diff --git a/Scripts/ej/web/ej.pager.min.js b/Scripts/ej/web/ej.pager.min.js index 7559a169..45f8f9c5 100644 --- a/Scripts/ej/web/ej.pager.min.js +++ b/Scripts/ej/web/ej.pager.min.js @@ -7,4 +7,4 @@ * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ -(function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min"],n):n()})(function(){(function(n,t,i){t.widget("ejPager","ej.Pager",{_rootCSS:"e-pager",validTags:["div"],defaults:{pageSize:12,pageCount:10,currentPage:1,enableExternalMessage:!1,externalMessage:"",pageSizeMessage:"",enableQueryString:!1,locale:"en-US",masterObject:null,click:null,enableRTL:!1,totalRecordsCount:null,totalPages:null,customText:"",showPageInfo:!0,cssClass:"",enabled:!0,showGoToPage:!1,isResponsive:!1},_init:function(){this._initPrivateProperties();this.model.enableQueryString&&this._queryStringValue();this.renderPager();this.model.isResponsive&&this._reSizeHandler();this._wireResizing();this._wireEvents();this.refreshPager()},_initPrivateProperties:function(){this._pageSize=this.model.pageSize.length>0?this.model.pageSize[0]:this.model.pageSize;this._links=[];this._$prev=null;this._$first=null;this._$PP=null;this._$NP=null;this._lastNP=!1;this._lastpageCount=null;this._$last=null;this._$next=null;this._prevPageNo=null;this.localizedLabels=this._getLocalizedLabels();this._intervalWid=0;this._msgWidth=0;this._gotoWid=0},_wireEvents:function(){var n=this;this._on(this.element,"click",this._pagerClickHandler)},_hidedrop:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_wireResizing:function(){this._refreshDropandTextItems();n(window).bind("resize",this.model.isResponsive?n.proxy(this._reSizeHandler,this):n.proxy(this._unWireResizing,this))},_unWireResizing:function(){this._refreshDropandTextItems();this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();n(window).unbind("resize",n.proxy(this._reSizeHandler,this))},_reSizeHandler:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();controlwidth=this._intervalWid+this._gotoWid+this.element.find(".e-pagercontainer").outerWidth()+this._msgWidth;controlwidth>this.element.outerWidth()-20?this._msgWidth>0&&this.element.find(".e-parentmsgbar").addClass("e-msg-res"):this._msgWidth>0&&this.element.find(".e-parentmsgbar").removeClass("e-msg-res");this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen());this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()>40&&(this.option("pageCount",this._maxPageCount),this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen()));this._refreshDropandTextItems()},_refreshDropandTextItems:function(){this.numTextbox&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-parentmsgbar").position().top?this.numTextbox.addClass("e-pager-goto-res"):this.numTextbox.removeClass("e-pager-goto-res"));this.pageInterval_wrap&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-pager-itemsinterval").position().top?this.element.find(".e-pager-itemsinterval").addClass("e-pager-goto-res"):this.element.find(".e-pager-itemsinterval").removeClass("e-pager-goto-res"))},renderPager:function(){var n=t.buildTag("div.e-pagercontainer","",{},{unselectable:"on"});this._renderPagerContainer(n);this.element[0].appendChild(n[0]);this._pageInfo();this.model.showGoToPage&&this._renderTextboxItem();this.model.pageSize.length>0&&this._renderDropdownlist();this.model.enableExternalMessage&&this._renderPagerMessage();this.model.enableRTL&&this.element.addClass("e-rtl");this.model.enabled||this._disable();this._cssClass=this.model.cssClass;this.element.addClass(this.model.cssClass)},_removeDropdownlist:function(){this.pageInterval_wrap.remove();this.$textspan=null;this.$dropItem=null},_renderDropdownlist:function(){var i=this,r;this.pageInterval_wrap=t.buildTag("div.e-pager-itemsinterval","",{},{unselectable:"on"});r=t.buildTag("div.e-drpdwndiv e-icon e-arrow-sans-down","",{},{unselectable:"on"});this.$textspan=t.buildTag("span.e-text");this.sizeIntervals=this.model.pageSize;r.appendTo(this.pageInterval_wrap);this.pageInterval_wrap.appendTo(this.element);this.pageInterval_wrap.insertBefore(this._parentMsgBar);this.$textspan.appendTo(r);i.$textspan.text(this.model.pageSize[0]);this.$dropItem=t.buildTag("ul.e-drpdwn e-ul");this._renderItems();this.$dropItem.appendTo(r);this._renderPageSizeMessage();r.on("click",function(){i.$dropItem.css("display")!="none"?i.$dropItem.hide():i.model.enabled&&i.$dropItem.show()});this.$dropItem.hide();this.$dropItem.find("li").on("click",function(){i.$dropItem.find("li.e-active").removeClass("e-active");n(this).addClass("e-active");i._pageSize=n(this).text();i.$textspan.text(n(this).text());i.refreshPager();i._trigger("pageSizeSelected",{pageSize:i._pageSize})});this._intervalWid=this.element.find(".e-pager-itemsinterval").outerWidth()},_renderPageSizeMessage:function(){var n=t.buildTag("div.e-interval-msg");n.appendTo(this.pageInterval_wrap);this.model.pageSizeMessage.toString().length?n.html(this.model.pageSizeMessage):n.hide()},_renderItems:function(){var i=this;n(this.model.pageSize).each(function(){li=t.buildTag("li");li.text(this);i.$dropItem.append(li)});this.$dropItem.find("li").first().addClass("e-active")},_queryStringValue:function(){var n=new RegExp("[\\?&]page=([^&#]*)").exec(window.location.href);this.model.currentPage=n?parseInt(n[1]||1):1},_renderPagerMessage:function(){var n=t.buildTag("div.e-pagermessage");this.model.externalMessage.toString().length?n.html(this.model.externalMessage):n.hide();this.element.append(n)},_removePagerMessage:function(){this.element.find("div.e-pagermessage").remove()},_mouseScroll:function(n){n.keyCode=="38"?this._updateField("increment"):n.keyCode=="40"&&this._updateField("decrement")},_updateField:function(n){var i=1;this.numTextbox.val()===""?this.numTextbox()=1:this.numTextbox.val().indexOf(" ")>=1&&(this.numTextbox.val()=this._textBox.val().replace(" ",""));this.model.currentPage=t.parseFloat(this.numTextbox.val(),this.model.locale);isNaN(this.model.currentPage)&&!this.model.currentPage&&(this.model.currentPage=1);this.model.currentPage>=1&&this.model.currentPage>this.model.totalPages?(this.model.currentPage=this.model.totalPages,this.numTextbox.val(this.model.currentPage)):this.model.currentPage<1&&this.model.currentPage<=this.model.totalPages?(this.model.currentPage=1,this.numTextbox.val(this.model.currentPage)):this.model.currentPage>=1&&this.model.currentPage<=this.model.totalPages&&(value=n=="increment"?this.model.currentPage+i:this.model.currentPage-i,value>=1&&value<=this.model.totalPages&&(this.numTextbox.val(value),this.model.currentPage=value));this.refreshPager()},_renderTextboxItem:function(){proxy=this;var i=t.buildTag("input#"+this.element[0].id+"_numtext","",{},{type:"textbox"});n(i).appendTo(this._parentMsgBar).insertBefore(n(this._parentMsgBar).find("span"));this.numTextbox=i;this.numTextbox.height(this.element.find(".e-pagercontainer .e-numericcontainer a").outerHeight());this.numTextbox.width(35);this.numTextbox.addClass("e-gototextbox e-textbox");this.model.showGoToPage||this.numTextbox.hide();this._gotoWid=n(this.numTextbox).outerWidth();this._on(n(this.numTextbox),"keydown",this._mouseScroll);this._on(this.numTextbox,"focusout",function(n){n.currentTarget.value=parseInt(n.currentTarget.value);var t=/^[0-9]*$/.test(parseInt(n.currentTarget.value));if(!t)return proxy.numTextbox.val(proxy.model.currentPage),!1;proxy.model.currentPage!=parseInt(n.currentTarget.value)&&(parseInt(n.currentTarget.value)>1&&parseInt(n.currentTarget.value)<=proxy.model.totalPages?(proxy.model.currentPage=parseInt(n.currentTarget.value),proxy.refreshPager()):proxy.numTextbox.val(this.model.currentPage))})},_renderPagerContainer:function(n){this._renderBackwardButton(n);this._renderpreviousPager(n);this._renderNumericItem(n);this._renderForwardPager(n);this._renderForwardButton(n)},_renderMsgBar:function(){var n=t.buildTag("span.e-pagermsg",String.format(this.localizedLabels.pagerInfo,this.model.currentPage,this.model.totalPages||0,this.model.totalRecordsCount||0));this._parentMsgBar.appendChild(n[0]);this._parentMsgBar.style.textAlign=t.TextAlign.Right},_renderpreviousPager:function(n){this._$PP=t.buildTag("a.e-link e-nextprevitemdisabled e-disable e-spacing e-PP","...",{},{title:this.localizedLabels.previousPagerTooltip,role:"link"});n.append(this._$PP)},_renderForwardPager:function(n){this._$NP=t.buildTag("a.e-link e-NP e-numericitem e-spacing e-default","...",{},{title:this.localizedLabels.nextPagerTooltip,role:"link"});n.append(this._$NP)},_renderBackwardButton:function(n){this._$first=t.buildTag("div.e-firstpage e-icon e-mediaback e-firstpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.firstPageTooltip});this._$prev=t.buildTag("div.e-prevpage e-icon e-arrowheadleft-2x e-prevpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.previousPageTooltip});n.append(this._$first);n.append(this._$prev)},_renderNumericItem:function(n){var i=t.buildTag("div.e-numericcontainer e-default","",{},{unselectable:"on"});this._renderNumericLinks(i,this.model.pageCount);n.append(i);this._maxPageCount=this.model.pageCount},_renderNumericLinks:function(n){var i,r;for(n.empty(),this.model.pageCount=Math.round(this.model.pageCount),i=1;i<=this.model.pageCount;i++)r=t.buildTag("a.e-link",this.model.customText+i,{},{role:"link"}).addClass("e-numericitem e-spacing e-default").data("index",i),i==this.model.currentPage&&r.removeClass("e-default").addClass("e-currentitem e-active"),n.append(r);this._links=n.children()},_renderForwardButton:function(n){this._$next=t.buildTag("div.e-nextpage e-icon e-arrowheadright-2x e-default","",{},{unselectable:"on",title:this.localizedLabels.nextPageTooltip});this._$last=t.buildTag("div.e-lastpage e-icon e-mediaforward e-default","",{},{unselectable:"on",title:this.localizedLabels.lastPageTooltip});n.append(this._$next);n.append(this._$last)},_setLocale:function(){this.localizedLabels=this._getLocalizedLabels();this._$first.attr("title",this.localizedLabels.firstPageTooltip);this._$prev.attr("title",this.localizedLabels.previousPageTooltip);this._$next.attr("title",this.localizedLabels.nextPageTooltip);this._$last.attr("title",this.localizedLabels.lastPageTooltip);this._$NP.attr("title",this.localizedLabels.nextPagerTooltip);this._$NP.attr("title",this.localizedLabels.previousPagerTooltip)},_applyCss:function(){this.model.currentPage>1?(this._$prev.removeClass("e-prevpagedisabled").removeClass("e-disable").addClass("e-prevpage e-default"),this._$first.removeClass("e-firstpagedisabled").removeClass("e-disable").addClass("e-firstpage e-default")):(this._$prev.addClass("e-prevpagedisabled e-disable").removeClass("e-prevpage").removeClass("e-default"),this._$first.addClass("e-firstpagedisabled e-disable").removeClass("e-firstpage").removeClass("e-default"));this.model.currentPage>this.model.pageCount?this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastNP=this._links.length&&parseInt(this._links[0].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>this.model.totalPages?!0:!1;this._lastNP==!1?this._$NP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastpageCount=this.model.totalPages%this.model.pageCount;this._lastpageCount==0&&(this._lastpageCount=this.model.pageCount);this.model.currentPage>this.model.totalPages-this._LastpageCount&&(this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"));this.model.currentPage==this.model.totalPages||this.model.totalRecordsCount==0?(this._$last.addClass("e-lastpagedisabled e-disable").removeClass("e-lastpage").removeClass("e-default"),this._$next.addClass("e-nextpagedisabled e-disable").removeClass("e-nextpage").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default")):(this._$last.addClass("e-lastpage e-default").removeClass("e-lastpagedisabled").removeClass("e-disable"),this._$next.addClass("e-nextpage e-default").removeClass("e-nextpagedisabled").removeClass("e-disable"));this._links.length&&(this._links.removeClass("e-currentitem").removeClass("e-active").addClass("e-default"),n(this._links[(this.model.currentPage-1)%this.model.pageCount]).removeClass("e-default").addClass("e-currentitem e-active"),n(this._links[(this._prevPageNo-1)%this.model.pageCount]).removeClass("e-default").addClass("e-numericitem"));this._pageSize>=this.model.totalRecordsCount/this.model.pageCount&&this._$PP!=null&&this._$PP.length!=0&&(this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"))},_SetTotalPages:function(){this.model.totalPages=this.model.totalRecordsCount%this._pageSize==0?this.model.totalRecordsCount/this._pageSize:parseInt(this.model.totalRecordsCount/this._pageSize,10)+1},_refreshNumericItem:function(){var i,t,r;if(this._links.length!=0&&this._links!=null)for(this.model.currentPage=this.model.totalPages==1?1:this.model.currentPage,this.model.currentPage>this.model.totalPages&&this.model.totalPages!=0&&(this.model.currentPage=this.model.totalPages),i=parseInt(this.model.currentPage/this.model.pageCount,10),this.model.currentPage%this.model.pageCount==0&&i>0&&(i=i-1),this._links.css("display","none"),t=0;t=this.model.totalPages&&(this._lastNP=!0)):this.model.currentPage++:r.hasClass("e-prevpage")&&r.hasClass("e-prevpagedisabled")!=!0?(this.model.currentPage%this.model.pageCount==1&&(this._lastNP=!1),this.model.currentPage--,this.model.currentPage<0&&(this.model.currentPage=0)):r.hasClass("e-lastpage")&&r.hasClass("e-lastpagedisabled")!=!0?(this._LastpageCount=this.model.totalPages%this.model.pageCount,this._LastpageCount==0?this._LastpageCount=this.model.pageCount:null,this.model.currentPage=this.model.totalPages,this._lastNP=!0):r.hasClass("e-firstpage")&&r.hasClass("e-firstpagedisabled")!=!0?(this.model.currentPage=1,this._lastNP=!1):r.hasClass("e-NP")&&r.hasClass("e-nextprevitemdisabled")!=!0?(this._links!=i&&(this.model.currentPage=parseInt(n(this._links[0]).data("index"),10)+this.model.pageCount),parseInt(this._links[this.model.pageCount-1].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>=this.model.totalPages&&(this._lastNP=!0,this._LastpageCount=this.model.totalRecordsCount-this._pageSize=1&&n<=this.model.totalPages?(this.model.currentPage=n,this.model.enableQueryString&&this._updateQueryString(this.model.currentPage),this._trigger("click",{currentPage:n,event:t})):this._trigger("click",{currentPage:n,event:t})},_updateQueryString:function(n){var t=this._getUpdatedURL(window.location.href,"page",n);history.pushState?window.history.pushState({path:t},"",t):window.location.href=t},_getUpdatedURL:function(n,t,i){var u=new RegExp("([?|&])"+t+"=.*?(&|#|$)","i"),r,f;return n.match(u)?n.replace(u,"$1"+t+"="+i+"$2"):(r="",f=n.indexOf("?")!==-1?"&":"?",n.indexOf("#")!==-1&&(r=n.replace(/.*#/,"#"),n=n.replace(/#.*/,"")),n+f+t+"="+i+r)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_fillScreen:function(){var t=this.element.find(".e-pagercontainer").outerWidth()-(this._$first.outerWidth()+this._$last.outerWidth()+this._$next.outerWidth()+this._$prev.outerWidth());t-=this._$NP.hasClass("e-disable")?0:this._$NP.outerWidth();t-=this._$PP.hasClass("e-disable")?0:this._$PP.outerWidth();this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1<1?this._flag?this.option("pageCount",1):this.model.pageCount=1:this._flag?this.option("pageCount",Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1):this.model.pageCount=Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1)},_enable:function(){this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.numTextbox&&this.numTextbox.addClass("e-disable")},_disable:function(){this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.prop("disabled","disabled");this.numTextbox&&this.numTextbox.removeClass("e-disable");this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"pageCount":this._renderNumericLinks(this.element.find(".e-numericcontainer"));this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen());this._flag=!1;break;case"enableExternalMessage":n[t]?this._renderPagerMessage():this._removePagerMessage();break;case"showPageInfo":this._pageInfo();break;case"pageSizeMessage":n[t]!=null&&this._renderPageSizeMessage();break;case"pageSize":this._pageSize=this.model.pageSize;n[t].length>0?(this._pageSize=this.model.pageSize[0],this.$dropItem?(this.$dropItem.find("li").remove(),this._renderItems()):this._renderDropdownlist()):this.$dropItem&&this._removeDropdownlist();break;case"enabled":n[t]?this._enable():this._disable();break;case"cssClass":this.element.removeClass(this._cssClass).addClass(n[t]);this._cssClass=this.model.cssClass;case"isResponsive":this._wireResizing();n[t]?this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen()):this.option("pageCount",this._maxPageCount);this._flag=!1;break;case"showGoToPage":n[t]?this._renderTextboxItem():this.numTextbox&&this.numTextbox.remove();break;case"locale":this._setLocale()}this.refreshPager()},_destroy:function(){this.element.empty().removeClass("e-pager");this._unWireResizing()}});t.Pager.Locale=t.Pager.Locale||{};t.Pager.Locale["default"]=t.Pager.Locale["en-US"]={pagerInfo:"{0} of {1} pages ({2} items)",firstPageTooltip:"Go to first page",lastPageTooltip:"Go to last page",nextPageTooltip:"Go to next page",previousPageTooltip:"Go to previous page",nextPagerTooltip:"Go to next pager",previousPagerTooltip:"Go to previous pager"}})(jQuery,Syncfusion)}); +(function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min"],n):n()})(function(){(function(n,t,i){t.widget("ejPager","ej.Pager",{_rootCSS:"e-pager",validTags:["div"],defaults:{pageSize:12,pageCount:10,currentPage:1,enableExternalMessage:!1,externalMessage:"",pageSizeMessage:"",enableQueryString:!1,locale:"en-US",masterObject:null,click:null,enableRTL:!1,totalRecordsCount:null,totalPages:null,customText:"",showPageInfo:!0,cssClass:"",enabled:!0,showGoToPage:!1,isResponsive:!1},_init:function(){this._initPrivateProperties();this.model.enableQueryString&&this._queryStringValue();this.renderPager();this.model.isResponsive&&this._reSizeHandler();this._wireResizing();this._wireEvents();this.refreshPager()},_initPrivateProperties:function(){this._pageSize=this.model.pageSize.length>0?this.model.pageSize[0]:this.model.pageSize;this._links=[];this._$prev=null;this._$first=null;this._$PP=null;this._$NP=null;this._lastNP=!1;this._lastpageCount=null;this._$last=null;this._$next=null;this._prevPageNo=null;this.localizedLabels=this._getLocalizedLabels();this._intervalWid=0;this._msgWidth=0;this._gotoWid=0},_wireEvents:function(){var n=this;this._on(this.element,"click",this._pagerClickHandler)},_hidedrop:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_wireResizing:function(){this._refreshDropandTextItems();n(window).bind("resize",this.model.isResponsive?n.proxy(this._reSizeHandler,this):n.proxy(this._unWireResizing,this))},_unWireResizing:function(){this._refreshDropandTextItems();this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();n(window).unbind("resize",n.proxy(this._reSizeHandler,this))},_reSizeHandler:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();controlwidth=this._intervalWid+this._gotoWid+this.element.find(".e-pagercontainer").outerWidth()+this._msgWidth;controlwidth>this.element.outerWidth()-20?this._msgWidth>0&&this.element.find(".e-parentmsgbar").addClass("e-msg-res"):this._msgWidth>0&&this.element.find(".e-parentmsgbar").removeClass("e-msg-res");this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen());this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()>40&&(this.option("pageCount",this._maxPageCount),this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen()));this._refreshDropandTextItems()},_refreshDropandTextItems:function(){this.numTextbox&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-parentmsgbar").position().top?this.numTextbox.addClass("e-pager-goto-res"):this.numTextbox.removeClass("e-pager-goto-res"));this.pageInterval_wrap&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-pager-itemsinterval").position().top?this.element.find(".e-pager-itemsinterval").addClass("e-pager-goto-res"):this.element.find(".e-pager-itemsinterval").removeClass("e-pager-goto-res"))},renderPager:function(){var n=t.buildTag("div.e-pagercontainer","",{},{unselectable:"on"});this._renderPagerContainer(n);this.element[0].appendChild(n[0]);this._pageInfo();this.model.showGoToPage&&this._renderTextboxItem();this.model.pageSize.length>0&&this._renderDropdownlist();this.model.enableExternalMessage&&this._renderPagerMessage();this.model.enableRTL&&this.element.addClass("e-rtl");this.model.enabled||this._disable();this._cssClass=this.model.cssClass;this.element.addClass(this.model.cssClass)},_removeDropdownlist:function(){this.pageInterval_wrap.remove();this.$textspan=null;this.$dropItem=null},_renderDropdownlist:function(){var i=this,r;this.pageInterval_wrap=t.buildTag("div.e-pager-itemsinterval","",{},{unselectable:"on"});r=t.buildTag("div.e-drpdwndiv e-icon e-arrow-sans-down","",{},{unselectable:"on"});this.$textspan=t.buildTag("span.e-text");this.sizeIntervals=this.model.pageSize;r.appendTo(this.pageInterval_wrap);this.pageInterval_wrap.appendTo(this.element);this.pageInterval_wrap.insertBefore(this._parentMsgBar);this.$textspan.appendTo(r);i.$textspan.text(this.model.pageSize[0]);this.$dropItem=t.buildTag("ul.e-drpdwn e-ul");this._renderItems();this.$dropItem.appendTo(r);this._renderPageSizeMessage();r.on("click",function(){i.$dropItem.css("display")!="none"?i.$dropItem.hide():i.model.enabled&&i.$dropItem.show()});this.$dropItem.hide();this.$dropItem.find("li").on("click",function(){i.$dropItem.find("li.e-active").removeClass("e-active");n(this).addClass("e-active");i._pageSize=n(this).text();i.$textspan.text(n(this).text());i.refreshPager();i._trigger("pageSizeSelected",{pageSize:i._pageSize})});this._intervalWid=this.element.find(".e-pager-itemsinterval").outerWidth()},_renderPageSizeMessage:function(){var n=t.buildTag("div.e-interval-msg");n.appendTo(this.pageInterval_wrap);this.model.pageSizeMessage.toString().length?n.html(this.model.pageSizeMessage):n.hide()},_renderItems:function(){var i=this;n(this.model.pageSize).each(function(){li=t.buildTag("li");li.text(this);i.$dropItem.append(li)});this.$dropItem.find("li").first().addClass("e-active")},_queryStringValue:function(){var n=new RegExp("[\\?&]page=([^&#]*)").exec(window.location.href);this.model.currentPage=n?parseInt(n[1]||1):1},_renderPagerMessage:function(){var n=t.buildTag("div.e-pagermessage");this.model.externalMessage.toString().length?n.html(this.model.externalMessage):n.hide();this.element.append(n)},_removePagerMessage:function(){this.element.find("div.e-pagermessage").remove()},_mouseScroll:function(n){n.keyCode=="38"?this._updateField("increment"):n.keyCode=="40"&&this._updateField("decrement")},_updateField:function(n){var i=1;this.numTextbox.val()==""?this.numTextbox.val(1):this.numTextbox.val().indexOf(" ")>=1&&this.numTextbox.val(this._textBox.val().replace(" ",""));this.model.currentPage=t.parseFloat(this.numTextbox.val(),this.model.locale);isNaN(this.model.currentPage)&&!this.model.currentPage&&(this.model.currentPage=1);this.model.currentPage>=1&&this.model.currentPage>this.model.totalPages?(this.model.currentPage=this.model.totalPages,this.numTextbox.val(this.model.currentPage)):this.model.currentPage<1&&this.model.currentPage<=this.model.totalPages?(this.model.currentPage=1,this.numTextbox.val(this.model.currentPage)):this.model.currentPage>=1&&this.model.currentPage<=this.model.totalPages&&(value=n=="increment"?this.model.currentPage+i:this.model.currentPage-i,value>=1&&value<=this.model.totalPages&&(this.numTextbox.val(value),this.model.currentPage=value));this.refreshPager()},_renderTextboxItem:function(){proxy=this;var i=t.buildTag("input#"+this.element[0].id+"_numtext","",{},{type:"textbox"});n(i).appendTo(this._parentMsgBar).insertBefore(n(this._parentMsgBar).find("span"));this.numTextbox=i;this.numTextbox.height(this.element.find(".e-pagercontainer .e-numericcontainer a").outerHeight());this.numTextbox.width(35);this.numTextbox.addClass("e-gototextbox e-textbox");this.model.showGoToPage||this.numTextbox.hide();this._gotoWid=n(this.numTextbox).outerWidth();this._on(n(this.numTextbox),"keydown",this._mouseScroll);this._on(this.numTextbox,"focusout",function(n){n.currentTarget.value=parseInt(n.currentTarget.value);var t=/^[0-9]*$/.test(parseInt(n.currentTarget.value));if(!t)return proxy.numTextbox.val(proxy.model.currentPage),!1;proxy.model.currentPage!=parseInt(n.currentTarget.value)&&(parseInt(n.currentTarget.value)>1&&parseInt(n.currentTarget.value)<=proxy.model.totalPages?(proxy.model.currentPage=parseInt(n.currentTarget.value),proxy.refreshPager()):proxy.numTextbox.val(this.model.currentPage))})},_renderPagerContainer:function(n){this._renderBackwardButton(n);this._renderpreviousPager(n);this._renderNumericItem(n);this._renderForwardPager(n);this._renderForwardButton(n)},_renderMsgBar:function(){var n=t.buildTag("span.e-pagermsg",String.format(this.localizedLabels.pagerInfo,this.model.currentPage,this.model.totalPages||0,this.model.totalRecordsCount||0));this._parentMsgBar.appendChild(n[0]);this._parentMsgBar.style.textAlign=t.TextAlign.Right},_renderpreviousPager:function(n){this._$PP=t.buildTag("a.e-link e-nextprevitemdisabled e-disable e-spacing e-PP","...",{},{title:this.localizedLabels.previousPagerTooltip,role:"link"});n.append(this._$PP)},_renderForwardPager:function(n){this._$NP=t.buildTag("a.e-link e-NP e-numericitem e-spacing e-default","...",{},{title:this.localizedLabels.nextPagerTooltip,role:"link"});n.append(this._$NP)},_renderBackwardButton:function(n){this._$first=t.buildTag("div.e-firstpage e-icon e-mediaback e-firstpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.firstPageTooltip});this._$prev=t.buildTag("div.e-prevpage e-icon e-arrowheadleft-2x e-prevpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.previousPageTooltip});n.append(this._$first);n.append(this._$prev)},_renderNumericItem:function(n){var i=t.buildTag("div.e-numericcontainer e-default","",{},{unselectable:"on"});this._renderNumericLinks(i,this.model.pageCount);n.append(i);this._maxPageCount=this.model.pageCount},_renderNumericLinks:function(n){var i,r;for(n.empty(),this.model.pageCount=Math.round(this.model.pageCount),i=1;i<=this.model.pageCount;i++)r=t.buildTag("a.e-link",this.model.customText+i,{},{role:"link"}).addClass("e-numericitem e-spacing e-default").data("index",i),i==this.model.currentPage&&r.removeClass("e-default").addClass("e-currentitem e-active"),n.append(r);this._links=n.children()},_renderForwardButton:function(n){this._$next=t.buildTag("div.e-nextpage e-icon e-arrowheadright-2x e-default","",{},{unselectable:"on",title:this.localizedLabels.nextPageTooltip});this._$last=t.buildTag("div.e-lastpage e-icon e-mediaforward e-default","",{},{unselectable:"on",title:this.localizedLabels.lastPageTooltip});n.append(this._$next);n.append(this._$last)},_setLocale:function(){this.localizedLabels=this._getLocalizedLabels();this._$first.attr("title",this.localizedLabels.firstPageTooltip);this._$prev.attr("title",this.localizedLabels.previousPageTooltip);this._$next.attr("title",this.localizedLabels.nextPageTooltip);this._$last.attr("title",this.localizedLabels.lastPageTooltip);this._$NP.attr("title",this.localizedLabels.nextPagerTooltip);this._$NP.attr("title",this.localizedLabels.previousPagerTooltip)},_applyCss:function(){this.model.currentPage>1?(this._$prev.removeClass("e-prevpagedisabled").removeClass("e-disable").addClass("e-prevpage e-default"),this._$first.removeClass("e-firstpagedisabled").removeClass("e-disable").addClass("e-firstpage e-default")):(this._$prev.addClass("e-prevpagedisabled e-disable").removeClass("e-prevpage").removeClass("e-default"),this._$first.addClass("e-firstpagedisabled e-disable").removeClass("e-firstpage").removeClass("e-default"));this.model.currentPage>this.model.pageCount?this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastNP=this._links.length&&parseInt(this._links[0].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>this.model.totalPages?!0:!1;this._lastNP==!1?this._$NP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastpageCount=this.model.totalPages%this.model.pageCount;this._lastpageCount==0&&(this._lastpageCount=this.model.pageCount);this.model.currentPage>this.model.totalPages-this._LastpageCount&&(this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"));this.model.currentPage==this.model.totalPages||this.model.totalRecordsCount==0?(this._$last.addClass("e-lastpagedisabled e-disable").removeClass("e-lastpage").removeClass("e-default"),this._$next.addClass("e-nextpagedisabled e-disable").removeClass("e-nextpage").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default")):(this._$last.addClass("e-lastpage e-default").removeClass("e-lastpagedisabled").removeClass("e-disable"),this._$next.addClass("e-nextpage e-default").removeClass("e-nextpagedisabled").removeClass("e-disable"));this._links.length&&(this._links.removeClass("e-currentitem").removeClass("e-active").addClass("e-default"),n(this._links[(this.model.currentPage-1)%this.model.pageCount]).removeClass("e-default").addClass("e-currentitem e-active"),n(this._links[(this._prevPageNo-1)%this.model.pageCount]).removeClass("e-default").addClass("e-numericitem"));this._pageSize>=this.model.totalRecordsCount/this.model.pageCount&&this._$PP!=null&&this._$PP.length!=0&&(this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"))},_SetTotalPages:function(){this.model.totalPages=this.model.totalRecordsCount%this._pageSize==0?this.model.totalRecordsCount/this._pageSize:parseInt(this.model.totalRecordsCount/this._pageSize,10)+1},_refreshNumericItem:function(){var i,t,r;if(this._links.length!=0&&this._links!=null)for(this.model.currentPage=this.model.totalPages==1?1:this.model.currentPage,this.model.currentPage>this.model.totalPages&&this.model.totalPages!=0&&(this.model.currentPage=this.model.totalPages),i=parseInt(this.model.currentPage/this.model.pageCount,10),this.model.currentPage%this.model.pageCount==0&&i>0&&(i=i-1),this._links.css("display","none"),t=0;t=this.model.totalPages&&(this._lastNP=!0)):this.model.currentPage++:r.hasClass("e-prevpage")&&r.hasClass("e-prevpagedisabled")!=!0?(this.model.currentPage%this.model.pageCount==1&&(this._lastNP=!1),this.model.currentPage--,this.model.currentPage<0&&(this.model.currentPage=0)):r.hasClass("e-lastpage")&&r.hasClass("e-lastpagedisabled")!=!0?(this._LastpageCount=this.model.totalPages%this.model.pageCount,this._LastpageCount==0?this._LastpageCount=this.model.pageCount:null,this.model.currentPage=this.model.totalPages,this._lastNP=!0):r.hasClass("e-firstpage")&&r.hasClass("e-firstpagedisabled")!=!0?(this.model.currentPage=1,this._lastNP=!1):r.hasClass("e-NP")&&r.hasClass("e-nextprevitemdisabled")!=!0?(this._links!=i&&(this.model.currentPage=parseInt(n(this._links[0]).data("index"),10)+this.model.pageCount),parseInt(this._links[this.model.pageCount-1].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>=this.model.totalPages&&(this._lastNP=!0,this._LastpageCount=this.model.totalRecordsCount-this._pageSize=1&&n<=this.model.totalPages?(this.model.currentPage=n,this.model.enableQueryString&&this._updateQueryString(this.model.currentPage),this._trigger("click",{currentPage:n,event:t})):this._trigger("click",{currentPage:n,event:t})},_updateQueryString:function(n){var t=this._getUpdatedURL(window.location.href,"page",n);history.pushState?window.history.pushState({path:t},"",t):window.location.href=t},_getUpdatedURL:function(n,t,i){var u=new RegExp("([?|&])"+t+"=.*?(&|#|$)","i"),r,f;return n.match(u)?n.replace(u,"$1"+t+"="+i+"$2"):(r="",f=n.indexOf("?")!==-1?"&":"?",n.indexOf("#")!==-1&&(r=n.replace(/.*#/,"#"),n=n.replace(/#.*/,"")),n+f+t+"="+i+r)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_fillScreen:function(){var t=this.element.find(".e-pagercontainer").outerWidth()-(this._$first.outerWidth()+this._$last.outerWidth()+this._$next.outerWidth()+this._$prev.outerWidth());t-=this._$NP.hasClass("e-disable")?0:this._$NP.outerWidth();t-=this._$PP.hasClass("e-disable")?0:this._$PP.outerWidth();this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1<1?this._flag?this.option("pageCount",1):this.model.pageCount=1:this._flag?this.option("pageCount",Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1):this.model.pageCount=Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1)},_enable:function(){this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.numTextbox&&this.numTextbox.addClass("e-disable")},_disable:function(){this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.prop("disabled","disabled");this.numTextbox&&this.numTextbox.removeClass("e-disable");this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"pageCount":this._renderNumericLinks(this.element.find(".e-numericcontainer"));this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen());this._flag=!1;break;case"enableExternalMessage":n[t]?this._renderPagerMessage():this._removePagerMessage();break;case"showPageInfo":this._pageInfo();break;case"pageSizeMessage":n[t]!=null&&this._renderPageSizeMessage();break;case"pageSize":this._pageSize=this.model.pageSize;n[t].length>0?(this._pageSize=this.model.pageSize[0],this.$dropItem?(this.$dropItem.find("li").remove(),this._renderItems()):this._renderDropdownlist()):this.$dropItem&&this._removeDropdownlist();break;case"enabled":n[t]?this._enable():this._disable();break;case"cssClass":this.element.removeClass(this._cssClass).addClass(n[t]);this._cssClass=this.model.cssClass;case"isResponsive":this._wireResizing();n[t]?this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen()):this.option("pageCount",this._maxPageCount);this._flag=!1;break;case"showGoToPage":n[t]?this._renderTextboxItem():this.numTextbox&&this.numTextbox.remove();break;case"locale":this._setLocale()}this.refreshPager()},_destroy:function(){this.element.empty().removeClass("e-pager");this._unWireResizing()}});t.Pager.Locale=t.Pager.Locale||{};t.Pager.Locale["default"]=t.Pager.Locale["en-US"]={pagerInfo:"{0} of {1} pages ({2} items)",firstPageTooltip:"Go to first page",lastPageTooltip:"Go to last page",nextPageTooltip:"Go to next page",previousPageTooltip:"Go to previous page",nextPagerTooltip:"Go to next pager",previousPagerTooltip:"Go to previous pager"}})(jQuery,Syncfusion)}); diff --git a/Scripts/ej/web/ej.web.all.min.js b/Scripts/ej/web/ej.web.all.min.js index 02c33f71..b5fc5cde 100644 --- a/Scripts/ej/web/ej.web.all.min.js +++ b/Scripts/ej/web/ej.web.all.min.js @@ -1,4 +1,4 @@ -/*! +/*! * filename: ej.web.all.min.js * version : 15.2.0.40 * Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. @@ -7,4 +7,4 @@ * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ -var LookupCachingMode,CalcQuickBase,FormulaInfoSetAction,FormulaInfoHashtable,HashTable,ejDateRangePicker,ejTooltip,Print,clipboardCleaner,documentManager,Heatmap,HeatmapLegend,RecurrenceEditor,InternalAdaptive,InternalScroller,InternalSelection,InternalFilter,InternalDragAndDrop,InternalEdit,InternalContext,InternalSwimlane,InternalCommon,Kanban,ejSignature,SpellCheck,_sideBySeriesPadding,ejSparkline,__extends,ejSunburstChart;window.ej=window.Syncfusion=window.Syncfusion||{},function(n,t,i){"use strict";var o,u,f,e;t.version="15.2.0.40";t.consts={NamespaceJoin:"-"};t.TextAlign={Center:"center",Justify:"justify",Left:"left",Right:"right"};t.Orientation={Horizontal:"horizontal",Vertical:"vertical"};t.serverTimezoneOffset=0;t.persistStateVersion=null;Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(n,t){return n[t]!==i});Date.prototype.toISOString||function(){function n(n){var t=String(n);return t.length===1&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+n(this.getUTCMonth()+1)+"-"+n(this.getUTCDate())+"T"+n(this.getUTCHours())+":"+n(this.getUTCMinutes())+":"+n(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();String.format=function(){for(var t=arguments[0],n=0;n");e=n("head").find("link").add("style");t.browserInfo().name==="msie"?(u="",e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.write("<\/head>"+u+f[0].innerHTML+"<\/body><\/html>")):(u="",r.document.write(""),e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.writeln(u+"<\/head>"),r.document.writeln(f[0].innerHTML+"<\/body><\/html>"));r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},1e3))},1e3)},ieClearRemover:function(t){var i=n(t).height();t.style.paddingTop=parseFloat(i/2)+"px";t.style.paddingBottom=parseFloat(i/2)+"px";t.style.height="1px";t.style.lineHeight="1px"},sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.successHandler,error:t.errorHandler,beforeSend:t.beforeSendHandler,complete:t.completeHandler})},buildTag:function(t,r,u,f){var s=/^[a-z]*[0-9a-z]+/ig.exec(t)[0],e=/#([_a-z]+[-_0-9a-z]+)/ig.exec(t),o;return e=e?e[e.length-1]:i,o=/\.([a-z]+[-_0-9a-z ]+)/ig.exec(t),o=o?o[o.length-1]:i,n(document.createElement(s)).attr(e?{id:e}:{}).addClass(o||"").css(u||{}).attr(f||{}).html(r||"")},_preventDefaultException:function(n,t){if(n)for(var i in t)if(t[i].test(n[i]))return!0;return!1},getMaxZindex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute"||n(t).css("position")=="fixed")return parseInt(n(t).css("z-index"))||1})),(t==i||t==null)&&(t=1),t},blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},getDimension:function(t,i){var e,u=n(t).parents().andSelf().filter(":hidden"),r,f;return u&&(r={visibility:"hidden",display:"block"},f=[],u.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];f.push(t)}),e=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),u.each(function(n){var i=f[n];for(var t in r)this.style[t]=i[t]})),e},transitionEndEvent:function(){return{"":"transitionend",webkit:"webkitTransitionEnd",Moz:"transitionend",O:"otransitionend",ms:"MSTransitionEnd"}[t.userAgent()]},animationEndEvent:function(){return{"":"animationend",webkit:"webkitAnimationEnd",Moz:"animationend",O:"webkitAnimationEnd",ms:"animationend"}[t.userAgent()]},startEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchstart":"mousedown"},endEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchend":"mouseup"},moveEvent:function(){return t.isTouchDevice()||n.support.hasPointer?n.support.hasPointer&&!t.isMobile()?"ejtouchmove":"touchmove":"mousemove"},cancelEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchcancel":"mousecancel"},tapEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"tap":"click"},tapHoldEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"taphold":"click"},isDevice:function(){return t.getBooleanVal(n("head"),"data-ej-forceset",!1)?t.getBooleanVal(n("head"),"data-ej-device",this._device()):this._device()},isPortrait:function(){var n=document.documentElement;return n&&n.clientWidth/n.clientHeight<1.1},isLowerResolution:function(){return window.innerWidth<=640&&t.isPortrait()&&t.isDevice()||window.innerWidth<=800&&!t.isDevice()||window.innerWidth<=800&&!t.isPortrait()&&t.isWindows()&&t.isDevice()||t.isMobile()},isIOSWebView:function(){return/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)},isAndroidWebView:function(){return!(typeof Android=="undefined")},isWindowsWebView:function(){return location.href.indexOf("x-wmapp")!=-1},_device:function(){return/Android|BlackBerry|iPhone|iPad|iPod|IEMobile|kindle|windows\sce|palm|smartphone|iemobile|mobile|pad|xoom|sch-i800|playbook/i.test(navigator.userAgent.toLowerCase())},isMobile:function(){return/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(navigator.userAgent.toLowerCase())&&/mobile/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-mobile",!1)===!0},isTablet:function(){return/ipad|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-tablet",!1)===!0||!t.isMobile()&&t.isDevice()},isTouchDevice:function(){return("ontouchstart"in window||window.navigator.msPointerEnabled&&t.isMobile())&&this.isDevice()},getClearString:function(t){return n.trim(t.replace(/\s+/g," ").replace(/(\r\n|\n|\r)/gm,"").replace(new RegExp(">[\n\t ]+<","g"),"><"))},getBooleanVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u.toLowerCase()=="true":r},_getSkewClass:function(n,t,i){var h=n.width(),c=n.height(),f=n.offset().left,e=n.offset().left+h,o=n.offset().top,s=n.offset().top+c,r=h*.3,u=c*.3;return te-r&&ie-r&&i>s-u?"e-m-skew-bottomright":ts-u?"e-m-skew-bottomleft":t>f+r&&ie-r?"e-m-skew-right":i>s-u?"e-m-skew-bottom":"e-m-skew-center"},_removeSkewClass:function(t){n(t).removeClass("e-m-skew-top e-m-skew-bottom e-m-skew-left e-m-skew-right e-m-skew-topleft e-m-skew-topright e-m-skew-bottomleft e-m-skew-bottomright e-m-skew-center e-skew-top e-skew-bottom e-skew-left e-skew-right e-skew-topleft e-skew-topright e-skew-bottomleft e-skew-bottomright e-skew-center")},_getObjectKeys:function(n){var t,i=[];if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},!Object.keys){for(t in n)n.hasOwnProperty(t)&&i.push(t);return i}if(Object.keys)return Object.keys(n)},_touchStartPoints:function(n,t){if(n){var i=n.touches?n.touches[0]:n;t._distX=0;t._distY=0;t._moved=!1;t._pointX=i.pageX;t._pointY=i.pageY}},_isTouchMoved:function(n,t){if(n){var i=n.touches?n.touches[0]:n,f=i.pageX-t._pointX,e=i.pageY-t._pointY,o=Date.now(),r,u;return t._pointX=i.pageX,t._pointY=i.pageY,t._distX+=f,t._distY+=e,r=Math.abs(t._distX),u=Math.abs(t._distY),!(r<5&&u<5)}},listenEvents:function(n,i,r,u,f,e){for(var o=0;o0)return e=i.parents(),f=n("body").children(),!t.isNullOrUndefined(i)&&i.length>0&&f.splice(f.index(r),1),n(f).each(function(n,t){e.push(t)}),u=Math.max.apply(u,n.map(e,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!u||u<1e4?u=1e4:u+=1,u},isValidAttr:function(t,i){var t=n(t)[0],r;return typeof t[i]!="undefined"?!0:(r=!1,n.each(t,function(n){if(n.toLowerCase()==i.toLowerCase())return r=!0,!1}),r)}};n.extend(t,t.util);t.widgetBase={droppables:{"default":[]},resizables:{"default":[]},_renderEjTemplate:function(i,r,u,f){var e=null;return((typeof i=="object"||i.startsWith("#")||i.startsWith("."))&&(e=n(i).attr("type")),e&&(e=e.toLowerCase(),t.template[e]))?t.template[e](this,i,r,u,f):t.template.render(this,i,r,u,f)},destroy:function(){var u,r,f,i;if(!this._trigger("destroy")){this.model.enablePersistence&&(this.persistState(),n(window).off("unload",this._persistHandler));try{this._destroy()}catch(e){}for(u=this.element.data("ejWidgets")||[],i=0;i-1,c){n.fn.off.apply(t,u?[i,r,f[3]]:[i,r]);e.splice(o,1);break}return this},_trigger:function(i,r){var f=null,e,u,s={},o,h;return(n.extend(s,r),i in this.model&&(f=this.model[i]),f&&(typeof f=="string"&&(f=t.util.getObject(f,window)),n.isFunction(f)&&(u=t.event(i,this.model,r),o=this.model._applyScope,e=f.call(this,u),o&&o.call(),r&&n.extend(r,u),u.cancel||!t.isNullOrUndefined(e))))?e===!1||u.cancel:(h=Boolean(r),r=r||{},r.originalEventType=i,r.type=this.pluginName+i,u=n.Event(r.type,t.event(r.type,this.model,r)),this.element&&this.element.trigger(u),h&&n.extend(r,u),t.isOnWebForms&&u.cancel==!1&&this.model.serverEvents&&this.model.serverEvents.length&&t.raiseWebFormsServerEvents(i,r,s),u.cancel)},setModel:function(t,i){var r,f,e,u;if(!this._trigger("modelChange",{changes:t})){for(r in t){if(!i){if(this.model[r]===t[r]){delete t[r];continue}if(n.isPlainObject(t[r])&&(o(this.model[r],t[r]),n.isEmptyObject(t[r]))){delete t[r];continue}}if(this.dataTypes&&(f=this._isValidModelValue(r,this.dataTypes,t),f!==!0))throw"setModel - Invalid input for property :"+r+" - "+f;this.model.notifyOnEachPropertyChanges&&this.model[r]!==t[r]&&(e={oldValue:this.model[r],newValue:t[r]},t[r]=this._trigger(r+"Change",e)?this.model[r]:e.newValue)}n.isEmptyObject(t)||(this._setFirst?(u=t.dataSource,u&&delete t.dataSource,n.extend(!0,this.model,t),u&&(this.model.dataSource=u instanceof Array?u.slice():u,t.dataSource=this.model.dataSource),this._setModel&&this._setModel(t)):this._setModel&&this._setModel(t)===!1||n.extend(!0,this.model,t),"enablePersistence"in t&&this._setState(t.enablePersistence))}},option:function(r,u,f){if(!r)return this.model;if(n.isPlainObject(r))return this.setModel(r,f);if(typeof r=="string"){r=r.replace(/^model\./,"");var e=t.getObject(r,this.model);if(u===i&&!f)return e;if(r==="enablePersistence")return this._setState(u);if(f&&u===t.extensions.modelGUID)return this._setModel(t.createObject(r,t.getObject(r,this.model),{}));if(f||t.getObject(r,this.model)!==u)return this.setModel(t.createObject(r,u,{}),f)}return i},_isValidModelValue:function(n,t,i){var r=t[n],u=i[n],f,e,o;if(!r)return!0;if(typeof r=="string"){if(r=="enum"&&(i[n]=u?u.toString().toLowerCase():u,r="string"),r==="array"){if(Object.prototype.toString.call(u)==="[object Array]")return!0}else if(r==="data"||r==="parent"||typeof u===r)return!0;return"Expected type - "+r}if(u instanceof Array){for(e=0;e=0){delete u[r];return}t.push(n);for(var f in n)n.hasOwnProperty(f)&&i(n[f],f,n);t.pop();return}}var t=[];return i(n,"obj",null),n},stringify:function(n,i){for(var f,u=this.observables,r=0;r"),u=t.preferredCulture(u)?u:"en-US",f=i,l=i.split("{0:"),a=i.split("}"),h=l[0],c=a[1],typeof r=="string"&&n.isNumeric(r)&&(r=Number(r)),i.indexOf("{0:")!=-1)return v=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),s=v.exec(i),s!=null&&r!=null?h!=null&&c!=null?h+t.format(r,s[2],u)+c:t.format(r,s[2],u):r!=null?r:"";if(f.startsWith("{")&&!f.startsWith("{0:")){var o=f.split(""),r=(r||"")+"",p=r.split(""),w=/[0aA\*CN<>\?]/gm;for(e=0,y=0;e0&&n.isPlainObject(p)&&(r=t.copyObject({},p)),!b){h.prototype._requiresID!==!0||n(this[y]).attr("id")||s.attr("id",c("ejControl_"));r&&typeof r!="object"?e(f+": methods/properties can be accessed only after plugin creation"):(h.prototype.defaults&&!t.isNullOrUndefined(t.setCulture)&&"locale"in h.prototype.defaults&&f!="ejChart"&&(!r||"locale"in r?t.isNullOrUndefined(r)&&(r={},r.locale=t.setCulture().name):r.locale=t.setCulture().name),new h(s,r));continue}if(r)if(u=[].slice.call(arguments,1),this.length>0&&u[0]&&p==="option"&&n.isPlainObject(u[0])&&(u[0]=t.copyObject({},u[0])),n.isPlainObject(r))l.setModel(r);else if((r.indexOf("_")===0||t.isNullOrUndefined(a=t.getObject(r,l)))&&r.indexOf("model.")!==0)e(o+": function/property - "+r+" does not exist");else{if(!a||!n.isFunction(a)){if(arguments.length==1)return a;l.option(r,arguments[1]);continue}if(w=a.apply(l,u),w!==i)return w}}return f.indexOf("ejm")!=-1&&t.widget.registerInstance(s,f,o,h.prototype),this};t.widget.register(f,o,h.prototype)};n.extend(t.widget,function(){var n={},i=[],r=function(i,r,u){t.isNullOrUndefined(n[i])||e("ej.widget : The widget named "+i+" is trying to register twice.");n[i]={name:i,className:r,proto:u};t.widget.extensions&&t.widget.extensions.registerWidget(i)},u=function(n,t,r,u){i.push({element:n,pluginName:t,className:r,proto:u})};return{register:r,registerInstance:u,registeredWidgets:n,registeredInstances:i}}());t.widget.destroyAll=function(n){var u,r,t,i;if(n&&n.length)for(u=0;u1?t[1]:i},set:function(n,t,i){typeof t=="object"&&(t=JSON.stringify(t));t=escape(t)+(i==null?"":"; expires="+i.toUTCString());document.cookie=n+"="+t}};u={getActionFromCode:function(n,t,i,r,f){var s,o,e;i=i||!1;r=r||!1;f=f||!1;for(s in n)if(s!=="focus")for(o=u.getKeyObject(n[s]),e=0;e9&&window.navigator.msPointerEnabled,i.pointerEnabled=window.navigator.pointerEnabled,i};t.eventType={mouseDown:"mousedown touchstart",mouseMove:"mousemove touchmove",mouseUp:"mouseup touchend",mouseLeave:"mouseleave touchcancel",click:"click touchend"};t.event=function(t,i,r){return n.extend(r||{},{type:t,model:i,cancel:!1})};t.proxy=function(n,t,i){return!n||typeof n!="function"?null:"on"in n&&t?i?n.on(t,i):n.on(t):function(){var r=i?[i]:[];return r.push.apply(r,arguments),n.apply(t||this,r)}};t.hasStyle=function(n){var r=document.documentElement.style,i,t;if(n in r)return!0;for(i=["ms","Moz","Webkit","O","Khtml"],n=n[0].toUpperCase()+n.slice(1),t=0;t",i,"<\/div>"].join(""));var e={prop:f,index:u};return n(i).render(r,e)};t.isPlainObject=function(n){if(!n||t.DataManager!==i&&n instanceof t.DataManager||typeof n!="object"||n.nodeType||jQuery.isWindow(n))return!1;try{if(n.constructor&&!n.constructor.prototype.hasOwnProperty("isPrototypeOf"))return!1}catch(f){return!1}var r,u=t.support.isOwnLast;for(r in n)if(u)break;return r===i||n.hasOwnProperty(r)};f=!1;t.util.valueFunction=function(n){return function(r,u){var e=t.getObject(n,this.model);if(f===!1&&(f=t.getObject("observables.getValue",t.widget)),r===i)return t.isNullOrUndefined(f)?typeof e=="function"?e.call(this):e:f(e,u);typeof e=="function"?(this["ob.values"][n]=r,e.call(this,r)):t.createObject(n,r,this.model)}};t.util.getVal=function(n){return typeof n=="function"?n():n};t.support={isOwnLast:function(){var n=function(){this.a=1},t;n.prototype.b=1;for(t in new n)return t==="b"}(),outerHTML:function(){return document.createElement("div").outerHTML!==i}()};e=t.throwError=function(n){try{throw new Error(n);}catch(t){throw t.message+"\n"+t.stack;}};t.getRandomValue=function(n,r){var u,f;return n===i||r===i?t.throwError("Min and Max values are required for generating a random number"):("crypto"in window&&"getRandomValues"in crypto?(f=new Uint16Array(1),window.crypto.getRandomValues(f),u=f[0]%(r-n)+n):u=Math.random()*(r-n)+n,u|0)};t.extensions={};t.extensions.modelGUID="{0B1051BA-1CCB-42C2-A3B5-635389B92A50}"}(window.jQuery,window.Syncfusion),function(){$.fn.addEleAttrs=function(n){var t=$(this);$.each(n,function(n,i){i&&i.specified&&t.attr(i.name,i.value)})};$.fn.removeEleAttrs=function(n){return this.each(function(){var t=$(this),i=$(this.attributes).clone();$.each(i,function(i,r){r&&r.specified&&n.test(r.name)&&t.removeAttr(r.name)})})};$.fn.attrNotStartsWith=function(n){var u=this,r=[],t;for(this.each(function(){t=$(this.attributes).clone()}),i=0;ii&&f.push(n);for(e=f,n=0;nthis.pageSize;)s.results.splice(0,1),s.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(s)),i},update:function(n,t,i,r){return this._crudAction=!0,this.cacheAdaptor.update(n,t,i,r)},insert:function(n,t,i){return this._insertAction=!0,this.cacheAdaptor.insert(n,t,i)},remove:function(n,t,i,r){return this._crudAction=!0,this.cacheAdaptor.remove(n,t,i,r)},batchRequest:function(n,t,i){return this.cacheAdaptor.batchRequest(n,t,i)}});var l=function(n,t){return n.filter(function(n){return n.fn===t})||[]},g=function(n,t){for(var r=n.filter(function(n){return t.indexOf(n.fn)!==-1}),u={},i=0;i-1;h--)/\bContent-ID:/i.test(i[h])&&/\bHTTP.+201/.test(i[h])&&(d=parseInt(/\bContent-ID: (\d+)/i.exec(i[h])[1]),s.added[d]&&(tt=u.parseJson(/^\{.+\}/m.exec(i[h])[0]),n.extend(s.added[d],this.processResponse(tt))));return s}var y=e&&e.getResponseHeader("DataServiceVersion"),w=null,rt={};if(y=y&&parseInt(y,10)||2,f&&f._requiresCount&&((i.__count||i["odata.count"])&&(w=i.__count||i["odata.count"]),i.d&&(i=i.d),(i.__count||i["odata.count"])&&(w=i.__count||i["odata.count"])),y===3&&i.value&&(i=i.value),i.d&&(i=i.d),y<3&&i.results&&(i=i.results),l&&l.aggregates&&l.aggregates.length){var p=l.aggregates,nt,ut={};for(h=0;h0;r--)if(u.indexOf(i._expands[r])>=0)i._expands.pop();else if(e.test(i._expands[r])){for(u=i._expands.pop(),f=u.replace(e,"($expand="),o=0;o-1;h--)/\bContent-ID:/i.test(i[h])&&/\bHTTP.+201/.test(i[h])&&(w=parseInt(/\bContent-ID: (\d+)/i.exec(i[h])[1]),s.added[w]&&(nt=u.parseJson(/^\{.+\}/m.exec(i[h])[0]),n.extend(s.added[w],this.processResponse(nt))));return s}if(y=null,d={},f&&f._requiresCount&&"@odata.count"in i&&(y=i["@odata.count"]),i=t.isNullOrUndefined(i.value)?i:i.value,l&&l.aggregates&&l.aggregates.length){var v=l.aggregates,g,it={};for(h=0;h=0;f--)u[f]&&(o=i.comparer,u[f].endsWith(" desc")&&(o=t.pvt.fnSort(t.sortOrder.Descending),u[f]=u[f].replace(" desc","")),n=it(n,u[f],o,[]));return n}return it(n,u,i.comparer,r?r.queries:[])},onGroup:function(n,i,r){var u,o,s,f,h;if(!n)return n;if(u=l(r.queries,"onAggregates"),o=[],u.length)for(f=0;f-1&&(e=this.rows.removeAt(i),e.markDelete(),this._deleted.push({model:e,position:i}),this._isDirty=!0,this._events.triggerHandler({type:"remove",model:e,table:this}))},isDirty:function(){return this._isDirty},getChanges:function(){for(var i={added:[],changed:[]},r=this.toArray(),n=0;n-1;u--){if(!t[u].offsetParent){t.splice(u,1);continue}n(t[u])[i](r)}},_changeHandler:function(t){t.data.self.set(t.data.prop,n(this).val())},_processField:function(n,t,i){var u={self:this,prop:t},r=this.get(t);if(i.fields.push(n[0]),this.formElements.indexOf(n[0].tagName.toLowerCase())===-1)return n.html(r),this._updates[t].read.push(n[0]);n.val(r).off("change",null,this._changeHandler).on("change",null,u,this._changeHandler);return this._updates[t].input.push(n[0])},formElements:["input","select","textarea"]};var ot=/[^\w]+/g,st=function(n){return n.replace(ot,"_")},ht=function(n){this.setDirty(!0,n.model)};if(t.Predicate=function(n,i,r,u){return(this instanceof t.Predicate)?(typeof n=="string"?(this.field=n,this.operator=i,this.value=r,this.ignoreCase=u,this.isComplex=!1,this._comparer=t.data.fnOperators.processOperator(this.operator)):(n instanceof t.Predicate&&r instanceof t.Predicate||r instanceof Array)&&(this.isComplex=!0,this.condition=i.toLowerCase(),this.predicates=[n],r instanceof Array?[].push.apply(this.predicates,r):this.predicates.push(r)),this):new t.Predicate(n,i,r,u)},t.Predicate.and=function(){return y._combinePredicates([].slice.call(arguments,0),"and")},t.Predicate.or=function(){return y._combinePredicates([].slice.call(arguments,0),"or")},t.Predicate.fromJSON=function(n){var i,t,r;if(p(n,Array)){for(i=[],t=0,r=n.length;t0&&(f=e,o=n[u]));return o},quickSelect:function(n,i,r,u,f,e){if(r==u)return n[r];var o=t.pvt.partition(n,i,r,u,e),s=o-r+1;return s==f?n[o]:f0||t.length>0;)f=n.length>0&&t.length>0?r?r(v(n,i,0),v(t,i,0))<=0?n:t:n[0][i]0?n:t,u.push(f.shift());return u},getObject:function(n,t){var i,f,u;if(!t)return r;if(!n)return t;if(n.indexOf(".")===-1)return t[n];for(i=t,f=n.split("."),u=0;u":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},t.data.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},t.data.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},t.data.fnOperators={equal:function(n,t,i){return i?s(n)==s(t):n==t},notequal:function(n,i,r){return!t.data.fnOperators.equal(n,i,r)},lessthan:function(n,t,i){return i?s(n)s(t):n>t},lessthanorequal:function(n,t,i){return i?s(n)<=s(t):n<=t},greaterthanorequal:function(n,t,i){return i?s(n)>=s(t):n>=t},contains:function(n,t,i){return i?!c(n)&&!c(t)&&s(n).indexOf(s(t))!=-1:!c(n)&&!c(t)&&n.toString().indexOf(t)!=-1},notnull:function(n){return n!==null},isnull:function(n){return n===null},startswith:function(n,t,i){return i?n&&t&&s(n).startsWith(s(t)):n&&t&&n.startsWith(t)},endswith:function(n,t,i){return i?n&&t&&s(n).endsWith(s(t)):n&&t&&n.endsWith(t)},processSymbols:function(n){var r=t.data.operatorSymbols[n],i;return r&&(i=t.data.fnOperators[r],i)?i:f("Query - Process Operator : Invalid operator")},processOperator:function(n){var i=t.data.fnOperators[n];return i?i:t.data.fnOperators.processSymbols(n)}},t.NotifierArray=function(i){return p(this,t.NotifierArray)?(this.array=i,this._events=n({}),this._isDirty=!1,this):new t.NotifierArray(i)},t.NotifierArray.prototype={on:function(n,t){this._events.on(n,t)},off:function(n,t){this._events.off(n,t)},push:function(n){var t;return t=p(n,Array)?[].push.apply(this.array,n):this.array.push(n),this._raise("add",{item:n,index:this.length()-1}),t},pop:function(){var n=this.array.pop();return this._raise("remove",{item:n,index:this.length()-1}),n},addAt:function(n,t){return this.array.splice(n,0,t),this._raise("add",{item:t,index:n}),t},removeAt:function(n){var t=this.array.splice(n,1)[0];return this._raise("remove",{item:t,index:n}),t},remove:function(n){var t=this.array.indexOf(n);return t>-1&&(this.array.splice(t,1),this._raise("remove",{item:n,index:t})),t},length:function(){return this.array.length},_raise:function(t,i){this._events.triggerHandler(n.extend({type:t},i));this._events.triggerHandler({type:"all",name:t,args:i})},toArray:function(){return this.array}},n.extend(t,t.dataUtil),Array.prototype.forEach=Array.prototype.forEach||function(n,t){for(var i=0,r=this.length;i9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n}function c(t,i,r){var u=r.type;r.type=i;n.event.dispatch.call(t,r);r.type=u}function it(n,t){if(t)for(prop in t)prop in n||(n[prop]=t[prop])}function e(n){return n.originalEvent.touches?n.originalEvent.touches[0]:i?n.originalEvent:n}function d(n){var r=i?n.originalEvent.pointerType:n.originalEvent.touches?"touch":"mouse",u=i&&h==t?r==4?"mouse":"touch":r;return n.pointerType=u,n.type!="mousedown"&&n.type!="mouseup"&&it(n,n.originalEvent),n}function o(t,i,r){var o,s,h,u={},e,f;return r&&(f=r.originalEvent.touches?[r.originalEvent.touches[0],t.originalEvent.changedTouches[0]]:[r.originalEvent,t.originalEvent],i._isSwipe||i._isdrag?(o=n.event.special.pinch._getdistance(f[0],f[1]),s=i.time,e={pageX:i.stopPoint.pageX,pageY:i.stopPoint.pageY}):i._isPinch&&(o=n.event.special.pinch.distance(t),s=t.timeStamp-r.timeStamp,h=i._pinchDistance),i._isDelta&&(u._dTime=t.timeStamp-r.timeStamp,u._x=f[1].pageX-f[0].pageX,u._y=f[1].pageY-f[0].pageY)),{options:t,delta:{time:u._dTime||null,X:u._x||null,Y:u._y||null},distance:o,scale:i._isPinch?h:null,time:s,velocity:{XY:o/u._dTime||null,X:u._x/u._dTime||null,Y:u._y/u._dTime||null},currentPosition:{pageX:e?e.pageX:null,pageY:e?e.pageY:null}}}function s(){var n=new Date;return n.getTime()}function l(n){i&&n.css("-ms-touch-action","pinch-zoom").css("touch-action","pinch-zoom")}var y=n(document);n.each("touchstart touchmove touchend tap doubletap taphold swipe swipeleft swiperight pinch pinchin pinchout pinchstop scrollstart scrollstop".split(" "),function(t,i){n.fn[i]=function(n){return n?this.on(i,n):this.trigger(i)};n.attrFn&&(n.attrFn[i]=!0)});var i=k().isMSPointerEnabled,h=k().pointerEnabled,a="ontouchstart"in window,rt="scroll",p=typeof orientation=="undefined",g=navigator.userAgent.match(/iPhone|iPad|iPod/i),u=i?h?"pointerdown":"MSPointerDown":a?"touchstart":"mousedown",f=i?h?"pointerup":"MSPointerUp":g?"touchend":a?"touchend":"mouseup",r=i?h?"pointermove":"MSPointerMove":a?"touchmove":"mousemove",w=i?h?"pointercancel":"MSPointerCancel":a?"touchcancel":"mouseleave",ut=i||!p?u:g?"touchstart":"touchstart mousedown",v=i||!p?f:"touchend mouseup",b=i||!p?r:"touchmove mousemove",nt=k(),tt=nt.name=="msie"&&nt.version=="9.0"?!0:!1;n.event.special.ejtouchmove={setup:function(){function s(){}function h(n){if(!(n.which&&n.which!==1)){var f=n.target,u=n.originalEvent;i&&(t={x:u.x,y:u.y});o.on(r,l)}}function l(n){if(!(n.which&&n.which!==1)){var u=n.target,r=n.originalEvent;it(n,n.originalEvent);(!i||!t||Math.abs(t.x-r.x)>10||Math.abs(t.y-r.y)>10&&i)&&c(e,"ejtouchmove",n)}}var e=this,o=n(e),t;o.on(u,h);y.on(f,s);t={}}};n.event.special.swipeupdown={setup:function(){var s=this,i=n(s);l(i);i.on(u,function(u){function l(n){if(n.preventDefault(),s){var t=e(n);h={time:(new Date).getTime(),coords:[t.pageX,t.pageY]};Math.abs(s.coords[1]-h.coords[1])>10&&n.preventDefault()}}var a=u,c=e(u),s={time:(new Date).getTime(),coords:[c.pageX,c.pageY],origin:n(u.target)},h;i.on(r,l).one(f,function(u){if(i.off(r,l),s&&h&&h.time-s.time<1e3&&Math.abs(s.coords[1]-h.coords[1])>30&&Math.abs(s.coords[0]-h.coords[0])<75){var e={time:h.time-s.time,_isSwipe:!0,_isDelta:!0,stopPoint:h},f=o(u,e,a);s.origin.trigger(n.extend(!0,{type:"swipeupdown"},f)).trigger(n.extend(!0,{type:s.coords[1]>h.coords[1]?"swipeup":"swipedown"},f))}s=h=t})})}};n.event.special.scrollstart={isEnabled:!0,setup:function(){function u(n,r){t=r;c(i,t?"scrollstart":"scrollstop",n)}var i=this,f=n(i),t,r;f.on(rt,function(i){n.event.special.scrollstart.isEnabled&&(t||u(i,!0),clearTimeout(r),r=setTimeout(function(){u(i,!1)},250))})}};n.event.special.tap={doubleTapThreshold:500,tapholdThreshold:650,canDoubleTap:function(t){return s()-t.doubleTapStartTime<=n.event.special.tap.doubleTapThreshold},setup:function(){var u=this,i=n(u),t=i.data(),r;l(i);t.isDoubleTapWait=!1;t.stopProcess=!1;t.preTouchend=null;t.preTouchstart=null;i.on(ut,function(f){function e(){clearTimeout(l);i.off(v,o);tt&&y.off(v,o);i.off(w,e);i.off(b,a);i.off("dragstart",it)}function a(n){var t=n.originalEvent.changedTouches?n.originalEvent.changedTouches[0]:n.originalEvent,r=f.originalEvent.changedTouches?f.originalEvent.changedTouches[0]:f.originalEvent;t.pageX==r.pageX&&t.pageY==r.pageY||(n.type=="mousemove"||n.type=="pointermove"&&n.originalEvent.pointerType=="mouse"||n.type=="MSPointerMove"&&n.originalEvent.pointerType==4?(clearTimeout(l),i.off(w,e),i.off(b,a)):e())}function o(i){var o,h;i.type=="touchend"&&(t.preTouchend=s());e();r!=i.target&&(i.type=="mouseup"||f.type=="pointerup"||"MSPointerUp")&&(o=i.target,jQuery.contains(r,o)?nt(i,r):jQuery.contains(o,r)||(h=n(r).parents().has(n(o)).first()[0],ej.isNullOrUndefined(h)||nt(i,h)));g===i.currentTarget&&(c(u,"tap",n.extend(d(i),{time:s()-t.startTime})),t.isDoubleTapWait&&n.event.special.tap.canDoubleTap(t)?(t.isDoubleTapWait=!1,c(u,"doubletap",n.extend(d(i),{time:s()-t.doubleTapStartTime}))):(t.isDoubleTapWait&&(t.isDoubleTapWait=!1,t.doubleTapStartTime=t.startTime),n.event.special.tap.canDoubleTap(t)&&(t.isDoubleTapWait=!0)))}function nt(n,t){n.target=t;n.toElement=t}function it(){e()}var g,h,l,p,k;if((f.type=="mousedown"||f.type=="pointerdown"||"MSPointerDown")&&(r=f.target),t=i.data(),t.startTime=s(),t.isDoubleTapWait||(t.doubleTapStartTime=t.startTime),f.type=="touchstart"&&(t.preTouchstart=t.startTime),t.stopProcess=f.type=="mousedown"&&(t.startTime-t.preTouchend<300||t.startTime-t.preTouchstart<30)?!0:!1,g=f.currentTarget,h=f.originalEvent,f.which&&f.which!==1||t.stopProcess)t.stopProcess&&(t.stopProcess=!1);else{i.on(v,o);if(tt)y.on(v,o);i.on(w,e);i.on(b,a);i.on("dragstart",it);p={};for(k in h)p[k]=h[k];l=setTimeout(function(){t.isDoubleTapWait&&(t.isDoubleTapWait=!1);c(u,"taphold",n.extend(d(f),{options:p,time:s()-t.startTime}))},n.event.special.tap.tapholdThreshold)}})}};n.event.special.swipe={scrollSupression:10,duration:1e3,horizontalDistance:30,verticalDistance:75,pointers:window.navigator.msPointerEnabled,startPoint:function(t){var i=e(t);return{time:(new Date).getTime(),coords:[i.pageX,i.pageY],origin:n(t.target)}},stopPoint:function(n){var t=e(n);return{time:(new Date).getTime(),coords:[t.pageX,t.pageY]}},handleSwipe:function(t,i,r,u){if(i.time-t.timen.event.special.swipe.horizontalDistance&&Math.abs(t.coords[1]-i.coords[1])i.coords[0]?"swipeleft":"swiperight"},f))}},setup:function(){var e=this,i=n(e);l(i);i.on(u,function(u){function s(t){e&&(o=n.event.special.swipe.stopPoint(t),Math.abs(e.coords[0]-o.coords[0])>n.event.special.swipe.scrollSupression&&t.preventDefault())}var e=n.event.special.swipe.startPoint(u),o,h=u;n(u.target).data("_dataTouchStart",{event:u,_now:(new Date).getTime()});i.on(r,s).one(f,function(u){i.off(r,s);e&&o&&n.event.special.swipe.handleSwipe(e,o,u,h);e=o=t})})}};n.event.special.pinch={distance:function(t){return t.originalEvent.touches.length<2?null:n.event.special.pinch._getdistance(t.originalEvent.touches[0],t.originalEvent.touches[1])},_getdistance:function(n,t){return Math.sqrt((n.pageX-t.pageX)*(n.pageX-t.pageX)+(n.pageY-t.pageY)*(n.pageY-t.pageY))},setup:function(){var e=this,i=n(e);l(i);i.on(u,function(u){var h=u;if(u.originalEvent.touches&&u.originalEvent.touches.length>=2){var s=n.event.special.pinch.distance(u),e,v=5,c=s,l,y=o(u,{_isPinch:!0,_pinchDistance:c},h);n(u.target).trigger(n.extend(!0,{type:"pinch"},y));function a(t){l=t;e=n.event.special.pinch.distance(t)||null;s&&e&&Math.abs(s-e)>v&&(n(t.target).trigger(n.extend(!0,{type:s>e?"pinchin":"pinchout"},o(t,{_isPinch:!0,_pinchDistance:c},h))),s=e)}i.on(r,a).one(f,function(){i.off(r,a);n(u.target).trigger(n.extend(!0,{type:"pinchstop"},o(l,{_isPinch:!0,_pinchDistance:e},h)));s=e=t})}})}};n.event.special.touchdrag={setup:function(){var s=this,i=n(s);l(i);i.on(u,function(u){function c(t){h&&(s=e(t),n.event.special.pinch._getdistance(h,s)>5&&n(t.target).trigger(n.extend(!0,{type:"touchdrag"},o(t,{_isdrag:!0,stopPoint:s,_isDelta:!0},l))))}var h=e(u),s,l=u;n(u.target).data("_dataTouchStart",{event:u,_now:(new Date).getTime()});i.on(r,c).one(f,function(){i.off(r,c);h=s=t})})}};n.each({scrollstop:"scrollstart",doubletap:"tap",taphold:"tap",swipeleft:"swipe",swiperight:"swipe",swipedown:"swipeupdown",swipeup:"swipeupdown",pinchin:"pinch",pinchout:"pinch",pinchstop:"pinch"},function(t,i){n.event.special[t]={setup:function(){n(this).on(i,n.noop)}}})}(jQuery),function(n,t){t.widget("ejDraggable","ej.Draggable",{element:null,model:null,validTags:["div","span","a"],defaults:{scope:"default",handle:null,dragArea:null,clone:!1,distance:1,dragOnTaphold:!1,cursorAt:{top:-1,left:-2},dragStart:null,drag:null,dragStop:null,create:null,destroy:null,helper:function(){return n('
').html("draggable").appendTo(document.body)}},_init:function(){this.handler=function(){};this.resizables={};helpers={};this._wireEvents();this._browser=t.browserInfo();this._isIE8=this._browser.name=="msie"&&this._browser.version=="8.0";this._isIE9=this._browser.name=="msie"&&this._browser.version=="9.0";this._browser.name=="msie"&&this.element.addClass("e-pinch")},_setModel:function(n){for(var t in n)switch(t){case"dragArea":this.model.dragArea=n[t];break;case"dragOnTaphold":this.model.dragOnTaphold=n[t]}},_destroy:function(){n(document).off(t.eventType.mouseUp,this._destroyHandler).off(t.eventType.mouseUp,this._dragStopHandler).off(t.eventType.mouseMove,this._dragStartHandler).off(t.eventType.mouseMove,this._dragHandler).off("mouseleave",this._dragMouseOutHandler).off("selectstart",!1);t.widgetBase.droppables[this.scope]=null},_initialize:function(i){var r,u;if(i.target&&i.target.nodeName&&n(i.target).closest("input[type='text'], textarea, select, option").length)return!0;r=i;i.preventDefault();i=this._getCoordinate(i);this.target=n(r.currentTarget);this._initPosition={x:i.pageX,y:i.pageY};n(document).on(t.eventType.mouseMove,this._dragStartHandler).on(t.eventType.mouseUp,this._destroyHandler);this.model.clone||(u=this.element.offset(),this._relXposition=i.pageX-u.left,this._relYposition=i.pageY-u.top);n(document.documentElement).trigger(t.eventType.mouseDown,r)},_setDragArea:function(){var o=n(this.model.dragArea)[0],s,h,u,r,f,e,i;if(o){if(r=["left","right","bottom","top"],t.isNullOrUndefined(o.getBoundingClientRect)){for(s=n(this.model.dragArea).outerWidth(),h=n(this.model.dragArea).outerHeight(),i=0;i=this.model.distance){if(f=this.model.helper({sender:r,element:this.target}),!f||t.isNullOrUndefined(f))return;if(e=this.model.handle=this.helper=f,this.model.dragStart&&(u=null,r.type=="touchmove"?(o=r.originalEvent.changedTouches[0],u=document.elementFromPoint(o.clientX,o.clientY)):u=r.originalEvent.target||r.target,this.model.cursorAt.top==0&&this.model.cursorAt.left==0&&(u=this._checkTargetElement(i)||u),this._trigger("dragStart",{event:r,element:this.element,target:u})))return this._destroy(),!1;this.model.dragArea?this._setDragArea():(this._left=this._top=this._right=this._bottom=0,this["border-top-width"]=this["border-left-width"]=0);s=e.offsetParent().offset();n(document).off(t.eventType.mouseMove,this._dragStartHandler).off(t.eventType.mouseUp,this._destroyHandler).on(t.eventType.mouseMove,this._dragHandler).on(t.eventType.mouseUp,this._dragStopHandler).on("mouseleave",this._dragMouseOutHandler).on("selectstart",!1);t.widgetBase.droppables[this.model.scope]={draggable:this.element,helper:e.css({position:"absolute",left:this.position.left-s.left,top:this.position.top-s.top}),destroy:this._destroyHandler}}},_drag:function(i){var u,f,h,c,o,l,s,r,e;i.preventDefault();this.position=this._getMousePosition(i);this.position.top<0&&(this.position.top=0);n(document).height()this.position.left?this._left:this._rightthis.position.top?this._top:this._bottom0&&(dropObj=n(r).data("ejDroppable"),!t.isNullOrUndefined(dropObj)))return dropObj},_elementUnderCursor:function(n){return n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"?document.elementFromPoint(n.originalEvent.changedTouches[0].clientX,n.originalEvent.changedTouches[0].clientY):document.elementFromPoint(n.clientX,n.clientY)},_contains:function(t,i){try{return n.contains(t,i)||t==i}catch(r){return!1}},_wireEvents:function(){t.isDevice()==!0&&this.model.dragOnTaphold==!0?this._on(this.element,"taphold",this._initialize):this._on(this.element,t.eventType.mouseDown,this._initialize);this._dragStartHandler=n.proxy(this._dragStart,this);this._destroyHandler=n.proxy(this._destroy,this);this._dragStopHandler=n.proxy(this._dragStop,this);this._dragHandler=n.proxy(this._drag,this);this._dragMouseEnterHandler=n.proxy(this._dragMouseEnter,this);this._dragMouseOutHandler=n.proxy(this._dragMouseOut,this)},_getMousePosition:function(n){n=this._getCoordinate(n);var t=this.model.clone?n.pageX:n.pageX-this._relXposition,i=this.model.clone?n.pageY:n.pageY-this._relYposition;return{left:t-[this.margins.left+this.model.cursorAt.left],top:i-[this.margins.top+this.model.cursorAt.top]}},_getCoordinate:function(n){var i=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"&&t.browserInfo().name!="msie")&&(i=n.originalEvent.changedTouches[0]),i}})}(jQuery,Syncfusion),function(n,t){t.widget("ejDroppable","ej.Droppable",{element:null,model:null,validTags:["div","span","a"],dropElements:[],defaults:{accept:null,scope:"default",drop:null,over:null,out:null,create:null,destroy:null},_init:function(){this._mouseOver=!1;this.dropElements.push(this)},_setModel:function(){},_destroy:function(){n(this.element).off("mouseup",n.proxy(this._drop,this))},_over:function(n){this._mouseOver||(this._trigger("over",n),this._mouseOver=!0)},_out:function(n){this._mouseOver&&(this._trigger("out",n),this._mouseOver=!1)},_drop:function(t,i){var u=t.target,f,e,r;for(t.type=="touchend"&&(f=t.originalEvent.changedTouches[0],u=document.elementFromPoint(f.clientX,f.clientY)),e=n(u).parents(".e-droppable"),n(u).hasClass("e-droppable")&&e.push(u),r=0;r').html("resizable").appendTo(document.body)}},_init:function(){if(this.target=this.element,this._browser=t.browserInfo(),this._isIE8=this._browser.name=="msie"&&this._browser.version=="8.0",this._isIE9=this._browser.name=="msie"&&this._browser.version=="9.0",this.handle!=null)n(this.target).delegate(this.handle,t.eventType.mouseDown,n.proxy(this._mousedown,this)).delegate(this.handle,"resizestart",this._blockDefaultActions);else n(this.target).on("mousedown",n.proxy(this._mousedown,this));this._resizeStartHandler=n.proxy(this._resizeStart,this);this._destroyHandler=n.proxy(this._destroy,this);this._resizeStopHandler=n.proxy(this._resizeStop,this);this._resizeHandler=n.proxy(this._resize,this);this._resizeMouseEnterHandler=n.proxy(this._resizeMouseEnter,this)},_mouseover:function(i){if(n(i.target).hasClass("e-resizable")){n(i.target).css({cursor:"se-resize"});n(this.target).on(t.eventType.mouseDown,n.proxy(this._mousedown,this))}else n(this.target).off(t.eventType.mouseDown),n(this.target).css({cursor:""})},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_setModel:function(){},_mousedown:function(i){var r=i;i=this._getCoordinate(i);this.target=n(r.currentTarget);this._initPosition={x:i.pageX,y:i.pageY};this._pageX=i.pageX;this._pageY=i.pageY;n(document).on(t.eventType.mouseMove,this._resizeStartHandler).on(t.eventType.mouseUp,this._destroyHandler);return n(document.documentElement).trigger(t.eventType.mouseDown,r),!1},_resizeStart:function(i){var r,h;if(n(i.target).hasClass("e-resizable")){i=this._getCoordinate(i);var u=this._initPosition.x-i.pageX,f=this._initPosition.y-i.pageY,e,o,s=Math.sqrt(u*u+f*f);if(s>=this.model.distance){if(this.model.resizeStart!=null&&this._trigger("resizeStart",{event:i,element:this.target}))return;r=this.model.helper({element:this.target});e=i.pageX-this._pageX+r.outerWidth();o=i.pageY-this._pageY+r.outerHeight();this._pageX=i.pageX;this._pageY=i.pageY;h=this.getElementPosition(r);n(document).off(t.eventType.mouseMove,this._resizeStartHandler).off(t.eventType.mouseUp,this._destroyHandler).on(t.eventType.mouseMove,this._resizeHandler).on(t.eventType.mouseUp,this._resizeStopHandler).on("mouseenter",this._resizeMouseEnterHandler).on("selectstart",!1);t.widgetBase.resizables[this.scope]={resizable:this.target,helper:r.css({width:e,height:o}),destroy:this._destroyHandler}}}},_resize:function(n){var i,r,u,e,f;n=this._getCoordinate(n);e=this.getElementPosition(t.widgetBase.resizables[this.scope].helper);f=this.model.helper({element:this.target});i=n.pageX-this._pageX+f.outerWidth();r=n.pageY-this._pageY+f.outerHeight();this._pageX=n.pageX;this._pageY=n.pageY;ithis.model.maxHeight&&(u=r-this.model.maxHeight,r=this.model.maxHeight,this._pageY=n.pageY-u);this.model.maxWidth!=null&&i>this.model.maxWidth&&(u=i-this.model.maxWidth,i=this.model.maxWidth,this._pageX=n.pageX-u);t.widgetBase.resizables[this.scope].helper.css({width:i,height:r});this._trigger("resize",{element:this.target})},_resizeStop:function(n){this.model.resizeStop!=null&&this._trigger("resizeStop",{element:this.target});(n.type=="mouseup"||n.type=="touchend")&&this._destroy(n)},_resizeMouseEnter:function(n){this._isIE9?this._resizeManualStop(n):this._isIE8?n.button==0&&this._resizeManualStop(n):n.buttons==0&&this._resizeManualStop(n)},_resizeManualStop:function(n){this.model.resizeStop!=null&&this._trigger("resizeStop",{element:this.target});this._destroy(n)},_destroy:function(){n(document).off(t.eventType.mouseUp,this._destroyHandler).off(t.eventType.mouseUp,this._resizeStopHandler).off(t.eventType.mouseMove,this._resizeStartHandler).off(t.eventType.mouseMove,this._resizeHandler).off("mouseenter",this._resizeMouseEnterHandler).off("selectstart",!1);t.widgetBase.resizables[this.scope]=null},getElementPosition:function(n){return n!=null&&n.length>0?{left:n[0].offsetLeft,top:n[0].offsetTop}:null},_getCoordinate:function(n){var t=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend")&&(t=n.originalEvent.changedTouches[0]),t}})}(jQuery,Syncfusion),function(n,t,i,r){"use strict";t.widget("ejScrollBar","ej.ScrollBar",{defaults:{orientation:"horizontal",viewportSize:0,height:18,width:18,smallChange:57,largeChange:57,value:0,maximum:0,minimum:0,buttonSize:18,infiniteScrolling:!1},validTags:["div"],type:"transclude",dataTypes:{buttonSize:"number",smallChange:"number",largeChange:"number"},observables:["value"],value:t.util.valueFunction("value"),_enabled:!0,content:function(){return this._content&&this._content.length||(this._content=this.model.orientation==="horizontal"?this.element.find(".e-hhandle"):this.element.find(".e-vhandle")),this._content},_init:function(){this.element.addClass("e-widget");this._ensureScrollers();this.content();this._setInitialValues()},_setInitialValues:function(){var n="X";this.model.orientation===t.ScrollBar.Orientation.Horizontal?this.element.addClass("e-hscrollbar"):(this.element.addClass("e-vscrollbar"),n="Y");(this.value()!==0||this.model.minimum!==0)&&(this.value(){2}<\/div>",u=n.fn.jquery,f={},o,e;f[i.dimension]=i.modelDim;e=t.buildTag("div."+i.css+"scroll e-box",String.format(r,"up e-chevron-up_01 e-icon e-box e-button",i.buttonSize)+String.format(r,"handlespace",i.handleSpace,String.format(r,"handle e-box e-pinch",i.handle))+String.format(r,"down e-chevron-down_01 e-icon e-box e-button",i.buttonSize),f);this.element.append(e);this.element.find(".e-vhandle").addClass("e-v-line e-icon");this.element.find(".e-hhandle").addClass("e-h-line e-icon");o=u==="1.7.1"||u==="1.7.2"?i.uDimension.toLowerCase():"outer"+i.uDimension;this[i.handler]=this.element.find("."+i.handler);this[i.handler].css("transition","none");this[i.scroll]=this[i.handler].parent();this[i.main]=this[i.scroll].parent();this[i.main].find(".e-button")["outer"+i.uDimension](i.buttonSize)},_calculateLayout:function(n){var i,u;n.scrollDim="scroll"+n.dimension;n.lPosition=n.position.toLowerCase();n.clientXy="page"+n.xy;n.scrollVal="scroll"+n.position;n.scrollOneStepBy=this.model.smallChange;n.modelDim=this.model[n.dimension=n.dimension.toLowerCase()];n.handler=n.css+"handle";n.buttonSize=this.model.buttonSize;n.main=n.css+"scroll";n.scroll=n.css+"ScrollSpace";n.handleSpace=n.modelDim-2*n.buttonSize;n.scrollable=this.model.maximum-this.model.minimum;i=this.model.height;this.model.orientation==="horizontal"&&(i=this.model.width);n.handle=this.model.viewportSize/(this.model.maximum-this.model.minimum+this.model.viewportSize)*(i-2*this.model.buttonSize);u=!t.isNullOrUndefined(this.model.elementHeight)&&typeof this.model.elementHeight=="string"&&this.model.elementHeight.indexOf("%")!=-1?!0:!1;n.handle<20&&!u&&(n.handle=20);n.onePx=n.scrollable/(n.handleSpace-n.handle);n.fromScroller=!1;n.up=!0;n.vInterval=r},_updateLayout:function(n){this.element.height(this.model.height);this.element.width(this.model.width);var t=this.element.find("."+n.css+"handle"),f=this.element.find("."+n.css+"handlespace"),u=n.dimension=="width"?t.css("left"):t.css("top"),i=n.dimension=="width"?f.outerWidth():f.outerHeight();u!==r&&u!=="auto"&&(i>=n.handle+parseFloat(u)||(this.model.enableRTL?t.css(n.dimension==="width"?"left":"top",parseFloat(i)-n.handle):t.css(n.dimension==="width"?"left":"top",parseFloat(i)-n.handle>0?parseFloat(i)-n.handle:0)));this.element.find("."+n.css+"scroll").css(n.dimension,n.modelDim+"px").find(".e-button").css(n.dimension,this.model.buttonSize).end().find("."+n.css+"handlespace").css(n.dimension,n.handleSpace+"px").find("."+n.css+"handle").css(n.dimension,n.handle+"px")},refresh:function(){this._ensureScrollers();this.value()&&this.scroll(this.value(),"none");this._scrollData&&(this._calculateLayout(this._scrollData),this._updateLayout(this._scrollData))},scroll:function(n,i,r,u){var o=this._scrollData,f,e;if(!r)if(this.model.orientation===t.ScrollBar.Orientation.Horizontal){if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollLeft:n,originalEvent:u}))return}else if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollTop:n,originalEvent:u}))return;this._scrollData&&(this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name!="msie"?this.value(-o.scrollable+n):this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name=="msie"?this.value(-1*n):this.value(n),this.content().length>0&&(this.model.orientation===t.ScrollBar.Orientation.Horizontal?(f=this.element.find(".e-hhandlespace").width()-this.element.find(".e-hhandle").outerWidth(),n=f<(n-this.model.minimum)/this._scrollData.onePx?f:(n-this.model.minimum)/this._scrollData.onePx,this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name!="msie"&&(n=f-n,n>0?n=n*-1:n),this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name=="msie"&&(n=-n),this._scrollData.enableRTL&&n>0&&!this._scrollData._scrollleftflag?n=0:n,this._scrollData._scrollleftflag&&(n>0?n=n*-1:n,this.value(n)),this.content()[0].style.left=n+"px",this._scrollData._scrollleftflag=!1):(e=this.element.find(".e-vhandlespace").height()-this.element.find(".e-vhandle").outerHeight(),n=e<(n-this.model.minimum)/this._scrollData.onePx?e:(n-this.model.minimum)/this._scrollData.onePx,this.content()[0].style.top=n+"px")))},_changeTop:function(n,t,i){var u,r;return u=n.dimension==="height"?this.value():this.value(),r=u+t,n.step=t,n.enableRTL&&t<0||t>0&&!n.enableRTL?n.enableRTL?rthis.model.maximum&&(r=this.model.maximum):n.enableRTL?r>this.model.minimum&&(r=this.model.minimum):r0:r<0)&&(r=0),r*(this._data.enableRTL?-1:1)+this._data.handle>=this._data.handleSpace&&(r=(this._data.handleSpace-this._data.handle)*(this._data.enableRTL?-1:1)),u=Math.ceil(r*this._data.onePx),this.scroll(u,"thumb")):(u=f*this._data.onePx,this._changeTop(this._data,u,"thumb",this._d)),this._trigger("thumbMove",{originalEvent:i,scrollData:this._data}));o===1&&(this._prevY=e)},_spaceMouseDown:function(i){var r,u,f;if(i.data&&this._enabled&&(r=i.data.d,i.which===1&&i.target!==this[r.handler][0])){u=i.data.step?this.model.smallChange:this.model.largeChange;f=i.data.top||this[r.handler].offset()[r.lPosition];i[r.clientXy]=i[r.clientXy]||0;i[r.clientXy]i[r.clientXy])&&(r.up=!0),r.up){clearInterval(r.vInterval);return}this._changeTop(r,u,u===3?"track":"button",i);f=i.data?i.data.top||this[r.handler].offset()[r.lPosition]:this[r.handler].offset()[r.lPosition]},this),150);n(document).one("mouseup",{d:r},t.proxy(this._mouseUp,this));n(document).mouseout({d:r},t.proxy(this._mouseUp,this))}},_remove:function(){this.model.orientation===t.ScrollBar.Orientation.Horizontal&&this.element.find(".e-hscroll").remove();this.model.orientation===t.ScrollBar.Orientation.Vertical&&this.element.find(".e-vscroll").remove();this._scrollData=null;this._content=null},_destroy:function(){this.element.remove()}});t.ScrollBar.Orientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion,window),function(n,t,i,r){"use strict";t.widget("ejScroller","ej.Scroller",{_addToPersist:["scrollLeft","scrollTop"],defaults:{height:250,autoHide:!1,animationSpeed:600,width:0,scrollOneStepBy:57,buttonSize:18,scrollLeft:0,scrollTop:0,targetPane:null,scrollerSize:18,enablePersistence:!1,enableRTL:r,enableTouchScroll:!0,enabled:!0,create:null,destroy:null,wheelStart:null,wheelMove:null,wheelStop:null},validTags:["div"],type:"transclude",dataTypes:{buttonSize:"number",scrollOneStepBy:"number"},observables:["scrollTop","scrollLeft"],scrollTop:t.util.valueFunction("scrollTop"),scrollLeft:t.util.valueFunction("scrollLeft"),keyConfigs:{up:"38",down:"40",left:"37",right:"39",pageUp:"33",pageDown:"34",pageLeft:"ctrl+37",pageRight:"ctrl+39"},content:function(){return this._content&&this._content.length&&this._content[0].offsetParent||(this._content=this.element.children().first().addClass("e-content")),this._content},_setFirst:!0,_updateScroll:!1,_init:function(){t.isNullOrUndefined(this.content()[0])||(this._prevScrollWidth=this.content()[0].scrollWidth,this._prevScrollHeight=this.content()[0].scrollHeight,this.element.addClass("e-widget"),this.content(),this._browser=t.browserInfo().name,this._wheelStart=!0,this._eleHeight=this.model.height,this._eleWidth=this.model.width,this.model.enableRTL===r&&(this.model.enableRTL=this.element.css("direction")==="rtl"),this._ensureScrollers(),this.model.enableRTL&&(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft()),this._on(this.content(),"scroll",this._scroll),this.model.targetPane!=null&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll),this.scrollLeft()&&this._setScrollLeftValue(this.scrollLeft()),this.scrollTop()&&this.content().scrollTop(this.scrollTop()),this.model.autoHide&&this._autohide(),this.model.enabled?this.enable():this.disable(),this._setDimension(),(this._prevScrollWidth!==this.content()[0].scrollWidth||this._prevScrollHeight!==this.content()[0].scrollHeight)&&this.refresh());this._addActionClass()},_addActionClass:function(){this._browser=="msie"&&(this.content().removeClass("e-pinch e-pan-x e-pan-y"),this._vScrollbar&&this._hScrollbar?this.content().addClass("e-pinch"):this._vScrollbar&&!this._hScrollbar?this.content().addClass("e-pan-x"):this._hScrollbar&&!this._vScrollbar&&this.content().addClass("e-pan-y"))},_setDimension:function(){t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1||(this._vScroll?this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),this.element.parent().height()):n(this.content()[0]).height(""));t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1||(this._hScroll?this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),this.element.parent().width()):n(this.content()[0]).width(""))},_setScrollLeftValue:function(n){this.model.enableRTL&&(n=t.browserInfo().name=="mozilla"?n<0?n:n*-1:!t.isNullOrUndefined(this._rtlScrollLeftValue)&&(t.browserInfo().name=="chrome"||this._rtlScrollLeftValue>0)?n<0?this._rtlScrollLeftValue+n:this._rtlScrollLeftValue-n:Math.abs(n));this.content().scrollLeft(n)},_ensureScrollers:function(){var u=n.fn.jquery,r;if(this.model.height=typeof this.model.height=="string"&&this.model.height.indexOf("px")!=-1?parseInt(this.model.height):this.model.height,this.model.width=typeof this.model.width=="string"&&this.model.width.indexOf("px")!=-1?parseInt(this.model.width):this.model.width,this.model.height&&this.element.height(this.model.height),this.model.width&&this.element.width(this.model.width),this._off(this.content(),"mousedown touchstart"),this.content().length>0){if(this.isVScroll()?(this._vScrollbar||(this._vScrollbar=this._createScrollbar(t.ScrollBar.Orientation.Vertical,this.isHScroll())),this.model.enableTouchScroll&&this._on(this.content(),"mousedown touchstart",{d:this._vScrollbar._scrollData},this._mouseDownOnContent)):(this._vScrollbar=null,this.element.children(".e-vscrollbar").remove()),this.isHScroll()?(this._hScrollbar||(this._hScrollbar=this._createScrollbar(t.ScrollBar.Orientation.Horizontal,this.isVScroll())),this.model.enableTouchScroll&&this._on(this.content(),"mousedown touchstart",{d:this._hScrollbar._scrollData},this._mouseDownOnContent)):(this._hScrollbar=null,this.element.children(".e-hscrollbar").remove()),this._vScrollbar||this._hScrollbar||this.content().css({width:"auto",height:"auto"}),this.element.find(".e-hscroll").length>0||this._vScrollbar&&this.content().outerHeight(this.content().outerHeight()-1),this._hScroll=this.isHScroll(),this._vScroll=this.isVScroll(),this._hScroll||this._vScroll){if(this.content().addClass("e-content"),u==="1.7.1"||u==="1.7.2"?(this._contentHeight="height",this._contentWidth="width"):(this._contentHeight="outerHeight",this._contentWidth="outerWidth"),r=this._exactElementDimension(this.element),this._ElementHeight=r.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.content()[this._contentHeight](this._ElementHeight-(this._hScroll&&!this.model.autoHide?this.model.scrollerSize:0)),this._ElementWidth=r.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.content()[this._contentWidth](this._ElementWidth-(this._vScroll&&!this.model.autoHide?this.model.scrollerSize:0)),isNaN(this._eleWidth)&&this._eleWidth.indexOf("%")>0&&isNaN(this._eleHeight)&&this._eleHeight.indexOf("%")>0)n(i).on("resize",n.proxy(this._resetScroller,this))}else this.content().removeClass("e-content");this._setDimension();this._parentHeight=n(this.element).parent().height();this._parentWidth=n(this.element).parent().width()}},_convertPercentageToPixel:function(n,t){return Math.floor(n*t/100)},isHScroll:function(){if(t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1){if(this.model.width>0){var i=this.content().find(this.model.targetPane);return this.model.targetPane!=null&&i.length?i[0].scrollWidth+i.siblings().width()>this.model.width:this.content()[0].scrollWidth>this.model.width?!0:this.content()[0].scrollWidth==this.model.width&&n(this.content()[0]).find("> *").length>0?n(this.content()[0]).find("> *")[0].scrollWidth>this.model.width:!1}return!1}return this.content()[0].scrollWidth>this.element.width()},isVScroll:function(){if(t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1){if(this.model.height>0&&(this.content()[0].scrollHeight>this.model.height||this.isHScroll()&&(this.content()[0].scrollHeight==this.model.height||this.content()[0].scrollHeight>this.model.height-(this.model.scrollerSize-2))))return!0}else return this.content()[0].scrollHeight>this.element.outerHeight();return!1},_setModel:function(n){for(var i in n)switch(i){case"enableRTL":n[i]?(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),t.isNullOrUndefined(this._hScrollbar)||(this._hScrollbar._scrollData.enableRTL=!0)):(this.element.removeClass("e-rtl"),t.isNullOrUndefined(this._hScrollbar)||(this._hScrollbar._scrollData.enableRTL=!1));this._hScrollbar&&(this.element.find(".e-hhandle").css("left",0),this._hScrollbar.value(0));break;case"scrollLeft":(parseFloat(t.util.getVal(n[i]))<0||!this._hScroll)&&(n[i]=0);this._externalCall=!0;this._hScrollbar&&(n[i]=parseFloat(t.util.getVal(n[i]))>this._hScrollbar._scrollData.scrollable?this._hScrollbar._scrollData.scrollable:parseFloat(t.util.getVal(n[i])));this._setScrollLeftValue(parseFloat(n[i]));this.scrollLeft(n[i]);!this._hScrollbar||this._hScrollbar._scrollData._scrollleftflag&&this.model.enableRTL||this.scrollX(n[i]);break;case"scrollTop":this._vScrollbar&&(n[i]=parseFloat(t.util.getVal(n[i]))>this._vScrollbar._scrollData.scrollable?this._vScrollbar._scrollData.scrollable:parseFloat(t.util.getVal(n[i])));(parseFloat(n[i])<0||!this._vScroll)&&(n[i]=0);this._externalCall=!0;this.content().scrollTop(parseFloat(n[i]));this.scrollTop(n[i]);this.scrollY(n[i]);break;case"touchScroll":this.model.enableTouchScroll?(this._vScrollbar&&this._on(this.content(),"mousedown touchstart",{d:this._vScrollbar._scrollData},this._mouseDownOnContent),this._hScrollbar&&this._on(this.content(),"mousedown touchstart",{d:this._hScrollbar._scrollData},this._mouseDownOnContent)):this._off(this.content(),"mousedown touchstart");break;case"scrollOneStepBy":this._vScrollbar&&(this._vScrollbar._scrollData.scrollOneStepBy=n[i],this._vScrollbar.model.smallChange=n[i]);this._hScrollbar&&(this._hScrollbar._scrollData.scrollOneStepBy=n[i],this._hScrollbar.model.smallChange=n[i]);break;case"buttonSize":this._vScrollbar&&(this._vScrollbar.model.buttonSize=this.model.buttonSize);this._hScrollbar&&(this._hScrollbar.model.buttonSize=this.model.buttonSize);this.refresh();break;case"height":this._eleHeight=n[i];this.refresh();break;case"width":this._eleWidth=n[i];this.refresh();break;default:this.refresh()}},_createScrollbar:function(i,r){var c=this,f,o,l,s,a,h=document.createElement("div"),e,u;return i===t.ScrollBar.Orientation.Vertical?(o=this.model.scrollerSize,l=t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1?f=this.model.height-(r?this.model.scrollerSize:0):f=this.element.height()-(r?this.model.scrollerSize:0),s=this.content()[0].scrollHeight,a=this.scrollTop()):(o=f=this.model.width-(r?this.model.scrollerSize:0),l=this.model.scrollerSize,t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1?(e=this.content().find(this.model.targetPane),s=this.model.targetPane!=null&&e.length?e[0].scrollWidth+e.parent().width()-e.width():this.content()[0].scrollWidth):(o=f=this.element.width()-(r?this.model.scrollerSize:0),s=this.content()[0].scrollWidth),a=this.scrollLeft()),this.element.children(".e-hscrollbar").length>0?n(this.element.children(".e-hscrollbar")).before(h):this.element.append(h),n(h).ejScrollBar({elementHeight:c._eleHeight,elementWidth:c._eleWidth,buttonSize:c.model.buttonSize,orientation:i,viewportSize:f,height:l,width:o,maximum:s-f,value:a,smallChange:this.model.scrollOneStepBy,largeChange:3*this.model.scrollOneStepBy,scroll:t.proxy(this._scrollChanged,this),thumbEnd:t.proxy(this._thumbEnd,this),thumbStart:t.proxy(this._thumbStart,this),thumbMove:t.proxy(this._thumbMove,this)}),u=n(h).ejScrollBar("instance"),i!==t.ScrollBar.Orientation.Vertical&&r||this._off(this.element,this._browser=="msie"?"wheel mousewheel":"mousewheel DOMMouseScroll",this._mouseWheel)._on(this.element,this._browser=="msie"?"wheel mousewheel":"mousewheel DOMMouseScroll",{d:u._scrollData},this._mouseWheel),i===t.ScrollBar.Orientation.Horizontal?this._scrollXdata=u._scrollData:this._scrollYdata=u._scrollData,i===t.ScrollBar.Orientation.Horizontal&&this.model.enableRTL&&(u._scrollData.enableRTL=!0),u._enabled=this.model.enabled,u},_updateScrollbar:function(i,r){var u=i===t.ScrollBar.Orientation.Vertical?this._vScrollbar:this._hScrollbar;u&&(i===t.ScrollBar.Orientation.Vertical?(u.model.width=this.model.scrollerSize,u.model.height=u.model.viewportSize=this.model.height-(r?this.model.scrollerSize:0),u.model.maximum=this.content()[0].scrollHeight-u.model.viewportSize,u.model.value=this.scrollTop()):(u.model.width=u.model.viewportSize=this.model.width-(r?this.model.scrollerSize:0),u.model.height=this.model.scrollerSize,u.model.maximum=(this.model.targetPane!=null&&this.content().find(this.model.targetPane).length>0?this.content().find(this.model.targetPane)[0].scrollWidth+(this.content().width()-n(this.model.targetPane).outerWidth()):this.content()[0].scrollWidth)-u.model.viewportSize,this.model.enableRTL||(u.model.value=this.scrollLeft())))},_autohide:function(){this.model.autoHide?(this.element.addClass("e-autohide"),this._on(this.element,"mouseenter mouseleave touchstart touchend",this._scrollerHover),this.content().siblings(".e-scrollbar.e-js").hide()):(this.element.removeClass("e-autohide"),this._off(this.element,"mouseenter mouseleave touchstart touchend",this._scrollerHover),this.content().siblings(".e-scrollbar.e-js").show())},_scrollChanged:function(i){this._updateScroll=!0;i.scrollTop!==r?this.scrollY(i.scrollTop,!0,"",i.source):i.scrollLeft!==r&&this.scrollX(i.scrollLeft,!0,"",i.source);this._updateScroll=!1;var u=this;n.when(this.content()).done(t.proxy(function(){u._trigger("scrollEnd",{scrollData:i})}))},_bindBlurEvent:function(r,u){this._scrollEle=n(r).data("ejScrollBar");this._event=u;var f=this;this._listener=function(){this._scrollEle._off(n(document),"mousemove touchmove",this._scrollEle._mouseMove);n(document).off("mouseup touchend",t.proxy(this._scrollEle._mouseUp,this._scrollEle));this._scrollEle._prevY=null;this._off(n(document),"mousemove touchmove",this._mouseMove);this._off(n(document),"mouseup touchend",this._mouseUp);this._off(n(i),"blur");this._evtData.handler==="e-vhandle"?this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData}):this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData})};this._on(n(i),"blur",this._listener)},_thumbStart:function(n){this._evtData=n.scrollData;var t=n.scrollData.handler==="e-vhandle"?this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"),t=n.scrollData.handler==="e-vhandle"?this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+n.scrollData.handler).closest(".e-scrollbar");this._bindBlurEvent(t,n);this._trigger("thumbStart",n)},_thumbMove:function(n){this._trigger("thumbMove",n)},_thumbEnd:function(t){this._trigger("thumbEnd",t);this._off(n(i),"blur")},refresh:function(i){var r,u;i||this.element.find(">.e-content").removeAttr("style");t.isNullOrUndefined(this._eleHeight)||typeof this._eleHeight!="string"||this._eleHeight.indexOf("%")==-1||this._parentHeight==n(this.element).parent().height()||(r=this._exactElementDimension(this.element.parent()),r=r.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),r));t.isNullOrUndefined(this._eleWidth)||typeof this._eleWidth!="string"||this._eleWidth.indexOf("%")==-1||this._parentWidth==n(this.element).parent().width()||(r=this._exactElementDimension(this.element.parent()),r=r.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),r));this._ensureScrollers();u=this.scrollLeft();this.model.enableRTL?(this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),u>0?this.content().scrollLeft(u):this._setScrollLeftValue(u)):this.content().scrollLeft(u);(this.scrollTop()&&this._vScrollbar==null||this._vScrollbar!==null&&this._vScrollbar&&this._vScrollbar._scrollData!=null&&!this._vScrollbar._scrollData.skipChange)&&this.content().scrollTop(this.scrollTop());this._vScrollbar&&(this._vScrollbar._scrollData.dimension="Height",this._updateScrollbar(t.ScrollBar.Orientation.Vertical,this._hScroll),this._vScroll&&!this._vScrollbar._calculateLayout(this._vScrollbar._scrollData)&&this._vScrollbar._updateLayout(this._vScrollbar._scrollData));this._hScrollbar&&(this._hScrollbar._scrollData.dimension="Width",this._updateScrollbar(t.ScrollBar.Orientation.Horizontal,this._vScroll),this._hScroll&&!this._hScrollbar._calculateLayout(this._hScrollbar._scrollData)&&this._hScrollbar._updateLayout(this._hScrollbar._scrollData));t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?this.element.find(".e-hhandle").css("left","0px"):this.model.targetPane!=null&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll);this._addActionClass();this._autohide()},_exactElementDimension:function(n){var i=n.get(0).getBoundingClientRect(),r=["left","right","top","bottom"],u,f,t;for(u=i.width?i.width:i.right-i.left,f=i.height?i.height:i.bottom-i.top,t=0;tthis._vScrollbar._scrollData.scrollable?this._vScrollbar._scrollData.scrollable:parseFloat(n));this.scrollTop(n);this.content().stop().animate({scrollTop:n},r,"linear",function(){e._trigger("scroll",{source:u||"custom",scrollData:e._vScrollbar?e._vScrollbar._scrollData:null,scrollTop:n,originalEvent:f})})}},scrollX:function(n,i,r,u,f){var o=this,e,s;if(n!==""){if(this._hScrollbar&&(n=parseFloat(n)>this._hScrollbar._scrollData.scrollable?this._hScrollbar._scrollData.scrollable:parseFloat(n)),this._externalCall=!0,e=t.browserInfo().name,this.model.enableRTL&&e!="mozilla"&&(n<0&&(n=Math.abs(n)),s=this.model.targetPane!=null?this.content().find(this.model.targetPane)[0]:this.content()[0],f!="mousemove"&&f!="touchmove"&&e!="msie"&&e!="msie"&&(n=this._hScrollbar._scrollData.scrollable-n)),this.scrollLeft(n),i){if(this._trigger("scroll",{source:u||"custom",scrollData:this._hScrollbar?this._hScrollbar._scrollData:null,scrollLeft:n,originalEvent:f}))return;this.model.targetPane!=null&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane).scrollLeft(n):this.content().scrollLeft(n);return}(t.isNullOrUndefined(r)||r==="")&&(r=100);this.model.targetPane!=null&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane).stop().animate({scrollLeft:n},r,"linear"):this.content().stop().animate({scrollLeft:n},r,"linear",function(){o._trigger("scroll",{source:u||"custom",scrollData:o._hScrollbar?o._hScrollbar._scrollData:null,scrollLeft:n,originalEvent:f})})}},enable:function(){var n=this.element.find(".e-vscrollbar,.e-hscrollbar,.e-vscroll,.e-hscroll,.e-vhandle,.e-hhandle,.e-vscroll .e-icon,.e-hscroll .e-icon");n.hasClass("e-disable")&&(n.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.enabled=!0);this._vScrollbar&&(this._vScrollbar._enabled=this.model.enabled);this._hScrollbar&&(this._hScrollbar._enabled=this.model.enabled)},disable:function(){var n=this.element.find(".e-vscrollbar,.e-hscrollbar,.e-vscroll,.e-hscroll,.e-vhandle,.e-hhandle,.e-vscroll .e-icon,.e-hscroll .e-icon");n.addClass("e-disable").attr({"aria-disabled":!0});this.model.enabled=!1;this._vScrollbar&&(this._vScrollbar._enabled=this.model.enabled);this._hScrollbar&&(this._hScrollbar._enabled=this.model.enabled)},_changeTop:function(n,i,r,u){var e=Math.ceil(this.model.targetPane!=null&&n.dimension!="height"?this.content().find(this.model.targetPane)[n.scrollVal]():this.content()[n.scrollVal]()),f;return n.dimension=="height"&&e==0&&(e=this.scrollTop()!=0?this.scrollTop():0),f=e+i,(n.enableRTL?fn.scrollable)&&(f=Math.round(n.scrollable)),(n.enableRTL?f>0:f<0)&&(f=0),f!==e&&(this["scroll"+n.xy](f,!0,"",r,u),n.xy!=="X"||t.isNullOrUndefined(this._hScrollbar)?t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(f,r,!0,u):this._hScrollbar.scroll(f,r,!0,u)),f!==e},_mouseWheel:function(t){var o;if((!this._vScrollbar||!t.ctrlKey)&&(this._vScrollbar||t.shiftKey)&&t.data&&this.model.enabled){var u=0,f=t.data.d,r=t,e;if(t=t.originalEvent,this._wheelStart&&this._trigger("wheelStart",{originalEvent:t,scrollData:r.data.d}),this._wheelStart=!1,clearTimeout(n.data(this,"timer")),this._wheelx!=1&&(t.wheelDeltaX==0||t.wheelDeltaY==0)&&(this._wheelx=1),navigator.platform.indexOf("Mac")==0&&this._wheelx==0&&(this._browser=="webkit"||this._browser=="chrome"))return!0;(this._browser=="mozilla"?t.axis==t.HORIZONTAL_AXIS?f=this._scrollXdata:this._scrollYdata:this._browser=="msie"?(t.type=="wheel"&&(u=t.deltaX/120),t.type=="mousewheel"&&t.shiftKey&&(f=this._scrollXdata,t.preventDefault?t.preventDefault():t.returnValue=!1)):this._wheelx&&t.wheelDeltaX!=0&&t.wheelDeltaY==0&&this._scrollXdata&&(f=this._scrollXdata),t.wheelDeltaX==0&&(this._wheelx=t.wheelDeltaX),t.wheelDelta?(u=navigator.platform.indexOf("Mac")==0?-t.wheelDelta/3:-t.wheelDelta/120,i.opera&&parseFloat(i.opera.version,10)<10&&(u=-u)):t.detail&&(u=t.detail/3),u)&&(r.originalEvent&&(e=r.originalEvent.wheelDelta&&r.originalEvent.wheelDelta>0||r.originalEvent.detail&&r.originalEvent.detail<0?-1:1),this._changeTop(f,u*f.scrollOneStepBy,"wheel",t)?(t.preventDefault?t.preventDefault():r.preventDefault(),r.stopImmediatePropagation(),r.stopPropagation(),this._trigger("wheelMove",{originalEvent:t,scrollData:r.data.d,direction:e})):(this._trigger("scrollEnd",{originalEvent:t,scrollData:r}),this._wheelx=0),o=this,n.data(this,"timer",setTimeout(function(){o._wheelStart=!0;o._trigger("wheelStop",{originalEvent:t,scrollData:r.data.d,direction:e})},250)))}},_contentHeightWidth:function(){this.content().siblings().css("display")=="block"&&this.model.autoHide&&this._hScroll?(this.content()[this._contentHeight](this._ElementHeight-this.model.scrollerSize),this.content()[this._contentWidth](this._ElementWidth-this.model.scrollerSize)):this.content().siblings().css("display")=="none"&&this.model.autoHide&&this._vScroll&&(this.content()[this._contentHeight](this._ElementHeight),this.content()[this._contentWidth](this._ElementWidth))},_scrollerHover:function(n){this.model.enabled&&(n.type!="mouseenter"&&n.type!="touchstart"||this.content().siblings().is(":visible")?(n.type=="mouseleave"||n.type=="touchend")&&(this.content().siblings().hide(),this._contentHeightWidth(),this._trigger("scrollHide",{originalEvent:n})):(this.content().siblings().css("display","block"),this._contentHeightWidth(),this._trigger("scrollVisible",{originalEvent:n})))},_mouseUp:function(r){if(r.data){var u=r.data.d;r.type!=="mouseup"&&r.type!=="touchend"&&(r.toElement||r.relatedTarget)||(this.content().css("cursor","default"),this._off(n(document),"mousemove touchmove"),this._off(n(document),"mouseup touchend",this._mouseUp),u.fromScroller=!1,this._mouseMoved!==!0||r.data.source!=="thumb"||t.isNullOrUndefined(this.model)||(n.when(this.content()).done(t.proxy(function(){this._trigger("thumbEnd",{originalEvent:r,scrollData:u})},this)),this._off(n(i),"blur")));u.up=!0}},_mouseDownOnContent:function(u){var f,s;if((this._startX=u.clientX!=r?u.clientX:u.originalEvent.changedTouches[0].clientX,this._startY=u.clientY!=r?u.clientY:u.originalEvent.changedTouches[0].clientY,this._timeStart=u.timeStamp||Date.now(),this.model.enabled)&&(f=u.data.d,this._evtData=u.data,s=f.handler==="e-vhandle"?this.element.find("."+f.handler).closest(".e-scrollbar"):this.element.find("."+f.handler).closest(".e-scrollbar"),this._bindBlurEvent(s,u),!this._trigger("thumbStart",{originalEvent:u,scrollData:f}))&&(u.which!=3||u.button!=2)){f.fromScroller=!0;var e=null,o=1,c=5,h;this._document=n(document);this._window=n(i);this._mouseMove=function(n){var s,l,u;if(this._relDisX=(this._startx=n.clientX!=r?n.clientX:n.originalEvent.changedTouches[0].clientX)-this._startX,this._relDisY=(this._starty=n.clientY!=r?n.clientY:n.originalEvent.changedTouches[0].clientY)-this._startY,this._duration=(n.timeStamp||Date.now())-this._timeStart,this._velocityY=Math.abs(this._relDisY)/this._duration,this._velocityX=Math.abs(this._relDisX)/this._duration,n.preventDefault(),!t.isNullOrUndefined(n.target.tagName)&&n.target.tagName.toLowerCase()==="iframe"){n.type="mouseup";this._mouseUp(n);return}if(s=n.type=="mousemove"?n[f.clientXy]:n.originalEvent.changedTouches[0][f.clientXy],e&&s!==e&&(this._mouseMoved=!0,l=s-e,u=this.model[f.scrollVal]-l,o==1&&Math.abs(l)>c&&(h=f.position,o=0),o==0&&(e=s),u>=0&&u<=f.scrollable&&h===f.position)){var a=this._velocityY>.5&&this._duration<50&&f.position=="Top",v=this._velocityX>.5&&this._duration<50&&f.position=="Left",y=(this._velocityY>.5||this._velocityX>.5)&&this._duration<50;y?a?(u=Math.abs(this._relDisY)+this._duration*this._velocityY,this._startY>this._starty?(u+=this.scrollTop(),u>f.scrollable&&(u=f.scrollable)):(uthis.scrollTop()&&(u=0)),this.scrollTop()<=f.scrollable&&this.scrollY(u,!1,this.model.animationSpeed,"thumb")):v&&(u=Math.abs(this._relDisX),this._startX>this._startx?(u+=this.scrollLeft(),u>f.scrollable&&(u=f.scrollable)):(u-=this.scrollLeft(),u=Math.abs(u),(u>f.scrollable||u>=this.scrollLeft())&&(u=0)),this.scrollLeft()<=f.scrollable&&this.scrollX(u,!1,this.model.animationSpeed,"thumb")):(this["scroll"+f.xy](u,!0,"","thumb",n.type),f.xy==="X"?this._hScrollbar.scroll(u,"thumb",!0,n.type):t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(u,"thumb",!0,n.type),this.content().css("cursor","pointer"),this._trigger("thumbMove",{originalEvent:n,scrollData:f}))}e==null&&(e=s);this._swipe=Math.abs(this._relDisX)>Math.abs(this._relDisY)?this._relDisX<0?"left":"right":this._relDisY<0?"up":"down";Math.round(this._content.scrollTop())==0&&this._swipe=="down"||Math.ceil(this._content.scrollTop())==f.scrollable&&this._swipe=="up"?(this._trigger("scrollEnd",{originalEvent:n.originalEvent,scrollData:n}),i.removeEventListener&&i.removeEventListener("DOMMouseScroll",this._preventDefault,!1),i.ontouchmove=null):n.data.d.clientXy=="pageY"&&(i.addEventListener&&i.addEventListener("DOMMouseScroll",this._preventDefault,!1),i.ontouchmove=this._preventDefault)};this._on(n(document),"mousemove touchmove",{d:f,source:"thumb"},this._mouseMove);this._mouseMoved=!1;this._on(n(document),"mouseup touchend",{d:f,source:"thumb"},this._mouseUp)}},_scroll:function(n){for(var i,u,f=[this._vScrollbar?this._vScrollbar._scrollData:null,this._hScrollbar?this._hScrollbar._scrollData:null],r=0;r<2;r++)if(i=f[r],i&&!i.skipChange){if(this._externalCall||(i.dimension==="height"?this.scrollTop(n.target[i.scrollVal]):this.scrollLeft(n.target[i.scrollVal])),i.sTop=this.model&&this.model.targetPane!=null&&r==1&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane)[0][i.scrollVal]:i.scrollVal=="scrollTop"?this.scrollTop():this.scrollLeft(),this[i.scrollVal](i.sTop),i.fromScroller)return;r===1?(u=this.content()[0],this._rtlScrollLeftValue&&u.scrollWidth-u.clientWidth!=this._rtlScrollLeftValue&&(this._rtlScrollLeftValue=u.scrollWidth-u.clientWidth),i.sTop=this.model&&t.browserInfo().name!="mozilla"&&this.model.enableRTL&&!this._hScrollbar._scrollData._scrollleftflag?this._rtlScrollLeftValue==0?i.sTop*-1:i.sTop-this._rtlScrollLeftValue:i.sTop,this._hScrollbar.scroll(i.sTop,"",!0)):this._vScrollbar.scroll(i.sTop,"",!0);(f.length==2&&r==1||f.length==1&&r==0)&&(this._externalScroller=!1)}},_changevHandlerPosition:function(n){var t=this._vScrollbar;t&&(n=t._scrollData!=null&&n>=t._scrollData.scrollable?t._scrollData.scrollable:n,t!=null&&n>=0&&n<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,n/t._scrollData.onePx+"px"))},_changehHandlerPosition:function(n){var t=this._hScrollbar;t&&(n=t._scrollData!=null&&n>=t._scrollData.scrollable?t._scrollData.scrollable:n,t!=null&&top>=0&&n<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,n/t._scrollData.onePx+"px"))},_destroy:function(){this.element.css({width:"",height:""}).find(".e-vscrollbar,.e-hscrollbar").remove();this.content().removeClass("e-content").css({width:"",height:""})},_preventDefault:function(n){n=n||i.event;n.preventDefault&&n.preventDefault();n.returnValue=!1}})}(jQuery,Syncfusion,window),function(n,t,i){t.widget("ejNavigationDrawerBase","ej.NavigationDrawerBase",{defaults:{contentId:null,cssClass:"",direction:"left",targetId:null,position:"normal",enableListView:!1,listViewSettings:{},type:"overlay",width:"auto",swipe:null,open:null,beforeClose:null,items:[],ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},ajaxSuccess:null,ajaxError:null,ajaxComplete:null},dataTypes:{direction:"enum",type:"enum",ajaxSettings:"data"},loadContent:function(i,r){var f=this,u,e,o;r.indexOf("#")==0?(u=n(r)[0]&&n(r)[0].nodeName&&n(r)[0].nodeName.toLowerCase()=="script"?t.getClearString(n(r)[0].innerHTML):r,u!=n(r)&&(n(u).length!=0?this._scriptTemplate.push({id:r,data:n(u)}):(e=n.grep(this._scriptTemplate,function(n){if(n.id==u)return n.data}),u=e.length>0?e[0].data[0]:u)),n(i).html(n(u)),this._hide()):(o={url:r,success:function(t){try{n(i).html(t);f._trigger("ajaxSuccess",{data:t,url:r,content:i});f._hide()}catch(u){}},error:function(n){try{f._trigger("ajaxError",{data:{status:n.status,responseText:n.responseText,statusText:n.statusText},content:i,url:r});f._hide()}catch(n){}},complete:function(n){try{f._trigger("ajaxComplete",{data:n,content:i,url:r})}catch(n){}}},this._sendAjaxRequest(o))},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_shadowWrapper:function(){this.model.isPaneOpen||(this._elementOverlay=t.buildTag("div#"+this._id+"_Overlay",{},{},{"class":this._rootCSS+" "+this._prefixClass+"nb-layout "+this._prefixClass+"nb-overlay"}),this._elementShadow=t.buildTag("div#"+this._id+"_shadow",{},{},{"class":this._rootCSS+" "+this._prefixClass+"nb-shadow "+this._prefixClass+"nb-type-"+(this.model.type=="slide"?"slide":"overlay")}),this._nbHome.append(this._elementOverlay),this._elementOverlay.hide(),this.element.hide(),this.element.prepend(this._elementShadow))},_renderControl:function(){this.model.position.toLowerCase()=="fixed"&&this.element.appendTo(this._nbHome);this._shadowWrapper();this.element.addClass(this._prefixClass+"user-select "+this.model.cssClass);this.element.addClass(this._prefixClass+"nb-layout "+(this.model.direction.toLowerCase()=="left"?this._prefixClass+"nb-left":this._prefixClass+"nb-right"));this.element.addClass(this._prefixClass+"nb-type-"+(this.model.type=="slide"?"slide":"overlay"));this._maxIndex=this._getMaxZindex();this._parentWidth=this._nbHome.width();this._setWidth();this._setLayout()},_getMaxZindex:function(){return Math.max.apply(null,n.map(n("body *"),function(t){return parseInt(n(t).css("z-index"))+1||1}))},_transform:function(t,i,r){var s="-"+this._browser+"-transform",u="translateX("+t+"px) translateZ(0px)",h="-"+this._browser+"-transition-property",f="transform",c="-"+this._browser+"-transition-duration",e=i+"ms",o;r?(o=this.model.position=="fixed"?"e-nb-fixed":"",this.model.position=="normal"&&this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").addClass("e-nb-normal"),this.element.addClass(""+this._prefixClass+"nb-animate "+o),this.element.css(h,f).css(c,e).css(s,u),this.element.css("transition-property",f).css("transition-duration",e).css("transform",u)):(o=this.model.position=="fixed"?"e-nb-fixed":"",this.model.position=="normal"&&this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").addClass("e-nb-normal"),this._nbHome.addClass(this._rootCSS+" "+this._prefixClass+"nb-animate "+o),this._nbHome.css(h,f).css(c,e).css(s,u),this._nbHome.css("transition-property",f).css("transition-duration",e).css("transform",u))},_show:function(){t.isNullOrUndefined(this.element.css("left").match(/\d/g))||Number(this.element.css("left").match(/\d/g)[0]r.clientX?"right":"left";u=this._isOpened()?this._swipeDirection!=this.model.direction.toLowerCase()?!0:!1:!1;u?this._startSwipeOffsetX&&this._isOpened()&&(this._relativeX=r.clientX-this._startSwipeOffsetActualX,this._relativeY=r.clientY-this._startSwipeOffsetY,f=this.element.width()+this._relativeX-(this.model.type.toLowerCase()=="overlay"?this._nbHome.offset().left:0),n(r.target).hasClass(""+this._prefixClass+"nb-overlay")&&(this.model.direction=="left"?-this._relativeXthis._nbHome.width()-50)&&(this.element.show(),r=this.model.type.toLowerCase()=="slide"?0:this._nbHome.offset().left,(this.model.direction=="left"?this._relativeX-r-this.element.width())&&(!this._containerX||this.model.targetHome?this._transform(this._containerX+this._relativeX-r,0,this._isTransitionElement()):i)))},_touchEnd:function(r){var u=r.changedTouches?r.changedTouches[0]:r;t.listenTouchEvent(this._nbHome,t.moveEvent(),this._touchMoveHandler,!0,this);this._isOpened()||(n.isFunction(t.isIOS7)?t.isIOS7():!1)||(this._containerX?this._hide():(this._relativeX=u.clientX-this._startSwipeOffsetX,this._relativeY=u.clientY-this._startSwipeOffsetY,(this.model.direction=="left"?this._startSwipeOffsetX<50:this._startSwipeOffsetX>this._nbHome.width()-50)&&(this._relativeX>30||this._relativeX<-30?this._show():this._hide())));this._data={targetElement:this._nbHome,element:this.element,direction:this._swipeDirection};this.model.enableListView?n.extend(this._data,{listview:this._lb}):i;this._trigger("swipe",this._data);t.listenTouchEvent(this._nbHome,t.endEvent(),this._touchEndHandler,!0,this);t.listenTouchEvent(this._nbHome,"mouseleave",this._touchEndHandler,!0,this)},open:function(){this.model.isPaneOpen||this._show()},close:function(){this.model.isPaneOpen||(this._data={element:this.element},this.model.enableListView?n.extend(this._data,{listview:this._lb}):i,this._trigger("beforeClose",this._data),this._hide())},toggle:function(){this.model.isPaneOpen||(this._isOpened()?this.close():this.open())}})}(jQuery,Syncfusion),function($,ej,undefined){ej.widget("ejListViewBase","ej.ListViewBase",{_addToPersist:["selectedItemIndex","checkedIndices"],defaults:{height:null,width:null,selectedItemIndex:-1,enableGroupList:!1,enableAjax:!1,enableCache:!1,enablePersistence:!1,ready:null,load:null,itemRequestCount:5,totalItemsCount:null,loadComplete:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,ajaxComplete:null,ajaxSettings:{type:"GET",cache:!1,async:!0,dataType:"html",contentType:"html",url:"",data:{}},renderTemplate:!1,templateId:null,persistSelection:!1,preventSelection:!1,dataSource:[],query:null,allowVirtualScrolling:!1,virtualScrollMode:"normal",showHeader:!1,showHeaderBackButton:!1,cssClass:"",headerTitle:"Title",headerBackButtonText:null,enableFiltering:!1,enableCheckMark:!1,checkedIndices:[],locale:"en-US"},observables:["selectedItemIndex","dataSource"],selectedItemIndex:ej.util.valueFunction("selectedItemIndex"),dataSource:ej.util.valueFunction("dataSource"),checkedIndices:ej.util.valueFunction("checkedIndices"),_updateModelItems:function(){var ang_attr,ang_li,ele,ul,groupid,element,groupTitle,element1,primaryKey,parentPrimaryKey;if(this.model.items=eval(this.model.items),ang_attr=this.model.items,ang_attr.length){for(ul=ej.buildTag("ul.e-m-clearall"),i=0;iul"),groupid=1,ulindex=0;ulindexli"),index=0;indexli"),index1=0;index1"):f[0].outerHTML.replace(/>/g,">"),this.jsChildRender=ej.buildTag("script#"+this.model.id+"_ChildTemplate","",{},{type:"text/x-jsrender"}),u=ej.buildTag("ul."+this._prefixClass+"childcontainer "+this._prefixClass+"list-hdr "+this._prefixClass+"clearall"),f.addClass(this._prefixClass+"childli"),u[0].innerHTML="{{for items}}"+f[0].outerHTML+"{{/for}}",r=n,r)for(u.empty().html($(this.jsRender).render(r)),i=u.clone().find("li"),s="",this._initEJCheckBox&&this._initEJCheckBox(u),c=this,t=0;tul"):this.element.find("ul:first"),this.model.showHeader&&(hdr=this._renderHeader(this.model.id,!1,this.model.headerTitle,this.model.headerBackButtonText),this._lbEle.prepend(hdr)),this._hasDataSource()&&!this.model.renderTemplate&&this.element.empty(),this.model.renderTemplate&&(this.model.templateId?this._tempContent.find("#"+this.model.templateId).length&&(this._template=this._tempContent.find("#"+this.model.templateId),ej.destroyWidgets(this._template),this._template[0].nodeName.toLowerCase()!="script"&&this._template.remove(),this._template=this._template[0].nodeName&&this._template[0].nodeName.toLowerCase()=="script"?ej.getClearString(this._template[0].innerHTML):this._template[0].outerHTML):(ej.destroyWidgets(this.element),this._template=this.element.html(),this.element.empty()),this._lContainer.addClass(this._prefixClass+"template-list")),!this.model.renderTemplate||this._hasDataSource()||this.model.enableGroupList){if(!this.model.renderTemplate||this.model.renderTemplate&&this._hasDataSource()||this.model.renderTemplate&&this.model.enableGroupList){if(this._model_index=0,this.model.enableGroupList){if(this._lContainer.addClass(this._prefixClass+"grouped"),innerDiv=ej.buildTag("div."+this._prefixClass+"grouplist"),ul=this.element.children(),ul.length||this.dataSource().length)for(group=this.dataSource().length?ej.DataManager(this.dataSource()).executeLocal(ej.Query().from(this.dataSource()).group(this.model.fieldSettings.groupID)):ej.DataManager(this.model.items).executeLocal(ej.Query().from(this.model.items).group(this.model.fieldSettings.groupID)),length=group.length,i=0;i=0&&!this.model.preventSelection&&this.model.persistSelection&&!ej.getBooleanVal(ulItems[this.selectedItemIndex()],"data-preventselection",this.model.preventSelection)&&ej.getBooleanVal(ulItems[this.selectedItemIndex()],"data-persistselection",this.model.persistSelection)&&(this._currentItem=$(this._liEl[this.selectedItemIndex()]),this._prevItem=this._currentItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"));$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"lv-checkdiv");this.model.renderTemplate&&$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark");$(this.element.find("."+this._prefixClass+"lv-check").closest("li."+this._prefixClass+"list")).addClass(this._prefixClass+"list-check");$(this.element.find("."+this._prefixClass+"lv-input").closest("."+this._prefixClass+"lv-filter")).addClass(this._prefixClass+"lv-inputdiv");this._wireEvents()}}else this.element.append(this._lbEle.append(this._lContainer)),$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark"),this._template&&(this._lContainer.append(this._template),ej.widget.init&&ej.widget.init(this._lContainer));this._setHeightWidth();this.model.height!==null&&this._lContainer.height()>this.model.height&&this._refreshScroller(this._lContainer,!1);this.scrollerObj&&(this.scrollerObj.refresh(),$(this.scrollerObj.element).find(".e-vhandlespace").css("height",$(this.scrollerObj.element).find(".e-vhandlespace").height()-1));this.model.loadComplete&&this._trigger("loadComplete")},_createFilterWrapper:function(n){var t=this._createFilterDiv(),i=ej.buildTag("a."+this._prefixClass+"lv-anchor",ej.buildTag("span."+this._prefixClass+"input-btn"),{},{Title:"Clear text","data-role":"none"});$(t).append(i);n.append(t)},_refreshScroller:function(n,t){this.model.virtualScrollMode=="continuous"&&(this._lContainer.find(".e-content, .e-vhandle,.e-vhandle div").removeAttr("style"),this._lContainer.css({display:"block"}),this.scrollerObj&&(this.scrollerObj.model.height=this._lContainer.height(),this.scrollerObj.refresh(),this.scrollerObj.option("scrollTop",0)));n.find(".e-vhandle div").removeAttr("style");hgt=t?this.model.showHeader&&this.model.enableFiltering?this.model.height-(ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")+ej.getDimension($(id).find("."+this._prefixClass+"lv-filter"),"outerHeight"))-2:this.model.showHeader?this.model.height-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")-2:this.model.enableFiltering?this.model.height-ej.getDimension($(id).find("."+this._prefixClass+"lv-filter"),"outerHeight")-2:this.model.height-2:this.model.showHeader&&this.model.enableFiltering?this.model.height-(ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")+$("."+this._prefixClass+"lv-filter").height())-2:this.model.showHeader?this.model.height-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")-2:this.model.enableFiltering?this.model.height-$("."+this._prefixClass+"lv-filter").height()-2:this.model.height-2;this.scrollerObj&&(this.scrollerObj.model.height=hgt)},_renderListItems:function(n){var u,e,i,r,f,t;if(n.addClass(this._prefixClass+"list-hdr "+this._prefixClass+"clearall"),this._liItems=n.find("li"),(this._liItems.length&&!this._hasDataSource()||this._hasDataSource())&&(this._renderParentChildTemplate(),this._hasDataSource()||this.model.enableGroupList||(this._items=this.model.items),u=this._items,e=this,i=this.model.allowVirtualScrolling?this._initDataSource(u):this._filterParentChild(u),i.child.length&&this._childRendering(i.child),i.parent))for(n.empty().html($(this.jsRender).render(i.parent)),r=n.find(">li"),f="",t=0;tthis._lContainer.outerHeight()/$(f).outerHeight()&&(t=Math.round(t),r=Math.round(this.itemIndex+e)),this.itemIndex<=t<=0&&(t=0),this._dataUrl.length==undefined&&this._temp==this._dataUrl?ej.DataManager&&this._dataUrl instanceof ej.DataManager&&(o=t==0?t:t-1,s=t==this.element.find("li").length?t:t+1,this._queryPromise(o,i,s+Math.ceil(this.model.height/u),n)):this._temp!=this._dataUrl?this._queryPromise(t,i,this._listitems.length,n):this._dataUrl.length>0&&this._loadQueryData(t,r,i);else if(this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="continuous"&&this.element.find("li").length-2<=(this.scrollerObj.scrollTop()+this.model.height)/this.element.find("li").outerHeight()&&(this.lastScrollPosition=this.scrollerObj.scrollTop(),t=this.element.children().length,t<=0&&(t=0),this._oldStartValue&&(t=this._oldStartValue),h=this.model.totalItemsCount?this.model.totalItemsCount:this._items.length,this.element.find("li").length0){if(this._isScrollComplete)return;this._loadQueryData(i.realUllength,i.realUllength+this.model.itemRequestCount,i)}}},_loadQueryData:function(n,t,i){this._isScrollComplete=t>=this._items.length?!0:!1;this._updateLoadingClass(!0);var r=this.dataSource();this._loadVirtualData(r.slice(n,t))._updateLoadingClass();i.model.virtualScrollMode=="continuous"&&(i.scrollerObj.option("scrollTop",i.lastScrollPosition),i.scrollerObj.refresh())},_updateLoadingClass:function(n){var t=this.element.attr("id");return n?($("#"+t+" .e-list-container.e-scroller >ul").addClass("e-load"),$(".e-lv .e-list.e-state-default").css("opacity","0.5")):($("#"+t+" .e-list-container.e-scroller >ul").removeClass("e-load"),$(".e-lv .e-list.e-state-default").css("opacity","1")),this},_queryPromise:function(n,t,i,r){this._trigger("itemRequest",{event:r,isInteraction:!0});var u=this._savedQueries.clone(),f=this._dataUrl.executeQuery(u.range(n,i));this._updateLoadingClass(!0);f.done(function(i){t._trigger("actionBeforeSuccess",i);t.realUllength=n;t._loadVirtualData(i.result);t.model.virtualScrollMode=="continuous"&&(t.scrollerObj.refresh(),t.scrollerObj.option("scrollTop",t.lastScrollPosition),t._updateLoadingClass(!1));t._trigger("actionSuccess",i)}).fail(function(n){t._trigger("actionFailure",n)}).always(function(n){t._trigger("actionComplete",n)})},_filterParentChild:function(n){var t=ej.DataManager(n),i=t.executeLocal(ej.Query().from(n).where(ej.Predicate(this.model.fieldSettings.parentPrimaryKey,ej.FilterOperators.notEqual,null)).group(this.model.fieldSettings.parentPrimaryKey)),r=t.executeLocal(ej.Query().from(n).where(ej.Predicate(this.model.fieldSettings.parentPrimaryKey,ej.FilterOperators.equal,null)));return{parent:r,child:i}},_childRendering:function(n){var t=this;n.length&&(t.element.append($(t.jsChildRender).render(n)),$.each(n,function(i,r){var e,f,u;for(ej.widget.init&&ej.widget.init(t.element.find("#child"+r.key)),e=t.element.find("#child"+r.key).find("ul"),f=e.find("li"),k=0,u=0;u"):t[0].outerHTML.replace(/>/g,">");this.jsChildRender=ej.buildTag("script#"+this.model.id+"_ChildTemplate","",{},{type:"text/x-jsrender"});i=ej.buildTag("ul."+this._prefixClass+"childcontainer "+this._prefixClass+"list-hdr "+this._prefixClass+"clearall");t.addClass(this._prefixClass+"childli");i[0].innerHTML="{{for items}}"+t[0].outerHTML+"{{/for}}";n=ej.buildTag("div."+this._rootCSS+" subpage "+this._prefixClass+"childitem","",{},{id:"{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}",style:"display:none"});r=ej.buildTag("div."+this._prefixClass+"list-container","",{},{id:"{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}_container"});this.model.showHeader&&n.append(this._renderHeader("{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}",!0,"Title"));this.model.enableFiltering&&this._createFilterWrapper(n);n.append(r.append(i));ej.browserInfo().name=="msie"&&ej.browserInfo().version<10?this.jsChildRender[0].text=n[0].outerHTML.replace(/>/g,">"):this.jsChildRender[0].innerHTML=n[0].outerHTML.replace(/>/g,">")},_renderChild:function(n){this._currentItem.attr("data-childid",n);this._currentItem.attr("data-childtitle")||this._currentItem.attr("data-childtitle",this._currentItem.text());this._createListDiv(n);this._div.hide();this._container=ej.buildTag("div."+this._prefixClass+"list-container#"+n+"_container");this.element.append(this._div)},_getText:function(n){return $(n).clone().children().remove().end().text()},_checkImgUrl:function(){var n=this.getRsc("helpers","Object"),t=this.data[n.model.fieldSettings.imageUrl];return $.support.pushstate||(t=typeof App=="object"?App.route.makeUrlAbsolute(t,!0):t),""},_checkAjaxUrl:function(){var t=this.data.href,u=this.data.childId,e=this.data.renderTemplate,o=this.data.templateId,n=this.getRsc("helpers","Object"),f=this.getRsc("helpers","ej"),r=n._currentPage(n),i;t&&t.indexOf("#")!=-1&&t!="#"?n._storedContent[u]||(r.find(t).show(),i=r.find(t).clone(),r.find(t).hide(),n._storedContent[u]=i[0].nodeName&&i[0].nodeName.toLowerCase()=="script"?f.getClearString(i[0].innerHTML):i[0].outerHTML):n._storedContent[this.index]&&(n._storedContent=f._pushValue(n._storedContent,"",this.index))},_currentPage:function(n){return n._prefixClass=="e-m-"?ej.getCurrentPage():$("body")},_checkIsCheck:function(){return this.data[this.getRsc("helpers","Object").model.fieldSettings.checked]?!0:!1},_onTouchStartHandler:function(n){if(this._mouseDown={x:ej.isNullOrUndefined(n.clientX)?n.touches[0].clientX:n.clientX,y:ej.isNullOrUndefined(n.clientY)?n.touches[0].clientY:n.clientY},$(n.target.parentElement).hasClass(this._prefixClass+"disable")||$(n.currentTarget).hasClass(this._prefixClass+"disable"))return!1;ej.isDevice()||ej._preventDefaultException(n.target,this._preventDefaultException)||n.preventDefault&&n.preventDefault();ej.isWindows&&ej.isWindows()&&ej._touchStartPoints(n,this);this._currentItem=$(n.currentTarget);this._scroll=!1;ej.getBooleanVal(this._currentItem,"data-preventSelection",this.model.preventSelection)||this._addSelection();this.model.renderMode!="windows"||this.model.windows.preventSkew||this._currentItem.addClass(this._prefixClass+"m-skew-center");this._triggerStartEvent(this._returnData());ej.listenEvents([this._liEl,this._liEl],[ej.endEvent(),ej.moveEvent(),ej.cancelEvent()],[this._touchEndDelegate,this._touchMoveDelegate,this._touchMoveDelegate],!1,this);$(window).on(ej.endEvent()+" MSPointerUp pointerup",this._docClickDelegate)},_onTouchMoveHandler:function(n){(ej.browserInfo().name=="msie"&&ej.browserInfo().version>8||ej.browserInfo().name!="msie")&&((ej.isNullOrUndefined(n.clientX)?n.changedTouches[0].clientX!==this._mouseDown.x:n.clientX)||(ej.isNullOrUndefined(n.clientY)?n.changedTouches[0].clientY!==this._mouseDown.y:n.clientY))&&(this._isMoved=!0,ej.isMobile()&&(!ej.isWindows||ej.isWindows&&!ej.isWindows()||ej.isWindows&&ej.isWindows()&&ej._isTouchMoved(n,this))&&(this._scroll=!0,ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)?this._prevItem&&this._prevItem[0]!=this._currentItem[0]&&this._removeSelection():this._removeSelection(),this.model.renderMode!="windows"||this.model.windows.preventSkew?!ej.getBooleanVal(this._currentItem,"data-preventselection",this.model.preventSelection)&&this._prevItem&&ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)&&this._prevItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"):ej._removeSkewClass(this._currentItem)))},_onTouchEndHandler:function(n){var u,r,t,i,f,e;if(this._isFromAjax=!1,ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)||this._removeSelection(),this.model.renderMode!="windows"||this.model.windows.preventSkew||ej._removeSkewClass(this._currentItem),this._scroll)return this._setCurrent(),this._unbindEvents(n),!1;if(!this._scroll){if(this._currentItem.find("."+this._prefixClass+"lv-check").length&&(u=this._currentItem.find("."+this._prefixClass+"lv-check"),this._prefixClass!="e-"||ej.isNullOrUndefined(n)||$(n.target).closest(".e-lv-checkdiv").length||this._toggleCheckboxValue(u)),r=this._currentItem.attr("data-childheaderbackbuttontext")==undefined?this._currentItem.closest("."+this._rootCSS+"").find("."+this._prefixClass+"header").length&&!this.model.showHeaderBackButton?this._currentItem.closest("."+this._rootCSS+"").find("."+this._prefixClass+"header ."+this._prefixClass+"htitle").text():"Back":ej.getAttrVal(this._currentItem,"data-childheaderbackbuttontext"),t=this._currentItem.attr("data-href"),this._currentItem.attr("data-navigateUrl"))this._touchEndEventHandler();else{if(i=this._isInsideNavigation?this._tempContent.find("[data-ajaxurl='"+this._convertToRelativeUrl(t)+"']"):this.element.find("[data-ajaxurl='"+this._convertToRelativeUrl(t)+"']"),ej.getBooleanVal(this._currentItem,"data-loadajax",this.model.enableAjax&&typeof t!="undefined"||!typeof t)&&(!this.model.enableCache||i.length==0)){i.length&&i.remove();(this._prefixClass=="e-"&&this._currentItem.hasClass("e-arrow")||this._prefixClass!="e-")&&this.loadAjaxContent(t,r);this._unbindEvents(n);this._isInsideNavigation&&this._nearestND.model.contentId&&this._closeNavigation();return}t&&t.indexOf("#")!=-1&&this._currentPage(this).find("#"+t.replace("#","")).length&&(this._renderChild(ej.getAttrVal(this._currentItem,"data-childid","page_"+parseInt(Math.random().toFixed(3)*1e3))),f=ej.buildTag("div."+this._prefixClass+"content",this._storedContent[this._currentItem.attr("data-childid")]),this._div.append(this._container.append(f)),ej.widget.init&&ej.widget.init(this._div));this._updateContent(this._currentItem,r);this.model.ready&&this._trigger("ready");this._isInsideNavigation&&(e=this._nearestND.model.contentId?!this._currentItem.attr("data-childid")||this._currentItem.attr("data-href"):!(this._currentItem.attr("data-childid")||this._currentItem.attr("data-href")));this._isInsideNavigation&&e&&this._closeNavigation();this._touchEndEventHandler(n)}this._prevItem=this._currentItem}this._unbindEvents(n)},_hasValue:function(n,t){for(var i=0;i","g"),"").toLowerCase())):this._elementText.push("")},_onKeyUp:function(n){for(var t=0;t]*>/gmi.test(r)?r.split(/<\/?body[^>]*>/gmi)[1]:r||""),f;i._div.append(i._container.append(u));i._updateContent(i._currentItem,t);(App.angularAppName||ej.angular.defaultAppName)&&ej.angular.compile(u);f={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxSuccess&&i._trigger("ajaxSuccess",f)},errorHandler:function(t,r,u){var f={xhr:t,textStatus:r,errorThrown:u,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxError&&i._trigger("ajaxError",f)},completeHandler:function(){var t={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxComplete&&i._trigger("ajaxComplete",t)}};ej.sendAjaxRequest(u)},selectItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&(this.setActive(n,t),this._currentItem=$(this._getElement(t).find("li."+this._prefixClass+"list")[n]),this._prevItem=this._currentItem,this._onTouchEndHandler())},setActive:function(n,t){n>=0&&(element=this._getElement(t),this._isEnable($(element.find("li."+this._prefixClass+"list")[n]))&&ej.getBooleanVal($(element.find("li."+this._prefixClass+"list")[n]),"data-persistSelection",this.model.persistSelection)&&(element.find("li."+this._prefixClass+"list."+this._prefixClass+"state-active").removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default"),this._currentItem=$(element.find("li."+this._prefixClass+"list")[n]),this._prevItem=this._currentItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active")))},deActive:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default")},enableItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).removeClass(this._prefixClass+"disable").addClass(this._prefixClass+"state-default").find("a").removeClass(this._prefixClass+"disable").find("."+this._prefixClass+"lv-check").ejCheckBox("enable")},disableItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).addClass(this._prefixClass+"disable").removeClass(this._prefixClass+"state-default").find("a").addClass(this._prefixClass+"disable").find("."+this._prefixClass+"lv-check").ejCheckBox("disable")},removeCheckMark:function(n,t){this._removeIndex=n;element=this._getElement(t);n>=0&&this._isEnable($(element.find("li."+this._prefixClass+"list")[n]))?$(element.find("li."+this._prefixClass+"list")[n]).find("."+this._prefixClass+"lv-checkdiv").remove():element.find("."+this._prefixClass+"lv-checkdiv").remove()},checkItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&this._setCheckboxValue($(this._getElement(t).find("."+this._prefixClass+"lv-check")[n]),!0)},unCheckItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&this._setCheckboxValue($(this._getElement(t).find("."+this._prefixClass+"lv-check")[n]),!1)},checkAllItem:function(n){var t=this;this._getElement(n).find("."+this._prefixClass+"lv-check").each(function(i,r){t._isEnable($(t._getElement(n).find("li."+t._prefixClass+"list")[i]))&&t._setCheckboxValue($(r),!0)})},unCheckAllItem:function(n){var t=this;this._getElement(n).find("."+this._prefixClass+"lv-check").each(function(i,r){t._isEnable($(t._getElement(n).find("li."+t._prefixClass+"list")[i]))&&t._setCheckboxValue($(r),!1)})},getActiveItem:function(n){return this._getElement(n).find("li."+this._prefixClass+"list."+this._prefixClass+"state-active")},getActiveItemText:function(n){return this._getElement(n).find("li."+this._prefixClass+"list."+this._prefixClass+"state-active").text()},getItemText:function(n,t){if(n>=0)return $(this._getElement(t).find("li."+this._prefixClass+"list")[n]).text()},getCheckedItems:function(n){return n!=undefined?this._getElement(n).find("input."+this._prefixClass+"lv-check:checked").closest("li."+this._prefixClass+"list"):this.element.find("input."+this._prefixClass+"lv-check:checked").closest("li."+this._prefixClass+"list")},getCheckedItemsText:function(n){return $(this.getCheckedItems(n)).map(function(){return $(this).text()}).get()},hasChild:function(n,t){if(n>=0)return this.element.find("#"+$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).attr("data-childid")).length?!0:!1},isChecked:function(n,t){if(n>=0)return $(this._getElement(t).find("li."+this._prefixClass+"list")[n]).find("input."+this._prefixClass+"lv-check").prop("checked")},showItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).css("visibility","")},hideItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).css("visibility","hidden")},show:function(n){this._getElement(n).css("visibility","")},hide:function(n){this._getElement(n).css("visibility","hidden")},_objectSplice:function(n,t){for(var i=0;i=0)if(this._hasDataSource()){if(typeof n=="object")for(r=0;r div > ul").append(s)),typeof n=="object"?this._objectSplice(n,t):this.model.items.splice(t,0,this._getLiAttributes(n,null,null,i)),f=this.model.items;else this._orgEle.children().append(n);if(u=this.model.enableGroupList?$(this.element.find("ul[data-ej-grouplisttitle= "+i+"]")):$(this.element.find("ul:visible")),ej.isNullOrUndefined(this.jsRender))this._renderControl(),$(this.element).find(".subpage").length>1&&$(this.element).find(".subpage:nth-child(2)").remove();else{if(typeof n=="object")for(r=0;r0&&$(e).addEleAttrs($($(n).attrNotStartsWith(/^data-ej-/)))}this._processing(u);this._liEl=this.element.find("li."+this._prefixClass+"list");this._initEJCheckBox&&(this._initEJCheckBox(u),this.model.renderTemplate&&$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark"));this._setHeightWidth();this._wireEvents()},_processing:function(n){n.find("li."+this._prefixClass+"firstitem").removeClass(this._prefixClass+"firstitem");n.find("li:first").addClass(this._prefixClass+"firstitem");n.find("li."+this._prefixClass+"lastitem").removeClass(this._prefixClass+"lastitem");n.find("li:last").addClass(this._prefixClass+"lastitem");eLi=n.find("li."+this._prefixClass+"list");eLi.removeEleEmptyAttrs();eLi.find("."+this._prefixClass+"chevron-right_01").removeEleEmptyAttrs();n.find("."+this._prefixClass+"lv-check").parent().addClass(this._prefixClass+"lv-checkdiv");n.find("."+this._prefixClass+"lv-check").closest("li."+this._prefixClass+"list").addClass(this._prefixClass+"list-check");n.find("."+this._prefixClass+"lv-input").closest("."+this._prefixClass+"lv-filter").addClass(this._prefixClass+"lv-inputdiv")},removeItem:function(n,t){if(n>=0){element=this._getElement(t);var i=$(element.find("li."+this._prefixClass+"list")[n]).attr("data-childid");this.element.find($("#"+i).length)&&this.element.find($("#"+i)).remove();$(element.find("li."+this._prefixClass+"list")[n]).remove()}},clear:function(){this.element.empty().html();this._liEl=this.element.find("li."+this._prefixClass+"list")},getItemsCount:function(n){return this._getElement(n).find("li."+this._prefixClass+"list").length},getActiveItemData:function(){if(this.getActiveItem().attr("data-id"))return this._generateData(this.dataSource().length?typeof this.dataSource()=="string"?eval(this.dataSource()):this.dataSource():this.model.items,this.getActiveItem().attr("data-id"))}});ej.VirtualScrollMode={Normal:"normal",Continuous:"continuous"}}(jQuery,Syncfusion),function(n){function e(n,t){return n.indexOf(t)===0}function s(n,t){return n.substr(n.length-t.length)===t}function u(n){return(n+"").replace(w,"")}function g(n){return isNaN(n)?NaN:Math[n<0?"ceil":"floor"](n)}function o(n,t,i){for(var r=n.length;r1?parseInt(e[1],10):0;r=e[0];e=r.split(".");r=e[0];u=e.length>1?e[1]:"";f>0?(u=o(u,f,!1),r+=u.slice(0,f),u=u.substr(f)):f<0&&(f=-f,r=o(r,f+1),u=r.slice(-f,r.length)+u,r=r.slice(0,-f));w=i["."]||".";u=t>0?w+(u.length>t?u.slice(0,t):o(u,t)):"";for(var s=r.length-1,y=i[","]||",",h="";s>=0;){if(c===0||c>s)return r.slice(0,s+1)+(h.length?y+h+u:u);h=r.slice(s-c+1,s+1)+(h.length?y+h:"");s-=c;a1&&(f=parseInt(t.slice(1),10));s=t.charAt(0).toUpperCase();switch(s){case"D":h="n";u=g(u);f!==-1&&(u=o(""+u,f,!0));n<0&&(u=-u);break;case"N":r=e;r.pattern=r.pattern||["-n"];case"C":r=r||e.currency;r.pattern=r.pattern||["-$n","$n"];case"P":r=r||e.percent;r.pattern=r.pattern||["-n %","n %"];h=n<0?r.pattern[0]||"-n":r.pattern[1]||"n";f===-1&&(f=r.decimals);u=nt(u*(s==="P"?100:1),f,r);break;default:throw"Bad number format specifier: "+s;}return it(u,h,e)}function it(n,t,i){for(var f=/n|\$|-|%/g,r="",e,u;;){if(e=f.lastIndex,u=f.exec(t),r+=t.slice(e,u?u.index:t.length),!u)break;switch(u[0]){case"n":r+=n;break;case"$":r+=i.currency.symbol||"$";break;case"-":/[1-9]/.test(n)&&(r+=i["-"]||"-");break;case"%":r+=i.percent.symbol||"%"}}return r}function i(n,t,i){return ni}function rt(n,t){var u=new Date,i,r;return t<100&&(i=n.twoDigitYearMax,i=typeof i=="string"?(new Date).getFullYear()%100+parseInt(i,10):i,r=u.getFullYear(),t+=r-r%100,t>i&&(t-=100)),t}function f(n,t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;i0&&(u-=1),i},s=function(t){var r=new RegExp("^\\d{1,"+t+"}"),i=n.substr(f,t).match(r);return i?(i=i[0],f+=i.length,parseInt(i,10)):null},h=function(t,i){for(var r=0,s=t.length,e,o,u;r1&&r.length-1){if(e=t.split("-")[0],i[e])return i[e]}else for(u=n.map(i,function(n){return n}),r=0;r-1?(n=n.replace(i.numberFormat.currency.symbol||"$",""),n=n.replace(i.numberFormat.currency["."]||".",i.numberFormat["."]||"."),y=u(i.numberFormat.currency.pattern[0].replace("$",""))):n.indexOf(i.numberFormat.percent.symbol)>-1&&(n=n.replace(i.numberFormat.percent.symbol||"%",""),n=n.replace(i.numberFormat.percent["."]||".",i.numberFormat["."]||"."),y=u(i.numberFormat.percent.pattern[0].replace("%",""))),n=u(n),b.test(n))v=parseFloat(n,t);else if(!t&&k.test(n))v=parseInt(n,16);else{var c=h(n,f,y),l=c[0],e=c[1];l===""&&f.pattern[0]!=="-n"&&(c=h(n,f,"-n"),l=c[0],e=c[1]);l=l||"+";s=e.indexOf("e");s<0&&(s=e.indexOf("E"));s<0?(o=e,p=null):(o=e.substr(0,s),p=e.substr(s+1));tt=f["."]||".";g=o.indexOf(tt);g<0?(r=o,w=null):(r=o.substr(0,g),w=o.substr(g+tt.length));nt=f[","]||",";r=r.split(nt).join("");it=nt.replace(/\u00A0/g," ");nt!==it&&(r=r.split(it).join(""));a=l+r;w!==null&&(a+="."+w);p!==null&&(rt=h(p,f,y),a+="e"+(rt[0]||"+")+rt[1]);d.test(a)&&(v=parseFloat(a))}return v};ej.globalize.parseDate=function(n,t,i){var r,o,f,u,s,e;if(i=ej.globalize.findCulture(i),t){if(typeof t=="string"&&(t=[t]),t.length)for(u=0,s=t.length;u0&&((this.targetElement.css("position")=="relative"||this.targetElement.css("position")=="absolute")&&this.targetElement[0]===n(this.model.appendTo)[0]?i={left:0,top:0}:(i.left-=this.targetElement.offsetParent().offset().left,i.top-=this.targetElement.offsetParent().offset().top));this.maindiv.css({position:"absolute",left:Math.ceil(i.left)+"px",top:Math.ceil(i.top)+"px","z-index":this._maxZindex()+1})},_setContentPosition:function(){if(this.model.template==null){var t=0,r=0,i,n=null;i=this.targetElement.outerHeight();this.popupText&&(t=this.popupText.outerHeight());this.popupImage&&(r=this.popupImage.outerHeight());this.popupImage&&(n=Math.ceil((i-(r+t))/2),this.popupImage.css("top",n+"px"));this.popupText&&(n||(n=Math.ceil((i-t)/2)),this.popupText.css("top",n+"px"))}else this.templateObj.css({position:"relative",left:Math.ceil((this.targetElement.outerWidth()-this.templateObj.outerWidth())/2),top:Math.ceil((this.targetElement.outerHeight()-this.templateObj.outerHeight())/2)})},_generateTextTag:function(n){this.popupText=t.buildTag("div.e-text",n);this.maindiv.append(this.popupText)},_setVisibility:function(n){n&&this._isTargetVisible()?this.show():this.hide()},_maxZindex:function(){return t.util.getZindexPartial(this.element)}})}(jQuery,Syncfusion),function(n,t){t.widget("ejButton","ej.Button",{element:null,model:null,validTags:["button","input"],_setFirst:!1,_rootCSS:"e-button",_requiresID:!0,defaults:{size:"normal",type:"submit",height:"",width:"",enabled:!0,htmlAttributes:{},text:null,contentType:"textonly",imagePosition:"imageleft",showRoundedCorner:!1,cssClass:"",prefixIcon:null,suffixIcon:null,enableRTL:!1,repeatButton:!1,timeInterval:"150",create:null,click:null,destroy:null},dataTypes:{size:"enum",enabled:"boolean",type:"enum",showRoundedCorner:"boolean",text:"string",contentType:"enum",imagePosition:"enum",prefixIcon:"string",suffixIcon:"string",cssClass:"string",repeatButton:"boolean",enableRTL:"boolean",timeInterval:"string",htmlAttributes:"data"},disable:function(){this.element.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1},enable:function(){this.element.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0},_init:function(){this._cloneElement=this.element.clone();this._initialize();this._render();this._controlStatus(this.model.enabled);this._wireEvents(this.model.repeatButton);this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n);t=="disabled"&&n=="disabled"&&i.disable()})},_destroy:function(){this._off(this.element,"blur",this._btnBlur);this.element.removeClass(this.model.cssClass+"e-ntouch e-btn e-select e-disable e-corner e-widget").removeAttr("role aria-describedby aria-disabled");this.element.removeClass("e-btn-"+this.model.size);this.model.contentType&&this.model.contentType!="textonly"?this.element.append(this._cloneElement.text())&&this.imgtxtwrap[0].remove():""},_setModel:function(n){for(var t in n)switch(t){case"size":this._setSize(n[t]);break;case"height":this._setHeight(n[t]);break;case"width":this._setWidth(n[t]);break;case"contentType":this._setContentType(n[t]);break;case"imagePosition":this._setImagePosition(n[t]);break;case"text":this._setText(n[t]);break;case"prefixIcon":this._setMajorIcon(n[t]);break;case"suffixIcon":this._setMinorIcon(n[t]);break;case"enabled":this._controlStatus(n[t]);break;case"showRoundedCorner":this._roundedCorner(n[t]);break;case"cssClass":this._setSkin(n[t]);break;case"enableRTL":this._setRTL(n[t]);break;case"timeInterval":this.model.timeInterval=n[t];break;case"htmlAttributes":this._addAttr(n[t])}},_setSize:function(n){this.element.removeClass("e-btn-mini e-btn-medium e-btn-small e-btn-large e-btn-normal");this.element.addClass("e-btn-"+n)},_setType:function(n){this.element.prop({type:n})},_setHeight:function(n){this.element.css("height",n)},_setWidth:function(n){this.element.css("width",n)},_setText:function(n){this.buttonType=="inputButton"?this.element.val(n):this.model.contentType==t.ContentType.TextOnly?this.element.html(n):this.textspan.html(n);this.model.text=n},_setMajorIcon:function(n){this.majorimgtag.removeClass(this.model.prefixIcon);this.majorimgtag.addClass(n);this.model.prefixIcon=n},_setMinorIcon:function(n){this.minorimgtag.removeClass(this.model.suffixIcon);this.minorimgtag.addClass(n);this.model.suffixIcon=n},_setContentType:function(n){n!=this.model.contentType&&(this.element.empty(),this.model.contentType=n,this._renderButtonNormal())},_setImagePosition:function(n){this.model.contentType==t.ContentType.TextAndImage&&n!=this.model.imagePosition&&(this.element.empty(),this.model.imagePosition=n,this._renderButtonNormal())},_setRTL:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_controlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(n){this.model.cssClass!=n&&(this.element.removeClass(this.model.cssClass),this.element.addClass(n))},_initialize:function(){t.isTouchDevice()||this.element.addClass("e-ntouch");this.element.is("input")?this.buttonType="inputButton":this.element.is("a")||this.element.is("button")?this.buttonType="tagButton":this.element.removeClass("e-button");this.element.attr("type")?this.model.type=this.element.attr("type"):this._setType(this.model.type);this._timeout=null},_render:function(){this._setSize(this.model.size);this._setHeight(this.model.height);this._setWidth(this.model.width);this._setRTL(this.model.enableRTL);this.element.addClass(this.model.cssClass+" e-btn e-select e-widget").attr("role","button");this.buttonType=="inputButton"?(this.element.addClass("e-txt"),this.model.text!=null&&this.model.text!=""?this.element.val(this.model.text):this.model.text=this.element.val()):this._renderButtonNormal();this._roundedCorner(this.model.showRoundedCorner);this.model.text&&this.element.attr("aria-describedby",this.model.text)},_renderButtonNormal:function(){if((this.model.text==null||this.model.text=="")&&(this.model.text=this.element.html()),this.element.empty(),this.textspan=t.buildTag("span.e-btntxt",this.model.text),this.model.contentType.indexOf("image")>-1&&(this.majorimgtag=t.buildTag("span").addClass(this.model.prefixIcon),this.minorimgtag=t.buildTag("span").addClass(this.model.suffixIcon),this.imgtxtwrap=t.buildTag("div")),this.model.contentType==t.ContentType.TextAndImage){switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.majorimgtag,this.textspan);break;case t.ImagePosition.ImageBottom:this.majorimgtag.attr("style","display:inherit");this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageTop:this.majorimgtag.attr("style","display:inherit");this.imgtxtwrap.append(this.majorimgtag,this.textspan)}this.element.append(this.imgtxtwrap)}else this.model.contentType==t.ContentType.ImageTextImage?(this.imgtxtwrap.append(this.majorimgtag,this.textspan,this.minorimgtag),this.element.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageBoth?(this.imgtxtwrap.append(this.majorimgtag,this.minorimgtag),this.element.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageOnly?(this.imgtxtwrap.append(this.majorimgtag),this.element.append(this.imgtxtwrap)):(this.element.addClass("e-txt"),this.element.html(this.model.text))},_roundedCorner:function(n){n==!0?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},_wireEvents:function(t){t&&(this._on(this.element,"mousedown",this._btnRepatMouseClickEvent),this._on(n(document),"mouseup",this._mouseUpClick),this._on(this.element,"keyup",this._btnRepatKeyUpEvent),this._on(n(document),"keypress",this._btnRepatKeyDownEvent));this._on(this.element,"click",this._btnMouseClickEvent);this._on(this.element,"blur",this._btnBlur)},_btnBlur:function(){this.element.removeClass("e-animate")},_btnMouseClickEvent:function(n){var t=this,i;if(this.element.addClass("e-animate"),!t.model.enabled)return!1;t.element.hasClass("e-disable")||(i={target:n.currentTarget,e:n,status:t.model.enabled},t._trigger("click",i))},_btnRepatMouseClickEvent:function(n){var t=this,i;if(!t.model.enabled)return!1;t.element.hasClass("e-disable")||(i={status:t.model.enabled},(n.button==0||n.which==1)&&(t._timeout=setInterval(function(){t._trigger("click",{target:n.currentTarget,status:t.model.enabled})},this.model.timeInterval)))},_mouseUpClick:function(){clearTimeout(this._timeout)},_btnRepatKeyDownEvent:function(n){var t=this,i;t.element.hasClass("e-disable")||(i={status:t.model.enabled},(n.keyCode==32||n.keyCode==13)&&t._trigger("click",i))},_btnRepatKeyUpEvent:function(n){(n.keyCode==32||n.keyCode==13)&&clearTimeout(this._timeout)}});t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"};t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.ButtonType={Button:"button",Reset:"reset",Submit:"submit"}}(jQuery,Syncfusion),function($,ej,undefined){return this.__calcQuickextends=function(n,t){function r(){this.constructor=n}for(var i=0;i=";this._validFunctionNameChars="_";this.bMARKER=String.fromCharCode(146);this.bMARKER2=this.bMARKER+this.bMARKER;this.tic='"';this._parseDecimalSeparator=".";this.parseDateTimeSeparator="/";this._parseArgumentSeparator=",";this._rightBracket=String.fromCharCode(131);this._leftBracket=String.fromCharCode(130);this.iFMarker="qIF"+String.fromCharCode(130);this.braceLeft="{";this.braceRight="}";this._braceRightNLeft=")(";this.computedValueLevel=0;this._circCheckList=[];this._maximumRecursiveCalls=100;this._sortedSheetNames=null;this.trueValueStr="TRUE";this.falseValueStr="FALSE";this.useDatesInCalcs=!1;this.sheetToken="!";this.namedRanges=null;this.undefinednamedRange=null;this.undefinedsheetNamedRnages=null;this.namerangecellcollection=null;this.sheetNamedRangesOriginalNames=null;this.sheetNamedRangeCellCollection=null;this.sheetDependentNamedRangeCells=null;this.namedRangesOriginalNames=null;this.namedRangeValues=null;this.rangeValues=null;this.dependentNamedRangeCells=null;this.namedRangesSized=null;this._namedRangesNonScoped=null;this.char_add="+";this.char_and="i";this.char_ANDop=String.fromCharCode(140);this.char_divide="/";this.char_ELSEop=String.fromCharCode(144);this.char_EM="r";this.char_EP="x";this.char_equal="=";this.char_greater=">";this.char_greatereq="h";this.char_IFop=String.fromCharCode(142);this.char_less="<";this.char_lesseq="f";this.char_multiply="*";this.char_noequal="p";this.char_NOTop=String.fromCharCode(145);this.char_or="w";this.char_ORop=String.fromCharCode(139);this.char_subtract="-";this.char_THENop=String.fromCharCode(143);this.char_XORop=String.fromCharCode(141);this.chartic="'"[0];this._string_and="&";this._string_E="E";this._string_EM="E-";this._string_empty="";this._string_EP="E+";this._string_fixedreference="$";this._string_greatereq=">=";this._string_lesseq="<=";this._string_noequal="<>";this._string_or="^";this.token_add="a";this.token_and="c";this.token_ANDop=String.fromCharCode(133);this.token_divide="d";this.token_ELSEop=String.fromCharCode(137);this.token_EM="v";this.token_EP="t";this.token_equal="e";this.token_greater="g";this.token_greatereq="j";this.token_IFop=String.fromCharCode(135);this.token_less="l";this.token_lesseq="k";this.token_multiply="m";this.token_noequal="o";this.token_NOTop=String.fromCharCode(138);this.token_or=String.fromCharCode(126);this.token_ORop=String.fromCharCode(132);this.token_subtract="s";this.token_THENop=String.fromCharCode(136);this.token_XORop=String.fromCharCode(134);this.tokens=[this.token_add,this.token_subtract,this.token_multiply,this.token_divide,this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal,this.token_and,this.token_or];this._dateTime1900=new Date(1900,0,1,0,0,0);this._preserveLeadingZeros=!1;this._ignoreCellValue=!1;this._errorStrings=null;this._cell="";this._iterationMaxCount=0;this._supportRangeOperands=!1;this._allowShortCircuitIFs=!1;this._processUpperCaseFormula="";this._processUpperCaseIvalue=0;this._processUpperCaseSheet="";this._markerChar="`";this._rowMaxCount=-1;this._columnMaxCount=-1;this._isInteriorFunction=!1;this._tempSheetPlaceHolder=String.fromCharCode(133);this.sheetFamilyID=0;this._supportsSheetRanges=!0;this._markers="()+-*/=><.,!";this._formulaInfoTable=null;this._dependentFormulaCells=null;this._dependentCells=new HashTable;this._calculatingSuspended=!1;this._inAPull=!1;this._useDatesInCalcs=!1;this._excelLikeComputations=!1;this._rethrowLibraryComputationExceptions=!1;this.formulaErrorStrings=["binary operators cannot start an expression","cannot parse","bad library","invalid char in front of","number contains 2 decimal points","expression cannot end with an operator","invalid characters following an operator","invalid character in number","mismatched parentheses","unknown formula name","requires a single argument","requires 3 arguments","invalid Math argument","requires 2 arguments","#NAME?","too complex","circular reference: ","missing formula","improper formula","invalid expression","cell empty","bad formula","empty expression","","mismatched string quotes","wrong number of arguments","invalid arguments","iterations do not converge","Control named '{0}' is already registered","Calculation overflow","Missing sheet"];this._parseDateTimeSeparator="/";this._millisecondsOfaDay=864e5;this.treat1900AsLeapYear=!1;this._oaDate=new Date(1899,11,30);this._saveStringsText="";this._processedCells=[];this.ignoreValueChanged=!1;this._breakedFormulaCells=[];this._tempBreakedFormulaCells=[];this._lockDependencies=!1;this._useDependencies=!1;this._inHandleIterations=!1;this._inRecalculateRange=!1;this._useNoAmpersandQuotes=!1;this._calcID=0;this._operators_cannot_start_an_expression=0;this._reservedWord_AND=1;this._reservedWord_XOR=2;this._reservedWord_IF=3;this._number_contains_2_decimal_points=4;this._reservedWord_ELSE=5;this._reservedWord_NOT=6;this._invalid_char_in_number=7;this._invalid_characters_following_an_operator=6;this._mismatched_parentheses=8;this._unknown_formula_name=9;this._requires_a_single_argument=10;this._requires_3_args=11;this._invalid_Math_argument=12;this._requires_2_args=13;this._bad_index=14;this._too_complex=15;this._circular_reference_=16;this._missing_formula=17;this._improper_formula=18;this._invalid_expression=19;this._cell_empty=20;this._bad_formula=21;this._empty_expression=22;this._virtual_mode_required=23;this._mismatched_tics=24;this._wrong_number_arguments=25;this._invalid_arguments=26;this._iterations_dont_converge=27;this._calculation_overflow=29;this._already_registered=28;this._missing_sheet=30;this._alwaysComputeDuringRefresh=!0;this._libraryComputationException=null;this._dependencyLevel=0;this._isDisposed=undefined;this._forceRefreshCall=!1;this.grid=this.parentObject;this._enableLookupTableCaching=0;this._lookupTables=new HashTable;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1;this._addFunction=function(n,t){return(n=n.toUpperCase(),this._libraryFunctions.getItem(n)==undefined)?(this._libraryFunctions.add(n,t),!0):!1};this._addToFormulaDependentCells=function(n){var t=this.cell,i=CalcEngine.getSheetFamilyItem(this.grid),r;i.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(r=i.parentObjectToToken.getItem(this.grid),t=r+t);this.getDependentFormulaCells().containsKey(t)?this.getDependentFormulaCells().getItem(t).containsKey(n)||this.getDependentFormulaCells().getItem(t).add(n,n):(this.getDependentFormulaCells().add(t,new HashTable),this.getDependentFormulaCells().getItem(t).add(n,n))};this._arrayRemove=function(n,t){for(var i=null;(i=n.indexOf(t))!==-1;)n.splice(i,1);return n};this._canGetRowIndex=function(n){var t=0;if(t-1&&(t=n.substring(i+1),this._namedRangesNonScoped.containsKey(t)||this._namedRangesNonScoped.add(t,this.namedRanges.getItem(n)))};this._checkHasCharBeforeNumber=function(n){for(var i=!1,t=n.length-1;t>0;t--)if(this._isLetter(n[t])){i=!0;break}return i};this._checkIfScopedRange=function(n,t){var r,s,u,i,o;t="";var f="NaN",h=this.getSheetID(this.grid),e=CalcEngine.getSheetFamilyItem(this.grid);if(n[0]==this.sheetToken.toString()&&(r=n.indexOf(this.sheetToken,1),r>1&&!isNaN(parseInt(n.substring(1,r-1)))&&(n=n.substring(r+1))),s="!"+h.toString()+"!",e.sheetNameToToken==null)return f;for(u=e.sheetNameToToken.keys(),i=0;ithis._absoluteZero?Math.abs((n-t)/t)1;)e=i.pop().toString(),r=e==this.tic+this.tic?r+this.tic:e+r,u=f==3?e:u,f--;i[0]==this.tic+this.tic&&i.pop();r=n.length==t&&this._isTextEmpty(u.split(this.tic).join(""))?r+u:r;i.push(r)}return i};this._computeMath=function(n,t){var u=0,r,l=!1,a,i,f,e,s,y,h,c,o;if(n.length>0&&(n=this.splitArgsPreservingQuotedCommas(n)[0]),a=[this.getParseArgumentSeparator(),":"],n.length>0&&(!this._isLetter(n[0])&&n[0]!=this.sheetToken&&n[0]!=this.bMARKER||n[0]=="u"&&this._isDigit(n[1]))&&this._indexOfAny(n,a)==-1){if(n=n.split("u").join("-").split("n").join(""),i=this._parseDouble(n),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}else if(n.length>0&&(n[0]==this.bMARKER||n[0]=="u"||n[0]=="n"||this._indexOfAny(n,this.tokens)>-1)){n=n.split("{").join("(");n=n.split("}").join(")");f="";e=Math.PI.toString();try{n.indexOf(e)>-1?(r=this._substring(n,1,n.indexOf(e)-2),r=this._isTextEmpty(r)?"1":r,f=this._indexOfAny(n,this.tokens)>-1?n.split(e.toString())[1]:"1",l=!0):r=this.computedValue(n)}catch(v){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(l)if(s=this.computedValue(r.toString()),f.indexOf("180")>-1)if(i=this._parseDouble(s),i)u=t(i*(Math.PI/180));else return this.getErrorStrings()[1].toString();else{if(y=this.computedValue(s+f),h=this._parseDouble(y),isNaN(h))return this.getErrorStrings()[1].toString();u=t(h*Math.PI)}else{if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}}else for(n=n.split("u").join("-"),c=this.getCellsFromArgs(n),o=0;o0){if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}break}return this.computeIsErr(u.toString())==this.trueValueStr?this.getErrorStrings()[4].toString():u.toString()};this._computeInteriorFunctions=function(n){var i,r,t,u;try{if(this._isTextEmpty(n))return n;for(this.computeFunctionLevel++,i=this._findLastqNotInBrackets(n);i>0;){if(r=n.substring(i).indexOf(this._rightBracket),r==-1)throw this.formulaErrorStrings[this._bad_formula];this._isInteriorFunction=!0;t=this._substring(n,i,r+1);t=this.computedValue(t);t==""||t[0]!=this.tic[0]||t[t.length-1]!=this.tic[0]||(u=this._substring(t,1,t.length-2),u.indexOf(this.tic)!=-1&&(this._multiTick=!0,u=u.split(this.tic).join("|")),t=this.tic+u+this.tic);t=this._markupResultToIncludeInFormula(t);n=this._isInteriorFunction?n.substring(0,i)+t+n.substring(i+r+1):n.substring(0,i)+t.split(this.tic).join("")+n.substring(i+r+1);this._isInteriorFunction=!1;i=this._findLastqNotInBrackets(n)}}catch(f){return f}finally{this.computeFunctionLevel--}return n};this._findAndCheckPrecedingChar=function(n,t,i){var r=n.indexOf(t,i);if(r>0)while(r>-1&&this.getValidPrecedingChars().indexOf(n[r-1])==-1)r=n.indexOf(t,r+1);return this._findAndCheckPrecedingCharCopy=n,r};this._findLastNonQB=function(n){var r=-1,i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>=0;--t)if(n[t]==this._rightBracket)i--;else if(n[t]==this._leftBracket)i++;else if(n[t]==this.bMARKER&&i==0){r=t;break}return r};this._findLastqNotInBrackets=function(n){for(var r=-1,i=!1,t=n.length-1;t>-1;){if(n[t]=="q"&&i){r=t;break}n[t]==this._leftBracket?i=!0:n[t]==this._rightBracket&&(i=!1);t--}return r};this._findNextSeparator=function(n,t){for(var i=0,r=!1;!r&&t-1)for(i=0,t=0;t59&&(n-=1),new Date(this._oaDate.setDate(this._oaDate.getDate()+n))};_weekEndType=["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"];this._getDoubleArray=function(n){var i,t="",u=[],f,r,o,e;for(n=this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),r=0;r-1)for(o=this.getCellsFromArgs(f[r]),e=0;e0&&(i=this._parseDouble(t),isNaN(i)?u.push(0):u.push(Number(i)));else t=this.getValueFromArg(f[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(Number(i))?u.push(0):u.push(i);return u};this._getDoubleArrayA=function(n){var t,i="",e=[],u,r,o,f;for(n=this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),r=0;r-1)for(o=this.getCellsFromArgs(u[r]),f=0;f0&&(i==this.trueValueStr?t=1:(t=this._parseDouble(i),isNaN(Number(t))&&t==0),e.push(t));else i=this.getValueFromArg(u[r]),i==this.trueValueStr?t=1:(t=this._parseDouble(i.toString()),isNaN(t)&&(t=0)),e.push(t);return e};this._getFormulaArrayBounds=function(n,t,i){var o=this.colIndex(this.cell),r=this.rowIndex(this.cell),s="",v=this.getFormulaInfoTable().containsKey(this.cell)?this.getFormulaInfoTable().getItem(this.cell):null,h,u,f,e;for(s=v!=null?v.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o),h=1,u=1,f=1;f<=t;f++)if(o-f>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(o-f)+r.toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f),u=o-f,s!=null&&l!=s){u++;break}}for(e=1;e<=i;e++)if(r-e>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(u)+(r-e).toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u),h=r-e,s!=null&&l!=s){h++;break}}return this._getFormulaArrayBoundsfirstRowIndex=h,this._getFormulaArrayBoundsfirstColIndex=u,this._getFormulaArrayBoundslastRowIndex=h+t,this._getFormulaArrayBoundslastColIndex=u+i,!0};FormulaArgumentType={None:{},Range:{},CellReference:{},TwoTextWithNumber:{},TextWithNumber:{},Numbers:{},Text:{},Date:{}};this.formulaErrorStringCheck=function(n,t){var arguments=this.splitArgsPreservingQuotedCommas(n),e,b,c,o,u,v,y,p,w,h,l,s,r,d,f,i;switch(t){case FormulaArgumentType.None:if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}break;case FormulaArgumentType.Range:if(e="",o=arguments,o!=null)for(i=0;i-1){if(u[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}for(b=this.getCellsFromArgs(u),c=0;c0&&this.getErrorStrings().indexOf(e)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return e}}}else{try{e=this.getValueFromArg(u)}catch(nt){}if(e.length>0&&(h=this.formulaErrorStringCheck(e,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h}break;case FormulaArgumentType.CellReference:if(o=arguments,o!=null)for(i=0;i-1)return v;if(y=this.formulaErrorStringCheck(arguments[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(y)>-1)return y;if(arguments.length==3&&(p=this.formulaErrorStringCheck(arguments[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(p)>-1))return p;break;case FormulaArgumentType.TextWithNumber:l=0;w=0;var a=this.getValueFromArg(arguments[0].split(this.tic).join("")),k=Boolean(a),tt=arguments.length==2&&isNaN(typeof this.getValueFromArg(arguments[1])=="boolean"),l=isNaN(this._parseDouble(arguments[0].split(this.tic).join("")));if(l&&(r=this.getValueFromArg(arguments[0]),this.getErrorStrings().indexOf(r)>-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}if(w=isNaN(this._parseDouble(arguments[1].split(this.tic).join(""))),arguments.length==2&&w&&(h=this.formulaErrorStringCheck(arguments[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;break;case FormulaArgumentType.Text:for(f=arguments,i=0;i-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}}break;case FormulaArgumentType.Numbers:for(s=arguments,i=0;i-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}if(!k&&isNaN(this._parseDouble(r))&&r!=""||s[i].includes(":")&&this._isCellReference(s[i])||r.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}break;case FormulaArgumentType.Date:for(d=0,f=arguments,i=0;i-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}if(!g&&isNaN(Date.parse(this._stripTics0(r)))&&isNaN(this._parseDouble(this._stripTics0(r)))&&r!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}return n};this._getSerialDateFromDate=function(n,t,i){var u=0,f,r,e;for(n<1900&&(n+=1900),f=!1;!f;){while(t>12)n++,t-=12;for(f=!0,r=new Date(n,t,1,-1).getDate();i>r;)r=new Date(n,t,1,-1).getDate(),t++,i-=r,f=!1;i<1&&(t--,r=new Date(n,t,1,-1).getDate(),i=r-i)}return e=Date.parse(n.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+i.toString()),isNaN(e)||(u=this._toOADate(new Date(e))),this.treat1900AsLeapYear&&u>59&&(u+=1),u};this._getSerialDateTimeFromDate=function(n){var t=this._toOADate(n);return this.treat1900AsLeapYear&&t>59&&(t+=1),t};this._getSheetTokenFromReference=function(n){var i="",t;if(n.length>2&&n[0]==this.sheetToken){for(t=1,i=this.sheetToken;t0&&r[0]==this.getFormulaCharacter()&&u==null){u=new FormulaInfo;u.setFormulaText(f.toString());this.getDependentFormulaCells().containsKey(this.cell)||this.getDependentFormulaCells().add(this.cell,new HashTable);o=!0;try{u.setParsedFormula(this.parseFormula(r))}catch(h){this._inAPull?(r=h,u=null):u.setFormulaValue(h);o=!1}o&&(u.setFormulaValue(this.computeFormula(u.getParsedFormula())),e=!0);u!=null&&(u.calcID=this._calcID,this.getFormulaInfoTable().containsKey(this.cell)||this.getFormulaInfoTable().add(this.cell,u),r=u.getFormulaValue()!=null?u.getFormulaValue():"")}return u!=null&&(this.getUseFormulaValues()||this.getCalculatingSuspended()&&(!this._inAPull||e)?r=u.getFormulaValue()!=null?u.getFormulaValue():"":e||(this._calcID==u.calcID?r=u.getFormulaValue():(r=this.computeFormula(u.getParsedFormula()),u.setFormulaValue(r),u.calcID=this._calcID))),(r==""||r==undefined)&&(r=""),s=this._parseDouble(r.substring(0,r.length-1)),r[r.length-1]!="%"||isNaN(s)||(r=(Number(s)/100).toString()),r};this._handleEmbeddedEs=function(n){for(var t=0,i,r;t>-1&&(t=n.indexOf(this._string_EP,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EP.length;r-1&&(t=n.indexOf(this._string_EM,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EM.length;r-1&&(t=n.indexOf(this._string_E,t))>-1&&n[0]!=this.bMARKER;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_E.length;r-1)return i;return-1};this._initLibraryFunctions=function(){this._libraryFunctions=new HashTable;this._addFunction("SUM","computeSum");this._addFunction("EncodeURL","computeEncodeURL");this._addFunction("CHAR","computeChar");this._addFunction("CODE","computeCode");this._addFunction("UNICODE","computeUniCode");this._addFunction("UNICHAR","computeUniChar");this._addFunction("UPPER","computeUpper");this._addFunction("LOWER","computeLower");this._addFunction("LEN","computeLen");this._addFunction("MID","computeMid");this._addFunction("LEFT","computeLeft");this._addFunction("CLEAN","computeClean");this._addFunction("REPT","computeRept");this._addFunction("RIGHT","computeRight");this._addFunction("REPLACE","computeReplace");this._addFunction("EXACT","computeExact");this._addFunction("FIND","computeFind");this._addFunction("TRIM","computeTrim");this._addFunction("SEARCH","computeSearch");this._addFunction("SUBSTITUTE","computeSubstitute");this._addFunction("PROPER","computeProper");this._addFunction("T","computeT");this._addFunction("NUMBERVALUE","computeNumberValue");this._addFunction("CONCATENATE","computeConcatenate");this._addFunction("VALUE","computeValue");this._addFunction("DOLLAR","computeDollar");this._addFunction("FIXED","computeFixed");this._addFunction("BIN2DEC","computeBin2Dec");this._addFunction("BIN2OCT","computeBin2Oct");this._addFunction("BIN2HEX","computeBin2Hex");this._addFunction("DEC2BIN","computeDec2Bin");this._addFunction("DEC2OCT","computeDec2Oct");this._addFunction("HEX2BIN","computeHex2Bin");this._addFunction("HEX2OCT","computeHex2Oct");this._addFunction("BITAND","computeBitAnd");this._addFunction("BITOR","computeBitOr");this._addFunction("BITLSHIFT","computeBitLShift");this._addFunction("BITRSHIFT","computeBitRShift");this._addFunction("BITXOR","computeBitXor");this._addFunction("DATE","computeDate");this._addFunction("DATEVALUE","computeDatevalue");this._addFunction("DAY","computeDay");this._addFunction("DAYS","computeDays");this._addFunction("DAYS360","computeDays360");this._addFunction("EDATE","computeEDate");this._addFunction("EOMONTH","computeEOMonth");this._addFunction("HOUR","computeHour");this._addFunction("ISOWEEKNUM","computeISOWeeknum");this._addFunction("MINUTE","computeMinute");this._addFunction("MONTH","computeMonth");this._addFunction("NETWORKDAYS","computeNetworkDays");this._addFunction("NETWORKDAYS.INTL","computeNetworkDaysOintl");this._addFunction("NOW","computeNow");this._addFunction("SECOND","computeSecond");this._addFunction("TIME","computeTime");this._addFunction("TIMEVALUE","computeTimevalue");this._addFunction("TODAY","computeToday");this._addFunction("WEEKDAY","computeWeekday");this._addFunction("WEEKNUM","computeWeeknum");this._addFunction("WORKDAY","computeWorkDay");this._addFunction("WORKDAY.INTL","computeWorkDayOintl");this._addFunction("YEAR","computeYear");this._addFunction("ADDRESS","computeAddress");this._addFunction("AREAS","computeAreas");this._addFunction("CHOOSE","computeChoose");this._addFunction("COLUMN","computeColumn");this._addFunction("COLUMNS","computeColumns");this._addFunction("FORMULATEXT","computeFormulaText");this._addFunction("HYPERLINK","computeHyperlink");this._addFunction("HLOOKUP","computeHLookUp");this._addFunction("INDEX","computeIndex");this._addFunction("INDIRECT","computeIndirect");this._addFunction("LOOKUP","computeLookUp");this._addFunction("OFFSET","computeOffSet");this._addFunction("TRANSPOSE","computeTranspose");this._addFunction("LOGNORM.INV","computeLognormOinv");this._addFunction("NORM.INV","computeNormOinv");this._addFunction("NORM.DIST","computeNormOdist");this._addFunction("NORM.S.DIST","computeNormOsODist");this._addFunction("NORM.S.INV","computeNormOsOInv");this._addFunction("PERMUT","computePermut");this._addFunction("PERMUTATIONA","computePermutationA");this._addFunction("STANDARDIZE","computeStandardize");this._addFunction("BINOM.DIST","computeBinomOdist");this._addFunction("BINOM.INV","computeBinomOInv");this._addFunction("CHISQ.INV.RT","computeChisqOinvOrt");this._addFunction("CHISQ.INV","computeChisqOinv");this._addFunction("CHISQ.DIST.RT","computeChisqOdistOrt");this._addFunction("F.DIST","computeFOdist");this._addFunction("GAMMALN","computeGammaln");this._addFunction("CONFIDENCE.NORM","computeConfidenceOnorm");this._addFunction("EXPON.DIST","computeExponOdist");this._addFunction("FISHER","computeFisher");this._addFunction("FISHERINV","computeFisherInv");this._addFunction("GAMMALN.PRECISE","computeGammalnOPrecise");this._addFunction("AVERAGE","computeAverage");this._addFunction("AVERAGEA","computeAverageA");this._addFunction("POISSON.DIST","computePoissonODist");this._addFunction("WEIBULL.DIST","computeWeiBullODist");this._addFunction("F.INV.RT","computeFOinvOrt");this._addFunction("T.DIST","computeTOdist");this._addFunction("MAX","computeMax");this._addFunction("MAXA","computeMaxa");this._addFunction("MEDIAN","computeMedian");this._addFunction("MIN","computeMin");this._addFunction("MINA","computeMina");this._addFunction("PERCENTRANK.INC","computePercentrankInc");this._addFunction("PERCENTILE","computePercentile");this._addFunction("RANK.EQ","computeRankOEq");this._addFunction("COUNT","computeCount");this._addFunction("COUNTA","computeCounta");this._addFunction("DEVSQ","computeDevsq");this._addFunction("F.DIST.RT","computeFOdistORt");this._addFunction("FORECAST","computeForecast");this._addFunction("GEOMEAN","computeGeomean");this._addFunction("HARMEAN","computeHarmean");this._addFunction("INTERCEPT","computeIntercept");this._addFunction("LARGE","computeLarge");this._addFunction("SMALL","computeSmall");this._addFunction("LOGNORM.DIST","computeLognormOdist");this._addFunction("AVEDEV","computeAvedev");this._addFunction("COUNTBLANK","computeCountblank");this._addFunction("STDEV.P","computeStdevOp");this._addFunction("STDEV.S","computeStdevOS");this._addFunction("STDEVA","computeStdeva");this._addFunction("STDEVPA","computeStdevpa");this._addFunction("T.INV","computeTOinv");this._addFunction("VAR.P","computeVarp");this._addFunction("VARA","computeVara");this._addFunction("VARPA","computeVarpa");this._addFunction("CORREL","computeCorrel");this._addFunction("PERCENTILE.EXC","computePercentileExc");this._addFunction("PERCENTILE.INC","computePercentileOInc");this._addFunction("TRIMMEAN","computeTrimmean");this._addFunction("RSQ","computeRsq");this._addFunction("PEARSON","computePearson");this._addFunction("CHIDIST","computeChidist");this._addFunction("ABS","computeAbs");this._addFunction("ACOS","computeAcos");this._addFunction("ACOSH","computeAcosh");this._addFunction("ACOT","computeAcot");this._addFunction("ACOTH","computeAcoth");this._addFunction("ARABIC","computeArabic");this._addFunction("ASIN","computeAsin");this._addFunction("ATAN","computeAtan");this._addFunction("ATAN2","computeAtan2");this._addFunction("CEILING.MATH","computeCeilingMath");this._addFunction("CEILING","computeCeiling");this._addFunction("COMBIN","computeCombin");this._addFunction("COMBINA","computeCombinA");this._addFunction("COS","computeCos");this._addFunction("COSH","computeCosh");this._addFunction("COT","computeCot");this._addFunction("CSC","computeCsc");this._addFunction("CSCH","computeCsch");this._addFunction("DECIMAL","computeDecimal");this._addFunction("DEGREES","computeDegrees");this._addFunction("ISTEXT","computeIsText");this._addFunction("EXP","computeExp");this._addFunction("EVEN","computeEven");this._addFunction("FACT","computeFact");this._addFunction("FACTDOUBLE","computeFactdouble");this._addFunction("FLOOR","computeFloor");this._addFunction("INT","computeInt");this._addFunction("LN","computeLn");this._addFunction("LOG","computeLog");this._addFunction("PI","computePI");this._addFunction("PRODUCT","computeProduct");this._addFunction("SEC","computeSecant");this._addFunction("SERIESSUM","computeSeriessum");this._addFunction("SIN","computeSin");this._addFunction("SINH","computeSinh");this._addFunction("SQRT","computeSqrt");this._addFunction("SUBTOTAL","computeSubTotal");this._addFunction("SUMIF","computeSumif");this._addFunction("TRUNC","computeTrunc");this._addFunction("TAN","computeTan");this._addFunction("LOG10","computeLogTen");this._addFunction("COTH","computeCoth");this._addFunction("AND","computeAnd");this._addFunction("FALSE","computeFalse");this._addFunction("IF","computeIf");this._addFunction("IFERROR","computeIfError");this._addFunction("NOT","computeNot");this._addFunction("OR","computeOr");this._addFunction("TRUE","computeTrue");this._addFunction("XOR","computeXor");this._addFunction("CELL","computeCell");this._addFunction("ERROR.TYPE","computeErrorType");this._addFunction("INFO","computeInfo");this._addFunction("ISBLANK","computeIsBlank");this._addFunction("ISERR","computeIsErr");this._addFunction("ISERROR","computeIsError");this._addFunction("ISEVEN","computeIsEven");this._addFunction("ISFORMULA","computeIsFormula");this._addFunction("ISLOGICAL","computeIsLogical");this._addFunction("ISNA","computeIsNA");this._addFunction("ISNONTEXT","computeIsNonText");this._addFunction("ISNUMBER","computeIsNumber");this._addFunction("ISODD","computeIsOdd");this._addFunction("ISREF","computeIsRef");this._addFunction("ISTEXT","computeIsText");this._addFunction("N","computeN");this._addFunction("NA","computeNA");this._addFunction("SHEET","computeSheet");this._addFunction("SHEETS","computeSheets");this._addFunction("TYPE","computeType");this._addFunction("ROW","computeRow");this._addFunction("ROWS","computeRows");this._addFunction("MATCH","computeMatch");this._addFunction("PMT","computePmt")};this._comb=function(n,t){for(var r,u=1,i=n+1;i<=t;++i)u=u*i;for(r=1,i=2;i<=t-n;++i)r=r*i;return u/r};this._finv=function(n,t,i){for(var o=Math.exp(this._gammaln((t+i)/2)-this._gammaln(t/2)-this._gammaln(i/2)+t/2*Math.log(t/i)),r=o,u=r/2,e=0,f=100,s=3,h=0;f==100&&s>0;)for(s--,r=r/2,u=r/2,f=0;f<100;++f){if(h++,e=1-o*this._fdist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e>n?r=r+u:(u=u/2,r-u<0&&(u=r/2),r=r-u)}return f==100&&(r=-1),r};this._tProbabilityDensity=function(n,t){var i=this._gammaFunction(.5*t+.5),r=Math.pow(1+n*n/t,-.5*t-.5),u=Math.sqrt(t*Math.PI)*this._gammaFunction(.5*t);return i*r/u};this._tCumulativeDensity=function(n,t){if(isNaN(n))return NaN;if(n==0)return.5;if(n>0){var i=t/(n*n+t);return 1-.5*this._rIBetaFunction(i,.5*t,.5)}return 1-this._tCumulativeDensity(-n,t)};this._sign=function(n){return n===0||isNaN(n)?n:n>0?1:-1};this._var=function(n){for(var u,f,i=0,r=n.length,t=0;t1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;switch(t){case 1:return Math.tan(Math.PI*(n-.5));case 2:return r=4*n*(1-n),2*(n-.5)*Math.sqrt(2/r);case 4:var r=4*n*(1-n),e=Math.sqrt(r),h=Math.cos(1/3*Math.acos(e))/e;return this._sign(n-.5)*2*Math.sqrt(h-1);default:for(i=t>6?this._standardNormalCumulativeDistributionFunctionInverse(n):this._tCumulativeDistributionInverse(n,4),u=0;u<50;u++){if(f=this._tCumulativeDensity(i,t),o=Math.abs(n-f),o<.0001)return i;s=this._tProbabilityDensity(i,t);i=i+(n-f)/s}throw"Solution did not converge";}};this._fdist=function(n,t,i){for(var s,p,f=32,e=0,c=n,o=(c-e)/f,l=o/3,y=this._fdensity(e,t,i)+this._fdensity(c,t,i),u=0,r=1;rt?(f=t-(n-t),c=n):(f=n,c=t+(t-n));var e=(c-f)/h,l=e/3,y=this._normaldensity(f,t,i)+this._normaldensity(c,t,i),u=0;for(r=1;rt?s+(1-s)/2:(1-s)/2};this._normaldensity=function(n,t,i){return 1/(Math.sqrt(2*Math.PI)*i)*Math.exp(-(n-t)*(n-t)/(2*i*i))};this._standardNormalCumulativeDistribution=function(n){if(n<0)return 1-this._standardNormalCumulativeDistribution(-n);var i=this._standardNormalProbabilityDensityFunction(n),t=1/(1+.2316419*n);return 1-i*(.31938153*t+-.356563782*Math.pow(t,2)+1.781477937*Math.pow(t,3)+-1.821255978*Math.pow(t,4)+1.330274429*Math.pow(t,5))};this._normalinv=function(n,t,i){var r=t;r=n<.05?t-2*i:n<.5?t:n<.95?t+2*i:t+5*i;for(var u=r/2,e=0,f=100,o=3,s=0;f==100&&o>0;)for(o--,r=r/2,u=r/2,f=0;f<100;++f){if(s++,e=this._normaldist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 01)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 01)throw"x must be between 0 and 1";return this._rIBetaFunction(n,t,i)};this._betaProbabilityDens=function(n,t,i){if(n<0||n>1)throw"x must be between 0 and 1";var r=this._betaFunction(t,i);return Math.pow(n,t-1)*Math.pow(1-n,i-1)/r};this._critbinom=function(n,t,i){var r=n,f=n,e=1,u=1;do{if(f=Math.floor(f/2)+1,e>=i){if(u=this._binomdist(n,r-1,t),isNaN(u))return this.maxValue;if(u0)break;r=r-f}else{if(u=this._binomdist(n,r+1,t),u>=i){r=r+1;break}r=r+f}e=this._binomdist(n,r,t)}while(r0);return r};this._newnormalinv=function(n){var f=[-39.696830286653757,220.9460984245205,-275.92851044696869,138.357751867269,-30.66479806614716,2.5066282774592392],e=[-54.476098798224058,161.58583685804089,-155.69897985988661,66.80131188771972,-13.280681552885721],i=[-.0077848940024302926,-.32239645804113648,-2.4007582771618381,-2.5497325393437338,4.3746641414649678,2.9381639826987831],u=[.0077846957090414622,.32246712907003983,2.445134137142996,3.7544086619074162],o=.02425,s=1-o,t=0,r=0;return n0;)for(e--,i=i/2,r=i/2,u=0;u<100;++u){if(f=1-this._chidist(i,t),Math.abs((f-n)/n)<1e-7)break;f>n?i=i+r:(r=r/2,i-r<0&&(r=i/2),i=i-r)}return u==100&&(i=-1),i};this._chidist=function(n,t){var c=[.09654008851,.09563872008,.09384439908,.0911738787,.087652093,.08331192423,.07819389579,.07234579411,.06582222278,.05868409348,.05099805926,.04283589802,.03427386291,.02539206531,.01627439473,.00701861001],l=[.04830766569,.14447196158,.23928736225,.33186860228,.42135127613,.50689990893,.58771575724,.66304426693,.73218211874,.79448379597,.84936761373,.89632115577,.93490607594,.96476225559,.98561151155,.99726386185],i=t/2,a=1/(Math.pow(2,i)*Math.exp(this._gammaln(i))),u;i=i-1;var o=0,s=n,f=(o+s)/2,h=(s-o)/2,e=0,r;for(u=0;u<16;++u)r=l[u]*h,e=Number(e)+Number(c[u]*(Math.pow(f+r,i)*Math.exp(-(f+r)/2)+Math.pow(f-r,i)*Math.exp(-(f-r)/2)));return Number(a)*Number(e)*Number(h)};this._gammaln=function(n){var r=[.918938533204673,.000595238095238,.000793650793651,.002777777777778,.083333333333333],t=n,i=0,u;if(t<7){for(i=t,t++;t<7;)i=i*t,t<7&&t++;i=-Math.log(i)}return u=this._parseDouble((1/(t*t)).toString()),i+(t-this._parseDouble("0.5"))*Math.log(t)-t+r[0]+(((-r[1]*u+r[2])*u-r[3])*u+r[4])/t};this._pearson=function(n,t,i){for(var u=0,f=0,r=0;r=1)return 1;if(t%1==0&&i%1==0&&t+i>0)return this._rIBetaFunction1(n,t,i);if(i%1==0&&t+i<172)return this._rIBetaFunction2(n,t,i);if(t%1==0&&t+i<172)return 1-this._rIBetaFunction2(1-n,i,t);if(t==.5&&i==.5)return 2/Math.PI*Math.atan(Math.sqrt(n/(1-n)));if(t==.5&&i%.5==0)return 1-this._rIBetaFunction(1-n,i,.5);if(t%.5==0&&i==.5){if(t<45){var u=0,e=Math.round(t-.5),l=this._parseDouble(this.computeGammaln("0.5".toString()));for(r=0;r.5?1-this._rIBetaFunction(1-n,i,t):(c=this._iBetaFunction(n,t,i)/this._betaFunction(t,i),Math.max(0,Math.min(1,c)))};this._rIBetaFunction1=function(n,t,i){var u=0,f=t+i-1,r;if(f<21){for(r=t;r172)throw"Cannot currently compute RegularizedIncompleteBetaFunction for a + b > 172";for(u=0,r=1;r143?t>20?2.5066282746310002*Math.pow(n,n-.5)*Math.pow(t,t-.5)/Math.pow(n+t,n+t-.5):this._gammaFunction(t)*Math.pow(n,-t):this._gammaFunction(n)*this._gammaFunction(t)/this._gammaFunction(n+t)};this._gammaFunction=function(n){var t,i;if(n>143)throw"Cannot currently compute gamma function for z > 143";if(n>0&&n<21&&n%1==0)return this._factorial(Math.round(n-1));if(n>0&&n<11&&n%.5==0)return t=n,i=1.77245385090552,i*this._factorial(2*t)/(Math.pow(4,t)*this._factorial(t));var r=1+1/(12*n)+1/(288*n*n)-139/(51840*Math.pow(n,3))-571/(2488320*Math.pow(n,4))+163879/(209018880*Math.pow(n,5))+5246819/(75246796800*Math.pow(n,6));return Math.pow(n,n-.5)*Math.exp(-n)*2.5066282746310002*r};this._epsilon=494065645841247e-338;this._factorial=function(n){var t,i;if(n<0)throw"Factorial not defined for negative n";if(n>20)throw"Answer will exceed max long";for(t=1,i=n;i>0;i--)t=t*i;return t};this._combinations=function(n,t){var i=this._logCombin(n,t),r=Math.exp(i);return Math.round(r)};this._logCombin=function(n,t){return this._logFactorial(n)-this._logFactorial(t)-this._logFactorial(n-t)};this._logFactorial=function(n){for(var t=0,i=2;i<=n;i++)t=t+Math.log(i);return t};this._isCellReference=function(n){var e,f,t,i,u,r;if(n==""||(n=this.setTokensForSheets(n),e=this._sheetToken(n),f=!1,e!=""&&(n=n.split(this.sheetToken).join("")),t=!1,i=!1,n.indexOf(":")!=n.lastIndexOf(":")))return!1;for(u=n.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),r=0;r-1&&n.indexOf(this.tic)==-1?f&&t&&i?!0:(!t||i)&&(t||!i)||f?!1:!0:t&&i&&n.indexOf(this.tic)==-1?!0:!1};this._isDate=function(n){if(typeof n=="object"||ej.parseDate(n)!=null){var t=new Date(Date.parse(n));return t>=this._dateTime1900?t:"NaN"}return"NaN"};this._isDigit=function(n){var t=n.charCodeAt(0);return t>47&&t<58?!0:!1};this._isHLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&2)!=0};this._isLetter=function(n){var t=n.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122?!0:!1};this._isLetterOrDigit=function(n){var t=n.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?!0:!1};this._isLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0||(this._enableLookupTableCaching&2)!=0};this._isOptimizedMatchesEnabled=function(){return(this._enableLookupTableCaching&4)!=0};this._isRange=function(n){var u=!1,r=n.indexOf(":"),t,i;if(r>1&&r0&&this._isDigit(n[t]);)t--;if(this._isLetter(n[t])){for(t--;t>=0&&this._isLetter(n[t]);)t--;t>-1&&n[t]==this._string_fixedreference[0]&&t--;t<0?i=!0:n[t]==this.sheetToken&&(t-->1&&n[t]==this.tic[0]?i=n.substring(0,t-1).lastIndexOf(this.tic[0])==0:t>0&&this._isDigit(n[t])&&(i=n.substring(0,t).lastIndexOf(this.sheetToken)==0))}if(i&&(t=r+1,t64&&t<91};this._iisVLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0};this._mark=function(n,t,i,r,u){var f=0,e;for(u?(f=this._findAndCheckPrecedingChar(n,i,f),n=this._findAndCheckPrecedingCharCopy):f=n.indexOf(i),e=i.length;f>-1;)n=n.substring(0,f)+r+n.substring(f+e),t=t.substring(0,f)+r+t.substring(f+e),u?(f=this._findAndCheckPrecedingChar(n,i,f),n=this._findAndCheckPrecedingCharCopy):f=n.indexOf(i,f);return this._markCopy="",t};this._markColonsInQuotes=function(n){for(var i=!1,t=0;t-1&&i>-1){var f=this.getReservedWordOperators()[this._reservedWord_IF].length,e=i-f,r=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,o=u-r,s=u+this.getReservedWordOperators()[this._reservedWord_ELSE].length,h=t.length-s;t="IF(("+this._substring(t,f,e)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,r,o)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,s,h)+"))";n=t}else if(i>-1){var f=0,e=i,r=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,o=t.length-r+1;t="IF(("+this._substring(t,f,e)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,r,o)+"))";n=t}return this._markIFCopy=t,t};this._markLibraryFormulas=function(n){var u=n.indexOf(")"),o,i,r,f,s,e,h,t;if(u==-1)n=this._markNamedRanges(n);else while(u>-1){for(o=0,i=u-1;i>-1&&(n[i]!="("||o!=0);)n[i]==")"?o++:n[i]==")"&&o--,i--;if(i==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];for(r=i-1;r>-1&&(this._isLetterOrDigit(n[r])||this._validFunctionNameChars.indexOf(n[r])>-1||n[r]==this.getParseDecimalSeparator());)r--;if(f=i-r-1,f>0&&this.getLibraryFunctions().getItem(this._substring(n,r+1,f))!=undefined)this._ignoreBracet=this._substring(n,r+1,f)=="AREAS"?!0:!1,t=this._substring(n,i,u-i+1),t=this._markNamedRanges(t),n=n.substring(0,r+1)+"q"+this._substring(n,r+1,f)+t.split("(").join(this._leftBracket).split(")").join(this._rightBracket)+n.substring(u+1);else{if(f>0){if(this.unknownFunction!=null){var c=CalcEngine.getSheetFamilyItem(this.grid),l=this.grid,a=this._sheetToken(this.cell),t=this.cell;for(a.length>0&&(l=c.tokenToParentObject.getItem(a),t=t.substring(t.lastIndexOf(this.sheetToken)+1)),s=c.sheetNameToParentObject.keys(),e=0;e0&&(t=n.substring(0,i));t=t+"{"+this._substring(n,i+1,u-i-1)+"}";u","=","&"],t=n.length>0&&(n[0]=="("||n[0]=="{")?1:0,r,f,i,e;for(n.indexOf("#N/A")>-1&&(n=n.split("#N/A").join("#N~A")),n.indexOf("#DIV/0!")>-1&&(n=n.split("#DIV/0!").join("#DIV~0!")),r=t,r=n.indexOf("[")==-1||n.indexOf("[")>this._indexOfAny(n.substring(t),u)?this._indexOfAny(n.substring(t),u):this._findNextEndIndex(n,r);r>-1&&r+t-1?this._getTableRange(this._substring(n,t,r)):this.getNamedRanges().getItem(this._substring(n,t,r)),i==undefined||typeof i=="string"||(i=i.getItem(this._substring(n,t,r))),i==null&&(f=this._checkIfScopedRange(this._substring(n,t,r)),isNaN(f)?this._substring(n,t,r).startsWith(this.sheetToken.toString())&&(e=this._substring(n,t,r).indexOf(this.sheetToken,1),e>1&&(i=this.getNamedRanges().getItem(this._substring(n.substring(t),e+1,r-e-1)))):i=f),i!=null&&(i=i.toUpperCase(),i=this.setTokensForSheets(i),i=this._markLibraryFormulas(i)),i!=null)n=n.substring(0,t)+i+n.substring(t+r),t+=i.length+1;else for(t+=r+1;tthis._indexOfAny(n.substring(t),u)?this._indexOfAny(n.substring(t),u):this._findNextEndIndex(n,r),r=this._indexOfAny(n.substring(t),u);r==0&&t-1)&&t-1?this._getTableRange(n.substring(t)):this.getNamedRanges().length>0?this.getNamedRanges().getItem(n.substring(t)):i,i==null&&(f=this._checkIfScopedRange(n.substring(t)),isNaN(f)||(i=f)),i!=null&&(i=i.toUpperCase(),i=this.setTokensForSheets(i),i=this._markLibraryFormulas(i),i!=null&&(n=n.substring(0,t)+i,t+=i.toString().length+1)),r=t-1&&(n=n.split("#N~A").join("#N/A")),n.indexOf("#DIV~0!")>-1&&(n=n.split("#DIV~0!").join("#DIV/0!")),n};this._markReserveWords=function(n){var t=n.toLowerCase(),i=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim();return i[0]==this.getReservedWordOperators()[this._reservedWord_IF]&&(n=this._markIF(t,n),t=this._markIFCopy),n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_NOT],this.char_NOTop,!0),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_OR],this.char_ORop,!1),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_AND],this.char_ANDop,!1),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_XOR],this.char_XORop,!1),t=this._markCopy,n};this._markupResultToIncludeInFormula=function(n){return n.length>0&&n[0]=="-"&&!isNaN(this._parseDouble(n))?n="nu"+n.substring(1):n.length>0&&(n[0]==this.tic[0]||n[0]==this.bMARKER||n[0]=="#")||n.startsWith(this.trueValueStr)||n.startsWith(this.falseValueStr)||(isNaN(this._parseDouble(n))?this._isRange(n)||(n=this.tic+n+this.tic):(n=n.split(this.getParseArgumentSeparator()).join(String.fromCharCode(32)),n="n"+n)),n};this._matchCompare=function(n,t){var i=n.toString(),r=t.toString(),u=this._parseDouble(i),f=this._parseDouble(r);return isNaN(u)||isNaN(f)?i==r?0:i>r?1:-1:u==f?0:u>f?1:-1};this._matchingRightBracket=function(n){for(var i=-1,t=1,r=0,e=this._sheetToken(n),u,f;i==-1&&t-1&&i-1&&(u=n.indexOf(this.sheetToken,t+1),u>-1&&(r=this._substring(n,t,u-t+1),n=n.replace(r,""),i=n.indexOf(":"))),this.rowIndex(n.substring(0,i)))};this._getTableRange=function(n){var t,f,r,i,e,s,u,o;if(n=n.replace(" ","").toUpperCase(),t=n.replace("]","").replace("#DATA",""),f=t,t.indexOf(this.getParseArgumentSeparator())>-1&&(f=t.substring(0,t.indexOf(this.getParseArgumentSeparator())).replace("[",""),t=t.replace("[","").replace(this.getParseArgumentSeparator(),"_")),r="",n.indexOf("#THISROW")>-1){if(i=this.getNamedRanges().getItem(t.replace("#THISROW","")),i==undefined||typeof i=="string"||(i=i.getItem(t.replace("#THISROW",""))),i==null)return i;i=i.toUpperCase();e=this.rowIndex(this.cell);i=i.replace(this._string_fixedreference,"");i=this.setTokensForSheets(i);s=0;u=this.getNamedRanges().getItem(f.Replace("#THISROW",""));u==undefined||typeof u=="string"||(u=u.getItem(f.Replace("#THISROW","")));u=u.replace(this._string_fixedreference,"").toUpperCase();u=this.setTokensForSheets(u);o=this._getTopRowIndexFromRange(i);r=this.getCellsFromArgs(i)[e-o]}else if(t=t[t.length-1]=="["?t.replace("[",""):t.replace("[","_"),(t.indexOf("#TOTALS")>-1||t.indexOf("#ALL")>-1||t.indexOf("#HEADERS")>-1||t.indexOf("#DATA")>-1)&&(t=t.replace("#","")),r=this.getNamedRanges().getItem(t),r==undefined||typeof r=="string"||(r=r.getItem(t)),r==null)return null;return r.toUpperCase()};this._parse=function(n){var t=n,s,u,f,r,h,i,c,o;if(this._isTextEmpty(t))return t;if(t=this.getFormulaText(t),this.getSupportLogicalOperators()&&(t=this._markReserveWords(t)),this.getFormulaCharacter()!=String.fromCharCode(0)&&this.getFormulaCharacter()==t[0]&&(t=t.substring(1)),this.getNamedRanges().length>0&&(t.indexOf("[")>-1&&(s=this._getTableRange(t),s!=null&&(t=s)),this.getNamedRanges().getItem(t.toUpperCase())!=undefined?t=this.getNamedRanges().getItem(t.toUpperCase()).toUpperCase():(u="",u=this._checkIfScopedRange(t.toUpperCase()),isNaN(u)||(t=u.toUpperCase()))),f=this._saveStrings(t),t=this._saveStringsText,t=t.split(this.braceLeft).join(this.tic),t=t.split(this.braceRight).join(this.tic),t=t.split("-+").join("-"),r=0,(t[t.length-1]!=this.bMARKER||this._indexOfAny(t,this.tokens)!=t.length-2)&&(t=t.toUpperCase()),t.indexOf(this.sheetToken)>-1&&(h=CalcEngine.getSheetFamilyItem(this.grid),h.sheetNameToParentObject!=null&&h.sheetNameToParentObject.length>0))try{t=this.setTokensForSheets(t)}catch(e){if(this._rethrowExceptions)throw e;else return e}if(this._isRangeOperand)return this._isRangeOperand=!1,this._getCellFrom(this._parseSimple(t));t=t.split(" ").join("");t=t.split("=>").join(">=");t=t.split("=<").join("<=");try{t=this._markLibraryFormulas(t)}catch(e){if(this._rethrowExceptions)throw e;else return e}if(!this._ignoreBracet)while((r=t.indexOf(")"))>-1){if(i=t.substring(0,r).lastIndexOf("("),i==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];if(i==r-1)throw this.formulaErrorStrings[this._empty_expression];c="";c=this._ignoreBracet?this._substring(t,i,r-i+1):this._substring(t,i+1,r-i-1);t=t.substring(0,i)+this._parseSimple(c)+t.substring(r+1)}if(!this._ignoreBracet&&t.indexOf("(")>-1)throw this.formulaErrorStrings[this._mismatched_parentheses];return o=this._parseSimple(t),f!=null&&f.length>0&&(o=this._setStrings(o,f)),o};this._parseDouble=function(n){return isNaN(parseInt(n))?NaN:Number(n.toString().replace(/[^0-9\.]-+/g,""))*1};this._parseSimple=function(n){var t=n;if(t.length>0&&t[0]=="+"&&(t=t.substring(1)),t=="#N/A"||t=="#N~A")return"#N/A";if(t.indexOf("#N/A")>-1&&(t=t.split("#N/A").join("#N~A")),t=="#DIV/0!"||t=="#DIV~0!")return"#DIV/0!";if(t.indexOf("#DIV/0!")>-1&&(t=t.split("#DIV/0!").join("#DIV~0!")),t=this._handleEmbeddedEs(t),t=t.split(this._string_lesseq).join(this.char_lesseq),t=t.split(this._string_greatereq).join(this.char_greatereq),t=t.split(this._string_noequal).join(this.char_noequal),t=t.split(this._string_fixedreference).join(this._string_empty),t=t.split(this._string_or).join(this.char_or),t=t.split(this._string_and).join(this.char_and),t=="")return t;var i=!0,r=[this.token_EP,this.token_EM],u=[this.token_or],f=[this.token_multiply,this.token_divide],e=[this.token_add,this.token_subtract],o=[this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal],s=[this.token_NOTop],h=[this.token_ORop,this.token_ANDop,this.token_XORop],c=[this.token_and],l=[this.char_EP,this.char_EM],a=[this.char_or],v=[this.char_multiply,this.char_divide],y=[this.char_add,this.char_subtract],p=[this.char_less,this.char_greater,this.char_equal,this.char_lesseq,this.char_greatereq,this.char_noequal],w=[this.char_NOTop],b=[this.char_ORop,this.char_ANDop,this.char_XORop],k=[this.char_and];return t=this._parseSimpleOperators(t,r,l),t=this._parseSimpleOperators(t,u,a),i&&(t=this._parseSimpleOperators(t,f,v)),i&&(t=this._parseSimpleOperators(t,e,y)),i&&(t=this._parseSimpleOperators(t,o,p)),i&&(t=this._parseSimpleOperators(t,s,w)),i&&(t=this._parseSimpleOperators(t,h,b)),i&&(t=this._parseSimpleOperators(t,c,k)),t.indexOf("#N~A")>-1&&(t=t.split("#N~A").join("#N/A")),t.indexOf("#DIV~0!")>-1&&(t=t.split("#DIV~0!").join("#DIV/0!")),t};this._parseSimpleOperators=function(n,t,i){for(var w,g,nt,a,tt,v,r,h,c,p,f,u=n,o,k="",d=0;d-").join(">u").split("<-").join("+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").toString(),u.length>0&&u[0]=="-"?u="0"+u:u.length>0&&u[0]=="+"&&(u=u.substring(1)),this._indexOfAny(u,i)>-1)while((o=this._indexOfAny(u,i))>-1){var s="",e="",l=0,y=0,ut=this._supportLogicalOperators&&u[o]==this.char_NOTop,r=0;if(ut)l=o;else{if(o<1&&u[o]!="-")throw this.formulaErrorStrings[this._operators_cannot_start_an_expression];if(r=o-1,o==0&&u[o]=="-"){u=this.bMARKER+"nu"+u.substring(1)+this.bMARKER;continue}else if(u[r]==this.tic[0]){if(f=u.substring(0,r-1).lastIndexOf(this.tic),f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,f,r-f+1);l=f}else if(u[r]==this.bMARKER){if(f=this._findLastNonQB(u.substring(0,r-1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,f+1,r-f-1);l=f+1}else if(u[r]==this._rightBracket){for(h=0,f=r-1;f>0&&(u[f]!="q"||h!=0);)u[f]=="q"?h--:u[f]==this._rightBracket&&h++,f--;if(f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,f,r-f+1);l=f}else if(this._isDigit(u[r])||u[r]=="%"){for(c=!1,p=!1;r>-1&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator()||!p&&u[r]=="%"||u[r]=="u");)u[r]==this.getParseDecimalSeparator()?c=!0:u[r]=="%"&&(p=!0),r=r-1;if(r>-1&&c&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];if(r=r+1,r==0||r>0&&!this._isUpperChar(u[r-1]))s="n"+this._substring(u,r,o-r),l=r;else{for(r=r-1;r>-1&&this._isUpperChar(u[r]);)r=r-1;if(r>-1&&u[r]=="u"&&(r=r-1),r>-1&&u[r]==this.sheetToken){for(r=r-1;r>-1&&u[r]!=this.sheetToken;)r=r-1;r>-1&&u[r]==this.sheetToken&&(r=r-1)}if(r>-1&&u[r]==":"){for(r=r-1;r>-1&&this._isDigit(u[r]);)r=r-1;while(r>-1&&this._isUpperChar(u[r]))r=r-1;if(r>-1&&u[r]==this.sheetToken){for(r--;r>-1&&u[r]!=this.sheetToken;)r--;r>-1&&u[r]==this.sheetToken&&r--}r=r+1;s=this._substring(u,r,o-r);s=this._getCellFrom(s)}else r=r+1,s=this._substring(u,r,o-r);this.updateDependencies(s);l=r}}else{while(r>=0&&(this._isUpperChar(u[r])||u[r]=="_"||u[r]=="."))r--;if(s=this._substring(u,r+1,o-r-1),l=r+1,a="",this.getNamedRanges().containsKey(s)>-1)s=this._parse(this.getNamedRanges()[s]);else if(isNaN(a=this._checkIfScopedRange(s,a)))if(s==this.trueValueStr)s="n"+this.trueValueStr;else if(s==this.falseValueStr)s="n"+this.falseValueStr;else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_char_in_front_of]+" "+u[o];return this.getErrorStrings()[5].toString()}else s=this._parse(a)}}if(o==u.length-1)throw this.formulaErrorStrings[this._expression_cannot_end_with_an_operator];else if(r=o+1,w=u[r]=="u",w&&r++,u[r]==this.tic[0]){if(f=u.substring(r+1).indexOf(this.tic),f<0)throw this.formulaErrorStrings[this._cannot_parse];e=this._substring(u,r,f+2);y=f+r+2}else if(u[r]==this.bMARKER){if(f=this._findNonQB(u.substring(r+1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];e=this._substring(u,r+1,f);w&&(e=e+"nu1m");y=f+r+2}else if(u[r]=="q"){for(h=0,f=r+1;f4){while(r-1)e=this._parse(this.getNamedRanges()[e]);else if(isNaN(a=this._checkIfScopedRange(e,a)))if(e==this.trueValueStr)e="n"+this.trueValueStr;else if(e==this.falseValueStr)e="n"+this.falseValueStr;else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_characters_following_an_operator];return this.getErrorStrings()[5].toString()}else e=this._parse(a);else this.updateDependencies(e);y=r+1}else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_characters_following_an_operator];return this.getErrorStrings()[5].toString()}tt=k.indexOf(u[o]);v=this.bMARKER+this._zapBlocks(s)+this._zapBlocks(e)+t[tt]+this.bMARKER;l>0&&(v=u.substring(0,l)+v);y0&&(u[f]!="q"||h!=0);)u[f]=="q"?h--:u[f]==this._rightBracket&&h++,f--;if(f<0)throw this.formulaErrorStrings[this._bad_library];}else if(this._isDigit(u[r])){for(c=!1,p=!1;r>-1&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator()||!p&&u[r]=="%");)u[r]==this.getParseDecimalSeparator()?c=!0:u[r]=="%"&&(p=!0),r=r-1;if(r>-1&&c&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];}if(u.length>0&&(this._isUpperChar(u[0])||u[0]==this.sheetToken)){var b=!0,it=!0,rt=!1;for(f=0;f0&&!rt)throw this.formulaErrorStrings[this._missing_sheet];for(rt=!0,f++;f-1)return this._isErrorString=!0,this.getErrorStrings().indexOf(t);if(t[0]=="#"||t=="")return 0;if(t==this.trueValueStr)return 1;if(t==this.falseValueStr)return 0;if(r=this._parseDouble(t),isNaN(r)){if(this.getUseDatesInCalculations()&&isNaN(this._parseDouble(i)))return u=this._isDate(t),isNaN(u)?0:this._getSerialDateTimeFromDate(u)}else return r}return t==""&&this.getTreatStringsAsZero()?0:i!=null&&i.toString().length>0?Number.NaN:0};this._popString=function(n){var t=n.pop(),r=this._parseDouble(t),i;if(t==null)t="";else if(isNaN(r)){if(this.getUseDatesInCalculations()&&isNaN(this._parseDouble(t.split(this.tic).join("")))&&(i=this._isDate(t.split(this.tic).join("")),!isNaN(i)))return this._getSerialDateTimeFromDate(i).toString()}else return r.toString();return this.removeTics(t.toString())};this._populateNamedRangesNonScoped=function(){this._namedRangesNonScoped==null&&(this._namedRangesNonScoped=new HashTable);this._namedRangesNonScoped.clear();for(var n=0;n-1)while(t>-1&&t-1){if(e=this.tic+this._uniqueStringMarker+s.toString()+this.tic,r-1&&t-1;u--)if(this.getValidPrecedingChars().indexOf(n[u].toString())==-1)i=n[u]+i;else break;if(!(i[0]=="'"&&i[i.length-1]=="'"))throw this.formulaErrorStrings[this._mismatched_tics];if(i[0]=="'"&&(i=i.substring(1)),i[i.length-1]=="'"&&(i=i.substring(0,i.length-1)),this.getSortedSheetNames().indexOf(i.toUpperCase())==-1)throw this.formulaErrorStrings[this._missing_sheet];t+11&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(n=this._substring(n,1,n.length-2)),n};this._substring=function(n,t,i){return n.substring(t,i+t)};this._isTextEmpty=function(n){return n==null||n==""};this._toOADate=function(n){return(n.getTime()-Date.parse(this._oaDate))/this._millisecondsOfaDay};this._zapBlocks=function(n){var i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>0;--t)n[t]==this._rightBracket?i--:n[t]==this._leftBracket?i++:n[t]==this.bMARKER&&i==0&&(n=n.substring(0,t-1)+n.substring(t+1));return n};this.addCustomFunction=function(n,t){return(n=n.toUpperCase(),this._addFunction(n,t),this._customlibraryFunctions.getItem(n)==undefined)?(this._customlibraryFunctions.add(n,t),!0):!1};this.UpdateDependentNamedRangeCell=function(n){var i,r,o;if(this.getDependentNamedRangeCells()!=null&&this.getDependentNamedRangeCells().containsKey(n)&&(i=this.getDependentNamedRangeCells().keys(),i!=null&&i.length>0))for(r=0;r-1?(o=CalcEngine.getSheetFamilyItem(this.grid),this.grid=o.tokenToParentObject.getItem(t.substring(0,e+3)),u=this.rowIndex(t),f=this.colIndex(t)):(u=this.rowIndex(t),f=this.colIndex(t));this.recalculateRange(RangeInfo.cells(u,f,u,f),this.grid);this.grid=s}};this.RemoveNamedRangeDependency=function(n){if(this.getDependentNamedRangeCells().containsKey(n)){var t=Hashtable(this.getDependentNamedRangeCells()[n]);t.Clear();this.getDependentNamedRangeCells().remove(n)}};this.SetNamedRangeDependency=function(n,t){var r=CalcEngine.getSheetFamilyItem(this.grid),u,i,f;r.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(u=r.GridModelToToken[this.grid],t=u+t);this.getDependentNamedRangeCells()!=null&&this.getDependentNamedRangeCells().containsKey(n)?(i=this.getDependentNamedRangeCells()[n],i.containsKey(t)||i.add(t,"0")):(f=new HashTable,f.add(t,"0"),this.getDependentNamedRangeCells().add(n,t.toString()))};this.addNamedRange=function(n,t){return(n=n.toUpperCase(),this.getNamedRanges().getItem(n)==null)?(this.getNamedRanges().add(n,t),this.getNameRangeValues().containsKey(n)||this.getNameRangeValues().add(n,t.toString()),(this.getUndefinedNamedRanges().containsKey(n)||this.getUndefinedNamedRanges().containsKey(n.toUpperCase())||this.getUndefinedNamedRanges().containsKey(n.toLowerCase()))&&(this.SetNamedRangeDependency(n.toUpperCase(),this.cell),this.UpdateDependentNamedRangeCell(n.toUpperCase())),namedRangesSized=null,this._checkAddNonScopedNamedRange(n),!0):!1};this.adjustRangeArg=function(n){return n.length>1&&n[0]==this.bMARKER&&n[n.length-1]==this.bMARKER&&this._substring(n,1,n.length-2).indexOf(this.bMARKER)==-1&&(n=this.computedValue(n)),n.length>1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(n=this._substring(n,1,n.length-2)),n};this.clearFormulaDependentCells=function(n){var f=this.getDependentFormulaCells().getItem(n),i,t,r,u;if(f!=null){for(i=f.keys(),t=0;tthis._maximumRecursiveCalls){this.computedValueLevel=0;throw this.formulaErrorStrings[this._too_complex];}if(_stack=[],i=0,_stack.length=0,sheet="",this.getAllowShortCircuitIFs()){loc=-1;do if(i-1&&(loc=this._matchingRightBracket(formula.substring(i)),loc>-1)){result="";nextIfLoc=formula.indexOf(this.iFMarker,loc);do{loc=i;sepLoc=this._findNextSeparator(formula,loc);isNaN(sepLoc)||(loc=sepLoc);for(var funcArgs=this._substring(formula,i+this.iFMarker.length,loc-this.iFMarker.length-1),ifArguments=[],argLoc=0,argNo=0;argLoc0&&arguments.push(funcArgs.substring(0,argLoc)):(argLoc=sepLoc,ifArguments.push(funcArgs.substring(0,argLoc)),funcArgs=funcArgs.substring(Number(argLoc)+1),argLoc=0);ifResult=this.getValueFromArg(ifArguments[0]);result=ifResult==this.trueValueStr?this.getValueFromArg(ifArguments[1]):this.getValueFromArg(ifArguments[2]);nextIfLoc=formula.indexOf(this.iFMarker,loc)}while(formula.indexOf(this.iFMarker)>-1&&nextIfLoc>-1);result=this._markupResultToIncludeInFormula(result);rightPiece="";i+loc+1-1&&loc>-1)}for(i=0;i=formula.length)continue;if(formula[i]==this.bMARKER&&i++,i>=formula.length)continue}if(formula[i]=="%"&&_stack.length>0){o=_stack[0];d=this._parseDouble(o);isNaN(d)||(_stack.pop(),_stack.push(Number(d)/100));i=i+1;continue}if(formula[i]==this.sheetToken){for(sheet=formula[i].toString(),i++;i50){if(this._breakedFormulaCells.indexOf(s)==-1&&this.getUseFormulaValues()){family=CalcEngine.getSheetFamilyItem(this.grid);token=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken;s=token+s;this._breakedFormulaCells.add(s);this._tempBreakedFormulaCells.add(s);break}_stack.push("FALSE")}else _stack.push(this.getValueFromParentObjectCell(s));else if(formula[i]=="q")if(formula=this._computeInteriorFunctions(formula),ii=formula.substring(i+1).indexOf(this._leftBracket),ii>0){for(var bracketCount=0,bracketFound=!1,start=ii+i+2,k=start;k0);)formula[k]==this._leftBracket?(bracketCount++,bracketFound=!0):formula[k]==this._leftBracket&&bracketCount--,k++;if(bracketFound){var s=this._substring(formula,start,k-start-2),s1="",splits=this.splitArgsPreservingQuotedCommas(s);for(t=0;t0&&(s1+=","),j=this._findLastqNotInBrackets(t),s1+=j>0?splits[t].substring(0,j)+this.computedValue(splits[t].substring(j)):this.computedValue(splits[t]);formula=formula.substring(0,start)+s1+formula.substring(k-2)}if(name=this._substring(formula,i+1,ii),name=="AVG"&&this._excelLikeComputations)throw this.formulaErrorStrings[this._bad_index];if(this.getLibraryFunctions().getItem(name)!=undefined){j=formula.substring(i+ii+1).indexOf(this._rightBracket);args=this._substring(formula,i+ii+2,j-1);try{functionName=this.getLibraryFunctions().getItem(name);result=this.getCustomLibraryFunctions().getItem(name)!=undefined?eval(functionName)(args):this[functionName](args);_stack.push(result)}catch(ex){if(this.getRethrowLibraryComputationExceptions()){this._libraryComputationException=ex;throw ex;}return ex}i+=j+ii+2}else if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._missing_formula];}else if(formula[0]==this.bMARKER){i=0;_stack.length==0;continue}else throw this.formulaErrorStrings[this._improper_formula];else if(this._isDigit(formula[i])||formula[i]=="u"){if(s="",(formula[i]=="u"||uFound)&&(s="-",uFound?uFound=!1:i++),i0&&(o=_stack[0],d=this._parseDouble(o.toString()),isNaN(d)||(_stack.pop(),s=(d/100).toString())):s=(Number(s)/100).toString()):i0?this.trueValueStr:this.falseValueStr:Number(d1)>Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_equal:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("")==s2.toUpperCase().split(this.tic).join("")?this.trueValueStr:this.falseValueStr:Number(d1)==Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_lesseq:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s2!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("").localeCompare(s2.toUpperCase().split(this.tic).join(""))<=0?this.trueValueStr:this.falseValueStr:Number(d1)<=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_greatereq:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("").localeCompare(s2.toUpperCase().split(this.tic).join(""))>=0?this.trueValueStr:this.falseValueStr:Number(d1)>=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_noequal:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("")!=s2.toUpperCase().split(this.tic).join("")?this.trueValueStr:this.falseValueStr:Number(d1)!=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_and:s1=this._popString(_stack);s2="";_stack.length>0&&(s2=this._popString(_stack));this.getUseNoAmpersandQuotes()?_stack.push(s2+s1):_stack.push(this.tic+s2+s1+this.tic);i=i+1;break;case this.token_or:d=this._pop(_stack);d1=this._pop(_stack);_stack.push(Math.pow(d1,d).toString());i=i+1;break;case this.token_ORop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr||s2.toUpperCase().split(this.tic).join("")==this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_ANDop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s2.toUpperCase().split(this.tic).join("")==this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_XORop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s2.toUpperCase().split(this.tic).join("")!=this.trueValueStr||s2.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s1.toUpperCase().split(this.tic).join("")!=this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_NOTop:s1=this._popString(_stack);d=this._parseDouble(s1);s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.falseValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;default:if(this.computedValueLevel=0,this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_expression];else return this.getErrorStrings()[1].toString()}}if(this._checkDanglingStack&&_stack.length>1&&formula.length>1&&(formula.indexOf(this.bmarker.toString())!=0||formula.indexOf(this.bmarker)!=formula.length-1||formula.indexOf(this.bmarker2)>-1))return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];if(_stack.length==0)return"";s="";cc=_stack.length;do return(s=_stack.pop().toString()+s,s==""&&!this.getUseNoAmpersandQuotes()&&this._isCellReference(formula)&&this.getTreatStringsAsZero())?"0":s;while(cc>0&&!(s.indexOf(this.FALSEVALUESTR)>-1||s.indexOf(this.tRUEVALUESTR)>1));return s}catch(ex){if(this.computedValueLevel=0,ex.toString().indexOf(this.formulaErrorStrings[this._circular_reference_])>-1||this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();throw ex;}if(ex.toString().indexOf(this.formulaErrorStrings[this._cell_empty])>-1)return"";if(this.getRethrowLibraryComputationExceptions()){this._libraryComputationException=ex;throw ex;}return ex}finally{this.computedValueLevel--;this.computedValueLevel<0&&(this.computedValueLevel=0)}};this.computeFormula=function(n){if(this.getThrowCircularException())if(this._iterationMaxCount>0){if(this.computedValueLevel==0)this._circCheckList.length=0,this._circCheckList.push(this.cell);else if(this._circCheckList.indexOf(this.cell)>-1)return this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().getItem(this.cell).toString()}else{if(this.computedValueLevel==0)this._circCheckList.length=0;else if(this._circCheckList.indexOf(this.cell)>-1){this.computedValueLevel=0;this._circCheckList.length=0;throw this.formulaErrorStrings[this._circular_reference_];}this._circCheckList.push(this.cell)}var t=this.computedValue(n);return this.getUseNoAmpersandQuotes()&&t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]&&(t=this._substring(t,1,t.length-2)),t};this.dispose=function(){if(!this._isDisposed){var n=0;this.grid!=null&&(n=this.getSheetID(this.grid));CalcEngine._tokenCount--;CalcEngine.sheetFamilyID--;CalcEngine._sheetFamiliesList!=null&&CalcEngine._sheetFamiliesList.length>0&&(CalcEngine._sheetFamiliesList[n]=null,CalcEngine._sheetFamiliesList.remove(n));CalcEngine.modelToSheetID!=null&&CalcEngine.modelToSheetID.length>0&&(CalcEngine.modelToSheetID[n]=null,CalcEngine._sheetFamiliesList.remove(n));this._formulaInfoTable!=null&&(this._formulaInfoTable.clear(),this._formulaInfoTable=null);this._circCheckList!=null&&(this._circCheckList.length=0,this._circCheckList=null);this._dependentCells!=null&&(this._dependentCells.clear(),this._dependentCells=null);this._dependentFormulaCells!=null&&(this._dependentFormulaCells.clear(),this._dependentFormulaCells=null);this.getIterationValues()!=null&&(this.getIterationValues().clear(),this.getIterationValues(null));this._libraryFunctions!=null&&(this._libraryFunctions.clear(),this._libraryFunctions=null);this._lookupTables!=null&&(this._lookupTables.clear(),this._lookupTables=null);this.grid=null;this.getLibraryFunctions()!=null&&(this.getLibraryFunctions().clear(),this.setLibraryFunctions(null));this._isDisposed=!0}};this.getCalcID=function(){return this._calcID};this._getCellFrom=function(n){var u="",t=this.getCellsFromArgs(n),i=t.length-1,f=this.rowIndex(t[0]),o,s,r;if(f==this.rowIndex(t[i])){var h=this.colIndex(t[0]),c=this.colIndex(t[i]),e=this.colIndex(this.cell);e>=h&&e<=c&&(u=RangeInfo.getAlphaLabel(e).toString()+f.toString())}else(o=this.colIndex(t[0]))==this.colIndex(t[i])&&(s=this.rowIndex(t[i]),r=this.rowIndex(this.cell),r>=f&&r<=s&&(u=RangeInfo.getAlphaLabel(o).toString()+r.toString()));return u};this.getCellsFromArgs=function(n){var i,f,t,h,l,e,s,a,u,o;if(n=this._markColonsInQuotes(n),t=n.indexOf(":"),t==-1)return n=n.split(this._markerChar).join(":"),t=n.indexOf(this.getParseArgumentSeparator()),t==-1?(i=this.rowIndex(n),f=this.colIndex(n),h=[],h.push(n),h):this.splitArgsPreservingQuotedCommas(n);this.getRowIndexFromName=function(n){var i,t;if(n.indexOf(":")==-1){for(i="",t=0;t-1&&(l=n.indexOf(this.sheetToken,r+1),l>-1&&(c=this._substring(n,r,l-r+1),n=n.split(c).join(""),t=n.indexOf(":"))),t>0&&this._isLetter(n[t-1]))s=this._rowMaxCount>0?this._rowMaxCount:50,n=n.substring(0,t)+"1:"+n.substring(t+1)+s.toString(),t=n.indexOf(":");else if(t>0&&this._isDigit(n[t-1])){for(e=t-2;e>=0&&this._isDigit(n[e]);)e--;e!=-1&&this._isLetter(n[e])||(s=this._columnMaxCount>0?this._columnMaxCount:50,n="A"+n.substring(0,t)+":"+RangeInfo.getAlphaLabel(s)+n.substring(t+1),t=n.indexOf(":"))}if(a=this._canGetRowIndex(n.substring(0,t)),!a)return this._ignoreCellValue=!0,n=y,this.splitArgsPreservingQuotedCommas(n);if(i=this.rowIndex(n.substring(0,t)),u=this.rowIndex(this._substring(n,t+1,n.length-t-1)),!(!(i==-1)||u==-1)==(i==-1||!(u==-1)))throw this.getErrorStrings()[5].toString();f=this.colIndex(n.substring(0,t));o=this.colIndex(this._substring(n,t+1,n.length-t-1));i>u&&(t=u,u=i,i=t);f>o&&(t=o,o=f,f=t);var w=(u-i+1)*(o-f+1),v=[],p=0;for(t=i;t<=u;++t)for(r=f;r<=o;++r)try{v[p++]=c+RangeInfo.getAlphaLabel(r)+t.toString()}catch(b){continue}return v};this.getFormulaRowCol=function(n,t,i){var f=CalcEngine.getSheetFamilyItem(n),r=RangeInfo.getAlphaLabel(i)+t.toString(),e,o,u;return(f.sheetNameToParentObject!=null&&(e=f.parentObjectToToken.getItem(n),r=e+r),this.getFormulaInfoTable().containsKey(r))?(o=this.getFormulaInfoTable.getItem(r),u=o.getFormulaText(),this.getFormulaText(u),u):""};this.getFormulaText=function(n){var t=new FormulaParsing(n);return t.getText()};this.getSheetID=function(n){var i=CalcEngine.getSheetFamilyItem(n),t,r;return i.sheetNameToParentObject!=null&&i.sheetNameToParentObject.length>0&&(t=i.parentObjectToToken.getItem(n),t=t.split("!").join(""),r=this._parseDouble(t),!isNaN(r))?r:-1};this.getStringArray=function(n){for(var f,r=[],i=0,u=!1,t=0;t1&&n.substring(0,2)=="ub")return(n=n.split("{").join("("),n=n.split("}").join(")"),f=n.substring(1),f=this.computedValue(f),u=this._parseDouble(f),!isNaN(u))?(u=-u,u.toString()):this.computedValue(n);if(n.indexOf("unu")==0?n="n"+n.substring(3):n.indexOf("un")==0&&(n="-"+n.substring(2)),n=n.split("u").join("-"),!this._isUpperChar(n[0])&&(this._isDigit(n[0])||n[0]==this.getParseDecimalSeparator()||n[0]=="-"||n[0]=="n"))if(n[0]=="n"&&(n=n.substring(1)),r=this._parseDouble(n),isNaN(r)){if(n.indexOf(this.trueValueStr)==0||n.indexOf(this.falseValueStr)==0)return n}else return this._preserveLeadingZeros?n:r.toString();if(this._ignoreCellValue&&!(n.indexOf(this.trueValueStr)==0||n.indexOf(this.falseValueStr)==0))return this._ignoreCellValue=!1,n;if(s=["+","-","/","*",")",")","{"],this._indexOfAny(n,s)==-1&&this._isUpperChar(n[0])||n[0]==this.sheetToken){if(n!=this.trueValueStr&&n!=this.falseValueStr&&this._isCellReference(n)&&(o=CalcEngine.getSheetFamilyItem(this.grid),o.sheetNameToParentObject!=null&&n.indexOf(this.sheetToken)==-1&&(h=o.parentObjectToToken.getItem(this.grid),n=h+n)),n==this.cell){e=this.getDependentCells().getItem(n);e!=null&&e.indexOf(n)>-1&&this._arrayRemove(e,n);this.getDependentFormulaCells().containsKey(this.cell)||this.clearFormulaDependentCells(this.cell);throw this.formulaErrorStrings[this._circular_reference_]+n;}return(t=this.getValueFromParentObjectCell(n),i=this._isDate(t),t=t.toString(),n!=this.trueValueStr&&n!=this.falseValueStr&&(r=this._parseDouble(t.split(this.tic).join("")),!this._preserveLeadingZeros&&t.length>0&&!isNaN(r)&&(t=r.toString()),this.updateDependencies(n)),t==this.tic+this.tic)?"NaN":(this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&!isNaN(i)&&isNaN(this._parseDouble(t))&&!isNaN(i.getDate())&&this._dateTime1900<=i&&(t=this._toOADate(i).toString()),t)}return(n=n.split("{").join("("),n=n.split("}").join(")"),n=this._parse(n),r=this._parseDouble(n.substring(0,n.length-1)),n.indexOf("%")!=n.length-1||isNaN(r)||(n=(Number(r)/100).toString()),this.getErrorStrings().indexOf(n)>-1)?n:this.computedValue(n)};this.getValueFromParentObjectCell=function(n){var t,e,s;if(n==this.trueValueStr||n==this.falseValueStr)return n;var r=n.lastIndexOf(this.sheetToken),u=0,f=0,o=this.grid,i=CalcEngine.getSheetFamilyItem(this.grid);if(r>-1&&i.tokenToParentObject!=null)this.grid=i.tokenToParentObject.getItem(n.substring(0,r+1)),u=this.rowIndex(n),f=this.colIndex(n);else if(r==-1){for(t=0;t0){if(this._circCheckList.indexOf(this.cell)>-1&&this.computedValueLevel>0)return this.grid=o,this.cell=e,this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().getItem(this.cell).toString();if(this.getIterationValues().containsKey(this.cell)&&this.computedValueLevel>0)return this.getIterationValues.getItem(this.cell).toString()}return s=this._getValueComputeFormulaIfNecessary(u,f,this.grid),this.grid=o,this.cell=e,s};this.getValueFromParentObject=function(n,t,i){var u=CalcEngine.getSheetFamilyItem(n),f=u.parentObjectToToken==null||u.parentObjectToToken.length==0?"":u.parentObjectToToken.getItem(n).toString(),o,s;f=f+RangeInfo.getAlphaLabel(i)+t.toString();o=this.grid;s=this.cell;this.cell=f;this.grid=n;var r=this._getValueComputeFormulaIfNecessary(t,i,n),e=new Date(Date.parse(r)),h=this._parseDouble(r);return this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&isNaN(h)&&!isNaN(e.getDate())&&this._dateTime1900<=e&&(r=this._toOADate(e).toString()),this.grid=o,this.cell=s,r};this.getValueFromParentObjectRowCol=function(n,t){return this._getValueComputeFormulaIfNecessary(n,t,this.grid)};this.handleIteration=function(n,t){return this.getFormulaInfoTable().containsKey(n)?this.getFormulaInfoTable.add(n,t):this.getFormulaInfoTable.add(n,t),this._iterationMaxCount>0&&n==this.cell&&this._handleIterations(t),t.getFormulaValue()};this.handleSheetRanges=function(n,t){for(var r=n.indexOf(this.sheetToken),i=0,o,s,e,u,v,f,y,h,c;r>0;){if(o=this._substring(n,i,r).lastIndexOf(":"),o>-1)if(s=this._substring(n,i+o+1,r-o-1).toUpperCase().split("'").join(""),e=this._isIE8?s.replace(/^\s+|\s+$/g,""):s.trim(),t.sheetNameToToken.containsKey(e)){if(u=i+o-1,this._sortedSheetNames.contains(s))u=u-s.length-1;else while(u>0&&this._markers.indexOf(n[u])==-1)u--;if(v=this._substring(n,u+1,o-u+i-1).toUpperCase().split("'").join(""),e=this._isIE8?v.replace(/^\s+|\s+$/g,""):v.trim(),t.sheetNameToToken.containsKey(e)){if(f=r+i+1,this._sortedSheetNames.contains(e))f=n.length-1;else while(fb&&p0&&(h+=this.getParseArgumentSeparator()),h+=c+String.fromCharCode(131)+w)}n=n.substring(0,u+1)+h+n.substring(f);i=n.length-f}else i=r+i}else i=r+i;else i=r+i;r=n.substring(i+1).indexOf(this.sheetToken)+1}return n.split(String.fromCharCode(131)).join(this.sheetToken)};this.isSheetMember=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n==null||n==undefined?!1:n.isSheetMember};this.parseAndComputeFormula=function(n){var i=n,r,t,u,f;for(i.length>0&&i[0]==this.getFormulaCharacter()&&(i=i.substring(1)),i.length>0&&i[0]=="+"&&(i=i.substring(1)),i.length>1&&i[0]==","&&i[1]>="0"&&i[1]<="9"&&(i="0,"+i.substring(1)),r=i.split(" ").join(""),t=r.indexOf("(");t!=-1&&t0){if(this._isDigit(r[t-1])&&!this._checkHasCharBeforeNumber(r.substring(0,t)))throw this.formulaErrorStrings[this._bad_formula]+" "+r.substring(0,t+1);if(u=r.substring(t+1).indexOf("("),u==-1)break;else t+=u}for(t=r.indexOf(")");t!=-1&&t0&&n[0]==this.getFormulaCharacter()&&(n=n.substring(1)),n.length>0&&n[0]=="+"&&(n=n.substring(1)),this._isRangeOperand=this._supportRangeOperands&&this._isRange(n),this.getCheckDanglingStack()&&n.split(" ").join("").indexOf(this._braceRightNLeft)>-1)return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];var t=this._isIE8?n.replace(/^\s+|\s+$/g,""):n.trim();return this._parse(t)};this.getUpdatedValueCell=function(n){var i,h,c,f,e,u,s;this._inAPull=!0;var l=this.grid,a=this.cell,o=CalcEngine.getSheetFamilyItem(this.grid),t=n.toUpperCase(),r;if((r=t.indexOf(this.sheetToken))==-1&&this.cell!=""&&this.cell!=undefined?(r=this.cell.indexOf(this.sheetToken,1),r>-1&&o.tokenToParentObject!=null&&(t=this.cell.substring(0,r+1)+t,this.grid=o.tokenToParentObject.getItem(this.cell.substring(0,r+1)))):r>0&&o.sheetNameToToken!=null&&o.tokenToParentObject!=null&&(u=o.sheetNameToToken.getItem(t.substring(0,r)),t=u+t.substring(r+1),this.grid=o.tokenToParentObject.getItem(u),this.cell=t),this.updateCalcID(),this.getDependentFormulaCells().containsKey(t)||this.getFormulaInfoTable().containsKey(t))this._processedCells.clear(),this.updateDependenciesAndCell(t),this._processedCells.clear(),i=this.getValueFromParentObject(t);else{for(i=this.getValueFromParentObjectCell(t);this._breakedFormulaCells.length==1;)this.updateCalcID(),i=this.getValueFromParentObjectCell(this._breakedFormulaCells[0].toString()),this._breakedFormulaCells.removeAt(0),this.setUseFormulaValues(!0);if(this.getUseFormulaValues()&&(this.isUseFormulaValueChanged=!0,this.setUseFormulaValue(!1)),this._tempBreakedFormulaCells.length>0){for(h=1;h<=this._tempBreakedFormulaCells.length;h++)i=this.getValueFromParentObjectCell(this._tempBreakedFormulaCells[this._tempBreakedFormulaCells.length-h].toString());this._tempBreakedFormulaCells.length=0;i=this.getValueFromParentObjectCell(t)}this.setUseFormulaValues(this.isUseFormulaValueChanged);c=this.ignoreValueChanged;this.ignoreValueChanged=!0;f=this.rowIndex(t);e=this.colIndex(t);this.getPreserveFormula()?(u=this._sheetToken(n),u==""?(u="!"+this.getSheetID(this.grid)+"!",s=this.getFormulaInfoTable().getItem(u+t),s!=null&&s!=undefined&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,s.getFormulaText(),f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,s.getFormulaText(),f,e))):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e)):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e);this.ignoreValueChanged=c}return this.grid=l,this.cell=a,this._inAPull=!1,i};this.getUpdatedValueRowCol=function(n,t,i){var o=this.grid,s=CalcEngine.getSheetFamilyItem(this.grid),f=this.sheetToken+n.toString()+this.sheetToken,r,u,e;this.grid=s.tokenToParentObject.getItem(f);this._inAPull=!0;r=f+RangeInfo.getAlphaLabel(i)+t.toString();this.updateCalcID();this.getDependentFormulaCells().containsKey(r)||this.formulaInfoTable.containsKey(r)?(this._processedCells.clear(),this.updateDependenciesAndCell(r),this._processedCells.clear()):(u=this.getValueFromParentObjectCell(r),e=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,u,t,i):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,u,t,i),this.ignoreValueChanged=e);this.grid=o;this._inAPull=!1};this.setTokensForSheets=function(n){var f=CalcEngine.getSheetFamilyItem(this.grid),t,i,u,r;if(this.getSupportsSheetRanges()&&(n=this.handleSheetRanges(n,f)),t=this.getSortedSheetNames(),t!=null)for(i=0;i0&&(this.grid=l.tokenToParentObject.getItem(u));try{var o=this.rowIndex(t),s=this.colIndex(t),i=this.getFormulaInfoTable().getItem(t);i!=null&&(h=this.cell,this.cell=t,(this.getAlwaysComputeDuringRefresh()||i.calcID!=this._calcID||i.getFormulaValue()=="")&&i.setFormulaValue(this.computeFormula(i.getParsedFormula())),i.calcID=this._calcID,this.cell=h,c=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i.getFormulaValue(),o,s):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i.getFormulaValue(),o,s),this.ignoreValueChanged=c,this._refreshedCells.containsKey(t)||(this._refreshedCells.add(t,0),this.refresh(t)))}catch(v){continue}this.grid=e}this._lockDependencies=a}finally{this._refreshedCells.containsKey(n)||this._refreshedCells.add(n,0);this._dependencyLevel--;this._dependencyLevel==0&&this._refreshedCells.clear()}}};this.refreshRange=function(n){for(var i,r,u,f,t=n.getTop();t<=n.getBottom();t++)for(i=n.getLeft();i<=n.getRight();i++)r=RangeInfo.getAlphaLabel(i)+t.toString(),this._dependencyLevel=0,u=CalcEngine.getSheetFamilyItem(this.grid),f=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken,u.tokenToParentObject!=null&&u.tokenToParentObject.contains(f)&&(this.grid=u.tokenToParentObject.getItem(f)),r=f+r,this.refresh(r)};this.registerGridAsSheet=function(n,t,i){var r,f,u;return CalcEngine.modelToSheetID!=null,CalcEngine.modelToSheetID==null&&(CalcEngine.modelToSheetID=new HashTable),(CalcEngine.modelToSheetID.getItem(t)==null||CalcEngine.modelToSheetID.getItem(t)==undefined)&&CalcEngine.modelToSheetID.add(t,i),r=CalcEngine.getSheetFamilyItem(t),r.isSheetMember=!0,f=n.toUpperCase(),r.sheetNameToParentObject==null&&(r.sheetNameToParentObject=new HashTable),r.tokenToParentObject==null&&(r.tokenToParentObject=new HashTable),r.sheetNameToToken==null&&(r.sheetNameToToken=new HashTable),r.parentObjectToToken==null&&(r.parentObjectToToken=new HashTable),r.sheetNameToParentObject.getItem(f)!=undefined?(u=r.sheetNameToToken.getItem(f),r.tokenToParentObject.add(u,t),r.parentObjectToToken.add(t,u)):(u=this.sheetToken+CalcEngine._tokenCount.toString()+this.sheetToken,CalcEngine._tokenCount++,r.tokenToParentObject.add(u,t),r.sheetNameToToken.add(f,u),r.sheetNameToParentObject.add(f,t),r.parentObjectToToken.add(t,u),this.sortedSheetNames=null),n};this.renameSheet=function(n,t){var i=CalcEngine.getSheetFamilyItem(t),r="",u;if(n.includes("/")||n.includes("?")||n.includes("*")||n.includes("[")||n.includes("]")||n.includes(":")||n.includes("\\"))throw"The name does not contain any of following characters: / ? * [ ] : \\";r=t.toString();r=r.toUpperCase();currentSheetName=n.toUpperCase();u=i.sheetNameToToken.getItem(r);CalcEngine.modelToSheetID.containsKey(t)&&(CalcEngine.modelToSheetID.remove(t),CalcEngine.modelToSheetID.add(n,this._calcID));i.sheetNameToParentObject.containsKey(r)&&(i.sheetNameToParentObject.remove(r),i.sheetNameToParentObject.add(currentSheetName,n));i.tokenToParentObject.containsKey(u)&&(i.tokenToParentObject.remove(u),i.tokenToParentObject.add(u,n));i.sheetNameToToken.containsKey(r)&&(i.sheetNameToToken.remove(r),i.sheetNameToToken.add(currentSheetName,u));i.parentObjectToToken.containsKey(r)&&(i.parentObjectToToken.remove(r),i.parentObjectToToken.add(n,u))};this.removeFunction=function(n){return(this._customlibraryFunctions.getItem(n)!=undefined&&this._customlibraryFunctions.remove(n),this._libraryFunctions.getItem(n)!=null)?(this._libraryFunctions.remove(n),!0):!1};this.removeNamedRange=function(n){return(n=n.toUpperCase(),this.getNamedRanges().getItem(n)!=null)?(this.getNamedRanges().remove(n),this._populateNamedRangesNonScoped(),!0):!1};this.rowIndex=function(n){var t=0,i,r=!1;if(t1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(this._substring(n,1,n.length-2).indexOf(this.tic)==-1?n=this._substring(n,1,n.length-2):this._multiTick&&(n=this._substring(n,1,n.length-2))),n};this.updateCalcID=function(){this._calcID++;this._calcID==Number.MAX_SAFE_INTEGER&&(this._calcID=Number.MIN_SAFE_INTEGER+1)};this.updateDependencies=function(n){var s,t,c,h,u,e,o,i,f,r;if(!this._lockDependencies&&this.getUseDependencies())if(s=CalcEngine.getSheetFamilyItem(this.grid),t=this.cell,s.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(c=s.parentObjectToToken.getItem(this.grid),t=c+t),s.sheetNameToParentObject!=null&&n.indexOf(this.sheetToken)==-1&&(c=s.parentObjectToToken.getItem(this.grid),n=c+n),this.getDependentCells().containsKey(n)){if(u=this.getDependentCells().getItem(n),u.indexOf(t)==-1&&u.push(t),this._addToFormulaDependentCells(n),this.getDependentFormulaCells().containsKey(n)&&(e=this.getDependentFormulaCells().getItem(n),e!=null))for(o=e.keys(),i=0;i0&&(this.grid=y.tokenToParentObject.getItem(h)),this.formulaInfoTable.containsKey(n)){if(t=this.formulaInfoTable[n],t.calcID!=this._calcID){if(c=this.cell,this.cell=n,this._iterationMaxCount>0&&this._circCheckList.indexOf(this.cell)>-1?this._handleIterations(t):t.setFormulaValue(this.computeFormula(t.getParsedFormula())),this.getDependentCells().containsKey(n))for(o=this.getDependentCells().getItem(n),u=0;u0&&(h=e.parentObjectToToken.getItem(f),r=h+r),t.getValue().length>0&&t.getValue()[0]==this.getFormulaCharacter()){if(this.cell=r,u=!0,this.getFormulaInfoTable().containsKey(r)){if(i=this.getFormulaInfoTable().getItem(r),t.getValue()!=i.getFormulaText()||i.getParsedFormula()==null){i.setFormulaText(t.getValue());this.getDependentFormulaCells().containsKey(this.cell)&&this.clearFormulaDependentCells(this.cell);try{i.setParsedFormula(this.parseFormula(t.getValue()))}catch(c){i.setFormulaValue(c);u=!1}}u&&(o=this.computeFormula(i.getParsedFormula()),s=o!=i.getFormulaValue()||this.getForceRefreshCall(),i.setFormulaValue(o));i.calcID=this._calcID}else{i=new FormulaInfo;i.setFormulaText(t.getValue());this.getDependentFormulaCells().containsKey(r)||this.getDependentFormulaCells().add(r,new HashTable);try{i.setParsedFormula(this.parseFormula(t.getValue()))}catch(c){i.setFormulaValue(c);u=!1}u&&(i.setFormulaValue(this.computeFormula(i.getParsedFormula())),this.computeIsFormula(i).toString()!="#NAME?"||this.getNamedRanges().containsKey(i.getFormulaText().split("=")[1].toUpperCase())||this.getUndefinedNamedRanges().add(i.getFormulaText().split("=")[1].toUpperCase()));i.calcID=this._calcID;this.getFormulaInfoTable().containsKey(r)?this.getFormulaInfoTable().add(r,i):this.getFormulaInfoTable().add(r,i)}this._iterationMaxCount>0&&u&&!this._inHandleIterations&&r==this.cell&&this._handleIterations(i);l=this.ignoreValueChanged;this.ignoreValueChanged=!0;this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(f)+1,i.getFormulaValue(),t.getRowIndex(),t.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(f)+1,i.getFormulaValue(),t.getRowIndex(),t.getColIndex());this.ignoreValueChanged=l}else!this._inRecalculateRange&&this.getFormulaInfoTable().containsKey(r)&&(this.getFormulaInfoTable().remove(r),this.getDependentFormulaCells().containsKey(r)&&this.clearFormulaDependentCells(r));s&&this.getDependentCells().containsKey(r)&&(this._dependencyLevel=0,this.refresh(r))}};this.getActiveCell=function(){return this.cell};this.getAllowShortCircuitIFs=function(){return this._allowShortCircuitIFs};this.setAllowShortCircuitIFs=function(n){this._allowShortCircuitIFs=n};this.getAlwaysComputeDuringRefresh=function(){return this._alwaysComputeDuringRefresh};this.setAlwaysComputeDuringRefresh=function(n){this._alwaysComputeDuringRefresh=n};this.getCalculatingSuspended=function(){return this._calculatingSuspended};this.setCalculatingSuspended=function(n){this._calculatingSuspended=n};this.getCheckDanglingStack=function(){return this._checkDanglingStack};this.setCheckDanglingStack=function(n){this._checkDanglingStack=n};this.getCustomLibraryFunctions=function(){return this._customlibraryFunctions};this.getDependentCells=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetDependentCells==null&&(n.sheetDependentCells=new HashTable),n.sheetDependentCells}return this._dependentCells==null&&(this._dependentCells=new HashTable),this._dependentCells};this.getDependentFormulaCells=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetDependentFormulaCells==null&&(n.sheetDependentFormulaCells=new HashTable),n.sheetDependentFormulaCells}return this._dependentFormulaCells==null&&(this._dependentFormulaCells=new HashTable),this._dependentFormulaCells};this.getEnableLookupTableCaching=function(){return this._enableLookupTableCaching};this.setEnableLookupTableCaching=function(n){this._enableLookupTableCaching=n};this.getErrorStrings=function(){return this._errorStrings==null&&(this._errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!"]),this._errorStrings};this.setErrorStrings=function(n){this._errorStrings=n};this.getExcelLikeComputations=function(){return this._excelLikeComputations};this.setExcelLikeComputations=function(n){this._excelLikeComputations=n};this.getForceRefreshCall=function(){return this._forceRefreshCall};this.setForceRefreshCall=function(n){this._forceRefreshCall=n};this.getFormulaCharacter=function(){return CalcEngine._formulaChar=='\0'&&(CalcEngine._formulaChar="="),CalcEngine._formulaChar};this.setFormulaCharacter=function(n){CalcEngine._formulaChar=n};this.getFormulaInfoTable=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetFormulaInfoTable==null&&(n.sheetFormulaInfoTable=new HashTable),n.sheetFormulaInfoTable}return this._formulaInfoTable==null&&(this._formulaInfoTable=new HashTable),this._formulaInfoTable};this.getPreserveLeadingZeros=function(){return this._preserveLeadingZeros};this.setPreserveLeadingZeros=function(n){this._preserveLeadingZeros=n};this.getIterationMaxCount=function(){return this._iterationMaxCount};this.setIterationMaxCount=function(n){this._iterationMaxCount=n;this._iterationMaxCount>0&&this.setThrowCircularException(!0)};this.getIterationMaxTolerance=function(){return this._iterationMaxTolerance};this.setIterationMaxTolerance=function(n){this._iterationMaxTolerance=n};this.getIterationValues=function(){return this._iterationValues==null&&(this._iterationValues=new HashTable),this._iterationValues};this.getLibraryComputationException=function(){return this._libraryComputationException};this.getLibraryFunctions=function(){return this._libraryFunctions};this.getLockDependencies=function(){return this._lockDependencies};this.setLockDependencies=function(n){this._lockDependencies=n};this.getMaximumRecursiveCalls=function(){return this._maximumRecursiveCalls};this.setMaximumRecursiveCalls=function(n){this._maximumRecursiveCalls=n};this.getNamedRanges=function(){return this.namedRanges==null&&(this.namedRanges=new HashTable,this._namedRangesNonScoped=new HashTable),this.namedRanges};this.setNamedRanges=function(n){this.namedRanges=n;this._populateNamedRangesNonScoped()};this.getUndefinedNamedRanges=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.undefinedsheetNamedRnages==null&&(this.undefinedsheetNamedRnages=new HashTable),this.undefinedsheetNamedRnages):(this.undefinednamedRange==null&&(this.undefinednamedRange=new HashTable),this.undefinednamedRange)};this.getNameRangeValues=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.namedRangeValues==null&&(this.namedRangeValues=new HashTable),this.namedRangeValues):(this.rangeValues==null&&(this.rangeValues=new HashTable),this.rangeValues)};this.getNamedRangesOriginalNames=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetNamedRangesOriginalNames==null&&(this.sheetNamedRangesOriginalNames=new HashTable),this.sheetNamedRangesOriginalNames):(this.namedRangesOriginalNames==null&&(this.namedRangesOriginalNames=new HashTable),this.namedRangesOriginalNames)};this.getNamedRangeCellCollection=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetNamedRangeCellCollection==null&&(this.sheetNamedRangeCellCollection=new HashTable),this.sheetNamedRangeCellCollection):(this.namerangecellcollection==null&&(this.namerangecellcollection=new HashTable),this.namerangecellcollection)};this.getDependentNamedRangeCells=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetDependentNamedRangeCells==null&&(this.sheetDependentNamedRangeCells=new HashTable),this.sheetDependentNamedRangeCells):(this.dependentNamedRangeCells==null&&(this.dependentNamedRangeCells=new HashTable),this.dependentNamedRangeCells)};this.getParseArgumentSeparator=function(){this._parseArgumentSeparator=='\0'&&(this._parseArgumentSeparator=",");var n=",";return this._isParseArgumentSeparator||n==this._parseArgumentSeparator||(this._parseArgumentSeparator=n),this._parseArgumentSeparator};this.setParseArgumentSeparator=function(n){this._parseArgumentSeparator=n;this._isParseArgumentSeparator=!0};this.getParseDateTimeSeparator=function(){return this._parseDateTimeSeparator};this.setParseDateTimeSeparator=function(n){this._parseDateTimeSeparator=n};this.getParseDecimalSeparator=function(){this._parseDecimalSeparator=='\0'&&(this._parseDecimalSeparator=".");var n=".";return this._isParseDecimalSeparatorChanged||n==this._parseDecimalSeparator||(this._parseDecimalSeparator=n),this._parseDecimalSeparator};this.setParseDecimalSeparator=function(n){this._parseDecimalSeparator=n;this._parseDecimalSeparator=!0};this.getPreserveFormula=function(){return this._preserveFormula};this.setPreserveFormula=function(n){this._preserveFormula=n};this.getReservedWordOperators=function(){return this._reservedWordOperators==null&&(this._reservedWordOperators=[" or "," and "," xor ","if "," then "," else ","not "]),this._reservedWordOperators};this.setReservedWordOperators=function(n){this._reservedWordOperators=n};this.getRethrowLibraryComputationExceptions=function(){return this._rethrowLibraryComputationExceptions};this.setRethrowLibraryComputationExceptions=function(n){this._rethrowLibraryComputationExceptions=n};this.getRethrowParseExceptions=function(){return this._rethrowExceptions};this.setRethrowParseExceptions=function(n){this._rethrowExceptions=n};this.getRowMaxCount=function(){return this._rowMaxCount};this.setRowMaxCount=function(n){this._rowMaxCount=n};this.getSortedSheetNames=function(){if(this._sortedSheetNames==null){var n=CalcEngine.getSheetFamilyItem(this.grid);n!=null&&n.sheetNameToToken!=null&&(this._sortedSheetNames=n.sheetNameToToken.keys(),this._sortedSheetNames.sort())}return this._sortedSheetNames};this.getSupportLogicalOperators=function(){return this._supportLogicalOperators};this.setSupportLogicalOperators=function(n){this._supportLogicalOperators=n};this.getSupportRangeOperands=function(){return this._supportRangeOperands};this.setSupportRangeOperands=function(n){this._supportRangeOperands=n};this.getSupportsSheetRanges=function(){return this._supportsSheetRanges};this.setSupportsSheetRanges=function(n){this._supportsSheetRanges=n};this.getThrowCircularException=function(){return this._throwCircularException};this.setThrowCircularException=function(n){this._throwCircularException=n};this.getTreatStringsAsZero=function(){return this._treatStringsAsZero};this.setTreatStringsAsZero=function(n){this._treatStringsAsZero=n};this.getUseDatesInCalculations=function(){return this._useDatesInCalcs};this.setUseDatesInCalculations=function(n){this._useDatesInCalcs=n};this.getUseDependencies=function(){return this._useDependencies};this.setUseDependencies=function(n){this._useDependencies=n};this.getUseFormulaValues=function(){return this._useFormulaValues};this.setUseFormulaValues=function(n){this._useFormulaValues=n};this.getUseNoAmpersandQuotes=function(){return this._useNoAmpersandQuotes};this.setUseNoAmpersandQuotes=function(n){this._useNoAmpersandQuotes=n};this.getValidPrecedingChars=function(){return this._validPrecedingChar+this.getParseArgumentSeparator()};this.setValidPrecedingChars=function(n){this._validPrecedingChars=n};this.getEnableFormulaErrorValidation=function(){return this._enableFormulaErrorValidation};this.setEnableFormulaErrorValidation=function(n){this._enableFormulaErrorValidation=n};this.getWeekEndType=function(){return["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"]};this.computeSum=function(n){var e=0,t,f,r,l=this.splitArgsPreservingQuotedCommas(n),s,o,u,i,h,a,c;if(!n||n.length==0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(s)>-1))return s;for(o=0;o-1){if(r.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}for(u=this.getCellsFromArgs(r),i=0;i-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}}catch(v){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(t!=""){if(f=t==this.trueValueStr?!0:t==this.falseValueStr?!1:this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}isNaN(f)?t="":e=e+f}}}else{try{if(r.startsWith(this.tic)&&isNaN(this._parseDouble(r))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=this.getValueFromArg(r).split(this.tic).join(""),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}}catch(v){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(t.length>0){if(f=t==this.trueValueStr?!0:t==this.falseValueStr?!1:this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1)return t;isNaN(f)||(e=e+f)}}return e.toString()};this.computeDate=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,i,o;if(s!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(i=0;i12)u-=12,r++;f=this._getSerialDateFromDate(r,u,h)}if(f==0){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return this._excelLikeComputations&&(o=this._fromOADate(f),o.toString()!="Invalid Date")?o.toLocaleDateString():f.toString()};this.computeDatevalue=function(n){var f=this.splitArgsPreservingQuotedCommas(n),s=f.length,h,i,e,t,u;if(s!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(h)>-1))return h;if(this._isCellReference(n)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=new Date(Date.parse(f[0]));e=this._parseDouble(f[0]);try{if(!isNaN(e)||i.toString()=="Invalid Date")if(e>0)i=this._fromOADate(e);else{var r=n.split(this.getParseDateTimeSeparator()),s=r.length,o="";for(t=0;t59&&(u+=1),Math.round(u).toString()};this.computeDay=function(n){var e=this.splitArgsPreservingQuotedCommas(n),i,t;if(e.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;var r=1,f=this.getValueFromArg(n).split(this.tic).join(""),u=this._parseDouble(f);if(isNaN(u))if(t=new Date(Date.parse(f)),t.toString()!="Invalid Date")r=t.getDate();else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}else{if(u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}t=this._getDateFromSerialDate(u);r=t.getDate()}return r.toString()};this.computeDays=function(n){var l=n,r=this.splitArgsPreservingQuotedCommas(n),u,t,i,o,s,f,e,h,c;if(r.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)?u:(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=t==""||t==null?new Date(Date.parse("1899-12-31")).toDateString():t,i=i==""||i==null?new Date(Date.parse("1899-12-31")).toDateString():i,f=this._parseDouble(t.split(this.tic).join("")),e=this._parseDouble(i.split(this.tic).join("")),o=isNaN(f)?new Date(Date.parse(t)):this._getDateFromSerialDate(f),s=isNaN(e)?new Date(Date.parse(i)):this._getDateFromSerialDate(e),h=s.getTime()-o.getTime(),c=Math.ceil(h/864e5),c.toString())};this.computeDays360=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,s,l,a,y;if(o!=2&&o!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(s)>-1))return s;var v=!1,u=0,i=new Date(Date.parse(this.getValueFromArg(r[0]).split(this.tic).join(""))),t=new Date(Date.parse(this.getValueFromArg(r[1]).split(this.tic).join(""))),h=this.getValueFromArg(r[0]),c=this.getValueFromArg(r[1]),f=h.split(this.tic).join("")=="TRUE"?"1":h.split(this.tic).join("")=="FALSE"?"0":h,e=c.split(this.tic).join("")=="TRUE"?"1":c.split(this.tic).join("")=="FALSE"?"0":c;if(f=this._parseDouble(f.split(this.tic).join("")),e=this._parseDouble(e.split(this.tic).join("")),isNaN(f)&&isNaN(this._isDate(i))||isNaN(e)&&isNaN(this._isDate(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}return i=f>0?this._getDateFromSerialDate(f):i,t=e>0?this._getDateFromSerialDate(e):t,l=!1,a=this.falseValueStr,o==3&&(a=this.getValueFromArg(r[2])),v=a==this.trueValueStr?!0:!1,i.getDate()==31&&(i=new Date(i.setDate(i.getDate()-1))),t.getDate()==31&&!v&&i.getDate()<30?t=new Date(t.setDate(t.getDate()+1)):t.getDate()==31&&(t=new Date(t.setDate(t.getDate()-1))),t-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;var u=this.getValueFromArg(i[0]).split(this.tic).join(""),y=parseInt(u),t=isNaN(u)?new Date(Date.parse(u)):this._fromOADate(parseInt(u)),h=this.getValueFromArg(i[1]).split(this.tic).join(""),c=parseInt(h);if(t.toString()=="Invalid Date"&&isNaN(c))try{var o=new Date(Date.now()),s=this._parseDouble(u),f=parseInt(h);if(f<0&&f-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;var f=this.getValueFromArg(i[0]).split(this.tic).join(""),t=new Date(f),u=this._parseDouble(this.getValueFromArg(i[1]).split(this.TIC).join(""));if(t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(isNaN(u))try{if(c=new Date(Date.now()),e=parseInt(f),u=this._parseDouble(this.getValueFromArg(i[1]).split(this.tic).join("")),u<0&&e<=0&&u9999&&(t=this._fromOADate(o)),t=new Date(t.setMonth(t.getMonth()+u)),s=new Date(t.getFullYear(),t.getMonth()+1,1,-1).getDate(),t=new Date(t.getFullYear(),t.getMonth(),s),this.getExcelLikeComputations()?t.toLocaleDateString():this._getSerialDateTimeFromDate(t).toString()};this.computeHour=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t,i,r,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=new Date(Date.now()),this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n=="TRUE"?"1":n=="FALSE"?"0":n,t=new Date(Date.parse(n)),r=parseInt(n),r<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(u=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(u))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getHours().toString()};this.computeISOWeeknum=function(n){var i=this.splitArgsPreservingQuotedCommas(n),c=i.length,u,r,t,o,s,h;if(c!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1))return u;if(r=this.getValueFromArg(i[0]),r[0]==this.tic&&this._isTextEmpty(r.split(this.tic).join(""))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}this._isTextEmpty(r)&&(n=this.computeDatevalue(new Date(1990,12,28).toLocaleDateString()));(n.indexOf(":")>-1||!this._isCellReference(this.getValueFromArg(i[0]))&&this.getValueFromArg(this.DateFormatter(i[0])).indexOf(":")>-1)&&(n="0");t=this.getValueFromArg(i[0]).split(this.tic).join("");t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;var l=new Date(t),e=this.DateFormatter(t),f=new Date(Date.parse(e)),a=this.dateTime1900;if(f.toString()=="Invalid Date")try{o=parseInt(e);f=this.fromOADate(o);t=f.toLocaleDateString()}catch(v){if(this.getRethrowLibraryComputationExceptions())throw"Bad Cell reference";return this.getErrorStrings()[1].toString()}return s=t+this.getParseArgumentSeparator()+"21",h=parseInt(this.computeWeeknum(s)),h.toString()};this.DateFormatter=function(n){var r=new Date(n),t=r.getDate(),i=r.getMonth()+1,u=r.getFullYear(),n;return t<10&&(t=+t),i<10&&(i=i),i+"/"+t+"/"+u};this.computeMinute=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,t,r;if(u.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(t=new Date(Date.now()),n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=new Date(Date.parse(n)),n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(r=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(r))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getMinutes().toString()};this.computeMonth=function(n){var r=1,o=this.splitArgsPreservingQuotedCommas(n),f,i,t,e,u;if(o.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(f)>-1))return f;if(i=this.getValueFromArg(n),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=new Date(Date.parse(i.split(this.tic).join(""))),e=parseInt(i),!isNaN(e)&&t.getFullYear()>9999&&(t=this._fromOADate(e)),i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(n=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(n))),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(t.toString()!="Invalid Date")r=t.getMonth()+1;else{if(u=this._parseDouble(this.getValueFromArg(n)),isNaN(u))return this.formulaErrorStrings[this._invalid_arguments];u<1?r=1:(t=this._getDateFromSerialDate(u),r=t.getMonth()+1)}return r.toString()};this.computeNetworkDays=function(n){var h=this.splitArgsPreservingQuotedCommas(n),y=h.length,c,f,t,e=[],p,o,s,u,k,l,w,a,rt;if(y!=2&&y!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(p=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(p)>-1))return p;if(o=this.getValueFromArg(h[0]).split(this.tic).join(""),s=this.getValueFromArg(h[1]).split(this.tic).join(""),o==""||s==""){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}var i=new Date(Date.parse(o)),r=new Date(Date.parse(s)),u=this._parseDouble(o);if(!isNaN(u)&&i.getFullYear()>9999&&(i=this._fromOADate(u)),i.toString()=="Invalid Date"&&(i=this._fromOADate(u)),i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(u=this._parseDouble(s),!isNaN(u)&&r.getFullYear()>9999&&(r=this._fromOADate(u)),r.toString()=="Invalid Date"&&(r=this._fromOADate(u)),r.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(y==3)if(c=h[2],c.indexOf(":")>-1)for(k=this.getCellsFromArgs(c),l=0;li&&t0&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&e.indexOf(t)==-1&&t>i&&t4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(c=0;c-1))return e;if(u>=3&&(e=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e}if(l=this.getValueFromArg(i[0]).split(this.tic).join(""),a=this.getValueFromArg(i[1]).split(this.tic).join(""),l==""||a==""){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(o=new Date(Date.parse(this._fromOADate(l))),v=new Date(Date.parse(this._fromOADate(a))),o.toString()=="Invalid Date"){if(s=this._parseDouble(l),isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}o=this.fromOADate(s)}if(v.toString()=="Invalid Date"){if(s=this._parseDouble(a),isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}v=this._fromOADate(s)}if(u==4)if(r=i[3],r=this.adjustRangeArg(r),r.indexOf(":")>-1||r.indexOf(",")>-1)for(b=this.getCellsFromArgs(r),w=0;wo&&t>v&&t.getDay()!=0&&t.getDay()!=6&&h.push(t))}else{try{f=this.getValueFromArg(r).split(this.tic).join("")}catch(d){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return d}f.length>0&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&h.indexOf(t)==-1&&t>o&&t2&&!isNaN(y)){if(isNaN(i[2])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}y=parseInt(i[2])}else y=1;for(var it=this._splitArguments(this.getWeekEndType()[y].toString(),","),g=parseInt(this.computeDatevalue(a))-parseInt(this.computeDatevalue(l))+1,k=g,nt=1,p=o;nt=0?k--:h.indexOf(p)>=0&&k--,p=new Date(p.setDate(p.getDate()+1)),nt++;return k.toString()};this.computeNow=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return new Date(Date.now()).toString()};this.computeSecond=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,t,r;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(t=new Date(Date.now()),n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=new Date(Date.parse(n)),n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(r=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(r))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getSeconds().toString()};this.computeTime=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,r,o;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;t[0]=this.getValueFromArg(t[0]);t[1]=this.getValueFromArg(t[1]);t[2]=this.getValueFromArg(t[2]);t[0]=t[0]==""?"0":t[0];t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0];t[1]=t[1]==""?"0":t[1];t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1];t[2]=t[2]==""?"0":t[2];t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2];var u=this._parseDouble(t[0]),f=this._parseDouble(t[1]),e=this._parseDouble(t[2]),i=0;if(isNaN(u)||isNaN(f)||isNaN(e)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(i=(3600*u+60*f+e)/86400,o=new Date(Date.now()).toLocaleDateString()+" "+i,dt=new Date(Date.parse(o)),i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}return i.toString()};this.computeTimevalue=function(n){var u=this.splitArgsPreservingQuotedCommas(n),o=u.length,r,f,t,i,e;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]).split(this.tic).join(""),t=t.split(this.tic).join(""),t.indexOf(":")>-1&&(f=new Date,t=f.toLocaleDateString()+" "+t),i=new Date(Date.parse(t)),i.toString()=="Invalid Date"&&(n=new Date(Date.now()).toLocaleDateString()+" "+n,i=new Date(Date.parse(n))),i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return e=(3600*i.getHours()+60*i.getMinutes()+i.getSeconds())/86400,e.toString()};this.computeToday=function(n){if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var t=new Date(Date.now());return this.getExcelLikeComputations()?t.toLocaleDateString():this._toOADate(t).toString()};this.computeWeekday=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,o,s,i,r,f,h,u;if(e!=1&&e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(o)>-1)?o:t.length==2&&this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)?s:(i=this.getValueFromArg(t[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,r=new Date(Date.parse(i.split(this.tic).join(""))),f=parseInt(i),!isNaN(f)&&r.getFullYear()>9999&&(r=this._fromOADate(f)),t[1]=e==2?t[1]:"1",r.toString()=="Invalid Date"&&(r=this._fromOADate(f)),h=parseInt(this.getValueFromArg(t[1])),u=r.getDay(),h==1?u+=1:(u==0&&(u=7),h==3&&(u-=1)),u.toString())};this.computeWeeknum=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,r,u,h,i;if(e>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((r=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(r)>-1)||e==2&&(r=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;if(t[0]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}u=this._fromOADate(this.DateFormatter(this.getValueFromArg(t[0]).split(this.tic).join("")))=="Invalid Date"?this.getValueFromArg(t[0]).split(this.tic).join(""):this.DateFormatter(this.getValueFromArg(t[0]).split(this.tic).join(""));var p=parseInt(u),w=new Date(u),o=new Date(Date.parse(u));if(o.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(h=["","0","1","","","","","","","","","1","2","3","4","5","6","0","","","","1"],e!=2?i=1:(i=this.getValueFromArg(t[1]),i==""&&(i=1)),Boolean(i=="TRUE"||i=="FALSE")){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}!isNaN(i);var f=parseInt(h[i]),c=new Date(o.getFullYear(),0,1),s=c.getDate(),l=s3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(r=0;r-1))return i;if(i=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)return i}if(t[0]==""||t[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(o="",s=0,o=f==3?t[0]+this.getParseArgumentSeparator()+t[1]+this.getParseArgumentSeparator()+"1"+this.getParseArgumentSeparator()+t[2]:t[0]+this.getParseArgumentSeparator()+t[1]+this.getParseArgumentSeparator()+"1",u=this.computeWorkDayOintl(o),e=new Date(Date.parse(this._fromOADate(u).toString())),isNaN(Date.parse(u))&&parseInt(u)&&(e=this._fromOADate(u)),e.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return this._toOADate(e).toString()};this.computeWorkDayOintl=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,u,a,b,v,i,l,p;if(o>4||o<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t[0]==""||t[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)||(u=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)||o>=3&&(u=this.formulaErrorStringCheck(t[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)||o==4&&(u=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)))return u;var e,f,s=[],c=this.getValueFromArg(t[0]).split(this.tic).join(""),h=new Date(Date.parse(c)),w=this.getValueFromArg(t[1]).split(this.tic).join(""),d;if(!isNaN(Date.parse(c))&&parseInt(c)&&(h=this._fromOADate(c)),isNaN(w)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(d=this._toOADate(h)+w,c.split(this.tic).join("")==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if(h.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(a=parseInt(w.toString()),o==4)if(e=t[3],e=this.adjustRangeArg(e),e.indexOf(":")>-1||e.indexOf(",")>-1)for(b=this.getCellsFromArgs(e),v=0;vh&&s.push(i.toString()))}else{try{f=this.getValueFromArg(e).split(this.tic).join("")}catch(nt){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}f!=""&&(i=new Date(Date.parse(f)),isNaN(Date.parse(f))&&parseInt(f)&&(i=this._fromOADate(f)),i.toString()!="Invalid Date"&&s.indexOf(i)==-1&&i>h&&s.push(i))}if(l=parseInt(t[2]),o>2&&!isNaN(l)||(l=1),l==0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}var k=this._splitArguments(_weekEndType[l].toString(),","),y=0,r=h;if(a<0)while(y>a)r=new Date(r.setDate(r.getDate()-1)),p=r.getDay(),k.indexOf(p.toString())<0&&s.indexOf(r)<0&&y--;else while(y-1))return u;if(t=this.getValueFromArg(f[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=new Date(Date.parse(t)),r=parseInt(t),!isNaN(r)&&i.getFullYear()>9999&&(i=this._fromOADate(r)),r==0)return"1900";if(r<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}if(t.split(this.tic).join("")==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if(i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return i.getFullYear().toString()};this.computeChar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,r,t,i;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),!isNaN(i)&&i>0&&i<256)return String.fromCharCode(t);if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()};this.computeCode=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e=i.length,r,t,u,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]).split(this.tic).join(""),u=parseInt(t),!isNaN(u))return t.charCodeAt(0).toString();if(t==null||t==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return i[0].length>4?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return f=t,f.charCodeAt(0).toString()};this.computeUniCode=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,r,t,e,u;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),this._isCellReference(i[0])){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(e=this._parseDouble(t),t=="invalid expression"||t==null||t==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return u=t.split(this.tic).join("").charCodeAt(0),u.toString()};this.computeUpper=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(t)>-1)?t:this._stripTics0(this.getValueFromArg(n)).toUpperCase()};this.computeLower=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(t)>-1)?t:this._stripTics0(this.getValueFromArg(n)).toLowerCase()};this.computeLen=function(n){var r=this.splitArgsPreservingQuotedCommas(n),e=r.length,i,t,u,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1)?i:(t=this._stripTics0(this.getValueFromArg(r[0])),isNaN(parseInt(t))&&(u=new Date(Date.parse(t)),u!="Invalid Date"&&(t=this.DateFormatter(t))),f=t[0]==this.tic&&t[t.length-1]==this.tic,(f?t.length-2:t.length).toString())};this.computeMid=function(n){var i=this.splitArgsPreservingQuotedCommas(n),s=i.length,r,t,u;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((r=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;t=i[0];t=this.getValueFromArg(t);var f=t[0]==this.tic&&t[t.length-1]==this.tic,e=this.getValueFromArg(i[1]),o=this._parseDouble(i[2]);if(e=this.getValueFromArg(i[1]),u=Number(e)+Number(f?0:-1),e==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return i[1].indexOf("#VALUE!")>-1?"#VALUE!":Number(u)>t.length?"":(t=u+o>t.length?t.substring(u):this._substring(t,u,o),f&&t[0]!=this.tic&&(t=this.tic+t),f&&t&&(t=t+this.tic),this._stripTics0(t))};this.computeLeft=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,e,t,o,r,i;if(f!=1&&f!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this._stripTics0(this.getValueFromArg(u[0])),!this._isCellReference(u[0])&&u[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return(o=t[0]==this.tic&&t[t.length-1]==this.tic,r=f==2?u[1]:"1",r=this.computedValue(r),r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,i=Number(r)+Number(o?1:0),i=t.length>=i?i:t.length,i=t.length>=i?i:t.length,i<0)?this.getErrorStrings()[1].toString():(i==0?t="":(t=t.substring(0,i),o&&t[t.length-1]!=this.tic&&(t=t+this.tic)),this.getUseNoAmpersandQuotes()&&t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]&&(t=this._substring(t,1,t.length-2)),t)};this.computeRight=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,f,e,t,i,o;if(u!=1&&u!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(f)>-1))return f;if(s1=this._stripTics0(this.getValueFromArg(r[0])),!this._isCellReference(r[0])&&r[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return(e=s1[0]==this.tic&&s1[s1.length-1]==this.tic,t=u==2?this.getValueFromArg(r[1]):"1",t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=parseInt(t),isNaN(i)||i<0||t.indexOf("#VALUE!")>-1)?"#VALUE!":i==0?"":(i=Number(t)+Number(e?1:0),o=s1.length>=i?s1.length-i:0,s1=s1.substring(o),e&&s1[0]!=this.tic&&(s1=this.tic+s1),s1)};this.computeReplace=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,s,h,i,o;if(c!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1)return s;if(h=this.formulaErrorStringCheck(r[3],FormulaArgumentType.Text),this.getErrorStrings().indexOf(h)>-1)return h}var u=this._stripTics0(this.getValueFromArg(r[0])),f=this._stripTics0(this.getValueFromArg(r[3])),e="",t=this.getValueFromArg(r[1]);if(t=t=="TRUE"?"1":t=="FALSE"?"0":t,t=this._parseDouble(t),i=this.getValueFromArg(r[2]),i=i=="TRUE"?"1":i=="FALSE"?"0":i,i=this._parseDouble(i),!this._isCellReference(r[0])&&r[0][0]!=this.tic||!this._isCellReference(r[3])&&r[3][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(t==0&&i==0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();if(isNaN(t)||isNaN(i))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();else try{if(o="",u==null||u=="")return f;u.length<=t&&t>i?e=u+f:u.length<=t?(o=u,e=u.split(o).join(f)):i==0?e=f+u:(o=this._substring(u,t-1,i),e=u.split(o).join(f))}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString()}return e};this.computeExact=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u,t,i,f,e;if(r.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)?u:(t=this.getValueFromArg(r[0]),i=this.getValueFromArg(r[1]),f=this._parseDouble(t),e=this._parseDouble(i),isNaN(f)||(t=f.toString()),isNaN(e)||(i=e.toString()),t.split(this.tic).join("")==i.split(this.tic).join("")?"TRUE":"FALSE")};this.computeFind=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r,e,u;if(t.length!=2&&t.length!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.TwoTextWithNumber),this.getErrorStrings().indexOf(r)>-1))return r;var o=this._stripTics0(this.getValueFromArg(t[0])),f=this._stripTics0(this.getValueFromArg(t[1])),i=1;return(t.length==3&&(e=this.getValueFromArg(t[2]),i=this._parseDouble(e),isNaN(i)&&(i=1)),i<=0||i>f.length)?"#VALUE!":(u=f.indexOf(o,i-1),u<0)?"#VALUE!":(Number(u)+Number(1)).toString()};this.computeSearch=function(n){var u=this.splitArgsPreservingQuotedCommas(n),s=u.length,o,e=1,h,t,r,i,c,f;if(s!=2&&s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.TwoTextWithNumber),this.getErrorStrings().indexOf(h)>-1))return h;if(t=this._stripTics0(this.getValueFromArg(u[0])).toUpperCase(),r=this._stripTics0(this.getValueFromArg(u[1])).toUpperCase(),!this._isCellReference(u[0])&&u[0][0]!=this.tic||!this._isCellReference(u[1])&&u[1][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(i=t,t.indexOf("*")>-1)t=t.split("*").join("")[0].toString();else if(t.indexOf("?")>-1){for(c=i.substring(0,i.indexOf("?")),f=Number(r.indexOf(c));r.indexOf(i)==-1;)for(f=Number(r.substring(f).indexOf(c))+Number(f)+1,i=t;i.indexOf("?")!=-1;){if(r.length<=f)return this.getErrorStrings()[1].toString();i=i.substring(0,i.indexOf("?"))+r[f]+t.substring(i.indexOf("?")+1);f++}t=i}if(o=Number(r.indexOf(t))+1,s==3){if(e=parseInt(this.getValueFromArg(u[2])),e==1&&t[0]==r[0])return e;if(!isNaN(e))try{o=Number(r.indexOf(t,e))+1}catch(l){return this.getErrorStrings()[1].toString()}}return o==0?this.getErrorStrings()[1].toString():o.toString()};this.computeSubstitute=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e,r,c,s,o,f;if(t.length!=3&&t.length!=4){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation())for(e=0;e<3;e++)if(r=this.formulaErrorStringCheck(t[e],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)return r;if(t.length==4&&this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;var i=this._stripTics0(this.getValueFromArg(t[0])),u=this._stripTics0(this.getValueFromArg(t[1])),h=this._stripTics0(this.getValueFromArg(t[2]));if(t.length==3){if(u==""||u==null)return i;i=i.split(u).join(h)}else{if(c=this.getValueFromArg(t[3]),!this._isCellReference(t[3])&&t[3][0]==this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(s=parseInt(c),!isNaN(s)){for(o=s,f=-1;o>0&&(f=i.indexOf(u,Number(f)+1))>-1;)o--;o==0&&(i=i.substring(0,f)+h+i.substring(Number(f)+Number(u.length)))}}return i};this.computeUniChar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,i,t,r,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(u[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(this._stripTics0(t)),isNaN(r)||r<=0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t[0]==this.tic?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return f=String.fromCharCode(t),f.toString()};this.computeClean=function(n){var f=this.splitArgsPreservingQuotedCommas(n),r,i,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments].toString()}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;var t=this.getValueFromArg(f[0]),e=t=="TRUE"||t=="FALSE"?!0:!1;if(this.getErrorStrings().indexOf(t)>-1)return t;if(t.indexOf(this.tic)==-1&&!this._isCellReference(n)&&isNaN(this._parseDouble(t))&&!e)return this.getErrorStrings()[5].toString();for(i=0;i<=31;i++)u=this.computeChar(i.toString()),t.indexOf(u)>-1&&(t=t.replace(u,""));return t[0]==this.tic&&t[t.length-1]==this.tic&&(t=this._substring(t,1,t.length-1)),t};this.computeTrim=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,t,f,r;if(u.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;for(t=this._stripTics0(this.getValueFromArg(n)),f=[this.tic,""],t=t.split(this.tic).join(""),r=0;t.length!=r;)r=t.length,t=t.split(" ").join(" ");return t};this.computeRept=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,s,u,i,e;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(f)>-1))return f;if(r=this._stripTics0(this.getValueFromArg(t[0])),s=1,t[1]=this.getValueFromArg(t[1].split(this.tic).join("")),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],r==null||r==""||t[1]==null||t[1]=="")return"";if(u=parseInt(t[1].split(this.tic).join("")),u<0||isNaN(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}for(i="",e=0;e32767){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}i=i.concat(r)}return i};this.computeProper=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,u,t,r;if(f!=1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(u=this.getValueFromArg(i[0]),!this._isCellReference(i[0])&&i[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return t=this._stripTics0(u),r=t.indexOf("'"),r>=0&&r64&&i<91);)t++,n[t]!=undefined?i=n[t].toUpperCase().charCodeAt(0):(t--,i=0);return n.substr(0,t)+n.charAt(t).toUpperCase()+n.substr(t+1).toLowerCase()}):/[a - zA - Z0 - 9] + $/.test(t)&&(t=t.replace(/[^a-zA-Z0-9_\\]/,"")),t};this.computeT=function(n){var r=0,u=this.splitArgsPreservingQuotedCommas(n),i,o,f,e;if(u.length>1)for(i=0;i-1)for(--r,o=this.getCellsFromArgs(i),f=0;f1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;var t=this.getValueFromArg(n),s=t=="TRUE"||t=="FALSE"?!0:!1;return isNaN(this._parseDouble(t))&&!s&&isNaN(this._isDate(t))?/[a-zA-Z0-9!#$%&'()*+,/:;<=>?@\^_`{|}~-]/.test(t)?this._stripTics0(t):" ":" "};this.computeNumberValue=function(n){var i=this.splitArgsPreservingQuotedCommas(n),l=i.length,f=this._parseDecimalSeparator,e=this._parseArgumentSeparator,o,t,r,u,s,h,c;if(l>3||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this._stripTics0(this.getValueFromArg(i[0])),l>1)try{if(r=i.length>1&&i[2]!=null?this._stripTics0(this.getValueFromArg(i[1])):e,u=i.length>1&&i[2]!=null?this._stripTics0(this.getValueFromArg(i[2])):f,r=="invalid expression"||u=="invalid expression"||(r==null||r=="")&&(u==null||u=="")){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}f=this._stripTics0(r)[0];e=this._stripTics0(u)[0]}catch(a){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==""||t==null)return"0";if(s=t.indexOf(f),h=t.indexOf(e),h>=s&&(s!=-1||h!=-1)&&i.length>2){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=t.replace(this.tic,""),t=t.replace(" ",""),t=t.replace(e.toString(),""),t=t.replace(f,this._parseDecimalSeparator),c=this.computeValue(t),isNaN(c)||t[t.length-1]=="$"){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return c};this.computeConcatenate=function(n){var i="",r=this.splitArgsPreservingQuotedCommas(n),u,t,f;if(!n||n.length==0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1))return u;for(t=0;t-1&&(i="#N/A"),i};this.computeValue=function(n){var i="",r,h,f,e,o,s;try{if(r=this.splitArgsPreservingQuotedCommas(n),h=r.length,h!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(f)>-1))return f;var t=r[0],u=!1,c=!1;if(t.indexOf(this.tic)>-1&&(u=!0),t=this._stripTics0(this.getValueFromArg(t)),(t!=null||t!="")&&!this._isCellReference(t)&&u&&isNaN(this._parseDouble(t.split(",").join("").split("$").join("")))&&(t=t.split(this.tic).join(""),c=!0),!this._isCellReference(r[0])&&r[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((t==null||t=="")&&u){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if((t==null||t=="")&&!u){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}if(t.indexOf(":")>-1)return i=this.computeTimevalue(t),i.toString();if(t[0]=="$"&&(t=t.split("$").join("")),t.indexOf(",")>-1&&(t=t.split(",").join("")),(t[0]=="%"||t[t.length-1]=="%")&&(t=t.split("%").join(""),e=this._parseDouble(t),isNaN(e)||(t=(e/100).toString())),o=new Date(Date.parse(t)),s=this._parseDouble(t),isNaN(s))if(o.toString()!="Invalid Date")i=this._toOADate(o);else{if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}else i=s.toString()}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return i.toString()};this.computeDollar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),t=u[0],i="2",e,f,o,r,s,h;if(u.length==2&&(i=u[1]),u.length>2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(t),t=t==""||t==null?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(i),i=i==""||i==null?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f=this._parseDouble(t),o=!1,isNaN(this._parseDouble(i))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((t==null||t=="")&&this._isCellReference(u[0])&&t[0]!=this.tic&&t[t.length-1]!=this.tic&&(f=0,o=!0),isNaN(f)&&!o){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return r=this._parseDouble(i),s=0,isNaN(r)&&(r=i==""?0:2),r>0?ej.format(f,"c"+r):(h=Math.pow(10,-r),s=Math.round(f/h)*h,ej.format(s,"c0"))};this.computeFixed=function(n){var f=this.splitArgsPreservingQuotedCommas(n),r=f[0],i="2",t="FALSE",s,h,e,u,c,o,l;if(f.length>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;if(h=f.length,h>1&&(i=f[1]),h>2&&(t=f[2]),r=this.getValueFromArg(r),i=this.getValueFromArg(i),t=this.getValueFromArg(t),r=r==""||r==null?"0":r,i=i==""||i==null?"0":i,t=t==""||t==null?"0":t,e=this._parseDouble(r),u=this._parseDouble(i),isNaN(u)&&(u=2),c=this._parseDouble(t),isNaN(c))if(t.toUpperCase()==this.falseValueStr)o=!1;else if(t.toUpperCase()==this.trueValueStr)o=!0;else return"#NAME?";else o=c==0?!1:!0;return o&&(ej.preferredCulture().numberFormat[","]=""),u>0?ej.format(e,"n"+u):(l=Math.pow(10,-u),e=Math.round(e/l)*l,ej.format(e,"n0"))};this.computeBin2Dec=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t,u;if(r.length>1||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(r[0]).replace(this.tic,""),!/^[01]{1,10}$/.test(t))return this.getErrorStrings()[4].toString();try{return t==""&&(t="0"),u=parseInt(t,2),t.length==10&&t.substring(0,1)=="1"?(parseInt(t.substring(1),2)-512).toString():u.toString()}catch(f){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}};this.computeBin2Oct=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=this.getValueFromArg(i[0]).replace(this.tic,""),t="",s,f,e,o,h,r;if(!/^[01]{1,10}$/.test(u))return this.getErrorStrings()[4].toString();if(i.length>2||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];else i.length>1&&(places=parseInt(this.getValueFromArg(i[1]).replace(this.tic,"")));if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;if(f=i.toString(),f.length==10&&f.substring(0,1)=="1"){for(e=10,o="",h=0;h<3;h++){e=e-3;var l=this._substring(f,e,3),a=this._parseDouble(parseInt(l,2).toString(8)),c=0;for(r=a;r>0;c+=parseInt(r%10),r=parseInt(r/10));o=c.toString()+o}return"7777777"+o}if(u<0)return(1073741824+u).toString(8);if(t=parseInt(u,10).toString(8),typeof places=="undefined")return t;if(isNaN(places))return"#VALUE!";if(places<0)return"#NUM!";if(places=Math.floor(places),places>=t.length&&places<=10)while(places-t.length>0)t="0"+t,places--;else if(this.getRethrowLibraryComputationExceptions())throw(new this.getErrorStrings)[4].toString();return t};this.computeBin2Hex=function(n){var u=0,r=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(r[0]).replace(this.tic,""),i="",f;if(r.length>2||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];else r.length>1&&(u=this._parseDouble(r[1]));if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(t=="1111111111")return t.replace("1","F");if(t.length==10&&t.substring(0,1)=="1")return(1073741312+parseInt(t,2).toString(8)).toString();try{if(t.length>10||this._parseDouble(t)<0||isNaN(t))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(i=parseInt(t,2).toString(16),i=="NaN"&&(i=this.getErrorStrings()[4].toString()),r.length>1)if(u>=i.length&&u<=10)i=this._padLeft("0",u,i);else if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else i=this.getErrorStrings()[4].toString()}catch(e){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else if(this.computeIsText(t)==this.trueValueStr)i=this.getErrorStrings()[5].toString();else return t==""?"0":this.getErrorStrings()[4].toString()}return i.toUpperCase()};this.computeDec2Bin=function(n){var f=0,i=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(i[0]).replace(this.tic,""),r=i.length>1?this.getValueFromArg(i[1]).replace(this.tic,""):"10",u="",e,o;if(n==null||n==""||i.length>2||i.length<1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(isNaN(this._parseDouble(t))&&isNaN(this._parseDouble(r))){if((t!=null||t!="")&&this.computeIsText(t)==this.trueValueStr||(r!=null||r!="")&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t!=null&&t!=""&&this.computeIsText(t)==this.falseValueStr||t!=null&&t!=""&&this.computeIsText(r)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==null&&t==""||r==null||r==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}}try{if(i.length>1&&(o=this.getValueFromArg(i[1]).replace(this.tic,""),f=this._parseDouble(o)),isNaN(o)){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this._parseDouble(t)<-512||this._parseDouble(t)>511)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(u=(t>>>0).toString(2),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(u=u.substring(u.length-10)),i.length>1){if(f>10){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}f<=10&&(u=this._padLeft("0",f,u))}}catch(s){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}return u};this.computeDec2Oct=function(n){var f=0,u=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(u[0]).replace(this.tic,""),r=u.length>1?this.getValueFromArg(u[1]).replace(this.tic,""):"10",i="",e,o;if(n==null||n==""||u.length>2||u.length<1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(!(!isNaN(this._parseDouble(t))&&!isNaN(this._parseDouble(r)))){if((t!=null||t!="")&&this.computeIsText(t)==this.trueValueStr||(r!=null||r!="")&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(t)>-1)return t;if(this.getErrorStrings().indexOf(r)>-1)return r;if(t!=null&&t!=""&&this.computeIsText(t)==this.falseValueStr||t!=null&&t!=""&&this.computeIsText(r)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==null&&t==""||r==null||r==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[0].toString()}}try{if(u.length>1&&(o=this.getValueFromArg(u[1]).replace(this.tic,""),f=this._parseDouble(o)),this._parseDouble(t)<-536870912||this._parseDouble(t)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(this._parseDouble(t)<0)i=parseInt(t>>>0,10).toString(8),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(i=i.substring(i.length-10));else if(i=parseInt(t,10).toString(8),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(i=i.substring(i.length-10)),u.length>1){if(f>10){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}f<=10&&(i=this._padLeft("0",f,i))}}catch(s){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}return i};this.computeHex2Bin=function(n){var u=0,r=this.splitArgsPreservingQuotedCommas(n),s,h,i,o,c;if(r.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n==this._parseArgumentSeparator.toString())if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[0].toString();if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s;if(r.length==2&&this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var t=this.getValueFromArg(r[0]),f=r.length==2?this.getValueFromArg(r[1]):"0",e=0;if(e=this._parseDouble(f),!isNaN(e)&&(e<0||e>10)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(Boolean(t=="TRUE"||t=="FALSE")||r.length==2&&Boolean(f=="TRUE"||f=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t!=""){if(t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t)))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString()}else if(this._isCellReference(r[0])&&t=="")return"0";if(t[0]==this.tic&&(t.split(this.tic).join("")==null||t.split(this.tic).join("")==""))return"0";if(f[0]==this.tic)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();else if(isNaN(this._parseDouble(f.split(this.tic).join(""))))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString();if(u=this._parseDouble(f),u<0||t[0]=="-")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();i="";t=t.split(this.tic).join("");try{for(o=0;o10||u>10||u=i.length)i=this._padLeft("0",u,i);else if(u!=0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(!isNaN(this._parseDouble(i))&&this._parseDouble(i)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}return i};this.computeHex2Oct=function(n){var u=0,i=this.splitArgsPreservingQuotedCommas(n),e,o,t,f,s,r;if(i.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n==this._parseArgumentSeparator.toString())if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[0].toString();if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(i.length==2&&this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this.getValueFromArg(i[0]),i[0]=i[0].split(this.TIC).join(""),f=i.length==2?this.getValueFromArg(i[1]):"0",t!=""&&t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5].toString()}if(Boolean(t=="TRUE"||t=="FALSE")||i.length==2&&Boolean(f=="TRUE"||f=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t[0]==this.tic&&(t.split(this.tic).join("")==null||t.split(this.tic).join("")==""))return"0";if(t.indexOf(this._parseArgumentSeparator.toString())>-1&&(s=t.indexOf(this._parseArgumentSeparator),t=t.split(this.tic).join("").substring(0,s-1)),r="",isNaN(this._parseDouble(f.split(this.tic).join(""))))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString();if(u=this._parseDouble(f),u<0||t[0]=="-")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(i.length>2)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();i.length>1&&(u=this._parseDouble(i[1]));try{if(t=t.split(this.tic).join(""),r=parseInt(t,16).toString(8),!isNaN(this._parseDouble(r))&&r.length>10&&(r=r.substring(r.length-10)),i.length>1){if(u>=r.length&&u<=10)r=this._padLeft("0",u,r);else if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(!isNaN(this._parseDouble(r))&&this._parseDouble(r)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}}catch(h){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.computeIsText(t)==this.trueValueStr?this.getErrorStrings()[4].toString():t==""?"0":this.getErrorStrings()[4].toString()}return r};this._padLeft=function(n,t,i){var u=i.length,r;if(i.length0)for(r=0;r5||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(c=0;c-1)return s;if(f==5&&(s=this.formulaErrorStringCheck(i[4],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s}if(t=this._string_empty,r=this.getValueFromArg(i[0].split(this.tic).join(this._string_empty)),r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,e=this.getValueFromArg(i[1].split(this.tic).join(this._string_empty)),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,r==""||e==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(o=this._parseDouble(r),u=this._parseDouble(e),o<1||u<1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}var v=f>2?this.getValueFromArg(i[2].split(this.tic).join(this._string_empty)):"1",l=u,y=l%26;if(l=parseInt(l/26),t=t+this._charTable[y],t=t+this._charTable[parseInt(l)],a=t.split("").join(",").split(this.getParseArgumentSeparator()),a.reverse(),h=a.join(""),t="$"+h+"$"+r,f>2)switch(v){case"2":t=h+"$"+r;break;case"3":t="$"+h+r;break;case"4":t=h+r}if(f>3&&(this.getValueFromArg(i[3].split(this.tic).join(this._string_empty))=="FALSE"||this.getValueFromArg(i[3].split(this.tic).join(this._string_empty))=="0"))switch(v){case"":t="R"+o+"C"+u;break;case"1":t="R"+o+"C"+u;break;case"2":t="R"+o+"C["+u+"]";break;case"3":t="R["+o+"]C"+u;break;case"4":t="R["+o+"]C["+u+"]"}return f>4&&this.getValueFromArg(i[4].split(this.tic).join(this._string_empty))==this._string_empty&&(i[4]=this.getValueFromArg(i[4]),t=i[4].split(this.tic).join(this._string_empty)+"!"+t),t};this.computeAreas=function(n){var r,u,f,t,e,i;if(n.indexOf(" ")>0&&(n=n.substring(0,n.indexOf(" "))),!this._isCellReference(n)&&!this.getNamedRanges().containsKey(n)&&!n.indexOf(")")){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(r)>-1))return r;if(u=this._splitArguments(n,")"),u.length>2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[1].toString()}for(f=u[0].split("(").join(this._string_empty),t=this.splitArgsPreservingQuotedCommas(f),e=t.length,i=0;i-1))return u;if(i=this.getValueFromArg(t[0]).split(this.tic).join(""),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,e=this.splitArgsPreservingQuotedCommas(i),i=e[0],r=parseInt(i),isNaN(r)||r>t.length-1||r<1)return"#VALUE!";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,t[r];if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1))return u;if(f=this.getValueFromArg(t[r]),f==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return f};this.computeColumn=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,r,t;if(u.length!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(n==null||n==this._string_empty)return t=this.colIndex(this.cell).toString(),r=this.rowIndex(this.cell).toString(),t;if(t=this.colIndex(n).toString(),r=this.rowIndex(n).toString(),r<=0||!isNaN(this._parseDouble(n))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return t};this.computeColumns=function(n){var t,e,o,s,h,i,u,f,r;if(t=this.splitArgsPreservingQuotedCommas(n),t.length!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1))return e;if(o=-1,this._parseDouble(t[0],o))return"1";if(t[0].indexOf(this.tic)&&!t[0].indexOf(";")&&!t[0].indexOf(this.getParseArgumentSeparator().toString())||!this._isCellReference(t[0])&&!this.getNamedRanges().containsValue(t[0])&&!n.indexOf(";")&&!n.indexOf(this.getParseArgumentSeparator().toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(i=1,n.indexOf(":")>-1)u=this.getCellsFromArgs(n),s=this.colIndex(u[0].toString()),h=this.colIndex(u[u.length-1].toString()),i=h-s+1,i=i>0?i:1;else if(n.indexOf(";")>-1)for(r=this._splitArguments(n.split(this.tic).join(this._string_empty),";"),f=1;f2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)?r:(f=this._stripTics0(this.getValueFromArg(i[0])),u==2)?(t=this._stripTics0(this.getValueFromArg(i[1])),t==null)?"0":t==this._string_empty?"0":t:f};this.computeAbs=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,r,t,u;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.abs(u).toString()};this.computeAcos=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>1||i<-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return Math.acos(i).toString()};this.computeAcosh=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(z=Math.log(i+Math.sqrt(i*i-1)),i<=0||z==Infinity){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return z.toString()};this.computeAcot=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,e,t,r;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(e=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(n),r=0,isNaN(t)||(r=t<=0?Math.PI/2-Math.atan(t):Math.atan(1/t)),r.toString())};this.computeAcoth=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,r,t,i,f;if(e!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(i<1&&i>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(f=(Math.log((i+1)/(i-1))/2).toString(),this.computeIsErr(f)==this.trueValueStr&&this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()};this.computeArabic=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,o,s;if(u.length!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(u[0]),this.getErrorStrings().indexOf(i)!=-1)return i;if(o=parseInt(i.split(this.tic).join("").toUpperCase()),!isNaN(o)||!this._isCellReference(u[0])&&u[0][0]!=this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return isNaN(o)?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}i=i.split(this.tic).join("").toUpperCase();var f=0,h=null,r=0,t=0,e=0;for(e=1e3,s=!1,f=1;f<=i.length;f++){h=this._substring(i,f-1,1);switch(h){case"-":s=!0;break;case"I":t=1;break;case"V":t=5;break;case"X":t=10;break;case"L":t=50;break;case"C":t=100;break;case"D":t=500;break;case"M":t=1e3;break;default:if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}r=t>e?r+t-2*e:r+t;e=t}return s&&(r=-r),r.toString()};this.computeAsin=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,u,t,i,f,e;if(o!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>1||i<-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=0,isNaN(f)||(e=Math.asin(f)),e.toString()};this.computeAtan=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.atan).toString())};this.computeAtan2=function(n){var f=this.splitArgsPreservingQuotedCommas(n),c=f.length,e,u,r,o,t,i,s,h;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(r=0,o=0,t=this.getValueFromArg(f[0]),i=this.getValueFromArg(f[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,s=t=="true"?!0:!1,h=i=="true"?!0:!1,s?t=s.toString():t==this._string_empty&&(t="0"),h?i=h.toString():i==this._string_empty&&(i="0"),this.getErrorStrings().indexOf(t)>-1)return t;if(this.getErrorStrings().indexOf(i)>-1)return i;if(u=this._parseDouble(t),r=this._parseDouble(i),isNaN(u)||isNaN(r))if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();else if(r==0&&u==0)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();else return this.getErrorStrings()[3].toString();return o=Math.atan2(r,u),o.toString()};this.computeCeilingMath=function(n){var e=this.splitArgsPreservingQuotedCommas(n),s=e.length,h,r,t,u,y;if(this._isTextEmpty(n)||s>3||s<1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;r=this.getValueFromArg(e[0]);r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r;t=s>1&&e[1].length!=0?this.getValueFromArg(e[1]):"1";t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;u=s==3&&e[2].length!=0?this.getValueFromArg(e[2]):"1";u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u;var i,f=-1,o=-1,c,l=!1,a=!1,v=!1;if(l=r.split(this.tic).join(this._string_empty)=="true"?!0:!1,a=t.split(this.tic).join(this._string_empty)=="true"?!0:!1,v=u.split(this.tic).join(this._string_empty)=="true"?!0:!1,r=l?l.toString():r,t=a?a.toString():t,u=v?v.toString():u,this.getErrorStrings().indexOf(r)!=-1)return r;if(this.getErrorStrings().indexOf(t)!=-1)return t;if(this.getErrorStrings().indexOf(u)!=-1)return u;if(t.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(t.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(i=this._parseDouble(r),f=this._parseDouble(t),o=this._parseDouble(u),isNaN(i)&&!isNaN(f)&&!isNaN(o)){if(i==0&&!this._isTextEmpty(r)&&this.computeIsText(r)==this.falseValueStr||f==0&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr||o==0&&!this._isTextEmpty(u)&&this.computeIsText(u)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(r.split(this.tic).join(this._string_empty))&&r[0]==this.tic||this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[1]==this.tic||this._isTextEmpty(u.split(this.tic).join(this._string_empty))&&u[2]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(r.split(this.tic).join(this._string_empty))||this._isTextEmpty(t.split(this.tic).join(this._string_empty))||this._isTextEmpty(u.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return(i<0&&o<0&&(f=-1),i==0||f==0)?"0":(y=0,i=this._parseDouble(i.toString()),i>0&&(i+=.4999999999),i<0&&-.5>=i-parseInt(i)&&(i-=.4999999999),i=Math.round(i),y=Math.floor(i/f),c=y*f,i<0&&i%2!=0&&o==0&&(c+=f),c.toString())};this.computeCeiling=function(n){var f=this.splitArgsPreservingQuotedCommas(n),h=f.length,c,i,t,o,s,u,r,e;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c;if(f[0]=this.getValueFromArg(f[0]),i=h>1?f[0]:"1",i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f[1]=this.getValueFromArg(f[1]),t=h>1&&f[1].length!=0?f[1]:"0",t=t==""||t==null?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,o=!1,s=!1,o=i.split(this.tic).join(this._string_empty)=="true"?!0:!1,s=t.split(this.tic).join(this._string_empty)=="true"?!0:!1,i=o?o.toString():i,t=s?s.toString():t,t==this.trueValueStr)return"1";if(t==this.falseValueStr)return"0";if(t.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(i)!=-1)return i;if(this.getErrorStrings().indexOf(t)!=-1)return t;if(r=-1,e=-1,u=this._parseDouble(i),r=this._parseDouble(t),isNaN(u)&&!isNaN(r)){if(u==0&&!this._isTextEmpty(i)&&this.computeIsText(i)==this.falseValueStr||r==0&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(i.split(this.tic).join(this._string_empty))&&i[0]==this.tic||this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[0]==this.TIC){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(i.split(this.tic).join(this._string_empty))||this._isTextEmpty(t.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(u=this._parseDouble(i),r=this._parseDouble(t),!isNaN(u)&&!isNaN(r)){if(u>0&&r<0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(u==0||r==0)return"0";if(e=Math.floor(u/r)*r,r>0)while(eu)e+=r}return e.toString()};this.computeDecimal2=function(n){var r=this.splitArgsPreservingQuotedCommas(n),h=r.length,o,t,i,f,u,s,e;if(h>3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/",!this.getValueFromArg(r[0]).indexOf(this.tic)&&!this._isCellReference(r[0])){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=0;try{t=this.getValueFromArg(r[0]).split(this.tic).join("");i=parseInt(this.getValueFromArg(r[1]).split(this.tic).join(""))}catch(c){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+c;return this.getErrorStrings()[1].toString()}if(i<2||i>o.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),i<=36&&(t=t.toUpperCase()),u=0,f=0;u=0&&e-1))return o;if(h=0,t=this.getValueFromArg(e[0]).split(this.tic).join(""),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(e[1]).split(this.tic).join(""),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t.split(this.tic).join("")==this._string_empty||i.split(this.tic).join("")==this._string_empty)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();if(s=this._parseDouble(t),r=this._parseDouble(i),isNaN(s)||isNaN(r)){if(this._rethrowLibraryComputationExceptions)return this.formulaErrorStrings[this._invalid_arguments];throw this.getErrorStrings()[1].toString();}else{if(u=parseInt((r+.1).toString()),f=parseInt((s+.1).toString()),f-1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(s!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(n.length>15){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return t=this.getValueFromArg(r[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t==""||t==0?"0":t,t=parseInt(t.split(this.tic).join("")),i=this.getValueFromArg(r[1]).split(this.tic).join(""),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i==""||i==0?"0":i,i=parseInt(i.split(this.tic).join("")),t==0&&i==0?f="1":(e=t+i-1,o=e+","+(t-1),f=this.computeCombin(o)),f};this.computeCos=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.cos).toString())};this.computeCosh=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),e=i.length,r,t,u,f;if(e>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.exp(u),(f+1/f)/2};this.computeCot=function(n){var u=this.splitArgsPreservingQuotedCommas(n),o=u.length,o=u.length,r,f,t,e,i;if(o!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(f=this.computeIsNumber(n),f==this.trueValueStr){if(t=n,t=t.indexOf("u")?t.split("u").join(this._string_empty):t,e=this._parseDouble(t),e>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}}else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}if(n=="0"){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return i=this._computeMath(n,Math.tan),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeCsc=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(1/parseFloat(Math.sin(i))).toString()};this.computeCsch=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i,e;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),e=this.computeIsNumber(n),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i==0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[3].toString()}return i>709?"0":(2/(Math.exp(i)-Math.exp(-i))).toString()};this.computeDecimal=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,o,s,t,i,u,f,h,e;if(c>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(o)>-1))return o;if(r[1]==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";i=0;try{t=this.getValueFromArg(r[0]).split(this.tic).join("");i=parseInt(this.getValueFromArg(r[1]).split(this.tic).join(""))}catch(l){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+l;return this.getErrorStrings()[1].toString()}if(i<2||i>s.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),i<=36&&(t=t.toUpperCase()),f=0,u=0;f=0&&e-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=0,f=180*u/Math.PI,f.toString()};this.computeExp=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,i,t,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t==""&&(n="0"),u=this._parseDouble(t),u>709){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return this._computeMath(n,Math.exp).toString()};this.computeEven=function(n){var e=0,r=this.splitArgsPreservingQuotedCommas(n),o=r.length,u,i,t,f;if(o>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(i=this.getValueFromArg(r[0]),t=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(t.split(this.tic).join("")),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.sign(t),t=Math.abs(t),t=Math.ceil(t),e=t%2==1?f*(t+1):f*t,e.toString()};this.computeFact=function(n){var i=0,o=this.splitArgsPreservingQuotedCommas(n),e,r,t,u,f;if(o.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(r=this.getValueFromArg(n),t=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,t=this._parseDouble(t.split(this.tic).join("")),isNaN(t))return this.getErrorStrings()[1].toString();if(t<0)return this.getErrorStrings()[4].toString();if(u=t,u>12)for(i=this._factorialTable[12],f=13;f<=u;f++)i*=f;else i=this._factorialTable[u];return i.toString()};this.computeFactdouble=function(n){var r,u=1,e=this.splitArgsPreservingQuotedCommas(n),f,t,i;if(e.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(r=parseInt(this.getValueFromArg(n)),isNaN(r))return this.getErrorStrings()[1].toString();if(r<0)return this.getErrorStrings()[4].toString();if(t=r,i=t,t>3)while(i>0)u=u*i,i=i-2;else u=t==0?1:t;return u.toString()};this.computeFloor=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,f;if(e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;var t=this._parseDouble(this.getValueFromArg(u[0])),i=this._parseDouble(this.getValueFromArg(u[1])),r=0;if(!isNaN(t)&&!isNaN(i)){if(t==0)return r.toString();if(t*i<=0&&!(t<0))return this.formulaErrorStrings[this._invalid_arguments];if(r=Math.ceil(t/i)*i,i>0)while(r>t)r-=i;else while(r1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(i[0]),this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=Math.floor(t).toString(),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return u};this.computeLn=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=i.length,r,t;if(u>1)return this.formulaErrorStrings[this.invalid_arguments];if(r=this.getValueFromArg(i[0]),t=this._parseDouble(r),t<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return r[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.log(t).toString()};this.computeLog=function(n){var f=this.splitArgsPreservingQuotedCommas(n),o=f.length,e,t,i,r,u;if(o>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),i=o==2?this.getValueFromArg(f[1]):"10",t==""||t==null||i==""||i==null){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(t),u=this._parseDouble(i),r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(r)||isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||i[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return(Math.log(r)/Math.LN10/(Math.log(u)/Math.LN10)).toString()};this.computeLogTen=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),f=i.length,r,t,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(this._computeMath(t,Math.log)/Math.LN10).toString()};this.computePI=function(n){if(this.getEnableFormulaErrorValidation()){var t=this.formulaErrorStringCheck(n,FormulaArgumentType.None);return this.formulaErrorStrings[this._invalid_arguments]==t?t:Math.PI.toString()}return Math.PI.toString()};this.computeProduct=function(n){var f=1,r,t,o=!0,u,s,i,c,h,e;if(this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(s)>-1))return s;for(i=0;i-1)for(h=this.getCellsFromArgs(c),e=0;e0){if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}f=f*r;o=!1}}else{try{t=this.getValueFromArg(u[i]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(l){return l}if(t.length>0){if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t==this.tic||this._isCellReference(u[i])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}f=f*r;o=!1}}return o?"0":f.toString()};this.computeSecant=function(n){var e=this.splitArgsPreservingQuotedCommas(n),r,u,t,f,i;if(n=this.getValueFromArg(n),r=e.length,r!=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(u=this.computeIsNumber(n),u==this.trueValueStr){if(t=n,t=t.indexOf("u")?t.split("u").join(""):t,f=parseFloat(t),f>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}}else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}return i=this._computeMath(n,Math.cos),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeSeriessum=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r,f,e,i;if(t.length!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(r=0;r<=2;r++)if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;var h=0,c=0,l=0,o=0,u=0,s;if(s=t[3].indexOf(";")>-1?this._splitArguments(t[3].split(this.tic).join(""),";"):this.getCellsFromArgs(t[3].split(this.tic).join("")),t[0]==""||t[1]==""||t[2]==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}for(h=this._parseDouble(this.getValueFromArg(t[0])),c=this._parseDouble(this.getValueFromArg(t[1])),l=this._parseDouble(this.getValueFromArg(t[2])),i=0;i1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.sin).toString())};this.computeSinh=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),e=i.length,r,t,u,f;if(e>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.exp(u),(f-1/f)/2};this.computeSqrt=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),r=i.length,t;if(r>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.sqrt).toString())};this.computeSubTotal=function(n){var f=!1,t=this._string_empty,e,r=0,u=this._splitArguments(n,this.getParseArgumentSeparator().toString()),s=u.length,o,i;if(s<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(u[0],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this._isCellReference(u[0])?this.getValueFromArg(u[0]):u[0].toString(),e=this._parseDouble(t),isNaN(e)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(r=parseInt(e.toString()),(r<1||r>11)&&(r<101||r>111))return this.getErrorStrings()[1].toString();if(f)return"0";t=n.substring(u[0].toString().length+1);f=!0;i=this._string_empty;switch(r){case 1:case 101:i=this.computeAverage(t);break;case 2:case 102:i=this.computeCount(t);break;case 3:case 103:i=this.computeCounta(t);break;case 4:case 104:i=this.computeMax(t);break;case 5:case 105:i=this.computeMin(t);break;case 6:case 106:i=this.computeProduct(t);break;case 7:case 107:i=this.computeStdev(t);break;case 8:case 108:i=this.computeStdevp(t);break;case 9:case 109:i=this.computeSum(t);break;case 10:case 110:i=this.computeVar(t);break;case 11:case 111:i=this.ComputeVarp(t);break;default:i=this.getErrorStrings()[1].toString()}return f=!1,i};this.computeSumif=function(n){var l=this.splitArgsPreservingQuotedCommas(n),w=l.length,p,b,t,a,f,v,h,c,r,i,u;if(w!=2&&w!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((p=this.formulaErrorStringCheck(l[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(p)>-1)||w==3&&(p=this.formulaErrorStringCheck(l[2],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(p)>-1)))return p;if(b=l[0],t=l[1],t.length<1)return"0";a=this.token_equal;t[0]!=this.tic[0]&&"=><".indexOf(t[0])==-1&&(t=this.getValueFromArg(t));f=t.length>0&&t[0]==this.tic[0]?1:0;v=this.minValue;t.substring(f)[0]==">="?(t=this._substring(t,f+2,t.length-2-2*f),a=this.token_greatereq):t.substring(f)[0]=="<="?(t=this._substring(t,f+2,t.length-2-2*f),a=this.token_lesseq):t.substring(f)[0]=="<"?(t=this._substring(t,f+1,t.length-1-2*f),a=this.token_less):t.substring(f)[0]==">"?(t=this._substring(t,f+1,t.length-1-2*f),a=this.token_greater):t.substring(f)[0]=="="&&(t=this._substring(t,f+1,t.length-1-2*f));t=t.split(this.tic).join("");var tt=this._parseDouble(t,v),e=w==2?b:l[2],y=this.getCellsFromArgs(b),o=this.getCellsFromArgs(e),s=y.length;if(s>o.length&&(h=e.indexOf(":"),h>-1)){var g=this.rowIndex(this._substring(e,0,h)),nt=this.colIndex(this._substring(e,0,h)),k=this.rowIndex(this._substring(e,h+1)),d=this.colIndex(this._substring(e,h+1));g!=k?k+=s-o.length:nt!=d&&(d+=s-o.length);e=this._substring(e,0,h+1)+RangeInfo.getAlphaLabel(d)+k.toString();o=this.getCellsFromArgs(e)}c=0;switch(a){case this.token_equal:for(u=0;u=v&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r));break;case this.token_greater:for(u=0;uv&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r));break;case this.token_less:for(u=0;u2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(o==2&&(t=this.getValueFromArg(r[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=this._parseDouble(t)),i=this.getValueFromArg(r[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,u=this._parseDouble(i.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return e=Math.pow(10,t),s=u<0?-1:1,(s*Math.floor(e*Math.abs(u))/e).toString()};this.computeLognormOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,e,u,f,i,h,c;if(s!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(f=0,i=0;i-1))return f;for(o=0,i=0;i=1||u<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}o=Math.exp(this._normalinv(r,e,u))}return o.toString()};this.computeNormOinv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,r,o,u,f,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,i=0;i=0&&r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments]+this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=this._normalCumulativeDistributionFunctionInverse(r,o,u)}return f<=0?this.formulaErrorStrings[this._iterations_dont_converge]:f.toString()};this.computeNormOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,s,u,f,r,e,h,i,c;if(o!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;for(e=0,h=0,i=0;i=1){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value doesnot match with in range level";return this.getErrorStrings()[4].toString()}return u=this._standardNormalCumulativeDistributionFunctionInverse(t),u.toString()};this.computePermut=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,r,u,f,e,i;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(e=0,t[0]=this.getValueFromArg(t[0]),t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=this.getValueFromArg(t[1]),t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],u=this._parseDouble(this.getValueFromArg(t[0])),f=this._parseDouble(this.getValueFromArg(t[1])),isNaN(u)||isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];var c=f+.1,s=u+.1,o=1;for(i=s-c+1;i<=s;++i)o=o*i;return e=o,e.toString()};this.computePermutationA=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,u,i,r,e,o,s;if(f!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)?u:(e=0,t[0]=this.getValueFromArg(t[0]),t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=this.getValueFromArg(t[1]),t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],i=this._parseDouble(t[0]),r=this._parseDouble(t[1]),isNaN(i)||isNaN(r))?this.formulaErrorStrings[this._invalid_arguments]:(o=r+.1,s=i+.1,Math.pow(i,r).toString())};this.computeStandardize=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,u,f,e,r,o,i;if(s!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;for(r=0,o=0,i=0;i-1))return e;for(o=0,s=0,i=0;if||u<0||u>1){if(this._rethrowLibraryComputationExceptions)throw"#NAME! Passed argument value is not equal to minimum par value";return this.getErrorStrings()[4].toString()}return o=t[3]==this.trueValueStr?1:0,s=o==0?this._comb(r,f)*Math.pow(u,r)*Math.pow(1-u,f-r):this._binomdist(f,r,u),s.toString()};this.computeChisqOinvOrt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,u,e,i;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i1||u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(r==1)return"0";e=this._chiinv(r,u)}return e.toString()};this.computeChisqOdistOrt=function(n){var i=this.splitArgsPreservingQuotedCommas(n),o=i.length,e,u,r,f,t,s;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,t=0;t-1))return e;var r,u=0,f=0,o=0;for(i=0;i1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=0,t=this._parseDouble(n),!isNaN(t)&&t>1)t=this._gammaln(t);else{if(t==1)return"0";if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return t.toString()};this.computeConfidenceOnorm=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,f,e,u,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw"Wrong number of arguments";return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(u=0,i=0;i=1||f<=0||e<1){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is different from minimum par";return this.getErrorStrings()[4].toString()}u=this._excelLikeComputations?this._normalinv(1-r+r/2,0,1):this._newnormalinv(1-r+r/2);u=u*f/Math.sqrt(e)}return u.toString()};this.computeExponOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,u,r,f,o,i,h;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,o=0,i=0;i-1))return r;if(u=0,i=this.getValueFromArg(f[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(i),!isNaN(t)&&t>-1&&t<1)u=.5*Math.log((1+t)/(1-t));else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return u.toString()};this.computeFisherInv=function(n){var e=this.splitArgsPreservingQuotedCommas(n),o=e.length,i,r,u,t,f;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(u=0,t=this.getValueFromArg(e[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(t),isNaN(r)||(f=Math.exp(2*r),u=(f-1)/(f+1)),u.toString())};this.computeGammalnOPrecise=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,i,t;if(u!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=0,t=this._parseDouble(n.toString()),!isNaN(t)&&t>1)t=this._gammaln(t);else{if(t==1)return"0";if(t<=0){if(this._rethrowLibraryComputationExceptions)throw"Passed Argument value is less than or equal to minimum value 0";return this.getErrorStrings()[4].toString()}}return t.toString()};this.computeLarge=function(n){var i=this.splitArgsPreservingQuotedCommas(n),h=i.length,r,u,f,t;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(r=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)return r;if(u=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)return u}if(t=this.getValueFromArg(i[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,f=this._parseDouble(t),isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];var e=f,o=this._getDoubleArray(i[0]),s=o.length;return e<1||e>s?this.formulaErrorStrings[this._invalid_arguments]:(o.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),o[s-e].toString())};this.computeSmall=function(n){var i=this.splitArgsPreservingQuotedCommas(n),s=i.length,u,f,t,e;if(s!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(u=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)return u;if(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)return f}if(t=this.getValueFromArg(i[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,e=this._parseDouble(t),isNaN(e))return this.formulaErrorStrings[this._invalid_arguments];var o=e,r=this._getDoubleArray(i[0]),h=r.length;return o<1||o>r.length?this.formulaErrorStrings[this._invalid_arguments]:(r.sort(function(n,t){return isNaN(n)||isNaN(t)?n-1)for(o=this.getCellsFromArgs(t),e=0;e0&&r++}else if(t=="")r++;else if(this._isLetter(t[0]))f=this.getValueFromArg(t),f.length>0&&r++;else if(t.indexOf(this.getParseArgumentSeparator())>-1)for(s=this.splitArgsPreservingQuotedCommas(t.split(this.tic).join("")),i=0;i0||i=="")&&r++}else u.length>0&&r++;return r.toString()};this.computeAverage=function(n){var i=0,e=0,r,t,f=[],h=this.splitArgsPreservingQuotedCommas(n),c,o,l,s,u;if(h.length<1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(c)>-1))return c;for(o=0;o-1)for(l=this.getCellsFromArgs(f),s=0;s0&&!isNaN(t))if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)==-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString()}else i=Number(i)+Number(r),e++}else{try{t=this.getValueFromArg(f).split(this.tic).join(this._string_empty);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;u=this.getValueFromArg(f);u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u}catch(a){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();else return this.getErrorStrings()[4].toString()}if(t.length>0)if(r=this._parseDouble(t),isNaN(r))if(u[0]==this.tic)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();else if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString();else i=Number(i)+Number(r),e++}return e>0&&(i=Number(i)/Number(e)),i.toString()};this.computeAverageA=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e,t,h,u,r,o,c,f,s;if(i.length<1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this._string_empty,h=0,i==this.trueValueStr||i==this.falseValueStr)return u=i==this.trueValueStr,u?+u:+u;for(r=0;r-1)for(o=this.splitArgsPreservingQuotedCommas(i[r].split(this.tic).join(this._string_empty)),c=0,f=0;f-1)for(s=this.getCellsFromArgs(i),o=0;o0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.max(r,u)}else{try{if(!this._isCellReference(i)&&i[0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}t=i==this._string_empty?"0":this.getValueFromArg(i);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return h}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.max(r,u)}return r!=this.minValue?r.toString():this._string_empty};this.computeMaxa=function(n){var f=this.minValue,i,t,u,o,r,s,e;if(this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(o)>-1))return o;for(r=0;r-1)for(s=this.getCellsFromArgs(u[r]),e=0;e0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}f=Math.max(f,i)}}else{try{if(u[r].startsWith(this.tic)||u[r]!=""){if(t=this.getValueFromArg(u[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return t}t==""&&(t="0")}else t="0"}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)==-1)return t;i=this._parseDouble(t)}f=Math.max(f,i)}}return f!=this.minValue?f.toString():this._string_empty};this.computeMedian=function(n){var r,t,i,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(r)>-1)?r:(t=this._getDoubleArray(n),t.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),i=parseInt((t.length/2).toString()),u="",t.length%2==1?t[i].toString():((t[i]+t[i-1])/2).toString())};this.computeMin=function(n){var r=this.maxValue,u,t,f,s,h,e,i,c,o;if(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(s=n.split(";"),s.length>1){for(i=0;i0)if(u=this._parseDouble(e),isNaN(u)){if(this.getErrorStrings().indexOf(e)==-1)return e}else r=Math.min(r,u);if(r!=this.maxValue)return r.toString()}for(i=0;i-1)for(c=this.getCellsFromArgs(f[i]),o=0;o0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.min(r,u)}else{try{if(!this._isCellReference(f[i])&&f[i][0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}t=f[i]==this._string_empty?"0":this.getValueFromArg(f[i]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;t==""&&this._isCellReference(f[i])&&(t="0")}catch(l){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return l}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.min(r,u)}return r!=this.maxValue?r.toString():this._string_empty};this.computeMina=function(n){var u=this.maxValue,i,t,o,s,h,c,f,r,l,e;if(this.adjustRangeArg(n),o=this.splitArgsPreservingQuotedCommas(n),s=n.split(";"),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(h)>-1))return h;if(s.length>1){for(r=0;r0){if(i=0,f.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(f)==-1)return f;f=f.split(this.tic).join("")=="TRUE"?"1":f.split(this.tic).join("")=="FALSE"?"0":f;i=this._parseDouble(f)}u=Math.min(u,i)}if(u!=this.maxValue)return u.toString()}for(r=0;r-1)for(l=this.getCellsFromArgs(o[r]),e=0;e0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else if(t.toUpperCase()==this.falseValueStr)i=0;else{if(this.getErrorStrings().indexOf(t)!=-1)return t;i=this._parseDouble(t)}u=Math.min(u,i)}}else{try{o[r].startsWith(this.tic)||o[r]!=""?(t=this.getValueFromArg(o[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t==""&&(t="0")):t="0"}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}u=Math.min(u,i)}}return u!=this.maxValue?u.toString():this._string_empty};this.computePercentrankInc=function(n){var i=this.splitArgsPreservingQuotedCommas(n),l=i.length,f,u,o,e,r,s,h,t,c,a,v;if(l!=2&&l!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i[0]!=""&&i[1]==""||i[1]!=""&&i[0]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()){if(f=this.formulaErrorStringCheck(i[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)return f;for(t=1;t-1)return f}if(o=3,e=this.getValueFromArg(i[1]),e==""&&(e="0"),u=this._parseDouble(e),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(u==0,l==3&&(i[2]=i[2].split(this.tic).join("")=="TRUE"?"1":i[2].split(this.tic).join("")=="FALSE"?"0":i[2],e=this.getValueFromArg(i[2]),o=this._parseDouble(e),isNaN(o)||o<1)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}for(r=this._getDoubleArray(i[0]),s=r.length,r.sort(),h=1,t=0;t0&&r[t-1]-1)||(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)))return f;if(e=0,t=this.getValueFromArg(i[0]),i[0]==this._string_empty||i[1]==this._string_empty||!this._isCellReference(i[1]))return this.getErrorStrings()[4].toString();if(r=this._parseDouble(t),!isNaN(r)){if(h=0,s==3){if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c;t=this.getValueFromArg(i[2]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;t==this._string_empty?t="0":this._parseDouble(t)>1&&(t="1");h=this._parseDouble(t)}var l=i[1],u=0,a=!1;if(l.indexOf(":")==-1)return this.getErrorStrings()[4].toString();if(l.indexOf(":")>-1){for(v=this.getCellsFromArgs(l),o=0;or?e+=1:u==r&&(a=!0))}a&&(e+=1)}}return e.toString()};this.computePercentile=function(n){var u=this.splitArgsPreservingQuotedCommas(n),c=u.length,f,t,h,r,e,o,s,i;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((f=this.formulaErrorStringCheck(u[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)||(f=this.formulaErrorStringCheck(u[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)))return f;if(h=this.getValueFromArg(u[1]),t=this._parseDouble(h),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];for(r=this._getDoubleArray(u[0]),e=r.length,r.sort(function(n,t){return isNaN(n)||isNaN(t)?nt){t=(t-i*o)/o;s=r[i]+t*(r[i+1]-r[i]);break}return s.toString()};this.computePoissonODist=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,o,u,s,i,e,f,h,t;if(c!=3)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,i=0,t=0;t-1))return s;for(f=0,h=!0,e=0;e=5&&r.toString().length>=3){if(this._rethrowLibraryComputationExceptions)throw"Passed argument length exceeded the minimum length";return this.getErrorStrings()[4].toString()}return o!=3&&(f=i[3]==this.trueValueStr?1:0,c=0,c=this._parseDouble(i[3]),isNaN(c)||(f=1)),h=f==1?!0:!1,f=h?1-Math.exp(-Math.pow(u/r,t)):Math.pow(u,t-1)*Math.exp(-Math.pow(u/r,t))*t/Math.pow(r,t),f.toString()};this.computeFOinvOrt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,u,f,e,i;if(s!=3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(e=0,i=0;i0&&r<1&&!isNaN(u)&&!isNaN(f)){if((r<0||r>1||u<1||f<1)&&this.getRethrowLibraryComputationExceptions())throw"#NUM! Passed Argument value is less than or equal to minimum value";e=this._finv(r,u,f)}if(e<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[4].toString()}return e.toString()};this.computeTOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,e,r,i,f,u;if(o!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(i=0,f=0,u=0;u-1)for(c=this.getCellsFromArgs(f),o=0;o0)if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>0)return t}else i=i+r,u.push(r)}else{try{if(t=this.getValueFromArg(f).split(this.tic).join(this._string_empty),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getEnableFormulaErrorValidation()&&(l=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1))return l}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0)if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)==-1)return t}else i=i+r,u.push(r)}if(u.length>0){for(v=i/u.length,i=0,s=0;s-1))return f;for(r=0,e=0,u=0;u-1))return f;for(e=0,i=0;i=1||u<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return r==0?"0":(e=this._chiinv(r,u),e.toString())}};this.computeCount=function(n){var u=0,t,f,e=new Date,r,i,s,o;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(r=this.splitArgsPreservingQuotedCommas(n),i=0;i-1)for(s=this.getCellsFromArgs(r[i].split(this.tic).join("")),o=0;o0){if(t==this.formulaErrorStrings[19]){if(this.geLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}f=this._parseDouble(t);e=new Date(Date.parse(t));isNaN(f)&&e.toString()=="Invalid Date"||this.getErrorStrings().indexOf(t)!=-1||u++}}else{try{r[i]!=this._string_empty||r[i][0]==this.tic||u++;t=this.getValueFromArg(r[i].split(this.tic).join(""));t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();throw this.getErrorStrings()[4].toString();}if(t.length>0){if(t[0]==this.formulaErrorStrings[19]){if(this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}f=this._parseDouble(t);e=new Date(Date.parse(t));isNaN(f)&&e.toString()=="Invalid Date"||this.getErrorStrings().indexOf(t)!=-1||u++}}return u.toString()};this.computeFOdistORt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,e,i,h;if(o!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;var f,r=0,u=0,s=0;for(i=0;i-1){if(r[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}for(s=this.getCellsFromArgs(f[r]),o=0;o0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,i=i*u}}else{try{t=this.getValueFromArg(f[r])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0){if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,i=i*u}}return e>0&&(i=Math.pow(i,1/e)),i.toString()};this.computeHarmean=function(n){var r=0,t,i,e=0,f,u,s,o,h;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),u=0;u-1){if(u[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}for(s=this.getCellsFromArgs(f[u]),o=0;o0)if(i=this._parseDouble(t),isNaN(i)||i==0){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,r=r+1/i}}else{try{t=this.getValueFromArg(f[u])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0){if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;if(i=this._parseDouble(t),isNaN(i)||i==0){if(this.getErrorStrings().indexOf(t))return t}else e++,r=r+1/i}}return e>0&&(r=e/r),r.toString()};this.computeIntercept=function(n){var f=this.splitArgsPreservingQuotedCommas(n),a=f.length,o,r,u,c,l,e,t;if(a!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1))return o;if(value1=this.getValueFromArg(f[0]),value2=this.getValueFromArg(f[1]),Boolean(value1)||Boolean(value2)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}var s=this._getDoubleArray(f[0]),h=this._getDoubleArray(f[1]),i=h.length;if(i<=0||i!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(r=0,u=0,t=0;t1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(o)>-1))return o;for(u=0;u-1)for(s=this.getCellsFromArgs(r),f=0;f-1))return o;if(r.length<=0){if(this.getLibraryComputationException()!=null)throw this.formulaErrorStrings[this._bad_formula];throw this.getErrorStrings()[4].toString();}for(i=0,t=0;t-1))return a;for(t=1;t<=2;t++)if(this.getEnableFormulaErrorValidation()&&(v=this.formulaErrorStringCheck(f[t],FormulaArgumentType.Text),this.getErrorStrings().indexOf(v)>-1))return v;if(e=this.getValueFromArg(f[0]),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,y=this._parseDouble(e),isNaN(y)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(s=this._getDoubleArray(f[1]),h=this._getDoubleArray(f[2]),i=h.length,i<=0||i!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(r=0,u=0,t=0;t-1))return t;if(i=this._getDoubleArrayA(n),r=i.length,r<2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}return this._stdevdotP(i).toString()};this.computeStdevOS=function(n){var t,i,r,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1))return t;if(i=this._getDoubleArrayA(n),r=i.length,r<2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}return u=0,this._sd(i,u).toString()};this.computeStdeva=function(n){var t,i,r,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1)?t:(i=this._getDoubleArrayA(n),r=i.length,r<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,this._sd(i,u).toString())};this.computeStdevpa=function(n){var i,r,t,u,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(i)>-1)?i:(r=this._getDoubleArrayA(n),t=r.length,t<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,f=this._sd(r,u),(f*Math.sqrt(t-1)/Math.sqrt(t)).toString())};this.computeVarp=function(n){var t=this._getDoubleArray(n),i=t.length;return((i-1)*this._var(t)/i).toString()};this.computeVara=function(n){var t=this._getDoubleArrayA(n);return this._var(t).toString()};this.computeVarpa=function(n){var t=this._getDoubleArrayA(n),i=t.length;return((i-1)*this._var(t)/i).toString()};this.computeCorrel=function(n){var f=this.splitArgsPreservingQuotedCommas(n),b=f.length,v,y,p,e,o,i,r,u,t,w;if(b!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(v=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(v)>-1))return v;if(y=this.getValueFromArg(f[0]),p=this.getValueFromArg(f[1]),y==null||y==""||p==null||p==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[1].toString()}if(e=this._getDoubleArray(f[0]),o=this._getDoubleArray(f[1]),i=o.length,i<=0||i!=e.length){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[0].toString()}for(r=0,u=0,t=0;t-1)return s;if(h=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1)return h}if(i=this.getValueFromArg(r[1]),u=this.getValueFromArg(r[0]),i==null||i==""||u==""||u==null||Boolean(i=="TRUE"||i=="FALSE")||Boolean(u=="TRUE"||u=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=this._parseDouble(i),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(e=this._parseDouble(i),e==0||e<=0||e>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(o=this._getDoubleArray(r[0]),a=o.length,o.sort(function(n,t){return isNaN(n)||isNaN(t)?n=this._parseDouble((f/(f+1)).toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return c=t*(f+1),c.toString()};this.computePercentileOInc=function(n){var f=this.splitArgsPreservingQuotedCommas(n),a=f.length,e,t,r,o,s,u,h,c,l,i;if(a!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((e=this.formulaErrorStringCheck(f[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)||(e=this.formulaErrorStringCheck(f[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1)))return e;if(r=this.getValueFromArg(f[1]),o=this.getValueFromArg(f[0]),r==null||r==""||o==null||o==""||Boolean(r=="TRUE"||r=="FALSE")||Boolean(o=="TRUE"||o=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=this._parseDouble(r),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(s=this._parseDouble(r),s==0||s<=0||s>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}for(u=this._getDoubleArray(f[0]),h=u.length,u.sort(),c=1/(h-1),l=u[h-1],i=0;it){t=(t-i*c)/c;l=u[i]+t*(u[i+1]-u[i]);break}return l.toString()};this.computeTrimmean=function(n){var r=this.splitArgsPreservingQuotedCommas(n),l=r.length,o,s,t,i,c,e;if(l!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(o=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1)return o;if(s=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)return s}if(i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(i),isNaN(t)&&(t="1"),t>1||t==0||t<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}var h=this._getDoubleArray(r[0]),u=h.length,f=parseInt((t*u).toString());for(f=parseInt(f/2),h.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),c=0,u=u-f,e=f;e-1))return i;if(t[0]==null||t[0]==""||t[1]==null||t[1]==""||Boolean(t[0]=="TRUE"||t[0]=="FALSE")||Boolean(t[1]=="TRUE"||t[1]=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}var r=this._getDoubleArray(t[0]),o=this._getDoubleArray(t[1]),f=r.length;if(f<=0||!isNaN(r)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}if(u=this._pearson(o,r,f).toString(),this.computeIsErr(u)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[3].toString()}return u};this.computeRsq=function(n){var u=this.splitArgsPreservingQuotedCommas(n),r,i,t;if(u.length!=2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(r)>-1))return r;if(i=this.computePearson(n).toString(),t=0,t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)!=-1)return i}else t=t*t;return t.toString()};this.computeHLookUp=function(n){var v=this._isHLookupCachingEnabled(),w=this._isOptimizedMatchesEnabled(),r,s,u,rt,h,b,t,c,k,p,o;if(v&&this._lookupTables==null&&(this.lookupTables=new HashTable),r=this.splitArgsPreservingQuotedCommas(n),r.length>4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if((s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1)||(s=this.formulaErrorStringCheck(r[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(s)>-1))return s;for(t=2;t-1)return s}u=this.getValueFromArg(r[0]);u=u.split(this.tic).join("").toUpperCase();var f=r[1].split('"').join(""),ut=this.getValueFromArg(r[2]).split(this.tic).join(""),l=this._parseDouble(ut);if(isNaN(l))return"#N/A";rt=parseInt(ut);h=!0;r.length==4&&(h=this.getValueFromArg(r[3])==this.trueValueStr);l=this._parseDouble(u);b=h?!isNaN(l):!1;t=f.indexOf(":");t==-1&&(f=f+":"+f,t=f.indexOf(":"));var ft=f.substring(0,t).lastIndexOf(this.sheetToken),et=this.grid,ct=CalcEngine.getSheetFamilyItem(this.grid);if(ft>-1&&(this.grid=ct.tokenToParentObject.getItem(f.substring(0,ft+1))),c=this.rowIndex(f.substring(0,t)),k=this.rowIndex(f.substring(t+1)),!(c!=-1||k==-1)==(c==-1||k!=-1))return this.getErrorStrings()[5].toString();var y=this.colIndex(f.substring(0,t)),ot=this.colIndex(f.substring(t+1)),d=!1,a="",g=null,nt=null;v&&(a=c.toString()+"_"+y.toString()+"_"+ot.toString()+"_"+this.grid.GetHashCode(),this._lookupTables.containsKey(a)||(w?(p=new LookUps,p.setMatchLookUpList(new HashTable),this._lookupTables.add(a,p)):(p=new LookUps,this._lookupTables.add(a,p)),d=!0),g=this._lookupTables.getItem(a).getLinearLookUpList(),w&&(nt=this._lookupTables.getItem(a).getMatchLookUpList()));var i="",tt=y,e="",it=0,st=!0,ht=!1;if(v&&w&&nt.containsKey(u))tt=nt.getItem(u),e=u;else for(o=y;o<=ot;++o){if(!v||o-y>=g.length||d?(e=this.getValueFromParentObject(this.grid,c,o).toString().toUpperCase().split('"').join(""),v&&(g.push(e),w&&nt.add(e,o))):e=g[o-y],it=b?this._parseDouble(e):it,e==u||h&&(b?!isNaN(it)&&it>l:e>u))if(e==u&&(tt=o,h=!0,ht=!0),d)st=!1;else break;st&&(tt=o);h=d=!0}if(h||e==u){if(!ht&&!b)return this.grid=et,"#N/A";if(rt+c-1>k)return"#REF!";i=this.getValueFromParentObject(this.grid,rt+c-1,tt).toString();i.length>0&&i[0]==this.getFormulaCharacter()&&(i=this.parseFormula(i));l=this._parseDouble(i);i.length>0&&i[0]!=this.tic[0]&&isNaN(l)&&(i=i)}else i="#N/A";return this.grid=et,i};this.computeIndex=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,f,i,r,p,l,w,e,o,s,a,v,b,k,d,y;if(h<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((f=this.formulaErrorStringCheck(t[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)||(f=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)||h==3&&(f=this.formulaErrorStringCheck(t[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)))return f;if(i=t[0],i=i.split(this.tic).join(""),r=i.indexOf(":"),r==-1)if(this._isCellReference(i))i=i+":"+i;else{if(i.indexOf(";")>-1){var u=parseInt(this.getValueFromArg(t[1])),g=this._splitArguments(i,";"),c=h==3?parseInt(this.getValueFromArg(t[2])):1;try{return u=u==0?1:u,c=c==0?1:c,p=this.splitArgsPreservingQuotedCommas(g[u-1]),p[c-1]}catch(nt){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[2].toString()}}if(l=this.splitArgsPreservingQuotedCommas(i),!isNaN(u)&&u>0){if(l.length>=u)return parseInt(u.toString())==0?l[0]:l[parseInt(u.toString())-1];if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return"#REF"}if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return(r=i.indexOf(":"),n.indexOf("#N/A")>-1||n.indexOf("#N~A")>-1)?"#N/A":n.indexOf("#DIV/0!")>-1||n.indexOf("#DIV~0!")>-1?"#DIV/0!":(w=this._getSheetTokenFromReference(i),t[1]=h==1||t[1]==""?"1":t[1],t[2]=h<=2||t[2]==""?"1":t[2],t[1]=this.getValueFromArg(t[1]),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],e=parseInt(t[1]),o=isNaN(e)?-1:e,t[2]=this.getValueFromArg(t[2]),t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2],e=parseInt(t[2]),s=isNaN(e)?-1:e,o==-1||s==-1)?"#REF":(a=this.rowIndex(i.substring(0,r)),v=this.rowIndex(i.substring(r+1)),!(a!=-1||v==-1)==(a==-1||v!=-1))?this.getErrorStrings()[5].toString():(b=this.colIndex(i.substring(0,r)),k=this.colIndex(i.substring(r+1)),o>v-a+1||s>k-b+1)?"#REF":(o=this.rowIndex(i.substring(0,r))+o-1,s=this.colIndex(i.substring(0,r))+s-1,d=w+RangeInfo.getAlphaLabel(s)+o,y=this.getValueFromArg(d),this._isTextEmpty(y))?"0":y};this.computeIndirect=function(n){var i=this.splitArgsPreservingQuotedCommas(n),h=i.length,o,r,s,t,f;if(h>2||h==0||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((o=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1)||h==2&&(o=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1)))return o;if(i[0]=i[0].toUpperCase(),i[0]=this.setTokensForSheets(i[0]),r=this._sheetToken(i[0].split(this.tic).join("")),r!=""&&(i[0]=i[0].split(r).join("")),i.length==2&&i[1]==this.falseValueStr){var l=i[0][0]==this.tic&&i[0][n[0].length-1]==this.tic,a=i[0].toUpperCase().split(this.tic).join(""),e=a.split(":"),u=e[0].split("R").join("C").split("C"),c=u.indexOf("");if(c>-1&&u.splice(c,1),u.length>2)return this.getErrorStrings()[2].toString();i[0]=RangeInfo.getAlphaLabel(parseInt(u[1]))+u[0];e.length==2&&(s=this._sheetToken(e[1]),(s!=null||s!="")&&(e[1]=e[1].split(s).join("")),u=e[0].split("R").join("C").split("C"),i[0]+=":"+RangeInfo.getAlphaLabel(parseInt(u[1]))+u[0]);l&&(i[0]=this.tic+i[0]+this.tic)}if(t="",i[0][0]==this.tic)t=r+i[0].split(this.tic).join("");else if(this._isCellReference(i[0])){if(f="",t=this.getValueFromArg(r+i[0]),t==null||t=="")return"0";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,i[0].split(this._string_fixedreference).join("");if(f=this._checkIfScopedRange(t.toUpperCase()),this.getNamedRanges().containsKey(t.toUpperCase()))t=this.getNamedRanges().getItem(t.toUpperCase()),t=t.toUpperCase(),t=t.split(this._string_fixedreference).join(""),t=this.setTokensForSheets(t),t[0]!=this.sheetToken&&(t=r+t);else if(f!="NaN")t=f,t=t.toUpperCase(),t=t.split(this._string_fixedreference).join(""),t=this.setTokensForSheets(t),t[0]!=this.sheetToken&&(t=r+t);else return this._isCellReference(t)?this.getValueFromArg(t):t.indexOf(!1)?this.getErrorStrings()[2].toString():t}else t=i[0];if(!this._isCellReference(t.split(this._string_fixedreference).join("")))if(f="",f=this._checkIfScopedRange(t.toUpperCase()),this.getNamedRanges().containsKey(t.toUpperCase()))t=this.getNamedRanges().getItem(t.toUpperCase()),t[0]!=this.sheetToken&&(t=r+t);else if(f!="NaN")t=f,t[0]!=this.sheetToken&&(t=r+t);else return this.getErrorStrings()[2].toString();return t.indexOf(":")>-1&&this._isInteriorFunction||this.computedValueLevel>1?(this._isInteriorFunction=!this._isInteriorFunction,t.split(this._string_fixedreference).join("")):this.getValueFromArg(t)};this.computeLookUp=function(n){var et=this._isHLookupCachingEnabled(),at=this._isOptimizedMatchesEnabled(),t,y,g,f,nt,it,ot,st,l,rt,p,a,u,o,w,r,k,tt,c,v,d,e;if(et&&this._lookupTables==null&&(this.lookupTables=new HashTable),t=this.splitArgsPreservingQuotedCommas(n),t.length>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(y=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(y)>-1)return y;for(g=1;g-1)return y}f=this.getValueFromArg(t[0]);f=f.split(this.tic).join("").toUpperCase();nt="";it=t[1].split('"').join("");t[2]=(t.length=3)?t[2].split(this.tic).join(""):t[2];var vt=this.getValueFromArg(t[0]),i=[],s=[],yt=this.getValueFromArg(t[2]).split(this.tic).join("");if(t.length==2)if(ot=t[1],st=this.splitArgsPreservingQuotedCommas(t[1]),t[1].indexOf(";")>-1)if(l=this._splitArguments(t[1],";"),l.length==1)for(a=this.splitArgsPreservingQuotedCommas(l[0].toUpperCase()),u=0;u-1)for(o=this.getCellsFromArgs(t[1]),r=0;r-1)for(o=this.getCellsFromArgs(it),r=0;r-1)for(o=this.getCellsFromArgs(b),r=0;rk&&f>i[c]&&k>f||f>i[c])k=f>i[c]?i[c]:i[c+1],tt++;else if(tt!=0)break;if(tt==0)return this.getErrorStrings()[0].toString();f=k}if(v=0,d=0,t.length==3&&t[2].indexOf(":")>-1){for(e=0;e5||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(e=this.formulaErrorStringCheck(u[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)return e;for(s=1;s-1))return e}var t=u[0],i=this._parseDouble(this.getValueFromArg(u[1])),p=isNaN(i)?-1:parseInt(i.toString());i=this._parseDouble(this.getValueFromArg(u[2]));v=isNaN(i)?-1:parseInt(i.toString());w=f>=4?u[3]:"-1";i=parseInt(this.getValueFromArg(w));h=isNaN(i)?1:i;b=f==5?u[4]:"-1";i=parseInt(this.getValueFromArg(b));var c=isNaN(i)?1:i,r=t.indexOf(":"),o=r==-1;o&&(t=t+":"+t,r=t.indexOf(":"));o=o&&c<=1&&h<=1;c==-1&&(o=!0);var d=this._getSheetTokenFromReference(t),l=this.rowIndex(t.substring(0,r))+p,g=this.rowIndex(t.substring(r+1))+p;return!(this.rowIndex(t.substring(0,r))!=-1||this.rowIndex(t.substring(r+1))!=-1)==(this.rowIndex(t.substring(0,r))==-1||this.rowIndex(t.substring(r+1))!=-1)?this.getErrorStrings()[5].toString():(a=this.colIndex(t.substring(0,r))+v,k=this.colIndex(t.substring(r+1))+v,l<=0||a<=0)?this.getErrorStrings()[2].toString():((h>0&&c<0||h<1&&c>1)&&(l=this.rowIndex(this.cell)),k==parseInt(this.computeColumn(t))-1&&(o=!0),y=d+RangeInfo.getAlphaLabel(a)+l,o?this.computedValue(y):y+":"+RangeInfo.getAlphaLabel(a+c-1)+(l+h-1))};this.computeTranspose=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e,c,o,l,s,a,i,t,u,r;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(!this._isCellReference(n)&&!this.getNamedRanges().containsKey(n)&&n.indexOf(";")==-1){if(t=this._splitArguments(n.split(this.tic).join(""),";"),t.length==1)return this.getValueFromArg(this.splitArgsPreservingQuotedCommas(t[0])[0]);if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(f=this.splitArgsPreservingQuotedCommas(n),c=f.length,c!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i="",n.indexOf(";")>-1){for(t=this._splitArguments(n.split(this.tic).join(""),";"),u=1;u-1&&(this.grid=ft.tokenToParentObject[n.substring(0,w+1)]);i=this._getValueComputeFormulaIfNecessary(o+rt,s+it,this.grid);this.grid=ut}return(i==null||i=="")&&(i="0"),i};this.computeEncodeURL=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i,r;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(!this._isCellReference(t[0])&&!this.getNamedRanges().containsKey(t[0])&&t[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(t[0]))&&!Boolean(t[0]=="TRUE"||t[0]=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5]}return r=this._stripTics0(this.getValueFromArg(t[0])),encodeURIComponent(r)};this.computeAnd=function(n){var f=!0,t,e,r,i,u,o,s;if(n==null||n=="")if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];else return this.formulaErrorStrings[this._bad_formula];for(r=this.splitArgsPreservingQuotedCommas(n),i=0;i-1)for(cells=this.getCellsFromArgs(r[i]),u=0;u-1)return cells[u];if(cells[u][0]==this.tic)if(this.getRethrowLibraryComputationExceptions)throw(new this.getErrorStrings)[5].toString();else return this.getErrorStrings()[5].toString();try{if(t=this.getValueFromArg(cells[u]),this.getErrorStrings().indexOf(t)>-1)return t}catch(h){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=f&(t==""?!0:t.split(this.tic).join("").toUpperCase()==this.trueValueStr||(e=this._parseDouble(t))&&e!=0)}else{try{if(t=this.getValueFromArg(r[i]),this.getErrorStrings().indexOf(t)>-1)return t;if(o=Date.parse(t.split(this.tic).join("")),e=this._parseDouble(t.split(this.tic).join("")),isNaN(o)){if(isNaN(e)&&!(t==this._string_empty)&&!(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||t.split(this.tic).join("").toUpperCase()==this.falseValueStr))if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();else return this._isCellReference(r[i])||t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}else return this.trueValueStr}catch(c){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}s=this._parseDouble(t);f=f&(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||!isNaN(s)&&e!=0)}}return f?this.trueValueStr:this.falseValueStr};this.computeFalse=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>0&&t!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.falseValueStr};this.computeIf=function(n){var t=this._string_empty,e=this.splitArgsPreservingQuotedCommas(n),i,u,f,r;if(e.length==1||e.length>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getCellsFromArgs(n),i.length>=2)try{if(t=this.getValueFromArg(i[0]),this.getErrorStrings().indexOf(t)!=-1)return t;if(!this._isCellReference(i[0])&&!isNaN(typeof t=="boolean")&&t.startsWith(this.tic)||this._isCellReference(i[0])&&t.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t.split(this.tic).join("")==this.trueValueStr||(u=this._parseDouble(t))&&u!=0){if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(f)>-1))return f;if(t=this.getValueFromArg(i[1]),t==""&&this.getTreatStringsAsZero())return"0"}else if(t.split(this.tic).join("")==this.falseValueStr||t==""||(u=this._parseDouble(t))&&u==0){if(t=i.length==3?this.getValueFromArg(i[2]):!1,t==""&&this.getTreatStringsAsZero())return"0";if(this.getErrorStrings().indexOf(t)!=-1)return t}else{if(i.indexOf(this.tic)>-1){var o=i[0].indexOf(this.tic)+1,s=i[0].lastIndexOf(this.tic)-1,h=i[0].substring(o,s-o+1);for(r=0;r-1))return r;if(t[0]==this.tic)return this.getValueFromArg(i[0]);try{if(t[0]==this.bMARKER&&(t=t.replace(this.bMARKER," "),t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),t[0]=="NAN"||t[0]=="-NAN"||t[0]=="INFINITY"||t[0]=="-INFINITY"||t[0]=="#"||t[0]=="n#"))return this.getValueFromArg(i[1]);t=i[0];t=this.getValueFromArg(t).toUpperCase().split(this.tic).join(this._string_empty)}catch(u){t=t.toUpperCase()}return t[0]=="NAN"||t[0]=="-NAN"||t[0]=="INFINITY"||t[0]=="-INFINITY"||t[0]=="#"||t[0]=="n#"?this.getValueFromArg(i[1]):this.getValueFromArg(i[0])};this.computeIfNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i=this._string_empty,r;if(u!=2)return this.getFormulaErrorStrings();if(this.computeIsNA(t[0])==this.trueValueStr){if(this.tic.indexOf(t[1])==-1&&!this._isCellReference(t[1])&&!(r=this._parseDouble(t[0]))&&!this.namedRanges.containsKey(t[1]))return this.getErrorStrings()[5].toString();i=this.getValueFromArg(t[1])}else if(this._isRange(t[0]))i=this.getErrorStrings()[1].toString();else{if(this.tic.indexOf(t[0])==-1&&!this._isCellReference(t[0])&&!(r=this._parseDouble(t[0]))&&!this.NamedRanges.ContainsKey(t[0]))return this.getErrorStrings()[5].toString();i=this.getValueFromArg(t[0])}return i[0]==this.tic&&i[length-1]==this.tic&&(i=this.substring(i,1,i.length-2)),i};this.computeNot=function(n){var t=n,i,r=[this.getParseArgumentSeparator(),":"];if(n.length>0&&this._indexOfAny(n,r)>-1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{if(t=this.getValueFromArg(t),this.getErrorStrings().indexOf(t)!=-1)return t;if(t==this.trueValueStr)t=this.falseValueStr;else if(t==this.falseValueStr)t=this.trueValueStr;else{if(isNaN(i=this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}t=Math.abs(i)>1e-10?this.falseValueStr:this.trueValueStr}}catch(u){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return u}return t};this.computeOr=function(n){var e=this.falseValueStr,t,r,u=this.splitArgsPreservingQuotedCommas(n),i,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(i=0;i-1&&this._isCellReference(i))for(cells=this.getCellsFromArgs(u[i]),f=0;f-1&&this._isCellReference(i))for(o=this.getCellsFromArgs(u[i]),f=0;f2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)||r.length==2&&(u=this.formulaErrorStringCheck(r[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(u)>-1)))return u;if(i="",r.length==2){if(!this._isCellReference(r[1])&&!this.namedRanges.containsKey(r[1])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}i=r[1]}else i=this.cell;f=r[0].split(this.tic).join(this._string_empty).toLowerCase();t="";switch(f){case"address":t=this.rowIndex(i).toString()+this.getParseArgumentSeparator()+this.colIndex(i).toString();t=this.computeAddress(t);break;case"col":t=this.computeColumn(i);break;case"contents":t=this.getValueFromArg(i);break;case"filename":t="Not Supported";break;case"row":t=this.computeRow(i);break;case"type":t=this.computeIsBlank(i)==this.trueValueStr?"b":this.computeIsText(i)==this.trueValueStr?"l":"v"}if(t==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return t.toString()};this.computeErrorType=function(n){var t=this._string_empty,r=this._splitArguments(n,this.getParseArgumentSeparator()),u=r.length,i;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1)?i:(t=this._isCellReference(n)?this.getValueFromArg(n):n,t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0])?"#N/A":t=="#NULL!"?"1":t=="#DIV/0!"?"2":t=="#VALUE!"?"3":t=="#REF!"?"4":t=="#NAME?"?"5":t=="#NUM!"?"6":t=="#N/A"?"7":t=="#GETTING_DATA"?"8":"#N/A"};this.computeInfo=function(n){var r=this.splitArgsPreservingQuotedCommas(n),e=r.length,i,u,t,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;u=this._stripTics0(this.getValueFromArg(r[0])).toLowerCase();t=this._string_empty;switch(u){case"directory":t=window.location.toString();break;case"numfile":t=this.getSortedSheetNames()!=null&&CalcEngine._sheetFamiliesList.length==0?this.getSortedSheetNames().length.toString():"1";break;case"origin":f=this.rowIndex(this.cell).toString()+this.getParseArgumentSeparator()+this.colIndex(this.cell).toString();t="$A: "+this.computeAddress(f);break;case"osversion":t=navigator.platform.toString();break;case"recalc":t=this._alwaysComputeDuringRefresh?"Automatic":"Manual";break;case"release":t=this.System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.toString();break;case"system":switch(navigator.appVersion.indexOf()){case navigator.platform:t="unix";break;case navigator.platform:t="mac";break;default:t="pcdos"}break;default:if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return t};this.computeIsBlank=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getValueFromArg(n)==""?this.trueValueStr:this.falseValueStr};this.computeIsErr=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return n=this.getValueFromArg(n).toUpperCase().split(this.tic).join(this._string_empty),n.count>1,(n.startsWith("NAN")||n.startsWith("-NAN")||n.startsWith("INFINITY")||n.startsWith("-INFINITY")||n.startsWith("#")||n.startsWith("n#"))&&!n.startsWith("#N/A")?this.trueValueStr:this.falseValueStr};this.computeIsError=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{n=this.getValueFromArg(n).toUpperCase().split(this.tic).join(this._string_empty)}catch(r){return this.trueValueStr}return n.indexOf("NAN")==0||n.indexOf("-NAN")==0||n.indexOf("INFINITY")==0||n.indexOf("-INFINITY")==1||n.indexOf("#")==0||n.indexOf("n#")==0?this.trueValueStr:this.falseValueStr};this.computeIsEven=function(n){var s=this._string_empty,f=this.splitArgsPreservingQuotedCommas(n),o=f.length,i,t,r,u,e;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(f[0]),t=parseInt(i.split(this.tic).join("")),this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(u=new Date(Date.parse(i)),isNaN(t)&&u.toString()!="invalid Date"&&(t=this._toOADate(u)),e=t,isNaN(t)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return e%2==0?this.trueValueStr:this.falseValueStr};this.computeIsFormula=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,u=this._string_empty,i,r;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(u=this.getValueFromArg(t[0]),this.namedRanges.containsValue(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return r=CalcEngine.getSheetFamilyItem(this.grid),this.isSheetMember()&&r.parentObjectToToken!=null&&(t[0]=r.parentObjectToToken.getItem(this.grid)+t[0]),this.getFormulaInfoTable().containsKey(t[0])?this.trueValueStr:this.falseValueStr};this.computeIsLogical=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return(n=this.getValueFromArg(n),n==this.falseValueStr||n==this.trueValueStr)?this.trueValueStr:this.falseValueStr};this.computeIsNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n=this.getValueFromArg(n),this.getErrorStrings().indexOf(n.toUpperCase())!=-1)return n.toUpperCase()=="#N/A"?this.trueValueStr:this.falseValueStr;try{n=this.getValueFromArg(n).toUpperCase()}catch(i){return this.falseValueStr}return n[0]=="#N/A"?this.trueValueStr:this.falseValueStr};this.computeIsNonText=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.computeIsText(n)==this.trueValueStr?this.falseValueStr:this.trueValueStr};this.computeIsNumber=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return n=this.getValueFromArg(n),isNaN(this._parseDouble(n))?this.falseValueStr:this.trueValueStr};this.computeIsRef=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t.length!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return((this.namedRanges.containsKey(n)||this._isCellReference(n))&&n[0]!=this.tic&&n[length-1]!=this.tic).toString().toUpperCase()};this.computeIsOdd=function(n){var r=this._string_empty,t=0,u=this._splitArguments(n,this.getParseArgumentSeparator()),f=u.length,e=[this.getParseArgumentSeparator(),":"],i;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n!=this._string_empty){if(this._indexOfAny(n,e)!=-1)return"#VALUE!";if(r=this.getValueFromArg(u[0]),t=parseInt(r.split(this.tic).join(this._string_empty)),isNaN(t)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return t%2!=0?this.trueValueStr:this.falseValueStr}return this.trueValueStr};this.computeIsText=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t;if(r>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return i=this._isCellReference(n),t=i?this.getValueFromArg(n):n,(i||t[0]==this.tic)&&t.length>0&&isNaN(this._parseDouble(t))?this.trueValueStr:this.falseValueStr};this.computeN=function(n){var t=this._string_empty,i=0,u,f=this._splitArguments(n,this.getParseArgumentSeparator()),e=f.length,r;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(n),u=new Date(Date.parse(t)),this._parseDouble(t))return i=this._parseDouble(t),i.toString();if(new Date(Date.parse(t))&&(i=this._getSerialDateTimeFromDate(u)),t==this.trueValueStr)i=1;else if(t==this.falseValueStr)i=0;else return this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1?t:isNaN(i)?"0":i.toString();return i.toString()};this.computeNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>0&&t!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return"#N/A"};this.computeSheet=function(n){var o=this.splitArgsPreservingQuotedCommas(n),h=o.length,c=this._string_empty,e,t,i,s;if(h>1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(t=o[0].toUpperCase(),t=t==null||t==this._string_empty?this.cell:t,t==null||t==this._string_empty)return"1";if(this.getErrorStrings().indexOf(t)>-1)return t;if(!this._isCellReference(t)&&!this.namedRanges.containsKey(t)&&this.getSortedSheetNames().indexOf(t)==-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}var r=CalcEngine.getSheetFamilyItem(this.grid),u=this._getSheetTokenFromReference(t),f=0;if(u!=null&&u!=this._string_empty||this.getSortedSheetNames().indexOf(t)!=-1||t.indexOf(this.sheetToken.toString()))if(u.length>0)f=parseInt(u.split(this.sheetToken).join(this._string_empty))+1;else try{for(i=0;i1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=0,t=u[0].toUpperCase(),this.getErrorStrings().indexOf(t)>-1)return t;if(t==null||t==this._string_empty)return this.getSortedSheetNames().length.toString();if(this.getEnableFormulaErrorValidation()){if(r=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(r)>-1)return r}else{if(t.split(this.tic).join(this._string_empty)==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(!this._isCellReference(t)&&!this.namedRanges.containsKey(t)&&this.getSortedSheetNames().indexOf(t)==-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}}try{f=this._splitArguments(t,"!");i=(f.length-1)/2}catch(s){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[2].toString();return this.getErrorStrings()[2].toString()}return i.toString()};this.computeType=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,i=0,t;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(r[0]),t==null||t==this._string_empty){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return n.indexOf(this.getParseArgumentSeparator())>-1?i=64:this.computeIsNumber(t)==this.trueValueStr?i=1:this.computeIsLogical(t)==this.trueValueStr?i=4:this.getErrorStrings().indexOf(t)>-1?i=16:this.computeIsText(t)==this.trueValueStr&&(i=2),i.toString()};this.computeRow=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r=t.length,i;if(r!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(t[0]==this._string_empty)return this.rowIndex(this.cell).toString();if(!this._isCellReference(t[0])&&!this.namedRanges.containsKey(t[0])){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return n.indexOf(":")>-1&&(n=this.getCellsFromArgs(n)[0]),this.rowIndex(n).toString()};this.computeRows=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e,o,s,t,r,i,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1))return e;if(t=1,f[0].indexOf(":")>-1)r=this.getCellsFromArgs(n),o=this.rowIndex(r[0].toString()),s=this.rowIndex(r[r.length-1].toString()),t=s-o+1,t=t>0?t:1;else if(f[0].indexOf(";")>-1)for(i=this._splitArguments(n.split(this.tic).join(this._string_empty),";"),u=1;u5||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var r,e=0,o=0,s=0,u=0,c=0;for(i=0;i.5?1:0,r==0?c=1*(s+o)/((1+r*u)*(1-(e+1))):(l=Math.pow(1+r,e),c=r*(s+o*l)/((1+r*u)*(1-l))),this.computeDollar(c.toString())};this.computeMatch=function(n){var f=this.splitArgsPreservingQuotedCommas(n),v=f.length,e,l,a,r,c,p,u;if(v>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((e=this.formulaErrorStringCheck(f[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1)||(e=this.formulaErrorStringCheck(f[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)))return e;var y=f[1].split(this.tic).join(this._string_empty),w=y.indexOf(":"),t=1;if(v==3){if(this.getEnableFormulaErrorValidation()&&(l=this.formulaErrorStringCheck(f[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1))return l;if(r=this.getValueFromArg(f[2]),r=r.split(this.tic).join(this._string_empty),a=this._parseDouble(r),t=isNaN(a)?1:a,r==this.falseValueStr)t=0;else if(r==this.trueValueStr)t=1;else if(r.includes(this.tic)&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}}var s=this.getValueFromArg(f[0].split(this.tic).join(this._string_empty)).toUpperCase(),o=this.getCellsFromArgs(this._stripTics0(y)),i=1,h="",u;for(c=0;c0){i=-1;break}if((t==0||t==1)&&u==s)break;else if(t==1&&this._matchCompare(s,u)<0){i--;break}else if(t==-1&&this._matchCompare(s,u)>0){i--;break}i++;h==u}return t!=0&&i==o.length+1&&(i=o.length),i>0&&i<=o.length?i.toString():this.getErrorStrings()[0].toString()};this.computeBitAnd=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,f,e,u;try{if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(r[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),t<0||i<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=this._parseDouble(i),(f&e).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBitOr=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,f,e,u;try{if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(r[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),t<0||i<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=this._parseDouble(i),(f|e).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBitLShift=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||Math.abs(u)>53||r<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(u>=0?r<>-u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this._parseDouble(t)<0||this._parseDouble(i)<0?this.getErrorStrings()[4].toString():this.getErrorStrings()[1].toString()}};this.computeBitRShift=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||Math.abs(u)>53||r<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(u>=0?r>>u:r<<-u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this._parseDouble(t)<0||this._parseDouble(i)<0?this.getErrorStrings()[4].toString():this.getErrorStrings()[1].toString()}};this.computeBitXor=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||u>0xffffffffffff||r<0||u<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(r^u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[1].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBinomOInv=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,f;if(c!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;var u,t,i=0,e=0,o=this.getValueFromArg(r[0]),s=this.getValueFromArg(r[1]),h=this.getValueFromArg(r[2]);if(o==""&&(r[0]=o="0"),s==""||h==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(u=this._parseDouble(o.split(this.tic).join("")),t=this._parseDouble(s.split(this.tic).join("")),i=this._parseDouble(h.split(this.tic).join("")),u==0)return"0";if(u<0||t<=0||t>=1||i<=0||i>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(t>0&&t<1&&i>=0&&i<1){if(e=this._critbinom(u,t,i),e==this.maxValue){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._calculation_overflow];return this.formulaErrorStrings[this._calculation_overflow]}}else{if(u<=0||t<=0||t>=1||i<0||i>1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return e.toString()};this.computeChidist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,e,i,r,u;if(o!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i-1))return r;if(n=this.getValueFromArg(n),u=!1,n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,f=this.computeIsNumber(n),f==this.trueValueStr&&(i=n,i.includes("-")&&(u=!0),i=i.includes("u")?i.replace("u",""):i,e=this._parseDouble(i),e>=134217728)){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(n=="0"){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return n=n.includes("-")?n.replace("-",""):n,t=this._computeMath(n,Math.tanh),(t!="#NUM!"||t!="#VALUE!")&&(t=(1/parseFloat(t)).toString()),u&&(t="-"+t),t};this._initLibraryFunctions()},CalcEngine.CalcEngine=function(){},CalcEngine.getFormulaCharacter=function(){return this._formulaChar=='\0'&&(this._formulaChar="="),this._formulaChar},CalcEngine._formulaChar="=",CalcEngine.sheetFamilyID=0,CalcEngine._tokenCount=0,CalcEngine.modelToSheetID=null,CalcEngine._sheetFamiliesList=null,CalcEngine._defaultFamilyItem=null,CalcEngine.createSheetFamilyID=function(){return this.sheetFamilyID==Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},CalcEngine.getSheetFamilyItem=function(n){if(this.sheetFamilyID==0)return CalcEngine._defaultFamilyItem==null&&(CalcEngine._defaultFamilyItem=new GridSheetFamilyItem),CalcEngine._defaultFamilyItem;CalcEngine._sheetFamiliesList==null&&(CalcEngine._sheetFamiliesList=new HashTable);var t=CalcEngine.modelToSheetID.getItem(n);return CalcEngine._sheetFamiliesList.containsKey(t)||CalcEngine._sheetFamiliesList.add(t,new GridSheetFamilyItem),CalcEngine._sheetFamiliesList.getItem(t)},CalcEngine.resetSheetFamilyID=function(){this.sheetFamilyID=0;CalcEngine.modelToSheetID!=null&&(CalcEngine.modelToSheetID.clear(),CalcEngine.modelToSheetID=null);CalcEngine._sheetFamiliesList!=null&&(CalcEngine._sheetFamiliesList.clear(),CalcEngine._sheetFamiliesList=null,this.resetSheetIDs())},CalcEngine.resetSheetIDs=function(){this._tokenCount=0},CalcEngine.unregisterGridAsSheet=function(n,t){var i=CalcEngine.getSheetFamilyItem(t),r=n.toUpperCase(),u;i.sheetNameToParentObject!=null&&i.sheetNameToParentObject.containsKey(r)&&(i.sheetNameToParentObject.remove(r),u=i.sheetNameToToken.getItem(r),i.sheetNameToToken.remove(r),i.tokenToParentObject.remove(u),i.parentObjectToToken.remove(t))},CalcEngine}(jQuery,Syncfusion),function(n){n[n.None=0]="None";n[n.VLOOKUP=1]="VLOOKUP";n[n.HLOOKUP=2]="HLOOKUP";n[n.Both=3]="Both";n[n.OptimizeForMatches=4]="OptimizeForMatches"}(LookupCachingMode||(LookupCachingMode={})),function(n){n[n.FormulaSet=0]="FormulaSet";n[n.NonFormulaSet=1]="NonFormulaSet";n[n.CalculatedValueSet=2]="CalculatedValueSet"}(FormulaInfoSetAction||(FormulaInfoSetAction={}));CalcQuickBase=function(){function n(n){this.resetStaticMembers=n;this._calcQuickID=0;this._controlModifiedFlags=null;this._dataStore=null;this._engine={};this._keyToRowsMap=null;this._keyToVectors=null;this._nameToControlMap=null;this._rowsToKeyMap=null;this._isValueSetEventChanged=!1;this._autoCalc=!1;this._isIE8=!1;this._cellPrefix="!0!A";this._checkKeys=!0;this._disposeEngineResource=!0;this._ignoreChanges=!1;this._leftBrace="{";this._tic='"';this._leftBracket="[";this._rightBracket="]";this._validLeftChars="+-*/><=^(&,";this._validRightChars="+-*/><=^)&,";this.getKeyValue=function(n){if(n=n.toUpperCase(),this.getDataStore().containsKey(n)){var t=this.getDataStore().getItem(n),i=t.getFormulaText();if(i.length>0&&i[0]==CalcEngine.getFormulaCharacter()&&t.calcID!=this.getEngine().getCalcID()){this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString();i=i.substring(1);try{t.setParsedFormula(this.getEngine().parseFormula(this._markKeys(i)))}catch(r){if(this.getCheckKeys())return t.setFormulaValue(r.Message),t.calcID=this.getEngine().getCalcID(),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,t.getFormulaValue(),2)),this.getDataStore().getItem(n).getFormulaValue()}try{t.setFormulaValue(this.getEngine().computeFormula(t.getParsedFormula()))}catch(r){if(this.getThrowCircularException()&&r.toString().indexOf(this.getEngine().formulaErrorStrings[this.getEngine().circular_reference_])==0)throw r;}t.calcID=this.getEngine().getCalcID();this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,t.getFormulaValue(),2))}return this.getEngine().getThrowCircularException()&&this.getEngine().getIterationMaxCount()>0&&t.setFormulaValue(this.getEngine().handleIteration(this.getEngine().cell,t)),this.getDataStore().getItem(n).getFormulaValue()}return this.getKeyToVectors().containsKey(n)?this.getKeyToVectors().getItem(n).toString():""};this.setKeyValue=function(n,t){var i,f,u,e,r,s,c;if(n=n.toUpperCase(),i=this._isIE8?t.toString().replace(/^\s+|\s+$/g,""):t.toString().trim(),!this.getDataStore().containsKey(n)||i.indexOf(this._leftBrace)==0){if(i.indexOf(this._leftBrace)==0){this.getKeyToVectors().containsKey(n)||this.getKeyToVectors().add(n,"");i=i.substring(1,i.length-2);var h=this.getKeyToRowsMap().length+1,o=i.split(this.getEngine().getParseArgumentSeparator()),l="A"+h+":A"+(h+o.length-1);for(this.getKeyToVectors()[n]=l,f=0;f0&&r.getFormulaText()!=i&&(s=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString(),c=this.getEngine().getDependentFormulaCells().getItem(s),c!=null&&this.getEngine().clearFormulaDependentCells(s));i.length>0&&i[0]==CalcEngine.getFormulaCharacter()?(r.setFormulaText(i),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,r.getFormulaValue(),2))):r.getFormulaValue()!=i&&(r.setFormulaText(""),r.setParsedFormula(""),r.setFormulaValue(i),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,r.getFormulaValue(),2)));this.getAutoCalc()&&this.updateDependencies(n)};this.resetKeys=function(){this.getDataStore().clear();this.getKeyToRowsMap().clear();this.getRowsToKeyMap().clear();this.getKeyToVectors().clear();this.getNameToControlMap().clear()};this._checkAdjacentPiece=function(n,t,i){var r=!0;return n=this._isIE8?n.replace(/^\s+|\s+$/g,""):n.trim(),n.length>0&&(r=t.indexOf(n[i?0:n.length-1])>-1),r};this.createEngine=function(){return new CalcEngine(this)};this.dispose=function(){this._dataStore=null;this._rowsToKeyMap=null;this._keyToRowsMap=null;this._keyToVectors=null;this._controlModifiedFlags=null;this._nameToControlMap=null;this.getDisposeEngineResource()&&(this._engine.getDependentFormulaCells().clear(),this._engine.getDependentCells().clear(),this._engine!=null&&this._engine.dispose(),this._engine=null)};this.tryParseAndCompute=function(n){var t="";try{t=this.parseAndCompute(n)}catch(i){t=i.message}return t};this.getFormula=function(n){return(n=n.toUpperCase(),this.getDataStore().containsKey(n))?this.getDataStore().getItem(n).getFormulaText():""};this.getValueRowCol=function(n,t){var u=this.getRowsToKeyMap().getItem(t).toString(),i=this.getKeyValue(u).toString(),r;return i!=null&&i[i.length-1]=="%"&&i.length>1&&(r=this.parseDouble(i.substring(0,i.length-1)),isNaN(r)&&(i=(Number(r)/100).toString())),i};this.initCalcQuick=function(n){this._dataStore=new HashTable;this._rowsToKeyMap=new HashTable;this._keyToRowsMap=new HashTable;this._keyToVectors=new HashTable;this._controlModifiedFlags=new HashTable;this._nameToControlMap=new HashTable;var t=CalcEngine.createSheetFamilyID();this._engine=this.createEngine();n&&(CalcEngine.resetSheetFamilyID(),this._engine.getDependentFormulaCells().clear(),this._engine.getDependentCells().clear());this._cellPrefix="!"+t+"!A";this._engine.registerGridAsSheet(RangeInfo.getAlphaLabel(this.getCalcQuickID()),this,t);this._engine.setCalculatingSuspended(!0);this._engine.ignoreValueChanged=!0;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1};this._markKeys=function(n){for(var t=n.indexOf(this._leftBracket),r,i,u,f;t>-1;)if(r=n.substring(t).indexOf(this._rightBracket)-1,i="",r>0)if(i=n.substring(t+1,r+t+1).toUpperCase(),this.getKeyToVectors().containsKey(i)){if(u=t+r+20?n.substring(0,t):"",this.getCheckKeys()&&!this._checkAdjacentPiece(f,this._validLeftChars,!1))throw"not followed properly"+i;n=f+this.getKeyToVectors().getItem(i).toString()+u;t=n.indexOf(this._leftbraket)}else if(this.getKeyToRowsMap().containsKey(i)){if(u=t+r+20?n.substring(0,t):"",this.getCheckKeys()&&!this._checkAdjacentPiece(f,this._validLeftChars,!1))throw"not followed properly"+i;n=f+"A"+this.getKeyToRowsMap().getItem(i).toString()+u;t=n.indexOf(this._leftBracket)}else if(n.toUpperCase().indexOf(this._tic+this._leftBracket+i+this._rightBracket+this.tic)>0)break;else throw"Unknown key: "+i;else t=-1;return n};this.parseAndCompute=function(n){return n.length>0&&n[0]==this.getEngine().getFormulaCharacter()&&(n=n.substring(1)),this.getEngine().parseAndComputeFormula(this._markKeys(n))};this.refreshAllCalculations=function(){var i,u;if(this.getAutoCalc()){for(this.setDirty(),this.ignoreChanges=!0,i=0;i0&&t[0]==this.getEngine().getFormulaCharacter()&&n.calcID!=this.getEngine().getCalcID()&&(t=t.substring(1),this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(r).toString(),n.setParsedFormula(this.getEngine().parseFormula(this._markKeys(t))),n.setFormulaValue(this.getEngine().computeFormula(n.getParsedFormula())),n.calcID=this.getEngine().getCalcID(),u=parseInt(this.getKeyToRowsMap().getItem(r)),this.getEngine().valueChanged(this,new ValueChangedArgs(u,1,n.getFormulaValue())));this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(r,n.getFormulaValue(),2))}this.ignoreChanges=!1}};this.setDirty=function(){this.getEngine().updateCalcID()};this.setValueRowCol=function(){};this.updateDependencies=function(n){var u,t,i,r;if(this.getAutoCalc()&&(u=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString(),t=this.getEngine().getDependentCells().getItem(u),this.setDirty(),t!=null))for(i=0;i-1&&(r=parseInt(t[i].substring(r+1)),n=this.getRowsToKeyMap().getItem(r).toString(),this.ignoreChanges=!0,this.setKeyValue(n,this.getKeyValue(n)),this.ignoreChanges=!1)};this.initCalcQuick(n)}return n.prototype.getAutoCalc=function(){return this._autoCalc},n.prototype.setAutoCalc=function(n){this._autoCalc=n;this.getEngine().setCalculatingSuspended(!n);this.getEngine().setUseDependencies(n);n&&this.setDirty()},n.prototype.getCalcQuickID=function(){return this._calcQuickID++,this._calcQuickID==Number.MAX_VALUE&&(this._calcQuickID=1),this._calcQuickID},n.prototype.getCheckKeys=function(){return this._checkKeys},n.prototype.setCheckKeys=function(n){this._checkKeys=n},n.prototype.getControlModifiedFlags=function(){return this._controlModifiedFlags},n.prototype.getDataStore=function(){return this._dataStore},n.prototype.getDisposeEngineResource=function(){return this._disposeEngineResource},n.prototype.setDisposeEngineResource=function(n){this._disposeEngineResource=n},n.prototype.getEngine=function(){return this._engine},n.prototype.getFormulaCharacter=function(){return this.getEngine().getFormulaCharacter()},n.prototype.setFormulaCharacter=function(n){this.getEngine().setFormulaCharacter(n)},n.prototype.getKeyToRowsMap=function(){return this._keyToRowsMap},n.prototype.getKeyToVectors=function(){return this._keyToVectors},n.prototype.getNameToControlMap=function(){return this._nameToControlMap},n.prototype.getRowsToKeyMap=function(){return this._rowsToKeyMap},n.prototype.getThrowCircularException=function(){return this.getEngine().getThrowCircularException()},n.prototype.setThrowCircularException=function(n){this.getEngine().setThrowCircularException(n)},n.prototype.getValueSetEventHandler=function(){return this._valueSetEvent==null&&(this._valueSetEvent=new ValueSetEvent),this._valueSetEvent.getValueSet()},n.prototype.setValueSetEventHandler=function(n){this._valueSetEvent==null&&(this._valueSetEvent=new ValueSetEvent);this._valueSetEvent.setValueSet(n)},n}();window.CalcQuick=function(n){function t(){n.apply(this,arguments);this.registerControlArray=function(n){for(var t=0;t0&&t<9;)n--,f="A".charCodeAt(0),u[t]=String.fromCharCode(n%26+f),n=parseInt((n/26).toString()),t++;for(r=[],i=0;i-1&&this.wrapper.find("span:first").hasClass("e-chk-inact")&&(this.checked().splice(n.inArray(this.model.value,this.checked()),1),this._isChecked=!1,this._hiddenInput.setAttribute("name",this.model.name)))},disable:function(){this.wrapper.hasClass("e-disable")||(this.wrapper.addClass("e-disable"),this.wrapper[0].setAttribute("aria-disabled",!0),this.element[0].setAttribute("disabled","disabled"),this._isIE8&&this.span.addClass("e-disable"),this._unWireEvents(),this.model.enabled=!1)},enable:function(){this.wrapper.hasClass("e-disable")&&(this.wrapper.removeClass("e-disable"),this.wrapper[0].setAttribute("aria-disabled",!1),this.element.prop("disabled",!1),this._isIE8&&this.span.removeClass("e-disable"),this._wireEvents(),this.model.enabled=!0)},isChecked:function(){if(this._isChecked!=null&&this._isChecked!=i)return this._isChecked}});t.CheckboxSize={Small:"small",Medium:"medium"};t.CheckState={Check:"check",Uncheck:"uncheck",Indeterminate:"indeterminate"}}(jQuery,Syncfusion),function(n,t){t.widget("ejRadioButton","ej.RadioButton",{_rootCSS:"e-radiobtn",element:null,_requiresID:!0,model:null,validTags:["input"],_addToPersist:["checked"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{id:null,name:null,value:null,checked:!1,cssClass:"",text:"",enableRTL:!1,htmlAttributes:{},enablePersistence:!1,idPrefix:"ej",size:"small",enabled:!0,validationRules:null,validationMessage:null,validationMessages:null,beforeChange:null,change:null,create:null,destroy:null},dataTypes:{id:"string",name:"string",enablePersistence:"boolean",size:"enum",enabled:"boolean",idPrefix:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data"},observables:["checked"],checked:t.util.valueFunction("checked"),_init:function(n){var i=t.browserInfo();this._cloneElement=this.element.clone();this._isIE8=i.name=="msie"&&i.version=="8.0"?!0:!1;this._setValue();this._renderControl();this.isChecked&&this._checkedHandler();t.isNullOrUndefined(this.radbtn.attr("disabled"))||(this.model.enabled=!1);this._setEnabled(this.model.enabled);this._addAttr(this.model.htmlAttributes);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());this._wireEvents();this.initialRender=!1},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.div.addClass(n):t=="name"?i.radbtn.attr(t,n):t=="required"?i.radbtn.attr(t,n):t=="disabled"&&n=="disabled"?i.disable():t=="checked"&&n=="checked"?i._checkedChange(!0,!0):i.div.attr(t,n)})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,i,u,f;this.element.find("input").rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.find("input").attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_setModel:function(t){for(var i in t)switch(i){case"cssClass":this._changeSkin(t[i]);break;case"enableRTL":this.model.text?t[i]?this.div.addClass("e-rtl"):this.div.removeClass("e-rtl")&&this.element.closest(".e-radiobtn-wrap").hasClass("e-rtl")?this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl"):"":t[i]?this.element.closest(".e-radiobtn-wrap").addClass("e-rtl"):this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl");break;case"text":this._setText(t[i]);break;case"size":this._setSize(t[i]);break;case"validationRules":this.model.validationRules!=null&&(this.element.find("input").rules("remove"),this.model.validationMessages=null);this.model.validationRules=t[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=t[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=t[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"checked":n(this.div).removeClass("e-material-animate");typeof this.checked()=="boolean"?(this.model.checked=t[i],this._checkedChange(this.model.checked)):t[i]()!=null&&t[i]()==this.element.find(".e-input").attr("value")&&this._checkedChange(t[i]());break;case"enabled":this._setEnabled(t[i]);break;case"id":this._setIdAttr(t[i]);break;case"name":this.radbtn.attr("name",t[i]);break;case"value":this.radbtn.attr("value",t[i]);break;case"htmlAttributes":this._addAttr(t[i])}},_destroy:function(){this.radbtn.remove();this._cloneElement.removeClass("e-js e-input e-radiobtn");this._cloneElement.insertBefore(this.element);this.element.remove()},_changeSkin:function(n){this.model.cssClass!=n&&(this.element.removeClass(this.model.cssClass).addClass(n),this.div.removeClass(this.model.cssClass).addClass(n))},_setValue:function(){t.isNullOrUndefined(this.element.attr("type"))&&this.element.attr("type","radio");t.isNullOrUndefined(this.element.attr("id"))||(this.model.id=this.element.attr("id"));t.isNullOrUndefined(this.element.attr("name"))||(this.model.name=this.element.attr("name"));t.isNullOrUndefined(this.element.attr("value"))||(this.model.value=this.element.attr("value"));this.element.attr({id:this.model.id,name:this.model.name,value:this.model.value});typeof this.checked()=="boolean"?this.model.checked=this.isChecked=this.model.checked||this.element.attr("checked")=="checked":this.isChecked=this.element.attr("value")==this.checked();this.isChecked&&this.element.attr("checked","checked");this._hiddenValue=this.element.attr("value");this._isAngularbind=!1},_setIdAttr:function(t){n("#"+this.model.idPrefix+this.model.id+"_wrapper").attr("id",this.model.idPrefix+t+"_wrapper");n("#"+this.model.idPrefix+this.model.id).attr("id",this.model.idPrefix+t);this.radbtn.attr("id",t)},_setSize:function(n){n==t.RadioButtonSize.Medium?(this.span.removeClass("e-radsmaller").addClass("e-radmedium"),this.div.removeClass("e-radsmall").addClass("e-radmed")):(this.span.removeClass("e-radmedium").addClass("e-radsmaller"),this.div.removeClass("e-radmed").addClass("e-radsmall"))},_setEnabled:function(n){n?this.enable():this.disable()},_renderControl:function(){this.initialRender=!0;var i=t.browserInfo();this.div=i.name=="msie"&&i.version=="8.0"?n('
<\/div>'):n('
<\/div>');this.div.attr({id:this.model.idPrefix+this.model.id,role:"radio",tabindex:0,"aria-checked":!1});this.span=n("<\/span>");this.span.addClass("e-spanicon");this._setSize(this.model.size);this.spanImg=n('<\/span>',"",{},{role:"presentation"});this.element.addClass("e-input");this.div.addClass(this.model.cssClass);this.span.append(this.spanImg);this.div.insertBefore(this.element);this.div.append(this.element);this.div.append(this.span);this._setTextWrapper(this.model.text);this.radbtn=this.element;this.element=this.div},_setTextWrapper:function(n){n!=""?(this.txtSpan=t.buildTag("div.e-text",n),this.div.append(this.txtSpan),this.model.enableRTL&&this.div.addClass("e-rtl")):this.model.enableRTL&&this.element.closest(".e-radiobtn-wrap").addClass("e-rtl")},_setText:function(n){this.model.text==""&&n!=""?this._setTextWrapper(n):this.txtSpan.html(n)},_wireEvents:function(){this._on(this.element,"click",this._checkedHandler);this._on(this.element,"focus",this._focusIn);this._on(this.element,"focusout",this._focusOut)},_focusIn:function(){n(this.element).addClass("e-focus");n(this.element).on("keydown",n.proxy(this._checkUnCheck,this))},_focusOut:function(){n(this.element).removeClass("e-focus");n(this.element).off("keydown",n.proxy(this._checkUnCheck,this))},_checkUnCheck:function(n){(n.keyCode==32||n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40)&&(n.preventDefault(),this._checkedHandler())},_checkedHandler:function(t){t&&(this._interacted=!0);this.element.hasClass("e-disable")||(this.isChecked=typeof this.checked()=="boolean"?this.radbtn.attr("checked")=="checked"?!0:!1:this.checked()==this.radbtn.attr("value"),n(this.element).find(".e-rad-icon").hasClass("e-circle_01")||this._changeEvent(!0),t&&n(this.div).addClass("e-material-animate"))},_checkedChange:function(n,t){this.isChecked=n;this._changeEvent(t)},_changeEvent:function(t){var r={isChecked:this.isChecked,isInteraction:!!t};if(!this.initialRender&&!0==this._trigger("beforeChange",r))return!1;if(n(this.element).find(".e-rad-icon").hasClass("e-circle_01"))this.spanImg.removeClass("e-circle_01").addClass("e-rad-select"),this.span.removeClass("e-rad-active"),this.div.attr({tabindex:0,"aria-checked":!1}),this.radbtn.removeAttr("checked");else{var u=this.element.find(".e-input").attr("name"),f=n('input.e-radiobtn[name="'+u+'"]:radio'),e=this,o=this.element.find(".e-input"),i=n(o).data("ejRadioButton");r.isChecked&&(this.spanImg.addClass("e-circle_01").removeClass("e-rad-select"),this.span.addClass("e-rad-active"),this.div.attr({tabindex:0,"aria-checked":!0}),this.radbtn.attr("checked","checked"));n.each(f,function(t,i){e._interacted&&n(n(i).closest(".e-widget")).find("span.e-spanicon").hasClass("e-rad-active")&&n(i).closest(".e-radiobtn-wrap").addClass("e-material-animate");n(i).closest(".e-radiobtn-wrap").find(".e-rad-icon").removeClass("e-circle_01").addClass("e-rad-select");n(i).closest(".e-radiobtn-wrap").find(".e-spanicon").removeClass("e-rad-active");n(i).closest(".e-radiobtn-wrap").attr({tabindex:0,"aria-checked":!1});var r=n(i).data("ejRadioButton");r!=null&&r.checked()!=null&&typeof r.checked()=="boolean"&&(r.model.checked=!1)});i!=null&&i.checked()!=null&&typeof i.checked()=="boolean"?i.model.checked=!0:i.checked(i.radbtn.attr("value"));this.element.find(".e-rad-icon").addClass("e-circle_01").removeClass("e-rad-select");this.span.addClass("e-rad-active");this.div.attr({tabindex:0,"aria-checked":!0});this._isAngularbind||this.element.find(".e-input").click();this.isChecked=!0}r={isChecked:this.isChecked,isInteraction:!!t};this.initialRender||this._trigger("change",r);t&&this._trigger("_change",{value:this._hiddenValue})},disable:function(){this.element.hasClass("e-disable")||(this.element.addClass("e-disable"),this.radbtn.attr("disabled","disabled"));this._isIE8&&this.span.addClass("e-disable");this.div.attr("aria-disabled",!0);this.model.enabled=!1},enable:function(){this.element.hasClass("e-disable")&&(this.element.removeClass("e-disable"),this.radbtn.prop("disabled",!1));this._isIE8&&this.span.removeClass("e-disable");this.div.attr("aria-disabled",!1);this.model.enabled=!0}});t.RadioButtonSize={Small:"small",Medium:"medium"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejAutocomplete","ej.Autocomplete",{element:null,model:null,validTags:["input"],_ignoreOnPersist:["fields","dataSource","query","focusIn","focusOut","change","select","create","destroy","open","close","actionComplete","actionSuccess","actionFailure"],_setFirst:!1,_rootCSS:"e-autocomplete",type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"]},_requiresID:!0,defaults:{dataSource:null,query:null,fields:{text:null,key:null,category:null,groupBy:null,htmlAttributes:null},locale:"en-US",name:null,template:null,allowGrouping:!1,enableDistinct:!1,allowSorting:!0,sortOrder:"ascending",htmlAttributes:{},multiSelectMode:"none",delimiterChar:",",allowAddNew:!1,addNewText:"Add New",showRoundedCorner:!1,readOnly:!1,cssClass:"",watermarkText:null,value:"",selectValueByKey:null,filterType:"startswith",caseSensitiveSearch:!1,showLoadingIcon:!0,showResetIcon:!1,itemsCount:0,minCharacter:1,delaySuggestionTimeout:200,showPopupButton:!1,highlightSearch:!1,enableAutoFill:!1,enableRTL:!1,enabled:!0,visible:!0,height:"",width:"",emptyResultText:"No suggestions",animateType:"slide",showEmptyResultText:!0,enablePersistence:!1,popupHeight:"152px",popupWidth:"auto",autoFocus:!1,multiColumnSettings:{enable:!1,showHeader:!0,stringFormat:"{0}",columns:[{field:null,headerText:null,textAlign:"left",headerTextAlign:"left",cssClass:"",type:"string",filterType:"startswith"}]},validationRules:null,validationMessage:null,focusIn:null,focusOut:null,change:null,select:null,create:null,open:null,close:null,destroy:null,actionBegin:null,actionComplete:null,actionSuccess:null,actionFailure:null},dataTypes:{autoFocus:"boolean",watermarkText:"string",locale:"string",cssClass:"string",filterType:"enum",caseSensitiveSearch:"boolean",showLoadingIcon:"boolean",template:"string",allowGrouping:"boolean",enableDistinct:"boolean",allowSorting:"boolean",sortOrder:"enum",allowAddNew:"boolean",addNewText:"string",showRoundedCorner:"boolean",showResetIcon:"boolean",readOnly:"boolean",itemsCount:"number",animateType:"enum",minCharacter:"number",showPopupButton:"boolean",highlightSearch:"boolean",enableAutoFill:"boolean",enableRTL:"boolean",multiSelectMode:"enum",delimiterChar:"string",emptyResultText:"string",showEmptyResultText:"boolean",enabled:"boolean",visible:"boolean",enablePersistence:"boolean",dataSource:"data",query:"data",fields:"data",validationRules:"data",validationMessage:"data",htmlAttributes:"data",multiColumnSettings:"data"},observables:["value","selectValueByKey"],value:t.util.valueFunction("value"),_selectValueByKey:t.util.valueFunction("selectValueByKey"),enable:function(){this.model.enabled||(this.model.enabled=!0,this.target.disabled=!1,this.element.removeClass("e-disable").attr({"aria-disabled":!1}),this.element.removeAttr("disabled"),this.model.showPopupButton&&this.dropdownbutton.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.multiSelectMode=="visualmode"&&this._ulBox.removeClass("e-disable").attr({"aria-disabled":!1}),this.wrapper.removeClass("e-disable-wrap"))},disable:function(){this.model.enabled&&(this._hideResult(),this.model.enabled=!1,this.target.disabled=!0,this.element.attr("disabled","disabled"),this.element.addClass("e-disable").attr({"aria-disabled":!0}),this.model.showPopupButton&&this.dropdownbutton.addClass("e-disable").attr({"aria-disabled":!0}),this.model.multiSelectMode=="visualmode"&&this._ulBox&&this._ulBox.addClass("e-disable").attr({"aria-disabled":!0}),this.wrapper.addClass("e-disable-wrap"))},clearText:function(){this.model.multiSelectMode=="visualmode"&&this._deleteBox(this._ulBox.children("li"));this.element.val("");this._valueChange();this._isFocused?this.element.blur():this._focusOutAction();this._hideResult()},getValue:function(){var n=this.value();return n==null?"":n},getSelectedItems:function(){return this._isFocused&&this.model.multiSelectMode!="visualmode"&&this._updateSelectedItemArray(this.getValue()),this._selectedItems},_setValue:function(i){var r,u,f;if(this._isWatermark||this._hiddenSpan.css("display","none"),(typeof i=="object"||typeof i=="number"&&isNaN(i)||n.trim(i)=="")&&(i=""),this.model.multiSelectMode=="visualmode"&&this._hiddenInput.val(""),this.element.val(""),i)if(this.model.multiSelectMode=="visualmode")if(this._selectedItems=[],this._modelValue=i,this._deleteBox(this._ulBox.children("li")),r=i.split(this.model.delimiterChar),this.element.width(1).val("").removeAttr("placeholder"),this._hiddenInput||(this._hiddenInput=t.buildTag("input#"+this.target.id+"_hidden","",{},{type:"hidden",name:this.element.attr("name")}).insertBefore(this.element)),t.DataManager&&this.model.dataSource instanceof t.DataManager)this._createBoxForObjectType(r);else if(this.suggestionListItems=this.model.dataSource,this.suggestionListItems&&typeof this.suggestionListItems[0]!="object")for(this._hiddenInput.val(i),u=0,f=r.length;u-1)&&this._selectValueByKey(this._selectValueByKey()!=null?this._selectValueByKey()+(o>-1?i:f)+e:(o>-1?i:f)+e),(!(this._hiddenInput.val()==f||f==null)||o>-1)&&this._hiddenInput.val(this._hiddenInput.val()+(f||i)+e),this._modelValue=t.isNullOrUndefined(this.value())?i+e:this.value()+i+e,this.element.val("").removeAttr("placeholder").width(1),this._ulBox.append(this._createBox(i)),this.model.height!=""&&(n(this._ulBox).parent().css("overflow","auto"),this.model.showPopupButton&&this._ulBox.parent()[0].scrollHeight!=0&&this.dropdownbutton.css("height",this._ulBox.parent()[0].scrollHeight)),this._addNewTemplate=null):this.model.multiSelectMode=="delimiter"?(e=this.target.value.lastIndexOf(this.model.delimiterChar),this._typed||this.element.val()==""||u||!this.model.showPopupButton?u?this.element.val(this.element.val()==""?i+this.model.delimiterChar:this.element.val()+i+this.model.delimiterChar):e==-1?this.element.val(this._queryString.substr(0,e+1)+i+this.model.delimiterChar):this.element.val(this._queryString.substr(0,e+this.model.delimiterChar.length)+i+this.model.delimiterChar):!this.model.enableAutoFill||this.showSuggestionBox?this._checkDeli()?this.element.val(this._queryString.substr(0,e)+this.model.delimiterChar+i+this.model.delimiterChar):this.element.val(this.element.val()+this.model.delimiterChar):this._checkDeli()||this.element.val(this.element.val()+this.model.delimiterChar),this._typed=!1):(this.element.val(i),this._selectedItems=[]);this._selectedItems.push(r);this._originalval.push(i);this._moveCaretToEnd(this.element[0])},_removeDuplicates:function(n){return this._selectedItems.length==0?!1:this._selectedItems.indexOf(n)!=-1?!0:void 0},search:function(){this.model.enabled&&this._checkDelimiter()&&(this._hideResult(),this._autoFill=!1,this._queryString=n.trim(this._queryString),this._queryString.length>0&&this._OnTextEnter())},setVisible:function(n){n?this.wrapper.show():this.wrapper.hide()},hide:function(){this._hideResult()},open:function(){this._showFullList()},_changeWatermark:function(n){this._isWatermark?this.element.attr("placeholder",n):this._hiddenSpan.text(n)},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.suggestionList.removeClass(this.model.cssClass).addClass(n)},_setDropdown:function(n){this.model.showPopupButton=n;n?this._renderDropdown():this._destroyDropdown()},_changeHeight:function(n){this.wrapper.height(n)},_changeWidth:function(n){this.wrapper.width(n);this._setListWidth()},_setCulture:function(){this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.addNewText)||(this._localizedLabels.addNewText=this._options.addNewText),t.isNullOrUndefined(this._options.emptyResultText)||(this._localizedLabels.emptyResultText=this._options.emptyResultText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this.model.addNewText=this._localizedLabels.addNewText;this.model.emptyResultText=this._localizedLabels.emptyResultText;this.model.watermarkText=this._localizedLabels.watermarkText},_init:function(n){if(this._options=n,this._setCulture(),!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this.model.fields.groupBy=this.model.fields.groupBy?this.model.fields.groupBy:this.model.fields.category;this._initialize();this._render();this._wireEvents();this.initialRender=!1;this.model.validationRules!=null&&(this._initValidator(),this._setValidation())},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var f,r,i,u,e;if(this.model.validationRules){f=this.model.multiSelectMode=="visualmode"?this._hiddenInput:this.element;f.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=f.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(e in this.model.validationMessage)i==e?u=this.model.validationMessage[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}}},_removeDuplicateValue:function(n){return n.split(this.model.delimiterChar).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]).join(this.model.delimiterChar)},_delimiterChar:function(){return this.model.multiSelectMode!="none"?this.model.delimiterChar:""},_setModel:function(n){var i,o,s,e,f,r,u;for(i in n){switch(i){case"dataSource":this.model.dataSource=null;break;case"watermarkText":this._changeWatermark(n[i]);break;case"delaySuggestionTimeout":this.model.delaySuggestionTimeout=parseInt(n[i]);break;case"value":deli=this._delimiterChar();this.model.multiSelectMode!="none"&&(u=n[i].substr(n[i].length-deli.length)==deli?n[i]:n[i]+deli,n[i]=n[i]==""?this.value():(this.value()?this.value():"")+u,this.model.multiSelectMode=="visualmode"&&(n[i]=n[i].split(deli).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]),n[i]=n[i].join(deli)));this.value(this._setValue(n[i]));this._modelValue=this.value();o=this.model.multiSelectMode=="visualmode"?this._hiddenInput.val():this.element.val();this._changeEvtTrigger(o);this.model.showResetIcon&&this._showReset();break;case"showPopupButton":this._setDropdown(n[i]);break;case"enableRTL":this._RightToLeft(n[i]);break;case"showRoundedCorner":this._setRoundedCorner(n[i]);break;case"readOnly":this._checkReadOnly(n[i]);break;case"delimiterChar":s=this.model.delimiterChar;n[i]=this._validateDelimiter(n[i]);this.model.delimiterChar=n[i];this.element.val(this.value().replace(new RegExp(s,"g"),this.model.delimiterChar));this.value(this.element.val());break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=n[i];this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation());break;case"locale":t.Autocomplete.Locale[n[i]]?(this.model.locale=n[i],this._setCulture(),this._setWatermark()):n[i]=this.model.locale;break;case"filterType":e=[];for(r in t.filterType)t.filterType.hasOwnProperty(r)&&e.push(t.filterType[r]);e.indexOf(n[i])>-1?this.model.filterType=n[i]:n[i]=this.model.filterType;break;case"multiSelectMode":this.model.multiSelectMode=n[i];f=this._delimiterChar();this.model.multiSelectMode!="none"&&(r=this._selectValueByKey(),u=this.value(),u&&(u=u.substr(u.length-f.length)==f?u:u+f,this.value(u),this.model.multiSelectMode=="visualmode"&&this.value(this._removeDuplicateValue(this.value()))),r&&(this._selectValueByKey(r.substr(r.length-f.length)==f?r:r+f),this.model.multiSelectMode=="visualmode"&&this._selectValueByKey(this._removeDuplicateValue(this._selectValueByKey()))));n[i]=="visualmode"?(this.model.validationRules!=null&&this.element.rules("remove"),this.element.val()!=""&&this._isWatermark&&this.element.removeAttr("placeholder"),this._renderBoxModel()):this.element.hasClass("e-visual-mode")&&this._destroyBoxModel();this._setValue(this.value());this._setValidation();t.isNullOrUndefined(this.element.attr("placeholder"))&&this._isWatermark&&this._setWatermark();break;case"enabled":this._disabled(!n[i]);break;case"visible":this.setVisible(n[i]);break;case"height":this._changeHeight(n[i]);break;case"width":this._changeWidth(n[i]);break;case"cssClass":this._changeSkin(n[i]);break;case"itemsCount ":(n[i]<=0||isNaN(n[i]))&&(n[i]=0);break;case"popupHeight":this.suggestionList.css({"max-height":isNaN(n[i])?n[i]:n[i]+"px"});break;case"popupWidth":this.model.popupWidth=n[i];this._setListWidth();break;case"selectValueByKey":deli=this._delimiterChar();r=t.util.getVal(n[i]);this.selectValueByKey(r);keyValue=this.model.multiSelectMode!="none"?this._selectValueByKey()+n[i]:n[i];keyValue=keyValue.split(deli).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]);keyValue=keyValue.join(deli);n[i]=keyValue.substr(keyValue.length-deli.length)==deli?keyValue:keyValue+deli;break;case"htmlAttributes":this._addAttr(n[i]);break;case"emptyResultText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.emptyResultText=this.model.emptyResultText=n[i];this._setCulture();break;case"addNewText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.addNewText=this.model.emptyResultText=n[i];this._setCulture();break;case"multiColumnSettings":t.isNullOrUndefined(n[i].enable)||(this.model.multiColumnSettings.enable=n[i].enable);t.isNullOrUndefined(n[i].showHeader)||(this.model.multiColumnSettings.showHeader=n[i].showHeader);t.isNullOrUndefined(n[i].stringFormat)||(this.model.multiColumnSettings.stringFormat=n[i].stringFormat);t.isNullOrUndefined(n[i].columns)||(this.model.multiColumnSettings.columns=n[i].columns);this.suggestionList.remove();this._renderSuggestionList();break;case"showResetIcon":this.model.showResetIcon=n[i];n[i]&&!t.isNullOrUndefined(this.value())&&this.value()!=""?this._showReset():this._removeReset()}this._hideResult()}},_destroy:function(){this.element.width("").removeAttr("role aria-label aria-expanded aria-haspopup aria-autocomplete autocomplete placeholder aria-owns aria-disabled disabled");this.element.insertAfter(this.wrapper);this.model.multiSelectMode=="visualmode"&&this.element.removeClass("e-visual-mode").attr("name",this._hiddenInput.attr("name"));this.model.enabled||this.element.removeClass("e-disable");this.wrapper.remove();this.element.removeClass("e-input").val("");this._isWatermark&&this.element.removeAttr("placeholder");this._hideResult();this.suggestionList.remove()},_initialize:function(){this.value(this.value()===""?this.element[0].value:this.value());this.element.attr("role","combobox").attr("aria-label","Autocomplete textbox").attr("aria-expanded",!1).attr("tabindex",0).attr("aria-autocomplete","list");/Edge\/12./i.test(navigator.userAgent)&&this.element.addClass("edge-browser");this.target=this.element[0];this.dropdownbutton=null;this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this.showSuggestionBox=!1;this.noresult=!0;this._queryString=null;this.suggLen=0;this._selectedItems=[];this._modelValue="";this._activeItem=0;this._originalval=[];this.ctrlKeyPressed=!1;this._isFocused=!1;this._isOpened=!1;this._typed=!1;this._cancelEvent=!1;this._isWatermark=this._checkWatermarkSupport();this._selectedObj=[]},_render:function(){this._renderWrapper();this._addAttr(this.model.htmlAttributes);this._setDimentions();this._renderDropdown();this._checkProperties();this._isWatermark?this._setWatermark():this._setWatermarkTxt();this._renderSuggestionList();this._RightToLeft(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner);this.setVisible(this.model.visible);this._setListPosition()},_renderWrapper:function(){var n,i;this.element.addClass("e-input").attr("autocomplete","off");this.wrapper=t.buildTag("span.e-atc e-widget "+this.model.cssClass+"#"+this.target.id+"_wrapper").insertAfter(this.element);document.activeElement==this.element[0]&&(n=!0);this.container=t.buildTag("span.e-in-wrap e-box").append(this.element);this.wrapper.append(this.container);this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this.model.watermarkText),this._hiddenSpan.css("display","none"),i=this,this._hiddenSpan.click(function(){this._isFocused||i.element.focus()}));n&&this.element.focus()},_renderDropdown:function(){if(this.model.showPopupButton){var i=t.buildTag("span.e-icon e-search").attr(this._isIE8?{unselectable:"on"}:{});this.dropdownbutton=t.buildTag("span.e-select#"+this.target.id+"_dropdown").attr(this._isIE8?{unselectable:"on"}:{}).append(i);this.container.append(this.dropdownbutton).addClass("e-padding");this.model.enabled||this.dropdownbutton.addClass("e-disable").attr({"aria-disabled":!0});this.dropdownbutton.on("mousedown",n.proxy(this._OnDropdownClick,this))}},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="required"&&i.element.attr(t,n);t=="class"?i.wrapper.addClass(n):t=="name"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._disabled(!0):t=="readOnly"&&n===!0?i._checkReadOnly(!0):i.wrapper.attr(t,n)})},_setDimentions:function(){this.model.height&&this.wrapper.height(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_renderBoxModel:function(){this._ulBox=t.buildTag("ul.e-ul e-boxes");var i=this.model.enabled?"":"e-disable";this._ulBox.addClass(i);this._hiddenInput=t.buildTag("input#"+this.target.id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element);this._hiddenInput.attr("name",this.element.attr("name"));this.element.val("").removeAttr("name").addClass("e-visual-mode");this._isWatermark||this.element.width(1);this.container.prepend(this._hiddenInput,this._ulBox);this.model.height!=""?this.wrapper.height(this.model.height):this.wrapper.height("auto");this._on(this.container,"mousedown",function(t){if(!this.model.enabled)return!1;var i=n(t.target);i.is(this.element)||(t.preventDefault(),this._isFocused||this.element.focus(),i.hasClass("e-options")?(!t.ctrlKey&&i.siblings().hasClass("e-active")&&this._removeActive(),i.hasClass("e-active")?i.removeClass("e-active"):i.addClass("e-active")):this._moveCaretToEnd(this.element[0]));!t.ctrlKey&&(i.hasClass("e-boxes")||i.hasClass("e-input"))&&this._removeActive()})},_destroyBoxModel:function(){this.container.prepend(this.element);this.element.attr({name:this._hiddenInput.attr("name")}).removeAttr("style").removeClass("e-visual-mode");this.wrapper.height(this.model.height);this._hiddenInput.remove();this._hiddenInput=null;this._ulBox.remove();this._off(this.container,"mousedown")},_deleteLastBox:function(){var t=this._ulBox.children(),n=t.last(),i=n.hasClass("e-active");this._removeActive();i?this._deleteBox(n):n.addClass("e-active")},_deleteBox:function(t){for(var s,u,i,f,e,r=0,o=t.length;r0&&(this.suggestionListItems=t.DataManager(this.suggestionListItems).executeLocal(t.Query().take(this.model.itemsCount)));this._checkEmptyList();this._addNewTemplate=null;this.noresult&&this.model.multiSelectMode=="visualmode"&&this.model.allowAddNew&&this.element.val()!=""&&!this._repeatRemove&&(this.noresult=!1,this.suggestionListItems.pop(),this._addNewTemplate=" ("+this.model.addNewText+")",this.suggestionListItems.push(this.element.val()+this._addNewTemplate),this._checkEmptyList());(!this.noresult||this.model.showEmptyResultText)&&this._generateSuggestionList(n)},_generateSuggestionList:function(i){var u=this.suggestionListItems,r,s,b,e,h,c,a,f,o,k,v,y;if(this.model.multiColumnSettings.enable?this._tableColumn.empty()&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv.css("display",""):this.ul.empty(),r=this,s=document.createDocumentFragment(),typeof u[0]!="object"){if(r.model.multiColumnSettings.enable){var p=t.buildTag("tbody"),d=t.buildTag("tr").attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}),g=t.buildTag("td",{},{},{role:"option"});for(e=0,h=u.length;h>e;e++){var c=r.model.highlightSearch&&!r.noresult?r._highlightSuggestion(u[e]):u[e],w=d.clone(),l=g.clone();n(l).attr(r._isIE8?{unselectable:"on"}:{}).attr(u[e]!=u.length-1?{"class":"e-atc-tdbottom"}:{}).html(c);w[0].appendChild(l[0]);p[0].appendChild(w[0]);s.appendChild(p[0]);r.model.showEmptyResultText&&r.model.emptyResultText==c&&r.model.multiColumnSettings.showHeader&&r._tableHeaderDiv.css("display","none")&&n(l).removeClass("e-atc-tdbottom");r._addNewTemplate&&!t.isNullOrUndefined(r._tableHeaderDiv)&&r._tableHeaderDiv.css("display","none")}r._tableColumn[0].appendChild(s)}else{for(b=t.buildTag("li",{},{},{role:"option"}).attr(r._isIE8?{unselectable:"on"}:{}),e=0,h=u.length;h>e;e++)c=r.model.highlightSearch&&!r.noresult?r._highlightSuggestion(u[e]):u[e],a=b.clone(),a[0].innerHTML=c,s.appendChild(a[0]);r.ul[0].appendChild(s)}this._currList=u;this._mapper={txt:null,key:null}}else f=this.model.fields,o={_key:null,_text:null,_attr:null},o._key=f&&f.key?f.key:"key",o._text=f&&f.text?f.text:"text",o._attr=f&&f.htmlAttributes?f.htmlAttributes:"htmlAttributes",this._mapper={txt:o._text,key:o._key},this._currList=[],this.model.fields.groupBy?(k=f&&f.groupBy?f.groupBy:"groupBy",y=t.Query().group(k),this._addSortingQuery(y,"key"),v=t.DataManager(u).executeLocal(y),this._swapUnCategorized(v),v.forEach(function(n,i){if(n.key)if(r.model.multiColumnSettings.enable){var f=t.buildTag("tr.e-category").attr("role","option").attr(r._isIE8?{unselectable:"on"}:{});f.append(t.buildTag("td",n.key).attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}).attr(i!=u.length-1?{"class":"e-atc-tdbottom"}:{}));r._tableColumn.append(f)}else r.ul.append(t.buildTag("li.e-category",n.key).attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}));r._generateLi(n.items,o)})):this._generateLi(u,o);this._getLiTags().length>0&&this._showResult(i)},_swapUnCategorized:function(n){for(var t,r=n.length,i=0;i0;t--)n[t]=n[t-1];return n[t]=n[i],!1}},_generateLi:function(i,r){var u=this,a=document.createDocumentFragment(),y=document.createDocumentFragment(),p,w,b,k,h,e,c,f,v,o,s,l;if(u.model.multiColumnSettings.enable){for(p=u.model.multiColumnSettings.columns.length,this._tableColumn.append(t.buildTag("tbody")),w=t.buildTag("tr"),b=t.buildTag("td"),f=0,v=i.length;v>f;f++)if(o=i[f][r._text],s=i[f][r._key],!t.isNullOrUndefined(o)||u.model.multiColumnSettings.enable){for(k=u._getField(i[f]),h=w.clone(),h[0].className=f%2?"e-atc-trbgcolor":"",e=0;e-1?u._highlightSuggestion(u._getField(i[f],u.model.multiColumnSettings.columns[e].field).toString()):u._getField(i[f],u.model.multiColumnSettings.columns[e].field),c[0].className=(f!=i.length-1?"e-atc-tdbottom ":"")+(e!=u.model.multiColumnSettings.columns.length-1?u.model.enableRTL?"e-atc-tdleft ":"e-atc-tdright ":"")+(u.model.multiColumnSettings.columns[e].cssClass?u.model.multiColumnSettings.columns[e].cssClass:""),c[0].style.textAlign=u.model.multiColumnSettings.columns[e].textAlign?u.model.multiColumnSettings.columns[e].textAlign:"left",y.appendChild(c[0]);h[0].appendChild(y);s&&h.attr("id",s);u._setAttributes(u._getField(i[f],r._attr),h[0]);a.appendChild(h[0]);u._currList=u._currList.concat([i[f]])}n(u._tableColumn).find("tbody")[0].appendChild(a)}else{for(f=0,v=i.length;v>f;f++)o=i[f][r._text],s=i[f][r._key],t.isNullOrUndefined(o)||(u.model.highlightSearch&&(o=u._highlightSuggestion(o)),u.model.template&&(o=u._getTemplatedString(i[f],r._text,o)),l=document.createElement("li"),l.innerHTML+=o,s&&l.setAttribute("id",s),u._setAttributes(u._getField(i[f],r._attr),l),a.appendChild(l),u._currList=u._currList.concat([i[f]]));u.ul[0].appendChild(a)}},_getLiTags:function(){return this.model.multiColumnSettings.enable?this._tableColumn.find("tbody tr:not('.e-category')"):this.ul.children("li:not('.e-category')")},_getTemplatedString:function(n,t,i){for(var r=this.model.template,f=r.indexOf("${"),e=r.indexOf("}");f!=-1&&e!=-1;){var o=r.substring(f,e+1),s=o.replace("${","").replace("}",""),u=this._getField(n,s);t==s&&(u=i);u||(u="");r=r.split(o).join(u);f=r.indexOf("${");e=r.indexOf("}")}return r},_getField:function(n,i){return t.pvt.getObject(i,n)},_setAttributes:function(t,i){if(t){typeof t=="string"&&(t=n.parseJSON(t));for(var r in t)i.setAttribute(r,t[r])}},_setListWidth:function(){var n=this.model.popupWidth;n&&n!="auto"?this.suggestionList.css({width:n}):this.suggestionList.css({width:this.wrapper.width()})},_setListHeight:function(){this.suggestionList.css({"max-height":this.model.popupHeight})},_refreshPopup:function(){this.model.popupWidth=="auto"&&this.wrapper.outerWidth()!=this.suggestionList.outerWidth()&&(this.suggestionList.css({width:this.wrapper.width()}),this._refreshScroller());this._setListPosition()},_showResult:function(r){var u,e,o,f;if(this._refreshScroller(),this._refreshPopup(),this._isOpened)n(document).on("mousedown",n.proxy(this._OnDocumentClick,this));else this.suggestionList.css("display","none"),u=this,clearTimeout(this._typing),this._typing=setTimeout(function(){u.suggestionList[u.model.animateType=="slide"?"slideDown":"fadeIn"](u.model.animateType=="none"?0:300,function(){n(document).on("mousedown",n.proxy(u._OnDocumentClick,u))})},this.model.delaySuggestionTimeout),e=r!=i?{event:r,isInteraction:!0}:{isInteraction:!1},this._trigger("open",e),this.wrapper.addClass("e-active");this._isOpened=!0;this.showSuggestionBox=!0;o=this._getLiTags();this._listSize=o.length;n(window).on("resize",n.proxy(this._OnWindowResize,this));f=t.getScrollableParents(this.wrapper);f[0]!=window&&this._on(f,"scroll",this._hideResult)},_hideResult:function(r){var u,f;this.showSuggestionBox&&(this.showSuggestionBox=!1,this._activeItem=0,clearTimeout(this._hiding),this.element.attr("aria-expanded",!1),u=this,this._isOpened?(this.suggestionList.css("display","none"),f=r!=i?{event:r,isInteraction:!0}:{isInteraction:!1},this._trigger("close",f)):this._hiding=setTimeout(function(){u.model&&u.suggestionList[u.model.animateType=="slide"?"slideUp":"fadeOut"](u.model.animateType=="none"?0:100);u._activeItem=0},this.model.delaySuggestionTimeout),n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this.wrapper.removeClass("e-active"))},_refreshScroller:function(){this.suggestionList.css("height","auto");this.suggestionList.find(".e-content , .e-scroller").removeAttr("style");this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&(n(this._tableColumn).attr("width","auto"),n(this._tableHeader).attr("width","auto"));this.suggestionList.css("display","block");this.model.multiColumnSettings.enable&&(this.scrollerObj.option("height","auto"),this._columnBorderAlign());var i=this.suggestionList.height()>parseInt(n.isNumeric(this.model.popupHeight)?this.model.popupHeight:this.model.popupHeight.replace("px",""))-4;i||this.model.multiColumnSettings.enable&&(this.suggestionList.height()<=this._tableColumn.height()||this.suggestionList.width()<=this._tableColumn.width()||this.model.multiColumnSettings.showHeader&&this.suggestionList.width()<=this._tableHeader.width())?(i&&(this.scrollerObj.model.height=this.model.multiColumnSettings.showHeader&&this._tableHeader?parseInt(this.suggestionList.height())-parseInt(this._tableHeader.height()):this.suggestionList.height()),!this.model.multiColumnSettings.enable&&this.suggestionList.width()0&&this._tableHeader.parent(".e-atc-tableHeaderContent").scrollLeft(this.model.enableRTL?this.suggestionList.find(".e-content")[0].scrollWidth-this.suggestionList.find(".e-content")[0].clientWidth:0))},_columnBorderAlign:function(){var i,t,r;if(this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv.css("display")!="none"){for(this._tableWid=this._tableHeader.outerWidth()>this._tableColumn.outerWidth()?this._tableHeader.outerWidth():this._tableColumn.outerWidth(),this._tableColumn.find("colgroup").remove(),n(this._headerColGroup.children).removeAttr("style"),t=0,r=this._headerColGroup.children.length;tparseInt(this._tableHeader.find("tr:first th").eq(t).outerWidth())?n(this._tableColumn).find("tr:first td").eq(t).outerWidth():this._tableHeader.find("tr:first th").eq(t).outerWidth()});this._tableColumn.append(n(this._headerColGroup).clone());i=this._tableWid>this.suggestionList.width()?this._tableWid:"100%";n(this._tableColumn).attr("width",i);n(this._tableHeader).attr("width",i)}else if(this.model.multiColumnSettings.enable&&!this.model.multiColumnSettings.showHeader){if(n(this._tableColumn).attr("width","auto"),this._tableWid=this._tableColumn.outerWidth(),n(this._headerColGroup.children).removeAttr("style"),i=this._tableWid>this.suggestionList.width()?this._tableWid:"100%",i!="100%"){for(t=0,r=this._headerColGroup.children.length;tc?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e0)return this.model.multiColumnSettings.enable?this._textFormateString(this._currList[this._activeItem-1]):!t.isNullOrUndefined(this._mapper)&&this._mapper.txt?this._getField(this._currList[this._activeItem-1],this._mapper.txt):this._currList[this._activeItem-1]},_getUniqueKey:function(){var n=null;return t.isNullOrUndefined(this._mapper)||(this._mapper.key&&(n=this._getField(this._currList[this._activeItem-1],this._mapper.key)),t.isNullOrUndefined(n)&&(n=null)),n},_setTextBoxValue:function(){var t,f,i,e,r,u;this._activeItem&&!this.noresult&&(t=this.model.multiColumnSettings.enable?this._textFormateString(this._currList[this._activeItem-1]):this.getActiveText(),f=this._getCaretSelection(),this.suggLen=f.start,i=this.target.value.substr(0,this.suggLen),r=this.target.value.lastIndexOf(this.model.delimiterChar),u=r==-1?n.trim(i.substr(r+1,this.suggLen)):n.trim(i.substr(r+this.model.delimiterChar.length,this.suggLen)),i&&(i.toLowerCase()==t.substr(0,this.suggLen).toLowerCase()||u.toLowerCase()==t.substr(0,this.suggLen-(r+this.model.delimiterChar.length)).toLowerCase())?(e=this.model.multiSelectMode=="delimiter"?i+t.substr(u.length,t.length):i+t.substr(i.length,t.length),this.element.val(e),this._autofilSelection(),this.model.multiSelectMode=="visualmode"&&(this._adjustWidth(),this.model.enableAutoFill&&this._refreshPopup()),this.model.autoFocus&&!this.noresult&&this._addListHover()):(this.model.multiSelectMode=="delimiter"&&t&&u?this.element.val(this.element.val().replace(u,t)):t&&this.element.val(t),this._removeSelection()))},_enterTextBoxValue:function(n){var t,i,r;!this._activeItem||this.noresult||this.model.readOnly||(t=this.getActiveText(),i=this._currList[this._activeItem-1],this._preVal=t+(this.model.multiSelectMode=="delimiter"?this.model.delimiterChar:""),this._valueToTextBox(t,i,!1),r=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val()==""?null:this.element.val(),this._trigger("select",{event:n,isInteraction:!0,value:r,text:t,key:this._getUniqueKey(),item:i}),this._valueChange(n),this.model.showResetIcon&&this._showReset());this._isOpened&&this._trigger("close",{event:n,isInteraction:!0})},_createBox:function(i){var r=t.buildTag("span.e-icon e-close"),u=t.buildTag("li.e-options",i).append(r);return this._on(r,"click",function(t){if(!this.model.enabled)return!1;this._deleteBox(n(t.target).parent())}),u},_addLoadingClass:function(){this.model.showLoadingIcon&&this.element.addClass("e-load")},_removeLoadingClass:function(){this.element.removeClass("e-load")},_highlightSuggestion:function(t){var o,s,u,e,f,i,h,r,c;if(n.trim(this._queryString)!=""&&(o=this.model.caseSensitiveSearch?"g":"gi",i=n.trim(this._queryString),i=/^[a-zA-Z0-9- ]*$/.test(i)?i:i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),s=this.model.filterType=="startswith"?"^"+i:this.model.filterType=="endswith"?i+"$":i,u=new RegExp(s,o),u.test(t)))for(e=t.match(u),h=t.replace(u,"~^"),f=h.split("~^"),t="",r=0,c=f.length;c>r;r++)t+=e[r]?f[r]+""+e[r]+"<\/span>":f[r];return t},_RightToLeft:function(n){n?(this.wrapper.addClass("e-rtl"),this.suggestionList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.suggestionList.removeClass("e-rtl"));this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&(this._tableHeaderDiv.removeClass(n?"e-atc-tableHeaderRTL":"e-atc-tableHeaderScroll"),this._tableHeader.find("tr :not(th:last)").addClass(n?"e-atc-thleft":"e-atc-thright").removeClass(n?"e-atc-thright":"e-atc-thleft"))},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.suggestionList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.suggestionList.removeClass("e-corner"))},_checkReadOnly:function(n){this.model.readOnly=n;this.model.readOnly?(this.element.attr({readonly:"readonly","aria-readonly":!0}),this._off(this.element,"keydown",this._OnKeyDown),this._off(this.element,"keyup",this._OnKeyUp),this._off(this.element,"paste",this._OnPaste),this._off(this.element,"keypress",this._onkeyPress)):(this.element.removeAttr("readonly aria-readonly"),this._on(this.element,"keydown",this._OnKeyDown),this._on(this.element,"keyup",this._OnKeyUp),this._on(this.element,"paste",this._OnPaste),this._on(this.element,"keypress",this._onkeyPress))},_onkeyPress:function(n){n.keyCode==13&&this._PreventDefaultAction(n)},_OnPaste:function(n){var t=this;setTimeout(function(){t._OnKeyUp(n)},0)},_OnKeyDown:function(t){var f;this.model.filterType!="startswith"&&(this.model.enableAutoFill=!1);switch(t.keyCode){case 37:case 35:case 36:this._removeSelection();break;case 38:this.showSuggestionBox&&this.suggestionList&&(this._removeListHover(),this._activeItem>1?this._activeItem-=1:this._activeItem=this._listSize,this._navigationHover());this._PreventDefaultAction(t);break;case 40:this.showSuggestionBox&&this.suggestionList?(this._removeListHover(),this._activeItemthis._listSize&&(this._activeItem=this._listSize);this._navigationHover()}this._PreventDefaultAction(t);break;case 8:n.trim(this.element.val())==""&&(this._isOpened=!1);this.model.multiSelectMode=="visualmode"&&this.element.val()==""&&this._deleteLastBox();break;case 17:this.ctrlKeyPressed=!0;break;case 9:this.showSuggestionBox&&(this._queryString=this.element.val(),this._enterTextBoxValue(t),this._hideResult(t),this._isOpened=!1,this._PreventDefaultAction(t));break;case 27:this._isOpened=!1;f=this.showSuggestionBox;this._hideResult(t);this._PreventDefaultAction(t);f&&this._trigger("close",{event:t,isInteraction:!0})}this.model.multiSelectMode=="visualmode"&&(t.keyCode!=17&&t.keyCode!=8&&t.keyCode!=46&&this._removeActive(),this._adjustWidth())},_PreventDefaultAction:function(n){n.preventDefault();this._cancelEvent||(n.stopPropagation(),n.cancelBubble=!0,n.returnValue=!0)},_bubbleEvent:function(n){return typeof n=="boolean"&&(this._cancelEvent=n),this._cancelEvent},_navigationHover:function(){this._addListHover();this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this._queryString=this.target.value,this._setTextBoxValue())},_OnKeyUp:function(t){if(this._keyDownComplete(t),this.ctrlKeyPressed&&t.type!="paste")return t.keyCode==17&&(this.ctrlKeyPressed=!1),!1;if(n.trim(this.element.val())==""&&t.keyCode==38&&t.keyCode==40)return this._hideResult(t),!1;if(!this._checkDelimiter())return!1;this._queryString=n.trim(this._queryString);switch(t.keyCode){case 34:case 33:case 38:case 40:case 37:case 39:case 20:case 16:case 17:case 18:case 35:case 36:case 144:case 9:case 27:break;case 13:t.preventDefault();this._queryString=this.element.val();this._enterTextBoxValue(t);this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this.suggLen=this.element.val().length,this._autofilSelection());this._isOpened=!1;this._hideResult(t);break;case 46:if(this.model.multiSelectMode=="visualmode"&&this.element.val()==""){this._deleteBox(this._ulBox.children("li.e-active"));break}case 8:this._queryString.length>=this.model.minCharacter?(this._autoFill=!1,this._OnTextEnter(t)):(this.noresult=!0,this._hideResult(t),n.trim(this.element.val())==""&&(this._isOpened=!1));this._typed=!0;break;default:this._queryString.length>=this.model.minCharacter?(this._autoFill=!0,this._OnTextEnter(t)):this.noresult=!0;this._typed=!0}},_getFilteredList:function(n,i){var u,r;clearTimeout(this.timeDelay);t.isNullOrUndefined(n)||typeof n[0]!="object"||(u=this.model.fields.text?this.model.fields.text:"text",this.model.actionFailure&&t.isNullOrUndefined(t.DataManager(n).executeLocal(t.Query().select(u))[0])&&this._trigger("actionFailure",{error:this._localizedLabels.actionFailure}));!n||!n.length||n.length<1?(this.suggestionListItems=[],this.model.actionFailure&&this._trigger("actionFailure",{error:this._localizedLabels.actionFailure})):(r=t.Query(),this._addQuery(r,typeof n[0]=="object"),this.suggestionListItems=t.DataManager(n).executeLocal(r),this.model.actionSuccess&&this._trigger("actionSuccess"));this._doneRemaining(i);this.model.actionComplete&&this._trigger("actionComplete")},_performSearch:function(n){var i,r;this.model.actionBegin&&this._trigger("actionBegin");i=this.model.dataSource;t.DataManager&&i instanceof t.DataManager?i.dataSource.offline||i.dataSource.json&&i.dataSource.json.length>0?(this._getFilteredList(i.dataSource.json,n),this._selectedObj.push(i.dataSource.json)):(window.clearTimeout(this.timer),r=this,this.timer=window.setTimeout(function(){r._fetchRemoteDat(i)},700)):this._getFilteredList(i,n)},_fetchRemoteDat:function(n){var t=this,i,r=this._getQuery();this._addQuery(r,!0);i=n.executeQuery(r);i.fail(function(n){t.suggestionListItems=null;t._removeLoadingClass();t._trigger("actionFailure",n)}).done(function(n){t.suggestionListItems=n.result;t.model.multiSelectMode=="none"?t._selectedObj=n.result:t.model.multiSelectMode=="delimiter"&&(t._selectedObj=t._selectedObj.concat(n.result));t._doneRemaining(n);t._trigger("actionSuccess",n)}).always(function(n){t._trigger("actionComplete",n)})},_addSortingQuery:function(n,t){if(this.model.allowSorting){var i=this.model.sortOrder=="descending"?!0:!1;n.sortBy(t,i)}},_addQuery:function(n,i){var u="",f,o,e,s,r;if(i&&(e=this.model.fields,u=e&&e.text?e.text:"text"),this._queryString)if(this.model.multiColumnSettings.enable)if(this._columnsIndex(),i){for(u=[],r=0,s=this._columnIndex.length;r0&&i.select(u);t.isNullOrUndefined(this.model.dataSource.dataSource.url)||this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query.clone();return i},_OnTextEnter:function(n){var i=this;t.isDevice()?(clearTimeout(this.timeDelay),this.timeDelay=setTimeout(function(){i._onTextProcess(n)},i.model.delaySuggestionTimeout)):i._onTextProcess(n)},_onTextProcess:function(n){this._addLoadingClass();this.element.attr("aria-expanded",!1);this._performSearch(n);this.model.showResetIcon&&this._showReset()},_showReset:function(){t.isNullOrUndefined(this.resetSpan)&&(this.resetSpan=t.buildTag("span.e-icon e-iclose"),this.model.showPopupButton?(this.dropdownbutton.before(this.resetSpan),this.container.addClass("e-popup e-reset")):this.container.append(this.resetSpan).addClass("e-reset"));this._on(this.resetSpan,"mousedown",this._refreshSearch)},_refreshSearch:function(){this.resetSpan=null;this.clearText();this._refreshPopup()},_removeReset:function(){this.resetSpan=this.resetSpan&&this.resetSpan[0].remove();this._refreshPopup()},_doneRemaining:function(n){this._showSuggestionList(n);this.element.attr({"aria-expanded":!0,"aria-haspopup":!0});(this.model.enableAutoFill&&this._autoFill&&!this.noresult||this.model.autoFocus)&&(this.element.attr("aria-autocomplete","both"),this._activeItem=1,this._queryString=this.target.value);this.model.enableAutoFill&&this._autoFill&&!this.noresult&&this._setTextBoxValue();this.model.autoFocus&&!this.noresult&&this._addListHover();this._removeLoadingClass();this.noresult&&!this.model.showEmptyResultText&&this._hideResult(n)},_removeRepeated:function(){var r=this.suggestionListItems,i,e,u,n,f;if(!r||r.length==0||this._selectedItems.length==0||this.suggestionListItems.length==1&&this.suggestionListItems[0]==this.element.val()+this._addNewTemplate)return!1;for(this._repeatRemove=!1,i=0,e=this._selectedItems.length;i0?f:i)):this._createBoxForObjectType(r))},_keyDownComplete:function(n){var t=this.element.val();this._preVal!=t&&(this._preVal=t,this.model.multiSelectMode=="visualmode"&&this._adjustWidth(),this._valueChange(n))},_moveCaretToEnd:function(n){var t,i;n.scrollLeft=n.scrollWidth;n.createTextRange&&(t=n.createTextRange(),t.moveEnd("textedit"),t.moveStart("textedit"),t.select());typeof n.selectionStart=="number"?n.selectionStart=n.selectionEnd=n.value.length:typeof n.createTextRange!="undefined"&&(i=n.createTextRange(),i.collapse(!1),i.select())},_getCaretSelection:function(){var n=this.element[0],u=0,f=0,e,t,i,r,o;return isNaN(n.selectionStart)?(e=document.selection.createRange().getBookmark(),t=n.createTextRange(),t.moveToBookmark(e),i=n.createTextRange(),i.collapse(!0),i.setEndPoint("EndToStart",t),r=i.text.length,o=t.text.length,{start:r,end:r+o}):(u=n.selectionStart,f=n.selectionEnd,{start:Math.abs(u),end:Math.abs(f)})},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_wireEvents:function(){this._on(this.element,"focus",this._targetFocus);this._on(this.element,"blur",this._targetBlur)}});t.Autocomplete.Locale=t.Autocomplete.Locale||{};t.Autocomplete.Locale["default"]=t.Autocomplete.Locale["en-US"]={addNewText:"Add New",emptyResultText:"No suggestions",actionFailure:"The specified field doesn't exist in given data source",watermarkText:""};t.filterType={StartsWith:"startswith",Contains:"contains",EndsWith:"endswith",LessThan:"lessthan",GreaterThan:"greaterthan",LessThanOrEqual:"lessthanorequal",GreaterThanOrEqual:"greaterthanorequal",Equal:"equal",NotEqual:"notequal"};t.SortOrder={Ascending:"ascending",Descending:"descending"};t.MultiSelectMode={None:"none",Delimiter:"delimiter",VisualMode:"visualmode"};t.Animation={None:"none",Slide:"slide",Fade:"fade"};t.Type={Number:"number",String:"string",Boolean:"boolean",Date:"date"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejDatePicker","ej.DatePicker",{element:null,_rootCss:"e-datepicker",model:null,validTags:["input","div","span"],_setFirst:!1,_addToPersist:["value"],_cancelValue:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{dayHeaderFormat:"min",showPopupButton:!0,enableAnimation:!0,showFooter:!0,displayInline:!1,htmlAttributes:{},dateFormat:"",watermarkText:"Select date",value:null,minDate:new Date("01/01/1900"),maxDate:new Date("12/31/2099"),startLevel:"month",depthLevel:"",cssClass:"",startDay:-1,stepMonths:1,locale:"en-US",showOtherMonths:!0,enableStrictMode:!1,enablePersistence:!1,enabled:!0,width:"",height:"",enableRTL:!1,showRoundedCorner:!1,headerFormat:"MMMM yyyy",buttonText:"Today",readOnly:!1,specialDates:null,fields:{date:"date",tooltip:"tooltip",iconClass:"iconClass",cssClass:"cssClass"},showTooltip:!0,showDisabledRange:!0,highlightSection:"none",highlightWeekend:!1,validationRules:null,validationMessage:null,validationMessages:null,allowEdit:!0,tooltipFormat:"ddd MMM dd yyyy",allowDrillDown:!0,blackoutDates:[],beforeDateCreate:null,open:null,close:null,select:null,change:null,focusIn:null,focusOut:null,beforeOpen:null,beforeClose:null,navigate:null,create:null,destroy:null},dataTypes:{startDay:"number",stepMonths:"number",showOtherMonths:"boolean",enableStrictMode:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",displayInline:"boolean",showPopupButton:"boolean",locale:"string",readOnly:"boolean",cssClass:"string",dateFormat:"string",watermarkText:"string",headerFormat:"string",buttonText:"string",specialDates:"data",showTooltip:"boolean",highlightSection:"enum",highlightWeekend:"boolean",enableAnimation:"boolean",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data",tooltipFormat:"string",allowEdit:"boolean",allowDrillDown:"boolean"},_renderPopup:function(){this.sfCalendar=t.buildTag("div.e-datepicker e-popup e-widget "+this.model.cssClass+" e-calendar "+(this.model.specialDates?this.model.specialDates[0][this._mapField._icon]?"e-icons ":"":""),"",{},{id:this._id?"e-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{}).insertBefore(this.element);this.model.displayInline&&!this.element.is("input")&&this.sfCalendar.addClass("e-inline");this.popup=this.sfCalendar;t.isTouchDevice()||this.sfCalendar.addClass("e-ntouch");this._setRestrictDateState(this.model.showDisabledRange);this._createCalender();this._setDisplayInline(this.model.displayInline);this._resizeCalender();this._setRTL(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner);this._wireCalendarEvents()},_setModel:function(i){var r,o;t.isNullOrUndefined(this.sfCalendar)&&this._renderPopup();var u=!1,f=!1,e=!1;for(r in i)switch(r){case"dayHeaderFormat":this.model.dayHeaderFormat=i[r];u=f=!0;break;case"showPopupButton":this._renderDateIcon(i[r],!0);break;case"displayInline":if(i[r]||this._bindDateButton(),this._setDisplayInline(i[r]),!this.model.allowEdit&&!i[r]&&this._isInputBox)this.element.on("mousedown",n.proxy(this._showDatePopUp,this));break;case"value":t.isPlainObject(i[r])&&(i[r]=null);t.isNullOrUndefined(i.minDate)&&t.isNullOrUndefined(i.maxDate)?(this._setDateValue(i[r]),this._specificFormat()&&(this._stopRefresh=!0),i[r]=this.model.value):this._updateDateValue(i[r]);e=u=f=!0;break;case"specialDates":this.model.specialDates=i[r];this._createSpecialDateObject();u=f=!0;break;case"fields":this.model.fields=i[r];this._mapField=this._getMapper();u=f=!0;break;case"showTooltip":this.model.showTooltip=i[r];u=f=!0;break;case"highlightWeekend":this.model.highlightWeekend=i[r];u=f=!0;break;case"highlightSection":this.model.highlightSection=i[r];u=f=!0;break;case"dateFormat":this.model.dateFormat=i[r];this._ensureValue();break;case"minDate":this._setMinDate(i[r]);i[r]=this.model.minDate;this._ensureValue();e=u=f=!0;break;case"maxDate":this._setMaxDate(i[r]);i[r]=this.model.maxDate;this._ensureValue();e=u=f=!0;break;case"locale":this.model.locale=i[r];this.model.startDay=t.isNullOrUndefined(this._options.startDay)&&this.model.startDay===this.culture.calendar.firstDay?-1:this._options.startDay===this.defaults.startDay?-1:this.model.startDay;this.model.dateFormat=t.isNullOrUndefined(this._options.dateFormat)&&this.model.dateFormat===this.culture.calendar.patterns.d?"":this.model.dateFormat;this._setCulture(i[r]);this.model.value&&this._setDateValue(this.model.value);i[r]=this.model.locale;u=f=!0;break;case"showOtherMonths":this.model.showOtherMonths=i[r];this._otherMonthsVisibility();break;case"enableStrictMode":this.model.enableStrictMode=i[r];e=u=f=!0;break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"readOnly":this.model.readOnly=i[r];this._disbleMaualInput();break;case"width":this._setWidth(i[r]);break;case"height":this._setHeight(i[r]);break;case"cssClass":this._setSkin(i[r]);break;case"enableRTL":this._setRTL(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enabled":i[r]?this.enable():this.disable();break;case"buttonText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.buttonText=this.model.buttonText=i[r];this._localizedLabels.buttonText=this.model.buttonText;this._setFooterText(i[r]);break;case"showFooter":this._enableFooter(i[r]);break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.watermarkText=this.model.watermarkText=i[r];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"startDay":o=i[r];(parseInt(i[r])<0||parseInt(i[r])>6)&&(i[r]=this.culture.calendar.firstDay,o=-1);this.model.startDay=i[r];t.isNullOrUndefined(this._options)&&(this._options={});this._options.startDay=o;u=f=!0;break;case"startLevel":this.model.startLevel=i[r];u=f=!0;break;case"headerFormat":this.model.headerFormat=i[r];u=f=!0;break;case"depthLevel":this.model.depthLevel=i[r];u=f=!0;break;case"htmlAttributes":this._addAttr(i[r]);break;case"allowEdit":this._changeEditable(i[r]);break;case"tooltipFormat":this.model.tooltipFormat=i[r];u=f=!0;break;case"allowDrillDown":this._allowQuickPick(i[r]);u=f=!0;break;case"showDisabledRange":this._setRestrictDateState(i[r]);break;case"blackoutDates":this.model.blackoutDates=i[r];this._initDisableObj(this.model.blackoutDates);u=f=!0}e&&(this._validateMinMaxDate(),i.value=this.model.value,i.maxDate=this.model.maxDate,i.minDate=this.model.minDate);this._setWaterMark();u&&(this.isValidState||this.model.displayInline)&&this._refreshDatepicker();f&&this._startLevel(this.model.startLevel);this._triggerChangeEvent();this._checkErrorClass()},observables:["value"],_destroy:function(){this.model.displayInline&&n(window).off("resize",n.proxy(this._OnWindowResize,this));this._isOpen&&this.hide();this.sfCalendar&&this.sfCalendar.remove();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove());this._cloneElement.removeClass("e-js e-input").removeClass(t.util.getNameSpace(this.sfType));this._cloneElement.insertAfter(this.element);this.element.remove()},_init:function(n){this._options=n;this._cloneElement=this.element.clone();this._dt_drilldown=!1;this._ISORegex();this._initDisableObj(this.model.blackoutDates);this.animation={open:{duration:200},close:{duration:100}};this._animating=!1;this._isInputBox=this._isInputBox();this._isSupport=document.createElement("input").placeholder==r?!1:!0;this._checkAttribute();this._setValues();this._createDatePicker();t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());n&&n.value!=r&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,i,u,f;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_checkAttribute:function(){for(var u=["min","max","readonly","disabled"],f=["minDate","maxDate","readOnly","enabled"],i,n,r=0;r6)&&(this.model.startDay=0);this.Date.firstDayOfWeek=this.model.startDay;this.Date.fullYearStart="20";this._showHeader=!0;t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value);this._validateMinMaxDate();this._dateValue=new Date(this._calendarDate.toString());this._isIE7=this._checkIE7();this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._isIE9=t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0"?!0:!1;this._getInternalEvents=!1;this._flag=!0;this._ejHLWeekEnd=!1;this._isOpen=!1;this._prevDate=null;this._preValue=null;this._isFocused=!1},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r.disable():u=="readOnly"&&n=="readOnly"?r.model.readOnly=!0:u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_createDatePicker:function(){this._createWrapper();this._wireEvents();this.model.displayInline&&this.show();this.model.enableRTL&&this._setRTL(!0);this.model.showRoundedCorner&&this._setRoundedCorner(!0)},_checkNameAttr:function(){!this.element.attr("name")&&this._isInputBox&&this.element.attr("name",this.element[0].id);this.model.displayInline&&!this._isInputBox&&this._hiddenInput.attr("name",this.element[0].id)},_createWrapper:function(){if(this._getMapper(),this.model.specialDates&&this._createSpecialDateObject(),this._isInputBox&&(this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0"}),this.wrapper=t.buildTag("span.e-datewidget e-widget "+this.model.cssClass),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.innerWrapper=t.buildTag("span.e-in-wrap e-box e-padding"),this.wrapper.append(this.innerWrapper).insertBefore(this.element),this.innerWrapper.append(this.element),this.dateIcon=t.buildTag("span.e-select#"+this._id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-icon e-calendar","",{},{"aria-label":"Select"}).attr(this._isIE8?{unselectable:"on"}:{})).insertAfter(this.element)),!this._isSupport||this.model.displayInline&&!this._isInputBox){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._isInputBox&&this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}this._checkNameAttr();this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this._setHeight(this.model.height);this._setWidth(this.model.width);this._id&&n("#e-"+this._id).remove();this._setDateValue(this.model.value);this._preValue=this._parseDate(this.element.val(),this.model.dateFormat);this._setWaterMark();this._dateValue=new Date(this._calendarDate.toString());this.model.displayInline?this._renderPopup():this._isInputBox&&this._renderDateIcon(this.model.showPopupButton,!1);this.model.readOnly&&this._disbleMaualInput();this.model.enabled?this.model.enabled&&n(this.element).hasClass("e-disable")&&this.enable():this.disable();this._layoutChanged();this._checkErrorClass();this._addAttr(this.model.htmlAttributes)},_isInputBox:function(){return this.element.is("input")&&(this.element.is("input[type=text]")||!this.element.attr("type"))},_renderDateIcon:function(n,t){t&&this.model.showPopupButton==n||(!n&&this.dateIcon?(this._bindInputEvent(),this.dateIcon.css("display","none"),this.innerWrapper.removeClass("e-padding")):(this.innerWrapper&&(this.innerWrapper.addClass("e-padding"),this.dateIcon.css("display","block")),this.model.displayInline||this._bindDateButton()),this.model.showPopupButton=n)},_resizeCalender:function(){this.model.dayHeaderFormat=="short"||this.model.dayHeaderFormat=="min"||this.model.dayHeaderFormat=="none"?this.sfCalendar.removeClass("e-headerlong"):this.model.dayHeaderFormat=="long"&&this.sfCalendar.addClass("e-headerlong")},_setWidth:function(n){n?this.wrapper?this.wrapper.width(n):this.element.width(n):this.model.width=this.wrapper?this.wrapper.outerWidth():this.element.width()},_setHeight:function(n){n?this.wrapper?this.wrapper.height(n):this.element.height(n):this.model.height=this.wrapper?this.wrapper.outerHeight():this.element.height();this._isIE7&&this.element.height(this.innerWrapper.height())},_setRTL:function(n){n?(this.wrapper&&this.wrapper.addClass("e-rtl"),this.sfCalendar&&this.sfCalendar.addClass("e-rtl")):(this.wrapper&&this.wrapper.removeClass("e-rtl"),this.sfCalendar&&this.sfCalendar.removeClass("e-rtl"))},_setRoundedCorner:function(n){n?(this.innerWrapper&&this.innerWrapper.addClass("e-corner"),this.sfCalendar&&this.sfCalendar.addClass("e-corner")):(this.innerWrapper&&this.innerWrapper.removeClass("e-corner"),this.sfCalendar&&this.sfCalendar.removeClass("e-corner"))},_refreshDatepicker:function(){var t,i;if(this._stopRefresh){this._stopRefresh=!1;return}t=this.element.val();i=this._specificFormat()&&this._formatter(this._preValue,this.model.dateFormat,this.model.locale)!=t?this._parseDate(t,!0):this._parseDate(t);i=this._validateYearValue(i);this._setDateValue(i);this._specificFormat()&&this._compareDate(this.model.value,this._calendarDate)&&this.element.val(t);n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._calendarDate,this.model.headerFormat));this._resizeCalender();this._dateValue=new Date(this._calendarDate.toString());this._hoverDate=this._calendarDate.getDate()-1;this._renderCalendar(this,this._dateValue);this._setFooterText(this._localizedLabels.buttonText);this._enableFooter(this.model.showFooter);this._layoutChanged()},_validateYearValue:function(n){if(n!=null){var i=t.preferredCulture(this.model.locale).calendars.standard.twoDigitYearMax;i=typeof i=="string"?(new Date).getFullYear()%100+parseInt(i,10):i;this._calendarDate.getFullYear()-n.getFullYear()==100&&this._calendarDate.getFullYear()>i&&n.setFullYear(this._calendarDate.getFullYear())}return n},_setFooterText:function(t){n(".e-footer-text",this.sfCalendar).html(t)},_setSkin:function(n){this.wrapper?(this.wrapper.removeClass(this.model.cssClass),this.wrapper.addClass(n)):(this.element.removeClass(this.model.cssClass),this.element.addClass(n));this.sfCalendar.removeClass(this.model.cssClass);this.sfCalendar.addClass(n)},_setDisplayInline:function(t){this.model.displayInline=t;t&&this._isInputBox?(this.sfCalendar.insertAfter(this.wrapper),this._setDatePickerPosition()):t?(this.element.append(this.sfCalendar),this._isSupport&&this._isInputBox||this._hiddenInput.css("display","none")):(this.sfCalendar.css("display","none"),n("body").append(this.sfCalendar),this._isOpen=!1);t&&(this.show(),this._off(this.dateIcon,"mousedown",this._showDatePopUp),this.element.off("mousedown",n.proxy(this._showDatePopUp,this)))},_disbleMaualInput:function(){this.model.readOnly?(n(this.element).attr("readonly","readonly"),this.model.displayInline||this.hide()):this.model.allowEdit&&n(this.element).prop("readonly",!1)},_checkDateObject:function(n,t){var t;if(n&&(typeof JSON!="object"||JSON.stringify(n)!=="{}"))n instanceof Date||(t=this._specificFormat()?this._parseDate(n,!0):this._parseDate(n,t),n=t?t:(t=this._checkJSONString(n))?t:null);else return null;return!isNaN(Date.parse(n))&&(this._dateValue=this._calendarDate=this._zeroTime(n),this._validateDate(n))?this._dateValue:null},_checkJSONString:function(n){if(isNaN(Date.parse(n))){if(this._extISORegex.exec(n)||this._basicISORegex.exec(n))return this._dateFromISO(n)}else{if(new Date(n).toJSON()===n||new Date(n).toDateString()===n||new Date(n).toGMTString()===n||new Date(n).toISOString()===n||new Date(n).toLocaleString()===n||new Date(n).toString()===n||new Date(n).toUTCString()===n)return new Date(n);if(typeof n=="string")return this._dateFromISO(n)}},_dateFromISO:function(n){var i=this._extISORegex.exec(n)||this._basicISORegex.exec(n),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){return char=n.toLowerCase(),char=="t"||char=="z"||char==":"||char=="-"?!0:!1},_checkInstanceType:function(n){if(n=this._stringToObject(n),n)n instanceof Date||(n=this._parseDate(n));else return null;return isNaN(Date.parse(n))?null:this._zeroTime(n)},_stringToObject:function(n){if(typeof n=="string"){var i=t.parseDate(n,this.model.dateFormat,this.model.locale);n=i!=null?i:new Date(n)}return n},_validateMinMaxDate:function(){var n=!1,t=!1;this.model.maxDatethis.model.maxDate?(this._calendarDate=this.model.maxDate,this.isValidState=!1,t=!0):this.isValidState=!0:this._calendarDatethis.model.maxDate&&(this._calendarDate=this.model.maxDate):(this.model.value?this.model.valuethis.model.maxDate&&(this._calendarDate=this.model.value=this.model.maxDate,n=!0):(this.element.val(""),this._calendarDatethis.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0);n&&this.element.val(this._formatter(this.model.value,this.model.dateFormat));t&&this._getInternalEvents&&this._trigger("outOfRange")},_setCulture:function(n){this.culture=t.preferredCulture(n);this.culture&&(this.model.locale=this.culture.name=="en"?"en-US":this.culture.name,this.Date.dayNames=this.culture.calendar.days.names,this.Date.dayNamesMin=this.culture.calendar.days.namesShort,this.Date.abbrDayNames=this.culture.calendar.days.namesAbbr,this.Date.monthNames=this.culture.calendar.months.names,this.Date.abbrMonthNames=this.culture.calendar.months.namesAbbr,this.Date.format=this.culture.calendar.patterns.d,this.model.dateFormat==""&&(this.model.dateFormat=this.culture.calendar.patterns.d),this.model.startDay==-1&&(this.model.startDay=this.culture.calendar.firstDay));this._separator=this._getSeparator();this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText),t.isNullOrUndefined(this._options.buttonText)||(this._localizedLabels.buttonText=this._options.buttonText));this._localizedLabelToModel()},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_setDatePickerPosition:function(){if(!this.model.displayInline||this._isInputBox){var i=this.element.is("input")?this.wrapper:this.element,r=this._getOffset(i),o,s,l=n(document).scrollTop()+n(window).height()-(r.top+n(i).outerHeight()),a=r.top-n(document).scrollTop(),f=this.sfCalendar.outerHeight(),e=this.sfCalendar.outerWidth(),u=r.left,h=i.outerHeight(),p=(h-i.height())/2,v=this._getZindexPartial(),c=3,y=fa?r.top+h+c:r.top-f-c;o=n(document).scrollLeft()+n(window).width()-u;s=n(document).scrollLeft()+u+i.width();(this.model.enableRTL||e>o&&es&&(u=r.left);this.sfCalendar.css({left:u+"px",top:y+"px","z-index":v})}},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.sfCalendar)},_setMinDate:function(n){this.model.minDate=this._checkInstanceType(n);this.model.minDate||(this.model.minDate=new Date("11/31/1899"))},_setMaxDate:function(n){this.model.maxDate=this._checkInstanceType(n);this.model.maxDate||(this.model.maxDate=new Date("12/31/2099"))},_setDateValue:function(n,i){var r=this._checkDateObject(n,i);r!=null?(this.isValidState=!0,this.model.value=new Date(r.toString()),this.model.displayInline||this.wrapper.addClass("e-valid"),this._validateMinMaxDate(),this._preTxtValue=this.element.val(this._formatter(this.model.value,this.model.dateFormat))):(n instanceof Date&&(this._validateMinMaxDate(),n=this._formatter(n,this.model.dateFormat)),this.model.enableStrictMode?this.element.val(n):this.element.val(null),this.model.value=null,this.model.displayInline||this.wrapper.removeClass("e-valid"),this._triggerChangeEvent(),this.isValidState=this.element.val()==""||t.isNullOrUndefined(this.element.val())?!0:!1);this._removeWatermark()},_updateInputVal:function(){var n=this._validateValue();(n!=null||!this.model.enableStrictMode)&&this.sfCalendar&&this.sfCalendar.find(".e-datepicker-days").is(":visible")&&this._refreshDatepicker()},_validateInputVal:function(){var n=this._validateValue();n!=null&&(this.model.enableStrictMode||(n<=this.model.maxDate&&n>=this.model.minDate?this.isValidState=!0:(this.model.value=null,this.isValidState=!0)))},_validateValue:function(){var n;return n=this._specificFormat()&&this.element.val()!=this._formatter(this._preValue,this.model.dateFormat,this.model.locale)?this._parseDate(this.element.val(),!0):this._parseDate(this.element.val()),this._validateYearValue(n)},_getSeparator:function(){var t,n;for(formats=this.culture?this.culture.calendar.patterns.d:this.model.dateFormat,t=new RegExp("^[a-zA-Z0-9]+$"),n=0;n=7&&n<8)return!0}return!1},_isValidDate:function(n){return n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_formatter:function(n,i){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)},_parseDate:function(n,i){var u=this._checkFormat(this.model.dateFormat);return DateValue=n,!this._specificFormat()||DateValue==r||n==""||i==!0||t.format(t.parseDate(DateValue,u,this.model.locale),this.model.dateFormat,this.model.locale)==DateValue?t.parseDate(n,u,this.model.locale):this._dateValue},_checkFormat:function(n){var i=this,r=this._regExp();return n.replace(r,function(n){return n==="/"?t.preferredCulture(i.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},_regExp:function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},isLeapYear:function(n){return n%4==0&&n%100!=0||n%400==0},_zeroTime:function(n){var t=typeof n=="string"?this._parseDate(n):new Date(n);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_getDaysInMonth:function(n){return[31,this.isLeapYear(n)?29:28,31,30,31,30,31,31,30,31,30,31][n.getMonth()]},_addDays:function(n,t){return n.setDate(n.getDate()+t),n},_addYears:function(n,t){return n.setFullYear(n.getFullYear()+t),n},_addMonths:function(n,t){var i=n.getDate();return n.setMonth(n.getMonth()+t),i>n.getDate()&&this._addDays(n,-n.getDate()),n},_isWeekend:function(n){return n.getDay()==0||n.getDay()==6},_isSpecialDates:function(n){if(this.model.specialDates)for(var t=0;te.getTime()&&(u=e),s=this.displayedMonth,h=this.displayedYear,this.displayedMonth=u.getMonth(),this.displayedYear=u.getFullYear(),o=u,i&&(this.displayedMonth!=s||this.displayedYear!=h)&&(this._renderCalendar(this,o),this._dateValue=o,this._trigger("monthChanged",[this.displayedMonth,this.displayedYear])))},_clearSelected:function(){this.numSelected=0;this.model.highlightSection=="week"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().removeClass("e-selected-week"):this.model.highlightSection=="month"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().parent().removeClass("e-selected-month"):this.model.highlightSection=="workdays"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().removeClass("e-work-week"):n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1)},_addSelected:function(){this.model.highlightSection=="week"?n("td.e-active",this.sfCalendar).parent().addClass("e-selected-week"):this.model.highlightSection=="month"?n("td.e-active, this.sfCalendar").parent().parent().addClass("e-selected-month"):this.model.highlightSection=="workdays"&&n("td.e-active",this.sfCalendar).parent().addClass("e-work-week")},_hideOtherMonths:function(t){n("td.other-month",t).css("visibility","hidden")},_showOtherMonths:function(t){n("td.other-month",t).css({visibility:"visible"})},_otherMonthsVisibility:function(){this.model.showOtherMonths?this._showOtherMonths(this.sfCalendar):this._hideOtherMonths(this.sfCalendar)},_createCalender:function(){t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-datepicker-headertext").text(this._formatter(this._calendarDate,this.model.headerFormat)).attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this.sfCalendar);this._enableHeader(this._showHeader);var i=t.buildTag("table.e-dp-viewdays","",{},{cellspacing:2}).data("e-table","data").attr({role:"grid","aria-activedescendant":""}).attr(this._isIE8?{unselectable:"on"}:{});this.sfCalendar.append(i);this._renderCalendar(this);this._startLevel(this.model.startLevel);t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this.sfCalendar);n(".e-footer-text",this.sfCalendar).html(this._localizedLabels.buttonText);this._enableFooter(this.model.showFooter)},_enableHeader:function(t){t?n(".e-header",this.sfCalendar).show():n(".e-header",this.sfCalendar).hide()},_enableFooter:function(t){t?n(".e-footer",this.sfCalendar).show():n(".e-footer",this.sfCalendar).hide();this._todayBtnDisable()},_todayBtnDisable:function(){var t=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate(),0,0,0);+this.model.minDate<=+t&&+this.model.maxDate>=+t?n(".e-footer",this.sfCalendar).removeClass("e-footer-disable"):n(".e-footer",this.sfCalendar).addClass("e-footer-disable")},_checkArrows:function(n,t){this._preArrowCondition(n,this.model.minDate.getFullYear());this._nextArrowCondition(t,this.model.maxDate.getFullYear())},_checkDateArrows:function(){this._preArrowCondition(this._tempMinDate,this.model.minDate);this._nextArrowCondition(this._tempMaxDate,this.model.maxDate)},_preArrowCondition:function(n,t){n<=t?this.sfCalendar.find(".e-arrow-sans-left").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-arrow-sans-left").removeClass("e-disable").attr({"aria-disabled":!1})},_nextArrowCondition:function(n,t){n>=t?this.sfCalendar.find(".e-arrow-sans-right").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-arrow-sans-right").removeClass("e-disable").attr({"aria-disabled":!1})},_previousNextHandler:function(t){var r,u,f,e,o,s,i;if(this.model.readOnly||!this.model.enabled||n(t.target).hasClass("e-disable"))return!1;t.preventDefault();r=n("table",this.sfCalendar);u=this._navigateFrom(r);f=n(t.target).is("a")?n(t.target.parentNode):n(t.target);e=f.hasClass("e-prev")?!0:!1;this._processNextPrevDate(e);o=n("table",this.sfCalendar);s=o.get(0).className;switch(s){case"e-dp-viewdays":i="month";break;case"e-dp-viewmonths":i="year";break;case"e-dp-viewyears":i="decade";break;case"e-dp-viewallyears":i="century"}this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:i,navigateFrom:u})},_processNextPrevDate:function(t){var i,u,l,h,c,f,e,o,r;if((this._DRPdisableFade&&(s=new Date(this.sfCalendar.find("td.current-month").attr("date")),this._dateValue=s),t&&this.sfCalendar.find(".e-arrow-sans-left").hasClass("e-disable"))||!t&&this.sfCalendar.find(".e-arrow-sans-right").hasClass("e-disable"))return!1;i=n("table",this.sfCalendar);l=i.get(0).className;switch(l){case"e-dp-viewdays":if(h=this.model.stepMonths,t){if(this._dateValue<=this.model.minDate)return this._flag=!1,!1}else if(this._dateValue>=this.model.maxDate)return this._flag=!1,!1;this._flag=!0;this._addMonths(this._dateValue,t?-h:h);this._clickedDate&&(this._calendarDate=this._clickedDate);this._dateValue=this._dateValuethis.model.maxDate?new Date(this.model.maxDate.toString()):this._dateValue;this._renderCalendar(this,this._dateValue);n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));this._addFocus("day",this._hoverDate);c=this._findFirstLastDay(new Date(this._dateValue.toString()));this._preArrowCondition(c.firstDay,this.model.minDate);this._nextArrowCondition(c.lastDay,this.model.maxDate);break;case"e-dp-viewmonths":if(f=this._dateValue,f.setFullYear(n(".e-datepicker-headertext",this.sfCalendar).text()),t){if(f.getFullYear()<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(f.getFullYear()>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0;this._addYears(f,t?-1:1);this._renderCalendar(this,f);u=f.getFullYear();n(".e-datepicker-headertext",this.sfCalendar).text(u);n("tbody,tr.e-week-header",i).not(".e-datepicker-months").hide();n(n(i).find(".e-datepicker-months")).show();this._addFocus("month",this._hoverMonth);this._checkArrows(u,u);break;case"e-dp-viewyears":if(e=this._dateValue,e.setFullYear(n(i).find(".e-state-hover").text()),t){if(parseInt(n("td.e-year-first:first").text())<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(parseInt(n("td.e-year-last:first").prev().text())>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0;n(i).find(".e-state-hover").hasClass("e-year-first")&&t||n(i).find(".e-state-hover").hasClass("e-year-last")&&!t?this._dateValue.setFullYear(e.getFullYear()):n(i).find(".e-state-hover").hasClass("e-year-first")&&!t?this._dateValue.setFullYear(e.getFullYear()+11):n(i).find(".e-state-hover").hasClass("e-year-last")&&t?this._dateValue.setFullYear(e.getFullYear()-11):this._dateValue.setFullYear(e.getFullYear()+(t?-10:10));this._renderCalendar(this,this._dateValue);r=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1);n(".e-datepicker-headertext",this.sfCalendar).text(r+1+" - "+(r+10));n("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide();n(n(i).find(".e-datepicker-years")).show();this._addFocus("year",this._hoverYear+(n(".e-year-first.e-hidedate").length?-1:0));this._checkArrows(r+1,r+10);break;case"e-dp-viewallyears":if(t){if(o=parseFloat(n("td.e-allyear-first",i.get(0)).text().split("-")[1]),o<=this.model.minDate.getFullYear())return this._flag=!1,!1;this._flag=!0}else{if(o=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]),o>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0}this._dateValue.setFullYear((this._lastHoveredYear?this._lastHoveredYear:this._dateValue.getFullYear())+(t?-100:100));this._lastHoveredYear=this._dateValue.getFullYear();this._renderCalendar(this,this._dateValue);r=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%100+1);u=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]);n(".e-datepicker-headertext",this.sfCalendar).text(r+1+" - "+u);n("tbody,tr.e-week-header",i).not(".e-datepicker-allyears").hide();n(n(i).find(".e-datepicker-allyears")).show();this._addFocus("allyear",this._hoverAllYear+(n(".e-allyear-first.e-hidedate").length?-1:0));this._checkArrows(r+1,u)}this._layoutChanged()},_addFocus:function(t,i){var f="e-current-"+t,r,u;return t=="day"&&(f="current-month"),r=this.sfCalendar.find("tbody tr td."+f),t=="month"&&n(r).each(function(t,r){if(parseInt(n(r).attr("index"))==parseInt(i)){i=t;return}}),u=r[i],u||(u=r.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),n(u).addClass("e-state-hover"),this._setActiveState(t),i},_setActiveState:function(t){var e,f,o;if(this.model.value instanceof Date){var i=this.sfCalendar.find("tbody tr td.e-current-"+t),r,s=this,u=-1;switch(t){case"month":this.model.value.getFullYear()===parseInt(n(".e-text",this.sfCalendar).text())&&n(i).each(function(t,i){if(parseInt(n(i).attr("index"))==parseInt(s.model.value.getMonth())){u=t;return}});break;case"year":e=this.model.value.getFullYear();n(i).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(e)){u=n;return}});break;case"allyear":f=parseInt(this.model.value.getFullYear())-(parseInt(this.model.value.getFullYear())%10+1);o=f+1+" - "+(f+10);n(i).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(o)){u=n;return}})}r=i[u];r&&(this.sfCalendar.find("table td").removeClass("e-active"),n(r).hasClass("e-hidedate")||n(r).addClass("e-active"))}},_setFocusByName:function(t,i){var u=this.sfCalendar.find("tbody tr td.e-current-"+t),f,r;return n(u).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(i)){f=n;return}}),r=u[f],r||(r=u.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),n(r).addClass("e-state-hover"),this._setActiveState(t),f},_getHeaderTxt:function(){return this.sfCalendar.find(".e-datepicker-headertext").text()},_findFirstLastDay:function(n){y=n.getFullYear();m=n.getMonth();var t=new Date(y,m,1),i=new Date(y,m+1,0);return{firstDay:t,lastDay:i}},_forwardNavHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t&&t.preventDefault();var u=n("table",this.sfCalendar),f=n("table",this.sfCalendar).get(0).className,e=this,i,r;navFrom=this._navigateFrom(u);switch(f){case"e-dp-viewdays":this._hoverMonth=this._getDateObj(u.find(".e-state-hover")).getMonth()||this._getDateObj(u.find(".e-active")).getMonth()||0;this._DRPdisableFade&&(this._renderCalendar(this,this._calendarDate),n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat)));this._startLevel("year");r="year";this._addFocus("month",this._hoverMonth);break;case"e-dp-viewmonths":i=this._getHeaderTxt();this._startLevel("decade");r="decade";this._hoverYear=this._setFocusByName("year",i);break;case"e-dp-viewyears":i=this._getHeaderTxt();this._startLevel("century");r="century";this._hoverAllYear=this._setFocusByName("allyear",i)}navFrom!="century"&&this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:r,navigateFrom:navFrom});this._layoutChanged()},_cellSelection:function(){var u=n("table",this.sfCalendar),r=n("table",this.sfCalendar).get(0).className,t,i;switch(r){case"e-dp-viewmonths":this._hoverMonth=this._addFocus("month",this._dateValue.getMonth());break;case"e-dp-viewyears":t=new Date(this._dateValue.toString());this._navigationToPrevNext("year");this._dateValue=t;this._hoverYear=this._setFocusByName("year",this._dateValue.getFullYear());break;case"e-dp-viewallyears":t=new Date(this._dateValue.toString());this._navigationToPrevNext("allyear");this._dateValue=t;i=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1);this._hoverAllYear=this._setFocusByName("allyear",i+1+" - "+i+10)}this._layoutChanged()},_navigationToPrevNext:function(t){var r=this.sfCalendar.find("tbody tr td.e-current-"+t),u,i,f=this._dateValue.getFullYear();n(r).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(f)){u=n;return}});i=r[u];i&&(n(i).hasClass("e-"+t+"-last")?this._processNextPrevDate(!1):n(i).hasClass("e-"+t+"-first")&&this._processNextPrevDate(!0))},_navigateFrom:function(n){var i=n.get(0).className,t;switch(i){case"e-dp-viewdays":t="month";break;case"e-dp-viewmonths":t="year";break;case"e-dp-viewyears":t="decade";break;case"e-dp-viewallyears":t="century"}return t},_backwardNavHandler:function(i){var u,r;if(this._animating=!0,this.model.readOnly||!this.model.enabled)return!1;i.type?(i.preventDefault(),u=n(i.currentTarget)):u=i;var f=n("table",this.sfCalendar),o,h=n("table",this.sfCalendar).get(0).className,e=this,s;navFrom=this._navigateFrom(f);switch(h){case"e-dp-viewmonths":f.removeClass("e-dp-viewmonths").addClass("e-dp-viewdays");this._lastHoveredMonth=parseInt(n(u).attr("index"));this._dateValue=new Date(this._dateValue.getFullYear(),this._lastHoveredMonth,1);this._DRPdisableFade&&this._trigger("_month_Loaded",{currentTarget:i.currentTarget});this._renderCalendar(this,this._dateValue);n("tbody",f).not(".e-datepicker-days,.e-week-header").hide();n(n(f).find(".e-datepicker-days,.e-week-header")).fadeIn("fast",function(){e._addFocus("day",e._hoverDate||0);e._animating=!1});n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));s="month";break;case"e-dp-viewyears":f.removeClass("e-dp-viewyears").addClass("e-dp-viewmonths");this._lastHoveredYear=parseInt(u.text());this._dateValue.setFullYear(this._lastHoveredYear);this._renderCalendar(this,this._dateValue);n("tbody,tr.e-week-header",f).not(".e-datepicker-months").hide();t.isNullOrUndefined(this._hoverMonth)&&!t.isNullOrUndefined(this._dateValue)&&(this._hoverMonth=this._dateValue.getMonth());n(n(f).find(".e-datepicker-months")).fadeIn("fast",function(){e._addFocus("month",e._hoverMonth||0);e._animating=!1});o=u.text();n(".e-datepicker-headertext",this.sfCalendar).text(o);this._checkArrows(o,o);s="year";break;case"e-dp-viewallyears":r=u.text().split("-");f.removeClass("e-dp-viewallyears").addClass("e-dp-viewyears");r[0]this.model.maxDate.getFullYear()&&(r[0]=this.model.maxDate.getFullYear().toString());this._renderCalendar(this,new Date(r[0],0,1));n("tbody,tr.e-week-header",f).not(".e-datepicker-years").hide();n(n(f).find(".e-datepicker-years")).fadeIn("fast",function(){e._addFocus("year",e._hoverYear||0);e._animating=!1});n(".e-datepicker-headertext",this.sfCalendar).text(r[0]+" - "+r[1]);this._checkArrows(r[0],r[1]);s="decade";this._dateValue=new Date(this._dateValue.setFullYear(parseInt(n.trim(r[0]))+(this._lastHoveredYear?this._lastHoveredYear%10:this._dateValue.getFullYear()%10)));break;default:this._clearSelected();this.sfCalendar.find("table td").removeClass("e-state-hover");u.not("td.other-month.e-hidedate").addClass("e-active").attr("aria-selected",!0);this._addSelected();this._hoverDate=this._getDateObj(u).getDate()-1;this._dateValue=new Date(u.attr("date"));this._clickedDate=new Date(u.attr("date"));this._animating=!1}navFrom!="month"&&this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:s,navigateFrom:navFrom});this._layoutChanged()},_startLevel:function(t){var i=n("table",this.sfCalendar),o=n(".e-datepicker-headertext",this.sfCalendar),r,f,u=this._dateValue,s,e;switch(t){case"decade":i.removeClass("e-dp-viewallyears e-dp-viewmonths e-dp-viewdays").addClass("e-dp-viewyears");n("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide();n(n(i).find(".e-datepicker-years")).show();u=this.model.enableStrictMode&&this._calendarDatethis.model.maxDate.getFullYear()?(u.addClass("e-hidedate"),u.removeClass("e-current-month")):(r.getFullYear()<=this.model.minDate.getFullYear()&&f=this.model.maxDate.getFullYear()&&f>this.model.maxDate.getMonth()+1)&&(u.addClass("e-hidedate"),u.removeClass("e-current-month")),e.append(u);t.append(e)}i.append(t);s=r.getFullYear();this._checkArrows(s,s)},_datepickerYears:function(t,i,r){for(var o,s,h,u,c=function(n){return document.createElement(n)},l=parseInt(r)-(parseInt(r)%10+1),f=[],e=0;e<12;e++)f.push(l+e);for(o=0,s=0;s<3;s++){for(h=n(c("tr")),e=0;e<4;e++)u=n(c("td")),u.attr(this._isIE8?{unselectable:"on"}:{}),o==0?u.addClass("e-year-first e-current-year "):o==11?u.addClass("e-year-last e-current-year "):u.addClass("e-current-year e-state-default"),(f[o]this.model.maxDate.getFullYear())&&(u.addClass("e-hidedate"),u.removeClass("e-current-year")),u.html(f[o++]),h.append(u);t.append(h)}i.append(t);this._checkArrows(f[0],f[f.length])},_datepickerAllYears:function(t,i,r){for(var f,h,c,u,e=parseInt(r)-(parseInt(r)%100+10),a=e,s=[],l=this._isIE8||this._isIE9?"":"\n",o=0;o<12;o++)s.push(parseInt(e)+" -"+l+parseInt(e+9)),e=e+10;for(f=0,h=0;h<3;h++){for(c=n(document.createElement("tr")),o=0;o<4;o++)u=n(document.createElement("td")),u.attr(this._isIE8?{unselectable:"on"}:{}),f==0?u.addClass("e-allyear-first e-current-allyear "):f==11?u.addClass("e-allyear-last e-current-allyear "):u.addClass("e-current-allyear e-state-default"),(parseInt(s[f].split("-\n")[1])this.model.maxDate.getFullYear())&&(u.addClass("e-hidedate"),u.removeClass("e-current-allyear")),u.html(s[f++]),c.append(u);t.append(c)}i.append(t)},_renderHeader:function(i){var c=n(document.createElement("thead")),e=t.preferredCulture(this.model.locale).calendars.standard.days,o,f,r,u,s,h;if(i.model.dayHeaderFormat!="none")for(o=t.buildTag("tr.e-week-header").attr({role:"columnheader"}).attr(this._isIE8?{unselectable:"on"}:{}),f=this.Date.firstDayOfWeek;f1&&(a-=7);g=Math.ceil((-1*a+1+this._getDaysInMonth(f))/7);this._addDays(f,a-1);nt=k._zeroTime(new Date);tt=this._calendarDate;e=t.buildTag("tbody.e-datepicker-months","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});this._datepickerMonths(e,s,h);e=t.buildTag("tbody.e-datepicker-days","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});for(var ut=0,it=!0,p=!0;ut++<\/span>"+f.getDate():f.getDate()+"").attr({date:f.toDateString(),title:this.model.showTooltip?y&&this.model.specialDates[c][this._mapField._tooltip]?this.model.specialDates[c][this._mapField._tooltip]:this._formatter(f,this.model.tooltipFormat):"","aria-selected":!1,role:"gridcell"}).attr(this._isIE8?{unselectable:"on"}:{}).addClass((v?"current-month e-state-default ":"other-month e-state-default ")+(this._isWeekend(f)?this._ejHLWeekEnd?"e-dp-weekend e-week-end ":this.model.highlightWeekend?"e-week-end ":"":"e-week-day ")+(v&&f.getTime()==nt.getTime()?"today ":""));o.find("span:first-of-type").addClass(y?this.model.specialDates[c][this._mapField._icon]?"e-special-date-icon "+this.model.specialDates[c][this._mapField._icon]+" ":"e-special-day":"");o.addClass(y?this.model.specialDates[c][this._mapField._custom]?this.model.specialDates[c][this._mapField._custom]:"":"");ft&&this._disableDates({date:f,element:o});tt.getTime()==f.getTime()&&v&&(o.hasClass("e-hidedate")||(this.model.value?(o.addClass("e-active").attr({"aria-selected":!0}),this.model.highlightSection=="week"&&l.addClass("e-selected-week"),this.model.highlightSection=="month"&&e.addClass("e-selected-month"),this.model.highlightSection=="workdays"&&l.addClass("e-work-week")):o.addClass("e-state-hover").attr({"aria-selected":!1})),this._hoverDate||(o.hasClass("e-hidedate")||o.addClass("e-state-hover"),this._hoverDate=f.getDate()-1));b=!0;(fthis.model.maxDate)&&(o.addClass("e-hidedate"),o.removeClass("current-month"),this.model.showOtherMonths&&o.removeClass("other-month"),b=p=!1);v&&(b&&it&&(this._tempMinDate=f,it=!1,p=!0),p&&(this._tempMaxDate=f));this._trigger("beforeDateCreate",{date:f,value:this._formatter(f,this.model.dateFormat),element:o});l.append(o);f=new Date(f.getFullYear(),f.getMonth(),f.getDate()+1,0,0,0)}e.append(l)}s.append(e);this._DRPdisableFade?(n(e).css("display","block"),n(e).css({display:"table-row-group","vertical-align":"middle","border-color":"inherit"})):this._isIE8||this._isIE7?n(e).css("display","block"):n(e).fadeIn("fast");this.model.startLevel===this.model.depthLevel?this._depthLevel(this.model.depthLevel):this.model.depthLevel!="month"&&this.model.depthLevel!=""?this.model.startLevel=="century"?this._depthLevel(this.model.depthLevel):this.model.startLevel=="decade"&&this.model.depthLevel!="century"?this._depthLevel(this.model.depthLevel):this.model.startLevel=="year"&&this.model.depthLevel!="decade"&&this.model.depthLevel!="century"?this._depthLevel(this.model.depthLevel):(this._on(s.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this)),this._on(s.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this))):(this._on(s.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this)),this._on(s.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this)));this._otherMonthsVisibility();this._checkDateArrows()},_checkDisableRange:function(n){return!t.isNullOrUndefined(this._disableCollection[n.getFullYear()])&&jQuery.inArray(n.getMonth(),this._disableCollection[n.getFullYear()])!==-1?!0:!1},_initDisableObj:function(){var r,n,u;for(this._disableCollection={},i=0;i1)t.row-=1;else return this._processNextPrevDate(!0),this.sfCalendar.find(h+":nth-child("+t.col+"):last");if(o=this._getCell(t,s),o.length<=0){if(o=this._findVisible(t,s,"up"),o!==null)return o;this._processNextPrevDate(!0);o=this.sfCalendar.find(h+":nth-child("+t.col+"):last")}return o;case 37:if(e)return this._processNextPrevDate(!0),this.sfCalendar.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else if(t.row>1)t={row:t.row-1,col:u};else return this._processNextPrevDate(!0),this.sfCalendar.find(h+":last");if(o=this._getCell(t,s),o.length<=0){if(o=this._findVisible(t,s,"left"),o!==null)return o;this._processNextPrevDate(!0);o=this.sfCalendar.find(h+":last")}return o;case 39:if(e)return this._processNextPrevDate(!1),this.sfCalendar.find("tbody tr td.e-state-hover");if(t.col=0;i++){if(nextElement=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+u+") td:nth-child("+f+")"),nextElement.length<=0)return null;if(nextElement.hasClass("e-hidedate")||!nextElement.is(":visible")){if((r=="right"||r=="left"?r=="right"?f++:f--:r=="down"?u++:u--,u<=0||u>this.sfCalendar.find("tbody"+t.parent+" tr").length)||(f>this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+u+") td").length&&(u++,f=1),f<=0&&(u--,f=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+u+") td").length),u<=0||u>this.sfCalendar.find("tbody"+t.parent+" tr").length))return null}else{if(nextElement.hasClass("other-month"))return null;if(nextElement.hasClass(e))return n.col=f,n.row=u,nextElement}}},_getCell:function(n,t){return this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+n.row+") td"+t.child+":nth-child("+n.col+")")},_getDateObj:function(n){return new Date(n.attr("date"))},_touchCalendar:function(n){var t=this.sfCalendar.find("table")[0].className;switch(n.type){case"pinchin":t!="e-dp-viewdays"&&this._keyboardNavigation({keyCode:13});break;case"pinchout":t!="e-dp-viewallyears"&&this.model.allowDrillDown&&this._forwardNavHandler();break;case"swipeleft":this._processNextPrevDate(!1);break;case"swiperight":this._processNextPrevDate(!0)}},show:function(i){var r,u;if(t.isNullOrUndefined(this.sfCalendar)&&this._renderPopup(),this._isOpen)return!1;if(r=this,this._popupOpen=!0,u=this._preValue!=null?new Date(this._preValue.toString()):this._preValue,this.model.enabled){if(this.model.displayInline||this._setDatePickerPosition(),this._trigger("beforeOpen",{element:this.sfCalendar,events:i}))return!1;this.sfCalendar.attr({"aria-hidden":"false"});r._isOpen=!0;this.sfCalendar.slideDown(this.model.enableAnimation?this.animation.open.duration:0,function(){if(r.model&&!r.model.displayInline)n(document).on("mousedown",n.proxy(r._onDocumentClick,r))});this._isIE8?this.element.val()&&this._compareDate(new Date(this.element.val()),u)&&this._updateInputVal():this._updateInputVal();this._refreshLevel(u);this._trigger("open",{prevDate:u,date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)});this._on(t.getScrollableParents(this.wrapper),"scroll",this.hide);n(window).on("resize",n.proxy(this._OnWindowResize,this));this.model.displayInline||this._on(t.getScrollableParents(this.wrapper),"touchmove",this.hide);this._isInputBox&&this.wrapper.addClass("e-active")}},hide:function(i){if(!this._isOpen||this._getInternalEvents||this._trigger("beforeClose",{element:this.sfCalendar,events:i}))return!1;var u=this;(this._popupOpen=!1,this.sfCalendar.attr({"aria-hidden":"true"}),this._popClose&&i!=r&&i.type!="click")||(this.sfCalendar.slideUp(this.model.enableAnimation?this.animation.close.duration:0,function(){u._isOpen=!1;n(document).off("mousedown",n.proxy(u._onDocumentClick,u));u._setWaterMark()}),this.element.val()!=""&&this._validateInputVal(),this._trigger("close",{prevDate:this._prevDate,date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)}),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"touchmove",this.hide),this._isInputBox&&this.wrapper.removeClass("e-active"))},enable:function(){this.model.enabled=!0;this.wrapper&&this.wrapper.removeClass("e-disable");this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.dateIcon&&this.dateIcon.removeClass("e-disable").attr({"aria-disabled":!1});this._isIE8&&this.dateIcon&&this.dateIcon.children().removeClass("e-disable");this.element.prop("disabled",!1);this._isSupport||this._hiddenInput.prop("disabled",!1);this.sfCalendar&&this.sfCalendar.removeClass("e-disable").attr({"aria-disabled":!1})},disable:function(){this.model.enabled=!1;this.wrapper&&this.wrapper.addClass("e-disable");this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.attr("disabled","disabled");this.dateIcon&&this.dateIcon.addClass("e-disable").attr({"aria-disabled":!0});this._isIE8&&this.dateIcon&&this.dateIcon.children().addClass("e-disable");this.element.attr("disabled","disabled");this._isSupport||this._hiddenInput.attr("disabled","disabled");this.sfCalendar&&this.sfCalendar.addClass("e-disable").attr({"aria-disabled":!0});this._isOpen&&(this.element.is(":input")&&this.element.blur(),this.model.displayInline||this.hide())},getValue:function(){return this._formatter(this.model.value,this.model.dateFormat)},_wireCalendarEvents:function(){if(this._allowQuickPick(this.model.allowDrillDown),this._on(n(".e-next",this.sfCalendar),"click",n.proxy(this._previousNextHandler,this)),this._on(n(".e-prev",this.sfCalendar),"click",n.proxy(this._previousNextHandler,this)),!this.model.displayInline){this.sfCalendar.on("mouseenter touchstart",n.proxy(function(){this._popClose=!0},this));this.sfCalendar.on("mouseleave touchend",n.proxy(function(){this._popClose=!1},this))}this.model.showFooter&&this._on(n(".e-footer",this.sfCalendar),"click",this._setCurrDate);this.sfCalendar&&this._on(this.sfCalendar,"pinchin pinchout swipeleft swiperight",n.proxy(this._touchCalendar,this))},_wireEvents:function(){if(this.element.is(":input")&&this.model.allowEdit&&(this._on(this.element,"blur",this._onFocusOut),this._on(this.element,"focus",this._onFocusIn),this._on(this.element,"keydown",this._onKeyDown)),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showDatePopUp,this))}},_bindDateButton:function(){this._on(this.dateIcon,"mousedown",this._showDatePopUp);this.model.allowEdit&&this.element.off("mousedown",n.proxy(this._showDatePopUp,this))},_bindInputEvent:function(){this._off(this.dateIcon,"mousedown",this._showDatePopUp)},_specificFormat:function(){var i=t.globalize._getDateParseRegExp(t.globalize.findCulture(this.model.locale).calendar,this.model.dateFormat);return n.inArray("dddd",i.groups)>-1||n.inArray("ddd",i.groups)>-1},_onFocusOut:function(i){var u,r,f;this._isFocused=!1;u=this._preValue!=null?new Date(this._preValue.toString()):this._preValue;this._validateOnFocusOut(this._validateValue(),i);this.wrapper.removeClass("e-focus");t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid");this._isOpen&&!this.model.displayInline||this._setWaterMark()||this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._updateInputVal();(!this._isOpen||this.model.displayInline)&&this._refreshLevel(u);this.element.val()!=""&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal();this.element.off("keydown",n.proxy(this._keyboardNavigation,this));this.model.showPopupButton||this._off(this.element,"click",this._elementClick);r=this.element.val();f={prevDate:this._prevDate,value:r};this._specificFormat()?this._prevDate!=r&&this._setDateValue(r,!0):this._setDateValue(r);this.model.value||this._clearSelected();this._trigger("focusOut",f);this._checkErrorClass()},_onFocusIn:function(t){if(this._isSupport&&(t.preventDefault(),this._isFocused=!0),this.wrapper.removeClass("e-error").attr("aria-invalid","false"),this.isValidState=!0,this.wrapper.addClass("e-focus"),this.wrapper.addClass("e-valid"),!this.model.readOnly){this._isSupport||this._hiddenInput.css("display","none");this.element.on("keydown",n.proxy(this._keyboardNavigation,this));this.model.showPopupButton||this.model.readOnly||this.show(t);this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this._trigger("focusIn",{date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)})}},_elementClick:function(n){this._popupOpen||this.show(n)},_removeWatermark:function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},_refreshPopup:function(){this._refreshDatepicker();this._startLevel(this.model.startLevel)},_refreshLevel:function(n){if(this.model.startLevel==this.model.depthLevel&&this.model.startLevel!="month"){var t=this._stringToObject(this.element.val());t=this._validateYearValue(t);t&&(this._compareDate(n,t)||this._refreshPopup())}},_validateOnFocusOut:function(n,i){var f=this._preValue!=null?this._calendarDate:this._preValue,o=this._formatter(f,this.model.dateFormat),e,r,u;this._specificFormat()&&n>this.model.minDate&&nthis.model.maxDate?(this.isValidState=!1,u=!0,this._calendarDate=nthis.model.maxDate&&(this._calendarDate=this.model.maxDate)):(this._preTxtValue==null||this.element.val()==""?(this.element.val(""),this._isSupport||this._hiddenInput.css("display","block")):this.element.val(o),this._triggerChangeEvent(i)):(t.isNullOrUndefined(this.model.value)&&(this.model.value=this._parseDate(this.element.val())),this.model.maxDatethis.model.maxDate)&&(r=!0,this._calendarDate=n=nthis.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0),r&&this.element.val(this._formatter(n,this.model.dateFormat)),this._compareDate(this._preValue,this._parseDate(this.element.val(),!0))||this._triggerChangeEvent(i))},_onKeyDown:function(n){if(n.keyCode===13){var t=this._preValue!=null?new Date(this._preValue.toString()):this._preValue;this._validateOnFocusOut(this._validateValue(),n);this._isOpen&&!this.model.displayInline||this._setWaterMark()||this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._updateInputVal();(!this._isOpen||this.model.displayInline)&&this._refreshLevel(t);this.element.val()!=""&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal();this._checkErrorClass()}},_showhidePopup:function(n){if(!this.model.enabled)return!1;this._isOpen?(this._isFocused||!this.element.is(":input")||t.isTouchDevice()||this.element.focus(),this._cancelValue||this.hide(n)):(this._isFocused||!this.element.is(":input")||t.isTouchDevice()||this.element.focus(),this.show(n))},_compareDate:function(n,t){return+n==+t?!0:!1},_validateDate:function(n){var t=!0,r;if(n!=null){for(i=0;ithis.model.maxDate)&&this.model.enableStrictMode&&(t=!1,this.isValidState=!1)}return t},_triggerChangeEvent:function(n){var i,u=this.element.val()==""?null:this.element.val(),t;this._prevDate=this._formatter(this._preValue,this.model.dateFormat);t={prevDate:this._prevDate,value:u,isInteraction:!!n};i=this._specificFormat()&&n!=r&&n.type=="keydown"&&this._formatter(this._preValue,this.model.dateFormat,this.model.locale)!=this.element.val()?this._parseDate(this.element.val(),!0):this._specificFormat()&&n!=r&&n.type=="blur"?this.model.value:this._parseDate(u);i=this._validateYearValue(i);this._validateDate(i)||(i=null);this._compareDate(this._preValue,i)?this.element.val()==""&&this._prevDate==null||this.element.val()==this._prevDate||(t.value=this.element.val(),this._trigger("_change",t)):(this._preValue=this.model.value=i,t.value=this._formatter(this.model.value,this.model.dateFormat),this.model.value&&(this._clickedDate=this._calendarDate=this.model.value),this.model.displayInline&&!this._isInputBox&&this._hiddenInput.attr("value",u),this.model.value||this.model.enableStrictMode||this._setDateValue(this.model.value),t.value=u,this._trigger("_change",t),t.value=this._formatter(this.model.value,this.model.dateFormat),this._trigger("change",t),this._checkErrorClass())},_triggerSelectEvent:function(){var t=this.element.val(),n;this._parseDate(t)&&(n={prevDate:this._prevDate,date:this.model.value,value:t,isSpecialDay:this._isSpecialDates(this.model.value)},this._prevDate!=t&&this._parseDate(n.value)&&this.model.value>=this.model.minDate&&this.model.value<=this.model.maxDate&&(this._cancelValue=this._trigger("select",n)),this._dt_drilldown&&this._trigger("dt_drilldown",n))},_onDocumentClick:function(t){this.model&&(n(t.target).is(this.popup)||n(t.target).parents(".e-popup").is(this.popup)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-datewidget").is(this.wrapper)?(n(t.target).is(this.popup)||n(t.target).parents(".e-popup").is(this.popup))&&t.preventDefault():this.hide(t))},_OnWindowResize:function(){this.sfCalendar&&this._setDatePickerPosition()},_showDatePopUp:function(n){var t=!1;if((n.button?t=n.button==2:n.which&&(t=n.which==3),!t)&&(this._isSupport||this.model.showPopupButton||(n.preventDefault(),this._onFocusIn()),!this.model.readOnly)){if(n.preventDefault(),!this.model.enabled&&this.model.displayInline)return!1;this._showhidePopup(n)}},_layoutChanged:function(){this._getInternalEvents&&this._trigger("layoutChange")},_setCurrDate:function(n){if(this.model.readOnly||!this.model.enabled)return!1;n&&n.preventDefault();var t=this;this._prevDate=this._formatter(this.model.value,this.model.dateFormat);this._dateValue=this._zeroTime(new Date);this.model.value=this._calendarDate=new Date(this._dateValue.toString());this._setDateValue(this.model.value);this._triggerSelectEvent(n);this._triggerChangeEvent(n);this._refreshDatepicker();this._changeDayClass();this._startLevel(this.model.startLevel);this._onSetCancelDateHandler(n);this._layoutChanged()},_changeDayClass:function(){var n=this.popup.children("table")[0].className;n!="e-dp-viewdays"&&this.popup.children("table").removeClass(n).addClass("e-dp-viewdays")},_onSetCancelDateHandler:function(t){if(this.model.readOnly||!this.model.enabled||t&&(n(t.target).hasClass("e-disable")||n(t.target).hasClass("e-hidedate")))return!1;t&&t.type&&t.preventDefault();this._specificFormat()?this._prevDate=this.element.val():this.model.value=this._parseDate(this.element.val());this._prevDate=this._formatter(this.model.value,this.model.dateFormat);this._setDateValue(this._dateValue);this._triggerSelectEvent(t);this._triggerChangeEvent(t);this._dateValue=new Date(this.model.value.toString());this.element.is(":input")&&!this.model.displayInline&&this._showhidePopup(t);t&&n(t.currentTarget).hasClass("other-month")&&this._refreshDatepicker();this._cellSelection()},_closeCalendar:function(n){n&&n!=this.element||this.sfCalendar.empty().remove()},_checkErrorClass:function(){this.wrapper&&(this.isValidState?this.wrapper.removeClass("e-error").attr("aria-invalid","false"):this.wrapper.addClass("e-error").attr("aria-invalid","true"))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.DatePicker.Locale=t.DatePicker.Locale||{};t.DatePicker.Locale["default"]=t.DatePicker.Locale["en-US"]={watermarkText:"Select date",buttonText:"Today"};t.DatePicker.Header={None:"none",Short:"short",Min:"min",Long:"long"};t.DatePicker.HighlightSection={Month:"month",Week:"week",WorkDays:"workdays",None:"none"};t.DatePicker.Level={Month:"month",Year:"year",Decade:"decade",Century:"century"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejTimePicker","ej.TimePicker",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_rootCSS:"e-timepicker",_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{cssClass:"",timeFormat:"",value:null,enableAnimation:!0,locale:"en-US",htmlAttributes:{},readOnly:!1,showPopupButton:!0,enableStrictMode:!1,interval:30,hourInterval:1,minutesInterval:1,secondsInterval:1,height:"",width:"",minTime:"12:00 AM",maxTime:"11:59 PM",showRoundedCorner:!1,enableRTL:!1,popupHeight:"191px",popupWidth:"auto",enabled:!0,enablePersistence:!1,disableTimeRanges:null,validationRules:null,validationMessages:null,focusIn:null,focusOut:null,beforeChange:null,change:null,select:null,create:null,destroy:null,beforeOpen:null,open:null,close:null},dataTypes:{timeFormat:"string",minTime:"string",maxTime:"string",readOnly:"boolean",interval:"number",showPopupButton:"boolean",locale:"string",hourInterval:"number",minutesInterval:"number",secondsInterval:"number",enabled:"boolean",enablePersistence:"boolean",enableAnimation:"boolean",enableStrictMode:"boolean",disableTimeRanges:"data",htmlAttributes:"data",validationRules:"data",validationMessages:"data"},observables:["value"],enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.element.prop("disabled",!1),this.model.enabled=!0,this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable").attr("aria-disabled",!1),this.model.showPopupButton&&(this.timeIcon.removeClass("e-disable").attr("aria-disabled",!1),this.popupList.removeClass("e-disable").attr("aria-disabled",!1)),this._isIE8&&this.timeIcon.children().removeClass("e-disable"))},disable:function(){this.model.enabled&&(this.element[0].disabled=!0,this.model.enabled=!1,this.element.attr("disabled","disabled"),this.wrapper.addClass("e-disable"),this.element.addClass("e-disable").attr("aria-disabled",!0),this.model.showPopupButton&&(this.timeIcon.addClass("e-disable").attr("aria-disabled",!0),this.popupList.addClass("e-disable").attr("aria-disabled",!0)),this._isIE8&&this.timeIcon.children().addClass("e-disable"),this._hideResult())},getValue:function(){return this.element.val()},setCurrentTime:function(){this.model.readOnly||this._setMask()},show:function(){this.showDropdown||this._getInternalEvents||this._showResult()},hide:function(){this.showDropdown&&this._hideResult()},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_timeFormat:function(n){var r,i;return n||(n=t.preferredCulture(this.model.locale).calendars.standard.patterns.t),r=this._validateTimeFormat(n),r&&(this.model.timeFormat=r,this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale),this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale),this.model.value?(this._setModelOption=!0,this.model.value=this._localizeTime(this.model.value),this.element.val(this.model.value)):(this._setModelOption=!1,i=this._localizeTime(this.element.val()),i&&this._checkMinMax(i)&&(this.model.value=i,this.element.val(i)))),r},_getTimeFormat:function(){this.model.timeFormat=t.preferredCulture(this.model.locale).calendar.patterns.t||"h:mm tt";this.seperator=this._getSeperator()},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popupList&&this.popupList.removeClass(this.model.cssClass).addClass(n)},_localize:function(n){var i=this._createObject(this.model.value,!0);this.model.locale=n;this._getTimeFormat();this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale);this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale);i?(this.model.value=this._localizeTime(i),this.element.val(this.model.value)):(i=this._localizeTime(this.element.val()),i&&this._checkMinMax(i)&&(this.model.value=i,this.element.val(i)));this._getAmPm()},_setLocalize:function(n){var n=t.preferredCulture(n);n&&(this.model.locale=n.name=="en"?"en-US":n.name,t.isNullOrUndefined(this._options)||!t.isNullOrUndefined(this._options.timeFormat)&&this._options.timeFormat||(this.model.timeFormat=t.preferredCulture(this.model.locale).calendars.standard.patterns.t))},_updateInput:function(){if(!t.isNullOrUndefined(this._options)){var n=this._localizeTime(this._options.value);t.isNullOrUndefined(n)||typeof n=="string"&&this.model.enableStrictMode&&!this.model.value&&(this.element.val(this._options.value),this.isValidState=this.element.val()==""?!0:!1,this._checkErrorClass())}},_createMinMaxObj:function(){this._minTimeObj=this._createObject(this.model.minTime);this._minTimeObj||(this.model.minTime=t.format(this._createObject((new Date).setHours(0,0,0,0)),this.model.timeFormat,this.model.locale));this._maxTimeObj=this._createObject(this.model.maxTime);this._maxTimeObj||(this.model.maxTime=t.format(this._createObject((new Date).setHours(23,59,59,59)),this.model.timeFormat,this.model.locale))},_setMinMax:function(){var n=(new Date).setHours(0,0,0,0),i=(new Date).setHours(23,59,59,59);!t.isNullOrUndefined(this._options)&&t.isNullOrUndefined(this._options.minTime)&&(this.model.minTime=t.format(this._createObject(n),this.model.timeFormat,this.model.locale));!t.isNullOrUndefined(this._options)&&t.isNullOrUndefined(this._options.maxTime)&&(this.model.maxTime=t.format(this._createObject(i),this.model.timeFormat,this.model.locale));this._createMinMaxObj()},_init:function(n){if(this._options=n,this._cloneElement=this.element.clone(),this._ISORegex(),!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this._initialize();this._render();this._wireEvents();n&&n.value!=r&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()});this._updateInput();this._updateTextbox();this.model.validationRules!=null&&(this._initTimeValidator(),this._setTimeValidation())},_updateTextbox:function(){this._options!==r&&(this._options.value!==r||this.model.value)||this._setTime(this._localizeTime(this.model.minTime))},_setMinMaxTime:function(i,r){!t.isNullOrUndefined(r.minTime)&&n.trim(r.minTime)&&this._isValid(r.minTime)&&(this.model.minTime=r.minTime,this._minTimeObj=this._createObject(this.model.minTime),this._validateTimes());!t.isNullOrUndefined(r.maxTime)&&n.trim(r.maxTime)&&this._isValid(r.maxTime)&&(this.model.maxTime=r.maxTime,this._maxTimeObj=this._createObject(this.model.maxTime),this._validateTimes());this._validateMinMax();this._createMinMaxObj();t.isNullOrUndefined(r.minTime)||(r.minTime=this.model.minTime);t.isNullOrUndefined(r.maxTime)||(r.maxTime=this.model.maxTime);this._checkMinMax(this.model.value)||(this.model.enableStrictMode?(this.isValidState=!1,this.model.value=null):(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime)));i!==this.model.value&&this._isValid(this.model.value,!0)&&this.element.val(this.model.value)},_setModel:function(n){var r=!1,o=this.model.value,i,e,u,f,s;for(i in n)switch(i){case"timeFormat":u=this._createObject(this.model.value);this._preTimeformat=this.model.timeFormat;e=this._timeFormat(n[i]);n[i]=this.model.timeFormat;e&&(this.seperator=this._getSeperator());f=this._createObject(this.model.value);r=+u==+f?!1:!0;break;case"locale":u=this._createObject(this.model.value);this._localize(n[i]);this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale);this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale);f=this._createObject(this.model.value);r=+u==+f?!1:!0;break;case"interval":this.model.interval=n[i];break;case"cssClass":this._changeSkin(n[i]);break;case"showRoundedCorner":this._setRoundedCorner(n[i]);break;case"enableRTL":this._setRtl(n[i]);break;case"height":this._setHeight(n[i]);break;case"width":this.wrapper.width(n[i]);this._setListWidth();break;case"value":t.isPlainObject(n[i])&&(n[i]=null);this.model.value=t.format(this._createObject(n[i],!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(n[i],!0)&&(s=this._isValid(n[i])?this._localizeTime(n[i]):n[i],this.element.val(s));n[i]=this.model.value;r=!0;break;case"enableStrictMode":this.model.enableStrictMode=n[i];break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initTimeValidator(),this._setTimeValidation());break;case"validationMessages":this.model.validationMessages=n[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initTimeValidator(),this._setTimeValidation());break;case"popupHeight":this.model.popupHeight=n[i];this._setListHeight();break;case"popupWidth":this.model.popupWidth=n[i];this._setListWidth();break;case"enabled":n[i]?this.enable():this.disable();break;case"htmlAttributes":this._addAttr(n[i]);break;case"disableTimeRanges":this.model.disableTimeRanges=n[i];this._initStartEnd();this.model.value=t.format(this._createObject(this.element.val(),!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(this.element.val(),!0)&&this.element.val(this.element.val());r=!0}t.isNullOrUndefined(n.minTime)&&t.isNullOrUndefined(n.maxTime)||(this._setMinMaxTime(o,n),r=!0);t.isNullOrUndefined(n.showPopupButton)?!this.model.showPopupButton||!e&&t.isNullOrUndefined(n.minTime)&&t.isNullOrUndefined(n.maxTime)&&t.isNullOrUndefined(n.locale)&&t.isNullOrUndefined(n.interval)&&t.isNullOrUndefined(n.disableTimeRanges)||this._reRenderDropdown():this._showButton(n[i]);r&&(this._raiseChangeEvent(o,!0),n.value=this.model.value);this._checkErrorClass()},_destroy:function(){this.element.insertAfter(this.wrapper);this.wrapper.remove();this.element.removeClass("e-input").removeAttr("ondragstart draggable aria-atomic aria-live aria-readonly").val(this.element.attr("value"));this._cloneElement.attr("name")||this.element.removeAttr("name");this.popupList&&this.popupList.remove()},_initialize:function(){this.target=this.element[0];this.timeIcon=null;this._disabledItems=[];this.popupList=null;this.focused=!1;this.start=0;this.end=0;this.min=null;this.max=null;this.incomplete=!1;this.downPosition=0;this._setLocalize(this.model.locale);this._setMinMax();this._getAmPm();this.showDropdown=!1;this._activeItem=0;this.isValidState=!0;this._manualFocus=!1;this._isIE7=this._checkIE7();this._initStartEnd();t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value);this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._getInternalEvents=!1;this._dateTimeInternal=!1;this.model.timeFormat?this.seperator=this._getSeperator():this._getTimeFormat()},_render:function(){this._renderWrapper();this._setDimentions();this._renderTimeIcon();this._validateTimes();this._createMinMaxObj();this._renderDropdown();this._addAttr(this.model.htmlAttributes);this._checkProperties();this._enableMask();this._checkErrorClass();this.element.attr({"aria-atomic":"true","aria-live":"assertive","aria-readonly":this.model.readOnly,value:this.model.value});(this.model.showPopupButton||!t.isNullOrUndefined(this.popupList))&&this.ul.find("li").attr({tabindex:-1,"aria-selected":!1});t.isNullOrUndefined(this.model.value)?this.wrapper.addClass("e-valid"):this.wrapper.removeClass("e-valid")},_renderWrapper:function(){this.element.addClass("e-input").attr("tabindex","0");this.wrapper=t.buildTag("span.e-timewidget e-widget "+this.model.cssClass+"#"+this.target.id+"_timewidget").insertAfter(this.element);this.wrapper.attr("style",this.element.attr("style"));this.element.removeAttr("style");t.isTouchDevice()||this.wrapper.addClass("e-ntouch");this.container=t.buildTag("span.e-in-wrap e-box").append(this.element);this.wrapper.append(this.container)},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r.disable():u=="readOnly"&&n=="readOnly"?r.model.readOnly=!0:u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_initTimeValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setTimeValidation:function(){var r,i,u,f;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_renderTimeIcon:function(){if(this.model.showPopupButton){this.timeIcon=t.buildTag("span.e-select").attr({role:"button","aria-label":"select"});var n=t.buildTag("span.e-icon e-clock").attr("role","presentation");this._isIE8&&(this.timeIcon.attr("unselectable","on"),n.attr("unselectable","on"));this.timeIcon.append(n);this.container.append(this.timeIcon).addClass("e-padding");this._on(this.timeIcon,"mousedown",this._timeIconClick)}},_elementClick:function(){this.showDropdown||this._showResult()},_renderDropdown:function(){var i=n("#"+this.element[0].id+"_popup").get(0),r;if(i&&n(i).remove(),!this.model.showPopupButton||this.popupList)return!1;this.popupList=t.buildTag("div.e-time-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.target.id+"_popup","",{},{tabindex:0,"aria-activedescendant":""});t.isTouchDevice()||this.popupList.addClass("e-ntouch");this.popup=this.popupList;this.ul=t.buildTag("ul.e-ul");this._isIE8&&this.ul.attr("unselectable","on");r=t.buildTag("div").append(this.ul);n("body").append(this.popupList.append(r));this._renderLiTags();this._setListHeight();this._setListWidth();this.popupList.ejScroller({height:this.popupList.height(),width:0,scrollerSize:20});this.scrollerObj=this.popupList.ejScroller("instance");this.popupList.css("display","none");this._listSize=this.ul.find("li").length},_renderLiTags:function(){var r,o,f,s,h,e,i,u;for(this._disabledItems=[],s=this.model.interval*6e4,h=!t.isNullOrUndefined(this.model.disableTimeRanges)&&this.model.disableTimeRanges.length>0?!0:!1,r=this._minTimeObj,o=this._maxTimeObj,e=0;this._compareTime(o,r,!0);)f=this._localizeTime(r),i=n(document.createElement("li")),i[0].appendChild(document.createTextNode(f)),this._isIE8&&i.attr("unselectable","on"),h&&(this._ensureTimeRange(f)?(i.addClass("e-disable"),this._disabledItems.push(e)):i.removeClass("e-disable")),this.ul[0].appendChild(i[0]),r=new Date(r).getTime()+s,e++;u=this.ul.find("li");t.isTouchDevice()||(this._on(u,"mouseenter",n.proxy(this._OnMouseEnter,this)),this._on(u,"mouseleave",n.proxy(this._OnMouseLeave,this)));this._on(u,"click",n.proxy(this._OnMouseClick,this))},_ensureTimeRange:function(n){if(!t.isNullOrUndefined(this.model.disableTimeRanges)){var r=this._makeDateTimeObj(n);for(i=0;i=+this._makeDateTimeObj(this.model.disableTimeRanges[i].startTime)&&+r<=+this._makeDateTimeObj(this.model.disableTimeRanges[i].endTime))return!0}return!1},_initStartEnd:function(){if(this._startTime=[],this._endTime=[],!t.isNullOrUndefined(this.model.disableTimeRanges))for(i=0;ic?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){return char=n.toLowerCase(),char=="t"||char=="z"||char==":"||char=="-"?!0:!1},_setMask:function(){this.model.value=new Date;this._enableMask()},_validateTimes:function(){var n=this._validateTimeFormat(this.model.timeFormat);this.model.timeFormat=n?n:"h:mm tt";this._isValid(this.model.minTime)||(this.model.minTime="12:00 AM");this._isValid(this.model.maxTime)||(this.model.maxTime="11:59 PM");this._isValid(this.model.value,!0)||(this.model.value=null);this._checkMinMax(this.model.value)||this.model.enableStrictMode||(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime));this._validateMinMax()},_ensureValue:function(){!this._checkMinMax(this.model.value)&&this._isValid(this.model.value,!0)&&(this.model.enableStrictMode?this.isValidState=!1:(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime)))},_validateMinMax:function(){this.model.minTime&&this.model.maxTime&&this._compareTime(this.model.minTime,this.model.maxTime)&&(this.model.minTime=this.model.maxTime)},_checkProperties:function(){this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable());this._addProperty();this._checkAttributes()},_addProperty:function(){this._setRtl(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner)},_setRtl:function(n){n?(this.wrapper.addClass("e-rtl"),this.popupList&&this.popupList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popupList&&this.popupList.removeClass("e-rtl"))},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popupList&&this.popupList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popupList&&this.popupList.removeClass("e-corner"))},_showButton:function(t){this.model.showPopupButton=t;t?(this.container.addClass("e-padding"),this._renderTimeIcon(),this._renderDropdown(),this._addProperty()):(this.container.removeClass("e-padding"),this.timeIcon.remove(),this.popupList.remove(),this.timeIcon=this.popupList=null,n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)))},_checkAttributes:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id});"ondragstart"in document.createElement("input")&&this.element.attr({ondragstart:"return false"});"draggable"in document.createElement("input")&&this.element.attr({draggable:"false"})},_getAmPm:function(){var t=new Date;t.setHours(0);this.ttAM=n.trim(this._localizeMeridian(t));t.setHours(23);this.ttPM=n.trim(this._localizeMeridian(t))},_setDimentions:function(){this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this._setHeight(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_setHeight:function(n){n&&this.wrapper.height(n);this._isIE7&&this.element.height(this.container.height())},_validateTimeFormat:function(t){var i=t.split(" "),r="";return i.length==1||i.length==2?(n(i).each(function(t,i){r+=n.trim(i)+" "}),n.trim(r)):null},_getSeperator:function(){for(var i=this._getElePlace(),t=this.model.timeFormat.split(" ")[i.time],r=new RegExp("^[a-zA-Z0-9]+$"),n=0;n-1&&this.element.val("");!this._checkMinMax(this.target.value)&&this._isValid(this.target.value,!0)?this.model.enableStrictMode?this.isValidState=!1:(this.model.minTime&&!this._compareTime(this._createObject(this.target.value),this.model.minTime,!0)&&this.element.val(this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this._createObject(this.target.value),!0)&&this.element.val(this.model.maxTime),this._isValid(this.model.value,!0)||this.element.val(null),this.isValidState=!0,t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")):this.isValidState=!0;this._ensureValue();this._raiseChangeEvent();this._checkErrorClass();this._raiseEvent("focusOut");this.model.enableStrictMode||this._checkInComplete();t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")},_clearRange:function(){var n=this.element[0];isNaN(n.selectionStart)||(n.selectionStart=0,n.selectionEnd=0)},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error").attr("aria-invalid","false"):this.wrapper.addClass("e-error").attr("aria-invalid","true")},_getCaretSelection:function(){var n=this.element[0],u=0,f=0,e,t,i,r,o;return isNaN(n.selectionStart)?(e=document.selection.createRange().getBookmark(),t=n.createTextRange(),t.moveToBookmark(e),i=n.createTextRange(),i.collapse(!0),i.setEndPoint("EndToStart",t),r=i.text.length,o=t.text.length,{start:r,end:r+o}):(u=n.selectionStart,f=n.selectionEnd,{start:Math.abs(u),end:Math.abs(f)})},_mouseDownOnInput:function(){this.focused||t.isTouchDevice()||this._focusElement();this.downPosition=this._getCaretSelection();n(document).on("mouseup",n.proxy(this._mouseUpOnInput,this))},_mouseUpOnInput:function(t){t.preventDefault();n(document).off("mouseup",n.proxy(this._mouseUpOnInput,this));var i=this._getCaretSelection();this.incomplete&&(this.incomplete=!1,i=this.downPosition);this.target.value!=this._getSelectedText()&&(i=this._getStartEnd(i),this._setSelection(i.start,i.end))},_getCategoryPosition:function(n){var i=0,r=0,u=this.target.value.split(" "),t=this._getElePlace(),h=this.seperator,e=!1,o=this.model.timeFormat.split(" ")[t.time].split(h),c=u[t.time].split(h),s,f;if(o.length>c.length)return{start:i,end:r,isValid:e};if(n=="tt")(u[t.tt]==this.ttAM||u[t.tt]==this.ttPM)&&(i=t.tt==0?0:u[t.time].length+1,r=i+u[t.tt].length,e=!0);else if(i=t.time==0?0:u[t.tt].length+1,s=o.indexOf(n),s!=-1){for(f=0;ft.length||isNaN(this._activeItem))&&(this._activeItem=0)},_keyDownOnInput:function(n){var t,u,i,b,h,k,c,e,v,y,d,l,o,g,a,p,f,w,s,r;if(this.model.readOnly&&!this._readOnlyKeys(n)||(i=n.keyCode,this._getInternalEvents&&i!=38&&i!=40&&i!=36&&i!=35&&i!=9))return!1;if(!this.model.enableStrictMode){if(this.showDropdown&&i!=38&&i!=40&&i!=27&&!this._readOnlyKeys(n))return!1;this.showDropdown&&(i==37||i==39)&&(n.keyCode=i==37?38:40)}t=this._getCaretSelection();r=this._getStartEnd(t);u=this._getCategory(r);switch(n.keyCode){case 38:n.preventDefault();this.showDropdown?this.showDropdown&&(n.preventDefault(),this._findActiveIndex(),prevActiveItem=this._activeItem,this._activeItem=this._disableItemSelectUp(this._activeItem-1),this._activeItem==0&&(this._activeItem=prevActiveItem),this._addListHover(),activeItem=this._getActiveItem(),activeItem.length&&this._selectTimeItem(activeItem)):this._isValid(this.target.value)&&this._modifyValue(!0);break;case 40:n.preventDefault();n.altKey&&this.model.showPopupButton?this._showhidePopup():this.showDropdown?this.showDropdown&&(n.preventDefault(),this._findActiveIndex(),prevActiveItem=this._activeItem,this._activeItem=this._disableItemSelectDown(this._activeItem),this._activeItem0?e=!0:!n.shiftKey&&t.end47&&n.keyCode<58?f=String.fromCharCode(p):n.keyCode>95&&n.keyCode<106&&(f=String.fromCharCode(p-48));u=="tt"&&(!n.shiftKey&&!n.ctrlKey&&!n.altKey&&n.keyCode>64&&n.keyCode<91||n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106)&&(n.preventDefault(),w=this._getCategoryPosition(u),this.start=w.start,this.end=w.end,this._changeAmPm(a),this._raiseChangeEvent());this.target.value!=this._getSelectedText()||n.shiftKey||n.ctrlKey||n.altKey||(n.keyCode>64&&n.keyCode<91&&!this.model.enableStrictMode&&n.preventDefault(),(n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106)&&(r=this._getStartEnd(t),this._setSelection(r.start,r.end)));!n.shiftKey&&!n.ctrlKey&&!n.altKey&&n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106?u!="tt"&&(this._getMinMax(u,!0),t.start==t.end?(this._findCategoryPosition(u),t.start==this.start?(s=f+a,this.element.val(this.model.minTime),r=this._getStartEnd(t),this._setSelection(r.start,r.end)):s=a+f,(s.length>2||!(Number(s)>=this.min&&this.max>=Number(s)))&&(this.model.enableStrictMode||n.preventDefault())):Number(f)>=this.min&&this.max>=Number(f)||this.model.enableStrictMode||n.preventDefault()):this._allowKeyCodes(n)||(this.model.enableStrictMode?n.stopPropagation():n.keyCode==8||n.keyCode==46?n.stopPropagation():n.preventDefault())},_getSelectedText:function(){if(window.getSelection){var t=n("#"+this.element[0].id).get(0);return t.value.substring(t.selectionStart,t.selectionEnd)}return document.selection.createRange().text},_allowKeyCodes:function(n){return n.ctrlKey&&(n.keyCode==65||n.keyCode==67||n.keyCode==90||n.keyCode==89)||n.keyCode==9||n.keyCode==116||n.keyCode==13?!0:!1},_readOnlyKeys:function(n){return n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39||this._allowKeyCodes(n)?!0:!1},_firstlastVal:function(n){var t=this.model.timeFormat.split(" "),r=this.seperator,i;return n?t[0]!="tt"?t[0].split(r)[0]:"tt":t[0]!="tt"?"tt":t[1]?(i=t[1].split(r),i.length?i[i.length-1]:"tt"):"tt"},_mouseWheel:function(n){if(n.preventDefault(),this.model.readOnly)return!1;var t,i=n.originalEvent;i.wheelDelta?t=i.wheelDelta/120:i.detail&&(t=-i.detail/3);t>0?this._modifyValue(!0):t<0&&this._modifyValue(!1)},_addListHover:function(){this._addSelected();this._updateScrollTop()},_addSelected:function(){this.ul.find("li").removeClass("e-active e-hover");var n=this._getActiveItem();n.length&&!n.hasClass("e-disable")&&n.addClass("e-active")},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t0)return this._disableItemSelectUp(t)}return 0},_getActiveItem:function(){return n(this.ul.find("li")[this._activeItem-1])},_timeIconClick:function(n){var i=!1,r;if(n.button?i=n.button==2:n.which&&(i=n.which==3),!i){if(n.preventDefault(),!this.model.enabled||this.model.readOnly||this.ul.find("li").length<1)return!1;this._showhidePopup();r=this.element.val().length;t.isTouchDevice()||this._setSelection(r,r)}},_showhidePopup:function(){if(this._getInternalEvents)return!1;this.showDropdown?this._hideResult():this._showResult()},_showResult:function(){this._raiseEvent("beforeOpen");this._refreshPopup();this.focused||t.isTouchDevice()||this._focusElement();this.model.value?this._changeActiveEle():this.ul.find("li").removeClass("e-active");var i=this,r=this._vissibleAndCalculateTop();this.popupList.slideDown(this.model.enableAnimation?200:0,function(){n(document).on("mousedown",n.proxy(i._OnDocumentClick,i))});this.scrollerObj.setModel({scrollTop:r});this.showDropdown=!0;this._listSize=this.ul.find("li").length;n(window).on("resize",n.proxy(this._OnWindowResize,this));this._on(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._on(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult);this._raiseEvent("open");this.wrapper.addClass("e-active")},_hideResult:function(){this.showDropdown&&!this._getInternalEvents&&(this.showDropdown=!1,this.popupList.slideUp(this.model.enableAnimation?100:0),n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this._off(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult),this._raiseEvent("close"),this.wrapper.removeClass("e-active"))},_vissibleAndCalculateTop:function(){this.popupList.css({display:"block"});var n=this._calcScrollTop();return this.popupList.css({display:"none"}),n},_calcScrollTop:function(){var i=this.ul.outerHeight(),n=this.ul.find("li").outerHeight(),t;return t=this.ul.find("li.e-active").index(),n*t-(this.popupList.outerHeight()-n)/2},_changeActiveEle:function(){if(!this.model.showPopupButton||!this.popupList)return!1;var t=this.ul.find("li"),i=this.element.val(),r=t.first().html(),n;n=(this._parse(i)-this._parse(r))/(this.model.interval*6e4);n=Math.round(n);this._activeItem=n==t.length?n:n+1;(this._activeItem<0||this._activeItem>t.length||isNaN(this._activeItem)||this._ensureTimeRange(i))&&(this._activeItem=0);this._addListHover()},_OnDocumentClick:function(t){n(t.target).is(this.popupList)||n(t.target).parents(".e-time-popup").is(this.popupList)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-timewidget").is(this.wrapper)?(n(t.target).is(this.popupList)||n(t.target).parents(".e-time-popup").is(this.popupList))&&t.preventDefault():this._hideResult()},_OnWindowResize:function(){this._refreshPopup()},_OnMouseEnter:function(t){var i=t.target;this.ul.find("li").removeClass("e-hover");n(i).hasClass("e-disable")||n(i).addClass("e-hover")},_OnMouseLeave:function(){(!this._dateTimeInternal||this.model.value)&&this.ul.find("li").removeClass("e-hover")},_OnMouseClick:function(t){(t.preventDefault(),n(t.target).hasClass("e-disable"))||(this.model.enabled&&!this.model.readOnly&&(this._activeItem=n(t.target).index()+1,this.ul.find("li").attr({tabindex:-1,"aria-selected":!1}),n(t.target).attr({"aria-selected":!0,tabindex:0}),this._addSelected(),this._selectTimeItem(n(t.target))),this._showhidePopup())},_selectTimeItem:function(n){this._beforeChange(n);var t=this._raiseChangeEvent();t&&this._trigger("select",{value:this.model.value,prevTime:this._previousValue})},_findCategoryPosition:function(n){n=="least"&&(n=this._getLeast(!0));var t=this._getCategoryPosition(n);this.start=t.start;this.end=t.end},_getLeast:function(t){var r=this.model.timeFormat.split(" "),u=this.seperator,i=null;return n(r).each(function(n,r){if(r!="tt"){var f=r.split(u);i=t?f[f.length-1]:f[0]}}),i},_changeValue:function(n,r){var l=this.target.value,u,f=this._getCategory(n),o;if(!f)return!1;if(this._setSelection(this.start,this.end),u=this.target.value.substring(this.start,this.end),this._checkMinMax(this.target.value))if(u!=this.ttAM&&u!=this.ttPM){if(u=this._changeCurrentValue(u,f,r),f.length!=1&&(u=this._changeWhole(u)),this._findCategoryPosition(f),this.element.val(this._replaceAt(this.target.value,this.start,this.end,u)),this.end=this.start+u.toString().length,this._setSelection(this.start,this.end),this._ensureTimeRange(this.target.value)&&this._checkMinMax(this.target.value)){var e=this._createObject(this.target.value),s=e.getHours(),h=r?this._startTime:this._endTime,c=r?this._endTime:this._startTime;if(!t.isNullOrUndefined(this.model.disableTimeRanges))for(i=0;i=+this._startTime[i]&&+e<=+this._endTime[i])&&(this.target.value=this._localizeTime(c[i]),this._setSelection(this.start,this.end),this._changeValue(n,r))}}else this._changeAmPm(u);else o=this._checkExceedRange(this.target.value),this._setTime(this.model[o]),this._findCategoryPosition(f),this._setSelection(this.start,this.end);this._checkMinMax(this.target.value)?this._raiseChangeEvent():(this.element.val(this.model.value),this._findCategoryPosition(f),this._setSelection(this.start,this.end))},_checkMinMax:function(n){var t=this._checkExceedRange(n);return t==null&&(t=!1),!t},_checkExceedRange:function(n){if(n){if(this.model.minTime&&!this._compareTime(n,this.model.minTime,!0))return"minTime";if(this.model.maxTime&&!this._compareTime(this.model.maxTime,n,!0))return"maxTime"}return null},_changeWhole:function(n){return n>9?""+n:"0"+n},_changeAmPm:function(n){n=n==this.ttAM?this.ttPM:this.ttAM;this.element.val(this._replaceAt(this.target.value,this.start,this.end,n));this._setSelection(this.start,this.end)},_changeMinute:function(n){var i=this._getExactFormat(["mm","m"]),t;i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),n?t==this.max?(t=this.min,this._changeHour(n)):t+=1:t==this.min?(t=this.max,this._changeHour(n)):t-=1,this._findCategoryPosition(i),i.length!=1&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_changeHour:function(n){var i=this._getExactFormat(["hh","h","HH","H"]),t;i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),n?t==this.max?(t+=1,this._changeMeridian()):t>this.max?t=this.min:t+=1:t==this.min?t=this.max+1:t>this.max?(t=this.max,this._changeMeridian()):t-=1,this._findCategoryPosition(i),i.length!=1&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_getExactFormat:function(n){for(var i=this.model.timeFormat,t=0;tthis.max?n=this.min-1+u:nthis.max+1&&(n=n-(this.max+1),f&&this._changeAdjacent(r,i)),r!="hh"&&r!="h"&&n==this.max+1&&(n=this.min,f&&this._changeAdjacent(r,i))):(r!="hh"&&r!="h"&&n>this.min?n-=u:(r=="hh"||r=="h")&&n>this.min&&n<=this.max?n-=u:(r=="hh"||r=="h")&&n==this.min?n=this.max+2-u:(f=!1,n=this.max+1-u,this._changeAdjacent(r,i)),n=7&&n<8)return!0}return!1},_replaceAt:function(n,t,i,r){return n.substring(0,t)+r+n.substring(i)},_localizeTime:function(i){return i?n.trim(t.format(this._createObject(i),this.model.timeFormat,this.model.locale)):null},_localizeMeridian:function(i){return n.trim(t.format(i,"tt",this.model.locale))},_compareTime:function(n,t,i){return i=i?!0:!1,i?this._parse(n)>=this._parse(t):this._parse(n)>this._parse(t)},_isValid:function(n,t){return n=this._createObject(n,t),n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_parse:function(n){return Date.parse(this._createObject(n))},_setEmptyDate:function(n){var t=new Date(n);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_createObject:function(n,i){var r=null,f,e;if(typeof n=="string"){var o=this._setModelOption?this._preTimeformat:this.model.timeFormat,u=t.preferredCulture(this.model.locale).calendar.patterns.d,s=t.format(new Date("1/1/2000"),u,this.model.locale);r=t.parseDate(s+" "+n,u+" "+o,this.model.locale);(this._extISORegex.exec(n)||this._basicISORegex.exec(n))&&(this.model.value=r=this._timeFromISO(n));this._setModelOption=!1;r||(f=new Date(n),r=isNaN(Date.parse(f))||t.isNullOrUndefined(n)?!this._dateTimeInternal||n==""?null:new Date("1/1/2000 "+n):this._setEmptyDate(n))}else typeof n=="number"?r=new Date(n):n instanceof Date&&(r=this._setEmptyDate(n));return r&&!this._dateTimeInternal&&i&&(e=this._localizeTime(r),this._ensureTimeRange(e)&&(r=null)),r},_wireEvents:function(){this._on(this.element,"focus",this._targetFocus);this._on(this.element,"blur",this._targetBlur);this._on(this.element,"mousedown",this._mouseDownOnInput);this._on(this.element,"keydown",this._keyDownOnInput);this._on(this.element,"keyup",this._keyUpOnInput)}})}(jQuery,Syncfusion),function(n,t,r){t.widget("ejDateTimePicker","ej.DateTimePicker",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,_rootCSS:"e-datetimepicker",type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{cssClass:"",locale:"en-US",readOnly:!1,showRoundedCorner:!1,enableRTL:!1,htmlAttributes:{},allowEdit:!0,enabled:!0,value:"",name:null,minDateTime:new Date("1/1/1900 12:00:00 AM"),maxDateTime:new Date("12/31/2099 11:59:59 PM"),height:"",width:"",dateTimeFormat:"",showPopupButton:!0,enableStrictMode:!1,buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"},watermarkText:"Select datetime",enablePersistence:!1,interval:30,timeDisplayFormat:"",timePopupWidth:105,popupPosition:"bottom",dayHeaderFormat:"short",startLevel:"month",depthLevel:"",startDay:-1,stepMonths:1,showOtherMonths:!0,enableAnimation:!0,headerFormat:"MMMM yyyy",validationRules:null,validationMessage:null,validationMessages:null,timeDrillDown:{enabled:!1,interval:5,showMeridian:!1,autoClose:!0,showFooter:!0},beforeOpen:null,beforeClose:null,open:null,close:null,change:null,create:null,destroy:null,focusIn:null,focusOut:null},dataTypes:{allowEdit:"boolean",cssClass:"string",locale:"string",readOnly:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",enabled:"boolean",enableAnimation:"boolean",dateTimeFormat:"string",showPopupButton:"boolean",buttonText:"data",watermarkText:"string",enablePersistence:"boolean",enableStrictMode:"boolean",interval:"number",timeDrillDown:"data",timeDisplayFormat:"string",dayHeaderFormat:"string",startLevel:"string",depthLevel:"string",startDay:"number",stepMonths:"number",showOtherMonths:"boolean",headerFormat:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data"},_setModel:function(i){var r,f=!1,e,u,o;for(r in i)switch(r){case"allowEdit":this._changeEditable(i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"locale":this._localize(i[r]);break;case"readOnly":this._readOnly(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enableRTL":this._setRtl(i[r]);break;case"enabled":this._enabled(i[r]);break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"value":i[r]=this._setValue(i[r]);this._specificFormat()&&(this._stopRefresh=!0);f=!0;break;case"enableStrictMode":this.model.enableStrictMode=i[r];f=!0;break;case"minDateTime":u=this._stringToObject(i[r]);e=this._getFormat(u,this.timePicker.model.timeFormat);this._isValidDate(u)?(this.datePicker.option("minDate",u),this.timePicker.option("minTime",e),i[r]=u,this.model.minDateTime=u):i[r]=this.model[r];f=!0;break;case"maxDateTime":u=this._stringToObject(i[r]);o=this._getFormat(i[r],this.timePicker.model.timeFormat);this._isValidDate(u)?(this.datePicker.option("maxDate",u),this.timePicker.option("maxTime",o),i[r]=u,this.model.maxDateTime=u):i[r]=this.model[r];f=!0;break;case"height":this.wrapper.height(i[r]);break;case"width":this.wrapper.width(i[r]);break;case"dateTimeFormat":this.model.dateTimeFormat=i[r];this.isValidState&&this._setValue(this.model.value);break;case"showPopupButton":this._showButton(i[r]);break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options[r]=this.model.watermarkText=i[r];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"buttonText":t.isNullOrUndefined(this._options)||(this._options=[]);this._options.buttonText=this.model.buttonText=i[r];this._localizedLabels.buttonText=this.model.buttonText;this._buttonText(i[r]);break;case"interval":this._updateTimeHeight();this.timePicker.option("interval",i[r]);break;case"timeDisplayFormat":this._updateTimeHeight();this.timePicker.option("timeFormat",i[r]);break;case"timePopupWidth":this._updateTimeHeight();this.timePicker.option("popupWidth",i[r]);break;case"dayHeaderFormat":this.datePicker.option("dayHeaderFormat",i[r]);break;case"startLevel":this.datePicker.option("startLevel",i[r]);break;case"depthLevel":this.datePicker.option("depthLevel",i[r]);break;case"startDay":this.datePicker.option("startDay",i[r]);this.model.startDay=this.datePicker.model.startDay;i[r]=this.model.startDay;break;case"stepMonths":this.datePicker.option("stepMonths",i[r]);break;case"showOtherMonths":this.datePicker.option("showOtherMonths",i[r]);break;case"headerFormat":this.datePicker.option("headerFormat",i[r]);break;case"htmlAttributes":this._addAttr(i[r]);break;case"popupPosition":this.model.popupPosition=i[r];this._setListPosition();break;case"timeDrillDown":t.isNullOrUndefined(i[r].enabled)||(this.model.timeDrillDown.enabled=i[r].enabled,this._changeDesign());t.isNullOrUndefined(i[r].interval)||(this.model.timeDrillDown.interval=i[r].interval,this._generateMins(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale))));t.isNullOrUndefined(i[r].showMeridian)||(this.model.timeDrillDown.showMeridian=i[r].showMeridian,this._sfTimeHour.empty(),this._renderHourTable());t.isNullOrUndefined(i[r].showFooter)||(this.model.timeDrillDown.showFooter=i[r].showFooter,this._changeDesign())}f&&this._validateMinMax();this._valueChange(!0);r=="value"&&(i[r]=this.model.value);this._updateTimeHeight();this._checkErrorClass()},observables:["value"],_destroy:function(){this.isPopupOpen&&this._hideResult();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove());this._cloneElement.removeClass("e-js e-input").removeClass(t.util.getNameSpace(this.sfType));this._cloneElement.insertAfter(this.element);this.element.remove();t.isNullOrUndefined(this.datePicker)||this.datePicker.destroy();t.isNullOrUndefined(this.timePicker)||this.timePicker.destroy();this.popup.remove()},_init:function(n){if(!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this._options=n;this._cloneElement=this.element.clone();this._ISORegex();this._isSupport=document.createElement("input").placeholder==r?!1:!0;this._validateMeridian();this._checkAttribute();this._initialize();this._initial=!0;this._interval=60;this._render();this._wireEvents();this._addAttr(this.model.htmlAttributes);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());this._changeDesign();n&&n.value!=r&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_changeDesign:function(){if(this.model.timeDrillDown.enabled){var t=this.model.timeDrillDown.showFooter?"block":"none";this.popup.addClass("e-drill-down");this._timeContainer.css("display","none");this._buttonContainer.css("display","none");this.datePicker.option("showFooter",this.model.timeDrillDown.showFooter);n(".e-footer",this._sfTimeHour).css("display",t);n(".e-footer",this._sfTimeMins).css("display",t)}else this.popup.removeClass("e-drill-down"),this._sfTimeHour.hide(),this._sfTimeMins.hide(),this._updateTimeHeight(),this._dateContainer.show(),this._timeContainer.show(),this._buttonContainer.show(),this.datePicker.option("showFooter",!1),this.timePicker._refreshScroller(),this.timePicker._changeActiveEle()},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_checkAttribute:function(){this.model.value=this.model.value===""?this.element[0].value:this.model.value;this._options.minDateTime||(this.model.minDateTime=this.element[0].min);this._options.maxDateTime||(this.model.maxDateTime=this.element[0].max);t.isNullOrUndefined(this._options.readOnly)&&(this.model.readOnly=this.element.is("[readonly]"));t.isNullOrUndefined(this._options.enabled)&&(this.model.enabled=!this.element.is("[disabled]"))},_setValidation:function(){var r,i,u,f;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r._enabled(!1):u=="readOnly"&&n=="readOnly"?r._readOnly(!0):u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],u)?r.element.attr(u,n):r.wrapper.attr(u,n)})},_validateMeridian:function(){var n=t.preferredCulture(this.model.locale);n&&(this.model.locale=n.name=="en"?"en-US":n.name);t.isNullOrUndefined(this._options)?this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0:t.isNullOrUndefined(this._options.timeDrillDown)?this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0:t.isNullOrUndefined(this._options.timeDrillDown.showMeridian)&&(this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0)},_initialize:function(){var i,r,u,f;this.popup=null;this.isPopupOpen=!1;this.isValidState=!0;this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.buttonText)||n.extend(this._localizedLabels.buttonText,this._options.buttonText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this._localizedLabelToModel();this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._isIE9=t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0"?!0:!1;this.model.dateTimeFormat&&this.model.timeDisplayFormat||this._getDateTimeFormat();this.model.value&&(typeof JSON!="object"||JSON.stringify(this.model.value)!=="{}")?this.model.value instanceof Date?i=this.model.value:(r=t.parseDate(this.model.value,this.model.dateTimeFormat,this.model.locale),i=r?r:(r=this._checkJSONString(this.model.value))?r:null):i=null;i&&(this.model.value=i);u=this.model.minDateTime=this._stringToObject(this.model.minDateTime);u&&this._isValidDate(u)||(this.model.minDateTime=this.defaults.minDateTime);f=this.model.maxDateTime=this._stringToObject(this.model.maxDateTime);f&&this._isValidDate(f)||(this.model.maxDateTime=this.defaults.maxDateTime)},_checkJSONString:function(n){var t=new Date(n);if(isNaN(Date.parse(t))){if(this._extISORegex.exec(n)||this._basicISORegex.exec(n))return this._dateFromISO(n)}else{if(t.toJSON()===this.model.value||t.toGMTString()===this.model.value||t.toISOString()===this.model.value||t.toLocaleString()===this.model.value||t.toString()===this.model.value||t.toUTCString()===this.model.value)return t;if(typeof n=="string")return this._dateFromISO(n)}},_render:function(){this._renderWrapper();this._renderIcon();this._setDimentions();this._renderDropdown();this._checkProperties()},_renderWrapper:function(){if(this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0",value:this.model.value}),this.wrapper=t.buildTag("span.e-datetime-wrap e-widget "+this.model.cssClass+"#"+this.element[0].id+"_wrapper").insertAfter(this.element),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.container=t.buildTag("span.e-in-wrap e-box").append(this.element),this.wrapper.append(this.container),!this._isSupport){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}},_removeWatermark:function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},_renderIcon:function(){if(!this.model.showPopupButton)return!1;this.datetimeIcon=t.buildTag("span.e-select","",{}).attr(this._isIE8?{unselectable:"on"}:{});var n=t.buildTag("span.e-icon e-datetime","",{},{"aria-label":"select"}).attr(this._isIE8?{unselectable:"on"}:{});this.datetimeIcon.append(n);this.container.append(this.datetimeIcon).addClass("e-padding");this._on(this.datetimeIcon,"click",this._iconClick);this._on(this.datetimeIcon,"mousedown",function(n){n.preventDefault()})},_setDimentions:function(){this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this.wrapper.height(this.model.height);this.wrapper.width(this.model.width)},_renderDropdown:function(){var f=n("#"+this.element[0].id+"_popup").get(0),e,o,i,r,u;f&&n(f).remove();this.popup=t.buildTag("div.e-datetime-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.element[0].id+"_popup").css("visibility","hidden");t.isTouchDevice()||this.popup.addClass("e-ntouch");n("body").append(this.popup);this._renderControls();e=t.buildTag("div.e-header",this._localizedLabels.buttonText.timeTitle).attr(this._isIE8?{unselectable:"on"}:{});this._dateContainer=t.buildTag("div.e-datecontainer").append(this.datePicker.popup).attr(this._isIE8?{unselectable:"on"}:{});this._timeContainer=t.buildTag("div.e-timecontainer").append(e,this.timePicker.popup).attr(this._isIE8?{unselectable:"on"}:{});this._drillDownContainer=t.buildTag("div.e-drillDowncontainer").append().attr(this._isIE8?{unselectable:"on"}:{});o=t.buildTag("div.e-popup-container").append(this._dateContainer,this._timeContainer,this._drillDownContainer).attr(this._isIE8?{unselectable:"on"}:{});i=t.buildTag("div.e-dt-button e-dt-today e-btn e-select e-flat",this._localizedLabels.buttonText.today).attr(this._isIE8?{unselectable:"on"}:{});r=t.buildTag("div.e-dt-button e-dt-now e-btn e-select e-flat",this._localizedLabels.buttonText.timeNow).attr(this._isIE8?{unselectable:"on"}:{});u=t.buildTag("div.e-dt-button e-dt-done e-btn e-select e-flat",this._localizedLabels.buttonText.done).attr(this._isIE8?{unselectable:"on"}:{});this._buttonContainer=t.buildTag("div.e-button-container").append(i,r,u).attr(this._isIE8?{unselectable:"on"}:{});this._renderDrillDown();this.popup.append(o,this._buttonContainer);this._checkForResponsive();this._updateTimeHeight();this._bindOperations();this._updateValues();this.popup.css({visibility:"visible",display:"none"});this._on(i,"click",this._todayClick);this._on(r,"click",this._nowClick);this._on(u,"click",this._doneClick)},_renderControls:function(){this._renderDateControl();this._renderTimeControl();var n=t.buildTag("span").append(this.datePicker.wrapper,this.timePicker.wrapper);n.find("span").css("display","none");this.popup.append(n)},_renderDrillDown:function(){this._renderHourPopup();this._renderMinsPopup()},_renderHourPopup:function(){this._sfTimeHour=t.buildTag("div.e-timepicker e-popup e-widget "+this.model.cssClass+" e-time-hours ","",{},{id:this._id?"e-hours-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{});t.isTouchDevice()||this._sfTimeHour.addClass("e-ntouch");this._drillDownContainer.append(this._sfTimeHour);this._renderHourTable()},_renderHourTable:function(){var r,e,h,c,l,a,f;if(t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-hours-headertext").text("October 2015").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeHour),this._interval<1)return!1;c=this._interval*6e4;l=this.model.timeDrillDown.showMeridian?2:1;rowCount=this.model.timeDrillDown.showMeridian?6:4;var v=this.model.timeDrillDown.showMeridian?"hh":"HH:00",o=["AM","PM"],s=0,u="";for(r=this.timePicker._createObject("12:00:00 AM"),e=this.model.timeDrillDown.showMeridian?this.timePicker._createObject("11:59:59 AM"):this.timePicker._createObject("11:59:59 PM"),i=0;i=rowCount&&(s=0,tbody.append(tr),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),r=this.timePicker._createObject(r).getTime()+c;table.append(tbody);this.model.timeDrillDown.showMeridian&&(r=this.timePicker._createObject("12:00:00 PM"),e=this.timePicker._createObject("11:59:59 PM"))}t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this._sfTimeHour);n(".e-footer-text",this._sfTimeHour).html(this._localizedLabels.buttonText.timeNow);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this.datePicker.model.value,"dd MMM yyyy"));this._on(this._sfTimeHour.find(".e-hour"),"click",n.proxy(this._hourNavHandler,this));this._on(n(".e-next",this._sfTimeHour),"click",n.proxy(this._prevNextHourHandler,this));this._on(n(".e-prev",this._sfTimeHour),"click",n.proxy(this._prevNextHourHandler,this));this._on(n(".e-footer",this._sfTimeHour),"click",this._todayBtn);n(".e-hours-headertext",this._sfTimeHour).on("click",n.proxy(this._forwardNavHandler,this));this._sfTimeHour.hide()},_localizeTime:function(i,r){return n.trim(t.format(this.timePicker._createObject(i),r,this.model.locale))},_renderMinsPopup:function(){var r,i,e,o,s,u,f;if(this._sfTimeMins=t.buildTag("div.e-timepicker e-popup e-widget "+this.model.cssClass+" e-time-minitues ","",{},{id:this._id?"e-time-minitues-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{}),t.isTouchDevice()||this._sfTimeMins.addClass("e-ntouch"),this._drillDownContainer.append(this._sfTimeMins),t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-minitues-headertext").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeMins),t.buildTag("div.e-mins-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-text").append(t.buildTag("span.e-minitues-meridiantxt").text("AM").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeMins),r=t.buildTag("table.e-dp-viewmins","",{},{cellspacing:2}).data("e-table","data").attr({role:"grid","aria-activedescendant":""}).attr(this._isIE8?{unselectable:"on"}:{}),this._sfTimeMins.append(r),tbody=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),this._intervall<1)return!1;for(s=this._interval*6e4,i=this.timePicker._createObject("12:00:00 AM"),e=this.timePicker._createObject("11:59:59 PM"),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),u=0;this.timePicker._compareTime(e,i,!0);)o=this._localizeTime(i,"HH:00"),f=t.buildTag("td.e-mins e-state-default",o),this._isIE8&&f.attr("unselectable","on"),tr.append(f),u++,u>=4&&(u=0,tbody.append(tr),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),i=this.timePicker._createObject(i).getTime()+s;r.append(tbody);n(".e-minitues-headertext",this._sfTimeMins).text(n(".e-hours-headertext",this._sfTimeHour).text());t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this._sfTimeMins);n(".e-footer-text",this._sfTimeMins).html(this._localizedLabels.buttonText.timeNow);n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this.datePicker.model.value,"dd MMM yyyy"));this.model.timeDrillDown.showMeridian||n(".e-mins-header",this._sfTimeMins).css("display","none");this._on(r.find(".e-mins"),"click",n.proxy(this._minsNavHandler,this));this._on(n(".e-next",this._sfTimeMins),"click",n.proxy(this._prevNextMinsHandler,this));this._on(n(".e-prev",this._sfTimeMins),"click",n.proxy(this._prevNextMinsHandler,this));this._on(n(".e-footer",this._sfTimeMins),"click",this._todayBtn);n(".e-minitues-headertext",this._sfTimeMins).on("click",n.proxy(this._forwardNavHandler,this));this._sfTimeMins.hide()},_todayBtn:function(){this._nowClick();this._hideResult()},_hourNavHandler:function(i){var r,u;if(this.model.readOnly||!this.model.enabled||i&&n(i.target).hasClass("e-disable"))return!1;i&&i.type&&i.preventDefault();n("table",this._sfTimeHour).find("td").removeClass("e-active");n(i.target).addClass("e-active");this._sfTimeHour.hide();this._sfTimeMins.show();this._addFocus(this._sfTimeMins);this.model.timeDrillDown.showMeridian?(u=n(i.target).hasClass("e-hour-am")?"AM":"PM",r=n(i.target).text()+":00 "+u):r=n(i.target).text();this._generateMins(r);var f=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),e=n.trim(t.format(this.timePicker._createObject(f),"HH:mm",this.model.locale)),o=n.trim(t.format(this.timePicker._createObject(f),"HH:00",this.model.locale));index=(this.timePicker._parse(e)-this.timePicker._parse(o))/(this.model.timeDrillDown.interval*6e4);index=Math.ceil(index);this._hoverMins=this._setFocusByIndex("mins",index,this._sfTimeMins)},_minsNavHandler:function(i){if(this.model.readOnly||!this.model.enabled||i&&n(i.target).hasClass("e-disable"))return!1;i&&i.type&&i.preventDefault();n("table",this._sfTimeMins).find("td").removeClass("e-active").removeClass("e-state-hover");n(i.target).addClass("e-active");this.model.timeDrillDown.showMeridian?(value=n(i.target).text()+" "+t.format(this._datetimeValue,"tt","en-US"),value=this.timePicker._localizeTime(value)):value=n(i.target).text();this.timePicker.option("value",value);this.datePicker.option("value",this._datetimeValue);this._datetimeValue=new Date(this.model.value.toString());this.model.timeDrillDown.autoClose&&this._hideResult(i);this._updateInput()},_generateMins:function(i){var f=n("table",this._sfTimeMins),o,r,s,h,u,c,e;for(f.empty(),this.model.timeDrillDown.showMeridian?n(".e-mins-header",this._sfTimeMins).show():n(".e-mins-header",this._sfTimeMins).hide(),o=this.model.timeDrillDown.showMeridian?"hh:mm":"HH:mm",n(".e-minitues-headertext",this._sfTimeMins).text(n(".e-hours-headertext",this._sfTimeHour).text()),tbody=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),u=0,c=this.model.timeDrillDown.interval*6e4,r=this.timePicker._createObject(i),this._datetimeValue.setHours(r.getHours()),s=this.timePicker._createObject(r).getTime()+354e4,tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),tbody.append(tr);this.timePicker._compareTime(s,r,!0);)u>=4&&(u=0,tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),tbody.append(tr)),h=this._localizeTime(r,o),e=t.buildTag("td.e-mins e-state-default",h),this._isIE8&&e.attr("unselectable","on"),tr.append(e),u++,r=this.timePicker._createObject(r).getTime()+c;f.append(tbody);n(".e-mins-header",this._sfTimeMins).find(".e-minitues-meridiantxt").text(t.format(this._datetimeValue,"tt",this.model.locale));this._disableRange("mins");this._on(f.find(".e-mins"),"click",n.proxy(this._minsNavHandler,this))},_prevNextHourHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=n(t.target).is("a")?n(t.target.parentNode):n(t.target),r=i.hasClass("e-prev")?!0:!1;this._processNextPrev(r,this._sfTimeHour)},_prevNextMinsHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=n(t.target).is("a")?n(t.target.parentNode):n(t.target),r=i.hasClass("e-prev")?!0:!1;this._processNextPrev(r,this._sfTimeMins)},_processNextPrev:function(i,r){var u,f,e;if(i&&r.find(".e-arrow-sans-left").hasClass("e-disable")||!i&&r.find(".e-arrow-sans-right").hasClass("e-disable"))return!1;u=n("table",r);e=u.get(0).className;switch(e){case"e-dp-viewhours":incVal=i?-1:1;this._datetimeValue.setDate(this._datetimeValue.getDate()+incVal);this._disableRange("hour");this._hoverHour=this._setFocusByIndex("hour",this._hoverHour,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"));break;case"e-dp-viewmins":incVal=i?-1:1;this._datetimeValue.setHours(this._datetimeValue.getHours()+incVal);this._generateMins(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)));var f=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),o=n.trim(t.format(this.timePicker._createObject(f),"HH:mm",this.model.locale)),s=n.trim(t.format(this.timePicker._createObject(f),"HH:00",this.model.locale));index=(this.timePicker._parse(o)-this.timePicker._parse(s))/(this.model.timeDrillDown.interval*6e4);index=Math.ceil(index);this._disableRange("mins");this._hoverMins=this._setFocusByIndex("mins",index,this._sfTimeMins);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))}},_forwardNavHandler:function(i,r){var u,e,f;if(this.model.readOnly||!this.model.enabled)return!1;e=this;i&&i.preventDefault();u=i?n(i.currentTarget).get(0).className:r.find(".e-text>span").get(0).className;switch(u){case"e-hours-headertext":this._sfTimeHour.css("display","none");this._dateContainer.css("display","block");this._addFocus(this._dateContainer.find(".e-datepicker"));break;case"e-minitues-headertext":this._sfTimeMins.css("display","none");this._disableRange("hour");start=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00");f=n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale));indx=(this.timePicker._parse(f)-this.timePicker._parse(start))/(this._interval*6e4);indx=Math.floor(indx);this._hoverHour=this._setFocusByIndex("hour",indx,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"));this._sfTimeHour.css("display","block");this._addFocus(this._sfTimeHour)}},_renderDateControl:function(){var n=t.buildTag("input#"+this.element[0].id+"_date","",{},{type:"text"});this.popup.append(n);n.ejDatePicker({height:"0px",width:"0px",displayInline:!0,showDateIcon:!1,showFooter:this.model.timeDrillDown.enabled?this.model.timeDrillDown.showFooter:!1,enableStrictMode:!0,buttonText:this._localizedLabels.buttonText.today,minDate:this._stringToObject(this.model.minDateTime),maxDate:this._stringToObject(this.model.maxDateTime),dayHeaderFormat:this.model.dayHeaderFormat,startLevel:this.model.startLevel,depthLevel:this.model.depthLevel,startDay:this.model.startDay,stepMonths:this.model.stepMonths,showOtherMonths:this.model.showOtherMonths,headerFormat:this.model.headerFormat,enabled:this.model.enabled,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,readOnly:this.model.readOnly,cssClass:this.model.cssClass,locale:this.model.locale});this.datePicker=n.data("ejDatePicker");this.model.startDay=this.datePicker.model.startDay;this.datePicker._getInternalEvents=!0;this.datePicker._dt_drilldown=!0;this.datePicker.popup.css({position:"static",display:"block"})},_renderTimeControl:function(){var n=t.buildTag("input#"+this.element[0].id+"_time","",{},{type:"text"}),i,r;this.popup.append(n);n.ejTimePicker({height:"0px",width:"0px",interval:this.model.interval,timeFormat:this.model.timeDisplayFormat,popupWidth:this.model.timePopupWidth,enabled:this.model.enabled,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,readOnly:this.model.readOnly,cssClass:this.model.cssClass,locale:this.model.locale});this.timePicker=n.data("ejTimePicker");this.timePicker._getInternalEvents=!0;this.timePicker.showDropdown=!0;this.timePicker._dateTimeInternal=!0;this.timePicker.popup.css({position:"static",display:"block"});i=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime;r=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime},_updateTimeHeight:function(){var n=this.popup.find(".e-timecontainer .e-header").is(":visible")?this.datePicker.popup.height()-this.popup.find(".e-header").height():this.datePicker.popup.height();n=this.popup.hasClass("e-dt-responsive")?"98px":n;this.timePicker.option("popupHeight",n)},_bindOperations:function(){var n=this;this.datePicker.option("layoutChange",function(){n._updateTimeHeight()});this.datePicker.option("outOfRange",function(){n.isValidState=!1});this.timePicker.option("outOfRange",function(){n.isValidState=!1});this.datePicker.option("change",function(t){n._refreshTimes(t)});this.datePicker.option("select",function(t){n._updateInput(t)});this.datePicker.option("dt_drilldown",function(t){n.model.timeDrillDown.enabled&&(n._updateInput(t),n._switchToDrilDown(t))});this.timePicker.option("select",function(){n._updateInput()})},_switchToDrilDown:function(){var i,r;this._dateContainer.hide();this._sfTimeHour.show();this._addFocus(this._sfTimeHour);i=new Date(this.model.value.toString());this._datetimeValue=new Date(i.setHours(this._datetimeValue.getHours(),this._datetimeValue.getMinutes(),this._datetimeValue.getSeconds(),this._datetimeValue.getMilliseconds()));this._disableRange("hour");start=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00");r=n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale));indx=(this.timePicker._parse(r)-this.timePicker._parse(start))/(this._interval*6e4);indx=Math.floor(indx);this._hoverHour=this._setFocusByIndex("hour",indx,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))},_disableRange:function(r){var h=r=="hour"?this._interval:this.model.timeDrillDown.interval,u=r=="hour"?this._sfTimeHour:this._sfTimeMins,s=r=="hour"?"e-hide-hour e-disable":"e-hide-mins e-disable",f,c,e,o;if(u.find("tbody tr td.e-"+r).removeClass(s),u.find(".e-arrow-sans-left").removeClass("e-disable"),u.find(".e-arrow-sans-right").removeClass("e-disable"),start=r=="hour"?this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"):this._localizeTime(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),"HH:00"),this._compareDate(this.model.minDateTime,this._datetimeValue)){if(r=="mins"&&!(this.model.minDateTime.getHours()===this._datetimeValue.getHours()))return!1;for(f=n.trim(t.format(this.timePicker._createObject(this.model.minDateTime),"HH:mm",this.model.locale)),indx=(this.timePicker._parse(f)-this.timePicker._parse(start))/(h*6e4),indx=r=="hour"?Math.floor(indx):Math.ceil(indx),i=0;i-1||n.inArray("ddd",i.groups)>-1},_changeEditable:function(t){var i=t?"_on":"_off";if(this.element.is(":input")){if(t)this.model.readOnly||this.element.attr("readonly",!1),this.element.off("mousedown",n.proxy(this._showhidePopup,this));else{this.model.readOnly||this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showhidePopup,this))}this[i](this.element,"blur",this._targetBlur);this[i](this.element,"focus",this._targetFocus);this[i](this.element,"keydown",this._keyDownOnInput)}this._change("allowEdit",t)},_setValue:function(n){return n&&(typeof JSON!="object"||JSON.stringify(n)!=="{}")?typeof n=="string"?this._extISORegex.exec(n)||this._basicISORegex.exec(n)?this._checkObject(this._dateFromISO(n)):(this.element.val(n),this._updateModel(),this._validateMinMax(),this._checkStrictMode(),this.wrapper.addClass("e-valid")):n instanceof Date&&this._isValidDate(n)&&this._checkObject(n):(this.element.val(""),this.model.value=null,this.isValidState=!0,this.wrapper.removeClass("e-valid")),this._checkErrorClass(),this.model.value},_checkObject:function(n){n instanceof Date&&this._isValidDate(n)&&(this.model.value=n,this._updateDateTime(),this._validateMinMax(),this._checkStrictMode())},_dateFromISO:function(n){var i=this._extISORegex.exec(n)||this._basicISORegex.exec(n),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){return char=n.toLowerCase(),char=="t"||char=="z"||char==":"||char=="-"?!0:!1},_validateValue:function(n){var i=t.parseDate(n,this.model.dateTimeFormat);!i||ithis.model.maxDateTime?(this.model.value=null,this._change("value",this.model.value),this.isValidState=!1):(this._change("value",this.model.value),this.isValidState=!0)},_validateMinMax:function(){var i,n,t;if(i=this.model.value?this._stringToObject(this.model.value):null,n=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime,t=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime,!i||!n||!t)return!1;n>t&&(this.model.minDateTime=this.model.maxDateTime);it&&(this.model.enableStrictMode?this.model.enableStrictMode&&(this.datePicker.option("maxDate",this._getFormat(t,this.datePicker.model.dateFormat)),this.timePicker.option("maxTime",this._getFormat(t,this.timePicker.model.timeFormat)),this.isValidState=!1):(this._setValue(t),this.isValidState=!0));it||(this.isValidState=!0)},_checkProperties:function(){this.model.readOnly&&this._readOnly(!0);this.model.showRoundedCorner&&this._setRoundedCorner(!0);this.model.enableRTL&&this._setRtl(!0);this.model.enabled&&this._enabled(!0);this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&this._enabled(!0):this._enabled(!1);this.model.name=this._options.name?this.model.name:this.element.attr("name")?this.element.attr("name"):this.element[0].id;this.element.attr("name",this.model.name);this._checkStrictMode();this._checkErrorClass();this._datetimeValue=new Date(this.datePicker._dateValue.toString());t.isNullOrUndefined(this.model.value)||(this._datetimeValue=new Date(this.model.value.toString()));this._setWaterMark()},_checkStrictMode:function(){this.model.enableStrictMode?this.model.enableStrictMode&&(this.isValidState||(this.model.value=null,this.isValidState=!1)):this.isValidState||(this.model.valuethis.model.maxDateTime?(this.element.val(this._objectToString(this.model.maxDateTime)),this.model.value=this.model.maxDateTime,this.isValidState=!0):(this.model.value="",this.element.val(""),this.isValidState=!0))},_targetFocus:function(n){n.preventDefault();this.isFocused=!0;this.wrapper.addClass("e-focus");this.wrapper.removeClass("e-error");this._isSupport||this._hiddenInput.css("display","none");this._prevDateTimeVal=this.element.val();this.model.showPopupButton||this.model.readOnly||this._showResult();this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this._trigger("focusIn",{value:this.model.value});this.wrapper.addClass("e-valid")},_targetBlur:function(){var n,i;this.isFocused=!1;this.wrapper.removeClass("e-focus");this.model.showPopupButton||this._hideResult();n=t.parseDate(this.element.val(),this.model.dateTimeFormat);n&&!this.model.enableStrictMode&&(nthis.model.maxDateTime)&&(n=n0&&(t.removeClass("e-focus"),t.hasClass("e-datepicker e-popup")?n(document).off("keydown",n.proxy(this.datePicker._keyboardNavigation,this.datePicker)):t.hasClass("e-timecontainer")?n(document).off("keydown",n.proxy(this.timePicker._keyDownOnInput,this.timePicker)):t.hasClass("e-time-hours")?n(document).off("keydown",n.proxy(this._keyDownOnHours,this)):t.hasClass("e-time-minitues")?n(document).off("keydown",n.proxy(this._keyDownOnMinutes,this)):t.hasClass("e-dt-button")&&n(document).off("keydown",n.proxy(this._buttonClick,this)))},_addPrevNextFocus:function(n){var i=this._getFocusedElement(),t;i.length>0?i.hasClass("e-datepicker e-popup")?t=n?this.popup.find(".e-dt-done"):this.popup.find(".e-timecontainer"):i.hasClass("e-timecontainer")?t=n?this.popup.find(".e-datecontainer >.e-datepicker.e-popup"):this.popup.find(".e-dt-today"):i.hasClass("e-dt-today")?t=n?this.popup.find(".e-timecontainer"):this.popup.find(".e-dt-now"):i.hasClass("e-dt-now")?t=n?this.popup.find(".e-dt-today"):this.popup.find(".e-dt-done"):i.hasClass("e-dt-done")&&(t=n?this.popup.find(".e-dt-now"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup")):t=n?this.popup.find(".e-dt-done"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup");this._addFocus(t)},_getFocusedElement:function(){return this.popup.children("div").find("div.e-focus")},_keyDownOnHours:function(n){var t,r,i;(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35)&&(n.preventDefault&&n.preventDefault(),t={row:null,col:null},t.col=this._sfTimeHour.find("tbody tr td.e-state-hover").index(),t.row=this._sfTimeHour.find("tbody tr td.e-state-hover").parent().index(),t.col=t.col!=-1?t.col+1:this._sfTimeHour.find("tbody tr td.e-active").index()+1,t.row!=-1?(t.row=t.row+1,this.model.timeDrillDown.showMeridian&&this._sfTimeHour.find("tbody tr td.e-state-hover").hasClass("e-hour-pm")&&(t.row=t.row+2)):(t.row=this._sfTimeHour.find("tbody tr td.e-active").parent().index()+1,this.model.timeDrillDown.showMeridian&&this._sfTimeHour.find("tbody tr td.e-active").hasClass("e-hour-pm")&&(t.row=t.row+2)),r=this._sfTimeHour.find("table")[0].className,rowLength=this._sfTimeHour.find("tbody.e-timepicker-hours tr").length,colLength=this.model.timeDrillDown.showMeridian?6:4,i=this._changeRowCol(t,n.keyCode,rowLength,colLength,"hours",n.ctrlKey),n.ctrlKey||(this._hoverHour=this._sfTimeHour.find("tbody.e-timepicker-hours tr td").index(i)),n.ctrlKey||(this._sfTimeHour.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover")))},_changeRowCol:function(t,i,r,u,f,e){var c,o,h={parent:null,child:null},s,a,l,v;switch(f){case"hours":c="tbody.e-timepicker-hours tr td.e-hour";h.parent=".e-timepicker-hours";h.child=".e-hour";hiddenClass=".e-hide-hour";o=this._sfTimeHour;break;case"mins":c="tbody.e-timepicker-mins tr td.e-mins";h.parent=".e-timepicker-mins";h.child=".e-mins";hiddenClass=".e-hide-mins";o=this._sfTimeMins;u=o.find("tbody"+h.parent+" tr:nth-child("+t.row+") td"+h.child).length}if(t.row<=0&&t.col<=0)return o.find(c+":not(.e-disable):first");a=this;switch(i){case 36:return o.find(c+":not(.e-disable):first");case 35:return o.find(c+":not(.e-disable):last");case 38:if(e)this._forwardNavHandler(null,o);else if(t.row>1)t.row-=1;else return this._processNextPrev(!0,o),o.find(c+":nth-child("+t.col+"):last");if(s=this._getCell(t,h,o).not(hiddenClass),s.length<=0){if(s=this._findVisible(t,h,"up",o),s!==null)return s;this._processNextPrev(!0,o);s=o.find(c+":nth-child("+t.col+"):last")}return s;case 37:if(e)return this._processNextPrev(!0,o),o.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else if(t.row>1)t={row:t.row-1,col:u},f=="mins"&&(t.col=u=o.find("tbody"+h.parent+" tr:nth-child("+t.row+") td"+h.child).length);else return this._processNextPrev(!0,o),o.find(c+":not(.e-disable):last");if(s=this._getCell(t,h,o).not(hiddenClass),s.length<=0){if(s=this._findVisible(t,h,"left",o),s!==null)return s;this._processNextPrev(!0,o);s=o.find(c+":not(.e-disable):last")}return s;case 39:if(e)return this._processNextPrev(!1,o),o.find("tbody tr td.e-state-hover");if(t.col2&&r.hasClass("e-time-hours")&&(f=f-2),u=r.find("tbody"+i.parent+" tr:nth-child("+f+") td"+i.child+":nth-child("+t.col+")"),this.model.timeDrillDown.showMeridian&&u.length>0&&r.hasClass("e-time-hours")&&(u=t.row<=2?n(u[0]):n(u[1])),u},_findVisible:function(n,t,r,u){var e=n.col,f=n.row,o=t.child.slice(1,t.child.length);for(i=0;i>=0;i++){if(nextElement=this._getCell({row:f,col:e},t,u),nextElement.length<=0)return null;if(nextElement.hasClass("e-disable")||!nextElement.is(":visible")){if((r=="right"||r=="left"?r=="right"?e++:e--:r=="down"?f++:f--,f<=0||f>u.find("tbody"+t.parent+" tr").length)||(e>u.find("tbody"+t.parent+" tr:nth-child("+f+") td").length&&(f++,e=1),e<=0&&(f--,e=u.find("tbody"+t.parent+" tr:nth-child("+f+") td").length),f<=0||f>u.find("tbody"+t.parent+" tr").length))return null}else if(nextElement.hasClass(o))return n.col=e,n.row=f,nextElement=this._getCell(n,t,u)}},_keyDownOnMinutes:function(n){var t,r,i;(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35)&&(n.preventDefault&&n.preventDefault(),t={row:null,col:null},t.col=this._sfTimeMins.find("tbody tr td.e-state-hover").index(),t.row=this._sfTimeMins.find("tbody tr td.e-state-hover").parent().index(),t.col=t.col!=-1?t.col+1:this._sfTimeMins.find("tbody tr td.e-active").index()+1,t.row=t.row!=-1?t.row+1:this._sfTimeMins.find("tbody tr td.e-active").parent().index()+1,r=this._sfTimeMins.find("table")[0].className,rowLength=this._sfTimeMins.find("tbody.e-timepicker-mins tr").length,colLength=4,i=this._changeRowCol(t,n.keyCode,rowLength,colLength,"mins",n.ctrlKey),n.ctrlKey||(this._hoverHour=this._sfTimeMins.find("tbody.e-timepicker-mins tr td").index(i)),n.ctrlKey||(this._sfTimeMins.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover")))},_valueChange:function(n){this.model.enableStrictMode?this.model.enableStrictMode&&(this._preVal!=this.element.val()||this.model.valuethis.model.maxDateTime)&&(this._updateModel(),this._raiseChangeEvent(n)):(this._preVal!=this.element.val()&&(this._preVal=this.element.val(),this._updateModel(),this._validateMinMax(),this._raiseChangeEvent(n)),this._setWaterMark())},_updateModel:function(n,i){var u,f;if(this._stopRefresh){this._stopRefresh=!1;return}u=this.element.val();u==""?(this.model.value=null,this._change("value",this.model.value),this.isValidState=!0):(f=n!=r&&n.type=="select"||this._prevDateTimeVal==this.element.val()?this.model.value:t.parseDate(u,this.model.dateTimeFormat,this.model.locale),f?(this.model.value=f,this.isValidState=!0,i||this._refreshPopup(),this._specificFormat()&&this._prevDateTimeVal!=this.element.val()&&this.element.val(this._objectToString(this.model.value))):(this.model.value=null,this._change("value",this.model.value),this.isValidState=!1,this.model.enableStrictMode||this.element.val(this._objectToString(this.model.value))))},_refreshPopup:function(){if(this.isValidState&&this.isPopupOpen){var n=this._setEmptyTime(this.model.value),t=this._setEmptyDate(this.model.value),i=this._getDate(),r=this._getTime();i&&this._compare(i,n)||this.datePicker.option("value",n);r&&this._compare(r,t)||this.timePicker.option("value",t)}},_buttonClick:function(n){if(n.keyCode==13){n.preventDefault();var t=this._getFocusedElement();t.hasClass("e-dt-today")?this._todayClick():t.hasClass("e-dt-now")?this._nowClick():t.hasClass("e-dt-done")&&this._doneClick()}},_todayClick:function(){if(!this.model.enabled||this.model.readOnly)return!1;this.datePicker.popup.find(".today").hasClass("e-active")&&this.datePicker.popup.children("table").hasClass("e-dp-viewdays")&&this.element.val()!=""&&this.isValidState||(this.datePicker._setCurrDate(),this._updateInput())},_nowClick:function(){var r;if(!this.model.enabled||this.model.readOnly)return!1;this.timePicker.setCurrentTime();var u=this.model.minDateTime,f=this.model.maxDateTime,n=this.datePicker.model.value,i=new Date;n=t.isNullOrUndefined(n)?new Date:n;r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),i.getHours(),i.getMinutes(),i.getSeconds());rf&&this.timePicker.option("value",this.timePicker._localizeTime(f));this._updateInput()},_doneClick:function(){this._hideResult()},_iconClick:function(n){n.preventDefault();this.isFocused||t.isTouchDevice()||this.element.focus();this._showhidePopup();this._isIE9&&this.popup.find(".e-popup-container").css("display","inline-block")},_setInitialSelection:function(){var i=this.timePicker.ul.find("li"),r,u,f,t,e;i.hasClass("e-hover")||(r=this.timePicker._setEmptyDate(new Date),u=r,this.timePicker.minTime&&!this._compareTime(this._createObject(r),this.timePicker.minTime,!0)&&(u=this.timePicker.minTime),this.timePicker.maxTime&&!this._compareTime(this.timePicker.maxTime,this._createObject(r),!0)&&(u=this.timePicker.maxTime),f=i.first().html(),t=(this.timePicker._parse(u)-this.timePicker._parse(f))/(this.timePicker.model.interval*6e4),t=Math.round(t),activeItem=t==i.length?t:t+1,(activeItem<0||activeItem>i.length||isNaN(activeItem))&&(activeItem=1),e=n(this.timePicker.ul.find("li")[activeItem-1]),e.addClass("e-hover"),this._calcScrollTop())},_calcScrollTop:function(){var r=this.timePicker.ul.outerHeight(),n=this.timePicker.ul.find("li").outerHeight(),t,i;t=this.timePicker.ul.find("li.e-hover").index();i=n*t-(this.timePicker.popupList.outerHeight()-n)/2;this.timePicker.scrollerObj.setModel({scrollTop:i})},_showhidePopup:function(){if(this.model.readOnly)return!1;this.isPopupOpen?this._hideResult():this._showResult()},_showResult:function(){if(this.isPopupOpen||!this.model.enabled||this._trigger("beforeOpen",{element:this.popup}))return!1;this.isPopupOpen=!0;this._setListPosition();this._checkForResponsive();var i=this;this.popup.slideDown(this.model.enableAnimation?200:0,function(){i._on(n(document),"mousedown",i._OnDocumentClick);i.model.timeDrillDown.enabled&&i._addFocus(i._dateContainer.find(".e-datepicker"));i.timePicker.model.value||i._setInitialSelection()});this._updateModel();this._updateTimeHeight();this._validateMinMax();this._on(n(window),"resize",this._OnWindowResize);this._on(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._raiseEvent("open");this._initial&&(this.timePicker._refreshScroller(),this.timePicker._changeActiveEle(),this._initial=!1);this.wrapper.addClass("e-active")},_hideResult:function(i){var r=this;if(!this.isPopupOpen||this._trigger("beforeClose",{element:this.popup}))return!1;if(this.isPopupOpen=!1,this._removeFocus(),this._popClose&&i&&i.type!="click"){this.isPopupOpen=!0;return}this.popup.slideUp(this.model.enableAnimation?100:0,function(){r.model&&(r.model.timeDrillDown.enabled&&(r._sfTimeHour.hide(),r._sfTimeMins.hide(),r._dateContainer.show()),t.isNullOrUndefined(r.model.value)||(r._datetimeValue=new Date(r.model.value.toString())))});this._raiseEvent("close");this._off(n(document),"mousedown",this._OnDocumentClick);this._off(n(window),"resize",this._OnWindowResize);this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this.wrapper.removeClass("e-active")},_setListPosition:function(){var r=this.wrapper,i=this._getOffset(r),s,v=n(document).scrollTop()+n(window).height()-(i.top+n(r).outerHeight()),h=i.top-n(document).scrollTop(),u=this.popup.outerHeight(),c=this.popup.outerWidth(),f=i.left,o=r.outerHeight(),l=(o-r.height())/2,y=this._getZindexPartial(),e=3,p=this.model.popupPosition,a;a=this.model.popupPosition==t.PopupPosition.Bottom?(uh?i.top+o+e:i.top-u-e)-l:(u>h?i.top+o+e:i.top-u-e)-l;s=n(document).scrollLeft()+n(window).width()-f;(this.model.enableRTL||c>s&&c0?this._addFocus(n(t.target).parents(".e-datepicker")):n(t.target).parents(".e-timecontainer").length>0?this._addFocus(n(t.target).parents(".e-timecontainer")):n(t.target).hasClass("e-dt-button")?this._addFocus(n(t.target)):n(t.target).parents(".e-time-hours").length>0?this._addFocus(n(t.target).parents(".e-time-hours")):n(t.target).parents(".e-time-minitues").length>0?this._addFocus(n(t.target).parents(".e-time-minitues")):this._removeFocus()):this._hideResult())},_OnWindowResize:function(){this._setListPosition();this._checkForResponsive();this._updateTimeHeight()},_raiseChangeEvent:function(i){var u=t.parseDate(this._prevDateTimeVal,this.model.dateTimeFormat),f=t.parseDate(this.element.val(),this.model.dateTimeFormat),r;+u==+f?this._prevDateTimeVal!=this.element.val()&&(r={prevDateTime:this._prevDateTimeVal,value:this.element.val(),isValidState:this.isValidState},this._prevDateTimeVal=this.element.val(),this._trigger("_change",r)):(this._preVal=this._prevDateTimeVal,r={prevDateTime:this._prevDateTimeVal,value:this.element.val(),isInteraction:!i,isValidState:this.isValidState},this._trigger("_change",r),r.value=n.trim(this.element.val())==""?null:this.element.val(),this._trigger("change",r),this._prevDateTimeVal=this.element.val())},_raiseEvent:function(n){return this.element!=null&&this.model[n]?this._trigger(n,{prevDateTime:this._preVal,value:this.element.val()}):!1},_getDateTimeFormat:function(){var n=t.preferredCulture(this.model.locale).calendar.patterns;this.model.dateTimeFormat||(this.model.dateTimeFormat=n.d+" "+n.t);this.model.timeDisplayFormat||(this.model.timeDisplayFormat=n.t)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popup)},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error"):this.wrapper.addClass("e-error")},_getDate:function(){return this.datePicker.model.value},_getTime:function(){return this._getDateObj(this.timePicker.model.value,this.timePicker.model.timeFormat)},_setEmptyTime:function(n){var t=new Date(n);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_setEmptyDate:function(n){var t=new Date(n);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_objectToString:function(n){return this._getFormat(n,this.model.dateTimeFormat)},_stringToObject:function(n){return this._getDateObj(n,this.model.dateTimeFormat)},_getFormat:function(n,i){if(n instanceof Date){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)}return n},_checkFormat:function(n){var i=this,r=this._regExp();return n.replace(r,function(n){return n==="/"?t.preferredCulture(i.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},_regExp:function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},_getDateObj:function(n,i){var o,f;if(typeof n=="string"){if(o=this._checkFormat(i),f=t.parseDate(n,o,this.model.locale),f!=null)return f;if(n!=""&&n!=null){var e,r=/^\s*(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).*Z\s*$/.exec(n),u=new Date;if(r&&(u=new Date,e=+r[2],u.setUTCFullYear(r[1],e-1,r[3]),u.setUTCHours(r[4],r[5],r[6]),e!=u.getUTCMonth()+1&&u.setTime()),this._isValidDate(u))return u}else return null}else return n},_compare:function(n,t){return n&&t&&n.getTime()==t.getTime()},_isValidDate:function(n){return n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_change:function(n,t){this.datePicker.option(n,t);this.timePicker.option(n,t)},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popup.removeClass(this.model.cssClass).addClass(n);this._change("cssClass",n)},_localize:function(r){var u,f;if(this.model.locale=r,this.model.dateTimeFormat=this.model.timeDisplayFormat="",u=["AM","PM"],this._getDateTimeFormat(),this._localizedLabels=this._getLocalizedLabels(),t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.buttonText)||n.extend(this._localizedLabels.buttonText,this._options.buttonText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText)),this._localizedLabelToModel(),this._buttonText(this._localizedLabels.buttonText),(this.isValidState||this.model.value instanceof Date&&this._isValidDate(this.model.value))&&this.element.val(this._objectToString(this.model.value)),this._preVal=this.element.val(),this._change("locale",r),this.model.startDay=this.datePicker.model.startDay,this._validateMeridian(),this._sfTimeHour.empty(),this._renderHourTable(),this.model.timeDrillDown.showMeridian)for(i=0;i<2;i++)f=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard[u[i]])?"":t.preferredCulture(this.model.locale).calendars.standard[u[i]][0],n("span.e-hours-meridiantxt-"+u[i].toLowerCase(),this._sfTimeHour).text(f)},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_readOnly:function(n){this.model.readOnly=n;n?this.element.attr("readonly","readonly"):this.element.prop("readonly",!1);this._change("readOnly",n)},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popup.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popup.removeClass("e-corner"));this.datePicker.option("showRoundedCorner",n)},_setRtl:function(n){n?(this.wrapper.addClass("e-rtl"),this.popup.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popup.removeClass("e-rtl"));this._change("enableRTL",n)},_enabled:function(n){n?(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable())},_showButton:function(n){this.model.showPopupButton=n;n?(this.container.addClass("e-padding"),this._renderIcon()):(this.container.removeClass("e-padding"),this.datetimeIcon.remove(),this.datetimeIcon=null)},_buttonText:function(t){n.extend(this.model.buttonText,t);this.popup.find(".e-dt-today").html(this.model.buttonText.today);this.popup.find(".e-dt-now").html(this.model.buttonText.timeNow);this.popup.find(".e-dt-done").html(this.model.buttonText.done);this.popup.find(".e-timecontainer").find(".e-header").html(this.model.buttonText.timeTitle)},_checkForResponsive:function(){if(n(window).outerWidth()>200&&n(window).outerWidth()<=500)this.popup.hasClass("e-dt-responsive")||(this.popup.addClass("e-dt-responsive"),this.timePicker.option("popupWidth",this.datePicker.popup.outerWidth()),this.timePicker.option("popupHeight",98),this.timePicker._refreshScroller(),this.timePicker._changeActiveEle());else if(this.popup.hasClass("e-dt-responsive")){this.popup.removeClass("e-dt-responsive");this.timePicker.option("popupWidth",this.model.timePopupWidth);var t=this.datePicker.popup.height()-this.popup.find(".e-header").height();this.timePicker.option("popupHeight",t);this.timePicker._refreshScroller();this.timePicker._changeActiveEle()}},enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.model.enabled=!0,this.element.prop("disabled",!1),this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable").attr("aria-disabled",!1),this._isSupport||this._hiddenInput.prop("disabled",!1),this.datetimeIcon&&this.datetimeIcon.removeClass("e-disable").attr("aria-disabled",!1),this._isIE8&&this.datetimeIcon&&this.datetimeIcon.children().removeClass("e-disable"),this.popup.children("div").removeClass("e-disable").attr("aria-disabled",!1),this._change("enabled",!0))},disable:function(){this.model.enabled&&(this.element[0].disabled=!0,this.model.enabled=!1,this.wrapper.addClass("e-disable"),this.element.addClass("e-disable").attr("aria-disabled",!0),this.element.attr("disabled","disabled"),this._isSupport||this._hiddenInput.attr("disabled","disabled"),this.datetimeIcon&&this.datetimeIcon.addClass("e-disable").attr("aria-disabled",!0),this._isIE8&&this.datetimeIcon&&this.datetimeIcon.children().addClass("e-disable"),this.popup.children("div").addClass("e-disable").attr("aria-disabled",!0),this._hideResult(),this._change("enabled",!1),this.datePicker.popup.removeClass("e-disable").attr("aria-disabled",!1),this.timePicker.popup.removeClass("e-disable").attr("aria-disabled",!1))},getValue:function(){return this._objectToString(this.model.value)},setCurrentDateTime:function(){this.model.readOnly||this._setValue(new Date)},show:function(){this._showResult()},hide:function(){this._hideResult()},_wireEvents:function(){if(this.model.allowEdit&&(this._on(this.element,"focus",this._targetFocus),this._on(this.element,"blur",this._targetBlur),this._on(this.element,"keydown",this._keyDownOnInput)),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showhidePopup,this))}this.popup.on("mouseenter touchstart",n.proxy(function(){this._popClose=!0},this));this.popup.on("mouseleave touchend",n.proxy(function(){this._popClose=!1},this))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.DateTimePicker.Locale=t.DateTimePicker.Locale||{};t.DateTimePicker.Locale["default"]=t.DateTimePicker.Locale["en-US"]={watermarkText:"Select datetime",buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"}};t.PopupPosition={Bottom:"bottom",Top:"top"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r};ejDateRangePicker=function(n){function t(i){return n.call(this),this._rootCSS="e-daterangepicker",this._setFirst=!1,this.PluginName="ejDateRangePicker",this.id="myDateRange",this._addToPersist=["value"],this.type="editor",this.angular={require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},this.model=null,this.validTags=["input"],this.defaults={height:"",width:"",value:"",cssClass:"",enabled:!0,startDate:null,endDate:null,enableTimePicker:!1,ranges:null,locale:"en-US",separator:"-",watermarkText:"Select Range",dateFormat:"",timeFormat:"",showPopupButton:!0,showRoundedCorner:!1,allowEdit:!0,enablePersistence:!1,create:null,change:null,beforeClose:null,beforeOpen:null,close:null,open:null,hover:null,click:null,clear:null,destroy:null,select:null},this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1,this._prevValue=null,this._validState=null,t.prototype.observables=["value"],i&&(i.jquery||(i=$("#"+i)),i.length)?$(i).ejDateRangePicker().data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype._setModel=function(n){var t,i;for(t in n)switch(t){case"allowEdit":if(!n[t]){this.element.attr("readonly","readonly");this.element.on("mousedown",$.proxy(this._showDatePopUp,this));this.element.off("blur",$.proxy(this._onMainFocusOut,this))}break;case"startDate":i=this._validateValues(n[t],"left");i==!1?n[t]=null:(this._startEndValidation()||this.model.endDate==null||(this._resetValues(),this.model.endDate=null),this._updateValues(),this._selectedStartDate=this.model.startDate,n[t]=this.model.startDate);break;case"endDate":i=this._validateValues(n[t],"right");i==!1?n[t]=null:(this._startEndValidation()||(this._rightDP.element.parents(".e-datewidget").addClass("e-val-error"),this.model.endDate=null),this._updateValues(),n[t]=this.model.endDate);break;case"enableTimePicker":this.model.enableTimePicker=n[t];n[t]?this._renderTimePicker():this._removeTimePicker();this._scrollerObj&&(this._scrollerObj.model.height=this.datePopup.height(),this._scrollerObj.refresh());break;case"locale":this._setCulture(n[t]);n[t]=this.model.locale;break;case"separator":this.model.separator=n[t];this._mainValue();break;case"dateFormat":this._leftDP&&this._leftDP.option(t,n[t]);this._rightDP&&this._rightDP.option(t,n[t]);this.model.dateFormat=n[t];this._getDateTimeFormat();this._updateInput();break;case"timeFormat":this._leftTP&&this._leftTP.option(t,n[t]);this._rightTP&&this._rightTP.option(t,n[t]);this.model.timeFormat=n[t];this._getDateTimeFormat();this._updateInput();break;case"watermarkText":ej.isNullOrUndefined(this._options)&&(this._options={});this._options.watermarkText=this.model.watermarkText=n[t];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"cssClass":this._changeSkin(n[t]);break;case"showRoundedCorner":this._setRoundedCorner(n[t]);break;case"showPopupButton":this._renderDateIcon(n[t]);break;case"value":this.element.val(n[t]);this._onMainFocusOut();n[t]=this.model.value;break;case"height":this.wrapper.height(n[t]);break;case"width":this.wrapper.width(n[t]);break;case"enabled":n[t]?this.enable():this.disable()}},t.prototype._init=function(n){this._options=n;this._flagevents=!1;this._id=this.element.attr("id");this._isSupport=document.createElement("input").placeholder==undefined?!1:!0;this.element.val()==""&&this.model.value&&this.element.val(this.model.value);this.element.val()&&this._setInitValue();this._createDateRangePicker();this._validState==!1&&this.element.val()&&this.wrapper.addClass("e-error");this._popupOpen=!1;this._isPopScroll=!1;this.model.enabled||this.disable();this._wireEvents()},t.prototype._setInitValue=function(){var n=this.element.val().split(this.model.separator),t=ej.parseDate(n[0],this._dateTimeFormat,this.model.locale),i=ej.parseDate(n[1],this._dateTimeFormat,this.model.locale);t&&i&&(this.model.startDate=t,this.model.endDate=i)},t.prototype._getNextMonth=function(n){var i=n,r,u,t;return(i instanceof Date)?(r=i.getMonth(),r==11?(u=i.getFullYear()+1,r=-1):u=i.getFullYear(),t=new Date,t=new Date(t.setFullYear(u)),t=new Date(t.setMonth(r+1)),new Date(t.setDate(1))):new Date},t.prototype._getDateTimeFormat=function(){var n=ej.preferredCulture(this.model.locale).calendars.standard.patterns;this.model.dateFormat||(this.model.dateFormat=n.d);this.model.enableTimePicker?(this.model.timeFormat||(this.model.timeFormat=n.t),this._dateTimeFormat=this.model.dateFormat+" "+this.model.timeFormat):this._dateTimeFormat=this.model.dateFormat},t.prototype._setValues=function(){this._leftDP.option("value",this.model.startDate);this._rightDP.option("value",this.model.endDate||null);this.model.startDate&&this._setStartDate(this.model.startDate,$('.current-month[date="'+this.model.startDate.toDateString()+'"]'),!0);this.model.endDate&&this._setEndDate(this.model.endDate,$('.current-month[date="'+this.model.endDate.toDateString()+'"]'),!0);this._rangeRefresh(this._setArgs(this._leftDP.popup));this._rangeRefresh(this._setArgs(this._rightDP.popup));this._rightDP.element.parents(".e-datewidget").removeClass("e-error");this.model.enableTimePicker&&(this._leftTP.option("value",this.model.startDate),this._rightTP.option("value",this.model.endDate));this._updateRanges("left");this._updateRanges("right")},t.prototype._customSet=function(){this._selectedStartDate=this.model.startDate;this._selectedEndDate=this.model.endDate;this._resetValues();this._setValues();this._popupOpen||this._mainValue();this._refreshMinMax();this._setWaterMark()},t.prototype._setCulture=function(n){n=ej.preferredCulture(n).name;this.model.locale=n;this._setOption("locale",n);this._localizedLabels=this._getLocalizedLabels();this._setLocalizedText();this._updateInput()},t.prototype._setRoundedCorner=function(n){n?(this._input_innerWrapper.addClass("e-corner"),this.popup.addClass("e-corner")):(this._input_innerWrapper.removeClass("e-corner"),this.popup.removeClass("e-corner"));this._setOption("showRoundedCorner",n)},t.prototype._renderDateIcon=function(n){n?(this.dateRangeIcon=ej.buildTag("span.e-select#"+this.id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(ej.buildTag("span.e-icon e-calendar","",{},{"aria-label":"Select"}).attr(this._isIE8?{unselectable:"on"}:{})).insertAfter(this.element),this._input_innerWrapper.addClass("e-padding"),this._on(this.dateRangeIcon,"mousedown",this._showDatePopUp),this._off(this.dateRangeIcon,"click",this._showDatePopUp)):(this.dateRangeIcon&&this.dateRangeIcon.remove(),this._input_innerWrapper.removeClass("e-padding"),this._bindDateButton(),this._off(this.dateRangeIcon,"click",this._showDatePopUp))},t.prototype._validateValues=function(n,t){var r=t=="right"?this._rightDP:this._leftDP,i=n;if(i!=null&&typeof i=="string")t=="left"?(this.model.startDate=ej.parseDate(n,this.model.dateFormat,this.model.locale)||null,this.model.startDate=this.model.startDate!=null?this.model.startDate:new Date(i)):(this.model.endDate=ej.parseDate(n,this.model.dateFormat,this.model.locale)||null,this.model.endDate=this.model.endDate!=null?this.model.endDate:new Date(i));else if(n instanceof Date){if(t=="left"){if(this.model.startDate=n,isNaN(n.getDate()))return!1;typeof this._formatter(this.model.startDate,this.model.locale)!="string"&&(this.model.startDate=ej.parseDate(this._formatter(this.model.startDate,this.model.locale),this.model.dateFormat))}else if(t=="right"){if(this.model.endDate=n,isNaN(n.getDate()))return!1;typeof this._formatter(this.model.endDate,this.model.locale)!="string"&&(this.model.endDate=ej.parseDate(this._formatter(this.model.endDate,this.model.locale),this.model.dateFormat))}}else return!1;return!0},t.prototype._formatter=function(n,t){var i=this._checkFormat(t);return ej.format(n,i,this.model.locale)},t.prototype._checkFormat=function(n){var t=this,i=this._regExp();return n.replace(i,function(n){return n==="/"?ej.preferredCulture(t.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},t.prototype._regExp=function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},t.prototype._setArgs=function(n){var t=new Date($(n.find(".current-month")[0]).attr("date"));return this.args={},this.args.element=n,this.args.month=t.getMonth(),this.args.year=t.getFullYear(),this.args},t.prototype._changeSkin=function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popup.removeClass(this.model.cssClass).addClass(n);this._setOption("cssClass",n)},t.prototype._createDateRangePicker=function(){var n;this._localizedLabels=this._getLocalizedLabels();this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0"});this.wrapper=ej.buildTag("span.e-daterangewidget e-widget "+this.model.cssClass);ej.isTouchDevice()||this.wrapper.addClass("e-ntouch");this._input_innerWrapper=ej.buildTag("span.e-in-wrap e-box");this.wrapper.append(this._input_innerWrapper).insertBefore(this.element);this._input_innerWrapper.append(this.element);this._input_innerWrapper.addClass("e-padding");this.popup=ej.buildTag("div.e-daterangepicker-popup e-popup e-widget e-box"+this.model.cssClass+"#"+this.element[0].id+"_popup").css("display","none");this._isSupport||(this._hiddenInput=ej.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element),this._hiddenInput.val(this._localizedLabels.watermarkText),this._hiddenInput.css("display","block"),n=this,$(this._hiddenInput).focus(function(){n.element.focus()}));$("body").append(this.popup);this.datePopup=ej.buildTag("div.e-datepickers-popup");this.popup.append(this.datePopup);this._leftDiv=ej.buildTag("div.e-left-datepicker");this._rightDiv=ej.buildTag("div.e-right-datepicker");this.datePopup.append(this._leftDiv);this.datePopup.append(this._rightDiv);this.calendar_left=ej.buildTag("input.leftDate_wrapper#"+this.element[0].id+"leftDate_wrapper","",{},{type:"text"});this._leftDiv.append(this.calendar_left);this.calendar_right=ej.buildTag("input.rightDate_wrapper#"+this.element[0].id+"rightDate_wrapper","",{},{type:"text"});this._rightDiv.append(this.calendar_right);n=this;this.culture=ej.preferredCulture(this.model.locale);this._getDateTimeFormat();this._setRoundedCorner(this.model.showRoundedCorner);this._renderDateIcon(this.model.showPopupButton);this.calendar_left.ejDatePicker({displayInline:!0,showFooter:!1,watermarkText:"",enableStrictMode:!0,layoutChange:function(){n._refreshEvents("left");n._updateRanges("left");n._scrollerObj&&(n._scrollerObj.model.height=n.datePopup.height(),n._scrollerObj.refresh())},showTooltip:!1,locale:this.model.locale,dateFormat:this.model.dateFormat,_month_Loaded:function(t){n._previousNextHandler(t)},enablePersistence:this.model.enablePersistence});this._leftDP=this.calendar_left.data("ejDatePicker");this._leftDP._getInternalEvents=!0;this._leftDP._DRPdisableFade=!0;this._leftDP.option("showPopupButton",!1);this._leftDP.popup.css({position:"static",visibility:"inherit"});this.calendar_right.ejDatePicker({displayInline:!0,showFooter:!1,watermarkText:"",enableStrictMode:!0,locale:this.model.locale,create:$.proxy(this._updateOnRender,this),layoutChange:function(){n._refreshEvents("right");n._updateRanges("right");n._scrollerObj&&(n._scrollerObj.model.height=n.datePopup.height(),n._scrollerObj.refresh())},dateFormat:this.model.dateFormat,_month_Loaded:function(t){n._previousNextHandler(t)},enablePersistence:this.model.enablePersistence});this._rightDP=this.calendar_right.data("ejDatePicker");this._rightDP._getInternalEvents=!0;this._rightDP._DRPdisableFade=!0;this._rightDP.option("showPopupButton",!1);this._rightDP.popup.css({position:"static",visibility:"inherit"});this.model.ranges&&this._renderRanges();this.model.enableTimePicker&&this._renderTimePicker();this._renderButton();this._bindDateButton();this._refreshEvents("left");this._refreshEvents("right");this._updateRanges("left");this._updateRanges("right");this.wrapper&&(this.model.width&&this.wrapper.width(this.model.width),this.model.height&&this.wrapper.height(this.model.height))},t.prototype._updateOnRender=function(){this.model.enableTimePicker?this._rightTime&&(this._rightTP=this._rightTime.ejTimePicker("instance"),this._updateValues()):this.calendar_right&&(this._rightDP=this.calendar_right.ejDatePicker("instance"),this._updateValues())},t.prototype._updateRangesList=function(){$(".e-dateranges-ul").find(".rangeItem.e-active").removeClass("e-active");$(".e-dateranges-ul").find(".rangeItem.e-custompic").addClass("e-active")},t.prototype._updateValues=function(){this._updateRangesList();this._getDateTimeFormat();this._startEndValidation()||this.model.startDate!=null&&this.model.endDate==null?(this._validateValues(this.model.startDate,"left"),this._validateValues(this.model.endDate,"right"),this._setValues(),this._mainValue()):(this._clearRanges(),this.element.val(""));this._refreshMinMax();this._setWaterMark()},t.prototype._startEndValidation=function(){if(this.model.startDate&&this.model.endDate){var t=this.model.startDate,n=this.model.endDate;return n&&t>n?!1:!0}return!1},t.prototype._renderButton=function(){this._buttonDiv=ej.buildTag("div.e-drpbuttons");var n=ej.buildTag("div.e-drp-button e-drp-reset e-btn e-select e-flat").attr({tabindex:"0"}),t=ej.buildTag("div.e-drp-button e-drp-apply e-disable e-btn e-select e-flat").attr({tabindex:"0"}),i=ej.buildTag("div.e-drp-button e-drp-cancel e-btn e-select e-flat").attr({tabindex:"0"});this._buttonDiv.append(n);this._buttonDiv.append(t);this._buttonDiv.append(i);this.popup.append(this._buttonDiv);this._setLocalizedText()},t.prototype._setLocalizedText=function(){ej.isNullOrUndefined(this._options)||(ej.isNullOrUndefined(this._options.buttonText)||$.extend(this._localizedLabels.ButtonText,this._options.buttonText),ej.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this.model.buttonText=this._localizedLabels.ButtonText;$(this._buttonDiv.find("div.e-drp-reset")).text(this.model.buttonText.reset);$(this._buttonDiv.find("div.e-drp-apply")).text(this.model.buttonText.apply);$(this._buttonDiv.find("div.e-drp-cancel")).text(this.model.buttonText.cancel);this._customRangePicker&&this._customRangePicker.find("ul li.e-custompic").length>0&&this._customRangePicker.find("ul li.e-custompic").text(this._localizedLabels.customPicker);this._setWaterMark()},t.prototype._renderRanges=function(){var f,i,t,n,r,u;if(this._renderRangesWrapper(),this.popup.append(this._customRangePicker),this._ranges_li="",f=this,this.model.ranges)for(i=0;i"+t.label+"<\/li>"));this._ranges_li+="
  • "+this._localizedLabels.customPicker+"<\/li>";this.popup.find("div.e-custom-dateranges ul").append(this._ranges_li);this._on(this._customRangePicker.find("ul li.rangeItem"),"click",this._customSelection);this._customRangePicker.ejScroller({height:this.datePopup.height(),width:0,scrollerSize:15});f._scrollerObj=this._customRangePicker.ejScroller("instance")},t.prototype._removeTimePicker=function(){this._leftDiv.removeClass("e-left-timepicker");this._rightDiv.removeClass("e-right-timepicker");this._leftTP.destroy();this._rightTP.destroy();this._rightTP=null;this._leftTP=null;this._leftTime.remove();this._rightTime.remove();this._setOption("width","");this._setOption("width","100%");this._updateValues()},t.prototype._setOption=function(n,t){this._leftDP&&this._leftDP.option(n,t);this._rightDP&&this._rightDP.option(n,t);this.model.enableTimePicker&&(this._leftTP&&this._leftTP.option(n,t),this._rightTP&&this._rightTP.option(n,t))},t.prototype._renderTimePicker=function(){this.model.timeFormat==""&&(this.model.timeFormat=this.culture.calendar.patterns.t);this._leftTime=ej.buildTag("input.leftTime#"+this._id+"_lTime");this._leftDiv.append(this._leftTime);this._leftDiv.addClass("e-left-timepicker");var n=this;this._leftTime.ejTimePicker({popupWidth:"115px",locale:this.model.locale,timeFormat:this.model.timeFormat,select:function(t){n.model.startDate&&n.model.endDate&&(n._rightTP&&n.model.startDate.toLocaleDateString()==n.model.endDate.toLocaleDateString()&&n._rightTP.option("minTime",t.value),n._buttonDiv.find(".e-drp-apply").removeClass("e-disable"))}});this._leftTP=this._leftTime.ejTimePicker("instance");this._leftTP.popup.addClass("e-daterange-timepopup");this._rightTime=ej.buildTag("input.rightTime#"+this._id+"_rTime");this._rightDiv.append(this._rightTime);this._rightDiv.addClass("e-right-timepicker");this._rightTime.ejTimePicker({popupWidth:"115px",locale:this.model.locale,create:$.proxy(this._updateOnRender,this),timeFormat:this.model.timeFormat,select:function(){n.model.startDate&&n.model.endDate&&n._buttonDiv.find(".e-drp-apply").removeClass("e-disable")}});this._rightTP=this._rightTime.ejTimePicker("instance");this._rightTP.popup.addClass("e-daterange-timepopup");this._on(this._leftTP.element,"keydown",this._onKeyDown);this._on(this._rightTP.element,"keydown",this._onKeyDown);this._setTimePickerPos()},t.prototype._setTimePickerPos=function(){$("#"+this._id+"_lTime_timewidget").css({position:"absolute",top:0,left:this._leftDP.popup.width()+this._leftDP.popup.position().left-this.popup.find($("#"+this._id+"_lTime_timewidget")).outerWidth()});$("#"+this._id+"_rTime_timewidget").css({position:"absolute",top:this.popup.hasClass("e-daterange-responsive")?this._rightDP.wrapper.position().top:0,left:this._rightDP.popup.width()+this._rightDP.popup.position().left-this.popup.find($("#"+this._id+"_rTime_timewidget")).outerWidth()})},t.prototype._updateInput=function(){if(!(this.model.startDate&&this.model.endDate)){this.model.value&&this.element.val(this.model.value);this._popupOpen&&this.popupHide();return}this._resetValues();this.wrapper.removeClass("e-error");this._mainValue();this._refreshMinMax()},t.prototype._removeWatermark=function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},t.prototype._mainValue=function(){var i="",r="",u=this.model.startDate,f=this.model.endDate,n=ej.format(u,this.model.dateFormat,this.model.locale),t=ej.format(f,this.model.dateFormat,this.model.locale);this.model.enableTimePicker&&this._leftTP&&this._rightTP&&this._leftTP.model.value&&this._rightTP.model.value?(i=this._leftTP.model.value,r=this._rightTP.model.value,n=ej.format(n+" "+i,this._dateTimeFormat,this.model.locale),t=ej.format(t+" "+r,this._dateTimeFormat,this.model.locale),this.model.startDate=ej.parseDate(n,this._dateTimeFormat,this.model.locale),this.model.endDate=ej.parseDate(t,this._dateTimeFormat,this.model.locale)):(this.model.startDate=ej.parseDate(n,this._leftDP.model.dateFormat,this.model.locale),this.model.endDate=ej.parseDate(t,this._rightDP.model.dateFormat,this.model.locale));n!=null&&t!=null?(this.model.value=n+" "+this.model.separator+" "+t,this.element.val(this.model.value),this._hiddenInput&&this._hiddenInput.attr("value",this.model.value),this._removeWatermark(),this._validState=!0):(this.model.value=null,this._setWaterMark(),this._validState=!1);this._prevValue=this.model.value;this._buttonDiv&&this._buttonDiv.find(".e-drp-apply").addClass("e-disable");this._trigger("_change",{value:this.model.value})},t.prototype._bindDateButton=function(){if(this.dateRangeicon&&this._on(this.dateRangeIcon,"click",this._showDatePopUp),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",$.proxy(this._showDatePopUp,this));this.element.off("blur",$.proxy(this._onMainFocusOut,this))}this.model.allowEdit&&this.element.off("mousedown",$.proxy(this._showDatePopUp,this))},t.prototype._showDatePopUp=function(n){if(!this.model.enabled)return!1;var t=!1;(n.button?t=n.button==2:n.which&&(t=n.which==3),t)||this._showhidePopup(n)},t.prototype._showhidePopup=function(n){this._popupOpen?(this._isFocused||!this.element.is(":input")||ej.isTouchDevice()||this.wrapper.addClass("e-focus"),this.popupHide(n)):(this._isFocused||!this.element.is(":input")||ej.isTouchDevice()||this.wrapper.addClass("e-focus"),this.popupShow(n))},t.prototype.popupHide=function(n){if(!this._popupOpen||this._isPopScroll)return!1;var t=this;this._trigger("beforeClose",{element:this.popup,events:n});this.popup.attr({"aria-hidden":"true"});this._leftTP&&!this._leftTP._popupOpen&&this._leftTP.hide();this._rightTP&&!this._rightTP._popupOpen&&this._rightTP.hide();this.popup.css("visibility","visible").slideUp(100,function(){t._popupOpen=!1});this._off(ej.getScrollableParents(this.wrapper),"scroll",$.proxy(this.popupHide,this));this._trigger("close",{element:this.popup,events:n});this.wrapper.removeClass("e-active")},t.prototype.popupShow=function(n){if(!this.model.enabled||this._popupOpen)return!1;var t=this;this._trigger("beforeOpen",{element:this.popup,events:n});this.wrapper.addClass("e-focus");this.popup.attr({"aria-hidden":"false"});t._popupOpen=!0;this.popup.css({visibility:"hidden",display:"block"});this._resizePopup();this.popup.css({display:"none",visibility:"visible"}).slideDown(100,function(){});this._on(ej.getScrollableParents(this.wrapper),"scroll",$.proxy(this.popupHide,this));this._trigger("open",{element:this.popup,events:n});this.wrapper.addClass("e-active")},t.prototype._resizePopup=function(){var n=this,i=0,t=0,u=n.datePopup.find(".e-popup.e-calendar").outerWidth(),r=n.datePopup.find(".e-popup.e-calendar").height();if(this._customRangePicker&&this._customRangePicker.height()<=0&&this._customRangePicker.height(this.datePopup.height()),this.model.ranges&&this.model.ranges.length>0&&(t=this._customRangePicker.find("ul").height(),i=n._customRangePicker.outerWidth()),$(window).width()-this.wrapper.position().left0)return u=n.parents(),r=$("body").children(),!ej.isNullOrUndefined(n)&&n.length>0&&r.splice(r.index(t),1),$(r).each(function(n,t){u.push(t)}),i=Math.max.apply(i,$.map(u,function(n){if($(n).css("position")!="static")return parseInt($(n).css("z-index"))||1})),!i||i<1e4?i=1e4:i+=1,i},t.prototype._setDatePickerPosition=function(){var n=this.element.is("input")?this.wrapper:this.element,t=this._getOffset(n),u,s=$(document).scrollTop()+$(window).height()-(t.top+$(n).outerHeight()),h=t.top-$(document).scrollTop(),r=this.popup.outerHeight(),f=this.popup.outerWidth(),i=t.left,e=n.outerHeight(),a=(e-n.height())/2,c=this._getZindexPartial(this.element,this.popup),o=3,l=rh?t.top+e+o:t.top-r-o;u=$(document).scrollLeft()+$(window).width()-i;f>u&&f0?"left":"right",ej.isNullOrUndefined(t)||t==="")||(i=new Date(t),this._selectedStartDate!=null&&this._selectedEndDate!=null&&(this._selectedStartDate=null),this._selectedStartDate==null?(this._selectedStartDate=i,this._selectedEndDate=null,this._startDate&&(this._startDate.date=null),this._rightDP.element.val(null),r=="right"&&(this._leftDP._stopRefresh=!0,this._leftDP.option("value",this._selectedStartDate),this._leftDP.element.val(this._selectedStartDate.toLocaleDateString())),this._rightTP&&this._rightTP.option("value",""),this.popup.find(".in-range").removeClass("in-range"),this.datePopup.find("td.e-state-default.e-active").removeClass("e-active"),this._rightDP.element.parents(".e-datewidget").removeClass("e-error"),u=$(this.datePopup.find('.current-month[date="'+t+'"]')),this._selectedStartDate=new Date(u.attr("date")),this._setStartDate(this._selectedStartDate,u,!0)):this._selectedStartDate===null||this._selectedEndDate!=null||i=n.year&&(f=n.element.parent().hasClass("e-left-datepicker")?$(i.find("td.current-month")[0]):$(i.find("td.current-month")[0]),u=n.element.parent().hasClass("e-left-datepicker")?"left":"right",this._updateRanges(u))},t.prototype._renderRangesWrapper=function(){ej.isNullOrUndefined(this._customRangePicker)&&(this._customRangePicker=ej.buildTag("div.e-custom-dateranges").css("height",this.datePopup.height()),this.popup.append(this._customRangePicker),this._customRangePicker.insertBefore(this._buttonDiv),this._ranges_li="
      <\/ul>",this._customRangePicker.append(this._ranges_li))},t.prototype.setRange=function(n){var t,i;if(this._clearRanges(),typeof n=="string"){for(i=0;i"+t.label+"<\/li>"));this._renderRangesWrapper();this._customRangePicker.find(".e-dateranges-ul").append(e);this._off(this._customRangePicker.find("ul li.rangeItem"),"click",this._customSelection);this._on(this._customRangePicker.find("ul li.rangeItem"),"click",this._customSelection);this._scrollerObj&&this._scrollerObj.refresh()},t.prototype._righthoverRange=function(n){var r,i,t;if(this._activeItem=$(n.currentTarget),this._activeItem.hasClass("e-hidedate")){n.stopPropagation();return}this.popup.find(".range-hover").removeClass("range-hover");this._activeItem.hasClass("in-range")&&this._activeItem.addClass("range-hover");r=this._activeItem.attr("date");i=new Date(r);this._trigger("hover",{element:n.currentTarget,events:n,value:new Date(this._activeItem.attr("date"))});t=this;!ej.isNullOrUndefined(t._selectedStartDate)&&ej.isNullOrUndefined(t._selectedEndDate)&&this.popup.find(".current-month").each(function(n,r){var u=$(r),e=u.attr("date"),f;ej.isNullOrUndefined(e)||e===""||(f=new Date(e),f>t._startDate.date&&ft._selectedStartDate&&new Date(new Date(t._selectedStartDate.getTime()).setDate(t._selectedStartDate.getDate()+1)).getTime()!==i.getTime()?u.addClass("showrange"):u.removeClass("showrange"))})},t.prototype._customSelection=function(n){if(this._customRangePicker.find(".e-active").removeClass("e-active"),$(n.currentTarget).attr("e-date-range")!="customPicker"){var t=$(n.currentTarget).attr("e-data-value").split(",");this.model.startDate=new Date(t[0]);this.model.endDate=new Date(t[1]);this._rightDP.element.parents(".e-datewidget").removeClass("e-error");this._customSet()}else this.model.startDate=null,this.model.endDate=null,this._clearRanges();$(n.currentTarget).addClass("e-active")},t.prototype._setWaterMark=function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._isSupport||this.element.val()!=""?$(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},t.prototype._clearRanges=function(){this._updateRangesList();this._setOption("value","");this._rightDP.element.parents(".e-datewidget").removeClass("e-val-error");this._selectedStartDate=null;this._selectedEndDate=null;this._startDate&&(this._startDate.date=null);this._endDate&&(this._endDate.date=null);this.popup.find("td").removeClass("e-start-date e-end-date in-range e-active e-state-hover today");this.model.value=null;this.model.startDate=null;this.model.endDate=null;this._buttonDiv&&this._buttonDiv.find(".e-drp-apply").addClass("e-disable")},t.prototype.clearRanges=function(){this._clearRanges();this._refreshMinMax();this.element.val("");this._trigger("_change",{value:this.model.value});this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate});this._trigger("clear",{})},t.prototype._getLocalizedLabels=function(){return ej.getLocalizedConstants("ej.DateRangePicker",this.model.locale)},t.prototype._unWireEvents=function(){this._off($(".e-next",this.popup),"click",$.proxy(this._previousNextHandler,this));this._off($(".e-prev",this.popup),"click",$.proxy(this._previousNextHandler,this));this._off($(this._buttonDiv.find("div.e-drp-cancel")),"click",this._cancelButton);this._off($(this._buttonDiv.find("div.e-drp-reset")),"click",this.clearRanges);this._off(this.popup.find(".leftDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._off(this.popup.find(".rightDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this.model.allowEdit&&(this._off(this.element,"blur",this._onMainFocusOut),this._off(this.element,"focus",this._onFocusIn),this._off(this.element,"keydown",this._onKeyDown))},t.prototype._onDocumentKeyDown=function(n){n.keyCode=="13"&&!this._buttonDiv.find(".e-drp-apply").hasClass("e-disable")&&this.wrapper.hasClass("e-focus")&&this._buttonDiv.find(".e-drp-apply").click()},t.prototype._wireEvents=function(){this._on($(".e-next",this.popup),"click",$.proxy(this._previousNextHandler,this));this._on($(".e-prev",this.popup),"click",$.proxy(this._previousNextHandler,this));this._on($(this._leftDP.sfCalendar.find("table .e-datepicker-months td")),"click",$.proxy(this._previousNextHandler,this));var n=this;this._on($(this._buttonDiv.find("div.e-drp-reset")),"click",this.clearRanges);this._on($(this._buttonDiv.find("div.e-drp-apply")),"click",function(){n._buttonDiv.find(".e-drp-apply").hasClass("e-disable")||(n._isPopScroll=!1,n._updateInput(),n._showhidePopup(),n._buttonDiv.find(".e-drp-apply").addClass("e-disable"),this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate}),this._trigger("select",{startDate:this.model.startDate,endDate:this.model.endDate,value:this.model.value}))});this._on($(window),"resize",this._resizePopup);$(document).on("mousedown",$.proxy(this._onDocumentClick,this));$(document).on("keydown",$.proxy(this._onDocumentKeyDown,this));this._on($(this._buttonDiv.find("div.e-drp-cancel")),"click",this._cancelButton);this._on(this.popup.find(".leftDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".rightDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".leftDate_wrapper.e-timepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".rightDate_wrapper.e-timepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this.model.allowEdit&&(this._on(this.element,"blur",this._onMainFocusOut),this._on(this.element,"focus",this._onFocusIn),this._on(this.element,"keydown",this._onKeyDown));this._on(this._leftDP.element,"keydown",this._onKeyDown);this._on(this._rightDP.element,"keydown",this._onKeyDown);this.popup.on("mouseenter touchstart",$.proxy(function(){this._isPopScroll=!0},this));this.popup.on("mouseleave touchend",$.proxy(function(){this._isPopScroll=!1},this))},t.prototype._onFocusIn=function(n){this._isSupport&&(n.preventDefault(),this._isFocused=!0);this.wrapper.hasClass("e-error")&&(this._validState=!1,this.wrapper.removeClass("e-error"));this.model.showPopupButton||this.model.readOnly||this.popupShow(n);this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this.wrapper.addClass("e-focus")},t.prototype._onKeyDown=function(n){n.keyCode==13&&($(n.currentTarget).hasClass("e-datepicker")?(this._validateValues($(n.currentTarget).val(),$(n.currentTarget).parents(".e-left-datepicker").length>0?"left":"right"),$(n.currentTarget).parents(".e-left-datepicker").length>0?this._leftDP.model.value=this.model.startDate:this._rightDP.model.value=this.model.endDate,this._onPopupFocusOut(n)):$(n.currentTarget).hasClass("leftTime")?this._leftTP._trigger("select"):this._rightTP._trigger("select"));n.stopImmediatePropagation()},t.prototype._cancelButton=function(){this._prevValue=null;this._isPopScroll=!1;this._clearRanges();this._onMainFocusOut();this._showhidePopup()},t.prototype._updateRanges=function(n){var i=n=="left"?this._leftDP:this._rightDP,t=this;if(i.popup.find("td.current-month").each(function(n,i){var r=$(i),f=r.attr("date"),u;ej.isNullOrUndefined(f)||f===""||(u=new Date(f),ej.isNullOrUndefined(t._startDate)||ej.isNullOrUndefined(t._startDate.date)||ej.isNullOrUndefined(t._endDate.date)||(u>t._startDate.date&&u0){if($(i.popup.find(".e-start-date")).next("td.in-range").length>0)return;$(i.popup.find(".e-start-date")).removeClass("showrange")}},t.prototype.getSelectedRange=function(){return{startDate:this.model.startDate,endDate:this.model.endDate}},t.prototype.enable=function(){this.element[0].disabled=!1;this.model.enabled=!0;this.wrapper.removeClass("e-disable");this.element.removeClass("e-disable");this.element.attr("aria-enabled","false");this.element.attr("enabled","enabled");this._isSupport||this._hiddenInput.attr("enabled","enabled");this.dateRangeIcon&&this.dateRangeIcon.removeClass("e-disable").attr("aria-disabled","false");this.popup.children("div").removeClass("e-disable").attr("aria-disabled","false");this._setOption("enabled",!0)},t.prototype.disable=function(){this.element[0].disabled=!0;this.model.enabled=!1;this.wrapper.addClass("e-disable");this.element.addClass("e-disable");this.element.attr("aria-disabled","true");this.element.attr("disabled","disabled");this._isSupport||this._hiddenInput.attr("disabled","disabled");this.dateRangeIcon&&this.dateRangeIcon.addClass("e-disable").attr("aria-disabled","true");this.popup.children("div").addClass("e-disable").attr("aria-disabled","true");this.popupHide();this._setOption("enabled",!1)},t.prototype._onMainFocusOut=function(){var n=this.element.val(),t;if(this.wrapper.removeClass("e-focus"),this.element.val()!=""||this._prevValue!=null){if(this._prevValue&&this._prevValue==this.element.val()){this._validState?this.wrapper.removeClass("e-error").removeClass("e-focus"):this.wrapper.addClass("e-error").removeClass("e-focus");return}if(this._updateRangesList(),this.element.val()==""){this.wrapper.removeClass("e-error");this._clearRanges();this._setWaterMark();this._refreshMinMax();this._trigger("change",{value:this.model.value,startDate:null,endDate:null});this._trigger("_change",{value:this.model.value});return}this.wrapper.removeClass("e-error");var i=this.element.val().split(this.model.separator),r=ej.parseDate(i[0],this._dateTimeFormat,this.model.locale),u=ej.parseDate(i[1],this._dateTimeFormat,this.model.locale);if(this._resetValues(),this._validState=!0,this._validateValues(r,"left")&&this._validateValues(u,"right")||(this._clearRanges(),this._refreshMinMax(),t=!0),this._startEndValidation()||(this._clearRanges(),this._refreshMinMax(),t=!0),n!=""&&t){this.element.val(n);this.wrapper.addClass("e-error");this.model.value=null;this._validState=!1;this._trigger("_change",{value:this.element.val()});this._trigger("change",{value:this.model.value,startDate:null,endDate:null});return}this._resetValues();this._setValues();this._refreshMinMax();this.model.value=this._validState&&n!=""?n:null;this._popupOpen||this._mainValue();this._prevValue=this.model.value;this._validState?this.wrapper.removeClass("e-error").removeClass("e-focus"):this.wrapper.addClass("e-error").removeClass("e-focus");this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate})}},t.prototype._onPopupFocusOut=function(n){var r;(ej.format(this._selectedStartDate,"M/d/yyyy")!=$("#daterangeleftDate_wrapper").val()||ej.format(this._selectedEndDate,"M/d/yyyy")!=$("#daterangerightDate_wrapper").val())&&this._updateRangesList();r=$(n.currentTarget).parents(".e-left-datepicker").length>0?this._leftDP:this._rightDP;this._validateValues($(n.currentTarget).val(),$(n.currentTarget).parents(".e-left-datepicker").length>0?"left":"right");$(n.currentTarget).parents(".e-left-datepicker").length>0?this._leftDP.model.value=this.model.startDate:this._rightDP.model.value=this.model.endDate;var t=this.model.startDate,u=this.model.endDate,i=!1;if(this._rightDP.element.parents(".e-datewidget").removeClass("e-val-error"),this._startEndValidation()||($(n.currentTarget).parents(".e-left-datepicker").length>0?(this._clearRanges(),this.model.startDate=t,this._selectedStartDate=this.model.startDate):(this._rightDP.element.parents(".e-datewidget").addClass("e-val-error"),this.model.endDate=null,i=!0)),t==null){this._clearRanges();return}this._selectedStartDate=this.model.startDate;this._selectedEndDate=this.model.endDate;this._resetValues();this._setValues();this.model.showPopupButton||this._off(this.element,"click",this._elementClick);this._refreshMinMax();this._popupOpen||this._mainValue();i&&this._rightDP.element.val(u.toLocaleDateString());this._setWaterMark()},t.prototype._resetValues=function(){this._leftDP.option("maxDate",null);this._rightDP.option("minDate",null);this._leftDP.option("value",this._leftDP.model.value);this._rightDP.option("value",this._rightDP.model.value)},t.prototype._refreshMinMax=function(){var n=this._getNextMonth(this._leftDP._calendarDate),t;n.toDateString()>this._rightDP._calendarDate.toDateString()&&(t=this._rightDP.model.value,this._rightDP._calendarDate=n,this._rightDP._dateValue=n,this._rightDP.option("value",n));this._rightDP.option("minDate",n);this._rightDP.option("value",t);var t=this._rightDP._calendarDate,i=t.getFullYear(),r=t.getMonth();this._leftDP.option("maxDate",new Date(i,r,0))},t.prototype._refreshEvents=function(){this._off(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._off(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._off(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._off(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._on(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._on(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._on(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._on(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._on($(this._leftDP.sfCalendar.find("table .e-datepicker-months td")),"click",$.proxy(this._previousNextHandler,this))},t.prototype._previousNextHandler=function(n){var s=$(n.currentTarget).closest(".e-calendar").parent(),u=s.hasClass("e-left-datepicker")?"left":"right",i,r,f,e,h,t;if(n.type=="_month_Loaded"?u=="left"?(r=$(this._rightDP.popup.find("td.current-month")[0]).attr("date"),i=this._leftDP._dateValue.toDateString()):u=="right"&&(i=$(this._leftDP.popup.find("td.current-month")[0]).attr("date"),r=this._rightDP._dateValue.toDateString()):(r=$(this._rightDP.popup.find("td.current-month")[0]).attr("date"),i=$(this._leftDP.popup.find("td.current-month")[0]).attr("date")),f=new Date(i),e=new Date(r),f.setHours(0,0,0,0),e.setHours(0,0,0,0),h=!0,u=="right"){t=$("table",this._leftDP.sfCalendar).get(0).className;t=="e-dp-viewdays"&&(this._leftDP._stopRefresh=!0);this._rightDP._stopRefresh=!1;var o=e,c=o.getFullYear(),l=o.getMonth();this._leftDP.option("maxDate",new Date(c,l,0));t=="e-dp-viewmonths"&&this._leftDP._startLevel("year");this._leftDP._checkDateArrows()}else t=$("table",this._rightDP.sfCalendar).get(0).className,$("table",this._rightDP.sfCalendar).get(0).className=="e-dp-viewdays"&&(this._rightDP._stopRefresh=!0),this._leftDP._stopRefresh=!1,this._rightDP.option("minDate",this._getNextMonth(f)),t=="e-dp-viewmonths"&&this._rightDP._startLevel("year"),this._rightDP._checkDateArrows();this._rightDP.element.parents(".e-datewidget").removeClass("e-error")},t}(ej.WidgetBase);window.ej.widget("ejDateRangePicker","ej.DateRangePicker",new ejDateRangePicker);window.ejDateRangePicker=null;ej.DateRangePicker.Locale={};ej.DateRangePicker.Locale=ej.DateRangePicker.Locale||{};ej.DateRangePicker.Locale["default"]=ej.DateRangePicker.Locale["en-US"]={ButtonText:{apply:"Apply",cancel:"Cancel",reset:"Reset"},watermarkText:"Select Range",customPicker:"Custom Picker"},function(n,t,i){t.widget("ejDialog","ej.Dialog",{_rootCSS:"e-dialog",element:null,_ignoreOnPersist:["drag","dragStart","dragStop","resizeStop","resizeStart","resize","beforeClose","beforeOpen","collapse","expand","close","open","destroy","create","ajaxSuccess","ajaxError","contentLoad","actionButtonClick","enableResize"],model:null,validTags:["div","span"],_setFirst:!1,angular:{terminal:!1},defaults:{showOnInit:!0,closeOnEscape:!0,closeIconTooltip:"close",enableAnimation:!0,allowDraggable:!0,backgroundScroll:!0,height:"auto",minHeight:120,minWidth:200,maxHeight:null,maxWidth:null,enableModal:!1,position:{X:"",Y:""},containment:null,enableResize:!0,htmlAttributes:{},showHeader:!0,showFooter:!1,contentType:null,contentUrl:null,ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},title:"",width:400,zIndex:1e3,cssClass:"",enableRTL:!1,allowKeyboardNavigation:!0,showRoundedCorner:!1,actionButtons:["close"],animation:{show:{effect:"fade",duration:400},hide:{effect:"fade",duration:400}},tooltip:{close:"Close",collapse:"Collapse",restore:"Restore",maximize:"Maximize",minimize:"Minimize",expand:"Expand",unPin:"UnPin",pin:"Pin"},footerTemplateId:null,locale:"en-US",faviconCSS:null,content:null,target:null,enablePersistence:!1,enabled:!0,isResponsive:!1,actionButtonClick:null,beforeClose:null,close:null,expand:null,collapse:null,beforeOpen:null,open:null,drag:null,dragStart:null,dragStop:null,resize:null,resizeStart:null,resizeStop:null,contentLoad:null,ajaxSuccess:null,ajaxError:null,create:null,destroy:null,Close:null},dataTypes:{showOnInit:"boolean",closeOnEscape:"boolean",enableAnimation:"boolean",backgroundScroll:"boolean",position:"data",animation:"data",closeIconTooltip:"string",tooltip:"data",allowDraggable:"boolean",enableModal:"boolean",enableResize:"boolean",isResponsive:"boolean",showHeader:"boolean",showFooter:"boolean",title:"string",faviconCSS:"string",zIndex:"number",cssClass:"string",enablePersistence:"boolean",contentUrl:"string",contentType:"string",enableRTL:"boolean",enabled:"boolean",allowKeyboardNavigation:"boolean",showRoundedCorner:"boolean",locale:"string",htmlAttributes:"data",ajaxSettings:"data",actionButtons:"array",footerTemplateId:"string"},_setModel:function(i){var r,u;for(r in i)switch(r){case"closeIconTooltip":this._dialogClose.attr("title",i[r]);break;case"tooltip":this._tooltipText(i[r]);break;case"title":this.model.title=i[r];this._ejDialog.find("span.e-title").length<=0?this._addTitleText():this._ejDialog.find("span.e-title").html(i[r]);this._updateCaptionWidth();break;case"width":this.model.width=i[r];this._changeSize();this._updateCaptionWidth();i[r]=this.model.width;break;case"height":this.model.height=i[r];this._changeSize();i[r]=this.model.height;break;case"position":this.model.position=i[r];this._dialogPosition();break;case"cssClass":this._changeSkin(i[r]);break;case"showRoundedCorner":this.model.showRoundedCorner=i[r];this._roundedCorner(i[r]);break;case"contentType":this.model.contentType=i[r];this._appendContent(i[r]);break;case"enabled":this.model.enabled=i[r];this._enabledAction(i[r]);break;case"contentUrl":this.model.contentUrl=i[r];this._appendContent(this.model.contentType);break;case"backgroundScroll":this.model.backgroundScroll=i[r];!this.model.backgroundScroll&&this.model.enableModal?n("body").addClass("e-dialog-modal"):n("body").removeClass("e-dialog-modal");break;case"content":case"target":this._ejDialog.appendTo(n(i[r]));this.model.target=this.model.content=i[r];this._dialogPosition();break;case"containment":this._setDragArea(i[r]);t.isNullOrUndefined(this._target)?this._ejDialog.appendTo(document.body):this._ejDialog.appendTo(this._target);this.model.position.X=this.model.position.Y="";this._dialogPosition();this.model.containment=i[r]=this._target;this.model.enableModal&&this._createOverlay();this._dialogTitlebar.ejDraggable({dragArea:this._target});break;case"locale":this.model.locale=i[r];this.localizedLabels=this._getLocalizedLabels();this._setLocaleCulture(this.localizedLabels,!0);this._tooltipText(this.model.tooltip);this._ejDialog.find("span.e-title").length<=0?this._addTitleText():this._ejDialog.find("span.e-title").html(this.model.title);this._updateCaptionWidth();break;case"minHeight":this.model.minHeight=i[r];this._ejDialog.css("minHeight",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"minWidth":this.model.minWidth=i[r];this._ejDialog.css("minWidth",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"maxHeight":this.model.maxHeight=i[r];this._ejDialog.css("maxHeight",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"maxWidth":this.model.maxWidth=i[r];this._ejDialog.css("maxWidth",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"zIndex":this._ejDialog.css("z-index",i[r]);break;case"faviconCSS":this.model.faviconCSS=i[r];this._favIcon();this._updateCaptionWidth();break;case"isResponsive":this.model.isResponsive=i[r];this.model.isResponsive?this._ejDialog.addClass("e-dialog-resize"):this._ejDialog.removeClass("e-dialog-resize");this._wireResizing();break;case"allowDraggable":this.model.allowDraggable=i[r];i[r]?this._enableDrag():this._dialogTitlebar.removeClass("e-draggable");break;case"enableResize":this.model.enableResize=i[r];i[r]?this._enableResize():(this._ejDialog.removeClass("e-resizable"),this._ejDialog.find(".e-resize-handle").remove());this._reRenderScroller();break;case"showHeader":this.model.showHeader=i[r];i[r]?(this._renderTitleBar(),this._iconsRender(this.model.actionButtons),this.model.faviconCSS&&(this._dialogFavIcon=!1,this._favIcon()),this._enableDrag(),this._maximize||this._updateScroller(t.isNullOrUndefined(this.contentDiv)?this._ejDialog.outerHeight(!0)-1-this._dialogTitlebar.outerHeight(!0):this.contentDiv.css("border-width")=="0px",t.isNullOrUndefined(this.contentDiv)?this._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px")):(this._ejDialog.find(".e-titlebar").remove(),this._maximize?this.refresh():this._updateScroller(t.isNullOrUndefined(this.contentDiv)?this._ejDialog.outerHeight(!0)-1:this.contentDiv.css("border-width")=="0px",t.isNullOrUndefined(this.contentDiv)?this._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px"));this._roundedCorner(this.model.showRoundedCorner);this.model.showFooter&&this._setContainerSize()._resetScroller();break;case"showFooter":this.model.showFooter=i[r];i[r]?(this._appendContent(),this._ejDialog.find(".e-resizable").remove()):this._ejDialog.find(".e-footerbar").remove();this._enableResize()._enableDrag()._sizeInPercent();this._reRenderScroller();this._setContainerSize()._resetScroller();this._roundedCorner(this.model.showRoundedCorner);break;case"footerTemplateId":this.model.footerTemplateId=i[r];this.model.showFooter&&(n(".e-footerbar").empty(),u=n("body").find("#"+this.model.footerTemplateId).html(),this._dialogFooterbar.append(u),this._enableResize());break;case"enableRTL":this.model.enableRTL=i[r];this.model.faviconCSS&&this._favIcon();i[r]?(this._ejDialog.addClass("e-rtl"),this.iframe&&this.iframe.contents().find("body").css("direction","rtl"),this.scroller&&this._resetScroller()):(this._ejDialog.removeClass("e-rtl"),this.iframe&&this.iframe.contents().find("body").css("direction","ltr"),this.scroller&&this._resetScroller());break;case"actionButtons":t.isNullOrUndefined(this._dialogTitlebar)||(this._removeAllIcons(),this._iconsRender(i[r]));this.model.actionButtons=i[r];this._updateCaptionWidth();break;case"enableModal":this._enableModal(i[r]);break;case"htmlAttributes":this._addAttr(i[r])}},_destroy:function(){this._overLay&&this._overLay.remove();this._cloneElement.appendTo(this._ejDialog.parent());this._ejDialog.remove();this._cloneElement.removeClass("e-dialog");this.element=this._cloneElement;this._isOpen=!1},keyConfigs:[37,38,39,40],_init:function(){this._init=!0;this._widthPercent=null;this._heightPercent=null;this._windowSize={outerWidth:n(window).outerWidth(),outerHeight:n(window).outerHeight()};this._initSize={width:this.model.width,height:this.model.height};this._sizeType={width:isNaN(this.model.width)?this.model.width.match(/px|%|auto/g)[0]:null,height:isNaN(this.model.height)?this.model.height.match(/px|%|auto/g)[0]:null};this._isOpen=this._maximize=this._minimize=!1;this.localizedLabels=this._getLocalizedLabels();this._setLocaleCulture(this.localizedLabels);this._setDimension();this.model.close||(this.model.close=this.model.Close);this.model.target||(this.model.target=this.model.content);this._responsive();this._renderControl();this._wireEvents();scrObj=this._ejDialog.closest(".e-dialog.e-js").data("ejDialog");scrObj&&scrObj._resetScroller();this.hidden=!1;this._init=!1;this._keyNavigation=!1},_responsive:function(){this.width=this.model.width;n(this.element).width(this.width);this.height=this.model.height;n(this.element).height(this.height);n(window).on("resize",n.proxy(this._resizeHandler,this))},_resizeHandler:function(){this._maximize&&(this.width=n(this._dialogTitlebar).outerWidth(),n(this.contentDiv).width(this.width),n(this.contentDiv).children().width(this.width),this.model.height=this.height=n(window).height(),this._ejDialog.css({height:this.height}),this.contentDiv.height(this._ejDialog.height()-n(this._dialogTitlebar).outerHeight()-n(this._dialogFooterbar).outerHeight()),this.element.height(this.contentDiv.height()));t.isNullOrUndefined(this.element)||this._resetScroller()},_setLocaleCulture:function(n,t){this.defaults.closeIconTooltip===this.model.closeIconTooltip&&(this.model.closeIconTooltip=n.closeIconTooltip);t&&(this.model.tooltip=this.localizedLabels.tooltip,this.model.title=this.localizedLabels.title);JSON.stringify(this.model.tooltip)===JSON.stringify(this.defaults.tooltip)&&(this.model.tooltip=n.tooltip);this.model.title===this.defaults.title&&(this.model.title=n.title)},_setDragArea:function(i){t.isNullOrUndefined(i)?this._target=null:typeof i=="string"?(i=="parent"&&(this._target=n(this.element).parent()),i.toLowerCase()=="document"&&(this._target=n(document)),i.toLowerCase()=="window"?this._target=n(window):n(i).length>0&&(this._target=n(i))):typeof i=="object"?i.length>0&&(this._target=i):this._target=null},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i._ejDialog.addClass(n):t=="disabled"&&n=="disabled"?(i.model.enabled=!1,i._enabledAction(!1)):i._ejDialog.attr(t,n)})},_tooltipText:function(i){n.extend(this.model.tooltip,i);!t.isNullOrUndefined(this._dialogClose)&&this._dialogClose.hasClass("e-close")&&this._dialogClose.attr("title",this.model.tooltip.close);!t.isNullOrUndefined(this._dialogCollapsible)&&(i.collapse||i.expand)&&(this._dialogCollapsible.hasClass("e-arrowhead-up")&&this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._dialogCollapsible.hasClass("e-arrowhead-down")&&this._dialogCollapsible.attr("title",this.model.tooltip.expand));!t.isNullOrUndefined(this._dialogMaximize)&&(i.maximize||i.restore)&&(this._dialogMaximize.hasClass("e-maximize")&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this._dialogMaximize.hasClass("e-restore")&&this._dialogMaximize.attr("title",this.model.tooltip.restore));!t.isNullOrUndefined(this._dialogMinimize)&&(i.minimize||i.restore)&&(this._dialogMinimize.hasClass("e-minus")&&this._dialogMinimize.attr("title",this.model.tooltip.minimize),this._dialogMinimize.hasClass("e-restore")&&this._dialogMinimize.attr("title",this.model.tooltip.restore));!t.isNullOrUndefined(this._dialogPin)&&(i.pin||i.unPin)&&(this._dialogPin.hasClass("e-unpin")&&this._dialogPin.attr("title",this.model.tooltip.pin),this._dialogPin.hasClass("e-pin")&&this._dialogPin.attr("title",this.model.tooltip.unPin))},_renderControl:function(){var i,r,u;this._cloneElement=this.element.clone();this.element.attr("tabindex",0).attr({role:"dialog","aria-labelledby":this.element.prop("id")+"_title"});this._ejDialog=t.buildTag("div.e-dialog e-widget e-box "+this.model.cssClass+" e-dialog-wrap e-shadow#"+(this.element.prop("id")==""?"":this.element.prop("id")+"_wrapper"),"",{display:"none",zIndex:this.model.zIndex},{tabindex:0});this.model.isResponsive&&this._ejDialog.addClass("e-dialog-resize");this.wrapper=this._ejDialog;this._addAttr(this.model.htmlAttributes);this._setDragArea(this.model.containment);t.isNullOrUndefined(this.model.containment)||t.isNullOrUndefined(this._target)?t.isNullOrUndefined(this.model.target)||(i=this.model.target):i=this._target;r=t.isNullOrUndefined(i)?document.body:i;u=n(r).find("#"+this._id+"_wrapper").get(0);u&&n(u).remove();this._ejDialog.appendTo(r);this.model.enableRTL&&this._ejDialog.addClass("e-rtl");this.model.showHeader&&(this._renderTitleBar(),this._iconsRender(this.model.actionButtons),this.model.faviconCSS&&this._favIcon());this._appendContent(this.model.contentType);this._enableResize()._enableDrag()._setSize();this.model.height!="auto"&&this._sizeInPercent();this.model.contentType!="ajax"&&(this.model.showOnInit&&this.open()?this._setContainerSize()._resetScroller():this._setHiddenDialogSize());this._roundedCorner(this.model.showRoundedCorner);this._enabledAction(this.model.enabled);this._sizeType.width=="auto"&&(this._maxWidth=this.model.width);this._sizeType.height=="auto"&&(this._maxHeight=this.model.height)},_setContainerSize:function(){if(this.model.height!="auto"){var t=this._ejDialog.outerHeight()-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0)+(this.model.showFooter?n(this._ejDialog.find("div.e-footerbar")).outerHeight(!0):0)-1;this.contentDiv.height(t);this.element.outerHeight(t)}return this},_changeSize:function(){this._initSize={width:this.model.width,height:this.model.height};this._sizeType.width=isNaN(this.model.width)?this.model.width.match(/px|%|auto/g):null;this._sizeType.height=isNaN(this.model.height)?this.model.height.match(/px|%|auto/g):null;this._setSize()._sizeInPercent()._setContainerSize()._resetScroller()},_enableDrag:function(){return this.model.allowDraggable&&this.model.showHeader&&(this._dialogTitlebar.addClass("e-draggable"),this._dragDialog()),this},_enableResize:function(){if(this.model.enableResize){this._ejDialog.addClass("e-resizable");var n=t.buildTag("div.e-icon e-resize-handle");this.model.showFooter?n.appendTo(this._dialogFooterbar):n.appendTo(this._ejDialog);this._resizeDialog()}return this},_changeSkin:function(n){this.model.cssClass!=n&&this._ejDialog.removeClass(this.model.cssClass).addClass(n)},_enableModal:function(n){n?this._isOpen&&this._createOverlay():this._overLay&&this._overLay.remove()},_enabledAction:function(n){n?(this._ejDialog.removeClass("e-disable"),this.wrapper.children(".e-disable-overlay").remove(),t.isNullOrUndefined(this.scroller)||this.scroller.enable()):(this._ejDialog.addClass("e-disable"),t.buildTag("div.e-disable-overlay").appendTo(this.wrapper),t.isNullOrUndefined(this.scroller)||this.scroller.disable())},_renderTitleBar:function(){this._elementTitle=this.element.attr("title");typeof this._elementTitle!="string"&&(this._elementTitle="");this.model.title=this.model.title||this._elementTitle;this._dialogTitlebar=t.buildTag("div#"+this.element.prop("id")+"_title.e-titlebar e-header e-dialog").prependTo(this._ejDialog);this._addTitleText()},_renderFooterBar:function(){this._dialogFooterbar=t.buildTag("div#"+this.element.prop("id")+"_foot.e-footerbar e-dialog e-js").appendTo(this._ejDialog)},_addTitleText:function(){return this.model.title&&(this._titleText=t.buildTag("span.e-title",this.model.title).prependTo(this._dialogTitlebar)),this},_updateCaptionWidth:function(){var n=this.model.faviconCSS&&!t.isNullOrUndefined(this._dialogFavIcon)?this._dialogFavIcon.outerWidth():0;return this._titleText&&this._titleText.css("max-width",this._dialogTitlebar.width()-20-this._dialogTitlebar.find(".e-dialog-icon").width()*this._dialogTitlebar.find(".e-dialog-icon").length-n),this},_iconsRender:function(i){for(var r=0;r0?(this.iframe=this.element.find("iframe.e-iframe"),this.iframe.attr("src",this.model.contentUrl)):(this.iframe=t.buildTag("iframe.e-iframe","",{width:"100%",height:"100%"},{scrolling:"auto",frameborder:0,src:this.model.contentUrl}),this.element.appendTo(this.contentDiv).append(this.iframe).show()),this.model.enableRTL&&n(this.iframe).load(function(){f.iframe.contents().find("body").css("direction","rtl")}),this._trigger("contentLoad",{contentType:i,url:this.model.contentUrl});else if(i=="image"){e=t.buildTag("img.e-images","","",{src:this.model.contentUrl});this.element.append(e).show().appendTo(this.contentDiv);n(e).on("load",function(){f._dialogPosition()});this._trigger("contentLoad",{contentType:i,url:this.model.contentUrl})}else this.element.show().appendTo(this.contentDiv);this._ejDialog.find("div.e-resize-handle").length>0?this._ejDialog.find(".e-footerbar").length==0&&this.contentDiv.insertBefore(this._ejDialog.find("div.e-resize-handle")):(u=this.element.children().find("iframe").contents()[0],t.isNullOrUndefined(u)?this._ejDialog.find(".e-footerbar").length==0?this.contentDiv.appendTo(this._ejDialog):this.contentDiv.insertBefore(this._dialogFooterbar):(this.contentDiv.appendTo(this._ejDialog),r=n("#"+this.contentDiv.find("iframe").attr("id")),n(r[0].contentDocument.lastChild).remove(),r[0].contentDocument.appendChild(u),t.browserInfo().name=="mozilla"&&setTimeout(function(){n(r[0].contentDocument.lastChild).remove();r[0].contentDocument.appendChild(u)},500)));this.model.showFooter&&this._ejDialog.find(".e-footerbar").length==0&&(this._renderFooterBar(),this.model.footerTemplateId!=null&&(o=n("body").find("#"+this.model.footerTemplateId).html(),this._dialogFooterbar.append(o)))},_roundedCorner:function(n){this._ejDialog[n?"addClass":"removeClass"]("e-corner");this.contentDiv.removeClass("e-dialog-top e-dialog-bottom e-dialog-content");this.model.showRoundedCorner&&(this.model.showHeader&&!this.model.showFooter?this.contentDiv.addClass("e-dialog-bottom"):!this.model.showHeader&&this.model.showFooter?this.contentDiv.addClass("e-dialog-top"):!this.model.showHeader&&!this.model.showFooter?this.contentDiv.addClass("e-dialog-content"):!0)},_reRenderScroller:function(){if(this.scroller!=i&&(this.scroller.refresh(!0),!this.model.enableRTL)){if(this.scroller._vScrollbar&&this.scroller._vScrollbar._scrollData&&this.model.enableResize){if(this.model.showFooter)var r=this.scroller._vScrollbar.element.find("> div.e-vscroll").height(),t=0,n=0;else var r=this.scroller._vScrollbar.element.find("> div.e-vscroll").height(),t=2,n=this._ejDialog.find("div.e-resize-handle").outerHeight();Math.floor(this.contentDiv.outerHeight())===Math.floor(this.scroller._vScrollbar.model.height+1)&&(this.scroller._vScrollbar.model.height-=n+t,this.scroller._vScrollbar._scrollData.handle-=n,this.scroller._vScrollbar._scrollData.handleSpace-=n+t,this.scroller._vScrollbar._updateLayout(this.scroller._vScrollbar._scrollData),this.scroller._vScrollbar.element.find("> div.e-vscroll").height(r-n-t))}if(!(this.scroller._vScrollbar&&this.scroller._vScrollbar._scrollData)&&this.scroller._hScrollbar&&this.scroller._hScrollbar._scrollData&&this.model.enableResize){if(this.model.showFooter)var u=this.scroller._hScrollbar.element.find("> div.e-hscroll").width(),t=0,n=0;else var u=this.scroller._hScrollbar.element.find("> div.e-hscroll").width(),t=2,n=this._ejDialog.find("div.e-resize-handle").outerWidth();this.scroller._hScrollbar.model.width-=n+t;this.scroller._hScrollbar._scrollData.handle-=n+t;this.scroller._hScrollbar._scrollData.handleSpace-=n+t;this.scroller._hScrollbar._updateLayout(this.scroller._hScrollbar._scrollData);this.scroller._hScrollbar.element.find("> div.e-hscroll").width(u-n-t)}}},_dialogMaxZindex:function(){var u=this.element.parents(),i,r,t;return i=n("body").children(),index=i.index(this.popup),i.splice(index,1),n(i).each(function(n,t){u.push(t)}),r=n(this.model.target).children(),cindex=r.index(this.popup),r.splice(cindex,1),n(r).each(function(n,t){u.push(t)}),t=Math.max.apply(t,n.map(u,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_setZindex:function(){var n=this._dialogMaxZindex();this.model.zIndex<=n&&this._ejDialog.css({zIndex:n+1})},_createOverlay:function(){var u=this._ejDialog.css("zIndex"),i,r;t.isNullOrUndefined(this._overLay)||this._overLay.remove();this.model.backgroundScroll||n("body").addClass("e-dialog-modal");this._overLay=t.buildTag("div#"+this.element.attr("id")+"_overLay.e-overlay","",{zIndex:u-1});t.isNullOrUndefined(this.model.containment)||t.isNullOrUndefined(this._target)?t.isNullOrUndefined(this.model.target)||(i=this.model.target):i=this._target;this._overLay.appendTo(t.isNullOrUndefined(i)?document.body:i);var r=!t.isNullOrUndefined(this.model.containment)&&!t.isNullOrUndefined(this._target)?"absolute":"fixed",f=t.isNullOrUndefined(i)||r=="fixed"?0:n(i).css("position").toLowerCase()!="static"?0:n(i).offset().left,e=t.isNullOrUndefined(i)||r=="fixed"?0:n(i).css("position").toLowerCase()!="static"?0:n(i).offset().top;this._overLay.css({top:e,left:f,position:r})},_sendAjaxOptions:function(t,i){t.addClass("e-load");var r=this,u=this.model.title,e=i,f={success:function(n){try{r._ajaxSuccessHandler(n,t,i,u)}catch(f){}},error:function(n){try{r._ajaxErrorHandler({status:n.status,responseText:n.responseText,statusText:n.statusText},t,i,u)}catch(n){}},complete:function(){try{r._setContainerSize();r._resetScroller();r.model.showOnInit||r._setHiddenDialogSize()}catch(n){}}};n.extend(!0,f,this.model.ajaxSettings);this._sendAjaxRequest(f)},_setHiddenDialogSize:function(){this._isOpen||(this._ejDialog.css({display:"block",visibility:"hidden"}),this._setContainerSize()._resetScroller(),this._ejDialog.css({display:"none",visibility:""}))},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_ajaxSuccessHandler:function(n,t,i){t.removeClass("e-load");t.html(n).addClass("e-dialog-loaded").appendTo(this._ejDialog);t.appendTo(this.contentDiv);this._dialogPosition();this.model.showOnInit&&this.open();this._trigger("ajaxSuccess",{data:n,url:i})},_ajaxErrorHandler:function(n,t,i){t.addClass("e-dialog-loaded").appendTo(this.contentDiv);this._dialogPosition().open();this._trigger("ajaxError",{data:n,url:i})},_closeIcon:function(){this._dialogClose=t.util.buildTag("div#"+this.element[0].id+"_closebutton.e-dialog-icon e-icon e-close",null,null).attr("tabIndex","0");this.model.closeIconTooltip=="close"&&this.model.tooltip.close=="Close"?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close):this.model.closeIconTooltip!="close"&&this.model.tooltip.close=="Close"?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.closeIconTooltip):this.model.closeIconTooltip=="close"&&this.model.tooltip.close!="Close"?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close):this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close);this._on(this._dialogClose,"touchstart click",this._closeClick)},_collapsibleIcon:function(){this._dialogCollapsible=t.util.buildTag("div#"+this.element[0].id+"_collapsbutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._collapsible?this._dialogCollapsible.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.expand).addClass("e-arrowhead-down").removeClass("e-arrowhead-up"):this._dialogCollapsible.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.collapse).addClass("e-arrowhead-up").removeClass("e-arrowhead-down");this._on(this._dialogCollapsible,"touchstart click",this._collapsibleClick)},_maximizeIcon:function(){this._dialogMaximize=t.util.buildTag("div#"+this.element[0].id+"_maximizebutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._maximize?this._dialogMaximize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.restore).addClass("e-restore").removeClass("e-maximize"):this._dialogMaximize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.maximize).addClass("e-maximize").removeClass("e-restore");this._on(this._dialogMaximize,"touchstart click",this._maximizeClick)},_minimizeIcon:function(){this._dialogMinimize=t.util.buildTag("div#"+this.element[0].id+"_minimizebutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._minimize?this._dialogMinimize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.restore).addClass("e-restore").removeClass("e-minus"):this._dialogMinimize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.minimize).addClass("e-minus").removeClass("e-restore");this._on(this._dialogMinimize,"touchstart click",this._minimizeClick)},_pinIcon:function(){this._dialogPin=t.util.buildTag("div#"+this.element[0].id+"_pinbutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._dialogPin.appendTo(this._dialogTitlebar).attr("title",this.dialogPin?this.model.tooltip.unPin:this.model.tooltip.pin).addClass(this.dialogPin?"e-pin":"e-unpin").removeClass(this.dialogPin?"e-unpin":"e-pin");this._on(this._dialogPin,"touchstart click",this._pinClick)},_favIcon:function(){if(this._dialogFavIcon)n=this._dialogFavIcon.find("span").removeClass().addClass("e-dialog-custom");else{this._dialogFavIcon=t.util.buildTag("div.e-dialog-favicon","",{},{style:"float:"+(this.model.enableRTL?"right":"left")});var n=t.util.buildTag("span.e-dialog-custom","",{},{role:"presentation"});n.appendTo(this._dialogFavIcon);this._dialogFavIcon.appendTo(this._dialogTitlebar)}this.model.faviconCSS?n.addClass(this.model.faviconCSS):this._dialogFavIcon.remove();this._dialogFavIcon.css("float",this.model.enableRTL?"right":"left")},_minMaxValidation:function(){var r=parseInt(this.model.minWidth),u=parseInt(this.model.minHeight),n=parseInt(this.model.maxWidth),t=parseInt(this.model.maxHeight),f=parseInt(this.model.width),e=parseInt(this.model.height),i=this._getParentObj();isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(r=this._convertPercentageToPixel(i.outerWidth(),r));isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(u=this._convertPercentageToPixel(i.outerHeight(),u));isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(n=this._convertPercentageToPixel(i.innerWidth(),n));isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(t=this._convertPercentageToPixel(i.innerHeight(),t));isNaN(this.model.width)&&this.model.width.indexOf("%")>0&&(f=this._convertPercentageToPixel(i.innerWidth(),f));isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&(e=this._convertPercentageToPixel(i.innerHeight(),e));(n&&f>n||r&&fn?n:r);(t&&e>t||u&&et?t:u)},_setSize:function(){var n=this.model;return this._minMaxValidation(),this._ejDialog.css({width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth}),this._ejDialog.css({height:n.height,minHeight:n.minHeight,maxHeight:n.maxHeight}),this._dialogPosition(),this},_resetScroller:function(){this.element.css({height:"auto","max-width":"","max-height":"",width:""});var r=this._ejDialog.outerHeight(!0)-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0)-(this.model.showFooter?n(this._ejDialog.find("div.e-footerbar")).outerHeight(!0):0),u,i={width:this.contentDiv.css("border-width")=="0px"||this.contentDiv.css("border-left-width")=="0px"?this._ejDialog.width():Math.round(this._ejDialog.width()-2),enableRTL:this.model.enableRTL,height:this.contentDiv.css("border-width")=="0px"?r:r-1,enableTouchScroll:!1};this.model.height=="auto"&&(this.element.height()0&&(u=t.isNullOrUndefined(this.scroller)?this.contentDiv.outerHeight()-this._padding:!this.scroller._hScrollbar&&this.scroller._vScrollbar?this.contentDiv.outerHeight():this.scroller._hScrollbar?this.contentDiv.outerHeight()-this.scroller.model.buttonSize:this.contentDiv.outerHeight(),this.model.height!="auto"&&this.model.height!="100%"?this.element.css({height:u}):this.element.css("height",this.model.height),this.model.height!="auto"&&this.model.height!="100%"||this.scroller._vScrollbar||this.element.css({"min-height":this.model.minHeight-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0)}),this.scroller._vScrollbar||this.model.width=="auto"||this.model.width=="100%"?this.scroller._vScrollbar||this.element.css("width",this.model.width):this.element.outerWidth(this.contentDiv.css("border-width")=="0px"||this.contentDiv.css("border-left-width")=="0px"?this._ejDialog.width():this._ejDialog.width()-2),this.element.css({"max-width":this.model.maxWidth,"max-height":this.model.maxHeight}));this.hidden&&this._ejDialog.css({display:"none"});this.hidden=!1},_updateScroller:function(n,t){this.contentDiv.ejScroller({width:t,height:n,enableRTL:this.model.enableRTL,enableTouchScroll:!1});this.scroller=this.contentDiv.data("ejScroller");this._reRenderScroller();this._changeSize()},_dragDialog:function(){var i=this,r=this._ejDialog.parents(".e-dialog-scroller");return this._dialogTitlebar.ejDraggable({handle:".e-titlebar",cursorAt:{top:0,left:0},dragArea:i._target,dragStart:function(n){return(n.element.attr("aria-grabbed",!0),i._clickHandler(),i.dialogPin||!i.model.allowDraggable||!i.model.enabled)?(n.cancel=!0,!1):i._trigger("dragStart",{event:n})?(n.cancel=!0,!1):void 0},drag:function(n){i._trigger("drag",{event:n})},dragStop:function(r){i._ejDialog.focus();r.element.attr("aria-grabbed",!1);i.element.find("> .e-draggable.e-titlebar")&&(dragobject=n("#"+i.element.find("> .e-draggable.e-titlebar").attr("id")).data("ejDraggable"),dragobject&&dragobject.option("cursorAt",i.element.offset()));var u=this.helper.offsetParent().offset();i._trigger("dragStop",{event:r});i.model.position.X=t.isNullOrUndefined(this.position.left)?parseInt(this.helper.css("left")):this.position.left-[u.left+parseFloat(this.helper.offsetParent().css("border-left-width"))];i.model.position.Y=t.isNullOrUndefined(this.position.top)?parseInt(this.helper.css("top")):this.position.top-[u.top+parseFloat(this.helper.offsetParent().css("border-top-width"))];i._positionChanged=!0},helper:function(){return n(i._ejDialog).addClass("dragClone")}}),this},_resizeDialog:function(){if(this.model.enableResize){var t=this,r=!1,i,u=parseInt(this.model.minWidth),f=parseInt(this.model.minHeight),e=parseInt(this.model.maxWidth),o=parseInt(this.model.maxHeight);return i=this._getParentObj(),isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(u=this._convertPercentageToPixel(i.outerWidth(),u)),isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(f=this._convertPercentageToPixel(i.outerHeight(),f)),isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(e=this._convertPercentageToPixel(i.innerWidth(),e)),isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(o=this._convertPercentageToPixel(i.innerHeight(),o)),this._ejDialog.find("div.e-resize-handle").ejResizable({minHeight:f,minWidth:u,maxHeight:o,maxWidth:e,handle:"e-widget-content",resizeStart:function(n){if(t.dlgresized=!0,!t.model.enabled)return!1;r||t._trigger("resizeStart",{event:n});r=!0;t.model.position={X:t._ejDialog.css("left"),Y:t._ejDialog.css("top")};t._dialogPosition()},resize:function(i){t.dlgresized=!0;var r=n(i.element).parents("div.e-dialog-wrap");t.model.height=n(r).outerHeight();t.model.width=n(r).outerWidth();t._setSize();t._setContainerSize();t._resetScroller();t._updateCaptionWidth();t._trigger("resize",{event:i});t._sizeType={width:"px",height:"px"};scrObj=t._ejDialog.closest(".e-dialog.e-js").data("ejDialog");scrObj&&scrObj._resetScroller()},resizeStop:function(i){t.dlgresized=!0;t._ejDialog.focus();t._sizeInPercent();var u=n(i.element).parents("div.e-dialog-wrap");t.model.height=n(u).outerHeight();t.model.width=n(u).outerWidth();t._setSize();t._setContainerSize();t._resetScroller();r&&t._trigger("resizeStop",{event:i});r=!1;t._setDimension();t.dlgresized=!1},helper:function(){return n(t._ejDialog)}}),this}},_dialogPosition:function(){if(this._ejDialog.parents("form").length>0&&t.isNullOrUndefined(this.model.containment)&&t.isNullOrUndefined(this.model.target)&&this._ejDialog.appendTo(this._ejDialog.parents("form")),this.model.position.X!=""||this.model.position.Y!="")if(this._ejDialog.css("position","absolute"),t.isNullOrUndefined(this.model.target)&&t.isNullOrUndefined(this.model.containment))this._ejDialog.css("left",this.model.position.X),this._ejDialog.css("top",this.model.position.Y);else{var i=t.isNullOrUndefined(this.model.containment)?this.model.target:this.model.containment;this.dlgresized||this._keyNavigation?(this._ejDialog.css("left",this.model.position.X),this._ejDialog.css("top",this.model.position.Y)):(this._ejDialog.css("left",n(i).offset().left+parseInt(this.model.position.X)),this._ejDialog.css("top",n(i).offset().top+parseInt(this.model.position.Y)))}else this._centerPosition();return this},_centerPosition:function(){var r=0,u=0,i,f,e,o;t.isNullOrUndefined(this.model.target)&&(t.isNullOrUndefined(this._target)||n(this._target).is(n(document))||n(this._target).is(n(window)))?(o=document.documentElement,r=(n(window).outerWidth()>this._ejDialog.width()?(n(window).outerWidth()-this._ejDialog.outerWidth())/2:0)+(window.pageXOffset||o.scrollLeft),u=(n(window).outerHeight()>this._ejDialog.height()?(n(window).outerHeight()-this._ejDialog.outerHeight())/2:0)+(window.pageYOffset||o.scrollTop)):(i=t.isNullOrUndefined(this._target)?n(this.model.target):n(this._target),i.css("position")=="static"&&(f=i.offsetParent().offset(),e=i.offset(),r=e.left-f.left,u=e.top-f.top),i.outerWidth()>this._ejDialog.width()&&(r+=(i.outerWidth()-this._ejDialog.width())/2),i.outerHeight()>this._ejDialog.height()&&(u+=(i.outerHeight()-this._ejDialog.height())/2));this._ejDialog.css({top:u,left:r});this._ejDialog.css("position","absolute")},_closeClick:function(n){this.model.enabled&&(n.stopPropagation(),this.close(n))},_collapsibleClick:function(t){this.model.enabled&&(n(t.target).hasClass("e-arrowhead-up")?this._actionCollapse(t):n(t.target).hasClass("e-arrowhead-down")&&this._actionExpand(t))},_actionCollapse:function(n){this._minimize||(this._dialogCollapsible&&this._dialogCollapsible.removeClass("e-arrowhead-up").addClass("e-arrowhead-down"),this._dialogCollapsible&&this._dialogCollapsible.attr("title",this.model.tooltip.expand),this._ejDialog.find("div.e-resize-handle").hide(),this._ejDialog.find(".e-widget-content").parent().slideUp("fast"),this.model.showFooter&&this._dialogFooterbar.slideUp("fast"),this._ejDialog.removeClass("e-shadow"),this._ejDialog.css("minHeight","0"),this._ejDialog.height("auto"),this._trigger("collapse",{isInteraction:n?!0:!1}),this._collapsible=!0)},_actionExpand:function(n){this._minimize||(this._dialogCollapsible&&this._dialogCollapsible.removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogCollapsible&&this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._ejDialog.addClass("e-shadow"),this._ejDialog.find(".e-widget-content").parent().slideDown("fast"),this.model.showFooter&&this._dialogFooterbar.slideDown("fast"),this._maximize?(this._ejDialog.css({width:"100%",height:"100%"}),this.element.css({width:"100%",height:"100%"}),this.contentDiv.css({width:"100%",height:"100%"})):this._ejDialog.height(this.model.height),this._ejDialog.find("div.e-resize-handle").show(),this._trigger("expand",{isInteraction:n?!0:!1}),this._collapsible=!1)},_maximizeClick:function(i){if(this.model.enabled){var r=n(i.target),u=this._dialogMaximize;r.hasClass("e-maximize")?(this._actionMaximize(),this._dialogTitlebar&&(this._dialogTitlebar.find(".e-restore").removeClass("e-restore").addClass("e-minus"),this._dialogMinimize&&this._dialogMinimize.attr("title",this.model.tooltip.minimize)),r.removeClass("e-maximize").addClass("e-restore"),this._dialogMaximize.attr("title",this.model.tooltip.restore),this._hideIcon(!0)):r.hasClass("e-restore")&&(this._actionRestore(),r.removeClass("e-restore").addClass("e-maximize"),this._dialogMaximize.attr("title",this.model.tooltip.maximize),!t.isNullOrUndefined(u)&&n(u).hasClass("e-arrowhead-down")&&(n(u).removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogMaximize.attr("title",this.model.tooltip.collapse)),this._hideIcon(!0))}this._resetScroller()},_actionMaximize:function(){this._ejDialog.css("top","0px").css("left","0px").css("overflow","hidden").css("position",this.model.containment?"absolute":this.model.target?"absolute":"fixed");this._ejDialog.css({width:"100%",height:"100%"});this.element.css({width:"100%",height:"100%"});this.contentDiv.css({width:"100%",height:"100%"});this._maximize=!0;this._minimize=!1;var n=this;this._dialogCollapsible&&!t.isNullOrUndefined(this._dialogCollapsible.hasClass("e-arrowhead-down"))&&(this._dialogCollapsible.removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._collapseValue=!0);this._collapseValue==!0&&this._ejDialog.find(".e-widget-content").parent().slideDown("fast",function(){n.refresh();n._reRenderScroller()});this._resetScroller()},_actionRestore:function(){this.element.height("").width("");this.contentDiv.height("").width("");this._restoreDialog();this._maximize=this._minimize=!1},_minimizeClick:function(i){if(this.model.enabled){var r=n(i.target),u=this._dialogMinimize.hasClass("e-icon")&&this._dialogMinimize;r.hasClass("e-minus")?(this._maximize&&this._setSize(),this._actionMinimize()):r.hasClass("e-restore")&&(this._actionRestore(),r.removeClass("e-restore").addClass("e-minus"),this._dialogMinimize.attr("title",this.model.tooltip.minimize),!t.isNullOrUndefined(u)&&n(u).hasClass("e-arrowhead-down")&&(n(u).removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogMinimize.attr("title",this.model.tooltip.collapse)),this._hideIcon(!0))}},_actionMinimize:function(){var i=n(window).height()-this._ejDialog.height()+this.element.height()+14,t;this._ejDialog.css("top","").css("bottom","0").css("left","0").css("position",this.model.containment?"absolute":this.model.target?"absolute":"fixed");this._ejDialog.css("minHeight","0");this._dialogTitlebar?(this._dialogTitlebar.find(".e-restore").removeClass("e-restore").addClass("e-maximize"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this._dialogTitlebar.find(".e-minus").removeClass("e-minus").addClass("e-restore"),this._dialogMinimize&&this._dialogMinimize.attr("title",this.model.tooltip.restore),this._isOpen?t=this._dialogTitlebar.outerHeight():(this._ejDialog.css({display:"block",visibility:"hidden"}),t=this._dialogTitlebar.outerHeight(),this._ejDialog.css({display:"none",visibility:""})),this._ejDialog.css("height",t+2),this._hideIcon(!1)):this._ejDialog.css("height","");this.contentDiv.hide();this.model.showFooter&&this._dialogFooterbar.hide();this._maximize=!1;this._minimize=!0},_hideIcon:function(i){var r=this._dialogCollapsible?this._dialogCollapsible:null;i?(t.isNullOrUndefined(r)||n(r).parent(".e-dialog-icon").show(),this._ejDialog.find("div.e-resize-handle").show()):(t.isNullOrUndefined(r)||n(r).parent(".e-dialog-icon").hide(),this._ejDialog.find("div.e-resize-handle").hide())},_pinClick:function(t){if(this.model.enabled){var i=n(t.target);i.hasClass("e-unpin")?(this.dialogPin=!0,i.removeClass("e-unpin").addClass("e-pin"),this._dialogPin.attr("title",this.model.tooltip.unPin)):i.hasClass("e-pin")&&(this.dialogPin=!1,i.removeClass("e-pin").addClass("e-unpin"),this._dialogPin.attr("title",this.model.tooltip.pin))}},_restoreDialog:function(){this.contentDiv.show();this.model.showFooter&&this._dialogFooterbar.show();this._ejDialog.css({position:"absolute",bottom:""}).addClass("e-shadow");this._setSize()._resetScroller();this._dialogTitlebar&&(this._dialogTitlebar.find(".e-minus").parent().show(),this._dialogCollapsible&&(this._dialogCollapsible.removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogCollapsible.attr("title",this.model.tooltip.collapse)))},_clickHandler:function(){var n=this._dialogMaxZindex();parseInt(this._ejDialog.css("zIndex"))-1&&this.model.allowDraggable&&!this.dialogPin&&(this._keyPressed(code,t.ctrlKey),t.preventDefault());this.model.closeOnEscape&&code===27&&this.model.enabled&&(this.element.find(".e-js.e-dialog").first().is(":visible")||(this.close(t),t.preventDefault()));code===13&&this.model.enabled&&(n(t.target).hasClass("e-close")?this.close(t):(n(t.target).hasClass("e-arrowhead-up")||n(t.target).hasClass("e-arrowhead-down"))&&this._collapsibleClick(t),n(t.target).hasClass("e-maximize")||n(t.target).hasClass("e-restore")&&n(t.target).is(this._dialogMaximize)?this._maximizeClick(t):(n(t.target).hasClass("e-minus")||n(t.target).hasClass("e-restore")&&n(t.target).is(this._dialogMinimize))&&this._minimizeClick(t),(n(t.target).hasClass("e-pin")||n(t.target).hasClass("e-unpin"))&&this._pinClick(t));code==9&&this.model.enableModal&&this._focusOnTab(t)},_focusOnTab:function(t){var i=this._ejDialog.find("a, button, :input, select, [tabindex]:not('-1')");i=n(i).find("a, button, :input, select, [tabindex]:not('')");t.shiftKey?i[i.index(t.target)-1]||(t.preventDefault(),i.last().focus()):i[i.index(t.target)+1]||(t.preventDefault(),i[0].focus())},_keyPressed:function(n,t){this._keyNavigation=!0;switch(n){case 40:t?this._resizing("height",this._ejDialog.outerHeight()+3):this.option("position",{X:this._ejDialog.position().left,Y:this._ejDialog.position().top+3});break;case 39:t?this._resizing("width",this._ejDialog.outerWidth()+3):this.option("position",{X:this._ejDialog.position().left+3,Y:this._ejDialog.position().top});break;case 38:t?this._resizing("height",this._ejDialog.outerHeight()-3):this.option("position",{X:this._ejDialog.position().left==0?0:this._ejDialog.position().left,Y:this._ejDialog.position().top>3?this._ejDialog.position().top-3:0});break;case 37:t?this._resizing("width",this._ejDialog.outerWidth()-3):this.option("position",{X:this._ejDialog.position().left>3?this._ejDialog.position().left-3:0,Y:this._ejDialog.position().top==0?0:this._ejDialog.position().top})}},_resizing:function(n,t){this.model.enableResize&&this.option(n,t)},_sizeInPercent:function(){if(!this._enableWindowResize())return this;var n=this._getParentObj();return this._widthPercent=this._sizeType.width=="%"?parseFloat(this.model.width):this._convertPixelToPercentage(n.outerWidth(),this._ejDialog.outerWidth()),this._heightPercent=this._sizeType.height=="%"?parseFloat(this.model.height):this._convertPixelToPercentage(n.outerHeight(),this._ejDialog.outerHeight()),this._widthPercent>=100&&(this._widthPercent=100,this._ejDialog.outerWidth(n.outerWidth()),this.model.width=this._ejDialog.width()),this._heightPercent>=100&&(this._heightPercent=100,this._ejDialog.outerHeight(n.outerHeight()),this.model.height=this._ejDialog.height()),this},_getParentObj:function(){return t.isNullOrUndefined(this.model.containment)?t.isNullOrUndefined(this.model.target)?n(document):n(this.model.target):n(this.model.containment)},_convertPercentageToPixel:function(n,t){return Math.round(t*n/100)},_convertPixelToPercentage:function(n,t){return Math.round(t/n*100)},_reSizeHandler:function(){var t;if(this._maximize){this._resetScroller();return}this.model.position.X!=""&&(this.model.position.Y!=""||this._minimize)||this._centerPosition();t=this._getParentObj();this._change=!1;this._windowSize.outerWidth!=n(window).outerWidth()?this._sizeType.width=="%"?this._percentageWidthDimension(t):this._pixelsWidthDimension(t):this._windowSize.outerHeight!=n(window).outerHeight()&&(this._sizeType.height=="%"?this._percentageHeightDimension(t):this._pixelsHeightDimension(t));this._change&&this._resizeContainer(t);this._windowSize={outerWidth:n(window).outerWidth(),outerHeight:n(window).outerHeight()};this._centerPosition()},_setDimension:function(){t.isNullOrUndefined(this.model.maxWidth)?t.isNullOrUndefined(this._sizeType.width)?this._maxWidth=+this.model.width:(this._sizeType.width=="px"||this._sizeType.width=="auto")&&(this._maxWidth=this.model.width):this._maxWidth=this.model.maxWidth;t.isNullOrUndefined(this.model.maxHeight)?t.isNullOrUndefined(this._sizeType.height)?this._maxHeight=+this.model.height:(this._sizeType.height=="px"||this._sizeType.height=="auto")&&(this._maxHeight=this.model.height):this._maxHeight=this.model.maxHeight},_percentageWidthDimension:function(n){this._ejDialog.outerWidth(this._convertPercentageToPixel(n.outerWidth(),this._widthPercent));this._change=!0},_percentageHeightDimension:function(n){this._ejDialog.outerHeight(this._convertPercentageToPixel(n.outerHeight(),this._heightPercent));this._change=!0},_pixelsWidthDimension:function(t){n(t).outerWidth()<=this._ejDialog.outerWidth()&&this._setWidth(t);n(t).outerHeight()<=this._ejDialog.outerHeight()&&!this.model.isResponsive&&this._setHeight(t);parseInt(this._ejDialog.css("width"))0&&isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&this.model.height!="auto"?!0:!1},_wireResizing:function(){n(window)[this._enableWindowResize()?"on":"off"]("resize",n.proxy(this._reSizeHandler,this))},_wireEvents:function(){this._on(this._ejDialog,"keydown",this._keyDown);this._on(this._ejDialog,"click",this._mouseClick);this._wireResizing()},refresh:function(){this._resetScroller()},open:function(){var i,r,u,f;return this._isOpen?!0:!0==this._trigger("beforeOpen")?!1:(this.element.css("display","block"),this._setZindex(),this._minimize||this._maximize||this._init||this._dialogPosition(),i=this,r={},this._ejDialog.show(),this.model.enableAnimation&&(this._ejDialog.css({opacity:0}),this.model.animation.show.effect=="slide"?(f=this._ejDialog.css("left"),this._ejDialog.css({left:-this._ejDialog.width()}),r={left:f,opacity:1}):r={opacity:1}),this._ejDialog.animate(r,this.model.enableAnimation?Number(this.model.animation.show.duration):0,function(){i.model&&(i._ejDialog.css("display")=="none"&&i._ejDialog.show(),i._ejDialog.eq(0).focus(),i._ejDialog.css({opacity:""}),i.contentDiv.find("a:visible:enabled, button:visible:enabled, :input:visible:enabled, select:visible:enabled, .e-input").first().focus(),i._trigger("open"),i._updateCaptionWidth(),i.model.enableModal&&!i.model.backgroundScroll&&(i._ejDialog.height()>n(window).height()&&i._ejDialog.css("height",n(window).height()),i.model.height=n(window).height(),i._overLay.css("position","fixed"),i.scroller.refresh(!0),i.refresh()),(i.model.maxHeight||i.model.maxWidth)&&(u=i._ejDialog.outerHeight(!0)-(i._dialogTitlebar?i._dialogTitlebar.outerHeight(!0):0),(i.model.height=="auto"||i.model.height=="100%")&&(u=i.model.height),i._updateScroller(t.isNullOrUndefined(this.contentDiv)?u-2:this.contentDiv.css("border-width")=="0px",t.isNullOrUndefined(this.contentDiv)?i._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px")))}),this.model.enableModal==!0&&this._createOverlay(),this._isOpen=!0,this.element.find("> .e-draggable.e-titlebar")&&(dragobject=n("#"+this.element.find("> .e-draggable.e-titlebar").attr("id")).data("ejDraggable"),dragobject&&dragobject.option("cursorAt",this.element.offset())),this)},close:function(t){var i,r,u;return!this._isOpen||!this.model.enabled?!0:(i=t?!0:!1,!0==this._trigger("beforeClose",{event:t,isInteraction:i}))?!1:(this._isOpen=!1,r=this,u={},this.model.enableAnimation&&(u=this.model.animation.hide.effect=="slide"?{left:-this._ejDialog.width(),opacity:0}:{opacity:0}),this._ejDialog.animate(u,this.model.enableAnimation?Number(this.model.animation.hide.duration):0,function(){r._trigger("close",{event:t,isInteraction:i});r._ejDialog.hide()}),this.model.enableModal&&(this._overLay&&this._overLay.remove(),this.model.backgroundScroll||n("body").removeClass("e-dialog-modal")),this)},isOpened:function(){return this.isOpen()},isOpen:function(){return this._isOpen},setTitle:function(n){return this.model.title=n,this._titleText.text(n),this._updateCaptionWidth(),this},setContent:function(n){return this.model.enabled?(this.element.html(n),this._resetScroller(),this):!1},focus:function(){return this._setZindex(),this.element.focus(),this},minimize:function(){if(this.model.showHeader)return this._actionMinimize(),n(this.wrapper.find(".e-minus")[0]).parent().hide(),this},maximize:function(){if(this.model.showHeader)return this._actionMaximize(),n(this.wrapper.find(".e-maximize")[0]).removeClass("e-maximize").addClass("e-restore"),n(this.wrapper.find(".e-restore")[1]).removeClass("e-restore").addClass("e-minus"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.restore),this.contentDiv.show(),this._dialogTitlebar&&this._dialogTitlebar.find(".e-minus").parent().show(),this._hideIcon(!0),this},restore:function(){if(this.model.showHeader){var t=this._minimize;return this._actionRestore(),n(this.wrapper.find(".e-restore")[0]).removeClass("e-restore").addClass(t?"e-minus":"e-maximize"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this._hideIcon(!0),this}},pin:function(){if(this.model.showHeader)return this.dialogPin=!0,n(this.wrapper.find(".e-unpin")[0]).removeClass("e-unpin").addClass("e-pin"),this._dialogPin&&this._dialogPin.attr("title",this.model.tooltip.unPin),this},unpin:function(){if(this.model.showHeader)return this.dialogPin=!1,n(this.wrapper.find(".e-pin")[0]).removeClass("e-pin").addClass("e-unpin"),this._dialogPin&&this._dialogPin.attr("title",this.model.tooltip.pin),this},collapse:function(){if(this.model.showHeader)return this._actionCollapse(),this._collapseValue=!0,this},expand:function(){if(this.model.showHeader)return this._actionExpand(),this}});t.Dialog.Locale=t.Dialog.Locale||{};t.Dialog.Locale["default"]=t.Dialog.Locale["en-US"]={tooltip:{close:"Close",collapse:"Collapse",restore:"Restore",maximize:"Maximize",minimize:"Minimize",expand:"Expand",unPin:"UnPin",pin:"Pin"},title:"",closeIconTooltip:"close"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejDropDownList","ej.DropDownList",{element:null,model:null,validTags:["select","input"],_addToPersist:["value","text","selectedIndex","selectedItemIndex","selectedItems","selectedIndices","popupWidth","popupHeight","itemValue"],_setFirst:!1,_rootCSS:"e-dropdownlist",angular:{require:["?ngModel","^?form","^?ngModelOptions"]},_requiresID:!0,defaults:{cssClass:"",value:null,htmlAttributes:{},text:null,itemValue:"",itemsCount:0,dataSource:null,delimiterChar:",",query:null,fields:{id:null,text:null,value:null,category:null,groupBy:null,imageUrl:null,imageAttributes:null,spriteCssClass:null,htmlAttributes:null,selected:null,tableName:null},locale:"en-US",watermarkText:null,height:"",width:"",popupHeight:"152px",popupWidth:"auto",maxPopupHeight:null,minPopupHeight:"20",maxPopupWidth:null,minPopupWidth:"0",targetID:null,template:null,headerTemplate:null,selectedItemIndex:-1,selectedIndex:-1,disableItemsByIndex:null,enableItemsByIndex:null,selectedItems:[],selectedIndices:[],cascadeTo:null,enablePopupResize:!1,allowVirtualScrolling:!1,virtualScrollMode:"normal",showRoundedCorner:!1,showPopupOnLoad:!1,enableRTL:!1,enabled:!0,filterType:"contains",sortOrder:"ascending",caseSensitiveSearch:!1,showCheckbox:!1,checkAll:!1,uncheckAll:!1,enablePersistence:!1,enableFilterSearch:!1,enableIncrementalSearch:!0,readOnly:!1,enableAnimation:!1,multiSelectMode:"none",allowGrouping:!1,enableSorting:!1,validationRules:null,validationMessage:null,actionBegin:null,actionComplete:null,actionFailure:null,actionSuccess:null,create:null,popupHide:null,popupShown:null,beforePopupShown:null,beforePopupHide:null,popupResizeStart:null,popupResize:null,popupResizeStop:null,change:null,select:null,dataBound:null,search:null,checkChange:null,cascade:null,destroy:null},dataTypes:{cssClass:"string",itemsCount:"number",watermarkText:"string",template:"string",disableItemsByIndex:"string",enableItemsByIndex:"string",enableIncrementalSearch:"boolean",cascadeTo:"string",delimiterChar:"string",showRoundedCorner:"boolean",showPopupOnLoad:"boolean",enableRTL:"boolean",enablePersistence:"boolean",allowVirtualScrolling:"boolean",virtualScrollMode:"enum",enabled:"boolean",readOnly:"boolean",multiSelectMode:"enum",dataSource:"data",query:"data",fields:"data",selectedItems:"array",enableAnimation:"boolean",allowGrouping:"boolean",enableSorting:"boolean",validationRules:"data",validationMessage:"data",htmlAttributes:"data",locale:"string"},observables:["value","selectedItemIndex","selectedIndex"],value:t.util.valueFunction("value"),selectedItemIndex:t.util.valueFunction("selectedItemIndex"),selectedIndex:t.util.valueFunction("selectedIndex"),enable:function(){if(this._visibleInput.hasClass("e-disable")){this.target.disabled=!1;this.model.enabled=!0;this.container.removeClass("e-disable");this._visibleInput.removeClass("e-disable");this.dropdownbutton.removeClass("e-disable");this.popupListWrapper.removeClass("e-disable");this._isIE8&&this.drpbtnspan.removeClass("e-disable");this.container.on("mousedown",n.proxy(this._OnDropdownClick,this));this.model.multiSelectMode=="visualmode"&&this._ulBox.removeClass("e-disable");this.wrapper.attr("tabindex","0")}this._wireEvents()},disable:function(){this._visibleInput.hasClass("e-disable")||(this.target.disabled=!0,this.model.enabled=!1,this.container.addClass("e-disable"),this._visibleInput.addClass("e-disable"),this.popupListWrapper.addClass("e-disable"),this.dropdownbutton.addClass("e-disable"),this._isIE8&&this.drpbtnspan.addClass("e-disable"),this.model.multiSelectMode=="visualmode"&&this._ulBox.addClass("e-disable"),this.container.off("mousedown",n.proxy(this._OnDropdownClick,this)),this._unwireEvents(),this.wrapper.removeAttr("tabindex"),this._isPopupShown()&&this._hideResult())},getValue:function(){return this._visibleInput.val()},_setValue:function(n){t.isNullOrUndefined(n)||(this._raiseEvents=!1,t.isNullOrUndefined(this.model.text)||this.unselectItemByText(this.model.text),this._raiseEvents=!0,this.selectItemByValue(n))},_setText:function(n){n&&(this._raiseEvents=!1,this.unselectItemByText(this.model.text),this._raiseEvents=!0,this.selectItemByText(n))},_setItemValue:function(n){this.model.itemValue=n},_changeWatermark:function(n){if(!this.model.enabled)return!1;this._isWatermark?this._visibleInput.attr("placeholder",n):this._hiddenSpan.text(n)},hidePopup:function(){if(!this.model.enabled)return!1;this.ultag.find("li").length>0&&this._hideResult()},showPopup:function(){if(!this.model.enabled)return!1;this.ultag.find("li").length>0&&this._showResult()},clearText:function(){this._clearTextboxValue();this._isWatermark||this._setWatermark()},addItem:function(t){var r,i,u,e,f,o;if(!this.model.enabled||!t||(this._mapFields(),r=n.isArray(t)?t:[t],r.length<1))return!1;for(i=this.mapFld,u={_id:null,_imageUrl:null,_imageAttributes:null,_spriteCSS:null,_text:null,_value:null,_htmlAttributes:null,_selected:null,_category:null},u._id=r[0][i._id]?i._id:"id",u._imageUrl=r[0][i._imageUrl]?i._imageUrl:"imageUrl",u._imageAttributes=r[0][i._imageAttributes]?i._imageAttributes:"imageAttributes",u._spriteCSS=r[0][i._spriteCSS]?i._spriteCSS:"spriteCssClass",u._text=r[0][i._text]?i._text:"text",u._value=r[0][i._value]?i._value:"value",u._htmlAttributes=r[0][i._htmlAttributes]?i._htmlAttributes:"htmlAttributes",u._selected=r[0][i._selected]?i._selected:"selected",u._category=r[0][i._category]?i._category:"groupBy",this._generateLi(r,u),e=this.dummyUl,f=0;f0)this._clearTextboxValue(),this._trigger("change",{text:this._visibleInput[0].value,selectedText:"",selectedValue:"",value:""});else for(f=this._toArray(t,!0),u=0;u=0){if(n.inArray(i,this._selectedIndices)==-1)for(r=0;r0&&(this._clearTextboxValue(),this._trigger("change",{text:this._visibleInput[0].value,selectedText:"",selectedValue:"",value:""}))},unselectItemsByIndices:function(n){this._unselectItemByIndex(n)},unselectItemByIndex:function(n){this._unselectItemByIndex(n)},_unselectItemByIndex:function(t){var i,u,f,r;for(this._selectedIndices=n.map(this._selectedIndices,function(n){return parseInt(n)}),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices,u=this._toArray(t,!0),this.listitems=this._getLi(),r=0;r0&&!(n.inArray(parseInt(i[r]),this._disabledItems)>-1)&&(index=n.inArray(i[r],this._disabledItems),this._setClass(this._getLi()[parseInt(i[r])],"e-disable"),this._disabledItems.push(parseInt(i[r])),this.model.disableItemsByIndex=String(this._disabledItems.join(",")))},enableItemsByIndices:function(n){this._enableItemByIndex(n)},enableItemByIndex:function(n){this._enableItemByIndex(n)},_enableItemByIndex:function(t){var r=this._toArray(t,!1),u,i;for(this.model.enableItemsByIndex=t,i=0;i0&&n.inArray(parseInt(r[i]),this._disabledItems)>-1&&!isNaN(parseInt(r[i]))&&(u=n.inArray(parseInt(r[i]),this._disabledItems),this._removeClass(this._getLi()[parseInt(r[i])],"e-disable"),this._disabledItems.splice(u,1));this.model.enableItemsByIndex=null;this.model.disableItemsByIndex=this._disabledItems.join(this.model.delimiterChar)},_validateDelimiter:function(n){if(this._trim(n).length==1)if(!/^[a-zA-Z0-9]+$/.test(n))return n;return","},_removeText:function(t){var i=this.element[0].value.split(this.model.delimiterChar),u=this._visibleInput[0].value.split(this.model.delimiterChar),r=n.inArray(t,i);r>=0&&(i.splice(r,1),u.splice(r,1));this.element[0].value=i.join(this.model.delimiterChar);this._visibleInput[0].value=u.join(this.model.delimiterChar)},_addText:function(n){var i,r,t,u;if(this._checkContains(this._hiddenValue))return!1;for(i=["element","_visibleInput"],t=0;t0&&this._selectCheckedItem(this._selectedIndices);this.model.disableItemsByIndex!=null&&this._disableItemByIndex(this.model.disableItemsByIndex);this.model.enableItemsByIndex!=null&&this._enableItemByIndex(this.model.enableItemsByIndex)},_initialize:function(){this._selectedIndices=this.model.selectedIndices.length>0?this.model.selectedIndices:this.model.selectedItems;this.model.selectedItems=this.model.selectedIndices=this._selectedIndices;this.model.selectedIndex=this.model.selectedIndex!=-1?this.model.selectedIndex:this.model.selectedItemIndex;this.element.is("select")&&(this.selectelement=!0,this._renderSelectToDropdown());this._selectedItemsID=[];this.target=this.element[0];this._disabledItems=[];this._queryString=null;this.suggLen=0;this._itemId=null;this.checkedStatus=!1;this._incqueryString="";this._activeItem=null;this.ddWidth=0;this._initValue=!0;this._virtualCount=0;this._raiseEvents=!0},_renderSelectToDropdown:function(){var i,f,u,r;if(this.inputElement=t.buildTag("input.e-dropdownlist#"+this._id+"_input","",{},{type:"text","data-role":"none"}),this.inputElement.insertAfter(this.element),this.element.attr("name")&&(this.inputElement.attr("name",this.element.attr("name")),this.element.removeAttr("name")),this.selectOptions=this.element,this.selectOptions.attr("id",this._id),this.model.dataSource==null){for(this.optionDiv=t.buildTag("div#"+this._id+"_list"),this.optionDiv.insertAfter(this.inputElement),this.optionUl=t.buildTag("ul"),this.optionDiv.append(this.optionUl),this.selectOptionItems=this.element.children("option"),f=this.selectOptionItems.length,this.optionDummyUl=n(),i=0;i0&&(r=this,r._finalize()):this._finalize();t.DataManager&&this.model.dataSource instanceof t.DataManager||this._finalize();this._setCheckAll(this.model.checkAll);(this.element.attr("disabled")||n(this.selectOptions).attr("disabled"))&&this.disable()},_isEqualDataSource:function(n){var i,t,r;if(!this.model.dataSource||!n||!(this.model.dataSource.length===n.length))return!1;for(i=!0,t=0,r=this.model.dataSource.length;t0&&u.select(f)}return this.model.allowVirtualScrolling&&u.requiresCount(),this.model.itemsCount>0&&u.take(this.model.itemsCount),i=this.model.dataSource.dataSource,r&&(i&&i.url&&!i.url.match(r.tableName+"$")||i&&!i.url||!i)&&(t.isNullOrUndefined(r.tableName)||u.from(r.tableName)),u},_addLoadingClass:function(){this._isPopupShown()?this.popupListWrapper.addClass("e-load"):(this.dropdownbutton.addClass("e-load"),this.drpbtnspan.removeClass("e-icon e-arrow-sans-down"));this._readOnly=!0},_removeLoadingClass:function(){this.dropdownbutton.removeClass("e-load");this.drpbtnspan.addClass("e-icon e-arrow-sans-down");this._readOnly=!1;this.popupListWrapper.removeClass("e-load")},_renderDropdown:function(){if(this.wrapper=t.buildTag("span.e-ddl e-widget "+this.model.cssClass+"#"+this._id+"_wrapper","",{},{tabindex:"0",accesskey:this.element.attr("accesskey")}),this.container=t.buildTag("span.e-in-wrap e-box #"+this._id+"_container"),this.element.removeAttr("accesskey"),this.model.value==null&&this.element.attr("value")!=null&&(this.model.value=this.element.attr("value")),this.element.attr("value","").val(""),this._isIE8?this._setAttr(this.element[0],{role:"combobox","aria-expanded":!1,"aria-autocomplete":"list","aria-haspopup":!0,"aria-owns":this._id+"_popup"}).element.hide():this._setAttr(this.element[0],{type:"hidden",role:"combobox","aria-expanded":!1,"aria-autocomplete":"list","aria-haspopup":!0,"aria-owns":this._id+"_popup"}).element.hide(),this.drpbtnspan=t.buildTag("span.e-icon e-arrow-sans-down","",{},{"aria-label":"select",unselectable:"on"}),this.dropdownbutton=t.buildTag("span.e-select#"+this._id+"_dropdown","",{},{role:"button",unselectable:"on"}).append(this.drpbtnspan),this.container.insertAfter(this.element),this.container.append(this.element),this.container.append(this.dropdownbutton),this.wrapper.insertBefore(this.container),this.wrapper.append(this.container),this.selectelement&&this.selectOptions.insertBefore(this.element),this._visibleInput=t.buildTag("input#"+this._id+"_hidden","",{}).insertAfter(this.element),this._visibleInput.addClass("e-input "),this._setAttr(this._visibleInput[0],{readonly:!0,tabindex:-1,"data-role":"none"}),!this._isWatermark){var i=this.model.watermarkText!=null?this.model.watermarkText:this._localizedLabels.watermarkText;this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element);this._hiddenSpan.text(i);this._hiddenSpan.css("display","none");this._hiddenSpan.on("mousedown",n.proxy(this._OnDropdownClick,this))}this._checkNameAttr();this._setDimentions();this._RightToLeft();this.ddWidth=this.dropdownbutton.outerWidth()>0?this.dropdownbutton.outerWidth():24;this.container.on("mousedown",n.proxy(this._OnDropdownClick,this))},_checkNameAttr:function(){this._name=t.isNullOrUndefined(this.element.attr("name"))?this._id:this.element.attr("name");this.element.attr("name",this._name)},_addAttr:function(i){var r=this;n.map(i,function(i,u){var f=u.toLowerCase();f=="class"?r.wrapper.addClass(i):f=="disabled"&&i=="disabled"?r.disable():f=="readOnly"&&i=="readOnly"?r.model.readOnly=!0:f=="style"?r.wrapper.attr(u,i):t.isValidAttr(r._visibleInput[0],u)?n(r._visibleInput).attr(u,i):r.wrapper.attr(u,i)})},_renderBoxModel:function(){if(!t.isNullOrUndefined(this._ulBox)||this.model.multiSelectMode!="visualmode")return!1;this._ulBox=t.buildTag("ul.e-ul e-boxes");this.container.prepend(this._ulBox);this._ulBox.css("min-height","30px");this._ulBox.css("display","none");this._on(this.container,"click",function(t){if(!this.model.enabled)return!1;var i=n(t.target);i.hasClass("e-options")&&(!t.ctrlKey&&i.siblings().hasClass("e-active")&&this._removeActive(),i.hasClass("e-active")?i.removeClass("e-active"):i.addClass("e-active"));!t.ctrlKey&&i.hasClass("e-boxes")&&this._removeActive()})},_renderPopupPanelWrapper:function(){var i=n("#"+this.element[0].id+"_popup_wrapper").get(0);i&&n(i).remove();this.popupPanelWrapper=t.buildTag("div#"+this._id+"_popup_wrapper");n("body").append(this.popupPanelWrapper);this.popupListWrapper=t.buildTag("div.e-ddl-popup e-box e-widget e-popup#"+this._id+"_popup_list_wrapper","",{display:"none",overflow:"hidden"});this.popupList=t.buildTag("div#"+this._id+"_popup",{tabIndex:0});this.popupListWrapper.addClass(this.model.cssClass);this.popup=this.popupList;this.popupScroller=t.buildTag("div");this.ultag=t.buildTag("ul.e-ul","",{},{role:"listbox"});this.popupScroller.append(this.ultag);this.popupList.append(this.popupScroller);this.model.headerTemplate&&(this.headerTemplate=n("
      ").append(this.model.headerTemplate),this.popupListWrapper.append(this.headerTemplate));this.popupListWrapper.append(this.popupList);this.popupPanelWrapper.append(this.popupListWrapper);this.ultag.on({mouseenter:n.proxy(this._OnMouseEnter,this),mouseleave:n.proxy(this._OnMouseLeave,this),click:n.proxy(this._OnMouseClick,this)},"li:not('.e-category')");if(t.isTouchDevice())this.ultag.on({tap:n.proxy(this._OnMouseEnter,this)},"li:not('.e-category')");n(window).on("resize",n.proxy(this._OnWindowResize,this))},_updateText:function(){this.model.text=this._visibleInput.val()==""?null:this._visibleInput.val()},_updateValue:function(n){this.value(n==""?null:n)},_setGroupingAndSorting:function(n,t){var i,u,r;if(this.model[n]=t,i=this.model.text,this._updateValue(""),this._selectedIndices=[],this.ultag.empty(),this._showFullList(),this.model.showCheckbox&&i)for(u=i.split(this.model.delimiterChar),r=0;r.e-category").length>0)for(this.popupListWrapper.addClass("e-atc-popup"),r=0;r.e-category").length;r++)i=n(t).find(">.e-category").eq(0).first().nextUntil(".e-category").get(),this._setSortList(t,i);else n(t).children(">.e-category").remove(),i=n(t).children("li").get(),this._setSortList(t,i);this.itemsContainer=n(t)},_setSortList:function(t,i){i.sort(function(t,i){var r=n(t).text().toUpperCase(),u=n(i).text().toUpperCase();return ru?1:0});this.model.sortOrder=="descending"&&i.reverse();(this.model.allowGrouping||n(t).find(">.e-category").length>0)&&(n(t).append(n("
    • ").text(n(t).find(">.e-category").eq(0).text()).addClass("e-category")),n(t).find(">.e-category").eq(0).remove());n.each(i,function(i,r){n(t).append(r)})},_renderPopupList:function(){this._doDataBind();this._renderRemaining()},_renderRemaining:function(){var t=this;this._dropbtnRTL();this.model.enableFilterSearch&&this._enableSearch();this.model.enablePopupResize&&this._enablePopupResize();this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal"&&this._totalCount&&this._totalCount>0&&(this._totalHeight=this._totalCount*29,this._totalPages=this._totalCount/(this.model.itemsCount*29),this._loadedItemHeight=this._getLi().length*29,this._getLi().attr("page",0),this._virtualPages=[0],this.ultag.append(n("").addClass("e-virtual").css({height:this._totalHeight-this._loadedItemHeight,display:"block"})));this._virtualUl=this.ultag.clone(!0);this._setListWidth();this._setListHeight();this._isSingleSelect()||(this.model.showCheckbox?this._checkboxHideShow(this.model.showCheckbox):this._multiItemSelection(this._getLi()));this._setUncheckAll(this.model.uncheckAll);this.popupScroller.css({height:"",width:""});this.popupList.ejScroller({height:this._getPopupHeight(),width:0,scrollerSize:20,scroll:function(n){t.model.allowVirtualScrolling&&t._onScroll(n)}});this.scrollerObj=this.popupList.ejScroller("instance");this.popupList.find("div.e-scrollbar div").attr("unselectable","on");this._setListPosition();this.popupListWrapper.css({display:"none",visibility:"visible"});this._changeSkin(this.model.cssClass);this.model.showPopupOnLoad&&this._showResult()},_enableSearch:function(){this.model.enableFilterSearch&&(this.inputSearch||(this.inputSearch=t.buildTag("input#"+this._id+"_inputSearch.e-input","",{},{type:"text","data-role":"none"}),this.popupListWrapper.prepend(n("").addClass("e-atc e-search").append(n("").addClass("e-in-wrap ").append(this.inputSearch).append(n("").addClass(" e-icon e-search")))),this._on(this.inputSearch,"keyup",this._OnSearchEnter)))},_removeSearch:function(){this.model.enableFilterSearch=!1;this.popupListWrapper.find(".e-atc.e-search").remove();this._isPopupShown()&&this.hidePopup();this.inputSearch=null},_OnSearchEnter:function(i){var f=this,u,r;n.inArray(i.keyCode,[38,40,13])!=-1&&this.ultag.find("li.e-nosuggestion").length<=0?i.keyCode==13?this._OnKeyUp(i):this._OnKeyDown(i):(this._activeItem=-1,this._queryString=this.inputSearch.val(),this._queryString==""&&this._virtualUl?(r={searchString:this._queryString,searchQuery:null,items:this._rawList},this._trigger("search",r),this._resetList(),this._updateSelectedIndexByValue(this.value()),this._refreshScroller(),this._setListPosition()):(this._mapFields(),u=this._addSearchQuery(t.Query(),!this._isPlainType(this._rawList)),r={searchString:this._queryString,items:this._rawList,searchQuery:u},this.popupListWrapper.find(".e-atc.e-search .e-search").addClass("e-cross-circle").removeClass("e-search"),this._on(this.popupListWrapper.find(".e-atc.e-search .e-cross-circle"),"mousedown",this._refreshSearch),this._trigger("search",r)||f._filterSearch(u,r)))},_refreshSearch:function(){this._resetSearch();this._refreshPopup()},_filterSearch:function(n,i){var u=!1,r=i.result?i.result:t.DataManager(this._rawList).executeLocal(n);r.length==0&&(u=!0,r.push(this._getLocalizedLabels("emptyResultText")));this.popupListItems=r;this.ultag.empty();this._isPlainType(this.popupListItems)?this._plainArrayTypeBinding(r):this._objectArrayTypeBinding(r,"search");u&&this.ultag.find("li").length==1&&this.ultag.find("li").eq(0).addClass("e-nosuggestion");this.model.showCheckbox&&!u&&this._appendCheckbox(this._getLi());this._onSearch=!0;this._setValue(this.value());this._onSearch=!1;this._updateSelectedIndexByValue(this.value());this._refreshScroller();this._setListPosition()},_updateSelectedIndexByValue:function(n){var r,i,t;if(n&&this.model.enableFilterSearch){for(this._selectedIndices=this.model.selectedItems=this.model.selectedIndices=[],this._virtualList=this._virtualUl.children("li:not('.e-category')"),r=this._toArray(n),i=0;i0&&n.take(this.model.itemsCount),n},_targetElementBinding:function(){var e=this.element.parents().last(),r,f,t,u,i;if(this.docbdy=this.model.targetID?e.find("#"+this.model.targetID):this.optionDiv?this.optionDiv:null,!this.docbdy)return!1;if(this.itemsContainer=this.docbdy[0].nodeName=="UL"?this.docbdy:this.docbdy.children("ol,ul"),(this.model.allowGrouping||this.itemsContainer.find(">.e-category").length>0)&&!this.model.enableSorting)for(this.popupListWrapper.addClass("e-atc-popup"),r=0;r.e-category").length;r++)f=this.itemsContainer.find(">.e-category").eq(r),f.replaceWith(n("
    • ").text(f.text()).addClass("e-category"));else this.model.enableSorting&&this._setSortingList();for(this.itemsContainer.children("ol,ul").remove(),this.items=this.itemsContainer.children("li"),this.items.children("img,div").addClass("e-align"),this._listItem([]),t=0;t0){for(r=0;r=Math.round(n(r.popupList).find("ul,ol").height()-n(r.popupList).height())&&r._rawList.length=0;r--)if(this._virtualPages[r]"),c=f?(r-1)*e*29-(i*e+e)*29:r*e*29-(i*e+e)*29,c!=0&&s.append(n("").addClass("e-virtual").css({display:"block",height:c})),this._mapFields(),this._generateLi(t,this.mapFld),n(this.dummyUl).attr("page",r),f&&n(this.dummyUl).slice(0,e).attr("page",r-1),this.model.showCheckbox&&this._appendCheckbox(this.dummyUl),s.append(this.dummyUl),o=(r*e+e)*29,o=u!=null?u*e*29-o:this.ultag.height()-o,o!=0&&s.append(n("").addClass("e-virtual").css({display:"block",height:o})),l=this.ultag.find("li[page="+i+"]").last(),l.next().remove(),s.children().insertAfter(l),this._virtualPages.push(r),f&&this._virtualPages.push(r-1),h=0;h0?f.setAttribute("data-value",typeof o=="object"?JSON.stringify(o):o):f.setAttribute("data-value",e);t.isNullOrUndefined(c)||c===""||f.setAttribute("id",c);t.isNullOrUndefined(y)||y==""||this._setAttr(f,y);this.model.template?n(f).append(this._getTemplatedString(i[u])):(t.isNullOrUndefined(l)||l==""||(s=document.createElement("img"),this._setClass(s,"e-align")._setAttr(s,{src:l,alt:e}),a&&a!=""&&this._setAttr(s,a),f.appendChild(s)),t.isNullOrUndefined(v)||v==""||(p=document.createElement("div"),this._setClass(p,"div.e-align "+v+" sprite-image"),f.appendChild(p)),w&&this._setClass(f,"chkselect"),t.isNullOrUndefined(e)&&(e=String(e)),h=document.createElement("span"),h.innerHTML=e,this._setClass(h,"e-ddltxt"),f.innerHTML+=h.outerHTML);this._setAttr(f,{role:"option",unselectable:"on"});this.dummyUl.push(f)}},_setAttr:function(n,t){var r,i,u;if(typeof t=="string")r=t.replace(/['"]/g,"").split("="),r.length==2&&n.setAttribute(r[0],r[1]);else for(i in t)if((i=="styles"||i=="style")&&typeof t[i]=="object")for(u in t[i])n.style[u]=t[i][u];else n.setAttribute(i,t[i]);return this},_setClass:function(n,t){return n.className+=" "+t,this},_removeClass:function(n,t){var i=n.className.indexOf(t);return i>=0&&(n.className=i!=0&&n.className[i-1]===" "?n.className.replace(" "+t,""):n.className.replace(t,"")),this},_hasClass:function(n,t){return n.className.indexOf(t)>=0},_swapUnCategorized:function(t){n(t).each(function(n,i){if(!i.key){for(var r=n;r>0;r--)t[r]=t[r-1];return t[r]=i,!1}})},_getField:function(n,i){return t.pvt.getObject(i,n)},_getTemplatedString:function(n){for(var t=this.model.template,i=t.indexOf("${"),r=t.indexOf("}"),u,f;i!=-1&&r!=-1;)u=t.substring(i,r+1),f=u.replace("${","").replace("}",""),t=t.replace(u,this._getField(n,f)),i=t.indexOf("${"),r=t.indexOf("}");return t},_setWatermark:function(){if(this.element.val()==""&&this._trim(this._visibleInput.val())==""){var n=this.model.watermarkText!=null?this.model.watermarkText:this._localizedLabels.watermarkText;this._isWatermark?this._visibleInput.attr("placeholder",n):this._hiddenSpan.css("display","block").text(n);this.model.multiSelectMode=="visualmode"&&this._ulBox&&this._ulBox.find("li").length==0&&this._swapUlandInput(!1)}},_checkboxHideShow:function(n){if(n){this.listitems=this._getLi();var t=this.listitems.find("input[type=checkbox]");t.length==0&&this._appendCheckbox(this.listitems)}else this._removeCheck(this.popupList);this.model.showCheckbox=n;this._virtualUl=this.ultag.clone(!0)},_setCheckAll:function(n){!this._isSingleSelect()&&n?this.checkAll():this.model.checkAll=!1},_setUncheckAll:function(n){!this._isSingleSelect()&&n?this.uncheckAll():this.model.uncheckAll=!1},checkAll:function(){var f=this._selectedIndices,u=!1,i,r;if(this._mapFields(),this.listitems=this._getLi(),this._isWatermark||this._hiddenSpan.css("display","none"),!this._isSingleSelect()){for(i=0;i-1&&(this._selectedIndices.splice(n.inArray(i,f),1),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),this._selectedValue=this._getAttributeValue(this.listitems[i])||"",this._itemID=n(this.listitems[i]).attr("id"),t.isNullOrUndefined(this._itemID)||this._itemID==""||this._removeSelectedItemsID(),this._initValue||this._trigger("checkChange",{isChecked:this.checkedStatus,data:this.model}),args={text:this._visibleInput[0].value,selectedText:this._currentText,itemId:i,selectedValue:this._selectedValue,value:this._selectedValue,isChecked:this.checkedStatus},this._updateValue(this.element.val()),this._updateText(),this._initValue||this._trigger("change",args),this._cascadeAction(),this.model.multiSelectMode=="visualmode"&&(this._deleteBoxCheck(this._hiddenValue),this._isPopupShown()&&this._setListPosition()));this.model.itemValue=this._selectedValue;this.model.checkAll=!1;this.model.uncheckAll=!0;this._setWatermark();this._activeItem=-1}},_removeSelectedItemsID:function(){var n;n=this._selectedItemsID.indexOf(this._itemID);this._selectedItemsID.splice(n,1);this._itemID=""},_refreshScroller:function(){this.model.enablePopupResize||(this.popupList.css("height","auto"),this.popupListWrapper.css("height","auto"));this.popupList.find(".e-content, .e-vhandle").removeAttr("style");this.popupList.find(".e-vhandle div").removeAttr("style");this.popupList.children(".e-content").removeClass("e-content");var n=this._isPopupShown();this.popupListWrapper.css("display","block");this.popupList.css({display:"block"});this.scrollerObj.model.height=Math.ceil(this._getPopupHeight());this.scrollerObj.refresh();this.model.enablePopupResize||(this.popupList.css("height","auto"),this.popupListWrapper.css("height","auto"));this.scrollerObj.option("scrollTop",0);n||this.popupListWrapper.css("display","none")},_enablePopupResize:function(){this.model.enablePopupResize&&(this.popupListWrapper.addClass("e-resizable").append(t.buildTag("div.e-resizebar").append(t.buildTag("div.e-icon e-resize-handle"))).find(".e-resize-handle").addClass(this.model.enableRTL?"e-rtl-resize":""),this._resizePopup())},_resizePopup:function(){var t=this,i=!1;this.popupListWrapper.find("div.e-resize-handle").ejResizable({minHeight:t._validatePixelData(t.model.minPopupHeight),minWidth:t._validatePixelData(t.model.minPopupWidth),maxHeight:t._validatePixelData(t.model.maxPopupHeight),maxWidth:t._validatePixelData(t.model.maxPopupWidth),handle:"e-ddl-popup",resizeStart:function(n){if(!t.model.enabled)return!1;i||t._trigger("popupResizeStart",{event:n});i=!0},resize:function(i){var r=n(i.element).parents("div.e-ddl-popup");t._refreshPopupOnResize(n(r).outerHeight(),n(r).outerWidth());t._trigger("popupResize",{event:i})},resizeStop:function(n){i&&(t._refreshPopupOnResize(t.model.popupHeight,t.model.popupWidth),i&&t._trigger("popupResizeStop",{event:n}),i=!1)},helper:function(i){var r=n(i.element).parents("div.e-ddl-popup");return t._refreshPopupOnResize(n(r).outerHeight(),n(r).outerWidth()),n(t.popupListWrapper)}})},_refreshPopupOnResize:function(n,t){n&&(this.model.popupHeight=n);t&&(this.model.popupWidth=t);this.popupListWrapper.css({height:this._validatePixelData(this.model.popupHeight),"min-height":this._validatePixelData(this.model.minPopupHeight),"max-height":this._validatePixelData(this.model.maxPopupHeight)});this._setListWidth();this._refreshScroller()},_setListWidth:function(){var n=this.model.popupWidth;n!="auto"?this.popupListWrapper.css({width:n}):this.popupListWrapper.css({"min-width":this._validatePixelData(this.model.minPopupWidth)});this.popupListWrapper.css({"max-width":this._validatePixelData(this.model.maxPopupWidth)})},_setListHeight:function(){this.model.enablePopupResize&&this.model.enableFilterSearch&&this.model.minPopupHeight&&this.model.minPopupHeight.toString().indexOf("%")<0&&this._validatePixelData(this.model.minPopupHeight)==20&&(this.model.minPopupHeight="65");this.model.enablePopupResize?this.popupListWrapper.css({"min-height":this._validatePixelData(this.model.minPopupHeight),"max-height":this._validatePixelData(this.model.maxPopupHeight),height:this._validatePixelData(this.model.popupHeight)}):this.popupListWrapper.css({"max-height":this._validatePixelData(this.model.popupHeight),"min-height":this._validatePixelData(this.model.minPopupHeight)})},_validatePixelData:function(n){return n&&!isNaN(n)?Number(n):n},_getPopupHeight:function(){var n=this.popupListWrapper.height(),t;return this.model.enablePopupResize&&(n-=this.popupListWrapper.find(">div.e-resizebar").height()),this.model.headerTemplate&&this.headerTemplate&&(n-=this.headerTemplate.height()),this.model.enableFilterSearch&&this.inputSearch&&(t=this.inputSearch.parent(".e-in-wrap"),n-=parseInt(t.css("height"))+parseInt(t.css("margin-top"))+parseInt(t.css("margin-bottom"))),n},_refreshPopup:function(){this.model.popupWidth!="auto"||this._validatePixelData(this.model.minPopupWidth)?this._validatePixelData(this.model.minPopupWidth)&&this.popupListWrapper.css({"min-width":this._validatePixelData(this.model.minPopupWidth)}):this.popupListWrapper.css({"min-width":this.wrapper.width()});this.scrollerObj!=i&&this._refreshScroller();this._setListPosition()},_setListPosition:function(){var t=this.wrapper,i=this._getOffset(t),f,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),u=this.popupListWrapper.outerHeight(),e=this.popupListWrapper.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(uc?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e=0||this._activeItem!=null)&&(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],n(t).removeClass("e-check-inact"),this.checkedStatus=this._isChecked(t)):this.checkedStatus=this.activeItem.hasClass("e-active")),i={text:this._currentText,selectedText:this._currentText,itemId:this.selectedIndexValue,value:this._selectedValue,isChecked:this.checkedStatus,isInteraction:!!this._uiInteract},!this._initValue&&!this._onSearch&&this._raiseEvents&&this._trigger("select",i)){this._setWatermark();return}(this._activeItem>=0||this._activeItem!=null)&&(this._isSingleSelect()||this._checkContains(this._selectedValue)?this._isSingleSelect()?(this.ultag.children("li").removeClass("e-hover").removeClass("e-active"),this.activeItem.addClass("e-active"),this._maintainHiddenValue(),this._visibleInput.val(this._currentText),this.element.val(this._hiddenValue),this.selectedItemIndex(this.selectedIndexValue),this.selectedIndex(this.selectedIndexValue),this._selectedIndices[0]=this.selectedIndexValue):r=!1:(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],this._isChecked(t)||(this._removeClass(t,"e-ddl-anim"),this._setClass(t,"e-check-act e-ddl-anim"),this._setAttr(t,{"aria-checked":!0}),n(t).find(".e-check-input")[0].checked=!0)):this.activeItem.addClass("e-active"),this.model.multiSelectMode=="visualmode"&&(this._ulBox.append(this._createBox(this._currentText,this._selectedValue)),this._isPopupShown()&&this._setListPosition()),this._maintainHiddenValue(),this._addText(this._currentText),this._createListHidden(this._hiddenValue),n.inArray(this.selectedIndexValue,this._selectedIndices)==-1&&(this._selectedIndices.push(this.selectedIndexValue),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices)),r&&(this.checkedStatus=!0,this._onValueChange(),this._cascadeAction(),this.selectelement&&n("#"+this._id).children().length>this.selectedIndexValue&&(n("#"+this._id).children()[this.selectedIndexValue].selected=!0)));this.model.uncheckAll=!1;this._setWatermark();this._uiInteract=!1},_onValueChange:function(){this.model.itemValue=this._selectedValue;this._updateText();this.value()==this.element.val()||this.value()==null&&this.element.val()==""||(this._updateSelectedIndexByValue(this.element.val()),this._updateValue(this.element.val()),this.model.showCheckbox||this.model.multiSelectMode!="none"||this.model.value!=null&&this.model.value!=""||(this.model.itemValue=""),args={text:this._visibleInput[0].value,selectedText:this._currentText,itemId:this.selectedIndexValue,selectedValue:this._selectedValue,value:this._selectedValue,isChecked:this.checkedStatus,isInteraction:!!this._uiInteract},this._initValue||this._onSearch||!this._raiseEvents||(this._trigger("change",args),this.model.showCheckbox&&this._trigger("checkChange",{isChecked:this.checkedStatus,text:this._visibleInput.val(),itemId:this.selectedIndexValue,selectedText:this._currentText,selectedValue:this._selectedValue,value:this._selectedValue,data:this.model})),this._uiInteract=!1)},_decode:function(t){return n("").html(t).text()},_chooseSelectionType:function(){this.activeItem=this._getActiveItem();this.selectedIndexValue=this._activeItem;this._mapFields();this.model.dataSource==null||this._isPlainType(this.model.dataSource)?(this._currentText=this.activeItem.text(),this._getAttributeValue(this.activeItem[0])?this._selectedValue=this._getAttributeValue(this.activeItem[0]):this._currentText!=null?(this.activeItem[0].setAttribute("value",this._currentText),this._selectedValue=this._currentText):this._selectedValue="",this._itemID=n(this.activeItem).attr("id")):(this._currentText=this._decode(this._getField(this.popupListItems[this._activeItem],this.mapFld._text)),this._currentText=this._currentText===""||this._currentText==null?this.activeItem.text():this._currentText,this._selectedValue=this._getField(this.popupListItems[this._activeItem],this.mapFld._value),this._selectedValue=this._selectedValue!=null?this._selectedValue:this._currentText,this._itemID=this._getField(this.popupListItems[this._activeItem],this.mapFld._id));t.isNullOrUndefined(this._itemID)||this._itemID==""||(this.model.showCheckbox?this.removeID?this._removeSelectedItemsID():this._selectedItemsID.push(this._itemID):(this._selectedItemsID=[],this.removeID||this._selectedItemsID.push(this._itemID)));this.selectedTextValue=this._currentText},_maintainHiddenValue:function(){this._hiddenValue=this._getAttributeValue(this.activeItem[0])||this._currentText},_removeTextBoxValue:function(){var i,t;if(this._uiInteract=!0,this.removeID=!0,this.checkedStatus=!0,this._chooseSelectionType(),(this._activeItem>=0||this._activeItem!=null)&&(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],n(t).removeClass("e-ddl-anim").addClass("e-check-inact e-ddl-anim"),this.checkedStatus=this._isChecked(t)):this.checkedStatus=this.activeItem.hasClass("e-active")),i={text:this._currentText,selectedText:this._currentText,itemId:this.selectedIndexValue,value:this._selectedValue,isChecked:this.checkedStatus},!this._initValue&&!this._onSearch&&this._raiseEvents&&this._trigger("select",i)){this._setWatermark();return}this._maintainHiddenValue();this._removeText(this._hiddenValue);this._removeListHidden(this._hiddenValue);this.activeItem.removeClass("e-active");this._isSingleSelect()||(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],this._isChecked(t)&&(this._removeClass(t,"e-check-act"),this._setAttr(t,{"aria-checked":!1}),n(t).find(".e-check-input")[0].checked=!0)):this.activeItem.removeClass("e-active"),n.inArray(this.selectedIndexValue,this._selectedIndices)>-1&&(this._selectedIndices.splice(n.inArray(this.selectedIndexValue,this._selectedIndices),1),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),this.model.multiSelectMode=="visualmode"&&(this._deleteBoxCheck(this._hiddenValue),this._isPopupShown()&&this._setListPosition()));this.checkedStatus=!1;this._onValueChange();this.model.cascadeTo==null||this._isSingleSelect()||this._initValue||this._cascadeAction();this.model.checkAll=!1;this._setWatermark()},_createBox:function(i,r){if(!this._checkContains(r)){this._ulBox.css("display")=="none"&&this._visibleInput.css("display")!="none"&&this._swapUlandInput(!0);var u=t.buildTag("span.e-icon e-close","",{},{unselectable:"on"}),f=t.buildTag("li.e-options").text(i).attr("data-value",r).append(u);return this._on(u,"click",function(t){if(!this.model.enabled)return!1;this._deleteBox(n(t.target).parent())}),f}},_deleteBoxCheck:function(t){for(var r=this._ulBox.children("li"),i=0;i0&&t=="active"?(e=this._getLi(),i=this._selectedIndices.length==e.length?0:this._selectedIndices[this._selectedIndices.length-1],(this.model.fields.groupBy!=null||this.ultag.find("li.e-category").length>0)&&(i=n.inArray(e.eq(i)[0],u))):i=this.ultag.find("li.e-"+t).index(),r=0;r0&&(t.which&&t.which==1||t.button&&t.button==0)&&this._OnPopupHideShow()},_OnPopupHideShow:function(){if(this._isPopupShown())this._hideResult();else if(this._showResult(),this.model.enableFilterSearch){if(this.getSelectedItem().length==0)this.ultag.find("li:first").addClass("e-hover");else{var t=this.getSelectedItem().length;n(this.getSelectedItem()[t-1]).addClass("e-hover")}this.inputSearch.focus()}else this.wrapper.focus()},_showFullList:function(){var n=this.model.dataSource,i;t.DataManager&&n instanceof t.DataManager?n.dataSource.offline||n.dataSource.json&&n.dataSource.json.length>0?this._getFilteredList(n.dataSource.json):(i=this,i._initDataSource(n)):this._getFilteredList(n)},_getFilteredList:function(n){if(!n||!n.length||n.length<1)this._targetElementBinding(),this._renderRemaining();else{var i=t.DataManager(n).executeLocal(this._isPlainType(n)?t.Query():this._getQuery(!0));this._totalCount=i.count;this._listItem(i.result?i.result:i);this._renderPopupList();this._rawList=this.popupListItems.slice()}},_cascadeAction:function(){if(this.model.cascadeTo)for(var r=this.model.cascadeTo.split(","),i=0;i0}),this._isSingleSelect()||i.selectItemByValue(c),(i.model.showCheckbox||i.model.multiSelectMode!="none")&&n("input:hidden[id^='#'][name="+i._id+"]").remove(),i._setSelectedItem)i.setModel(i._setCascadeModel);else{for(s=["value","text","selectedIndex","selectedIndices"],o=0;o0&&setTimeout(function(){s._incqueryString=""},1e3);var f=this._getLi(),i,e=this.model.caseSensitiveSearch,r,u=this._incqueryString,h=this._incqueryString.length,o=!1;for(e||(u=u.toLowerCase()),i=0;i=t;u--)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&this._selectFocusedItem(u)},_selectShiftHome:function(t,i,r){if(r||this._clearTextboxValue(),t>=0&&t<=this._listSize-1){if(t==0)this._clearTextboxValue();else for(var u=t;u>=i;u--)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&(this._activeItem=u,this._enterTextBoxValue());this._activeItem=t;t==0&&this._enterTextBoxValue();this.scrollerObj.setModel({scrollTop:0})}},_selectShiftEnd:function(t,i,r){if(r||this._clearTextboxValue(),t<=this._listSize-1){if(t==i)this._clearTextboxValue();else for(var u=t;u<=i;u++)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&(this._activeItem=u,this._enterTextBoxValue());this._activeItem=t;t==i&&this._enterTextBoxValue();this.scrollerObj.setModel({scrollTop:this.ultag.outerHeight()})}},_getLastFocusedLi:function(){return this._selectedIndices&&this._selectedIndices.length>0?this._selectedIndices[this._selectedIndices.length-1]:null},_getLastShiftFocusedLi:function(t,i){var r=i?t-1:t+1;return n.inArray(r,this._selectedIndices)<0?t:this._getLastShiftFocusedLi(r,i)},_shiftUp:function(n,t,i){var u,r,f;if(n==null||n<0)this._checkDisableStep(0,t,!1,!1,!0);else if(n>0&&n<=this._listSize-1&&(u=this._disableItemSelectUp(n-t),u!=null))if(this._getLastFocusedLi()!=null)if(this._selectedIndices.length>1&&n-1==this._selectedIndices[this._selectedIndices.length-2])for(r=1;r<=t;r++)if(n-r==this._selectedIndices[this._selectedIndices.length-2])this._activeItem=n+1-r,this._removeTextBoxValue(),this._focusItem(n-r);else break;else f=this._getLastShiftFocusedLi(this._getLastFocusedLi(),!1),this._selectShiftUp(u,f,i);else this._moveUp(n,t,!1)},_shiftDown:function(n,t,i){var u,r,f;if(n==null||n<0)this._checkDisableStep(-1,t,!0,!1,!0);else if(n1&&n+1==this._selectedIndices[this._selectedIndices.length-2])for(r=1;r<=t;r++)if(n+r==this._selectedIndices[this._selectedIndices.length-2])this._activeItem=n-1+r,this._removeTextBoxValue(),this._focusItem(n+r);else break;else f=this._getLastShiftFocusedLi(this._getLastFocusedLi(),!0),this._selectShiftDown(f,u,i);else this._moveDown(n,t,!1)},_moveUp:function(n,t,i){n==null||n<=0?this._checkDisableStep(0,t,!1,i):n>this._listSize-1?this._checkDisableStep(this._listSize-1,t,!1,i):n>0&&n<=this._listSize-1&&this._checkDisableStep(n,t,!1,i)},_moveDown:function(n,t,i){n==null||n<0?this._checkDisableStep(-1,t,!0,i):n==0?this._checkDisableStep(0,t,!0,i):n>=this._listSize-1?this._checkDisableStep(this._listSize-1,t,!0,i):n=0;e--)if(o=i?n+e:n-e,f=this[s](o),f!=null)break;f!=null&&(r?this._focusItem(f):this._selectItem(f),u&&r&&this._enterTextBoxValue())},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t0)return this._disableItemSelectUp(t-1)}},_preventDefaultAction:function(n,t){n.preventDefault?n.preventDefault():n.returnValue=!1;t&&(n.stopPropagation?n.stopPropagation():n.cancelBubble=!0)},_OnKeyDown:function(n){var f,r,u,i,t;if(this._uiInteract=!0,this.model.enabled)if(this._itemId=null,f=this._getLi(),this._listSize=f.length,u=this.popupList.height(),r=this.ultag.children("li").outerHeight(),i=Math.round(u/r)!=0?Math.round(u/r):5,this._isSingle=this._isSingleSelect(),this._isSingle)switch(n.keyCode){case 38:if(n.altKey){this.ultag.find("li").length>0&&this._hideResult();break}case 33:t=n.keyCode==33?i:1;this._moveUp(this._activeItem,t);this._preventDefaultAction(n,!0);break;case 8:this._preventDefaultAction(n);break;case 40:if(n.altKey){this.ultag.find("li").length>0&&this._showResult();break}case 34:t=n.keyCode==34?i:1;this._moveDown(this._activeItem,t);this._preventDefaultAction(n,!0);break;case 37:this.model.enableRTL?this._moveDown(this._activeItem,1):this._moveUp(this._activeItem,1);this._preventDefaultAction(n);break;case 39:this.model.enableRTL?this._moveUp(this._activeItem,1):this._moveDown(this._activeItem,1);this._preventDefaultAction(n);break;case 9:case 27:this._isPopupShown()&&this._hideResult();break;case 35:this._moveDown(this._listSize-1,0);this._preventDefaultAction(n);break;case 36:t=this._activeItem!=null?this._activeItem:this._listSize-1;this._moveUp(t,t);this._preventDefaultAction(n)}else switch(n.keyCode){case 38:n.altKey?this.ultag.find("li").length>0&&this._hideResult():n.shiftKey?this._shiftUp(this._activeItem,1,n.ctrlKey):this._moveUp(this._activeItem,1,n.ctrlKey);this._preventDefaultAction(n);break;case 33:n.shiftKey?this._shiftUp(this._activeItem,i,n.ctrlKey):this._moveUp(this._activeItem,i,n.ctrlKey);this._preventDefaultAction(n);break;case 8:this._preventDefaultAction(n);break;case 40:n.altKey?this.ultag.find("li").length>0&&this._showResult():n.shiftKey?this._shiftDown(this._activeItem,1,n.ctrlKey):this._moveDown(this._activeItem,1,n.ctrlKey);this._preventDefaultAction(n);break;case 34:n.shiftKey?this._shiftDown(this._activeItem,i,n.ctrlKey):this._moveDown(this._activeItem,i,n.ctrlKey);this._preventDefaultAction(n);break;case 37:this.model.enableRTL?this._moveDown(this._activeItem,1,!1):this._moveUp(this._activeItem,1,!1);this._preventDefaultAction(n);break;case 39:this.model.enableRTL?this._moveUp(this._activeItem,1,!1):this._moveDown(this._activeItem,1,!1);this._preventDefaultAction(n);break;case 9:case 27:this._isPopupShown()&&this._hideResult();break;case 35:n.shiftKey?this._selectShiftEnd(this._activeItem,this._listSize-1,n.ctrlKey):this._moveDown(this._activeItem,this._listSize,n.ctrlKey);this._preventDefaultAction(n);break;case 36:t=this._activeItem!=null?this._activeItem:this._listSize-1;n.shiftKey?this._selectShiftHome(this._activeItem,0,n.ctrlKey):this._moveUp(this._activeItem,t,n.ctrlKey);this._preventDefaultAction(n)}},_OnKeyUp:function(i){var u,r;if(this.model.enabled){if(this._preventDefaultAction(i),u=i.target,this._activeItem==null&&(this._activeItem=this._getLi().index(this.popupList.find("ol,ul").children("li.e-hover"))),this._trim(this._visibleInput.val())==""&&i.keyCode==38&&i.keyCode==40)return this._hideResult(),!1;switch(i.keyCode){case 13:!this._isSingle&&this._isPopupShown()&&(i.ctrlKey||i.shiftKey)&&this._activeItem>=0?this._selectAndUnselect():!this._isPopupShown()||i.ctrlKey||i.shiftKey?this._isPopupShown()&&this._hideResult():(t.isNullOrUndefined(this.inputSearch)||(this.getSelectedItem().length==0?(this.selectItemByIndex(0),n(this.listitems[0]).removeClass("e-hover")):(r=this._getLastFocusedLi(),(this.model.multiSelectMode!="none"||this.model.showCheckbox)&&(this.unselectItemByIndex(r),n(this.listitems[r]).removeClass("e-hover")))),this._hideResult());this._preventDefaultAction(i);break;case 32:this._isPopupShown()&&this._isSingle&&this._hideResult();!this._isSingle&&this._isPopupShown()&&this._activeItem>=0&&this._selectAndUnselect();this._preventDefaultAction(i);break;case 8:this.model.multiSelectMode=="visualmode"&&this._deleteLastBox();this._preventDefaultAction(i);break;case 46:if(this.model.multiSelectMode=="visualmode"||this.model.showCheckbox){this._deleteBox(this._ulBox.children("li.e-active"));break}}}},_isSingleSelect:function(){return!this.model.showCheckbox&&this.model.multiSelectMode=="none"},_selectAndUnselect:function(){this.model.showCheckbox?this._isChecked(this._getActiveItem().find(".e-checkwrap")[0])?this._removeTextBoxValue():this._enterTextBoxValue():this.model.MultiSelectMode!="none"&&(this._getActiveItem().hasClass("e-active")?this._removeTextBoxValue():this._enterTextBoxValue())},_targetFocus:function(){this.model.enabled&&!this._isFocused&&(this._isWatermark||this._hiddenSpan.css("display","none"),this.wrapper.addClass("e-focus e-popactive"),this._isFocused=!0,this._trigger("focusIn"))},_targetBlur:function(){this.model.enabled&&(this._isFocused=!1,this.wrapper.removeClass("e-focus e-popactive"),this._setWatermark(),this._trigger("focusOut"))},_getLocalizedLabels:function(n){return this._localizedLabels[n]===i?t.DropDownList.Locale["en-US"][n]:this._localizedLabels[n]},_wireEvents:function(){this._on(this.wrapper,"focus",this._targetFocus);this._on(this.wrapper,"blur",this._targetBlur);this._on(this.wrapper,"keydown",this._OnKeyDown);this._on(this.popupList,"keydown",this._OnKeyDown);this._on(this.popupList,"keyup",this._OnKeyUp);this._on(this.wrapper,"keyup",this._OnKeyUp);this._on(this.popupList,"keypress",this._OnKeyPress);this._on(this.wrapper,"keypress",this._OnKeyPress)},_unwireEvents:function(){this._off(this.wrapper,"focus",this._targetFocus);this._off(this.wrapper,"blur",this._targetBlur);this._off(this.wrapper,"keydown",this._OnKeyDown);this._off(this.popupList,"keydown",this._OnKeyDown);this._off(this.popupList,"keyup",this._OnKeyUp);this._off(this.wrapper,"keyup",this._OnKeyUp);this._off(this.popupList,"keypress",this._OnKeyPress);this._off(this.wrapper,"keypress",this._OnKeyPress);n(window).off("resize",n.proxy(this._OnWindowResize,this))},_multiItemSelection:function(n,t){var i,r;for(this._ulBox||this.model.multiSelectMode!="visualmode"||this._renderBoxModel(),i=0;i<\/div>").append("
      <\/div>"),$(this.tip).insertBefore(this.tooltipInter))},t.prototype._adjustArrow=function(n){var r,u,f=$(this.tooltip).width(),i=$(this.tooltip).height(),t=n.stem,o=n.target,e={tipHeight:0,tipWidth:0};o.horizontal=="right"||o.horizontal=="left"?(r=t.horizontal=="left"?-this.model.tip.size.height:t.horizontal=="right"?f:f/2-this.tipSize.width/2,u=t.horizontal!="center"?t.vertical=="top"?5:t.vertical=="center"?i/2-this.tipSize.width/2:i-5-this.tipSize.width:t.vertical=="top"?-this.tipSize.height:t.vertical=="bottom"?i:this.tooltipPos.height/2-this.tipSize.width/2,e=this._arrowBinding(n,"horizontal")):(u=t.vertical=="top"?-this.tipSize.height:t.vertical=="bottom"?i:i/2-this.tipSize.width/2,r=t.vertical=="center"?t.horizontal=="left"?-this.model.tip.size.height:f:t.horizontal=="left"?10:t.horizontal=="center"?this.tooltipPos.width/2-this.tipSize.width/2:f-10-this.tipSize.width,e=this._arrowBinding(n,"vertical"));this.arrowValue.left=r;this.arrowValue.top=u;$(this.tip).css({height:e.tipHeight+"px",width:e.tipWidth+"px",left:r+"px",top:u+"px",display:t.horizontal=="center"&&t.vertical=="center"?"none":"block"})},t.prototype._arrowBinding=function(n,t){var f=n.stem,c=t=="horizontal"?f.horizontal!="center":f.vertical=="center",r,u,e=$(this.tooltip).css("border-top-color"),o=$(this.tooltip).css("background-color"),s=this.model.tip.size.height,h=this.model.tip.size.height-1,i={"border-top":"none","border-bottom":"none","border-right":"none","border-left":"none"};return c?(r=this.model.tip.size.height,u=this.model.tip.size.width,$(this.tip).find(".e-arrowTipOuter").css(this._arrow(n,s,e,i,"horizontal")),$(this.tip).find(".e-arrowTipInner").css(this._arrow(n,h,o,i,"horizontal"))):(r=this.model.tip.size.width,u=this.model.tip.size.height,$(this.tip).find(".e-arrowTipOuter").css(this._arrow(n,s,e,i,"vertical")),$(this.tip).find(".e-arrowTipInner").css(this._arrow(n,h,o,i,"vertical"))),{tipHeight:u,tipWidth:r}},t.prototype._arrow=function(n,t,i,r,u){var f=n.stem,e=u=="horizontal"?f.horizontal=="right"?"0px":"1px":"1px",o=u=="horizontal"?"1px":f.vertical=="bottom"?"0px":"1px";return r["border-top"]=u=="horizontal"?t+"px solid transparent":f.vertical=="bottom"?t+"px solid "+i:"none",r["border-bottom"]=u=="horizontal"?t+"px solid transparent":f.vertical=="top"?t+"px solid "+i:"none",r["border-right"]=u=="horizontal"?f.horizontal=="left"?t+"px solid "+i:"none":t+"px solid transparent",r["border-left"]=u=="horizontal"?f.horizontal=="right"?t+"px solid "+i:"none":t+"px solid transparent",t==this.model.tip.size.height-1&&(r.left=e,r.top=o),r},t.prototype._iconRender=function(){this.model.closeMode==ej.Tooltip.CloseMode.Sticky&&(ej.isNullOrUndefined(this.tooltipClose)||$(this.tooltipClose).remove(),this.tooltipClose=ej.buildTag("div .e-icon"," ",{},{id:"_closeIcon"}),this.model.title!=null?$(this.tooltipClose).insertAfter(this.tooltipTitle).addClass("e-close"):$(this.tooltipClose).insertBefore(this.tooltipInter).addClass("e-cross-circle"),this._on($(this.tooltipClose),"click",this._hideTooltip))},t.prototype._renderTarget=function(){this.targetElement=$(this.element).find(this.model.target);for(var n=0;na+this.containerSize.width)&&(this.positionTooltip.horizontal=y>=this.tooltipPos.width?"right":this.containerSize.width-y>=this.tooltipPos.width?"left":"center"),(i.topthis.containerSize.height+v)&&(this.positionTooltip.vertical=p>=this.tooltipPos.height?"bottom":this.containerSize.height-p>=this.tooltipPos.height?"top":"center")),this.positionTooltip.horizontal!=t.horizontal||this.positionTooltip.vertical!=t.vertical)this.isCollision=!0,t=$.extend(!0,{},this.positionTooltip);else if(this.isCollision=!1,$(this.tooltip).css({top:i.top+"px",left:i.left+"px",position:"absolute",right:"auto",bottom:"auto"}),e.stem=$.extend(!0,{},this.positionTooltip),this.model.showShadow&&this._shadowEffect(this.model.showShadow,e),this.model.isBalloon&&this._adjustArrow(e),this._showTooltip(),this.model.associate==ej.Tooltip.Associate.MouseEnter&&(this.isTrack=!1),this.model.associate==ej.Tooltip.Associate.MouseFollow&&this.triggerEvents("tracking",{position:this.model.position,event:n}))return},t.prototype._axisPosition=function(){var i=$.extend(!0,{},this.model.position),r,u,n,t;typeof this.model.position.target.horizontal=="number"&&(r=this.model.position.target.horizontal.toString());typeof this.model.position.target.vertical=="number"&&(u=this.model.position.target.vertical.toString());n=parseInt(r);t=parseInt(u);ej.isNullOrUndefined(this.tip)||$(this.tip).css({display:"none"});this.model.showShadow&&this._shadowEffect(this.model.showShadow,i);this.model.isBalloon&&this._adjustArrow(i);isFinite(n)&&isFinite(t)&&$(this.tooltip).css({top:t,left:n,position:"absolute"})},t.prototype._tooltipPosition=function(n){var u=0,t=$.extend(!0,{},n.stem),r=$.extend(!0,{},n.target),i=$.extend(!0,{},this.targetPos),o=t.vertical==="top"||t.vertical==="bottom"?5+this.tipSize.width/2:0,s=t.horizontal==="right"||t.horizontal==="left"?10+this.tipSize.width/2:0,u=this.model.isBalloon?t.horizontal!=="center"?this.model.tip.size.height:t.vertical!=="center"?this.model.tip.size.height:0:0,f=this.model.tip.adjust.xValue!=0?this.model.tip.adjust.xValue:this.model.isBalloon?0:2,e=this.model.tip.adjust.yValue!=0?this.model.tip.adjust.yValue:this.model.isBalloon?0:2;i.left+=r.horizontal==="right"?this.targetPos.width:r.horizontal==="left"?0:this.targetPos.width/2;i.top+=r.vertical==="bottom"?this.targetPos.height:r.vertical==="top"?0:this.targetPos.height/2;i.left+=t.horizontal==="right"?-this.tooltipPos.width:t.horizontal==="left"?0:-(this.tooltipPos.width/2);i.top+=t.vertical==="bottom"?-this.tooltipPos.height:t.vertical==="top"?0:-(this.tooltipPos.height/2);i.left+=r.horizontal!=="center"?t.horizontal==="right"?-u:t.horizontal==="left"?u:0:t.vertical==="center"?t.horizontal==="right"?-u:t.horizontal==="left"?u:0:0;i.top+=r.horizontal==="center"?t.vertical==="bottom"?-u:t.vertical==="top"?u:0:t.horizontal==="center"?t.vertical==="bottom"?-u:t.vertical==="top"?u:0:0;i.left+=r.horizontal==="center"&&t.vertical!=="center"?t.horizontal==="right"?s:t.horizontal==="left"?-s:0:0;i.top+=r.horizontal!=="center"&&t.horizontal!=="center"?t.vertical==="top"?-o:t.vertical==="bottom"?o:0:0;i.left+=r.horizontal!=="center"?t.horizontal==="right"?-f:t.horizontal==="left"?f:0:t.vertical==="center"?t.horizontal==="right"?-f:t.horizontal==="left"?f:0:0;i.top+=r.horizontal==="center"?t.vertical==="bottom"?-e:t.vertical==="top"?e:0:t.horizontal==="center"?t.vertical==="bottom"?-e:t.vertical==="top"?e:0:0;this.tooltipPos.left=i.left;this.tooltipPos.top=i.top;this.model.collision===ej.Tooltip.Collision.None&&(this.model.isBalloon&&this._adjustArrow(n),this._shadowEffect(this.model.showShadow,n),$(this.tooltip).css({top:i.top+"px",left:i.left+"px",position:"absolute"}))},t.prototype._calcCollision=function(n,t){var n=$.extend(!0,{},n),i=$.extend(!0,{},n),o=this.model.tip.size.height,f=!0,r=this.model.containment!="body"?$(t).offset().left-$(this.model.containment).offset().left:$(t).offset().left,u=this.model.containment!="body"?$(t).offset().top-$(this.model.containment).offset().top:$(t).offset().top,e={topSpace:u,rightSpace:this.containerSize.width-(r+this.targetPos.width),bottomSpace:this.containerSize.height-(u+this.targetPos.height),leftSpace:r,centerRight:this.containerSize.width-(r+this.targetPos.width/2),centerLeft:r+this.targetPos.width/2,centerTop:u+this.targetPos.height/2,centerBottom:this.containerSize.height-(u+this.targetPos.height/2),tooltipWidth:this.tooltipPos.width+o,tooltipHeight:this.tooltipPos.height+o};if(this.model.collision===ej.Tooltip.Collision.Fit)this._collisionFit(n,e);else{while(f)i=this._collisionFlip(i,e),i.target.horizontal!=n.target.horizontal||i.target.vertical!=n.target.vertical||i.stem.horizontal!=n.stem.horizontal||i.stem.vertical!=n.stem.vertical?(this._tooltipPosition(i),n=$.extend(!0,{},i)):f=!1;f||(this.model.collision==ej.Tooltip.Collision.FlipFit?this._collisionFit(i,e):(this._adjustArrow(i),this._shadowEffect(this.model.showShadow,i),$(this.tooltip).css({top:this.tooltipPos.top+"px",left:this.tooltipPos.left+"px",position:"absolute"})))}},t.prototype._collisionFlip=function(n,t){var r=$.extend(!0,{},this.tooltipPos),i=$.extend(!0,{},n),e=$(this.model.containment).scrollLeft(),o=$(this.model.containment).scrollTop(),u=this.containerSize.left,f=this.containerSize.top;return(r.left+r.width>u+this.containerSize.width+e||r.left=t.tooltipWidth?"left":t.rightSpace>=t.tooltipWidth?"right":"center":i.stem.horizontal=t.centerLeft>=t.tooltipWidth?"right":t.centerRight>=t.tooltipWidth?"left":"center"),r.top=t.tooltipHeight?"bottom":"center"),r.top+r.height>this.containerSize.height+o+f&&(i.target.vertical=t.topSpace>=t.tooltipHeight?"top":"center"),(i.target.horizontal!=n.target.horizontal||i.target.vertical!=n.target.vertical)&&(i.stem.horizontal=i.target.horizontal=="center"?t.centerLeft>=t.tooltipWidth?"right":t.centerRight>=t.tooltipWidth?"left":"center":i.target.horizontal=="right"?"left":"right"),(i.target.vertical!=n.target.vertical||i.target.horizontal!=n.target.horizontal)&&(i.stem.vertical=i.target.vertical=="center"?t.centerTop>=t.tooltipHeight?"bottom":t.centerBottom>=t.tooltipHeight?"top":t.centerTop>t.centerBottom?"bottom":"top":i.target.vertical=="top"?"bottom":"top"),i},t.prototype._collisionFit=function(n,t){var i=$.extend(!0,{},this.tooltipPos),o=!1,s=!1,r=1,u=1,h=null,c=$(this.model.containment).scrollLeft(),l=$(this.model.containment).scrollTop(),f=this.containerSize.left,e=this.containerSize.top,a,v;(i.leftthis.containerSize.width+c+f)&&(r=i.leftthis.containerSize.width+c+f?i.left-(i.left+i.width-(this.containerSize.width+f)):1,o=!0);(i.topthis.containerSize.height+l+e)&&(u=i.topthis.containerSize.height+l+e?i.top-(i.top+i.height-(this.containerSize.height+e)):1,s=!0);$(this.tooltip).css({top:u!=1?u+"px":i.top+"px",left:r!=1?r+"px":i.left+"px",position:"absolute"});this._adjustArrow(n);h={left:this.arrowValue.left,top:this.arrowValue.top,height:this.model.tip.size.height,width:this.model.tip.size.width,display:$(this.tip).css("display")};this.tooltipPos.top=u=u!=1?u:i.top;this.tooltipPos.left=r=r!=1?r:i.left;a=$(this.tooltip).width();v=$(this.tooltip).height();(o||s&&h.display!="none")&&(this.model.isBalloon&&(o&&(this.arrowValue.left=this._horizontalAdjustment(n,t)),s&&(this.arrowValue.top=this._verticalAdjustment(n,t))),this.arrowValue.left==-this.model.tip.size.height||this.arrowValue.left==a?$(this.tip).css({left:this.arrowValue.left+"px",top:this.arrowValue.top+"px",display:"block"}):this.arrowValue.top==-this.model.tip.size.height||this.arrowValue.top==v?$(this.tip).css({left:this.arrowValue.left+"px",top:this.arrowValue.top+"px",display:"block"}):$(this.tip).css({left:this.arrowValue.left+"px",top:this.arrowValue.top+"px",display:"none"}));this._shadowEffect(this.model.showShadow,n)},t.prototype._horizontalAdjustment=function(n,t){var r={left:this.arrowValue.left,top:this.arrowValue.top},u,i;return $(this.tooltip).css({display:"block"}),u=n.target.horizontal!="center"?this.model.tip.size.height:this.model.tip.size.height,i=n.target.horizontal!="center"&&n.stem.horizontal=="left"?$(this.tip).offset().left:n.target.horizontal!="center"&&n.stem.horizontal=="right"?$(this.tip).offset().left+u:$(this.tip).offset().left,$(this.tooltip).css({display:"none"}),i>t.leftSpace&&i+ut.leftSpace+this.targetPos.width||it.topSpace&&it.topSpace+this.targetPos.height)&&(r.top=t.topSpace+this.targetPos.height/2-parseInt(this.tooltipPos.top.toString())),r.top)},t.prototype._createHeader=function(){this.model.title!=null&&(ej.isNullOrUndefined(this.tooltipTitle)&&this._createTitle(),ej.isNullOrUndefined(this.tooltipContent)?$(this.tooltipHeader).appendTo(this.tooltipInter).addClass("e-tooltipHeader"):$(this.tooltipHeader).insertBefore(this.tooltipContent).addClass("e-tooltipHeader"));this.model.closeMode==ej.Tooltip.CloseMode.Sticky&&this._iconRender()},t.prototype._hideTooltip=function(){var n;if(this._isHidden=!0,n=this.model.animation.speed!=0?this.model.animation.speed:this.model.animation.effect==ej.Tooltip.Effect.Slide?200:this.model.animation.effect==ej.Tooltip.Effect.Fade?800:0,this.model.enabled==!0&&$(this.tooltip).css("display")=="block"){if(this.triggerEvents("beforeClose",{}))return;if(this.model.animation.effect==ej.Tooltip.Effect.Fade?$(this.tooltip).fadeOut(n):this.model.animation.effect==ej.Tooltip.Effect.Slide?$(this.tooltip).slideUp(n):$(this.tooltip).css({display:"none"}),$(this.tooltip).css("display")=="none"&&$(this.tooltip).attr("aria-hidden","true").removeClass("e-customAnimation"),this.triggerEvents("close",{}))return}},t.prototype._showTooltip=function(){if(this._isHidden){var n=this.model.animation.speed!=0?this.model.animation.speed:this.model.animation.effect==ej.Tooltip.Effect.Slide?200:this.model.animation.effect==ej.Tooltip.Effect.Fade?800:0;if(this._isHidden=!1,$(this.tooltip).css("display")=="none"&&this.model.enabled==!0&&(this.model.animation.effect==ej.Tooltip.Effect.Fade?$(this.tooltip).fadeIn(n):this.model.animation.effect==ej.Tooltip.Effect.Slide?$(this.tooltip).slideDown(n):$(this.tooltip).css({display:"block"}),$(this.tooltip).css("display")=="block"&&($(this.tooltip).attr("aria-hidden","false").css({zIndex:ej.getMaxZindex()+1}),this.model.animation.effect==ej.Tooltip.Effect.None&&$(this.tooltip).addClass("e-customAnimation"),this._getScrollableParents()),this.triggerEvents("open",{})))return}},t.prototype._getScrollableParents=function(){var n=$(this.element).parentsUntil("html").filter(function(){$(this).css("overflow")!="visible"}).add($(window));this._on(n,"scroll",this._hideTooltip)},t.prototype._tooltipAuto=function(){var n=this;this.timer=setTimeout(function(){n._hideTooltip()},n.model.autoCloseTimeout)},t.prototype._beforeOpenTooltip=function(n){this.positionTooltip=$.extend(!0,{},this.model.position.stem);this.positionTarget=$.extend(!0,{},this.model.position.target);this.targetElement=this.element;ej.isNullOrUndefined(this.model.target)||ej.isNullOrUndefined($(n.currentTarget).attr("data-content"))||(this.model.content=$(n.currentTarget).attr("data-content"),this._setContent(this.model.content))},t.prototype._targetHover=function(n){if(this.isTrack=!0,this.model.enabled)if(this._isHidden||(ej.browserInfo().name=="msie"||ej.browserInfo().name=="edge")&&this.model.associate==ej.Tooltip.Associate.MouseFollow){if(this.tooltip.stop(!0,!0),this.triggerEvents("beforeOpen",{event:n})){this._isCancel=!0;return}this._isCancel=!1;this._beforeOpenTooltip(n);this.model.associate!=ej.Tooltip.Associate.MouseEnter&&this.model.associate!=ej.Tooltip.Associate.MouseFollow?(ej.isNullOrUndefined(this.model.target)?this._positionElement(this.element):this._positionElement(n.currentTarget),clearTimeout(this.timer),this._showTooltip(),this.model.closeMode==ej.Tooltip.CloseMode.Auto&&this._tooltipAuto(),n.type=="click"?this.triggerEvents("click",{event:n}):this.triggerEvents("hover",{event:n})):this.isTrack=!0}else ej.isNullOrUndefined(this.model.target)||this._positionElement(n.currentTarget)},t.prototype._onMouseOut=function(){this.model.enabled&&!this._isHidden&&(this.model.closeMode==ej.Tooltip.CloseMode.None&&this._hideTooltip(),clearTimeout(this.mouseTimer));this.isTrack=!1},t.prototype._onTooltipMouseEnter=function(){var n=this;this.model.enabled&&this.model.animation.effect==ej.Tooltip.Effect.None&&$(n.tooltip).css({display:"block"})},t.prototype._onTooltipMouseLeave=function(){var n=this;this.model.enabled&&this.model.animation.effect==ej.Tooltip.Effect.None&&n.model.closeMode==ej.Tooltip.CloseMode.None&&$(n.tooltip).css({display:"none"})},t.prototype._docTouchEndHandler=function(n){$(n.target).closest(".e-tooltip").length||this.model.closeMode!=ej.Tooltip.CloseMode.None||this._hideTooltip()},t.prototype._keyDown=function(n){var t=n.keyCode?n.keyCode:n.which?n.which:n.charCode;if(this.model.enabled)switch(t){case 27:n.preventDefault();this._hideTooltip()}},t}(ej.WidgetBase);window.ej.widget("ejTooltip","ej.Tooltip",new ejTooltip);window.ejTooltip=null;ej.Tooltip.CloseMode={Auto:"auto",None:"none",Sticky:"sticky"};ej.Tooltip.Effect={Slide:"slide",Fade:"fade",None:"none"};ej.Tooltip.Trigger={Hover:"hover",Click:"click",Focus:"focus"};ej.Tooltip.Collision={Flip:"flip",FlipFit:"flipfit",None:"none",Fit:"fit"};ej.Tooltip.Associate={Window:"window",MouseFollow:"mousefollow",MouseEnter:"mouseenter",Target:"target",Axis:"axis"},function($,ej,undefined){ej.widget("ejListView","ej.ListView",{_rootCSS:"e-lv",validTags:["div"],_prefixClass:"e-",defaults:{fieldSettings:{navigateUrl:"navigateUrl",href:"href",enableAjax:"enableAjax",preventSelection:"preventSelection",persistSelection:"persistSelection",text:"text",enableCheckMark:"enableCheckMark",checked:"checked",primaryKey:"primaryKey",parentPrimaryKey:"parentPrimaryKey",imageClass:"imageClass",imageUrl:"imageUrl",childHeaderTitle:"childHeaderTitle",childId:"childId",childHeaderBackButtonText:"childHeaderBackButtonText",renderTemplate:"renderTemplate",templateId:"templateId",attributes:"attributes",mouseUp:"mouseUp",mouseDown:"mouseDown",groupID:"groupID",id:"id"},mouseDown:null,mouseUp:null,items:[],dataSource:null,query:null},dataTypes:{dataSource:"data",query:"data",itemRequestCount:"number",fieldSettings:"data",renderMode:"enum",theme:"enum",enablePersistence:"boolean"},observables:["selectedItemIndex","dataSource"],selectedItemIndex:ej.util.valueFunction("selectedItemIndex"),dataSource:ej.util.valueFunction("dataSource"),checkedIndices:ej.util.valueFunction("checkedIndices"),_tags:[{tag:"items",attr:["navigateUrl","href","text","checked","primaryKey","parentPrimaryKey","imageClass","imageUrl","childHeaderTitle","childId","childHeaderBackButtonText","mouseUP","mouseDown","attributes","renderTemplate","templateId","enableAjax","preventSelection","persistSelection","enableCheckMark","attributes"],content:"template"}],_init:function(n){var t;this._options=n;this._preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/};this._storedContent=[];this._storedTemplate=[];this._tempContent=$("body");this._touchStart=this.model.mouseDown;this._touchEnd=this.model.mouseUp;this._oldEle=this.element.clone();this._oldEle.find("ul").length&&(this.model.items=[]);this._indexVal=0;this._setCulture();this._updateModelItems();this.model.allowVirtualScrolling&&(this.dummyUl=$(),this._savedQueries=this.model.query.clone());this._load();t=this.element.closest(".e-nb.e-js");this._isInsideNavigation=t.length;this._isInsideNavigation&&(this._nearestND=t.ejNavigationDrawer("instance"));this._responsive()},_responsive:function(){$(window).on("resize",$.proxy(this._resizeHandler,this))},_resizeHandler:function(){$(this.element).parent().width()==null&&this.model==null?$(this.element).width(this.width):$(this.element).parent().width()<=this.model.width?(this.width=$(this.element).parent().width(),$(this.element).width(this.width)):$(this.element).width(this.model.width)},_itemsObjectCollection:function(n,t,i,r){var f,u;return ej.getAttrVal(n,"data-ej-rendertemplate")&&(f=this._tempContent.find("#"+ej.getAttrVal(n,"data-ej-templateid")),f.length?(u=f.remove(),this._storedTemplate[this._indexVal]=u[0].nodeName&&u[0].nodeName.toLowerCase()=="script"?ej.getClearString(u[0].innerHTML):u[0].outerHTML):this._storedTemplate[this._indexVal]||($(n)[0].innerHTML?this._storedTemplate[this._indexVal]=$(n)[0].innerHTML:this._storedTemplate[this._indexVal]&&this._tempContent.find("#"+template).length&&(u=this._tempContent.find("#"+template).remove(),u=u[0].nodeName&&u[0].nodeName.toLowerCase()=="script"?ej.getClearString(u[0].innerHTML):u[0].outerHTML,this._storedTemplate=ej._pushValue(this._storedTemplate,u,this._indexVal))),this._indexVal++),this._getLiAttributes(n,t,i,r)},_getLiAttributes:function(n,t,i,r){var u={};return u.groupID=r?r:"",u.text=ej.getAttrVal(n,"data-ej-text")?ej.getAttrVal(n,"data-ej-text"):this._getText(n),u.preventSelection=ej.getAttrVal(n,"data-ej-preventselection"),u.persistSelection=ej.getAttrVal(n,"data-ej-persistselection"),u.navigateUrl=ej.getAttrVal(n,"data-ej-navigateurl"),u.href=ej.getAttrVal(n,"data-ej-href"),u.checked=ej.getAttrVal(n,"data-ej-checked"),u.primaryKey=ej.getAttrVal(n,"data-ej-primarykey",t),u.parentPrimaryKey=ej.getAttrVal(n,"data-ej-parentprimarykey",i),u.imageClass=ej.getAttrVal(n,"data-ej-imageclass"),u.imageUrl=ej.getAttrVal(n,"data-ej-imageurl"),u.childHeaderTitle=ej.getAttrVal(n,"data-ej-childheadertitle"),u.childId=u.href?ej.getAttrVal(n,"data-ej-childid")?ej.getAttrVal(n,"data-ej-childid"):"page_"+parseInt(Math.random().toFixed(3)*1e3):"",u.childHeaderBackButtonText=ej.getAttrVal(n,"data-ej-childheaderbackbuttontext"),u.mouseUp=ej.getAttrVal(n,"data-ej-mouseUp"),u.mouseDown=ej.getAttrVal(n,"data-ej-mouseDown"),this.element.find("li").length>0&&(u.attributes=typeof n=="object"?n.attrNotStartsWith(/^data-ej-/):$(n).attrNotStartsWith(/^data-ej-/)),u.renderTemplate=ej.getAttrVal(n,"data-ej-rendertemplate"),u.templateId=this._storedTemplate[this._indexVal-1],u.enableAjax=ej.getAttrVal(n,"data-ej-enableajax"),u.enableCheckMark=ej.getAttrVal(n,"data-ej-enablecheckmark"),u},_renderLists:function(){var t=ej.buildTag("li","",{},{"class":this._prefixClass+"user-select "+this._prefixClass+"list "+this._prefixClass+"state-default{{if "+this.model.fieldSettings.primaryKey+" || "+this.model.fieldSettings.enableAjax+" || "+this.model.enableAjax+"}} "+this._prefixClass+"arrow{{/if}}{{if "+this.model.fieldSettings.imageClass+"}} "+this._prefixClass+"margin{{else}}{{if "+this.model.fieldSettings.imageUrl+"}} "+this._prefixClass+"margin{{/if}}{{/if}}","data-childid":"{{if "+this.model.fieldSettings.primaryKey+"}}child{{>"+this.model.fieldSettings.primaryKey+"}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}","data-childheadertitle":"{{>"+this.model.fieldSettings.childHeaderTitle+"}}","data-childheaderbackbuttontext":"{{>"+this.model.fieldSettings.childHeaderBackButtonText+"}}","data-preventSelection":"{{>"+this.model.fieldSettings.preventSelection+"}}","data-persistSelection":"{{>"+this.model.fieldSettings.persistSelection+"}}","data-navigateUrl":"{{>"+this.model.fieldSettings.navigateUrl+"}}","data-loadajax":"{{>"+this.model.fieldSettings.enableAjax+"}}","data-href":"{{>"+this.model.fieldSettings.href+"}}{{:~_checkAjaxUrls()}}","data-checked":"{{>"+this.model.fieldSettings.checked+"}}","data-templateid":"{{>"+this.model.fieldSettings.renderTemplate+"}}","data-mouseup":"{{>"+this.model.fieldSettings.mouseUp+"}}","data-mousedown":"{{>"+this.model.fieldSettings.mouseDown+"}}","data-id":"{{>"+this.model.fieldSettings.id+"}}"}),n,i,r;if(this.model.renderTemplate)this._hasDataSource()&&this._template&&(n=this._createCheckBox(),t[0].innerHTML=this._template+"{{if "+this.model.fieldSettings.enableCheckMark+" !== undefined}}{{if "+this.model.fieldSettings.enableCheckMark+".toString() == 'false' ? "+this.model.fieldSettings.enableCheckMark+" : "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{else}}{{if "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{/if}}");else{i=ej.buildTag("a","",{},{"class":this._prefixClass+"chevron-right_01 "+this._prefixClass+"remove-shadow{{if "+this.model.fieldSettings.imageClass+"}} "+this._prefixClass+"margin{{else}}{{if "+this.model.fieldSettings.imageUrl+"}} "+this._prefixClass+"margin{{/if}}{{/if}}{{if "+this.model.fieldSettings.primaryKey+" || "+this.model.fieldSettings.enableAjax+" || "+this.model.enableAjax+"}} "+this._prefixClass+"fontimage e-icon{{/if}}",href:ej.browserInfo().name=="msie"&&ej.browserInfo().version<9?"":"{{if "+this.model.fieldSettings.navigateUrl+" == '' || "+this.model.fieldSettings.navigateUrl+" == undefined }}{{else}}{{:"+this.model.fieldSettings.navigateUrl+"}}{{/if}}"});ej.browserInfo().name=="msie"&&ej.browserInfo().version<9&&i.removeAttr("href");var u=ej.buildTag("span","{{>"+this.model.fieldSettings.text+"}}",{},{"class":this._prefixClass+"list-text "+this._prefixClass+"rel "+this._prefixClass+"user-select{{if "+this.model.fieldSettings.imageClass+"}} "+this._prefixClass+"text{{else}}{{if "+this.model.fieldSettings.imageUrl+"}} "+this._prefixClass+"text{{/if}}{{/if}}"}),f=ej.buildTag("div","",{},{"class":this._prefixClass+"list-img "+this._prefixClass+"rel "+this._prefixClass+"user-select {{>"+this.model.fieldSettings.imageClass+"}}"}),n=this._createCheckBox();i[0].innerHTML=this.model.renderMode=="windows"&&ej.isMobile()?"{{if !"+this.model.fieldSettings.primaryKey+"}}{{if "+this.model.fieldSettings.enableAjax+" == undefined || "+this.model.fieldSettings.enableAjax+".toString() == 'false'}}{{if !"+this.model.fieldSettings.navigateUrl+"}}{{if "+this.model.fieldSettings.enableCheckMark+" !== undefined}}{{if "+this.model.fieldSettings.enableCheckMark+".toString() == 'false' ? "+this.model.fieldSettings.enableCheckMark+" : "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{else}}{{if "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{/if}}{{/if}}{{/if}}{{/if}}{{if "+this.model.fieldSettings.imageClass+"}}"+f[0].outerHTML+"{{else}}{{if "+this.model.fieldSettings.imageUrl+"}}{{:~_checkImgUrls()}}{{/if}}{{/if}}"+u[0].outerHTML:"{{if "+this.model.fieldSettings.imageClass+"}}"+f[0].outerHTML+"{{else}}{{if "+this.model.fieldSettings.imageUrl+"}}{{:~_checkImgUrls()}}{{/if}}{{/if}}"+u[0].outerHTML+"{{if !"+this.model.fieldSettings.primaryKey+"}}{{if "+this.model.fieldSettings.enableAjax+" == undefined || "+this.model.fieldSettings.enableAjax+".toString() == 'false'}}{{if !"+this.model.fieldSettings.navigateUrl+"}}{{if "+this.model.fieldSettings.enableCheckMark+" !== undefined}}{{if "+this.model.fieldSettings.enableCheckMark+".toString() == 'false' ? "+this.model.fieldSettings.enableCheckMark+" : "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{else}}{{if "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{/if}}{{/if}}{{/if}}{{/if}}";t[0].innerHTML="{{if "+this.model.fieldSettings.renderTemplate+" == undefined || "+this.model.fieldSettings.renderTemplate+".toString() == 'false'}}"+i[0].outerHTML+"{{else}}{{:templateId}}{{/if}}"}return this.model.renderMode=="ios7"&&(r=ej.buildTag("div."+this._prefixClass+"list-div"),r[0].innerHTML=t[0].innerHTML,t.empty().append(r)),t},_updateContent:function(n,t){var e=this,i=$(n),r=i.attr("data-childid"),f,u;id=this._isInsideNavigation&&n.attr("data-href")?$("body").find($("#"+r)):this.element.find($("#"+r));id.length&&(f=this.element.find("#"+r+"_header"),this.model.enableFiltering&&this._initializeFiltering($(id)),u=i.attr("data-childheadertitle")==undefined?n.text():i.attr("data-childheadertitle"),f.hasClass("e-header")&&this._setHeaderVal(r,u,t),id.attr("data-hdr-title",u).attr("data-hdr-bckbtn",t),this._initEJCheckBox(id),this._isInsideNavigation&&n.attr("data-href")&&this._nearestND.model.contentId?$("body").find(".e-lv.subpage.e-childitem")&&$("#"+this._nearestND.model.contentId).empty().append(id.show()):(i.closest(".subpage").hide(),id.show(),this._childContainer=id.find("."+this._prefixClass+"list-container"),this._childContainer.ejScroller({height:this._childContainer.height(),width:0,scrollerSize:20}),this.scrollerObj=this._childContainer.ejScroller("instance"),this._containerHeight=this.element.height()-ej.getDimension(this._lbEle.find("."+this._prefixClass+"lv-inputdiv"),"outerHeight")-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight"),this.model.height!==null&&this._childContainer.height()>this._containerHeight&&this._refreshScroller(this._childContainer,!0),this.scrollerObj&&(this.scrollerObj.refresh(),$(this.scrollerObj.element).find(".e-vhandlespace").css("height",$(this.scrollerObj.element).find(".e-vhandlespace").height()-1)),$(this.element.children()[0]).removeClass("e-slideright"),id.addClass("e-slideleft")))},_renderHeader:function(n,t,i,r){var u=ej.buildTag("div","",{},{id:n+"_header","class":"e-header e-box"});return t?(u.append("<\/span>"),u.append("
      "+(r?r:"Back")+"<\/div>")):u.append("
      "+i+"<\/div>"),u},_setHeaderVal:function(n,t,i){this._onBackButtonDelegate=$.proxy(this._onBackButtonClick,this);ej.listenTouchEvent($("#"+n+"_header"),ej.endEvent(),this._onBackButtonDelegate,!1,this);var r=this.model.showHeaderBackButton?this.model.headerBackButtonText?this.model.headerBackButtonText:i:i;$("#"+n+"_header").find(".e-btn-text").text(i?r:"Back");$("#"+n+"_header").find(".e-htitle").text(t)},_onBackButtonClick:function(){this.element.find(".e-slideleft").removeClass("e-slideleft");this.element.children(":visible").hide();$(this.element.children()[0]).show();$(this.element.children()[0]).addClass("e-slideright");this.model.enableFiltering&&this._initializeFiltering($(this.element.children()[0]))},_returnData:function(){var checkedItem=this._currentItem.closest("ul.e-list-hdr").find('.e-chkbox-wrap[aria-checked="true"]').closest("li"),elementId=ej.getAttrVal(this._currentItem,"data-id",this._currentItem.text()),items=this.dataSource().length?typeof this.dataSource()=="string"?eval(this.dataSource()):this.dataSource():this.model.items;return{hasChild:this._currentItem.attr("data-childid")&&this._currentItem.attr("data-childid").length>0?this.element.find("#"+this._currentItem.attr("data-childid")).length?!0:!1:!1,item:this._currentItem,text:this._currentItem.text(),index:this._currentItem.index(),isChecked:this._currentItem.find("input.e-lv-check").closest(".e-chkbox-wrap").attr("aria-checked")=="true"?!0:!1,checkedItems:checkedItem.length?checkedItem:null,checkedItemsText:$(checkedItem).map(function(){return $(this).text()}).get(),itemData:this._generateData(items,elementId),checkedValues:this.checkedIndices()}},_initEJCheckBox:function(n){var r=n.find("li"),f=r.length,u,t;for(i=0;i0?(u=this.model.checkedIndices,t=this._hasValue(u,i)):(t=ej.getAttrVal($(r[i]),"data-checked"),t=t=="true"?!0:!1),$($(r[i]).find(".e-lv-check")).ejCheckBox({checked:t});n.find(".e-lv-checkdiv").removeClass("e-lv-checkdiv");n.find(".e-lv-check").parent().addClass("e-lv-checkdiv")},_triggerStartEvent:function(n){this.model.mouseDown=ej.browserInfo().name=="msie"&&ej.browserInfo().version==8?this._touchStart:ej.getAttrVal(this._currentItem,"data-mousedown",this._touchStart);this._trigger("mouseDown",n)},_triggerEndEvent:function(n,t){if(this.model.mouseUp=ej.browserInfo().name=="msie"&&ej.browserInfo().version==8?this._touchEnd:ej.getAttrVal(this._currentItem,"data-mouseup",this._touchEnd),this.selectedItemIndex(this._currentItem.index()),this.model.enablePersistence||this.model.enableCheckMark){var r=this._currentItem.find(".e-chkbox-wrap"),i=this._currentItem.index();r.attr("aria-checked")=="true"||i||$(t.target).parent().hasClass("e-chk-inact")?this._hasValue(this._checkedValues,i)?this._checkedValues.splice(this._checkedValues.indexOf(i),1):this._checkedValues.push(i):this._checkedValues.splice(this._checkedValues.indexOf(i),1)}this.checkedIndices(this._checkedValues);this.model.mouseUp&&this._trigger("mouseUp",n)},_createFilterDiv:function(){return ej.buildTag("div.e-lv-filter",ej.buildTag("input.e-lv-input","",{},{type:"text",placeholder:"search"}))},_emptyFilterTextValue:function(n){n.find(".e-lv-input").val("")},_createListDiv:function(n){this._div=ej.buildTag("div#"+n+"."+this._rootCSS+" subpage e-childitem e-ajaxchild",this.model.showHeader&&this._isInsideNavigation&&!this._nearestND.model.contentId?this._renderHeader(n,!0,this._currentItem.text()):"")},_createCheckBox:function(){return ej.buildTag("input.e-lv-check","",{},{type:"checkbox"})},_toggleCheckboxValue:function(n){n.ejCheckBox({checked:$(n.closest(".e-chkbox-wrap")).attr("aria-checked")=="true"?!1:!0})},_setCheckboxValue:function(n,t){n.ejCheckBox({checked:t})},_convertToRelativeUrl:function(n){return n},_setCulture:function(){this._localizedLabels=this._getLocalizedLabels();ej.isNullOrUndefined(this._options)||(ej.isNullOrUndefined(this._options.headerTitle)||(this._localizedLabels.headerTitle=this._options.headerTitle),ej.isNullOrUndefined(this._options.headerBackButtonText)||(this._localizedLabels.headerBackButtonText=this._options.headerBackButtonText));this.model.headerTitle=this._localizedLabels.headerTitle;this.model.headerBackButtonText=this._localizedLabels.headerBackButtonText},_getLocalizedLabels:function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)}});ej.ListView.Locale=ej.ListView.Locale||{};ej.ListView.Locale["default"]=ej.ListView.Locale["en-US"]={headerTitle:"Title",headerBackButtonText:""};$.extend(!0,ej.ListView.prototype,ej.ListViewBase.prototype)}(jQuery,Syncfusion),function(n,t){t.widget("ejNavigationDrawer","ej.NavigationDrawer",{_setFirst:!0,validTags:["div"],_rootCSS:"e-nb",_prefixClass:"e-",defaults:{isPaneOpen:!1},dataTypes:{isPaneOpen:"boolean"},_init:function(){this._load();this._renderControl();this._renderEJMControls();this._createDelegate();this._wireEvents()},_load:function(){this._browser=this._getBrowserAgent();this.model.position=="normal"?this.model.isPaneOpen?(this.element.siblings().wrapAll("
      <\/div>"),this._pageContainer=this._nbHome=this.element.siblings()):(this._elementWrapper=t.buildTag("div#"+this._id+"_WrapContainer",{},{},{"class":this._rootCSS+" e-nb-container e-nb-"+this.model.direction.toLowerCase()}),this.element.wrapAll(this._elementWrapper),this._nbHome=n("#"+this._id+"_WrapContainer").parent()):(this._nbHome=n("body"),this.element.appendTo(this._nbHome));this._nbHomeCss=this._nbHome.clone(!0)[0].style},_renderEJMControls:function(){this.model.enableListView?(this._lb=t.buildTag("div#"+this._id+"_listview",{},{},{"class":"e-nb-listview"}),this.model.items.length||this.model.listViewSettings.dataSource.length?this._lb.appendTo(this.element):this.element.find(">ul").wrapAll(this._lb),this._lb=n("#"+this._id+"_listview"),this.model.listViewSettings.width||(this.model.listViewSettings.width=240),this.model.listViewSettings.items=this.model.items,this._lb.ejListView(n.extend({},this.model.listViewSettings,{loadComplete:n.proxy(this._setLayout,this)})),this._lbObj=this._lb.data("ejListView"),this._lb.ejListView("selectItem",this.model.listViewSettings.selectedItemIndex)):this.element.find(".e-nb-listview").empty()},_setModel:function(t){var r=!1;for(var i in t){switch(i){case"width":this._setWidth();this._setLayout();break;case"direction":this._setLayout();break;case"type":this._transform(0,0,!0);this._transform(0,0,!1);break;case"isPaneOpen":this.model[i]=t[i];this.element.hide();t[i]?(n(this._elementWrapper,this._elementShadow,this._elementOverlay).remove(),this.element.removeAttr("style").height("100%"),this.element.unwrap()):(this._pageContainer.children().unwrap(),this._pageContainer.remove());this._load();this._shadowWrapper();this.model.enableListView&&this._renderEJMControls();this._wireEvents();break;case"enableListView":this._renderEJMControls();break;default:r=!0}r&&this._refresh()}},_destroyEJMPlugin:function(){this._lb&&(this._lb.ejListView("destroy"),this._lb.children().unwrap());this.model.contentId&&n("#"+this.model.contentId).empty();this._id&&n("#"+this._id).hide()},_getBrowserAgent:function(){return/webkit/i.test(navigator.appVersion)?"webkit":/firefox/i.test(navigator.userAgent)?"Moz":/trident/i.test(navigator.userAgent)?"ms":"opera"in window?"O":""}});n.extend(!0,t.NavigationDrawer.prototype,t.NavigationDrawerBase.prototype);n.extend(!0,t.NavigationDrawer.prototype.defaults.listViewSettings,t.ListView.prototype.defaults);t.NavigationDrawer.prototype._tags=t.ListView.prototype._tags}(jQuery,Syncfusion),function(n,t,r){t.widget("ejListBox","ej.ListBox",{element:null,_ignoreOnPersist:["dataSource","query","itemRequestCount","fields","create","change","select","unselect","itemDragStart","itemDrag","itemDragStop","itemDrop","checkChange","destroy","actionComplete","actionFailure","actionSuccess","actionBegin","itemDropped","selected"],model:null,validTags:["ul"],_setFirst:!1,_rootCSS:"e-listbox",defaults:{itemsCount:null,totalItemsCount:null,dataSource:null,query:t.Query(),itemRequestCount:5,itemHeight:null,fields:{id:null,text:null,imageUrl:null,imageAttributes:null,spriteCssClass:null,htmlAttributes:null,tooltipText:null,selectBy:null,checkBy:null,groupBy:null,tableName:null,selected:null,category:null,toolTipText:null},height:"auto",width:"200",template:null,text:"",selectedIndex:null,checkedIndices:[],selectedIndices:[],cascadeTo:null,value:"",cssClass:"",targetID:null,htmlAttributes:{},showRoundedCorner:!1,enableRTL:!1,enabled:!0,showCheckbox:!1,allowVirtualScrolling:!1,virtualScrollMode:"normal",enablePersistence:!1,allowMultiSelection:!1,allowDrag:!1,allowDrop:!1,enableIncrementalSearch:!1,enableWordWrap:!0,caseSensitiveSearch:!1,loadDataOnInit:!0,create:null,change:null,select:null,unselect:null,itemDragStart:null,itemDrag:null,itemDragStop:null,itemDrop:null,checkChange:null,destroy:null,actionComplete:null,actionSuccess:null,actionBeforeSuccess:null,focusIn:null,focusOut:null,actionFailure:null,actionBegin:null,cascade:null,sortOrder:"none",enableVirtualScrolling:!1,checkAll:!1,uncheckAll:!1,enableLoadOnDemand:!1,itemRequest:null,allowDragAndDrop:r,selectedItemIndex:null,enableItemsByIndex:null,checkItemsByIndex:null,disableItemsByIndex:null,uncheckItemsByIndex:null,itemDropped:null,selected:null,selectIndexChanged:null,selectedItems:[],checkedItems:[],checkedItemlist:[],selectedItemlist:[]},dataTypes:{cssClass:"string",itemsCount:"number",itemRequestCount:"number",allowDrag:"boolean",allowDrop:"boolean",enableWordWrap:"boolean",enableIncrementalSearch:"boolean",caseSensitiveSearch:"boolean",template:"string",targetID:"string",cascadeTo:"string",showRoundedCorner:"boolean",enableRTL:"boolean",enablePersistence:"boolean",enabled:"boolean",allowMultiSelection:"boolean",dataSource:"data",query:"data",checkedIndices:"data",selectedIndices:"data",htmlAttributes:"data",loadDataOnInit:"boolean",showCheckbox:"boolean",sortOrder:"enum"},observables:["value","dataSource"],value:t.util.valueFunction("value"),dataSource:t.util.valueFunction("dataSource"),enable:function(){var n,t;this.listContainer.hasClass("e-disable")&&(this.target.disabled=!1,this.model.enabled=this.model.enabled=!0,this.element.removeAttr("disabled"),this.listContainer.removeClass("e-disable"),this.model.allowMultiSelection&&this.listContainer.removeClass("e-disable"),n=this.listContainer.find(".e-vscrollbar,.e-hscrollbar"),this.model.showCheckbox&&(t=this.listContainer.find("li:not(.e-disable)"),t.find(".listcheckbox").ejCheckBox("enable")),n.length>0&&this.scrollerObj.enable())},disable:function(){if(!this.listContainer.hasClass("e-disable")){this.target.disabled=!0;this.model.enabled=this.model.enabled=!1;this.element.attr("disabled","disabled");this.listContainer.addClass("e-disable");this.model.allowMultiSelection&&this.listContainer.addClass("e-disable");var n=this.listContainer.find(".e-vscrollbar,.e-hscrollbar");this.model.showCheckbox&&this.element.find(".listcheckbox").ejCheckBox("disable");n.length>0&&this.scrollerObj.disable()}},selectItemByIndex:function(t){var u=this.model.selectedIndex,f=this.listitems?this.listitems:this.listitem,i,r;t!=0&&(t=parseInt(t));t==null||this.model.showCheckbox||((t>this.element.find("li:not('.e-ghead')").length||t<0||1/t==-Infinity)&&(t=this.model.selectedIndex),i=n(this.element.find("li:not('.e-ghead')")[t]),i.hasClass("e-select")||(this._activeItem=t,this.element.children("li").removeClass("e-select"),this._selectedItems=[],this.model.selectedIndices=[],i.addClass("e-select"),this._selectedItems.push(i),this.model.selectedIndices.push(t),r=this._getItemObject(i,null),r.isInteraction=!1,this.model.select&&this._trigger("select",r)));this.model.cascadeTo&&(this._activeItem=t,this._cascadeAction());this._setSelectionValues()._OnListSelect(u,this._activeItem)},checkItemByIndex:function(n){typeof n=="number"&&this.checkItemsByIndices(n.toString())},uncheckItemByIndex:function(n){typeof n=="number"&&this.uncheckItemsByIndices(n.toString())},checkItemsByIndices:function(i){var r,u,f,e;if(t.isNullOrUndefined(i))return!1;if(r=i.toString().split(","),r.length>0)for(u=0;u-1||this._checkedItems.push(this._activeItem),n.inArray(f[0],this.model.checkedIndices)>-1||this.model.checkedIndices.push(this._activeItem),e=this._getItemObject(f,null),e.isInteraction=!1,this.model.checkChange&&this._trigger("checkChange",e))));this._setSelectionValues()},uncheckItemsByIndices:function(i){var r,u,f,e,o,s;if(t.isNullOrUndefined(i))return!1;if(r=i.toString().split(","),r.length>0)for(u=0;u-1&&this._checkedItems.splice(o,1),o>-1&&this.model.checkedIndices.splice(o,1),s=this._getItemObject(e,null),s.isInteraction=!1,this.model.checkChange&&this._trigger("checkChange",s)));this._setSelectionValues()},selectAll:function(){var i,t,r;if(!this.model.showCheckbox&&this.model.allowMultiSelection)for(i=this.element.children("li:not('.e-ghead')"),t=0;t=t&&this.model.selectedIndex!=null&&(this.model.selectedIndex==t||n(this.element.children()[t-1]).hasClass("e-disable")?this.model.selectedIndex=null:this.model.selectedIndex!=t&&(this.model.selectedIndex-=1)),f=n(t).length,f>1){for(i=f;i>=0;i--)n(this.element.children()[t[i]]).remove();for(e=this.element.children().length,u=0;u=0;r--)n(this.element.children()[r]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(r),n(this.element.children()[r]).hasClass("e-select")&&this.model.selectedIndices.push(r),n(this.element.children()[r]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(r);for(t=parseInt(t)+1,t;tthis.model.selectedIndex,u;if(this._addListHover(),this._getItem(this._selectedItem).removeClass("e-hover"),o?(t.insertAfter(f),this.model.selectedIndex-=1,t.hasClass("e-disable")&&n.inArray(r.toString(),this._disabledItems)>-1&&(this._disabledItems.splice(n.inArray(r.toString(),this._disabledItems),1),this._disabledItems.push((r+1).toString())),this._selectedItem-=1):s&&(t.insertBefore(f),this.model.selectedIndex+=1,t.hasClass("e-disable")&&n.inArray(r.toString(),this._disabledItems)>-1&&(this._disabledItems.splice(n.inArray(r.toString(),this._disabledItems),1),this._disabledItems.push((r-1).toString())),this._selectedItem+=1),o||s)for(this.model.selectedIndices=[],u=0;u'+r+"<\/li>"):n(this.element.find("li:not('.e-ghead')")[u-1]).after('
    • '+r+"<\/li>"):n(this.element).html('
    • '+r+"<\/li>");this.listitems=this.element.find("li");this._addItemIndex=u;this.model.showCheckbox&&($checkbox=t.buildTag("input.listcheckbox e-align#popuplist"+(this.listitems.length-1)+"_"+this._id,"",{},{type:"checkbox",name:"list"+(this.listitems.length-1)}),n(this.listitems[u]).prepend($checkbox),n(n(this.listitems[u]).find(".listcheckbox")).ejCheckBox({change:n.proxy(this._onClickCheckList,this)}));(this.model.allowDrag||this.model.allowDrop)&&this._enableDragDrop();this._addItemIndex=null;this._refreshItems()}else if(!(this.dataSource()instanceof t.DataManager)){for(o.dataSource()instanceof Object?(dup={},r instanceof Object||(dup[o.model.fields.text]=r,r=dup)):r instanceof Array||(r=[r]),n(r).each(function(n,t){o.dataSource().splice(u,0,t);u=u+1}),this.model.disableItemsByIndex=[],this.model.selectedIndices=[],this.model.checkedIndices=[],this.model.selectedIndex>=f&&(this.model.selectedIndex+=1),e=f-1,e;e>=0;e--)n(this.element.children()[e]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(e),n(this.element.children()[e]).hasClass("e-select")&&this.model.selectedIndices.push(e),n(this.element.children()[e]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(e);for(f;f0&&!(n.inArray(r[u],this._disabledItems)>-1)&&(f=n(this.element.children("li:not('.e-ghead')")[parseInt(r[u])]).addClass("e-disable"),f.find(".listcheckbox").ejCheckBox("disable"),this._disabledItems.push(r[u]))},enableItemsByIndices:function(t){for(var f,i=t.toString().split(","),u,r=0;r0&&n.inArray(i[r],this._disabledItems)>-1&&(u=n.inArray(i[r],this._disabledItems),f=n(this.element.children("li:not('.e-ghead')")[parseInt(i[r])]).removeClass("e-disable"),f.find(".listcheckbox").ejCheckBox("enable"),this._disabledItems.splice(u,1))},_init:function(){this._id=this.element[0].id;this._isMozilla=t.browserInfo().name=="mozilla"?!0:!1;this._cloneElement=this.element.clone();this._deprecatedValue()._initialize()._render()._wireEvents();this._initValue=this.focused=!1;this._typeInterval=null;this._typingThreshold=2e3;this.model.checkAll&&this.checkAll();this.model.uncheckAll&&this.uncheckAll();this.model.disableItemsByIndex&&this.disableItemsByIndices(this.model.disableItemsByIndex.toString());this.model.enableItemsByIndex&&this.enableItemsByIndices(this.model.enableItemsByIndex.toString());this.model.uncheckItemsByIndex&&this.uncheckItemsByIndices(this.model.uncheckItemsByIndex.toString());this._deprecatedValue()._enabled(this.model.enabled)},_deprecatedValue:function(){return this.model.itemDrop=this.model.itemDrop||this.model.itemDropped,this.model.change=this.model.change||this.model.selectIndexChanged,this.model.fields.checkBy=this.model.fields.selected||this.model.fields.checkBy,this.model.fields.tooltipText=this.model.fields.toolTipText||this.model.fields.tooltipText,this.model.fields.groupBy=this.model.fields.category||this.model.fields.groupBy,this.model.select=this.model.select||this.model.selected,this.model.allowDragAndDrop!=r&&(this.model.allowDrag=this.model.allowDrop=!0),this.model.selectedIndex=this.model.selectedIndex!=null?this.model.selectedIndex:this.model.selectedItemIndex,this.model.checkedIndices=(this.model.checkedIndices.length?this.model.checkedIndices:null)||(this.model.checkItemsByIndex?this.model.checkItemsByIndex:null)||(this.model.checkedItems.length?this.model.checkedItems:null)||(this.model.checkedItemlist.length?this.model.checkedItemlist:[]),this.model.selectedIndices=(this.model.selectedIndices.length?this.model.selectedIndices:null)||(this.model.selectedItems.length?this.model.selectedItems:null)||(this.model.selectedItemlist.length?this.model.selectedItemlist:[]),this},_setModel:function(i){var r,f=!1,o,u,c,e;for(r in i)switch(r){case"value":this._setText(t.util.getVal(i[r]));break;case"dataSource":t.isNullOrUndefined(this._isCasCadeTarget)||(this.model.selectedIndex=null);i[r]=t.util.getVal(i[r]);this._checkModelDataBinding(i[r]);break;case"query":this._queryCheck(i[r]);break;case"fields":this.model.fields=n.extend(this.model.fields,i[r]);this._checkModelDataBinding(this.dataSource());break;case"template":this.model.template=i[r];this.refresh(!0);break;case"loadDataOnInit":this._loadContent=i[r];this._checkModelDataBinding(this.dataSource());break;case"enableRTL":this.model.enableRTL=i[r];this.model.enableRTL?this.listContainer.addClass("e-rtl"):this.listContainer.removeClass("e-rtl");break;case"enabled":this.model.enabled=i[r];this._enabled(i[r]);break;case"enableWordWrap":this.model.enableWordWrap=i[r];this._wordWrapItems(i[r]);break;case"height":case"width":this.model[r]=i[r];this._setDimensions();break;case"cssClass":this.model.cssClass=i[r];this.listContainer.addClass(this.model.cssClass);break;case"showCheckbox":this._checkboxHideShow(i[r]);i[r]&&this._removeListHover();break;case"showRoundedCorner":this.model.showRoundedCorner=i[r];this._roundedCorner();break;case"selectedItemIndex":case"selectedIndex":this.listitem[i[r]]||i[r]==null||this.listitems[i[r]]?(this.selectItemByIndex(i[r]),this.model.selectedIndex=this.model.selectedItemIndex=i[r]):i[r]=this.model.selectedIndex;break;case"sortOrder":this.model.sortOrder=i[r];this.dataSource()!=null?this._showFullList():this._renderlistContainer();break;case"checkItemsByIndex":case"checkedItemlist":case"checkedItems":case"checkedIndices":this.uncheckAll();this.checkItemsByIndices(i[r].toString());i[r]=this.model[r]=this.model.checkedIndices;break;case"uncheckItemsByIndex":this.uncheckItemsByIndices(i[r].toString());this.model[r]=i[r];break;case"selectedItemlist":case"selectedItems":case"selectedIndices":this.unselectAll();this.selectItemsByIndices(i[r].toString());i[r]=this.model.selectedIndices;break;case"enableItemsByIndex":this.model[r]=i[r];this.enableItemsByIndices(i[r].toString());break;case"disableItemsByIndex":this.model[r]=i[r];this.disableItemsByIndices(i[r].toString());break;case"enableVirtualScrolling":this.model.allowVirtualScrolling=i[r];f=!0;break;case"allowDrag":case"allowDrop":case"allowDragAndDrop":case"allowVirtualScrolling":case"virtualScrollMode":this.model[r]=i[r];f=!0;break;case"checkAll":this.model[r]=i[r];i[r]?this.checkAll():this.uncheckAll();break;case"uncheckAll":this.model[r]=i[r];i[r]?this.uncheckAll():this.checkAll();break;case"htmlAttributes":this._addAttr(i[r]);break;case"itemsCount":o=this.model.itemsCount;this.model.height?(this.model.itemsCount=i[r],this._setItemsCount()._setDimensions()):i[r]=o;break;case"itemHeight":var s=this.listItemsElement,h=t.isNullOrUndefined(i[r])?i[r]:i[r].toString().replace("px",""),l=t.isNullOrUndefined(this.model.itemHeight)?this.model.itemHeight:this.model.itemHeight.toString().replace("px","");for(u=0;u0&&this._selectCheckedItem(this._selectedItems),this.model.checkedIndices!=null&&this.checkItemsByIndices(this.model.checkedIndices.toString()),this},_initialize:function(){return this._isList=this.element.children().length?!0:!1,this.target=this.element[0],this._queryString=null,this._disabledItems=[],this._itemId=null,this._up=this._down=this._ctrlClick=!1,this.checkedStatus=this._isScrollComplete=!1,this._incqueryString="",this._activeItem=null,this._initValue=!0,this.model.allowVirtualScrolling=this.model.allowVirtualScrolling?this.model.allowVirtualScrolling:this.model.enableLoadOnDemand,this.model.virtualScrollMode=this.model.enableVirtualScrolling?"continuous":this.model.virtualScrollMode,this._selectedItems=[],this._checkedItems=[],this._loadContent=this.model.loadDataOnInit,this._loadInitialRemoteData=!0,this._skipInitialRemoteData=!1,this.model.enableVirtualScrolling&&(this.model.allowVirtualScrolling=!0),this._setItemsCount(),this},_render:function(){return this._savedQueries=this.model.query.clone(),this.model.totalItemsCount&&this._savedQueries.take(this.model.totalItemsCount),this._renderContainer()._addAttr(this.model.htmlAttributes),t.DataManager&&this.dataSource()instanceof t.DataManager?(this.model.actionBegin&&this._trigger("actionBegin",{}),this._loadInitialRemoteData&&this._initDataSource(this.dataSource())):this._showFullList(),this.dataSource()||this._finalize(),this.listItemsElement=this.element.find("li:not('.e-ghead')"),this.model.showRoundedCorner&&this._roundedCorner(),this},_queryCheck:function(n){this._savedQueries=n.clone();this.element.empty();this.dataSource()&&this._checkModelDataBinding(this.dataSource())},_checkModelDataBinding:function(n){this.mergeValue=null;this.dataSource(n);n!=null&&n.length!=0?t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._showFullList():(this.element.empty(),this._refreshScroller())},_initDataSource:function(n){var t=this,i;t.listitems=t.dataSource();t._updateLoadingClass(!0);i=n.executeQuery(this._getQuery());i.done(function(n){t.listitems=n.result;t._updateLoadingClass()._showFullList()._trigger("actionSuccess",n);t._finalize()}).fail(function(n){t.dataSource(null);t._updateLoadingClass(!0)._trigger("actionFailure",n)}).always(function(n){t.model.checkAll&&t.checkAll();t.model.uncheckAll&&t.uncheckAll();t._trigger("actionComplete",n)})},_getQuery:function(){var i,r,n,u;if(t.isNullOrUndefined(this.model.query)){r=[];n=this.model.fields;i=t.Query();for(u in n)u!=="tableName"&&r.push(n[u]);r.length>0&&i.select(r);this.dataSource().dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this._savedQueries;return i},_addDragableClass:function(){if(this.model.allowDrag||this.model.allowDrop){this.element.css("cursor","pointer");this.model.allowDrop&&(this.listContainer.addClass("e-droppable"),this.listBoxScroller.addClass("e-droppable"));var t=this;this.element.children("li").each(function(){t.model.allowDrag&&n(this).addClass("e-draggable");t.model.allowDrop&&n(this).addClass("e-droppable")})}return this},_enableDragDrop:function(){(this.model.allowDrag||this.model.allowDrop)&&this._drag()},_updateLoadingClass:function(n){return this.listContainer[n?"addClass":"removeClass"]("e-load"),this},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.listContainer.addClass(n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._enabled(!1):i.listContainer.attr(t,n)})},_renderContainer:function(){return this.listContainer=t.buildTag("div.e-ddl-popup e-box e-popup e-widget "+this.model.cssClass,"",{visibility:"hidden"},{tabIndex:0,id:this._id+"_container"}),this.listBoxScroller=t.buildTag("div"),this.ultag=t.buildTag("ul.e-ul","",{},{role:"listbox"}),this.element=this.element.addClass("e-ul"),this.listContainer.append(this.listBoxScroller).insertAfter(this.element),this.listBoxScroller.append(this.element),this.element.attr("unselectable","on").css("user-select","none"),this._hiddenInput=t.buildTag("input#"+this._id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element),this._hiddenInput.attr("name",this._id),this},_setMapFields:function(){mapper=this.model.fields;this.mapFld={_id:null,_imageUrl:null,_imageAttributes:null,_tooltipText:null,_spriteCSS:null,_text:null,_value:null,_htmlAttributes:null,_selectBy:null,_checkBy:null};this.mapFld._id=mapper&&mapper.id?mapper.id:"id";this.mapFld._imageUrl=mapper&&mapper.imageUrl?mapper.imageUrl:"imageUrl";this.mapFld._tooltipText=mapper&&mapper.tooltipText?mapper.tooltipText:"tooltipText";this.mapFld._imageAttributes=mapper&&mapper.imageAttributes?mapper.imageAttributes:"imageAttributes";this.mapFld._spriteCSS=mapper&&mapper.spriteCssClass?mapper.spriteCssClass:"spriteCssClass";this.mapFld._text=mapper&&mapper.text?mapper.text:this.listitems[0].text?"text":this._getObjectKey(this.listitems[0])[0];this.mapFld._value=mapper&&mapper.value?mapper.value:"value";this.mapFld._htmlAttributes=mapper&&mapper.htmlAttributes?mapper.htmlAttributes:"htmlAttributes";this.mapFld._checkBy=mapper&&mapper.checkBy?mapper.checkBy:"checkBy";this.mapFld._selectBy=mapper&&mapper.selectBy?mapper.selectBy:"selectBy";this.mapCateg=mapper&&mapper.groupBy?mapper.groupBy:""},_getObjectKey:function(n){var t,i;if(Object.keys)return Object.keys(n);t=[];for(i in n)n.hasOwnProperty(i)&&t.push(i);return t},_itemStyle:function(){var n=t.isNullOrUndefined(this.model.itemHeight)?this.model.itemHeight:this.model.itemHeight.toString().replace("px",""),i=t.isNullOrUndefined(this.model.itemHeight)?"min-height:20px;":"min-height:"+n+"px;height:"+n+"px";return{style:i}},sort:function(){var t=document.createElement("ul"),o,r,s,u,i,f;if(n(t).append(this.itemsContainer.children()),this.model.fields.groupBy!=null||n(t).find(">.e-ghead").length>0){for(o=0;o.e-ghead").length;o++)r=n(t).find(">.e-ghead").eq(0).first().nextUntil(".e-ghead").get(),this._setSortList(t,r);for(s=document.createElement("ul"),u=n(t).clone().find(">.e-ghead").get(),f=0;f.e-ghead").eq(l).first().nextUntil(".e-ghead").get(),m=0;mu?1:0}),i},_setSortList:function(t,i){this._customSort(t,i);this.model.sortOrder.toLowerCase()=="descending"&&i.reverse();(this.model.fields.groupBy!=null||n(t).find(">.e-ghead").length>0)&&(n(t).append(n("
    • ").text(n(t).find(">.e-ghead").eq(0).text()).addClass("e-ghead")),n(t).find(">.e-ghead").eq(0).remove());n.each(i,function(i,r){n(t).append(r)})},_renderlistContainer:function(){var e,s,d,c,l,u,o,y,a,p,i,w,b,h,v,k,f;if(this.hold=this.touchhold=!1,this.item="",this.startime=0,this.listitemheight=24,e=this.listitems,d=this.model.fields,this.lastScrollTop=-1,this.dummyUl=n(),this.model.enableRTL&&this.listContainer.addClass("e-rtl"),this._wordWrapItems(),this.dataSource()==null||this.dataSource().length<1)c=this.element.parents().last(),this.docbdy=this.model.targetID?c.find("#"+this.model.targetID):c.find("#"+this._id),this.itemsContainer=this.docbdy,this.model.sortOrder!="none"&&this.sort(),this.itemsContainer.children("ol,ul").remove(),this.items=this.itemsContainer.children("li"),this.items.children("img").addClass("e-align"),this.items.children("div").addClass("e-align"),l=parseInt(this.model.itemHeight)+"px",this.model.itemHeight&&n("li").css({"min-height":l,height:l}),this.element.append(this.itemsContainer.children());else if(this.dataSource()!=null&&typeof e[0]!="object")if(this._loadInitialRemoteData&&this.mergeValue&&this.model.virtualScrollMode=="continuous"&&this.model.totalItemsCount)this._loadlist(this.mergeValue);else if(this._loadInitialRemoteData&&this.mergeValue&&this.model.virtualScrollMode=="normal"&&this.model.totalItemsCount){for(this.realUllength=0,this.mergeUl=[],i=0;i0){if(this.mergeValue&&this.mergeValue!=u&&this.mergeValue!=r)for(this.mergeUl=[],i=0;i0?this.listContainer.find("ol,ul").children("li:not('.e-ghead')"):this.element.children("li:not('.e-ghead')"),f=this._listitems.find("input[type=checkbox]"),i=0;i0){if(this.listitem.find(".listcheckbox").ejCheckBox("destroy"),this.listitem.find("input[type=checkbox]").remove(),this.model.allowMultiSelection)for(n=0;n0)for(i=0;i1?i._onDragStarts(u,t.target):i._onDragStarts([i._getItemObject(t.element,t)],t.target))return t.cancel=!0,r&&r.remove(),!1}else return!1},drag:function(t){var r=t.target,u=i.getSelectedItems();if(u.length>1?i._onDrag(u,r):i._onDrag([i._getItemObject(t.element,t)],r))return!1;(n(r).hasClass("e-droppable")||n(r).parent().hasClass("e-droppable"))&&n(r).addClass("allowDrop")},dragStop:function(t){t.element.dropped||r&&r.remove();var f=t.target,o=i,s=u?"Before":"After",e=i.getSelectedItems();if((e.length>1?i._onDragStop(e,f):i._onDragStop([i._getItemObject(t.element,t)],f))||(n(t.element).removeClass("e-active"),f.nodeName=="UL"&&(f=n(f).children()[0]),n(f).closest("li").length?f=n(t.target).closest("li")[0]:f.nodeName!="LI"&&(f=n(f).closest(".e-ddl-popup.e-droppable")[0]),f&&f.nodeName=="LI"&&n(f).hasClass("e-droppable")&&n(f).closest(".e-ddl-popup.e-droppable").length?i._dropItem(f,t.element,u,t.event):n(f).hasClass("e-droppable")&&n(f).closest(".e-ddl-popup.e-droppable").length&&i._dropItemContainer(f,t.element,t.event),n(".allowDrop").removeClass("allowDrop"),t.target!=i.element[0]&&t.element.parent().length&&n(t.element.parent()[0]).data().ejWidgets[0]=="ejListBox"&&(i=n("#"+t.element.parent()[0].id).data(n(t.element.parent()[0]).data().ejWidgets[0]),e.length>1?i._onDropped(e,f):i._onDropped([i._getItemObject(t.element),t],t.target))))return!1;i.model.allowDrag||i.model.allowDragAndDrop||i.element.children().removeClass("e-draggable")},helper:function(u){if(!t.isNullOrUndefined(u.element)&&!n(u.element.closest(".e-ddl-popup.e-js")).hasClass("e-disable")&&n(u.element).hasClass("e-draggable")&&(i=n(u.element).closest(".e-listbox.e-js").data("ejListBox"),i._tempTarget=n(u.element).text(),(i.model.allowDrag||i.model.allowDragAndDrop)&&i))return r=n(u.sender.target).clone().addClass("dragClone dragClonelist"),r.addClass(i.model.cssClass+(i.model.enableRTL?" e-rtl":"")),r.css({width:i.element.width(),padding:"5px 5px 5px 0.857em","list-style":"none","text-align":i.model.enableRTL?"right":"left",opacity:"1"}),r.appendTo(n("body"))}})},_dropItem:function(t,i,r,u){var o;i.addClass("e-droppable");var h=n(t).closest(".e-ddl-popup.e-droppable")[0].id.replace("_container",""),s=[],f=[],e=n("#"+h).data("ejListBox"),c=e.model.showCheckbox?!this.model.showCheckbox:this.model.showCheckbox;c||(o=this._getDropObject(t,i,u),s=o.dataIndex,f=o.dataObj,r?n(li).insertBefore(t):n(li).insertAfter(t),this._refreshItems(),f&&this.dataSource()&&this._dropDataSource(e,s,f,li.index()),e._refreshItems())},_dropItemContainer:function(t,i,r){i.addClass("e-droppable");var s=n(t)[0].id.replace("_container",""),u=n("#"+s).data("ejListBox"),h=u.model.showCheckbox?!this.model.showCheckbox:this.model.showCheckbox;if(!h){var e=[],f=[],o=this._getDropObject(t,i,r);e=o.dataIndex;f=o.dataObj;li.insertAfter(n(n(t).find("li")).last());n(t).find("ul").length>0?n(t).find("ul").append(li):n(t).find("ej-listbox").append(li);this._refreshItems();f&&this.dataSource()&&this._dropDataSource(u,e,f,u.dataSource()?u.dataSource().length:0);u.model.allowDrag||n(li).ejDraggable("instance")._destroy();u._refreshItems()}},_dropDataSource:function(i,r,u,f){var o=t.DataManager&&this.dataSource()instanceof t.DataManager,e;o||(r instanceof Array?(e=this,n.each(u,function(n){indx=e.dataSource().indexOf(u[n]);e.dataSource().splice(indx,1)})):this.dataSource().splice(r,1),i.dataSource()instanceof Array?i.dataSource().splice.apply(i.dataSource(),[f,0].concat(u)):i.dataSource(u))},_getDropObject:function(t,i){var r=[],u=[];return this.model.allowMultiSelection?(li=n(i).parent().find(".e-select").removeClass("e-select e-hover"),li.length||(li=i.removeClass("e-select e-hover"))):li=i.removeClass("e-select e-hover"),li.length?(proxy=this,n.each(li,function(){r.push(n(this).index());u.push(proxy.dataSource()?proxy.dataSource()[n(this).index()]:null)})):(r=li.index(),u=this.dataSource()?this.dataSource()[r]:null),{dataIndex:r,dataObj:u}},_showResult:function(){var i=this,t;this._refreshContainer();this.element.attr({"aria-expanded":!0});t=this.element.children("li:not('.e-ghead')");this._listSize=t.length;this._ListEventUnbind(t);t.on("touchstart mouseenter",n.proxy(this._OnMouseEnter,this));t.on("touchend mouseleave",n.proxy(this._OnMouseLeave,this));t.on("click",n.proxy(this._OnMouseClick,this));t.on("contextmenu",n.proxy(this._OnMouseContext,this));return i.model.showCheckbox&&i.element.find(".listcheckbox").ejCheckBox({enabled:i.model.enabled}),this},_OnWindowResize:function(){this._refreshContainer();this.listContainer.css("display","block")},refresh:function(){t.isNullOrUndefined(this.model.query)||(this._savedQueries=this.model.query);this.model.dataSource?(this.model.template&&this.element.empty(),this._checkModelDataBinding(this.dataSource())):(this.listContainer.css({height:this.model.height,width:this.model.width}),this._refreshScroller())},_removeListHover:function(){return this._selectedItems=[],this.model.selectedIndices=[],this.model.selectedIndex=null,this.element.children("li").removeClass("e-hover e-select selectItem"),this},_addListHover:function(){this._activeItem=this._selectedItem;var n=this._getItem(this._selectedItem);n.addClass("e-select e-hover");this.scrollerObj.setModel({scrollTop:this._calcScrollTop()});n.focus();this._OnListSelect(this.prevselectedItem,this._selectedItem)},_calcScrollTop:function(n){for(var f=this.element.outerHeight(),r=this.element.find("li"),u=0,i=n?n:this.element.find("li.e-select").index(),t=0;t0)&&(t.keyCode==40||t.keyCode==39?this._disableItemSelectDown():this._disableItemSelectUp(),this._selectedItem=this._activeItem);var i=this._getItem(this._selectedItem);this._selectedItems.push(i)},_getItem:function(t){return n(this.element.children("li:not('.e-ghead')")[t])},_getItemObject:function(n,t){var i=this._elementIndex(n);return{item:n,index:i,text:n.text(),value:n.attr("value")?n.attr("value"):n.text(),isEnabled:!n.hasClass("e-disable"),isSelected:n.hasClass("e-select"),isChecked:n.find(".e-chk-image").hasClass("e-checkmark"),data:this.dataSource()?this.getListData()[i]:null,event:t?t:null}},_roundedCorner:function(){return this.listContainer[this.model.showRoundedCorner?"addClass":"removeClass"]("e-corner-all"),this},_enabled:function(n){return n?this.enable():this.disable(),this},_showFullList:function(){return this.dataSource()!=null&&(t.DataManager&&this.dataSource()instanceof t.DataManager||(this.listitems=this.dataSource()),!this._savedQueries.queries.length||t.DataManager&&this.dataSource()instanceof t.DataManager||(this.listitems=t.DataManager(this.dataSource()).executeLocal(this._savedQueries))),this._renderlistContainer(),this.dataSource()instanceof t.DataManager||this._trigger("actionComplete"),this._addDragableClass()._enableDragDrop(),this._disabledItems=[],this.disableItemsByIndices(this.model.disableItemsByIndex),this.model.selectedIndex==0?this.selectItemByIndex(this.model.selectedIndex):this.model.selectedIndex&&this.selectItemByIndex(this.model.selectedIndex),this.selectItemsByIndices(this.model.selectedIndices),this.checkItemsByIndices(this.model.checkedIndices),this._tooltipList(),this},_tooltipList:function(){this.listContainer.find("li").hasClass("e-tooltip")&&n(this.listContainer).ejTooltip({target:".e-tooltip",isBalloon:!1,position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}}})},_cascadeAction:function(){if(this.model.cascadeTo){this._currentValue=this._getField(this.listitems[this._activeItem],this.mapFld._value);this.selectDropObj=n("#"+this.model.cascadeTo).ejListBox("instance");n.extend(!0,this.selectDropObj,{_isCasCadeTarget:!0});t.isNullOrUndefined(this._dSource)&&(this._dSource=this.selectDropObj.dataSource());this._performJsonDataInit();var i={cascadeModel:this.selectDropObj.model,cascadeValue:this._currentValue,setCascadeModel:{},requiresDefaultFilter:!0};this._trigger("cascade",i);this.selectDropObj._setCascadeModel=i.setCascadeModel}},_performJsonDataInit:function(){this._changedSource=t.DataManager(this._dSource).executeLocal(t.Query().where(this.mapFld._value,"==",this._currentValue));this.selectDropObj.setModel({dataSource:this._changedSource,enable:!0,value:"",selectedIndex:-1})},_OnMouseContext:function(n){return n.preventDefault(),!1},_OnMouseEnter:function(t){var i,r,u;this.startime=0;this.item="";t.type=="touchstart"&&(this.item=n(t.target).text(),this.startime=(new Date).getTime());this.model.enabled&&(this.element.children("li").removeClass("e-hover"),n(t.target).is("li")&&n(t.target).addClass("e-hover"),n(t.target).hasClass("e-disable")?n(t.target).removeClass("e-hover"):t.target.tagName!="li"&&(i=n(t.target).parents("li"),n(i).addClass("e-hover")),u=0,this.element.children("li:not('.e-ghead')").each(function(t){if(n(this).hasClass("e-hover"))return r=t,!1}),this._hoverItem=r)},_OnMouseLeave:function(t){this.element.children("li").removeClass("e-hover");this.endtime=(new Date).getTime();(this.endtime-this.startime)/200>2&&this.item==n(t.target).text()&&(this.hold=(this.endtime-this.startime)/200>2?!this.hold:!1)},_OnMouseClick:function(i){var u,o,s,e,f,c,h;if(n(i.currentTarget).hasClass("e-disable"))return!1;if(i.which==3&&(this.hold=!0),this.endtime=(new Date).getTime(),(this.endtime-this.startime)/200>2&&(this.model.template||this.item!=n(i.target).text()||this.hold||(this.hold=(this.endtime-this.startime)/200>2)),i.shiftKey&&this._shiftkey&&(this._shiftkey=!1,this.prevselectedItem=this._activeItem),t.isNullOrUndefined(this._hoverItem)||(this._activeItem=this._hoverItem),this.model.enabled&&this._activeItem!=r){if((!i.shiftKey||isNaN(this.prevselectedItem))&&(this._shiftkey=!0,this.prevselectedItem=this._lastEleSelect?this._lastEleSelect:this._activeItem),this.model.showCheckbox){if(n(i.currentTarget).is("li")&&n(i.target).is("li"))n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("isChecked")?(n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("option","checked",!1),f=this.model.checkedIndices.indexOf(n(i.currentTarget).index()),this._checkedItems.splice(f,1),this.model.checkedIndices.splice(f,1),this.checkedStatus=!1):(n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("option","checked",!0),this._checkedItems.push(this._activeItem),this.model.checkedIndices.push(this._elementIndex(i.currentTarget)),this.checkedStatus=!0);else if(n(i.currentTarget).is("li")&&n(i.target).is("li"))n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("isChecked")?(this._checkedItems.push(this._activeItem),this.model.checkedIndices.push(n(i.currentTarget).index()),this.checkedStatus=!0):(f=this.model.checkedIndices.indexOf(n(i.currentTarget).index()),this._checkedItems.splice(f,1),this.model.checkedIndices.splice(f,1),this.checkedStatus=!1);else return!1;this.selectedTextValue=n(i.currentTarget).text();!this.element.hasClass("e-disable")&&n(i.target).is("li")&&(c={status:this.model.enabled,isChecked:this.checkedStatus,selectedTextValue:this.selectedTextValue},h=this._getItemObject(n(i.target),i),h.isInteraction=!0,this._trigger("checkChange",h));this._lastEleSelect=n(i.currentTarget).index()}else u=n(this.element.children("li:not('.e-ghead')")[this._hoverItem]),this.model.allowMultiSelection&&(i.ctrlKey||this.touchhold||this.hold||i.shiftKey)||this._removeListHover(),this.element.children("li").removeClass("e-hover"),!u.hasClass("e-select")||i.shiftKey&&this.model.allowMultiSelection?(u.addClass("e-select"),this._selectedItems.push(u),this.model.selectedIndices.push(this._activeItem),i.shiftKey&&this.model.allowMultiSelection&&(i.ctrlKey||this._removeListHover(),this.prevselectedItem=0&&(this.model.selectedIndex=this._activeItem),o=this.element.children("li:not('.e-ghead')"),this.element.children("li:not('.e-ghead').e-select").each(function(r,f){u.push(n(f).attr("value")?n(f).attr("value"):!t.isNullOrUndefined(i.model.fields.text)&&i.dataSource()?i.getListData()[i._elementIndex(f)][i.model.fields.text]:n(f).text());i.model.selectedIndices.push(o.index(f))})),t.DataManager&&t.DataManager&&this.dataSource()instanceof t.DataManager&&this.model.allowVirtualScrolling)if(this.model.showCheckbox)for(r=0;r-1;i++)this._activeItem--,this._activeItem<0&&(this._activeItem=this.listitems.length-1);n(this.element.children("li")[this._activeItem]).addClass("e-select")},_disableItemSelectDown:function(){var t,i;for(this._disableItemSelectCommon(),t=typeof this.model.disableItemsByIndex!="object"?this.model.disableItemsByIndex.split(",").sort():this.model.disableItemsByIndex,this.listitems.length-1==this._activeItem?this._activeItem=0:this._activeItem++,i=0;n.inArray(this._activeItem.toString(),t.toString())>-1;i++)this._activeItem++,this.listitems.length==this._activeItem&&(this._activeItem=0);n(this.element.children("li")[this._activeItem]).addClass("e-select")},_checkitems:function(){var r,t;if(this.model.showCheckbox)for(r=this.element.find("li:not('.e-ghead')"),i=0;i0?this._pageUpStep-f:0,end=this._pageDownStep):(start=this.prevselectedItem,end=this._pageDownStep-f>this.prevselectedItem?this._pageDownStep-f:this.prevselectedItem),this._shiftHomeAndEndKeyProcess(start,end,end>this.prevselectedItem?end:start),this._pageUpStep=start,this._pageDownStep=end):this._moveUp(this._activeItem,f);this._preventDefaultAction(t);break;case 34:f=t.keyCode==34?l:1;t.shiftKey&&this.model.allowMultiSelection?(this._pageUpStep==null&&(this._pageUpStep=this.prevselectedItem),this._pageDownStep==null&&(this._pageDownStep=this.prevselectedItem),this._pageUpStep==0&&this.prevselectedItem!=0?this._pageUpStep+f>=this.prevselectedItem?start=end=this.prevselectedItem:(start=this._pageUpStep+f,end=this._pageDownStep+f=this.prevselectedItem?start=end=this.prevselectedItem:(start=this._pageUpStep,end=this._pageDownStep+fthis.prevselectedItem&&(end=this.prevselectedItem),this._shiftHomeAndEndKeyProcess(start,end,start0;i--)if(!n(this.element.find("li")[i]).hasClass("e-disable"))return this.model.selectedIndex=i,this._shiftSelectItem=i,!1;break;case 36:for(t.shiftKey&&this.model.allowMultiSelection?this._shiftHomeAndEndKeyProcess(0,this._activeItem,0):this._homeAndEndKeyProcess(t,u,0),i=0;ithis._listSize-1?this._checkDisableStep(this._listSize-1,t,!1):n>0&&n<=this._listSize-1&&this._checkDisableStep(n,t,!1)},_moveDown:function(n,t){n==null||n<0?this._checkDisableStep(-1,t,!0):n==0?this._checkDisableStep(0,t,!0):n>=this._listSize-1?this._checkDisableStep(this._listSize-1,t,!0):n=0;u--)if(f=i?n+u:n-u,r=this[e](f),r!=null)break;r!=null&&this.selectItemByIndex(r)},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t0)return this._disableItemSelectUp(t-1)}},_preventDefaultAction:function(n,t){n.preventDefault?n.preventDefault():n.returnValue=!1;t&&(n.stopPropagation?n.stopPropagation():n.cancelBubble=!0)},_homeAndEndKeyProcess:function(t,i,r){if(n(":focus").length&&n(":focus")[0].nodeName!="INPUT")return this._OnListSelect(this._selectedItem,r),this.selectItemByIndex(r),this._selectedItem=r,this.scrollerObj.setModel({scrollTop:this._calcScrollTop(r)}),this.model.showCheckbox&&(this._removeListHover(),n(i[r]).addClass("e-hover"),this._lastEleSelect=this._selectedItem=r),this._keyCascade(i[r],t),t.preventDefault(),!1},_shiftHomeAndEndKeyProcess:function(n,t,i){return this._removeListHover(),this._activeItemLoop(n,t),this.scrollerObj.setModel({scrollTop:this._calcScrollTop(i)}),!1},_keyCascade:function(t,i){var r=this._getItemObject(n(t),i);this.model.selectedText=r.text;r.isInteraction=!0;this._trigger("select",r);this.model.cascadeTo&&(this._activeItem=this._selectedItem,this._cascadeAction())},mergeData:function(i,r){var u,f;this.mergeUl=n();this._setMapFields();u=this;this._skipInitialRemoteData=r?r:!1;t.DataManager&&i instanceof t.DataManager?(f=i.executeQuery(this._getQuery()),f.done(function(n){u.mergeValue=n.result;u._renderlistContainer()})):(this.mergeValue=i,this.listitems=this.listitems?this.listitems:this.dataSource(),this._renderlistContainer());this._loadInitialRemoteData=!1},_onScroll:function(i){var f,o,s,h,c,u,l,e;if(this._temp=this.dataSource(),this.model.actionBegin&&this._trigger("actionBegin",{}),this._temp!=this.dataSource()&&(t.DataManager&&this.dataSource()instanceof t.DataManager?this._initDataSource(this.dataSource()):this._showFullList()),f=this,o=this.element.find("li")[0],this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal")s=n(o).outerHeight(),this.itemIndex=Math.round(this.scrollerObj.scrollTop()/s),this.realUllength=this.itemIndex,u=this.itemIndex,this.itemIndex>this.listContainer.outerHeight()/n(o).outerHeight()&&(u=this.mergeValue&&u>=this.mergeValue.length?u-this.mergeValue.length:u,e=this.itemIndex+this._getLiCount()),(this.mergeValue&&this.itemIndex<=this.mergeValue.length||u<=0)&&(u=0),this.dataSource().length==r&&this._temp==this.dataSource()?t.DataManager&&this.dataSource()instanceof t.DataManager&&(h=u==0?u:u-1,c=u==this.element.find("li").length?u:u+1,this._queryPromise(h,f,c+Math.ceil(this.model.height/s),i)):this._temp!=this.dataSource()?this._queryPromise(u,f,this._listitems.length,i):this.dataSource().length>0&&this._loadQueryData(u,e,f);else if(this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="continuous"&&this.listItemsElement.length-2<=(this.scrollerObj.scrollTop()+this.listContainer.height())/this.element.find("li").outerHeight()&&(this.lastScrollPosition=this.scrollerObj.scrollTop(),u=this.mergeValue&&!this._skipInitialRemoteData?this.element.children().length-this.mergeValue.length:this.element.children().length,u<=0&&(u=0),this._oldStartValue&&(u=this._oldStartValue),l=this.model.totalItemsCount?this.model.totalItemsCount:this.listitems.length,this.listItemsElement.lengththis.model.totalItemsCount?this.model.totalItemsCount-this.mergeValue.length:u+this.model.itemRequestCount:this.model.totalItemsCount&&u+this.model.itemRequestCount>this.model.totalItemsCount?this.model.totalItemsCount:u+this.model.itemRequestCount,t.DataManager&&this.dataSource()instanceof t.DataManager)if(u<=e)this._queryPromise(u,f,e,i);else return!1;this._oldStartValue=u+this.model.itemRequestCount}else if(this.dataSource().length>0){if(this._isScrollComplete)return;this._loadQueryData(f.realUllength,f.realUllength+this.model.itemRequestCount,f)}},_queryPromise:function(n,t,i,r){this._trigger("itemRequest",{event:r,isInteraction:!0});this._setMapFields();var u=this._savedQueries.clone(),f=this.dataSource().executeQuery(u.range(n,i));this._updateLoadingClass(!0);f.done(function(i){t._trigger("actionBeforeSuccess",i);t.realUllength=r.source!="wheel"?t.mergeValue?t.mergeValue.length+n:n:n;t._loadlist(i.result)._checkboxHideShow(t.model.showCheckbox)._showResult()._updateLoadingClass();t._applySelection();t.model.virtualScrollMode=="continuous"&&(t.scrollerObj.refresh(),t.scrollerObj.option("scrollTop",t.lastScrollPosition));t._trigger("actionSuccess",i)}).fail(function(n){t._trigger("actionFailure",n)}).always(function(n){t._trigger("actionComplete",n)})},_selectListItems:function(){var t=this.element.find("li:not('.e-ghead')");for(i=0;i=this.listitems.length?!0:!1;this._updateLoadingClass(!0);var r=this.dataSource();this._loadlist(r.slice(n,t))._showResult()._updateLoadingClass();i._applySelection();i.model.virtualScrollMode=="continuous"&&(i.scrollerObj.option("scrollTop",i.lastScrollPosition),i.scrollerObj.refresh())},_setText:function(t){for(i=0;i0&&this._typeInterval==null&&(this._typeInterval=setTimeout(function(){_proxy._incqueryString="";_proxy._typeInterval=null},_proxy._typingThreshold));var f=this.listContainer.find("ol,ul").children("li:not('.e-category')"),i,c=this.model.caseSensitiveSearch,r,h=this._incqueryString,l=this._incqueryString.length,e=!1;for(c||(h=h.toLowerCase()),o=this._activeItem,--o,s=this._activeItem!=f.length-1?this._activeItem+1:0,this._incqueryString.length>1&&(s=this._activeItem),i=s;i0&&(this.element[0].type="text"),this._isWatermark="placeholder"in document.createElement("input"),this.model.locale=t.preferredCulture(this.model.locale).name=="en"?"en-US":t.preferredCulture(this.model.locale).name,this._localizedLabels=this._getLocalizedLabels(),this.culture=t.preferredCulture(this.model.locale),this._browsername=t.browserInfo().name,this._initCustomValue(),this._prevSeparator=null,this._checkSeparator(this.model.groupSeparator),this._checkAttribute(),this._renderControl(),this._setValues(),this._wireEvents(),this._initObjects(),this._addAttr(this.model.htmlAttributes),this.model.validationRules!=null&&(this._initValidator(),this._setValidation()),this._updateSeparator(),n&&n.value!=i&&this._trigger("_change",{value:this.model.value});else return this._destroy(),!1},_checkAttribute:function(){for(var u=["min","max","step","readonly","disabled","placeholder"],f=["minValue","maxValue","incrementStep","readOnly","enabled","watermarkText"],i,n,r=0;r<\/span>');i.find(".e-spin-up").append(t.buildTag("span.e-icon e-arrow e-arrow-sans-up").attr({role:"presentation",unselectable:"on"}));i.find(".e-spin-down").append(t.buildTag("span.e-icon e-arrow e-arrow-sans-down").attr({role:"presentation",unselectable:"on"}));this.innerWrap.append(i);this.spin=this.wrapper.find(".e-select");this.spinUp=this.wrapper.find(".e-spin-up");this.spinDown=this.wrapper.find(".e-spin-down");this._setWidth(this.model.width);this._setHeight(this.model.height);this.model.cssClass!=""&&this._setSkin(this.model.cssClass);this._showSpin(this.model.showSpinButton);this.model.showRoundedCorner&&this._roundedCorner(this.model.showRoundedCorner);this.model.enableRTL&&this._enableRTL(this.model.enableRTL);this.model.readOnly&&this._setReadOnly(this.model.readOnly);this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&this.enable():this.disable()},_initObjects:function(){this._preVal=this.model.value;this.model.value===null?(this.isValidState=!0,this._hiddenInput.val(null)):(this.model.valuethis.model.maxValue)&&(this.isValidState=!1);this._checkErrorClass();this._setWaterMark()},_showSpin:function(n){n?(this.spin&&(this.spin.show(),this.innerWrap.addClass("e-padding")),this._spinEvents("_on")):(this.spin&&(this.spin.hide(),this.innerWrap.removeClass("e-padding")),this._spinEvents("_off"))},_roundedCorner:function(n){n&&!this.innerWrap.hasClass("e-corner")?this.innerWrap.addClass("e-corner"):this.innerWrap.hasClass("e-corner")&&this.innerWrap.removeClass("e-corner")},_enableRTL:function(n){n?this.spin?this.wrapper.addClass("e-rtl"):this.element.addClass("e-rtl"):this.spin?this.wrapper.removeClass("e-rtl"):this.element.removeClass("e-rtl")},_setWidth:function(n){n!=""?this.wrapper.width(n):this.model.width=this.wrapper.outerWidth()},_setHeight:function(n){n!=""?this.wrapper.height(n):this.model.height=this.wrapper.outerHeight()},_setSkin:function(n){this.wrapper.removeClass(this.model.cssClass);this.wrapper.addClass(n)},_setValue:function(n,t){this._isWatermark||this._hiddenSpan.css("display","none");this.model.value=this._checkNumValue(n);this._validateMinMaxValue(!1);this._checkErrorClass();this._localizedFormat();this._raiseChangeEvent(t);this._setWaterMark()},_setLocalize:function(n){var i=t.preferredCulture(this.model.locale).numberFormat[","];this.model.locale=t.preferredCulture(n).name=="en"?"en-US":t.preferredCulture(n).name;this.model.groupSeparator=t.isNullOrUndefined(this._options.groupSeparator)&&i===this.model.groupSeparator?t.preferredCulture(this.model.locale).numberFormat[","]:this.model.groupSeparator;this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText);this._localizedLabelToModel();this.culture=t.preferredCulture(this.model.locale);this._initCustomValue();this._updateSymbol(this.model.locale);this._localizedFormat();this._changeWatermark(this.model.watermarkText);value=t.isNullOrUndefined(this.model.value)?this.model.value:this.model.value.toString().indexOf("e")==-1?this._formatValue(this.model.value,"n",!0):this._convertToExponetial(this.model.value).unformattedValue;this.element.val(value)},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText},_updateSymbol:function(n){this._percentSymbol=t.preferredCulture(n).numberFormat.percent.symbol;this._currencySymbol=t.preferredCulture(n).numberFormat.currency.symbol},_setDecimal:function(n){this.model.decimalPlaces=n;this._localizedFormat()},_validateMinMaxValue:function(n,i){var u=!1,r;this.model.minValue>this.model.maxValue&&(this.model.minValue=this.model.maxValue);!t.isNullOrUndefined(this.model.value)&&this.model.minValue>this.model.value?(this.model.enableStrictMode!=!0?(this.isValidState=!0,this._startValue=this.model.value=this.model.minValue):this.isValidState=!1,u=!0):!t.isNullOrUndefined(this.model.value)&&this.model.maxValue0?this._updateInputField("increment"):t<0&&this._updateInputField("decrement");this._cancelEvent(n)}},_numberValue:function(){var n=this._textBox.value;return this.sfType==="ej.NumericTextbox"&&(n=this._formatValue(this.model.value,"n",!0)),this.sfType==="ej.PercentageTextbox"?n=this._formatValue(this.model.value,"n",!0):this.sfType==="ej.CurrencyTextbox"&&(n=this._formatValue(this.model.value,"n",!0)),typeof n=="string"&&!isNaN(this._parseValue(n))?n:""},_formatValue:function(n,i,r){r&&this._updateCultureInfo();var n=t.format(n,i+this.model.decimalPlaces,this.model.locale);return r&&this._restCultureInfo(),n},_parseValue:function(n){this._updateCultureInfo();var n=t.parseFloat(n,this.model.locale);return this._restCultureInfo(),n},_initCustomValue:function(){var n,i=this.sfType=="ej.PercentageTextbox"?"percent":this.sfType=="ej.CurrencyTextbox"?"currency":"numeric";switch(i){case"percent":case"currency":n=this.culture.numberFormat[i];t.isNullOrUndefined(this._options.negativePattern)&&(this.model.negativePattern=n.pattern[0]);t.isNullOrUndefined(this._options.positivePattern)&&(this.model.positivePattern=n.pattern[1]);t.isNullOrUndefined(this._options.currencySymbol)&&i=="currency"&&(this.model.currencySymbol=n.symbol);t.isNullOrUndefined(this._options.groupSize)&&(this.model.groupSize=n.groupSizes[0]);break;case"numeric":n=this.culture.numberFormat;t.isNullOrUndefined(this._options.negativePattern)&&(this.model.negativePattern=n.pattern[0]);t.isNullOrUndefined(this._options.groupSize)&&(this.model.groupSize=n.groupSizes[0])}},_updateCultureInfo:function(){var n,t=this.sfType=="ej.PercentageTextbox"?"percent":this.sfType=="ej.CurrencyTextbox"?"currency":"numeric";n=t=="numeric"?this.culture.numberFormat:this.culture.numberFormat[t];this._oldNegativePattern=n.pattern[0];this._oldGroupSize=n.groupSizes[0];n.pattern[0]=this.model.negativePattern;n.groupSizes[0]=this.model.groupSize;t!="numeric"&&(this._oldPositivePattern=n.pattern[1],n.pattern[1]=this.model.positivePattern);t=="currency"&&(this._oldcurrencySymbol=n.symbol,n.symbol=this.model.currencySymbol)},_restCultureInfo:function(){var n,t=this.sfType=="ej.PercentageTextbox"?"percent":this.sfType=="ej.CurrencyTextbox"?"currency":"numeric";n=t=="numeric"?this.culture.numberFormat:this.culture.numberFormat[t];n.pattern[0]=this._oldNegativePattern;n.groupSizes[0]=this._oldGroupSize;t!="numeric"&&(n.pattern[1]=this._oldPositivePattern);t=="currency"&&(n.symbol=this._oldcurrencySymbol)},_toggleTextbox:function(n){var t=this;t._hiddenInput.toggle(n);t.element.toggle(!n)},_paste:function(n){var i,r;window.clipboardData&&window.clipboardData.getData?i=window.clipboardData.getData("Text"):n.originalEvent.clipboardData&&n.originalEvent.clipboardData.getData&&(i=n.originalEvent.clipboardData.getData("text/plain"));r=t.parseFloat(i,this.model.locale);isNaN(r)?this._cancelEvent(n):(this.element.val(r),this._cancelEvent(n))},_focusIn:function(){if(!this.model.readOnly){if(this._focused=!0,t.isNullOrUndefined(this.model.value)||this.element.val(this._removeSeparator(this.model.value)),this._toggleTextbox(!1),this._textBox=this.element[0],this.element[0].focus(),this._preVal=this.model.value,this._isWatermark||this._hiddenSpan.css("display","none"),this.wrapper.addClass("e-focus"),this.wrapper.removeClass("e-error"),!this._error){if(this._textBox.value!=""){var n=this._formatValue(this._textBox.value,"n",!0);this._textBox.value=n;this._hiddenInput.val(n)}this._setSelectionRange(0,this._textBox.value.length)}this._trigger("focusIn",{value:this.model.value})}},_focusOut:function(){var n;this._focused=!1;this.wrapper.removeClass("e-focus");this._error||(this._textBox.value!=""?(n=t.parseFloat(this._textBox.value,this.model.locale),nthis.model.maxValue&&(this.model.enableStrictMode?this.isValidState=!1:this._textBox.value=this._formatValue(this.model.maxValue,"n",!0)),this.model.value=t.parseFloat(this._textBox.value,this.model.locale),isNaN(this.model.value)&&!this.model.value&&(this.model.value=null,this.isValidState=!1),this._toggleTextbox(!0),this._textBox=this._hiddenInput[0],this._localizedFormat(),this._checkErrorClass()):(n=this._textBox.value==""?null:this._textBox.value,this.model.value=n,this._hiddenInput.val(n),this._toggleTextbox(!0),this._textBox=this._hiddenInput[0]),this.model.value===null||this.model.value>=this.model.minValue&&this.model.value<=this.model.maxValue?this.isValidState=!0:this.model.enableStrictMode&&(this.isValidState=!1),this._raiseChangeEvent(),this._setWaterMark(),n=t.isNullOrUndefined(this.model.value)?this.model.value:this.model.value.toString().indexOf("e")==-1?this._removeSeparator(this.model.value):this._convertToExponetial(this.model.value).unformattedValue,this.element.val(n),this._updateSeparator(),this._trigger("focusOut",{value:this.model.value}));this._checkErrorClass()},_cancelEvent:function(n){return n.cancelBubble=!0,n.returnValue=!1,n.stopPropagation(),n.preventDefault(),!1},_updateInputField:function(i){var f,e,u,r;this.isValidState=!0;this._focused||n(this._hiddenInput[0]).focus();f=this.model.incrementStep;e=this.model.value;this._textBox.value===""?(this._textBox.value=this._formatValue(this._startValue,"n",!0),f=0):this._textBox.value.indexOf(" ")>=0&&(this._textBox.value=this._textBox.value.replace(" ",""));this.sfType==="ej.PercentageTextbox"||this.sfType==="ej.CurrencyTextbox"?(u=this._textBox.value,r=u,u.indexOf(t.preferredCulture(this.model.locale).numberFormat.percent.symbol)>-1&&(r=u.substring(0,u.length-1)),this.model.value=this._parseValue(r)):this.sfType=="ej.NumericTextbox"&&(this.model.value=t.parseFloat(this._textBox.value,this.model.locale));isNaN(this.model.value)&&!this.model.value&&(this.model.value=this._startValue);this.model.value>=this.model.minValue&&this.model.value>this.model.maxValue?(this.model.value=this.model.maxValue,this._setValue(this.model.value)):this.model.value=this.model.minValue&&this.model.value<=this.model.maxValue&&(r=i=="increment"?this.model.value+f:this.model.value-f,r>=this.model.minValue&&r<=this.model.maxValue&&this._setValue(r));this._checkErrorClass()},_validateDecimal:function(n){var i=String.fromCharCode(n.keyCode);return(i=n.keyCode==188?",":n.keyCode==190?".":n.keyCode==110?t.preferredCulture(this.model.locale).numberFormat["."]:i,t.preferredCulture(this.model.locale).numberFormat["."].charCodeAt(0)==i.charCodeAt(0))?!0:!1},_allowKeyCodes:function(n){for(var i=[38,40,35,36,109,189,46,8,127,37,39,190,9,13,16,17,18,20,110,173,86,88,67],t=0;t1?i[0]:i,r.test(i)?this._prevSeparator!=null?this._prevSeparator:t.preferredCulture(this.model.locale).numberFormat[","]:i},_keyPress:function(n){var f,i;if(n.which!==0&&!n.metaKey&&!n.ctrlKey&&n.keyCode!==8&&n.keyCode!==13){var e=this,r=null,u=".";return cursor=this._caretPosition(),beforeCursor=this._textBox.value.toString().substring(0,cursor),afterCursor=this._textBox.value.toString().substring(cursor),numberFormat=t.preferredCulture(this.model.locale).numberFormat,f=String.fromCharCode(n.which),value=beforeCursor+f+afterCursor,i=numberFormat[u],i=i===u?"\\"+i:i,r=e.model.decimalPlaces===0?/^(-)?(\d*)$/:new RegExp("^(-)?(((\\d+("+i+"\\d*)?)|("+i+"\\d*)))?$"),r.test(value)?void 0:!1}},_validateDecimalOnType:function(n){var r,e,s,h,o,u,i,f;return r=this._caretPosition(),s=this._textBox.value.toString().substring(0,r),h=this._textBox.value.toString().substring(r),o=this._getSelection(this._textBox.value),i=t.preferredCulture(this.model.locale).numberFormat["."],u=t.isNullOrUndefined(this.model.value)?"":this.model.value.toString(),this.model.decimalPlaces!=0?(f=this._textBox.value.split(i)[1],e=u.indexOf(i)>0?u.substring(u.indexOf(i)+1,u.length).length>this.model.decimalPlaces?!0:o.length==0&&r>this._textBox.value.indexOf(i)&&f&&f.length>=this.model.decimalPlaces?!0:!1:o.length==0&&r>this._textBox.value.indexOf(i)&&f&&f.length>=this.model.decimalPlaces?!0:!1):e=!1,e?(this._keypressFlag=!1,this._cancelEvent(n),!1):void 0},_keyDown:function(r){var s,a,k,d,v,y,l,h,c,w;if(!this.model.readOnly)if(this._CurrentCultureInfo=JSON.parse(JSON.stringify(t.preferredCulture())),r.keyCode>=48&&r.keyCode<=57||r.keyCode>=96&&r.keyCode<=105||this._allowKeyCodes(r)){if(r.shiftKey&&(r.keyCode==35||r.keyCode==36||r.keyCode==37||r.keyCode==39||r.keyCode==46||r.keyCode==127)||r.ctrlKey&&(r.keyCode==86||r.keyCode==118||r.keyCode==67||r.keyCode==88))return!0;if(r.ctrlKey==!0&&r.keyCode!=9&&r.keyCode!=17&&r.keyCode!=86&&r.keyCode!=67||r.keyCode==67||r.keyCode==86||r.keyCode==88)return this._keypressFlag=!1,this._cancelEvent(r),!1;if((r.keyCode>=48&&r.keyCode<=57||r.keyCode>=96&&r.keyCode<=105||r.keyCode==110)&&(s=this._caretPosition(),k=this._textBox.value.toString().substring(0,s),d=this._textBox.value.toString().substring(s),v=this._getSelection(this._textBox.value),r.keyCode>=96&&r.keyCode<=105&&(r.keyCode-=48),this.model.validateOnType&&this._validateDecimalOnType(r),this._validateOnType)){var u=t.preferredCulture(this.model.locale).numberFormat["."],f=this.model.value.toString(),it=f.indexOf(u),g=this.model.value,e=this.model.minValue.toFixed(this.model.decimalPlaces),o=this.model.maxValue.toFixed(this.model.decimalPlaces),p=!1;if((e.toString().indexOf("e")>0||o.toString().indexOf("e")>0)&&(p=!0),p)this.model.decimalPlaces!=0?(y=this._textBox.value.split(".")[1],a=f.indexOf(u)>0||Number(f)Number(o)?f.substring(f.indexOf(u)+1,f.length).length>this.model.decimalPlaces?!0:v.length==0&&s>this._textBox.value.indexOf(u)&&y&&y.length>=this.model.decimalPlaces?!0:!1:v.length==0&&s>this._textBox.value.indexOf(u)&&y&&y.length>=this.model.decimalPlaces?!0:!1):a=!1;else if(u!="."&&(f=this._textBox.value.toString(),this.model.minValue.toString().match(new RegExp(".","g"))&&(e=this.model.minValue.toString().replace(/["."]/g,u)),this.model.maxValue.toString().match(new RegExp(".","g"))&&(o=this.model.maxValue.toString().replace(/["."]/g,u))),h=e.toString().indexOf(u)>0?Number(e.toString().substring(0,e.toString().indexOf(u))):this.model.minValue,c=o.toString().indexOf(u)>0?Number(o.toString().toString().substring(0,o.toString().indexOf(u))):this.model.maxValue,it>0){g=Number(f.substring(f.indexOf(u)+1,f.toString().length));h=e.toString().indexOf(u)>0?Number(e.toString().substring(e.toString().indexOf(u)+1,e.toString().length)):0;c=o.toString().indexOf(u)>0?Number(o.toString().substring(o.toString().indexOf(u)+1,o.toString().length)):0;var rt=Number(f.substring(0,f.indexOf(u))),ut=Number(e.toString().substring(0,e.toString().indexOf(u))),ft=Number(o.toString().substring(0,o.toString().indexOf(u)));a=this._validateValue(g,h,c,!0,rt,ut,ft)?!1:!0}else a=this._validateValue(g,h,c,!1)?!1:!0;if(a)return this._keypressFlag=!1,this._cancelEvent(r),!1}if(r.keyCode==38&&this._allowkeyboard&&(this._updateInputField("increment"),this._cancelEvent(r)),r.keyCode==40&&this._allowkeyboard&&(this._updateInputField("decrement"),this._cancelEvent(r)),r.keyCode==8&&(s=this._caretPosition(),k=this._textBox.value.substring(0,s),d=this._textBox.value.substring(s),v=this._getSelection(this._textBox.value)),(r.keyCode==46||r.keyCode==127)&&(s=this._caretPosition(),k=this._textBox.value.substring(0,s),d=this._textBox.value.substring(s),v=this._getSelection(this._textBox.value)),this._validateDecimal(r)&&this.model.decimalPlaces!=0&&r.keyCode!=46){if(l=t.preferredCulture(this.model.locale).numberFormat["."],w=this._textBox.value.split(l),w[1]==i){var b=this._caretPosition(),tt=w[0].substring(0,b),nt=w[0].substring(b);if((this.model.minValue.toString().indexOf("e")>0||this.model.maxValue.toString().indexOf("e")>0)&&(p=!0),nt.length>this.model.decimalPlaces&&this.model.validateOnType==!0)return this._keypressFlag=!1,this._cancelEvent(r),!1;if(this._validateOnType&&!p)if(this.model.minValue.toString().match(new RegExp(".","g"))&&(h=this.model.minValue.toString().replace(/["."]/g,l)),this.model.maxValue.toString().match(new RegExp(".","g"))&&(c=this.model.maxValue.toString().replace(/["."]/g,l)),h=h.indexOf(l)>0?Number(h.substring(0,h.indexOf(l))):Number(h),c=c.indexOf(l)>0?Number(c.substring(0,c.indexOf(l))):Number(c),this._validateValue(this.model.value,h,c,"DecimalKeyPressed"))this._textBox.value=tt+l+nt;else return this._keypressFlag=!1,this._cancelEvent(r),!1;else this._textBox.value=tt+l+nt;this._setSelectionRange(b+1,b+1)}this._cancelEvent(r)}else(r.keyCode==190||r.keyCode==110)&&this._cancelEvent(r);(r.keyCode==109||r.keyCode==189||r.keyCode==173)&&(this._caretPosition()!=0&&this._getSelection(this._removeFormats(this._textBox.value))!=this.model.value||this.model.minValue>=0&&!this.model.enableStrictMode||this._textBox.value.toString().match(new RegExp("-","g"))&&this._getSelection(this._textBox.value)===""?this._cancelEvent(r):this._getSelection()==this.model.value&&(this.model.value=null));r.keyCode==13&&this._checkNumValue(this._preVal)!==this._checkNumValue(this._textBox.value)&&this._setValue(this._textBox.value)}else(r.keyCode!=27&&!r.ctrlKey||r.ctrlKey&&r.keyCode==90&&n.trim(this._textBox.value)==="")&&(this._keypressFlag=!1,this._cancelEvent(r))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.NumericTextbox.Locale=t.NumericTextbox.Locale||{};t.NumericTextbox.Locale["default"]=t.NumericTextbox.Locale["en-US"]={watermarkText:"Enter value"};t.PercentageTextbox.Locale=t.PercentageTextbox.Locale||{};t.PercentageTextbox.Locale["default"]=t.PercentageTextbox.Locale["en-US"]={watermarkText:"Enter value"};t.CurrencyTextbox.Locale=t.CurrencyTextbox.Locale||{};t.CurrencyTextbox.Locale["default"]=t.CurrencyTextbox.Locale["en-US"]={watermarkText:"Enter value"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejMaskEdit","ej.MaskEdit",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{maskFormat:"",value:null,watermarkText:"",name:null,height:"",width:"",showError:!1,htmlAttributes:{},cssClass:"",customCharacter:null,inputMode:"text",readOnly:!1,textAlign:t.TextAlign.Left,hidePromptOnLeave:!1,showRoundedCorner:!1,enablePersistence:!1,enabled:!0,showPromptChar:!0,validationRules:null,validationMessage:null,keydown:null,keyup:null,keyPress:null,change:null,mouseover:null,mouseout:null,focusIn:null,focusOut:null,create:null,destroy:null},dataTypes:{maskFormat:"string",showError:"boolean",enabled:"boolean",customCharacter:"string",cssClass:"string",watermarkText:"string",showRoundedCorner:"boolean",showPromptChar:"boolean",inputMode:"enum",textAlign:"enum",hidePromptOnLeave:"boolean",readOnly:"boolean",validationRules:"data",validationMessage:"data",htmlAttributes:"data"},_setModel:function(n){for(var i in n)switch(i){case"value":t.isPlainObject(n[i])&&(n[i]=null);this._setValue(n[i]);n[i]=this.get_UnstrippedValue();this._raiseEvents("change",!0);break;case"width":this._setWidth(n[i]);break;case"height":this._setHeight(n[i]);break;case"watermarkText":this.model.watermarkText=n[i];this._changeWatermark(n[i]);break;case"showRoundedCorner":this._roundedCorner(n[i]);break;case"showPromptChar":this._setShowPrompt(n[i]);break;case"validationRules":this.model.validationRules!=null&&(this._hiddenInput.rules("remove"),this.model.validationMessage=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=n[i];this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation());break;case"textAlign":this._setTextAlign(n[i]);break;case"inputMode":this._setInputMode(n[i]);break;case"maskFormat":this.model.maskFormat=n[i];this._valueMapper();this._setMask(n[i]);n[i]=this.model.maskFormat;break;case"cssClass":this._setSkin(n[i]);break;case"readOnly":this._setReadOnly(n[i]);break;case"enabled":this.model.enabled=n[i];this._controlStatus(n[i]);break;case"htmlAttributes":this._addAttr(n[i]);break;case"hidePromptOnLeave":this.model.hidePromptOnLeave=n[i];this._textbox.value!=""&&(this.model.hidePromptOnLeave?(this._unStrippedMask=this._textbox.value,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=this._textbox.value.replace(/[ ]/g,"_"),this.model.value=this._textbox.value)}},observables:["value"],_destroy:function(){t.isNullOrUndefined(this._hiddenInput)||this.element.attr("name",this._hiddenInput.attr("name"));this._isWatermark&&this.element.removeAttr("placeholder");this.element.insertAfter(this.wrapper);t.isNullOrUndefined(this.wrapper)||this.wrapper.remove();this.model.textAlign&&this.element.css("text-align","");this.element.val("").removeClass(" e-mask e-input e-disable").empty()},_init:function(n){if(this._options=n,this._tempMask=this.model.maskFormat,this.element.is("input")&&(this.element.is("input[type=text]")||this.element.is("input[type=password]")||!this.element.attr("type")))this._isWatermark="placeholder"in document.createElement("input"),this._setValues(),this._valueMapper(),this._renderControl(),this._initObjects(),this._wireEvents(),this._addAttr(this.model.htmlAttributes),this.model.validationRules!=null&&(this._initValidator(),this._setValidation());else return this._destroy(),!1;n&&n.value!=r&&this.model.value!==n.value&&this._trigger("_change",{value:this.get_UnstrippedValue(),unmaskedValue:this.get_StrippedValue()})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="name"?r._hiddenInput.attr(i,n):u=="disabled"&&n=="disabled"?r.disable():u=="readonly"&&n=="readOnly"?r._setReadOnly(!0):u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_setValidation:function(){var r,i,u,f;this._hiddenInput.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this._hiddenInput.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessage)i==f?u=this.model.validationMessage[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_setShowPrompt:function(n){this.model.showPromptChar=n;this._textbox.value=this.model.showPromptChar?this._unStrippedMask:this.get_UnstrippedValue()},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_setValues:function(){this._unStrippedMask=null;this._charMap={"9":"[0-9 ]",a:"[A-Za-z0-9 ]",A:"[A-Za-z0-9]",N:"[0-9]","#":"[0-9]","&":"[^]+","<":"",">":"",C:this.model.customCharacter!=null?"["+this.model.customCharacter+"]":"[A-Za-z ]","?":"[A-Za-z]"}},_renderControl:function(){if(this.model.name=this.element.attr("name")!=null?this.element.attr("name"):this.model.name!=null?this.model.name:this.element[0].id,this.element.attr("name")!=null&&this.element.removeAttr("name"),this.wrapper=t.buildTag("span.e-mask e-widget "+this.model.cssClass),this.innerWrapper=t.buildTag("span.e-in-wrap e-box"),this.wrapper.append(this.innerWrapper).insertBefore(this.element),this.innerWrapper.append(this.element),this._hiddenInput=t.buildTag("input#"+this._id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element),this._isWatermark||this.model.inputMode=="password"||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this.model.watermarkText),this._hiddenSpan.css("display","none"),this._hiddenSpan.bind("mousedown",n.proxy(this._OnFocusHandler,this))),t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value),t.isNullOrUndefined(this.model.value)||this.wrapper.addClass("e-valid"),this._hiddenInput.attr({name:this.model.name,value:this.model.value}),this.element.attr({"aria-invalid":!1}).addClass("e-input"),this.model.maskFormat==""&&this.model.value==null){var i=this;setTimeout(function(){i.element.val()!=""&&(i.option("value",i.element.val()),i.previousValue=i.model.value,i._initObjects())},500)}else this.element.attr({value:this.model.value});t.isNullOrUndefined(this._options.inputMode)&&!t.isNullOrUndefined(this.element.attr("type"))?this.model.inputMode=this.element.attr("type"):this._setInputMode(this.model.inputMode);this._setWidth(this.model.width);this._setHeight(this.model.height);this._roundedCorner(this.model.showRoundedCorner);this._setTextAlign(this.model.textAlign);this._setReadOnly(this.model.readOnly);this._controlStatus(this.model.enabled);this.previousValue=this.model.value},_initObjects:function(){var t,n;if(this._textbox=this.element[0],this._keypressFlag=0,this._selectedTextKeyDown=0,this._keydownFlag=0,this.model.maskFormat.indexOf("\\")>=0){for(t=0,n=0;n=0?this.model.maskFormat:this.model.maskFormat.replace(/[9?CANa#&]/g,"_");(this._maskModel.indexOf("<")>=0||this._maskModel.indexOf(">")>=0)&&(this._maskModel=this._maskModel.replace(/[<>]/g,""),this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,""),this._valueMapper());this._validatedValue=this._maskModel;this.model.inputMode!="password"&&(this._setValue(this.model.value),this._setWaterMark());this.model.showError&&this.element.addClass("e-error").attr("aria-invalid","true")},_setWidth:function(n){this.wrapper.width(n)},_setHeight:function(n){this.wrapper.height(n)},_roundedCorner:function(n){n&&!this.innerWrapper.hasClass("e-corner")?this.innerWrapper.addClass("e-corner"):this.innerWrapper.hasClass("e-corner")&&this.innerWrapper.removeClass("e-corner")},_setTextAlign:function(n){n=="right"?(this.element.css("text-align",""),this.wrapper.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.element.css("text-align",n))},_setInputMode:function(n){this.element.attr("type",n)},_setReadOnly:function(n){this.model.readOnly=n;n?this.element.attr("readonly",!0):this.element.removeAttr("readonly")},_setSkin:function(n){this.wrapper.removeClass(this.model.cssClass);this.wrapper.addClass(n)},_setWaterMark:function(){var i=this.model.showPromptChar?this._maskModel:this._maskModel!=""&&this._maskModel!=null?this._maskModel.replace(/[_]/g," "):this._maskModel;this._maskModel=this.model.maskFormat.indexOf("\\")>=0?this.model.maskFormat===""?null:this.model.maskFormat:n.trim(this.model.maskFormat.replace(/[9?CANa#&]/g,"_"))===""?null:this.model.maskFormat.replace(/[9?CANa#&]/g,"_");(this._maskModel!=""&&this._maskModel!=null&&this._textbox.value==i||i==""&&this._textbox.value==""&&this.model.inputMode!="password")&&(this._textbox.value="");this.model.watermarkText.length!=0||t.isNullOrUndefined(this.element.attr("placeholder"))||(this.model.watermarkText=this.element.attr("placeholder"));this.model.watermarkText&&(this._isWatermark?this.element.attr("placeholder",this.model.watermarkText):this._textbox.value?this._hiddenSpan.css("display","none").text(this.model.watermarkText):this._hiddenSpan.css("display","block").text(this.model.watermarkText));this.model.watermarkText||this._textbox.value||!this.model.maskFormat||(this.model.hidePromptOnLeave?(this._unStrippedMask=this._maskModel,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=i)},_changeWatermark:function(t){if(!this.model.enabled)return!1;var i=this.model.showPromptChar?this._maskModel:this._maskModel!=""&&this._maskModel!=null?this._maskModel.replace(/[_]/g," "):this._maskModel;(this._textbox.value==i||this._textbox.value==""||n.trim(this.get_StrippedValue())=="")&&this.model.inputMode!="password"&&(this._textbox.value="");this._isWatermark?this.element.attr("placeholder",t):this._hiddenSpan.text(t);!this.model.watermarkText&&n.trim(this.get_StrippedValue())==""&&this.model.maskFormat&&(this.model.hidePromptOnLeave?(this._unStrippedMask=this._maskModel,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=i)},_showAlert:function(){var t=this;this.element.addClass("e-error").attr("aria-invalid","true").animate({Opacity:1},700,null,function(){n(t._textbox).removeClass("e-error").attr("aria-invalid","false")})},_unMask:function(){for(var u=this.model.value,f="",n=i=0,t,o="_",s,e;nu.length)break}return f},_validateValue:function(){var b,v,o,e,w,c,n,f,y;if(!t.isNullOrUndefined(this.model.value)){var h=this.model.value,u=this._maskModel,i=f=0,s,a="_",p,l=this._unMask();if(this._isWatermark||this.model.inputMode=="password"||this._hiddenSpan.css("display","none"),this._maskLength==0)return this._textbox.value=h,this._setWaterMark(),!0;for(b=this.model.value.toString(),h=this.model.maskFormat.indexOf("\\")>=0||this.model.customCharacter!=null?this.model.value:this.model.value=b.replace(/[\(\)-]/g,"");ih.length)break}if(this.model.value)if(this._textbox.value=u,this.model.value=this.get_UnstrippedValue(),this.model.maskFormat.indexOf("\\")>=0||this.model.maskFormat.indexOf("&")>=0){for(this._textbox.value="",w=0,_pos=0;_pos=0)for(n=0;n")>=0||this._textbox.value.indexOf("<")>=0)&&(this._textbox.value=this._textbox.value.replace(/[<>]/g,""),this._tempMask=this.model.maskFormat,this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,"")),this.model.showPromptChar||(this._textbox.value=this.get_UnstrippedValue()),this._tempMask!=null)for(f=0;f=0?(_position=this._getCunrrentPos(i),f=this.model.maskFormat.substr(i+_position,1)):f=this.model.maskFormat.substr(i,1),r=this.model.customCharacter,e=String.fromCharCode(t),n.each(o,function(n,t){f==n&&(r!=null&&(n=="C"?t="["+r+"]":(n=="A"||n=="N"||n=="#")&&(t=t.replace("]","")+r+"]")),u=e.match(new RegExp(t))?!0:!1)}),u},_seekNext:function(){for(var n=this._caretPosition(this._textbox),r=n,u=!0,t,i;u;){if(n>=0&&n=0?this.model.maskFormat.charAt(n+t)!="\\"&&this.model.maskFormat.charAt(n+t-1)!="\\"&&(this._charMap[this.model.maskFormat.charAt(n+t)]||(this._setCaretPosition(n),n++)):this._charMap[this.model.maskFormat.charAt(n)]||(this._setCaretPosition(n),n++),n!=r)){r=n;continue}}u=!1}return n},_seekBefore:function(){var n=this._caretPosition(this._textbox),i=--n,t=!0;for(this._selectedTextKeyDown==1&&(t=!1);t;){if(n>=0&&n=0){for(s=0,e=0;e<=t;e++)this.model.maskFormat[e].indexOf("\\")>=0&&t!=0&&(s+=1);this._textbox.value=this.model.maskFormat[t+s].indexOf("\\")>=0?f+u[t]+i.substr(1,i.length):f+n+i.substr(1,i.length)}else this._textbox.value=f+n+i.substr(1,i.length);this._setCaretPosition(t+1)}},_updateCasing:function(n,t){for(var r,i=0;i")&&t++;for(r=t;r>-1;r--){if(this._tempMask.substr(r,1)=="<")return n.toLowerCase();if(this._tempMask.substr(r,1)==">")return n.toUpperCase()}},get_StrippedValue:function(){var u,o=this.model.maskFormat,f=null,e,i,t,r;if(u=this._textbox.value==""&&this.model.inputMode!="password"?this._maskModel:this._textbox.value,o.length==0)return u;for(e=0,i=0;i=0?this.model.maskFormat[i]=="\\"?e+=1:this.model.maskFormat[i-1]=="\\"?f+=this._textbox.value[i-e]:(t=o[i],r=null,"9?$a*".indexOf(t)!=-1?r=this._charMap[t]:t=="A"||t=="N"||t=="#"?r=this._charMap[t].replace("]","")+this.model.customCharacter+"]":t=="C"?r="["+this.model.customCharacter+"]":t=="&"&&(f+=u[i-e]),r&&u[i-e]&&u[i-e].match(new RegExp(r))&&(f+=u[i-e])):(t=o[i],r=null,"9?$a*".indexOf(t)!=-1?r=this._charMap[t]:t=="A"||t=="N"||t=="#"?r=this._charMap[t].replace("]","")+this.model.customCharacter+"]":t=="C"?r="["+this.model.customCharacter+"]":t=="&"&&(f+=u[i-e]),r&&u[i]&&u[i].match(new RegExp(r))&&(f+=u[i]));return f},get_UnstrippedValue:function(){var t=this._textbox.value==""&&this.model.inputMode!="password"?this._maskModel:this._textbox.value,i=null;return this.model.maskFormat.length==0?t:(t!=r&&(i=n.trim(t.replace(/[_]/g," "))==""?null:t.replace(/[_]/g," ")),i)},_setValue:function(i){(t.isNullOrUndefined(i)||n.trim(i)=="")&&(i=null);this.model.value=i;this._isWatermark||this.model.inputMode=="password"||this._hiddenSpan.css("display","none");t.isNullOrUndefined(this.model.maskFormat)||this.model.maskFormat==""?(this._textbox.value=t.isNullOrUndefined(i)?"":i,this._unStrippedMask=this._textbox.value):(this._validateValue(),t.isNullOrUndefined(this.model.value)&&(this._textbox.value=t.isNullOrUndefined(i)?"":i,this._unStrippedMask=this._maskModel));this._setWaterMark()},_valueMapper:function(){for(var u=[],i=0,o=this.model.maskFormat||"",s=o.split(""),f=0,n,r="",e,h=this._charMap,t;f=0||this._maskModel.indexOf(">")>=0)&&(this._maskModel=this._maskModel.replace(/[<>]/g,""),this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,""));t.isNullOrUndefined(this.model.maskFormat)||this.model.maskFormat==""?this.model.watermarkText||this._textbox.value==this._maskModel||(this.model.maskFormat?this.model.hidePromptOnLeave?(this._textbox.value=this._maskModel,this._unStrippedMask=this._textbox.value,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=this._maskModel:(unstripVal=this._unStrippedMask.replace(/[_]/g," "),this._textbox.value=this.model.customCharacter==null?n.trim(unstripVal.replace(/[\(\)-]/g,"")):n.trim(unstripVal),this._unStrippedMask=this._textbox.value)):this._validateValue()},enable:function(){this.element.disabled=!1;this.element.removeAttr("disabled").removeClass("e-disable").attr({"aria-disabled":!1});this.wrapper.removeClass("e-disable-wrap");this.model.enabled=!0},disable:function(){this.element.disabled=!0;this.element.attr("disabled","disabled").addClass("e-disable").attr({"aria-disabled":!0});this.wrapper.addClass("e-disable-wrap");this.model.enabled=!1},clear:function(){this._textbox.value=this.model.maskFormat.replace(/[9?aCAN]/g,"_");this.model.value=this.get_StrippedValue()},_wireEvents:function(){this._on(this.element,"focus",this._OnFocusHandler);this._on(this.element,"blur",this._OnBlurHandler);this._on(this.element,"keydown",this._OnKeyDownHandler);this._on(this.element,"keypress",this._OnKeyPressHandler);this._on(this.element,"keyup",this._OnKeyUpHandler);this._on(this.element,"mouseover",this._OnMouseOverHandler);this._on(this.element,"mouseout",this._OnMouseOutHandler);this._on(this.element,"paste",this._OnPasteHandler);this._on(this.element,"cut",this._OnCutHandler)},_OnCutHandler:function(){var i=t.isNullOrUndefined(this._maskModel)?"":this._maskModel.substring(this._textbox.selectionStart,this._textbox.selectionEnd),r=this._textbox.value.substring(0,this._textbox.selectionStart),u=this._textbox.value.substring(this._textbox.selectionEnd),f=this._textbox.selectionStart,n=this;setTimeout(function(){n._textbox.value=r+i+u;n._setCaretPosition(f);n._raiseEvents("change")},0)},_OnPasteHandler:function(){var t=this;return setTimeout(function(){var i=n(t._textbox).val();t._setValue(i);t._raiseEvents("change")},0),!0},_OnFocusHandler:function(){this.wrapper.addClass("e-focus");var i=this.model.showPromptChar?this._maskModel:this._maskModel!=""&&this._maskModel!=null?this._maskModel.replace(/[_]/g," "):this._maskModel;this.model.readOnly||(this._focusValue=this.model.value,this._isWatermark||this.model.inputMode=="password"||this._hiddenSpan.css("display","none"),this._textbox.value==""&&this._maskModel!=""&&this.model.inputMode!="password"&&(this._textbox.value=this.model.maskFormat.indexOf("\\")>=0?this.model.watermarkText:t.isNullOrUndefined(this._maskModel)?"":i),this._maskModel!=null&&(this._textbox.value.indexOf("<")>=0||this._textbox.value.indexOf(">")>=0)&&(this._textbox.value=this._textbox.value.replace(/[<>]/g,""),this._maskModel=this._textbox.value,this._tempMask=this.model.maskFormat,this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,"")),this._textbox.value!=i&&this._unStrippedMask!=null&&this.model.hidePromptOnLeave&&(this._textbox.value=this._unStrippedMask),this.model.showPromptChar||(this._textbox.value=this.get_UnstrippedValue()),n.fn.selectRange=function(n,t){return this.each(function(){if(this.setSelectionRange)this.focus(),this.setSelectionRange(n,t);else if(this.createTextRange){var i=this.createTextRange();i.collapse(!0);i.moveEnd("character",t);i.moveStart("character",n);i.select()}})},this.model.maskFormat&&n(this.element).selectRange(0,0),this._raiseEvents("focusIn"))},_OnBlurHandler:function(){var f,i,n,u;if(this.wrapper.removeClass("e-focus"),this.model.value=this.get_StrippedValue(),f=[],i=[],(this._textbox.value.indexOf("_")!=-1||this._textbox.value.indexOf(" ")!=-1)&&!t.isNullOrUndefined(this.model.value)){for(n=0;n=0)for(r=0;r=35&&u<=41&&(window.navigator.appCodeName=="Mozilla"||window.navigator.appCodeName=="opera")&&(this._keypressFlag=1),n.shiftKey&&(n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39||n.keyCode==46||n.keyCode==127)||n.ctrlKey&&(n.keyCode==86||n.keyCode==65||n.keyCode==67||n.keyCode==88)){this._keypressFlag=1;return}return u==8?this.model.inputMode!="password"?(this._keydownFlag=1,i=this._seekBefore(),this._selectedTextKeyDown?!this.model.showPromptChar&&this._selectedTextKeyDown&&(this._textbox.value=this.get_UnstrippedValue(),this._setCaretPosition(i+1)):(i>=0&&i=0&&i=0?i=0||this.model.maskFormat.indexOf("\\")>=0?(_position=this._getCunrrentPos(i),this.model.maskFormat[i+_position]=="&"&&r==127||(this.model.maskFormat.indexOf("\\")>=0?i0&&(this._itemWidth<=this.element.width()||this._itemWidth>=this.element.width()&&!this._isOverflowPopupOpen())&&(t.isNullOrUndefined(this.popupWrapper)||this.popupWrapper.hide());this._renderHamburgerIcon();this.element.find("li.e-ham-wrap").css({display:"list-item"});var o=this.element.find("li.e-ham-wrap").outerWidth(),r=0,e=!0;for(this.element.find("li.e-ham-wrap").hide(),this._menuHeaderItems=this.element.find(">li.e-list"),this._menuOverflowItems=[],i=0;ili.e-list.e-haschild>ul").find("li.e-haschild").find("span.e-icon.e-arrowhead-down").removeClass("e-arrowhead-down").addClass("e-arrowhead-right"),this.model.enableSeparator&&this._setSeparator(!0);else{if(e){e=!1;this.element.find("li.e-ham-wrap").css({display:"list-item"});r=r-u.outerWidth()+o;i>1&&(r=r-n(this._menuHeaderItems[i-1]).outerWidth(),i=i-2);continue}this._menuOverflowItems.push(n(u).clone(!0));u.addClass("e-menu-hide")}this._menuOverflowItems.length>0?(this._renderHamburgerIcon(),n(".e-menu-popwrap").length?this._addOverflowItems():this._renderPopupWrapper(),this.lastelement=this.element.find(">li.e-list:visible").last().addClass("e-last"),this.element.find(">li.e-list.e-haschild>ul").find("li.e-haschild").find("span.e-icon.e-arrowhead-down").removeClass("e-arrowhead-down").addClass("e-arrowhead-right")):this._menuOverflowItems.length==0&&n("li.e-ham-wrap").length>0&&this.element.find("li.e-ham-wrap").remove()}(this.model.orientation=="vertical"||this.model.menuType==t.MenuType.ContextMenu&&n(window).width()>=768&&this.model.isResponsive)&&this.element.find("span.e-icon.e-arrowhead-down").removeClass("e-arrowhead-down").addClass("e-arrowhead-right")},_renderHamburgerIcon:function(){if(this._ensureOverflowPopup()&&this.element.find("li.e-ham-wrap").length==0){var i=t.buildTag("li.e-ham-wrap"),r=t.buildTag("div");this.hamburgerspan=t.buildTag("span.e-hamburger");r.append(this.hamburgerspan);i.append(r);this.element.append(i);this.model.height!=0?this._setHeight(this.model.height):n("li.e-ham-wrap").css({height:this.element.find("li.e-list").first().height()});this._on(this.element.find("li.e-ham-wrap"),"click",this._overflowOpen)}},_addOverflowItems:function(){var i,r,u;if(this._ensureOverflowPopup()&&n(".e-menu-popwrap").length>0&&!t.isNullOrUndefined(this.popupWrapper)){for(this.popupWrapper.empty(),this._menuCloneItems.length=0,i=0;i0&&(u=this.popupWrapper.innerWidth(),this.popupWrapper.find("ul.e-menu").css({width:u+"px"}));this.model.enableSeparator&&this._setSeparator(!0)}},_overflowOpen:function(n){if(this._isOverflowPopupOpen()){var i=t.util.getOffset(this.element),r=i.left+(this.model.enableRTL?0:this.element.outerWidth()-this.popupWrapper.outerWidth()),u=i.top+this.element.outerHeight();this.wrapper.parent().length&&(this.wrapper.parent().css("position")=="absolute"||this.wrapper.parent().css("position")=="relative")&&(i=t.util.getOffset(this.wrapper.parent()),r=r-i.left,u=u-i.top);this.popupWrapper.css({left:r,top:u});this.popupWrapper.show();this._trigger("overflowOpen",{e:n})}else this._overflowClose(n)},_overflowClose:function(n){this._ensureOverflowPopup()&&!t.isNullOrUndefined(this.popupWrapper)&&(this.popupWrapper.find("li.e-list").removeClass(".e-mhover.e-active.e-mfocused"),this._hideAnimation(this.popupWrapper.find('li.e-list:has("> ul")').find("> ul:visible"),this._hideAnim),this.popupWrapper.hide(),this._trigger("overflowClose",{e:n}))},_isOverflowPopupOpen:function(){if(n(this.popupWrapper).length>0)return this.popupWrapper.css("display")=="none"},_removePopup:function(){n(window).width()<767&&this.model.isResponsive&&(this._ensureResponsiveClasses(n(window).width()),this.element.find("li.e-ham-wrap").length>0&&this.popupWrapper.length>0&&(this.element.find("li.e-ham-wrap").remove(),n(".e-menu-popwrap").remove(),this.element.find("li.e-list").addClass("e-menu-show")))},_mobileResponsiveMenu:function(){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&this.element.css("display")=="none"?this.element.removeClass("e-res-hide").addClass("e-res-show"):this.model.menuType==t.MenuType.ContextMenu||this.model.orientation=="vertical"||this.element.css("display")=="none"||this.element.removeClass("e-res-show").addClass("e-res-hide")},_ensureOverflowPopup:function(){return this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&n(window).width()>=768&&this.model.isResponsive},_onResize:function(){this.element.find("li.e-ham-wrap").hide();n(window).width()>=768?this._calculateOverflowItems():this._removePopup()},_ensureResponsiveClasses:function(n){n&&this.element.find("span.e-icon").hasClass("e-arrowhead-right")&&this.element.find("span.e-icon.e-arrowhead-right").removeClass("e-arrowhead-right").addClass("e-arrowhead-down")},_responsiveLayout:function(){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&(this.wrapper.addClass("e-menu-responsive"),this.element.addClass("e-menu-responsive"),this.resWrap=t.buildTag("span.e-menu-res-wrap e-menu-responsive"),this.inResWrap=t.buildTag("span.e-in-wrap e-box e-menu-res-in-wrap"),this.label=t.buildTag("span.e-res-title").html(this.model.locale=="en-US"?this.model.titleText:t.Menu.Locale[this.model.locale]&&t.Menu.Locale[this.model.locale].titleText?t.Menu.Locale[this.model.locale].titleText:this.model.titleText),this.check=t.buildTag("span.e-check-wrap e-icon"),this.wrapper.append(this.resWrap),this.resWrap.append(this.inResWrap),this.inResWrap.append(this.label).append(this.check))},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i.disable():i.element.attr(t,n)})},_oncheck:function(n){var t=this.element.parents(".e-menu-wrap").children(".e-menu");n.isChecked?t.removeClass("e-res-hide").addClass("e-res-show"):t.removeClass("e-res-show").addClass("e-res-hide")},_addClass:function(){var u,f,i,r,t;for(this.element.find('li:has("> ul")').find("> a,> span").addClass("aschild"),this.element.find(">li").addClass("e-list").attr({role:"menuitem"}),this.element.find("li").find(">a, >span").addClass("e-menulink"),u=this.element.find(".e-list a.aschild"),f=this.element.find(".e-list span.aschild"),t=0;t<\/span>").append("<\/span>");this.element.find(">li.e-list.e-haschild").append(i)}},_generateTemplate:function(n){var i=this,r;n instanceof t.DataManager?(r=n.executeQuery(this._columnToSelect(this.model.fields)),r.done(function(n){i._odataFlag=!0;i._generateItemTemplate(n.result);i._wireEvents("_on")})):(i._odataFlag=!1,this._generateItemTemplate(i.model.fields.dataSource),this._wireEvents("_on"))},_generateItemTemplate:function(n){for(var i,t=0;t0)){for(h=t.buildTag("ul"),s=0;s0){for(e=n(document.createElement("ul")),r=0;r").addClass("e-icon e-arrowhead-down")).addClass("e-arrow-space"):c.model.showSubLevelArrows&&n(f).children("a.aschild").append(n("").addClass("e-icon e-arrowhead-right")).addClass("e-arrow-space")}}),p.then(function(){c._renderArrow()});else if(t.isNullOrUndefined(i.child)||(t.isPlainObject(i.child)?e=t.DataManager(u.child.dataSource).executeLocal(t.Query().where(u.child.parentId,t.FilterOperators.equal,i[u.id])):i.child instanceof Array&&(e=i.child)),e&&e.length>0){for(h=n(document.createElement("ul")),s=0;sli.e-list:has("> ul")').children("a").append(n("").addClass("e-icon "+r)).addClass("e-arrow-space")}else this.element.find('>li.e-list:has("> ul")').children("a").removeClass("e-arrow-space").children("span.e-icon").remove();i?this.element.find(">li.e-list > ul li.e-list:has(>ul)").children("a").append(n("").addClass("e-icon e-arrowhead-right")).addClass("e-arrow-space"):this.element.find(">li.e-list > ul li.e-list:has(>ul)").children("a").removeClass("e-arrow-space").children("span.e-icon").remove()},_intializeMenu:function(){this.model.height!=0&&this._setHeight(this.model.height);this.model.width!=0&&this._setWidth(this.model.width);this.model.menuType=="contextmenu"&&(this.model.openOnClick=!1);this.model.openOnClick&&(this._hoverOpen=!1,this._hoverClose=!1)},_setOrientation:function(n){n=="horizontal"?this.element.removeClass("e-vertical e-horizontal").addClass("e-horizontal"):this.element.removeClass("e-horizontal e-vertical").addClass("e-vertical");n=="vertical"&&this._removePopup()},_setHeight:function(i){this.model.orientation=="horizontal"&&i!=="auto"?(i=typeof i=="number"?i+"px":i,this.element.find("> li").find(">a:first").css("line-height",i),this.model.showRootLevelArrows&&this.element.find("> li").find(">a:first").find("> span:first").css({"line-height":i,top:"0px"}),this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&n("li.e-ham-wrap").length>0&&(this.element.find("li.e-ham-wrap").children("div").css({"line-height":i}),this.element.find("li.e-ham-wrap").css({height:i}),n(".e-menu-popwrap").length>0&&this.popupWrapper.find("a.e-menulink").css({"line-height":i}))):this.element.height(i)},_setWidth:function(n){this.element.css("width",n);this.model.orientation==="horizontal"&&n!=="auto"&&this.model.isResponsive&&this.resWrap.css("width",n);this.model.orientation=="horizontal"&&this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&this._calculateOverflowItems()},_setOverflowDimensions:function(n,i){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&(i=typeof i=="number"?i+"px":i);n=="height"?this.popupWrapper.css({height:i}):n=="width"&&this.popupWrapper.css({width:i});this._addOverflowItems()},_setRTL:function(n){n?this.element.removeClass("e-rtl").addClass("e-rtl"):this.element.removeClass("e-rtl");n&&this.model.orientation==="horizontal"?this.wrapper.removeClass("e-menu-rtl").addClass("e-menu-rtl"):this.wrapper.removeClass("e-menu-rtl");this.model.subMenuDirection=n?"left":"right"},_setSubMenuDirection:function(n){n!="left"&&n!="right"&&(this.model.subMenuDirection=this.model.enableRTL?"left":"right")},_setAnimation:function(n){n==="none"?(this._showAnim="none",this._hideAnim="none"):(this._showAnim="slideDown",this._hideAnim="slideUp")},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_centerAlign:function(n){this.model.orientation=="horizontal"&&n?this.element.css("text-align","center"):this.element.css("text-align","inherit")},_columnToSelect:function(n){var u=[],r=t.Query(),i;if(t.isNullOrUndefined(n.query)){for(i in n)i!=="tableName"&&i!=="child"&&i!=="dataSource"&&n[i]&&u.push(n[i]);u.length>0&&r.select(u);this.model.fields.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||r.from(n.tableName)}else r=n.query;return r},_max_zindex:function(){var i,r,t;return this.model.menuType=="contextmenu"?(i=n(this._targetElement).parents(),i.push(this._targetElement)):i=n(this.element).parents(),r=n("body").children(),index=r.index(this.popup),r.splice(index,1),n(r).each(function(n,t){i.push(t)}),t=Math.max.apply(t,n.map(i,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_recursiveFunction:function(t,i){var r=this,u=!1;n.each(t,function(n,t){return t.Text==i?(r.selectedItem=t,u=!0,!1):(t.ChildItems!=null&&r._recursiveFunction(t.ChildItems,i),u?!1:void 0)})},_contextMenu_Template:function(){if(this.element[0].id!="")var t=n(".e-menu-wrap #"+this.element[0].id).get(0);t&&n(t.parentElement).remove();this.model.orientation="vertical";this.element.addClass(this.model.cssClass+" e-context");this.element.css("display","none");this._referenceElement=this.element.parent();n("body").append(this.element);this.wrapper.insertBefore(this.element);this.wrapper.append(this.element)},_closeMenu:function(){this._hideAnimation(this.element.find('li.e-list:has("> ul")').find("> ul:visible"),this._hideAnim)},_onMenuIntent:function(n,t,i){t._delayMenuHover=window.setTimeout(function(){if(t._mouseOver==!0&&i){var r=t._showAnim,u=t._hideAnim,f=t._showSpeed,e=t._hideSpeed;t._show(n,r,u)}},this._showSpeed)},_onHide:function(n,t,i){t._delaySubMenuHover=window.setTimeout(function(){if(t._mouseOver==!1&&i){var n=t._id,r=t._hideAnim,u=t._hideSpeed;t._closeAll()}},t._hideSpeed)},_subMenuPos:function(t,r){var e=n(t).offset(),a,v,o=e.left,u=n("ul:first",t),c=n(t).outerWidth(),f,h,l,w,s,b;if(e==null||e==i)return!1;if(f=u.outerWidth()+1,h=this.model.container?n(this.model.container).width()+n(document).scrollLeft():document.documentElement.clientWidth+n(document).scrollLeft(),this.model.menuType=="normalmenu")if(n(t.parentNode).is(this.element))this.model.orientation=="horizontal"?(u.css("top",n(t).outerHeight()+"px"),this.model.enableRTL?(v=o+c-f<0?o+c-f:1,u.css({left:"auto",right:v+"px"})):(a=hf||r=="right"&&h<=e.left+c+f&&o>f?u.css("left",-(f+4)+"px"):u.css("left",n(t).outerWidth()+4+"px");else if(r=="left"&&o>f||r=="right"&&h<=e.left+c+f&&o>f)u.css("left",-(f+4)+"px");else{u.css("left",n(t).outerWidth()+4+"px");var s=u.outerHeight(),y=n(window).height(),p=y-(e.top-n(window).scrollTop());yf&&u.css("left",-(f+4)+"px"),s=u.outerHeight(),e.top+s>n(window).height()?(b=-s+n(t).outerHeight(),s>e.top+n(t).outerHeight()/2?u.css("top",-(s/2)+"px"):u.css("top",b+"px")):u.css("top","0px")},_setSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n+" e-menu-wrap")},_setSeparator:function(i){i?(this.element.addClass("e-separator"),n(".e-menu-popwrap").length>0&&!t.isNullOrUndefined(this.ulTag)&&this.ulTag.addClass("e-separator")):this.element.removeClass("e-separator")},_contextMenuEvents:function(t){this[t](n(this.model.contextMenuTarget),"mouseup taphold",this._ContextMenuHandler);this[t](this.element,"contextmenu",this._onDefaultPreventer);this[t](n(this.model.contextMenuTarget),"contextmenu",this._onDefaultPreventer);this[t](n(document),"mousedown",this._onContextClose)},_show:function(t,i,r){var f,u=n("> ul",t),e=this._max_zindex();u.attr({"aria-hidden":!1});this._hideAnimation(n(t).siblings().find(" > ul:visible"),r);n.inArray(this._disabledMenuItems,t)>-1||(u.css("display")!="none"?(f=this.model.openOnClick?n(u):u.children().find("> ul"),this._hideAnimation(f,r)):n("> ul",t).children().find("> ul").hide(),this._subMenuPos(t,this.model.subMenuDirection),u.css({"z-index":e+1}),n(t).children("span.e-menu-arrow").css({"z-index":e+2}),n("> ul",t).css("display")=="block"||n(t).hasClass("e-disable-item")||(this._showAnimation(u,i),u.closest("li").addClass("e-active e-mfocused")),n(t).siblings("li.e-active").length>0&&n(t).siblings("li.e-active").removeClass("e-active e-mfocused"))},_closeAll:function(){this._hideAnimation(this.element.find('li.e-list:has("> ul")').find("> ul:visible"),this._hideAnim);this._hideAnimation(this.element.find("> ul:visible"),this._hideAnim)},_showAnimation:function(n,t){switch(t){case"slideDown":n.slideDown(this.model.enableAnimation?200:0);break;case"none":n.css("display","block")}},_hideAnimation:function(t,i){switch(i){case"slideUp":n(t).attr({"aria-hidden":!0});t.slideUp(this.model.enableAnimation?100:0);break;case"none":t.css("display","none")}t.closest("li").removeClass("e-active e-mfocused")},_removeValue:function(i,r){for(var f=t.browserInfo(),e=f.version==="8.0"&&f.name==="msie"?i[0].outerText:i[0].textContent,o=n(r).length,u=0,s=n(r).children("a").length==0?n(r).children("span"):n(r).children("a");u<=o;){if(n(s[u]).text()===e)return u;u++}},_createSubLevelItem:function(t,i){var r;r=n(document.createElement("ul"));r.append(i);t.append(r);t.attr({role:"menu","aria-haspopup":"true"});t.addClass("e-haschild");this.element.find('li:has("> ul")').find("> a,>span").addClass("aschild e-arrow-space");this._insertArrows(r)},_insertArrows:function(t){this.model.showRootLevelArrows?t.find(">a,>span").append(n("").addClass("e-icon e-arrowhead-down")).addClass("e-arrow-space"):t.find(">a,>span").removeClass("e-arrow-space").find(">span.e-icon").remove();this.model.showSubLevelArrows?t.parent("li.e-list:has(>ul)").children("a,span").append(n("").addClass("e-icon e-arrowhead-right")).addClass("e-arrow-space"):t.parent("li.e-list:has(>ul)").children("a,span").removeClass("e-arrow-space").find(">span.e-icon").remove()},_createMenuItem:function(t){var r,i,u,f;return r=n(document.createElement("li")),r.attr({"class":"e-list",role:"menuitem"}),t.htmlAttribute&&this._setAttributes(t.htmlAttribute,r),t.text&&t.text!=""&&(i=n(document.createElement("a")),i.attr({"class":"e-menulink"}),t.imageUrl&&t.imageUrl!=""?(u=n(document.createElement("img")),u.attr("src",t.imageUrl),t.imageAttribute&&this._setAttributes(t.imageAttribute,u),i.append(u)):t.spriteCssClass&&t.spriteCssClass!=""&&(f=n(document.createElement("span")),f.addClass(t.spriteCssClass),i.append(f)),i.append(t.text),t.linkAttribute&&this._setAttributes(t.linkAttribute,i),t.url&&i.attr("href",t.url),r.append(i)),t.id&&r.prop("id",t.id),this.model.enabled||r.addClass("e-disable-item"),r},_insertNode:function(i,r,u){var e=0,o=0,s=0,f=[];for(n(r).is(this.element)?f.push(this.element):typeof r=="string"?f.push(this.element.find(r)):typeof r=="undefined"?f.push(this.element):f.push(r),o=0;o0&&n.inArray(t[0],this._hiddenMenuItems)==-1&&(t.addClass("e-hidden-item"),this._hiddenMenuItems.push(t[0]))},_showElement:function(t){t.length>0&&n.inArray(t[0],this._hiddenMenuItems)>-1&&(t.removeClass("e-hidden-item"),this._hiddenMenuItems.splice(this._hiddenMenuItems.indexOf(t[0]),1))},_getNodeByID:function(t){return typeof t!="object"&&t!=""&&(t=this.element.find(".e-list"+t)),n(t)},_processItems:function(t,i){for(var u=this._getNodeByID(t),r=0;ra ,li.e-list >span")).filter(function(){return n.trim(n(this).text())===t});i.length>0&&!(n.inArray(i.parent()[0],this._disabledMenuItems)>-1)&&(i.parent().addClass("e-disable-item").attr({"aria-disabled":!0}),i.parent().find(">a.aschild span.e-icon").addClass("e-disable"),this._disabledMenuItems.push(i.parent()[0]))},disableItemByID:function(t){if(t&&t!=""){var r=this.element.find("#"+t)?this.element.find("#"+t)[0]:i;!r||n.inArray(r,this._disabledMenuItems)>-1||(n(r).addClass("e-disable-item").attr({"aria-disabled":!0}),n(r).find(">a.aschild span.e-icon").addClass("e-disable"),this._disabledMenuItems.push(r))}},getHiddenItems:function(){return this._hiddenMenuItems},hideItems:function(n){if(typeof n=="object"&&n.length!==i)for(var t=0;ta ,li.e-list >span")).filter(function(){return n.trim(n(this).text())===t}),r;i.length>0&&n.inArray(i.parent()[0],this._disabledMenuItems)>-1&&(i.parent().removeClass("e-disable-item").attr({"aria-disabled":!1}),i.parent().find(">a.aschild span.e-icon").removeClass("e-disable"),r=this._removeValue(i,this._disabledMenuItems),this._disabledMenuItems.splice(r,1))},enableItemByID:function(t){var i,r;if(t&&t!=""&&(i=this.element.find("#"+t)[0],i&&n.inArray(i,this._disabledMenuItems)>-1))for(n(i).removeClass("e-disable-item").attr({"aria-disabled":!1}),n(i).find(">a.aschild span.e-icon").removeClass("e-disable"),r=this._disabledMenuItems.length-1;r>=0;r--)this._disabledMenuItems[r].id==t&&this._disabledMenuItems.splice(r,1)},disable:function(){this.model.enabled=!1;var i=this.element.find(">li[class~=e-list]"),t=this;n.each(i,function(i,r){n.inArray(r,t._disabledMenuItems)>-1||(n(r).addClass("e-disable-item").attr({"aria-disabled":!0}),n(r).find(">a.aschild span.e-icon").addClass("e-disable"),t._disabledMenuItems.push(r))})},enable:function(){var i=this,t;this.model.enabled=!0;t=this.element.find("li.e-disable-item");n.each(t,function(t,r){n(r).removeClass("e-disable-item").attr({"aria-disabled":!1});n(r).find(">a.aschild span.e-icon").removeClass("e-disable");i._disabledMenuItems.pop(r)})},show:function(n,t,i,r){if(!this.model.enabled)return!1;this.model.menuType=="contextmenu"?this.showContextMenu(n,t,i,r,!1):this.element.css("display","block")},hide:function(n){if(!this.model.enabled)return!1;this.model.menuType=="contextmenu"?this.hideContextMenu(n):(this._closeMenu(),this.element.css("display","none"))},_wireEvents:function(t){this[t](this.element.find("li.e-list"),"mouseout",this._mouseOutHandler);this[t](this.element.find("li.e-list"),"mouseover",this._mouseOverHandler);this[t](this.element.children(),"click",this._onClickHandler);this[t](this.element,"keydown",this._onKeyDownHandler);this[t](this.element,"focus",this._OnFocusHandler);this[t](this.element,"blur",this._OnFocusOutHandler);this.model.menuType=="contextmenu"&&n(this.model.contextMenuTarget)[0]!=null&&this._contextMenuEvents(t);this.model.menuType!="contextmenu"&&(this[t](n(document),"click",this._onDocumentClick),this[t](this.element,"mousedown",this._onMouseDownHandler));this[t](n(window),"resize",n.proxy(this._onResize,this))},_mouseOverHandler:function(i){var r,f="",e,u;if(this.element.find(".e-mhover").removeClass("e-mhover"),i.currentTarget=n(i.target).closest("li")[0],n(i.currentTarget).hasClass("e-disable-item")?this._isFocused=!1:n(i.currentTarget).addClass("e-mhover"),i.stopPropagation&&i.stopPropagation(),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delaySubMenuHover),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delayMenuHover),this._mouseOver=!0,this._isMenuOpen=!0,this._isSubMenuOpen=n(i.currentTarget.parentNode.parentNode).is(this.element)?!1:!0,i.currentTarget.nodeName=="LI")r=i.currentTarget;else if(i.currentTarget.parentNode)if(i.currentTarget.parentNode.nodeName=="LI")r=i.currentTarget.parentNode;else return!1;else return i.preventDefault(),!1;n(i.currentTarget).hasClass("e-disable-item")||this._onMenuIntent(r,this,this._hoverOpen);n.inArray(r,this._disabledMenuItems)>-1||(e=n(r).children("a,span").text(),f=t.isNullOrUndefined(r)?"":n(r)[0].id,u={text:e,element:r,event:i,ID:f},this._trigger("mouseover",n.extend({events:u},u)))},_onMouseDownHandler:function(t){n(t.target).hasClass("e-menu")&&(this._isFocused=!1)},_mouseOutHandler:function(i){var r,f="",e,u;if(n(i.currentTarget).removeClass("e-mhover"),i.stopPropagation&&i.stopPropagation(),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delaySubMenuHover),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delayMenuHover),this._mouseOver=!1,this._isMenuOpen=!1,i.currentTarget.nodeName=="LI")r=i.currentTarget;else if(i.currentTarget.parentNode)if(i.currentTarget.parentNode.nodeName=="LI")r=i.currentTarget.parentNode;else return!1;else return i.preventDefault(),!1;this._onHide(r,this,this._hoverClose);n.inArray(r,this._disabledMenuItems)>-1||(e=n(r).children("a,span").text(),f=t.isNullOrUndefined(r)?"":n(r)[0].id,u={text:e,element:r,event:i,ID:f},this._trigger("mouseout",n.extend({events:u},u)))},_onClickHandler:function(i){var r,o="",f,s,u,e;if(this._isFocused=!0,f=!1,!n(i.target).closest("li.e-list").hasClass("e-disable-item")&&n(i.target).closest("li.e-list").length>0)r=n(i.target).closest("li.e-list")[0],n(r).is(this.element.find(">li.e-list"))&&(this._activeElement=r);else{n(i.target).is(this.element)&&(this._activeElement=this.element.find(">li:first"));return}n(i.target).is("a")&&n(r).find(">a,>span").hasClass("aschild")&&this.model.openOnClick&&(this._isFocused=!1);!this._hoverOpen&&n(r).find(">a,>span").hasClass("aschild")&&(this._show(r,this._showAnim,this._hideAnim),this._hoverOpen=!1,f=!0);n.inArray(r,this._disabledMenuItems)>-1||(this.model.menuType=="contextmenu"&&this._isContextMenuOpen&&!n(r).hasClass("e-haschild")&&(this._hideAnimation(this.element,this._hideAnim),this._isContextMenuOpen=!1,this._trigger("close",n.extend({events:i},i)),this._off(t.getScrollableParents(n(this.model.contextMenuTarget)),"scroll",this.hideContextMenu)),f||n(r).find(">a,>span").hasClass("aschild")||(this._closeMenu(),this.model.openOnClick&&(this._hoverOpen=!1)),s=n(r).children("a,span").text(),u=n(r).closest("ul").parent("li"),u.length!=0?(parentId=t.isNullOrUndefined(u.attr("id"))?null:u.attr("id"),parentText=u.children("a,span").text()):(parentId=null,parentText=null),o=t.isNullOrUndefined(r)?"":n(r)[0].id,e={text:s,element:r,event:i,selectedItem:this.selectedItem,ID:o,parentId:parentId,parentText:parentText},this._trigger("click",n.extend({events:e},e)),this.selectedItem=null,this.model.openOnClick&&this.model.menuType!="contextmenu"&&this.element.focus())},_onKeyDownHandler:function(i){var c,h,e;if(this.model.menuType!="contextmenu"||this._isContextMenuOpen){var o,f,s="",r=this.element.find(".e-mhover"),u=this.element.find(".e-mfocused"),l;if(!n(r).length>0&&n(this._activeElement).length>0&&(r=u=n(this._activeElement)),i.keyCode==9?(this._isFocused=!1,this._OnFocusOutHandler()):(i.keyCode==37||i.keyCode==38||i.keyCode==39||i.keyCode==40)&&i.preventDefault(),i.keyCode==40&&(this.model.orientation=="horizontal"?this.element.find(">li.e-mhover").children("ul").length>0||n(this._activeElement).length>0?(n(r).children("ul").css("display")==="none"&&this._show(r[r.length-1],this._showAnim,this._hideAnim),r.removeClass("e-mhover e-mfocused").children("ul:first").find("li:first").addClass("e-mhover"),this._activeElement==null?r.addClass("e-mfocused"):n(this._activeElement).addClass("e-mfocused")):(liVisible=r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),n(r[r.length-1]).removeClass("e-mfocused e-mhover"),f=n(liVisible[liVisible.index(r)+1]).length>0?n(liVisible[liVisible.index(r[r.length-1])+1]):liVisible.first(),f.addClass("e-mhover")):this.model.orientation!="horizontal"&&(liVisible=r.length==0?this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"):r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r.removeClass("e-mfocused e-mfocused"),r.length>0?(r.removeClass("e-mhover"),f=n(liVisible[liVisible.index(r[r.length-1])+1]).length>0?n(liVisible[liVisible.index(r[r.length-1])+1]):liVisible.first()):f=liVisible.first(),f.addClass("e-mhover"))),i.keyCode==39&&(this.model.orientation=="horizontal"&&(this.element.find(">li.e-list").hasClass("e-mhover")||n(this._activeElement).length>0)?(r.removeClass("e-mfocused e-mhover"),liVisible=this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(r[r.length-1])+1]).length>0?n(liVisible[liVisible.index(r[r.length-1])+1]):liVisible.first(),f.addClass("e-mhover")):n(r).children("ul").length>0?(r.removeClass("e-mfocused e-mhover"),c=r.children("ul:first").find("li:first"),this._show(r[r.length-1],this._showAnim,this._hideAnim),liVisible=r.addClass("e-mfocused").children("ul:first").children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(c)]).length>0?n(liVisible[liVisible.index(c)]):liVisible.first(),f.addClass("e-mhover")):r.children("ul").length<=0&&this.model.orientation=="horizontal"&&r.parent().closest(".e-list").parent().hasClass("e-menu")&&(this._hideAnimation(r.parent(),this._hideAnim),r.removeClass("e-mfocused e-mhover"),n(u[u.length-1]).removeClass("e-mfocused"),liVisible=r.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(u[u.length-1])+1]).length>0?n(liVisible[liVisible.index(u[u.length-1])+1]):n(liVisible[liVisible.index(u.first())]),f.addClass("e-mhover"))),i.keyCode==38&&(this.model.orientation=="horizontal"?(liVisible=r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r.removeClass("e-mfocused e-mhover"),f=n(liVisible[liVisible.index(r[r.length-1])-1]).length>0?n(liVisible[liVisible.index(r[r.length-1])-1]):liVisible.last()):this.model.orientation!="horizontal"&&(liVisible=r.length==0?this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"):r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r.length>0?(r.removeClass("e-mfocused e-mhover"),f=n(liVisible[liVisible.index(r[r.length-1])-1]).length>0?n(liVisible[liVisible.index(r[r.length-1])-1]):liVisible.last()):f=liVisible.last()),f.addClass("e-mhover")),i.keyCode==37&&(this.model.orientation=="horizontal"?this.element.find(">li.e-list").hasClass("e-mhover")||n(this._activeElement).length>0?(r.removeClass("e-mfocused e-mhover"),liVisible=this.element.find("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(r[r.length-1])-1]).length>0?n(liVisible[liVisible.index(r[r.length-1])-1]):liVisible.last(),f.addClass("e-mhover")):(this._hideAnimation(r.parent(),this._hideAnim),r.removeClass("e-mfocused e-mhover"),n(u[u.length-1]).removeClass("e-mfocused e-active"),liVisible=r.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=r.parent().closest(".e-list").parent(".e-menu").length>0?n(liVisible[liVisible.index(u[u.length-1])-1]).length>0?n(liVisible[liVisible.index(u[u.length-1])-1]):liVisible.last():n(liVisible[liVisible.index(u[u.length-1])]).length>0?n(liVisible[liVisible.index(u[u.length-1])]):liVisible.last(),f.addClass("e-mhover")):(r.parent("ul.e-menu").length==0||this.model.menuType=="contextmenu"&&r.parent("ul.e-context").length==0)&&(this._hideAnimation(r.parent(),this._hideAnim),r.removeClass("e-mfocused e-mhover"),n(u[u.length-1]).removeClass("e-mfocused"),liVisible=r.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(u[u.length-1])]).length>0?n(liVisible[liVisible.index(u[u.length-1])]):n(liVisible[liVisible.index(u.last())]),f.addClass("e-mhover"))),i.keyCode==13&&(h=n(r).children("a,span").text(),s=t.isNullOrUndefined(n(r)[0])?"":n(r)[0].id,e={menuId:this.element[0].id,text:h,selectedItem:u,ID:s},this.model.menuType=="contextmenu"?this._isContextMenuOpen&&r.length>0&&!u.hasClass("e-disable-item")&&(this.model.click&&this._trigger("click",n.extend({events:e},e)),this.selectedItem=null,this.hideContextMenu(i)):r.length>0&&!r.hasClass("e-disable-item")&&(n(r).find(">a,>span").hasClass("aschild")&&n(r).children("ul").css("display")==="none"?(this._show(r[0],this._showAnim,this._hideAnim),r.removeClass("e-mhover").children("ul:first").find("li:first").addClass("e-mhover")):(this.element.find(".e-mhover >a,.e-mhover >span ").focus(),this.element.find("li.e-list").removeClass("e-mhover e-mfocused"),this._closeAll()),t.isNullOrUndefined(n(r).find(">a").attr("href"))&&this._trigger("click",n.extend({events:e},e)))),i.keyCode==27&&(this.model.menuType=="contextmenu"?this.hideContextMenu(i):this.element.find("li.e-list").removeClass("e-mhover"),this.element.find('li.e-list:has("> ul")').find("> ul:visible").parents("li.e-list").addClass("e-mhover"),this._closeAll()),n(i.target).is(this.element)&&i.target.parentNode)r.length&&(o=r);else return!1;n.inArray(o,this._disabledMenuItems)>-1||(h=n(o).children("a,span").text(),s=t.isNullOrUndefined(o)?"":n(o)[0].id,(this.element.find("li.e-mfocused.e-mhover").length||i.keyCode==13)&&(l=i.keyCode==13?r:this.element.find("li.e-mfocused.e-mhover")),e={text:h,element:o,targetElement:l,event:i,ID:s},this._trigger("keydown",n.extend({events:e},e)));this._activeElement=null;u=this.element.find(".e-mfocused")}},_OnFocusHandler:function(){this.model.menuType!="contextmenu"&&!this.element.find(">li:first").hasClass("e-disable-item")&&this._isFocused&&this.element.find(".e-mhover").length==0&&n("li.e-ham-wrap").length==0?this.element.find(">li:first").addClass("e-mhover"):this._isFocused=!0;this.model.menuType!="contextmenu"&&(this._activeElement=this.element.find(">li:first"))},_OnFocusOutHandler:function(){this._isFocused||(this.element.find("li.e-list").removeClass("e-mhover e-mfocused"),this._closeAll());this._isFocused=!1},_onDocumentClick:function(t){this.model.openOnClick&&(this._hoverOpen=!1);n(t.target).parents("ul.e-menu").is(this.element)||(this.element.find("li.e-list").removeClass("e-mhover e-mfocused"),this._closeAll(),this._isFocused=!0);n(t.target).parents("ul.e-menu").is(this.popupWrapper)||n(t.target).hasClass("e-ham-wrap")||n(t.target).parent().hasClass("e-ham-wrap")||n(t.target).hasClass("e-hamburger")||n(t.target).parent("li").hasClass("e-haschild")||n(t.target).is("span.e-icon.e-arrowhead-down")||this._isOverflowPopupOpen()||this.model.menuType=="contextmenu"||!(n("li.e-ham-wrap").length>0)||this._overflowClose()},_ContextMenuHandler:function(n){var t=!1,r,i,e,u,f;n.type=="taphold"?t=!0:n.button?t=n.button==2:n.which&&(t=n.which==3);r=n.target;t?(i=n,n.type=="taphold"&&(i=n.options.type=="touchstart"?n.options.touches[0]:n.options),e=this._showSpeed,this.showContextMenu(null,null,r,i,!0)):this._isContextMenuOpen&&(u=this._hideAnim,f=this._hideSpeed,this.hideContextMenu(n,u,f))},_calculateContextMenuPosition:function(t){locationX=t.clientX+this.element.width()this.element.height()?t.pageY-this.element.height():n(window).height()-this.element.outerHeight();var i=n("body").css("position")!="static"?n("body").offset():{left:0,top:0};return locationX-=i.left,locationY-=i.top,{X:locationX,Y:locationY}},_onDefaultPreventer:function(n){return n.preventDefault(),n.stopPropagation(),!1},_onContextClose:function(t){var e=this,i,r,u,f;this._isContextMenuOpen&&(i=!1,(n(t.target).is(this.element)||n(t.target).parents(".e-context").is(this.element))&&(i=!0),i||(r=this._hideAnim,u=this._hideSpeed,this.hideContextMenu(t,r,u),f=n(t.target).parents(),n.each(f,function(n,t){t.id==e._ContextTargetId})))}});t.Menu.Locale=t.Menu.Locale||{};t.Menu.Locale["default"]=t.Menu.Locale["en-US"]={titleText:"Menu"};t.MenuType={NormalMenu:"normalmenu",ContextMenu:"contextmenu"};t.Direction={Left:"left",Right:"right",None:"none"};t.AnimationType={None:"none",Default:"default"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPager","ej.Pager",{_rootCSS:"e-pager",validTags:["div"],defaults:{pageSize:12,pageCount:10,currentPage:1,enableExternalMessage:!1,externalMessage:"",pageSizeMessage:"",enableQueryString:!1,locale:"en-US",masterObject:null,click:null,enableRTL:!1,totalRecordsCount:null,totalPages:null,customText:"",showPageInfo:!0,cssClass:"",enabled:!0,showGoToPage:!1,isResponsive:!1},_init:function(){this._initPrivateProperties();this.model.enableQueryString&&this._queryStringValue();this.renderPager();this.model.isResponsive&&this._reSizeHandler();this._wireResizing();this._wireEvents();this.refreshPager()},_initPrivateProperties:function(){this._pageSize=this.model.pageSize.length>0?this.model.pageSize[0]:this.model.pageSize;this._links=[];this._$prev=null;this._$first=null;this._$PP=null;this._$NP=null;this._lastNP=!1;this._lastpageCount=null;this._$last=null;this._$next=null;this._prevPageNo=null;this.localizedLabels=this._getLocalizedLabels();this._intervalWid=0;this._msgWidth=0;this._gotoWid=0},_wireEvents:function(){var n=this;this._on(this.element,"click",this._pagerClickHandler)},_hidedrop:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_wireResizing:function(){this._refreshDropandTextItems();n(window).bind("resize",this.model.isResponsive?n.proxy(this._reSizeHandler,this):n.proxy(this._unWireResizing,this))},_unWireResizing:function(){this._refreshDropandTextItems();this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();n(window).unbind("resize",n.proxy(this._reSizeHandler,this))},_reSizeHandler:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();controlwidth=this._intervalWid+this._gotoWid+this.element.find(".e-pagercontainer").outerWidth()+this._msgWidth;controlwidth>this.element.outerWidth()-20?this._msgWidth>0&&this.element.find(".e-parentmsgbar").addClass("e-msg-res"):this._msgWidth>0&&this.element.find(".e-parentmsgbar").removeClass("e-msg-res");this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen());this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()>40&&(this.option("pageCount",this._maxPageCount),this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen()));this._refreshDropandTextItems()},_refreshDropandTextItems:function(){this.numTextbox&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-parentmsgbar").position().top?this.numTextbox.addClass("e-pager-goto-res"):this.numTextbox.removeClass("e-pager-goto-res"));this.pageInterval_wrap&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-pager-itemsinterval").position().top?this.element.find(".e-pager-itemsinterval").addClass("e-pager-goto-res"):this.element.find(".e-pager-itemsinterval").removeClass("e-pager-goto-res"))},renderPager:function(){var n=t.buildTag("div.e-pagercontainer","",{},{unselectable:"on"});this._renderPagerContainer(n);this.element[0].appendChild(n[0]);this._pageInfo();this.model.showGoToPage&&this._renderTextboxItem();this.model.pageSize.length>0&&this._renderDropdownlist();this.model.enableExternalMessage&&this._renderPagerMessage();this.model.enableRTL&&this.element.addClass("e-rtl");this.model.enabled||this._disable();this._cssClass=this.model.cssClass;this.element.addClass(this.model.cssClass)},_removeDropdownlist:function(){this.pageInterval_wrap.remove();this.$textspan=null;this.$dropItem=null},_renderDropdownlist:function(){var i=this,r;this.pageInterval_wrap=t.buildTag("div.e-pager-itemsinterval","",{},{unselectable:"on"});r=t.buildTag("div.e-drpdwndiv e-icon e-arrow-sans-down","",{},{unselectable:"on"});this.$textspan=t.buildTag("span.e-text");this.sizeIntervals=this.model.pageSize;r.appendTo(this.pageInterval_wrap);this.pageInterval_wrap.appendTo(this.element);this.pageInterval_wrap.insertBefore(this._parentMsgBar);this.$textspan.appendTo(r);i.$textspan.text(this.model.pageSize[0]);this.$dropItem=t.buildTag("ul.e-drpdwn e-ul");this._renderItems();this.$dropItem.appendTo(r);this._renderPageSizeMessage();r.on("click",function(){i.$dropItem.css("display")!="none"?i.$dropItem.hide():i.model.enabled&&i.$dropItem.show()});this.$dropItem.hide();this.$dropItem.find("li").on("click",function(){i.$dropItem.find("li.e-active").removeClass("e-active");n(this).addClass("e-active");i._pageSize=n(this).text();i.$textspan.text(n(this).text());i.refreshPager();i._trigger("pageSizeSelected",{pageSize:i._pageSize})});this._intervalWid=this.element.find(".e-pager-itemsinterval").outerWidth()},_renderPageSizeMessage:function(){var n=t.buildTag("div.e-interval-msg");n.appendTo(this.pageInterval_wrap);this.model.pageSizeMessage.toString().length?n.html(this.model.pageSizeMessage):n.hide()},_renderItems:function(){var i=this;n(this.model.pageSize).each(function(){li=t.buildTag("li");li.text(this);i.$dropItem.append(li)});this.$dropItem.find("li").first().addClass("e-active")},_queryStringValue:function(){var n=new RegExp("[\\?&]page=([^&#]*)").exec(window.location.href);this.model.currentPage=n?parseInt(n[1]||1):1},_renderPagerMessage:function(){var n=t.buildTag("div.e-pagermessage");this.model.externalMessage.toString().length?n.html(this.model.externalMessage):n.hide();this.element.append(n)},_removePagerMessage:function(){this.element.find("div.e-pagermessage").remove()},_mouseScroll:function(n){n.keyCode=="38"?this._updateField("increment"):n.keyCode=="40"&&this._updateField("decrement")},_updateField:function(n){var i=1;this.numTextbox.val()===""?this.numTextbox()=1:this.numTextbox.val().indexOf(" ")>=1&&(this.numTextbox.val()=this._textBox.val().replace(" ",""));this.model.currentPage=t.parseFloat(this.numTextbox.val(),this.model.locale);isNaN(this.model.currentPage)&&!this.model.currentPage&&(this.model.currentPage=1);this.model.currentPage>=1&&this.model.currentPage>this.model.totalPages?(this.model.currentPage=this.model.totalPages,this.numTextbox.val(this.model.currentPage)):this.model.currentPage<1&&this.model.currentPage<=this.model.totalPages?(this.model.currentPage=1,this.numTextbox.val(this.model.currentPage)):this.model.currentPage>=1&&this.model.currentPage<=this.model.totalPages&&(value=n=="increment"?this.model.currentPage+i:this.model.currentPage-i,value>=1&&value<=this.model.totalPages&&(this.numTextbox.val(value),this.model.currentPage=value));this.refreshPager()},_renderTextboxItem:function(){proxy=this;var i=t.buildTag("input#"+this.element[0].id+"_numtext","",{},{type:"textbox"});n(i).appendTo(this._parentMsgBar).insertBefore(n(this._parentMsgBar).find("span"));this.numTextbox=i;this.numTextbox.height(this.element.find(".e-pagercontainer .e-numericcontainer a").outerHeight());this.numTextbox.width(35);this.numTextbox.addClass("e-gototextbox e-textbox");this.model.showGoToPage||this.numTextbox.hide();this._gotoWid=n(this.numTextbox).outerWidth();this._on(n(this.numTextbox),"keydown",this._mouseScroll);this._on(this.numTextbox,"focusout",function(n){n.currentTarget.value=parseInt(n.currentTarget.value);var t=/^[0-9]*$/.test(parseInt(n.currentTarget.value));if(!t)return proxy.numTextbox.val(proxy.model.currentPage),!1;proxy.model.currentPage!=parseInt(n.currentTarget.value)&&(parseInt(n.currentTarget.value)>1&&parseInt(n.currentTarget.value)<=proxy.model.totalPages?(proxy.model.currentPage=parseInt(n.currentTarget.value),proxy.refreshPager()):proxy.numTextbox.val(this.model.currentPage))})},_renderPagerContainer:function(n){this._renderBackwardButton(n);this._renderpreviousPager(n);this._renderNumericItem(n);this._renderForwardPager(n);this._renderForwardButton(n)},_renderMsgBar:function(){var n=t.buildTag("span.e-pagermsg",String.format(this.localizedLabels.pagerInfo,this.model.currentPage,this.model.totalPages||0,this.model.totalRecordsCount||0));this._parentMsgBar.appendChild(n[0]);this._parentMsgBar.style.textAlign=t.TextAlign.Right},_renderpreviousPager:function(n){this._$PP=t.buildTag("a.e-link e-nextprevitemdisabled e-disable e-spacing e-PP","...",{},{title:this.localizedLabels.previousPagerTooltip,role:"link"});n.append(this._$PP)},_renderForwardPager:function(n){this._$NP=t.buildTag("a.e-link e-NP e-numericitem e-spacing e-default","...",{},{title:this.localizedLabels.nextPagerTooltip,role:"link"});n.append(this._$NP)},_renderBackwardButton:function(n){this._$first=t.buildTag("div.e-firstpage e-icon e-mediaback e-firstpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.firstPageTooltip});this._$prev=t.buildTag("div.e-prevpage e-icon e-arrowheadleft-2x e-prevpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.previousPageTooltip});n.append(this._$first);n.append(this._$prev)},_renderNumericItem:function(n){var i=t.buildTag("div.e-numericcontainer e-default","",{},{unselectable:"on"});this._renderNumericLinks(i,this.model.pageCount);n.append(i);this._maxPageCount=this.model.pageCount},_renderNumericLinks:function(n){var i,r;for(n.empty(),this.model.pageCount=Math.round(this.model.pageCount),i=1;i<=this.model.pageCount;i++)r=t.buildTag("a.e-link",this.model.customText+i,{},{role:"link"}).addClass("e-numericitem e-spacing e-default").data("index",i),i==this.model.currentPage&&r.removeClass("e-default").addClass("e-currentitem e-active"),n.append(r);this._links=n.children()},_renderForwardButton:function(n){this._$next=t.buildTag("div.e-nextpage e-icon e-arrowheadright-2x e-default","",{},{unselectable:"on",title:this.localizedLabels.nextPageTooltip});this._$last=t.buildTag("div.e-lastpage e-icon e-mediaforward e-default","",{},{unselectable:"on",title:this.localizedLabels.lastPageTooltip});n.append(this._$next);n.append(this._$last)},_setLocale:function(){this.localizedLabels=this._getLocalizedLabels();this._$first.attr("title",this.localizedLabels.firstPageTooltip);this._$prev.attr("title",this.localizedLabels.previousPageTooltip);this._$next.attr("title",this.localizedLabels.nextPageTooltip);this._$last.attr("title",this.localizedLabels.lastPageTooltip);this._$NP.attr("title",this.localizedLabels.nextPagerTooltip);this._$NP.attr("title",this.localizedLabels.previousPagerTooltip)},_applyCss:function(){this.model.currentPage>1?(this._$prev.removeClass("e-prevpagedisabled").removeClass("e-disable").addClass("e-prevpage e-default"),this._$first.removeClass("e-firstpagedisabled").removeClass("e-disable").addClass("e-firstpage e-default")):(this._$prev.addClass("e-prevpagedisabled e-disable").removeClass("e-prevpage").removeClass("e-default"),this._$first.addClass("e-firstpagedisabled e-disable").removeClass("e-firstpage").removeClass("e-default"));this.model.currentPage>this.model.pageCount?this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastNP=this._links.length&&parseInt(this._links[0].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>this.model.totalPages?!0:!1;this._lastNP==!1?this._$NP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastpageCount=this.model.totalPages%this.model.pageCount;this._lastpageCount==0&&(this._lastpageCount=this.model.pageCount);this.model.currentPage>this.model.totalPages-this._LastpageCount&&(this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"));this.model.currentPage==this.model.totalPages||this.model.totalRecordsCount==0?(this._$last.addClass("e-lastpagedisabled e-disable").removeClass("e-lastpage").removeClass("e-default"),this._$next.addClass("e-nextpagedisabled e-disable").removeClass("e-nextpage").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default")):(this._$last.addClass("e-lastpage e-default").removeClass("e-lastpagedisabled").removeClass("e-disable"),this._$next.addClass("e-nextpage e-default").removeClass("e-nextpagedisabled").removeClass("e-disable"));this._links.length&&(this._links.removeClass("e-currentitem").removeClass("e-active").addClass("e-default"),n(this._links[(this.model.currentPage-1)%this.model.pageCount]).removeClass("e-default").addClass("e-currentitem e-active"),n(this._links[(this._prevPageNo-1)%this.model.pageCount]).removeClass("e-default").addClass("e-numericitem"));this._pageSize>=this.model.totalRecordsCount/this.model.pageCount&&this._$PP!=null&&this._$PP.length!=0&&(this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"))},_SetTotalPages:function(){this.model.totalPages=this.model.totalRecordsCount%this._pageSize==0?this.model.totalRecordsCount/this._pageSize:parseInt(this.model.totalRecordsCount/this._pageSize,10)+1},_refreshNumericItem:function(){var i,t,r;if(this._links.length!=0&&this._links!=null)for(this.model.currentPage=this.model.totalPages==1?1:this.model.currentPage,this.model.currentPage>this.model.totalPages&&this.model.totalPages!=0&&(this.model.currentPage=this.model.totalPages),i=parseInt(this.model.currentPage/this.model.pageCount,10),this.model.currentPage%this.model.pageCount==0&&i>0&&(i=i-1),this._links.css("display","none"),t=0;t=this.model.totalPages&&(this._lastNP=!0)):this.model.currentPage++:r.hasClass("e-prevpage")&&r.hasClass("e-prevpagedisabled")!=!0?(this.model.currentPage%this.model.pageCount==1&&(this._lastNP=!1),this.model.currentPage--,this.model.currentPage<0&&(this.model.currentPage=0)):r.hasClass("e-lastpage")&&r.hasClass("e-lastpagedisabled")!=!0?(this._LastpageCount=this.model.totalPages%this.model.pageCount,this._LastpageCount==0?this._LastpageCount=this.model.pageCount:null,this.model.currentPage=this.model.totalPages,this._lastNP=!0):r.hasClass("e-firstpage")&&r.hasClass("e-firstpagedisabled")!=!0?(this.model.currentPage=1,this._lastNP=!1):r.hasClass("e-NP")&&r.hasClass("e-nextprevitemdisabled")!=!0?(this._links!=i&&(this.model.currentPage=parseInt(n(this._links[0]).data("index"),10)+this.model.pageCount),parseInt(this._links[this.model.pageCount-1].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>=this.model.totalPages&&(this._lastNP=!0,this._LastpageCount=this.model.totalRecordsCount-this._pageSize=1&&n<=this.model.totalPages?(this.model.currentPage=n,this.model.enableQueryString&&this._updateQueryString(this.model.currentPage),this._trigger("click",{currentPage:n,event:t})):this._trigger("click",{currentPage:n,event:t})},_updateQueryString:function(n){var t=this._getUpdatedURL(window.location.href,"page",n);history.pushState?window.history.pushState({path:t},"",t):window.location.href=t},_getUpdatedURL:function(n,t,i){var u=new RegExp("([?|&])"+t+"=.*?(&|#|$)","i"),r,f;return n.match(u)?n.replace(u,"$1"+t+"="+i+"$2"):(r="",f=n.indexOf("?")!==-1?"&":"?",n.indexOf("#")!==-1&&(r=n.replace(/.*#/,"#"),n=n.replace(/#.*/,"")),n+f+t+"="+i+r)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_fillScreen:function(){var t=this.element.find(".e-pagercontainer").outerWidth()-(this._$first.outerWidth()+this._$last.outerWidth()+this._$next.outerWidth()+this._$prev.outerWidth());t-=this._$NP.hasClass("e-disable")?0:this._$NP.outerWidth();t-=this._$PP.hasClass("e-disable")?0:this._$PP.outerWidth();this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1<1?this._flag?this.option("pageCount",1):this.model.pageCount=1:this._flag?this.option("pageCount",Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1):this.model.pageCount=Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1)},_enable:function(){this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.numTextbox&&this.numTextbox.addClass("e-disable")},_disable:function(){this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.prop("disabled","disabled");this.numTextbox&&this.numTextbox.removeClass("e-disable");this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"pageCount":this._renderNumericLinks(this.element.find(".e-numericcontainer"));this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen());this._flag=!1;break;case"enableExternalMessage":n[t]?this._renderPagerMessage():this._removePagerMessage();break;case"showPageInfo":this._pageInfo();break;case"pageSizeMessage":n[t]!=null&&this._renderPageSizeMessage();break;case"pageSize":this._pageSize=this.model.pageSize;n[t].length>0?(this._pageSize=this.model.pageSize[0],this.$dropItem?(this.$dropItem.find("li").remove(),this._renderItems()):this._renderDropdownlist()):this.$dropItem&&this._removeDropdownlist();break;case"enabled":n[t]?this._enable():this._disable();break;case"cssClass":this.element.removeClass(this._cssClass).addClass(n[t]);this._cssClass=this.model.cssClass;case"isResponsive":this._wireResizing();n[t]?this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen()):this.option("pageCount",this._maxPageCount);this._flag=!1;break;case"showGoToPage":n[t]?this._renderTextboxItem():this.numTextbox&&this.numTextbox.remove();break;case"locale":this._setLocale()}this.refreshPager()},_destroy:function(){this.element.empty().removeClass("e-pager");this._unWireResizing()}});t.Pager.Locale=t.Pager.Locale||{};t.Pager.Locale["default"]=t.Pager.Locale["en-US"]={pagerInfo:"{0} of {1} pages ({2} items)",firstPageTooltip:"Go to first page",lastPageTooltip:"Go to last page",nextPageTooltip:"Go to next page",previousPageTooltip:"Go to previous page",nextPagerTooltip:"Go to next pager",previousPagerTooltip:"Go to previous pager"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejSlider","ej.Slider",{element:null,model:null,validTags:["div","span"],_addToPersist:["value","values"],_rootCSS:"e-slider",_setFirst:!1,_requiresID:!0,defaults:{orientation:"horizontal",enableAnimation:!0,animationSpeed:500,showTooltip:!0,cssClass:"",showRoundedCorner:!1,readOnly:!1,enableRTL:!1,htmlAttributes:{},minValue:0,maxValue:100,sliderType:"default",value:null,values:null,incrementStep:1,height:null,width:null,enabled:!0,showScale:!1,largeStep:10,smallStep:1,showSmallTicks:!0,enablePersistence:!1,allowMouseWheel:!1,start:null,stop:null,slide:null,change:null,create:null,destroy:null,tooltipChange:null},dataTypes:{orientation:"enum",enableAnimation:"boolean",animationSpeed:"number",cssClass:"string",showRoundedCorner:"boolean",readOnly:"boolean",enableRTL:"boolean",minValue:"number",maxValue:"number",sliderType:"enum",incrementStep:"number",enabled:"boolean",showScale:"boolean",largeStep:"number",smallStep:"number",showSmallTicks:"boolean",enablePersistence:"boolean",htmlAttributes:"data",allowMouseWheel:"boolean"},observables:["value","values"],value:t.util.valueFunction("value"),values:t.util.valueFunction("values"),enable:function(){this.model.enabled||(this.model.enabled=!0,this.wrapper&&this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable"),this._wireEvents())},disable:function(){this.model.enabled&&(this.model.enabled=!1,this.wrapper&&this.wrapper.addClass("e-disable"),this.element.addClass("e-disable"),this._unWireEvents())},_validateValue:function(n,t){t=typeof t=="undefined"?!1:t;n==null||n===""?n=this.model.minValue:typeof n=="string"&&(n=parseFloat(n));this._isNumber(n)?this.value(n):this._isNumber(this.value())||this.value(this.model.minValue);this.model.sliderType!="range"&&this._setValue(t)},_validateRangeValue:function(n,t){if(t=typeof t=="undefined"?!1:t,n==null)n=[this.model.minValue,this.model.maxValue];else if(typeof n=="string"){var i=n.split(",");i.length>1&&(n=[parseFloat(i[0]),parseFloat(i[1])])}typeof n=="object"&&this._isNumber(n[0])&&this._isNumber(n[1])?this.values([n[0],n[1]]):typeof this.values()=="object"&&this._isNumber(this.values()[0])&&this._isNumber(this.values()[1])||this.values([this.model.minValue,this.model.maxValue]);this.model.sliderType=="range"&&this._setRangeValue(t)},_validateStartEnd:function(){isNaN(this.model.minValue)&&(this.model.minValue=0);isNaN(this.model.maxValue)&&(this.model.maxValue=100)},_isNumber:function(n){return typeof n=="number"&&!isNaN(n)},_outerCorner:function(n){n?this._roundedCorner():this._sharpedCorner()},_changeSkin:function(n){this.element.removeClass(this.model.cssClass).addClass(n);this.model.showScale&&this.ul.removeClass(this.model.cssClass).addClass(n)},getValue:function(){return this._getHandleValue()},setValue:function(n,t){this.model.sliderType=="range"?this._validateRangeValue(n,t):this._validateValue(n,t)},_init:function(){this._isInteraction=!0;this._initialize();this._render()},_setModel:function(n){var r,u;this._isInteraction=!1;t.isNullOrUndefined(n.minValue)&&t.isNullOrUndefined(n.maxValue)||(this._isNumber(n.minValue)?this.model.minValue=n.minValue:n.minValue=this.model.minValue,this._isNumber(n.maxValue)?this.model.maxValue=n.maxValue:n.maxValue=this.model.maxValue,this.model.sliderType=="range"&&n.values==i?this._setRangeValue():this.model.sliderType!="range"&&n.value==i&&this._setValue());for(r in n)switch(r){case"value":this._validateValue(t.util.getVal(n[r]));n[r]=this.model.value;break;case"values":this._validateRangeValue(t.util.getVal(n[r]));n[r]=this.model.values;break;case"height":this.model.height=n[r];this._setDimension();this.model.showScale&&this._scaleAlignment();break;case"width":this.model.width=n[r];this._setDimension();this.model.showScale&&this._scaleAlignment();break;case"enabled":this._disabled(!n[r]);break;case"showRoundedCorner":this._outerCorner(n[r]);break;case"enableRTL":this.model.enableRTL=n[r];this._checkRTL();n[r]=this.model.enableRTL;break;case"cssClass":this._changeSkin(n[r]);break;case"showScale":this._renderScale(n[r]);break;case"orientation":u=this.model.height;this.model.height=this.model.width;this.model.width=u;case"sliderType":this._sliderOptions(r,n[r]);break;case"smallStep":case"largeStep":case"showSmallTicks":case"minValue":case"maxValue":this._scaleOptions(r,n[r]);break;case"htmlAttributes":this._addAttr(n[r]);break;case"tooltipChange":this.model.tooltipChange=n[r];break;case"allowMouseWheel":this.model.allowMouseWheel=n[r]}},_destroy:function(){this.model.showScale&&this._destroyScale();this.element.insertAfter(this.wrapper);this.wrapper.remove();this.element.removeClass("e-widget e-box "+this.model.cssClass).empty()},_initialize:function(){this.target=this.element[0];this.horDir="left";this.verDir="bottom";this._isFocused=!1},_render:function(){this.initialRender=!0;this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this.wrapper=t.buildTag("div.e-slider-wrap e-widget"+this.model.cssClass+"#"+this.target.id+"_wrapper",{tabindex:"0",role:"slider"}).insertAfter(this.element);this.wrapper.append(this.element);this.element.addClass("e-widget e-box "+this.model.cssClass);this.model.sliderType!="default"&&(this.header=t.buildTag("div.e-range"),this.element.append(this.header),this.model.sliderType=="range"&&(this.secondHandle=this._createHandle()));this.firstHandle=this._createHandle();this._setOrientation();this._setDimension();this._insertHiddenField();this._checkProperties();this._addAttr(this.model.htmlAttributes);this._setSliderValue()},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i._disabled(!0):i.element.attr(t,n)})},_renderScale:function(n){var u,f,i,o,h,c;if(n){this.wrapper.addClass("e-scale-wrap");u="width";f="h";this.model.orientation=="vertical"&&(u="height",f="v");i=this.model.smallStep;this.model.showSmallTicks?i<=0&&(i=this.model.incrementStep):i=this.model.largeStep>0?this.model.largeStep:this.model.maxValue-this.model.minValue;o=Math.abs(this.model.maxValue-this.model.minValue)/i;this.ul=t.buildTag("ul.e-scale e-"+f+"-scale "+this.model.cssClass);this._isIE8&&this.ul.addClass("e-ie8");this.wrapper.append(this.ul);var e,r=this.model.minValue,l=0,s=100/o;for(f=="v"&&(r=this.model.maxValue),h=0;h<=o;h++)e=t.buildTag("li.e-tick","",{},{title:r}),e.css(u,s+"%"),r%this.model.largeStep==0&&(c=t.buildTag("span.e-tick-value",""+r),e.addClass("e-large").append(c)),this.ul.append(e),f=="h"?r+=i:r-=i,l+=i;this.ul.children().first().addClass("e-first-tick").css(u,s/2+"%");this.ul.children().last().addClass("e-last-tick").css(u,s/2+"%");this._scaleAlignment()}else this._destroyScale();this._setWrapperHeight()},_destroyScale:function(){this.wrapper.removeClass("e-scale-wrap");this.ul.remove();this.ul=null},_tickValuePosition:function(){var n=this.model.orientation=="vertical"?"height":"width",t=this.model.orientation=="vertical"?"top":"left",i=this.ul.find(".e-tick.e-first-tick"),r=i.find(".e-tick-value"),u=this.ul.find(".e-tick.e-large:not(.e-first-tick)").find(".e-tick-value");tickWidth=i[n]()*2;r.css(t,-r[n]()/2);u.css(t,(tickWidth-u[n]())/2)},_scaleAlignment:function(){var u;this._tickValuePosition();var f=12,t=20,e=t/2,n="height",i="top",r="h";this.model.orientation=="vertical"?(n="width",i="right",r="v",this.element.width()<=15?this.wrapper.addClass("e-small-size"):this.wrapper.removeClass("e-small-size")):this.element.height()<=15?this.wrapper.addClass("e-small-size"):this.wrapper.removeClass("e-small-size");this.ul.css(i,-(this.wrapper[n]()+e));r=="v"&&this.ul.css("top",-this.wrapper.height()).css(i,e);this.ul[n](this.wrapper[n]()+t);u=-(t-f)/2;this.model.largeStep==null&&r!="v"&&(u=-u);this.ul.find(".e-tick:not(.e-large)").css(n,this.wrapper[n]()+f).css(i,u);r=="v"&&this.ul.children(".e-large").find(".e-tick-value").css("right",this.wrapper.width()+t+4)},_setWrapperHeight:function(){var i,r,n,t;this.model.orientation=="horizontal"?(i=this.ul?this.firstHandle.outerHeight()>this.ul.height()?this.firstHandle.outerHeight():this.ul.height():this.firstHandle.outerHeight(),n=(i-this.element.outerHeight())/2,n<0&&(n=0),this.wrapper.css({padding:n+"px 0px"})):(r=this.ul?this.firstHandle.outerWidth()>this.ul.width()?this.firstHandle.outerWidth():this.ul.width():this.firstHandle.outerWidth(),t=(r-this.element.outerWidth())/2,t<0&&(t=0),this.wrapper.css({padding:"0px "+t+"px"}))},_createHandle:function(){return handle=t.buildTag("a.e-handle e-select","",{},{"aria-label":"drag",tabindex:0,role:"slider","aria-valuemin":this.model.minValue,"aria-valuemax":this.model.maxValue}),t.browserInfo().name=="msie"&&handle.addClass("e-pinch"),this.element.append(handle),handle},_setDimension:function(){this.model.height&&this.wrapper.height(this.model.height);this.model.width&&this.wrapper.width(this.model.width);this._setHandleSize();this._handleAlignment(this.model.enableRTL)},_insertHiddenField:function(){this._hidden=t.buildTag("input","",{},{type:"hidden",name:this.element[0].id});this._hidden.val(this._getHandleValue());this.element.append(this._hidden)},_checkProperties:function(){this.model.enabled?this._wireEvents():this.wrapper?this.wrapper.addClass("e-disable"):this.element.addClass("e-disable");this.model.showScale?this._renderScale(!0):this._setWrapperHeight();this.model.enableRTL&&this._checkRTL();this.model.showRoundedCorner&&this._roundedCorner()},_roundedCorner:function(){this.element.addClass("e-corner")},_sharpedCorner:function(){this.element.removeClass("e-corner")},_handleAlignment:function(n){var t=-(this.firstHandle.outerWidth()/2)+"px",i;i=this.model.orientation!="vertical"?n?"0 "+t+" 0 0":"0 0 0 "+t:n?t+" 0 0 0":"0 0 "+t+" 0";this.element.children(".e-handle").css("margin",i)},_checkRTL:function(){var i,n,t;this.model.showScale&&this.model.orientation=="vertical"&&this.model.enableRTL&&(this.model.enableRTL=!1);i=this.model.enableRTL;n=this.model.orientation!="vertical"?this.horDir:this.verDir;i?(this.wrapper.addClass("e-rtl"),this.horDir="right",this.verDir="top"):(this.wrapper.removeClass("e-rtl"),this.horDir="left",this.verDir="bottom");t=this.model.orientation!="vertical"?this.horDir:this.verDir;n!=t&&(this.firstHandle.css(t,this.firstHandle.css(n)).css(n,"auto"),this.model.sliderType!="default"&&(this.header.css(t,this.header.css(n)).css(n,"auto"),this.model.sliderType=="range"&&this.secondHandle.css(t,this.secondHandle.css(n)).css(n,"auto")));this._handleAlignment(i)},_setOrientation:function(){this.model.orientation!="vertical"?this.wrapper.addClass("e-horizontal"):(this.wrapper.addClass("e-vertical"),this.firstHandle.css(this.verDir,"0"))},_setHandleSize:function(){if(this.model.height!=null&&this.model.orientation=="horizontal"||this.model.width!=null&&this.model.orientation=="vertical"){var n;n=this.model.orientation!="vertical"?this.wrapper.height()+2:this.wrapper.width()+2;this.element.find(".e-handle").height(n).width(n)}else this.wrapper.addClass("e-default-wrap"),this.element.find(".e-handle").addClass("e-default")},_disabled:function(n){n?this.disable():this.enable()},_sliderOptions:function(n,t){this._unWireEvents();this._destroy();this.model[n]=t;this._init()},_scaleOptions:function(n,t){this.model.showScale&&(this._destroyScale(),this.model[n]=t,this._renderScale(!0))},_showTooltip:function(){if(this.model.showTooltip){this._timeOut&&clearTimeout(this._timeOut);var i=this.tooltip?n("body .e-tooltipbox").text().replace(/\s+/g,"").replace("-",","):"";if(this.tooltip&&this.tooltip.length&&this.tooltip.css("display")!="none"&&this._getHandle()[0]==this._oldHandle&&i==this.preValue){this._getHandleValue().toString()!=this.preValue&&this._setTooltipPosition();return}this._oldHandle=this._getHandle()[0];n("body .e-tooltipbox").remove();this.tooltip=t.buildTag("div.e-tooltipbox"+this.model.cssClass+" e-corner",{role:"tooltip"}).css(this._getOffset(this._getHandle()));n("body").append(this.tooltip);this.model.orientation=="vertical"&&this.tooltip.addClass("e-vertical");this._setTooltipPosition()}},_hideTooltip:function(){if(this.model.showTooltip){var n=this;this._timeOut=setTimeout(function(){n.tooltip.fadeOut(800)},1500)}},_showhideTooltip:function(n){this.model.showTooltip&&n&&(this._showTooltip(),this._timeOut&&clearTimeout(this._timeOut),this._hideTooltip())},_setTooltipPosition:function(){var i,r,o,f,u,t,e,s,h,c;this.model.showTooltip&&(this._updateTooltipValue(),e=5,u=this._getHandle(),t=this._getOffset(u),tooltipPos=this._getOffset(this.tooltip),border=n(u).outerHeight()-n(u).height(),this.model.orientation=="vertical"?(f=(this.tooltip.outerHeight()-u.outerHeight())/2,o=u.outerWidth()+e,i=t.top-f,r=t.left+o,s=n(window).height(),window.pageYOffset>0&&(s+=window.pageYOffset),i<0?i=0:sn(window).width()&&this.tooltip.css({left:"0px"}),o=(this.tooltip.outerWidth()-u.outerWidth())/2,f=this.tooltip.outerHeight()+e,i=t.top-f,r=t.left-o,h=n(window).width(),window.pageXOffset>0&&(h+=window.pageXOffset),r<0?r=0:hn(window).height()?(i=t.top,r=t.left>this.tooltip.outerWidth()+e+border?t.left-(this.tooltip.outerWidth()+border):t.left+(u.outerWidth()+e+border)):i=t.top+u.outerHeight()+border)),c=this._maxZindex(),this.tooltip.css({top:i,left:r,zIndex:c+1}))},_getOffset:function(n){return t.util.getOffset(n)},_maxZindex:function(){return t.util.getZindexPartial(this.element,this.popup)},_updateTooltipValue:function(){var t=0,i=1,n;this.model.enableRTL&&(t=1,i=0);n=this.model.tooltipChange?this._raiseEvent("tooltipChange"):this._getHandleValue();this.tooltip[0].innerHTML=this.model.sliderType!="range"?n:n[t]+" - "+n[i]},_increaseHeaderWidth:function(n){if(this.model.sliderType!="default"){var i="width",r=this.horDir,t={};this.model.orientation=="vertical"&&(i="height",r=this.verDir);this.model.sliderType=="range"?(t[i]=this.handlePos-this.handlePos2+"%",t[r]=this.handlePos2+"%"):(t[i]=this.handlePos+"%",t[r]=0);n?this.header.animate(t,this.model.animationSpeed):this.header.css(t)}},_setSliderValue:function(){this._validateStartEnd();this.model.sliderType=="range"?this._validateRangeValue(this.values()):this._validateValue(this.value());this.preValue=this.getValue().toString()},_hoverOnHandle:function(t){n(t.currentTarget).addClass("e-hover")},_leaveFromHandle:function(t){n(t.currentTarget).removeClass("e-hover")},_firstHandleClick:function(i){if(i.preventDefault(),this.firstHandle.focus().addClass("e-no-tab"),this._raiseEvent("start"))return!1;this.mouseDownPos=this.handlePos;this.model.readOnly||this._on(n(document),t.eventType.mouseMove,this._firstHandleMove);this._on(n(document),t.eventType.mouseUp,this._firstHandleUp);this._on(n(document),"mouseleave",this._firstHandleUp);this._showTooltip()},_firstHandleMove:function(n){n.preventDefault();n=n.type=="touchmove"?n.originalEvent.changedTouches[0]:n;var t={x:n.pageX,y:n.pageY};this.handlePos=this._xyToPosition(t);this.model.sliderType=="range"&&this.handlePosthis.handlePos&&(this.handlePos2=this.handlePos);this.handlePos2!=this.preHandlePos2&&(this.preHandlePos2=this.handlePos2,this.handleVal2=this._positionToValue(this.handlePos2),this._increaseHeaderWidth(!1),this._setHandlePosition(!1,!1,!1),this._setTooltipPosition(),this._updateModelValue(),this._raiseEvent("slide"))},_secondHandleUp:function(i){i.preventDefault();this._off(n(document),t.eventType.mouseMove,this._secondHandleMove);this._off(n(document),t.eventType.mouseUp,this._secondHandleUp);this._off(n(document),"mouseleave",this._secondHandleUp);this._timeOut&&clearTimeout(this._timeOut);this._hideTooltip();this.mouseDownPos2!=this.handlePos2&&this._raiseChangeEvent()},_focusInHandle:function(t){this._isFocused||(this._isFocused=!0,n(t.currentTarget).addClass("e-focus"),this.model.readOnly||this._on(n(document),"keydown",this._moveHandle),this.model.allowMouseWheel&&!this.model.readOnly&&this._on(this.element,"mousewheel DOMMouseScroll",this._moveHandle),this.activeHandle=n(t.currentTarget).is(this.firstHandle)?1:2,this._setZindex())},_focusOutHandle:function(t){this._isFocused=!1;this.model.showTooltip&&this.tooltip&&this.tooltip.fadeOut(800);this.element.find(".e-no-tab").removeClass("e-no-tab");n(t.currentTarget).removeClass("e-focus");this._off(n(document),"keydown",this._moveHandle);this._off(this.element,"mousewheel DOMMouseScroll",this._moveHandle)},_moveHandle:function(n){var t,i,r,f,u,e;(n.type=="mousewheel"||n.type=="DOMMouseScroll")&&n.preventDefault();r=this._getHandleIndex(this.activeHandle)-1;n.originalEvent.detail&&(f=-n.originalEvent.detail/3,t=f>0?"add":"sub");switch(n.keyCode||n.originalEvent.wheelDelta){case-120:case 37:case 40:this._getHandle().addClass("e-no-tab");n.preventDefault();t="sub";break;case 120:case 38:case 39:this._getHandle().addClass("e-no-tab");n.preventDefault();t="add";break;case 36:if(this._getHandle().addClass("e-no-tab"),n.preventDefault(),this._raiseEvent("start"))return!1;this.model.sliderType!="range"&&this.value()!=this.model.minValue?this._changeHandleValue(this.model.minValue,this.model.enableAnimation):this.model.sliderType=="range"&&(i=this.activeHandle==2?this.model.minValue:this.handleVal2,this.values()[r]!=i&&this._changeHandleValue(i,this.model.enableAnimation));break;case 35:if(this._getHandle().addClass("e-no-tab"),n.preventDefault(),this._raiseEvent("start"))return!1;this.model.sliderType!="range"&&this.value()!=this.model.maxValue?this._changeHandleValue(this.model.maxValue,this.model.enableAnimation):this.model.sliderType=="range"&&(i=this.activeHandle==1?this.model.maxValue:this.handleVal,this.values()[r]!=i&&this._changeHandleValue(i,this.model.enableAnimation));break;case 27:this._getHandle().addClass("e-no-tab");n.preventDefault();this._getHandle().focusout()}if(t=="add"||t=="sub"){if(this._raiseEvent("start"))return!1;u=this.activeHandle==1?this.handleVal:this.handleVal2;e=t=="add"?this._add(u,this.model.incrementStep,!0):this._add(u,this.model.incrementStep,!1);this._changeHandleValue(e,!1)}},_changeHandleValue:function(n,t){var i=null;this.activeHandle==1?(this.handleVal=this._checkHandleValue(n),this.handlePos=this._checkHandlePosition(this.handleVal),this.model.sliderType=="range"&&this.handlePosi-this.handlePos2?(this.handlePos2=this.preHandlePos2=i,this.handleVal2=r,this.activeHandle=2):(this.handlePos=this.preHandlePos=i,this.handleVal=r,this.activeHandle=1);this._getHandle().focus().addClass("e-no-tab");this.model.sliderType!="default"&&this._increaseHeaderWidth(this.model.enableAnimation);this._setHandlePosition(this.model.enableAnimation,!0,!0)}},_setHandlePosition:function(n,t,i){var r=this._getHandle(),e=this,u={},f,o,s;f=this.activeHandle==1?this.handlePos:this.handlePos2;o=this.activeHandle==1?this.handleVal:this.handleVal2;r.attr("aria-label",o);s=this.model.orientation=="vertical"?this.verDir:this.horDir;u[s]=f+"%";f==0?this.model.sliderType!="range"&&this._getHandle().addClass("e-handle-start"):this._getHandle().removeClass("e-handle-start");n?r.animate(u,this.model.animationSpeed,function(){e._showhideTooltip(t);i&&e._raiseChangeEvent()}):(r.css(u),this._showhideTooltip(t),i&&this._raiseChangeEvent())},_xyToPosition:function(n){if(this.model.minValue==this.model.maxValue)return 100;if(this.model.orientation!="vertical")var r=n.x-this.element.offset().left,i=this.element.width()/100,t=r/i;else var u=n.y-this.element.offset().top,i=this.element.height()/100,t=100-u/i;return(t=this._stepValueCalculation(t),t<0?t=0:t>100&&(t=100),this.model.enableRTL)?100-t:t},_updateValue:function(){this.handleVal=this._checkHandleValue(this.value());this.handlePos=this._checkHandlePosition(this.handleVal);this.preHandlePos=this.handlePos;this.activeHandle=1},_setValue:function(n){this._updateValue();this._increaseHeaderWidth(n);this._setHandlePosition(n,!1,!0)},_updateRangeValue:function(){var n=this.values();this.handleVal=this._checkHandleValue(n[1]);this.handleVal2=this._checkHandleValue(n[0]);this.handlePos=this._checkHandlePosition(this.handleVal);this.handlePos2=this._checkHandlePosition(this.handleVal2);this.handlePos=t.start&&n<=t.end?100*(n-this.model.minValue)/(this.model.maxValue-this.model.minValue):nt.end&&(n=t.end),n},_tempStartEnd:function(){return this.model.minValue>this.model.maxValue?{start:this.model.maxValue,end:this.model.minValue}:{start:this.model.minValue,end:this.model.maxValue}},_positionToValue:function(n){var t=this.model.maxValue-this.model.minValue,i=this._round(t*n/100);return this._add(i,this.model.minValue,!0)},_getHandle:function(){return this.activeHandle==1?this.firstHandle:this.secondHandle},_getHandleIndex:function(n){return this.model.sliderType=="range"&&n==1?2:1},_getHandleValue:function(){return this.model.sliderType=="range"?[this.handleVal2,this.handleVal]:this.handleVal},_updateModelValue:function(){var n=this._getHandleValue();this.model.sliderType=="range"?this.values(n):this.value(n);this._hidden.val(n)},_add:function(n,t,i,r){var u=Math.pow(10,r||3);return i?(Math.round(n*u)+Math.round(t*u))/u:(Math.round(n*u)-Math.round(t*u))/u},_round:function(n){var t=this.model.incrementStep.toString().split(".");return t[1]?parseFloat(n.toFixed(t[1].length)):Math.round(n)},_raiseChangeEvent:function(){this._updateModelValue();this.initialRender?this.initialRender=!1:this.getValue().toString()!=this.preValue.toString()&&(this._raiseEvent("change"),this._raiseEvent("stop"),this.preValue=this.getValue().toString(),this._isInteraction=!0)},_raiseEvent:function(n){var t={id:this.target.id,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)},i;return(n=="change"&&(t={id:this.target.id,isInteraction:this._isInteraction,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)}),n=="tooltipChange"&&(t={id:this.target.id,isInteraction:this._isInteraction,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)}),i=this._trigger(n,t),n=="tooltipChange")?t.value:i},_setZindex:function(){this.model.sliderType=="range"&&(this.activeHandle==1?(this.firstHandle.css("z-index",2),this.secondHandle.css("z-index",1)):(this.firstHandle.css("z-index",1),this.secondHandle.css("z-index",2)))},_stepValueCalculation:function(n){this.model.incrementStep==0&&(this.model.incrementStep=1);var i=this.model.incrementStep/((this.model.maxValue-this.model.minValue)/100),t=n%Math.abs(i);return t!=0&&(i/2>t?n-=t:n+=Math.abs(i)-t),n},_wireEvents:function(){this._on(this.wrapper,"mousedown",this._sliderBarClick);this._on(this.firstHandle,t.eventType.mouseDown,this._firstHandleClick);this._on(this.firstHandle,"mouseenter",this._hoverOnHandle);this._on(this.firstHandle,"mouseleave",this._leaveFromHandle);this._on(this.firstHandle,"focusin",this._focusInHandle);this._on(this.firstHandle,"focusout",this._focusOutHandle);this.model.sliderType=="range"&&(this._on(this.secondHandle,t.eventType.mouseDown,this._secondHandleClick),this._on(this.secondHandle,"mouseenter",this._hoverOnHandle),this._on(this.secondHandle,"mouseleave",this._leaveFromHandle),this._on(this.secondHandle,"focusin",this._focusInHandle),this._on(this.secondHandle,"focusout",this._focusOutHandle))},_unWireEvents:function(){this._off(this.wrapper,"mousedown");this._off(this.firstHandle,t.eventType.mouseDown);this._off(this.firstHandle,"mouseenter");this._off(this.firstHandle,"mouseleave");this._off(this.firstHandle,"focusin");this._off(this.firstHandle,"focusout");this.model.sliderType=="range"&&(this._off(this.secondHandle,t.eventType.mouseDown),this._off(this.secondHandle,"mouseenter"),this._off(this.secondHandle,"mouseleave"),this._off(this.secondHandle,"focusin"),this._off(this.secondHandle,"focusout"))}});t.SliderType={Default:"default",MinRange:"minrange",Range:"range"}}(jQuery,Syncfusion),function(n,t){t.widget("ejSplitButton","ej.SplitButton",{element:null,model:null,validTags:["button"],_setFirst:!1,_rootCSS:"e-splitbutton",defaults:{size:"normal",width:"",height:"",enabled:!0,htmlAttributes:{},text:null,contentType:"textonly",imagePosition:"imageleft",buttonMode:"split",arrowPosition:"right",targetID:null,target:null,showRoundedCorner:!1,prefixIcon:null,suffixIcon:null,cssClass:"",enableRTL:!1,create:null,beforeOpen:null,click:null,itemMouseOver:null,itemMouseOut:null,itemSelected:null,open:null,close:null,destroy:null},dataTypes:{size:"string",enabled:"boolean",showRoundedCorner:"boolean",text:"string",contentType:"enum",imagePosition:"enum",buttonMode:"enum",arrowPosition:"enum",target:"string",targetID:"string",prefixIcon:"string",suffixIcon:"string",cssClass:"string",enableRTL:"boolean",htmlAttributes:"data"},disable:function(){this.element.addClass("e-disable");this.wrapper.addClass("e-disable");this.contstatus&&this._hidePopup();this.model.buttonMode==t.ButtonMode.Split&&this.dropbutton.addClass("e-disable").attr("aria-disabled",!0);this.model.buttonMode==t.ButtonMode.Dropdown&&this.btnimgwrap.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1},visible:function(n){n?(this.wrapper.removeClass("e-split-btn-hide"),this.wrapper.find(".e-icon").css("visibility","")):(this.wrapper.addClass("e-split-btn-hide"),this.wrapper.find(".e-icon").css("visibility","hidden"))},enable:function(){this.element.removeClass("e-disable");this.wrapper.removeClass("e-disable");this.model.buttonMode==t.ButtonMode.Split&&this.dropbutton.removeClass("e-disable").attr("aria-disabled",!1);this.model.buttonMode==t.ButtonMode.Dropdown&&this.btnimgwrap.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0},hide:function(){this.contstatus&&this._hidePopup()},show:function(){this.contstatus||(this.model.buttonMode==t.ButtonMode.Dropdown?this.element.click():this.model.buttonMode==t.ButtonMode.Split&&this.dropbutton.click())},_init:function(){this._cloneElement=this.element.clone();this._initialize();this._controlStatus(this.model.enabled);this._documentClickHandler=n.proxy(this._documentClick,this);this._wireEvents()},_destroy:function(){this.splitwrap.removeClass("e-drop");this.splitwrap.removeClass("e-btn-"+this.model.size);this.innerWrap.removeClass("e-splitarrowright e-splitarrowleft e-splitarrowbottom e-splitarrowtop");this.element.removeClass(this.model.cssClass+" e-select e-corner e-btn e-disable e-split-btn e-droparrowright e-droparrowleft e-droparrowbottom e-droparrowtop e-left-btn e-txt").empty();this.element.append(this._cloneElement.text());this.element.insertAfter(this.wrapper);this.wrapper.remove();n(this.model.target).ejMenu("destroy");n(this.model.target).insertAfter(this.element);this._off(this.element,"click",this._btnMouseClick)},_setModel:function(t){for(var i in t)switch(i){case"size":this._setSize(t[i]);break;case"width":this._splitbtnWidth(t[i]);break;case"height":this._splitbtnHeight(t[i]);break;case"contentType":this._setContentType(t[i]);break;case"imagePosition":this._setImagePosition(t[i]);break;case"buttonMode":this._setButtonMode(t[i]);break;case"arrowPosition":this._setArrowPosition(t[i]);break;case"text":this._setText(t[i]);break;case"prefixIcon":this._setMajorIcon(t[i]);break;case"suffixIcon":this._setMinorIcon(t[i]);break;case"enabled":this._controlStatus(t[i]);break;case"targetID":case"target":this._setTarget(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"cssClass":this._setSkin(t[i]);break;case"enableRTL":this._setRTL(t[i]);n(this.model.target).ejMenu({enableRTL:t[i]});break;case"htmlAttributes":this._addAttr(t[i])}},_setText:function(n){this.model.contentType==t.ContentType.TextOnly?this.model.buttonMode==t.ButtonMode.Split?this.element.html(n):(this.element.empty(),this.imgtxtwrap=n,this.model.arrowPosition==t.ArrowPosition.Left||this.model.arrowPosition==t.ArrowPosition.Top?this.element.append(this.btnimgwrap,this.imgtxtwrap):this.element.append(this.imgtxtwrap,this.btnimgwrap)):this.textspan.html(n)},_setMajorIcon:function(n){this.majorimgtag.removeClass(this.model.prefixIcon);this.majorimgtag.addClass(n)},_setMinorIcon:function(n){this.minorimgtag.removeClass(this.model.suffixIcon);this.minorimgtag.addClass(n)},_setTarget:function(n){n.substring(0,1)=="."||n.substring(0,1)=="#"?this.model.target=n:(this.model.targetID=n,this.model.target="#"+n);this._renderContxtMenu()},_setContentType:function(n){n!=this.model.contentType&&(this.element.empty(),this.model.contentType=n,this._renderButtonContent())},_setImagePosition:function(n){(n==t.ImagePosition.ImageRight||n==t.ImagePosition.ImageLeft||n==t.ImagePosition.ImageBottom||n==t.ImagePosition.ImageTop)&&this.model.contentType==t.ContentType.TextAndImage&&n!=this.model.imagePosition&&(this.element.empty(),this.model.imagePosition=n,this._renderButtonContent())},_setButtonMode:function(n){(n==t.ButtonMode.Split||n==t.ButtonMode.Dropdown)&&n!=this.model.buttonMode&&(this._destroy(),this.model.buttonMode=n,this._init())},_setArrowPosition:function(n){(n==t.ArrowPosition.Right||n==t.ArrowPosition.Left||n==t.ArrowPosition.Bottom||n==t.ArrowPosition.Top)&&(this.model.buttonMode==t.ButtonMode.Dropdown&&n!=this.model.arrowPosition?(this.model.arrowPosition=n,this.element.empty(),this._setSize(this.model.size),this.element.removeClass("e-droparrowright e-droparrowleft e-droparrowbottom e-droparrowtop"),this._renderButtonContent()):this.model.buttonMode==t.ButtonMode.Split&&n!=this.model.arrowPosition&&(this.model.arrowPosition=n,this._setSize(this.model.size),this.innerWrap.removeClass("e-splitarrowright e-splitarrowleft e-splitarrowbottom e-splitarrowtop"),this._setRTL(this.model.enableRTL)))},_setRTL:function(n){if(this.model.buttonMode==t.ButtonMode.Split){this.dropdownimg.removeClass("e-arrow-sans-up").addClass("e-arrow-sans-down");switch(this.model.arrowPosition){case t.ArrowPosition.Right:this.innerWrap.addClass("e-splitarrowright");break;case t.ArrowPosition.Left:this.innerWrap.addClass("e-splitarrowleft");break;case t.ArrowPosition.Bottom:this.innerWrap.addClass("e-splitarrowbottom");break;case t.ArrowPosition.Top:this.innerWrap.addClass("e-splitarrowtop");this.dropdownimg.addClass("e-arrow-sans-up").removeClass("e-arrow-sans-down")}n==!0?this.splitwrap.addClass("e-rtl e-btnrtl"):this.splitwrap.removeClass("e-rtl e-btnrtl")}else n==!0?this.splitwrap.addClass("e-rtl"):this.splitwrap.removeClass("e-rtl");this.model.enableRTL=n;this._roundedCorner(this.model.showRoundedCorner)},_roundedCorner:function(t){t?(this.element.addClass("e-corner"),n(this.model.target).length>0&&n(this.model.target).addClass("e-corner")):(this.element.removeClass("e-corner"),n(this.model.target).length>0&&n(this.model.target).removeClass("e-corner"))},_controlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(i){this.element.removeClass(this.model.cssClass);this.model.buttonMode==t.ButtonMode.Split&&(this.dropbutton.removeClass(this.model.cssClass),this.dropbutton.addClass(i));this.element.addClass(i);n(this.model.target).ejMenu("option","cssClass",i)},_initialize:function(){this.element.is("button")?this._render():this.element.removeClass("e-splitbutton");this._timeout=null},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i._controlStatus(!1):i.wrapper.attr(t,n)})},_render:function(){this.element.addClass(this.model.cssClass+" e-btn e-select e-split-btn "+(t.isTouchDevice()?"":"e-ntouch")).attr("role","button");this.model.text==null||this.model.text==""?this.model.text=this.element.text():this.element.attr("aria-describedby",this.model.text);this.model.buttonMode!=t.ButtonMode.Split&&this.model.buttonMode!=t.ButtonMode.Dropdown&&(this.model.buttonMode=t.ButtonMode.Split);this.model.arrowPosition!=t.ArrowPosition.Right&&this.model.arrowPosition!=t.ArrowPosition.Left&&this.model.arrowPosition!=t.ArrowPosition.Bottom&&this.model.arrowPosition!=t.ArrowPosition.Top&&(this.model.arrowPosition=t.ArrowPosition.Right);this.element.empty();this.splitwrap=this.model.buttonMode==t.ButtonMode.Split?t.buildTag("span.e-split e-widget","",{},{"tab-index":0}):t.buildTag("span.e-split e-drop e-widget");this.splitwrap.insertBefore(this.element);this.innerWrap=t.buildTag("span.e-in-wrap e-box e-padding");this.splitwrap.append(this.innerWrap);this.wrapper=this.splitwrap;this.dropdownimg=t.buildTag("span.e-icon e-arrow-sans-down");this.btnimgwrap=t.buildTag("div.e-split-btn-div");this.btnimgwrap.append(this.dropdownimg);this.model.buttonMode==t.ButtonMode.Split&&(this.dropbutton=t.buildTag("button.e-split-btn e-btn e-select "+this.model.cssClass+" e-drp-btn"+(t.isTouchDevice()?"":" e-ntouch"),"",{},{type:"button","data-role":"none",id:this.element[0].id+"drpbtn"}),this.dropbutton.append(this.btnimgwrap),this.dropbutton.insertAfter(this.element),this.model.contentType==t.ContentType.TextOnly?this.dropbutton.addClass("e-btn-txt"):this.dropbutton.addClass("e-rht-btn"));this._setSize(this.model.size);this.element.addClass("e-left-btn");this._renderButtonContent();this.model.buttonMode==t.ButtonMode.Dropdown?this.innerWrap.append(this.element):this.innerWrap.append(this.element,this.dropbutton);this.model.target==null&&this.model.targetID!=null&&(this.model.target="#"+this.model.targetID);this._renderContxtMenu();this._roundedCorner(this.model.showRoundedCorner);this._setRTL(this.model.enableRTL);this._addAttr(this.model.htmlAttributes)},_renderButtonContent:function(){if(this.textspan=t.buildTag("span.e-btntxt",this.model.text),this.majorimgtag=t.buildTag("span").addClass(this.model.prefixIcon),this.minorimgtag=t.buildTag("span").addClass(this.model.suffixIcon),this.imgtxtwrap=t.buildTag("div"),this.model.contentType==t.ContentType.TextAndImage)switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.majorimgtag,this.textspan);break;case t.ImagePosition.ImageBottom:this.majorimgtag.css("display","inline-table");this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageTop:this.majorimgtag.css("display","inline-table");this.imgtxtwrap.append(this.majorimgtag,this.textspan)}else this.model.contentType==t.ContentType.ImageTextImage?this.imgtxtwrap.append(this.majorimgtag,this.textspan,this.minorimgtag):this.model.contentType==t.ContentType.ImageBoth?this.imgtxtwrap.append(this.majorimgtag,this.minorimgtag):this.model.contentType==t.ContentType.ImageOnly?this.imgtxtwrap.append(this.majorimgtag):(this.element.addClass("e-txt"),this.imgtxtwrap=this.model.text);this.model.buttonMode==t.ButtonMode.Dropdown?this._renderDropdownArrow():this.element.append(this.imgtxtwrap)},_renderDropdownArrow:function(){this.btnimgwrap.css("position","absolute");this.dropdownimg.removeClass("e-arrow-sans-up").addClass("e-arrow-sans-down");switch(this.model.arrowPosition){case t.ArrowPosition.Right:this.element.addClass("e-droparrowright");this.element.append(this.imgtxtwrap,this.btnimgwrap);break;case t.ArrowPosition.Left:this.element.addClass("e-droparrowleft");this.element.append(this.btnimgwrap,this.imgtxtwrap);break;case t.ArrowPosition.Bottom:this.element.addClass("e-droparrowbottom");this.element.append(this.imgtxtwrap,this.btnimgwrap);break;case t.ArrowPosition.Top:this.element.addClass("e-droparrowtop");this.dropdownimg.addClass("e-arrow-sans-up").removeClass("e-arrow-sans-down");this.element.append(this.btnimgwrap,this.imgtxtwrap)}},_setSize:function(n){this.wrapper.css({height:"",width:""});switch(n){case"mini":this._splitbtnSize(n);break;case"small":this._splitbtnSize(n);break;case"medium":this._splitbtnSize(n);break;case"large":this._splitbtnSize(n);break;default:this._splitbtnSize(n)}(this.model.arrowPosition==t.ArrowPosition.Bottom||this.model.arrowPosition==t.ArrowPosition.Top)&&this.model.height==""&&this.splitwrap.addClass("e-btn-arrowsplit-"+n);var i=this.model.height===""?this.wrapper.outerHeight()+"px":this.model.height;this._splitbtnHeight(i);this.model.size!=="normal"?(wd=this.model.width===""?this.wrapper.outerWidth()+"px":this.model.width,this._splitbtnWidth(wd)):this.model.width!==""&&(wd=this.model.width,this._splitbtnWidth(wd))},_splitbtnSize:function(n){this.splitwrap.removeClass("e-btn-mini e-btn-medium e-btn-small e-btn-large e-btn-normal e-btn-arrowsplit-large e-btn-arrowsplit-small e-btn-arrowsplit-mini e-btn-arrowsplit-medium e-btn-arrowsplit-normal");(this.model.arrowPosition==t.ArrowPosition.Left||this.model.arrowPosition==t.ArrowPosition.Right)&&this.splitwrap.addClass("e-btn-"+n)},_splitbtnHeight:function(n){(n==""||n==null)&&(n="30px");this.splitwrap.css("height",n)},_splitbtnWidth:function(n){this.splitwrap.css("width",n)},_renderContxtMenu:function(){this.model.target!=null&&n(this.model.target).attr("id")==null&&this.model.target.substring(0,1)=="."&&n(this.model.target).attr("id",this.element.attr("id")+"_"+this.model.target.replace(".",""));n(this.model.target).ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"",fields:this.model.fields,showArrow:!0,cssClass:"e-split "+this.model.cssClass,enableRTL:this.model.enableRTL}).on("ejMenuclose",n.proxy(this._onKeyDown,this))},_onKeyDown:function(n){n.keyCode==27&&this._hide()},_itemClick:function(t){t={status:this.model.enabled,ID:t.ID,text:t.text};this._trigger("itemSelected",t);n(t.element).hasClass("e-haschild")||this._hide()},_itemMouseOver:function(n){this._trigger("itemMouseOver",n)},_itemMouseOut:function(n){this._trigger("itemMouseOut",n)},_wireEvents:function(){this._on(this.element,"click",this._btnMouseClick);this._on(this.element,"mousedown",this._btnMouseDown);this.model.buttonMode==t.ButtonMode.Split&&this._on(this.dropbutton,"click",this._btnMouseClick);this._on(n(document),"mousedown",this._docrhtclk)},_btnMouseClick:function(i){var r;if(!this.model.enabled)return!1;if(!n(i.currentTarget).hasClass("e-disable"))if(i.currentTarget.id!=this.element[0].id+"drpbtn"&&this.model.buttonMode==t.ButtonMode.Split)r={status:this.model.enabled},this._trigger("click",r);else if(this.contstatus||this._trigger("beforeOpen"),this.wrapper.addClass("e-active"),this.contstatus)this._hidecontext(i);else{this._contextPosition(i);this._trigger("open");this._on(n(window),"resize",this._OnWindowResize);this.contstatus=!0;this.element.on("click",n.proxy(this._hidecontext,this));t.listenTouchEvent(n(document),t.startEvent(),this._documentClickHandler,!1,this);this._on(t.getScrollableParents(this.wrapper),"scroll",this._hidePopup)}},_OnWindowResize:function(n){this._contextPosition(n)},_contextPosition:function(i){var r=this._getXYpos(i),u,e,f;e=this.model.buttonMode==t.ButtonMode.Split?this.dropbutton:this.element;f=n(this.model.target).ejMenu("instance");u=r.x-(n(this.model.target).outerWidth()-(this.model.buttonMode==t.ButtonMode.Split?this.dropbutton.outerWidth():this.element.outerWidth()));r.x=this.model.enableRTL?u<\/span>');this.labelFinder.append(this.element);this.buttontag=t.buildTag("button.e-togglebutton e-btn e-tbtn "+this.model.cssClass+" e-select","",{},{role:"button",tabindex:0,type:this.model.type,"data-role":"none"});t.isTouchDevice()||this.buttontag.addClass("e-ntouch");n(this.labelFinder).wrap(this.wrapper);this.buttontag.insertAfter(this.labelFinder);t.util.isNullOrUndefined(this.model.activeText)&&(this.model.activeText=this.model.defaultText);t.util.isNullOrUndefined(this.model.activePrefixIcon)&&(this.model.activePrefixIcon=this.model.defaultPrefixIcon);t.util.isNullOrUndefined(this.model.activeSuffixIcon)&&(this.model.activeSuffixIcon=this.model.defaultSuffixIcon);this._setSize(this.model.size);this._setHeight(this.model.height);this._setWidth(this.model.width);this._setRTL(this.model.enableRTL);this._renderButtonContent();this.toggleState()||t.isNullOrUndefined(this.element.attr("checked"))||this.toggleState(!0);this._tglevaluestatus(this.toggleState());this._roundedCorner(this.model.showRoundedCorner);this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i.disable():t=="checked"&&n=="checked"?i._tglevaluestatus(this.toggleState()):i.wrapper.attr(t,n)})},_renderButtonContent:function(){if(this.imgtxtwrap=t.buildTag("div"),this.defaulttxtspan=t.buildTag("span.e-btntxt#"+this.element[0].id+"textstatic",this.toggleState()?this.model.activeText:this.model.defaultText),this.model.contentType.indexOf("image")>-1&&(this.defMainIcon=t.buildTag("span #"+this.element[0].id+"mainiconstatic"),this.defMiniIcon=t.buildTag("span #"+this.element[0].id+"miniconstatic"),this.toggleState()?this.defMainIcon.addClass(this.model.activePrefixIcon):this.defMainIcon.addClass(this.model.defaultPrefixIcon),this.toggleState()?this.defMiniIcon.addClass(this.model.activeSuffixIcon):this.defMiniIcon.addClass(this.model.defaultSuffixIcon)),this.model.contentType==t.ContentType.TextAndImage){switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.defaulttxtspan,this.defMainIcon);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.defMainIcon,this.defaulttxtspan);break;case t.ImagePosition.ImageBottom:this.defMainIcon.attr("style","display:inherit");this.imgtxtwrap.append(this.defaulttxtspan,this.defMainIcon);break;case t.ImagePosition.ImageTop:this.defMainIcon.attr("style","display:inherit");this.imgtxtwrap.append(this.defMainIcon,this.defaulttxtspan)}this.buttontag.append(this.imgtxtwrap)}else this.model.contentType==t.ContentType.ImageTextImage?(this.imgtxtwrap.append(this.defMainIcon,this.defaulttxtspan,this.defMiniIcon),this.buttontag.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageOnly?(this.imgtxtwrap.append(this.defMainIcon),this.buttontag.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageBoth?(this.imgtxtwrap.append(this.defMainIcon,this.defMiniIcon),this.buttontag.append(this.imgtxtwrap)):(this.buttontag.addClass("e-txt"),this.buttontag.text(this.model.defaultText))},_tglevaluestatus:function(n){n?(this._toggleButtonStatus(n),this.element.attr("checked","checked")):(this._toggleButtonStatus(n),this.element.prop("checked",!1))},_roundedCorner:function(n){n==!0?this.buttontag.addClass("e-corner"):this.buttontag.removeClass("e-corner")},_wireEvents:function(){this._on(this.buttontag,"click",this._tglebtnclicked);this._on(this.buttontag,"blur",this._tglebtnblur)},_tglebtnblur:function(){this.buttontag.removeClass("e-animate")},_tglebtnclicked:function(i){if(this.model.preventToggle&&!this.model.enabled)return!1;this.model.preventToggle||this.buttontag.hasClass("e-disable")||(this.toggleState(this.toggleState()?!1:!0),t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?this._tglevaluestatus(this.toggleState()):this._toggleButtonStatus(this.toggleState()),n(this.element).prop("checked",this.toggleState()),i.preventDefault(),this.buttontag.addClass("e-animate"),this._trigger("click",{isChecked:this.toggleState(),status:this.model.enabled}))},_toggleButtonStatus:function(n){n?(this.model.contentType==t.ContentType.TextOnly?this.buttontag.html(this.model.activeText):(this.defaulttxtspan.html(this.model.activeText),this.defMainIcon.removeClass(this.model.defaultPrefixIcon).addClass(this.model.activePrefixIcon),this.defMiniIcon.removeClass(this.model.defaultSuffixIcon).addClass(this.model.activeSuffixIcon)),this.buttontag.addClass("e-active").attr("aria-pressed",!0)):(this.model.contentType==t.ContentType.TextOnly?this.buttontag.html(this.model.defaultText):(this.defaulttxtspan.html(this.model.defaultText),this.defMainIcon.removeClass(this.model.activePrefixIcon).addClass(this.model.defaultPrefixIcon),this.defMiniIcon.removeClass(this.model.activeSuffixIcon).addClass(this.model.defaultSuffixIcon)),this.buttontag.removeClass("e-active").attr("aria-pressed",!1));this.toggleState(n);this.initialRender||this._trigger("change",{isChecked:this.toggleState()})}});t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"};t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.ButtonType={Button:"button",Reset:"reset",Submit:"submit"}}(jQuery,Syncfusion),function(n,t){t.widget("ejGroupButton","ej.GroupButton",{element:null,model:null,validTags:["div","span"],_addToPersist:["selectedItemIndex"],_setFirst:!1,_rootCSS:"e-groupbutton",defaults:{height:"",width:"",cssClass:"",enabled:!0,enableRTL:!1,showRoundedCorner:!1,size:"normal",groupButtonMode:"radiobutton",orientation:t.Orientation.Horizontal,selectedItemIndex:[],htmlAttributes:{},dataSource:null,query:null,fields:{text:"text",prefixIcon:"prefixIcon",suffixIcon:"suffixIcon",contentType:"contentType",imagePosition:"imagePosition",selected:"selected",url:"url",htmlAttribute:"htmlAttribute",linkAttribute:"linkAttribute"},create:null,beforeSelect:null,select:null,keyPress:null,destroy:null},dataTypes:{cssClass:"string",enabled:"boolean",dataSource:"data",query:"data",fields:"data",showRoundedCorner:"boolean",enableRTL:"boolean",size:"enum",groupButtonMode:"enum",orientation:"enum",selectedItemIndex:"array"},_setModel:function(t){var f,i,u,r,e;for(f in t){i=t[f];switch(f){case"size":this._setSize(i);break;case"height":this._setDimension("height",i);break;case"width":this._setDimension("width",i);break;case"enabled":this._setControlStatus(i);break;case"showRoundedCorner":this._setRoundedCorner(i);break;case"cssClass":this._setSkin(i);break;case"enableRTL":this._setRTL(i);break;case"htmlAttributes":this._setAttr(i);break;case"dataSource":this.element.html("");this.model.dataSource=i;this._initialize();break;case"groupButtonMode":this.model.groupButtonMode!=i&&this.itemsContainer.children(".e-grp-btn-item.e-active").removeClass("e-active").attr({"aria-selected":!1});break;case"orientation":this._setOrientation(i);this._setDimension("width",this.model.width);this._setDimension("height",this.model.height);break;case"selectedItemIndex":for(u=JSON.parse(JSON.stringify(this.model.selectedItemIndex)),r=0,e=u.length;r0&&i.select(u);this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query;return i},_createItems:function(n){this.list=n;var i;for(this.mapField=this._getMapper(),this.ultag=t.buildTag("ul"),this.element.append(this.ultag),i=0;i-1&&(i[r._prefixIcon]&&(f=t.buildTag("span"),f.addClass(i[r._prefixIcon])),i[r._suffixIcon]&&(s=t.buildTag("span"),s.addClass(i[r._suffixIcon])));switch(h){case t.ContentType.TextAndImage:switch(c){case t.ImagePosition.ImageRight:e.append(o,f);break;case t.ImagePosition.ImageLeft:e.append(f,o);break;case t.ImagePosition.ImageBottom:f.attr("style","display:inherit");e.append(o,f);break;case t.ImagePosition.ImageTop:f.attr("style","display:inherit");e.append(f,o)}break;case t.ContentType.ImageTextImage:e.append(f,o,s);break;case t.ContentType.ImageBoth:e.append(f,s);break;case t.ContentType.ImageOnly:e.append(f);break;case t.ContentType.TextOnly:e.append(o)}i[r._url]&&(aTag=t.buildTag("a.e-grp-btn-link").attr("href",i[r._url]),i[r._linkAttribute]&&this._setAttributes(i[r._linkAttribute],aTag),e.wrapInner(aTag));this.ultag.append(e);i[r._selected]&&n.inArray(u,this.model.selectedItemIndex)<=-1&&this.model.selectedItemIndex.push(u)},_setAttributes:function(n,t){for(var i in n)i=="class"?t.addClass(n[i]):t.attr(i,n[i])},_renderItems:function(){var r;this.itemsContainer=this.element.children("ol, ul, div").addClass("e-ul");this.itemsContainer.children("ol, ul").remove();this.items=this.itemsContainer.children("li, div").addClass("e-grp-btn-item").attr({"aria-selected":!1,"aria-disabled":!1});for(var u=0,t=[],e=this.items.length,i,f;u0?t.children("a").children():t.children(),r.appendTo(i)),r=t.children("a").length>0?t.children("a"):t,r.append(i);this.items.filter(":last").addClass("last")},_handleSeletedItem:function(){var i=this.model.selectedItemIndex,r,u;if(this.model.groupButtonMode==t.GroupButtonMode.RadioButton)this._setSeletedItem(n(this.items[i[i.length-1]]));else for(r=0,u=i.length;r0?n(r[r.index(e)+1]):r.first()):(u==37||u==40)&&this.model.orientation!=t.Orientation.Vertical||(u==37||u==38)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),f=n(r[r.index(e)-1]).length>0?n(r[r.index(e)-1]):r.last()):u==36?(i.preventDefault(),f=r.first()):u==35?(i.preventDefault(),f=r.last()):u==32&&i.preventDefault(),f){if(o=this._getDetails(f),o.element=f,o.event=i,this._triggerEvent("keyPress",o))return;f.addClass("e-hover").siblings(".e-hover").removeClass("e-hover")}}else switch(u){case 13:case 32:i.preventDefault();this._selectDeselect(e,i);break;case 27:i.preventDefault();this.element.blur()}},_onfocusIn:function(){this.element.addClass("e-focus");this._clicked||this._getVisibleItems().first().addClass("e-hover").siblings(".e-hover").removeClass("e-hover");this._on(this.element,"keyup keydown",this._onKeyPress)},_onfocusOut:function(){this.element.removeClass("e-focus").find(".e-grp-btn-item.e-hover").removeClass("e-hover");this._off(this.element,"keyup keydown",this._onKeyPress)},_onBtnHover:function(t){var i=n(t.currentTarget);i.hasClass("e-disable")||i.addClass("e-hover")},_onBtnLeave:function(t){var i=n(t.currentTarget);i.hasClass("e-disable")||i.removeClass("e-hover")},_onBtnClick:function(t){var i=n(t.currentTarget);i.hasClass("e-disable")||this._selectDeselect(i,t)},_onMouseDown:function(){this._clicked=!0},_triggerEvent:function(n,t){if(this._isRender)return this._trigger(n,t)},_wireUnwireEvents:function(n){this[n](this.element,"mousedown",this._onMouseDown)[n](this.element,"focus",this._onfocusIn)[n](this.element,"blur",this._onfocusOut);this[n](this.items,"click",this._onBtnClick);t.isTouchDevice()||(this[n](this.items,"mouseenter",this._onBtnHover),this[n](this.items,"mouseleave",this._onBtnLeave))},isSelected:function(n){return n=this._getNodeByID(n),n[0]!=null&&n.hasClass("e-grp-btn-item")?n.hasClass("e-active"):void 0},isDisabled:function(n){return n=this._getNodeByID(n),n[0]!=null&&n.hasClass("e-grp-btn-item")?n.attr("aria-disabled")=="true"?!0:!1:void 0},disable:function(){this.element.addClass("e-disable").attr("aria-disabled",!0);this.items.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1;this._wireUnwireEvents("_off")},enable:function(){this.element.removeClass("e-disable").attr("aria-disabled",!1);this.items.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0;this._wireUnwireEvents("_on")},show:function(){this.element.removeClass("e-hidden")},hide:function(){this.element.addClass("e-hidden")},getSelectedItem:function(){return this.element.find(".e-grp-btn-item.e-active")},getIndex:function(n){return n=this._getNodeByID(n),n[0]!=null&&n.hasClass("e-grp-btn-item")?this.items.index(n):void 0},enableItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&(n.removeClass("e-disable").attr("aria-disabled",!1),n.next(".e-grp-btn-item").removeClass("e-border-left e-border-bottom"))},disableItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&!n.hasClass("e-disable")&&(n.addClass("e-disable").attr("aria-disabled",!0),this.model.orientation==t.Orientation.Horizontal?(this._setDimension("width",this.model.width),n.next(".e-grp-btn-item").addClass("e-border-left")):(n.next(".e-grp-btn-item").addClass("e-border-bottom"),this._setDimension("height",this.model.height)))},selectItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&this._setSeletedItem(n)},deselectItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&this._removeSelection(n)},showItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&(n.removeClass("e-hidden"),this._updateCss())},hideItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&(n.addClass("e-hidden"),this._updateCss())}});t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.GroupButtonMode={CheckBox:"checkbox",RadioButton:"radiobutton"};t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"}}(jQuery,Syncfusion),function(n,t){t.widget("ejToolbar","ej.Toolbar",{element:null,model:null,validTags:["div","span"],_setFirst:!1,_rootCSS:"e-toolbar",angular:{terminal:!1},defaults:{height:"",width:"",enabled:!0,hide:!1,disabledItemIndices:[],enabledItemIndices:[],enableSeparator:!1,orientation:"horizontal",enableRTL:!1,isResponsive:!1,showRoundedCorner:!1,htmlAttributes:{},dataSource:null,Items:{id:"id",tooltipText:"tooltipText",imageUrl:"imageUrl",text:"text",imageAttributes:"imageAttributes",spriteCssClass:"spriteCssClass",htmlAttributes:"htmlAttributes",group:"group",template:"template"},query:null,responsiveType:"popup",fields:{id:"id",tooltipText:"tooltipText",imageUrl:"imageUrl",text:"text",imageAttributes:"imageAttributes",spriteCssClass:"spriteCssClass",htmlAttributes:"htmlAttributes",group:"group",template:"template"},tooltipSettings:{associate:"mouseenter",showShadow:!0,position:{stem:{horizontal:"left",vertical:"top"}},tip:{size:{width:5,height:5},adjust:{xValue:17,yValue:17}},isBalloon:!1},cssClass:"",targetID:null,create:null,click:null,itemHover:null,itemLeave:null,overflowOpen:null,overflowClose:null,destroy:null},dataTypes:{enabled:"boolean",hide:"boolean",enableSeparator:"boolean",disabledItemIndices:"data",enabledItemIndices:"data",orientation:"enum",enableRTL:"boolean",showRoundedCorner:"boolean",isResponsive:"boolean",dataSource:"data",query:"data",fields:"data",cssClass:"string",htmlAttributes:"data",targetID:"string",responsiveType:"enum"},hide:function(){if(!this.model.enabled&&this.element.css("display")=="none")return!1;this.element.css("display","none");this.model.hide=!0},show:function(){if(!this.model.enabled&&this.element.css("display")!="none")return!1;this.element.css("display","block");this.model.hide=!1},_init:function(){this.model.targetID!=null&&this.element.html(n("#"+this.model.targetID).find("ul,ol"));this._cloneElement=n(this.element).clone();this._localDataSource=null;this.model.dataSource!=null?this._generateTemplate():this.model.Items!=null&&this._generateTemplate();this.model.dataSource instanceof t.DataManager||this._initialize();this._renderTooltip(this.model.tooltipSettings)},_setModel:function(t){for(var i in t)switch(i){case"height":this._setHeight(t[i]);break;case"width":this.model.width=t[i];this._setWidth();this._bindUnbindWidth();break;case"enabled":this._controlStatus(t[i]);break;case"disabledItemIndices":this._disableItemByIndex(t[i]);t[i]=this.model.disabledItemIndices;break;case"enabledItemIndices":this._enableItemByIndex(t[i]);break;case"isResponsive":this.model.isResponsive=t[i];this.model.isResponsive?(this._responsiveLayout(),this._renderTooltip(this.model.tooltipSettings)):this._removeResponsive();break;case"hide":this._controlVisibleOptions(t[i]);break;case"orientation":this._setOrientation(t[i]);this.model.orientation=t[i];this._wireResizing();break;case"tooltipSettings":this.model.tooltipSettings=n.extend(!0,this.model.tooltipSettings,t[i]);this._renderTooltip(this.model.tooltipSettings);break;case"enableRTL":this._enableRTL(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"cssClass":this._setSkin(t[i]);break;case"htmlAttributes":this._addAttr(t[i]);break;case"enableSeparator":this.model.enableSeparator=t[i];this._renderToolbarSeparator();break;case"fields":n.extend(this.model.fields,t[i]);break;case"query":this.model.query=t[i];break;case"dataSource":for(optio in t)optio=="fields"&&n.extend(this.model.fields,t[optio]),optio=="query"&&(this.model.query=t[optio]);this._refreshTagItems(i,t[i]);break;case"Items":n.extend(this.model.Items,t[i]);this._refreshTagItems(i,t[i]);break;case"targetID":this.model.targetID=t[i];this._setTargetID()}},_setTargetID:function(){this.element.removeAttr("role tabindex aria-disabled style");n(this._spantag).remove();n(this._liTemplte).remove();this._liTemplte=this._tipRes=null;this.element.removeClass("e-widget e-box e-toolbarspan e-rtl");this.element.find("ul,ol").removeClass("e-ul e-horizontal e-vertical e-separator e-comnrtl");this.element.find("li").removeClass("e-tooltxt e-comnrtl");this.element.find("li").removeAttr("aria-label");this._init()},_refreshTagItems:function(n,t){this.model[n]=t;this.element.empty();this._generateTemplate();this._initialize()},_setHeight:function(n){this.element.css("height",n)},_setWidth:function(){var t,u;if(this.model.width=="auto"){var r=parseFloat(this.element.css("border-left-width"))+parseFloat(this.element.css("border-right-width")),f=this.element.find("ul").children("li"),i=this.element.find("ul"),e;for(e=this.model.responsiveType=="inline"?this.element.find(".e-arrow-sans-down"):this.element.find(".e-toolbar-res-arrow"),t=0,u=i.length;t0&&(n(this._liTemplte.children()).insertBefore(n(this.element).find("span.e-res-pos")),this._renderToolbarSeparator(),this.model.responsiveType!="inline"&&this._liTemplte.addClass("e-display-none"),this._contstatus=!1);this._elementWidth=typeof getComputedStyle=="function"?parseFloat(window.getComputedStyle(this.element[0]).width):this.element.width()-1;this._liWidth=this._spanWidth;this._spantag.removeClass("e-display-block").addClass("e-display-none");for(var t=0;tthis._elementWidth&&(this._spantag.hasClass("e-display-block")||this._spantag.removeClass("e-display-none").addClass("e-display-block"),this._spantag.addClass("e-res-pos"),this._liTemplte.addClass("e-normal"),this._liTemplte.append(this.itemsContainer[t]));this.model.responsiveType=="inline"&&(this._liTemplte.removeClass("e-normal"),this._liTemplte.css("width",this.element.width()));this._isResized=!0},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popup)},_getOffset:function(n){return t.util.getOffset(n)},_btnMouseClick:function(i){var u,f,r,h,o=1,l=this.element.outerWidth(),a=this.element.outerHeight(),s=n(this._liTemplte).outerWidth(),c=n(window).width(),e=n(window).scrollLeft();n(i.currentTarget).hasClass("e-disable")||(maxZ=this._getZindexPartial(),f=this._getOffset(this.element),r=this.model.enableRTL?f.left:f.left+l-s,h=f.top+a-o+2,r=rc+e?c-s+e-o:r,this._contstatus?(this._liTemplte.addClass("e-display-none"),this.model.responsiveType=="inline"&&this._spantag.removeClass("e-active"),this._contstatus=!1,u={currentTarget:i.currentTarget,clientX:i.clientX,clientY:i.clientY,cancel:i.cancellable},this._trigger("overflowClose",u)):(this._liTemplte.removeClass("e-display-none"),this.model.responsiveType!="inline"&&this._liTemplte.css({top:h+"px",left:r+"px","z-index":maxZ}),this.model.responsiveType=="inline"&&this._spantag.addClass("e-active"),this._contstatus=!0,u={currentTarget:i.currentTarget,clientX:i.clientX,clientY:i.clientY,cancel:i.cancellable},this._trigger("overflowOpen",u),this.model.responsiveType!="inline"&&this._on(t.getScrollableParents(this.element),"scroll",this._hidecontext),this.element.bind("click",n.proxy(this._hidecontext,this))),this._contstatus&&this.model.responsiveType!="inline"&&this._on(n(document),"mouseup",this._documentClick),this._contstatus||this._off(n(document),"mouseup",this._documentClick),this._removeListHover())},_hidecontext:function(i){n(i.target).is(n("#"+this.element[0].id+"_target"))||this.model.responsiveType=="inline"||(this._liTemplte.addClass("e-display-none"),this._contstatus=!1,this.element.unbind("click",n.proxy(this._hidecontext,this)),this._off(t.getScrollableParents(this.element),"scroll",this._hidecontext),this._off(n(document),"mouseup",this._documentClick))},_documentClick:function(t){if(!n(t.target).is(n("#"+this.element[0].id+"_target"))&&!(n(t.target).closest("div#"+this.element[0].id+"_hiddenlist").length!=0||n(t.target).parents().hasClass("e-ddl-popup"))){this._liTemplte.addClass("e-display-none");this._contstatus=!1;var i={currentTarget:t.currentTarget,clientX:t.clientX,clientY:t.clientY,cancel:t.cancellable};this._trigger("overflowClose",i);this._off(n(document),"mouseup",this._documentClick)}},_setSkin:function(n){this.element.removeClass(this.model.cssClass).addClass(n);var t="e-toolbarTooltip "+n;this._subControlsSetModel("cssClass",t)},_subControlsSetModel:function(i,r){t.isNullOrUndefined(this._tipToolbar)||n(this.target).ejTooltip("option",i,r);t.isNullOrUndefined(this._tipRes)||n(this._liTemplte).ejTooltip("option",i,r)},_destroy:function(){this.element.html("");t.isNullOrUndefined(this._tipToolbar)||n(this.target).ejTooltip("destroy");t.isNullOrUndefined(this._tipRes)||n(this._liTemplte).ejTooltip("destroy");this._cloneElement.removeClass("e-toolbar e-js");this.element.replaceWith(this._cloneElement);this._liTemplte&&this._liTemplte.remove();this._unWireResizing()},_initialize:function(){this.element.attr({role:"toolbar",tabindex:"0"});var n=this.element.children().find("li");this._focusEnable=!0;this._renderControl();this._responsiveLayout();this._wireEvents()},_responsiveLayout:function(){if(this._roundedCorner(this.model.showRoundedCorner),this.model.isResponsive&&this.model.orientation=="horizontal"){t.isNullOrUndefined(this._liTemplte)||(t.isNullOrUndefined(this._tipRes)||this._tipRes.destroy(),n(this._liTemplte).remove());this._spantag=n("<\/span>");this.model.responsiveType=="inline"&&this._spantag.removeClass("e-toolbar-res-arrow").addClass("e-inlinearrow e-arrow-sans-down");this._spantag.appendTo(this.element);this._liTemplte=n("
      <\/div>");this.model.responsiveType=="inline"&&this._liTemplte.removeClass("e-abs-position").addClass("e-inline");this._spantag.appendTo(this.element);this._spanWidth=this._spantag.outerWidth(!0)+8;this.model.enableRTL&&this._liTemplte.addClass("e-rtl");this._isResized=!1;this._elementWidth=typeof getComputedStyle=="function"?parseFloat(window.getComputedStyle(this.element[0]).width):this.element.width()-1;this._liWidth=this._spanWidth;for(var i=0;ithis._elementWidth?this._reSizeHandler():this._spantag.removeClass("e-display-block").addClass("e-display-none");this.model.responsiveType=="inline"?n(this.element[0]).append(this._liTemplte):n("body").append(this._liTemplte);this._renderTooltip(this.model.tooltipSettings)}this._on(n("#"+this.element[0].id+"_target"),"mousedown",this._btnMouseClick);this._wireResizing();this._controlVisibleOptions(this.model.hide);this._enableRTL(this.model.enableRTL);this._disabledItems=this.model.disabledItemIndices;this._controlStatus(this.model.enabled);this.model.disabledItemIndices=this._disabledItems;this.model.disabledItemIndices.length!=0&&this._disableItemByIndex(this.model.disabledItemIndices);this.model.enabledItemIndices.length!=0&&this._enableItemByIndex(this.model.enabledItemIndices);this._setWidth()},_removeResponsive:function(){n(this._spantag).remove();t.isNullOrUndefined(this._tipRes)||n(this._liTemplte).ejTooltip("destroy");var i=n(this._liTemplte).children("ul");n(this._liTemplte).detach();n(this.element).append(i);this.itemsContainer=this.element.children("ol,ul");this.items=this.itemsContainer.children("li");this._off(this.items,"mouseup");this._off(this.items,"mousedown");this._off(this.element,"mousedown");this._wireEvents();this._wireResizing();this._setWidth()},_controlVisibleOptions:function(n){n!=!1?this.hide():this.show()},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_roundedCorner:function(n){n?(this.element.addClass("e-corner"),this._liTemplte&&this._liTemplte.addClass("e-corner")):(this.element.removeClass("e-corner"),this._liTemplte&&this._liTemplte.removeClass("e-corner"));this._subControlsSetModel("showRoundedCorner",n)},_generateTemplate:function(){var n=this,i;this.element.css("visibility","hidden");this.model.dataSource instanceof t.DataManager?(i=this.model.dataSource.executeQuery(this.model.query),i.done(function(t){n._generateGroup(t.result);n._initialize();n.element.css("visibility","")})):this.model.dataSource!=null?(n._generateGroup(n.model.dataSource),n.element.css("visibility","")):(n._generateGroup(n.model.Items),n.element.css("visibility",""))},_generateGroup:function(n){var r=this,f,u,t,e,i;for(this._localDataSource=n,f=-1,u=[],t=0;t-1&&(r=n.inArray(t[i],this.model.disabledItemIndices),this.enableItem(this.items[this.model.disabledItemIndices[r]]),this.model.disabledItemIndices.splice(r,1))},_disableItemByIndex:function(t){var i;if(!this.model.enabled)return!1;for(this._disabledItems=this.model.disabledItemIndices,i=0;i-1&&this.disableItem(this.items[i]);this.model.disabledItemIndices=this._disabledItems},disable:function(){if(this.element.attr("aria-disabled")=="true")return!1;this.element.attr("aria-disabled",!0).removeAttr("aria-label");this._addOverlay(this.items);this.model.isResponsive&&this.model.orientation=="horizontal"&&this._spantag.addClass("e-disable");this.model.enabled=!1;this._subControlsSetModel("enabled",!1)},enable:function(){if(this.model.disabledItemIndices=[],this.element.attr("aria-disabled")=="false")return!1;this.items.removeClass("e-disable");this._removeOverlay(this.items);this.element.attr("aria-disabled",!1);this.model.isResponsive&&this.model.orientation=="horizontal"&&this._spantag.removeClass("e-disable");this.model.enabled=!0;this._subControlsSetModel("enabled",!0)},selectItem:function(t){var i=n(t);i==null||i.length<=0||(i.addClass("e-active").attr("aria-selected",!0),this._activeItem=n(this.items).index(i))},deselectItem:function(t){var i=n(t);i==null||i.length<=0||i.removeClass("e-active").attr("aria-selected",!1)},selectItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.selectItem(t)},deselectItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.deselectItem(t)},removeItem:function(t){var r,u,i;if(this.model.disabledItemIndices=[],r=n(t),u=0,r!=null&&!(r.length<=0))for(r.remove(),this.items=this.itemsContainer.children("li"),i=0;i0?this._liTemplte.find(".e-tooltxt").index(i):n(this.items).index(i),this._trigger("click",args)))},_onItemLeave:function(t){var i=n(t.currentTarget),r=t.target;i.hasClass("e-disable")||(this._removeSelection(),i.removeClass("e-hover"),args={currentTarget:i,target:r,status:this.model.enabled},this._trigger("itemLeave",args))},_onKeyPress:function(i){var u,r,f,e;if(u=i.keyCode?i.keyCode:i.which?i.which:i.charCode,this.model.isResponsive&&this._liTemplte.find(".e-tooltxt").length>0?(this._keyPressed=!0,this._items=this._contstatus?this._liTemplte.find(".e-tooltxt"):this.element.find(".e-tooltxt"),r=this._items.filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)")):(this._keyPressed=!1,r=this.items.filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)")),this._focusedItem?(f=this._focusedItem,this._focusedItem=null):f=r.filter(".e-hover"),i.type=="keydown")(u==38||u==39)&&this.model.orientation!=t.Orientation.Vertical||(u==39||u==40)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),e=n(r[r.index(f)+1]).length>0?n(r[r.index(f)+1]):r.first()):(u==37||u==40)&&this.model.orientation!=t.Orientation.Vertical||(u==37||u==38)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),e=n(r[r.index(f)-1]).length>0?n(r[r.index(f)-1]):r.last()):u==33||u==36?(i.preventDefault(),e=r.first()):(u==34||u==35)&&(i.preventDefault(),e=r.last()),e&&(this._removeListHover(),e.addClass("e-hover"));else switch(u){case 13:case 32:if(i.preventDefault(),!f[0])break;args={currentTarget:f[0],target:n(f)[0],status:this.model.enabled,event:i};this._trigger("click",args);this._removeListHover();break;case 27:i.preventDefault();this.element.blur();break;case 9:i.preventDefault();this._activeItem=n(this.items).filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)").first().index();this._addListHover()}},_removeListHover:function(){n(this.items).removeClass("e-hover")},_addListHover:function(){var n=this._getActiveItem();n.hasClass("e-disable")||n.addClass("e-hover").focus()},_getActiveItem:function(){return this.model.isResponsive&&this._keyPressed?n(this._items[this._activeItem]):n(this.items[this._activeItem])},_targetBlur:function(n){n.preventDefault();this.element.focusout().removeClass("e-focus");this._removeListHover();this._off(this.element,"keyup",this._onKeyPress)._off(this.element,"keydown",this._onKeyPress);this._trigger("focusOut")},_clickEventHandler:function(){this._clicked=!0},_removeSelection:function(){this._currentItem&&this._currentItem.attr("aria-selected")!="true"&&this._currentItem.removeClass("e-active")},_focusElement:function(){if(!this.element.hasClass("e-focus")&&(this.element.addClass("e-focus"),this._on(this.element,"keyup",this._onKeyPress)._on(this.element,"keydown",this._onKeyPress),!this._focusEnable)){this._focusEnable=!0;return}this._removeListHover();this._activeItem=this._clicked?-1:0;(this._getActiveItem().hasClass("e-disable")||this._getActiveItem().is(":hidden"))&&(this._activeItem=n(this.items).filter('li:not([class*="e-disable"])').first().index());this._addListHover()}});t.Toolbar.ResponsiveType={Popup:"popup",Inline:"inline"}}(jQuery,Syncfusion),function(n,t){t.widget("ejAccordion","ej.Accordion",{_rootCSS:"e-acrdn",element:null,model:null,validTags:["div","span"],_addToPersist:["selectedItemIndex","selectedItems"],_setFirst:!1,angular:{terminal:!1},defaults:{collapsible:!1,ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},events:"click",customIcon:{header:"e-plus",selectedHeader:"e-minus"},heightAdjustMode:"content",height:null,width:null,headerSize:null,enableAnimation:!0,selectedItemIndex:0,cssClass:"",enableRTL:!1,showCloseButton:!1,showRoundedCorner:!1,allowKeyboardNavigation:!0,enableMultipleOpen:!1,expandSpeed:"300",collapseSpeed:"300",selectedItems:[],disabledItems:[],enabledItems:[],enablePersistence:!1,enabled:!0,htmlAttributes:{},ajaxLoad:null,ajaxBeforeLoad:null,activate:null,beforeActivate:null,inActivate:null,beforeInactivate:null,ajaxSuccess:null,ajaxError:null,create:null,destroy:null},dataTypes:{cssClass:"string",collapsible:"boolean",enabled:"boolean",events:"string",heightAdjustMode:"enum",ajaxSettings:"data",customIcon:"data",selectedItems:"array",disabledItems:"array",enabledItems:"array",enableAnimation:"boolean",htmlAttributes:"data"},_setModel:function(t){var i,r,e,s,u,o,f;for(i in t)switch(i){case"events":this._off(this._headers,this.model.events);this._on(this._headers,t[i],this._headerEventHandler);break;case"disabledItems":this.disableItems(t[i]);break;case"enabledItems":this.enableItems(t[i]);break;case"enabled":this._enabledAction(t[i]);break;case"selectedItemIndex":n(this._contentPanels[t[i]]).hasClass("e-disable")||t[i]>this._headers.length||this.model.enableMultipleOpen?t[i]=this.model.selectedItemIndex:(this._isInteraction=!0,this.model.enableMultipleOpen||this._activeTab(t[i],!1,!0),this._isInteraction=!1);break;case"heightAdjustMode":this._setHeightStyle(t[i]);break;case"cssClass":this._changeSkin(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"customIcon":r=this.model.customIcon;e=t[i];this._headers.find("span."+r.header).removeClass(r.header).addClass(e.header);this._headers.find("span."+r.selectedHeader).removeClass(r.selectedHeader).addClass(e.selectedHeader);break;case"height":this.element.height(t[i]);this.model.height=t[i];this.model.heightAdjustMode!="fill"?this._getHeight()>this.element.height()&&(this._scrollerObj?this._scrollerObj.option({height:this.element.height()}):this._setScoller()):this._setHeight();break;case"width":if(this.element.width(t[i]),this._scrollerObj&&this._scrollerObj.option("width",t[i]),t[i].toString().indexOf("%"))n(window).on("resize",n.proxy(this._scrollerRefresh,this));else n(window).off("resize",n.proxy(this._scrollerRefresh,this));this._scrollerObj&&this._scrollerObj.refresh();break;case"headerSize":this.model.headerSize=t[i];this._setHeaderSize();break;case"showCloseButton":this.model.showCloseButton=t[i];this._addDeleteIcon();break;case"allowKeyboardNavigation":t[i]?(this._off(this.element,"keydown"),this._on(this.element,"keydown",this._keyPress)):this._off(this.element,"keydown");break;case"enableRTL":t[i]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this._scrollerObj&&this._scrollerObj.option("enableRTL",t[i]);break;case"selectedItems":this._showHideSelectedItems(t[i]);t[i]=this.model.selectedItems;break;case"expandSpeed":this.model.expandSpeed=t[i];break;case"collapseSpeed":this.model.collapseSpeed=t[i];break;case"htmlAttributes":this._addAttr(t[i]);break;case"enableMultipleOpen":if(this.model.enableMultipleOpen=t[i],this.model.selectedItems.length<=0)s=n.extend(!0,[],this.model.enabledItems),this._activeTab(this.model.enabledItems[0]);else if(this.model.selectedItemIndex>0&&this.model.selectedItemIndex<=this._headers.length)for(u=n.extend(!0,[],this.model.selectedItems),u.sort(function(n,t){return n-t}),this.model.selectedItemIndex=u[0],o=u,f=1;f :even");this.element.attr("tabindex",0).attr("role","tablist");this._contentPanels=this._headers.next();this._nagativeIndexCheck(this.model.selectedItemIndex);this._addBaseClass();this._addAttr(this.model.htmlAttributes);t.buildTag("span.e-icon "+this.model.customIcon.header).prependTo(this._headers);this.model.showCloseButton&&this._addDeleteIcon();this._setHeightStyle(this.model.heightAdjustMode);this.model.height&&this.element.css("height",this.model.height);this.model.width&&this.element.css("width",this.model.width);this.model.enableMultipleOpen||this._renderHeaderIcon();t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize();this._wireEvents();this._roundedCorner(this.model.showRoundedCorner);this.model.enabled||this._enabledAction(this.model.enabled);this._selectedItemsAction(this.model.enableMultipleOpen?this.model.selectedItems:this.model.selectedItemIndex);this._disableItems(this.model.disabledItems);this._setEnabledItems()},_setHeight:function(){var t=this,r=0,u=0,i;this.element.css("height",this.model.height);maxHeight=this.element.height();this._contentPanels.css("height","auto");this._scrollerObj&&this._scrollerObj.option("height",this.element.height());this._headers.each(function(i){maxHeight-=n(this).outerHeight();r+=n(this).outerHeight();n(t._contentPanels[i]).hasClass("e-acrdn-content-active")&&(u+=n(t._contentPanels[i]).outerHeight())});maxPadding=0;i=this.element.height()-(u+r);i>0?this._contentPanels.each(function(){n(this).height(n(this).height()+i/t.element.find(".e-select.e-active").length)}):this._setScoller();this._scrollerObj&&this._scrollerObj.refresh()},_setScoller:function(){if(this.element.parent(".e-acrdn-scroller.e-scroller").length<1){this.scroller=t.buildTag("div.e-acrdn-scroller");this.element.wrap(this.scroller);var n=this.element.css("width");this.element.parent(".e-acrdn-scroller").ejScroller({height:this.element.height(),width:this.model.width});this.element.css("width",n);this._scrollerObj=this.element.parent(".e-js").data("ejScroller");this.model.showRoundedCorner&&this.element.parent(".e-acrdn-scroller").addClass("e-corner");this.model.enableRTL&&this._scrollerObj.option("enableRTL",!0)}},_setHeaderSize:function(){var t=this;this._headers.each(function(){n(this).css({"padding-top":0,"padding-bottom":0});n(this).css("height",t.model.headerSize);var i=typeof t.model.headerSize=="string"&&t.model.headerSize.indexOf("px")!=-1?t.model.headerSize:t.model.headerSize+"px";n(n(this).find("a[href]")).css("line-height",i);n(this).find(".e-icon").length>0&&n(this).find(".e-icon").css("margin-top",n(this).height()/2-5)});this.model.height&&(this.model.heightAdjustMode!="fill"?this._getHeight()>this.element.height()&&(this._scrollerObj?this._scrollerObj.refresh():this._setScoller()):this._setHeight(),this._scrollerObj&&this._scrollerObj.refresh())},_addDeleteIcon:function(){this.model.showCloseButton?(this.getItemsCount()>0&&this._headers.append(this._createDeleteIcon()),this._on(this._headers.children("div.e-close"),"click",this._panelDeleteClick)):(this._headers.children("div.e-close").remove(),this._off(this._headers.children("div.e-close"),"click",this._panelDeleteClick))},_createDeleteIcon:function(){return t.buildTag("div.e-icon e-close")},_getHeight:function(){var t=0,i=0,r=this;return this._headers.each(function(u){t+=n(this).outerHeight();n(r._contentPanels[u]).hasClass("e-acrdn-content-active")&&(i+=n(r._contentPanels[u]).outerHeight())}),t+i},_setEnabledItems:function(){for(var t=0;t=0&&n[t]0)for(var t=0;t=0&&this._activeTab(n[t],!0);else!(this.collapseALL&&this.model.collapsible)&&this.model.selectedItemIndex>=0&&this._activeTab(this.model.selectedItemIndex,!0)},_enabledAction:function(n){n?this.enable():this.disable()},_addBaseClass:function(){this.element.addClass(this.model.cssClass+" e-widget");this.model.enableRTL&&this.element.addClass("e-rtl");this._headers.addClass(" e-select").attr("role","tab").attr("tabindex",0);this._contentPanels.addClass("e-content").attr("role","tabpanel").attr("aria-hidden",!0).hide();this.model.enableMultipleOpen||n(this._contentPanels[this.model.selectedItemIndex]).show()},_removeBaseClass:function(){this._headers.removeClass(" e-select");this._contentPanels.removeClass("e-content").show()},_roundedCorner:function(n){n?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_nagativeIndexCheck:function(n){var i,t;if(n<0&&this.model.collapsible)for(this.collapseALL=!0,i=this.getItemsCount(),t=0;t=this._headers.length)&&(this.model.selectedItemIndex=0)},collapsePanel:function(n){this._expandcollapsepanel(!1,n)},expandPanel:function(n){this._expandcollapsepanel(!0,n)},_expandcollapsepanel:function(t,i){proxy=this;i instanceof Array?n.each(i,function(n,i){proxy._activehideIndex(t,i)}):typeof i=="number"&&proxy._activehideIndex(t,i)},_activehideIndex:function(n,t){t>=0&&t<=proxy._headers.length&&(n?this._activeTab(t,!1,!0):(this._hideTab(t,!1,!0),this._deleteSelectedItems(t),this.model.selectedItemIndex==t&&(this.model.selectedItemIndex=null)))},_activeTab:function(i,r,u){var e,o,f;if(n.inArray(i,this.model.disabledItems)<0){if(e={activeIndex:i,isInteraction:!u},!0===(!r&&this._trigger("beforeActivate",e)))return!1;this.model.enableMultipleOpen||this._hideTab(this.model.selectedItemIndex,r,u);this.model.selectedItemIndex=i;t.isNullOrUndefined(this.model.selectedItemIndex)||(o=this.model.customIcon,this._headers.attr("tabindex",0).removeAttr("aria-expanded"),this._activeHeader=this._headers.eq(i).addClass("e-active ").attr("aria-selected",!0).attr("tabindex",0).attr("aria-expanded",!0),this._activeHeader.find("span.e-icon").removeClass(o.header).addClass(o.selectedHeader),this._addSelectedItems(i),this._ajaxLoad(),this._roundedCorner(this.model.showRoundedCorner),e={activeHeader:this._activeHeader,activeIndex:this.model.selectedItemIndex,isInteraction:!u},f=this,this._activeHeader.next().addClass("e-acrdn-content-active").removeAttr("aria-hidden",!1),this._paneAdjustSize(),this._activeContent=this._activeHeader.next().slideDown(this.model.enableAnimation?this._validateSpeed(this.model.expandSpeed):0,function(){r||f._trigger("activate",e);f.model.height&&(f.model.heightAdjustMode!="fill"?f._getHeight()>f.element.height()&&(f._scrollerObj?f._scrollerObj.refresh():f._setScoller()):f._setHeight(),f._scrollerObj&&f._scrollerObj.refresh())}))}},_paneAdjustSize:function(){var i=this,t;this.model.heightAdjustMode==="fill"&&this.model.enableMultipleOpen&&(maxHeight=this._getDimension(n(this.element).parent(),"height"),n(this.element).parent().css({overflow:"auto"}),this._headers.each(function(){maxHeight-=i._getDimension(n(this),"outerHeight")}),t=0,t=Math.max(t,i._getDimension(n(this._activeHeader.next()),"outerHeight")-i._getDimension(n(this._activeHeader.next()),"height")),maxHeight=maxHeight/this.model.selectedItems.length-t,this._headers.next().animate({height:maxHeight},300))},_validateSpeed:function(t){return t&&(t=n.trim(t.toString().toLowerCase()))&&(t=="fast"||t=="slow")?t:Number(t)},_hideTab:function(n,t,i){var f=this.model.customIcon,u,r;if(n>=0){if(u={inActiveIndex:n,isInteraction:!i},!0===(!t&&this._trigger("beforeInactivate",u)))return!1;this._activeHeader=this._headers.eq(n).removeClass("e-active ").removeAttr("aria-selected").attr("tabindex",0).attr("aria-expanded",!1);this._activeHeader.find("span.e-icon").removeClass(f.selectedHeader).addClass(f.header);u={inActiveHeader:this._activeHeader,inActiveIndex:n,isInteraction:!i};r=this;r.raiseEvent=t;this._activeHeader.next().removeClass("e-acrdn-content-active").attr("aria-hidden",!0).slideUp(this.model.enableAnimation?this._validateSpeed(this.model.collapseSpeed):0,function(){r.raiseEvent||r._trigger("inActivate",u);r.model.height&&(r.model.heightAdjustMode!="fill"?r._getHeight()>r.element.height()&&(r._scrollerObj?r._scrollerObj.refresh():r._setScoller()):r._setHeight());r._scrollerObj&&r._scrollerObj.refresh();r._paneAdjustSize()});this._deleteSelectedItems(n)}},_renderHeaderIcon:function(){if(this._headers.find(".e-icon").length<=0){var n=this.model.customIcon;n&&(this.collapseALL&&this.model.collapsible||this._headers.eq(this.model.selectedItemIndex).find("span.e-icon").removeClass(n.header).addClass(n.selectedHeader))}},_ajaxLoad:function(){var t=this._activeHeader.find("a[href]"),r,i;t.length>0&&(r=n(this._contentPanels[this.model.selectedItemIndex]),i=n(t).attr("href"),i&&i!=="#"&&this._sendAjaxOptions(r,t[0]))},_sendAjaxOptions:function(t,i){if(!0===this._trigger("ajaxBeforeLoad",{url:i}))return!1;t.addClass("e-load");var r=this,u=n(i).html(),f=i.href.replace("#",""),e={type:this.model.ajaxSettings.type,cache:this.model.ajaxSettings.cache,url:f,data:this.model.ajaxSettings.data,dataType:this.model.ajaxSettings.dataType,contentType:this.model.ajaxSettings.contentType,async:this.model.ajaxSettings.async,success:function(n){try{r._ajaxSuccessHandler(n,t,i,u)}catch(f){}},error:function(){try{r._ajaxErrorHandler(data,i,r.model.selectedItemIndex,u)}catch(n){}}};this._sendAjaxRequest(e)},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_ajaxSuccessHandler:function(t,i,r,u){u!=null&&n(r).html(u);i.removeClass("e-load");i.html(t).addClass("e-acrdn-loaded");var f={data:t,url:r,content:i};this._trigger("ajaxSuccess",f);this._trigger("ajaxLoad",{url:r})},_ajaxErrorHandler:function(n,t){this._trigger("ajaxError",{data:n,url:t});this._trigger("ajaxLoad",{url:t})},_setHeightStyle:function(i){var u=this,r,f;t.Accordion.HeightAdjustMode.Fill==i?this.model.height!=null?this._setHeight():(r=this._getDimension(n(this.element).parent(),"height"),n(this.element).parent().css({overflow:"auto"}),u._headers.each(function(){r-=u._getDimension(n(this),"outerHeight")}),f=0,u._headers.next().each(function(){f=Math.max(f,u._getDimension(n(this),"outerHeight")-u._getDimension(n(this),"height"))}).height(r-f).css({overflow:"auto"})):t.Accordion.HeightAdjustMode.Auto==i&&(r=0,u._headers.next().each(function(){r=Math.max(r,u._getDimension(n(this),"outerHeight"))}).height(r),this.maxAutoHeight=r);t.Accordion.HeightAdjustMode.Fill!=i&&this.model.height&&this._getHeight()>this.element.height()&&this._setScoller()},_getDimension:function(t,i){var u,f=n(t).parents().addBack().filter(":hidden"),r={visibility:"hidden",display:"block"},e=[];return f.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];e.push(t)}),u=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),f.each(function(n){var i=e[n];for(var t in r)this.style[t]=i[t]}),u},_headerEventHandler:function(t){if(this.model.enabled){t.preventDefault();var r=n(t.currentTarget),i=this._headers.index(r);this.model.enableMultipleOpen&&this._headers.eq(i).hasClass("e-active")?this._hideTab(i):this.model.enableMultipleOpen&&this.model.collapsible?this._activeTab(i):this.model.selectedItemIndex==i&&this.model.collapsible?(this._hideTab(this.model.selectedItemIndex),this.model.selectedItemIndex=-1):this._headers.eq(i).hasClass("e-active")||this._activeTab(i)}},_addSelectedItems:function(t){var i=this.model.selectedItems;this._removeNullInArray(i);n.inArray(t,i)==-1&&this.model.selectedItems.push(t)},_deleteSelectedItems:function(t){var i=this.model.selectedItems;n.inArray(t,i)>-1&&(this.model.selectedItems.splice(n.inArray(t,i),1),i.length==0&&i.push(-1))},_removeNullInArray:function(n){var t=n.indexOf(-1);t!=-1&&n.splice(t,1)},_deleteDisabledItems:function(t){n.inArray(t,this.model.disabledItems)>-1&&(position=n.inArray(t,this.model.disabledItems),this.model.disabledItems.splice(position,1))},_addEnabledItems:function(t){n.inArray(t,this.model.enabledItems)<0&&this.model.enabledItems.push(t)},_deleteEnabledItems:function(t){n.inArray(t,this.model.enabledItems)>-1&&(position=n.inArray(t,this.model.enabledItems),this.model.enabledItems.splice(position,1))},_keyPress:function(i){if(this.model.enabled){var r,u,f=n(i.target);if((f.hasClass("e-select")||f.hasClass("e-acrdn"))&&(r=this.model.selectedItemIndex),code=i.keyCode?i.keyCode:i.which?i.which:i.charCode,f.hasClass("e-select")||f.hasClass("e-acrdn"))switch(code){case 39:case 40:i.preventDefault();r=r==this.getItemsCount()-1?0:r+1;this._activeTab(r);u=n(this._headers[r]);break;case 38:case 37:i.preventDefault();r=r==0?this.getItemsCount()-1:r-1;this._activeTab(r);u=n(this._headers[r]);break;case 35:i.preventDefault();u=n(this._headers[this.getItemsCount()-1]);this._activeTab(this.getItemsCount()-1);break;case 36:i.preventDefault();u=n(this._headers[0]);this._activeTab(0);break;case 32:case 13:i.preventDefault();n(this._headers[r]).hasClass("e-active")&&(this.model.enableMultipleOpen||this.model.collapsible)?this._hideTab(r):this._activeTab(r)}else if(i.ctrlKey&&!f.hasClass("e-acrdn"))switch(code){case 38:i.preventDefault();r=this._contentPanels.index(f.parent(".e-content"));u=n(this._headers[r]);this._activeTab(r);break;case 33:i.preventDefault();u=n(this._headers[0]);this._activeTab(0);break;case 34:i.preventDefault();u=n(this._headers[this.getItemsCount()-1]);this._activeTab(this.getItemsCount()-1)}t.isNullOrUndefined(u)||(u.addClass("e-focus"),u.focus())}},_wireEvents:function(){this._on(this._headers,this.model.events,this._headerEventHandler);this.model.allowKeyboardNavigation&&this._on(this.element,"keydown",this._keyPress);n(window).on("resize",n.proxy(this._contentPaneSize,this));if(this.model.height&&this.model.width&&this.model.width.toString().indexOf("%")!=-1)n(window).on("resize",n.proxy(this._scrollerRefresh,this))},_scrollerRefresh:function(){this.model.height&&(this.model.heightAdjustMode!="fill"?this._getHeight()>this.model.height&&(this._scrollerObj?this._scrollerObj.refresh():this._setScoller()):this._setHeight())},_unWireEvents:function(){this._off(this._headers,this.model.events);n(window).off("resize",n.proxy(this._contentPaneSize,this));n(window).off("resize",n.proxy(this._scrollerRefresh,this));this.model.allowKeyboardNavigation&&this._off(this.element,"keydown")},_contentPaneSize:function(){var i=this._getDimension(n(this.element).parent(),"height");this._prevSize!=i&&(t.Accordion.HeightAdjustMode.Fill==this.model.heightAdjustMode&&(this.model.enableMultipleOpen?this._paneAdjustSize():this._setHeightStyle(this.model.heightAdjustMode)),this._prevSize=i)},_disableItems:function(t){var i,r,u;if(n.isArray(t))for(i=0;i=0&&(r++,this.model.selectedItemIndex=r);if(r==this._headers.length)for(r=r-1,i=0;i=0&&(r--,this.model.selectedItemIndex=r);u!==this.model.selectedItemIndex&&this._selectedItemsAction(r)}},enableItems:function(t){if(!this.model.enabled)return!1;if(n.isArray(t))for(var i=0;ithis._headers.length)this._addItemIndex=this._headers.length;else if(u>=0&&u<=this._headers.length)this._addItemIndex=u;else return!1;for(c=this.model.enableAnimation,c&&(this.model.enableAnimation=!1),this.model.heightAdjustMode=="fill"&&this._headers.next().height("auto"),o=0;o=this._addItemIndex&&this.model.disabledItems[o]++;if(e=t.buildTag("h3").addClass("e-select").attr("role","tab").attr("tabindex",0),this._addItemIndex==0?e.insertBefore(n(this._headers[this._addItemIndex])):e.insertAfter(n(this._headers[this._addItemIndex-1]).next()),this._addItemIndex<=this.model.selectedItemIndex&&(this.model.selectedItemIndex+=1),this._headers.length||(this._headers=e,this.element.append(this._headers),this.model.selectedItemIndex=0),a=t.buildTag("a").attr("href",f?r:"#").text(i),a.appendTo(e),f&&(r=""),h=n(r).length>0?n(r):t.buildTag("div").text(r),h.addClass("e-content").attr("role","tabpanel").attr("aria-hidden",!0).hide(),h.insertAfter(e),this._headers=this.element.find("> :even"),this._contentPanels=this._headers.next(),t.buildTag("span.e-icon "+this.model.customIcon.header).prependTo(e),this.model.showCloseButton&&(l=this._createDeleteIcon(),e.append(l),this._on(l,"click",this._panelDeleteClick)),this.model.enableMultipleOpen){for(this.model.selectedItems=[],s=0;s-1&&tt?this.model.disabledItems[i]--:this.model.disabledItems[i]==t&&this.model.disabledItems.splice(i,1);if(n(this.element.find(">div.e-content")[t]).remove(),this._contentPanels.splice(t,1),this._headers.splice(t,1),this.model.enableMultipleOpen&&this.model.selectedItemIndex==t?this.model.selectedItemIndex=null:this.model.enableMultipleOpen||(t==this.model.selectedItemIndex&&this.model.collapsible?this.model.selectedItemIndex=null:t==0&&this.model.selectedItemIndex==0?this.model.selectedItemIndex=0:t<=this.model.selectedItemIndex&&(this.model.selectedItemIndex-=1)),this._unWireEvents(),this._wireEvents(),this.model.heightAdjustMode!="fill"||this.model.enableMultipleOpen||this._setHeightStyle(this.model.heightAdjustMode),this.model.enableMultipleOpen){for(this.model.selectedItems=[],r=0;r0&&this._scrollerObj.disable());this._unWireEvents()},enable:function(){this.model.enabled=!0;for(var n=0;nn&&(this.model.minValue=n);this.model.value>n&&(this.model.value=n);this.model.maxValue=n;this._setProgressValue()},_setTop:function(){var n=(this.element.height()-this.text.height())/2;this.text.css("top",Math.floor(n))},_increaseProgressWidth:function(){this.header.css("width",this.model.percentage+"%");this.initial==0&&this.model.percentage!=this.initial&&this._raiseEvent("start");this._preVal!=this.model.value&&(this._preVal=this.model.value,n(this.header).attr("aria-label",this.model.percentage),this.header.hasClass("e-complete")&&this.header.removeClass("e-complete"),this.initialRender?this.initialRender=!1:this._raiseEvent("change"),this.model.percentage==100&&(this.header.addClass("e-complete"),this._raiseEvent("complete")))},_raiseEvent:function(n){this._trigger(n,{value:this.model.value,percentage:this.model.percentage})},_setProgressValue:function(){this.initial=this.model.percentage;this.model.percentage=this._valueToPercent(this.model.value);this._increaseProgressWidth()},_isNumber:function(n){return typeof n=="number"&&!isNaN(n)},_validateRange:function(n,t,i){return ni?i:n},_valueToPercent:function(n){return this.model.maxValue<=this.model.minValue?100:(n=this._validateRange(n,this.model.minValue,this.model.maxValue),100*(n-this.model.minValue)/(this.model.maxValue-this.model.minValue))},_percentToValue:function(n){if(this.model.maxValue<=this.model.minValue)return this.model.minValue;if(n>=0&&n<=100){var t=this.model.maxValue-this.model.minValue,i=t*n/100;n=i+this.model.minValue}else n<0?n=this.model.minValue:n>100&&(n=this.model.maxValue);return n}})}(jQuery,Syncfusion),function(n,t){t.widget("ejRating","ej.Rating",{_rootCSS:"e-rating",element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{maxValue:5,minValue:0,value:1,allowReset:!0,shapeWidth:23,shapeHeight:23,orientation:"horizontal",incrementStep:1,readOnly:!1,htmlAttributes:{},enabled:!0,showTooltip:!0,precision:"full",cssClass:"",width:null,height:null,enablePersistence:!1,create:null,click:null,mouseover:null,mouseout:null,change:null,destroy:null},dataTypes:{maxValue:"number",minValue:"number",allowReset:"boolean",shapeWidth:"number",shapeHeight:"number",orientation:"enum",incrementStep:"number",readOnly:"boolean",precision:"enum",enabled:"boolean",htmlAttributes:"data"},observables:["value"],value:t.util.valueFunction("value"),_setModel:function(n){for(var i in n)switch(i){case"allowReset":n[i]?this._showResetButton():this._hideResetButton();break;case"value":this.setValue(t.util.getVal(n[i]));n[i]=this.value();break;case"enabled":this._enabledAction(n[i]);break;case"cssClass":this._changeSkin(n[i]);break;case"height":this._mainDiv.height(n[i]);break;case"width":this._mainDiv.width(n[i]);break;case"readOnly":this.model.readOnly=n[i];n[i]?(this._unWireEvents(),this._on(this._mainDiv.find("li"),"mouseleave touchend",this._MouseOutHandler)):this.refresh();break;case"orientation":this.model.orientation=n[i];this.refresh();break;case"maxValue":this.model.maxValue=n[i];this.refresh();break;case"minValue":this.model.minValue=n[i];this.refresh();break;case"incrementStep":this.model.incrementStep=n[i];this.refresh();break;case"shapeWidth":this.model.shapeWidth=n[i];this.refresh();break;case"shapeHeight":this.model.shapeHeight=n[i];this.refresh();break;case"htmlAttributes":this._addAttr(n[i])}},_destroy:function(){this.element.show();this.element.val(this.element.attr("value"));this._unWireEvents();this._mainDiv.remove()},_init:function(){this._initialize()},_initialize:function(){this.element.hide();this._mainDiv=t.buildTag("div.e-rating e-widget "+this.model.cssClass,"",{},{tabindex:"0",role:"group","aria-label":"Rating"});t.isNullOrUndefined(this.model.width)||this._mainDiv.width(this.model.width);t.isNullOrUndefined(this.model.height)||this._mainDiv.height(this.model.height);this._mainDiv.insertBefore(this.element);this.model.orientation==t.Orientation.Horizontal?this._mainDiv.addClass("e-horizontal"):this._mainDiv.addClass("e-vertical");this.model.allowReset&&!this.model.readOnly&&this._createReset();this._validation();this.value()==1&&this.element[0].value!=""&&this.value(this.element[0].value);this._renderShape();this._shapes=this._mainDiv.find("div.e-shape");this._wireEvents();this._CurrentIndex=0;this._initCurrentValue();this.element.val(this.value());this._enabledAction(this.model.enabled);this._checkNameAttr();this._addAttr(this.model.htmlAttributes);this.model.showTooltip&&this._renderTooltip()},_checkNameAttr:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id})},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r._mainDiv.addClass(n):u=="readonly"?r.model.readOnly=n:u=="disabled"&&n=="disabled"?r._enabledAction(!1):u=="style"?r._mainDiv.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r._mainDiv.attr(i,n)})},_changeSkin:function(n){this.model.cssClass!=n&&this._mainDiv.removeClass(this.model.cssClass).addClass(n)},_enabledAction:function(n){n?(this._mainDiv.removeClass("e-disable"),this.element.removeAttr("disabled")):(this._mainDiv.addClass("e-disable"),this.element.attr("disabled","disabled"))},_validation:function(){this.model.incrementStep<1?this.model.incrementStep=1:this.model.incrementStep>this.model.maxValue&&(this.model.incrementStep=this.model.maxValue)},_createReset:function(){this._mainDiv.find("div.e-reset").length<=0?t.buildTag("div.e-reset","",{width:this.model.shapeWidth+"px",height:this.model.shapeHeight,title:"Reset"},{role:"button","aria-label":"reset","aria-hidden":!1}).appendTo(this._mainDiv):this._mainDiv.find("div.e-reset").show()},_renderShape:function(){var n=Math.round(this.model.maxValue/this.model.incrementStep),o=Math.round(this.model.minValue/this.model.incrementStep),i,r,u,f,e;if(this.model.orientation==t.Rating.Orientation.Horizontal?(i=(n+1)*this.model.shapeWidth,r=this.model.shapeHeight):this.model.orientation==t.Rating.Orientation.Vertical&&(i=this.model.shapeWidth,r=this.model.shapeHeight*n),n>0){for(u=t.buildTag("ul.e-ul","",{width:i+"px",height:r},{}),f=o;fthis.model.minValue)for(r=this.value()/this.model.incrementStep-this.model.minValue/this.model.incrementStep,this._CurrentIndex=r,this._valueRefresh(this._CurrentIndex),i=0;i.5?1:.5:1,r=((r%1).toFixed(1)!=0?f:r/this._CurrentIndex)*this.model.shapeWidth,u=0;u=parseFloat(this.toolTipValue)&&(o=n(this._mainDiv).data("ejTooltip"),o._setModel({content:this.toolTipValue}))},_renderTooltip:function(){var u=this,i,r;this.model.showTooltip&&(i={target:{horizontal:"center",vertical:"top"},stem:{horizontal:"center",vertical:"bottom"}},this.model.orientation==t.Rating.Orientation.Vertical&&(i={target:{horizontal:"right",vertical:"center"},stem:{horizontal:"left",vertical:"center"}}),r=n(this._mainDiv).ejTooltip({target:".e-shape-list",content:this.value(),isBalloon:!1,collision:"flip",position:i,showRoundedCorner:!0,cssClass:this.model.cssClass,beforeOpen:function(n){u._updateTooltipValue(n)}}).data("ejTooltip"),n(r.tooltip).css({"min-width":"auto"}))},_updateTooltipValue:function(t){var i=n(this._mainDiv).data("ejTooltip");i._setModel({content:this.toolTipValue});i.show(t.event.target);t.cancel=!0},_wireEvents:function(){this.model.readOnly||(this._on(this._mainDiv,"mousedown",this._ClickHandler),this._on(this._mainDiv.find("li"),"mouseenter touchmove",this._MouseOverHandler));this._on(this._mainDiv.find("li"),"mouseleave touchend",this._MouseOutHandler);this._on(this._mainDiv.find("li"),t.eventType.mouseMove,this._MouseMoveHandler)},_unWireEvents:function(){this._mainDiv.find("li").off("mouseenter touchmove");this._mainDiv.find("li").off("mouseleave touchend");this._mainDiv.off("mousedown");this.model.precision!==t.Rating.Precision.Full&&this._mainDiv.find("li").off(t.eventType.mouseMove)},_valueChanged:function(){this.element.val(this.value());this._prevValue!=this._currValue&&this._trigger("change",{value:this.value(),prevValue:this._prevValue})},reset:function(){this._reset()},show:function(){if(!this.model.enabled)return!1;this._mainDiv.css("visibility","visible")},hide:function(){if(!this.model.enabled)return!1;this._mainDiv.css("visibility","hidden")},_showResetButton:function(){if(!this.model.enabled)return!1;this._createReset()},_hideResetButton:function(){if(!this.model.enabled)return!1;this._mainDiv.find("div.e-reset").hide()},getValue:function(){return this.value()==null||this.value()===""?"":this.value()},setValue:function(t){t!=null&&t!="null"&&(this.model.maxValuet&&(t=this.model.minValue),this.value(t),n(this._shapes).removeClass("selected").addClass("inactive"),this._initCurrentValue(),this.element.val(this.value()))},refresh:function(){this._destroy();this._unWireEvents();this._initialize()}});t.Rating.Precision={Full:"full",Half:"half",Exact:"exact"};t.Rating.Orientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion),function(n,t){t.widget("ejRotator","ej.Rotator",{element:null,model:null,_setFirst:!1,validTags:["ul"],defaults:{cssClass:"",dataSource:null,query:null,fields:{text:"text",url:"url",linkAttribute:"linkAttribute",targetAttribute:"targetAttribute",thumbnailText:"text",thumbnailUrl:"url"},enabled:!0,displayItemsCount:"1",navigateSteps:"1",animationSpeed:600,startIndex:"0",enableTouch:!0,showPlayButton:!1,enableAutoPlay:!1,showNavigateButton:!0,slideWidth:"",slideHeight:"",frameSpace:"",isResponsive:!1,orientation:"horizontal",pagerPosition:"outside",showThumbnail:!1,showPager:!0,stopOnHover:!1,htmlAttributes:{},thumbnailSourceID:null,template:null,templateId:null,showCaption:!1,allowKeyboardNavigation:!0,enableRTL:!1,animationType:"slide",delay:500,circularMode:!0,create:null,change:null,start:null,stop:null,thumbItemClick:null,pagerClick:null,destroy:null},dataTypes:{cssClass:"string",dataSource:"data",query:"data",fields:"data",template:"string",templateId:"array",enabled:"boolean",displayItemsCount:"",navigateSteps:"",animationSpeed:"",transitionDelay:"",startIndex:"",showPlayButton:"boolean",enableAutoPlay:"boolean",slideWidth:"",slideHeight:"",frameSpace:"",isResponsive:"boolean",orientation:"enum",pagerPosition:"enum",showThumbnail:"boolean",thumbnailSourceID:"",showPager:"boolean",showCaption:"boolean",enableRTL:"boolean",allowKeyboardNavigation:"boolean",circularMode:"boolean",animationType:"string",delay:"",htmlAttributes:"data"},_init:function(){this._rtlDirection=!0;this._initialize();this.model.dataSource==null&&this._setValues();this._render();this._wireEvent();this.model.enableAutoPlay&&this.play();this.model.enabled||t.browserInfo().name!="msie"||t.browserInfo().version!="8.0"||(this._outerWrapper.addClass("e-disable").attr({"aria-disabled":!0}),this._ieEnable("addClass"))},_initialize:function(){this.element.attr("tabindex",0);this._liCount=null;this.transitionDelay=null;this._animating=!1;this._isPlaying=!1;this._interval=null;this._thumbCount=null;this._captionChange=!1;this._liSize=null;this._containerSize=null;this._thumbVal=this.model.showThumbnail;this.containerCss=this.model.orientation==t.Orientation.Horizontal?"outerWidth":"outerHeight";this.displayCss=this.model.orientation==t.Orientation.Horizontal?"left":"top";n.extend(jQuery.easing,{slowSlide:function(n,t,i,r,u){var f=(t/=u)*t;return i+r*f*f},fastSlide:function(n,t,i,r,u){var f=(t/=u)*t,e=f*t;return i+r*(e*f+-5*f*f+10*e+-10*f+5*t)},slide:function(n,t,i,r,u){var f=(t/=u)*t,e=f*t;return i+r*(6*e*f+-15*f*f+10*e)}})},_setValues:function(){this._setLicount();this._setSpeed(this.model.animationSpeed);this._setVisibleItemCount(this.model.displayItemsCount);this._setItemMove(this.model.navigateSteps);this._setFrameSpace(this.model.frameSpace);this._setSlideWidth(this.model.slideWidth);this._setSlideHeight(this.model.slideHeight);this._changeProperty();this._setInitial()},_refresh:function(){this._setValues();this._setDimension();this._changeSkin()},_reRenderControl:function(){this._undoClone();this._setLicount();this._setSpeed(this.model.animationSpeed);this._setVisibleItemCount(this.model.displayItemsCount);this._setItemMove(this.model.navigateSteps);this._setFrameSpace(this.model.frameSpace);this._setSlideWidth(this.model.slideWidth);this._setSlideHeight(this.model.slideHeight);this._changeProperty();this._cloneItem();this._createCaption();this._changeSkin();this._setRTL(!1)},_refreshControl:function(){this._setShowPager();this.model.showCaption?(this.element.siblings().hasClass("e-caption")&&this._caption.remove(),this._createCaption()):this.element.siblings().hasClass("e-caption")&&this._caption.remove();this.model.showThumbnail||this._thumbVal&&this.model.displayItemsCount==1&&this.model.navigateSteps==1?(this.element.parents(".e-in-wrap").siblings().hasClass("e-thumb")&&(this._thumb.remove(),t.isNullOrUndefined(this._thumbControl)||this._thumbControl.remove()),this._createThumb(),this.model.showThumbnail=!0):this.element.parents(".e-in-wrap").siblings().hasClass("e-thumb")&&(this._thumb.remove(),t.isNullOrUndefined(this._thumbControl)||this._thumbControl.remove());this._changeSkin();this._setRTL(!1)},_checkDataBinding:function(){var n=this.model.dataSource;n!=null&&(this.element.addClass("onloading"),t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._renderItems(n));this._setValues()},_initDataSource:function(n){var t=this,i;i=n.executeQuery(this._getQuery());i.done(function(n){t._renderItems(n.result)}).fail(function(){t.element.removeClass("onloading")})},_getQuery:function(){var n;if(t.isNullOrUndefined(this.model.query)){n=[];queryManager=t.Query();mapper=this.model.fields;col;for(col in mapper)col!=="tableName"&&mapper[col]&&n.push(mapper[col]);n.length>0&&queryManager.select(n);this.model.dataSource.dataSource.url.match(mapper.tableName+"$")||t.isNullOrUndefined(mapper.tableName)||queryManager.from(mapper.tableName)}else queryManager=this.model.query;return queryManager},_renderItems:function(n){this.list=n;this._generateTagItems(this.list);this.element.removeClass("onloading")},_generateTagItems:function(n){var t;for(this.mapField=this._getMapper(),t=0;t")).insertAfter(this._buttonWrapper);this.model.circularMode?(i=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),i--):i=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize);this._setCaptionText(i)},_createThumb:function(){var r,i;if(this.model.dataSource!=null||this.model.thumbnailSourceID!=null){if(this._thumb=this.model.showPager?t.buildTag("div.e-thumb","",{},{tabindex:"0",role:"group"}).insertAfter(this._bulletWrapper):t.buildTag("div.e-thumb","",{},{tabindex:"0",role:"group"}).insertAfter(this._innerWrapper),this._thumbItems=t.buildTag("ul.e-thumb-items e-ul"),this.model.dataSource!=null)this._thumbItems.addClass("onloading"),this._generateThumbnailTagItems(this.list);else{for(i=0;i0&&this.element.children("li").length>this.model.startIndex?this.model.startIndex:0)*this.model.navigateSteps*this._liSize):this.element.css(this.displayCss,"0")},_setBegin:function(){this.model.circularMode?this.element.css(this.displayCss,-(this._liSize*this.model.displayItemsCount)):this.element.css(this.displayCss,"0")},_setSlideWidth:function(n){isNaN(parseInt(n))?this.model.slideWidth=this._getMaxSize("width"):(n=n.toString(),this.model.slideWidth=this._checkValue(n,"width"));this.element.children("li").css("width",this.model.slideWidth);this._liWidth=this.element.children("li").outerWidth(!0)},_setSlideHeight:function(n){isNaN(parseInt(n))?this.model.slideHeight=this._getMaxSize("height"):(n=n.toString(),this.model.slideHeight=this._checkValue(n,"height"));this.element.children("li").css("height",this.model.slideHeight);this._liHeight=this.element.children("li").outerHeight(!0)},_setPagerposition:function(n){this.model.showPager&&(this._bullet.removeClass("e-default e-thumb-pos e-topleft e-topright e-bottomleft e-bottomright e-topCenter e-outside"),this._bullet.addClass("e-"+n),(n=="bottomleft"||n=="bottomright")&&this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&this._bullet.addClass("e-thumb-pos"))},_setCaptionText:function(n){if(this.model.showCaption){var t=this.model.circularMode?++n:n;this._caption.children().html(this.element.children("li").eq(t).children("img").attr("title"))}},_setAutoplay:function(n){n?this._createAutoPlay():this._autoButton!=null&&(this._setPause(),this._autoButton.remove())},_setSlideButton:function(n){n?this._createButtonControl():(this._prevButton.remove(),this._nextButton.remove())},_setOrientation:function(n){this._wrapper.removeClass("e-"+this.model.orientation).addClass("e-"+n);this._setFrameSpace(this.model.frameSpace);this._refresh();this.model.orientation==t.Orientation.Horizontal?this.element.css({left:-(Math.round(-this.element.position().top/this._liHeight)*this._liSize),top:0}):this.element.css({top:-(Math.round(-this.element.position().left/this._liWidth)*this._liSize),left:0});this._unwireTouchEvents();this._wireTouchEvents()},_setRTL:function(n,i){n&&this.model.showNavigateButton&&(this._unwireBtnEvents(),this.model.enableRTL=i);var r=this.model.enableRTL?"addClass":"removeClass";this.model.showPager&&this._bullet[r]("e-rtl");this.model.showCaption&&this._caption[r]("e-rtl");t.isNullOrUndefined(this._thumbItems)||this._thumbItems[r]("e-rtl");n&&this.model.showNavigateButton&&this._wireBtnEvents()},_setActiveBullet:function(){var n;this.model.circularMode?(n=Math.round(-Math.round(this.element.position()[this.displayCss])/(this._liSize*this.model.displayItemsCount)),this.model.navigateSteps0&&(Math.round(parseInt(t))=="100"&&(this.model.displayItemsCount=1,this._setVisibleItemCount(this.model.displayItemsCount)),t=this._convertPercentageToPixel(n(this.element[0]).parent()[i](),parseInt(t))),t},_convertPercentageToPixel:function(n,t){return Math.round(t*n/100)},_convertPixelToPercentage:function(n,t){return Math.round(t/n*100)},_changeProperty:function(){this.containerCss=this.model.orientation==t.Orientation.Horizontal?"outerWidth":"outerHeight";this.displayCss=this.model.orientation==t.Orientation.Horizontal?"left":"top";this.model.orientation==t.Orientation.Horizontal?(this._liSize=this._liWidth,this._containerSize=this._containerWidth):(this._liSize=this._liHeight,this._containerSize=this._containerHeight)},_setFrameSpace:function(n){isNaN(parseInt(n))?this.model.frameSpace="0px":(this.model.frameSpace=n,this.model.orientation==t.Orientation.Horizontal?this.element.children("li").css({"margin-right":n,"margin-bottom":0}):this.element.children("li").css({"margin-bottom":n,"margin-right":0}))},_setLicount:function(){this._liCount=this.element.children("li").length},_setVisibleItemCount:function(n){this.model.displayItemsCount=n;this.model.navigateSteps=this.model.navigateSteps<=this.model.displayItemsCount?this.model.navigateSteps:this.model.displayItemsCount;this._checkAndSet()},_checkAndSet:function(){(this.model.displayItemsCount>1||this.model.navigateSteps>1)&&(this.model.showThumbnail&&(this.model.showThumbnail=!1),this.model.showCaption&&(this.model.showCaption=!1,this._captionChange=!0))},_changeSkin:function(){var n;this.model.displayItemsCount>1||this.model.navigateSteps>1?(this._innerWrapper.addClass("e-multiple"),this._wrapper.removeClass("e-single"),this._outerWrapper.css("width",this._innerWrapper.outerWidth(!0))):(this._innerWrapper.removeClass("e-multiple"),this._wrapper.addClass("e-single"));this.model.showPlayButton&&this._autoButton.css({left:(this._innerWrapper.outerWidth(!0)/2-this._autoButton.width()/2)/this._innerWrapper.outerWidth(!0)*100+"%",top:(this._wrapper.outerHeight(!0)/2-this._autoButton.height()/2)/this._wrapper.outerHeight(!0)*100+"%"});this.model.showNavigateButton&&(n=(this._wrapper.outerHeight(!0)/2-this._prevButton.height()/2)/this._wrapper.outerHeight(!0)*100+"%",this._prevButton.css("top",n),this._nextButton.css("top",n));this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&this._previous!=null&&this._next!=null&&(n=this._outerWrapper.outerHeight(!0)+this._thumbItems.children("li").outerHeight(!0)/2-this._thumbItems.children("li").outerHeight(!0)-this._previous.height()/2,n=n/this._outerWrapper.outerHeight(!0)*100+"%",this._previous.css("top",n),this._next.css("top",n))},_setItemMove:function(n){this.model.navigateSteps=this._validateItemMove(n);this._checkAndSet()},_validateItemMove:function(n){return n<=this.model.displayItemsCount?n:this.model.displayItemsCount},_setPlay:function(){this.model.showPlayButton&&this._autoButton.hasClass("play")&&this._autoButton.removeClass("play").addClass("pause");this._animate=!0;this._raiseEvent("start")},_setPause:function(n){this._interval!=null&&(this.model.showPlayButton&&this._autoButton.hasClass("pause")&&this._autoButton.removeClass("pause").addClass("play"),clearInterval(this._interval),this._isInteraction=!n,this._animate=this.model.stopOnHover?!0:!1,this._interval=null,this._raiseEvent("stop"))},_setContainerPercent:function(){this._containerPercent=this._convertPixelToPercentage(this.element.parents(".e-rotator-wrap").parent().width(),this.element.parent().width())},_setSpeed:function(n){this.transitionDelay=this.model.animationType!="slideshow"?n+this.model.delay:n*2+this.model.delay},_setThumbProperty:function(){var e,u=0,f,i=this._thumbItems.children("li"),r;if(t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&parseFloat(n(i[0]).width())<0)return!1;for(r=0;rt?this._thumbMove(t):this._thumbMove(this._thumbItems.width()-i))},_changeThumbControl:function(n){var t;this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&(t=this._thumbItems.children("li").length,n*this._thumbItems.children("li").outerWidth(!0)>0?this._previous!=null&&this._previous.hasClass("e-disable")&&this._previous.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}):this._previous!=null&&this._previous.hasClass("e-enable")&&this._previous.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0}),n*this._thumbItems.children("li").outerWidth(!0)<(t-this._thumbCount)*this._thumbItems.children("li").outerWidth(!0)?this._next!=null&&this._next.hasClass("e-disable")&&this._next.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}):this._next!=null&&this._next.hasClass("e-enable")&&this._next.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0}))},_getMaxSize:function(n){for(var t=0,r=0,i=0,u=this,i=0;it?r:t;return t},_calculateValue:function(){return this._convertPercentageToPixel(this._containerWidth-(this.model.displayItemsCount-1)*parseInt(this.model.frameSpace),100/this.model.displayItemsCount)},_changeState:function(n){n?this.enable():this.disable()},_findActive:function(){var t,n;if(this.model.showPager){for(n=0;n=this._thumbItems.children("li").outerWidth(!0)&&this._thumbMove(this._thumbItems.children("li").outerWidth(!0));this._thumbItems.width()-n<=this._thumbItems.children("li").outerWidth(!0)&&this[this.model.enableRTL?"_previous":"_next"].removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0})},_thumbMove:function(n){var t=this;t._thumbItems.animate({left:"-="+n+"px"},600,function(){t._thumbItems.stop(!0,!0)})},_thumbPrev:function(){var i=this,t,n;if(!this.model.enabled)return!1;this[this.model.enableRTL?"_previous":"_next"].hasClass("e-disable")&&this[this.model.enableRTL?"_previous":"_next"].removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1});t=Math.round(this._thumbItems.position().left);n=this._thumbItems.children("li").outerWidth(!0);-t>=n&&this._thumbMove(-n);-t<=n&&this[this.model.enableRTL?"_next":"_previous"].removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0})},_findLength:function(){var t=this,n;return this.model.showThumbnail&&(n=t._thumbItems.children("li").length-1),this.model.showPager&&(n=t._bullet.children("li").length-1),this.model.showPager||this.model.showThumbnail||(n=this.model.circularMode?this.element[this.containerCss]()/this._liSize-this.model.displayItemsCount*2:this.element[this.containerCss]()/this._liSize-1),n},_changeActiveState:function(n){var t=this,i,r;i=t._findActive();r=t._findLength();t._removeActiveItem();n=="prev"?i>0?(t._setActiveItem(i-1),this.model.animationType!="slideshow"&&this._setCaptionText(i-1)):(t._setActiveItem(r),this.model.animationType!="slideshow"&&this._setCaptionText(r)):i0?r-1:u:0;this._prevIndex=r;this.model.animationType=="slideshow"&&(i.element.fadeOut(i.model.animationSpeed/2),i.model.showCaption&&i._caption.fadeOut(i.model.animationSpeed/2));i.element.animate(f,o,e,function(){t=="end"&&i._setBegin();i._animating=!1;i._setCaptionText(r);i._raiseEvent("change")});this.model.animationType=="slideshow"&&(i.element.fadeIn(i.model.animationSpeed/2),i.model.showCaption&&i._caption.fadeIn(i.model.animationSpeed/2))},_moveNext:function(){var n=this,i,r,t,u;if(n._animating=!0,this.model.circularMode){if(i=Math.round(n.element.position()[n.displayCss]),r=n.model.displayItemsCount*n._liSize-n._liCount*n._liSize,t=Math.round(n.element.position()[n.displayCss])+n.element[n.containerCss](),n._calculateItemMove(),i>r&&t-n._containerSize>n._move+parseInt(n.model.frameSpace))return{move:n._move,action:"next"};if(t-n._containerSize<=n._move+parseInt(n.model.frameSpace))return u=t-n._containerSize-parseInt(n.model.frameSpace),{move:u,action:"end"}}else{if(i=Math.round(n.element.position()[n.displayCss]),r=-(n._liCount*n._liSize),t=Math.round(n.element.position()[n.displayCss])+n.element[n.containerCss](),n._calculateItemMove(),i-n._liSize!=r)return t-n._containerSize<=n._move+parseInt(n.model.frameSpace)&&(n._move=t-n._containerSize-parseInt(n.model.frameSpace),n._move=n._move==0?i:n._move),{move:n._move,action:"next"};if(t-n._containerSize<=n._move+parseInt(n.model.frameSpace))return{move:i,action:"end"}}},_movePrev:function(){var n=this,i,u,f,r;return i=Math.round(n.element.position()[n.displayCss]),u=n.element.position()[n.displayCss],+n.element[n.containerCss](),f=n.element[n.containerCss](),n._calculateItemMove(),this.model.circularMode?un.model.displayItemsCount*n._liSize?{move:-n._move,action:"prev"}:(r=n.model.displayItemsCount*n._liSize*2+i-n._liCount*n._liSize,n._move=(n._liCount-n.model.displayItemsCount*2)%n.model.navigateSteps*n._liSize,n._move==0&&n._calculateItemMove(),n.model.orientation==t.Orientation.Horizontal?n.element.css("left",r):n.element.css("top",r),{move:-n._move,action:"prev"}):u=n._liSize*n.model.navigateSteps?{move:-n._move,action:"prev"}:(r=n.model.displayItemsCount*n._liSize+i-n._liCount*n._liSize,n._move=-i0?this._thumbItems.children().eq(--t).addClass("e-thumbhover"):this._thumbItems.children().eq(0).addClass("e-thumbhover"):t1){if(this.model.circularMode)for(n=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),n=this.eventType!="pagerClick"&&t.isNullOrUndefined(this._prevIndex)?n-this.model.displayItemsCount:this._eventIndex?this._eventIndex:n,i=0;ithis.panes.length||this.panes.length<=1)return!1;var u,e=i?"e-collapse":"e-expand",f=this.element.children(".e-splitbar:not(.e-shadowbar)");if(u=t==f.length?this._clickArrow(t-1,!i,!1):n(f[t]).children("."+e),r)u.css("display")!="none"&&u.mousedown();else return u},addItem:function(i,r,u){var e=this.panes.length,d,r,f,g,a,k,it;if(u=this._getNumber(u),d=this.element[this.containerCss](),t.isNullOrUndefined(u)&&(u=e),u<0||u>e)return"";r=this._getPaneProperty(r);r=this._checkMinMaxSize(r);f=t.buildTag("div.e-pane e-"+this.model.orientation.substr(0,1)+"-pane");this.element.append(f[this.containerCss](r.paneSize));g=r.paneSize=f[this.containerCss]();e==0&&this.panes.push(f);f.remove();var v=u,nt=e>0?e:this.panes.length,o,y,p,w,s={},c=0,l=!1;for(a=g+this._bar,y=0;y<2;y++){for(o=v;o=a-c){s[o]=tt-(a-c);l=!0;break}else e==0&&h>=0?(s[o]=b,c+=h,l=!0):h>0&&(s[o]=b,c+=h)}if(l)break;else nt=v,v=0}if(!l)return"";for(k in s)n(this.panes[k])[this.containerCss](s[k]);return e<=0?f.append(n(this.panes[u])):u==e?(p="insertBefore",w=1,f.insertAfter(n(this.panes[u-1]))):(p="insertAfter",w=0,f.insertBefore(n(this.panes[u]))),this.model.properties.splice(u,0,r),e==0&&this.element.append(f[this.containerCss](d)),e>0&&(this.panes.splice(u,0,f),it=this._createSplitBar(u-w),it[p](f)),f.append(i),this._updateModel(),f},removeItem:function(i){var r=this.panes.length-1,f,u,e,o;if(i=this._getNumber(i),t.isNullOrUndefined(i)&&(i=r),i<0||i>r||r<0)return null;f=n(this.panes[i]);o=f[this.containerCss]()+this._bar;f.remove();e=this.element.children(".e-splitbar:not(.e-shadowbar)");i==r?(u=n(this.panes[i-1]),n(e[i-1]).remove()):(u=n(this.panes[i+1]),n(e[i]).remove());u[this.containerCss](u[this.containerCss]()+o);this._removeArrays(i);this._updateModel()},_checkMinMaxSize:function(n){return!t.isNullOrUndefined(n.minSize)&&n.paneSizen.maxSize&&(n.paneSize=n.maxSize),n},_removeArrays:function(n){this.model.properties.splice(n,1);this.panes.splice(n,1);this.oldPaneSize.splice(n,1);this.oldPanePercent.splice(n,1);this._sizePercent.splice(n,1)},_getNumber:function(n){return n=parseFloat(n),isNaN(n)?null:n},_updateModel:function(){for(var t=0;t0&&this.element.css("height",this.model.height),isNaN(this.model.width)&&this.model.width.indexOf("%")>0&&this.element.css("width",this.model.width))},_setPanesProperty:function(){for(var n=0;n1)for(var t,n=0;n0&&(n=this.model.isResponsive?this._convertToPixel(i.innerWidth(),n):this.model.width);isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&(t=this.model.isResponsive?this._convertToPixel(i.innerHeight(),t):this.model.height);this.model.height&&this.element.css("height",t);this.model.width&&this.element.css("width",n)},_setHeightWidth:function(){this._setDimentions();this._setPanesSize();this._getPanesPercent()},_getParentObj:function(){return this.element.parent()},_checkProperties:function(){this.model.enableRTL&&this._rtl(this.model.enableRTL);this._prevSize=this.element[this.containerCss]()},_getExactInnerWidth:function(){var i=t.browserInfo();return i.name=="msie"?i.version==8?n(this.element)[this.containerCss]():parseFloat(window.getComputedStyle(this.element[0])[this.containerCss]):parseFloat(window.getComputedStyle(this.element[0])[this.containerCss])-(parseFloat(this.element.css("border-"+this.displayCss+"-width"))+parseFloat(this.element.css("border-"+this.borderCss+"-width"))+parseFloat(this.element.css("padding-"+this.displayCss))+parseFloat(this.element.css("padding-"+this.borderCss)))},_rtl:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_setPanesSize:function(){var r=this.containerCss,v=0,u=0,o=this.element[r](),b=!1,s=this._bar=n(this.element).find(">.e-splitbar").length>0?parseFloat(n(this.element).find(">.e-splitbar").css(r)):this._bar,p=[],e,i,f=this.panes.length,y,k,c,h,l,w,a;if(f>1)for(i=0;ithis.model.properties[i].maxSize?this.model.properties[i].maxSize:e),n(this.panes[i]).css(r,e),e<=0?(v++,p.push(i),u+=s):b?(n(this.panes[i]).css(r,0),u+=e+s,this.model.properties[i].paneSize=0):(u+=e+s,u>o&&(y=u-o+s,k=f-i-1,y+=k*s,n(this.panes[i]).css(r,y),b=!0,u+=y+s),this.model.properties[i].paneSize=e);else f==1&&(n(this.panes[0]).css(r,"100%"),u=o);if(f>1&&u!=o)if(h=n(this.panes[f-1]),u>o)c=u-o,h.css(r,c);else if(u0)for(w=parseFloat(c/v),l=0;l0;a--)if(t.isNullOrUndefined(this.model.properties[a-1].maxSize)){h=n(this.panes[a-1]);break}h.css(r,parseFloat(h[r]()+c));this.model.properties[f-1].paneSize=h[r]()}f>1&&this._checkPaneSize()},_getUnit:function(n){return n=="px"?"px":n=="pt"?"pt":n.substr(1)=="%"?"%":"px"},_getNormalValue:function(n){var i,t,r,u;return this.model.orientation=="vertical"?(i=n.y-this.element.offset().top,t=i/this.element.outerHeight(),r=this.element.height()):(i=n.x-this.element.offset().left,t=i/this.element.outerWidth(),r=this.element.width()),t>1&&(t=1),t<0&&(t=0),u=t*r,this._trimValue(u)},_trimValue:function(n){var t,i,r;return t=1,i=n%t,r=n-i,Math.abs(i)*2>=t&&(r+=i>0?t:-t),parseFloat(r.toFixed(5))},_getSplitbarIndex:function(){return this.element.children(".e-splitbar:not(.e-shadowbar)").index(this.currentSplitBar)},_paneResize:function(){var t,i,r,u,f,e,o,s;if(this.shadowBar==null)return!1;this.currentSplitBar=this.shadowBar.next();e=this._getSplitbarIndex();i=this.shadowBar.prev();r=this.currentSplitBar.next();u=e;f=e+1;t=this.shadowBar.offset()[this.displayCss];t=t-this.currentSplitBar.offset()[this.displayCss];n(i).css(this.containerCss,t+n(i)[this.containerCss]()+"px");n(r).css(this.containerCss,n(r)[this.containerCss]()-t+"px");this.oldPaneSize[u]=n(i)[this.containerCss]();this.oldPaneSize[f]=n(r)[this.containerCss]();this.shadowBar.remove();this._checkPaneSize();o={item:i,index:u,size:this.oldPaneSize[u]};s={item:r,index:f,size:this.oldPaneSize[f]};this._updateModelValue(o,s);this._trigger("resize",{prevPane:o,nextPane:s,splitbarIndex:e})},_checkPaneSize:function(){for(var r=0,e,f,i=this.panes.length,t=0;t0?s:1;if(u==0){for(t=i-1;t>=0;t--)if(n(this.panes[t]).hasClass("expanded")&&!n(this.panes[t]).hasClass("collapsed")){u=n(this.panes[t])[this.containerCss]();n(this.panes[t]).css(this.containerCss,parseFloat(u+o));break}}else n(this.panes[i-1]).css(this.containerCss,parseFloat(u+o-h))}},_maxminDraggableRange:function(n){var l,a,v,y,o,r,u,f,e,t,i,s,h,c;l=this.shadowBar.prev();this.currentSplitBar=this.shadowBar.next();a=this.currentSplitBar.next();v=l[this.containerCss]();y=a[this.containerCss]();o=this.displayCss=="left"?this.currentSplitBar[0].offsetLeft:this.currentSplitBar[0].offsetTop;r=o-v;u=y+o;c=this._getSplitbarIndex();f=c;e=c+1;t=this.model.properties[f].maxSize;i=this.model.properties[e].maxSize;t=t!=null?parseInt(t,10):null;i=i!=null?parseInt(i,10):null;this.model.properties[f].minSize=parseInt(this.model.properties[f].minSize,10);this.model.properties[e].minSize=parseInt(this.model.properties[e].minSize,10);s=this.model.properties[f].minSize;h=this.model.properties[e].minSize;this.shadowBar.removeClass("e-end-indicaton");n>u-h?(this.resizedPosition=u-h,this.shadowBar.addClass("e-end-indicaton")):nr+t&&(this.resizedPosition=r+t,this.shadowBar.addClass("e-end-indicaton")):i!=null&&n",beforeStart:null},t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejPrint(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype._init=function(){this.id=this.element[0].id;this._initialize(this.element,undefined)},t.prototype._initialize=function(n,t){var o,f,i,r,u,e;if(this.styles=$(""),this.title=$("title"),this.model.globalStyles&&this._addglobalStyles(this.model.globalStyles),this.model.externalStyles&&this._addStylesToElement(this.model.externalStyles),this.model.title&&this._addTitleToElement(this.model.title),o=$(""),f=$("").append(this.title),f.append(this.styles.clone()),i=$(""),r=$("
      "),t){if(typeof n=="string")n=$(n),r.append(n.clone());else if(typeof n=="object")for(u=0;u").html(n):$(n).clone()},t.prototype._addglobalStyles=function(){this.model.globalStyles&&(this.styles=$("style, link, meta, title"))},t.prototype._addStylesToElement=function(n){var i,t,r;if(this.model.externalStyles)for(i=$.isArray(n)?n:n.split(","),t=0;t"),this.styles=$.merge(this.styles,r)},t.prototype._addTitleToElement=function(){this.model.title&&(this.title.length===0&&(this.title=$("")),this.title.text(this.model.title))},t.prototype._removeContentFromPrint=function(n){var i,t;if(this.model.excludeSelector)for(i=$.isArray(n)?n:n.split(","),t=0;t<i.length;t++)this.copy.find(i[t]).remove()},t.prototype._printContent=function(n,t,i){var e=this,r,u,f;if(i){if(u=[],this.element.attr("id")!==undefined?u.push("#"+this.element.attr("id")):u.push("."+this.element.attr("class").replace(/ /g,".")),n!==undefined)if($.isArray(n))for(f=0;f<n.length;f++)u.push(n[f]);else u.push(n);n=this._initialize(u,!0)}this._trigger("beforeStart",{content:n});t||(r=this.model.printInNewWindow?window.open():window.open(" ","print","height="+this.model.height+",width="+this.model.width+",tabbar=no"));r.document.write(this.model.docType);r.document.write(n[0].outerHTML);r.document.close();r.focus();setTimeout(function(){ej.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},e.model.timeOutPeriod))},this.model.timeOutPeriod)},t.prototype.print=function(n,t){this._printContent(n,t,!0)},t}(ej.WidgetBase);window.ej.widget("ejPrint","ej.Print",new Print),function(n,t,i){t.widget("ejTab","ej.Tab",{_rootCSS:"e-tab",element:null,model:null,validTags:["div","span"],_addToPersist:["selectedItemIndex"],_setFirst:!1,angular:{terminal:!1},defaults:{collapsible:!1,enableAnimation:!0,ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},disabledItemIndex:[],enabledItemIndex:[],hiddenItemIndex:[],events:"click",idPrefix:"ej-tab-",heightAdjustMode:"content",selectedItemIndex:0,cssClass:"",showCloseButton:!1,htmlAttributes:{},enableTabScroll:!1,showReloadIcon:!1,headerPosition:"top",width:null,height:null,headerSize:null,enableRTL:!1,allowKeyboardNavigation:!0,showRoundedCorner:!1,enablePersistence:!1,enabled:!0,ajaxLoad:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,itemActive:null,beforeActive:null,itemAdd:null,itemRemove:null,beforeItemRemove:null,create:null,destroy:null},dataTypes:{cssClass:"string",collapsible:"boolean",events:"string",heightAdjustMode:"enum",enabled:"boolean",ajaxSettings:"data",disabledItemIndex:"data",enabledItemIndex:"data",enableAnimation:"boolean",htmlAttributes:"data"},observables:["selectedItemIndex"],selectedItemIndex:t.util.valueFunction("selectedItemIndex"),_destroy:function(){this._unWireEvents();this._removeBaseClass()},_setModel:function(i){for(var r in i)switch(r){case"events":this._off(this.items,this.model.events);this._on(this.items,i[r],this._tabItemClick);break;case"disabledItemIndex":this._disableItems(i[r]);i[r]=this.model.disabledItemIndex;break;case"enabledItemIndex":this._enableItems(i[r]);break;case"enabled":this._enabledAction(i[r]);break;case"selectedItemIndex":this._isInteraction=!1;this.showItem(t.util.getVal(i[r]));i[r]=this.model.selectedItemIndex;break;case"heightAdjustMode":this.model.heightAdjustMode=i[r];this._setTabsHeightStyle(i[r]);this._resizeEvents(i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"height":this.model.height=i[r];this._setTabsHeightStyle(this.model.heightAdjustMode);break;case"width":this.element.width(i[r]);n(this.contentPanels).width(Number(i[r]));this.refreshTabScroll();break;case"headerSize":this._setHeaderSize(i[r]);break;case"allowKeyboardNavigation":i[r]?this._on(this.element,"keydown",this._keyPress):this._off(this.element,"keydown");break;case"headerPosition":this.model.headerPosition=i[r];this.model.headerPosition==t.Tab.Position.Top?(this._removeVerticalClass(),this._removeScroll(),this.itemsContainer.remove(),this.itemsContainer.insertBefore(this.element.find(">div").first()),this.element.find("div.e-active-content").removeClass("e-activebottom"),n(this.contentPanels).css("margin-top","0")):this.model.headerPosition==t.Tab.Position.Bottom?(this._removeVerticalClass(),this._removeScroll(),this.element.find("div.e-active-content").removeClass("e-activetop"),this.model.enableTabScroll?n(this.contentPanels).css("margin-top","0"):n(this.contentPanels).css("position","relative")):(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._removeHeaderClass(),n(this.items).css("display",""),this._removeScroll());this._refresh();this.model.headerPosition==t.Tab.Position.Right&&this.element.css("position","");(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick),this.model.height&&this.model.enableTabScroll&&(n(this.contentPanels).height(Number(this.model.height)-2),this.element.find("div.e-active-content").height(Number(this.model.height)-32)));this.scrollstep=30;break;case"showCloseButton":i[r]?(this._addDeleteIcon(),this._on(this.element.find("div.e-close"),"click",this._tabDeleteClick)):this.element.find("div.e-close").remove();break;case"enableTabScroll":this.model.enableTabScroll=i[r];i[r]?(this._removeScroll(),this._addScroll(),this.model.headerPosition=="left"&&(this._refresh(),this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick))):(this._removeScroll(),this.itemsContainer.removeAttr("style"),n(this.contentPanels).css("margin-top","0"));(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._refresh(),this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick),this.model.headerPosition!=t.Tab.Position.Right||this.model.enableTabScroll||this.element.css("margin-left",""));break;case"showReloadIcon":i[r]?this._addReloadIcon():this.element.find("div.e-reload").remove();break;case"enableRTL":this.model.enableRTL=i[r];this._removeScroll();this.itemsContainer.removeAttr("style");n(this.contentPanels).css("margin-top","0");this.element.find("ul").removeAttr("style");i[r]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this.model.enableTabScroll&&this._addScroll();this._refresh();this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick);this.model.headerPosition==t.Tab.Position.Right&&this.model.enableRTL&&this.element.css("margin-left","");break;case"htmlAttributes":this._addAttr(i[r]);break;case"hiddenItemIndex":this.model.headerPosition==t.Tab.Position.Top||this.model.headerPosition==t.Tab.Position.Bottom?n(this.items).css("display","inline-block"):n(this.items).css("display","");this.model.hiddenItemIndex=i[r];this.model.hiddenItemIndex.length>0&&this._hiddenIndexItem(this.model.hiddenItemIndex)}},_removeScroll:function(){this.itemsContainer.removeAttr("style");this.element.find("div.e-chevron-circle-right").remove();this.element.find("div.e-chevron-circle-left").remove()},_addScroll:function(){(this.model.headerPosition=="left"||this.model.headerPosition=="right"&&this._tabContentsHeight()>(this.element.width()||Number(this.model.height))||this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this._checkScroll();this._addScrollIcon();this.refreshTabScroll()},_init:function(){this._addItemIndex=null;this.tabId=0;this._hiddenIndex=this.model.hiddenItemIndex;this._initialize();this._prevSize=this._getDimension(n(this.element).parent(),"height")},_changeSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},_tabContentsWidth:function(){for(var r=this.element.find("li").length,t=0,i=0;i<r;i++)t=t+n(this.element.find("li")[i]).width();return t},_tabContentsHeight:function(){for(var r=this.element.find("li").length,t=0,i=0;i<r;i++)t=t+n(this.element.find("li")[i]).height();return t},_initialize:function(){this.initialRender=!0;this.element.attr("tabindex",0).attr("role","tablist");this._itemsRefreshing();n(this.anchors).addClass("e-link");this._preTabSelectedIndex=this._preTabIndex=-1;t.isNullOrUndefined(this.model.width)||this.element.width(this.model.width);t.isNullOrUndefined(this.model.height)||this.element.height(this.model.height);this._setTabPosition(this.model.headerPosition);this.model.showCloseButton&&this._addDeleteIcon();this.model.showReloadIcon&&this._addReloadIcon();this.model.showRoundedCorner&&this._roundedCorner(this.model.showRoundedCorner);this._enabledAction(this.model.enabled);this.contentPanels=[];this._addAttr(this.model.htmlAttributes);this._reinitialize();this._addBaseClass();t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize(this.model.headerSize);this._disableTabs();this._roundedCorner(this.model.showRoundedCorner);this.model.enableTabScroll&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom"?this.itemsContainer.width()>this.element.width()&&this._addScrollIcon():this.element.height()<this.items.height()*this.items.length&&this._addScrollIcon());this._wireEvents(this.model.events);this.showItem(this.selectedItemIndex());this._setTabsHeightStyle(this.model.heightAdjustMode);this._enabledAction(this.model.enabled);this._resizeEvents(this.model.heightAdjustMode);this.model.hiddenItemIndex.length>0&&this._hiddenIndexItem(this.model.hiddenItemIndex)},_reinitialize:function(t){for(var f,r,u=this._addItemIndex!=null?this._addItemIndex:0;u<this.anchors.length;u++)if(f=this.anchors[u],r=this.divId==i?n(f).attr("href"):this.divId,this.divId=i,hrefBase=r.split("#")[0],hrefBase&&hrefBase===location.toString().split("#")[0]&&(r=a.hash,f.href=r),r&&r!=="#"?(this._addContentTag(r,u),t&&this._addContentBaseClass(n(this.contentPanels[u]))):this.model.enablePersistence||this.model.disabledItemIndex.push(u),this._addItemIndex!=null){this._unWireEvents();this._wireEvents(this.model.events);this.items.length==1&&this.showItem(this.selectedItemIndex());break}},_itemsRefreshing:function(){this.itemsContainer=this.element.find("ol,ul").eq(0);this.items=this.itemsContainer.find(" > li:has(a[href])");this.anchors=this.items.find("a[href]")},_setHeaderSize:function(n){this.element.find(">ul li.e-item").css("height","auto");this.element.find(">ul li.e-item").children("a.e-link").css("margin-top","0px");this.model.headerPosition=="left"?this.element.find(">ul.e-left").css({width:n,"text-align":"center"}):this.model.headerPosition=="right"?this.element.find(">ul.e-right").css({width:n,"text-align":"center"}):(this.element.find(">ul.e-header li.e-item").css("height",n),this.element.find(">ul.e-header li.e-item a.e-link").css("margin-top",(this.element.find(">ul.e-header").outerHeight()/2-this.element.find(">.e-header li.e-item a.e-link").outerHeight()).toString()+"px"))},_enabledAction:function(n){n?this.element.removeClass("e-disable"):this.element.addClass("e-disable")},_hiddenIndexItem:function(t){for(var r,i=0;i<t.length;i++)!n.inArray(parseInt(t[i]),this._hiddenIndex)>-1&&(r=n(this.items[parseInt(t[i])]).children("a").attr("href"),this._hidePanel(r));this._hideContentPanel(this.selectedItemIndex(),this.model.hiddenItemIndex);this._hiddenIndex=this.model.hiddenItemIndex},_hidePanel:function(t){for(var r,i=0;i<this.contentPanels.length;i++)if("#"+n(this.contentPanels[i]).attr("id")==t){n(this.contentPanels[i]).css("display","none");break}for(r=0;r<this.items.length;r++)if(n(this.items.children("a")[r]).attr("href")==t){n(this.items[r]).css("display","none");break}},_hideContentPanel:function(t,i){n.inArray(t,i)>-1?(t+=1,t<=this.items.length-1?this._hideContentPanel(t,i):t>this.items.length-1&&i.length!=this.items.length&&this._hideContentPanel(0,i)):this.showItem(t)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?(i.model.enabled=!1,i._enabledAction(!1)):i.element.attr(t,n)})},_setTabPosition:function(i){i==t.Tab.Position.Bottom?(this.itemsContainer.appendTo(this.element),this.items.removeClass("e-bottom-line"),this.items.addClass("e-top-line")):i==t.Tab.Position.Top?(this.items.removeClass("e-top-line"),this.itemsContainer.prependTo(this.element),this.model.enableRTL?this.items.addClass("e-rtl-top-line e-top-hover"):this.items.addClass("e-bottom-line")):(i==t.Tab.Position.Left||i==t.Tab.Position.Right)&&this.items.length>=0&&(this.model.height?this.itemsContainer.css("height",this.model.height):!1&&n(this.itemsContainer).css("height",""),this.element.addClass("e-vertical"))},_addDeleteIcon:function(){var n,i;this.element.find("div.e-close.e-tabdelete").length<=0&&this.items.length>0&&(n=t.buildTag("div.e-icon e-close e-tabdelete","",{},{role:"presentation"}).css("visibility","hidden"),this.model.headerPosition=="left"||this.model.headerPosition=="right"?(i=this.items.find("a"),n.insertBefore(i)):this.items.append(n))},_addScrollIcon:function(){if(this.element.addClass("e-tabscroll"),this.element.find("div.e-chevron-circle-right").length<=0&&this.items.length>0){this._rightScrollIcon=t.buildTag("div.e-icon e-chevron-circle-right","",{},{role:"presentation"}).css("visibility","hidden");this.itemsContainer.append(this._rightScrollIcon);this.scrollstep=30;this._rightScrollIcon.css("position","relative");this.model.enableRTL||(this.model.headerPosition=="left"?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()/2+"px"):this.model.headerPosition=="right"?this._rightScrollIcon.css("margin-left",this.itemsContainer.width()/2-this.scrollstep+"px"):this.model.enablePersistence==!0&&this._beforeWidth!=0&&this._beforeWidth>this.scrollPanelWidth?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-this.scrollPanelWidth+20-(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)*2+"px"):this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-this.scrollPanelWidth+20+"px"));this.model.headerPosition=="left"||this.model.headerPosition=="right"?(this._rightScrollIcon.css("transform","rotate(270deg)"),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)<11?this.model.headerPosition=="top"||this.model.headerPosition=="bottom"?this._rightScrollIcon.css("margin-top","-"+(this.itemsContainer.height()+this.scrollPanelWidth-3)+"px"):this.model.enableRTL?this._rightScrollIcon.css("margin-top","-"+this.items.height()*this.items.length+"px"):this._rightScrollIcon.css("margin-top","-"+(this.items.height()*this.items.length-20)+"px"):this.model.enablePersistence==!0&&this._beforeWidth!=0&&this._beforeWidth>this.scrollPanelHeight?this._rightScrollIcon.css("margin-top","-"+(this.items[this.selectedItemIndex()].offsetTop*3-this.scrollPanelHeight*2)+"px"):this.model.enableRTL?this._rightScrollIcon.css("margin-top","-"+this.items.height()*this.items.length+"px"):this._rightScrollIcon.css("margin-top","-"+(this.items.height()*this.items.length-20)+"px")):this.model.enableRTL?(this._rightScrollIcon.css("margin-top","-"+this.itemsContainer.height()+"px"),this._rightScrollIcon.css("margin-left",this.itemsContainer.width()-14+"px")):this._rightScrollIcon.css("margin-top","-"+(this.itemsContainer.height()/2+10)+"px");t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)<11&&(this.model.headerPosition=="top"?parseInt(this._rightScrollIcon.prev().offset().top)-parseInt(this._rightScrollIcon.offset().top)==-parseInt(this._rightScrollIcon.css("margin-top"))&&this._rightScrollIcon.css("top",this.itemsContainer.height()/2+27+"px"):this.model.headerPosition=="bottom"&&(this.model.enableRTL?this._rightScrollIcon.css("top",this.itemsContainer.height()/2+20+"px"):this._rightScrollIcon.css("top",this.itemsContainer.height()/2+27+"px")));this.model.headerPosition=="left"?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()/2+"px"):this.model.headerPosition=="right"&&this._rightScrollIcon.css("margin-left",this.itemsContainer.width()/2-this.scrollstep+"px");this.element.attr("unselectable","on");this.element.css("user-select","none");this.element.on("selectstart",!1);this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick)}},_addScrollBackIcon:function(){if(this.element.find("div.e-chevron-circle-left").length<=0){this._leftScrollIcon=t.buildTag("div.e-icon e-chevron-circle-left","",{},{role:"presentation"}).css("visibility","hidden");this.itemsContainer.prepend(this._leftScrollIcon);this.rightscrollstep=30;this.element.attr("unselectable","on");this.element.css("user-select","none");this.element.on("selectstart",!1);this._leftScrollIcon.css("position","absolute").css("z-index","10");(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&(this.model.enableRTL?this._leftScrollIcon.css("margin-right",this.element.width()-20+"px"):this._leftScrollIcon.css("margin-left","20px"));this.model.headerPosition=="left"||this.model.headerPosition=="right"?(this.model.enableRTL?(this._leftScrollIcon.css("margin-top",+(this.scrollPanelHeight-4)+"px"),this.model.headerPosition=="right"?this._leftScrollIcon.css("margin-right",this.itemsContainer.width()/2+14+"px"):this._leftScrollIcon.css("margin-right",this.itemsContainer.width()/2+"px")):(this.model.headerPosition=="right"?this._leftScrollIcon.css("margin-left",this.itemsContainer.width()/2-30+"px"):this.model.headerPosition=="left"&&this._leftScrollIcon.css("margin-left",this.itemsContainer.width()/2-15+"px"),this._leftScrollIcon.css("margin-top",+this.scrollPanelHeight+20+"px")),this._leftScrollIcon.css("transform","rotate(270deg)")):t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)<11?this._leftScrollIcon.css("margin-top","0px"):this.model.enableRTL?this._leftScrollIcon.css("margin-top","0px"):this._leftScrollIcon.css("margin-top","-5px");this._on(this._leftScrollIcon,"click",this._tabScrollBackClick)}},_addReloadIcon:function(){var n,i;this.element.find("div.e-reload").length<=0&&this.items.length>0&&(n=t.buildTag("div.e-icon e-reload","",{},{role:"presentation"}).css("visibility","hidden"),this.model.headerPosition=="left"||this.model.headerPosition=="right"?(i=this.items.find("a"),n.insertBefore(i)):this.items.append(n))},_addBaseClass:function(){this.element.addClass("e-widget "+this.model.cssClass);this.itemsContainer.addClass("e-box");this.model.enableRTL&&this.element.addClass("e-rtl");this.model.headerPosition=="top"&&(n(this.contentPanels).addClass("e-hidebottom e-addborderbottom"),n(this.itemsContainer).addClass("e-addborderbottom"),n(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hideright e-addborderright e-hideleft e-addborderleft"),n(this.itemsContainer).removeClass("e-addbordertop e-addborderright e-addborderleft"),this.items.length>0&&this.itemsContainer.addClass("e-header"),this.model.enableRTL&&(this.items.addClass("e-rtl-top-line"),this.items.removeClass("e-rtl-bottom-line")));this.model.headerPosition=="bottom"&&(n(this.contentPanels).removeClass("e-hidebottom e-addborderbottom e-hideright e-addborderright e-hideleft e-addborderleft"),n(this.itemsContainer).removeClass("e-addborderbottom e-addborderright e-addborderleft"),n(this.contentPanels).addClass("e-hidetop e-addbordertop"),n(this.itemsContainer).addClass("e-addbordertop"),this.items.length>0&&this.itemsContainer.addClass("e-header"),this.model.enableRTL&&(this.items.addClass("e-rtl-bottom-line"),this.items.removeClass("e-rtl-top-line e-top-line")));this.model.headerPosition=="left"&&(this.items.length>0&&this.itemsContainer.addClass("e-left"),n(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideright e-addborderright"),n(this.itemsContainer).removeClass("e-addbordertop e-addborderbottom e-addborderright"),n(this.contentPanels).addClass("e-hideleft e-addborderleft"),n(this.itemsContainer).addClass("e-addborderleft"),n(this.items).removeClass("e-rtl-bottom-line e-rtl-top-line"));this.model.headerPosition=="right"&&(this.items.length>0&&this.itemsContainer.addClass("e-right"),n(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideleft e-addborderleft"),n(this.itemsContainer).removeClass("e-addbordertop e-addborderbottom e-addborderleft"),n(this.contentPanels).addClass("e-hideright e-addborderright"),n(this.itemsContainer).addClass("e-addborderright"),this.model.enableTabScroll&&this._tabContentsHeight()>(this.element.height||Number(this.model.height))&&n(this.itemsContainer).css("z-index","12").css("margin-left","-"+this.itemsContainer.find("li").width()+"px"),n(this.items).removeClass("e-rtl-bottom-line e-rtl-top-line"));this.items.addClass("e-select e-item").attr("role","tab").attr("tabindex",-1).attr("aria-expanded",!0).attr("aria-selected",!1);n(this.contentPanels).addClass("e-content e-content-item e-box").attr("role","tabpanel").attr("aria-hidden",!0);((this.model.headerPosition=="left"||this.model.headerPosition=="right")&&this._tabContentsHeight()>(this.element.height()||Number(this.model.height))||(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this._tabContentsWidth()>(t.getDimension(this.element,"width")||this.model.width))&&this._checkScroll()},_addContentBaseClass:function(n){this.model.headerPosition=="top"&&(n.addClass("e-hidebottom e-addborderbottom"),n.removeClass("e-hidetop e-addbordertop e-hideright e-addborderright e-hideleft e-addborderleft"));this.model.headerPosition=="bottom"&&(n.removeClass("e-hidebottom e-addborderbottom e-hideright e-addborderright e-hideleft e-addborderleft"),n.addClass("e-hidetop e-addbordertop"));this.model.headerPosition=="left"&&(n.removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideright e-addborderright"),n.addClass("e-hideleft e-addborderleft"));this.model.headerPosition=="right"&&(n.removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideleft e-addborderleft"),n.addClass("e-hideright e-addborderright"));n.addClass("e-content e-content-item e-box").attr("role","tabpanel").attr("aria-hidden",!0)},_checkScroll:function(){var i,r,u,f;if(this.scrollPanelWidth=t.getDimension(this.element,"width"),this.scrollPanelHeight=t.getDimension(this.element,"height"),this.model.enableTabScroll==!0&&this._tabContentsHeight()>this.items.height()){if(this.scrollstep=0,this.model.enableTabScroll=!0,(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this.itemsContainer.css({width:t.getDimension(this.element,"width")+parseInt(this.items.css("width"))*this.items.length+"px",position:"absolute"}),this._beforeWidth=0,this.model.enablePersistence==!0)if(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")for(i=0;i<this.selectedItemIndex();i++)this._beforeWidth+=this.items[i].offsetWidth;else for(i=0;i<this.selectedItemIndex();i++)this._beforeWidth+=this.items[i].offsetHeight;r=parseInt(this.itemsContainer.css("width"));this.model.headerPosition=="top"&&(u=n(this.contentPanels),u.css("padding-top",this.itemsContainer.outerHeight()+(u.hasClass("e-activetop")?0:this.model.enableRTL?4:3)+"px"),n(this.contentPanels).css({"border-top":"none",width:t.getDimension(this.element,"width")-1+"px"}),this.itemsContainer.css("border-bottom","1px solid #bbbcbb"));this.model.headerPosition=="bottom"&&(n(this.contentPanels).css({position:"relative",width:t.getDimension(this.element,"width")-1+"px","border-bottom":"none"}),this.itemsContainer.css("border-top","1px solid #bbbcbb"),n(this.contentPanels).css({"border-top":""}));f=parseInt(r-(this.scrollPanelWidth+this.scrollstep-1));this.model.enableRTL&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")?this.itemsContainer.css("clip","rect(0px,"+r+"px,100px,"+f+"px)"):this.model.headerPosition=="left"?this._tabContentsHeight()>Number(this.model.height)&&(this.itemsContainer.css({height:parseInt(this.itemsContainer.css("height"))+parseInt(this.items.css("height"))*this.items.length+30+"px",position:"absolute","border-right":"1px solid #bbbcbb",background:"white"}),n(this.contentPanels).css("padding-left",this.itemsContainer.width()+5+"px"),this.model.enableRTL&&this.itemsContainer.css("margin-right",t.getDimension(this.element,"width")-this.itemsContainer.width()),this._beforeWidth==0||this._beforeWidth<this.scrollPanelHeight?this.itemsContainer.css("clip","rect(0px,"+(this.itemsContainer.width()+4)+"px,"+this.scrollPanelHeight+"px,"+this.scrollstep+"px)"):this._beforeWidth>this.scrollPanelHeight&&this.itemsContainer.css({clip:"rect("+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px,"+(this.itemsContainer.width()+2)+"px,"+(this.items[this.selectedItemIndex()].offsetTop*2-this.scrollPanelHeight)+"px,0px)","margin-top":"-"+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px"}),this.element.removeClass("e-scrolltab")):this.model.headerPosition=="right"?this._tabContentsHeight()>Number(this.model.height)&&(this.itemsContainer.css({height:parseInt(this.itemsContainer.css("height"))+parseInt(this.items.css("height"))*this.items.length+30+"px",position:"absolute","margin-left":"-1px"}).css("z-index","12"),n(this.contentPanels).css({position:"absolute",width:parseInt(this.element.width()-1)+"px",height:t.getDimension(this.element,"height")+"px","margin-left":"-"+t.getDimension(this.element,"width")+"px","border-right":"none"}),this.model.enableRTL||n(this.element).css("margin-left",t.getDimension(this.element,"width")+"px"),this.itemsContainer.css("border-left","1px solid #bbbcbb"),this.model.enableRTL&&this.itemsContainer.css("margin-right","-"+(this.itemsContainer.width()+1)+"px"),this._beforeWidth==0||this._beforeWidth<this.scrollPanelHeight?this.itemsContainer.css("clip","rect(0px,"+this.itemsContainer.width()+2+"px,"+this.scrollPanelHeight+"px,"+this.scrollstep+"px)"):this._beforeWidth>this.scrollPanelHeight&&this.itemsContainer.css({clip:"rect("+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px,"+(this.itemsContainer.width()+2)+"px,"+(this.items[this.selectedItemIndex()].offsetTop*2-this.scrollPanelHeight)+"px,0px)","margin-top":"-"+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px"}),this.element.removeClass("e-scrolltab")):this._beforeWidth==0||this._beforeWidth<this.scrollPanelWidth?this.itemsContainer.css({clip:"rect(0px,"+(this.scrollPanelWidth+this.scrollstep)+"px,100px,"+this.scrollstep+"px)","margin-left":"-"+this.scrollstep+"px"}):this._beforeWidth>this.scrollPanelWidth&&this.itemsContainer.css({clip:"rect(0px,"+(this.items[this.selectedItemIndex()].offsetLeft*2-this.scrollPanelWidth)+"px,100px,"+(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)*2+"px)","margin-left":"-"+(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)*2+"px"});this.itemsContainer.find(".e-icon.e-chevron-circle-left").length&&this.itemsContainer.find(".e-icon.e-chevron-circle-left").css("display","none");this._initialClip=this.itemsContainer.css("clip")}},_executeForwardScrolling:function(n,i){var r;if(this._rightScrollIcon.css("position","relative"),r=i?i:n.type=="swiperight"||n.type=="swipeleft"?50:30,this.model.headerPosition=="top"||this.model.headerPosition=="bottom")if(this.model.enableRTL){var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),o=this.itemsContainer.css("margin-right")?Number(this.itemsContainer.css("margin-right").split("px")[0].replace(",","")):0,e=Number(this._rightScrollIcon.css("margin-left").split("px")[0]),s=this._leftScrollIcon&&this._leftScrollIcon.css("margin-right")?Number(this._leftScrollIcon.css("margin-right").split("px")[0]):"";this.itemsContainer.css({clip:"rect(0px,"+(f-r)+"px,100px,"+(u-r)+"px)","margin-right":"-"+(-o+r)+"px"});this._rightScrollIcon.css("margin-left",e-r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-right",s+r+"px"):"";n.type=="swipeleft"&&Math.abs(Number(this.itemsContainer.css("margin-right").split("px")[0]))>=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._off(this.items,"swipeleft",this._tabSwipe);this._leftScrollIcon&&this._leftScrollIcon.css("margin-right")&&Number(this._leftScrollIcon.css("margin-right").split("px")[0])>=this._tabContentsWidth()-40&&this._rightScrollIcon.css("display","none")}else{var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),e=Number(this._rightScrollIcon.css("margin-right").split("px")[0]);this.itemsContainer.css({clip:"rect(0px,"+(f+r)+"px,100px,"+(u+r)+"px)","margin-left":"-"+(u+r)+"px"});this._rightScrollIcon.css("margin-right",e-r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-left",u+r+"px"):"";n.type=="swipeleft"&&Math.abs(Number(this.itemsContainer.css("margin-left").split("px")[0]))>=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._off(this.items,"swipeleft",this._tabSwipe);this._leftScrollIcon&&this._leftScrollIcon.css("margin-left")&&Number(this._leftScrollIcon.css("margin-left").split("px")[0])>=this._tabContentsWidth()-t.getDimension(this.element,"width")&&(this._rightScrollIcon.css("display","none"),this._off(this.items,"swipeleft",this._tabSwipe))}else if(this.model.headerPosition=="left"||this.model.headerPosition=="right"){var f=Number(this.itemsContainer.css("clip").split("px")[0].replace(",","").split("(")[1]),u=Number(this.itemsContainer.css("clip").split("px")[2].replace(",","")),e=Number(this._rightScrollIcon.css("margin-top").split("px")[0].replace(",","")),h=this._leftScrollIcon&&this._leftScrollIcon.css("margin-top")?Number(this._leftScrollIcon.css("margin-top").split("px")[0]):0,c=this.itemsContainer.css("margin-top")?Number(this.itemsContainer.css("margin-top").split("px")[0]):0;this.itemsContainer.css({clip:"rect("+(f+r)+"px, "+(this.itemsContainer.width()+4)+"px,"+(u+r)+"px, 0px)","margin-top":"-"+(-c+r)+"px"});this._rightScrollIcon.css("margin-top",e+r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-top",h+r+"px"):"";u>this._tabContentsHeight()-20&&(this.itemsContainer.css({clip:"rect("+(this._tabContentsHeight()-Number(this.model.height)+2)+"px, "+(this.itemsContainer.width()+4)+"px, "+(this._tabContentsHeight()+2)+"px, 0px","margin-top":"-"+(this._tabContentsHeight()-Number(this.model.height)+2)+"px"}),this._leftScrollIcon.css("margin-top",this._tabContentsHeight()-12+"px"),this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-(this._tabContentsHeight()-Number(this.model.height))-22)+"px"),this._rightScrollIcon.css("display","none"))}},_executeBackwardScrolling:function(n,i){var r;if(this._rightScrollIcon!=""&&this._rightScrollIcon.css("display","block"),r=i?i:n.type=="swiperight"||n.type=="swipeleft"?50:30,this.model.headerPosition=="top"||this.model.headerPosition=="bottom")if(this.model.enableRTL){var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),o=Number(this.itemsContainer.css("margin-right").split("px")[0])?Number(this.itemsContainer.css("margin-right").split("px")[0]):0,s=this._leftScrollIcon&&this._leftScrollIcon.css("margin-right")?Number(this._leftScrollIcon.css("margin-right").split("px")[0]):"",e=Number(this._rightScrollIcon.css("margin-left").split("px")[0]);this.itemsContainer.css({clip:"rect(0px,"+(f+r)+"px,100px,"+(u+r)+"px)","margin-right":"-"+(-o-r)+"px"});this._rightScrollIcon.css("margin-left",e+r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-right",s-r+"px"):"";n.type=="swiperight"&&Math.abs(Number(this.itemsContainer.css("margin-right").split("px")[0]))<=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._on(this.items,"swipeleft",this._tabSwipe);o>=-r&&this._leftScrollIcon&&this._leftScrollIcon.css("display","none")}else{var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),e=Number(this._rightScrollIcon.css("margin-right").split("px")[0]);this.itemsContainer.css({clip:"rect(0px,"+(f-r)+"px,100px,"+(u-r)+"px)","margin-left":"-"+(u-r)+"px"});this._rightScrollIcon.css("margin-right",e+r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-left",u-r+"px"):"";u-r<0&&(this.itemsContainer.css({clip:"rect(0px,"+t.getDimension(this.element,"width")+"px,100px, 0px","margin-left":"0px"}),this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-t.getDimension(this.element,"width")+20+"px"));n.type=="swiperight"&&Math.abs(Number(this.itemsContainer.css("margin-left").split("px")[0]))<=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._on(this.items,"swipeleft",this._tabSwipe);u<=r&&this._leftScrollIcon&&this._leftScrollIcon.css("display","none")}else if(this.model.headerPosition=="left"||this.model.headerPosition=="right"){var f=Number(this.itemsContainer.css("clip").split("px")[0].replace(",","").split("(")[1]),u=Number(this.itemsContainer.css("clip").split("px")[2].replace(",","")),e=Number(this._rightScrollIcon.css("margin-top").split("px")[0]),h=this._leftScrollIcon.css("margin-top")?Number(this._leftScrollIcon.css("margin-top").split("px")[0]):0,c=this.itemsContainer.css("margin-top")?Number(this.itemsContainer.css("margin-top").split("px")[0]):0;this.itemsContainer.css({clip:"rect("+(f-r)+"px, "+this.itemsContainer.width()+"px,"+(u-r)+"px, 0px)","margin-top":"-"+(-c-r)+"px"});this._rightScrollIcon.css("margin-top",e-r+"px").css("display","block");this._leftScrollIcon.css("margin-top",h-r+"px");Number(this.itemsContainer.css("clip").split("px")[0].split("(")[1])<=0&&(this.itemsContainer.css({clip:"rect( 0px, "+this.itemsContainer.width()+"px,"+Number(this.model.height)+"px, 0px)","margin-top":"0px"}),this._leftScrollIcon.css("display","none"),this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-22)+"px"))}},_removeHeaderClass:function(){this.itemsContainer.remove();this.itemsContainer.insertBefore(this.element.find(">div").first());this.items.removeClass("e-bottom-line e-top-line");n(this.contentPanels).removeClass("e-content-bottom e-activetop e-activebottom");this.itemsContainer.removeClass("e-header e-left e-right")},_removeVerticalClass:function(){this.element.removeClass("e-vertical");this.itemsContainer.removeClass("e-left e-right").removeAttr("style")},_removeBaseClass:function(){this.element.removeClass("e-tab e-widget e-corner");(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&this._removeVerticalClass();this.itemsContainer.removeClass("e-header e-box e-clearall e-select");this.anchors.removeClass("e-link");this.items.removeClass("e-select e-item e-active e-bottom-line e-top-line");n(this.contentPanels).removeClass("e-content e-content-item e-box");n(this.contentPanels).removeClass("e-content e-content-item e-box e-content-bottom e-activetop e-activebottom e-active-content");n(this.contentPanels).css("display","")},_addContentTag:function(n,i){var u=this._getTabId(n),r=this.element.find("#"+u);r.length||(r=t.buildTag("div.e-content e-content-item e-box e-content-bottom #"+u).insertAfter(this.contentPanels[i-1]||this.itemsContainer));this.contentPanels.splice(i,0,r[0])},_roundedCorner:function(n){n?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_setTabsHeightStyle:function(i){var r,u;if(t.Tab.HeightAdjustMode.Content!=i&&n(this.contentPanels).height(""),t.Tab.HeightAdjustMode.Fill==i)(t.Tab.Position.Left===this.model.headerPosition||t.Tab.Position.Right===this.model.headerPosition)&&n(this.contentPanels).css("height","100vh"),this._contentPaneSize();else if(t.Tab.HeightAdjustMode.Auto==i){for(r=0,n(this.contentPanels).css({display:"none"}).addClass("e-active-content"),u=0;u<this.contentPanels.length;u++)r=Math.max(r,this._getDimension(n(this.contentPanels[u]),"outerHeight"));n(this.contentPanels).removeClass("e-active-content");n(this.contentPanels).height(r);this.maxAutoHeight=r;this.showItem(this.selectedItemIndex())}else t.Tab.HeightAdjustMode.None==i&&this.model.height!=null&&this._contentPaneSize();t.Tab.HeightAdjustMode.Fill!==i&&n(this.itemsContainer).height("");t.Tab.HeightAdjustMode.Content==i&&n(this.contentPanels).height("auto");this.model.enableTabScroll&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&n(this.contentPanels).css("height",this.model.height+"px")},_getDimension:function(t,i){var u,f=n(t).parents().addBack().filter(":hidden"),r={visibility:"hidden",display:"block"},e=[];return f.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];e.push(t)}),u=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),f.each(function(n){var i=e[n];for(var t in r)this.style[t]=i[t]}),u},showItem:function(i){var f,e,u,r;if(n.inArray(i,this.model.disabledItemIndex)<0){if(f=this,this._isInteraction!=!1&&(this._isInteraction=!0),this._preTabSelectedIndex=this.selectedItemIndex(),this.selectedItemIndex(i),this.selectedItemIndex()>=this.contentPanels.length&&(this.selectedItemIndex(0),i=this.selectedItemIndex()),i>=0&&!this.initialRender&&!0===this._onBeforeActive(i))return this.selectedItemIndex(this._preTabSelectedIndex),!1;if(this._preTabIndex=this._preTabSelectedIndex,n(this.items[this.selectedItemIndex()]).attr("aria-expanded",!0).attr("aria-selected",!0).attr("tabindex",0),this.selectedItemIndex()!=null&&this.selectedItemIndex()<this.contentPanels.length){for(this._ajaxLoad(),this.hideItem(this._preTabIndex),n(this.contentPanels[this.selectedItemIndex()]).fadeIn(this.model.enableAnimation?20:0,function(){if(!f.initialRender&&f._onActive())return!0;f.initialRender=!1}),this.model.headerPosition=="left"||this.model.headerPosition=="right"?n(this.contentPanels[this.selectedItemIndex()]).addClass("e-active-content "):(e=this.model.headerPosition==t.Tab.Position.Top?"e-activetop":"e-activebottom",n(this.contentPanels[this.selectedItemIndex()]).addClass(e)),n(this.items[this.selectedItemIndex()]).addClass("e-active").removeClass("e-select"),n(this.items[this.selectedItemIndex()]).removeClass("e-margine-top e-margine-bottom"),u=0;u<=n(this.items).length;u++)n(this.items[u]).hasClass("e-select")&&(this.model.headerPosition=="right"&&n(this.items[u]).removeClass("e-margine-top e-margine-bottom"),this.model.headerPosition=="left"&&n(this.items[u]).removeClass("e-margine-top e-margine-bottom"),this.model.headerPosition=="top"&&(this.element.hasClass("e-tab-collapsed")?n(this.items[u]).removeClass("e-margine-top"):n(this.items[u]).addClass("e-margine-top"),n(this.items[u]).removeClass("e-margine-bottom")),this.model.headerPosition=="bottom"&&(n(this.items[u]).removeClass("e-margine-top"),n(this.items[u]).addClass("e-margine-bottom")));n(this.contentPanels[this.selectedItemIndex()]).addClass("e-active-content").removeAttr("aria-hidden",!1)}}this.model.enableTabScroll&&this._tabContentsWidth()>(this.model.width||this.element.width())&&this.itemsContainer.find("li").length&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")?this.model.enableRTL||(r=Number(this.itemsContainer.find("li.e-active").position().left.toFixed(0))+this.itemsContainer.find("li.e-active").width()-t.getDimension(this.element,"width"),r>0&&(Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))+this.itemsContainer.find("li.e-active").width()>t.getDimension(this.element,"width")||Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))-this.itemsContainer.find("li.e-active").width()<0)?(this.itemsContainer.css("clip","rect(0 ,"+(t.getDimension(this.element,"width")+(r+10))+"px, 100px,"+(r+10)+"px)").css("margin-left","-"+(r+10)+"px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-t.getDimension(this.element,"width")+10-r+"px").css("display","block"):"",this._addScrollBackIcon(),this._leftScrollIcon?this._leftScrollIcon.css("display","block").css("margin-left",r+10+"px"):""):r<0&&(Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))+this.itemsContainer.find("li.e-active").width()>t.getDimension(this.element,"width")||Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))-this.itemsContainer.find("li.e-active").width()<0)&&(this.itemsContainer.css("clip","rect(0 ,"+t.getDimension(this.element,"width")+"px, 100px, 0px)").css("margin-left","0px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-t.getDimension(this.element,"width")+20+"px").css("display","block"):"",this._leftScrollIcon?this._leftScrollIcon.css("display","none"):"")):this.model.enableTabScroll&&this.model.height&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&!this.model.enableRTL&&(r=Number(this.itemsContainer.find("li.e-active").position().top.toFixed(0))+this.itemsContainer.find("li.e-active").height()-Number(this.model.height),r>0&&(Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))+this.itemsContainer.find("li.e-active").height()>Number(this.model.height)||Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))-this.itemsContainer.find("li.e-active").height()<0)?(this.itemsContainer.css("clip","rect("+r+"px,"+(this.itemsContainer.outerWidth()+2)+"px, "+(Number(this.model.height)+r)+"px, 0px").css("margin-top","-"+r+"px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-r-22)+"px").css("display","block"):"",this._addScrollBackIcon(),this._leftScrollIcon?this._leftScrollIcon.css("margin-top",Number(this.model.height)+r-10+"px").css("display","block"):""):r<0&&(Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))+this.itemsContainer.find("li.e-active").height()>Number(this.model.height)||Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))-this.itemsContainer.find("li.e-active").height()<0)&&(this.itemsContainer.css("clip","rect(0px ,"+(this.itemsContainer.outerWidth()+2)+"px, "+Number(this.model.height)+"px, 0px").css("margin-top","0px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-22)+"px").css("display","block"):"",this._leftScrollIcon?this._leftScrollIcon.css("display","none").css("margin-top",Number(this.model.height)-10+"px"):""))},hideItem:function(i){if(n(this.contentPanels[i]).fadeOut(0),!(this.model.headerPosition=="left"||this.model.headerPosition=="right"))var r=this.model.headerPosition==t.Tab.Position.Top?"e-activetop":"e-activebottom";n(this.items[i]).removeClass("e-active").addClass("e-select");n(this.contentPanels[i]).removeClass("e-active-content "+r).attr("aria-hidden",!0)},_ajaxLoad:function(){var t=n(this.contentPanels[this.selectedItemIndex()]),i=this.anchors[this.selectedItemIndex()],r=n(i).attr("href");t.is(":empty")&&r.indexOf("#")!==0&&this._sendAjaxOptions(t,i)},_getTabId:function(n){return n.indexOf("#")?this.model.idPrefix+this._getNextTabId():n.replace("#","")},_getNextTabId:function(){return++this.tabId},_disableTabs:function(){for(var t=0,i;i=this.items[t];t++)n.inArray(t,this.model.disabledItemIndex)>-1&&(n(i).find("a").off(this.model.events),n(i).find("div.e-close").off("click")),n(i)[n.inArray(t,this.model.disabledItemIndex)!=-1&&!n(i).hasClass("e-tab-selected")?"addClass":"removeClass"]("e-disable"),n(this.contentPanels[t])[n.inArray(t,this.model.disabledItemIndex)!=-1&&!n(this.contentPanels[t]).hasClass("e-tab-selected")?"addClass":"removeClass"]("e-disable")},_tabItemClick:function(t){if(this.model.enabled){t.preventDefault();var i;this.selectedItemIndex()==n(this.items).index(n(t.currentTarget))&&this.model.collapsible?(i=-1,n(this.element).addClass("e-tab-collapsed")):i=n(this.items).index(n(t.currentTarget));i!=this.selectedItemIndex()&&this.showItem(i);n(this.element).removeClass("e-tab-collapsed")}},_tabDeleteClick:function(t){var u,r,i,f;this.model.enabled&&(u=n(t.target),r=n(t.target).parent().width(),u.hasClass("e-close")&&(i=n(this.items).index(n(t.target).parent())),i==this.selectedItemIndex()&&this.items.length>i&&this.selectedItemIndex(this.selectedItemIndex()+1),f=Number(this.itemsContainer.css("margin-right").split("px")[0])?Number(this.itemsContainer.css("margin-right").split("px")[0]):0,this.model.enableTabScroll&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&(!this.model.enableRTL||this.model.enableRTL&&f<-r?this._executeBackwardScrolling(t,r):(this.itemsContainer.css({"margin-right":"0px",clip:this._initialClip}),this._leftScrollIcon&&this._leftScrollIcon.css("display","none"),this._rightScrollIcon&&this._rightScrollIcon.css("display","none"))),this.removeItem(i))},_tabScrollClick:function(n){this.model.enabled&&this._rightScrollIcon[0]==n.target&&(this._executeForwardScrolling(n),this._addScrollBackIcon(),this._leftScrollIcon.css("display","block"))},_tabSwipe:function(n){n.type=="swipeleft"?this._executeForwardScrolling(n):this._executeBackwardScrolling(n)},_tabScrollBackClick:function(n){this.model.enabled&&this._leftScrollIcon[0]==n.target&&this._executeBackwardScrolling(n)},_tabReloadClick:function(t){var i;if(this.model.enabled&&(i=n(t.target),i.hasClass("e-reload"))){var r=this.anchors[this.selectedItemIndex()],u=n(r).attr("href"),f=n(this.contentPanels[this.selectedItemIndex()]);u.indexOf("#")!==0?this._sendAjaxOptions(f,r):this.showItem(this.selectedItemIndex())}},_sendAjaxOptions:function(t,i){if(this._onBeforeLoad(i))return!0;t.addClass("e-load");var r=this,u=n(i).html(),f=i.href.replace("#",""),e={type:this.model.ajaxSettings.type,cache:this.model.ajaxSettings.cache,url:f,data:this.model.ajaxSettings.data,dataType:this.model.ajaxSettings.dataType,contentType:this.model.ajaxSettings.contentType,async:this.model.ajaxSettings.async,success:function(n){try{r._ajaxSuccessHandler(n,t,i,u)}catch(f){}},error:function(){try{r._ajaxErrorHandler(i,r.selectedItemIndex(),u)}catch(n){}}};this._sendAjaxRequest(e)},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_ajaxSuccessHandler:function(t,i,r,u){u!=null&&n(r).html(u);i.removeClass("e-load");i.html(t).addClass("e-tab-loaded");var f={data:t,url:r,content:i};return this._trigger("ajaxSuccess",f),this._onLoad(r)?!0:void 0},_ajaxErrorHandler:function(n,t){this._trigger("ajaxError",{data:n,url:t});this._onLoad(t)},_createContentPanel:function(t){return n("<div><\/div>").attr("id",t).addClass("e-content e-content-item e-content-bottom e-box")},_refresh:function(){this._unWireEvents();this.itemsContainer.removeAttr("style class");n(this.contentPanels).removeAttr("style class");this.element.css("margin-left","");this._removeVerticalClass();this._removeHeaderClass();this._initialize()},_keyPress:function(i){if(this.model.enabled){var f,r,u=n(i.target);if(code=i.keyCode?i.keyCode:i.which?i.which:i.charCode,u.hasClass("e-link")||u.hasClass("e-item"))switch(code){case 39:case 40:i.preventDefault();this.showItem(this.selectedItemIndex()+1);break;case 37:case 38:i.preventDefault();this.selectedItemIndex()!=0?this.showItem(this.selectedItemIndex()-1):this.selectedItemIndex()==0&&this.showItem(this.getItemsCount()-1);break;case 35:i.preventDefault();this.showItem(this.getItemsCount()-1);break;case 36:i.preventDefault();this.showItem(0);break;case 13:i.preventDefault();this.showItem(this.selectedItemIndex())}else if(i.ctrlKey&&!u.hasClass("e-tab"))switch(code){case 38:i.preventDefault();f=n(this.contentPanels).index(u.parent(".e-content"));r=n(this.items[f]);break;case 33:i.preventDefault();r=n(this.items[0]);this.showItem(0);break;case 34:i.preventDefault();r=n(this._headers[this.getItemsCount()-1]);this.showItem(this.getItemsCount()-1)}t.isNullOrUndefined(r)||(r.addClass("e-focus"),r.focus())}},_hoverHandler:function(t){if(t.preventDefault(),this.model.enabled){var i=n(this.items).index(n(t.target).parent());i==-1&&(i=n(this.items).index(n(t.target)));n(this.items[i]).hasClass("e-disable")||(t.type==="mouseout"?n(this.element.find("div.e-tabdelete")[i]).css("visibility","hidden"):n(this.element.find("div.e-tabdelete")[i]).css("visibility","visible"),t.type==="mouseout"?n(this.element.find("div.e-reload")[i]).css("visibility","hidden"):n(this.element.find("div.e-reload")[i]).css("visibility","visible"));t.type==="mouseout"?n(this.element.find("div.e-chevron-circle-right")).css("visibility","hidden"):n(this.element.find("div.e-chevron-circle-right")).css("visibility","visible");t.type==="mouseout"?n(this.element.find("div.e-chevron-circle-left")).css("visibility","hidden"):n(this.element.find("div.e-chevron-circle-left")).css("visibility","visible")}},_wireEvents:function(t){this._on(this.items,t,this._tabItemClick);this._on(this.itemsContainer,"mouseover",this._hoverHandler);this._on(this.itemsContainer,"mouseout",this._hoverHandler);this._on(this.element.find(">ul").eq(0).find(">li div.e-close"),"click",this._tabDeleteClick);this._on(this.element.find(">ul").eq(0).find("div.e-chevron-circle-left"),"click",this._tabScrollBackClick);this.model.enableTabScroll&&this._on(this.items,"swipeleft swiperight",this._tabSwipe);this._on(this.itemsContainer,"focusin",this._focusIn);this._on(this.itemsContainer,"focusout",this._focusOut);n(window).on("resize",n.proxy(this._resize,this));this._on(this.element.find(">ul").eq(0).find(">li div.e-reload"),"click",this._tabReloadClick)},_resize:function(){this.model&&this.model.width==null&&this.model.enableTabScroll&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&(this._removeScroll(),this._addScroll())},_unWireEvents:function(){this._off(this.items,this.model.events);this._off(this.element.find(">ul").eq(0).find(">li div.e-close"),"click");this._off(this.element.find(">ul").eq(0).find("div.e-chevron-circle-right"),"click");this._off(this.element.find(">ul").eq(0).find("div.e-chevron-circle-left"),"click");this.model.enableTabScroll&&this._off(this.items,"swipeleft swiperight",this._tabSwipe);this._off(this.itemsContainer,"mouseover",this._hoverHandler);this._off(this.itemsContainer,"mouseout",this._hoverHandler);this._off(this.itemsContainer,"focusin",this._focusIn);this._off(this.itemsContainer,"focusout",this._focusOut);this._off(this.element.find(">ul").eq(0).find(">li div.e-reload"),"click");this._resizeEvents()},_resizeEvents:function(t){if(t==="fill")n(window).on("resize",n.proxy(this._windowResized,this));else n(window).off("resize",n.proxy(this._windowResized,this))},_windowResized:function(){var t=this._getDimension(n(this.element).parent(),"height");this._prevSize!=t&&(this._contentPaneSize(),this._prevSize=t,!this.model.width&&this.model.enableTabScroll&&this._addScroll())},_contentPaneSize:function(){var i,r,t;for(this.model.height!=null&&this.model.heightAdjustMode=="none"?(n(this.element).height(this.model.height),i=this._getDimension(n(this.element),"height")):i=this._getDimension(n(this.element).parent(),"height"),n(this.contentPanels).height(""),n(this.element).parent().css({overflow:"auto"}),(this.model.headerPosition==="top"||this.model.headerPosition==="bottom")&&(i-=this._getDimension(n(this.itemsContainer),"outerHeight")),r=0,t=0;t<this.contentPanels.length;t++)n(this.contentPanels[t]).hasClass("e-active-content")?(padding=Math.max(r,this._getDimension(n(this.contentPanels[t]),"outerHeight")-this._getDimension(n(this.contentPanels[t]),"height")),this.model.height!=null&&this.model.heightAdjustMode=="none"?n(this.contentPanels[t]).outerHeight(i).css({overflow:"auto"}):n(this.contentPanels[t]).height(i-padding).css({overflow:"auto"})):(r=Math.max(r,this._getDimension(n(this.contentPanels[t]),"outerHeight")-this._getDimension(n(this.contentPanels[t]),"height")),this.model.height!=null&&this.model.heightAdjustMode=="none"?n(this.contentPanels[t]).outerHeight(i).css({overflow:"auto"}):n(this.contentPanels[t]).height(i-r).css({overflow:"auto"}))},_disableItems:function(t){if(!this.model.enabled)return!1;if(t!=null){for(var i=0;i<t.length;i++)n.inArray(t[i],this.model.disabledItemIndex)==-1&&this.model.disabledItemIndex.push(t[i]);this.model.disabledItemIndex.sort();this._disableTabs()}},_enableItems:function(t){var i,r;if(!this.model.enabled)return!1;for(i=0;i<t.length;i++)r=t[i],this.model.disabledItemIndex=n.grep(this.model.disabledItemIndex,function(n){return n!=r});this._disableTabs()},disable:function(){for(var t=[],n=0;n<this.getItemsCount();n++)t.push(n);this._disableItems(t);this.model.enabledItemIndex=[];this._unWireEvents()},enable:function(){for(var i=[],t=0;t<this.getItemsCount();t++)n.inArray(t,this.model.enabledItemIndex)<0&&(this.model.enabledItemIndex.push(t),i.push(t)),this._enableItems(t);this.model.disabledItemIndex=[]},getItemsCount:function(){if(this.items)return this.items.length},addItem:function(r,u,f,e,o){var h,s,a,c,l,v,y,p;for(this._addItemIndex=f>=0&&f<this.items.length?f:this.items.length,h=0;h<this.model.disabledItemIndex.length;h++)this.model.disabledItemIndex[h]>=f&&this.model.disabledItemIndex[h]++;this.model.headerPosition=="left"?this.items.length>=0&&this.itemsContainer.addClass("e-left"):this.model.headerPosition=="right"?this.items.length>=0&&this.itemsContainer.addClass("e-right"):this.items.length==0&&this.itemsContainer.addClass("e-header");s=t.buildTag("li.e-select e-item");this.model.headerPosition=="top"&&(this.model.enableRTL?n(s).addClass("e-rtl-top-line e-top-hover"):n(s).addClass("e-bottom-line"));t.isNullOrUndefined(e)||(a=t.buildTag("span").addClass(e),s.append(a));f===i&&u===i&&r!=null&&(u="Item");f===i&&u===i&&o===i&&(r="#Item"+this.items.length,u="Item");o!=i?(o.indexOf("#")!=0&&(o="#"+o),this.divId=o):r!=i&&(o=r);c=t.buildTag("a",u,{},{href:r});(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&c.appendTo(s);this.model.showCloseButton&&(l=t.buildTag("div.e-icon e-close e-tabdelete","",{},{}).css("visibility","hidden"),s.append(l),this._on(l,"click",this._tabDeleteClick));(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&c.appendTo(s);f===i&&(f=this.anchors.length);v=f>=this.items.length;v?s.appendTo(this.itemsContainer):s.insertBefore(this.items[f]);t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize(this.model.headerSize);this.selectedItemIndex()==f?(this.hideItem[f],this.selectedItemIndex(this.selectedItemIndex()+1)):(this.hideItem[f],f<this.selectedItemIndex()&&this.selectedItemIndex(this.selectedItemIndex()+1));this._itemsRefreshing();this._reinitialize(!0);this.model.headerPosition=="top"&&n(this.contentPanels[f]).addClass("e-hidebottom");this.model.headerPosition=="bottom"&&(n(this.contentPanels[f]).addClass("e-hidetop"),s.addClass("e-top-line e-item e-select e-margine-bottom"));this.model.headerPosition=="left"&&n(this.contentPanels[f]).addClass("e-hideleft");this.model.headerPosition=="right"&&n(this.contentPanels[f]).addClass("e-hideright");y={tabHeader:this.anchors[f],tabContent:this.contentPanels[f]};this.refreshTabScroll();this._addItemIndex=null;this._onAdd(y);this.model.showReloadIcon&&(p=t.buildTag("div.e-icon e-reload","",{},{role:"presentation"}).css("visibility","hidden"),n(this.element.find("li")[f]).append(p));this.model.enableTabScroll&&this.model.headerPosition=="right"&&n(this.contentPanels).css("height",this.model.height+"px")},_isSizeExceeded:function(){for(var r,u=this.element.width(),i=0,f=this.items.length,t=0;t<f;t++)r=n(this.items[t]).width(),i+=r;return i>u?!0:!1},refreshTabScroll:function(){this._isSizeExceeded()?(this.element.find("div.e-chevron-circle-right").length>=1&&this.element.find("div.e-chevron-circle-right").remove(),this.model.enableTabScroll&&(this._checkScroll(),this._addScrollIcon())):(this.model.headerPosition=="left"||this.model.headerPosition=="right"&&this._tabContentsHeight()>(this.element.width()||Number(this.model.height))||this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this._checkScroll()},removeItem:function(t){var i,r;if(!this.model.enabled)return!1;if(t!=null&&t>-1&&t<this.items.length){if(this._onBrforeRemove({index:t})===!0)return!1;for(i=n(this.items[t]).remove(),this.model.disabledItemIndex=[],i.hasClass("e-active")&&(t==0?this.selectedItemIndex(t+1):this.selectedItemIndex(t-1),this.showItem(this.selectedItemIndex())),n(this.element.find(">div.e-content")[t]).remove(),this.contentPanels.splice(t,1),t<this.selectedItemIndex()?this.selectedItemIndex(this.selectedItemIndex()-1):this.selectedItemIndex(),(t<0||t>=this.anchors.length)&&this.selectedItemIndex(0),(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&this.items.length==1?this._removeVerticalClass():this.items.length==1&&this.itemsContainer.removeClass("e-header"),this._unWireEvents(),this._itemsRefreshing(),this._wireEvents(this.model.events),this.model.enableTabScroll&&this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick),indx=0;indx<this.items.length;indx++)n(this.items[indx]).hasClass("e-disable")&&this.model.disabledItemIndex.push(indx);this._disableTabs();r={removedTab:i};this._onRemove(r)}this.getItemsCount()==0&&(this.itemsContainer.removeAttr("style"),this.itemsContainer.find("div").remove());this._tabContentsHeight()<Number(this.model.height)&&this.itemsContainer.css("clip").split("px").length&&this.model.enableTabScroll&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")?(this._refresh(),this.itemsContainer.removeAttr("style"),this._leftScrollIcon?this._leftScrollIcon.remove():"",this._rightScrollIcon?this._rightScrollIcon.remove():""):this.model.enableTabScroll&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&(this._leftScrollIcon&&Number(this.itemsContainer.css("clip").split("px")[0].replace(",","").split("(")[1])!=-Number(this._leftScrollIcon.css("margin-top").split("px")[0])?(this._removeScroll(),this._addScroll()):this.refreshTabScroll(),this.showItem(this.selectedItemIndex()))},show:function(){if(!this.model.enabled)return!1;this.element.css("visibility","visible")},hide:function(){if(!this.model.enabled)return!1;this.element.css("visibility","hidden")},_onBeforeLoad:function(n){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,url:n,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),url:n,isInteraction:this._isInteraction},this._trigger("ajaxBeforeLoad",t)},_focusIn:function(){if(!this.model.readOnly&&this.model.allowKeyboardNavigation)n(this.element).on("keydown",n.proxy(this._keyPress,this))},_focusOut:function(){n(this.element).off("keydown",n.proxy(this._keyPress,this))},_onLoad:function(n){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,url:n,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),url:n,isInteraction:this._isInteraction},this._trigger("ajaxLoad",t)},_onActive:function(){var n;return n=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),isInteraction:this._isInteraction},this._isInteraction=!0,this._trigger("itemActive",n)},_onBeforeActive:function(n){if(this.model.beforeActive!=null){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabSelectedIndex],prevActiveIndex:this._preTabSelectedIndex,activeHeader:null,activeIndex:null,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabSelectedIndex],prevActiveIndex:this._preTabSelectedIndex,activeHeader:this.items[n],activeIndex:n,isInteraction:this._isInteraction},this._trigger("beforeActive",t)}},_onAdd:function(n){return this._trigger("itemAdd",n)},_onRemove:function(n){return this._trigger("itemRemove",n)},_onBrforeRemove:function(n){return this._trigger("beforeItemRemove",n)}});t.Tab.HeightAdjustMode={Content:"content",Auto:"auto",Fill:"fill",None:"none"};t.Tab.Position={Top:"top",Bottom:"bottom",Left:"left",Right:"right"}}(jQuery,Syncfusion),function(n,t){t.widget("ejTagCloud","ej.TagCloud",{element:null,model:null,validTags:["div","span"],_rootCSS:"e-tagcloud",_setFirst:!1,defaults:{cssClass:"",htmlAttributes:{},dataSource:null,query:null,fields:{text:"text",url:"url",frequency:"frequency",htmlAttributes:"htmlAttributes"},showTitle:!0,titleText:"Title",titleImage:null,format:"cloud",enableRTL:!1,minFontSize:"10px",maxFontSize:"40px",mouseover:null,mouseout:null,click:null,create:null,destroy:null},dataTypes:{cssClass:"string",showTitle:"boolean",titleText:"string",titleImage:"string",format:"enum",enableRTL:"boolean",dataSource:"data",query:"data",fields:"data",htmlAttributes:"data"},_init:function(){this._initialize();this._render()},_setModel:function(n){for(var t in n)switch(t){case"fields":case"query":case"dataSource":case"minFontSize":case"maxFontSize":this._refreshTagItems(t,n[t]);break;case"showTitle":this._showTitle(n[t]);break;case"titleText":this._title(n[t]);break;case"titleImage":this._titleImage(n[t]);break;case"cssClass":this._changeSkin(n[t]);break;case"format":this._format(n[t]);break;case"enableRTL":this._rtl(n[t]);break;case"htmlAttributes":this._addAttr(n[t])}},_refreshTagItems:function(n,t){this.model[n]=t;this.ul.empty();this._checkDataBinding()},_showTitle:function(n){n?(this._generateTitle(),this.ul.removeClass("e-notitle")):(this.titleText.remove(),this.ul.addClass("e-notitle"),this.titleText=null)},_title:function(n){this.titleText&&(n?this.text?this.text.html(n):this._generateTextTag(n):this.text&&(this.text.remove(),this.text=null))},_titleImage:function(n){this.titleText&&(n?this.image?this.image.attr("src",n):this._generateImageTag(n):this.image&&(this.image.remove(),this.image=null))},_changeSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},insert:function(t){n.trim(t.text)&&this.ul.append(this._generateLi(t,this._getMapper()))},insertAt:function(t,i){n.trim(t.text)&&n(this.ul.children()[i-1]).before(this._generateLi(t,this._getMapper()))},remove:function(t){for(var u=this.ul.children(),r,i=0;i<u.length;i++)r=n(u[i]),r.children()[0].innerHTML==t&&r.remove()},removeAt:function(t){var i=this.ul.children();n(i[t-1]).remove()},_format:function(n){n=="cloud"?(this.ul.removeClass("e-list"),this.ul.addClass("e-cloud")):n=="list"&&(this.ul.removeClass("e-cloud"),this.ul.addClass("e-list"))},_destroy:function(){this.element.removeClass("e-widget "+this.model.cssClass);this.element.empty()},_initialize:function(){this.minFreq=0;this.maxFreq=30;this.ul=null;this.titleText=null;this.image=null;this.text=null},_render:function(){this.element.addClass("e-widget "+this.model.cssClass);this.model.showTitle&&this._generateTitle();this._renderWrapper();this._checkDataBinding();this._addAttr(this.model.htmlAttributes);this._checkProperties()},_generateTitle:function(){this.titleText=t.buildTag("div.e-header e-title");this.model.titleImage&&this._generateImageTag(this.model.titleImage);this.model.titleText&&this._generateTextTag(this.model.titleText);this.ul?this.titleText.insertBefore(this.ul):this.element.append(this.titleText)},_generateImageTag:function(t){this.image||(this.image=n('<img class="e-title-img" src="'+t+'" />'));this.text&&!this.model.titleImage?this.image.insertBefore(this.text):this.titleText.append(this.image)},_generateTextTag:function(n){this.text||(this.text=t.buildTag("span",n));this.titleText.append(this.text)},_renderWrapper:function(){var n;n=this.model.format=="list"?"list":"cloud";this.ul=t.buildTag("ul.e-ul e-box e-"+n);this.element.append(this.ul);this.model.showTitle||this.ul.addClass("e-notitle")},_renderItems:function(n){this._generateTagItems(n);this.ul.removeClass("e-load")},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n)})},_checkProperties:function(){this.model.enableRTL&&this._rtl(this.model.enableRTL)},_rtl:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_checkDataBinding:function(){var n=this.model.dataSource;n!=null&&(this.ul.addClass("e-load"),t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._renderItems(n))},_initDataSource:function(n){var t=this,i=n.executeQuery(this._getQuery());i.done(function(n){t._renderItems(n.result)}).fail(function(){t.ul.removeClass("e-load")})},_setAttributes:function(n,t){if(n)for(var i in n)i=="class"?t.addClass(n[i]):t.attr(i,(i=="style"?t.attr("style")+";":"")+n[i])},_getQuery:function(){var r;if(t.isNullOrUndefined(this.model.query)){var u=[],i=t.Query(),n=this.model.fields;for(r in n)r!=="tableName"&&n[r]&&u.push(n[r]);u.length>0&&i.select(u);this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query;return i},_generateTagItems:function(t){var i,r=this._getMapper(),u=function(n){return n[r._freq]},f=t.map?t.map(u):n.map(t,u);for(this.minFreq=Math.min.apply(Math,f),this.maxFreq=Math.max.apply(Math,f),i=0;i<t.length;i++)this.ul.append(this._generateLi(t[i],r))},_getMapper:function(){var n=this.model.fields,t={_text:null,_freq:null,_url:null};return t._text=n&&n.text?n.text:"text",t._freq=n&&n.frequency?n.frequency:"frequency",t._url=n&&n.url?n.url:"url",t._attr=n&&n.htmlAttributes?n.htmlAttributes:"htmlAttributes",t},_generateLi:function(n,i){var u=t.buildTag("li.e-tagitems"),r;return r=t.buildTag("a.e-txt",n[i._text]||n[i._url],{"font-size":this._calculateFontSize(n[i._freq])},{role:"link"}),n[i._url]&&r.attr({href:n[i._url],target:"blank"}),this._setAttributes(n[i._attr],r),u.append(r),this._on(r,"mouseenter",this._mouseEnter),this._on(r,"mouseleave",this._mouseLeave),this._on(r,"click",this._mouseClick),u},_mouseEnter:function(t){n(t.target).addClass("hover");this._raiseEvent(t,"mouseover")},_mouseLeave:function(t){n(t.target).removeClass("hover");this._raiseEvent(t,"mouseout")},_mouseClick:function(t){n(t.target).removeClass("hover");this._raiseEvent(t,"click")},_raiseEvent:function(t,i){this._trigger(i,{value:n(t.target).html(),url:n(t.target).attr("href"),eventType:i,target:n(t.target)})},_calculateFontSize:function(n){if(n){var t=2,i,r,u=parseInt(this.model.minFontSize,10),f=parseInt(this.model.maxFontSize,10);return i=(n-this.minFreq)/(this.maxFreq-this.minFreq),r=f-u,u+t*Math.floor(i*(r/t))}return this.model.minFontSize}});t.Format={Cloud:"cloud",List:"list"}}(jQuery,Syncfusion),function(n,t){t.widget("ejTileBase","ej.TileBase",{defaults:{badge:{enabled:!1,value:1,text:null,maxValue:100,minValue:1,position:"bottomright"},caption:{enabled:!0,text:"text",icon:null,position:"innerbottom",alignment:"normal"},enablePersistence:!1,imageClass:null,imagePosition:"center",imageTemplateId:null,imageUrl:null,liveTile:{text:null,enabled:!1,imageClass:null,imageTemplateId:null,imageUrl:null,type:"flip",updateInterval:2e3},cssClass:"",tileSize:"small",width:null,height:null,showRoundedCorner:!1,backgroundColor:null,allowSelection:!1,locale:"en-US",showText:!0,text:"text",textAlignment:"normal"},dataTypes:{imagePosition:"enum",liveTile:{text:"array",type:"enum",enabled:"boolean",updateInterval:"number",imageUrl:"array",imageClass:"array",imageTemplateId:"array"},alignment:"enum",tileSize:"enum",locale:"string"},observables:["badge.value","badge.enabled","badge.text","badge.position","text","caption.text"],_badgeValue:t.util.valueFunction("badge.value"),_badgeEnabled:t.util.valueFunction("badge.enabled"),_badgeText:t.util.valueFunction("badge.text"),_badgePosition:t.util.valueFunction("badge.position"),_captionText:t.util.valueFunction("caption.text"),text:t.util.valueFunction("text"),_setDeprecatedProperties:function(){this.model.caption.enabled=this.defaults.caption.enabled==this.model.caption.enabled&&this.defaults.showText==this.model.showText?this.defaults.caption.enabled:this.model.caption.enabled!=this.defaults.caption.enabled?this.model.caption.enabled:this.model.showText;this._captionText(this.defaults.caption.text==this._captionText()&&this.defaults.text==this.text()?this.defaults.caption.text:this._captionText()!=this.defaults.caption.text?this._captionText():this.text());this.model.caption.alignment=this.defaults.caption.alignment==this.model.caption.alignment&&this.defaults.textAlignment==this.model.textAlignment?this.defaults.caption.alignment:this.model.caption.alignment!=this.defaults.caption.alignment?this.model.caption.alignment:this.model.textAlignment},_tileRender:function(){var f,r,u,i,e;if(this._setDeprecatedProperties(),this._imagePosition=this.model.imagePosition,this._cssClass=this.model.cssClass,this.element.addClass(this.model.cssClass+" "+this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"tile-"+this.model.tileSize),this.model.showRoundedCorner&&this.element.addClass(this._prefix+"tile-round-corner"),this._isLiveTile()?this._liveTile():(this._image=t.buildTag("div").addClass(this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"image-parent"),this._innerImage=t.buildTag("span").addClass(this._prefix+"tile-image "+this._prefix+"tile-image"+this.model.imagePosition),this.model.imageTemplateId?(f=this._isMobile()?t.getCurrentPage().find("#"+this.model.imageTemplateId):n("#"+this.model.imageTemplateId),this._innerImage.addClass(this._prefix+"tile-template").append(f)):this.model.imageClass?this._innerImage.addClass(this.model.imageClass):this.model.imageUrl&&(r=this._isMobile()&&this.model.imagePath?this._getAbsolutePath(this.model.imagePath)+"/"+this.model.renderMode.toLowerCase()+"/"+this.model.imageUrl:this._getAbsolutePath(this.model.imageUrl),this._innerImage.css({"background-image":"url('"+r+"')"}),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&this.model.imagePosition=="fill"&&this._innerImage.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+r+"',sizingMethod='scale')","-ms-filter":"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+r+"',sizingMethod='scale')"})),this._image.append(this._innerImage),this.element.append(this._image),this._setBackgroundColor(this.model.backgroundColor),this.model.imageTemplateId&&this._prefix=="e-m-"&&t.angular.defaultAppName&&t.angular.compile(this._image)),this._isCaptionEnable())if(this.model.liveTile.text&&this._isLiveTile())for(u=this.element.find("."+this._prefix+"image-parent"),i=0,e=u.length;i<e;i++)this._setCaptionClass(n(u[i])),n(u[i]).addClass(this._prefix+"tile-caption-text ").attr("text",this.model.liveTile.text[i]);else this._setCaptionClass(this.element),this.model.caption.icon?(this._captionIcon=this.model.caption.icon,this.element.addClass(this._prefix+"tile-caption-icon "+this._prefix+"icon-"+this._captionIcon)):this.element.addClass(this._prefix+"tile-caption-text ").attr("text",this._captionText());this._badgeEnabled()&&this._setBadgeEnabled();this._selectElement=t.buildTag("span."+this._prefix+"tile-overlay");this.element.append(this._selectElement);this.model.height||(this.model.height=this.model.caption.position=="outer"?this.element.height()-50:this.element.height());this.model.width||(this.model.width=this.element.width());this._isCustomizeSize()&&this._setCustomizSize()},_liveTile:function(){var r,e,o,u,i,s,f;if(this.element.addClass(this._prefix+"livetile-enable"),this.model.liveTile.imageTemplateId)for(i=0;i<this.model.liveTile.imageTemplateId.length;i++)e=t.buildTag("div").addClass(this._prefix+"tile-template "+this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"image-parent "+this._prefix+"tile-"+this.model.liveTile.type),o=this._isMobile()?t.getCurrentPage().find("#"+this.model.liveTile.imageTemplateId[i]):n("#"+this.model.liveTile.imageTemplateId[i]),this.element.append(e.append(o));else if(this.model.liveTile.imageClass)for(i=0;i<this.model.liveTile.imageClass.length;i++)r=t.buildTag("span").addClass(this.model.liveTile.imageClass[i]+" "+this._prefix+"tile-image "+this._prefix+"tile-image"+this.model.imagePosition),u=t.buildTag("div").addClass(this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"tile-"+this.model.liveTile.type+" "+this._prefix+"image-parent"),r.appendTo(u),this.element.append(u);else for(i=0;i<this.model.liveTile.imageUrl.length;i++)s=this._isMobile()&&this.model.imagePath?this._getAbsolutePath(this.model.imagePath)+"/windows/"+this.model.liveTile.imageUrl[i]:this._getAbsolutePath(this.model.liveTile.imageUrl[i]),r=t.buildTag("span").addClass(this._prefix+"tile-image "+this._prefix+"tile-image"+this.model.imagePosition).css({"background-image":"url('"+s+"')"}),f=t.buildTag("div."+this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"tile-"+this.model.liveTile.type+" "+this._prefix+"image-parent"),r.appendTo(f),this.element.append(f);this._setBackgroundColor(this.model.backgroundColor);n(this.element.children()[0]).addClass(this._prefix+"tile-"+this.model.liveTile.type+"back").removeClass(this._prefix+"tile-"+this.model.liveTile.type);this.model.imageTemplateId&&this._prefix=="e-m-"&&(App.angularAppName||t.angular.defaultAppName)&&t.angular.compile(this.element)},_setCustomizSize:function(){var i=(this._isLiveTileMode()||this.model.renderMode=="flat")&&parseInt(this.model.width)<=70?"70":this._isMobile()&&this.model.renderMode=="android"&&this._isBelowSmallSize()?"85":this._isMobile()&&this.model.renderMode=="ios7"&&this._isBelowSmallSize()?"74":this.model.width,n=(this._isLiveTileMode()||this.model.renderMode=="flat")&&parseInt(this.model.height)<=70?"70":this._isMobile()&&(this.model.renderMode=="android"||this.model.renderMode=="ios7")&&this._isBelowSmallSize()?"70":this._isMobile()&&this.model.renderMode=="ios7"&&this._isBelowSmallSize()?"70":this.model.height,t=(this._isLiveTileMode()||this.model.renderMode=="flat")&&!this._isBelowSmallSize()?50:(this._isLiveTileMode()||this.model.renderMode=="flat")&&this._isBelowSmallSize()?0:this._isMobile()&&this.model.renderMode=="android"&&this._isBelowSmallSize()?30:30,r=this.model.caption.enabled&&this.model.caption.position=="outer"&&this.model.height?n?parseInt(n)+t:parseInt(n)+t:this.model.height;this.element.css({width:this.model.width?this.model.width:"70",height:this.model.height?r:this.element.height()+t});this.element.find("."+this._prefix+"image-parent").css({width:this.element.css("width"),height:this.model.height?n:this.element.height()-t});!this._isBelowSmallSize()&&this.model.caption.enabled&&this.model.caption.position=="outer"&&(this.element.find(".e-m-tile-image").css({width:this.model.width?i:"",height:this.model.height?n:""}),this._selectElement.css({width:this.model.width?i:"",height:this.model.height?n:""}));this._isBelowSmallSize()&&(this.element.addClass(this._prefix+"tile-small"),this._isMobile()&&(this.model.renderMode=="android"||this.model.renderMode=="ios7")&&this.model.caption.position=="outer"||this.element.removeAttr("text"))},_isLiveTile:function(){return this._isLiveTileMode()&&this.model.liveTile.enabled},_isLiveTileMode:function(){return!this._isMobile()||this.model.renderMode=="windows"},_setCaptionClass:function(n){n.addClass(this._prefix+"tile-caption "+this._prefix+"caption-"+this.model.caption.position+" "+this._prefix+"caption-align-"+this.model.caption.alignment)},_isCaptionEnable:function(){return this.model.caption.enabled&&!(this.model.tileSize=="small"||this._isBelowSmallSize()&&this.model.tileSize=="small")||this._isMobile()&&(this.model.renderMode=="ios7"||this.model.renderMode=="android")&&this.model.caption.position=="outer"||this._isMobile()&&(this.model.renderMode=="android"||this.model.renderMode=="ios7")&&this.model.caption.position=="outer"&&this._isCustomizeSize()&&this._isBelowSmallSize()},_isBelowSmallSize:function(){var n=this.model.width?parseInt(this.model.width):this.model.width,t=this.model.height?parseInt(this.model.height):this.model.height,i=!this._isMobile()||this._isMobile()&&(this.model.renderMode=="windows"||this.model.renderMode=="flat")?70:this._isMobile()&&this.model.renderMode=="android"?85:74;return n<=i&&n!=null||t<=i&&t!=null},_isCustomizeSize:function(){return this.model.height||this.model.width},_createDelegates:function(){this._onStartDelegate=n.proxy(this._isMobile()?this._onTouchStartHandler:this._onMouseDownHandler,this);this._onEndDelegate=n.proxy(this._isMobile()?this._onTouchEndHandler:this._onMouseUpHandler,this);this._onMoveDelegate=n.proxy(this._isMobile()?this._onTouchMoveHandler:this._onMouseMoveHandler,this);this._onDocClickDelegate=n.proxy(this._onDocClickHandler,this);this._startAnimationDelegate=n.proxy(this["_"+this.model.liveTile.type+"Tile"],this)},_wireEvents:function(i){this._createDelegates();t.listenEvents([this.element,n(document)],[t.startEvent(),t.endEvent()],[this._onStartDelegate,this._onDocClickDelegate],i,this);this._isLiveTile()&&(i?this._stopTileAnimation():this._startTileAnimation())},_onDocClickHandler:function(){this._removeActiveClass()},_removeActiveClass:function(){this._isLiveTileMode()?t._removeSkewClass(this.element):n(this.element).removeClass(this._prefix+"state-active")},_startTileAnimation:function(){this._intervalCounter=setInterval(this._startAnimationDelegate,this.model.liveTile.updateInterval)},_stopTileAnimation:function(){clearInterval(this._intervalCounter)},_flipTile:function(){var n=this.element.find("."+this._prefix+"tile-flipback"),t=this.element.find("."+this._prefix+"tile-flip").first();n.addClass(this._prefix+"tile-flip").removeClass(this._prefix+"tile-flipback");t.addClass(this._prefix+"tile-flipback").removeClass(this._prefix+"tile-flip")},_slideTile:function(){this._animateEffect()},_carouselTile:function(){this._animateEffect()},_animateEffect:function(){var i=this.model.liveTile.type.toLowerCase(),r=this.element.find("."+this._prefix+"image-parent"),t=this.element.find("."+this._prefix+"tile-"+i+"back"),e=t.next()[0]==null?r.first():t.next(),o=t.prev()[0]==null?r.last():t.prev(),u,f;(n(t.next()[0]).hasClass(this._prefix+"tile-overlay")||n(t.prev()[0]).hasClass(this._prefix+"tile-overlay"))&&(u=n(t.next()[0]).next(),f=n(t.next()[0]).prev(),e=u.next()[0]==null?r.first():u.next(),o=f.prev()[0]==null?r.last():f.prev());o.addClass(this._prefix+"tile-"+i).removeClass(this._prefix+"tile-"+i+"up");t.addClass(this._prefix+"tile-"+i+"up").removeClass(this._prefix+"tile-"+i+"back");e.removeClass(this._prefix+"tile-"+i).addClass(this._prefix+"tile-"+i+"back")},_getAbsolutePath:function(n){return this._isMobile()?this._makeUrlAbsolute(n).toString():n},_makeUrlAbsolute:function(i){var r=n("<a href ='"+i+"'><\/a>")[0],u;n("body").append(r);u=r.pathname.indexOf("/")!=0?"/"+r.pathname:r.pathname;var f=t.browserInfo(),e=f.name=="msie"&&f.version=="9.0",o=r.protocol+"//"+(e&&r.port=="80"?r.host.replace(":80",""):r.host)+u+r.search+r.hash;return n(r).remove(),o},_isMobile:function(){return this._prefix=="e-m-"?!0:!1},updateTemplate:function(i,r){var u,f;this._isLiveTile()?(n(this.element.children()[r]).empty(),u=this._isMobile()?t.getCurrentPage().find("#"+i):n("#"+i),n(this.element.children()[r]).append(u)):(f=this._isMobile()?t.getCurrentPage().find("#"+i):n("#"+i),this._image.addClass(this._prefix+"tile-template").empty().append(f))},_setModel:function(n){var u=!1,i,r;for(i in n)if(r="_set"+i.charAt(0).toUpperCase()+i.slice(1),this[r]||i=="locale")switch(i){case"text":this[r](t.util.getVal(n[i]));n[i]=this.text(t.util.getVal(n[i]));t.isNullOrUndefined(this._options)&&(this._options={});this._options.caption=this.model.caption;break;case"locale":t.Tile.Locale[n[i]]&&(this.model.locale=n[i],this._setCulture(),this._setCaptionText(this._captionText()));break;default:this[r](n[i])}else u=!0;u&&this._refresh()},_setCaption:function(n){var u=!1,i,r;for(i in n)if(r="_setCaption"+i.charAt(0).toUpperCase()+i.slice(1),this[r])switch(i){case"text":this[r](t.util.getVal(n[i]));n[i]=this._captionText(t.util.getVal(n[i]));break;default:this[r](n[i])}else u=!0;u&&this._refresh()},_setText:function(n){this._captionText(n);this._setCaptionText(n)},_setCaptionText:function(n){this._isCaptionEnable()?this.element.attr("text",n):this.element.removeAttr("text")},_setCaptionEnabled:function(){this._isCaptionEnable()?this.element.attr("text",this._captionText()):this.element.removeAttr("text")},_setCaptionIcon:function(n){this._isCaptionEnable()&&(this.element.removeClass(this._prefix+"caption-text "+this._prefix+"icon-"+this._captionIcon).addClass(this._prefix+"caption-icon "+this._prefix+"icon-"+n).removeAttr("text"),this._captionIcon=n)},_setCaptionAlignment:function(n){this._isCaptionEnable()&&this.element.removeClass(this._prefix+"caption-align-normal "+this._prefix+"caption-align-left "+this._prefix+"caption-align-center "+this._prefix+"caption-align-right").addClass(this._prefix+"caption-align-"+n)},_setShowRoundedCorner:function(n){n?this.element.addClass(this._prefix+"tile-round-corner"):this.element.removeClass(this._prefix+"tile-round-corner")},_setCssClass:function(n){this.element.removeClass(this._cssClass).addClass(n);this._cssClass=n},_setBackgroundColor:function(n){!this._isMobile()||this._isMobile()&&this.model.renderMode=="windows"||this.model.caption.position=="outer"?this.element.find("."+this._prefix+"tile-image").css("background-color",n):this.element.css("background-color",n)},_setTileSize:function(n){this._isCaptionEnable()?this._isCaptionEnable()&&this.element.attr("text",this._captionText()):this.element.removeAttr("text");this.element.css({width:"",height:""});this.element.find("."+this._prefix+"image-parent").css({width:"",height:""});this.element.removeClass(this._prefix+"tile-small "+this._prefix+"tile-medium "+this._prefix+"tile-wide "+this._prefix+"tile-large").addClass(this._prefix+"tile-"+n);this.model.height=this.element.height();this.model.width=this.element.width()},_setImagePosition:function(t){this.element.removeClass(this._prefix+"tile-image"+this._imagePosition).addClass(this._prefix+"tile-image"+t);n(this.element.find("."+this._prefix+"tile-image")).removeClass(this._prefix+"tile-image"+this._imagePosition).addClass(this._prefix+"tile-image"+t);this._imagePosition=this.model.imagePosition},_setBadge:function(n){var i,r;for(i in n)if(r="_setBadge"+i.charAt(0).toUpperCase()+i.slice(1),this[r])switch(i){case"value":case"enabled":case"text":this[r](t.util.getVal(n[i]));typeof n[i]=="function"?n[i](this["_badge"+i.charAt(0).toUpperCase()+i.slice(1)]()):n[i]=this["_badge"+i.charAt(0).toUpperCase()+i.slice(1)]();break;default:this[r](n[i])}},_setBadgeValue:function(n){if(this._badgeEnabled()){n=t.isNullOrUndefined(n)?this._badgeValue():n;var i;this._badgeText()?i=this._badgeText():n<=this.model.badge.maxValue&&n>=this.model.badge.minValue?(i=n.toString(),this._badgeValue(n)):n>this.model.badge.maxValue?(i=this.model.badge.maxValue.toString()+"+",this._badgeValue(this.model.badge.maxValue)):(i=this.model.badge.minValue.toString(),this._badgeValue(this.model.badge.minValue));this.element.addClass(this._prefix+"tile-badge "+this._prefix+"badge-position-"+this._badgePosition());this.element.addClass(this._prefix+"tile-badge-value").attr("badgeValue",i)}else this.element.removeClass(this._prefix+"tile-badge "+this._prefix+"badge-position-"+this._badgePosition()+" "+this._prefix+"tile-badge-value")},_setBadgePosition:function(n){this._badgePosition(n);this._badgeEnabled()&&this.element.removeClass(this._prefix+"badge-position-bottomright "+this._prefix+"badge-position-topright").addClass(this._prefix+"badge-position-"+this._badgePosition())},_setBadgeEnabled:function(n){this._badgeEnabled(n);this._setBadgeValue()},_setBadgeMaxValue:function(n){this.model.badge.maxValue=n;this._setBadgeValue()},_setBadgeMinValue:function(n){this.model.badge.minValue=n;this._badgeEnabled()&&this._setBadgeValue()},_setBadgeText:function(n){this._badgeText(n);this._badgeEnabled()&&this._setBadgeValue()},_clearElement:function(){this.element.removeAttr("class");this.element.html(this._orgEle.html())},_destroy:function(){this._wireEvents(!0);this._clearElement()}})}(jQuery,Syncfusion),function(n,t){t.widget("ejTile","ej.Tile",{_setFirst:!0,validTags:["div"],_rootCSS:"e-tile",defaults:{mouseDown:null,mouseUp:null},_init:function(n){this._options=n;this._setCulture();this._orgEle=this.element.clone();this._liveTileimageTemplateParent=[];this._cloneLiveTileImageTemplateElement=[];this._renderEJControl()},_renderEJControl:function(){if(this.model.captionTemplateId&&(this._captionTemplateParent=n("#"+this.model.captionTemplateId).parent(),this._cloneCaptionTemplateElement=n("#"+this.model.captionTemplateId).clone()),this.model.imageTemplateId&&(this._imageTemplateParent=n("#"+this.model.imageTemplateId).parent(),this._cloneImageTemplateElement=n("#"+this.model.imageTemplateId).clone()),this.model.liveTile.enabled&&this.model.liveTile.imageTemplateId)for(i=0;i<this.model.liveTile.imageTemplateId.length;i++)this._liveTileimageTemplateParent[i]=n("#"+this.model.liveTile.imageTemplateId[i]).parent(),this._cloneLiveTileImageTemplateElement[i]=n("#"+this.model.liveTile.imageTemplateId[i]).clone();this.element.addClass("e-tile-web");this._prefix="e-";this._tileRender();this._wireEvents()},_onMouseDownHandler:function(i){var r=this.element;r.addClass(t._getSkewClass(r,i.pageX,i.pageY).replace("e-m-","e-"));this._trigger("mouseDown",{text:r.attr("text"),index:n(i.target).index()});t.listenTouchEvent(this.element,t.moveEvent(),this._onMoveDelegate,!1,this);t.listenTouchEvent(this.element,t.endEvent(),this._onEndDelegate,!1,this);this._isMoved=!1},_onMouseMoveHandler:function(){this._isMoved=!0;this._removeActiveClass()},_onMouseUpHandler:function(i){this.model.allowSelection&&(this._selected?this._selected&&(this._selected=!1,this._selectElement.removeClass("e-tile-selected")):(this._selected=!0,this._selectElement.addClass("e-tile-selected")));!this._isMoved&&this.model.mouseUp&&this._trigger("mouseUp",{text:this.element.attr("text"),index:n(i.target).index(),select:this._selected});this._removeActiveClass();this._isMoved=!1;t.listenTouchEvent(this.element,t.moveEvent(),this._onMoveDelegate,!0,this);t.listenTouchEvent(this.element,t.endEvent(),this._onEndDelegate,!0,this)},_refresh:function(){if(this._destroy(),this.element.addClass("e-tile e-js"),this.model.captionTemplateId&&n(this._captionTemplateParent).append(this._cloneCaptionTemplateElement),this.model.imageTemplateId&&n(this._imageTemplateParent).append(this._cloneImageTemplateElement),this.model.liveTile.enabled&&this.model.liveTile.imageTemplateId)for(i=0;i<this.model.liveTile.imageTemplateId.length;i++)n(this._liveTileimageTemplateParent[i]).append(this._cloneLiveTileImageTemplateElement[i]);this._renderEJControl()},_setCulture:function(){this.model.locale!="en-US"&&(t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.caption)||t.isNullOrUndefined(this._options.caption.text))&&t.isNullOrUndefined(this._options.text))&&this._captionText(this._getLocalizedLabels().captionText)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.Tile.Locale=t.Tile.Locale||{};t.Tile.Locale["default"]=t.Tile.Locale["en-US"]={captionText:"text"};t.Tile.ImagePosition={Center:"center",TopCenter:"topcenter",BottomCenter:"bottomcenter",RightCenter:"rightcenter",LeftCenter:"leftcenter",TopLeft:"topleft",TopRight:"topright",BottomRight:"bottomright",BottomLeft:"bottomleft",Fill:"fill"};t.Tile.BadgePosition={TopRight:"topright",BottomRight:"bottomright"};t.Tile.CaptionAlignment={Normal:"normal",Left:"left",Right:"right",Center:"center"};t.Tile.CaptionPosition={InnerTop:"innertop",InnerBottom:"innerbottom",Outer:"outer"};t.Tile.TileSize={Medium:"medium",Small:"small",Large:"large",Wide:"wide"};t.Tile.LiveTileType={Flip:"flip",Slide:"slide",Carousel:"carousel"};n.extend(!0,t.Tile.prototype,t.TileBase.prototype)}(jQuery,Syncfusion),function(n,t){t.widget("ejRadialSliderBase","ej.RadialSliderBase",{defaults:{radius:200,ticks:[0,10,20,30,40,50,60,70,80,90,100],enableRoundOff:!0,value:10,autoOpen:!0,enableAnimation:!0,cssClass:null,labelSpace:30,stop:null,slide:null,start:null,change:null,create:null,destroy:null},dataTypes:{radius:"number",enableRoundOff:"boolean",enableAnimation:"boolean",cssClass:"string"},observables:["value"],observableArray:["ticks"],value:t.util.valueFunction("value"),ticks:t.util.valueFunction("ticks"),_outerTextCalculation:function(n,t,i){var e=this._isMobile()?this.model.radius-this.model.labelSpace:this.model.radius+this.model.labelSpace,f,s,o,r,u;for(this._point=(i-t)/(n-1),i=t+(i-t)/(n-1),f=i,s=f,this._textPoints=[],o=0;o<n;o++)r={},u=t,t=t*Math.PI/180,i=i*Math.PI/180,r.X2=this._startXY+e*Math.cos(t),r.Y2=this._startXY+e*Math.sin(t),r.textAlignment=u<=270&&90<=u?"middle":"start",t=f,i=f+this._point,f+=this._point,this._textPoints.push(r);return r={},u=this._startValueAngle,this._startValueAngle=this._startValueAngle*Math.PI/180,r.X2=this._startXY+e*Math.cos(this._startValueAngle),r.Y2=this._startXY+e*Math.sin(this._startValueAngle),r.textAlignment=u<=270&&90<=u?"middle":"start",this._textPoints.push(r),this._textPoints},_polarToCartesian:function(n,t,i,r,u){var f=r*Math.PI/180;return{x:n+i*Math.cos(f),y:t+i*Math.sin(u?-f:f)}},_tapHandlerEvent:function(t){var e=n("#"+this._prefix+this._elementID+"-radial-slider-svg").offset(),o=t.clientY,s=t.clientX,h=e.top+this._radialWidth/2-n(window).scrollTop(),c=e.left+this._radialWidth/2,u,f,l,r,i;if(this._dynamicAngleCalculation(c,s,h,o),u=this._isMobile()&&this.model.renderMode=="ios7"?6.5:this._isMobile()&&this.model.renderMode=="windows"?2.5:5,!this._isMobile()&&this._angle>=360-this._endAngle&&this._angle<=360-this._startAngle||this._isMobile()&&this._angle>=360-(this._endAngle-u)&&this._angle<=360-(this._startAngle+u)||this._isMobile()&&this.model.position.charAt(0).toLowerCase()=="l"&&(this._angle>270+u||this._angle<90-u)){if(this._lineAngleCalculation(!0),this._previousAngle=this._angle,this._isMobile()||(n(this._overLine).remove(),this._pathBeforeAddlength=this._tickCount+1,this._pathAfterAddLength=this._directionLine.toString().replace(/[^M]/g,"").length,this._pathBeforeAddlength<this._pathAfterAddLength?(f=this._isTapSelected?2:1,this._directionLine.remove(this._tickCount,f,f)):this._directionLine.remove(this._tickCount,1),this._dynamicLineCalculation(this._angle,!1,!0,!0,this._tickCount,this._tickCount+1,!0),n(this._pathLineElement).attr("d",this._directionLine.toString())),n(this._textGroupElement).find("[id="+this._prefix+this._elementID+"-dynamic-text]").length>0&&this._textGroupElement.find("[id="+this._prefix+this._elementID+"-dynamic-text]").remove(),l=this._selectPart(),r=l.select,this._isTicksControl()){if(i=this._ticksCalculation(),this._isMobile()&&this.model.position.charAt(0).toLowerCase()=="l"?this.line.textAlignment="end":this._isMobile()&&this.model.position.charAt(0).toLowerCase()=="r"?this.line.textAlignment="start":this._isMobile()&&(this.model.position.charAt(0).toLowerCase()=="b"||this.model.position.charAt(0).toLowerCase()=="t")&&(this.line.textAlignment="middle"),(this._isMobile()&&this.ticks().indexOf(i)==0||this.ticks().indexOf(i)==this._tickCount-1)&&(this.line.textAlignment="middle"),this.ticks().indexOf(i)<0){this._outerTextElement=this._createSVGElements("text",{"stroke-width":.5,x:this.line.X2,y:this.line.Y2,"class":this._prefix+"dynamic-text",id:this._prefix+this._elementID+"-dynamic-text",textContent:i,"text-anchor":this.line.textAlignment});this._textGroupElement.append(this._outerTextElement);var a=document.getElementById(this._prefix+this._elementID+"-dynamic-text").getBoundingClientRect(),c=this._textPoints[r.toFixed()].X2,h=this._textPoints[r.toFixed()].Y2,s=this.line.X2,o=this.line.Y2,b=Math.sqrt(Math.pow(s-c,2)+Math.pow(o-h,2));if(b<a.width*72/96){this.line={};var v=i.toString().length,y=a.width*72/96-(this._isMobile()?v*2:v*4),k=parseFloat(r.toFixed(3).substr(0,1))==r.toFixed()?this._degPoint[r.toFixed()]+y:this._degPoint[r.toFixed()]-y,p=(360-k)*(Math.PI/180),w=this._isMobile()?this.model.radius-this.model.labelSpace:this.model.radius+this.model.labelSpace;this.line.X2=this._startXY+w*Math.cos(p);this.line.Y2=this._startXY+w*Math.sin(-p);n("#"+this._prefix+this._elementID+"-dynamic-text").attr({x:this.line.X2,y:this.line.Y2})}}}else i=this.ticks()[r.toFixed()];this._trigger("change",{value:i,oldValue:this.value()});this._needleStop&&this.model.stop&&this._trigger("stop",{value:i});this.value(i);this._needleStop=!0;this._needleMove=!1;this._isMobile()&&(this.model.renderMode=="windows"||this.model.renderMode=="flat"?this._dynamicWindowsRadial():this._dynamicIOSandAndroidRadial())}},_selectPart:function(){var t=this._dynamicAngle,i=this._startAngle,u=this._endAngle,n;this._isMobile()&&(n=this.model.renderMode=="ios7"?5:this.model.renderMode=="windows"?2.5:5,i=this._startAngle+n,u=this._endAngle-n,this.model.position.charAt(0).toLowerCase()=="l"&&this._dynamicAngle<180&&(t=this._dynamicAngle+360));var r=(t-i)/((u-i)/(this.ticks().length-1)),f=this.ticks()[parseInt(r)],e=this.ticks()[parseInt(r)+1],o=e-f;return{select:r,firstValue:f,space:n,difference:o,dynamicAngle:t}},_lineAngleCalculation:function(n){var t=this._selectPart(),i,f,r,u;this._degPoint.splice(this.ticks().length,this.ticks().length+1);this._degPoint.push(this._degPoint[this._degPoint.length-1]+this._point);i=(this._degPoint[parseInt(t.select)+1]-this._degPoint[parseInt(t.select)]-(this._degPoint[parseInt(t.select)+1]-t.dynamicAngle))/(this._point/t.difference);f=parseInt(t.select)!=0?this._degPoint[parseInt(t.select)]:this._degPoint[parseInt(t.select)];this.model.enableRoundOff&&n?(u=parseFloat(i.toFixed(2)),i=parseInt(i.toFixed()),r=t.difference==.5&&u>=.25?this._point*1:this._point/t.difference*i):r=this._point/t.difference*parseFloat(i.toFixed(2));this._angle=360-this._degPoint[parseInt(t.select)]-Math.abs(r)},_isTicksControl:function(){var t=this._selectPart(),i,r;return this._degPoint.splice(this.ticks().length,this.ticks().length+1),this._degPoint.push(this._degPoint[this._degPoint.length-1]+this._point),i=(this._degPoint[parseInt(t.select)+1]-this._degPoint[parseInt(t.select)]-(this._degPoint[parseInt(t.select)+1]-this._dynamicAngle))/(this._point/t.difference),r=this.model.enableRoundOff?parseInt(i.toFixed())==0||parseInt(i.toFixed())==t.difference?!1:!0:n.inArray(this._angle,this._degPoint)>-1?!1:!0,r},_ticksCalculation:function(){var t=this._selectPart(),r=t.select,s=t.dynamicAngle,h=t.difference,e=t.firstValue,l=t.space,e=this.ticks()[parseInt(r)],u,f,o,n,i,c;return this.line={},u=this._angle*(Math.PI/180),f=this._isMobile()?this.model.radius-this.model.labelSpace:this.model.radius+this.model.labelSpace,this.line.X2=this._startXY+f*Math.cos(u),this.line.Y2=this._startXY+f*Math.sin(-u),this.line.textAlignment=this._angle<=270&&90<=this._angle?"middle":"start",o=parseInt(r)!=0?this._degPoint[parseInt(r)]:this._degPoint[parseInt(r)],n=(s-o)/(this._point/h),this.model.enableRoundOff?(c=parseFloat(n.toFixed(1).substr(1,3)),n=parseInt(n.toFixed()),i=e+Math.abs(n)):(i=e+Math.abs(parseFloat(n.toFixed(2))),i=parseFloat(i.toFixed(2))),i},_dynamicAngleCalculation:function(n,t,i,r){var u=Math.atan2(r-i,t-n);this._angle=(360-u*180/Math.PI)%360;this._dynamicAngle=(360+u*180/Math.PI)%360},_createSVGElements:function(t,i){var r=document.createElementNS(this._svgLink,t);return n.each(i,function(n,t){n=="xlink:href"&&r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t);n!="textContent"?r.setAttribute(n,t):r.textContent=t}),r},show:function(){this.model.enableAnimation&&(this.element.removeClass(this._prefix+"slider-hide").addClass(this._prefix+"slider-show"),this._radialSVG.attr("class","").attr("class",this._prefix+"radialslider-svg-show "+this._prefix+"rs-svg"));this.element.css("display","block");this.model.autoOpen=!0},hide:function(){var n=this;this.model.enableAnimation?(this.element.removeClass(this._prefix+"slider-show").addClass(this._prefix+"slider-hide"),this._radialSVG.attr("class","").attr("class",this._prefix+"radialslider-svg-hide "+this._prefix+"rs-svg"),this.model.autoOpen?setTimeout(function(){n.element.css("display","none")},this._isMobile?150:400):n.element.css("display","none")):n.element.css("display","none");this.model.autoOpen=!1},_setModel:function(n){t.isNullOrUndefined(n.inline)||n.inline||(this.model.radius+=50);n.ticks&&(this.model.ticks=n.ticks);this._refresh()},_clearElement:function(){this.element.removeAttr("class");this.element.html(this._orgEle.html())},_destroy:function(){this._wireEvents(!0);this._clearElement()},_isMobile:function(){return this._prefix=="e-m-"?!0:!1}})}(jQuery,Syncfusion),function(n,t,i){t.widget("ejRadialSlider","ej.RadialSlider",{_setFirst:!0,validTags:["div"],_rootCSS:"e-radialslider",defaults:{mouseover:null,strokeWidth:2,inline:!1,endAngle:360,startAngle:0,innerCircleImageClass:null,innerCircleImageUrl:null,showInnerCircle:!0,inline:!1},dataTypes:{innerCircleImageClass:"string",innerCircleImageUrl:"string",showInnerCircle:"boolean",inline:"boolean",strokeWidth:"number",endAngle:"number",startAngle:"number"},_init:function(){this._orgEle=this.element.clone();this._renderEJControl()},_renderEJControl:function(){this._prefix="e-";this._directionLine=this._getStringBuilder();this._initialization();this._renderControl();this._wireEvents(!1)},_initialization:function(){this.element.addClass(this.model.cssClass);this._svgLink="http://www.w3.org/2000/svg";this._startXY=this.model.radius-(this.model.inline?50:0);this._startAngle=this.model.startAngle;this._endAngle=this.model.endAngle;this._diameter=2*this.model.radius;this._elementID=this.element.attr("id");this.model.radius=this._startXY;this._tickCount=this.ticks().length;this._labelSpacing=this.model.inline?0:200;this._radialWidth=this._diameter+this._labelSpacing;this.element.css({width:this._diameter+this._labelSpacing,height:this._diameter+this._labelSpacing});this._radialSliderWrapper=t.buildTag("div",{},{},{"class":this._prefix+"radail-slider-wrapper"}).css({width:this._radialWidth,height:this._radialWidth});this.model.showInnerCircle&&(this._innerCircle=t.buildTag("div",{},{},{"class":this._prefix+"inner-circle"}).css({left:this._radialWidth/2-(20+this.model.strokeWidth+1),top:this._radialWidth/2-(20+this.model.strokeWidth+1),"border-width":this.model.strokeWidth+1}),this.model.innerCircleImageClass?this._innerCircle.addClass(this.model.innerCircleImageClass):this._innerCircle.css({"background-image":"url('"+this.model.innerCircleImageUrl+"')"}),this._radialSliderWrapper.append(this._innerCircle));this.element.append(this._radialSliderWrapper)},_renderControl:function(){var t,r;this._radialSVG=n(this._createSVGElements("svg",{id:this._prefix+this._elementID+"-radial-slider-svg","class":this._prefix+"rs-svg",width:this._diameter+this._labelSpacing,height:this._diameter+this._labelSpacing}));var i=this.model.inline?50:100,u=this.model.inline?45:95,f=this.model.inline?55:105;for(this._pathLineGroupElement=n(this._createSVGElements("g",{id:"outerLineCircle",transform:"translate("+i+","+i+")"})),this._lineDirection=this._outerLineCalculation(50,40,this._tickCount,!0,!0,"path"),this._textGroupElement=n(this._createSVGElements("g",{id:"outerTextCircle",transform:"translate("+u+","+f+")"})),this._circleGroupElement=n(this._createSVGElements("g",{id:"circlegroup",transform:"translate("+i+","+i+")"})),this._circlePath=this._createSVGElements("path",{id:"circlepath",d:this._circleArcDirection(this._startAngle,this._endAngle),"class":this._prefix+"radialarcdefault",fill:"none","stroke-width":this.model.strokeWidth}),this._circleGroupElement.append(this._circlePath),this._circleGroupElement.append(this._radialCircle),this._outerTextDirection=this._outerTextCalculation(this._tickCount,this._startAngle,this._endAngle),t=0;t<this._tickCount+1;t++){if(r=t==0&&this._startAngle==0&&this._endAngle==360?this._tickCount-1:t,this._outerTextElement,t==this._tickCount)if(this.ticks()[0]==this.value())continue;else this._outerTextElement=this._createSVGElements("text",{"stroke-width":.5,x:this._outerTextDirection[t].X2,y:this._outerTextDirection[t].Y2,id:this._prefix+this._elementID+"-dynamic-text","class":this._prefix+"dynamic-text",textContent:this.value(),"text-anchor":this._outerTextDirection[t].textAlignment});else this._outerTextElement=this._createSVGElements("text",{"stroke-width":.5,x:this._outerTextDirection[t].X2,y:this._outerTextDirection[t].Y2,"class":this._prefix+"ticks-text",textContent:this.ticks()[r],"text-anchor":this._outerTextDirection[t].textAlignment});this._textGroupElement.append(this._outerTextElement)}this._pathLineElement=this._createSVGElements("path",{"class":this._prefix+"radial-needle",d:this._lineDirection,fill:"none","stroke-width":this.model.strokeWidth});this._pathLineGroupElement.append(this._pathLineElement);this._radialSliderWrapper.append(this._radialSVG.append(this._pathLineGroupElement).append(this._textGroupElement).append(this._circleGroupElement));this.model.autoOpen?this.show():this.hide()},_circleArcDirection:function(n,t){var i=.5*Math.min(this._diameter-(this.model.inline?100:0),this._diameter-(this.model.inline?100:0)),r=this._polarToCartesian(this._startXY,this._startXY,i,n),u=this._polarToCartesian(this._startXY,this._startXY,i,t);return ArcSweep=t-n<=180?"0":"1",["M",r.x,r.y,"A",i,i,0,ArcSweep,1,u.x,u.y-1].join(" ")},_overNeedleMoveHandler:function(t){var r,f,e,o;t.preventDefault();var u=n("#"+this._prefix+this._elementID+"-radial-slider-svg").offset(),s=t.clientY,h=t.clientX,c=u.top+this._radialWidth/2-n(window).scrollTop(),l=u.left+this._radialWidth/2;this._dynamicAngleCalculation(l,h,c,s);this._angle>360-this._endAngle&&this._angle<360-this._startAngle&&(this.line={},r=this.model.radius,this.line.X1=this._startXY,this.line.Y1=this._startXY,f=Math.cos(this._angle*Math.PI/180),e=-Math.sin(this._angle*Math.PI/180),this.line.X2=this._startXY+(r-5)*f,this.line.Y2=this._startXY+(r-5)*e,this._overLine!=i?n(this._overLine).attr({d:[" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" "),"stroke-width":this.model.strokeWidth==1?this.model.strokeWidth-.5:this.model.strokeWidth-1}):this._overLine=this._createSVGElements("path",{"class":this._prefix+"needle-over",d:[" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" "),"stroke-width":this.model.strokeWidth==1?this.model.strokeWidth-.5:this.model.strokeWidth-1}),this._pathLineGroupElement.append(this._overLine),this._isNeedleOver=!0,o=this._ticksCalculation(),this.model.mouseover&&this._trigger("mouseover",{value:o,selectedValue:this.value()}))},_needleMoveHandler:function(i){var u,f;t.blockDefaultActions(i);t.isTouchDevice()&&(i=i.touches?i.touches[0]:i);var r=n("#"+this._prefix+this._elementID+"-radial-slider-svg").offset(),e=i.clientY,o=i.clientX,s=r.top+this._radialWidth/2-n(window).scrollTop(),h=r.left+this._radialWidth/2;this._dynamicAngleCalculation(h,o,s,e);this._angle>360-this._endAngle&&this._angle<360-this._startAngle&&(n(this._overLine).remove(),this._lineAngleCalculation(),u=this._isTapSelected?this._tickCount+1:this._tickCount,this._directionLine.remove(u,1,1),this._dynamicLineCalculation(this._angle,!1,!0,!0,this._tickCount,this._tickCount+1,!1),n(this._pathLineElement).attr("d",this._directionLine.toString()),this.model.slide&&(f=this._ticksCalculation(),this._trigger("slide",{value:f,selectedValue:this.value()})),this._needleMove=!0)},_dynamicLineDirection:function(n,t,i){var r={},u=this._polarToCartesian(this._startXY,this._startXY,this.model.radius,n,i),f=this._polarToCartesian(this._startXY,this._startXY,this.model.radius+10,n,i);return r.X1=u.x,r.Y1=u.y,r.X2=f.x,r.Y2=f.y,this._isTapSelected=!0,this._directionLine.insert(t+2,[" M",r.X1,r.Y1,"L",r.X2,r.Y2].join(" ")),this._directionLine.toString()},_inLineCalculation:function(n,t){var i={},r=this._polarToCartesian(this._startXY,this._startXY,this.model.radius-5,n,t);return i.X1=this._startXY,i.Y1=this._startXY,i.X2=r.x,i.Y2=r.y,this._directionLine.append([" M",i.X1,i.Y1,"L",i.X2,i.Y2].join(" ")),this._directionLine.toString()},_dynamicLineCalculation:function(n,t,i,r,u,f,e){var o,s,h;return this.line={},o=this.model.radius,this.line.X1=this._startXY,this.line.Y1=this._startXY,s=Math.cos(n*Math.PI/180),h=-Math.sin(n*Math.PI/180),this.line.X2=this._startXY+(o-5)*s,this.line.Y2=this._startXY+(o-5)*h,e&&this._dynamicLineDirection(n,u,!0),t&&this._directionLine.append([" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" ")),r&&this._directionLine.insert(u+3,[" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" ")),this._directionLine.toString()},_getStringBuilder:function(){var n=[],t=0;return{append:function(i){return n[t++]=i,this},remove:function(i,r,u){return t=t-(u||1),n.splice(i,r||1),this},insert:function(i,r){return n.splice(i,0,r),t++,this},toString:function(t){return n.join(t||"")}}},_outerLineCalculation:function(n,t,i,r,u,f){var c=this.model.radius,s=this._startAngle,l=s+(this._endAngle-this._startAngle)/(i-1),v,o,e,b,k;this._point=(this._endAngle-this._startAngle)/(i-1);var h=l,tt=h,w=[];if(this._degPoint=[],this._degPoint.push(s),r)for(v=0;v<i;v++)o={},s=s*Math.PI/180,l=l*Math.PI/180,this._degPoint.push(h),f!="text"&&(o.X1=this._startXY+c*Math.cos(s),o.Y1=this._startXY+c*Math.sin(s)),o.X2=this._startXY+(c+10)*Math.cos(s),o.Y2=this._startXY+(c+10)*Math.sin(s),s=h,l=h+this._point,h+=this._point,f=="path"?this._directionLine.append([" M",o.X1,o.Y1,"L",o.X2,o.Y2].join(" ")):w.push(o);if(u)for(e=0;e<this.ticks().length;e++){var a=e+1,y=e==this.ticks().length-1?this.ticks()[this.ticks().length-1]+.5:this.ticks()[a],p=e==0?this.ticks()[e]-.5:this.ticks()[e],d=p<=0&&p>=this.value()?!0:!1,g=y<=0&&y<=this.value()?!0:!1,nt=d&&g?!0:p<=this.value()&&this.value()<y;nt&&(this.ticks()[e]!=this.value()?(b=this._point/(this.ticks()[a]-this.ticks()[e]),k=this.ticks()[a]-this.value(),this._startValueAngle=this._degPoint[a]-b*k,this._dynamicLineDirection(this._startValueAngle,this._tickCount-2,!1),this._inLineCalculation(this._startValueAngle,!1)):(this._startValueAngle=this._degPoint[e],this._inLineCalculation(this._startValueAngle,!1)))}return this._path=f=="path"?this._directionLine.toString():w,this._path},_refresh:function(){this._destroy();this.model.enableRoundOff&&(this.model.value=Math.round(this.model.value));this.element.addClass("e-radialslider e-js");this._renderEJControl()},_createDelegates:function(){this._touchStartDelegate=n.proxy(this._touchStartHandler,this);this._needleMoveDelegate=n.proxy(this._needleMoveHandler,this);this._touchEndDelegate=n.proxy(this._touchEndHandler,this);this._overNeedleMoveDelegate=n.proxy(this._overNeedleMoveHandler,this);this._mouseOutDelegate=n.proxy(this._mouseOutHandler,this);this._enterMouseDelegates=n.proxy(this._entermouse,this)},_wireEvents:function(n){var i=n?"off":"on";this._createDelegates();t.listenEvents([this._radialSVG,this._radialSVG,this._radialSVG,this._radialSVG],[t.endEvent(),t.startEvent(),"mouseenter","mouseleave"],[this._touchEndDelegate,this._touchStartDelegate,this._enterMouseDelegates,this._mouseOutDelegate],!1)},_entermouse:function(){t.listenEvents([this._radialSVG],[t.moveEvent()],[this._overNeedleMoveDelegate],!1)},_mouseOutHandler:function(r){if(r.preventDefault(),this._radialSVG.has(r.target).length==0&&this._needleMove){t.listenEvents([this._radialSVG],[t.moveEvent()],[this._needleMoveDelegate],!0);var u=this._previousAngle!=i?this._previousAngle:this._startValueAngle;this._pathAfterAddLength=this._directionLine.toString().replace(/[^M]/g,"").length;this._directionLine.remove(this._pathAfterAddLength-1,1);this._inLineCalculation(u,!0);n(this._pathLineElement).attr("d",this._directionLine.toString());this._needleMove=!1}n(this._overLine).remove()},_touchEndHandler:function(n){n=n.touches?n.changedTouches[0]:n;t.listenEvents([this._radialSVG],[t.moveEvent()],[this._needleMoveDelegate],!0);this._tapHandlerEvent(n)},_touchStartHandler:function(n){t.blockDefaultActions(n);t.isTouchDevice()&&(n=n.touches?n.touches[0]:n);this._needleStop=!1;this.model.start&&this._trigger("start",{value:this.value()});t.listenEvents([this._radialSVG],[t.moveEvent()],[this._needleMoveDelegate],!1)}});n.extend(!0,t.RadialSlider.prototype,t.RadialSliderBase.prototype)}(jQuery,Syncfusion),function(n,t,r){t.widget("ejTreeView","ej.TreeView",{_rootCSS:"e-treeview",element:null,model:null,validTags:["ul","div"],_addToPersist:["expandedNodes","checkedNodes","selectedNodes"],_setFirst:!1,_requiresID:!0,defaults:{allowMultiSelection:!1,showCheckbox:!1,enableAnimation:!0,allowDragAndDrop:!1,htmlAttributes:{},allowDropChild:!0,allowDropSibling:!0,allowDragAndDropAcrossControl:!0,allowEditing:!1,allowKeyboardNavigation:!0,items:null,fields:{dataSource:null,query:null,tableName:null,child:null,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass",expanded:"expanded",hasChild:"hasChild",selected:"selected",linkAttribute:"linkAttribute",imageAttribute:"imageAttribute",htmlAttribute:"htmlAttribute",imageUrl:"imageUrl",isChecked:"isChecked"},autoCheckParentNode:!1,loadOnDemand:!1,cssClass:"",template:null,enableRTL:!1,expandOn:"dblclick",enablePersistence:!1,enabled:!0,expandedNodes:[],checkedNodes:[],selectedNode:-1,selectedNodes:[],width:null,height:null,autoCheck:!0,enableMultipleExpand:!0,fullRowSelect:!1,sortSettings:{allowSorting:!1,sortOrder:"ascending"},nodeClick:null,beforeExpand:null,nodeExpand:null,beforeCollapse:null,nodeCollapse:null,beforeSelect:null,nodeSelect:null,nodeUnselect:null,nodeCheck:null,nodeUncheck:null,inlineEditValidation:null,beforeEdit:null,nodeEdit:null,keyPress:null,nodeDragStart:null,nodeDrag:null,nodeDragStop:null,nodeDropped:null,beforeAdd:null,nodeAdd:null,beforeDelete:null,nodeDelete:null,beforeCut:null,nodeCut:null,beforePaste:null,nodePaste:null,beforeLoad:null,loadSuccess:null,loadError:null,ready:null,create:null,destroy:null},dataTypes:{allowMultiSelection:"boolean",cssClass:"string",showCheckbox:"boolean",enableAnimation:"boolean",allowDragAndDrop:"boolean",allowDropChild:"boolean",allowDragAndDropAcrossControl:"boolean",allowEditing:"boolean",allowKeyboardNavigation:"boolean",autoCheckParentNode:"boolean",loadOnDemand:"boolean",enableRTL:"boolean",expandOn:"string",enablePersistence:"boolean",enableMultipleExpand:"boolean",fullRowSelect:"boolean",items:"data",fields:{dataSource:"data",query:"data",child:"data"},expandedNodes:"array",checkedNodes:"array",selectedNode:"number",selectedNodes:"array",htmlAttributes:"data",sortSettings:{allowSorting:"boolean",sortOrder:"enum"}},observables:["fields.dataSource"],dataSource:t.util.valueFunction("fields.dataSource"),_setModel:function(i){var r,l,s,h,c,e,f,u,o,a;for(r in i)switch(r){case"allowMultiSelection":this.model.allowMultiSelection=i[r];this.model.allowMultiSelection||(l=n(this._liList[this.model.selectedNodes[0]]),this._unselectAll(),this._isRender=!1,this._nodeSelectionAction(l),this._isRender=!0);break;case"cssClass":this._changeSkin(i[r]);break;case"fields":if(this._deepWatch&&!t.isNullOrUndefined(i[r].dataSource)&&JSON.stringify(this._oldDataSource)==JSON.stringify(typeof i[r].dataSource=="function"?i[r].dataSource():i[r].dataSource))return;this._unWireEvents();h=this.element.hasClass("e-js")?!1:!0;c=h?this.element.children("ul"):this.element;c.empty();this.model.fields==null||i[r]==null?this.model.fields=i[r]:this._extendFields(this.model.fields,i[r]);this.model.expandedNodes=[];this.model.checkedNodes=[];this.model.selectedNodes=[];this.model.selectedNode=-1;this._persistValues(this.model.expandedNodes,"expandedNodes");this._persistValues(this.model.checkedNodes,"checkedNodes");this._persistValues(this.model.selectedNodes,"selectedNodes");this._newDataSource=this.dataSource();!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null?this._checkDataBinding():this._initialize();h&&(s=this.element.children(".e-treeview-ul"),c.append(s.children()),s.remove());break;case"allowDragAndDropAcrossControl":this.model.allowDragAndDropAcrossControl=i[r];this._enableDragDrop();break;case"enabled":this._enabledAction(i[r]);break;case"showCheckbox":i[r]?(this.model.showCheckbox=i[r],this._showCheckBox(),this.model.enabled||this.element.find(".nodecheckbox").ejCheckBox("disable")):(this.element.find(".e-item > div > .e-chkbox-wrap").remove(),this._updateCheckedNodes());break;case"autoCheck":this.model.autoCheck=i[r];break;case"autoCheckParentNode":this.model.autoCheckParentNode=i[r];break;case"expandedNodes":if(u=i[r].length,e=JSON.parse(JSON.stringify(this.model.expandedNodes)),u>0)for(this._expandNodes(i[r]),f=0,u=e.length;f<u;f++)i[r].indexOf(e[f])==-1&&this._collpaseNode(n(this._liList[e[f]]));else u==0&&this._collapseAll();i[r]=this.model.expandedNodes;break;case"checkedNodes":if(this.model.showCheckbox)if(u=i[r].length,e=JSON.parse(JSON.stringify(this.model.checkedNodes)),u>0)for(this._checkedNodes(i[r]),f=0,u=e.length;f<u;f++)i[r].indexOf(e[f])==-1&&this._nodeUncheck(n(this._liList[e[f]]).find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]);else u==0&&this._uncheckAll();i[r]=this.model.checkedNodes;break;case"expandOn":this._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:this.model.expandOn,this._expandEventHandler);this._assignTouchExpandOn(i[r]);this._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:i[r],this._expandEventHandler);break;case"allowEditing":this._preventEditable();i[r]&&this._allowEditable();break;case"allowKeyboardNavigation":o=i[r]?"_on":"_off";this[o](this.element,"keydown",this._KeyPress);break;case"allowDragAndDrop":this.model.allowDragAndDrop=i[r];i[r]?this._addDragableClass():this._preventDraggable();break;case"allowDropChild":this.model.allowDropChild=i[r];i[r]?this._addDragableClass():this._preventDropChild();break;case"allowDropSibling":this.model.allowDropSibling=i[r];i[r]?this._addDragableClass():this._preventDropSibling();break;case"enableRTL":this.model.enableRTL=i[r];a=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;o=this.model.enableRTL?"addClass":"removeClass";a[o]("e-rtl");break;case"height":this.element.is("ul")?this.element.parent().height(i[r]):this.element.height(i[r]);break;case"width":this.element.is("ul")?this.element.parent().width(i[r]):this.element.width(i[r]);break;case"selectedNode":case"selectedNodes":this.model.selectedNodes=r=="selectedNode"?[i[r]]:i[r];this.element.find("a.e-text.e-active").removeClass("e-node-focus e-active").closest("li").attr("aria-selected",!1);this._doSelectNodes(this.model.selectedNodes,!1);r!="selectedNode"&&(i[r]=this.model.selectedNodes);break;case"htmlAttributes":this._addAttr(i[r]);break;case"enableMultipleExpand":i[r]||this.collapseAll();this.model.enableMultipleExpand=i[r];break;case"sortSettings":n.extend(this.model.sortSettings,i[r]);t.isNullOrUndefined(this.model.fields)||this.dataSource()==null||(this.model.expandedNodes=[],this.model.checkedNodes=[],this.model.selectedNodes=[],this._checkDataBinding());break;case"fullRowSelect":this._wholeRowEvents("_off");this.model.fullRowSelect=i[r];this.model.fullRowSelect?this._addWholeRowWrap():this._removeWholeRowWrap();this._doWholeRowAction();this._wholeRowEvents("_on")}},_destroy:function(){this.element.html("");this._cloneElement.removeClass("e-treeview e-js e-treeview-wrap");var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;t.replaceWith(this._cloneElement);n("#"+this._id+"_WaitingPopup").remove();window.localStorage?(window.localStorage.removeItem(this._id+"_childNodes"),window.localStorage.removeItem(this._id+"_persistedValues")):window.cookie&&(document.cookie=this._id+"_childNodes=; expires=Thu, 01 Jan 1970 00:00:00 UTC",document.cookie=this._id+"_persistedValues=; expires=Thu, 01 Jan 1970 00:00:00 UTC")},_init:function(){var i,r,n;this._cloneElement=this.element.clone();this._dataSource=[];this._fragment=[];this._templateType="";this._indexID=0;this._newDataSource=this.dataSource();this._id=this.element.prop("id");this._treeList=[];this._isTextbox=!1;this._isDevice=this._checkDevice();this._deepWatch=this.element.attr("e-deepwatch")==="true";i=t.browserInfo();this._isIE8=i.name=="msie"&&i.version=="8.0"?!0:!1;this._oldDataSource=JSON.parse(JSON.stringify(this.dataSource()));this._assignTouchExpandOn(this.model.expandOn);this.model.enablePersistence&&(r=this._getCookies("_persistedValues"),r||(n={selectedNodes:[],expandedNodes:[],checkedNodes:[]},n=this._updatePersistAttr(n),this._setCookies("_persistedValues",JSON.stringify(n))));t.isNullOrUndefined(this.model.fields)||this.dataSource()==null?(this._initialize(),this._completeRendering()):this._checkDataBinding()},_initialize:function(){this._cutNode=null;this._beforeEditText=null;this._CurrenctSelectedNodes=[];this._isLoaded=!1;this._renderMultiTouchDialog();this.element.is("ul")?this._createWrapper():(this.element.addClass("e-treeview-wrap e-widget").attr("tabindex",0).children("ul:first").addClass("e-ul e-box"),this.model.width!=null&&this.element.width(this.model.width),this.model.height!=null&&this.element.height(this.model.height),this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),this._addAttr(this.model.htmlAttributes));this._elementSettings();this._beforeBaseClass();this.dataSource()==null&&(this._addBaseClass(),this._controlRender());this._addWholeRowWrap();this._isIE8&&(this.element.is("UL")?this.element.parent(".e-treeview-wrap").addClass("e-ie8"):this.element.addClass("e-ie8"));this._finalize()},_completeRendering:function(){this._treeList.length!=0||this._isLoaded||(this._finalizeNode(),this._enabledAction(this.model.enabled),this._triggerEvent("ready",{element:this.element[0]}),this._isLoaded=!0)},_addWholeRowWrap:function(){this.model.fullRowSelect&&(this.element.is("UL")?this.element.parent(".e-treeview-wrap").addClass("e-fullrow-wrap"):this.element.addClass("e-fullrow-wrap"))},_removeWholeRowWrap:function(){this.element.is("UL")?this.element.parent(".e-treeview-wrap").removeClass("e-fullrow-wrap"):this.element.removeClass("e-fullrow-wrap")},_doWholeRowAction:function(){var t,r,i,u;if(this.model.fullRowSelect)for(t=0,r=this._liList.length;t<r;t++)i=n(this._liList[t]),i[0]!=null&&(u=i.find("> .e-text-wrap"),this._renderWholeRow(i,u));else this.element.find(".e-fullrow").remove()},_renderWholeRow:function(t,i){if(t&&this.model.fullRowSelect){var r=document.createElement("div");r.setAttribute("class","e-fullrow");i?n(r).insertAfter(i):t[0].appendChild(r)}},_extendFields:function(t,i){if(t==null||i==null)t=i;else if(t.child==null||i.child==null)n.extend(t,i);else{this._extendFields(t.child,i.child);var r=t.child;n.extend(t,i);n.extend(t.child,r)}},_checkDevice:function(){return t.isDevice()&&t.isTouchDevice()},_assignTouchExpandOn:function(n){this._touchExpandOn=n=="dblclick"?"doubletap":n=="click"?"tap":n},_renderMultiTouchDialog:function(){var i,r,u;this._customPop=t.buildTag("div.e-fe-popup","",{display:"none"});i=t.buildTag("div.e-content");r=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSelection&&(u=t.buildTag("span.e-rowselect e-icon"),i.append(u));this._customPop.append(i);this._customPop.append(r);this.element.append(this._customPop);this._on(i,this._isDevice&&n.isFunction(n.fn.tap)?"touchstart":"mousedown",this._popupClick)},_popupClick:function(){var n=this._customPop.find(".e-rowselect");n.hasClass("e-spanclicked")?this._hidePopup():(this._isPopup=!0,n.addClass("e-spanclicked"))},_hidePopup:function(){this._customPop!=null&&this._customPop.is(":visible")&&(this._customPop.find(".e-rowselect").removeClass("e-spanclicked"),this._customPop.hide(),this._isPopup=!1)},_elementSettings:function(){var n=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;this.element.is("ul")?n.attr("role","tree"):n.attr("aria-activedescendant",this._id+"_active").children("ul:first").attr("role","tree")},_beforeBaseClass:function(){var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap")[0]:this.element[0];this._ulList=n(t.querySelectorAll("ul"));this._liList=n(t.querySelectorAll("li"))},_createWrapper:function(){var n=t.buildTag("div.e-treeview-wrap e-widget "+this.model.cssClass,"","",{tabindex:0,"aria-activedescendant":this._id+"_active"});this.model.width!=null&&n.width(this.model.width);this.model.height!=null&&n.height(this.model.height);this.model.enableRTL&&n.addClass("e-rtl");n.insertAfter(this.element);n.append(this.element.addClass("e-ul e-box").attr("tabindex",0));this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?i._enabledAction(!1):i.element.attr(t,n)})},_changeSkin:function(n){if(this.model.cssClass!=n){var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;t.removeClass(this.model.cssClass).addClass(n);t.find(".e-item > div > .e-chkbox-wrap").removeClass(this.model.cssClass).addClass(n);this._waitingPopup&&this._waitingPopup.option("cssClass",n)}},_enabledAction:function(n){this.model.enabled=n;n?(this.element.removeClass("e-disable"),this._wireEvents()):(this.element.addClass("e-disable"),this._unWireEvents())},_checkDataBinding:function(){this.dataSource()instanceof t.DataManager?this._initDataSource():(this._ensureDataSource(this.dataSource()),this._initialize(),this._completeRendering())},_initDataSource:function(){this.element.ejWaitingPopup({cssClass:this.model.cssClass});this._waitingPopup=this.element.ejWaitingPopup("instance");this._waitingPopup.maindiv.addClass("e-tree-popup");var n=this,i,r;this.element.ejWaitingPopup("refresh");this.element.ejWaitingPopup("show");r=this._columnToSelect(this.model.fields);i=this.dataSource().executeQuery(r);i.done(function(i){n.element.ejWaitingPopup("hide");n.retriveData=i.xhr&&i.xhr.responseJSON&&i.xhr.responseJSON.d?i.xhr.responseJSON.d:i.result?i.result:[];n._typeOfFieldId=n.retriveData[0]?(typeof n.retriveData[0][n.model.fields.id]).toLowerCase():"";n._ensureDataSource(n.retriveData);n._initialize();(n.model.loadOnDemand||t.isNullOrUndefined(n.model.fields.child))&&n._completeRendering()})},_columnToSelect:function(n){var u=[],r=t.Query(),i;if(n.query||t.isNullOrUndefined(n.tableName))r=n.query?n.query:r;else{for(i in n)i!=="tableName"&&i!=="child"&&i!=="dataSource"&&n[i]&&u.push(n[i]);u.length>0&&r.select(u);this.dataSource().dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||r.from(n.tableName)}return r},_ensureDataSource:function(n){n=this._getSortAndFilterList(this.model.fields,n);this.currentSelectedData=n;this._renderTemplate(n);this.element.is("ul")?this.element.html(this._fragment.firstChild.children):this.element.html(this._fragment)},_getTemplateType:function(n,t){for(var i=0,r=n.length;i<r;i++){if(n[i].hasOwnProperty(t.parentId)||n[i].hasOwnProperty(t.hasChild))return 1;if(n[i].hasOwnProperty("child"))return 2}return 1},_groupingObjects:function(n,t){for(var u,r={},f=[],i=0,e=n.length;i<e;i++)u=JSON.stringify(t(n[i])),r[u]=r[u]||[],r[u].push(n[i]);for(i in r)f.push(r[i]);return f},_renderTemplate:function(n){this._onlineData=!1;this._loadOnDemandNodes=!1;var i=this;this._templateType=this._getTemplateType(n,this.model.fields);this._dataSource=this._templateType==1?this._groupingObjects(n,function(n){return[!t.isNullOrUndefined(n)&&[n[i.model.fields.parentId]].toString()]}):n;this._templateNodeCreation(n,this.model.fields)},_templateNodeCreation:function(i,r){var e,u,f,o;if(this._fragment=document.createDocumentFragment(),e=document.createElement("ul"),this._fragment.appendChild(e),u=this._fragment.firstChild,(this._onlineData||this._loadOnDemandNodes)&&(u.className="e-treeview-ul",u.setAttribute("role","group"),n(u).attr("style","display:none")),this.dataSource()!=null){for(f=0,o=i.length;f<o;f++)i[f]&&(t.isNullOrUndefined(i[f][this.model.fields.parentId])||i[f][this.model.fields.parentId]==0||this._loadOnDemandNodes)&&u.appendChild(this._genTemplate(i[f],r));n(u).find(".e-item:first-child:not(:last-child)").addClass("first");n(u).find(".e-item:last-child").addClass("last")}},_onlineDataSource:function(t,i,r){this._loadOnDemandNodes=!0;this._templateNodeCreation(t,r);var u=this.element.find(".e-item#"+i);u[0]!=null&&(n(u[0]).append(this._fragment),u.children().find("> div:first").addClass("e-icon e-plus"),this._finalizeLoadOnDemand(u));this._onlineData=!1},_genTemplate:function(i,r){var v=document.createDocumentFragment(),u,y,f,e,s,o,p,w,h,l,a,c,b;if(y=document.createElement("li"),v.appendChild(y),u=v.firstChild,u.id=i[r.id]?i[r.id]:"",u.setAttribute("role","treeitem"),i[r.htmlAttribute]&&this._setAttributes(i[r.htmlAttribute],u),u.className+=" e-item",e=document.createElement("a"),i[r.imageUrl]?(f=document.createElement("img"),f.className="e-align",f.src=i[r.imageUrl],i[r.imageAttribute]&&this._setAttributes(i[r.imageAttribute],f)):i[r.spriteCssClass]&&(f=document.createElement("span"),f.className=i[r.spriteCssClass]),this.model.template){if(f&&e.appendChild(f),typeof n.fn.render!="function")throw"Error : JsRender dependecy script missing";e.innerHTML+=this._renderEjTemplate(this.model.template,i)}else i[r.text]?n(e).text(i[r.text]):n(e).text("undefined"),f&&e.insertBefore(f,e.lastChild);if(i[r.linkAttribute]&&(typeof i[r.linkAttribute]=="object"?this._setAttributes(i[r.linkAttribute],e):e.href=i[r.linkAttribute]),u.appendChild(e),i[r.expanded]&&(u.className+=" expanded"),i[r.selected]&&(u.className+=" selected"),t.isNullOrUndefined(i[r.isChecked])||(u.className+=i[r.isChecked]?" checked":" unchecked"),u.setAttribute("aria-selected",!1),u.setAttribute("aria-expanded",!1),this.dataSource()instanceof t.DataManager)this._updateElement(u,!0),this.model.showCheckbox&&this._checkboxOnTemplate(u.children[0]),this.model.loadOnDemand?(i[r.hasChild]||i.hasOwnProperty("child"))&&(u.children[0].firstChild.className="e-icon e-plus"):!t.isNullOrUndefined(r.child)&&r.child.dataSource instanceof t.DataManager?(o=this,w=r.child.parentId?r.child.parentId:o.model.fields.parentId,h,h=r.id?r.id:this.model.fields.id,this._treeList.push("false"),p=this._executeDataQuery(r.child,w,this._typeOfFieldId=="number"?parseInt(i[h]):i[h]),p.done(function(n){o._treeList.pop();s=n.xhr&&n.xhr.responseJSON&&n.xhr.responseJSON.d?n.xhr.responseJSON.d:n.result?n.result:[];s=o._getSortAndFilterList(r.child,s);s&&s.length>0&&(o._onlineData=!0,o._onlineDataSource(s,s[0][r.child.parentId],r.child));o._treeList.length==0&&o._completeRendering()})):t.isNullOrUndefined(this.model.fields.child)&&this._childNodeCreation(i,u,r);else if(this.model.loadOnDemand){if(this._updateElement(u,!0),(i[r.hasChild]||i.hasOwnProperty("child"))&&(u.children[0].firstChild.className="e-icon e-plus"),this.model.showCheckbox&&this._checkboxOnTemplate(u.children[0]),i[r.expanded]&&this._childNodeCreation(i,u,r),this.model.enablePersistence&&(l=this._getCookies("_childNodes"),l))for(a=JSON.parse(l),c=0,b=a.length;c<b;c++)if(a[c].toString()==i[r.id].toString()){this._childNodeCreation(i,u,r);break}}else this._onlineData||(this._updateElement(u,!0),this.model.showCheckbox&&this._checkboxOnTemplate(u.children[0]),this._childNodeCreation(i,u,r));return u},_childNodeCreation:function(i,r,u){var f,s,h,e,o,c;if(f=this._templateType==2?!t.isNullOrUndefined(i.child)&&i.child.length>0&&i.child:this._getChildNodes(this._dataSource,{id:i[u.id]}),!t.isNullOrUndefined(f)&&f.length>0){for(r.children[0].firstChild.className="e-icon e-plus",s=document.createDocumentFragment(),h=document.createElement("ul"),s.appendChild(h),e=s.firstChild,e.className="e-treeview-ul",e.setAttribute("role","group"),n(e).attr("style","display:none"),o=0,c=f.length;o<c;o++)f[o]&&e.appendChild(this._genTemplate(f[o],u));r.appendChild(h)}},_checkboxOnTemplate:function(n){n.parentElement.id==""&&(n.parentElement.id=this._id+"_"+this._indexID,this._indexID++);var t=document.createElement("input");t.setAttribute("type","checkbox");t.setAttribute("class","nodecheckbox");t.setAttribute("name",this._id+"_Checkbox_"+n.parentElement.id);t.setAttribute("value",n.parentElement.id);n.insertBefore(t,n.children[1])},_updateElement:function(t,i){var f,e,u,o,s=t.firstChild,h,c,l;s&&(h=s.nodeName,h=="SPAN"||h=="IMG"?(o=s,u=t.lastChild):u=t.lastChild,u&&(l=u.lastChild!=null?u.lastChild.nodeValue:"",c=n.trim(u.innerHTML),textElement=n(u).clone()[0],n(u).remove(),textElement.className+=" e-text CanSelect",textElement.innerHTML=c,t.innerHTML=""),f=document.createElement("div"),f.setAttribute("class","e-text-wrap"),f.setAttribute("role","presentation"),i&&(e=document.createElement("div"),e.setAttribute("role","presentation"),f.appendChild(e)),o&&f.appendChild(o),f.appendChild(textElement),n(t).prop("name")==r&&n(t).prop("name",n.trim(l)),t.appendChild(f),this._renderWholeRow(n(t)))},_setAttributes:function(t,i){for(var r in t)n(i).attr(r,t[r])},_addDragableClass:function(){this.model.allowDragAndDrop&&(this._anchors=this._liList.map(function(){return n("a.e-text",this)[0]}),this._anchors.addClass("e-draggable e-droppable"),this._enableDragDrop(),this._on(this.element,"mouseup touchstart pointerdown MSPointerDown",this._anchors,this._focusElement))},_addBaseClass:function(){this._ulList.addClass("e-treeview-ul").attr("role","group");this._liList.addClass("e-item").attr("role","treeitem");this.element.is("ul")||this.element.find("ul:first").removeClass("e-treeview-ul").addClass("e-ul")},_controlRender:function(){var s=this.element,h,e,i,f,c,l,a,o,y,v,u,p;if(s!=null){for(h=s.find(".e-item"),e=0;e<h.length;e++)i=n(h[e]),a=i.children("ul")[0],a&&n(i.children("ul")[0]).remove(),o=i.children("a")[0],o?(l=n.trim(n(o).text()),f=n(o).clone(),n(o).remove(),c=i.clone(),n(f).prepend(c.children()),n(f).addClass("e-text CanSelect"),i.html("")):(l=n.trim(this._getText(i)),c=i.clone(),i.html(""),f=t.buildTag("a.e-text CanSelect","","",{alt:""}),f.append(c.children()),f[0].innerHTML+=l),y=t.buildTag("div","",{},{role:"presentation"}),v=t.buildTag("div.e-text-wrap","",{},{role:"presentation"}),n(v).append(y).append(f),i.prepend(v),this._renderWholeRow(i),a&&i.append(a),i.prop("name")==r&&i.prop("name",l),this.model.showCheckbox&&this._checkboxOnTemplate(h[e].children[0]);this.model.showCheckbox&&s.find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange})}u=s.find(".e-item");u.find(">ul").hide();p=u.find(".e-text");p.focus(function(){n(this).blur()});u.filter(".e-item:last-child").addClass("last");n(u[0]).addClass("first");n(u[0]).hasClass("first")&&n(u[0]).hasClass("last")&&n(u[0]).removeClass("first");n(u.filter(":has(ul)")).each(function(){n(this).attr("aria-expanded",!1).attr("aria-selected",!1);var t=n(this).children("ul:first");n(t).is(":hidden")?n(this).find("> div > div:first").removeClass("e-icon e-minus").addClass("e-icon e-plus"):n(this.childNodes[1]).removeClass("e-icon e-plus").addClass("e-icon e-minus")})},_getText:function(t){return n(t).clone().children().remove().end().text()},_expandNodes:function(i,r){for(var e,o=i.length,u=[],f=0;f<o;f++)(u=r?this._getNodeByID(i[f]):n(this._liList[i[f]]),t.isNullOrUndefined(u))||!this.model.enableMultipleExpand&&(e=u.siblings().find(">div>.e-minus").closest(".e-item"),e.length>0)||this.isExpanded(u)||(!this.model.loadOnDemand||this.dataSource()instanceof t.DataManager?this._expandNode(u):this._createChildNodesWhenExpand(u))},_checkedNodes:function(t){var r,i,u;for(t.length>0&&this._removeField(this._newDataSource,this.model.fields.isChecked),i=0,u=t.length;i<u;i++)r=n(this._liList[t[i]]),r[0]!=null&&this._nodeCheck(r.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},_finalize:function(){this.model.showCheckbox&&this.element.find(".e-item > div .nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange});this.model.allowEditing&&this._allowEditable()},_finalizeNode:function(){var a,h,r,o,c,y;this._isRender=!1;this._allowOnDemand=!0;var v=this.element,f=this._getCookies("_persistedValues"),i=[],u=[],l,e,s;if(!(this.model.expandedNodes instanceof Array&&this.model.expandedNodes.length>0))for(l=v.find("li.expanded"),o=l.length,r=0;r<o;r++)(a=n(l[r]),!this.model.enableMultipleExpand&&(h=a.siblings().find(">div>.e-minus").closest(".e-item"),h.length>0))||this._expandNode(a);if(f&&(e=JSON.parse(f),i=e.expandedNodes,u=[]),i&&i.length>0&&!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null){for(r=0,o=i.length;r<o;r++)if(u=this.element.find(".e-item#"+i[r]),u[0]!=null){if(!this.model.enableMultipleExpand&&(h=u.siblings().find(">div>.e-minus").closest(".e-item"),h.length>0))continue;!this.model.loadOnDemand||this.dataSource()instanceof t.DataManager?this._expandNode(u):this._createChildNodesWhenExpand(u)}}else s=JSON.parse(JSON.stringify(this.model.expandedNodes)),this._expandNodes(s);if(this.model.showCheckbox)if(f&&(e=JSON.parse(f),i=e.checkedNodes,u=[]),i&&i.length>0&&!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null)for(this._removeField(this._newDataSource,this.model.fields.isChecked),r=0,o=i.length;r<o;r++)u=this.element.find(".e-item#"+i[r]),u[0]!=null&&this._nodeCheck(u.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]);else s=JSON.parse(JSON.stringify(this.model.checkedNodes)),this._checkedNodes(s);this.model.checkedNodes instanceof Array&&this.model.checkedNodes.length>0||this.model.showCheckbox&&this._isCheckedAction();c=!1;f&&(e=JSON.parse(f),i=e.selectedNodes,c=!0);(!f||i&&i.length==0)&&(i=this.model.selectedNodes.length>0?this.model.selectedNodes:this.model.selectedNode==-1?[]:[this.model.selectedNode],c=!1);y={ctrlKey:!0};i&&i.length>0?this._doSelectNodes(i,c):this._isSelectedAction(y);this._isRender=!0;this._allowOnDemand=!1;v.find(".e-item.checked, .e-item.expanded, .e-item.selected").removeClass("checked expanded selected")},_doSelectNodes:function(t,i){for(var u,f={ctrlKey:!0},r=0,e=t.length;r<e;r++)if(u=i?this._getNodeByID(t[r]):n(this._liList[t[r]]),u[0]!=null&&this._nodeSelectionAction(u,f),!this.model.allowMultiSelection)break},_doUnselectNodes:function(n){for(var i,t=0,r=n.length;t<r;t++)if(i=this._getNodeByID(n[t]),i[0]!=null&&this._nodeUnSelectionAction(i),!this.model.allowMultiSelection)break},_updateSelectedNode:function(){var t=n(this._liList).find(".e-text.e-active").closest(".e-item"),i,u,f;if(this.model.selectedNodes=[],this.model.allowMultiSelection||(this.model.selectedNode=null),t[0]==r||t.length<=0){this._persistValues(this.model.selectedNodes,"selectedNodes");return}if(this.model.allowMultiSelection){for(i=0,u=t.length;i<u;i++)f=n(this._liList).index(t[i]),this.model.selectedNodes.push(f);this._persistValues(this.model.selectedNodes,"selectedNodes")}else this._isRender=!1,this._nodeSelectionAction(n(t[0])),this._isRender=!0},_setCookies:function(n,i){window.localStorage?window.localStorage.setItem(this._id+n,i):document.cookie&&t.cookie.set(this._id+n,i)},_getCookies:function(n){return window.localStorage?window.localStorage.getItem(this._id+n):window.cookie?t.cookie.get(this._id+n):void 0},_updateCheckedNodes:function(){for(var r=[],t=this.element.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox.checked").closest(".e-item"),i=0;i<t.length;i++)r.push(n(this._liList).index(t[i]));(r.length>0||t.length==0)&&(this.model.checkedNodes=r);t.length==0&&this.model.checkedNodes.push(-1);this._persistValues(this.model.checkedNodes,"checkedNodes")},_updateExpandedNodes:function(){var t,r=[],i,u;for(t=this.element.find(".e-item > div > .e-minus").closest(".e-item").addClass("e-collapse"),i=0,u=t.length;i<u;i++)r.push(n(this._liList).index(t[i]));(r.length>0||t.length==0)&&(this.model.expandedNodes=r);t.length==0&&this.model.expandedNodes.push(-1);this._persistValues(this.model.expandedNodes,"expandedNodes")},_isCheckedAction:function(){for(var r,u,f,i=this.element.find(".e-item.checked"),t=0;t<i.length;t++)if(r=n(i[t]).find(".e-item"),u=n(i[t]).find(".e-item.unchecked"),r.length==0||!(r.length>0&&u.length==r.length)||!this.model.autoCheck)for(this._nodeCheck(n(i[t]).find("> div > .e-chkbox-wrap > input.nodecheckbox:first")[0]),f=0;f<u.length;f++)this._nodeUncheck(n(u[f]).find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]);this.element.find(".e-item.checked, .e-item.unchecked").removeClass("checked unchecked")},_isExpandedAction:function(){for(var i,u,r=this.element.find("li.expanded"),f=r.length,t=0;t<f;t++)(i=n(r[t]),!this.model.enableMultipleExpand&&(u=i.siblings().find(" > div > .e-minus").closest(".e-item"),u.length>0))||this._expandNode(i);this.element.find(".e-item.expanded").removeClass("expanded")},_isSelectedAction:function(t){for(var r=this.element.find(".e-item.selected"),i=0,u=r.length;i<u;i++)if(r[i]!=null&&this._nodeSelectionAction(n(r[i]),t),!this.model.allowMultiSelection)break;this.element.find(".e-item.selected").removeClass("selected")},_checkedChange:function(t){if(t.isInteraction){var i=this.element.closest(".e-treeview.e-js").data("ejTreeView");action=t.isChecked?"_nodeCheck":"_nodeUncheck";i[action](n(this.element)[0],t)}},_doClickAnimation:function(t){var i=n(t.target);i!=r&&t.type!=r&&(i.addClass("e-animate"),i.is("A")&&i.hasClass("e-text")&&i.closest(".e-text-wrap").addClass("e-animate"))},_ClickEventHandler:function(i){var v=this,u,r=n(i.target),h=r.closest(".e-item").find("> div > div:first"),c,l,e,f,o,a,s;if(this._isPopup=!1,h&&!h.hasClass("e-process")&&(u=r.closest(".e-item"),!u.hasClass("e-node-disable"))){if(this.element.find(".e-animate").removeClass("e-animate"),this._doClickAnimation(i),c=u[0]!=null?u[0].getAttribute("id"):"",this._triggerEvent("nodeClick",{event:i,currentElement:r[0],id:c,parentId:u.closest("ul").closest(".e-item").attr("id")}),!t.isNullOrUndefined(r)&&r.is("DIV"))if(r.hasClass("e-plus")||r.hasClass("e-minus"))if(l=null,r.is("SPAN")&&(r=r.parent("div").find("div:first")),l=u.children("ul:first"),o=this.isChildLoaded(u),!o&&this.model.loadOnDemand){if(r.removeClass("e-plus").addClass("e-load"),this._checkboxChecked=r.parent().find(".nodecheckbox").hasClass("checked"),f=this._getNodeDetails(u),e={currentElement:u,targetElement:r[0],id:f.id,value:f.text,parentId:f.parentId,isChildLoaded:o,hasParent:!0,async:!0},this._isEventTriggered=!0,this._triggerEvent("beforeExpand",e))return!1;this._loadOnDemand(e,r[0])}else r.hasClass("e-plus")?this._expandNode(u):this._collpaseNode(u);else this.model.fullRowSelect&&(r.hasClass("e-fullrow")||r.hasClass("e-text-wrap"))&&(r=r.closest(".e-item").find("> .e-text-wrap .e-text"));r.is("A")||r.hasClass("input-text")||(r=r.closest(".e-text"));!t.isNullOrUndefined(r)&&r.is("A")&&r.hasClass("CanSelect")&&(i&&i.pointerType=="touch"&&this._customPop!=null&&this.model.allowMultiSelection?(a=n(i.target),this._customPop.is(":visible")||this._customPop.show(),this._customPop.is(":visible")&&!this._customPop.find(".e-rowselect").hasClass("e-spanclicked")?(s=a.offset(),this._customPop.offset({left:s.left,top:s.top-40})):i.ctrlKey=!0):this._hidePopup(),r.hasClass("e-active")?this.model.allowMultiSelection&&this._nodeUnSelectionAction(r.closest(".e-item"),i):this._nodeSelectionAction(r.closest(".e-item"),i))}},_getChildTables:function(n,i,r){if(!t.isNullOrUndefined(n.child))return i==r?n.child:this._getChildTables(n.child,i,r+1)},_loadOnDemand:function(i){var u,e,r,f=this,o;if(this.dataSource()instanceof t.DataManager){if(e=i.currentElement.parents("ul").length,r=this._getChildTables(f.model.fields,e,1),t.isNullOrUndefined(r)&&t.isNullOrUndefined(this.model.fields.child)&&(r=this.model.fields),!r){n(i.targetElement).hasClass("e-load")&&n(i.targetElement).removeClass(n(i.targetElement).hasClass("e-plus")||n(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load");return}r.query&&r.query.queries.length>0&&(r.query.queries=[]);o=this._executeDataQuery(r,r.parentId,this._typeOfFieldId=="number"?parseInt(i.currentElement[0].id):i.currentElement[0].id);o.done(function(t){u=t.xhr&&t.xhr.responseJSON&&t.xhr.responseJSON.d?t.xhr.responseJSON.d:t.result?t.result:[];u=f._getSortAndFilterList(r,u);u.length>0?(f._onlineData=!0,f._loadChildNodeWhenOnDemand(u,i,r)):n(i.targetElement).hasClass("e-load")&&n(i.targetElement).removeClass(n(i.targetElement).hasClass("e-plus")||n(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load")})}else u=this._getChildNodes(this._dataSource,i),!t.isNullOrUndefined(u)&&u.length>0?setTimeout(function(){f._createSubNodesWhenLoadOnDemand(u,i.targetElement,f.model.fields)},400):n(i.targetElement).hasClass("e-load")&&n(i.targetElement).removeClass(n(i.targetElement).hasClass("e-plus")||n(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load")},_loadChildNodeWhenOnDemand:function(n,i,r){var u=this;!t.isNullOrUndefined(n)&&n.length>0&&setTimeout(function(){u._createSubNodesWhenLoadOnDemand(n,i.targetElement,r)},100)},_createSubNodesWhenLoadOnDemand:function(t,i,r){this._loadOnDemandNodes=!0;this._templateNodeCreation(t,r);n(this._fragment.firstChild).attr("style","display:none");this._fragment.firstChild.className="e-treeview-ul";this._fragment.firstChild.setAttribute("role","group");i.parentNode.parentNode.appendChild(this._fragment);var u=n(i).closest(".e-item");u.attr({"aria-expanded":!1,"aria-expanded":!0});n(i).removeClass("e-load").addClass("e-plus");this._expandNode(u);this._finalizeLoadOnDemand(u)},_finalizeLoadOnDemand:function(n){var r,u,i,f;this._beforeBaseClass();this._isRender=!1;this.model.showCheckbox&&(n.children("ul").find("li > div > input.nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),r=n.children("ul").find(".e-item"),u=n.children("ul").find(".e-item.unchecked"),u.length>=0&&u.length!=r.length&&this._checkboxChecked?r.not(".unchecked").addClass("checked"):u.length==r.length&&this.isNodeChecked(n)&&this._nodeUncheck(n.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]),this._isLoaded&&(this._isCheckedAction(),this._updateCheckedNodes()));this._isRender=!0;this._addDragableClass();this._preventEditable();this.model.allowEditing&&this._allowEditable();this._isLoaded&&(this._isSelectedAction(),this._updateSelectedNode(),this._allowOnDemand=!0,this._isExpandedAction(),this._updateExpandedNodes(),this._allowOnDemand=!1);!this.model.loadOnDemand||!this.model.enablePersistence||this.dataSource()instanceof t.DataManager||(f=this._getCookies("_childNodes"),f&&(i=JSON.parse(f)),!t.isNullOrUndefined(i)&&i.indexOf(n[0].id)==-1?i.push(n[0].id):i=[n[0].id],this._setCookies("_childNodes",JSON.stringify(i)))},_getChildNodes:function(n,i){var u=[],r,f;if(this._templateType==1){for(r=0,f=n.length;r<f;r++)if(!t.isNullOrUndefined(n[r][0])&&!t.isNullOrUndefined(n[r][0][this.model.fields.parentId])&&n[r][0][this.model.fields.parentId]==i.id)return n[r]}else{for(r=0,f=n.length;r<f;r++){if(n[r][this.model.fields.id]==i.id)return n[r].child;if(n[r].hasOwnProperty("child")&&(u=this._getChildNodes(n[r].child,i),!t.isNullOrUndefined(u)&&u.length>0))break}return u}},_getPath:function(n){for(var i=n.prop("name"),t=n.parents(".e-item:first");t[0]!=null&&t[0].parentNode.id!=this._id;)i=t.prop("name")+"/"+i,t=t.parents(".e-item:first");return this._id+"/"+i},_nodeSelectionAction:function(t,i){var v,e,r,h,c;if(t[0]!=null||t.length!=0){var l=n(t.find("> div > .e-text")[0]),a=!1,y=this.model.selectedNodes.slice(),o=this._liList.index(t[0]);if(this._currNode=t,!this._triggerEvent("beforeSelect",{target:t,nodeDetails:this._getNodeDetails(t)})){if(this.model.allowMultiSelection&&i&&(!i||i.ctrlKey)||(this.element.find("a.e-text.e-active").removeClass("e-node-focus e-active"),this.element.find("[aria-selected=true]").attr("aria-selected",!1),this.element.find(".e-li-active").removeClass("e-li-active"),this.model.fullRowSelect&&(this.element.find(".e-li-focus").removeClass("e-li-focus"),this.element.find(".e-node-focus").removeClass("e-node-focus")),this.element.find("#"+this._id+"_active").removeAttr("id"),this.model.selectedNodes=[],this._deepWatch&&this._removeField(this._newDataSource,this.model.fields.selected)),this.model.allowMultiSelection&&i&&i.shiftKey){this._startNode||(this._startNode=this._currNode);var s=this.getVisibleNodes(),u=s.index(this._startNode),f=s.index(t[0]);for(u>f&&(v=u,u=f,f=v),e=u;e<=f;e++)r=n(s.get(e)),h=this._liList.index(r[0]),n.inArray(h,this.model.selectedNodes)==-1&&(this.model.selectedNodes.push(h),c=r.find("> div > a.e-text"),c.removeClass("e-node-focus"),r.attr("aria-selected",!0),r.addClass("e-li-active"),c.addClass("e-active"),a=!0,this._deepWatch&&this._updateField(this._newDataSource,r.attr("id"),this.model.fields.selected,!0))}else this._startNode=t;this.model.allowMultiSelection||(this.model.selectedNode=o);a||(this.element.find("a.e-text.e-node-focus").removeClass("e-node-focus"),t.attr("aria-selected",!0),t.addClass("e-li-active"),l.addClass("e-active"),this.model.allowMultiSelection||l.attr("id",this._id+"_active"),n.inArray(o,this.model.selectedNodes)==-1&&this.model.selectedNodes.push(o),this._deepWatch&&this._updateField(this._newDataSource,t.attr("id"),this.model.fields.selected,!0));this.model.enablePersistence&&this._persistValues(this.model.selectedNodes,"selectedNodes");this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerGivenEvent("nodeSelect",t)}}},_nodeUnSelectionAction:function(n,t){if(this.model.allowMultiSelection&&t&&!t.ctrlKey){this._nodeSelectionAction(n,t);return}n.removeClass("e-li-active");n.attr("aria-selected",!1).find("> div > .e-text").removeClass("e-active").attr("id","");this._updateUnselectModel(n[0]);this._deepWatch&&(this._updateField(this._newDataSource,n.attr("id"),this.model.fields.selected,!1),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerGivenEvent("nodeUnselect",n)},_updateUnselectModel:function(t){var r=this._liList.index(t),u=this.model.selectedNodes,i;this.model.allowMultiSelection||(this.model.selectedNode=null);i=n.inArray(r,u);i>-1&&this.model.selectedNodes.splice(i,1);this._persistValues(this.model.selectedNodes,"selectedNodes")},_triggerGivenEvent:function(n,t){if(this._isRender){var i={currentElement:t,value:t.find("> div > a.e-text").eq(0).text(),id:t[0].getAttribute("id"),parentId:t.closest("ul").closest(".e-item").attr("id"),selectedNodes:this.model.selectedNodes};this._triggerEvent(n,i)}},_getNodesIndex:function(n){for(var i=[],t=0,r=n.length;t<r;t++)i.push(this._liList.index(n[t]));return i},_nodeEnableAction:function(n){var t=this.getParent(n);t[0]!=null&&t.hasClass("e-node-disable")||(this.model.showCheckbox&&n.find("div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("enable").prop("disabled",!1),n.find(".e-text").removeClass("e-node-disable").closest(".e-item").removeClass("e-node-disable").removeProp("disabled"))},_nodeDisableAction:function(n){var i,t,r;for(this._collpaseNode(n),this.model.showCheckbox&&n.find("div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("disable").prop("disabled",!0),i=n.find(".e-text.e-active").closest(".e-item"),n.find(".e-text").addClass("e-node-disable").removeClass("e-active").attr("id","").closest(".e-item").addClass("e-node-disable").prop("disabled",!0),t=0,r=i.length;t<r;t++)this._updateUnselectModel(i[t])},_getNodeDetails:function(n){if(n[0]!=null&&n.is("LI")&&n.hasClass("e-item")){var i,r,t,u,f,e,o,s,h;return i=n[0].getAttribute("id"),r=n.children("div").find(".e-text:first").text(),t=n.closest("ul").closest(".e-item").attr("id"),u=n.parents("ul").length,f=n.find(".e-item").length,e=this._isNodeExpanded(n),o=this._isChecked(n),s=n.find("> div > .e-text").hasClass("e-active"),h=this._liList.index(n),{id:i,text:r,parentId:t?t:"",level:u,count:f,expanded:e,checked:o,selected:s,index:h}}return{id:"",text:"",parentId:"",level:"",count:"",expanded:"",checked:"",selected:"",index:""}},_denyMultipleExpand:function(t){for(var r=t.siblings().find(">div>.e-minus").closest(".e-item"),i=0,u=r.length;i<u;i++)this._collpaseNode(n(r[i]))},_expandCollapseAction:function(t){if(t&&!t.hasClass("e-process")){var f,o=this,i,r,u,e;if(i=t.closest(".e-item"),t.is("SPAN")&&(t=n(t).parent("div").find("div:first")),f=i.children("ul:first"),f.find("> .e-item").length>0){if(this.model.enableAnimation&&t.addClass("e-process"),r=this._getNodeDetails(i),e=this.isChildLoaded(i),u={currentElement:i,value:r.text,isChildLoaded:e,id:r.id,parentId:r.parentId,async:!1},!this._isNodeExpanded(i)&&e){if(!this._isEventTriggered&&this._triggerEvent("beforeExpand",u))return!1;this._isEventTriggered=!1;i.attr("aria-expanded",!0);this._addExpandedNodes(this._liList.index(i));n(t).removeClass("e-icon e-plus").addClass("e-icon e-minus");i.addClass("e-collapse");this._deepWatch&&this._updateField(this._newDataSource,r.id,this.model.fields.expanded,!0);this._doAnimation(f,t,"nodeExpand",u,350)}else{if(this.element.find(".e-material-animate").removeClass("e-material-animate"),i.attr("aria-expanded",!1),this._triggerEvent("beforeCollapse",u)===!0)return!1;this._removeExpandedNodes(this._liList.index(u.currentElement));n(t).removeClass("e-icon e-minus").addClass("e-icon e-plus");i.removeClass("e-collapse");this._deepWatch&&this._updateField(this._newDataSource,r.id,this.model.fields.expanded,!1);this._doAnimation(f,t,"nodeCollapse",u,200)}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))}}},_doAnimation:function(n,i,r,u,f){var e=this;this.model.enableAnimation?n.animate({height:"toggle"},f,"linear",function(){t.isNullOrUndefined(e.model)||e._doAnimateAction(i,r,u)}):(n.css("display",f==200?"none":"block"),this._doAnimateAction(i,r,u))},_doAnimateAction:function(n,t,i){n.removeClass("e-process");this._triggerEvent(t,i)},_isChecked:function(n){return n.find("> div > .e-chkbox-wrap:first").attr("aria-checked")==="true"?!0:!1},_doRecursiveCheck:function(t,i){var o,r,f,t,u,s,e;u=this._getChildUl(t);o=u?u.querySelectorAll('.e-chkbox-wrap[aria-checked="true"]').length:0;s=u?u.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[];r=t.firstChild.querySelector(".nodecheckbox");r&&r.nodeName.toUpperCase()=="INPUT"&&(e=n(r).data("ejCheckBox"),o==s.length||this.model.autoCheckParentNode?(e.setModel({enableTriState:!1,checked:!0}),r.className+=" checked",f=t.firstChild.getElementsByTagName("a")[0].innerHTML,i.push({id:t.id,text:f}),this._deepWatch&&!this.model.autoCheckParentNode&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(r,f),this._addCheckNodes(this._liList.index(t))):e.setModel({enableTriState:!0,checkState:"indeterminate"}),t=t.parentNode.parentNode,t.nodeName.toUpperCase()=="LI"&&this._doRecursiveCheck(t,i))},_nodeCheck:function(t,i){var s,r,u,h,e,o,c,f,l;if(n(t)[0]!=null){if(this._CurrenctSelectedNodes=[],this._checkedArray=[],t.className+=" checked",s=n(t).data("ejCheckBox"),s){if(s.setModel({enableTriState:!1,checked:!0}),r=t.parentNode.parentNode.parentNode,u=r.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._checkedArray.push({id:r.id,text:u}),this._deepWatch&&this._updateField(this._newDataSource,r.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(t,u),this._addCheckNodes(this._liList.index(r)),this.model.autoCheck){for(c=this._getChildUl(r),e=c?c.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],f=0,l=e.length;f<l;f++)n(e[f]).ejCheckBox({checked:!0,enableTriState:!1})[0].className+=" checked",o=e[f].parentNode.parentNode.parentNode,u=o.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._checkedArray.push({id:o.id,text:u}),this._deepWatch&&this._updateField(this._newDataSource,o.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(e[f],u),this._addCheckNodes(this._liList.index(o));h=r.parentNode.parentNode;h.nodeName.toUpperCase()=="LI"&&this._doRecursiveCheck(h,this._checkedArray)}i&&(i.checknode=this._checkedArray);this._onChecked(n(t),i)}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._persistValues(this.model.checkedNodes,"checkedNodes")}},_addHiddenInputElement:function(n,t){if(n.firstChild==null){var i=document.createElement("input");i.setAttribute("type","hidden");i.setAttribute("name",this._id+"_Checkbox_"+n.value+".Text");i.setAttribute("value",t);try{n.appendChild(i)}catch(r){}}},_doRecursiveUncheck:function(t,i){var e,r,o,t,u,s,f;u=this._getChildUl(t);e=u?u.querySelectorAll('.e-chkbox-wrap[aria-checked="true"]').length:0;s=u?u.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[];r=t.firstChild.querySelector(".nodecheckbox");r&&r.nodeName.toUpperCase()=="INPUT"&&(f=n(r).data("ejCheckBox"),e<=0&&(f.setModel({enableTriState:!1,checked:!1}),n(r).removeClass("checked").removeClass("checked").children().remove(),o=t.firstChild.getElementsByTagName("a")[0].innerHTML,this._removeCheckNodes(this._liList.index(t)),i.push({id:t.id,text:o}),this._deepWatch&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)),e>0&&this.model.autoCheckParentNode?(f.setModel({checked:!0}),r.className+=" checked",o=t.firstChild.getElementsByTagName("a")[0].innerHTML,this._addHiddenInputElement(t,o),this._deepWatch&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)):e>0&&!this.model.autoCheckParentNode&&(s.length>1?f.setModel({enableTriState:!0,checkState:"indeterminate"}):f.setModel({checked:!1}),n(r).removeClass("checked").removeClass("checked").children().remove(),this._removeCheckNodes(this._liList.index(t)),this._deepWatch&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)),t=t.parentNode.parentNode,t.nodeName.toUpperCase()=="LI"&&this._doRecursiveUncheck(t,i))},_nodeUncheck:function(t,i){var e,u,r,f;if(n(t)[0]!=null){if(e=this,this._uncheckedArray=[],currentLi=t.parentNode.parentNode.parentNode,n(currentLi).find("div > .e-chkbox-wrap > .nodecheckbox").removeClass("checked").children().remove(),chkObj=n(t).data("ejCheckBox"),this._removeCheckNodes(this._liList.index(currentLi)),chkObj){if(chkObj.setModel({enableTriState:!1,checked:!1}),textvalue=currentLi.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._uncheckedArray.push({id:currentLi.id,text:textvalue}),this._deepWatch&&this._updateField(this._newDataSource,currentLi.id,this.model.fields.isChecked,!1),this.model.autoCheck){for(childUl=this._getChildUl(currentLi),u=childUl?childUl.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],r=0,f=u.length;r<f;r++)n(u[r]).ejCheckBox({enableTriState:!1,checked:!1}),liElement=u[r].parentNode.parentNode.parentNode,textvalue=liElement.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._uncheckedArray.push({id:liElement.id,text:textvalue}),this._deepWatch&&this._updateField(this._newDataSource,liElement.id,this.model.fields.isChecked,!1),this._removeCheckNodes(this._liList.index(liElement));parentLi=currentLi.parentNode.parentNode;parentLi.nodeName.toUpperCase()=="LI"&&this._doRecursiveUncheck(parentLi,this._uncheckedArray)}i&&(i.unchecknode=this._uncheckedArray);this._onUnChecked(n(t),i)}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._persistValues(this.model.checkedNodes,"checkedNodes")}},_executeDataQuery:function(i,r,u){var f,o,e;if(f=t.Query(),f=this._columnToSelect(i),!t.isNullOrUndefined(r)&&r!=""){for(o=n.extend(!0,[],f._params),f._params=[],f.addParams(r,u),e=0;e<o.length;e++)o[e].key!=r&&f.addParams(o[e].key,o[e].value);f.where(r,t.FilterOperators.equal,u)}return i.dataSource.executeQuery(f)},_createChildNodesWhenExpand:function(i,r,u,f,e,o){var a,v,h,y,p,s,c,w,l;if(i.length>0&&i.find("ul .e-item").length==0){if(a=i.attr("id"),v=i.children("div").find(".e-text:first").text(),y=i.children("div").find("div.e-plus:first"),h={currentElement:i,targetElement:y[0],id:a,value:v,isChildLoaded:!1,hasParent:!0,async:!1},c=this,this._isEventTriggered=!0,this._triggerEvent("beforeExpand",h))return!1;if(this.dataSource()instanceof t.DataManager){if(p=h.currentElement.parents("ul").length,s=this._getChildTables(this.model.fields,p,1),t.isNullOrUndefined(s)&&t.isNullOrUndefined(this.model.fields.child)&&(s=this.model.fields),!s){n(h.targetElement).hasClass("e-load")&&n(h.targetElement).removeClass(n(h.targetElement).hasClass("e-plus")||n(h.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load");return}s.query&&s.query.queries.length>0&&(s.query.queries=[]);this._treeList.push("false");w=this._executeDataQuery(s,s.parentId,this._typeOfFieldId=="number"?parseInt(h.currentElement[0].id):h.currentElement[0].id);w.done(function(n){c._treeList.pop();l=n.xhr&&n.xhr.responseJSON&&n.xhr.responseJSON.d?n.xhr.responseJSON.d:n.result?n.result:[];l=c._getSortAndFilterList(s,l);c._appendChild(l,i,s,r,u,f);u&&c._expandByLevel(i.find("> ul"),u-1,f);c._treeList.length==0&&(e&&c._doAfterExpand(i,e,o),c._completeRendering())})}else l=this._getChildNodes(this._dataSource,{id:i[0].id}),this._appendChild(l,i,this.model.fields,r,u,f)}else this._expandNode(i)},_appendChild:function(i,r,u,f,e,o){var h,s,c;if(!t.isNullOrUndefined(i)&&i.length>0){if(this._checkboxChecked=r.find("> div > .e-chkbox-wrap > .nodecheckbox").hasClass("checked"),this._loadOnDemandNodes=!0,r.find("ul .e-item").length==0&&(this._templateNodeCreation(i,u),r.append(this._fragment)),this._finalizeLoadOnDemand(r),this._expandNode(r),f&&!e&&!o)for(h=r.find(".e-item > div > .e-plus").closest(".e-item"),s=0,c=h.length;s<c;s++)this._createChildNodesWhenExpand(n(h[s]),!0,null,o)}else f&&r.find("> div > .e-plus").removeClass("e-plus e-icon")},_getSortAndFilterList:function(n,i){var r,u;return!i||!i.length||i.length<1?r=[]:(u=t.Query(),this._addSortingQuery(u,n),r=t.DataManager(i).executeLocal(u)),r},_addSortingQuery:function(n,i){if(this.model.sortSettings.allowSorting){var r=i&&i.text?i.text:"text",u=this.model.sortSettings.sortOrder==t.sortOrder.Descending?!0:!1;n.sortBy(r,u)}},_expandNode:function(n){var t,i;return n[0]!=null&&n.length>0&&(t=n.find("> div > div:first"),this.model.loadOnDemand&&!this.model.enablePersistence?n.find("> ul > .e-item").length>0&&t.hasClass("e-plus")?(this.model.enableMultipleExpand||this._denyMultipleExpand(n),this._expandCollapseAction(n.find("> div > div.e-plus:first"))):t.hasClass("e-icon")&&!t.hasClass("e-minus")&&this._allowOnDemand&&this._createChildNodesWhenExpand(n):t.hasClass("e-plus")&&(i=n.find("> ul > .e-item").length>0?!0:!1,i&&(this.model.enableMultipleExpand||this._denyMultipleExpand(n),this._expandCollapseAction(t)))),!0},_collpaseNode:function(n){if(n[0]!=null&&n.length>0&&n.find("> ul > .e-item").length>0){var t=n.find("> div > div:first");t.hasClass("e-minus")&&this._expandCollapseAction(t)}},_getElement:function(){return this.element.is("UL")?this.element:this.element.find("> ul")},_getImmediateChild:function(n,t){return t?n.find("> .e-item:not(:hidden)"):n.find("> .e-item")},_expandByLevel:function(n,t,i){t>0&&this._expandByNode(this._getImmediateChild(n,i),t,i)},_expandByNode:function(t,i,r){for(var u=0,f=t.length;u<f;u++)n(t[u]).find("> div > div").hasClass("e-plus")&&(this.model.loadOnDemand?this._createChildNodesWhenExpand(n(t[u]),!0,i,r):this._expandNode(n(t[u]))),this._expandByLevel(n(t[u]).find("> ul"),i-1,r)},_expandAll:function(t){var u=this.element,i,r;if(r=u.find(t?".e-item > div > .e-plus:not(:hidden)":".e-item > div > .e-plus").closest(".e-item"),this.model.loadOnDemand)for(i=0,len=r.length;i<len;i++)this._createChildNodesWhenExpand(n(r[i]),!0,null,t);else for(i=0,len=r.length;i<len;i++)this._expandNode(n(r[i]))},_collapseByLevel:function(n,t,i){t>0&&this._collapseByNode(this._getImmediateChild(n,i),t,i)},_collapseByNode:function(t,i,r){for(var u=0,f=t.length;u<f;u++)n(t[u]).find("> div > div").hasClass("e-minus")&&this._collpaseNode(n(t[u])),this._collapseByLevel(n(t[u]).find("> ul"),i-1,r)},_collapseAll:function(t){var u=this.element,i,r;if(r=u.find(t?".e-item > div > .e-minus:not(:hidden)":".e-item > div > .e-minus").closest(".e-item"),r.length>0)for(i=0,len=r.length;i<len;i++)this._collpaseNode(n(r[i]))},_checkAll:function(){this._CurrenctSelectedNodes=[];var r=this.element,t;for(t=r.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox"),t.addClass("checked"),i=0,len=t.length;i<len;i++)n(t[i]).ejCheckBox("setModel",{checked:!0}),this._addHiddenInputElement(t[i],n(t[i]).parent().siblings(".e-text")[0].lastChild.nodeValue);this.model.checkedNodes=this.getCheckedNodesIndex()},_uncheckAll:function(){var r=this.element,t;for(t=r.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox"),t.removeClass("checked").children().remove(),i=0,len=t.length;i<len;i++)n(t[i]).ejCheckBox("setModel",{checked:!1});this.model.checkedNodes=[];this.model.checkedNodes.push(-1)},_selectAll:function(){var r,t,u,i;for(this._isRender=!1,r={ctrlKey:!0},t=0,u=this._liList.length;t<u;t++)if(i=n(this._liList[t]),i[0]!=null&&this._nodeSelectionAction(i,r),!this.model.allowMultiSelection)break;this._isRender=!0},_unselectAll:function(){this.element.find("a.e-text.e-active").removeClass("e-node-focus e-active");this.element.find("[aria-selected=true]").attr("aria-selected",!1);this.element.find(".e-li-active").removeClass("e-li-active");this.element.find(".e-li-focus").removeClass("e-li-focus");this.element.find(".e-node-focus").removeClass("e-node-focus");this.model.selectedNodes=[];this.model.enablePersistence&&this._persistValues(this.model.selectedNodes,"selectedNodes")},_isNodeExpanded:function(n){if(n[0]!=null)return n.children("ul:first").length>0&&n.find("> div > div.e-minus").length>0},_showCheckBox:function(){for(var t=this.element,i=t.find("li"),n=0;n<i.length;n++)this._checkboxOnTemplate(i[n].children[0]);t.find(".e-item > div > .nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange});t.find(".e-item.e-node-disable > div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("disable")},_drag:function(){var i,u=!1,o=t.browserInfo(),r=null,s=null,f=null,e;e=o.name=="msie"&&o.version=="8.0"?!0:!1;this.element.is("ul")?(this._treeView=this.element.parent(),this.model.allowDragAndDropAcrossControl||(f=this.element.parent())):(this._treeView=this.element,this.model.allowDragAndDropAcrossControl||(f=this.element));n(this._treeView).find("ul li div a").not(".e-js").ejDraggable({dragArea:f,clone:!0,dragStart:function(u){if(!i||t.isNullOrUndefined(u.target)||n(u.target).hasClass("e-node-disable")||i.element.find(".e-item > div > .e-text.e-editable").length!=0||(u.element.attr("aria-grabbed",!0),i.element.closest(".e-treeview-wrap").addClass("e-dragging"),n(u.target).is("A")&&!n(u.target).hasClass("e-draggable")))return!1;e&&(document.ondragstart=function(){return!1});var f={target:n(u.target).closest(".e-item"),targetElementData:i._getNodeDetails(n(u.target).closest(".e-item")),dragTarget:u.target,parentElement:n(u.target).closest("ul").closest(".e-item"),parentElementData:i._getNodeDetails(n(u.target).closest("ul").closest(".e-item")),event:u.event};if(i._triggerEvent("nodeDragStart",f))return u.cancel=!0,r&&r.remove(),!1},drag:function(f){var e,o,h,s,c;return u=!1,n(".e-sibling").remove(),e=f.target,o=i._findTarget(n(e)),n(e).closest(".e-treeview-wrap").addClass("e-dragging"),n(r).css({"margin-left":"20px","margin-top":f.event.clientY-20<0?"0px":"10px",display:"table"}),n(r).find("> a.e-text").css({display:"table-cell","white-space":"nowrap",margin:"0 0 1px"}),n(r).find(">.e-dropedStatus").css({display:"table-cell"}),h={draggedElement:n(f.element).closest(".e-item"),draggedElementData:i._getNodeDetails(n(f.element).closest(".e-item")),dragTarget:e,target:o,targetElementData:i._getNodeDetails(o),event:f.event},(n(f.element).parent().parent().has(n(e)).length==0||i.model.allowMultiSelection&&i.model.selectedNodes.length>1)&&(n(e).hasClass("e-droppable")||n(e).parent().hasClass("e-droppable"))&&n(e).hasClass("e-dropchild")&&!n(e).hasClass("e-node-disable")&&(i.model.allowDragAndDropAcrossControl||!i.model.allowDragAndDropAcrossControl&&n(e).parents(".e-treeview").is(i.element))?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"),n(e).addClass("allowDrop")):n(e).hasClass("e-droppable")&&!n(e).hasClass("e-item")&&!n(e).hasClass("e-text")||n(e).is("UL")&&n(e).hasClass("e-ul")&&n(e).find(".e-item").length==0&&n(e).parent(".e-treeview-wrap").length>0?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus")):(n(e).hasClass("e-sibling")||n(e).find("a").hasClass("e-text"))&&(n(e).hasClass("e-sibling")||n(e).parent().parent().hasClass("e-item")||n(e).parent().hasClass("e-item")||n(e).hasClass("e-item")||n(e).hasClass("e-text"))&&(e.nodeName.toUpperCase()!="LI"&&(e.parentElement===null||e.parentElement.nodeName.toUpperCase()!="LI")||this.model.allowDropSibling)&&(i.model.allowDragAndDropAcrossControl||n(e).parents(".e-treeview").is(i.element))||(document.body.style.cursor="not-allowed",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-minus"),n(e).removeClass("showline-hover"),n(e).removeClass("noline-hover")),e.nodeName!="A"&&(n(f.element).parent().parent().has(n(e)).length==0||i.model.allowMultiSelection&&i.model.selectedNodes.length>1)&&n(f.element).parent().parent()[0]!=n(e)[0]?(e.nodeName=="UL"&&n(e).children()[0]!=null&&(e=n(e).children()[0],u=!0),e.nodeName!="LI"&&(e=n(e).closest(".e-droppable")[0]||n(e).parent()),e.nodeName=="LI"&&n(e).hasClass("e-droppable")&&n(e).hasClass("e-dropsibling")&&(i.model.allowDragAndDropAcrossControl||!i.model.allowDragAndDropAcrossControl&&n(e).parents(".e-treeview").is(i.element))?(s=t.buildTag("div.e-sibling"),c=n(e).offset().top+n(e).find("a").height()||-1,u=f.event.pageY>c?!1:!0,u?s.insertBefore(n(e).find("> div > a").parent()):s.insertAfter(n(e).find("> div > a").parent()),n(e).parents().hasClass("e-rtl")?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-insertInbetween-rtl")):(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-insertInbetween"))):e.nodeName=="A"&&n(e)&&n(e).hasClass("e-droppable")&&n(e).hasClass("e-dropchild")?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"),n(e).addClass("allowDrop")):!n(e).hasClass("e-droppable")||n(e).hasClass("e-item")||n(e).hasClass("e-text")||(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"))):n(".e-sibling").remove(),i._triggerEvent("nodeDrag",h)?!1:void 0},dragStop:function(t){var f,o,s,c,h,l;if((e&&(document.ondragstart=function(){return!0}),t.element.dropped||(r&&r.remove(),document.body.style.cursor=""),f=t.target,n(f).closest(".e-treeview-wrap").removeClass("e-dragging"),i.element.closest(".e-treeview-wrap").removeClass("e-dragging"),f.className=="e-sibling"&&(f=n(f).closest(".e-item")[0]),n(".e-sibling").remove(),n(f).hasClass("e-node-disable"))||(o=u?"Before":"After",trgtEle=i._findTarget(n(f)),o=f.nodeName=="A"?"Over":o,s={draggedElementData:i._getNodeDetails(n(t.element).closest(".e-item")),draggedElement:n(t.element).closest(".e-item"),dropTarget:n(f),target:trgtEle,targetElementData:i._getNodeDetails(trgtEle),position:o,event:t.event},i._triggerEvent("nodeDragStop",s)))return!1;if(i.model.allowMultiSelection&&n(t.element).hasClass("e-active"))for(c=i.element.find(".e-item > div > .e-active"),h=0,l=c.length;h<l;h++)t.element=c[h],o=i._dropNode(f,t,o,u);else o=i._dropNode(f,t,o,u);if(n(".allowDrop").removeClass("allowDrop"),n(t.element).attr("aria-grabbed",!1),n(f).hasClass("e-dropchild")||r&&r.remove(),trgtEle=i._findTarget(n(f)),s={droppedElementData:i._getNodeDetails(n(t.element).closest(".e-item")),droppedElement:n(t.element).closest(".e-item"),dropTarget:n(f),target:trgtEle,targetElementData:i._getNodeDetails(trgtEle),position:o,event:t.event},i._triggerEvent("nodeDropped",s))return!1;document.body.style.cursor=""},helper:function(u){var e,o,f,h;if(!t.isNullOrUndefined(u.element)&&!n(u.element).hasClass("e-node-disable")&&n(u.element).hasClass("e-draggable")&&(i=n(u.element).closest(".e-treeview.e-js").data("ejTreeView"),i))return r=t.buildTag("div.e-dragedNode e-widget"),e=t.util.getZindexPartial(i.element),r.css({"z-index":e}),r.addClass(i.model.cssClass+(i.model.enableRTL?" e-rtl":"")),o=i.element.find(".e-item > div > .e-active"),f=o.length,s=n(u.element).clone().addClass("dragClone"),this.spanEle=t.buildTag("span.e-icon e-plus e-dropedStatus"),r.append(this.spanEle),r.append(s),h=t.buildTag("span.e-drop-count",f),f>1&&i.model.allowMultiSelection&&n(u.element).hasClass("e-active")&&r.append(h),r.appendTo(n("body"))}})},_dropNode:function(t,i,r,u){return t.nodeName=="A"&&n(t).hasClass("e-dropchild")&&n(t).hasClass("e-droppable")||t.nodeName=="UL"&&n(t).children().length==0?(r="Over",n(t).is("UL")&&n(t).hasClass("e-ul")&&n(t).find(".e-item").length==0&&n(t).parent(".e-treeview-wrap").length>0?this._dropAsChildNode(n(t),n(i.element),i.event):n(i.element).parent().parent().has(n(t)).length==0&&(n(t).parent().parent().has(n(i.element)).length==0||this._isDescendant(n(t).parents("li:last").find(">ul>li"),n(i.element).parents("li:first")[0]))&&(this.model.allowDragAndDropAcrossControl||!this.model.allowDragAndDropAcrossControl&&n(t).parents(".e-treeview").is(this.element))&&this._dropAsChildNode(n(t).closest(".e-item"),n(i.element),i.event)):(t.nodeName=="UL"&&(t=n(t).children()[0]),t.nodeName!="LI"&&(t=n(t).closest(".e-droppable")[0]||n(t).parent()),t.nodeName=="LI"&&n(t).hasClass("e-dropsibling")&&n(t).hasClass("e-droppable")?n(i.element).parent().parent().has(n(t)).length<1&&n(i.element).parent().parent()[0]!=n(t)[0]&&(this.model.allowDragAndDropAcrossControl||!this.model.allowDragAndDropAcrossControl&&n(t).parents(".e-treeview").is(this.element))&&this._dropAsSiblingNode(n(t),n(i.element),u,i.event):t.nodeName=="A"&&n(t).hasClass("e-dropchild")&&n(t).hasClass("e-droppable")&&(r="Over",n(i.element).parent().parent().has(n(t)).length==0&&(n(t).parent().parent().has(n(i.element)).length==0||this._isDescendant(n(t).parents("li:last").find(">ul>li"),n(i.element).parents("li:first")[0]))&&this._dropAsChildNode(n(t).closest(".e-item"),n(i.element),i.event))),r},_findTarget:function(n){return n.hasClass("e-text")?n.closest(".e-item"):n.closest("ul").closest(".e-item").length>0?n.closest("ul").closest(".e-item"):this.element.find(n).length>0&&!this.model.template?n.parents("ul").first():this.element.find(n).length>0&&this.model.template?n.closest(".e-item"):n},_isDescendant:function(t,i){var r=!0;return n(t).each(function(n,t){if(t==i)return r=!1,!1;r=!0}),r},_childDrop:function(){n(this._treeView).find("ul .e-item div .e-text").ejDroppable({accept:n(this._treeView).find("ul .e-item div .e-text").addClass("e-dropchild"),drop:function(t,i){n(i.helper).hide()}})},_siblingDrop:function(){n(this._treeView).find("ul .e-item").addClass("e-dropsibling").ejDroppable({drop:function(t,i){n(i.helper).hide()}})},_dropAsSiblingNode:function(i,r,u){var f=r.parent().parent(),f=n(f),e;e=n(r.parents(".e-item")[1]);t.isNullOrUndefined(this.model.fields)||this.dataSource()==null||this.dataSource()instanceof t.DataManager||this._updateDataSource(r.parents(".e-item:first"),n(i),u,this);u?f.insertBefore(i):f.insertAfter(i);this.model.template||this._autoGenerateNodes(r.parents(".e-item:first"));this._modifyCss(e);this._isRender=!1;this._updateCheckState(f);this._updateCheckState(e);this._isRender=!0;f.find("> div > .e-minus").length>0&&!this.model.enableMultipleExpand&&this._denyMultipleExpand(f);this._updateChanges(n(i))},_dropAsChildNode:function(i,r){var u=r.parent().parent(),u=n(u),f;f=n(r.parents(".e-item")[1]);n(i).is("UL")?n(i).append(u):this._appendNode(i,u);t.isNullOrUndefined(this.model.fields)||this.dataSource()==null||this.dataSource()instanceof t.DataManager||this._updateDataSource(r.parents(".e-item:first"),n(i).find("> div > .e-text").first(),"",this);this.model.template||this._autoGenerateNodes(r.parents(".e-item:first"));this._modifyCss(f);this._isRender=!1;this._updateCheckState(u);this._updateCheckState(f);this._isRender=!0;i.find("> div > .e-icon.e-plus:first").length>0&&this._expandNode(i);this._updateChanges(n(i))},_updateChanges:function(t){if(n(t)[0]!=null){var i=this,r=0;do i._updateNodes(),r++,i=t.closest(".e-treeview.e-js").data("ejTreeView");while(i&&this._id!=i._id&&r==1)}},_updatePersistProb:function(){var r,t,f,u,i,e;for(this._removeField(this._newDataSource,this.model.fields.selected),this._removeField(this._newDataSource,this.model.fields.expanded),r=this.getSelectedNodes(),t=0,f=r.length;t<f;t++)this._updateField(this._newDataSource,n(r[t]).attr("id"),this.model.fields.selected,!0);for(u=this.getExpandedNodes(),i=0,e=u.length;i<e;i++)this._updateField(this._newDataSource,n(u[i]).attr("id"),this.model.fields.expanded,!0)},_orderDataSource:function(){var f,r,u,e,i,o;for(this._beforeBaseClass(),f=[],r=this._newDataSource,this._updatePersistProb(),u=0,e=this._liList.length;u<e;u++)for(i=0,o=r.length;i<o;i++)if(!t.isNullOrUndefined(r[i])&&!t.isNullOrUndefined(r[i][this.model.fields.id])&&r[i][this.model.fields.id].toString()==n(this._liList[u]).attr("id")){n(this._liList[u]).find("> ul .e-item").length==0?delete r[i][this.model.fields.hasChild]:this._templateType==1&&(r[i][this.model.fields.hasChild]=!0);f.push(r[i]);break}return f},_updateDataSource:function(i,r,u,f){var o,e,c,s,l,h,a;n(i)[0]!=null&&n(r)[0]!=null&&(o=f,e=r.closest(".e-treeview.e-js").data("ejTreeView"),!o||!e||t.isNullOrUndefined(e.model.fields)||e.dataSource()==null||e.dataSource()instanceof t.DataManager||(r.is("A")?(c=r.closest(".e-item").attr("id"),l=r.closest(".e-item").find("> ul > .e-item"),s=l.length>0?l.length:r.closest(".e-item").index()):(c=r.parents(".e-item:first").attr("id"),h=r.next(".e-item"),a=r.prev(".e-item"),s=h.length>0?s=a.length>0?h.index()-1:u?r.index():h.index():u?r.index():r.index()+1),e&&o._findAndUpdate(i.attr("id"),c,o._newDataSource,s,e,r,u)))},_removeObject:function(n,i,r){for(var u=0,f=n.length;u<f;u++)if(!t.isNullOrUndefined(n[u])&&!t.isNullOrUndefined(n[u][r])&&n[u][r].toString()==i){n.splice(u,1);break}},_getObjectPosition:function(n,i,r){for(var f,u=0,e=n.length;u<e;u++){if(!t.isNullOrUndefined(n[u])&&!t.isNullOrUndefined(n[u][r])&&n[u][r].toString()==i)return u;if(n[u].hasOwnProperty("child")&&(f=this._getObjectPosition(n[u].child,i,r),f>=0))return f}return-1},_convertDataSourceTypes:function(n,t){for(var i=0;i<n.child.length;i++)n.child[i][this.model.fields.parentId]=n[this.model.fields.id],t.push(n.child[i]),n.child[i].hasOwnProperty("child")&&n.child[i].child.length>0&&this._convertDataSourceTypes(n.child[i],t);return n.child&&(delete n.child,n[this.model.fields.hasChild]=!0),t},_childObjectCollection:function(n,t,i,r){for(var f,u=0,e=n.length;u<e;u++)f=this._getChildNodes(t,{id:n[u][this.model.fields.id]}),f&&(r==2?(i[u].hasOwnProperty("child")||(i[u].child=[]),i[u].child=this._childObjectCollection(f,t,f,r)):(i=i.concat(f),i=this._childObjectCollection(f,t,i,r)));return i},_updateCopyData:function(t,i,u){var f=i.model.fields,e;return temp=u,arr=JSON.parse(JSON.stringify(u[t])),proxy=this,n.each(this.model.fields,function(n){(n!=="dataSource"||n!=="query")&&temp[t][proxy.model.fields[n]]!==r&&(delete arr[proxy.model.fields[n]],arr[f[n]]=temp[t][proxy.model.fields[n]])}),n.extend(e,arr,!1)},_updateDataFields:function(n,t,i,r,u){for(var e=[],f=0,o=t.length;f<o;f++)u==1&&(this._removeObject(n,i,this.model.fields.parentId),delete t[f][this.model.fields.parentId],delete t[f][this.model.fields.hasChild]),t[f].hasOwnProperty("child")&&(t[f].child=this._updateDataFields(n,t[f].child,t[f][this.model.fields.id],r,u)),e.push(this._updateCopyData(f,r,t));return e},_findAndUpdate:function(n,i,r,u,f,e,o){var a,w,k,b,tt,y,g,c,p,s,v,h;if(!t.isNullOrUndefined(r))if(this._templateType==1){for(c=0,p=r.length;c<p;c++)if(!t.isNullOrUndefined(r[c])&&!t.isNullOrUndefined(r[c][this.model.fields.id])&&r[c][this.model.fields.id].toString()==n){if(this._id==f._id)t.isNullOrUndefined(i)?delete r[c][this.model.fields.parentId]:r[c][this.model.fields.parentId]=i,a=this.dataSource(),w=this,this._deepWatch&&(k=r.splice(c,1),h=this._getObjectPosition(a,e.attr("id"),this.model.fields.id),h>=0&&!e.is("A")?r.splice(o?h:h+1,0,k[0]):r.push(k[0]),this._oldDataSource=JSON.parse(JSON.stringify(r)),this.dataSource(r)),this._templateType=this._getTemplateType(a,this.model.fields),this._dataSource=this._templateType==1?this._groupingObjects(a,function(n){return[!t.isNullOrUndefined(n)&&[n[w.model.fields.parentId]].toString()]}):a;else{var s=[],l,w=this,d,v=[],nt=[];if(d=this._groupingObjects(r,function(n){return[!t.isNullOrUndefined(n)&&[n[w.model.fields.parentId]].toString()]}),nt=r.splice(c,1),s.push(this._updateCopyData(0,f,nt)),l=this._getChildNodes(d,{id:n}),l&&l.length>0&&(l=this._childObjectCollection(l,d,l,f._templateType)),f._templateType==2)l&&l.length>0&&(y=this._updateDataFields(r,l,n,f,this._templateType),s[0].hasOwnProperty("child")||(s[0].child=[]),s[0].child=y),delete s[0][f.model.fields.parentId],delete s[0][f.model.fields.hasChild],f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h=h>=0&&!e.is("A")?o?h:h+1:u,i?f._changeObjectPos(i,s,f._newDataSource,h):f._newDataSource.splice(h,0,s[0])):i?f._changeObjectPos(i,s,f._newDataSource,u):f._newDataSource.splice(u,0,s[0]);else{if(l&&l.length>0){for(b=0,tt=l.length;b<tt;b++)this._removeObject(r,l[b][this.model.fields.id],this.model.fields.id);this._dataSource=this._templateType==1?this._groupingObjects(r,function(n){return[!t.isNullOrUndefined(n)&&[n[w.model.fields.parentId]].toString()]}):r}if(i?s[0][f.model.fields.parentId]=i:delete s[0][f.model.fields.parentId],f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h>=0&&!e.is("A")?f._newDataSource.splice(o?h:h+1,0,s[0]):f._newDataSource.push(s[0])):f._newDataSource.push(s[0]),y=[],l&&l.length>0){if(!(this.dataSource()instanceof t.DataManager)){for(c=0;c<l.length;c++)y.push(this._updateCopyData(c,f,l));l=y}g=f._newDataSource=f._newDataSource.concat(l);f._dataSource=f._templateType==1?f._groupingObjects(g,function(n){return[!t.isNullOrUndefined(n)&&[n[f.model.fields.parentId]].toString()]}):g}}f._deepWatch&&(f.dataSource(f._newDataSource),f._oldDataSource=JSON.parse(JSON.stringify(f._newDataSource)));this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))}break}}else for(c=0,p=r.length;c<p;c++){if(r[c][this.model.fields.id].toString()==n)return s=r.splice(c,1),this._id==f._id?this._deepWatch?(h=this._getObjectPosition(this._newDataSource,e.attr("id"),this.model.fields.id),h=h>=0&&!e.is("A")?o?h:h+1:u,i?this._changeObjectPos(i,s,this._newDataSource,h):this._newDataSource.splice(h,0,s[0]),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource)):i?this._changeObjectPos(i,s,this._newDataSource,u):this._newDataSource.splice(u,0,s[0]):(s=this._updateDataFields(r,s,n,f,this._templateType),f._templateType==1?(v=[],s[0].hasOwnProperty("child")?(v=f._convertDataSourceTypes(s[0],v),s[0]=s.concat(v)):s[0]=s.concat(),i?s[0][0][f.model.fields.parentId]=i:delete s[0][0][f.model.fields.parentId],f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h>=0&&!e.is("A")?f._newDataSource.splice(o?h:h+1,0,s[0][0]):f._newDataSource.push(s[0][0]),f._newDataSource=f._newDataSource.concat(v)):f._newDataSource=f._newDataSource.concat(s[0])):f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h=h>=0&&!e.is("A")?o?h:h+1:u,i?f._changeObjectPos(i,s,f._newDataSource,h):f._newDataSource.splice(h,0,s[0])):i?f._changeObjectPos(i,s,f._newDataSource,u):f._newDataSource.splice(u,0,s[0]),f._deepWatch&&(f.dataSource(f._newDataSource),f._oldDataSource=JSON.parse(JSON.stringify(f._newDataSource))),this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))),!0;if(r[c].hasOwnProperty("child")&&this._findAndUpdate(n,i,r[c].child,u,f,e,o))break}},_changeObjectPos:function(n,t,i,r){for(var u=0,f=i.length;u<f;u++){if(i[u][this.model.fields.id].toString()==n)return i[u].hasOwnProperty("child")?i[u].child.splice(r,0,t[0]):(i[u].child=[],i[u].child.push(t[0])),!0;if(i[u].hasOwnProperty("child")&&this._changeObjectPos(n,t,i[u].child,r))break}},_finalizeEditing:function(t){if(n(t)[0]!=null){var i=t.closest(".e-treeview.e-js").data("ejTreeView");i&&(i._preventEditable(),i.model.allowEditing&&i._allowEditable())}},_updateCheckState:function(n){var t,i,r;this._isTreeElement(n)&&(t=n.closest(".e-treeview.e-js").data("ejTreeView"),t&&t.model.showCheckbox&&(i=n.children("ul").find(".e-item > div > .e-chkbox-wrap > .checked").closest(".e-item").addClass("checked"),i.length>0?t._isCheckedAction():(r=t.isNodeChecked(n)?"_nodeCheck":"_nodeUncheck",t[r](n.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]))))},_autoGenerateNodes:function(t){var i,u,r,f;if(n(t)[0]!=null)if(i=t.closest(".e-treeview.e-js").data("ejTreeView"),i&&i.model.showCheckbox){if(t.find(".e-chkbox-wrap").length==0){for(this._checkboxOnTemplate(t[0].children[0]),u=t.find(".e-item"),r=0,f=u.length;r<f;r++)this._checkboxOnTemplate(u[r].children[0]);t.find(".nodecheckbox").ejCheckBox({cssClass:i.model.cssClass,change:i._checkedChange})}}else t.find(".e-chkbox-wrap").remove()},_appendNode:function(i,r){var u,o,f,s,e;for(this._isTreeElement(i)?(i.find("ul")[0]==null?(u=i.closest(".e-treeview.e-js").data("ejTreeView"),u&&(s=this._isNodeExpanded(i),!s&&u.model.loadOnDemand&&i.find("> div > div").first().hasClass("e-plus")&&u._createChildNodesWhenExpand(i,null,null,null,r,u)),this.dataSource()instanceof t.DataManager&&u.model.loadOnDemand&&i.find("> div > div").first().hasClass("e-plus")||this._doAfterExpand(i,r,u),this._deepWatch&&this._templateType==1&&(this._updateField(this._newDataSource,i.attr("id"),this.model.fields.hasChild,!0),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))):n(i.find("ul")[0]).append(r),this.isDisabled(i)||this._expandNode(i)):this.element.is("UL")?this.element.append(r):this.element.children("ul:first").length>0?this.element.children("ul:first").append(r):(o=t.buildTag("ul.e-treeview-ul","",{},{role:"group"}),o.append(r),this.element.append(o)),f=this.element.find(".e-item.expanded"),e=0;e<f.length;e++)this.model.loadOnDemand&&!(this.dataSource()instanceof t.DataManager)?this._createChildNodesWhenExpand(n(f[e])):this._expandNode(n(f[e]));f.removeClass("expanded");this.model.showCheckbox&&this._isCheckedAction()},_doAfterExpand:function(i,r,u){var e=t.buildTag("ul.e-treeview-ul","",{},{role:"group",style:"display:none"}),f;n(e).append(n(r));n(i.find("div")[1]).length==0?(f=document.createElement("div"),f.setAttribute("role","presentation"),f.className="e-icon e-minus",n(i.find("div")).append(n(f))):n(i.find("div")[1]).hasClass("e-minus")||n(i.find("div")[1]).addClass("e-icon e-plus");u&&u.model.loadOnDemand&&i.find("ul").length>0?i.children("ul").append(n(r)):i.append(n(e))},_modifyCss:function(t){t=n(t);t[0]!=null&&t.find(".e-item").length==0&&(t.removeClass("e-collapse").attr("aria-expanded",!1).find("> div > .e-icon").removeClass("e-icon e-minus").closest(".e-item").find("ul").remove(),this._deepWatch&&(this._updateField(this._newDataSource,t.attr("id"),this.model.fields.expanded,!1),this._templateType==1&&this._updateField(this._newDataSource,t.attr("id"),this.model.fields.hasChild,!1),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource)))},_applyFirstLastChildClass:function(){n(this._liList).removeClass("first last").filter(":first-child:not(:last-child)").addClass("first");n(this._liList).filter(":last-child").addClass("last")},_expandEventHandler:function(t){var i=n(t.target),r,u;i.hasClass("e-icon")||i.closest(".e-item").hasClass("e-node-disable")||t.type==="dblclick"&&this.model.allowEditing||(t.preventDefault(),r=i.is("A")?n(i.siblings("div")):n(i.parent().siblings("div")),this.model.fullRowSelect&&(i.is("div.e-text-wrap")||i.is("div.e-fullrow"))&&(r=i.closest(".e-item").find("> .e-text-wrap > div")),u=i.closest(".e-item"),r.hasClass("e-minus")?this._collpaseNode(u):this.model.loadOnDemand&&r.find(".e-item").length==0?this._ClickEventHandler({target:r[0]}):this._expandNode(u))},_inlineEdit:function(t){t.preventDefault();var i=n(t.target);return i.hasClass("input-text")||i.hasClass("e-node-disable")||(i.is("A")||(i=i.closest(".e-text")),i.is("A")&&!i.hasClass("e-node-disable")&&this._inlineEditAction(i)),!1},_inlineEditAction:function(n){var t=this.element.find(".e-item > div > .e-text > #Edit_Input");t[0]==null&&this._createEditTextBox(n)},_createEditTextBox:function(i){var f={currentElement:i},r,e,u;return this._triggerEvent("beforeEdit",f)?!1:(r=this.element.find(".e-item > div > .e-text > #Edit_Input"),r[0]==null&&(u=t.buildTag("Input.input-text#Edit_Input","","",{type:"text",value:n.trim(i.text()).replace(/\n\s+/g," "),name:"inplace_value"}),u.width(i.outerWidth()+5),u.height(i.outerHeight()),u.addClass("e-tree-input e-textbox"),this._beforeEditText=i.text(),i[0].lastChild.nodeValue="",i.addClass("e-editable").append(u),r=u,e=r.val().length==""?3:i.outerWidth()+20,this._mousePositionAtEnd(r),this._currentEditableNode=i,this._on(r,"keypress",this._editTextBoxKeyPress)._on(r,"keydown",this,this._pressEscKey)._on(r,"mousedown pointerdown MSPointerDown",this,this._preventPropagation)._on(r,this.model.expandOn,this,this._preventPropagation)._on(r,"blur",this._focusout)),r)},_preventPropagation:function(n){n.stopImmediatePropagation();this._isTextbox=!0},_editTextBoxKeyPress:function(n){n.target.size=n.target.value.length+1},_mousePositionAtEnd:function(n){return n.focus&&n.focus(),n.select&&n.select(),!0},_focusElement:function(t){if(!this._isTextbox){if(t&&(t.type=="touchstart"||t.type=="pointerdown"||t.type=="MSPointerDown")){var i=n(t.currentTarget);i.hasClass("e-text")&&this.selectNode(i.closest(".e-item"))}this.element.focus()}},_focusout:function(t){var i=n(t.currentTarget),r;this._isTextbox=!1;r={id:i.closest(".e-item").attr("id"),oldText:this._beforeEditText,newText:i.val()};this._triggerEvent("inlineEditValidation",r)?this._cancelAction(i):this._saveAction(i,t)},_pressEscKey:function(i){var r,u,f;i.cancelBubble=!0;i.returnValue=!1;r=n(i.currentTarget);r[0]!=null&&(i.keyCode==13&&(i.stopPropagation(),this._focusout(i)),i.keyCode==27&&this._cancelAction(r),(i.keyCode==13||i.keyCode==27)&&(u=t.browserInfo(),f=u.name=="msie"&&u.version=="8.0"?!0:!1,f&&this.element.focus()))},_onFocusHandler:function(n){n.preventDefault()},_onKeyDown:function(n,t){n.find("> div > .e-text:first").removeClass("e-node-focus");t.find("> div > .e-text:first").addClass("e-node-focus");this.model.fullRowSelect&&(n.removeClass("e-li-focus"),t.addClass("e-li-focus"))},_KeyPress:function(t){var f,r=this,o,e,i,p,s,h,w,l,a,v,k,b,y,u,c,d;if(c=this.element.is("ul")?this.element:this.element.find("> ul"),f=t.keyCode?t.keyCode:t.which?t.which:t.charCode,r.model.allowKeyboardNavigation&&r.element.find("#Edit_Input").length<1&&r.element.find(".e-chkbox-wrap.e-focus").length<1)if(this.element.find(".e-animate").removeClass("e-animate"),o=n(c.find(".e-item > div > .e-text.e-active").closest(".e-item")[0]),e=c.find(".e-item:visible"),r._focusedNode?(i=r._focusedNode,r._focusedNode=null):i=c.find(".e-text.e-node-focus").closest(".e-item"),f==113&&(t.preventDefault(),c=i.length>0?i:o,c.length>0&&r.model.allowEditing&&!this.model.template&&(t.target=c.find("> div > .e-text:first"),r._inlineEdit(t))),f!=40||t.altKey)if(f!=38||t.altKey)if((f!=39||this.model.enableRTL||t.altKey)&&(f!=37||!this.model.enableRTL))if((f!=37||this.model.enableRTL||t.altKey)&&(f!=39||!this.model.enableRTL)){if(f!=36||t.altKey){if(f!=35||t.altKey){if(f==13)t.preventDefault(),u=i.length>0?i:o,k=u.find("> div > .e-text"),k.removeClass("e-node-focus"),this.model.fullRowSelect&&u.removeClass("e-li-focus"),k.hasClass("e-active")?r.model.allowMultiSelection&&r._nodeUnSelectionAction(u,event):r._nodeSelectionAction(u,t),r._focusedNode=u;else if(f==32)t.preventDefault(),u=i.length>0?i:o,u.length>0&&this.model.showCheckbox&&(b=u.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0],b.checked?this._nodeUncheck(b):this._nodeCheck(b),r._focusedNode=u);else if(f==46)t.preventDefault(),u=i.length>0?i:this.model.allowMultiSelection?c.find(".e-item > div > .e-text.e-active").closest(".e-item"):o,u.length>0&&this._removeNode(u,t);else if(t&&t.ctrlKey==!0)if(f==88&&this.model.allowDragAndDrop&&this.model.allowDropChild){if(t.preventDefault(),u=i.length>0?i:o,u.length>0){if(y=u.parents(".e-item:first"),this._triggerEvent("beforeCut",{target:u,nodeDetails:this._getNodeDetails(u),keyCode:f,event:t}))return;this._cutNode=n(e[e.index(u)]).detach();n(this._cutNode)[0]!=null&&(this._isRender=!1,this.unselectNode(u),y.find("> ul > .e-item").length==0&&(this.collapseNode(y),this._modifyCss(y)),this._isRender=!0,this._triggerEvent("nodeCut",{parentElement:y,parentDetails:this._getNodeDetails(y),keyCode:f,event:t}))}}else if(f==86&&this._cutNode!=null&&this.model.allowDragAndDrop&&this.model.allowDropChild){if(t.preventDefault(),u=i.length>0?i:o,u=n(e[e.index(u)]),u.length===0&&(u=this.element),c=this._cutNode.find(" > div > .e-text").first(),n(e).length>0){if(this._triggerEvent("beforePaste",{target:u,nodeDetails:this._getNodeDetails(u),keyCode:f,event:t}))return;this._isRender=!1;this._dropAsChildNode(u,c,t);this._isRender=!0;this._cutNode=null;d=c.closest(".e-item");this._triggerEvent("nodePaste",{target:d,nodeDetails:this._getNodeDetails(d),keyCode:f,event:t})}}else r.model.allowMultiSelection&&(r._focusedNode=i)}else if(t.preventDefault(),v=i.length>0?i:o,a=n(e).last(),(a.hasClass("e-node-disable")||a.hasClass("hidden"))&&(a=this._getPrevEle(e,a)),o.length>0&&i.length==0&&o[0]!=a[0]||i.length>0&&i[0]!=a[0]){if(r._KeyPressEventHandler(a,r,f,t))return;r._onKeyDown(v,a)}}else if(t.preventDefault(),v=i.length>0?i:o,l=n(e).first(),(l.hasClass("e-node-disable")||l.hasClass("hidden"))&&(l=this._getNextEle(e,l)),o.length>0&&i.length==0&&o[0]!=l[0]||i.length>0&&i[0]!=l[0]){if(r._KeyPressEventHandler(l,r,f,t))return;r._onKeyDown(v,l)}}else if(t.preventDefault(),w=i.length>0?i.find("> div > div").first():o.find("> div > div").first(),h=w.closest(".e-item"),w.hasClass("e-minus"))this._collpaseNode(n(e[e.index(w.closest(".e-item"))]));else{if(h=n(e[e.index(h)]).closest("ul").closest(".e-item"),r._KeyPressEventHandler(h.length>0?h:"",r,f,t))return;h.length>0&&r._onKeyDown(i,h)}else if(t.preventDefault(),p=i.length>0?i.find("> div > div").first():o.find("> div > div").first(),s=p.closest(".e-item"),p.hasClass("e-plus"))this.model.loadOnDemand&&s.find("> ul .e-item").length==0?this._ClickEventHandler({target:p[0]}):this._expandNode(n(e[e.index(s)]));else{if(s=this._getNextEle(e,s),r._KeyPressEventHandler(s.length>0?s:"",r,f,t))return;(s.length>0&&s[0]==p.closest(".e-item").find("ul > .e-item:first")[0]||s.find("ul > .e-item").first().hasClass("e-node-disable"))&&r._onKeyDown(i,s)}else{if(t.preventDefault(),v=i.length>0?i:o,h=this._getPrevEle(e,v),r._KeyPressEventHandler(h.length>0?h:null,r,f,t))return;h.length>0&&r._onKeyDown(i,h)}else{if(t.preventDefault(),v=i.length>0?i:o,s=this._getNextEle(e,v),r._KeyPressEventHandler(s.length>0?s:null,r,f,t))return;s.length>0&&r._onKeyDown(i,s)}},_getNextEle:function(t,i){var u=t.index(i),r;do u++,r=n(t[u]);while(r.hasClass("e-node-disable")||r.hasClass("hidden"));return r},_getPrevEle:function(t,i){var u=t.index(i),r;do u--,r=n(t[u]);while(r.hasClass("e-node-disable")||r.hasClass("hidden"));return r},_removeChildNodes:function(n,i,r){for(var f,e=0,o,u=0;u<i.length;u++)if(!t.isNullOrUndefined(i[u][0][this.model.fields.parentId])&&i[u][0][this.model.fields.parentId].toString()==r){e=i[u].length;break}for(u=0;u<e;u++)for(f=0;f<n.length;f++)if(!t.isNullOrUndefined(n[f][this.model.fields.parentId])&&n[f][this.model.fields.parentId].toString()==r){t.isNullOrUndefined(n[f])||(o=n[f][this.model.fields.id].toString());n.splice(f,1);this._removeChildNodes(n,i,o);break}},_removeNode:function(i,r){var f,c,l,h,a,o,s,e,u;if(i[0]!=null&&i[0]!=null&&i.length>0){if(e=this,f=n(i[0]).closest("ul").closest(".e-item"),o=n(i[0]),this._triggerEvent("beforeDelete",{target:o,nodeDetails:this._getNodeDetails(o),parentElement:f[0]!=null?f:null,parentDetails:this._getNodeDetails(f),event:r,removedNodes:i}))return;if(this._isRender=!1,!t.isNullOrUndefined(this.dataSource())&&this.dataSource().length>0){for(u=this.dataSource(),h=0,a=i.length;h<a;h++)for(o=n(i[h]),s=0;s<u.length;s++)if(c=o.attr("id"),u[s][this.model.fields.id].toString()==c){l=this._groupingObjects(u,function(n){return[!t.isNullOrUndefined(n)&&[n[e.model.fields.parentId]].toString()]});u.splice(s,1);this._removeChildNodes(u,l,c);break}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(u)),this.dataSource(u))}if(i.remove(),this._modifyCss(f),this._updateNodes(),this._updateCheckState(f),this._isRender=!0,this._triggerEvent("nodeDelete",{parentElement:f[0]!=null?f:null,parentDetails:this._getNodeDetails(f),event:r,removedNodes:i}))return;e=this;u=this.dataSource();setTimeout(function(){e.dataSource()==null||e.dataSource()instanceof t.DataManager||(e._dataSource=e._groupingObjects(u,function(n){return[!t.isNullOrUndefined(n)&&[n[e.model.fields.parentId]].toString()]}))},300)}},_updateNodes:function(){this._beforeBaseClass();this._applyFirstLastChildClass();this._updateExpandedNodes();this._updateCheckedNodes();this._updateSelectedNode()},_updateField:function(n,i,r,u){var f,e,o;if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)&&!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(r))if(this._templateType==1){for(f=0,e=n.length;f<e;f++)if(!t.isNullOrUndefined(n[f])&&!t.isNullOrUndefined(n[f][this.model.fields.id])&&n[f][this.model.fields.id].toString()==i){n[f][r]=u;u==!1&&delete n[f][r];o=n[f];n.splice(f,1,o);break}}else for(f=0,e=n.length;f<e;f++){if(n[f][this.model.fields.id].toString()==i){n[f][r]=u;u==!1&&delete n[f][r];o=n[f];n.splice(f,1,o);break}n[f].hasOwnProperty("child")&&this._updateField(n[f].child,i,r,u)}},_removeField:function(n,i){if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)&&!t.isNullOrUndefined(n))for(var u=0;u<n.length;u++)n[u][i]!=r&&delete n[u][i],n[u].hasOwnProperty("child")&&this._removeField(n[u].child,i)},_KeyPressEventHandler:function(t,i,r,u){var f,e,o,s;return n(t)[0]!=null?(s=this._isNodeExpanded(t),f=this._getNodeDetails(t),o=i._getPath(t),e={keyCode:r,currentElement:t,value:f.text,isExpanded:s,path:o,event:u,id:f.id,parentId:f.parentId}):e={keyCode:r,currentElement:t,value:"",isExpanded:"",path:"",event:u,id:"",parentId:""},this._triggerEvent("keyPress",e)},_documentClick:function(t){var i,e,u,f;if(t.target.id!="Edit_Input"&&(i=n("#Edit_Input")[0]),i!=null){var e=n(i).closest(".e-text")[0],u=i.value,r=n(i).closest(".e-item");n(i).remove();e.lastChild.nodeValue=u;n(e).removeClass("e-editable").removeAttr("style");this._updateField(this._newDataSource,r.attr("id"),this.model.fields.text,u);this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerEvent("nodeEdit",{id:r.attr("id"),oldText:this._beforeEditText,newText:u,target:r,nodeDetails:this._getNodeDetails(r),event:t})}this.element.find(t.target).length==0?(f=this.element.find(".e-item > div > .e-text.e-node-focus"),this._focusedNode=f.closest(".e-item"),f.removeClass("e-node-focus")):n(t.target).hasClass("e-active")&&(this._focusedNode=this.element.find(t.target).closest(".e-item"))},_saveAction:function(t,i){var u=t.val(),r=t.closest(".e-item"),f=t.closest(".e-text")[0];t.remove();f!=null&&(f.lastChild.nodeValue=u,n(f).removeClass("e-editable"),this._updateField(this._newDataSource,r.attr("id"),this.model.fields.text,u),this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource)),this._triggerEvent("nodeEdit",{id:r.attr("id"),oldText:this._beforeEditText,newText:u,target:r,nodeDetails:this._getNodeDetails(r),event:i}),this.element.focus(),this._focusedNode=r)},_cancelAction:function(t){var i=t.closest(".e-text")[0];t.remove();i.lastChild.nodeValue=this._beforeEditText;n(i).removeClass("e-node-hover e-editable");this.element.focus()},_mouseEnterEvent:function(t){this.element.find(".e-node-hover").removeClass("e-node-hover");n(t.currentTarget).hasClass("e-text")&&!n(t.currentTarget).hasClass("e-node-disable")&&n(t.currentTarget).addClass("e-node-hover")},_mouseLeaveEvent:function(t){n(t.currentTarget).removeClass("e-node-hover")},_liMouseEnterEvent:function(t){this.element.find(".e-node-hover").removeClass("e-node-hover");this.element.find(".e-li-hover").removeClass("e-li-hover");var r=n(t.currentTarget).closest(".e-item"),i=r.find("> div .e-text");i.length>0&&!i.hasClass("e-node-disable")&&(i.addClass("e-node-hover"),r.addClass("e-li-hover"))},_liMouseLeaveEvent:function(t){var i=n(t.currentTarget).closest(".e-item");i.find("> div .e-text").removeClass("e-node-hover");i.removeClass("e-li-hover")},_onFocusOutHandler:function(){this._isPopup||this._hidePopup();this._isPopup=!1},_createObjectByText:function(t,i){if(typeof t=="string"){var r={};return r[this.model.fields.text]=t,n(i)[0]!=null&&(r[this.model.fields.parentId]=i[0].getAttribute("id")),r}},_addNodesWhenObject:function(i,r){var l=JSON.stringify(this._dataSource),f=this.dataSource(),e,h,u,o,s,c;if(this._dataSource=[],this.dataSource()!=null&&this.dataSource()instanceof t.DataManager&&(f=[]),r[0]!=null&&r.length>0&&(e=r[0].getAttribute("id")),t.isNullOrUndefined(i.length))this._dataSource.push(i),t.isNullOrUndefined(this.dataSource())||(this._setNodeId(i,this.model.fields),t.isNullOrUndefined(e)||(i[this.model.fields.parentId]=e),f.push(i));else if(this._dataSource=i,!t.isNullOrUndefined(this.dataSource()))for(u=0;u<i.length;u++)this._setNodeId(i[u],this.model.fields),e?i[u][this.model.fields.parentId]=e:delete i[u][this.model.fields.parentId],f.push(i[u]);for(h=this._templateType,this._templateType=2,this._liList||(this._liList=n("li",this.element)),o=document.createDocumentFragment(),s=0,c=this._dataSource.length;s<c;s++)o.appendChild(this._genTemplate(this._dataSource[s],this.model.fields)),this._liList.push(n(o).children()[0]);return this._templateType=h,this.dataSource()==null||this.dataSource()instanceof t.DataManager||(this._dataSource=JSON.parse(l),this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(f)),this.dataSource(f))),o},_setNodeId:function(n,i){var u=i&&i.id?i.id:this.model.fields.id,f,r,e;if((t.isNullOrUndefined(n[u])||n[u]=="")&&(n[u]=this._id+"_"+this._indexID,this._indexID++),n.hasOwnProperty("child"))for(f=n.child,r=0,e=f.length;r<e;r++)this._setNodeId(f[r],i.child)},_addExpandedNodes:function(t){var i=this.model.expandedNodes;this._removeNullInArray(i);n.inArray(t,i)==-1&&this.model.expandedNodes.push(t);this._persistValues(this.model.expandedNodes,"expandedNodes")},_removeExpandedNodes:function(t){var i=this.model.expandedNodes;n.inArray(t,i)>-1&&(this.model.expandedNodes.splice(n.inArray(t,i),1),i.length==0&&i.push(-1));this._persistValues(this.model.expandedNodes,"expandedNodes")},_persistValues:function(i,r){var f,o,c,s,u,l,h,e;if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null){for(f=i,o=[],u=0,l=f.length;u<l;u++)!t.isNullOrUndefined(f[u])&&f[u]>=0&&(c=this._liList[f[u]],s=n(c).attr("id"),s&&o.push(s));h=this._getCookies("_persistedValues");h&&(e=JSON.parse(h),e[r]=o,e=this._updatePersistAttr(e),this._setCookies("_persistedValues",JSON.stringify(e)))}},_updatePersistAttr:function(i){return t.isNullOrUndefined(this._ignoreOnPersist)?(n.inArray("selectedNodes",this._addToPersist)==-1&&delete i.selectedNodes,n.inArray("expandedNodes",this._addToPersist)==-1&&delete i.expandedNodes,n.inArray("checkedNodes",this._addToPersist)==-1&&delete i.checkedNodes):(n.inArray("selectedNodes",this._ignoreOnPersist)>-1&&delete i.selectedNodes,n.inArray("expandedNodes",this._ignoreOnPersist)>-1&&delete i.expandedNodes,n.inArray("checkedNodes",this._ignoreOnPersist)>-1&&delete i.checkedNodes),i},_onChecked:function(n,i){var r=n.closest(".e-item"),u,f,e;nodeDetails=this._getNodeDetails(r);this._CurrenctSelectedNodes.push(nodeDetails.text);u=this._isChecked(r);f=t.isNullOrUndefined(i)?"":t.isNullOrUndefined(i.event)?"":i.event;e={currentElement:r,id:nodeDetails.id,parentId:nodeDetails.parentId,value:nodeDetails.text,currentNode:this._CurrenctSelectedNodes,currentCheckedNodes:this._checkedArray,isChecked:u,event:f};this._isRender&&this._triggerEvent("nodeCheck",e)},_onUnChecked:function(n,i){var r=n.closest(".e-item"),u,f,e;nodeDetails=this._getNodeDetails(r);this._CurrenctSelectedNodes.push(nodeDetails.text);u=this._isChecked(r);f=t.isNullOrUndefined(i)?"":t.isNullOrUndefined(i.event)?"":i.event;e={currentElement:r,id:nodeDetails.id,parentId:nodeDetails.parentId,value:nodeDetails.text,currentNode:nodeDetails.text,currentUncheckedNodes:this._uncheckedArray,isChecked:u,event:f};this._triggerEvent("nodeUncheck",e)},_addCheckNodes:function(n){var t=this.model.checkedNodes;this._removeNullInArray(t);!t instanceof Array&&(t=[]);t.indexOf(n)==-1&&t.push(n)},_removeCheckNodes:function(n){var t=this.model.checkedNodes,i;!t instanceof Array&&(t=[]);i=t.indexOf(n);i!=-1&&(t.splice(i,1),t.length==0&&t.push(-1))},_removeNullInArray:function(n){var t=n.indexOf(-1);t!=-1&&n.splice(t,1)},_afterInsertingNode:function(n){this._addDragableClass();this._finalizeEditing(n);var t=n.closest("ul").closest(".e-item");this._modifyCss(t);this._updateCheckState(t);this._isSelectedAction();t.length>0&&t.hasClass("e-node-disable")&&this._nodeDisableAction(t);this._updateSelectedNode()},_insertBeforeOrAfter:function(i,r,u){if(r=this._getNodeByID(r),r[0]!=null&&r.is("LI")&&r.hasClass("e-item")){if(this._triggerEvent("beforeAdd",{data:i,targetParent:r[0]!=null?r:null,parentDetails:this._getNodeDetails(r)}))return;if(this._isRender=!1,typeof i!="object"&&(i=this._createObjectByText(i)),typeof i!="object")return;i[this.model.parentId]&&delete i[this.model.parentId];outerLi=this._addNodesWhenObject(i,r);temp=document.createElement("ul");n(temp).append(outerLi);outerLi=n(temp.children);this.model.showCheckbox&&outerLi.children().find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange});r.parents(".e-item:first").length>0?r.parents(".e-item:first").append(outerLi):this.element.append(outerLi);this.model.showCheckbox&&this._isCheckedAction();this._dropAsSiblingNode(r,outerLi.find("> div > .e-text"),u,"");this._afterInsertingNode(outerLi);this._isRender=!0;this._triggerEvent("nodeAdd",{data:i,nodes:outerLi,parentElement:r[0]!=null?r:null,parentDetails:this._getNodeDetails(r)});var f=this,e=this.dataSource();setTimeout(function(){f.dataSource()==null||f.dataSource()instanceof t.DataManager||(f._dataSource=f._groupingObjects(e,function(n){return[!t.isNullOrUndefined(n)&&[n[f.model.fields.parentId]].toString()]}))},300)}},_getNodeByID:function(t){return typeof t!="object"&&t!=""&&t!=r?this.element.find(this._checkValidId(t.toString())):(t=n(t),t.is("A")&&t.hasClass("e-text")&&(t=t.closest(".e-item")),t)},_checkValidId:function(n){return n[0]=="#"?n.replace(/(:|\.|\[|\]|,)/g,"\\$1"):"#"+n.replace(/(:|\.|\[|\]|,)/g,"\\$1")},_isTreeElement:function(t){return n(t)[0]!=null&&t.is("LI")&&t.hasClass("e-item")},_isUrl:function(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)},_getChildUl:function(n){return this.model.fullRowSelect?n.children[2]:n.children[1]},_sendAjaxOptions:function(n,t){var r=this,i,u;i=this._getNodeDetails(t);i.mapper=this.model.fields;i.model=this.model;u={url:n,data:i,type:"POST",async:!0,crossDomain:!0,dataType:"JSON",contentType:"application/json; charset=utf-8",success:function(n){try{r._ajaxSuccessHandler(n,t)}catch(i){}},error:function(n){try{r._ajaxErrorHandler(n)}catch(t){}}};this._sendAjaxRequest(u)},_sendAjaxRequest:function(t){var i=JSON.parse(JSON.stringify(t));(delete i.success,delete i.error,this._triggerEvent("beforeLoad",{ajaxOptions:i}))||(delete i.success,delete i.error,n.extend(t,i),n.ajax({type:t.type,url:t.url,dataType:t.dataType,data:t.data,async:t.async,contentType:t.contentType,crossDomain:t.crossDomain,success:t.success,error:t.error}))},_ajaxSuccessHandler:function(n,t){this._isRender=!1;typeof n=="object"&&this.addNode(n,t);this._isRender=!0;this._triggerEvent("loadSuccess",{data:n,targetParent:t,parentDetails:this._getNodeDetails(t)})},_ajaxErrorHandler:function(n){this._triggerEvent("loadError",{error:n})},_wireEvents:function(){this._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click",this._ClickEventHandler)._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:this.model.expandOn,this._expandEventHandler)._on(this.element,"focus",this._onFocusHandler)._on(this.element,"blur",this._onFocusOutHandler);this._wholeRowEvents("_on");this.model.allowEditing&&this._allowEditable();this.model.allowDragAndDrop&&this._addDragableClass();this.model.showCheckbox&&this.element.find(".nodecheckbox").ejCheckBox("enable");this.model.allowKeyboardNavigation&&this._on(this.element,"keydown",this._KeyPress)},_unWireEvents:function(){this._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click")._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:this.model.expandOn)._off(this.element,"focus")._off(this.element,"blur");this._wholeRowEvents("_off");this._preventEditable();this._preventDraggable();this.model.allowKeyboardNavigation&&this._off(this.element,"keydown");this.model.showCheckbox&&this.element.find(".nodecheckbox").ejCheckBox("disable")},_wholeRowEvents:function(t){this.model.fullRowSelect?(this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchstart)?"touchstart":"mouseenter",".e-text-wrap",this._liMouseEnterEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchend)?"touchend":"mouseleave",".e-text-wrap",this._liMouseLeaveEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchstart)?"touchstart":"mouseenter",".e-fullrow",this._liMouseEnterEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchend)?"touchend":"mouseleave",".e-fullrow",this._liMouseLeaveEvent)):(this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchstart)?"touchstart":"mouseenter",".e-text",this._mouseEnterEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchend)?"touchend":"mouseleave",".e-text",this._mouseLeaveEvent))},_enableDragDrop:function(){this.model.allowDragAndDrop&&(this._drag(),this.model.allowDropChild&&this._childDrop(),this.model.allowDropSibling&&this._siblingDrop())},_allowEditable:function(){this.model.template||(this.element.find(".e-item").addClass("AllowEdit"),this._on(n(document),"click",this._documentClick)._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"doubletap":"dblclick","a.e-text",this._inlineEdit))},_preventEditable:function(){this.element.find(".e-item").removeClass("AllowEdit");this._off(n(document),"click")._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"doubletap":"dblclick","a.e-text")},_preventDraggable:function(){this.element.find(".e-draggable, .e-droppable").removeClass("e-draggable e-droppable");this._preventDropSibling();this._preventDropChild();this._off(this.element,"mouseup touchstart pointerdown MSPointerDown",this._anchors,this._focusElement)},_preventDropSibling:function(){this.element.find(".e-dropsibling").removeClass("e-dropsibling")},_preventDropChild:function(){this.element.find(".e-item > div > .e-dropchild").removeClass("e-dropchild")},_getNodeData:function(i){var u,e,c,l,f,a;if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)&&i!=r){if(this._updatePersistProb(),u=[],this._templateType==2)u=t.DataManager(this._newDataSource).executeLocal(t.Query().where(this.model.fields.id,"equal",i,!1));else{var s=[],o=this._newDataSource,v=t.Query().where(this.model.fields.id,"equal",i,!1),y=t.DataManager(o).executeLocal(v),h=this._getFilterItems(y[0],o);for(e=0,c=h.length;e<c;e++)s.push(new t.Predicate(this.model.fields.id,"equal",h[e],!1));l=t.Query().where(t.Predicate.or(s));u=t.DataManager(o).executeLocal(l)}for(f=0,a=u.length;f<a;f++)n(document.getElementById(u[f][this.model.fields.id])).find("> ul .e-item").length==0?delete u[f][this.model.fields.hasChild]:this._templateType==1&&(u[f][this.model.fields.hasChild]=!0);return u}},_getFilterItems:function(n,i){var f=[],s,e,r,h,o,u,c;for(f.push(n.id),s=t.Query().where(this.model.fields.parentId,"equal",n.id,!1),e=t.DataManager(i).executeLocal(s),r=0,h=e.length;r<h;r++)for(o=this._getFilterItems(e[r],i),u=0,c=o.length;u<c;u++)f.push(o[u]);return f},refresh:function(){this._unWireEvents();this.element.html("");this._init()},expandAll:function(n,t){this.model.enableMultipleExpand&&(n>0?this._expandByLevel(this._getElement(),n,t):this._expandAll(t))},collapseAll:function(n,t){this.model.enableMultipleExpand&&(n>0?this._collapseByLevel(this._getElement(),n,t):this._collapseAll(t))},checkAll:function(){this.model.showCheckbox&&this._checkAll()},unCheckAll:function(){this.model.showCheckbox&&this._uncheckAll()},selectNode:function(n){n&&typeof n=="object"&&n.length>0?(this._unselectAll(),this._doSelectNodes(n,!0)):(n=this._getNodeByID(n),this._isTreeElement(n)&&this._nodeSelectionAction(n))},unselectNode:function(n){n&&typeof n=="object"&&n.length>0?this._doUnselectNodes(n):(n=this._getNodeByID(n),this._isTreeElement(n)&&this._nodeUnSelectionAction(n))},selectAll:function(){this.model.allowMultiSelection&&this._selectAll()},unselectAll:function(){this.model.allowMultiSelection&&this._unselectAll()},enableNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.enableNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeEnableAction(i)},disableNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.disableNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeDisableAction(i)},addNodes:function(n,t){if(n&&typeof n=="object"&&t==r&&n.length>0)for(var i=0;i<n.length;i++)this.addNode(n[i],t);else this.addNode(n,t)},addNode:function(i,r){var f,l,h,s,u,o,e,c;t.isNullOrUndefined(i)||(f=null,l=null,u=r?this._getNodeByID(r):this.model.allowMultiSelection?this.getSelectedNodes():this.getSelectedNode(),typeof i=="object"&&(t.isNullOrUndefined(i.length)&&!t.isNullOrUndefined(i[this.model.fields.parentId])?s=i[this.model.fields.parentId]:t.isNullOrUndefined(i.length)||i.length!=1||(s=i[0][this.model.fields.parentId]),s&&(u=this._getNodeByID(s))),u=this._isTreeElement(u)?n(u[0]):[],this._triggerEvent("beforeAdd",{data:i,targetParent:u[0]!=null?u:null,parentDetails:this._getNodeDetails(u)}))||(u.length==0||u.hasClass("e-node-disable")||this._expandNode(u),typeof i!="object"&&(i=this._createObjectByText(i,u)),typeof i!="object"||t.isNullOrUndefined(i.length)&&i.length==0)||(f=this._addNodesWhenObject(i,u),h=document.createElement("ul"),n(h).append(f),f=n(h.children),this.model.showCheckbox&&f.children().find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),this._appendNode(u,f),u[0]!=null&&(o=n(u[0].childNodes[0].childNodes[0]),o.hasClass("e-plus")||o.hasClass("e-minus")?o.removeClass("e-load"):o.removeClass("e-icon e-load")),u[0]!=null&&u.find("> div > .e-minus").length>0&&!this.model.enableMultipleExpand&&this._denyMultipleExpand(u),this._updateNodes(),this._afterInsertingNode(f),this._triggerEvent("nodeAdd",{data:i,nodes:f,parentElement:u[0]!=null?u:null,parentDetails:this._getNodeDetails(u)}),e=this,c=this.dataSource(),setTimeout(function(){e.dataSource()==null||e.dataSource()instanceof t.DataManager||(e._dataSource=e._groupingObjects(c,function(n){return[!t.isNullOrUndefined(n)&&[n[e.model.fields.parentId]].toString()]}))},300))},removeNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.removeNode(n[t]);else i=n?this._getNodeByID(n):this.model.allowMultiSelection?this.getSelectedNodes():this.getSelectedNode(),this._isTreeElement(i)&&this._removeNode(i)},removeAll:function(){this._liList.remove();this._updateNodes()},checkNode:function(n){var t,i;if(this.model.showCheckbox)if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.checkNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeCheck(i.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},uncheckNode:function(n){var t,i;if(this.model.showCheckbox)if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.uncheckNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeUncheck(i.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},expandNode:function(n){n&&typeof n=="object"&&n.length>0?(this._allowOnDemand=!0,this._expandNodes(n,!0),this._allowOnDemand=!1):(n=this._getNodeByID(n),this._isTreeElement(n)&&(this._allowOnDemand=!0,this._expandNode(n),this._allowOnDemand=!1))},collapseNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.collapseNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._collpaseNode(i)},showNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.showNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&i.css("visibility","").removeClass("hidden")},hideNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.hideNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&i.css("visibility","hidden").addClass("hidden")},show:function(){this.element.css("visibility","").find(".e-item").removeClass("hidden")},hide:function(){this.element.css("visibility","hidden").find(".e-item").addClass("hidden")},hasChildNode:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?n.find("> ul > .e-item").length>0?!0:!1:void 0},isChildLoaded:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&n.find("ul > .e-item").length>0?!0:!1},isNodeChecked:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._isChecked(n):void 0},isExpanded:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._isNodeExpanded(n):void 0},isVisible:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&n.css("visibility")!="hidden"?!0:!1},isExist:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&this._liList.index(n)!=-1?!0:!1},isSelected:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?n.find("> div > .e-text").hasClass("e-active"):void 0},isDisabled:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&n.hasClass("e-node-disable")?!0:!1},getTreeData:function(n){return n!=r?this._getNodeData(n):!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)?this._orderDataSource():void 0},getText:function(t){return t=this._getNodeByID(t),this._isTreeElement(t)?n.trim(this.element.find(t).find("> div > .e-text").text()):void 0},getSelectedNode:function(){return this.model.allowMultiSelection?null:this.element.find(".e-item > div > .e-active").closest(".e-item")},getSelectedNodes:function(){return this.element.find(".e-item > div > .e-active").closest(".e-item")},getCheckedNodes:function(){if(this.model.showCheckbox)return this._liList.find('> div > .e-chkbox-wrap[aria-checked="true"]').closest(".e-item")},getExpandedNodes:function(){return this.element.find(".e-item > div > .e-minus").closest(".e-item")},getExpandedNodesIndex:function(){return this._getNodesIndex(this.getExpandedNodes())},getCheckedNodesIndex:function(){return this._getNodesIndex(this.getCheckedNodes())},getSelectedNodeIndex:function(){return this.model.allowMultiSelection?null:this._getNodesIndex(this.getSelectedNode())},getSelectedNodesIndex:function(){return this._getNodesIndex(this.getSelectedNodes())},getVisibleNodes:function(){return this.element.find(".e-item:visible:not(.hidden, .e-node-disable)")},getNodeCount:function(){return this.element.find(".e-item").length},getNode:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._getNodeDetails(n):null},getNodeIndex:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._liList.index(n):void 0},getNodeByIndex:function(t){if(typeof t=="number")return n(this._liList[t])},getParent:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?n.parents(".e-item:first"):void 0},getChildren:function(n,t){return n=this._getNodeByID(n),this._isTreeElement(n)?t?n.find(".e-item"):n.find("> ul > .e-item"):void 0},updateText:function(i,r){if(i=this._getNodeByID(i),this._isTreeElement(i)&&!t.isNullOrUndefined(r)){var u=this.element.find(i).children("div").find("> .e-text")[0],f,e;if(u!=null){if(e={currentElement:n(u)},this._triggerEvent("beforeEdit",e))return!1;f=u.lastChild.nodeValue}u.lastChild.nodeValue=r;this._updateField(this._newDataSource,i.attr("id"),this.model.fields.text,r);this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerEvent("nodeEdit",{id:i.attr("id"),oldText:f,newText:r,target:i,nodeDetails:this._getNodeDetails(i),event:null})}},insertAfter:function(n,t){this._insertBeforeOrAfter(n,t,!1)},insertBefore:function(n,t){this._insertBeforeOrAfter(n,t,!0)},moveNode:function(n,i,r){if(n=this._getNodeByID(n),i=this._getNodeByID(i),this._isTreeElement(n)){if(n.parents(".e-item")[0]==i[0]&&t.isNullOrUndefined(r)||i.find(n).index()==r||i[0]==null&&this._liList.index(n)==r)return;var u=i[0]!=null&&r>=0?i.find("> ul > .e-item").eq(r):this.getNodeByIndex(r);this._isRender=!1;this._isTreeElement(u)?u.parents(".e-item:first")[0]==n.parents(".e-item:first")[0]&&u.next(".e-item")[0]==null?this._dropAsSiblingNode(u,n.find(" > div > .e-text"),!1,""):this._dropAsSiblingNode(u,n.find(" > div > .e-text"),!0,""):this._dropAsChildNode(i,n.find(" > div > .e-text"),"");i.length>0&&i.hasClass("e-node-disable")&&this._nodeDisableAction(i);this._isRender=!0}},loadData:function(n,t){t=this._getNodeByID(t);this._isUrl(n)&&(t[0]==null||this._isTreeElement(t))&&this._sendAjaxOptions(n,t)},ensureVisible:function(t){var r,u,i,f;if(t=this._getNodeByID(t),this._isTreeElement(t)&&!this.isDisabled(t)&&this.isVisible(t)){for(r=t.parents(".e-item"),i=0,f=r.length;i<f;i++)this._expandNode(n(r[i]));return u=t.offset(),t.animate({scrollTop:u.top},this.model.enableAnimation?350:0,"linear",function(){t.find("> div > a.e-text")[0].scrollIntoView(!1)}),!0}return!1},_triggerEvent:function(n,t){if(this._isRender)return this._trigger(n,t)}})}(jQuery,Syncfusion),function(n,t,r){t.widget("ejUploadbox","ej.Uploadbox",{element:null,_addToPersist:[""],model:null,validTags:["div","span"],_setFirst:!1,_rootCSS:"e-uploadbox",defaults:{buttonText:{browse:"Browse",upload:"Upload",cancel:"Cancel",close:"Close"},width:"100px",height:"35px",htmlAttributes:{},dialogPosition:{X:"",Y:""},dialogText:{title:"Upload Box",name:"Name",size:"Size",status:"Status"},customFileDetails:{title:!0,name:!0,size:!0,status:!0,action:!0},dialogAction:{modal:!1,closeOnComplete:!1,drag:!0,content:null},locale:"en-US",asyncUpload:!0,pushFile:null,enabled:!0,multipleFilesSelection:!0,autoUpload:!1,showFileDetails:!0,fileSize:31457280,extensionsAllow:"",extensionsDeny:"",saveUrl:"",removeUrl:"",uploadName:"",cssClass:"",dropAreaText:"Drop files or click to upload",allowDragAndDrop:!1,showBrowseButton:!0,showRoundedCorner:!0,dropAreaHeight:"100%",dropAreaWidth:"100%",enableRTL:!1,create:null,fileSelect:null,begin:null,beforeSend:null,cancel:null,inProgress:null,success:null,complete:null,remove:null,error:null,destroy:null},dataTypes:{buttonText:"data",dialogText:"data",disbled:"boolean",customFileDetails:"data",pushFile:"data",dialogAction:"data",multipleFilesSelection:"boolean",autoUpload:"boolean",showFileDetails:"boolean",allowDragAndDrop:"boolean",showBrowseButton:"boolean",showRoundedCorner:"boolean",fileSize:"number",extensionsAllow:"string",extensionsDeny:"string",saveUrl:"string",removeUrl:"string",cssClass:"string",enableRTL:"boolean",htmlAttributes:"data"},disable:function(){this._changeState(!1)},enable:function(){this._changeState(!0)},_changeState:function(t){t?n(this.control).removeClass("e-disable"):n(this.control).addClass("e-disable");this.model.enabled=t;n(this._currentElement).find(".e-uploadinput")[0].disabled=!t;this.diaObj&&(this.diaObj.option("beforeClose",this._onBeforeClose),this.diaObj.setModel({enabled:t,allowDraggable:t}))},refresh:function(){this.diaObj&&(this.diaObj.isOpened()?this.diaObj.close():this._uploadFileListDelete())},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.Uploadbox",this.model.locale)},_init:function(){this.s=t.browserInfo();this._updateLocalConstant();this._initialize();this._wireEvents();this.model.asyncUpload||this._initObjectsSyncUpload();this._controlStatus(this.model.enabled);this.model.locale=="en-US"?this._buttonText(this.model.buttonText):this._setLocale();this._roundedCorner(this.model.showRoundedCorner)},_setModel:function(n){for(var t in n){switch(t){case"buttonText":this._buttonText(n[t]);break;case"htmlAttributes":this._addAttr(n[t]);break;case"dialogText":this._dialogText(n[t]);break;case"cssClass":this._setSkin(n[t]);break;case"enableRTL":this._setRTL(n[t]);break;case"enabled":this._controlStatus(n[t]);break;case"locale":this.model.locale=n[t];this._updateLocalConstant();this._setLocale();break;case"height":this.model.height=n[t];this._setHeight(this.model.height);break;case"width":this.model.width=n[t];this._setWidth(this.model.width);break;case"dialogPosition":this.model.dialogPosition=n[t];this._dialogPosition();break;case"allowDragAndDrop":this.model.allowDragAndDrop=n[t];this._dragAndDrop();break;case"dropAreaText":this.model.dropAreaText=n[t];this._dropAreaText(this.model.dropAreaText);break;case"showBrowseButton":this.model.showBrowseButton=n[t];this._hideBrowseButton();this._refreshUploadDialogParent();break;case"showRoundedCorner":this._roundedCorner(n[t]);break;case"dropAreaHeight":this.model.dropAreaHeight=n[t];this._setSize();break;case"dropAreaWidth":this.model.dropAreaWidth=n[t];this._setSize();break;case"pushFile":this.model.pushFile=n[t];this.model.pushFile!=null&&this.UploadType=="Xhr"&&this.model.asyncUpload&&(this._files=this.model.pushFile);this._onXhrSelect();break;case"multipleFilesSelection":this.model.multipleFilesSelection=n[t];(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1)==!1&&(this.model.multipleFilesSelection?this._currentElement.find(".e-uploadinput").attr("multiple","multiple"):this._currentElement.find(".e-uploadinput").removeAttr("multiple"));break;case"uploadName":this.model.uploadName=n[t];this.inputupload.attr("name",this.model.uploadName);this.refresh();break;case"autoUpload":this.model.autoUpload=n[t];break;case"showFileDetails":this.model.showFileDetails=n[t];this.refresh();break;case"fileSize":this.model.fileSize=n[t];break;case"extensionsAllow":this.model.extensionsAllow=n[t];this._currentElement.find(".e-uploadinput").attr("accept",n[t]);break;case"extensionsDeny":this.model.extensionsDeny=n[t];break;case"saveUrl":this.model.saveUrl=n[t];break;case"removeUrl":this.model.removeUrl=n[t]}this._currentElement=this.model.allowDragAndDrop&&!this.model.showBrowseButton?this.dragWrapper:this.element}},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_setRTL:function(n){n?this._currentElement.addClass("e-rtl"):this._currentElement.removeClass("e-rtl");this.updialog&&this.updialog.ejDialog({enableRTL:n})},_getLocalizedLabels:function(n){var i,r="";return i=n=="browse"||n=="upload"||n=="cancel"||n=="close"?"buttonText":"dialogText",this._localizedLabels[n]?r=this._localizedLabels[n]:this._localizedLabels[i][n]?r=this._localizedLabels[i][n]:t.Uploadbox.Locale["en-US"][n]?r=t.Uploadbox.Locale["en-US"][n]:t.Uploadbox.Locale["en-US"][i][n]&&(r=t.Uploadbox.Locale["en-US"][i][n]),r},_setLocale:function(){this._buttonText(this._localizedLabels.buttonText);this._dialogText(this._localizedLabels.dialogText);this._dropAreaText(this._localizedLabels.dropAreaText)},_buttonText:function(t){n.extend(this.model.buttonText,t);this.buttondiv.val(this.model.buttonText.browse);this.updialog&&(this.updialog.find(".e-action-container .e-uploadbtn").html(this.model.buttonText.upload),this.updialog.find(".e-action-container .e-uploadclosebtn").html(this.model.buttonText.cancel))},_dialogText:function(t){n.extend(this.model.dialogText,t);this.diaObj==r||this.diaObj.option("title",this.model.dialogText.title);this.updialog&&(this.updialog.find(".e-head-name").html(this.model.dialogText.name),this.updialog.find(".e-head-size").html(this.model.dialogText.size),this.updialog.find(".e-head-status").html(this.model.dialogText.status))},_destroy:function(){this._currentElement.hasClass("e-uploadbox")&&(this._currentElement.removeClass("e-uploadbox e-widget"),this._currentElement.empty(),n(this.dragWrapper).after(this._currentElement),this.element.css({width:"",height:""}),this._bindResizeHandler(!1),this.dragWrapper.remove())},_setSkin:function(n){this._currentElement.removeClass(this.model.cssClass);this._currentElement.addClass(n);this.diaObj&&this.diaObj.setModel({cssClass:this.model.cssClass});this.model.allowDragAndDrop&&this.dragWrapper.addClass(n)},_initialize:function(){this.control=this.element[0];this.element.addClass("e-widget "+this.model.cssClass);this.innerdiv=t.buildTag("div.e-selectpart e-select e-box");this.element.append(this.innerdiv);this.buttondiv=t.buildTag("input.e-inputbtn e-btn#"+this.control.id+"_SelectButton","",{},{type:"button","data-role":"none",value:this._getLocalizedLabels("browse")});this.inputupload=t.buildTag("input.e-uploadinput","",{},{type:"file","data-role":"none",name:this.model.uploadName!=""?this.model.uploadName:this.control.id}).attr("accept",this.model.extensionsAllow);this.model.multipleFilesSelection&&(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1)==!1&&this.inputupload.attr("multiple","multiple");this.innerdiv.append(this.buttondiv);this.innerdiv.append(this.inputupload);this.model.allowDragAndDrop&&this._dragAndDrop(!0);this._Selector=this.buttondiv[0];this._currentElement=this.model.allowDragAndDrop&&!this.model.showBrowseButton?this.dragWrapper:this.element;this._setRTL(this.model.enableRTL);this._addAttr(this.model.htmlAttributes);this.Uploadframes=[];this.UploadForms=[];this._successFiles=[];this._errorFiles=[];this.UploadType=this._isXhrSupported()?"Xhr":"IFrame";this.model.width!=""&&this._setWidth(this.model.width);this.model.height!=""&&this._setHeight(this.model.height);this._hideBrowseButton()},_refreshUploadDialogParent:function(){this.diaObj&&this.diaObj.setModel({target:this.model.dialogAction.content!=null&&this.model.dialogAction.content!=""?this.model.dialogAction.content:!this.model.showBrowseButton&&this.model.allowDragAndDrop?"#"+this.control.id+"_dragWrapper":"#"+this.control.id})},_hideBrowseButton:function(){!this.model.showBrowseButton&&this.model.allowDragAndDrop?(this.element.addClass("e-browse-hide"),this._dropAreaSize()):this.element.hasClass("e-browse-hide")&&(this.element.removeClass("e-browse-hide"),this.element.width(this.model.width),this.element.height(this.model.height))},_setSize:function(){this.model.allowDragAndDrop&&(this.model.dropAreaWidth!=""&&this.dragWrapper.outerWidth(this.model.dropAreaWidth),this.model.dropAreaHeight!=""&&this.dragWrapper.outerHeight(this.model.dropAreaHeight),this.model.showBrowseButton||this._dropAreaSize())},_dropAreaSize:function(){this.model.dropAreaWidth!=""&&this.element.width(this.model.dropAreaWidth);this.model.dropAreaHeight!=""&&this.element.height(this.model.dropAreaHeight)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?i.disable():i.element.attr(t,n)})},_dragAndDrop:function(){this.model.allowDragAndDrop?(this.dragWrapper=t.buildTag("div.e-drag-wrapper e-widget-wrapper e-upload-box "+this.model.cssClass+"#"+this.control.id+"_dragWrapper"),this.innerWrapper=t.buildTag("div.e-drag-container"),this._spanTag=t.buildTag("span.e-drag-text").html(this.model.locale=="en-US"?this.model.dropAreaText:t.Uploadbox.Locale[this.model.locale].dropAreaText),this.innerWrapper.append(this._spanTag),this.innerWrapper.insertBefore(this.element),this.dragWrapper.insertBefore(this.element),this.innerWrapper.append(this.element),this.dragWrapper.append(this.innerWrapper),this._bindDragEvents(),this._refreshUploadDialogParent(),this._setSize()):(this._refreshUploadDialogParent(),this.element.insertBefore(this.dragWrapper),this.dragWrapper.remove(),this._unBindDragEvents());this._hideBrowseButton()},_resizeHandler:function(){this.diaObj&&(n(window).width()>750?(n(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),this.diaObj.setModel({width:this._getDialogContentWidth(),height:"auto"})):(n(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"),this.diaObj.setModel({width:250,height:"auto"})),this.diaObj.scroller&&this.diaObj.scroller.setModel({height:"auto"}))},_getDialogContentWidth:function(){var n=0;return this.model.customFileDetails.name&&(n=n+200),this.model.customFileDetails.size&&(n=n+100),this.model.customFileDetails.status?n=n+200:this.model.customFileDetails.action&&(n=n+45),n+5},_dropAreaText:function(n){this.model.allowDragAndDrop&&this._spanTag.html(n)},_bindDragEvents:function(){this._on(this.dragWrapper,"dragover",this._onDragOverHandler);this._on(this.dragWrapper,"drop",this._onDropHandler)},_unBindDragEvents:function(){this._off(this.dragWrapper,"dragover",this._onDragOverHandler);this._off(this.dragWrapper,"drop",this._onDropHandler)},_setWidth:function(n){this.element.css("width",n)},_setHeight:function(n){this.element.height(n)},_dialogPosition:function(){if(this.diaObj){if((this.diaObj.model.content=="#"+this.control.id||this.diaObj.model.content=="#"+this.control.id+"_dragWrapper")&&this.model.dialogPosition.X==""&&this.model.dialogPosition.Y==""){var t=parseInt(this.diaObj.wrapper.css("left"))-(this.diaObj.wrapper.outerWidth()-n(this.diaObj.model.content).outerWidth())/2;this.model.dialogPosition.X=parseInt(t)>0?t:parseInt(this.diaObj.wrapper.css("left"));this.model.dialogPosition.Y=parseInt(this.diaObj.wrapper.css("top"))+n(this.diaObj.model.content).outerHeight()}this.model.dialogPosition.X!=""&&this.model.dialogPosition.Y!=""&&this.diaObj.setModel({position:this.model.dialogPosition})}},_roundedCorner:function(n){n?this.innerdiv.addClass("e-corner"):this.innerdiv.hasClass("e-corner")&&this.innerdiv.removeClass("e-corner")},_wireEvents:function(){this._on(this.element,"click",this._disableclickselect);this._on(this.element,"keydown",this._keydownselect);this._bindInputChangeEvent();this._bindResizeHandler(!0)},_bindResizeHandler:function(t){t?n(window).on("resize",n.proxy(this._resizeHandler,this)):n(window).off("resize",n.proxy(this._resizeHandler,this))},_keydownselect:function(n){this.element.hasClass("e-disable")||n.keyCode!=13||this.diaObj&&this.diaObj.isOpened()||this.element.find(".e-uploadinput").click()},_onDropHandler:function(n){if(t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"||t.browserInfo().version==="9.0"||this._currentElement.hasClass("e-disable"))return!1;n.stopPropagation();n.preventDefault();this._files=this._getAllFileInfo(n.originalEvent.dataTransfer.files);this._fileSelect(n)},_onDragOverHandler:function(n){if(this._currentElement.hasClass("e-disable"))return!1;n.stopPropagation();n.preventDefault()},_disableclickselect:function(n){this._currentElement.hasClass("e-disable")&&n.preventDefault()},_bindInputChangeEvent:function(){this._on(this.inputupload,"change",this._inputValueChange)},_inputValueChange:function(t){return this._files=this._getInputFileInfo(n(t.target)),this._fileSelect(t)},_fileSelect:function(n){if(this._trigger("fileSelect",{files:this._files}))return this._resetFileInput(this._currentElement.find(".e-uploadinput")),!1;this._fileUpload(n)},_fileUpload:function(n){var t=this._isAllowed(this._files);this._files=t.files;this.model.asyncUpload?t.files!=null&&t.files.length>0&&(this.UploadType=="Xhr"?this._onXhrSelect(n):this._onSelectIFrame(n),this._resetFileInput(this._currentElement.find(".e-uploadinput"))):t.status&&this._onSelectSyncUpload(n);this._renderTooltip()},__uploadButtonClick:function(t){if(!this._currentElement.hasClass("e-disable")){var i=this._currentElement.find(".e-uploadbtn");this._currentElement.find(".e-uploadbtn").hasClass("e-disable")?t.preventDefault():this.UploadType=="Xhr"?this._xhrOnUploadButtonClick(t):this._onUploadButtonClickIFrame(t);n(t.target).attr("disabled","disabled").addClass("e-disable")}},_actionClick:function(t){var r,i,u;this._currentElement.hasClass("e-disable")||(r=n(t.target),i=r.closest(".e-upload-file"),this._file=n(i).data("file"),r.hasClass("e-delete")?this.UploadType=="Xhr"?this._xhrOnRemove(t,i):this._onRemoveIFrame(t,i):r.hasClass("e-file-cancel")?(this._trigger("cancel",{fileStatus:this._file}),u=this.updialog.find(".e-file-cancel"),u.hasClass("e-disable")?t.preventDefault():this.model.asyncUpload?(this._removeFile(n(i).data("file")),this.UploadType=="Xhr"?this._xhrOnCancel(t,i):this._onCancelIFrame(t,i)):this._onCancelSyncUpload(t,i)):r.hasClass("e-reload")&&(this.UploadType=="Xhr"?this._xhrOnRetry(t,i):this._onRetryIFrame(t,i)))},_removeFileEntry:function(n){n.remove()},_removeFile:function(n){for(var i=[],t=0;t<this._files.length;t++)this._files[t]!=n&&i.push(this._files[t]);this._files=i},_isFileUpload:function(t){if(this.model.customFileDetails.action){var i=n(t).find("div.e-icon");return i.is(".e-file-cancel")}return!0},_isXhrSupported:function(){return this.s.name=="msie"&&parseInt(this.s.version)<9||this.s.name=="safari"&&this.s.name=="chrome"&&this.s.version=="536"?!1:typeof FormData!="undefined"&&typeof File!="undefined"},_getFileName:function(t){return n.map(this._getAllFileInfo(t),function(n){return n.name}).join(", ")},_getFileSize:function(t){var i=this;return n.map(this._getAllFileInfo(t),function(n){return i._formatSize(n.size)}).join(", ")},_pushFile:function(i,r){var s,h,e,u,o,f,c,l,a,v,y;for(f=n("<div class='e-head-content'><\/div>"),l=n("<div class='e-file-head e-head-name'>"+this._getLocalizedLabels("name")+"<\/div>"),a=n("<div class='e-file-head e-head-size'>"+this._getLocalizedLabels("size")+"<\/div>"),v=n("<div class='e-file-head e-head-status'>"+this._getLocalizedLabels("status")+"<\/div>"),this.model.customFileDetails.name&&n(l).appendTo(f),this.model.customFileDetails.size&&n(a).appendTo(f),this.model.customFileDetails.status&&n(v).appendTo(f),filedialog=this.updialog,filedialog&&filedialog.length!=0?this.model.showFileDetails&&(this.updialog&&this.updialog.find(".e-uploadbtn").removeAttr("disabled").removeClass("e-disable"),this.diaObj.open()):(this.updialog=t.buildTag("div.uploaddialog#"+this.element[0].id+"_dialog","",{},{title:this._getLocalizedLabels("title")}),this.model.allowDragAndDrop&&!this.model.showBrowseButton?(this.dragWrapper.append(this.updialog),DialogContentContainer="#"+this.control.id+"_dragWrapper"):(this.element.append(this.updialog),DialogContentContainer="#"+this.control.id)),s=this.updialog.find(".e-ul"),n(this.updialog.find(".e-head-content"))&&n(this.updialog.find(".e-head-content")).replaceWith(f),s.length==0&&(f.appendTo(this.updialog),s=t.buildTag("ul.e-ul").appendTo(this.updialog)),n(this.updialog).find(".e-file-upload").length>0&&n(this.updialog).find(".e-file-upload").remove(),fileListActions=t.buildTag("div.e-file-upload").appendTo(this.updialog).append(this.model.autoUpload||!this.model.asyncUpload?n(t.buildTag("div.e-action-container")).addClass("sync"):t.buildTag("div.e-action-container")),dialogActions=t.buildTag("button.e-uploadclosebtn e-btn e-select",this._getLocalizedLabels("cancel"),{},{type:"button","data-role":"none"}).appendTo(n(this.updialog).find(".e-action-container")),this.model.showRoundedCorner&&dialogActions.addClass("e-corner"),this._on(dialogActions,"click",this._dialogclose),this._on(dialogActions,"keydown",this._keydownDialogClose),y=this.model.dialogAction.content!=null&&this.model.dialogAction.content!=""?this.model.dialogAction.content:DialogContentContainer,this.updialog.ejDialog({showOnInit:!1,closeIconTooltip:this._getLocalizedLabels("closeToolTip"),minWidth:240,width:n(window).width()<750?250:this._getDialogContentWidth(),height:"auto",cssClass:"e-uploadbox "+this.model.cssClass,close:n.proxy(this._uploadFileListDelete,this),enableRTL:this.model.enableRTL,target:y,enableResize:!1,allowDraggable:this.model.dialogAction.drag,enableModal:this.model.asyncUpload?this.model.dialogAction.modal:!1,showHeader:this.model.customFileDetails.title,showRoundedCorner:this.model.showRoundedCorner}),n(window).width()<750?n(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"):n(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),this.diaObj=this.updialog.data("ejDialog"),this.model.cssClass!=""&&this.diaObj.setModel({cssClass:this.model.cssClass}),this._dialogPosition(),this.model.multipleFilesSelection||this.updialog.find(".e-ul>.e-upload-file").remove(),u=0;u<i.length;u++)h=n("<li class='e-upload-file'><\/li>").appendTo(s).data(r),addedlist=n("<div class='e-file-list'><\/div>"),addedfilename=n("<div class='e-file-progress e-file-view'><div class='e-file-name e-file-view'><span class='e-file-name-txt'>"+i[u].name+"<\/span><\/div>"),c="<div class='e-file-size e-file-view'><span class='e-file-name-txt'>"+this._formatSize(i[u].size)+"<\/span><\/div>",addedfilestatus=n("<div class='e-file-percentage e-file-view'><div class='e-file-progress-bar'><div class='e-file-progress-status'><\/div><\/div><\/div>"),addedfileaction=n("<div class='e-action-perform'><div class='e-icon e-file-view'><\/div><\/div>"),this.model.customFileDetails.name&&n(addedfilename).appendTo(addedlist),this.model.customFileDetails.size&&(this._getFileSize(i[u]).toString().toLowerCase().match("0.0kb").length==0||i[u].size!=null?n(c).appendTo(addedlist):n(this.updialog).find(".e-head-size").remove()),this.model.customFileDetails.status&&n(addedfilestatus).appendTo(addedlist),this.model.customFileDetails.action&&(n(addedfileaction).appendTo(addedlist),o="cancel",addedlist.find(".e-icon").remove().addClass(o.toString()),o=="cancel"?e=t.buildTag("div.e-icon e-file-cancel","",{},{"data-content":this._getLocalizedLabels("cancelToolTip")}):o=="remove"?e=t.buildTag("div.e-icon e-delete","",{},{"data-content":this._getLocalizedLabels("removeToolTip")}):o=="retry"&&(e=t.buildTag("div.e-icon e-reload","",{},{"data-content":this._getLocalizedLabels("retryToolTip")})),addedlist.find(".e-action-perform").append(e),this._on(e,"click",this._actionClick)),n(addedlist).appendTo(h);return this.model.showFileDetails&&this.diaObj.open(),this._buttonText(this.model.buttonText),this._dialogText(this.model.dialogText),h},_keydownDialogClose:function(n){this._currentElement.hasClass("e-disable")||n.keyCode==13&&this._dialogclose()},_pushFileDetails:function(i){var r,u,f,s,h,c,l,a,v,y,e,o,p;return f=n("<div class='e-head-content'><\/div>"),s=n("<div class='e-file-head e-head-name'>"+this._getLocalizedLabels("name")+"<\/div>"),h=n("<div class='e-file-head e-head-size'>"+this._getLocalizedLabels("size")+"<\/div>"),c=n("<\/div><div class='e-file-head e-head-status'>"+this._getLocalizedLabels("status")+"<\/div>"),this.model.customFileDetails.name&&n(s).appendTo(f),this.model.customFileDetails.size&&n(h).appendTo(f),this.model.customFileDetails.status&&n(c).appendTo(f),r=this,filedialog=this.updialog,filedialog&&filedialog.length!=0?this.model.showFileDetails&&(DialogContentContainer="#"+this.control.id,this.updialog&&this.updialog.find(".e-uploadbtn").removeAttr("disabled").removeClass("e-disable"),r.diaObj.open()):(this.updialog=t.buildTag("div.uploaddialog#"+this.element[0].id+"_dialog","",{},{title:this._getLocalizedLabels("title")}),this.model.allowDragAndDrop&&!this.model.showBrowseButton?(this.dragWrapper.append(this.updialog),DialogContentContainer="#"+this.control.id+"_dragWrapper"):(this.element.append(this.updialog),DialogContentContainer="#"+this.control.id)),e=this.updialog.find(".e-ul"),n(this.updialog.find(".e-head-content"))&&n(this.updialog.find(".e-head-content")).replaceWith(f),e.length==0&&(f.appendTo(this.updialog),e=t.buildTag("ul.e-ul").appendTo(this.updialog)),n(this.updialog).find(".e-file-upload").length>0&&n(this.updialog).find(".e-file-upload").remove(),fileListActions=t.buildTag("div.e-file-upload").appendTo(this.updialog).append(this.model.autoUpload||!this.model.asyncUpload?n(t.buildTag("div.e-action-container")).addClass("sync"):t.buildTag("div.e-action-container")),dialogActions=t.buildTag("button.e-uploadclosebtn e-btn e-select",this._getLocalizedLabels("cancel"),{},{type:"button","data-role":"none"}).appendTo(n(this.updialog).find(".e-action-container")),this.model.showRoundedCorner&&dialogActions.addClass("e-corner"),this._on(dialogActions,"click",this._dialogclose),this.model.multipleFilesSelection||this.updialog.find(".e-ul>.e-upload-file").remove(),o=n("<li class='e-upload-file'><\/li>").appendTo(e).data("file",i),u=n("<div class='e-file-list'><\/div>"),l=n("<div class='e-file-progress e-file-view'><div class='e-file-name e-file-view'><span class='e-file-name-txt'>"+i.name+"<\/span><\/div>"),v=n("<div class='e-file-size e-file-view'><span class='e-file-name-txt'>"+this._formatSize(0)+"\\"+this._formatSize(i.size)+"<\/span><\/div>"),a=n("<div class='e-file-percentage e-file-view'><div class='e-file-progress-bar'><div class='e-file-progress-status'><\/div><\/div><\/div>"),y=n("<div class='e-action-perform'><div class='e-icon e-file-view'><\/div><\/div><\/div>"),this.model.customFileDetails.name&&n(l).appendTo(u),this.model.customFileDetails.size&&n(v).appendTo(u),this.model.customFileDetails.status&&n(a).appendTo(u),this.model.customFileDetails.action&&n(y).appendTo(u),n(u).appendTo(o),p=this.model.dialogAction.content!=null&&this.model.dialogAction.content!=""?this.model.dialogAction.content:DialogContentContainer,this.updialog.ejDialog({showOnInit:!1,closeIconTooltip:this._getLocalizedLabels("closeToolTip"),minWidth:240,width:n(window).width()<750?250:this._getDialogContentWidth(),height:"auto",cssClass:"e-uploadbox "+this.model.cssClass,close:n.proxy(this._uploadFileListDelete,this),enableRTL:this.model.enableRTL,target:p,enableResize:!1,allowDraggable:this.model.dialogAction.drag,enableModal:this.model.asyncUpload?this.model.dialogAction.modal:!1,showHeader:this.model.customFileDetails.title,showRoundedCorner:this.model.showRoundedCorner}),n(window).width()<750?n(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"):n(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),r.diaObj=this.updialog.data("ejDialog"),r.model.cssClass!=""&&r.diaObj.setModel({cssClass:this.model.cssClass}),r._dialogPosition(),this.model.showFileDetails&&r.diaObj.open(),this._buttonText(this.model.buttonText),this._dialogText(this.model.dialogText),o},_setProgress:function(t,i,r){var u,f,e,o;this.model.customFileDetails.status&&(u=n(t).find(".e-file-progress-status"),u.width(i+"%"));this.model.customFileDetails.size&&(f=n(t).find(".e-file-size .e-file-name-txt"),e=this._formatSize(r.loaded),o=this._formatSize(r.total),f.html(e+"\\"+o))},_setAction:function(n,i){if(this.model.customFileDetails.action){var r;n.find(".e-action-perform .e-icon,.e-file-percentage .e-icon").remove().addClass(i.toString());i=="cancel"?r=t.buildTag("div.e-icon e-file-cancel","",{},{"data-content":this._getLocalizedLabels("cancelToolTip")}):i=="remove"?r=t.buildTag("div.e-icon e-delete","",{},{"data-content":this._getLocalizedLabels("removeToolTip")}):i=="retry"&&(r=t.buildTag("div.e-icon e-reload","",{},{"data-content":this._getLocalizedLabels("retryToolTip")}));n.find(".e-action-perform").append(r);this._on(r,"click",this._actionClick)}},_setStatus:function(n,i){if(this.model.customFileDetails.status){var u,r=t.buildTag("div");i=="success"&&(n.find(".file-status").addClass("e-file-status-success").html("Completed"),n.find(".e-file-percentage").html(""),r.addClass("e-icon e-checkmark").attr("data-content",this._getLocalizedLabels("completedToolTip")),n.find(".e-file-percentage").append(r));i=="failed"&&(n.find(".file-status").addClass("e-file-status-failed").html("Failed"),n.find(".e-file-percentage").html(""),r.addClass("e-icon e-file-percentage-failed").attr("data-content",this._getLocalizedLabels("failedToolTip")),n.find(".e-file-percentage").append(r));i=="progress"&&n.find(".file-status").addClass("file-status-inprogress").html("in progress");i=="uploading"&&(n.find(".file-status").addClass("file-status-inprogress").html("uploading"),u=n.find(".e-file-percentage"),u.html(""))}},_renderTooltip:function(){var i=this;t.isNullOrUndefined(this.updialog)||(this.upTooltip=n(this.updialog).ejTooltip({target:".e-file-cancel, .e-delete, .e-reload, .e-checkmark, .e-close, .e-file-percentage-failed",content:" ",isBalloon:!1,showRoundedCorner:this.model.showRoundedCorner,enableRTL:this.model.enableRTL,position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}}}).data("ejTooltip"),n(this.upTooltip.tooltip).css({"min-width":"auto"}))},_createInputandBind:function(){var n=t.buildTag("input","",{},{type:"file","data-role":"none"});n.attr("name",this.model.uploadName!=""?this.model.uploadName:this.control.id).attr("autocomplete","off").attr("class","e-uploadinput").attr("accept",this.model.extensionsAllow);this.model.multipleFilesSelection&&(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1)==!1&&n.attr("multiple","multiple");n.appendTo(this.element.find(".e-selectpart"));this.inputupload=n;this._bindInputChangeEvent()},_showUploadButton:function(){var i=this.updialog.find(".e-uploadbtn");i.length==0&&(i=t.buildTag("button.e-uploadbtn e-btn e-select",this._getLocalizedLabels("upload"),{},{type:"button","data-role":"none"}),this.model.showRoundedCorner&&i.addClass("e-corner"),this.updialog.find(".e-action-container").append(i),this._on(i,"click",this.__uploadButtonClick),this._on(i,"keydown",this._keydownUpload),n(i).focus());this._buttonText(this.model.buttonText)},_keydownUpload:function(n){n.keyCode==13&&this.__uploadButtonClick(n)},_resetFileInput:function(n){var t=n.clone(!1,!1);this._on(t,"change",this._inputValueChange);n.replaceWith(t)},_isAllowed:function(t){var f,e,i,s,h,c,r=this,u=[],l=[],o=!0;return f=this.element.find(".e-uploadinput"),e=this,this.model.extensionsAllow!=""?(s=this.model.extensionsAllow.replace(/\s/g,"").toLowerCase().split(","),n(t).each(function(){n.inArray(this.extension.toLowerCase(),s)==-1?(i={action:"Files Processing",error:r._getLocalizedLabels("allowError").replace("#Extension",s.join(", ")),files:this},e._trigger("error",i),r._resetFileInput(f),o=!1):this.extension!=""&&u.push(this)})):this.model.extensionsDeny!=""?(c=this.model.extensionsDeny.replace(/\s/g,"").toLowerCase().split(","),n(t).each(function(){n.inArray(this.extension.toLowerCase(),c)!=-1?(i={action:"Files Processing",error:r._getLocalizedLabels("denyError").replace("#Extension",c.join(", ")),files:this},e._trigger("error",i),r._resetFileInput(f),o=!1):this.extension!=""&&u.push(this)})):n(t).each(function(){this.extension!=""&&u.push(this)}),this.model.fileSize!=""?(h=this.model.fileSize,n(u).each(function(){this.size>h?(i={action:"Files Processing",error:r._getLocalizedLabels("filedetail").replace("#fileSize",h),files:this},e._trigger("error",i),r._resetFileInput(f),o=!1):l.push(this)})):l=u,{files:l,status:o}},_fileListRemove:function(){fileList=this.updialog.find(".e-upload-file .e-delete");fileList.length==0&&(this.updialog.find(".e-uploadbtn").attr("disabled","disabled").addClass("e-disable"),this.updialog.ejDialog("close"))},_uploadHide:function(){fileList=this.updialog.find(".e-upload-file .e-file-cancel");fileList.length==0&&(this.updialog.find(".e-ul").empty(),this.updialog.find(".e-uploadbtn").attr("disabled","disabled").addClass("e-disable"),this.updialog.ejDialog("close"),this.upTooltip.hide())},_onBeforeClose:function(i){t.isNullOrUndefined(i.event)||(i.cancel=n(i.event.currentTarget).hasClass("e-disable")?!0:!1)},_dialogclose:function(t){if(!this._currentElement.hasClass("e-disable")){var u=this.updialog.find(".e-uploadclosebtn"),i,r;r=this.updialog.find(".e-ul").children().first();i=n(r).data("file");u.hasClass("e-disable")?t.preventDefault():(this._uploadFileListDelete(),this.updialog.ejDialog("close"));this._trigger("cancel",{fileStatus:i})}},_uploadFileListDelete:function(){this.updialog.find(".e-ul").empty();this._currentElement.find(".e-uploadinput").val("");this._resetFileInput(this._currentElement.find(".e-uploadinput"));this.model.asyncUpload||this._formResetSyncUpload()},_onXhrSelect:function(){var t,i;this._xhrBeforeUpload(this._files);t=this;n.each(t._files,function(r,u){i=n(u).data("filelist");t._setAction(i,"cancel");t.model.autoUpload?t._xhrPerformUpload(u):t._showUploadButton()})},_xhrBeforeUpload:function(t){var i,r,u,f;return i=t,r=this,n.each(i,function(t,i){u=r._createFormObjectXhr(i);n(i).data("formobject",u);f=r._pushFileDetails(i);n(i).data("filelist",f)}),i},_xhrPerformUpload:function(t){var o,i,e,u,f;if(u=new XMLHttpRequest,i=this,f={files:t},this._trigger("begin",f)){n(t).data("xhr",u);i._onRequestError(i,r,t);return}if(o=this.model.saveUrl,e=n(t).data("formobject"),e.append((this.model.uploadName&&this.model.uploadName!=""?this.model.uploadName:this.control.id)+"_data",JSON.stringify(f.data)),n(t).data("xhr",u),u.addEventListener("load",function(n){i._onRequestSuccess(i,n,t)},!1),u.addEventListener("error",function(n){i._onRequestError(i,n,t)},!1),u.upload.addEventListener("progress",function(n){i._onRequestProgress(i,n,t)},!1),u.open("POST",o),f={files:t,xhr:u},this._trigger("beforeSend",f)){n(t).data("xhr",u);i._onRequestError(i,r,t);return}u.send(e)},_xhrOnUploadButtonClick:function(){var r,f,u,t;for(r=this.model.showBrowseButton?this.diaObj.wrapper:this.dragWrapper,t=r.find(".e-ul li.e-upload-file"),i=0;i<t.length;i++)f=n(this),u=this._isFileUpload(t[i]),u&&this._xhrPerformUpload(n(t[i]).data("file"))},_xhrOnRemove:function(t,i){var u=n(i).find(".e-file-name").text().toString().split(","),r=this;n.ajax({url:this.model.removeUrl,type:"POST",data:"fileNames="+u,success:function(){n(i).remove();r._fileListRemove();r._trigger("remove",{fileStatus:r._file})}});this.upTooltip.hide()},_xhrOnCancel:function(t,i){var r,u;r=n(i).data("file");u=n(r).data("xhr");u&&n(r).data("xhr").abort();n(r).data("xhr",null);n(i).data("file",null);n(i).remove();this._uploadHide()},_xhrOnRetry:function(t,i){if(!this._currentElement.hasClass("e-disable")){var r=n(i).data("file");this._xhrPerformUpload(r)}},_onRequestSuccess:function(t,i,r){var u=n(r).data("xhr");u.status>=200&&u.status<=299?t._onXhrUploadSuccess(t,i,r):t._onRequestError(t,i,r);t._files.length==this._successFiles.length+this._errorFiles.length&&(t._trigger("complete",{files:r,responseText:u.responseText,success:this._successFiles,error:this._errorFiles,xhr:u,e:i}),this._onClearCompletedFiles())},_onClearCompletedFiles:function(){this._successFiles.length=this._errorFiles.length=0;this.model.dialogAction.closeOnComplete&&this._dialogclose()},_onXhrUploadSuccess:function(t,i,r){var u,f,o,s,e,h,c;u=n(r).data("filelist");f=n(r).data("xhr");t.model.removeUrl?(t._setAction(u,"remove"),t._setStatus(u,"success")):(u.find(".e-action-perform .e-icon,.e-file-percentage .e-icon").remove(),t._setStatus(u,"success"));n(r).length>0&&(o=n(u).find(".e-file-progress-status"),o.width("100%"),s=n(r)[0].size,e=this._formatSize(s),h=n(u).find(".e-file-size .e-file-name-txt"),h.html(e+"\\"+e));c={files:r,responseText:f.responseText,xhr:f,e:i};this.updialog.find(".e-file-upload .e-uploadclosebtn").html(this.model.buttonText.close).focus();t._trigger("success",c);this._successFiles.push(r)},_onRequestError:function(t,i,r){var f,u,e;f=n(r).data("filelist");u=n(r).data("xhr");t._setAction(f,"retry");t._setStatus(f,"failed");e={action:"File Processing",error:u.status?u.status+" "+u.statusText:"Unable to reach the server.",files:r,xhr:u,e:i};t._trigger("error",e);this._errorFiles.push(r)},_onRequestProgress:function(t,i,r){var u,f,e;u=Math.round(i.loaded*100/i.total);f=n(r).data("filelist");t._setProgress(f,u,i);t._setStatus(f,"progress");e={file:r,percentage:u,e:i};this._trigger("inProgress",e)},_createFormObjectXhr:function(n){var t=new FormData;return t.append(this.model.uploadName!=""?this.model.uploadName:this.control.id,n.rawFile),t},_getInputFileInfo:function(n){var t=n[0];return t.files?this._getAllFileInfo(t.files):[{name:this._GetName(t.value),extension:this._getFileExtensionType(t.value),size:this._getFileSizeinIE(t.value)}]},_getFileSizeinIE:function(n){var t,i;t=null;i=null;try{t=new ActiveXObject("Scripting.FileSystemObject")}catch(r){i=null}return t&&(i=t.getFile(n).size),i},_getFileExtensionType:function(n){return n.match?n.match(/\.([^\.]+)$/)?n.match(/\.([^\.]+)$/)[0]:"":""},_getAllFileInfo:function(t){var i=this;return n.map(t,function(n){return i._getFileInfo(n||t)})},_GetName:function(n){var t=n.lastIndexOf("\\");return t!=-1?n.substr(t+1):n},_getFileInfo:function(n){var t=n.name||n.fileName||n;return{name:t,extension:this._getFileExtensionType(t),size:n.size||n.fileSize,rawFile:n}},_formatSize:function(n){var t=-1;if(!n)return"0.0KB";do n=n/1024,t++;while(n>99);return Math.max(n,0).toFixed(1)+["KB","MB","GB","TB","PB","EB"][t]},_onSelectIFrame:function(t){var r,u,i,f;r=n(t.target);u=this._getInputFileInfo(r);i=this._beforeUploadIFrame(u);f=i.data("iframe");this.model.autoUpload?this._performUploadIFrame(i):this._showUploadButton();this._off(this.inputupload,"change");this._bindInputChangeEvent()},_onRemoveIFrame:function(t,i){var u,f,r,e;u=i.data("iframe");e=n(i).data("file");f=e[0].name;r=this;u?(this._removeFileEntry(i),this.model.removeUrl&&n.ajax({url:this.model.removeUrl,type:"POST",data:"fileNames="+f,success:function(){r._fileListRemove();r._trigger("remove",{fileStatus:r._file})}})):(this._removeFileEntry(i),this._trigger("remove",{fileStatus:this._file}))},_onCancelIFrame:function(n,t){var i;this._trigger("cancel",{Status:t});i=t.data("iframe");i&&(this._removeFileEntry(t),typeof i.stop!="undefined"?i.stop():i.document&&(i.document.execCommand("Stop"),i.contentWindow.location.href=i.contentWindow.location.href),this._processServerResponse(i,""));this._uploadHide()},_onRetryIFrame:function(n,t){this._performUploadIFrame(t)},_beforeUploadIFrame:function(n){var t,r,i;return t=this._createFrame(this.control.id+"_Iframe"+this.Uploadframes.length),this.Uploadframes.push(t),r=this._createForm(this.model.saveUrl,t[0].id),this._currentElement.find("input.e-uploadinput").removeClass("e-uploadinput").css("display","none").appendTo(r),this._createInputandBind(),i=this._pushFile(n,{iframe:t,form:r,file:n}),t.data({filelist:i}),this._setAction(i,"cancel"),i},_performUploadIFrame:function(t){var e,r,i,u,f;if(u={files:t},this._trigger("begin",u)){this._failureIframeUpload(t,"File upload has been denied");return}e=t.data("file");this._setStatus(t,"uploading");r=t.data("iframe");i=t.data("form");f=n("<input>").attr("name",(this.model.uploadName&&this.model.uploadName!=""?this.model.uploadName:this.control.id)+"_data").attr("type","hidden").val(JSON.stringify(u.data));i.append(f);r.appendTo(document.body);i.appendTo(document.body);this._on(r,"load",this._removeFramesIFrame);i.submit()},_onUploadButtonClickIFrame:function(){var t,i,r;t=this;n(".e-ul li.e-upload-file",t.updialog).each(function(){i=n(this);r=t._isFileUpload(i);r&&t._performUploadIFrame(i)})},_removeFramesIFrame:function(t){var u,i,r,f;u=n(t.target);f=this._files;r=u.data("filelist");try{i=n.trim(t.target.contentDocument.body.innerText.replace(/\n|\r/g," "))}catch(t){i="Server Error trying to get server response: "+t}i.substring(0,12)!="Server Error"&&i.indexOf("HTTP Error")!=0?(this._processServerResponse(u,i),this._setIframeProgress(r,100,t),this._setStatus(r,"progress"),this._successIframeUpload(r,i)):this._failureIframeUpload(r,i);r.length==this._successFiles.length+this._errorFiles.length&&(this._trigger("complete",{files:f,responseText:i,success:this._successFiles,error:this._errorFiles}),this._onClearCompletedFiles())},_setIframeProgress:function(t,i){var r;r=n(t).find(".e-file-progress-status");r.width(i+"%")},_successIframeUpload:function(n,t){fileEntry=n.data("file");this.model.removeUrl?(this._setAction(n,"remove"),this._setStatus(n,"success")):(n.find(".file-action").remove(),this._setStatus(n,"success"));args={files:fileEntry,responseText:t};this.updialog.find(".e-file-upload .e-uploadclosebtn").html(this.model.buttonText.close).focus();this._trigger("success",args);this._successFiles.push(fileEntry)},_failureIframeUpload:function(n,t){fileEntry=n.data("file");this.model.saveUrl&&t!="File upload has been denied"?(this._setAction(n,"retry"),this._setStatus(n,"failed")):(n.find(".file-action").remove(),this._setStatus(n,"failed"));args=t.indexOf("HTTP Error")==0?{files:fileEntry,responseText:t,status:t.match(/\d+/).toString()}:{files:fileEntry,responseText:t};this._trigger("error",args);this._errorFiles.push(fileEntry)},_processServerResponse:function(t){var i;i=n(document.body).find("form[target='"+n(t).attr("id")+"']");setTimeout(function(){i.remove();t.remove()},0)},_createDivBlock:function(n){return t.buildTag("div."+n)},_createForm:function(n,i){return t.buildTag("form","",{},{enctype:"multipart/form-data",method:"POST",action:n,target:i})},_createFrame:function(n){return t.buildTag("iframe#"+n,"",{display:"none"},{name:n})},_createInput:function(n){return t.buildTag("input","",{},{type:"file",name:n,"data-role":"none"})},_initObjectsSyncUpload:function(){this._currentElement.closest("form").attr("enctype","multipart/form-data").attr("encoding","multipart/form-data");this._wireEventsSyncUpload()},_wireEventsSyncUpload:function(){var t=this._currentElement.closest("form")[0];this._on(n(t),"submit",this._formSubmitSyncUpload);this._on(n(t),"reset",this._formResetSyncUpload)},_onSelectSyncUpload:function(t){var i,r,u;i=n(t.target);r=n(".e-selectpart",this.control);this._currentElement.find("input.e-uploadinput").removeClass("e-uploadinput").css("display","none").appendTo(r);this._createInputandBind();u=this._pushFile(this._files,{file:this._files,Input:i})},_onCancelSyncUpload:function(n,t){var i=t.data("Input");t.data("file",null);t.data("Input",null);t.remove();i.remove();this._uploadHide()},_formSubmitSyncUpload:function(){var t,i;t=n(".e-uploadinput",this.control);t.attr("name","");i=this.model.uploadName!=""?this.model.uploadName:this.control.id;setTimeout(function(){t.attr("name",i)},0)},_formResetSyncUpload:function(){n(".e-selectpart",this.control).children('input[type="file"]').each(function(){n(this).hasClass("e-uploadinput")||n(this).remove()})}});t.Uploadbox.Locale=t.Uploadbox.Locale||{};t.Uploadbox.Locale["default"]=t.Uploadbox.Locale["en-US"]={buttonText:{upload:"Upload",browse:"Browse",cancel:"Cancel",close:"Close"},dialogText:{title:"Upload Box",name:"Name",size:"Size",status:"Status"},dropAreaText:"Drop files or click to upload",filedetail:"The selected file size is too large. Please select a file within #fileSize",denyError:"Files with #Extension extensions are not allowed.",allowError:"Only files with #Extension extensions are allowed.",cancelToolTip:"Cancel",removeToolTip:"Remove",retryToolTip:"Retry",completedToolTip:"Completed",failedToolTip:"Failed",closeToolTip:"Close"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejRTE","ej.RTE",{element:null,model:null,_rootCSS:"e-rte",validTags:["textarea"],_addOnPersist:["value","height","width"],_setFirst:!1,_requiresID:!0,_operationHandler:null,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{allowEditing:!0,isResponsive:!1,allowKeyboardNavigation:!0,enableTabKeyNavigation:!0,cssClass:"",height:"370",width:"786",enabled:!0,htmlAttributes:null,externalCSS:null,enableXHTML:!1,importSettings:{url:""},exportToPdfSettings:{url:"",fileName:"PdfExport"},exportToWordSettings:{url:"",fileName:"WordExport"},validationRules:null,validationMessage:null,maxLength:7e3,minWidth:"400",maxWidth:null,minHeight:"280",maxHeight:null,showToolbar:!0,showFooter:!1,showHtmlSource:!1,showWordCount:!0,showCharCount:!0,showHtmlTagInfo:!0,showClearAll:!1,iframeAttributes:null,showClearFormat:!0,showContextMenu:!0,showFontOption:!0,autoFocus:!1,enableHtmlEncode:!1,showDimensions:!1,showRoundedCorner:!1,locale:"en-US",name:"",pasteCleanupSettings:{listConversion:!1,cleanCSS:!1,removeStyles:!1,cleanElements:!1},toolbarOverflowMode:"popup",tools:{formatStyle:["format"],edit:[],style:["bold","italic","underline","strikethrough"],alignment:["justifyLeft","justifyCenter","justifyRight","justifyFull"],lists:["unorderedList","orderedList"],indenting:["outdent","indent"],doAction:["undo","redo"],links:["createLink","removeLink"],images:["image"],media:["video"],tables:["createTable","addRowAbove","addRowBelow","addColumnLeft","addColumnRight","deleteRow","deleteColumn","deleteTable"],view:["fullScreen"],customTools:[],print:[],customOrderList:[],customUnOrderList:[],font:[],clipboard:[],clear:[],effects:[],casing:[],importExport:[]},tooltipSettings:{associate:"mouseenter",showShadow:!0,position:{stem:{horizontal:"left",vertical:"top"}},tip:{size:{width:5,height:5}},isBalloon:!1},toolsList:["formatStyle","font","style","effects","alignment","lists","indenting","clipboard","doAction","clear","links","images","media","tables","casing","customTools","view","print","edit","importExport"],colorCode:["000000","FFFFFF","C4C4C4","ADADAD","595959","262626","4f81bd","dbe5f1","b8cce4","95b3d7","366092","244061","c0504d","f2dcdb","e5b9b7","d99694","953734","632423","9bbb59","ebf1dd","d7e3bc","c3d69b","76923c","4f6128","8064a2","e5e0ec","ccc1d9","b2a2c7","5f497a","3f3151","f79646","fdeada","fbd5b5","fac08f","e36c09","974806"],format:[{text:"Paragraph",value:"<p>",spriteCssClass:"e-paragraph"},{text:"Quotation",value:"<blockquote>",spriteCssClass:"e-quotation"},{text:"Heading 1",value:"<h1>",spriteCssClass:"e-h1"},{text:"Heading 2",value:"<h2>",spriteCssClass:"e-h2"},{text:"Heading 3",value:"<h3>",spriteCssClass:"e-h3"},{text:"Heading 4",value:"<h4>",spriteCssClass:"e-h4"},{text:"Heading 5",value:"<h5>",spriteCssClass:"e-h5"},{text:"Heading 6",value:"<h6>",spriteCssClass:"e-h6"}],fontName:[{text:"Segoe UI",value:"Segoe UI"},{text:"Arial",value:"Arial,Helvetica,sans-serif"},{text:"Courier New",value:"Courier New,Courier,monospace"},{text:"Georgia",value:"Georgia,serif"},{text:"Impact",value:"Impact,Charcoal,sans-serif"},{text:"Lucida Console",value:"Lucida Console,Monaco,monospace"},{text:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{text:"Times New Roman",value:"Times New Roman,Times,serif"},{text:"Trebuchet MS",value:"Trebuchet MS,Helvetica,sans-serif"},{text:"Verdana",value:"Verdana,Geneva,sans-serif"}],fontSize:[{text:"1 (8pt)",value:"8pt"},{text:"2 (10pt)",value:"10pt"},{text:"3 (12pt)",value:"12pt"},{text:"4 (14pt)",value:"14pt"},{text:"5 (18pt)",value:"18pt"},{text:"6 (24pt)",value:"24pt"},{text:"7 (36pt)",value:"36pt"}],tableRows:8,tableColumns:10,colorPaletteRows:6,colorPaletteColumns:6,showCustomTable:!0,value:null,undoStackLimit:50,enableResize:!0,enablePersistence:!1,enableRTL:!1,autoHeight:!1,zoomStep:"0.05",imageBrowser:{filePath:"",extensionAllow:"*.png,*.gif,*.jpg,*.jpeg",ajaxAction:"",ajaxSettings:""},fileBrowser:{filePath:"",extensionAllow:"*.doc,*.docx,*.pdf,*.txt",ajaxAction:""},change:null,execute:null,keydown:null,keyup:null,create:null,destroy:null,contextMenuClick:null,preRender:null,select:null},dataTypes:{enabled:"boolean",autoFocus:"boolean",enableHtmlEncode:"boolean",autoHeight:"boolean",enableXHTML:"boolean",isResponsive:"boolean",enablePersistence:"boolean",showRoundedCorner:"boolean",showCustomTable:"boolean",enableResize:"boolean",importSettings:{url:"string"},exportToPdfSettings:{url:"string",fileName:"string"},exportToWordSettings:{url:"string",fileName:"string"},pasteCleanupSettings:{listConversion:"boolean",cleanCSS:"boolean",removeStyles:"boolean",cleanElements:"boolean"},showDimensions:"boolean",showFontOption:"boolean",showClearFormat:"boolean",showClearAll:"boolean",showHtmlTagInfo:"boolean",showWordCount:"boolean",showCharCount:"boolean",showHtmlSource:"boolean",allowKeyboardNavigation:"boolean",enableTabKeyNavigation:"boolean",allowEditing:"boolean",showToolbar:"boolean",showFooter:"boolean",showContextMenu:"boolean",enableRTL:"boolean",toolsList:"array",colorCode:"array",toolbarOverflowMode:"enum",format:"data",fontName:"data",fontSize:"data",htmlAttributes:"data",iframeAttributes:"data",tools:{formatStyle:"array",font:"array",edit:"array",style:"array",effects:"array",alignment:"array",lists:"array",indenting:"array",clipboard:"array",doAction:"array",clear:"array",links:"array",media:"array",images:"array",tables:"array",casing:"array",customTools:"array",view:"array",print:"array",importExport:"array",customOrderList:"array",customUnOrderList:"array"}},_rteIconsList:{format:"format",bold:"e-bold_01",italic:"e-italic_01",underline:"e-underline_01",strikethrough:"e-strikethrough_01",justifyLeft:"e-align-left_01",justifyCenter:"e-align-center_01",justifyRight:"e-align-right_01",justifyFull:"e-align-justify_01",unorderedList:"e-bullets_01",orderedList:"orderedList",outdent:"outdent",indent:"indent",undo:"undo",redo:"redo",createLink:"e-link_01",removeLink:"e-unlink_01",image:"e-image",video:"e-video",createTable:"e-table_02",addRowAbove:"e-insert-row-above_02",addRowBelow:"e-insert-row-below_02",addColumnLeft:"e-insert-column-left_02",addColumnRight:"e-insert-column-right_02",deleteRow:"e-delete-row_01",deleteColumn:"e-delete-column_01",deleteTable:"deleteTable",fullScreen:"fullScreen",superscript:"e-superscript_01",subscript:"e-subscript_01",upperCase:"e-uppercase_01",lowerCase:"e-lowercase_01",zoomIn:"e-zoom-in",zoomOut:"e-zoom-out",print:"print","import":"e-upload",wordExport:"e-icon e-word-export",pdfExport:"e-icon e-pdf-export",findAndReplace:"findAndReplace",cut:"e-cut_01",copy:"e-copy_02",paste:"e-paste_01",clearFormat:"clearFormat",clearAll:"e-delete_05",fontName:"fontName",fontSize:"fontSize",fontColor:"e-font",backgroundColor:"e-background-color",rteResize:"e-resize-handle",rteSource:"e-file-code",customTableImage:"e-table",resize:"e-full-screen-collapse_01",maximize:"e-full-screen-expand_01",openLink:"",deleteTables:"",insertTable:"",tableProperties:"",imageProperties:""},observables:["value"],value:t.util.valueFunction("value"),_setModel:function(i){var r,f,e,s,c,h,u,o;this._isInteraction=!1;for(r in i){switch(r){case"allowEditing":this._enableEdit(i[r]);break;case"autoFocus ":this.model.autoFocus=i[r];i[r]&&this._focus();break;case"showToolbar":i[r]?t.isNullOrUndefined(this._rteToolbar)?this._renderToolBar():(this._rteToolbar.show(),this.model.isResponsive&&this._toolBarObj._reSizeHandler()):this._rteToolbar.hide();break;case"showFooter":this.model.showFooter=i[r];i[r]?t.isNullOrUndefined(this._rteFooter)?this._renderFooter():this._rteFooter.show():this._rteFooter.hide();break;case"pasteCleanupSettings":this.model.pasteCleanupSettings=i[r];t.clipboardCleaner&&(this._pasteCleaner||this._enableContentCleaner(),this._pasteCleaner&&(this._pasteCleaner.filterOptions=i[r]));case"isResponsive":this.model.isResponsive=i[r];this._renderToolBarList();f=n(this._rteIframe).outerHeight();e=n(this._rteToolbar).outerHeight();n(this._rteWapper).height(f+e);t.isNullOrUndefined(n(this._rteFooter))||(s=n(this._rteFooter).outerHeight(),n(this._rteWapper).height(f+s+e));break;case"enabled":this._disabled(i[r]);break;case"height":this.model.height=i[r];this._rteWapper.height(i[r]);break;case"width":this.model.height=i[r];this._rteWapper.css("width",i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"showHtmlSource":this._footerElement("div.e-rte-source",i[r]);break;case"showHtmlTagInfo":this._footerElement("div.e-rte-htmltaginfo",i[r]);break;case"showWordCount":this.model.showWordCount=i[r];this._createCountElement(i[r],this._wordCount);break;case"showCharCount":this.model.showCharCount=i[r];this._createCountElement(i[r],this._charCount);break;case"tooltipSettings":this.model.tooltipSettings=n.extend(!0,this.model.tooltipSettings,i[r]);this.model.showToolbar&&this._toolBarItems.ejToolbar("option","tooltipSettings",i[r]);this._renderTooltip(this.model.tooltipSettings);break;case"showClearAll":this._footerElement("div.clearAll",i[r]);break;case"showClearFormat":this._footerElement("div.clearFormat",i[r]);break;case"enableResize":this._footerElement("div.e-rte-resize",i[r]);break;case"fontName":this._fontStyleDDL.ejDropDownList({dataSource:i[r]});break;case"fontSize":this._fontSizeDDL.ejDropDownList({dataSource:i[r]});break;case"format":this._formatDDL.ejDropDownList({dataSource:i[r]});break;case"value":t.isPlainObject(i[r])&&(i[r]=null);this._getDocument().body.innerHTML=t.util.getVal(i[r]);c={text:this._getText(),htmlText:this.getHtml()};this._onChange();break;case"showDimensions":i[r]?(this._imgDialog.find("div.e-rte-imgdimensions").show(),this._imgDialog.find("div.e-rte-videoDimensions").show()):(this._imgDialog.find("div.e-rte-imgdimensions").hide(),this._imgDialog.find("div.e-rte-videoDimensions").hide());break;case"showFontOption":i[r]?this._rteWapper.find("ul.e-rte-fontgroup").show():this._rteWapper.find("ul.e-rte-fontgroup").hide();break;case"locale":this.model.locale=i[r];h=this.model;this.element.ejRTE("destroy").ejRTE(h);break;case"importSettings":this.model.importSettings=n.extend(!0,this.model.importSettings,i[r]);break;case"exportToPdfSettings":this.model.exportToPdfSettings=n.extend(!0,this.model.exportToPdfSettings,i[r]);break;case"exportToWordSettings":this.model.exportToWordSettings=n.extend(!0,this.model.exportToWordSettings,i[r]);break;case"tableRows":this.model.tableRows=i[r];u=this._createTable.find("div.e-rte-table").html("");this._drawTable(u);break;case"iframeAttributes":this._updateIframeSkin(i[r]);break;case"tableColumns":this.model.tableColumns=i[r];u=this._createTable.find("div.e-rte-table").html("");this._drawTable(u);break;case"showCustomTable":o=this._createTable.find("div.customtable-group");i[r]?t.isNullOrUndefined(this._customTableDialog)?this._createCustomTable():o.show():o.hide();break;case"colorPaletteRows":this.model.colorPaletteRows=i[r];this._updateColorPalette();break;case"colorPaletteColumns":this.model.colorPaletteColumns=i[r];this._updateColorPalette();break;case"colorCode":this.model.colorCode=i[r];this._updateColorPalette();break;case"name":this.model.name=i[r];this._checkNameAttr();break;case"showContextMenu":this.model.showContextMenu=i[r];this._showHideContextMenu();break;case"enableRTL":this._enableRTL(i[r]);break;case"htmlAttributes":this._addAttr(i[r]);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"validationRules":this.element.closest("form").length!=0&&(this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null),this.model.validationRules=i[r],this.model.validationRules!=null&&(this._initValidator(),this._setValidation()));break;case"validationMessage":this.element.closest("form").length!=0&&(this.model.validationMessage=i[r],this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation()));break;case"autoHeight":this.model.autoHeight=i[r];this._setAutoHeight()}r!="locale"&&this._setIframeHeight()}this._updateCount()},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.RTE",this.model.locale)},_enableContentCleaner:function(){t.clipboardCleaner&&!this._isIE8()&&(this._pasteCleaner||(this._pasteCleaner=new t.clipboardCleaner(this._getDocument(),this._iframePaste,this)),this._pasteCleaner.filterOptions=this.model.pasteCleanupSettings)},_init:function(){t.isNullOrUndefined(this.element)||this.element[0].type!="textarea"||(this._updateLocalConstant(),this.element.hide(),this._initialize()._render(),this.model.allowEditing&&this._wireEvents(),this.model.pasteCleanupSettings&&(this.model.pasteCleanupSettings.cleanElements||this.model.pasteCleanupSettings.removeStyles||this.model.pasteCleanupSettings.cleanCSS||this.model.pasteCleanupSettings.listConversion)&&this._enableContentCleaner(),this._updateIframeSkin(this.model.iframeAttributes),this.model.enabled==!1&&this._disabled(this.model.enabled),this._addAttr(this.model.htmlAttributes),this.model.autoFocus&&(this._focus(),this._updateToolbarStatus(),this._updateFontOptionStatus(),this._updateFormat()),this.model.enableHtmlEncode&&this.value(this._encode(this._decode(this.value()))),this.model.showToolbar&&(this.disableToolbarItem("removeLink"),t.isNullOrUndefined(this._getWindow())||this._updateIndentStatus()),this.model.enableRTL&&this._enableRTL(!0),this.model.externalCSS&&this._addCssToIframe(this.model.externalCSS),this.wrapper=this._rteWapper,this.model.validationRules!=null&&(this._initValidator(),this._setValidation()),this.model.showContextMenu&&this._showHideContextMenu(),this._isInteraction=!0)},_hideContextMenuByItem:function(t){for(index1=0;index1<n(this._textMenuObj.element).children("li").length;index1++)n.inArray(n(n(this._textMenuObj.element).children("li")[index1]).attr("id"),t)!=-1?n(n(this._textMenuObj.element).children("li")[index1]).show():n(n(this._textMenuObj.element).children("li")[index1]).hide()},_filterMenuItems:function(i){var r=this._isIE()?this._currentSelNode:this._getSelectedNode(),u=this._saveSelection().commonAncestorContainer;t.isNullOrUndefined(r)||t.isNullOrUndefined(r.tagName)||r.tagName.toLowerCase()!=="img"&&i.target.tagName.toLowerCase()!="img"?!t.isNullOrUndefined(r)&&n(r).closest("table").length?(this._hideContextMenuByItem(n(r).closest("a").length?this._contextType.table_hyper:this._contextType.table),this._contextValidation(u,i)):!t.isNullOrUndefined(r)&&n(r).closest("a").length?(this._hideContextMenuByItem(this._contextType.hyperlink),this._contextValidation(u,i)):this._isIE8()?(this._hideContextMenuByItem(this._contextType.text),this._updateContextMenuItemState(this._getRange().text!=="")):(this._hideContextMenuByItem(this._contextType.text),this._contextValidation(u,i)):(this._hideContextMenuByItem(this._contextType.image),this._updateContextMenuItemState(!0));this._rteIframe.contents().find("body").addClass("e-cursor")},_contextmenuPosition:function(t){var u=(t.clientX==r?0:t.clientX)+this._rteWapper.offset().left,i=(t.clientY==r?0:t.clientY)+this._rteWapper.offset().top+(this._rteToolbar?this._rteToolbar.outerHeight():0),f=n(this._textMenuObj.element).attr("style","visibility: visible;display:block;").height(),e=n(this._textMenuObj.element).width();i=i+f<n(document).scrollTop()+n(window).height()?i:i-f<0?i:i-f;u=u+e<n(document).scrollLeft()+n(window).width()?u:u-e;n(this._textMenuObj.element).attr("style","width:auto;left:"+u+"px;top:"+i+"px;z-index:"+(this._onGetMaxZindex()+1)).focus()},_contextValidation:function(n){this._updateContextMenuItemState(n&&(data=n.nodeValue?n.nodeValue:n.textContent)&&(this._saveSelection().endContainer==this._saveSelection().startContainer?data.substring(this._saveSelection().startOffset,this._saveSelection().endOffset)!=="":!0))},_updateContextMenuItemState:function(n){n?(this._textMenuObj.enableItemByID("cut"),this._textMenuObj.enableItemByID("copy")):(this._textMenuObj.disableItemByID("cut"),this._textMenuObj.disableItemByID("copy"))},_contextMenuClick:function(i){var f=i.ID?i.ID.toLowerCase():n(i.element).attr("id").toLowerCase(),u;this._isIE()&&this._ieSelectionRange&&this.selectRange(this._ieSelectionRange);switch(f){case"cut":!this._isIE()&&this._getValidbrowser(t.browserInfo().name)?this._openAlert(this._getLocalizedLabels("cutAlert")):this._getDocument().execCommand(f,!1,r);this._imgOrg&&this._imgDupDiv&&this._imgBoxMouseMove&&(n(this._imgOrg).css("outline",""),n(this._imgDupDiv).remove(),this._off(n(this._getDocument()),"mousemove",this._imgBoxMouseMove));this._updateCursor();break;case"copy":!this._isIE()&&this._getValidbrowser(t.browserInfo().name)?this._openAlert(this._getLocalizedLabels("copyAlert")):this._getDocument().execCommand(f,!1,r);this.selectRange(this._getRange());break;case"paste":this._isIE()?this._getDocument().execCommand(f,!1,r):this._openAlert(this._getLocalizedLabels("pasteAlert"));break;case"openlink":this._onOpen();break;case"createlink":this._linkDialog||this._renderLinkDialog();this._hyperLinkManager(!1);break;case"imageproperties":this._imgDialog||this._renderImageDialog();this._imageManager();break;case"addcolumnleft":u=this.insertColumn(!0,this._currentSelNode);this._updateCursor(u);break;case"addcolumnright":u=this.insertColumn(!1,this._currentSelNode);this._updateCursor(u);break;case"addrowabove":u=this.insertRow(!0,this._currentSelNode);this._updateCursor(u);break;case"addrowbelow":u=this.insertRow(!1,this._currentSelNode);this._updateCursor(u);break;case"deleterow":this.removeRow(this._currentSelNode);break;case"deletecolumn":this.removeColumn(this._currentSelNode);break;case"deletetable":this.removeTable(n(this._currentSelNode).closest("table"));break;case"tableproperties":this._eTblDialog||this._renderEditTableDialog();this._eTblManager();this._eTblDialog.ejDialog("open");break;case"removelink":this._onUnlink()}this._trigger("contextMenuClick",{event:i});this._onChange()},_updateCursor:function(n,t){if(!this._isIE8()){var i=this._getDocument().createRange(),r=this._getRange();n?this._setRange(n,r,!0):t?(i.setStart(t.startContainer,t.startOffset),i.setEnd(t.endContainer,t.endOffset),this.selectRange(i)):(i.setStart(r.startContainer,r.startOffset),i.setEnd(r.startContainer,r.startOffset),this.selectRange(i))}},_loadRules:function(){jQuery.validator.addMethod("contentRequired",function(t,i){return n.trim(n(i).data("ejRTE")._getText())},"Please specify the value.");jQuery.validator.addMethod("maxWordCount",function(t,i,r){return n.trim(n(i).data("ejRTE")._getText()).split(/\W+/).length<=r},"Please enter the content with in max word count.");jQuery.validator.addMethod("minWordCount",function(t,i,r){return n.trim(n(i).data("ejRTE")._getText()).split(/\W+/).length>=r},"Please enter the content with min word count.");jQuery.validator.addMethod("minCharCount",function(t,i,r){return n(i).data("ejRTE")._getText().length>=r},"Please enter the content with min length.");jQuery.validator.addMethod("maxCharCount",function(t,i,r){return n(i).data("ejRTE")._getText().length<=r},"Please enter the content with in max length.");this._customRules={required:"contentRequired",maxWordCount:"maxWordCount",minWordCount:"minWordCount",maxlength:"maxCharCount",minlength:"minCharCount",equalTo:"equalTo"}},_initValidator:function(){this._loadRules();this.element.closest("form").data("validator")||this.element.closest("form").validate()},_getRuleData:function(n,t){var i=null;switch(n){case"contentRequired":i={contentRequired:t};break;case"minCharCount":i={minCharCount:t};break;case"maxCharCount":i={maxCharCount:t};break;case"maxWordCount":i={maxWordCount:t};break;case"minWordCount":i={minWordCount:t};break;case"equalTo":i={equalTo:t}}return i},_setValidation:function(){var f,i,o,e,r,u,s;if(this.element.closest("form").length!=0){f=this.element.closest("form").validate();e=this.element.attr("name");f.settings.messages[e]={};for(r in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[r])&&this._customRules[r]){if(i=this._customRules[r],o=this.model.validationRules[r],this.element.rules("add",this._getRuleData(i,o)),t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){f.settings.messages[e][i]=n.validator.messages[i];for(s in this.model.validationMessage)r==s?u=this.model.validationMessage[r]:""}else u=this.model.validationRules.messages[i];f.settings.messages[e][i]=u!=null?u:n.validator.messages[i]}}},_addAttr:function(t){if(t!=null){var i=this;n.map(t,function(n,t){t=="class"?i._rteWapper.addClass(n):t=="name"?i.element.attr(t,n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i.disable():t=="readOnly"&&n=="readOnly"?i._enableEdit(!1):i._rteWapper.attr(t,n)})}},_addCssToIframe:function(t){for(var i,u=n.isArray(t)?t:t.split(","),r=0;r<u.length;r++)i=document.createElement("link"),i.href=u[r],i.rel="stylesheet",i.type="text/css",this._rteIframe.contents().find("head").append(i)},_disabled:function(n){n!=!0?this.disable():this.enable()},_destroy:function(){this.element.insertBefore(this._rteWapper);t.isNullOrUndefined(this._tooltip)||n(this._rteFooter).ejTooltip("destroy");t.isNullOrUndefined(this._formatDDL)||this._formatDDL.ejDropDownList("destroy");t.isNullOrUndefined(this._fontStyleDDL)||this._fontStyleDDL.ejDropDownList("destroy");t.isNullOrUndefined(this._fontSizeDDL)||this._fontSizeDDL.ejDropDownList("destroy");t.isNullOrUndefined(this._fontColorSplit)||this._fontColorSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._bgColorSplit)||this._bgColorSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._unOrderSplit)||this._unOrderSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._orderSplit)||this._orderSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._customTableDialog)||(t.isNullOrUndefined(this._customTableDialog.find(".e-rte-ddlAlignment"))||this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("destroy"),t.isNullOrUndefined(this._customTableDialog.find(".e-rte-txtBorder"))||this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("destroy"));t.isNullOrUndefined(this._linkDialog)||n(this._linkDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._imgDialog)||(this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList("destroy"),n(this._imgDialog).closest("div.e-rte.e-dialog-wrap").remove());t.isNullOrUndefined(this._videoDialog)||n(this._videoDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._createTable)||n(this._createTable).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._sourceDialog)||n(this._sourceDialog).closest("div.e-dialog-wrap").remove();t.isNullOrUndefined(this._customColor)||n(this._customColor).closest("div.e-dialog-wrap").remove();t.isNullOrUndefined(this._customTableDialog)||n(this._customTableDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._customTableDialog)||n(this._customTableDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._alertWindow)||n(this._alertWindow).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._eTblDialog)||(this._eTblDialog.find(".e-rte-dropdown").ejDropDownList("destroy"),n(this._eTblDialog).closest("div.e-rte.e-dialog-wrap").remove());t.isNullOrUndefined(this._explorerObj)||this._explorerObj.destroy();t.isNullOrUndefined(this._imgPicker)||this._imgPicker.destroy();t.isNullOrUndefined(this._tblborderPicker)||this._tblborderPicker.destroy();t.isNullOrUndefined(this._fileDialog)||n(this._fileDialog).closest("div.e-rte.e-dialog-wrap").remove();this._textMenuObj&&this._textMenuObj.destroy();this._toolBarObj&&this._toolBarObj.destroy();this._rteWapper.remove();n("#"+this._rteId+"customcolor_popup").length>0&&n("#"+this._rteId+"customcolor_popup").remove();n("#"+this._rteId+"customcolor_Presets").length>0&&n("#"+this._rteId+"customcolor_Presets").remove();this.element.show();this.element.focus();this._createTable=null;this._unwireEvents()},_initialize:function(){return this._toolsList=this.model.toolsList,this._rteId=this.element[0].id,this._rteId=this._rteId?this._rteId:"",this._backupArray=[],this._undoRedoPosition=0,this._fontColor="#000000",this._bgColor="#ffffff",this._imgWidth=0,this._imgHeight=0,this._videoWidth=0,this._videoHeight=0,this._keypressFlag=!0,this._styleItems=t.isNullOrUndefined(this.model.tools.style)?[]:this.model.tools.style,this._alignItems=t.isNullOrUndefined(this.model.tools.alignment)?[]:this.model.tools.alignment,this._listItems=t.isNullOrUndefined(this.model.tools.lists)?[]:this.model.tools.lists,this._scriptsItems=t.isNullOrUndefined(this.model.tools.effects)?[]:this.model.tools.effects,this._contextMenu=["cut","copy","paste","|","insertTable",["addColumnLeft","addColumnRight","addRowAbove","addRowBelow"],"|","deleteTables",["deleteRow","deleteColumn","deleteTable"],"|","tableProperties","|","createLink","openLink","removeLink","imageProperties"],this._contextType={text:["cut","copy","paste","createLink"],image:["cut","copy","paste","imageProperties"],hyperlink:["cut","copy","paste","createLink","openLink","removeLink"],table:["cut","copy","paste","insertTable","deleteTables","tableProperties","createLink"],table_hyper:["cut","copy","paste","insertTable","deleteTables","tableProperties","createLink","openLink","removeLink"]},this},_render:function(){this._renderWrapper()._checkNameAttr();this.model.showToolbar&&this._renderToolBar();this._trigger("preRender",this.element);this._renderEditArea();this.model.showFooter&&this._renderFooter();this._setIframeHeight();this._rteWidth=this.model.width;this._rteHeight=this.model.height;this._renderAlertDialog();this._roundedCorner(this.model.showRoundedCorner)},_initContextMenu:function(){for(var r,t,i=[],n=0;n<this._contextMenu.length;n++)if(this._contextMenu[n]!="|")if(typeof this._contextMenu[n]=="object")for(r=n+1,t=0;t<this._contextMenu[n].length;t++)this._contextMenu[n][t]!="|"&&i.push({id:this._contextMenu[n][t],parentId:this._contextMenu[n-1],text:this._getLocalizedLabels(this._contextMenu[n][t]),sprite:"e-rte-toolbar-icon "+this._contextMenu[n][t]+" "+this._rteIconsList[this._contextMenu[n][t]],htmlAttr:this._contextMenu[n+1][t+1]=="|"?{"class":"e-rte-separator",id:this._contextMenu[n][t]}:{id:this._contextMenu[n][t]}});else i.push({id:this._contextMenu[n],parentId:null,text:this._getLocalizedLabels(this._contextMenu[n]),sprite:"e-rte-toolbar-icon "+this._contextMenu[n]+" "+this._rteIconsList[this._contextMenu[n]],htmlAttr:this._contextMenu[n+1]=="|"?{"class":"e-rte-separator",id:this._contextMenu[n]}:{id:this._contextMenu[n]}});return i},_createContextMenu:function(){var r=t.buildTag("ul.e-rte-context-menu #"+this._id+"_contextmenu"),i=this;return r.ejMenu({menuType:t.MenuType.ContextMenu,enableSeparator:!0,width:"auto",enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,contextMenuTarget:this._getDocument(),click:n.proxy(this._contextMenuClick,this),fields:{dataSource:this._initContextMenu(),id:"id",parentId:"parentId",text:"text",htmlAttribute:"htmlAttr",spriteCssClass:"sprite"},beforeOpen:function(t){i._isIE()&&i._ieSelectionRange&&i.selectRange(i._ieSelectionRange);i.model.enabled?this.enable():this.disable();i._filterMenuItems(i._contextMenuEventArgs=t.events);n(this.element).parent().hide()},open:function(){n(this.element).attr("style","visibility:visible;width:auto;display:block;left:0px;top:0px;");n(this.element).parent().show();i._contextmenuPosition(i._contextMenuEventArgs);this._showAnimation(this.element,this._showAnim);n(this.element).focus()},close:function(){n(i._getDocument()).find("body").removeClass("e-cursor")}}),r},_showHideContextMenu:function(){this.model.allowEditing&&this.model.enabled&&this.model.showContextMenu&&this._getDocument()?(this._textMenuObj=this._createContextMenu().data("ejMenu"),this._textMenuObj._off(n(this._textMenuObj.model.contextMenuTarget),"mouseup taphold",this._textMenuObj._ContextMenuHandler),this._textMenuObj._on(n(this._textMenuObj.model.contextMenuTarget),"mouseup",this._textMenuObj._ContextMenuHandler)):this._textMenuObj&&this._textMenuObj.destroy()},_checkNameAttr:function(){this.model.name?this.element.attr({name:this.model.name}):t.isNullOrUndefined(this.element.attr("name"))&&this.element.attr({name:this.element[0].id})},_enableEdit:function(n){this.model.allowEditing=n;n?(this._wireEvents(),this.model.showToolbar&&this._toolBarItems.ejToolbar("option","click",this._toolBarClick),this._rteIframe.contents().find("body").attr("contenteditable",!0)):(this._unwireEvents(),this.model.showToolbar&&this._toolBarItems.ejToolbar("option","click",null),this._rteIframe.contents().find("body").attr("contenteditable",!1));this._showHideContextMenu();this._disableResizeObj(n)},_disableResizeObj:function(i){i?this.model.enableRTL||this._on(n(this._getDocument()).find("table.e-rte-table"),"mouseover",this._tableMouseOver):(t.browserInfo().name==="mozilla"&&(this._getDocument().designMode="off"),this._off(n(this._getDocument()).find("table.e-rte-table"),"mouseover",this._tableMouseOver),this._removeResizeObject())},_changeSkin:function(n){this._rteWapper.removeClass(this.model.cssClass).addClass(n);this._subControlsSetModel("cssClass",n)},_updateIframeSkin:function(t){try{var i=this._rteIframe.contents().find("body");t&&(proxy=this,n.map(t,function(n,t){t=="class"?i.addClass(n):t=="required"?i.attr(t,n):t=="disabled"&&n=="disabled"?proxy.disable():t=="readOnly"&&n=="readOnly"?proxy._enableEdit(!1):i.attr(t,n)}))}catch(r){return!1}},_renderWrapper:function(){return this.model.minHeight.toString().indexOf("%")>0&&(this.model.minHeight=parseInt(this.model.height)*parseInt(this.model.minHeight)/100),!t.isNullOrUndefined(this.model.maxHeight)&&this.model.maxHeight.toString().indexOf("%")>0&&(this.model.maxHeight=parseInt(this.model.height)+parseInt(this.model.height)*parseInt(this.model.maxHeight)/100),this.model.minWidth.toString().indexOf("%")>0&&(this.model.minWidth=parseInt(this.model.width)*parseInt(this.model.minWidth)/100),!t.isNullOrUndefined(this.model.maxWidth)&&this.model.maxWidth.toString().indexOf("%")>0&&(this.model.maxWidth=parseInt(this.model.width)+parseInt(this.model.width)*parseInt(this.model.maxWidth)/100),this._rteWapper=t.buildTag("div.e-rte e-rte-wrapper e-widget e-box "+this.model.cssClass+"#"+this._rteId+"_wrapper","",{},{role:"presentation"}).insertBefore(this.element),this._rteWapper.css("height",this.model.height).css("width",this.model.width).css("min-height",this.model.minHeight).css("min-width",this.model.minWidth).css("max-height",this.model.maxHeight).css("max-width",this.model.maxWidth),this._rteWapper.append(this.element.hide()),this},_renderToolBar:function(){this._rteToolbar=t.buildTag("div.e-rte-toolbar #"+this._rteId+"_tools").insertAfter(this.element);this._crateToolbarTemplate()._initToolBarItems()._renderToolBarList();this._renderToolBarItems();t.isNullOrUndefined(this._explorerObj)||this._rteToolbar.find("li.e-rteItem-image").length>0&&this._explorerObj.setModel({showFooter:!1,showTreeview:!1});t.isNullOrUndefined(this._fileBrowserObj)||this._rteToolbar.find("li.e-rteItem-fileBrowser").length>0&&this._fileBrowserObj.setModel({showFooter:!1,showTreeview:!1});t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"&&this._toolBarObj.disableItemByID(this._rteId+"_video")},_renderToolBarList:function(){var t={};t.click=this.model.allowEditing?this._toolBarClick:null;t.cssClass=this.model.cssClass;t.enableRTL=this.model.enableRTL;t.enableSeparator=!0;this.model.toolbarOverflowMode=="inline"&&(t.responsiveType="inline");t.isResponsive=this.model.isResponsive;t.height=t.isResponsive?"":"auto";t.showRoundedCorner=this.model.showRoundedCorner;t.tooltipSettings=this.model.tooltipSettings;t.create=function(){var t=n(this.element).find(".e-ddl.e-widget .e-dropdownlist"),i=n(this.element).find(".e-split.e-widget .e-splitbutton");t.length&&t.ejDropDownList({height:"30px"});i.length&&i.ejSplitButton({height:"30px"})};this._toolBarItems.ejToolbar(t);this._disableTabkeyNavigation(this._toolBarItems)._disableTabkeyNavigation(this._toolBarItems.find("[tabindex],.e-split-btn"));this._toolBarObj=this._toolBarItems.ejToolbar("instance");this._on(n(document),"mouseup touchend",this._zoomUp);this._on(n(this._toolBarObj.itemsContainer).find(".e-rteItem-zoomIn , .e-rteItem-zoomOut"),"mousedown touchstart",this._zoomDown)},_disableTabkeyNavigation:function(t){return n(t).attr("tabindex","-1"),this},_crateToolbarTemplate:function(){var i,r,u;this._toolBarItems=t.buildTag("div#"+this._rteId+"_toolbar").appendTo(this._rteToolbar).height(30);for(i in this._toolsList)i=this._toolsList[i],t.isNullOrUndefined(this.model.tools[i])||(i=="customTools"?t.isNullOrUndefined(this.model.tools[i])||this._customTools(this.model.tools[i]):this.model.tools[i].length>0&&this._createToolsItems(this.model.tools[i],i));return this.model.fileBrowser.filePath!=""&&(r=t.buildTag("ul#"+this._rteId+"-file-exporer"),u=n("<li id='"+this._rteId+"_fileBrowser' class='e-rte-explorer e-rteItem-fileBrowser' title='"+this._getLocalizedLabels("fileBrowser")+"' ><div class='e-rte-toolbar-icon fileBrowser e-fileBrowser' unselectable = 'on'><\/div><\/li>"),u.appendTo(r),r.appendTo(this._toolBarItems)),this},_createToolsItems:function(i,r){var f=t.buildTag("ul#"+(this._rteId+"_"+r)),e,u;for(r=="font"&&f.addClass("e-rte-fontgroup"),r=="formatStyle"&&f.addClass("e-rte-format"),r=="lists"&&f.addClass("e-rte-lists"),u=0;u<i.length;u++)e=n("<li id='"+(this._rteId+"_"+i[u].replace(/ /g,""))+"' class='e-rteItem-"+i[u]+"' ><div class='e-rte-toolbar-icon "+i[u]+" "+this._rteIconsList[i[u]]+"' unselectable = 'on'><\/div><\/li>"),i[u]==="video"&&t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"?e.attr("title",this._getLocalizedLabels("html5Support")):e.attr("title",this._getLocalizedLabels(i[u].replace(/ /g,""))),i[u]==="fullScreen"?e.attr("data-content",this._getLocalizedLabels("maximize")).children(".e-rte-toolbar-icon").addClass(this._rteIconsList.maximize):i[u]==="findAndReplace"&&e.attr("title",this._getLocalizedLabels("FindAndReplace")),e.appendTo(f);f.appendTo(this._toolBarItems);r!="font"||this.model.showFontOption||f.hide()},_customTools:function(i){for(var e,f,u,r=0;r<i.length;r++)e=t.buildTag("ul"),f=n("<li id='"+i[r].name+"' title='"+i[r].tooltip+"' ><div class='"+(t.isNullOrUndefined(i[r].css)?"":i[r].css)+"'>"+(t.isNullOrUndefined(i[r].text)?"":i[r].text)+"<\/div><\/li>"),u=i[r].action,typeof u=="string"&&(u=t.util.getObject(u,window)),t.isNullOrUndefined(i[r].action)||this._on(f,"click",u),n(i[r].template).appendTo(f.find("div")),f.appendTo(e),e.appendTo(this._toolBarItems)},_initToolBarItems:function(){return this._rteToolbar.find("li.e-rteItem-format").length>0&&this._renderFormat(),this._rteToolbar.find("li.e-rteItem-createLink").length>0&&this._renderLinkDialog(),this._rteToolbar.find("li.e-rteItem-video").length>0&&this._renderVideoDialog(),this._rteToolbar.find("li.e-rteItem-image").length>0&&this._renderImageDialog(),this._rteToolbar.find("li.e-rteItem-createTable").length>0&&this._renderTableDialog(),this._rteToolbar.find("li.e-rteItem-fontName").length>0&&this._renderFontStyle(),this._rteToolbar.find("li.e-rteItem-fontSize").length>0&&this._renderFontSize(),this._rteToolbar.find("li.e-rteItem-fontColor").length>0&&this._renderFontColor(),this._rteToolbar.find("li.e-rteItem-backgroundColor").length>0&&this._renderBGColor(),this._rteToolbar.find("li.e-rteItem-createTable").length>0&&this._renderEditTableDialog(),this._rteToolbar.find("li.e-rteItem-fileBrowser").length>0&&this._renderFileBrowserDialog(),this._rteToolbar.find("li.e-rteItem-unorderedList").length>0&&this._renderUnOrderList(),this._rteToolbar.find("li.e-rteItem-orderedList").length>0&&this._renderOrderList(),this._rteToolbar.find("li.e-rteItem-import").length>0&&this._renderimport(),this.model.showClearAll||this._rteToolbar.find("li.e-rteItem-clearAll").hide(),this},_renderToolBarItems:function(){this._toolBarObj.disableItemByID(this._rteId+"_undo");this._toolBarObj.disableItemByID(this._rteId+"_redo");this.model.enableRTL?this._toolBarObj.selectItemByID(this._rteId+"_justifyRight"):this._toolBarObj.selectItemByID(this._rteId+"_justifyLeft");var n=this._rteToolbar.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable");return this.model.isResponsive&&n.length==0?this._toolBarObj._liTemplte.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable").hide():this._rteToolbar.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable").hide(),this},_renderEditArea:function(){this._rteEditor=t.buildTag("div.editarea #"+this._rteId+"_editor").appendTo(this._rteWapper);this._rteIframe=t.buildTag("iframe.content-iframe #"+this._rteId+"_Iframe","",{},{frameborder:"0"}).appendTo(this._rteEditor);this._setIFrames();navigator.userAgent.match(/iPad/i)!=null&&this._rteEditor.addClass("e-ipadscroll")},_xhtmlTagValidation:function(){var n,o,s,e,u,i;if(this.value()!=null){if(n=this.value(),n=n.replace(/\r/gi," ").replace(/\n/gi,"<br/> ").replace(/\r\n/gi," ").replace(/( )+/gi," ").replace(/ /gi," ").replace(/•/gi,"*").replace(/<quo;/gi,"<").replace(/&rtquo;/gi,">").replace(/&trze;/gi,"(tm)").replace(/©/gi,"(c)").replace(/®/gi,"(r)"),n.indexOf("<body>")!=-1&&(o=n.indexOf("<body>"),s=n.slice(0,o+6),n=n.replace(s,"").replace("<\/body><\/html>","")),n=n.replace(/<br>/g,"<br/>").replace(/<hr>/g,"<hr/>"),n=this._imageXhtml(n),n=this._styleXhtml(n),n=this._startXhtml(n),n.indexOf("alt=")!=-1){for(var v=/alt=\"(.*?)\"/ig,f=[],h,c=0;(h=v.exec(n))!=null;)f[c]=h[0],c++;for(i=0;i<f.length;i++)n=n.replace(f[i],'alt=""')}if(!t.isNullOrUndefined(this._fontXhtml(n))){if(n=this._fontXhtml(n),n.indexOf("ol")!=-1){for(var y=/<ol(.*)<\/ol>/ig,l,a=0,r=[];(l=y.exec(n))!==null;)r[a]=l[0].toString(),a++;for(e=[],u=0;u<r.length;u++)e[u]=r[u];for(i=0;i<r.length;i++)r[i]=r[i].replace(/<br\/>/gi,"");for(i=0;i<r.length;i++)n=n.replace(e[i],r[i])}n=n.replace(/<o:p>/gi,"").replace(/<\/o:p>/gi,"")}this.value(n)}},_setIFrames:function(){var r=null,f,u,i;this.value()!=null&&this.value()!=""&&(r=this.value().replace(/'/g,'"'));r==null&&this.value(n.trim(this.element[0].value));f=t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)==8;u="<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <style>html, body{height: 100%;margin: 0;}body.e-cursor{cursor:default} span.e-selected-node\t{background-color: #939393;color: white;}span.e-selected-node.e-highlight{background-color: #1d9dd8;}body{font-family:Times New Roman,Times,serif;color:#5C5C5C;word-wrap:break-word;padding: 8px;box-sizing: border-box;}.e-rte-table caption{border: 1px solid;border-bottom:none}td{word-wrap:break-word;word-break:break-all;}.e-rteColumnResizer{position: absolute;bottom:0;overflow: visible;cursor: col-resize;background-repeat:repeat;background-color:transparent}.e-rteRowResizer{position: absolute;bottom:0;overflow: visible;margin-left: -4px;cursor: row-resize;background-repeat:repeat;background-color:transparent} span.e-rte-imageboxmark{width:5px;height:5px;position:absolute;display:block;background:#fff;border:1px solid #000;}<\/style><\/head><body spellcheck='false' autocorrect='off' contenteditable="+(this.model.allowEditing?"true":"false")+">"+(this.value()!=""&&this.value()!="<br>"?n.trim(this.value()):"<p><span><\/span><\/p>")+"<\/body><\/html>";this._rteIframe.css({width:"100%"});(this.element[0].value=="<div><\/div>"||this.element[0].value=="")&&(this.element[0].innerHTML=this.value());this._setContent(u);this._isIE8()&&this.value(this._getDocument().body.innerHTML);i=n(this._getDocument()).find("table");!this.model.enableRTL&&i.length>0&&this._on(i,"mouseover",this._tableMouseOver);this.model.enableXHTML&&this._updateValue();this._setAutoHeight();(!t.isNullOrUndefined(this.model.undoStackLimit)||this.model.undoStackLimit!==""||this.model.undoStackLimit>0)&&(this._backupArray[0]=this.getHtml())},_setIframeHeight:function(){var i=(!t.isNullOrUndefined(this._rteToolbar)&&this._rteToolbar.is(":visible")?this._rteToolbar.outerHeight():6)+(!t.isNullOrUndefined(this._rteFooter)&&this._rteFooter.is(":visible")?this._rteFooter.outerHeight():0);this._rteIframe.css("height",i==0?this.model.height:this._rteWapper.outerHeight()-i-(parseInt(this._rteEditor.css("padding-top"))+parseInt(n(".e-rte-wrapper").css("border-bottom-width"))+parseInt(this.model.showFooter?n(".e-rte-footer").css("margin-top"):0)))},_renderFooter:function(){var r=this.model,i,n;this._rteFooter=t.buildTag("div.e-rte-footer #"+this._rteId+"_footer").appendTo(this._rteWapper);i=t.buildTag("div.e-rte-footer-left");this._htmlSource=t.buildTag("div.e-rte-icons e-rte-footeritems e-rte-footericon e-rte-source "+this._rteIconsList.rteSource,"",{},{title:this._getLocalizedLabels("viewHtml")}).appendTo(i);this._htmlInfo=t.buildTag("div.e-rte-htmltaginfo e-rte-footeritems").appendTo(i);i.appendTo(this._rteFooter);n=t.buildTag("div.e-rte-footer-right");this._wordCount=t.buildTag("div.e-rte-wordcount e-rte-footeritems").appendTo(n);this._charCount=t.buildTag("div.e-rte-charcount e-rte-footeritems").appendTo(n);this._clearFormat=t.buildTag("div.e-rte-icons "+this._rteIconsList.clearFormat+" e-rte-footericon e-rte-footeritems","",{},{title:this._getLocalizedLabels("clearFormat"),unselectable:"on"}).appendTo(n);this._clearAll=t.buildTag("div.e-rte-icons clearAll "+this._rteIconsList.clearAll+" e-rte-footericon e-rte-footeritems","",{},{title:this._getLocalizedLabels("clearAll")}).appendTo(n);this._resize=t.buildTag("div.e-icons e-rte-resize "+this._rteIconsList.rteResize+" e-rte-footeritems").appendTo(n);n.appendTo(this._rteFooter);this._footerEvents("_on");this.model.showHtmlSource||this._htmlSource.hide().removeClass("e-rte-footeritems");this.model.showHtmlTagInfo||this._htmlInfo.hide().removeClass("e-rte-footeritems");this.model.showWordCount||this._wordCount.hide().removeClass("e-rte-footeritems");this.model.showCharCount||this._charCount.hide().removeClass("e-rte-footeritems");this.model.showClearAll||this._clearAll.hide().removeClass("e-rte-footeritems");this.model.showClearFormat||this._clearFormat.hide().removeClass("e-rte-footeritems");r.enableResize?this._enableResize():this._resize.hide().removeClass("e-rte-footeritems");this._updateCount();this.model.showWordCount&&this._on(this._wordCount,"click",this._wordCharClick);this.model.showCharCount&&this._on(this._charCount,"click",this._wordCharClick);this._renderTooltip(this.model.tooltipSettings)},_renderTooltip:function(i){var r=n.extend(!0,{},i);r.cssClass=t.isNullOrUndefined(r.cssClass)?"e-rteTooltip "+this.model.cssClass:r.cssClass+" e-rteTooltip "+this.model.cssClass;r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.target=".e-rte-icons";this.model.showFooter&&(this._tooltip=n(this._rteFooter).ejTooltip(r).data("ejTooltip"))},_hideTooltip:function(){t.isNullOrUndefined(this._tooltip)||this._tooltip.hide()},_footerElement:function(n,t){if(this.model.showFooter){var i=this._rteFooter.find(n);t?i.show().addClass("e-rte-footeritems"):i.hide().addClass("e-rte-footeritems")}},_wordCharClick:function(){this._alertWindow.ejDialog("option",{showHeader:!0,title:"<span style='padding-left:0.4em;'>"+this._getLocalizedLabels("wordCount")+"<\/span>"});this.model.enableRTL&&this._alertWindow.find(".e-alert-ok").removeClass("e-rte-alertBtnRTL");this._alertWindow.find(".e-rte-button").removeClass("e-fieldseparate").css({"text-align":"center","padding-bottom":"1em","padding-top":"0.5em"});this._alertWindow.ejDialog("instance").refresh();this._openAlert("<div style='padding-left:0.3em;padding-right:0.3em;'><div style='"+(this.model.enableRTL?"float:right":"float:left")+"'>"+this._getLocalizedLabels("words")+"<p style='margin:0.875em 0em;'>"+this._getLocalizedLabels("charSpace")+"<\/p><p style='margin:0.875em 0em;'>"+this._getLocalizedLabels("charNoSpace")+"<\/p><\/div><div style='"+(this.model.enableRTL?"float:left;padding-right:2em;":"float:right;padding-left:2em;")+"'>"+(n.trim(this._getText())!=""?n.trim(this._getText()).split(/\W+/).length:0)+"<p style='margin:0.875em 0em;'>"+this._getText().length+"<\/p><p style='margin:0.875em 0em;'>"+this._getText().replace(/\s/g,"").length+"<\/p><\/div><\/div><br/>")},_updateColorPalette:function(){var t=n("ul#"+this._rteId+"_colorTable"),i=n("ul#"+this._rteId+"_colorBGTable");t.find("div.e-rte-table").remove();t.find("li").append(this._colorTable());i.find("div.e-rte-table").remove();i.find("li").append(this._colorTable())},_enableRTL:function(n){try{n?this._rteIframe.contents().find("body").css("direction","rtl"):this._rteIframe.contents().find("body").css("direction","ltr")}catch(t){}this._subControlsSetModel("enableRTL",n)},_roundedCorner:function(n){n&&this._rteWapper.toggleClass("e-corner-all");this._subControlsSetModel("showRoundedCorner",n)},_subControlsSetModel:function(i,r){t.isNullOrUndefined(this._tooltip)||(i=="cssClass"?n(this._rteFooter).ejTooltip("option",i,"e-rteTooltip "+r):n(this._rteFooter).ejTooltip("option",i,r));t.isNullOrUndefined(this._formatDDL)||this._formatDDL.ejDropDownList("option",i,r);t.isNullOrUndefined(this._fontStyleDDL)||this._fontStyleDDL.ejDropDownList("option",i,r);t.isNullOrUndefined(this._fontSizeDDL)||this._fontSizeDDL.ejDropDownList("option",i,r);t.isNullOrUndefined(this._fontColorSplit)||this._fontColorSplit.ejSplitButton("option",i,r);t.isNullOrUndefined(this._bgColorSplit)||this._bgColorSplit.ejSplitButton("option",i,r);t.isNullOrUndefined(this._toolBarItems)||(i=="showRoundedCorner"&&this._toolBarItems.hasClass("e-corner-top")&&this._toolBarItems.removeClass("e-corner-top").addClass("e-corner-all"),this._toolBarItems.ejToolbar("option",i,r),i=="showRoundedCorner"&&this._toolBarItems.hasClass("e-corner-all")&&this._toolBarItems.removeClass("e-corner-all").addClass("e-corner-top"));t.isNullOrUndefined(this._linkDialog)||(this._linkDialog.ejDialog("option",i,r),this._linkDialog.find(".e-rte-btn").ejButton("option",i,r),this._chkTarget.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._linkDialog.find(".e-inputtext").addClass("e-corner-all"):this._linkDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._imgDialog)||(this._imgDialog.ejDialog("option",i,r),this._imgDialog.find("div.e-rte-imageTab").ejTab("option",i,r),this._imgDialog.find(".e-rte-imgBorderPx").ejNumericTextbox("option",i,r),this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList("option",i,r),this._chkImgDimensions.ejCheckBox("option",i,r),this._dialogchkTarget.ejCheckBox("option",i,r),this._imgDialog.find(".e-rte-btn").ejButton("option",i,r),i=="showRoundedCorner"&&(r==!0?this._imgDialog.find(".e-inputtext").addClass("e-corner-all"):this._imgDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._videoDialog)||(this._videoDialog.ejDialog("option",i,r),this._videoDialog.find(".e-rte-btn").ejButton("option",i,r),this._chkvideoDimensions.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._videoDialog.find(".e-inputtext").addClass("e-corner-all"):this._videoDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._createTable)||this._createTable.ejDialog("option",i,r);t.isNullOrUndefined(this._sourceDialog)||(this._sourceDialog.ejDialog("option",i,r),this._sourceDialog.find(".e-rte-btn").ejButton("option",i,r),i=="showRoundedCorner"&&(r==!0?this._sourceDialog.find(".e-inputtext").addClass("e-corner-all"):this._sourceDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._alertWindow)||(this._alertWindow.ejDialog("option",i,r),this._alertWindow.find(".e-rte-btn").ejButton("option",i,r));t.isNullOrUndefined(this._customTableDialog)||(this._customTableDialog.ejDialog("option",i,r),this._customTableDialog.find(".e-rte-btn").ejButton("option",i,r),this._customTableDialog.find(".numerictextbox").ejNumericTextbox("option",i,r),this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("option",i,r),this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("option",i,r),this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("option",i,r),this._chkTblCaption.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._customTableDialog.find(".e-inputtext").addClass("e-corner-all"):this._customTableDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._eTblDialog)||(this._eTblDialog.ejDialog("option",i,r),this._eTblDialog.find(".e-numerictextbox").ejNumericTextbox("option",i,r),this._eTblDialog.find(".e-rte-dropdown").ejDropDownList("option",i,r),this._getTableObj("_Tab").ejTab("option",i,r),this._eTblDialog.find(".e-rte-btn").ejButton("option",i,r),this._eTblCaption.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._eTblDialog.find(".e-inputtext").addClass("e-corner-all"):this._eTblDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._fileDialog)||(this._fileDialog.ejDialog("option",i,r),this._fileDialog.find(".e-rte-btn").ejButton("option",i,r),this._chkFileTarget.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._fileDialog.find(".e-inputtext").addClass("e-corner-all"):this._fileDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._explorerObj)||this._explorerObj.option(i,r);t.isNullOrUndefined(this._fileBrowserObj)||this._fileBrowserObj.option(i,r)},_createCountElement:function(n,t){n?t.show():t.hide();t.toggleClass("e-rte-footeritems")},_enableResize:function(){this.model.enableResize&&this.model.enabled&&(this._rteWapper.addClass("e-resizable"),this._resizeRTE())},_resizeRTE:function(){var i=this;this._overlayElement=t.buildTag("div.e-rte-overlay");this._rteEditor.css("position","relative");this._rteWapper.find("div.e-rte-resize").ejResizable({minHeight:parseInt(i.model.minHeight),minWidth:parseInt(i.model.minWidth),maxHeight:parseInt(i.model.maxHeight),maxWidth:parseInt(i.model.maxWidth),resizeStart:function(n){i._rteEditor.append(i._overlayElement);i._trigger("resizeStart",{event:n})},resize:function(n){i._updateCount();i._resizeHeight(n.element);i._trigger("resize",{event:n});i.model.isResponsive&&i.model.showToolbar&&i._toolBarObj._reSizeHandler()},resizeStop:function(n){i._overlayElement.remove();i._trigger("resizeStop",{event:n})},helper:function(t){return i._resizeHeight(t.element),n(i._rteWapper)}})},_getDocumentHandler:function(){return this._operationHandler||(this._operationHandler=new t.editorManager(this.getDocument(),this._getWindow())),this._operationHandler},_resizeHeight:function(t){var i=n(t).parents("div.e-rte-wrapper");this._rteWidth=n(i).width();this._rteHeight=n(i).height();this._rteWapper.height(this._rteHeight);this._rteWapper.width(this._rteWidth);this._setIframeHeight()},_getDialogModel:function(){var n=this._rteWapper;return dialogModel={enableResize:!1,showOnInit:!1,enableModal:!0,cssClass:this.model.cssClass,target:n,isResponsive:!0,enableRTL:this.model.enableRTL}},_labelFor:function(n){return this._rteId?" for="+this._rteId+n+" ":""},_TagId:function(n){return this._rteId?" id="+this._rteId+n+" ":""},_renderLinkDialog:function(){var f=this,i=this.model.enableRTL?"e-rtlrte":"",u=this._linkDialog=t.buildTag("div#"+this._rteId+"_link"),e=n("<div class='e-rte-label "+i+"'><label "+this._labelFor("_link_url")+">"+this._getLocalizedLabels("linkWebUrl")+"<\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-linkUrl' "+this._TagId("_link_url")+"/><\/div><div class='e-rte-label "+i+"'><label "+this._labelFor("_link_text")+">"+this._getLocalizedLabels("linkText")+"<\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-linkText' "+this._TagId("_link_text")+"><\/div><div class='e-rte-label "+i+"'><label "+this._labelFor("_link_title")+">"+this._getLocalizedLabels("linkTooltipLabel")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-linkTitle' "+this._TagId("_link_title")+"><\/div><div class='e-rte-label "+i+"'><\/div><div class='e-rte-field "+i+"'><input type='checkbox' class='e-rte-linkTarget' data-role ='none' "+this._TagId("_link_target")+"><label "+this._labelFor("_link_target")+" style='padding: 5px;'>"+this._getLocalizedLabels("linkOpenInNewWindow")+"<\/label><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+i+"' type='button' data-role ='none' id='link_insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+i+"'type='button' data-role ='none' id='link_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>"),r;e.appendTo(u);u.appendTo(this._rteWapper);r=this._getDialogModel();r.minWidth="340px";r.width="auto";r.title=this._getLocalizedLabels("createLink");r.target=null;r.closeIconTooltip=this._getLocalizedLabels("closeIcon");r.showRoundedCorner=this.model.showRoundedCorner;r.close=function(){f._ieCursorMaintainance()};u.ejDialog(r);u.closest(".e-dialog-wrap").addClass("e-rte");this.model.showRoundedCorner&&u.find(".e-inputtext").addClass("e-corner-all");this._chkTarget=u.find(".e-rte-linkTarget");this._chkTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});u.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(u.find(".e-rte-btn"),"click",this._linkBtnClick)._on(this._linkDialog.find(".e-rte-linkUrl"),"keypress",this._urlValidation)},_renderImageDialog:function(){var u=this,o="",i,f,r,e;this._imgDialog=t.buildTag("div#"+this._rteId+"_Image");i=this.model.enableRTL?"e-rtlrte":"";f="<div "+this._TagId("_img_Tab")+" class='e-rte-imageTab'><ul><li class='e-first'><a href='#"+this._rteId+"_general'>"+this._getLocalizedLabels("general")+" <\/a><\/li><li class='e-nofirst'><a href='#"+this._rteId+"_advanced'>"+this._getLocalizedLabels("advanced")+" <\/a><\/li><\/ul><div id='"+this._rteId+"_general'><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_url")+">"+this._getLocalizedLabels("imageWebUrl")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgUrl' "+this._TagId("_img_url")+"><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_text")+">"+this._getLocalizedLabels("imageAltText")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgText' "+this._TagId("_img_text")+"><\/div><\/div><div class='e-rte-imgdimensions' "+this._TagId("_imgdimensions")+"><div class='e-rte-label "+i+"'><label>"+this._getLocalizedLabels("dimensions")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' data-role ='none' class='e-inputtext e-dimensions e-rte-imgX' maxlength='3' "+this._TagId("_imgX")+"><label style='padding: 5px;'>X<\/label><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' style='margin-right: 5px;' class='e-inputtext e-dimensions e-rte-imgY' maxlength='3' "+this._TagId("_imgY")+"><\/div><input type='checkbox' class='e-rte-imgConsrn' data-role ='none'"+this._TagId("_img_consrn")+"<label "+this._labelFor("_img_consrn")+" style='padding: 5px;'>"+this._getLocalizedLabels("constrainProportions")+"<\/label><\/div><\/div><div id='"+this._rteId+"_advanced'><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_link")+">"+this._getLocalizedLabels("imageLink")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgLink' "+this._TagId("_img_link")+"><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_border_px")+">"+this._getLocalizedLabels("imageBorder")+"<\/label><\/div><div class='e-rte-field "+i+"'><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("imageBorder")+"' class='e-rte-imgBorderPx' maxlength='3' "+this._TagId("_img_border_px")+"><\/div><div class='e-img-border-field'><select class='e-rte-imgBorderStyle' data-role ='none' "+this._TagId("_img_border_style")+"><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input data-role ='none' type='text' title='"+this._getLocalizedLabels("imageBorder")+"' class='e-inputtext e-rte-imgBorderColor' "+this._TagId("_img_border_color")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_style")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgStyle' "+this._TagId("_img_style")+"><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><\/div><div class='e-rte-field "+i+"'><input type='checkbox' class='e-rte-imgLinkTarget' data-role ='none' "+this._TagId("_img_link_target")+"><label "+this._labelFor("_img_link_target")+" style='padding: 5px;'>"+this._getLocalizedLabels("linkOpenInNewWindow")+"<\/label><\/div><\/div><\/div><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+i+"' data-role ='none' type='button' id='"+this._rteId+"_img_insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+i+"' type='button' data-role ='none' id='"+this._rteId+"_img_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>";this.model.imageBrowser.filePath!=""&&(o="<div "+this._TagId("_img_explorer")+" class='e-rte-explorer e-rte-imgBrowser'><\/div>");f=n(o+f);f.appendTo(this._imgDialog);this._imgDialog.appendTo(this._rteWapper);this.model.showDimensions||this._rteWapper.find("div.e-rte-imgdimensions").hide();r=this._getDialogModel();r.maxWidth=this.model.imageBrowser.filePath==""?"470px":"720px";r.width="auto";r.title=this._getLocalizedLabels("image");r.target=null;r.closeIconTooltip=this._getLocalizedLabels("closeIcon");r.showRoundedCorner=this.model.showRoundedCorner;r.open=function(){u._explorerObj&&u._explorerObj.adjustSize();t.isNullOrUndefined(u._imgSplitObj)||u._imgSplitObj.option("enableAutoResize",!0)};r.close=function(){u._ieCursorMaintainance();t.isNullOrUndefined(u._imgSplitObj)||u._imgSplitObj.option("enableAutoResize",!1)};this._imgDialog.ejDialog(r);this._imgDialog.closest(".e-dialog-wrap").css({visibility:"hidden",display:"block"}).addClass("e-rte");this.model.imageBrowser.filePath!=""&&(e={upload:{url:this.model.imageBrowser.uploadAction}},this.model.imageBrowser.ajaxSettings&&n.extend(!0,e,this.model.imageBrowser.ajaxSettings),this._explorerObj=this._imgDialog.find("div.e-rte-imgBrowser").ejFileExplorer({allowMultiSelection:!1,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,cssClass:this.model.cssClass,maxWidth:"690px",isResponsive:!0,minWidth:"330px",height:"300px",path:this.model.imageBrowser.filePath,fileTypes:this.model.imageBrowser.extensionAllow,layout:t.FileExplorer.layoutType.LargeIcons,select:function(n){u._UpdateImgDetails(n)},tools:{creation:["NewFolder","Open"],navigation:["Back","Forward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete"],searchBar:["Searchbar"]},toolsList:["creation","navigation","addressBar","editing","searchBar"],enableResize:!1,showContextMenu:!1,ajaxAction:this.model.imageBrowser.ajaxAction,locale:this.model.locale,ajaxSettings:e}).data("ejFileExplorer"),this._imgSplitObj=this._imgDialog.find(".e-splitter").data("ejSplitter"),this._imgSplitObj.option("enableAutoResize",!1));this.model.showRoundedCorner&&this._imgDialog.find(".e-inputtext").addClass("e-corner-all");this._imgDialog.find("div.e-rte-imageTab").ejTab({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._imgDialog.find(".e-rte-imgBorderPx").ejNumericTextbox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",minValue:0,value:0,showRoundedCorner:this.model.showRoundedCorner});this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._chkImgDimensions=this._imgDialog.find(".e-rte-imgConsrn");this._chkImgDimensions.ejCheckBox({check:!0,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._imgDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._imgPicker=this._imgDialog.find(".e-rte-imgBorderColor").ejColorPicker({cssClass:this.model.cssClass,modelType:"palette",buttonText:{apply:this._getLocalizedLabels("buttonApply"),cancel:this._getLocalizedLabels("buttonCancel"),swatches:this._getLocalizedLabels("swatches")}}).data("ejColorPicker");this._imgDialog.parents("#"+this._rteId+"_Image_wrapper").css({visibility:"visible",display:"none"});this._dialogchkTarget=this._imgDialog.find(".e-rte-imgLinkTarget");this._dialogchkTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._imgDialog.find(".e-rte-btn"),"click",this._imageBtnClick);this._on(this._imgDialog.find(".e-rte-imgUrl , .e-rte-imgLink"),"keypress",this._urlValidation);this._on(this._imgDialog.find("input.e-dimensions"),"change",this._recalcImgSize)},_renderFileBrowserDialog:function(){var r=this,o="",u=this.model.enableRTL?"e-rtlrte":"",f,i,e;this._fileDialog=t.buildTag("div#"+this._rteId+"_fileDialog");f="<div class='e-rte-elements'><div class='e-rte-label "+u+"'><label "+this._labelFor("_file_url")+">"+this._getLocalizedLabels("linkWebUrl")+"<\/label><\/div><div class='e-rte-field "+u+"'><input type='text' data-role ='none' class='e-inputtext e-rte-fileUrl' "+this._TagId("_file_url")+"/><\/div><div class='e-rte-label "+u+"'><label "+this._labelFor("_file_text")+">"+this._getLocalizedLabels("linkText")+"<\/label><\/div><div class='e-rte-field "+u+"'><input type='text' data-role ='none' class='e-inputtext e-rte-fileText' "+this._TagId("_file_text")+"><\/div> <\/div><div class='e-rte-field'><input type='checkbox' class='e-rte-fileTarget' data-role ='none' "+this._TagId("_file_target")+"><label "+this._labelFor("_link_target")+" style='padding: 5px;'>"+this._getLocalizedLabels("linkOpenInNewWindow")+"<\/label><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+u+"' type='button' data-role ='none' id='"+this._rteId+"_file_insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+u+"'type='button' data-role ='none' id='"+this._rteId+"_file_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>";o="<div "+this._TagId("_file_explorer")+" class='e-rte-explorer e-rte-fileBrowser'><\/div>";f=n(o+f);f.appendTo(this._fileDialog);this._fileDialog.appendTo(this._rteWapper);i=this._getDialogModel();i.width="auto";i.title=this._getLocalizedLabels("fileBrowser");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.open=function(){r._fileBrowserObj.adjustSize();t.isNullOrUndefined(r._fileSplitObj)||r._fileSplitObj.option("enableAutoResize",!0)};i.close=function(){r._ieCursorMaintainance();t.isNullOrUndefined(r._fileSplitObj)||r._fileSplitObj.option("enableAutoResize",!1)};this._fileDialog.ejDialog(i);this._fileDialog.closest(".e-dialog-wrap").css({visibility:"hidden",display:"block"}).addClass("e-rte");e={upload:{url:this.model.fileBrowser.uploadAction}};this.model.fileBrowser.ajaxSettings&&n.extend(!0,e,this.model.fileBrowser.ajaxSettings);this._fileBrowserObj=this._fileDialog.find("div.e-rte-fileBrowser").ejFileExplorer({allowMultiSelection:!1,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,cssClass:this.model.cssClass,maxWidth:"690px",height:"300px",isResponsive:!0,minWidth:"330px",path:this.model.fileBrowser.filePath,fileTypes:this.model.fileBrowser.extensionAllow,layout:"list",select:function(n){r._UpdateFileDetails(n)},tools:{creation:["NewFolder","Open"],navigation:["Back","Forward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete"],searchBar:["Searchbar"]},toolsList:["creation","navigation","addressBar","editing","searchBar"],enableResize:!1,showContextMenu:!1,ajaxAction:this.model.fileBrowser.ajaxAction,locale:this.model.locale,ajaxSettings:e}).data("ejFileExplorer");this._fileSplitObj=this._fileDialog.find(".e-splitter").data("ejSplitter");this._fileSplitObj.option("enableAutoResize",!1);this.model.showRoundedCorner&&this._fileDialog.find(".e-inputtext").addClass("e-corner-all");this._fileDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._fileDialog.parents("#"+this._rteId+"_fileDialog_wrapper").css({visibility:"visible",display:"none"});this._chkFileTarget=f.find(".e-rte-fileTarget");this._chkFileTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._fileDialog.find(".e-rte-btn"),"click",this._fileBtnClick)},_UpdateImgDetails:function(t){n(this._imgURL).hasClass("e-error")&&this._imgURL.removeClass("e-error");t.path===""?this._imgURL.val("http://"):this._imgDialog.find("div.e-rte-imageTab").find(".e-rte-imgUrl").val(t.path+(t.name[0]?t.name[0]:""))},_UpdateFileDetails:function(t){n(this._fileURL).hasClass("e-error")&&this._fileURL.removeClass("e-error");t.path===""?this._fileURL.val("http://"):this._fileDialog.find(".e-rte-fileUrl").val(t.path+(t.name[0]?t.name[0]:""))},_fileBtnClick:function(n){n.target.id===this._rteId+"_file_cancel"?(this._clearFileFields(),this._fileDialog.ejDialog("close"),this._ieCursorMaintainance()):n.target.id===this._rteId+"_file_insert"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._restoreSelection(this._selectionRange),this._fileDialog.find("e-rte-fileUrl").val()!=""?this._onInsertFileLink():this._linkDialog.ejDialog("close"),this._trigger("execute",{commandName:"hyperlink"}),this._onChange(),this._setBackupData())},_clearFileFields:function(){this._fileURL=this._fileDialog.find(".e-rte-fileUrl");this._fileURL.val("http://");this._fileLinkText=this._fileDialog.find(".e-rte-fileText");this._fileLinkText.val("");this._chkFileTarget.ejCheckBox({check:!1})},_onGetInsertFileContent:function(n){this._selectedHTML=this._fileLinkText.val()===""?n:this._fileLinkText.val()},_onInsertFileLink:function(){var i,f,o=this._fileURL.val().match(/(ftp:|http:|https:)\/\//g),u=this._fileURL.val().startsWith("~")?this._fileURL.val().replace(this._fileURL.val().substr("0","1"),".."):this._fileURL.val(),r,e;if(t.isNullOrUndefined(o)&&u!==""||!t.isNullOrUndefined(o)&&o[0].length<u.length)r=this._isIE()&&n(this._currentSelNode).parents("body").length>0?this._currentSelNode:this._getSelectedNode(),t.isNullOrUndefined(r)||r.tagName.toUpperCase()!="A"?t.isNullOrUndefined(r)||r.tagName.toUpperCase()!="IMG"?(i=t.buildTag("a","",{},{href:u}),i[0].target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self",this._focus(),this._isIE()?(t.isNullOrUndefined(this._selectedHTML)?this._onGetInsertFileContent(u):this._selectedHTML.length==0&&this._onGetInsertFileContent(u),i[0].innerHTML=this._selectedHTML,f=i[0].outerHTML):(this._fileLinkText.val()===""?i.html(u):i.html(this._fileLinkText.val()),f=n("<div>").append(n(i).clone()).html()),f&&this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length&&(this._isIE()?this._pasteHtml(f):this._getDocument().execCommand("inserthtml",!1,f),this._focus())):(e=n(r).parent("a")[0],t.isNullOrUndefined(e)?(i=t.buildTag("a","",{},{href:u}),n(r.outerHTML).appendTo(n(i)),n(r).replaceWith(n(i)),i[0].target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self"):(e.href=u,e.target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self")):(r.href=u,r.innerHTML=this._fileLinkText.val(),r.target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self"),this._fileDialog.ejDialog("close");else return this._fileURL.addClass("e-error"),!1;this.enableToolbarItem("removeLink");this._updateCount()},_renderVideoDialog:function(){var f=this,r,u,i;this._videoDialog=t.buildTag("div#"+this._rteId+"_video");r=this.model.enableRTL?"e-rtlrte":"";u=n("<div><label>"+this._getLocalizedLabels("embedVideo")+"<\/label><\/div><textarea class='e-rte-video e-inputtext' aria-label="+this._getLocalizedLabels("embedVideo")+"><\/textarea><div class='e-rte-videoDimensions'"+this._TagId("_videodimensions")+" style='margin-top:7px'><div class='e-rte-label'><label>"+this._getLocalizedLabels("dimensions")+" <\/label><\/div><div><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' class='e-inputtext e-dimensions e-rte-videoX' maxlength='3' "+this._TagId("_videoX")+"><label style='padding: 5px;'>X<\/label><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' style='margin-right: 5px;' class='e-inputtext e-dimensions e-rte-videoY' maxlength='3'"+this._TagId("_videoY")+"><input type='checkbox' class='e-rte-videoConsrn' data-role ='none'"+this._TagId("_video_consrn")+"<label "+this._labelFor("_video_consrn")+"style='padding: 5px;'>"+this._getLocalizedLabels("constrainProportions")+"<\/label><\/div><\/div><div class='e-rte-button e-fieldseparate'><button id='video_insert'type='button' data-role ='none' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button id='video_cancel' type='button' data-role ='none' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");u.appendTo(this._videoDialog);this._videoDialog.appendTo(this._rteWapper);this.model.showDimensions||this._rteWapper.find(".e-rte-videoDimensions").hide();i=this._getDialogModel();i.width="auto";i.closeIconTooltip=this._getLocalizedLabels("closeIcon");i.title=this._getLocalizedLabels("video");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.close=function(){f._ieCursorMaintainance()};this._videoDialog.ejDialog(i);this._videoDialog.closest(".e-dialog-wrap").addClass("e-rte");this.model.showRoundedCorner&&this._videoDialog.find(".e-inputtext").addClass("e-corner-all");this._chkvideoDimensions=this._videoDialog.find(".e-rte-videoConsrn");this._chkvideoDimensions.ejCheckBox({checked:!0,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._videoDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._videoDialog.find(".e-rte-btn"),"click",this._insertVideo);this._on(this._videoDialog.find("input.e-dimensions"),"change",this._recalcVideoSize)},_renderTableDialog:function(){var r=this,i,n;this._createTable=t.buildTag("div.e-rte-table-picker#"+this._rteId+"_table");this._tblheaderDiv=t.buildTag("div.e-rte-tableheader");this._tblheaderDiv.html(this._getLocalizedLabels("createTable"));this._tblheaderDiv.appendTo(this._createTable);i=t.buildTag("div.e-rte-table");this._drawTable(i);i.appendTo(this._createTable);this._createCustomTable();this._createTable.appendTo(this._rteWapper);n=this._getDialogModel();n.enableModal=!1;n.showHeader=!1;n.width="auto";n.minWidth="270px";n.maxWidth="270px";n.showRoundedCorner=this.model.showRoundedCorner;n.close=function(n){n.event&&n.event.clickAction&&r._ieCursorMaintainance()};this._createTable.ejDialog(n)},_createCustomTable:function(){var u=n("<div class='customtable-group e-rte-createCustomTableLink' "+this._TagId("_createCustomTableLink")+"><span class='e-rte-toolbar-icon "+this._rteIconsList.customTableImage+"'><\/span><a class='customtable-link' role='button' title='"+this._getLocalizedLabels("customTable")+"'>"+this._getLocalizedLabels("customTable")+"<\/a><\/div><div class='customtable-group e-rte-eTblProperties' "+this._TagId("_eTblProperties")+"><span class='e-rte-toolbar-icon "+this._rteIconsList.customTableImage+"'><\/span><a class='customtable-link' role='button' title='"+this._getLocalizedLabels("editTable")+"'>"+this._getLocalizedLabels("editTable")+"<\/a><\/div>"),r,f,i;this._on(u,"click",this._openCustomTable);u.appendTo(this._createTable);this.model.showCustomTable||this._createTable.find("#"+this._rteId+"_createCustomTableLink").hide();r=this.model.enableRTL?"e-rtlrte":"";this._customTableDialog=t.buildTag("div.e-rte-customtable#"+this._rteId+"_customTable");f=n("<div class='e-fieldgroup'><div class='e-rte-tablefields'><label "+this._labelFor("_txtColumns")+">"+this._getLocalizedLabels("tableColumns")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='numerictextbox e-rte-txtColumns' "+this._TagId("_txtColumns")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtRows")+">"+this._getLocalizedLabels("tableRows")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='numerictextbox e-rte-txtRows' "+this._TagId("_txtRows")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtWidth")+">"+this._getLocalizedLabels("tableWidth")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtWidth'"+this._TagId("_txtWidth")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtHeight")+">"+this._getLocalizedLabels("tableHeight")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtHeight'"+this._TagId("_txtHeight")+"><\/div><\/div><div class='e-fieldseparate'><div class='e-rte-tablefields'><label "+this._labelFor("_txtSpacing")+">"+this._getLocalizedLabels("tableCellSpacing")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtSpacing' "+this._TagId("_txtSpacing")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtPadding")+">"+this._getLocalizedLabels("tableCellPadding")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtPadding'"+this._TagId("_txtPadding")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtBorder")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-tablefields'><select class='e-rte-txtBorder' data-role ='none' "+this._TagId("_txtBorder")+"><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_chkCaption")+">"+this._getLocalizedLabels("tableCaption")+"<\/label><\/div><div class='e-rte-tablefields'><input type='checkbox' class='e-rte-chkCaption' data-role ='none'"+this._TagId("_chkCaption")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_ddlAlignment")+">"+this._getLocalizedLabels("tableAlignment")+"<\/label><\/div><div class='e-rte-tablefields'><select class='e-rte-ddlAlignment' data-role ='none' "+this._TagId("_ddlAlignment")+"><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+r+"' data-role ='none' id='insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+r+"' data-role ='none' id='cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");f.appendTo(this._customTableDialog);i=this._getDialogModel();i.width="auto";i.maxWidth="480px";i.title=this._getLocalizedLabels("customTable");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.closeIconTooltip=this._getLocalizedLabels("closeIcon");this._customTableDialog.ejDialog(i);this._customTableDialog.closest(".e-dialog-wrap").addClass("e-rte");this.model.showRoundedCorner&&this._customTableDialog.find(".e-inputtext").addClass("e-corner-all");this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable");this._customTableDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".numerictextbox").ejNumericTextbox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",minValue:1,value:3,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox({maxValue:63,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!1,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._chkTblCaption=this._customTableDialog.find(".e-rte-chkCaption");this._chkTblCaption.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._customTableDialog.find(".e-rte-btn"),"click",this._insertCustomTable)},_renderEditTableDialog:function(){var f=this,i;this._eTblDialog=t.buildTag("div.e-rte-edittable#"+this._rteId+"_eTbl");var r=this._rteId,u=this.model.enableRTL?"e-rtlrte":"",e=n("<div id='"+this._rteId+"_eTbl_Tab'><ul><li class='e-first'><a href='#"+this._rteId+"_eTblTable'>"+this._getLocalizedLabels("table")+" <\/a><\/li><li class='e-nofirst'><a href='#"+this._rteId+"_eTblRow'>"+this._getLocalizedLabels("row")+" <\/a><\/li><li class='e-nofirst'><a href='#"+this._rteId+"_eTblCell'>"+this._getLocalizedLabels("cell")+" <\/a><\/li><\/ul><div id='"+this._rteId+"_eTblTable'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblWidth")+">"+this._getLocalizedLabels("tableWidth")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblWidth")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblHeight")+">"+this._getLocalizedLabels("tableHeight")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblHeight")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblCellSpace")+">"+this._getLocalizedLabels("tableCellSpacing")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-numerictextbox' "+this._TagId("_eTblCellSpace")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblCellPad")+">"+this._getLocalizedLabels("tableCellPadding")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-numerictextbox' "+this._TagId("_eTblCellPad")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblAlign")+">"+this._getLocalizedLabels("tableAlignment")+"<\/label><\/div><div class='e-rte-tablefields'><select id='"+r+"_eTblAlign' data-role ='none' class='e-rte-dropdown'><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblCaption")+">"+this._getLocalizedLabels("tableCaption")+"<\/label><\/div><div class='e-rte-tablefields'><input type='checkbox' data-role ='none' "+this._TagId("_eTblCaption")+"><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblBrdrPx")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-stylefield'><div class='e-img-border-field'><input data-role ='none' type='text' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext e-numerictextbox' maxlength='3' "+this._TagId("_eTblBrdrPx")+"><\/div><div class='e-img-border-field'><select "+this._TagId("_eTbl_border_style")+" class='e-rte-dropdown' data-role ='none' ><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext' "+this._TagId("_eTbl_border_color")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblStyle")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-stylefield'><input data-role ='none' type='text' class='e-inputtext' "+this._TagId("_eTblStyle")+"><\/div><\/div><\/div><div id='"+r+"_eTblRow'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRHeight")+">"+this._getLocalizedLabels("tableHeight")+"<\/label><\/div><div class='e-rte-tablefields'><input data-role ='none' type='text' class='e-inputtext' "+this._TagId("_eTblRHeight")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRAlign")+">"+this._getLocalizedLabels("textAlign")+"<\/label><\/div><div class='e-rte-tablefields'><select "+this._TagId("_eTblRAlign")+" data-role ='none' class='e-rte-dropdown'><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRBrdrPx")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-stylefield'><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext e-numerictextbox' maxlength='3' "+this._TagId("_eTblRBrdrPx")+"><\/div><div class='e-img-border-field'><select "+this._TagId("_eTblRBrdrStyle")+" data-role ='none' class='e-rte-dropdown'><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext' "+this._TagId("_eTblRBrdrColor")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRStyle")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-stylefield'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblRStyle")+"><\/div><\/div><\/div><div id='"+r+"_eTblCell'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClWidth")+">"+this._getLocalizedLabels("tableWidth")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblClWidth")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClAlign")+">"+this._getLocalizedLabels("textAlign")+"<\/label><\/div><div class='e-rte-tablefields'><select "+this._TagId("_eTblClAlign")+" data-role ='none' class='e-rte-dropdown'><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClBrdrPx")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-stylefield'><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext e-numerictextbox' maxlength='3' "+this._TagId("_eTblClBrdrPx")+" ><\/div><div class='e-img-border-field'><select "+this._TagId("_eTblClBrdrStyle")+" data-role ='none' class='e-rte-dropdown'><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext' "+this._TagId("_eTblClBrdrColor")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClStyle")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-stylefield'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblClStyle")+"><\/div><\/div><\/div><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+u+"' data-role ='none' id='"+r+"_eTbl_apply'>"+this._getLocalizedLabels("dialogApply")+"<\/button><button class='e-rte-btn "+u+"' data-role ='none' id='"+r+"_eTbl_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");e.appendTo(this._eTblDialog);this._tblborderPicker=this._eTblDialog.find("#"+this._rteId+"_eTbl_border_color").ejColorPicker({cssClass:this.model.cssClass,modelType:"palette",buttonText:{apply:this._getLocalizedLabels("buttonApply"),cancel:this._getLocalizedLabels("buttonCancel"),swatches:this._getLocalizedLabels("swatches")}}).data("ejColorPicker");this._eTblDialog.appendTo(this._rteWapper);i=this._getDialogModel();i.width="auto";i.title=this._getLocalizedLabels("editTable");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.closeIconTooltip=this._getLocalizedLabels("closeIcon");i.close=function(){f._ieCursorMaintainance()};this._eTblDialog.ejDialog(i);this._eTblDialog.closest(".e-dialog-wrap").addClass("e-rte e-edittable");this.model.showRoundedCorner&&this._eTblDialog.find(".e-inputtext").addClass("e-corner-all");this._eTblDialog.find(".e-numerictextbox").ejNumericTextbox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",minValue:0,value:0,showRoundedCorner:this.model.showRoundedCorner});this._eTblDialog.find(".e-rte-dropdown").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",showRoundedCorner:this.model.showRoundedCorner});this._eTblAlign=this._getTableObj("Align").data("ejDropDownList");this._eTblAlign.option("enabled",!1);this._getTableObj("_Tab").ejTab({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._eTblCaption=this._getTableObj("Caption");this._eTblCaption.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._eTblDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._eTblDialog.find(".e-rte-btn"),"click",this._eTblBtnClick)},_drawTable:function(n){for(var r,i=0;i<this.model.tableRows;i++){for(rowDiv=t.buildTag("div.e-rtetablerow"),r=0;r<this.model.tableColumns;r++)tableCell=t.buildTag("div.e-rte-tablecell e-default"),tableCell.appendTo(rowDiv);rowDiv.appendTo(n)}},_renderSourceDialog:function(){var f=this,r,u,i;this._sourceDialog=t.buildTag("div.e-rte-source#"+this._rteId+"_Source");r=this.model.enableRTL?"e-rtlrte":"";u=n("<textarea class='e-rte-srctextarea e-inputtext'><\/textarea><div class='e-rte-button e-fieldseparate'><button id='src_update' data-role ='none' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogUpdate")+"<\/button><button id='src_cancel' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");u.appendTo(this._sourceDialog);i=this._getDialogModel();i.title=this._getLocalizedLabels("viewHtml");i.width="auto";i.minWidth="330px";i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.close=function(){f._ieCursorMaintainance()};i.closeIconTooltip=this._getLocalizedLabels("closeIcon");this._sourceDialog.ejDialog(i);this._sourceDialog.closest(".e-dialog-wrap").addClass("e-rte e-sourcedialog");this.model.showRoundedCorner&&this._sourceDialog.find(".e-inputtext").addClass("e-corner-all");this._sourceDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._sourceDialog.find(".e-rte-btn"),"click",this._srcBtnClick)},_renderAlertDialog:function(){var u=this,r,i;this._alertWindow=t.buildTag("div#"+this._rteId+"_Alert");r=n("<p class='e-alerttext' style='margin:0.875em 0em;'><\/p><div class='e-rte-button e-fieldseparate'><button data-role ='none' class='e-rte-btn e-alert-ok' type='button'>"+this._getLocalizedLabels("dialogOk")+"<\/button><button class='e-rte-btn e-alert-cancel' data-role='none'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");r.appendTo(this._alertWindow);i=this._getDialogModel();i.showHeader=!1;i.width="auto";i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.close=function(){u._ieCursorMaintainance()};i.minHeight="50px";this._alertWindow.ejDialog(i);this._alertWindow.closest(".e-dialog-wrap").addClass("e-rte");this._alertWindow.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._alertWindow.find(".e-rte-btn"),"click",this._alertBtnClick);this._alertWindow.find(".e-alert-cancel").hide()},_alertBtnClick:function(t){if(n.trim(this._alertWindow.find(".e-alerttext").html())==this._getLocalizedLabels("deleteAlert")&&n(t.target).hasClass("e-alert-ok")){this._getDocument().body.innerHTML=" ";this._emptyContent();this.model.showToolbar&&this._toolBarObj.selectItemByID(this._rteId+"_justifyLeft");this._setBackupData();this._updateCount();var i=this._isIE()?this._currentSelNode:this._getSelectedNode();this._updateTagInfo(i);this._onChange()}this._alertWindow.ejDialog("close");this._alertWindow.find(".e-alert-cancel").hide()},_emptyContent:function(){var r,n=document.createElement("span"),t,i;n.innerHTML="";t=this._getDocument().createRange();i=this._getDocument().getSelection();this._getDocument().body.firstChild&&this._getDocument().body.firstChild.remove();this._getDocument().body.appendChild(r=this._getDocument().createElement("p"));r.appendChild(n);i.removeAllRanges();t.setStart(n.firstChild,0);t.setEnd(n.firstChild,0);i.addRange(t)},_openAlert:function(t){this._alertWindow.find(".e-alerttext").html(t);this._alertWindow.ejDialog("instance")._centerPosition();n("#"+this._rteId+"_Alert_wrapper").css({"z-index":this._onGetMaxZindex()});this._alertWindow.ejDialog("open")},_renderFormat:function(){this._formatDDL=t.buildTag("input#"+this._rteId+"_formatDDL","","",{type:"text",title:this._getLocalizedLabels("format"),"data-role":"none"});var n={};n.dataSource=this._formatText(this.model.format,[{text:"paragraph",value:"<p>"},{text:"quotation",value:"<blockquote>"},{text:"heading1",value:"<h1>"},{text:"heading2",value:"<h2>"},{text:"heading3",value:"<h3>"},{text:"heading4",value:"<h4>"},{text:"heading5",value:"<h5>"},{text:"heading6",value:"<h6>"}]);n.width="105px";n.enableRTL=this.model.enableRTL;n.popupWidth="175px";n.popupHeight="auto";n.selectedItemIndex=0;n.select=this._formatChange;n.cssClass="e-rte-format-ddl";n.showRoundedCorner=this.model.showRoundedCorner;n.fields={text:"text",value:"value",spriteCssClass:"spriteCssClass"};this._formatDDL.appendTo(this._rteToolbar.find("li.e-rteItem-format").html(""));this._formatDDL.ejDropDownList(n);this._formatPopupStyle()},_formatText:function(n,t){for(var r,i=0;i<n.length;i++)for(r=0;r<t.length;r++)if(n[i].value==t[r].value){n[i].text=this._getLocalizedLabels(t[r].text)?this._getLocalizedLabels(t[r].text):n[i].text;break}return n},_formatPopupStyle:function(){for(var i=this._formatDDL.data("ejDropDownList").popupPanelWrapper.find("li"),t=0;t<i.length;t++)n(i[t]).addClass(this.model.format[t].spriteCssClass)},_renderFontStyle:function(){this._fontStyleDDL=t.buildTag("input#"+this._rteId+"_fontNameDDL","","",{type:"text",title:this._getLocalizedLabels("fontName"),"data-role":"none"});var n={};n.dataSource=this._formatText(this.model.fontName,[{text:"timesnewroman",value:"Times New Roman,Times,serif"},{text:"segoeui",value:"Segoe UI"},{text:"arial",value:"Arial,Helvetica,sans-serif"},{text:"couriernew",value:"Courier New,Courier,monospace"},{text:"georgia",value:"Georgia,serif"},{text:"impact",value:"Impact,Charcoal,sans-serif"},{text:"lucidaconsole",value:"Lucida Console,Monaco,monospace"},{text:"tahoma",value:"Tahoma,Geneva,sans-serif"},{text:"trebuchetms",value:"Trebuchet MS,Helvetica,sans-serif"},{text:"verdana",value:"Verdana,Geneva,sans-serif"}]);n.enableRTL=this.model.enableRTL;n.selectedItemIndex=0;n.htmlAttributes={datafontid:""+this._rteId};n.select=this._fontStyleChange;n.showRoundedCorner=this.model.showRoundedCorner;n.fields={text:"text",value:"value"};this._fontStyleDDL.appendTo(this._rteToolbar.find("li.e-rteItem-fontName").html(""));this._fontStyleDDL.ejDropDownList(n)},_renderFontSize:function(){this._fontSizeDDL=t.buildTag("input#"+this._rteId+"_fontSizeDDL","","",{type:"text",title:this._getLocalizedLabels("fontSize"),"data-role":"none"});var n={};n.dataSource=this.model.fontSize;n.width="100px";n.enableRTL=this.model.enableRTL;n.selectedItemIndex=2;n.htmlAttributes={datafontid:""+this._rteId};n.select=this._fontSizeChange;n.showRoundedCorner=this.model.showRoundedCorner;n.fields={text:"text",value:"value"};this._fontSizeDDL.appendTo(this._rteToolbar.find("li.e-rteItem-fontSize").html(""));this._fontSizeDDL.ejDropDownList(n)},_renderFontColor:function(){var e=this,u,i,r,f;this._fontColorSplit=t.buildTag("button#"+this._rteId+"_fontColorbtn","",{},{type:"button","data-role":"none"});u=n("<ul id='"+this._rteId+"_colorTable' class='e-rte-colorpalette'><li><\/li><\/ul>");u.find("li").append(this._colorTable());i={};i.width="42px";i.contentType="textandimage";i.targetID=this._rteId+"_colorTable";i.enableRTL=this.model.enableRTL;i.prefixIcon=this._rteIconsList.fontColor;i.showRoundedCorner=this.model.showRoundedCorner;this._fontColorSplit.appendTo(this._rteToolbar.find("li.e-rteItem-fontColor").html(""));r=n("#"+this._rteId+"_colorTable").get(0);r&&(n(r).parent().hasClass("e-menu-wrap")?n(r).parent().remove():n(r).remove());f=n("<div class='customcolor e-rte-customcolor' "+this._TagId("_customcolor")+"><a class='customcolor-link' role='button' title='"+this._getLocalizedLabels("customColor")+"'>"+this._getLocalizedLabels("customFontColor")+"<\/a><\/div>");u.append(f);u.appendTo(this._rteToolbar.find("li.e-rteItem-fontColor"));this._on(f,"click",this._openColorpalette);this._fontColorSplit.ejSplitButton(i);this._splitObj=this._fontColorSplit.ejSplitButton("instance");this._splitObj.option("beforeOpen",function(){e._bindClickOperation("FontColor")});this._on(this._fontColorSplit,"click",this._fontColorClick);this._fontColorSplit.find("span."+this._rteIconsList.fontColor).removeClass("e-icon");this._fontColorSplit.find("span.e-btntxt").css("background-color",this._fontColor)},_renderUnOrderList:function(){var u=this,i,r;this._unOrderSplit=t.buildTag("button#"+this._rteId+"_unorder","",{},{type:"button","data-role":"none"});this._unorderLiTemplate=t.buildTag("ul#"+this._rteId+"_unorderlist","",{height:"auto",width:"84px"},{"class":"e-rte-unorderlistname"});n("<li id='none' title='"+this._getLocalizedLabels("none")+"' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-nonelist-icon'><\/span><\/li><li id='disc' title='"+this._getLocalizedLabels("disc")+"' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-disclist-icon'><\/span><\/li><li id='square' title='"+this._getLocalizedLabels("square")+"' class='square' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-squarelist-icon'><\/span><\/li><li id='circle' title='"+this._getLocalizedLabels("circle")+"' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-circlelist-icon'><\/span><\/li>").appendTo(this._unorderLiTemplate);t.isNullOrUndefined(u.model.tools.customUnorderedList)||n.each(u.model.tools.customUnorderedList,function(t,i){t==0&&n(u._unorderLiTemplate).find("#circle,#square").attr("class","e-liseparator");n("<li id='"+(i.name?i.name:"ulcustom"+t)+"' class='"+(i.css?i.css:"")+"' title='"+(i.tooltip?i.tooltip:"")+"' style='float:left;width:100%;'>"+(i.text?i.text:"")+"<\/li>").appendTo(u._unorderLiTemplate)});i={};i.width="42px";i.contentType="imageonly";i.targetID=this._rteId+"_unorderlist";i.enableRTL=this.model.enableRTL;i.prefixIcon="e-icon e-rte-toolbar-icon "+this._rteIconsList.unorderedList;i.showRoundedCorner=this.model.showRoundedCorner;i.itemSelected=n.proxy(this._onUnorderList,this);this._unOrderSplit.appendTo(this._rteToolbar.find("li.e-rteItem-unorderedList").html(""));r=n("#"+this._rteId+"_unorderlist").get(0);r&&(n(r).parent().hasClass("e-menu-wrap")?n(r).parent().remove():n(r).remove());this._unorderLiTemplate.appendTo(this._rteToolbar.parents("body").length>0?this._rteToolbar.find("li.e-rteItem-unorderedList"):n("body"));this._unOrderSplit.ejSplitButton(i);this._unOrderSplitObj=this._unOrderSplit.ejSplitButton("instance");this._unOrderSplit.find("span.e-unorderedList-icon").removeClass("e-icon");this._on(this._unOrderSplit,"click",this._onUnorderList)},_renderOrderList:function(){var u=this,i,r;this._orderSplit=t.buildTag("button#"+this._rteId+"_order","",{},{type:"button","data-role":"none"});this._orderLiTemplate=t.buildTag("ul#"+this._rteId+"_orderlist","",{height:"auto",width:"124.05px"},{"class":"e-rte-orderlistname"});n("<li id='none' title='"+this._getLocalizedLabels("none")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-nonelist-icon'><\/span><\/li><li id='decimal' title='"+this._getLocalizedLabels("number")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-numbering-icon'><\/span><\/li><li id='lower-alpha' title='"+this._getLocalizedLabels("loweralpha")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-loweralpha-icon'><\/span><\/li><li id='lower-roman' title='"+this._getLocalizedLabels("lowerroman")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-lowerroman-icon'><\/span><\/li><li id='upper-alpha' title='"+this._getLocalizedLabels("upperalpha")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-upperalpha-icon'><\/span><\/li><li id='upper-roman' title='"+this._getLocalizedLabels("upperroman")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-upperroman-icon'><\/span><\/li>").appendTo(this._orderLiTemplate);t.isNullOrUndefined(u.model.tools.customOrderedList)||n.each(u.model.tools.customOrderedList,function(t,i){t==0&&n(u._orderLiTemplate).find("#upper-roman,#upper-alpha,#lower-roman").attr("class","e-liseparator");n("<li id='"+(i.name?i.name:"olcustom"+t)+"' class='"+(i.css?i.css:"")+"' title='"+(i.tooltip?i.tooltip:"")+"' style='float:left;width:100%;'>"+(i.text?i.text:"")+"<\/li>").appendTo(u._orderLiTemplate)});i={};i.width="42px";i.contentType="imageonly";i.enableRTL=this.model.enableRTL;i.showRoundedCorner=this.model.showRoundedCorner;i.targetID=this._rteId+"_orderlist";i.prefixIcon="e-icon e-rte-toolbar-icon "+this._rteIconsList.orderedList;i.itemSelected=n.proxy(this._onOrderList,this);this._orderSplit.appendTo(this._rteToolbar.find("li.e-rteItem-orderedList").html(""));r=n("#"+this._rteId+"_orderlist").get(0);r&&(n(r).parent().hasClass("e-menu-wrap")?n(r).parent().remove():n(r).remove());this._orderLiTemplate.appendTo(this._rteToolbar.parents("body").length>0?this._rteToolbar.find("li.e-rteItem-orderedList"):n("body"));this._orderSplit.ejSplitButton(i);this._orderSplitObj=this._orderSplit.ejSplitButton("instance");this._on(this._orderSplit,"click",this._onOrderList)},_renderBGColor:function(){var o=this,r,u,i,e,f;this._bgColorSplit=t.buildTag("button#"+this._rteId+"_backgroundColorbtn","",{},{type:"button","data-role":"none"});r=n("<ul id='"+this._rteId+"_colorBGTable' class='e-rte-colorpalette'><li><\/li><\/ul>");r.find("li").append(this._colorTable());u=n("<button id='"+this._rteId+"_backgroundtransparentbtn'class='e-rte-transbtn' role='button' title='"+this._getLocalizedLabels("TransBGColor")+"'>"+this._getLocalizedLabels("TransBGColor")+"<\/button>");i={};i.width="42px";i.contentType="textandimage";i.targetID=this._rteId+"_colorBGTable";i.enableRTL=this.model.enableRTL;i.prefixIcon=this._rteIconsList.backgroundColor;i.showRoundedCorner=this.model.showRoundedCorner;e=n("<div class='customBGcolor e-rte-customcolor' "+this._TagId("_customBGcolor")+"><a class='customcolor-link ' role='button' title='"+this._getLocalizedLabels("customBGColor")+"'>"+this._getLocalizedLabels("customBGColor")+"<\/a><\/div>");r.append(e);this._on(e,"click",this._openColorpalette);u.prependTo(r);this._bgColorSplit.appendTo(this._rteToolbar.find("li.e-rteItem-backgroundColor").html(""));f=n("#"+this._rteId+"_colorBGTable").get(0);f&&(n(f).parent().hasClass("e-menu-wrap")?n(f).parent().remove():n(f).remove());r.appendTo(this._rteToolbar.find("li.e-rteItem-backgroundColor"));this._bgColorSplit.ejSplitButton(i);u.ejButton({width:"100%",contentType:"text",targetID:this._rteId+"_colorBGTable",showRoundercorner:this.model.showRounderCorner});this._bgObj=u.ejButton("instance");this._on(u,"click",this._bgTransClick);this._bgSplitObj=this._bgColorSplit.ejSplitButton("instance");this._bgSplitObj.option("beforeOpen",function(){o._bindClickOperation("BGColor")});this._on(this._bgColorSplit,"click",this._bgColorClick);this._bgColorSplit.find("span."+this._rteIconsList.backgroundColor).removeClass("e-icon");this._bgColorSplit.find("span.e-btntxt").css("background-color",this._bgColor)},_bindClickOperation:function(t){var i=this,u=t=="BGColor"?i._bgSplitObj:i._splitObj,f=t=="BGColor"?"_backgroundColorbtn":"_fontColorbtn",r=t=="BGColor"?"_colorBGTable":"_colorTable";SplitMenu=n("#"+i._rteId+f).ejSplitButton("instance");t=="BGColor"?i._bgSplitMenu=SplitMenu:i._splitMenu=SplitMenu;SplitMenu.model.close=function(){u.contstatus=!1;i._off(n("#"+i._rteId+r).find("div.e-rte-palettetable"),"click",t=="BGColor"?i._bgColorPaletteClick:i._colorPaletteClick)};i._on(n("#"+i._rteId+r).find("div.e-rte-palettetable"),"click",t=="BGColor"?i._bgColorPaletteClick:i._colorPaletteClick)},_colorTable:function(){for(var u,f=t.buildTag("div.e-rte-table"),i=0,n,r,e=0;e<this.model.colorPaletteRows;e++){for(r=t.buildTag("div.e-rtetablerow"),u=0;u<this.model.colorPaletteColumns;u++)i<this.model.colorCode.length&&(n="#"+this.model.colorCode[i],tableCell=t.buildTag("div.e-rte-palettetable","",{"background-color":n},{title:n,"color-code":n}),tableCell.appendTo(r),i++);r.appendTo(f)}return f},_recalcVideoSize:function(n){var r,u,t,i;r=this._videoDialog.find(".e-rte-videoX");u=this._videoDialog.find(".e-rte-videoY");t=r.val();i=u.val();!this._chkvideoDimensions.ejCheckBox("isChecked")||!this._videoWidth||!this._videoHeight||!t||!i||(n.target.id==r[0].id?(i=Math.round(t/this._videoWidth*i),u.val(i)):(t=Math.round(i/this._videoHeight*t),r.val(t)));this._videoWidth=t;this._videoHeight=i},_recalcImgSize:function(n){var r,u,t,i;r=this._imgDialog.find(".e-rte-imgX");u=this._imgDialog.find(".e-rte-imgY");t=r.val();i=u.val();!this._chkImgDimensions.ejCheckBox("isChecked")||!this._imgWidth||!this._imgHeight||!t||!i||(n.target.id==r[0].id?(i=Math.round(t/this._imgWidth*i),u.val(i)):(t=Math.round(i/this._imgHeight*t),r.val(t)));this._imgWidth=t;this._imgHeight=i},_urlValidation:function(t){var i=n(t.target);i.hasClass("e-error")&&i.removeClass("e-error")},_ieLinkRange:function(){var n=this._getRange();this._isIE()||this._isIE8()?(t.isNullOrUndefined(this._currentSelNode)||this._currentSelNode.nodeName.toLowerCase()=="html"||n.setStart(this._currentSelNode,this._currentSelNode.childNodes.length),this._selectionRange=n):(t.isNullOrUndefined(this._currentSelNode)||this._currentSelNode.nodeName.toLowerCase()!="html",this._selectionRange=n)},_ieCursorMaintainance:function(){this._isIE8()?this._setRange(this._currentSelNode,this._getDocument().body.createTextRange(),!0):(this._ieLinkRange(),this._focus())},_linkBtnClick:function(n){n.target.id==="link_cancel"?(this._clearLinkFields(),this._linkDialog.ejDialog("close"),this._ieCursorMaintainance()):n.target.id==="link_insert"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._restoreSelection(this._selectionRange),this._txtURL.val()!=""?this._onInsertLink():(this._onUnlink(),this._linkDialog.ejDialog("close")),this._trigger("execute",{commandName:"hyperlink"}),this._onChange(),this._setBackupData())},_imageBtnClick:function(i){if(i.target.id===this._rteId+"_img_cancel")this._imgDialog.ejDialog("close"),this._ieCursorMaintainance();else if(i.target.id===this._rteId+"_img_insert"){var r=this._imgURL.val().match(/(ftp:|http:|https:)\/\//g);if(t.isNullOrUndefined(r)&&this._imgURL.val()!==""||!t.isNullOrUndefined(r)&&r[0].length<this._imgURL.val().length)this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length?this._onInsertImage():this._imgDialog.ejDialog("close"),this._onChange(),this._setBackupData();else return this._imgURL.addClass("e-error"),this._isUrl(n.trim(this._imageLink.val()))||this._imageLink.addClass("e-error"),!1}},_srcBtnClick:function(i){var r,u,f;if(i.target.id==="src_update"){r=n.trim(this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value);this.model.enableHtmlEncode&&(r=this._decode(r));try{this._getDocument().documentElement.innerHTML=r.replace("<html>","").replace("<\/html>","");this.model.enableXHTML&&(this._getDocument().documentElement.innerHTML=this._updateXhtml())}catch(e){u=/<body[^>]*>((.|[\n\r])*)<\/body>/i;t.isNullOrUndefined(u.exec(r))||(r=u.exec(r)[1],this._getDocument().body.innerHTML=r)}this._onChange();this._updateCount()}this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value="";f=n(this._getDocument()).find("table.e-rte-table");this.model.enableRTL||this._on(f,"mouseover",this._tableMouseOver);this._sourceDialog.ejDialog("close");this._showHideContextMenu()},_eTblBtnClick:function(n){n.target.id===this._rteId+"_eTbl_cancel"?(this._eTblDialog.ejDialog("close"),this._ieCursorMaintainance()):n.target.id===this._rteId+"_eTbl_apply"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._oneditTable(),this._onChange(),this._setBackupData())},_insertCustomTable:function(i){var f,r,u;if(this._customTableValidation=!1,i.target.id==="insert"){var e=this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("getValue"),o=this._customTableDialog.find(".e-rte-txtRows").ejNumericTextbox("getValue"),s=this._customInputValidation(this._customTableDialog.find(".e-rte-txtHeight")),h=this._customInputValidation(this._customTableDialog.find(".e-rte-txtWidth")),c=this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("getSelectedValue"),l=this._customInputValidation(this._customTableDialog.find(".e-rte-txtSpacing")),a=this._customInputValidation(this._customTableDialog.find(".e-rte-txtPadding")),v=this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("getSelectedValue"),y=this._chkTblCaption.ejCheckBox("isChecked");this._customTableValidation||(t.isNullOrUndefined(this._tableInsertAt)||t.isNullOrUndefined(this._tableInsertAt.startContainer)||this._restoreSelection(this._tableInsertAt),f=this._tableGenerator(o,e,!1,h,s,l,a,c,v,y),this.executeCommand("inserthtml",f),r=n(this._getDocument()).find("table.e-rte-table"),u=this._customTableDialog.find(".e-rte-ddlAlignment").data("ejDropDownList"),u.option("value")=="Center"&&r.attr("style","margin: 0 auto"),this.model.enableRTL||this._on(r,"mouseover",this._tableMouseOver),this._onChange(),u.option({value:"",enabled:!1}));this._on(this._customTableDialog.find(".e-rte-txtHeight"),"keypress",this._urlValidation)._on(this._customTableDialog.find(".e-rte-txtWidth"),"keypress",this._urlValidation)._on(this._customTableDialog.find(".e-rte-txtSpacing"),"keypress",this._urlValidation)._on(this._customTableDialog.find(".e-rte-txtPadding"),"keypress",this._urlValidation)}this._customTableValidation||(this._customTableDialog.ejDialog("close"),this._clearTableFields(),this._ieCursorMaintainance())},_customInputValidation:function(n){var t=n.val().toLowerCase(),i=t.substr(t.length-2,2),r=t.match(/[!@#$%^&*()_+\-=\[\]{};':"\\|,<>\/?]/gi),u=t.match(/[a-z]/gi);return!isNaN(t)&&(r==null||r.length==0)||t.length>1&&t.substr(t.length-1,1)=="%"&&r.length==1&&(u==null||u.length==0)||t.length>2&&(r==null||r.length==0)&&u!=null&&u.length==2&&(i=="px"||i=="in"||i=="cm"||i=="mm"||i=="em"||i=="ex"||i=="pt"||i=="pc")?t:(n.addClass("e-error"),this._customTableValidation=!0,0)},_clearTableFields:function(){this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("option","value",3);this._customTableDialog.find(".e-rte-txtRows").ejNumericTextbox("option","value",3);this._customTableDialog.find(".e-rte-txtHeight").val("");this._customTableDialog.find(".e-rte-txtWidth").val("");this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("clearText");this._customTableDialog.find(".e-rte-txtSpacing").val("");this._customTableDialog.find(".e-rte-txtPadding").val("");var n=this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("clearText"),t=this._chkTblCaption.ejCheckBox({check:!1})},_clearEditTableFields:function(){this._eTblHeight=this._eTblDialog.find("input").val("");this._eTblDialog.find(".e-numerictextbox").data("ejNumericTextbox").option("value","");this._eTblDialog.find(".e-rte-dropdown").data("ejDropDownList").option("value","");this._eTblAlign.disable();this._eTblCaption.ejCheckBox({check:!1})},_clearLinkFields:function(){this._txtURL=this._linkDialog.find(".e-rte-linkUrl");this._txtURL.removeClass("e-error");this._txtURL.val("http://");this._txtLinkText=this._linkDialog.find(".e-rte-linkText");this._txtLinkText.val("");this._txtLinkTitle=this._linkDialog.find(".e-rte-linkTitle");this._txtLinkTitle.val("");this._chkTarget.ejCheckBox({check:!1});this._txtURL.focus()},_textFieldFocus:function(n,t,i){if(this._isIE8()){var r=n.createTextRange();r.collapse(!0);r.moveEnd("character",t);r.moveStart("character",i);r.select()}else n.setSelectionRange(t,i)},_clearImgFields:function(){this._imgURL=this._imgDialog.find(".e-rte-imgUrl").val("http://").removeClass("e-error");this._imgDialog.find(".e-rte-imgText").val("");this._chkImgDimensions.ejCheckBox({checked:!0});this._imageLink=this._imgDialog.find(".e-rte-imgLink");this._imageLink.removeClass("e-error");this._imageLink.val("");this._imageBorderPx=this._imgDialog.find(".e-rte-imgBorderPx").data("ejNumericTextbox");this._imageBorderPx.option("value",0);this._imageBorderStyle=this._imgDialog.find(".e-rte-imgBorderStyle").data("ejDropDownList");this._imageBorderStyle.option("value","");this._imgPicker.option("value",null);this._imgDialog.find(".e-selected-color").removeAttr("style");this._imageStyle=this._imgDialog.find(".e-rte-imgStyle");this._imageStyle.val("");this._dialogchkTarget.ejCheckBox({check:!1})},_videoManager:function(){var i=this._getSelectedNode();this._editVideo=null;this._getPasteRangeVal();i&&!t.isNullOrUndefined(i.tagName)&&(this._editVideo=i,this._videoWidth=parseInt(n(i).width()),this._videoHeight=parseInt(n(i).width()),this.model.showDimensions&&(this._videoDialog.find(".e-rte-videoX").val(this._videoWidth),this._videoDialog.find(".e-rte-videoY").val(this._videoHeight)));n("#"+this._rteId+"_video_wrapper").css({"z-index":this._onGetMaxZindex()});this._videoDialog.ejDialog("open");this._videoDialog.find("textarea.e-rte-video").focus()},_sourceCodeManager:function(){t.isNullOrUndefined(this._sourceDialog)&&this._renderSourceDialog();this._updateTagInfo("body");this._hideTooltip();t.isNullOrUndefined(this._getDocument().documentElement)?this._htmlSource.addClass("e-disable"):(this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value=this.model.enableHtmlEncode?this._encode(this._getDocument().documentElement.outerHTML):this._getDocument().documentElement.outerHTML,n("#"+this._rteId+"_Source_wrapper").css({"z-index":this._onGetMaxZindex()}),this._sourceDialog.ejDialog("open"),this._sourceDialog.find("textarea.e-rte-srctextarea").focus())},_getPasteRangeVal:function(){this._isIE()&&(this._pasteRangeVal=this._getRange(),this._pasteFlag=!0)},_hyperLinkManager:function(i){this._getPasteRangeVal();var r=this._isIE()?this._currentSelNode:this._getSelectedNode();this._selectedHTML=t.browserInfo().name==="msie"&&t.browserInfo().version==="11.0"?this._pasteRangeVal.toString():this._getSelText();i?(this._clearFileFields(),!t.isNullOrUndefined(r)&&r.tagName.toUpperCase()=="A"?this._fileLinkText.val(n(r).html()):this._fileLinkText.val(this._selectedHTML),n("#"+this._rteId+"_fileDialog_wrapper").css({"z-index":this._onGetMaxZindex()}),this._fileDialog.ejDialog("open")):(this._clearLinkFields(),!t.isNullOrUndefined(r)&&r.tagName.toUpperCase()=="A"?this._txtLinkText.val(n(r).html()):this._txtLinkText.val(this._selectedHTML),n("#"+this._rteId+"_link_wrapper").css({"z-index":this._onGetMaxZindex()}),this._linkDialog.ejDialog("open"),this._textFieldFocus(this._txtURL[0],this._txtURL.val().length,this._txtURL.val().length));r&&!/^(A)$/.test(r.nodeName)&&r.tagName.toUpperCase()=="IMG"&&(r=n(r).parent("a")[0]);i?r&&/^(A)$/.test(r.nodeName)&&this._fileURL.val(r.href):r&&/^(A)$/.test(r.nodeName)&&(this._txtURL.val(r.href),this._txtLinkTitle.val(r.title))},_tableManager:function(){var r=this._rteToolbar.find("li.e-rteItem-createTable"),i,u,o,f,e;this._getPasteRangeVal();this._getSelectedNode().nodeName.toLowerCase()=="td"&&this._createTable.find("div.e-rte-eTblProperties").removeClass("e-disable");this.model.isResponsive&&r.length==0?(o=n(this._toolBarObj._liTemplte).outerHeight()-n(this._toolBarObj._liTemplte).height(),r=this._toolBarObj._liTemplte.find("li.e-rteItem-createTable"),n("#"+this._rteId+"_table_wrapper").css({visibility:"hidden",display:"block"}),u=n(this._toolBarObj._liTemplte).offset().top+n(this._toolBarObj._liTemplte).outerHeight()+o-n("#"+this._rteId+"_table_wrapper").offsetParent().offset().top,i=n(r).offset().left>230?n(r).offset().left-n("#"+this._rteId+"_table_wrapper").offsetParent().offset().left:n("#"+this._rteId+"_table_wrapper").offsetParent().offset().left,n("#"+this._rteId+"_table_wrapper").css({visibility:"visible"})):(i=n(r).position().left,u=n(r).position().top+r.height()+7);(parseInt(i)+parseInt(n("#"+this._id+"_table_wrapper").css("width"))>document.body.clientWidth||parseInt(i)+parseInt(n("#"+this._id+"_table_wrapper").css("width"))>parseInt(n("#"+this._id+"_wrapper").css("width"))+n("#"+this._id+"_wrapper").position().left)&&(i=parseInt(i)-(parseInt(n("#"+this._id+"_table_wrapper").css("width"))-n(r).width())+"px");f=document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop;f<u&&n(window).height()<u-f+parseInt(n("#"+this._id+"_table_wrapper").css("height"))&&(u=parseInt(n("#"+this._id+"_table_wrapper").css("height"))>n(window).height()?f:n(window).height()-parseInt(n("#"+this._id+"_table_wrapper").css("height"))>0?n(window).height()-parseInt(n("#"+this._id+"_table_wrapper").css("height"))+f:f);e=this._rteWapper.offset();i=parseInt(i)-parseInt(e.left);u=parseInt(u)-parseInt(e.top);this._createTable.ejDialog("option","position",{X:i,Y:u});this._createTable.ejDialog("open");this._on(t.getScrollableParents(this._createTable),"scroll",function(){this._createTable.ejDialog("close")})},_eTblManager:function(){var i,e,s,f,u;this._clearEditTableFields();var h=this._rteId,o=n(this._getSelectedNode()).closest("td"),r=o.length>0?o[0]:this._currentSelNode;t.isNullOrUndefined(r)||r.tagName.toLowerCase()!=="td"||(i=n(r).closest("tbody").closest("table"),this._getTableObj("Height").val(n(i).height()),this._getTableObj("Width").val(n(i).width()),t.isNullOrUndefined(i[0])||(this._getTableObj("CellSpace").data("ejNumericTextbox").option("value",i[0].cellSpacing),this._getTableObj("CellPad").data("ejNumericTextbox").option("value",i[0].cellPadding),e=i[0].align),t.isNullOrUndefined(e)||e==""||(this._eTblAlign.enable(),this._eTblAlign.option("value",e)),s=n(n(r).closest("tbody")).prev("caption"),s.length>0&&this._eTblCaption.ejCheckBox({checked:!0}),t.isNullOrUndefined(i[0])||i[0].style==""||(this._getTableObj("BrdrPx").data("ejNumericTextbox").option("value",i[0].style.borderWidth.split("px")[0]),u=this._getTableObj("_border_style").data("ejDropDownList"),i[0].style.borderStyle!=""?u.selectItemByValue(i[0].style.borderStyle):u.option({selectedItemIndex:0}),this._getTableObj("_border_color").val(i[0].style.borderColor)),this._getTableObj("Style").val(i.attr("style")),f=n(r).closest("tr"),this._getTableObj("RHeight").val(n(f).height()),this._getTableObj("RAlign").data("ejDropDownList").option("value",f[0].style.textAlign),f[0].style!=""&&(this._getTableObj("RBrdrPx").data("ejNumericTextbox").option("value",f[0].style.borderWidth.split("px")[0]),u=this._getTableObj("RBrdrStyle").data("ejDropDownList"),f[0].style.borderStyle!=""?u.selectItemByValue(f[0].style.borderStyle):u.option({selectedItemIndex:0}),this._getTableObj("RBrdrColor").val(f[0].style.borderColor)),this._getTableObj("RStyle").val(f.attr("style")),this._getTableObj("ClWidth").val(n(r).width()),this._getTableObj("ClAlign").data("ejDropDownList").option("value",r.style.textAlign),r.style!=""&&(this._getTableObj("ClBrdrPx").data("ejNumericTextbox").option("value",r.style.borderLeftWidth.split("px")[0]),u=this._getTableObj("ClBrdrStyle").data("ejDropDownList"),r.style.borderStyle!=""?u.selectItemByValue(r.style.borderStyle):u.option({selectedItemIndex:0}),this._getTableObj("ClBrdrColor").val(r.style.borderColor)),this._getTableObj("ClStyle").val(n(r).attr("style")))},_getTableObj:function(n){return this._eTblDialog.find("#"+this._rteId+"_eTbl"+n)},_imageManager:function(){var i,u,r;this._clearImgFields();i=this._isIE()?this._currentSelNode:this._getSelectedNode();this._getPasteRangeVal();i&&!t.isNullOrUndefined(i)&&(this._imgWidth=parseInt(n(i).width()),this._imgHeight=parseInt(n(i).height()),this.model.showDimensions&&(this._imgDialog.find(".e-rte-imgX").val(this._imgWidth),this._imgDialog.find(".e-rte-imgY").val(this._imgHeight)),u=n(i).parent("a"),u.length>0&&this._imageLink.val(u.attr("href")),i.tagName.toLowerCase()==="img"&&(this._imgDialog.find(".e-rte-imgUrl").val(i.src),this._imgDialog.find(".e-rte-imgText").val(i.alt),i.style!=""&&(this._imageBorderPx.option("value",i.style.borderWidth.split("px")[0]),this._imageBorderStyle.option("value",i.style.borderStyle),i.style.borderColor.length>0&&(t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"?this._imgPicker.option("value",i.style.borderColor):(r=i.style.borderColor.split("(")[1].split(")")[0],r=r.split(","),r={r:n.trim(r[0]),g:n.trim(r[1]),b:n.trim(r[2])},this._imgPicker.option("value",this._imgPicker.RGBToHEX(r))))),this._imageStyle.val(n(i).attr("style"))));n("#"+this._rteId+"_Image_wrapper").css({"z-index":this._onGetMaxZindex()});this._imgDialog.ejDialog("open");this._textFieldFocus(this._imgURL[0],this._imgURL.val().length,this._imgURL.val().length);t.isNullOrUndefined(this._explorerObj)&&this._imgDialog.find(".e-rte-imgUrl").focus()},_getValidbrowser:function(n){switch(n){case"chrome":return t.browserInfo().version<42;case"mozilla":return t.browserInfo().version<41;case"opera":return t.browserInfo().version<29;default:return!0}},_alertHeader:function(n){n._alertWindow.ejDialog("option","showHeader",!1);this.model.enableRTL&&!this._alertWindow.find(".e-alert-ok").hasClass("e-rte-alertBtnRTL")&&this._alertWindow.find(".e-alert-ok").addClass("e-rte-alertBtnRTL");n._alertWindow.find(".e-rte-button").css({"text-align":"","padding-bottom":"","padding-top":""}).addClass("e-fieldseparate");n._alertWindow.ejDialog("instance").refresh()},_toolBarClick:function(i){var o,s,f;if(!i.event||!(i.event.which&&i.event.which==3||i.event.button&&i.event.button==2)){var h=n(this.itemsContainer).closest("div.e-rte").find("textarea.e-rte"),r=h.ejRTE("instance"),e=h.attr("id"),u=t.isNullOrUndefined(e)?i.currentTarget.id.replace("_",""):i.currentTarget.id.replace(e+"_","");if(r._alertHeader(r),t.browserInfo().name==="mozilla"&&(r._getDocument().designMode="off"),n(i.currentTarget).hasClass("e-rteItem-copy")&&!r._isIE()&&r._getValidbrowser(t.browserInfo().name)?r._openAlert(r._getLocalizedLabels("copyAlert")):n(i.currentTarget).hasClass("e-rteItem-cut")&&!r._isIE()&&r._getValidbrowser(t.browserInfo().name)?r._openAlert(r._getLocalizedLabels("cutAlert")):n(i.currentTarget).hasClass("e-rteItem-paste")&&!r._isIE()?r._openAlert(r._getLocalizedLabels("pasteAlert")):(t.browserInfo().name!="chrome"&&(f=r._scriptsItems.indexOf(u),r._scriptsItems.indexOf(u)>=0&&n("#"+e+"_"+r._scriptsItems[f==0?1:0]).hasClass("e-active")&&r._selectCommand(e+"_"+r._scriptsItems[f==0?1:0])),o=n.grep(i.currentTarget.children[0].className.split(/\s+/),function(n){return!/^e-(rteItem|rte-toolbar-icon)$/i.test(n)}),(o.indexOf("e-split")>=0||o.indexOf("e-ddl")>=0)&&(o[0]=u),r._selectCommand(o[0])),r._styleItems.indexOf(u)>=0||r._scriptsItems.indexOf(u)>=0)n(i.currentTarget).hasClass("e-isactive")?this.deselectItemByID(i.currentTarget.id):this.selectItemByID(i.currentTarget.id),n(i.currentTarget).hasClass("e-isactive")?n(i.currentTarget).removeClass("e-isactive"):n(i.currentTarget).addClass("e-isactive"),r._scriptsItems.indexOf(u)>=0&&(f=r._scriptsItems.indexOf(u),n("#"+e+"_"+r._scriptsItems[f==0?1:0]).removeClass("e-isactive"),this.deselectItemByID(e+"_"+r._scriptsItems[f==0?1:0]));else if(r._alignItems.indexOf(u)>=0)for(this.selectItemByID(i.currentTarget.id),f=r._alignItems.indexOf(u),s=0;s<r._alignItems.length;s++)s!=f&&this.deselectItemByID(e+"_"+r._alignItems[s]);else r._listItems.indexOf(u)>=0&&(n(i.currentTarget).hasClass("e-isactive")?this.deselectItemByID(i.currentTarget.id):this.selectItemByID(i.currentTarget.id),n(i.currentTarget).hasClass("e-isactive")?n(i.currentTarget).removeClass("e-isactive"):n(i.currentTarget).addClass("e-isactive"),f=r._listItems.indexOf(u),n("#"+e+"_"+r._listItems[f==0?1:0]).removeClass("e-isactive"),f==0?this.deselectItemByID(e+"_"+r._listItems[1]):this.deselectItemByID(e+"_"+r._listItems[0]))}},_toggleEditTable:function(){var r,i,u,f;if(this._isIE8()&&this._getRange().parentElement&&(this._currentSelNode=this._getRange().parentElement()),r=n(this._getSelectedNode()).closest("table"),i=r.length>0?r[0]:this._getSelectedNode(),t.isNullOrUndefined(i))return!1;t.isNullOrUndefined(this._toolBarItems)||(f=this._rteToolbar.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable"),u=this.model.isResponsive&&f.length==0?this._toolBarObj._liTemplte.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable"):this._toolBarItems.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable"),t.isNullOrUndefined(i.tagName)||(i&&i.tagName&&i.tagName.toLowerCase()=="td"||i.tagName.toLowerCase()=="table"||i.tagName.toLowerCase()=="tr"?(u.show(),this._createTable&&this._createTable.find("div.e-rte-eTblProperties").removeClass("e-disable")):t.isNullOrUndefined(this._createTable)||(u.hide(),this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable"))));this.model.isResponsive&&this.model.showToolbar&&this._toolBarObj._reSizeHandler();(!this.model.autoHeight||this._toolBarObj&&n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.resize)).length)&&this._setIframeHeight()},_formatChange:function(t){if(t.isInteraction){var r=n(this.element).closest("div.e-rte").find("textarea.e-rte"),i=r.ejRTE("instance"),u=r.attr("id");t.value!==""&&i._onFormatBlock(t.value);i._isIE()&&i._focus();i._onChange();i._setBackupData()}},_fontStyleChange:function(t){var r,i,u;t.isInteraction&&(r=n(this.element).closest("div").hasClass("e-normal")?n("textarea#"+t.model.htmlAttributes.datafontid):n(this.element).closest("div.e-rte").find("textarea.e-rte"),i=r.ejRTE("instance"),u=r.attr("id"),i._focus(),t.value!==""&&i._onFontName(t.value),i._onChange(),i._setBackupData())},_fontSizeChange:function(t){var r,i,u;t.isInteraction&&(r=n(this.element).closest("div").hasClass("e-normal")?n("textarea#"+t.model.htmlAttributes.datafontid):n(this.element).closest("div.e-rte").find("textarea.e-rte"),i=r.ejRTE("instance"),u=r.attr("id"),i._focus(),t.value!==""&&i._onFontSize(t.value),i._onChange(),i._setBackupData())},_colorPaletteClick:function(n){var t;(t=n.target.getAttribute("color-code"))&&(this._focus(),this._onFontColor(t),this._splitMenu.hide(n),this._fontColor=t,this._fontColorSplit.find("span.e-btntxt").css("background-color",t),this._onChange(),this._setBackupData())},_bgColorPaletteClick:function(n){var t;(t=n.target.getAttribute("color-code"))&&(this._focus(),this._onBGColor(t),this._bgSplitMenu.hide(n),this._bgColor=t,this._bgColorSplit.find("span.e-btntxt").css("background-color",t),this._onChange(),this._setBackupData())},_fontColorClick:function(n){if(this._onFontColor(this._fontColor),t.isNullOrUndefined(this._splitMenu))return!1;this._splitMenu.hide(n)},_bgTransClick:function(n){this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.backcolor,"transparent");this._trigger("execute",{commandName:"backColor"});this._bgColorSplit.find("span.e-btntxt").css("background-color","transparent");!t.isNullOrUndefined(this._bgSplitMenu);this._bgSplitMenu.hide(n);this._bgColor="transparent"},_bgColorClick:function(n){if(this._onBGColor(this._bgColor),t.isNullOrUndefined(this._bgSplitMenu))return!1;this._bgSplitMenu.hide(n)},_selectCommand:function(i){n(this._imgDupDiv).remove();n(this._imgOrg).css("outline","");t.browserInfo().name=="edge"||i=="format"||i=="fontName"||i=="fontSize"||i=="fontColor"||i=="backgroundColor"||i=="createTable"||this._focus();switch(i){case"fullScreen":this._onFullScreen();break;case"print":this._onPrint();break;case"import":this._onImport();break;case"wordExport":this._onExportToWord();break;case"pdfExport":this._onExportToPdf();break;case"findAndReplace":t.RTE.FindAndReplace&&this._showFindAndReplace();break;case"bold":this._onBold();break;case"italic":this._onItalics();break;case"underline":this._onUnderLine();break;case"strikethrough":this._onStrikeThrough();break;case"justifyLeft":this._onJustifyLeft();break;case"justifyRight":this._onJustifyRight();break;case"justifyCenter":this._onJustifyCenter();break;case"justifyFull":this._onJustifyFull();break;case"cut":this._onCut();break;case"copy":this._onCopy();break;case"paste":this._onPaste();break;case"clearFormat":this._onClearFormat();break;case"clearAll":this._clearAllManager();break;case"orderedList":case"unorderedList":this._getPasteRangeVal();break;case"undo":this._undo();break;case"redo":this._redo();break;case"indent":this._onIndent();this._indentdepth++;break;case"outdent":this._onOutdent();this._indentdepth>0&&this._indentdepth--;break;case"createLink":this._hyperLinkManager(!1);break;case"removeLink":this._onUnlink();break;case"image":this._imageManager();break;case"createTable":this._createTable.ejDialog("isOpen")?this._createTable.ejDialog("close"):this._tableManager();break;case"addRowAbove":this.insertRow(!0);break;case"addRowBelow":this.insertRow(!1);break;case"addColumnLeft":this.insertColumn(!0);break;case"addColumnRight":this.insertColumn(!1);break;case"deleteRow":this.removeRow();break;case"deleteColumn":this.removeColumn();break;case"deleteTable":this.removeTable();break;case"superscript":this._onSuperScript();break;case"subscript":this._onSubScript();break;case"upperCase":this._onUpperCase();break;case"lowerCase":this._onLowerCase();break;case"video":this._videoManager();break;case"fileBrowser":this._hyperLinkManager(!0);break;default:this._onChange()}i!="createLink"&&i!="image"&&i!="video"&&i!="createTable"&&this._onChange();i!="undo"&&i!="redo"&&this._setBackupData();var r=this._isIE()?this._currentSelNode:this._getSelectedNode();this._updateTagInfo(r)},_focus:function(){browserInfo=t.browserInfo();browserInfo.name=="webkit"?this._getWindow().focus():this._getWindow().document.body.focus();this._restoreSelection(this._selectionRange)},_getWindow:function(){return n(n(this._rteWapper.find(".content-iframe"))[0].contentWindow)[0]},_getDocument:function(){var n=this._rteWapper.find(".content-iframe");try{return n.contents()[0]}catch(t){return""}},_onFullScreen:function(){n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.resize)).length?(n(this._rteWapper).css({top:this._rteOffset.top,left:this._rteOffset.left,width:this._rteWidth,height:this._rteHeight,position:this._rtePosition,"z-index":""}),n("body").css("overflow",""),n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.resize)).addClass(this._rteIconsList.maximize).removeClass(this._rteIconsList.resize).parent("li").attr("data-content",this._getLocalizedLabels("maximize"))):(this._rteOffset=n(this._rteWapper).position(),this._rtePosition=n(this._rteWapper).css("position"),n(this._rteWapper).css({top:"0px",left:"0px",width:"100%",height:"100%",position:"fixed","z-index":this._onGetMaxZindex()}),n("body").css("overflow","hidden"),n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.maximize)).removeClass(this._rteIconsList.maximize).addClass(this._rteIconsList.resize).parent("li").attr("data-content",this._getLocalizedLabels("resize")));n(this._getDocument()).find("table.e-rte-table").length>0&&this._removeResizeObject();this._setAutoHeight();this.model.showToolbar&&this.model.isResponsive&&this._toolBarObj._reSizeHandler();this._setIframeHeight();t.isNullOrUndefined(this._createTable)||this._createTableClose()},_onGetMaxZindex:function(){return Math.max.apply(null,n.map(n("body *"),function(t){return parseInt(n(t).css("z-index"))+1||1}))},_onZooming:function(i){i._zoomValue=0;var r=Number(i.getDocument().body.style.zoom==""||t.isNullOrUndefined(i.getDocument().body.style.zoom)?1:i.getDocument().body.style.zoom),u=isNaN(i.model.zoomStep)&&i.model.zoomStep.indexOf("%")!=-1?parseInt(i.model.zoomStep)/100:Number(i.model.zoomStep);return i._zoomValue=i._zoomArgs=="IN"?r+u:r-u>.1?r-u:.1,n(i.getDocument().body).css({zoom:i._zoomValue,transform:"scale("+i._zoomValue+")","transform-origin":"0 0","-o-transform":"scale("+i._zoomValue+")","-o-transform-origin":"0 0","-webkit-transform":"scale("+i._zoomValue+")","-webkit-transform-origin":"0 0"}),n(i._toolBarObj.itemsContainer.find(".e-rteItem-zoomIn")).attr("title",i._getLocalizedLabels("zoomIn")+" "+Math.round(i._zoomValue*100)+"%"),n(i._toolBarObj.itemsContainer.find(".e-rteItem-zoomOut")).attr("title",i._getLocalizedLabels("zoomOut")+" "+Math.round(i._zoomValue*100)+"%"),i._isIE()?i:void 0},_onKeyZoom:function(n){var t=this;this._mouseStillDown=!0;this._zoomArgs=n;this._setInterval=setInterval(t._onZooming(t),100)},_onPrint:function(){var i=this;this._isIE()||t.browserInfo().name==="mozilla"?this._getWindow().onafterprint=function(){n(i.getDocument().body).css({zoom:i._zoomValue?i._zoomValue:1,transform:"scale("+(i._zoomValue?i._zoomValue:1)+")","transform-origin":"0 0","-o-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-o-transform-origin":"0 0","-webkit-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-webkit-transform-origin":"0 0"})}:i._getWindow().matchMedia("print").addListener(function(t){t.matches||n(i.getDocument().body).css({zoom:i._zoomValue?i._zoomValue:1,transform:"scale("+(i._zoomValue?i._zoomValue:1)+")","transform-origin":"0 0","-o-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-o-transform-origin":"0 0","-webkit-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-webkit-transform-origin":"0 0"})});n(i.getDocument().body).css({zoom:"",transform:"","-o-transform":"","-webkit-transform":""});this._getWindow().print()},_renderimport:function(){var i=t.buildTag("div#"+this._id+"_importUpload","","",""),r=this.model.importSettings.url+"?rteid="+this._id;this._rteToolbar.find("li.e-rteItem-import").append(i);i.ejUploadbox({multipleFilesSelection:!1,width:"0px",height:"0px",autoUpload:!0,extensionsAllow:".docx,.doc",showBrowseButton:!1,buttonText:{browse:this._id},showFileDetails:!1,saveUrl:r,success:function(t){var u=t.model.buttonText.browse,f=n("#"+u).data("ejRTE"),i=t.responseText,r=n(f._getDocument().body);i=i.replace('<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">',"").replace("<\/string>","").replace(/"/gi,"");r.children().remove();r.append(n.parseHTML(i))}});i.addClass("e-browse-hide")},_onImport:function(){this._toolBarItems.find("div#"+this._id+"_importUpload").find("input[type=file]").trigger("click")},_onExportToWord:function(){var r=this._getDocument().body,u=this.model.exportToWordSettings.url,f=r.innerHTML,e={action:u+"?rteid="+this._id,method:"post"},i=t.buildTag("form","",null,e),o={name:this._id+"_inputVal",type:"hidden",value:f},s=t.buildTag("input","",null,o),h={name:this._id+"_inputFile",type:"hidden",value:this.model.exportToWordSettings.fileName},c=t.buildTag("input","",null,h);n("body").append(i.append(s).append(c));i.submit();i.remove()},_onExportToPdf:function(){var r=this._getDocument().body,u=this.model.exportToPdfSettings.url,f=r.innerHTML,e={action:u+"?rteid="+this._id,method:"post"},i=t.buildTag("form","",null,e),o={name:this._id+"_inputVal",type:"hidden",value:f},s=t.buildTag("input","",null,o),h={name:this._id+"_inputFile",type:"hidden",value:this.model.exportToPdfSettings.fileName},c=t.buildTag("input","",null,h);n("body").append(i.append(s).append(c));i.submit();i.remove()},_zoomUp:function(n){n&&(n.which&&n.which==3||n.button&&n.button==2)||this._setInterval&&(this._mouseStillDown=!1,clearInterval(this._setInterval),this._setInterval=null)},_zoomDown:function(t){if(!t||!(t.which&&t.which==3||t.button&&t.button==2)){var i=this;i._mouseStillDown=!0;i._zoomArgs=n(t.target).hasClass("e-rte-toolbar-icon zoomIn "+this._rteIconsList.zoomIn)||n(t.target).hasClass("e-rteItem-zoomIn")?"IN":"OUT";i._setInterval=t.type=="mousedown"?setInterval(function(){i._onZooming(i)},100):setInterval(i._onZooming(i),100)}},_onBold:function(){var n;this._isIE8()?this.executeCommand("bold",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.bold,null),this._trigger("execute",{commandName:"bold"}))},_onItalics:function(){var n;this._isIE8()?this.executeCommand("italic",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.italic,null),this._trigger("execute",{commandName:"italic"}))},_onStrikeThrough:function(){var n;this._isIE8()?this.executeCommand("strikethrough",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.strikethrough,null),this._trigger("execute",{commandName:"strikethrough"}))},_onUnderLine:function(){var n;this._isIE8()?this.executeCommand("underline",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.underline,null),this._trigger("execute",{commandName:"underline"}))},_onJustifyLeft:function(){var n;this._isIE8()?this.executeCommand("JustifyLeft",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifyleft,null),this._trigger("execute",{commandName:"JustifyLeft"}))},_onJustifyRight:function(){var n;this._isIE8()?this.executeCommand("JustifyRight",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifyright,null),this._trigger("execute",{commandName:"JustifyRight"}))},_onJustifyCenter:function(){var n;this._isIE8()?this.executeCommand("JustifyCenter",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifycenter,null),this._trigger("execute",{commandName:"JustifyCenter"}))},_onJustifyFull:function(){this._alignFlag=!0;this._isIE8()?this.executeCommand("justifyfull"):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifyfull,null),this._trigger("execute",{commandName:"justifyfull"}))},_onCut:function(){var n;this.executeCommand("cut",n)},_onCopy:function(){var n;this.executeCommand("copy",n)},_onOpen:function(){var t=this._isIE()?this._currentSelNode:this._getSelectedNode();window.open(n(t).attr("href"))},_onPaste:function(){var n;this.executeCommand("paste",n)},_onOrderList:function(i){var r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode(),u;(n(r).prop("tagName")=="OL"||n(r).parents("ol").length!=0||i.ID=="none")&&i.type!="click"&&(!(n(r).prop("tagName")=="OL"||n(r).parents("ol").length>0)||i.ID!="none")||t.isNullOrUndefined(i.ID)&&this._listOrderType=="none"||this.executeCommand("insertorderedlist","listItem");r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode();i.type=="click"&&n(r).parents("ol").length>=0&&(i.ID=this._listOrderType);t.isNullOrUndefined(i.ID)||(u=n(r).prop("tagName")=="OL"?r:n(r).parents("ol"));this._generateListItems(i,u,t.isNullOrUndefined(this.model.tools.customOrderedList)?[]:this.model.tools.customOrderedList);this._listOrderType=i.ID;this._updateIndent(r)},_onUnorderList:function(i){var r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode(),u;(n(r).prop("tagName")=="UL"||n(r).parents("ul").length!=0||i.ID=="none")&&i.type!="click"&&(!(n(r).prop("tagName")=="UL"||n(r).parents("ul").length>0)||i.ID!="none")||t.isNullOrUndefined(i.ID)&&this._listType=="none"||this.executeCommand("insertunorderedlist","listItem");r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode();i.type=="click"&&n(r).parents("ul").length>=0&&(i.ID=this._listType);t.isNullOrUndefined(i.ID)||(u=n(r).prop("tagName")=="UL"?r:n(r).parents("ul"));this._generateListItems(i,u,t.isNullOrUndefined(this.model.tools.customUnorderedList)?[]:this.model.tools.customUnorderedList);this._listType=i.ID;this._updateIndent(r)},_generateListItems:function(t,i,r){n(i).css({"list-style-type":t.ID,"list-style-image":""});var u=this;["none","disc","circle","square","decimal","upper-roman","lower-roman","upper-alpha","lower-alpha"].indexOf(t.ID)==-1&&n.each(r,function(r,u){u.name==t.ID&&n(i).css({"list-style-type":u.listStyle,"list-style-image":u.listImage})});this._setBackupData();this._isIE()?this.selectRange(this._pasteRangeVal):this.selectRange(this._getRange());this._updateTagInfo(this._isIE()?this._currentSelNode:this._getSelectedNode())},_onUndo:function(){this._isIE8()?this.executeCommand("undo",null):this._undo()},_onDelete:function(){this.executeCommand("delete",null)},_onRedo:function(){this._isIE8()?this.executeCommand("redo",null):this._redo()},_onClearFormat:function(){var n;this.executeCommand("removeformat",n);this._hideTooltip();this._setBackupData();this._onChange();this._updateIframeSkin(this.model.iframeAttributes);this._updateToolbarStatus()},_onFormatBlock:function(n){if(this._focus(),this._isIE8()){var i;i=document.getSelection?this._getSelectedNode():this._getWindow().document.selection.createRange().parentElement();this._onClearFormat();this.executeCommand("formatBlock",n)}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.formatblock,n),this._trigger("execute",{commandName:"formatBlock"});this._updateToolbarStatus();this._updateFontOptionStatus()},_onFontName:function(n){this._isIE8()?this.executeCommand("fontName",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.fontname,n),this._trigger("execute",{commandName:"fontName"}))},_onFontSize:function(n){this._isIE8()?this.executeCommand("fontSize",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.fontsize,n),this._trigger("execute",{commandName:"fontSize"}))},_onFontColor:function(n){this._customDialogobj.isOpen()&&(this._fontColorSplit.find("span.e-btntxt").css("background-color",n),this._customColor.ejDialog("close"));this._isIE8()?this.executeCommand("foreColor",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.forecolor,n),this._trigger("execute",{commandName:"foreColor"}));this._onChange();this._updateIframeSkin(this.model.iframeAttributes)},_onBGColor:function(n){this._customDialogobj.isOpen()&&(this._bgColorSplit.find("span.e-btntxt").css("background-color",n),this._customColor.ejDialog("close"));this._isIE8()?this.executeCommand("backColor",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.backcolor,n),this._trigger("execute",{commandName:"backColor"}));this._onChange()},_onIndent:function(){if(this._isIE8()){this._getWindow().document.body.style.wordWrap="break-word";var i=document.getSelection?this._getWindow().document.getSelection().focusNode:this._getWindow().document.selection.createRange().parentElement();i&&/^(OL|UL|LI)$/.test(i.nodeName)?this._listIndent(i):i&&/^(#text)$/.test(i.nodeName)&&/^(OL|UL|LI)$/.test(n(i).parent()[0].nodeName)?this._listIndent(n(i).parents("li")[0],i):this.executeCommand("indent",!1);i&&n(i).focus()}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.indent,null),this._trigger("execute",{commandName:"indent"});this._updateIframeSkin(this.model.iframeAttributes);this._updateIndentStatus()},_onOutdent:function(){if(this._isIE8()){var i=document.getSelection?this._getWindow().document.getSelection().focusNode:this._getWindow().document.selection.createRange().parentElement();i&&/^(OL|UL|LI)$/.test(i.nodeName)?this._listOutdent(i):i&&/^(#text)$/.test(i.nodeName)&&/^(OL|UL|LI)$/.test(n(i).parent()[0].nodeName)?this._listOutdent(n(i).parents("li")[0],i):this.executeCommand("outdent",!1)}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.outdent,null),this._trigger("execute",{commandName:"outdent"});this._updateIndentStatus()},_onSelectAll:function(){this.executeCommand("selectall")},selectAll:function(){this._onSelectAll()},_onHyperLink:function(n){this.executeCommand("createlink",n)},_onInsertLink:function(){var r,u,i,f;if(!this._isUrl(n.trim(this._txtURL.val())))return this._txtURL.addClass("e-error"),!1;i=(t.browserInfo().name=="msie"||t.browserInfo().name=="chrome")&&n(this._currentSelNode).parents("body").length>0?this._currentSelNode:this._getSelectedNode();t.isNullOrUndefined(i)||i.tagName.toUpperCase()!="A"?t.isNullOrUndefined(i)||i.tagName.toUpperCase()!="IMG"?(r=t.buildTag("a","",{},{href:this._txtURL.val(),title:this._txtLinkTitle.val()==""?this._txtURL.val()+"\n"+this._getLocalizedLabels("linkTooltip"):this._txtLinkTitle.val()}),r[0].target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"",this._focus(),this._isIE()?(this._selectedHTML.length==0&&(this._selectedHTML=this._txtLinkText.val()===""?this._txtURL.val():this._txtLinkText.val()),r[0].innerHTML=this._selectedHTML,u=r[0].outerHTML):(this._txtLinkText.val()===""?r.html(this._txtURL.val()):r.html(this._txtLinkText.val()),u=n("<div>").append(n(r).clone()).html()),u&&this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length&&(this._isIE()?this._pasteHtml(u):this._getDocument().execCommand("inserthtml",!1,u),this.selectRange(this._getRange()))):(f=n(i).parent("a")[0],t.isNullOrUndefined(f)?(r=t.buildTag("a","",{},{href:this._txtURL.val(),title:this._txtLinkTitle.val()==""?this._txtURL.val()+"\n"+this._getLocalizedLabels("linkTooltip"):this._txtLinkTitle.val()}),r[0].target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"",n(i.outerHTML).appendTo(n(r)),n(i).replaceWith(n(r))):(f.href=this._txtURL.val(),f.title=this._txtLinkTitle.val(),f.target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"")):(i.href=this._txtURL.val(),i.title=this._txtLinkTitle.val(),i.innerHTML=this._txtLinkText.val(),i.target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"");this._linkDialog.ejDialog("close");this.enableToolbarItem("removeLink");this._updateCount()},_setImageProperties:function(i,r,u,f,e,o,s){this.model.showDimensions&&(r!=""&&(i[0].width=r),u!=""&&(i[0].height=u));i=n(i).attr("style",f);border=e+"px ";border+=!t.isNullOrUndefined(o)&&o!=""?o+" ":"solid ";border+=!t.isNullOrUndefined(s)&&s!=""?s:"#000000";i=i.css("border",border)},_onInsertImage:function(){var o=this._imgDialog.find(".e-rte-imgUrl"),h=this._imgDialog.find(".e-rte-imgText"),c=this._imgDialog.find(".e-rte-imgX").val(),l=this._imgDialog.find(".e-rte-imgY").val(),i=this,s,w,r;this._restoreSelection(this._selectionRange);var a="",f=i._imageLink.val(),v=i._imageBorderPx.getValue(),y=i._imageBorderStyle.getSelectedValue(),e=i._imgPicker.getValue(),p=i._imageStyle.val(),u=i._isIE()?i._currentSelNode:i._getSelectedNode();if(t.isNullOrUndefined(u)||(a=u.nodeName.toUpperCase()),e=!t.isNullOrUndefined(e)&&e.length>0?e:"",s=o.val().startsWith("~")?o.val().replace(o.val().substr("0","1"),".."):o.val(),a!="IMG")w=n("<img>",{src:s,error:function(){o.addClass("e-error")},success:function(){var r=t.buildTag("img","",{},{alt:h.val(),src:s}),u,o;if(i._setImageProperties(r,c,l,p,v,y,e),f!="")if(i._isUrl(n.trim(f)))u=t.buildTag("a","",{},{href:f}),u[0].target=i._dialogchkTarget.ejCheckBox("isChecked")?"_blank":"_self",n(r[0].outerHTML).appendTo(u),r=u;else return i._imageLink.addClass("e-error"),!1;o=r[0].outerHTML;i.executeCommand("inserthtml",o)}});else{if(u.src=s,u.alt=h.val(),i._setImageProperties(n(u),c,l,p,v,y,e),r=n(u).parent("a"),f!="")if(i._isUrl(n.trim(f)))r.length>0?r.attr("href",f):(r=t.buildTag("a","",{},{href:f}),n(u.outerHTML).appendTo(r),n(u).replaceWith(r));else return i._imageLink.addClass("e-error"),!1;else r.length>0&&r.attr("href","");!t.isNullOrUndefined(r)&&r.length>0&&(r[0].target=this._dialogchkTarget.ejCheckBox("isChecked")?"_blank":"_self")}i._setAutoHeight();i._imageLink.hasClass("e-error")||i._imgDialog.ejDialog("close");i._on(i._imageLink,"keypress",i._urlValidation)._on(i._imageLink,"blur",i._urlValidation)},_insertVideo:function(i){var u=n.trim(this._videoDialog.find("textarea.e-rte-video")[0].value),f=this._videoDialog.find(".e-rte-videoX").val(),e=this._videoDialog.find(".e-rte-videoY").val(),r;this._restoreSelection(this._selectionRange);this._alertHeader(this);i.target.id==="video_insert"&&u!==""?(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),r=n(u)[0],this.model.showDimensions&&!t.isNullOrUndefined(r)&&(f!=""&&(r.width=f),e!=""&&(r.height=e)),!t.isNullOrUndefined(r)&&this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length&&this.executeCommand("inserthtml",r.outerHTML+"<br/>"),this._onChange(),this._setBackupData(),this._videoDialog.ejDialog("close")):i.target.id==="video_cancel"?(this._videoDialog.ejDialog("close"),this._ieCursorMaintainance()):this._openAlert(this._getLocalizedLabels("videoError"));this._videoDialog.find("textarea.e-rte-video")[0].value="";this._videoDialog.find(".e-rte-videoX").val("");this._videoDialog.find(".e-rte-videoY").val("");this._chkvideoDimensions.ejCheckBox({check:!0});this._setAutoHeight()},_oneditTable:function(){var e=n(this._getSelectedNode()).closest("td"),i=e.length>0?e[0]:this._currentSelNode,o=n(i).closest("tbody").closest("table"),u=n(n(i).closest("tbody")).prev("caption"),f,r,s;this._eTblCaption.ejCheckBox("isChecked")?u.length==0&&t.buildTag("caption").append(n('<br type="_moz">')).insertBefore(n(n(i).closest("tbody"))):u.length>0&&u.remove();f=this._eTblAlign.getSelectedValue();r=this._getTableObj("Style").val();f=="center"&&(r+=";margin: 0 auto;");r&&o.attr("style",r);this._customTableValidation=!1;var h=this._customInputValidation(this._getTableObj("Width")),c=this._customInputValidation(this._getTableObj("Height")),l=this._customInputValidation(this._getTableObj("RHeight")),a=this._customInputValidation(this._getTableObj("ClWidth"));this._customTableValidation||(o.css({width:h,height:c,cellPadding:this._getTableObj("CellPad").data("ejNumericTextbox").getValue(),cellSpacing:this._getTableObj("CellSpace").data("ejNumericTextbox").getValue(),float:f,"border-width":this._getTableObj("BrdrPx").data("ejNumericTextbox").getValue()+"px","border-style":this._getTableObj("_border_style").data("ejDropDownList").getSelectedValue(),"border-color":this._getTableObj("_border_color").val()}),s=n(i).closest("tr"),s.attr({style:this._getTableObj("RStyle").val()}).css({height:l,"text-align":this._getTableObj("RAlign").data("ejDropDownList").getSelectedValue(),"border-width":this._getTableObj("RBrdrPx").data("ejNumericTextbox").getValue()+"px","border-style":this._getTableObj("RBrdrStyle").data("ejDropDownList").getSelectedValue(),"border-color":this._getTableObj("RBrdrColor").val()}),n(i).attr({style:this._getTableObj("ClStyle").val()}).css({width:a,"text-align":this._getTableObj("ClAlign").data("ejDropDownList").getSelectedValue(),"border-width":this._getTableObj("ClBrdrPx").data("ejNumericTextbox").getValue()+"px","border-style":this._getTableObj("ClBrdrStyle").data("ejDropDownList").getSelectedValue(),"border-color":this._getTableObj("ClBrdrColor").val()}),this._eTblDialog.ejDialog("close"));this._on(this._getTableObj("Width"),"keypress",this._urlValidation)._on(this._getTableObj("Height"),"keypress",this._urlValidation)._on(this._getTableObj("RHeight"),"keypress",this._urlValidation)._on(this._getTableObj("ClWidth"),"keypress",this._urlValidation)},_clearAllManager:function(){this._hideTooltip();this._alertWindow.find(".e-alert-cancel").show();this._alertHeader(this);this._openAlert(this._getLocalizedLabels("deleteAlert"))},_onUnlink:function(){var n;this.executeCommand("unlink",n);this.disableToolbarItem("removeLink")},_onSuperScript:function(){var n;this._isIE8()?this.executeCommand("SuperScript",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.superscript,null),this._trigger("execute",{commandName:"SuperScript"}))},_onSubScript:function(){var n;this._isIE8()?this.executeCommand("SubScript",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.subscript,null),this._trigger("execute",{commandName:"SubScript"}))},_onInsertTable:function(i,r,u){if(this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length){n(this._getDocument().body).css("display","inline-block");var f=this._tableGenerator(i,r,u);this.executeCommand("inserthtml",f);(t.isNullOrUndefined(n(this._getDocument().body).find("table:last")[0].nextSibling)||n(this._getDocument().body).find("table:last")[0].nextSibling.nodeName.toLowerCase()=="#text"&&n.trim(n(this._getDocument().body).find("table:last")[0].nextSibling.nodeValue)=="\n")&&n("<p><br/><\/p>").insertAfter(n(this._getDocument().body).find("table"));n(this._getDocument().body).css("display","");this._setAutoHeight()}},_onUpperCase:function(){if(this._isIE8())if(document.getSelection){var a=this._getWindow().getSelection(),i=this._saveSelection(),r=i.commonAncestorContainer,f=i.commonAncestorContainer.children;if(f!=null){var e=i.cloneContents(),o=this._changeCase(e,"Upper"),s=n(o).clone(),u=document.createElement("div");n(u).append(n(s));u.innerHTML!=null&&u.innerHTML!=""&&this._getWindow().document.execCommand("inserthtml",!1,u.innerHTML)}else{var h=r.nodeValue.substring(i.startOffset,i.endOffset).toUpperCase(),c=r.nodeValue.substr(0,i.startOffset),l=r.nodeValue.substring(i.endOffset);r.nodeValue=c+h+l}}else{if(this._getWindow().document.selection.type.toLowerCase()=="control")return;this._seleText=t.isNullOrUndefined(this._seleText)?"":this._seleText;this._getDocument().selection.createRange().pasteHTML(this._seleText.toUpperCase())}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.uppercase,null);this._trigger("execute",{commandName:"uppercase"})},_changeCase:function(n,t){var i=n.childNodes,r;if(i.length>0)for(r=0;r<i.length;r++)i[r].nodeType==3?i[r].nodeValue=t=="Upper"?i[r].nodeValue.toUpperCase():i[r].nodeValue.toLowerCase():i[r].nodeType==1&&i[r].tagName.toUpperCase()!="FONT"&&this._changeCase(i[r],t);return i},_onLowerCase:function(){if(this._isIE8())if(document.getSelection){var a=this._getWindow().getSelection(),i=this._saveSelection(),r=i.commonAncestorContainer,f=i.commonAncestorContainer.children;if(f!=null){var e=i.cloneContents(),o=this._changeCase(e,"Lower"),s=n(o).clone(),u=document.createElement("div");n(u).append(n(s));u.innerHTML!=null&&u.innerHTML!=""&&this._getWindow().document.execCommand("inserthtml",!1,u.innerHTML)}else{var h=r.nodeValue.substring(i.startOffset,i.endOffset).toLowerCase(),c=r.nodeValue.substr(0,i.startOffset),l=r.nodeValue.substring(i.endOffset);r.nodeValue=c+h+l}}else{if(this._getWindow().document.selection.type.toUpperCase()=="control")return;this._seleText=t.isNullOrUndefined(this._seleText)?"":this._seleText;this._getDocument().selection.createRange().pasteHTML(this._seleText.toLowerCase())}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.lowercase,null);this._trigger("execute",{commandName:"lowercase"})},_listIndent:function(n){var i,r;return(i=n.previousSibling,i&&this._isListNode(i))?(i.appendChild(n),!0):i&&i.nodeName=="LI"&&this._isListNode(i.lastChild)?(i.lastChild.appendChild(n),this._combineLists(n.lastChild,i.lastChild,n),!0):(i=n.nextSibling,i&&this._isListNode(i))?(i.insertBefore(n,i.firstChild),!0):i&&i.nodeName=="LI"&&this._isListNode(n.lastChild)?!1:(i=n.previousSibling,i&&i.nodeName=="LI")?(r=t.buildTag(n.parentNode.nodeName)[0],i.appendChild(r),r.appendChild(n),this._combineLists(n.lastChild,r,n),!0):!0},_combineLists:function(t,i,r){var u;if(this._isListNode(t)){while(u=r.lastChild.firstChild)i.appendChild(u);n(t).remove()}},_isListNode:function(n){return n&&/^(OL|UL)$/.test(n.nodeName)},_isFirstChild:function(n){return n.parentNode.firstChild==n},_isLastChild:function(n){return n.parentNode.lastChild==n},_removeEmptyList:function(t){t&&n(t).children().length===0&&n(t).remove()},_listOutdent:function(t){var r=n(t.parentNode),i=r[0].parentNode;return(t=n(t),this._isFirstChild(t[0])&&this._isLastChild(t[0]))?(i.nodeName=="LI"?(t.insertAfter(i),this._removeEmptyList(i),r.remove()):this._isListNode(i)?r.remove():this.executeCommand("outdent",!1),!0):this._isFirstChild(t[0])?(i.nodeName=="LI"?(t.insertAfter(i),t[0].appendChild(r[0]),this._removeEmptyList(i)):this._isListNode(i)?i.insertBefore(t[0],r[0]):this.executeCommand("outdent",!1),!0):this._isLastChild(t[0])?(i.nodeName=="LI"?t.insertAfter(i):this._isListNode(i)?t.insertAfter(r[0]):this.executeCommand("outdent",!1),!0):(this.executeCommand("outdent",!1),!1)},_updateIndent:function(i){t.isNullOrUndefined(this._toolBarObj)||(n("#"+this._rteId+"_indent").hasClass("e-disable")&&this._toolBarObj.enableItemByID(this._rteId+"_indent"),i&&/^(LI)$/.test(i.nodeName)&&n(i).parents(i.parentNode.nodeName).last().find("li").index(i)===0&&this._toolBarObj.disableItemByID(this._rteId+"_indent"))},_updateCount:function(){t.isNullOrUndefined(this.model)||(this.model.showFooter&&this.model.showWordCount&&(this._wordCount.html(this._getLocalizedLabels("words")+" : "+(n.trim(this._getText())!=""?n.trim(this._getText()).split(/\W+/).length:0)),this._rteFooter.width()<400&&this._wordCount.html(this._getLocalizedLabels("w")+" : "+(n.trim(this._getText())!=""?n.trim(this._getText()).split(/\W+/).length:0))),this.model.showFooter&&this.model.showCharCount&&(this._charCount.html(this._getLocalizedLabels("characters")+" : "+this._getText().length),this._rteFooter.width()<400&&this._charCount.html(this._getLocalizedLabels("c")+" : "+this._getText().length)))},_updateTagInfo:function(i){var f="",e,o=1,r,u;if(t.isNullOrUndefined(i)||(i.localName=="body"||i.localName=="html")&&(i=this._getSelectedNode()),this._curNode=t.isNullOrUndefined(i)?"":i.tagName?i.tagName.toLowerCase():"html",this.model.showFooter&&this.model.showHtmlTagInfo){if(this._curNode!="html"&&this._curNode!==""){for(r=n(i).parents(),u=r.length-1;u>=0;u--)e=r[u].tagName.toLowerCase(),e!="html"?f+=" » "+e:o++;f+=" » "+this._curNode;n(i).parents().length>0&&(t.isNullOrUndefined(r[r.length-o])||(this._pTag=r[r.length-o].tagName.toLowerCase()))}this._tags=f;this._responsiveTagList()}},_responsiveTagList:function(){n(this._htmlInfo).html(this._tags);n(this._rteWapper).outerWidth()<n(this._rteWapper).find(".e-rte-footer-left").outerWidth()+n(this._rteWapper).find(".e-rte-footer-right").outerWidth()?n(this._htmlInfo).html(" » "+this._pTag+" » ... ... » "+this._curNode):n(this._htmlInfo).html(this._tags)},_removeNoSpaceChar:function(n){return n&&(n=n.replace(/[\uFEFF]/g,"")),n},_updateValue:function(){var n=this._removeNoSpaceChar(this._updateXhtml());this.model.enableHtmlEncode&&(n=this._encode(this._decode(n)));this.value(n);this.element.val(n)},_imageXhtml:function(n){for(var v=/<img(.*?)>/ig,c,u=0,i=[],o,r,f;(c=v.exec(n))!==null;)i.push(c[0].toString());for(o=[],o=i.slice(0),r=0;r<i.length;r++)i[r].indexOf("/")==-1?i[r]=i[r].substr(0,i[r].length)+"/"+i[r].substr(i[r].length-1,i[r].length):i[r].lastIndexOf("/")!=i[r].length-2&&(i[r]=i[r].substr(0,i[r].length-1)+"/"+i[r].substr(i[r].length-1,i[r].length));var l=/(alt)=("[^"]*")/i,e=/(src)=("[^"]*")/g,a=/(src)=('[^"]*')/g;for(r=0;r<i.length;r++){var y=t.isNullOrUndefined(l.exec(i[r]))?/(alt)=('[^"]*')/i.exec(i[r]):l.exec(i[r]),p=t.isNullOrUndefined(e.exec(i[r]))?a.exec(i[r]):e.exec(i[r]),s=t.isNullOrUndefined(i[r].match(e))?i[r].match(a):i[r].match(e),h=t.isNullOrUndefined(i[r].match(/(alt)=("[^"]*")/g))?i[r].match(/(alt)=('[^"]*')/g):i[r].match(/(alt)=("[^"]*")/g);if(y==null&&h==null)i[r]=i[r].substr(0,i[r].length-2)+' alt=""'+i[r].substr(i[r].length-2,i[r].length);else for(u=h.length-1;u>0;u--)i[r]=i[r].replace(h[u],"");if(p==null&&s==null)i[r]=i[r].substr(0,i[r].length-2)+' src=""'+i[r].substr(i[r].length-2,i[r].length);else for(u=s.length-1;u>0;u--)i[r]=i[r].replace(s[u],"")}for(f=0;f<i.length;f++)n=n.replace(o[f],i[f]);return n},_tagCssReplace:function(n,i,r){var f=/(style)=("[^"]*")/i.exec(i),u;if(f!=null)return u=f[0],n!=""&&(u=u.substr(0,u.length-1)+n+';"'),t.isNullOrUndefined(n)||(i=i.replace(r[0],"").replace(f[0],u)),i},_updateIndentStatus:function(){this._isIE8()?n(this._getSelectedNode()).closest("BLOCKQUOTE").length>0?this.enableToolbarItem("outdent"):this.disableToolbarItem("outdent"):this._getDocumentHandler()&&this._operationHandler._validateIndent(this._getRange().startContainer)?this.enableToolbarItem("outdent"):this.disableToolbarItem("outdent")},_replaceHeightWidth:function(n,i){var u=n.exec(i),r;return t.isNullOrUndefined(u)||(r=u[0],r=r.replace(/\"/gi,"").replace("=",":")),this._tagCssReplace(r,i,u)},_typeXhtmlValidation:function(){var n=styleRegval[0];n=n=='type="a"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("a","lower-alpha"):n=='type="A"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("A","upper-alpha"):n=='type="1"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("1","decimal"):n=='type="i"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("i","lower-roman"):n=='type="I"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("I","upper-roman"):n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type")},_getCssXhtml:function(n,i){var u=n.exec(i),r;return t.isNullOrUndefined(u)||(r=u[0],r=r.replace(/\"/gi,"").replace("=",":").replace("valign","text-align").replace("align","text-align"),i=i.replace(u[0],'style="'+r+';"')),i},_styleXhtml:function(n){for(var v=/<((?:(?!\/)).)*?>/ig,a,r=[],c,u,f,e,o,s,l,h,i;(a=v.exec(n))!==null;)r.push(a[0].toString());for(c=[],c=r.slice(0),i=0;i<r.length;i++){if(r[i].indexOf("style=")!=-1){if(r[i].indexOf("height=")!=-1&&(e=/( height)=("[^"]*")/i,r[i]=this._replaceHeightWidth(e,r[i])),r[i].indexOf("width=")!=-1&&(o=/( width)=("[^"]*")/i,r[i]=this._replaceHeightWidth(o,r[i])),r[i].indexOf("type=")!=-1&&(s=/( type)=("[^"]*")/i,u=s.exec(r[i]),t.isNullOrUndefined(u)||(f=this._typeXhtmlValidation(r[i])),r[i]=this._tagCssReplace(f,r[i],u)),r[i].indexOf("valign=")!=-1){var l=/( valign)=("[^"]*")/i,u=l.exec(r[i]),f=u[0];f=r[i].indexOf("vertical-align:")!=-1?"":f.replace(/\"/gi,"").replace("=",":").replace("valign","vertical-align");r[i]=this._tagCssReplace(f,r[i],u)}r[i].indexOf("align=")!=-1&&(h=/( align)=("[^"]*")/i,u=h.exec(r[i]),t.isNullOrUndefined(u)||(f=u[0],f=r[i].indexOf("text-align:")!=-1?"":f.replace(/\"/gi,"").replace("=",":").replace("align","text-align")),r[i]=this._tagCssReplace(f,r[i],u))}r[i].indexOf("style=")==-1&&(r[i].indexOf("height=")!=-1&&(e=/(height)=("[^"]*")/i,r[i]=this._getCssXhtml(e,r[i])),r[i].indexOf("width=")!=-1&&(o=/(width)=("[^"]*")/i,r[i]=this._getCssXhtml(o,r[i])),r[i].indexOf("type=")!=-1&&(s=/( type)=("[^"]*")/i,r[i]=this._getCssXhtml(s,r[i])),r[i].indexOf("valign=")!=-1&&(l=/(valign)=("[^"]*")/i,r[i]=this._getCssXhtml(l,r[i])),r[i].indexOf("align=")!=-1&&(h=/(align)=("[^"]*")/i,r[i]=this._getCssXhtml(h,r[i])))}for(i=0;i<r.length;i++)n=n.replace(c[i],r[i]);return n},_getFormatXhtml:function(n,t){for(var r=[],u,i;(u=n.exec(t))!=null;)r.push(u[0]);for(i=0;i<r.length;i++)t=t.replace(r[i],"")},_startXhtml:function(n){if(n.indexOf("start=")!=-1)n=this._getFormatXhtml(/start=\"(.*?)\"/ig,n);return n},_fontXhtml:function(n){if(n.indexOf("<font")!=-1)n=this._getFormatXhtml(/<font(.*?)>/ig,n);return n},_filerXhtmlNode:function(n,t){for(var i=[],r;(r=n.exec(t))!=null;)i.push(r[0]);return i},_replaceXhtmlNode:function(n,t,i){for(var r=0;r<n.length;r++)t=t.replace(i[r],n[r]);return t},_tdXhtml:function(n){var t=[],r,i,u;for(t=this._filerXhtmlNode(/<td((?:(?!<\/td>).))*?<td/ig,n),r=[],r=t.slice(0),i=0;i<t.length;i++)u=t[i].lastIndexOf("<td"),t[i]=t[i].substr(0,u)+"<\/td>"+t[i].substr(u,t[i].length);return this._replaceXhtmlNode(t,n,r)},_ptagXhtml:function(n){var f=/<\/p>((?:(?!<p).))*<\/p>/ig,r,i=[],u,t;if((r=f.exec(n))!=null)while((r=f.exec(n))!=null)i.push(r[0]);for(u=[],u=i.slice(0),t=0;t<i.length;t++)i[t].indexOf("<p")==-1&&(i[t]=i[t].substr(0,i[t].length-4));for(t=0;t<i.length;t++)n=n.replace(u[t],i[t]);return n},_getUpdaeNodeXhtml:function(n,t,i){for(var r;(r=n.exec(t))!=null;)i.push(r[0]);return i},_replaceUpdateXhtml:function(n,t,i){for(var r=[],r=this._getUpdaeNodeXhtml(n,t,r),u=0;u<r.length;u++)t=t.replace(r[u],i);return t},_replaceXhtmlVal:function(n,t,i){for(var r=0;r<n.length;r++)t=t.replace(i[r],n[r]);return t},_replaceTagUpdateXhtml:function(n,t,i,r){var u=[],f;return u=this._getUpdaeNodeXhtml(n,t,u),f=[],f=u.slice(0),u[0]=i+u[0]+r,t.replace(f[0],u[0])},_replaceTagXHTML:function(n,t){var i=[],u,r;for(i=this._getUpdaeNodeXhtml(n,t,i),u=[],u=i.slice(0),r=0;r<i.length;r++)i[r]=i[r].replace(/<br\/>/gi,"");return this._replaceXhtmlVal(i,t,u)},_replaceInputParams:function(n,t){var i=[],u,r,f;for(i=this._getUpdaeNodeXhtml(n,t,i),u=[],u=i.slice(0),r=0;r<i.length;r++)f=i[r].indexOf(">"),i[r]=i[r].substr(0,f)+"/"+i[r].substr(f,i[r].length-1);return this._replaceXhtmlVal(i,t,u)},_updateXhtml:function(){var w=this._getDocument().body.innerHTML,n,b,et,ct,pt,p,lt,ft,u,k,st,wt,d,at,rt,i,s,l,ot,g,v,ht,nt,o,h,bt,kt,a,vt,dt,c,gt,f,y,tt,it,e,yt,r;if(this.model.enableXHTML){if(w=w.replace(/hhh/g,"").replace(/<br>/g,"<br/>").replace(/contenteditable="false"/g,"").replace(/contenteditable="true"/g,"").replace(/ /g," ").replace(/<hr>/g,"<hr/>").replace(/cellspacing =[0-9]/g,"").replace(/cellpadding =[0-9]/g,""),this.value(w),this._xhtmlTagValidation(),w=this.value(),n=w.replace(/\s+/g," ").replace(/> </gi,"><"),n.indexOf("<?xml")!=-1)for(var ni=/<?xml:(.*?)>/ig,ut=[],b=0;(xmlTemp=ni.exec(n))!=null;)f=n.indexOf("<?xml"),ut[b]=xmlTemp[0],ut[b]=n.substr(f,ut[b].length+2),n=n.replace(ut[b],""),b++;if(n.indexOf("<table")!=-1){for(ft=/<table(.*?)<\/table>/ig,u=[],u=this._getUpdaeNodeXhtml(ft,n,u),k=[],k=u.slice(0),r=0;r<u.length;r++)if(u[r]=u[r].replace(/<p>/gi,"").replace(/<\/p>/gi,""),u[r].indexOf("<p")!=-1)for(b=0;b<u[r].length;b++)if(et=u[r].indexOf("<p"),ct=0,et!=-1)for(f=et+4;f<u[r].length-7;f++)u[r].charAt(f)==">"&&ct==0&&(u[r]=u[r].substr(0,et)+u[r].substr(f+1,u[r].length-1),ct++);n=this._replaceXhtmlVal(u,n,k)}if(n.indexOf("<td")!=-1)for(r=0;r<2;r++)n=this._tdXhtml(n);if(n.indexOf("<tr")!=-1){for(pt=/<tr(.*?)>(?!<\/td>)/ig,p=[],p=this._getUpdaeNodeXhtml(pt,n,p),lt=[],lt=p.slice(0),r=0;r<p.length;r++)p[r].indexOf("<\/td>")!=-1&&(p[r]=p[r].replace("<\/td>",""));for(n=this._replaceXhtmlVal(p,n,lt),ft=/<tr(.*?)<\/tr>/ig,u=[],u=this._getUpdaeNodeXhtml(ft,n,u),k=[],k=u.slice(0),r=0;r<u.length;r++)h=u[r].lastIndexOf("<\/tr>"),ot=u[r].charAt(h-5)+u[r].charAt(h-4)+u[r].charAt(h-3)+u[r].charAt(h-2)+u[r].charAt(h-1),ot!="<\/td>"&&(u[r]=u[r].substr(0,h)+"<\/td>"+u[r].substr(h,u[r].length));n=this._replaceXhtmlVal(u,n,k)}if(n.indexOf("<input")!=-1&&(st=/<input((?:(?!\/).))*?>/ig,n=this._replaceInputParams(st,n),n=n.replace(/<\/input>/gi,"")),n.indexOf("<param")!=-1&&(st=/<param((?:(?!\/).))*?>/ig,n=this._replaceInputParams(st,n),n=n.replace(/<\/param>/gi,"")),n.indexOf("<p ")!=-1||n.indexOf("<p>")!=-1){if(wt=/<p(.*)<\/p>/ig,d=[],d=this._getUpdaeNodeXhtml(wt,n,d),at=[],at.slice(0),rt=d[0].length-1,i=d[0],i.indexOf("<p")!=-1)for(s=i.indexOf("<p");s<=rt;s++)if(h="",r=0,s<rt-3&&(h=i.charAt(s)+i.charAt(s+1)),h=="<p")for(l=s+1;l<=rt;l++)if((ot=i.charAt(l)+i.charAt(l+1)+i.charAt(l+2)+i.charAt(l+3))=="<\/p>"&&r++,(ot=i.charAt(l)+i.charAt(l+1))=="<p"){if(r==0&&i.indexOf("<div")!=-1&&(g=i.substr(s,l-s),g.indexOf("<div")!=-1)){for(v=g.indexOf("<div"),ht=0,o=s+v+1;o<i.length-1;o++)h=i.charAt(o)+i.charAt(o+1)+i.charAt(o+2)+i.charAt(o+3)+i.charAt(o+4)+i.charAt(o+5),h=="<\/div>"&&ht==0&&(nt=o);i=i.substr(0,s+v)+"<\/span><\/p>"+i.substr(s+v,-(s+v)+nt+6)+"<p><span>"+i.substr(nt+6,i.length-1);r++}if(r==0){if(i.indexOf("<table")!=-1&&(g=i.substr(s,l-s),g.indexOf("<table")!=-1)){for(v=g.indexOf("<table"),ht=0,o=s+v+1;o<i.length-1;o++)h=i.charAt(o)+i.charAt(o+1)+i.charAt(o+2)+i.charAt(o+3)+i.charAt(o+4)+i.charAt(o+5)+i.charAt(o+6)+i.charAt(o+7),h=="<\/table>"&&ht==0&&(nt=o);i=i.substr(0,s+v)+"<\/span><\/p>"+i.substr(s+v,-(s+v)+nt+8)+"<p><span>"+i.substr(nt+8,i.length-1);r++}r==0&&(i=i.substr(0,l-1)+"<\/p>"+i.substr(l,i.length-1),rt++,r++)}}for(i=i.replace(/<\/p><\/p>/gi,"<\/p>"),bt=[],bt=d.slice(0),r=0;r<2;r++)i=this._ptagXhtml(i);for(kt=/<p(.*?)<\/p>/ig,a=[],a=this._getUpdaeNodeXhtml(kt,i,a),vt=[],vt.slice(0),f=0;f<a.length;f++)a[f].indexOf("<table")!=-1&&(y=/<table(.*)<\/table>/ig,a[f]=this._replaceTagUpdateXhtml(y,a[f],"<\/span><\/p>","<p><span>")),a[f].indexOf("<div")!=-1&&(y=/<div(.*)<\/div>/ig,a[f]=this._replaceTagUpdateXhtml(y,a[f],"<\/span><\/p>","<p><span>"));i=this._replaceXhtmlVal(a,i,vt);n=n.replace(at[0],i)}if(n.indexOf("<span")!=-1){for(dt=/<span(.*?)<\/span>/ig,c=[],c=this._getUpdaeNodeXhtml(dt,n,c),gt=[],sapnEX=c.slice(0),f=0;f<c.length;f++)c[f].indexOf("<table")!=-1&&(y=/<table(.*)<\/table>/ig,c[f]=this._replaceTagUpdateXhtml(y,c[f],"<\/span>","<span>")),c[f].indexOf("<div")!=-1&&(y=/<div(.*)<\/div>/ig,c[f]=this._replaceTagUpdateXhtml(y,c[f],"<\/span>","<span>")),c[f].indexOf("<p")!=-1&&(y=/<p(.*)<\/p>/ig,c[f]=this._replaceTagUpdateXhtml(y,c[f],"<\/span>","<span>"));n=this._replaceXhtmlVal(c,n,gt)}if(n.indexOf("<ol")!=-1&&(tt=/<ol(.*?)<\/ol>/ig,n=this._replaceTagXHTML(tt,n)),n.indexOf("<table")!=-1&&(tt=/<table(.*?)><\/table>/ig,n=this._replaceTagXHTML(tt,n)),n.indexOf("style")!=-1&&(tt=/style="(.*?)"/ig,n=this._replaceTagXHTML(tt,n)),t.isNullOrUndefined(this._fontXhtml(n))||(n=this._fontXhtml(n)),(n.indexOf("<br ")!=-1||n.indexOf("<br>")!=-1)&&(e=/<br(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"<br/>")),(n.indexOf("<strong ")!=-1||n.indexOf("<strong>")!=-1)&&(e=/<strong((?:(?!r).))*?>/ig,n=this._replaceUpdateXhtml(e,n,"<b>").replace(/<\/strong>/gi,"<\/b>")),n.indexOf("<strong ")!=-1&&(e=/<strong (.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"<b>").replace(/<\/strong>/gi,"<\/b>")),n.indexOf("<u")!=-1&&(e=/<u((?:(?!l).))*?>/ig,n=this._replaceUpdateXhtml(e,n,'<span style="text-decoration: underline;">').replace(/<\/u>/gi,"<\/span>")),n.indexOf("<hr")!=-1&&(e=/<hr(.*?)>/ig,it=[],n=this._replaceUpdateXhtml(e,n,"<hr/>")),t.isNullOrUndefined(this._startXhtml(n))||(n=this._startXhtml(n)),n.indexOf("v:shapes=")!=-1&&(e=/v:shapes=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("v:")!=-1&&(e=/<v:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("/v:")!=-1&&(e=/<\/v:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("o:")!=-1&&(e=/<o:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("/o:")!=-1&&(e=/<\/o:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("role=")!=-1&&(e=/role=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("target=")!=-1&&(e=/target=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("language=")!=-1&&(e=/language=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("lang=")!=-1)for(e=/lang=\"(.*?)\"/ig,it=this._getUpdaeNodeXhtml(e,n,it),yt=[],yt=it.slice(0),r=0;r<it.length;r++)n=n.replace(yt[r],it[r].toLowerCase());n=n.replace(/<\/td><\/td>/gi,"<\/td>").replace(/<\/th><\/td>/gi,"<\/th>");n=n==""||/<div class="e-xhtml">/ig.test(n)?n:"<div class='e-xhtml'>"+n+"<\/div>";w=n.replace(/"/g,"'").replace(/cellspacing=("[0-9]")/g,"").replace(/cellSpacing=("[0-9]")/g,"").replace(/cellpadding=("[0-9]")/g,"").replace(/cellPadding=("[0-9]")/g,"").replace(/border=("[^"]")/g,"").replace(/<!--(.*?)-->/gm,"").replace(/(vAlign)=("[^"]*")/g,"").replace(/(valign)=("[^"]*")/g,"").replace(/(colspan)=("[^"]*")/g,"").replace(/(colSpan)=("[^"]*")/g,"");this.value(w)}return w},_setClearFormat:function(){var n=this._rteToolbar.find(".e-active").length},_updateToolbarStatus:function(){var i,t;try{if(i=!1,this.model.showToolbar){for(t=0;t<this._styleItems.length;t++)this._getCommandStatus(n.trim(this._styleItems[t].toLowerCase()))?(this._toolBarObj.selectItemByID(this._rteId+"_"+this._styleItems[t]),n("#"+this._rteId+"_"+this._styleItems[t]).addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_"+this._styleItems[t]),n("#"+this._rteId+"_"+this._styleItems[t]).removeClass("e-isactive"));for(t=0;t<this._alignItems.length;t++)this._getCommandStatus(n.trim(this._alignItems[t].toLowerCase()))?(this._toolBarObj.selectItemByID(this._rteId+"_"+this._alignItems[t]),i=!0):this._toolBarObj.deselectItemByID(this._rteId+"_"+this._alignItems[t]);for(i||this._toolBarObj.selectItemByID(this._rteId+"_justifyLeft"),t=0;t<this._scriptsItems.length;t++)this._getCommandStatus(n.trim(this._scriptsItems[t].toLowerCase()))?(this._toolBarObj.selectItemByID(this._rteId+"_"+this._scriptsItems[t]),n("#"+this._rteId+"_"+this._scriptsItems[t]).addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_"+this._scriptsItems[t]),n("#"+this._rteId+"_"+this._scriptsItems[t]).removeClass("e-isactive"));this._getCommandStatus("InsertOrderedList")?(this._toolBarObj.selectItemByID(this._rteId+"_orderedList"),n("#"+this._rteId+"_orderedList").addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_orderedList"),n("#"+this._rteId+"_orderedList").removeClass("e-isactive"));this._getCommandStatus("InsertUnorderedList")?(this._toolBarObj.selectItemByID(this._rteId+"_unorderedList"),n("#"+this._rteId+"_unorderedList").addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_unorderedList"),n("#"+this._rteId+"_unorderedList").removeClass("e-isactive"));this._updateIndentStatus()}}catch(r){}},_updateFormat:function(){try{if(this._formatDDL&&this.model.showToolbar&&!t.isNullOrUndefined(this.model.tools.formatStyle)){var i=n.trim(this._getCommandValue("formatblock").replace(/'/g,""));if(this._isIE())switch(i){case"Heading 6":i="<h6>";break;case"Heading 5":i="<h5>";break;case"Heading 4":i="<h4>";break;case"Heading 3":i="<h3>";break;case"Heading 2":i="<h2>";break;case"Heading 1":i="<h1>"}else i="<"+i+">";this._formatDDL.hasClass("e-dropdownlist")&&(t.isNullOrUndefined(i)||i==""?this._formatDDL.ejDropDownList({value:this._getLocalizedLabels("format")}):!n(this._formatDDL).parents("ul.e-rte-format").length==0&&this._formatDDL.ejDropDownList("setSelectedValue",i))}}catch(r){}},_updateFontOptionStatus:function(){var i,r;try{this.model.showFontOption&&this.model.showToolbar&&!t.isNullOrUndefined(this.model.tools.font)&&(i=n.trim(this._getCommandValue("fontname").replace(/"/g,"").replace(/'/g,"").replace(/, /g,",")),(t.isNullOrUndefined(i)||i=="")&&(i="Segoe UI"),!t.isNullOrUndefined(this._fontStyleDDL)&&this._fontStyleDDL.hasClass("e-dropdownlist")&&!n(this._fontStyleDDL).parents("ul.e-rte-fontgroup").length==0&&this._fontStyleDDL.ejDropDownList("setSelectedValue",i),r=this._isIE8()?this._getCommandValue("fontsize"):this._getDocumentHandler()&&this._operationHandler._validateFontSize(this._getRange().startContainer),(t.isNullOrUndefined(r)||r=="")&&(r=2),!t.isNullOrUndefined(this._fontSizeDDL)&&this._fontSizeDDL.hasClass("e-dropdownlist")&&!n(this._fontSizeDDL).parents("ul.e-rte-fontgroup").length==0&&this._fontSizeDDL.ejDropDownList("setSelectedValue",r))}catch(u){}},_getSelText:function(){var n="",r,t,i;return this._isIE()?n=this._seleText:window.getSelection?(r=this._getWindow().getSelection(),i=this._saveSelection(),t=document.createTextNode(i.toString()),n=t.nodeValue):document.getSelection&&(n=this._getWindow().document.getSelection()),n},_isIE:function(){var n=!1,i=t.browserInfo();return i.name=="msie"&&(n=!0),n},_isIE8:function(){var n=!1,i=t.browserInfo();return i.name=="msie"&&i.version=="8.0"&&(n=!0),n},_isUrl:function(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)},_pasteHtml:function(t,i){var e,r,l,h,o,a,c,f,v,s,u,y,p;if(this._pasteAPIFlag?this._isIE()&&this._focus():this._focus(),window.getSelection){if(e=this._getWindow().getSelection(),e.getRangeAt&&e.rangeCount){for(r=this._pasteFlag?this._pasteRangeVal:e.getRangeAt(0),l=r.commonAncestorContainer,h=l.nodeType==3?n(l).parentsUntil("body"):n(l).children(),u=h.length-1;u>=0;u--)if(h[u].textContent==r.toString()&&h[u].nodeName.toLowerCase()!="li"){r.selectNode(h[u]);break}if(r.deleteContents(),o=document.createElement("div"),o.innerHTML=t,a=this._getDocument().createDocumentFragment(),v=o.firstChild,this._pasteFlag||this._pasteAPIFlag){while(c=o.firstChild)v!=c?f=v.appendChild(c):o.removeChild(o.firstChild);f=a.appendChild(v)}else while(c=o.firstChild)f=a.appendChild(c);r.insertNode(a);f&&!i?(r=r.cloneRange(),r.setStartAfter(f),r.collapse(!0),e.removeAllRanges(),e.addRange(r)):(r=this.createRange(),r.setStart(f,f.data.length),r.setEnd(f,f.data.length),e.removeAllRanges(),e.addRange(r))}}else if(this._getDocument().selection&&this._getDocument().selection.type!="Control")if(!this._ieSelectionRange||this._ieSelectionRange.offsetLeft==0&&this._ieSelectionRange.offsetTop==0&&this._ieSelectionRange.boundingHeight==0)this._getDocument().body.insertAdjacentHTML("afterBegin",t);else if(this._pasteFlag&&this.selectRange(this._pasteRangeVal),s=this._ieParents(this._getRange()),y=!1,this._pasteAPIFlag)this._getRange().pasteHTML(t);else{for(p=this._getRange().text,u=s.length-1;u>=0;u--)if(s[u].innerText==p&&s[u].nodeName.toLowerCase()!="li"){s[u].nodeName=="BODY"?s[u].innerHTML=t:s[u].outerHTML=t;y=!0;break}y||this._getRange().pasteHTML(t)}this._pasteAPIFlag=this._pasteFlag=!1},_ieParents:function(n){var t=[];for(rangeval=this._isIE8()?n.duplicate():n.cloneRange(),n.parentElement=rangeval.parentElement();n.parentElement.nodeName!="HTML";){if(n.parentElement.nodeName=="TD"||n.parentElement.nodeName=="TH")break;t.push(n.parentElement);n=n.parentElement}return t},_getLocalizedLabels:function(n){return this._localizedLabels[n]===r?t.RTE.Locale["en-US"][n]:this._localizedLabels[n]},_getSelectedNode:function(){var u=this._getRange(),i,n=this._ieSelectionRange&&u.offsetLeft==0&&u.offsetTop==0&&u.boundingHeight==0?this._ieSelectionRange:u,t=n.startContainer,r=n.endContainer,f=n.startOffset,e=n.endOffset;return n?n.setStart?(i=n.commonAncestorContainer,!n.collapsed&&(t==r&&e-f<2&&t.hasChildNodes()&&(i=t.childNodes[f]),t.nodeType===3&&r.nodeType===3&&(t=t.length===f?this._skipEmptyNode(t.nextSibling,!0):t.parentNode,r=e===0?this._skipEmptyNode(r.previousSibling,!1):r.parentNode,t&&t===r)))?t:i&&i.nodeType==3?i.parentNode:i:n.item?n.item(0):n.parentElement():this._getDocument().selection},_skipEmptyNode:function(n,t){for(var i=n;n&&n.nodeType===3&&n.length===0;)n=t?n.nextSibling:n.previousSibling;return n||i},_getSelection:function(){var n;return this._isIE()?(n=this._getDocument().selection.createRange(),n.type=this._getDocument().selection.type):(n=window.getSelection(),n.rangeCount&&(sText=n.getRangeAt(0)),n.type=this._getWindow().getSelection().type),n},_saveSelection:function(){var i=this._getWindow(),r=i.document,n=i.getSelection?i.getSelection():r.selection,t,u;return n&&(n.createRange?t=n.createRange():n.rangeCount>0&&n.getRangeAt(0)?t=n.getRangeAt(0):n.anchorNode&&n.focusNode&&r.createRange?(t=r.createRange(),t.setStart(n.anchorNode,n.anchorOffset),t.setEnd(n.focusNode,n.focusOffset),t.collapsed!==n.isCollapsed&&(t.setStart(n.focusNode,n.focusOffset),t.setEnd(n.anchorNode,n.anchorOffset))):r.createRange()?(t=r.createRange(),t.setStart(i.document.body,0),t.setEnd(i.document.body,0)):(u=document.getElementsByTagName("iframe")[0],i=u.contentWindow,t=i.document.createRange(),t.setStart(i.document.body,0),t.setEnd(i.document.body,0))),t},_restoreSelection:function(n){var i=this._getWindow(),r=i.document,t=i.getSelection?i.getSelection():r.selection;t&&n&&(n.select?n.select():t.removeAllRanges&&t.addRange&&(t.removeAllRanges(),t.addRange(n)))},_getRange:function(){var i,u,f,r,n;if(this._isIE8())return i=this._saveSelection(),u=this._ieSelectionRange&&i.offsetLeft==0&&i.offsetTop==0&&i.boundingHeight==0?this._ieSelectionRange:i,u;if(this._isIE())return this._ieSelection=window.getSelection&&(t.isNullOrUndefined(this._selectionRange)?!1:this._selectionRange.length>0)?this._selectionRange:this._saveSelection();if(this._getWindow().getSelection()&&this._getWindow().getSelection().rangeCount>0)return this._getWindow().getSelection().getRangeAt(0);f=document.getElementsByTagName("iframe")[0];r=f.contentWindow;try{n=r.document.createRange();n.setStart(r.document.body,0);n.setEnd(r.document.body,0)}catch(e){n=this._getDocument().createRange();n.setStart(this._getDocument().body,0);n.setEnd(this._getDocument().body,0)}return n},_setBackupData:function(){var t=this.getHtml(),i=this._backupArray.length;i==this.model.undoStackLimit+1&&this._backupArray.splice(0,1);t!=this._backupArray[i-1]&&this.model.undoStackLimit>0&&this._backupArray.push(t);this._undoRedoPosition=this._backupArray.length-1;this.model.showToolbar&&this._rteToolbar.find("li.e-rteItem-undo")&&this._backupArray.length>1&&!n("#"+this._rteId+"_undo").hasClass("e-rteTooldisable")&&this._toolBarObj.enableItemByID(this._rteId+"_undo")},_getSelectedHtmlString:function(){var i,e,o,r,f,u,t,s;if(typeof document.selection!="undefined"&&this._isIE8()){for(i=this._ieParents(this._getRange()),e=!1,t=i.length-1;t>=0;t--)if(i[t].innerText==this._getRange().text){o=i[t].nodeName=="BODY"?i[t].innerHTML:i[t].outerHTML;e=!0;break}return e||(o=this._getRange().htmlText.substring(0,1)=="<"?this._getRange().text:this._getRange().htmlText),o}for(r=this._getRange(),f=r.commonAncestorContainer,u=f.nodeType==3?n(f).parentsUntil("body"):n(f).children(),t=u.length-1;t>=0;t--)if(u[t].textContent!=""&&u[t].textContent==r.toString()){r.selectNode(u[t]);break}return s=document.createElement("div"),s.appendChild(r.cloneContents()),s.innerHTML},_getText:function(){var n=this._getDocument().body;if(n!=null)return this._isIE()?n.innerText:n.textContent},_validateMaxLength:function(n){if(this.model.maxLength!=null){var t=this.model.maxLength,i=this._getText();t<=i.length&&(n.keyCode<47||n.ctrlKey&&n.keyCode==65||n.ctrlKey&&n.keyCode==67||n.ctrlKey&&n.keyCode==86||n.ctrlKey&&n.keyCode==88||(this._keypressFlag=!1,this._cancelEvent(n)))}},_cancelEvent:function(n){return n.returnValue=!1,n.stopPropagation(),n.preventDefault(),!1},_alignToolUpdate:function(n){for(var t=0;t<this._alignItems.length;t++)this._alignItems[t]===n?this._toolBarObj.selectItemByID(this._rteId+"_"+n):this._toolBarObj.deselectItemByID(this._rteId+"_"+this._alignItems[t])},_getCommandStatus:function(n){return this._getDocument().queryCommandState(n)},_getCommandValue:function(n){var i=this._getDocument().queryCommandValue(n),r;if(this._isIE()){if(n=="fontname"){for(r=0;r<this.model.fontName.length;r++)if(i==this.model.fontName[r].text){i=this.model.fontName[r].value;break}(t.isNullOrUndefined(i)||i=="")&&(i=this.model.fontName[0].value)}if(n=="formatblock"){for(r=2;r<this.model.format.length;r++)if(i==this.model.format[r].text){i=this.model.format[r].value;break}i=="Normal"&&(i=this.model.format[0].value)}}return i},_undo:function(){this._undoRedoPosition>0&&(this.model.enableHtmlEncode?this.setHtml(this._decode(this._backupArray[this._undoRedoPosition-1])):this.setHtml(this._backupArray[this._undoRedoPosition-1]),this._undoRedoPosition--,this._focus(),this._updateFontOptionStatus(),this._updateFormat(),this._updateCount(),this._toggleEditTable(),this.model.isResponsive&&this._toolBarObj._liTemplte.removeClass("e-display-none"),this._toolBarObj.enableItemByID(this._rteId+"_redo"));this._undoRedoPosition==0&&(this._toolBarObj.disableItemByID(this._rteId+"_undo"),this._toolBarObj.enableItemByID(this._rteId+"_redo"));this._updateToolbarStatus();this._trigger("execute",{commandName:"undo"})},_getRedoContent:function(){return this.model.enableHtmlEncode?this._decode(this._backupArray[this._undoRedoPosition+1]):this._backupArray[this._undoRedoPosition+1]},_redo:function(){var i,n;this._undoRedoPosition!=this._backupArray.length&&(this._backupArray[this._undoRedoPosition+1]!=null?(i=this._getRedoContent(),this.setHtml(i),this._undoRedoPosition++):(n=this._getRedoContent(),t.isNullOrUndefined(n)||this.setHtml(n),this._undoRedoPosition=this._backupArray.length-2),this._focus(),this._updateToolbarStatus(),this._updateFontOptionStatus(),this._updateFormat(),this._updateCount(),t.isNullOrUndefined(this._toolBarObj)||(this._backupArray.length-1>0&&this._toolBarObj.enableItemByID(this._rteId+"_undo"),this._undoRedoPosition==this._backupArray.length-1&&this._toolBarObj.disableItemByID(this._rteId+"_redo")));this._trigger("execute",{commandName:"redo"})},_setContent:function(n){var i=this._getDocument();i==""||t.isNullOrUndefined(i)||(i.open(),i.write(n),i.close(),i.EditMode=!0)},_removeResizeObject:function(){n(this._getDocument()).find(".e-rteColumnResizer , .e-rteRowResizer , .e-rteLastcolumn").remove()},_tableMouseOver:function(i){(i.target.nodeName=="TABLE"||t.browserInfo().name==="mozilla"&&i.target.nodeName=="TD")&&(this._curTable=i.target.nodeName=="TD"?n(i.target).closest("table")[0]:i.target,this._removeResizeObject(),n(this._getDocument()).find(".e-rte-tablebox").remove(),this._tableResizeObject(n(this._curTable)))},_preventDefaultResize:function(){var n=this._getDocument();t.browserInfo().name==="msie"&&t.browserInfo().version==="11.0"?n.body.addEventListener("mscontrolselect",this._ieDefaultTableHandler):this._isIE()&&n.body.attachEvent("oncontrolselect",this._ieTableHandler);t.browserInfo().name==="mozilla"&&(n.designMode="on",n.execCommand("enableObjectResizing",!1,"false"),n.execCommand("enableInlineTableEditing",!1,"false"))},_tableResizeObject:function(i){var f,r,u;for(this.model.allowEditing&&this._preventDefaultResize(),f=parseInt(n(i).attr("cellspacing")?n(i).attr("cellspacing"):0),this._newcol=i.find("tr:first td").not(":first"),this._newRow=i.find("tr td:nth-child(1)"),this._newlas=i.find("tr:first td:last"),r=0;this._newcol.length>r;r++)n(this._getDocument().body).after('<div class ="e-rteColumnResizer" unselectable="on" contenteditable="false" data-col ='+(r+1)+' style="top:'+n(this._newcol[r]).closest("table").offset().top+"px;left:"+n(this._newcol[r]).offset().left+"px;height:"+n(this._newcol[r]).closest("table").outerHeight()+"px;width:"+(5+f)+"px;margin-left: "+(-4-f)+'px;"><\/div>');for(r=0;this._newRow.length>r;r++)n(this._getDocument().body).after('<div class ="e-rteRowResizer" unselectable="on" contenteditable="false" data-row ='+r+' style="top:'+(n(this._newRow[r]).offset().top+n(this._newRow[r]).height())+"px;left:"+n(this._newRow[r]).offset().left+"px;width:"+n(this._newRow[r]).closest("table").width()+"px;height:"+(5+f)+'px;"><\/div>');n(this._getDocument().body).after('<div class ="e-rteColumnResizer e-rtelastcol" data-col ='+this._newcol.length+' contenteditable="false" style="top:'+n(this._newlas).closest("table").offset().top+"px;left:"+(n(this._newlas).offset().left+n(this._newlas).width())+"px;height:"+n(this._newlas).closest("table").outerHeight()+"px;width:"+(5+f)+'px;margin-left:3px;"><\/div>');this._botRigTab=t.buildTag("span.e-rte-tablebox e-rte-botrig","",{cursor:"nwse-resize",width:"5px",height:"5px",position:"absolute",display:"block",background:"#fff",border:"1px solid #000"},{});u=i.find("tr:last td:last:not(:has(>span.e-rte-tablebox))");u.length>0&&n(this._getDocument().body).after(n(this._botRigTab).css({left:parseInt(u.closest("table").width())+u.closest("table").offset().left+"px",top:parseInt(u.closest("table").height())+u.closest("table").offset().top+"px"}))},_ieDefaultTableHandler:function(n){n.preventDefault()},_ieTableHandler:function(){return!1},_tableCellStart:function(){this._tableInsertAt=this._saveSelection()},_tableCellSelect:function(i){var r,u=n(i.target),f=u.parent().index(),e=u.index();this._createTable.find("div.e-rte-tablecell").each(function(){r=n(this);r.index()<=e&&r.parent().index()<=f?r.addClass("e-active"):r.removeClass("e-active")});this._tblheaderDiv.html(e+1+"x"+(f+1)+this._getLocalizedLabels("table"));n(this._getDocument()).find("table.e-rte-tableremove").remove();t.isNullOrUndefined(this._tableInsertAt)||this._restoreSelection(this._tableInsertAt)},_tableCellLeave:function(){this._createTable.find("div.e-rte-tablecell").removeClass("e-active");n(this._getDocument()).find("table.e-rte-tableremove").remove();this._tblheaderDiv.html(this._getLocalizedLabels("createTable"))},_tableCellDown:function(i){var r=n(i.target),f=r.parent().index()+1,e=r.index()+1,u;this._focus();n(this._getDocument()).find("table.e-rte-tableremove").remove();t.isNullOrUndefined(this._tableInsertAt)||(this._restoreSelection(this._tableInsertAt),this._onInsertTable(f,e,!1));u=n(this._getDocument()).find("table.e-rte-table");this.model.enableRTL||this._on(u,"mouseover",this._tableMouseOver);this._createTable.ejDialog("close",{clickAction:!0});this._setBackupData();this._onChange();this.model.isResponsive&&!n(this._toolBarObj._liTemplte).hasClass("e-inline")&&(this._toolBarObj._liTemplte.addClass("e-display-none"),this._toolBarObj.contstatus=!1)},_tableGenerator:function(n,i,r,u,f,e,o,s,h,c){var l="e-rte-table";r&&(l+=" e-rte-tableremove");u=t.isNullOrUndefined(u)||u==""?"width:99%;":"width:"+u+";";f=t.isNullOrUndefined(f)||f==""?"":"height:"+f+";";e=t.isNullOrUndefined(e)||e==""?"":"cellspacing:"+e+";";o=t.isNullOrUndefined(o)||o==""?"":"cellpadding:"+o+";";s=t.isNullOrUndefined(s)?"":" float:"+s+";";switch(h){case"dotted":borderstyle="dotted";break;case"double":return this._border="style='border:3px double #5C5C5C;'",borderstyle="double","<table border='1' class='"+l+"' style='"+u+" "+f+" "+this._border+" "+e+" "+o+" "+s+"' >"+(c?"<caption><\/caption>":"")+Array(n+1).join("<tr>"+Array(i+1).join("<td><br _moz_dirty=''/><\/td>")+"<\/tr>")+"<\/table>";case"dashed":borderstyle="dashed";break;case"solid":borderstyle="solid";break;default:borderstyle="solid"}return borderstyle!="double"?(this._border="border:1px "+borderstyle+"#5C5C5C;","<table border='1' class='"+l+"' style='"+u+f+this._border+e+o+s+"' >"+(c?'<caption><br type="_moz"><\/caption>':"")+Array(n+1).join("<tr>"+Array(i+1).join("<td><br _moz_dirty=''/><\/td>")+"<\/tr>")+"<\/table>"):"<table border='1' class='"+l+"' style='border:1px solid #5C5C5C; "+u+f+e+o+s+"' >"+(c?'<caption><br type="_moz"><\/caption>':"")+Array(n+1).join("<tr>"+Array(i+1).join("<td><br _moz_dirty=''/><\/td>")+"<\/tr>")+"<\/table>"},_openCustomTable:function(t){t.currentTarget.id==this._rteId+"_createCustomTableLink"?(n("#"+this._rteId+"_customTable_wrapper").css({"z-index":this._onGetMaxZindex()}),this._customTableDialog.ejDialog("open"),this._createTable.ejDialog("close"),this._widthFocusOut()):this._createTable.find("div.e-rte-eTblProperties").hasClass("e-disable")||(this._eTblManager(),n("#"+this._rteId+"_eTbl_wrapper").css({"z-index":this._onGetMaxZindex()}),this._eTblDialog.ejDialog("open"),this._createTable.ejDialog("close"),this._on(this._getTableObj("Width"),"focusout",this._widthFocusOut),this._widthFocusOut())},_createcustomColorpalette:function(){var f=n("#"+this._rteId).data("ejRTE"),r=t.buildTag("div.e-custom-palette"),u,i;this._customColor=t.buildTag("div.e-rte-customColor#"+this._rteId+"_customColorDialog");u=t.buildTag("input.e-custom-palette#"+this._rteId+"customcolor");u.appendTo(this._customColor);this.colorobj=this._customColor.find(".e-custom-palette").ejColorPicker({enableRTL:this.model.enableRTL,enableOpacity:!0,showRecentColors:!0,modelType:"picker",cssClass:this.model.cssClass,showSwitcher:!1,select:function(n){f._checkColor(n.value)}}).data("ejColorPicker");i=this._getDialogModel();i.width="auto";i.height="auto";i.minWidth="220px";i.htmlAttributes={"class":"e-custom-Dialog"};i.title=this._getLocalizedLabels("customFontColor");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.closeIconTooltip=this._getLocalizedLabels("closeIcon");this._customColor.ejDialog(i);this._customDialogobj=this._customColor.ejDialog("instance");this._customColor.closest(".e-dialog-wrap").addClass("e-rte");this.colorobj.popupContainer.appendTo(r);this.colorobj.popupContainer.css({display:"block","border-style":"none"});n("#"+this._rteId+"_customColorDialog").find("span.e-colorwidget.e-picker").remove();n("#"+this._rteId+"_customColorDialog").prepend(r);this.colorobj._hidePopup=function(){n("#"+this._rteId+"_customColorDialog").ejDialog("isOpen")&&n("#"+this._rteId+"_customColorDialog").ejDialog("close");this.colorobj.model.displayInline||this.colorobj.hide()};this._on(this.colorobj._cancelTag,"click",this.colorobj._hidePopup)},_openColorpalette:function(n){this._customColor||this._createcustomColorpalette();n.currentTarget.id==this._rteId+"_customcolor"?(this._fontclick=!0,!t.isNullOrUndefined(this._splitMenu),this._splitMenu.hide(n)):n.currentTarget.id==this._rteId+"_customBGcolor"&&(this._fontclick=!1,!t.isNullOrUndefined(this._bgSplitMenu),this._bgSplitMenu.hide(n));this._customColor.ejDialog("open")},_checkColor:function(n){this._fontclick?(this._onFontColor(n),this._fontColor=n):(this._onBGColor(n),this._bgColor=n)},_createTableClose:function(i){!t.isNullOrUndefined(this._createTable)&&(!t.isNullOrUndefined(i)&&n(i.target).parents("#"+this._rteId+"_tables").length<=0||t.isNullOrUndefined(i))?t.isNullOrUndefined(this._createTable.data("ejDialog"))||((t.isNullOrUndefined(i)||i.target!=this._createTable[0]&&n(i.target).parents(".e-rte-table-picker").length<=0)&&(this._createTable.ejDialog("isOpened")&&this._createTable.ejDialog("close"),this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable")),this._createTable.ejDialog("isOpened")&&this.model.isResponsive&&!n(i.target).find("div#"+this._toolBarObj.element[0].id+"_hiddenlist").hasClass("e-inline")?this._toolBarObj._liTemplte.removeClass("e-display-none"):!this.model.isResponsive||t.isNullOrUndefined(i)||n(i.target).is(n("#"+this._toolBarObj.element[0].id+"_target"))||n(i.target).closest("div#"+this._toolBarObj.element[0].id+"_hiddenlist").length!=0||n(i.target).parents().hasClass("e-ddl-popup")||this._toolBarObj._liTemplte.addClass("e-display-none")):n(this._createTable.find("div.e-rte-eTblProperties").hasClass("e-disable")).addClass("e-disable")},_documentClick:function(t){if(n(t.target).hasClass("e-inlinearrow")&&this._setIframeHeight(),this.model.toolbarOverflowMode!="inline"&&this._createTableClose(t),this._isIE()&&!window.getSelection){var i=t.target.id;i==""&&(i=t.target.parentNode.id);(i==this._rteId+"_fontSizeDDL"||i==this._rteId+"_fontNameDDL"||i==this._rteId+"_formatDDL"||i==this._rteId+"_fontSizeDDL_dropdown"||i==this._rteId+"_fontNameDDL_dropdown"||i==this._rteId+"_formatDDL_dropdown")&&this._restoreSelection(this._selectionRange)}},_iframeFocus:function(i){!t.isNullOrUndefined(this._createTable)&&this._createTable.ejDialog("isOpened")&&this._createTable.ejDialog("close");!n(this._fontSizeDDL).parents("ul.e-rte-fontgroup").length==0&&!t.isNullOrUndefined(this._fontSizeDDL)&&this._fontSizeDDL.hasClass("e-dropdownlist")&&this._fontSizeDDL.ejDropDownList("hidePopup");!n(this._fontStyleDDL).parents("ul.e-rte-fontgroup").length==0&&!t.isNullOrUndefined(this._fontStyleDDL)&&this._fontStyleDDL.hasClass("e-dropdownlist")&&this._fontStyleDDL.ejDropDownList("hidePopup");!n(this._formatDDL).parents("ul.e-rte-format").length==0&&!t.isNullOrUndefined(this._formatDDL)&&this._formatDDL.hasClass("e-dropdownlist")&&this._formatDDL.ejDropDownList("hidePopup");t.isNullOrUndefined(this._createTable)||this._createTable.ejDialog("close");t.isNullOrUndefined(this._splitMenu)||this._splitMenu.hide(i);t.isNullOrUndefined(this._bgSplitMenu)||this._bgSplitMenu.hide(i);t.isNullOrUndefined(this._orderSplitObj)||this._orderSplitObj.hide(i);t.isNullOrUndefined(this._unOrderSplitObj)||this._unOrderSplitObj.hide(i)},_updateKeyDownSelectStatus:function(n,t){n.hasClass("e-active")?this._toolBarObj.deselectItemByID(this._rteId+"_"+t):this._toolBarObj.selectItemByID(this._rteId+"_"+t)},_iframeKeyDown:function(i){var r,u;if(this.model.showToolbar&&this.model.allowKeyboardNavigation&&i)if(i.ctrlKey){i.keyCode==65?this._contolAKeyfalg=!0:t.isNullOrUndefined(this._contolAKeyfalg)?this._contolAKeyfalg:this._contolAKeyfalg=!1;u=this;switch(i.keyCode){case 48:return i.preventDefault(),n(this.getDocument().body).css({zoom:1,transform:"scale(1)","transform-origin":"0 0","-o-transform":"scale(1)","-o-transform-origin":"0 0","-webkit-transform":"scale(1)","-webkit-transform-origin":"0 0"}),n(u._toolBarObj.itemsContainer.find(".e-rteItem-zoomIn")).attr("title",u._getLocalizedLabels("zoomIn")+" 100%"),n(u._toolBarObj.itemsContainer.find(".e-rteItem-zoomOut")).attr("title",u._getLocalizedLabels("zoomOut")+" 100%"),u._zoomValue=1,!1;case 57:return i.preventDefault(),this._onKeyZoom("IN"),!1;case 173:case 189:return i.preventDefault(),this._onKeyZoom("OUT"),!1;case 80:return i.preventDefault(),this._onPrint(),!1;case 66:if(!i.shiftKey)return i.preventDefault(),r=this._toolBarItems.find("li.e-rteItem-bold"),r.hasClass("e-disable")||(this._onBold(),this._updateKeyDownSelectStatus(r,"bold"),this._onChange(),this._setBackupData()),!1;break;case 72:if(i.shiftKey)return i.preventDefault(),this._getPasteRangeVal(),this._sourceCodeManager(),!1;break;case 73:return i.preventDefault(),i.shiftKey?this._imageManager():(r=this._toolBarItems.find("li.e-rteItem-italic"),r.hasClass("e-disable")||(this._onItalics(),this._setBackupData(),this._updateKeyDownSelectStatus(r,"italic"),this._onChange())),!1;case 85:return i.preventDefault(),i.shiftKey?this._onUpperCase():(r=this._toolBarItems.find("li.e-rteItem-underline"),r.hasClass("e-disable")||(this._onUnderLine(),this._updateKeyDownSelectStatus(r,"underline"))),this._setBackupData(),this._onChange(),!1;case 76:return i.preventDefault(),i.shiftKey?this._onLowerCase():this._toolBarItems.find("li.e-rteItem-justifyLeft").hasClass("e-disable")||(this._onJustifyLeft(),this._alignToolUpdate("justifyLeft")),this._setBackupData(),this._onChange(),!1;case 82:return i.preventDefault(),i.altKey?this.removeRow():i.shiftKey?this._onClearFormat():(r=this._toolBarItems.find("li.e-rteItem-justifyRight"),r.hasClass("e-disable")||(this._onJustifyRight(),this._alignToolUpdate("justifyRight"))),this._setBackupData(),this._onChange(),!1;case 69:if(i.shiftKey)return i.preventDefault(),this._openCustomTable(i),this._setBackupData(),this._onChange(),!1;if(!this._toolBarItems.find("li.e-rteItem-justifyCenter").hasClass("e-disable"))return i.preventDefault(),this._onJustifyCenter(),this._setBackupData(),this._alignToolUpdate("justifyCenter"),this._onChange(),!1;break;case 74:if(!this._toolBarItems.find("li.e-rteItem-justifyFull").hasClass("e-disable"))return i.preventDefault(),this._onJustifyFull(),this._alignToolUpdate("justifyFull"),this._setBackupData(),this._onChange(),!1;break;case 90:if(!this._toolBarItems.find("li.e-rteItem-undo").hasClass("e-disable"))return i.preventDefault(),this._onUndo(),!1;break;case 89:if(!this._toolBarItems.find("li.e-rteItem-redo").hasClass("e-disable"))return i.preventDefault(),this._onRedo(),!1;break;case 67:if(i.altKey)return i.preventDefault(),this.removeColumn(),!1;if(i.shiftKey)return i.preventDefault(),this._getPasteRangeVal(),this._customTableDialog&&this._renderTableDialog(),this._customTableDialog.ejDialog("open"),!1;if(this._toolBarItems.find("li.e-rteItem-copy").hasClass("e-disable"))return i.preventDefault(),this._keypressFlag=!1,!1;break;case 88:if(this._toolBarItems.find("li.e-rteItem-cut").hasClass("e-disable"))return i.preventDefault(),this._keypressFlag=!1,!1;this._onChange();break;case 86:if(this._toolBarItems.find("li.e-rteItem-paste").hasClass("e-disable")||this.model.maxLength<=n.trim(this._getText()).length&&(t.isNullOrUndefined(this._contolAKeyfalg)?!0:this._contolAKeyfalg))return i.preventDefault(),this._keypressFlag=!1,!1;if(i.shiftKey)return i.preventDefault(),this._keypressFlag=!1,this._selectCommand("video"),!1;break;case 77:return i.preventDefault(),i.shiftKey?this._toolBarItems.find("li.e-rteItem-outdent").hasClass("e-disable")||(this._onOutdent(),this._indentdepth>0&&this._indentdepth--):this._toolBarItems.find("li.e-rteItem-indent").hasClass("e-disable")||(this._onIndent(),this._indentdepth++),this._setBackupData(),this._onChange(),!1;case 75:return i.preventDefault(),i.shiftKey?this._onUnlink():this._toolBarItems.find("li.e-rteItem-createLink").hasClass("e-disable")||this._hyperLinkManager(!1),!1;case 188:if(i.shiftKey)return i.preventDefault(),this._changeFontsize(!1),this._onChange(),!1;this._setBackupData();this._onChange();break;case 190:if(i.shiftKey)return i.preventDefault(),this._changeFontsize(!0),this._onChange(),!1;this._setBackupData();break;case 61:case 187:return i.preventDefault(),i.shiftKey?this._onSuperScript():this._onSubScript(),this._onChange(),this._setBackupData(),!1;case 79:if(i.shiftKey)return i.preventDefault(),this.executeCommand("insertorderedlist","listItem"),this._onChange(),this._setBackupData(),!1;if(i.altKey)return i.preventDefault(),this.executeCommand("insertunorderedlist","listItem"),this._onChange(),this._setBackupData(),!1;break;case 83:if(i.shiftKey)return i.preventDefault(),this._onStrikeThrough(),this._onChange(),this._setBackupData(),!1;break;case 70:if(i.shiftKey)return i.preventDefault(),this._selectCommand("fullScreen"),!1;if(!i.altKey)return i.preventDefault(),t.RTE.FindAndReplace&&this._showFindAndReplace(),!1;break;case 37:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertColumn(!0),this._onChange(),!1;break;case 39:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertColumn(!1),this._onChange(),!1;break;case 38:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertRow(!0),this._onChange(),!1;break;case 40:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertRow(!1),this._onChange(),!1;break;case 65:if(i.altKey)return i.preventDefault(),this.removeTable(),!1;break;case 121:return i.preventDefault(),this._clearAllManager(),!1;case 84:if(i.altKey&&this._toolBarItems){this._toolBarItems.focus();break}}}else if(i.keyCode!=9||!this.model.enableTabKeyNavigation||(this._isIE8()?this._currentSelNode.nodeName.toLowerCase()=="td":this._getSelectedNode().nodeName.toLowerCase()=="td"))i.keyCode==8&&(ele=this._getSelectedNode(),n(ele).find("span#RTE_imgDupDiv").length>0&&n(this._imgDupDiv).remove(),n(ele).parents("BLOCKQUOTE").length>0&&(this._onOutdent(),i.preventDefault()));else return this._keypressFlag=!0,this.executeCommand("inserthtml","     ",!0),!1;else i.ctrlKey!=!0||i.keyCode!=66&&i.keyCode!=73&&i.keyCode!=85&&i.keyCode!=76&&i.keyCode!=82&&i.keyCode!=69&&i.keyCode!=74&&i.keyCode!=90&&i.keyCode!=89&&i.keyCode!=67&&i.keyCode!=88&&i.keyCode!=86&&i.keyCode!=8&&i.keyCode!=46||this.model.allowKeyboardNavigation||i.preventDefault();if(this.model.maxLength!=null&&(t.isNullOrUndefined(this._contolAKeyfalg)?!0:!this._contolAKeyfalg))try{!this._isIE8()||i.keyCode!=86||this.model.maxLength>=window.clipboardData.getData("Text").length+n.trim(this._getText()).length?this._validateMaxLength(i):i.preventDefault()}catch(f){}(this._isIE8()?this._currentSelNode&&this._currentSelNode.nodeName.toLowerCase()=="td":this._getSelectedNode().nodeName.toLowerCase()=="td")&&(ele=this._isIE8()?this._currentSelNode:this._getSelectedNode(),_newElementIndex=n(ele).parent().children().index(n(ele)),i.keyCode!=9||i.shiftKey||(_newElement=t.isNullOrUndefined(ele.nextSibling)?t.isNullOrUndefined(n(ele).parents("tr")[0].nextSibling)?t.isNullOrUndefined(n(ele).parents("table")[0].nextSibling)?ele:n(ele).parents("table")[0].nextSibling.nodeName.toLowerCase()=="td"?n(ele).parents("table")[0].nextSibling:ele:n(ele).parents("tr")[0].nextSibling.childNodes[0]:ele.nextSibling,this._setTableSelection(_newElement,i)),i.keyCode==9&&i.shiftKey?(_newElement=t.isNullOrUndefined(ele.previousSibling)?t.isNullOrUndefined(n(ele).parents("tr")[0].previousSibling)?t.isNullOrUndefined(n(ele).parents("table")[0].previousSibling)?ele:n(ele).parents("table")[0].previousSibling.nodeName.toLowerCase()=="td"?n(ele).parents("table")[0].previousSibling:ele:n(ele).parents("tr")[0].previousSibling.childNodes[n(ele).parents("tr")[0].previousSibling.childNodes.length-1]:ele.previousSibling,this._setTableSelection(_newElement,i)):i.keyCode==40?_newElement=t.isNullOrUndefined(n(ele).parents("tr")[0].nextSibling)?!t.isNullOrUndefined(n(ele).parents("table")[0].nextSibling)&&!this._isIE8()?n(ele).parents("table")[0].nextSibling:ele:n(ele).parents("tr")[0].nextSibling.children[_newElementIndex]:i.keyCode==38&&(_newElement=t.isNullOrUndefined(n(ele).parents("tr")[0].previousSibling)?!t.isNullOrUndefined(n(ele).parents("table")[0].previousSibling)&&!this._isIE8()?n(ele).parents("table")[0].previousSibling:ele:n(ele).parents("tr")[0].previousSibling.children[_newElementIndex]),i.keyCode!=9||ele!=_newElement||t.isNullOrUndefined(n(ele).parents("tr")[0].previousSibling)?(i.keyCode==9&&this._isIE8()||i.keyCode==40||i.keyCode==38)&&(this._setRange(_newElement,this._getRange(),!0),i.preventDefault()):(this.insertRow(!1),this._setRange(this._isIE8()?n(this._getRange().parentElement()).parents("tr").next().children().first()[0]:n(this._getRange().startContainer).parents("tr").next().children().first()[0],this._getRange(),!0),i.preventDefault()),this._isIE8()&&this._getRange().parentElement&&(this._currentSelNode=this._getRange().parentElement()));n(i.target).parents("table").length==0&&n(this._getDocument()).find(".e-rte-tablebox").remove();this._setAutoHeight();this._trigger("keydown",{keyCode:i.keyCode})},_changeFontsize:function(n){var t=parseInt(this._getCommandValue("fontsize"))?parseInt(this._getCommandValue("fontsize")):2;(!n&&t>this.model.fontSize[0].value||n&&t<this.model.fontSize[this.model.fontSize.length-1].value)&&(this._onFontSize(n?t+1:t-1),this._updateFontOptionStatus())},_iframeKeypress:function(n){if(!this._keypressFlag)return n.preventDefault(),this._keypressFlag=!0,!1},_setTableSelection:function(n,t){this._isIE8()||n.childNodes.length==1&&n.childNodes[0].nodeName=="BR"||n.childNodes.length==0?this._setRange(n,this._getRange(),!0):(range=this._getDocument().createRange(),range.selectNodeContents(n),this.selectRange(range));t.preventDefault()},_setAutoHeightValue:function(t){return t.nodeName=="#text"&&(t.parentNode.nodeName=="BODY"&&(n(t).wrap("<div><\/div>"),this.selectRange(this._getRange())),range=n(t.parentNode).position().top+parseInt(n(t.parentNode).css("height"))),t.nodeName=="DIV"&&(range=n(t).position().top+parseInt(n(t).css("height"))),range},_setAutoHeight:function(){this.model.autoHeight?this._autoHeight():t.isNullOrUndefined(this._getDocument())||n(this._getDocument().body).css("overflow","")},_autoHeight:function(){var i=this._toolBarItems?this._toolBarItems.outerHeight():0,r;t.isNullOrUndefined(this._getDocument().body)||(n(this._getDocument().body).css("overflow","hidden"),r=t.isNullOrUndefined(this._getDocument().body.lastChild)?0:this._getDocument().body.lastChild.clientHeight+this._getDocument().body.lastChild.offsetTop,parseInt(n(this._rteWapper[0]).css("min-height"))-i<=r?n(this._rteIframe[0]).css("height",r+30+"px"):n(this._rteIframe[0]).css("height",parseInt(n(this._rteWapper[0]).css("min-height"))-i+"px"),range=0,range=window.getSelection&&!t.isNullOrUndefined(this._getRange().startContainer)?this._setAutoHeightValue(this._getRange().startContainer):this._getDocument().selection&&!t.isNullOrUndefined(this._ieParents(this._getRange())[0])?this._setAutoHeightValue(this._ieParents(this._getRange())[0]):0,range>=this._rteIframe.height()-30&&(this._rteIframe[0].contentDocument?n(this._rteIframe[0]).css("height",this._rteIframe[0].contentDocument.documentElement.scrollHeight+20+"px"):n(this._rteIframe[0]).css("height",this._rteIframe[0].contentWindow.document.body.scrollHeight+20+"px")),this._rteWapper.outerHeight(this._rteEditor.outerHeight()+i+parseInt(this.model.showFooter?19:0)))},_ieSelRange:function(){this._isIE()?(this._selectionRange="",this._ieSelectionRange=this._getRange(),this._seleText=t.isNullOrUndefined(this._getWindow().document.selection)?this._selectionRange.toString():this._getWindow().document.selection.createRange().text):this._ieSelectionRange=this._ieSelection},_iframeSelectionChange:function(n){this._trigger("select",{event:n,model:this.model})},_ignorekeyArray:[13,32,8,46],_iframeKeyUp:function(t){n(this._imgDupDiv).remove();n(this._imgOrg).css("outline","");this._toggleEditTable();n.inArray(t.which,this._ignorekeyArray)!=-1&&this._setBackupData();t.ctrlKey&&(t.keyCode==57||t.keyCode==189)&&this._zoomUp();this._updateToolbarStatus();this._updateFontOptionStatus();this._updateFormat();this._updateCount();var i=this._isIE8()?this._currentSelNode:this._getSelectedNode();if(this.model.showToolbar&&(this._isIE8()?i.nodeName.toLowerCase():i.nodeName.toLowerCase()!="a"?this.disableToolbarItem("removeLink"):this.enableToolbarItem("removeLink")),this._updateTagInfo(i),this._setAutoHeight(),this._ieSelRange(),this._trigger("keyup",{keyCode:t.keyCode}),this._iframeSelectionChange(t),t.ctrlKey)switch(t.keyCode){case 88:case 86:this._onChange()}(t.keyCode==46||t.keyCode==8)&&(this._getDocument().body.innerHTML==""||this._getDocument().body.innerHTML=="<br>")&&this._emptyContent()},_iframeMouseUp:function(i){if(this._tableResizeUp(i),this._zoomUp(i),this._resizeBtnInit(),!t.isNullOrUndefined(this._imgDup)&&n(this._imgOrg).parents("body").length>0&&(n(this._imgOrg).css({width:n(this._imgDup).css("width"),height:n(this._imgDup).css("height")}),n(this._imgOrg).position({left:n(this._imgDup).position().left,top:n(this._imgDup).position().top}),n(this._imgDup).css("display","none"),this._resizeImgPos(),this._setAutoHeight()),i.target.nodeName=="IMG"||n(i.target).hasClass("e-rte-imageboxmark")||(n(this._imgOrg).css("outline",""),n(this._imgDupDiv).remove(),this._off(n(this._getDocument()),"mousemove",this._imgBoxMouseMove)),i.target.nodeName=="IMG"&&n(i.target).parents("body").length>0){var r=this._isIE8()?this._getDocument().body.createTextRange():this._getDocument().createRange();this._isIE8()?r.moveToElementText(i.target):r.selectNode(i.target);this.selectRange(r)}this._currentSelNode=i.target;i.currentTarget&&i.target.nodeName&&i.target.nodeName.toLowerCase()=="html"&&this._getDocument()&&this._getDocument().body&&(this._isIE8()?!0:this._getRange().startOffset==this._getRange().endOffset)&&(this._isIE()&&i.currentTarget.createRange&&this._setRange(this._isIE8()?this._getDocument().body:this._getRange().startContainer,i.currentTarget.createRange(),!0),this._getDocument().body.focus());this._toggleEditTable();this._updateToolbarStatus();i.button?isRightClick=i.button==2:i.which&&(isRightClick=i.which==3);isRightClick||(this._updateFormat(),this._updateFontOptionStatus());this._ieSelRange();this._iframeSelectionChange(i);this._fontStyleDDL&&!t.isNullOrUndefined(this._fontStyleDDL.data("ejDropDownList"))&&this._fontStyleDDL.ejDropDownList("instance")._isPopupShown()&&n(this._fontStyleDDL.ejDropDownList("instance").popupList.ejScroller("instance").element).trigger("mouseup");this._fontSizeDDL&&!t.isNullOrUndefined(this._fontSizeDDL.data("ejDropDownList"))&&this._fontSizeDDL.ejDropDownList("instance")._isPopupShown()&&n(this._fontSizeDDL.ejDropDownList("instance").popupList.ejScroller("instance").element).trigger("mouseup")},_iframeMouseDown:function(i){if(t.browserInfo().name==="mozilla"&&(this._getDocument().designMode="off"),t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this._focus(),this._contolAKeyfalg=!1,this._updateTagInfo(i.target),this._updateIndent(i.target),this.model.showToolbar&&(i.target.nodeName!="A"?this.disableToolbarItem("removeLink"):this.enableToolbarItem("removeLink")),i.target.nodeName=="VIDEO"&&this.model.allowEditing&&this._preventDefaultResize(),i.target.nodeName=="IMG"&&this.model.allowEditing&&(this._preventDefaultResize(),this._imageClick(i.target)),n(i.target).hasClass("e-rte-imageboxmark"))return this._resizeBtnInit(),this._commonBoxDown=!0,n(i.target).hasClass("e-rte-rigmed")&&(this._rigMidBox=!0),n(i.target).hasClass("e-rte-toplef")&&(this._topLefBox=!0),n(i.target).hasClass("e-rte-topmed")&&(this._topMidBox=!0),n(i.target).hasClass("e-rte-toprig")&&(this._topRigBox=!0),n(i.target).hasClass("e-rte-lefmed")&&(this._lefMidBox=!0),n(i.target).hasClass("e-rte-botlef")&&(this._botLefBox=!0),n(i.target).hasClass("e-rte-botmid")&&(this._botMidBox=!0),n(i.target).hasClass("e-rte-botrig")&&(this._botRigBox=!0),!1;n(i.target).hasClass("e-rteColumnResizer")&&(this._lastCol=n(i.target).hasClass("e-rtelastcol")?!0:!1,this._columnEle=n(this._curTable).find("tr:first td").eq(parseInt(n(i.target).attr("data-col")))[0],this._columnDown=!0,this._columnIndex=this._columnEle.cellIndex,n(this._getDocument().body).after("<span class='colresizerline'style='cursor:col-resize;position:absolute;width:0px;border-left: 1px dashed #787878;height:"+n(this._columnEle).closest("table").height()+"px;left:"+i.pageX+"px;top:"+n(this._columnEle).offset().top+"px;'><\/span>"));n(i.target).hasClass("e-rteRowResizer")&&(this._rowEle=n(this._curTable).find("tr").eq(parseInt(n(i.target).attr("data-row")))[0],this._rowDown=!0);n(i.target).hasClass("e-rte-tablebox")&&(this._boxDown=!0,this._boxElement=this._curTable);(n(i.target).hasClass("e-rte-tablebox")||n(i.target).hasClass("e-rteRowResizer")||n(i.target).hasClass("e-rteColumnResizer"))&&this._on(n(this._getDocument()),"mousemove",this._imgBoxMouseMove);(t.browserInfo().name=="msie"||t.browserInfo().name=="chrome")&&i.ctrlKey==!0&&i.which==1&&(i.target.tagName.toUpperCase()!="A"||t.isNullOrUndefined(n(i.target).attr("href"))||window.open(n(i.target).attr("href"),"_blank"));this.model.isResponsive&&!t.isNullOrUndefined(this._toolBarObj)&&this._toolBarObj._liTemplte.children("ul").length>0&&!n(this._toolBarObj._liTemplte).hasClass("e-inline")&&(this._toolBarObj.contstatus=!0,this._toolBarObj._liTemplte.addClass("e-display-none"),this._toolBarObj.contstatus=!1);this._iframeFocus();this._onChange()},_iframeFocusOut:function(n){n.data&&(n.data._proxy._onChange(),n.data._proxy._selectionRange=n.data._proxy._isIE8()?n.data._proxy._getRange():n.data._proxy._saveSelection(),n.data._proxy._seleText=t.isNullOrUndefined(n.data._proxy._getWindow().document.selection)?n.data._proxy._selectionRange.toString():n.data._proxy._isIE8()?n.data._proxy._getWindow().document.selection.createRange().text:n.data._proxy._getWindow().getSelection().toString())},_widthFocusOut:function(){var i,r,u;this._customTableDialog.ejDialog("isOpen")?(i=this._customTableDialog,r="#"+this._rteId+"_ddlAlignment",u="#"+this._rteId+"_txtWidth"):(i=this._eTblDialog,r="#"+this._rteId+"_eTblAlign",u="#"+this._rteId+"_eTblWidth");var t=i.find(u).val(),f=n(r).data("ejDropDownList"),e=t&&t!=""&&!isNaN(t)||t.slice(-2)=="px"||t.slice(-2)=="em"||t.slice(-2)=="pt"||t.slice(-1)=="%"?!0:!1;f.option("enabled",e)},_windowResize:function(){this._setAutoHeight();this._setIframeHeight();this._updateCount()},_tableResizeUp:function(){n(this._getDocument()).find("table.e-rte-table").length&&(this._columnDown||this._rowDown||this._boxDown)?(this._currentTable&&this._columnDown&&this._columnDownClick&&(this._lastCol?(this._currentTable.closest("table").find("tr:first td").each(function(){this.style.width==""&&n(this).width(parseInt(n(this).closest("table").width()/(n(this).siblings().length+1)))}),this._currentTable.eq(this._columnIndex).width(this.lasColIndexWid),this._currentTable.closest("table").attr({width:""}),n(this._getDocument()).find(".e-rte-tablebox").css({left:this._currentTable.eq(this._columnIndex).offset().left+this._currentTable.eq(this._columnIndex).outerWidth()+"px"})):(this._currentTable.eq(this._columnIndex-1).width(this.nexColIndexWid),this._currentTable.eq(this._columnIndex).width(this._columnIndexWid))),this._removeResizeObject(),n(this._getDocument()).find(".colresizerline").remove(),n(this._getDocument()).find(".e-rte-tablebox").css("display","none"),this._restoreSelection(this._tableSelection),this._columnDown=!1,this._rowDown=!1,this._boxDown=!1,this._columnDownClick=!1):(n(this._getDocument()).find(".e-rte-tablebox").remove(),this._tableSelection=this._getRange())},_resizeBtnInit:function(){this._commonBoxDown=!1;this._rigMidBox=!1;this._topLefBox=!1;this._topMidBox=!1;this._topRigBox=!1;this._lefMidBox=!1;this._botLefBox=!1;this._botMidBox=!1;this._botRigBox=!1},_imgSpanBox:function(i){this._resizeBtnInit();this._imgOrg=i;this._imgDupDiv=t.buildTag("span#RTE_imgDupDiv");this._imgDup=t.buildTag("img#RTE_imgdivspan","",{display:"none",position:"absolute","background-size":"100% 100%",outline:"1px dashed #000",opacity:".64"},{}).appendTo(this._imgDupDiv);this._topLef=t.buildTag("span.e-rte-imageboxmark e-rte-toplef#RTE_toplef","",{cursor:"nwse-resize"},{}).appendTo(this._imgDupDiv);this._topMid=t.buildTag("span.e-rte-imageboxmark e-rte-topmed#RTE_topmed","",{cursor:"ns-resize"},{}).appendTo(this._imgDupDiv);this._topRig=t.buildTag("span.e-rte-imageboxmark e-rte-toprig#RTE_toprig","",{cursor:"nesw-resize"},{}).appendTo(this._imgDupDiv);this._leftMid=t.buildTag("span.e-rte-imageboxmark e-rte-lefmed#RTE_lefmed","",{cursor:"ew-resize"},{}).appendTo(this._imgDupDiv);this._rigMid=t.buildTag("span.e-rte-imageboxmark e-rte-rigmed#RTE_rigmed","",{cursor:"ew-resize"},{}).appendTo(this._imgDupDiv);this._botLef=t.buildTag("span.e-rte-imageboxmark e-rte-botlef#RTE_botlef","",{cursor:"nesw-resize"},{}).appendTo(this._imgDupDiv);this._botMid=t.buildTag("span.e-rte-imageboxmark e-rte-botmid#RTE_botmid","",{cursor:"ns-resize"},{}).appendTo(this._imgDupDiv);this._botRig=t.buildTag("span.e-rte-imageboxmark e-rte-botrig#RTE_botrig","",{cursor:"nwse-resize"},{}).appendTo(this._imgDupDiv);this._resizeImgPos();this._resizeImgDupPos();n(this._getDocument().body).after(this._imgDupDiv);n(i).css({outline:"1px dashed #5C5C5C"});this._on(n(this._getDocument()),"mousemove",this._imgBoxMouseMove)},_resizeImgPos:function(){this._ltPos=n(this._imgOrg).position();this._imgWid=n(this._imgOrg).css("width");this._imgHgt=n(this._imgOrg).css("height");this._imgDup.css({width:this._imgWid,height:this._imgHgt,left:this._ltPos.left+"px",top:this._ltPos.top+"px",border:n(this._imgOrg).css("border")});this._imgDup.attr({src:n(this._imgOrg).attr("src")});var i=parseInt(n(this._imgOrg).css("width"))-2+this._ltPos.left,u=(parseInt(n(this._imgOrg).css("width"))-2)/2+this._ltPos.left,r=parseInt(n(this._imgOrg).css("height"))-2+this._ltPos.top,f=(parseInt(n(this._imgOrg).css("height"))-2)/2+this._ltPos.top,t=parseInt(n(this._imgOrg).css("border-width")==""?0:n(this._imgOrg).css("border-width"));n(this._rigMid).css({left:i+2*t+"px",top:f+"px"});n(this._botLef).css({left:this._ltPos.left-3+"px",top:r+2*t+"px"});n(this._botRig).css({left:i+2*t+"px",top:r+2*t+"px"});n(this._botMid).css({left:u+"px",top:r+2*t+"px"});n(this._topRig).css({left:i+2*t+"px",top:this._ltPos.top-3+"px"});n(this._topLef).css({left:this._ltPos.left-3+"px",top:this._ltPos.top-3+"px"});n(this._topMid).css({left:u+"px",top:this._ltPos.top-3+"px"});n(this._leftMid).css({left:this._ltPos.left-3+"px",top:f+"px"})},_resizeImgDupPos:function(){this._ltDupPos=n(this._imgOrg).position();this._imgMidWid=n(this._imgOrg).css("width");this._imgDupHgt=n(this._imgOrg).css("height")},_imgBoxMouseMove:function(i){var s,h;if(this._commonBoxDown)this._rigMidBox?this._imgDupMouseMove(parseInt(i.pageX)-this._ltDupPos.left+"px",this._imgDupHgt,i):this._lefMidBox?(this._imgDupMouseMove(parseInt(this._imgMidWid)+this._ltDupPos.left-i.pageX+"px",this._imgDupHgt,i),n(this._imgDup).offset({left:i.pageX})):this._topMidBox?(this._imgDupMouseMove(this._img_wid,parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),n(this._imgDup).offset({top:i.pageY})):this._botMidBox?this._imgDupMouseMove(this._img_wid,i.pageY-this._ltDupPos.top+"px",i):this._botRigBox?this._imgDupMouseMove(i.pageX-this._ltDupPos.left+"px",i.pageY-this._ltDupPos.top+"px",i):this._botLefBox?(this._imgDupMouseMove(parseInt(this._imgMidWid)+this._ltDupPos.left-i.pageX+"px",i.pageY-this._ltDupPos.top+"px",i),n(this._imgDup).offset({left:i.pageX})):this._topRigBox?(this._imgDupMouseMove(i.pageX-this._ltDupPos.left+"px",parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),n(this._imgDup).offset({top:i.pageY})):this._topLefBox&&(this._imgDupMouseMove(parseInt(this._imgMidWid)+this._ltDupPos.left-i.pageX+"px",parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),n(this._imgDup).offset({top:i.pageY,left:i.pageX}));else if(this._columnDown){this._columnDownClick=!0;this._currentTable=n(this._columnEle).closest("table").find("tr:first td");var o=this._columnEle.style.width==""?n(this._columnEle).width():parseInt(this._columnEle.style.width),r=n(this._columnEle).offset().left,f=r>i.pageX?o+(r-i.pageX):o-(i.pageX-r),y=n(this._currentTable).eq(this._columnIndex-1)[0].style.width==""?n(n(this._currentTable).eq(this._columnIndex-1)).width():parseInt(n(this._currentTable).eq(this._columnIndex-1)[0].style.width),c=o+y;!this._lastCol&&f>15&&c-f>15?(this.nexColIndexWid=c-f,this._columnIndexWid=f,n(this._getDocument()).find(".colresizerline").css({left:i.pageX+"px"})):this._lastCol&&r<i.pageX&&i.pageX-r>15&&(this.lasColIndexWid=i.pageX-r,n(this._getDocument()).find(".colresizerline").css({left:i.pageX+"px"}));this._removeMouseSelection(i);n(this._columnEle).closest("table").find("tr:last td:last span.e-rte-tablebox").css({display:"none"})}else if(this._rowDown)(t.browserInfo().name==="chrome"||t.browserInfo().name==="mozilla")&&(select=this._getDocument().getSelection().removeAllRanges()),s=this._rowEle.offsetTop,h=this._rowEle.parentElement.parentElement.offsetTop,i.pageY-(s+h)>20&&(this._rowEle.style.height=i.pageY-(s+h)+"px"),this._removeMouseSelection(i),n(this._getDocument()).find(".e-rte-tablebox").css({left:n(this._rowEle).closest("table").width()+n(this._rowEle).closest("table").offset().left+"px",top:n(this._rowEle).closest("table").height()+n(this._rowEle).closest("table").offset().top+"px"});else if(this._boxDown){var u=n(this._boxElement),l=u.parent(),e=u.offset(),a=(i.pageX-e.left)/l.width()*100,v=(i.pageY-e.top)/l.height()*100;(t.browserInfo().name==="chrome"||t.browserInfo().name==="mozilla")&&this._getDocument().getSelection().removeAllRanges();i.pageX>0&&a>10&&v>0&&(u.attr({width:a+"%",height:v+"%"}),n(this._getDocument()).find(".e-rte-tablebox").css({left:u.width()+e.left+"px",top:u.height()+e.top+"px"}),u.find("tr:first td").each(function(){var t=n(this);t.width(parseInt(t.closest("table").width()/(t.siblings().length+1)))}));this._removeMouseSelection(i)}},_removeMouseSelection:function(n){return t.browserInfo().name==="mozilla"&&this._getDocument().getSelection().removeAllRanges(),n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault(),n.cancelBubble=!0,n.returnValue=!1,!1},_imgDupMouseMove:function(t,i,r){n(this._imgDup).css({display:"block",width:t,height:i});this._resizeImgDupPos();this._isIE8()&&this._removeMouseSelection(r)},_imageClick:function(t){n(this._getDocument().body).find("img").css("outline","");this._imgDupDiv&&this._imgDupDiv.remove();this._imgSpanBox(t)},_iframePaste:function(i){var r=this,o=t,u,e,f;if(i)try{u=t.isNullOrUndefined(window.clipboardData)?i.originalEvent.clipboardData.getData("text/plain"):window.clipboardData.getData("Text");u.length!=0?r.model.maxLength>=u.length+n.trim(r._getText()).length||i.preventDefault():(e=i.originalEvent.clipboardData.items[0].getAsFile(),f=new FileReader,f.onload=function(n){r.executeCommand("inserthtml","<img src="+n.target.result+" alt />")},f.readAsDataURL(e))}catch(s){}setTimeout(function(){r._setBackupData();r._onChange();r._setAutoHeight();r._updateCount();r._pasteTableResize();o.browserInfo().name=="webkit"?r._getWindow().focus():r._getWindow().document.body.focus()},0)},_pasteTableResize:function(){for(var r=n(this._getDocument()).find("table").not(".e-rte-table"),t,i=0;i<r.length;i++)t=n(r[i]),t.addClass("e-rte-table").removeAttr("style cellspacing").attr({border:1,cellspacing:1,width:t.width()}).css({border:"1px solid#5C5C5C","border-collapse":"separate","border-spacing":"2px"}),t.find("table tr,td").removeAttr("style width"),this._on(t,"mouseover",this._tableMouseOver)},_wireEvents:function(){var i=n(this._getDocument());if(this._getDocument()!=""){if(t.isNullOrUndefined(this._createTable)||this._on(this._createTable,"mouseenter","div.e-rte-tablecell",this._tableCellStart)._on(this._createTable,"mousemove","div.e-rte-tablecell",this._tableCellSelect)._on(this._createTable,"mouseleave","div.e-rte-table",this._tableCellLeave)._on(this._createTable,"mousedown","div.e-rte-tablecell",this._tableCellDown)._on(n(document),"click",this._documentClick),this._on(i,"focus",this._iframeFocus)._on(i,"keydown",this._iframeKeyDown)._on(i,"keypress",this._iframeKeypress)._on(i,"keyup",this._iframeKeyUp)._on(i,"mouseup",this._iframeMouseUp)._on(i,"mousedown",this._iframeMouseDown)._on(n(window),"resize",this._windowResize),!this._isIE8()&&this.model.pasteCleanupSettings&&(this.model.pasteCleanupSettings.cleanElements||this.model.pasteCleanupSettings.removeStyles||this.model.pasteCleanupSettings.cleanCSS||this.model.pasteCleanupSettings.listConversion)||this._on(i,"paste",this._iframePaste),!t.isNullOrUndefined(document.getElementById(this._id+"_Iframe")))n(document.getElementById(this._id+"_Iframe").contentWindow).on("blur",{_proxy:this},this._iframeFocusOut);t.isNullOrUndefined(this._customTableDialog)||this._on(this._customTableDialog.find(".e-rte-txtWidth"),"focusout",this._widthFocusOut)}},_unwireEvents:function(){var i=n(this._getDocument());t.isNullOrUndefined(this._createTable)||this._off(this._createTable,"mousemove","div.e-rte-tablecell")._off(this._createTable,"mouseleave","div.e-rte-table")._off(this._createTable,"mousedown","div.e-rte-tablecell")._off(n(document),"click",this._documentClick);this._off(i,"focus")._off(i,"keydown")._off(i,"keyup")._off(i,"mouseup")._off(i,"mousedown")._off(n(window),"resize",this._windowResize);n(document.getElementById(this._id+"_Iframe").contentWindow).off("blur",this._iframeFocusOut);t.isNullOrUndefined(this._customTableDialog)||this._off(this._customTableDialog.find(".e-rte-txtWidth"),"focusout")},_footerEvents:function(n){this[n](this._htmlSource,"click",this._sourceCodeManager);this[n](this._clearFormat,"click",this._onClearFormat);this[n](this._clearAll,"click",this._clearAllManager)},_onChange:function(){if(_prevhtml=n.trim(this.value()),this.model.enableXHTML&&(this._updateXhtml(),this.model.enableHtmlEncode&&this.value(this._encode(this._removeNoSpaceChar(this.value())))),_prevhtml!==this._removeNoSpaceChar(this.getHtml())){this._updateValue();var t={text:this._getText(),htmlText:this.getHtml(),isInteraction:this._isInteraction};this._trigger("change",t);this._isInteraction=!0}},_disableIframeContent:function(){try{this._rteIframe.contents().find("body,[contenteditable='true']").attr("contenteditable",!1)}catch(n){}},disable:function(){this.model.enabled=!1;this._showHideContextMenu();this.element.attr("disabled","disabled");this._unwireEvents();this.model.showToolbar&&this._toolBarObj.disable();n(this._rteFooter).ejTooltip("option","enabled",!1);this._disableIframeContent();this._rteEditor.addClass("e-disable");this.model.showFooter&&(this._rteFooter.addClass("e-disable"),this._resize.removeClass("e-resizable"),this._footerEvents("_off"));this._disableResizeObj(!1)},enable:function(){this.model.enabled=!0;this._showHideContextMenu();this.element.removeAttr("disabled");this._wireEvents();this.model.showToolbar&&this._toolBarObj.enable();n(this._rteFooter).ejTooltip("option","enabled",!0);this._rteIframe.contents().find("body,[contenteditable='false']").attr("contenteditable",!0);this._rteEditor.removeClass("e-disable");this.model.showFooter&&(this._rteFooter.removeClass("e-disable"),this._resize.addClass("e-resizable"),this._footerEvents("_on"));this._disableResizeObj(!0)},disableToolbarItem:function(i){!t.isNullOrUndefined(i)&&(n(this._toolBarObj.target).find("#"+this._rteId+"_"+i).length!=0||n(this._toolBarObj._liTemplte).find("#"+this._rteId+"_"+i).length!=0)?this._toolBarObj.disableItemByID(this._rteId+"_"+i):this._toolBarObj.disableItemByID(i);i=="undo"&&n("#"+this._rteId+"_"+i).addClass("e-rteTooldisable")},enableToolbarItem:function(i){!t.isNullOrUndefined(i)&&(n(this._toolBarObj.target).find("#"+this._rteId+"_"+i).length!=0||n(this._toolBarObj._liTemplte).find("#"+this._rteId+"_"+i).length!=0)?this._toolBarObj.enableItemByID(this._rteId+"_"+i):this._toolBarObj.enableItemByID(i);i=="undo"&&n("#"+this._rteId+"_"+i).hasClass("e-rteTooldisable");n("#"+i).removeClass("e-rteTooldisable")},removeToolbarItem:function(n){t.isNullOrUndefined(n)||this._toolBarObj.removeItemByID(this._rteId+"_"+n);this._setIframeHeight()},refresh:function(){this._unwireEvents();this._setIFrames();this._setIframeHeight();this.model.enabled?this._wireEvents():this._disableIframeContent();this.model.enableRTL&&this._rteIframe.contents().find("body").css("direction","rtl");this._showHideContextMenu()},show:function(){this._rteWapper.show();this._setIFrames()},hide:function(){this._rteWapper.hide()},setColorPickerType:function(n){n=="palette"||n==="picker"?this._imgPicker.option("modelType",n):this._imgPicker.option("modelType","default")},pasteContent:function(n){this._pasteAPIFlag=!0;this._pasteHtml(n);this._onChange()},getDocument:function(){return this._getDocument()},getHtml:function(t){if(this.model.enableXHTML)return this.model.enableHtmlEncode?t==!1?this._removeNoSpaceChar(n.trim(this._decode(this.value()))):this._removeNoSpaceChar(n.trim(this.value())):this._removeNoSpaceChar(n.trim(this.value()));try{return this.model.enableHtmlEncode?t==!1?this._removeNoSpaceChar(n.trim(this._getDocument().body.innerHTML)):this._removeNoSpaceChar(this._encode(n.trim(this._getDocument().body.innerHTML))):this._removeNoSpaceChar(n.trim(this._getDocument().body.innerHTML))}catch(i){return""}},setHtml:function(t){this._getDocument().body.innerHTML="";this._getDocument().body.innerHTML=n.trim(t);this._onChange();var i=n(this._getDocument()).find("table");!this.model.enableRTL&&i.length>0&&this._on(i,"mouseover",this._tableMouseOver)},getText:function(){return this._getText()},executeCommand:function(i,r,u){if(this._isIE8()&&t.isNullOrUndefined(this._ieSelectionRange)?this._ieSelectionRange=this._getRange():this._isIE()&&i.toLowerCase()=="inserthtml"&&!this._isIE8()&&(this._getRange().startContainer.nodeName.toLowerCase()!="body"?this._currentSelNode=this._getRange().startContainer:this._ieLinkRange()),this._trigger("execute",{commandName:i}))return!1;var f="";if(t.browserInfo().name=="chrome"&&this._getWindow().getSelection().rangeCount==0&&this._restoreSelection(this._saveSelection()),i=="underline"){if(window.getSelection&&(f=n(this._getWindow().getSelection().anchorNode).parents("a"),f.length>0)){n(f).css("text-decoration",n(f).css("text-decoration")=="none"?"underline":"none");return}}else{if(i.toLowerCase()=="inserthtml"){this._isIE()?this._pasteHtml(r,u):this._getDocument().execCommand(i,!1,r);return}i.toLowerCase()=="formatblock"&&this._isIE()&&r.charAt(0)!="<"&&r.charAt(r.length-1)!=">"&&(r="<"+r+">")}t.browserInfo().name=="msie"&&this._focus();this._isIE()&&i=="fontName"&&(r=r.substring(0,r.indexOf(",")));this._getDocument().execCommand(i,!1,r);this._onChange();i=="fontName"||i=="fontSize"||i=="indent"||i=="cut"||i=="copy"||i=="paste"||i=="undo"||i=="redo"||i=="outdent"||t.isNullOrUndefined(this._toolBarObj)||(this._toolBarObj.itemsContainer.find("li#"+this._rteId+"_"+i).hasClass("e-active")?this._toolBarObj.deselectItemByID(this._rteId+"_"+i):this._toolBarObj.selectItemByID(this._rteId+"_"+i));r!="listItem"&&this._setBackupData()},focus:function(){this._focus()},getCommandStatus:function(n){if(t.isNullOrUndefined(n)||n!="")return this._getCommandStatus(n)},getSelectedHtml:function(){return this._getSelectedHtmlString()},insertMenuOption:function(t){if(t.newItem&&t.targetItem&&t.insertType&&t.menuType){var u=this._textMenuObj,f,r=t.newItem,e=t.spriteCssClass?[{text:t.newItem,id:r,spriteCssClass:t.spriteCssClass}]:[{text:t.newItem,id:r}];for(i=0;i<u.element.find("li a").length;i++)if(n(u.element.find("li a")[i]).text()==t.targetItem){f=n(u.element.find("li")[i]).attr("id");break}t.insertType=="insert"?u.insert(e,f?"#"+f:f):t.insertType=="insertAfter"?u.insertAfter(e,"#"+f):t.insertType=="insertBefore"&&u.insertBefore(e,"#"+f);t.menuType.text&&this._contextType.text.push(r);t.menuType.image&&this._contextType.image.push(r);t.menuType.hyperlink&&this._contextType.hyperlink.push(r);t.menuType.table&&(this._contextType.table.push(r),this._contextType.table_hyper.push(r))}},removeMenuOption:function(t){var i=this._textMenuObj;i.remove(["#"+t]);(index=n.inArray(t,this._contextType.text))!=-1&&(this._contextType.text=this._removeContextData(index,this._contextType.text));(index=n.inArray(t,this._contextType.image))!=-1&&(this._contextType.image=this._removeContextData(index,this._contextType.image));(index=n.inArray(t,this._contextType.hyperlink))!=-1&&(this._contextType.hyperlink=this._removeContextData(index,this._contextType.hyperlink));(index=n.inArray(t,this._contextType.table))!=-1&&(this._contextType.textablet=this._removeContextData(index,this._contextType.table));(index=n.inArray(t,this._contextType.table_hyper))!=-1&&(this._contextType.textablet=this._removeContextData(index,this._contextType.table_hyper))},_removeContextData:function(t,i){var r=[];return n(i).each(function(n,i){t!=n&&r.push(i)}),r},insertRow:function(i,r){if(this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length){var e=t.isNullOrUndefined(r)?this._getSelectedNode():r,o="<td "+this._border+"contentEditable='true'><br _moz_dirty=''/><\/td>",u=n(e).closest("tr"),s=u.find("td").length,f=n("<tr>"+Array(s+1).join(o)+"<\/tr>");return i?f.insertBefore(u):f.insertAfter(u),f.find("td:first").focus(),this._setAutoHeight(),e}},insertColumn:function(i,r){var u;if(this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length){var o=n(this._getSelectedNode()).closest("td"),f=t.isNullOrUndefined(r)?o.length>0?o[0]:this._getSelectedNode():r,s="<td "+this._border+"contentEditable='true'><br _moz_dirty=''/><\/td>",h=n(f).closest("tr"),e,c=h.closest("table").find("tr"),l=h.find("td").index(f);for(u=0;u<c.length;u++)e=n(c[u]).find("td")[l],i?n(s).insertBefore(e):n(s).insertAfter(e);return f}},removeRow:function(i){var r=t.isNullOrUndefined(i)?this._getSelectedNode():i,f=this._getRange(),u=null,e=n(r).closest("table");e.find("tr").length==1?(u=n(r).parent("tr").closest("table").next()[0]||n(r).parent("tr").closest("table").prev()[0],n(r).parent("tr").closest("table").remove()):(u=n(r).parent("tr").prev("tr").length!=0?n(r).parent("tr").prev("tr").find("td:last")[0]:n(r).parent("tr").next("tr").find("td:first")[0],curRow=n(r).closest("tr").remove());t.isNullOrUndefined(u)||this._setRange(u,f);this._setAutoHeight()},selectRange:function(n){this._focus();this._isIE8()?n.select():(select=this._getDocument().getSelection(),select.removeAllRanges(),select.addRange(n))},_encode:function(t){return n("<div/>").text(t).html()},_decode:function(n){return n.replace(/&/g,"&").replace(/&lt;/g,"<").replace(/</g,"<").replace(/&gt;/g,">").replace(/>/g,">").replace(/ /g," ").replace(/&nbsp;/g," ").replace(/"/g)},createRange:function(){return this._isIE8()?this.getDocument().body.createTextRange():this._getRange()},_setRange:function(n,i,r){this._isIE8()?t.isNullOrUndefined(n)||(i.collapse(!0),i.moveToElementText(n),i.moveStart("character",1),i.select()):(i.setStart(n,0),i.collapse(!0),t.browserInfo().name=="msie"&&t.browserInfo().version!="11.0"&&t.isNullOrUndefined(r)?t.isNullOrUndefined(r)&&(selection=this._getDocument().body.createTextRange(),selection.moveToElementText(n)):this.selectRange(i))},removeColumn:function(i){var e=n(this._getSelectedNode()).closest("td"),r=t.isNullOrUndefined(i)?e.length>0?e[0]:this._getSelectedNode():i,h=this._getRange(),o=n(r).closest("tr"),s=o.closest("table").find("tr"),c=o.find("td").index(r),f=t.isNullOrUndefined(r.nextElementSibling)?n(r.previousSibling)[0]:n(r.nextElementSibling)[0],u;if(t.isNullOrUndefined(f))n(r).parent("tr").parents("table").remove();else for(u=0;u<s.length;u++)n(n(s[u]).find("td")[c]).remove();t.isNullOrUndefined(f)||this._setRange(f,h)},removeTable:function(i){var r=t.isNullOrUndefined(i)?n(this._getSelectedNode()).closest("table"):i,u=n(r).parent().closest("table").length<1;this._currentSelNode=n(r).parent()[0];n(r).remove();u&&this._toggleEditTable();this._setAutoHeight();this._removeResizeObject();n(this._getDocument()).find(".e-rte-tablebox").remove()}});t.RTE.Locale=t.RTE.Locale||{};t.RTE.Locale["default"]=t.RTE.Locale["en-US"]={bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",justifyCenter:"Align text center",justifyLeft:"Align text left",justifyRight:"Align text right",justifyFull:"Justify",unorderedList:"Insert unordered list",orderedList:"Insert ordered list",indent:"Increase Indent",fileBrowser:"File Browser",outdent:"Decrease Indent",cut:"Cut",copy:"Copy",paste:"Paste",paragraph:"Paragraph",undo:"Undo",redo:"Redo",upperCase:"Upper Case",lowerCase:"Lower Case",clearAll:"Clear All",clearFormat:"Clear Format",createLink:"Insert/Edit Hyperlink",removeLink:"Remove Hyperlink",tableProperties:"Table Properties",insertTable:"Insert",deleteTables:"Delete",imageProperties:"Image Properties",openLink:"Open Hyperlink",image:"Insert image",video:"Insert video",editTable:"Edit Table Properties",embedVideo:"Paste your embed code below",viewHtml:"View HTML",fontName:"Select font family",fontSize:"Select font size",fontColor:"Select color",customFontColor:"More Colors...",customBGColor:"More Colors...",format:"Format",backgroundColor:"Background color",TransBGColor:"Transparent",style:"Styles",deleteAlert:"Are you sure you want to clear all the contents?",copyAlert:"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+C keyboard shortcut instead of copy operation.",pasteAlert:"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+V keyboard shortcut instead of paste operation.",cutAlert:"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X keyboard shortcut instead of cut operation.",videoError:"The text area can not be empty",imageWebUrl:"Web Address",imageAltText:"Alternate text",dimensions:"Dimensions",constrainProportions:"Constrain Proportions",linkWebUrl:"Web Address",imageLink:"Image as Link",imageBorder:"Image Border",imageStyle:"Style",linkText:"Text",linkTooltipLabel:"Tooltip",html5Support:"This tool icon only enabled in HTML5 supported browsers",linkOpenInNewWindow:"Open link in new window",tableColumns:"No.of Columns",tableRows:"No.of Rows",tableWidth:"Width",tableHeight:"Height",tableCellSpacing:"Cell spacing",tableCellPadding:"Cell padding",tableBorder:"Border",tableCaption:"Caption",tableAlignment:"Alignment",textAlign:"Text align",dialogUpdate:"Update",dialogInsert:"Insert",dialogCancel:"Cancel",dialogApply:"Apply",dialogOk:"Ok",createTable:"Insert Table",insertTable:"Insert",addColumnLeft:"Insert Columns to the Left",addColumnRight:"Insert Columns to the Right",addRowAbove:"Insert Rows Above",addRowBelow:"Insert Rows Below",deleteRow:"Delete entire row",deleteColumn:"Delete entire column",deleteTable:"Delete Table",customTable:"Create custom table...",characters:"Characters",words:"Words",w:"W",c:"C",general:"General",advanced:"Advanced",table:"Table",row:"Row",column:"Column",cell:"Cell",solid:"Solid",dotted:"Dotted",dashed:"Dashed",doubled:"Double",maximize:"Maximize",resize:"Minimize",swatches:"Swatches",paragraph:"Paragraph",quotation:"Quotation",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",segoeui:"Segoe UI",arial:"Arial",couriernew:"Courier New",georgia:"Georgia",impact:"Impact",lucidaconsole:"Lucida Console",tahoma:"Tahoma",timesnewroman:"Times New Roman",trebuchetms:"Trebuchet MS",verdana:"Verdana",disc:"Disc",circle:"Circle",square:"Square",number:"Number",loweralpha:"Lower Alpha",upperalpha:"Upper Alpha",lowerroman:"Lower Roman",upperroman:"Upper Roman",none:"None",linkTooltip:"ctrl + click to follow link",charSpace:"Characters (with spaces)",charNoSpace:"Characters (no spaces)",wordCount:"Word Count",left:"Left",right:"Right",center:"Center",zoomIn:"Zoom In",zoomOut:"Zoom Out",print:"Print","import":"Import a Document",wordExport:"Export as Word Document",pdfExport:"Export as Pdf File",FindAndReplace:"Find and Replace",Find:"Find",MatchCase:"Match Case",WholeWord:"Whole Word",ReplaceWith:"Replace with",Replace:"Replace",ReplaceAll:"Replace All",FindErrorMsg:"Couldn't find specified word.",FindOf:" of ",ReplaceCount:" occurrences were replaced."};t.RTE.ToolbarOverflowMode={Popup:"popup",Inline:"inline"}}(jQuery,Syncfusion),function(n,t){t.RTE=t.RTE||{};t.RTE.FindAndReplace={_findObject:null,_selectedIndex:-1,_findAndReplaceClick:function(t){var r=this._findDialog.element,e=n.trim(n(r).find("[ej-function='findtxt']").val()),o=t.target.tagName=="SPAN"||t.target.tagName=="DIV"?n(t.target).closest("button")[0]:t.target,s=n(r).find("[ej-function='replacetxt']").val(),u=this.getDocument().body,f=n(r).find("[ej-function='replace'],[ej-function='replaceAll']"),i=n(r).find("[ej-function='prev'],[ej-function='next']"),h;if(n(this._findDialog.element).children("span").html(""),!n(o).hasClass("e-disable"))switch(o.getAttribute("ej-function")){case"find":e?(this._findObject.find(e,u,!n(r).find("[ej-function='matchCase']")[0].checked,n(r).find("[ej-function='wholeWords']")[0].checked),this._selectedIndex=-1,this._findObject.nodeCollection.length?(n("#"+this._id+"_rtefindcount").html(""),this._findObject.nodeCollection.length>0?f.ejButton("enable"):f.ejButton("disable"),this._highlightNode(++this._selectedIndex,u),this._updateBtnStatus(this._selectedIndex,i)):(n.merge(i,f).ejButton("disable"),this._findObject.revertAll(),n(this._findDialog.element).children("span").html(this._getLocalizedLabels("FindErrorMsg")))):this._findObject.nodeCollection.length&&this._findObject.revertAll();break;case"next":this._selectedIndex<this._findObject.nodeCollection.length&&(n("#"+this._id+"_rtefindcount").html(""),this._highlightNode(++this._selectedIndex,u));this._updateBtnStatus(this._selectedIndex,i);break;case"prev":this._selectedIndex>0&&(n("#"+this._id+"_rtefindcount").html(""),this._highlightNode(--this._selectedIndex,u));this._updateBtnStatus(this._selectedIndex,i);break;case"replace":this._findObject.replaceByIndex(this._selectedIndex,s);this._findObject.nodeCollection.length?this._selectedIndex>this._findObject.nodeCollection.length-1&&--this._selectedIndex:(n("#"+this._id+"_rtefindcount").html(""),this._selectedIndex=-1);this._selectedIndex>-1?(n("#"+this._id+"_rtefindcount").html(""),this._highlightNode(this._selectedIndex,u),this._updateBtnStatus(this._selectedIndex,i)):n.merge(i,f).ejButton("disable");this._setBackupData();break;case"replaceAll":h=this._findObject.replaceAll(s);this._selectedIndex=-1;n("#"+this._id+"_rteReplaceCount").append(h+this._getLocalizedLabels("ReplaceCount"));n.merge(i,f).ejButton("disable");this._setBackupData()}this._updateCount()},_updateBtnStatus:function(t,i){t<this._findObject.nodeCollection.length-1?n(i[1]).ejButton("enable"):n(i[1]).ejButton("disable");t>0?n(i[0]).ejButton("enable"):n(i[0]).ejButton("disable")},_highlightNode:function(i,r){var u,f;for(n(r).find(".e-highlight").removeClass("e-highlight"),u=0;u<this._findObject.nodeCollection.length;u++)if(i==u)for(f=0;f<this._findObject.nodeCollection[u].length;f++)n(this._findObject.nodeCollection[u][f].node).addClass("e-highlight"),n(t.browserInfo().name=="msie"||t.browserInfo().name=="mozilla"?r.parentElement:r).scrollTop(n(this._findObject.nodeCollection[u][f].node).offset().top-25);n("#"+this._id+"_rtefindcount").append(i+this._getLocalizedLabels("FindOf")+this._findObject.nodeCollection.length)},_renderFindDialog:function(i){var r="<div id='"+this._id+"_basicDialog' title='"+this._getLocalizedLabels("FindAndReplace")+"'><div class='e-maincontent'><div class='e-fd-findcontent'><div class='e-fd-lable'><span>"+this._getLocalizedLabels("Find")+"<\/span><\/div><div class='e-txtbox'><input type='text' ej-function='findtxt' id='"+this._id+"_findtxt' class='e-js e-input'><\/div><div id='"+this._id+"_rtefindcount' class='e-rtefindcount'><\/div><\/div><div class='e-fd-InnerContent'><div><input type='checkbox' ej-function='matchCase' id='"+this._id+"_matchCase' value='true'><label for='"+this._id+"_matchCase' class='e-fd-checkboxlable' style=''>"+this._getLocalizedLabels("MatchCase")+"<\/label><\/div><div class='e-checkbx'><input type='checkbox' ej-function='wholeWords' id='"+this._id+"_wholeWords' value='true'><label for='"+this._id+"_wholeWords' class='e-fd-checkboxlable'>"+this._getLocalizedLabels("WholeWord")+"<\/label><\/div><\/div><div class='e-fd-replacecontent'><div class='e-fd-lable'><span>"+this._getLocalizedLabels("ReplaceWith")+"<\/span><\/div><div class='e-txtbox'><input type='text' ej-function='replacetxt' id='"+this._id+"_replacetxt' class='e-js e-input'><\/div><\/div><\/div><div id='"+this._id+"_rteReplaceCount' class='e-rteReplaceCount'><\/div><span style='text-align: center;'><\/span><div class='e-fd-btncol'><div class='e-btn-left'><button id='"+this._id+"_find' ej-function='find'>"+this._getLocalizedLabels("Find")+"<\/button><button id='"+this._id+"_replace' ej-function='replace'>"+this._getLocalizedLabels("Replace")+"<\/button><button id='"+this._id+"_replaceAll' class='ejRTE-replaceAll' ej-function='replaceAll'>"+this._getLocalizedLabels("ReplaceAll")+"<\/button><\/div><div class='e-btn-right'><button id='"+this._id+"_prev' ej-function='prev'><\/button><button id='"+this._id+"_next' ej-function='next'><\/button><\/div><\/div><\/div>";i._findDialog=n(r).ejDialog({width:"auto",minWidth:"300px",maxWidth:"380px",isResponsive:!0,close:this._onCloseFindAndReplace,cssClass:"e-rte e-findandreplace",enableRTL:i.model.enableRTL,enableResize:!1,enableModal:!0}).data("ejDialog");n(i._findDialog.element).find("input[type=text]").val("");n(i._findDialog.element).find("button").ejButton({height:30});n(i._findDialog.element).find("[ej-function='replace'],[ej-function='replaceAll'],[ej-function='prev'],[ej-function='next']").ejButton("disable");n(i._findDialog.element).find("[ej-function='prev'],[ej-function='next']").ejButton({height:30,width:30,contentType:"imageonly"});n(i._findDialog.element).find("[ej-function='prev']").ejButton({prefixIcon:"e-icon e-chevron-left_02"}).next().ejButton({prefixIcon:"e-icon e-chevron-right_02"});n(i._findDialog.element).find("[ej-function='wholeWords'],[ej-function='matchCase']").ejCheckBox({enableRTL:i.model.enableRTL,checked:!1});this._findObject=new t.FindAndReplace;this._on(i._findDialog.element.find("button"),"click",this._findAndReplaceClick)},_onCloseFindAndReplace:function(){n("#"+this._id.replace("_basicDialog","")).data("ejRTE")._findObject.revertAll();this.element.find("[ej-function='replace'],[ej-function='replaceAll'],[ej-function='prev'],[ej-function='next']").ejButton("disable");this.element.find("input[type=text]").val("");this.element.find("[ej-function='wholeWords'],[ej-function='matchCase']").ejCheckBox({checked:!1});this.element.children("span").html("");n(".e-rteReplaceCount").html("");n(".e-rtefindcount").html("")},_showFindAndReplace:function(){this._findDialog?this._findDialog.open():this._renderFindDialog(this)}}}(jQuery,Syncfusion),function(){ej.FindAndReplace=function(){this.indexLength=0;this.elements=[];this.matches=[];this.nodeCollection=[];this.specialChar=/([{}()|[\]\/\\.*+?^=!:$])/g;this.escapeContent="\\$1"};ej.FindAndReplace.prototype._addContentEscape=function(n){return String(n).replace(this.specialChar,this.escapeContent)};ej.FindAndReplace.prototype.find=function(n,t,i,r){return this.nodeCollection.length&&this.revertAll(),this._validateTextContent(n,this._getFormatedText(t),i,r),this.matches.length?(this._iterateNodes(t),this.matches=[],!0):!1};ej.FindAndReplace.prototype._replace=function(n,t){for(var i=0;i<n.length;i++)!i||!t?this._elementDefragment(n[i].node,t):$(n[i].node).remove()};ej.FindAndReplace.prototype.replaceByIndex=function(n,t){for(var r=[],i=0;i<this.nodeCollection.length;i++)i==n?this._replace(this.nodeCollection[i],t):r.push(this.nodeCollection[i]);this.nodeCollection=r};ej.FindAndReplace.prototype.replaceAll=function(n){for(var t=0;t<this.nodeCollection.length;t++)this._replace(this.nodeCollection[t],n);return this.nodeCollection=[],t};ej.FindAndReplace.prototype.revertAll=function(){for(var n=0;n<this.nodeCollection.length;n++)this._replace(this.nodeCollection[n]);this.nodeCollection=[]};ej.FindAndReplace.prototype._elementDefragment=function(n,t){var i=n.nextSibling,r=n.previousSibling;i&&r&&i.nodeType==3&&r.nodeType==3?(i=n.previousSibling,i.data=i.data+(t!=undefined?t:n.firstChild.data)+n.nextSibling.data,$(n.nextSibling).remove(),$(n).remove()):i&&i.nodeType==3?(i=n.nextSibling,i.data=(t!=undefined?t:n.firstChild.data)+i.data,$(n).remove()):r&&r.nodeType==3?(i=n.previousSibling,i.data=i.data+(t!=undefined?t:n.firstChild.data),$(n).remove()):(i=t!=undefined?document.createTextNode(t):n.firstChild,$(n).replaceWith(i))};ej.FindAndReplace.prototype._validateTextContent=function(n,t,i,r){for(var u=this._addContentEscape(n),f=new RegExp(r?"\\b"+u+"\\b":u,i?"gi":"g");data=f.exec(t);)this.matches.push({startIndex:data.index,endIndex:data.index+n.length});return this.matches};ej.FindAndReplace.prototype._traverseNode=function(n,t){if(n.nodeType===3&&(out=this._validateData(n,t),out.curNode&&(n=out.curNode),out.status))return!0;if(n=n.firstChild)do if(n.nodeType===3){if(out=this._validateData(n,t),out.curNode&&(n=out.curNode),out.status)return!0}else if(this._traverseNode(n,t))return!0;while(n=n.nextSibling);return!1};ej.FindAndReplace.prototype._validateData=function(n,t){var i=this.indexLength,r=this.indexLength+n.length;return this.indexLength=this.indexLength+n.length,i>=t.startIndex||t.startIndex<r?this._elementFragment(t,{startIndex:i,endIndex:r},n):{status:!1}};ej.FindAndReplace.prototype._elementFragment=function(n,t,i){var u=i.data,r=i,f,e;if(n.startIndex<=t.startIndex&&n.endIndex>=t.endIndex)r=ej.buildTag("span.e-selected-node").append(document.createTextNode(i.data))[0],$(i).replaceWith(r),this.elements.push({node:r});else if(n.startIndex<=t.startIndex&&n.endIndex<t.endIndex)f=n.endIndex-n.startIndex,e=ej.buildTag("span.e-selected-node").append(document.createTextNode(u.substr(0,f)))[0],$(e).insertBefore(i),i.data=u.substr(f),this.elements.push({node:e});else if(n.startIndex>t.startIndex&&n.endIndex>=t.endIndex)f=n.startIndex-t.startIndex,r=ej.buildTag("span.e-selected-node").append(document.createTextNode(u.substr(f)))[0],$(r).insertAfter(i),i.data=u.substr(0,f),this.elements.push({node:r});else if(n.startIndex>t.startIndex&&n.endIndex<t.endIndex){var o=n.startIndex-t.startIndex,s=o+(n.endIndex-n.startIndex),e=ej.buildTag("span.e-selected-node").append(document.createTextNode(u.substring(o,s)))[0];r=document.createTextNode(u.substring(s));i.data=u.substr(0,o);$(r).insertAfter(i);$(e).insertAfter(i);this.elements.push({node:e})}return{status:n.endIndex>t.startIndex&&n.endIndex<=t.endIndex,curNode:r}};ej.FindAndReplace.prototype._getFormatedText=function(n){var t="";if(n.nodeType===3)return n.data.replace(/\n/g," ");if(n=n.firstChild)do t+=n.nodeType===3?n.data.replace(/\n/g," "):this._getFormatedText(n);while(n=n.nextSibling);return t};ej.FindAndReplace.prototype._iterateNodes=function(n){temp=this;$(this.matches).each(function(t,i){temp._traverseNode(n,i);temp.nodeCollection.push(temp.elements);temp.indexLength=0;temp.elements=[]})}}();ej.RTE.FindAndReplace&&$.extend(ej.RTE.prototype,ej.RTE.FindAndReplace);clipboardCleaner=function(){function n(n,t,i){function u(n){if(r.CleanerState&&(r._pasteHandler(n),r.syncLoad))return n.preventDefault(),n.stopPropagation(),!1}function f(n){r.CleanerState&&r._keydownHandler(n)}this.CleanerState=!0;this.syncLoad=!1;this.listContents=[];this.blockNode=["div","p","h1","h2","h3","h4","h5","h6","address","blockquote","button","center","dd","dir","dl","dt","fieldset","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this.flagState=!0;this.content=null;this.htmlContent="";this.insertCleanedContent=!0;this.filterOptions={listConversion:!0,cleanCSS:!0,removeStyles:!1,cleanElements:!0};this.Collection=[];this.blockqouteNodes=[];this.tempCleaner=[];this.ignorableNodes=["A","APPLET","B","BLOCKQUOTE","BR","BUTTON","CENTER","CODE","COL","COLGROUP","DD","DEL","DFN","DIR","DIV","DL","DT","EM","FIELDSET","FONT","FORM","FRAME","FRAMESET","H1","H2","H3","H4","H5","H6","HR","I","IMG","IFRAME","INPUT","INS","LABEL","LI","OL","OPTION","P","PARAM","PRE","Q","S","SELECT","SPAN","STRIKE","STRONG","SUB","SUP","TABLE","TBODY","TD","TEXTAREA","TFOOT","TH","THEAD","TITLE","TR","TT","U","UL"];this.listNodes=[];this.ulData=["disc","square","circle","disc","square","circle"];this.olData=["decimal","lower-alpha","lower-roman","upper-alpha","upper-roman","lower-greek"];var r=this;this.callback=t;this.env=i;this.currentDocument=n;this._isIE()&&(this.currentDocument.body.addEventListener?this.currentDocument.body.addEventListener("keydown",f):this.currentDocument.body.attachEvent("onkeydown",f));this.currentDocument.body.addEventListener?this.currentDocument.body.addEventListener("paste",u):this.currentDocument.body.attachEvent("onpaste",u)}return n.prototype._keydownHandler=function(n,t){t===void 0&&(t=!1);(this._isIE()&&n.ctrlKey&&!n.shiftKey&&n.keyCode==86&&this.flagState||t)&&(this.flagState=!1,this._setContent())},n.prototype._setContent=function(){var u=this,n,i,r,t;this.content=this.currentDocument.createElement("div");i=this.currentDocument.createElement("P");this.content.id="ClipboardData";this.content.style.position="absolute";this.content.style.height="10px";this.content.style.width="10px";this.content.style.overflow="hidden";this.content.style.top="-3000px";n=this.currentDocument.createTextNode("PastedContent");ej.browserInfo().name=="chrome"?(i.appendChild(n),this.content.appendChild(i)):this.content.appendChild(n);window.getSelection&&(r=this.currentDocument.getSelection(),r.rangeCount>0&&(t=r.getRangeAt(0),t.deleteContents(),t.collapse(!0),t.insertNode(this.content),this._updateRange(n,0,n.textContent.length),this.content.focus(),this.syncLoad=!1))},n.prototype._insertContent=function(n){var t;n===void 0&&(n=!0);var r=this.currentDocument.createElement("span"),i=[],u,f=this.currentDocument.createElement("p");if(r.appendChild(u=this.currentDocument.createTextNode(String.fromCharCode(65279))),f.appendChild(r),this._finalCleanup(this.Container),this.Container.appendChild(f),this._isIE()&&n){for(i=[],t=this.Container.childNodes.length-1;t>-1;t--)i.push(this.Container.childNodes.item(t));for(t=0;t<i.length;t++)this._insertAfter(this.content,i[t]);this.content.removeNode(!0)}else this._contentPositionHandler();$(ej.browserInfo().name=="msie"||ej.browserInfo().name=="mozilla"?this.currentDocument.body.parentNode:this.currentDocument.body).scrollTop($(r).offset().top-25);this.callback.call(this.env);this._updateRange(u,0,u.textContent.length)},n.prototype._insertAfter=function(n,t){n.nextSibling?n.parentElement.insertBefore(t,n.nextSibling):n.parentElement.appendChild(t)},n.prototype._findValidListType=function(n){if(n.nodeType==3&&n.textContent.trim().length>0&&this.listContents.push(n.textContent),n=n.firstChild)do this._findValidListType(n);while(n=n.nextSibling)},n.prototype._createNodeCollection=function(n){for(var t=this.currentDocument.createElement(n.shift()),r,i=t;r=n.shift();)t=this.currentDocument.createElement(r).appendChild(t);return{leaf:i,root:t}},n.prototype._contentPositionHandler=function(){var s=this.currentDocument.getSelection(),n,r,h=[],u=[],f,e,o,t,i;if(s.rangeCount>0)if(this.content&&(e=this.currentDocument.createRange(),o=this.currentDocument.getSelection(),e.selectNode(this.content),o.removeAllRanges(),o.addRange(e)),t=s.getRangeAt(0),t.startContainer==t.endContainer){if(t.startOffset!=t.endOffset&&t.deleteContents(),t.insertNode(this.Container),n=this.Container.parentNode,n.nodeName.toLowerCase()!="body"){do h.push(n.nodeName.toLowerCase());while(this.blockNode.indexOf(n.nodeName.toLowerCase())==-1&&(n=n.parentElement));for(f=this._createNodeCollection(h),n&&(n.nextSibling?n.parentElement.insertBefore(f.root,n.nextSibling):n.parentElement.appendChild(f.root)),n=this.Container;n=n.nextSibling;)f.leaf.appendChild(n);this._insertAfter(this.Container.parentElement,this.Container)}for(i=0;i<this.Container.childNodes.length;i++)u.push(this.Container.childNodes[i]);while(r=u.shift())this.Container.parentElement.insertBefore(r,this.Container)}else{for(t.deleteContents(),t.insertNode(this.Container),i=0;i<this.Container.childNodes.length;i++)u.push(this.Container.childNodes[i]);while(r=u.shift())this.Container.parentElement.insertBefore(r,this.Container)}this._remove(this.Container);this._remove(this.content);this.content=null},n.prototype._updateRange=function(n,t,i){var r=this.currentDocument.createRange(),u=this.currentDocument.getSelection();r.setStart(n,t);r.setEnd(n,i);u.removeAllRanges();u.addRange(r)},n.prototype._pasteHandler=function(n){this.clipboardData={plain:null,rtf:null,html:null};this.syncLoad=!1;this._isIE()?this._extractClipboardIE(n):(this._fillClipboard(n),this._extractClipboardNonIE(n))},n.prototype._isIE=function(){return navigator.userAgent.match(/Trident|msie/i)!=null},n.prototype._extractClipboardNonIE=function(n){if(this.clipboardData.html)this.content=null,this.htmlContent=this.clipboardData.html,this._processContent(n);else if(ej.browserInfo().name=="chrome"&&this.clipboardData.plain){var u=this.currentDocument.createElement("div"),r,i=this.clipboardData.plain.split("\n"),t=this.currentDocument.createElement("p");if(i.length)while(r=i.shift())t.appendChild(this.currentDocument.createTextNode(r)),i.length&&t.appendChild(this.currentDocument.createElement("br"));else t.appendChild(this.currentDocument.createTextNode(this.clipboardData.plain));this.htmlContent=t.innerHTML;this._processContent(n,!1)}else n&&n.clipboardData&&n.clipboardData.items.length?this.callback.call(this.env,n):(this._setContent(),this._contentUpdater())},n.prototype._extractClipboardIE=function(){this._contentUpdater()},n.prototype._contentUpdater=function(){var n=this;setTimeout(function(){n.content&&(n.clipboardData.html=n.htmlContent=n.content.innerHTML);n.flagState||(n.flagState=!0);n._processContent()},0)},n.prototype._fillClipboard=function(n){this.clipboardData.html=n.clipboardData.getData("text/html")?n.clipboardData.getData("text/html"):null;this.clipboardData.plain=n.clipboardData.getData("text/plain")?n.clipboardData.getData("text/plain"):null;this.clipboardData.rtf=n.clipboardData.getData("text/rtf")?n.clipboardData.getData("text/rtf"):null},n.prototype._processContent=function(n,t){var r;n===void 0&&(n=null);t===void 0&&(t=!0);var i=this.currentDocument.createElement("p"),e=this,u=!0,f=this.currentDocument.createElement("p");if(/class="?Mso|style="[^ ]*\bmso-/i.test(this.htmlContent)&&t)this.htmlContent=this.htmlContent.replace(/<img[^>]+>/i,""),i.innerHTML=this.htmlContent,this.syncLoad=!0,this.Collection=[],this.blockqouteNodes=[],this.listNodes=[],this._cleanup(i),this._flush(),this.filterOptions.listConversion&&this._listConverter(),this.filterOptions.cleanElements&&(this._blockquoteConvert(),this._cleanElement(i),this._flush()),this.filterOptions.cleanCSS&&(this._cleanStyles(i),this._flush(!1)),this.Container=i,this.insertCleanedContent&&this._insertContent();else{if(this.syncLoad=!0,i.innerHTML=this.htmlContent,this.filterOptions.cleanCSS&&(this._cleanStyles(i),this._flush(!1)),i.childNodes.length){for(r=0;r<i.childNodes.length;r++)this.blockNode.indexOf(i.childNodes[r].nodeName.toLowerCase())!=-1&&(u=!1);u&&(f.appendChild(i),i=f)}this.Container=i;this.insertCleanedContent&&this._insertContent(!u)}},n.prototype._flush=function(n){var t,r,i;if(n===void 0&&(n=!0),r=[],n)while(t=this.tempCleaner.shift())this._remove(t);else while(t=this.tempCleaner.shift()){if(t.childNodes.length){for(r=[],i=0;i<t.childNodes.length;i++)r.push(t.childNodes[i]);for(i=0;i<r.length;i++)t.parentElement.insertBefore(r[i],t)}this._remove(t)}},n.prototype._makeConvertion=function(){for(var u=this.currentDocument.createElement("div"),i,f=1,t,e=0,r,n=0;n<this.Collection.length;n++){if(this.Collection[n].level==1&&e==0)this.Collection[n].content&&(u.appendChild(i=this.currentDocument.createElement(this.Collection[n].type)),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level));else if(this.Collection[n].level==f)t.parentElement.tagName.toLowerCase()==this.Collection[n].type?(t.parentElement.appendChild(t=this.currentDocument.createElement("li")),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent))):(i=this.currentDocument.createElement(this.Collection[n].type),this._insertAfter(t.parentElement,i),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()));else if(this.Collection[n].level>f)t.appendChild(i=this.currentDocument.createElement(this.Collection[n].type)),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),t.style.marginLeft=(this.Collection[n].level-f-1)*40+"px",i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level);else if(this.Collection[n].level==1)u.lastChild.tagName.toLowerCase()==this.Collection[n].type?i=u.lastChild:u.appendChild(i=this.currentDocument.createElement(this.Collection[n].type)),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level);else for(r=t;r=r.parentElement;){if(r.attributes.getNamedItem("level"))if(parseInt(r.attributes.getNamedItem("level").textContent)==this.Collection[n].level){r.tagName.toLowerCase()==this.Collection[n].type?(t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),r.appendChild(t)):(i=this.currentDocument.createElement(this.Collection[n].type),this._insertAfter(t.parentElement,i),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level));break}else if(this.Collection[n].level>parseInt(r.attributes.getNamedItem("level").textContent)){r.appendChild(i=this.currentDocument.createElement(this.Collection[n].type));t=this.currentDocument.createElement("li");t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent));i.appendChild(t);t.style.marginLeft=(this.Collection[n].level-parseInt(r.attributes.getNamedItem("level").textContent)-1)*40+"px";i.setAttribute("level",this.Collection[n].level.toString());i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level);break}continue}f=this.Collection[n].level;e++}return u},n.prototype._listConverter=function(){for(var i,r,e,o,t,s,u=[],f=[],n=0;n<this.listNodes.length;n++){if(this.listNodes[n]==null){u.push({content:this._makeConvertion(),node:this.listNodes[n-1]});this.Collection=[];continue}r=this.listNodes[n].attributes.getNamedItem("style").textContent;e=r&&r.indexOf("level")!=-1?parseInt(r.charAt(r.indexOf("level")+5)):1;this.listContents=[];this._findValidListType(this.listNodes[n]);o=this.listContents[0].length>1?"ol":"ul";s=this.listContents[1]?this.currentDocument.createTextNode(this.listContents[1]):this.currentDocument.createTextNode("");this.Collection.push({type:o,content:s,level:e})}while((t=this.listNodes.shift())?t:t=this.listNodes.shift()){for(f=[],i=0;i<u.length;i++)if(u[i].node==t){for(n=0;n<u[i].content.childNodes.length;n++)f.push(u[i].content.childNodes[n]);for(n=0;n<f.length;n++)t.parentElement.insertBefore(f[n],t);break}t.remove&&t.remove();t.removeNode&&t.removeNode(!0)}},n.prototype._blockquoteConvert=function(){for(var t,r,i=[],n=0;n<this.blockqouteNodes.length;n++){if(r=this.currentDocument.createElement("blockquote"),i=[],this.blockqouteNodes[n].childNodes&&this.blockqouteNodes[n].childNodes.length){for(t=0;t<this.blockqouteNodes[n].childNodes.length;t++)i.push(this.blockqouteNodes[n].childNodes.item(t));for(t=0;t<i.length;t++)r.appendChild(i[t])}this.blockqouteNodes[n].parentElement.insertBefore(r,this.blockqouteNodes[n]);this.blockqouteNodes[n].remove&&this.blockqouteNodes[n].remove();this.blockqouteNodes[n].removeNode&&this.blockqouteNodes[n].removeNode(!0)}},n.prototype._cleanup=function(n){for(var i,t=0;t<n.childNodes.length;t++){if(this.ignorableNodes.indexOf(n.childNodes[t].nodeName)==-1||n.childNodes[t].nodeType==3&&n.childNodes[t].textContent.trim()==""){this.tempCleaner.push(n.childNodes[t]);continue}else n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msoquote")!=-1?this.blockqouteNodes.push(n.childNodes[t]):n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msolistparagraph")!=-1&&this.listNodes.push(n.childNodes[t]);!i||this.blockNode.indexOf(n.childNodes[t].nodeName.toLowerCase())==-1||n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msolistparagraph")!=-1||this.listNodes.push(null);this.blockNode.indexOf(n.childNodes[t].nodeName.toLowerCase())!=-1&&(i=n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msolistparagraph")!=-1?!0:!1)}this.listNodes.length&&this.listNodes[this.listNodes.length-1]!=null&&this.listNodes.push(null)},n.prototype._finalCleanup=function(n){for(var i,r=[],t=0;t<n.childNodes.length;t++)n.childNodes[t]&&n.childNodes[t].nodeType!=3&&this.blockNode.indexOf(n.childNodes[t].nodeName.toLowerCase())!=-1&&n.childNodes[t].innerHTML&&n.childNodes[t].innerHTML.trim()==""&&r.push(n.childNodes[t]);while(i=r.shift())this._remove(i)},n.prototype._getlistStyle=function(n,t){return t=t>0?t-1:t,n=="ol"?t<this.olData.length?this.olData[t]:this.olData[0]:t<this.ulData.length?this.ulData[t]:this.ulData[0]},n.prototype._cleanElement=function(n){if(n.nodeType==3?n.textContent.trim()==""&&this.tempCleaner.push(n):n&&this.ignorableNodes.indexOf(n.nodeName)==-1&&this.tempCleaner.push(n),n=n.firstChild)do this._cleanElement(n);while(n=n.nextSibling)},n.prototype._cleanStyles=function(n){if(n&&n.nodeType!=3&&(this._cleanCSSClass(n),this._cleanCSSStyle(n),n.nodeName!="SPAN"||n.attributes.getNamedItem("style")||n.attributes.getNamedItem("class")?n.nodeName=="FONT"&&this.filterOptions.removeStyles&&this.tempCleaner.push(n):this.tempCleaner.push(n)),n=n.firstChild)do this._cleanStyles(n);while(n=n.nextSibling)},n.prototype._cleanCSSClass=function(n){var t;if(n.attributes&&n.attributes.getNamedItem("class")&&(this.filterOptions.cleanCSS||this.filterOptions.removeStyles)){var i=n.className.split(" "),r="",u=void 0;for(t=0;t<i.length;t++)i[t].toLowerCase().indexOf("mso")==-1&&this.filterOptions.cleanCSS&&(r+=i[t]+" ");r.length&&!this.filterOptions.removeStyles?(u=this.currentDocument.createAttribute("class"),u.value=r,n.attributes.setNamedItem(u)):n.attributes.removeNamedItem("class")}},n.prototype._cleanCSSStyle=function(n){var t;if(n.attributes&&n.attributes.getNamedItem("style")&&(this.filterOptions.cleanCSS||this.filterOptions.removeStyles)){var i=n.attributes.getNamedItem("style").textContent.split(";"),r="",u=void 0;for(t=0;t<i.length;t++)i[t].toLowerCase().indexOf("mso")==-1&&(r+=i[t]+";");r.length&&!this.filterOptions.removeStyles?(u=this.currentDocument.createAttribute("style"),u.value=r,n.attributes.setNamedItem(u)):n.attributes.removeNamedItem("style");!n.attributes.getNamedItem("align")||n.tagName==="FONT"||n.attributes.removeNamedItem("align")}},n.prototype._remove=function(n){n&&(n.remove?n.remove():n.removeNode?n.removeNode(!0):n.textContent&&(n.textContent=""))},n}();$.extend(ej,{clipboardCleaner:clipboardCleaner});window.ClipboardCleaner=undefined,function(n){var u=function(){function n(n,t){this.formatInfo=new o;this._nodeCollection=[];this._iterationStatus=!1;this.filterNode=["div","p","h1","h2","h3","h4","h5","h6","address","applet","blockquote","button","center","dd","dir","dl","dt","fieldset","form","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","script","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this.advanceFilterNode=["img","video","table","tbody","tr","td","th"];this.indentFilter=["img","video"];this._junkSpanNodes=[];this.currentDocument=n;this.currentWindow=t;this._rangeExtract=new s(this.currentDocument);this._bindEvent()}return n.prototype._bindEvent=function(){$(this.currentDocument.body).on("keydown",$.proxy(this._editorKeyUpEvent,this))},n.prototype._editorKeyUpEvent=function(n){if(this._junkContentStatus){var t=this._getRangy(this.currentWindow,this.currentDocument),i=t.startContainer,r=t.startOffset;!n.shiftKey&&n.which>=37&&n.which<=40&&i.nodeType==3&&(this._junkContentStatus=!1,this._iterateCompleteNode(i,n,r))}},n.prototype._iterateCompleteNode=function(n,t,i){var r=n.data.length;this._junkSpanNodes=[];this._removeJunkContent(this.currentDocument.body);this._collectJunkSpanNodes(this.currentDocument.body);this._removeJunkSpanNodes();r>n.data.length&&i--;n.data||$(n).remove();n.data.trim()&&this._updateCursor(n,i)},n.prototype._collectJunkSpanNodes=function(n){var t=n;if($(t).is("span")&&!$(t).attr("style")&&this._junkSpanNodes.push(t),t=t.firstChild)do $(t).is("span")&&!$(t).attr("style")&&this._junkSpanNodes.push(t),this._collectJunkSpanNodes(t);while(t=t.nextSibling)},n.prototype._removeJunkSpanNodes=function(){for(var n;n=this._junkSpanNodes.shift();)n.childNodes.length?$(n).replaceWith(n.childNodes):$(n).remove()},n.prototype._removeJunkContent=function(n){var t=n;if(t.nodeType==3&&this._removeCursorText(t),t=t.firstChild)do t.nodeType==3?this._removeCursorText(t):this._removeJunkContent(t);while(t=t.nextSibling)},n.prototype._removeCursorText=function(n){n.data=n.data.replace(String.fromCharCode(65279),"")},n.prototype.focus=function(){var n=this;setTimeout(function(){var t=ej.browserInfo();t.name=="webkit"?n.currentWindow.focus():n.currentWindow.document.body.focus()},100)},n.prototype._justifyContent=function(n){this._backUpRange(this.currentDocument,this.currentWindow);this._getModifedRange(this._getRangy(this.currentWindow,this.currentDocument));this._onApplyjustify(n,this.currentDocument,this.currentWindow);this._resetRange(this.currentDocument,this.currentWindow)},n.prototype._applyFormateBlock=function(n){var t=this._getRangy(this.currentWindow,this.currentDocument);this._backUpRange(this.currentDocument,this.currentWindow);this._applyChanges(n,this.currentDocument,this.currentWindow);this._resetRange(this.currentDocument,this.currentWindow);this._selectionRange=this._getRangy(this.currentWindow,this.currentDocument)},n.prototype._applyList=function(n,t){this._backUpRange(this.currentDocument,this.currentWindow);this._getModifedRange(this._getRangy(this.currentWindow,this.currentDocument));this._applyOrderedList(n.toLowerCase()=="orderlist"?"ol":"ul",this.currentDocument,this.currentWindow,t);this._resetRange(this.currentDocument,this.currentWindow)},n.prototype._applyIndent=function(n){this._backUpRange(this.currentDocument,this.currentWindow);this._getModifedRange(this._getRangy(this.currentWindow,this.currentDocument));n?this._onApplyIndent(this.currentDocument,this.currentWindow):this._onApplyDecreaseIndent(this.currentDocument,this.currentWindow);this._resetRange(this.currentDocument,this.currentWindow)},n.prototype._getRangy=function(n,t){if(n.getSelection()&&n.getSelection().rangeCount>0)return n.getSelection().getRangeAt(0);var i;try{i=n.document.createRange();i.setStart(n.document.body,0);i.setEnd(n.document.body,0)}catch(r){i=t.createRange();i.setStart(t.body,0);i.setEnd(t.body,0)}return i},n.prototype._getexactSelectedNode=function(n,t){function e(n){if(n.nodeType==3&&($.trim(n.nodeValue)!=""||n.nodeValue==""||$.trim(n.nodeValue)==""&&n.nextSibling==f[0]))i.push(n);else if(n.nodeValue&&n.nodeName!="#comment"&&n.nodeValue.trim()==""&&r.range.endContainer.parentNode.nextSibling!=r._next)$.inArray(n.previousElementSibling,u)<0&&u.push(n.previousElementSibling);else if((n.nodeName.toLowerCase()=="br"||$.inArray(n.nodeName.toLowerCase(),r.filterNode)<0)&&$.inArray(n.parentNode,i)<0&&n.nodeName.toLowerCase()!="body"&&$.inArray(n.nodeName.toLowerCase(),r.advanceFilterNode)<0&&!ej.isNullOrUndefined(i[i.length-1])&&i[i.length-1].parentNode!=n.parentNode&&n.previousSibling&&n.previousSibling.parentNode!=n.parentNode)i.push(n.parentNode);else if($.inArray(n.nodeName.toLowerCase(),r.advanceFilterNode)>=0&&ej.isNullOrUndefined(n.firstChild))i.push(n);else for(n=n.firstChild;n;)e(n),n=n.nextSibling}var i=[],u=[],f,r;return this._parentDoc=t,f=$(this._parentDoc.body).find("span#startRange"),r=this,this._generateRange(n),this._traverse(e),i},n.prototype._getStartEndElement=function(n,t){if(this._isAncestor(t,n))while(n&&n.parentNode!=t)n=n.parentNode;return n},n.prototype._generateRange=function(n){var t=n.commonAncestorContainer;this._next=n.startContainer==t&&!this._isTextNode(n.startContainer)?n.startContainer.childNodes[n.startOffset]:this._getStartEndElement(n.startContainer,t);this._end=n.endContainer==t&&!this._isTextNode(n.endContainer)?n.endContainer.childNodes[n.endOffset]:this._getStartEndElement(n.endContainer,t).nodeName.toLowerCase()!="body"&&this._getStartEndElement(n.endContainer,t).nextSibling},n.prototype._traverse=function(n){function u(){return t._next!=(t._isTextNode(t.range.endContainer)?t.range.endContainer.parentNode.nextSibling:t.range.endContainer.nextElementSibling)&&t.range.endContainer.parentNode.nextSibling!=t._next?(t._current=t._next,t._next=t._current&&t._current.nextSibling!=$(t._parentDoc.body).find("span#endRange")[0]&&t._current.nextSibling!=(ej.isNullOrUndefined(t._end)?t.range.endContainer.nextSibling:t._end)?t._current.nextSibling:null,t._current):null}for(var t=this,r,i;r=u();)if(t._hasSubNodes())t._getSubtree(t._getRangy(t.currentWindow,t.currentDocument)),t._traverse(n);else{if(i=r,t.range.startContainer.nodeName.toLowerCase()!="body"&&t._next==null&&i!=t.range.endContainer)while(ej.isNullOrUndefined(t._next)&&!ej.isNullOrUndefined(i))i=i.parentNode,ej.isNullOrUndefined(i)||t._current.nextSibling==$(t._parentDoc.body).find("span#endRange")[0]||(t._next=i.nextSibling);n(r)}return r},n.prototype._hasSubNodes=function(){return!this._isTextNode(this._current)&&(this._isAncestorItself(this._current,this.range.startContainer)||this._isAncestorItself(this._current,this.range.endContainer))},n.prototype._isTextNode=function(n){return n&&n.nodeValue!==null&&n.data!==null},n.prototype._isAncestor=function(n,t){try{return!this._isTextNode(n)&&($.contains(n,this._isTextNode(t)?t.parentNode:t)||t.parentNode==n)}catch(i){return!1}},n.prototype._isAncestorItself=function(n,t){return this._isAncestor(n,t)||n==t},n.prototype._getSubtree=function(){var n=this,t=n.range.cloneRange();return t.selectNodeContents(n._current),n._isAncestorItself(n._current,n.range.startContainer)&&t.setStart(n.range.startContainer,n.range.startOffset),n._isAncestorItself(n._current,n.range.endContainer)&&t.setEnd(n.range.endContainer,n.range.endOffset),this._generateRange(t)},n.prototype._getModifedRange=function(n){if(n.endOffset==0&&n.startContainer!=n.endContainer){var t=n.endContainer;do t=ej.isNullOrUndefined(n.endContainer.previousSibling)?t.parentNode:t;while(ej.isNullOrUndefined(t.previousSibling));this._isTextNode(t.previousSibling)&&$.trim(t.previousSibling.textContent).length!=0?n.setEnd(t.previousSibling,t.previousSibling.childNodes.length):n.setEnd(t.previousSibling,t.previousSibling.childNodes.length)}},n.prototype._getSelectedParent=function(n){for(var r=[],i=n,t=0;t<i.length;t++){if(this._isTextNode(i[t])){while(i[t]&&i[t].parentNode&&i[t].parentNode.nodeName.toLowerCase()!="body"&&$.inArray(i[t].parentNode.nodeName.toLowerCase(),this.filterNode)<0)i[t]=i[t].parentNode;i[t].parentNode.nodeName.toLowerCase()=="body"&&r.push(this._updateParent(i[t]))}i[t]&&i[t].parentNode&&i[t].parentNode.nodeName.toLowerCase()!="body"&&$.inArray(i[t].parentNode,r)<0&&(i[t].parentNode.nodeName.toLowerCase()!="body"&&i[t].nodeName.toLowerCase()!="img"&&i[t].nodeName.toLowerCase()!="video"?r.push(i[t].parentNode):r.push(i[t]))}return r},n.prototype._updateParent=function(n){for(var i=[n],t=n,u,f,r=document.createElement("div");t=t.previousSibling;)if($.inArray(t.nodeName.toLowerCase(),this.filterNode)!=-1){u=t;break}else i.push(t);for(i=i.reverse(),t=n;t=t.nextSibling;)if($.inArray(t.nodeName.toLowerCase(),this.filterNode)!=-1){f=t;break}else i.push(t);return $(i).appendTo(r),u?$(r).insertAfter(u):f?$(r).insertBefore(f):$(r).appendTo(this.currentDocument.body),r},n.prototype._applyChanges=function(n,t,i){var h,o;this.range=this._getRangy(i,t);var y=this._getexactSelectedNode(this.range,t),l=y.slice(),u=document.createElement(n.substring(n.indexOf("<")+1,n.indexOf(">")));if(l.length==0&&this.range.startContainer.nodeName.toLowerCase()=="body"&&this.range.endContainer.nodeName.toLowerCase()=="body"&&this.range.commonAncestorContainer.nodeName.toLowerCase()=="body"&&this._parentDoc.body.innerHTML=="")this.focus(),u.innerHTML=" ",this._parentDoc.body.innerHTML=u.outerHTML;else{h=this._getSelectedParent(l);o=[];o.push(l[0]);for(var a=this._getSelectedParent(o)[0],f=[],e=0,c=document.createElement("div"),d=document.createElement("div"),g=this._getSelectedParent(o)[0],p,r,w,b,v,k,s=0;s<h.length;s++){if(o=[],o.push(h[s]),a=this._getSelectedParent(o)[0],$(h[s]).attr("style")&&$(u).attr("style",$(h[s]).attr("style")),$.inArray(a,f)>=0||(f.push(a),u.innerHTML.length!=0&&(f[e].nodeName.toLowerCase()!="td"&&f[e].nodeName.toLowerCase()!="tr"&&f[e].nodeName.toLowerCase()!="tbody"&&f[e].nodeName.toLowerCase()!="li"&&f[e].nodeName.toLowerCase()!="body"?$(f[e]).replaceWith(u.outerHTML):f[e].nodeName.toLowerCase()!="tr"&&f[e].nodeName.toLowerCase()!="tbody"&&($(f[e]).prepend("<div><\/div>"),c.innerHTML=u.outerHTML,f[e].replaceChild(c.firstChild,f[e].firstChild)),e++),u.innerHTML="",c.innerHTML=""),r=h[s],b=!1,ej.isNullOrUndefined(r.parentNode)||(w=r.nodeName.toLowerCase()=="li"),!ej.isNullOrUndefined(r)){for(v=r;v.childNodes.length!=0;)if($.inArray(r.firstChild.nodeName.toLowerCase(),this.filterNode)<0)while(r.firstChild&&$.inArray(r.firstChild.nodeName.toLowerCase(),this.filterNode)<0)$(u).append(v.childNodes[0]);else break;k=r.previousSibling}p=r.parentNode;u.innerHTML.length!=0&&(r.nodeName.toLowerCase()!="td"&&r.nodeName.toLowerCase()!="tr"&&r.nodeName.toLowerCase()!="tbody"&&r.nodeName.toLowerCase()!="li"&&r.nodeName.toLowerCase()!="body"?$(r).replaceWith(u.outerHTML):r.nodeName.toLowerCase()!="tr"&&r.nodeName.toLowerCase()!="tbody"&&($(r).prepend("<div><\/div>"),c.innerHTML=u.outerHTML,r.replaceChild(c.firstChild,r.firstChild)),e++);u.innerHTML="";c.innerHTML="";$(u).removeAttr("style")}}},n.prototype._validateIndent=function(n){var t=!1;do $(n).attr("style")&&parseInt($(n).css("margin-left"))>0&&(t=!0);while((n=n.parentNode)&&!$(n).is("body"));return t},n.prototype._validateFontSize=function(n){var t=parseInt($(n.nodeType==3?n.parentNode:n).css("font-size"));return Math.round(t*(3/4))+"pt"},n.prototype._onApplyIndent=function(n,t){var i;this.range=this._getRangy(t,n);var e=this._getexactSelectedNode(this.range,n),u,f=e.slice(),r=this._getSelectedParent(f);if(f.length!=0||this.range.startContainer.nodeName.toLowerCase()!="body"||this.range.endContainer.nodeName.toLowerCase()!="body"||this.range.commonAncestorContainer.nodeName.toLowerCase()!="body"||this._parentDoc.body.innerHTML!="")for(i=0;i<=r.length-1;i++)r[i].nodeName.toLowerCase()=="td"&&($(r[i]).append($(u=document.createElement("p")).append(r[i].childNodes)),r[i]=u),r[i].nodeName.toLowerCase()!="li"?$(r[i]).css("margin-left",40+parseInt($(r[i]).css("margin-left"))+"px"):$(r[i]).prev().length==0?$(r[i].parentNode).css("margin-left",parseInt($(r[i].parentNode).css("margin-left"))+40+"px"):$(r[i]).css("margin-left",parseInt($(r[i]).css("margin-left"))+40+"px")},n.prototype._onApplyDecreaseIndent=function(n,t){var i;this.range=this._getRangy(t,n);var u=this._getexactSelectedNode(this.range,n),f=u.slice(),r=this._getSelectedParent(f);for(i=0;i<=r.length-1;i++)parseInt($(r[i]).css("margin-left"))>=40&&r[i].nodeName.toLowerCase()!="li"?$(r[i]).css("margin-left",parseInt($(r[i]).css("margin-left"))-40):$(r[i]).prev().length==0&&parseInt($(r[i].parentNode).css("margin-left"))>=40?$(r[i].parentNode).css("margin-left",parseInt($(r[i].parentNode).css("margin-left"))-40):parseInt($(r[i]).css("margin-left"))>=40&&$(r[i]).css("margin-left",parseInt($(r[i]).css("margin-left"))-40)},n.prototype._getNodeName=function(n){return this._isTextNode(n)?"#text":n.nodeName.toLowerCase()},n.prototype._onApplyjustify=function(n,t,i){var h,u,r,f,s,e,o;for(this.range=this._getRangy(i,t),h=this._getexactSelectedNode(this.range,t),u=this._getSelectedParent(h),r=0;r<u.length;r++)if(f=document.createElement("div"),u[r].nodeName.toLowerCase()=="li"){for(s=$(u[r]).children(),e=0,o=0;o<s.length;o++)$.inArray(this._getNodeName(s[o]),this.filterNode)>0&&e++;if(e>0)while(u[r].childNodes.length>0)if(this._isTextNode(u[r].childNodes[0])||$.inArray(this._getNodeName(u[r].childNodes[0]),this.filterNode)<0)f.appendChild(u[r].childNodes[0]);else break;else $(u[r]).css("text-align",n);f.childNodes.length>0&&($(f).css("text-align",n),u[r].insertBefore(f,u[r].childNodes[0]),e=0)}else $(u[r]).css("text-align",n)},n.prototype._getParentNodeCollection=function(n){var t=n,i=t.parentNode.nodeName.toLowerCase(),r=[];for(r.push(t);i!="body"&&(i=="li"||i=="ol"||i=="ul");)t=t.parentNode,i=t.parentNode.nodeName.toLowerCase(),r.push(t);return r},n.prototype._generateListParentTag=function(n,t,i){var r=document.createElement(n);return $(r).css("list-style-type",i),t.nodeName.toLowerCase()!="li"?$(r).insertBefore(t):$(r).insertBefore(t.parentNode),r},n.prototype._applyOrderedList=function(n,t,i,r){var e,w,at,l,d,g,nt,ot,a,rt;this.range=this._getRangy(i,t);var ut=this._getexactSelectedNode(this.range,t),st=document.createElement(n),tt=document.createElement(n),f=this._getSelectedParent(ut),ft=this._getParentNodeCollection(f[0]),vt=document.createElement("p"),s,y,c,h,o,v,u,p=ft[ft.length-1];for(r!="none"&&(h=this._generateListParentTag(n,f[0],r)),e=0;e<=f.length-1;e++)if(c=document.createElement("li"),f[e].parentNode.nodeName.toLowerCase()=="li"&&(f[e]=f[e].parentNode),r=="none"){if($(f[e]).closest("ul,ol").length<1)continue;if($(f[e]).find("ol").length!=0||$(f[e]).find("ul").length!=0){s=$(f[e]).parents(n).first();var ht=s.parents("li:last"),ct=s.parents("li:last").prevAll(),lt=s.parents("li:last").nextAll();u=$(f[e]).parents("li:last")[0]}else{s=$(f[e]);var ht=s,ct=s.prevAll(),lt=s.nextAll();u=$(f[e])[0]}y=$(f[e]).parents(n).last();w=0;ct.length!=0&&($(tt).append(ht),$(tt).append(lt),$(tt).insertAfter(y));at=document.createElement("p");l=o=document.createElement("li");st.appendChild(l);for(var b=y,it=[],et=!1,k;u;){if($.inArray(u,f)>=0||$.inArray(u.firstChild,f)>=0||$.inArray(u.firstChild,ut)>=0){for(w==0&&l.firstChild&&l.firstChild.innerHTML!=""&&(y.append(l),l=o=document.createElement("li")),k=document.createElement("p");u.firstChild&&$.inArray(u.firstChild.nodeName.toLowerCase(),this.filterNode)<0;)k.appendChild(u.firstChild),et=!0;if(et&&(w++,$(k).insertAfter(b),b=$(k),$(u).children().length==0&&it.push(u)),w==f.length){for(d=document.createElement(n),$(u).children().length!=0?$(d).append($(u).parents("li:last").nextAll()):$(d).append($(u).nextAll()),u.nodeName.toLowerCase()=="ol"||u.nodeName.toLowerCase()=="ul"?$(u).insertAfter(b):u.nodeName.toLowerCase()=="li"&&(g=document.createElement(n),$(g).append(u),$(g).insertAfter(b),u=g),$(d).insertAfter(u),nt=0;nt<it.length;nt++)for(v=it[nt];v.nodeName.toLowerCase()!="body";)ot=v.parentNode,$(v).remove(),v=ot;e=f.length;break}}if(this._isTextNode(u.firstChild)||u.firstChild&&$.inArray(u.firstChild.nodeName.toLowerCase(),this.filterNode)<0)o.appendChild(u.firstChild),ej.isNullOrUndefined(u.firstChild)&&(u=u.nextSibling);else if(this._isTextNode(u)){if(a=0,rt=u,u=u.nextSibling,ej.isNullOrUndefined(u)){for(u=rt;$(u.parentNode).next().length==0;)u=u.parentNode,a++;a>0&&(u=$(u.parentNode).next()[0])}o.appendChild(rt);o=a!=0||this._isTextNode(u)?this._createElement(u.nodeName.toLowerCase(),this._getParentnodeName(a,o),"after"):this._createElement(u.nodeName.toLowerCase(),o.parentNode,null);a=0}else u.firstChild?(o=this._createElement(u.firstChild.nodeName.toLowerCase(),o,null),u=u.firstChild):u=u.nextSibling}}else f[e].nodeName.toLowerCase()!="li"?$(f[e]).is("h1,h2,h3,h4,h5,h6,p,blockquote")?($(c).append(f[e]),h.appendChild(c)):($(f[e]).attr("style")&&$(c).attr("style",$(f[e]).attr("style")),$(c).append(f[e].childNodes),h.appendChild(c),$(f[e]).remove()):(f[e]=$(f[e]).closest("li"))&&(h=document.createElement(n),$(h).css("list-style-type",r),$(h).append(f[e].parentNode.childNodes),$(f[e].parentNode).replaceWith(h));r!="none"&&p.childNodes.length==0&&(p.nodeName.toLowerCase()=="ol"||p.nodeName.toLowerCase()=="ul")&&$(p).remove()},n.prototype._getParentnodeName=function(n,t){for(var i=t,r=0;r<=n;r++)i=i.parentNode;return i},n.prototype._createElement=function(n,t,i){var r=document.createElement(n);return i!="after"?t.appendChild(r):$(r).insertAfter(t),r},n.prototype._backUpRange=function(n,t){var u=n.createElement("span"),r,i;u.id="startRange";r=n.createElement("span");r.id="endRange";i=this._getRangy(t,n).cloneRange();i.collapse(!1);i.insertNode(r);i=this._getRangy(t,n).cloneRange();i.collapse(!0);i.insertNode(u)},n.prototype._resetRange=function(n,t){var u=$(n.body).find("span#startRange"),i=$(n.body).find("span#endRange"),f=ej.isNullOrUndefined(i[0].previousSibling)?0:this._isTextNode(i[0].previousSibling)?i[0].previousSibling.length:i[0].previousSibling.childNodes.length>0?i[0].previousSibling.childNodes.length:0,r=this._getRangy(t,n);u[0].nextSibling!=i[0]?r.setStart(u[0].nextSibling,0):r.setStart(u[0].nextSibling.nextSibling,0);i[0].previousSibling!=u[0]?ej.isNullOrUndefined(i[0].previousSibling)?r.setEnd(i[0].parentNode,f):r.setEnd(i[0].previousSibling,f):r.setEnd(i[0].nextSibling,0);u.remove();i.remove();this._selectRange(r,n)},n.prototype._selectRange=function(n,t){var i=t.getSelection();i.removeAllRanges();i.addRange(n)},n.prototype._validateFormatData=function(n,t){var r=[],i=n.parentNode,u=n,s=[],e,o;if(i)do s.push(u),((e=this._tagCheck(i,t))||(o=this._styleCheck(i,t)))&&r.push(new f(i,n,e,o));while(!$(i).is("body")&&(u=i)&&(i=i.parentNode));return r},n.prototype._tagCheck=function(n,t){return this.formatInfo.getFormatData(t).Value.tag?$(n).is(this.formatInfo.getFormatData(t).Value.tag):!1},n.prototype._styleCheck=function(n,t){var r,i;return!$(n).is(this.formatInfo.filterNode)&&this.formatInfo.getFormatData(t).Value.css&&n.getAttribute("style")?(i=!0,r=this.formatInfo.getFormatData(t).Value.css.split(";"),$(r).each(function(t,r){r&&n.getAttribute("style").replace(/\s/g,"").indexOf(r)==-1&&(i=!1)}),i):!1},n.prototype._validateFormat=function(n,t){var i=[],r={Info:null,status:null};return t=t.toLowerCase(),$.inArray(t,this.formatInfo.actionList)!=-1&&((i=this._validateFormatData(n,t))&&i.length&&(r.Info=i),r.status=i.length>0),r},n.prototype._CurrentformateStatus=function(n,t){for(var r={Info:null,status:null},u=!0,i=0;i<n.length;i++)r=this._validateFormat(n[i],t),r.status||(u=!1);return u},n.prototype._getSelectNode=function(){return this._rangeExtract.ProcessRange()},n.prototype._getFormatedTagOrder=function(n,t){return n[t].currentNode=this._getNodeOrder(n[t].textNode,n[t].node),t?n.slice(t,t+1):n},n.prototype._getNodeOrder=function(n,t){var i=n,r=[];do r.push(i);while((i=i.parentNode)&&i!=t);return r},n.prototype._splitNode=function(n){for(var t=n,i={rightSide:[],leftSide:[]};t=t.nextSibling;)this._validateCommentNode(t)&&i.rightSide.push(t);for(t=n;t=t.previousSibling;)this._validateCommentNode(t)&&i.leftSide.push(t);return i},n.prototype._validateCommentNode=function(n){return n.nodeType!=8},n.prototype._validateTextNode=function(n){return n.nodeType==3},n.prototype._validateType=function(n){return this._validateTextNode(n)&&n.data.length},n.prototype._formatechildNodes=function(n,t,i){for(var r={rightSide:[],leftSide:[]},f,u=n.length-1;u>=0;u--)r=this._splitNode(n[u]),r.rightSide.length&&$($(i.cloneNode(!1)).append(r.rightSide)).insertAfter(n[u]),f=i,r.leftSide.length&&$($(i.cloneNode(!1)).append(r.leftSide.reverse())).insertBefore(n[u])},n.prototype._removeFormat=function(n,t,i){var r=this._getFormatedTagOrder(n.Info,i),u,f=r[0].currentNode.slice(r[0].currentNode.length-1),o=document.createElement("span"),e;return r[0].currentNode=r[0].currentNode.slice(0,r[0].currentNode.length-1),e=this._splitNode(f[0]),e.rightSide.length&&$($(r[0].node.cloneNode(!1)).append(e.rightSide)).insertAfter(r[0].node),r[0].tag?(this._rangeExtract.cursorBasedCollection&&!r[0].textNode.data.trim().length?$(o).append(f).insertAfter($(r[0].node)):$(f).insertAfter(r[0].node),u=r[0].textNode,this._rangeExtract.cursorBasedCollection&&this._setCursorOnNode(u,r[0].textNode)):(u=$(r[0].node.cloneNode(!1)),u.css(this.formatInfo.getFormatData(t).Value.removeCSS),u[0].getAttribute("style")?$(u.append(f)).insertAfter(r[0].node):$(f).insertAfter(r[0].node),u=f),r[0].currentNode.length&&this._formatechildNodes(r[0].currentNode,t,r[0].node),e.leftSide.length||$(r[0].node).remove(),u[0]?u[0]:u},n.prototype._applyFormat=function(n,t,i){var r=this._splitNode(n),u,e=n,f=document.createElement("span");return r.leftSide.length&&r.leftSide[0].nodeType!=3&&(this._tagCheck(r.leftSide[0],t)||this._compareCSS(r.leftSide[0],i?this.formatInfo.getFormatData(t).Value.css+":"+i+";":this.formatInfo.getFormatData(t).Value.css))?$(r.leftSide[0]).append(n):r.rightSide.length&&r.rightSide[0].nodeType!=3&&(this._tagCheck(r.rightSide[0],t)||this._compareCSS(r.rightSide[0],i?this.formatInfo.getFormatData(t).Value.css+":"+i+";":this.formatInfo.getFormatData(t).Value.css))?$(r.rightSide[0]).prepend(n):r.leftSide.length||r.rightSide.length||!$(n.parentNode).is(this.formatInfo.getFormatData(t).Value.styleParent)?(u=document.createElement(this.formatInfo.getFormatData(t).Value.result),this._rangeExtract.cursorBasedCollection?this._validateTextNode(n)?(!$(u).is("span")&&this._rangeExtract._noContent?$(f).append(u):f=u,u.appendChild(e=document.createTextNode(n.data)),this._rangeExtract.cursorBasedCollection&&this._setCursorOnNode(n,e),$(n).replaceWith(f)):(u.innerHTML="",$(f).append(u),n.firstChild&&$(n.firstChild).is("br")?$(f).insertBefore(n.firstChild):$(n).append(f),this._rangeExtract.cursorBasedCollection&&this._setCursorOnNode(n,u.firstChild),e=u):(u.appendChild(e=document.createTextNode(n.data)),$(n).replaceWith(u)),i&&$(u).css(this.formatInfo.getFormatData(t).Value.css,i)):i?$(n.parentNode).css(this.formatInfo.getFormatData(t).Value.css,i):$(n.parentNode).css(this._collectStyleData(this.formatInfo.getFormatData(t).Value.css)),e},n.prototype._setCursorOnNode=function(n,t){this._rangeExtract._cursorData.node==n&&(this._rangeExtract._cursorData.node=t)},n.prototype._compareCSS=function(n,t){return n.getAttribute("style")&&n.getAttribute("style").toLowerCase().trim().replace(/\s/g,"")==t.toLowerCase().trim().replace(/\s/g,"")},n.prototype._collectStyleData=function(n){var i=n.replace(/\s/g,"").split(";"),r={},t;return $(i).each(function(n){var u=i[n];t=u.split(":");t.length>1&&(r[t[0].toLowerCase().trim()]=t[1].toLowerCase().trim())}),r},n.prototype._validateStyleData=function(n,t,i){var r=n.getAttribute("style").split(";"),u=!1;return $(r).each(function(n){var e=r[n],f=e.split(":");if(f[0].toLowerCase().trim()==t.toLowerCase().trim()&&f[1].toLowerCase().trim()==i.toLowerCase().trim())return u=!0,!1}),u},n.prototype._caseConvert=function(n){var i=this._getSelectNode(),u,f,e,t,r;if(i.length&&(i.length!=1||i[0].data.length)){for(r=0;r<i.length;r++)u=i[r],t=document.createTextNode(u.data[this.formatInfo.captionConvert[n]]()),this._rangeExtract._cursorData.node==u&&(this._rangeExtract._cursorData.node=t),u.data&&$(u).replaceWith(t),t&&i.length==1?(f=t)&&(e=t):r==0?f=t:r==i.length-1?e=t:null;f&&e&&this._refreshRange(f,e)}},n.prototype._validateSelectedNode=function(n){return!n.length||n.length==1&&n[0].data&&!n[0].data.length},n.prototype._tagFormatProcess=function(n,t){var u=this._getSelectNode(),c,e,r,i,o,s,f,h;if(!this._validateSelectedNode(u)){for(c=this._CurrentformateStatus(u,n),r={Info:null,status:null},f=0;f<u.length;f++){if(e=u[f],r=this._validateFormat(e,n),i=null,(t||c)&&r.status)for(h=0;h<r.Info.length;h++)i=this._removeFormat(r,n,h);else i=r.status||t?e:this._applyFormat(e,n,null);i&&(u.length==1?(o=i)&&(s=i):f==0?o=i:f==u.length-1?s=i:null)}return o&&s&&this._refreshRange(o,s),this.focus(),{data:r,nodeStatus:c}}},n.prototype._refreshRange=function(n,t){var u=this.currentDocument.createRange(),f=this.currentDocument.getSelection(),i,r;this._rangeExtract&&(i=this._rangeExtract._cursorData.node)&&(r=this._rangeExtract._cursorData.offSet);this._rangeExtract.cursorBasedCollection&&i&&r>-1?(r=this._validateTextNode(i)?r>i.data.length?i.data.length:r:0,i.nodeType!=3||i.data.trim()||(i.data=String.fromCharCode(65279)+i.data,r++),this._updateCursor(i,r)):n&&t&&(n.data&&!n.data.trim()&&n.data.indexOf(String.fromCharCode(65279))==-1&&(n.data=String.fromCharCode(65279)+n.data),t.data&&!t.data.trim()&&t.data.indexOf(String.fromCharCode(65279))==-1&&(t.data=String.fromCharCode(65279)),f.removeAllRanges(),u.setStart(n,0),u.setEnd(t,t.data?t.data.length:0),f.addRange(u));$(this.currentWindow).focus()},n.prototype._updateCursor=function(n,t){var i=this.currentDocument.createRange(),r=this.currentDocument.getSelection();i.setStart(n,t);i.setEnd(n,t);r.removeAllRanges();r.addRange(i)},n.prototype._cssFormatProcess=function(n,t,i){var f=this._getSelectNode(),s,e={Info:null,status:null},r,h,c,u,o;if(!this._validateSelectedNode(f)){for(u=0;u<f.length;u++){if(s=f[u],e=this._validateFormat(s,n),e.status)for(o=0;o<e.Info.length;o++)(i||!this._validateStyleData(e.Info[o].node,this.formatInfo.getFormatData(n).Value.css,t))&&(r=this._removeFormat(e,n,o));i||(r=this._applyFormat(s,n,t));r&&(f.length==1?(h=r)&&(c=r):u==0?h=r:u==f.length-1?c=r:null)}this._refreshRange(h,c);this.focus()}},n.prototype.execCommand=function(n,i){try{switch(n){case t.bold:this._tagFormatProcess("bold",!1);break;case t.italic:this._tagFormatProcess("italic",!1);break;case t.underline:this._tagFormatProcess("underline",!1);break;case t.strikethrough:this._tagFormatProcess("strikethrough",!1);break;case t.superscript:this._tagFormatProcess("subscript",!0);this._tagFormatProcess("superscript",!1);break;case t.subscript:this._tagFormatProcess("superscript",!0);this._tagFormatProcess("subscript",!1);break;case t.fontsize:this._cssFormatProcess("fontsize",i,!1);break;case t.fontname:this._cssFormatProcess("fontname",i,!1);break;case t.forecolor:this._cssFormatProcess("forecolor",i,!1);break;case t.backcolor:this._cssFormatProcess("backcolor",i,!1);break;case t.uppercase:this._caseConvert("uppercase");break;case t.lowercase:this._caseConvert("lowercase");break;case t.indent:this._applyIndent(!0);break;case t.outdent:this._applyIndent(!1);break;case t.justifyleft:this._justifyContent("left");break;case t.justifycenter:this._justifyContent("center");break;case t.justifyright:this._justifyContent("right");break;case t.justifyfull:this._justifyContent("justify");break;case t.formatblock:this._applyFormateBlock(i)}this._junkContentStatus=!0}catch(r){}},n}();n.editorManager=u,function(n){n[n.bold=0]="bold";n[n.italic=1]="italic";n[n.underline=2]="underline";n[n.strikethrough=3]="strikethrough";n[n.superscript=4]="superscript";n[n.subscript=5]="subscript";n[n.fontsize=6]="fontsize";n[n.fontname=7]="fontname";n[n.forecolor=8]="forecolor";n[n.backcolor=9]="backcolor";n[n.uppercase=10]="uppercase";n[n.lowercase=11]="lowercase";n[n.indent=12]="indent";n[n.outdent=13]="outdent";n[n.justifyleft=14]="justifyleft";n[n.justifycenter=15]="justifycenter";n[n.justifyright=16]="justifyright";n[n.justifyfull=17]="justifyfull";n[n.formatblock=18]="formatblock"}(n.execCommand||(n.execCommand={}));var t=n.execCommand,f=function(){function n(n,t,i,r){this.textNode=t;this.node=n;this.css=r;this.tag=i}return n}(),i=function(){function n(n,t,i,r,u){this.tag=n;this.css=t;this.result=i;this.removeCSS=r;this.styleParent=u}return n}(),e=function(){function n(){this.uppercase="toUpperCase";this.lowercase="toLowerCase"}return n}(),r=function(){function n(n,t){this.Key=n;this.Value=t}return n}(),o=function(){function n(){this.filterNode=["div","p","h1","h2","h3","h4","h5","h6","address","applet","blockquote","button","center","dd","dir","dl","dt","fieldset","form","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","script","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this.actionList=["bold","italic","underline","strikethrough","superscript","subscript","fontsize","fontname","forecolor","backcolor"];this.captionConvert=new e;this._updateData()}return n.prototype._updateData=function(){var n=Array();n.push(new r("bold",new i("b,strong","font-weight:bold;","b",{"font-weight":""},"span")));n.push(new r("italic",new i("i, cite, em, var, address, dfn","font-style:italic","i",{"font-style":""},"span")));n.push(new r("underline",new i("u,ins","text-decoration:underline;","u",{"text-decoration":""},"span")));n.push(new r("strikethrough",new i("s, strike, del","text-decoration:line-through;","s",{"text-decoration":""},"span")));n.push(new r("superscript",new i("sup","vertical-align:super;font-size:smaller;","sup",{"vertical-align":"","font-size":""},"span")));n.push(new r("subscript",new i("sub","vertical-align:sub;font-size:smaller;","sub",{"vertical-align":"","font-size":""},"span")));n.push(new r("fontsize",new i(null,"font-size","span",{"font-size":""},"span")));n.push(new r("fontname",new i(null,"font-family","span",{"font-family":""},"span")));n.push(new r("forecolor",new i(null,"color","span",{color:""},"span")));n.push(new r("backcolor",new i(null,"background-color","span",{"background-color":""},"span")));this.tempCollection=n},n.prototype.getFormatData=function(n){for(var i,t=0;t<this.tempCollection.length;t++)if(i=this.tempCollection[t],i.Key==n)return this.tempCollection[t]},n}(),s=function(){function n(n){this.exp=/\s/g;this._findStatus={leftSide:null,rightSide:null};this._iterationStatus=!1;this._cursorData={node:null,offSet:null};this._nodeCollection=[];this._traverseData={leftSide:{childNode:"lastChild",sibling:"previousSibling"},rightSide:{childNode:"firstChild",sibling:"nextSibling"}};this._blockNodes=["div","p","h1","h2","h3","h4","h5","h6","address","applet","blockquote","button","center","dd","dir","dl","dt","fieldset","form","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","script","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this._noContent=!1;this.nodeCollection={leftSide:[],rightSide:[]};this.currentDocument=n}return n.prototype.ProcessRange=function(){var n=this._getRange();return $(this.currentDocument.body).attr("contenteditable")=="true"&&n&&(this._nodeCollection=[],this._noContent=!1,this._iterationStatus=!1,this._cursorData={node:null,offSet:null},n.startContainer==n.endContainer&&n.startOffset==n.endOffset?(this._collectCursorBasedTextNode(n.startContainer,n.startOffset),this.cursorBasedCollection=!0):(this._collectSelectionBasedTextNode(n),this.cursorBasedCollection=!1)),this._nodeCollection},n.prototype._insertCursor=function(n,t){var r=n.data.substring(0,t),u=n.data.substr(t),i;r.replace(String.fromCharCode(65279),"")&&$(document.createTextNode(r)).insertBefore(n);u.replace(String.fromCharCode(65279),"")&&$(document.createTextNode(u)).insertAfter(n);$(n).replaceWith(i=document.createTextNode(""));this._cursorData={node:i,offSet:0};this._nodeCollection.push(i);this._noContent=!0},n.prototype._collectCursorBasedTextNode=function(n,t){for(var r,f,i,u,c=new RegExp(this.exp),s,h,e,o;f=c.exec(n.data);)n.data.substring(f.index,f.index+1).indexOf(" ")!=-1&&(f.index<t&&(r=f),!u&&t<=f.index&&(u=f));return r&&u?t-(r.index+1)==0||t-(r.index+1)==n.data.substring(r.index+1,u.index).replace("\n","").length?this._insertCursor(n,t):(s=n.data.substring(0,r.index+1),h=n.data.substring(u.index),$(document.createTextNode(s)).insertBefore(n),$(document.createTextNode(h)).insertAfter(n),$(n).replaceWith(i=document.createTextNode(n.data.substring(r.index+1,u.index))),this._cursorData={node:i,offSet:t-(r.index+1)},this._nodeCollection.push(i)):r?(this._collectNodeData(n,!1),e=this._nodeCollection,this._nodeCollection=[],e.length==0&&(t-(r.index+1)==0||t-(r.index+1)==n.data.substring(r.index+1).replace("\n","").length)?this._insertCursor(n,t):(s=n.data.substring(0,r.index+1),$(document.createTextNode(s)).insertBefore(n),$(n).replaceWith(i=document.createTextNode(n.data.substring(r.index+1))),this._cursorData={node:i,offSet:t-(r.index+1)},this._nodeCollection.push(i),this._nodeCollection.concat(e))):u?(this._collectNodeData(n,!0),o=this._nodeCollection,this._nodeCollection=[],o.length==0&&(t==n.data.substring(0,u.index).replace("\n","").length||t==0)?this._insertCursor(n,t):(h=n.data.substring(u.index),$(document.createTextNode(h)).insertAfter(n),$(n).replaceWith(i=document.createTextNode(n.data.substring(0,u.index))),this._cursorData={node:i,offSet:t},this._nodeCollection=o.reverse(),this._nodeCollection.push(i))):n.nodeType!=3?(i=document.createTextNode(""),n.firstChild?$(i).insertBefore(n.firstChild):$(i).appendTo(n),this._nodeCollection.push(i),this._cursorData={node:i,offSet:t},this._noContent=!0):(this._collectNodeData(i=n,!1),e=this._nodeCollection,this._nodeCollection=[],this._collectNodeData(i,!0),o=this._nodeCollection,this._nodeCollection=[],i.data==String.fromCharCode(65279)||o.length==0&&t==0||e.length==0&&i.data.replace(String.fromCharCode(65279),"").replace("\n","").length==t?this._insertCursor(n,t):(this._nodeCollection=o.reverse(),this._nodeCollection.push(i),this._nodeCollection=this._nodeCollection.concat(e),this._cursorData={node:i,offSet:t})),this._nodeCollection},n.prototype._validateContent=function(n,t){for(var e=new RegExp(this.exp),i,r=[],u,f;i=e.exec(n.data);)r.push(i);r.length?(i=r[t=="leftSide"?r.length-1:0],f=t=="leftSide"?i.index+1:i.index,$(u=document.createTextNode(n.data.substring(f))).insertAfter(n),n.data=n.data.substring(0,f),t=="rightSide"&&$.trim(n.data)?this._nodeCollection.push(n):t=="leftSide"&&$.trim(u.data)&&this._nodeCollection.push(u),this._findStatus[t]=!0):this._nodeCollection.push(n)},n.prototype._iterateNodes=function(n,t){if(!this._findStatus[t])if(n.nodeType==3&&n.data)this._validateContent(n,t);else if((n=n[this._traverseData[t].childNode])&&!this._findStatus[t])do n.nodeType==3&&n.data?this._validateContent(n,t):this._iterateNodes(n,t);while((n=n[this._traverseData[t].sibling])&&!this._findStatus[t])},n.prototype._collectNodeData=function(n,t){this._findStatus={leftSide:undefined,rightSide:undefined};var r=this,i=t?"leftSide":"rightSide";do this.nodeCollection=this._splitSiblingNode(n),$(this.nodeCollection[i]).each(function(n,t){r._iterateNodes(t,i)});while(!this._validateBlockType(n.parentNode)&&(n=n.parentNode)&&!this._findStatus[i])},n.prototype._validateBlockType=function(n){return $.inArray(n.tagName.toLowerCase(),this._blockNodes.concat("body"))!=-1},n.prototype._validateTextNode=function(n){return n.nodeType==3},n.prototype._splitSiblingNode=function(n){for(var t=n,i={leftSide:[],rightSide:[]};t=t.nextSibling;)t.tagName&&this._validateBlockType(t)||i.rightSide.push(t);for(t=n;t=t.previousSibling;)t.tagName&&this._validateBlockType(t)||i.leftSide.push(t);return i},n.prototype._getRange=function(){var n=this.currentDocument.getSelection(),t=null;return n.rangeCount&&(t=n.getRangeAt(0)),t},n.prototype._collectSelectionBasedTextNode=function(n){var t,i,f,o,s,e,r=n.startContainer,u=n.endContainer;this._nodeCollection=[];n.startContainer==n.endContainer?this._validateTextNode(n.endContainer)?(n.startOffset&&(t=n.startContainer.data.substr(0,n.startOffset)),n.startContainer.data.length!=n.endOffset&&(i=n.startContainer.data.substr(n.endOffset)),f=n.startContainer.data.substr(n.startOffset,n.endOffset-n.startOffset),t&&$(o=document.createTextNode(t)).insertBefore(n.startContainer),i&&$(s=document.createTextNode(i)).insertAfter(n.startContainer),f&&$(n.startContainer).replaceWith(e=document.createTextNode(f))&&this._nodeCollection.push(e)):this._updateNodeCollection(n.startContainer.nodeName.toLowerCase()=="html"?$(n.startContainer).find("body")[0]:n.startContainer,r,null):(n.startContainer.nodeType==3&&n.startOffset&&(t=n.startContainer.data.substr(0,n.startOffset),i=n.startContainer.data.substr(n.startOffset),$(document.createTextNode(t)).insertBefore(n.startContainer),$(r).replaceWith(r=document.createTextNode(i))),n.endContainer.nodeType==3&&n.endContainer.data.length!=n.endOffset?(i=n.endContainer.data.substr(n.endOffset),t=n.endContainer.data.substr(0,n.endOffset),$(document.createTextNode(i)).insertAfter(n.endContainer),$(u).replaceWith(u=document.createTextNode(t))):n.endOffset&&n.endContainer.lastChild&&(u=n.endContainer.lastChild),this._updateNodeCollection(n.commonAncestorContainer,r,u))},n.prototype._updateNodeCollection=function(n,t,i){if(this._updateIterationStatus(n,t,i),n=n.firstChild)do this._updateNodeCollection(n,t,i);while(n=n.nextSibling)},n.prototype._updateIterationStatus=function(n,t,i){n!=t||this._iterationStatus||(this._iterationStatus=!0);n.nodeType==3&&this._iterationStatus&&this._nodeCollection.push(n);n==i&&this._iterationStatus&&(this._iterationStatus=!1)},n}()}(documentManager||(documentManager={}));$.extend(ej,documentManager);window.documentManager=null,function(n,t,i){t.widget("ejColorPicker","ej.ColorPicker",{_rootCSS:"e-colorpicker",element:null,model:null,validTags:["input","div"],_addToPersist:["value","opacityValue"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{enableOpacity:!0,opacityValue:100,columns:10,palette:"basicpalette",htmlAttributes:{},buttonMode:"split",custom:[],presetType:"basic",modelType:"picker",locale:"en-US",showPreview:!0,showTooltip:!1,showClearButton:!1,showSwitcher:!0,value:null,displayInline:!1,buttonText:{apply:"Apply",cancel:"Cancel",swatches:"Swatches"},tooltipText:{switcher:"Switcher",addButton:"Add Color",basic:"Basic",monoChrome:"Mono Chrome",flatColors:"Flat Colors",seaWolf:"Sea Wolf",webColors:"Web Colors",sandy:"Sandy",pinkShades:"Pink Shades",misty:"Misty",citrus:"Citrus",vintage:"Vintage",moonLight:"Moon Light",candyCrush:"Candy Crush",currentColor:"Current Color",selectedColor:"Selected Color"},showApplyCancel:!0,showRecentColors:!1,toolIcon:null,cssClass:"",enabled:!0,change:null,select:null,open:null,close:null,create:null,destroy:null},dataTypes:{modelType:"enum",palette:"enum",presetType:"enum",cssClass:"string",displayInline:"boolean",locale:"string",showSwitcher:"boolean",showRecentColors:"boolean",enabled:"boolean",showPreview:"boolean",enableOpacity:"boolean",buttonText:"data",custom:"array",htmlAttributs:"data"},observables:["value","opacityValue"],value:t.util.valueFunction("value"),opacityValue:t.util.valueFunction("opacityValue"),_setModel:function(n){for(var i in n)switch(i){case"enableOpacity":this.model.enableOpacity=n[i];this._previewSlider(this.model.enableOpacity);this._valueOperation();break;case"opacityValue":if(this.model.enableOpacity){this._tempOpacity=parseFloat(t.util.getVal(n[i]));this._opacity.option("value",this._tempOpacity);this._switch||this._changeOpacity();this._updateValue();this.opacityValue(this._tempOpacity);typeof n[i]=="function"?n[i](this.opacityValue()):n[i]=this.opacityValue();break}else return!1;case"custom":this.model.custom=n[i];this._reInitialize();break;case"palette":this.model.palette=n[i];this._reInitialize();break;case"columns":this.model.columns=parseFloat(n[i]);this._reInitialize();n[i]=this.model.columns;break;case"presetType":if(this.model.presetType=n[i],t.isNullOrUndefined(r[this.model.presetType]))return!1;this._reInitialize();break;case"buttonMode":this._unBindIconClick();this._buttonElement=t.ColorPicker.ButtonMode.Split==n[i]?this.dropdownbutton:this.wrapper;t.ColorPicker.ButtonMode.Split==n[i]?this.wrapper.addClass("e-split"):this.wrapper.removeClass("e-split");this._bindIconClick();break;case"showTooltip":this._colorSlider.option("showTooltip",n[i]);this._opacity.option("showTooltip",n[i]);break;case"value":this._setValue(t.util.getVal(n[i]),!0);typeof n[i]=="function"?n[i](this.value()):n[i]=this.value();break;case"modelType":this.model.modelType=n[i];this._reInitialize();break;case"showSwitcher":this.model.showSwitcher=n[i];this._showSwitcher();break;case"tooltipText":this._toolTipText(n[i]);break;case"locale":this.model.locale=n[i];this._localize(n[i]);break;case"showPreview":this.model.showPreview=n[i];this._previewPane(this.model.showPreview);break;case"buttonText":this._buttonText(n[i]);break;case"displayInline":this._setDisplayInline(n[i]);break;case"cssClass":this._setSkin(n[i]);this.model.cssClass=n[i];break;case"enabled":this._enabled(n[i]);break;case"showRecentColors":this.model.showRecentColors=n[i];this._previewColor(this.model.showRecentColors);break;case"htmlAttributes":this._addAttr(n[i]);break;case"showClearButton":this._showClearIcon(n[i]);break;case"showApplyCancel":this.model.showApplyCancel=n[i];this._buttonContainer()}},_setSkin:function(n){this.wrapper?this.wrapper.removeClass(this.model.cssClass).addClass(n):this.element.removeClass(this.model.cssClass).addClass(n)},_showSwitcher:function(){this.model.showSwitcher?(this._changeTag.removeClass("e-hide"),this.model.modelType=="picker"?this._switcher.addClass("e-paletteModel").removeClass("e-pickerModel"):this._switcher.addClass("e-pickerModel").removeClass("e-paletteModel")):this._changeTag.addClass("e-hide")},_pickerType:function(){this._modelType="picker";this.PaletteWrapper.removeAttr("style");this.PaletteWrapper.addClass("e-hide");this._gradient.removeClass("e-hide");this._gradient.fadeIn(200);this._presetTag.parents(".e-split.e-widget").addClass("e-hide");this._switcher.removeAttr("class");this._switcher.addClass("e-color-image e-paletteModel");this._switch=!0;this._rgbValue();this._hueGradient();this._updateUI();this._alphaGradient(this.RGBToHEX(this.rgb));this._hsva.ejButton("enable");this._switchEvents();this._unSwitchEvents();this._hideUnBindEvents();this.isPopupOpen&&this._showBindEvents();this.model.modelType=="default"?this._changeTag.removeClass("e-hide"):this._changeTag.addClass("e-hide");this.popupList.prepend(this._gradient);this._showSwitcher()},_paletteType:function(){this._gradient.removeAttr("style");this._presetTag.parents(".e-split.e-widget").removeClass("e-hide");this.PaletteWrapper.removeClass("e-hide");this.PaletteWrapper.fadeIn(200);this._switch=!1;this._disableHSVButton();this._cellSelect();this._switchEvents();this._unSwitchEvents();this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType);this.popupList.prepend(this.PaletteWrapper);this._showSwitcher()},_reInitialize:function(){this._destroyPalette(!1)},_destroyPalette:function(n){this.PaletteWrapper.remove();(n||this._columns!=this.model.columns&&this.model.palette!=="custompalette")&&(this.PaletteWrapper=this._presetType(this._presetsId));this._temp!==this.model.presetType&&(this.PaletteWrapper=this._layoutType(this.model.palette));this.model.modelType=="palette"&&(this._modelType="palette",this.PaletteWrapper=this._layoutType(this.model.palette),this._hideUnBindEvents(),this.isPopupOpen&&this._showBindEvents(),this._gradient.addClass("e-hide"),this._paletteType(),n||this.model.palette=="custompalette"?"":this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType));this.model.modelType=="picker"&&(this._pickerType(),this.model.displayInline&&!this.element.is("input")&&this._footer.addClass("e-hide"));this._temp=this.model.presetType;this._columns=this.model.columns;this._modelType=="picker"?this._presetTag.parents(".e-split.e-widget").addClass("e-hide"):this._presetTag.parents(".e-split.e-widget").removeClass("e-hide");this.refresh()},_previewColor:function(n){n?(this._swatchesArea.fadeIn(200),this._bindRecentEvent()):(this._swatchesArea.fadeOut(200),this._unBindRecentEvent())},_buttonText:function(i){n.extend(this.model.buttonText,i);t.isNullOrUndefined(this._buttonTag)||this._buttonTag.html(this.model.buttonText.apply);t.isNullOrUndefined(this._cancelTag)||this._cancelTag.html(this.model.buttonText.cancel);this._spnTag.html(this.model.buttonText.swatches)},_toolTipText:function(t){n.extend(this.model.tooltipText,t);this._addTitleText()},_previewPane:function(n){n?this._previewTag.removeClass("e-hide"):this._previewTag.addClass("e-hide")},_previewSlider:function(n){n?this._opacity.enable():this._opacity.disable()},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_localize:function(){this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._localizedLabels)||(t.isNullOrUndefined(this._localizedLabels.buttonText)||this._buttonText(this._localizedLabels.buttonText),t.isNullOrUndefined(this._localizedLabels.tooltipText)||this._toolTipText(this._localizedLabels.tooltipText))},_destroy:function(){this.isPopupOpen&&this.hide();this.popupContainer.remove();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove(),this._presetContainer.parent(".e-menu-wrap").remove());this.element.removeClass("e-colorpicker e-input e-widget").removeAttr("style name").val(this.element.attr("value"))},_init:function(){this._browser=t.browserInfo();this._isFocused=!1;this.isPopupOpen=!1;this._dataBind=!1;this._modelType="picker";this._id&&n("#"+this._id+"_popup").remove();"#"+this._id+"_Presets"&&n("#"+this._id+"_Presets").parent(".e-menu-wrap").remove();this.model.palette==="basicpalette"?this._presetsId="e-presets30":"";this._tempValue=t.isNullOrUndefined(this.value())&&this.element[0].value!==""?this.element[0].value:this.value();this._previousValue=this._previousColor=this._tempValue;this._renderControl();this._tempOpacity=this.opacityValue();this.model.palette==="custompalette"&&this._presetTag.parents(".e-split.e-widget").addClass("e-hide");this.popupContainer.find("button.e-presets").ejSplitButton({targetID:this._presetContainer.attr("id")});this._tempValue&&(this._setValue(this._tempValue),this._switch&&this._rgbValue());this._hsvValue();this._hueGradient();this._addTitleText();this._showClearIcon(this.model.showClearButton);this._columns=this.model.columns;this._temp=this.model.presetType;this._tempValue||(this._colorSlider.option("value",parseInt(this._hsv.h)),this._opacity.option("value",this._tempOpacity),this._alphaGradient("#fff"),this._previousValue="");this.model.enabled||this._enabled(this.model.enabled)},_renderControl:function(){this._createWrapper();this._renderPopupPanelWrapper();this._selectedButton=this._groupTag.find(".e-click");this._buttonContainer();this._renderPopupElement();this._buttonElement=t.ColorPicker.ButtonMode.Split==this.model.buttonMode?this.dropdownbutton:this.wrapper;this.model.buttonMode==t.ColorPicker.ButtonMode.Split&&this.element.is("input")&&this.wrapper.addClass("e-split");this._addAttr(this.model.htmlAttributes);this._setDisplayInline(this.model.displayInline);this._previewPane(this.model.showPreview);this._previewColor(this.model.showRecentColors);this._localize();this._switch&&this._previewSlider(this.model.enableOpacity);this._wireEvents();this._switchEvents()},_createWrapper:function(){this.element.is("input")&&(this.element.addClass("e-input e-widget"),this.spanElement=t.buildTag("span.e-selected-color"),this.wrapper=t.buildTag("span.e-colorwidget e-picker e-widget "+this.model.cssClass).attr({tabindex:"0","aria-expanded":!1,"aria-haspopup":!0,"aria-owns":"popup"}),this._id&&this.wrapper.attr("id",this._id+"Wrapper"),this.container=t.buildTag("span.e-in-wrap e-box e-splitarrowright"),this.drpbtnspan=t.buildTag("span.e-icon e-arrow-sans-down","",{},{"aria-label":"select"}),this.dropdownbutton=t.buildTag("span.e-select","",{},{role:"button"}).append(this.drpbtnspan),this.iconWrapper=t.buildTag("span.e-tool-icon "+this.model.toolIcon),this.colorContainer=t.buildTag("span.e-color-container"),this.colorContainer.append(this.spanElement),this.container.insertAfter(this.element),t.isNullOrUndefined(this.model.toolIcon)?this.container.append(this.colorContainer):(this.colorContainer.prepend(this.iconWrapper),this.container.addClass("e-tool"),this.container.append(this.colorContainer)),this.container.append(this.element,this.dropdownbutton),this.wrapper.insertBefore(this.container),this.wrapper.append(this.container),this.element.css("display","none").val(this.value()));this._checkNameAttr()},_addTitleText:function(){this._switcher.attr("title",this.model.tooltipText.switcher);this._spanTag.attr("title",this.model.tooltipText.addButton);this._presetLi.find("#e-presets00").attr("title",this.model.tooltipText.webColors);this._presetLi.find("#e-presets01").attr("title",this.model.tooltipText.vintage);this._presetLi.find("#e-presets02").attr("title",this.model.tooltipText.seaWolf);this._presetLi.find("#e-presets10").attr("title",this.model.tooltipText.sandy);this._presetLi.find("#e-presets11").attr("title",this.model.tooltipText.pinkShades);this._presetLi.find("#e-presets12").attr("title",this.model.tooltipText.moonLight);this._presetLi.find("#e-presets20").attr("title",this.model.tooltipText.monoChrome);this._presetLi.find("#e-presets21").attr("title",this.model.tooltipText.misty);this._presetLi.find("#e-presets22").attr("title",this.model.tooltipText.flatColors);this._presetLi.find("#e-presets30").attr("title",this.model.tooltipText.basic);this._presetLi.find("#e-presets31").attr("title",this.model.tooltipText.candyCrush);this._presetLi.find("#e-presets32").attr("title",this.model.tooltipText.citrus);this._currentTag.attr("title",this.model.tooltipText.currentColor);this._previousTag.attr("title",this.model.tooltipText.selectedColor)},_renderPopupPanelWrapper:function(){var u,r,f,i;for(this.popupContainer=t.buildTag("div.e-colorpicker e-box e-popup e-widget "+this.model.cssClass,"",{},{role:"grid","aria-readonly":"true",tabindex:"0",style:"visibility:hidden"}),this._id&&this.popupContainer.attr("id",this._id+"_popup"),n("body").append(this.popupContainer),this.popupList=t.buildTag("div.e-popupWrapper"),this._gradient=t.buildTag("div.e-container"),this._colorArea=t.buildTag("div.e-hsv-color"),this._gradientArea=t.buildTag("div.e-hsv-gradient"),this._handleArea=t.buildTag("div.e-draghandle e-color-image"),this._browser=="msie"&&this._handleArea.addClass("e-pinch"),this._colorArea.append(this._gradientArea,this._handleArea),this._picker=t.buildTag("div.e-gradient"),this._hueSlider=t.buildTag("div.e-widget e-hue e-state-default"),this._alphaSlider=t.buildTag("div.e-widget e-opacity e-state-default"),this._picker.append(this._hueSlider,this._alphaSlider),this._gradient.append(this._colorArea,this._picker),this.popupList.append(this._gradient),this._footerBlock=t.buildTag("div.e-footerContainer"),this._templateWrapper=t.buildTag("div.e-buttons"),this._groupTag=t.buildTag("div.e-grpbtn"),this._formEle=t.buildTag("div.e-form"),this._rgb=t.buildTag("button.e-rgbButton e-click","",{},{type:"button"}),this._hexCode=t.buildTag("button.e-hexButton","",{},{type:"button"}),this._hsva=t.buildTag("button.e-hsvButton","",{},{type:"button"}),this._groupTag.append(this._rgb,this._hexCode,this._hsva),this._codeEditor=t.buildTag("div.e-codeeditor"),this._inputTag=t.buildTag("input.e-color-code","",{},{type:"text",tabindex:"0",maxLength:"22"}),this._codeEditor.append(this._inputTag),this._formEle.append(this._groupTag,this._codeEditor),this._previewTag=t.buildTag("div.e-preview").attr({tabindex:"0"}),this._currentTag=t.buildTag("div.e-current"),this._previousTag=t.buildTag("div.e-previous"),this._previewTag.append(this._currentTag,this._previousTag),this._templateWrapper.append(this._formEle,this._previewTag),this._swatchesArea=t.buildTag("div.e-color-labels"),u=11,this._divTag=t.buildTag("div.e-recent-color"),this._addTag=t.buildTag("div.e-colorblock e-block"),this._spanTag=t.buildTag("div.e-color e-color-image e-add"),this._addTag.append(this._spanTag),this._divTag.append(this._addTag),r=0;r<u;r++)this._liTag=t.buildTag("div.e-colorblock e-block"),f=t.buildTag("div.e-color e-color-image e-empty"),this._liTag.append(f),this._divTag.prepend(this._liTag);this._swatchesArea.append(this._divTag);this._footer=t.buildTag("div.e-footer");this._swatches=t.buildTag("div.e-element");this._changeTag=t.buildTag("div.e-switcher").attr("tabindex","0");this._switcher=t.buildTag("div.e-color-image");this._presetTag=t.buildTag("button.e-presets e-colorSplit");this._presets=t.buildTag("div");this._changeTag.append(this._switcher);this._presetTag.append(this._presets);this._swatches.append(this._changeTag,this._presetTag);this._footer.append(this._swatches);this._footerBlock.append(this._templateWrapper,this._swatchesArea,this._footer);this.PaletteWrapper=this._layoutType(this.model.palette);this.popupList.append(this.PaletteWrapper,this._footerBlock);i=n("#"+this._id+"_Presets").get(0);i&&(n(i).parent().hasClass("e-menu-wrap")?n(i).parent().remove():n(i).remove());this._presetContainer=n("<ul id='"+this._id+"_Presets' class='e-presetWrapper' style: top:87px ><\/ul>");this._presetLi=t.buildTag("li.e-item");this._presetLi.append(this._renderPresets());this._presetContainer.append(this._presetLi);this.popupList.append(this._presetContainer);this.popupContainer.append(this.popupList);(this._browser.name="msie"&&(this._browser.version=="9.0"||this._browser.version=="8.0"))?this._hueSlider.addClass("e-color-image e-filter"):this._hueSlider.addClass("e-common");this._width=this._gradientArea.width();this._height=this._gradientArea.height()},_buttonContainer:function(){this.model.displayInline||(this.model.showApplyCancel?(this._buttonTag=t.buildTag("button.e-applyButton","",{},{type:"button"}),this._cancelTag=t.buildTag("button.e-cancelButton","",{},{type:"button"}),this._footer.append(this._buttonTag,this._cancelTag),this._applyObj=this.popupContainer.find("button.e-applyButton").ejButton({text:this.model.buttonText.apply,type:"button",cssClass:"e-flat"}).data("ejButton"),this._cancelObj=this.popupContainer.find("button.e-cancelButton").ejButton({text:this.model.buttonText.cancel,type:"button",cssClass:"e-flat"}).data("ejButton"),this._on(this._cancelTag,"click",this._hidePopup),this._on(this._buttonTag,"click",this._buttonClick)):this._buttonTag!==i&&this._cancelTag!==i&&(this._buttonTag.remove(),this._cancelTag.remove(),this._off(this._cancelTag,"click",this._hidePopup),this._off(this._buttonTag,"click",this._buttonClick)))},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._enabled(!1):i.wrapper.attr(t,n)})},_showClearIcon:function(n){n?(this._clearIcon=t.buildTag("div",{},{},{"class":"e-icon e-close_01"}).hide(),this._codeEditor.append(this._clearIcon),this._on(this._clearIcon,"mousedown",this._clearColor),this._on(this._clearIcon,"click",this._clearColor)):(this._clearIcon&&this._clearIcon.remove(),this._off(this._clearIcon,"mousedown",this._clearColor),this._off(this._clearIcon,"click",this._clearColor))},_colorPresetsClick:function(t){this._presetsId=t.currentTarget.id;this._presetsId==="e-presets00"?this.model.presetType="webcolors":this._presetsId==="e-presets01"?this.model.presetType="vintage":this._presetsId==="e-presets02"?this.model.presetType="seawolf":this._presetsId==="e-presets10"?this.model.presetType="sandy":this._presetsId==="e-presets11"?this.model.presetType="pinkshades":this._presetsId==="e-presets12"?this.model.presetType="moonlight":this._presetsId==="e-presets20"?this.model.presetType="monochrome":this._presetsId==="e-presets21"?this.model.presetType="misty":this._presetsId==="e-presets22"?this.model.presetType="flatcolors":this._presetsId==="e-presets30"?this.model.presetType="basic":this._presetsId==="e-presets31"?this.model.presetType="candycrush":this._presetsId==="e-presets32"&&(this.model.presetType="citrus");this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType);n("#"+this._id+"_Presets").find("li.e-preset-row").removeClass("e-presetsactive");n("#"+this._presetsId).addClass("e-presetsactive");this.PaletteWrapper.remove();this._modelType=="palette"&&(this.PaletteWrapper=this._layoutType(this.model.palette),this._gradient.addClass("e-hide"),this._paletteType(),this._switcher.addClass("e-pickerModel").removeClass("e-paletteModel"))},_renderPresets:function(){var r=t.buildTag("div.e-presets-table"),f,u,n,i;for(this._spnTag=t.buildTag("span.e-presetHeader"),this._spnTag.html(this.model.buttonText.swatches),r.append(this._spnTag),f=0,n=0;n<4;n++){for(u=t.buildTag("ul.e-tablerow"),i=0;i<3;i++)tableCell=t.buildTag("li.e-color-image e-preset-row#e-presets"+[n]+[i]),tableCell.appendTo(u);u.appendTo(r)}return r},_renderPopupElement:function(){var i=this;this._hsv={h:360,s:0,v:100};this._rgb.ejButton({text:"RGBA",type:"button"});this._hexCode.ejButton({text:"HEX",type:"button"});this._hsva.ejButton({text:"HSVA",type:"button"});this._splitObj=this._presetTag.ejSplitButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly"}).data("ejSplitButton");this._splitObj.option("beforeOpen",function(n){i._bindClickOperation(n)});this._presetTag.parents(".e-split.e-widget").css({height:"27px"});this.model.custom.length==0?this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType):"";n("#"+this._presetsId).addClass("e-presetsactive");this._splitObj._getXYpos=function(){return n("#"+this.model.targetID).ejMenu({animationType:"none"}),btnpos=this.dropbutton.offset(),btnposx=btnpos.left-this.dropbutton.prev().outerWidth()-1,btnposy=btnpos.top-n("#"+this.model.targetID).outerHeight()-1,{x:btnposx,y:btnposy}};this._colorSlider=this._hueSlider.ejSlider({orientation:"Vertical",showTooltip:this.model.showTooltip,minValue:0,maxValue:360,change:function(n){i._changeHue(n)},slide:function(n){i._changeHue(n)}}).data("ejSlider");this._opacity=this._alphaSlider.ejSlider({value:this.opacityValue(),showTooltip:this.model.showTooltip,orientation:"Vertical",incrementStep:5,value:100,change:function(n){i._changeAlpha(n)},slide:function(n){i._changeAlpha(n)}}).data("ejSlider");(this._browser.name="msie"&&this._browser.version=="8.0")&&(this._handleTag=t.buildTag("div.e-handle-wrapper"),this._handleTag.appendTo(this._opacity.element.find("a.e-handle")));this._colorSlider.firstHandle.css({height:"13px",width:"13px"});this._opacity.firstHandle.css({height:"13px",width:"13px"});this.popupContainer.css({visibility:"visible",display:"none"});this.model.modelType=="picker"?(this._modelType="picker",this._gradient.removeClass("e-hide"),this.PaletteWrapper.addClass("e-hide"),this._presetTag.parents(".e-split.e-widget").addClass("e-hide"),this._showSwitcher(),this._switch=!0):this.model.modelType=="palette"&&(this._modelType="palette",this._presetTag.parents(".e-split.e-widget").removeClass("e-hide"),this.PaletteWrapper.removeClass("e-hide"),this._gradient.addClass("e-hide"),this._hsva.ejButton("disable"),this._showSwitcher(),this._switch=!1)},_layoutType:function(n){return typeof n=="string"&&n=="basicpalette"?this._collection=this._paletteGenerate(r[this.model.presetType],this.model.columns):typeof n=="string"&&n=="custompalette"&&this.model.modelType=="palette"&&(this._collection=this._paletteGenerate(this.model.custom,this.model.columns)),n=="custompalette"?this._collection.addClass("e-custom"):"",this._collection},_presetType:function(n){return n==="e-presets00"?this._collection=this._paletteGenerate(r.webcolors,this.model.columns):n==="e-presets01"?this._collection=this._paletteGenerate(r.vintage,this.model.columns):n==="e-presets02"?this._collection=this._paletteGenerate(r.seawolf,this.model.columns):n==="e-presets10"?this._collection=this._paletteGenerate(r.sandy,this.model.columns):n==="e-presets11"?this._collection=this._paletteGenerate(r.pinkshades,this.model.columns):n==="e-presets12"?this._collection=this._paletteGenerate(r.moonlight,this.model.columns):n==="e-presets20"?this._collection=this._paletteGenerate(r.monochrome,this.model.columns):n==="e-presets21"?this._collection=this._paletteGenerate(r.misty,this.model.columns):n==="e-presets22"?this._collection=this._paletteGenerate(r.flatcolors,this.model.columns):n==="e-presets30"?this._collection=this._paletteGenerate(r.basic,this.model.columns):n==="e-presets31"?this._collection=this._paletteGenerate(r.candycrush,this.model.columns):n==="e-presets32"&&(this._collection=this._paletteGenerate(r.citrus,this.model.columns)),this._collection},_paletteGenerate:function(i,r){var u;for(this._PresetTable=t.buildTag("div.e-palette-color").attr({role:"presentation"}),this._tag=t.buildTag("div.e-row"),u=0;u<i.length;u++)u&&u%r==0&&(this._tag=t.buildTag("div.e-row")),this._td=t.buildTag("div.e-item").attr({role:"gridcell","aria-label":"#"+n.trim(i[u]),value:"#"+n.trim(i[u]),style:"background-color:#"+n.trim(i[u])}),this._tag.append(this._td),this._PresetTable.append(this._tag);return this._PresetTable},_checkNameAttr:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id})},_enabled:function(n){n?this.enable():(this.model.enabled=!0,this.disable())},_setDisplayInline:function(i){this.model.displayInline=i;i&&this.element.is("input")?(this.popupContainer.insertAfter(this.wrapper),this._footer.css({display:"none"}),this._setPopupPosition()):i?(this.element.append(this.popupContainer),this.popupContainer.find("button.e-applyButton").css({display:"none"}),this.popupContainer.find("button.e-cancelButton").css({display:"none"}),this._footer.css({display:"none"})):(this.popupContainer.css("display","none"),n("body").append(this.popupContainer),this._isOpen=!1,this.element.is("input")&&(this._bindIconClick(),this.popupContainer.find("button.e-applyButton").length==0&&this._buttonContainer(),this._footer.css({display:"block"}),this.wrapper.removeClass("e-focus"),this._off(n(document),"mousedown",this._onDocumentClick)),this._isFocused=this.isPopupOpen=!1);i&&(this.show(),this.element.is("input")&&this._off(n(this._buttonElement),"mousedown",this._iconClick),this._off(t.getScrollableParents(this.wrapper),"scroll",this.hide))},_bindIconClick:function(){var i=n._data(n(this._buttonElement)[0],"events");t.isNullOrUndefined(i)||t.isNullOrUndefined(i.mousedown)?this._on(this._buttonElement,"mousedown",this._iconClick):i.mousedown.length==0&&this._on(this._buttonElement,"mousedown",this._iconClick)},_unBindIconClick:function(){this._off(this._buttonElement,"mousedown",this._iconClick)},_setPopupPosition:function(){var t=this.element.is("input")?this.wrapper:this.element,i=this._getOffset(t),e,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),f=this.popupContainer.outerHeight(),u=this.popupContainer.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(f<h||f>c?i.top+o+s:i.top-f-s)-l;e=n(document).scrollLeft()+n(window).width()-r;u>e&&u<r+t.outerWidth()&&(r-=this.popupContainer.outerWidth()-t.outerWidth());u+t.offset().left>n(window).width()&&(r=Math.abs(u-n(window).width()));this.popupContainer.css({left:r+"px",position:"absolute",top:v+"px","z-index":a})},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popupContainer)},_setValue:function(n,i){(typeof n=="object"||typeof n=="number"||t.isNullOrUndefined(n.match("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$")))&&(n=null);this.value(n);this._tempValue=n;t.isNullOrUndefined(n)?this._setEmptyValue():this._renderModelValue(n);this._changeEvent(!1,i);this._selectEvent();this.element.is("input")&&this._updateValue()},_renderModelValue:function(n){var t;n&&typeof n=="string"&&(t=this._HexToHSV(n),this._oldValue=this.rgb,this._switch&&(this._valueOperation(),this._colorSlider.option("value",parseInt(this._hsv.h))),this._inputTagValue(this._selectedButton),this._switch||(this._updateUI(),this.element.val(this.value())),this._hueGradient())},setValue:function(n){this._setValue(n)},enable:function(){if(this.model.enabled)return!1;this.wrapper&&this.wrapper.hasClass("e-disable")?(this.wrapper.removeClass("e-disable"),this.element.prop("disabled",!1),this.container.hasClass("e-disable")&&this.container.removeClass("e-disable"),this.popupList.removeClass("e-disable"),this.dropdownbutton.removeClass("e-disable")):this.model.displayInline&&this.element.removeClass("e-disable");var t=this._switch;this._switch=!0;this._cancelObj.enable();this._colorSlider.enable();this.model.enableOpacity?this._opacity.enable():this._opacity.disable();this._splitObj.enable();this._applyObj.enable();this._wireEvents();this._switchEvents();this._switch=t;n(this._inputTag).prop("readonly",!1);this._buttonElement&&this._on(this._buttonElement,"mousedown",this._iconClick);this.model.enabled=!0},disable:function(){if(!this.model.enabled)return!1;this.wrapper&&!this.wrapper.hasClass("e-disable")?(this.wrapper.addClass("e-disable"),this.element.attr("disabled","disabled"),this.container.hasClass("e-disable")||this.container.addClass("e-disable"),this.popupList.addClass("e-disable"),this.dropdownbutton.addClass("e-disable")):this.model.displayInline&&this.element.addClass("e-disable");var t=this._switch;this._switch=!1;this._cancelObj.disable();this._colorSlider.disable();this._opacity.disable();this._splitObj.disable();this._applyObj.disable();this._unWireEvents();this._unSwitchEvents();this._switch=t;this._unBindIconClick();n(this._inputTag).attr("readonly","readonly");this.isPopupOpen&&!this.model.displayInline&&this.hide();this.model.enabled=!1},getColor:function(){return this.rgb},getValue:function(){return this.value()},_alphaGradient:function(n){var i=t.browserInfo(),n=t.isNullOrUndefined(n)?"#000000":n;i.name=="mozilla"?this._alphaSlider.attr({style:"background:-moz-linear-gradient(center top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"}):i.name=="msie"||i.name=="edge"?this._alphaSlider.attr({style:"background:-ms-linear-gradient(top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"}):i.name=="opera"&&i.version<="11.61"?this._alphaSlider.attr({style:"background:-o-linear-gradient(top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"}):(i.name=="chrome"||i.name=="safari"||i.name=="opera")&&this._alphaSlider.attr({style:"background:-webkit-linear-gradient(top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"});i.name=="msie"&&(i.version=="8.0"||i.version=="9.0")&&this._alphaSlider.attr({style:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+n+", endColorstr=#ffffff)"});i.name=="msie"&&i.version=="8.0"&&this._handleTag.css({background:this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"})},_hueGradient:function(){var n=this._hsv,t={h:this._hsv.h,s:100,v:100};this._hueSlider.children(".e-handle").css({background:this._formRGB(this.HSVToRGB(t))});this._hsv=n},_updateColor:function(){(this.model.displayInline||!this.model.showApplyCancel)&&(this.value(this._tempValue),this.element.is("input")&&this._updateValue(),this._trigger("select",{value:this.value()}),this._previousColor=this._tempValue)},_changeEvent:function(n,t){this._change&&this._previousValue!==this._tempValue&&(this._alphaGradient(this._tempValue),this._previousValue=this._tempValue,this._trigger("change",{value:this._tempValue,changeFrom:n?"slider":"picker",isInteraction:!t}),this._updateColor(n))},_selectEvent:function(){(this._previousColor!==this._tempValue||this._tempOpacity!==this.opacityValue())&&(this.value(this._tempValue),this.element.is("input")&&this._updateValue(),this.element.val(this.value()),this._trigger("select",{value:this.value()}),this._previousColor=this._tempValue)},_changeHue:function(n){this._handleArea.css("visibility","visible");parseInt(this._hsv.h)!==parseInt(n.value)&&this._switch&&(this._hsv.h=Math.round(n.value),this._hueGradient(),this._hsvValue(),this._tempValue=this.RGBToHEX(this.rgb),this._changeEvent(!0))},_changeAlpha:function(n){this._handleArea.css("visibility","visible");this._switch&&(this.rgb.a=n.value/100,this._tempOpacity=parseInt(this.rgb.a*100),this._changeOpacity(n))},_changeOpacity:function(n){this.rgb.a=this._tempOpacity/100;(this._browser.name="msie"&&this._browser.version=="8.0")?(this._currentTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}),this._handleTag.css({background:this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"})):(this._currentTag.css("background-color",this._formRGBA(this.rgb)),this._alphaSlider.children(".e-handle").css({background:this._formRGBA(this.rgb)}));this._inputTagValue(this._selectedButton);this.model.displayInline?(this._trigger("change",{value:this._tempValue,changeFrom:"slider",isInteraction:t.isNullOrUndefined(n)?!1:n.isInteraction}),this._trigger("select",{value:this.value()})):this._trigger("change",{value:this._tempValue,changeFrom:"slider",isInteraction:t.isNullOrUndefined(n)?!1:n.isInteraction})},_updateValue:function(){this.value()?(this._browser.name="msie"&&this._browser.version=="8.0")?this.spanElement.css({"background-color":this._formRGB(this._HexToRGB(this.value())),filter:"alpha(opacity="+this.rgb.a*100+")"}):this.spanElement.css({"background-color":this._formRGBA(this._HexToRGB(this.value()))}):this.spanElement.removeAttr("style")},_bindClickOperation:function(){var t=this;t._on(n("#"+this._id+"_Presets").find("li.e-preset-row"),"mousedown",t._colorPresetsClick);SplitMenu=n("#"+t._presetContainer.attr("id")).ejMenu("instance");SplitMenu.model.close=function(){t._splitObj.contstatus=!1;t._off(n("#"+this._id+"_Presets").find("li.e-preset-row"),"mousedown",t._colorPresetsClick)}},_wireEvents:function(){this.element.is("input")&&(this._on(this.wrapper,"blur",this._targetBlur),this._on(this.wrapper,"focus",this._targetFocus),this._on(this.wrapper,"keydown",this._popupShown),this._on(this.colorContainer,"click",this._containerClick));this._on(this._changeTag,"click",this._switchModel);this._on(this._groupTag,"click",this._groupButton);this._on(this._addTag,"click",this._addColor);this._on(this._codeEditor,"mouseenter",this._inputEvent);this._on(this._codeEditor,"mouseleave",this._inputEvent);this._on(this._inputTag,"blur",this._inputEvent);this._on(this._inputTag,"focus",this._inputEvent);this._on(this._inputTag,"keyup",this._inputEvent);this._on(this.popupContainer,"focus",this._targetFocus);this._on(this.popupContainer,"blur",this._targetBlur)},_unWireEvents:function(){!this.model.displayInline&&this.element.is("input")&&(this._off(this.wrapper,"blur",this._targetBlur),this._off(this.wrapper,"focus",this._targetFocus),this._off(this.wrapper,"keydown",this._popupShown),this._off(this.colorContainer,"click",this._containerClick));this._off(this._changeTag,"click",this._switchModel);this._off(this._groupTag,"click",this._groupButton);this._off(this._addTag,"click",this._addColor);this._off(this._codeEditor,"mouseenter",this._inputEvent);this._off(this._codeEditor,"mouseleave",this._inputEvent);this._off(this._inputTag,"blur",this._inputEvent);this._off(this._inputTag,"focus",this._inputEvent);this._off(this._inputTag,"keyup",this._inputEvent);this._off(this.popupContainer,"focus",this._targetFocus);this._off(this.popupContainer,"blur",this._targetBlur)},_inputEvent:function(n){this._clearIcon&&(n.type==="focus"&&this._off(this._codeEditor,"mouseleave",this._inputEvent),n.type==="blur"&&this._on(this._codeEditor,"mouseleave",this._inputEvent),n.type==="keyup"&&(this._inputTag.val()!==""?(this._clearIcon.show(),this._handleArea.css("visibility","visible")):(this._clearIcon.hide(),this._handleArea.css("visibility","hidden"))),n.type==="mouseleave"||n.type==="blur"||this._inputTag.val()==""?this._clearIcon.hide():this._clearIcon.show())},_clearColor:function(n){this._tempValue="";this._inputTag.val("");this._setEmptyValue();n.type=="click"&&(this._clearIcon.hide(),this._inputTag.focus())},_containerClick:function(){this.model.buttonMode=="split"&&this._trigger("select",{value:this.value()})},_popupShown:function(n){if(n.keyCode==13)return this._showHidePopup(),this.isPopupOpen||this._buttonClick(n),!1},_recentColor:function(i){var f,e,r,u;if(this._divTag.find(".e-select").removeClass("e-select").addClass("e-block"),f=i.target.attributes.value,r=i.target.attributes.style,t.isNullOrUndefined(f)||t.isNullOrUndefined(r))return this._change=!1,!1;n(i.target.parentNode).addClass("e-select").removeClass("e-block");u=r.value.replace(/^(background-color:rgb|background-color:rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(",");t.isNullOrUndefined(u[3])?(this._browser.name="msie"&&this._browser.version=="8.0")?(e=parseInt(r.nodeValue.replace(/^(FILTER: alpha)\(/,"").split("=")[1].split(")")[0]),this._opacity.option("value",e),this.rgb.a=e/100):(this._opacity.option("value",100),this.rgb.a=1):(this._opacity.option("value",parseInt((parseFloat(u[3])*100).toFixed(2))),this.rgb.a=parseFloat(parseFloat(u[3]).toFixed(2)));this._HexToHSV(f.value);this._inputTagValue(this._selectedButton);this._tempValue=this.RGBToHEX(this.rgb);this._valueOperation();this._colorSlider.option("value",parseInt(this._hsv.h));this._hueGradient();this._changeEvent(!1);(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus()},_handleClick:function(t){t.preventDefault();this._width=this._gradientArea.width();this._height=this._gradientArea.height();this.model.displayInline&&(this._isFocused=!0);this._handleArea.css("visibility","visible");this.mouseDownPos=this._handlePos;n(document).on("mousemove touchmove",n.proxy(this._handleMovement,this));n(document).on("mouseup touchend",n.proxy(this._handleUp,this))},_handleMove:function(n){this._handleArea.css("visibility","visible");this._handleMovement(n);this._focusWrapper(n)},_handleMovement:function(n){if(!this.model.enabled)return!1;var t=n.pageX,i=n.pageY;this.element.is("input")&&this.wrapper.focus();(n.type=="touchstart"||n.type=="touchmove")&&(t=n.originalEvent.changedTouches[0].pageX,i=n.originalEvent.changedTouches[0].pageY);this._hsv.v=parseInt(100*(this._gradientArea.height()-Math.max(0,Math.min(this._gradientArea.height(),i-this._gradientArea.offset().top)))/this._gradientArea.height(),10);this._hsv.s=parseInt(100*Math.max(0,Math.min(this._gradientArea.width(),t-this._gradientArea.offset().left))/this._gradientArea.width(),10);this._hsvValue();this._tempValue=this.RGBToHEX(this.rgb);this._change=!0;this._changeEvent(!1)},_handleUp:function(t){return n(document).off("mouseup touchend",this._handleUp),n(document).off("mousemove touchmove",this._handleMovement),this._focusWrapper(t),!1},_handlePosition:function(){this._handlePos=this._handleArea?{left:parseInt(parseInt(this._width)*this._hsv.s/100,10)+"px",top:parseInt(parseInt(this._height)*(100-this._hsv.v)/100,10)+"px"}:"";this._handleArea.css({left:this._handlePos.left,top:this._handlePos.top})},_addColor:function(){var t=this._divTag.find("> div");value=this._selectedButton.html()!="HSVA"?this._inputTag.val():this._formRGBA(this.HSVToRGB(this._hsv));value!==""&&this._change&&this.model.showRecentColors&&t.length<=12&&(n(n(t)[t.length-2]).remove(),this._generateLi());(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus()},_buttonClick:function(){this._change=!0;var n=this._inputTag.val(),t=this._divTag.find("div");if(this._opacity.option("value",this._tempOpacity),this._tempValue=this.RGBToHEX(this.rgb),this._updatePreviewColor(),this._inputTag.val()==="")if(this._tempValue="",this.model.showClearButton)this._setValue("");else return this._inputTag.addClass("e-error"),!1;this._selectEvent();this.element.is("input")&&(this._updateValue(),this.wrapper.focus());this.model.displayInline||this.hide();this._tempOpacity!==this.opacityValue()&&this.opacityValue(this._tempOpacity)},_generateLi:function(){this._liTag=t.buildTag("div.e-colorblock e-block e-colorset").attr({value:this.RGBToHEX(this.rgb),tabindex:"0"});var n=t.buildTag("div.e-color e-set").attr({value:this.RGBToHEX(this.rgb),title:this.RGBToHEX(this.rgb)});(this._browser.name="msie"&&this._browser.version=="8.0")?n.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}):n.css({"background-color":this._formRGBA(this.rgb)});this._liTag.append(n);this._divTag.prepend(this._liTag)},_colorCodeValue:function(i){var e="",c=this._inputTag.val(),u,r,f,o,s,h;if(u=n.trim(c),u.length==5?this._inputTag.removeClass("e-error"):"",this._keyPressFlag=i.shiftKey&&i.keyCode>=35&&i.keyCode<=40||i.keyCode>=65&&i.keyCode<71||i.keyCode==51||i.ctrlKey&&(i.keyCode==88||i.keyCode==86)||i.keyCode==190?1:i.crtlKey||i.shiftKey||!(i.keyCode>=65&&i.keyCode<71||i.keyCode>=35&&i.keyCode<=40||i.keyCode>=96&&i.keyCode<=105||i.keyCode>=48&&i.keyCode<=57||i.keyCode==13||i.keyCode==8||i.keyCode==46||i.type==="blur")?0:1,(this.model.enableOpacity&&(i.keyCode==188||i.keyCode==71||i.keyCode==72||i.keyCode==82||i.keyCode==83||i.keyCode==86)||i.shiftKey&&(i.keyCode==57||i.keyCode==48))&&(this._keyPressFlag=1),this._keyPressFlag==1){if(this._inputTag.removeClass("e-error"),i.keyCode===13||i.type==="blur"){if(u===""&&(this.model.showClearButton?this._setEmptyValue():this._inputTag.addClass("e-error")),o=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,r=u.match(o),t.isNullOrUndefined(r))if(s=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/,r=u.match(s),t.isNullOrUndefined(r)){if(h=/^hsva?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/,r=u.match(h),t.isNullOrUndefined(r))return u!=""&&this._inputTag.addClass("e-error"),this._change=!1,!1;this._hsvColor(r)}else this._rgbaColor(r);else{if(r[1].length===3)for(f=0;f<r[1].length;f++)e+=r[1][f]+r[1][f];else r[1].length===6&&(e=r[1]);u=this.hexCodeToRGB("#"+e);this._inputTag.val("#"+e);this.rgb=this.HSVToRGB(this.RGBToHSV(u));this._tempValue=this.RGBToHEX(this.rgb);this._change=!0}this._change&&(this._valueOperation(),this._colorSlider.option("value",parseInt(this._hsv.h)),this._hueGradient(),this._changeEvent(!1),this.element.is("input")||this._selectEvent(),this._inputTag.val()!==""&&this._inputTag.removeClass("e-error"))}}else i.keyCode!=9&&i.preventDefault(),i.shiftKey||i.ctrlKey||i.keyCode===27||i.keyCode==20||this._inputTag.addClass("e-error")},_setEmptyValue:function(){this._handleArea.css("visibility","hidden");this._currentTag.css({"background-color":""});this._removeClass();this._tempValue=null;this._inputTag.val(null);this._previousValue!==this._tempValue&&(this._trigger("change",{value:null}),this._previousValue=this._tempValue)},_rgbaColor:function(n){var i={};if(n[0].split("(")[0]!="rgba"||t.isNullOrUndefined(n[4]))if(n[0].split("(")[0]=="rgb"&&t.isNullOrUndefined(n[4]))i.r=n[1],i.g=n[2],i.b=n[3],i.a=this.rgb.a,this._inputTag.val("rgba("+i.r+","+i.g+","+i.b+","+i.a+")");else return this._inputTag.addClass("e-error"),this._change=!1,!1;else i.r=n[1],i.g=n[2],i.b=n[3],i.a=n[4];this.rgb.a=parseFloat(i.a);this._tempOpacity=this.rgb.a*100;this._opacity.option("value",this._tempOpacity);this.opacityValue(this._tempOpacity);this._tempValue=this.RGBToHEX(i);this._HexToHSV(this._tempValue);this._inputTag.removeClass("e-error");this._change=!0},_hsvColor:function(n){var i={};if(t.isNullOrUndefined(n[4]))return this._inputTag.addClass("e-error"),this._change=!1,!1;i.h=n[1];i.s=n[2];i.v=n[3];i.a=n[4];this.rgb.a=parseFloat(i.a);this._tempOpacity=this.rgb.a*100;this._opacity.option("value",this._tempOpacity);this.opacityValue(this._tempOpacity);this.rgb=this.HSVToRGB(i);this._tempValue=this.RGBToHEX(this.rgb);this._inputTag.removeClass("e-error");this._change=!0},_iconClick:function(n){n.preventDefault();this._showHidePopup();this.wrapper.focus()},_showHidePopup:function(){if(this.model.displayInline)return!1;this.isPopupOpen?(this.hide(),this.wrapper.focus()):this.show()},hide:function(){var i=this;if(!this.isPopupOpen||this.model.displayInline)return!1;this.isPopupOpen=this._dataBind=!1;this.element.is("input")&&(this.wrapper.focus(),this.wrapper.removeClass("e-active"));this._width=this._gradientArea.width();this._height=this._gradientArea.height();this.popupContainer.slideUp(200,function(){i.model&&(i._tempOpacity=i.opacityValue(),i.rgb.a=i._tempOpacity/100,i._tempValue=i.value(),i._renderModelValue(i.value()),i._opacity.option("value",parseInt(i.opacityValue())),i.model.displayInline||i._off(n(document),"mousedown",i._onDocumentClick),i._trigger("close"))});this.model.displayInline||this._off(n(document),"mousedown",this._onDocumentClick);this._off(this._inputTag,"keydown",this._colorCodeValue);this._off(this._inputTag,"blur",this._colorCodeValue);this._modelType=="palette"?this._off(n(document),"keydown",this._keyDown):this._off(n(document),"keydown",this._onKeyDown);this._off(t.getScrollableParents(this.wrapper),"scroll",this.hide);n(window).off("resize",n.proxy(this._OnWindowResize,this))},_hidePopup:function(){this.model.displayInline||this.hide()},show:function(){if(this.element.is("input")&&(this.wrapper.focus(),this.wrapper.addClass("e-active")),this.isPopupOpen||!this.model.enabled)return!1;this.isPopupOpen=!0;this.model.modelType=="palette"&&this._cellSelect();!this.model.displayInline&&(this.value()===""||t.isNullOrUndefined(this.value()))?this._setEmptyValue():this._handleArea.css("visibility","visible");this._previousColor=this._previousValue=this.value();this.popupContainer.children().find(".e-focus").removeClass("e-focus");this.model.displayInline||this._setPopupPosition();var i=this;this.popupContainer.slideDown(200,function(){i.isFocused=!0;i._on(n(document),"mousedown",i._onDocumentClick);i._trigger("open")});this._dataBind||(this._modelType=="palette"?this._on(n(document),"keydown",this._keyDown):this._on(n(document),"keydown",this._onKeyDown));this._on(this._inputTag,"keydown",this._colorCodeValue);this._on(this._inputTag,"blur",this._colorCodeValue);this._dataBind=!0;n(window).on("resize",n.proxy(this._OnWindowResize,this));this.model.displayInline||this._on(t.getScrollableParents(this.wrapper),"scroll",this.hide);this._prevSize!==n(window).width()&&this.refresh()},_showBindEvents:function(){this._modelType=="palette"?this._on(n(document),"keydown",this._keyDown):this._on(n(document),"keydown",this._onKeyDown)},_hideUnBindEvents:function(){this._modelType=="palette"?this._off(n(document),"keydown",this._onKeyDown):this._off(n(document),"keydown",this._keyDown)},_switchEvents:function(){this._switch?(this._on(this._gradientArea,"mousedown touchstart",this._handleMove),this._on(this._handleArea,"mousedown touchstart",this._handleClick),this._on(this._gradientArea,"mousedown touchstart",this._handleClick)):this._on(this._collection,"mousedown",this._onSelect)},_unSwitchEvents:function(){this._switch?this._off(this._collection,"mousedown",this._onSelect):(this._off(this._gradientArea,"mousedown touchstart",this._handleMove),this._off(this._handleArea,"mousedown touchstart",this._handleClick),this._off(this._gradientArea,"mousedown touchstart",this._handleClick))},_groupButton:function(t){if(n(t.target).hasClass("e-disable"))return!1;if(n(t.target).hasClass("e-button")){var i=this._groupTag.find(".e-btn.e-select");this._inputTag.val()!==""?this._inputTagValue(n(t.target)):this._selectedButton=n(t.target);this._selectedButton.html()!=="HEX"?this._inputTag.attr("maxLength","22"):this._inputTag.attr("maxLength","7");this._groupTag.find(".e-click").removeClass("e-click");n(t.target).addClass("e-click");this._inputTag.removeClass("e-error")}},_inputTagValue:function(n){n.html()=="RGBA"?this._inputTag.val(this._formRGBA(this.rgb)):n.html()=="HEX"?this._inputTag.val(this.RGBToHEX(this.rgb)):n.html()=="HSVA"&&this._modelType!="palette"&&this._inputTag.val("hsva("+Math.round(this._hsv.h)+","+Math.round(this._hsv.s)+","+Math.round(this._hsv.v)+","+this.rgb.a+")");this._selectedButton=n},_bindRecentEvent:function(){this._on(this._divTag,"click",this._recentColor)},_unBindRecentEvent:function(){this._off(this._divTag,"click",this._recentColor)},_handlePlacement:function(n,t,i){this._handleArea.css("visibility","visible");var r=this._hsv;r[n]+=t*(i?1:3);r[n]<0&&(r[n]=0);n==="s"?this._hsv.s=r[n]:this._hsv.v=r[n];this._hsvValue();this._tempValue=this.RGBToHEX(this.rgb);this._changeEvent(!1)},_onKeyDown:function(t){var i=t.keyCode;if(this.model.enabled&&(t.shiftKey&&i==9&&n(this._hueSlider).find(".e-handle").hasClass("e-focus")&&this._focusWrapper(t),this._isFocused||i!=9||i===27)&&(this._change=!0,!t.altKey&&!t.shiftKey))switch(i){case 39:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("s",1,t.ctrlKey));break;case 38:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("v",1,t.ctrlKey));break;case 37:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("s",-1,t.ctrlKey));break;case 40:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("v",-1,t.ctrlKey));break;case 13:t.preventDefault();n(t.target).hasClass("e-switcher")?(this._switchModel(),n(t.target).focus()):n(t.target).hasClass("e-applyButton")&&this._buttonClick(t);break;case 27:t.preventDefault();this.model.displayInline||this.hide();this._tempValue=this.value();break;case 9:active=document.activeElement;n(active).is(this.wrapper)&&this._focusPopup(t)}},_focusPopup:function(t){n(this._hueSlider).find(".e-handle").focus();t.preventDefault()},_focusWrapper:function(t){this.element.is("input")&&n(this.wrapper).focus();t.preventDefault()},_onDocumentClick:function(t){n(t.target).is(this.popupContainer)||n(t.target).parents(".e-colorpicker").is(this.popupContainer)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-colorpickerwidget").is(this.wrapper)||n(t.target).parents(".e-presetWrapper").is("#"+this._id+"_Presets")||(this.model.displayInline||(this.hide(),this.element.is("input")&&this.wrapper.removeClass("e-focus")),this._isFocused=!1)},_OnWindowResize:function(){this.element.is("input")&&this._setPopupPosition();this.refresh()},refresh:function(){var t=n(this._PresetTable.find(".e-item")[1]),i=10,u,r;this.isPopupOpen?this._modelType=="picker"&&this.PaletteWrapper.css({display:"block",visibility:"hidden"}):(this.popupContainer.css({display:"block",visibility:"hidden"}),this._modelType=="palette"&&this.PaletteWrapper.css({display:"block",visibility:"hidden"}));(parseFloat(this._tag.outerHeight())>t.outerHeight(!0)||n(this._tag).outerWidth()-n(t).outerWidth(!0)*i>t.outerWidth()||n(this._tag).outerWidth()==0)&&(u=parseFloat(n(this._tag).outerWidth())-36,r=u/i-(t.outerWidth()-t.width()),this._PresetTable.find(".e-item").css("width",r),t.outerWidth(!0)*i>this._tag.outerWidth()&&this._PresetTable.find(".e-item").css("width",r-1));this.isPopupOpen?this._modelType=="picker"&&this.PaletteWrapper.css({display:"none",visibility:"visible"}):(this.popupContainer.css({display:"none",visibility:"visible"}),this._modelType=="palette"&&this.PaletteWrapper.css({visibility:"visible"}));this._prevSize=n(window).width();this._width=this._gradientArea.width();this._height=this._gradientArea.height()},_range:function(n,t){return t===""?0:t>n?n:t},_hsvValue:function(){this._change=!0;this._hsv.v=this._hsv.v>=100?100:this._hsv.v;this._hsv.s=this._hsv.s>=100?100:this._hsv.s;this.hsv=this._hsv;this.rgb=this.HSVToRGB(this.hsv);this._valueOperation();this._inputTagValue(this._selectedButton)},_formRGB:function(n){if(!t.isNullOrUndefined(n))return"rgb("+n.r+","+n.g+","+n.b+")"},_formRGBA:function(n){if(!t.isNullOrUndefined(n))return"rgba("+n.r+","+n.g+","+n.b+","+n.a+")"},_rgbValue:function(){value=this._HexToRGB(this._tempValue);t.isNullOrUndefined(value)||(this.rgb=value,this._change=!0,this.HSVToRGB(this.RGBToHSV(this.rgb)),this._colorSlider.option("value",parseInt(this._hsv.h)),this._opacity.option("value",this.rgb.a*100));this._valueOperation();this._inputTagValue(this._selectedButton)},_valueOperation:function(){this._handlePosition();this._alphaGradient(this._tempValue);this._inputTag.removeClass("e-error");this._updateUI()},_HexToHSV:function(n){return this.HSVToRGB(this.RGBToHSV(this._HexToRGB(n)))},_HexToRGB:function(n){if(!t.isNullOrUndefined(n)){var n,i=n.match("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");return t.isNullOrUndefined(i)?(this._change=!1,!1):(i[1].length==3&&(n="#"+i[1][0]+i[1][0]+i[1][1]+i[1][1]+i[1][2]+i[1][2]),this._change=!0,n=parseInt(n.indexOf("#")>-1?n.substring(1):n,16),value=t.isNullOrUndefined(this.rgb)?parseFloat(this._tempOpacity)/100:this.rgb.a,this.rgb={r:n>>16,g:(n&65280)>>8,b:n&255,a:value})}},RGBToHSV:function(n){var t={h:0,s:0,v:0},u=Math.min(n.r,n.g,n.b),i=Math.max(n.r,n.g,n.b),r=i-u;return(t.v=i,t.v*=100/255,r===0)?(this._hsv=t,t):(t.s=i!=0?255*r/i:0,t.h=t.s!=0?n.r==i?(n.g-n.b)/r:n.g==i?2+(n.b-n.r)/r:4+(n.r-n.g)/r:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,this._hsv=t,t)},HSVToRGB:function(n){var i={},f=Math.round(n.h),s=Math.round(n.s*255/100),o=Math.round(n.v*255/100),h;if(s==0)i.r=i.g=i.b=o;else{var r=o,u=(255-s)*o/255,e=(r-u)*(f%60)/60;f==360&&(f=0);f<60?(i.r=r,i.b=u,i.g=u+e):f<120?(i.g=r,i.b=u,i.r=r-e):f<180?(i.g=r,i.r=u,i.b=u+e):f<240?(i.b=r,i.r=u,i.g=r-e):f<300?(i.b=r,i.g=u,i.r=u+e):f<360?(i.r=r,i.g=u,i.b=r-e):(i.r=0,i.g=0,i.b=0)}return this._hsv=n,h=t.isNullOrUndefined(this.rgb)?parseFloat(this._tempOpacity)/100:this.rgb.a,{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b),a:h}},_HSVToHex:function(n){return this.RGBToHEX(this.HSVToRGB(n))},_toHEX:function(n){return n.indexOf("#")!==-1?n:(n=n.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+this._hex(n[1])+this._hex(n[2])+this._hex(n[3]))},RGBToHEX:function(n){if(!t.isNullOrUndefined(n))return"#"+this._hex(n.r)+this._hex(n.g)+this._hex(n.b)},_hex:function(n){return("0"+parseInt(n).toString(16)).slice(-2)},_colorValue:function(n){return this._color=n.indexOf("#")!=-1?this.hexCodeToRGB(n):"","rgb("+this._color.r+", "+this._color.g+", "+this._color.b+")"},hexCodeToRGB:function(n){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:this.rgb.a}:null},_updatePreviewColor:function(){(this._browser.name="msie"&&this._browser.version=="8.0")?this._previousTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}):this._previousTag.css({"background-color":this._formRGBA(this.rgb)});this._oldValue=this.rgb},_updateUI:function(){var t=this._hsv,n;this._switch?(n={h:this._hsv.h,s:100,v:100},this._gradientArea.css({"background-color":this._colorValue(this._HSVToHex(n))})):this._cellSelect();(this._browser.name="msie"&&this._browser.version=="8.0")?(this._currentTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}),this._previousTag.css({"background-color":this._formRGB(this._oldValue),filter:"alpha(opacity="+this.rgb.a*100+")"})):(this._currentTag.css({"background-color":this._formRGBA(this.rgb)}),this._previousTag.css({"background-color":this._formRGBA(this._oldValue)}),this._alphaSlider.children(".e-handle").css({background:this._formRGBA(this.rgb)}));this._hsv=t},_targetFocus:function(n){n.preventDefault();this._isFocused||(this._isFocused=!0,this.element.is("input")&&this.wrapper.addClass("e-focus"))},_targetBlur:function(){this._isFocused=!1;!this.isPopupOpen&&this.element.is("input")&&this.wrapper.removeClass("e-focus")},_switchModel:function(){this._tempValue=this.RGBToHEX(this.rgb);this.refresh();var n=this;this._off(this._changeTag,"click",this._switchModel);this._modelType=="palette"?(this._modelType="picker",this._switcher.removeClass("e-pickerModel").addClass("e-paletteModel"),this.PaletteWrapper.fadeOut(300,function(){n._presetTag.parents(".e-split.e-widget").addClass("e-hide");n._gradient.fadeIn(300);n._on(n._changeTag,"click",n._switchModel)}),this._switch=!0,this._rgbValue(),this._hueGradient(),this._hsva.ejButton("enable")):(this.PaletteWrapper.remove(),this._modelType="palette",this.PaletteWrapper=this._layoutType(this.model.palette),this._gradient.addClass("e-hide"),this._paletteType(),this._switcher.removeClass("e-paletteModel").addClass("e-pickerModel"),this._gradient.fadeOut(300,function(){n._presetTag.parents(".e-split.e-widget").removeClass("e-hide");t.isNullOrUndefined(n.PaletteWrapper)&&(n.PaletteWrapper=n._layoutType(n.model.palette),n._splitObj.option("prefixIcon","e-color-image e-"+n.model.presetType),n.popupList.prepend(n.PaletteWrapper));n.PaletteWrapper.fadeIn(300);n._on(n._changeTag,"click",n._switchModel)}),this.value()!==""&&this._cellSelect(),this._disableHSVButton());this.model.palette==="custompalette"&&this._presetTag.parents(".e-split.e-widget").addClass("e-hide");(!this.model.displayInline||this.element.is(":input"))&&this.wrapper.focus();this._switchEvents();this._unSwitchEvents();this.isPopupOpen&&(this._hideUnBindEvents(),this._showBindEvents())},_disableHSVButton:function(){n(this._groupTag.find(".e-click")).hasClass("e-hsvButton")&&(this._inputTagValue(this._rgb),this._rgb.addClass("e-click"),this._hsva.removeClass("e-click"));this._hsva.ejButton("disable")},_cellSelect:function(){var i,r,t=this;this._removeClass();this._collection.find(".e-item").each(function(){i=n(this).css("background-color");(t._browser.name="msie"&&t._browser.version=="8.0")?i&&i.replace(/ /g,"")===t.RGBToHEX(t.rgb)&&(r=this,n(r).addClass("e-filter")):i&&i.replace(/ /g,"")===t._formRGB(t.rgb)&&(r=this)});n(r).addClass("e-state-selected").attr("aria-selected",!0)},_removeClass:function(){this._collection.find(".e-item").removeClass("e-state-selected").removeClass("e-filter").removeAttr("aria-selected")},_position:function(n,t,i){n=Array.prototype.slice.call(n);var u=n.length,r=n.indexOf(t);return r<0?i<0?n[u-1]:n[0]:(r+=i,n[r<0?r+=u:r%=u])},_onSelect:function(n){if(!this.model.enabled)return!1;this._isFocused=!0;this._handleArea.css("visibility","visible");n.target.style.backgroundColor!=""&&(this._collection.find(".e-item").removeClass("e-state-selected").removeAttr("aria-selected"),this._HexToRGB(this._toHEX(n.target.style.backgroundColor)),this._updateUI(),this._inputTagValue(this._selectedButton),(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus(),this._tempValue=this.RGBToHEX(this.rgb),this._changeEvent(!1));n.preventDefault()},_keyDown:function(t){if(this._isFocused){if(this._change=!0,!this.model.enabled)return!1;var i="",r=t.keyCode,u=this._collection.find(".e-item"),f=u.filter(".e-state-selected").get(0),e=this.model.columns;t.altKey||r!=37&&r!=38&&r!=39&&r!=40||t.target.className==="e-color-code"||this._removeClass();switch(!t.altKey&&r){case 40:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,e));break;case 37:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,-1));break;case 38:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,-e));break;case 39:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,1));break;case 13:this._collection.find(".e-item").removeClass("e-state-selected").removeAttr("aria-selected");n(t.target).hasClass("e-switcher")?(this._switchModel(),n(t.target).focus()):n(t.target).hasClass("e-applyButton")&&(this._buttonClick(t),this._updateUI(),this.model.displayInline||this.hide(),this.element.is("input")&&this.wrapper.focus());break;case 27:this.model.displayInline||this.hide();n(this._presetContainer).hide();this.element.is("input")&&this.wrapper.focus();break;case 9:active=document.activeElement;n(active).is(this.wrapper)&&this._focusPalettePopup(t,!0)}i&&(n(i).addClass("e-state-selected").attr("aria-selected",!0),this._currentTag.css({"background-color":this._formRGB(this._HexToRGB(i.attributes.value.value))}),this._inputTagValue(this._selectedButton),this._tempValue=this.RGBToHEX(this.rgb),this._changeEvent(!1))}else t.keyCode==27&&(this.hide(),n(this._presetContainer).hide())},_focusPalettePopup:function(t){n(this.popupContainer).focus();t.preventDefault()}});t.ColorPicker.Locale=t.ColorPicker.Locale||{};t.ColorPicker.Locale["default"]=t.ColorPicker.Locale["en-US"]={buttonText:{apply:"Apply",cancel:"Cancel",swatches:"Swatches"},tooltipText:{switcher:"Switcher",addButton:"Add Color",basic:"Basic",monoChrome:"Mono Chrome",flatColors:"Flat Colors",seaWolf:"Sea Wolf",webColors:"Web Colors",sandy:"Sandy",pinkShades:"Pink Shades",misty:"Misty",citrus:"Citrus",vintage:"Vintage",moonLight:"Moon Light",candyCrush:"Candy Crush",currentColor:"Current Color",selectedColor:"Selected Color"}};t.ColorPicker.Palette={BasicPalette:"basicpalette",CustomPalette:"custompalette"};t.ColorPicker.ModelType={Palette:"palette",Picker:"picker"};t.ColorPicker.ButtonMode={Default:"dropdown",Split:"split"};t.ColorPicker.PresetType={Basic:"basic",MonoChrome:"monochrome",FlatColors:"flatcolors",SeaWolf:"seawolf",WebColors:"webcolors",Sandy:"sandy",PinkShades:"pinkshades",Misty:"misty",Citrus:"citrus",Vintage:"vintage",MoonLight:"moonlight",CandyCrush:"candycrush"};var r={basic:["ffffff","facbcb","fccb98","faf39a","fbf8cd","a6d38b","aadee8","d1ecf2","cdcae5","eecde1","cccbcb","f16667","f69668","f8ee6b","f7ec37","89c987","75cddd","8bd3e1","7f7fcc","9494c8","b3b2b3","ec2024","f7971d","ffcb67","f5ea14","74bf44","69c8c9","46c7f4","6666ad","b76cab","676767","971b1e","ca6828","ca9732","979937","0d9948","339898","4857a6","62449a","973794","000000","2f1110","973620","663433","343416","183319","023334","22205f","3b2f8d","310e31"],monochrome:["ffffff","e3e3e3","c6c6c6","aaaaaa","8e8e8e","717171","555555","393939","1c1c1c","000000","f9e6e7","f4d0d2","efbabc","e9a4a7","e48e92","df787c","da6267","d44c52","cf363c","ca2027","fff4ca","ffeb9e","fff0b4","ffefb1","ffe788","ffe272","ffd947","ffd531","ffd01b","ffcc05","e4f4eb","ccead9","b4e0c7","9cd6b5","84cca3","6dc190","55b77e","3dad6c","25a35a","0d9948","e8f4f4","d6e3eb","c4d1e3","b3c0da","a1aed1","8f9dc9","7d8bc0","6c7ab7","5a68af","4857a6"],flatcolors:["7477b8","488bca","18b1d4","1db369","78c162","acc063","ffe84e","f6b757","f79853","ed6346","E87F3D","E4C45D","B7A575","999999","67809F","002228","00A578","F9A41F","F3770B","D7401B","FFCB36","82CC2C","36B595","6370AD","D4264E","004D8E","22A04B","F3A414","C77405","F3420B","1ABC9C","3498DB","9B59B6","E67E22","E74C3C","3A738A","EBD9A7","89AD78","FF766D","C76160","BF3542","CDC5BA","EBE3D6","3C3C3C","2E2E2E","77A7FB","E57368","FBCB43","34B67A","FFFFFF"],seawolf:["0EEAFF","15A9FA","1B76FF","1C3FFD","2C1DFF","0B3C4C","0E5066","13647F","127899","1A8BB2","74B8E8","659EBB","3C9FFF","26466F","2472FF","0069A4","009BF2","004165","49A0B4","274C5F","000000","7A5848","E0A088","F9DEC6","3A2A22","DC3522","D9CB9E","374140","2A2C2B","1E1E20","CB3937","FE6B2C","654E44","6DD16F","70FE2C","275673","4681A6","FDDEC9","F22816","400101","071C2F","388494","E6A934","F3DB5F","534329","206956","47683B","E1BFA6","BF7950","903932"],webcolors:["0066aa","00bbdd","338800","77bb00","ffcc99","990c0c","0303c9","336699","669933","cccccc","EEEEEE","E7C36F","F7B230","E35B20","000033","7D7A74","BD524A","FCB200","8CFCC2","2ACD6B","666666","666553","FFFEEC","B2B2A4","AAA4B2","9CA5E3","5A668C","BBA469","CFC295","FFFFFF","DBBF56","2E94B3","808080","E96656","14A168","DE185B","D8806F","DBE186","D8CC63","DCC527","4E6C89","E2BDAD","EC6053","81BBAD","DFCDA5","453394","66398A","313E7D","336694","788E91"],sandy:["c0a986","ecd9c3","dfc79b","f6d58e","ecdaad","fff3e0","7f6b4a","ffd694","7f7a70","ccac76","E6E2AF","A79A71","EFECCA","806F4C","2F2F2E","997F1A","CCB65F","FFD291","6B674A","635F3A","7F693A","FFEBC1","FFD275","7F7561","CCA85E","D29854","4A4034","C9AD8D","4A351D","968169","E6E39F","9A9757","FFFDC9","94909A","E2E0E6","960010","EB1517","CD7C29","9A571C","1F7A94","7F6826","7F724C","FFE499","FFD04C","CCA63D","FFA669","92FFB6","FFF352","E8C269","D7E8CB"],pinkshades:["F6B1C3","F0788C","DE264C","BC0D35","A20D1E","E12256","BB1C48","7B132F","3B0917","FA2660","FFB7B5","9A423F","FF6D68","BB5855","CC5753","E88161","D66C60","C2646E","996072","705262","FFA1BD","FF8FB7","FF82AE","E9719B","CC6882","F250C7","BF1774","BF2696","AC60AA","BB90C5","BF1553","F20775","F2F2F2","e5566d","f2afc1","f43fa5","fc8c99","FF6887","7F3443","CC536C","D06AA9","E65F41","650017","BC1620","FA427E","3B1132","84476E","B83D65","E6E0E8","FF6EE8"],misty:["5C7A84","3D5372","7C9196","50748A","ADBFBF","010735","052159","194073","376B8C","FFFFFF","985999","C811CC","892EFF","FF6852","DBA211","0A0D0C","85A67C","46593E","BBD9AD","202616","BF8E63","734327","A66C4B","593A2F","BFBFBF","8DB0B6","1B778A","F46C1B","881801","192129","81808C","ABAABF","0C0E09","6A7366","37402F","5D6663","84867B","A4A66A","BABBB1","20211C","6B9695","646E8C","6B8196","61787F","648C80","8E9FBA","89A8C8","799ED1","7FAEE7","849EBD"],citrus:["FAEA41","E7F03E","E3C647","FAC541","F0AB3E","CCCA1F","FFF300","FFCB0D","FF9500","804A00","6A692A","FFFCA0","FFFFFF","CF664E","EFAC66","EFF299","F2DC6D","F29727","F2600C","592202","214001","4F7302","1A2601","BCD97E","C0D904","AAFEFF","359D6D","E5FF45","65FCCF","ABDC4B","42B200","C6FF00","F2E304","FFB200","FF8600","52EC04","04E206","94D507","ECE404","E2C904","DA321C","FF7913","FBD028","C0D725","9FC131","547312","ADBF26","DEB329","F1DB47","E08214"],vintage:["684132","fdbe30","eaac21","87783c","3e4028","ffc706","cd5648","5bafa9","828282","363636","424862","fb9a63","bfc4d5","f6fbf4","febc98","657050","FCF082","D8D98B","A2AB80","4D584A","5ADED4","4DAAAB","26596A","163342","6C98A1","010A26","28403B","557359","AEBF8A","C7D9AD","AFFCCB","CB4243","D2997E","36857E","4AC6BB","28394B","191313","AF0A18","DC373D","122438","43734A","A6A26D","D9B448","BF8C2C","734002","26010F","866F53","ACBD91","7BAB87","546859"],moonlight:["241D37","2A233D","322B45","362F49","D4BA73","261225","592040","8C3063","A64985","73345D","A3C8FF","85B6FF","000040","213190","050859","FFFFFF","6AAED9","4184BF","224573","2e4154","bcad7e","955351","c36a57","9a8556","7e6029","dbd78e","beae3b","c3a04c","58504d","967644","CFC496","B3B391","889486","61797B","366577","123340","436E73","7B8C61","D7D996","F0EBB4","341F36","D9B5E0","9889AB","4D4E66","1B2129","5CBBE3","FCF1BC","5C8182","383A47","B4F257"],candycrush:["0779f4","30da00","fb8006","f9d802","a71df7","f70200","fd49ae","682e07","9b2424","5e7693","F9AB3B","EF5627","FF0000","00A398","803C2C","DE5711","FFF026","FF0048","14A0CC","00B229","FFFFBE","F7CD99","FF77A1","9886E8","97CACB","EAEDE5","FFD127","FF870C","EC4610","9A1900","993460","CC1464","C300FF","FFFFBC","CCB914","FFFEE2","B24C5F","FF274F","0A94CC","679DB2","C2FFE6","16B271","5FFFBC","B2442F","FFA190","E89359","FFFB75","F36EFF","5999E8","73EB86"]}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejFileExplorer","ej.FileExplorer",{element:null,model:null,validTags:["div"],_addToPersist:["layout","selectedFolder","selectedItems","height","width"],_rootCSS:"e-fileexplorer",_requiresID:!0,defaults:{fileTypes:"*.*",filterSettings:{caseSensitiveSearch:!1,filterType:"contains",allowSearchOnTyping:!0},showToolbar:!0,showCheckbox:!0,showNavigationPane:!0,allowDragAndDrop:!0,showContextMenu:!0,showFooter:!0,layout:"grid",locale:"en-US",selectedFolder:"",selectedItems:"",gridSettings:{allowSorting:!0,columns:[{field:"name",headerText:"Name",width:"30%"},{field:"dateModified",headerText:"Date Modified",width:"30%"},{field:"type",headerText:"Type",width:"15%"},{field:"size",headerText:"Size",width:"12%",textAlign:"right",headerTextAlign:"left"}],allowResizing:!0},tools:{creation:["NewFolder"],navigation:["Back","Forward","Upward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete","Rename","Download"],copyPaste:["Cut","Copy","Paste"],getProperties:["Details"],searchBar:["Searchbar"],layout:["Layout"],sortBy:["SortBy"]},toolsList:["layout","creation","navigation","addressBar","editing","copyPaste","sortBy","getProperties","searchBar"],path:"",height:"400px",width:"850px",minWidth:"400px",maxWidth:null,minHeight:"250px",maxHeight:null,isResponsive:!1,uploadSettings:{allowMultipleFile:!0,maxFileSize:31457280,autoUpload:!1},enableResize:!1,cssClass:"",enableRTL:!1,allowKeyboardNavigation:!0,showThumbnail:!0,enableThumbnailCompress:!1,showRoundedCorner:!1,ajaxAction:"",ajaxDataType:"json",ajaxSettings:{read:{},createFolder:{},remove:{},rename:{},paste:{},getDetails:{},download:{},upload:{},getImage:{},search:{}},allowMultiSelection:!0,contextMenuSettings:{items:{navbar:["NewFolder","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","Getinfo"],cwd:["Refresh","Paste","|","SortBy","|","NewFolder","Upload","|","Getinfo"],files:["Open","Download","|","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","OpenFolderLocation","Getinfo"]},customMenuFields:[]},enablePersistence:!1,layoutChange:null,getImage:null,select:null,unselect:null,createFolder:null,remove:null,cut:null,copy:null,paste:null,open:null,beforeOpen:null,beforeUpload:null,beforeDownload:null,beforeGetImage:null,beforeAjaxRequest:null,resizeStart:null,resize:null,resizeStop:null,templateRefresh:null,dragStart:null,drag:null,dragStop:null,drop:null,menuClick:null,menuBeforeOpen:null,menuOpen:null,create:null,destroy:null},dataTypes:{filterSettings:"data",showToolbar:"boolean",showNavigationPane:"boolean",showContextMenu:"boolean",allowDragAndDrop:"boolean",allowKeyboardNavigation:"boolean",showRoundedCorner:"boolean",showFooter:"boolean",layout:"enum",gridSettings:"data",tools:{creation:"array",navigation:"array",addressBar:"array",editing:"array",layout:"array",copyPaste:"array",getProperties:"array",searchBar:"array"},toolsList:"array",uploadSettings:"data",ajaxSettings:"data"},_setModel:function(i){var f=this,r,e,o,u;for(r in i)switch(r){case"showToolbar":i[r]?t.isNullOrUndefined(this._toolBarItems)?this._updateToolbar():this._toolBarItems.show():this._toolBarItems.hide();this.adjustSize();break;case"showNavigationPane":case"showTreeview":this.model.showNavigationPane=this.model.showTreeview=i[r];this._showHideSplitBar(this.model.showNavigationPane);break;case"showContextMenu":this._showHideContextMenu();break;case"height":this.element.css("height",this._getProperValue(this.model.height));this.adjustSize();break;case"width":this.element.css("width",this._getProperValue(this.model.width));this.adjustSize();break;case"layout":this._switchLayoutView(!0);break;case"allowDragAndDrop":this.model.allowDragAndDrop=i[r];this._draggableOption(i[r]?"_on":"_off");i[r]?this._allowDrag():this._preventDrag();break;case"showThumbnail":this.model.showThumbnail=i[r];this._switchLayoutView();break;case"enableThumbnailCompress":this.model.enableThumbnailCompress=i[r];this.model.showThumbnail&&this.model.layout!="grid"&&this._renderTileView(this._fileExplorer[this._originalPath]);break;case"path":i[r]?this._setPath(i[r]):this._getPath();break;case"enableRTL":this._enableRTL(i[r]);break;case"allowKeyboardNavigation":this._subControlsSetModel("allowKeyboardNavigation",i[r]);this._gridObj&&this._gridObj.setModel({allowKeyboardNavigation:i[r]});break;case"showFooter":i[r]?(this._statusbar.hasClass("e-statusbar")?(e=this._splittag.find(".e-cont2").outerHeight()-this._statusbar.outerHeight(),this._tileView.height(e),this._gridtag.height(e),this._statusbar.show()):(this._createStatusBar(),this._updateData(),this.model.enableResize&&this._resizeFileExplorer(),this._on(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView),this._on(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView)),o=this._splittag.height()-this._gridtag.find(".e-gridheader").outerHeight(),this._tileContent.parent(".e-tile-wrapper").ejScroller({height:this._splittag.outerHeight()-this._statusbar.outerHeight(),scrollerSize:this._scrollerSize,thumbStart:function(n){f._onThumbStart(n)}})):(this._tileView.height("auto"),this._gridtag.height("auto"),this._statusbar.hide(),o=this._splittag.height()-this._gridtag.find(".e-gridheader").outerHeight(),this._tileContent.parent(".e-tile-wrapper").ejScroller({height:this._splittag.outerHeight(),scrollerSize:this._scrollerSize,thumbStart:function(n){f._onThumbStart(n)}}));break;case"gridSettings":u=JSON.parse(JSON.stringify(i[r]));u.columns&&(u.columns.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"<script type='text/x-jsrender'><span class='e-fe-icon {{:cssClass}}' unselectable='on'><\/span><\/script>",textAlign:t.TextAlign.Center,allowResizing:!1}),this.model.showCheckbox&&u.columns.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:18,template:"<script type='text/x-jsrender'><input type='checkbox' class='e-grid-row-checkbox'/><\/script>",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1}));this._gridObj&&this._gridtag.ejGrid(u);this._showHideContextMenu();this._renderSortbyDrpdwn();break;case"locale":this.model.locale=i[r];this._destroy();this._init();break;case"cssClass":this._changeSkin(i[r]);break;case"fileTypes":n.each(f._fileExplorer,function(n){f._fileExplorer[n]=""});this._removeOldSelectionDetails();this._refreshItems(this._selectedNode,this._currentPath);this._uploadtag.ejUploadbox("option",{extensionsAllow:this.model.fileTypes=="*.*"?"":this.model.fileTypes.replace(/\*/g,"")});break;case"selectedFolder":this._selectedFolder(this.model.selectedFolder);break;case"selectedItems":this._selectedItems=i[r];this._setSelectedItems(i[r]);break;case"allowMultiSelection":i[r]||this._setSelectedItems([]);this._gridtag.find(".e-gridheader").length&&this._gridtag.ejGrid("option",{selectionType:i[r]?"multiple":"single"});break;case"isResponsive":this.model.isResponsive=i[r];this._toolBarObj&&(this._toolBarObj.option("isResponsive",this.model.isResponsive),this.model.showToolbar?this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize());this._wireResizing();break;case"tools":case"toolsList":r=="tools"?n.extend(this.model.tools,i[r]):this.model.toolsList=i[r];this._toolBarObj&&(this._toolBarObj.destroy(),this.element.find("#"+this._ExplorerId+"_toolbar").remove(),this._updateToolbar(),this.model.showToolbar?this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize());break;case"enableResize":i[r]?i[r]&&this.model.showFooter&&(this._resizeItem=t.buildTag("div.e-icon e-fe-resize e-resize-handle"),this._resizeItem.insertBefore(this.element.find(".e-switchView")),this._resizeFileExplorer()):this._resizeItem&&this._resizeItem.remove();break;case"minHeight":this.element.css("min-height",this._getProperValue(this.model.minHeight));this._refreshResizeHandler();break;case"maxHeight":this.element.css("max-height",this._getProperValue(this.model.maxHeight));this._refreshResizeHandler();break;case"minWidth":this.element.css("min-width",this._getProperValue(this.model.minWidth));this._refreshResizeHandler();break;case"maxWidth":this.element.css("max-width",this._getProperValue(this.model.maxWidth));this._refreshResizeHandler();break;case"showCheckbox":this._changeCheckState=this.model.showCheckbox;this.model.layout=="grid"?this._renderGridView(this._fileExplorer[this._originalPath]):this._renderTileView(this._fileExplorer[this._originalPath],!0);this._setSelectedItems(this.model.selectedItems);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"contextMenuSettings":n.extend(this.model[r],i[r]);this._showHideContextMenu()}},_init:function(){this._cloneElement=this.element.clone();t.isNullOrUndefined(this.model.uploadBoxSettings)||(this.model.uploadSettings=this.model.uploadBoxSettings);t.isNullOrUndefined(this.model.showTreeview)||(this.model.showNavigationPane=this.model.showTreeview);t.isNullOrUndefined(this.model.move)||(this.model.cut=this.model.move);this._initialize();this._render();this._changeLayoutActive(this.model.layout)},_postInit:function(){this._enablePostInit=!1;this._enableRTL(this.model.enableRTL);this._wireEvents();this._wireResizing();this._setMinMaxSizeInInteger();this.model.enableResize&&this.model.showFooter&&this._resizeFileExplorer();this._isClicked=!1;this._selectedTreeFolder&&this._currentPath!=this._selectedTreeFolder&&this._selectedFolder(this._selectedTreeFolder);this._selectedNodes.length&&this._setSelectedItems(this._selectedNodes);this._isClicked=!0},_initialize:function(){this._ExplorerId=this.element[0].id;this._fileExplorer={};this._feParent={};this._updateImages={};this._selectedStates=[];this._updateOnNodeSelection=!1;this._isClicked=!0;this._toolBarObj=null;this._tileView=null;this._tileScroll=null;this._originalPath=null;this._initPath="";this._initUpdate=!1;this._scrollerSize=8;this._editingToolsState=!0;this._renderMultiTouchDialog();this._ensureResolution();this._isDevice=this._checkDevice();this.element.css({height:this._getProperValue(this.model.height),width:this._getProperValue(this.model.width),"min-width":this._getProperValue(this.model.minWidth),"max-width":this._getProperValue(this.model.maxWidth),"min-height":this._getProperValue(this.model.minHeight),"max-height":this._getProperValue(this.model.maxHeight)});this._customCssClass=this.model.cssClass;this.element.addClass(this.model.cssClass);this._isTreeNode=!1;this._selectedItems=[];this._selectedTileItems=[];this._downloadDialog=null;this._newFolderDialog=null;this._renameDialog=null;this._openDialog=null;this._detailsDialog=null;this._alertDialog=null;this._enablePostInit=!0;this._initialTime=(new Date).getTime();this._currentPath=this.model.path.replace(/\\/g,"/");this._rootPath=this._currentPath=this._currentPath.endsWith("/")?this._currentPath:this._currentPath+"/";this._gridObj=null;this._setUploadLocalization();this._restrictedToolbarOptions=[];this._restrictedMenuOption=[];this._changeCheckState=this.model.showCheckbox;this._perRow=1;this._suggestionItems=[];this._highlightedNodes="";this._prevsorting=!0},_renderMultiTouchDialog:function(){var n,i,r;this._customPop=t.buildTag("div.e-fe-popup","",{display:"none"});n=t.buildTag("div.e-content");i=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSelection&&(r=t.buildTag("span.e-rowselect e-icon"),n.append(r));this._customPop.append(n);this._customPop.append(i);this.element.append(this._customPop);this._on(this._customPop,"mousedown",this._popupClick)},_popupClick:function(){var n=this._customPop.find(".e-rowselect");n.hasClass("e-spanclicked")?this._hidePopup():n.addClass("e-spanclicked")},_hidePopup:function(){this._customPop!=null&&this._customPop.is(":visible")&&(this._customPop.find(".e-rowselect").removeClass("e-spanclicked"),this._customPop.hide())},_ensureResolution:function(){this._isMobileOrTab=n(window).width()<=750?!0:!1;this._isMobileOrTab?(this.element.addClass("e-fe-mobile"),this._toolBarObj&&this._toolBarObj._liTemplte.css("max-width",this.element.width())):(this.element.removeClass("e-fe-mobile"),this._splitObj&&this.model.showNavigationPane&&this._splitObj.element.find(".e-cont1").hasClass("collapsed")&&(this.model.enableRTL?this._splitObj.expand(1):this._splitObj.expand(0)));this._toolBarObj&&this._toolBarObj.option("cssClass",this.model.cssClass+" e-fe-toolbar "+(this._isMobileOrTab?"e-fe-mobile":""));n(window).width()<=350||this.element.width()<=350?this.element.addClass("e-fe-small"):this.element.removeClass("e-fe-small");n(window).width()<=295||this.element.width()<=295?this.element.addClass("e-fe-short"):this.element.removeClass("e-fe-short")},_showHideNavigation:function(){this._splitObj.element.find(".e-cont1").hasClass("collapsed")?this.model.enableRTL?this._splitObj.collapse(0):this._splitObj.collapse(1):this.model.enableRTL?this._splitObj.expand(0):this._splitObj.expand(1)},_renderSplitIcon:function(){this.model.showNavigationPane&&(this._splitIcon=t.buildTag("div.e-fe-split-icon"),this._splitIcon.append("<span class='e-icon e-arrow-sans-left'><\/span>"),this._splitObj.element.find(".e-splitbar").append(this._splitIcon),this._on(this._splitIcon,"touchend click",this._showHideNavigation),this._isMobileOrTab&&this._splitObj&&this.model.showNavigationPane&&(this.model.enableRTL?this._splitObj.collapse(1):this._splitObj.collapse(0)))},_checkDevice:function(){return t.isDevice()&&t.isTouchDevice()},_initContextMenuOptions:function(n){for(var i,f,u=[],r=this.model.contextMenuSettings.items[n],e=this.model.contextMenuSettings.customMenuFields,t=0;t<r.length;t++)r[t]!="|"&&(i=this._getCustomItem(e,r[t]),f=r[t+1]=="|"?"e-fe-separator":null,this._addMenuItem(i,r[t],f,u,n),i&&i.hasOwnProperty("child")&&this._getChildItems(i.child,u,n,i.id));return u},_addMenuItem:function(n,i,r,u,f,e){var o=this._extendAttr(n,"text"),s,h;this["_menu"+i]=o?o:this._getLocalizedLabels("ContextMenu"+i);s=this._extendAttr(n,"htmlAttributes",r);h=this._extendAttr(n,"spriteCssClass","e-fileexplorer-toolbar-icon "+i);u.push({id:t.isNullOrUndefined(n)?this._ExplorerId+"_"+f+"_"+i:i,text:this["_menu"+i],parentId:e,sprite:h,htmlAttr:s})},_getChildItems:function(n,i,r,u){for(var e,f=0,o=n.length;f<o&&!t.isNullOrUndefined(n[f]);f++)e=n[f],this._addMenuItem(e,n[f].id,null,i,r,u),e&&e.hasOwnProperty("child")&&this._getChildItems(e.child,i,r,e.id)},_getCustomItem:function(n,i){for(var u,r=0,f=n.length;r<f&&!t.isNullOrUndefined(n[r]);r++){if(n[r].id==i){u=n[r];break}if(n[r].hasOwnProperty("child")){u=this._getCustomItem(n[r].child,i);break}}return u},_extendAttr:function(n,t,i){return i?t=="htmlAttributes"?{"class":n?n[t]?n[t]["class"]?n[t]["class"]+" "+i:i:i:i}:n?n[t]?n[t]+" "+i:i:i:n?n[t]?n[t]:null:null},_render:function(){this._selectedTreeFolder=this.model.selectedFolder;this._selectedNodes=this.model.selectedItems;this.element.addClass("e-widget e-box").attr({role:"fileexplorer",tabindex:0});this.model.showToolbar&&this._renderToolBar();this._createSplitPane();this._read();this._roundedCorner(this.model.showRoundedCorner)},_read:function(){var i=this,u={data:{ActionType:"Read",Path:this._currentPath,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(),this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(n){if(n!==r&&n!==null){if(n.hasOwnProperty("d")&&(n=n.d),!t.isNullOrUndefined(n.error)){i._showErrorDialog(n.error);return}i._feParent[i._currentPath]=n.cwd;i._readSuccess(n.files);i._enablePostInit&&i._postInit()}},successAfter:this.model.ajaxSettings.read.success};this.model.ajaxSettings.read.success=r;n.extend(!0,u,this.model.ajaxSettings.read);this._sendAjaxRequest(u)},_sendAjaxRequest:function(i,r){var e,f,u;(!i.dataType&&this.model.ajaxDataType&&(i.dataType=this.model.ajaxDataType),this.model.ajaxAction!=""&&this._currentPath!="")&&((i.data.ActionType!="Read"&&(this._selectedItemDetails=i.data.SelectedItems),e={Name:"",ActionType:"",Path:"",ExtensionsAllow:"",LocationFrom:"",LocationTo:"",Action:"",NewName:"",Names:[],CaseSensitive:!1,SearchString:"",FileUpload:null,CommonFiles:null},r||this._waitingPopup.show(),n.extend(!0,e,i.data),f={data:e,ajaxSettings:i},u=this,this._trigger("beforeAjaxRequest",f))||(i=f.ajaxSettings,n.ajax({data:i.dataType&&i.dataType.toLowerCase()=="jsonp"||i.contentType=="application/x-www-form-urlencoded"?{json:JSON.stringify(f.data)}:JSON.stringify(f.data),url:i.url,type:i.dataType&&i.dataType.toLowerCase()=="jsonp"?"GET":i.type,async:i.async,success:function(n){u._waitingPopup.hide();i.success.call(this,n);typeof i.successAfter=="function"&&i.successAfter.apply(this,arguments)},contentType:i.contentType?i.contentType:"application/json",dataType:i.dataType,jsonpCallback:i.jsonpCallback?i.jsonpCallback:i.dataType&&i.dataType.toLowerCase()=="jsonp"?"MyCallbackFunction":"",error:i.error?i.error:function(n){u._waitingPopup.hide();var i=n.responseJSON?n.responseJSON.ExceptionType+", "+n.responseJSON.ExceptionMessage:n.statusText;u._alertDialog=u._createDialog(t.buildTag("div.e-fe-dialog-label",i),{width:400,height:"auto",title:u._getLocalizedLabels("Error")});u._alertDialogObj=u._alertDialog.data("ejDialog")},beforeSend:i.beforeSend,complete:function(){u._waitingPopup.hide();i.complete}})))},_onBeforeOpen:function(){var t,n=[],i;return t=this._nodeType=="File"?this._currentPath.replace("~","..")+this._selectedFile:this._currentPath,this._selectedFile?n=this._getSelectedItemDetails(this._currentPath,this._selectedFile):this._selectedContent&&(n=this._getSelectedItemDetails(this._getFolderPath(),this._selectedContent)),i={path:t,itemType:this._nodeType,selectedItems:n},this._trigger("beforeOpen",i)},_readSuccess:function(n){var t;if(n!==r&&n!==null){for(this._update=!1,t=0;t<n.length;t++)n[t].sizeInByte=n[t].size,n[t].size=n[t].isFile?this._bytesToSize(n[t].size):"",n[t].cssClass=this._getCssClass(n[t]);var i=this.model.gridSettings.columns[0];this._changeActiveSortedoption(i.headerText,!0);this._sorting(i.field,!0,n);this._fileExplorer[this._currentPath]=n;this._itemStatus&&this._itemStatus.html(this._sorteditems.length+" "+(this._sorteditems.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")));this._treetag.hasClass("e-treeview")||(this._renderTreeView(this._sorteditems),this._updateOnNodeSelection=!0);this.model.layout=="grid"?this._renderGridView(this._sorteditems):this._renderTileView(this._sorteditems);this._usePreviousValues()}},_getCssClass:function(n){var t=n.name.substr(n.name.lastIndexOf(".")+1).toLowerCase();return n.isFile?/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(n.name)?"e-fe-images":/\.(mp3|wav|aac|ogg|wma|aif|fla|m4a)$/i.test(n.name)?"e-fe-audio":/\.(webm|mkv|flv|vob|ogv|ogg|avi|wmv|mp4|3gp)$/i.test(n.name)?"e-fe-video":/\.(css|exe|html|js|msi|pdf|pptx|ppt|rar|zip|txt|docx|doc|xlsx|xls|xml|rtf|php)$/i.test(n.name)?"e-fe-"+t:"e-fe-unknown e-fe-"+t:n.permission&&!n.permission.Read?"e-fe-folder e-fe-lock":"e-fe-folder"},_bytesToSize:function(n){var t,i;return n==0?"0 Byte":(t=parseInt(Math.floor(Math.log(n)/Math.log(1024))),i=n/Math.pow(1024,t),i.toFixed(2)+" "+["Bytes","KB","MB","GB","TB"][t])},_setPath:function(n){this.model.path=n;this._treetag.remove();this._treetag=t.buildTag("div#"+this._ExplorerId+"_treeView");this._splittag.find(".e-cont1 > .e-tree-wrapper").append(this._treetag);this._fileExplorer=this._updateImages={};this._selectedStates=[];this._selectedItems=[];this._selectedTileItems=[];this._initUpdate=!1;this._initPath="";this._currentPath=this.model.path.replace(/\\/g,"/");this._originalPath=this._rootPath=this._currentPath=this._currentPath.endsWith("/")?this._currentPath:this._currentPath+"/";this._read()},_getPath:function(){return this.model.path},_changeSkin:function(n){this.element.removeClass(this._customCssClass).addClass(n);this._customCssClass=n;this._waitingPopup.option("cssClass",n);this._subControlsSetModel("cssClass",n)},_draggableOption:function(n){this._treeDragEvents(n);this._tileDragEvents(n);this._gridDragEvents(n);n=="_off"&&(this._previousPath=null);this._statusbar&&this[n](this._statusbar,"dragover",this._preventDropOption);this._toolBarItems&&this[n](this._toolBarItems,"dragover",this._preventDropOption)},_swapWith:function(t,i){t=n(t);i=n(i);var r=n("<span>").hide();t.before(r);i.before(t);r.replaceWith(i)},_enableRTL:function(n){var r=this._splittag.find(".e-cont1"),u=this._splittag.find(".e-cont2"),i,t;if(this.model.enableRTL=n,n){for(r.index()<u.index()&&this._swapWith(r,u),i=JSON.parse(JSON.stringify(this.model.gridSettings.columns)),this._oldFormat||(this._oldFormat=JSON.parse(JSON.stringify(i))),t=0;t<i.length;t++)i[t].textAlign=i[t].headerTextAlign="right";this._gridObj&&this._gridObj.columns(i);this.element.addClass("e-rtl");this.element.find(".e-scroller").addClass("e-rtl")}else{if(r.index()>u.index()&&this._swapWith(u,r),this._gridObj&&this._oldFormat){for(t=0;t<this._oldFormat.length;t++)this._oldFormat[t].textAlign||(this._oldFormat[t].textAlign="left"),this._oldFormat[t].headerTextAlign||(this._oldFormat[t].headerTextAlign="left");this._gridObj.columns(this._oldFormat)}this._oldFormat&&(this.model.gridSettings.columns=JSON.parse(JSON.stringify(this._oldFormat)),this._oldFormat=null);this.element.removeClass("e-rtl");this.element.find(".e-scroller").removeClass("e-rtl");this._gridtag&&this._gridtag.removeClass("e-rtl")}this._splitterCorrection();this._subControlsSetModel("enableRTL",n)},_roundedCorner:function(n){var t=n?"addClass":"removeClass";this.element[t]("e-corner-all");this._treeContextMenutag&&this._treeContextMenutag[t]("e-corner");this._tileContextMenutag&&this._tileContextMenutag[t]("e-corner");this._subControlsSetModel("showRoundedCorner",n)},_destroy:function(){this._toolBarObj&&this._toolBarObj.destroy();this._treeContextMenutag&&this._treeContextMenutag.parent().remove();this._tileContextMenutag&&this._tileContextMenutag.parent().remove();this._newFolderDialogObj&&this._newFolderDialogObj.isOpen()&&this._removeDialog(this._newFolderDialogObj);this._renameDialogObj&&this._renameDialogObj.isOpen()&&this._removeDialog(this._renameDialogObj);this._openDialogObj&&this._openDialogObj.isOpen()&&this._removeDialog(this._openDialogObj);this._detailsDialogObj&&this._detailsDialogObj.isOpen()&&this._removeDialog(this._detailsDialogObj);this._alertDialogObj&&this._alertDialogObj.isOpen()&&this._removeDialog(this._alertDialogObj);this._alertWindowObj&&this._alertWindowObj.isOpen()&&this._removeDialog(this._alertWindowObj);this._splitButtonObj&&this._splitButtonObj.destroy();this._splitButtonObj1&&this._splitButtonObj1.destroy();this._waitingPopup&&this._waitingPopup.destroy();this._gridObj&&this._gridObj.element.ejWaitingPopup("destroy");this._unwireEvents();this.element.html("");n(this._cloneElement).attr("style")?this.element.attr("style",n(this._cloneElement).attr("style")):this.element.removeAttr("style");this.element.removeClass("e-widget e-box e-rtl");this.element.removeAttr("role");delete this._prevsortingoption;this._prevsorting},_createFolder:function(i){var u=this,f={data:{ActionType:"CreateFolder",Name:i,Path:this._originalPath,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(this._originalPath),this._treeObj.getText(this._selectedNode))},url:this.model.ajaxAction,type:"POST",success:function(n){var i,e,f,o;if(n!==r&&n!==null){if(n.hasOwnProperty("d")&&(n=n.d),!t.isNullOrUndefined(n.error)){u._showErrorDialog(n.error);return}i=u._selectedNode;e=[{id:n.files[0].name,name:n.files[0].name,spriteCssClass:n.files[0].permission&&!n.files[0].permission.Read?"e-fe-icon e-fe-folder e-fe-lock":"e-fe-icon e-fe-folder",hasChild:!1}];u._treetag.ejTreeView("isExpanded",i)||u._treeObj&&u._treeObj.expandNode(i);u._nodeExpanded=!0;u._treeObj.addNode(e,i);u._nodeExpanded=!1;u._update=!0;u._treeObj.selectNode(i);u._refreshTreeScroller();u._treetag.find("li").removeAttr("tabindex");f=u._treetag.find("li div a").not(".e-js");u.model.allowDragAndDrop&&f.length&&(u._drag(f),f.addClass("e-file-draggable"));o={data:n,selectedItems:u._selectedItemDetails};u._trigger("createFolder",o);u._setSelectedItems([n.files[0].name])}},successAfter:this.model.ajaxSettings.createFolder.success};this.model.ajaxSettings.createFolder.success=r;n.extend(!0,f,this.model.ajaxSettings.createFolder);this._sendAjaxRequest(f)},_needToScroll:function(n,i){var f,e=i=="Tree"?n.find("a").eq(0).outerHeight():n.outerHeight()+(this.model.layout=="grid"?0:10),r=0,u;if(r+=n.position().top+e,i=="Tree"){while(n.parent().hasClass("e-treeview-ul"))n=n.parent(),r+=n.position().top;f=this._splittag.find(".e-cont1").height()}else this.model.layout==t.FileExplorer.layoutType.Grid?(f=this._gridtag.find(".e-gridcontent").height(),r=r-this._gridtag.find(".e-gridheader").outerHeight()):f=this._tileViewWrapper.height();u=n.closest(".e-scroller .e-content",".e-fileexplorer");f<r?u.animate({scrollTop:u.scrollTop()+e*2},500,"linear"):r<n.outerHeight()&&u.animate({scrollTop:u.scrollTop()-e*2},500,"linear")},_cut_copy:function(n){var i=this,f,r,e,u,o;if(this._sourcePath==this._currentPath&&this._option=="move"){this.element.find(".e-blur").removeClass("e-blur");this.model.layout!="grid"&&this._clearTileCheckBoxSelection();this._setSelectedItems(this._fileName);n&&(this._activeSource=this.model.selectedItems);return}for(f=this._fileExplorer[this._currentPath],r=typeof this._copiedNodes=="string"?[this._copiedNodes]:this._copiedNodes,this._pastedFiles=r.slice(),e=0;e<r.length;e++)if(!this._isNameExist(this._suggestionItems.length?this._suggestionItems:this._fileExplorer[this._sourcePath],r[e]))return;u=i._currentPath;o=function(){if(i._currentPath=u,t.isNullOrUndefined(f)&&(f=i._fileExplorer[u]),i._existingItems=[],i._sourcePath!=u&&f.length)i._getDuplicateItems(i._sourcePath,u,typeof i._fileName=="string"?[i._fileName]:i._fileName),i._existingItems.length?i._createReplaceConformationDiaolg("_pasteOperation","ReplaceAlert"):i._pasteOperation();else{for(var n=0;n<r.length;n++)i._pastedFiles[n]=i._getDuplicateName(i._fileExplorer[u],r[n]);i._pasteOperation()}};t.isNullOrUndefined(f)?this._getFileDetails(this._currentPath,"","",o):o()},_createReplaceConformationDiaolg:function(i,r){var u=this,f=0,v=String.format(this._getLocalizedLabels(r),this._existingItems[f].Path),o=t.buildTag("div.e-get-name"),y=t.buildTag("div.e-fe-dialog-label",v),s=t.buildTag("div.e-fe-dialog-btn e-replace"),e=t.buildTag("button.e-fe-btn-yes ",this._getLocalizedLabels("YesButton")),h=t.buildTag("button.e-fe-btn-yes e-all ",this._getLocalizedLabels("YesToAllButton")),c=t.buildTag("button.e-fe-btn-no ",this._getLocalizedLabels("NoButton")),l=t.buildTag("button.e-fe-btn-no e-all ",this._getLocalizedLabels("NoToAllButton")),a;e.ejButton({type:"button",cssClass:"e-flat",click:function(){/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(u._existingItems[f].Name)&&(u._updateImages[u._existingItems[f].Path]=(new Date).getTime());u._existingItems[f].IsReplace=!0;f++;f<u._existingItems.length?u._alertDialog.find(".e-fe-dialog-label").text(String.format(u._getLocalizedLabels(r),u._existingItems[f].Path)):u._destroyReplaceConformationDiaolg(i)}});c.ejButton({type:"button",cssClass:"e-flat",click:function(){u._existingItems[f].IsReplace=!1;f++;f<u._existingItems.length?u._alertDialog.find(".e-fe-dialog-label").text(String.format(u._getLocalizedLabels(r),u._existingItems[f].Path)):u._destroyReplaceConformationDiaolg(i)}});h.ejButton({type:"button",cssClass:"e-flat",click:function(){for(var n=f;n<u._existingItems.length;n++)/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(u._existingItems[n].Name)&&(u._updateImages[u._existingItems[n].Path]=(new Date).getTime()),u._existingItems[n].IsReplace=!0;u._destroyReplaceConformationDiaolg(i)}});l.ejButton({cssClass:"e-flat",type:"button",click:function(){for(var n=f;n<u._existingItems.length;n++)u._existingItems[n].IsReplace=!1;u._destroyReplaceConformationDiaolg(i)}});s.append(e,h,c,l);n(o).append(y,s);a=function(){e.focus()};this._alertDialog=this._createDialog(o,{width:500,height:"auto",title:this._getLocalizedLabels("Error"),open:a});this._alertDialogObj=this._alertDialog.data("ejDialog")},_destroyReplaceConformationDiaolg:function(n){this._removeDialog(this._alertDialogObj);this[n]()},_pasteOperation:function(){var i,u,r,o,e,c;for(this._removeBlurEffect(),i=this,u=-1,typeof this._fileName=="string"&&(this._fileName=[this._fileName]),r=0;r<this._fileName.length;r++)if(o=this._sourcePath+this._fileName[r]+"/",this._currentPath.indexOf(o)>=0){u=r;break}if(u!=-1){var l=this._getLocalizedLabels("CancelPasteAction"),s=t.buildTag("div"),a=t.buildTag("div.e-fe-dialog-label",l),h=t.buildTag("div.e-fe-dialog-centerbtn"),f=t.buildTag("button.e-fe-btn-cancel ",this._getLocalizedLabels("CancelButton"));f.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});e=t.buildTag("button.e-fe-btn-skip ",this._getLocalizedLabels("SkipButton"));e.ejButton({cssClass:"e-flat",type:"button",click:function(){i._fileName.splice(u,1);i._removeDialog(i._alertDialogObj);i._performPasteOperation()}});h.append(e,f);n(s).append(a,h);c=function(){f.focus()};this._alertDialog=this._createDialog(s,{width:400,height:"auto",title:this._getLocalizedLabels("Error"),open:c});this._alertDialogObj=this._alertDialog.data("ejDialog")}else this._performPasteOperation()},_performPasteOperation:function(){var i=this,u=this._currentPath.split("/"),f={data:{ActionType:"Paste",LocationFrom:this._sourcePath,LocationTo:this._currentPath,Names:typeof this._fileName=="string"?[this._fileName]:this._fileName,Action:this._option,CommonFiles:this._existingItems,SelectedItems:this._getSelectedItemDetails(this._sourcePath,this._fileName),TargetFolder:this._getSelectedItemDetails(this._getFolderPath(),u[u.length-2])},url:this.model.ajaxAction,type:"POST",success:function(r){var o,s,f,e,h,c;if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){i._showErrorDialog(r.error);return}for(typeof i._fileName=="string"&&(i._fileName=[i._fileName]),f=0;f<i._pastedFiles.length;f++)/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(i._pastedFiles[f])&&(i._updateImages[i._currentPath+i._pastedFiles[f]]=(new Date).getTime());if(i._existingItems&&i._existingItems.filter(function(t){if(t.IsReplace==!1){var r=n.inArray(t.Name,i._pastedFiles);r>-1&&i._pastedFiles.splice(r,1)}}),i._existingItems=[],o=i._originalPath,s=i._selectedNode,i._option=="move"){for(f=0;f<i._fileName.length;f++)i._modifySelectedStates(i._sourcePath+i._fileName[f],"");if(i._fileName.length>0)if(i._fileName.length==1)i._sourceType=="Directory"&&i._treeObj.removeNode(i._refreshNode);else for(u=i._refreshNode.siblings(),i._sourceType=="Directory"&&i._treeObj.removeNode(i._refreshNode),f=0;f<i._fileName.length;f++)for(e=0;e<u.length;e++)i._fileName[f]==n(u[e]).text()&&i._treeObj.removeNode(u[e])}n.each(i._fileExplorer,function(n){n.startsWith(o)&&(i._fileExplorer[n]="")});i._currentPath=i._originalPath;i._highlightedNodes=i._pastedFiles;i._option=="move"?i._refreshItems(s,o,function(){i._fileExplorer[i._sourcePath]="";i._getFileDetails(i._sourcePath)}):i._refreshItems(s,o);h=i._getFolderPath();i._option=="move"&&(i._fileName="",i._option=null,i._toolBarItems&&i._toolBarItems.ejToolbar("disableItemByID",i._ExplorerId+"Paste"),i.model.showContextMenu&&(i._viewMenuObj.disableItem(i._menuPaste),i._treeMenuObj.disableItem(i._menuPaste)));c={name:i._fileName,targetPath:i.model.path,selectedItems:i._selectedItemDetails,targetFolder:i._getSelectedItemDetails(h,i._selectedContent)};i._trigger("paste",c)},successAfter:this.model.ajaxSettings.paste.success};this.model.ajaxSettings.paste.success=r;n.extend(!0,f,this.model.ajaxSettings.paste);this._sendAjaxRequest(f)},_deletion:function(i,u){var f=this,o=this._treeObj.getSelectedNode(),e;this._treeObj.isExpanded(o)||this._treeObj&&this._treeObj.expandNode(o);e={data:{ActionType:"Remove",Names:typeof i=="string"?[i]:i,Path:u,SelectedItems:this._getSelectedItemDetails(u,i)},traditional:!0,url:this.model.ajaxAction,type:"POST",success:function(r){var o,s,h;if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){f._showErrorDialog(r.error);return}for(f._selectedItemsTag&&f._selectedItemsTag.html(""),f._fileExplorer[f._ajax_folderPath]="",n.each(f._fileExplorer,function(n){n.startsWith(f._ajax_folderPath)&&(f._fileExplorer[n]="")}),o=0;o<e.data.SelectedItems.length;o++)e.data.SelectedItems[o].isFile==!1&&f._modifySelectedStates(u+e.data.SelectedItems[o].name,"");f._currentPath=f._ajax_folderPath;s=f._selectedContent==f._selectedTreeText?f._parentNode:f._selectedNode;f._refreshItems(s,f._ajax_folderPath);f._treeObj.getSelectedNode().length==0?f._treeObj.selectNode(f._parentNode):f.model.layout=="grid"?f._gridtag.find(".e-gridcontent").click():f._tileViewWrapper.click();h={data:r,path:f._ajax_folderPath,name:i,selectedItems:f._selectedItemDetails};f._trigger("remove",h)},successAfter:this.model.ajaxSettings.remove.success};this.model.ajaxSettings.remove.success=r;n.extend(!0,e,this.model.ajaxSettings.remove);this._sendAjaxRequest(e)},_rename:function(){var i=this,u={data:{ActionType:"Rename",Path:i._currentPath,Name:i._selectedContent,NewName:i._ajax_person,CommonFiles:i._existingItems,SelectedItems:this._getSelectedItemDetails(i._currentPath,this._selectedContent)},url:this.model.ajaxAction,type:"POST",success:function(r){if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){i._showErrorDialog(r.error);return}i._existingItems=[];i._fileExplorer[i._currentPath]="";i._nodeType!="File"&&i._modifySelectedStates(i._currentPath+i._selectedContent,i._currentPath+i._ajax_person);i._splittag.find(".e-cont2 .e-active").length<=0?(n.each(i._fileExplorer,function(n){n.startsWith(i._currentPath+i._selectedContent+"/")&&(i._fileExplorer[n]="")}),i._selectedNode.find("> div > .e-text")[0].lastChild.nodeValue=i._selectedContent=i._ajax_person,i._originalPath=i._currentPath+=i._ajax_person+"/",i._updateAddressBar()):(i.model.selectedItems.length>0?(i.model.selectedItems[i.model.selectedItems.length-1]=i._getOriginalName(i._ajax_person),i._selectedItems[0]=i._ajax_person,i._highlightedNodes=i.model.selectedItems,i._refreshItems(i._selectedNode,i._currentPath)):i._refreshItems(i._parentNode,i._currentPath),i._treeObj.getSelectedNode().length==0&&n(i._parentNode).find("li a").each(function(){if(n(this).text()==i._ajax_person)return i._treeObj.selectNode(n(this).closest("li.e-item")),!1}))},successAfter:this.model.ajaxSettings.rename.success};this.model.ajaxSettings.rename.success=r;n.extend(!0,u,this.model.ajaxSettings.rename);this._sendAjaxRequest(u)},_downloadFile:function(){var t=this._getSelectedItemDetails(this._currentPath,this._selectedItems),i={Path:this._currentPath,ActionType:"Download",SelectedItems:JSON.stringify(t),Names:this._selectedItems},r=this.model.ajaxAction+"?"+n.param(i,!0),u;if(this.model.ajaxSettings.download.url&&(r=this.model.ajaxSettings.download.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.download.url,"?"+n.param(i,!0)):this.model.ajaxSettings.download.url),u={path:this._currentPath,files:this._selectedItems,selectedItems:t},this._trigger("beforeDownload",u))return!1;window.location=r},_removeBlurEffect:function(){this._currntNode&&(this._currntNode.hasClass("e-active")&&this._currntNode.removeClass("e-blur"),this._currntNode.find(".e-active").length&&this._currntNode.find(".e-active").removeClass("e-blur"))},_renderTreeView:function(t){var e=t.length>0?!0:!1,i,r,u,f;for(this._collapse=!1,i=this,r=this._currentPath.split("/"),u=0;u<r.length-2;u++)this._initPath+=r[u]+"/";f=r[r.length-2];this._localData=[{id:1,name:f,spriteCssClass:this._hasReadPermission(this._currentPath)?"e-fe-icon e-fe-folder":"e-fe-icon e-fe-folder e-fe-lock",hasChild:e}];this._treetag._collapse=!1;this._treetag.ejTreeView({loadOnDemand:!0,cssClass:i.model.cssClass,enableRTL:i.model.enableRTL,allowKeyboardNavigation:i.model.allowKeyboardNavigation,fields:{dataSource:i._localData,id:"id",parentId:"pid",text:"name",hasChild:"hasChild",spriteCssClass:"spriteCssClass"},nodeCollapse:function(n){i._refreshTreeScroller(n)},nodeExpand:function(n){i._refreshTreeScroller(n)},nodeClick:function(n){i._treenodeClicked(n)},beforeExpand:function(n){i._treeNodeBeforeExpand(n)},nodeSelect:function(n){i._updateTreePath(n)},beforeCollapse:function(n){i._onBeforeCollapse(n)},beforeDelete:function(n){i._treeBeforeDelete(n)}});this._treeObj=this._treetag.data("ejTreeView");this._treeViewEvents("_off");this._treeViewEvents("_on");this._isClicked=!1;this._treetag.ejTreeView("selectNode",n(this._treetag).find("li")[0]);this._isClicked=!0;this._treeScroll=this._treetag.parent(".e-tree-wrapper").ejScroller({height:this._splittag.height(),width:parseInt(this._splittag.find(".e-cont1").width()),buttonSize:0,scrollerSize:this._scrollerSize,thumbStart:function(n){i._onThumbStart(n)}}).data("ejScroller");this._addChild(t)},_treeViewEvents:function(n){this[n](this._treetag,"focus",this._focusTreeView);this[n](this._treetag,"blur",this._blurTreeView);this.model.allowDragAndDrop&&this._treeDragEvents(n)},_treeDragEvents:function(n){var t=this._treetag.parent(".e-tree-wrapper");t&&(this[n](t,"dragover",this._onDragOverHandler),this[n](t,"drop",this._onDropHandler),this[n](t,"dragleave",this._onDragLeave))},_focusTreeView:function(){this._treetag.hasClass("e-focus")||(this._treetag.addClass("e-focus"),this._itemList=[],this._on(this._treetag,"keydown",this._OnKeyUp),this._hidePopup())},_blurTreeView:function(){this._treetag.removeClass("e-focus");this._off(this._treetag,"keydown",this._OnKeyUp)},_treeBeforeDelete:function(n){if(!t.isNullOrUndefined(n.event)){var i=this._getKeyCode(n.event);i==46&&(n.cancel=!0)}},_treeNodeBeforeExpand:function(n){if(!this._nodeExpanded){var t=this._updatePath(n.currentElement,n.value);this._fileExplorer[t]||this._getFileDetails(t,n.currentElement);this._treetag.ejTreeView("hasChildNode",n.currentElement)||this._fileExplorer[t]&&this._addChild(this._fileExplorer[t],n.currentElement)}},_treenodeClicked:function(t){if(t.event.currentTarget&&t.event.currentTarget.focus(),n(t.currentElement).hasClass("e-text")&&t.currentElement!=this._selectedNode.find("> div > .e-text")[0]){this._selectedContent=t.currentElement.text;this._selectedNode=n(t.currentElement).closest("li.e-item");var i=n(this._selectedNode.parents("li.e-item")[0]);this._parentNode=i.length!=0?i:this._selectedNode;this._nodeType="Directory";this._isTreeNode=!0}},_showHideContextMenu:function(){if(this.model.showContextMenu){var i={beforeOpen:"",click:""},r={id:"",targetId:""};this._treeMenuOptions=this._initContextMenuOptions("navbar");r.id=this._ExplorerId+"_treeView";r.targetId="#"+this._ExplorerId+"_treeView";i.beforeOpen=n.proxy(this._beforeOpenContextMenu,this);i.open=n.proxy(this._contextMenuOpen,this);i.close=n.proxy(this._onHideContextMenu,this);i.click=n.proxy(this._contextMenuClick,this);this._treeContextMenutag=this._createContextMenuTag(this._treeMenuOptions,r,i);this._treeMenuObj=this._treeContextMenutag.ejMenu("instance");this._cwdMenuOptions=this._initContextMenuOptions("cwd");this._addSortbyoptions();r.id=this._ExplorerId+"_tileView";r.targetId="#"+this._ExplorerId+"_tileWrapper,#"+this._ExplorerId+"_grid";i.beforeOpen=n.proxy(this._beforeOpenTileContextMenu,this);i.open=n.proxy(this._contextMenuOpen,this);i.click=n.proxy(this._fileContextMenuClick,this);this._tileContextMenutag=this._createContextMenuTag(this._cwdMenuOptions,r,i);this._viewMenuObj=this._tileContextMenutag.ejMenu("instance");(t.isNullOrUndefined(this._fileName)||this._fileName=="")&&this._treeMenuObj.disableItem(this._menuPaste);this._fileMenuOptions=this._initContextMenuOptions("files")}else this._treeContextMenutag&&this._tileContextMenutag&&(this._treeMenuObj.destroy(),this._viewMenuObj.destroy(),n("#"+this._ExplorerId+"_treeViewContextMenu").remove(),n("#"+this._ExplorerId+"_tileViewContextMenu").remove(),this._viewMenuObj=this._treeMenuObj=null)},_addSortbyoptions:function(){var r=this.model.contextMenuSettings.items.cwd.length,i=this.model.contextMenuSettings.items.cwd,n,t;if(i.indexOf("SortBy")>-1)for(n=this.model.gridSettings.columns.length,j=0;j<n;j++)t="e-fileexplorer-toolbar-icon "+this.model.gridSettings.columns[j].field,this._cwdMenuOptions.push({id:this._ExplorerId+"_cwd_"+this.model.gridSettings.columns[j].field,text:this.model.gridSettings.columns[j].headerText,parentId:this._ExplorerId+"_cwd_SortBy",sprite:t})},enableMenuItem:function(n){n=this._findCommand(n,this.model.contextMenuSettings.items,!0);for(var t=0;t<this._restrictedMenuOption.length;t++)if(this._restrictedMenuOption[t]==n){this._restrictedMenuOption.splice(t,1);break}this._treeMenuObj&&this._treeMenuObj.enableItem(n);this._viewMenuObj&&this._viewMenuObj.enableItem(n)},disableMenuItem:function(t){t=this._findCommand(t,this.model.contextMenuSettings.items,!0);n.inArray(t,this._restrictedMenuOption)==-1&&this._restrictedMenuOption.push(t);this._treeMenuObj&&this._treeMenuObj.disableItem(t);this._viewMenuObj&&this._viewMenuObj.disableItem(t)},_renderGridView:function(i){for(var r,f,s,o,u=JSON.parse(JSON.stringify(this.model.gridSettings.columns)),h=null,e=0;e<u.length;e++)u[e].template||(u[e].template="<script type='text/x-jsrender'><span title= '{{:"+u[e].field+"}}'>{{:"+u[e].field+"}}<\/span><\/script>");this._suggestionItems.length&&u.push({field:"filterPath",headerText:"Folder",width:"20%"});u.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"<script type='text/x-jsrender'><span class='e-fe-icon {{:cssClass}}' unselectable='on'><\/span><\/script>",textAlign:t.TextAlign.Center,allowResizing:!1});this.model.showCheckbox&&u.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:22,template:"<script type='text/x-jsrender'><input type='checkbox' class='e-grid-row-checkbox'/><\/script>",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1});r=this;f=u[u.length-1];f&&(f.customAttributes?f.customAttributes["class"]?f.customAttributes["class"].search("e-rowcell e-last-rowcell")==-1&&(f.customAttributes["class"]=f.customAttributes["class"]+" e-rowcell e-last-rowcell"):f.customAttributes["class"]=" e-rowcell e-last-rowcell":f.customAttributes={"class":"e-rowcell e-last-rowcell"});this._gridObj?(u.length!=this._gridObj.model.columns.length&&(this._gridObj.model.columns=u,this._gridObj.columns(this._gridObj.model.columns)),h=JSON.parse(JSON.stringify(this._gridObj.model.sortSettings)),this._gridObj.option("dataSource",i),this._gridObj.option("enableRTL",this.model.enableRTL),this._gridObj.option("sortSettings",h)):this._gridtag.ejGrid({cssClass:r.model.cssClass,enableRTL:r.model.enableRTL,allowKeyboardNavigation:this.model.allowKeyboardNavigation,dataSource:i,selectionType:r.model.allowMultiSelection?"multiple":"single",allowSorting:r.model.gridSettings.allowSorting,columns:u,isResponsive:!0,scrollSettings:{width:186,height:200,buttonSize:0,scrollerSize:r._scrollerSize},allowScrolling:!0,enableResponsiveRow:!1,rowSelected:function(n){r._updatePathFromGrid(n)},recordDoubleClick:function(n){r._openAction(n)},templateRefresh:function(n){r._templateRefresh(n)},create:this.model.showCheckbox?function(n){r._gridCheckboxState(n)}:null,actionBegin:function(n){r._gridActionBegin(n)},actionComplete:function(n){r._gridActionComplete(n)},allowResizing:r.model.gridSettings.allowResizing});i.length&&i[0].filterPath&&this._setFilteredContent();this._gridObj=this._gridtag.ejGrid("instance");s=this._getFilePermission(this._currentPath);s&&!s.Read?this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("ProtectedFolder")).addClass("e-fe-center"):this._gridObj.model.dataSource.length==0&&this._searchbar&&n.trim(this._searchbar.val())?this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("EmptyResult")).addClass("e-fe-center"):this._gridObj.model.dataSource.length==0&&this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("EmptyFolder")).addClass("e-fe-center");this.gridItems=this._gridObj.getRows();this.model.allowDragAndDrop&&(this._gridtag.children(".e-gridcontent").addClass("e-droppable"),this._drag(n(this.gridItems)),n(this.gridItems).addClass("e-file-draggable"));this._reSizeHandler();o=this._gridObj.getScrollObject();o&&(o.isVScroll()||o.isVScroll())&&o.element.ejScroller({thumbStart:function(n){r._onThumbStart(n)}});this._gridtag.attr("tabindex",-1);this._gridViewEvents("_off");this._gridViewEvents("_on");this._gridupdate(this._prevsortingoption)},_setFilteredContent:function(){for(var t,r=this._gridtag.find(".e-gridcontent tr"),i=0;i<r.length;i++)t=n(r[i]).find("td:last"),n(r[i]).attr("data-parent-path",t.text()),t.attr("title",t.text()),t.text("/"+t.text().replace(this._rootPath,""))},_templateRefresh:function(n){this._trigger("templateRefresh",n)},_gridActionBegin:function(n){if(n.requestType=="sorting"){n.cancel=!0;this._suggestionItems.length&&this._setFilteredContent();var t=this.model.gridSettings.columns.length;for(i=0;i<t;i++)if(n.columnName==this.model.gridSettings.columns[i].field){this._changeActiveSortedoption(this.model.gridSettings.columns[i].headerText);this._sorting(this._prevsortingoption,this._prevsorting);this._sortingActioncomplete();break}}},_gridActionComplete:function(n){this.model.showCheckbox&&this._gridCheckboxState(n);!t.isNullOrUndefined(this._gridObj)&&this.model.gridSettings.allowSorting&&this._gridupdate(this._prevsortingoption)},_gridCheckboxState:function(){var n=this;this._gridtag.find(".e-headercelldiv:first").html(" <input type='checkbox' id='headchk' />").addClass("e-col-check");this._headCheckObj=this._gridtag.find("#headchk").ejCheckBox({showRoundedCorner:n.model.showRoundedCorner,change:function(t){n._headCheckChange(t)}}).data("ejCheckBox");this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({showRoundedCorner:n.model.showRoundedCorner});this._gridtag.find(".e-chkbox-wrap").removeAttr("tabindex")},_checkChange:function(t){var i,e;if(t.isInteraction||t.isInteraction==r){var o=this._gridtag.find(".e-grid-row-checkbox"),f=this._gridtag.find(" .e-gridcontent .e-checkbox:checked"),u=[];for(i=0;i<f.length;i++)u.push(n(f[i]).closest("tr").index());for(t&&!t.type&&(e=n.inArray(t.index(),u),t.find(".e-chk-act").length==1?u.splice(e,1):u.push(t.index())),this._changeCheckState=!1,this._gridObj.clearSelection(),u.length==o.length?this._gridtag.find("#headchk").ejCheckBox({checked:!0}):this._gridtag.find("#headchk").ejCheckBox({checked:!1}),this._isClicked=!1,i=0;i<u.length;i++)!0&&(this._gridObj.multiSelectCtrlRequest=!0,this._gridObj.selectRows(u[i]));this._isClicked=!0;this.model.checked==!1&&this._gridtag.find("#headchk").ejCheckBox({checked:!1});this._changeCheckState=!0}},_recordClick:function(){for(var r,i=this._gridtag.find(".e-grid-row-checkbox"),t=0;t<i.length;t++)n.inArray(t,this._gridObj.selectedRowsIndexes)<0?(n(i[t]).ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1}),this._gridObj.multiSelectCtrlRequest||this._unselectEvent()):(n(i[t]).ejCheckBox({checked:!0}),r=this._gridtag.find(".e-grid-row-checkbox:checked"),r.length==i.length&&this._gridtag.find("#headchk").ejCheckBox({checked:!0}))},_headCheckChange:function(n){if(n.isInteraction){var i=this,t=this._gridtag.find(".e-grid-row-checkbox");t.ejCheckBox({change:function(n){i._checkChange(n)}});this._gridtag.find("#headchk").is(":checked")?(t.ejCheckBox({checked:!0}),this._gridObj.selectRows(0,t.length)):(t.ejCheckBox({checked:!1}),this._setSelectedItems([]),this._unselectEvent())}},_unselectEvent:function(){var t=this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName),i,e,u,f;if((this._filteredItemsName=[],!this._gridObj||!this._gridObj.multiSelectCtrlRequest)&&t.length>0){for(this._unselectedItems=[],i=0;i<t.length;i++)name=t[i].name,this._unselectedItems.push(name);e=n.inArray(r,this.model.selectedItems);n.each(this._fileExplorer[this._originalPath],function(n,t){u=t.isFile?"File":"Directory"});f={name:this._unselectedItems[this._unselectedItems.length-1],names:this._unselectedItems,path:this.model.selectedFolder,nodeType:u,unselectedItem:t[t.length-1],unselectedItems:t};this._trigger("unselect",f)}},_gridViewEvents:function(n){this[n](this._gridtag.find(".e-gridcontent"),"focusin",this._focusGridView);this[n](this._gridtag.find(".e-gridcontent"),"focusout",this._blurGridView);this.model.allowDragAndDrop&&this._gridDragEvents(n)},_gridDragEvents:function(n){var t=this._gridtag.children(".e-gridcontent");t&&(this[n](t,"dragover",this._onDragOverHandler),this[n](t,"drop",this._onDropHandler),this[n](t,"dragleave",this._onDragLeave),this[n](this._gridtag.find(".e-gridheader"),"dragover",this._preventDropOption))},_focusGridView:function(){this._gridtag.find(".e-gridcontent").hasClass("e-focus")||(this._gridtag.find(".e-gridcontent").addClass("e-focus"),this._itemList=[],this._on(this._gridtag.find(".e-gridcontent"),"keydown",this._OnKeyUp),this._hidePopup())},_blurGridView:function(){this._gridtag.find(".e-gridcontent").removeClass("e-focus");this._off(this._gridtag.find(".e-gridcontent"),"keydown",this._OnKeyUp)},_setThumbImageHeight:function(){var i=this._perRow=1,t,f,r,u;if(this.items){for(t=0;t<this.items.length-1;t++)if(this.items[t].getBoundingClientRect().top==this.items[t+1].getBoundingClientRect().top)i++;else break;if(!(i==null||i<2))for(t=0,f=this.items.length;t<f;t+=i)r=0,u=this.items.slice(t,t+i),u.each(function(){var t=parseInt(n(this).find(".e-thumb-image").outerHeight());t>r&&(r=t)}),u.find(".e-thumb-image.e-image").css("height",r);this._tileScroll&&this._tileScroll.refresh()}this._perRow=i},_renderTileView:function(i,r){var h,c,l,o,a,s,e;this._tileView.children()&&this._tileView.children().remove()&&this._tileView.removeClass("e-tileview");this._tileView.appendTo(this._tileContent);this._tileView.addClass("e-tileview").attr("role","tileview");h=this._getFilePermission(this._currentPath);h&&!h.Read?this._tileView.html(this._getLocalizedLabels("ProtectedFolder")).addClass("e-fe-center"):this._searchbar&&n.trim(this._searchbar.val())&&i.length==0?this._tileView.html(this._getLocalizedLabels("EmptyResult")).addClass("e-fe-center"):i.length==0?this._tileView.html(this._getLocalizedLabels("EmptyFolder")).addClass("e-fe-center"):this._tileView.html("").removeClass("e-fe-center");var u=this,v=r,f=null;if(n.each(i,function(i,r){var e,s,c,o,l,a,p,w;e=r.filterPath?n("<li class='e-tilenode' data-parent-path='"+r.filterPath+"'><\/li>"):n("<li class='e-tilenode'><\/li>");s=n("<div class='e-align'><div class='e-thumb-image e-image ' unselectable='on'><\/div><\/div>");r.isFile?(s.appendTo(e),c=r.name.substr(r.name.lastIndexOf(".")+1).toLowerCase(),/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(r.name)?u.model.showThumbnail?(o=r.filterPath?r.filterPath.replace("~","..")+r.name:v?u._originalPath.replace("~","..")+r.name:u._currentPath.replace("~","..")+r.name,l=u._getImage(o,r.name,u.model.enableThumbnailCompress),f=t.buildTag("img.e-thumbImage","","",{src:l?l:o+"?"+(u._updateImages[o]?u._updateImages[o]:u._initialTime),unselectable:"on"})):f=n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-images"):f=/\.(mp3|wav|aac|ogg|wma|aif|fla|m4a)$/i.test(r.name)?n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-audio"):/\.(webm|mkv|flv|vob|ogv|ogg|avi|wmv|mp4|3gp)$/i.test(r.name)?n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-video"):/\.(css|exe|html|js|msi|pdf|pptx|ppt|rar|zip|txt|docx|doc|xlsx|xls|xml|rtf|php)$/i.test(r.name)?n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-"+c):n("<span class='e-thumbImage e-fe-icon e-fe-unknown' unselectable='on'><\/span>").addClass("e-fe-"+c)):(s.appendTo(e),e.addClass("e-folder"),f=n("<span class='e-thumbImage e-fe-icon e-fe-folder' unselectable='on'><\/span>"),r.permission&&!r.permission.Read&&f.addClass("e-fe-lock"));f.appendTo(s.find(".e-thumb-image"));u.model.showCheckbox&&(a=n("<input type='checkbox' class='e-tile-checkbox' />"));var y=n("<div class='e-name-wrap' unselectable='on' <\/div>"),h=n("<div class='e-name e-name-in-wrap' unselectable='on'><\/div>"),b=n("<div class='e-file-name' unselectable='on'><span class='e-file-info' title= '"+r.name+"'>"+r.name+"<\/span><\/div>");b.appendTo(h);r.isFile&&u.model.layout=="tile"&&(p=n("<div class='e-file-type' unselectable='on'><span class='e-file-info'>"+r.type+"<\/span><\/div>"),p.appendTo(h),w=n("<div class='e-file-size' unselectable='on'><span class='e-file-info'>"+r.size+"<\/span><\/div>"),w.appendTo(h));h.appendTo(y);e.attr({"aria-selected":!1,title:r.isFile?r.dateModified+" ("+r.size+")":r.dateModified,role:"tileitem"});u.model.showCheckbox&&a.prependTo(e);y.appendTo(e);e.appendTo(u._tileView);u.model.showCheckbox&&u._tileView.find(".e-tile-checkbox").ejCheckBox({size:"mini",showRoundedCorner:u.model.showRoundedCorner});u._tileView.find(".e-chkbox-wrap").removeAttr("tabindex")}),this._activeItem=0,this.items=this._tileView.children("li.e-tilenode"),this.model.allowDragAndDrop&&(this._tileViewWrapper.addClass("e-droppable"),this._drag(this.items),this.items.addClass("e-file-draggable")),this._tileViewEvents("_off"),this._tileViewEvents("_on"),this._tileContent.addClass("e-content"),c=this.model.showFooter?this._splittag.outerHeight()-this._statusbar.outerHeight():this._splittag.outerHeight(),l=parseInt(this._splittag.find(".e-cont2").width()),t.isNullOrUndefined(this._tileScroll)?this._tileScroll=this._tileContent.parent(".e-tile-wrapper").ejScroller({height:c,width:l,buttonSize:0,scrollerSize:this._scrollerSize,thumbStart:function(n){u._onThumbStart(n)}}).data("ejScroller"):(this._tileScroll.option({height:c,width:l}),this._tileScroll&&this._tileScroll.refresh()),u._tileView.find(".e-image > img").length)for(o=u._tileView.find(".e-image > img"),a=0,s=0;s<o.length;s++)e=new Image,e.onload=e.onabort=e.onerror=function(n){if(n){++a==o.length&&u._setThumbImageHeight();var t={path:n.target.src,element:n.target,originalArgs:n,action:"thumbnailPreview"};u._trigger("getImage",t)}},e.src=n(o[s]).attr("src");else u._setThumbImageHeight()},_getImage:function(n,t,i){var f,r,u;return(n=n.replace("..","~"),f=this._getSelectedItemDetails(this._currentPath,t),r={path:n,canCompress:i,size:i?{Height:104,Width:116}:null,selectedItems:f},this._trigger("beforeGetImage",r))?"":((this._currentPath.indexOf(":")==1||this.model.ajaxSettings.getImage.url)&&(u=this.model.ajaxAction+"?Path="+r.path+"&ActionType=GetImage&CanCompress="+r.canCompress+"&Size="+JSON.stringify(r.size)+"&SelectedItems="+JSON.stringify(r.selectedItems),this.model.ajaxSettings.getImage.url&&(u=this.model.ajaxSettings.getImage.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.getImage.url,"?CanCompress="+r.canCompress+"&Size="+JSON.stringify(r.size)+"&Path="+r.path+"&SelectedItems="+JSON.stringify(r.selectedItems)):this.model.ajaxSettings.getImage.url)),u?u:i?this.model.ajaxAction+"?ActionType=GetImage&CanCompress="+r.canCompress+"&Size="+JSON.stringify(r.size)+"&Path="+r.path+"&SelectedItems="+JSON.stringify(r.selectedItems):"")},_gridtagClick:function(t){t.stopPropagation();(n(t.target).hasClass("e-gridcontent")||n(t.target).hasClass("e-content")||n(t.target).hasClass("e-table"))&&(this._addFocus(this._gridtag.find(".e-gridcontent")),this.model.showCheckbox&&(this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1})),this._gridObj.clearSelection(),this._unselectEvent(),this._updateCurrentPathPermission(),this._activeSource&&this._activeSource.length&&this._setSelectedItems(this._activeSource));this._activeSource=null},_updateGridSelection:function(t){t.events&&!t.events.ctrlKey&&n(t.target)[0]!=null&&this._gridObj.selectRows(n(t.target).closest("td").parent().index(),null,n(t.target).closest("td"))},_updateTileSelection:function(t){t.events&&!t.events.ctrlKey&&n(t.target)[0]!=null&&this._triggerClick(t.target)},_tileViewEvents:function(t){this[t](this.items,"mousedown",this._preventDefaultSelection);this[t](this.items,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click",this._upDatePathFromTileView);this[t](this.items,this._isDevice&&n.isFunction(n.fn.tap)?"doubletap":"dblclick",this._openAction);this[t](this.items,"mouseenter",this._onItemHover);this[t](this.items,"mouseleave",this._onItemLeave);this[t](this._tileViewWrapper,"focusin",this._focusTileView);this[t](this._tileViewWrapper,"focusout",this._blurTileView);this.model.allowDragAndDrop&&this._tileDragEvents(t)},_tileDragEvents:function(n){this._tileViewWrapper&&(this[n](this._tileViewWrapper,"dragover",this._onDragOverHandler),this[n](this._tileViewWrapper,"drop",this._onDropHandler),this[n](this._tileViewWrapper,"dragleave",this._onDragLeave))},_preventDefaultSelection:function(n){n.shiftKey&&n.preventDefault()},_tileViewWrapperClick:function(t){(n(t.target).hasClass("e-tile-wrapper")||n(t.target).hasClass("e-tile-content")||n(t.target).hasClass("e-tileview"))&&(this._lastItemIndex=this._lastItemIndex?this._lastItemIndex:this._itemList?this._itemList.filter(".e-active").index():-1,this._addFocus(this._tileViewWrapper),this.items.hasClass("e-active")&&this.items.removeClass("e-active").attr("aria-selected",!1),this._updateCurrentPathPermission(),this.model.showCheckbox&&this._clearTileCheckBoxSelection(),this._hidePopup(),this._activeSource&&this._activeSource.length&&this._setSelectedItems(this._activeSource),this._unselectEvent());this._activeSource=null},_onItemHover:function(t){var i=t.currentTarget,r=t.target;n(i).hasClass("e-disable")||(this.items.removeClass("e-hover"),n(i).addClass("e-hover"))},_onItemLeave:function(t){var i=t.currentTarget,r=t.target;n(i).hasClass("e-disable")||n(i).removeClass("e-hover")},_focusTileView:function(){this._tileViewWrapper.hasClass("e-focus")||(this._tileViewWrapper.addClass("e-focus"),this._itemList=this.items,this._on(this._tileViewWrapper,"keydown",this._OnKeyUp),this._on(this._tileViewWrapper,"keydown",this._OnKeyDown))},_blurTileView:function(){this._tileViewWrapper.removeClass("e-focus");this._off(this._tileViewWrapper,"keydown",this._OnKeyUp);this._off(this._tileViewWrapper,"keydown",this._OnKeyDown)},_OnKeyDown:function(t){var i=this._itemList.length-1,r;if(this._activeItem=this._lastItemIndex?this._lastItemIndex:this._itemList?this._itemList.filter(".e-active").index():-1,r=this._getKeyCode(t),this.model.allowKeyboardNavigation){switch(r){case 38:if(t.preventDefault(),n(t.target).hasClass("e-statusbar")){this._focusLayout(this.model.layout);return}if(this._activeItem<this._perRow-1)return;this._activeItem-=this._perRow;this._beforeListHover(t);break;case 37:if(t.preventDefault(),this._activeItem==0)return;this._activeItem<0||this._activeItem==null||this._activeItem>i?this._activeItem=0:this._activeItem==0?this._activeItem=i:this._activeItem-=1;this._beforeListHover(t);break;case 40:if(t.preventDefault(),this._activeItem+this._perRow>=this._itemList.length)return;this._activeItem+=this._perRow;this._beforeListHover(t);break;case 39:if(t.preventDefault(),this._activeItem==i)return;this._activeItem>i||this._activeItem==null||this._activeItem<0?this._activeItem=i:this._activeItem==i?this._activeItem=0:this._activeItem+=1;this._beforeListHover(t);break;case 33:case 36:t.preventDefault();this._activeItem=0;this._beforeListHover(t);break;case 34:case 35:t.preventDefault();this._activeItem=i;this._beforeListHover(t)}this._lastItemIndex=t.shiftKey?this._activeItem:null}},_OnKeyUp:function(i){var o=this._getKeyCode(i),f,u,s,r,e;if(this.model.allowKeyboardNavigation&&!this._KeydownEventHandler(i))switch(o){case 13:i.preventDefault();i.altKey?(this._lastFocusedElement=i.currentTarget,this._getDetails()):(i.preventDefault(),this._lastFocusedElement=i.currentTarget,n(i.currentTarget).hasClass("e-treeview")||(f=!1,n(i.currentTarget).hasClass("e-tile-wrapper")?f=this.items.hasClass("e-active"):n(i.currentTarget).hasClass("e-gridcontent")&&(f=n(this.gridItems).find("td").hasClass("e-active")),f&&this._selectedContent&&this._openAction()));break;case 86:i.ctrlKey&&(i.preventDefault(),!t.isNullOrUndefined(this._option)&&this._selectedContent&&(this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath),this._lastFocusedElement=i.currentTarget,this._cut_copy()));break;case 46:case 67:case 68:case 88:case 113:if(i.preventDefault(),this._lastFocusedElement=i.currentTarget,f=!1,n(i.currentTarget).hasClass("e-treeview")?this._rootPath!=this._currentPath&&(f=this._treetag.find(".e-active").length>0?!0:!1):n(i.currentTarget).hasClass("e-tile-wrapper")?f=this.items.hasClass("e-active"):n(i.currentTarget).hasClass("e-gridcontent")&&(f=n(this.gridItems).find("td").hasClass("e-active")),f&&this._selectedContent&&this._toRead&&(o==67&&this._toCopy&&i.ctrlKey&&this._copyMoveNode("copy"),this._toEdit))switch(o){case 46:this._deleteFolder();break;case 68:i.ctrlKey&&this._deleteFolder();break;case 88:i.ctrlKey&&this._copyMoveNode("move");break;case 113:this._renameFolder()}break;case 93:case 121:if((i.shiftKey||o==93)&&this.model.showContextMenu)if(i.preventDefault(),this._lastFocusedElement=i.currentTarget,u=null,n(i.currentTarget).hasClass("e-treeview"))r=this._treeObj.getSelectedNode().find(".e-active"),u=this._getMenuPosition(r),this._treeMenuObj.show(u.left,u.top,r,i,!0);else{if(n(i.currentTarget).hasClass("e-tile-wrapper")){for(e=0;e<this.items.length;e++)if(r=n(this.items[e]),r.text()==this._selectedContent){u=this._getMenuPosition(r);s=r;break}}else if(n(i.currentTarget).hasClass("e-gridcontent"))for(e=0;e<this.gridItems.length;e++)if(r=n(this.gridItems[e]).find("td.e-grid-image").next(),r.text()==this._selectedContent){u=this._getMenuPosition(r);s=r;break}u==null&&(u=n(i.currentTarget).offset(),s=n(i.currentTarget));this._viewMenuObj.show(u.left,u.top,s,i,!0)}}},_KeydownEventHandler:function(n){return data={keyCode:n.keyCode,altKey:n.altKey,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,originalArgs:n},this._trigger("keydown",data)},_getMenuPosition:function(n){var i=n.outerHeight()/2,r=n.outerWidth()/2,t=n.offset();return{top:t.top+i,left:t.left+r}},_beforeListHover:function(i){var r=this._getActiveItem(),u;r.hasClass("e-disable")||(n(i.target).hasClass("e-statusbar")?(this.model.layout=r.hasClass("e-switchGridView")?t.FileExplorer.layoutType.Grid:t.FileExplorer.layoutType.LargeIcons,this._switchLayoutView(this.model.layout),this._addFocus(this._statusbar)):(u={keyCode:91,shiftKey:i.shiftKey,innerEvent:!0,currentTarget:r[0],target:r[0]},this._upDatePathFromTileView(u)))},_getActiveItem:function(){return n(n(this._itemList)[this._activeItem])},_getURL:function(){var n=this.model.ajaxAction+"?Path="+this._currentPath+"&ActionType=Upload"+(this._selectedContent?"&SelectedItems="+JSON.stringify(this._getSelectedItemDetails(this._getFolderPath(),[this._selectedContent])):"");return this.model.ajaxSettings.upload.url&&(n=this.model.ajaxSettings.upload.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.upload.url,"?Path="+this._currentPath+(this._selectedContent?"&SelectedItems="+JSON.stringify(this._getSelectedItemDetails(this._getFolderPath(),[this._selectedContent])):"")):this.model.ajaxSettings.upload.url),n},_renderUploadBox:function(){var n=this,i=this._getURL();this._uploadtag.ejUploadbox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,height:"0px",width:"0px",uploadName:"FileUpload",autoUpload:this.model.uploadSettings.autoUpload,showFileDetails:!this.model.uploadSettings.autoUpload,dialogText:{title:n._getLocalizedLabels("Upload")},dialogAction:{modal:!0,content:n.element},showRoundedCorner:this.model.showRoundedCorner,extensionsAllow:this.model.fileTypes=="*.*"?"":this.model.fileTypes.replace(/\*/g,""),multipleFilesSelection:this.model.uploadSettings.allowMultipleFile,fileSize:this.model.uploadSettings.maxFileSize,buttonText:{browse:"Upload file"},saveUrl:i,removeUrl:this.model.ajaxAction+"?Path="+this._currentPath+"&ActionType=Remove",locale:t.Uploadbox.Locale[this.model.locale]?this.model.locale:"en-US",complete:function(t){n._uploadSuccess(t)},remove:function(t){n._uploadSuccess(t)},fileSelect:function(t){var f,r,i,u;for(n._fileExplorer[n._currentPath]||n._getFileDetails(n._currentPath),f=n._fileExplorer[n._currentPath],n._existingItems=[],r=n._files=t.files,i=0;i<r.length;i++)for(u=0;u<f.length;u++)if(r[i].name==f[u].name){n._existingItems.push({Name:r[i].name,Path:n._currentPath+r[i].name,IsReplace:!0});break}n._existingItems.length&&(n._createReplaceConformationDiaolg("_customUpload","ReplaceAlert"),t.cancel=!0)},error:function(i){n._alertDialog&&n._alertDialog.is(":visible")||(n._alertDialog=n._createDialog(t.buildTag("div.e-fe-dialog-label",i.error?i.error:i.responseText),{width:400,height:"auto",title:n._getLocalizedLabels("Error")}),n._alertDialogObj=n._alertDialog.data("ejDialog"))},begin:function(t){var i=n._currentPath.split("/"),r={path:n._currentPath,selectedItems:n._getSelectedItemDetails(n._getFolderPath(),i[i.length-2]),uploadItemDetails:t.files};n._trigger("beforeUpload",r)&&(t.cancel=!0);n._uploadtag.ejUploadbox({saveUrl:n._getURL()})},cancel:function(){n._usePreviousValues()}})},_usePreviousValues:function(){this._previousPath&&(this._currentPath=this._previousPath,this._selectedContent=this._previousSelectedContent,this._previousPath=null)},_isRestrictedUpload:function(n,t,i){var r=null,u;if(n.find(".e-fe-lock").length){if(r=i?i:this._getFolderPath(this._updatePath(n,t)),this._fileExplorer[r]&&this._fileExplorer[r].length)for(u=0;u<this._fileExplorer[r].length;u++)if(this._fileExplorer[r][u].name==t&&this._fileExplorer[r][u].permission)return!this._fileExplorer[r][u].permission.Upload;return!1}return!1},_onDragOverHandler:function(i){var e="",o="",r=n(i.target),u=r.hasClass("e-js")||r.hasClass("e-tileview")?"":r.text(),f,s;i.originalEvent.dataTransfer.dropEffect="copy";i.stopPropagation();i.preventDefault();r.hasClass("e-file-droppable")||(e=this._splittag.find(".e-file-droppable"),e&&e.removeClass("e-file-droppable"),n(i.currentTarget).hasClass("e-tree-wrapper")?!t.isNullOrUndefined(r)&&r.is("A")?(this._droppableElement=r,this._droppableElement.length&&this._droppableElement.addClass("e-file-droppable"),f=r.closest("li.e-item"),f.find(".e-icon").length&&!this._treeObj.isExpanded(f)&&(this._expandTimer=window.setTimeout(function(){this._treeObj&&this._treeObj.expandNode(f)},800))):i.originalEvent.dataTransfer.dropEffect="none":(this.model.layout=="grid"?(this._droppableElement=r.closest("tr","table.e-table"),this._droppableElement.length?(this._droppableElementData=this._gridObj.model.currentViewData[this._gridObj.getIndexByRow(this._droppableElement)],this._droppableElementData.isFile&&(this._gridtag.find(".e-gridcontent").addClass("e-file-droppable"),this._droppableElement=null)):this._gridtag.find(".e-gridcontent").addClass("e-file-droppable")):(this._droppableElement=r.closest("li",".e-tileview").has(".e-fe-folder"),this._droppableElement.length||this._tileViewWrapper.addClass("e-file-droppable")),this._droppableElement&&this._droppableElement.length&&this._droppableElement.addClass("e-file-droppable"),o=this._getHoverTreeElementPath(r),this._droppableElement&&this._droppableElement.length&&(u=this.model.layout=="grid"?this._droppableElementData.name:this._droppableElement.find(".e-file-name").text())));this._droppableElement&&this._droppableElement.length&&this._isRestrictedUpload(this._droppableElement,u?u:i.target.textContent,o)&&(i.originalEvent.dataTransfer.dropEffect="none");s={target:this._droppableElement&&this._droppableElement.length?this._droppableElement:r,targetElementName:u,targetPath:this._getHoverTreeElementPath(r)+u};this._trigger("drag",s)},_getHoverTreeElementPath:function(n){return n.hasClass("e-text")?this._updatePath(n,n.text()):this._originalPath},_onDropHandler:function(t){var r,i;if(t.originalEvent.dataTransfer.files&&t.originalEvent.dataTransfer.files.length){if(t.stopPropagation(),t.preventDefault(),this._expandTimer!=null&&(window.clearTimeout(this._expandTimer),this._expandTimer=null),this.element.find(".e-file-droppable").removeClass("e-file-droppable"),r=this._uploadtag.ejUploadbox("instance"),this._droppableElement&&this._droppableElement.length)this._previousPath=this._currentPath,this._previousSelectedContent=this._selectedContent,n(t.currentTarget).hasClass("e-tree-wrapper")?(this._selectedContent=t.target.text,this._currentPath=this._updatePath(n(t.target),this._selectedContent)):(this._selectedContent=this.model.layout=="grid"?this._droppableElementData.name:n(t.target).closest("li","e-tileview").find(".e-file-name").text(),this._currentPath=this._originalPath+this._selectedContent+"/");else{if(this._droppableElement&&!this._droppableElement.length&&this._isRestrictedUpload(this._selectedNode,this._selectedTreeText,this._getFolderPath(this._originalPath)))return t.originalEvent.dataTransfer.dropEffect="none",null;this._currentPath=this._originalPath;this._selectedContent=this._selectedTreeText}(i={dropAction:"upload",fileInfo:t.originalEvent.dataTransfer.files,target:this._droppableElement&&this._droppableElement.length?this._droppableElement:n(t.currentTarget),targetPath:this._currentPath,targetElementName:this._selectedContent},this._trigger("dragStop",i))||(r._onDropHandler(t),i={dropAction:"upload",fileInfo:t.originalEvent.dataTransfer.files,target:this._droppableElement&&this._droppableElement.length?this._droppableElement:n(t.currentTarget),targetPath:this._currentPath,targetFolder:this._selectedContent},this._trigger("drop",i))}},_onDragLeave:function(t){this._expandTimer!=null&&(window.clearTimeout(this._expandTimer),this._expandTimer=null);(this._gridtag.find(".e-gridcontent").hasClass("e-file-droppable")||n(t.target).hasClass("e-tile-wrapper")||n(t.target).hasClass("e-gridcontent")||n(t.target).closest(".e-fileexplorer .e-tile-wrapper")||n(t.target).closest(".e-fileexplorer .e-gridcontent"))&&(this.model.layout=="grid"?this._gridtag.find(".e-gridcontent").removeClass("e-file-droppable"):this._tileViewWrapper.removeClass("e-file-droppable"))},_customUpload:function(){for(var t,n=0;n<this._existingItems.length;n++)if(!this._existingItems[n].IsReplace)for(t=0;t<this._files.length;t++)if(this._files[t].name==this._existingItems[n].Name){this._files.splice(t,1);break}this._uploadtag.ejUploadbox({pushFile:this._files})},_uploadSuccess:function(n){for(var r=this._currentPath,i=[],t=0;t<n.success;t++)i.push(n.success[t].name);this.element.find(".e-dialog.e-js .e-action-perform").remove();this._fileExplorer[this._currentPath]="";this._treeObj.selectNode(this._selectedNode);r==this._currentPath&&this._setSelectedItems(i)},_preventDrag:function(){var t=this._treetag.find("li div a");t.removeClass("e-file-draggable");this.gridItems&&this.gridItems.length&&n(this.gridItems).removeClass("e-file-draggable");this.items&&this.items.length&&this.items.removeClass("e-file-draggable")},_allowDrag:function(){var t,r,i,u;this._gridtag.children(".e-gridcontent").addClass("e-droppable");this._tileViewWrapper.addClass("e-droppable");t=this._treetag.find("li div a").not(".e-js");t.length&&this._drag(t);r=n(this.gridItems).not(".e-js");r.length&&this._drag(n(this.gridItems));i=this.items.not(".e-js");i.length&&this._drag(i);u=this._treetag.find("li div a");u.addClass("e-file-draggable");this.gridItems&&this.gridItems.length&&n(this.gridItems).addClass("e-file-draggable");this.items&&this.items.length&&this.items.addClass("e-file-draggable")},_drag:function(i){var f,e,o,h,u,c,s,r=this;i.ejDraggable({dragOnTaphold:!0,clone:!0,dragStart:function(t){var u=!1,i,e;if(r._previousElement=r._selectedNode,n(t.target).hasClass("e-text")?(u=!0,r._copiedNodes=[n(t.target).text()],r._option="move",r._sourcePath=r._getFolderPath(r._getHoverTreeElementPath(n(t.target))),r._sourceType="Directory",r._fileName=n(t.target).text(),r._refreshNode=n(t.target).closest("li")):r.model.selectedItems.length<=1&&(r.model.layout=="grid"?r._gridObj.selectRows(n(t.target).closest("tr").index()):r._triggerClick(t.target)),r.model.selectedItems.length){for(i=0;i<r.model.selectedItems.length;i++)if(t.target&&r._isRestrictedMove(t.element,r.model.selectedItems[i],r.model.selectedFolder))return f.remove(),t.cancel=!0,null}else if(n(t.target).hasClass("e-text")&&(o=t.target.textContent),t.target&&o&&r._isRestrictedMove(t.element,o,""))return f.remove(),t.cancel=!0,null;u||r._copyMoveNode("move");r._previousElement.find("a").eq(0).click();e={target:t.element,targetPath:r._currentPath,selectedItems:r._getSelectedItemDetails(r._sourcePath,r._fileName)};r._trigger("dragStart",e)},drag:function(t){var l,a=u,v=n(t.target).closest(".e-droppable",".e-fileexplorer"),i,y;n(t.target).hasClass("e-droppable")?u=n(t.target):v.length?u=v:n(t.target).hasClass("e-text")?u=n(t.target).find(".e-droppable"):r._clearExpand(n(t.target).closest("li.e-item"));document.body.style.cursor="no-drop";e&&(e.style.cursor=h);e=t.target;h=t.target.style.cursor;n(f).css({"margin-left":"10px"});u&&a&&u.hasClass("e-draggable")?(u.text()!=a.text()&&(i=n(t.target).closest("li.e-item"),r._clearExpand(i),i&&i.find(".e-icon").length&&!r._treeObj.isExpanded(i)&&(r._expandTimer=window.setTimeout(function(){r._treeObj&&r._treeObj.expandNode(i)},800)),clearTimeout(l),l=setTimeout(function(){n(e).hasClass("e-text")?r._needToScroll(n(e).closest("li"),"Tree"):u&&r._needToScroll(n(u),"")},100)),t.target.style.cursor="pointer"):t.target.style.cursor="no-drop";n(e).hasClass("e-text")?(o=e.textContent,s=""):(o=r.model.layout=="grid"?u?u.find("[data-cell='"+r._gridObj.getColumnByField("name").headerText+"']").text():"":u?u.hasClass("e-tile-wrapper")?"":u.text():"",s=r._getHoverTreeElementPath(n(e)));e&&r._isRestrictedMove(u,o,s)?(t.target.style.cursor="no-drop",c=!0):c=!1;s+(o?o+"/":"")!=r._sourcePath&&(t.target.style.cursor="pointer");y={target:u&&u.length?u:n(t.target),targetElementName:o,targetPath:(s?s:r._originalPath)+o};r._trigger("drag",y)},dragStop:function(i){var o=!1,s;if(o=r.model.layout=="grid"?n(i.target).hasClass("e-gridcontent")||n(i.target).find("table").length&&n(i.target).closest(".e-gridcontent",".e-fileexplorer").length:n(i.target).hasClass("e-tileview")||n(i.target).find(".e-tileview").length&&n(i.target).closest(".e-fileexplorer").length,o&&r._sourcePath==r._originalPath&&(r._activeSource=r.model.selectedItems),o){if(r._setSelectedItems([]),t.isNullOrUndefined(r._copiedNodes)||!i.element.hasClass("e-file-draggable"))return;if(f.hide(),r.element.find(".e-blur").removeClass("e-blur"),r._currentPath==r._sourcePath+r._fileName+"/")return;r._cut_copy();f&&f.remove()}r._expandTimer!=null&&(window.clearTimeout(r._expandTimer),r._expandTimer=null);e&&(e.style.cursor=h);document.body.style.cursor="";r.element.find(".e-blur").removeClass("e-blur");!i.element.dropped&&((n(i.event.target).hasClass("e-tree-wrapper")||n(i.event.target).parents(".e-tree-wrapper").length>0)&&!n(i.event.target).is("a")||!n(i.event.target).hasClass("e-tile-wrapper")&&!n(i.event.target).parents(".e-tile-wrapper").length>0&&!n(i.event.target).hasClass("e-gridcontent")&&!n(i.event.target).parents(".e-gridcontent").length>0&&!n(i.event.target).hasClass("e-tree-wrapper")&&!n(i.event.target).parents(".e-tree-wrapper").length>0)&&f&&f.remove();s={dropAction:"move",fileInfo:r._getSelectedItemDetails(r._sourcePath,r._copiedNodes),target:u&&u.length?u:n(i.target),targetElementName:r._selectedContent,targetPath:r._currentPath};r._trigger("dragStop",s)},helper:function(i){var u,e,s,o,h;if(!t.isNullOrUndefined(i.element)){if(!i.element.hasClass("e-file-draggable"))return i.cancel=!0,null;if(r)return f=t.buildTag("div.e-dragedNode e-fe"),h=t.util.getZindexPartial(r.element),f.css({"z-index":h}),f.addClass(r.model.cssClass+(r.model.enableRTL?" e-rtl":"")),u=n(i.element).clone().addClass("dragClone"),e=u.find("img"),s=e.length?t.buildTag("img.e-thumbImage","","",{src:e.attr("src")}):t.buildTag("span","","",{"class":u.find(".e-fe-icon").attr("class")}),r.model.selectedItems.length>1&&(o=t.buildTag("div.e-count"),o.text(r.model.selectedItems.length),f.append(o)),f.append(s),f.appendTo(n("body"))}}});i.ejDroppable({accept:i,drop:function(i,u){var f,e;c||t.isNullOrUndefined(r._copiedNodes)||!u.draggable.hasClass("e-file-draggable")||(n(u.helper).hide(),f=function(t){var u,f;(t||r._clickTarget(i),r._currentPath!=r._sourcePath+r._fileName+"/")&&(u=r._getSelectedItemDetails(r._sourcePath,r._fileName),r._cut_copy(!0),f={dropAction:"move",fileInfo:u,target:n(i.dropTarget),targetPath:r._currentPath,targetFolder:r._selectedContent},r._trigger("drop",f))},r.model.layout!="grid"||n(i.dropTarget).hasClass("e-text")?(e=r._getHoverTreeElementPath(n(i.dropTarget)),r._fileExplorer[e]?f():r._getFileDetails(e,"","",f)):(r._gridObj.selectRows(n(i.dropTarget).closest("tr").index()),f(!0)),n("body").find(".e-dragedNode").length>0&&n("body").find(".e-dragedNode").remove())}})},_clickTarget:function(t){if(n(t.dropTarget).hasClass("e-text"))this._treeObj&&this._treeObj.selectNode(t.dropTarget);else if(this.model.layout=="grid"){var i=n(t.dropTarget).closest("tr").index();i>=0?this._gridObj.selectRows(n(t.dropTarget).closest("tr").index()):n(t.dropTarget).click()}else this._triggerClick(t.dropTarget)},_triggerClick:function(t){var i=n(t).closest(".e-tilenode");i.length>0&&this._isDevice&&n.isFunction(n.fn.tap)?n(t).trigger("tap"):n(t).click()},_clearExpand:function(){this._expandTimer!=null&&(window.clearTimeout(this._expandTimer),this._expandTimer=null)},_isRestrictedMove:function(n,t,i){var r=null,u;if(n&&n.find(".e-fe-lock").length){if(r=i?i:this._getFolderPath(this._updatePath(n,t)),this._fileExplorer[r]&&this._fileExplorer[r].length)for(u=0;u<this._fileExplorer[r].length;u++)if(this._fileExplorer[r][u].name==t&&this._fileExplorer[r][u].permission)return!this._fileExplorer[r][u].permission.Copy;return!1}return!1},_createAddressBar:function(){this._addresstag=t.buildTag("input.e-addressBar e-tool-input","",{},{id:this._ExplorerId+"_addressbar",type:"text"});this._addresstag.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Addressbar").html(""));var i=n("<span class='e-fe-icon e-fe-folder'><\/span>");i.insertBefore(this._addresstag);t.browserInfo().name=="msie"&&t.ieClearRemover(this._addresstag[0]);this._addressBarEvents("_on")},_addressBarEvents:function(t){this[t](n("#"+this._ExplorerId+"_addressbar"),"focus",this._inputFocusin);this[t](n("#"+this._ExplorerId+"_addressbar"),"keydown",this._searchPath);this[t](n("#"+this._ExplorerId+"_addressbar"),"blur",this._addressbarFocusout)},_inputFocusin:function(t){n(t.target).select()},_updateAddressBar:function(){if(this._addresstag){var n=this._currentPath;this._addresstag.val(n.replace(this._initPath,""))}},_onEpand:function(n){this._splitObj.element.find(".e-cont1").hasClass("collapsed")?this._splitIcon&&this._splitIcon.find(".e-icon").hasClass("e-arrow-sans-left")&&this._splitIcon.find(".e-icon").addClass("e-arrow-sans-right").removeClass("e-arrow-sans-left"):this._splitIcon&&this._splitIcon.find(".e-icon").hasClass("e-arrow-sans-right")&&this._splitIcon.find(".e-icon").addClass("e-arrow-sans-left").removeClass("e-arrow-sans-right");this._reSizeHandler(n)},_createSplitPane:function(){var f=this,i=t.buildTag("div"),n=t.buildTag("div"),e,u;this._splittag=t.buildTag("div#"+this._ExplorerId+"_splitter");i.addClass("e-cont1");n.addClass("e-cont2");this.model.enableRTL?this._splittag.append(n,i):this._splittag.append(i,n);e=this.model.enableRTL?[{},{paneSize:this._isMobileOrTab?"150px":"25%"}]:[{paneSize:this._isMobileOrTab?"150px":"25%"},{}];this.element.append(this._splittag);this._splitObj=this._splittag.ejSplitter({enableAutoResize:!0,animationSpeed:50,width:"100%",cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,allowKeyboardNavigation:this.model.allowKeyboardNavigation,height:this.element.height()-(this._toolBarItems?this._toolBarItems.outerHeight():0),properties:e,expandCollapse:function(n){f._onEpand(n)},resize:function(n){f._reSizeHandler(n)}}).data("ejSplitter");var r=this._splitObj.element.find(".e-splitbar"),o=r.css("border-width"),s=r.css("width");r.css({width:"0px","border-width":"0px"});this._splitObj.refresh();r.css({width:s,"border-width":o});this._renderSplitIcon();u=t.buildTag("div.e-tree-wrapper");i.append(u);this._treetag=t.buildTag("div#"+this._ExplorerId+"_treeView");u.append(this._treetag);this._gridtag=t.buildTag("div#"+this._ExplorerId+"_grid");n.append(this._gridtag);this._tileViewWrapper=t.buildTag("div.e-tile-wrapper#"+this._ExplorerId+"_tileWrapper","","",{tabindex:0});this.model.layout=="tile"&&this._tileViewWrapper.addClass("e-tileInfo-view");n.append(this._tileViewWrapper);this._tileViewWrapper.append("<div class='e-tile-content' > <\/div>");this._tileContent=this._tileViewWrapper.find(".e-tile-content");this._tileView=t.buildTag("ul#"+this._ExplorerId+"_tileView");this._tileContent.append(this._tileView);this._statusbar=t.buildTag("div","","",{tabindex:0});this._statusbar.insertAfter(this._tileView);n.append(this._statusbar);this.model.showFooter&&this._createStatusBar();this._waitingPopup=this._splittag.find(".e-cont2").ejWaitingPopup({showOnInit:!1,cssClass:this.model.cssClass}).data("ejWaitingPopup");this._showHideSplitBar(!1);this._showHideContextMenu();this.model.layout=="grid"?this._tileContent.parent().hide():this._gridtag.hide();this._createUploadBox()},_selectedFolder:function(n){var i,r,t,e;this._isClicked=!1;var o=n.replace(this._initPath,""),u=this._treeObj.getSelectedNode(),f=o.split("/");for(o&&this._treeObj.selectNode(this._treeObj.element.find("li:first")),i=0;i<f.length;i++)if(f[i]!="")for(u=this._treeObj.getSelectedNode(),this._treeObj.isExpanded(u)||this._treeObj&&this._treeObj.expandNode(u),r=u.find("ul:first>li").find("div:first .e-text"),t=0;t<r.length;t++)r[t].text==f[i]&&(e=f.filter(function(n){return n!=""}),e[e.length-1]==r[t].text&&(this._isClicked=!0),this._treeObj.selectNode(r[t].parentNode.parentNode));this._isClicked=!0},_setSelectedItems:function(t){var f,o,r,u,i,e,s;if(this._suggestionItems.length&&(f=t,t=this._selectedItems),typeof t=="string"&&(t=[t]),this._removeOldSelectionDetails(),this.model.layout=="grid"){for(this._gridObj.clearSelection(),o=this._gridObj.multiSelectCtrlRequest,this._gridObj.multiSelectCtrlRequest=!0,r=this._gridtag.find(".e-gridcontent tr"),u=0;u<t.length;u++)for(r=n("#"+this._ExplorerId+" .e-gridcontent td:contains("+(f?f[u]:t[u])+")"),i=0;i<r.length;i++)if(this._suggestionItems.length?this._originalPath+t[u]==n(r[i]).closest("tr").attr("data-parent-path")+n(r[i]).text():t[u]==n(r[i]).text()){this._gridObj.selectRows(n(r[i]).closest("tr").index());break}this._recordClick();this._gridObj.multiSelectCtrlRequest=o}else for(this.items.removeClass("e-active").attr("aria-selected",!1),r=this._tileView.find(".e-tilenode"),u=0;u<t.length;u++)for(i=0;i<r.length;i++)if(e=this.model.layout=="tile"?n(r[i]).find(".e-file-name").text():n(r[i]).text(),this._suggestionItems.length?this._originalPath+t[u]==n(r[i]).attr("data-parent-path")+e:t[u]==e){s={keyCode:91,ctrlKey:!0,currentTarget:r[i],target:r[i]};this._upDatePathFromTileView(s);break}},_refreshTreeScroller:function(){t.isNullOrUndefined(this.element)||(this.model.enableRTL&&(this._treeScroll.model.scrollLeft=0),this._treeScroll&&this._treeScroll.refresh())},_createStatusBar:function(){var i,n;this._statusbar.addClass("e-statusbar");this._itemStatus=t.buildTag("div.e-itemStaus");this._selectedItemsTag=t.buildTag("div.e-itemStaus e-selected-items");this._switchBtn=t.buildTag("div.e-switchView");this._statusbar.append(this._switchBtn,this._itemStatus,this._selectedItemsTag);this.model.enableResize&&(this._resizeItem=t.buildTag("div.e-icon e-fe-resize e-resize-handle"),this._resizeItem.insertBefore(this._switchBtn));i=this._splittag.find(".e-cont2").outerHeight()-this._statusbar.outerHeight();this._gridtag.height(i);n=t.buildTag("button.e-switchGridView#"+this._ExplorerId+"_switchGridView","",{},{title:this._getLocalizedLabels("Grid"),tabindex:0});this._switchBtn.append(n);n.ejButton({type:"button",size:"normal",contentType:"imageonly",prefixIcon:"e-icon e-fe-grid"});n=t.buildTag("button.e-swithListView#"+this._ExplorerId+"_swithListView","",{},{title:this._getLocalizedLabels("LargeIcons"),tabindex:0});this._switchBtn.append(n);n.ejButton({type:"button",size:"normal",contentType:"imageonly",prefixIcon:"e-icon e-fe-largeicons"});this.model.layout=="grid"&&this._statusbar.find(".e-switchGridView").addClass("e-active");this.model.layout=="largeicons"&&this._statusbar.find(".e-swithListView").addClass("e-active");this._statusBarEvents("_off");this._statusBarEvents("_on")},_statusBarEvents:function(n){this[n](this._statusbar,"focus",this._focusStatusBar);this[n](this._statusbar.find("button"),"focus",this._focusStatusBarButton);this[n](this._statusbar.find("button"),"blur",this._blurStatusBarButton);this[n](this._statusbar,"blur",this._blurStatusBar);this.model.allowDragAndDrop&&this[n](this._statusbar,"dragover",this._preventDropOption)},_focusStatusBar:function(){this._statusbar.hasClass("e-focus")||(this._statusbar.addClass("e-focus"),this._itemList=this._switchBtn.find("button"),this._on(this._statusbar,"keydown",this._OnKeyDown),this._hidePopup())},_focusStatusBarButton:function(){this._on(this._statusbar.find("button"),"keydown",this._check)},_blurStatusBarButton:function(){this._off(this._statusbar.find("button"),"keydown",this._check)},_blurStatusBar:function(){this._statusbar.removeClass("e-focus");this._off(this._statusbar,"keydown",this._OnKeyDown)},_check:function(){var n;this.model.layout==t.FileExplorer.layoutType.Grid?(this.model.layout=t.FileExplorer.layoutType.LargeIcons,n=!0):this.model.layout==t.FileExplorer.layoutType.LargeIcons&&(this.model.layout=t.FileExplorer.layoutType.Grid,n=!0);n&&this._switchLayoutView()},_refreshResizeHandler:function(){this._setMinMaxSizeInInteger();this.adjustSize();this.model.showFooter&&this.model.enableResize&&this._resizeFileExplorer()},_refreshResizeEventHandler:function(t){var i=n(t.element).parents("div.e-fileexplorer");this.model.height=n(i).outerHeight();this.model.width=n(i).outerWidth();this.element.css({height:this.model.height,width:this.model.width});this.adjustSize()},_convertPercentageToPixel:function(n,t){return Math.round(t*n/100)},_getProperValue:function(n){return n==null?null:isNaN(n)?n:n},_setMinMaxSizeInInteger:function(){var t;this._minWidth=parseInt(this.model.minWidth);this._minHeight=parseInt(this.model.minHeight);this._maxWidth=parseInt(this.model.maxWidth);this._maxHeight=parseInt(this.model.maxHeight);t=this.element.parent()[0].nodeName=="BODY"?n(window):n(this.element.parent()[0]);isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(this._minWidth=this._convertPercentageToPixel(t.outerWidth(),this._minWidth));isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(this._minHeight=this._convertPercentageToPixel(t.outerHeight(),this._minHeight));isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(this._maxWidth=this._convertPercentageToPixel(t.innerWidth(),this._maxWidth));isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(this._maxHeight=this._convertPercentageToPixel(t.innerHeight(),this._maxHeight))},_resizeFileExplorer:function(){var t=this;this.element.find("div.e-fe-resize").ejResizable({minHeight:t._minHeight,minWidth:t._minWidth,maxHeight:t._maxHeight,maxWidth:t._maxWidth,resizeStart:function(n){t._trigger("resizeStart",{event:n})},resize:function(n){t._refreshResizeEventHandler(n);t._trigger("resize",{event:n})},resizeStop:function(n){t._refreshResizeEventHandler(n);t._trigger("resizeStop",{event:n})},helper:function(){return n(t.element)}})},_showHideSplitBar:function(n){this._splittag.show();this._splitObj.model.properties[1].paneSize==0?(this.element.find(".e-splitbar").show(),this._splitObj.expand(1),!this._gridtag.hasClass("e-grid")&&n&&this._updateData()):this._splitObj.model.properties[0].paneSize==0&&(this.element.find(".e-splitbar").show(),this._splitObj.expand(0),this._treetag.parent(".e-tree-wrapper").css("display","block"));this.model.showNavigationPane||(this.model.enableRTL?this._splitObj.collapse(1):this._splitObj.collapse(0),this.element.find(".e-splitbar").hide(),!this._gridtag.hasClass("e-grid")&&n&&this._updateData())},_updateTreePath:function(i){var r,u,f,i;if(this._suggestionItems=[],this._toDownload=!1,this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0,this._removeBlurEffect(),this._searchbar&&this._searchbar.val(""),this._selectedTreeText=this._selectedContent=i.value,this._selectedNode=i.currentElement,r=n(this._selectedNode.parents("li.e-item")[0]),this._parentNode=r.length!=0?r:this._selectedNode,this._nodeType="Directory",this._initUpdate?this._currentPath=this._updatePath(i.currentElement,i.value):this._initUpdate=!0,this._updateOnNodeSelection&&this._updateData(),this._originalPath=this._currentPath,!this._isStateNavigation){if(!t.isNullOrUndefined(this._currentState)){for(u=this._selectedStates.length-1;u>this._currentState;u--)this._selectedStates.pop();this._toolBarItems&&this._disableToolbarItem("Forward")}this._selectedStates[this._selectedStates.length-1]!=this._originalPath&&(this._currentState=this._selectedStates.length,this._selectedStates.push(this._originalPath),this._selectedStates.length==2&&this._toolBarItems&&this._enableToolbarItem("Back"))}this._updateAccessRules(this._originalPath);this._updateToolbarItems();this._updateNewFolderTool(this._toRead&&this._toEditContents);r.length||(this._disableEditingTools(),this._toolBarItems&&this._disableToolbarItem("Copy"));this.model.selectedFolder=this._currentPath;this._updateAddressBar();this._currntNode=this._selectedNode.find("> div > .e-text");this.model.selectedItems=[];this._filteredItemsName=[];this._selectedItems=[];this._selectedTileItems=[];f=this._getFolderPath();this._isClicked&&(i={name:[i.value],names:[i.value],path:f,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(f,this._selectedContent)},this._trigger("select",i))},_modifySelectedStates:function(t,i){var r=this;n.each(r._selectedStates,function(n,u){u&&u.startsWith(t)&&(r._selectedStates[n]=i?r._selectedStates[n].replace(t,i):i)})},_onBeforeCollapse:function(){this._collapse=!0},_updatePath:function(t,i){for(var u="",r=0;r<t.parents("ul").length-1;r++)n(t.parents("ul")[r]).siblings("div").find("a").text()&&(u=n(t.parents("ul")[r]).siblings("div").find("a").text()+"/"+u);return this._initPath+u+i+"/"},_updatePathFromGrid:function(i){var s,e,a,c,f,y,h,o;this._searchbar&&n.trim(this._searchbar.val())||(this._suggestionItems=[]);this.model.showCheckbox&&this._changeCheckState&&(this.model.allowMultiSelection||this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({checked:!1}),n(i.target).closest(".e-chkbox-wrap").length&&this._checkChange(i.row),(i.target&&n(i.target).closest(".e-chkbox-wrap").length==0||t.isNullOrUndefined(i.target))&&this._recordClick());s=this;e=n(i.target).closest("td.e-rowcell");this._addFocus(this._gridtag.find(".e-gridcontent"));c=!0;this._toDownload=this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0;this._isTreeNode=!1;this._selectedItems=[];var l=0,u=this._gridtag.ejGrid("getSelectedRecords"),v=n.inArray(r,u);for(v>-1&&u.splice(v,1),f=0;f<u.length;f++)this._suggestionItems&&this._suggestionItems.length?(h=u[f].filterPath.replace(this._originalPath,"")+u[f].name,this._selectedItems.push(h)):this._selectedItems.push(u[f].name),l+=u[f].sizeInByte,u[f].isFile||(c=!1,this._toDownload=!1),this._updateAccessValue(u[f]);this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath);n.each(s._suggestionItems.length>0?s._suggestionItems:s._fileExplorer[s._originalPath],function(n,t){t.name!=i.data.name||t.isFile||(a=!0)});a?(this._nodeType="Directory",e.hasClass("e-active")&&this._updateNode(i.data.name)):this._nodeType="File";y=this._nodeType;this._currntNode=e[0]!=null&&e.parent("tr");this._selectedContent=this._selectedItems[this._selectedItems.length-1];!e.hasClass("e-active")&&u.length>0&&(this._selectedContent=this._selectedItems[this._selectedItems.length-1],this._nodeType=u[u.length-1].isFile?"File":"Directory",this._nodeType=="Directory"&&this._updateNode(this._selectedContent));this._selectedItemsTag&&this._selectedItemsTag.html((this._selectedItems.length>0?this._selectedItems.length+" "+(this._selectedItems.length>1?this._getLocalizedLabels("Items"):this._getLocalizedLabels("Item"))+" "+this._getLocalizedLabels("Selected"):"")+(l?c?" "+this._bytesToSize(l):"":""));this._setFilteredItemsName();this.model.selectedItems=this._filteredItemsName;o={name:this._selectedItems,names:this._selectedItems,path:this.model.selectedFolder,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName)};this._urlTag&&this._urlTag.find("input").val(o.path);this._nameTag&&this._nameTag.find("input").val(o.name);this._updateSelectionDetails(this._nodeType);this._isClicked&&(!i.target||e&&e.hasClass("e-active")?this._trigger("select",o):(h=this._suggestionItems&&this._suggestionItems.length?i.data.filterPath.replace(this._originalPath,"")+i.data.name:i.data.name,o={name:h,names:[h],path:this.model.selectedFolder,nodeType:y,unselectedItem:i.data,unselectedItems:[i.data]},this._trigger("unselect",o)))},_enableEditingTools:function(){var t,n;if(!this._editingToolsState&&this._toolBarItems){for(t=["Rename","Delete","Cut"],n=0;n<t.length;n++)this._enableToolbarItem(t[n]);this._editingToolsState=!0}},_enableToolbarItem:function(n){if(this._restrictedToolbarOptions.indexOf(n)<0){var t=this._ExplorerId+n.replace(/ /g,"");this._toolBarObj&&this._toolBarObj.itemsContainer.find("li#"+t).hasClass("e-disable")&&this._toolBarObj.enableItemByID(t)}},_disableToolbarItem:function(n){var t=this._ExplorerId+n.replace(/ /g,"");this._toolBarObj&&!this._toolBarObj.itemsContainer.find("li#"+t).hasClass("e-disable")&&this._toolBarObj.disableItemByID(t)},_disableEditingTools:function(){var t,n;if(this._toolBarItems){for(t=["Rename","Delete","Cut"],n=0;n<t.length;n++)this._disableToolbarItem(t[n]);this._editingToolsState=!1}},_clearTileCheckBoxSelection:function(){this.model.showCheckbox&&this._tileView.find(".e-tile-checkbox ").ejCheckBox({checked:!1})},_upDatePathFromTileView:function(t){var b=n(t.target),v,l,s,a,u,y,f,e,o,h,c,w,r,i;if(t.pointerType=="touch"&&this._customPop!=null&&this.model.allowMultiSelection?(this._customPop.is(":visible")||this._customPop.show(),this._customPop.is(":visible")&&!this._customPop.find(".e-rowselect").hasClass("e-spanclicked")?(v=b.offset(),this._customPop.offset({left:v.left-40,top:v.top-40})):t.ctrlKey=!0):this._hidePopup(),this._searchbar&&n.trim(this._searchbar.val())||(this._suggestionItems=[]),t.innerEvent||(this._lastItemIndex=n(t.currentTarget).index()),this._addFocus(this._tileViewWrapper),this._isTreeNode=!1,l=this,this.model.showCheckbox&&(s=n(t.target).closest(".e-tilenode").find(".e-tile-checkbox").data("ejCheckBox"),n(t.target).hasClass("e-chk-image")&&(t.ctrlKey=this.model.showCheckbox)),t.shiftKey){for(this._selectItems=[],this._startNode||(this._startNode=this._currntNode),h=n(t.currentTarget).index(),c=this._startNode.index(),h>c&&(w=h,h=c,c=w),r=this._tileContent.find(".e-tilenode"),r.removeClass("e-active").attr("aria-selected",!1),i=h;i<=c;i++)this._selectItems.push(n(r.get(i)).find(".e-file-name").text());this._setSelectedItems(this._selectItems)}else{if(a=[],t.ctrlKey&&this.model.allowMultiSelection||(this._sizeInByte=0,this._selectedItems=[],this._selectedTileItems=[],n(t.currentTarget).siblings().removeClass("e-active").attr("aria-selected",!1),n(t.currentTarget).removeClass("e-active").attr("aria-selected",!1),this._clearTileCheckBoxSelection(),this._unselectEvent()),n(t.currentTarget).hasClass("e-active")?(n(t.currentTarget).removeClass("e-active").attr("aria-selected",!1),s&&s.option("checked",!1)):(n(t.currentTarget).addClass("e-active").attr("aria-selected",!0),s&&s.option("checked",!0)),u="File",y=!0,this._toDownload=this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0,f=n(t.currentTarget).find(".e-file-name").text(),this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath),r=this._suggestionItems.length?this._suggestionItems:this._fileExplorer[this._originalPath],r)for(i=0;i<r.length;i++)if(r[i].name==f){n(t.currentTarget).hasClass("e-active")?(this._sizeInByte+=r[i].sizeInByte,this._selectedTileItems.push(r[i])):t.ctrlKey&&(this._sizeInByte-=r[i].sizeInByte,e=n.inArray(r[i],this._selectedTileItems),e>-1&&(a.push(this._selectedTileItems[e]),this._selectedTileItems.splice(e,1)));break}if(n.each(this._selectedTileItems,function(n,t){t.isFile||(l._update=!1,y=!1,l._toDownload=!1);l._updateAccessValue(t)}),n(t.currentTarget).find(".e-fe-folder").length&&(u="Directory",n(t.currentTarget).hasClass("e-active")&&this._updateNode(f)),this._currntNode=n(t.currentTarget),this._currntNode.attr("data-parent-path")&&(f=this._currntNode.attr("data-parent-path").replace(this._originalPath,"")+f),this._selectedContent=f,n(t.currentTarget).hasClass("e-active"))this._selectedItems.push(this._selectedContent);else{var e=n.inArray(this._selectedContent,this._selectedItems),p=this._selectedContent,k=u;e>-1&&this._selectedItems.splice(e,1);this._selectedTileItems.length>0&&(this._selectedContent=this._selectedItems[this._selectedItems.length-1],u=this._selectedTileItems[this._selectedTileItems.length-1].type,u=="Directory"&&this._updateNode(this._selectedContent))}this._startNode&&this._selectItems.length!=0&&this._selectItems.length!=this._selectedItems.length||((!this._selectItems||this._selectItems.length<=0)&&(this._startNode=null),this._selectedItemsTag&&this._selectedItemsTag.html((this._selectedItems.length>0?this._selectedItems.length+" "+(this._selectedItems.length>1?this._getLocalizedLabels("Items"):this._getLocalizedLabels("Item"))+" "+this._getLocalizedLabels("Selected"):"")+(this._sizeInByte?y?" "+this._bytesToSize(this._sizeInByte):"":"")),this._nodeType=u,this._setFilteredItemsName(),this.model.selectedItems=this._filteredItemsName,o={name:this._selectedItems,names:this._selectedItems,path:this.model.selectedFolder,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName)},this._urlTag&&this._urlTag.find("input").val(o.url),this._nameTag&&this._nameTag.find("input").val(o.name),this._updateSelectionDetails(this._nodeType),this._isClicked&&(n(t.currentTarget).hasClass("e-active")?this._trigger("select",o):(o={name:p,names:[p],path:this.model.selectedFolder,nodeType:k,unselectedItem:a[0],unselectedItems:a},this._trigger("unselect",o))),this._selectItems=[])}},_setFilteredItemsName:function(){var t,n;for(this._filteredItemsName=[],t=0;t<this._selectedItems.length;t++)n=this._selectedItems[t].split("/"),this._filteredItemsName.push(n[n.length-1]?n[n.length-1]:n[n.length-2])},_getOriginalName:function(n){var t=n.split("/");return t[t.length-1]?t[t.length-1]:t[t.length-2]},_updateNode:function(n){this._currentPath+=n+"/"},_getFileURL:function(){return this._nodeType=="File"?(/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(this._selectedContent)?(this._widthTag&&this._widthTag.show().removeClass("e-hide"),this._heightTag&&this._heightTag.show().removeClass("e-hide")):(this._widthTag&&this._widthTag.hide().addClass("e-hide"),this._heightTag&&this._heightTag.hide().addClass("e-hide")),this._currentPath.replace("~","..")+this._selectedContent):""},_updateData:function(){var n=this._fileExplorer[this._currentPath],t;if(this._selectedItemsTag&&this._selectedItemsTag.html(""),n&&!this._update){this._itemStatus&&this._itemStatus.html(n.length+" "+(n.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")));var i=this.model.gridSettings.columns[0];this._changeActiveSortedoption(i.headerText,!0);this._sorting(i.field,!0,n);t=this._sorteditems;this.model.layout=="grid"?this._renderGridView(t):this._renderTileView(t)}else this._read()},_addChild:function(t,i){var e=[],r,o,u,f;if(t)for(r=0;r<t.length;r++)t[r].isFile||(t[r].id=t[r].name,t[r].spriteCssClass=t[r].permission&&!t[r].permission.Read?"e-fe-icon e-fe-folder e-fe-lock":"e-fe-icon e-fe-folder",e.push(t[r]));this._nodeExpanded=!0;o=i?n(i).closest("li.e-item"):this._treeObj.getSelectedNode();e.length&&this._treeObj.addNode(e,o);u=o.find(".e-load");u&&(u.hasClass("e-plus")||u.hasClass("e-minus")?u.removeClass("e-load"):u.removeClass("e-icon e-load"));this._nodeExpanded=!1;this._treetag.find("li").removeAttr("tabindex");f=this._treetag.find("li div a").not(".e-js");f.length&&this.model.allowDragAndDrop&&(this._drag(f),f.addClass("e-file-draggable"))},_createContextMenuTag:function(i,r,u){var e=n("body").find("#"+r.id+"ContextMenu"),f=e.length?e:t.buildTag("ul.fe-context-menu #"+r.id+"ContextMenu");return f.ejMenu({menuType:t.MenuType.ContextMenu,enableSeparator:!0,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,contextMenuTarget:r.targetId,beforeOpen:u.beforeOpen,open:u.open,close:u.close,click:u.click,fields:{dataSource:i,id:"id",text:"text",htmlAttribute:"htmlAttr",spriteCssClass:"sprite"}}),f.hide(),f},_beforeOpenContextMenu:function(t){if(n(t.target).hasClass("e-text")){if(this._menuNode=n(t.target).closest("li.e-item"),this._treeObj&&this._treeObj.element.find(".e-node-focus").removeClass("e-node-focus"),this._menuNode.find("> div > .e-text:first").addClass("e-node-focus"),t.dataSource=this._treeMenuOptions.slice(),t.contextMenu="navbar",t.element=this._treeMenuObj.element,this._trigger("menuBeforeOpen",t))return!1;JSON.stringify(this._treeMenuObj.model.fields.dataSource)!=JSON.stringify(this._treeMenuOptions)&&this._treeMenuObj.option("fields",{dataSource:t.dataSource});for(var i=0;i<this._restrictedMenuOption.length;i++)this._treeMenuObj&&this._treeMenuObj.disableItem(this._restrictedMenuOption[i]);this._toRead&&this._toEdit?this._enableEditingMenus():this._disableEditingMenus();this._toRead&&this._toCopy?this._restrictedMenuOption.indexOf(this._menuCopy)<0&&this._treeMenuObj.enableItem(this._menuCopy):this._treeMenuObj.disableItem(this._menuCopy);this._toRead?this._restrictedMenuOption.indexOf(this._menuOpen)<0&&this._treeMenuObj.enableItem(this._menuOpen):this._treeMenuObj.disableItem(this._menuOpen);this._toRead&&this._toEditContents?this._restrictedMenuOption.indexOf(this._menuNewFolder)<0&&this._treeMenuObj.enableItem(this._menuNewFolder):this._treeMenuObj.disableItem(this._menuNewFolder);this._toRead&&this._toUpload?this._restrictedMenuOption.indexOf(this._menuUpload)<0&&this._treeMenuObj.enableItem(this._menuUpload):this._treeMenuObj.disableItem(this._menuUpload);n(t.target).parents("li.e-item:first").attr("id")==1&&this._disableEditingMenus()}else t.cancel=!0},_beforeOpenTileContextMenu:function(t){if(n(t.target).closest("th.e-headercell").hasClass("e-col-check")&&this._headCheckObj.wrapper.click(),n(t.target).hasClass("e-scrollbar")||n(t.target).parents().hasClass("e-scrollbar")||n(t.target).closest("th.e-headercell").hasClass("e-col-check")){t.cancel=!0;return}if(!n(t.target).hasClass("e-rowcell")&&!n(t.target).closest("td.e-rowcell").hasClass("e-col-check")&&n(t.target).closest("td.e-rowcell").length>0&&!n(t.target).closest("td.e-rowcell").hasClass("e-active")&&t.events&&(t.events.button==2||t.events.which==3)?this._updateGridSelection(t):(n(t.target).hasClass("e-file-info")||n(t.target).hasClass("e-thumb-image")||n(t.target).closest(".e-thumb-image").length>0||n(t.target).closest(".e-tilenode").length>0)&&n(t.target).closest(".e-chkbox-wrap").length==0&&!n(t.target).closest(".e-tilenode").hasClass("e-active")&&this._updateTileSelection(t),n(t.target).is(".e-tilenode.e-active")||n(t.target).closest(".e-tilenode").hasClass("e-active")||n(t.target).closest("td.e-rowcell").is(".e-active")||(t.events.ctrlKey||t.events.shiftKey||n(t.target).closest("td.e-rowcell").hasClass("e-col-check")||n(t.target).closest(".e-chkbox-wrap").length>0)&&(n(this.items).hasClass("e-active")||n(this.gridItems).find("td").hasClass("e-active"))?(t.dataSource=this._fileMenuOptions.slice(),t.contextMenu="files",t.element=this._viewMenuObj.element):(n(t.events.currentTarget).hasClass("e-grid")&&(n(t.target).hasClass("e-gridcontent")||n(t.target).hasClass("e-content")||n(t.target).hasClass("e-table")||!n(t.target).is(".e-rowcell.e-active"))&&(this._gridObj.clearSelection(),this.model.showCheckbox&&(this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1}))),n(t.events.currentTarget).hasClass("e-tile-wrapper")&&(n(t.target).hasClass("e-tile-wrapper")||n(t.target).hasClass("e-tile-content")||n(t.target).hasClass("e-tileview")||!(n(t.target).is(".e-tilenode.e-active")||n(t.target).parent(".e-tilenode").hasClass("e-active")))&&(this.model.showCheckbox&&this._clearTileCheckBoxSelection(),this.items.hasClass("e-active")&&this.items.removeClass("e-active").attr("aria-selected",!1)),this._updateCurrentPathPermission(),t.dataSource=this._cwdMenuOptions.slice(),t.contextMenu="cwd",t.element=this._viewMenuObj.element),this._trigger("menuBeforeOpen",t))return!1;JSON.stringify(this._viewMenuObj.model.fields.dataSource)!=JSON.stringify(t.dataSource)&&this._viewMenuObj.option("fields",{dataSource:t.dataSource});for(var i=0;i<this._restrictedMenuOption.length;i++)this._viewMenuObj&&this._viewMenuObj.disableItem(this._restrictedMenuOption[i]);this._toRead&&(/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(this.model.selectedItems)||this._nodeType!="File")?this._restrictedMenuOption.indexOf(this._menuOpen)<0&&this._viewMenuObj.enableItem("Open"):this._viewMenuObj&&this._viewMenuObj.disableItem("Open");this._option&&this._toRead||this._viewMenuObj.disableItem(this._menuPaste);this._isupdate?this._restrictedMenuOption.indexOf(this._menuDownload)<0&&this._viewMenuObj.enableItem(this._menuDownload):this._viewMenuObj.disableItem(this._menuDownload);this._searchbar&&n.trim(this._searchbar.val())?this._restrictedMenuOption.indexOf(this._menuOpenFolderLocation)<0&&this._viewMenuObj.enableItem(this._menuOpenFolderLocation):this._viewMenuObj.disableItem(this._menuOpenFolderLocation);this._toRead&&this._toDownload?this._restrictedMenuOption.indexOf(this._menuDownload)<0&&this._viewMenuObj.enableItem(this._menuDownload):this._viewMenuObj.disableItem(this._menuDownload);this._toRead&&this._toUpload?this._restrictedMenuOption.indexOf(this._menuUpload)<0&&this._viewMenuObj.enableItem(this._menuUpload):this._viewMenuObj.disableItem(this._menuUpload);this._toRead&&this._toEdit?this._enableEditingMenus():this._disableEditingMenus();this._toRead&&this._toCopy?this._restrictedMenuOption.indexOf(this._menuCopy)<0&&this._viewMenuObj.enableItem(this._menuCopy):this._viewMenuObj.disableItem(this._menuCopy);this._hasEditContentsPermission(this._originalPath)?this._restrictedMenuOption.indexOf(this._menuNewFolder)<0&&this._viewMenuObj.enableItem(this._menuNewFolder):this._viewMenuObj.disableItem(this._menuNewFolder)},_contextMenuOpen:function(n){if(n.contextMenu=n.model.contextMenuTarget==this._ExplorerId+"_treeView"?"navbar":this.model.selectedItems.length>0?"files":"cwd",n.element=n.contextMenu=="navbar"?this._treeMenuObj.element:this._viewMenuObj.element,n.contextMenu=="cwd")var t=this.model.gridSettings.columns.length;for(i=0;i<t;i++)this._prevsortingoption==this.model.gridSettings.columns[i].field&&this._changeActiveSortedoption(this.model.gridSettings.columns[i].headerText,!1,!0);this._trigger("menuOpen",n)},_removeOldSelectionDetails:function(n){this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath);this._sizeInByte=0;this._selectedItems=[];this._selectedTileItems=[];this.model.selectedItems=[];this._selectedContent=this._selectedTreeText;this._nodeType=n?n:"Directory";this._selectedItemsTag&&this._selectedItemsTag.html("");this._toolBarItems&&this._disableToolbarItem("Download");this._viewMenuObj&&this._viewMenuObj.disableItem(this._menuDownload);this._disableEditingTools()},_contextMenuClick:function(n){this._treeObj.selectNode(this._menuNode);this._fileContextMenuClick(n)},_fileContextMenuClick:function(n){var u,f,i,r;if(this.model.ajaxAction!=""&&this._currentPath!=""){if(n.contextMenu=n.model.contextMenuTarget==this._ExplorerId+"_treeView"?"navbar":this.model.selectedItems.length>0?"files":"cwd",(t.isNullOrUndefined(n.selectedItem)||n.selectedItem.attr("id")!=this._ExplorerId+"_cwd_SortBy")&&(t.isNullOrUndefined(n.element)||n.element.parentElement.parentElement.id!=this._ExplorerId+"_cwd_SortBy"))switch(n.text){case this._menuOpen:this._openAction();break;case this._menuNewFolder:this._createNewFolder();break;case this._menuDelete:this._deleteFolder();break;case this._menuRefresh:this.refresh();break;case this._menuRename:this._renameFolder();break;case this._menuUpload:this.element.find(".e-uploadinput").click();break;case this._menuDownload:this._downloadFile();break;case this._menuCut:this._copyMoveNode("move");break;case this._menuCopy:this._copyMoveNode("copy");break;case this._menuPaste:this._cut_copy();break;case this._menuGetinfo:this._getDetails();break;case this._menuOpenFolderLocation:this._setFilteredItemsName();u=this.model.selectedItems;this._selectedFolder(this._originalPath+this._selectedContent.replace(this._filteredItemsName,""));this._setSelectedItems(u);break;case n.text:f=this.model.contextMenuSettings.customMenuFields;r=this._getCustomItem(f,n.ID);r&&(i=r.action);typeof i=="string"&&(i=t.util.getObject(i,window));i&&i(n)}else this._changeActiveSortedoption(n.text),this._sorting(this._prevsortingoption,this._prevsorting),this._sortingActioncomplete();this._trigger("menuClick",n)}},_createNewFolder:function(){var i=this,r="",c=this._getLocalizedLabels("NewFolderAlert"),e=t.buildTag("div.e-get-name"),l=t.buildTag("div.e-fe-dialog-label",c),u=t.buildTag("input.e-fe-dialog-text e-ejinputtext e-textbox","","",{type:"text"}),o=t.buildTag("div.e-fe-dialog-label e-error-msg");u.val("New folder");var s=t.buildTag("div.e-fe-dialog-btn"),f=t.buildTag("button.e-fe-btn-ok ",this._getLocalizedLabels("OkButton")),h=t.buildTag("button.e-fe-btn-cancel ",this._getLocalizedLabels("CancelButton"));f.ejButton({type:"button",cssClass:"e-flat",click:function(){var f,e,l;if(i._removeDialog(i._newFolderDialogObj),r=u.val(),n.trim(r)||(r="New folder"),i._fileExplorer[i._currentPath]||i._getFileDetails(i._currentPath),f=i._fileExplorer[i._currentPath],f.length)for(e=0;e<f.length;e++)if(f[e].isFile||f[e].name!=r)e==f.length-1&&r&&i._createFolder(r);else{var s=t.buildTag("div.e-get-name"),a=t.buildTag("div.e-fe-dialog-label",String.format(i._getLocalizedLabels("ErrorOnFolderCreation"),r)),h=t.buildTag("div.e-fe-dialog-btn"),o=t.buildTag("button.e-fe-btn-ok ",i._getLocalizedLabels("YesButton")),c=t.buildTag("button.e-fe-btn-cancel ",i._getLocalizedLabels("NoButton"));o.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});c.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj);i._createFolder(i._getDuplicateName(f,"New folder"))}});h.append(o,c);n(s).append(a,h);l=function(){o.focus()};i._alertDialog=i._createDialog(s,{width:400,height:"auto",title:i._getLocalizedLabels("Error"),open:l});i._alertDialogObj=i._alertDialog.data("ejDialog");break}else r&&i._createFolder(r)}});h.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._newFolderDialogObj)}});s.append(f,h);n(e).append(l,u,o,s);this._newFolderDialog=this._createDialog(e,{width:350,height:"auto",open:function(){i._openInputDialog(u,f,o,this)},title:this._getLocalizedLabels("NewFolder")});this._newFolderDialogObj=this._newFolderDialog.data("ejDialog")},_openInputDialog:function(n,t,i,r){var u=this;n.focus();this._isDevice||n.select();(this._isMobileOrTab||this._isDevice)&&r.option("position",{Y:"20%"});n.keyup(function(n){var i=u._getKeyCode(n);i==13&&t.click()});n.keypress(function(n){var t=u._getKeyCode(n);return/[/\\|*?"<>:]/.test(String.fromCharCode(t))?(i.html(u._getLocalizedLabels("InvalidFileName")),!1):!0});n.keydown(function(){i.html("")})},_deleteFolder:function(){var i,f;this._alertWindow=t.buildTag("div#e-fe_deleteAlert");i=this._selectedItems.length>1?String.format(this._getLocalizedLabels("DeleteMultipleFolder"),this._selectedItems.length):this._getLocalizedLabels("DeleteFolder")+this._selectedContent+"?";var e=t.buildTag("div.e-fe-dialog-label",i),r=t.buildTag("div.e-fe-dialog-btn"),n=t.buildTag("button.e-fe-btn-ok",this._getLocalizedLabels("OkButton")),u=t.buildTag("button.e-fe-btn-cancel",this._getLocalizedLabels("CancelButton"));r.append(n,u);this._alertWindow.append(e,r);proxy=this;n.ejButton({type:"button",cssClass:"e-flat",click:function(){proxy._removeDialog(proxy._alertWindowObj);proxy._ajax_folderPath=proxy._nodeType=="Directory"?proxy._getFolderPath():proxy._currentPath;proxy._deletion(proxy._selectedItems.length>1?proxy._selectedItems:proxy._selectedContent,proxy._ajax_folderPath);proxy._disableEditingTools();proxy._disableToolbarItem("Copy")}});u.ejButton({cssClass:"e-flat",type:"button",click:function(){proxy._removeDialog(proxy._alertWindowObj)}});f=function(){n.focus()};this._alertWindow=this._createDialog(this._alertWindow,{width:350,height:"auto",title:this._getLocalizedLabels("Delete"),open:f});this._alertWindowObj=this._alertWindow.data("ejDialog")},_getFileDetails:function(i,u,f,e){var o=this,s={data:{ActionType:"Read",Path:i,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(i),u?u.text():this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(r){if(r=r.hasOwnProperty("d")?r.d:r,!t.isNullOrUndefined(r.error)){o._showErrorDialog(r.error);return}for(var s=0;s<r.files.length;s++)r.files[s].sizeInByte=r.files[s].size,r.files[s].size=r.files[s].size?o._bytesToSize(r.files[s].size):"",r.files[s].cssClass=o._getCssClass(r.files[s]);o._feParent[i]=r.cwd;o._fileExplorer[i]=r.files;u&&o._addChild(o._fileExplorer[i],n(u));f&&(o._sorting(o._prevsortingoption,o._prevsorting,r.files),o.model.layout=="grid"?o._renderGridView(o._sorteditems):o._renderTileView(o._sorteditems),o._updateItemStatus(o._sorteditems));o._highlightedNodes&&!o._suggestionItems.length&&(o._setSelectedItems(o._highlightedNodes),o._highlightedNodes="");o._searchbar&&n.trim(o._searchbar.val())&&o._searchFiles(o._originalPath);e&&typeof e=="function"&&e()},successAfter:this.model.ajaxSettings.read.success};this.model.ajaxSettings.read.success=r;n.extend(!0,s,this.model.ajaxSettings.read);this._sendAjaxRequest(s)},_searchFiles:function(i){var u=this,f={data:{ActionType:"Search",SearchString:this._queryString,Path:i,CaseSensitive:this.model.filterSettings.caseSensitiveSearch,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(i),this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(n){if(n=n.hasOwnProperty("d")?n.d:n,!t.isNullOrUndefined(n.error)){u._showErrorDialog(n.error);return}for(var i=0;i<n.files.length;i++)n.files[i].sizeInByte=n.files[i].size,n.files[i].size=n.files[i].size?u._bytesToSize(n.files[i].size):"",n.files[i].cssClass=u._getCssClass(n.files[i]),n.files[i].filterPath=u._originalPath+n.files[i].filterPath.replace(/\\/g,"/");u._sorting(u._prevsortingoption,u._prevsorting,n.files);u._suggestionItems=n.files=u._sorteditems;u._suggestionItems=n.files;u.model.layout=="grid"?u._renderGridView(n.files):u._renderTileView(n.files);u._updateItemStatus(n.files);u._setSelectedItems(u._highlightedNodes);u._highlightedNodes=""},successAfter:this.model.ajaxSettings.search.success};this.model.ajaxSettings.search.success=r;n.extend(!0,f,this.model.ajaxSettings.search);this._sendAjaxRequest(f)},_getDuplicateName:function(n,t){for(var i=0,r=t;this._isNameExist(n,t);)i++,t=r.split(".")[0]+(i>0?"("+i+")":"")+(t.split(".")[1]?"."+t.split(".")[1]:"");return t},_isNameExist:function(n,t){for(var i=0;n&&i<n.length;i++)if(t==n[i].name)return!0;return!1},_renameFolder:function(){var i=this,c=this._getLocalizedLabels("RenameAlert"),e=t.buildTag("div.e-rename"),l=t.buildTag("div.e-fe-dialog-label",c),r=this._selectedContent.split(".")[0].split("/");r.indexOf("")!=-1&&r.splice(r.indexOf(""),1);var u=t.buildTag("input.e-fe-dialog-text e-ejinputtext e-textbox","","",{type:"text",value:r[r.length-1]}),o=t.buildTag("div.e-fe-dialog-label e-error-msg"),s=t.buildTag("div.e-fe-dialog-btn"),f=t.buildTag("button.e-fe-btn-ok",this._getLocalizedLabels("OkButton")),h=t.buildTag("button.e-fe-btn-cancel",this._getLocalizedLabels("CancelButton"));f.ejButton({cssClass:"e-flat",type:"button",click:function(){var f=u.val(),s=r[r.length-1],o,e,v;if(i._removeDialog(i._renameDialogObj),n.trim(f)&&f!=s)for(i._currentPath=i._nodeType=="Directory"?i._getFolderPath():i._currentPath,i._fileExplorer[i._currentPath]||i._getFileDetails(i._currentPath),o=i._fileExplorer[i._currentPath],i._ajax_person=i._selectedContent.replace(s,f),i._nodeType=="File"&&/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(i._ajax_person)&&(i._updateImages[i._currentPath+i._ajax_person]=(new Date).getTime()),e=0;e<o.length;e++)if(o[e].name==f){i._nodeType=="File"&&(f=i._getDuplicateName(i._fileExplorer[i._currentPath],f),i._ajax_person=i._selectedContent.replace(s,f));var c=t.buildTag("div.e-get-name"),y=t.buildTag("div.e-fe-dialog-label",String.format(i._getLocalizedLabels(i._nodeType=="File"?"DuplicateFileCreation":"ErrorOnFolderCreation"),f)),l=t.buildTag("div.e-fe-dialog-btn"),h=t.buildTag("button.e-fe-btn-ok ",i._getLocalizedLabels("OkButton")),a=t.buildTag("button.e-fe-btn-cancel ",i._getLocalizedLabels("CancelButton"));h.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj);i._nodeType=="File"?i._rename():(i._existingItems=[],i._getDuplicateItems(i._currentPath+i._selectedContent+"/",i._currentPath+f+"/",!0),i._existingItems.length?i._createReplaceConformationDiaolg("_rename","DuplicateAlert"):i._rename())}});a.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});l.append(h,a);n(c).append(y,l);v=function(){h.focus()};i._alertDialog=i._createDialog(c,{width:400,height:"auto",title:i._getLocalizedLabels("Error"),open:v});i._alertDialogObj=i._alertDialog.data("ejDialog");break}else e==o.length-1&&i._rename()}});h.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._renameDialogObj)}});s.append(f,h);n(e).append(l,u,o,s);this._renameDialog=this._createDialog(e,{width:350,height:"auto",open:function(){i._openInputDialog(u,f,o,this)},title:this._getLocalizedLabels("Rename")});this._renameDialogObj=this._renameDialog.data("ejDialog")},_isSelectedFile:function(n,t){for(var i=0;i<n.length;i++)if(t==n[i])return!0;return!1},_refreshItems:function(t,i,r){var e,f,u,o;if(this._treeObj){for(t=n(t),!this._treeObj.isExpanded(t)&&this._treeObj.hasChildNode(t)&&this._treeObj.expandNode(t),this._fileExplorer[i]="",e=this,n.each(e._fileExplorer,function(n){n.startsWith(i)&&(e._fileExplorer[n]="")}),f=t.find("ul:first > li"),u=0;u<f.length;u++)t.find(f[u]).length&&this._treeObj.removeNode(n(f[u]));o=t.find(".e-process");o.length&&o.removeClass("e-process");this._getFileDetails(i,t.find("> div > .e-text"),!0,r)}else this._currentPath=this.model.path,this._read()},_getDuplicateItems:function(n,t,i){var r,f,e,u;if(this._fileExplorer[t]||this._getFileDetails(t),r=this._fileExplorer[t],this._fileExplorer[n]||this._getFileDetails(n),f=this._fileExplorer[n],f&&r)for(e=0;e<f.length;e++)for(u=0;u<r.length;u++)f[e].name==r[u].name&&(i==!0||this._isSelectedFile(i,r[u].name))&&(this._existingItems[this._existingItems.length]={Name:r[u].name,Path:t+r[u].name+(r[u].isFile?"":"/"),IsReplace:!0},r[u].isFile||this._getDuplicateItems(n+f[e].name+"/",t+r[u].name+"/",!0))},_backward:function(){var i;if(this._currentState>0){var n=!0,t=0;for(this._isStateNavigation=!0,i=this._currentState,--this._currentState;this._selectedStates[this._currentState]==""||this._selectedStates[this._currentState]==this._selectedStates[i];)this._currentState?--this._currentState:n=!1;n&&this._selectedFolder(this._selectedStates[this._currentState]);this._isStateNavigation=!1;(this._currentState==t||this._selectedStates.length-2==this._currentState)&&this._toolBarItems&&this._enableToolbarItem("Forward");this._currentState==t&&this._toolBarItems&&this._disableToolbarItem("Back")}},_forward:function(){var t;if(this._currentState+1<this._selectedStates.length){var n=!0;for(this._isStateNavigation=!0,t=this._currentState,++this._currentState;this._selectedStates[this._currentState]==""||this._selectedStates[this._currentState]==this._selectedStates[t];)this._currentState<this._selectedStates.length-1?++this._currentState:n=!1;n&&this._selectedFolder(this._selectedStates[this._currentState]);this._isStateNavigation=!1;this._selectedStates.length-1==this._currentState&&this._toolBarItems&&this._disableToolbarItem("Forward");this._currentState==0&&this._toolBarItems&&this._disableToolbarItem("Back");this._currentState==1&&this._toolBarItems&&this._enableToolbarItem("Back")}},_copyMoveNode:function(n){var t,i;n=="move"&&(this.element.find(".e-blur").removeClass("e-blur"),t=this.element.find(".e-splitter .e-active"),t.length&&t.length==1?t.addClass("e-blur"):this.element.find(".e-cont2 .e-active").addClass("e-blur"));this._copiedNodes=this._filteredItemsName;this._option=n;this._sourcePath=this._nodeType=="Directory"?this._getFolderPath():this._currentPath;this._sourceType=this._nodeType;this._fileName=this._selectedItems.length>1?this._selectedItems:this._selectedContent;this._refreshNode=this._originalPath!=this._currentPath?this._findMatchingElement(this._selectedNode.find("ul:first"),this._selectedContent):this._selectedNode;this._toolBarItems&&this._enableToolbarItem("Paste");this.model.showContextMenu&&(this._restrictedMenuOption.indexOf(this._menuPaste)<0&&this._viewMenuObj.enableItem(this._menuPaste),this._restrictedMenuOption.indexOf(this._menuPaste)<0&&this._treeMenuObj.enableItem(this._menuPaste));i={name:this._fileName,sourcePath:this._sourcePath,selectedItems:this._getSelectedItemDetails(this._sourcePath,this._fileName)};n=="move"?this._trigger("cut",i):this._trigger("copy",i)},_openAction:function(){var i,s,r,h,o,u,f,e,a,v;if(this._toRead&&(i=this,this._nodeType=="File"&&(this._selectedFile=this._selectedContent),!this._onBeforeOpen())){if(this._nodeType=="Directory")if(this._suggestionItems.length)this._selectedFolder(this._originalPath+this._selectedContent);else{for(r=this._treeObj.getSelectedNode(),h=this._selectedContent,this._treeObj.isExpanded(r)||this._treeObj&&this._treeObj.expandNode(r),o=r.find("ul:first>li").find("div:first .e-text"),this._treeObj.hasChildNode(r)||(u=this._isTreeNode==!0?this._currentPath:this._currentPath.replace(this._selectedContent+"/",""),this._isTreeNode=!1,this._addChild(this._fileExplorer[u])),f=0;f<o.length;f++)if(n(o[f]).text()==h){this._treeObj.selectNode(o[f].parentNode.parentNode);break}s=this._getSelectedItemDetails(this._getFolderPath(),h);this._selectedItems=[];this._selectedTileItems=[]}else if(this._nodeType=="File"){if(/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(this._selectedFile)){i._openDialog=t.buildTag("div.e-imageViewer","","",{id:i._ExplorerId+"_basicDialog",title:i._selectedFile});var u=i._currentPath.replace("~","..")+this._selectedFile,c=this._getImage(u,this._selectedFile,!1),l=t.buildTag("img","","",{src:c?c:u});n(i._openDialog).append(l);n(i.element).append(i._openDialog);e=new Image;e.onload=e.onabort=e.onerror=function(n){if(n){var t={path:n.target.src,element:n.target,originalArgs:n,action:"open"};i._trigger("getImage",t)}};e.src=l.attr("src");i._openDialog.ejDialog({width:450,height:350,minHeight:200,minWidth:300,maxWidth:"100%",isResponsive:i.model.isResponsive,target:i.element,closeIconTooltip:i._getLocalizedLabels("DialogCloseToolTip"),enableRTL:i.model.enableRTL,showRoundedCorner:i.model.showRoundedCorner,cssClass:i.model.cssClass,close:function(n){i._onDialogClose(n)}}).parents(".e-dialog-wrap").addClass("e-imageViewer-wrap");i._openDialog.css("height","90%");i._openDialogObj=i._openDialog.data("ejDialog")}s=i._getSelectedItemDetails(i._currentPath,i._selectedContent)}a=this._nodeType=="File"?u:this._currentPath;v={path:a,itemType:this._nodeType,selectedItems:s};this._trigger("open",v)}},_getSelectedItemDetails:function(n,t){var f,i,u,r;if(typeof t=="string"&&(t=[t]),f=[],i=this._suggestionItems&&this._suggestionItems.length?this._suggestionItems:this._fileExplorer[n],i)for(u=0;u<t.length;u++)for(r=0;r<i.length;r++)i[r].name==this._getOriginalName(t[u])&&f.push(i[r]);return f},_getDetails:function(){var e=this._nodeType=="Directory"?this._getFolderPath():this._currentPath,i=this,u=typeof this._selectedContent=="string"?[this._selectedContent]:this._selectedContent,f;u[0].endsWith("/")&&(u[0]=u[0].substring(0,u[0].length-1));f={data:{ActionType:"GetDetails",Path:e,Names:u,SelectedItems:this._getSelectedItemDetails(e,this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(u){if(u.hasOwnProperty("d")&&(u=u.d),!t.isNullOrUndefined(u.error)){i._showErrorDialog(u.error);return}var c=t.buildTag("div.e-fe-table"),o=t.buildTag("table"),e,l,s,f,h,a;n.each(u.details[0],function(u,c){e=t.buildTag("tr");l=t.buildTag("td",t.isNullOrUndefined(i._getLocalizedLabels(u))?u:i._getLocalizedLabels(u));s=t.buildTag("td");u=="Name"||u=="Location"?(f=t.buildTag("div"),h=t.buildTag("input.e-readonly","","",{style:"border:none;",type:"text",value:c,title:c,readonly:!0}),h.focus(function(){n(this).blur()}),f.append(h)):u=="Size"?(a=i._bytesToSize(c),f=t.buildTag("span",a+" ("+c+" Bytes)")):f=u=="Permission"?c!=r?t.buildTag("span",i._objToString(c),"",{style:"word-break: break-word;"}):null:t.buildTag("span",c);f!=r&&(u=="Permission"&&n(o).find("tr:last").addClass("e-border"),s.append(f),n(o).append(e),n(e).append(l,s),(u=="Name"||u=="Size")&&e.addClass("e-border"))});n(c).append(o);i._detailsDialog=i._createDialog(c,{width:500,height:"auto",title:i._getLocalizedLabels("Details")});i._detailsDialogObj=i._detailsDialog.data("ejDialog");i._detailsDialogObj.focus()},successAfter:this.model.ajaxSettings.getDetails.success};this.model.ajaxSettings.getDetails.success=r;n.extend(!0,f,this.model.ajaxSettings.getDetails);this._sendAjaxRequest(f,!0)},_objToString:function(n){var i="";for(var t in n)n.hasOwnProperty(t)&&(i+=t+": "+n[t]+", ");return i},_uploadFile:function(){proxy=this.element.find(".e-uploadbox");proxy=proxy.ejUploadbox("instance")},_getFolderPath:function(n){for(var i=n?n.split("/"):this._currentPath.split("/"),r="",t=0;t<i.length-2;t++)r+=i[t]+"/";return r},_renderToolBar:function(){this._crateToolbarTemplate();this._initToolbarItems();var t={};t.click=n.proxy(this._toolBarClick,this);t.cssClass=this.model.cssClass;t.enableRTL=this.model.enableRTL;t.enableSeparator=!0;t.isResponsive=this.model.isResponsive;t.height=t.isResponsive?"":"auto";t.cssClass=this.model.cssClass+" e-fe-toolbar "+(this._isMobileOrTab?"e-fe-mobile":"");t.enableRTL=this.model.enableRTL;this._toolBarItems.ejToolbar(t);this._toolBarObj=this._toolBarItems.ejToolbar("instance");this._isMobileOrTab&&this._toolBarObj.model.isResponsive&&this._toolBarObj._liTemplte.css("max-width",this.element.width());this._disableToolbarItem("Paste");this._disableToolbarItem("Download");this._disableToolbarItem("Back");this._disableToolbarItem("Forward");this._disableEditingTools()},_initToolbarItems:function(){this._toolBarItems.find("#"+this._ExplorerId+"Addressbar").length>0&&this._createAddressBar();this._toolBarItems.find("#"+this._ExplorerId+"Searchbar").length>0&&this._searchDetails();this._toolBarItems.find("#"+this._ExplorerId+"Layout").length>0&&this._renderLayoutDrpdwn();this._toolBarItems.find("#"+this._ExplorerId+"SortBy").length>0&&this._renderSortbyDrpdwn()},_renderSortbyDrpdwn:function(){var f,e,r,u;for(this._showSortbyDDL=t.buildTag("button#"+this._ExplorerId+"_sortby","","",{"data-role":"none",type:"button"}),f=n("<ul id="+this._ExplorerId+"_splitMenu1 class='e-fe-split-context'>"),e=this.model.gridSettings.columns.length,i=0;i<e;i++)f.append(n("<li><a class=' e-arrow-space'><span class='e-icon'><\/span>"+this.model.gridSettings.columns[i].headerText+"<\/a><\/li>"));f.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"SortBy").html(""));r={};u=this;r.height="24px";r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.targetID=this._ExplorerId+"_splitMenu1";r.contentType="imageonly";r.buttonMode="dropdown";r.itemSelected=function(n){u._changeActiveSortedoption(n.text);u._sorting(u._prevsortingoption,u._prevsorting);u._sortingActioncomplete()};r.prefixIcon="e-icon e-fe-sortby";this._showSortbyDDL.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"SortBy").addClass("e-fe-split-button"));this._showSortbyDDL.ejSplitButton(r);this._splitButtonObj1=this._showSortbyDDL.data("ejSplitButton")},_gridupdate:function(n){var i;i=this._prevsorting?"ascending":"descending";t.isNullOrUndefined(this._gridObj)||(this._gridObj.getHeaderTable().find("[ej-mappingname="+n+"]").parent().attr("aria-sort",i),this._gridObj._addSortElementToColumn(n,i))},_changeActiveSortedoption:function(r,u,f){var l,e,a,c,o,s,h;for(f==!0&&(this._prevsorting=!this._prevsorting),l=this.model.gridSettings.columns.length,a=n("#"+this._ExplorerId+"_tileViewContextMenu").find("li").length,j=0;j<a;j++)c=n("#"+this._ExplorerId+"_tileViewContextMenu").find("li")[j],c.id==this._ExplorerId+"_cwd_SortBy"&&(e=n(c).find("ul li"));for(o=n("#"+this._ExplorerId+"_splitMenu1").find("li"),n(e).find("span").removeClass("e-fe-ascending e-fe-descending"),n(o).find("span").removeClass("e-fe-ascending e-fe-descending"),i=0;i<l;i++)if(s=!t.isNullOrUndefined(e)&&e[i],h=!t.isNullOrUndefined(o)&&o[i],contextactiveElement=n(s).find("span"),toolbaractiveElement=n(h).find("span"),!t.isNullOrUndefined(s)&&n(s).text()==r||!t.isNullOrUndefined(h)&&n(h).find("a").text()==r){u?(contextactiveElement.addClass("e-fe-ascending"),toolbaractiveElement.addClass("e-fe-ascending")):this._prevsortingoption==this.model.gridSettings.columns[i].field?this._prevsorting?(contextactiveElement.addClass("e-fe-descending"),toolbaractiveElement.addClass("e-fe-descending")):(contextactiveElement.addClass("e-fe-ascending"),toolbaractiveElement.addClass("e-fe-ascending")):this._prevsorting?(contextactiveElement.addClass("e-fe-ascending"),toolbaractiveElement.addClass("e-fe-ascending")):(contextactiveElement.addClass("e-fe-descending"),toolbaractiveElement.addClass("e-fe-descending"));this._prevsortingoption=this.model.gridSettings.columns[i].field;this._prevsorting=contextactiveElement.hasClass("e-fe-ascending")||toolbaractiveElement.hasClass("e-fe-ascending")?!0:!1;break}},_sorting:function(n,i,r){var c,u,f,e,o,s,h;c=t.isNullOrUndefined(r)?this._searchbar&&this._searchbar.val()!=""?this._suggestionItems.length>=0?this._suggestionItems:this._fileExplorer[this._originalPath]:this._fileExplorer[this._originalPath]:r;u=n=="type"?"name":n=="size"?"sizeInByte":n;f=t.DataManager(c);switch(n){case"type":case"dateModified":i?(e=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortBy(u)),o=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortBy(u)),this._sorteditems=e.concat(o)):(s=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortByDesc(u)),h=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortByDesc(u)),this._sorteditems=s.concat(h));break;case"name":case"size":default:i?(e=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortBy(u)),o=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortBy(u)),this._sorteditems=e.concat(o)):(s=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortByDesc(u)),h=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortByDesc(u)),this._sorteditems=h.concat(s))}},_sortingActioncomplete:function(){switch(this.model.layout){case t.FileExplorer.layoutType.Grid:this._gridObj.option("dataSource",this._sorteditems);break;case t.FileExplorer.layoutType.LargeIcons:case t.FileExplorer.layoutType.Tile:default:this._renderTileView(this._sorteditems,!0)}t.isNullOrUndefined(this._selectedItems)||this._selectedItems.length!=1||this._setSelectedItems(this._selectedContent)},_renderLayoutDrpdwn:function(){var f,r,u;for(this._showLayoutDDL=t.buildTag("button#"+this._ExplorerId+"_layout","","",{"data-role":"none",type:"button"}),f=n("<ul id="+this._ExplorerId+"_splitMenu class='e-fe-split-context'>"),this._layoutList=["Tile","Grid","LargeIcons"],i=0;i<this._layoutList.length;i++)f.append(n("<li><a class=' e-arrow-space'><span class='e-icon e-fe-activeicon'><\/span>"+this._getLocalizedLabels(this._layoutList[i])+"<\/a><\/li>"));f.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Layout").html(""));r={};u=this;r.height="24px";r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.targetID=this._ExplorerId+"_splitMenu";r.contentType="imageonly";r.buttonMode="dropdown";r.itemSelected=function(n){switch(n.text){case u._getLocalizedLabels("LargeIcons"):u.model.layout="largeicons";break;case u._getLocalizedLabels("Tile"):u.model.layout="tile";break;case u._getLocalizedLabels("Grid"):default:u.model.layout="grid"}u._switchLayoutView()};r.prefixIcon="e-icon e-fe-"+this.model.layout;this._showLayoutDDL.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Layout").addClass("e-fe-split-button"));this._showLayoutDDL.ejSplitButton(r);this._splitButtonObj=this._showLayoutDDL.data("ejSplitButton")},_changeLayoutActive:function(i){if(this._splitButtonObj&&this._splitButtonObj.option("prefixIcon","e-icon e-fe-"+i),this._toolBarItems&&this._toolBarItems.find("#"+this._ExplorerId+"Layout").length>0){n(n("#"+this._ExplorerId+"_splitMenu").find("li span").removeClass("e-fe-activeicon"));switch(i){case t.FileExplorer.layoutType.LargeIcons:n(n("#"+this._ExplorerId+"_splitMenu").find("li")[2]).find("span").addClass("e-fe-activeicon");break;case t.FileExplorer.layoutType.Tile:n(n("#"+this._ExplorerId+"_splitMenu").find("li")[0]).find("span").addClass("e-fe-activeicon");break;case t.FileExplorer.layoutType.Grid:default:n(n("#"+this._ExplorerId+"_splitMenu").find("li")[1]).find("span").addClass("e-fe-activeicon")}}},_createUploadBox:function(){this._uploadtag=t.buildTag("div#"+this._ExplorerId+"FileUpload","",{padding:"0px",height:"0px",width:"0px"});this.element.prepend(this._uploadtag);this._renderUploadBox();this._uploadtag.find(".e-inputbtn").hide();this._uploadtag.find(".e-uploadinput").attr("tabindex",-1)},_searchDetails:function(){this._isWatermark="placeholder"in document.createElement("input");var i=this._getLocalizedLabels("Search");this._searchbar=t.buildTag("input.e-searchBar e-tool-input","",{},{id:this._ExplorerId+"_searchbar",type:"text",placeholder:i});this._searchbar.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Searchbar").html(""));t.browserInfo().name=="msie"&&t.ieClearRemover(this._searchbar[0]);this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ",i,{display:"block"}).insertAfter(this._searchbar));this._on(n("#"+this._ExplorerId+"_searchbar"),"focus",this._inputFocusin);this._on(n("#"+this._ExplorerId+"_searchbar"),"keyup",this._onSearchKeyup)},_setUploadLocalization:function(){n.each(t.FileExplorer.Locale,function(n,i){i.UploadSettings&&(t.Uploadbox.Locale[n]=i.UploadSettings)})},_getLocalizedLabels:function(n){return t.FileExplorer.Locale[this.model.locale]===r||t.FileExplorer.Locale[this.model.locale][n]===r?t.FileExplorer.Locale["en-US"][n]?t.FileExplorer.Locale["en-US"][n]:n:t.FileExplorer.Locale[this.model.locale][n]},_crateToolbarTemplate:function(){this._toolBarItems=t.buildTag("div#"+this._ExplorerId+"_toolbar").prependTo(this.element);for(var n=0;n<this.model.toolsList.length;n++)items=this.model.toolsList[n],t.isNullOrUndefined(this.model.tools[items])||(items=="customTool"?t.isNullOrUndefined(this.model.tools[items])||this._customTools(this.model.tools[items]):this.model.tools[items].length>0&&this._createToolsItems(this.model.tools[items],items))},_createToolsItems:function(i,r){var f=t.buildTag("ul#"+(this._ExplorerId+r)),e,u;for(f.addClass("e-ul-"+r),u=0;u<i.length;u++)e=n("<li id='"+(this._ExplorerId+i[u].replace(/ /g,""))+"' class='e-feItem-"+i[u]+"' title='"+this._getLocalizedLabels(i[u].replace(/ /g,""))+"' ><div class='e-fileexplorer-toolbar-icon "+i[u]+"'><\/div><\/li>"),e.appendTo(f);f.appendTo(this._toolBarItems)},_customTools:function(i){for(var e,f,u,r=0;r<i.length;r++)e=t.buildTag("ul"),f=n("<li id='"+(this._ExplorerId+i[r].name.replace(/ /g,""))+"' title='"+i[r].tooltip+"' ><div class='"+(t.isNullOrUndefined(i[r].css)?"":i[r].css)+"'><\/div><\/li>"),u=i[r].action,typeof u=="string"&&(u=t.util.getObject(u,window)),t.isNullOrUndefined(i[r].action)||this._on(f,"click",u),n(i[r].template).appendTo(f.find("div")),f.appendTo(e),e.appendTo(this._toolBarItems)},_toolBarClick:function(t){var i,r,u;if(this._hidePopup(),i=this,t.event.which&&(t.event.which==3||t.event.which==2)||t.event.button&&t.event.button==2)return!1;if(this.model.ajaxAction!=""&&this._currentPath!=""){this._lastFocusedElement=n(t.currentTarget);r=n(t.currentTarget);u=r.attr("id");switch(u){case this._ExplorerId+"Addressbar":case this._ExplorerId+"Searchbar":this._searchbar&&!this._isWatermark&&(this._searchbar.blur(function(){i._searchbar.val()||i._hiddenSpan.css("display","block")}),this._hiddenSpan.css("display","none"));t.event.type=="keyup"&&r.find("input").focus();break;case this._ExplorerId+"Download":this._downloadFile();break;case this._ExplorerId+"Upward":this._upward();break;case this._ExplorerId+"NewFolder":this._createNewFolder();break;case this._ExplorerId+"Delete":this._deleteFolder();break;case this._ExplorerId+"Rename":this._renameFolder();break;case this._ExplorerId+"Refresh":this._currentPath=this._originalPath;this._highlightedNodes=this.model.selectedItems;this._refreshItems(this._treeObj?this._treeObj.getSelectedNode():"",this._originalPath);break;case this._ExplorerId+"Back":this._backward();break;case this._ExplorerId+"Forward":this._forward();break;case this._ExplorerId+"Cut":this._copyMoveNode("move");break;case this._ExplorerId+"Copy":this._copyMoveNode("copy");break;case this._ExplorerId+"Paste":this._currentPath=this._originalPath;this._cut_copy();break;case this._ExplorerId+"Open":this._openAction();break;case this._ExplorerId+"Details":this._getDetails();break;case this._ExplorerId+"Upload":this.element.find(".e-uploadinput").click()}}},_upward:function(){this._treeObj&&this._treeObj.selectNode(this._treeObj.getSelectedNode().parent().closest("li.e-item"))},_getFilteredList:function(){if(this._suggestionItems=[],n.trim(this._queryString)){switch(this.model.filterSettings.filterType){case t.FileExplorer.filterType.StartsWith:this._queryString=this._queryString+"*";break;case t.FileExplorer.filterType.EndsWith:this._queryString="*"+this._queryString;break;case t.FileExplorer.filterType.Contains:this._queryString="*"+this._queryString+"*"}this._searchFiles(this._originalPath)}else this._suggestionItems=[],this._sorting(this._prevsortingoption,this._prevsorting,this._fileExplorer[this._originalPath]),this.model.layout=="grid"?this._renderGridView(this._sorteditems):this._renderTileView(this._sorteditems),this._updateItemStatus(this._fileExplorer[this._originalPath]);this._gridupdate(this._prevsortingoption)},_updateItemStatus:function(n){n&&this._itemStatus&&this._itemStatus.html(n.length+" "+(n.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")))},_onSearchKeyup:function(n){var t=this,n=n;clearTimeout(this._searchTimer);this._searchTimer=setTimeout(function(){t._validateKeyCode(n)},300)},_validateKeyCode:function(n){var t;switch(n.which){case 38:case 40:case 37:case 39:case 20:case 16:case 17:case 18:case 35:case 36:case 144:break;case 27:this._searchbar&&this._searchbar.val("");this._queryString="";t=this._addresstag.val();this._removeOldSelectionDetails();this._currentPath=this._currentPath.split(t)[0]+t;this._getFilteredList(this._fileExplorer[this._currentPath]);this.model.layout=="grid"?this._addFocus(this._gridtag.find(".e-gridcontent")):this._addFocus(this._tileViewWrapper);break;case 9:case 46:case 8:case 13:default:if(!this.model.filterSettings.allowSearchOnTyping&&n.which==13||this.model.filterSettings.allowSearchOnTyping){this._queryString=n.currentTarget.value;t=this._addresstag.val();this._removeOldSelectionDetails();this._currentPath=this._currentPath.split(t)[0]+t;this._getFilteredList(this._fileExplorer[this._currentPath]);break}}},_onDialogClose:function(){n("body").find("#"+this._ExplorerId+"_basicDialog_wrapper").remove();this._lastFocusedElement&&this._lastFocusedElement.focus()},_switchView:function(n){var i=!1;n.currentTarget.getAttribute("id")==this._ExplorerId+"_swithListView"?this.model.layout!=t.FileExplorer.layoutType.LargeIcons&&(this.model.layout=t.FileExplorer.layoutType.LargeIcons,i=!0):this.model.layout!=t.FileExplorer.layoutType.Grid&&(this.model.layout=t.FileExplorer.layoutType.Grid,i=!0);i&&this._switchLayoutView()},_switchLayoutView:function(n){var i=!1,r=this._sorteditems,u;this._currentPath=this._originalPath;switch(this.model.layout){case t.FileExplorer.layoutType.LargeIcons:case t.FileExplorer.layoutType.Tile:this._gridtag.hide();this._tileContent.parent().show();this._tileViewWrapper.removeClass("e-tileInfo-view");this._statusbar&&(this._statusbar.find(".e-swithListView").removeClass("e-active"),this._statusbar.find(".e-switchGridView").removeClass("e-active"));this.model.layout==t.FileExplorer.layoutType.LargeIcons?this._statusbar&&this._statusbar.find(".e-swithListView").addClass("e-active"):(this._tileViewWrapper.addClass("e-tileInfo-view"),this.items=this._tileView.find("li.e-tilenode"),this._setThumbImageHeight());this._renderTileView(r);i=!0;break;case t.FileExplorer.layoutType.Grid:default:this._tileView&&this._tileContent.parent().hide();this._gridtag.show();this._renderGridView(r);this._statusbar&&(this._statusbar.find(".e-swithListView").removeClass("e-active"),this._statusbar.find(".e-switchGridView").addClass("e-active"));i=!0}this._changeLayoutActive(this.model.layout);i&&(this._updateItemStatus(r),this._setSelectedItems(this.model.selectedItems),u={layoutType:this.model.layout,isInteraction:!n},this._trigger("layoutChange",u))},_wireEvents:function(){this._on(n("#"+this._ExplorerId+"_newFolder"),"click",this._createNewFolder);this._on(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView);this._on(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView);this._on(this.element,"keydown",this._keyDownOnInput);this._on(this._gridtag,"click",this._gridtagClick);this._on(this._tileViewWrapper,"click",this._tileViewWrapperClick);this.model.allowDragAndDrop&&this._toolBarItems&&this._on(this._toolBarItems,"dragover",this._preventDropOption)},_preventDropOption:function(n){n.preventDefault();n.stopPropagation();n.originalEvent.dataTransfer.dropEffect="none"},_onHideContextMenu:function(){this._treeObj&&this._treeObj.element.find(".e-node-focus").removeClass("e-node-focus")},_adjustSize:function(n){this._isWindowResized=n?!0:!1;this.adjustSize()},_closeDialog:function(t){this._unwireDialogEvent(t);n(t.target).closest("div.e-dialog").find(".e-dialog").ejDialog("close")},_searchPath:function(i){var o=this._getKeyCode(i),r;switch(o){case 13:this._searchbar&&this._searchbar.val("");var e=this._addresstag.val(),u=e.split("/"),f=this._treetag;for(r=0;r<u.length;r++)u[r]&&(f=this._findMatchingElement(n(f).children("ul"),u[r]),f.length?this._treetag.ejTreeView("selectNode",f):(this._setSelectedItems([u[r]]),this.model.selectedItems.length?this._openAction():(this._alertDialog=this._createDialog(t.buildTag("div.e-fe-dialog-label",String.format(this._getLocalizedLabels("ErrorPath"),e)),{width:400,height:"auto",title:this._getLocalizedLabels("Error")}),this._alertDialogObj=this._alertDialog.data("ejDialog"))));break;case 27:i.preventDefault();this._updateAddressBar();this._toolBarItems.focus()}},_addressbarFocusout:function(){this._updateAddressBar()},_createDialog:function(i,r){var u=this,f=t.buildTag("div#"+this._ExplorerId+"_basicDialog.e-fe-dialog");return n(i).css("overflow","hidden"),n(f).append(i),f.ejDialog({title:r.title?r.title:"",width:r.width,maxWidth:"100%",isResponsive:u.model.isResponsive,target:u.element,closeIconTooltip:u._getLocalizedLabels("DialogCloseToolTip"),height:r.height,enableModal:!0,showHeader:!0,enableResize:!1,enableAnimation:!1,allowKeyboardNavigation:u.model.allowKeyboardNavigation,enableRTL:u.model.enableRTL,showRoundedCorner:u.model.showRoundedCorner,cssClass:this.model.cssClass+" e-fe-dialog",open:r.open,close:function(n){u._onDialogClose(n)}}),f},_showErrorDialog:function(n){this._alertDialog=this._createDialog(t.buildTag("div.e-fe-dialog-label",n),{width:400,height:"auto",title:this._getLocalizedLabels("Error")});this._alertDialogObj=this._alertDialog.data("ejDialog")},_findMatchingElement:function(t,i){return n(t).children("li").filter(function(){if(n(this).find(".e-text:first").text()==i)return n(this)})},_getKeyCode:function(n){return n.keyCode?n.keyCode:n.which?n.which:n.charCode},_keyDownOnInput:function(i){var f,r,u,i;if(!n(i.target).hasClass("e-tool-input")&&(f=this._getKeyCode(i),this.model.allowKeyboardNavigation)&&!this._KeydownEventHandler(i))switch(f){case 49:i.shiftKey&&i.ctrlKey&&this.model.showToolbar&&(i.preventDefault(),this._addFocus(this._toolBarItems));break;case 50:i.shiftKey&&i.ctrlKey&&this.model.showNavigationPane&&(i.preventDefault(),this._addFocus(this._treetag));break;case 51:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._addFocus(n(this._splittag.find(".e-splitbar")[0])));break;case 52:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._changeLayout(t.FileExplorer.layoutType.Grid));break;case 53:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._changeLayout(t.FileExplorer.layoutType.Tile));break;case 54:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._changeLayout(t.FileExplorer.layoutType.LargeIcons));break;case 55:i.shiftKey&&i.ctrlKey&&this.model.showFooter&&(i.preventDefault(),this._addFocus(this._statusbar));break;case 65:if(i.ctrlKey)if(i.preventDefault(),this.model.layout=="grid")r=this.gridItems,this._gridObj.clearSelection(),this._removeOldSelectionDetails(),this._addFocus(this._gridtag.find(".e-gridcontent")),this._gridObj.selectRows(0,r.length-1,n(r[r.length-1]).find("td:first"));else for(r=this.items,this.items.hasClass("e-active")&&this.items.removeClass("e-active").attr("aria-selected",!1),this._removeOldSelectionDetails(),this._addFocus(this._tileViewWrapper),u=0;u<r.length;u++)i={keyCode:91,ctrlKey:!0,currentTarget:r[u],target:r[u]},this._upDatePathFromTileView(i);break;case 78:i.altKey&&this._hasEditContentsPermission(this._originalPath)&&(i.preventDefault(),this._createNewFolder());break;case 85:i.ctrlKey&&this._toUpload&&(i.preventDefault(),this.element.find(".e-uploadinput").click());break;case 116:i.preventDefault();this._currentPath=this._originalPath;this._highlightedNodes=this.model.selectedItems;this._refreshItems(this._treeObj?this._treeObj.getSelectedNode():"",this._originalPath)}},_changeLayout:function(n){this.model.layout!=n&&(this.model.layout=n,this._removeFocus(),this._switchLayoutView(n));this._focusLayout(n)},_focusLayout:function(n){switch(n){case t.FileExplorer.layoutType.Grid:this._addFocus(this._gridtag.find(".e-gridcontent"));break;case t.FileExplorer.layoutType.Tile:case t.FileExplorer.layoutType.LargeIcons:default:this._addFocus(this._tileViewWrapper)}},_getFocusedElement:function(){var t=this.element.find(".e-focus");return t?t:n(":focus")},_addFocus:function(n){n.hasClass("e-focus")||(this._removeFocus(),n.focus())},_removeFocus:function(){var n=this._getFocusedElement();n.length>0&&n.blur()},_subControlsSetModel:function(n,t){var i={};i[n]=t;this._treeObj&&this._treeObj.option(n,t);this._downloadDialogObj&&this._downloadDialogObj.isOpen()&&this._downloadDialogObj.option(n,t);this._newFolderDialogObj&&this._newFolderDialogObj.isOpen()&&this._newFolderDialogObj.option(n,t);this._renameDialogObj&&this._renameDialogObj.isOpen()&&this._renameDialogObj.option(n,t);this._openDialogObj&&this._openDialogObj.isOpen()&&this._openDialogObj.option(n,t);this._detailsDialogObj&&this._detailsDialogObj.isOpen()&&this._detailsDialogObj.option(n,t);this._alertDialogObj&&this._alertDialogObj.isOpen()&&this._alertDialogObj.option(n,t);this._alertWindowObj&&this._alertWindowObj.isOpen()&&this._alertWindowObj.option(n,t);this._treeContextMenutag&&this._treeMenuObj.option(n,t);this._tileContextMenutag&&this._viewMenuObj.option(n,t);this._toolBarObj&&this._toolBarObj.option(n,t);this._uploadtag&&this._uploadtag.data("ejUploadbox").option(n,t);this._splitObj&&this._splitObj.option(n,t);this._splitButtonObj&&this._splitButtonObj.option(n,t);this._splitButtonObj1&&this._splitButtonObj1.option(n,t);this._statusbar.find("button").length&&this._statusbar.find("button").ejButton(i);this._headCheckObj&&this._headCheckObj.option(n,t);this._tileView.find(".e-tile-checkbox").length&&this._tileView.find(".e-tile-checkbox").ejCheckBox(i);this._gridtag.find(".e-grid-row-checkbox").length&&this._gridtag.find(".e-grid-row-checkbox").ejCheckBox(i)},_removeDialog:function(n){n.close();var t=n._overLay;t&&t.remove();n._ejDialog.remove()},_reSizeHandler:function(){if(this._splitterCorrection(),this.model.ajaxAction!=""&&this._currentPath!=""){if(this.model.layout=="grid"){var n=this._splittag.outerHeight()-this._gridtag.find(".e-gridheader").outerHeight();this._gridObj&&this._gridObj.option("scrollSettings",{height:this.model.showFooter?n-this._statusbar.outerHeight():n,width:this._splittag.find(".e-cont2").width()})}else this._tileScroll&&this._tileScroll.option("width",parseInt(this._splittag.find(".e-cont2").width())),this._setThumbImageHeight();this._treeScroll&&this._treeScroll.option("width",parseInt(this._splittag.find(".e-cont1").width()));this._waitingPopup&&this._waitingPopup.refresh()}},_splitterCorrection:function(){var n=this._splittag.find(this.model.enableRTL?".e-cont2":".e-cont1").width()-1;this._splittag.find(".e-split-divider").css("left",n).css("z-index",1)},_findCommand:function(t,i,r){var u=this;return n.each(i,function(n,i){for(var f=0,e=i.length;f<e;f++)if(i[f].toLowerCase()==t.toLowerCase())return t=r?u["_menu"+i[f]]:i[f],!1}),t},_getElement:function(t){return typeof t=="string"&&(t=this._findCommand(t,this.model.tools)),typeof t!="object"&&(t=typeof t=="string"?this._toolBarObj.itemsContainer.find("li#"+t).length>0?this._toolBarObj.itemsContainer.find("li#"+t):this._toolBarObj.itemsContainer.find("li#"+this._ExplorerId+t.replace(/ /g,"")):this._toolBarObj.itemsContainer.find("li").eq(t)),t=n(t),n(t[0])},_updateToolbar:function(){this._renderToolBar();this._selectedStates.length>=2&&this._enableToolbarItem("Back");this._updateAddressBar();this._selectedItems.length>0&&this._toRead&&(this._toDownload&&this._enableToolbarItem("Download"),this._enableEditingTools(),this._toCopy&&this._enableToolbarItem("Copy"));t.isNullOrUndefined(this._fileName)||this._fileName==""||this._toRead&&this._enableToolbarItem("Paste")},_enableEditingMenus:function(){for(var t=[this._menuRename,this._menuDelete,this._menuCut],n=0;n<t.length;n++)this._restrictedMenuOption.indexOf(t[n])<0&&(this._viewMenuObj&&this._viewMenuObj.enableItem(t[n]),this._treeMenuObj&&this._treeMenuObj.enableItem(t[n]))},_disableEditingMenus:function(){for(var t=[this._menuRename,this._menuDelete,this._menuCut],n=0;n<t.length;n++)this._viewMenuObj&&this._viewMenuObj.disableItem(t[n]),this._treeMenuObj&&this._treeMenuObj.disableItem(t[n])},_updateSelectionDetails:function(n){this._selectedItems.length==0?this._removeOldSelectionDetails(n):(this._updateToolbarItems(),this._updateNewFolderTool(this._hasEditContentsPermission(this._originalPath)))},_updatePasteTool:function(){this._toolBarItems&&(this._option&&this._toRead?this._enableToolbarItem("Paste"):this._disableToolbarItem("Paste"))},_updateAccessRules:function(n){var t=this._feParent[n];this._updateAccessValue(t)},_updateAccessValue:function(n){t.isNullOrUndefined(n)||t.isNullOrUndefined(n.permission)||(n.permission.Copy||(this._toCopy=!1),n.permission.Download||(this._toDownload=!1),n.permission.Edit||(this._toEdit=!1),n.permission.EditContents||(this._toEditContents=!1),n.permission.Read||(this._toRead=!1),n.permission.Upload||(this._toUpload=!1))},_updateToolbarItems:function(){this._toolBarItems&&(this._toRead&&this._toDownload?this._enableToolbarItem("Download"):this._disableToolbarItem("Download"),this._toRead&&this._toUpload?this._enableToolbarItem("Upload"):this._disableToolbarItem("Upload"),this._toRead&&this._toEdit?this._enableEditingTools():this._disableEditingTools(),this._toRead&&this._toCopy?this._enableToolbarItem("Copy"):this._disableToolbarItem("Copy"),this._updatePasteTool())},_getFilePermission:function(n){return this._feParent[n]?this._feParent[n].permission:null},_updateCurrentPathPermission:function(){this._removeOldSelectionDetails();this._toDownload=!1;this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0;this._updateAccessRules(this._originalPath);this._toolBarItems&&(this._toUpload?this._enableToolbarItem("Upload"):this._disableToolbarItem("Upload"));this._updateNewFolderTool(this._hasEditContentsPermission(this._originalPath));this._disableToolbarItem("Copy");this._updatePasteTool()},_updateNewFolderTool:function(n){this._toolBarItems&&(n?this._enableToolbarItem("NewFolder"):this._disableToolbarItem("NewFolder"))},_hasEditContentsPermission:function(n){var t=this._getFilePermission(n);return t?t.Read&&t.EditContents?!0:!1:!0},_hasReadPermission:function(n){var t=this._getFilePermission(n);return t&&!t.Read?!1:!0},_unwireEvents:function(){this._off(n("#"+this._ExplorerId+"_newFolder"),"click",this._createNewFolder);this._off(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView);this._off(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView);this._addressBarEvents("_off");this._off(n("#"+this._ExplorerId+"_searchbar"),"focus",this._inputFocusin);this._off(n("#"+this._ExplorerId+"_searchbar"),"keyup",this._onSearchKeyup);this._off(this.element,"keydown",this._keyDownOnInput);this._off(this._gridtag,"click");this._off(this._tileViewWrapper,"click");this.model.isResponsive&&this._off(n(window),"resize",this._adjustSize);this._toolBarItems&&this._off(this._toolBarItems,"dragover",this._preventDropOption)},_wireResizing:function(){this.model.isResponsive?this._on(n(window),"resize",this._adjustSize):this._off(n(window),"resize",this._adjustSize)},adjustSize:function(){this._ensureResolution();!this._isWindowResized&&this.model.showToolbar&&this.model.isResponsive&&this._toolBarObj._reSizeHandler();this._isWindowResized=!1;this._splittag.css("height",this.element.height()-(this.model.showToolbar&&this._toolBarItems?this._toolBarItems.outerHeight():0));var n=this._splittag.outerHeight()-(this.model.showFooter?this._statusbar.outerHeight():0);this._tileContent&&this._tileContent.parent(".e-tile-wrapper").height(n);this._tileScroll&&this._tileScroll.option("height",n);this._gridtag&&this._gridtag.height(n);this._splitObj&&this._splitObj._windowResized();this._treeScroll&&this._treeScroll.option("height",this._splittag.height());this._reSizeHandler()},refresh:function(){this._refreshItems(this._selectedNode,this._currentPath)},enableToolbarItem:function(n){this._removeRestrictedToolItem(n);n=this._getElement(n);n[0]!=null&&this._toolBarObj&&this._toolBarObj.enableItem(n)},disableToolbarItem:function(n){if(n=this._getElement(n),n[0]!=null&&this._toolBarObj){var t=n.attr("id").replace(this._ExplorerId,"");this._restrictedToolbarOptions.push(t);this._toolBarObj.disableItem(n)}},removeToolbarItem:function(n){this._removeRestrictedToolItem(n);n=this._getElement(n);n[0]!=null&&this._toolBarObj&&this._toolBarObj.removeItem(n)},_removeRestrictedToolItem:function(n){for(var i=typeof n=="string"?n:n.attr("id").replace(this._ExplorerId,""),t=0;t<this._restrictedToolbarOptions.length;t++)if(this._restrictedToolbarOptions[t]==i){this._restrictedToolbarOptions.splice(t,1);break}},_onThumbStart:function(t){var i=n(t.originalEvent.target);if(i.hasClass("e-draggable")||i.closest(".e-draggable").length)return t.cancel=!0,!1}});t.FileExplorer.Locale={};t.FileExplorer.Locale["en-US"]={EmptyFolder:"This folder is empty",ProtectedFolder:"You don't currently have permission to access this folder",EmptyResult:"No items match your search",Back:"Backward",Forward:"Forward",Upward:"Upward",Refresh:"Refresh",Addressbar:"Address bar",Upload:"Upload",Rename:"Rename",Delete:"Delete",Download:"Download",Error:"Error",Cut:"Cut",Copy:"Copy",Paste:"Paste",Details:"Details",Searchbar:"Search bar",Open:"Open",Search:"Search",NewFolder:"New folder",SortBy:"Sort by",Size:"Size",RenameAlert:"Please enter new name",NewFolderAlert:"Please enter new folder name",ContextMenuOpen:"Open",ContextMenuNewFolder:"New folder",ContextMenuDelete:"Delete",ContextMenuRename:"Rename",ContextMenuUpload:"Upload",ContextMenuDownload:"Download",ContextMenuCut:"Cut",ContextMenuCopy:"Copy",ContextMenuPaste:"Paste",ContextMenuGetinfo:"Get info",ContextMenuRefresh:"Refresh",ContextMenuOpenFolderLocation:"Open folder location",Item:"item",Items:"items",Selected:"selected",ErrorOnFolderCreation:"This destination already contains a folder named '{0}'. Do you want to merge this folder content with already existing folder '{0}'?",InvalidFileName:"A file name can't contain any of the following characters: \\/:*?\"<>|",GeneralError:"Please see browser console window for more information",ErrorPath:"FileExplorer can't find '{0}'. Check the spelling and try again.",ReplaceAlert:"File named '{0}' already exists. Replace old file with new one?",DuplicateAlert:"There is already a file with the same name '{0}'. Do you want to create file with duplicate name",DuplicateFileCreation:"There is already a file with the same name in this location. Do you want to rename '{0}' to '{1}'?",DeleteFolder:" Are you sure you want to delete ",DeleteMultipleFolder:"Are you sure you want to delete these {0} items?",CancelPasteAction:"The destination folder is a subfolder of source folder.",OkButton:"OK",ContextMenuSortBy:"Sort by",CancelButton:"Cancel",YesToAllButton:"Yes to all",NoToAllButton:"No to all",YesButton:"Yes",NoButton:"No",SkipButton:"Skip",Grid:"Grid view",Tile:"Tile view",LargeIcons:"Large icons",Name:"Name",Location:"Location",Type:"Item type",Layout:"Layout",Created:"Created",Accessed:"Accessed",Modified:"Modified",Permission:"Permission",DialogCloseToolTip:"Close",UploadSettings:{buttonText:{upload:"Upload",browse:"Browse",cancel:"Cancel",close:"Close"},dialogText:{title:"Upload Box",name:"Name",size:"Size",status:"Status"},dropAreaText:"Drop files or click to upload",filedetail:"The selected file size is too large. Please select a file within the valid size.",denyError:"Files with #Extension extensions are not allowed.",allowError:"Only files with #Extension extensions are allowed.",cancelToolTip:"Cancel",removeToolTip:"Remove",retryToolTip:"Retry",completedToolTip:"Completed",failedToolTip:"Failed",closeToolTip:"Close"}};t.FileExplorer.filterType={StartsWith:"startswith",Contains:"contains",EndsWith:"endswith"};t.FileExplorer.layoutType={Tile:"tile",Grid:"grid",LargeIcons:"largeicons"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejCaptcha","ej.Captcha",{element:null,model:null,validTags:["div"],_setFirst:!1,_rootCSS:"e-captcha",defaults:{enablePattern:!0,targetInput:"",targetButton:"",height:50,width:150,characterSet:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",maximumLength:8,minimumLength:4,enableCaseSensitivity:!0,enableAutoValidation:!1,encryptedCode:"",customErrorMessage:"Invalid Captcha",showAudioButton:!1,showRefreshButton:!1,locale:"en-US",enableRTL:!1,requestMapper:"",refreshBegin:"",refreshSuccess:"",refreshFailure:"",refreshComplete:"",mapper:"",hatchStyle:"BackwardDiagonal"},dataTypes:{targetInput:"string",targetButton:"string",height:"number",width:"number",characterSet:"string",maximumLength:"number",minimumLength:"number",enableCaseSensitivity:"boolean",enableAutoValidation:"boolean",encryptedCode:"string",customErrorMessage:"string",requestMapper:"string",showAudioButton:"boolean",locale:"string",showRefreshButton:"boolean",enableRTL:"boolean",mapper:"string",hatchStyle:"enum",enablePattern:"boolean"},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.Captcha",this.model.locale)},_getLocalizedLabels:function(n){return this._localizedLabels[n]===i?t.Captcha.Locale["en-US"][n]:this._localizedLabels[n]},_init:function(){this._initialize();this._wireEvents()},_initialize:function(){this._updateLocalConstant();n("#"+this._id+"_RefreshButton").ejButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly",prefixIcon:"e-icon e-captcha e-reload",type:"button"});n("#"+this._id+"_PlayAudio").ejButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly",prefixIcon:"e-icon e-captcha e-volume-up",type:"button"});n("#"+this._id+"_ValidText").attr("placeholder",this._getLocalizedLabels("placeHolderText"));this._control=n("#"+this._id).get(0);this.model.targetInput||(this.model.targetInput=this._id+"_ValidText");this._target=n("#"+this.model.targetInput).get(0);this._captchaImage=n("#"+this._id+"_CaptchaImage").get(0);this._message=n("#"+this._id+"_CaptchaMessage").get(0);this._refreshButton=n("#"+this._id+"_RefreshButton").get(0);this._form=n(this._target).parents("form")[0];this._audioObject=n("#"+this._id+"_AudioObject").get(0);this._audioButton=n("#"+this._id+"_PlayAudio").get(0);this._audioPluginObject=null;this._audioType="audio/wav";t.isNullOrUndefined(this.model.targetButton)||this.model.targetButton===""||(this._submitButton=n("#"+this.model.targetButton).get(0),this._submitButton||(this._submitButton=n("[id$='"+this.model.targetButton+"']").get(0)));this._hiddenField=n("#"+this._id+"_Hidden").get(0);this._audioObject&&(this._isSupportAudio(this._audioType)||this._appendAudioPlugin())},_wireEvents:function(){if(this._FormSubmitDelegate=n.proxy(this.formSubmit,this),this._CaptchaRefreshDelegate=n.proxy(this.refresh,this),this._PlayAudioDelegate=n.proxy(this.playAudio,this),this._audioButton)n(this._audioButton).on("click",this._PlayAudioDelegate);if(this._submitButton)n(this._submitButton).on("click",this._FormSubmitDelegate);if(this._refreshButton)n(this._refreshButton).on("click",this._CaptchaRefreshDelegate)},_unwireEvents:function(){this._audioButton&&n(this._audioButton).off("click",this._PlayAudioDelegate);this._submitButton&&n(this._submitButton).off("click",this._FormSubmitDelegate);this._refreshButton&&n(this._refreshButton).off("click",this._CaptchaRefreshDelegate)},playAudio:function(){try{this._audioPluginObject?this._audioPluginObject.Play():this._audioObject&&this._audioObject.play&&this._audioObject.play()}catch(n){}},_isSupportAudio:function(n){return document.createElement("audio").canPlayType?document.createElement("audio").canPlayType(n).match(/maybe|probably/i)?!0:!1:!1},_appendAudioPlugin:function(){n(this._audioPluginObject).remove();var t=this._createAudioPluginObject();this._audioObject.parentNode.appendChild(t);this._audioPluginObject=n("#"+this._id+"_AudioPlugin").get(0)},_createAudioPluginObject:function(){var n=document.createElement("embed");return n.setAttribute("id",this._id+"_AudioPlugin"),n.setAttribute("src",this.model.audioUrl),n.setAttribute("name","AudioPlugin"),n.setAttribute("enablejavascript","true"),n.setAttribute("type","audio/wav"),n.setAttribute("autostart","false"),n.setAttribute("pluginspage","http://www.apple.com/quicktime/download/"),n.style.top=0,n.style.left=0,n.style.width="0px",n.style.height="0px",n.style.position="absolute",n},_onSuccess:function(t){var i=t.d?JSON.parse(t.d):t;try{this._audioPluginObject?this._audioPluginObject.Pause():this._audioObject&&this._audioObject.pause&&this._audioObject.pause()}catch(r){}this._captchaImage.src=i.NewChallenge;this._audioObject&&(this._audioObject.src=i.AudioLink);this.model.audioURL=i.AudioLink;this._audioPluginObject&&this._appendAudioPlugin();this.model.isValid=i.Validation=="False"?!1:!0;this.model.enableAutoValidation&&this._displayMessages();n("#"+this._id+"_ValidText")&&n("#"+this._id+"_ValidText").val("");this.model.encryptedCode=i.Script;n(this._hiddenField).val(this.model.encryptedCode)},_displayMessages:function(){this.model.isValid?n("#"+this._id+"_CaptchaMessage").html(""):(n("#"+this._id+"_CaptchaMessage").html(this.model.locale=="en-US"?this.model.customErrorMessage:t.Captcha.Locale[this.model.locale].customErrorMessage),n("#"+this._id+"_ValidText").addClass("error"))},_onRefreshSuccess:function(t){var i=t.d?JSON.parse(t.d):t;try{this._audioPluginObject?this._audioPluginObject.Pause():this._audioObject&&this._audioObject.pause&&this._audioObject.pause()}catch(r){}this._captchaImage.src=i.NewChallenge;this._audioObject&&(this._audioObject.src=i.AudioLink);this.model.audioUrl=i.AudioLink;this._audioPluginObject&&this._appendAudioPlugin();this.model.encryptedCode=i.EncryptedText;n(this._hiddenField).val(i.EncryptedText)},formSubmit:function(t){var i=this,r={Height:this.model.height,Width:this.model.width,CharacterSet:this.model.characterSet,MaximumLength:this.model.maximumLength,MinimumLength:this.model.minimumLength,CaseSensitive:this.model.enableCaseSensitivity,ShowRefreshButton:this.model.showRefreshButton,ShowAudioButton:this.model.showAudioButton,EncryptedText:this.model.encryptedCode,ResponseText:n(this._target).val(),Id:this._id,HatchStyle:this.model.hatchStyle,EnablePattern:this.model.enablePattern,RequestType:"CaptchaRequest",ActionType:"Validation"};return n.ajax({type:"POST",url:this.model.requestMapper?this.model.requestMapper:this.model.pathName+"/"+this.model.mapper,data:JSON.stringify({captchaModel:r}),dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(n){n&&i._onSuccess(n);return},error:function(){i._trigger("refreshFailure");return}}),!this.model.isValid&&this.model.enableAutoValidation?(t.preventDefault(),t.stopPropagation(),!1):void 0},refresh:function(){var t=this,i={Height:this.model.height,Width:this.model.width,CharacterSet:this.model.characterSet,MaximumLength:this.model.maximumLength,MinimumLength:this.model.minimumLength,CaseSensitive:this.model.enableCaseSensitivity,EncryptedText:this.model.encryptedCode,ShowRefreshButton:this.model.showRefreshButton,ShowAudioButton:this.model.showAudioButton,Id:this._id,HatchStyle:this.model.hatchStyle,EnablePattern:this.model.enablePattern,RequestType:"CaptchaRequest",ActionType:"Refresh"};if(t._trigger("refreshBegin"))return!1;n.ajax({type:"POST",url:this.model.requestMapper?this.model.requestMapper:this.model.pathName+"/"+this.model.mapper,data:JSON.stringify({captchaModel:i}),dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(n){n&&(t._onRefreshSuccess(n),t._trigger("refreshSuccess"));return},error:function(){t._trigger("refreshFailure");return},complete:function(){t._trigger("refreshComplete");return}})}});t.HatchStyle={None:"none",BackwardDiagonal:"backwardDiagonal",Cross:"cross",DarkDownwardDiagonal:"darkDownwardDiagonal",DarkHorizontal:"darkHorizontal",DarkUpwardDiagonal:"darkUpwardDiagonal",DarkVertical:"darkVertical",DashedDownwardDiagonal:"dashedDownwardDiagonal",DashedHorizontal:"dashedHorizontal",DashedUpwardDiagonal:"dashedUpwardDiagonal",DashedVertical:"dashedVertical",DiagonalBrick:"diagonalBrick",DiagonalCross:"diagonalCross",Divot:"divot",DottedDiamond:"dottedDiamond",DottedGrid:"dottedGrid",ForwardDiagonal:"forwardDiagonal",Horizontal:"horizontal",HorizontalBrick:"horizontalBrick",LargeCheckerBoard:"largeCheckerBoard",LargeConfetti:"largeConfetti",LargeGrid:"largeGrid",LightDownwardDiagonal:"lightDownwardDiagonal",LightHorizontal:"lightHorizontal",LightUpwardDiagonal:"lightUpwardDiagonal",LightVertical:"lightVertical",Max:"max",Min:"min",NarrowHorizontal:"narrowHorizontal",NarrowVertical:"narrowVertical",OutlinedDiamond:"outlinedDiamond",Percent90:"percent90",Wave:"wave",Weave:"weave",WideDownwardDiagonal:"wideDownwardDiagonal",WideUpwardDiagonal:"wideUpwardDiagonal",ZigZag:"zigZag"};t.Captcha.Locale=t.Captcha.Locale||{};t.Captcha.Locale["default"]=t.Captcha.Locale["en-US"]={placeHolderText:"Type the code shown",CustomErrorMessage:"Invalid Captcha"}}(jQuery,Syncfusion),function(n,t){"use strict";var i=function(){function i(n,i){this._heatmap=i?i:null;i&&(i._grid=this);this._rootCSS="e-grid";this.element=null;this.validTags=["div"];this.model=null;this._requiresID=!0;this.keyConfigs={focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",nextPage:"34",previousPage:"33",lastPage:"ctrl+alt+34",firstPage:"ctrl+alt+33",nextPager:"alt+34",previousPager:"alt+33",firstCellSelection:"36",lastCellSelection:"35",firstRowSelection:"ctrl+36",lastRowSelection:"ctrl+35",upArrow:"38",downArrow:"40",rightArrow:"39",leftArrow:"37",moveCellRight:"9",moveCellLeft:"shift+9",selectedGroupExpand:"alt+40",totalGroupExpand:"ctrl+40",selectedGroupCollapse:"alt+38",totalGroupCollapse:"ctrl+38",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40"};this._ignoreOnPersist=["query","isEdit","toolbarClick","queryCellInfo","mergeCellInfo","currentViewData","enableAltRow","enableRTL","contextClick","contextOpen","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","childGrid","summaryRows","toolbarSettings","editSettings","allowMultiSorting","enableAutoSaveOnSelectionChange","locale","allowCellMerging","allowTextWrap","textWrapSettings","cssClass","dataSource","groupSettings.enableDropAreaAnimation","enableRowHover","showSummary","allowGrouping","enableHeaderHover","allowKeyboardNavigation","scrollSettings.frozenRows","scrollSettings.frozenColumns","enableTouch","contextMenuSettings.enableContextMenu","exportToExcelAction","exportToWordAction","exportToPdfAction"];this.ignoreOnExport=["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","editSettings","pageSettings","enableAutoSaveOnSelectionChange","localization","allowScrolling","cssClass","dataSource","groupSettings.enableDropAreaAnimation","enableRowHover","allowSummary","enableHeaderHover","allowKeyboardNavigation"];this.observables=["dataSource","selectedRowIndex","pageSettings.currentPage"];this._tags=[{tag:"columns",attr:["allowEditing","allowFiltering","allowGrouping","allowResizing","allowSorting","cssClass","customAttributes","dataSource","defaultValue","disableHtmlEncode","editTemplate","editType","foreignKeyField","foreignKeyValue","headerTemplateID","headerText","isFrozen","isIdentity","isPrimaryKey","filterBarTemplate","textAlign","templateID","textAlign","headerTextAlign","tooltip","clipMode","validationRules.minlength","validationRules.maxlength","validationRules.range","validationRules.number","validationRules.required","editParams.decimalPlaces",[{tag:"commands",attr:["type","buttonOptions"]}]],content:"template"},{tag:"summaryRows",attr:["showCaptionSummary","showTotalSummary",[{tag:"summaryColumns",attr:["customSummaryValue","dataMember","displayColumn","summaryType","template"]}]]},{tag:"stackedHeaderRows",attr:[[{tag:"stackedHeaderColumns",attr:["headerText","column"]}]]},{tag:"filterSettings.filteredColumns",attr:[]},{tag:"sortSettings.sortedColumns",attr:[]}];this._dataSource=t.util.valueFunction("dataSource");this._selectedRow=t.util.valueFunction("selectedRowIndex");this._currentPage=t.util.valueFunction("pageSettings.currentPage");this.dataTypes={dataSource:"data",query:"data",columns:"array",childGrid:"parent",gridLines:"enum",summaryRows:"array",stackedHeaderRows:"array",toolbarSettings:{toolbarItems:"array",customToolbarItems:"array"},contextMenuSettings:{contextMenuItems:"array",customContextMenuItems:"array",subContextMenu:"array"},selectionSettings:{selectionMode:"array",selectedRecords:"array"},sortSettings:{sortedColumns:"array"},filterSettings:{filteredColumns:"array",filterType:"enum",filterBarMode:"enum"},groupSettings:{groupedColumns:"array"},editSettings:{editMode:"enum",formPosition:"enum",rowPosition:"enum"},searchSettings:{fields:"array"},textWrapSettings:{wrapMode:"enum"}};this.model={allowPaging:!1,showColumnChooser:!1,gridLines:"both",allowSorting:!1,showStackedHeader:!1,selectedRecords:[],stackedHeaderRows:[],allowFiltering:!1,allowMultipleExporting:!1,allowSelection:!0,allowGrouping:!1,showSummary:!1,allowResizing:!1,allowResizeToFit:!1,allowTextWrap:!1,allowCellMerging:!1,enableRowHover:!0,enablePersistence:!1,enableFocusout:!1,selectedRowIndex:-1,allowSearching:!1,enableToolbarItems:!1,enableHeaderHover:!1,allowReordering:!1,allowKeyboardNavigation:!0,allowRowDragAndDrop:!1,enableTouch:!0,columnLayout:"auto",selectionType:"single",dataSource:null,cssClass:"",allowScrolling:!1,locale:"en-US",enableAutoSaveOnSelectionChange:!0,allowMultiSorting:!1,exportToExcelAction:"",exportToWordAction:"",exportToPdfAction:"",_groupingCollapsed:[],editSettings:{allowEditing:!1,showAddNewRow:!1,allowAdding:!1,allowDeleting:!1,editMode:"normal",rowPosition:"top",dialogEditorTemplateID:null,allowEditOnDblClick:!0,externalFormTemplateID:null,inlineFormTemplateID:null,formPosition:"bottomleft",titleColumn:null,showConfirmDialog:!0,showDeleteConfirmDialog:!1},selectionSettings:{selectionMode:["row"],enableToggle:!1,cellSelectionMode:"flow"},pageSettings:{pageSize:12,pageCount:8,currentPage:1,totalPages:null,enableTemplates:!1,showDefaults:!1,template:null,totalRecordsCount:null,enableQueryString:!1,printMode:"allpages"},groupSettings:{showDropArea:!0,showToggleButton:!1,showGroupedColumn:!0,showUngroupButton:!0,enableDropAreaAutoSizing:!0,captionFormat:null,groupedColumns:[]},contextMenuSettings:{enableContextMenu:!1,contextMenuItems:["Add Record","Edit Record","Delete Record","Sort In Ascending Order","Sort In Descending Order","Next Page","Last Page","Previous Page","First Page","Save","Cancel","Grouping","Ungrouping"],customContextMenuItems:[],subContextMenu:[],disableDefaultItems:!1},filterSettings:{filterType:"filterbar",filterBarMode:"immediate",showFilterBarStatus:!0,statusBarWidth:450,showPredicate:!1,filteredColumns:[],enableInterDeterminateState:!0,maxFilterChoices:1e3,enableCaseSensitivity:!1,immediateModeDelay:1500,enableComplexBlankFilter:!0,blankValue:""},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},sortSettings:{sortedColumns:[]},toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},minWidth:0,currentIndex:0,rowDropSettings:{dropMapper:null,dragMapper:null,dropTargetID:null},scrollSettings:{width:"auto",height:0,enableTouchScroll:!0,allowVirtualScrolling:!1,virtualScrollMode:"normal",frozenRows:0,frozenColumns:0,buttonSize:18,autoHide:!1,scrollerSize:18,scrollOneStepBy:57,enableVirtualization:!1},textWrapSettings:{wrapMode:"both"},summaryRows:[],enableRTL:!1,enableAltRow:!0,currentViewData:null,detailsTemplate:null,childGrid:null,keySettings:null,rowTemplate:null,detailsDataBound:null,rowDataBound:null,queryCellInfo:null,mergeCellInfo:null,create:null,actionBegin:null,actionComplete:null,actionFailure:null,beginEdit:null,endEdit:null,endAdd:null,endDelete:null,beforeBatchAdd:null,beforeBatchSave:null,beforeBatchDelete:null,batchAdd:null,batchDelete:null,cellSave:null,cellEdit:null,resizeStart:null,resizeEnd:null,resized:null,load:null,destroy:null,rowSelecting:null,rowSelected:null,cellSelecting:null,cellSelected:null,columnSelecting:null,columnSelected:null,columnDragStart:null,columnDrag:null,columnDrop:null,dataBound:null,recordClick:null,recordDoubleClick:null,templateRefresh:null,rightClick:null,detailsCollapse:null,detailsExpand:null,toolbarClick:null,contextOpen:null,contextClick:null,columns:[],query:null,isEdit:!1,isResponsive:!1,enableResponsiveRow:!1,virtualLoading:null}}return i.prototype._dataSource=t.util.valueFunction("dataSource"),i.prototype._selectedRow=t.util.valueFunction("selectedRowIndex"),i.prototype._currentPage=t.util.valueFunction("pageSettings.currentPage"),i.prototype._mapValues=function(){},i.prototype._createElement=function(i,r){this.element=i.jquery?i:n(i);this.sfType="ej-grid";this.pluginName="ej.Grid";this.model=t.copyObject(!0,{},this.model,r);this.model.keyConfigs=t.copyObject(this.keyConfigs);this.element.addClass("e-grid e-js").data("ej.Grid",this)},i.prototype._init=function(n,i,r){var f,u,e;this._createElement(n,i);!t.isNullOrUndefined(this.model.query)&&this.model.query instanceof t.Query||(this.model.query=t.Query());t.isNullOrUndefined(this.model.parentDetails)||(f=this.model.queryString,u=this.model.foreignKeyField,this.model.query=this.model.query.clone(),e=this.model.parentDetails.parentKeyFieldValue===undefined?"undefined":this.model.parentDetails.parentKeyFieldValue,this.model.query.where(t.isNullOrUndefined(u)?f:u,"equal",e,!0));this._initPrivateProperties();this._initScrolling();this.model.enableResponsiveRow&&this.element.addClass("e-responsive");this._checkForeignKeyBinding();this._checkDataBinding(r);this._refreshScroller({})},i.prototype._checkDataBinding=function(n){var i,u,r,f;if(!this.model.columns.length&&((this._dataSource()==null||!this._dataSource().length)&&!(this._dataSource()instanceof t.DataManager)||this._dataSource()instanceof t.DataManager&&this._dataManager.dataSource.url==undefined&&!this._dataSource().dataSource.json.length)){this._alertDialog.find(".e-content").text(this.localizedLabels.EmptyDataSource);this._alertDialog.ejDialog("open");return}if(this._initialRenderings(),this.model.editSettings.allowDeleting&&this.model.selectionType=="multiple"&&(this.multiDeleteMode=!0),this.initialRender=!0,this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.allowFiltering&&this._isExcelFilter&&this._renderExcelFilter(),this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),this.model.allowGrouping&&this.element.append(this._renderGroupDropArea()),(this.model.toolbarSettings.showToolbar||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&this.element.append(this._renderToolBar()),i=this.model.columns,i&&i.length){if(u=this.model.query._expands,typeof i[0]=="string")for(r=0;r<i.length;r++)i[r]={field:i[r]};for(r=0;r<i.length;r++)i[r].field&&i[r].field.indexOf(".")!==-1&&this._getExpands(i[r].field,u);this.model.query.expand(u);this.commonQuery.expand(u);this._renderAfterColumnInitialize()}this.model.allowPaging&&this.element.append(this._renderGridPager());this.model.contextMenuSettings.enableContextMenu&&this.element.append(this._renderContext());this.model.scrollSettings.allowVirtualScrolling&&(this._loadedJsonData=[],this._prevPage=1);this._dataSource()instanceof t.DataManager?this._dataSource().ready!=undefined?(f=this,this._dataSource().ready.done(function(n){f._initDataSource();f.model.dataSource=t.DataManager(n.result)})):this._initDataSource():(this._ensureDataSource(),this._setForeignKeyData(),this._relationalColumns.length==0&&this._initGridRender(n),this._vRowHeight=Math.floor(this.getRowHeight()));this.model.showColumnChooser&&this._renderColumnChooser()},i.prototype._initialRenderings=function(){var r,i;if(this.model.groupSettings.groupedColumns.length){for(r=[],i=0;i<this.model.sortSettings.sortedColumns.length;i++)t.isNullOrUndefined(this.model.sortSettings.sortedColumns[i].direction)&&(this.model.sortSettings.sortedColumns[i].direction=t.sortOrder.Ascending),r.push(this.model.sortSettings.sortedColumns[i].field);if(this.model.allowGrouping)for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)n.inArray(this.model.groupSettings.groupedColumns[i],r)==-1&&this.model.sortSettings.sortedColumns.push({field:this.model.groupSettings.groupedColumns[i],direction:t.sortOrder.Ascending})}},i.prototype._renderAfterColumnInitialize=function(){this.element.append(this._renderGridHeader())},i.prototype.setGridHeaderContent=function(n){this._gridHeaderContent=n},i.prototype._renderGridHeader=function(){var n=t.buildTag("div.e-gridheader"),r,u,i=t.buildTag("div");return this.model.allowScrolling&&i.addClass("e-headercontent"),this.setGridHeaderContent(n),this.initialRender&&(this.columnsWidthCollection=[],this._hiddenColumns=[],this._hiddenColumnsField=[]),this._visibleColumns=[],this._visibleColumnsField=[],this._disabledGroupableColumns=[],this._fieldColumnNames={},this._headerColumnNames={},this.model.scrollSettings.frozenColumns>0?(r=t.buildTag("div.e-frozenheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(0,this.model.scrollSettings.frozenColumns),!0)),u=t.buildTag("div.e-movableheader",t.buildTag("div.e-movableheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(this.model.scrollSettings.frozenColumns),!1))),i.append(r).append(u)):i.append(this._renderGridHeaderInternalDesign(this.model.columns)),n.html(i),this.model.isResponsive&&n.addClass("e-textover"),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),n},i.prototype.setGridHeaderTable=function(n){this._gridHeaderTable=n},i.prototype._renderGridHeaderInternalDesign=function(i,r){var y=t.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"heatmap"}),c=t.buildTag("thead"),p=t.buildTag("tbody.e-hide"),l=t.buildTag("tr.e-columnheader"),a=n(document.createElement("colgroup")),w=n(document.createElement("tr")),b,u,v,h,s,o;if((this.model.childGrid||this.model.detailsTemplate)&&(l.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),a.append(this._getIndentCol())),this.model.showStackedHeader)for(o=0;o<this.model.stackedHeaderRows.length;o++)b=this._createStackedRow(this.model.stackedHeaderRows[o],r),c.append(b);for(u=0;u<i.length;u++){var e=t.buildTag("th.e-headercell e-default","",{},{role:"columnheader"}),k=document.createElement("td"),f=t.buildTag("div.e-headercelldiv",i[u].headerText===undefined?i[u].headerText=i[u].field:i[u].headerText,{},{"ej-mappingname":i[u].field});if(i[u].disableHtmlEncode&&f.text(i[u].headerText),t.isNullOrUndefined(i[u].headerTooltip)||f.addClass("e-headertooltip"),t.isNullOrUndefined(i[u].tooltip)||f.addClass("e-gridtooltip"),(i[u].clipMode==t.HeatMapGrid.ClipMode.Ellipsis||i[u].clipMode==t.HeatMapGrid.ClipMode.EllipsisWithTooltip)&&f.addClass("e-gridellipsis"),e.append(f),this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&(i[u].allowFiltering==undefined||i[u].allowFiltering===!0)&&(!t.isNullOrUndefined(i[u].field)||i[u].field=="")){if(v="e-filterset",!this.initialRender&&this.model.filterSettings.filteredColumns)for(h=0;h<this.model.filterSettings.filteredColumns.length;h++)this.model.filterSettings.filteredColumns[h].field==i[u].field&&(v="e-filterset e-filteredicon e-filternone");e.append(t.buildTag("div.e-filtericon e-icon "+v));e.addClass("e-headercellfilter");t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this.model.enableRTL&&n(f).css("padding","0 0 0 2em")}s=document.createElement("col");i[u].priority&&n(k).addClass("e-table-priority-"+i[u].priority);w.append(k);l.append(e);a.append(s);i[u].visible===!1?(e.addClass("e-hide")&&n(s).css("display","none"),n.inArray(i[u].headerText,this._hiddenColumns)==-1&&n.inArray(i[u].field,this._hiddenColumnsField)==-1&&(this._hiddenColumns.push(i[u].headerText)&&i[u].field!=(""||undefined)?this._hiddenColumnsField.push(i[u].field):this._hiddenColumnsField.push(i[u].headerText)),n.inArray(i[u].field,this._visibleColumnsField)!=-1&&this._visibleColumnsField.splice(n.inArray(i[u].field,this._visibleColumnsField),1)&&this._visibleColumns.splice(n.inArray(i[u].headerText,this._visibleColumns),1)):(this._visibleColumns.push(i[u].headerText)&&i[u].field!=(""||undefined)?this._visibleColumnsField.push(i[u].field):this._visibleColumnsField.push(i[u].headerText),i[u].visible=!0,n.inArray(i[u].field==""?i[u].headerText:i[u].field,this._hiddenColumnsField)!=-1&&this._hiddenColumnsField.splice(n.inArray(i[u].field==""?i[u].headerText:i[u].field,this._hiddenColumnsField),1)&&this._hiddenColumns.splice(n.inArray(i[u].headerText,this._hiddenColumns),1));this.model.showColumnChooser&&i[u].showInColumnChooser!==!1&&(i[u].showInColumnChooser=!0);this.model.allowResizing&&i[u].allowResizing!==!1&&(i[u].allowResizing=!0);t.isNullOrUndefined(i[u].headerTextAlign)?i[u].textAlign!=undefined?f.css("text-align",i[u].textAlign):this.model.enableRTL&&f.css("text-align",i[u].textAlign="right"):f.css("text-align",i[u].headerTextAlign);i[u].allowResizing===!1&&this._disabledResizingColumns.push(i[u].field);i[u].allowSorting===!1&&this._disabledSortableColumns.push(i[u].field);i[u].allowGrouping===!1&&this._disabledGroupableColumns.push(i[u].field);i[u].allowEditing===!1&&this._disabledEditableColumns.push(i[u].field);t.isNullOrUndefined(i[u].cssClass)||(e.addClass(i[u].cssClass),n(s).addClass(i[u].cssClass));t.isNullOrUndefined(i[u].headerTemplateID)||(f.html(n(i[u].headerTemplateID).hide().html()).parent().addClass("e-headertemplate"),o=n.inArray(i[u].field,this._disabledGroupableColumns),o==-1&&t.isNullOrUndefined(i[u].field)&&this._disabledGroupableColumns.push(i[u].field));this.model.isResponsive&&e.attr("title",this._decode(i[u].headerText));i[u].priority&&(e.attr("data-priority",i[u].priority).addClass("e-table-priority-"+i[u].priority),n(s).addClass("e-table-priority-"+i[u].priority));this.initialRender&&(typeof i[u].width=="string"&&i[u].width.indexOf("%")!=-1?this.columnsWidthCollection.push(parseInt(i[u].width)/100*this.element.width()):this.columnsWidthCollection.push(i[u].width));i[u].width==undefined&&this.model.commonWidth!==undefined&&(this.columnsWidthCollection[u]=this.model.commonWidth);this._fieldColumnNames[i[u].headerText]=i[u].field;this._headerColumnNames[i[u].field]=i[u].headerText}return c.append(l),p.append(w),y.append(a).append(c).append(p),y},i.prototype._decode=function(t){return n("<div/>").html(t).text()},i.prototype._checkForeignKeyBinding=function(){if(this.model.columns.length){var i,r,u,n;for(i=0,r=this.model.columns,u=r.length;i<u;i++)n=r[i],n.hasOwnProperty("foreignKeyField")&&n.dataSource instanceof t.DataManager&&this._relationalColumns.push({field:n.field,key:n.foreignKeyField,value:n.foreignKeyValue,dataSource:n.dataSource});this._$fkColumn=!0}},i.prototype._initScrolling=function(){for(var u,r=[],f=[],e=0,i=0;i<this.model.columns.length;i++)this.model.columns[i].visible===!1&&i<this.model.scrollSettings.frozenColumns&&e++,this.model.columns[i].isFrozen===!0?r.push(this.model.columns[i]):f.push(this.model.columns[i]);(r.length>0&&(u=this.model.scrollSettings.frozenColumns,this.model.columns=n.merge(n.merge([],r),f),this.model.scrollSettings.frozenColumns=r.length,r.length!=u&&u!=0&&(this.model.scrollSettings.frozenColumns=u)),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&(this.model.allowGrouping||this.model.rowTemplate!=null||this.model.detailsTemplate!=null||this.model.childGrid!=null||this.model.scrollSettings.allowVirtualScrolling||this.model.editSettings.editMode=="batch"))||(this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this.model.scrollSettings.enableVirtualization?(this._vRowHeight=Math.floor(this.getRowHeight()+1),this._virtualRowCount=Math.round(this.model.scrollSettings.height/this._vRowHeight)+1,this.model.pageSettings.pageSize<this._virtualRowCount*5&&(this.model.pageSettings.pageSize=this._virtualRowCount*5)):(this.model.pageSettings.pageSize=this.model.pageSettings.pageSize==12?Math.round(this.model.scrollSettings.height/32)+1:this.model.pageSettings.pageSize,this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize))),(this.model.width||this.model.height)&&(this.model.allowScrolling=!0,this.model.width&&(this.model.scrollSettings.width=this.model.width),this.model.height&&(this.model.scrollSettings.height=this.model.height)),this._originalScrollWidth=t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)?this.model.scrollSettings.width:this.model.scrollSettings.previousStateWidth)},i.prototype._initPrivateProperties=function(){this._click=0;this._tabKey=!1;this._gridHeaderTable=null;this._gridWidth=this.element.width();this._id=this.element.attr("id");this._gridRows=null;this._unboundRow=null;this._gridContentTable=null;this._gridContent=null;this._remoteSummaryData=null;this._gridSort=null;this._gridHeaderContent=null;this._gridFooterContent=null;this._gridFooterTable=null;this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0;this._links=null;this._gridPager=null;this._cSortedColumn=null;this._cSortedDirection=null;this._$curSElementTarget=null;this._gridFilterBar=null;this._$curFieldName=null;this._$prevFieldName=null;this._mediaStatus=!1;this._$fDlgIsOpen=!1;this._$menuDlgIsOpen=!1;this._$colType=null;this._$colFormat=null;this._$prevColType=null;this._$prevSElementTarget=null;this._currentFilterColumn=null;this._filteredRecordsCount=null;this._filteredRecords=[];this._validatedColumns=[];this.filterColumnCollection=[];this._previousFilterCount=null;this._excelFilter=null;this._isExcelFilter=this.model.filterSettings.filterType=="excel";this._$fkColumn=!1;this._fkParentTblData=[];this._primaryKeys=[];this._identityKeys=[];this._primaryKeyValues=[];this._modifiedRecords=[];this._addedRecords=[];this._tdsOffsetWidth=[];this._deletedRecords=[];this._disabledToolItems=n();this._validationRules={};this._groupedColumns=[];this._scolumns=[];this._currentJsonData=[];this._groupingColumnIndex=0;this._dataManager=this._dataSource()instanceof t.DataManager?this._dataSource():this._dataSource()!=null?t.DataManager(this._dataSource()):null;this._dataManager!=null&&this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.totalRecordsCount!=null&&this._dataManager.dataSource.json!=null&&this._dataManager.dataSource.json.splice(this.model.pageSettings.totalRecordsCount);this._isRemoteSaveAdaptor=this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.remoteSaveAdaptor;this._isLocalData=!0;this._disabledResizingColumns=[];this._disabledSortableColumns=[];this._disabledGroupableColumns=[];this._disabledFilterableColumns=[];this._disabledEditableColumns=[];this._hiddenColumns=[];this._visibleColumns=[];this._visibleColumnsField=[];this._hiddenColumnsField=[];this._ccVisibleColumns=[];this._ccHiddenColumns=[];this._sortedColumns=[];this.multiSortRequest=!1;this.multiSelectCtrlRequest=!1;this.multiSelectShiftRequest=!1;this._enableSelectMultiTouch=!1;this._enableSortMultiTouch=!1;this._templateRefresh=!1;this.initialRender=!1;this._selectDrag=!1;this._isAddNew=!1;this._fieldColumnNames={};this._headerColumnNames={};this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualPageRecords={};this._queryCellView=[];this._currentPageViews=[];this._virtualLoadedPages=[];this._currentLoadedIndexes=[];this._prevVirtualSort=[];this._prevVirtualFilter=[];this._prevVirtualIndex=0;this._currentVirtualIndex=1;this._virtualRowCount=0;this._virtualSelectedRecords={};this.selectedRowsIndexes=[];this._isReorder=!1;this._searchString="";this._searchCount=null;this.columnsWidthCollection=[];this._Indicator=null;this._resizer=null;this._bulkEditCellDetails={cellValue:null,rowIndex:-1,columnIndex:-1,fieldName:null,_data:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],rowData:null};this.batchChanges={added:[],deleted:[],changed:[]};this._bulkEditTemplate=n();this._confirmDialog=null;this._confirmedValue=!1;this._lastRow=!1;this._isVirtualRecordsLoaded=!1;this._scrollValue=0;this._currentTopFrozenRow=this.model.scrollSettings.frozenRows;this._rowHeightCollection=[];this._scrollObject=null;this._customPop=null;this.selectedRowCellIndexes=[];this._rowIndexesColl=[];this.selectedColumnIndexes=[];this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1;this.commonQuery=n.extend(!0,{},this.model.query);this.phoneMode=this.model.isResponsive&&document.documentElement.clientWidth<360?!0:!1;this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();this._mediaQuery=!1;this._columnChooserList=null;this._$headerCols=null;this._$contentCols=null;this._detailsOuterWidth=null;this._editForm=null;this._cloneQuery=null;this.localizedLabels=this._getLocalizedLabels();this._searchBar=null;this._relationalColumns=[];this._dropDownManager={};this._isUngrouping=!1;this._columnChooser=!1},i.prototype._getLocalizedLabels=function(){return t.getLocalizedConstants("ej.HeatMapGrid",this.model.locale)},i.prototype._initSelection=function(){for(var t=this.model.selectionSettings.selectionMode,n=0;n<t.length;n++)this["_allow"+t[n]+"Selection"]=!0},i.prototype._getSelectedViewData=function(t,i,r){var o=t%this._virtualRowCount,u,f={},e;return u=i?parseInt(n(i).closest("tr").attr("name"),32):r?r:t>1?Math.ceil((t+1)/this._virtualRowCount):1,f.viewIndex=u,this._virtualLoadedRecords[u]&&(f.data=this._virtualLoadedRecords[u][o]),e=t%this._virtualRowCount,f.rowIndex=u*this._virtualRowCount-(this._virtualRowCount-e),f},i.prototype._frozenCell=function(t,i){var r=i,u=0,f=this.getRowByIndex(t);return i>=this.model.scrollSettings.frozenColumns&&(u=1,r=r-this.model.scrollSettings.frozenColumns),n(f.eq(u).find(".e-rowcell:eq("+r+")"))},i.prototype.selectCells=function(i){var r,e,o,c,s,u,h,f;if(!this._allowcellSelection)return!1;r=null;c=this._excludeDetailRows();r=this.model.scrollSettings.frozenColumns?this._frozenCell(i[0][0],i[0][1][0]):c.eq(i[0][0]).find(".e-rowcell:eq("+i[0][1]+")");t.isNullOrUndefined(this._previousRowCellIndex)||this._previousRowCellIndex.length==0||(this.model.scrollSettings.enableVirtualization?(e=this._prevRowCell,o=this._preVirRowCellIndex):(e=n(this.getRowByIndex(this._previousRowCellIndex[0][0]).find(".e-rowcell:eq("+this._previousRowCellIndex[0][1]+")")),o=this._previousRowCellIndex));s=this._currentJsonData[i[0][0]];u=i[0][0];this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(h=this._getSelectedViewData(i[0][0],r),s=h.data,u=h.rowIndex);f={currentCell:r,cellIndex:i[0][1],data:s,previousRowCellIndex:o,previousRowCell:e};this.model.selectionType=="multiple"&&(f.isCtrlPressed=this.multiSelectCtrlRequest,f.isShiftPressed=this.multiSelectShiftRequest);switch(this.model.selectionType){case t.HeatMapGrid.SelectionType.Single:this.clearCellSelection();this.clearColumnSelection();this.selectedRowCellIndexes=[];this._virtualRowCellSelIndex=[];n.inArray(u,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(u);this.selectedRowCellIndexes.push({rowIndex:u,cellIndex:i[0][1]});this.model.scrollSettings.frozenColumns?this._frozenCell(i[0][0],i[0][1][0]).addClass("e-cellselectionbackground e-activecell"):n(this.getRowByIndex(i[0][0]).find(".e-rowcell:eq("+i[0][1]+")")).addClass("e-cellselectionbackground e-activecell")}f={currentCell:r,cellIndex:i[0][1],data:s,selectedRowCellIndex:this.selectedRowCellIndexes,previousRowCellIndex:o,previousRowCell:e};(!this.multiSelectShiftRequest||t.isNullOrUndefined(this._previousRowCellIndex))&&(this._previousRowCellIndex=i,this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._preVirRowCellIndex=n.extend(!0,[],i),this._preVirRowCellIndex[0][0]=u),this._prevRowCell=r);this._heatmap&&this._heatmap._cellSelected(f);return},i.prototype.clearSelection=function(i){var r,i,u,f,e;return this._selectedRow()>=-1&&(r=this.model.scrollSettings.frozenColumns?this._excludeDetailRows():n(this.element.find("tr[aria-selected='true']")),t.isNullOrUndefined(i)?(this.model.scrollSettings.frozenColumns>0&&(r=n(r[0]).add(r[1])),r.removeAttr("aria-selected").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-selectionbackground").removeClass("e-active"),this._clearVirtualSelection||(this.selectedRowsIndexes=[],this.model.selectedRecords=[])):(this.getRowByIndex(i).removeAttr("aria-selected").find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),u=this.getRowByIndex(i),this.model.scrollSettings.enableVirtualization&&this.multiSelectCtrlRequest&&n.inArray(i,this.selectedRowsIndexes)==-1&&(f=parseInt(u.attr("name"),32)*this._virtualRowCount,e=this._virtualRowCount-u.index()%this._virtualRowCount,i=f-e),i=n.inArray(i,this.selectedRowsIndexes),i!=-1&&this.selectedRowsIndexes.splice(i,1)),this.selectedRowsIndexes.length||this._selectedRow(-1)),!0},i.prototype._excludeDetailRows=function(){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)?n(this.getRows()):n(this.getRows()).not(".e-detailrow,.e-gridSummaryRows")},i.prototype.clearCellSelection=function(i,r){var f,e,u;if(this._allowcellSelection)if(f=this.model.scrollSettings.frozenColumns||!t.isNullOrUndefined(i)?this._excludeDetailRows():n(this.element.find(".e-cellselectionbackground")).parent(),t.isNullOrUndefined(i))this.model.scrollSettings.frozenColumns&&(f=n(f[0]).add(f[1])),f.find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-cellselectionbackground").removeClass("e-activecell"),this.selectedRowCellIndexes=[],this._rowIndexesColl=[];else{for(u=0;u<this.selectedRowCellIndexes.length;u++)if(this.selectedRowCellIndexes[u].rowIndex==i){e=n.inArray(r,this.selectedRowCellIndexes[u].cellIndex);this.model.scrollSettings.frozenColumns?this._frozenCell(i,r).removeClass("e-cellselectionbackground").removeClass("e-activecell"):f.eq(i).find(".e-rowcell").eq(r).removeClass("e-cellselectionbackground").removeClass("e-activecell");break}u!=this.selectedRowCellIndexes.length&&(this.selectedRowCellIndexes[u].cellIndex.splice(e,1),this.selectedRowCellIndexes[u].cellIndex.length==0&&(this.selectedRowCellIndexes.splice(u,1),this._rowIndexesColl.splice(n.inArray(i,this._rowIndexesColl),1)))}return!0},i.prototype.clearColumnSelection=function(i){var r,o,u,s,f,e;if(this._allowcolumnSelection)if(r=n(this._excludeDetailRows()),t.isNullOrUndefined(i))this.model.scrollSettings.frozenColumns&&(r=n(r[0]).add(r[1])),r.find(".e-rowcell").removeClass("e-columnselection"),n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")).removeClass("e-columnselection"),this.selectedColumnIndexes=[];else{if(o=0,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(++i,o=1),this.model.scrollSettings.frozenColumns)for(u=0,s=i,i>=this.model.scrollSettings.frozenColumns&&(u=1,s=i-this.model.scrollSettings.frozenColumns),f=0;f<r[u].length;f++)n(r[u][f].cells[s]).removeClass("e-columnselection");else for(e=0;e<r.length;e++)n(r[e].cells[i]).removeClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")[i]).removeClass("e-columnselection");this.selectedColumnIndexes.splice(0,i-o)}return!0},i.prototype.getSelectedRecords=function(){var t=[],n;if(this._virtualScrollingSelection)return this._virtualSelRecords;for(n=0;n<this.selectedRowsIndexes.length;n++)this.selectedRowsIndexes[n]!=-1&&(this.model.scrollSettings.allowVirtualScrolling?t.push(this._virtualSelectedRecords[this.selectedRowsIndexes[n]]):t.push(this._currentJsonData[this.selectedRowsIndexes[n]]));return t},i.prototype._setCurrentRow=function(n){(n==t.HeatMapGrid.Actions.Refresh||n==t.HeatMapGrid.Actions.Ungrouping||n==t.HeatMapGrid.Actions.Grouping||n==t.HeatMapGrid.Actions.Filtering||n==t.HeatMapGrid.Actions.Sorting||n==t.HeatMapGrid.Actions.Delete||n==t.HeatMapGrid.Actions.Save||n==t.HeatMapGrid.Actions.Cancel||n==t.HeatMapGrid.Actions.Paging)&&(this._selectedRow(-1),this._virtualDataRefresh||(this.selectedRowsIndexes=[]))},i.prototype.refreshContent=function(){var n={};n.requestType=t.HeatMapGrid.Actions.Refresh;this._processBindings(n)},i.prototype.rowHeightRefresh=function(){var i,f;if(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.model.currentViewData)&&this.model.currentViewData.length){var u=this.getContentTable().get(0).rows,e=this.getContentTable().get(1).rows,r=0;if(this.getContent().find(".e-frozencontentdiv").is(":visible"))for(i=0;i<u.length;i++)n(u[i]).css("display")!="none"&&(r=t.max([u[i].getClientRects()[0].height,e[i].getClientRects()[0].height]),n(u[i]).height(r),n(e[i]).height(r),i&&(i==this.model.scrollSettings.frozenRows-1||i==u.length-1)&&(r=r+1),this.model.allowTextWrap||i&&i!=this.model.scrollSettings.frozenRows-1||(r=r-1),this.model.isEdit&&n(u[i]).find("#"+this._id+"EditForm").length&&i&&n(u[i]).find("#"+this._id+"EditForm td").css("height",r),n(e[i]).find("#"+this._id+"EditForm td").css("height",r));this._getRowHeights();!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&this.getScrollObject().isVScroll()&&(f=this.getScrollObject()._vScrollbar,f&&f.value()!=f.model.maximum&&this._scrollObject.refresh(this.model.scrollSettings.frozenColumns>0))}},i.prototype._refreshDataSource=function(n){this._dataManager=n instanceof t.DataManager?n:t.DataManager(n);this._isLocalData=!(this._dataSource()instanceof t.DataManager)||this._dataManager.dataSource.offline||this._isRemoteSaveAdaptor;this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._virtualDataRefresh=!0);this.refreshContent(!0);this._refreshScroller({requestType:"refresh"})},i.prototype.dataSource=function(n,t){t&&(this._templateRefresh=!0);this._dataSource(n);this.model.scrollSettings.enableVirtualization||(n.length>0?this._currentPage(1):this._currentPage(0));this._refreshDataSource(n);var i=this._refreshVirtualPagerInfo();(this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling)&&this._showPagerInformation(i);this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData?this._refreshVirtualView():this._refreshVirtualContent(),this.getContent().ejScroller("isHScroll")&&this.getContent().ejScroller("scrollX",0,!0),this.getContent().ejScroller("isVScroll")?(this.model.scrollSettings.enableVirtualization||this.getContent().ejScroller("scrollY",0,!0),this.element.find(".e-gridheader").addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss"));(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow();this._trigger("dataBound",{})},i.prototype._trigger=function(){},i.prototype.getFooterContent=function(){return this._gridFooterContent},i.prototype.getScrollObject=function(){return(this._scrollObject==null||t.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},i.prototype.getRowHeight=function(){var i=-1,n,r,t;return this.getContentTable()!=null&&(n=this.getContentTable().find("tr:not(.e-virtualrow)"),r=n.length>2?1:0,n.length&&(t=n[r].getBoundingClientRect()),n.length>1&&(i=t&&t.height?t.height:n[r].offsetHeight)),i==-1?32:i},i.prototype.getCurrentIndex=function(){return(this._currentPage()-1)*this.model.pageSettings.pageSize},i.prototype.getColumnByIndex=function(n){return n<this.model.columns.length?this.model.columns[n]:null},i.prototype.set_currentPageIndex=function(n){var i=this.model.pageSettings,u=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r;return(i.totalPages==null&&(i.totalPages=Math.ceil(u/i.pageSize)),n>i.totalPages||n<1||n==this._currentPage())?!1:(t.isNullOrUndefined(this._prevPageNo)&&(this._prevPageNo=this._currentPage()),this._currentPage(n),this._currentPage()!=this._prevPageNo?(r={},r.requestType="paging",this.gotoPage(this._currentPage(),r),!0):!1)},i.prototype.set_currentVirtualIndex=function(n){var t,i;return n<1||n!=1&&n!=this._totalVirtualViews&&n==this._currentVirtualIndex&&this._checkCurrentVirtualView(this._virtualLoadedRows,n)?!1:(this._prevVirtualIndex=this._currentVirtualIndex,this._currentVirtualIndex=n,t=this._calculateCurrentViewPage(),t<=this.model.pageSettings.totalPages&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)?this._prevVirtualIndex<n&&n!=1?(i=this._isThumbScroll&&t!=1?t:t+1,!this._virtualPageRecords[i]&&i<=this.model.pageSettings.totalPages?this._setCurrentViewPage(i):this._renderVirtulViewContent(t)):this._prevVirtualIndex>n?(i=this._isThumbScroll?t:t-1,this._virtualPageRecords[i]&&!this._virtualLoadedRecords[n-1]&&(i=t-1),!this._virtualPageRecords[i]&&i>=1&&this._setCurrentViewPage(i)):this._renderVirtulViewContent(t):this._renderVirtulViewContent(t),!0)},i.prototype._setCurrentViewPage=function(n){this._needPaging=!0;this._prevPageNo=this._currentPage();this.gotoPage(n)},i.prototype._renderVirtulViewContent=function(){this._needPaging=!1;this._refreshVirtualView(this._currentVirtualIndex)},i.prototype._checkCurrentVirtualView=function(t,i){var f=this._virtualRowCount,u=i-1,r=i+1,e;if(t instanceof Array){if(t.length&&((u==0||r==this._totalVirtualViews+1)&&n.inArray(i,t)!=-1||n.inArray(u,t)!=-1&&n.inArray(i,t)!=-1&&n.inArray(r,t)!=-1))return!0}else if(e=r==this._totalVirtualViews?this._lastViewData:f,!this.initialRender&&i==1&&this._virtualLoadedRows[i]||i==this._totalVirtualViews&&t==this._virtualLoadedRows&&t[i]||u==0&&t[i]&&t[i].length==f||r==this._totalVirtualViews+1&&t[i]&&t[i].length==this._lastViewData||t[u]&&t[u].length==f&&t[i]&&t[i].length==f&&t[r]&&t[r].length==e)return!0;return!1},i.prototype._refreshStackedHeader=function(){var i,r,u,t;if(this.model.showStackedHeader){for(i=this.model.stackedHeaderRows,t=0;t<i.length;t++)if(this.model.scrollSettings.frozenColumns!=0){var f=n(this.getHeaderContent().find(".e-frozenheaderdiv")),e=n(this.getHeaderContent().find(".e-movableheader")),o=this._createStackedRow(i[t],!0),s=this._createStackedRow(i[t],!1);n(f.find("tr.e-stackedHeaderRow")[t]).replaceWith(o);n(e.find("tr.e-stackedHeaderRow")[t]).replaceWith(s)}else r=this._createStackedRow(i[t],!1),this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]?n(this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]).replaceWith(r):r.insertBefore(this.getHeaderTable().find("tr.e-columnheader:last"));if(u={},u.requestType="refresh",this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0)for(t=0;t<this.model.groupSettings.groupedColumns.length;t++)this.getHeaderTable().find(".e-stackedHeaderRow").prepend(this._getGroupTopLeftCell());this.model.allowScrolling&&this._refreshScroller(u)}},i.prototype._getStackedColumnByTarget=function(n){var r=(n.get(0)||{}).className,i=/e-row([0-9])-column([0-9])/.exec(r),u=i[1],f=i[2],e=[u,"stackedHeaderColumns",f].join(".");return t.getObject(e,this.model.stackedHeaderRows)},i.prototype._checkSkipAction=function(n){switch(n.requestType){case t.HeatMapGrid.Actions.Save:case t.HeatMapGrid.Actions.Delete:return!0}return!1},i.prototype._processBindings=function(i){var r,u,f;if(this._requestType=i.requestType,this.model.query=this.commonQuery.clone(),this.model.editSettings.editMode=="batch"&&i.requestType!="batchsave"&&i.requestType!="cancel"&&!this._confirmedValue&&this._bulkChangesAcquired())return this._requestArgs=i,!1;!t.isNullOrUndefined(this.model.dataSource)&&i.requestType=="refresh"&&this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this._scrollValue=0,this._loadedJsonData=[],this._prevPage=this._currentPage());this._ensureDataSource(i);this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="virtualscroll"?(this._loadedJsonData.push({pageIndex:this._prevPage,data:this._currentJsonData}),this._prevPage=this._currentPage()):this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=this.model.currentViewData),i.requestType=="filtering"&&(this._loadedJsonData=[],this._prevPage=this._currentPage()));this.model.scrollSettings.allowVirtualScrolling&&i.requestType=="filtering"&&this.model.filterSettings.filteredColumns.length>0&&this.getScrollObject().scrollY(0);this.model.enableRTL?this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"):this.element.hasClass("e-rtl")&&this.element.removeClass("e-rtl");i.requestType==t.HeatMapGrid.Actions.Delete&&this.model.groupSettings.groupedColumns.length==0&&(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").remove(),i.tr.remove());this._editForm=this.model.scrollSettings.frozenColumns>0||this.model.editSettings.showAddNewRow?this.element.find(".gridform"):n("#"+this._id+"EditForm");this.model.editSettings.showAddNewRow&&i.requestType=="beginedit"||this._editForm.length==0||this._editForm.length>1&&(i.requestType=="save"&&i.action=="edit"||i.requestType=="cancel")&&(this._editForm=this.model.editSettings.rowPosition=="top"?this._editForm[1]:this._editForm[0]);this._dataSource()instanceof t.DataManager&&!this._isRemoteSaveAdaptor&&i.requestType!=t.HeatMapGrid.Actions.BeginEdit&&i.requestType!=t.HeatMapGrid.Actions.Cancel&&i.requestType!=t.HeatMapGrid.Actions.Add?(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage&&(r=t.pvt.filterQueries(this.model.query.queries,"onPage"),this.model.query.queries.splice(n.inArray(r[0],this.model.query.queries),1),this.model.query.page(this._currentPage()-1,this.model.pageSettings.pageSize),u=this._dataSource().executeQuery(this.model.query),this.model.query.queries.splice(n.inArray(r[0],this.model.query.queries),1),this.model.query.page(this._currentPage(),this.model.pageSettings.pageSize)),this._virtualSelectedRows&&this._virtualSelectedRows.length>0&&this.model.query.addParams("virtualSelectRecords",this._virtualSelectedRows),f=this._queryPromise=this._dataSource().executeQuery(this.model.query),proxy._dataSource().ready?proxy._dataSource().ready.done(function(){proxy._processDataRequest(proxy,i,f,u)}):proxy._processDataRequest(proxy,i,f,u)):this._isRelationalRendering(i)?this._setForeignKeyData(i):this.sendDataRenderingRequest(i)},i.prototype._processDataRequest=function(n,i,r,u){r.done(t.proxy(function(r){var e,f,o;if(n._relationalColumns.length==0,u&&!n._previousPageRendered)n.model.previousViewData&&n.model.previousViewData.length!=0&&(n.model.previousViewData.splice(0,r.result.length),n._previousPageLength=r.result.length,n._currentPageData=r.result,t.merge(n.model.previousViewData,r.result),n.model.currentViewData=n.model.previousViewData,n._remoteLastPageRendered=!0);else if(n._remoteLastPageRendered&&n.model.pageSettings.currentPage==n.model.pageSettings.totalPages-1&&!n.model.scrollSettings.enableVirtualization){for(e=n.model.pageSettings.pageSize-n._previousPageLength,f=0;f<e;f++)o=n.getRows()[n.getRows().length-(n.model.pageSettings.pageSize-f)],o.remove();n._tempPageRendered=!0;n.model.currentViewData=r.result}else n.model.pageSettings.currentPage!=n.model.pageSettings.totalPages-1||n._remoteLastPageRendered||(n._previousPageRendered=!0),n.model.currentViewData=r.result==null?[]:r.result,n._$fkColumn&&n.model.filterSettings.filterType=="excel"&&n.model.filterSettings.filteredColumns.length>0&&(n._fkParentTblData=r.result);n.model.allowScrolling&&n.model.scrollSettings.allowVirtualScrolling&&n.model.scrollSettings.enableVirtualization&&(i.requestType=="filtering"&&(n._gridRecordsCount=n._filteredRecordsCount=r.count,n._refreshVirtualViewDetails()),r.result.length?(n._isInitNextPage||n._isLastVirtualpage?(n._setInitialCurrentIndexRecords(r.result,n._currentPage()),n._isInitNextPage=n._isLastVirtualpage=!1):n._setVirtualLoadedRecords(r.result,n._currentPage()),n._isThumbScroll&&!n._checkCurrentVirtualView(n._virtualLoadedRecords,n._currentVirtualIndex)&&n._checkPrevNextViews(),n._remoteRefresh=!0):n.getContent().find(".e-virtualtop, .e-virtualbottom").remove());t.isNullOrUndefined(r.aggregates)||(n._remoteSummaryData=r.aggregates);t.isNullOrUndefined(n._unboundRow)||i.selectedRow==n._unboundRow||i.requestType!="save"||(n._unboundRow.find(".e-editbutton").trigger("click"),n._unboundRow=null)}));r.fail(t.proxy(function(t){i.error=t.error;t=[];n.model.currentViewData=[];n._trigger("actionFailure",i)}))},i.prototype._createUnboundElement=function(i){var f=document.createElement("div"),e,u,r,o;for(i.headerText=t.isNullOrUndefined(i.headerText)?i.field:i.headerText,t.isNullOrUndefined(i.headerText)||(f.id=this._id+i.headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate"),e=t.buildTag("div.e-unboundcelldiv"),u=i.commands,r=0;r<u.length;r++)o=t.buildTag("button.e-"+u[r].type.replace(/\s+/g,"")+"button","",{},{type:"button"}),o.val(u[r].type),e.append(o);return n("body").append(n(f).html(e).hide()),f},i.prototype._gridTemplate=function(n,t,i){var r=n.model.columns[i];return n._isGrouping&&(this.index=n._currentJsonData.indexOf(this.data)),n._renderEjTemplate("#"+t,this.data,this.index,r)},i.prototype._renderEjTemplate=function(i,r,u,f){var e=null;return((typeof i=="object"||i.startsWith("#")||i.startsWith("."))&&(e=n(i).attr("type")),e&&(e=e.toLowerCase(),t.template[e]))?t.template[e](this,i,r,u,f):t.template.render(this,i,r,u,f)},i.prototype._createTemplateElement=function(i,r,u){var e=i["templateID"in i?"templateID":"template"],s=/^#([\w-]*)/.exec(e),r=r||n("body"),f,h=u?"Pager":i.headerText+n.inArray(i,this.model.columns)+"_Template",o={name:"SCRIPT",type:"text/x-template",text:e,id:(this._id+h).replace(/[^0-9A-z-_]/g,"")};return f=s&&s[1]?document.getElementById(s[1]):/^<script/i.test(e)?n(e).get(0):t.buildTag(o.name,o.text).get(0),f.id=f.id||o.id,f.type=f.type||o.type,r.append(u?f.innerHTML:f),f},i.prototype._page=function(n){var t;n.events.text==this.localizedLabels.NextPage?(t=this.model.pageSettings.currentPage,++t,this.gotoPage(t)):n.events.text==this.localizedLabels.PreviousPage?(t=this.model.pageSettings.currentPage,t>1?(--t,this.gotoPage(t)):this.gotoPage(t)):n.events.text==this.localizedLabels.LastPage?(t=this.model.pageSettings.totalPages,this.gotoPage(t)):this.gotoPage(1)},i.prototype.gotoPage=function(n){var i,r,u;(this.model.allowPaging||this.model.allowScrolling||this.model.scrollSettings.allowVirtualScrolling)&&(i={},i.previousPage=this._currentPage(),this._currentPage(n),i.endIndex=this._currentPage()*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:this._currentPage()*this.model.pageSettings.pageSize,i.startIndex=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=n,this.model.allowPaging&&(i.requestType=t.HeatMapGrid.Actions.Paging),this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this._isVirtualRecordsLoaded=!1,u=this._refreshVirtualPagerInfo(),this._showPagerInformation(u),i.requestType=t.HeatMapGrid.Actions.VirtualScroll),r=this._processBindings(i),r&&this._currentPage(i.previousPage),this._primaryKeyValues=[])},i.prototype._checkScrollActions=function(n){return!this.model.scrollSettings.allowVirtualScrolling&&(n==t.HeatMapGrid.Actions.Sorting||n==t.HeatMapGrid.Actions.Reorder)||n==t.HeatMapGrid.Actions.Grouping||n==t.HeatMapGrid.Actions.Ungrouping||n==t.HeatMapGrid.Actions.Add||n==t.HeatMapGrid.Actions.Cancel||n==t.HeatMapGrid.Actions.Save||n==t.HeatMapGrid.Actions.BatchSave||n==t.HeatMapGrid.Actions.Delete||n==t.HeatMapGrid.Actions.Filtering||n==t.HeatMapGrid.Actions.Paging||n==t.HeatMapGrid.Actions.Refresh||n==t.HeatMapGrid.Actions.Search?!0:!1},i.prototype._frozenAlign=function(){var t=this.getContent().first(),i=this.getBrowserDetails(),n;n=this.model.enableRTL?"margin-right":"margin-left";t.find(".e-movablecontent").css(n,i.browser==="safari"?"auto":t.find(".e-frozencontentdiv").width()+"px");this.getHeaderContent().find(".e-movableheader").removeAttr("style").css(n,i.browser==="safari"?"auto":this.getHeaderContent().find(".e-frozenheaderdiv").width()+"px")},i.prototype._refreshScroller=function(n){var r=this.getContent().first(),i,u,f,e,o,s;t.isNullOrUndefined(r.data("ejScroller"))||(this.model.scrollSettings.frozenColumns>0&&(this._frozenAlign(),this.refreshScrollerEvent(),r.find(".e-movablecontent").scrollLeft(this.getHeaderContent().find(".e-movableheader").scrollLeft()),!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&this.getScrollObject()._vScrollbar.value()>this.getScrollObject()._vScrollbar.model.maximum&&(i=this.getScrollObject()._vScrollbar.model.maximum)),this.model.scrollSettings.frozenRows>0&&(this._initFrozenRows(),i=this.getScrollObject().model.scrollTop,!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&i>this.getScrollObject()._vScrollbar.model.maximum&&(i=this.getScrollObject()._vScrollbar.model.maximum),(n.requestType=="cancel"||n.requestType=="save")&&i>this._editFormHeight&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&(i=i-this._editFormHeight),n.requestType==t.Grid.Actions.Add&&this.getScrollObject().scrollY(0,!0),t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)),n.requestType=="beginedit"&&(i=this.getScrollObject().model.scrollTop,this.getScrollObject().scrollY(0,!0)),!t.isNullOrUndefined(this.model.dataSource)&&(n.requestType=="refresh"||n.requestType=="searching")&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData&&this._gridRecordsCount>0?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(1),this._currentVirtualIndex==1&&this.getScrollObject().scrollY(0)),this.model.scrollSettings.frozenColumns>0&&n.requestType!="filtering"?this.rowHeightRefresh():this.getScrollObject().refresh(),r.ejScroller("model.enableRTL",this.model.enableRTL),this.model.isResponsive&&(n.requestType=="searching"||n.requestType=="filtering")&&(u=this.getScrollObject(),f=u.isHScroll()?this.getContentTable().height()+u.model.buttonSize:this.getContentTable().height(),f>this.model.scrollSettings.height&&(f=this.model.scrollSettings.height),e=typeof this.model.scrollSettings.width=="string"?this.element.width()-u.model.buttonSize:this.model.scrollSettings.width,o=e,this.getContent().ejScroller({height:f,width:o})),r.ejScroller("isVScroll")&&!this.getScrollObject().model.autoHide?(this.getHeaderContent().addClass("e-scrollcss"),this.getHeaderContent().find(".e-headercontent").hasClass("e-hscrollcss")||this.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):this._showHideScroller(),this._getRowHeights(),i&&!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&n.requestType!=t.Grid.Actions.Add&&(this._currentTopFrozenRow=0,i>this.getScrollObject()._vScrollbar.model.maximum&&(i=this.getScrollObject()._vScrollbar.model.maximum),this.getScrollObject()._vScrollbar.scroll(i)),n.requestType=="virtualscroll"&&(s=this.getScrollObject().model.scrollTop+this.getScrollObject().model.height-this.getScrollObject().model.height*.3,this.getScrollObject().scrollY(s,!0)))},i.prototype._isFrozenColumnVisible=function(){for(var n=0;n<this.model.scrollSettings.frozenColumns;n++)if(this.model.columns[n].visible)return!0;return!1},i.prototype._frozenPaneRefresh=function(){this.getContent().find(".e-frozencontentdiv").css("display","none");this.getHeaderContent().find(".e-frozenheaderdiv").css("display","none");this.getHeaderContent().find(".e-movableheader")[0].style["margin-left"]="";this.getContent().find(".e-movablecontent")[0].style["margin-left"]="";var i=t.isNullOrUndefined(this._scrollObject._vScrollbar)?0:this._scrollObject._vScrollbar["e-vscroll"].width(),n=this.model.scrollSettings.width-i-1;this.model.scrollSettings.width>this.getContent().find(".e-movablecontentdiv").width()&&(this.getContent().find(".e-movablecontentdiv").width(n),this.getHeaderContent().find(".e-movableheaderdiv").width(n));this._scrollObject.option("scrollLeft",0)},i.prototype._renderScroller=function(){var e,o,u,f,r,l,s,i,h,c;if(this.model.scrollSettings||(this.model.scrollSettings={}),this.model.enablePersistence&&(t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)||!this.model.scrollSettings.previousStateWidth)&&this.model.isResponsive&&(this.model.scrollSettings.previousStateWidth=this.model.scrollSettings.width),typeof this._originalScrollWidth!="string"||this.model.isResponsive||(this.element.css("width","auto"),e=this.element.width(),(this.model.scrollSettings.width=="auto"||this._originalScrollWidth=="auto")&&(this._originalScrollWidth="100%"),this.model.scrollSettings.width=e*(parseFloat(this._originalScrollWidth)/100)),typeof this.model.scrollSettings.height!="string"||this.model.isResponsive||(o=this.element.height(),this.model.scrollSettings.height=="auto"&&(this.model.scrollSettings.height="100%"),this.model.scrollSettings.height=o*(parseFloat(this.model.scrollSettings.height)/100)),(this.model.scrollSettings.width||this.model.width)&&!this._mediaQuery&&this.element.width(this.model.scrollSettings.width||this.model.width),u=this.getContent().attr("tabindex","0"),l=this.getRows(),this.model.scrollSettings.frozenColumns>0){if(s=this.getContent().find(".e-frozencontentdiv").width()+20,s>this.model.scrollSettings.width){this.getContent().remove();this.getHeaderTable().eq(1).remove();return}f=this.getContent().find(".e-frozencontentdiv").width();r=this.model.enableRTL?"margin-right":"margin-left";this.getContent().find(".e-movablecontent").css(r,f+"px");this.getHeaderContent().find(".e-movableheader").css(r,f+"px");this.model.scrollSettings.targetPane=".e-movablecontent"}this._initFrozenRows();this.model.scrollSettings.autoHide&&(this.model.scrollSettings.show=n.proxy(this._showHideScroller,this));i=this;this.model.scrollSettings.frozenRows||(this.model.scrollSettings.scroll=function(n){t.isNullOrUndefined(n.scrollData)||n.scrollData.handler!="e-hhandle"?(i._scrollValue=n.scrollTop,i.model.currentIndex=n.scrollTop==0?n.scrollTop:Math.floor(n.scrollTop/i._vRowHeight)):(i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),i._checkScroller(n,this))});!this.model.scrollSettings.allowVirtualScrolling&&this.model.currentIndex>0&&!this.model.scrollSettings.scrollTop&&(h=this.model.currentIndex*this.getRowHeight(),this.model.scrollSettings.scrollTop=h);this.model.scrollSettings&&!this.model.scrollSettings.height&&(this.model.scrollSettings.height=0);u.ejScroller(this.model.scrollSettings);this.model.rowTemplate!=null&&(this.getBrowserDetails().browser=="msie"||this.getBrowserDetails().browser=="safari")&&this.getScrollObject().refresh();this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenRows==0&&this.getScrollObject()._vScrollbar&&this.getScrollObject()._hScrollbar&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=this.getScrollObject()._hScrollbar._scrollData.skipChange=!0);this.model.scrollSettings.autoHide||this._showHideScroller();this.getBrowserDetails().browser=="safari"&&this.model.scrollSettings.frozenColumns>0&&this.getHeaderContent().find(".e-movableheader").add(this.getContent().find(".e-movablecontent")).css(r,"auto");this.refreshScrollerEvent();this.model.scrollSettings.frozenColumns>0&&!this._isFrozenColumnVisible()&&this._frozenPaneRefresh();i.model.scrollSettings.allowVirtualScrolling&&(c=this._refreshVirtualPagerInfo(),this._showPagerInformation(c),u.ejScroller({scroll:function(r){if(i.model.scrollSettings.enableVirtualization&&r.scrollData!=null&&r.scrollData.handler!="e-hhandle"){if(r.reachedEnd=r.scrollData.scrollable-r.scrollTop==0,r.source=="thumb"){var f=Object.keys(i._virtualLoadedRows),u=(i._currentVirtualIndex+2).toString();i.model.scrollSettings.virtualScrollMode=="continuous"&&n.inArray(u,f)==-1&&u<i._totalVirtualViews?i._isContinuous=!0:(r.model.scrollTop=r.scrollTop,i._isContinuous=!1,r.cancel=!0)}(r.source=="button"||r.source=="key"||r.source=="wheel")&&(i._isThumbScroll=!1,i._virtualViewScroll(r),i.model.scrollSettings.virtualScrollMode=="continuous"&&r.reachedEnd&&this.refresh());i.model.currentIndex=r.scrollTop==0?r.scrollTop:Math.floor(r.scrollTop/i._vRowHeight)}else!t.isNullOrUndefined(r.scrollData)&&r.scrollData.handler=="e-hhandle"&&i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),r.reachedEnd=this.content()[0].scrollHeight-r.scrollTop==this.content()[0].clientHeight,(r.source=="button"||r.source=="key"||r.source=="wheel")&&i.model!=null&&i._virtualScroll(r),r.source=="wheel"&&r.scrollTop!=i._scrollValue&&(r.scrollTop=i._scrollValue),i._checkScroller(r,this)},thumbEnd:function(t){(i.model.scrollSettings.enableVirtualization&&i.model.scrollSettings.virtualScrollMode=="continuous"?t.reachedEnd=t.scrollData.scrollable-t.model.scrollTop==0:t.originalEvent&&!n(t.originalEvent.target).hasClass("e-rowcell")&&(t.reachedEnd=this.content()[0].scrollHeight-t.scrollData.sTop==this.content()[0].clientHeight),t.scrollData.handler!="e-hhandle")&&i.model!=null&&t.originalEvent&&(i.model.scrollSettings.enableVirtualization?(i._isThumbScroll=!0,i._virtualViewScroll(t),i.model.scrollSettings.virtualScrollMode=="continuous"&&t.reachedEnd&&this.refresh()):i._virtualScroll(t))},scrollEnd:function(t){if(t.scrollData.type!="mousewheel"&&(t.scrollData.model==null||t.scrollData.model.orientation!="horizontal")&&i.model.scrollSettings.enableVirtualization&&!i._isContinuous){var r=i._calculateCurrentViewPage(t.model),u=n.inArray(r,i._virtualLoadedPages)!=-1;u?(i._isThumbScroll=!0,i._virtualViewScroll(t),i._totalVirtualViews<=i._maxViews*3&&(this._content[0].scrollTop=t.scrollData.scrollTop)):t.cancel=!0}}}))},i.prototype._checkScroller=function(n,t){var i=n.scrollLeft>0?n.scrollLeft:Math.abs(n.scrollLeft),r;n.source=="thumb"&&(t.content()[0].scrollWidth-i==t.content()[0].clientWidth||i==0)&&(this.model.enableRTL&&(r=i==0?n.scrollData.scrollable:0,n.scrollData.sTop=n.model.scrollLeft=r,t.content().scrollLeft(r)),t.refresh())},i.prototype._showHideScroller=function(){this.getContent().ejScroller("isVScroll")?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this.model.scrollSettings.autoHide||this.getHeaderContent().addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss");this.getBrowserDetails().browser=="msie"||this.model.scrollSettings.frozenColumns!=0||this._mediaQuery||(!this.element.find(".e-gridheader").hasClass("e-scrollcss")&&(this.model.filterSettings.filteredColumns.length||this._hiddenColumns.length)?(this.getHeaderTable().removeAttr("style"),this.getContentTable().removeAttr("style")):(this.getHeaderContent().find("div table").first().width(this.getContentTable().width()),this.getContent().find("div table").first().width(this.getContentTable().width()),this.getHeaderTable().width(this.getContentTable().width())));this.getBrowserDetails().browser=="msie"&&this.model.scrollSettings.frozenColumns==0&&(this.getContent().ejScroller("isVScroll")?this.getContent().width(this.getHeaderContent().width()+18):this.getContent().width(this.getHeaderContent().width()));this._isHscrollcss()},i.prototype._isHscrollcss=function(){var n=this.getContent().data("ejScroller"),t=n&&(n.isHScroll()||n.isVScroll())?"addClass":"removeClass";this.getHeaderContent().find(".e-headercontent")[t]("e-hscrollcss")},i.prototype._initFrozenRows=function(){var i=this.getRows();this.model.currentViewData&&this.model.currentViewData.length!=0&&(this.model.scrollSettings.frozenRows>0&&i!=null?(this.model.scrollSettings.scroll=n.proxy(this._scroll,this),this.getContent().find(".e-frozeny").removeClass("e-frozeny").end().find(".e-frozenrow").removeClass("e-frozenrow"),!t.isNullOrUndefined(i[0][this.model.scrollSettings.frozenRows-1])&&!t.isNullOrUndefined(i[1][this.model.scrollSettings.frozenRows-1])&&this.model.scrollSettings.frozenColumns>0?n(i[0][this.model.scrollSettings.frozenRows-1].cells).add(i[1][this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"):t.isNullOrUndefined(this.getRowByIndex(this.model.scrollSettings.frozenRows-1)[0])||n(i[this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"),this.model.scrollSettings.height=this._rowHeightCollection[Math.floor(this.model.scrollSettings.height/this._rowHeightCollection[1])]+18):delete this.model.scrollSettings.scroll)},i.prototype.refreshScrollerEvent=function(){var i=this;this.getContent().find(".e-content:first,.e-movablecontent").scroll(t.proxy(function(t){if(this.model.scrollSettings.targetPane?this.getHeaderContent().find(".e-movableheader").scrollLeft(n(t.currentTarget).scrollLeft()):this.getHeaderContent().find("div").first().scrollLeft(n(t.currentTarget).scrollLeft()),this.model.scrollSettings.frozenRows>0&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&this.model.isEdit){var i=t.target.scrollTop;this.getContent().find(".e-content").scrollTop(0);this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop+i,!0)}},this));this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").scroll(t.proxy(function(t){var i=n(t.currentTarget);this.model.scrollSettings.targetPane?(this.getContent().find(".e-movablecontent").scrollLeft(i.scrollLeft()),this.model.showSummary&&this.getFooterContent().find(".e-movablefooter").scrollLeft(i.scrollLeft())):(this.model.showSummary&&this.getFooterContent().scrollLeft(i.scrollLeft()),this.getContent().find(".e-content").first().scrollLeft(i.scrollLeft()))},this))},i.prototype._renderByFrozenDesign=function(){var r=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),i={};i.colgroup1=r.append(t.buildTag("colgroup").append(u.splice(0,this.model.scrollSettings.frozenColumns))).html();i.colgroup2=r.html(t.buildTag("colgroup").append(u)).html();this.getContent().find("div").first().get(0).innerHTML=n.render[this._id+"_FrozenTemplate"]({datas:this.model.currentViewData},i);this.setGridContentTable(this.getContent().find(".e-table").attr("role","heatmap"))},i.prototype.addFrozenTemplate=function(){var i="<div class='e-frozencontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup1}}<tbody>{{for datas tmpl='"+this._id+"_JSONFrozenTemplate'/}}<\/tbody><\/table><\/div><div class='e-movablecontent'><div class='e-movablecontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup2}}<tbody>{{for datas tmpl='"+this._id+"_JSONTemplate'/}}<\/tbody><\/table><\/div><\/div>",t={};t[this._id+"_FrozenTemplate"]=i;n.templates(t)},i.prototype._getTopRow=function(n){var i=this.model.scrollSettings.frozenRows,t=0;if(n>10)for(t=0;t<this._rowHeightCollection.length;t++)if(this._rowHeightCollection[t]>n){i=this.model.scrollSettings.frozenRows+t-1;break}return{imaginaryIndex:i,actualIndex:t}},i.prototype._showHideRow=function(t,i,r,u){var f=this.getRows();this.model.scrollSettings.frozenColumns>0?n(f[0]).slice(t,i).add(n(f[1]).slice(t,i).toArray())[r]():n(f).slice(t,i)[r]();this._currentTopFrozenRow=r=="show"?t:i;this.getScrollObject()._changevHandlerPosition(u)},i.prototype._scroll=function(n){var i,f,e,o,u;if(n.scrollData!=null&&n.scrollData.dimension!="width"){n.cancel=!0;var h=this.getRows(),s=this._getTopRow(n.scrollTop),r=s.imaginaryIndex;if(r>this._currentTopFrozenRow?this._showHideRow(this.model.scrollSettings.frozenRows,r,"hide",n.scrollTop):r<this._currentTopFrozenRow&&this._showHideRow(r,this._currentTopFrozenRow+1,"show",n.scrollTop),i=this.getContentTable().last().find("tr"),f=parseInt(i.last().find("td:first").css("border-top-width"))*2+1,n.scrollTop==this.getScrollObject()._vScrollbar.model.maximum&&i.last()[0].offsetTop+i.last().height()-f>this.element.find(".e-content").height()){for(e=i.last().prev()[0].offsetTop+i.last().prev().height(),o=1,u=i.length-2;e-f>this.element.find(".e-content").height();u++){e=i[u].offsetTop+i.eq(u).height();o++;break}this._showHideRow(this.model.scrollSettings.frozenRows,r+o,"hide",n.scrollTop)}n.model.scrollTop=n.scrollTop}else t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)},i.prototype._virtualScroll=function(t){var i,f;if(t!=null){var u=0,e=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r=this.model.pageSettings,o=this.getContentTable()[0].tBodies[0],s=n(o).find("tr.e-virtualrow");if(r.totalPages=Math.ceil(e/r.pageSize),t.scrollTop!==undefined&&(t.model.scrollTop=t.scrollTop),t.reachedEnd!=undefined&&(t.model.reachedEnd=t.reachedEnd),i=this._calculateCurrenPage(s,this.getContentTable(),t.model),i>r.totalPages&&(i=r.totalPages),r.currentPage!=i&&n.inArray((i-1)*r.pageSize,this.virtualLoadedPages)==-1&&(this._isVirtualRecordsLoaded=!1),this._isVirtualRecordsLoaded)r.currentPage=i;else{if(n.inArray((i-1)*r.pageSize,this.virtualLoadedPages)==-1){if(this.model.scrollSettings.virtualScrollMode=="continuous"&&!t.reachedEnd)return;i==r.totalPages&&n.inArray((i-2)*r.pageSize,this.virtualLoadedPages)==-1&&(u++,this.set_currentPageIndex(i));u==1&&(this._lastRow=!0);this.set_currentPageIndex(i)}r.currentPage=i}f=this._refreshVirtualPagerInfo();this._showPagerInformation(f)}},i.prototype._virtualViewScroll=function(t){if(t!=null){t.scrollTop!==undefined&&(t.model.scrollTop=t.scrollTop);t.reachedEnd!=undefined&&(t.model.reachedEnd=t.reachedEnd);var i=this._calculateCurrentVirtualIndex(t);n.inArray(i,this._currentLoadedIndexes)==-1&&(this._isVirtualRecordsLoaded=!1);this._isVirtualRecordsLoaded||this.set_currentVirtualIndex(i)}},i.prototype._refreshVirtualContent=function(t){var f=this.getRowHeight(),e=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,o,i,u,s,h,c,r;t!=null&&(this._currentPage(t),o=this._refreshVirtualPagerInfo(),this._showPagerInformation(o));i=this.getCurrentIndex();u=this.getContentTable()[0].tBodies[0];i>0&&(s=document.createElement("tr"),n(s).addClass("e-virtualrow").css("height",f*i).prependTo(u));i+this.model.pageSettings.pageSize<=e&&this.getContentTable().find("tr").last().hasClass("e-virtualrow")!=!0&&this.model.scrollSettings.frozenColumns==0&&(h=document.createElement("tr"),c=this.model.scrollSettings.virtualScrollMode=="normal"?f*(e-(i+this.model.pageSettings.pageSize)):1,n(h).addClass("e-virtualrow").css("height",c).appendTo(n(u)));this.virtualLoadedPages=[];this.orderedVirtualLoadedPage=[];this.virtualLoadedPages.push(i>=0?i:0);this.orderedVirtualLoadedPage.push(i>=0?i:0);r=n(u).find("tr:not(.e-virtualrow)").attr("name",i>=0?i:0)[0];r&&r.previousSibling&&(n(r.previousSibling).hasClass("e-virtualrow")||r.previousSibling.offsetTop>i*this.getContent().height())&&(this.getContent().children("div").first().scrollTop(this.getContent().find(".content").scrollTop()-(this.getContent().find(".content").scrollTop()-r.offsetTop)),this._isVirtualRecordsLoaded=!0)},i.prototype._refreshVirtualView=function(t){var u,e,r,o,h,f,i;if(this._singleView)this._singleView=!1,this._addLastRow(),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),f=this._currentVirtualIndex.toString(32),n(this._gridRows).attr("name",f),this._virtualLoadedRows[this._currentVirtualIndex]=this._gridRows,this._eventBindings();else{if(u=this._virtualRowCount,t)t>this._totalVirtualViews&&(t=1,e=!0),this._currentVirtualIndex=t,this._virtualLoadedRecords[t]?r=Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize):(this._virtualDataRefresh||this._currentVirtualIndex==this._totalVirtualViews||(e=!0),r=Math.ceil(t*this._virtualRowCount/this.model.pageSettings.pageSize)),this._refreshVirtualViewScroller(e),r>this.model.pageSettings.totalPages&&(r=this.model.pageSettings.totalPages),r<=0&&(r=1),n.inArray(r,this._virtualLoadedPages)==-1?this.gotoPage(r):(this._currentPage(r),this._needPaging=this._checkCurrentVirtualView(this._virtualLoadedRecords,t)?!1:!0,this._getVirtualLoadedRecords(this.model.query),this._replacingVirtualContent());else{if(this._refreshVirtualViewDetails(),o=n(this.getContentTable()[0].rows),this._setVirtualTopBottom(),this.initialRender){for(i=0;i<this._currentLoadedIndexes.length;i++){var s=this._currentLoadedIndexes[i],l=(i+1)*u,c=i*u;n(o[l-1]).addClass("e-virtualview"+s);f=s.toString(32);h=o.slice(c,c+u).attr("name",f).detach();this._virtualLoadedRows[s]=h;h.appendTo(this.getContentTable())}this._currentVirtualIndex>1&&this._refreshVirtualViewScroller()}this._eventBindings()}n.inArray(this._currentPage(),this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(this._currentPage())}if(!t&&(this.model.queryCellInfo||this.model.rowDataBound))for(i=0;i<this._currentLoadedIndexes.length;i++)n.inArray(this._currentLoadedIndexes[i],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[i]);this._isThumbScroll=!1;this._virtualDataRefresh=!1},i.prototype._refreshVirtualViewData=function(){this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualLoadedPages=[];this._virtualPageRecords={};this._queryCellView=[];this.model.pageSettings.totalPages!=null&&this._currentPage()>this.model.pageSettings.totalPages&&(this._currentPage(1),this._currentVirtualIndex=1)},i.prototype.setCurrentPageData=function(n){this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._refreshVirtualViewDetails(),this._setVirtualLoadedRecords(n,this._currentPage()),this._refreshVirtualView(this._currentVirtualIndex))},i.prototype._refreshVirtualViewScroller=function(n){var t,i;this.initialRender&&!this.model.scrollSettings.scrollTop||n?(i=this._vRowHeight,t=this.model.currentIndex*this._vRowHeight):t=this._scrollObject.model.scrollTop;this.getContent().ejScroller("model.scrollTop",t);this._scrollValue=t},i.prototype._calculateCurrentViewPage=function(n){n||(n=this._scrollObject.model);var i=this.model.pageSettings.pageSize,t=Math.ceil((n.scrollTop+this.model.scrollSettings.height)/this._vRowHeight/i);return this.model.pageSettings.totalPages==null&&(this.model.pageSettings.totalPages=Math.ceil(this._getVirtualTotalRecord()/i)),t>this.model.pageSettings.totalPages&&(t=this.model.pageSettings.totalPages),t},i.prototype._calculateCurrentVirtualIndex=function(t){var h=t.model,p=this._getVirtualTotalRecord(),i,c,l,u=[],e,o,a,r=h.scrollTop,y=r+this.model.scrollSettings.height,s,v,f;if(i=y/this._vRowHeight/this._virtualRowCount,i=this._prevVirtualIndex>this._currentVirtualIndex&&r<=this._scrollValue?Math.floor(i):Math.ceil(i),r>=this._scrollValue&&h.virtualScrollMode=="continuous"&&h.reachedEnd&&(i=i+1),i>this._totalVirtualViews&&(i=this._totalVirtualViews),i<=0&&(i=1),n.inArray(i,this._currentLoadedIndexes)!==-1&&this._virtualLoadedRows[i]&&r!=t.scrollData.scrollable){for(s=this.getContentTable()[0].rows,a=s.length,v=this.getContent().find(".e-virtualtop").height(),l=r>=this._scrollValue,f=0;f<a;f++){if(e=s[f],o=e.offsetHeight+e.offsetTop+v,o>r+this.model.scrollSettings.height){u.length===0&&f!==0&&(u=[s[e.offsetTop<=r+this.model.scrollSettings.height?f:f-1]]);break}if(o>=r&&o<=r+this.model.scrollSettings.height&&(u.push(e),l===!1&&u.length>1))break}c=n(r>=this._scrollValue?u[u.length-1]:u[0]);c.length&&(i=parseInt(c.attr("name"),32))}return this._scrollValue=r,i},i.prototype._calculateCurrenPage=function(t,i,r){var o=this.model.pageSettings.pageSize,u,a=this,v,w,f=[],s,h,b,k,y,g=this.getRowHeight(),c,e,l,p,d;if(u=(r.scrollTop+this.model.scrollSettings.height)/g/o,k=this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1),y=this.getContentTable().find("tr[name="+k+"]").eq(0),u=y.length&&y.offset().top>0&&u>=1&&r.scrollTop<this._scrollValue&&this.virtualLoadedPages.indexOf(Math.ceil(u-1)*o)!==-1?Math.floor(u):Math.ceil(u),r.scrollTop>=this._scrollValue&&r.virtualScrollMode=="continuous"&&r.reachedEnd&&(u=this.virtualLoadedPages[this.virtualLoadedPages.length-1]/o+2),n.inArray((u-1)*o,this.virtualLoadedPages)!==-1){for(c=this.getContentTable().children("tbody").children("tr"),b=c.length,w=r.scrollTop>=this._scrollValue,e=0;e<b;e++){if(s=c[e],h=s.offsetHeight+s.offsetTop,h>r.scrollTop+a.model.scrollSettings.height){f.length===0&&e!==0&&(f=[c[s.offsetTop<=r.scrollTop+a.model.scrollSettings.height?e:e-1]]);break}if(h>=r.scrollTop&&h<=r.scrollTop+a.model.scrollSettings.height&&(f.push(s),w===!1&&f.length>1))break}v=n(r.scrollTop>=this._scrollValue?f[f.length-1]:f[0]);v.hasClass("e-virtualrow")?f.length===1&&u++:u=parseInt(v.attr("name"),10)/o+1}for(this._scrollValue=r.scrollTop,l=0;l<t.length;l++)if(p=t[l],p.offsetTop+p.offsetHeight>=r.scrollTop)return d=this._calculatePrevPage(t,i,r),this._prevPageNo=d,u==0&&(u=1),u>this.model.pageSettings.totalPages?this.model.pageSettings.totalPages:u;return u},i.prototype._calculatePrevPage=function(t,i,r){for(var f,e,u=0;u<t.length;u++)if(f=t[u],f.offsetTop+f.offsetHeight>=r.scrollTop&&(e=n(f).prevAll("tr[name]")[0],e!=null))return Math.ceil(parseInt(n(e).attr("name"),10)/this.model.pageSettings.pageSize)+1;return-1},i.prototype._refreshVirtualPagerInfo=function(){var n={};return n.pageSize=this.model.pageSettings.pageSize,n.currentPage=this._currentPage(),n.totalRecordsCount=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,n.totalPages=Math.ceil(n.totalRecordsCount/n.pageSize),n},i.prototype._showPagerInformation=function(t){var i=(t.currentPage-1)*t.pageSize;n(this.$pagerStatusBarDiv).find("div:first").html(String.format("{0} of {1} pages ({2} items)",t.currentPage,t.totalPages,t.totalRecordsCount),i,i+t.pageSize);n(this.$pagerStatusBarDiv).css("display","block")},i.prototype._replacingContent=function(){var yt=document.createElement("div"),u=this.getCurrentIndex(),o=this.getContentTable()[0],rt=n(o).find("colgroup").first(),l=this.getRowHeight(),r,a,ut,f,h,b,e,y,ft,k,et,d,ot,st,nt,i,s,at,tt,kt,dt,it,vt;rt.replaceWith(this._getMetaColGroup());(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&rt.prepend(this._getIndentCol());r=o.tBodies[0];a=this.model.currentViewData;t.isNullOrUndefined(this._currentPageData)?this._virtualLoadedRecords[this._currentPage()]=a:(this._virtualLoadedRecords[this._currentPage()]=this._currentPageData,this._currentPageData=null);var pt=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](a)),w=this,v=pt.children("tr");if(this._allowcolumnSelection&&this.selectedColumnIndexes.length>0)for(s=0;s<this.selectedColumnIndexes.length;s++)ut=this.selectedColumnIndexes[s]+1,v.find("td:nth-of-type("+ut+")").addClass("e-columnselection");for(this.virtualLoadedPages.push(u>=0?u:0),f=t.dataUtil.mergeSort(t.distinct(this.virtualLoadedPages)),n(v).attr("name",u),h=t.dataUtil.min(f),b=t.dataUtil.max(f),n(r).children(".e-virtualrow").remove(),i=0;i<f.length;i++)e=f[i],y=f[i-1],(e!=this.orderedVirtualLoadedPage[i]||this.orderedVirtualLoadedPage[i]==undefined)&&(y!=undefined?v.insertAfter(n(r).children("[name="+y+"]:last")):v.insertBefore(n(r).children("[name="+this.orderedVirtualLoadedPage[i]+"]:first")),this.orderedVirtualLoadedPage=f),e!=0&&(ft=e==h?h:y,k=e-ft-w.model.pageSettings.pageSize,k>0&&(et=document.createElement("tr"),n(et).addClass("e-virtualrow").css("height",l*k).insertBefore(n(r).children("[name="+e+"]:first")))),e==b&&(d=w._gridRecordsCount-b-w.model.pageSettings.pageSize,d>0&&(ot=document.createElement("tr"),n(ot).addClass("e-virtualrow").css("height",l*d).appendTo(r)));h>0&&(st=document.createElement("tr"),n(st).addClass("e-virtualrow").css("height",l*h).prependTo(r));var ht=this.getContent(),p=n(r).children("tr[name="+u+"]")[0],g=p.previousSibling,ct=ht.height(),lt=p.offsetTop;if(this._virtaulUnSel)for(nt=n.extend(!0,[],this._virtaulUnSel),i=0;i<nt.length;i++){var c=nt[i],wt=this.model.pageSettings.currentPage,bt=c%this.model.pageSettings.pageSize==0?parseInt(c/this.model.pageSettings.pageSize):parseInt(c/this.model.pageSettings.pageSize)+1;bt==wt&&(s=c%this.model.pageSettings.pageSize,at=n(r).find("tr[name="+u+"]").eq(s),at.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),tt=this._virtaulUnSel.indexOf(c),tt!=-1&&this._virtaulUnSel.splice(tt,1))}(p&&g&&(this._virIndex||n(g).hasClass("e-virtualrow")||g.offsetTop>u*ct)&&(this._gridRecordsCount-u>=this.model.pageSettings.pageSize||p.offsetParent.offsetHeight-lt<ct)||this._lastRow)&&(this._lastRow&&(this._lastRow=!1),this._virIndex&&(this._virIndex=!1),this._isVirtualRecordsLoaded=!0,ht.find(".e-content").scrollTop(lt),this._scrollValue=this.getContent()[0].firstChild.scrollTop);kt=n(o).get(0);dt=yt.firstChild;this._currentJsonData=a;this._gridRows=n(o).get(0).rows;it=n(o).find(".e-virtualrow").last();vt=this.model.scrollSettings.virtualScrollMode=="normal"?it.height()-(n(o).height()-this._gridRecordsCount*l):1;it.css("height",vt);this._eventBindings()},i.prototype._replacingVirtualContent=function(){var f=this.getContentTable()[0],e=this._currentLoadedIndexes,r=n("<tbody><\/tbody>"),s,l,i,u,a,h,c,t;if(this._checkCurrentVirtualView(this._virtualLoadedRows,this._currentVirtualIndex)){for(s=[],t=0;t<e.length;t++)n.merge(s,this._virtualLoadedRows[e[t]]);n(r).append(s)}else for(l=n("<tbody><\/tbody>"),t=0;t<e.length;t++)if(i=e[t],u=this._virtualLoadedRows[i],u)i<this._currentVirtualIndex?(c=r.find(".e-virtualview"+i),c.length?n(u).insertBefore(c):r.prepend(u)):n(u).insertAfter(r.find(".e-virtualview"+(i-1)));else{var l=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](this._virtualLoadedRecords[i])),o=l[0].rows,v=o.length-1;n(o[v]).addClass("e-virtualview"+i);a=i.toString(32);h=n(o).attr("name",a);(h.length==this._virtualRowCount||i==this._totalVirtualViews)&&(this._virtualLoadedRows[i]=h,r.append(o))}if(f.replaceChild(r[0],f.lastChild),n(f.rows).removeClass("e-hover"),this._setVirtualTopBottom(),(this._isThumbScroll||this._remoteRefresh)&&(this._scrollObject._content[0].scrollTop=this._scrollObject.scrollTop(),this._isThumbScroll=this._remoteRefresh=!1),this.model.allowSelection&&this._checkVirtualSelection(),this._gridRows=f.rows,this._checkCurrentVirtualView(this._queryCellView,this._currentVirtualIndex)||this._eventBindings(),this.model.queryCellInfo||this.model.rowDataBound)for(t=0;t<this._currentLoadedIndexes.length;t++)n.inArray(this._currentLoadedIndexes[t],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[t])},i.prototype._setVirtualTopBottom=function(){var f=this.getContentTable()[0],c=this._vRowHeight,v=t.dataUtil.mergeSort(t.distinct(this._currentLoadedIndexes)),y=t.dataUtil.min(v),e=t.dataUtil.max(v),p=this._getVirtualTotalRecord(),a,l,w,i,u,h,o,r,s;if(this.model.scrollSettings.virtualScrollMode=="continuous"&&this._virtualLoadedRows[e+1]&&(w=Object.keys(this._virtualLoadedRows),l=parseInt(t.dataUtil.max(w),10),e=l-e),a=e*this._virtualRowCount*c,n.inArray(this._totalVirtualViews,this._currentLoadedIndexes)!=-1&&this._currentVirtualIndex!=this._totalVirtualViews&&(a=(p-(this._virtualRowCount-this._lastViewData))*c),i=p*c-a,this.model.scrollSettings.virtualScrollMode!="continuous"||this._virtualLoadedRows[e+1]||(i=l&&l<=e+1?i:1),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),u=1e6,i>0&&this._getVirtualTotalRecord()>this._virtualRowCount*2)if(Math.round(i).toString().length<7)t.buildTag("div.e-virtualbottom","",{height:i}).insertAfter(f);else for(t.buildTag("div.e-virtualbottom").insertAfter(f),o=Math.ceil(i/u),r=0;r<o;r++)s=u,r==o-1&&(s=i%u),n(f).next().append(t.buildTag("div","",{height:s}));if(y>1)if(h=(y-1)*this._virtualRowCount*c,Math.round(h).toString().length<7)t.buildTag("div.e-virtualtop","",{height:h}).insertBefore(f);else for(t.buildTag("div.e-virtualtop").insertBefore(f),o=Math.ceil(h/u),r=0;r<o;r++)s=u,r==o-1&&(s=h%u),n(f).prev().append(t.buildTag("div","",{height:s}));this._scrollObject.model.scrollTop!=this._scrollValue&&this.getContent().ejScroller("model.scrollTop",this._scrollValue)},i.prototype._checkVirtualSelection=function(){for(var e,i,r,s,a,f,o,l,u=this.getContentTable()[0],t=0;t<this.selectedRowsIndexes.length;t++)i=this.selectedRowsIndexes[t],r=this._getSelectedViewData(i).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&(e=i%this._virtualRowCount+this._currentLoadedIndexes.indexOf(r)*this._virtualRowCount,n(u.rows[e].cells).hasClass("e-selectionbackground")||(n(n(u.rows[e]).attr("aria-selected","true")[0].cells).addClass("e-selectionbackground e-active"),this.model.selectedRecords[t]=this._virtualLoadedRecords[r][e%this._virtualRowCount]));for(t=0;t<this._rowIndexesColl.length;t++)i=this._rowIndexesColl[t],r=this._getSelectedViewData(i).viewIndex,(n.inArray(r,this._currentLoadedIndexes)!=-1&&n.inArray(i,this._virtualRowCellSelIndex)==-1||this._virtualDataRefresh)&&(s=n.inArray(i,this._rowIndexesColl),a=this.selectedRowCellIndexes[s].cellIndex);for(f=n(u.rows).find(".e-active, .e-cellselectionbackground").closest("tr"),t=0;t<f.length;t++){var v=parseInt(n(f[t]).attr("name"),32)*this._virtualRowCount,y=this._virtualRowCount-n(f[t]).index()%this._virtualRowCount,h=v-y,c=n(f[t]).index();this.selectedRowsIndexes.length&&n.inArray(h,this.selectedRowsIndexes)==-1&&(this._clearVirtualSelection=!0,this.clearSelection(c));this._rowIndexesColl.length&&n.inArray(h,this._rowIndexesColl)==-1&&n(this.getRowByIndex(c)[0].cells).removeClass("e-cellselectionbackground e-activecell")}for(n(u.rows).find(".e-columnselection").removeClass("e-columnselection"),o=0;o<this.selectedColumnIndexes.length;o++)l=this.selectedColumnIndexes[o]+1,n(u.rows).find("td:nth-of-type("+l+")").addClass("e-columnselection");this._clearVirtualSelection=!1},i.prototype._calculateWidth=function(){for(var t=this.getHeaderTable().find(".e-columnheader").last().find("th:visible"),i=0,n=0;n<t.length;n++)i+=t.eq(n).outerWidth();return i},i.prototype.columns=function(i,r){var f,u,e,o,s;if(!t.isNullOrUndefined(i)){for(f=!1,typeof i=="string"?(i=[i],f=!0):i instanceof Array&&i.length&&typeof i[0]=="string"&&(f=!0),u=0;u<i.length;u++)e=n.inArray(this.getColumnByField(f?i[u]:i[u].field),this.model.columns),r=="add"||t.isNullOrUndefined(r)?e==-1?this.model.columns.push(f?{field:i[u]}:i[u]):this.model.columns[e]=f?{field:i[u]}:i[u]:e!=-1&&this.model.columns.splice(e,1);for(this.columnsWidthCollection=[],o=!1,s=0;s<this.model.columns.length;s++)this.columnsWidthCollection.push(this.model.columns[s].width),t.isNullOrUndefined(o)||(o=!0);this._enableRowHover(o);(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.refreshContent(!0);this.model.allowScrolling&&(this.refreshScrollerEvent(),this.model.allowResizeToFit&&this.getContent().ejScroller("isVScroll")&&this._showHideScroller())}},i.prototype._enableRowHover=function(i,r){var f=!0,u;if(t.isNullOrUndefined(i)){for(u=0;u<this.model.columns.length;u++)if(!t.isNullOrUndefined(this.model.columns[u].tooltip)){f=!0;break}}else f=i;this.model.enableRowHover||f?r._on(this.element,"mouseenter mouseleave",".e-gridcontent tr td",n.proxy(this._rowHover,this)):r._off(this.element,"mouseenter mouseleave",".e-gridcontent tr td")},i.prototype._rowHover=function(i){var u=n(i.target),r,f;if(r=this.model.scrollSettings.frozenColumns?n(this.getRows()):this.element.find(".e-row.e-hover,.e-alt_row.e-hover"),(!u.closest("#"+this._id+"EditForm").length||!u.hasClass("e-rowcell"))&&u.hasClass("e-rowcell"))return i.type=="mouseenter"&&u.hasClass("e-gridtooltip")&&this._showTooltip(u),this.model.enableRowHover&&(i.type!="mouseenter"||this._dragActive?(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(r[0])&&!t.isNullOrUndefined(r[1])&&(r=n(r[0]).add(r[1])),r.removeClass("e-hover")):this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(r[0])&&!t.isNullOrUndefined(r[1])?(r=n(r[0]).add(r[1]),r.removeClass("e-hover"),f=this.getIndexByRow(u.parent()),f!=-1&&this.getRowByIndex(f).addClass("e-hover")):(r.removeClass("e-hover"),(u.parent().hasClass("e-row")||u.parent().hasClass("e-alt_row"))&&u.parent().addClass("e-hover"))),!1},i.prototype._showTooltip=function(i,r){var e=i.index(),l=i.hasClass("e-stackedHeaderCell"),u,o,c,a,f,h,s,v;if(i.hasClass("e-headercelldiv")&&(e=i.parent(".e-headercell").index()-this.model.groupSettings.groupedColumns.length),!l&&(this.model.childGrid||this.model.detailsTemplate)&&e--,this.model.scrollSettings.frozenColumns>0&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(e=e+this.model.scrollSettings.frozenColumns),u=l?this._getStackedColumnByTarget(i):this.getColumnByIndex(e),u.clipMode!=t.HeatMapGrid.ClipMode.Ellipsis){if(u.clipMode==t.HeatMapGrid.ClipMode.EllipsisWithTooltip&&(o=i,i.find("span").hasClass("e-tooltip")||(c=t.buildTag("span.e-tooltip",{},{}),c.html(i.html()),o.html(c)),o.find("span.e-tooltip").css("display","inline-block"),a=o.find("span:first")[0].getBoundingClientRect().width,o.find("span.e-tooltip").css("display","inline"),i.width()>a)){i.removeAttr("title");return}if(f=document.createElement("script"),t.isNullOrUndefined(u.tooltip)&&t.isNullOrUndefined(u.headerTooltip))return;f.id=(this._id+u.headerText+n.inArray(u,this.model.columns)+"_TemplateToolTip").split(" ").join("");f.type="text/x-template";s=r?"headerTooltip":"tooltip";t.isNullOrUndefined(u[s])||u[s].slice(0,1)==="#"?h=n(u[s]):f.text=u[s];h&&(f.text=h.html(),f.type=h.attr("type")||f.type);n("body").append(f);v=n(f).render({value:i.text()});i.attr("title",v)}else i.removeAttr("title")},i.prototype._colgroupRefresh=function(){var t,i,r,u;(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(t=n(this.getHeaderTable()).find("colgroup"),i=n(this.getContentTable()).find("colgroup")):(t=n(this.getHeaderTable()).find("colgroup")[0],i=n(this.getContentTable()).find("colgroup")[0]);r=n(t).clone();u=n(i).clone();n(i).remove();n(t).remove();(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(n(r[0]).prependTo(this.getHeaderTable()[0]),n(r[1]).prependTo(this.getHeaderTable()[1]),n(u[0]).prependTo(this.getContentTable()[0]),n(u[1]).prependTo(this.getContentTable()[1])):(n(r).prependTo(this.getHeaderTable()),n(u).prependTo(this.getContentTable()))},i.prototype._detailColsRefresh=function(){this._$headerCols=this.getHeaderTable().children("colgroup").find("col");this._$contentCols=this.getContentTable().children("colgroup").find("col");var n=this.model.columns.length;this._$headerCols.length>n&&this._$headerCols.splice(0,this._$headerCols.length-n);this._$contentCols.length>n&&this._$contentCols.splice(0,this._$contentCols.length-n)},i.prototype._htmlEscape=function(n){var t={"&":"&","<":"<",">":">",'"':""","'":"'"};return n.replace(/[&<>"']/g,function(n){return t[n]})},i.prototype._getForeignKeyData=function(n){for(var u,e,r=this,f={},i=0;i<this.model.columns.length;i++)this.model.columns[i].foreignKeyValue&&this.model.columns[i].dataSource&&(u=t.isNullOrUndefined(r.model.columns[i].foreignKeyField)?r.model.columns[i].field:r.model.columns[i].foreignKeyField,e=this.model.columns[i].dataSource instanceof t.DataManager?this.model.columns[i].foreignKeyData:this.model.columns[i].dataSource,e.filter(function(t){var e=n[r.model.columns[i].field],o=!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):e;t[u]==o&&(f[u]=t)}));return f},i.prototype._foreignKeyBinding=function(i,r,u){var f,e,o=n("#"+u).ejGrid("instance"),s;return i=o.model.columns[i],s=i.dataSource instanceof t.DataManager?i.foreignKeyData:i.dataSource,s.filter(function(n){if(t.getObject(i.foreignKeyField,n)==r)return e=t.getObject(i.foreignKeyValue,n),f=i.type=="date"?new Date(e):e}),i.format&&(f=o.formatting(i.format,f,o.model.locale)),f},i.prototype._setForeignKeyData=function(){var f;if(this._relationalColumns.length){var c=this._relationalColumns,l=this._relationalColumns.length,a=[],u=this.model.currentViewData,i={},r,e,o,s,v=this,h=t.proxy(function(n){this._trigger("actionFailure",{requestType:"fetchingforeigndata",error:n.error})},this);for(f=0;f<l;f++)if(0 in u){if(r=c[f],i.field=r.field,i.keyField=r.key,i.valueField=r.value,i.dataSource=r.dataSource,i.query=(new t.Query).select([i.valueField,i.keyField]).foreignKey(i.keyField),o=t.distinct(u.level?u.records:u,i.keyField,!0),e=t.UrlAdaptor.prototype.getFiltersFrom(o,i.query),i.query.where(e),this._trigger("actionBegin",n.extend(i,{requestType:"fetchingforeigndata",column:this.getColumnByField(i.field)})))return;s=i.dataSource.ready===undefined?i.dataSource.executeQuery(i.query,null,h):i.dataSource.ready.fail(h);a.push(s)}}},i.prototype._isRelationalRendering=function(n){return 0 in this._relationalColumns&&["add","beginedit","cancel"].indexOf(n.requestType)==-1},i.prototype._columns=function(){var n=this.element.find(".e-gridheader");n.find("div").first().empty().append(this._renderGridHeader().find("table"));this._headerCellgDragDrop();this.refreshContent(!0);this._trigger("refresh")},i.prototype._summaryRows=function(n,i,r){if(i=="showTotalSummary"||i=="showCaptionSummary"){var u=n.summaryRows,f=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;this.option("summaryRows")[u][i]=f}this.element.find(".e-gridfooter").remove();(i=="showCaptionSummary"||i=="title")&&(this._isCaptionSummary=this.option("summaryRows")[u].showCaptionSummary,this.model.showSummary=this._isCaptionSummary,this.model.groupSettings.groupedColumns.length!=0&&this._refreshCaptionSummary())},i.prototype._summaryRows_summaryColumns=function(n,i,r){(i=="displayColumn"||i=="dataMember")&&t.isNullOrUndefined(this.getColumnByField(r))||this.element.find(".e-groupcaptionsummary").length!=0&&this._refreshCaptionSummary()},i.prototype._stackedHeaderRows_stackedHeaderColumns=function(){this._refreshStackedHeader()},i.prototype._sortSettings_sortedColumns=function(n,t,i){var u,f,r=this.model.sortSettings.sortedColumns[n["sortSettings.sortedColumns"]];t=="field"?(u=this.getColumnByField(i)!=null?i:null,f=r.direction=="ascending"||r.direction=="descending"?r.direction:null):t=="direction"&&(u=this.getColumnByField(r.field)!=null?r.field:null,f=i=="ascending"||i=="descending"?i:null);u!=null&&f!=null&&this.sortColumn(u,f)},i.prototype._filterSettings_filteredColumns=function(n,i,r){var f,e,o,s,h,u=this.model.filterSettings.filteredColumns[n["filterSettings.filteredColumns"]];switch(i){case"field":f=this.getColumnByField(r)!=null?r:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"matchcase":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;break;case"operator":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,r);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"predicate":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=r=="and"||r=="or"?r:null;o=u.matchcase;break;case"value":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=r;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase}f!=null&&e!=null&&h!=null&&s!=null&&o!=null&&this.filterColumn(f,e,h,s,o)},i.prototype._map=function(t,i){var r=n.map(t,function(n){if(n===i)return n});return r.length!=0?r[0]:null},i.prototype._refreshCaptionSummary=function(){var t=document.createElement("div");t.innerHTML=["<table>",n.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("");this.getContentTable().get(0).replaceChild(t.firstChild.firstChild,this.getContentTable().get(0).lastChild);this.refreshContent()},i.prototype.getContentTable=function(){return this._gridContentTable},i.prototype.setGridContentTable=function(n){this._gridContentTable=n},i.prototype.getContent=function(){return this._gridContent},i.prototype.setGridContent=function(n){this._gridContent=n},i.prototype.getHeaderContent=function(){return this._gridHeaderContent},i.prototype.getHeaderTable=function(){return this._gridHeaderTable},i.prototype.getRows=function(){return this._gridRows},i.prototype.getFilteredRecords=function(){return this._filteredRecords},i.prototype.getRowByIndex=function(i,r){var e;try{var f=this.getRows(),o=this._excludeDetailRows(),u=n();if(n.isArray(i)){for(e=0;e<i.length;e++)this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i[e]]),u.push(f[1][i[e]])):u.push(f[i[e]]);return u}return t.isNullOrUndefined(r)?this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i]),u.push(f[1][i]),u):n(o.not(".e-virtualrow")[i]):this.model.scrollSettings.frozenColumns>0?(u.push(n(f[0]).slice(i,r)),u.push(n(f[1]).slice(i,r)),u):n(o.not(".e-virtualrow").slice(i,r))}catch(s){return n()}},i.prototype.getColumnIndexByField=function(n){for(var t=0,i=this.model.columns,r=i.length;t<r;t++)if(i[t].field===n)return t;return-1},i.prototype.getColumnIndexByHeaderText=function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r},i.prototype.getIndexByRow=function(t){var r=this.getRows(),u=this._excludeDetailRows(),i;return this.model.scrollSettings.frozenColumns>0?(i=n(r[0]).index(t),i==-1&&(i=n(r[1]).index(t)),i):u.not(".e-virtualrow").index(t)},i.prototype.getPrimaryKeyFieldNames=function(){if(this._primaryKeys.length!=0)return this._primaryKeys;for(var n=0,t=this.model.columns,i=t.length;n<i;n++)t[n].isPrimaryKey&&this._primaryKeys.push(t[n].field);return this._primaryKeys},i.prototype.getVisibleColumnNames=function(){return this._visibleColumns},i.prototype.getHiddenColumnNames=function(){return this._hiddenColumns},i.prototype.getColumnByField=function(n){for(var t=0;t<this.model.columns.length;t++)if(this.model.columns[t].field==n)break;return t==this.model.columns.length?null:this.model.columns[t]},i.prototype.getsortColumnByField=function(n){for(var t=0;t<this.model.sortSettings.sortedColumns.length;t++)if(this.model.sortSettings.sortedColumns[t].field==n)break;return t==this.model.sortSettings.sortedColumns.length?null:this.model.sortSettings.sortedColumns[t]},i.prototype.getColumnByHeaderText=function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r==this.model.columns.length?null:this.model.columns[r]},i.prototype.getCurrentViewData=function(){return this._currentJsonData},i.prototype.getColumnFieldNames=function(){for(var t=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].field&&t.push(this.model.columns[n].field);return t},i.prototype.getBrowserDetails=function(){var t=navigator.userAgent.match(/(firefox|mozilla|chrome|opera|msie|safari)\s?\/?(\d+(.\d+)*)/i);return!navigator.userAgent.match(/Trident\/7\./)?{browser:t[1].toLowerCase(),version:t[2]}:{browser:"msie",version:n.uaMatch(navigator.userAgent).version}},i.prototype._initComplexColumn=function(n,i,r){var e=r||i,u,o,f;for(u in n)typeof n[u]!="object"||t.isNullOrUndefined(n[u])?(o=e.concat(".").concat(u),f=n[u],this.model.columns.push({field:o,type:f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null})):(e=e.concat(".").concat(u),this._initComplexColumn(n[u],u,e))},i.prototype._initColumns=function(i){for(var f,e,r,u,o;i.items!=undefined;)i=i.items[0];if(this.model.columns.length==0&&i){for(f in i)i.hasOwnProperty(f)&&(typeof i[f]!="object"||i[f]instanceof Date||i[f]==null)?(e=i[f],this.model.columns.push({field:f,type:e!=null?e.getDay?e.getHours()>0||e.getMinutes()>0||e.getSeconds()>0||e.getMilliseconds()>0?"datetime":"date":typeof e:null})):typeof i[f]=="object"&&this._initComplexColumn(i[f],f);this.model.columns.length&&this._renderAfterColumnInitialize()}else for(r=0;r<this.model.columns.length;r++)this.model.columns[r].field=t.isNullOrUndefined(this.model.columns[r].field)?"":this.model.columns[r].field,t.isNullOrUndefined(this.model.columns[r].validationRules)||this._validatedColumns.push(this.model.columns[r].field),t.isNullOrUndefined(this.model.columns[r].type)?(u=t.isNullOrUndefined(this.model.columns[r].field)?null:t.getObject(this.model.columns[r].field,i),o=this.model.columns[r].dataSource,!!o&&this.model.columns[r].foreignKeyValue&&(this.model.columns[r].originalType=u!=null?u.getDay?u.getHours()>0||u.getMinutes()>0||u.getSeconds()>0||u.getMilliseconds()>0?"datetime":"date":typeof u:null,u=(o instanceof t.DataManager)?t.getObject("0."+this.model.columns[r].foreignKeyValue,this.model.columns[r].foreignKeyData):t.getObject("0."+this.model.columns[r].foreignKeyValue,o)),this.model.columns[r].type=u!=null?u.getDay?u.getHours()>0||u.getMinutes()>0||u.getSeconds()>0||u.getMilliseconds()>0?"datetime":"date":typeof u:null):this.model.columns[r].type!="date"||this.model.columns[r].format!=undefined||this._isReorder==!0||this.model.allowGrouping==!0||this._showHideColumns?this.model.columns[r].type!="datetime"||this.model.columns[r].format!=undefined||this._isReorder==!0||this.model.allowGrouping==!0||this._showHideColumns||(t.isNullOrUndefined(t.globalize)?n.extend(this.model.columns[r],{format:"{0:"+t.preferredCulture().calendars.standard.patterns.d+" "+t.preferredCulture().calendars.standard.patterns.t+"}"}):n.extend(this.model.columns[r],{format:"{0:M/d/yyyy h:mm tt}"})):t.isNullOrUndefined(t.globalize)?n.extend(this.model.columns[r],{format:"{0:"+t.preferredCulture().calendars.standard.patterns.d+"}"}):n.extend(this.model.columns[r],{format:"{0:M/d/yyyy}"})},i.prototype._getExpands=function(n,t){var r=n.split("."),i="",u,f;for(r.splice(r.length-1,1),u=0;u<r.length;u++,i=""){for(f=0;f<u;f++)i+=r[f]+"/";i=i+r[u];t.indexOf(i)===-1&&t.push(i)}},i.prototype._ensureDataSource=function(i){var r,k,v,y,s,h,e,u,o,d,p,g,nt,w,b,l,f,tt,c,it,a,rt;if(this._dataSource()==null&&!(this._dataSource()instanceof t.DataManager)){if(t.isNullOrUndefined(i)||i.requestType!="add")return;this.dataSource([])}if(this.model.query.requiresCount(),r=this.model.query,k=r.clone(),this._dataSource()instanceof t.DataManager||(this.model.currentViewData=this._dataSource()),this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!t.isNullOrUndefined(this._cModifiedData)||!t.isNullOrUndefined(this._cAddedRecord))){if(t.isNullOrUndefined(this._cAddedRecord)){for(s=0;s<this._primaryKeys.length;s++)r=r.where(this._primaryKeys[s],t.FilterOperators.equal,this._primaryKeyValues[s]);v=this._dataManager.executeLocal(r);this._dataSource()instanceof t.DataManager?n.extend(this._dataSource().dataSource.json[n.inArray(v.result[0],this._dataSource().dataSource.json)],this._cModifiedData):n.extend(this._dataSource()[n.inArray(v.result[0],this._dataSource())],this._cModifiedData);this._cModifiedData=null}else y=this._cAddedRecord,this._cAddedRecord=null,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.unshift(y):this._dataSource(undefined,!0).splice(0,0,y);r.queries=k.queries;this.model.editSettings.showAddNewRow||(this.model.isEdit=!1)}if(i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&(this._excludeDetailRows().length==1||this.multiDeleteMode=="multiple"&&this.selectedRowsIndexes.length==this._excludeDetailRows().length)&&this.model.pageSettings.currentPage!=1&&this._currentPage(this.model.pageSettings.totalPages-1),i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&!t.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof t.DataManager?(s=n.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(s,1)):(s=n.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(undefined,!0).splice(s,1))),this.model.sortSettings.sortedColumns.length){for(h=[],e=this.model.sortSettings.sortedColumns,u=e.length-1;u>=0;u--)if(this.model.groupSettings.groupedColumns.indexOf(e[u].field)==-1){if(r.sortBy(e[u].field,e[u].direction),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&n.inArray(e[u],this._prevVirtualSort)==-1){for(o=0;o<this._prevVirtualSort.length;o++)e[u].field==this._prevVirtualSort[o].field&&this._prevVirtualSort.splice(o,1);this._needVPaging=this._currentVirtualIndex*this._virtualRowCount%this.model.pageSettings.pageSize<=this._virtualRowCount;this._prevVirtualSort.push(e[u]);this._virtualDataRefresh=!0;this._refreshVirtualViewData()}}else h.push({field:e[u].field,direction:e[u].direction});for(o=0;o<h.length;o++)r.sortBy(h[o].field,h[o].direction)}if((this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization)&&(this._isLocalData?(d=this._dataManager.executeLocal(r),this._recordsCount=d.count,p=this._recordsCount%this.model.pageSettings.pageSize==0?this._recordsCount/this.model.pageSettings.pageSize:parseInt(this._recordsCount/this.model.pageSettings.pageSize,10)+1,this._currentPage()>p&&this._currentPage(p)):t.isNullOrUndefined(i)&&this._currentPage(1),this._currentPage()==0&&(this._prevPageNo==0||this._prevPageNo==null?this._currentPage(1):this._currentPage(this._prevPageNo)),r.page(this._currentPage(),this.model.pageSettings.pageSize)),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._needPaging=!0,this.initialRender&&this.model.currentIndex>1&&(this.model.currentIndex<=this._getVirtualTotalRecord()||!this._isLocalData)&&(this.model.scrollSettings.virtualScrollMode=="continuous"&&(this.model.currentIndex=1),this._currentVirtualIndex=Math.ceil(this.model.currentIndex/this._virtualRowCount),this._isThumbScroll=!0,this._currentPage(Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this._virtualDataRefresh&&(this._isThumbScroll=!0,this._refreshVirtualViewData(!0),this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0,this._currentPage(Math.ceil(this._currentVirtualIndex*this._virtualRowCount/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this.model.virtualLoading!=null&&(this._gridRecordsCount=this.model.pageSettings.totalRecordsCount),this.model.filterSettings.filteredColumns==0&&this._prevVirtualFilter.length&&(this._refreshVirtualViewData(),this._prevVirtualFilter=[]),this._isLocalData&&this.initialRender&&this._refreshVirtualViewDetails(),this._getVirtualLoadedRecords(r)),i!=undefined&&i.requestType=="add"&&this._isLocalData&&this.model.groupSettings.groupedColumns.length==0&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&((this._dataSource()instanceof t.DataManager)?this._dataSource().dataSource.json.unshift(i.data):this._dataSource().unshift(i.data)),t.isNullOrUndefined(i)||i.action!="add"||t.isNullOrUndefined(this.model.parentDetails)||(g=this.getColumnByField(this.model.parentDetails.parentKeyField),nt=n.inArray(g,this.model.columns),nt==-1&&(w={},w[this.model.parentDetails.parentKeyField]=this.model.parentDetails.parentKeyFieldValue,n.extend(!0,this.model.currentViewData[0],w))),this._cloneQuery=r.clone(),this._isLocalData&&(!this.model.scrollSettings.enableVirtualization||this._virtualDataRefresh)){if(b=this._dataManager.dataSource.json,l=this._dataSource().dataSource,!t.isNullOrUndefined(l)&&this._dataSource()instanceof t.DataManager&&(this._dataManager.dataSource.json=b!=l.json?l.json:b),f=this._dataManager.executeLocal(r),this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&(this._prevPageRendered=!0),this.model.scrollSettings.allowVirtualScrolling&&!this._prevPageRendered&&f.result.length!=this.model.pageSettings.pageSize&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage)tt=t.pvt.filterQueries(r.queries,"onPage"),r.queries.splice(n.inArray(tt[0],r.queries),1),r.page(this._currentPage()-1,this.model.pageSettings.pageSize),c=this._dataManager.executeLocal(r),c.result.splice(0,f.result.length),this._previousPageRecords=n.extend(!0,[],c.result),this._previousPageLength=f.result.length,this._currentPageData=f.result,t.merge(c.result,f.result),this.model.currentViewData=c.result,this._lastPageRendered=!0;else if(this._lastPageRendered&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&!this.model.scrollSettings.enableVirtualization){for(it=this.model.pageSettings.pageSize-this._previousPageLength,a=0;a<it;a++)rt=this.getRows()[this.getRows().length-(this.model.pageSettings.pageSize-a)],rt.remove();this._tempPageRendered=!0;this.model.currentViewData=f.result}else this.model.currentViewData=f.result;this._gridRecordsCount=f.count;this._remoteSummaryData=f.aggregates;this._searchCount=this._searchString.length?f.count:null;this.model.groupSettings.groupedColumns.length&&this._setAggregates()}},i.prototype._refreshViewPageDetails=function(){this._currentPage(1);this.model.currentIndex=0;this._currentVirtualIndex=1;this.getContent().ejScroller("model.scrollTop",0)},i.prototype._refreshVirtualViewDetails=function(n){n&&(this._gridRecordsCount=this._dataSource()!==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount);this._totalVirtualViews=Math.ceil(this._getVirtualTotalRecord()/this._virtualRowCount);this._maxViews=Math.ceil(this.model.pageSettings.pageSize/this._virtualRowCount);this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize);this.model.pageSettings.totalRecordsCount=this._gridRecordsCount;this._lastViewData=this._virtualRowCount-(this._totalVirtualViews*this._virtualRowCount-this._getVirtualTotalRecord())},i.prototype._getVirtualLoadedRecords=function(t){var i=this._currentPage(),r,u,f;if(this._needPaging&&(this._isLastVirtualpage=r=this._isThumbScroll&&i==this.model.pageSettings.totalPages&&!this._virtualPageRecords[i],(this.initialRender||this._virtualDataRefresh)&&(r=!0),this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||i!=1)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._getVirtualOnLoadingData(i,!r):this._setVirtualPaging(t,i,!r),!this.initialRender&&this._isThumbScroll&&this._virtualPageRecords[i]&&!this._virtualDataRefresh&&this._checkPrevNextViews(i,t)),this._needPaging=!1,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.initialRender&&this._isLocalData)for(this.model.currentViewData=[],u=0;u<this._currentLoadedIndexes.length;u++)f=this._currentLoadedIndexes[u],this._virtualLoadedRecords[f]&&n.merge(this.model.currentViewData,this._virtualLoadedRecords[f])},i.prototype._setVirtualPaging=function(i,r,u){var e=t.pvt.filterQueries(i.queries,"onPage"),f;e.length&&i.queries.splice(n.inArray(e[0],i.queries),1);(!u||this._needVPaging)&&this.model.currentIndex>this._virtualRowCount?(this._initCurrentIndex(i,r),this._needVPaging=!1):i.page(r,this.model.pageSettings.pageSize);this._isLocalData&&!this._virtualPageRecords[r]&&(f=this._dataManager.executeLocal(i),this.initialRender||(this.model.currentViewData=f.result),f.result.length?(this._setVirtualLoadedRecords(f.result,r),n.inArray(r,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(r)):this.getContent().find(".e-virtualtop, .e-virtualbottom").remove())},i.prototype._checkPrevNextViews=function(){var n=this._currentVirtualIndex,u=this._virtualLoadedRecords[n-1],f=this._virtualLoadedRecords[n+1],r=this._maxViews==3?1:2,t,i;n!=1&&n!=this._totalVirtualViews&&(u&&u.length==this._virtualRowCount?f&&f.length==this._virtualRowCount||this._totalVirtualViews==n-1||(i=n-r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i-1,t=this._scrollValue-r*this._virtualRowCount*this._vRowHeight):(i=n+r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i+1,t=this._scrollValue+r*this._virtualRowCount*this._vRowHeight),t&&(this._scrollValue=t,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.model.currentIndex=t==0?t:Math.floor(t/this._vRowHeight)))},i.prototype._initCurrentIndex=function(n,t){var u=t*this.model.pageSettings.pageSize,o=this._currentVirtualIndex*this._virtualRowCount+this._virtualRowCount,s=this._currentVirtualIndex*this._virtualRowCount-this._virtualRowCount*2,c=o>u||s<u-this.model.pageSettings.pageSize,r,f,i,h,e;c||this._isLastVirtualpage?(o>u?(r=(t-1)*this.model.pageSettings.pageSize,f=this.model.pageSettings.pageSize*2,this._isInitNextPage=!0):(s<u-this.model.pageSettings.pageSize||this._isLastVirtualpage)&&(r=(t-2)*this.model.pageSettings.pageSize,f=this.model.pageSettings.pageSize*2,this._isInitNextPage=!1,this._remoteRefresh=!0),this.model.virtualLoading&&this._isLocalData?(i={},i.endIndex=r+f,i.endIndex=i.endIndex>this._getVirtualTotalRecord()?this._getVirtualTotalRecord():i.endIndex,i.startIndex=r,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),e=i.result,this._setInitialCurrentIndexRecords(e,t)):(n.skip(r).take(f),this._isLocalData&&(h=this._dataManager.executeLocal(n),e=h.result,this._isLastVirtualpage=!1,this._setInitialCurrentIndexRecords(e,t)))):(this._needVPaging=!1,this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||t!=1)?this._getVirtualOnLoadingData(t,!0):this._setVirtualPaging(n,t,!0))},i.prototype._setInitialCurrentIndexRecords=function(n,t){for(var i=0;i<2;i++){var r=i*this.model.pageSettings.pageSize,f=r+this.model.pageSettings.pageSize,e=n.slice(r,f),u;u=this._isInitNextPage?i==0?t:t+1:i==0?t-1:t;this._setVirtualLoadedRecords(e,u)}},i.prototype._getVirtualOnLoadingData=function(n,t){var i,r;n>0&&(this.model.currentIndex>this._virtualRowCount&&(!t||this._needVPaging)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._initCurrentIndex(undefined,n):(i={},i.endIndex=n*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:n*this.model.pageSettings.pageSize,i.startIndex=n*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),r=i.result,this._setVirtualLoadedRecords(r,n)))},i.prototype._setVirtualLoadedRecords=function(t,i){var u=this._virtualRowCount,h=this.model.pageSettings.pageSize,v=h/u,o,y=Math.ceil(i*h/u),p=i==this.model.pageSettings.totalPages,l,e,f,s,r,w,c,a,b;for(this._virtualPageRecords[i]||(this._virtualPageRecords[i]=t),p&&(l=this._getVirtualTotalRecord()%h,y=(!this._virtualLoadedRecords[this._totalVirtualViews]||this._virtualLoadedRecords[this._totalVirtualViews].length!=this._lastViewData)&&l<this._lastViewData&&l!=0?this._totalVirtualViews+1:this._totalVirtualViews,this._getVirtualTotalRecord()<u&&(this._singleView=!0)),e=0;e<v;e++)r=Math.ceil((i-1)*v+(e+1)),(r<=this._totalVirtualViews||p)&&r<=y&&(this._virtualLoadedRecords[r-1]&&this._virtualLoadedRecords[r-1].length!=u?(w=this._virtualLoadedRecords[r-1].length+e*u,f=u-w+e*u,n.merge(this._virtualLoadedRecords[r-1],t.slice(0,f)),o=s=f+u,r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,o))):r==1||this._virtualLoadedRecords[r-1]?(f=o?o:e*u%h,o=s=f+u):(c=s=(r-1)*u%h,c!=0&&(this._virtualLoadedRecords[r-1]=t.slice(0,c)),f=c,s=o=c+u),this._virtualLoadedRecords[r]&&this._virtualLoadedRecords[r].length!=u?(a=t.slice(f,s),a.length+this._virtualLoadedRecords[r].length<=u&&(b=n.merge(a,this._virtualLoadedRecords[r]),this._virtualLoadedRecords[r]=b)):!this._virtualLoadedRecords[r]&&r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,s)));n.inArray(i,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(i)},i.prototype._setVirtualLoadedIndexes=function(n){var i,t;for(this._currentLoadedIndexes=[],i=n==this._totalVirtualViews?n:n+1,n!=1&&(n=n-1),t=n;t<=i;t++)this._currentLoadedIndexes.push(t)},i.prototype._getVirtualTotalRecord=function(){return this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount},i.prototype._initGridRender=function(t){var r,i;this.addInitTemplate();this.model.scrollSettings.frozenColumns>0&&this.addFrozenTemplate();this.model.allowGrouping&&this.addGroupingTemplate();this.model.showSummary&&this.addSummaryTemplate();this.model.keySettings&&n.extend(this.model.keyConfigs,this.model.keySettings);this.render();this._setTextWrap();this._wireEvents(t);this.initialRender=!1;this.model.width&&!this.model.allowScrolling&&this.element.width(this.model.width);(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.model.parentDetails&&(r=this.model.parentDetails.parentID,i=n("#"+r).data("ejGrid"),i.model.allowScrolling&&i._refreshScroller({requestType:"refresh"}));this.element.closest("tr").hasClass("e-detailrow")&&!this.model.parentDetails&&(i=this.element.closest("tr.e-detailrow").closest(".e-grid").data("ejGrid"),i.model.allowScrolling&&i.getScrollObject().refresh())},i.prototype._setTextWrap=function(){if(this.model.allowTextWrap==!0)switch(this.model.textWrapSettings.wrapMode){case"content":this.element.find(".e-columnheader").removeClass("e-wrap");this.element.removeClass("e-wrap");this.getContent().addClass("e-wrap");break;case"header":this.element.removeClass("e-wrap");this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").addClass("e-wrap");break;default:this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").removeClass("e-wrap");this.element.addClass("e-wrap")}else this.getContent().removeClass("e-wrap"),this.element.find(".e-columnheader").removeClass("e-wrap"),this.element.removeClass("e-wrap")},i.prototype._getMetaColGroup=function(){for(var r,u=t.buildTag("colgroup"),i=0;i<this.model.columns.length;i++)r=n(document.createElement("col")),this.model.columns[i].visible===!1&&r.css("display","none"),this.model.rowTemplate==null||t.isNullOrUndefined(this.model.columns[i].cssClass)||r.addClass(this.model.columns[i].cssClass),this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&n.inArray(this.model.columns[i].field,this.model.groupSettings.groupedColumns)!=-1&&r.css("display","none"),u.append(r);return u},i.prototype._alternateRow=function(){return this.getIndex()%2==0?"e-row":"e-alt_row"},i.prototype.formatting=function(i,r,u){var f,l,h,c,a,v,s,e,y;if(i=i.replace(/%280/g,'"').replace(/</g,"<").replace(/>/g,">"),u=t.preferredCulture(u)?u:"en-US",f=i,l=i.split("{0:"),a=i.split("}"),h=l[0],c=a[1],typeof r=="string"&&n.isNumeric(r)&&(r=Number(r)),i.indexOf("{0:")!=-1)return v=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),s=v.exec(i),s!=null&&r!=null?h!=null&&c!=null?h+t.format(r,s[2],u)+c:t.format(r,s[2],u):r!=null?r:"";if(f.startsWith("{")&&!f.startsWith("{0:")){var o=f.split(""),r=(r||"")+"",p=r.split(""),w=/[0aA\*CN<>\?]/gm;for(e=0,y=0;e<o.length;e++)o[e]=w.test(o[e])?"{"+y+++"}":o[e];return String.format.apply(String,[o.join("")].concat(p)).replace("{","").replace("}","")}return this.data!=null&&this.data.Value==null?(n.each(this.data,function(n,t){f=f.replace(new RegExp("\\{"+n+"\\}","gm"),t)}),f):this.data.Value},i.prototype.addInitTemplate=function(){var p=this.element.find(".e-headercelldiv:not(.e-emptyCell)"),l={},w=!0,a=document.createElement("tbody"),v=n(a),c,b,u,tt,o,k,g,f,nt;if(this.model.rowTemplate==null){var y=document.createElement("tr"),e=n(y),r=this.model.columns,i;for(this._gridRecordsCount&&!this._virtualDataRefresh?this._initColumns(this.model.currentViewData[0]!=undefined?this.model.currentViewData[0]:this.model.currentViewData.value):this._isLocalData&&(this._dataSource()!=null&&this._dataSource().length||this._dataManager&&this._dataManager.dataSource.json.length)&&this._initColumns(this._dataSource()[0]!=undefined?this._dataSource()[0]:this._dataManager.dataSource.json[0]),c={_gridFormatting:this.formatting},n.views.helpers(c),f={},f._foreignKey=this._foreignKeyBinding,n.views.helpers(f),(this.model.childGrid||this.model.detailsTemplate)&&(b=t.buildTag("td.e-detailrowcollapse","<div class='e-icon e-gnextforward'><\/div>"),e.append(b)),i=0;i<this.model.columns.length;i++){if(u=t.buildTag("td.e-rowcell"),t.isNullOrUndefined(r[i].tooltip)&&r[i].clipMode!=t.HeatMapGrid.ClipMode.EllipsisWithTooltip||u.addClass("e-gridtooltip"),(r[i].clipMode==t.HeatMapGrid.ClipMode.Ellipsis||r[i].clipMode==t.HeatMapGrid.ClipMode.EllipsisWithTooltip)&&u.addClass("e-gridellipsis"),this.model.isResponsive&&u.attr("data-cell",this._decode(this.model.columns[i].headerText)),r[i].visible==!1?u.addClass("e-hide"):(w&&(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&u.addClass("e-detailrowvisible"),w=!1),this.model.groupSettings.showGroupedColumn||u.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[i].field+"'}}e-hide{{/if}}{{/for}}"),t.isNullOrUndefined(r[i].templateID||r[i].template)){for(var s=(r[i].field||"").split("."),d=s.length-1,h="";d;)h+="(",d--;g=r[i].type||r[i].editType;switch(g){default:r[i].disableHtmlEncode?u.html("{{html:"+h+"#data['"+s.join("'] || {})['")+"']}}"):u.html("{{:"+h+"#data['"+s.join("'] || {})['")+"']}}")}r[i].format==undefined||r[i].foreignKeyValue||u.html("{{:~_gridFormatting('"+r[i].format+"',"+h+"#data['"+s.join("'] || {})['")+"'],'"+this.model.locale+"')}}");r[i].foreignKeyValue&&r[i].dataSource&&u.html("{{:~_foreignKey("+i+","+h+"#data['"+s.join("'] || {})['")+"'],'"+this._id+"')}}");r[i].commands&&(f={},n.views.helpers(f),(t.isNullOrUndefined(r[i].field)||r[i].field=="")&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),t.isNullOrUndefined(r[i].headerText)||n("#"+this._id+r[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate").remove(),nt=this._createUnboundElement(r[i]),t.isNullOrUndefined(r[i].headerText)||u.addClass("e-unboundcell").addClass("e-"+r[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+nt.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&u.addClass("e-frozenunbound"),this._isUnboundColumn=!0)}else f={},o=r[i].headerText,f["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this,tt),n.views.helpers(f),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.match(/[^0-9\s\w]/g))||(o=o.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+o+i+"_Template").remove(),k=this._createTemplateElement(r[i]),(r[i].field==""||t.isNullOrUndefined(r[i].field))&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),r[i].template!=!1&&u.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+k.id+"','"+i+"')}}");r[i].textAlign==undefined&&(r[i].textAlign="left");r[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(r[i].field)),this._primaryKeys=n.unique(this._primaryKeys));this.phoneMode&&this.model.enableResponsiveRow||r[i].textAlign==undefined||(u.css("text-align",r[i].textAlign),n(p[i]).css("text-align",r[i].textAlign));this.phoneMode||t.isNullOrUndefined(r[i].headerTextAlign)||n(p[i]).css("text-align",r[i].headerTextAlign);t.isNullOrUndefined(r[i].cssClass)||u.addClass(r[i].cssClass);t.isNullOrUndefined(r[i].priority)||u.addClass("e-table-priority-"+r[i].priority);t.isNullOrUndefined(r[i].customAttributes)||u.attr(r[i].customAttributes);u.addClass("sf-ht-heatmapcell");u.attr("role","heatmapcell");e.append(u);this.model.enableAltRow?(c["_"+this._id+"AlternateRow"]=this._alternateRow,n.views.helpers(c),e.addClass("{{:~_"+this._id+"AlternateRow()}}")):e.addClass("e-row");e.attr("role","row");this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenColumns==i+1&&(a.appendChild(y),l[this._id+"_JSONFrozenTemplate"]=v.html(),e.empty(),v.empty())}a.appendChild(y)}l[this._id+"_JSONTemplate"]=this.model.rowTemplate!=null?n(this.model.rowTemplate).html():v.html();n.templates(l)},i.prototype.render=function(){this.model.showSummary=this.model.summaryRows.length>0||this.model.showSummary;this._renderGridContent().insertAfter(this.element.children(".e-gridheader"));this.model.allowResizeToFit&&this.setWidthToColumns();this._initialEndRendering()},i.prototype._createStackedRow=function(i,r){for(var v,ft,et,u,y,p,w,f,e,st,k,a=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),l=[],d=[],g=[],nt=[],o=0;o<this.model.columns.length;o++)if(v=this.model.columns[o],v.visible!=!1){if(this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&this.model.groupSettings.groupedColumns.length>0&&n.inArray(v.field,this.model.groupSettings.groupedColumns)!=-1)continue;var tt="",it="",rt="",ut="",h=i.stackedHeaderColumns;for(e=0;e<h.length;e++)ft=n.isArray(h[e].column)?h[e].column:n.map(h[e].column.split(","),n.trim),et="e-row"+n.inArray(i,this.model.stackedHeaderRows)+"-column"+e,n.inArray(v.field,ft)!=-1&&(tt=h[e].headerText,it=h[e].cssClass,rt=h[e].textAlign,ut=h[e].tooltip?" e-gridtooltip "+et:"");l.push(tt);d.push(it);g.push(rt);nt.push(ut)}for(u=[],f=0;f<l.length;f++){for(y=1,p=f+1;p<l.length;p++)if(l[f]==l[p])y++;else break;u.push({sapnCount:y,headerText:l[f],cssClass:d[f],txtAlign:g[f],tooltip:nt[f]});f+=y-1}if(a=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),w=this.model.scrollSettings.frozenColumns,this.model.allowScrolling&&w>0){var b=[],c=0,s=0,ot=0;for(f=0;f<this.model.columns.length;f++)e=this.model.columns[f],f<w&&e.visible==!1&&ot++;for(c=w-ot;c>0;)st=u[s].sapnCount,u[s].sapnCount<c?(b.push(u[s]),r?s++:u.splice(s,1)):u[s].sapnCount>c?(u[s].sapnCount=u[s].sapnCount-c,r&&b.push({sapnCount:c,headerText:u[s].headerText})):(b.push(u[s]),r||u.splice(s,1)),c-=st;r&&(u=b)}for((this.model.detailsTemplate||this.model.childGrid)&&a.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),o=0;o<u.length;o++)k=t.buildTag("th.e-headercell e-stackedHeaderCell e-default"+u[o].tooltip,u[o].headerText,{},{colspan:u[o].sapnCount}),k.css("textAlign",u[o].txtAlign),a.append(k),u[o].cssClass!=undefined&&k.addClass(u[o].cssClass);return a},i.prototype._renderGridContent=function(){var o=t.buildTag("div.e-gridcontent"),h=t.buildTag("div"),f=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),c=n(document.createElement("tbody")),r,i,e,l,u,s,a;if(f.append(this.getHeaderTable().find("colgroup").clone()).append(c),h.html(f),o.html(h),this.setGridContentTable(f),this.setGridContent(o),f.attr("role","heatmap"),r={},this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length){if(this.initialRender&&(r.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],!this.model.groupSettings.showGroupedColumn))for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)e=this.model.groupSettings.groupedColumns[i],n.inArray(e,this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(e),this.getColumnByField(e).visible=!1);r.requestType=t.HeatMapGrid.Actions.Grouping}else r.requestType=t.HeatMapGrid.Actions.Refresh;if(this._dataSource()==null||this._dataSource().length==0||this.model.currentViewData.length==0?(l=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length}),c.append(n(document.createElement("tr")).append(l)),this.setWidthToColumns(),this.initialRender&&this.sendDataRenderingRequest(r)):this.sendDataRenderingRequest(r),this._isCaptionSummary&&r.requestType=="grouping"&&this.model.groupSettings.groupedColumns.length>1)for(u=this.getContentTable().find(".e-table").not(".e-recordtable").children("colgroup"),s=n(this.getContentTable().find(".e-recordtable")[0]).children("colgroup").find("col"),i=0;i<u.length;i++)a=n(u[i]).find("col").length,n(u[i]).find("col:gt("+(a-s.length-1)+")").remove(),n(u[i]).append(s.clone());return o},i.prototype.sendDataRenderingRequest=function(i){var v,rt,ut,s,ft,et,tt,a,k,ot,c,y,o,d,it,st,g,ht;if(this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1),this.setFormat(),this.model.scrollSettings.enableVirtualization||(this._previousColumnIndex=null,this._previousRowCellIndex=null,this._previousIndex=null),i.requestType=="add"||i.requestType=="grouping"||this.model.currentViewData!=null&&this.model.currentViewData.length)switch(i.requestType){case t.HeatMapGrid.Actions.Refresh:case t.HeatMapGrid.Actions.Paging:case t.HeatMapGrid.Actions.Sorting:case t.HeatMapGrid.Actions.Filtering:case t.HeatMapGrid.Actions.Save:case t.HeatMapGrid.Actions.Cancel:case t.HeatMapGrid.Actions.Delete:case t.HeatMapGrid.Actions.Search:case t.HeatMapGrid.Actions.Reorder:case t.HeatMapGrid.Actions.BatchSave:if(v=this.model.groupSettings.groupedColumns,this.model.allowGrouping&&i.requestType==t.HeatMapGrid.Actions.Refresh&&v.length==0&&this.element.find(".e-grouptopleftcell").length>0&&(rt=this.element.children(".e-gridheader"),rt.find("div").first().empty().append(this._renderGridHeader().find("table"))),this.model.allowGrouping||(v=[]),(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none"),v.length==0){var u=document.createElement("div"),p,h=-1,nt=!1;if(this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(this.model.childGrid!=null||this.model.detailsTemplate!=null)&&this.getContentTable().find("colgroup").first().prepend(this._getIndentCol()),ut=this._currentPage(),(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"||this.model.editSettings.editMode=="normal")&&(i.requestType=="cancel"||i.requestType=="save")&&(this._editFormHeight=this.element.find(".gridform").closest("tr").height()),this.model.scrollSettings.frozenColumns>0)u.innerHTML=this._renderByFrozenDesign();else{i.data&&(p=document.createElement("div"),p.innerHTML=["<table>",n.render[this._id+"_JSONTemplate"](i.data),"<\/table>"].join(""),this._dataSource()instanceof t.DataManager&&i.requestType==t.HeatMapGrid.Actions.Save&&(h=this._getDataIndex(this.model.currentViewData,i.data),nt=this._dataSource().adaptor instanceof t.remoteSaveAdaptor));u.innerHTML=["<table>",n.render[this._id+"_JSONTemplate"](this.model.currentViewData),"<\/table>"].join("");var w=this.getContentTable().get(0),r=w.lastChild,ct=this.getContentTable().first().find("tbody").first();if((i.requestType=="save"||i.requestType=="cancel")&&this.model.editSettings.editMode!="batch"){if(s=this.model.editSettings.editMode.indexOf("inlineform")!=-1?t.isNullOrUndefined(i.selectedRow)?this._selectedRow():i.selectedRow:this.getContentTable().find(".e-"+i.action+"edrow").index(),ft=this._currentTrIndex,s==-1&&(s=ft),this.model.detailsTemplate!=null||this.model.childGrid!=null)for(et=this.model.editSettings.editMode=="inlineform"?n(n(r.childNodes).not(".e-detailrow")[s]):n(r.childNodes[s]),tt=n(r.childNodes).not(".e-detailrow"),c=0;c<tt.length;c++)et.is(tt[c])&&(s=c);if(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"){if(i.action=="add"&&!this.getContentTable().find(".e-addedrow").length)break;var f=this.getContentTable().find(".e-addedrow").get(0),l=this.getContentTable().find(".e-editedrow"),e=l.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:p.firstChild.firstChild.lastChild;l.length?(this.model.editSettings.showAddNewRow&&this.model.editSettings.rowPosition=="top"&&(s=s-1),e=u.firstChild.firstChild.childNodes[s],this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(f=l.prev("tr").get(0),l.remove()):f=l.get(0),a=n(e),o=n(f),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next("tr.e-detailrow:visible").length&&(y=a.find(".e-detailrowcollapse"),y.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),i.requestType=="cancel"?(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").addClass("e-showaddrow"),o.replaceWith(a)):!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(this.model.detailsTemplate!=null&&o.next("tr.e-detailrow").length&&r.removeChild(o.next("tr.e-detailrow").get(0)),o.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&v.length==0&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):r.replaceChild(e,f)):(a=n(e),o=n(f),i.action=="add"&&i.requestType=="save"&&this.model.editSettings.showAddNewRow&&this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&(this.model.editSettings.rowPosition=="bottom"?r.lastChild.previousSibling.remove():r.lastChild.remove()),i.requestType=="cancel"||this._dataSource()instanceof t.DataManager||this._currentPage()!=1||i.requestType=="save"&&!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount==this._previousFilterCount?(t.isNullOrUndefined(f)||(o.remove(),this._dataSource()instanceof t.DataManager&&h!=-1?h==0?r.insertBefore(e,r.children[h]):a.insertAfter(r.children[h-1]):this._dataSource()instanceof t.DataManager&&!nt||this._currentPage()==1||i.requestType!="save"||n(r).prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&v.length==0&&(this._dataSource()instanceof t.DataManager&&h==-1&&!nt&&i.requestType!="save"||i.requestType!="save"&&!(this._dataSource()instanceof t.DataManager))&&i.requestType=="cancel"&&!this.model.editSettings.showAddNewRow&&w.lastChild.appendChild(u.firstChild.firstChild.lastChild)),i.requestType=="cancel"&&this._selectedRow()!=-1&&this.clearSelection()):this.model.currentViewData.length==1?(n(r).empty(),r.appendChild(e)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this.model.editSettings.rowPosition=="bottom"?(ct.prepend(f),r.replaceChild(e,f)):r.replaceChild(e,f))}else if(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"){if(i.action=="add"&&!this.element.find(".e-addedrow").length)break;if(l=this.element.find(".e-editedrow"),i.requestType!="cancel"&&(l.length||t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount!=this._previousFilterCount))if(l.length){if(e=u.firstChild.firstChild.childNodes[s],f=this._excludeDetailRows(r.childNodes)[s],this.model.allowCellMerging!=null&&(o=n(f),n(f.childNodes).hasClass("e-merged")))for(k=o.children(".e-merged").index(),ot=f.children[k].colSpan,c=0;c<ot;c++)e.childNodes[k+c].className+=" e-merged e-hide",e.childNodes[k].colSpan=c+1;this.model.detailsTemplate!=null&&(f=n(r.childNodes).not(".e-detailrow").eq(s).get(0));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next("tr.e-detailrow:visible").length&&(y=n(e).find(".e-detailrowcollapse"),y.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"));!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(o=n(f),this.model.detailsTemplate!=null&&o.next("tr.e-detailrow").length&&r.removeChild(o.next("tr.e-detailrow").get(0)),o.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):r.replaceChild(e,f)}else this.model.currentViewData.length==1&&this.getContentTable().find("td.e-rowcell").length==0?(e=u.firstChild.firstChild.firstChild,n(r).empty(),r.appendChild(e)):(d=l.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:p.firstChild.firstChild.lastChild,this._dataSource()instanceof t.DataManager?h!=-1&&(h==0?r.insertBefore(d,r.children[h]):n(d).insertAfter(r.children[h-1]),this.model.allowPaging&&(this.model.pageSettings.pageSize<=this.model.currentViewData.length||h==this.model.pageSettings.pageSize-1)&&r.removeChild(r.lastChild)):(this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this._currentPage()==1?this.getContentTable().find("tbody").first().prepend(n(d)):this.getContentTable().find("tbody").first().prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.removeChild(r.lastChild)),this.model.detailsTemplate!=null&&n(w.lastChild.lastChild).children(".e-detailrowexpand").length&&r.removeChild(r.lastChild));else e=u.firstChild.firstChild.childNodes[s],f=r.childNodes[s],a=n(e),o=n(f),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next(".e-detailrow:visible").length&&(y=a.find(".e-detailrowcollapse"),y.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),o.replaceWith(a),this.clearSelection()}this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():w.rows;this.model.enableAltRow&&this._refreshAltRow()}else if(i.requestType=="delete"){if(this._isUnboundColumn){var b=this.element.find(".e-editedrow"),f=this.getContentTable().find(".e-editedrow").get(0),e=b.length?u.firstChild.firstChild.firstChild:p.firstChild.firstChild.lastChild;b.length!=0&&(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")?n(f).replaceWith(n(e)):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(f=b.prev("tr").get(0),b.remove()):f=b.get(0)}this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&this.getContentTable()[0].rows.length!=this.model.currentViewData.length&&(this.getContentTable().find("tr").length&&this._excludeDetailRows().length?this.multiDeleteMode?(it=u.firstChild.firstChild.rows.length,st=n(u.firstChild.firstChild.rows).slice(it-this.selectedRowsIndexes.length,it),n(r).append(st)):r.appendChild(u.firstChild.firstChild.lastChild):n(r).prepend(u.firstChild.firstChild.rows));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(g=this.getContentTable().find(".e-detailrow:visible"),n.each(g,function(n){g.eq(n).closest("tr").prev().children(".e-detailrowexpand").length==0&&g.eq(n).remove()}));this._gridRows=w.rows;this.model.enableAltRow&&this._refreshAltRow()}else this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild)}this._currentJsonData=this.model.currentViewData;this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():this.getContentTable().get(0).rows;this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);ht={};(i.requestType=="sorting"||i.requestType=="filtering")&&this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="filtering"&&(this.getContent().first().ejScroller("refresh").ejScroller("isVScroll")?this.element.find(".gridheader").addClass("e-scrollcss"):this.element.find(".gridheader").removeClass("e-scrollcss"),ht=this._refreshVirtualPagerInfo()),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(ut),i.requestType=="filtering"&&this.getContent().first().ejScroller("refresh"));this.model.scrollSettings.enableVirtualization||this._eventBindings();break}case t.HeatMapGrid.Actions.Grouping:this._group(i);this._refreshStackedHeader();break;case t.HeatMapGrid.Actions.BeginEdit:this._edit(i);break;case t.HeatMapGrid.Actions.Add:this._add(i);break;case t.HeatMapGrid.Actions.Ungrouping:this._ungroup(i);break;case t.HeatMapGrid.Actions.VirtualScroll:this._isVirtualRecordsLoaded||(this.model.scrollSettings.enableVirtualization?this._replacingVirtualContent():this._replacingContent())}else i.requestType!="refresh"||this.model.currentViewData!=0||this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),this._newungroup(i);this._showGridLines();this._completeAction(i)},i.prototype._showGridLines=function(){var n=this.model.gridLines;n!="both"&&this.getContent().addClass(n!="none"?"e-"+n+"lines":"e-hidelines")},i.prototype._newungroup=function(n){n.requestType=="ungrouping"?this._ungroup(n):this.getContentTable().find("tbody").empty().first().append(this._getEmptyTbody())},i.prototype.setFormat=function(){for(var i,r,t=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].type=="date"&&t.push(this.model.columns[n]);if(t.length>0)for(n=0;n<this.model.currentViewData.length;n++)for(i=0;i<t.length;i++)r=this.model.currentViewData[n][t[i].field],/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(r)&&(this.model.currentViewData[n][t[i].field]=new Date(this.model.currentViewData[n][t[i].field]))},i.prototype._completeAction=function(i){var u,r;if(this.model.editSettings.showAddNewRow||(this.model.isEdit=!1),this._confirmedValue=!1,t.HeatMapGrid.Actions.Grouping!=i.requestType||!t.isNullOrUndefined(i.columnName)){if(i.columnSortDirection!="ascending"&&i.columnSortDirection!="descending"||t.isNullOrUndefined(i.columnName)||(u=this.getColumnByField(i.columnName),this.model.allowSorting&&this.model.allowMultiSorting?this._scolumns.push(u.field):this._gridSort=u.field),i.requestType!="beginedit"&&i.requestType!="add"&&this.setWidthToColumns(),(i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&(this._isAddNew=!1,this.model.isResponsive&&this.model.minWidth&&this.windowonresize()),this.initialRender||!(t.HeatMapGrid.Actions.UnGrouping==i.requestType||this.model.groupSettings.groupedColumns.length>0)||n("#"+this._id+"EditForm").length?t.HeatMapGrid.Actions.Sorting==i.requestType&&this.model.allowSorting||t.HeatMapGrid.Actions.Refresh==i.requestType||t.HeatMapGrid.Actions.Cancel==i.requestType?!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i):t.HeatMapGrid.Actions.Delete==i.requestType||t.HeatMapGrid.Actions.Save==i.requestType||t.HeatMapGrid.Actions.Search==i.requestType?(this._editEventTrigger(i),!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i)):t.HeatMapGrid.Actions.Filtering==i.requestType?this._filterCompleteAction():t.HeatMapGrid.Actions.BeginEdit==i.requestType||t.HeatMapGrid.Actions.Add==i.requestType?this._editCompleteAction(i):(t.HeatMapGrid.Actions.Grouping==i.requestType||t.HeatMapGrid.Actions.Ungrouping==i.requestType)&&this["_"+i.requestType+"CompleteAction"](i):this._recalculateIndentWidth(),!this.initialRender&&this.model.showSummary&&this.model.summaryRows.length>0&&(this.model.currentViewData.length||this.element.children(".e-gridfooter").remove()),this.initialRender||(this.getContent().find("td.e-selectionbackground").length||this._setCurrentRow(i.requestType),i.requestType!="virtualscroll"&&this.clearColumnSelection()&&n(this.getHeaderTable().find("th.e-headercell")).removeClass("e-columnselection")),this.model.editSettings.editMode=="batch"&&this.refreshBatchEditMode(),(!this.initialRender&&(this.model.allowScrolling||this.model.isResponsive)&&(this._checkScrollActions(i.requestType)||this.model.editSettings.editMode.indexOf("inline")!=-1&&i.requestType=="beginedit")||this.model.scrollSettings.virtualScrollMode=="continuous"&&i.requestType=="virtualscroll")&&(this.model.isResponsive&&this.model.minWidth?this.windowonresize():this._refreshScroller(i)),this.model.scrollSettings.virtualScrollMode=="normal"&&i.requestType=="virtualscroll"&&this.getContent().find("div:first").scrollLeft(this.getScrollObject().scrollLeft()),this._customPop!=null&&i.requestType!="sorting"&&this._customPop.hide(),!this.model.allowScrolling||this.initialRender||this.model.scrollSettings.enableVirtualization||this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell"),t.HeatMapGrid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0&&this._groupingCompleteAction(i),t.HeatMapGrid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length<1&&this._ungroupingCompleteAction(i),this.model.textWrapSettings&&this._setTextWrap(),(this._isUngrouping||this._columnChooser)&&i.requestType=="refresh"||(this._isUngrouping=!1,this._columnChooser=!1),this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&(this.initialRender||this.getContentTable().find("tr.e-addedrow").length!=0||this.element.find(".e-gridcontent").find("tr").length==0||this._startAdd()),(t.HeatMapGrid.Actions.BeginEdit==i.requestType||t.HeatMapGrid.Actions.Add==i.requestType)&&n.isFunction(n.validator)&&this.setValidation(),this.initialRender||(this.model._groupingCollapsed=[]),!this.initialRender&&i.requestType=="refresh")for(r=0;r<this.model.filterSettings.filteredColumns.length;r++)this.getHeaderTable().find(".e-headercelldiv").eq(this.getColumnIndexByField(this.model.filterSettings.filteredColumns[r].field)).parent().find(".e-filtericon").addClass("e-filteredicon e-filternone");this.model.columnLayout!="fixed"||this.model.isEdit||this.setWidthToColumns()}},i.prototype._getDataIndex=function(n,t){for(var i,u,f=0,r=0,e=n.length;r<e;r++){for(i=0,u=this._primaryKeys.length;i<u;i++)if(this._checkPrimaryValue(n[r][this._primaryKeys[i]],t[this._primaryKeys[i]],this._primaryKeys[i]))continue;else i==u-1&&(f=1);if(f)return r}return-1},i.prototype._checkPrimaryValue=function(n,t,i){return this.getColumnByField(i).type=="string"&&(n=n.trim()),n!=t?!0:!1},i.prototype._eventBindings=function(){var a=this.model.scrollSettings.frozenColumns>0?this._gridRows[0].length:this._gridRows.length,e=0,h,c=this.model.pageSettings.pageSize,i,r,u,o,f,s,l;if(this._gridRecordsCount!=0&&(this.model.queryCellInfo!=null||this.model.rowDataBound!=null||this.model.mergeCellInfo!=null||this.model.templateRefresh!=null))for(i=0;i<a;i++){if(r=null,e=i,this.model.scrollSettings.allowVirtualScrolling&&i<c)if(this.model.scrollSettings.enableVirtualization){if(r=n(this._gridRows).eq(i),u=parseInt(n(r).attr("name"),32),n.inArray(u,this._queryCellView)!=-1)continue;this._virtualLoadedRecords[u]&&(o=this._virtualLoadedRecords[u][i%this._virtualRowCount]);e=u*this._virtualRowCount+i%this._virtualRowCount}else{for(f=0;f<this._cloneQuery.queries.length;f++)h=this._cloneQuery.queries[f].fn=="onPage"&&this._cloneQuery.queries[f].e.pageIndex-1;s=c*h;s!=0&&(r=this.getContentTable().find("tr[name="+s+"]").eq(i),e=r.index())}else this.model.scrollSettings.enableVirtualization&&(r=n(this._gridRows).eq(i));if(r=r||this.getRowByIndex(e),r.hasClass("e-virtualrow")||t.isNullOrUndefined(this._currentJsonData[i]||o))break;l=this.model.scrollSettings.enableVirtualization?o:this._currentJsonData[i];this._rowEventTrigger(r,l)}},i.prototype._rowEventTrigger=function(i,r){for(var o,f={row:i,data:r},s=i.cells,e=n(i).find(".e-rowcell"),u=0;u<e.length;u++)f={cell:e[u],data:r,text:e[u].innerHTML},o=this._getForeignKeyData(f.data),n(e[u]).hasClass("e-rowcell")&&(f.column=this.model.columns[u]),t.isNullOrUndefined(o)||(f.foreignKeyData=o),this._heatmap._setBinding(f),n(e[u]).hasClass("e-templatecell")&&(f={cell:e[u],column:this.model.columns[u],data:r,rowIndex:n(i).index()})},i.prototype.setWidthToColumns=function(){var r=this.getContentTable().children("colgroup").find("col"),u=this.getHeaderTable().children("colgroup").find("col"),f=this.element.width(),o=0,s=0,v=0,y,w,b,l,a,p,e,rt,h,i;for(this.model.groupSettings.groupedColumns.length&&!this.model.allowScrolling&&this.model.groupSettings.showGroupedColumn&&(y=this.getBrowserDetails(),y.browser=="msie"&&parseInt(y.version,10)>8&&r.first().css("width",3e3/f+"%")),t.isNullOrUndefined(this.model.detailsTemplate)||(w=this.model.groupSettings.groupedColumns.length,b=this.model.groupSettings.groupedColumns.length!=0?1:0,r.eq(b).css("width",this._detailsOuterWidth),u.eq(w).css("width",this._detailsOuterWidth)),this._detailColsRefresh(),r=this._$headerCols,u=this._$contentCols,i=0;i<u.length;i++){if(this.model.allowResizeToFit&&this.model.columns[i].width===undefined&&this.columnsWidthCollection[i]===undefined){var ut=this.model.groupSettings.groupedColumns.length?i+this.model.groupSettings.groupedColumns.length:i,k=this._resizer._getContentWidth(i),d=this.getHeaderTable().find(".e-headercelldiv").eq(ut),g=this._resizer._getHeaderContentWidth(d);v=this.model.editSettings.editMode=="normal"&&(this.model.isEdit||this._isAddNew)?r.eq(i).width():(k>g?k:g)+parseInt(d.css("padding-left"),10);this.columnsWidthCollection[i]=v;s+=this.model.columns[i].visible?v:0}else s+=this.model.columns[i].visible?parseInt(this.model.columns[i].width,10):0;if(t.isNullOrUndefined(this.columnsWidthCollection[i])){if(this.model.allowScrolling){var ft=(f/this.model.columns.length).toFixed(2),et=(f/(this.model.scrollSettings.buttonSize||18)/100).toFixed(2),c=ft-et;r.eq(i).css("width",c+"px");u.eq(i).css("width",c+"px");this.model.columns[i].width=c;this.columnsWidthCollection[i]=parseFloat(c)}}else r.eq(i).width(this.columnsWidthCollection[i]),u.eq(i).width(this.columnsWidthCollection[i]),this.model.columns[i].priority&&u.eq(i).addClass("e-table-priority-"+this.model.columns[i].priority)}if(this.model.columnLayout=="fixed"){this.model.scrollSettings&&this.model.scrollSettings.frozenColumns==0&&(this.getHeaderTable().width(s),this.getContentTable().width(s));var ot=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),nt=this.getHeaderContent().width()>ot?"addClass":"removeClass",tt=this.getHeaderTable(),it=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(tt=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),it=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0));tt[nt]("e-tableLastCell");it[nt]("e-tableLastCell")}if(!this.model.allowScrolling&&this.model.allowResizeToFit&&s>f&&(this.model.allowScrolling=!0,this.model.scrollSettings.width=f,this.getHeaderTable().parent().addClass("e-headercontent"),!this.model.scrollSettings.frozenColumns>0&&this.getHeaderTable().width(f)),this.model.isEdit&&(e=r.clone(),this.model.editSettings.showAddNewRow&&(l=this.getContentTable().find(".e-editedrow")),a=this.model.scrollSettings.frozenColumns>0?this.getContent().find(".gridform").find("colgroup"):!t.isNullOrUndefined(l)&&l.length==1?l.find("colgroup"):n("#"+this._id+"EditForm").find("colgroup"),this.model.scrollSettings.frozenColumns>0&&a.first().empty().append(e.splice(0,this.model.scrollSettings.frozenColumns)),a.last().empty().append(e),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&a.prepend(this._getIndentCol())),this.model.groupSettings.groupedColumns.length)for(p=this.getContentTable().find(".e-recordtable").children("colgroup"),i=0;i<p.length;i++)e=r.clone(),rt=this._detailsOuterWidth!=null?this._detailsOuterWidth:"30px",(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&e.splice(0,0,n(this._getIndentCol()).width(rt)[0]),p.eq(i).empty().append(e);if(this.model.scrollSettings.frozenColumns>0){for(h=0,i=0;i<this.columnsWidthCollection.length;i++)h+=parseInt(this.columnsWidthCollection[i],10),this.model.scrollSettings.frozenColumns-1==i&&(o=Math.ceil(h));this.getContent().find(".e-frozencontentdiv").outerWidth(o).end().find(".e-movablecontentdiv").outerWidth(h-o);this.getHeaderContent().find(".e-frozenheaderdiv").outerWidth(o).end().find(".e-movableheaderdiv").outerWidth(h-o)}},i.prototype._initialEndRendering=function(){if(this.model.scrollSettings.frozenColumns>0&&!this.model.allowScrolling){this.getContent().remove();this.getHeaderTable().eq(1).remove();return}if(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization,this._getRowHeights(),this.element.width()!=0)this.model.allowScrolling&&this._renderScroller();else if(this.model.allowScrolling&&this.element.width()==0){var n=this,i=setInterval(function(){n.element.width()==0||t.isNullOrUndefined(n.element.width())||(n._renderScroller(),n._endRendering(),clearInterval(i))},100);return}this._endRendering()},i.prototype._endRendering=function(){var n,i;!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&this.model.allowScrolling&&(n=this.getScrollObject());i=this.model.enableRTL?"e-summaryscroll e-rtl":"e-summaryscroll";this.model.allowScrolling&&this.model.showSummary&&n._vScroll&&this.element.find(".e-summaryrow.e-scroller").addClass(i);this._addMedia();this.model.allowScrolling&&this.model.allowTextWrap&&!this.model.scrollSettings.allowVirtualScrolling&&this.getContent().first().ejScroller("refresh");this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage()!=1||this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=this._currentJsonData),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView():this._refreshVirtualContent(),this.getContent().first().ejScroller("refresh"),this.getContent().ejScroller("isVScroll")?(this.element.find(".e-gridheader").addClass("e-scrollcss"),this.getHeaderTable().first().width(this.getContentTable().width())):this.element.find(".e-gridheader").removeClass("e-scrollcss"));this._selectedRow()!=-1&&(this.model.currentIndex=this._selectedRow());this.rowHeightRefresh();this.initialRender&&(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow()},i.prototype._addLastRow=function(){var r=this.getContentTable().find("tr:last").find("td"),u=0,i;if(this.model.allowScrolling&&!this.model.scrollSettings.allowVirtualScrolling&&!t.isNullOrUndefined(this.model.dataSource)&&!t.isNullOrUndefined(this.getRows())){for(i=0;i<this.getRows().length;i++)u+=n(this.getRows()[i]).height();u<this.getContent().height()-1&&r.addClass("e-lastrowcell")}this.model.scrollSettings.allowVirtualScrolling&&this.getContentTable().height()<this.getContent().height()&&r.addClass("e-lastrowcell")},i.prototype._addMedia=function(){if(typeof this.model.scrollSettings.width!="string"&&this.model.scrollSettings.width>0?this._responsiveScrollWidth=this._originalScrollWidth=this.model.scrollSettings.width:this._originalScrollWidth=this.element.width(),typeof this.model.scrollSettings.height!="string"&&this.model.scrollSettings.height>0&&(this._responsiveScrollHiehgt=this.model.scrollSettings.height),this.model.minWidth&&this.model.isResponsive){if(this._$onresize=n.proxy(this.windowonresize,this),n(window).bind("resize",this._$onresize),n.isFunction(window.matchMedia)){var t=window.matchMedia("(max-width: 768px)");this._mediaStatus=t.matches}this.windowonresize()}},i.prototype._getNoncontentHeight=function(){var n=this.getHeaderContent().outerHeight();return this.model.allowGrouping&&this.model.groupSettings.showDropArea&&(n+=this.element.find(".e-groupdroparea").outerHeight()),n},i.prototype._mediaQueryUpdate=function(n,i,r,u){var e,o,s,f;if(window.innerWidth<=320&&this.model.enableResponsiveRow){e=this.getContentTable()[0].style;e.removeAttribute?e.removeAttribute("min-width"):e.removeProperty("min-width");o=this.getContent().data("ejScroller");o&&this.getContent().ejScroller("destroy");return}n?(this.model.scrollSettings.width=t.isNullOrUndefined(this._responsiveScrollWidth)?r:Math.min(this._responsiveScrollWidth,r),f=Math.min(u,i)-this._getNoncontentHeight(),f=t.isNullOrUndefined(this._responsiveScrollHiehgt)?f:Math.min(this._responsiveScrollHiehgt,f),f=this.model.scrollSettings.height!="auto"?f-(parseInt(this.element.parent().css("margin-bottom"))+1):this.model.scrollSettings.height,this.model.minWidth>r&&i>u&&(f=f!="auto"?f+this.model.scrollSettings.buttonSize:f),t.isNullOrUndefined(this.getRows())&&(f="100%"),this.model.scrollSettings.height=f,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller()):(this.model.scrollSettings.width="100%",t.isNullOrUndefined(this._responsiveScrollWidth)||(this.model.scrollSettings.width=Math.min(this._responsiveScrollWidth,r)),s=Math.min(u,i),f=s-this._getNoncontentHeight(),t.isNullOrUndefined(this._responsiveScrollHiehgt)||(f=Math.min(this._responsiveScrollHiehgt,u)),f=this.model.scrollSettings.height!="auto"?f-parseInt(this.element.parent().css("margin-bottom")):this.model.scrollSettings.height,t.isNullOrUndefined(this.getRows())&&(f="100%"),this.model.scrollSettings.height=f,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller())},i.prototype.windowonresize=function(){var i,f;this.model.scrollSettings.width=this._responsiveScrollWidth;this.element.width("100%");this.getContentTable().width("100%");this.getHeaderTable().width("100%");this.getContentTable().css("minWidth",this.model.minWidth);i=this.element.width();var e=n(window).height()-this.element.offset().top,s=t.isNullOrUndefined(this.getRows())?1:this.getRows().length,o=this.element.parent().is(n("body"))||this.element.parent().height()==n("body").height()||this.element.parent()[0].style.height=="",r=this.getContentTable()[0].scrollHeight+this._getNoncontentHeight(),u=o?e:this.element.parent().height();r+=parseInt(this.element.parent().css("margin-top"));f=this.model.minWidth>i||u<=r;this._mediaQueryUpdate(f,u,i,r);this._refreshScroller({})},i.prototype._getRowHeights=function(){var n=this.getRows(),i,r,t;if(n!==null)if(this._rowHeightCollection=[],n[1]!==undefined&&n[1].length&&(this.model.scrollSettings.frozenColumns>0&&n[0]!==undefined||n[0]!==undefined&&typeof n[0].item!="undefined"&&typeof n[0].length=="number"&&typeof n[1].item!="undefined"&&typeof n[1].length=="number"))for(i=n[0],r=n[1],t=0;t<i.length;t++)this._rowHeightCollection[t]=i[t].offsetTop>=r[t].offsetTop?i[t].offsetTop:r[t].offsetTop;else for(t=0;t<n.length;t++)this._rowHeightCollection[t]=n[t].offsetTop;return this._rowHeightCollection},i.prototype._getEmptyTbody=function(){var i=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length});return n(document.createElement("tr")).append(i)},i.prototype._getIndentCol=function(){return t.buildTag("col","",{width:"30px"})},i.prototype._wireEvents=function(t){t._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",n.proxy(this._clickHandler,this));this._enableRowHover(undefined,t);this.model.allowGrouping&&(this._enableGroupingEvents(),this._on(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",n.proxy(this._dropAreaHover,this)))},i.prototype._clickHandler=function(t){var i=n(t.target),e=n("[id$='ccDiv'].e-grid.e-columnChooser"),o,a=n("#"+this._id+"EditForm"),s,r,u,v,f,y,h,c,l,p,w;if(e.length)for(v=!0,f=0;f<e.length;f++)(i.parents(".e-ccButton").length||i.hasClass("e-ccButton"))&&(v=n(t.target).closest(".e-grid").attr("id")+"ccDiv"!=e[f].id);if(i.closest(".e-grid").attr("id")===this._id&&!i.closest("#"+this._id+"EditForm").length){if(i.hasClass("e-rowcell")||i.closest("td").is(".e-rowcell")||i.hasClass("e-headercell")&&t.clientY-i.offset().top<i.height()/4){if(this._bulkEditCellDetails.cancelSave){this._bulkEditCellDetails.cancelSave=!1;return}if(this.model.editSettings.editMode=="batch"&&n.isFunction(n.validator)&&a.length&&a.validate().errorList.length>0)return;this.model.editSettings.editMode=="batch"&&this.element.focus();s=i.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0;y=i.closest(".e-rowcell").index()!=-1?i.closest(".e-rowcell").index():i.closest(".e-headercell").index()-this.model.groupSettings.groupedColumns.length;r=i.hasClass("e-rowcell")?i.index()-s:y-s;r=this.model.detailsTemplate!=null||this.model.childGrid!=null?r-1:r;this.model.scrollSettings.frozenColumns&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(r=r+this.model.scrollSettings.frozenColumns);u=this.getIndexByRow(i.closest("tr"));this._bulkEditCellDetails.columnIndex=r;this._bulkEditCellDetails.rowIndex=u;this.model.allowSelection&&(this.model.selectionType=="multiple"&&((t.ctrlKey||this._enableSelectMultiTouch)&&(this.multiSelectCtrlRequest=!0),t.shiftKey&&(this.multiSelectShiftRequest=!0,this._allowcellSelection&&u>-1&&this.selectCells([[u,[r]]]),this._selectedRow(this.getIndexByRow(i.closest("tr")))),t.pointerType=="touch"&&this._customPop!=null&&!this._customPop.is(":visible")&&this._customPop.find(".e-rowselect").hasClass("e-spanclicked")&&this.model.selectionSettings.selectionMode=="row"&&this._customPop.show(),t.pointerType=="touch"&&this._customPop!=null&&(this._customPop.find(".e-sortdirect").is(":visible")||!this._customPop.find(".e-rowselect").hasClass("e-spanclicked"))&&this.model.selectionType=="multiple"&&(this._customPop.removeAttr("style"),h=i.offset(),this._customPop.offset({top:0,left:0}).offset({left:h.left,top:h.top-this.getRowHeight()}).find(".e-sortdirect").hide().end().find(".e-rowselect").show().end().show())),this.multiSelectShiftRequest||(this._allowcellSelection&&u>-1&&(c=this._checkCellSelectionByRow(u,r),(this.model.selectionSettings.enableToggle&&this.selectedRowCellIndexes.length==1&&this.selectedRowCellIndexes[0].cellIndex.length==1||t.ctrlKey&&this.model.selectionType=="multiple")&&c!=-1&&this.selectedRowCellIndexes.length>0&&this.selectedRowCellIndexes[0].cellIndex.length>0?this.clearCellSelection(c.rowIndex,r):this.selectCells([[u,[r]]])),this._allowrowSelection&&u>-1&&(l=this.getIndexByRow(i.closest("tr")),this.model.scrollSettings.enableVirtualization&&(p=u%this._virtualRowCount,w=parseInt(n(i).closest("tr").attr("name"),32),l=w*this._virtualRowCount-(this._virtualRowCount-p)),this.model.selectionSettings.enableToggle&&this.getSelectedRecords().length==1&&n.inArray(this.getIndexByRow(i.closest("tr")),this.selectedRowsIndexes)!=-1&&this.clearSelection(l)),this._allowcolumnSelection&&i.hasClass("e-headercell")&&!i.hasClass("e-stackedHeaderCell")&&t.clientY-i.offset().top<i.height()/4&&this.model.selectionSettings.enableToggle&&this.selectedColumnIndexes.length==1&&n.inArray(r,this.selectedColumnIndexes)!=-1&&this.clearColumnSelection(r),this.multiSelectCtrlRequest=!1),this.multiSelectShiftRequest=!1);o=this.model.columns[this._bulkEditCellDetails.columnIndex].field;i.closest(".e-rowcell").length&&o&&(this._tabKey=!1,this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="batch"&&this.editCell(n.inArray(i.closest("tr").get(0),this.getRows()),o))}(i.hasClass("e-rowselect")||i.hasClass("e-sortdirect"))&&(i.hasClass("e-spanclicked")?(i.removeClass("e-spanclicked"),i.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!1),i.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!1),this._customPop.hide()):(i.addClass("e-spanclicked"),i.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!0),i.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!0)));i.is(".e-filtericon")&&i.closest(".e-detailrow").length!=0&&t.preventDefault();this.model.allowSearching&&this._searchBar!=null&&(i.is(this._searchBar.find(".e-cancel"))?this._searchBar.find("input").val(""):t.target.id==this._id+"_searchbar"?this._searchBar.find(".e-cancel").removeClass("e-hide"):this._searchBar.find(".e-cancel").hasClass("e-hide")||this._searchBar.find(".e-cancel").addClass("e-hide"))}},i.prototype._checkCellSelectionByRow=function(t,i){for(var r=0;r<this.selectedRowCellIndexes.length;r++)if(this.selectedRowCellIndexes[r].rowIndex==t)break;return r!=this.selectedRowCellIndexes.length&&n.inArray(i,this.selectedRowCellIndexes[r].cellIndex)!=-1?this.selectedRowCellIndexes[r]:-1},i.prototype._destroy=function(){var t,r,u,i;if(this.element.off(),this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").add(this.getContent().find(".e-content,.e-movablecontent")).unbind("scroll"),t=n("#"+this._id+"EditForm"),t.length){for(r=t.find(".e-field"),i=0;i<r.length;i++)u=n(r[i]);t.remove()}this.model.showColumnChooser&&(n("#"+this._id+"ccDiv").remove(),n("#"+this._id+"_ccTail").remove(),n("#"+this._id+"_ccTailAlt").remove());this.model.allowFiltering&&this.model.filterSettings.filterType=="excel"&&this._excelFilter.resetExcelFilter();this.model.allowReordering&&n(".e-columndropindicator").remove();this._$onresize&&n(window).unbind("resize",this._$onresize);this.element.empty().removeClass("e-grid "+this.model.cssClass)},i}();t.HeatMapGrid=function(n,t){return new i(n,t)};t.HeatMapGrid.Locale=t.HeatMapGrid.Locale||{};t.HeatMapGrid.Actions={Paging:"paging",Sorting:"sorting",Filtering:"filtering",BeginEdit:"beginedit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Grouping:"grouping",Ungrouping:"ungrouping",Refresh:"refresh",Reorder:"reorder",Search:"searching",BatchSave:"batchsave",VirtualScroll:"virtualscroll"};t.HeatMapGrid.ClipMode={Ellipsis:"ellipsis",Clip:"clip",EllipsisWithTooltip:"ellipsiswithtooltip"};t.HeatMapGrid.SelectionType={Single:"single",Multiple:"multiple"};t.HeatMapGrid.SelectionMode={Row:"row",Cell:"cell",Column:"column"};t.HeatMapGrid.Locale["default"]=t.HeatMapGrid.Locale["en-US"]={EmptyRecord:"No records to display",GroupDropArea:"Drag a column header here to group its column",DeleteOperationAlert:"No records selected for delete operation",EditOperationAlert:"No records selected for edit operation",SaveButton:"Save",OkButton:"OK",CancelButton:"Cancel",EditFormTitle:"Details of ",AddFormTitle:"Add New Record",Notactionkeyalert:"This Key-Combination is not available",Keyconfigalerttext:"This Key-Combination has already been assigned to ",GroupCaptionFormat:"{{:headerText}}: {{:key}} - {{:count}} {{if count == 1 }} item {{else}} items {{/if}} ",BatchSaveConfirm:"Are you sure you want to save changes?",BatchSaveLostChanges:"Unsaved changes will be lost. Are you sure you want to continue?",ConfirmDelete:"Are you sure you want to Delete Record?",CancelEdit:"Are you sure you want to Cancel the changes?",PagerInfo:"{0} of {1} pages ({2} items)",FrozenColumnsViewAlert:"Frozen columns should be in grid view area",FrozenColumnsScrollAlert:"Enable allowScrolling while using frozen Columns",FrozenNotSupportedException:"Frozen Columns and Rows are not supported for Grouping, Row Template, Detail Template, Hierarchy Grid and Batch Editing",Add:"Add",Edit:"Edit",Delete:"Delete",Update:"Update",Cancel:"Cancel",Done:"Done",Columns:"Columns",SelectAll:"(Select All)",PrintGrid:"Print",ExcelExport:"Excel Export",WordExport:"Word Export",PdfExport:"PDF Export",StringMenuOptions:[{text:"StartsWith",value:"StartsWith"},{text:"EndsWith",value:"EndsWith"},{text:"Contains",value:"Contains"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],NumberMenuOptions:[{text:"LessThan",value:"LessThan"},{text:"GreaterThan",value:"GreaterThan"},{text:"LessThanOrEqual",value:"LessThanOrEqual"},{text:"GreaterThanOrEqual",value:"GreaterThanOrEqual"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],PredicateAnd:"AND",PredicateOr:"OR",Filter:"Filter",FilterMenuCaption:"Filter Value",FilterbarTitle:"'s filter bar cell",MatchCase:"Match Case",Clear:"Clear",ResponsiveFilter:"Filter",ResponsiveSorting:"Sort",Search:"Search",DatePickerWaterMark:"Select date",EmptyDataSource:"DataSource must not be empty at initial load since columns are generated from dataSource in AutoGenerate Column Grid",ForeignKeyAlert:"The updated value should be a valid foreign key value",True:"true",False:"false",UnGroup:"Click here to ungroup",AddRecord:"Add Record",EditRecord:"Edit Record",DeleteRecord:"Delete Record",Save:"Save",Grouping:"Group",Ungrouping:"Ungroup",SortInAscendingOrder:"Sort In Ascending Order",SortInDescendingOrder:"Sort In Descending Order",NextPage:"Next Page",PreviousPage:"Previous Page",FirstPage:"First Page",LastPage:"Last Page",EmptyRowValidationMessage:"Atleast one field must be updated",NoResult:"No Matches Found"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};Heatmap=function(n){function t(t,i){return n.call(this),this._rootCSS="e-heatmap",this._grid=null,this.PluginName="ejHeatMap",this._setFirst=!1,this.id="null",this.model=null,this.validTags=["div"],this.defaults={itemsSource:null,itemsMapping:{itemsSource:null,columnStyle:{headerTemplateID:"",templateID:"",textAlign:"",width:null},headerMapping:{columnStyle:{headerTemplateID:"",templateID:"",textAlign:"",width:null},displayName:"",propertyName:""},column:{displayName:"",propertyName:""},columnMapping:null,row:{displayName:"",propertyName:""},value:{displayName:"",propertyName:""}},colorMappingCollection:null,selectedItem:null,legendCollection:[],heatMapCell:{showContent:"visible",showColor:!0},cellMouseOver:null,cellMouseEnter:null,cellMouseLeave:null,cellSelected:null,isResponsive:!1,enableVirtualization:!1,enableRTL:!1,defaultColumnStyle:{textAlign:"center",headerTemplateID:"",templateID:""},enableTooltip:!1,tooltipSettings:{templateId:null,position:{stem:{horizontal:"left",vertical:"center"},target:{horizontal:"right",vertical:"center"}},isBalloon:!0,animation:{effect:"none",speed:0},associate:"mouseFollow",trigger:"hover"},width:null,height:null},this.observables=["heatMapCell.showContent","heatMapCell.showColor",],this.dataTypes={colorMappingCollection:"data",itemsMapping:{columnMapping:"data"},itemsSource:"data",legendCollection:"data"},this._tags=[{tag:"colorMappingCollection",attr:["value","color","label.bold","label.italic","label.text","label.textDecoration","label.fontSize","label.fontFamily","label.fontColor",],singular:"colorMapping"}],this._heatmapShowContent=ej.util.valueFunction("heatMapCell.showContent"),this._heatmapShowColor=ej.util.valueFunction("heatMapCell.showColor"),t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejHeatMap(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype._setModel=function(n){var t=!1,i=this._grid,u,r;if(i){for(u in n)switch(u){case"colorMappingCollection":n.colorMappingCollection&&n.colorMappingCollection.length>0&&(this.model.colorMappingCollection=n.colorMappingCollection,t=!0);break;case"itemsSource":n.itemsSource&&(this.model.itemsSource=n.itemsSource,r=void 0,r=this.model.itemsMapping&&this.model.itemsMapping.column&&this.model.itemsMapping.row?this._bindCellMapValues():this._bindTableMapValues(),i.dataSource(r.dataTableMapping,!1),t=!0);break;case"legendCollection":n.legendCollection&&n.legendCollection>0&&(this.model.legendCollection=n.legendCollection);break;case"heatMapCell":case"heatmapCell":n.heatmapCell&&(n.heatmapCell.showContent!=undefined&&(n.heatMapCell.showContent=n.heatmapCell.showContent),n.heatmapCell.showColor!=undefined&&(n.heatMapCell.showColor=n.heatmapCell.showColor));n.heatMapCell&&(n.heatMapCell.showColor&&(typeof n.heatMapCell.showColor()=="boolean"?this._heatmapShowColor(n.heatMapCell.showColor()):this.model.heatMapCell.showColor=n.heatMapCell.showColor||n.heatMapCell.showColor===!1?n.heatMapCell.showColor:this.model.heatMapCell.showColor),n.heatMapCell.showContent&&(typeof n.heatMapCell.showContent()=="function"?this._heatmapShowContent(n.heatMapCell.showContent()):this.model.heatMapCell.showContent=n.heatMapCell.showContent||n.heatMapCell.showContent===!1?n.heatMapCell.showContent:this.model.heatMapCell.showContent),t=!0);break;case"tooltipSettings":case"enableTooltip":n.enableTooltip!=undefined&&(this.model.enableTooltip=n.enableTooltip);n.tooltipSettings&&(n.tooltipSettings.position&&(this.model.tooltipSettings.position=n.tooltipSettings.position),n.tooltipSettings.isBalloon!=undefined&&(this.model.tooltipSettings.isBalloon=n.tooltipSettings.isBalloon),n.tooltipSettings.animation&&(this.model.tooltipSettings.animation=n.tooltipSettings.animation),n.tooltipSettings.associate&&(this.model.tooltipSettings.associate=n.tooltipSettings.associate),n.tooltipSettings.trigger&&(this.model.tooltipSettings.trigger=n.tooltipSettings.trigger),n.tooltipSettings.templateId!==undefined&&n.tooltipSettings.templateId!==null&&(this.model.tooltipSettings.templateId=n.tooltipSettings.templateId));this._hasClass(this.element[0],"e-tooltip")&&($("#"+this.element[0].id).data("ejTooltip").destroy(),this.element.addClass("e-js"));this._renderTooltip()}t&&(i.refreshContent(),this._updateResponsiveSize(i))}},t.prototype._hasClass=function(n,t){for(var r=n.classList,i=0;i<r.length;i++)if(r[i]==t)return!0},t.prototype._init=function(){var n=this._getSpace();this._initData();this._updateDataSource();this._wireEvents();this._renderMapGrid();this._renderTooltip()},t.prototype._wireEvents=function(){this._on($(window),"resize",this._updateResponsiveSize);this._on($(window),"load",this._updateResponsiveSize);$(window).bind("mousewheel DOMMouseScroll",$.proxy(this._hideLegendMarker,this))},t.prototype._hideLegendMarker=function(){for(var i,n=$(".gradient_scale_marker"),t=0;n.length>0&&t<n.length;t++)n[t]&&(i=n[t],i.style.visibility="hidden")},t.prototype._getBoundingClientRect=function(n){var t=n.getBoundingClientRect();return ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"&&(t={left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:$(n).width(),height:$(n).height()}),t},t.prototype._getSpace=function(){var n=this._getBoundingClientRect(this.element[0])},t.prototype._initData=function(){typeof this.model.legendCollection=="string"&&(this.model.legendCollection=JSON.parse(this.model.legendCollection));this._updateHeatMapCellData(this.model);this.model.enableTooltip&&this.model.tooltipSettings&&!this.model.tooltipSettings.templateId&&(this.model.tooltipSettings.templateId=this.element[0].id+"_DefaultTooltipDiv")},t.prototype._updateHeatMapCellData=function(n){n&&n.heatmapCell&&(n.heatmapCell.showContent!=undefined&&(this.model.heatMapCell.showContent=n.heatmapCell.showContent),n.heatmapCell.showColor!=undefined&&(this.model.heatMapCell.showColor=n.heatmapCell.showColor))},t.prototype._updateDataSource=function(){},t.prototype._bindTableMapValues=function(){var o=[],f=[],e,r,n,u,i,t;if(this.model.itemsSource&&this.model.itemsSource.length>0)for(e=this.model.itemsSource,t=0;t<e.length;t++)o.push(e[t]);for(r=this.model.itemsMapping.headerMapping,n=r.columnStyle,n=this._mergeDefaultSettings(n,!0),u=!0,u=this.model.enableVirtualization?!1:u,r&&f.push({field:r.propertyName,headerText:r.displayName,isFrozen:u,width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""}),i=this.model.itemsMapping.columnMapping,t=0;i&&t<i.length;t++)n=i[t].columnStyle,n=this._mergeDefaultSettings(n,!1),f.push({field:i[t].propertyName,headerText:i[t].displayName,width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""});return{dataTableMapping:o,columns:f}},t.prototype._renderMapGrid=function(){var n=null,u,t,i,r;n=this.model.itemsMapping&&this.model.itemsMapping.column&&this.model.itemsMapping.column.propertyName!=""&&this.model.itemsMapping.row&&this.model.itemsMapping.row.propertyName!=""?this._bindCellMapValues():this._bindTableMapValues();u=null;this.model.height===null&&delete this.model.height;this.model.width===null&&delete this.model.width;n&&$("#"+this.element[0].id)[0]&&(t=ej.HeatMapGrid({},this),i={height:this.model.height!==undefined?this.model.height-40:"auto",width:this.model.width!==undefined?Number(this.model.width):"100%",allowVirtualScrolling:this.model.enableVirtualization?!0:!1,virtualScrollMode:"normal",enableVirtualization:this.model.enableVirtualization?!0:!1},this.model.width===undefined&&delete i.width,r={dataSource:n.dataTableMapping?n.dataTableMapping:[],columns:n.columns?n.columns:[],enableRowHover:!1,allowScrolling:!0,selectionSettings:{selectionMode:[ej.HeatMapGrid.SelectionMode.Cell]},queryCellInfo:$.proxy(this._setBinding,this),cellSelected:$.proxy(this._cellSelected,this),isResponsive:this.model.isResponsive?this.model.isResponsive:!1,enableResponsiveRow:!1,scrollSettings:i,minWidth:10,enableRTL:this.model.enableRTL?this.model.enableRTL:!1},t._init($("#"+this.element[0].id),r,this),this._updateResponsiveSize(t))},t.prototype._updateResponsiveSize=function(n){var e,o,u,f,t,i,r;if(this.model.isResponsive){if(e=$(".e-movableheaderdiv"),o=$(".e-movablecontentdiv"),e.css("width","100%"),o.css("width","100%"),e[0]&&(u=e[0].getElementsByTagName("colgroup")[0],u&&u.childNodes&&u.childNodes.length>0))for(t=0;this.model.itemsMapping.columnMapping&&t<this.model.itemsMapping.columnMapping.length;t++)i=this.model.itemsMapping.columnMapping[t],!i||i.columnStyle&&i.columnStyle.width||(r=$(u.childNodes[t]),r&&r[0]&&(r[0].style.width=""));if(o[0]&&(f=o[0].getElementsByTagName("colgroup")[0],f&&f.childNodes&&f.childNodes.length>0))for(t=0;this.model.itemsMapping.columnMapping&&t<this.model.itemsMapping.columnMapping.length;t++)i=this.model.itemsMapping.columnMapping[t],!i||i.columnStyle&&i.columnStyle.width||(r=$(f.childNodes[t]),r&&r[0]&&(r[0].style.width=""));n&&n._refreshScroller&&$(".e-scrollbar")[0]&&(this.model.enableVirtualization||$(".e-scrollbar")[0].parentNode.removeChild($(".e-scrollbar")[0]),n._initScrolling())}},t.prototype._cellSelected=function(n){this.model.selectedItem={cellValue:n.currentCell[0].ejHeatMapData.cellValue,source:n.currentCell[0].ejHeatMapData.data,cell:n.currentCell[0]};this._raiseEvent("cellSelected",{cellValue:n.currentCell[0].ejHeatMapData.cellValue,source:this._getTableData(n.currentCell[0].ejHeatMapData),cell:n.currentCell[0]})},t.prototype._componentToHex=function(n){var t=n.toString(16);return t.length===1?"0"+t:t},t.prototype._rgbToHex=function(n,t,i){return isNaN(n)&&isNaN(t)&&isNaN(i)?"":"#"+this._componentToHex(n)+this._componentToHex(t)+this._componentToHex(i)},t.prototype._setBinding=function(n){var t=$(n.cell),r=this._convertToRBG(ej.parseFloat(ej.format(n.text,"c")),this.model.colorMappingCollection),f=this._rgbToHex(r.R,r.G,r.B),u=this.model.itemsMapping.columnStyle&&this.model.itemsMapping.columnStyle[n.column.field]?this.model.itemsMapping.columnStyle[n.column.field]:null,i;this._heatmapShowColor()!=undefined&&(n.column.field&&u&&u.fillColor?(i=this._getForeGroundColor(u.fillColor),t.css("background-color",u.fillColor).css("color",i?i:"black")):(this._heatmapShowColor()===!1?t.css("background-color","white"):(i=this._getForeGroundColor(r),t.css("background-color",f).css("color",i?i:"")),this._setClassOnForzen(n.cell)&&t.index()===0&&t.css("font-weight","normal").css("font-size",12)));this._canEnableContent(n)&&(t[0].innerHTML=" ");this._bindHoverOutEvents(n,f);this.model.itemsMapping.headerMapping&&n.column.field&&this.model.itemsMapping.headerMapping.propertyName===n.column.field||t.addClass("sf-ht-enabletooltip")},t.prototype._canEnableContent=function(n){if(this._heatmapShowContent()===ej.datavisualization.HeatMap.CellVisibility.Hidden)return this.model.itemsMapping.headerMapping&&n.column&&this.model.itemsMapping.headerMapping.propertyName===n.column.field?!1:!0},t.prototype._setClassOnForzen=function(n){do if(n)if(n=n.parentNode,n){if(n.className==="e-movablecontent")return!0}else break;while(n&&n.className!=="e-gridcontent");return!1},t.prototype._getForeGroundColor=function(n){if(n.R!==undefined&&n.G!==undefined&&n.B!==undefined){var t=(n.R+n.G+n.B)/3;return t<255*.5?"white":isNaN(n.R)&&isNaN(n.G)&&isNaN(n.B)?"":"black"}return null},t.prototype._getTableData=function(n){var f=n.data,i,r,u,t;if(this.model.itemsMapping&&this.model.itemsMapping.column&&this.model.itemsMapping.row){if(i=this.model.itemsMapping.row,r=this.model.itemsMapping.column,n.column.field)return u=n.column.field,t={},t[i.propertyName]=f[i.propertyName],t.value=n.cellValue,t[r.propertyName]=u,t}else return n.data},t.prototype._bindHoverOutEvents=function(n,t){$(n.cell).mouseenter($.proxy(this._cellMouseEnter,this)).mousemove($.proxy(this._cellMouseHover,this)).mouseleave($.proxy(this._cellMouseOut,this));n.cell.ejHeatMapData={column:n.column,cellValue:n.text,data:n.data,rgb:t}},t.prototype._cellMouseOut=function(n){var t,i,r;for(this._raiseEvent("cellMouseLeave",{cellValue:n.currentTarget.ejHeatMapData.cellValue,source:this._getTableData(n.currentTarget.ejHeatMapData),cell:n.currentTarget}),t=$(".gradient_scale_marker"),i=0;t.length>0&&i<t.length;i++)t[i]&&(r=t[i],r.style.visibility="hidden")},t.prototype._cellMouseHover=function(n){this._raiseEvent("cellMouseOver",{cellValue:n.currentTarget.ejHeatMapData.cellValue,source:this._getTableData(n.currentTarget.ejHeatMapData),cell:n.currentTarget})},t.prototype._cellMouseEnter=function(n){var i,t,r,u;if(this.model.legendCollection.length>0)for(i=0,t=null;i<this.model.legendCollection.length;i++)r=this.model.legendCollection[i],r&&$("#"+r)[0]&&(u=$("#"+r).data("ejHeatMapLegend"),u&&(n.currentTarget.ejHeatMapData&&(t=n.currentTarget.ejHeatMapData.cellValue),t&&u.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient.toString()&&(t=Number(t),this.model.itemsMapping.headerMapping&&n.currentTarget.ejHeatMapData&&n.currentTarget.ejHeatMapData.column.field&&this.model.itemsMapping.headerMapping.propertyName===n.currentTarget.ejHeatMapData.column.field?this._hideLegendMarker():this._drawLegendMarker(u,t))));this._raiseEvent("cellMouseEnter",{cellValue:n.currentTarget.ejHeatMapData.cellValue,source:this._getTableData(n.currentTarget.ejHeatMapData),cell:n.currentTarget})},t.prototype._raiseEvent=function(n,t){if(this.model[n])return this._trigger(n,t)},t.prototype._drawDefaultTooltip=function(n){var t=document.getElementById(this.element[0].id+"_DefaultTooltipDiv");return t||(t=this._createDefaultTooltip(n)),t},t.prototype._createDefaultTooltip=function(n){var r=document.createElement("div"),f,t,i,u;return f={id:this.element[0].id+"_DefaultTooltipDiv","class":"e-heatmap-tooltip-default",style:"padding-top:3px; height: 24px;pointer-events:none;position: absolute"},t=this.model.itemsMapping.headerMapping&&this.model.itemsMapping.headerMapping.displayName?this.model.itemsMapping.headerMapping.displayName:"",t==""&&(t=this.model.itemsMapping.row&&this.model.itemsMapping.row.displayName?this.model.itemsMapping.headerMapping.displayName:""),n.event.currentTarget&&n.event.currentTarget.ejHeatMapData&&this.model.itemsMapping.headerMapping&&this.model.itemsMapping.headerMapping.propertyName&&(i=n.event.currentTarget&&n.event.currentTarget.ejHeatMapData,u=i.data[this.model.itemsMapping.headerMapping.propertyName]),r.innerHTML="<table><tr><td style='min-width:50px;padding-right: 10px;'>"+t+"<\/td><td>"+u+"<\/td><\/tr><tr><td>Value<\/td><td>"+i.cellValue+"<\/td><\/tr><\/table>",r},t.prototype._renderTooltip=function(){var n=this;n.model.enableTooltip&&$("#"+this.element[0].id).ejTooltip({target:".sf-ht-enabletooltip",position:this.model.tooltipSettings.position,isBalloon:this.model.tooltipSettings.isBalloon,animation:this.model.tooltipSettings.animation,associate:this.model.tooltipSettings.associate,trigger:this.model.tooltipSettings.trigger,beforeOpen:function(t){if(n.model.enableTooltip)if($("#"+n.element[0].id).ejTooltip("instance").hide(),t.event.currentTarget&&t.event.currentTarget.ejHeatMapData&&n.model.tooltipSettings.templateId!=this.element[0].id+"_DefaultTooltipDiv")$("#"+n.element[0].id).ejTooltip({content:$.templates("#"+n.model.tooltipSettings.templateId).render(t.event.currentTarget.ejHeatMapData)});else{var i=n._drawDefaultTooltip(t);$("#"+n.element[0].id).ejTooltip({content:$.templates(i).render(t.event.currentTarget.ejHeatMapData)})}}})},t.prototype._drawLegendMarker=function(n,t){var o,u,r;if(n&&t!==undefined&&!isNaN(t)){if(o=$("#"+n._id+"_gradient_scale")[0],o){u="position:absolute;visibility:visible;box-sizing:border-box;";r=$("#"+n._id+"_gradient_scale_marker")[0];r||(r=document.createElement("div"),r.setAttribute("id",n._id+"_gradient_scale_marker"),r.setAttribute("class","gradient_scale_marker"),o.appendChild(r));var i=this._getBoundingClientRect(o),s=this._getBoundingClientRect(r),f=this._getScroll(),e=this.model.colorMappingCollection,h=e[e.length-1].value;u+=n.model.orientation==="horizontal"?"width: 0;height: 0;border-left:"+i.height/2+"px solid transparent;border-right: "+i.height/2+"px solid transparent;border-bottom: "+i.height+"px solid green;":"border-left: none;border-right: "+i.width+"px solid green;border-bottom: "+i.width/2+"px solid transparent;border-top: "+i.width/2+"px solid transparent;";var l=e[0].value,c=e[e.length-1].value,a=c-l;n.model.orientation==="horizontal"?(u+=this.model.enableRTL?"left:"+(Math.round(i.left+f.x-s.width/2+1)+(Number((c-t)*100/h)/100*i.width-3))+"px;":"left:"+(Math.round(i.left+f.x-s.width/2+1)+(Number(t*100/h)/100*i.width-3))+"px;",u+="top:"+(i.top+f.y+2)+"px;"):(u+="left:calc("+(i.left+f.x)+"px + 0px);",u+=this.model.enableRTL?"top: calc( "+Math.round(i.top+f.y-s.height/2+1)+"px + "+(Number((c-t)*100/h)/100*i.height-3)+"px);":"top: calc( "+Math.round(i.top+f.y-s.height/2+1)+"px + "+(Number(t*100/h)/100*i.height-3)+"px);");r.setAttribute("style",u)}}else this._hideLegendMarker()},t.prototype._getScroll=function(){if(window.pageYOffset!==undefined)return{x:pageXOffset?pageXOffset:0,y:pageYOffset?pageYOffset:0};var n=void 0,t=void 0,i=document,r=i.documentElement,u=i.body;return n=r.scrollLeft||u.scrollLeft||0,t=r.scrollTop||u.scrollTop||0,{x:n?n:0,y:t?t:0}},t.prototype._convertToRBG=function(n,t){var u=0,o,e,i,s,h,c;typeof n=="number"?u=Number(n):typeof n=="string"||n==null;var r=0,f=0;t=this._orderbyOffset(t);for(o in t)if(e=Number(t[o].value),e!==undefined)if(u<=e){f=e;break}else f=e,r=e;return u<r||u>f,i=0,r!==undefined?(s=f-r,i=(u-r)/s,i=isNaN(i)&&u===0?0:i):r=f,i<0||i>1,h=this._getEqualColor(t,r),c=this._getEqualColor(t,f),this._getPercentageColor(i,h,c)},t.prototype._hashCode=function(n){for(var t=0,i=0;i<n.length;i++)t=n.charCodeAt(i)+((t<<5)-t);return t},t.prototype._intToRGB=function(n){var t=(n&16777215).toString(16).toUpperCase();return"00000".substring(0,6-t.length)+t},t.prototype._getPercentageColor=function(n,t,i){var e=i,u,o=t,r,f;e.split("#").length>1?u=e.split("#")[1]:(f=this._intToRGB(this._hashCode(e)),u=f);r=null;o.split("#").length>1?r=o.split("#")[1]:(f=this._intToRGB(this._hashCode(o)),r=f);var s=this._getPercentage(n,parseInt(r.substr(0,2),16),parseInt(u.substr(0,2),16)),h=this._getPercentage(n,parseInt(r.substr(2,2),16),parseInt(u.substr(2,2),16)),c=this._getPercentage(n,parseInt(r.substr(4,2),16),parseInt(u.substr(4,2),16));return{R:s,G:h,B:c}},t.prototype._getPercentage=function(n,t,i){var r=i-t;return Math.round(t+r*n)},t.prototype._getEqualColor=function(n,t){for(var r,i=0;i<n.length;i++)if(r=n[i],r&&Number(r.value)===t)return r.color;return"#00000"},t.prototype._orderbyOffset=function(n){for(var u,t,i,r=0;r<n.length-1;r++)t=n[r],i=n[r+1],t&&i&&t.value&&i.value&&t.value>i.value&&(u=t,t=i,i=u);return n},t.prototype._mergeDefaultSettings=function(n,t){var r,i;return n&&(r=n.width===undefined?!0:!1),i=$.extend(!0,{},this.model.defaultColumnStyle,n),t&&this.model.enableRTL&&(i.textAlign=!n||n&&!n.textAlign?"right":n.textAlign),r&&delete i.width,i},t.prototype._bindCellMapValues=function(){var f=[],e={prLeft:this.model.itemsMapping.row.propertyName,prTop:this.model.itemsMapping.column.propertyName,prValue:this.model.itemsMapping.value.propertyName},i=this._convertToCellBindingData(this.model.itemsSource,e),r=this.model.itemsMapping.row,o=this.model.itemsMapping.column,n=this._getCellBingingColumnData(r.propertyName,!0),u,t;for(n=this._mergeDefaultSettings(n,!1),r&&(u=!0,u=this.model.enableVirtualization?!1:u,f.push({field:r.propertyName,headerText:r.displayName,isFrozen:u,width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""})),t=0;t<i.items.length;t++)n=this._getCellBingingColumnData(i.items[t],!1),n=this._mergeDefaultSettings(n,!1),f.push({field:i.items[t],headerText:i.items[t],width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""});return{dataTableMapping:i.dataTableMapping,columns:f}},t.prototype._getCellBingingColumnData=function(n,t){var u,i,r,f;if(t){if(u=this.model.itemsMapping&&this.model.itemsMapping.headerMapping,u.propertyName===n)return this._mergeColumnStyle(u.columnStyle,!0)}else if(i=this.model.itemsMapping&&this.model.itemsMapping.columnMapping,i&&i.length>0)for(r=0;r<i.length;r++)if(f=this._mergeDefaultSettings(i[r],!1),f.propertyName===n)return this._mergeColumnStyle(f.columnStyle,!1);return null},t.prototype._mergeColumnStyle=function(n,t){return n=this._mergeDefaultSettings(n,t),$.extend(!0,{},{textAlign:n&&n.textAlign?n.textAlign:"center"},n)},t.prototype._convertToCellBindingData=function(n,t){var u=[],e=[],c,i,r,f,o,s,h;for(c in n)if(i=n[c],i&&(r={},i[t.prLeft]))if(u.length===0)f=!1,r.hasOwnProperty(i[t.prLeft])||(r[t.prLeft]=i[t.prLeft],u.push(r),f=!0),f&&(r[i[t.prTop].toString()]=i[t.prValue]);else{for(f=!1,o=0;o<u.length;o++)s=u[o],s&&s[t.prLeft]===i[t.prLeft]&&(s[i[t.prTop]]=i[t.prValue],e.indexOf(i[t.prTop])===-1&&e.push(i[t.prTop].toString()),f=!0);f||(h=!1,r.hasOwnProperty(i[t.prLeft])||(r[t.prLeft]=i[t.prLeft],u.push(r),h=!0),h&&(r[i[t.prTop].toString()]=i[t.prValue],e.indexOf(i[t.prTop])===-1&&e.push(i[t.prTop].toString())))}return{dataTableMapping:u,items:e}},t}(ej.WidgetBase);window.ej.widget("ejHeatMap","ej.datavisualization.HeatMap",new Heatmap);ej.datavisualization.HeatMap.CellVisibility={Visible:"visible",Hidden:"hidden"};ej.datavisualization.HeatMap.Effect={Slide:"slide",Fade:"fade",None:"none"};ej.datavisualization.HeatMap.Trigger={Hover:"hover",Click:"click"};ej.datavisualization.HeatMap.Associate={MouseFollow:"mouseFollow",MouseEnter:"mouseEnter",Target:"target"};ej.datavisualization.HeatMap.Horizontal={Left:"left",Center:"center",Right:"right"};ej.datavisualization.HeatMap.Vertical={Top:"top",Center:"center",Bottom:"bottom"};ej.datavisualization.HeatMap.TextAlign={Right:"right",Left:"left",Center:"center"};ej.datavisualization.HeatMap.LegendMode={Gradient:"gradient",List:"list"};ej.datavisualization.HeatMap.LegendOrientation={Horizontal:"horizontal",Vertical:"vertical"};ej.datavisualization.HeatMap.TextDecorations={Underline:"underline",Overline:"overline",LineThrough:"line-through",None:"none"};HeatmapLegend=function(n){function t(t,i){return n.call(this),this.defaults={colorMappingCollection:null,orientation:ej.datavisualization.HeatMap.LegendOrientation.Horizontal,showLabel:!0,legendMode:"gradient",height:null,width:null,isResponsive:!1,enableRTL:!1},this.validTags=["div"],this._rootCSS="e-heatmaplegend",this._id="",this.setFirst=!1,this.PluginName="ejHeatMapLegend",this.id="null",this.model=null,this.dataTypes={colorMappingCollection:"data"},this._tags=[{tag:"colorMappingCollection",attr:["value","color","label.bold","label.italic","label.text","label.textDecoration","label.fontSize","label.fontFamily","label.fontColor",],singular:"colorMapping"}],t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejHeatMapLegend(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype._init=function(){this._initLegendData();this._wireEvents();this._renderLegend()},t.prototype._setLabel=function(n){var t=n?n:{};return t.bold=t&&t.bold!==undefined?t.bold:!1,t.italic=t&&t.italic!==undefined?t.italic:!1,t.text=t&&t.text?t.text:"",t.textDecoration=t&&t.textDecoration?t.textDecoration:ej.datavisualization.HeatMap.TextDecorations.None,t.fontSize=t&&t.fontSize?t.fontSize:10,t.fontFamily=t&&t.fontFamily?t.fontFamily:"Arial",t.fontColor=t&&t.fontColor?t.fontColor:"black",t},t.prototype._initLegendData=function(){this.model.colorMappingCollection=this._getSortedMappingList(this.model.colorMappingCollection);for(var n=0;n<this.model.colorMappingCollection.length;n++)this.model.colorMappingCollection[n].label=this._setLabel(this.model.colorMappingCollection[n].label)},t.prototype._wireEvents=function(){this._on($(window),"resize",this._updateLegendSize);$(this.element[0].parentNode).scroll($.proxy(this._hideLegendMarker,this))},t.prototype._hideLegendMarker=function(){var n=$(".gradient_scale_marker");for(var t in n)n[t]&&n[t].parentNode&&n[t].parentNode.removeChild(n[t])},t.prototype._scrollElement=function(){var n=$("#"+this._id+"_gradient_scale_marker")[0];n&&n.parentNode.removeChild(n)},t.prototype._getLargerGradientLabel=function(){for(var u,n,f,t={left:0,top:0,width:0,height:0},i=this.model.colorMappingCollection,r=0;i&&r<i.length;r++)u=i[r],n=document.createElement("span"),this.element[0].appendChild(n),this._mergeLabelProperties(n,u),u.label&&(f=this._getBoundingClientRect(n),t=this._union(t,f)),n.parentNode.removeChild(n);return t},t.prototype._getBoundingClientRect=function(n){var t=n.getBoundingClientRect();return ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"&&(t={left:t.left<0?0:t.left,top:t.top<0?0:t.top,right:t.right<0?0:t.right,bottom:t.bottom<0?0:t.bottom,width:$(n).outerWidth(),height:$(n).outerHeight()}),{left:t.left<0?0:t.left,top:t.top<0?0:t.top,right:t.right<0?0:t.right,bottom:t.bottom<0?0:t.bottom,width:t.width,height:t.height}},t.prototype._getSpace=function(){var t=this._getLargerGradientLabel(),n=this._getBoundingClientRect(this.element[0]);return n={bottom:n.bottom,height:n.height-(t.height/2+2),left:n.left,right:n.right,top:n.top,width:this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?n.width-10:n.width},this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient&&(this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?n.width=n.width-t.width/2:n.height=n.height-t.height/2),n},t.prototype._renderLegend=function(){var n=$("#"+this.element[0].id)[0],i,r,t;n&&($("div."+this.element[0].id).find("*").removeAttr("style"),$("#"+this.element[0].id).empty());i=this.model.height?this.model.height:"100%";r=this.model.width?this.model.width:"100%";$("#"+this.element[0].id).attr("role","heatmap-legend").css("height",i).css("width",r).css("overflow","hidden");t=this._getSpace(null);this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient?this._renderGradient(t,n,null):this._renderList(t,n,null)},t.prototype._mergeLabelProperties=function(n,t){if(n&&t&&t.label){var i=t.label;i&&(n.innerHTML=this.model.legendMode!=="gradient"&&i.text?i.text:t.value,n.style.fontFamily=i.fontFamily,n.style.fontSize=i.fontSize+"px",n.style.fontColor=i.fontColor,n.style.textDecoration=i.textDecoration,n.style.fontWeight=i.bold?"bold":"",n.style.fontStyle=i.italic?"italic":"")}},t.prototype._union=function(n,t){var i=Math.min(n.left,t.left),r=Math.min(n.top,t.top),u=Math.max(n.width,t.width),f=Math.max(n.height,t.height);return{left:i,top:r,width:u-i,height:f-r}},t.prototype._updateLegendSize=function(n){if(this.model.isResponsive){var r=this.model.height?this.model.height:"100%",u=this.model.width?this.model.width:"100%",t=$("#"+this.element[0].id)[0],i=this._getSpace(!0);this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient?this._renderGradient(i,t,n):this._renderList(i,t,n)}},t.prototype._renderListBox=function(n,t,i,r,u,f){var e=$("#"+t)[0],h,s,c,o,l;e||(e=document.createElement("div"),e.setAttribute("id",t),this.model.enableRTL?$(n).prepend(e):n.appendChild(e),e.setAttribute("style","height:auto;height:auto;float:left;vertical-align: middle;"));e.setAttribute("role","list");h="";s=$("#"+e.id+"_colordiv_")[0];s||(s=document.createElement("div"),s.setAttribute("id",e.id+"_colordiv_"),e.appendChild(s));h="background-color:"+i.color+";";s.setAttribute("style",h+"height:"+u+"px;width:"+r+"px;float:left");this.model.showLabel&&(c=this._getBoundingClientRect(e),o=$("#"+e.id+"_labelSpan_")[0],o||(o=document.createElement("span"),o.setAttribute("id",e.id+"_labelSpan_"),o.setAttribute("aria-label","label"),o.setAttribute("class","sf-ht-label"),o.innerHTML=i.label&&i.label.text?i.label.text:i.value,e.appendChild(o)),o.setAttribute("style","float:left;margin-left:3px;margin-right:3px;margin-right:3px;margin-bottom:3px;"),this._mergeLabelProperties(o,i),l=this._getBoundingClientRect(o),o.style.marginTop=c.height/2-l.height/2+"px");this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?e.style.margin="10px":(!f||this.model.enableRTL)&&($("#"+e.id+"_colordiv_br")[0]||$(e).after("<div id="+e.id+"_colordiv_br> <\/br><\/br><\/div> "))},t.prototype._renderList=function(n,t,i){var r=$("#"+t.id+"_list")[0],f,u,e;for(r?i&&(r.innerHTML=""):(r=document.createElement("div"),r.setAttribute("id",t.id+"_list"),t.appendChild(r),r.setAttribute("style","height:auto;height:auto;float:left;")),f=this.model.colorMappingCollection,u=0;u<f.length;u++)this._renderListBox(r,t.id+"_listBox_"+u,f[u],15,15,u===f.length-1?!0:!1);var o=this._getBoundingClientRect(t),s=this._getBoundingClientRect(r),h=o.width/2-s.width/2;r.style.marginLeft=h<=0?"0px":h+"px";e=o.height/2-s.height/2;r.style.marginTop=e<=0?"0px":e+"px"},t.prototype._setAttribute=function(n,t){if(n)for(var i in t)n.setAttribute(i,t[i])},t.prototype._renderGradient=function(n,t,i){var r=$("#"+this.element[0].id+"_gradient_scale_line")[0],f,o,u,s,e;r||(r=document.createElement("div"),t.appendChild(r));f=this.model.orientation==="horizontal"?"":"float:left;";f+=this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?"height:"+(40/100*n.height+20/100*n.height)+"px;width:"+n.width+"px; ":"height:"+n.height+"px;width:"+(40/100*n.width+20/100*n.width)+"px;";o=this._getStartlabelOffset();f+=this.model.orientation==="horizontal"?"padding-left:"+o.width+"px;":"padding-top:"+(o.height/2-1)+"px;";r.setAttribute("style",f);this._setAttribute(r,{id:"#"+this.element[0].id+"_gradient_scale_line"});r.setAttribute("style",f);u=$("#"+this.element[0].id+"_gradient")[0];u?i&&(u.innerHTML=""):(u=document.createElement("div"),r.appendChild(u));this._setAttribute(u,{id:this.element[0].id+"_gradient",role:"gradient"});s="to right , ";e="float:left; ";this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?e+="height:"+(40/100*n.height-2)+"px; width:"+n.width+"px; ":(s="to bottom , ",e+="height:"+n.height+"px;width:"+(40/100*n.width-2)+"px;");u.setAttribute("style",e);this._renderGradientElements(u);this._renderGradientScale(n,r,i);this._renderGradientScaleValue(n,t,i)},t.prototype._renderGradientElements=function(n){var i=this.model.colorMappingCollection,p=Number(i[0].value),f=i.length,s=Number(i[i.length-1].value),t,l,o,a,v;if(f>0){var h=0,c=0,e=this._getBoundingClientRect(n);for(t=1;i&&t<f;t++){var r="float:left;border:none;",u=$("#"+this.element[0].id+"_inner_gradient"+t)[0],y=this._childElementsBounds(n).width?this._childElementsBounds(n).width:0;u||(u=document.createElement("div"),this.model.enableRTL?$(n).prepend(u):n.appendChild(u));this.model.orientation==="horizontal"?(l=i[t].value*100/s,o=e.width*(l/100)-h,t===f-1&&(o=e.width-y-1),r+="height:100%;width:"+o+"px;",r+=this.model.enableRTL?ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t].color+", endColorstr="+i[t-1].color+",GradientType=1 );":"background:linear-gradient(to right ,"+i[t].color+", "+i[t-1].color+");":ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t-1].color+", endColorstr="+i[t].color+",GradientType=1 );":"background:linear-gradient(to right ,"+i[t-1].color+", "+i[t].color+");"):(a=i[t].value*100/s,v=e.height*(a/100)-c,r+="width:100%;height:"+v+"px;",r+=this.model.enableRTL?ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t].color+", endColorstr="+i[t-1].color+",GradientType=0 );":"background:linear-gradient(to bottom ,"+i[t].color+", "+i[t-1].color+");":ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t-1].color+", endColorstr="+i[t].color+",GradientType=0 );":"background:linear-gradient(to bottom ,"+i[t-1].color+", "+i[t].color+");");this._setAttribute(u,{id:this.element[0].id+"_inner_gradient"+t,style:r});h=this._childElementsBounds(n).width;c=this._childElementsBounds(n).height}}},t.prototype._getStartlabelOffset=function(){var n=document.createElement("span"),t,i;return this.element[0].appendChild(n),t=this.model.colorMappingCollection[0],this._mergeLabelProperties(n,t),i=null,t.label&&(i=this._getBoundingClientRect(n)),n.parentNode.removeChild(n),i},t.prototype._renderGradientScaleValue=function(n,t,i){var u=$("#"+this.element[0].id+"_gradient_scale_value")[0],o,r;u?i&&(u.innerHTML=""):(u=document.createElement("div"),t.appendChild(u));this._setAttribute(u,{id:this.element[0].id+"_gradient_scale_value"});o="float:left;";o+=this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?"width: 100%;":"height:100%;width:12px;margin-left:2px;";u.setAttribute("style",o);var f=this.model.colorMappingCollection,h=this._getBoundingClientRect(u),e=null,s=this._getStartlabelOffset();if(this.model.enableRTL)for(r=f.length-1;r>=0;r--)e=this._createGradientLabel(n,f[r],u,this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?!0:!1,r,e,r===0?s.width/2:0,0);else for(r=0;r<f.length;r++)e=this._createGradientLabel(n,f[r],u,this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?!0:!1,r,e,r===0?s.width/2:0,0)},t.prototype._createGradientLabel=function(n,t,i,r,u,f,e,o){var c,s,h,a;if(this.model.showLabel){c=this._getBoundingClientRect(i);s=$("#"+this.element[0].id+"_gradient_scale_value"+t.value)[0];s||(s=document.createElement("span"),i.appendChild(s));s.setAttribute("id",this.element[0].id+"_gradient_scale_value"+t.value);h="float:left;";h+="height:auto;";h+="width:auto;";s.setAttribute("style",h);s.innerHTML=t.value;this._mergeLabelProperties(s,t);var d=this._getBoundingClientRect(s),l=this.model.colorMappingCollection,g=l[l.length-1].value,nt=this._getScroll(),b=$("#"+this.element[0].id+"_gradient")[0],k=l[0].value,w=l[l.length-1].value,v=w-k,y=0,p=0;return b&&(c=this._getBoundingClientRect(b)),r?(y=this.model.enableRTL?Math.round(r?(w-t.value)/v*c.width:0):Math.round(r?t.value/v*c.width:0),h+="margin-left:"+(y+(e?e:0)-(f&&f.x?f.x:0))+"px;"):(p=this.model.enableRTL?Math.round((w-t.value)/v*c.height):Math.round(t.value/v*c.height),h+="margin-top:"+(p+(u===1?-3:0)+(o?o:0)-(f&&f.y?f.y:0))+"px;"),r?p=0:y=0,s.setAttribute("style",h),s.setAttribute("aria-label","label"),s.setAttribute("class","sf-ht-label"),this._mergeLabelProperties(s,t),a=this._getBoundingClientRect(s),{x:y+a.width+(e?a.width/2:0),y:p+a.height-(u===0?0:0)+(o?a.height/2:0)}}},t.prototype._renderGradientScale=function(n,t,i){var u=$("#"+this.element[0].id+"_gradient_scale")[0],o,f,r;if(u?i&&(u.innerHTML=""):(u=document.createElement("div"),t.appendChild(u)),this._setAttribute(u,{id:this.element[0].id+"_gradient_scale"}),o="float:left;",o+=this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?"height:"+20/100*n.height+"px; width:"+n.width+"px; margin-top:2px;":"height:"+n.height+"px;width:"+20/100*n.width+"px; margin-left:2px",u.setAttribute("style",o),this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient){var e=this.model.colorMappingCollection,s=this._getBoundingClientRect(u),h=e[e.length-1].value;if(this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal)for(f=this._createValueLine(this.element[0].id+"_gradient_scale_first",!0,n,"",u),r=1;r<e.length;r++)f+=this._createSpaceLine(this.element[0].id+r+"space",!0,n,"",u,f,e[r],r),f+=this._createValueLine(this.element[0].id+r+"value",!0,n,"",u);else for(f=this._createValueLine(this.element[0].id+"_gradient_scale_first",!1,n,"",u),r=1;r<e.length;r++)f+=this._createSpaceLine(this.element[0].id+r+"space",!1,n,"",u,f,e[r],r),f+=this._createValueLine(this.element[0].id+r+"value",!1,n,"",u)}},t.prototype._childElementsBounds=function(n){var i=n.childNodes,u={left:0,top:0,right:0,bottom:0,width:0,height:0},r,t;if(i.length>0)for(t=0;t<i.length;t++)i[t]&&(r=this._getBoundingClientRect(i[t]),r&&(u.width+=r.width,u.height+=r.height));return u},t.prototype._createSpaceLine=function(n,t,i,r,u,f,e,o){var y=this._getBoundingClientRect(u),w=this._childElementsBounds(u),s=$("#"+n)[0],h,a,v;s||(s=document.createElement("div"),s.setAttribute("id",n),this.model.enableRTL?$(u).prepend(s):u.appendChild(s));h="float:left;border: 1px solid gray; ";var c=this.model.colorMappingCollection,b=c[0].value,k=c[c.length-1].value,p=k-b,l=t?e.value/p*y.width:0;return l-=o===1||o===c.length-1?5:4,t&&(l-=w.width),a=Math.round(t?0:e.value/p*y.height-(o===1?6:4)),t||(a-=f),h+="height:"+Math.floor(a)+"px;",h+="width:"+Math.floor(l)+"px;",s.setAttribute("style",h),v=this._getBoundingClientRect(s),t?v.width:v.height},t.prototype._createValueLine=function(n,t,i,r,u){var s=this._getBoundingClientRect(u),f=$("#"+n)[0],o;f||(f=document.createElement("div"),f.setAttribute("id",n),this.model.enableRTL?$(u).prepend(f):u.appendChild(f));var e="float:left;",h=t?0:s.width,c=t?s.height:0;return e+="height:"+c+"px;",e+="width:"+h+"px;",e+="border: 1px solid gray; ",r&&(e+=r),f.setAttribute("style",e),o=this._getBoundingClientRect(f),t?o.width:o.height},t.prototype._getScroll=function(){if(window.pageYOffset!==undefined)return{x:pageXOffset?pageXOffset:0,y:pageYOffset?pageYOffset:0};var n=void 0,t=void 0,i=document,r=i.documentElement,u=i.body;return n=r.scrollLeft||u.scrollLeft||0,t=r.scrollTop||u.scrollTop||0,{x:n?n:0,y:t?t:0}},t.prototype._getSortedMappingList=function(n){var t,i,r;if(n){for(t=0;t<n.length;t++)for(i=t+1;i<n.length;i++)Number(n[t].value)>Number(n[i].value)&&(r=n[t],n[t]=n[i],n[i]=r);return n}},t.prototype._setModel=function(n){var i,t;for(i in n)switch(i){case"colorMappingCollection":for(this.model.colorMappingCollection=n.colorMappingCollection?n.colorMappingCollection:this.model.colorMappingCollection,this.model.colorMappingCollection=this._getSortedMappingList(this.model.colorMappingCollection),t=0;t<this.model.colorMappingCollection.length;t++)this.model.colorMappingCollection[t].label=this._setLabel(this.model.colorMappingCollection[t].label);this._updateLegendSize(!0);break;case"legendMode":this._renderLegend()}},t}(ej.WidgetBase);window.ej.widget("ejHeatMapLegend","ej.datavisualization.HeatMapLegend",new HeatmapLegend),function(n,t,r){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.common={refreshContent:function(n){n&&(this.refreshTemplate(),this.refreshHeader());this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFilterBarTemplate();var i={};this._initialRenderings();i.requestType=t.Grid.Actions.Refresh;this._processBindings(i)},rowHeightRefresh:function(){var i,s,h,f,o;if(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.model.currentViewData)&&this.model.currentViewData.length){var u=this.getContentTable().get(0).rows,e=this.getContentTable().get(1).rows,r=0;if(this.getContent().find(".e-frozencontentdiv").is(":visible"))for(i=0;i<u.length;i++)n(u[i]).css("display")!="none"&&(s=u[i].getClientRects()[0].height,h=e[i].getClientRects()[0].height,r=t.isNullOrUndefined(s)||t.isNullOrUndefined(h)?t.max([u[i].offsetHeight,e[i].offsetHeight]):t.max([s,h]),n(u[i]).height(r),n(e[i]).height(r),i&&(i==this.model.scrollSettings.frozenRows-1||i==u.length-1)&&(r=r+1),this.model.allowTextWrap||i&&i!=this.model.scrollSettings.frozenRows-1||(r=r-1),this.model.isEdit&&n(u[i]).find("#"+this._id+"EditForm").length&&i&&n(u[i]).find("#"+this._id+"EditForm td").css("height",r),n(e[i]).find("#"+this._id+"EditForm td").css("height",r));if(this.model.showSummary&&this.model.summaryRows.length>0){var c=this.getFooterTable().get(0).rows,a=this.getFooterTable().get(1).rows,l=0;for(f=0;f<c.length;f++)l=t.max([c[f].getClientRects()[0].height,a[f].getClientRects()[0].height]),n(c[f]).height(l),n(a[f]).height(l)}this._getRowHeights();!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&(this.getScrollObject()._vScrollbar!=null||this.getScrollObject().isVScroll())&&(o=this.getScrollObject()._vScrollbar,(t.isNullOrUndefined(o)||o.value()!=o.model.maximum)&&this._scrollObject.refresh(this.model.scrollSettings.frozenColumns>0))}},dataSource:function(n,t){if(t&&(this._templateRefresh=!0),this._dataSource(n),this.model.scrollSettings.enableVirtualization||this._currentPage(1),this._updateDataSource=!0,this._refreshDataSource(n,t),this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling){var i=this._refreshVirtualPagerInfo();this._showPagerInformation(i)}this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData?this._refreshVirtualView():this._refreshVirtualContent(),this.getContent().ejScroller("isHScroll")&&this.getContent().ejScroller("scrollX",0,!0),this.getContent().ejScroller("isVScroll")?(this.model.scrollSettings.enableVirtualization||this.getContent().ejScroller("scrollY",0,!0),this.element.find(".e-gridheader").addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss"));(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow();this._trigger("dataBound",{})},_refreshDataSource:function(n,i){this._dataManager=n instanceof t.DataManager?n:t.DataManager(n);this._isRemoteSaveAdaptor=this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.remoteSaveAdaptor;this._isLocalData=!(this._dataSource()instanceof t.DataManager)||this._dataManager.dataSource.offline||this._isRemoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor;this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._virtualDataRefresh=!0,this._isLocalData&&this._refreshVirtualViewDetails(!0));this.refreshContent(t.isNullOrUndefined(i)?!0:i);t.isNullOrUndefined(this.getPager())||(this.getPager().ejPager("model.currentPage",1),this._refreshGridPager())},hideColumns:function(i){var v=0,s={},e,w=[],b,c,y=0,r,l,h,p,a;b=typeof i=="string"?this.getColumnByHeaderText(i):this.getColumnByHeaderText(i[0]);c=typeof i=="string"?this.getColumnByField(i):this.getColumnByField(i[0]);this._showHideColumns=!0;var o=this._isDuplicate(n.merge(n.merge([],this._visibleColumns),this._hiddenColumns)),f=o?"_hiddenColumnsField":"_hiddenColumns",u=o?"_visibleColumnsField":"_visibleColumns";if(!o&&c!=null)if(n.isArray(i))for(r=0;r<i.length;r++)l=this.getColumnByField(i[r]),i[r]=l!=null?l.headerText:i[r];else i=c.headerText;if(n.isArray(i))for(r=0;r<i.length;r++)e=n.inArray(i[r],this[u]),e!=-1?(this[f].push(i[r]),this[u].splice(e,1)):e==-1&&u=="_visibleColumnsField"&&n.inArray(i[r],this[f])==-1&&t.isNullOrUndefined(this.getColumnByField(i[r]))&&(this[f].push(this.getColumnByHeaderText(i[r]).field)&&this._hiddenColumns.push(this.getColumnByHeaderText(i[r]).field),this[u].splice(n.inArray(this.getColumnByHeaderText(i[r]).field,this[u]),1)&&this._visibleColumns.splice(n.inArray(i[r],this._visibleColumns),1));else e=n.inArray(i,this[u]),e!=-1?(this[f].push(i),this[u].splice(e,1)):e==-1&&u=="_visibleColumnsField"&&n.inArray(i,this[f])==-1&&t.isNullOrUndefined(this.getColumnByField(i))&&(this[f].push(this.getColumnByHeaderText(i).field)&&this._hiddenColumns.push(this.getColumnByHeaderText(i).field),this[u].splice(n.inArray(this.getColumnByHeaderText(i).field,this[u]),1)&&this._visibleColumns.splice(n.inArray(i,this._visibleColumns),1));for(r=0;r<this.model.columns.length;r++)if(h=o?"field":"headerText",n.inArray(t.isNullOrUndefined(this.model.columns[r][h])||this.model.columns[r][h]==""?this.model.columns[r].headerText:this.model.columns[r][h],this[f])!=-1&&(this.model.columns[r].visible&&w.push(this.model.columns[r]),this.model.columns[r].visible=!1,this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&this.model.columns.indexOf(this.model.columns[r])<this.model.scrollSettings.frozenColumns&&y++,v++),this[f].length==v)break;s.requestType="refresh";this._hideHeaderColumn(this[f],o);this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&(p=this._renderGridHeader(),this.element.find(".e-gridheader").replaceWith(p[0]),this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering(),this.model.allowReordering&&this._headerCellreorderDragDrop());this.refreshTemplate();this.model.scrollSettings.allowVirtualScrolling&&this._virtualShowHide(s);this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(s),this._isAddNew=!1);this.sendDataRenderingRequest(s);this.rowHeightRefresh();this.model.allowScrolling&&(this.model.scrollSettings.frozenColumns!=0||t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||(a=this._calculateWidth(),this.getHeaderTable().width(a),this.getContentTable().width(a)),t.isNullOrUndefined(this._scrollObject)||this.getScrollObject().refresh());this.model.showColumnChooser&&this._refreshColumnChooserList();this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&(y==this.model.scrollSettings.frozenColumns&&this._frozenPaneRefresh(),this.getScrollObject().refresh());this._showHideColumns=!1},showColumns:function(i){var y=0,s={},c=[],w,l,a,h,v,u,r,p;w=typeof i=="string"?this.getColumnByHeaderText(i):this.getColumnByHeaderText(i[0]);l=typeof i=="string"?this.getColumnByField(i):this.getColumnByField(i[0]);this._showHideColumns=!0;var o=this._isDuplicate(n.merge(n.merge([],this._visibleColumns),this._hiddenColumns)),f=o?"_hiddenColumnsField":"_hiddenColumns",e=o?"_visibleColumnsField":"_visibleColumns";if(!o&&l!=null)if(n.isArray(i))for(r=0;r<i.length;r++)a=this.getColumnByField(i[r]),i[r]=a!=null?a.headerText:i[r];else i=l.headerText;if(n.isArray(i))for(r=0;r<i.length;r++)u=n.inArray(i[r],this[f]),u!=-1?(this[f].splice(u,1),this[e].push(i[r])):u==-1&&f=="_hiddenColumnsField"&&n.inArray(i[r],this[e])==-1&&t.isNullOrUndefined(this.getColumnByField(i[r]))&&(this[e].push(this.getColumnByHeaderText(i[r]).field)&&this._visibleColumns.push(i[r]),this[f].splice(n.inArray(this.getColumnByHeaderText(i[r]).field,this[f]),1)&&this._hiddenColumns.splice(n.inArray(i[r],this._hiddenColumns),1));else u=n.inArray(i,this[f]),u!=-1?(this[f].splice(u,1),this[e].push(i)):u==-1&&f=="_hiddenColumnsField"&&n.inArray(i,this[e])==-1&&t.isNullOrUndefined(this.getColumnByField(i))&&(this[e].push(this.getColumnByHeaderText(i).field)&&this._visibleColumns.push(i),this[f].splice(n.inArray(this.getColumnByHeaderText(i).field,this[f]),1)&&this._hiddenColumns.splice(n.inArray(i,this._hiddenColumns),1));for(r=0;r<this.model.columns.length;r++)if(h=o?"field":"headerText",n.inArray(t.isNullOrUndefined(this.model.columns[r][h])||this.model.columns[r][h]==""?this.model.columns[r].headerText:this.model.columns[r][h],this[e])!=-1&&(this.model.columns[r].visible||c.push(this.model.columns[r]),this.model.columns[r].visible=!0,y++),this[e].length==y)break;if(this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0){for(v=!1,r=0;r<c.length;r++)u=this.model.columns.indexOf(c[r]),u<this.model.scrollSettings.frozenColumns&&(v=!0);if(v){for(r=0;r<this.model.columns.length;r++)n.inArray(this.model.columns[r].headerText,this._hiddenColumns)!=-1?this.model.columns[r].visible=!1:n.inArray(this.model.columns[r].headerText,this._visibleColumns)!=-1&&(this.model.columns[r].visible=!0);p=this._renderGridHeader();this.element.find(".e-gridheader").replaceWith(p[0]);this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering();this.model.allowReordering&&this._headerCellreorderDragDrop()}}s.requestType="refresh";this._showHeaderColumn(this[e],o);this.refreshTemplate();this.model.scrollSettings.allowVirtualScrolling&&this._virtualShowHide(s);this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(s),this._isAddNew=!1);this.sendDataRenderingRequest(s);this.rowHeightRefresh();this.model.allowScrolling&&!t.isNullOrUndefined(this._scrollObject)&&this.getScrollObject().refresh();this.model.showColumnChooser&&this._refreshColumnChooserList();this._showHideColumns=!1},_virtualShowHide:function(n){this._currentPage(1);this.model.query=this.commonQuery.clone();this._ensureDataSource(n);this._loadedJsonData=[];this._prevPage=this._currentPage()},resizeColumns:function(n,t){var i,r;if(n instanceof Array)for(i=0;i<n.length;i++)r=t instanceof Array?t[i]:t,this._setWidthColumnCollection(n[i],r);else this._setWidthColumnCollection(n,t);this.setWidthToColumns();this.model.scrollSettings.frozenColumns&&(this._frozenAlign(),this.rowHeightRefresh())},_setWidthColumnCollection:function(t,i){var r=this.getColumnByHeaderText(t)||this.getColumnByField(t);r.width=i;n.inArray(r.field,this._disabledResizingColumns)==-1&&(this.columnsWidthCollection[n.inArray(r,this.model.columns)]=i)},refreshTemplate:function(){this.addInitTemplate();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.model.allowGrouping&&this.addGroupingTemplate()},refreshHeader:function(){var n=this.element.find(".e-gridheader");this.element[0].replaceChild(this._renderGridHeader()[0],n[0]);this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering();this.model.allowGrouping&&this._headerCellgDragDrop();this.model.allowReordering&&this._headerCellreorderDragDrop();this.model.showColumnChooser&&this._renderColumnChooserData(!0);this.model.gridLines!="both"&&this._showHeaderGridLines()},set_dropColumn:function(i,u){var w,b,y,ut,ft,et,tt,ot,k,st,a,e,f,o,nt;if(this.model.allowReordering&&i!=u){this.model.columns.splice(u,0,this.model.columns.splice(i,1)[0]);var s=this.model.columns,p=this.getHeaderTable().find(".e-columnheader:last .e-headercell").not(".e-stackedHeaderCell"),c=p.find(".e-headercelldiv"),ht=this.getHeaderContent().find("div").first().scrollLeft();this.model.scrollSettings.frozenColumns||this.getHeaderTable().find("colgroup").replaceWith(this._getMetaColGroup());(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&this.getHeaderTable().find("colgroup").prepend(this._getIndentCol());w=function(t){var i=[],o,e,s;if(t!=r){["",r].indexOf(t.value)==-1&&(i.push({name:"value",value:t.value}),t.value="");for(var u=0,f=t.attributes,h=f.length;u<h;u++)o=/^jQuery[0-9]+$/,f[u].name.match(o)||i.push({name:f[u].name,value:f[u].value});for(e=0,s=i.length;e<s;e++)n(t).removeAttr(i[e].name);return i}};b=function(t,i){if(i!=r)for(var u=0,f=t.length;u<f;u++)t[u].name=="value"&&(i.value=t[u].value),n(i).attr(t[u].name,t[u].value)};this.getHeaderTable().find(".e-fltrtempdiv").length==0&&this.getHeaderTable().find(".e-filterdiv").length>0&&(y=this.getHeaderTable().find(".e-filterdiv input"));var d=t.isNullOrUndefined(y),h={cellattributes:[],headerattributes:[],filtercellattributes:[],filterThattributes:[]},it=i<u?i:u,rt=i<u?u:i;for(f=it,o=0;f<=rt;f++)ut=this.model.detailsTemplate!=null||this.model.childGrid!=null?f+1:f,h.headerattributes[o]=w(p[ut]),h.cellattributes[o]=w(c[f]),h.filtercellattributes[o]=d?[]:w(y[f]),h.filterThattributes[o]=d?[]:w(n(y[f]).closest("th")[0]),o++;ft=i<u?h.cellattributes.length-1:0;et=i<u?0:h.cellattributes.length-1;for(tt in h)h[tt].splice(ft,0,h[tt].splice(et,1)[0]);for(f=it,o=0;f<=rt;f++)ot=this.model.detailsTemplate!=null||this.model.childGrid!=null?f+1:f,b(h.headerattributes[o],p[ot]),b(h.cellattributes[o],c[f]),d||b(h.filtercellattributes[o],y[f]),d||b(h.filterThattributes[o],n(y[f]).closest("th")[0]),o++;if(this.model.allowFiltering&&["menu","excel"].indexOf(this.model.filterSettings.filterType)!=-1){for(this._$fDlgIsOpen&&this._closeFDialog(),k=this.model.columns,p.find(".e-filtericon").remove(),f=0;f<k.length;f++)(k[f].allowFiltering||t.isNullOrUndefined(k[f].allowFiltering))&&(st=p.find(".e-headercelldiv[ej-mappingname="+k[f].field+"]").closest(".e-headercell"),st.append(t.buildTag("div.e-filtericon e-icon e-filterset")));this._refreshFilterIcon()}for(this.columnsWidthCollection.splice(u,0,this.columnsWidthCollection.splice(i,1)[0]),this._fieldColumnNames=this._headerColumnNames=[],e=0;e<s.length;e++)this._fieldColumnNames[s[e].headerText]=s[e].field,this._headerColumnNames[s[e].field]=s[e].headerText,a=n(c[e]),t.isNullOrUndefined(s[e].headerTemplateID)?s[e].type=="checkbox"?a.html("<input type = 'checkbox' class = 'e-checkselectall'><\/input>"):s[e].disableHtmlEncode?a.text(s[e].headerText):a.html(s[e].headerText):a.html(n(s[e].headerTemplateID).html()),this.model.groupSettings.showToggleButton&&(t.isNullOrUndefined(s[e].allowGrouping)||s[e].allowGrouping)&&(n.inArray(s[e].field,this.model.groupSettings.groupedColumns)!=-1?a.append(this._getToggleButton().addClass("e-toggleungroup")):a.append(this._getToggleButton().addClass("e-togglegroup")));if(this.model.allowGrouping&&this.model.allowSorting!=!0)for(f=0;f<this.model.sortSettings.sortedColumns.length;f++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[f].field,this.model.sortSettings.sortedColumns[f].direction);if(this.model.allowSorting)for(f=0;f<this.model.sortSettings.sortedColumns.length;f++){var g=1,v=this.model.sortSettings.sortedColumns[f],ct=this.getsortColumnByField(v.field),l=this.getColumnIndexByField(v.field),lt=n.inArray(ct,this.model.sortSettings.sortedColumns);if(imageDirection=v.direction!="descending"?"e-rarrowup-2x":"e-rarrowdown-2x",this.model.allowMultiSorting){for(o=1;o<=lt;o++)g=g+1;c.eq(l).css("text-align")=="right"?(this.model.sortSettings.sortedColumns.length>1&&c.eq(l).prepend(this._createSortNumber(g,c.eq(l)).addClass("e-sortnumber")),c.eq(l).append(this._createSortElement().addClass("e-"+(v.direction||"ascending")+" "+imageDirection))):(c.eq(l).append(this._createSortElement().addClass("e-"+(v.direction||"ascending")+" "+imageDirection)),this.model.sortSettings.sortedColumns.length>1&&c.eq(l).append(this._createSortNumber(g,c.eq(l)).addClass("e-sortnumber")))}else imageDirection=v.direction!="descending"?"e-rarrowup-2x":"e-rarrowdown-2x",c.eq(l).append(this._createSortElement().addClass("e-"+(v.direction||"ascending")+" "+imageDirection))}this.getHeaderTable().find(".e-fltrtempdiv").length>0&&(this.getHeaderTable().find(".e-filterbar").first().remove(),this._renderFiltering(),this._renderFilterBarTemplate());nt={};nt.requestType=t.Grid.Actions.Reorder;this._isReorder=!0;this.refreshTemplate();this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(nt),this._isAddNew=!1);this.setWidthToColumns();this.model.scrollSettings.frozenColumns||this.getHeaderContent().find("div").first().scrollLeft(ht);this.sendDataRenderingRequest(nt);this._isReorder=!1}},getPager:function(){return this._gridPager},getFooterTable:function(){return this._gridFooterTable},setGridFooterTable:function(n){this._gridFooterTable=n},getFooterContent:function(){return this._gridFooterContent},setGridFooterContent:function(n){this._gridFooterContent=n},getScrollObject:function(){return(this._scrollObject==null||t.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},setGridPager:function(n){this._gridPager=n},getRowHeight:function(){var r=-1,i,f,u,o;if(this.getContentTable()!=null)i=this.getContentTable().find("tr:not(.e-virtualrow)"),f=i.length>2?1:0,i.length&&(u=i[f].getBoundingClientRect()),i.length>1&&(r=u&&u.height?u.height:i[f].offsetHeight);else if(!t.isNullOrUndefined(this.model.rowTemplate)&&!t.isNullOrUndefined(this._dataSource())&&this._dataSource().length>0){var e=document.createElement("div"),s=n.templates(this.model.rowTemplate),h=this._dataSource()[0];e.innerHTML=['<table class="e-template-table">',s.render(h),"<\/table>"].join("");n("body").append(e.firstChild);o=n("body").find(".e-template-table").find("tr")[0];r=o.offsetHeight;n("body").find(".e-template-table").remove()}return r==-1?32:r},getCurrentIndex:function(){return(this._currentPage()-1)*this.model.pageSettings.pageSize},getColumnByIndex:function(n){return n<this.model.columns.length?this.model.columns[n]:null},set_currentPageIndex:function(n){var i=this.model.pageSettings,u=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r;return(i.totalPages==null&&(i.totalPages=Math.ceil(u/i.pageSize)),n>i.totalPages||n<1||n==this._currentPage())?!1:(t.isNullOrUndefined(this._prevPageNo)&&(this._prevPageNo=this._currentPage()),this._currentPage(n),this._currentPage()!=this._prevPageNo?(r={},r.requestType="paging",this.gotoPage(this._currentPage(),r),!0):!1)},set_currentVirtualIndex:function(n){var t,i;return n<1||n!=1&&n!=this._totalVirtualViews&&n==this._currentVirtualIndex&&this._checkCurrentVirtualView(this._virtualLoadedRows,n)?!1:(this._prevVirtualIndex=this._currentVirtualIndex,this._currentVirtualIndex=n,t=this._calculateCurrentViewPage(),t<=this.model.pageSettings.totalPages&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)?this._prevVirtualIndex<n&&n!=1?(i=this._isThumbScroll&&t!=1?t:t+1,!this._virtualPageRecords[i]&&i<=this.model.pageSettings.totalPages?this._setCurrentViewPage(i):this._renderVirtulViewContent(t)):this._prevVirtualIndex>n?(i=this._isThumbScroll?t:t-1,this._virtualPageRecords[i]&&!this._virtualLoadedRecords[n-1]&&(i=t-1),!this._virtualPageRecords[i]&&i>=1&&this._setCurrentViewPage(i)):this._renderVirtulViewContent(t):this._renderVirtulViewContent(t),!0)},_setCurrentViewPage:function(n){this._needPaging=!0;this._prevPageNo=this._currentPage();this.gotoPage(n)},_renderVirtulViewContent:function(){this._needPaging=!1;this._refreshVirtualView(this._currentVirtualIndex);this.element.ejWaitingPopup("hide")},_checkCurrentVirtualView:function(t,i){var f=this._virtualRowCount,u=i-1,r=i+1,e;if(t instanceof Array){if(t.length&&((u==0||r==this._totalVirtualViews+1)&&n.inArray(i,t)!=-1||n.inArray(u,t)!=-1&&n.inArray(i,t)!=-1&&n.inArray(r,t)!=-1))return!0}else if(e=r==this._totalVirtualViews?this._lastViewData:f,!this.initialRender&&i==1&&this._virtualLoadedRows[i]||i==this._totalVirtualViews&&t==this._virtualLoadedRows&&t[i]||u==0&&t[i]&&t[i].length==f||r==this._totalVirtualViews+1&&t[i]&&t[i].length==this._lastViewData||t[u]&&t[u].length==f&&t[i]&&t[i].length==f&&t[r]&&t[r].length==e)return!0;return!1},expandCollapse:function(i){var a,w,b,l,k,e,v,o,s,h,u;if(i.prop("tagName")=="DIV"&&(i.parent().hasClass("e-recordplusexpand")||i.parent().hasClass("e-recordpluscollapse")||i.parent().hasClass("e-detailrowcollapse")||i.parent().hasClass("e-detailrowexpand"))&&(i=i.parent()),a=-1,this.model.allowGrouping&&(t.isOnWebForms||this.initialRender))for(w=i.attr("ej-mappingname"),fieldValue=i.attr("ej-mappingvalue"),i.parents(".e-tabletd").length&&(b=i.parents(".e-tabletd").parent("tr").prev("tr").find(".e-recordplusexpand").attr("ej-mappingvalue")),l=this.model._groupingCollapsed,u=0;u<l.length;u++)if(l[u].key==w&&l[u].value==fieldValue&&(l[u].parent==r||l[u].parent==b)){a=u;break}if(i.hasClass("e-recordplusexpand")||i.hasClass("e-recordpluscollapse")||i.hasClass("e-detailrowcollapse")||i.hasClass("e-detailrowexpand")){if(i.hasClass("e-recordplusexpand")&&this.model.groupSettings.groupedColumns.length)k=i.index(),e=i.closest("tr").next(),e.hide(),i.removeClass("e-recordplusexpand").addClass("e-recordpluscollapse").find("div").removeClass("e-gdiagonalnext").addClass("e-gnextforward"),(t.isOnWebForms||this.initialRender)&&a==-1&&this.model._groupingCollapsed.push({key:w,value:fieldValue,parent:b});else if(i.hasClass("e-recordpluscollapse")&&this.model.groupSettings.groupedColumns.length){var k=i.index(),e=i.closest("tr").next(),o=[],s=e;for(n(s[0].cells[k]).hasClass("e-indentcell")&&s.children(".e-indentcell").length==i.parent().children(".e-indentcell").length+1&&(s.show(),h=s.children(".e-recordplusexpand"),h!=null&&h.length>0&&o.push(h)),i.removeClass("e-recordpluscollapse").addClass("e-recordplusexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"),u=0;u<o.length;u++)o[u].removeClass("e-recordplusexpand").addClass("e-recordpluscollapse").find("div").removeClass("e-gdiagonalnext").addClass("e-gnextforward"),this.expandCollapse(o[u]);(t.isOnWebForms||this.initialRender)&&a!=-1&&this.model._groupingCollapsed.splice(a,1)}else if(i.hasClass("e-detailrowexpand")){var k=i.index(),f=this,y=this.getIndexByRow(i.closest("tr")),e=i.closest("tr").next();e.hide(0,function(){var n={masterRow:i.closest("tr"),detailsRow:e,masterData:f._currentJsonData[y]},r=f._getForeignKeyData(n.masterData);t.isNullOrUndefined(r)||(n.foreignKeyData=r);f._trigger("detailsCollapse",n);f.model.childGrid!=null&&f.model.allowScrolling&&f._refreshScroller({requestType:"refresh"})});i.removeClass("e-detailrowexpand").addClass("e-detailrowcollapse").find("div").addClass("e-gnextforward").removeClass("e-gdiagonalnext")}else if(i.hasClass("e-detailrowcollapse")){var k=i.index(),f=this,y=this.getIndexByRow(i.closest("tr")),d=i.closest("tr").next();if(d.hasClass("e-detailrow"))e=d;else{var c=t.buildTag("tr.e-detailrow","",{display:"none"},{}),nt=t.buildTag("td.e-detailindentcell"),tt=this.model.groupSettings.showGroupedColumn?0:this.model.groupSettings.groupedColumns.length,g=t.buildTag("td.e-detailcell","",{},{colspan:this._visibleColumns.length-tt}),p=t.buildTag("div"),it=n(i.closest("tr")).parents(".e-grid").length;p.attr("id","child"+it+"_grid"+y+Math.round(Math.random()*1e3));n(c).append(nt);n(c).append(g);v=this._currentJsonData[y];this.model.detailsTemplate&&n(c).append(g.append(this._renderEjTemplate(this.model.detailsTemplate,v)));n(i.closest("tr")).after(c);this.model.childGrid&&(this.model.childGrid.parentDetails={parentID:this._id,parentPrimaryKeys:this.getPrimaryKeyFieldNames(),parentKeyField:this.model.childGrid.queryString,parentKeyFieldValue:v[this.model.childGrid.queryString],parentRowData:v},n(c).append(g.append(p)));e=c}for(this._showGridLines(),o=[],s=e,n(s[0].cells[k]).hasClass("e-detailindentcell")&&(s.show(0,function(){var n={masterRow:i.closest("tr"),detailsRow:e,masterData:f._currentJsonData[y]},r=f._getForeignKeyData(n.masterData);t.isNullOrUndefined(r)||(n.foreignKeyData=r);f._trigger("detailsExpand",n);f.model.childGrid!=null&&f.model.allowScrolling&&f._refreshScroller({requestType:"refresh"})}),d.hasClass("e-detailrow")||(this._trigger("detailsDataBound",{detailsElement:c,data:v}),this._trigger("refresh")),this.model.childGrid&&!t.isNullOrUndefined(p)&&p.ejGrid(this.model.childGrid),h=s.children(".e-detailrowexpand"),h!=null&&h.length>0&&o.push(h)),i.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").addClass("e-gdiagonalnext").removeClass("e-gnextforward"),u=0;u<o.length;u++)o[u].removeClass("e-detailrowexpand").addClass("e-detailrowcollapse").find("div").removeClass("e-gdiagonalnext").addClass("e-gnextforward"),this.expandCollapse(o[u])}!this.model.allowScrolling||t.isNullOrUndefined(this._scrollObject&&this._scrollObject.model)||i.closest(".e-hscroll").length||this.getScrollObject().refresh();this.model.isResponsive&&this.windowonresize()}},_refreshGridPager:function(){var i,n,r;this.getPager()!=null&&(i=this.getPager().ejPager("model"),n={},n.currentPage=this._currentPage(),this._filteredRecordsCount==0&&this.model.currentViewData.length==0&&(t.isNullOrUndefined(this._prevPageNo)||this._prevPageNo)?(n.currentPage=0,this._prevPageNo=i.currentPage,this.model.pageSettings.currentPage=0):i.currentPage==0&&(t.isNullOrUndefined(this._prevPageNo)||this._prevPageNo)&&(n.currentPage=this._prevPageNo),r=this.model.editSettings.showAddNewRow&&this.model.groupSettings.groupedColumns.length==0?1:0,n.totalRecordsCount=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount-r:this._searchCount:this._filteredRecordsCount,t.util.isNullOrUndefined(n.currentPage)&&(n.currentPage=this._currentPage()),this.getPager().ejPager("option",n).ejPager("refreshPager"),this.model.pageSettings.totalPages=i.totalPages||null,this.model.pageSettings.totalRecordsCount=i.totalRecordsCount||null)},_showHeaderColumn:function(i,r){for(var u,o,a,s,h=this.getHeaderTable().find("thead"),c=h.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),v=h.find(".e-filterbar").find(".e-filterbarcell"),e=this.getHeaderTable().find("colgroup").find("col"),l,f=0;f<i.length;f++)l=r?t.isNullOrUndefined(this.getColumnByField(i[f]))?this.getColumnByHeaderText(i[f],t.isNullOrUndefined(this.getColumnByField(i[f]))):this.getColumnByField(i[f]):this.getColumnByHeaderText(i[f]),u=n.inArray(l,this.model.columns),u=this.model.detailsTemplate!=null||this.model.childGrid?u+1:u,o=this.model.scrollSettings.frozenColumns,a=o!=0&&u>=o?c.eq(u).removeClass("e-hide").index()+o:c.eq(u).removeClass("e-hide").index(),v.eq(a).removeClass("e-hide"),e.length>this.model.columns.length&&this.model.groupSettings.groupedColumns.length&&(s=e.length-this.model.columns.length,e=e.slice(this.model.detailsTemplate||this.model.childGrid?s+1:s)),e.eq(u).css("display","");this.model.showStackedHeader&&this._refreshStackedHeader()},_hideHeaderColumn:function(i,r){for(var a,s=this.getHeaderTable().find("thead"),h=s.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),v=s.find(".e-filterbar").find(".e-filterbarcell"),f=this.getHeaderTable().find("colgroup").find("col"),c,u=0;u<i.length;u++){c=r?t.isNullOrUndefined(this.getColumnByField(i[u]))?this.getColumnByHeaderText(i[u],t.isNullOrUndefined(this.getColumnByField(i[u]))):this.getColumnByField(i[u]):this.getColumnByHeaderText(i[u]);var e=n.inArray(c,this.model.columns),l=this.model.detailsTemplate!=null||this.model.childGrid?e+1:e,o=this.model.scrollSettings.frozenColumns;a=o!=0&&e>=o?h.eq(l).addClass("e-hide").index()+o:h.eq(l).addClass("e-hide").index();v.eq(a).addClass("e-hide");f.length>this.model.columns.length&&(f=f.slice(f.length-this.model.columns.length));f.eq(e).css("display","none")}this.model.showStackedHeader&&(this._refreshStackedHeader(),this._colgroupRefresh())},_refreshStackedHeader:function(){var i,r,u,t;if(this.model.showStackedHeader){for(i=this.model.stackedHeaderRows,t=0;t<i.length;t++)if(this.model.scrollSettings.frozenColumns!=0){var f=n(this.getHeaderContent().find(".e-frozenheaderdiv")),e=n(this.getHeaderContent().find(".e-movableheader")),o=this._createStackedRow(i[t],!0),s=this._createStackedRow(i[t],!1);n(f.find("tr.e-stackedHeaderRow")[t]).replaceWith(o);n(e.find("tr.e-stackedHeaderRow")[t]).replaceWith(s)}else r=this._createStackedRow(i[t],!1),this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]?n(this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]).replaceWith(r):r.insertBefore(this.getHeaderTable().find("tr.e-columnheader:last"));if(u={},u.requestType="refresh",this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0)for(t=0;t<this.model.groupSettings.groupedColumns.length;t++)this.getHeaderTable().find(".e-stackedHeaderRow").prepend(this._getGroupTopLeftCell());this.model.allowScrolling&&this._refreshScroller(u)}},_getStackedColumnByTarget:function(n){var r=(n.get(0)||{}).className,i=/e-row([0-9])-column([0-9])/.exec(r),u=i[1],f=i[2],e=[u,"stackedHeaderColumns",f].join(".");return t.getObject(e,this.model.stackedHeaderRows)},_checkSkipAction:function(n){switch(n.requestType){case t.Grid.Actions.Save:case t.Grid.Actions.Delete:return!0}return!1},_unboundTemplateRendering:function(t){return n("#"+t).html()},_processBindings:function(i){var r,f,e;if(this._requestType=i.requestType,this.model.query=this.commonQuery.clone(),!this._checkSkipAction(i)&&this._trigger("actionBegin",i))return!0;if(this.model.editSettings.editMode=="batch"&&i.requestType!="batchsave"&&i.requestType!="cancel"&&!this._confirmedValue&&this._bulkChangesAcquired()&&this.model.editSettings.showConfirmDialog)return this._confirmDialog.find(".e-content").html(this.localizedLabels.BatchSaveLostChanges),this._confirmDialog.ejDialog("open"),this._requestArgs=i,!1;if(!t.isNullOrUndefined(this.model.dataSource)&&i.requestType=="refresh"&&this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this._scrollValue=0,this._loadedJsonData=[],this._prevPage=this._currentPage()),this._ensureDataSource(i),this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="virtualscroll"?(this._loadedJsonData.push({pageIndex:this._prevPage,data:this._currentJsonData}),this._prevPage=this._currentPage()):this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=t.isNullOrUndefined(this._currentPageData)?this.model.currentViewData:this._currentPageData,this._currentPageData=null),i.requestType=="filtering"&&(this._loadedJsonData=[],this._prevPage=this._currentPage(),n("#"+this._id+"_externalEdit").remove()),(i.requestType==t.Grid.Actions.Delete||i.requestType==t.Grid.Actions.Add)&&this._refreshVirtualViewDetails()),this.model.scrollSettings.allowVirtualScrolling&&i.requestType=="filtering"&&this.model.filterSettings.filteredColumns.length>0&&this.getScrollObject().scrollY(0),this.model.enableRTL?this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"):this.element.hasClass("e-rtl")&&this.element.removeClass("e-rtl"),i.requestType==t.Grid.Actions.Delete&&this.model.groupSettings.groupedColumns.length==0&&(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").remove(),i.tr.remove()),this._editForm=this.model.scrollSettings.frozenColumns>0||this.model.editSettings.showAddNewRow?this.element.find(".gridform"):n("#"+this._id+"EditForm"),!(this.model.editSettings.showAddNewRow&&i.requestType=="beginedit")&&this._editForm.length!=0)for(r=0;r<this._editForm.length;r++)n(this._editForm[r]).find("select.e-dropdownlist").ejDropDownList("destroy"),n(this._editForm[r]).find(".e-datepicker").ejDatePicker("destroy"),n(this._editForm[r]).find(".e-datetimepicker").ejDateTimePicker("destroy"),n(this._editForm[r]).find(".e-numerictextbox").ejNumericTextbox("destroy");if(!(this._dataSource()instanceof t.DataManager)||this._isRemoteSaveAdaptor||i.requestType==t.Grid.Actions.BeginEdit||i.requestType==t.Grid.Actions.Cancel||i.requestType==t.Grid.Actions.Add||this._dataSource().adaptor instanceof t.SqlDataSourceAdaptor&&(i.requestType==t.Grid.Actions.Save||i.requestType==t.Grid.Actions.Delete))this._isRelationalRendering(i)?this._setForeignKeyData(i):this.sendDataRenderingRequest(i);else{this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage&&this.virtualLoadedPages.indexOf((this._prevPageNo-1)*this.model.pageSettings.pageSize)==-1&&(f=t.pvt.filterQueries(this.model.query.queries,"onPage"),this.model.query.queries.splice(n.inArray(f[0],this.model.query.queries),1),this.model.query.page(this._currentPage()-1,this.model.pageSettings.pageSize),e=this._dataSource().executeQuery(this.model.query),this.model.query.queries.splice(n.inArray(f[0],this.model.query.queries),1),this.model.query.page(this._currentPage(),this.model.pageSettings.pageSize));this._virtualSelectedRows&&this._virtualSelectedRows.length>0&&this.model.query.addParams("virtualSelectRecords",this._virtualSelectedRows);var o=this._queryPromise=this._dataSource().executeQuery(this.model.query),s=this.element.ejWaitingPopup("instance"),u=this;this.element.ejWaitingPopup("show");u._dataSource().ready?u._dataSource().ready.done(function(){u._processDataRequest(u,i,o,e)}):u._processDataRequest(u,i,o,e)}},_processDataRequest:function(n,i,r,u){r.done(t.proxy(function(r){var e,f,o;if(!t.isNullOrUndefined(n.element)){if(n._relationalColumns.length==0&&n.element.ejWaitingPopup("hide"),u&&!n._previousPageRendered)n._processLastPageData(n,i,r.result,u),n.model.previousViewData&&n.model.previousViewData.length!=0&&(n.model.previousViewData.splice(0,r.result.length),n._previousPageLength=r.result.length,n._currentPageData=r.result,t.merge(n.model.previousViewData,r.result),n.model.currentViewData=n.model.previousViewData,n._remoteLastPageRendered=!0);else if(n._remoteLastPageRendered&&n.model.pageSettings.currentPage==n.model.pageSettings.totalPages-1&&!n.model.scrollSettings.enableVirtualization){for(e=n.model.pageSettings.pageSize-n._previousPageLength,f=0;f<e;f++)o=n.getRows()[n.getRows().length-(n.model.pageSettings.pageSize-f)],o.remove();n._tempPageRendered=!0;n.model.currentViewData=r.result}else n._identityKeys.length&&i.action=="add"&&this.adaptor instanceof t.ODataAdaptor&&n._processIdentityField(r.result,i),n.model.pageSettings.currentPage!=n.model.pageSettings.totalPages-1||n._remoteLastPageRendered||(n._previousPageRendered=!0),n.model.currentViewData=r.result==null?[]:r.result,n._$fkColumn&&n.model.filterSettings.filterType=="excel"&&n.model.filterSettings.filteredColumns.length>0&&(n._fkParentTblData=r.result);n.model.allowScrolling&&n.model.scrollSettings.allowVirtualScrolling&&n.model.scrollSettings.enableVirtualization&&(i.requestType=="filtering"&&(n._gridRecordsCount=n._filteredRecordsCount=r.count,n._refreshVirtualViewDetails()),r.result.length?(n._isInitNextPage||n._isLastVirtualpage?(n._setInitialCurrentIndexRecords(r.result,n._currentPage()),n._isInitNextPage=n._isLastVirtualpage=!1):(n._gridRecordsCount=r.count,n._refreshVirtualViewDetails(),n._setVirtualLoadedRecords(r.result,n._currentPage())),n._isThumbScroll&&!n._checkCurrentVirtualView(n._virtualLoadedRecords,n._currentVirtualIndex)&&n._checkPrevNextViews(),n._remoteRefresh=!0):n.getContent().find(".e-virtualtop, .e-virtualbottom").remove());t.isNullOrUndefined(r.aggregates)||(n._remoteSummaryData=r.aggregates);n._processData(r,i);t.isNullOrUndefined(n._unboundRow)||i.selectedRow==n._unboundRow||i.requestType!="save"||(n._unboundRow.find(".e-editbutton").trigger("click"),n._unboundRow=null)}}));r.fail(t.proxy(function(r){t.isNullOrUndefined(n.element)||(n.element.ejWaitingPopup("hide"),i.error=r.error,r=[],n.model.currentViewData=[],n._processData(r,i),t.isNullOrUndefined(n.getPager())||n.getPager().ejPager({currentPage:0,totalRecordsCount:0}),n._trigger("actionFailure",i))}))},_processIdentityField:function(i,r){var u=this._primaryKeys[0],e=t.distinct(i,u),o=t.distinct(this.model.currentViewData,u),s=n.grep(e,function(t){return n.inArray(t,o)==-1?!0:!1}),f=t.DataManager(i).executeLocal((new t.Query).where(u,"equal",s))[0];r.data=t.isNullOrUndefined(f)?r.data:f},_processLastPageData:function(n,i,r,u){u.done(t.proxy(function(t){n.model.previousViewData=t.result}));u.fail(t.proxy(function(t){n.element.ejWaitingPopup("hide");i.error=t.error;t=[];n.model.previousViewData=[];n._processData(t,i);n._trigger("actionFailure",i)}))},_createUnboundElement:function(i,r){var o=document.createElement("div"),s,f,u,e;for(i.headerText=t.isNullOrUndefined(i.headerText)?i.field:i.headerText,t.isNullOrUndefined(i.headerText)||(o.id=this._id+i.headerText.replace(/[^a-z0-9|s_]/gi,"")+r+"_UnboundTemplate"),s=t.buildTag("div.e-unboundcelldiv"),f=i.commands,u=0;u<f.length;u++)e=t.buildTag("button.e-flat e-"+f[u].type.replace(/\s+/g,"")+"button","",{},{type:"button"}),e.val(f[u].type),(f[u].type=="save"||f[u].type=="edit")&&e.addClass("e-btnsub"),(f[u].type=="cancel"||f[u].type=="delete")&&e.addClass("e-btncan"),s.append(e);return n("body").append(n(o).html(s).hide()),o},_refreshUnboundTemplate:function(i){var h,e,s,u,r,f,o;if(this._isUnboundColumn)for(h=0,e=0;e<this.model.columns.length;e++)if(this.model.columns[e].commands)for(s=i.find(".e-unboundcell.e-"+this.model.columns[e].headerText.replace(/[^a-z0-9|s_]/gi,"")+e).find(".e-unboundcelldiv"),u=n.extend(!0,[],this.model.columns[e].commands),r=0;r<u.length;r++){for(t.isNullOrUndefined(u[r].buttonOptions)&&(u[r].buttonOptions={}),u[r].buttonOptions.width=t.isNullOrUndefined(u[r].buttonOptions.width)?"52":u[r].buttonOptions.width,u[r].buttonOptions.height=t.isNullOrUndefined(u[r].buttonOptions.height)?"28":u[r].buttonOptions.height,u[r].buttonOptions.cssClass=t.isNullOrUndefined(u[r].buttonOptions.cssClass)?this.model.cssClass:u[r].buttonOptions.cssClass,u[r].buttonOptions.enableRTL=this.model.enableRTL,f=s.find(".e-"+u[r].type.replace(/\s+/g,"")+"button"),this.model.isEdit&&this._requestType!="cancel"||(i.closest(".e-editcell").length?u[r].type=="save"||u[r].type=="cancel"?f.show():(f.hasClass("e-deletebutton")&&f.hide(),f.hasClass("e-editbutton")&&f.hide()):u[r].type=="save"||u[r].type=="cancel"?f.hide():(f.hasClass("e-deletebutton")&&f.show(),f.hasClass("e-editbutton")&&f.show())),o=0;o<f.length;o++)n(f[o]).data("ejButton")&&n(f[o]).ejButton("destroy");f.ejButton(u[r].buttonOptions)}else continue},_gridTemplate:function(n,t,i){var r=n.model.columns[i];return n.model.scrollSettings.enableVirtualization&&(this.index+=n._currentVirtualRowIndex),n._isGrouping&&(this.index=n._currentJsonData.indexOf(this.data)),n._renderEjTemplate("#"+t,this.data,this.index,r)},_createTemplateElement:function(i,r,u){var e=i["templateID"in i?"templateID":"template"],s=/^#([\w-]*)/.exec(e),r=r||n("body"),f,h=u?"Pager":i.headerText+n.inArray(i,this.model.columns)+"_Template",o={name:"SCRIPT",type:"text/x-template",text:e,id:(this._id+h).replace(/(\\|[^0-9A-z-_])/g,"")};return f=s&&s[1]?document.getElementById(s[1]):/^<script/i.test(e)?n(e).get(0):t.buildTag(o.name,o.text).get(0),f.id=f.id||o.id,f.type=f.type||o.type,r.append(u?f.innerHTML:f),f},_renderGridPager:function(){var i=n(document.createElement("div")),t={};return this.model.pageSettings.click=this._gPagerClickHandler,this.model.pageSettings.totalRecordsCount=this._gridRecordsCount||null,this.model.pageSettings.enableRTL=this.model.enableRTL,this.model.pageSettings.locale=this.model.locale,this.model.pageSettings.enableQueryString=this.model.pageSettings.enableQueryString,this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&(t.enableExternalMessage=this.model.filterSettings.showFilterBarStatus),n.extend(t,this.model.pageSettings),t.currentPage=this._currentPage(),t.masterObject=this,this.setGridPager(i),i.ejPager(t),i.ejPager("refreshPager"),t=i.ejPager("model"),this.model.pageSettings.totalPages=t.totalPages||null,this._currentPage()!==t.currentPage&&this._currentPage(t.currentPage),this._renderPagerTemplate(i),i},_renderPagerTemplate:function(n,i){var r=this.model.pageSettings,f=n.find(".e-pagercontainer").not(".e-template").length==0,u;n.find(".e-pagercontainer.e-template").remove();(i||!r.enableTemplates)&&f&&n.ejPager("renderPager");r.enableTemplates&&(r.showDefaults||n.children().remove(),u=t.buildTag("div",null,null,{"class":"e-pagercontainer e-template"}),this._createTemplateElement(this.model.pageSettings,u,!0),n.append(u))},_renderContext:function(){var y=this.model.contextMenuSettings.contextMenuItems,p,w,e=0,r=t.buildTag("ul","",{},{id:this._id+"_Context"}),i,l,s,a,k,v,h;if(!this.model.contextMenuSettings.disableDefaultItems)for(e;e<y.length;e++)p=y[e],w=this._items(p,"contextMenuItem"),r.append(w);var b=this.model.contextMenuSettings.customContextMenuItems,f=this.model.contextMenuSettings.subContextMenu,u,c,o=0;for(o;o<b.length;o++){for(u=b[o],c=this._items(u,"customContextMenuItem"),i=0;i<f.length;i++)if(typeof u=="string"&&u==f[i].contextMenuItem||typeof u=="object"&&u.id==f[i].contextMenuItem){for(l=t.buildTag("ul","",{},{id:this._id+"_subMenuContext"+i}),s=0;s<f[i].subMenu.length;s++)menuItem=f[i].subMenu[s],menuItem1=this._items(menuItem,"subMenuItems"),l.append(menuItem1);c.append(l)}r.append(c)}r.find("li").length>0&&(this.element.append(r),a=this.element.parents("div.e-grid"),k=t.Menu.prototype._showContextMenu,t.Menu.prototype._showContextMenu=function(t,i,r,u){n(this.model.contextMenuTarget).hasClass("e-grid")&&(++t,++i);k.apply(this,[t,i,r,u])},n(r).ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+this._id,click:n.proxy(this._clickevent,this),width:"auto",beforeOpen:n.proxy(this._menu,this)}),a.length&&(v=n("#"+a[0].id+"_Context"),h=v.ejMenu("model.excludeTarget"),v.ejMenu({excludeTarget:!t.isNullOrUndefined(h)&&h.length!=0?h.concat(",#"+this._id):"#"+this._id})),this._conmenu=r.data("ejMenu"))},_clickevent:function(i){var o=i.events.text,e=n(this._contexttarget.parentNode),r=n(this._contexttarget),u,f;if(r.hasClass("e-filterset")?r=r.siblings():(r.hasClass("e-icon")||r.hasClass("e-number"))&&(r=r.parent()),u=r.attr("ej-mappingname")||r.find(".e-headercelldiv").attr("ej-mappingname"),!this._trigger("contextClick",i))switch(o){case this.localizedLabels.AddRecord:this._startAdd();break;case this.localizedLabels.EditRecord:if(this.model.editSettings.editMode=="batch"){var s=n(this._contexttarget.parentNode).find(".e-rowcell").index(r),h=this._excludeDetailRows().index(e),c=this.model.columns[s].field;this.editCell(h,c)}else this.startEdit(e);break;case this.localizedLabels.DeleteRecord:this.model.editSettings.showDeleteConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open"):this.multiDeleteMode&&this.selectedRowsIndexes.length>1?this._multiRowDelete():this.deleteRow(e);break;case this.localizedLabels.Save:this.endEdit();break;case this.localizedLabels.Cancel:this.cancelEdit();break;case this.localizedLabels.SortInDescendingOrder:f=t.sortOrder.Descending;this.sortColumn(u,f);break;case this.localizedLabels.SortInAscendingOrder:f=t.sortOrder.Ascending;this.sortColumn(u,f);break;case this.localizedLabels.Grouping:this.groupColumn(u);break;case this.localizedLabels.Ungrouping:this.ungroupColumn(u);break;case this.localizedLabels.NextPage:case this.localizedLabels.PreviousPage:case this.localizedLabels.LastPage:case this.localizedLabels.FirstPage:this._page(i)}},_menu:function(i){var r=this._conmenu.element,u,d,p,o,g,tt,s,e,k,c,l,v,y,a,f;if(this._contexttarget=i.target,u=n(i.target),o=n(this._contexttarget),this.model.allowSelection&&(o.hasClass("e-rowcell")||o.closest(".e-rowcell").length)&&!u.hasClass("e-selectionbackground")&&(g=o.hasClass("e-rowcell")?o.parent():o.closest(".e-rowcell").parent(),this.model.isEdit||this.selectRows(this.getIndexByRow(g),null,o)),(u.hasClass("e-ascending")||u.hasClass("e-descending"))&&!u.parent().hasClass("e-headercelldiv"))return!1;d=u.hasClass("e-filtericon")||u.hasClass("e-headercelldiv")?i.target.parentNode.getAttribute("aria-sort"):u.hasClass("e-headercell")?i.target.getAttribute("aria-sort"):u.parent().parent().attr("aria-sort");tt=i.target.className;s=n(r);p=u.hasClass("e-filterset")?u.siblings().attr("ej-mappingname"):u.hasClass("e-icon")||u.hasClass("e-number")?u.parent().attr("ej-mappingname"):u.hasClass("e-headercell")?u.find(".e-headercelldiv").attr("ej-mappingname"):u.attr("ej-mappingname");r.css("visibility","visible");var nt=u.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0,w=u.closest(".e-rowcell"),b=u.closest(".e-headercell"),it=w.index()!=-1?w.index():b.index()-this.model.groupSettings.groupedColumns.length,h=u.hasClass("e-rowcell")?u.index()-nt:it-nt;h=this.model.detailsTemplate!=null||this.model.childGrid!=null?h-1:h;e=this.model.columns[h];k={allowGrouping:".e-contextgrouping",allowSorting:".e-contextascending, .e-contextdescending","editSettings.allowAdding":".e-contextadd","editSettings.allowEditing":".e-contextedit","editSettings.allowDeleting":".e-contextdelete"};for(c in k)l=r.find(k[c]).parent(),t.getObject(c,this.model)==!1||t.getObject(c,e)===!1?l.css("display","none"):l.css("display")=="none"&&l.css("display","block");if(u.closest(".e-grid").attr("id")!==this._id||u.is("input")){r.css("visibility","hidden");return}if(this.getHeaderTable().find(u).length>0){if(!(b.length!=0&&b.children().hasClass("e-headercelldiv"))){r.css("visibility","hidden");return}f=n(r.find(".e-head"));r.find(".e-page").css("display","none");r.find(".e-content").css("display","none");r.find(".e-savcan").css("display","none");f.css("display","block");(t.isNullOrUndefined(e.field)||e.field=="")&&(f.css("display","none"),r.find(".e-customitem").length==0&&r.css("visibility","hidden"));a={columnIndex:h,headerText:e.headerText};n.extend(i,a)}else if(this.getContentTable().find(u).length>0){if(v=this.getIndexByRow(n(i.target.parentElement)),y=this.model.editSettings.editMode=="batch"?this.getDataByIndex(v):this.getSelectedRecords(),w.length==0){r.css("visibility","hidden");return}f=n(r.find(".e-content"));r.find(".e-head").css("display","none");r.find(".e-page").css("display","none");r.find(".e-savcan").css("display","none");f.css("display","block");(t.isNullOrUndefined(e.field)||e.field=="")&&this.model.editSettings.editMode=="batch"&&(f.css("display","none"),r.find(".e-customitem").length==0&&r.css("visibility","hidden"));a=this.model.editSettings.editMode=="batch"?{columnIndex:h,rowIndex:v,rowData:y,headerText:e.headerText,cellValue:t.getObject(t.isNullOrUndefined(e.field)?"":e.field,y)}:{columnIndex:h,rowIndex:v,rowData:y,headerText:e.headerText};n.extend(i,a)}else if(this.getPager().find(u).length>0||u.hasClass("e-pager"))f=n(r.find(".e-page")),r.find(".e-head").css("display","none"),r.find(".e-content").css("display","none"),r.find(".e-savcan").css("display","none"),f.css("display","block");else return f=n(r),r.css("visibility","hidden"),!1;switch(d){case"ascending":s.find(".ascending").parent().css("display","none");break;case"descending":s.find(".descending").parent().css("display","none")}u.hasClass("e-rowcell")&&this.model.editSettings.showAddNewRow&&(f=n(r.find(".e-savcan")),r.find(".e-contextadd").parent().css("display","none"),f.css("display","block"));this.model.isEdit&&u.hasClass("e-rowcell")&&(!this.model.editSettings.showAddNewRow||n(".e-editedrow").length>0)&&(f=n(r.find(".e-savcan")),r.find(".e-head").css("display","none"),r.find(".e-content").css("display","none"),r.find(".e-page").css("display","none"),f.css("display","block"));this.model.pageSettings.totalPages==1&&f.hasClass("e-page")?r.find(".e-customitem").length==0?r.css("visibility","hidden"):r.find(".e-page").css("display","none"):this.model.pageSettings.currentPage==1?(s.find(".previous").parent().css("display","none"),s.find(".first").parent().css("display","none")):this.model.pageSettings.currentPage==this.model.pageSettings.totalPages&&(s.find(".last").parent().css("display","none"),s.find(".nextpage").parent().css("display","none"));this.model.groupSettings.groupedColumns.indexOf(p)!=-1?f.find(".group").parent().css("display","none"):this.model.groupSettings.groupedColumns.indexOf(p)==-1&&f.find(".ungroup").parent().css("display","none");this.model.contextOpen&&this._trigger("contextOpen",i)},_items:function(i,r){var f,u,e,o;return i==""?!1:(r=="contextMenuItem"&&(i.indexOf("Record")!=-1?(u=t.buildTag("li","",{},{"class":"e-content"}),u.css("display","none")):i.indexOf("Page")!=-1?(u=t.buildTag("li","",{},{"class":"e-page"}),i.indexOf("Next")!=-1?f=t.buildTag("div","",{},{"class":"nextpage"}):i.indexOf("Previous")!=-1?f=t.buildTag("div","",{},{"class":"previous"}):i.indexOf("Last")!=-1?f=t.buildTag("div","",{},{"class":"last"}):i.indexOf("First")!=-1&&(f=t.buildTag("div","",{},{"class":"first"})),u.css("display","none")):i=="Save"||i=="Cancel"?(u=t.buildTag("li","",{},{"class":"e-savcan"}),u.css("display","none")):(i.indexOf("Order")!=-1||i=="Grouping"||i=="Ungrouping")&&(u=t.buildTag("li","",{},{"class":"e-head"}),i.indexOf("Ascending")!=-1?f=t.buildTag("div","",{},{"class":"ascending"}):i.indexOf("Descending")!=-1?f=t.buildTag("div","",{},{"class":"descending"}):i=="Grouping"?f=t.buildTag("div","",{},{"class":"group"}):i=="Ungrouping"&&(f=t.buildTag("div","",{},{"class":"ungroup"})),u.css("display","none"))),t.isNullOrUndefined(u)&&(u=t.buildTag("li","",{},{"class":"e-customitem"}),u.css("display","block")),u.append(f),e=document.createElement("a"),o="",typeof i=="string"&&(o=i.indexOf("Ascending")!=-1?"ascending":i.indexOf("Descending")!=-1?"descending":i.split(" ")[0].toLowerCase(),e.innerHTML=t.isNullOrUndefined(this.localizedLabels[i.replace(/\s+/g,"")])?i:this.localizedLabels[i.replace(/\s+/g,"")]),typeof i=="object"&&(o=i.id=="Ascending"?"ascending":i.id=="Descending"?"descending":i.id.split(" ")[0].toLowerCase(),e.innerHTML=t.isNullOrUndefined(this.localizedLabels[i.text.replace(/\s+/g,"")])?i.text:this.localizedLabels[i.text.replace(/\s+/g,"")],u.attr("id",i.id)),n(e).append(t.buildTag("span","",{},{"class":"e-gridcontext e-icon e-context"+o})),u.append(e),u)},_page:function(n){var t;n.events.text==this.localizedLabels.NextPage?(t=this.model.pageSettings.currentPage,++t,this.gotoPage(t)):n.events.text==this.localizedLabels.PreviousPage?(t=this.model.pageSettings.currentPage,t>1?(--t,this.gotoPage(t)):this.gotoPage(t)):n.events.text==this.localizedLabels.LastPage?(t=this.model.pageSettings.totalPages,this.gotoPage(t)):this.gotoPage(1)},gotoPage:function(n){var i,r,u;(this.model.allowPaging||this.model.allowScrolling||this.model.scrollSettings.allowVirtualScrolling)&&(i={},i.previousPage=this._currentPage(),this._currentPage(n),i.endIndex=this._currentPage()*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:this._currentPage()*this.model.pageSettings.pageSize,i.startIndex=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=n,this.model.allowPaging&&(i.requestType=t.Grid.Actions.Paging),this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this._isVirtualRecordsLoaded=!1,u=this._refreshVirtualPagerInfo(),this._showPagerInformation(u),i.requestType=t.Grid.Actions.VirtualScroll),r=this._processBindings(i),r&&this._currentPage(i.previousPage),this._primaryKeyValues=[])},_gPagerClickHandler:function(n){if(this._prevPageNo!=n.currentPage)return this.model.masterObject.gotoPage(n.currentPage),!1},_processData:function(i,r){var u,f;if(this.initialRender)this._initDataProcessed=!0,this._initDataProcess(i,r);else{if(this._gridRecordsCount=i.count==0&&this.model.currentViewData.length?i.result.length:i.count,this.getPager()!=null&&(this.model.pageSettings.totalRecordsCount=this._gridRecordsCount),(r.requestType==t.Grid.Actions.Filtering||t.Grid.Actions.Save||this.model.filterSettings.filteredColumns.length>0&&r.requestType==t.Grid.Actions.Refresh)&&(this._filteredRecordsCount=i.count),this.model.allowScrolling&&this.model.scrollSettings.enableVirtualization)for(this.model.currentViewData=[],u=0;u<this._currentLoadedIndexes.length;u++)f=this._currentLoadedIndexes[u],n.merge(this.model.currentViewData,this._virtualLoadedRecords[f]||[]);this._setForeignKeyData(r);this._relationalColumns.length==0&&this.sendDataRenderingRequest(r)}},_frozenCell:function(t,i){var r=i,u=0,f=this.getRowByIndex(t);return i>=this.model.scrollSettings.frozenColumns&&(u=1,r=r-this.model.scrollSettings.frozenColumns),n(f.eq(u).find(".e-rowcell:eq("+r+")"))},_frozenColumnSelection:function(t,i,r){var e=i,f=0,o,u;if(r)for(u=i;u<r;u++){for(e=u,u>=this.model.scrollSettings.frozenColumns&&(f=1,e=u-this.model.scrollSettings.frozenColumns),o=0;o<t[f].length;o++)n(t[f][o].cells[e]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell")[u]).addClass("e-columnselection");this.selectedColumnIndexes.push(u)}else for(i>=this.model.scrollSettings.frozenColumns&&(f=1,e=i-this.model.scrollSettings.frozenColumns),u=0;u<t[f].length;u++)n(t[f][u].cells[e]).addClass("e-columnselection")},_renderGridFooter:function(){var i,n;if(this.model.summaryRows.length>0){if(i=t.buildTag("div.e-gridfooter"),n=t.buildTag("table.e-gridsummary","",{},{cellspacing:"0.25px"}),this.setGridFooterContent(i),this.model.scrollSettings.frozenColumns>0){var u=t.buildTag("div.e-frozenfooterdiv"),f=t.buildTag("div.e-movablefooter"),r=n.clone(),e=t.buildTag("div.e-movablefooterdiv");f.append(e);n.append(this.getHeaderTable().first().find("colgroup").clone());r.append(this.getHeaderTable().last().find("colgroup").clone());u.append(n);e.append(r);this.setGridFooterTable(n.add(r));this._createSummaryRows(this.getFooterTable());i.append(u.add(f));i.find(".e-frozenfooterdiv").outerWidth(this.getHeaderContent().find(".e-frozenheaderdiv").width()).end().find(".e-movablefooterdiv").outerWidth(this.getContent().find(".e-movablecontentdiv").width())}else n.append(this.getHeaderTable().find("colgroup").clone()),this.setGridFooterTable(n),this._createSummaryRows(this.getFooterTable()),i.append(n);return i}throw"summary row collection is missing";},_setSummaryAggregate:function(n){for(var t,f,u=this.model.summaryRows,i,r=0,e=u.length;r<e;r++)for(i=u[r].summaryColumns,t=0,f=i.length;t<f;t++)n.aggregate(i[t].summaryType,i[t].dataMember)},_createSummaryRows:function(i,r,u,f,e){var l=i.find("col");i.find("tbody").length>0&&i.find("tbody").remove();var s=t.buildTag("tbody"),o=this,h=s.clone(),c=this.model.summaryRows;!t.isNullOrUndefined(r)&&this._isCaptionSummary&&(c=this._captionSummary(e));n.each(c,function(c,a){var y,k,w,d,tt,p;if(a.showTotalSummary===!1&&t.isNullOrUndefined(r)||a.showGroupSummary===!1&&e&&!t.isNullOrUndefined(r))return!0;if(y=t.buildTag("tr.e-gridSummaryRows"),t.isNullOrUndefined(f&&f.level))for(p=0;p<o.model.groupSettings.groupedColumns.length;p++)y.prepend(t.buildTag("td").addClass("e-indentcell"));k=e?" e-gcsummary":"";(o.model.detailsTemplate!=null||o.model.childGrid!=null)&&(o.model.groupSettings.groupedColumns.length!=0?y.children("td.e-indentcell").last().after("<td class='e-summaryrow"+k+"'><\/td>"):y.prepend("<td class='e-summaryrow'><\/td>"));var v=o.getHeaderTable().find("td").clone().addClass("e-summaryrow"+k+""),w=0;if(t.isNullOrUndefined(a.titleColumn)||(w=o.getColumnIndexByField(a.titleColumn),w==-1&&(w=o.getColumnIndexByHeaderText(a.titleColumn))),w!=-1&&(v=o._assignTitleColumn(w,a.title,v,0)),o._hideSummaryColumn(v,l),o.model.scrollSettings.frozenColumns>0)d=y.clone(),s.append(y.append(v.slice(0,o.model.scrollSettings.frozenColumns))),h.append(d.append(v.slice(o.model.scrollSettings.frozenColumns)));else if(o._isCaptionSummary&&!e||t.isNullOrUndefined(f&&f.level))s.append(y.append(v));else{var g=o.model.groupSettings.groupedColumns.length-f.level+1,b=i.clone().addClass("e-groupsummary"),nt={};for(nt.data={items:f},y.prepend("<td class='e-summaryrow"+k+"' colspan="+o._colSpanAdjust(null,null,nt)+" style = 'padding:0;' ><\/td>"),n(y[0].cells).filter(".e-summaryrow").html(b.append(t.buildTag("tr",v))),tt=b.find("col").length-(o.model.columns.length+g),(o.model.detailsTemplate!=null||o.model.childGrid!=null)&&y.find("tr").prepend("<td class='e-summaryrow'><\/td>"),p=0;p<tt;p++)b.find("col").first().remove();for(p=0;p<g;p++)n(b[0].rows).prepend("<td class='e-indentcell'><\/td>"),n(b.find("col")[p]).addClass("e-summary");s.append(y)}n.each(a.summaryColumns,function(i,f){var s,e,h,c;s=f.summaryType!="custom"?u?u[f.dataMember+" - "+f.summaryType]:o._remoteSummaryData[f.dataMember+" - "+f.summaryType]:o.getSummaryValues(f,r);prefix=f.prefix?f.prefix:"";e=o.getColumnIndexByField(f.displayColumn);h=f.suffix?f.suffix:"";o.model.allowScrolling&&n(v[e]).addClass("e-scroller");n(v[e]).html()!=""&&prefix==""&&(prefix=n(v[e]).html());t.isNullOrUndefined(f.template)?e!=-1&&n(v[e]).html(prefix+(f.format?o.formatting(f.format,s,o.model.locale):s)+h).css("text-align",o.model.columns[e].textAlign):(c={summaryValue:f.format?o.formatting(f.format,s,o.model.locale):s,summaryColumn:f},n(v[e]).html(n.render[o._id+"_summaryTemplate"+f.template](c)).css("text-align",o.model.columns[e].textAlign),n(v[e]).addClass("e-summarytemplate"))})});this.model.scrollSettings.frozenColumns>0?(i.first().append(s),i.last().append(h)):i.append(s)},_assignTitleColumn:function(n,t,i,r){for(var f,u=n;u<this.model.columns.length;u++)if(f=this.model.columns[u],r==0&&f.visible!=!1){i.eq(u).html(t);break}return i},getSummaryValues:function(i,r){var f,u,o,s,h,e;u=t.isNullOrUndefined(r)?this.model.filterSettings.filteredColumns.length>0?this._filteredRecords:this._dataSource():r;u instanceof t.DataManager?(o=u,u=u.dataSource.json):o=t.DataManager(u);switch(i.summaryType){case t.Grid.SummaryType.Maximum:s=t.max(u,i.dataMember);f=t.getObject(i.dataMember,s);break;case t.Grid.SummaryType.Minimum:s=t.min(u,i.dataMember);f=t.getObject(i.dataMember,s);break;case t.Grid.SummaryType.Average:f=t.avg(u,i.dataMember);break;case t.Grid.SummaryType.Sum:f=t.sum(u,i.dataMember);break;case t.Grid.SummaryType.Count:f=u.length;break;case t.Grid.SummaryType.TrueCount:h=t.Predicate(i.dataMember,"equal",!0);f=o.executeLocal(t.Query().where(h)).length;break;case t.Grid.SummaryType.FalseCount:h=t.Predicate(i.dataMember,"equal",!1);f=o.executeLocal(t.Query().where(h)).length;break;case t.Grid.SummaryType.Custom:e=i.customSummaryValue;e&&(typeof e=="string"&&(e=t.util.getObject(e,window)),n.isFunction(e)&&(f=e.call(this,i,u)))}return f},_hideCaptionSummaryColumn:function(){var f=this.getHeaderTable().find(".e-headercelldiv[ej-mappingname]").first(),e=this.getContentTable().find(".e-groupcaption").clone(),t=this.getContentTable().find(".e-groupcaption").parent(),o=this.model.columns.length-1,r,n,u;if(this._isCaptionSummary&&(this.getContentTable().find(".e-summaryrow:not(.e-gcsummary)").remove(),this.getFooterTable().find("tbody td").slice(-o).removeClass("e-groupcaptionsummary").addClass("e-summaryrow"),this.getFooterTable()!=null&&this.getContentTable().find(".e-recordplusexpand").parent().children(".e-indentcell").remove(),!this.model.groupSettings.showGroupedColumn&&this.getContentTable().find(".e-groupcaptionsummary").not(".e-hide").length&&(r=+this.getContentTable().find(".e-recordtable:first").parents("tbody:first").find(".e-groupcaption").attr("colspan"),this._hiddenColumnsField.length==this.model.columns.length-1&&f.parent().hasClass("e-hide")||!r)))for(i=0;i<e.length;i++)t.eq(i).children().not(".e-hide,.e-recordplusexpand").filter("td.e-groupcaptionsummary:first").addClass("e-hide"),n=t.eq(i).find(".e-groupcaption"),u=parseInt(n.attr("colspan")),n.attr("colspan",++u);this.getContentTable().find(".e-recordtable").find(".e-indentcell").remove()},_hideSummaryColumn:function(t,r){if(r.length>this.model.columns.length&&(r=r.slice(r.length-this.model.columns.length)),!this.model.groupSettings.showGroupedColumn&&this.model.showSummary)for(i=0;i<this.model.columns.length;i++)for(j=0;j<this.model.groupSettings.groupedColumns.length||j<this._hiddenColumnsField.length;j++){var u=this.getHeaderTable().find(".e-headercelldiv:not(.e-emptyCell)");if(u.eq(i).is(":visible"))r.eq(i).css("display")=="none"&&r.eq(i).css("display","");else{r.eq(i).css("display","none");n(t[i]).addClass("e-hide");break}}else for(i=0;i<this.model.columns.length;i++)this.model.columns[i].visible?r.eq(i).css("display")=="none"&&r.eq(i).css("display",""):(r.eq(i).css("display","none"),n(t[i]).addClass("e-hide"))},_initScrolling:function(){var r=[],f=[],e=0,i,u;for(this.model.scrollSettings.enableVirtualization&&(this.model.scrollSettings.allowVirtualScrolling=!0),i=0;i<this.model.columns.length;i++)this.model.columns[i].visible===!1&&i<this.model.scrollSettings.frozenColumns&&e++,this.model.columns[i].isFrozen===!0?r.push(this.model.columns[i]):f.push(this.model.columns[i]);if(r.length>0&&(u=this.model.scrollSettings.frozenColumns,this.model.columns=n.merge(n.merge([],r),f),this.model.scrollSettings.frozenColumns=r.length,r.length!=u&&u!=0&&(this.model.scrollSettings.frozenColumns=u)),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&(this.model.allowGrouping||this.model.rowTemplate!=null||this.model.detailsTemplate!=null||this.model.childGrid!=null||this.model.scrollSettings.allowVirtualScrolling||this.model.editSettings.editMode=="batch")){this._renderAlertDialog();this._alertDialog.find(".e-content").text(this._getLocalizedLabels().FrozenNotSupportedException);this._alertDialog.ejDialog("open");return}this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this.model.scrollSettings.enableVirtualization?(this._vRowHeight=Math.floor(this.getRowHeight()+1),this._virtualRowCount=Math.round(this.model.scrollSettings.height/this._vRowHeight)+1,this.model.pageSettings.pageSize<this._virtualRowCount*5&&(this.model.pageSettings.pageSize=this._virtualRowCount*5)):(this.model.pageSettings.pageSize=this.model.pageSettings.pageSize==12?Math.round(this.model.scrollSettings.height/32)+1:this.model.pageSettings.pageSize,this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize)));(this.model.width||this.model.height)&&(this.model.allowScrolling=!0,this.model.width&&(this.model.scrollSettings.width=this.model.width),this.model.height&&(this.model.scrollSettings.height=this.model.height));this._originalScrollWidth=t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)?this.model.scrollSettings.width:this.model.scrollSettings.previousStateWidth},_checkScrollActions:function(n){return!this.model.scrollSettings.allowVirtualScrolling&&(n==t.Grid.Actions.Sorting||n==t.Grid.Actions.Reorder)||n==t.Grid.Actions.Grouping||n==t.Grid.Actions.Ungrouping||n==t.Grid.Actions.Add||n==t.Grid.Actions.Cancel||n==t.Grid.Actions.Save||n==t.Grid.Actions.BatchSave||n==t.Grid.Actions.Delete||n==t.Grid.Actions.Filtering||n==t.Grid.Actions.Paging||n==t.Grid.Actions.Refresh||n==t.Grid.Actions.Search?!0:!1},_frozenAlign:function(){var r=this.getContent().first(),n=!t.isIOSWebView()&&this.getBrowserDetails(),i;i=this.model.enableRTL?"margin-right":"margin-left";r.find(".e-movablecontent").css(i,n&&n.browser==="safari"?"auto":r.find(".e-frozencontentdiv").width()+"px");this.getHeaderContent().find(".e-movableheader").removeAttr("style").css(i,n&&n.browser==="safari"?"auto":this.getHeaderContent().find(".e-frozenheaderdiv").width()+"px")},_refreshScroller:function(i){var r=this.getContent().first(),o,f,s,u,h,e,c,l;if(!t.isNullOrUndefined(r.data("ejScroller"))){if(this.model.scrollSettings.frozenColumns>0){if(this._isFrozenColumnVisible())if(this._visibleColumns.length<=this.model.scrollSettings.frozenColumns){for(o=!1,f=this.model.scrollSettings.frozenColumns;f<this.model.columns.length;f++)if(this._visibleColumns.indexOf(this.model.columns[f].headerText)!=-1){o=!0;break}o||(r.find(".e-frozencontentdiv").removeAttr("style"),this.getHeaderContent().find(".e-frozenheaderdiv").removeAttr("style"),r.find(".e-movablecontent").width(0),r.find(".e-movablecontentdiv").width(0),r.find(".e-movablecontent").height(0),r.find(".e-movablecontentdiv").height(0))}else this._frozenAlign(),r.find(".e-movablecontent").scrollLeft(this.getHeaderContent().find(".e-movableheader").scrollLeft()),!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&this.getScrollObject()._vScrollbar.value()>this.getScrollObject()._vScrollbar.model.maximum&&(u=this.getScrollObject()._vScrollbar.model.maximum);else r.find(".e-movablecontentdiv").removeAttr("style"),this.getHeaderContent().find(".e-movableheaderdiv").removeAttr("style"),r.find(".e-frozencontent").width(0),r.find(".e-frozencontentdiv").width(0),r.find(".e-frozencontent").height(0),r.find("e-frozencontentdiv").height(0);this.refreshScrollerEvent()}if(this.model.scrollSettings.frozenRows>0){for(this._initFrozenRows(),f=0;f<this.getRows().length;f++)n(this.getRows()[f]).filter(":hidden").css("display","table-row");!this.initialRender&&t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&this.element.height()>this.model.scrollSettings.height&&this.getContent().attr("tabindex","0").ejScroller(this.model.scrollSettings);u=this.getScrollObject().model.scrollTop;s=this.getScrollObject().model.scrollLeft;!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&u>this.getScrollObject()._vScrollbar.model.maximum&&(u=this.getScrollObject()._vScrollbar.model.maximum);(i.requestType=="cancel"||i.requestType=="save")&&u>this._editFormHeight&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&(u=u-this._editFormHeight);i.requestType==t.Grid.Actions.Add&&this.getScrollObject().scrollY(0,!0);t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)}(i.requestType=="beginedit"||i.requestType=="save")&&(u=this.getScrollObject().model.scrollTop,this.getScrollObject().scrollY(0,!0));!t.isNullOrUndefined(this.model.dataSource)&&(i.requestType=="refresh"||i.requestType=="searching")&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData&&this._gridRecordsCount>0?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(1),this._currentVirtualIndex==1&&this.getScrollObject().scrollY(0));this.model.scrollSettings.frozenColumns>0&&this.rowHeightRefresh();this.getScrollObject().refresh();r.ejScroller("model.enableRTL",this.model.enableRTL);this.model.isResponsive&&(i.requestType=="searching"||i.requestType=="filtering")&&(h=this.getScrollObject(),e=h.isHScroll()?this.getContentTable().height()+h.model.buttonSize:this.getContentTable().height(),e=typeof this.model.scrollSettings.height=="string"||e>this.model.scrollSettings.height?this.model.scrollSettings.height:e,c=typeof this.model.scrollSettings.width=="string"?this.element.width():this.model.scrollSettings.width,width=c,this.getContent().ejScroller({height:e,width:width}));this.getScrollObject().isVScroll()&&!this.getScrollObject().model.autoHide?(this.getHeaderContent().addClass("e-scrollcss"),this.getHeaderTable().first().width(this.getContentTable().width()),this.getHeaderContent().find(".e-headercontent").hasClass("e-hscrollcss")||this.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):this._showHideScroller();!this.model.allowPaging||this.getScrollObject().isVScroll()||this.getScrollObject().isHScroll()||this.getContentTable().width()==this.getContent().width()||(this.getContentTable().width(this.getContent().width()),this.getHeaderTable().width(this.getContentTable().width()));this._getRowHeights();u&&!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&i.requestType!=t.Grid.Actions.Add&&(this._currentTopFrozenRow=0,u>this.getScrollObject()._vScrollbar.model.maximum&&(u=this.getScrollObject()._vScrollbar.model.maximum),this.getScrollObject()._vScrollbar.scroll(u));s&&this.model.scrollSettings.frozenColumns>0&&i.requestType==t.Grid.Actions.BeginEdit&&this.getScrollObject()._hScrollbar.scroll(s);i.requestType=="virtualscroll"&&(l=this.getScrollObject().model.scrollTop+this.getScrollObject().model.height-this.getScrollObject().model.height*.3,this.getScrollObject().scrollY(l,!0))}},_isFrozenColumnVisible:function(){for(var n=0;n<this.model.scrollSettings.frozenColumns;n++)if(this.model.columns[n].visible)return!0;return!1},_frozenPaneRefresh:function(){this.getContent().find(".e-frozencontentdiv").css("display","none");this.getHeaderContent().find(".e-frozenheaderdiv").css("display","none");this.getHeaderContent().find(".e-movableheader")[0].style["margin-left"]="";this.getContent().find(".e-movablecontent")[0].style["margin-left"]="";var i=t.isNullOrUndefined(this._scrollObject._vScrollbar)?0:this._scrollObject._vScrollbar["e-vscroll"].width(),n=this.model.scrollSettings.width-i-1;this.model.scrollSettings.width>this.getContent().find(".e-movablecontentdiv").width()&&(this.getContent().find(".e-movablecontentdiv").width(n),this.getHeaderContent().find(".e-movableheaderdiv").width(n));this._scrollObject.option("scrollLeft",0)},_renderScroller:function(){var s,r,u,o,f,l,e,i,h,c;if(this.model.scrollSettings||(this.model.scrollSettings={}),this.model.enablePersistence&&(t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)||!this.model.scrollSettings.previousStateWidth)&&this.model.isResponsive&&(this.model.scrollSettings.previousStateWidth=this.model.scrollSettings.width),typeof this._originalScrollWidth!="string"||this.model.isResponsive||(this.element.css("width","auto"),r=this.element.width(),(this.model.scrollSettings.width=="auto"||this._originalScrollWidth=="auto")&&(this._originalScrollWidth="100%"),this.model.scrollSettings.width=r*(parseFloat(this._originalScrollWidth)/100)),typeof this.model.scrollSettings.height!="string"||this.model.isResponsive||(s=this.element.height(),this.model.scrollSettings.height=="auto"&&(this.model.scrollSettings.height="100%"),this.model.scrollSettings.height=s*(parseFloat(this.model.scrollSettings.height)/100)),(this.model.scrollSettings.width||this.model.width)&&!this._mediaQuery&&(r=this.model.scrollSettings.width||this.model.width,typeof r=="string"?this.element.css("width",this.model.scrollSettings.width||this.model.width):this.element.width(this.model.scrollSettings.width||this.model.width)),u=this.getContent().attr("tabindex","0"),l=this.getRows(),this.model.scrollSettings.frozenColumns>0){for(e=0;e<this.getRows().length;e++)n(this.getRows()[e]).filter(":hidden").css("display","table-row");if(scrollWidth=this.getContent().find(".e-frozencontentdiv").width()+20,scrollWidth>this.model.scrollSettings.width){this.getContent().remove();this.getHeaderTable().eq(1).remove();this._alertDialog.find(".e-content").text(this.localizedLabels.FrozenColumnsViewAlert);this._alertDialog.ejDialog("open");return}o=this.getContent().find(".e-frozencontentdiv").width();f=this.model.enableRTL?"margin-right":"margin-left";this.getContent().find(".e-movablecontent").css(f,o+"px");this.getHeaderContent().find(".e-movableheader").css(f,o+"px");this.model.scrollSettings.targetPane=".e-movablecontent"}this._initFrozenRows();this.model.scrollSettings.autoHide&&(this.model.scrollSettings.show=n.proxy(this._showHideScroller,this));i=this;this.model.scrollSettings.frozenRows||(this.model.scrollSettings.scroll=function(n){t.isNullOrUndefined(n.scrollData)||n.scrollData.handler!="e-hhandle"?(i._scrollValue=n.scrollTop,i.model.currentIndex=n.scrollTop==0?n.scrollTop:Math.floor(n.scrollTop/i._vRowHeight)):(i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),i._checkScroller(n,this))});!this.model.scrollSettings.allowVirtualScrolling&&this.model.currentIndex>0&&!this.model.scrollSettings.scrollTop&&(h=this.model.currentIndex*this.getRowHeight(),this.model.scrollSettings.scrollTop=h);u.ejScroller(this.model.scrollSettings);this.model.allowRowDragAndDrop&&this.model.allowScrolling&&t.gridFeatures.dragAndDrop&&u.ejScroller({thumbStart:function(){return!1}});this.model.rowTemplate==null||t.isIOSWebView()||this.getBrowserDetails().browser!="msie"&&this.getBrowserDetails().browser!="safari"||this.getScrollObject().refresh();this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenRows==0&&this.getScrollObject()._vScrollbar&&this.getScrollObject()._hScrollbar&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=this.getScrollObject()._hScrollbar._scrollData.skipChange=!0);this.model.scrollSettings.autoHide||this._showHideScroller();!t.isIOSWebView()&&this.getBrowserDetails().browser=="safari"&&this.model.scrollSettings.frozenColumns>0&&this.getHeaderContent().find(".e-movableheader").add(this.getContent().find(".e-movablecontent")).css(f,"auto");this.refreshScrollerEvent();this.model.scrollSettings.frozenColumns>0&&!this._isFrozenColumnVisible()&&this._frozenPaneRefresh();i.model.scrollSettings.allowVirtualScrolling&&(c=this._refreshVirtualPagerInfo(),this._showPagerInformation(c),u.ejScroller({scroll:function(r){if(i.model.scrollSettings.enableVirtualization&&r.scrollData!=null&&r.scrollData.handler!="e-hhandle"){if(r.reachedEnd=r.scrollData.scrollable-r.scrollTop==0,r.source=="thumb"){var f=t._getObjectKeys(i._virtualLoadedRows),u=(i._currentVirtualIndex+2).toString();i.model.scrollSettings.virtualScrollMode=="continuous"&&n.inArray(u,f)==-1&&u<i._totalVirtualViews?i._isContinuous=!0:(r.model.scrollTop=r.scrollTop,i._isContinuous=!1,r.cancel=!0)}(r.source=="button"||r.source=="key"||r.source=="wheel")&&(n("#"+i._id+"_WaitingPopup").is(":visible")?r.cancel=!0:(i._isThumbScroll=!1,i._virtualViewScroll(r)),i.model.scrollSettings.virtualScrollMode=="continuous"&&r.reachedEnd&&this.refresh());i.model.currentIndex=r.scrollTop==0?r.scrollTop:Math.floor(r.scrollTop/i._vRowHeight)}else!t.isNullOrUndefined(r.scrollData)&&r.scrollData.handler=="e-hhandle"&&i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),r.reachedEnd=this.content()[0].scrollHeight-r.scrollTop==this.content()[0].clientHeight,(r.source=="button"||r.source=="key"||r.source=="wheel")&&i.model!=null&&i._virtualScroll(r),r.source=="wheel"&&r.scrollTop!=i._scrollValue&&(r.scrollTop=i._scrollValue),i._checkScroller(r,this)},thumbEnd:function(t){(i.model.scrollSettings.enableVirtualization&&i.model.scrollSettings.virtualScrollMode=="continuous"?t.reachedEnd=t.scrollData.scrollable-t.model.scrollTop==0:t.originalEvent&&!n(t.originalEvent.target).hasClass("e-rowcell")&&(t.reachedEnd=this.content()[0].scrollHeight-t.scrollData.sTop==this.content()[0].clientHeight),t.scrollData.handler!="e-hhandle")&&i.model!=null&&t.originalEvent&&(i.model.scrollSettings.enableVirtualization?(i._isThumbScroll=!0,i._virtualViewScroll(t),i.model.scrollSettings.virtualScrollMode=="continuous"&&t.reachedEnd&&this.refresh(),i._isLocalData&&i.element.ejWaitingPopup("hide")):i._virtualScroll(t))},scrollEnd:function(t){if(t.scrollData.type!="mousewheel"&&(t.scrollData.model==null||t.scrollData.model.orientation!="horizontal")&&i.model.scrollSettings.enableVirtualization&&!i._isContinuous){var u=i._calculateCurrentViewPage(t.model),r=n.inArray(u,i._virtualLoadedPages)!=-1;r?(i._isThumbScroll=!0,i._virtualViewScroll(t),i.element.ejWaitingPopup("hide"),i._totalVirtualViews<=i._maxViews*3&&(this._content[0].scrollTop=t.scrollData.scrollTop)):(r||i.element.ejWaitingPopup("show"),t.cancel=!0)}}}))},_checkScroller:function(n,t){var i=n.scrollLeft>0?n.scrollLeft:Math.abs(n.scrollLeft),r;n.source=="thumb"&&(t.content()[0].scrollWidth-i==t.content()[0].clientWidth||i==0)&&(this.model.enableRTL&&(r=i==0?n.scrollData.scrollable:0,n.scrollData.sTop=n.model.scrollLeft=r,t.content().scrollLeft(r)),t._hScrollbar.refresh())},_showHideScroller:function(){this.getScrollObject().isVScroll()?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this.model.scrollSettings.autoHide||this.getHeaderContent().addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss");this.model.scrollSettings.frozenColumns!=0||this._mediaQuery||(!this.element.find(".e-gridheader").hasClass("e-scrollcss")&&(this.model.filterSettings.filteredColumns.length||this._hiddenColumns.length&&!this.model.minWidth)?(this.getHeaderTable().removeAttr("style"),this.getContentTable().removeAttr("style")):(this.getHeaderContent().find("div table").first().width(this.getContentTable().width()),this.getContent().find("div table").first().width(this.getContentTable().width()),this.getHeaderTable().width(this.getContentTable().width())));this._isHscrollcss()},_isHscrollcss:function(){var n=this.getContent().data("ejScroller"),t=n&&(n.isHScroll()||n.isVScroll())?"addClass":"removeClass";this.getHeaderContent().find(".e-headercontent")[t]("e-hscrollcss")},_initFrozenRows:function(){var i=this.getRows(),r;this.model.currentViewData&&this.model.currentViewData.length!=0&&(this.model.scrollSettings.frozenRows>0&&i!=null?(this.model.scrollSettings.scroll=n.proxy(this._scroll,this),this.getContent().find(".e-frozeny").removeClass("e-frozeny").end().find(".e-frozenrow").removeClass("e-frozenrow"),!t.isNullOrUndefined(i[0][this.model.scrollSettings.frozenRows-1])&&!t.isNullOrUndefined(i[1][this.model.scrollSettings.frozenRows-1])&&this.model.scrollSettings.frozenColumns>0?n(i[0][this.model.scrollSettings.frozenRows-1].cells).add(i[1][this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"):t.isNullOrUndefined(this.getRowByIndex(this.model.scrollSettings.frozenRows-1)[0])||n(i[this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"),this.getContent().height()>this.model.scrollSettings.height&&(r=t.isNullOrUndefined(this.getContent().data("ejScroller"))?null:this.getScrollObject(),this.initialRender||t.isNullOrUndefined(r)||!t.isNullOrUndefined(r._vScrollbar)||this._getRowHeights(),this.model.scrollSettings.height=this._rowHeightCollection[Math.floor(this.model.scrollSettings.height/this._rowHeightCollection[1])]+18)):delete this.model.scrollSettings.scroll)},refreshScrollerEvent:function(){var i=this;this.getContent().find(".e-content:first,.e-movablecontent").scroll(t.proxy(function(t){if(this.model.scrollSettings.targetPane?($movablecontent=n(t.currentTarget).hasClass("e-movablecontent")||!this.model.currentViewData||this.model.currentViewData.length==0?n(t.currentTarget):n(t.currentTarget).find(".e-movablecontent"),this.getHeaderContent().find(".e-movableheader").scrollLeft($movablecontent.scrollLeft())):this.getHeaderContent().find("div").first().scrollLeft(n(t.currentTarget).scrollLeft()),this.model.scrollSettings.frozenRows>0&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&this.model.isEdit){var i=t.target.scrollTop;this.getContent().find(".e-content").scrollTop(0);this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop+i,!0)}},this));this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").scroll(t.proxy(function(t){var i=n(t.currentTarget);this.model.scrollSettings.targetPane?(this.getContent().find(".e-movablecontent").scrollLeft(i.scrollLeft()),this.model.showSummary&&this.getFooterContent().find(".e-movablefooter").scrollLeft(i.scrollLeft())):(this.model.showSummary&&this.getFooterContent().scrollLeft(i.scrollLeft()),this.getContent().find(".e-content").first().scrollLeft(i.scrollLeft()))},this))},clearFiltering:function(n){var i,t;if(n){if(this._clearFilter(n),this.model.filterSettings.filterType!="filterbar")for(t=0;t<this.filterColumnCollection.length;t++)this.filterColumnCollection[t].field==n&&this.filterColumnCollection.splice(t,1)}else{for(i=this.model.filterSettings.filteredColumns,t=0;t<i.length;)this._clearFilter(i[t].field);this.filterColumnCollection=[];(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&this.getHeaderTable().find(".e-filtericon").removeClass("e-filteredicon e-filternone")}},_clearFilter:function(i){var u=this.model.filterSettings.filterType,f,r;t.isNullOrUndefined(this.getColumnByField(i).filterType)||(u=this.getColumnByField(i).filterType);switch(u){case t.Grid.FilterType.FilterBar:n.inArray(this.getColumnByField(i),this.filterColumnCollection)!=-1&&(this.getHeaderTable().find("#"+i+"_filterBarcell").val(""),this._currentFilterbarValue="",f=n.inArray(i,this.filterColumnCollection),this._currentFilterColumn=this.getColumnByField(i),this._showFilterMsg());break;case t.Grid.FilterType.Menu:r="#"+this._id+"_"+this._$colType+"Dlg";this._$colType=="boolean"?n(r).find(".e-value .e-js").ejCheckBox("model.checked",!1):this._$colType=="number"?n(r).find(".e-numerictextbox").ejNumericTextbox("model.value",""):n(r).find(".e-value input").val("");(this._excelFilterRendered||this._isExcelFilter)&&delete this._excelFilter._predicates[0][i];this._$curFieldName=i;break;case t.Grid.FilterType.Excel:delete this._excelFilter._predicates[0][i];this._excelFilter.closeXFDialog();this._$curFieldName=i}this.filterColumn(i,"","","or")},clearSearching:function(){this.element.find(".e-gridtoolbar #"+this._id+"_search").val("");this.search("");n.extend(this.model.searchSettings,this.defaults.searchSettings)},_renderByFrozenDesign:function(){var r=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),i={};i.colgroup1=r.append(t.buildTag("colgroup").append(u.splice(0,this.model.scrollSettings.frozenColumns))).html();i.colgroup2=r.html(t.buildTag("colgroup").append(u)).html();this.getContent().find("div").first().get(0).innerHTML=n.render[this._id+"_FrozenTemplate"]({datas:this.model.currentViewData},i);this.setGridContentTable(this.getContent().find(".e-table").attr("role","grid"))},addFrozenTemplate:function(){var i="<div class='e-frozencontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup1}}<tbody>{{for datas tmpl='"+this._id+"_JSONFrozenTemplate'/}}<\/tbody><\/table><\/div><div class='e-movablecontent'><div class='e-movablecontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup2}}<tbody>{{for datas tmpl='"+this._id+"_JSONTemplate'/}}<\/tbody><\/table><\/div><\/div>",t={};t[this._id+"_FrozenTemplate"]=i;n.templates(t)},_getTopRow:function(n){var i=this.model.scrollSettings.frozenRows,t=0;if(n>10)for(t=0;t<this._rowHeightCollection.length;t++)if(this._rowHeightCollection[t]>n){i=this.model.scrollSettings.frozenRows+t-1;break}return{imaginaryIndex:i,actualIndex:t}},_showHideRow:function(t,i,r,u){var f=this.getRows();this.model.scrollSettings.frozenColumns>0?n(f[0]).slice(t,i).add(n(f[1]).slice(t,i).toArray())[r]():n(f).slice(t,i)[r]();this._currentTopFrozenRow=r=="show"?t:i;this.getScrollObject()._changevHandlerPosition(u)},_scroll:function(n){var i,f,e,o,u;if(n.scrollData!=null&&n.scrollData.dimension!="width"){n.cancel=!0;var h=this.getRows(),s=this._getTopRow(n.scrollTop),r=s.imaginaryIndex;if(r>this._currentTopFrozenRow?this._showHideRow(this.model.scrollSettings.frozenRows,r,"hide",n.scrollTop):r<this._currentTopFrozenRow&&this._showHideRow(r,this._currentTopFrozenRow+1,"show",n.scrollTop),i=this.getContentTable().last().find("tr"),f=parseInt(i.last().find("td:first").css("border-top-width"))*2+1,n.scrollTop==this.getScrollObject()._vScrollbar.model.maximum&&i.last()[0].offsetTop+i.last().height()-f>this.element.find(".e-content").height()){for(e=i.last().prev()[0].offsetTop+i.last().prev().height(),o=1,u=i.length-2;e-f>this.element.find(".e-content").height();u++){e=i[u].offsetTop+i.eq(u).height();o++;break}this._showHideRow(this.model.scrollSettings.frozenRows,r+o,"hide",n.scrollTop)}n.model.scrollTop=n.scrollTop}else t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)},_renderAlertDialog:function(){var r=t.buildTag("div.e-content",this._getLocalizedLabels().frozenColumnsMessage),i=t.buildTag("span.e-buttons","<input type='button' class='e-flat' id="+this._id+"ConfirmDialogOK value='"+this._getDeprecatedLocalizedLabel("OKButton")+"'/>");this._alertDialog=t.buildTag("div#"+this._id+"AlertDialog");this._alertDialog.append(r).append(i);this.element.append(this._alertDialog);i.find("input").ejButton({cssClass:this.model.cssClass,showRoundedCorner:!0,size:"mini",click:n.proxy(function(){this._alertDialog.ejDialog("close")},this)});this._renderFDialog(this._id+"AlertDialog");this._alertDialog.ejDialog({width:"auto",enableModal:!0})},_renderFDialog:function(t){n("#"+t).ejDialog({showOnInit:!1,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showHeader:!1,width:260,enableResize:!1,allowKeyboardNavigation:!1,content:"#"+this._id})},_virtualScroll:function(t){var i,e;if(this.selectedRowsIndexes.length==this._gridRecordsCount&&this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").prop("checked","checked"),t!=null){var f=0,o=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,u=this.model.pageSettings,s=this.getContentTable()[0].tBodies[0],h=n(s).find("tr.e-virtualrow");if(u.totalPages=Math.ceil(o/u.pageSize),t.scrollTop!==r&&(t.model.scrollTop=t.scrollTop),t.reachedEnd!=r&&(t.model.reachedEnd=t.reachedEnd),i=this._calculateCurrenPage(h,this.getContentTable(),t.model),i>u.totalPages&&(i=u.totalPages),u.currentPage!=i&&n.inArray((i-1)*u.pageSize,this.virtualLoadedPages)==-1&&this.element.find(".gridform:visible").length==0&&(this._isVirtualRecordsLoaded=!1),this._isVirtualRecordsLoaded)u.currentPage=i;else{if(n.inArray((i-1)*u.pageSize,this.virtualLoadedPages)==-1){if(this.model.scrollSettings.virtualScrollMode=="continuous"&&!t.reachedEnd)return;i==u.totalPages&&n.inArray((i-2)*u.pageSize,this.virtualLoadedPages)==-1&&(f++,this.set_currentPageIndex(i));f==1&&(this._lastRow=!0);this.set_currentPageIndex(i)}u.currentPage=i}e=this._refreshVirtualPagerInfo();this._showPagerInformation(e)}},_virtualViewScroll:function(t){if(t!=null){t.scrollTop!==r&&(t.model.scrollTop=t.scrollTop);t.reachedEnd!=r&&(t.model.reachedEnd=t.reachedEnd);var i=this._calculateCurrentVirtualIndex(t);this.model.isEdit&&this.cancelEdit();n.inArray(i,this._currentLoadedIndexes)==-1&&(this._isVirtualRecordsLoaded=!1);this._isVirtualRecordsLoaded||this.set_currentVirtualIndex(i)}},_createPagerStatusBar:function(){var n=this.element.find(".e-pagerstatusbar"),i,r;n.length&&n.remove();i=t.buildTag("div.e-pagermsgdiv");this.$pagerStatusBarDiv=t.buildTag("div.e-pagerstatusbar").append(i);this.model.scrollSettings.allowVirtualScrolling&&this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&(r=t.buildTag("div.e-pagerfiltermsg").css("display","none"),this.$pagerStatusBarDiv.append(r));this.$pagerStatusBarDiv.appendTo(this.element);this.$pagerStatusBarDiv.css("display","none")},_refreshVirtualContent:function(t){var e=this.getRowHeight(),o=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,s,r,i,f,h,c,l,u;t!=null&&(this._currentPage(t),s=this._refreshVirtualPagerInfo(),this._showPagerInformation(s));r=0;this.model.scrollSettings.enableVirtualization&&(r=1);i=r==1?this.getCurrentIndex()+1:this.getCurrentIndex();f=this.getContentTable()[0].tBodies[0];i>1&&(h=document.createElement("tr"),n(h).addClass("e-virtualrow").css("height",e*i).prependTo(f));i+this.model.pageSettings.pageSize<=o&&this.getContentTable().find("tr").last().hasClass("e-virtualrow")!=!0&&this.model.scrollSettings.frozenColumns==0&&(c=document.createElement("tr"),l=this.model.scrollSettings.virtualScrollMode=="normal"?e*(o-(i+this.model.pageSettings.pageSize)):1,n(c).addClass("e-virtualrow").css("height",l).appendTo(n(f)));this.virtualLoadedPages=[];this.orderedVirtualLoadedPage=[];this.virtualLoadedPages.push(i>=r?i:r);this.orderedVirtualLoadedPage.push(i>=r?i:r);u=n(f).find("tr:not(.e-virtualrow)").attr("name",i>=r?i:r)[0];u&&u.previousSibling&&(n(u.previousSibling).hasClass("e-virtualrow")||u.previousSibling.offsetTop>i*this.getContent().height())&&(this.getContent().children("div").first().scrollTop(this.getContent().find(".content").scrollTop()-(this.getContent().find(".content").scrollTop()-u.offsetTop)),this._isVirtualRecordsLoaded=!0)},isIntermediate:function(){return this.model.currentIndex<this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1)?!0:!1},_refreshVirtualView:function(t,i,r){var e,o,f,a,c,s,l,h,u;if(this._singleView)this._singleView=!1,this._addLastRow(),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),h=this._currentVirtualIndex.toString(32),n(this._gridRows).attr("name",h),this._virtualLoadedRows[this._currentVirtualIndex]=this._gridRows,this._eventBindings();else{if(e=this._virtualRowCount,t)t>this._totalVirtualViews&&(t=1,o=!0),i=="selectRows"&&(o=!0),this._currentVirtualIndex=t,this._virtualLoadedRecords[t]?(a=this.getScrollObject(),f=Math.ceil((a.scrollTop()+this.model.scrollSettings.height)/this._vRowHeight/this.model.pageSettings.pageSize)):(this._virtualDataRefresh||this._currentVirtualIndex==this._totalVirtualViews||(o=!0),f=Math.ceil(t*this._virtualRowCount/this.model.pageSettings.pageSize)),this._refreshVirtualViewScroller(o,i,r),f>this.model.pageSettings.totalPages&&(f=this.model.pageSettings.totalPages),f<=0&&(f=1),n.inArray(f,this._virtualLoadedPages)==-1?this.gotoPage(f):(this._currentPage(f),this._needPaging=this._checkCurrentVirtualView(this._virtualLoadedRecords,t)?!1:!0,this._getVirtualLoadedRecords(this.model.query),this._replacingVirtualContent());else{if(this._refreshVirtualViewDetails(),c=n(this.getContentTable()[0].rows),this._setVirtualTopBottom(),this.initialRender){for(u=0;u<this._currentLoadedIndexes.length;u++)s=this._currentLoadedIndexes[u],viewIndex=(u+1)*e,viewCount=u*e,n(c[viewIndex-1]).addClass("e-virtualview"+s),h=s.toString(32),l=c.slice(viewCount,viewCount+e).attr("name",h).detach(),this._virtualLoadedRows[s]=l,l.appendTo(this.getContentTable());this._currentVirtualIndex>1&&this._refreshVirtualViewScroller()}this._eventBindings()}n.inArray(this._currentPage(),this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(this._currentPage())}if(!t&&(this.model.queryCellInfo||this.model.rowDataBound))for(u=0;u<this._currentLoadedIndexes.length;u++)n.inArray(this._currentLoadedIndexes[u],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[u]);this._isThumbScroll=!1;this._virtualDataRefresh=!1},_refreshVirtualViewData:function(){this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualLoadedPages=[];this._virtualPageRecords={};this._queryCellView=[];this.model.pageSettings.totalPages!=null&&this._currentPage()>this.model.pageSettings.totalPages&&(this._currentPage(1),this._currentVirtualIndex=1)},setCurrentPageData:function(n){this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._refreshVirtualViewDetails(),this._setVirtualLoadedRecords(n,this._currentPage()),this._refreshVirtualView(this._currentVirtualIndex))},_refreshVirtualViewScroller:function(n,t,i){var r,u;(this.initialRender&&!this.model.scrollSettings.scrollTop||n)&&(u=this._vRowHeight,r=this.model.currentIndex*this._vRowHeight);r=t=="selectRows"?i*this._vRowHeight:this._scrollObject.model.scrollTop;this.getContent().ejScroller("model.scrollTop",r);this._scrollValue=r},_calculateCurrentViewPage:function(n){n||(n=this._scrollObject.model);var i=this.model.pageSettings.pageSize,t=Math.ceil((n.scrollTop+this.model.scrollSettings.height)/this._vRowHeight/i);return this.model.pageSettings.totalPages==null&&(this.model.pageSettings.totalPages=Math.ceil(this._getVirtualTotalRecord()/i)),t>this.model.pageSettings.totalPages&&(t=this.model.pageSettings.totalPages),this.model.pageSettings.currentPage=t,t},_calculateCurrentVirtualIndex:function(t){var h=t.model,p=this._getVirtualTotalRecord(),i,c,l,u=[],e,o,a,r=h.scrollTop,y=r+this.model.scrollSettings.height,s,v,f;if(i=y/this._vRowHeight/this._virtualRowCount,i=this._prevVirtualIndex>this._currentVirtualIndex&&r<=this._scrollValue?Math.floor(i):Math.ceil(i),r>=this._scrollValue&&h.virtualScrollMode=="continuous"&&h.reachedEnd&&(i=i+1),i>this._totalVirtualViews&&(i=this._totalVirtualViews),i<=0&&(i=1),n.inArray(i,this._currentLoadedIndexes)!==-1&&this._virtualLoadedRows[i]&&r!=t.scrollData.scrollable){for(s=this.getContentTable()[0].rows,a=s.length,v=this.getContent().find(".e-virtualtop").height(),l=r>=this._scrollValue,f=0;f<a;f++){if(e=s[f],o=e.offsetHeight+e.offsetTop+v,o>r+this.model.scrollSettings.height){u.length===0&&f!==0&&(u=[s[e.offsetTop<=r+this.model.scrollSettings.height?f:f-1]]);break}if(o>=r&&o<=r+this.model.scrollSettings.height&&(u.push(e),l===!1&&u.length>1))break}c=n(r>=this._scrollValue?u[u.length-1]:u[0]);c.length&&(i=parseInt(c.attr("name"),32))}return this._scrollValue=r,i},_calculateCurrenPage:function(t,i,r){var o=this.model.pageSettings.pageSize,u,a=this,v,w,f=[],s,h,b,k,y,g=this.getRowHeight(),c,e,l,p,d;if(u=(r.scrollTop+this.model.scrollSettings.height)/g/o,k=this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1),y=this.getContentTable().find("tr[name="+k+"]").eq(0),u=y.length&&y.offset().top>0&&u>=1&&r.scrollTop<this._scrollValue&&this.virtualLoadedPages.indexOf(Math.ceil(u-1)*o)!==-1?Math.floor(u):Math.ceil(u),r.scrollTop>=this._scrollValue&&r.virtualScrollMode=="continuous"&&r.reachedEnd&&(u=this.virtualLoadedPages[this.virtualLoadedPages.length-1]/o+2),n.inArray((u-1)*o,this.virtualLoadedPages)!==-1){for(c=this.getContentTable().children("tbody").children("tr"),b=c.length,w=r.scrollTop>=this._scrollValue,e=0;e<b;e++){if(s=c[e],h=s.offsetHeight+s.offsetTop,h>r.scrollTop+a.model.scrollSettings.height){f.length===0&&e!==0&&(f=[c[s.offsetTop<=r.scrollTop+a.model.scrollSettings.height?e:e-1]]);break}if(h>=r.scrollTop&&h<=r.scrollTop+a.model.scrollSettings.height&&(f.push(s),w===!1&&f.length>1))break}v=n(r.scrollTop>=this._scrollValue?f[f.length-1]:f[0]);v.hasClass("e-virtualrow")?f.length===1&&u++:u=parseInt(v.attr("name"),10)/o+1}for(this._scrollValue=r.scrollTop,l=0;l<t.length;l++)if(p=t[l],p.offsetTop+p.offsetHeight>=r.scrollTop)return d=this._calculatePrevPage(t,i,r),this._prevPageNo=d,u==0&&(u=1),u>this.model.pageSettings.totalPages?this.model.pageSettings.totalPages:u;return u},_calculatePrevPage:function(t,i,r){for(var f,e,u=0;u<t.length;u++)if(f=t[u],f.offsetTop+f.offsetHeight>=r.scrollTop&&(e=n(f).prevAll("tr[name]")[0],e!=null))return Math.ceil(parseInt(n(e).attr("name"),10)/this.model.pageSettings.pageSize)+1;return-1},_refreshVirtualPagerInfo:function(){var n={};return n.pageSize=this.model.pageSettings.pageSize,n.totalRecordsCount=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,n.totalRecordsCount==0&&this._currentPage(0),n.currentPage=this._currentPage(),n.totalPages=Math.ceil(n.totalRecordsCount/n.pageSize),n},_showPagerInformation:function(t){var i=(t.currentPage-1)*t.pageSize;n(this.$pagerStatusBarDiv).find("div:first").html(String.format(this.localizedLabels.PagerInfo,t.currentPage,t.totalPages,t.totalRecordsCount),i,i+t.pageSize);n(this.$pagerStatusBarDiv).css("display","block")},_cellMerging:function(i){i.colMerge=function(n){if(this.cell.className.indexOf("e-colmerge")==-1){this.cell.className+=" e-colmerge";this.model.columns.length-this.cell.cellIndex<n&&(n=this.model.columns.length-this.cell.cellIndex);this.cell.colSpan=n;for(var i=1;i<n;i++)t.isNullOrUndefined(this.cell.parentElement.children[this.cell.cellIndex+i])||(this.cell.parentElement.children[this.cell.cellIndex+i].className+=" e-hide")}};i.rowMerge=function(i){var r,u;if(this.cell.className.indexOf("e-rowmerge")==-1)for(this.cell.className+=" e-rowmerge",r=this.cell.parentNode.parentNode,r.rows.length-this.cell.parentElement.rowIndex<i&&(i=r.rows.length-this.cell.parentElement.rowIndex),this.cell.rowSpan=i,u=0;u<i-1;u++)if(t.isNullOrUndefined(r.children[this.cell.parentElement.rowIndex+u].nextSibling))break;else(!n(".e-grid").children().is(".e-dialog")||n(".e-grid").find(".e-dialog").attr("style").indexOf("display: none")!=-1||this.model.allowFiltering)&&(r.children[this.cell.parentElement.rowIndex+u].nextSibling.children[this.cell.cellIndex].className+=" e-merged e-hide")};i.merge=function(r,u){var o,s,e,f;if(r>1&&u>1){if(this.cell.className.indexOf("e-colmerge")==-1){if(this.cell.className+=" e-colmerge",o=this.cell.parentNode.parentNode,o.rows.length-this.cell.parentElement.rowIndex<u&&(u=o.rows.length-this.cell.parentElement.rowIndex),!n(".e-grid").children().is(".e-dialog")||n(".e-grid").find(".e-dialog").attr("style").indexOf("display: none")!=-1||this.model.allowFiltering)for(s=0;s<u;s++)if(t.isNullOrUndefined(o.children[this.cell.parentElement.rowIndex+s]))break;else for(e=o.children[this.cell.parentElement.rowIndex+s].children[this.cell.cellIndex],this.model.columns.length-e.cellIndex<r&&(r=this.model.columns.length-e.cellIndex),e.colSpan=r,f=1;f<r;f++)t.isNullOrUndefined(e.parentElement.children[this.cell.cellIndex+f])||(e.parentElement.children[this.cell.cellIndex+f].className+=" e-hide");else for(this.cell.colSpan=r,f=1;f<r;f++)t.isNullOrUndefined(this.cell.nextSibling)||(this.cell.parentElement.children[this.cell.cellIndex+f].className+=" e-hide");i.rowMerge(u)}}else r>1&&i.colMerge(r),u>1&&i.rowMerge(u)}},_replacingContent:function(){var wt=document.createElement("div"),a=0,u,y,et,e,c,d,o,w,ot,g,st,nt,ht,ct,it,i,h,yt,rt,gt,ni,ut,pt;this.model.scrollSettings.enableVirtualization&&(a=1);var f=a==1?this.getCurrentIndex()+1:this.getCurrentIndex(),s=this.getContentTable()[0],ft=n(s).find("colgroup").first(),v=this.getRowHeight();ft.replaceWith(this._getMetaColGroup());(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&ft.prepend(this._getIndentCol());u=s.tBodies[0];y=this.model.currentViewData;t.isNullOrUndefined(this._currentPageData)?this._virtualLoadedRecords[this._currentPage()]=y:(this._virtualLoadedRecords[this._currentPage()]=this._currentPageData,this._currentPageData=null);var bt=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](y)),k=this,p=bt.children("tr");if(this._allowcolumnSelection&&this.selectedColumnIndexes.length>0)for(h=0;h<this.selectedColumnIndexes.length;h++)et=this.selectedColumnIndexes[h]+1,p.find("td:nth-of-type("+et+")").addClass("e-columnselection");for(this.virtualLoadedPages.push(f>=a?f:a),e=t.dataUtil.mergeSort(t.distinct(this.virtualLoadedPages)),n(p).attr("name",f),c=t.dataUtil.min(e),d=t.dataUtil.max(e),n(u).children(".e-virtualrow").remove(),i=0;i<e.length;i++)o=e[i],w=e[i-1],(o!=this.orderedVirtualLoadedPage[i]||this.orderedVirtualLoadedPage[i]==r)&&(w!=r?p.insertAfter(n(u).children("[name="+w+"]:last")):p.insertBefore(n(u).children("[name="+this.orderedVirtualLoadedPage[i]+"]:first")),this.orderedVirtualLoadedPage=e),o!=0&&(ot=o==c?c:w,g=o-ot-k.model.pageSettings.pageSize,g>0&&(st=document.createElement("tr"),n(st).addClass("e-virtualrow").css("height",v*g).insertBefore(n(u).children("[name="+o+"]:first")))),o==d&&(nt=k._gridRecordsCount-d-k.model.pageSettings.pageSize,nt>0&&(ht=document.createElement("tr"),n(ht).addClass("e-virtualrow").css("height",v*nt).appendTo(u)));c>0&&(ct=document.createElement("tr"),n(ct).addClass("e-virtualrow").css("height",v*c).prependTo(u));var lt=this.getContent(),b=n(u).children("tr[name="+f+"]")[0],tt=b.previousSibling,at=lt.height(),vt=b.offsetTop;if(this._virtaulUnSel)for(it=n.extend(!0,[],this._virtaulUnSel),i=0;i<it.length;i++){var l=it[i],kt=this.model.pageSettings.currentPage,dt=l%this.model.pageSettings.pageSize==0?parseInt(l/this.model.pageSettings.pageSize):parseInt(l/this.model.pageSettings.pageSize)+1;dt==kt&&(h=l%this.model.pageSettings.pageSize,yt=n(u).find("tr[name="+f+"]").eq(h),yt.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),rt=this._virtaulUnSel.indexOf(l),rt!=-1&&this._virtaulUnSel.splice(rt,1))}(b&&tt&&(this._virIndex||n(tt).hasClass("e-virtualrow")||tt.offsetTop>f*at)&&(this._gridRecordsCount-f>=this.model.pageSettings.pageSize||b.offsetParent.offsetHeight-vt<at)||this._lastRow)&&(this._lastRow&&(this._lastRow=!1),this._virIndex&&(this._virIndex=!1),this._isVirtualRecordsLoaded=!0,lt.find(".e-content").scrollTop(vt),this._scrollValue=this.getContent()[0].firstChild.scrollTop);gt=n(s).get(0);ni=wt.firstChild;this._currentJsonData=y;this._gridRows=n(s).get(0).rows;ut=n(s).find(".e-virtualrow").last();pt=this.model.scrollSettings.virtualScrollMode=="normal"?ut.height()-(n(s).height()-this._gridRecordsCount*v):1;ut.css("height",pt);this._enableCheckSelect&&this._virtualCheckSelection(f);this._eventBindings()},_virtualCheckSelection:function(t){var i=this.getContentTable()[0].tBodies[0];n(i).find("tr[name="+t+"]").find(".e-checkcelldiv input").prop("checked","checked");n(i).find("tr[name="+t+"]").attr("aria-selected","true").find("td").addClass("e-selectionbackground e-active")},_replacingVirtualContent:function(){var f=this.getContentTable()[0],e=this._currentLoadedIndexes,r=n("<tbody><\/tbody>"),s,l,i,u,a,h,c,t;if(this._checkCurrentVirtualView(this._virtualLoadedRows,this._currentVirtualIndex)){for(s=[],t=0;t<e.length;t++)n.merge(s,this._virtualLoadedRows[e[t]]);n(r).append(s)}else for(l=n("<tbody><\/tbody>"),t=0;t<e.length;t++)if(i=e[t],u=this._virtualLoadedRows[i],u)i<this._currentVirtualIndex?(c=r.find(".e-virtualview"+i),c.length?n(u).insertBefore(c):r.prepend(u)):n(u).insertAfter(r.find(".e-virtualview"+(i-1)));else{this._currentVirtualRowIndex=i>0?(i-1)*this._virtualRowCount:0;var l=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](this._virtualLoadedRecords[i])),o=l[0].rows,v=o.length-1;n(o[v]).addClass("e-virtualview"+i);a=i.toString(32);h=n(o).attr("name",a);(h.length==this._virtualRowCount||i==this._totalVirtualViews)&&(this._virtualLoadedRows[i]=h,r.append(o))}if(f.replaceChild(r[0],f.lastChild),n(f.rows).removeClass("e-hover"),this._setVirtualTopBottom(),(this._isThumbScroll||this._remoteRefresh)&&(this._scrollObject._content[0].scrollTop=this._scrollObject.scrollTop(),this._isThumbScroll=this._remoteRefresh=!1),this.model.allowSelection&&this._checkVirtualSelection(),this._gridRows=f.rows,this._currentJsonData=this.model.currentViewData,this._checkCurrentVirtualView(this._queryCellView,this._currentVirtualIndex)||this._eventBindings(),this.model.queryCellInfo||this.model.rowDataBound)for(t=0;t<this._currentLoadedIndexes.length;t++)n.inArray(this._currentLoadedIndexes[t],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[t]);this._trigger("refresh")},_setVirtualTopBottom:function(){var f=this.getContentTable()[0],c=this._vRowHeight,v=t.dataUtil.mergeSort(t.distinct(this._currentLoadedIndexes)),y=t.dataUtil.min(v),e=t.dataUtil.max(v),p=this._getVirtualTotalRecord(),a,l,w,i,u,h,o,r,s;if(this.model.scrollSettings.virtualScrollMode=="continuous"&&this._virtualLoadedRows[e+1]&&(w=Object.keys(this._virtualLoadedRows),l=parseInt(t.dataUtil.max(w),10),e=l-e),a=e*this._virtualRowCount*c,n.inArray(this._totalVirtualViews,this._currentLoadedIndexes)!=-1&&this._currentVirtualIndex!=this._totalVirtualViews&&(a=(p-(this._virtualRowCount-this._lastViewData))*c),i=p*c-a,this.model.scrollSettings.virtualScrollMode!="continuous"||this._virtualLoadedRows[e+1]||(i=l&&l<=e+1?i:1),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),u=1e6,i>0&&this._getVirtualTotalRecord()>this._virtualRowCount*2)if(Math.round(i).toString().length<7)t.buildTag("div.e-virtualbottom","",{height:i}).insertAfter(f);else for(t.buildTag("div.e-virtualbottom").insertAfter(f),o=Math.ceil(i/u),r=0;r<o;r++)s=u,r==o-1&&(s=i%u),n(f).next().append(t.buildTag("div","",{height:s}));if(y>1)if(h=(y-1)*this._virtualRowCount*c,Math.round(h).toString().length<7)t.buildTag("div.e-virtualtop","",{height:h}).insertBefore(f);else for(t.buildTag("div.e-virtualtop").insertBefore(f),o=Math.ceil(h/u),r=0;r<o;r++)s=u,r==o-1&&(s=h%u),n(f).prev().append(t.buildTag("div","",{height:s}));this._scrollObject.model.scrollTop!=this._scrollValue&&this.getContent().ejScroller("model.scrollTop",this._scrollValue)},_checkVirtualSelection:function(){for(var e,i,r,c,h,o,f,s,v,u=this.getContentTable()[0],t=0;t<this.selectedRowsIndexes.length;t++)i=this.selectedRowsIndexes[t],r=this._getSelectedViewData(i).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&(e=i%this._virtualRowCount+this._currentLoadedIndexes.indexOf(r)*this._virtualRowCount,n(u.rows[e].cells).hasClass("e-selectionbackground")||(n(n(u.rows[e]).attr("aria-selected","true")[0].cells).addClass("e-selectionbackground e-active"),this.model.selectedRecords[t]=this._virtualLoadedRecords[r][e%this._virtualRowCount]));for(t=0;t<this._rowIndexesColl.length;t++)if(i=this._rowIndexesColl[t],r=this._getSelectedViewData(i).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&n.inArray(i,this._virtualRowCellSelIndex)==-1||this._virtualDataRefresh)for(c=n.inArray(i,this._rowIndexesColl),h=this.selectedRowCellIndexes[c].cellIndex,o=0;o<h.length;o++)this._selectMultipleCells(i,h[o]);for(f=n(u.rows).find(".e-active, .e-cellselectionbackground").closest("tr"),t=0;t<f.length;t++){var y=parseInt(n(f[t]).attr("name"),32)*this._virtualRowCount,p=this._virtualRowCount-n(f[t]).index()%this._virtualRowCount,l=y-p,a=n(f[t]).index();this.selectedRowsIndexes.length&&n.inArray(l,this.selectedRowsIndexes)==-1&&(this._clearVirtualSelection=!0,this.clearSelection(a));this._rowIndexesColl.length&&n.inArray(l,this._rowIndexesColl)==-1&&n(this.getRowByIndex(a)[0].cells).removeClass("e-cellselectionbackground e-activecell")}for(n(u.rows).find(".e-columnselection").removeClass("e-columnselection"),s=0;s<this.selectedColumnIndexes.length;s++)v=this.selectedColumnIndexes[s]+1,n(u.rows).find("td:nth-of-type("+v+")").addClass("e-columnselection");this._clearVirtualSelection=!1},_refreshPagerTotalRecordsCount:function(){this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._gridRecordsCount:this._searchCount,currentPage:this._currentPage()})},_maxZindex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==r||t==null)&&(t=1),t},_keyPressed:function(i,u,f,e){var s=n(u),g,nt,c,h,y,w,k,tt,a,b,p,d,o,l,v;if(s.hasClass("e-tooltxt")&&f.code==13)return g={currentTarget:u,target:u.firstChild},nt=n(u).closest(".e-gridtoolbar"),nt.ejToolbar("instance")._trigger("click",g),!1;if((!this._allowcellSelection||this._previousRowCellIndex&&this._previousRowCellIndex.length!=0||(this._previousRowCellIndex=[],this._previousRowCellIndex.push([0,[0]])),s.hasClass("e-ddl")&&f.code==13&&n(document.activeElement).parents("td").hasClass("e-templatecell"))||!this.model.allowKeyboardNavigation||u.tagName=="INPUT"&&this.model.keyConfigs[i].indexOf(",")==-1&&f.code!=40&&f.code!=38&&f.code!=13&&f.code!=27&&f.code!=9||String.fromCharCode(f.code).toLowerCase()==this.element[0].accessKey.toLowerCase()||n(u).prop("type")=="checkbox"&&f.code!=13&&f.code!=9&&f.code!=27||this.model.editSettings.editMode=="batch"&&u.tagName=="INPUT"&&f.code!=13&&f.code!=9&&f.code!=27&&(u.selectionStart!=0&&i!="moveCellRight"||u.selectionEnd!=u.value.length&&i!="moveCellLeft")||this.model.allowFiltering&&s.hasClass("e-filtertext")&&f.code==13||s.hasClass("e-fltrbtn")&&f.code==13||(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate")&&n(u).closest("#"+this._id+"EditForm").length||n(u).parent().siblings("#"+this._id+"EditForm").length||f.code==13&&s.parent().hasClass("e-unboundcelldiv"))return!0;if(f.code==13&&u.tagName=="INPUT"&&s.closest("#"+this._id+"_search").length&&(i="searchRequest"),f.code==13&&this._excelFilter!=null&&!t.isNullOrUndefined(this._excelFilter._openedFltr)&&this._excelFilter._openedFltr.length&&this._excelFilter._openedFltr.is(":visible")&&(i="excelfilter"),f.code==13&&n(u).hasClass("e-gridtoolbar")&&(toolbarId=s.find(".e-hover").attr("Id"),i="toolbarOperationRequest"),!this.model.isEdit&&i=="cancelRequest")return this.clearSelection(),this.clearCellSelection(),this.clearColumnSelection(),!0;if(n(u).find("input.e-dropdownlist").attr("aria-expanded")=="true"&&this.model.isEdit&&i=="saveRequest")return!0;if(this.getPager()!=null&&(c=this.getPager().ejPager("model"),h=c.currentPage),y=!1,s=n(u),s.closest(".e-grid").attr("Id")===this._id){switch(i){case"insertRecord":!t.gridFeatures.edit||this.model.isEdit||this.model.editSettings.showAddNewRow||this.model.editSettings.editMode!="normal"||this._toolbarOperation(this._id+"_add");break;case"toolbarOperationRequest":this._toolbarOperation(toolbarId);this.element.focus();break;case"searchRequest":this.search(s.val());break;case"excelfilter":k=this._id+this._excelFilter._$colType;this._excelFilter._openedFltr.hasClass("e-dlgcustom")&&(k+="Custom");this._excelFilter._openedFltr.find("#"+k+"_OkBtn").trigger("click");break;case"saveRequest":t.gridFeatures.edit&&(s.blur(),this.model.editSettings.editMode=="batch"?(tt=n(this.getRowByIndex(this._bulkEditCellDetails.rowIndex)),this.model.isEdit&&tt.hasClass("e-insertedrow")&&this._batchCellValidation(this._bulkEditCellDetails.rowIndex),this._moveCurrentCell("down")):this._toolbarOperation(this._id+"_update"),e.stopPropagation());break;case"cancelRequest":t.gridFeatures.edit&&this._toolbarOperation(this._id+"_cancel");break;case"deleteRecord":t.gridFeatures.edit&&this._toolbarOperation(this._id+"_delete");break;case"editRecord":t.gridFeatures.edit&&(!this.model.isEdit||this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal")&&this._toolbarOperation(this._id+"_edit");break;case"totalGroupCollapse":t.gridFeatures.group&&(this.collapseAll(),this.element.focus());break;case"totalGroupExpand":t.gridFeatures.group&&(this.expandAll(),this.element.focus());break;case"selectedGroupExpand":t.gridFeatures.group&&(this._$currentTr=n(this.getRows()).eq(this._selectedRow()),w=this._$currentTr.parents("tr").first().prev().find(".e-recordpluscollapse"),this.expandCollapse(w));break;case"selectedGroupCollapse":t.gridFeatures.group&&(this._$currentTr=n(this.getRows()).eq(this._selectedRow()),w=this._$currentTr.parents("tr").first().prev().find(".e-recordplusexpand"),this.expandCollapse(w));break;case"firstRowSelection":t.gridFeatures.selection&&this.selectRows(0);break;case"lastRowSelection":t.gridFeatures.selection&&(o=this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])?n(this.getRows()[0]).length-1:n(this._excludeDetailRows()).length-1);this.selectRows(o);break;case"rowUpSelection":this.element.find(".e-row.e-hover,.e-alt_row.e-hover").removeClass("e-hover");a=this._traverseRow!=null?this._traverseRow:this._selectedRow();a>0&&(this._nextRow=a,this._prevRow=a-1,b=n(this.getContent().find("tr.e-traverse")[0]),b.removeClass("e-traverse"),this.getRowByIndex(this._prevRow).addClass("e-traverse"),p=this.getContent().find("tr.e-traverse"),this._traverseRow=this.getIndexByRow(p));break;case"rowDownSelection":this.element.find(".e-row.e-hover,.e-alt_row.e-hover").removeClass("e-hover");a=this._traverseRow!=null?this._traverseRow:this._selectedRow();(a+1<this.model.currentViewData.length||this.model.scrollSettings.allowVirtualScrolling)&&(this._prevRow=a,this._nextRow=a+1,b=n(this.getContent().find("tr.e-traverse")[0]),b.removeClass("e-traverse"),this.getRowByIndex(this._nextRow).addClass("e-traverse"),p=this.getContent().find("tr.e-traverse"),this._traverseRow=this.getIndexByRow(p));break;case"randomSelection":this.element.find(".e-row.e-hover,.e-alt_row.e-hover").removeClass("e-hover");this.model.selectionType=="multiple"&&(this.multiSelectCtrlRequest=!0);p=this.getContent().find("tr.e-traverse");this._traverseRow=this.getIndexByRow(p);this._traverseRow!=-1&&(this.model.selectionSettings.enableToggle&&this.getSelectedRecords().length==1&&n.inArray(this._traverseRow,this.selectedRowsIndexes)!=-1?this.clearSelection(selectedIndex):this.selectRows(this._traverseRow));this.getRowByIndex(a).removeClass("e-traverse");this.multiSelectCtrlRequest=!1;break;case"upArrow":if(this.multiSelectCtrlRequest=!1,this._traverseRow=null,this.model.isEdit&&s.hasClass("e-ddl"))break;if(t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=r)&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;this._selectedRow()>0&&(this._enableCheckSelect||this.selectRows(this._selectedRow()-1),this.model.editSettings.editMode!="batch"||this.model.scrollSettings.enableVirtualization||this._moveCurrentCell("up"));this._previousRowCellIndex&&this._previousRowCellIndex.length!=0&&this._previousRowCellIndex[0][0]!=0&&this._allowcellSelection&&(this.selectCells([[this._previousRowCellIndex[0][0]-1,this._previousRowCellIndex[0][1]]]),this.model.editSettings.editMode=="batch"&&this._moveCurrentCell("down"))}break;case"downArrow":if(this.multiSelectCtrlRequest=!1,this._traverseRow=null,this.model.isEdit&&s.hasClass("e-ddl"))break;if(t.gridFeatures.selection&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;this._selectedRow()==-1&&(this.model.selectedRowIndex=0);o=this._excludeDetailRows().length-1;this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])&&(o=this.getRows()[0].length-1);this._selectedRow()!=o&&this._selectedRow()!=-1&&(this._enableCheckSelect||this.selectRows(this._selectedRow()+1),this.model.editSettings.editMode!="batch"||this.model.scrollSettings.enableVirtualization||this._moveCurrentCell("down"));this._previousRowCellIndex&&this._previousRowCellIndex.length!=0&&this._previousRowCellIndex[0][0]!=o&&this._allowcellSelection&&(this.selectCells([[this._previousRowCellIndex[0][0]+1,this._previousRowCellIndex[0][1]]]),this.model.editSettings.editMode=="batch"&&this._moveCurrentCell("down"))}break;case"rightArrow":if(t.gridFeatures.selection&&this._allowcellSelection&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;o=n(this.getRows()).length-1;this._previousRowCellIndex&&this._previousRowCellIndex[0][1]==this.model.columns.length-1&&this._previousRowCellIndex[0][0]!=o?this.selectCells([[this._previousRowCellIndex[0][0]+1,[0]]]):this._previousRowCellIndex&&this._previousRowCellIndex[0][1]!=this.model.columns.length-1&&this.selectCells([[this._previousRowCellIndex[0][0],[parseInt(this._previousRowCellIndex[0][1])+1]]])}break;case"leftArrow":if(t.gridFeatures.selection&&this._allowcellSelection&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;this._previousRowCellIndex&&this._previousRowCellIndex[0][1]==0&&this._previousRowCellIndex[0][0]!=0?this.selectCells([[this._previousRowCellIndex[0][0]-1,[this.model.columns.length-1]]]):this._previousRowCellIndex&&this._previousRowCellIndex[0][1]!=0&&this.selectCells([[this._previousRowCellIndex[0][0],[parseInt(this._previousRowCellIndex[0][1])-1]]])}break;case"firstCellSelection":if(t.gridFeatures.selection&&this._allowcellSelection){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;o=n(this.getRows()).length-1;o>-1&&this.selectCells([[0,[0]]])}break;case"lastCellSelection":if(t.gridFeatures.selection&&this._allowcellSelection){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;o=this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])?this.getRows()[0].length-1:n(this._excludeDetailRows()).length-1;o>-1&&this.selectCells([[o,[this.model.columns.length-1]]])}break;case"nextPage":this.getPager()!=null&&(h=h+1);t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||this.element.focus();break;case"previousPage":this.getPager()!=null&&(h=h-1);t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||this.element.focus();break;case"lastPage":this.getPager()!=null&&(h=c.totalPages);break;case"firstPage":this.getPager()!=null&&(h=1);break;case"nextPager":this.getPager()!=null&&(h=Math.ceil(c.currentPage/c.pageCount)*c.pageCount+1);break;case"previousPager":this.getPager()!=null&&(h=(Math.floor(c.currentPage/c.pageCount)-1)*c.pageCount+1);break;case"moveCellLeft":this.model.editSettings.editMode=="batch"?(this._tabKey=!0,y=this._moveCurrentCell("left")):y=!0;break;case"moveCellRight":this.model.editSettings.editMode=="batch"&&s?(this._tabKey=!0,y=this._moveCurrentCell("right")):y=!0;break;case"multiSelectionByDownArrow":t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=r)&&(o=this._excludeDetailRows().length-1,s=this.element.find(".e-gridcontent").find(".e-rowcell"),this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])&&(o=this.getRows()[0].length-1),this._selectedRow()<=o&&this._selectedRow()!=-1&&(l=this._selectedRow()+1,v=this._previousIndex,this.selectRows(v,l,s),l-1==o&&(this.selectRows(v,o),l=o)),this._selectedRow(l),this._previousIndex=v);this.model.editSettings.editMode=="batch"&&this.element.focus();break;case"multiSelectionByUpArrow":d=0;t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=r)&&(o=this._excludeDetailRows().length-1,s=this.element.find(".e-gridcontent").find(".e-rowcell"),this._selectedRow()>=0&&this._selectedRow()>=-1&&(l=this._selectedRow()-1,v=this._previousIndex,this.selectRows(v,l,s),l<0&&(this.selectRows(v,d),l=d)),this._selectedRow(l),this._previousIndex=v);this.model.editSettings.editMode=="batch"&&this.element.focus();break;default:y=!0}return this.getPager()!=null&&h<=c.totalPages&&c.currentPage!==h&&i!="searchRequest"&&i!=="deleteRecord"&&this.getPager().ejPager("goToPage",h),y}},_findColumnsWidth:function(){for(var t=this.getHeaderTable().find(".e-headercell").not(".e-stackedHeaderCell, .e-detailheadercell"),n=0;n<this.model.columns.length;n++)this.model.columns[n].visible&&(this.columnsWidthCollection[n]=t.eq(n+0).outerWidth())},_calculateWidth:function(){for(var t=this.getHeaderTable().find(".e-columnheader").last().find("th:visible"),i=0,n=0;n<t.length;n++)i+=t.eq(n).outerWidth();return i},_initIndicators:function(){var t=this._id+"_ColumnDropIndicator";n("#"+t).length&&n("#"+t).remove();this._Indicator=document.createElement("DIV");n(this._Indicator).attr("id",t).addClass("e-columndropindicator").addClass("e-dropAcceptor").appendTo(document.body);n(this._Indicator).css({display:"none"})},_refreshGridFooterColGroup:function(){this.getFooterTable().find("colgroup").remove();this.model.scrollSettings.frozenColumns>0?(this.getFooterTable().eq(0).append(this.getHeaderTable().eq(0).find("colgroup").clone()),this.getFooterTable().eq(1).append(this.getHeaderTable().eq(1).find("colgroup").clone())):this.getFooterTable().append(this.getHeaderTable().find("colgroup").clone())},_refreshGroupSummary:function(){var r=this.getHeaderContent().find("colgroup col").clone(),i,t;for(r.splice(0,this.model.groupSettings.groupedColumns.length),i=this.getContentTable().find(".e-groupsummary colgroup"),t=0;t<i.length;t++)n(i[t]).find(".e-summary").is("visible")||n(i[t]).find(".e-summary").show(),n(i[t]).find("col:not('.e-summary')").remove(),n(i[t]).append(r.clone())},reorderColumns:function(n,t){var i,r;(typeof n=="string"&&typeof t=="string"?(i=this.getColumnIndexByField(n),r=this.getColumnIndexByField(t)):(i=n,r=t),i!=-1&&r!=-1&&typeof i!="string"&&typeof r!="string")&&(this.set_dropColumn(i,r),this.model.showStackedHeader&&this._refreshStackedHeader(),this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization?(this._virtualDataRefresh=!0,this._queryCellView=[],this._virtualLoadedRows={},this._refreshVirtualView(this._currentVirtualIndex)):this._refreshVirtualContent()))},columns:function(r,u){var f,e,s,o,h;if(!t.isNullOrUndefined(r)){for(f=!1,typeof r=="string"?(r=[r],f=!0):r instanceof Array&&r.length&&typeof r[0]=="string"&&(f=!0),i=0;i<r.length;i++)e=f?r[i]:r[i].field,s=f?r[i]:r[i].headerText,o=(t.isNullOrUndefined(e)||e=="")&&(t.isNullOrUndefined(s)||s=="")?-1:t.isNullOrUndefined(e)||e==""?n.inArray(this.getColumnByHeaderText(s),this.model.columns):n.inArray(this.getColumnByField(e),this.model.columns),u=="add"||t.isNullOrUndefined(u)?o==-1?this.model.columns.push(f?{field:r[i]}:r[i]):this.model.columns[o]=f?{field:r[i]}:r[i]:o!=-1&&this.model.columns.splice(o,1);for(this.columnsWidthCollection=[],tooltip=!1,h=0;h<this.model.columns.length;h++)this.columnsWidthCollection.push(this.model.columns[h].width),t.isNullOrUndefined(tooltip)||(tooltip=!0);this._enableRowHover(tooltip);this.refreshHeader();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.refreshContent(!0);this.model.allowScrolling&&(this.refreshScrollerEvent(),this.model.allowResizeToFit&&this.getContent().ejScroller("isVScroll")&&this._showHideScroller())}},_enableRowHover:function(n){var r=!0,i;if(t.isNullOrUndefined(n)){for(i=0;i<this.model.columns.length;i++)if(!t.isNullOrUndefined(this.model.columns[i].tooltip)){r=!0;break}}else r=n;this.model.enableRowHover||r?this._on(this.element,"mouseenter mouseleave",".e-gridcontent tr td",this._rowHover):this._off(this.element,"mouseenter mouseleave",".e-gridcontent tr td")},_rowHover:function(i){var r=n(i.target),u,f,e,o,s;if(r.hasClass("e-rowcell")||(r=r.closest(".e-rowcell")),u=this.model.scrollSettings.frozenColumns?n(this.getRows()):this.element.find(".e-row.e-hover,.e-alt_row.e-hover"),(!r.closest("#"+this._id+"EditForm").length||!r.hasClass("e-rowcell"))&&r.hasClass("e-rowcell"))return i.type=="mouseenter"&&r.hasClass("e-gridtooltip")&&this._showTooltip(r),this.model.enableRowHover&&(this.element.find(".e-traverse").removeClass("e-traverse"),this._traverseRow=null,i.type!="mouseenter"||this._dragActive?(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(u[0])&&!t.isNullOrUndefined(u[1])&&(u=n(u[0]).add(u[1])),u.removeClass("e-hover")):this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(u[0])&&!t.isNullOrUndefined(u[1])?(u=n(u[0]).add(u[1]),u.removeClass("e-hover"),f=this.getIndexByRow(r.parent()),f!=-1&&this.getRowByIndex(f).addClass("e-hover")):(u.removeClass("e-hover"),(r.parent().hasClass("e-row")||r.parent().hasClass("e-alt_row"))&&r.parent().addClass("e-hover")),gridRows=r.parent(),f=this.getIndexByRow(gridRows),e=this._currentJsonData[f],this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization?(f=f%this.model.pageSettings.pageSize,e=this._currentJsonData[f]):this.model.scrollSettings.enableVirtualization&&(o=this._getSelectedViewData(f,r),e=o.data,f=o.rowIndex),s={row:gridRows,rowIndex:f,rowData:e,cell:r},this._trigger("rowHover",s)),!1},_showTooltip:function(i,r){var u=i.index(),a=i.hasClass("e-stackedHeaderCell"),c={},f,s,v,e,h,o,l,y,p;if(i.hasClass("e-headercelldiv")&&(u=i.parent(".e-headercell").index()-this.model.groupSettings.groupedColumns.length),!a&&(this.model.childGrid||this.model.detailsTemplate)&&u--,this.model.scrollSettings.frozenColumns>0&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(u=u+this.model.scrollSettings.frozenColumns),f=a?this._getStackedColumnByTarget(i):this.getColumnByIndex(u),f.clipMode!=t.Grid.ClipMode.Ellipsis){if(f.clipMode==t.Grid.ClipMode.EllipsisWithTooltip&&(s=i,i.find("span").hasClass("e-ellipsistooltip")||($span=t.buildTag("span.e-ellipsistooltip",{},{}),$span.html(i.html()),s.append($span)),s.find("span.e-ellipsistoottip").css("display","inline-block"),v=s.find("span:first")[0].getBoundingClientRect().width,s.find("span.e-ellipsistooltip").remove(),i.width()>v)){i.removeAttr("title");return}if(e=document.createElement("script"),t.isNullOrUndefined(f.tooltip)&&t.isNullOrUndefined(f.headerTooltip))return;e.id=(this._id+f.headerText+n.inArray(f,this.model.columns)+"_TemplateToolTip").split(" ").join("");e.type="text/x-template";o=r?"headerTooltip":"tooltip";t.isNullOrUndefined(f[o])||f[o].slice(0,1)==="#"?h=n(f[o]):e.text=f[o];h&&(e.text=h.html(),e.type=h.attr("type")||e.type);t.isNullOrUndefined(h)||f[o].slice(0,1)==="#"||n("body").append(e);l=i.closest("tr");n(l).hasClass("e-columnheader")||i.hasClass("e-gridheader")||(u=this.getIndexByRow(l),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling?this.model.scrollSettings.enableVirtualization?(y=l.attr("name"),u=u%this._virtualRowCount,virtualIndex=parseInt(y,32),c=this._virtualLoadedRecords[virtualIndex][u]):u=u%this.model.pageSettings.pageSize:c=this.getCurrentViewData()[u]);c.value=!i.hasClass("e-headercell")||a?i.text():i.find("e-gridheadertooltip").text();p=n(e).render(c);i.attr("title",p)}else i.removeAttr("title")},_rightClickHandler:function(i){var f,u,e,r;if(i.preventDefault(),f=t.browserInfo(),i.which==3||f.name=="msie"&&f.version=="8.0"){if(u={},$target=n(i.target),$gridRow=n(this.getRows()),this.getContentTable().has($target).length){var r=$gridRow.index($target.parent()),s=this.getRowByIndex(r),o=this._currentJsonData[r];if(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(e=this._getSelectedViewData(r,$target),o=e.data,r=e.rowIndex),r==-1)return;u={rowIndex:r,row:s,data:o,cellIndex:$target.index(),cellValue:$target.html(),cell:$target}}else if(this.getHeaderTable().has($target).length){if(r=0,$th=this.getHeaderTable().find("th").not(".e-detailheadercell,.e-grouptopleftcell,.e-filterbarcell"),r=$target.is(".e-headercelldiv")?$th.index($target.closest(".e-headercell")):$th.index($target),r==-1)return;u={headerIndex:r,headerText:this.getColumnFieldNames()[r],headerCell:$th.eq(r),column:this.getColumnByIndex(r)}}else($target.is(".e-pager")||this.getPager()!=null&&this.getPager().has($target).length)&&(u={pager:this.model.pageSettings});this._trigger("rightClick",u)}},_touchGrid:function(n){var i=this._currentPage(),r=!0,t;(this.model.allowScrolling||this.model.isResponsive&&this.model.minWidth!=0)&&(t=(this.getScrollObject()||{})._scrollXdata,t&&(r=n.type=="swipeleft"?t.scrollable-t.sTop==0:t.sTop==0));switch(n.type){case"swipeleft":this.model.allowPaging&&i!=this.model.pageSettings.totalPages&&!this.model.isEdit&&r&&this.element.ejGrid("gotoPage",i+1);break;case"swiperight":this.model.allowPaging&&i>1&&!this.model.isEdit&&r&&this.element.ejGrid("gotoPage",i-1)}},_recorddblClickHandler:function(n){this._recordClickProcess(n,this,"recordDoubleClick")},_recordClickProcess:function(t,i,r){var c={},u=n(t.target).is(".e-rowcell")?n(t.target):n(t.target).closest("td"),o,e,h,a,v;if(u.closest(".e-grid").attr("id")===i._id&&(u.is(".e-rowcell")||u.closest("td").is(".e-rowcell"))&&!(u.closest(".e-editcell,.e-insertedrow").length>0)&&(o=i.model.detailsTemplate!=null||i.model.childGrid!=null?u.index()-1:u.index(),e=i.getColumnByIndex(o),i.model.editSettings.editMode!="batch"||e.allowEditing==!1||e.isPrimaryKey==!0)){var f=i.getIndexByRow(u.closest("tr")),l=i.getRowByIndex(f),s=i._currentJsonData[f];i.model.scrollSettings.allowVirtualScrolling&&(i.model.scrollSettings.enableVirtualization?(h=i._getSelectedViewData(f,u),s=h.data,f=h.rowIndex):(a=f%i.model.pageSettings.pageSize,v=(parseFloat(l.attr("name"))-(this.model.scrollSettings.enableVirtualization?1:0))/i.model.pageSettings.pageSize+1,s=i._virtualLoadedRecords[v][a]));c={rowIndex:f,row:l,data:s,cell:u,cellIndex:o,columnName:e.headerText,cellValue:u.text()};i._trigger(r,c)}},_invokeRecordClick:function(n,t){this._recordClickProcess(n,t,"recordClick")},_recordClick:function(i){this._click++;var r=this,u=null;r._click==1?n.inArray("recordClick",this.model.serverEvents)!==-1&&n.inArray("recordDoubleClick",this.model.serverEvents)!==-1?u=setTimeout(function(){r._click=0;r._invokeRecordClick(i,r)},400):(r._click=0,t.isNullOrUndefined(u)||clearTimeout(u),r._invokeRecordClick(i,r)):r._click==2&&(t.isNullOrUndefined(u)||clearTimeout(u),r._click=0)},_headerMouseDown:function(t){if(n(t.target).hasClass("e-headercelldiv")&&!n(t.target).parent().hasClass("e-grouptopleftcell")||n(t.target).hasClass("e-headercell")){var i=n(t.target).hasClass("e-headercelldiv")?n(t.target).parent():n(t.target);this.model.enableHeaderHover&&i.removeClass("e-hover e-headercell-hover").addClass("e-headercellactive e-active")}if(this.model.allowResizing)return this._resizer._mouseDown(t)},_contentMouseDown:function(i){var u,f,r;n(i.target).closest("td").hasClass("e-selectionbackground")||n(i.target).closest("tr").length&&(u=i.type=="touchstart"?i.originalEvent.touches[0].pageX:i.pageX,f=i.type=="touchstart"?i.originalEvent.touches[0].pageY:i.pageY,this._dragDiv=t.buildTag("div.e-griddragarea","",{position:"absolute",width:"0px",height:"0px"}),this.getContent().append(this._dragDiv),r=n(i.target).closest("tr.e-row"),r.length||(r=n(i.target).closest("tr.e-alt_row")),this._startIndex=r.length?this.getIndexByRow(r):null,this._on(n(document),"touchmove mousemove",this._mouseMoveDragHandler),t.isIOSWebView()||this.getBrowserDetails().browser!="safari"||this.model.contextMenuSettings.enableContextMenu||this._on(this.element,"contextmenu",function(n){n.preventDefault()}),this._on(n(document),"touchend mouseup",this._mouseUpDragHandler),this._startDrag={_x:u,_y:f})},_mouseMoveDragHandler:function(i){var c,e,v,l,f;if(i.pageY!=this._startDrag._y){c=i.type=="touchmove"?i.originalEvent.touches[0].pageX:i.pageX;e=i.type=="touchmove"?i.originalEvent.touches[0].pageY:i.pageY;this._selectDrag=!0;var y=this._dragDiv[0].offsetLeft,p=this._dragDiv[0].offsetTop,r=this._startDrag._x,u=this._startDrag._y,o=c,s=e,h,a=e+2;r>o&&(h=o,o=r,r=h);u>s&&(h=s,s=u,u=h,a=e-2);v=this._dragDiv.height();this._dragDiv.css({left:r,top:u,width:o-r,height:s-u});l=n(document.elementFromPoint(c,a));f=l.closest("tr.e-row");f.length||(f=l.closest("tr.e-alt_row"));f.length&&(this._endIndex=this.getIndexByRow(f),t.isNullOrUndefined(this._startIndex)&&(this._startIndex=this._endIndex),this.selectRows(this._startIndex,this._endIndex))}},_mouseUpDragHandler:function(i){this._off(n(document),"touchend mouseup",this._mouseUpDragHandler);this._off(n(document),"touchmove mousemove",this._mouseMoveDragHandler);t.isIOSWebView()||this.getBrowserDetails().browser!="safari"||this.model.contextMenuSettings.enableContextMenu||this._off(this.element,"contextmenu",function(n){n.preventDefault()});i.stopPropagation();this._selectDrag=!1;this._dragDiv.remove()},_headerHover:function(t){var i=n(t.target);t.type=="mouseover"||t.type=="mousemove"||t.type=="touchmove"||t.type=="MSPointerMove"?((this.model.allowResizing||this.model.allowResizeToFit)&&this._resizer._mouseHover(t),this.model.enableHeaderHover&&!this._dragActive&&(i.hasClass("e-headercelldiv")&&!i.parent().hasClass("e-grouptopleftcell")||i.hasClass("e-headercell"))&&(i.hasClass("e-headercelldiv")&&(i=i.parent()),this.getHeaderTable().find(".e-columnheader").find(".e-headercell-hover").removeClass("e-headercell-hover").removeClass("e-hover"),i.addClass("e-headercell-hover e-hover")),i.hasClass("e-gridtooltip")&&this._showTooltip(i),(i.hasClass("e-gridheadertooltip")||i.find(".e-gridheadertooltip").length)&&this._showTooltip(i,!0),t.type=="mouseover"&&this._addCursor()):this.model.enableHeaderHover&&this.getHeaderTable().find(".e-columnheader").find(".e-headercell-hover").removeClass("e-headercell-hover").removeClass("e-hover")},_addCursor:function(){var u=this.model.allowResizing||this.model.allowResizeToFit||this.model.allowGrouping||this.model.allowFiltering||this.model.allowSorting||this.model.allowReordering||this.model.contextMenuSettings.enableContextMenu||this._allowcolumnSelection,i,r,n;if(u){if(this.getHeaderTable().find(".e-columnheader").removeClass("e-defaultcursor"),!(this.model.contextMenuSettings.enableContextMenu||this.model.selectionSettings.selectionMode=="column")){for(i=[{val:this.model.allowSorting,str:"sort"},{val:this.model.allowGrouping,str:"group"},{val:this.model.allowReordering,str:"reorder"},{val:this.model.allowFiltering,str:"filter"}],r=0,n=0;n<i.length;n++)i[n].val==!1&&(i.splice(n,1),n--);for(n=0;n<this.model.columns.length&&i.length>0;n++){for(j=0;j<i.length;j++)switch(i[j].str){case"sort":t.isNullOrUndefined(this.model.columns[n].allowSorting)||this.model.columns[n].allowSorting||r++;break;case"group":t.isNullOrUndefined(this.model.columns[n].allowGrouping)||this.model.columns[n].allowGrouping||r++;break;case"reorder":t.isNullOrUndefined(this.model.columns[n].allowReordering)||this.model.columns[n].allowReordering||r++;break;case"filter":t.isNullOrUndefined(this.model.columns[n].allowFiltering)||this.model.columns[n].allowFiltering||r++}isTempCol=t.isNullOrUndefined(this.model.columns[n].template)&&t.isNullOrUndefined(this.model.columns[n].templateID)?!1:!0;r!=i.length||isTempCol||this.getHeaderTable().find(".e-headercell").eq(n).addClass("e-defaultcursor");r=0}}}else this.getHeaderTable().find(".e-columnheader").addClass("e-defaultcursor"),this.getHeaderTable().find(".e-headercell").removeClass("e-defaultcursor")},_colgroupRefresh:function(){var t,i,r,u;(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(t=n(this.getHeaderTable()).find("colgroup"),i=n(this.getContentTable()).find("colgroup")):(t=n(this.getHeaderTable()).find("colgroup")[0],i=n(this.getContentTable()).find("colgroup")[0]);r=n(t).clone();u=n(i).clone();n(i).remove();n(t).remove();(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(n(r[0]).prependTo(this.getHeaderTable()[0]),n(r[1]).prependTo(this.getHeaderTable()[1]),n(u[0]).prependTo(this.getContentTable()[0]),n(u[1]).prependTo(this.getContentTable()[1])):(n(r).prependTo(this.getHeaderTable()),n(u).prependTo(this.getContentTable()))},_detailColsRefresh:function(){this._$headerCols=this.getHeaderTable().children("colgroup").find("col");this._$contentCols=this.getContentTable().children("colgroup").find("col");var n=this.model.columns.length;this._$headerCols.length>n&&this._$headerCols.splice(0,this._$headerCols.length-n);this._$contentCols.length>n&&this._$contentCols.splice(0,this._$contentCols.length-n)},_summaryColRrefresh:function(){for(var t=this.getFooterContent().find(".e-gridsummary"),n=0;n<this.columnsWidthCollection.length;n++)t.find("col").eq(n).width(this.columnsWidthCollection[n])},_headerdblClickHandler:function(n){this.model.allowResizeToFit&&this._resizer._columnResizeToFit(n);this.model.allowScrolling&&this.getScrollObject().refresh(this.model.scrollSettings.frozenColumns>0)},_mouseUp:function(n){this.model.allowResizing&&this._resizer._mouseUp(n)},_mouseMove:function(n){this.model.allowResizing&&this._resizer._mouseMove(n)},_setModel:function(i){var u,y,p,tt,w,s,h,it,rt,ut,l,b,a,k,ft,e,et,f,c,v,ot,o,nt;for(u in i)switch(u){case"enableResponsiveRow":i[u]?(this.element.addClass("e-responsive"),this.model.minWidth&&(this._removeMedia(),this._scrollerAddedOnMedia=!1),this.model.allowFiltering&&(this.element.find(".e-filterDialoge").remove(),this._renderFilterDialogs(),this._renderResponsiveFilter(),this.element.find(".e-gridtoolbar").remove())):(this.model.allowFiltering&&(n("body").find(".e-filterDialoge").remove(),this._renderFilterDialogs()),this.element.css("display")=="none"&&this.element.css("display","block"),this.element.removeClass("e-responsive"),this.model.minWidth&&this._addMedia(),this.model.allowScrolling&&(this.getScrollObject().refresh(),this.getScrollObject().isVScroll()?this.getScrollObject().isVScroll()&&(this.getHeaderContent().addClass("e-scrollcss"),this.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):(this.getHeaderContent().removeClass("e-scrollcss"),this.getHeaderContent().find(".e-headercontent").removeClass("e-hscrollcss"))));this._tdsOffsetWidth=[];(this.model.allowFiltering||this.model.allowSorting)&&(y=this.model.toolbarSettings.toolbarItems.indexOf("responsiveFilter"),y!=-1&&this.model.toolbarSettings.toolbarItems.splice(y,1),p=this.model.toolbarSettings.toolbarItems.indexOf("responsiveSorting"),p!=-1&&this.model.toolbarSettings.toolbarItems.splice(p,1),this.element.find(".e-gridtoolbar").remove(),this._renderToolBar().insertBefore(this.element.find(".e-gridheader").first()));break;case"showColumnChooser":i[u]?(this._visibleColumns=[],this._hiddenColumns=[],this._visibleColumnsField=[],this._hiddenColumnsField=[],this._renderGridHeaderInternalDesign(this.model.columns),this._renderColumnChooser()):(tt=n("#"+this._id+"ccDiv").data("ejDialog"),tt.isOpened()&&n("#"+this._id+"_ccTail").remove(),w=0,t.isNullOrUndefined(this.element.find(".e-ccButton").outerHeight())||(w+=this.element.find(".e-ccButton").outerHeight()),this.element.find(".e-ccButton").remove(),n("#"+this._id+"ccDiv_wrapper").remove(),this.element.css("margin-top",parseInt(this.element.css("margin-top"),10)-w));break;case"gridLines":this.getContent().removeClass("e-horizontallines e-verticallines e-hidelines");this.getHeaderContent().removeClass("e-horizontallines e-verticallines e-hidelines");this._showHeaderGridLines();this._showGridLines();break;case"showDeleteConfirmDialog":this.model.editSettings.showDeleteConfirmDialog=i[u];i[u]?this._renderConfirmDialog():this.element.find("#"+this._id+"ConfirmDialog_wrapper").remove();break;case"showConfirmDialog":this.model.editSettings.showConfirmDialog=i[u];i[u]?this._renderConfirmDialog():this.element.find("#"+this._id+"ConfirmDialog_wrapper").remove();break;case"pageSettings":if(s=this.getPager().ejPager("model"),t.isNullOrUndefined(i[u].currentPage)||s.currentPage!=this._currentPage()){for(h in i[u])h!="currentPage"&&i[u][h]===s[h]&&delete i[u][h];if(n.isEmptyObject(i[u]))break;i[u].currentPage=this._currentPage();this.getPager().ejPager("option",i[u]);this._renderPagerTemplate(this.getPager(),i[u].showDefaults);this._currentPage(this._currentPage()>s.totalPages?s.totalPages:this._currentPage());this.refreshContent()}break;case"columns":it=i.columns;this.model.columns=[];this.columns(it,"add");break;case"allowPaging":this.model.allowPaging=i[u];i[u]&&this.element.children(".e-pager").length==0?(this.element.append(this._renderGridPager()),this.refreshContent(),this.getPager().ejPager("refreshPager")):(this.getPager().remove(),this.setGridPager(null),this.refreshContent(),this.model.filterSettings.filterType=="filterbar"&&this.model.allowFiltering&&this._createPagerStatusBar());break;case"allowSearching":this.model.allowSearching=i[u];break;case"searchSettings":n.extend(this.model.searchSetings,i[u]);this.refreshContent();break;case"allowGrouping":i[u]&&this.element.children(".e-groupdroparea").length==0?(this.model.allowGrouping=i[u],this.addGroupingTemplate(),this.model.showColumnChooser&&this.element.find(".e-ccButton").length>0?this.element.find(".e-ccButton").after(this._renderGroupDropArea()):this.element.prepend(this._renderGroupDropArea()),this._enableGroupingEvents(),this._headerCellgDragDrop(),this._off(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",this._dropAreaHover),this._on(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",this._dropAreaHover)):this.element.children(".e-groupdroparea").remove();this.model.allowGrouping&&(t.isNullOrUndefined(i.groupSettings)||n.extend(this.model.groupSettings,i.groupSettings),this._enableGrouping());break;case"groupSettings":n.extend(this.model.groupSettings,i[u]);this.model.allowGrouping&&t.isNullOrUndefined(i.allowGrouping)&&this._enableGrouping();t.isNullOrUndefined(this.model.groupSettings.enableDropAreaAnimation)||(this.model.groupSettings.enableDropAreaAutoSizing=this.model.groupSettings.enableDropAreaAnimation);break;case"cssClass":this.element.removeClass(this.model.cssClass).addClass(i[u]);break;case"allowFiltering":case"filterSettings":if(u=="filterSettings"?n.extend(this.model.filterSettings,i[u]):this.model.allowFiltering=i[u],this.filterColumnCollection=[],this._$fDlgIsOpen&&this._closeFDialog(),this.model.allowFiltering){if(this.model.filterSettings.filterType==t.Grid.FilterType.FilterBar)for(this.getHeaderTable().find(".e-filterbar").remove(),this.getHeaderTable().find(".e-columnheader").find(".e-filtericon").remove().end().find(".e-headercellfilter").removeClass("e-headercellfilter"),this._renderFiltering(),this._renderFilterBarTemplate(),this.model.filterSettings.showFilterBarStatus&&!this.model.allowPaging?this._createPagerStatusBar():this.model.allowPaging&&this.getPager().ejPager({enableExternalMessage:this.model.filterSettings.showFilterBarStatus}),rt=this.getHeaderTable().find(".e-filterbar"),f=0;f<this.model.groupSettings.groupedColumns.length;f++)rt.prepend(this._getEmptyFilterBarCell());else if(!ut&&(this.model.filterSettings.filterType==t.Grid.FilterType.Menu||this.model.filterSettings.filterType==t.Grid.FilterType.Excel)){for(ut=1,this.getHeaderTable().find(".e-columnheader").find(".e-filtericon").remove().end().find(".e-headercellfilter").removeClass("e-headercellfilter"),this.getHeaderTable().find(".e-filterbar").remove(),l=this.getHeaderTable().find(".e-columnheader").find(".e-headercell").not(".e-detailheadercell"),f=0;f<l.length;f++)b=l.eq(f).find(".e-headercelldiv").attr("ej-mappingname"),t.isNullOrUndefined(b)||(a=this.getColumnByField(b),!t.isNullOrUndefined(a)&&(t.isNullOrUndefined(a.allowFiltering)||a.allowFiltering)&&l.eq(f).addClass("e-headercellfilter").append(t.buildTag("div.e-filtericon e-icon e-filterset")));this.model.filterSettings.filterType==t.Grid.FilterType.Excel?(this._isExcelFilter=!0,this._renderExcelFilter()):this._isExcelFilter&&(this._isExcelFilter=!1,this._excelFilter.resetExcelFilter(),this._excelFilter=null);this.model.filterSettings.filterType==t.Grid.FilterType.Menu&&this._renderFilterDialogs();this.model.filterSettings.filteredColumns=[];this.refreshContent()}this._enableFilterEvents()}else this.model.filterSettings.filterType==t.Grid.FilterType.FilterBar?this.getHeaderTable().find(".e-filterbar").remove():(this.model.filterSettings.filterType==t.Grid.FilterType.Menu||this.model.filterSettings.filterType==t.Grid.FilterType.Excel)&&this.getHeaderTable().find(".e-columnheader").find(".e-filtericon").remove().end().find(".e-headercellfilter").removeClass("e-headercellfilter"),(this._isExcelFilter||this._excelFilterRendered)&&(this._isExcelFilter=this._excelFilterRendered=!1,this._excelFilter.resetExcelFilter(),this._excelFilter=null),this.model.filterSettings.filteredColumns=[],this.refreshContent();this.model.isResponsive&&this.model.allowScrolling&&(k={},k.requestType="filtering",this._refreshScroller(k));break;case"enableRowHover":this.model.enableRowHover=i[u];this._enableRowHover();break;case"allowScrolling":case"scrollSettings":if(e=this.getContent(),u!="allowScrolling"){if(!t.util.isNullOrUndefined(i.scrollSettings)){if(n.isEmptyObject(i.scrollSettings))break;t.util.isNullOrUndefined(i.scrollSettings.enableVirtualization)||t.util.isNullOrUndefined(i.scrollSettings.allowVirtualScrolling)||(i.scrollSettings.allowVirtualScrolling=i.scrollSettings.enableVirtualization);n.extend(this.model.scrollSettings,i.scrollSettings)}this._initHeight=this.model.scrollSettings.height;this._isHeightResponsive=this.model.scrollSettings.height=="100%"?!0:!1;this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this.model.currentIndex=1,this.model.scrollSettings.enableVirtualization?(this._virtualRowCount=Math.round(this.model.scrollSettings.height/this.getRowHeight())+1,this._refreshVirtualViewDetails(),this._refreshVirtualViewData()):(this._createPagerStatusBar(),this._showPagerInformation(this.model.pageSettings)));i.scrollSettings.frozenColumns!==r||i.scrollSettings.frozenRows!==r||i.scrollSettings.allowVirtualScrolling!==r||i.scrollSettings.virtualScrollMode!==r||i.scrollSettings.enableVirtualization!=r?(o=this.model,o.query=this.commonQuery.clone(),this._selectedRow()!=-1&&this.clearSelection(this._selectedRow()),i.scrollSettings.virtualScrollMode!=r&&(o.pageSettings.currentPage=1),this.element.ejGrid("destroy").ejGrid(o)):(t.util.isNullOrUndefined(i.allowScrolling)||(this.model.allowScrolling=i.allowScrolling),t.util.isNullOrUndefined(e.data("ejScroller"))||e.ejScroller("destroy"),this.model.allowScrolling?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this._originalScrollWidth=this.model.scrollSettings.width,this._renderScroller(),this.setWidthToColumns(),t.util.isNullOrUndefined(e.data("ejScroller"))||this.getScrollObject().refresh(),this.refreshScrollerEvent()):(this.element.children(".e-gridheader").removeClass("e-scrollcss"),this.element.get(0).style.width.length==0&&this.element.css("width","auto"),this.setWidthToColumns()),this._addLastRow())}break;case"currentIndex":this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization?(ft=Math.ceil(i.currentIndex/this._virtualRowCount),this._isThumbScroll=!0,this._refreshVirtualView(ft),this._refreshVirtualViewScroller(!0)):this._scrollObject.option("scrollTop",i.currentIndex*this.getRowHeight());break;case"locale":this.model.locale=i[u];this.model.query=this.commonQuery.clone();this._destroy();this.element.css("margin-top","0px").addClass("e-grid"+this.model.cssClass);this._init();break;case"dataSource":for(e=this.element.find(".e-gridcontent").first(),n.isFunction(i.dataSource)||this.resetModelCollections(),this._gridRecordsCount==1&&!t.isNullOrUndefined(this._cDeleteData)&&n.inArray(this._cDeleteData[0],this._dataSource())==-1&&this.model.editSettings.allowDeleting&&(this._gridRecordsCount=this._dataSource().length),f=0;f<this.model.columns.length;f++)this.model.columns[f].template!==r&&(this._columntemplaterefresh=!0);this._updateDataSource=!0;this._refreshDataSource(this._dataSource());this.element.children(".e-gridfooter").remove();this.model.showSummary&&this.model.currentViewData.length>0&&this._renderGridFooter().insertAfter(e);(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow();break;case"selectedRowIndex":this._selectedRow()!=-1&&n.inArray(this._selectedRow(),this.selectedRowsIndexes)==-1?(this.model.currentIndex=this._selectedRow(),this.selectRows(this._selectedRow())):this._selectedRow()==-1&&(this.clearSelection(),this.selectedRowsIndexes=[]);break;case"selectedRowIndices":if(this.model.allowSelection==!0&&this.model.selectionType=="multiple"&&this._selectedMultipleRows().length>0){for(this.clearSelection(),this.selectedRowsIndexes=this._selectedMultipleRows(),this._selectedMultipleRows(this.selectedRowsIndexes),f=0;f<this.selectedRowsIndexes.length;f++)et=this.getRowByIndex(this.selectedRowsIndexes[f]),et.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active");this.model.selectedRecords=this.getSelectedRecords()}else this._selectedMultipleRows().length==0&&(this.clearSelection(),this.selectedRowsIndexes=[]);break;case"editType":this._selectedRow()!=-1&&n.inArray(this._selectedRow(),this.selectedRowsIndexes)==-1&&this.selectRows(this._selectedRow());break;case"editSettings":n.extend(this.model.editSettings,i[u]);this.refreshToolbar();this.refreshContent(!0);this.refreshBatchEditMode();this._tdsOffsetWidth=[];n("#"+this._id+"_dialogEdit").data("ejDialog")&&n("#"+this._id+"_dialogEdit").ejDialog("destroy");n("#"+this._id+"_dialogEdit_wrapper,#"+this._id+"_dialogEdit").remove();n("#"+this._id+"_externalEdit").remove();this.getContentTable().find(".e-insertedrow").remove();this.model.isEdit=!1;this.model.editSettings.editMode!="normal"&&(this.model.editSettings.showAddNewRow=!1);this.model.editSettings.showAddNewRow||this.getContentTable().find(".e-addedrow").length&&this.cancelEdit();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?this.element.append(this._renderDialog()):(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&this.element.append(this._renderExternalForm()));(this.model.editSettings.allowDeleting&&this.model.editSettings.showDeleteConfirmDialog||this.model.editSettings.editMode=="batch"&&this.model.editSettings.showConfirmDialog)&&t.isNullOrUndefined(this._confirmDialog)&&this._renderConfirmDialog();this._enableEditingEvents();this.refreshToolbar();break;case"allowResizing":this.model.allowResizing=i[u];this.model.allowResizing?(this._on(this.element,t.eventType.mouseMove,this._mouseMove),this._on(this.element,"mouseup",this._mouseUp),this._resizer=this._resizer||new t.gridFeatures.gridResize(this)):(this._off(this.element,t.eventType.mouseMove,this._mouseMove),this._off(this.element,"mouseup",this._mouseUp),this.model.allowResizeToFit||(this._resizer=null));break;case"allowResizeToFit":this.model.allowResizeToFit?(this._on(this.element,"dblclick",".e-gridheader",this._headerdblClickHandler),this._resizer=this._resizer||new t.gridFeatures.gridResize(this),this.setWidthToColumns()):(this._off(this.element,"dblclick",".e-gridheader",this._headerdblClickHandler),this.model.allowResizing||(this._resizer=null));break;case"allowReordering":this.model.allowReordering=i[u];this.model.allowReordering&&this._headerCellreorderDragDrop();break;case"allowRowDragAndDrop":this.model.allowRowDragAndDrop?(this._rowsDragAndDrop(),this.model.selectionType=="multiple"&&this._on(this.element,"touchstart mousedown",".e-gridcontent",this._contentMouseDown),this.model.allowScrolling&&this.getContent().ejScroller({thumbStart:function(){return!1}})):(this._off(this.element,"touchstart mousedown",".e-gridcontent",this._contentMouseDown),this.getContentTable().ejDroppable("destroy"),n(this.getRows()).ejDraggable("destroy"),this.getContent().ejScroller({thumbStart:null}));break;case"showSummary":case"summaryRows":if(u=="showSummary"&&i[u]&&this.addSummaryTemplate(),u!="showSummary"||i[u]){if(u=="summaryRows"&&this.model.showSummary||u=="showSummary"){this.element.children(".e-gridfooter").remove();this.element.children(".e-gridfooter").remove();var e=this.element.find(".e-gridcontent").first(),d=this.model.query.queries,g=[];for(f=0;f<d.length;f++)d[f].fn==="onPage"&&(g=d.splice(f,1));c=this.model.query;this._setSummaryAggregate(c);g.length&&c.queries.push(g[0]);this.model.currentViewData.length&&(this._isLocalData?(this._remoteSummaryData=this._dataManager.executeLocal(c).aggregates,this._renderGridFooter().insertAfter(e)):(v=this,ot=this._dataManager.executeQuery(c),ot.done(function(n){v.element.children(".e-gridfooter").remove();v._remoteSummaryData=n.aggregates;v._renderGridFooter().insertAfter(e)})));this.model.allowGrouping&&(this._rowCol=this._captionSummary(),this._isCaptionSummary=(this._rowCol!=null&&this._rowCol.length)>0?!0:!1,this.refreshContent(!0))}}else this.element.children(".e-gridfooter").remove();break;case"enableAltRow":this.model.enableAltRow=i[u];this.addInitTemplate();this.refreshContent();break;case"toolbarSettings":n.extend(this.model.toolbarSettings,i[u]);this.element.children(".e-gridtoolbar").remove();this.model.toolbarSettings.showToolbar&&this._renderToolBar().insertBefore(this.element.find(".e-gridheader").first());break;case"allowSorting":this.model.allowSorting=i[u];this.model.allowSorting||this.clearSorting();break;case"selectionSettings":n.extend(this.model.selectionSettings,i[u]);this.clearSelection();this.clearCellSelection();this.clearColumnSelection();this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1;this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();break;case"sortSettings":n.extend(this.model.sortSettings,i[u]);this.refreshContent();break;case"contextMenuSettings":n.extend(this.model.contextMenuSettings,i[u]);!t.isNullOrUndefined(n("#"+this._id+"_Context").data("ejMenu"))&&n("#"+this._id+"_Context").ejMenu("destroy")&&n("#"+this._id+"_Context").remove();this.model.contextMenuSettings.enableContextMenu&&this._renderContext();break;case"enableRTL":this.model.enableRTL=i[u];o=this.model;o.query=this.commonQuery.clone();this.element.ejGrid("destroy");o.enableRTL?n("#"+this._id).addClass("e-rtl"):n("#"+this._id).removeClass("e-rtl");n("#"+this._id).ejGrid(o);break;case"enableTouch":this.model.enableTouch=i[u];this.model.enableTouch?(this._on(this.element,"swipeleft swiperight",".e-gridcontent .e-table",n.proxy(this._touchGrid,this)),this.element.removeClass("e-touch")):(this.element.addClass("e-touch"),this._off(this.element,"swipeleft swiperight",".e-gridcontent .e-table"));break;case"allowSelection":i[u]?(this._off(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",this._clickHandler),this._on(this.element,"click",this._clickHandler),this._initSelection()):(this.clearSelection(),this.clearCellSelection(),this.clearColumnSelection(),this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1);break;case"query":this.commonQuery=n.extend(!0,{},i[u]);break;case"showStackedHeader":case"stackedHeaderRows":this.model.showStackedHeader&&i.stackedHeaderRows&&i.stackedHeaderRows.length>0?(t.getObject("stackedHeaderRows.length",i)&&(this.model.stackedHeaderRows=i.stackedHeaderRows),this._refreshStackedHeader()):this.getHeaderTable().find(".e-stackedHeaderRow").remove();break;case"allowTextWrap":case"textWrapSettings":n.extend(this.model.textWrapSettings,i[u]);this._setTextWrap();break;case"rowTemplate":this.refreshContent(!0);break;case"detailsTemplate":this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0?(this._renderAlertDialog(),this._alertDialog.find(".e-content").text(this._getLocalizedLabels("FrozenNotSupportedException")),this._alertDialog.ejDialog("open")):(nt=this.element.children(".e-gridheader"),nt.find("div").first().empty().append(this._renderGridHeader().find("table")),this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering(),this.setGridHeaderContent(nt),this.refreshContent(!0),this.model.allowReordering&&this._headerCellreorderDragDrop(),this.model.allowGrouping&&this._headerCellgDragDrop())}},resetModelCollections:function(){this.model.groupSettings.groupedColumns=[];this.model.filterSettings.filteredColumns=[];this.filterColumnCollection=[];this.model.sortSettings.sortedColumns=[];this.model.pageSettings.currentPage=this.defaults.pageSettings.currentPage},_enableGrouping:function(){var r,f,u,e,i;if(this.refreshTemplate(),this.model.groupSettings.showToggleButton)for(r=0;r<this.model.columns.length;r++)f=this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").eq(r),u=this.model.columns[r].field,n.inArray(u,this._disabledGroupableColumns)!=-1||t.isNullOrUndefined(u)||u==""||f.find(".e-gridgroupbutton").length||(n.inArray(u,this.model.groupSettings.groupedColumns)!=-1?f.append(this._getToggleButton().addClass("e-toggleungroup")):f.append(this._getToggleButton().addClass("e-togglegroup")));if(this.model.groupSettings.showToggleButton||this.getHeaderTable().find(".e-gridgroupbutton").remove(),this.element.find(".e-groupdroparea").remove(),this.model.groupSettings.showDropArea&&(this.model.showColumnChooser&&this.element.find(".e-ccButton").length>0?this.element.find(".e-ccButton").after(this._renderGroupDropArea()):this.element.prepend(this._renderGroupDropArea()),t.gridFeatures.dragAndDrop&&(this._groupHeaderCelldrag(),this._headerCellgDragDrop())),!t.isNullOrUndefined(this.model.groupSettings.groupedColumns.length)&&this.model.groupSettings.groupedColumns.length){for(e={},e.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],e.requestType=t.Grid.Actions.Grouping,this.element.find(".e-groupdroparea").empty(),i=0;i<this.model.groupSettings.groupedColumns.length-1;i++)this._addColumnToGroupDrop(this.model.groupSettings.groupedColumns[i]);for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)t.isNullOrUndefined(this.getsortColumnByField(this.model.groupSettings.groupedColumns[i]))&&this.model.sortSettings.sortedColumns.push({field:this.model.groupSettings.groupedColumns[i],direction:t.sortOrder.Ascending});this._processBindings(e)}},addIgnoreOnExport:function(n){typeof n=="string"?this.ignoreOnExport.push(n):this.ignoreOnExport=this.ignoreOnExport.concat(n)},addIgnoreOnToolbarServerClick:function(n){typeof n=="string"?this.ignoreOnToolbarServerClick.push(n):this.ignoreOnToolbarServerClick=this.ignoreOnToolbarServerClick.concat(n)},_decode:function(t){return n("<div/>").html(t).text()},_htmlEscape:function(n){var t={"&":"&","<":"<",">":">",'"':""","'":"'"};return n.replace(/[&<>"']/g,function(n){return t[n]})},_mappingSelection:function(){var i,n;if(t.gridFeatures.selection&&this._enableCheckSelect){for(this.multiSelectCtrlRequest=!0,i=[],n=0;n<this._currentJsonData.length;n++)t.pvt.getObject(this._selectionMapColumn,this._currentJsonData[n])==!0&&i.push(n);this.selectedRowsIndexes=[];this._selectedRow(-1);this._selectionByGrid=!0;i.length&&this.selectRows(i);this._selectionByGrid=!1}},_headerCheckUpdateAll:function(n){for(var r=[],r=this._isLocalData?this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json:this._dataSource():this._currentJsonData,i=0;i<r.length;i++)r[i][this._selectionMapColumn]=n,this.batchChanges.changed.push(r[i]);this.batchSave();return},_getForeignKeyData:function(n){var r=this,f={},u,e;for(i=0;i<this.model.columns.length;i++)this.model.columns[i].foreignKeyValue&&this.model.columns[i].dataSource&&(u=t.isNullOrUndefined(r.model.columns[i].foreignKeyField)?r.model.columns[i].field:r.model.columns[i].foreignKeyField,e=this.model.columns[i].dataSource instanceof t.DataManager?this.model.columns[i].foreignKeyData:this.model.columns[i].dataSource,e.filter(function(e){var o=t.getObject(r.model.columns[i].field,n),s=!isNaN(parseFloat(o))&&isFinite(o)?parseFloat(o):o;e[u]==s&&(f[u]=e)}));return f},_foreignKeyBinding:function(i,r,u){var f,e,o=n("#"+u).ejGrid("instance"),s;return i=o.model.columns[i],s=i.dataSource instanceof t.DataManager?i.foreignKeyData:i.dataSource,s.filter(function(n){if(t.getObject(i.foreignKeyField,n)==r)return e=t.getObject(i.foreignKeyValue,n),f=i.type=="date"?new Date(e):e}),i.format&&(f=o.formatting(i.format,f,o.model.locale)),f},_checkForeignKeyBinding:function(){if(this.model.columns.length){var i,r,u,n;for(i=0,r=this.model.columns,u=r.length;i<u;i++)n=r[i],n.hasOwnProperty("foreignKeyField")&&n.dataSource instanceof t.DataManager&&this._relationalColumns.push({field:n.field,key:n.foreignKeyField,value:n.foreignKeyValue,dataSource:n.dataSource});this._$fkColumn=!0}},_setForeignKeyData:function(i){var s,w,l,h;if(this._relationalColumns.length){var a=this._relationalColumns,b=this._relationalColumns.length,c=[],o=this.model.currentViewData,u={},f,v,y,p,e=this;if(o.length==0)for(s=0,w=this.model.columns.length;s<w;s++)column=this.model.columns[s],!t.isNullOrUndefined(column.foreignKeyField)&&column.dataSource instanceof t.DataManager&&(column.foreignKeyData=[]);for(l=t.proxy(function(n){this._trigger("actionFailure",{requestType:"fetchingforeigndata",error:n.error})},this),this.element.ejWaitingPopup("model.showOnInit")||this.element.ejWaitingPopup("show"),h=0;h<b;h++)if(0 in o){if(f=a[h],u.field=f.field,u.keyField=f.key,u.valueField=f.value,u.dataSource=f.dataSource,u.query=(new t.Query).select([u.valueField,u.keyField]).foreignKey(u.keyField),y=t.distinct(o.level?o.records:o,u.keyField,!0),v=t.UrlAdaptor.prototype.getFiltersFrom(y,u.query),u.query.where(v),this._trigger("actionBegin",n.extend(u,{requestType:"fetchingforeigndata",column:this.getColumnByField(u.field)})))return;p=u.dataSource.ready===r?u.dataSource.executeQuery(u.query,null,l):u.dataSource.ready.fail(l);c.push(p)}n.when.apply(this,c).then(function(){var u,t,n,o,r,s;for(e.element.ejWaitingPopup("hide"),u=[].slice.call(arguments,0,arguments.length),n=0,o=c.length;n<o;n++)for(f=a[n],r=0,s=e.model.columns.length;r<s;r++)t=e.model.columns[r],t.foreignKeyField==f.key&&t.foreignKeyValue==f.value&&(t.foreignKeyData=u[n].result);e.initialRender?e._initGridRender():e.sendDataRenderingRequest(i)})}},_isRelationalRendering:function(n){return 0 in this._relationalColumns&&["add","beginedit","cancel"].indexOf(n.requestType)==-1}}}(jQuery,Syncfusion),function(n,t,r){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.edit={_processEditing:function(){var e=this._columnToSelect(),h=e.query,i=[],y=e.fields,f=[],p,o=this._relationalColumns,w=o.length,a,c,b,v,u,s,l,k;if(this.model.query._fromTable!=""&&h.from(this.model.query._fromTable),a=y.length,a&&f.push(this._dataManager.executeQuery(h)),w!=0)for(c=0;c<w;c++)obj=o[c],qry=(new t.Query).select([obj.key,obj.value]),p=obj.dataSource.ready===r?obj.dataSource.executeQuery(qry):obj.dataSource.ready,f.push(p);if(e.fieldsDrop.length)for(b=e.fieldsDrop.length,v=e.fieldsDrop,u=0;u<b;u++)s=[],l=this.getColumnByField(v[u]),t.isNullOrUndefined(t.getObject("editParams.fields.text",l))?i.push(v[u]):(k=l.editParams,i.push(k.fields)),i[u]instanceof Object?(s.push(i[u].text),s.push(i[u].value)):s.push(i[u]),h=(new t.Query).select(s),f.push(l.dataSource.executeQuery(h));f.length!=0?n.when.apply(this,f).then(t.proxy(function(){for(var r=[].slice.call(arguments,0,arguments.length),n=0,e=0,u=0,s=a,h,c=f.length;n<c;n++){while(s>0)t.createObject(y[--s],r[n].result,this._dropDownManager),h=!0;if(!h||n!=0){if(o.length!=e){obj=o[e];key=obj.key+"."+obj.value;t.createObject(key,r[n].result,this._dropDownManager);e++;continue}o.length==e&&i.length&&(i[u]instanceof Object?(t.createObject(i[u].text,r[n].result,this._dropDownManager),t.createObject(i[u].value,r[n].result,this._dropDownManager)):t.createObject(i[u],r[n].result,this._dropDownManager),u++)}}this._initiateTemplateRendering()},this)):this._initiateTemplateRendering()},_initiateTemplateRendering:function(){this.model.editSettings.editMode=="normal"?this.addEditingTemplate():this.model.editSettings.editMode=="batch"?this.addBatchEditTemplate():this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="inlineform"?this.addDialogEditingTemplate():this.addExternalDialogEditingTemplate();this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&this._startAdd()},addEditingTemplate:function(){var c,s,i,u,e,w,f,h;if(this.model.columns.length!=0){var o=t.buildTag("tbody"),v=t.buildTag("tr"),y=t.buildTag("td","",{},{colSpan:this.model.scrollSettings.frozenColumns>0?this.model.scrollSettings.frozenColumns:this.model.columns.length}),p=t.buildTag("form","",{},{id:this._id+"EditForm","class":"gridform"}),l=t.buildTag("table.e-table","",{},{cellspacing:.25}),b=t.buildTag("tbody"),a=t.buildTag("tr");for(o.append(v),v.append(y),y.append(p),c=n(document.createElement("colgroup")),p.append(l),l.append(c),b.append(a).appendTo(l),this.model.scrollSettings.frozenColumns>0&&(s=o.clone(),s.find("td").first().prop("colSpan",this.model.columns.length-this.model.scrollSettings.frozenColumns)),i=0;i<this.model.columns.length;i++)(u=t.buildTag("td.e-rowcell"),a.append(u.get(0)),this.model.columns[i].type!="checkbox"||this._isMapSelection)&&(t.isNullOrUndefined(this.model.columns[i].commands)&&(!this.model.columns[i].template||this.model.columns[i].template&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field)?this._initCellEditType(i,u):this.model.columns[i].template?(f={},e=this.model.columns[i].headerText,f["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this),n.views.helpers(f),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.match(/[^0-9\s\w]/g))||(e=e.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+e+i+"_Template").remove(),w=this._createTemplateElement(this.model.columns[i]),u.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+w.id+"')}}")):this.model.columns[i].commands&&(f={},f["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,n.views.helpers(f),n("#"+this._id+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(this.model.columns[i],i),u.addClass("e-unboundcell").addClass("e-"+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&u.addClass("e-frozenunbound"),this._isUnboundColumn=!0),this.model.columns[i].textAlign!=r&&u.css("text-align",this.model.columns[i].textAlign),this.model.columns[i].allowEditing==!1&&u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isPrimaryKey===!0&&u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isIdentity===!0&&(u.find(".e-field").addClass("e-identity"),this._identityKeys.push(n.trim(this.model.columns[i].field)),this._identityKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._identityKeys.sort()):n.uniqueSort(this._identityKeys.sort())),h=n(document.createElement("col")),this.model.columns[i].priority&&(u.addClass("e-table-priority-"+this.model.columns[i].priority),h.addClass("e-table-priority-"+this.model.columns[i].priority)),this.model.columns[i].visible===!1&&(h.css("display","none"),u.addClass("e-hide")),t.isNullOrUndefined(this.model.columns[i].cssClass)||u.addClass(this.model.columns[i].cssClass),!this.model.groupSettings.showGroupedColumn&&u.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[i].field+"'}}e-hide{{/if}}{{/for}}")&&h.css("display","none"),c.append(h),i==this.model.scrollSettings.frozenColumns-1&&(a=s.find("tr").last(),c=s.find("colgroup"),n.templates(this._id+"_JSONFrozenEditingTemplate",o.html()),o=s));n.templates(this._id+"_JSONEditingTemplate",o.html())}},addDialogEditingTemplate:function(){var i,o,y,e;if(this.model.columns.length!=0){var h=t.buildTag("div"),s=t.buildTag("form.gridform","",{},{id:this._id+"EditForm"}),l=t.buildTag("table","",{},{cellspacing:"14px"}),f,a,u,v,c;for(i=0;i<this.model.columns.length;i++)(this.model.columns[i].type!="checkbox"||this._isMapSelection)&&(this.model.editSettings.editMode=="dialog"?(v="tr",c="td"):v=c="div",f=t.buildTag(v),a=t.buildTag(c,"",{"text-align":"right"}).addClass("e-label"),u=t.buildTag(c,"",{"text-align":"left"}).addClass("e-rowcell"),f.is("div")&&f.addClass("e-gridFromDiv"),this.model.columns[i].priority&&this.model.editSettings.editMode=="inlineform"&&f.addClass("e-table-priority-"+this.model.columns[i].priority),f.append(a.get(0)).append(u.get(0)),this.model.columns[i].headerText==r&&(this.model.columns[i].headerText=this.model.columns[i].field),a.append("<label for='"+this.model.columns[i].field+"'>"+this.model.columns[i].headerText+"<\/label>"),t.isNullOrUndefined(this.model.columns[i].commands)&&(!this.model.columns[i].template||this.model.columns[i].template&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field)?this._initCellEditType(i,u):this.model.columns[i].template?(e={},o=this.model.columns[i].headerText,e["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this),n.views.helpers(e),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.match(/[^0-9\s\w]/g))||(o=o.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+o+i+"_Template").remove(),y=this._createTemplateElement(this.model.columns[i]),u.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+y.id+"')}}")):this.model.columns[i].commands&&(e={},e["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,n.views.helpers(e),n("#"+this._id+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(this.model.columns[i],i),u.addClass("e-unboundcell").addClass("e-"+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&u.addClass("e-frozenunbound"),this._isUnboundColumn=!0,f.addClass("e-hide")),this.model.columns[i].allowEditing==!1&&u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isIdentity===!0&&(u.find(".e-field").addClass("e-identity"),this._identityKeys.push(n.trim(this.model.columns[i].field)),this._identityKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._identityKeys.sort()):n.uniqueSort(this._identityKeys.sort())),this.model.columns[i].visible===!1&&f.addClass("e-hide"),t.isNullOrUndefined(this.model.columns[i].cssClass)||u.addClass(this.model.columns[i].cssClass),this.model.editSettings.editMode=="dialog"?(s.append(l),l.append(f)):s.append(f),s.appendTo(h),this.model.columns[i].isPrimaryKey===!0&&(u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this._primaryKeys.push(n.trim(this.model.columns[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort())));this.model.editSettings.editMode=="dialog"&&s.append(l);h=this.renderDiaglogButton(s,h);n.templates(this._id+"_JSONDialogEditingTemplate",h.html())}},_editEventTrigger:function(n){if(n.requestType=="save"||n.requestType=="delete"){var i={data:n.data,previousData:n.previousData,action:n.action!==r?n.action:n.requestType};t.isNullOrUndefined(n.foreignKeyData)||(i.foreignKeyData=n.foreignKeyData);this._trigger("end"+i.action.charAt(0).toUpperCase()+i.action.slice(1),i)}},_compiledDropDownTemplate:function(i,r,u,f){var s={_gridFormatting:this.formatting},e,o;return n.views.helpers(s),e=t.buildTag("select"),o=t.buildTag("option",f!=null?"{{:~_gridFormatting('"+f+"',"+r+",'"+this.model.locale+"')}}":"{{:"+r+"}}",{},{value:"{{:"+i+"}}"}),e.append(o),n.templates(e.html())},_initCellEditType:function(i,u){var o=this.model.columns[i].field,a,nt,c,d,g,it,rt,f,h,w,l,y,s,e,k,ut,ft,et;this.model.columns[i].foreignKeyValue&&(this.model.columns[i].editType="dropdownedit");this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&(e=n.inArray(this.model.columns[i].field,this._dataSource().adaptor.value),e!=-1&&(a=this._dataSource().adaptor.value[e],nt=this._dataSource().adaptor.key[e]));this.model.columns[i].editTemplate&&(this.model.columns[i].editType="edittemplate");t.isNullOrUndefined(this.model.columns[i].editType)&&(this.model.columns[i].editType=this.model.columns[i].type=="date"||this.model.columns[i].type=="datetime"?this.model.columns[i].type+"picker":"stringedit");this.model.isResponsive&&u.attr("data-cell",this._decode(this.model.columns[i].headerText));var v=(o||"").split("."),tt=v.length-1,p="";for(t.isNullOrUndefined(o)||(o=o.replace(/[^a-z0-9\s_]/gi,""));tt;)p+="(",tt--;switch(this.model.columns[i].editType){case"edittemplate":c=this.model.columns[i].editTemplate.create;typeof c=="string"?(d=t.util.getObject(c,window),g=n.isFunction(d)?n(d()).attr({id:this._id+o,name:this.model.columns[i].field}):n(c).length==1&&n(c).get(0).tagName=="SCRIPT"?n(n(c).html()).attr({id:this._id+o,name:this.model.columns[i].field}):n(c).attr({id:this._id+o,name:this.model.columns[i].field})):g=n(c()).attr({id:this._id+o,name:this.model.columns[i].field});u.append(g);break;case"stringedit":u.html(t.buildTag("input.e-field e-ejinputtext","",{},{value:"{{html:"+p+"#data['"+v.join("'] || {})['")+"']}}",id:this._id+o,name:this.model.columns[i].field}));break;case"booleanedit":u.html('{{if #data["'+v.join('"]["')+'"]}} <input class="e-field e-checkbox" type ="checkbox" id='+this._id+o+" name="+this.model.columns[i].field+' checked="checkbox"><\/input>{{else}} <input class="e-field e-checkbox" type ="checkbox" id='+this._id+o+" name="+this.model.columns[i].field+" > {{/if}}");this.model.editSettings.editMode=="normal"&&u.addClass("e-boolcell");break;case"numericedit":it=t.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:"+p+"#data['"+v.join("'] || {})['")+"']}}",id:this._id+o,name:this.model.columns[i].field});u.append(it);break;case"datepicker":case"datetimepicker":rt=t.buildTag("input.e-"+this.model.columns[i].editType+" e-field","",{},{type:"text",value:"{{:"+p+"#data['"+v.join("'] || {})['")+"']}}",id:this._id+o,name:this.model.columns[i].field});u.append(rt);break;case"dropdownedit":if(f=this.model.columns[i],h=[],t.isNullOrUndefined(f.dataSource)){if(t.isNullOrUndefined(f.dataSource)&&this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a&&(data=this.model.dataSource.adaptor.foreignData[e],$foreignkeyfield=this.model.dataSource.adaptor.key[e],$foreignkeyvalue=this.model.dataSource.adaptor.value[e],h=data),l=f.field,t.isNullOrUndefined(t.getObject(l,this._dropDownManager)))return;if(w=t.getObject(l,this._dropDownManager),y=0 in w&&typeof w[0]=="object",s=s=t.dataUtil.mergeSort(t.distinct(w,y?l:r,y?!1:r)),h.length==0)if(t.isNullOrUndefined(f.dataSource)&&this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a)for(e=0;e<s.length;e++)h.push({text:s[e][0],value:s[e][1]});else for(e=0;e<s.length;e++)h.push({text:s[e],value:s[e]})}else if(t.isNullOrUndefined(f.foreignKeyField)&&f.dataSource instanceof t.DataManager){var l=f.field,b=t.getObject(l,this._dropDownManager),y=0 in b&&typeof b[0]=="object",s=s=t.dataUtil.mergeSort(t.distinct(b,y?l:r,y?!1:r));if(t.isNullOrUndefined(t.getObject("editParams.fields.text",f))||(h=b),h.length==0)for(e=0;e<s.length;e++)h.push({text:s[e],value:s[e]})}else h=!t.isNullOrUndefined(f.foreignKeyField)&&f.field in this._dropDownManager?t.getObject(f.foreignKeyField+"."+f.foreignKeyValue,this._dropDownManager):f.dataSource;ut=t.isNullOrUndefined(f.foreignKeyField)?f.field:f.foreignKeyField;f.foreignKeyValue?k=this._compiledDropDownTemplate(ut,f.foreignKeyValue,f.type,f.format):this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a?k=this._compiledDropDownTemplate($foreignkeyfield?$foreignkeyfield:"value",$foreignkeyvalue?$foreignkeyvalue:"text",f.type,f.format):(ft=t.getObject("editParams.fields.value",f)||"value",et=t.getObject("editParams.fields.text",f)||"text",k=this._compiledDropDownTemplate(ft,et,f.type,f.format));u.get(0).innerHTML=!t.isNullOrUndefined(f.editParams)&&this._dataSource()instanceof t.DataManager&&this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a?"<input data-value='{{:"+nt+"}}'/>":["<select>",k.render(h),"<\/select>"].join("");u.find("select,input").prop({id:this._id+o,name:f.field}).addClass("e-field e-dropdownlist")}},addBatchEditTemplate:function(){if(this.model.columns.length!=0){for(var u=t.buildTag("div","",{display:"none"},{id:this._id+"_BulkEditTemplate"}),r,i=0,f=this.model.columns.length;i<f;i++)(t.isNullOrUndefined(this.model.columns[i].commands)&&t.isNullOrUndefined(this.model.columns[i].template)||this.model.columns[i].template&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field)&&(r=t.buildTag("div","",{},{id:this.model.columns[i].field.replace(/\./g,t.pvt.consts.complexPropertyMerge)+"_BulkEdit"}),this._initCellEditType(i,r),u.append(r)),this.model.columns[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(this.model.columns[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort())),this.model.columns[i].isIdentity===!0&&(r.find(".e-field").addClass("e-identity"),this._identityKeys.push(n.trim(this.model.columns[i].field)),this._identityKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._identityKeys.sort()):n.uniqueSort(this._identityKeys.sort()));u.children().length&&(this._bulkEditTemplate=u)}},addExternalDialogEditingTemplate:function(){var e,i,u,r,f;if(this.model.columns.length!=0){for(e=t.buildTag("td","",{"text-align":"left"}).addClass("e-rowcell"),i=0;i<this.model.columns.length;i++)(this.model.columns[i].type!="checkbox"||this._isMapSelection)&&(t.isNullOrUndefined(this.model.columns[i].commands)&&!t.isNullOrUndefined(this.model.columns[i].template)&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field&&!t.isNullOrUndefined(this.model.columns[i].editTemplate)&&this._initCellEditType(i,e),this.model.columns[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(this.model.columns[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort())));u=t.buildTag("div","",{display:"none"});r=t.buildTag("form.gridform","",{},{id:this._id+"EditForm"});this.model.editSettings.editMode=="dialogtemplate"&&this.model.editSettings.dialogEditorTemplateID!=null?f=this.model.editSettings.dialogEditorTemplateID:this.model.editSettings.editMode=="externalformtemplate"&&this.model.editSettings.externalFormTemplateID!=null?(f=this.model.editSettings.externalFormTemplateID,r.addClass("e-display")):(f=this.model.editSettings.inlineFormTemplateID,r.addClass("e-display"));r.html(n(f).html());u=this.renderDiaglogButton(r,u);n.templates(this._id+"_JSONdialogTemplateMode",u.html())}},_editdblClickHandler:function(t){var i=n(t.target);i.closest(".e-grid").attr("id")===this._id&&(i.hasClass("e-rowcell")||i.closest("td").hasClass("e-rowcell"))&&(!this.model.isEdit||this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal")&&(this._$currentTr=this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0?this.getRowByIndex(i.closest("tr").index()):i.closest("tr"),this.startEdit(this._$currentTr))},_columnToSelect:function(){for(var r=[],u=[],f=this.model.columns,i=0;i<this.model.columns.length;i++)this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&n.inArray(this.model.columns[i].field,this._dataSource().adaptor.value)!=-1&&t.isNullOrUndefined(this.model.columns[i].editType)&&(this.model.columns[i].editType="dropdownedit"),this.model.columns[i].editType===t.Grid.EditingType.Dropdown&&t.isNullOrUndefined(this.model.columns[i].dataSource)&&r.push(this.model.columns[i].field),f[i].editType===t.Grid.EditingType.Dropdown&&t.isNullOrUndefined(f[i].foreignKeyField)&&f[i].dataSource instanceof t.DataManager&&u.push(this.model.columns[i].field);return r.length?{query:t.Query().select(r),fields:r,fieldsDrop:u}:{query:t.Query(),fields:[],fieldsDrop:u}},_renderExternalForm:function(){var f=t.buildTag("div","",{display:"none"},{id:this._id+"_externalEdit","class":"e-form-container"}),n=t.buildTag("div","","",{id:this._id+"_eFormHeader","class":"e-form-titlebar"}),e=t.buildTag("span","","",{"class":"e-form-title"}),i=t.buildTag("div","","",{id:this._id+"_eFormToggleBtn","class":"e-form-togglebtn"}),o=t.buildTag("span","","",{"class":"e-form-toggle-icon e-icon"});i.append(o);n.append(e).append(i);var r=t.buildTag("div","","",{id:this._id+"_eFormContent","class":"e-form-content"}),u=t.buildTag("div","","",{id:this._id+"_externalForm","class":"e-externalform"}),s=t.buildTag("div","","",{"class":"e-externalformedit"});return u.append(s),r.append(u),f.append(n).append(r)},_buttonClick:function(t){if(t.type=="close"){if(!this.model.isEdit)return;this.model.isEdit=!1;this.element.ejGrid("cancelEdit");this.refreshToolbar();return}if(t.keyCode!==r&&t.keyCode!=13||this.model==null)return!0;this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?t.target.id=="EditDialog_"+this._id+"_Save"?this.element.ejGrid("endEdit"):t.target.id=="EditDialog_"+this._id+"_Cancel"&&(this.element.ejGrid("cancelEdit"),n("#"+this._id+"_dialogEdit").ejDialog("close")):this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"?n(t.target).hasClass("e-form-toggle-icon")?(this.element.ejGrid("cancelEdit"),n("#"+this._id+"_externalEdit").css("display","none")):t.target.id=="EditExternalForm_"+this._id+"_Save"?this.element.ejGrid("endEdit").length!==r&&n("#"+this._id+"_externalEdit").css("display","none"):t.target.id=="EditExternalForm_"+this._id+"_Cancel"&&(this.element.ejGrid("cancelEdit"),n("#"+this._id+"_externalEdit").css("display","none")):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?t.target.id=="InlineEditForm_"+this._id+"_Save"?this.element.ejGrid("endEdit"):t.target.id=="InlineEditForm_"+this._id+"_Cancel"&&this.element.ejGrid("cancelEdit"):this.element.ejGrid("cancelEdit")},_enableEditingEvents:function(){if(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding){if(this.model.editSettings.allowEditing&&this.model.editSettings.editMode!="batch"&&this.model.editSettings.allowEditOnDblClick?this._on(this.element,n.isFunction(n.fn.doubletap)&&this.model.enableTouch?"doubletap":"dblclick",".e-gridcontent",this._editdblClickHandler):(this._off(this.element,"dblclick",".e-gridcontent"),this._off(this.element,"doubletap",".e-gridcontent")),this._off(n("#"+this._id+"_dialogEdit"),"click ","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel"),this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate")this._on(n("#"+this._id+"_dialogEdit"),"click ","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel",this._buttonClick);else if(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"){this._on(n("#"+this._id+"_externalEdit"),"click ","#EditExternalForm_"+this._id+"_Save ,#EditExternalForm_"+this._id+"_Cancel",this._buttonClick);n(this.element).on("click",".e-form-toggle-icon",n.proxy(this._buttonClick,this))}else if(this.model.editSettings.editMode=="batch")this._on(n(document),"mousedown",this._saveCellHandler),this._batchEnabled=!0;else if(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")n(this.element).on("click ","#InlineEditForm_"+this._id+"_Save ,#InlineEditForm_"+this._id+"_Cancel",n.proxy(this._buttonClick,this));this.model.editSettings.editMode!="batch"&&this._batchEnabled&&(this._off(n(document),"mousedown",this._saveCellHandler),this._batchEnabled=!1)}else this._off(n("#"+this._id+"_dialogEdit"),"click","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel"),n(this.element).off("click",".e-icon"),this._off(n("#"+this._id+"_externalEdit"),"click","#EditExternalForm_"+this._id+"_Save ,#EditExternalForm_"+this._id+"_Cancel"),n(this.element).off("click",".e-form-toggle-icon"),n(this.element).off("click","#InlineEditForm_"+this._id+"_Save ,#InlineEditForm_"+this._id+"_Cancel")},_multiRowDelete:function(){var i={},n,r,u;if(i.added=[],i.deleted=[],i.changed=[],i.deleted=this.getSelectedRecords(),n={},n.data=this.getSelectedRecords(),n.tr=this.getSelectedRows(),r=this._getForeignKeyData(n.data),t.isNullOrUndefined(r)||(n.foreignKeyData=r),n.requestType="delete",this._trigger("actionBegin",n))return!0;u=this;this._sendBulkReuqest(i,n)},deleteRow:function(i){var c,s,f,u,h,e,o;if(this.model.editSettings.allowDeleting&&(!this.model.isEdit||this.model.editSettings.editMode=="batch"||this.model.editSettings.showAddNewRow)){if(this.model.editSettings.showDeleteConfirmDialog&&!this._confirmDialog.is(":visible")){this._cDeleteData=i;this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open");return}if(n.isArray(i))this.selectRows(i),this._multiRowDelete();else if(this.model.editSettings.editMode=="batch")this._bulkDelete(this.getIndexByRow(i));else{if(this._primaryKeys.length==0&&!this.model.editSettings.allowEditing&&!this.model.editSettings.allowAdding)for(f=0;f<this.model.columns.length;f++)this.model.columns[f].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(this.model.columns[f].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort()));if(this._selectedRow()==-1&&t.isNullOrUndefined(i)){alert(this.localizedLabels.DeleteOperationAlert);return}for(t.isNullOrUndefined(i)&&(i=this.model.scrollSettings.enableVirtualization?this.getContentTable().find("tr[aria-selected='true']"):this.getRowByIndex(this._selectedRow())),this._primaryKeyValues=[],this._getPrimaryKeyValues(i),c=t.DataManager(this._currentJsonData),s=new t.Query,f=0;f<this._primaryKeys.length;f++)s=s.where(this._primaryKeys[f],t.FilterOperators.equal,this._primaryKeyValues[f]);if(currentData=c.executeLocal(s),u={},u.tr=i,u.data=currentData[0],h=this._getForeignKeyData(u.data),t.isNullOrUndefined(h)||(u.foreignKeyData=h),u.requestType=t.Grid.Actions.Delete,this._trigger("actionBegin",u))return!0;this._cDeleteData=currentData;!(t.isOnWebForms&&this.model.serverEvents&&this.model.serverEvents.indexOf("endDelete")!=-1)&&this._dataSource()instanceof t.DataManager&&!this._dataManager.dataSource.offline&&this._dataManager.dataSource.json!==r||this._dataSource().adaptor instanceof t.remoteSaveAdaptor?(e=this._dataManager.remove(this._primaryKeys[0],this._primaryKeys.length?t.getObject(this._primaryKeys[0],currentData[0]):null,this.model.query),o=this,n.isFunction(e.promise)?(e.done(function(){o._processBindings(u);o._primaryKeyValues=[];o._cDeleteData=null}),e.fail(function(n){u.error=n;o._trigger("actionFailure",u)})):this._processBindings(u)):this._processBindings(u);e!=r&&n.isFunction(e.promise)||(this._primaryKeyValues=[],this._cDeleteData=null)}}},_htmlEncode:function(n){return str=n,t.isNullOrUndefined(str)||(str=isNaN(str)?str.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"):str),str},startEdit:function(i){if(this.model.editSettings.allowEditing&&(!this.model.editSettings.showAddNewRow||this.model.editSettings.editMode!="normal"||!this._excludeDetailRows().hasClass("e-editedrow"))&&!this.element.ejWaitingPopup("model.showOnInit")){if(this._selectedRow()==-1&&t.isNullOrUndefined(i)){alert(this.localizedLabels.EditOperationAlert);return}if(this.model.scrollSettings.enableVirtualization&&t.isNullOrUndefined(i)&&(i=this.getContentTable().find("tr[aria-selected='true']")),t.isNullOrUndefined(i)?(this._currentTrIndex=this._selectedRow(),this._$currentTr=this.getRowByIndex(this._currentTrIndex)):(this._currentTrIndex=this.getIndexByRow(i),this._$currentTr=i),!n(this._$currentTr).is(":visible"))return!1;this._primaryKeyValues=[];this._getPrimaryKeyValues(this._$currentTr);var u=this._editedData=this._currentJsonData[this._currentTrIndex],r={row:this._$currentTr,rowIndex:this._currentTrIndex,primaryKey:this._primaryKeys,primaryKeyValue:this._primaryKeyValues,rowData:u},f=this._trigger("beginEdit",r);if(f){this._primaryKeyValues=[];return}r.requestType=t.Grid.Actions.BeginEdit;this._processBindings(r)}},_getPrimaryKeyValues:function(i){var u,f,o=i.attr("name"),s,r,h,c=!1,e;for(this._lastVirtualPage=null,e=0;e<this._primaryKeys.length;e++)s=this.getColumnByField(this._primaryKeys[e]),u=this.getIndexByRow(i),f=this._currentJsonData,this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization?(u=u%this._virtualRowCount,r=parseInt(o,32)):(u=u%this.model.pageSettings.pageSize,r=parseFloat(o)/this.model.pageSettings.pageSize+1,this._currentJsonData=this._virtualLoadedRecords[r],r!=this.model.pageSettings.totalPages||this._prevPageRendered||this._virtualLoadedRecords[r].length==this.model.pageSettings.pageSize||(f=n.extend(!0,[],this._previousPageRecords),h=n.extend(!0,[],this._virtualLoadedRecords[r]),t.merge(f,h),this._lastVirtualPage=this._currentJsonData=n.extend(!0,[],f),c=!0)),f=c?f:this._virtualLoadedRecords[r],this._vCurrentTrIndex=u,this._currentVIndex=r),this._primaryKeyValues.push(this._htmlEncode(t.getObject(s.field,f[u])))},_startAdd:function(){var f,r,u,e,i,h,o,c,s,l;if(this.model.editSettings.allowAdding)if(this._isAddNew=!0,this.model.editSettings.editMode=="batch")this._bulkAddRow();else{for(f={},r=this.model.columns,i=0;i<r.length;i++)t.isNullOrUndefined(this.model.parentDetails)||r[i].field!=this.model.parentDetails.parentKeyField||(r[i].defaultValue=this.model.parentDetails.parentKeyFieldValue),!t.isNullOrUndefined(r[i].field)&&r[i].field.indexOf(".")>0?t.createObject(r[i].field,r[i].defaultValue||"",f):f[r[i].field]=t.isNullOrUndefined(r[i].defaultValue)?r[i].type=="date"||r[i].type=="datetime"?null:"":r[i].defaultValue;if(u={},e={},u.data=f,this.model.editSettings.editMode.indexOf("template")!=-1)for(i=0;i<this.model.columns.length;i++)t.isNullOrUndefined(this.model.columns[i].field)||this.model.columns[i].field.indexOf(".")==-1||(h=this.model.columns[i].field.split("."),t.createObject(this.model.columns[i].field,u.data[this.model.columns[i].field],e),u.data[h[0]]=e,delete u.data[this.model.columns[i].field]);o=this._getForeignKeyData(u.data);t.isNullOrUndefined(o)||(u.foreignKeyData=o);u.requestType="add";this.clearSelection();this.model.selectionSettings.selectionMode.indexOf("cell")!=-1&&this.clearCellSelection();this.model.scrollSettings.allowVirtualScrolling&&(this._currentVIndex=null,this._lastVirtualPage=null,this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(1):this._virtualLoadedRecords[1]?this._currentPage(1):this.gotoPage(1),this.getScrollObject().scrollY(0));c=this._processBindings(u);c||(this.model.editSettings.showAddNewRow?this._selectedRow(-1):this._selectedRow(0));s=this.model.groupSettings.groupedColumns.length;s>1&&(l=this.getContentTable().find(".e-addedrow").find("table").find("colgroup").children(),n(l.slice(0,s-1)).css("width",this.getHeaderTable().find("colgroup").children()[0].style.width))}},endEdit:function(){var e,c,w,b,l,a,k,s,nt,v,y,rt,p,ut,h,tt,ft,it,et;if(this.model.isEdit){if(b=0,!this.editFormValidate())return!0;if(l={},this.model.editSettings.editMode=="batch")this.saveCell();else{for(this._isAddNew&&(this._isEditChangesApplied=!0),this.model.editSettings.showAddNewRow&&(w=this.getContentTable().find(".e-editedrow")),e=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):!t.isNullOrUndefined(w)&&w.length==1?w[0].lastChild.lastChild:document.getElementById(this._id+"EditForm"),c=n(e),a=this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?c.closest("tr"):c.closest("div"),a.find("td.e-rowcell").removeClass("e-validError"),e=this.model.scrollSettings.frozenColumns>0?e[0]:e,s=0;s<e.length;s++)if(!a.hasClass("e-addedrow")||!n(e[s]).hasClass("e-identity")){var f=e[s].name,o=n(e[s]),u=this.getColumnByField(f);if(!o.hasClass("e-dropdownlist e-input")||o.attr("id").indexOf("_input")==-1||!t.isNullOrUndefined(c[1])){if(f!=r&&f!=""&&l[f]==null){u=this.getColumnByField(f);var i=e[s].value,d=e[s].type,g=n(e[s]).is(":checked"),k=u?u.originalType:null;if(n(e[s]).attr("type")=="hidden"&&t.isNullOrUndefined(o.attr("value")))continue;if(t.isNullOrUndefined(u)||u.editType!="edittemplate")n(e[s]).hasClass("e-datepicker")?(i=o.ejDatePicker("model.value"),this._isEditChangesApplied||(colFormat=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(u.format)?u.format:"{0:MM/dd/yyyy}",this.formatting(colFormat,i,this.model.locale)!=this.formatting(colFormat,this._editedData[f],this.model.locale)&&(this._isEditChangesApplied=!0))):n(e[s]).hasClass("e-datetimepicker")?(i=o.ejDateTimePicker("model.value"),this._isEditChangesApplied||(colFormat=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(u.format)?u.format:"{0:MM/dd/yyyy hh:mm:ss}",this.formatting(colFormat,i,this.model.locale)!=this.formatting(colFormat,this._editedData[f],this.model.locale)&&(this._isEditChangesApplied=!0))):o.is(".e-numerictextbox")?(i=o.ejNumericTextbox("getValue"),t.isNullOrUndefined(u)||u.type!="string"||t.isNullOrUndefined(i)||(i=i.toString()),this._isEditChangesApplied||this._editedData[f]==i||(this._isEditChangesApplied=!0)):(o.data("ejDropDownList")||o.is(".e-dropdownlist"))&&(o.is(":hidden")&&o.is("input")&&t.isNullOrUndefined(o.data("ejDropDownList"))&&(o=o.siblings(".e-dropdownlist")),i=o.ejDropDownList("getSelectedValue"),t.isNullOrUndefined(u)||t.isNullOrUndefined(u.format)||u.type!="date"&&u.type!="datetime"||(i=i.length>0?new Date(i):i),this._isEditChangesApplied||this._editedData[f]==i||(this._isEditChangesApplied=!0));else if(nt=n(e[s]).attr("type")=="hidden",n(e[s]).is("#"+this._id+f)||nt)v=u.editTemplate.read,o=n(e[s]),o=nt?n(e[s]).siblings("#"+this._id+f).length?n(e[s]).siblings("#"+this._id+f):o:o,typeof v=="string"&&(v=t.util.getObject(v,window)),i=v(o),this._isEditChangesApplied||typeof this._editedData[f]!="object"?this._isEditChangesApplied||u.type!="number"?this._isEditChangesApplied||u.type!="string"?this._isEditChangesApplied||u.type!="boolean"||this._editedData[f]!=i&&(this._isEditChangesApplied=!0):this._editedData[f]!=i&&(this._isEditChangesApplied=!0):(rt=typeof i=="string"?+i:i,this._editedData[f]!=rt&&(this._isEditChangesApplied=!0)):(y="",u.type=="date"||u.type=="datetime"?(u.type=="date"&&(y=t.isNullOrUndefined(u.format)?"{0:MM/dd/yyyy}":u.format),u.type=="datetime"&&(y=t.isNullOrUndefined(u.format)?"{0:MM/dd/yyyy hh:mm:ss}":u.format),this.formatting(y,this._editedData[f],this.model.locale)!=this.formatting(y,i,this.model.locale)&&(this._isEditChangesApplied=!0)):JSON.stringify(this._editedData[f])!=JSON.stringify(i.split(","))&&(this._isEditChangesApplied=!0));else continue;k&&(i=k=="number"?+i:k=="boolean"?i===this.localizedLabels.True?!0:!1:k==="date"?new Date(i):i);u==null?i=!isNaN(parseFloat(i))&&isFinite(i)?parseFloat(i):i:u.type=="number"&&!t.isNullOrUndefined(i)&&i.length&&(i=t.parseFloat(i,this.model.locale),this._isEditChangesApplied||this._editedData[f]==i||(this._isEditChangesApplied=!0));typeof i!="string"||i.length||(i=null);this._isEditChangesApplied||t.isNullOrUndefined(u)||u.type!="string"||this._editedData[f]==i||(this._isEditChangesApplied=!0);this._isEditChangesApplied||t.isNullOrUndefined(u)||u.type!="date"||u.editType!="stringedit"||u.format!=null&&this.formatting(u.format,this._editedData[f],this.model.locale)!=i&&(this._isEditChangesApplied=!0);(d!="checkbox"&&!t.isNullOrUndefined(i)&&i!==""||g)&&b++;p=d=="checkbox"&&(t.isNullOrUndefined(u)||u.type=="boolean")?g:i;this._isEditChangesApplied||t.isNullOrUndefined(u)||u.type!="boolean"||(ut=d=="checkbox"?g:JSON.parse(i),this._editedData[f]!=ut&&(this._isEditChangesApplied=!0));this._isEditChangesApplied||typeof p!="string"||typeof this._editedData[f]!="string"||this._editedData[f]==p||(this._isEditChangesApplied=!0);f.indexOf(".")!=-1?t.createObject(f,p,l):l[f]=p}s==e.length-1&&c.length>1&&c.index(e)==0&&(e=c[1],s=-1)}}if(h={data:l},tt=this._getForeignKeyData(h.data),t.isNullOrUndefined(tt)||(h.foreignKeyData=tt),h.requestType=t.Grid.Actions.Save,h.selectedRow=this._selectedRow(),h.previousData=jQuery.extend({},this.model.currentViewData[h.selectedRow]),this._trigger("actionBegin",h))return!0;if(a.hasClass("e-editedrow")?(this._cModifiedData=l,h.action="edit"):a.hasClass("e-addedrow")&&(b&&(this._cAddedRecord=l),h.action="add"),h.action=="add"&&this.editFormValidate()&&(t.isNullOrUndefined(this.model.queryString)||(ft=this.model.foreignKeyField||this.model.queryString,h.data[ft]=this.model.parentDetails.parentRowData[this.model.queryString]),!b))return elements=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):n("#"+this._id+"EditForm"),it=t.buildTag("div"),elements.addClass("field-validation-empty"),et=elements.find("input:visible").not(".e-identity").first(),this._renderValidator(it,et),$errorMessage=t.buildTag("div.e-field-validation-error",this.localizedLabels.EmptyRowValidationMessage),$tail=n(it).find(".e-errortail"),$errorMessage.insertAfter($tail),$errorMessage.css("display","block"),!1;(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none");this._isAddNew||this._isEditChangesApplied?(this._isEditChangesApplied=!1,this._updateAction(h)):this.cancelEdit()}}},_updateAction:function(i){var f,u;this._dataSource()instanceof t.DataManager&&!this._dataManager.dataSource.offline&&this._dataManager.dataSource.json!==r||this._dataSource().adaptor instanceof t.remoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor?this.model.editSettings.editMode=="batch"?(this.batchChanges.added.push(i.data),this.batchSave()):(t.isNullOrUndefined(this._cModifiedData)||t.isOnWebForms&&this.model.serverEvents&&this.model.serverEvents.indexOf("endEdit")!=-1?t.isOnWebForms&&this.model.serverEvents&&this.model.serverEvents.indexOf("endAdd")!=-1||(f=this._dataManager.insert(i.data,this.model.query)):f=this._dataManager.update(this._primaryKeys[0],i.data,this.model.query),u=this,this.element.ejWaitingPopup("show"),f&&n.isFunction(f.promise)?(f.done(function(r){u.model.isEdit=!1;!t.isNullOrUndefined(r)&&n.isPlainObject(r.record)&&(n.extend(i.data,r.record),i.action=="add"&&(u._cAddedRecord=i.data),i.action=="edit"&&(u._cModifiedData=i.data));u._processBindings(i);u._isRemoteSaveAdaptor&&(u.element.ejWaitingPopup("hide"),t.isNullOrUndefined(u._unboundRow)||i.selectedRow==u._unboundRow||i.requestType!="save"||(u._unboundRow.find(".e-editbutton").trigger("click"),u._unboundRow=null));u._cModifiedData=null;u._cAddedRecord=null;u._primaryKeyValues=[]}),f.fail(function(n){i.error=n&&n.error?n.error:n;u._cModifiedData=null;u._cAddedRecord=null;u.element.ejWaitingPopup("hide");u._trigger("actionFailure",i)})):(u.model.isEdit=!1,u._processBindings(i))):this._processBindings(i);f!=r&&n.isFunction(f.promise)||(this._cModifiedData=null,this._cAddedRecord=null,this._primaryKeyValues=[])},cancelEdit:function(){var i={};i.requestType=t.Grid.Actions.Cancel;this._cModifiedData=null;this._processBindings(i);this._primaryKeyValues=[];this._currentData=null;(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none")},refreshToolbar:function(){var r=n("#"+this._id+"_toolbarItems"),t=r.find("li"),u,i;if(r.ejToolbar("enableItem",t),u=this.getContentTable().find(".e-editedrow"),this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&u.length==0)this._disabledToolItems.push(t.filter("[id="+this._id+"_add]"));else for(i=0;i<t.length;i++)switch(t[i].id){case this._id+"_add":case this._id+"_edit":case this._id+"_delete":case this._id+"_responsiveFilter":case this._id+"_responsiveSorting":case this._id+"_search":this.model.isEdit?this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&u.length==0||(n(t[i]).hasClass("e-hover")&&n(t[i]).removeClass("e-hover"),this._disabledToolItems.push(t[i])):this.model.enableToolbarItems||this.model.editSettings.allowAdding||t[i].id!=this._id+"_add"?this.model.enableToolbarItems||this.model.editSettings.allowEditing||t[i].id!=this._id+"_edit"?this.model.enableToolbarItems||this.model.editSettings.allowDeleting||t[i].id!=this._id+"_delete"||this._disabledToolItems.push(t[i]):this._disabledToolItems.push(t[i]):this._disabledToolItems.push(t[i]);break;case this._id+"_update":case this._id+"_cancel":this.model.isEdit||this.getContentTable().find(".e-updatedtd.e-icon.e-gupdatenotify").length!=0||this._isBatchDeleteApplied||(n(t[i]).hasClass("e-hover")&&n(t[i]).removeClass("e-hover"),this._disabledToolItems.push(t[i]))}r.ejToolbar("disableItem",this._disabledToolItems);r.ejToolbar("model.enableRTL",this.model.enableRTL);this._disabledToolItems=n()},_getHiddenCount:function(n){for(var i=0,t=0;t<n.length;t++)n.eq(t).hasClass("e-hide")&&i++;return i},_refreshTemplateCell:function(t,i){for(var f,u=t.find(".e-templatecell"),r=0;r<u.length;r++)f={cell:u[r],data:i,column:this.model.columns[n(u[r]).index()],rowIndex:t.index()},this._trigger("templateRefresh",f)},_edit:function(i){var k=this.model.scrollSettings.enableVirtualization?t.DataManager(this._virtualLoadedRecords[this._currentVIndex]):t.DataManager(this._currentJsonData),f,l=new t.Query,c,b,s,o,h,p,u;for(this.model.allowFiltering&&(this._previousFilterCount=this._filteredRecordsCount),c=0;c<this._primaryKeys.length;c++)l=l.where(this._primaryKeys[c],t.FilterOperators.equal,this._primaryKeyValues[c]);this._currentData=k.executeLocal(l);var e=document.createElement("div"),a=t.isNullOrUndefined(this.model.editSettings.titleColumn)?this._primaryKeys[0]:this.model.editSettings.titleColumn,r=n(e);if(this.model.editSettings.editMode=="normal"){e.innerHTML=["<table>",n.render[this._id+"_JSONEditingTemplate"](this._currentData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("");var v=r.find("tr").first(),s=0,w=this.model.columns.length,y=i.row.first();this.model.scrollSettings.frozenColumns>0&&(r.prepend(["<table>",n.render[this._id+"_JSONFrozenEditingTemplate"](this._currentData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("")),v.splice(0,0,r.find("table").first().find("tr").first().get(0)),$currentTrLa=i.row.last(),$tempLastTR=v.last());f=r.find("tr").first();r.find("td").not(".e-rowcell").addClass("e-editcell e-normaledit");this._setEditDropdownValue(r);this.model.groupSettings.groupedColumns.length>=2&&(b=i.row.find("td.e-indentcell"),r.find("tr").first().prepend(b));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(s++,r.find(".e-editcell").find("tr").prepend(i.row.find("[class*=e-detailrow]").eq(0).removeClass("e-selectionbackground e-active")),this.model.gridLines!="both"&&r.find(".e-editcell .e-rowcell:first").addClass("e-detailrowvisible"));this.model.scrollSettings.frozenColumns>0&&(r.find(".e-editcell").get(1).colSpan=this.model.columns.length-this.model.scrollSettings.frozenColumns-i.row.last().find(".e-hide").length+s,w=this.model.scrollSettings.frozenColumns,$currentTrLa.hasClass("e-alt_row")&&$tempLastTR.addClass("e-alt_row"));r.find(".e-editcell").get(0).colSpan=w-y.find("td").not(":visible").length+s;y.hasClass("e-alt_row")&&f.addClass("e-alt_row");y.empty().replaceWith(f.addClass("e-editedrow"));i.row=f;f.is(":last-child")||f.find("td.e-rowcell").addClass("e-validError");this.model.scrollSettings.frozenColumns>0&&($currentTrLa.empty().replaceWith($tempLastTR.addClass("e-editedrow")),i.row=$tempLastTR);this._refreshUnboundTemplate(v.find(".gridform"));this._gridRows=this.model.scrollSettings.frozenColumns==0?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row, tr.e-editedrow").toArray():n(this.getContentTable().get(0).rows).toArray();this.model.scrollSettings.frozenColumns>0&&(this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop,!0),this._gridRows=[this._gridRows,n(this.getContentTable().get(1).rows).toArray()])}else this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(s=0,e.innerHTML=this.model.editSettings.editMode=="inlineform"?n.render[this._id+"_JSONDialogEditingTemplate"](this._currentData):n.render[this._id+"_JSONdialogTemplateMode"](this._currentData),this._setEditDropdownValue(r),o=t.buildTag("tr"),h=t.buildTag("td"),o.addClass("e-editedrow"),h.addClass("e-inlineformedit"),e=n(e).clone(!0).children(),h.html(e),o.append(h),o.is(":last-child")||o.find(".e-rowcell").addClass("e-validError"),this.model.scrollSettings.frozenColumns>0?(p=o.clone(),p.find("td").empty().prop("colspan",this.model.scrollSettings.frozenColumns),i.row.eq(1).after(o).end().eq(0).after(p),this._gridRows=[this._gridRows,this.getContentTable().last().find("tr").toArray()]):i.row.after(o),this._gridRows=this.getContentTable().first().find(".e-rowcell,.e-inlineformedit").closest("tr").toArray(),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&s++,this.model.scrollSettings.frozenColumns>0?h.prop("colspan",this.model.columns.length-this.model.scrollSettings.frozenColumns-o.find("form").children().not(":visible").length+s):h.prop("colspan",this.model.columns.length-this._hiddenColumns.length+s),this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find("tr").toArray()]),n("#"+this._id+"_inlineFormTitle").text(this.localizedLabels.EditFormTitle+this._currentData[0][a]),i.row.find("input").attr("disabled","disabled").addClass("e-disable")):(r.addClass("e-editedrow"),e.innerHTML=this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform"?n.render[this._id+"_JSONDialogEditingTemplate"](this._currentData):n.render[this._id+"_JSONdialogTemplateMode"](this._currentData),this._setEditDropdownValue(r),this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?(n("#"+this._id+"_dialogEdit").html(n(e)),u={},u.cssClass=this.model.cssClass,u.enableRTL=this.model.enableRTL,u.width="auto",u.enableResize=this.phoneMode,u.close=n.proxy(this._buttonClick,this),u.content="#"+this._id,u.enableModal=!0,u.allowKeyboardNavigation=!1,u.title=this.localizedLabels.EditFormTitle+this._currentData[0][a],n("#"+this._id+"_dialogEdit").ejDialog(u),n("#"+this._id+"_dialogEdit").ejDialog("open")):(n("#"+this._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),n("#"+this._id+"_externalForm").find(".e-externalformedit").html(n(e)),n("#"+this._id+"_eFormHeader").find(".e-form-title").text(this.localizedLabels.EditFormTitle+this._currentData[0][a]),this._externalFormPosition(),i.row.find("input").attr("disabled","disabled").addClass("e-disable")));this.model.editSettings.editMode!="normal"&&(f=n(e));t.isNullOrUndefined(this.model.templateRefresh)||f.find(".e-templatecell").length==0||this._refreshTemplateCell(f,this.model.currentViewData[f.index()])},_setEditDropdownValue:function(i){for(var s,h,e,l,f,u=i.find("select.e-field"),o,c=i.find("input.e-field.e-dropdownlist"),r=0;r<u.length;r++){if(s={},h="",u[r].name.indexOf(".")!=-1){for(f=1;f<u[r].name.split(".").length;f++)h=h.concat("(");s[this._id+"ddlTemp"]="{{:"+h+"#data['"+u[r].name.split(".").join("'] || {})['")+"']}}"}else s[this._id+"ddlTemp"]="{{:"+u[r].name.replace(/[^a-z0-9\s_]/gi,"")+"}}";n.templates(s);o=n.render[this._id+"ddlTemp"](this._currentData);e=i.find("select:eq("+r+') option[value="'+o+'"]');u.eq(r).data("ej-value",o);l=this.getColumnByField(u[r].name);this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&this._dataSource().adaptor.value.indexOf(l.field)!=-1&&(e=i.find("select:eq("+r+') option:contains("'+o+'")'),u.eq(r).val(e[0].value),u.eq(r).data("ej-value",e[0].value));e.attr("selected","selected")}for(f=0;f<c.length;f++)c.eq(f).data("ej-value",t.getObject(c.eq(f).attr("name"),this._currentData[0]))},_add:function(i){var u=document.createElement("div"),e,c,l,a,h,v,y,p,f,r,s;if(this._isLocalData&&this.model.groupSettings.groupedColumns.length==0&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&((this._dataSource()instanceof t.DataManager)?this._dataSource().dataSource.json.splice(0,1):this._dataSource().splice(0,1)),this._previousFilterCount=this._filteredRecordsCount,this.model.editSettings.editMode=="normal"){for(l=n(u),a=this.model.columns.length,u.innerHTML=["<table>",n.render[this._id+"_JSONEditingTemplate"](i.data,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join(""),f=n(u).find("select.e-field"),r=0;r<f.length;r++)f.eq(r).val(i.data[f[r].name]),f.eq(r).data("ej-value",i.data[f[r].name]);if(this.model.scrollSettings.frozenColumns>0&&($tempLastTR=l.find("table").first().find("tr").first(),l.prepend(["<table>",n.render[this._id+"_JSONFrozenEditingTemplate"](i.data,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("")),n($tempLastTR).find("td").first().addClass("e-editcell")),c=l.find("tr").first(),h=n(u).find(".e-editcell").get(0),n(u).find("td").first().addClass("e-editcell"),this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&this.model.groupSettings.groupedColumns.length==0&&!this.model.editSettings.showAddNewRow&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&n(this.getContentTable().get(0).lastChild.lastChild).children(".e-detailrowexpand").length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),(this.model.currentViewData.length==0||this.getContentTable().find("td.e-rowcell").length==0)&&this.model.scrollSettings.frozenColumns==0?(this.getContentTable().find("tr").first().replaceWith(n(u).find("tr").first().addClass("e-addedrow e-normaledit")),this.getContentTable().find("tr").length==0&&this.getContentTable().append(n(u).find("tr").first().addClass("e-addedrow e-normaledit"))):(this.model.scrollSettings.frozenColumns>0&&this._renderByFrozenDesign(),v=this.getContentTable().first().find("tbody").first(),this.model.editSettings.rowPosition=="top"?v.prepend(c.addClass("e-addedrow e-normaledit")):this.model.editSettings.rowPosition=="bottom"&&v.append(c.addClass("e-addedrow e-normaledit")),this.model.scrollSettings.frozenColumns>0&&this.getContentTable().last().find("tbody").first().prepend($tempLastTR.addClass("e-addedrow e-normaledit"))),e=this.getContentTable().find("tr.e-addedrow"),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&e.attr("name",0),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&e.find("tr").first().prepend(t.buildTag("td.e-detailrowcollapse")),this.model.groupSettings.groupedColumns.length){for(r=0;r<this.model.groupSettings.groupedColumns.length;r++)r==0?e.prepend(t.buildTag("td.e-indentcell")):e.find("tr").prepend(t.buildTag("td.e-indentcell"));this.model.groupSettings.groupedColumns.length>0&&(this.model.detailsTemplate!=null||this.model.childGrid!=null)?e.find("td.e-editcell").prop("colspan",this.model.columns.length+this.model.groupSettings.groupedColumns.length-this._hiddenColumns.length):this.model.groupSettings.groupedColumns.length>=2?e.find("td.e-editcell").prop("colspan",this.model.columns.length+(this.model.groupSettings.groupedColumns.length-1)-this._hiddenColumns.length):e.find("td.e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length)}else this.model.detailsTemplate!=null||this.model.childGrid!=null?e.find(".e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length+1):(this.model.scrollSettings.frozenColumns>0&&(e.find(".e-editcell").last().prop("colspan",this.model.columns.length-this.model.scrollSettings.frozenColumns-$tempLastTR.find("td").not(":visible").length),a=this.model.scrollSettings.frozenColumns),e.find(".e-editcell").first().prop("colspan",a-c.find("td").not(":visible").length));e.is(":last-child")||e.find("td.e-rowcell").addClass("e-validError");t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||this.model.editSettings.rowPosition!="bottom"||this._colgroupRefresh();this._refreshUnboundTemplate(e.find(".gridform"));this._gridRows=this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray();this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray()])}else if(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"){u.innerHTML=this.model.editSettings.editMode=="inlineform"?n.render[this._id+"_JSONDialogEditingTemplate"](i.data):n.render[this._id+"_JSONdialogTemplateMode"](i.data);var w=0,o=t.buildTag("tr"),h=t.buildTag("td");for(o.addClass("e-addedrow"),h.addClass("e-inlineformedit e-editcell"),u=n(u).clone(!0).children(),f=n(u).find("select.e-field"),r=0;r<f.length;r++)f.eq(r).val(i.data[f[r].name]),f.eq(r).data("ej-value",i.data[f[r].name]);if(h.html(u),o.append(h),o.is(":last-child")||o.find(".e-rowcell").addClass("e-validError"),this.model.groupSettings.groupedColumns.length)for(r=0;r<this.model.groupSettings.groupedColumns.length;r++)o.prepend(t.buildTag("td.e-indentcell"));else o.find("td.e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length);this.model.scrollSettings.frozenColumns>0?(y=o.clone(),p=h.find(".gridform").children(),y.find("td").empty().prop("colSpan",this.model.scrollSettings.frozenColumns-this._getHiddenCount(p.slice(0,this.model.scrollSettings.frozenColumns))),h.prop("colSpan",this.model.columns.length-this.model.scrollSettings.frozenColumns-this._getHiddenCount(p.slice(this.model.scrollSettings.frozenColumns))),(this.model.currentViewData.length==0||this.getContentTable().find("td.e-rowcell").length==0)&&this._renderByFrozenDesign(),this.getContentTable().first().find("tbody").first().prepend(y),this.getContentTable().last().find("tbody").first().prepend(o)):((this.model.detailsTemplate!=null||this.model.childGrid!=null)&&w++,h.prop("colspan",this.model.columns.length-this._hiddenColumns.length+w),this.model.currentViewData.length==0||this.getContentTable().find("td.e-rowcell").length==0?this.getContentTable().find("tr").first().replaceWith(n(o)):this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&this.model.groupSettings.groupedColumns.length==0&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),this.model.editSettings.rowPosition=="top"?this.getContentTable().first().find("tbody").first().prepend(o):this.model.editSettings.rowPosition=="bottom"&&this.getContentTable().first().find("tbody").first().append(o));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&n(this.getContentTable().get(0).lastChild.lastChild).children(".e-detailrowexpand").length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild);n("#"+this._id+"_inlineFormTitle").text(this.localizedLabels.AddFormTitle);this._refreshUnboundTemplate(n("#"+this._id+"EditForm"));this._gridRows=this.getContentTable().first().find(".e-rowcell,.e-inlineformedit").closest("tr.e-row, tr.e-alt_row").toArray();this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray()])}else{for(n(u).addClass("e-addedrow"),u.innerHTML=this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform"?n.render[this._id+"_JSONDialogEditingTemplate"](i.data):n.render[this._id+"_JSONdialogTemplateMode"](i.data),f=n(u).find("select.e-field"),r=0;r<f.length;r++)f.eq(r).val(i.data[f[r].name]),f.eq(r).data("ej-value",i.data[f[r].name]);this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?(n("#"+this._id+"_dialogEdit").html(n(u)),s={},s.cssClass=this.model.cssClass,s.width="auto",s.enableResize=this.phoneMode,s.content="#"+this._id,s.enableModal=!0,s.close=n.proxy(this._buttonClick,this),s.enableRTL=this.model.enableRTL,s.allowKeyboardNavigation=!1,s.title=this.localizedLabels.AddFormTitle,n("#"+this._id+"_dialogEdit").ejDialog(s),n("#"+this._id+"_dialogEdit").ejDialog("open")):(n("#"+this._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),n("#"+this._id+"_externalForm").find(".e-externalformedit").html(n(u)),n("#"+this._id+"_eFormHeader").find(".e-form-title").text(this.localizedLabels.AddFormTitle),this._externalFormPosition())}this.model.editSettings.editMode!="normal"&&(e=n(u));t.isNullOrUndefined(this.model.templateRefresh)||e.find(".e-templatecell").length==0||this._refreshTemplateCell(e,i.data);this.model.allowPaging&&(this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._gridRecordsCount:this._searchCount,currentPage:this._currentPage()}),this._refreshGridPager())},editFormValidate:function(){var t,i,r;return n.isFunction(n.validator)?this.model.scrollSettings.frozenColumns>0?(t=this.element.find(".gridform"),t.length>1?(i=t.eq(0).validate().form(),r=t.eq(1).validate().form(),i&&r?!0:!1):t.validate().form()):this.model.editSettings.showAddNewRow?n(this.getRows()).hasClass("e-editedrow")?this.element.find(".e-editedrow .gridform").validate().form():this.element.find(".e-addedrow .gridform").validate().form():n("#"+this._id+"EditForm").validate().form():!0},_refreshAltRow:function(){for(var t,r=this._excludeDetailRows(),i=0;i<r.length;i++)t=n(r[i]),t.hasClass("e-alt_row")&&t.removeClass("e-alt_row"),i%2!=0?t.addClass("e-alt_row"):t.addClass("e-row")},_editCompleteAction:function(i){var o=this.element.find(".gridform"),s,h,u,r,f,e;if(this.model.isEdit=!0,s=this.getContentTable().children("colgroup").find("col"),h=this.element.width(),this.setWidthToColumns(),t.Grid.Actions.Add==i.requestType){for(u=o.find(".e-field:disabled"),r=0;r<u.length;r++)f=n(u[r]).attr("name"),n(u[r]).hasClass("e-identity")||(n.inArray(f,this._disabledEditableColumns)==-1||n.inArray(f,this._primaryKeys)!==-1)&&n(u[r]).prop("disabled",!1).removeClass("e-disable");for(e=0;e<this.model.groupSettings.groupedColumns.length-1;e++)o.find("colgroup").prepend(this._getIndentCol())}(this._tdsOffsetWidth.length==0||this.model.groupSettings.groupedColumns.length||n.inArray(0,this._tdsOffsetWidth)!=-1||this._hiddenColumns.length>0)&&this._setoffsetWidth();this._refreshEditForm(i);this.model.scrollSettings.frozenColumns>0&&(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")&&(i.requestType=="beginedit"?i.row.eq(0).next().find("td").height(i.row.eq(1).next().find("td").height()):this.getContentTable().first().find("tr").first().find("td").height(this.getContentTable().last().find("tr").first().find("td").height()));this.model.scrollSettings.frozenRows>0&&i.requestType=="beginedit"&&(this._initFrozenRows(),t.getObject("_vScrollbar._scrollData",this.getScrollObject())&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0));this.model.scrollSettings.frozenColumns>0&&(this.rowHeightRefresh(),this._refreshScroller(i));this.model.allowScrolling&&this.model.scrollSettings.frozenColumns<=0&&this.getScrollObject()&&this.getScrollObject().isHScroll()&&this.getScrollObject().refresh();n.isFunction(n.validator)&&this.initValidator()},_refreshEditForm:function(i){var g,ot,it,v,rt,e,b,nt,u,c,o,ut,k,tt,y,h,l,f,p,a,w,d,s,st,ht;for(this.model.editSettings.showAddNewRow&&(g=this.getContentTable().find(".e-editedrow")),ot=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):!t.isNullOrUndefined(g)&&g.length==1?g[0].lastChild.lastChild:document.getElementById(this._id+"EditForm"),it=!1,this.model.enableResponsiveRow&&n.isFunction(window.matchMedia)&&(rt=window.matchMedia("(max-width: 320px)")),e=n(ot).find("input,select,div.e-field,textarea"),b=86,(this._isUnboundColumn||this.getContentTable().find(".e-templatecell")!=null)&&this.model.editSettings.editMode!="batch"&&(e=e.filter(function(){return!n(this).closest(".e-rowcell").hasClass("e-unboundcell")&&!n(this).closest(".e-rowcell").hasClass("e-templatecell")})),nt=null,l=0;l<e.length;l++){if(u=e.eq(l),o=this.getColumnByField(t.isNullOrUndefined(u.prop("name"))?u.attr("name"):u.prop("name")),o!=null&&(v=n.inArray(o,this.model.columns)),this.model.editSettings.editMode=="batch"?b=95:this.model.editSettings.editMode=="normal"&&(b=96),this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(u.parent().css("width",t.dataUtil.max(this._tdsOffsetWidth)+"px"),c=t.max(this._tdsOffsetWidth)*(b/100)):c=this._tdsOffsetWidth[l]*(b/100),(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="batch"||this.model.allowResizing||this.model.allowResizeToFit)&&!u.hasClass("e-checkbox")&&(c="100%"),o!=null&&v!==r&&v<this.model.columns.length&&this.model.columns[v].editTemplate)ut={rowdata:this.model.editSettings.editMode=="batch"?this._batchEditRowData:this._currentJsonData[this._selectedRow()],column:this.model.columns,element:u,requestType:i.requestType,type:i.type},k=this.model.columns[v].editTemplate.write,t.isNullOrUndefined(i)||i.requestType!="add"||(ut.rowdata={}),typeof k=="string"&&(k=t.util.getObject(k,window)),k(ut),this.model.columns[v].isPrimaryKey&&i.requestType=="beginedit"&&u.addClass("e-disable").attr("disabled","disabled");else if(u.hasClass("e-numerictextbox")||u.hasClass("e-datepicker")||u.hasClass("e-datetimepicker")||u.hasClass("e-dropdownlist"))tt=this.getColumnByField(u.prop("name")),y=u.val(),(!t.isNullOrUndefined(rt)&&rt.matches||tt.width&&typeof tt.width=="string"&&tt.width.indexOf("%")!=-1&&(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="batch"))&&(c="100%"),u.outerWidth(c),u.hasClass("e-numerictextbox")&&(y.length&&u.attr("value",parseFloat(y)),u.prop("name",u.prop("name").replace(this._id,""))),u.hasClass("e-disable")&&u.attr("disabled","disabled");else if(u.hasClass("e-save e-button")||u.hasClass("e-cancel e-button"))u.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,width:"100","text-align":"centre",height:"35px"});else switch(u.prop("tagName")){case"INPUT":if(!t.isNullOrUndefined(o)&&o.format&&u.val()!="")switch(o.type){case"date":var y=u.val(),at=new Date(y),s=o.format.replace("{0:","").replace("}",""),vt=t.format(at,s,this.model.locale);u.val(vt);break;case"number":y=u.val();s=new RegExp("\\{0(:([^\\}]+))?\\}","gm").exec(o.format);s[2].toLowerCase().split("")[0]=="c"?s[2]=s[2].toLowerCase().replace("c","n"):s[2];u.val(t.format(parseFloat(y),s[2],this.model.locale))}u.attr("type")!="checkbox"?(u.css("text-align",u.attr("name")!=null&&this.getColumnByField(u.attr("name"))!=null?this.getColumnByField(u.attr("name")).textAlign:"center"),this.model.editSettings.editMode=="batch"?(u.css("width","100%").css("height","28px"),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version,10)==8&&u.css("line-height","22px")):this.model.editSettings.editMode=="normal"?(u.css("width","100%").css("height","30px"),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version,10)==8&&u.css("line-height","24px")):(u.outerWidth(c).height(28),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version,10)==8&&u.css("line-height","26px"))):u.width(c>0?u.width()>c?c:u.width():this.model.editSettings.editMode.indexOf("template")!=-1?u.width():1);this.model.editSettings.editMode!="batch"||this._tabKey||(u.is(":checked")?u.prop("checked",!1):u.prop("checked",!0));break;case"SELECT":u.width(c).height(28)}o==null||o.visible||!o.validationRules||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalformtemplate"||this.model.editSettings.editMode=="inlineformtemplate"||u.addClass("e-hide");u.is(":disabled")||it||u.is(":hidden")&&typeof(u.data("ejDropDownList")||u.data("ejNumericTextbox"))!="object"||(nt=u,it=!0)}for(h={},h.enableRTL=this.model.enableRTL,h.cssClass=this.model.cssClass,h.watermarkText=this.localizedLabels.NumericTextBoxWaterMark,h.locale=this.model.locale,e.filter(".e-numerictextbox").ejNumericTextbox(n.extend({showSpinButton:!0},h)),h.watermarkText=this.localizedLabels.DatePickerWaterMark,e.filter(".e-datepicker").ejDatePicker(n.extend({displayDefaultDate:!0,showPopupButton:!1},h)),delete h.watermarkText,e.filter(".e-datetimepicker").ejDateTimePicker(n.extend({showPopupButton:!1},h)),e.filter(".e-dropdownlist").ejDropDownList(n.extend({enableIncrementalSearch:!0,htmlAttributes:{style:"width: 100%"}},h)),l=0;l<this.model.columns.length;l++){if(f=this.model.columns[l],!t.isNullOrUndefined(f.editParams))switch(f.editType){case t.Grid.EditingType.DateTimePicker:e.filter("#"+this._id+f.field+".e-datetimepicker").ejDateTimePicker(f.editParams);break;case t.Grid.EditingType.DatePicker:e.filter("#"+this._id+f.field+".e-datepicker").ejDatePicker(f.editParams);break;case t.Grid.EditingType.Numeric:e.filter("#"+this._id+f.field+".e-numerictextbox").ejNumericTextbox(f.editParams);break;case t.Grid.EditingType.Dropdown:e.filter("#"+this._id+f.field+".e-dropdownlist").ejDropDownList(f.editParams)}if(f.editType==t.Grid.EditingType.Dropdown&&(p=-1,this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&(p=this._dataSource().adaptor.value.indexOf(f.field)),a=e.filter("#"+this._id+f.field.replace(".","")+".e-dropdownlist"),w=null,!t.isNullOrUndefined(f.dataSource)&&!t.isNullOrUndefined(f.editParams)&&t.isNullOrUndefined(f.foreignKeyField)&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&p!=-1?w=f.dataSource:t.isNullOrUndefined(f.dataSource)&&p!=-1&&!t.isNullOrUndefined(f.editParams)?w=this._dataSource().adaptor.foreignData[p]:!t.isNullOrUndefined(f.editParams)&&"fields"in f.editParams&&t.isNullOrUndefined(f.foreignKeyField)&&(w=f.dataSource),w!=null&&a.ejDropDownList({dataSource:w}),d=a.data("ej-value"),this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&p!=-1&&!t.isNullOrUndefined(f.editParams)?a.ejDropDownList("setSelectedText",i.requestType=="add"&&t.isNullOrUndefined(f.defaultValue)&&t.isNullOrUndefined(d)?a.val(""):d):a.ejDropDownList("setSelectedValue",i.requestType=="add"&&t.isNullOrUndefined(f.defaultValue)&&t.isNullOrUndefined(d)?a.val(""):d),f==null||f.visible||!f.validationRules||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalformtemplate"||this.model.editSettings.editMode=="inlineformtemplate"||f.editType==t.Grid.EditingType.Dropdown&&a.closest(".e-rowcell").find("input").addClass("e-hide")),s=null,f.format!==r&&f.format.length>0&&(st=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),ht=st.exec(f.format),s=ht[2]),[t.Grid.EditingType.DatePicker,t.Grid.EditingType.DateTimePicker].indexOf(f.editType)!=-1){var ct=f.editType==t.Grid.EditingType.DatePicker?"datePicker":"dateTimePicker",lt="ej"+ct.replace(/\b\w/g,function(n){return n.toUpperCase()}),yt=this._id+f.field,ft=e.filter(function(t,i){return i.id==yt&&(n(i).hasClass("e-datepicker")||n(i).hasClass("e-datetimepicker"))}),et={};s==null||!t.isNullOrUndefined(f.editParams)&&(f.editParams.dateFormat||f.editParams.dateTimeFormat)||(et[ct.replace("Picker","")+"Format"]=s);ft.hasClass("e-disable")&&(et.enabled=!1);ft[lt](et);this.model.editSettings.editMode=="batch"&&ft[lt]("show")}}nt!=null&&this._focusElements(nt)},_focusElements:function(n){if(n.length){var t=n;(t[0].tagName.toLowerCase()!="select"||t.hasClass("e-field e-dropdownlist"))&&(t[0].tagName.toLowerCase()!="input"||t.hasClass("e-numerictextbox"))?t.hasClass("e-field e-dropdownlist")?t.closest(".e-ddl").focus():t.hasClass("e-numerictextbox")?t.siblings("input:visible").first().select().focus():t.find("input:visible,select").first().select().focus():(t.focus().select(),t[0].focus())}},_renderToolBar:function(){var r=t.buildTag("div.e-gridtoolbar","",{},{id:this._id+"_toolbarItems"}),f=t.buildTag("ul"),u,i;return(!t.isNullOrUndefined(this.model.toolbarSettings.toolbarItems)&&this.model.toolbarSettings.toolbarItems.length||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&this._renderLi(f),r.append(f),u=t.buildTag("ul"),r.append(u),!t.isNullOrUndefined(this.model.toolbarSettings.customToolbarItems)&&this.model.toolbarSettings.customToolbarItems.length&&this._renderCustomLi(u),i={},i.click=this._toolBarClick,i.cssClass=this.model.cssClass,i.enableRTL=this.model.enableRTL,i.enableSeprator=!1,r.ejToolbar(i),r.ejToolbar("disableItem",this._disabledToolItems),this._disabledToolItems=n(),r},_renderCustomLi:function(i){for(var e,u,f,r=0;r<this.model.toolbarSettings.customToolbarItems.length;r++){f=this.model.toolbarSettings.customToolbarItems[r].templateID?this.model.toolbarSettings.customToolbarItems[r].templateID.replace("#",""):this.model.toolbarSettings.customToolbarItems[r];u=t.buildTag("li","",{},{id:this._id+"_"+f,title:f});switch(typeof this.model.toolbarSettings.customToolbarItems[r]){case"string":e=t.buildTag("a.e-toolbaricons e-icon","",{}).addClass(this.model.toolbarSettings.customToolbarItems[r]);break;case"object":u.attr("title",this.model.toolbarSettings.customToolbarItems[r].templateID.replace("#",""));e=n(this.model.toolbarSettings.customToolbarItems[r].templateID).hide().html()}u.html(e);i.append(u)}},_renderLi:function(i){var f,r,u,e;for(n.isFunction(window.matchMedia)&&this.model.enableResponsiveRow&&(f=this.model.toolbarSettings.toolbarItems.indexOf("search"),f!=-1&&this.model.toolbarSettings.toolbarItems.splice(f,1),this.model.allowFiltering&&this.model.toolbarSettings.toolbarItems.push("responsiveFilter"),this.model.allowSorting&&this.model.toolbarSettings.toolbarItems.push("responsiveSorting"),f!=-1&&this.model.toolbarSettings.toolbarItems.push("search")),r=0;r<this.model.toolbarSettings.toolbarItems.length;r++)u=t.buildTag("li","",{},{id:this._id+"_"+this.model.toolbarSettings.toolbarItems[r],title:this.localizedLabels[this.model.toolbarSettings.toolbarItems[r].slice(0,1).toUpperCase()+this.model.toolbarSettings.toolbarItems[r].slice(1)]}),this._renderLiContent(u,this.model.toolbarSettings.toolbarItems[r]),e=this.model.toolbarSettings.toolbarItems[r],this.model.enableResponsiveRow&&(e==="responsiveFilter"||e==="responsiveSorting")&&(u.addClass("e-gridresponsiveicons"),u.css("display","none")),i.append(u)},_renderLiContent:function(n,i){var r,u,f,e;switch(i){case"add":r=t.buildTag("a.e-addnewitem e-toolbaricons e-icon e-addnew","",{});break;case"edit":r=t.buildTag("a.e-edititem e-toolbaricons e-icon e-edit","",{});break;case"delete":r=t.buildTag("a.e-deleteitem e-toolbaricons e-icon e-delete","",{});break;case"update":r=t.buildTag("a.e-saveitem e-toolbaricons e-disabletool e-icon e-save","",{});this._disabledToolItems.push(n.get(0));break;case"cancel":r=t.buildTag("a.e-cancel e-toolbaricons e-disabletool e-icon e-gcancel","",{});this._disabledToolItems.push(n.get(0));break;case"search":r=t.buildTag("a.e-searchitem e-toolbaricons e-disabletool e-icon e-searchfind","",{});this.model.enableResponsiveRow||(u=t.buildTag("input.e-ejinputtext e-gridsearchbar","",{},{type:"text",id:this._id+"_searchbar"}),e=t.buildTag("span.e-cancel e-icon e-hide","",{right:"1%"}),f=t.buildTag("div.e-filterdiv e-searchinputdiv","",{display:"inline-table",width:"83%"}),f.append(u).append(e),n.append(f),t.isNullOrUndefined(this.model.searchSettings.key)||u.val(this.model.searchSettings.key));this.model.allowSearching=!0;break;case"printGrid":r=t.buildTag("a.e-print e-toolbaricons e-icon","",{});break;case"excelExport":r=t.buildTag("a.e-toolbaricons e-excelIcon e-icon","",{});break;case"wordExport":r=t.buildTag("a.e-toolbaricons e-wordIcon e-icon","",{});break;case"pdfExport":r=t.buildTag("a.e-toolbaricons e-pdfIcon e-icon","",{});break;case"responsiveFilter":r=t.buildTag("a.e-toolbaricons e-filterset e-icon","",{});break;case"responsiveSorting":r=t.buildTag("a.e-toolbaricons e-respponsiveSorting e-icon","",{})}n.append(r);i=="search"&&(this._searchBar=n,n.css("display","flex"))},_toolBarClick:function(i){var h=n(this.itemsContainer).closest(".e-grid"),u=h.ejGrid("instance"),f=h.attr("id"),s,c,e;if(i.event!=r||i.target.tagName!="INPUT"||i.currentTarget.id!=f+"_search"){n.isFunction(n.fn.ejDatePicker)&&n("#"+f+"EditForm").find(".e-datepicker").ejDatePicker("hide");var o=i.currentTarget,v=i.target,y=n.extend({},u.model);if(u.ignoreOnToolbarServerClick.length)for(s=0;s<u.ignoreOnToolbarServerClick.length;s++)delete y[u.ignoreOnToolbarServerClick[s]];if(c={itemName:n(o).attr("data-content"),itemId:o.id,currentTarget:o,target:v,itemIndex:n(o).index(),itemCurrentTarget:o.outerHTML,gridModel:y,itemTarget:v.outerHTML,toolbarData:i},!h.ejGrid("instance")._trigger("toolbarClick",c)){switch(c.itemId){case f+"_add":u._toolbarOperation(f+"_add");break;case f+"_edit":u._toolbarOperation(f+"_edit");break;case f+"_delete":u._toolbarOperation(f+"_delete");break;case f+"_update":u._toolbarOperation(f+"_update");break;case f+"_cancel":u.model.editSettings.editMode=="batch"?u.model.editSettings.showConfirmDialog?u._confirmDialog.find(".e-content").html(u.localizedLabels.CancelEdit).end().ejDialog("open"):u.cancelEdit():u._toolbarOperation(f+"_cancel");break;case f+"_search":if(u.model.enableResponsiveRow)if(t.isNullOrUndefined(u.element.find(".e-responsesearch")[0])){var l=t.buildTag("div.e-gridtoolbar","",{},{id:this._id+"_toolbarItems"}),p=t.buildTag("div.e-responsesearch","",{width:"95%",height:"38px","margin-top":"7px","margin-left":"6px"}),a=t.buildTag("span.e-ttoltxt","",{width:"98%","margin-left":"2%"},{id:u._id+"_search"});$a=t.buildTag("span.e-searchitem e-toolbaricons e-disabletool e-icon e-searchfind","",{position:"absolute",right:"2%","margin-top":"1%"});t.browserInfo().name==="webkit"&&$a.css("margin-top","-2px");e=t.buildTag("input.e-ejinputtext","",{width:"97%",height:"30px"},{type:"search",id:u._id+"_searchInput"});t.isNullOrUndefined(u.model.searchSettings.key)||e.val(u.model.searchSettings.key);a.append(e);a.append($a);p.append(a);l.append(p);l.ejToolbar({click:function(t){u._toolbarOperation(f+"_search",n(t.currentTarget).find("input").val())}});e.on("keyup",function(){e.val()!=""?($a.removeClass("e-searchfind"),$a.addClass("e-cancel")):($a.removeClass("e-cancel"),$a.addClass("e-searchfind"))});$a.click(function(){$a.hasClass("e-cancel")&&(e.val(""),$a.removeClass("e-cancel"),$a.addClass("e-searchfind"),u._toolbarOperation(f+"_search",n("#"+f+"_searchInput").val()))});l.insertBefore(u.getHeaderContent())}else u.element.find(".e-responsesearch").css("display")=="block"?u.element.find(".e-responsesearch").css("display","none"):u.element.find(".e-responsesearch").css("display","block");else u._toolbarOperation(f+"_search",n(i.target).hasClass("e-cancel")?"":n(i.currentTarget).find("input").val());break;case f+"_printGrid":u._toolbarOperation(f+"_printGrid");break;case f+"_excelExport":u._toolbarOperation(f+"_excelExport");break;case f+"_wordExport":u._toolbarOperation(f+"_wordExport");break;case f+"_pdfExport":u._toolbarOperation(f+"_pdfExport");break;case f+"_responsiveFilter":u._toolbarOperation(f+"_responsiveFilter");break;case f+"_responsiveSorting":u._toolbarOperation(f+"_responsiveSorting")}return!1}}},_toolbarOperation:function(i,r){var h=this.element,u=h.ejGrid("instance"),o=u.model.editSettings.editMode=="batch",f=h.attr("id"),c,s,e,l,p;u._exportTo=u["export"];switch(i){case f+"_add":o?u._bulkAddRow():u._startAdd();break;case f+"_edit":if(o&&u.model.editSettings.allowEditing){if(u._bulkEditCellDetails.columnIndex==-1){alert(this.localizedLabels.EditOperationAlert);return}c=u.model.columns[u._bulkEditCellDetails.columnIndex].field;c&&u.editCell(u._bulkEditCellDetails.rowIndex,c)}else u.startEdit();break;case f+"_delete":if(this._selectedRow()==-1){alert(this.localizedLabels.DeleteOperationAlert);return}this.model.editSettings.showDeleteConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open"):o?this._bulkDelete():this.multiDeleteMode?this._multiRowDelete():this.deleteRow();break;case f+"_update":o&&n("#"+this._id+"EditForm").children().find(".e-field-validation-error").length==0?this.model.editSettings.showConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.BatchSaveConfirm).end().ejDialog("open"):this.batchSave():u.endEdit();break;case f+"_cancel":o?n("#"+f+"ConfirmDialog").ejDialog("isOpened")===!0?this._triggerConfirm():u.cancelEditCell():u.cancelEdit();break;case f+"_search":args.type=="click"&&(args.target.nodeName=="A"||args.target.nodeName=="SPAN")&&h.ejGrid("search",r);break;case f+"_printGrid":this.print();break;case f+"_excelExport":u._exportTo(u.model.exportToExcelAction,"excelExporting",u.model.allowMultipleExporting);break;case f+"_wordExport":u._exportTo(u.model.exportToWordAction,"wordExporting",u.model.allowMultipleExporting);break;case f+"_pdfExport":u._exportTo(u.model.exportToPdfAction,"pdfExporting",u.model.allowMultipleExporting);break;case f+"_responsiveFilter":n("#responsiveFilter").css("display","block");setTimeout(function(){u.element.css("display","none");0});break;case f+"_responsiveSorting":for(this._sortColumns=[],this._removeSortCol=[],s=0;s<this.model.sortSettings.sortedColumns.length;s++)this._sortColumns.push({field:this.model.sortSettings.sortedColumns[s].field,direction:this.model.sortSettings.sortedColumns[s].direction});if(t.isNullOrUndefined(n("#responsiveSort")[0])){e=n("#responsiveFilter").clone().css("display","block");e.insertAfter(this.element);e.attr("id","responsiveSort");u._setSortingButton();var a=t.buildTag("div.btnContainer","",{width:"100%",bottom:"0px",position:"absolute"}),v=t.buildTag("input.e-resposnsiveFilterBtnLeft e-flat e-btnsub","OK",{width:"45.6%"}),y=t.buildTag("input.e-resposnsiveFilterBtnRight e-flat e-btncan","Cancel",{width:"46%"}),w=t.buildTag("div.e-resFIlterRigthIcon"),b=t.buildTag("span.e-icon e-responsiveClose e-resIcon");e.find(".e-resFilterleftIcon").remove();e.find(".labelRes").text("Sorting");e.find(".e-resFilterDialogHeaderDiv").append(w.append(b));e.find(".e-resFilterDialogHeaderDiv").find(".e-resFIlterRigthIcon").click(function(){n("#responsiveSort").css("display","none");u.element.css("display","block")});l=t.buildTag("div.e-resFilterleftIcon","",{"margin-top":"3%"});p=t.buildTag("span.e-icon e-resIcon e-responsiveSortClear");l.click(function(){e.find(".e-responsivefilterColDiv").find(".e-button").remove();u._setSortingButton(!0);for(var n=0;n<u._sortColumns.length;n++)u._removeSortCol.indexOf(u._sortColumns[n].field)==-1&&u._removeSortCol.push(u._sortColumns[n].field);u._sortColumns=[];u._removeSortCol=[]});e.find(".e-resFilterDialogHeaderDiv").prepend(l.append(p));e.append(a);a.append(v).append(y);v.ejButton({text:"OK",type:"button",click:n.proxy(this._resSortOperation,this)});y.ejButton({text:"Cancel",type:"button",click:function(){n("#responsiveSort").css("display","none");u.element.css("display","block");u._sortColumns=[];e.find(".e-responsivefilterColDiv").find(".e-button").remove();u._setSortingButton()}})}else n("#responsiveSort").find(".e-responsivefilterColDiv").find(".e-button").remove(),this._setSortingButton();n("#responsiveSort").find(".e-responsivefilterColDiv").find(".e-filternone").remove();n("#responsiveSort").css("display","block");setTimeout(function(){u.element.css("display","none");0})}return!1},_resSortOperation:function(){for(var i=[],t=0;t<this.model.sortSettings.sortedColumns.length;t++)i.push(this.model.sortSettings.sortedColumns[t].field);for(t=0;t<i.length;t++)this.removeSortedColumns(i[t]);for(t=0;t<this._sortColumns.length;t++)this.model.allowMultiSorting&&(this.multiSortRequest=!0),this.sortColumn(this._sortColumns[t].field,this._sortColumns[t].direction);n("#responsiveSort").css("display","none");this.element.css("display","block")},_setSortingButton:function(i){var u=n("#responsiveSort"),r=this;this._sortCols=[];t.isNullOrUndefined(u.find(".e-responsivefilterColDiv").find(".e-button")[0])&&u.find(".e-responsivefilterColDiv").each(function(u,f){var l=t.buildTag("div","",{float:"right","margin-right":"2%","margin-top":"-1%"}),o=n(f).attr("ej-MappingName"),h=t.buildTag("button#"+o+".e-sortingBtn e-flat",""),e,c,s;if(n(f).append(l.append(h)),e="None",c="",i)h.ejButton({text:e,type:"button",height:28,width:120,id:o,showRoundedCorner:!0,click:n.proxy(r._resSortButClick,r)});else{for(s=0;s<r.model.sortSettings.sortedColumns.length;s++)r.model.sortSettings.sortedColumns[s].field==o&&(e=r.model.sortSettings.sortedColumns[s].direction=="ascending"?"Ascending":"Descending",c=e=="Ascending"?"e-resIcon e-respponsiveSortingAsc":"e-resIcon e-respponsiveSortingDesc");c!=""?h.ejButton({text:e,type:"button",height:28,width:120,cssClass:"e-resSortIconBtn",id:o,prefixIcon:c,imagePosition:"imageright",contentType:"textandimage",showRoundedCorner:!0,click:n.proxy(r._resSortButClick,r)}):h.ejButton({text:e,type:"button",height:28,cssClass:"e-resSortIconBtn",width:120,id:o,showRoundedCorner:!0,click:n.proxy(r._resSortButClick,r)})}})},_sortOperation:function(t,i){var r,u,f;for(this._removeSortCol.indexOf(t)!=-1&&(this._sortColumns.splice(this._removeSortCol.indexOf(t),0),this._removeSortCol.splice(this._removeSortCol.indexOf(t),0)),r=0;r<this._sortColumns.length;r++)if(this._sortColumns[r].field==t)break;this.model.allowMultiSorting?(this.multiSortRequest=!0,r!=-1&&(this._sortColumns.splice(r,1),this._removeSortCol.indexOf(t)==-1&&this._removeSortCol.push(t))):(n("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-button").removeClass("e-disable"),u=n("#responsiveFilter").find(".e-responsivefilterColDiv").not(".e-responsivefilterColDiv[ej-mappingname='"+t+"']"),f=u.find(".e-button").addClass("e-disable"),f.text("None"),this._sortColumns.length>0&&(this._removeSortCol.push(this._sortColumns[0].field),this._sortColumns=[]));this._sortColumns.push({field:t,direction:i})},_resSortButClick:function(t){var f="",e="",u=t.model.id,i=n("#"+t.model.id).ejButton("instance"),r;if(t.model.text=="None")f="Ascending",e="e-resIcon e-respponsiveSortingAsc",this._sortOperation(u,"ascending");else if(t.model.text=="Ascending")f="Descending",e="e-resIcon e-respponsiveSortingDesc",this._sortOperation(u,"descending");else{for(i.model.text="None",i.model.prefixIcon="",i.type="button",i.model.contentType="text",i._render(),r=0;r<this._sortColumns.length;r++)if(this._sortColumns[r].field==u)break;this._removeSortCol.push(u);this._sortColumns.splice(r,1);n("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-button").removeClass("e-disable");return}i.model.text=f;i.model.prefixIcon="e-resIcon "+e;i.model.imagePosition="imageright";i.model.contentType="textandimage";i._render()},renderDiaglogButton:function(n,i){var r,o,f,e,u;return this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"?r="EditExternalForm_":this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(r="InlineEditForm_",o=t.buildTag("div","","",{id:this._id+"_inlineFormTitle","class":"e-inlineform-titlebar"}),o.appendTo(i)):r="EditDialog_",f=t.buildTag("input.e-save e-button e-btnsub e-flat","",{"margin-left":"30px"},{type:"button",id:r+this._id+"_Save"}),f.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:this.localizedLabels.SaveButton,width:"100"}),e=t.buildTag("input.e-cancel e-button e-btncan e-flat","",{"margin-left":"19px","margin-right":"13px"},{type:"button",id:r+this._id+"_Cancel"}),e.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:this.localizedLabels.CancelButton,width:"100"}),u=this.model.editSettings.editMode!="dialog"&&this.model.editSettings.editMode!="dialogtemplate"?t.buildTag("div","","",{"class":"e-editform-btn"}):t.buildTag("div"),u.append(f),u.append(e),n.appendTo(i),this.model.editSettings.editMode!="dialog"&&this.model.editSettings.editMode!="dialogtemplate"?u.appendTo(i):n.append(u),i},_externalFormPosition:function(){var t=n(this.element).offset(),r=n(this.element).width(),u=n(this.element).height(),i=n("#"+this._id+"_externalEdit");switch(this.model.editSettings.formPosition){case"topright":n(i).find(".e-form-toggle-icon").removeClass("e-bottomleft").addClass("e-topright");n(i).css({left:t.left+r+1+"px",top:t.top+"px",position:"absolute",width:"290px"});n("#"+this._id+"_eFormContent").height("auto");break;case"bottomleft":n(i).find(".e-form-toggle-icon").removeClass("e-topright").addClass("e-bottomleft");n(i).css({left:t.left+"px",top:t.top+u+1+"px"});n("#"+this._id+"_eFormContent").width("100%")}},_setoffsetWidth:function(){var i,r=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):n("#"+this._id+"EditForm"),t;if(this._gridRecordsCount!=0||this.model.groupSettings.groupedColumns.length!=0||this.model.scrollSettings.frozenColumns!=0||this.model.scrollSettings.frozenRows!=0||this.model.editSettings.editMode=="batch")for(i=this.model.editSettings.editMode=="batch"?r.closest("td"):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"?r.find(".e-rowcell").not(".e-unboundcell,.e-templatecell"):r.find("tr").find(".e-rowcell").not(".e-unboundcell,.e-templatecell"),t=0;t<i.length;t++)this._tdsOffsetWidth[t]=i.get(t).offsetWidth},_bulkChangesAcquired:function(){return this.batchChanges.added.length>0||this.batchChanges.changed.length||this.batchChanges.deleted.length?!0:!1},_renderDialog:function(){return t.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none"},{id:this._id+"_dialogEdit"})},getCurrentEditCellData:function(){var r,i,f,u,e,o;if(this.model.isEdit&&n("#"+this._id+"EditForm").length){r=n("#"+this._id+this._bulkEditCellDetails.fieldName.replace(/[^a-z0-9\s_]/gi,""));f=this.model.columns[this._bulkEditCellDetails.columnIndex];switch(this._bulkEditCellDetails.cellEditType){case t.Grid.EditingType.String:case t.Grid.EditingType.Numeric:i=r.val();break;case t.Grid.EditingType.Dropdown:i=this._bulkEditCellDetails.isForeignKey?{value:r.ejDropDownList("getSelectedValue"),text:r.ejDropDownList("getValue")}:r.ejDropDownList("getSelectedValue");this._bulkEditCellDetails.isForeignKey&&f.originalType=="number"&&i.value!=""&&(i.value=JSON.parse(i.value));break;case t.Grid.EditingType.Boolean:i=r.is(":checked");break;case t.Grid.EditingType.DatePicker:e=n.trim(r.val());o=r.ejDatePicker("instance");o._setDateValue(e);i=e==""?e:o.model.value;break;case t.Grid.EditingType.DateTimePicker:i=n.trim(r.val())==""?n.trim(r.val()):r.ejDateTimePicker("model.value");break;case"edittemplate":u=f.editTemplate.read;typeof u=="string"&&(u=t.util.getObject(u,window));i=u(r)}return typeof i=="string"&&i.length&&f.type=="number"&&(i=t.globalize.parseFloat(i,this.model.locale)),i}return null},cancelEditCell:function(){if(this.model.isEdit){var r=this.getRows()[this._bulkEditCellDetails.rowIndex],u={},i;t.createObject(this._bulkEditCellDetails.fieldName,this._bulkEditCellDetails.cellValue,u);i=n(r).hasClass("e-insertedrow")?n(r).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex+this.model.groupSettings.groupedColumns.length):n(r).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex);n(i).removeClass("e-validError");n(i).hasClass("e-updatedtd")&&n(i).addClass("e-gupdatenotify");n(i).removeClass("e-editedbatchcell").empty().html(n(n.templates[this._id+"_JSONTemplate"].render(u)).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex).innerHTML);this.model.isEdit=!1;this.element.focus()}},saveCell:function(i){var l,a,v,o,w,s;if(this.model.isEdit){if(!this.editFormValidate())return!0;var y=n("#"+this._id+"EditForm"),b=y.closest("tr"),k=y.closest("td"),f,e,r={},u=this.model.columns[this._bulkEditCellDetails.columnIndex],p=n("#"+this._id+this._bulkEditCellDetails.fieldName.replace(/[^a-z0-9\s_]/gi,"")),c,h;if(r={columnName:u.field,value:this.getCurrentEditCellData(),rowData:this._bulkEditCellDetails.rowData,previousValue:this._bulkEditCellDetails.cellValue,columnObject:u,cell:k,isForeignKey:this._bulkEditCellDetails.isForeignKey},!i&&this._trigger("cellSave",r)){this._focusElements(r.cell);this._bulkEditCellDetails.cancelSave=!0;return}if(this.model.allowTextWrap&&r.cell.addClass("e-nowrap"),(this._bulkEditCellDetails.cellEditType=="datetimepicker"||this._bulkEditCellDetails.cellEditType=="dropdownedit"||this._bulkEditCellDetails.cellEditType=="datepicker")&&p[p.data("ejWidgets")[0]]("destroy"),t.isNullOrUndefined(u.format)||(u.type!="date"&&u.type!="datetime"||t.isNullOrUndefined(r.value)||(r.isForeignKey?r.value.text=r.value.text.length>0?new Date(r.value.text):r.value.text:r.value=r.value.length>0?new Date(r.value):r.value),e=this.formatting(u.format,r.isForeignKey?!isNaN(parseFloat(r.value.text))&&isFinite(r.value.text)?parseFloat(r.value.text):r.value.text:r.value,this.model.locale),r.cell.empty().html(e)),t.createObject(this._bulkEditCellDetails.fieldName,r.isForeignKey?r.value.value:r.value,r.rowData),t.isNullOrUndefined(u.format)&&(e=r.isForeignKey?r.value.text:r.value),t.isNullOrUndefined(u.template)||(l=t.copyObject({},r.rowData),t.createObject(this._bulkEditCellDetails.fieldName,r.isForeignKey?r.value.value:r.value,l),e=n.templates(u.template).render(l)),this._bulkEditCellDetails.cellEditType=="edittemplate"?(r.value instanceof Array&&(e=r.value.join()),r.cell.empty().html(e)):r.columnObject.type=="boolean"||r.columnObject.editType=="booleanedit"?(a={},t.createObject(r.columnObject.field,r.value,a),r.cell.empty().html(n(n.templates[this._id+"_JSONTemplate"].render(a))[0].cells[this._bulkEditCellDetails.columnIndex].innerHTML)):r.columnObject.editType!="datepicker"&&r.columnObject.editType!="datetimepicker"||t.isNullOrUndefined(u.format)?r.columnObject.disableHtmlEncode?r.cell.text(e).html():r.cell.empty().html(e):r.cell.empty().html(e),r.cell.removeClass("e-validError"),r.cell.hasClass("e-updatedtd")&&r.cell.addClass("e-gupdatenotify"),r.previousValue=t.isNullOrUndefined(r.previousValue)?"":u.type=="date"||u.type=="datetime"?new Date(r.previousValue):r.previousValue,f=r.isForeignKey?r.value.value:r.value,v=!1,o=this.model.editSettings.rowPosition=="bottom"&&this._currentJsonData.length==this._bulkEditCellDetails.rowIndex?this._currentJsonData[this._bulkEditCellDetails.rowIndex-1]:this._currentJsonData[this._bulkEditCellDetails.rowIndex],v=this._currentJsonData.length>0?this._bulkEditCellDetails.type!="date"&&this._bulkEditCellDetails.type!="datetime"||t.isNullOrUndefined(this._bulkEditCellDetails.format)?t.isNullOrUndefined(t.getObject(r.columnName,o))?!t.isNullOrUndefined(f):(this._bulkEditCellDetails.cellEditType=="datepicker"||this._bulkEditCellDetails.cellEditType=="datetimepicker"||this._bulkEditCellDetails.cellEditType=="dropdownedit")&&f instanceof Date&&r.previousValue instanceof Date?f.getTime()!==t.getObject(r.columnName,o).getTime():typeof f=="number"?f!==parseFloat(t.getObject(r.columnName,o)):typeof f=="boolean"?f!=t.getObject(r.columnName,o):f!==t.getObject(r.columnName,o).toString():this._bulkEditCellDetails.cellValue instanceof Date?this.formatting(this._bulkEditCellDetails.format,f)!=this.formatting(this._bulkEditCellDetails.format,t.getObject(r.columnName,o)):!0:!0,this.model.isEdit=!1,v)r.cell.addClass("e-updatedtd e-icon e-gupdatenotify"),this._enableSaveCancel(),c=t.getObject(this._bulkEditCellDetails.fieldName,r.rowData),h=typeof c=="string"&&c.length?r.isForeignKey?r.value.value.toString():r.value.toString():r.isForeignKey?isNaN(parseInt(r.value.value))?r.value.value:parseInt(r.value.value):r.value,typeof r.value!="string"||h.length||(h=null),t.createObject(this._bulkEditCellDetails.fieldName,h,r.rowData),n.inArray(r.rowData,this.batchChanges.changed)==-1&&n.inArray(r.rowData,this.batchChanges.added)==-1&&this.batchChanges.changed.push(r.rowData),this.isejObservableArray&&(w=r.cell.closest("tr").hasClass("e-insertedrow")?"insert":"update",this._refreshViewModel(r,w));else if(r.cell.removeClass("e-updatedtd e-icon e-gupdatenotify"),this._enableSaveCancel(),this.batchChanges.changed.length>0&&!r.cell.hasClass("e-editedbatchcell e-updatedtd e-icon e-gupdatenotify")&&!r.cell.parent().children().hasClass("e-updatedtd e-icon e-gupdatenotify"))for(s=0;s<this.batchChanges.changed.length;s++)r.rowData[this._primaryKeys[0]]==this.batchChanges.changed[s][this._primaryKeys[0]]&&this.batchChanges.changed.splice(s,1);b.removeClass("e-editedrow").removeClass("e-batchrow");r.cell.removeClass("e-editedbatchcell")}},_refreshViewModel:function(i,u){var s,e,f;for(s=this._dataSource()instanceof t.DataManager?this._dataSource():t.DataManager(this._dataSource()),e=new t.Query,f=0;f<this._primaryKeys.length;f++)e=e.where(this._primaryKeys[f],t.FilterOperators.equal,this._primaryKeys.length?t.getObject(this._primaryKeys[f],i.rowData):null);var c=s.executeLocal(e),o=this._dataSource(r,!0),h=n.inArray(c[0],this._dataSource());this.model.editSettings.showConfirmDialog=!1;switch(u){case"update":o(i.rowData,h,u);break;case"remove":o(i.rowData,h,u);break;case"insert":o(i.rowData,0,u)}},_enableSaveCancel:function(){if(this.model.toolbarSettings.showToolbar){var n=this.getContentTable().find(".e-updatedtd.e-icon.e-gupdatenotify").length>0||this._isBatchDeleteApplied?"enableItemByID":"disableItemByID";$toolBar=this.element.find("#"+this._id+"_toolbarItems");$toolBar.ejToolbar(n,this._id+"_update");$toolBar.ejToolbar(n,this._id+"_cancel")}},setCellText:function(i,u,f){var v=typeof u=="string",nt=this._excludeDetailRows(),o,tt=this.model.groupSettings.groupedColumns.length!=0,h=this.model.scrollSettings.allowVirtualScrolling,e=this[v?"getColumnByField":"getColumnByIndex"](u),y=t.getObject(["currentViewData",tt?".records":""].join(""),this.model),c={},it=h?this._dataManager:new t.DataManager(y),l=this._primaryKeys[0],b=v||t.getObject(i+"."+l,h?this._dataManager.dataSource.json:y),rt=f,k=!1,a,d,p,w,ut,s,g;t.createObject(e.field,f,c);v&&(b=i,i=it.executeLocal((new t.Query).select(l)).indexOf(i),u=this.getColumnIndexByField(e.field));h&&(a=this.model.pageSettings.pageSize,w=i%a,d=(i+a-w)/a,p=(d-1)*a,isCached=n.inArray(p,this.virtualLoadedPages)!=-1,isCached&&(o=this.getContentTable().find("tr[name="+p+"]")[w].cells[u]));ut=this._excludeDetailRows()[i];s=this;t.isNullOrUndefined(e)||e.isPrimaryKey||e.allowEditing==!1||(t.isNullOrUndefined(e.validationRules)||($form=t.buildTag("form","",{},{id:this._id+"EditForm"}),$valElem=t.buildTag("input","",{},{id:this._id+e.field,value:f}),$form.addClass("gridform"),$form.append($valElem),this.element.append($form),$form.validate({errorPlacement:function(t){return s._alertDialog||s._renderAlertDialog(),n("#"+s._id+"AlertDialog_wrapper").css("min-height",""),s._alertDialog.find(".e-content").text(t.text()),s._alertDialog.ejDialog("open"),s.element.find($form).remove(),k=!0,!0}}),this.setValidationToField(e.field,e.validationRules)),t.isNullOrUndefined(e.format)||(g=this.formatting(e.format,e.foreignKeyValue?!isNaN(parseFloat(f))&&isFinite(f)?parseFloat(f):f:f,this.model.locale),rt=g),t.isNullOrUndefined(e.validationRules)||(n($form).validate().form(),this.element.find($form).remove()),k||(canSkip=i==-1||u==-1||h&&!isCached||i>(h?this._dataSource():y).length||u>this.model.columns.length,canSkip||(o=this.model.scrollSettings.frozenColumns?this._frozenCell(i,u)[0]:o||this._excludeDetailCells(nt[i])[u],f=e.format===r?f:this.formatting(e.format,f,this.model.locale),t.isNullOrUndefined(e.foreignKeyField)||t.isNullOrUndefined(e.foreignKeyValue)||(f=this._getForeignKeyData(c)[e.foreignKeyField][e.foreignKeyValue]),e.disableHtmlEncode?n(o).text(f):o.innerHTML=f,this._trigger("queryCellInfo",{cell:o,text:o.innerHTML,column:e,data:c})),l&&(t.createObject(l,b,c),this._dataManager.update(l,c))))},_excludeDetailCells:function(i){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)?n(i.cells):n(i.cells).not(".e-detailrowexpand, .e-detailrowcollapse")},setCellValue:function(i,u,f){var y;if(n("#"+this._id+"EditForm").length>0&&n("#"+this._id+"EditForm").attr("id","EditForm1"),this.model.editSettings.editMode=="batch"&&!this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.frozenColumns){var c=this.getDataByIndex(i),l=this._excludeDetailRows()[i],a=this.getColumnIndexByField(u),s=this,h=f,v=!1,e=this.getColumnByField(u),o;if(o=n(l).hasClass("e-insertedrow")?n(l.cells).not(".e-detailrowcollapse, .e-detailrowexpand")[a+this.model.groupSettings.groupedColumns.length]:n(l.cells).not(".e-detailrowcollapse, .e-detailrowexpand")[a],!t.isNullOrUndefined(e)&&!e.isPrimaryKey&&e.allowEditing!=!1){if(t.isNullOrUndefined(e.validationRules)||($form=t.buildTag("form","",{},{id:this._id+"EditForm"}),$valElem=t.buildTag("input","",{},{id:this._id+e.field,value:f}),$form.append($valElem),this.element.append($form),$form.validate({errorPlacement:function(t){return s._alertDialog||s._renderAlertDialog(),n("#"+s._id+"AlertDialog_wrapper").css("min-height",""),s._alertDialog.find(".e-content").text(t.text()),s._alertDialog.ejDialog("open"),s.element.find($form).remove(),v=!0,!0}}),this.setValidationToField(e.field,e.validationRules)),e.foreignKeyValue&&(h=this._foreignKeyBinding(a,f,this._id),h==r)){this._alertDialog||this._renderAlertDialog();n("#"+this._id+"AlertDialog_wrapper").css("min-height","");this._alertDialog.find(".e-content").text(this.localizedLabels.ForeignKeyAlert);this._alertDialog.ejDialog("open");t.isNullOrUndefined(e.validationRules)||this.element.find($form).remove();return}t.isNullOrUndefined(e.format)||(y=this.formatting(e.format,e.foreignKeyValue?!isNaN(parseFloat(f))&&isFinite(f)?parseFloat(f):f:f,this.model.locale),h=y);t.isNullOrUndefined(e.validationRules)||(n($form).validate().form(),this.element.find($form).remove());n("#EditForm1").attr("id",this._id+"EditForm");v||o.innerHTML==h||(n(o).has("form").length>0&&(this.model.isEdit=!1),n(o).hasClass("e-boolrowcell")?n(o).find("input").attr("checked",h):o.innerHTML=h,n(o).addClass("e-updatedtd e-icon e-gupdatenotify"),n(o).removeClass("e-validError e-editedbatchcell"),t.createObject(u,f,c),n.inArray(c,this.batchChanges.changed)==-1&&this.batchChanges.changed.push(c),this._enableSaveCancel())}}},setDefaultData:function(i){var e,h,o,u,f,c;if(t.isNullOrUndefined(i)){for(e=[],h=this.model.columns,o=0;o<this.model.columns.length;o++)e.push(this.model.columns[o].field);for(t.isNullOrUndefined(this._bulkEditCellDetails._data)&&(this._bulkEditCellDetails._data=[]),i={},u=function(n,r){t.createObject(n,r,i)},f=0;f<e.length;f++){var s=f,r=e[f],l=h[f].type,a=t.getObject(r,this._bulkEditCellDetails._data[0]),v=t.isNullOrUndefined(this.model.parentDetails)?null:this.model.parentDetails.parentKeyField;if(r===v&&(this.model.columns[s].defaultValue=this.model.parentDetails.parentKeyFieldValue),t.isNullOrUndefined(this.model.columns[s].defaultValue))switch(l){case"number":u(r,0);break;case"string":u(r,null);break;case"boolean":u(r,!1);break;case"object":n.isArray(a)?u(r,[]):u(r,null);case"datetime":case"date":u(r,null)}else u(r,this.model.columns[s].defaultValue)}t.isNullOrUndefined(this.model.queryString)||(c=this.model.foreignKeyField||this.model.queryString,i[c]=this.model.parentDetails.parentRowData[this.model.queryString])}this._bulkEditCellDetails.defaultData=i},_bulkDelete:function(i){if(this.model.editSettings.allowDeleting){if(t.isNullOrUndefined(i)&&(i=this._selectedRow()),i==-1){alert(this.localizedLabels.DeleteOperationAlert);return}var e,r,u,f={};if(this.multiDeleteMode&&this.selectedRowsIndexes.length>1?(u=[],r=this.getSelectedRows(),Array.prototype.push.apply(u,this.getSelectedRecords()),Array.prototype.push.apply(this.batchChanges.deleted,this.getSelectedRecords())):(e=this.getRows()[i],r=n(e),u=this.getDataByIndex(i)),f={primaryKey:this._primaryKeys,rowIndex:i,rowData:u,row:r},this._trigger("beforeBatchDelete",f))return;this.isejObservableArray&&this._refreshViewModel(f,"remove");this.model.isEdit&&this.cancelEditCell();r.hasClass("e-insertedrow")?(r.remove(),i=n.inArray(e,this._bulkEditCellDetails.insertedTrCollection),i!=-1&&(this._bulkEditCellDetails.insertedTrCollection.splice(i,1),this.batchChanges.added.splice(i,1))):(r.hide(),(f.rowIndex==0||r.hasClass("e-firstrow"))&&(r.hasClass("e-firstrow")&&this.getContentTable().find("tr").removeClass("e-firstrow"),this.getContentTable().find("tr:visible").first().addClass("e-firstrow")),n.isArray(u)||this.batchChanges.deleted.push(u));this._gridRows=this.getContentTable().find("td.e-rowcell").closest("tr").toArray();this.model.allowScrolling&&this._refreshScroller(f);this._isBatchDeleteApplied=!0;this._enableSaveCancel();this._selectedRow(-1);f={primaryKey:this._primaryKeys,rowIndex:i,rowData:u};this._trigger("batchDelete",f)}},_bulkAddRow:function(i){var h=n("#"+this._id+"EditForm"),r,u,f,e,o,s;if(h.length&&!this.editFormValidate())return!0;if(this.model.editSettings.allowAdding){if(r={},e=this.getRows(),t.isNullOrUndefined(i)||(this._bulkEditCellDetails.defaultData=i),t.isNullOrUndefined(this._bulkEditCellDetails.defaultData)&&this.setDefaultData(),r={defaultData:n.extend(!0,{},this._bulkEditCellDetails.defaultData),primaryKey:this._primaryKeys},this._trigger("beforeBatchAdd",r))return;for(u=n(n.render[this._id+"_JSONTemplate"](r.defaultData)).addClass("e-insertedrow"),e!=null&&n(e[0]).hasClass("e-alt_row")&&u.removeClass("e-alt_row"),this.model.editSettings.rowPosition=="top"?this.getContentTable().first().find("tbody").first().prepend(u):this.model.editSettings.rowPosition=="bottom"&&this.getContentTable().first().find("tbody").first().append(u),this.model.allowScrolling&&this._refreshScroller(r),this._gridRecordsCount===0&&this.getContentTable().find("tbody .emptyrecord").first().remove(),this._gridRows=this.getContentTable().find("td.e-rowcell").closest("tr").toArray(),o=0;o<this.model.groupSettings.groupedColumns.length;o++)u.prepend(t.buildTag("td.e-indentcell"));this._bulkEditCellDetails.insertedTrCollection.push(u.get(0));this.batchChanges.added.push(r.defaultData);s=this._gridRows.length-1;this.model.editSettings.rowPosition=="bottom"?(f=this._findNextEditableCell(0),this.selectRows(s),this.editCell(s,this.model.columns[f].field)):(f=this._findNextEditableCell(0),this.selectRows(0),this.editCell(0,this.model.columns[f].field));u.find(".e-rowcell").addClass("e-updatedtd e-icon e-gupdatenotify");this._enableSaveCancel();r={defaultData:r.defaultData};n.extend(r,{columnObject:this.model.columns[f],columnIndex:f,row:u,primaryKey:this._primaryKeys,cell:n(u[0].cells[f])});this._trigger("batchAdd",r)}},getDataByIndex:function(t){var i=n(this._excludeDetailRows()[t]),r;return i.hasClass("e-insertedrow")?(r=n.inArray(i[0],this._bulkEditCellDetails.insertedTrCollection),this.batchChanges.added[r]):this._bulkEditCellDetails._data[this.model.editSettings.rowPosition=="top"?t-this._bulkEditCellDetails.insertedTrCollection.length:t]},refreshBatchEditChanges:function(){this._bulkEditCellDetails={cellValue:null,rowIndex:-1,_data:null,columnIndex:-1,fieldName:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],rowData:null,isForeignKey:!1};this.batchChanges={added:[],deleted:[],changed:[]}},refreshBatchEditMode:function(){this.model.editSettings.editMode=="batch"&&(this.refreshBatchEditChanges(),this._bulkEditCellDetails._data=n.extend(!0,[],this.getCurrentViewData()))},batchCancel:function(){this.cancelEdit()},batchSave:function(){var n={},t=this;(this.saveCell(),n.batchChanges=this.getBatchChanges(),this._trigger("beforeBatchSave",n))||(n={},n.requestType="batchsave",this._sendBulkReuqest(this.getBatchChanges(),n))},_sendBulkReuqest:function(n,i){var r=this._dataManager.saveChanges(n,this._primaryKeys[0],this.model.query._fromTable,this.model.query),u=this;this._isBatchDeleteApplied=!1;this._dataManager instanceof t.DataManager&&!this._dataManager.dataSource.offline?(r.done(function(){u._processBindings(i)}),r.fail(function(n){var t={error:n.error};u._trigger("actionFailure",t)})):this._processBindings(i)},getBatchChanges:function(){return this.batchChanges},editCell:function(i,u){var c;if(!this.element.ejWaitingPopup("model.showOnInit")&&this.model.editSettings.allowEditing&&n.inArray(u,this._disabledEditableColumns)==-1){if(c=n("#"+this._id+"EditForm"),this.model.isEdit&&this.saveCell(),n.isFunction(n.validator)&&c.length&&c.validate().errorList.length)return;var o=n(this._excludeDetailRows()[i]),s=this.getColumnIndexByField(u),a=o.find(".e-rowcell").eq(s),e=this.model.columns[s],h=this.getDataByIndex(i),f={validationRules:t.isNullOrUndefined(e.validationRules)?{}:n.extend(!0,{},e.validationRules),columnName:e.field,value:t.getObject(t.isNullOrUndefined(u)?"":u,h),rowData:h,row:o,primaryKey:this._primaryKeys,columnObject:e,cell:a,isForeignKey:!t.isNullOrUndefined(e.foreignKeyValue)&&this.model.editSettings.editMode=="batch"?!0:!1},l=!0;if(this.model.allowTextWrap&&this.element.find(".e-rowcell").removeClass("e-nowrap"),this.model.allowScrolling&&this._refreshScroller(f),this._batchEditRowData=h,this._trigger("cellEdit",f))return;o.hasClass("e-insertedrow")&&(f.requestType="add");(n.inArray(u,this._primaryKeys)!=-1||f.columnObject.allowEditing===!1||(f.columnObject.template||f.columnObject.type=="checkbox")&&(f.columnObject.allowEditing==!1||!f.columnObject.field)||f.columnObject.commands)&&(n.extend(this._bulkEditCellDetails,{cellValue:f.value,rowIndex:i,fieldName:u,rowData:f.rowData,columnIndex:s,isForeignKey:t.isNullOrUndefined(f.columnObject.foreignKeyValue)?!1:!0}),l=!1);o.hasClass("e-insertedrow")&&f.columnObject.isPrimaryKey&&(l=!0);l&&(n.extend(this._bulkEditCellDetails,{rowIndex:i,cellValue:f.value,columnIndex:s,format:e.format==r?null:e.format,type:e.type,fieldName:u,cellEditType:f.columnObject.editType,rowData:h,isForeignKey:t.isNullOrUndefined(f.columnObject.foreignKeyValue)?!1:!0}),this._renderBulkEditObject(f,a),o.addClass("e-editedrow").addClass("e-batchrow"),f.cell.addClass("e-editedbatchcell"),f.columnObject.editType=="booleanedit"&&f.cell.addClass("e-boolrowcell"))}},_findNextEditableCell:function(n){for(var i=this.model.columns.length,t=n;t<i;t++)if(!this.model.columns[t].template&&!this.model.columns[t].commands&&this.model.columns[t].visible)return t;return-1},_findNextCell:function(i,r){var e,u=[],f,o=this.getRows();return this.model.columns[i].template&&(this.model.columns[i].__isTemplate=!0),this.model.columns[i].commands&&(this.model.columns[i].__isCommand=!0),f=t.Predicate("visible","equal",!0).and("__isTemplate","notequal",!0).and("__isCommand","notequal",!0),n(o[this._bulkEditCellDetails.rowIndex]).hasClass("e-insertedrow")||(f=f.and("allowEditing","notequal",!1)),e=r=="right"?this.model.columns.slice(i):this.model.columns.slice(0,i+1).reverse(),u=t.DataManager(e).executeLocal(t.Query().where(f)),u.length!=0||r=="left"&&this._bulkEditCellDetails.rowIndex==0||r=="right"&&this._bulkEditCellDetails.rowIndex+1==this.getRows().length||(e=r=="right"?this.model.columns.slice(0,i):this.model.columns.slice(i).reverse(),u=t.DataManager(e).executeLocal(t.Query().where(f)),this._bulkEditCellDetails.rowIndex=u.length&&r=="right"?this._bulkEditCellDetails.rowIndex+1:this._bulkEditCellDetails.rowIndex-1),u.length?n.inArray(u[0],this.model.columns):-1},_moveCurrentCell:function(i){var r,u=this._bulkEditCellDetails.rowIndex,f=n("#"+this._id+"EditForm");if(this._bulkEditCellDetails.rowIndex==-1&&this._bulkEditCellDetails.columnIndex==-1)return!0;switch(i){case"right":if(this._bulkEditCellDetails.rowIndex==this.getRows().length-1&&this._bulkEditCellDetails.columnIndex==this.model.columns.length-1||!this.element.is(document.activeElement)&&f.length==0)return!0;this._bulkEditCellDetails.columnIndex==this.model.columns.length-1?(r=0,this._bulkEditCellDetails.rowIndex=this._bulkEditCellDetails.rowIndex+1):r=this._bulkEditCellDetails.columnIndex+1;(t.isNullOrUndefined(this.model.columns[r].template)||!t.isNullOrUndefined(this.model.columns[r].field))&&t.isNullOrUndefined(this.model.columns[r].commands)&&this.model.columns[r].visible!==!1&&this.model.columns[r].allowEditing!==!1||(r=this._findNextCell(r,i));this._bulkEditCellDetails.rowIndex!=u&&this.selectRows(this._bulkEditCellDetails.rowIndex);r!=-1&&this.editCell(this._bulkEditCellDetails.rowIndex,this.model.columns[r].field);break;case"left":if(this._bulkEditCellDetails.rowIndex==0&&this._bulkEditCellDetails.columnIndex==0||!this.element.is(document.activeElement)&&f.length==0)return!0;this._bulkEditCellDetails.columnIndex==0?(r=this.model.columns.length-1,this._bulkEditCellDetails.rowIndex=this._bulkEditCellDetails.rowIndex-1,this.selectRows(this._bulkEditCellDetails.rowIndex)):r=this._bulkEditCellDetails.columnIndex-1;(t.isNullOrUndefined(this.model.columns[r].template)||!t.isNullOrUndefined(this.model.columns[r].field))&&t.isNullOrUndefined(this.model.columns[r].commands)&&this.model.columns[r].visible!==!1&&this.model.columns[r].allowEditing!==!1||(r=this._findNextCell(r,i));this._bulkEditCellDetails.rowIndex!=u&&this.selectRows(this._bulkEditCellDetails.rowIndex);r!=-1&&this.editCell(this._bulkEditCellDetails.rowIndex,this.model.columns[r].field);break;case"up":if(this._bulkEditCellDetails.rowIndex==0)return;r=this._bulkEditCellDetails.columnIndex;this._enableCheckSelect||this.selectRows(this._bulkEditCellDetails.rowIndex-1);this.editCell(this._bulkEditCellDetails.rowIndex-1,this.model.columns[this._bulkEditCellDetails.columnIndex].field);break;case"down":if(this._bulkEditCellDetails.rowIndex==this.getRows().length-1){this.endEdit();return}r=this._bulkEditCellDetails.columnIndex;this._enableCheckSelect||this.selectRows(this._bulkEditCellDetails.rowIndex+1);this._bulkEditCellDetails.columnIndex!=-1&&this.editCell(this._bulkEditCellDetails.rowIndex+1,this.model.columns[this._bulkEditCellDetails.columnIndex].field)}return addedRow=!n(this.getRows()[this._bulkEditCellDetails.rowIndex]).hasClass("e-insertedrow"),r!=-1&&(this.model.columns[r].commands||this.model.columns[r].isPrimaryKey&&addedRow||this.model.columns[r].template)&&this.element.focus(),!1},_renderBulkEditObject:function(i,r){var o=t.buildTag("form","",{},{id:this._id+"EditForm"}),c=this._bulkEditTemplate,l=this._id+i.columnObject.field,u,s,e={},h,f;t.createObject(i.columnObject.field,i.value,e);h={requestType:i.requestType};r.empty();r.parent().is(":last-child")||(r.addClass("e-validError"),r.removeClass("e-gupdatenotify"));s=c.find("#"+i.columnObject.field.replace(/\./g,t.pvt.consts.complexPropertyMerge)+"_BulkEdit").html();u=n(n.templates(s).render(e));u.get(0).tagName=="SELECT"&&(f=t.getObject(i.columnObject.field,e),u.val(t.isNullOrUndefined(f)?"":f.toString()),u.val()==null&&u.val(u.find("option").first().val()),u.data("ej-value",f));o.append(u);r.append(o);this._setoffsetWidth();this._refreshEditForm(h);n.isFunction(n.validator)&&!n.isEmptyObject(i.validationRules)&&(this.initValidator(),this.setValidationToField(i.columnObject.field,i.validationRules));this.model.isEdit=!0},_triggerConfirm:function(n){if(n!==r&&n.model.text==this._getDeprecatedLocalizedLabel("OKButton"))this._confirmDialog.find(".e-content").text()==this.localizedLabels.BatchSaveConfirm?this.batchSave():this._confirmDialog.find(".e-content").text()==this.localizedLabels.ConfirmDelete?this.model.editSettings.editMode=="batch"?this._bulkDelete():this.multiDeleteMode?this._multiRowDelete():t.isNullOrUndefined(this._cDeleteData)?this.deleteRow():(this.deleteRow(this._cDeleteData),this._cDeleteData=null):this._confirmDialog.find(".e-content").text()==this.localizedLabels.CancelEdit?this.cancelEdit():(this._confirmedValue=!0,this._processBindings(this._requestArgs)),this._isBatchDeleteApplied=!1,this.clearSelection();else{if(this._confirmDialog.find(".e-content").text()!=this.localizedLabels.BatchSaveConfirm&&this._confirmDialog.find(".e-content").text()!=this.localizedLabels.ConfirmDelete&&this._confirmDialog.find(".e-content").text()!=this.localizedLabels.CancelEdit)switch(this._requestArgs.requestType){case"grouping":this.model.groupSettings.groupedColumns.pop();break;case"ungrouping":this.model.groupSettings.groupedColumns.push(this._requestArgs.columnName);break;case"sorting":this._cSortedDirection=this._cSortedColumn=null;break;case"filtering":this.model.filterSettings.filteredColumns.reverse().splice(0,this._requestArgs.currentFilterObject);this.model.filterSettings.filteredColumns.reverse();break;case"paging":this._currentPage(this._requestArgs.previousPage);this.getPager().ejPager("model.currentPage",this._requestArgs.previousPage)}this._confirmedValue=!1}this._requestArgs=null;this._confirmDialog.ejDialog("close")},_batchCellValidation:function(n){var r=this.getRowByIndex(n),t;if(this.model.editSettings.editMode=="batch"&&this.model.isEdit&&r.hasClass("e-insertedrow"))for(i=0;i<this._validatedColumns.length;i++){if(t=this.getColumnIndexByField(this._validatedColumns[i]),!this.editFormValidate())return!0;this.editCell(n,this.model.columns[t].field)}},_saveCellHandler:function(t){var i=n(t.target),r;t.stopPropagation();r=this.model.editSettings.rowPosition=="top"||this._gridRows==null?0:this._gridRows.length-1;i.closest(".e-popup").length==0&&i.closest(".e-rowcell").find("#"+this._id+"EditForm").length==0&&(n(this.getRows()).hasClass("e-insertedrow")&&this._batchCellValidation(r),this.saveCell())},initValidator:function(){for(var r=this,i=this.model.scrollSettings.frozenColumns>0||this.model.editSettings.showAddNewRow?this.element.find(".gridform"):n("#"+this._id+"EditForm"),t=0;t<i.length;t++)i.eq(t).validate({ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(n,t){r._renderValidator(n,t)}})},_renderValidator:function(i,r){var v,w,y,d,g,nt;if(r.is(":hidden")&&(r=r.siblings("input:visible")),r.length){var f=r.closest(".e-rowcell"),e=n(i).addClass("e-error"),l=t.buildTag("div.e-errortail e-toparrow"),u=t.isNullOrUndefined(this.getContent().data("ejScroller"))?null:this.getScrollObject(),p=0;f=f.length?f:f=r.closest("td");f.find(".e-error").remove();r.parent().hasClass("e-in-wrap")?e.insertAfter(r.closest(".e-widget")):e.insertAfter(r);v=this.model.scrollSettings.frozenRows>0&&this._currentTrIndex>=this.model.scrollSettings.frozenRows?!0:!1;w=v?"append":"prepend";e[w](l);this.model.allowScrolling&&(u&&u._hScrollbar||u._vScrollbar)&&(f.addClass("e-validError"),p=u._hScrollbar?u._hScrollbar.element[0].offsetTop:0);var o=f.offset().top+f[0].offsetHeight+i[0].offsetHeight,a=!1,b=u&&u._hScrollbar?u._hScrollbar.model.height:0;if((u&&u.isHScroll()&&o>p||o>this.getContent()[0].offsetTop+this.getContent().find(".e-content").height())&&(a=!0),this.model.enableRTL?this.model.editSettings.editMode!="dialog"&&e.offset({top:r.offset().top+r.height()}):this.model.editSettings.editMode!="dialog"&&e.offset({left:r.offset().left,top:r.offset().top+r.height()}),this.model.scrollSettings.frozenRows<=0&&n.inArray(this.model.editSettings.editMode,["externalform","externalformtemplate","dialog","dialogtemplate"])==-1){var k=this.getContent(),h=k.find(".e-content"),c=h.height(),s=k[0].offsetTop;if(a&&u!=null&&u._vScrollbar&&this.model.scrollSettings.frozenColumns){var rt=u._vScrollbar.model.value-(o-(s+h[0].scrollHeight)),tt=s+h[0].scrollHeight,it=s+c;(!this.model.scrollSettings.frozenColumns&&o>tt||this.model.scrollSettings.frozenColumns&&o>it)&&(u._vScrollbar.model.maximum+=o-(s+c),u._vScrollbar.refresh(!0));this.model.scrollSettings.frozenColumns&&(y=this.getContent().find(".e-movablecontent"),y.height(y[0].scrollHeight));u.scrollY(r.offset().top-s+h[0].scrollTop)}else a&&this.model.allowScrolling&&u!=null&&(u.isVScroll()?u.isVScroll()&&(u.refresh(),this._showHideScroller(),u._vScroll&&(g=u._vScrollbar.model.value+(o-(s+c+b-b)),u.scrollY(g))):(d=o-(s+c),h.height(c+d)))}else v&&(a?(nt=e.css("top"),l.addClass("e-bottomarrow"),e.css({bottom:nt,top:"auto"})):l.prependTo(l.parent()));e.show("slow")}},setValidation:function(){for(var n=0;n<this.model.columns.length;n++)t.isNullOrUndefined(this.model.columns[n].validationRules)||this.setValidationToField(this.model.columns[n].field,this.model.columns[n].validationRules)},setValidationToField:function(i,r){var u=i,f,o,s,e;t.isNullOrUndefined(i)||(u=u.replace(/[^a-z0-9\s_]/gi,""));o=this.model.editSettings.editMode=="batch"?this.element.find("#"+this._id+"EditForm"):this.model.editSettings.showAddNewRow?n(this.getRows()).hasClass("e-editedrow")?this.element.find(".e-editedrow .gridform"):this.element.find(".e-addedrow .gridform"):this.element.find(".gridform");f=o.find("#"+this._id+u).length>0?o.find("#"+this._id+u):o.find("#"+u);r.regex&&(r[i+"regex"]=r.regex,delete r.regex,n.validator.addMethod(u+"regex",function(n,t,i){var r=i instanceof RegExp?i:new RegExp(i);return r.test(n)},t.getObject("messages.regex",r)||this.getColumnByField(i).headerText+" should match the given pattern"));f.attr("name")||f.attr("name",i);f.rules("add",r);s=n("#"+this._id+"EditForm").validate();s.settings.messages[i]=s.settings.messages[i]||{};t.isNullOrUndefined(r.required)||(e=t.isNullOrUndefined(r.messages&&r.messages.required)?n.validator.messages.required:r.messages.required,e.indexOf("This field")==0&&(e=e.replace("This field",this.getColumnByField(i).headerText)),s.settings.messages[i].required=e,f.hasClass("e-datepicker")&&f.ejDatePicker({watermarkText:""}))},_renderConfirmDialog:function(){var r=t.buildTag("div.e-content",this.localizedLabels.BatchSaveConfirm),i=t.buildTag("span.e-buttons",'<input type="button" class="e-flat e-btnsub" id='+this._id+'ConfirmDialogOK value="'+this._getDeprecatedLocalizedLabel("OKButton")+"\" /> <input type='button' class='e-flat e-btncan' id="+this._id+"ConfirmDialogCancel value='"+this.localizedLabels.CancelButton+"' />");this._confirmDialog=t.buildTag("div#"+this._id+"ConfirmDialog",{float:"left"});this._confirmDialog.append(r).append(i);this.element.append(this._confirmDialog);i.find("input").ejButton({cssClass:this.model.cssClass,showRoundedCorner:!0,size:"mini",click:n.proxy(this._triggerConfirm,this)});this._renderFDialog(this._id+"ConfirmDialog");this._confirmDialog.ejDialog({width:"auto",minWidth:0,minHeight:0,enableModal:!0})},_unboundClickHandler:function(i){var r=n(i.target).closest("button"),e,o,u,s,h,f,c,l;if((!r.hasClass("e-button")||!(r.hasClass("e-disable")||r.prop("disabled")))&&r.closest(".e-grid").attr("id")===this._id&&(e=0,o={},!n(i.target).hasClass("e-unboundcelldiv"))){if(u=r.hasClass("e-savebutton")?this.getIndexByRow(n(".e-editedrow")):this.getIndexByRow(r.closest("tr")),this.model.isEdit&&(!this._isLocalData||this._isRemoteSaveAdaptor)&&r.hasClass("e-editbutton")){this._unboundRow=r.closest("tr");return}if(s=this._currentJsonData[u],h=n(r).ejButton("instance"),(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlinetemplate")&&(e=n("#"+this._id).find(".e-editedrow").length),this.model.allowSelection&&!this.model.isEdit&&this.selectRows(this.getIndexByRow(r.closest("tr"))-e),r.hasClass("e-cancelbutton")&&(this.model.isEdit=!1),n.isFunction(n.fn.ejDatePicker)&&n("#"+this._id+"EditForm").find(".e-datepicker").ejDatePicker("hide"),r.hasClass("e-editbutton")&&this.model.editSettings.editMode!="batch")this.model.isEdit&&this.cancelEdit(),f=this.getRowByIndex(u),this.startEdit(f);else if(r.hasClass("e-deletebutton")){if(f=this.getRowByIndex(u),this.model.editSettings.showDeleteConfirmDialog&&!this._isUnboundColumn){this._toolbarOperation(this._id+"_delete");return}this.deleteRow(f)}else r.hasClass("e-savebutton")?(this.endEdit(),s=this._currentJsonData[u]):r.hasClass("e-cancelbutton")&&this.cancelEdit();o={rowIndex:u,data:s,buttonModel:h.model,commandType:r.val()};t.raiseWebFormsServerEvents&&(c={model:this.model,originalEventType:"commandButtonClick"},l=o,t.isNullOrUndefined(this.model.serverEvents)||n.inArray("commandButtonClick",this.model.serverEvents)==-1||t.raiseWebFormsServerEvents("commandButtonClick",c,l))}},addRecord:function(n,i){var u,r;this.model.editSettings.allowAdding&&this.element.find(".e-gridcontent .gridform").length==0&&(n?((this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")&&(u=t.buildTag("tr.e-addedrow"),this.getContentTable().find("tbody").first().prepend(u)),r={data:n},r.action="add",r.selectedRow=this._selectedRow(),this._cAddedRecord=n,r.requestType=t.Grid.Actions.Save,this._updateAction(r),r.selectedRow!=-1&&this.selectRows(r.selectedRow+1),this._isUnboundColumn&&this._refreshUnboundTemplate(this.getContentTable()),i||(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")&&this.model.allowPaging&&this.model.pageSettings.pageSize<this.model.currentViewData.length&&this.model.groupSettings.groupedColumns.length==0&&!this.model.editSettings.showAddNewRow&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild)):this._startAdd())},updateRecord:function(n,i){this._updateDeleteRecord(n,i,"update");this.model.editSettings.editMode!="batch"&&(this.model.sortSettings.sortedColumns.length||this.model.summaryRows.length>0||this.model.groupSettings.groupedColumns.length||!t.isNullOrUndefined(this._searchCount)||this.filterColumnCollection.length)&&this.refreshContent()},_updateDeleteRecord:function(i,r,u){var l=t.DataManager(this._currentJsonData),e=[],f,s,h,o,c;t.isNullOrUndefined(i)||(e=l.executeLocal(t.Query().where(i,t.FilterOperators.equal,t.getObject(i,r))));e.length?(f=n.inArray(e[0],this._currentJsonData),o={data:r,requestType:t.Grid.Actions.Save,previousData:e[0],rowIndex:f},c=this._getForeignKeyData(o.data),t.isNullOrUndefined(c)||(o.foreignKeyData=c),this._trigger("actionBegin",o),f!=-1&&(s=this.getRowByIndex(f),u=="update"?(t.copyObject(e[0],r),h=n(n.render[this._id+"_JSONTemplate"](e)),s.hasClass("e-alt_row")?h.addClass("e-alt_row"):h.removeClass("e-alt_row"),s.replaceWith(h),this._trigger("actionComplete",o),this._isUnboundColumn&&this._refreshUnboundTemplate(this.getContentTable()),this.model.editSettings.editMode=="batch"?this.batchChanges.changed.push(e[0]):this._dataManager[u](i,r),this._isMapSelection&&(this._selectionByGrid=!0,this.multiSelectCtrlRequest=!0,r[this._selectionMapColumn]?this.selectRows(f):this.clearSelection(f),this._selectionByGrid=!1)):(n.inArray(f,this.selectedRowsIndexes)==-1&&this.selectedRowsIndexes.push(f),this.deleteRow(s)),this.model.editSettings.editMode=="batch"&&(this.batchSave(),this._confirmedValue=!0))):this.model.editSettings.editMode=="batch"?(this.batchChanges[u=="update"?"changed":"deleted"].push(r),this.batchSave(),this._confirmedValue=!0):this._dataManager[u](i,r)},deleteRecord:function(n,t){this._updateDeleteRecord(n,t,"remove")}}}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.sort={_addSortElementToColumn:function(i,r){var h=t.DataManager(this.model.columns).executeLocal(t.Query().where("field","equal",i)),f,o,e,s;if(o=h.length>1?this.getColumnByHeaderText(this._$curSElementTarget.text()):this.getColumnByField(i),!t.isNullOrUndefined(o)){var c=n.inArray(o,this.model.columns),l=this.getsortColumnByField(i),a=n.inArray(l,this.model.sortSettings.sortedColumns),u=this.getHeaderTable().find("thead tr:not('.e-stackedHeaderRow')").find(".e-headercell").not(".e-detailheadercell").eq(c).find(".e-headercelldiv");if(r=t.isNullOrUndefined(r)?"ascending":r.toLowerCase(),u.find(".e-ascending,.e-descending").remove(),this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i+"']").find(".e-ascending,.e-descending").not(".e-ungroupbutton").remove(),f=r!="descending"?"e-rarrowup-2x":"e-rarrowdown-2x",e=1,this.model.allowSorting&&this.model.allowMultiSorting&&this.model.sortSettings.sortedColumns.length>1){for(s=1;s<=a;s++)e=e+1;u.css("text-align")=="right"?(u.prepend(this._createSortNumber(e,u).addClass("e-sortnumber")),u.append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f))):(u.prepend(this._createSortNumber(e,u).addClass("e-sortnumber")),u.append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f)))}else u.append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f));this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i+"']").append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f));u.parent().attr("aria-sort",r)}},_removeSortElementFromColumn:function(t){var r=this.getColumnByField(t),u=n.inArray(r,this.model.columns),i=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell").eq(u).find(".e-headercelldiv");i.find(".e-ascending,.e-descending").remove();i.parent().prop("aria-sort",!1)},_sortCompleteAction:function(i){var f,e,r,u;for(e=this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").parent().attr("ej-mappingname"),this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),n(this.getHeaderTable().find(".e-columnheader").find(".e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell,.e-hide)")[this.getColumnIndexByField(e)]).removeAttr("aria-sort"),this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i.columnName+"']").find(".e-ascending,.e-descending,.e-number").not(".e-ungroupbutton").remove(),this.getHeaderTable().find("[aria-sort]").prop("aria-sort",!1),r=0;r<this.model.sortSettings.sortedColumns.length;r++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[r].field,this.model.sortSettings.sortedColumns[r].direction);this.model.groupSettings.groupedColumns.length&&this._$curSElementTarget!=null&&(u=this._checkEinGroupDrop(n.trim(this._$curSElementTarget.attr("ej-mappingname"))),t.isNullOrUndefined(u)||(f=(t.isNullOrUndefined(i.columnSortDirection)||i.columnSortDirection==""?this.getsortColumnByField(this._$curSElementTarget.attr("ej-mappingname")).direction.toLowerCase():i.columnSortDirection)=="ascending"?"e-rarrowup-2x":"e-rarrowdown-2x",u.find(".e-ascending,.e-descending").removeClass().addClass("e-icon e-"+(t.isNullOrUndefined(i.columnSortDirection)||i.columnSortDirection==""?this.getsortColumnByField(this._$curSElementTarget.attr("ej-mappingname")).direction.toLowerCase():i.columnSortDirection)+" "+f)));this.multiSortRequest=!1;(!this.model.allowScrolling||!this.initialRender||this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this.setWidthToColumns()},removeSortedColumns:function(t){if(n.isArray(t))for(var i=0;i<t.length;i++)this._removeSortedColumnFromCollection(t[i]);else this._removeSortedColumnFromCollection(t);this.multiSortRequest=!0;this.sortColumn(null,null)},_removeSortedColumnFromCollection:function(n){for(var t=0;t<this.model.sortSettings.sortedColumns.length;t++)if(this.model.sortSettings.sortedColumns[t].field==n){this.model.sortSettings.sortedColumns.splice(t,1);break}},clearSorting:function(){var t=this;this.model.sortSettings.sortedColumns=n.grep(this.model.sortSettings.sortedColumns,function(i){return n.inArray(i.field,t.model.groupSettings.groupedColumns)!=-1?!0:!1});this._$prevSElementTarget=null;this._$curSElementTarget=null;this.refreshContent()},sortColumn:function(i,r){var u,f,e;this.model.allowSorting&&n.inArray(i,this._disabledSortableColumns)==-1&&(i==null||i.length!=0)&&(u={},this.multiSortRequest||(f=this,this.model.sortSettings.sortedColumns=n.grep(this.model.sortSettings.sortedColumns,function(t){return n.inArray(t.field,f.model.groupSettings.groupedColumns)!=-1?!0:!1})),u.requestType=t.Grid.Actions.Sorting,this._cSortedColumn=u.columnName=i,this._cSortedDirection=u.columnSortDirection=t.isNullOrUndefined(r)?t.sortOrder.Ascending:r.toLowerCase(),this._cSortedColumn!==null&&(this._removeSortedColumnFromCollection(i),this.model.sortSettings.sortedColumns.push({field:this._cSortedColumn,direction:this._cSortedDirection})),e=this._processBindings(u),e&&(this._cSortedDirection=this._cSortedColumn=null),this._primaryKeyValues=[])},_createSortElement:function(){return t.buildTag("span.e-icon"," ")},_renderMultiTouchDialog:function(){var n,r,i;this._customPop=t.buildTag("div.e-gridpopup","",{display:"none"});n=t.buildTag("div.e-content");r=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSorting&&(i=t.buildTag("span.e-sortdirect e-icon"),n.append(i));this.model.selectionType=="multiple"&&(i=t.buildTag("span.e-rowselect e-icon"),n.append(i));this._customPop.append(n);this._customPop.append(r);this.element.append(this._customPop)}}}(jQuery,Syncfusion),function($,ej,undefined){ej.gridFeatures=ej.gridFeatures||{};ej.gridFeatures.filter={getFilterBar:function(){return this._gridFilterBar},setGridFilterBar:function(n){this._gridFilterBar=n},filterColumn:function(n,t,i,r,u,f){var e,a,s,h,p,d,l,o,g,y,w,k,v;if(this.model.allowFiltering)for(e=this.getColumnByField(n),(ej.isNullOrUndefined(e)||ej.isNullOrUndefined(e.filterBarTemplate)||e.type!="boolean"||i!="true")&&i!="false"||(i=JSON.parse(i)),e&&ej.isNullOrUndefined(e.format)?e.type=="date"?a=ej.preferredCulture().calendar.patterns.d:e.type=="datetime"&&(a=ej.preferredCulture().calendar.patterns.f):e&&(a=e.format.replace("{0:","").replace("}","")),!ej.isNullOrUndefined(e)&&!ej.isNullOrUndefined(e.filterBarTemplate)&&(e.type=="date"||e.type=="datetime")&&i.length>0&&(i=ej.parseDate(i,a,this.model.locale)),s=[],typeof n=="object"?s=n:s.push({field:n,operator:t,value:i,predicate:r,matchcase:u,actualFilterValue:f}),h=0;h<s.length;h++){var n=s[h].field,t=s[h].operator,i=s[h].value,r=s[h].predicate,u=ej.isNullOrUndefined(s[h].matchcase)?!1:s[h].matchcase,f=s[h].actualFilterValue,c={};for(c.requestType=ej.Grid.Actions.Filtering,c.currentFilterObject=[],this._$curFieldName=n,$.isArray(t)||(t=$.makeArray(t)),$.isArray(i)||(i=$.makeArray(i)),$.isArray(r)||(r=$.makeArray(r)),p=!1,d=this._filterCollection,ej.util.isNullOrUndefined(this._currentFilterColumn)&&(this._currentFilterColumn=this.getColumnByField(n)),l=0;l<t.length;l++){if(o={field:n,operator:t[l],value:i[l],matchcase:u,predicate:r[l],actualFilterValue:ej.getObject("value",f),actualOperator:ej.getObject("operator",f)},predicated=ej.getObject("ejpredicate",f),predicated&&(o=predicated),this._$colType!=null&&this.model.filterSettings.filterType!="filterbar"||ej.isNullOrUndefined(this._currentFilterColumn)||(this._$colType=this._currentFilterColumn.type),this.model.filterSettings.filteredColumns.length==0&&o.value!=="")(this._$colType=="date"||this._$colType=="datetime")&&this.model.filterSettings.filterType!=="excel"&&(t=="equal"||t=="notequal")&&typeof o.value!="string"?this._setDateFilters(o):this.model.filterSettings.filteredColumns.push(o);else{if(g=this,!p){var nt=ej.DataManager(this.model.filterSettings.filteredColumns),tt=(new ej.Query).where("field",ej.FilterOperators.equal,o.field),b=nt.executeLocal(tt);for(y=0;y<b.length;y++)w=$.inArray(b[y],this.model.filterSettings.filteredColumns),w!=-1&&this.model.filterSettings.filteredColumns.splice(w,1)}o.value!==""&&((this._$colType=="date"||this._$colType=="datetime")&&this.model.filterSettings.filterType!=="excel"&&(t=="equal"||t=="notequal")&&typeof o.value!="string"?this._setDateFilters(o):this.model.filterSettings.filteredColumns.push(o))}p=!0;c.currentFilterObject.push(o)}c.filterCollection=this.model.filterSettings.filteredColumns;c.currentFilteringColumn=n;k=this._processBindings(c);k&&(this.model.filterSettings.filteredColumns.reverse().splice(0,t.length),this.model.filterSettings.filteredColumns.reverse());this.model.filterSettings.filterType=="filterbar"&&(v=this.getHeaderTable().find("#"+n+"_filterBarcell"),v.val()!=""&&(v.val()==i||this._fltrBarcell)||(i[0]instanceof Date?v.val(ej.format(i[0],a,this.model.locale)):v.val(i[0]),this._currentFilterbarValue=i,this.filterStatusMsg="",this._showFilterMsg()));ej.isNullOrUndefined(e)||ej.isNullOrUndefined(e.filterBarTemplate)||(this.filterStatusMsg="",this._currentFilterbarValue=c.currentFilterObject[0].value,this._oldFilterColumn!=e&&this.filterColumnCollection.length>0&&$.inArray(e,this.filterColumnCollection)==-1&&this.filterColumnCollection.push(e),this._oldFilterColumn=this._currentFilterColumn=e,this._showFilterMsg());this._fltrBarcell=!1}},search:function(n){var t={};$("#"+this._id+"_search").find("input").val()!=n;$("#"+this._id+"_search").find("input").val(n);t.requestType=ej.Grid.Actions.Search;t.keyValue=n;this.model.searchSettings.fields=this.model.searchSettings.fields.length!=0?this.model.searchSettings.fields:this.getColumnFieldNames();(n!=""||this.model.searchSettings.key!="")&&(this.model.searchSettings.key=n.toLowerCase()==this.localizedLabels.True.toLowerCase()?"true":n.toLowerCase()==this.localizedLabels.False.toLowerCase()?"false":n,this._processBindings(t));this._primaryKeyValues=[]},_filterBarHandler:function(n){var f=n.keyCode,i=$(n.target),u,r,t;if(i.closest(".e-grid").attr("id")===this._id&&(this.model.filterSettings.filterBarMode=="immediate"||f==13)&&f!=9){for(i=$(n.target),this.filterStatusMsg="",u=i.prop("id").replace("_filterBarcell",""),t=0;t<this.model.columns.length;t++)if(ej.isNullOrUndefined(this.model.columns[t].foreignKeyValue)||u.indexOf("_"+this.model.columns[t].foreignKeyValue)==-1){if(this.model.columns[t].field==u){r=this.model.columns[t];break}}else{r=this.model.columns[t];break}if(r==null)return;if(this._currentFilterColumn=r,this._$curFieldName=r.field,this._currentFilterColumn!=this._oldFilterColumn&&(this.filterValueOldLength=0),this._currentFilterbarValue=i.val().toLowerCase()==this.localizedLabels.True.toLowerCase()?"true":i.val().toLowerCase()==this.localizedLabels.False.toLowerCase()?"false":i.val(),this.filterValueCurrentLength=this._currentFilterbarValue.length,(this.filterValueCurrentLength==0&&this.filterValueOldLength==0||this._currentFilterbarValue==this.OldfilterValue)&&this._currentFilterColumn==this._oldFilterColumn&&!this.model.scrollSettings.enableVirtualization){this._showFilterMsg();return}if(this._skipFilterProcess=this._checkForSkipInput(),this._skipFilterProcess)if(this._currentFilterColumn.type=="string")this.filterStatusMsg="Invalid Filter Data",this._showFilterMsg();else{this._skipFilterProcess=!1;this.model.scrollSettings.enableVirtualization||this._showFilterMsg();return}else this._processFilter(n)}},_renderResponsiveFilter:function(){for(var i,r,n=ej.buildTag("div#responsiveFilter.resFilterDiv","",{width:"100%",padding:"0px"}),f=$(window).height()+1,h=f*(8/100),v=this.element.height()>f?$(window).width()+16.5:$(window).width(),e=ej.buildTag("div.columnDiv","",{width:"100%"}),t=0;t<this.model.columns.length;t++)i=ej.buildTag("div.e-responsivefilterColDiv","",{width:"100%"},{"ej-MappingName":this.model.columns[t].field}),r=ej.buildTag("span",this.model.columns[t].headerText,{"margin-left":"4%"}),i.append(r),e.append(i);n.append(e);this.element.append(n);var c=this,y=this.element.outerWidth(),u=ej.buildTag("div.e-resFilterDialogHeaderDiv","",{height:h}),r=ej.buildTag("div.labelRes","<span>Filter<\/span>"),o=ej.buildTag("div.e-resFilterleftIcon","",{"margin-top":"3%"}),l=ej.buildTag("span.e-icon e-responsiveFilterClear e-resIcon","",{"font-size":"23px"}),s=ej.buildTag("div.e-resFIlterRigthIcon","",{float:"right","margin-top":"3%"},{closeDialogue:"responsiveFilter",gridEle:!0}),a=ej.buildTag("span.e-icon e-responisveClose e-resIcon","",{"font-size":"23px"},{closeDialogue:"responsiveFilter",gridEle:!0});s.click(function(){$("#responsiveFilter").css("display","none");c.element.css("display","block")});o.click(function(){$("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-filternone").click()});u.append(o.append(l));u.append(r).append(s.append(a));n.prepend(u);n.insertAfter(this.element);$(".resFilterDiv").on("keydown",$.proxy(this._responsiveDialogueKeyUp,this));n.css("display","none");$(".e-responsivefilterColDiv").on("click",$.proxy(this._mouseClickHandler,this))},_closeDivIcon:function(n){var i=$(n.target),t;ej.isNullOrUndefined(i.attr("closeDialogue"))||(t=$("#"+i.attr("closeDialogue")),ej.isNullOrUndefined(t.data("ejDialog"))?t.css("display","none"):t.ejDialog("close"));ej.isNullOrUndefined(i.attr("gridEle"))||this.element.css("display","block");ej.isNullOrUndefined(i.attr("openDialogue"))||(this.model.enableResponsiveRow||i.attr("closeDialogue").indexOf("Custom")!=-1?(t=$("#"+i.attr("openDialogue")),ej.isNullOrUndefined(t.data("ejDialog"))?t.css("display","block"):t.ejDialog("open")):this.element.css("display","block"))},_setResponsiveFilterIcon:function(){var t=$("#responsiveFilter").find(".columnDiv"),i=this,n;for(t.find(".e-filtericon").remove(),n=0;n<this.model.filterSettings.filteredColumns.length;n++){var r=this.model.filterSettings.filteredColumns[n],u=t.find(".e-responsivefilterColDiv[ej-MappingName="+r.field+"]"),f=ej.buildTag("div.e-filtericon e-icon e-resIcon e-filterset e-filternone e-filterreset","",{float:"right",height:"22px",width:"21px","font-size":"20px","margin-right":"3%","margin-top":"2%"}),e=ej.buildTag("span.e-filtericon e-icon e-resIcon e-filterset e-filternone","",{},{colType:r.type});u.find(".e-filternone").remove();u.append(f);e.click(function(n){var t=n.target;i._$colType=t.attr("colType");i._fltrClrHandler();t.remove()})}},_renderExcelFilter:function(){var n=this.model.filterSettings.filteredColumns.length!=0?this.model.filterSettings.filteredColumns[0].field:null,t={instance:this,showSortOptions:this.model.allowSorting,allowFormatFiltering:this.model.filterSettings.allowFormatFiltering,allowCaseSensitive:this.model.filterSettings.enableCaseSensitivity,maxFilterLimit:this.model.filterSettings.maxFilterChoices,interDeterminateState:this.model.filterSettings.enableInterDeterminateState,enableComplexBlankFilter:this.model.filterSettings.enableComplexBlankFilter,blankValue:this.model.filterSettings.blankValue,filterHandler:ej.proxy(this._filterHandler,this),initFilterCol:n,actionBegin:"actionBegin",actionComplete:"actionComplete"};this._excelFilter=new ej.excelFilter(t);$.extend(this._excelFilter,this.model.filterSettings)},_filterHandler:function(n){var r={},o,s,h,u,f,i,t,e,c;if(r.requestType=n.action=="sorting"?n.action:"filtering",s=this.model.filterSettings.filteredColumns,n.action=="filtering"){for(o=ej.DataManager(this.model.filterSettings.filteredColumns),h=(new ej.Query).where("field",ej.FilterOperators.equal,n.fieldName),u=o.executeLocal(h),t=0;t<u.length;t++)f=$.inArray(u[t],this.model.filterSettings.filteredColumns),f!=-1&&this.model.filterSettings.filteredColumns.splice(f,1);ej.merge(this.model.filterSettings.filteredColumns,n.filterCollection);n.currentFilterCollection=n.filterCollection}else{if(n.action=="clearfiltering"){for(i=n.filterDetails,delete this._excelFilter._predicates[0][n.fieldName],this.filterColumn(i.field,i.operator,i.value,i.predicate),t=0;t<this.filterColumnCollection.length;t++)this.filterColumnCollection[t].field==i.field&&this.filterColumnCollection.splice(t,1);return}if(n.action=="sorting"){e=n.sortDetails;ej.gridFeatures.sort&&this.sortColumn(e.field,e.direction);this._excelFilter.closeXFDialog();return}}r.currentFilteringColumn=n.fieldName;r.predicated=n.ejpredicate;c=this._processBindings(r);c&&(this.model.filterSettings.filteredColumns=s)},_renderFiltering:function(){var c=this.getHeaderTable(),v,u,r=ej.buildTag("tr.e-filterbar"),y,l=[],i,n,e,s,t,a,h;for((this.model.detailsTemplate||this.model.childGrid)&&r.append(ej.buildTag("th.e-filterbarcell e-mastercell")),n=0;n<this.model.columns.length;n++){var o=ej.buildTag("th.e-filterbarcell"),f=ej.buildTag("div.e-filterdiv"),p=ej.buildTag("span.e-cancel e-icon e-hide"),e=ej.isNullOrUndefined(this.model.columns[n].field)?this.model.columns[n].field:this.model.columns[n].field.replace(/[^a-z0-9|s_]/gi,""),s=ej.isNullOrUndefined(this.model.columns[n].foreignKeyValue)?e+"_filterBarcell":e+"_"+this.model.columns[n].foreignKeyValue+"_filterBarcell";if(this.model.columns[n].allowFiltering==!1||ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate)||ej.isNullOrUndefined(this.model.columns[n].field)?(f.addClass("e-fltrinputdiv"),e=this.model.columns[n].field,s=ej.isNullOrUndefined(this.model.columns[n].foreignKeyValue)?e+"_filterBarcell":e+"_"+this.model.columns[n].foreignKeyValue+"_filterBarcell",i=ej.buildTag("input.e-ejinputtext e-filtertext","",{},{title:this.model.columns[n].headerText+this.localizedLabels.FilterbarTitle,type:"search",id:s})):(o.addClass("e-fltrtemp"),f.addClass("e-fltrtempdiv"),ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate.create)?i=ej.buildTag("input e-filtertext","",{},{title:this.model.columns[n].headerText+this.localizedLabels.FilterbarTitle,id:s,"class":"e-filterUi_input e-filtertext e-fltrTemp"}):(v={columnIndex:n,column:this.model.columns[n]},u=this.model.columns[n].filterBarTemplate.create,typeof u=="string"&&(u=ej.util.getObject(u,window)),i=u(v),i=$(i).attr({title:this.model.columns[n].headerText+this.localizedLabels.FilterbarTitle,id:s,"class":"e-filterUi_input e-filtertext e-fltrTemp"}))),this.model.filterSettings.filteredColumns.length>0&&this.model.filterSettings.filterType=="filterbar"&&$.inArray(this.model.columns[n].field,l)==-1)for(t=0;t<this.model.filterSettings.filteredColumns.length;t++)this.getColumnIndexByField(this.model.filterSettings.filteredColumns[t].field)==n&&(this.model.filterSettings.filteredColumns[t].operator=="greaterthan"?i.val(">"+this.model.filterSettings.filteredColumns[t].value):this.model.filterSettings.filteredColumns[t].operator=="lessthan"?i.val("<"+this.model.filterSettings.filteredColumns[t].value):this.model.filterSettings.filteredColumns[t].operator=="notequal"?i.val("!="+this.model.filterSettings.filteredColumns[t].value):i.val(this.model.filterSettings.filteredColumns[t].value),$.inArray(this.model.filterSettings.filteredColumns[t].field,l)==-1&&l.push(this.model.filterSettings.filteredColumns[t].field));(this.model.columns[n].allowFiltering===!1||this.model.columns[n].field==""||ej.isNullOrUndefined(this.model.columns[n].field))&&(i.attr("disabled",!0).addClass("e-disable"),this._disabledFilterableColumns.push(this.model.columns[n].headerText));this.model.columns[n].visible===!1&&o.addClass("e-hide");ej.isNullOrUndefined(this.model.columns[n].cssClass)||o.addClass(this.model.columns[n].cssClass);this.model.columns[n].allowFiltering==!1||ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate)?f.append(i).append(p):f.append(i);r.append(o.append(f));n==this.model.scrollSettings.frozenColumns-1&&(y=r.clone(),c.find("thead").first().append(y),r.empty())}if(c.find("thead").last().append(r),ej.browserInfo().name=="msie"&&ej.browserInfo().version<10)for(a=c.find("thead").find(".e-ejinputtext.e-filtertext"),h=0;h<a.length;h++)ej.ieClearRemover(a[h]);this.setGridFilterBar(r)},_renderFilterBarTemplate:function(){for(var u,t,i,r,f=!1,n=0;n<this.model.columns.length;n++)if(this.model.columns[n].allowFiltering!=!1&&!ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate)&&!ej.isNullOrUndefined(this.model.columns[n].field)){if(i=this.model.columns[n].filterBarTemplate.read,typeof i=="string"&&(i=ej.util.getObject(i,window)),t=this.model.columns[n].foreignKeyField?{element:this.getHeaderTable().find(".e-filterbar").find(".e-fltrtemp").find("#"+this.model.columns[n].field.replace(/[^a-z0-9|s_]/gi,"")+"_"+this.model.columns[n].foreignKeyValue.replace(/[^a-z0-9|s_]/gi,"")+"_filterBarcell"),columnIndex:n,column:this.model.columns[n]}:{element:this.getHeaderTable().find(".e-filterbar").find(".e-fltrtemp").find("#"+this.model.columns[n].field.replace(/[^a-z0-9|s_]/gi,"")+"_filterBarcell"),columnIndex:n,column:this.model.columns[n]},typeof t.column.filterBarTemplate.read=="string"&&(t.column.filterBarTemplate.read=i),r=this.model.columns[n].filterBarTemplate.write,typeof r=="string"&&(r=ej.util.getObject(r,window)),this.model.filterSettings.filteredColumns.length>0)for(u=0;u<this.model.filterSettings.filteredColumns.length;u++)this.model.columns[n].field==this.model.filterSettings.filteredColumns[u].field&&(t.modelVal=this.model.filterSettings.filteredColumns[u].value);r.call(this,t);f=!0}f&&(this.model.filterSettings.filterBarMode=ej.Grid.FilterBarMode.OnEnter)},_closeFilterDlg:function(){ej.isNullOrUndefined($("#"+this._id+"_"+this._$colType+"Dlg").data("ejDialog"))?$("#"+this._id+"_"+this._$colType+"Dlg").css("display","none"):$("#"+this._id+"_"+this._$colType+"Dlg").ejDialog("close");this._$fDlgIsOpen=!1;this._$menuDlgIsOpen=!1},_filterBarClose:function(n){var t=$(n.target),i;t.closest(".e-grid").attr("id")===this._id&&(n.type=="click"&&t.hasClass("e-cancel")&&(i=t.prev(),i.focus().val(""),i.trigger("keyup"),n.stopPropagation()),n.type=="focusin"&&t.hasClass("e-filtertext")&&(t=$(n.target).next(),this.getFilterBar().find(".e-cancel").addClass("e-hide"),t.removeClass("e-hide")))},_processFilter:function(n){this._alreadyFilterProcessed?(this._stopTimer(),this._startTimer(n)):(this._alreadyFilterProcessed=!0,this._startTimer(n))},_startTimer:function(n){var t=this,i=n.keyCode==13?0:t.model.filterSettings.immediateModeDelay;this._timer=window.setTimeout(function(){t._onTimerTick()},i)},_stopTimer:function(){this._timer!=null&&window.clearTimeout(this._timer)},_onTimerTick:function(){var n,t,i;this.OldfilterValue=this._currentFilterbarValue;this._oldFilterColumn=this._currentFilterColumn;this.filterValueOldLength=this.filterValueCurrentLength;this._findPredicate();var r=this._currentFilterColumn.type=="string"?!1:!0,u=$.extend([],this.model.filterSettings.filteredColumns);for(n=0;n<u.length;n++)this.getHeaderContent().find(".e-filterbar #"+u[n].field+"_filterBarcell").val()==""&&($.inArray(this.model.filterSettings.filteredColumns[n],this.filterColumnCollection)!=-1&&this.filterColumnCollection.splice(n,1),this.model.filterSettings.filteredColumns.splice(n,1));if(this._currentFilterColumn.type=="date"||this._currentFilterColumn.type=="datetime")for(t=0;t<this.model.filterSettings.filteredColumns.length;t++)this.model.filterSettings.filteredColumns[t].isComplex&&(i=this.model.filterSettings.filteredColumns[t].predicates,this.model.filterSettings.filteredColumns.length==1?this.model.filterSettings.filteredColumns=i:(this.model.filterSettings.filteredColumns[t]=i[0],this.model.filterSettings.filteredColumns.push(i[1])));this._skipFilterProcess?this.filterStatusMsg="Invalid Filter Data":this._currentFilterColumn.foreignKeyValue&&this._currentFilterColumn.dataSource&&this._currentFilterbarValue!=""?this._fltrForeignKeyValue(this._operator,this._currentFilterbarValue,r,this._currentFilterColumn.dataSource,this._currentFilterColumn.foreignKeyField,this._currentFilterColumn.foreignKeyValue,this._currentFilterColumn.type):ej.isNullOrUndefined(this._currentFilterColumn.filterBarTemplate)&&(this._fltrBarcell=!0,this.filterColumn(this._currentFilterColumn.field,this._operator,this._currentFilterbarValue,this._predicate,r));!this.model.scrollSettings.enableVirtualization&&ej.isNullOrUndefined(this._currentFilterColumn.filterBarTemplate)&&this._showFilterMsg();this._stopTimer()},_findPredicate:function(){var u=this._currentFilterbarValue.replace(/ && /i," and ").replace(" || "," or "),t=u.split(" "),n;if(this._predicate="and",t.length!=0)if($.isFunction(ej.Predicate[t[1]])){this._skipFilterProcess=!1;this._predicate=t[1];var i=u.split(" "+t[1]+" "),f=[],r=[];for(n=0;n<i.length;n++)this._validateFilterValue(i[n]),f.push(this._operator),this._currentFilterColumn.type=="number"?r.push(this._currentFilterbarValue):this._currentFilterColumn.type=="string"&&r.push(i[n]);this._currentFilterbarValue=r;this._operator=f}else this._validateFilterValue($.trim(this._currentFilterbarValue));else this._validateFilterValue($.trim(this._currentFilterbarValue))},_validateFilterValue:function(n){var r,t,i,u;switch(this._currentFilterColumn.type){case"number":for(this._operator=ej.FilterOperators.equal,r=[">","<","=","!"],t=0;t<n.length;t++)if(jQuery.inArray(n[t],r)!=-1)break;t!=n.length&&(this._getOperator(n.substring(t)),t!=0&&(this._currentFilterbarValue=n.substring(0,t)));this._currentFilterbarValue=this._currentFilterbarValue!=""&&n.length>=1?ej.parseFloat(this._currentFilterbarValue,this.model.locale):n.length>1?ej.parseFloat(n,this.model.locale):n;break;case"date":case"datetime":this._operator=ej.FilterOperators.equal;this._getOperator(n);i=ej.isNullOrUndefined(this._currentFilterColumn.format)?this._currentFilterColumn.type=="date"?ej.preferredCulture().calendar.patterns.d:ej.preferredCulture().calendar.patterns.f:this._currentFilterColumn.format.replace("{0:","").replace("}","");this._currentFilterbarValue!=""&&(u=ej.parseDate(this._currentFilterbarValue,i,this.model.locale),ej.isNullOrUndefined(u)?this.filterStatusMsg="Invalid Filter Data":this._currentFilterbarValue=ej.parseDate(this._currentFilterbarValue,i,this.model.locale));break;case"string":n.charAt(0)=="*"?(this._currentFilterbarValue=this._currentFilterbarValue.slice(1),this._operator=ej.FilterOperators.startsWith):n.charAt(n.length-1)=="%"?(this._currentFilterbarValue=this._currentFilterbarValue.slice(0,-1),this._operator=ej.FilterOperators.startsWith):n.charAt(0)=="%"?(this._currentFilterbarValue=this._currentFilterbarValue.slice(1),this._operator=ej.FilterOperators.endsWith):this._operator=ej.FilterOperators.startsWith;break;case"boolean":case"checkbox":this._currentFilterbarValue.toLowerCase()=="true"||this._currentFilterbarValue=="1"?this._currentFilterbarValue=!0:(this._currentFilterbarValue.toLowerCase()=="false"||this._currentFilterbarValue=="0")&&(this._currentFilterbarValue=!1);this._operator=ej.FilterOperators.equal;break;default:this._operator=ej.FilterOperators.equal}},_getOperator:function(n){n.charAt(0)=="="&&(this._operator=ej.FilterOperators.equal,this._currentFilterbarValue=n.substring(1));(ej.data.operatorSymbols[n.charAt(0)]!==undefined||ej.data.operatorSymbols[n.slice(0,2)]!==undefined)&&(this._operator=ej.data.operatorSymbols[n.charAt(0)],this._currentFilterbarValue=n.substring(1),this._operator===undefined&&(this._operator=ej.data.operatorSymbols[n.slice(0,2)],this._currentFilterbarValue=n.substring(2)));(this._operator==ej.FilterOperators.lessThan||this._operator==ej.FilterOperators.greaterThan)&&this._currentFilterbarValue.charAt(0)=="="&&(this._operator=this._operator+"orequal",this._currentFilterbarValue=this._currentFilterbarValue.substring(1))},_checkForSkipInput:function(){var t=!1,r=this,i,n;if(this._currentFilterColumn.type=="number"&&(ej.data.operatorSymbols[this._currentFilterbarValue]!==undefined||$.inArray(this._currentFilterbarValue,["="," ","!"])!=-1)&&(t=!0),this._currentFilterColumn.type=="string")for(i=[">","<","=","!"],n=0;n<this._currentFilterbarValue.length;n++)$.inArray(this._currentFilterbarValue[n],i)!=-1&&(t=!0);return t},_showFilterMsg:function(){var n=$.inArray(this._currentFilterColumn,this.filterColumnCollection),t,u,i,f,r;if(this._currentFilterbarValue!==""&&n==-1&&this.filterColumnCollection.push(this._currentFilterColumn),this._currentFilterbarValue===""&&n!=-1&&this.filterColumnCollection.splice(n,1),(!this._skipFilterProcess||this.filterColumnCollection.length>0)&&this.filterStatusMsg!="Invalid Filter Data")for(n=0;n<this.filterColumnCollection.length;n++)ej.isNullOrUndefined(this.filterColumnCollection[n])||(i=this.filterColumnCollection[n].headerText,this.filterColumnCollection[n].disableHtmlEncode&&(i=this._htmlEscape(i)),this.filterColumnCollection[n].field.indexOf(".")!=-1?(f=this.filterColumnCollection[n].field.split("."),u=f.join("\\."),t=$("#"+u+"_filterBarcell").val()):(r=ej.isNullOrUndefined(this.filterColumnCollection[n].foreignKeyValue)?this.filterColumnCollection[n].field+"_filterBarcell":this.filterColumnCollection[n].field+"_"+this.filterColumnCollection[n].foreignKeyValue+"_filterBarcell",t=this._currentFilterColumn.type=="boolean"&&!ej.isNullOrUndefined(this._currentFilterColumn.filterBarTemplate)&&this.element.find("#"+r).hasClass("e-checkbox e-js")?this.element.find("#"+r).parent().attr("aria-checked"):this.element.find("#"+r).val()),t!=""&&(n>0&&this.filterStatusMsg!=""&&(this.filterStatusMsg+=" && "),this.filterStatusMsg+=i+": "+t));this.model.allowPaging?this.getPager().ejPager("model.externalMessage",this.filterStatusMsg):(this.model.scrollSettings.allowVirtualScrolling?this.$pagerStatusBarDiv.find(".e-pagerfiltermsg").html(this.filterStatusMsg).css("display","block"):this.$pagerStatusBarDiv.find("div").html(this.filterStatusMsg),this.filterStatusMsg.length?this.$pagerStatusBarDiv.css("display","block"):this.model.scrollSettings.allowVirtualScrolling?this.$pagerStatusBarDiv.find(".e-pagerfiltermsg").hide():this.$pagerStatusBarDiv.hide());this.filterStatusMsg=="Invalid Filter Data"&&(n=$.inArray(this._currentFilterColumn,this.filterColumnCollection),this.filterColumnCollection.splice(n,1));this.filterStatusMsg=""},_renderFilterDialogs:function(){var n,t,i,r,u,f;$.each(this.model.columns,ej.proxy(function(e,o){o.type!="string"||n&&ej.isNullOrUndefined(o.filterType)?o.type!="guid"||f&&ej.isNullOrUndefined(o.filterType)?o.type!="number"||t&&ej.isNullOrUndefined(o.filterType)?o.type!="date"||r&&ej.isNullOrUndefined(o.filterType)?o.type!="datetime"||u&&ej.isNullOrUndefined(o.filterType)?o.type!="boolean"||i&&ej.isNullOrUndefined(o.filterType)||(ej.isNullOrUndefined(o.filterType)&&(i=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(u=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(r=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(t=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(f=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(n=!0),this._renderFilters(o))},this))},_renderFilters:function(col){this._isExcelFilter&&col.filterType!="menu"||col.filterType=="excel"?(ej.isNullOrUndefined(this._excelFilter)&&(this._renderExcelFilter(),this._excelFilterRendered=!0),this._excelFilter.renderDialog(col.type)):eval(this["_render"+col.type.substring(0,1).toUpperCase()+col.type.substring(1)+"Dialog"](col))},_renderStringDialog:function(){var n=this._id+"_stringDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"string"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(n))},_renderBooleanDialog:function(){var n=this._id+"_booleanDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"boolean"),this.model.isResponsive&&this._mediaStatus||(this._renderFDialog(n),this.model.filterSettings.showPredicate?$("#"+n).ejDialog({minHeight:136,width:"100%"}):$("#"+n).ejDialog({minHeight:90,width:"100%"})))},_renderGuidDialog:function(){var n=this._id+"_guidDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"guid"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(n))},_renderNumberDialog:function(){var n=this._id+"_numberDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"number"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(n))},_renderDateDialog:function(n){var t=this._id+"_dateDlg",i;$("#"+t).length>0||(i=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),i.appendTo("body"),this._renderDlgContent(i,"date",n),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderDatetimeDialog:function(n){var t=this._id+"_datetimeDlg",i;$("#"+t).length>0||(i=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),i.appendTo("body"),this._renderDlgContent(i,"datetime",n),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderFDialog:function(n){$("#"+n).ejDialog({showOnInit:!1,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showHeader:!1,width:260,enableResize:!1,allowKeyboardNavigation:!1,content:"#"+this._id})},_closeFDialog:function(){(this._isExcelFilter||this._excelFilterRendered)&&this._excelFilter.closeXFDialog();this._$menuDlgIsOpen&&this._closeFilterDlg()},_renderDlgContent:function(n,t,i){n.addClass("e-grid");var f=ej.buildTag("div.e-predicate"),o=ej.buildTag("div.e-operator"),u=ej.buildTag("div.e-value"),b=this.localizedLabels.StringMenuOptions,s=this.localizedLabels.NumberMenuOptions,c=ej.buildTag("input#"+this._id+t+"_ddinput",{},{},{type:"text"}),l=ej.buildTag("div#"+this._id+t+"_dropdown"),h=ej.buildTag("ul"),a=ej.buildTag("input",{},{},{type:"radio",name:this._id+"_predicate"+t,value:"or"}),v=ej.buildTag("input",{},{},{type:"radio",name:this._id+"_predicate"+t,value:"and",checked:"checked"}),e;f.append(v).append(ej.buildTag("span.e-caption").html(this.localizedLabels.PredicateAnd)).append(a).append(ej.buildTag("span.e-caption").html(this.localizedLabels.PredicateOr));this.model.filterSettings.showPredicate||f.hide();t=="string"&&(e=ej.buildTag("input",{},{},{type:"checkbox"}),f.append(e).append(ej.buildTag("span.e-caption").html(this.localizedLabels.MatchCase)),$.each(b,function(n,t){h.append(ej.buildTag("li",{},{},{value:t.value}).html(t.text))}));(t=="number"||t=="date"||t=="datetime"||t=="guid")&&(t=="guid"&&(s=s.slice(4,6)),$.each(s,function(n,t){h.append(ej.buildTag("li",{},{},{value:t.value}).html(t.text))}));t!="boolean"&&(l.append(h),o.append(c),o.append(l));var r=ej.buildTag("input",{},{},{type:"text"}),y=ej.buildTag("input",{},{},{type:"checkbox"}),k=this.model.enableResponsiveRow?"OkButton":"Filter",d=this.model.enableResponsiveRow?"CancelButton":"Clear",p=ej.buildTag("input.e-filter e-flat e-btnsub",{},{},{type:"button",value:this.localizedLabels[k]}),w=ej.buildTag("input.e-clear e-flat e-btncan",{},{},{type:"button",value:this.localizedLabels[d]});u.append(ej.buildTag("span.e-caption").html(this.localizedLabels.FilterMenuCaption));n.append(f);t=="boolean"?(u.find("span.e-caption").css("top","1px"),u.append(y)):(u.append(ej.buildTag("br")).append(r),n.append(o));n.append(u);n.append(ej.buildTag("div.e-dlgBtns").append(p).append(w));t!="boolean"&&c.ejDropDownList({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,targetID:this._id+t+"_dropdown",width:"100%",height:"26px",selectedItemIndex:0});a.ejRadioButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL});v.ejRadioButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,checked:!0});e&&e.ejCheckBox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL});n.css("display","none");this._createButton("filter",p);this._createButton("clear",w);t=="number"?r.ejNumericTextbox({cssClass:this.model.cssClass,locale:this.model.locale,enableRTL:this.model.enableRTL,value:0,showSpinButton:!1,height:"26px",decimalPlaces:2,width:"100%"}):t=="guid"?r.css({height:"26px",width:"100%"}):t=="date"?(r.attr("id",this._id+"_dpDate"),r.ejDatePicker({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableStrictMode:!0,width:"100%",watermarkText:this.localizedLabels.DatePickerWaterMark,locale:this.model.locale}),ej.isNullOrUndefined(i.format)||r.ejDatePicker({dateFormat:i.format.replace(/{0:|}/g,function(){return""})})):t=="datetime"?(r.attr("id",this._id+"_dpDateTime"),r.ejDateTimePicker({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableStrictMode:!0,width:"100%",locale:this.model.locale}),ej.isNullOrUndefined(i.format)||r.ejDateTimePicker({dateTimeFormat:i.format.replace(/{0:|}/g,function(){return""})})):t=="boolean"?y.ejCheckBox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL}):t=="string"&&(r.attr("id",this._id+"_acString"),r.ejAutocomplete({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,dataSource:this._dataSource(),width:"100%",height:26,enableDistinct:!0,focusIn:function(){var n=this.element.closest(".e-dialog").find(".e-dropdownlist"),t=this.element.closest(".e-dialog").find(".e-checkbox").prop("checked");this.model.filterType=n.ejDropDownList("model.value");this.model.caseSensitiveSearch=t},open:function(){var n=!this.element.closest(".e-dialog").ejDialog("isOpened");this.suggestionList.css({visibility:n?"hidden":"visible"})}}))},_createButton:function(n,t){var i=n=="filter"?ej.proxy(this._fltrBtnHandler,this):ej.proxy(this._fltrClrHandler,this);t.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,click:i})},_getIdField:function(){var n;return $.each(this.model.columns,function(t,i){if(i.key)return n=i.field,!1}),n},_filterCompleteAction:function(){var i,t;if(this.model.allowPaging&&this._refreshGridPager(),this.model.scrollSettings.allowVirtualScrolling&&(i=this._refreshVirtualPagerInfo(),this._showPagerInformation(i)),this.model.filterSettings.filterType=="menu"||this._isExcelFilter){this._closeFDialog();var u=this.getColumnByField(this._$curFieldName),f=$.inArray(u,this.model.columns),r=this,n=!1;$.each(this.model.filterSettings.filteredColumns,function(t,i){return i.field==r._$curFieldName?(n=!0,!1):i.isComplex==!0&&i.predicates[0].field==r._$curFieldName?(n=!0,!1):void 0});t=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell").eq(f).find(".e-filtericon");n?t.addClass("e-filteredicon e-filternone"):t.removeClass("e-filteredicon e-filternone")}},_refreshFilterIcon:function(){var r,n,u,t,i,f;if(this.model.filterSettings.filteredColumns.length)for(r=ej.distinct(this.model.filterSettings.filteredColumns,"field",!0),n=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell"),this.model.showStackedHeader&&(n=n.not(".e-stackedHeaderCell")),this.model.allowReordering&&n.find(".e-filtericon").removeClass("e-filteredicon e-filternone"),i=0,f=r.length;i<f;i++)t=r[i],u=this.getColumnIndexByField(t.isComplex===!0?t.predicates[0].field:t.field),n.eq(u).find(".e-filtericon").addClass("e-filteredicon e-filternone")},_setFilterFieldValues:function(n){var i="",t=this,r=-1,u;$.each(this.model.filterSettings.filteredColumns,function(n,i){i.field==t._$curFieldName&&(r=n)});r==-1&&this._$colType!="boolean"&&(this._$colType=="string"&&$(".e-predicate input.e-js[type='checkbox']").ejCheckBox({checked:!1}),$(".e-predicate input[name ="+this._id+"_predicate"+this._$colType+"]:first").ejRadioButton({checked:!0}),$("#"+this._id+this._$colType+"_ddinput").ejDropDownList({selectedItemIndex:0,change:function(){this.element.closest(".e-dialog").find(".e-autocomplete").val(i)}}));u=$(this.model.filterSettings.filteredColumns).map(function(){return this.field}).get();(this._$curFieldName!=this._$prevFieldName||$.inArray(this._$curFieldName,u)!=-1)&&($.each(this.model.filterSettings.filteredColumns,function(n,r){if(r.field==t._$curFieldName){for(var e=t._$colType=="number"||t._$colType=="date"||t._$colType=="datetime"?"Number":"String",f=t.localizedLabels[e+"MenuOptions"],o=ej.isNullOrUndefined(r.actualOperator)?r.operator:r.actualOperator,u=0;u<f.length;u++)if(f[u].value.toLowerCase()==o)break;return t._$colType=="string"&&$(".e-predicate input.e-js[type='checkbox']").ejCheckBox({checked:r.matchcase}),$("input[value="+r.predicate+"]").ejRadioButton({checked:!0}),$("#"+t._id+t._$colType+"_ddinput").ejDropDownList({selectedItemIndex:u}),i=r.actualFilterValue!=null?r.actualFilterValue:r.value,!1}}),this._$colType=="boolean"?i&&i!=""?$(n).find(".e-value input:checkbox.e-js").ejCheckBox({checked:!0}):$(n).find(".e-value input:checkbox.e-js").ejCheckBox({checked:!1}):this._$colType=="date"||this._$colType=="datetime"?$(n).find(".e-value .e-datepicker")[this._$colType=="date"?"ejDatePicker":"ejDateTimePicker"]("model.value",i):this._$colType=="number"?$(n).find(".e-value .e-numerictextbox").ejNumericTextbox("model.value",i):$(n).find(".e-value input").val(i))},_fltrBtnHandler:function(){var f;this.model.isResponsive&&this._mediaStatus&&this._responsiveFilterClose();var o=this._id+"_"+this._$colType+"Dlg",i=$("#"+o),n=i.find(".e-value input"),u,e,t=n.val(),r=undefined;this._$colType=="number"&&(n=n.filter(".e-numerictextbox"),t=parseFloat(n.ejNumericTextbox("getValue")),r=!0);this._$colType=="string"&&(r=i.find(".e-predicate input[type='checkbox']").is(":checked"));(this._$colType=="date"||this._$colType=="datetime")&&(t=ej.parseDate(t,this._$colFormat,this.model.locale),r=!0);this._$colType=="boolean"?(t=n.ejCheckBox("model.checked")!=null?n.ejCheckBox("model.checked"):!1,u="equal"):u=$("#"+this._id+this._$colType+"_ddinput").ejDropDownList("getSelectedValue").toLowerCase();e=i.find(".e-predicate input[type='radio']:checked");this._$colForeignKeyValue&&this._$colDropdownData?this._fltrForeignKeyValue(u,t,r,this._$colDropdownData,this._$colForeignKeyField,this._$colForeignKeyValue,this._$colType,e):this.filterColumn(this._$curFieldName,u,t,i.find(".e-predicate input[type='radio']:checked").attr("value"),r);this.model.isResponsive&&(i.css("display","none"),this._setResponsiveFilterIcon(),this.element.css("display","block"),!this.model.allowScrolling||this.model.enableResponsiveRow&&this.model.minWidth||(f={},f.requestType="refresh",this._refreshScroller(f)))},_fltrClrHandler:function(){this.clearFiltering(this._$curFieldName)},_fltrForeignKeyValue:function(n,t,r,u,f,e,o,s){var y,p;ej.isNullOrUndefined(r)&&(r=!0);var b=[],v,l,g=s?s.css("display")=="none":!0,k=s?s.attr("value"):"and",a,w=u,c,h={mapFieldName:e,fieldName:f,operator:n,value:t,predicate:s,matchcase:r},d={requestType:ej.Grid.Actions.Filtering,action:"fetchingForeignKeyField",currentFilteringColumn:f,currentFilterObject:h};this._trigger("actionBegin",d);u instanceof ej.DataManager||(w=new ej.DataManager(u));o=="date"?(y=new Date(t.setDate(t.getDate()-1)),p=new Date(t.setDate(t.getDate()+2)),v=n=="equal"||n=="notequal"?n=="equal"?(new ej.Query).where(ej.Predicate(h.mapFieldName,">",y,!h.matchcase).and(h.mapFieldName,"<",p,!h.matchcase)).select(h.fieldName):(new ej.Query).where(ej.Predicate(h.mapFieldName,"<=",y,!h.matchcase).or(h.mapFieldName,">=",p,!h.matchcase)).select(h.fieldName):(new ej.Query).where(h.mapFieldName,h.operator,h.value,!h.matchcase).select(h.fieldName)):v=(new ej.Query).where(h.mapFieldName,h.operator,h.value,!h.matchcase).select(h.fieldName);l={actualFilterValue:h.value,actualOperator:h.operator,ejpredicate:undefined,predicate:k};w.executeQuery(v).done(ej.proxy(function(n){for(c=n.result,requireProc=$.isPlainObject(c[0]),preds=[],merge=!1,c=requireProc?ej.distinct(c,f,!1):c,field=this._$curFieldName,a=new ej.Predicate(field,"equal",c[0],r),i=1,vlen=c.length;i<vlen;i++)preds.push(new ej.Predicate(field,"equal",c[i],r)),merge=!0;merge&&(preds.unshift(a),a=ej.Predicate.or(preds));$.extend(l,{ejpredicate:$.extend(a,{field:field},l)});this.filterColumn(h.fieldName,h.operator,h.value,b,h.matchcase,l)},this))},_setDateFilters:function(n,t){var u,f,e,r,i;if(t||ej.isNullOrUndefined(this.getColumnByField(n.field).format)?(u=new Date(n.value.setSeconds(n.value.getSeconds()-1)),f=new Date(n.value.setSeconds(n.value.getSeconds()+2))):(e=this.getColumnByField(n.field).format,e.indexOf("s")!=-1?(u=new Date(n.value.setSeconds(n.value.getSeconds()-1)),f=new Date(n.value.setSeconds(n.value.getSeconds()+2))):e.indexOf("m")!=-1?(u=new Date(n.value.setMinutes(n.value.getMinutes()-1)),f=new Date(n.value.setMinutes(n.value.getMinutes()+2))):e.indexOf("h")!=-1?(u=new Date(n.value.setHours(n.value.getHours()-1)),f=new Date(n.value.setHours(n.value.getHours()+2))):(u=new Date(n.value.setSeconds(n.value.getSeconds()-1)),f=new Date(n.value.setDate(n.value.getDate()+1)))),r=$.extend({},n),i=$.extend({},n),r.value=u,i.value=f,n.operator=="equal"?(r.operator="greaterthan",r.predicate="and",i.operator="lessthan",i.predicate="and"):(r.operator="lessthanorequal",r.predicate="or",i.operator="greaterthanorequal",i.predicate="or"),pred=ej.Predicate(r.field,r.operator,r.value,!1),predicate=pred[i.predicate](ej.Predicate(i.field,i.operator,i.value,!1)),n.value=new Date(n.value.setSeconds(i.value.getSeconds()-1)),t)return predicate;this.model.filterSettings.filteredColumns.push($.extend(predicate,{field:n.field,operator:n.operator,value:n.value}))}}}(jQuery,Syncfusion),function(n,t,i){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.group={_renderGroupDropArea:function(){var i,n;return t.isNullOrUndefined(this.model.groupSettings.enableDropAreaAnimation)||(this.model.groupSettings.enableDropAreaAutoSizing=this.model.groupSettings.enableDropAreaAnimation),i=this.model.groupSettings.enableDropAreaAutoSizing?"":this.localizedLabels.GroupDropArea,this.model.groupSettings.showDropArea?(n=t.buildTag("div.e-groupdroparea",i),n.addClass("e-default"),this.model.groupSettings.enableDropAreaAutoSizing&&n.append(t.buildTag("div.e-animatebutton e-icon").addClass(this.model.groupSettings.enableDropAreaAutoSizing?"e-animatebuttondown e-gdownarrow":"e-animatebuttonup e-guparrow")),n):void 0},_getColGroup:function(t){var r=this.getRsc("helpers",t),f,e,u;return f=r.model.groupSettings.groupedColumns.length==1?this.data.items.level===i?0:this.data.items.level-1:this.data.items.level===i?r.model.groupSettings.groupedColumns.length:this.data.items.level-1,e=n(document.createElement("div")),r._isCaptionSummary?u=r._getCaptionColGroup(f):(u=r._getMetaColGroup(),f!=r.model.groupSettings.groupedColumns.length&&r.model.groupSettings.groupedColumns.length>1&&u.prepend(r._getIndentCol())),e.html(u),e.html()},_colSpanAdjust:function(r,u,f){var e,s,c,l,a,o,w,h,b;if(t.isNullOrUndefined(r)?(e=this,s=f):(e=this.getRsc("helpers",r),s=this),e.model.groupSettings.groupedColumns.length==1?(c=s.data.items.level===i?1:s.data.items.level-1,u=="groupcaption"&&(e._currentJsonData=e._currentJsonData.concat(s.data.items))):(c=s.data.items.level===i?e.model.groupSettings.groupedColumns.length:s.data.items.level-1,u=="groupcaption"&&s.data.items.level===i&&(e._currentJsonData=e._currentJsonData.concat(s.data.items))),e._isGrouping=!0,l=e.model.groupSettings.showGroupedColumn?0:e.model.groupSettings.groupedColumns.length,a=0,n.each(e._hiddenColumnsField,function(t,i){var r=n.inArray(i,e.model.groupSettings.groupedColumns);r!=-1&&(a=a+1,e.model.groupSettings.showGroupedColumn&&(l=l+1))}),o=e.model.columns.length+e.model.groupSettings.groupedColumns.length-c-e._hiddenColumnsField.length-l+a,o=e.model.detailsTemplate!=null||e.model.childGrid!=null?o+1:o,e._isCaptionSummary&&u=="groupcaption"){var v=[],k=0,d=e._captionSummary(),y=0,p=[];for(n.each(d[0].summaryColumns,function(t,i){n.inArray(i.displayColumn,e._hiddenColumnsField)!=-1&&k++;p.push(e.getColumnIndexByField(i.displayColumn));v.push(e.getColumnIndexByField(i.displayColumn)+e.model.groupSettings.groupedColumns.length-c)}),w=t.min(p),h=0;h<e._hiddenColumnsField.length;h++)b=t.isNullOrUndefined(e.getColumnByField(e._hiddenColumnsField[h]))?e.getColumnIndexByHeaderText(e._hiddenColumnsField[h],t.isNullOrUndefined(e.getColumnByField(e._hiddenColumnsField[h]))):e.getColumnIndexByField(e._hiddenColumnsField[h]),w>b&&y++;v.length>0&&(o=t.min(v));o=o-y;o=e.model.detailsTemplate!=null||e.model.childGrid!=null?o+1:o}return o},_captionEncode:function(n){var t=this.getRsc("helpers",n),i=t.getColumnByField(this.data.field);return i.disableHtmlEncode},_captionFormat:function(i){var u=this.getRsc("helpers",i),e,r=n.extend({},this.data),f=u.getColumnByField(r.field);return e=f.foreignKeyValue&&f.dataSource?u._foreignKeyBinding(u.getColumnIndexByField(r.field),r.key,u._id):r.key,t.isNullOrUndefined(f.format)||f.format.indexOf("{0:")!=-1||(r[r.field]=r.key,u.data=r),r.key=f.format?u.formatting(f.format,e,u.model.locale):e,r.headerText=f.headerText,n.render[u._id+"_CaptionTemplate"](r)},_getCaptionColGroup:function(n){var t=this.getHeaderTable().find("colgroup").clone(),u=t.find("col"),i=u.length-this.model.columns.length,r;if((this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(i=i-1),t.find("col:lt("+i+")").remove(),n>0&&n!=this.model.groupSettings.groupedColumns.length)if(this.model.groupSettings.groupedColumns.length>2&&n!=this.model.groupSettings.groupedColumns.length-1)for(r=0;r<this.model.groupSettings.groupedColumns.length-n;r++)t.prepend(this._getIndentCol());else t.prepend(this._getIndentCol());return t},_groupSummaryRow:function(i,r,u,f){var e=this.getRsc("helpers",u),f=!t.isNullOrUndefined(f),s,a,v,o,h,c;if(e.model.showSummary){if(e.getFooterTable()==null&&e._renderGridFooter(),e._createSummaryRows(e.getFooterTable(),i.records==null?i:i.records,r,i,f),e._isCaptionSummary&&!f&&(s=[],a=e._captionSummary(),n.each(a[0].summaryColumns,function(n,t){s.push(e.getColumnIndexByField(t.displayColumn))}),s.length>0&&(colIndex=t.min(s)),v=e.model.columns.length,e.getFooterTable().find("tbody td").slice(-(v-colIndex)).removeClass("e-summaryrow").addClass("e-groupcaptionsummary")),!e.model.groupSettings.showGroupedColumn){var y=e.model.groupSettings.groupedColumns,l=0,p=e.getFooterTable().children("tbody").find("tr");for(o=0;o<e.model.summaryRows.length;o++){for(h=0;h<e.model.summaryRows[o].summaryColumns.length;h++)for(c=0;c<y.length;c++)y[c]==e.model.summaryRows[o].summaryColumns[h].displayColumn&&(l++,e.model.summaryRows[o].summaryColumns.length==l&&n(p[o]).addClass("e-hide"));l=0}}return f?e.getFooterTable().find("tbody").html():e.getFooterTable().find("tbody").find("tr").html()}},addGroupingTemplate:function(){var l=document.createElement("tbody"),i=this,r={},f,u,o,e;r["_"+i._id+"ColSpanAdjust"]=this._colSpanAdjust;r["_"+i._id+"Colgroup"]=this._getColGroup;t.isNullOrUndefined(this.model.groupSettings.captionFormat)?n.templates(i._id+"_CaptionTemplate",this.localizedLabels.GroupCaptionFormat):n.templates(i._id+"_CaptionTemplate",this.model.groupSettings.captionFormat);r["_"+i._id+"CaptionFormat"]=this._captionFormat;r["_"+i._id+"GroupSummaryRow"]=this._groupSummaryRow;r["_"+i._id+"CaptionEncode"]=this._captionEncode;r[i._id+"Object"]=this;n.views.helpers(r);f=" ~_"+i._id+"CaptionFormat('"+i._id+"Object')";u="<td class='e-recordplusexpand' ej-mappingname='{{:field}}' ej-mappingvalue='{{:key}}'><div class='e-icon e-gdiagonalnext'><\/div><\/td><td class='e-groupcaption' colspan='{{:~_"+i._id+"ColSpanAdjust('"+i._id+"Object','groupcaption') }}'>{{if ~_"+i._id+"CaptionEncode('"+i._id+"Object')}}{{html:"+f+"}}{{else}}{{:"+f+"}}{{/if}}<\/td>";this._isCaptionSummary&&this.model.showSummary&&(u=u+"{{:~_"+i._id+"GroupSummaryRow(items, aggregates,'"+i._id+"Object')}}");o="<tr class='e-groupcaptionrow'>"+u+"<\/tr>";e=t.buildTag("tbody");e.html("{{if items.GROUPGUID}}{{for items tmpl='"+i._id+"_GroupingTemplate'/}}{{else}}{{for items tmpl='"+i._id+"_JSONTemplate'/}}{{/if}}");var s="<table class='e-table {{if items.GROUPGUID}}{{else}}e-recordtable{{/if}}' cellspacing='0.25px' >{{:~_"+i._id+"Colgroup('"+i._id+"Object')}}"+e.html()+"{{:~_"+i._id+"GroupSummaryRow(items, aggregates,'"+i._id+"Object', '"+i._id+"showGroupCaption')}}<\/table>",h="<td class='e-tabletd' colspan='{{:~_"+i._id+"ColSpanAdjust('"+i._id+"Object','table')}}'>"+s+"<\/td>",c="<tr><td class='e-indentcell'><\/td>"+h+"<\/tr>";n.templates(i._id+"_GroupingTemplate",o+c)},addSummaryTemplate:function(){var i=this;n.each(i.model.summaryRows,function(r,u){n.each(u.summaryColumns,function(r,u){t.isNullOrUndefined(u.template)||n.templates(i._id+"_summaryTemplate"+u.template,u.template)})})},_getGroupTopLeftCell:function(){var n=t.buildTag("th.e-grouptopleftcell");return n.append(t.buildTag("div.e-headercelldiv e-emptyCell"," ")),n},_getEmptyFilterBarCell:function(){return t.buildTag("th.e-filterbarcell e-grouptopleftcell")},_groupingAction:function(n){var i=this.getHeaderTable().find("thead").find(".e-columnheader:not(.e-stackedHeaderRow)").find(".e-grouptopleftcell"),u=this.getHeaderTable().find("colgroup").find("col"),r=i.length,t;for(r&&(this.getHeaderTable().find("colgroup").replaceWith(this._getMetaColGroup()),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&this.getHeaderTable().find("colgroup").prepend(this._getIndentCol()),i.remove(),this.getHeaderTable().find("thead").find(".e-filterbar").find(".e-filterbarcell:lt("+r+")").remove()),(!this.model.allowResizeToFit||n)&&this.setWidthToColumns(),t=0;t<this.model.groupSettings.groupedColumns.length;t++)this.getHeaderTable().find("colgroup").prepend(this._getIndentCol()),this.getHeaderTable().find("thead").find(".e-columnheader").prepend(this._getGroupTopLeftCell()),this.getHeaderTable().find("thead").find(".e-filterbar").prepend(this._getEmptyFilterBarCell());this.getHeaderTable().find(".e-columnheader").find("th.e-grouptopleftcell").last().addClass("e-lastgrouptopleftcell")},groupColumn:function(i){var r,u,f;if((this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&this._closeFDialog(),this.model.allowGrouping&&n.inArray(i,this._disabledGroupableColumns)==-1)&&!t.isNullOrUndefined(this.getColumnByField(i))&&n.inArray(i,this.model.groupSettings.groupedColumns)==-1){for(this.model.groupSettings.groupedColumns.push(i),r=0;r<this.model.sortSettings.sortedColumns.length;r++)if(this.model.sortSettings.sortedColumns[r].field==i)break;this.model.sortSettings.sortedColumns.length==r&&this.model.sortSettings.sortedColumns.push({field:i,direction:t.sortOrder.Ascending});u={};u.columnName=i;u.requestType=t.Grid.Actions.Grouping;f=this._processBindings(u);f&&(n.inArray(i,this._scolumns)!=-1||this._gridSort==i||this.model.sortSettings.sortedColumns.pop(),this.model.groupSettings.groupedColumns.pop());this._primaryKeyValues=[]}},ungroupColumn:function(i){var f,e,u,r,o,s;if(this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&this._closeFDialog(),this.model.allowGrouping){if(n.inArray(i,this.model.groupSettings.groupedColumns)!=-1)this.model.groupSettings.groupedColumns.splice(n.inArray(i,this.model.groupSettings.groupedColumns),1);else return null;for(this.model.groupSettings.groupedColumns.length==0&&(this._LastColumnUnGroup=!0),f=this.getColumnByField(i),this.model.groupSettings.showGroupedColumn||f.visible||(e=this._hiddenColumnsField.indexOf(i),this._hiddenColumnsField.splice(e,1),f.visible=!0),u={},r=0;r<this.model.sortSettings.sortedColumns.length;r++)if(this.model.sortSettings.sortedColumns[r].field==i){if(this._scolumns.indexOf(i)!=-1&&this.model.allowSorting&&this.model.allowMultiSorting||this._gridSort==i)if(this.model.allowSorting&&this.model.allowMultiSorting){o=n.inArray(i,this._scolumns);this._scolumns.splice(o,1);break}else{this._gridSort=null;break}else this.model.sortSettings.sortedColumns.splice(r,1);break}u.columnName=i;u.requestType=t.Grid.Actions.Ungrouping;this._isUngrouping=!0;s=this._processBindings(u);s&&this.model.groupSettings.groupedColumns.push(i);this._primaryKeyValues=[]}},collapseGroupDropArea:function(){var r=this.element.find(".e-groupdroparea").first(),i=this;this.model.groupSettings.groupedColumns.length==0&&this.model.groupSettings.enableDropAreaAutoSizing&&r.animate({height:"10px"},200,function(){i.model!=null&&i.model.groupSettings.groupedColumns.length==0&&(n(this).html("").append(t.buildTag("div.e-animatebutton e-animatebuttondown e-icon e-gdownarrow")),n(this).dequeue().css("height","auto"))})},expandGroupDropArea:function(){var n=this.element.find(".e-groupdroparea").first(),i=this;this.model.groupSettings.groupedColumns.length==0&&i.model.groupSettings.enableDropAreaAutoSizing&&n.animate({height:"30px"},150,function(){i.model.groupSettings.groupedColumns.length==0&&n.html(i.localizedLabels.GroupDropArea).append(t.buildTag("div.e-animatebutton e-animatebuttonup e-icon e-guparrow"));n.dequeue().css("height","30px")})},_enableGroupingEvents:function(){this.model.allowGrouping&&this._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",".e-groupdroparea",this._groupHeaderCellClick)},_recalculateIndentWidth:function(){var e=this,o=!t.isIOSWebView()&&this.getBrowserDetails(),i=this.getHeaderTable().find(".e-lastgrouptopleftcell").width(),r=i,s=i/30,f,u,h,c;s>=1&&(r=30/s);this.getHeaderTable().find("colgroup").find("col").slice(0,this.model.groupSettings.groupedColumns.length).css("width",r+"px");u=this.getContentTable().find("table").filter(":not(.e-recordtable)");i=this.getHeaderTable().find(".e-lastgrouptopleftcell").width();i>30||this._isCaptionSummary&&(i>=30||i>r)?(this._isCaptionSummary?(h=this.model.isEdit?u.parent(":not(.gridform)").children("colgroup"):u.children("colgroup"),n.each(h,function(t,i){var u=n(i).find("col").length-e.model.columns.length;(e.model.detailsTemplate!=null||e.model.childGrid!=null)&&u>0&&(u=u-1);n(i).find("col").slice(0,u).css("width",r+"px")})):this.model.isEdit?u.parent(":not(.gridform)").children("colgroup").find("col:first-child").css("width",i+"px"):u.children("colgroup").find("col:first-child").css("width",i+"px"),f=this.getContentTable().find("colgroup").first().find("col").slice(0,this.model.groupSettings.groupedColumns.length),o&&o.browser!="msie"?f.css("width",r+"px"):this._isCaptionSummary?f.css("width",r+"px"):f.first().css("width",i/this.element.width()*100+"%")):(this.getContentTable().find("colgroup").first().find("col").slice(0,this.model.groupSettings.groupedColumns.length).css("width",r+"px"),this.getContentTable().find("table").filter(":not(.e-recordtable)").children("colgroup").find("col:first-child").css("width",i+"px"));this.model.showSummary&&(c=this.getContentTable().find("table").filter(".e-groupsummary").find(".e-summary"),c.css("width",r+"px"))},getFieldNameByHeaderText:function(n){return t.isNullOrUndefined(this._fieldColumnNames[n])?null:this._fieldColumnNames[n]},getHeaderTextByFieldName:function(n){return t.isNullOrUndefined(this._headerColumnNames[n])?null:this._headerColumnNames[n]},expandAll:function(){var i=this.element.find(".e-recordpluscollapse"),r=this._excludeDetailRows().find(".e-detailrowcollapse"),t;if(i.length!=0)for(t=0;t<i.length;t++)this.expandCollapse(n(i[t]));if(r.length!=0)for(t=0;t<r.length;t++)this.expandCollapse(n(r[t]))},collapseAll:function(){var i=this.element.find(".e-recordplusexpand"),r=this.element.find(".e-detailrowexpand"),t;if(i.length!=0)for(t=0;t<i.length;t++)this.expandCollapse(n(i[t]));if(r.length!=0)for(t=0;t<r.length;t++)this.expandCollapse(n(r[t]))},_group:function(i){var u,o,f,e,s,r,h;if(this.model.groupSettings.groupedColumns.length&&this.model.currentViewData){if(this._currentJsonData=[],u=document.createElement("div"),!this.model.groupSettings.showGroupedColumn){if(this.initialRender||t.isNullOrUndefined(i.columnName)||i.requestType!="grouping")for(r=0;r<this.model.groupSettings.groupedColumns.length;r++)n.inArray(this.model.groupSettings.groupedColumns[r],this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(this.model.groupSettings.groupedColumns[r]),this._hiddenColumns.push(this.getColumnByField(this.model.groupSettings.groupedColumns[r]).headerText),this.getColumnByField(this.model.groupSettings.groupedColumns[r]).visible=!1);else o=this.getColumnByField(i.columnName),n.inArray(i.columnName,this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(i.columnName),this._hiddenColumns.push(this.getColumnByField(i.columnName).headerText),o.visible=!1);this._hideHeaderColumn(this.model.groupSettings.groupedColumns,!0);this.getContentTable().children("colgroup").replaceWith(this.getHeaderTable().find("colgroup").clone())}for(this._isReorder=i.requestType=="reorder"?!0:!1,f=this.getContentTable().children("colgroup").find("col"),e=f.length-this.model.columns.length,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&e--,f.length>this.model.columns.length&&this.getContentTable().children("colgroup").find("col:lt("+e+")").remove(),this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),s=this.model.detailsTemplate!=null||this.model.childGrid!=null?this.model.groupSettings.groupedColumns.length+1:this.model.groupSettings.groupedColumns.length,r=0;r<s;r++)this.getContentTable().children("colgroup").prepend(this._getIndentCol());this.model.currentViewData.length?(h=this.getContentTable().children("tbody"),h.empty(),u.innerHTML=["<table><tbody>",n.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/tbody><\/table>"].join(""),this.getContentTable().get(0).replaceChild(u.firstChild.firstChild,this.getContentTable().get(0).lastChild),this._hideCaptionSummaryColumn()):this.model.isEdit&&this.cancelEdit();this._groupingAction();this._gridRows=this.getContentTable().find(".e-recordtable").find("tbody").find("tr").not(".e-gridSummaryRows");this._eventBindings()}},_ungroup:function(){var i,r,u,n;if(this._isGrouping=!1,t.isNullOrUndefined(this.model.detailsTemplate)||(this._detailsOuterWidth=null),i=this.element.children(".e-gridheader"),r=i.find(".e-filterbar").find("th").find("input"),i.find("div").first().empty().append(this._renderGridHeader().find("table")),this.setGridHeaderContent(i),this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar")for(this._renderFiltering(),this._renderFilterBarTemplate(),u=this.element.children(".e-gridheader").find(".e-filterbar").find("th").find("input"),n=0;n<r.length;n++)u.eq(n).val(r.eq(n).val());this.model.groupSettings.showGroupedColumn||this._hideHeaderColumn(this.model.groupSettings.groupedColumns,!0);this.refreshTemplate();this.element.find(".e-gridcontent").children("div").first().empty().append(this._renderGridContent().find("table").first());this.setGridContent(this.element.find(".e-gridcontent"));this._gridRows=this.model.groupSettings.groupedColumns.length!=0?this.getContentTable().find(".e-recordtable").find("tbody").find("tr").toArray():this.getContentTable().get(0).rows;this.element.find(".e-groupdroparea").first().hasClass("e-allowDrop")&&this.element.find(".e-groupdroparea").first().removeClass("e-allowDrop")},_groupHeaderCellClick:function(t){var i=n(t.target),r;i.hasClass("e-groupdroparea")||(i.hasClass("e-ungroupbutton")?(r=i.parent().attr("ej-mappingname"),this.ungroupColumn(r)):i.hasClass("e-togglegroupbutton")?(r=i.parent().attr("ej-mappingname"),i.hasClass("e-toggleungroup")&&this.ungroupColumn(r)):i.hasClass("e-animatebutton")?n(t.target).hasClass("e-animatebuttondown")?this.expandGroupDropArea():this.collapseGroupDropArea():(i.addClass("e-headercelldiv"),this._mouseClickHandler(t),i.removeClass("e-headercelldiv")))},_captionSummary:function(i){for(var f=null,u=this.model.summaryRows,e=u.length,r=0;r<e;r++)if(u[r].showCaptionSummary==!0){f=n(u[r]);break}return i&&(left=u.slice(0,r),right=u.slice(r+1,e),t.merge(f=left,right)),f},_dropAreaHover:function(t){var i=n(t.target),r=this;return t.type=="mouseenter"?(this._dragActive?i.hasClass("e-groupdroparea")&&i.addClass("e-hover"):i.removeClass("e-hover"),i.hasClass("e-groupheadercell")&&this.model.groupSettings.showUngroupButton&&i.find(".e-ungroupbutton").show(150)):t.type=="mouseleave"&&(i.hasClass("e-groupdroparea")&&(i.find(".e-ungroupbutton").hide(150),i.removeClass("e-hover")),i.hasClass("e-groupheadercell")&&this.model.groupSettings.showUngroupButton&&i.find(".e-ungroupbutton").hide(150)),!1},_groupingCompleteAction:function(n){var r=this.element.children(".e-groupdroparea"),i;if((this.model.groupSettings.groupedColumns.length&&r.find(".e-grid-icon").length==0||t.Grid.Actions.Refresh==n.requestType)&&r.empty(),this.initialRender||t.Grid.Actions.Refresh==n.requestType){for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)this._addColumnToGroupDrop(this.model.groupSettings.groupedColumns[i]);this._refreshGridPager()}else this._addColumnToGroupDrop(n.columnName);for(this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),i=0;i<this.model.sortSettings.sortedColumns.length;i++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[i].field,this.model.sortSettings.sortedColumns[i].direction);!this.initialRender&&t.gridFeatures.dragAndDrop&&this._groupHeaderCelldrag();this.model.allowScrolling&&this.getContentTable().parent().scrollLeft(this.getHeaderTable().parent().scrollLeft()-1);this.element.children(".e-cloneproperties").remove();t.gridFeatures.filter&&["menu","excel"].indexOf(this.model.filterSettings.filterType)&&this._refreshFilterIcon()},_ungroupingCompleteAction:function(n){var r=this.element.children(".e-groupdroparea"),i;for(n.requestType!=t.Grid.Actions.Refresh&&this._removeColumnFromDrop(n.columnName),this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),i=0;i<this.model.sortSettings.sortedColumns.length;i++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[i].field,this.model.sortSettings.sortedColumns[i].direction);this.model.groupSettings.groupedColumns.length==0&&(r.html(this.model.groupSettings.enableDropAreaAutoSizing?"":this.localizedLabels.GroupDropArea),this.model.groupSettings.enableDropAreaAutoSizing&&r.append(t.buildTag("div.e-animatebutton e-icon").addClass(this.model.groupSettings.enableDropAreaAutoSizing?"e-animatebuttondown e-gdownarrow":"e-animatebuttonup e-guparrow")),r.css("height","auto"));t.gridFeatures.dragAndDrop&&this._headerCellgDragDrop();this.model.allowReordering&&t.gridFeatures.dragAndDrop&&this._headerCellreorderDragDrop();this.model.allowScrolling&&this.getContentTable().parent().scrollLeft(this.getHeaderTable().parent().scrollLeft()-1);this.element.children(".e-cloneproperties").remove();t.gridFeatures.filter&&["menu","excel"].indexOf(this.model.filterSettings.filterType)&&this._refreshFilterIcon()},_getToggleButton:function(){return t.buildTag("span.e-togglegroupbutton e-icon e-gridgroupbutton"," ")},_checkEinHeader:function(t){for(var u,r=this.element.children(".e-gridheader").find("thead").find(".e-columnheader").find(".e-headercell"),i=0;i<r.length;i++){if(n.trim(r.eq(i).find("div").attr("ej-mappingname"))==t)return r.eq(i);if(this.model.allowSorting&&this.model.allowMultiSorting&&(u=n(r.eq(i)).clone(),u.find(".e-number").remove(),n.trim(u.find("div").attr("ej-mappingname"))==t))return u}return null},_checkEinGroupDrop:function(t){for(var r=this.element.children(".e-groupdroparea").find(".e-grid-icon"),i=0;i<r.length;i++)if(n.trim(r.eq(i).find("div").attr("ej-mappingname"))==t)return r.eq(i);return null},_addColumnToGroupDrop:function(i){var r=t.buildTag("div.e-grid-icon e-groupheadercell"),h=this.element.find(".e-groupdroparea").first(),u=t.buildTag("div",{},{},{"ej-mappingname":i}),c="e-rarrowup-2x",f=this.getColumnByField(i),e,o;f.disableHtmlEncode?r.append(u.text(f.headerText)):f.headerTemplateID?r.append(u.html(n(f.headerTemplateID).html())):r.append(u.html(f.headerText));e=this._checkEinHeader(i);this.model.groupSettings.showToggleButton&&(u.append(this._getToggleButton().addClass("e-toggleungroup")),e.find(".e-headercelldiv").find(".e-togglegroupbutton").remove().end().append(this._getToggleButton().addClass("e-toggleungroup")));o="ascending";e.find(".e-ascending,.e-descending").length&&(o=e.find(".e-ascending,.e-descending").hasClass("e-ascending")?"ascending":"descending",c=o=="ascending"?"e-rarrowup-2x":"e-rarrowdown-2x");u.append(this._createSortElement().addClass("e-"+o+" "+c));this.model.groupSettings.showUngroupButton&&u.append(t.buildTag("span.e-ungroupbutton e-icon e-cancel"," ",{},{title:this.localizedLabels.UnGroup}));h.append(r).css("height","auto");var l=r.offset().left,s=r.clone().css("position","absolute"),a=this;r.css("visibility","hidden");h.append(s).dequeue();s.css({left:l+150}).animate({left:l},150,function(){r.css("visibility","visible");s.remove()})},_removeColumnFromDrop:function(t){for(var f=this.getHeaderTextByFieldName(t),e=this,u=this.element.children(".e-groupdroparea"),r=u.css("height","30px").find(".e-grid-icon"),i=0;i<r.length;i++)n.trim(r.eq(i).find("div").attr("ej-mappingname"))==t&&(this.model.groupSettings.groupedColumns.length==0?this.collapseGroupDropArea():r.eq(i).remove())},_setAggreatedCollection:function(n){if((!(this._dataSource()instanceof t.DataManager)||this._dataManager.dataSource.url==i||this._isRemoteSaveAdaptor||this._dataManager.dataSource.offline)&&!this.model.enableLoadOnDemand){var r;r=this._dataManager.executeLocal(n).result;this._aggregatedCollection=r}},_setAggregates:function(n,i){var r,e,k=new t.Query,l,a,s,u,h,y,v,o,p,c,w,f,b;for(n=n||this.model.currentViewData,i=i||this._aggregatedCollection,l=n.length,l!=0&&(s=t.Predicate("field","equal",n[0].field),u=t.Predicate("key","equal",n[0].key),n[0].key instanceof Date&&(h={value:n[0].key,operator:"equal",field:"key"},u=this._setDateFilters(h,!0)),e=s.and(u)),r=1;r<l;r++)s=t.Predicate("field","equal",n[r].field),u=t.Predicate("key","equal",n[r].key),n[r].key instanceof Date&&(h={value:n[r].key,operator:"equal",field:"key"},u=this._setDateFilters(h,!0)),e=e.or(s.and(u));if(i=e?new t.DataManager(i).executeLocal(k.where(e)):i,a=i.length,n.length>0)for(r=0;r<a;r++)if((!(r>0)||!(r<a-1))&&(n[r].count=i[r].count,n[r].items.GROUPGUID&&this._setAggregates(n[r].items,i[r].items),this.model.showSummary))for(y=n[r].aggregates=[],v=this.model.summaryRows,c=0,w=v.length;c<w;c++)for(o=v[c].summaryColumns,f=0,b=o.length;f<b;f++)p=i[r].items.level?i[r].items.records:i[r].items,y[o[f].dataMember+" - "+o[f].summaryType]=this.getSummaryValues(o[f],p)}}}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.dragAndDrop={_headerCellgDragDrop:function(){var i=this,r;this.dragHeaderElement();r=this.element.children("div.e-groupdroparea");r.ejDroppable({accept:r,drop:function(r,u){if(!t.isNullOrUndefined(u.helper)&&u.helper.is(":visible")){var f=i.getColumnByField(n.trim(n(u.draggable[0]).find("div").attr("ej-mappingname")));(u.helper.remove(),i._disabledGroupableColumns.length&&n.inArray(f.field,i._disabledGroupableColumns)!=-1)||(t.isNullOrUndefined(f)||t.isNullOrUndefined(f.field)||f.field==""||i.groupColumn(f.field),i.model.allowGrouping&&i.collapseGroupDropArea())}}})},_headerCellreorderDragDrop:function(){var i=this,r;this.dragHeaderElement();r=this.element.find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell");r.ejDroppable({accept:r,drop:function(r,u){var v,h,l,f,e,c,a,y,p,o,s,w;!t.isNullOrUndefined(u.helper)&&u.helper.is(":visible")&&n(u.draggable[0]).closest(".e-grid").attr("id")==i._id&&((u.draggable.attr("aria-sort")=="ascending"||u.draggable.attr("aria-sort")=="descending")&&(v=i.getColumnByField(n.trim(n(u.draggable[0]).find("div").attr("ej-mappingname"))),i.model.allowSorting&&i.model.allowMultiSorting?i._scolumns.push(v.field):i._gridSort=v.field),a=u.draggable.index(),r.dropTarget.hasClass("e-headercelldiv")?c=r.dropTarget.parent().index():(r.dropTarget.parent().hasClass("e-headercell")||r.dropTarget.hasClass("e-headercell"))&&(c=r.dropTarget.index()),(n(r.dropTarget).hasClass("e-number")||n(r.dropTarget).hasClass("e-icon"))&&(c=r.dropTarget.closest(".e-headercell").index()),i.model.scrollSettings.frozenColumns>0?(f=u.draggable.closest(".e-frozenheaderdiv").length>0?a:a+i.model.scrollSettings.frozenColumns,e=r.dropTarget.closest(".e-frozenheaderdiv").length>0?c:c+i.model.scrollSettings.frozenColumns):(f=a,e=c),i.model.allowGrouping&&i.model.groupSettings.groupedColumns.length>0?(f=f-i.model.groupSettings.groupedColumns.length,e=e-i.model.groupSettings.groupedColumns.length):(i.model.detailsTemplate!=null||i.model.childGrid!=null)&&(f=f-1,e=e-1),h=i.getColumnByIndex(f),l=i.getColumnByIndex(e),y=!t.isNullOrUndefined(h)&&!t.isNullOrUndefined(h.field)&&h.field!=""?h.field:null,p=!t.isNullOrUndefined(l.field)&&l.field!=""?l.field:null,u.helper.remove(),o=n(r.dropTarget).clone(),o.find(".e-number").remove(),t.isNullOrUndefined(y)||t.isNullOrUndefined(p)?i.reorderColumns(f,e):(n(r.dropTarget).hasClass("e-droppable")?(o=o.children(".e-headercelldiv"),s=n(r.dropTarget).children(".e-headercelldiv")):(o=n(r.dropTarget).parent(),s=n(r.dropTarget),n(s).hasClass("e-filtericon")&&(s=o=n(s).siblings(".e-headercelldiv"))),w=i.model.allowSorting&&i.model.allowMultiSorting?r.dropTarget.hasClass("e-number")||r.dropTarget.hasClass("e-icon")?i.getColumnByField(n.trim(o.attr("ej-mappingname"))):i.getColumnByField(n.trim(s.attr("ej-mappingname"))):r.dropTarget.hasClass("e-icon")&&!r.dropTarget.hasClass("e-filtericon")?i.getColumnByField(n.trim(o.attr("ej-mappingname"))):i.getColumnByField(n.trim(s.attr("ej-mappingname"))),i.reorderColumns(h.field,w.field)),i.model.allowGrouping&&i.collapseGroupDropArea())}})},dragHeaderElement:function(){var i=this,f=this.element.children("div.e-gridheader").find("th.e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell"),u=t.buildTag("div.e-cloneproperties e-grid","",{height:"20px","z-index":2}),r;f.ejDraggable({cursorAt:{top:0,left:0},helper:function(t){var f,s,e,o;return i.element.find(".e-dragclone").length>0&&i.element.find(".e-dragclone").remove(),f=n(t.element).hasClass("e-headercell")?n(t.element):n(t.element).closest("th"),s=f.find(".e-headercelldiv"),e=n(t.element).index(),i.model.allowGrouping&&i.model.groupSettings.groupedColumns.length>0?e=e-i.model.groupSettings.groupedColumns.length:(i.model.detailsTemplate!=null||i.model.childGrid!=null)&&(e=e-1),r=i.getColumnByIndex(e),i._$curSElementTarget=s,i.model.allowSorting&&i.model.allowMultiSorting?(o=n(f).clone(),o.find(".e-number").remove(),u.text(o.text()).clone().width(f.outerWidth()+2).height(f.height()+2).css({"font-size":parseInt((f.height()+3)/2)}).addClass("e-dragclone").appendTo(i.element)):u.text(f.text()).clone().width(f.outerWidth()+2).height(f.height()+2).css({"font-size":parseInt((f.height()+3)/2)}).addClass("e-dragclone").appendTo(i.element)},dragStart:function(t){var e=t.target,s=n(e),h={target:e,draggableType:"headercell",column:r},u,f,o=!1;return(i.model.groupSettings.showToggleButton&&r&&r.allowGrouping&&(u=n.inArray(r.field,i.model.groupSettings.groupedColumns),f=n(t.element).find(".e-togglegroupbutton").hasClass("e-togglegroup"),(u!=-1&&f||u==-1&&!f)&&(o=!0)),i._resizer!=null&&i._resizer._expand||o||s.eq(0).hasClass("e-filtericon")||r&&r.allowGrouping==!1&&r.allowReordering==!1)?(n(".e-dragclone").remove(),!1):(i._dragActive=!0,i.model.allowGrouping&&i.expandGroupDropArea(),i._trigger("columnDragStart",h)?!1:void 0)},drag:function(t){var u=n(t.target),e={target:u,draggableType:"headercell",column:r},f;if(i._trigger("columnDrag",e))return!1;u.closest(".e-grid").attr("id")===i._id&&(i.getHeaderTable().find(".e-headercell").removeClass("e-reorderindicate"),!i.model.allowReordering||!(u.hasClass("e-headercelldiv")||u.hasClass("e-headercell"))||u.hasClass("e-detailheadercell")||u.hasClass("e-stackedHeaderCell")||u.parent().hasClass("e-grouptopleftcell")||(document.body.style.cursor="",u.addClass("e-allowDrop"),i.getHeaderTable().find(".e-reorderindicate").removeClass("e-reorderindicate"),u.hasClass("e-headercell")?u.addClass("e-reorderindicate"):u.parent().addClass("e-reorderindicate")),i.model.allowScrolling&&(f=t.event.type=="touchmove"?t.event.originalEvent.touches[0].pageX:t.event.pageX,i._dragAutoScrollX(f,t)),u.hasClass("e-groupdroparea")||u.closest(".e-groupdroparea").length?(document.body.style.cursor="default",u.addClass("e-allowDrop")):u.hasClass("e-headercelldiv")||u.hasClass("e-headercell")?document.body.style.cursor="pointer":u.hasClass("e-rowcell")&&(document.body.style.cursor="not-allowed"))},dragStop:function(t){if(!t.element.dropped){var u=n(t.target),f={target:u,draggableType:"headercell",column:r};i._trigger("columnDrop",f);i.element.find(".e-groupdroparea").removeClass("e-hover");i.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive").removeClass("e-active");n(t.target).closest(".e-groupdroparea").length||n(t.target).closest(".e-columnheader").length&&i.model.allowReordering&&!n(t.target).hasClass("e-stackedHeaderCell")||n(".e-dragclone").remove();(n(t.target).hasClass("e-rowcell")||n(t.target).hasClass("e-stackedHeaderCell"))&&i.collapseGroupDropArea();i._dragActive=!1;i.getHeaderTable().find(".e-reorderindicate").removeClass("e-reorderindicate");document.body.style.cursor="";n(i._Indicator).css("display","none")}}})},_groupHeaderCelldrag:function(){var u=t.buildTag("div.e-cloneproperties e-grid","",{height:"20px","z-index":2}),i=childProxy=this,f=this.element.children(".e-groupdroparea").find(".e-groupheadercell"),r;f.ejDraggable({cursorAt:{top:0,left:0},helper:function(t){var r=n(t.sender.target).closest(".e-grid-icon");return u.text(n(t.sender.target).closest(".e-groupheadercell").text()).clone().width(r.width()+2).height(r.height()+2).addClass("e-dragclone").appendTo(i.element)},dragStart:function(n){var r=n.target,t;return n.model.cursorAt={top:0,left:0},t={target:r,draggableType:"groupheadercell"},i._trigger("columnDragStart",t)?!1:void 0},drag:function(t){n(".Sibling").remove();var r=n(t.target),u={target:r,draggableType:"groupheadercell"};if(i._trigger("columnDrag",u))return!1;r.closest("div.e-gridcontent").length?(document.body.style.cursor="",r.addClass("e-allowDrop")):document.body.style.cursor=n(t.target).closest(".e-columnheader").length>0?"pointer":"not-allowed"},dragStop:function(t){if(childProxy=i,!t.element.dropped){var r=n(t.target),u={target:r,draggableType:"groupheadercell"};n(t.target).closest(".e-rowcell").length||n(t.target).closest(".e-groupcaption").length||n(t.target).closest(".e-columnheader").length||n(".e-dragclone").remove();document.body.style.cursor=""}}});r=this.element.children(".e-gridcontent, .e-gridheader");r.ejDroppable({accept:i.element.children("div.e-groupdroparea").find(".e-groupheadercell"),drop:function(i,r){if(!t.isNullOrUndefined(r.helper)&&r.helper.is(":visible")&&r.draggable.hasClass("e-groupheadercell")){var u=n(r.draggable[0]).find("div").attr("ej-mappingname");r.helper.remove();t.isNullOrUndefined(u)||childProxy.ungroupColumn(u)}}})},_rowsDragAndDrop:function(){this.dragRowElement();var r=this.getContentTable(),i=this;r.ejDroppable({accept:r,drop:function(r,u){var v=n(r.dropTarget).closest("tr"),f,l,h,c,o,a;if(!u.helper.find("tr.e-srcgridinfo").length||(i._draggedGridID=u.helper.find("tr.e-srcgridinfo").children("td").text(),f=i._draggedGridID!=i._id?n("#"+i._draggedGridID).ejGrid("instance"):i,f._id!=i._id&&f.model.rowDropSettings.dropTargetID!="#"+i._id))return!1;var s=f.getSelectedRecords(),e=l=i.getIndexByRow(v);if(e==-1&&(e=l=0),e=e+i._currentPage()*i.model.pageSettings.pageSize-i.model.pageSettings.pageSize,h={sourceID:f._id,destinationID:i._id,destinationRowIndex:e},o={target:v,targetIndex:e,draggedRecords:s,dropDetails:h},!i._trigger("beforeRowDrop",o))if(c=i._dataSource()instanceof t.DataManager?i._dataSource().dataSource:i._dataSource(),t.isNullOrUndefined(i.model.rowDropSettings.dropMapper)||(t.isNullOrUndefined(c.headers)&&(c.headers=[]),c.headers.push({rowDropDetails:JSON.stringify(h)})),i._id!=f._id){var p=i._dataManager,w=i._dataSource().adaptor,y=f.getBatchChanges();y.deleted=s;o={dropDetails:h,records:s,requestType:t.Grid.Actions.Refresh,targetIndex:e,action:"rowDragged"};i._processDropRequest(f,y,"drag",o);a=i.getBatchChanges();a.added=s;o.action="rowDropped";i._processDropRequest(i,a,"drop",o)}else i._draggedGridID==i._id&&(i.reorderRows(f.selectedRowsIndexes,l),n(".e-dragclone").remove())}})},_dragAutoScrollX:function(n){var u=n-this.element.offset().left,f=this.element.width()-this.model.scrollSettings.scrollerSize,i=this.getScrollObject(),r=this;i&&i._hScrollbar&&(u<5?this._dragLeftInterval=setInterval(function(){if(r._dragLeftInterval){var n=i.scrollLeft(),u=t.sum(r.columnsWidthCollection)/r.model.columns.length;n>i._hScrollbar.model.minimum?n>u?i.scrollX(i.scrollLeft()-u,!0):i.scrollX(i._hScrollbar.model.minimum,!0):r._dragLeftInterval&&(r._dragLeftInterval=clearInterval(r._dragLeftInterval))}},500):u>f-5?this._dragRightInterval=setInterval(function(){if(r._dragRightInterval){var n=i.scrollLeft(),u=t.sum(r.columnsWidthCollection)/r.model.columns.length;Math.round(n)<i._hScrollbar.model.maximum?i.scrollX(i.scrollLeft()+u,!0):r._dragRightInterval&&(r._dragRightInterval=clearInterval(r._dragRightInterval))}},500):(this._dragLeftInterval&&(this._dragLeftInterval=clearInterval(this._dragLeftInterval)),this._dragRightInterval&&(this._dragRightInterval=clearInterval(this._dragRightInterval))))},_dragAutoScroll:function(n,t){var i=n.getContent().data("ejScroller"),r=n.getContent()[0].getBoundingClientRect();r||(r=n.getContent().offset());i&&i._vScrollbar&&(r.top>=t.event.clientY?n._dragUpInterval=setInterval(function(){if(n._dragUpInterval){var t=-n.getRowHeight(),r=i.scrollTop();r!=0?i.scrollY(i.scrollTop()+t,!0):n._dragUpInterval&&(n._dragUpInterval=clearInterval(n._dragUpInterval))}},500):r.top+n.getContent().height()<=t.event.clientY?n._dragDownInterval=setInterval(function(){if(n._dragDownInterval){var t=n.getRowHeight(),r=i.scrollTop();Math.round(r)<=i._vScrollbar.model.maximum?i.scrollY(i.scrollTop()+t,!0):n._dragDownInterval&&(n._dragDownInterval=clearInterval(n._dragDownInterval))}},500):(n._dragUpInterval&&(n._dragUpInterval=clearInterval(n._dragUpInterval)),n._dragDownInterval&&(n._dragDownInterval=clearInterval(n._dragDownInterval))))},dragRowElement:function(){var i=this,r=n(this.getRows());r.ejDraggable({cursorAt:{top:-8,left:-8},helper:function(r){var f,u,e,o,h,s;return(this.clone=!0,f=n(r.element).closest("tr"),i._selectDrag||!f.length||n.inArray(i.getIndexByRow(f),i.selectedRowsIndexes)==-1)?!1:(u=t.buildTag("div.e-cloneproperties e-draganddrop e-grid","",{height:"auto","z-index":2,position:"absolute",width:i.element.width()}),u.append(t.buildTag("table","",{width:i.element.width()})),o=n(i.getRows()).clone().removeClass(),h=0,e=n.map(o,function(t,r){if(n.inArray(r,i.selectedRowsIndexes)!=-1)return t}),s=t.buildTag("tr.e-srcgridinfo e-grid","",{display:"none",height:"auto"}).append("<td>"+i._id+"<\/td>"),e.push(s[0]),n(e).find("td").removeClass("e-selectionbackground e-active"),u.find("table").append(e),f.find("td.e-selectionbackground").length||u.css("display","none"),u.addClass("e-dragclone").appendTo(n("body")))},dragStart:function(t){var r=n(t.target).closest("tr");if(i._selectDrag||n.inArray(i.getIndexByRow(r),i.selectedRowsIndexes)==-1)return!1;var u=t.target,f=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),e=i.getSelectedRecords(),o={target:f,currentTarget:u,draggableType:"rows",data:e};if(i._trigger("rowDragStart",o))return!1},drag:function(t){var r=n(t.target),f=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),e=i.getSelectedRecords(),o={target:f,currentTarget:r,draggableType:"rows",data:e},u;if(i._dragAutoScroll(i,t),i._trigger("rowDrag",o))return!1;document.body.style.cursor="not-allowed";u=n(i.model.rowDropSettings.dropTargetID);(r.closest(i.model.rowDropSettings.dropTargetID).length||r.closest("#"+i._id).length)&&(r.closest(".e-grid").length&&(r.closest(".e-rowcell").length||r.closest(".emptyrecord").length)?r.closest("table").addClass("e-allowRowDrop"):u.hasClass("e-grid")||u.addClass("e-allowRowDrop"))},dragStop:function(r){var u,f;if(!r.element.dropped){i._dragUpInterval&&(i._dragUpInterval=clearInterval(i._dragUpInterval));i._dragDownInterval&&(i._dragDownInterval=clearInterval(i._dragDownInterval));var e=n(r.target),o=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),s=i.getSelectedRecords();if(document.body.style.cursor="",u=n(i.model.rowDropSettings.dropTargetID),u.hasClass("e-grid")?u.find(".e-gridcontent").find("table").removeClass("e-allowRowDrop"):u.removeClass("e-allowRowDrop"),i.getContent().find("table").removeClass("e-allowRowDrop"),f={rows:o,target:e,draggableType:"rows",data:s},t.isNullOrUndefined(this._checkTargetElement(r.event))&&n(".e-dragclone").remove(),i._trigger("rowDrop",f))return!1}}})},_processDropRequest:function(i,r,u,f){var e,o;f.action=="rowDragged"&&n(".e-dragclone").remove();e=i._dataManager.dataSource.batchUrl;i._dataManager.dataSource.batchUrl=i.model.rowDropSettings[u+"Mapper"];o=i._dataManager.saveChanges(r,i._primaryKeys[0],i.model.query._fromTable);n.isFunction(o.promise)&&i._dataManager.dataSource.batchUrl!=null?(n("#"+i._id).data("ejWaitingPopup").show(),o.done(function(){i._isLocalData&&u=="drop"&&(f.dropDetails.sourceID==f.dropDetails.destinationID?i._moveDroppedRowIndex(f.targetIndex,f.records,f.draggedRowIndexes):i._moveDroppedRowIndex(f.targetIndex,f.records));u=="drop"&&(i._dataSource()instanceof t.DataManager?i._dataSource().dataSource.headers.pop():i._dataSource().headers.pop());i._dataManager.dataSource.batchUrl=e;i.refreshBatchEditChanges();n("#"+i._id).data("ejWaitingPopup").hide();i._processBindings(f)}),o.fail(function(t){i._dataManager.dataSource.batchUrl=e;n("#"+i._id).data("ejWaitingPopup").hide();f.error=t&&t.error?t.error:t;i._trigger("actionFailure",f)})):(i.refreshBatchEditChanges(),i._dataManager.dataSource.batchUrl=e,u=="drop"&&i._moveDroppedRowIndex(f.targetIndex,f.records),f.dropDetails.sourceID==f.dropDetails.destinationID&&u=="drag"||i._processBindings(f))},reorderRows:function(n,i){var r,u,f;if(!this.model.sortSettings.sortedColumns.length)if(r=this.getSelectedRecords(),this.selectedRowsIndexes=[],u={requestType:t.Grid.Actions.Refresh,action:"rowReordering",draggedRowIndexes:n,targetIndex:i,dropDetails:{sourceID:this._id,destinationID:this._id,DestinationRowIndex:i},records:r},t.isNullOrUndefined(this.model.rowDropSettings.dropMapper)){if(this._trigger("actionBegin",u))return!1;this._moveDroppedRowIndex(i,r,n);this._trigger("actionComplete",u)}else f=this.getBatchChanges(),f.changed=r,this._processDropRequest(this,f,"drop",u)},_moveDroppedRowIndex:function(i,r,u){var a,o,h,p,f;if(t.isNullOrUndefined(u)){if(i>-1)for(h=this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json:this._dataSource(),p=i+this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,f=0;f<r.length;f++)h.splice(i++,0,h.splice(h.length-r.length+f,1)[0])}else{var u=u.sort(function(n,t){return n-t}),c=i,s,e,l=0,v=this.model.currentViewData.slice(),y=this.getRowByIndex(i);for(i+=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,f=0;f<u.length;f++)h=v[u[f]],e=u[f]-l,s=0,a=this._excludeDetailRows(),o=n(a[e]),c>e&&l++,this.model.allowPaging&&(s=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize),e=s+e,this.selectedRowsIndexes.push(c-l),f==u.length-1&&(this.model.selectedRowIndex=this.selectedRowsIndexes[0]),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next().hasClass("e-detailrow")&&(o=o.add(o.next()[0])),y.before(o),c<u[f]-l?c++:i--,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.splice(i+f,0,this._dataSource().dataSource.json.splice(e,1)[0]):this._dataSource().splice(i+f,0,this._dataSource().splice(e,1)[0]),this.model.currentViewData.splice(i+f-s,0,this.model.currentViewData.splice(e-s,1)[0])}}}}(jQuery,Syncfusion),function(n,t,i){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.selection={selectRows:function(r,u,f){var s,st,c,l,lt,at,vt,p,yt,nt,ft,pt,k,e,d,v,b,a,et,ot,y,wt,bt,kt,h;if(!this._allowrowSelection)return!1;if(this._traverseRow!=r&&n(".e-traverse").removeClass("e-traverse"),this._traverseRow=null,s=[],this.initialRender&&(this.model.currentIndex=r),this.model.scrollSettings.enableVirtualization&&(n.isArray(r)?this.model.currentIndex=r[0]:u&&(this.model.currentIndex=r>u?u:r)),!this.multiSelectCtrlRequest&&this.model.scrollSettings.allowVirtualScrolling&&(this._virtuaOtherPage?this._virtualScrollingSelection=!0:(this.clearSelection(),this._virtualScrollingSelection=!1)),n.isArray(r)&&(s=r,r=s[0],this._virtaulSel=[],this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization))for(this._virtualScrollingSelection=!0,this._virtualSelectedRows=s,st=parseInt(r/this.model.pageSettings.pageSize)*this.model.pageSettings.pageSize,d=(parseInt(r/this.model.pageSettings.pageSize)+1)*this.model.pageSettings.pageSize,this._virtaulSel.push(r),this._virtuaOtherPage||(this._virtaulUnSel=[]),e=1;e<s.length;e++)st<s[e]&&s[e]<d?this._virtaulSel.push(s[e]):this._virtaulUnSel.push(s[e]);if(p=n(this.getRows()),this.model.allowScrolling&&!this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&(l=p.eq(r)[0],!t.isNullOrUndefined(l)&&this.model.groupSettings.groupedColumns.length==0)){var ht=this.getScrollObject().scrollTop(),ct=ht+this.getScrollObject().content()[0].clientHeight,tt=l.offsetTop+l.offsetHeight;(!t.isNullOrUndefined(l)&&ct<tt||tt<=ht&&tt<ct)&&(lt=t.isNullOrUndefined(l)?" ":l.offsetTop,at=this.getScrollObject(),at.scrollY(lt))}var h={},g,it=this._currentPage()-1,w=this.model.pageSettings.pageSize;this.model.scrollSettings.enableVirtualization||(v=this.getRowByIndex(r).attr("name"),b=t.isNullOrUndefined(v)?r:parseInt(v)/w+1);t.isNullOrUndefined(r)||(this.model.editSettings.editMode=="batch"&&n(p[r]).hasClass("e-insertedrow")?(vt=this.batchChanges.added.reverse(),c=vt[r],this.batchChanges.added.reverse()):c=this.model.editSettings.editMode=="batch"?this._currentJsonData[r-this.batchChanges.added.length]:this._currentJsonData[t.isNullOrUndefined(r)?u:r]);var o=r,rt=this._previousIndex,ut=this.getRowByIndex(this._previousIndex);if(h={rowIndex:o,row:p.eq(r),data:c,target:f,prevRow:ut,prevRowIndex:rt},this.model.scrollSettings.allowVirtualScrolling&&(h=this._getVirtualRows(r,f,"selectRows",s),this.model.scrollSettings.enableVirtualization||(r=h.rowIndex),c=h.data,o=h.rowIndex,rt=h.prevRowIndex,ut=h.prevRow),!this._trigger("rowSelecting",h)){if(f&&f.hasClass("e-checkselectall")&&this._isLocalData&&this._isMapSelection)return this._headerCheckUpdateAll(!f[0].checked);if(p=n(this.getRows()),this._isMapSelection&&!this._selectionByGrid&&t.isNullOrUndefined(u)&&!s.length){c[this._selectionMapColumn]=!h.row.find(".e-checkcelldiv input").prop("checked");this.updateRecord(this._primaryKeys[0],c,"update");return}if((this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this.model.isEdit&&this.model.enableAutoSaveOnSelectionChange&&(!(this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal")||this.getContentTable().find(".e-editedrow").length!=0)){if(this.endEdit())return;(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none")}if(this.checkSelectedRowsIndexes[it]!=i||this._isMapSelection||(this.checkSelectedRowsIndexes[it]=[]),s.length>0){for(e=0;e<s.length;e++)this.selectedRowsIndexes.indexOf(s[e])==-1&&this.selectedRowsIndexes.push(s[e]),this._selectedMultipleRows(this.selectedRowsIndexes),this._isMapSelection&&!this._selectionByGrid&&(y=this._currentJsonData[s[e]],y[this._selectionMapColumn]=!0,this.batchChanges.changed.push(y));if(!this.model.scrollSettings.enableVirtualization)for(yt=this._virtaulSel[0]-r,e=0;e<this._virtaulSel.length;e++)this._virtaulSel[e]-=yt;if(rows=this.getRowByIndex(this.model.scrollSettings.allowVirtualScrolling?this._virtaulSel:s),this.model.scrollSettings.frozenColumns&&(rows=n(rows[0]).add(rows[1])),n(rows).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),this._enableCheckSelect&&!this._isMapSelection&&n(rows).find(".e-checkcelldiv input").prop("checked","checked"),Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords()),this._isMapSelection&&!this._selectionByGrid){this.batchSave();return}}else if(t.isNullOrUndefined(u)||t.isNullOrUndefined(r)){r=t.isNullOrUndefined(r)?u:r;o=r;switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){this.model.selectedRecords=[];nt=n.inArray(o,this.selectedRowsIndexes);nt!=-1&&!this._isMapSelection&&this.clearSelection(o,f)&&this.selectedRowsIndexes.splice(nt,0);nt==-1&&(this.selectedRowsIndexes.push(o),this._selectedMultipleRows(this.selectedRowsIndexes),ft=this.getRowByIndex(r),ft.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),this.model.scrollSettings.enableVirtualization?this._virtualSelectedRecords[o]=this._getSelectedViewData(r,f).data:this._virtualSelectAction(b,r,w),(this._enableCheckSelect&&f&&!f.parent().hasClass("e-checkcelldiv")||t.isNullOrUndefined(f)&&this._enableCheckSelect)&&ft.find(".e-checkcelldiv input").prop("checked","checked"));Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords());break}case t.Grid.SelectionType.Single:this.clearSelection();this.clearColumnSelection();this.selectedRowsIndexes=[];this.model.selectedRecords=[];this._virtualSelectedRecords={};this.selectedRowsIndexes.push(o);this._selectedMultipleRows(this.selectedRowsIndexes);this.getRowByIndex(r).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active");this.model.scrollSettings.enableVirtualization?this._virtualSelectedRecords[o]=c:this._virtualSelectAction(b,r,w);Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords());this._enableCheckSelect&&this.getRowByIndex(r).find(".e-checkcelldiv [type=checkbox]").prop("checked",!0)}}else if(this.model.selectionType==t.Grid.SelectionType.Multiple&&(this._isMapSelection||this.clearSelection(),this.clearColumnSelection(),this.selectedRowsIndexes=[],this.model.selectedRecords=[],this._virtualSelectedRecords={},$toIndex=u,this._virtualUnSel=[],this._virtualUnSelIndexes=[],this._isMapSelection||!(f&&f.hasClass("e-checkselectall")&&f[0].checked))){for(this.model.scrollSettings.enableVirtualization&&f&&(a=this._getSelectedViewData(u,f).viewIndex,pt=u%this._virtualRowCount,$toIndex=a*this._virtualRowCount-(this._virtualRowCount-pt),o!=this._prevSelIndex&&(o=this._prevSelIndex)),g=o-$toIndex<0,this.model.scrollSettings.enableVirtualization||(rows=g?this.getRowByIndex(r,u+1):this.getRowByIndex(u,r+1)),this.model.scrollSettings.frozenColumns&&(rows=n(rows[0]).add(rows[1])),k=[],e=g?o:$toIndex,d=g?$toIndex:o;e<=d;e++)this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization?(this._virtualSelectedRecords[e]=this._getSelectedViewData(e).data,a=this._getSelectedViewData(e).viewIndex,n.inArray(a,this._currentLoadedIndexes)!=-1?(et=this._currentLoadedIndexes.indexOf(a),ot=e%this._virtualRowCount+et*this._virtualRowCount,ot==0&&et*this._virtualRowCount,k.push(ot)):(this._virtualUnSel.push(e),n.inArray(a,this._virtualUnSelIndexes)==-1&&this._virtualUnSelIndexes.push(a))):(v=this.getRowByIndex(e).attr("name"),b=t.isNullOrUndefined(v)?r:parseInt(v)/w+1,this._virtualSelectAction(b,e,w))),this.selectedRowsIndexes.push(e),this._selectedMultipleRows(this.selectedRowsIndexes),this._isMapSelection&&!this._selectionByGrid&&(y=this._currentJsonData[e],y[this._selectionMapColumn]=!0,this.batchChanges.changed.push(y));if(this._isMapSelection){this.batchSave();return}this.model.scrollSettings.enableVirtualization&&(rows=this.getRowByIndex(k[0],k[k.length-1]+1));n(rows).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active");Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords());this._enableCheckSelect&&n(rows).find(".e-checkcelldiv input").prop("checked","checked")}this._enableCheckSelect&&(this.checkSelectedRowsIndexes[it]=this.selectedRowsIndexes,this._selectAllCheck||(this.selectedRowsIndexes.length==this._currentJsonData.length||this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.selectedRowsIndexes.length==this._gridRecordsCount?this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").prop("checked","checked"):this._selectionByGrid&&this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").prop("checked",!1)));this._selectedRow()!==o&&n(this.getRowByIndex(o)).attr("aria-selected")=="true"&&this._selectedRow(o);f&&f.hasClass("e-checkselectall")&&!this._isMapSelection&&(wt=this,bt=this._dataSource()instanceof t.DataManager&&this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization?Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize):this.model.pageSettings.totalPages,this.checkSelectedRowsIndexes=f.is(":checked")?[]:n.map(Array(bt),function(){return Array(n.map(Array(wt.model.pageSettings.pageSize),function(n,t){return t}))}));c=this._virtualScrollingSelection?this._virtualSelRecords:c;kt=this.model.scrollSettings.enableVirtualization?o:this._selectedRow();h={rowIndex:kt,row:this.getRowByIndex(this._selectedRow()),data:c,target:f,prevRow:ut,prevRowIndex:rt};this._previousIndex=this.selectedRowsIndexes.length?r:this._previousIndex;this.model.scrollSettings.enableVirtualization&&(this._prevSelIndex=o,this._prevSelRow=this.getRowByIndex(r));this.model._checkSelectedRowsIndexes=this.checkSelectedRowsIndexes;n(this.getRowByIndex(r)).is('[role="row"]')&&n(this.getRowByIndex(o)).attr("aria-selected")=="true"&&this._trigger("rowSelected",h)}},_getVirtualRows:function(i,r,u,f){var p=i,d=this._previousIndex,g=this.getRowByIndex(this._previousIndex),w,c,a={},it=n(this.getRows()),nt,y,e,o,k;if(this.model.scrollSettings.enableVirtualization){var rt=this._virtualRowCount,v=Math.ceil((i+1)/rt),b=v>1?this._virtualRowCount:0;if(this.initialRender||v!=this._currentVirtualIndex&&!r?(this._isThumbScroll=!0,this._refreshVirtualView(v,u,i),i=i!=0?i%this._virtualRowCount+b:i):(!(i>this._virtualRowCount*3)&&(t.isNullOrUndefined(r)||n(r).parent().hasClass("e-headercelldiv")||t.isNullOrUndefined(r[0])||r[0].checked)?i=i%this._virtualRowCount+b:(y=this._getSelectedViewData(i,r).viewIndex,nt=i%this._virtualRowCount,p=y*this._virtualRowCount-(this._virtualRowCount-nt)),i!=p||r||(i=i!=0?i%this._virtualRowCount+b:i)),f.length)for(o=0;o<f.length;o++)y=this._getSelectedViewData(f[o]).viewIndex,n.inArray(y,this._currentLoadedIndexes)!=-1&&this._virtaulSel.push(f[o]),this._virtualSelectedRecords[f[o]]||(this._virtualSelectedRecords[f[o]]=this._getSelectedViewData(f[o]).data);c=this._getSelectedViewData(i,r,v).data;d=this._prevSelIndex;g=this._prevSelRow}else{var s=this.model.pageSettings.pageSize,tt=this.getRowByIndex(i).attr("name"),ut=t.isNullOrUndefined(tt)?i:parseInt(tt)/s+1,l=i%s,h=parseInt(i/s),k=h*s;if(!t.isNullOrUndefined(h)&&h>0&&n.inArray(k,this.virtualLoadedPages)==-1&&t.isNullOrUndefined(r))if(l--,this._virIndex=!0,this._virtualTrIndex=l,this.gotoPage(h+1),e=this,this._dataSource()instanceof t.DataManager){if(this._queryPromise.done(function(n){var t;e._virtuaOtherPage=!0;e._virtualdata=e._currentJsonData;e._pageTo=h;e._virtualScrollingSelection&&(e._virtualSelRecords=n.virtualSelectRecords);var u=parseInt(i/e.model.pageSettings.pageSize)*e.model.pageSettings.pageSize,o=(parseInt(i/e.model.pageSettings.pageSize)+1)*e.model.pageSettings.pageSize,r=[];for(r.push(i),t=1;t<f.length;t++)u<f[t]&&f[t]<o&&r.push(f[t]);return e.selectRows(r),!1}),e._virtualScrollingSelection)return}else{if(e._virtualdata=e._currentJsonData,f.length>0)for(e._virtualSelRecords=[],o=0;o<f.length;o++)e._virtualSelRecords.push(this.model.dataSource[f[o]]);e._pageTo=h}for(this._virtuaOtherPage&&(this._virtuaOtherPage=!1),o=0;o<this._loadedJsonData.length;o++)this._loadedJsonData[o].pageIndex==ut&&(w=this._loadedJsonData[o].data);c=t.isNullOrUndefined(w)?this._currentJsonData[l]:w[l];c=this._virtualScrollingSelection?this._virtualSelRecords:c;k=this._pageTo*s;!t.isNullOrUndefined(this._virtualdata)&&this._virtualdata.length>0?(i=n(document.getElementsByName(k)[l]).index(),c=this._virtualdata[l],this._virtualdata=[]):n(document.getElementsByName(h*s)).length>0&&!t.isNullOrUndefined(this._pageTo)&&(i=n(document.getElementsByName(h*s)[i%s]).index())}return a={rowIndex:this.model.scrollSettings.enableVirtualization?p:i,row:it.eq(i),data:c},u=="selectRows"&&(a.prevRow=g,a.prevRowIndex=d),a},_selectingMultipleRows:function(n){this._modelMultiSelectedIndexes=n;this.clearSelection();this.multiSelectCtrlRequest=!0;for(var t=0;t<n.length;t++)this.selectRows(n[t]);this.multiSelectCtrlRequest=!1;this._modelMultiSelectedIndexes=[]},_virtualSelectAction:function(n,i,r){this.model.scrollSettings.allowVirtualScrolling&&!t.isNullOrUndefined(i)&&(this._virtualSelectedRecords[i]=t.isNullOrUndefined(this._virtualLoadedRecords[n])?this._currentJsonData[i%r]:this._virtualLoadedRecords[n][i%r])},_getSelectedViewData:function(t,i,r){var o=t%this._virtualRowCount,u,f={},e;return u=i?parseInt(n(i).closest("tr").attr("name"),32):r?r:t>1?Math.ceil((t+1)/this._virtualRowCount):1,f.viewIndex=u,this._virtualLoadedRecords[u]&&(f.data=this._virtualLoadedRecords[u][o]),e=t%this._virtualRowCount,f.rowIndex=u*this._virtualRowCount-(this._virtualRowCount-e),f},selectCells:function(r){var y,tt,it,g,nt,e,b,h,c,l,u,v,f,ut,d,k;if(!this._allowcellSelection)return!1;if(y=null,g=this._excludeDetailRows(),y=this.model.scrollSettings.frozenColumns?this._frozenCell(r[0][0],r[0][1][0]):g.eq(r[0][0]).find(".e-rowcell:eq("+r[0][1]+")"),t.isNullOrUndefined(this._previousRowCellIndex)||this._previousRowCellIndex.length==0||(this.model.scrollSettings.enableVirtualization?(tt=this._prevRowCell,it=this._preVirRowCellIndex):(tt=n(this.getRowByIndex(this._previousRowCellIndex[0][0]).find(".e-rowcell:eq("+this._previousRowCellIndex[0][1]+")")),it=this._previousRowCellIndex)),nt=this._currentJsonData[r[0][0]],e=r[0][0],this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(b=this._getSelectedViewData(r[0][0],y),nt=b.data,e=b.rowIndex),k={currentCell:y,cellIndex:r[0][1],data:nt,previousRowCellIndex:it,previousRowCell:tt},this.model.selectionType=="multiple"&&(k.isCtrlPressed=this.multiSelectCtrlRequest,k.isShiftPressed=this.multiSelectShiftRequest),!this._trigger("cellSelecting",k)){switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){d=n.inArray(e,this._rowIndexesColl);d!=-1?this.selectedRowCellIndexes[d].cellIndex.push(parseInt(r[0][1].toString())):(n.inArray(e,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(e),this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:r[0][1]}));y.addClass("e-cellselectionbackground e-activecell");break}else if(this.multiSelectShiftRequest&&this._previousRowCellIndex!=i){this.clearCellSelection();this.clearColumnSelection();this.selectedRowCellIndexes=[];var p=this._previousRowCellIndex[0][0],s=parseInt(this._previousRowCellIndex[0][1]),a=r[0][0],o=parseInt(r[0][1]);if(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(p=this._preVirRowCellIndex[0][0],a=this._getSelectedViewData(a,this.getRowByIndex(a).find(".e-rowcell")).rowIndex),h=[],this.model.selectionSettings.cellSelectionMode=="box"){var et=this.model.scrollSettings.frozenColumns?this.getRows()[0].length-1:this.getRows().length-1,rt=s<o?s:o,ft=rt==o?s:o,w=[],h=[];for(u=rt;u<=ft;u++){if(c=p,l=a,c<l)for(f=c;f<=l;f++)n.inArray(f,w)==-1&&w.push(f),this._selectMultipleCells(f,u,o,s);else for(f=l;f<=c;f++)n.inArray(f,w)==-1&&w.push(f),this._selectMultipleCells(f,u,o,s);h.push(u)}for(u=0;u<w.length;u++)this.selectedRowCellIndexes.push({rowIndex:w[u],cellIndex:h});this._rowIndexesColl=t.distinct(w)}else if(a>p)for(u=p;u<=a;u++){for(h=[],c=u==p?s:0,l=u==a?o:this.model.columns.length-1,f=c;f<=l;f++)h.push(f),this._selectMultipleCells(u,f,o,s);this.selectedRowCellIndexes.push({rowIndex:u,cellIndex:h});this._rowIndexesColl.push(u)}else for(u=p;u>=a;u--){if(h=[],c=u==p?s:this.model.columns.length-1,l=u==a?o:0,c>l)for(f=c;f>=l;f--)h.push(f),this._selectMultipleCells(u,f,o,s);else for(f=l;f>=c;f--)h.push(f),this._selectMultipleCells(u,f,o,s);this.selectedRowCellIndexes.push({rowIndex:u,cellIndex:h});this._rowIndexesColl.push(u)}break}else{for(this.clearCellSelection(),this._virtualRowCellSelIndex=[],u=0;u<r.length;u++)if(r[u][1].length>1)for(v=g.eq(r[u][0]).find(".e-rowcell"),this.model.scrollSettings.frozenColumns&&(v=n(g[0]).eq(r[u][0]).find(".e-rowcell").add(n(g[1]).eq(r[u][0]).find(".e-rowcell"))),f=0;f<v.length;f++)ut=this.model.detailsTemplate!=null||this.model.childGrid!=null?v[f].cellIndex-1:f,n.inArray(ut,r[u][1])!=-1&&(n(v[f]).addClass("e-cellselectionbackground e-activecell"),d=n.inArray(r[u][0],this._rowIndexesColl),d!=-1?this.selectedRowCellIndexes[d].cellIndex.push(v[f].cellIndex):(e=r[u][0],this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(b=this._getSelectedViewData(e,v),nt=b.data,e=b.rowIndex),this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:[v[f].cellIndex]}),this._rowIndexesColl.push(r[u][0])));else this.model.scrollSettings.frozenColumns?this._frozenCell(r[u][0],r[u][1][0]).addClass("e-cellselectionbackground e-activecell"):n(this.getRowByIndex(r[u][0]).find(".e-rowcell:eq("+r[u][1]+")")).addClass("e-cellselectionbackground e-activecell"),this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:r[u][1]}),this._rowIndexesColl.push(e);break}case t.Grid.SelectionType.Single:this.clearCellSelection();this.clearColumnSelection();this.selectedRowCellIndexes=[];this._virtualRowCellSelIndex=[];n.inArray(e,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(e);this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:r[0][1]});this.model.scrollSettings.frozenColumns?this._frozenCell(r[0][0],r[0][1][0]).addClass("e-cellselectionbackground e-activecell"):n(this.getRowByIndex(r[0][0]).find(".e-rowcell:eq("+r[0][1]+")")).addClass("e-cellselectionbackground e-activecell")}k={currentCell:y,cellIndex:r[0][1],data:nt,selectedRowCellIndex:this.selectedRowCellIndexes,previousRowCellIndex:it,previousRowCell:tt};(!this.multiSelectShiftRequest||t.isNullOrUndefined(this._previousRowCellIndex))&&(this._previousRowCellIndex=r,this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._preVirRowCellIndex=n.extend(!0,[],r),this._preVirRowCellIndex[0][0]=e),this._prevRowCell=y);this._trigger("cellSelected",k)}},_selectMultipleCells:function(t,i){var r,u,f;this.model.scrollSettings.frozenColumns?this._frozenCell(t,i).addClass("e-cellselectionbackground e-activecell"):this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization?(r=this._getSelectedViewData(t).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&(u=this._currentLoadedIndexes.indexOf(r),f=t%this._virtualRowCount+u*this._virtualRowCount,n(this.getRowByIndex(f).find(".e-rowcell:eq("+i+")")).addClass("e-cellselectionbackground e-activecell"),n.inArray(t,this._virtualRowCellSelIndex)==-1&&n.inArray(t,this._rowIndexesColl)!=-1&&t!=this._preVirRowCellIndex[0][0]&&this._virtualRowCellSelIndex.push(t))):n(this.getRowByIndex(t).find(".e-rowcell:eq("+i+")")).addClass("e-cellselectionbackground e-activecell")},selectColumns:function(r,u){var s,v,c,l,f,h,o;if(!this._allowcolumnSelection)return!1;this._allowcolumnSelection=!0;var e=this.getRows(),a=this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[this._previousColumnIndex],o={columnIndex:r==i?u:r,headerCell:n(this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[r]),column:this.model.columns[r],previousColumnIndex:this._previousColumnIndex,prevColumnHeaderCell:a},y=this._previousColumnIndex;if(this._previousColumnIndex=(o.isShiftPressed=this.multiSelectShiftRequest)==!0?r==i?u:r:u,this.model.selectionType=="multiple"&&(o.isCtrlPressed=this.multiSelectCtrlRequest,o.isShiftPressed=this.multiSelectShiftRequest),!this._trigger("columnSelecting",o)){if(t.isNullOrUndefined(u)||t.isNullOrUndefined(r)){r=t.isNullOrUndefined(r)?u:r;switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){if(s=n.inArray(r,this.selectedColumnIndexes),s!=-1&&this.clearColumnSelection(r)&&this.selectedColumnIndexes.splice(s,0),s==-1){if(this.selectedColumnIndexes.push(r),this._previousColumnIndex=this.selectedColumnIndexes.length?r:i,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(e,r);else for(f=0;f<e.length;f++)n(this._excludeDetailCells(e[f])[r]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell)")[r]).addClass("e-columnselection")}break}case t.Grid.SelectionType.Single:if(this.clearSelection(),this.clearCellSelection(),this.clearColumnSelection(),this.selectedColumnIndexes=[],this.selectedColumnIndexes.push(r),this._previousColumnIndex=this.selectedColumnIndexes.length?r:i,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(e,r);else for(f=0;f<e.length;f++)n(this._excludeDetailCells(e[f])[r]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell)")[r]).addClass("e-columnselection")}}else if(this.model.selectionType==t.Grid.SelectionType.Multiple)if(this.clearColumnSelection(),this.selectedColumnIndexes=[],v=0,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(v=1),c=r>u?u:r,l=r>u?r+1:u+1,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(e,c,l);else for(f=c;f<l;f++){for(h=0;h<e.length;h++)n(this._excludeDetailCells(e[h])[f]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell)")[f]).addClass("e-columnselection");this.selectedColumnIndexes.push(f)}o={columnIndex:r==i?u:r,headerCell:n(this.getHeaderTable().find(".e-columnheader").last().find("th").not(".e-detailheadercell")[r]),column:this.model.columns[r],selectedColumnIndex:this.selectedColumnIndexes,previousColumnIndex:y,prevColumnHeaderCell:a};this._trigger("columnSelected",o)}},clearSelection:function(r,u){var p=r,g=n(this.getRows()),e=n(this.getRows()),r,l,o,a,w,v,s,y,u,b,h,k,d,f,nt,c;if(this._selectedRow()>=-1){if(e=this.model.scrollSettings.frozenColumns||!t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid)?this._excludeDetailRows():n(this.element.find("tr[aria-selected='true']")),l=e.find("td").hasClass("e-selectionbackground e-active"),l){if(o={},a=n(this.getContent().find("tr[aria-selected='true']")),this.model.scrollSettings.allowVirtualScrolling)t.isNullOrUndefined(r)?(y=this.selectedRowsIndexes[0],u=this.getSelectedRecords().length&&this._enableCheckSelect&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization?this.element.find(".e-headercheckcelldiv .e-checkselectall"):a[0]):y=r,b=this.selectedRowsIndexes,o=this._getVirtualRows(y,u,"clearSelection",b);else{for(t.isNullOrUndefined(r)||(this.model.editSettings.editMode=="batch"&&n(e[r]).hasClass("e-insertedrow")?(w=this.batchChanges.added.reverse(),f=w[r],this.batchChanges.added.reverse()):f=this.model.editSettings.editMode=="batch"?this._currentJsonData[r-this.batchChanges.added.length]:this._currentJsonData[t.isNullOrUndefined(r)?toIndex:r]),v=[],s=0;s<this.selectedRowsIndexes.length;s++)v.push(this._currentJsonData[this.selectedRowsIndexes[s]]);o={rowIndex:r==i?this.selectedRowsIndexes:r,row:r==i?a:g.eq(r),data:r==i?v:f}}if(this._trigger("rowDeselecting",o))return}t.isNullOrUndefined(r)?(e.removeAttr("aria-selected").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-selectionbackground").removeClass("e-active"),this._clearVirtualSelection||(this.selectedRowsIndexes=[],this.model.selectedRecords=[]),this._selectionByGrid||(e.find(".e-checkcelldiv [type=checkbox]").prop("checked",!1),nt=null,this._isMapSelection&&this._headerCheckUpdateAll(!1),Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords()))):(this.getRowByIndex(r).removeAttr("aria-selected").find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),h=this.getRowByIndex(r),this.model.scrollSettings.enableVirtualization&&this.multiSelectCtrlRequest&&(k=parseInt(h.attr("name"),32)*this._virtualRowCount,d=this._virtualRowCount-h.index()%this._virtualRowCount,r=k-d),r=n.inArray(r,this.selectedRowsIndexes),r!=-1&&(this.selectedRowsIndexes.splice(r,1),this._selectedMultipleRows(this.selectedRowsIndexes),this.model.selectedRecords.splice(r,1)),this._enableCheckSelect&&!u&&h.find(".e-checkcelldiv [type=checkbox]").prop("checked",!1),this._isMapSelection&&(this._selectionByGrid||t.isNullOrUndefined(r)||r==-1||(f=this._currentJsonData[p],f[this._selectionMapColumn]=!1,this.updateRecord(this._primaryKeys[0],f,"update")),Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords())));this._enableCheckSelect&&(this.selectedRowsIndexes.length==this._currentJsonData.length||this._selectAllCheck||this.getHeaderTable().find(".e-headercheckcelldiv .e-checkselectall").prop("checked",!1),c=this._currentPage()-1,checkBoxIndex=n.inArray(p,this.checkSelectedRowsIndexes[c]),checkBoxIndex!=-1&&this.checkSelectedRowsIndexes[c].splice(r,1),this.selectedRowsIndexes.length||this._isMapSelection||u||(this.checkSelectedRowsIndexes[c]=[],e.find(".e-checkcelldiv [type=checkbox]").prop("checked",!1)));this.selectedRowsIndexes.length||this._selectedRow(-1)}return this.model._checkSelectedRowsIndexes=this.checkSelectedRowsIndexes,l&&this._trigger("rowDeselected",o)?!0:void 0},_excludeDetailRows:function(){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)||this.model.scrollSettings.frozenColumns?this.model.scrollSettings.frozenColumns>0&&this.getRows()!=null&&this.getRows().length>1?n(this.getRows()[0]).not(".e-detailrow,.e-gridSummaryRows").add(n(this.getRows()[1]).not(".e-detailrow,.e-gridSummaryRows")):n(this.getRows()):n(this.getRows()).not(".e-detailrow,.e-gridSummaryRows")},clearCellSelection:function(r,u){var e,c,l,h,o,s,f;if(this._allowcellSelection){if(e=t.isNullOrUndefined(r)&&t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid)?n(this.element.find(".e-cellselectionbackground")).parent():this._excludeDetailRows(),h=e.find("td").hasClass("e-cellselectionbackground e-activecell"),h){c=this.model.scrollSettings.frozenColumns&&!t.isNullOrUndefined(r)?this._frozenCell(r,u):this.getContent().find(".e-cellselectionbackground");var a=[],y=[u],v=[];for(o=0;o<this.selectedRowCellIndexes.length;o++)for(a.push(this._currentJsonData[this.selectedRowCellIndexes[o].rowIndex]),f=0;f<this.selectedRowCellIndexes[o].cellIndex.length;f++)v.push(this.selectedRowCellIndexes[o].cellIndex[f]);if(s={currentCell:(r||u)==i?c:e.eq(r).find(".e-rowcell").eq(u),cellIndex:(r||u)==i?v:y,data:(r||u)==i?a:this._currentJsonData[r]},this.model.selectionType=="multiple"&&(s.isCtrlPressed=this.multiSelectCtrlRequest,s.isShiftPressed=this.multiSelectShiftRequest),this._trigger("cellDeselecting",s))return!0}if(t.isNullOrUndefined(r))this.model.scrollSettings.frozenColumns&&(e=n(e[0]).add(e[1])),e.find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-cellselectionbackground").removeClass("e-activecell"),this.selectedRowCellIndexes=[],this._rowIndexesColl=[];else{for(f=0;f<this.selectedRowCellIndexes.length;f++)if(this.selectedRowCellIndexes[f].rowIndex==r){l=n.inArray(u,this.selectedRowCellIndexes[f].cellIndex);this.model.scrollSettings.frozenColumns?this._frozenCell(r,u).removeClass("e-cellselectionbackground").removeClass("e-activecell"):e.eq(r).find(".e-rowcell").eq(u).removeClass("e-cellselectionbackground").removeClass("e-activecell");break}f!=this.selectedRowCellIndexes.length&&(this.selectedRowCellIndexes[f].cellIndex.splice(l,1),this.selectedRowCellIndexes[f].cellIndex.length==0&&(this.selectedRowCellIndexes.splice(f,1),this._rowIndexesColl.splice(n.inArray(r,this._rowIndexesColl),1)))}}if(h&&this._trigger("cellDeselected",s))return!0},clearColumnSelection:function(r){var s,h,e,c,l,u,o;if(this._allowcolumnSelection){var f=n(this._excludeDetailRows()),v=n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")),a=v.hasClass("e-columnselection");if(a){for(s=[],h=[],u=0;u<this.selectedColumnIndexes.length;u++)s.push(this.model.columns[this.selectedColumnIndexes[u]]),h.push(n(this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[this.selectedColumnIndexes[u]]));if(e={columnIndex:r==i?this.selectedColumnIndexes:r,headerCell:r==i?h:n(this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[r]),column:r==i?s:this.model.columns[r]},this.model.selectionType=="multiple"&&(e.isCtrlPressed=this.multiSelectCtrlRequest,e.isShiftPressed=this.multiSelectShiftRequest),this._trigger("columnDeselecting",e))return}if(t.isNullOrUndefined(r))f.find(".e-rowcell").removeClass("e-columnselection"),n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")).removeClass("e-columnselection"),this.selectedColumnIndexes=[];else{if(c=0,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(++r,c=1),this.model.scrollSettings.frozenColumns)for(l=r,r>=this.model.scrollSettings.frozenColumns?(l=r-this.model.scrollSettings.frozenColumns,f=n(this.getContent).find(".e-movablecontent").find("tr")):f=n(this.getContent).find(".e-frozencontentdiv").find("tr"),u=0;u<f.length;u++)n(f[u].cells[l]).removeClass("e-columnselection");else for(o=0;o<f.length;o++)n(f[o].cells[r]).removeClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")[r]).removeClass("e-columnselection");this.selectedColumnIndexes.splice(0,r-c)}}if(a&&this._trigger("columnDeselected",e))return!0},getSelectedRows:function(){for(var i=n(),t=0;t<this.selectedRowsIndexes.length;t++)this.model.scrollSettings.frozenColumns>0?(i.push(this.getRowByIndex(this.selectedRowsIndexes[t])[0]),i.push(this.getRowByIndex(this.selectedRowsIndexes[t])[1])):i.push(this.getRowByIndex(this.selectedRowsIndexes[t])[0]);return i},getSelectedRecords:function(){var i=[],t,r;if($gridRows=this.getRows(),this._virtualScrollingSelection)return this._virtualSelRecords;for(t=0;t<this.selectedRowsIndexes.length;t++)this.selectedRowsIndexes[t]!=-1&&(this.model.editSettings.editMode=="batch"&&n($gridRows[this.selectedRowsIndexes[t]]).hasClass("e-insertedrow")?(r=this.batchChanges.added.reverse(),i.push(r[this.selectedRowsIndexes[t]]),this.batchChanges.added.reverse()):this.model.scrollSettings.allowVirtualScrolling?i.push(this._virtualSelectedRecords[this.selectedRowsIndexes[t]]):this.model.editSettings.editMode=="batch"?i.push(this._currentJsonData[this.selectedRowsIndexes[t]-this.batchChanges.added.length]):i.push(this._currentJsonData[this.selectedRowsIndexes[t]]));return i},_setCurrentRow:function(n){(n==t.Grid.Actions.Refresh||n==t.Grid.Actions.Ungrouping||n==t.Grid.Actions.Grouping||n==t.Grid.Actions.Filtering||n==t.Grid.Actions.Sorting||n==t.Grid.Actions.Delete||n==t.Grid.Actions.Save||n==t.Grid.Actions.Paging||n==t.Grid.Actions.Search)&&(this._selectedRow(-1),this._selectedMultipleRows([]),this._virtualDataRefresh||(this.selectedRowsIndexes=[]))},_renderMultiTouchDialog:function(){var n,r,i;this._customPop=t.buildTag("div.e-gridpopup","",{display:"none"});n=t.buildTag("div.e-content");r=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSorting&&(i=t.buildTag("span.e-sortdirect e-icon"),n.append(i));this.model.selectionType==t.Grid.SelectionType.Multiple&&(i=t.buildTag("span.e-rowselect e-icon"),n.append(i));this._customPop.append(n);this._customPop.append(r);this.element.append(this._customPop)}}}(jQuery,Syncfusion),function(n,t,r){t.gridFeatures=t.gridFeatures||{};t.widget("ejGrid","ej.Grid",{_rootCSS:"e-grid",element:null,validTags:["div"],model:null,_requiresID:!0,keyConfigs:{focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",nextPage:"34",previousPage:"33",lastPage:"ctrl+alt+34",firstPage:"ctrl+alt+33",nextPager:"alt+34",previousPager:"alt+33",firstCellSelection:"36",lastCellSelection:"35",firstRowSelection:"ctrl+36",lastRowSelection:"ctrl+35",rowUpSelection:"ctrl+shift+38",rowDownSelection:"ctrl+shift+40",randomSelection:"ctrl+shift+83",upArrow:"38",downArrow:"40",rightArrow:"39",leftArrow:"37",moveCellRight:"9",moveCellLeft:"shift+9",selectedGroupExpand:"alt+40",totalGroupExpand:"ctrl+40",selectedGroupCollapse:"alt+38",totalGroupCollapse:"ctrl+38",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40"},_ignoreOnPersist:["actionBegin","actionComplete","actionFailure","batchAdd","batchDelete","beforeBatchSave","beforeBatchAdd","beforeBatchDelete","beginEdit","cellEdit","cellSave","cellSelecting","cellSelected","cellDeselecting","cellDeselected","columnDrag","columnDragStart","columnDrop","columnSelecting","columnSelected","columnDeselecting","columnDeselected","create","dataBound","destroy","detailsCollapse","detailsExpand","endAdd","endDelete","endEdit","recordClick","recordDoubleClick","load","resized","resizeEnd","resizeStart","rightClick","rowSelected","rowSelecting","rowDeselected","rowDeselecting","rowDrag","rowDragStart","rowDrop","templateRefresh","beforePrint","beforeRowDrop","query","isEdit","toolbarClick","queryCellInfo","mergeCellInfo","currentViewData","enableAltRow","enableRTL","contextClick","contextOpen","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","childGrid","summaryRows","toolbarSettings","editSettings","allowMultiSorting","enableAutoSaveOnSelectionChange","locale","allowCellMerging","allowTextWrap","textWrapSettings","cssClass","dataSource","groupSettings.enableDropAreaAutoSizing","enableRowHover","showSummary","allowGrouping","enableHeaderHover","allowKeyboardNavigation","scrollSettings.frozenRows","scrollSettings.frozenColumns","enableTouch","contextMenuSettings.enableContextMenu","exportToExcelAction","exportToWordAction","exportToPdfAction"],ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","editSettings","pageSettings","enableAutoSaveOnSelectionChange","localization","allowScrolling","cssClass","dataSource","groupSettings.enableDropAreaAnimation","enableRowHover","allowSummary","enableHeaderHover","allowKeyboardNavigation"],ignoreOnToolbarServerClick:[],observables:["dataSource","selectedRowIndex","pageSettings.currentPage","selectedRowIndices"],_tags:[{tag:"columns",attr:["allowEditing","allowFiltering","allowTextWrap","filterType","allowGrouping","allowResizing","allowSorting","cssClass","customAttributes","dataSource","defaultValue","disableHtmlEncode","editTemplate","editType","foreignKeyField","foreignKeyValue","headerTemplateID","headerText","isFrozen","isIdentity","isPrimaryKey","filterBarTemplate","textAlign","templateID","textAlign","headerTextAlign","tooltip","clipMode","validationRules.minlength","validationRules.maxlength","validationRules.range","validationRules.number","validationRules.required","editParams.decimalPlaces",[{tag:"commands",attr:["type","buttonOptions"]}]],content:"template"},{tag:"summaryRows",attr:["showCaptionSummary","showTotalSummary",[{tag:"summaryColumns",attr:["customSummaryValue","dataMember","displayColumn","summaryType","template"]}]]},{tag:"stackedHeaderRows",attr:[[{tag:"stackedHeaderColumns",attr:["headerText","column"]}]]},{tag:"filterSettings.filteredColumns",attr:[]},{tag:"sortSettings.sortedColumns",attr:[]}],_dataSource:t.util.valueFunction("dataSource"),_selectedRow:t.util.valueFunction("selectedRowIndex"),_selectedMultipleRows:t.util.valueFunction("selectedRowIndices"),_currentPage:t.util.valueFunction("pageSettings.currentPage"),defaults:{allowPaging:!1,showColumnChooser:!1,gridLines:"both",allowSorting:!1,showStackedHeader:!1,selectedRecords:[],stackedHeaderRows:[],allowFiltering:!1,allowMultipleExporting:!1,allowSelection:!0,allowGrouping:!1,showSummary:!1,allowResizing:!1,allowResizeToFit:!1,allowTextWrap:!1,allowCellMerging:!1,enableRowHover:!0,enablePersistence:!1,enableFocusout:!1,selectedRowIndex:-1,selectedRowIndices:[],allowSearching:!1,enableToolbarItems:!1,enableHeaderHover:!1,allowReordering:!1,allowKeyboardNavigation:!0,allowRowDragAndDrop:!1,enableTouch:!0,enableLoadOnDemand:!1,columnLayout:"auto",selectionType:"single",dataSource:null,cssClass:"",allowScrolling:!1,locale:"en-US",enableAutoSaveOnSelectionChange:!0,allowMultiSorting:!1,exportToExcelAction:"ExportToExcel",exportToWordAction:"ExportToWord",exportToPdfAction:"ExportToPdf",_groupingCollapsed:[],_checkSelectedRowsIndexes:[],editSettings:{allowEditing:!1,showAddNewRow:!1,allowAdding:!1,showAddNewRow:!1,allowDeleting:!1,editMode:"normal",rowPosition:"top",dialogEditorTemplateID:null,allowEditOnDblClick:!0,externalFormTemplateID:null,inlineFormTemplateID:null,formPosition:"bottomleft",titleColumn:null,showConfirmDialog:!0,showDeleteConfirmDialog:!1},selectionSettings:{selectionMode:["row"],enableToggle:!1,cellSelectionMode:"flow"},resizeSettings:{resizeMode:"normal"},pageSettings:{pageSize:12,pageCount:8,currentPage:1,totalPages:null,enableTemplates:!1,showDefaults:!1,template:null,totalRecordsCount:null,enableQueryString:!1,printMode:"allpages"},groupSettings:{showDropArea:!0,showToggleButton:!1,showGroupedColumn:!0,showUngroupButton:!0,enableDropAreaAutoSizing:!0,captionFormat:null,groupedColumns:[]},contextMenuSettings:{enableContextMenu:!1,contextMenuItems:["Add Record","Edit Record","Delete Record","Sort In Ascending Order","Sort In Descending Order","Next Page","Last Page","Previous Page","First Page","Save","Cancel","Grouping","Ungrouping"],customContextMenuItems:[],subContextMenu:[],disableDefaultItems:!1},filterSettings:{filterType:"filterbar",filterBarMode:"immediate",showFilterBarStatus:!0,statusBarWidth:450,showPredicate:!1,filteredColumns:[],enableInterDeterminateState:!0,maxFilterChoices:1e3,enableCaseSensitivity:!1,immediateModeDelay:1500,enableComplexBlankFilter:!0,blankValue:""},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},sortSettings:{sortedColumns:[]},toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},minWidth:0,currentIndex:0,rowDropSettings:{dropMapper:null,dragMapper:null,dropTargetID:null},scrollSettings:{width:"auto",height:0,enableTouchScroll:!0,allowVirtualScrolling:!1,virtualScrollMode:"normal",frozenRows:0,frozenColumns:0,buttonSize:18,autoHide:!1,scrollerSize:18,scrollOneStepBy:57,enableVirtualization:!1},textWrapSettings:{wrapMode:"both"},summaryRows:[],enableRTL:!1,enableAltRow:!0,currentViewData:null,detailsTemplate:null,childGrid:null,keySettings:null,rowTemplate:null,detailsDataBound:null,rowDataBound:null,queryCellInfo:null,mergeCellInfo:null,create:null,actionBegin:null,actionComplete:null,actionFailure:null,beginEdit:null,endEdit:null,endAdd:null,endDelete:null,beforeBatchAdd:null,beforeBatchSave:null,beforeBatchDelete:null,beforePrint:null,batchAdd:null,batchDelete:null,cellSave:null,cellEdit:null,resizeStart:null,resizeEnd:null,resized:null,load:null,destroy:null,rowSelecting:null,rowSelected:null,rowHover:null,rowDeselecting:null,rowDeselected:null,cellSelecting:null,cellSelected:null,cellDeselecting:null,cellDeselected:null,columnSelecting:null,columnSelected:null,columnDeselecting:null,columnDeselected:null,columnDragStart:null,columnDrag:null,columnDrop:null,rowDrag:null,rowDragStart:null,rowDrop:null,beforeRowDrop:null,dataBound:null,recordClick:null,recordDoubleClick:null,templateRefresh:null,rightClick:null,detailsCollapse:null,detailsExpand:null,toolbarClick:null,contextOpen:null,contextClick:null,columns:[],query:null,isEdit:!1,isResponsive:!1,enableResponsiveRow:!1,virtualLoading:null},dataTypes:{dataSource:"data",query:"data",columns:"array",childGrid:"parent",gridLines:"enum",summaryRows:"array",stackedHeaderRows:"array",toolbarSettings:{toolbarItems:"array",customToolbarItems:"array"},contextMenuSettings:{contextMenuItems:"array",customContextMenuItems:"array",subContextMenu:"array"},selectionSettings:{selectionMode:"array",selectedRecords:"array"},sortSettings:{sortedColumns:"array"},filterSettings:{filteredColumns:"array",filterType:"enum",filterBarMode:"enum"},groupSettings:{groupedColumns:"array"},editSettings:{editMode:"enum",formPosition:"enum",rowPosition:"enum"},searchSettings:{fields:"array"},textWrapSettings:{wrapMode:"enum"}},_columns:function(){var n=this.element.find(".e-gridheader");n.find("div").first().empty().append(this._renderGridHeader().find("table"));this._headerCellgDragDrop();this.refreshContent(!0);this._trigger("refresh")},_summaryRows:function(n,i,r){if(i=="showTotalSummary"||i=="showCaptionSummary"){var u=n.summaryRows,f=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;this.option("summaryRows")[u][i]=f}this.element.find(".e-gridfooter").remove();this._renderGridFooter().insertAfter(this.getContent());(i=="showCaptionSummary"||i=="title")&&(this._isCaptionSummary=this.option("summaryRows")[u].showCaptionSummary,this.model.showSummary=this._isCaptionSummary,this.model.groupSettings.groupedColumns.length!=0&&this._refreshCaptionSummary())},_summaryRows_summaryColumns:function(n,i,r){(i=="displayColumn"||i=="dataMember")&&t.isNullOrUndefined(this.getColumnByField(r))||(this._createSummaryRows(this.getFooterTable()),this.element.find(".e-groupcaptionsummary").length!=0&&this._refreshCaptionSummary())},_stackedHeaderRows_stackedHeaderColumns:function(){this._refreshStackedHeader()},_sortSettings_sortedColumns:function(n,t,i){var u,f,r=this.model.sortSettings.sortedColumns[n["sortSettings.sortedColumns"]];t=="field"?(u=this.getColumnByField(i)!=null?i:null,f=r.direction=="ascending"||r.direction=="descending"?r.direction:null):t=="direction"&&(u=this.getColumnByField(r.field)!=null?r.field:null,f=i=="ascending"||i=="descending"?i:null);u!=null&&f!=null&&this.sortColumn(u,f)},_filterSettings_filteredColumns:function(n,i,r){var f,e,o,s,h,u=this.model.filterSettings.filteredColumns[n["filterSettings.filteredColumns"]];switch(i){case"field":f=this.getColumnByField(r)!=null?r:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"matchcase":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;break;case"operator":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,r);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"predicate":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=r=="and"||r=="or"?r:null;o=u.matchcase;break;case"value":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=r;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase}f!=null&&e!=null&&h!=null&&s!=null&&o!=null&&this.filterColumn(f,e,h,s,o)},_map:function(t,i){var r=n.map(t,function(n){if(n===i)return n});return r.length!=0?r[0]:null},_refreshCaptionSummary:function(){var t=document.createElement("div");t.innerHTML=["<table>",n.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("");this.getContentTable().get(0).replaceChild(t.firstChild.firstChild,this.getContentTable().get(0).lastChild);this.refreshContent()},getContentTable:function(){return this._gridContentTable},setGridContentTable:function(n){this._gridContentTable=n},getContent:function(){return this._gridContent},setGridContent:function(n){this._gridContent=n},getHeaderContent:function(){return this._gridHeaderContent},setGridHeaderContent:function(n){this._gridHeaderContent=n},getHeaderTable:function(){return this._gridHeaderTable},setGridHeaderTable:function(n){this._gridHeaderTable=n},getRows:function(){return this._gridRows},getFilteredRecords:function(){return this._filteredRecords},getRowByIndex:function(i,r){var e;try{var f=this.getRows(),o=this._excludeDetailRows(),u=n();if(n.isArray(i)){for(e=0;e<i.length;e++)this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i[e]]),u.push(f[1][i[e]])):u.push(f[i[e]]);return u}return t.isNullOrUndefined(r)?this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i]),u.push(f[1][i]),u):n(o.not(".e-virtualrow")[i]):this.model.scrollSettings.frozenColumns>0?(u.push(n(f[0]).slice(i,r)),u.push(n(f[1]).slice(i,r)),u):n(o.not(".e-virtualrow").slice(i,r))}catch(s){return n()}},getColumnIndexByField:function(n){for(var t=0,i=this.model.columns,r=i.length;t<r;t++)if(i[t].field===n)return t;return-1},getColumnIndexByHeaderText:function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r},getIndexByRow:function(t){var r=this.getRows(),u=this._excludeDetailRows(),i;return this.model.scrollSettings.frozenColumns>0?(i=n(r[0]).index(t),i==-1&&(i=n(r[1]).index(t)),i):u.not(".e-virtualrow").index(t)},getPrimaryKeyFieldNames:function(){if(this._primaryKeys.length!=0)return this._primaryKeys;for(var n=0,t=this.model.columns,i=t.length;n<i;n++)t[n].isPrimaryKey&&this._primaryKeys.push(t[n].field);return this._primaryKeys},getVisibleColumnNames:function(){return this._visibleColumns},getHiddenColumnNames:function(){return this._hiddenColumns},getColumnByField:function(n){for(var t=0;t<this.model.columns.length;t++)if(this.model.columns[t].field==n)break;return t==this.model.columns.length?null:this.model.columns[t]},getsortColumnByField:function(n){for(var t=0;t<this.model.sortSettings.sortedColumns.length;t++)if(this.model.sortSettings.sortedColumns[t].field==n)break;return t==this.model.sortSettings.sortedColumns.length?null:this.model.sortSettings.sortedColumns[t]},getColumnByHeaderText:function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r==this.model.columns.length?null:this.model.columns[r]},getCurrentViewData:function(){return this._currentJsonData},getColumnFieldNames:function(){for(var t=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].field&&t.push(this.model.columns[n].field);return t},getBrowserDetails:function(){var t=navigator.userAgent.match(/(firefox|chrome|opera|msie|safari)\s?\/?(\d+(.\d+)*)/i);return!!navigator.userAgent.match(/Trident\/7\./)||!!navigator.userAgent.match(/Edge/)?{browser:"msie",version:n.uaMatch(navigator.userAgent).version}:{browser:t[1].toLowerCase(),version:t[2]}},_initPrivateProperties:function(){this._showInColumnchooserCol=[];this._currentVirtualRowIndex=0;this._click=0;this._gridPhoneMode=320;this._columntemplaterefresh=!1;this._tabKey=!1;this._gridHeaderTable=null;this._gridWidth=this.element.width();this._id=this.element.attr("id");this._gridRows=[];this._fltrBarcell=!1;this._unboundRow=null;this._gridContentTable=null;this._gridContent=null;this._remoteSummaryData=null;this._gridSort=null;this._gridHeaderContent=null;this._gridFooterContent=null;this._gridFooterTable=null;this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0;this._links=null;this._gridPager=null;this._cSortedColumn=null;this._cSortedDirection=null;this._$curSElementTarget=null;this._gridFilterBar=null;this._$curFieldName=null;this._$prevFieldName=null;this._editedData={};this._isEditChangesApplied=!1;this._mediaStatus=!1;this._$fDlgIsOpen=!1;this._$menuDlgIsOpen=!1;this._$colType=null;this._$colFormat=null;this._$prevColType=null;this._$prevSElementTarget=null;this._currentFilterColumn=null;this._filteredRecordsCount=null;this._filteredRecords=[];this._validatedColumns=[];this.filterColumnCollection=[];this._previousFilterCount=null;this._excelFilter=null;this._isExcelFilter=this.model.filterSettings.filterType=="excel";this._$fkColumn=!1;this._fkParentTblData=[];this._primaryKeys=[];this._identityKeys=[];this._primaryKeyValues=[];this._modifiedRecords=[];this._addedRecords=[];this._tdsOffsetWidth=[];this._deletedRecords=[];this._disabledToolItems=n();this._validationRules={};this._groupedColumns=[];this._LastColumnUnGroup=!1;this._scolumns=[];this._currentJsonData=[];this._groupingColumnIndex=0;this._dataManager=this._dataSource()instanceof t.DataManager?this._dataSource():this._dataSource()!=null?t.DataManager(this._dataSource()):null;this._dataManager!=null&&this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.totalRecordsCount!=null&&this._dataManager.dataSource.json!=null&&this._dataManager.dataSource.json.splice(this.model.pageSettings.totalRecordsCount);this._isRemoteSaveAdaptor=this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.remoteSaveAdaptor;this._isLocalData=!0;this._disabledResizingColumns=[];this._disabledSortableColumns=[];this._disabledGroupableColumns=[];this._disabledFilterableColumns=[];this._disabledEditableColumns=[];this._hiddenColumns=[];this._visibleColumns=[];this._visibleColumnsField=[];this._hiddenColumnsField=[];this._ccVisibleColumns=[];this._ccHiddenColumns=[];this._sortedColumns=[];this.multiSortRequest=!1;this.multiSelectCtrlRequest=!1;this.multiSelectShiftRequest=!1;this._enableSelectMultiTouch=!1;this._enableSortMultiTouch=!1;this._templateRefresh=!1;this.initialRender=!1;this._selectDrag=!1;this._isAddNew=!1;this._fieldColumnNames={};this._headerColumnNames={};this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualPageRecords={};this._virtaulSel=[];this._dragUpInterval=null;this._dragDownInterval=null;this._queryCellView=[];this._currentPageViews=[];this._virtualLoadedPages=[];this._currentLoadedIndexes=[];this._prevVirtualSort=[];this._prevVirtualFilter=[];this._prevVirtualIndex=0;this._currentVirtualIndex=1;this._virtualRowCount=0;this._virtualSelectedRecords={};this._selectionByGrid=!1;this._enableCheckSelect=!1;this.checkSelectedRowsIndexes=[];this._isMapSelection=!1;this._selectionMapColumn=null;this._selectAllCheck=!1;this.selectedRowsIndexes=[];this._isReorder=!1;this._searchString="";this._searchCount=null;this.columnsWidthCollection=[];this._Indicator=null;this._resizer=null;this._bulkEditCellDetails={cellValue:null,rowIndex:-1,columnIndex:-1,fieldName:null,_data:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],rowData:null};this.batchChanges={added:[],deleted:[],changed:[]};this._bulkEditTemplate=n();this._confirmDialog=null;this._confirmedValue=!1;this._lastRow=!1;this._isVirtualRecordsLoaded=!1;this._scrollValue=0;this._currentTopFrozenRow=this.model.scrollSettings.frozenRows;this._rowHeightCollection=[];this._scrollObject=null;this._customPop=null;this.selectedRowCellIndexes=[];this._rowIndexesColl=[];this.selectedColumnIndexes=[];this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1;this.commonQuery=this.model.query.clone();t.gridFeatures.group&&(this._rowCol=this._captionSummary(),this._isCaptionSummary=(this._rowCol!=null&&this._rowCol.length)>0?!0:!1);this.phoneMode=this.model.isResponsive&&document.documentElement.clientWidth<360?!0:!1;this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();this._mediaQuery=!1;this._columnChooserList=null;this._$headerCols=null;this._$contentCols=null;this._detailsOuterWidth=null;this._editForm=null;this._cloneQuery=null;this.localizedLabels=this._getLocalizedLabels();this._searchBar=null;this._relationalColumns=[];this._dropDownManager={};this._isUngrouping=!1;this._columnChooser=!1;this._showHideColumns=!1;this._vCurrentTrIndex=null;this._lastVirtualPage=null;this._currentVIndex=null;(!this.model.enablePersistence||t.isNullOrUndefined(this._isHeightResponsive))&&(this._isHeightResponsive=!1);this._resize=!1;this._initHeight=0;this._initDataProcessed=!1;this._menuColTypes=[];this._excelColTypes=[]},_init:function(){var i,n,u;this._trigger("load");!t.isNullOrUndefined(this.model.query)&&this.model.query instanceof t.Query||(this.model.query=t.Query());t.isNullOrUndefined(this.model.parentDetails)||(i=this.model.queryString,n=this.model.foreignKeyField,this.model.query=this.model.query.clone(),u=this.model.parentDetails.parentKeyFieldValue===r?"undefined":this.model.parentDetails.parentKeyFieldValue,this.model.query.where(t.isNullOrUndefined(n)?i:n,"equal",u,!0));this._initPrivateProperties();t.gridFeatures.common&&this._initScrolling();this.model.enableResponsiveRow&&this.element.addClass("e-responsive");this._checkForeignKeyBinding();this._checkDataBinding()},_initComplexColumn:function(n,i,r){var e=r||i,u,o,f;for(u in n)typeof n[u]!="object"||t.isNullOrUndefined(n[u])?(o=e.concat(".").concat(u),f=n[u],this.model.columns.push({field:o,type:f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null})):(e=e.concat(".").concat(u),this._initComplexColumn(n[u],u,e))},_initColumns:function(i){for(var e,o,u,f,s;i.items!=r;)i=i.items[0];if(this.model.columns.length==0&&i){for(e in i)i.hasOwnProperty(e)&&(typeof i[e]!="object"||i[e]instanceof Date||i[e]==null)?(o=i[e],this.model.columns.push({field:e,type:o!=null?o.getDay?o.getHours()>0||o.getMinutes()>0||o.getSeconds()>0||o.getMilliseconds()>0?"datetime":"date":typeof o:null})):typeof i[e]=="object"&&this._initComplexColumn(i[e],e);this.model.columns.length&&this._renderAfterColumnInitialize()}else for(u=0;u<this.model.columns.length;u++)this.model.columns[u].field=t.isNullOrUndefined(this.model.columns[u].field)?"":this.model.columns[u].field,t.isNullOrUndefined(this.model.columns[u].validationRules)||this._validatedColumns.push(this.model.columns[u].field),t.isNullOrUndefined(this.model.columns[u].type)?(f=t.isNullOrUndefined(this.model.columns[u].field)?null:t.getObject(this.model.columns[u].field,i),s=this.model.columns[u].dataSource,!!s&&this.model.columns[u].foreignKeyValue&&(this.model.columns[u].originalType=f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null,f=(s instanceof t.DataManager)?t.getObject("0."+this.model.columns[u].foreignKeyValue,this.model.columns[u].foreignKeyData):t.getObject("0."+this.model.columns[u].foreignKeyValue,s)),this.model.columns[u].type=f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null):this.model.columns[u].type=="date"&&this.model.columns[u].format==r&&this._isReorder!=!0&&this.initialRender&&!this._showHideColumns?n.extend(this.model.columns[u],{format:"{0:"+t.preferredCulture(this.model.locale).calendars.standard.patterns.d+"}"}):this.model.columns[u].type=="datetime"&&this.model.columns[u].format==r&&this._isReorder!=!0&&this.initialRender&&!this._showHideColumns&&n.extend(this.model.columns[u],{format:"{0:"+t.preferredCulture(this.model.locale).calendars.standard.patterns.d+" "+t.preferredCulture(this.model.locale).calendars.standard.patterns.t+"}"})},_initSelection:function(){var n=this.model.selectionSettings.selectionMode;for(i=0;i<n.length;i++)this["_allow"+n[i]+"Selection"]=!0},_checkDataBinding:function(){var o,i,f,u,e;if(!this.model.columns.length&&((this._dataSource()==null||!this._dataSource().length)&&!(this._dataSource()instanceof t.DataManager)||this._dataSource()instanceof t.DataManager&&this._dataManager.dataSource.url==r&&!this._dataSource().dataSource.json.length)){this._renderAlertDialog();this._alertDialog.find(".e-content").text(this.localizedLabels.EmptyDataSource);this._alertDialog.ejDialog("open");return}if(this._initialRenderings(),this.model.editSettings.allowDeleting&&this.model.selectionType=="multiple"&&(this.multiDeleteMode=!0),this.initialRender=!0,this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.allowFiltering&&this._isExcelFilter&&this._renderExcelFilter(),this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),this.model.allowGrouping&&this.element.append(this._renderGroupDropArea()),(this.model.toolbarSettings.showToolbar||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&(this.element.append(this._renderToolBar()),t.browserInfo().name=="msie"&&t.browserInfo().version<10&&n.inArray("search",this.model.toolbarSettings.toolbarItems)!=-1&&(o=this.element.find(".e-toolbar.e-toolbarspan .e-gridsearchbar"),t.ieClearRemover(o[0]))),i=this.model.columns,i&&i.length){if(f=this.model.query._expands,typeof i[0]=="string")for(u=0;u<i.length;u++)i[u]={field:i[u]};for(u=0;u<i.length;u++)i[u].field&&i[u].field.indexOf(".")!==-1&&this._getExpands(i[u].field,f);this.model.query.expand(f);this.commonQuery.expand(f);this._renderAfterColumnInitialize()}this.model.allowPaging&&(this.element.append(this._renderGridPager()),this.model.pageSettings.isResponsive&&n(this.element.find(".e-pager")).ejPager("instance")._reSizeHandler());this.model.contextMenuSettings.enableContextMenu&&this.element.append(this._renderContext());n.isFunction(n.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),n("#"+this._id+"_WaitingPopup").addClass("e-gridwaitingpopup"));this.model.scrollSettings.allowVirtualScrolling&&(this._loadedJsonData=[],this._prevPage=1);this._dataSource()instanceof t.DataManager?(this.element.ejWaitingPopup("show"),this._dataSource().ready!=r?(e=this,this._dataSource().ready.done(function(n){e._initDataSource();e.model.dataSource=t.DataManager(n.result)})):(this.element.ejWaitingPopup("show"),this._initDataSource())):(this._ensureDataSource(),this._trigger("actionBegin"),this._setForeignKeyData(),this._relationalColumns.length==0&&this._initGridRender(),this._vRowHeight=Math.floor(this.getRowHeight()))},_renderColumnChooser:function(){var u=t.buildTag("button .e-ccButton",this.localizedLabels.Columns,{float:this.model.enableRTL?"left":"right"}).attr("type","button"),e,l,y,i,o,s,h,a,f,c,v;this.element.prepend(u);u.ejButton({prefixIcon:"e-icon e-down-arrow",imagePosition:"imageright",contentType:"textandimage",type:"button",click:n.proxy(this._ccClickHandler,this),width:90});e=u.outerHeight();u.css("margin-top",0-e);l=parseInt(this.element.css("margin-top"),10);this.element.css("margin-top",l+e);y=t.buildTag("div");i=t.buildTag("div .e-grid e-columnChooser","",{},{id:this._id+"ccDiv"});n("#"+this._id+"ccDiv").data("ejDialog")!=r&&(n("#"+this._id+"ccDiv").ejDialog("destroy"),n("#"+this._id+"ccDiv").remove());o=t.buildTag("div.e-searchbox e-fields").append(t.buildTag("input#"+this._id+"_ccSearchBox.e-ejinputtext e-filtertext",{},{},{type:"text"}));s=t.buildTag("span .e-searchfind e-icon");o.append(s);h=t.buildTag("div","",{height:"228px"},{id:this._id+"liScrollerDiv"});this._renderColumnChooserData(!1);h.append(this._columnChooserList);i.append(o);i.append(h);a=t.buildTag("div .e-columnChooserSplitter","",{"border-bottom":"0px"});i.append(a);this.model.enableRTL?($buttonDiv=t.buildTag("div .e-ccBtndiv","",{float:"left","margin-top":"7px","margin-right":"-13px"}),f=t.buildTag("button .e-ccformbtn e-btncan e-flat",this.localizedLabels.Cancel,{"margin-right":"7px","margin-left":"9px"}),n(s).addClass("e-rtl")):($buttonDiv=t.buildTag("div .e-ccBtndiv","",{float:"right","margin-top":"7px"}),f=t.buildTag("button .e-ccformbtn e-btncan e-flat",this.localizedLabels.Cancel,{"margin-right":"7px","margin-left":"6px"}));c=t.buildTag("button .e-ccformbtn e-btnsub e-flat",this.localizedLabels.Done);$buttonDiv.append(c);$buttonDiv.append(f);i.append($buttonDiv);c.ejButton({click:n.proxy(this._addButtonCC,this),showRoundedCorner:!0,width:66});f.ejButton({click:n.proxy(this._cancelButtonHandler,this),showRoundedCorner:!0,width:66});i.insertBefore(this.element);i.ejDialog({width:"auto",beforeClose:n.proxy(this._columnChooserBeforeClose,this),showOnInit:!1,allowKeyboardNavigation:!1,enableResize:!1,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showHeader:!1,width:260});t.browserInfo().name=="msie"&&t.browserInfo().version<10&&(v=n(".e-columnChooser").find("input#"+this._id+"_ccSearchBox")[0],t.ieClearRemover(v))},_renderColumnChooserData:function(i){var w=this.model.columns.length==this.getVisibleColumnNames().length,o,c,e,f,l,y,p;for(this._ccCheckBoxList=[],o=t.buildTag("div","",{"margin-left":"0px",width:"250px"}),c=0,e=-1;e<this.model.columns.length;e++)if(f=e==-1,f||this.model.columns[e].showInColumnChooser){var u=this.model.columns[e],s=f?this.localizedLabels.SelectAll:t.isNullOrUndefined(u.headerText)||u.headerText==""?u.field==""?null:u.field:u.headerText,b=u&&u.disableHtmlEncode?this._htmlEscape(s):s;if(!t.isNullOrUndefined(s)||f){var a=t.buildTag("div","",{},{"class":"e-columnChooserListDiv"}),h=f?this._id+"selectAll":this._id+s.replace(/\s|\.|[^a-zA-Z0-9]| /g,"_"),v=o.find("#"+h).length;v&&c++;l=t.buildTag("input","",{},{id:v?h+c+"":h,value:s,type:"checkbox","ej-field":f?"":u.field,"ej-headertext":f?"":u.headerText,"class":f?"e-selectall":""});y=t.buildTag("label",b,{"font-size":"13px"},{"for":v?h+c+"":h});a.append(l);a.append(y);o.append(a);p=!f&&!t.isNullOrUndefined(u.visible)?u.visible:!0;l.ejCheckBox({checked:f?w:p,change:n.proxy(this._columnChooserCheckChange,this)});f||t.isNullOrUndefined(u.visible)||l[u.visible?"attr":"removeAttr"]("checked",!0)}}else this.model.columns[e].showInColumnChooser!=r&&this._showInColumnchooserCol.push(this.model.columns[e]);i?(this._columnChooserList.empty().append(o.children()),n("#"+this._id+"liScrollerDiv").is(":visible")&&n("#"+this._id+"liScrollerDiv").ejScroller("refresh")):this._columnChooserList=o;this._ccCheckBoxList=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall")},_checkFinder:function(){var t=n(this),i=t.closest(".e-columnChooserListDiv");if(t.hasClass("e-checkbox")&&!i.hasClass("e-hide")&&t.prop("checked"))return!0},_displayFinder:function(){return!n(this).closest(".e-columnChooserListDiv").hasClass("e-hide")},_columnChooserCheckChange:function(t){var e;if(!t.isInteraction){t.isChecked&&n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']").removeClass("e-disable");return}var i=t.isChecked,r=this._ccCheckBoxList.filter(this._displayFinder),u=this._ccCheckBoxList.filter(this._checkFinder),o=r.length,f=u.length;t.model.id==this._id+"selectAll"?i?r.not(":checked").ejCheckBox({checked:i}):u.ejCheckBox({checked:i}):(this._columnChooserList.find("input.e-selectall").ejCheckBox("model.checked",o==f),i=f!=0,this.element[i?"attr":"removeAttr"]("checked",!0));e=i?"removeClass":"addClass";n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']")[e]("e-disable")},_columnChooserBeforeClose:function(){n(".e-columnChoosertail").remove();n(".e-columnChoosertailAlt").remove();n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']").removeClass("e-disable");n("#"+this._id+"_ccSearchBox").val("");var t={};t.target={};t.target.value="";this._columnChooserSearch(t)},_columnChooserSearch:function(r){var u,f,c,o,l,v;r.type=="click"&&(r.target.value="",n("#"+this._id+"_ccSearchBox").val(""));u=r.target.value;f=n("#"+this._id+"_ccSearchBox").next("span");u!=""?(f.removeClass("e-searchfind"),f.addClass("e-cancel")):(f.removeClass("e-cancel"),f.addClass("e-searchfind"));n(".e-cancel").on("click",n.proxy(this._columnChooserSearch,this));var s=this.model.columns,e=[],h=[],a=[],p=this,w=function(t){var i=p.model.groupSettings;return!i.showGroupedColumn&&n.inArray(t,i.groupedColumns)>-1};for(u!=""&&(s=t.DataManager(this.model.columns).executeLocal(t.Query().where("headerText",t.FilterOperators.startsWith,u,!0)),a=t.DataManager(this.model.columns).executeLocal(t.Query().where("field",t.FilterOperators.startsWith,u,!0)),a.forEach(function(t){t.headerText==""&&n.inArray(t,s)==-1&&s.push(t)})),s.forEach(function(n){if(n.showInColumnChooser&&!w(n.field)){var i=t.isNullOrUndefined(n.headerText)||n.headerText==""?n.field==""?null:n.field:n.headerText;e.push(i)}}),t.isNullOrUndefined(n("#nomatches")[0])||n("#nomatches").remove(),c=this._columnChooserList.find(".e-columnChooserListDiv"),i=0;i<this.model.columns.length;i++)this.model.columns[i].showInColumnChooser&&!t.isNullOrUndefined(this.model.columns[i].headerText)&&(this.model.columns[i].headerText!=""?h.push(this.model.columns[i].headerText):this.model.columns[i].field!=""&&h.push(this.model.columns[i].field));for(o=0;o<h.length;o++)l=h[o],v=e.indexOf(l),t.isNullOrUndefined(l)||c.eq(o+1)[v==-1?"addClass":"removeClass"]("e-hide");e.length==0&&this._emptyColumnChooserData();var b=this._ccCheckBoxList.filter(this._displayFinder).length,y=this._ccCheckBoxList.filter(this._checkFinder).length,k=y==b;e.length&&c.eq(0).find("input.e-js").ejCheckBox({checked:k});c.eq(0)[e.length==0?"addClass":"removeClass"]("e-hide");n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']")[y?"removeClass":"addClass"]("e-disable");n("#"+this._id+"liScrollerDiv").ejScroller("refresh")},_addButtonCC:function(){var i,r,t,u;for(this._visibleColumns=[],this._hiddenColumns=[],this._visibleColumnsField=[],this._hiddenColumnsField=[],this._columnChooserClick=!0,i={},i.requestType="columnchooser",this._columnChooser=!0,r=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall"),t=0,u=r.length;t<u;t++){var o=n(r[t]),s=o.attr("ej-headertext"),f=o.attr("ej-field");this._id+"selectAll"!=o.attr("id")&&(this[r[t].checked?"_visibleColumns":"_hiddenColumns"].push(s),this[r[t].checked?"_visibleColumnsField":"_hiddenColumnsField"].push(f!=""?f:s))}for(t=0,u=this._showInColumnchooserCol.length;t<u;t++){var e=this._showInColumnchooserCol[t],h=e.headerText,f=e.field;this[e.visible?"_visibleColumns":"_hiddenColumns"].push(h);this[e.visible?"_visibleColumnsField":"_hiddenColumnsField"].push(f!=""?f:h)}var a=this._visibleColumns,v=this._hiddenColumns,c,l;c=n.merge(n.merge([],a),v);l=this._isDuplicate(c);this._trigger("actionBegin",i);l?(this.showColumns(this._visibleColumnsField),this.hideColumns(this._hiddenColumnsField)):(this.showColumns(this._visibleColumns),this.hideColumns(this._hiddenColumns));n("#"+this._id+"ccDiv").ejDialog("close");n(".e-columnChoosertail").remove();this.refreshScrollerEvent();i={requestType:"columnchooser",removedcolumns:[],addedcolumns:[],visiblecolumns:this.getVisibleColumnNames(),hiddencolumns:this.getHiddenColumnNames()};this._ccColumnUpdate(i.addedcolumns,this.getVisibleColumnNames(),this._ccVisibleColumns);this._ccColumnUpdate(i.removedcolumns,this.getHiddenColumnNames(),this._ccHiddenColumns);this._trigger("actionComplete",i);this._columnChooser=!1},_ccColumnUpdate:function(t,r,u){for(i=0;i<r.length;i++)n.inArray(r[i],u)==-1&&t.push(r[i])},_isDuplicate:function(n){for(var t,i=[],r=0;r<n.length;r++)t=n[r],i[t]=i[t]>=1?i[t]+1:1;for(t in i)if(i[t]>1)return!0;return!1},_cancelButtonHandler:function(){n("#"+this._id+"ccDiv").ejDialog("close");n(".e-columnChoosertailAlt").remove();n(".e-columnChoosertail").remove()},_ccClickHandler:function(){var f=230,i,r=this.element.find(".e-ccButton"),u;if(i=r.offset().left+r.width(),u=n("#"+this._id+"ccDiv").data("ejDialog"),u&&u.isOpened())u.close(),n(".e-columnChoosertail").remove(),n(".e-columnChoosertailAlt").remove();else{n("#"+this._id+"ccDiv").ejDialog({width:"230px",height:"310px",position:{X:this.model.enableRTL?i-f+143:i-f,Y:r.offset().top+35}}).ejDialog("open");var e=parseInt(n("#"+this._id+"ccDiv_wrapper").css("z-index")),o=t.buildTag("div #"+this._id+"_ccTail .e-columnChoosertail","",{display:"block",position:"absolute",left:this.model.enableRTL?i-78:i-29,top:r.offset().top+15}),s=t.buildTag("div #"+this._id+"_ccTailAlt .e-columnChoosertailAlt","",{display:"block","z-index":e+2,position:"absolute",left:this.model.enableRTL?i-78:i-29,top:r.offset().top+16});o.insertBefore(n("#"+this._id+"ccDiv_wrapper"));s.insertBefore(n("#"+this._id+"ccDiv_wrapper"))}this._refreshColumnChooserList();this._ccVisibleColumns=this.getVisibleColumnNames();this._ccHiddenColumns=this.getHiddenColumnNames();n("#"+this._id+"liScrollerDiv").ejScroller({height:"228",width:"228",buttonSize:0});n("#"+this._id+"liScrollerDiv").ejScroller("refresh");t.isIOSWebView()||this.getBrowserDetails().browser!="chrome"||n(".e-columnChooser .e-hscrollbar").attr("style","height: 10px !important;");n(".e-ejinputtext").on("keyup",n.proxy(this._columnChooserSearch,this))},_refreshColumnChooserList:function(){for(var c,l,a,i=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall"),s=this._isDuplicate(n.merge(n.merge([],this._visibleColumns),this._hiddenColumns)),u=0,v=i.length;u<v;u++){var f=n(i[u]),e=f.attr("ej-headertext"),h=f.attr("ej-field"),o=r,y=i.filter("[ej-headertext='"+e+"']").length;this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&n.inArray(n(i[u]).attr("ej-field"),this.model.groupSettings.groupedColumns)!=-1?(n(i[u]).parents(".e-columnChooserListDiv").addClass("e-hide"),i[u].checked=!1,this._columnChooserList.find(".e-columnChooserListDiv").eq(0).hasClass("e-hide")&&this.model.columns.length>this.model.groupSettings.groupedColumns.length&&this._columnChooserList.find(".e-columnChooserListDiv").eq(0).removeClass("e-hide")):(n(i[u]).parents(".e-columnChooserListDiv").removeClass("e-hide"),i[u].checked=!0);c=s?h==""?e:h:e;o=this[s?"_hiddenColumnsField":"_hiddenColumns"].indexOf(c)!=-1;f.prop("checked",!o);f.ejCheckBox("model.checked",!o)}l=i.filter(this._displayFinder).length==i.filter(this._checkFinder).length&&i.filter(this._displayFinder).length?!0:!1;this._columnChooserList.find("input:checkbox.e-selectall").ejCheckBox({checked:l});this.model.groupSettings.showGroupedColumn||(t.isNullOrUndefined(n("#nomatches")[0])||n("#nomatches").remove(),this.model.columns.length==this.model.groupSettings.groupedColumns.length&&(this._columnChooserList.find(".e-columnChooserListDiv").eq(0).addClass("e-hide"),this._emptyColumnChooserData()),a=i.filter(this._displayFinder).length>0?!0:!1,n("#"+this._id+"ccDiv").find("button[aria-describedby='Done']").ejButton({enabled:a}))},_emptyColumnChooserData:function(){var i=t.buildTag("div#nomatches","",{"padding-left":"13px"}),r=n("#"+this._id+"ccDiv").find("#"+this._id+"liScrollerDiv"),u=t.buildTag("span",this.localizedLabels.NoResult);i.append(u);n(r).append(i)},_initDataSource:function(){var i,n;this._isLocalData=!(this._dataSource()instanceof t.DataManager)||this._dataSource().dataSource.offline||this._isRemoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor;this._dataSource().adaptor instanceof t.SqlDataSourceAdaptor&&(this._isLocalData=!1);this._ensureDataSource();this._trigger("actionBegin");i=this._dataSource().executeQuery(this.model.query);n=this;this._dataManager.dataSource.table!=null&&this._dataManager.dataSource.table.css("display","none");this.element.is(":visible")||this.element.ejWaitingPopup("hide");i.done(t.proxy(function(n){this._initDataProcessed||(this._initDataProcess(n),this._initDataProcessed=!0)},this));n=this;i.fail(function(i){if(!t.isNullOrUndefined(n.element)){n.element.ejWaitingPopup("hide");n.model.currentViewData=[];n._gridRecordsCount=0;n._renderGridContent().insertAfter(n.element.children(".e-gridheader"));var r={error:i.error};n._trigger("actionFailure",r)}})},_initDataProcess:function(i,r){var f,u,e;if(!t.isNullOrUndefined(this.element)){if(this._relationalColumns.length==0&&this.element.ejWaitingPopup("hide"),!this.model.columns.length&&!i.count){f=i.count%this.model.pageSettings.pageSize==0?i.count/this.model.pageSettings.pageSize:parseInt(i.count/this.model.pageSettings.pageSize,10)+1;this._currentPage()>f&&this._currentPage(f);this._renderAlertDialog();this._alertDialog.find(".e-content").text(this.localizedLabels.EmptyDataSource);this._alertDialog.ejDialog("open");this.element.ejWaitingPopup("hide");return}if(t.isNullOrUndefined(i.aggregates)||(this._remoteSummaryData=i.aggregates),this.model.scrollSettings.enableVirtualization||(this.model.currentViewData=i.result),this._$fkColumn&&this.model.filterSettings.filteredColumns.length>0&&this.model.filterSettings.filterType=="excel"&&(this._fkParentTblData=i.result),this._gridRecordsCount=this.model.enablePersistence||this.model.pageSettings.totalRecordsCount==null||this.model.filterSettings.filteredColumns.length!=0?i.count==0&&i.result.length?i.result.length:i.count:this.model.pageSettings.totalRecordsCount,this.model.filterSettings.filteredColumns.length>0&&(this._filteredRecordsCount=i.count),this.getPager()!=null&&(this.model.pageSettings.totalRecordsCount=this._gridRecordsCount),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization)if(this._refreshVirtualViewDetails(),this._isInitNextPage||this._remoteRefresh?(this._setInitialCurrentIndexRecords(i.result,this._currentPage()),this._isInitNextPage=this._remoteRefresh=!1):this._setVirtualLoadedRecords(i.result,this._currentPage()),this._isThumbScroll&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)&&this._checkPrevNextViews(this._currentPage()),this.initialRender)for(this.model.currentViewData=[],u=0;u<this._currentLoadedIndexes.length;u++)e=this._currentLoadedIndexes[u],n.merge(this.model.currentViewData,this._virtualLoadedRecords[e]||[]);else this.model.currentViewData=i.result;this._setForeignKeyData(r);this._relationalColumns.length==0&&this._initGridRender()}},_initialRenderings:function(){var r,i;if(this.model.groupSettings.groupedColumns.length){for(r=[],i=0;i<this.model.sortSettings.sortedColumns.length;i++)t.isNullOrUndefined(this.model.sortSettings.sortedColumns[i].direction)&&(this.model.sortSettings.sortedColumns[i].direction=t.sortOrder.Ascending),r.push(this.model.sortSettings.sortedColumns[i].field);if(this.model.allowGrouping)for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)n.inArray(this.model.groupSettings.groupedColumns[i],r)==-1&&this.model.sortSettings.sortedColumns.push({field:this.model.groupSettings.groupedColumns[i],direction:t.sortOrder.Ascending})}},_getExpands:function(n,t){var r=n.split("."),i="",u,f;for(r.splice(r.length-1,1),u=0;u<r.length;u++,i=""){for(f=0;f<u;f++)i+=r[f]+"/";i=i+r[u];t.indexOf(i)===-1&&t.push(i)}},_renderAfterColumnInitialize:function(){this.element.append(this._renderGridHeader());this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&(this._renderFiltering(),this._renderFilterBarTemplate());this.model.gridLines!="both"&&this._showHeaderGridLines();this.model.allowPaging&&this.element.append(this.element.find(".e-pager").first())},_ensureDataSource:function(i){var f,k,ut,ft,d,l,a,s,v,e,c,et,ct,y,ot,lt,o,g,w,p,u,b,tt,at,vt,st,ht,it,h,yt,nt,pt,rt,wt;if(this._dataSource()==null&&!(this._dataSource()instanceof t.DataManager)){if(t.isNullOrUndefined(i)||i.requestType!="add")return;this.dataSource([])}if(this.model.query.requiresCount(),f=this.model.query,k=f.clone(),this._dataSource()instanceof t.DataManager||(this.model.currentViewData=this._dataSource()),this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!t.isNullOrUndefined(this._cModifiedData)||!t.isNullOrUndefined(this._cAddedRecord))){if(t.isNullOrUndefined(this._cAddedRecord)){for(c=0;c<this._primaryKeys.length;c++)f=f.where(this._primaryKeys[c],t.FilterOperators.equal,this._primaryKeyValues[c]);ut=this._dataManager.executeLocal(f);this._dataSource()instanceof t.DataManager?t.copyObject(this._dataSource().dataSource.json[n.inArray(ut.result[0],this._dataSource().dataSource.json)],this._cModifiedData):t.copyObject(this._dataSource()[n.inArray(ut.result[0],this._dataSource())],this._cModifiedData);this._cModifiedData=null}else ft=this._cAddedRecord,this._cAddedRecord=null,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.unshift(ft):this._dataSource(r,!0).splice(0,0,ft);f.queries=k.queries;this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"||(this.model.isEdit=!1)}if(i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&(this._excludeDetailRows().length==1||this.multiDeleteMode=="multiple"&&this.selectedRowsIndexes.length==this._excludeDetailRows().length)&&this.model.pageSettings.currentPage!=1&&this._currentPage(this.model.pageSettings.totalPages-1),i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&!t.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof t.DataManager?(c=n.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(c,1)):(c=n.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(r,!0).splice(c,1))),this.model.scrollSettings.allowVirtualScrolling&&i&&(i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&(this._virtualDataRefresh=!0,this._refreshVirtualViewData()),this.model.sortSettings.sortedColumns.length){for(d=[],l=this.model.sortSettings.sortedColumns,u=l.length-1;u>=0;u--)if(this.model.groupSettings.groupedColumns.indexOf(l[u].field)==-1){if(f.sortBy(l[u].field,l[u].direction),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&n.inArray(l[u],this._prevVirtualSort)==-1){for(o=0;o<this._prevVirtualSort.length;o++)l[u].field==this._prevVirtualSort[o].field&&this._prevVirtualSort.splice(o,1);this._needVPaging=this._currentVirtualIndex*this._virtualRowCount%this.model.pageSettings.pageSize<=this._virtualRowCount;this._prevVirtualSort.push(l[u]);this._virtualDataRefresh=!0;this._refreshVirtualViewData()}}else d.push({field:l[u].field,direction:l[u].direction});for(o=0;o<d.length;o++)f.sortBy(d[o].field,d[o].direction)}if(this.model.allowSearching&&this.model.searchSettings.key.length&&(a=this.model.searchSettings,a.fields=a.fields.length!=0?a.fields:this.getColumnFieldNames(),f.search(a.key,a.fields,a.operator||"contains",a.ignoreCase),this.initialRender||i.requestType!="searching"||this._currentPage(1)),this._isLocalData&&this.model.allowSearching&&(this._filteredRecords=this.model.searchSettings.key.length!=0?this._dataManager.executeLocal(f).result:[]),this.model.allowFiltering&&this.model.filterSettings.filteredColumns.length){for(v=this.model.filterSettings.filteredColumns[0],e=this.model.filterSettings.filteredColumns,u=0;u<e.length;u++)c=n.inArray(this.getColumnByField(e[u].field),this.filterColumnCollection),e[u].field!==""&&c==-1&&this.filterColumnCollection.push(this.getColumnByField(e[u].field));if(!(this._isExcelFilter||this._excelFilterRendered)||v instanceof t.Predicate)for(v instanceof t.Predicate?(s=v,this._excelFilterRendered&&(lt=t.distinct(e,"field",!1),this._excelFilter._predicates[0]=this._excelFilter._predicates[0]||{},this._excelFilter._predicates[0][lt[0]]=s)):s=t.Predicate(v.field,v.operator,v.value,!v.matchcase),u=1;u<e.length;u++)e[u]instanceof t.Predicate?s=s[e[u].predicate||"and"](e[u]):!this._isLocalData&&e.length>2&&u>1&&e[u].predicate=="or"?s.predicates.push(t.Predicate(e[u].field,e[u].operator,e[u].value,e[u].ignoreCase||!e[u].matchcase)):s=s[e[u].predicate||"and"](e[u].field,e[u].operator,e[u].value,!e[u].matchcase);else{this._excelFilter.getPredicate(e,null,!0);et=this._excelFilter._predicates[0];for(ct in et)y=et[ct],ot=y.from!=r,ot?f.skip(y.from=="top"?0:this._gridRecordsCount-y.take).take(y.take):s=s!=r?s.and(y):y}if(s&&f.where(s),this._isLocalData?(g=this._dataManager.executeLocal(f),this._filteredRecordsCount=ot?g.result.length:g.count,w=this._filteredRecordsCount%this.model.pageSettings.pageSize==0?this._filteredRecordsCount/this.model.pageSettings.pageSize:parseInt(this._filteredRecordsCount/this.model.pageSettings.pageSize,10)+1,this._currentPage()>w&&this._currentPage(w),this._filteredRecords=this._dataManager.executeLocal(f).result,this._$fkColumn&&this.model.filterSettings.filteredColumns.length>0&&this.model.filterSettings.filterType=="excel"&&(this._fkParentTblData=this._filteredRecords)):t.isNullOrUndefined(i)||i.requestType!=t.Grid.Actions.Filtering||this._currentPage(1),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization)for(u=0;u<e.length;u++){for(o=0;o<this._prevVirtualFilter.length;o++)e[u]==this._prevVirtualFilter[o]&&i.requestType==t.Grid.Actions.Filtering&&this._prevVirtualFilter.splice(o,1);n.inArray(e[u],this._prevVirtualFilter)==-1&&(this._prevVirtualFilter.push(e[u]),this._gridRecordsCount=this._filteredRecordsCount,this._refreshViewPageDetails(),this._refreshVirtualViewData(),this._refreshVirtualViewDetails())}}if(this._isLocalData&&this.model.allowFiltering&&this.model.filterSettings.filteredColumns.length==0&&(!t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount>0)&&(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshViewPageDetails(),this._refreshVirtualViewDetails(!0)),this._filteredRecordsCount=null,this._filteredRecords=[]),this.model.summaryRows.length&&this._setSummaryAggregate(f),this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization){if(this._isLocalData&&(g=this._dataManager.executeLocal(f),this._recordsCount=g.count,w=this._recordsCount%this.model.pageSettings.pageSize==0?this._recordsCount/this.model.pageSettings.pageSize:parseInt(this._recordsCount/this.model.pageSettings.pageSize,10)+1,this._currentPage()>w&&this._currentPage(w)),this._currentPage()==0&&(this._prevPageNo==0||this._prevPageNo==null?this._currentPage(1):this._currentPage(this._prevPageNo)),!this._isLocalData&&!this.initialRender&&!t.isNullOrUndefined(i)&&i.requestType=="refresh"&&k.queries.length)for(u=0;u<k.queries.length;u++)k.queries[u].fn=="onWhere"&&this._currentPage(1);f.page(this._currentPage(),this.model.pageSettings.pageSize)}if(this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._needPaging=!0,this.initialRender&&this.model.currentIndex>1&&(this.model.currentIndex<=this._getVirtualTotalRecord()||!this._isLocalData)&&(this.model.scrollSettings.virtualScrollMode=="continuous"&&(this.model.currentIndex=1),this._currentVirtualIndex=Math.ceil(this.model.currentIndex/this._virtualRowCount),this._isThumbScroll=!0,this._currentPage(Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this._virtualDataRefresh&&(this._isThumbScroll=!0,this._refreshVirtualViewData(!0),this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0,this._currentPage(Math.ceil(this._currentVirtualIndex*this._virtualRowCount/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this.model.virtualLoading!=null&&(this._gridRecordsCount=this.model.pageSettings.totalRecordsCount),this.model.filterSettings.filteredColumns==0&&this._prevVirtualFilter.length&&(this._refreshVirtualViewData(),this._prevVirtualFilter=[]),this._isLocalData&&this.initialRender&&this._refreshVirtualViewDetails(),this._getVirtualLoadedRecords(f)),this.model.allowGrouping){for(p=f.clone(),this.model.allowPaging&&this.model.groupSettings.groupedColumns.length&&(p.queries=p.queries.slice(0,p.queries.length-1)),u=0;u<this.model.groupSettings.groupedColumns.length;u++)b=this.model.groupSettings.groupedColumns[u],tt=this.getColumnByField(b),t.isNullOrUndefined(tt)||t.isNullOrUndefined(tt.enableGroupByFormat)||!tt.enableGroupByFormat?(f.group(b),p.group(b)):(f.group(b,t.proxy(this._formatGroupColumn,this)),p.group(b,t.proxy(this._formatGroupColumn,this)));this.model.groupSettings.groupedColumns.length&&this._setAggreatedCollection(p)}if(i!=r&&i.requestType=="add"&&this._isLocalData&&this.model.groupSettings.groupedColumns.length==0&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&((this._dataSource()instanceof t.DataManager)?this._dataSource().dataSource.json.unshift(i.data):this._dataSource().unshift(i.data)),t.isNullOrUndefined(i)||i.action!="add"||t.isNullOrUndefined(this.model.parentDetails)||(at=this.getColumnByField(this.model.parentDetails.parentKeyField),vt=n.inArray(at,this.model.columns),vt==-1&&(st={},st[this.model.parentDetails.parentKeyField]=this.model.parentDetails.parentKeyFieldValue,n.extend(!0,this.model.currentViewData[0],st))),this._cloneQuery=f.clone(),this._isLocalData&&(!this.model.scrollSettings.enableVirtualization||this._virtualDataRefresh)){if(ht=this._dataManager.dataSource.json,it=this._dataSource().dataSource,!t.isNullOrUndefined(it)&&this._dataSource()instanceof t.DataManager&&(this._dataManager.dataSource.json=ht!=it.json?it.json:ht),h=this._dataManager.executeLocal(f),!t.isNullOrUndefined(i)&&i.requestType=="beginedit")this.model.currentViewData=h.result;else if(this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&(this._prevPageRendered=!0),this.model.scrollSettings.allowVirtualScrolling&&!this._prevPageRendered&&h.result.length!=this.model.pageSettings.pageSize&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage)yt=t.pvt.filterQueries(f.queries,"onPage"),f.queries.splice(n.inArray(yt[0],f.queries),1),f.page(this._currentPage()-1,this.model.pageSettings.pageSize),nt=this._dataManager.executeLocal(f),nt.result.splice(0,h.result.length),this._previousPageRecords=n.extend(!0,[],nt.result),this._previousPageLength=h.result.length,this._currentPageData=h.result,t.merge(nt.result,h.result),this.model.currentViewData=this._lastVirtualPage=nt.result,this._lastPageRendered=!0;else if(this._lastPageRendered&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&!this.model.scrollSettings.enableVirtualization){for(pt=this.model.pageSettings.pageSize-this._previousPageLength,rt=0;rt<pt;rt++)wt=this.getRows()[this.getRows().length-(this.model.pageSettings.pageSize-rt)],wt.remove();this._tempPageRendered=!0;this.model.currentViewData=h.result}else this.model.currentViewData=h.result;this._gridRecordsCount=h.count;this._remoteSummaryData=h.aggregates;this._searchCount=this._searchString.length?h.count:null;this.model.groupSettings.groupedColumns.length&&this._setAggregates()}},_formatGroupColumn:function(n,i){var f=this.getColumnByField(i),r,u;return r=f.format,u=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),r=u.exec(r)[2],t.format(n,r,this.model.locale)},_refreshViewPageDetails:function(){this._currentPage(1);this.model.currentIndex=0;this._currentVirtualIndex=1;this.getContent().ejScroller("model.scrollTop",0)},_refreshVirtualViewDetails:function(n){var i=this._dataSource();n&&(this._gridRecordsCount=i!==null?i instanceof t.DataManager?i.dataSource.json.length:i.length:this.model.pageSettings.totalRecordsCount);this._totalVirtualViews=Math.ceil(this._getVirtualTotalRecord()/this._virtualRowCount);this._maxViews=Math.ceil(this.model.pageSettings.pageSize/this._virtualRowCount);this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize);this.model.pageSettings.totalRecordsCount=this._gridRecordsCount;this._lastViewData=this._virtualRowCount-(this._totalVirtualViews*this._virtualRowCount-this._getVirtualTotalRecord())},_getVirtualLoadedRecords:function(t){var i=this._currentPage(),r,u;if(this._needPaging&&(this._isLastVirtualpage=needTwoPage=this._isThumbScroll&&i==this.model.pageSettings.totalPages&&!this._virtualPageRecords[i],(this.initialRender||this._virtualDataRefresh)&&(needTwoPage=!0),this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||i!=1)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._getVirtualOnLoadingData(i,!needTwoPage):this._setVirtualPaging(t,i,!needTwoPage),!this.initialRender&&this._isThumbScroll&&this._virtualPageRecords[i]&&!this._virtualDataRefresh&&this._checkPrevNextViews(i,t)),this._needPaging=!1,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.initialRender&&this._isLocalData)for(this.model.currentViewData=[],r=0;r<this._currentLoadedIndexes.length;r++)u=this._currentLoadedIndexes[r],this._virtualLoadedRecords[u]&&n.merge(this.model.currentViewData,this._virtualLoadedRecords[u])},_setVirtualPaging:function(i,r,u){var e=t.pvt.filterQueries(i.queries,"onPage"),f;e.length&&i.queries.splice(n.inArray(e[0],i.queries),1);(!u||this._needVPaging)&&this.model.currentIndex>this._virtualRowCount?this._initCurrentIndex(i,r):i.page(r,this.model.pageSettings.pageSize);this._needVPaging=!1;this._isLocalData&&!this._virtualPageRecords[r]&&(f=this._dataManager.executeLocal(i),this.initialRender||(this.model.currentViewData=f.result),f.result.length?(this._setVirtualLoadedRecords(f.result,r),n.inArray(r,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(r)):this.initialRender||this.getContent().find(".e-virtualtop, .e-virtualbottom").remove())},_checkPrevNextViews:function(){var n=this._currentVirtualIndex,u=this._virtualLoadedRecords[n-1],f=this._virtualLoadedRecords[n+1],r=this._maxViews==3?1:2,t,i;n!=1&&n!=this._totalVirtualViews&&(u&&u.length==this._virtualRowCount?f&&f.length==this._virtualRowCount||this._totalVirtualViews==n-1||(i=n-r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i-1,t=this._scrollValue-r*this._virtualRowCount*this._vRowHeight):(i=n+r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i+1,t=this._scrollValue+r*this._virtualRowCount*this._vRowHeight),t&&(this._scrollValue=t,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.model.currentIndex=t==0?t:Math.floor(t/this._vRowHeight)))},_initCurrentIndex:function(i,r){var e=r*this.model.pageSettings.pageSize,c=this._currentVirtualIndex*this._virtualRowCount+this._virtualRowCount,l=this._currentVirtualIndex*this._virtualRowCount-this._virtualRowCount*2,v=c>e||l<e-this.model.pageSettings.pageSize,f,o,u,h,a,s;v||this._isLastVirtualpage?(c>e?(f=(r-1)*this.model.pageSettings.pageSize,o=this.model.pageSettings.pageSize*2,this._isInitNextPage=!0):(l<e-this.model.pageSettings.pageSize||this._isLastVirtualpage)&&(f=(r-2)*this.model.pageSettings.pageSize,o=this.model.pageSettings.pageSize*2,this._isInitNextPage=!1,this._remoteRefresh=!0),this.model.virtualLoading&&this._isLocalData?(u={},u.endIndex=f+o,u.endIndex=u.endIndex>this._getVirtualTotalRecord()?this._getVirtualTotalRecord():u.endIndex,u.startIndex=f,u.currentPage=this._currentPage(),u.result=null,this._trigger("virtualLoading",u),s=u.result,this._setInitialCurrentIndexRecords(s,r)):(h=t.pvt.filterQueries(i.queries,"onSkip"),h.length&&i.queries.splice(n.inArray(h[0],i.queries),1),i.skip(f).take(o),this._isLocalData&&(a=this._dataManager.executeLocal(i),s=this.model.currentViewData=a.result,this._isLastVirtualpage=!1,this._setInitialCurrentIndexRecords(s,r)))):(this._needVPaging=!1,this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||r!=1)?this._getVirtualOnLoadingData(r,!0):this._setVirtualPaging(i,r,!0))},_setInitialCurrentIndexRecords:function(n,t){for(i=0;i<2;i++){var r=i*this.model.pageSettings.pageSize,f=r+this.model.pageSettings.pageSize,e=n.slice(r,f),u;u=this._isInitNextPage||t==1&&this.model.pageSettings.totalPages==1?i==0?t:t+1:i==0?t-1:t;this._setVirtualLoadedRecords(e,u)}},_getVirtualOnLoadingData:function(n,t){var i,u;n>0&&(this.model.currentIndex>this._virtualRowCount&&(!t||this._needVPaging)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._initCurrentIndex(r,n):(i={},i.endIndex=n*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:n*this.model.pageSettings.pageSize,i.startIndex=n*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),u=i.result,this._setVirtualLoadedRecords(u,n)))},_setVirtualLoadedRecords:function(t,i){var u=this._virtualRowCount,h=this.model.pageSettings.pageSize,v=h/u,o,y=Math.ceil(i*h/u),p=i==this.model.pageSettings.totalPages,l,e,f,s,r,w,c,a,b;for(this._virtualPageRecords[i]||(this._virtualPageRecords[i]=t),p&&(l=this._getVirtualTotalRecord()%h,y=(!this._virtualLoadedRecords[this._totalVirtualViews]||this._virtualLoadedRecords[this._totalVirtualViews].length!=this._lastViewData)&&l<this._lastViewData&&l!=0?this._totalVirtualViews+1:this._totalVirtualViews,this._getVirtualTotalRecord()<u&&(this._singleView=!0)),e=0;e<v;e++)r=Math.ceil((i-1)*v+(e+1)),(r<=this._totalVirtualViews||p)&&r<=y&&(this._virtualLoadedRecords[r-1]&&this._virtualLoadedRecords[r-1].length!=u?(w=this._virtualLoadedRecords[r-1].length+e*u,f=u-w+e*u,n.merge(this._virtualLoadedRecords[r-1],t.slice(0,f)),o=s=f+u,r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,o))):r==1||this._virtualLoadedRecords[r-1]?(f=o?o:e*u%h,o=s=f+u):(c=s=(r-1)*u%h,c!=0&&(this._virtualLoadedRecords[r-1]=t.slice(0,c)),f=c,s=o=c+u),this._virtualLoadedRecords[r]&&this._virtualLoadedRecords[r].length!=u?(a=t.slice(f,s),a.length+this._virtualLoadedRecords[r].length<=u&&(b=n.merge(a,this._virtualLoadedRecords[r]),this._virtualLoadedRecords[r]=b)):!this._virtualLoadedRecords[r]&&r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,s)));n.inArray(i,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(i)},_setVirtualLoadedIndexes:function(n){var i,t;for(this._currentLoadedIndexes=[],i=n==this._totalVirtualViews?n:n+1,n!=1&&(n=n-1),t=n;t<=i;t++)this._currentLoadedIndexes.push(t)},_getVirtualTotalRecord:function(){return this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount},_initGridRender:function(){var i,s,u,h,c,r;if(this.addInitTemplate(),this.model.scrollSettings.frozenColumns>0&&this.addFrozenTemplate(),this.model.allowGrouping&&this.addGroupingTemplate(),this.model.showSummary&&this.addSummaryTemplate(),(this.model.allowResizing||this.model.allowResizeToFit)&&(this._resizer=new t.gridFeatures.gridResize(this)),this.model.keySettings&&n.extend(this.model.keyConfigs,this.model.keySettings),this._initHeight=this.model.scrollSettings.height,this.model.scrollSettings.height=="100%"&&(this._isHeightResponsive=!0),this.render(),this._setTextWrap(),this.model.columnLayout=="fixed"){var l=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),f=this.getHeaderContent().width()>l?"addClass":"removeClass",e=this.getHeaderTable(),o=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(e=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),o=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0));e[f]("e-tableLastCell");o[f]("e-tableLastCell")}if(this.model.allowGrouping&&t.gridFeatures.dragAndDrop&&this._headerCellgDragDrop(),this.model.allowReordering&&t.gridFeatures.dragAndDrop&&(this._headerCellreorderDragDrop(),this._initIndicators()),this._wireEvents(),this.model.allowGrouping&&!t.isNullOrUndefined(this.model.serverProperties))for(this.model._groupingCollapsed=this.model.serverProperties._groupingCollapsed,i=0;i<this.model._groupingCollapsed.length;i++)s=this.getContent().find(".e-recordplusexpand"),u=s.filter("td[ej-mappingname='"+this.model._groupingCollapsed[i].key+"' ][ej-mappingvalue='"+this.model._groupingCollapsed[i].value+"']"),u.length>1&&!t.isNullOrUndefined(this.model._groupingCollapsed[i].parent)&&(h=this.model._groupingCollapsed[i].parent,u=u.filter(function(){return n(this).parents(".e-tabletd").parent("tr").prev("tr").find(".e-recordplusexpand[ej-mappingvalue="+h+"]").length})),this.expandCollapse(u);this.initialRender=!1;this.model.width&&!this.model.allowScrolling&&this.element.width(this.model.width);(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this._trigger("dataBound",{});this._trigger("refresh");this.model.parentDetails&&(c=this.model.parentDetails.parentID,r=n("#"+c).data("ejGrid"),r.model.allowScrolling&&r._refreshScroller({requestType:"refresh"}));this.element.closest("tr").hasClass("e-detailrow")&&!this.model.parentDetails&&(r=this.element.closest("tr.e-detailrow").closest(".e-grid").data("ejGrid"),r.model.allowScrolling&&r.getScrollObject().refresh());this.model.allowFiltering&&this.model.filterSettings.filterType=="menu"&&this._renderFilterDialogs();this.model.enableResponsiveRow&&(this.model.allowSorting||this.model.allowFiltering)&&this._renderResponsiveFilter();this.model.allowGrouping&&this.model.showSummary&&(this._refreshGroupSummary(),this.model.currentViewData.length&&this._refreshGridFooterColGroup());this._isMapSelection&&this._mappingSelection();this.model.showColumnChooser&&this._renderColumnChooser();this._enableCheckSelect&&(this.model.currentViewData!=null&&this.model.currentViewData.length==0?this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").hide():this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").show())},_setTextWrap:function(){if(this.model.allowTextWrap==!0){switch(this.model.textWrapSettings.wrapMode){case"content":this.element.find(".e-columnheader").removeClass("e-wrap");this.element.removeClass("e-wrap");this.getContent().addClass("e-wrap");break;case"header":this.element.removeClass("e-wrap");this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").addClass("e-wrap");break;default:this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").removeClass("e-wrap");this.element.addClass("e-wrap")}if(this.model.scrollSettings.frozenColumns>0&&this.model.textWrapSettings.wrapMode!="content"){var n=this.getHeaderContent().find(".e-frozenheaderdiv").find(".e-columnheader").last().find("th"),t=this.getHeaderContent().find(".e-movableheader").find(".e-columnheader").last().find("th");n.height()>t.height()?t.height(n.height()):n.height(t.height())}}else this.getContent().removeClass("e-wrap").find(".e-rowcell").removeClass("e-nwrap"),this.element.find(".e-columnheader").removeClass("e-wrap").find(".e-headercelldiv").removeClass("e-nwrap"),this.element.removeClass("e-wrap")},_getMetaColGroup:function(){for(var r,u=t.buildTag("colgroup"),i=0;i<this.model.columns.length;i++)r=n(document.createElement("col")),this.model.columns[i].visible===!1&&r.css("display","none"),this.model.rowTemplate==null||t.isNullOrUndefined(this.model.columns[i].cssClass)||r.addClass(this.model.columns[i].cssClass),this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&n.inArray(this.model.columns[i].field,this.model.groupSettings.groupedColumns)!=-1&&r.css("display","none"),u.append(r);return u},_alternateRow:function(){return this.getIndex()%2==0?"e-row":"e-alt_row"},addInitTemplate:function(){var k=this.element.find(".e-headercelldiv:not(.e-emptyCell)"),v={},d=!0,y=document.createElement("tbody"),p=n(y),b,a,g,f,ut,s,nt,it,l,rt,e;if(this.model.rowTemplate==null){var w=document.createElement("tr"),o=n(w),u=this.model.columns,i;for(this._gridRecordsCount&&!this._virtualDataRefresh?(b=this.model.editSettings.showAddNewRow&&!this.initialRender?this.model.currentViewData[1]:this.model.currentViewData[0],t.isNullOrUndefined(b)||this._initColumns(b)):this._isLocalData&&(this._dataSource()!=null&&this._dataSource().length||this._dataManager&&this._dataManager.dataSource.json.length)&&this._initColumns(this._dataSource()[0]!=r?this._dataSource()[0]:this._dataManager.dataSource.json[0]),a={_gridFormatting:this.formatting,getComplexData:t.getObject},n.views.helpers(a),e={},e._foreignKey=this._foreignKeyBinding,n.views.helpers(e),(this.model.childGrid||this.model.detailsTemplate)&&(g=t.buildTag("td.e-detailrowcollapse","<div class='e-icon e-gnextforward'><\/div>"),o.append(g)),i=0;i<this.model.columns.length;i++){if(f=t.buildTag("td.e-rowcell"),t.isNullOrUndefined(u[i].tooltip)&&u[i].clipMode!=t.Grid.ClipMode.EllipsisWithTooltip||f.addClass("e-gridtooltip"),(u[i].clipMode==t.Grid.ClipMode.Ellipsis||u[i].clipMode==t.Grid.ClipMode.EllipsisWithTooltip)&&f.addClass("e-gridellipsis"),this.model.isResponsive&&f.attr("data-cell",this._decode(this.model.columns[i].headerText)),u[i].visible==!1?f.addClass("e-hide"):(d&&(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.addClass("e-detailrowvisible"),d=!1),this.model.groupSettings.showGroupedColumn||f.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[i].field+"'}}e-hide{{/if}}{{/for}}"),t.isNullOrUndefined(u[i].templateID||u[i].template)){for(var h=(u[i].field||"").split("."),tt=h.length-1,c="";tt;)c+="(",tt--;it=u[i].type||u[i].editType;switch(it){case"boolean":case"booleanedit":t.isNullOrUndefined(u[i].displayAsCheckbox)&&(u[i].displayAsCheckbox=!0);u[i].displayAsCheckbox?(l="",l=this.model.editSettings.editMode=="batch"&&(t.isNullOrUndefined(u[i].allowEditing)||u[i].allowEditing)?l:"disabled='disabled'",rt="{{if ~getComplexData('"+this.model.columns[i].field+"', #data)}} <input type ='checkbox' "+l+" checked='checked'><\/input>{{else}} <input type ='checkbox' "+l+"><\/input> {{/if}}",f.addClass("e-boolrowcell").html(rt)):f.html("{{if ~getComplexData('"+this.model.columns[i].field+"', #data)}}"+this.localizedLabels.True+"{{else}}"+this.localizedLabels.False+"{{/if}}");break;case"checkbox":this._enableCheckSelect=!0;this.model.selectionType="multiple";this.model.editSettings.allowDeleting&&(this.multiDeleteMode=!0);this.model.selectionSettings.enableToggle=!0;this._isMapSelection=u[i].field!="";this._selectionMapColumn=u[i].field;u[i].textAlign="center";this._isMapSelection||(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1);f.addClass("e-checkcell").html("<div class = 'e-checkcelldiv'>{{if #data['"+h.join("']['")+"']}} <input type ='checkbox' checked='checked'><\/input>{{else}} <input type ='checkbox'><\/input> {{/if}}<\/div>");this.model.columns[i].editType=t.Grid.EditingType.Boolean;this.model.scrollSettings.frozenColumns>0&&f.addClass("e-frozenunbound");this.model.enableAutoSaveOnSelectionChange=!1;break;default:u[i].disableHtmlEncode?f.html("{{html:"+c+"#data['"+h.join("'] || {})['")+"']}}"):f.html("{{:"+c+"#data['"+h.join("'] || {})['")+"']}}")}u[i].format==r||u[i].foreignKeyValue||f.html("{{:~_gridFormatting('"+u[i].format+"',"+c+"#data['"+h.join("'] || {})['")+"'],'"+this.model.locale+"')}}");u[i].foreignKeyValue&&u[i].dataSource&&f.html("{{:~_foreignKey("+i+","+c+"#data['"+h.join("'] || {})['")+"'],'"+this._id+"')}}");u[i].commands&&(e={},e["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,n.views.helpers(e),(t.isNullOrUndefined(u[i].field)||u[i].field=="")&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),t.isNullOrUndefined(u[i].headerText)||n("#"+this._id+u[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(u[i],i),t.isNullOrUndefined(u[i].headerText)||f.addClass("e-unboundcell").addClass("e-"+u[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&f.addClass("e-frozenunbound"),this._isUnboundColumn=!0)}else e={},s=u[i].headerText,e["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this,ut),n.views.helpers(e),t.isNullOrUndefined(s)||t.isNullOrUndefined(s.match(/[^0-9\s\w]/g))||(s=s.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+s+i+"_Template").remove(),nt=this._createTemplateElement(u[i]),(u[i].field==""||t.isNullOrUndefined(u[i].field))&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),u[i].template!=!1&&f.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+nt.id+"','"+i+"')}}");u[i].textAlign==r&&(u[i].textAlign="left");u[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(u[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort()));this.phoneMode&&this.model.enableResponsiveRow||u[i].textAlign==r||(f.css("text-align",u[i].textAlign),n(k[i]).css("text-align",u[i].textAlign));this.phoneMode||t.isNullOrUndefined(u[i].headerTextAlign)||n(k[i]).css("text-align",u[i].headerTextAlign);t.isNullOrUndefined(u[i].cssClass)||f.addClass(u[i].cssClass);this.model.allowTextWrap&&this.model.textWrapSettings.wrapMode!="header"&&u[i].allowTextWrap==!1&&f.addClass("e-nwrap");t.isNullOrUndefined(u[i].priority)||f.addClass("e-table-priority-"+u[i].priority);t.isNullOrUndefined(u[i].customAttributes)||f.attr(u[i].customAttributes);f.attr("role","gridcell");o.append(f);this.model.enableAltRow?(a["_"+this._id+"AlternateRow"]=this._alternateRow,n.views.helpers(a),o.addClass("{{:~_"+this._id+"AlternateRow()}}")):o.addClass("e-row");o.attr("role","row");this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenColumns==i+1&&(y.appendChild(w),v[this._id+"_JSONFrozenTemplate"]=p.html(),o.empty(),p.empty())}y.appendChild(w)}v[this._id+"_JSONTemplate"]=this.model.rowTemplate!=null?n(this.model.rowTemplate).html():p.html();n.templates(v)},render:function(){this.model.showSummary=this.model.summaryRows.length>0||this.model.showSummary;this._renderGridContent().insertAfter(this.element.children(".e-gridheader"));this.model.allowResizeToFit&&this.setWidthToColumns();this.model.allowGrouping&&t.gridFeatures.dragAndDrop&&this._groupHeaderCelldrag();this.model.showSummary&&this._currentJsonData.length&&(this._renderGridFooter().insertAfter(this.getContent()),this._hideCaptionSummaryColumn());this._initialEndRendering()},_createStackedRow:function(i,u){var y=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),a=[],g=[],p,ut,ft,f,w,b,k,e,s,ot,o,v;for(tAl=[],tp=[],o=0;o<this.model.columns.length;o++)if(p=this.model.columns[o],p.visible!=!1){if(this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&this.model.groupSettings.groupedColumns.length>0&&n.inArray(p.field,this.model.groupSettings.groupedColumns)!=-1)continue;var nt="",tt="",it="",rt="",c=i.stackedHeaderColumns;for(s=0;s<c.length;s++)ut=n.isArray(c[s].column)?c[s].column:n.map(c[s].column.split(","),n.trim),ft="e-row"+n.inArray(i,this.model.stackedHeaderRows)+"-column"+s,n.inArray(p.field,ut)!=-1&&(nt=c[s].headerText,tt=c[s].cssClass,it=c[s].textAlign,rt=c[s].tooltip?" e-gridtooltip "+ft:"");a.push(nt);g.push(tt);tAl.push(it);tp.push(rt)}for(f=[],e=0;e<a.length;e++){for(w=1,b=e+1;b<a.length;b++)if(a[e]==a[b])w++;else break;f.push({sapnCount:w,headerText:a[e],cssClass:g[e],txtAlign:tAl[e],tooltip:tp[e]});e+=w-1}if(y=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),k=this.model.scrollSettings.frozenColumns,this.model.allowScrolling&&k>0){var d=[],l=0,h=0,et=0;for(e=0;e<this.model.columns.length;e++)s=this.model.columns[e],e<k&&s.visible==!1&&et++;for(l=k-et;l>0;)ot=f[h].sapnCount,f[h].sapnCount<l?(d.push(f[h]),u?h++:f.splice(h,1)):f[h].sapnCount>l?(f[h].sapnCount=f[h].sapnCount-l,u&&d.push({sapnCount:l,headerText:f[h].headerText})):(d.push(f[h]),u||f.splice(h,1)),l-=ot;u&&(f=d)}for((this.model.detailsTemplate||this.model.childGrid)&&y.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),o=0;o<f.length;o++)v=t.buildTag("th.e-headercell e-stackedHeaderCell e-default"+f[o].tooltip,f[o].headerText,{},{colspan:f[o].sapnCount}),v.css("textAlign",f[o].txtAlign),y.append(v),f[o].cssClass!=r&&v.addClass(f[o].cssClass),(this.model.allowResizing||this.model.allowReordering||this.model.allowResizeToFit)&&v.addClass("e-resizer");return y},_renderGridHeaderInternalDesign:function(i,u){var p=t.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"grid"}),l=t.buildTag("thead"),w=t.buildTag("tbody.e-hide"),a=t.buildTag("tr.e-columnheader"),v=n(document.createElement("colgroup")),b=n(document.createElement("tr")),k,f,y,c,h,s;if((this.model.childGrid||this.model.detailsTemplate)&&(a.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),v.append(this._getIndentCol())),this.model.showStackedHeader)for(s=0;s<this.model.stackedHeaderRows.length;s++)k=this._createStackedRow(this.model.stackedHeaderRows[s],u),l.append(k);for(f=0;f<i.length;f++){var o=t.buildTag("th.e-headercell e-default","",{},{role:"columnheader"}),d=document.createElement("td"),e=t.buildTag("div.e-headercelldiv",i[f].headerText===r&&i[f].type!="checkbox"?i[f].headerText=i[f].field:i[f].headerText,{},{"ej-mappingname":i[f].field});if(i[f].disableHtmlEncode&&e.text(i[f].headerText),t.isNullOrUndefined(i[f].headerTooltip)||e.addClass("e-gridheadertooltip"),t.isNullOrUndefined(i[f].tooltip)||e.addClass("e-gridtooltip"),(i[f].clipMode==t.Grid.ClipMode.Ellipsis||i[f].clipMode==t.Grid.ClipMode.EllipsisWithTooltip)&&e.addClass("e-gridellipsis"),(this.model.allowResizing||this.model.allowReordering||this.model.allowResizeToFit)&&o.addClass("e-resizer"),o.append(e),this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&(i[f].allowFiltering==r||i[f].allowFiltering===!0)&&(!t.isNullOrUndefined(i[f].field)||i[f].field=="")&&i[f].type!="checkbox"){if(y="e-filterset",!this.initialRender&&this.model.filterSettings.filteredColumns)for(c=0;c<this.model.filterSettings.filteredColumns.length;c++)this.model.filterSettings.filteredColumns[c].field==i[f].field&&(y="e-filterset e-filteredicon e-filternone");o.append(t.buildTag("div.e-filtericon e-icon "+y));o.addClass("e-headercellfilter");t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this.model.enableRTL&&n(e).css("padding","0 0 0 2em")}h=document.createElement("col");i[f].priority&&n(d).addClass("e-table-priority-"+i[f].priority);b.append(d);a.append(o);v.append(h);i[f].visible===!1?(o.addClass("e-hide")&&n(h).css("display","none"),n.inArray(i[f].headerText,this._hiddenColumns)==-1&&n.inArray(i[f].field,this._hiddenColumnsField)==-1&&(this._hiddenColumns.push(i[f].headerText)&&i[f].field!=(""||r)?this._hiddenColumnsField.push(i[f].field):this._hiddenColumnsField.push(i[f].headerText)),n.inArray(i[f].field,this._visibleColumnsField)!=-1&&this._visibleColumnsField.splice(n.inArray(i[f].field,this._visibleColumnsField),1)&&this._visibleColumns.splice(n.inArray(i[f].headerText,this._visibleColumns),1)):(this._visibleColumns.push(i[f].headerText)&&i[f].field!=(""||r)?this._visibleColumnsField.push(i[f].field):this._visibleColumnsField.push(i[f].headerText),i[f].visible=!0,n.inArray(i[f].field==""?i[f].headerText:i[f].field,this._hiddenColumnsField)!=-1&&this._hiddenColumnsField.splice(n.inArray(i[f].field==""?i[f].headerText:i[f].field,this._hiddenColumnsField),1)&&this._hiddenColumns.splice(n.inArray(i[f].headerText,this._hiddenColumns),1));this.model.showColumnChooser&&i[f].showInColumnChooser!==!1&&(i[f].showInColumnChooser=!0);this.model.allowResizing&&i[f].allowResizing!==!1&&(i[f].allowResizing=!0);t.isNullOrUndefined(i[f].headerTextAlign)?i[f].textAlign!=r?e.css("text-align",i[f].textAlign):this.model.enableRTL&&e.css("text-align",i[f].textAlign="right"):e.css("text-align",i[f].headerTextAlign);i[f].allowResizing===!1&&this._disabledResizingColumns.push(i[f].field);i[f].allowSorting===!1&&this._disabledSortableColumns.push(i[f].field);i[f].allowGrouping===!1&&this._disabledGroupableColumns.push(i[f].field);i[f].allowEditing===!1&&this._disabledEditableColumns.push(i[f].field);t.isNullOrUndefined(i[f].cssClass)||(o.addClass(i[f].cssClass),n(h).addClass(i[f].cssClass));this.model.allowTextWrap&&this.model.textWrapSettings.wrapMode!="content"&&i[f].allowTextWrap==!1&&e.addClass("e-nwrap");t.isNullOrUndefined(i[f].headerTemplateID)||(e.html(n(i[f].headerTemplateID).hide().html()).parent().addClass("e-headertemplate"),s=n.inArray(i[f].field,this._disabledGroupableColumns),s==-1&&t.isNullOrUndefined(i[f].field)&&this._disabledGroupableColumns.push(i[f].field));t.getObject("type",i[f])=="checkbox"&&t.isNullOrUndefined(i[f].headerText)&&(e.addClass("e-headercheckcelldiv"),e.html("<input type = 'checkbox' class = 'e-checkselectall'><\/input>"),t.isNullOrUndefined(i[f].field)||e.attr("ej-mappingname",i[f].field));this.model.allowGrouping&&this.model.groupSettings.showToggleButton&&n.inArray(i[f].field,this._disabledGroupableColumns)==-1&&!t.isNullOrUndefined(i[f].field)&&i[f].field!=""&&(n.inArray(i[f].field,this.model.groupSettings.groupedColumns)!=-1?e.append(this._getToggleButton().addClass("e-toggleungroup")):e.append(this._getToggleButton().addClass("e-togglegroup")));this.model.isResponsive&&o.attr("title",this._decode(i[f].headerText));i[f].priority&&(o.attr("data-priority",i[f].priority).addClass("e-table-priority-"+i[f].priority),n(h).addClass("e-table-priority-"+i[f].priority));this.initialRender&&(typeof i[f].width=="string"&&i[f].width.indexOf("%")!=-1?this.columnsWidthCollection.push(parseInt(i[f].width)/100*this.element.width()):this.columnsWidthCollection.push(i[f].width));i[f].width==r&&this.model.commonWidth!==r&&(this.columnsWidthCollection[f]=this.model.commonWidth);this._fieldColumnNames[i[f].headerText]=i[f].field;this._headerColumnNames[i[f].field]=i[f].headerText}return l.append(a),w.append(b),p.append(v).append(l).append(w),p},_renderGridHeader:function(){var n=t.buildTag("div.e-gridheader"),r,u,i=t.buildTag("div");return this.model.allowScrolling&&i.addClass("e-headercontent"),this.setGridHeaderContent(n),this.initialRender&&(this.columnsWidthCollection=[],this._hiddenColumns=[],this._hiddenColumnsField=[]),this._visibleColumns=[],this._visibleColumnsField=[],this._disabledGroupableColumns=[],this._fieldColumnNames={},this._headerColumnNames={},this.model.scrollSettings.frozenColumns>0?(r=t.buildTag("div.e-frozenheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(0,this.model.scrollSettings.frozenColumns),!0)),u=t.buildTag("div.e-movableheader",t.buildTag("div.e-movableheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(this.model.scrollSettings.frozenColumns),!1))),i.append(r).append(u)):i.append(this._renderGridHeaderInternalDesign(this.model.columns)),n.html(i),this.model.isResponsive&&n.addClass("e-textover"),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),n},_renderGridContent:function(){var o=t.buildTag("div.e-gridcontent"),h=t.buildTag("div"),e=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),c=n(document.createElement("tbody")),r,i,u,l,f,s,a;if(e.append(this.getHeaderTable().find("colgroup").clone()).append(c),h.html(e),o.html(h),this.setGridContentTable(e),this.setGridContent(o),e.attr("role","grid"),r={},this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length){if(this.initialRender&&(r.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],!this.model.groupSettings.showGroupedColumn))for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)u=this.model.groupSettings.groupedColumns[i],n.inArray(u,this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(u),this._hiddenColumns.push(this.getColumnByField(u).headerText),this.getColumnByField(u).visible=!1);r.requestType=t.Grid.Actions.Grouping}else r.requestType=t.Grid.Actions.Refresh;if(this._dataSource()==null||this._dataSource().length==0||this.model.currentViewData.length==0?(l=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length-this._hiddenColumns.length}),c.append(n(document.createElement("tr")).append(l)),this.setWidthToColumns(),(this.initialRender||this.model.groupSettings.groupedColumns.length)&&this.sendDataRenderingRequest(r)):this.sendDataRenderingRequest(r),this._isCaptionSummary&&r.requestType=="grouping"&&this.model.groupSettings.groupedColumns.length>1)for(f=this.getContentTable().find(".e-table").not(".e-recordtable").children("colgroup"),s=n(this.getContentTable().find(".e-recordtable")[0]).children("colgroup").find("col"),i=0;i<f.length;i++)a=n(f[i]).find("col").length,n(f[i]).find("col:gt("+(a-s.length-1)+")").remove(),n(f[i]).append(s.clone());return o},print:function(){var r={};r.requestType="print";this._printselectrows=this.getContentTable().find('tr[aria-selected="true"]');this._trigger("actionBegin",r);var u=window.open("","print","height=452,width=1024,tabbar=no"),f=t.buildTag("div#"+this._id),i=n.extend({},this.model);i.toolbarSettings.showToolbar=i.allowPaging=i.allowScrolling=!1;i.query.queries=[];this.model.allowPaging&&this.model.pageSettings.printMode=="currentpage"?(i.query.queries=[{fn:"onPage",e:{pageIndex:this._currentPage(),pageSize:this.model.pageSettings.pageSize}}],i.dataBound=function(){this._printProcess(u)}):i.dataBound=function(){this._printProcess(u)};f.ejGrid(i)},_printProcess:function(n){var i=this.element,r={requestType:"print",element:i,selectedRows:this._printselectrows};this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&i.find(".e-filterbar").remove();i.show();this._trigger("beforePrint",r);t.print(i,n);this._trigger("actionComplete",r)},"export":function(i,r,u,f){var o=n.extend(!0,{},this.model),h=this,w={action:i,method:"post","data-ajax":"false"},e=t.buildTag("form","",null,w),s=[],l,b,c,a,v,y,p;if(u&&!t.isOnWebForms)l=n("div.e-grid"),f&&f.length>0&&(l=n.map(f,function(n){return document.getElementById(n)})),n.each(l,function(i,r){var u=n(r).data("ejGrid"),f,o,c,l;if(s.push({id:u._id,locale:u.model.locale}),!t.isNullOrUndefined(u)&&(f=n.extend(!0,{},u.model),f=h._getModifyExportModel(f),u.ignoreOnExport)){for(o=0;o<u.ignoreOnExport.length;o++)delete f[u.ignoreOnExport[o]];c={name:"GridModel",type:"hidden",value:u.stringify(f)};l=t.buildTag("input","",null,c);e.append(l)}}),n("body").append(e),e.submit();else{if(this._locale=this.model.locale,o=this._getModifyExportModel(o),b=this,this.ignoreOnExport)for(c=0;c<this.ignoreOnExport.length;c++)delete o[this.ignoreOnExport[c]];t.raiseWebFormsServerEvents?(a={model:o,originalEventType:r},v={model:this.stringify(o)},t.raiseWebFormsServerEvents(r,a,v),setTimeout(function(){t.isOnWebForms=!0},1e3)):(y={name:"GridModel",type:"hidden",value:this.stringify(o)},p=t.buildTag("input","",null,y),e.append(p),e.append(this),n("body").append(e),e.submit())}return setTimeout(function(){var i,r;if(s.length)for(i=0;i<s.length;i++)r=n("#"+s[i].id).data("ejGrid"),r.model.locale=s[i].locale;t.isNullOrUndefined(h._locale)||(h.model.locale=h._locale)},0),e.remove(),!0},_getModifyExportModel:function(i){var e={},u,o,f;n.extend(e,t.Grid.Locale["en-US"],t.Grid.Locale[i.locale]);var s=e.GroupCaptionFormat,h=s.indexOf("{{if"),l=s.indexOf(" {{else}}"),a=s.slice(h,l).replace("{{if count == 1 }}",""),c={EmptyRecord:e.EmptyRecord,GroupCaptionFormat:s.slice(0,h),GroupText:a,True:e.True,False:e.False};for(t.isNullOrUndefined(this.model)||(this.model.locale=i.locale.concat(JSON.stringify(c))),i.locale=i.locale.concat(JSON.stringify(c)),u=0;u<i.columns.length;u++)if(i.columns[u].editType!=r)switch(i.columns[u].editType){case"stringedit":case"edittemplate":i.columns[u].editType="string";break;case"numericedit":i.columns[u].editType="numeric";break;case"dropdownedit":i.columns[u].editType="dropdown";break;case"booleanedit":i.columns[u].editType="boolean"}for(u=0;u<i.filterSettings.filteredColumns.length;u++)i.filterSettings.filteredColumns[u].operator=="equal"?i.filterSettings.filteredColumns[u].operator="equals":i.filterSettings.filteredColumns[u].operator=="notequal"&&(i.filterSettings.filteredColumns[u].operator="notequals");if(i.showStackedHeader)for(i.stackedHeaderRow=i.stackedHeaderRows,u=0;u<i.stackedHeaderRow.length;u++)for(i.stackedHeaderRow[u].stackedHeaderColumn=i.stackedHeaderRow[u].stackedHeaderColumns,o=i.stackedHeaderRow[u].stackedHeaderColumn,f=0;f<o.length;f++)i.stackedHeaderRow[u].stackedHeaderColumn[f].column=n.isArray(o[f].column)?o[f].column:o[f].column.split(",");return i},sendDataRenderingRequest:function(i){var h,d,g,w,nt,tt,b,s,v,it,o,c,f,rt,k,ut,y,ft;if(this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1),this.setFormat(),this.model.scrollSettings.enableVirtualization||(this._previousColumnIndex=null,this._previousRowCellIndex=null,this._previousIndex=null),i.requestType=="add"||i.requestType=="grouping"||this.model.currentViewData!=null&&this.model.currentViewData.length)switch(i.requestType){case t.Grid.Actions.Refresh:case t.Grid.Actions.Paging:case t.Grid.Actions.Sorting:case t.Grid.Actions.Filtering:case t.Grid.Actions.Save:case t.Grid.Actions.Cancel:case t.Grid.Actions.Delete:case t.Grid.Actions.Search:case t.Grid.Actions.Reorder:case t.Grid.Actions.BatchSave:if(h=this.model.groupSettings.groupedColumns,this.model.allowGrouping&&i.requestType==t.Grid.Actions.Refresh&&h.length==0&&this.element.find(".e-grouptopleftcell").length>0&&(d=this.element.children(".e-gridheader"),d.find("div").first().empty().append(this._renderGridHeader().find("table"))),(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none"),this.model.allowGrouping||(h=[]),h.length==0){var u=document.createElement("div"),l,e=-1,p=!1;if(this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(this.model.childGrid!=null||this.model.detailsTemplate!=null)&&this.getContentTable().find("colgroup").first().prepend(this._getIndentCol()),g=this._currentPage(),(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"||this.model.editSettings.editMode=="normal")&&(i.requestType=="cancel"||i.requestType=="save")&&(this._editFormHeight=this.element.find(".gridform").closest("tr").height()),this.model.scrollSettings.frozenColumns>0)u.innerHTML=this._renderByFrozenDesign();else{i.data&&(l=document.createElement("div"),l.innerHTML=["<table><tbody>",n.render[this._id+"_JSONTemplate"](i.data),"<\/tbody><\/table>"].join(""),this._dataSource()instanceof t.DataManager&&i.requestType==t.Grid.Actions.Save&&(e=this._getDataIndex(this.model.currentViewData,i.data),p=this._dataSource().adaptor instanceof t.remoteSaveAdaptor));w=null;w=!this.model.scrollSettings.allowVirtualScrolling||this.model.scrollSettings.enableVirtualization||t.isNullOrUndefined(this._currentVIndex)||i.requestType!="save"&&i.requestType!="cancel"&&i.requestType!="delete"?this.model.currentViewData:t.isNullOrUndefined(this._lastVirtualPage)?this._virtualLoadedRecords[this._currentVIndex]:this._lastVirtualPage;u.innerHTML=["<table><tbody>",n.render[this._id+"_JSONTemplate"](w),"<\/tbody><\/table>"].join("");var a=this.getContentTable().get(0),r=a.lastChild,et=this.getContentTable().first().find("tbody").first();if(i.requestType!="save"&&i.requestType!="cancel"||this.model.editSettings.editMode=="batch"||this.model.scrollSettings.allowVirtualScrolling)i.requestType!="delete"||this.model.scrollSettings.allowVirtualScrolling?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):(this._isUnboundColumn&&($editedrow=this.element.find(".e-editedrow"),$oldChild=this.getContentTable().find(".e-editedrow").get(0),$newChild=$editedrow.length?u.firstChild.firstChild.firstChild:l.firstChild.firstChild.lastChild,$editedrow.length!=0&&(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")?n($oldChild).replaceWith(n($newChild)):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?($oldChild=$editedrow.prev("tr").get(0),$editedrow.remove()):$oldChild=$editedrow.get(0)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&this.getContentTable()[0].rows.length!=this.model.currentViewData.length&&(this.getContentTable().find("tr").length&&this._excludeDetailRows().length?this.multiDeleteMode?(k=u.firstChild.firstChild.rows.length,ut=n(u.firstChild.firstChild.rows).slice(k-this.selectedRowsIndexes.length,k),n(r).append(ut)):r.appendChild(u.firstChild.firstChild.lastChild):n(r).prepend(u.firstChild.firstChild.rows)),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(y=this.getContentTable().find(".e-detailrow:visible"),n.each(y,function(n){y.eq(n).closest("tr").prev().children(".e-detailrowexpand").length==0&&y.eq(n).remove()})),this._gridRows=a.rows,this.model.enableAltRow&&this._refreshAltRow());else{if(rowIndex=this.model.editSettings.editMode.indexOf("inlineform")!=-1?t.isNullOrUndefined(i.selectedRow)?this._selectedRow():i.selectedRow:this.getContentTable().find(".e-"+i.action+"edrow").index(),nt=this._currentTrIndex,rowIndex==-1&&(rowIndex=nt),this.model.detailsTemplate!=null||this.model.childGrid!=null)for(tt=this.model.editSettings.editMode=="inlineform"?n(n(r.childNodes).not(".e-detailrow")[rowIndex]):n(r.childNodes[rowIndex]),b=n(r.childNodes).not(".e-detailrow"),o=0;o<b.length;o++)tt.is(b[o])&&(rowIndex=o);if(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"){if(i.action=="add"&&!this.getContentTable().find(".e-addedrow").length)break;$oldChild=this.getContentTable().find(".e-addedrow").get(0);$editedTr=this.getContentTable().find(".e-editedrow");$newChild=$editedTr.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:l.firstChild.firstChild.lastChild;$editedTr.length?($newChild=u.firstChild.firstChild.childNodes[rowIndex],this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?($oldChild=$editedTr.prev("tr").get(0),$editedTr.remove()):$oldChild=$editedTr.get(0),s=n($newChild),f=n($oldChild),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.next("tr.e-detailrow:visible").length&&(c=s.find(".e-detailrowcollapse"),c.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),i.requestType=="cancel"?(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").addClass("e-showaddrow"),f.replaceWith(s)):!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(this.model.detailsTemplate!=null&&f.next("tr.e-detailrow").length&&r.removeChild(f.next("tr.e-detailrow").get(0)),f.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&h.length==0&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):t.isNullOrUndefined(this.model.currentViewData[rowIndex])||this._primaryKeys.length&&t.getObject(this._primaryKeys[0],this.model.currentViewData[rowIndex])!=t.getObject(this._primaryKeys[0],i.data)?n(r).replaceWith(n(u).find("tbody")):r.replaceChild($newChild,$oldChild),this.model.editSettings.showAddNewRow&&(this.model.editSettings.rowPosition=="top"?r.firstChild.remove():r.lastChild.remove())):(s=n($newChild),f=n($oldChild),i.action=="add"&&i.requestType=="save"&&this.model.editSettings.showAddNewRow&&this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&(this.model.editSettings.rowPosition=="bottom"?r.lastChild.previousSibling.remove():r.lastChild.remove()),i.requestType=="cancel"||this._dataSource()instanceof t.DataManager||this._currentPage()!=1||i.requestType=="save"&&!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount==this._previousFilterCount?(t.isNullOrUndefined($oldChild)||(f.remove(),this._dataSource()instanceof t.DataManager&&e!=-1?e==0?r.insertBefore($newChild,r.children[e]):s.insertAfter(r.children[e-1]):this._dataSource()instanceof t.DataManager&&!p||this._currentPage()==1||i.requestType!="save"||n(r).prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&h.length==0&&(this._dataSource()instanceof t.DataManager&&e==-1&&!p&&i.requestType!="save"||i.requestType!="save"&&!(this._dataSource()instanceof t.DataManager))&&i.requestType=="cancel"&&!this.model.editSettings.showAddNewRow&&a.lastChild.appendChild(u.firstChild.firstChild.lastChild)),i.requestType!="cancel"||this._selectedRow()==-1||this._enableCheckSelect||this.clearSelection()):this.model.currentViewData.length==1?(n(r).empty(),r.appendChild($newChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this.model.editSettings.rowPosition=="bottom"?(et.prepend($oldChild),r.replaceChild($newChild,$oldChild)):r.replaceChild($newChild,$oldChild))}else if(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")if($editedTr=this.element.find(".e-editedrow"),i.requestType!="cancel"&&($editedTr.length||t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount!=this._previousFilterCount))if($editedTr.length){if($newChild=u.firstChild.firstChild.childNodes[rowIndex],$oldChild=this._excludeDetailRows(r.childNodes)[rowIndex],this.model.allowCellMerging!=null&&(f=n($oldChild),n($oldChild.childNodes).hasClass("e-merged")))for(v=f.children(".e-merged").index(),it=$oldChild.children[v].colSpan,o=0;o<it;o++)$newChild.childNodes[v+o].className+=" e-merged e-hide",$newChild.childNodes[v].colSpan=o+1;this.model.detailsTemplate!=null&&($oldChild=n(r.childNodes).not(".e-detailrow").eq(rowIndex).get(0));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.next("tr.e-detailrow:visible").length&&(c=n($newChild).find(".e-detailrowcollapse"),c.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"));!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(f=n($oldChild),this.model.detailsTemplate!=null&&f.next("tr.e-detailrow").length&&r.removeChild(f.next("tr.e-detailrow").get(0)),f.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):t.isNullOrUndefined(this.model.currentViewData[rowIndex])||this._primaryKeys.length&&t.getObject(this._primaryKeys[0],this.model.currentViewData[rowIndex])!=t.getObject(this._primaryKeys[0],i.data)?n(r).replaceWith(n(u).find("tbody")):r.replaceChild($newChild,$oldChild)}else this.model.currentViewData.length==1&&this.getContentTable().find("td.e-rowcell").length==0?($newChild=u.firstChild.firstChild.firstChild,n(r).empty(),r.appendChild($newChild)):(newChild=$editedTr.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:l.firstChild.firstChild.lastChild,this._dataSource()instanceof t.DataManager?e!=-1&&(e==0?r.insertBefore(newChild,r.children[e]):n(newChild).insertAfter(r.children[e-1]),rt=this._isAddNew&&e?this.model.currentViewData.length-1:this.model.currentViewData.length+1,this.model.allowPaging&&(this.model.pageSettings.pageSize<rt||e==this.model.pageSettings.pageSize)&&r.removeChild(r.lastChild)):(this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this._currentPage()==1?this.getContentTable().find("tbody").first().prepend(n(newChild)):this.getContentTable().find("tbody").first().prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.removeChild(r.lastChild)),this.model.detailsTemplate!=null&&n(a.lastChild.lastChild).children(".e-detailrowexpand").length&&r.removeChild(r.lastChild));else $newChild=u.firstChild.firstChild.childNodes[rowIndex],$oldChild=r.childNodes[rowIndex],s=n($newChild),f=n($oldChild),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.next(".e-detailrow:visible").length&&(c=s.find(".e-detailrowcollapse"),c.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),f.replaceWith(s),this._enableCheckSelect||this.clearSelection(),this.model.allowPaging&&this._refreshGridPager();this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():a.rows;this.model.enableAltRow&&this._refreshAltRow()}}this._currentJsonData=this.model.currentViewData;this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():this.getContentTable().get(0).rows;this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);ft={};(i.requestType=="sorting"||i.requestType=="filtering"||i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="filtering"&&(this.getContent().first().ejScroller("refresh").ejScroller("isVScroll")?this.element.find(".gridheader").addClass("e-scrollcss"):this.element.find(".gridheader").removeClass("e-scrollcss"),ft=this._refreshVirtualPagerInfo()),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(g),i.requestType=="filtering"&&this.getContent().first().ejScroller("refresh"));this.model.allowPaging&&(this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._gridRecordsCount:this._searchCount,currentPage:this._currentPage()}),this._refreshGridPager());this.model.scrollSettings.enableVirtualization||this._eventBindings();break}case t.Grid.Actions.Grouping:this._group(i);this._refreshStackedHeader();break;case t.Grid.Actions.BeginEdit:this._edit(i);break;case t.Grid.Actions.Add:this._add(i);break;case t.Grid.Actions.Ungrouping:this._ungroup(i);break;case t.Grid.Actions.VirtualScroll:this._isVirtualRecordsLoaded||(this.model.scrollSettings.enableVirtualization?this._replacingVirtualContent():this._replacingContent())}else i.requestType=="reorder"&&this.model.groupSettings.groupedColumns.length>0?this._group(i):((t.isNullOrUndefined(this.model.currentViewData)||this.model.currentViewData.length==0)&&!this.phoneMode&&(i.requestType=="refresh"&&this.model.scrollSettings.frozenColumns==0&&this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(i.requestType=="filtering"||i.requestType=="cancel"||i.requestType=="refresh")&&this.model.scrollSettings.frozenColumns>0&&this._removeFrozenTemplate()),this._newungroup(i));(t.isNullOrUndefined(this.model.currentViewData)||this.model.currentViewData.length==0)&&(this._currentJsonData=[]);this._showGridLines();this._completeAction(i)},_removeFrozenTemplate:function(){this.getContent().find(".e-content").empty();var i=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),r=n(document.createElement("tbody"));i.append(this.getHeaderTable().find("colgroup").clone()).append(r);this.getContent().find(".e-content").html(i);this.setGridContentTable(i)},_showGridLines:function(){var n=this.model.gridLines;n!="both"&&this.getContent().addClass(n!="none"?"e-"+n+"lines":"e-hidelines")},_showHeaderGridLines:function(){var n=this.model.gridLines;n!="both"&&this.getHeaderContent().addClass(n!="none"?"e-"+n+"lines":"e-hidelines")},_newungroup:function(n){n.requestType=="ungrouping"?this._ungroup(n):this.getContentTable().find("tbody").empty().first().append(this._getEmptyTbody())},setFormat:function(){for(var f,r,u,i=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].type=="date"&&i.push(this.model.columns[n]);if(i.length>0&&!t.isNullOrUndefined(this.model.currentViewData))for(n=0,f=this.model.currentViewData.length;n<f;n++)for(r=0;r<i.length;r++)u=t.getObject(i[r].field,this.model.currentViewData[n]),/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(u)&&t.createObject(i[r].field,new Date(u),this.model.currentViewData[n])},_completeAction:function(i){var s,e,f,l,h,c,r,u,o;if(this.model.editSettings.editMode.indexOf("dialog")!=-1&&(i.requestType=="save"||i.requestType=="cancel")&&n("#"+this._id+"_dialogEdit").data("ejDialog")&&n("#"+this._id+"_dialogEdit").ejDialog("close"),this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"||(this.model.isEdit=!1),this._confirmedValue=!1,t.Grid.Actions.Grouping==i.requestType&&t.isNullOrUndefined(i.columnName)||i.requestType=="refresh"&&this._LastColumnUnGroup){this._LastColumnUnGroup=!1;return}i.columnSortDirection!="ascending"&&i.columnSortDirection!="descending"||t.isNullOrUndefined(i.columnName)||(s=this.getColumnByField(i.columnName),this.model.allowSorting&&this.model.allowMultiSorting?this._scolumns.push(s.field):this._gridSort=s.field);i.requestType!="beginedit"&&i.requestType!="add"&&(!this.model.allowScrolling||!this.initialRender||this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this.setWidthToColumns();(i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&(this._isAddNew=!1,this.model.isResponsive&&this.model.minWidth&&this.windowonresize());this.initialRender||!(t.Grid.Actions.UnGrouping==i.requestType||this.model.groupSettings.groupedColumns.length>0)||n("#"+this._id+"EditForm").length||this._recalculateIndentWidth();t.Grid.Actions.Paging==i.requestType||t.Grid.Actions.BatchSave==i.requestType?this._refreshGridPager():t.Grid.Actions.Sorting==i.requestType&&this.model.allowSorting||t.Grid.Actions.Refresh==i.requestType||t.Grid.Actions.Cancel==i.requestType?(t.gridFeatures.sort&&this.getHeaderTable()!==null&&this._sortCompleteAction(i),this.model.allowPaging&&(e=this.getPager().ejPager("option"),this._currentPage(e.currentPage),delete e.currentPage,n.extend(this.model.pageSettings,e),delete this.model.pageSettings.masterObject,this._refreshGridPager()),!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i)):t.Grid.Actions.Delete==i.requestType||t.Grid.Actions.Save==i.requestType||t.Grid.Actions.Search==i.requestType?(this._editEventTrigger(i),!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i),this.model.allowPaging&&this._refreshPagerTotalRecordsCount()):t.Grid.Actions.Filtering==i.requestType?this._filterCompleteAction():t.Grid.Actions.BeginEdit==i.requestType||t.Grid.Actions.Add==i.requestType?this._editCompleteAction(i):(t.Grid.Actions.Grouping==i.requestType||t.Grid.Actions.Ungrouping==i.requestType)&&this["_"+i.requestType+"CompleteAction"](i);(this.model.toolbarSettings.showToolbar||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&this.refreshToolbar();!this.initialRender&&this.model.showSummary&&this.model.summaryRows.length>0&&(this.model.currentViewData.length?(this.element.children(".e-gridfooter").length||this._renderGridFooter().insertAfter(this.getContent()),i.requestType=="beginedit"||i.requestType=="add"||(this._refreshGridFooterColGroup(),this._createSummaryRows(this.getFooterTable()))):this.element.children(".e-gridfooter").remove());!this.initialRender&&t.gridFeatures.selection&&(this.getContent().find("td.e-selectionbackground").length||this._setCurrentRow(i.requestType),i.requestType=="cancel"&&n(this.getRowByIndex(this.model.selectedRowIndex)).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),i.requestType!="virtualscroll"&&this.clearColumnSelection()&&n(this.getHeaderTable().find("th.e-headercell")).removeClass("e-columnselection"));this.model.editSettings.editMode=="batch"&&this.refreshBatchEditMode();(!this.initialRender&&(this.model.allowScrolling||this.model.isResponsive)&&(this._checkScrollActions(i.requestType)||this.model.editSettings.editMode.indexOf("inline")!=-1&&i.requestType=="beginedit")||this.model.scrollSettings.virtualScrollMode=="continuous"&&i.requestType=="virtualscroll")&&(this.model.isResponsive&&this.model.minWidth?this.windowonresize():this._refreshScroller(i));this.model.scrollSettings.virtualScrollMode=="normal"&&i.requestType=="virtualscroll"&&this.getContent().find("div:first").scrollLeft(this.getScrollObject().scrollLeft());this._customPop!=null&&i.requestType!="sorting"&&this._customPop.hide();!this.model.allowScrolling||this.initialRender||this.model.scrollSettings.enableVirtualization||this.model.isResponsive&&this._isHeightResponsive||this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell");this.model.allowGrouping&&this.model.showSummary&&this._refreshGroupSummary();t.Grid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0&&this._groupingCompleteAction(i);t.Grid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length<1&&this._ungroupingCompleteAction(i);this.model.allowGrouping&&(f=this.element.children(".e-groupdroparea"),f.length>0&&f.removeClass("e-default").removeClass("e-active"),this.model.groupSettings.groupedColumns.length>0?f.addClass("e-active"):f.addClass("e-default"));this.model.textWrapSettings&&this._setTextWrap();i.requestType==t.Grid.Actions.Reorder&&this.model.showColumnChooser&&(l=n("#"+this._id+"ccDiv").data("ejDialog"),l.isOpened()&&n("#"+this._id+"_ccTail").first().remove(),h=0,t.isNullOrUndefined(this.element.find(".e-ccButton").outerHeight())||(h+=this.element.find(".e-ccButton").outerHeight()),this.element.find(".e-ccButton").first().remove(),n("#"+this._id+"ccDiv_wrapper").remove(),this.element.css("margin-top",parseInt(this.element.css("margin-top"),10)-h),this._renderColumnChooser());this.initialRender&&i.requestType=="grouping"&&(i={requestType:"refresh"});(this._isUngrouping||this._columnChooser)&&i.requestType=="refresh"||(this._trigger("actionComplete",i),this._isUngrouping=!1,this._columnChooser=!1);(!this._isUngrouping&&!this.initialRender||this._showHideColumns||this._columntemplaterefresh)&&this._trigger("refresh");this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&(this.initialRender||this.getContentTable().find("tr.e-addedrow").length!=0||this.element.find(".e-gridcontent").find("tr").length==0||this._startAdd(),i.requestType=="searching"&&this.element.find(".e-gridtoolbar").find("li#"+this._id+"_search input").focus());(t.Grid.Actions.BeginEdit==i.requestType||t.Grid.Actions.Add==i.requestType)&&n.isFunction(n.validator)&&this.setValidation();this.initialRender||(this.model._groupingCollapsed=[]);this._updateDataSource&&this._gridRecordsCount&&(c=this.model.editSettings.showAddNewRow?this.model.currentViewData[1]:this.model.currentViewData[0],t.isNullOrUndefined(c)||(this._initColumns(c),this.model.allowFiltering&&this._renderFilterDialogs(),this._updateDataSource=!1));this.model.columnLayout!="fixed"||this.model.isEdit||this.setWidthToColumns();this.model.allowRowDragAndDrop&&this._rowsDragAndDrop();!this._isLocalData&&this.model.allowScrolling&&this.element.width()!=0&&this.refreshScrollerEvent();!this.initialRender&&this._enableCheckSelect&&(r=this.checkSelectedRowsIndexes[this._currentPage()-1],u=this.getHeaderTable().find(".e-headercheckcelldiv .e-checkselectall"),this._selectAllCheck||this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.selectedRowsIndexes.length==this._gridRecordsCount||u.prop("checked",!1),!this._isMapSelection&&r&&r.length>this._gridRows.length&&r.splice(this._gridRows.length,r.length-this._gridRows.length),this._isMapSelection?this._mappingSelection():i.requestType!="paging"&&i.requestType!="save"&&i.requestType!="beginedit"&&i.requestType!="cancel"?this.checkSelectedRowsIndexes=[]:r&&r.length&&this.selectRows(r),this.model.currentViewData!=null&&this.model.currentViewData.length==0?this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").hide():this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").show(),this._selectAllCheck&&(o=u.prop("checked")^this.selectedRowsIndexes.length==this.model.currentViewData.length,this.model.groupSettings.groupedColumns.length&&(o=!o),u[0].checked=o?u[0].checked:!u[0].checked))},_getDataIndex:function(n,t){for(var i,u,f=0,r=0,e=n.length;r<e;r++){for(i=0,u=this._primaryKeys.length;i<u;i++)if(this._checkPrimaryValue(n[r][this._primaryKeys[i]],t[this._primaryKeys[i]],this._primaryKeys[i]))break;else{i==u-1&&(f=1);continue}if(f)return r}return-1},_checkPrimaryValue:function(n,t,i){return this.getColumnByField(i).type=="string"&&(n=n.trim()),n!=t?!0:!1},_eventBindings:function(){var a=this.model.scrollSettings.frozenColumns>0?this._gridRows[0].length:this._gridRows.length,e=0,h,c=this.model.pageSettings.pageSize,i,r,u,o,f,s,l;if(t.gridFeatures.common&&this._refreshUnboundTemplate(this.getContentTable()),this._gridRecordsCount!=0&&(this.model.queryCellInfo!=null||this.model.rowDataBound!=null||this.model.mergeCellInfo!=null||this.model.templateRefresh!=null))for(i=0;i<a;i++){if(r=null,e=i,this.model.scrollSettings.allowVirtualScrolling&&i<c)if(this.model.scrollSettings.enableVirtualization){if(r=n(this._gridRows).eq(i),u=parseInt(n(r).attr("name"),32),n.inArray(u,this._queryCellView)!=-1)continue;this._virtualLoadedRecords[u]&&(o=this._virtualLoadedRecords[u][i%this._virtualRowCount]);e=u*this._virtualRowCount+i%this._virtualRowCount}else{for(f=0;f<this._cloneQuery.queries.length;f++)h=this._cloneQuery.queries[f].fn=="onPage"&&this._cloneQuery.queries[f].e.pageIndex-1;s=c*h;s!=0&&(r=this.getContentTable().find("tr[name="+s+"]").eq(i),e=r.index())}else this.model.scrollSettings.enableVirtualization&&(r=n(this._gridRows).eq(i));if(r=r||this.getRowByIndex(e),r.hasClass("e-virtualrow")||t.isNullOrUndefined(this._currentJsonData[i]||o))break;l=this.model.scrollSettings.enableVirtualization?o:this._currentJsonData[i];this._rowEventTrigger(r,l)}},_rowEventTrigger:function(i,r){var u={row:i,data:r},s,e,f,o;if(this._trigger("rowDataBound",u),s=i.cells,e=n(i).find(".e-rowcell"),this.model.queryCellInfo!=null||this.model.mergeCellInfo!=null||this.model.templateRefresh!=null)for(f=0;f<e.length;f++)u={cell:e[f],data:r,text:e[f].innerHTML},o=this._getForeignKeyData(u.data),n(e[f]).hasClass("e-rowcell")&&(u.column=this.model.columns[f]),t.isNullOrUndefined(o)||(u.foreignKeyData=o),this.model.allowCellMerging==!0&&(this._cellMerging(u),this._trigger("mergeCellInfo",u)),this._trigger("queryCellInfo",u),n(e[f]).hasClass("e-templatecell")&&(u={cell:e[f],column:this.model.columns[f],data:r,rowIndex:n(i).index()},this._trigger("templateRefresh",u))},setWidthToColumns:function(){var f=this.getContentTable().children("colgroup").find("col"),h=this.getHeaderTable().children("colgroup").find("col"),s=[],e=this.element.width(),l=0,a=0,w=0,y=!t.isIOSWebView()&&this.getBrowserDetails(),g,nt,rt,ut,p,k,c,ht,o,i,d;for(this.model.groupSettings.groupedColumns.length&&!this.model.allowScrolling&&this.model.groupSettings.showGroupedColumn&&y&&y.browser=="msie"&&parseInt(y.version,10)>8&&f.first().css("width",3e3/e+"%"),t.isNullOrUndefined(this.model.detailsTemplate)||(g=this.model.groupSettings.groupedColumns.length,nt=this.model.groupSettings.groupedColumns.length!=0?1:0,f.eq(nt).css("width",this._detailsOuterWidth),h.eq(g).css("width",this._detailsOuterWidth)),this._detailColsRefresh(),f=this._$headerCols,h=this._$contentCols,i=0;i<h.length;i++){if(this.model.allowResizeToFit&&this.model.columns[i].width===r){hCellIndex=this.model.groupSettings.groupedColumns.length?i+this.model.groupSettings.groupedColumns.length:i;var tt=this._resizer._getContentWidth(i),b=this.getHeaderTable().find(".e-headercelldiv").eq(hCellIndex),it=this._resizer._getHeaderContentWidth(b);w=this.model.editSettings.editMode=="normal"&&(this.model.isEdit||this._isAddNew)?y.browser=="firefox"?parseInt(f[i].style.width,10):f.eq(i).width():(tt>it?tt:it)+parseInt((b.css("padding-left"),10)+(b.css("padding-right"),10));this.columnsWidthCollection[i]=w;a+=this.model.columns[i].visible?w:0}else a+=this.model.columns[i].visible?parseInt(this.model.columns[i].width,10):0;this.model.columns[i].priority&&h.eq(i).addClass("e-table-priority-"+this.model.columns[i].priority);t.isNullOrUndefined(this.columnsWidthCollection[i])?this.model.allowScrolling&&s.push(this.model.columns[i]):(f.eq(i).width(this.columnsWidthCollection[i]),h.eq(i).width(this.columnsWidthCollection[i]))}for(rt=s.filter(function(n){return!n.visible}).length,ut=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell"),i=0;i<s.length;i++)if(s[i].visible){var v=t.isNullOrUndefined(s[i].field)?this.getColumnIndexByField(s[i].field):this.getColumnIndexByHeaderText(s[i].headerText),ft=ut.eq(v)[0],u=ft.getBoundingClientRect().width;t.isNullOrUndefined(u)&&(u=ft.offsetWidth);parseInt(u)<15&&(u=(e/this.model.columns.length).toFixed(2),bSize=(e/(this.model.scrollSettings.buttonSize||18)/100).toFixed(2),u=u-bSize);f.eq(v).css("width",u+"px");h.eq(v).css("width",u+"px");this.model.columns[v].width=u;this.columnsWidthCollection[v]=parseFloat(u)}if(rt||(this._undefinedColsCollection=null),this.model.columnLayout=="fixed"){this.model.scrollSettings&&this.model.scrollSettings.frozenColumns==0&&(this.getHeaderTable().width(a),this.getContentTable().width(a));var ct=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),et=this.getHeaderContent().width()>ct?"addClass":"removeClass",ot=this.getHeaderTable(),st=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(ot=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),st=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0));ot[et]("e-tableLastCell");st[et]("e-tableLastCell")}if(!this.model.allowScrolling&&this.model.allowResizeToFit&&!this.model.isResponsive&&a>e&&(this.model.allowScrolling=!0,this.model.scrollSettings.width=e,this.getHeaderTable().parent().addClass("e-headercontent"),this._renderScroller(),!this.model.scrollSettings.frozenColumns>0&&this.getHeaderTable().width(e)),this.model.isEdit&&(c=f.clone(),this.model.editSettings.showAddNewRow&&(p=this.getContentTable().find(".e-editedrow")),$colGroup=this.model.scrollSettings.frozenColumns>0?this.getContent().find(".gridform").find("colgroup"):!t.isNullOrUndefined(p)&&p.length==1?p.find("colgroup"):n("#"+this._id+"EditForm").find("colgroup"),this.model.scrollSettings.frozenColumns>0&&$colGroup.first().empty().append(c.splice(0,this.model.scrollSettings.frozenColumns)),$colGroup.last().empty().append(c),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&$colGroup.prepend(this._getIndentCol())),this.model.groupSettings.groupedColumns.length)for(k=this.getContentTable().find(".e-recordtable").children("colgroup"),i=0;i<k.length;i++)c=f.clone(),ht=this._detailsOuterWidth!=null?this._detailsOuterWidth:"30px",(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&c.splice(0,0,n(this._getIndentCol()).width(ht)[0]),k.eq(i).empty().append(c);if(this.model.scrollSettings.frozenColumns>0){for(o=0,i=0;i<this.model.columns.length;i++)o+=this.model.columns[i].visible?parseInt(this.columnsWidthCollection[i],10):0,this.model.scrollSettings.frozenColumns-1==i&&(l=Math.ceil(o));this.element.width(this.model.scrollSettings.width||this.model.width);d=this.element.find(".e-gridcontent").children().first().width();d>o?o=d+(this.getContentTable().height()<this.model.scrollSettings.height&&this.getScrollObject()._vScroll?this.model.scrollSettings.buttonSize:0):o+=this.getHeaderContent().height()<this.model.scrollSettings.height?this.model.scrollSettings.buttonSize:0;this.getContent().find(".e-frozencontentdiv").outerWidth(l).end().find(".e-movablecontentdiv").outerWidth(o-l);this.getHeaderContent().find(".e-frozenheaderdiv").outerWidth(l).end().find(".e-movableheaderdiv").outerWidth(o-l)}!this.initialRender&&this.model.allowResizeToFit&&this.model.allowScrolling&&this.model.scrollSettings.enableVirtualization&&(e=this.getHeaderTable().width()>this.getContentTable().width()?this.getHeaderTable().width():this.getContentTable().width(),this.getContentTable().width(e),this.getHeaderTable().width(e))},_initialEndRendering:function(){var r,i,u;if(this.model.allowRowDragAndDrop&&this._rowsDragAndDrop(),(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?this.element.append(this._renderDialog()):(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&this.element.append(this._renderExternalForm())),(this.model.editSettings.editMode=="batch"||this.model.editSettings.showDeleteConfirmDialog)&&this._renderConfirmDialog(),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&n("#"+this._id+"AlertDialog").length==0&&this._renderAlertDialog(),(this.model.allowMultiSorting||this.model.selectionType=="multiple")&&this._renderMultiTouchDialog(),this.model.scrollSettings.frozenColumns>0&&!this.model.allowScrolling){this.getContent().remove();this.getHeaderTable().eq(1).remove();this._alertDialog.find(".e-content").text(this.localizedLabels.FrozenColumnsScrollAlert);this._alertDialog.ejDialog("open");return}if(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this._createPagerStatusBar(),this._getRowHeights(),this.element.width()!=0&&this.model.allowScrolling)this._renderScroller(),this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0||(this.setWidthToColumns(),r=t.isNullOrUndefined(this.getContent().data("ejScroller"))?null:this.getScrollObject(),r!=null&&r.refresh(),this.refreshScrollerEvent());else if((this.model.allowScrolling||this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length)&&this.element.width()<=0){i=this;u=setInterval(function(){if(!t.isNullOrUndefined(i.element)&&i.element.width()>0&&!t.isNullOrUndefined(i.element.width())){if(i.model.allowScrolling&&(i._renderScroller(),!(i.model.scrollSettings.frozenRows>0||i.model.scrollSettings.frozenColumns>0))){i.setWidthToColumns();var n=t.isNullOrUndefined(i.getContent().data("ejScroller"))?null:i.getScrollObject();n!=null&&n.refresh();i.refreshScrollerEvent()}i.model.allowGrouping&&i.model.groupSettings.groupedColumns.length&&i.getHeaderTable().find(".e-grouptopleftcell").width()<=0&&i.getHeaderTable().find(".e-grouptopleftcell").css("width",i.getHeaderTable().find("colgroup col").eq(0).width());i._endRendering();clearInterval(u)}},100);return}this._endRendering()},_endRendering:function(){var n,r,u,i,f;t.isNullOrUndefined(this.model.serverProperties)||(n=this.model.serverProperties._checkSelectedRowsIndexes,this.checkSelectedRowsIndexes=n&&n.length?n:this.checkSelectedRowsIndexes);!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&this.model.allowScrolling&&(r=this.getScrollObject());u=this.model.enableRTL?"e-summaryscroll e-rtl":"e-summaryscroll";this.model.allowScrolling&&this.model.showSummary&&(r._vScroll&&this.element.find(".e-summaryrow.e-scroller").addClass(u),this.getFooterTable()&&this.getFooterTable().find("colgroup").first().replaceWith(this.getHeaderTable().find("colgroup").clone()));this._addMedia();this.model.allowScrolling&&this.model.allowTextWrap&&!this.model.scrollSettings.allowVirtualScrolling&&this.getContent().first().ejScroller("refresh");this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this._currentPage()!=1||this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=this._currentJsonData),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView():this._refreshVirtualContent(this._currentPage()),this.getContent().first().ejScroller("refresh"),this.getContent().ejScroller("isVScroll")?(this.element.find(".e-gridheader").addClass("e-scrollcss"),this.getHeaderTable().first().width(this.getContentTable().width())):this.element.find(".e-gridheader").removeClass("e-scrollcss"));this.model.allowSelection==!0&&this.model.selectionType=="multiple"&&this._selectedMultipleRows().length>0&&this._selectingMultipleRows(this._selectedMultipleRows());(this._selectedRow()!=-1||this._selectedMultipleRows().length==1)&&(i=this._selectedMultipleRows(),f=i.length?i:this._selectedRow(),this.selectRows(f));!this.model.allowFiltering||this.model.filterSettings.filterType!="filterbar"||this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling||this._createPagerStatusBar();t.gridFeatures.common&&this.rowHeightRefresh();t.gridFeatures.filter&&["menu","excel"].indexOf(this.model.filterSettings.filterType)!=-1&&this._refreshFilterIcon();this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this._recalculateIndentWidth();this.initialRender&&(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow()},_addLastRow:function(){var r=this.getContentTable().find("tr:last").find("td"),u=0,i;if(this.model.allowScrolling&&!this.model.scrollSettings.allowVirtualScrolling&&!t.isNullOrUndefined(this.model.dataSource)&&!t.isNullOrUndefined(this.getRows())){for(i=0;i<this.getRows().length;i++)u+=n(this.getRows()[i]).height();u<this.getContent().height()-1&&r.addClass("e-lastrowcell")}this.model.scrollSettings.allowVirtualScrolling&&this.getContentTable().height()<this.getContent().height()&&r.addClass("e-lastrowcell")},_addMedia:function(){if(!this.model.enablePersistence&&typeof this.model.scrollSettings.width!="string"&&this.model.scrollSettings.width>0?this._responsiveScrollWidth=this._originalScrollWidth=this.model.scrollSettings.width:this._originalScrollWidth=this.element.width(),typeof this.model.scrollSettings.height!="string"&&this.model.scrollSettings.height>0&&(this._responsiveScrollHiehgt=this.model.scrollSettings.height),this.model.minWidth&&this.model.isResponsive){this._$onresize=n.proxy(this.windowonresize,this);n(window).on("resize",this._$onresize);if(n.isFunction(window.matchMedia)){var t=window.matchMedia("(max-width: 768px)");this._mediaStatus=t.matches}this.windowonresize()}},_getNoncontentHeight:function(){var n=0;return t.isNullOrUndefined(this.getHeaderContent().outerHeight())||(n+=this.getHeaderContent().outerHeight()),this.model.toolbarSettings.showToolbar&&!t.isNullOrUndefined(this.element.find(".e-gridtoolbar").outerHeight())&&(n+=this.element.find(".e-gridtoolbar").outerHeight()),this.model.allowPaging&&!t.isNullOrUndefined(this.element.find(".e-pager").outerHeight())&&(n+=this.element.find(".e-pager").outerHeight()),this.model.showColumnChooser&&!t.isNullOrUndefined(this.element.find(".e-ccButton").outerHeight())&&(n+=this.element.find(".e-ccButton").outerHeight()),this.model.allowGrouping&&this.model.groupSettings.showDropArea&&!t.isNullOrUndefined(this.element.find(".e-groupdroparea").outerHeight())&&(n+=this.element.find(".e-groupdroparea").outerHeight()),this.model.showSummary&&!t.isNullOrUndefined(this.element.find(".e-gridsummary").outerHeight())&&(n+=this.element.find(".e-gridsummary").outerHeight()),n},setDimension:function(n,t){var i=n-this._getNoncontentHeight();this.model.scrollSettings.height=i;this.model.scrollSettings.width=t;this._renderScroller()},_getVisibleColumnsWidth:function(){for(var t=0,n=0;n<this.columnsWidthCollection.length;n++)this.model.columns[n].visible&&(t+=this.columnsWidthCollection[n]);return t},setPhoneModeMaxWidth:function(n){this._gridPhoneMode=n},_mediaQueryUpdate:function(i,r,u,f){var o,s,h,e;if(window.innerWidth<=this._gridPhoneMode&&this.model.enableResponsiveRow){o=this.getContentTable()[0].style;o.removeAttribute?o.removeAttribute("min-width"):o.removeProperty("min-width");s=this.getContent().data("ejScroller");s&&this.getContent().ejScroller("destroy");return}i?(this.model.scrollSettings.width=t.isNullOrUndefined(this._responsiveScrollWidth)?u:Math.min(this._responsiveScrollWidth,u),e=Math.min(f,r)-this._getNoncontentHeight(),e=t.isNullOrUndefined(this._responsiveScrollHiehgt)?e:Math.min(this._responsiveScrollHiehgt,e),(this.element.parent().is("body")&&n(document).height()>e||e>this.element.parent().height())&&this.model.scrollSettings.height!="auto"&&(e-=parseInt(this.element.parent().css("margin-bottom")+1)),e=this.model.scrollSettings.height!="auto"?e:this.model.scrollSettings.height,(this.model.minWidth>u||this.getContentTable().width()>u)&&r>f&&(e=e!="auto"?e+this.model.scrollSettings.buttonSize:e),t.isNullOrUndefined(this.getRows())&&(e="100%"),this.model.scrollSettings.height=this._isHeightResponsive?e:this._initHeight?this._initHeight:this.getContentTable()[0].scrollHeight,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller()):(this.model.scrollSettings.width="100%",t.isNullOrUndefined(this._responsiveScrollWidth)||(this.model.scrollSettings.width=Math.min(this._responsiveScrollWidth,u)),h=Math.min(f,r),e=h-this._getNoncontentHeight(),t.isNullOrUndefined(this._responsiveScrollHiehgt)||(e=Math.min(this._responsiveScrollHiehgt,e)),(this.element.parent().is("body")&&n(document).height()>e||e>this.element.parent().height())&&this.model.scrollSettings.height!="auto"&&(e-=parseInt(this.element.parent().css("margin-bottom"))),e=this.model.scrollSettings.height!="auto"?e:this.model.scrollSettings.height,(!t.isNullOrUndefined(this._responsiveScrollWidth)&&this.model.scrollSettings.width==this._responsiveScrollWidth&&(this.model.minWidth>this._responsiveScrollWidth||this._getVisibleColumnsWidth()>this._responsiveScrollWidth)||t.isNullOrUndefined(this._responsiveScrollWidth)&&(this.getRowHeight()==e||this._isHeightResponsive)&&this.getContentTable().width()>u)&&(e=e!="auto"?e+this.model.scrollSettings.buttonSize:e),t.isNullOrUndefined(this.getRows())&&(e="100%"),this.getContent().height()>=e&&!this._resize&&!this.initialRender&&typeof this.model.scrollSettings.width=="string"&&(this.model.scrollSettings.width=u),this.model.scrollSettings.height=this._isHeightResponsive?e:this._initHeight?this._initHeight:this.getContentTable()[0].scrollHeight,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller());this._resize=!1},windowonresize:function(i){var r,e,u,s;if(!this.element.is(":visible")){r=this;r._isVisible=!0;e=setInterval(function(){r.element.is(":visible")&&r._isVisible&&(r.windowonresize(),r._isVisible=!1,clearInterval(e))},100);return}i&&i.type=="resize"&&(this._resize=!0);this.model.scrollSettings.width=this._responsiveScrollWidth;this.element.css("width","100%");this.getContentTable().width("100%");this.getHeaderTable().width("100%");this.getContentTable().css("minWidth",this.model.minWidth);this.getContent().find(".e-vscrollbar").length==0&&this._isHeightResponsive&&(this.getContent().height("100%"),this.getContent().find(".e-content").height("100%"));this.getBrowserDetails().browser=="msie"&&this.getHeaderTable().css("min-width",this.model.minWidth);u=this.element.width();var h=n(window).height()-this.element.offset().top,l=t.isNullOrUndefined(this.getRows())?1:this.getRows().length,c=this.element.parent().is(n("body"))||this.element.parent().height()==n("body").height()||["","auto"].indexOf(this.element.parent()[0].style.height)!=-1,f=this.getContentTable()[0].scrollHeight+this._getNoncontentHeight(),o=c?h:this.element.parent().height();f+=parseInt(this.element.parent().css("margin-top"));s=this.model.minWidth>u||o<=f;this._mediaQueryUpdate(s,o,u,f)},_removeMedia:function(){n(window).off("resize",this._$onresize);this.getContentTable().css("min-width","");this.getHeaderTable().css("min-width","");this.getContentTable().css("width","");this.model.scrollSettings.width="auto";this.getContent().data("ejScroller")&&this.getContent().ejScroller("destroy")},_getRowHeights:function(){var n=this.getRows(),t;if(n!==null)if(this._rowHeightCollection=[],n[1]!==r&&n[1].length&&(this.model.scrollSettings.frozenColumns>0&&n[0]!==r||n[0]!==r&&typeof n[0].item!="undefined"&&typeof n[0].length=="number"&&typeof n[1].item!="undefined"&&typeof n[1].length=="number"))for(frotrs=n[0],movtrs=n[1],t=0;t<frotrs.length;t++)this._rowHeightCollection[t]=frotrs[t].offsetTop>=movtrs[t].offsetTop?frotrs[t].offsetTop:movtrs[t].offsetTop;else for(t=0;t<n.length;t++)this._rowHeightCollection[t]=n[t].offsetTop;return this._rowHeightCollection},_getEmptyTbody:function(){var i=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length-this._hiddenColumns.length});return n(document.createElement("tr")).append(i)},_getIndentCol:function(){return t.buildTag("col","",{width:"30px"})},_createSortElement:function(){return t.buildTag("span.e-icon"," ")},_createSortNumber:function(n,i){return i.css("text-align")=="right"?t.buildTag("span.e-number",n,{color:"white","font-size":"9px","text-align":"center",float:"left"}):t.buildTag("span.e-number",n,{color:"white","font-size":"9px","text-align":"center",float:"right"})},_onFocusIn:function(){var n=this;setTimeout(function(){n.element.removeClass("e-activefocusout")},0)},_onFocusOut:function(){var n=this;setTimeout(function(){n.element.addClass("e-activefocusout")},0)},_wireEvents:function(){this._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",this._clickHandler);this._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",".e-gridheader",this._mouseClickHandler);this.model.enableFocusout&&(this._on(this.element,"focusout",this._onFocusOut),this._on(this.element,"focusin",this._onFocusIn));t.gridFeatures.common&&(this._on(this.element,n.isFunction(n.fn.doubletap)&&this.model.enableTouch?"doubletap":"dblclick",".e-gridcontent > div:first",this._recorddblClickHandler),this.model.rightClick&&this._on(this.element,"contextmenu",this._rightClickHandler),this._on(this.element,"click",".e-gridcontent",this._recordClick),this._enableRowHover(),this.model.enableTouch?this._on(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._touchGrid,this)):this.element.addClass("e-touch"),this._on(this.element,"mousedown",".e-gridheader",this._headerMouseDown),this.model.allowRowDragAndDrop&&this.model.selectionType=="multiple"&&this._on(this.element,"touchstart mousedown",".e-gridcontent",this._contentMouseDown),this._on(this.element,"mouseover mouseleave",".e-gridheader:first",this._headerHover),this._on(this.element,t.eventType.mouseMove,".e-gridheader:first",this._headerHover),this.model.allowResizeToFit&&this._on(this.element,"dblclick",".e-gridheader",this._headerdblClickHandler),this.model.allowResizing&&(this._on(this.element,t.eventType.mouseMove,".e-gridheader:first",this._mouseMove),this._on(this.element,"mouseup",this._mouseUp)),this.model.allowKeyboardNavigation&&(this.element[0].tabIndex=this.element[0].tabIndex==-1?0:this.element[0].tabIndex,this.element[0].accessKey=!t.isNullOrUndefined(this.element[0].accessKey)&&this.element[0].accessKey!=""?this.element[0].accessKey:"e",this._on(this.element,"keyup",this._keyDownHandler)));t.gridFeatures.edit&&(this._enableEditingEvents(),this._on(this.element,"click",".e-gridcontent .e-unboundcelldiv",this._unboundClickHandler));this.model.allowGrouping&&(this._enableGroupingEvents(),this._on(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",this._dropAreaHover));this._enableFilterEvents()},_enableFilterEvents:function(){if((this.model.allowMultiSorting||this.model.selectionType=="multiple"||this.model.allowFiltering)&&this._on(n(document),"mousedown",this._docClickHandler),this.model.allowFiltering){var t=this;this._off(this.element,"keyup",".e-filterbar input")._on(this.element,"keyup",".e-filterbar input",this._filterBarHandler);this._on(this.element,"focus click",".e-filterbar",this._filterBarClose)}},_docClickHandler:function(i){var r=!t.isIOSWebView()&&this.getBrowserDetails(),u=n(i.target);this._customPop!=null&&this.element.find(i.target).length==0&&this._customPop.hide();this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel"?this._$colType&&(n(i.target).find(".e-grid.e-dlgcontainer").length>1||n(i.target).find(".e-excelfilter").length>1)&&(r&&r.browser=="msie"?i.target.tagName!="BODY"&&(this.isExcelFilter?this._excelFilter.closeXFDialog(i):this._closeFilterDlg()):this._isExcelFilter?this._excelFilter.closeXFDialog(i):this._closeFilterDlg()):u.hasClass("e-filtertext")||u.hasClass("e-cancel")||this.getFilterBar().find(".e-cancel").addClass("e-hide"))},_mouseClickHandler:function(i){var d=n(i.target),u,lt=this.commonQuery.clone(),g,rt,ut,h,ft,o,f,s,at,ot,bt,k,st,vt,tt,yt,y,nt,c,it,pt,ht,ti,ct;if((d.closest(".e-grid").length==0||d.closest(".e-grid").attr("id")===this._id)&&this.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow").css("cursor")!="col-resize")if(u=n(i.target).is(".e-ascending, .e-descending")?n(i.target.parentNode):d.hasClass("e-groupheadercell")?d.children("div"):n(i.target),this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this._isExcelFilter)&&(n.fx.off=!0,this._closeFDialog(),n.fx.off=!1),this.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive").removeClass("e-active"),u.hasClass("e-headercelldiv")||u.hasClass("e-headercell")&&n.inArray("column",this.model.selectionSettings.selectionMode)==-1||!u.hasClass("e-togglegroupbutton")&&u.closest(".e-headercelldiv").length&&n.inArray(u[0].tagName,["SELECT","INPUT","TEXTAREA"])==-1||u.closest(".e-groupheadercell").length&&n(i.target).is(".e-ascending, .e-descending")){if(!this.model.allowSorting||t.gridFeatures.sort===r)return;u=u.hasClass("e-headercelldiv")||u.closest(".e-groupheadercell").length?u:u.hasClass("e-headercell")?u.find(".e-headercelldiv"):u.closest(".e-headercelldiv");h=u.attr("ej-mappingname");g=t.sortOrder.Ascending;this._$prevSElementTarget=this._$curSElementTarget;this._$curSElementTarget=u;g=u.find("span").hasClass("e-ascending")?t.sortOrder.Descending:t.sortOrder.Ascending;i.pointerType=="touch"&&this._customPop!=null&&!this._customPop.is(":visible")&&this._customPop.find(".e-sortdirect").hasClass("e-spanclicked")&&this._customPop.show();i.pointerType=="touch"&&this._customPop!=null&&(this._customPop.find(".e-rowselect").is(":visible")||!this._customPop.find(".e-sortdirect").hasClass("e-spanclicked"))&&this.model.allowMultiSorting&&(rt=u.offset(),this._customPop.removeAttr("style"),this._customPop.offset({left:rt.left,top:rt.top-this.getHeaderTable().find(".e-columnheader").height()-u.height()}).find(".e-sortdirect").show().end().find(".e-rowselect").hide().end().show());this.model.allowMultiSorting&&(i.ctrlKey||this._enableSortMultiTouch)&&(this.multiSortRequest=!0);i.shiftKey&&n.inArray(h,this.model.groupSettings.groupedColumns)==-1&&(this._removeSortedColumnFromCollection(h),this.multiSortRequest=!0,h=null,this.sortColumn(h,g));t.isNullOrUndefined(h)||this.sortColumn(h,g)}else if(u.hasClass("e-togglegroupbutton")&&this.model.allowGrouping)ut=u.parent().attr("ej-mappingname"),u.hasClass("e-togglegroup")&&this.groupColumn(ut),u.hasClass("e-toggleungroup")&&this.ungroupColumn(ut);else if((u.hasClass("e-filtericon")||u.hasClass("e-filteredicon")||u.hasClass("e-responsivefilterColDiv")||u.parent().hasClass("e-responsivefilterColDiv"))&&(h=u.parent().find(".e-headercelldiv").attr("ej-mappingname")||u.attr("ej-mappingname")||n(u.parent()).attr("ej-mappingname"),this._$prevFieldName=this._$curFieldName,currentColumn=this.getColumnByField(h),ft={True:this.localizedLabels.True,False:this.localizedLabels.False},this.model.allowFiltering)){if(o=this,this.model.filterSettings.filterType=="excel"&¤tColumn.filterType=="menu"&&n.inArray(currentColumn.type,this._menuColTypes)==-1?(this._renderFilters(currentColumn),this._menuColTypes.push(currentColumn.type)):(this.model.filterSettings.filterType=="menu"&¤tColumn.filterType=="excel"||this.model.filterSettings.filterType=="excel"&¤tColumn.filterType!="menu")&&n.inArray(currentColumn.type,this._excelColTypes)==-1&&(this._renderFilters(currentColumn),this._excelColTypes.push(currentColumn.type)),n.each(this.model.columns,function(n,t){t.field==h&&(o._$colType=t.type,o._$curFieldName=t.field,o._$colFormat=t.format,o._$filterType=t.filterType,o._$colForeignKeyField=t.foreignKeyField?t.foreignKeyField:t.field,o._$colForeignKeyValue=t.foreignKeyValue,o._$colDropdownData=t.dataSource)}),(this.model.filterSettings.filterType=="menu"&&this._$filterType!="excel"||this.model.filterSettings.filterType=="excel"&&this._$filterType=="menu")&&(f="#"+this._id+"_"+this._$colType+"Dlg",this._$menuDlgIsOpen=!0,this._$colType=="string"?this._$colForeignKeyValue&&this._$colDropdownData?n("#"+this._id+"_acString").ejAutocomplete({fields:{text:o._$colForeignKeyValue,key:o._$colForeignKeyField},dataSource:o._$colDropdownData}):n("#"+this._id+"_acString").ejAutocomplete({fields:{text:o._$curFieldName,key:this._getIdField()},dataSource:this._dataSource()}):this._$colType=="date"?this._$colFormat!=r?(this._$colFormat=this._$colFormat.replace("{0:","").replace("}",""),n(f).find(".e-datewidget .e-datepicker").ejDatePicker({dateFormat:this._$colFormat.replace("{0:","").replace("}","")})):n(f).find(".e-datewidget .e-datepicker").ejDatePicker({dateFormat:t.preferredCulture(this.model.locale).calendars.standard.patterns.d}):this._$colType=="datetime"&&(this._$colFormat!=r&&(this._$colFormat=this._$colFormat.replace("{0:","").replace("}",""),n(f).find(".e-datetimewidget input").ejDateTimePicker({dateFormat:this._$colFormat.replace("{0:","").replace("}","")})),this._setFilterFieldValues(f))),this._mediaStatus=document.documentElement.clientWidth<768,this.model.isResponsive&&this._mediaStatus){var e=this,l=t.buildTag("div.e-resFilterDialogHeaderDiv"),wt=t.buildTag("div.labelRes","<span>Filter<\/span>");n(".e-filterMenuBtn").length>0&&n(".e-filterMenuBtn").remove();var et=t.buildTag("div.e-filterMenuBtn"),b=t.buildTag("input.e-resposnsiveFilterBtnLeft e-flat e-btnsub"),p=t.buildTag("input.e-resposnsiveFilterBtnRight e-flat e-btncan");if(l.append(wt),l.css("width","100%"),s=n(f).css("padding-left","0px"),u.parent().hasClass("e-responsivefilterColDiv")&&u.hasClass("e-filternone"))o._fltrClrHandler(),u.remove(),n("#responsiveFilter").css("display","block");else if(this.element.css("display","none"),setTimeout(function(){n("#responsiveFilter").css("display","none");0}),this._isExcelFilter||this._$filterType=="excel"){if(this._excelDlg=f="#"+this._id+this._$colType+"_excelDlg",t.isNullOrUndefined(s.find(".e-resFilterDialogHeaderDiv")[0])){b.ejButton({text:"OK",type:"button",click:function(){e._responsiveFilterClose();e._excelFilter._openedFltr=n(e._excelDlg);e._excelFilter._fltrBtnHandler();e._setResponsiveFilterIcon()}});p.ejButton({text:"Cancel",type:"button",click:function(){n(f).css("display","none");o.element.css("display","block")}});n(f).children().not(".e-searchcontainer").remove();var kt=this._excelFilter,k=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"}),st=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"});k.click(function(t){n.proxy(e._closeDivIcon(t),this)});l.append(k.append(st));y=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:f.slice(1),gridEle:!0});nt=t.buildTag("span.e-icon e-resIcon e-responisveCustomFilter","",{},{closeDialogue:f.slice(1),gridEle:!0});y.click(function(t){n.proxy(e._closeDivIcon(t),this)});o._$colType!="boolean"&&l.append(y.append(nt));n(f).css("padding","0px");c=n(f).css("height",n(window).height()-2);c.css("width",n(window).width()-2);ht=c.find(".e-searchcontainer .e-searchbox").css("margin-top","10px");ht.children().css("margin-top","10px");var dt=c.find(".e-checkboxlist"),gt=n(window).width()*(97/100),ni=n(window).height()*(65/100);n(c.find(".e-searchcontainer")).addClass("e-resSearch");it=c.find(".e-resSearch .e-btncontainer").remove();it.find("input:first").css("width","45.6%");it.find("input:first").addClass("e-resposnsiveFilterBtnLeft");it.find("input:last").addClass("e-resposnsiveFilterBtnRight");c.find(".e-excelLabel").remove();pt=t.buildTag("div.e-excelLabel","Order Id",{"font-weight":"bold","margin-top":"10px"});ht=c.find(".e-searchcontainer");pt.insertAfter(c.find(".e-searchcontainer .e-searchbox"));c.prepend(l);n(f).append(et.append(b).append(p));dt.ejScroller({height:ni,width:gt}).ejScroller("refresh")}this._excelFilter.openXFDialog({field:h,enableResponsiveRow:!0,displayName:currentColumn.headerText,dataSource:this._dataSource(),query:lt,position:{X:v,Y:w},dimension:{height:n(window).height(),width:n(window).width()},cssClass:"resFilter",type:this._$colType,format:this._$colFormat,localizedStrings:ft});n(f).insertAfter(this.element);t.isNullOrUndefined(n(f).parents(".e-grid")[0])||n(f).remove();y.click(function(){var y,w,i,u,k,h,d,c,g,l,nt,tt,r,it,rt,a,v,s;n(e._excelDlg).css("display","none");y=n(window).height()-5;w=n(window).width();kt._openCustomFilter("equal");i=f=n("#"+e._id+e._$colType+"_CustomFDlg").addClass("e-responsviesExcelFilter");t.isNullOrUndefined(i.find(".e-resFilterDialogHeaderDiv")[0])&&(u=t.buildTag("div.e-resFilterDialogHeaderDiv"),k=t.buildTag("div.labelRes","<span>Custom Filter<\/span>"),u.append(k),h=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",openDialogue:e._excelDlg.slice(1)}),d=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",openDialogue:e._excelDlg.slice(1)}),h.click(function(){i.css("display","none");e.model.enableResponsiveRow?n("#responsiveFilter").css("display","block"):e.element.css("display","block")}),u.append(h.append(d)),c=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",gridEle:!0}),g=t.buildTag("span.e-icon e-resIcon e-responisveClose","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",gridEle:!0}),u.append(c.append(g)),c.click(function(){i.css("display","none");e.element.css("display","block")}),i.prepend(u),i.insertAfter(e.element),i.find(".e-dlgfields").css("width","100%"),l=i.find(".e-dlgfields:first").css("width","92%").css("margin-left","6%"),l.css("margin-top","4%"),nt=i.find(".e-dlgfields").find(".e-fieldset legend").text(),tt=t.buildTag("div.e-responsiveLabelDiv",nt,{"margin-left":"6%"}),tt.insertAfter(l),r=i.find(".e-dlgfields").find(".e-fieldset").find("table").css("width","61%"),i.find(".e-dlgfields").find(".e-fieldset").replaceWith(r),it=r.parent("div").addClass("e-responsiveExcelFilterFieldDiv"),rt=r.find(".e-dropdownlist"),r.find(".e-dropdownlist").each(function(t,i){var u=n(i).ejDropDownList("model.dataSource"),r=n(window).width()*(40/100);n(i).ejDropDownList("destroy").ejDropDownList({width:r,popupWidth:r+"px",dataSource:u})}),r.find(".e-autocomplete").each(function(t,i){var r=n(i).ejAutocomplete("model.dataSource"),u=n(window).width()*(40/100);n(i).ejAutocomplete("destroy").ejAutocomplete({width:u,dataSource:r.dataSource,fields:r.fields})}),r.find(".e-datepicker").each(function(t,i){var u=n(i).ejDatePicker("model.dataSource"),r=n(window).width()*(40/100);n(i).ejDatePicker("destroy").ejDatePicker({width:r})}),a=b.clone(),v=p.clone(),a.ejButton({text:"OK",type:"button",click:function(){e._excelFilter._openedFltr=i;e._excelFilter._fltrBtnHandler();i.hasClass("e-dlgcustom")&&i.ejDialog("close");e._setResponsiveFilterIcon();e.element.css("display","block")}}),v.ejButton({text:"Cancel",type:"button",click:function(){i.ejDialog("close");o.element.css("display","block")}}),i.append(et.clone().append(a).append(v)),s=i.find(".e-dlgfields .e-btncontainer").remove(),s.find("input:first").addClass("e-resposnsiveFilterBtnLeft"),s.find("input:first").css("width","45.6%"),s.find("input:last").addClass("e-resposnsiveFilterBtnRight"));e.element.css("display","none");i.ejDialog({enableModal:!1,height:y,width:w,position:{X:0,Y:0},enableResize:!1,showHeader:!1}).ejDialog("open")});ti=t.buildTag("div")}else at=this.model.enableResponsiveRow?"OK":"Filter",ot=this.model.enableResponsiveRow?"Cancel":"Clear",b.ejButton({text:at,type:"button",click:n.proxy(this._fltrBtnHandler,this)}),p.ejButton({text:ot,type:"button",click:function(){ot=="Clear"&&(o.element.css("display","block"),o._fltrClrHandler());n(f).css("display","none");p.hasClass("e-resposnsiveFilterBtnRight")&&o.element.css("display","block")}}),u.parent().hasClass("e-responsivefilterColDiv")&&u.hasClass("e-filternone")?(o._fltrClrHandler(),u.remove()):(s.addClass("e-resMenuFltr"),s.css("height",n(window).height()-1).css("width",n(window).width()-2),s.find(".e-operator").addClass("e-resFilterOperator"),s.find(".e-value").addClass("e-resFilterOperator"),bt=s.find(".e-dlgBtns").remove().addClass("e-filterMenuBtn"),s.append(et.append(b).append(p)),t.isNullOrUndefined(s.find(".e-resFilterDialogHeaderDiv")[0])&&(s.insertAfter(this.element),k=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"}),st=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"}),k.click(function(){s.css("display","none");e.model.enableResponsiveRow?n("#responsiveFilter").css("display","block"):e.element.css("display","block")}),l.append(k.append(st)),y=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:f.slice(1),gridEle:!0}),nt=t.buildTag("span.e-icon e-resIcon e-responisveClose","",{},{closeDialogue:f.slice(1),gridEle:!0}),y.click(function(){s.css("display","none");e.element.css("display","block")}),vt=n(s.find(".e-value").find("input:last")),o._$colType=="string"&&(tt=n(s.find(".e-value").find("input:last")).ejAutocomplete("model"),vt.ejAutocomplete("destroy").ejAutocomplete({enableDistinct:!0,dataSource:tt.dataSource,fields:tt.fields,width:tt.width,focusIn:function(){var n=this.element.closest(".e-filterDialoge").find(".e-dropdownlist");this.model.filterType=n.val()}})),l.append(y.append(nt)),s.prepend(l)),s.find(".e-responsiveLabelDiv").remove(),yt=t.buildTag("div.e-responsiveLabelDiv","",{"margin-left":"5%","font-size":"17px","margin-top":"5%"}).append(t.buildTag("span",this.getHeaderTextByFieldName(h),{"font-weight":"bold"})),yt.insertAfter(s.find(".e-resFilterDialogHeaderDiv")),s.fadeIn(100,function(){}))}else{n(f).hasClass("e-resMenuFltr")&&(n(f).remove(),this._renderFilterDialogs(),f="#"+this._id+"_"+this._$colType+"Dlg");n(f).ejDialog({position:{X:"",Y:""}});var oi=n(document).width(),a=document.documentElement.clientWidth<800?200:250,v=u.position().left+18,w=u.position().top+2,ii=n("#"+this._id).width();u.closest(".e-headercell").css("position")=="relative"&&(v=u.offset().left+15,w=u.offset().top+20);ct="e-filterdialoglarge";a=this._isExcelFilter&¤tColumn.filterType!="menu"&&!t.isNullOrUndefined(this._excelFilter._dialogContainer)?this._excelFilter._dialogContainer.width():a;var ri=this.element.offset().left+this.element.width()-u.offset().left,ui=a-ri,fi=u.offset().left-this.element.offset().left,ei=a-fi;u.offset().left+18+a>ii&&ui>ei&&(v=v-a);a==200&&(ct="");t.isNullOrUndefined(this._$colType)||(this.model.filterSettings.filterType=="menu"&&this._$filterType!="excel"||this.model.filterSettings.filterType=="excel"&&this._$filterType=="menu"?(v=v-n("#"+this._id).offset().left,w=w-n("#"+this._id).offset().top,n(f).ejDialog({position:{X:v,Y:w},width:a,cssClass:ct}).ejDialog("open")):this._excelFilter.openXFDialog({field:h,displayName:currentColumn.headerText,dataSource:this._dataSource(),query:lt,position:{X:v,Y:w},type:this._$colType,format:currentColumn.format,foreignKey:currentColumn.foreignKeyField,foreignKeyType:currentColumn.originalType,foreignKeyValue:currentColumn.foreignKeyValue,foreignDataSource:currentColumn.dataSource,localizedStrings:ft}))}this._setFilterFieldValues(f);this._$colType=="number"&¤tColumn.serverType!=r?n(f).find(".e-numerictextbox").ejNumericTextbox({width:"100%",decimalPlaces:0}):this._$colType=="number"&&n(f).find(".e-numerictextbox").ejNumericTextbox({width:"100%",decimalPlaces:2});this._$prevColType=this._$colType;this._$fDlgIsOpen=!0}},_responsiveFilterClose:function(){this.element.css("display","block")},_clickHandler:function(i){var r=n(i.target),o=n("[id$='ccDiv'].e-grid.e-columnChooser"),s,w=n("#"+this._id+"EditForm"),h,u,f,c,e,l,b,a,k,v,y,p,d,g;if(o.length)for(c=!0,e=0;e<o.length;e++)(r.parents(".e-ccButton").length||r.hasClass("e-ccButton"))&&(c=n(i.target).closest(".e-grid").attr("id")+"ccDiv"!=o[e].id),l=n("#"+o[e].id).ejDialog("instance"),l.isOpened()&&c&&(l.close(),n(".e-columnChoosertail").remove(),n(".e-columnChoosertailAlt").remove());if((!r.hasClass("e-button")||!(r.hasClass("e-disable")||r.prop("disabled")))&&r.closest(".e-grid").attr("id")===this._id&&!r.closest("#"+this._id+"EditForm").length){if(r.hasClass("e-rowcell")||r.closest("td").is(".e-rowcell")||r.hasClass("e-headercell")&&i.clientY-r.offset().top<r.height()/4||r.parents(".e-headercheckcelldiv").length){if(this._bulkEditCellDetails.cancelSave){this._bulkEditCellDetails.cancelSave=!1;return}if(this.model.editSettings.editMode=="batch"&&n.isFunction(n.validator)&&w.length&&w.validate().errorList.length>0)return;this.model.editSettings.editMode=="batch"&&this.element.focus();h=r.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0;b=r.closest(".e-rowcell").index()!=-1?r.closest(".e-rowcell").index():r.closest(".e-headercell").index()-this.model.groupSettings.groupedColumns.length;u=r.hasClass("e-rowcell")?r.index()-h:b-h;u=this.model.detailsTemplate!=null||this.model.childGrid!=null?u-1:u;this.model.scrollSettings.frozenColumns&&(r.closest(".e-movableheaderdiv").length||r.closest(".e-movablecontentdiv").length)&&(u=u+this.model.scrollSettings.frozenColumns);f=this.getIndexByRow(r.closest("tr"));this._bulkEditCellDetails.columnIndex=u;this._bulkEditCellDetails.rowIndex=f;this.model.allowSelection&&t.gridFeatures.selection&&(a=this._enableCheckSelect&&r.parent(".e-checkcelldiv").length?!0:!1,r.hasClass("e-checkselectall")&&(this._selectAllCheck=!0,k=this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling?this._gridRecordsCount:this.model.allowPaging?this.model.currentViewData.length:this._gridRows.length,this.selectRows(0,k-1,r)),this.model.selectionType=="multiple"&&((i.ctrlKey||this._enableSelectMultiTouch)&&(this.multiSelectCtrlRequest=!0),i.shiftKey&&(this.multiSelectShiftRequest=!0,this._allowcellSelection&&f>-1&&this.selectCells([[f,[u]]]),this._allowrowSelection&&f>-1&&(!this._enableCheckSelect||a)&&this.selectRows(this._previousIndex,this.getIndexByRow(r.closest("tr")),r),this._selectedRow(this.getIndexByRow(r.closest("tr"))),this._allowcolumnSelection&&r.hasClass("e-headercell")&&!r.hasClass("e-stackedHeaderCell")&&i.clientY-r.offset().top<r.height()/4&&this.selectColumns(this._previousColumnIndex,u)),i.pointerType=="touch"&&this._customPop!=null&&!this._customPop.is(":visible")&&this._customPop.find(".e-rowselect").hasClass("e-spanclicked")&&this.model.selectionSettings.selectionMode=="row"&&this._customPop.show(),i.pointerType=="touch"&&this._customPop!=null&&(this._customPop.find(".e-sortdirect").is(":visible")||!this._customPop.find(".e-rowselect").hasClass("e-spanclicked"))&&this.model.selectionType=="multiple"&&(this._customPop.removeAttr("style"),v=r.offset(),this._customPop.offset({top:0,left:0}).offset({left:v.left,top:v.top-this.getRowHeight()-r.height()}).find(".e-sortdirect").hide().end().find(".e-rowselect").show().end().show())),this.multiSelectShiftRequest||(this._allowcellSelection&&f>-1&&(y=this._checkCellSelectionByRow(f,u),(this.model.selectionSettings.enableToggle&&this.selectedRowCellIndexes.length==1&&this.selectedRowCellIndexes[0].cellIndex.length==1||i.ctrlKey&&this.model.selectionType=="multiple")&&y!=-1&&this.selectedRowCellIndexes.length>0&&this.selectedRowCellIndexes[0].cellIndex.length>0?this.clearCellSelection(y.rowIndex,u):this.selectCells([[f,[u]]])),this._allowrowSelection&&f>-1&&(p=this.getIndexByRow(r.closest("tr")),this._enableCheckSelect&&(this.multiSelectCtrlRequest=!0),this.model.scrollSettings.enableVirtualization&&(d=f%this._virtualRowCount,g=parseInt(n(r).closest("tr").attr("name"),32),p=g*this._virtualRowCount-(this._virtualRowCount-d)),(!this._enableCheckSelect||a)&&(this.model.selectionSettings.enableToggle&&!this._enableCheckSelect&&this.getSelectedRecords().length==1&&n.inArray(this.getIndexByRow(r.closest("tr")),this.selectedRowsIndexes)!=-1?this.clearSelection(p):this.selectRows(this.getIndexByRow(r.closest("tr")),null,r)),!this._enableCheckSelect||i.ctrlKey||this._enableSelectMultiTouch||(this.multiSelectCtrlRequest=!1)),this._allowcolumnSelection&&r.hasClass("e-headercell")&&!r.hasClass("e-stackedHeaderCell")&&i.clientY-r.offset().top<r.height()/4&&(this.model.selectionSettings.enableToggle&&this.selectedColumnIndexes.length==1&&n.inArray(u,this.selectedColumnIndexes)!=-1?this.clearColumnSelection(u):this.selectColumns(u)),this.multiSelectCtrlRequest=!1),this.multiSelectShiftRequest=!1);s=this._bulkEditCellDetails.columnIndex>=0?this.model.columns[this._bulkEditCellDetails.columnIndex].field:null;r.closest(".e-rowcell").length&&!t.isNullOrUndefined(s)&&(this._tabKey=!1,this.model.editSettings.allowEditing&&this.model.editSettings.editMode==t.Grid.EditMode.Batch&&this.editCell(n.inArray(r.closest("tr").get(0),this._excludeDetailRows()),s))}(r.hasClass("e-rowselect")||r.hasClass("e-sortdirect"))&&(r.hasClass("e-spanclicked")?(r.removeClass("e-spanclicked"),r.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!1),r.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!1),this._customPop.hide()):(r.addClass("e-spanclicked"),r.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!0),r.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!0)));this._selectAllCheck=!1;t.gridFeatures.common&&this.expandCollapse(r);r.is(".e-filtericon")&&r.closest(".e-detailrow").length!=0&&i.preventDefault();this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this._isExcelFilter)&&!r.is(".e-filtericon")&&r.closest(".e-dlgcontainer").length!=1&&this._closeFDialog();this.model.allowSearching&&this._searchBar!=null&&(r.is(this._searchBar.find(".e-cancel"))?this._searchBar.find("input").val(""):i.target.id==this._id+"_searchbar"?this._searchBar.find(".e-cancel").removeClass("e-hide"):this._searchBar.find(".e-cancel").hasClass("e-hide")||this._searchBar.find(".e-cancel").addClass("e-hide"))}},_checkCellSelectionByRow:function(t,i){for(var r=0;r<this.selectedRowCellIndexes.length;r++)if(this.selectedRowCellIndexes[r].rowIndex==t)break;return r!=this.selectedRowCellIndexes.length&&n.inArray(i,this.selectedRowCellIndexes[r].cellIndex)!=-1?this.selectedRowCellIndexes[r]:-1},_persistState:function(n){this.model.enablePersistence&&this._isHeightResponsive&&(n._isHeightResponsive=this._isHeightResponsive)},_restoreState:function(n){this.model.enablePersistence&&n._isHeightResponsive&&(this._isHeightResponsive=n._isHeightResponsive)},_destroy:function(){var u,e,t,f,i,r;if(this.element.off(),this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").add(this.element.find(".e-gridcontent").find(".e-content,.e-movablecontent")).off("scroll"),u=n("#"+this._id+"EditForm"),u.length){for(e=u.find(".e-field"),f=0;f<e.length;f++)t=n(e[f]),t.hasClass("e-datetimepicker")?t.ejDateTimePicker("destroy"):t.hasClass("e-datepicker")?t.ejDatePicker("destroy"):t.hasClass("e-dropdownlist")&&t.ejDropDownList("destroy");u.remove()}this._confirmDialog&&this._confirmDialog.ejDialog("destroy");this.element.find(".e-dropdownlist").ejDropDownList("model.dataSource",[]);this.model.showColumnChooser&&(n("#"+this._id+"ccDiv").ejDialog("destroy"),n("#"+this._id+"ccDiv").remove(),n("#"+this._id+"_ccTail").remove(),n("#"+this._id+"_ccTailAlt").remove());this.model.allowFiltering&&this.model.filterSettings.filterType=="excel"&&this._excelFilter.resetExcelFilter();this.model.allowReordering&&n(".e-columndropindicator").remove();this.model.allowFiltering&&this.model.filterSettings.filterType=="menu"&&(i=this,n.each(this.model.columns,function(t,u){r=u.type;n("#"+i._id+r+"_ddinput_popup_wrapper").remove();r=="string"?n("#"+i._id+"_stringDlg").find(".e-autocomplete").ejAutocomplete("destroy"):r=="date"?n("#"+i._id+"_dateDlg").find(".e-datepicker").ejDatePicker("destroy"):r=="datetime"?n("#"+i._id+"_datetimeDlg").find(".e-datetimepicker").ejDateTimePicker("destroy"):r=="number"&&n("#"+i._id+"_numberDlg").find(".e-numerictextbox").ejNumericTextbox("destroy")}));this._$onresize&&n(window).off("resize",this._$onresize);this.element.empty().removeClass("e-grid "+this.model.cssClass);this.element.ejWaitingPopup("destroy");this.model.contextMenuSettings.enableContextMenu&&(n("#"+this._id+"_Context").ejMenu("destroy"),n("#"+this._id+"_Context").remove())},_getDeprecatedLocalizedLabel:function(n){if(["OkButton","OKButton"].indexOf(n)!=-1)return this.localizedLabels.OkButton||this.localizedLabels.OKButton},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.gridFeatures.common&&n.extend(t.Grid.prototype,t.gridFeatures.common);t.gridFeatures.edit&&n.extend(t.Grid.prototype,t.gridFeatures.edit);t.gridFeatures.filter&&n.extend(t.Grid.prototype,t.gridFeatures.filter);t.gridFeatures.group&&n.extend(t.Grid.prototype,t.gridFeatures.group);t.gridFeatures.selection&&n.extend(t.Grid.prototype,t.gridFeatures.selection);t.gridFeatures.sort&&n.extend(t.Grid.prototype,t.gridFeatures.sort);t.gridFeatures.dragAndDrop&&n.extend(t.Grid.prototype,t.gridFeatures.dragAndDrop);t.Grid.Locale=t.Grid.Locale||{};t.Grid.Locale["default"]=t.Grid.Locale["en-US"]={EmptyRecord:"No records to display",GroupDropArea:"Drag a column header here to group its column",DeleteOperationAlert:"No records selected for delete operation",EditOperationAlert:"No records selected for edit operation",SaveButton:"Save",OKButton:"OK",CancelButton:"Cancel",EditFormTitle:"Details of ",AddFormTitle:"Add New Record",GroupCaptionFormat:"{{:headerText}}: {{:key}} - {{:count}} {{if count == 1 }} item {{else}} items {{/if}} ",BatchSaveConfirm:"Are you sure you want to save changes?",BatchSaveLostChanges:"Unsaved changes will be lost. Are you sure you want to continue?",ConfirmDelete:"Are you sure you want to Delete Record?",CancelEdit:"Are you sure you want to Cancel the changes?",PagerInfo:"{0} of {1} pages ({2} items)",FrozenColumnsViewAlert:"Frozen columns should be in grid view area",FrozenColumnsScrollAlert:"Enable allowScrolling while using frozen Columns",FrozenNotSupportedException:"Frozen Columns and Rows are not supported for Grouping, Row Template, Detail Template, Hierarchy Grid and Batch Editing",Add:"Add",Edit:"Edit",Delete:"Delete",Update:"Update",Cancel:"Cancel",Done:"Done",Columns:"Columns",SelectAll:"(Select All)",PrintGrid:"Print",ExcelExport:"Excel Export",WordExport:"Word Export",PdfExport:"PDF Export",StringMenuOptions:[{text:"StartsWith",value:"StartsWith"},{text:"EndsWith",value:"EndsWith"},{text:"Contains",value:"Contains"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],NumberMenuOptions:[{text:"LessThan",value:"LessThan"},{text:"GreaterThan",value:"GreaterThan"},{text:"LessThanOrEqual",value:"LessThanOrEqual"},{text:"GreaterThanOrEqual",value:"GreaterThanOrEqual"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],PredicateAnd:"AND",PredicateOr:"OR",Filter:"Filter",FilterMenuCaption:"Filter Value",FilterbarTitle:"'s filter bar cell",MatchCase:"Match Case",Clear:"Clear",ResponsiveFilter:"Filter",ResponsiveSorting:"Sort",Search:"Search",DatePickerWaterMark:"Select date",NumericTextBoxWaterMark:"Enter value",EmptyDataSource:"DataSource must not be empty at initial load since columns are generated from dataSource in AutoGenerate Column Grid",ForeignKeyAlert:"The updated value should be a valid foreign key value",True:"true",False:"false",UnGroup:"Click here to ungroup",AddRecord:"Add Record",EditRecord:"Edit Record",DeleteRecord:"Delete Record",Save:"Save",Grouping:"Group",Ungrouping:"Ungroup",SortInAscendingOrder:"Sort In Ascending Order",SortInDescendingOrder:"Sort In Descending Order",NextPage:"Next Page",PreviousPage:"Previous Page",FirstPage:"First Page",LastPage:"Last Page",EmptyRowValidationMessage:"Atleast one field must be updated",NoResult:"No Matches Found"};t.Grid.Actions={Paging:"paging",Sorting:"sorting",Filtering:"filtering",BeginEdit:"beginedit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Grouping:"grouping",Ungrouping:"ungrouping",Refresh:"refresh",Reorder:"reorder",Search:"searching",BatchSave:"batchsave",VirtualScroll:"virtualscroll"};t.Grid.SummaryType={Average:"average",Minimum:"minimum",Maximum:"maximum",Count:"count",Sum:"sum",TrueCount:"truecount",FalseCount:"falsecount",Custom:"custom"};t.Grid.EditMode={Normal:"normal",Dialog:"dialog",DialogTemplate:"dialogtemplate",Batch:"batch",ExternalForm:"externalform",ExternalFormTemplate:"externalformtemplate",InlineForm:"inlineform",InlineTemplateForm:"inlineformtemplate"};t.Grid.PrintMode={AllPages:"allpages",CurrentPage:"currentpage"};t.Grid.ResizeMode={NextColumn:"nextcolumn",Control:"control",Normal:"normal"};t.Grid.Rowposition={Top:"top",Bottom:"bottom"};t.Grid.FormPosition={BottomLeft:"bottomleft",TopRight:"topright"};t.Grid.ClipMode={Ellipsis:"ellipsis",Clip:"clip",EllipsisWithTooltip:"ellipsiswithtooltip"};t.Grid.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker"};t.Grid.UnboundType={Edit:"edit",Save:"save",Delete:"delete",Cancel:"cancel"};t.Grid.ToolBarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",Search:"search",PrintGrid:"printGrid",ExcelExport:"excelExport",WordExport:"wordExport",PdfExport:"pdfExport"};t.Grid.FilterType={Menu:"menu",FilterBar:"filterbar",Excel:"excel"};t.Grid.FilterBarMode={Immediate:"immediate",OnEnter:"onenter"};t.Grid.SelectionType={Single:"single",Multiple:"multiple"};t.Grid.ColumnLayout={Auto:"auto",Fixed:"fixed"};t.Grid.GridLines={Both:"both",None:"none",Horizontal:"horizontal",Vertical:"vertical"};t.Grid.VirtualScrollMode={Normal:"normal",Continuous:"continuous"};t.Grid.SelectionMode={Row:"row",Cell:"cell",Column:"column"};t.Grid.WrapMode={Both:"both",Content:"content",Header:"header"};t.Grid.exportAll=function(n,i){t.Grid.prototype["export"](n,null,!0,i)};t.SqlDataSourceAdaptor=(new t.UrlAdaptor).extend({init:function(){this.initialRender=!0},processQuery:function(n,i,r){var h=t.UrlAdaptor.prototype.processQuery(n,i,r),u=t.parseJSON(h.data),e={},f,o,s,c;if(u.param)for(f=0;f<u.param.length;f++)o=u.param[f],s=Object.keys(o)[0],e[s]=o[s];return e.value=u,c=JSON.stringify({type:"SqlData",args:u}),this.initialRender==!1&&__doPostBack("",c),this.initialRender=!1,{data:JSON.stringify(e),result:n.dataSource.json,ejPvtData:h.ejPvtData,count:n.dataSource.json.length}},processResponse:function(n,i,u,f,e){var h=n.ejPvtData||{},l=n.groupDs,v,a,s,o,w;if(f&&f.getResponseHeader("Content-Type")&&f.getResponseHeader("Content-Type").indexOf("xml")!=-1&&n.nodeType==9)return u._requiresCount?{result:[],count:0}:[];if(v=JSON.parse(n.data),v&&v.action==="batch"&&n.added)return e.added=n.added,e;if(h&&h.aggregates&&h.aggregates.length){var c=h.aggregates,s={},y,p={};for(("count"in n)&&(s.count=n.count),n.result&&(s.result=n.result),n.aggregate&&(n=n.aggregate),o=0;o<c.length;o++)y=t.aggregates[c[o].type],y&&(p[c[o].field+" - "+c[o].type]=y(n,c[o].field));s.aggregates=p;n=s}if(h&&h.groups&&h.groups.length){for(a=h.groups,s={},("count"in n)&&(s.count=n.count),n.aggregates&&(s.aggregates=n.aggregates),n.result&&(n=n.result),o=0;o<a.length;o++)w=null,t.isNullOrUndefined(l)||(l=t.group(l,a[o])),n=t.group(n,a[o],h.aggregates,w,l);return s.count!=r?s.result=n:s=n,s}return n}})}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.gridResize=function(t){this.$headerTable=t.getHeaderTable();this.gridInstance=t;this._colMinWidth=15;this._$visualElement=n();this._currentCell=-1;this._allowStart=!1;this._oldWidth=null;this._orgX=null;this._orgY=null;this._extra=null;this._expand=!1;this._target=null;this._cellIndex=-1};t.gridFeatures.gridResize.prototype={_mouseHover:function(t){var r,h,o,c,s;if(!this._$visualElement.is(":visible")&&(this._allowStart=!1,n(t.target).is(".e-headercelldiv")&&(t.target=t.target.parentNode),r=n(t.target),n(t.target).hasClass("e-filtericon")&&(n(t.target).css("cursor")=="col-resize"||n(t.target).closest("tr").css("cursor")=="col-resize")&&(n(t.target).css("cursor","pointer"),n(t.target).closest("tr").css("cursor","pointer")),r.hasClass("e-headercell"))){var f=t.target,u=f.getBoundingClientRect(),i=0,e=0;(t.type="mousemove")?(i=t.clientX,e=t.clientY):(t.type="touchmove")?(i=evt.originalEvent.changedTouches[0].clientX,e=evt.originalEvent.changedTouches[0].clientY):(t.type="MSPointerMove")&&(i=t.originalEvent.clientX,e=t.originalEvent.clientY);h=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.getHeaderContent().width()+this.gridInstance.element.children(".e-gridheader").find(".e-columnheader").offset().left:this.gridInstance.getHeaderTable().width()+this.gridInstance.element.children(".e-gridheader").find(".e-columnheader").offset().left;(i>=u.left+document.documentElement.scrollLeft+f.offsetWidth-5||i<=u.left+3)&&i<h&&i>=u.left&&e<=u.top+document.documentElement.scrollTop+t.target.offsetHeight?(o=i>u.left+3?n(t.target).find(".e-headercelldiv"):n(t.target).prevAll("th:visible:first").find(".e-headercelldiv"),c=window.pageXOffset||document.documentElement.scrollTop||document.body.scrollTop,s=this.gridInstance.element.find(".e-headercell").not(".e-detailheadercell").offset().left+10-c,(this.gridInstance.model.enableRTL&&i<=s||!this.gridInstance.model.enableRTL&&i>=s)&&((this.gridInstance.model.showStackedHeader||o.length)&&n.inArray(n(o).attr("ej-mappingname"),this.gridInstance._disabledResizingColumns)==-1?(this.gridInstance.model.showStackedHeader&&n(r.parents("thead")).find("tr").css("cursor","col-resize"),this.gridInstance.model.showStackedHeader||r.parent().css("cursor","col-resize"),this._currentCell=n(t.target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell:visible").index(f):this.gridInstance.getHeaderContent().find(".e-headercell:visible").not(".e-stackedHeaderCell,.e-detailheadercell").index(f),this.gridInstance.model.enableRTL&&(this._currentCell=this._currentCell-1),this._allowStart=!0):(r.parent().css("cursor","pointer"),this._currentCell=-1))):(this.gridInstance.element.find(".e-columnheader").css("cursor","pointer"),this._currentCell=-1)}},_start:function(t,i){var o=this.gridInstance.getHeaderTable().find(".e-columnheader"),s,f,r,h,e,u;if(f=n(this._target).hasClass("e-stackedHeaderCell")?o.find(".e-headercell").not(".e-hide"):o.find(".e-headercell").not(".e-stackedHeaderCell,.e-hide"),this._currentCell!=-1&&this._currentCell<f.length&&(r=f[this._currentCell]),typeof r!="undefined")if(h=r.getBoundingClientRect(),s=this._tableY=h.top+parseInt(navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollTop:document.documentElement.scrollTop),this._allowStart){if(e=this._$visualElement=n(document.createElement("div")),_height=this.gridInstance.element.find(".e-gridcontent").first().height()+this.gridInstance.element.find(".e-gridheader").height(),this.gridInstance.model.showStackedHeader&&this.gridInstance.model.stackedHeaderRows.length>0){var c=this.gridInstance.getHeaderTable().find("tr.e-columnheader"),a=c.length,l=n(this._target).parent("tr")[0].rowIndex;for(u=0;u<l;u++)_height=_height-n(c[u]).height()}e.addClass("e-reSizeColbg").appendTo(this.gridInstance.element).attr("unselectable","on").css("visibility","hidden");this.gridInstance._resizeTimeOut=setTimeout(function(){e.css({visibility:"visible",height:_height+"px",cursor:"col-resize",left:t,top:s,position:"fixed"})},100);this._oldWidth=r.offsetWidth;this._orgX=t;this._orgY=i;this._extra=t-this._orgX;this._expand=!0}else this._currentCell=-1},_mouseMove:function(n){if(this._expand){var t=0,i=0;(n.type="mousemove")?(t=n.clientX,i=n.clientY):(n.type="touchmove")?(t=evt.originalEvent.changedTouches[0].clientX,i=evt.originalEvent.changedTouches[0].clientY):(n.type="MSPointerMove")&&(t=n.originalEvent.clientX,i=n.originalEvent.clientY);navigator.userAgent.indexOf("WebKit")!=-1&&(t=n.pageX,i=n.pageY);t+=document.documentElement.scrollLeft;n.preventDefault();this._moveVisual(t)}else this._mouseHover(n)},_getCellIndex:function(t){var o=n(t._target),i=t._target,f=i.getBoundingClientRect(),e=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,r,u;return this._orgX<f.left+5+e&&(i=n(i).prevAll(":visible:first")[0]),r=i.cellIndex,u=r,t.gridInstance.model.groupSettings.groupedColumns.length&&(u=r-t.gridInstance.model.groupSettings.groupedColumns.length),u},_reSize:function(i){var ti=this,s,a,g,v,d,ht,h,nt,f,tt,y,l,rt,w,k,r,ot;if(this._initialTableWidth=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.getHeaderTable().first().parent().width()+this.gridInstance.getHeaderTable().last().parent().width():this.gridInstance.getHeaderTable().parent().width(),this.gridInstance.model.enableRTL&&(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell=this._currentCell-1:this.gridInstance.model.enableRTL||this._getResizableCell(),a=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?this.gridInstance.getHeaderTable().find("thead"):n(this._target).parents("thead"),this._currentCell!=-1&&this._expand){this._expand=!1;var dt=n(this._target).hasClass("e-stackedHeaderCell")?a.find(".e-headercell:not(.e-detailheadercell)").filter(":visible"):a.find(".e-headercell:not(.e-detailheadercell,.e-stackedHeaderCell)").filter(":visible"),st=dt[this._currentCell],c=st.offsetWidth,u=i-this._orgX;if(this.gridInstance.model.enableRTL&&(u=-u),parseInt(u)+parseInt(c)>this._colMinWidth){if(u!=0&&a.css("cursor","default"),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"&&(g=this.gridInstance.getHeaderTable().find("colgroup").find("col"),t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),g=this.gridInstance._$headerCols),v=g.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length),d=v.width()),this._resizeColumnUsingDiff(c,u),s=this.gridInstance.element.find(".e-gridcontent").first(),ht=s.find("div").hasClass("e-content"),h=!t.isIOSWebView()&&this.gridInstance.getBrowserDetails(),h&&h.browser=="msie"&&this.gridInstance.model.allowScrolling&&(nt=this.gridInstance.getContentTable().width(),f=this.gridInstance._calculateWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?(this.gridInstance.getHeaderTable().last().width(f-this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()),this.gridInstance.getContentTable().last().width(f-this.gridInstance.getContent().find(".e-frozencontentdiv").width()),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().last().width(f-this.gridInstance.getFooterContent().find(".e-frozenfootertdiv").width())):f>nt&&(this.gridInstance.getHeaderTable().width(f),this.gridInstance.getContentTable().width(f),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().width(f)),parseInt(h.version,10)>8&&this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length&&(f>nt?(this.gridInstance.getContentTable().width(f),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",2e3/s.find("table").first().width()+"%")):(this.gridInstance.getContentTable().css("width","100%"),this.gridInstance._groupingAction(!0),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",(this.gridInstance.getHeaderTable().find("colgroup").find("col").first().width()/s.find("table").first().width()*100).toFixed(2)+"%"))),this.gridInstance.getHeaderTable().parent().scrollLeft(s.find(".e-content").scrollLeft()-1)),this.gridInstance._colgroupRefresh(),this.gridInstance.model.allowTextWrap&&this.gridInstance.rowHeightRefresh(),this.gridInstance.model.groupSettings.groupedColumns.length&&!this.gridInstance.model.isEdit&&this.gridInstance._recalculateIndentWidth(),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)!="normal")if(t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"){tt=this.gridInstance.getHeaderTable().find("colgroup").find("col");y=this.gridInstance.getContentTable().find("colgroup").find("col");t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),tt=this.gridInstance._$headerCols,y=this.gridInstance._$contentCols);var e=this._currentCell+1,ct=tt.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)?e:e+this.gridInstance.model.groupSettings.groupedColumns.length),o=ct.width()+(d-v.width());if(o<this._colMinWidth&&(o=this._colMinWidth),ct.width(o),this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length){var lt=this.gridInstance.getContentTable().find(".e-recordtable"),p=lt.find("colgroup"),at=this.gridInstance.getVisibleColumnNames().length;for(this.gridInstance.getContentTable().find(".e-detailrow").length&&(p=p.not(lt.find(".e-detailrow").find("colgroup")).get()),r=0;r<p.length;r++)l=n(p[r]).find("col").filter(this._diaplayFinder),l.length>at&&l.splice(0,l.length-at),n(l[e]).width(o)}if(this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){if(e>=0&&e<this.gridInstance.model.scrollSettings.frozenColumns&&this._getFrozenResizeWidth()+u>this.gridInstance.element.find(".e-headercontent").first().width())return;$ContentCol=y.filter(this._diaplayFinder).eq(e)}else $ContentCol=y.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)?e:e+this.gridInstance.model.groupSettings.groupedColumns.length);if($ContentCol.width(o),this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings.frozenColumns>0&&n(st).is(":last-child")&&this.gridInstance.pluginName=="ejGrid"){var it=v.width()-d,vt=this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()+it,yt=this.gridInstance.getHeaderContent().find(".e-movableheaderdiv").width()-it,pt=parseInt(this.gridInstance.getHeaderContent().find(".e-movableheader")[0].style["margin-left"])+it;this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(vt);this.gridInstance.getContent().find(".e-frozencontentdiv").width(vt);this.gridInstance.getHeaderContent().find(".e-movableheaderdiv").width(yt);this.gridInstance.getContent().find(".e-movablecontentdiv").width(yt);this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",pt);this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",pt)}this.gridInstance.model.scrollSettings.frozenColumns>0&&n(this._target).parent("tr").parents("div:first").hasClass("e-frozenheaderdiv")&&(this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(this._newWidth),this.gridInstance.getContent().find(".e-frozencontentdiv").width(this._newWidth))}else this.gridInstance.model.scrollSettings.frozenColumns||(rt=this.gridInstance.getHeaderTable().width(),this.gridInstance.getHeaderTable().css("width",rt+parseInt(u)),this.gridInstance.getContentTable().css("width",rt+parseInt(u)),this.gridInstance.model.scrollSettings.width+=parseInt(u),this.gridInstance.getContent().width()>this.gridInstance.getContentTable().width()?(this.gridInstance.getContentTable().addClass("e-tableLastCell"),this.gridInstance.getHeaderTable().addClass("e-tableLastCell")):(this.gridInstance.getContentTable().removeClass("e-tableLastCell"),this.gridInstance.getHeaderTable().removeClass("e-tableLastCell")));if(h.browser=="msie"||!h||!this.gridInstance.model.allowScrolling||this.gridInstance.model.scrollSettings.frozenColumns!=0||(this.gridInstance.getHeaderTable().width("100%"),this.gridInstance.getContentTable().width("100%"),w=this.gridInstance._calculateWidth(),(w<=this.gridInstance.getContentTable().width()||this.gridInstance.getHeaderTable().width()>this.gridInstance.getContentTable().width())&&(this.gridInstance.getHeaderTable().width(w),this.gridInstance.getContentTable().width(w))),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="default"){var wt=this._currentCell,ut=n(this._target),bt=[],kt=[],o=c+u,ft={};if(this.gridInstance.model.showStackedHeader&&ut.hasClass("e-stackedHeaderCell")){var gt=ut.parent(".e-stackedHeaderRow").index(),ni=ut.text(),et=this.gridInstance.model.stackedHeaderRows[gt].stackedHeaderColumns,b;for(r=0;r<et.length;r++)et[r].headerText==ni&&(b=et[r].column);for(k=b,b instanceof Array||(k=b.split(",")),r=0;r<k.length;r++)ot=this.gridInstance.getColumnIndexByField(k[r]),bt.push(ot),kt.push(this.gridInstance.model.columns[ot]);ft={columnIndex:bt,column:kt,oldWidth:c,newWidth:o}}else ft={columnIndex:wt,column:this.gridInstance.model.columns[wt],oldWidth:c,newWidth:o};this.gridInstance._trigger("resized",ft)}this.gridInstance.model.allowScrolling&&(this.gridInstance.getScrollObject().refresh(this.gridInstance.model.scrollSettings.frozenColumns>0),this.gridInstance.model.isResponsive&&this.gridInstance.model.minWidth&&this.gridInstance.windowonresize(),!ht&&s.find("div").hasClass("e-content")&&this.gridInstance.refreshScrollerEvent(),this.gridInstance._isHscrollcss())}}this._target=null;this._$visualElement.remove();this._expand=!1;this._currentCell=-1;this._allowStart=!1},_getFrozenResizeWidth:function(){for(var t=this.gridInstance.getHeaderTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),i=0,n=0;n<t.length;n++)t.eq(n).css("display")!="none"&&(i+=parseInt(t[n].style.width.replace("px","")));return i},_diaplayFinder:function(){return n(this).css("display")!="none"},_resizeColumnUsingDiff:function(i,r){var vt=this,a,h,v,e,y,nt,r,c,p,o,w,b,tt,at,it,u,l,rt,st,ht,ct,k,f,ut;this._currntCe=this._currentCell;h=this.gridInstance.getHeaderTable().find("colgroup").find("col");v=this.gridInstance.getContentTable().find("colgroup").find("col");t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),h=this.gridInstance._$headerCols,v=this.gridInstance._$contentCols);var s=h.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length),d,ft,yt=h.slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),g=s[0].style.width,et=g.indexOf("%")!=-1,ot=!g||et?n(this._target).outerWidth():g,lt=et?1:i/parseInt(ot);if(a=r=r/lt,e=this._newWidth=parseInt(r)+parseInt(ot),e>0&&r!=0){if(e<this._colMinWidth&&(e=this._colMinWidth),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"&&(y=s.next(),nt=this.gridInstance.model.scrollSettings.frozenColumns&&this._currentCell==this.gridInstance.model.scrollSettings.frozenColumns-1?!0:!1,nt&&(y=h.eq(this.gridInstance.model.scrollSettings.frozenColumns)),(nt||!s.is(":last-child"))&&y.width()+(s.width()-e)<=this._colMinWidth&&(e=s.width()+(y.width()-this._colMinWidth))),r=e-i,this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){if(this._currentCell>=0&&this._currentCell<this.gridInstance.model.scrollSettings.frozenColumns&&this._getFrozenResizeWidth()+r>this.gridInstance.element.find(".e-headercontent").first().width())return;d=v.filter(this._diaplayFinder).eq(this._currentCell)}else d=v.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length);if(this.gridInstance.model.showSummary&&(this._$footerCols=this.gridInstance.getFooterTable().find("colgroup").find("col"),c=this.gridInstance.model.columns.length,this._$footerCols.length>c&&this._$footerCols.splice(0,this._$footerCols.length-c),$footerCols=this._$footerCols,ft=$footerCols.filter(this._diaplayFinder).eq(this._currentCell),ft.outerWidth(e)),n(this._target).parent("tr").hasClass("e-stackedHeaderRow")?this._resizeStackedHeaderColumn(n(this._target).parent("tr"),a,this._currntCe):s.outerWidth(e),n(this._target).parent("tr").hasClass("e-stackedHeaderRow")){if(this.gridInstance.model.groupSettings.groupedColumns.length)for(p=this.gridInstance.getContentTable().find(".e-recordtable"),o=p.find("colgroup"),u=0;u<this._changedcell.length;u++)for(w=this._changedcell[u],b=0;b<o.length;b++)tt=n(o[b]).children().filter(this._diaplayFinder),f=parseInt(a)+parseInt(tt[w].style.width),f<this._colMinWidth&&(f=this._colMinWidth),n(tt[w]).width(f);for(at=this.gridInstance.getContentTable().find("colgroup").find("col").filter(this._diaplayFinder).length,u=0;u<this._changedcell.length;u++)it=this.gridInstance.getContentTable().find("colgroup").find("col").filter(this._diaplayFinder)[this._changedcell[u]],f=parseInt(a)+parseInt(it.style.width),f<this._colMinWidth&&(f=this._colMinWidth),n(it).outerWidth(f),this.gridInstance.model.isEdit&&this.gridInstance.model.allowGrouping&&this.gridInstance.model.groupSettings.groupedColumns.length==0&&($sEditCol=this.gridInstance.getContentTable().find(".gridform").find("colgroup col").filter(this._diaplayFinder)[this._changedcell[u]],n($sEditCol).outerWidth(f))}else{if(this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length){var p=this.gridInstance.getContentTable().find(".e-recordtable"),o=p.find("colgroup"),w=this._currentCell,c=this.gridInstance.getVisibleColumnNames().length;for(this.gridInstance.getContentTable().find(".e-detailrow").length&&(o=o.not(p.find(".e-detailrow").find("colgroup")).get()),u=0;u<o.length;u++)l=n(o[u]).find("col").filter(this._diaplayFinder),l.length>c&&l.splice(0,l.length-c),n(l[w]).width(e)}d.outerWidth(e);this.gridInstance.model.isEdit&&(rt=this.gridInstance.getContentTable().find(".e-editedrow,.e-addedrow"),st=rt.find("table").find("colgroup col"),ht=rt.hasClass("e-addedrow")&&this.gridInstance.model.groupSettings.groupedColumns.length?this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length-1:this._currentCell,ct=st.filter(this._diaplayFinder).eq(ht),ct.outerWidth(e))}if(this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns&&t.getObject("resizeSettings.resizeMode",this.gridInstance.model)!="nextcolumn"&&this.gridInstance.pluginName=="ejGrid"){for(k=this.gridInstance.getContentTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings.frozenColumns),f=0,u=0;u<k.length;u++)f+=k[u].style.display=="none"?0:parseInt(k[u].style.width.replace("px",""));this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(f);ut=this.gridInstance.model.enableRTL?"margin-right":"margin-left";this.gridInstance.getContent().find(".e-frozencontentdiv").width(f).next().css(ut,f+"px");this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(f).next().css(ut,f+"px");this.gridInstance.model.showSummary&&this.gridInstance.getFooterContent().find(".e-frozenfooterdiv").width(f)}this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor","default")}},_resizeStackedHeaderColumn:function(t,i,r){var v,y,f,c,o;this._changedcell=[];var p=this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-detailheadercell"),u=0,e=0,s=p[r],l=n(s).attr("colspan"),w=i/l,a=n(s).parent("tr"),b=a.next(),h=s.cellIndex;for(this.gridInstance.model.groupSettings.showGroupedColumn&&(e=this.gridInstance.model.groupSettings.groupedColumns.length,u+=e);h>e;)h--,v=n(a).children("th").not(".e-detailheadercell")[h],u+=parseInt(n(v).attr("colspan"));for(this._currentCell=u,y=u+parseInt(l),f=u;f<y;f++)c=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder)[f],this._changedcell.push(f-e),o=parseInt(i)+parseInt(c.style.width),o<this._colMinWidth&&(o=this._colMinWidth),n(c).outerWidth(o)},_triggerResizeEvents:function(t,i){var p=this.gridInstance.getHeaderTable().find(".e-columnheader"),b=p.find(".e-headercell").filter(":visible"),o=this._cellIndex,u=n(this._target),l=[],s,f,c,r,v,e;if(col=[],t=="resizeStart"&&(this._orgX=i,o=this._cellIndex=this._getCellIndex(this,i)),s=b[this._currentCell],f=s.offsetWidth,this.gridInstance.model.showStackedHeader&&u.hasClass("e-stackedHeaderCell")){var k=u.parent(".e-stackedHeaderRow").index(),d=u.text(),a=this.gridInstance.model.stackedHeaderRows[k].stackedHeaderColumns,h;for(r=0;r<a.length;r++)a[r].headerText==d&&(h=a[r].column);for(c=h,h instanceof Array||(c=h.split(",")),r=0;r<c.length;r++)v=this.gridInstance.getColumnIndexByField(c[r]),l.push(v),col.push(this.gridInstance.model.columns[v])}if(t=="resizeStart")return e={},e=this.gridInstance.model.showStackedHeader&&u.hasClass("e-stackedHeaderCell")?{columnIndex:l,column:col,target:u,oldWidth:f}:{columnIndex:o,column:this.gridInstance.model.columns[o],target:n(s),oldWidth:f},this.gridInstance._trigger("resizeStart",e);var g=p.find(".e-headercell").not(".e-detailheadercell").filter(":visible"),y=i-this._orgX,w=f+y;return this.gridInstance._colgroupRefresh(),e={},e=this.gridInstance.model.showStackedHeader&&u.hasClass("e-stackedHeaderCell")?{columnIndex:l,column:col,target:n(s),oldWidth:f,newWidth:w,extra:y}:{columnIndex:o,column:this.gridInstance.model.columns[o],target:n(s),oldWidth:f,newWidth:w,extra:y},this.gridInstance._trigger("resizeEnd",e)},_mouseUp:function(n){if(this.gridInstance._resizeTimeOut&&(clearTimeout(this.gridInstance._resizeTimeOut),this.gridInstance._resizeTimeOut=0),this._expand){var i=n.clientX,r=n.clientY;if(navigator.userAgent.indexOf("WebKit")!=-1&&(i=n.pageX,r=n.pageY),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="col-resize"&&this._triggerResizeEvents("resizeEnd",i)){this.gridInstance.element.find(".e-reSizeColbg").remove();return}i+=document.documentElement.scrollLeft;this._reSize(i,r);!t.isNullOrUndefined(this._currntCe)&&this._currntCe>=0&&(this.gridInstance.model.columns[this._currntCe].width=this.gridInstance.columnsWidthCollection[this._currntCe])}},_getResizableCell:function(){var r,i,u,t,f;if(r=n(this._target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderTable().find(".e-columnheader"):this.gridInstance.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow"),i=r.find(".e-headercell").not(".e-hide,.e-detailheadercell"),u=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,!this.gridInstance.model.scrollSettings.frozenColumns||this._currentCell!=this.gridInstance.model.scrollSettings.frozenColumns-1)for(t=0;t<i.length;t++){if(point=i[t].getBoundingClientRect(),f=point.left+u+5,f>this._orgX&&n(i[t]).height()+point.top>=this._orgY){this._currentCell=t-1;return}if(t==i.length-1||this.gridInstance.model.showStackedHeader&&n(this._target).get(0)===i[t]){this._currentCell=t;return}}},_moveVisual:function(n){var t=this.gridInstance.getHeaderContent().find("div").first()[0].getBoundingClientRect();t.left+document.documentElement.scrollLeft+t.width<n||n<t.left+document.documentElement.scrollLeft?this._$visualElement.remove():this._currentCell!=-1&&this._$visualElement.css({left:n,top:this._tableY})},_mouseDown:function(t){var i,r,u;return this._allowStart&&n(t.target).closest("tr").css("cursor")=="col-resize"?(this._target=t.target,i=t.clientX,r=t.clientY,navigator.userAgent.indexOf("WebKit")!=-1&&(i=t.pageX,r=t.pageY-document.body.scrollTop),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="col-resize"&&(n(t.target).is(".e-headercelldiv")&&(t.target=t.target.parentNode),this._target=t.target,this._triggerResizeEvents("resizeStart",i)))?void 0:(u=this,i+=document.documentElement.scrollLeft,t.button!=2&&this._start(i,r),!1):!0},_columnResizeToFit:function(i){var lt=this.gridInstance.getHeaderTable().find(".e-columnheader").filter(function(){return n(this).css("cursor")=="col-resize"}),at,st,d,e,h,v,rt,ht,ct,ut,et,ft,ot,r;if(this.gridInstance.model.allowResizeToFit&<.length){n(i.target).is(".e-headercelldiv")&&(i.target=i.target.parentNode);var y=n(i.target),c,f=0,o=0;if(c=y.hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-detailheadercell"):this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-stackedHeaderCell,.e-detailheadercell"),this._target=y,y.hasClass("e-headercell")){var b=i.target,p=n.inArray(b,c),w=p;this._orgX=i.pageX;this.gridInstance.model.enableRTL?this._currentCell=p:this._getResizableCell();p!=this._currentCell&&(p=w=this._currentCell,b=i.target.previousSibling);var l=c.filter(":visible")[w],s=[],a=[],k=[];if(o=this.gridInstance.model.groupSettings.groupedColumns.length,t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)&&t.isNullOrUndefined(this.gridInstance.model.childGrid)||(o+=1),n(b).parent("tr").hasClass("e-stackedHeaderRow")){for(currentSpan=n(l).attr("colspan"),tr=n(l).parent("tr"),tHeadIndex=l.cellIndex,at=tr.next();tHeadIndex>o;)tHeadIndex--,st=n(tr).children("th")[tHeadIndex],f+=parseInt(n(st).attr("colspan"));d=f+parseInt(currentSpan)}else f=w,d=w+1;var u=0,g=0,nt=0,tt=[],it=[];if(f!=-1)for(e=c.slice(0,f+1).filter(".e-hide").length,h={columnIndex:f+e,column:this.gridInstance.model.columns[f+e],target:y,oldWidth:v},this.gridInstance._trigger("resizeStart",h),r=f;r<d;r++){if(e=c.slice(0,r+1).filter(".e-hide").length,nt=this._getContentWidth(r+e),$cellDiv=this.gridInstance.getHeaderTable().find(".e-headercell:not(.e-hide, .e-stackedHeaderCell)").children(".e-headercelldiv").eq(r),g=this._getHeaderContentWidth($cellDiv),u=g>nt?g:nt,u+=parseInt(($cellDiv.css("padding-left"),10)+($cellDiv.css("padding-right"),10)),v=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder).eq(r+o).width(),u=v>u?u:this._colMinWidth<u?u:this._colMinWidth,rt=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder),(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)&&rt.splice(0,1),rt.eq(r+o).width(u),this.gridInstance.model.groupSettings.groupedColumns.length&&(ht=this.gridInstance.getContentTable().find(".e-recordtable").find("colgroup"),ct=this,n.each(ht,function(t,i){n(i).find("col").filter(ct._diaplayFinder).eq(r).width(u)})),ut=this.gridInstance.getContentTable().find("col").filter(this._diaplayFinder),(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)&&ut.splice(0,1),ut.eq(r+o).width(u),this.gridInstance.model.isEdit)for(ft=this.gridInstance.getContentTable().find(".e-editedrow").find("col"),et=this.gridInstance.element.find(".gridform"),j=0;j<et.length;j++)ft=n(et[j]).find("col"),ft.eq(r+o).width(u);tt.push(this.gridInstance.model.columns[r+e]);it.push(Math.abs(u-v));s.push(r+e);a.push(u);k.push(v);(this.gridInstance.model.scrollSettings.frozenColumns>0||this.gridInstance.model.groupSettings.groupedColumns.length&&this.gridInstance.model.isEdit)&&(ot=r+e,this.gridInstance.columnsWidthCollection[ot]=u,this.gridInstance.setWidthToColumns(),this.gridInstance.model.scrollSettings.frozenColumns<=ot+1&&(this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",u),this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",u)))}for(this.gridInstance._colgroupRefresh(),this.gridInstance._recalculateIndentWidth(),h={columnIndex:s,column:tt,target:l,oldWidth:k,newWidth:a,extra:it},this.gridInstance._trigger("resizeEnd",h),r=0;r<s.length;r++)this.gridInstance.columnsWidthCollection[s[r]]=a[r],this.gridInstance.model.columns[s[r]].width=a[r];h={columnIndex:s,column:tt,target:l,oldWidth:k,newWidth:a,extra:it};this.gridInstance._trigger("resized",h);this.gridInstance.model.summaryRows.length>0&&this.gridInstance._summaryColRrefresh();this.gridInstance._findColumnsWidth()}}},_getContentWidth:function(i){var e=0,r=t.buildTag("span",{},{}),u=this.gridInstance,o,f;return t.isNullOrUndefined(u._gridRows)||(f=u._gridRows,this.gridInstance.model.scrollSettings.frozenColumns&&i>=this.gridInstance.model.scrollSettings.frozenColumns&&(f=f[1],i=i-this.gridInstance.model.scrollSettings.frozenColumns),n.each(f,function(t,f){if(n(f).is(".e-row,.e-alt_row")&&!n(f).is(".e-editedrow")){var s=n(f).find("td.e-rowcell").eq(i),h=n(s).html();u.model.columns[i].commands?r.html(n(h).children()):s.hasClass("e-validError")?r.html(n(h).attr("value")):r.html(h);n(s).html(r);o=s.find("span:first").width();o>e&&(e=o);n(s).html(h)}})),u._refreshUnboundTemplate(this.gridInstance.getContentTable()),e},_getHeaderContentWidth:function(n){var i=0,r=t.buildTag("span",{},{}),u=n.html();return r.html(u),n.html(r),i=n.find("span:first").width(),(this.gridInstance.model.allowFiltering&&this.gridInstance.model.filterSettings.filterType=="menu"||this.gridInstance.model.filterSettings.filterType=="excel")&&(i=i+n.parent().find(".e-filtericon").width()+10),n.html(u),i}}}(jQuery,Syncfusion),function(n,t){t.scheduleFeatures=t.scheduleFeatures||{};var r=function(){return"{{if multiRes == true}}<td class = 'e-horizontalheader'><div class='e-horizontalresheader'>{{:label}}<\/div><\/td>{{else}}{{/if}}<td class='e-horizontaldaterender'><div class='e-horizontaltimecells {{:heightclass}}'><div class='e-headerdays' style='position:absolute;'><table class ='e-table {{:tablelayout}}' cellpadding='0px' cellspacing='0px' style='width:100%;border-collapse:separate;table-layout:fixed;'><tbody>{{if view !== 'month'}}<tr style='width:100%;'> <td>{{if view === 'day'}}<table cellspacing='0px' style='width:100%;'>{{else}}<table class='e-table' cellspacing='0px'>{{/if}}<tbody><tr> {{for cols ~headercellWidth = headercellWidth}}<td class='e-headercells {{:cellToday}} e-horizontalheadertddate'><div class='{{:currentDateClass}} e-horizontalheaderdiv'>{{:currentDay}}<\/div><\/td>{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr><tr style='width:100%;position:absolute;'> <td><table class =' e-table e-horizontaltabletimecell' cellspacing='0px' style='border-collapse:collapse;'><tbody><tr> {{for timeTdCount ~columnvalue =column }}{{for ~name=time ~dayend=timecellclass ~index=#getIndex() }}<td class='e-horizontaltimetd {{:~dayend}}'><div style='width:{{:timeCellWidth}}'><span class ='e-horizontaltimespan'>{{:~name.slice(0,2)}}<\/span><div class ='e-horizontaltimespandiv'>{{:~name.slice(3,5)}}<\/div><\/div><\/td>{{for ~columnvalue[~index] ~width = timeCellWidth}}<td class='e-horizontalalternatetd'><div style='width:{{:~width}}'><\/div><\/td>{{/for}}{{/for}}{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr>{{/if}}{{if view == 'month'}}<tr>{{for cols}}<td class='e-headercells e-horizontmonthheaderdatetd {{:cellToday}}'><div title='{{:title}}' class='e-dateheadercell e-horizontmonthdatealign'>{{:currentDate}}<\/div><\/td>{{/for}}<\/tr><tr>{{for cols}}<td class ='e-horizontmonthheaderdaytd' style='width:{{:cellWidth}}'><div class='e-dateheadercell e-horizontmonthdatealign' title='{{:daynameTitle}}'>{{:currentDay}}<\/div><\/td>{{/for}}<\/tr>{{/if}}<\/tbody><\/table><\/div><\/div><\/td>"},u=function(){return"{{if multiRes == true}}<td class = 'e-horizontalheader'><div class='e-horizontalresheader'>{{:label}}<\/div><\/td>{{else}}{{/if}}<td class='e-horizontaldaterender'><div class='e-horizontaltimecells {{:heightclass}}'><div class='e-headerdays' style='position:absolute;'><table class ='e-table' cellpadding='0px' cellspacing='0px' style='width:100%;border-collapse:separate;table-layout:fixed;'><tbody>{{if view !== 'month'}}<tr style='width:100%;'> <td>{{if view === 'day'}}<table cellspacing='0px' style='width:100%;'>{{else}}<table class='e-table' cellspacing='0px'>{{/if}}<tbody><tr> {{for cols ~headercellWidth = headercellWidth}}<td class='e-headercells {{:cellToday}} e-horizontalheadertddate'><div class='{{:currentDateClass}} e-horizontalheaderdiv'>{{:currentDay}}<\/div><\/td>{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr><tr style='width:100%;position:absolute;'> <td><table class='e-table e-horizontaltabletimecell' cellspacing='0px' style='border-collapse:collapse;'><tbody><tr> {{for timeTdCount ~userTemplateId = userTemplateId ~template=template ~columnvalue =column}}{{for ~name=time ~names=times ~dayend=timecellclass }}<td class='e-horizontaltimetd {{:~dayend}}'><div style='width:{{:timeCellWidth}}'><span class ='e-horizontaltimespan'>{{:~name}}<\/span><div class ='e-horizontaltimespandiv'><\/div><\/div><\/td>{{for ~columnvalue ~width = timeCellWidth ~names=~names}}<td class='e-horizontalalternatetd' style='vertical-align:middle !important;'><div style='width:{{:~width}};' > {{if ~template ==true || ~userTemplateId==true }}{{:~names[#getIndex()]}}{{else}}<\/div>{{/if}}<\/td>{{/for}}{{/for}}{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr>{{/if}}{{if view == 'month'}}<tr>{{for cols}}<td class='e-headercells e-horizontmonthheaderdatetd {{:cellToday}}'><div class='e-dateheadercell e-horizontmonthdatealign'>{{:currentDate}}<\/div><\/td>{{/for}}<\/tr><tr>{{for cols}}<td class ='e-horizontmonthheaderdaytd'><div class='e-dateheadercell e-horizontmonthdatealign' style='width:{{:cellWidth}}'>{{:currentDay}}<\/div><\/td>{{/for}}<\/tr>{{/if}}<\/tbody><\/table><\/div><\/div><\/td>"},f=function(){return"<div class ='e-horizontresdiv'><div class='e-horires' style='height:100%'><table class='e-table e-resourceheadertable' width='100%' cellpadding='0px' cellspacing='0px' style='table-layout:fixed'><tbody>{{for trs}}<tr class='e-horizontresheaderdiv'>{{for ~resname=name ~marginleft=marginleft }}{{if classname == 'e-parentnode'}}<td class='{{:classname}} resemptytd' style='width:25px;height:{{:cellHeight}}'><\/td>{{else}}<td class='resemptytd' style='width:25px;height:{{:cellHeight}}'><\/td>{{/if}}<td class='{{:classname}}' style='vertical-align:middle;height:{{:cellHeight}};'>{{if classname == 'e-parentnode'}}<div id={{:idnum}} class='{{:classname}}category e-resourceicon e-resourcecollapse' style='width:20px;vertical-align:middle;float:left;margin-left:{{:~marginleft}};margin-top:2px;'><\/div>{{/if}}<div class='e-resourceheadertext' style='text-align:left;margin-left:{{:~marginleft}};' title='{{if userResTemplId == true}}{{:name}}{{else}}{{:~resname}}{{/if}}'>{{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resname}}{{/if}}<\/div><\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table><\/div><\/div>"},e=function(){return"<table class='e-table e-workcellstab'cellpadding='0px' cellspacing='0px'><tbody>{{for cellrows ~cols=cols ~hourdiff=hourdiff ~view=view ~classname=classname ~columnvalue=column ~userTemp=userTemplate ~userHtml=userHtml}}{{if classname == 'e-parentnode'}} <tr class='e-resourceheadertr' style='width:100%'>{{for ~cols ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}<td class='e-resourceheadercells e-workcells e-parentworkcell e-dayend' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{else}}<td class='e-resourceheadercells e-workcells e-parentworkcell' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{/if}}{{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}<\/td>{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}<td class='e-resourceheadercells e-workcells e-parentworkcell e-alternateworkcell' style='width:{{:~width}};height:{{:cellHeight}}'>{{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}<\/td>{{/for}}{{/if}}{{/for}}<\/tr>{{else}}<tr style='width:100%'>{{for ~cols ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}<td class='e-workcells e-childworkcell e-dayend' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{else}}<td class='e-workcells e-childworkcell' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{/if}}{{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}<\/td>{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}<td class='e-workcells e-childworkcell e-alternateworkcell' style='width:{{:~width}};height:{{:cellHeight}}'>{{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}<\/td>{{/for}}{{/if}}{{/for}}<\/tr>{{/if}}{{/for}}<\/tbody><\/table>"};t.scheduleFeatures.horizontal={_renderHorizontalTemplates:function(){this.horizontalHeader=n.templates(r());this.cellTemplate=n.templates(e());this.horizontalResHeader=n.templates(f());this.userTimeCellHoriTemplate=n.templates(u())},_horizontalViewNavigation:function(t){var u,i,r,f;if(t.type=="click"){if(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7){if(this.element.find(".e-headercells").children().removeClass("e-activeview"),u=t.currentTarget.cellIndex,i=new Date(this._dateRender[u]),this.model.minDate<=i&&this.model.maxDate>=i)this.model.timeScale.enable&&n(t.currentTarget).children().addClass("e-activeview"),this.currentDate(i);else return!1;this._businessHourScroller()}else if(this.currentView()=="month"||this._isCustomMonthView()){if(u=t.currentTarget.cellIndex,this.model.views.indexOf("day")==-1)return!1;if(i=new Date(this.monthDays[u]),this.model.minDate<=i&&this.model.maxDate>=i)this.currentDate(i);else return!1;this._navView=!0;this._viewChange(t,this.currentView(),"day")}}else if(t.type=="dblclick"&&(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7)){if(r=n(t.target),f=r.hasClass("e-headercells")?r:r.parent().hasClass("e-headercells")?r.parent():r.parent().parent(),this.model.views.indexOf("day")==-1||!f.hasClass("e-headercells"))return!1;if(i=new Date(this._dateRender[f.index()]),this.model.minDate<=i&&this.model.maxDate>=i)this.currentDate(i);else return!1;this._navView=!0;this._viewChange(t,this.currentView(),"day")}},_renderHorizontalHeaderDays:function(i){var u,s,h,f,c,e,o,r;if(this.element.find(".e-headercells").addClass("e-dateheaderselect"),this.currentView()==="month"||this._isCustomMonthView())for(o=this.monthDays,r=0;r<o.length;r++)new Date(new Date(o[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight");else{if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(this.element.find(".e-headercells").children().removeClass("e-activeview"),r=0;r<this._dateRender.length;r++)u=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(this._dateRender[r]).getDay()].split("")[0]:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?i.calendar.days.names[new Date(this._dateRender[r]).getDay()]:this._dayShortNames[new Date(this._dateRender[r]).getDay()]:this._dayShortNames[new Date(this._dateRender[r]).getDay()],s=this.model.timeScale.enable?this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?u+parseInt(t.format(new Date(this._dateRender[r]),"dd",this.model.locale)):this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?u+" "+t.format(new Date(this._dateRender[r]),"dd MMMM yyyy",this.model.locale):u+" "+t.format(new Date(this._dateRender[r]),"dd MMM yy",this.model.locale):u+" "+new Date(this._dateRender[r]).getDate():this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?u+parseInt(t.format(new Date(this._dateRender[r]),"dd",this.model.locale)):this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?t.format(new Date(this._dateRender[r]),"dd MMMM yyyy",this.model.locale):t.format(new Date(this._dateRender[r]),"dd MMM yy",this.model.locale):("0"+new Date(this._dateRender[r]).getDate()).slice(-2),n(this.element.find(".e-headercells")[r]).find("div")[0].innerHTML=s,new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight"),new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date(this.currentDate().setHours(0,0,0,0)).getTime()&&n(this.element.find(".e-headercells")[r]).children().addClass("e-activeview");else for(h=this._getUserDateheaderTemplate(),r=0;r<this._dateRender.length;r++)n(this.element.find(".e-headercells")[r]).find("div")[0].innerHTML=h[r].currentDay,new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight");f=new Date(this.currentDate());this.model.orientation=="horizontal"&&this.currentView()!="month"&&this.model.timeScale.enable&&(new Date(this.currentDate()).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&(this.element.find(".e-headercells").children().removeClass("e-activeview"),this.element.find(".e-currentdayhighlight").children().addClass("e-activeview")),c=this.element.find(".e-headercells").children(".e-activeview").parent().index(),this.element.find(".e-headercells").children().removeClass("e-activeview"),e=this.currentView()==="day"?0:this.currentView()==="workweek"?f.getDay()-1:this.currentView()==="week"?f.getDay():c,this.currentView()!="day"&&n(this.element.find(".e-headercells")[e]).children().addClass("e-activeview"),new Date(new Date(this.currentDate()).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?n(this.element.find("td.e-horizontalheadertddate")[e]).addClass("e-headerToday"):"")}},_horizontalScroll:function(i,r){var e,f,u;if(!t.isNullOrUndefined(i.scrollLeft)&&(r.currentView()=="day"||r.currentView()=="week"||r.currentView()=="workweek"||this.currentView()==="customview"&&this._renderDays<=7)){if(e=n(r.element.find(".e-headercells").find(".e-activeview").parent()).index(),u=0,this.model.enableRTL?(f=t.browserInfo().name=="mozilla"?Math.abs(i.scrollLeft):i.scrollData.scrollable-i.scrollLeft,n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",f-1+"px"),u=Math.floor(Math.abs(f)/(r.element.find(".e-workcells").width()+1)/((r.model.endHour-r.model.startHour)*r.model.timeScale.minorSlotCount))):u=Math.floor(Math.abs(i.scrollLeft)/r.element.find(".e-workcells").width()/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),i.scrollData.scrollable-i.scrollLeft==0)return;r.currentView()!="day"&&e!==u&&r.element.find(".e-headercells").children().removeClass("e-activeview");r.currentView()!="day"&&n(r.element.find(".e-headercells")[u]).children().addClass("e-activeview");this.model.timeScale.enable||r.element.find(".e-headercells").children().removeClass("e-activeview")}},_getHorizontalheaderCellCount:function(n){var f=[],r,u,e;if(this._isCustomMonthView(),!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&(this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"||this.currentView()=="customview"&&this._oneWeek))f=this._getUserDateheaderTemplate();else for(i=0;i<this._dateRender.length;i++)r=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(this._dateRender[i]).getDay()].split("")[0]:this.currentView()==="month"||this.currentView()==="day"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?n.calendar.days.names[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],u=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday e-currentdayhighlight":"",e=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:r,currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?{currentDay:t.format(new Date(this._dateRender[i]),this._pattern.D,this.model.locale),currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:{currentDay:r+" "+t.format(new Date(this._dateRender[i]),"dd MMM yy",this.model.locale),currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:{currentDay:this._mediaQuery?r+parseInt(t.format(new Date(this._dateRender[i]),"dd",this.model.locale)):r+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:u,cellWidth:this.model.cellWidth},f.push(e);return f},_getHoriStartEndTime:function(i){var c=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),v,l,f,y,p,w,h,u,r,o;c&&(v=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),l=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()));var e=[],s=this.model.cellWidth?this._safariBrowser?parseInt(this.model.cellWidth)-1+"px":this.model.cellWidth:this._safariBrowser?"29px":"30px",b=this.currentView()=="week"?7:this.currentView()=="day"?1:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length;for(f=0;f<b;f++)if(c){var h=new Date((new Date).setHours(0,0,0,0)),r=0,a=[];for(u=this.model.startHour;u<this.model.endHour;){for(y=this.model.timeScale.majorSlot+r,p=r;r<y;)w=r,r=r*6e4,c?w==p?o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?l.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}):v.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}):t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||a.push(l.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}).trim()):this._timeMode=="12"?(o=(u===this.model.startHour||u===12)&&i.AM&&i.PM&&r==0?t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh:mm tt",this.model.locale),e.push({time:o,id:u+"_"+r,timecellclass:u==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(u<=9?"0"+u:u)+" 00",timecellclass:u%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)==this.model.startHour&&f!=0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),r=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?r/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount:r/6e4+this.model.timeScale.majorSlot;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:r>=60?u+1:u;r=r>=60?0:r;c&&(r==this.model.timeScale.majorSlot||r==0)&&(e.push({time:o.trim(),times:a,id:u+"_"+r,timecellclass:u-1==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),a=[])}}else for(h=new Date((new Date).setHours(0,0,0,0)),u=this.model.startHour;u<this.model.endHour;){for(r=0;r<60;)r=r*6e4,this._timeMode=="12"?(o=(u===this.model.startHour||u===12)&&i.AM&&i.PM&&r==0?t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh:mm tt",this.model.locale),e.push({time:o,id:u+"_"+r,timecellclass:u==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(u<=9?"0"+u:u)+" 00",timecellclass:u%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)==this.model.startHour&&f!=0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),r=r/6e4+this.model.timeScale.majorSlot;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:u+1}return e},_getHorizontalDayAppointments:function(n,i,r,u){for(var e=[],f=0;f<n.length;f++)e=!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?new t.DataManager(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,n[f][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])):this.res1,e.length!=0&&(new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(n[f][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[f][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?n[f][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.id]:!0&&new Date(new Date(n[f][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[f][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())&&this._renderApp(n[f],r,u)},_horiGroupCollection:function(){if(this._tempResource.length!=0){var n=this._resourceSort(),i=this.res1,r=n.filter(function(n){return i.indexOf(n)===-1});return t.isNullOrUndefined(this.model.group)&&(this.res1=["0"]),r}},_renderHorizontalApp:function(i,r,u,f,e,o,s,h){var ft=this.element.find(".e-workcellstab tr"),a,k,d=0,nt,lt,et,ot,st,g,p,w,ct,c,b,it,y,kt;if(i<=r&&(lt=new Date(i).getHours()<s?new Date(i).getHours()+-new Date(i).getHours()+-new Date(i).getMinutes():new Date(i).getHours()+-s,et=new Date(r).getHours()>h?new Date(r).getHours()+(-new Date(r).getHours()+(h-s))+-new Date(r).getMinutes():new Date(r).getHours()+-s,et=new Date(r).getHours()==h?new Date(et).getMinutes()+-new Date(r).getMinutes():et,a=this.element.find(".e-appointment").length>0?this.element.find(".e-appointment").outerHeight(!0):this._getElementHeight("e-appointment"),ot=0,this.model.startHour<=new Date(i).getHours()&&this.model.endHour>=new Date(i).getHours())){var l=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._grouping.length>1?this._findResourceIndex(this._horiHeaderCollection,this._tempResource[this._tempResource.length-2].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:0,v=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()])+1:1,at=this.model.appointmentTemplateId?!0:!1,rt=at?this._getUserAppointmentTemplate(u):"";if(a=this.model.appointmentTemplateId?n(rt).css("height")=="100%"?this.model.showOverflowButton?e-15:this.initialCellHeight:n(rt).css("height")=="0px"?a:n(rt).height():a,ot=t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)?this._getOverlapCount(u,f,this._dateRender,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getOverlapCount(u,f,this._dateRender,null),this._renderedAllDay.push(n.extend(!0,{},u)),d=ot*a+d,u[this._appointmentSettings.allDay])st=new Date(new Date(new Date(r).setHours(0,0,0,0)).getTime())-new Date(new Date(new Date(i).setHours(0,0,0,0)).getTime()),g=Math.round(st/864e5)+1,g>this._dateRender.length&&(g=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay()),p=g*(h-s)*60,w=(this.model.endHour-this.model.startHour)*o*f,k=this.cellwidth/30*p+(p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1),nt="0";else if(new Date(new Date(new Date(u[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime())<new Date(new Date(new Date(u[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())){var vt=new Date(r)<new Date(new Date(r).setHours(this.model.endHour,0,0))&&new Date(r)<new Date(new Date(r).setHours(this.model.startHour,0,0))?this.model.endHour*30:new Date(r).getHours()*60+new Date(r).getMinutes(),yt=new Date(i)>new Date(new Date(r).setHours(this.model.startHour,0,0))?this.model.startHour*60:new Date(i).getHours()*60+new Date(i).getMinutes(),ht=1,pt,ut,wt,bt,st;if(pt=this._dateRender.indexOf(new Date(r).setHours(0,0,0,0)),ut=this._dateRender.indexOf(new Date(i).setHours(0,0,0,0)),pt==-1)while(ht<7)if(new Date(this._dateRender[this._dateRender.length-ht]).getTime()<new Date(r).setHours(0,0,0,0)){wt=this._dateRender.length-ht;vt=this.model.endHour*60;break}else ht++;else wt=pt;ut==-1?(bt=f,yt=this.model.startHour*60):bt=ut;st=wt-bt;p=st*(h-s)*60-yt+vt;w=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+(ut==-1?0:lt*o)*(60/this.model.timeScale.majorSlot));k=this.cellwidth/30*p+(p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2);g>this._dateRender.length&&(g=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay(),p=g*(h-s)*60,k=p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));nt=ut==-1?0:parseFloat(new Date(i).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*o/this.model.timeScale.majorSlot}else{if(nt=parseFloat(new Date(i).getMinutes()+new Date(i).getMilliseconds()/60)*this.cellwidth*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,this.model.endHour-this.model.startHour==24)ct=new Date(r).getHours()*60+new Date(r).getMinutes()-(new Date(i).getHours()*60+new Date(i).getMinutes());else var vt=new Date(r).getHours()*60+new Date(r).getMinutes()>this.model.endHour*60?this.model.endHour*60:new Date(r).getHours()*60+new Date(r).getMinutes(),yt=new Date(i).getHours()*60+new Date(i).getMinutes()<this.model.startHour*60?this.model.startHour*60:new Date(i).getHours()*60+new Date(i).getMinutes(),ct=vt-yt;ct+=1;k=ct/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(ct/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2)+1;w=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+lt*o*(60/this.model.timeScale.majorSlot))}if(c=this._appointmentColor(u),e=t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0?e:ft.eq(v+l-1).children().eq(w).height()+1,b=this._indicationApp(u),d+a+7<e){var dt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.startTime]),"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.endTime]),"HH:mm",this.model.locale),ni=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,tt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!c.appointColor.applyFilter?!0:!1,subject:u[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:nt+"px",top:d,appHeight:this.model.appointmentTemplateId?a:"",appWidth:k+"px",userAppTemplId:at,userTemplate:rt,appClass:"e-appointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?u[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(u):u[this._appointmentSettings.priority],uid:u.Guid,recurrence:u[this._appointmentSettings.recurrence],recurrenceEdit:ni,leftInd:b.leftIndication,rightInd:b.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),y=ft.eq(v+l-1).children().eq(w);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,tt);y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(tt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(tt))}else if(this.model.showOverflowButton)it=w+Math.round(new Date(i).getMinutes()/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it).length==0&&(y=ft.eq(v+l-1).children().eq(it),kt='<div id="'+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it+'" class="e-icon e-arrowhead-down e-appsoverflow" cellinfo="'+this._dateRender[f]+'"><\/div>',y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(kt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(kt)),d=e-this.element.find(".e-appsoverflow").height(),this.element.find("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it).css(this.model.enableRTL?"right":"left",this.cellwidth-25+"px").css("top",d+"px")),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it).attr("appcount",ot+1);else{this.element.find(".e-workcellstab tr").eq(v+l-1).children().css("height",e+a-1+"px");this.element.find(".e-resourceheadertable tr").eq(v+l-1).find(".e-childnode").css("height",e+a-1+"px");var dt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.startTime]),"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.endTime]),"HH:mm",this.model.locale),ni=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,tt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,subject:u[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:nt+"px",top:d,appHeight:this.model.appointmentTemplateId?a:"",appWidth:k+"px",userAppTemplId:at,userTemplate:rt,appClass:"e-appointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?u[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(u):u[this._appointmentSettings.priority],uid:u.Guid,recurrence:u[this._appointmentSettings.recurrence],recurrenceEdit:ni,leftInd:b.leftIndication,rightInd:b.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),y=ft.eq(v+l-1).children().eq(w);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,tt);y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(tt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(tt));this._overflowFlag=!0}t.isNullOrUndefined(b)||(b.leftIndication&&(this.model.enableRTL?this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),b.rightIndication&&(this.model.enableRTL?this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")));!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(this._horiHeaderCollection,l,w,u,k,nt)}},_renderAppointmentCategory:function(i,r,u,f,e,o){var h,y,c=0,p,k,l=[],w,b=this.element.find(".e-resourceheadercells").height(),v,s,a;if(!t.isNullOrUndefined(this.model.group)&&this._grouping.length>0){h=this._getResourceColor(f);y=h.appointData==""?"e-categorycolor":"";r-=1;e=this.currentView()=="month"||this._isCustomMonthView()?e:e+2;do if(s=this.element.find(".e-resourceheadertr").eq(r).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;left:"+o+"px;'><\/div>",s.find("div.e-appointwrapper").length>0?s.find("div.e-appointwrapper").append(a):s.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),this._tempResource.length>2){for(v=this._tempResource.length-2;v>=0;v--)if(c=this._tempResource[v].resourceSettings.dataSource.indexOf(i[r]),c!=-1){if(c=v,p=this._tempResource[v].resourceSettings.groupId,t.isNullOrUndefined(p))return;break}k=c==0?c:c-1;l=new t.DataManager(i).executeLocal((new t.Query).where(this._tempResource[k].resourceSettings.id,t.FilterOperators.equal,i[r][p]));w=this._tempResource[0].resourceSettings.dataSource.indexOf(l[0]);w==0?(l=[],this._tempResource.length>2&&(s=this.element.find(".e-resourceheadertr").eq(w).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+this.element.find(".e-resourceheadercells").height()+"px;background:"+h.appointData+";width:"+e+"px;left:"+o+"px;'><\/div>",s.find("div.e-appointwrapper").length>0?s.find("div.e-appointwrapper").append(a):s.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)))):l.length!=0?r=i.indexOf(l[0]):""}while(l.length!=0)}},_getHorizontalOverlapCount:function(n,i,r,u,f){for(var o=[],e=0,s=n.length;e<s;e++)t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?new Date(new Date(n[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[e][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&(new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])>=new Date(n[e][this._appointmentSettings.startTime])||new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])&&new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.startTime])>=new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])<new Date(n[e][this._appointmentSettings.endTime]))&&(f!=null?f==n[e][this._tempResource[this._tempResource.length-1].field]:f==null)&&o.push(n[e]):new Date(new Date(n[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[e][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&(new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])>=new Date(n[e][this._appointmentSettings.startTime])||new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])&&new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.startTime])>=new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])<new Date(n[e][this._appointmentSettings.endTime]))&&o.push(n[e]);return o},_renderHorizontalHeaderBar:function(){var y=this._isCustomMonthView(),u=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",p=u=="day"?1:u=="week"?7:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length,c,l,w,e,o,s,h,f,i,b,v,k;if(this._strTime=this._getStartEndTime(),c=this._columnTimeScale(this._strTime),this.datesColumn=this._getHeaderAllDayCellsCount(),u==="month"||this._isCustomMonthView()){for(this.datesColumn=[],this.monthDays=[],this.totdays=[],i=0;i<this._dateRender.length;i++)this.currentView()==="month"||this._isCustomMonthView()&&this._oneWeek?new Date(this.currentDate()).getMonth()===new Date(this._dateRender[i]).getMonth()&&this.totdays.push(this._dateRender[i]):this.totdays.push(new Date(this._dateRender[i]));if(l=this.totdays.length,!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&(this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"||this.currentView()=="customview"&&this._oneWeek))for(w=this._getUserDateheaderTemplate(),i=0;i<l;i++)e={currentDate:w[i].currentDay,currentDateClass:"",currentDay:this.currentView()=="day"?this._dayFullNames[new Date(this.totdays[i]).getDay()]:this._dayShortNames[new Date(this.totdays[i]).getDay()].toString(),cellWidth:this.model.cellWidth?this.model.cellWidth:"100%",cellHeight:this.model.cellHeight,cellToday:new Date(this.totdays[i]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()?"e-currentdayhighlight":""},this.datesColumn.push(e),this.monthDays.push(this.totdays[i]);else for(i=0;i<l;i++)s=new Date(this.totdays[i]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()?"e-currentdayhighlight":"",o=y&&new Date(this.totdays[i]).getDate()==1?t.format(new Date(this.totdays[i]),"MMM",this.model.locale)+" "+new Date(this.totdays[i]).getDate():t.format(new Date(this.totdays[i]),"dd",this.model.locale),e=this.model.timeScale.enable?{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this._dayFullNames[new Date(this.totdays[i]).getDay()].toString().slice(0,1),cellWidth:!this.model.cellWidth&&this.currentView()!="month"&&!this._isCustomMonthView()?"30px":this.model.cellWidth,cellHeight:this.model.cellHeight,cellToday:s}:this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"?{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this.currentView()=="day"?this._dayFullNames[new Date(this.totdays[i]).getDay()]:this._dayShortNames[new Date(this.totdays[i]).getDay()].toString(),cellWidth:this.model.cellWidth?this.model.cellWidth:"100%",cellHeight:this.model.cellHeight,cellToday:s}:{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this._dayFullNames[new Date(this.totdays[i]).getDay()].toString().slice(0,1),cellWidth:this.model.cellWidth,cellHeight:this.model.cellHeight,cellToday:s},this.datesColumn.push(e),this.monthDays.push(this.totdays[i])}if(h=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,f=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,h||f){var d=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),g=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),nt=[],r=0;for(i=this.model.startHour;i<this.model.endHour;){for(var a=[],tt=this.model.timeScale.majorSlot+r,it=r;r<tt;)b=r,r=r*6e4,this._timeMode=="12"&&(b!=it||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?a.push(d.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,r))}).trim()):a.push(g.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,r))}).trim())),r=r/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;i=this.model.timeScale.majorSlot>60?i+this.model.timeScale.majorSlot/60:r>=60?i+1:i;r=r>=60?0:r;nt.push(a)}f=!0}v=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&this._tempResource[0].resourceSettings.dataSource.length!=0?!0:!1;k=h||f?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:v,view:u,timeTdCount:this._strTime,colspan:u=="month"?1:this._strTime.length/p*2,heightclass:u=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",width:this.model.width,headercellWidth:u=="day"?"100%":"55px",column:c,userTemplateId:h,template:f}):this.horizontalHeader.render({tablelayout:y?"e-fixedlayout":"",cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:v,view:u,timeTdCount:this._strTime,colspan:u=="month"?1:this._strTime.length/p*2,heightclass:u=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",width:this.model.width,headercellWidth:u=="day"?"100%":"55px",column:c});this.aTR.append(k)},_renderHorizontalContent:function(n,i,r,u,f,e){var y=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),s,o,l=[],p=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,v=this._strTime,h,a,c;l=this._columnValue;this._tempResource.length==0||t.isNullOrUndefined(this.model.group)||this._tempResource[0].resourceSettings.dataSource.length==0?(o="",s=[{classname:"e-childnode"}]):(o=this._renderHorizontalResources(),s=this._horiResources);h=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0;h&&(a=this._getUserWorkCellsTemplate());c=this.cellTemplate.render({cellrows:s,hourdiff:Math.ceil((this.model.endHour-this.model.startHour)*(60/this.model.timeScale.majorSlot)),view:this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",cols:this.model.timeScale.enable?this.currentView()=="month"||this._isCustomMonthView()?this.datesColumn:v:this.datesColumn,column:l,userTemplate:h,userHtml:a});o==""?this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(c))))))))):this.wTR.append(t.buildTag("td.e-horizontalrestd",{},{},{width:"15%",height:"100%"}).append(o)).append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(c)))))))))},_columnTimeScale:function(n){var u,i;this._columnValue=[];_cols2=[];var r=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,f=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate),e=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)?!0:!1,o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)?!1:!0;if(f)for(i=0;i<n.length;i++)this._columnValue.push(i);else for(i=0;i<n.length;i++){for(u=0;u<this.model.timeScale.minorSlotCount-1;u++)if(r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,r>(this.model.endHour-this.model.startHour)*60){if(_cols2.push(u),u==this.model.timeScale.minorSlotCount-2){r=0;break}}else _cols2.push(u);this._columnValue.push(_cols2);r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;_cols2=[]}return this._columnValue},_getResourceHeadTemplate:function(t){var i=n.templates(n(this.model.resourceHeaderTemplateId).html());return i.render(t)},_renderHorizontalResources:function(){var i,u,f,r,e,c,o;this._resCollect=[];this._horizontalResRender=[];this._horiResources=[];var s=this.currentView(),l=s=="day"?1:s=="week"||s=="month"||this._isCustomMonthView()?7:this.model.workWeek.length,h=this.model.resourceHeaderTemplateId?!0:!1;if(t.isNullOrUndefined(this.model.group))for(o=0;o<this._tempResource.length;o++)this._horizontalResRender.push(this._tempResource[o].resourceSettings.dataSource),this._resCollect.push(this._tempResource[o].resourceSettings.dataSource);else if(this._grouping.length===1){for(u=0;u<this._grouping.length;u++)i=this._findResourceIndex(this._tempResource,"name",this._grouping[u]);for(u=0;u<this._resourceInfo[i].dataSource.length;u++)this._horiResources.push({cellHeight:this.model.cellHeight,name:this._resourceInfo[i].dataSource[u][this._resourceInfo[i].text],idnum:this._resourceInfo[i].dataSource[u][this._resourceInfo[i].id],classname:"e-childnode",marginleft:"10px",width:"10px",backgroundcolor:"",border:"1px solid #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(this._resourceInfo[i].dataSource[u],{classname:"e-childnode"})),userResTemplId:h}),this._resCollect.push(this._resourceInfo[i].dataSource[u]);this._horizontalResRender.push(this._resCollect)}else{for(f=this._resourceSort(),r=0;r<f.length;r++){for(e=0;e<this.render_Resources.length;e++)if(c=this.render_Resources[e].indexOf(f[r]),c!=-1){i=e;break}i==this.render_Resources.length-1?(this._horiResources.push({cellHeight:this.model.cellHeight,name:f[r][this._tempResource[i].resourceSettings.text],classname:"e-childnode",marginleft:(this._mediaQuery?i*11:i*21)+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(f[r],{classname:"e-childnode"})),userResTemplId:h}),this._resCollect.push(f[r])):(this._horiResources.push({cellHeight:this.model.cellHeight,name:f[r][this._tempResource[i].resourceSettings.text],idnum:f[r][this._tempResource[i].resourceSettings.id]+"_"+f[r][this._tempResource[i].resourceSettings.groupId],classname:"e-parentnode",marginleft:i*10+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(f[r],{classname:"e-parentnode"})),userResTemplId:h}),this._resCollect.push(f[r]))}this._horizontalResRender.push(this._resCollect)}return this.horizontalResHeader.render({trs:this._horiResources})},_horizontalResIcon:function(){for(var r,s,e=this.element.find(".e-parentnodecategory"),o,u,h,i,f=0;f<e.length;f++){for(o=e[f].id.split("_")[0],r=0;r<this._tempResource.length;r++)if(u=new t.DataManager(this._tempResource[r].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.id,t.FilterOperators.equal,o)),u.length!=0){u=r;break}for(i=u+1,i=i==this._tempResource.length?i-1:i,s=0;s<this._tempResource.length;s++){h=new t.DataManager(this._resourceSort()).executeLocal((new t.Query).where(this._tempResource[i].resourceSettings.groupId,t.FilterOperators.equal,o));h.length==0&&n(e[f]).removeClass("e-resourceicon e-resourcecollapse");break}}},_renderHorizontalCurrentTime:function(){var i,r,t;if(this.currentView()==="month"||this._isCustomMonthView())for(i=this.monthDays,r=this.element.find(".e-headerdays").find("table").find("td"),t=0;t<i.length;t++)new Date(new Date(i[t]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()&&n(r[t]).addClass("e-monthcurrenttime");else this.element.find("td.e-headerToday").length>0&&(this.element.find(".e-horizontaltabletimecell").parent().append('<div id="'+this._id+'_HighlightCurrentTimeline" class="e-highlightcurrenttimeline" style="height: 92%; width: 2px; position: absolute; background-color: red; "><\/div>'),n("#"+this._id+"_HighlightCurrentTimeline").css("top",this.element.find(".e-headerdays tr")[1].offsetTop))},_horizontalTimePosition:function(t,i){if(t.element.find("td.e-headerToday").length>0){var r=t.element.find("td.e-headerToday")[0].cellIndex,u=(t.model.endHour-t.model.startHour)*60/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount*r+(i.getHours()-t.model.startHour)*60/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount,f=parseFloat(i.getMinutes())*t.element.find(".e-workcells")[1].offsetWidth*t.model.timeScale.minorSlotCount/t.model.timeScale.majorSlot;n("#"+t._id+"_HighlightCurrentTimeline").css("left",u*t.element.find(".e-workcells")[1].offsetWidth+f)}},_horizontalBusinessHighlight:function(i,r,u,f,e){var a=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._horiResources.length:1,h,l,o,c,s;if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable)for(o=0;o<a;o++)for(h=0;h<i.length;h++)for(s=0;s<this.model.workWeek.length;s++)this._dayNamesArray.indexOf(this.model.workWeek[s])==new Date(i[h]).getDay()&&n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[r*f+(this.model.endHour-this.model.startHour)*f*h-1]).nextAll(".e-workcells").slice(0,u*f-r*f).addClass("e-businesshighlightworkcells");else for(l=this.monthDays,e=this.element.find(".e-workcells"),e.removeClass("e-monthcellhighlight"),o=0;o<a;o++)for(c=0;c<l.length;c++)for(s=0;s<this.model.workWeek.length;s++)this._dayNamesArray.indexOf(this.model.workWeek[s])==new Date(l[c]).getDay()&&n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[c]).addClass("e-monthcellhighlight")},_onResourceClick:function(i){var s,e,l,y,h,a,o,v,u=[],c=[],f,r;for(e=n(i.currentTarget),e.hasClass("e-resourceicon e-resourcecollapse")?(e.removeClass("e-resourceicon e-resourcecollapse").addClass("e-resourceicon e-resourceexpand"),l=!0):(e.removeClass("e-resourceicon e-resourceexpand").addClass("e-resourceicon e-resourcecollapse"),y=!0),this.model.cellHeight||(this.element.find(".e-workcellstab").css("height","100%"),this.element.find(".e-resourceheadertable").css("height","100%")),s=n(i.currentTarget).closest("td.e-parentnode").parent().index(),v=this._getResourceCollection(),r=0;r<v.length;r++)if(h=new t.DataManager(this._tempResource[r].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.id,t.FilterOperators.equal,i.currentTarget.id.split("_")[0])),h.length!=0){a=h[0].count;break}for(f=0;f<a;f++)u.push(this.element.find(".e-resourceheadertable tr")[s+f+1]),c.push(this.element.find(".e-workcellstab tr")[s+f+1]);for(r=0;r<u.length;r++)l?(o=n(u[r]).children().hasClass("e-parentnode"),o&&n(u[r]).find(".e-parentnodecategory").removeClass("e-resourceicon e-resourcecollapse").addClass("e-resourceicon e-resourceexpand"),n(u[r]).is(":visible")&&(n(u[r]).toggle(),n(c[r]).toggle())):(o=n(u[r]).children().hasClass("e-parentnode"),o&&n(u[r]).find(".e-parentnodecategory").removeClass("e-resourceicon e-resourceexpand").addClass("e-resourceicon e-resourcecollapse"),n(u[r]).is(":hidden")&&(n(u[r]).toggle(),n(c[r]).toggle()));this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height());this._horizontalRender();this.model.cellHeight&&this._reRenderScroller();this._mediaQuery&&this.refreshScroller();this._horizontalResIcon();this.element.find("div.e-prevapp,div.e-nextapp").remove();this.element.find(".e-categorybar").height(this.element.find(".e-parentworkcell").height()-3);this._businessHourScroller();this._renderAppointmentAll()}}}(jQuery,Syncfusion),function(n,t,i){t.ExcelFilter=t.ExcelFilter||{};t.excelFilter=function(n){return this._ctrlInstance=n.instance,this.id=this._ctrlInstance._id,this._dialogContainer=null,this._showSort=n.showSortOptions||!1,this._interDeterminateState=n.interDeterminateState||!1,this._maxCount=t.isNullOrUndefined(n.maxFilterLimit)?1e3:n.maxFilterLimit,this._formatFiltering=!0,this._locale=this._ctrlInstance.model.locale||"en-US",this.localizedLabels=this._getLocalizedLabel(),this._filterHandler=n.filterHandler||null,this._searchHandler=this._ctrlInstance.model.searchSettings||null,this._cancelHandler=n.cancelHandler||null,this._customFilterHandler=n.customFilterHandler||null,this._cssClass=n.cssClass||null,this._matchCase=n.allowCaseSensitive||!1,this._title=n.title||this.localizedLabels.title,this._complexBlankCriteria=n.enableComplexBlankFilter,this._blankValue=n.blankValue,this.fName=n.initFilterCol||null,this._spliter=n.valueDelimiter||t.ExcelFilter.valueDelimiter,this._initialFName=this.fName,this._displayName=null,this._dataSource=null,this._isUrlAdaptor=!1,this._$tableID=null,this._$blankVal=null,this._$selectedColors=[],this._$enableColor=!1,this._$filteredByColor="",this._$colType=null,this._$key=0,this.filteredColumn=null,this.sortedColumns=null,this._chkList=null,this._listsWrap=null,this._menuWrap=null,this._localJSON=null,this._actualCount=0,this._totalRcrd=0,this._enableResponsiveRow=!1,this._searchCount=0,this._currentData=null,this._openedFltr=null,this._predicates=[],this.cFilteredCols=this.fName!=null?[this.fName]:[],this._columnsFiltered=[],this.guid=t.getGuid("excelfilter"),this._noDlg=[],this._sepAftr=["sortDesc","notequal","between","top10","endswith","contains"],this._posType=["number","date","datetime","string","boolean","guid"],this._empties=this._complexBlankCriteria?["null","undefined",""]:[this.guid],this._reqInProgess=!1,this._isFiltered=!1,this._onActionBegin=n.actionBegin||null,this._onActionComplete=n.actionComplete||null,this.maxItemOnQuery=0,this.enableNormalize=!0,this.enableSelect=!1,this._onDemandSearch=!1,this._searchRequest=!1,this._isIndeterminate=!1,this._selectAll="<div class='e-ftrchk'><input type='checkbox' class='e-selectall' value='selectall' class='e-ftrchk' /><label class='e-ftrchk'>("+this.localizedLabels.SelectAll+")<\/label><\/div>",this._blanks="<div class='e-ftrchk'><input type='checkbox' id='blanks' class='e-ftrchk' value='"+this._empties.join(this._spliter)+"' @@/><label class='e-ftrchk' for='blanks' value=''>("+this.localizedLabels.Blanks+")<\/label><\/div>",this._blank=i,this._addAtLast=!1,this.guidMenuOpt=[{id:1,text:this.localizedLabels.SortNoSmaller,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortNoLarger,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.GuidFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.GuidMenuOptions}],this.numberMenuOpt=this.booleanMenuOpt=[{id:1,text:this.localizedLabels.SortNoSmaller,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortNoLarger,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.NumberFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.NumberMenuOptions}],this.stringMenuOpt=[{id:1,text:this.localizedLabels.SortTextAscending,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortTextDescending,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.TextFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.StringMenuOptions}],this.dateMenuOpt=[{id:1,text:this.localizedLabels.SortDateOldest,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortDateNewest,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.DateFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.DateMenuOptions}],this.datetimeMenuOpt=[{id:1,text:this.localizedLabels.SortDateOldest,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortDateNewest,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.DateTimeFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.DatetimeMenuOptions}],this};t.excelFilter.prototype={isNotBlank:function(n,i){var r=t.isNullOrUndefined(n)||n===""||n===null;return i||n!==""&&n!==null||(this._addAtLast=!0),!r},_checkBlank:function(n){if(this.isNotBlank(n))return!0;var t=this._blank==i&&!this._addAtLast;return t&&(this._blank=!0),t},_getValueData:function(n,i){var r=this._empties;return this.isNotBlank(n,!0)&&(r=t.distinct(i,this._$foreignKey||this.fName,!1)),r.join(this._spliter)},getPredicate:function(n,r,u){var e,s,o,f,h;for(this._isUrlAdaptor=this._ctrlInstance._dataSource()instanceof t.DataManager&&(this._ctrlInstance._dataSource().adaptor instanceof t.UrlAdaptor||this._ctrlInstance._dataSource().adaptor instanceof t.WebMethodAdaptor),e=r!=i?[r]:t.distinct(n,"field",!1),o={},f=0,h=e.length;f<h;f++)s=new t.DataManager(n).executeLocal((new t.Query).where("field","equal",e[f])),o[e[f]]=this.generatePredicate(s),u&&(this._predicates[this._$key]=this._predicates[this._$key]||{},this._predicates[this._$key][e[f]]=o[e[f]]);return o},generatePredicate:function(n){var f=n?n.length:0,u,r,i;if(f){for(r=this._updateDateFilter(n[0]),u=this._isUrlAdaptor&&(r.type=="date"||r.type=="datetime")?this._getDatePredicate(r):r.ejpredicate?r.ejpredicate:t.Predicate(r.field,r.operator,r.value,r.ignoreCase||!r.matchcase),i=1;i<f;i++)n[i]=this._updateDateFilter(n[i]),this._isUrlAdaptor&&f>2&&i>1&&n[i].predicate=="or"?n[i].type=="date"||n[i].type=="datetime"?u.predicates.push(this._getDatePredicate(n[i])):u.predicates.push(t.Predicate(n[i].field,n[i].operator,n[i].value,n[i].ignoreCase||!n[i].matchcase)):u=this._isUrlAdaptor&&(n[i].type=="date"||n[i].type=="datetime")?u[n[i].predicate](this._getDatePredicate(n[i])):n[i].ejpredicate?u[n[i].predicate](n[i].ejpredicate):u[n[i].predicate](n[i].field,n[i].operator,n[i].value,n[i].ignoreCase||!n[i].matchcase);return u||null}},_getDatePredicate:function(n){return t.Predicate(n.field,n.operator,n.value,n.ignoreCase||!n.matchcase)},getFilterFrom:function(n,i){var i=t.distinct(i,this.fName,!1);return this.maxItemOnQuery>0&&(i=i.slice(0,this.maxItemOnQuery)),t.UrlAdaptor.prototype.getFiltersFrom(i,(new t.Query).foreignKey(this._$foreignKey))},renderDialog:function(n){this._$colType=n;var e=this.id+n+"_excelDlg",i=t.buildTag("div#"+e+".e-excelfilter e-dlgcontainer e-shadow"),r=t.buildTag("ul#"+this.id+n+"_MenuItem"),o=this._getMenuData(n);r=this._createLiTag(r,o,!1);var f=t.buildTag("span.e-searchbox e-fields").append(t.buildTag("input#"+this.id+"_SearchBox.e-ejinputtext e-searchinput",{},{},{type:"text",placeholder:this.localizedLabels.Search})).append(t.buildTag("span.e-search e-icon")),s=t.buildTag("div#"+this.id+n+"_CheckBoxList.e-checkboxlist e-fields").append(t.buildTag("div")),h=this._createBtn(),u=t.buildTag("div.e-searchcontainer"),c=t.buildTag("div.e-status e-fields e-hide",this.localizedLabels.CheckBoxStatusMsg);i.append(r);u.append(f);u.append(c);u.append(s);u.append(h);i.append(u);i.appendTo(this._ctrlInstance.element);i.css("display","none");this._renderCustomFDlg(n);this._dialogContainer=i;this._cssClass!=null&&i.addClass(this._cssClass);this._showSort||(r.find(".e-fnsort").closest("li").css("display","none"),r.find("li.e-separator:first").css("display","none"));this._lsitBoxTemplate();this._renderSubCtrls(n);t.browserInfo().name=="msie"&&t.browserInfo().version<10&&t.ieClearRemover(f.find("input")[0]);this._wireEvents()},_getDeprecatedLocalizedLabel:function(n){if(["Ok","OK"].indexOf(n)!=-1)return this.localizedLabels.Ok||this.localizedLabels.OK},_renderSubCtrls:function(i){n("#"+this.id+i+"_MenuItem").ejMenu({orientation:"vertical",width:266,container:"#"+this.id,click:t.proxy(this._menuHandler,this),enableRTL:this._ctrlInstance.model.enableRTL,enableSeparator:!1});n("#"+this.id+i+"_OkBtn").ejButton({text:this._getDeprecatedLocalizedLabel("OK"),showRoundedCorner:!0,width:60,click:t.proxy(this._fltrBtnHandler,this),enabled:!0});n("#"+this.id+i+"_CancelBtn").ejButton({text:this.localizedLabels.Cancel,showRoundedCorner:!0,width:60,click:t.proxy(this.closeXFDialog,this)});n("#"+this.id+i+"_CheckBoxList").ejScroller({height:130,width:234,scroll:t.proxy(this._virtualize,this)});n("#"+this.id+i+"_CheckBoxList").ejWaitingPopup({showOnInit:!1})},openXFDialog:function(r){var u,f,e;(this.fName=r.field,this._dataSource=r.dataSource,this._$colType=r.type||"string",this._$format=r.format||"",this._enableResponsiveRow=r.enableResponsiveRow,this.filteredColumn=r.filteredColumns||this._ctrlInstance.model.filterSettings.filteredColumns,this.sortedColumns=r.sortedColumns||this._ctrlInstance.model.sortSettings.sortedColumns,this._displayName=r.displayName,this.query=r.query||new t.Query,this._$key=r.key||0,this._$tableID=r.tableID,this._$blankVal=t.isNullOrUndefined(this._$tableID)?this._$blankVal:r.blank,this._$selectedColors=r.selectedColors||[],this._$enableColor=r.enableColor||!1,this._$filteredByColor=r.filteredByColor||this._$filteredByColor,this._$foreignField=r.foreignKeyValue,this._$foreignData=r.foreignDataSource,this._$foreignKey=r.foreignKey,this._$foreignKeyType=r.foreignKeyType,this._$foreignData instanceof t.DataManager&&(this._$foreignData.adaptor instanceof t.ODataAdaptor||this._$foreignData.adaptor instanceof t.ODataV4Adaptor||this._$foreignData.adaptor instanceof t.WebApiAdaptor)&&(this.maxItemOnQuery=50),n.extend(this.localizedLabels,r.localizedStrings||{}),e={requestType:"filterbeforeopen",filterModel:this,columnName:this.fName,columnType:this._$colType},this._ctrlInstance._trigger(this._onActionBegin,e))||(this._openedFltr!=null&&this._openedFltr.is(n("#"+this.id+this._$colType+"_excelDlg"))||(this.closeXFDialog(),this._openedFltr=n("#"+this.id+this._$colType+"_excelDlg")),this._listsWrap=n("#"+this.id+this._$colType+"_CheckBoxList"),this._menuWrap=n("#"+this.id+this._$colType+"_MenuItem"),this._searchBox=this._openedFltr.find(".e-searchbox input"),this._setPosition(this._openedFltr,r.position),this._openedFltr.addClass(r.cssClass),this._openedFltr.fadeIn(300,function(){}),f=n("#"+this.id+this._$colType+"_MenuItem").find("li[ejfnrole='popup']"),this._$enableColor?(this._createDivTag(f.eq(0).find(".e-shadow"),this._$selectedColors,!1,"sort"),this._$filteredByColor==-1||this._$filteredByColor.length<1||this._$filteredByColor===this.fName?this._createDivTag(f.eq(1).find(".e-shadow"),this._$selectedColors,!1,"filter"):f.eq(1).addClass("e-disable-item")):f.hide(),this._isFiltered=this._predicates[this._$key]!=i&&this._predicates[this._$key][this.fName]!=i,this._isFiltered=r.isFiltered||this._isFiltered,(this._$colType=="date"||this._$colType=="datetime")&&this._$format==""&&(this._$format=this._$colType=="date"?"{0:MM/dd/yyyy}":"{0:MM/dd/yyyy hh:mm:ss}"),this._processListData(),u=this._listsWrap.data("ejScroller"),this._ctrlInstance.model.enableRTL&&u.isHScroll()&&(u.scrollLeft(u.content()[0].scrollWidth-u.content()[0].clientWidth),u.refresh()),this._setDisable(),e={requestType:"filterafteropen",filterModel:this,columnName:this.fName,columnType:this._$colType},this._ctrlInstance._trigger(this._onActionComplete,e))},closeXFDialog:function(i){if(i!=null){var r=n(i.target);if(!(r.closest("#"+this.id+this._$colType+"_CustomFDlg").length>0||r.closest("#"+this.id+this._$colType+"_excelDlg").length>0))return}this._openedFltr&&(this._openedFltr.hasClass("e-dlgcustom")?this._openedFltr.ejDialog("close"):(this._openedFltr.fadeOut(300,function(){}),this._listsWrap.ejWaitingPopup("hide")),t.isNullOrUndefined(this._cancelHandler)||this._cancelHandler(),this.resetFilterModel(),this._ctrlInstance._$fDlgIsOpen=!1)},_setPosition:function(n,t){n.css("position","absolute");n.css("left",t.X).css("top",t.Y)},_setDisable:function(){var o=this._menuWrap.find("li[ejfnrole='clearfilter']"),r=this._menuWrap.find("li[ejfnrole='filterpopup']"),e=this._menuWrap.find("li[ejfnrole *= 'sort']"),s=this._listsWrap.find("input").filter(":checked:not(.e-selectall)").length,f,u,i;if(this._isFiltered?o.removeClass("e-disable-item"):o.addClass("e-disable-item"),this._showSort&&(f=t.DataManager(this.sortedColumns).executeLocal((new t.Query).where("field","equal",this.fName)),f.length&&f[0].direction=="ascending"?e.filter("[ejfnrole='sortAsc']").addClass("e-disable-item"):e.filter("[ejfnrole='sortAsc']").removeClass("e-disable-item"),f.length&&f[0].direction=="descending"?e.filter("[ejfnrole='sortDesc']").addClass("e-disable-item"):e.filter("[ejfnrole ='sortDesc']").removeClass("e-disable-item")),u=r.find(".aschild"),this.cFilteredCols.length!=0&&n.inArray(this.fName,this.cFilteredCols)!=-1){for(i=0;i<this.filteredColumn.length;i++)if(this.filteredColumn[i].field==this.fName){u.find("#ejFiltercheck").length==0&&(u.append("<input type='checkbox' id='ejFiltercheck' />"),u.find("#ejFiltercheck").ejCheckBox({checked:!0}),u.find("#ejFiltercheck").ejCheckBox("disable"));r.find(".e-shadow .e-exceltick").length>0&&r.find(".e-shadow .e-exceltick").remove();this.filteredColumn[i].field==this.fName&&!t.isNullOrUndefined(this.filteredColumn[i+1])&&this.filteredColumn[i+1].field==this.fName&&(this._$foreignField&&this.filteredColumn[i+1].customFilter||!this._$foreignField)?this.filteredColumn[i].operator=="greaterthanorequal"&&this.filteredColumn[i+1].operator=="lessthanorequal"?r.find(".e-shadow .e-list[ejvalue=between]").find("a").append("<span class='e-exceltick e-icon' />"):r.find(".e-shadow .e-list[ejvalue=customfilter]").find("a").append("<span class='e-exceltick e-icon' />"):this._$foreignField?r.find(".e-shadow .e-list[ejvalue="+this.filteredColumn[i].actualFilterOperator+"]").find("a").append("<span class='e-exceltick e-icon' />"):r.find(".e-shadow .e-list[ejvalue="+this.filteredColumn[i].operator+"]").find("a").append("<span class='e-exceltick e-icon' />");break}}else for(i=0;i<this.filteredColumn.length;i++)if(this.filteredColumn[i].field==this.fName){this._removeTick(r,u);break}this._isFiltered||u.find("#ejFiltercheck").length==0||this._removeTick(r,u);this._$colType=="boolean"&&this._menuWrap.find("li[aria-haspopup=true]").addClass("e-hide");this._searchBox.val("");this._searchBox.siblings().addClass("e-search").removeClass("e-cancel")},_removeTick:function(n,t){t.find("#ejFiltercheck").ejCheckBox("destroy");n.find(".aschild #ejFiltercheck").remove();n.find(".e-shadow .e-exceltick.e-icon").remove()},_createBtn:function(n){var i=n?this.id+this._$colType+"Custom":this.id+this._$colType,u=t.buildTag("div.e-btncontainer e-fields"),r=t.buildTag("div");return r.append(t.buildTag("input#"+i+"_OkBtn.e-fltrbtn e-btnsub e-flat",{},{},{type:"button"})).append(t.buildTag("input#"+i+"_CancelBtn.e-fltrbtn e-btncan e-flat",{},{},{type:"button"})),u.append(r)},_menuHandler:function(t){var s=n(t.element),i=s.attr("ejfnrole"),r={},h,c,f,e,o,u;if(i==="filterbgcolor"||i==="filterfgcolor")h={field:this.fName,operation:i,color:n(t.element).css("background-color")},r={originalEvent:t.event,action:"filterbycolor",filterDetails:h,tableID:this._$tableID},this._isFiltered=!1;else if(i=="clearfilter")c={field:this.fName,operator:"",value:"",predicate:"or"},r={originalEvent:t.event,fieldName:this.fName,action:"clearfiltering",filterDetails:c,tableID:this._$tableID},f=n.inArray(this.fName,this.cFilteredCols),f!=-1&&this.cFilteredCols.splice(f,1),e=n.inArray(this.fName,this._columnsFiltered),e!=-1&&this._columnsFiltered.splice(e,1),this._initialFName==this.fName&&(this._initialFName=null);else{if(i=="popup"||i=="filterpopup")return;i=="operator"?this._openCustomFilter(s.attr("ejvalue")):i=="sortAsc"||i=="sortDesc"?(o=i=="sortAsc"?"ascending":"descending",u={field:this.fName,direction:o},r={originalEvent:t.event,action:"sorting",sortDetails:u,tableID:this._$tableID}):(u={field:this.fName,direction:o,operation:i,color:n(t.element).css("background-color")},r={originalEvent:t.event,action:"sortbycolor",sortDetails:u,tableID:this._$tableID})}i!="operator"&&(this._filterHandler(r),this.closeXFDialog())},_searchBoxFocus:function(t){var i=n(t.target);i.hasClass("e-cancel")&&(i.prev().val(""),i.next().addClass("e-cancel"),i.addClass("e-search"),i.prev().trigger("keyup"));t.type=="focusin"&&(i.next().addClass("e-cancel"),i.next().removeClass("e-search"))},_search:function(r){var e=r.target.value,u,o,f=n(r.target);(u=this.getType()!="string"&&parseFloat(e)?parseFloat(e):e,o="contains",u=u==""||u==i?i:u,this._$colType=="boolean"&&(u!=i&&this.localizedLabels.True.toLocaleLowerCase().indexOf(u.toLowerCase())!=-1?u="true":u!=i&&this.localizedLabels.False.toLocaleLowerCase().indexOf(u.toLowerCase())!=-1&&(u="false")),this._$colType!="date"&&this._$colType!="datetime"||(u=t.parseDate(e,this.replacer(this._$format,/{0:|}/g,"")),o="equal",this._previousValue!=null||u!=null))&&(this._previousValue=u,delay=this._dataSource instanceof t.DataManager&&this._ctrlInstance.model.pageSettings.totalRecordsCount>this._ctrlInstance.model.filterSettings.maxFilterChoices?1500:0,sender={type:"filterchoicesearch",value:u,operator:o,matchcase:["date","datetime"].indexOf(this._$colType)!=-1?!1:this._matchCase},this._processSearch(sender,delay),f.val()==""?(f.next().addClass("e-search"),f.next().removeClass("e-cancel")):(f.next().addClass("e-cancel"),f.next().removeClass("e-search")))},_processSearch:function(n,t){this._alreadySearchProcessed?(this._stopTimer(),this._startTimer(n,t)):(this._alreadySearchProcessed=!0,this._startTimer(n,t))},_startTimer:function(n,t){this._timer=window.setTimeout(function(){proxy._processListData(n)},t)},_stopTimer:function(){this._timer!=null&&window.clearTimeout(this._timer)},_getLocalizedLabel:function(){return t.getLocalizedConstants("ej.ExcelFilter",this._locale)},_getMenuData:function(n){return n!=i?this[n+"MenuOpt"]:[]},_lsitBoxTemplate:function(){var i={},u={},r;i[this.id+"isNotBlank"]=t.proxy(this.isNotBlank,this);i[this.id+"checkBlank"]=t.proxy(this._checkBlank,this);i[this.id+"_getValueData"]=t.proxy(this._getValueData,this);i[this.id+"_checkBoxState"]=t.proxy(this._setCheckState,this);i[this.id+"_genId"]=this._genCheckID;n.views.helpers(i);r=this.id+this._$colType+"{{:~"+this.id+"_genId()}}";u[this.id+this._$colType+"_listBox_Template"]="{{if ~"+this.id+"checkBlank(key)}}<div class='e-ftrchk'><input type='checkbox' id='"+r+"' value='{{html:~"+this.id+"_getValueData(key, items)}}' class='e-ftrchk' {{:~"+this.id+"_checkBoxState(~"+this.id+"_getValueData(key, items))}}/><label class='e-ftrchk' for='"+r+"'>{{if ~"+this.id+"isNotBlank(key,'true')}} {{>key}} {{else}} (Blanks) {{/if}}<\/label><\/div>{{/if}}";n.templates(u)},_processListData:function(n){var e,u={},r=new t.Query,k=(new t.Query).requiresCount(),h={},v,o,y,l,b,s;this._searchCount=0;var p=this._predicates[this._$key],c,f=null,a=null,w=null,s=null;t.isNullOrUndefined(this._$foreignField&&this._$foreignData)?(f=this._dataSource,a=this.fName,w=this._localJSON):(f=w=this._$foreignData,this._dataSource instanceof t.DataManager&&!(f instanceof t.DataManager)&&(f=t.DataManager(f)),a=this._$foreignField);for(v in p)v!=this.fName&&(o=p[v],y=o.from,y?r.skip(y=="top"?0:f.length-(f.length-o.take)).take(o.take):c=c!=i?c.and(o):o);(u.columnName=a,r.requiresCount(),this._dataSource instanceof t.DataManager&&!this._dataSource.dataSource.offline&&this._ctrlInstance.model.pageSettings.totalRecordsCount>this._ctrlInstance.model.filterSettings.maxFilterChoices&&(r.take(this.maxFilterChoices),this._onDemandSearch=!0),c&&r.where(c),t.merge(r.queries,this.query.queries)||t.merge(r._params,this.query._params),h.requestType=n?n.type:"filterchoicerequest",h.filterModel=this,h.query=r,h.dataSource=f,this._ctrlInstance._trigger(this._onActionBegin,h))||(!t.isNullOrUndefined(this._searchHandler)&&this._searchHandler.key.length&&(l=this._searchHandler,r.search(l.key,l.fields,l.operator||"contains",l.ignoreCase||!0)),this.enableSelect&&r.select(this.fName),n&&n.type=="filterchoicesearch"?(u.type=n.type,this._$foreignField&&(r=k),n.value&&r.where(a,n.operator,n.value,!n.matchcase),this._dataSource instanceof t.DataManager&&this._ctrlInstance.model.pageSettings.totalRecordsCount>this._ctrlInstance.model.filterSettings.maxFilterChoices?(this._searchRequest=!0,this._listsWrap.ejWaitingPopup("show"),this._$foreignField?(b=this._$foreignData instanceof t.DataManager?this._$foreignData:t.DataManager(this._$foreignData),this._dataProcessing(b,r,u)):this._dataProcessing(this._dataSource,r,u)):this._dataProcessing(t.DataManager(this._localJSON),r,u)):this._dataSource instanceof t.DataManager?(proxy=this,u.type="filterchoicerequest",this._listsWrap.ejWaitingPopup("show"),this._reqInProgess||(this._reqInProgess=!0,this._$foreignField&&(f=this._dataSource),e=f.executeQuery(r),e.done(function(n){proxy._$foreignField?proxy._filterForeignData(n,u):(s=n.result,u.data=proxy._localJSON=proxy._currentData=s,proxy._totalRcrd=n.count,proxy._listsWrap.ejWaitingPopup("hide"),proxy._setCheckBoxList(u),proxy._reqInProgess=!1)}))):(s=[],e=t.DataManager(this._dataSource).executeLocal(r),u.type="filterchoicerequest",this._$foreignField?this._filterForeignData(e,u):(s=e.result,u.data=this._localJSON=this._currentData=s,this._totalRcrd=e.count,this._setCheckBoxList(u))))},_dataProcessing:function(n,t,i){var r;r=n.executeQuery(t);r.done(function(n){i.data=proxy._currentData=n.result;proxy._totalRcrd=proxy._searchCount=n.result.length;proxy._setCheckBoxList(i)})},_filterForeignData:function(i,r){var a=typeof r=="boolean",h=this._$foreignKey,c=this._$foreignField,b=this._$foreignKeyType,v,l,f=this,y={},e,p,o=new t.Query,k=this._$foreignData instanceof t.DataManager?this._$foreignData:t.DataManager(this._$foreignData),s,u,w;if(a){for(u=i[0],y=i[0],p=i.slice(),!u||this.closeXFDialog(),e=new t.Predicate(c,u.operator,u.value,!u.matchcase),s=1,w=i.length;s<w;s++)u=i[s],e=e[u.predicate](c,u.operator,u.value,!u.matchcase);o.where(e)}else v=i.result,l=i.count,!l||o.where(this.getFilterFrom(this._$foreignData,v)),this._listsWrap.ejWaitingPopup("model.showOnInit")||this._listsWrap.ejWaitingPopup("show");o.select([h,c]);k.executeQuery(o).done(function(i){if(a){var u=t.distinct(i.result,h,!0),u=0 in u?u:[{}],e=u.map(function(t){return n.extend({},y,{value:t[h],operator:"equal",actuals:p,type:b})});f.initiateFilter(e)}else r.data=f._localJSON=f._currentData=i.result,f._totalRcrd=l,f._listsWrap.ejWaitingPopup("hide"),f._setCheckBoxList(r),f._reqInProgess=!1})},_setCheckBoxList:function(i){var u={},f,e,o=this._blanks,r;(u.requestType=i.type,u.dataSource=this._dataSource,u.filterModel=this,this._currentData.length!=0?(f=this.getDistinct(i.data,i.columnName,!0,!!this._$foreignKey),e=this._isFiltered,this._actualCount=f.length,f.length=this._maxCount>this._actualCount?this._actualCount:this._maxCount,this._onDemandSearch&&this._actualCount==1e3||this._actualCount>=this._maxCount?this._openedFltr.find("div.e-status").removeClass("e-hide"):this._openedFltr.find("div.e-status").addClass("e-hide"),this._filterdCol=t.DataManager(this.filteredColumn).executeLocal(t.Query().where("field","equal",this.fName)),this._listsWrap.find("div:first").html([this._selectAll,n.render[this.id+this._$colType+"_listBox_Template"](f),this._addAtLast?this.replacer(o,/@@/g,this._setCheckState,this._empties.join(this._spliter)):""].join("")),this._chkList=this._listsWrap.find("input:checkbox").not(".e-selectall"),$inView=this._chkList.slice(0,20),$inView.ejCheckBox({change:t.proxy(this._checkHandler,this)}),$inView.siblings().height(14).width(14),this._listsWrap.find(".e-selectall").ejCheckBox({change:t.proxy(this._selectAllHandler,this),enableTriState:this._interDeterminateState}),this._listsWrap.find(".e-selectall").attr("id",this.id+this._$colType+"SelectAll"),this._listsWrap.find(".e-selectall").siblings().height(14).width(14),this._listsWrap.find(".e-selectall").closest("span").siblings("label").attr("for",this.id+this._$colType+"SelectAll")):(this._listsWrap.find("div").first().html(t.buildTag("div.e-ftrchk",this.localizedLabels.NoResult,{},{})),this._chkList=this._listsWrap.find("input:checkbox").not(".e-selectall")),t.isNullOrUndefined(this._chkList)||(r=this._chkList.filter(":checked").length),this._isFiltered&&this._searchRequest&&r==0&&this._checkIsIndeterminate(i.columnName,this.filteredColumn),this._isFiltered&&this._actualCount!=r?(r>0||this._isIndeterminate&&this._interDeterminateState)&&this._listsWrap.find(".e-selectall").ejCheckBox("model.checkState","indeterminate"):this._listsWrap.find(".e-selectall").ejCheckBox({checked:!0}),n("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:r!=0}),this._listsWrap.ejScroller({scrollTop:0}).ejScroller("refresh"),this._listsWrap.hasClass("e-waitingpopup")&&this._listsWrap.ejWaitingPopup("hide"),this._ctrlInstance._trigger(this._onActionComplete,u))||(this._isIndeterminate=!1)},_checkIsIndeterminate:function(n,t){for(var i=0;i<t.length;i++)n==t[i].field&&(this._isIndeterminate=!0)},_createLiTag:function(r,u,f){return proxy=this,n.each(u,function(u,e){var s=t.buildTag("li",{},{},e.htmlAttribute||f&&{ejfnrole:"operator",ejvalue:e.value}||{}),h,c=f&&n.inArray(e.value,proxy._noDlg)==-1?"...":"",o=t.buildTag("a",e.text+c,{},{});e.sprite!=i&&o.append(t.buildTag("span",{},{},{"class":e.sprite}));e.child!=i&&(h=e.id!=3&&e.id!=5?proxy._createLiTag(t.buildTag("ul.e-shadow"),e.child,!0):e.id===3?proxy._createDivTag(t.buildTag("ul.e-shadow"),e.child,!0,"sort"):proxy._createDivTag(t.buildTag("ul.e-shadow"),e.child,!0,"filter"));e.child==i?r.append(s.append(o)):r.append(s.append(o).append(h));n.inArray(e.value||e.htmlAttribute&&e.htmlAttribute.ejfnrole,proxy._sepAftr)!=-1&&r.append(t.buildTag("li.e-separator"))}),r},_createDivTag:function(n,i,r,u){var e,l,s=[],h=[],c=!1,a="",v="",y="",p="",w="",b="",o,f;if(u=="sort"?(a=this.localizedLabels.SortByCellColor,v=this.localizedLabels.SortByFontColor):(a=this.localizedLabels.FilterByCellColor,v=this.localizedLabels.FilterByFontColor),y=u+"colorhdr",w=u+"fonthdr",p=u+"bgcolor",b=u+"fgcolor",n.length>0&&n.children().remove(),i.length>0){for(f=0;f<i.length;f++){for(o=0;o<s.length;o++)if(s[o]==i[f].background){c=!0;break}for(c||t.isNullOrUndefined(i[f].background)||i[f].background.startsWith("#6n")||s.push(i[f].background),c=!1,o=0;o<h.length;o++)if(h[o]==i[f].foreground){c=!0;break}c||t.isNullOrUndefined(i[f].foreground)||i[f].foreground.startsWith("#6n")||h.push(i[f].foreground);c=!1}if(s.length>0)for(e=t.buildTag("li.e-list e-bghdrcolor","","",{ejfnrole:y}),l=t.buildTag("a.e-menulink",a,{}),e.append(l),n.append(e),f=0;f<s.length;f++)e=t.buildTag("li.e-list e-valcolor",{},{"background-color":s[f]},{ejfnrole:p}),n.append(e);if(h.length>0)for(e=t.buildTag("li.e-list e-fghdrcolor","","",{ejfnrole:w}),l=t.buildTag("a.e-menulink",v,{}),e.append(l),n.append(e),f=0;f<h.length;f++)e=t.buildTag("li.e-list e-valcolor",{},{"background-color":h[f]},{ejfnrole:b}),n.append(e);s.length<1&&h.length<1?n.parent().addClass("e-disable-item"):n.parent().removeClass("e-disable-item")}else n.parent().addClass("e-disable-item");return n},_setCheckState:function(n){var i=n,f=n.split(this._spliter),e=f.length,r,o,s,h,u;if(!this._isFiltered||this._searchCount)return"checked";while(e--)if(i=this.processValue(f[e]),this._$colType=="date"||this._$colType=="datetime"||this._$colType=="boolean"){for(r=0,o=this._filterdCol.length;r<o;r++)if((this._$colType!="boolean"||i===this._filterdCol[r].value)&&(this._$colType!="date"&&this._$colType!="datetime"||(s=this._$colType=="date"&&i instanceof Date?this._formatting(this._$format,new Date(i.getFullYear(),i.getMonth(),i.getDate()),this._locale):this._formatting(this._$format,i,this._locale),h=this._formatting(this._$format,this._filterdCol[r].value,this._locale),s===h)))return"checked"}else if(u=t.DataManager(this._filterdCol).executeLocal(t.Query().where("value","equal",i).where("operator","equal","equal")),u.length!=0)return u[0].operator=="equal"&&u[0].isCustom==!0&&this._ctrlInstance.model.currentViewData.length>0?"checked":u[0].isCustom===!0?"":"checked"},_genCheckID:function(){return"CheckBox"+this.getIndex()},_formatting:function(n,t,i){if(this._$colType=="date"&&n==""&&(n="{0:MM/dd/yyyy hh:mm:ss}"),this._$colType=="boolean")return t===""?"":this.localizedLabels[t==!0?"True":t==!1?"False":""];if(this._formatFiltering||this._$colType=="date"){var r=this._ctrlInstance.formatting;return n!=""?r(n,t,i):t}},_updateDateFilter:function(n){return n.type!="date"&&!(n.value instanceof Date)?n:(n.value=n.value instanceof Date?n.value:t.parseJSON({val:n.value}).val,["equal","notequal"].indexOf(n.operator)==-1?n:this._setDateObject(n))},_checkHandler:function(t){n("#"+t.model.id).prop("checked",t.isChecked);var f=this._listsWrap.find("input.e-ftrchk").filter(":checked:not(.e-selectall)"),r=f.length,i=this._listsWrap.find(".e-selectall"),u;r==this._chkList.length?(i.prop("checked",!0),u=!0):r!=0&&this._interDeterminateState?t.isInteraction&&i.ejCheckBox("model.checkState","indeterminate"):(i.prop("checked",!1),u=!1);i.ejCheckBox({checked:u});n("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:r!=0})},_selectAllHandler:function(t){t.checkState=="check"?(this._chkList.filter(":not(:checked)").ejCheckBox({checked:t.isChecked}),this._chkList.prop("checked",!0)):t.checkState=="uncheck"&&(this._chkList.filter(function(){if(n(this).hasClass("e-checkbox")&&n(this).prop("checked"))return this}).ejCheckBox({checked:t.isChecked}),this._chkList.prop("checked",!1),this._chkList.removeAttr("checked"));n("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:t.isChecked})},_renderCustomFDlg:function(i){var u=this.id+i+"_CustomFDlg",r;n("#"+u).length||(r=t.buildTag("div#"+u+".e-excelfilter e-dlgcustom"),r.addClass(this._cssClass),this._renderCDlgContent(r,i),r.ejDialog({showOnInit:!1,enableResize:!1,enableModal:!0,allowKeyboardNavigation:!1,title:this._title,width:370,content:"#"+this.id,enableRTL:this._ctrlInstance.model.enableRTL,closeIconTooltip:"Close",cssClass:"e-excelfilter e-customDlg"}),r.ejDialog("refresh"))},_renderCDlgContent:function(i,r){var k=t.buildTag("div.e-dlgfields",this.localizedLabels.Showrowswhere,{},{}),u=this.id+this._$colType,l=t.buildTag("fieldset.e-fieldset"),a=t.buildTag("tr.e-fields"),v=t.buildTag("tr.e-fields"),y=t.buildTag("tr.e-fields e-top"),f=t.buildTag("input#"+u+"_CustomDrop1"),e=t.buildTag("input#"+u+"_CustomDrop2"),d=t.buildTag("input#"+u+"_CustomDrop3"),o=t.buildTag("input#"+u+"_CustomValue1.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),s=t.buildTag("input#"+u+"_CustomValue2.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),g=t.buildTag("input#"+u+"_CustomValue3.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),c=t.buildTag("tr.e-predicate"),p=t.buildTag("input#"+u+"_CustomAndPredicate",{},{},{type:"radio",name:"predicate",value:"and"}),w=t.buildTag("input#"+u+"_CustomOrPredicate",{},{},{type:"radio",name:"predicate",value:"or"}),b=t.buildTag("input#"+u+"_CustomMatchPredicate",{},{},{type:"checkbox"}),h,nt;i.append(k);h=t.buildTag("table.e-optable");a.append(t.buildTag("td.e-operator").append(f)).append(t.buildTag("td.e-value").append(o));c.append(t.buildTag("td",{},{},{}).append(p).append(t.buildTag("label.e-caption",this.localizedLabels.PredicateAnd,{},{"for":u+"_CustomAndPredicate"})).append(w).append(t.buildTag("label.e-caption",this.localizedLabels.PredicateOr,{},{"for":u+"_CustomOrPredicate"})));v.append(t.buildTag("td.e-operator").append(e)).append(t.buildTag("td.e-value").append(s));h.append(a).append(c).append(v);r=="string"&&c.append(t.buildTag("td",{},{},{}).append(b).append(t.buildTag("label.e-caption",this.localizedLabels.MatchCase,{},{"for":u+"_CustomMatchPredicate"})));(r=="number"||r=="guid")&&(y.append(t.buildTag("td.e-operator").append(d)).append(t.buildTag("td.e-value").append(g)),h.append(y));l.append(t.buildTag("legend")).append(h);i.append(t.buildTag("div.e-dlgfields").append(l));i.append(t.buildTag("div.e-dlgfields").append(this._createBtn(!0)));i.appendTo("body");nt=r.replace(r.charAt(0),r.charAt(0).toUpperCase());n([f,e]).ejDropDownList({fields:{text:"text",value:"value"},height:27,width:120,enableRTL:this._ctrlInstance.model.enableRTL});r=="number"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n([o,s]).ejNumericTextbox({showSpinButton:!1,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.NumericTextboxWaterMark,focusOut:function(){this.model.decimalPlaces==0&&this.element.prev(".e-input").val(this.model.value)}})):r=="guid"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n(o).css({height:"22px",width:"175px"}),n(s).css({height:"22px",width:"177px"})):r=="date"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n([o,s]).ejDatePicker({cssClass:this._ctrlInstance.model.cssClass,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.DatePickerWaterMark,locale:this._locale})):r=="datetime"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n([o,s]).ejDateTimePicker({cssClass:this._ctrlInstance.model.cssClass,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.DateTimePickerWaterMark,locale:this._locale})):r=="string"&&n([o,s]).ejAutocomplete({cssClass:this._ctrlInstance.model.cssClass,enableRTL:this._ctrlInstance.model.enableRTL,enableDistinct:!0,width:"177px",height:"27px",locale:this._locale});n([p,w]).ejRadioButton({cssClass:this._ctrlInstance.model.cssClass,enableRTL:this._ctrlInstance.model.enableRTL});b.ejCheckBox({});n("#"+u+"Custom_OkBtn").ejButton({text:this._getDeprecatedLocalizedLabel("OK"),showRoundedCorner:!0,width:"23.6%",click:t.proxy(this._fltrBtnHandler,this),enabled:!0});n("#"+u+"Custom_CancelBtn").ejButton({text:this.localizedLabels.Cancel,showRoundedCorner:!0,width:"23.6%",click:t.proxy(this.closeXFDialog,this)})},_openCustomFilter:function(i){var o=i!="top10"?this._$colType:i,a=this.query,s=o.replace(o.charAt(0),o.charAt(0).toUpperCase()),r=this.id+this._$colType,h,f,e,c,l,u;(this.closeXFDialog(),this._openedFltr=n("#"+r+"_CustomFDlg"),u={requestType:"filterbeforeopen",filterModel:this,columnName:this.fName,columnType:this._$colType,isCustomFilter:!0},this._ctrlInstance._trigger(this._onActionBegin,u))||(this._openedFltr.ejDialog("open"),this._openedFltr.ejDialog({open:function(){n("#"+r+"_CustomValue1").hasClass("e-autocomplete")?n("#"+r+"_CustomValue1").focus():n("#"+r+"_CustomValue1").prev().focus()}}),this._openedFltr.find("legend").html(this._displayName),h=["Number","Date"].indexOf(s)!=-1?6:5,f=this.localizedLabels[s+"MenuOptions"].slice(0,h),f.unshift({text:"",value:""}),n("#"+r+"_CustomDrop1").ejDropDownList({dataSource:f}),n("#"+r+"_CustomDrop2").ejDropDownList({dataSource:f}),this._$colType=="number"?(e=0,i=="top10"?(this._openedFltr.find(".e-optable tr").not(".e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr.e-top").removeClass("e-hide"),n("#"+r+"_CustomDrop3").ejDropDownList({dataSource:this.localizedLabels[s+"MenuOptions"]})):(e=this._$format.length!=0?parseInt(this._$format.replace(/\D/g,"")):0,this._openedFltr.find(".e-optable tr.e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr").not(".e-top").removeClass("e-hide"),n("#"+r+"_CustomValue1").ejNumericTextbox("model.decimalPlaces",e),n("#"+r+"_CustomValue2").ejNumericTextbox("model.decimalPlaces",e))):(this._openedFltr.find(".e-optable tr.e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr").not(".e-top").removeClass("e-hide")),this._$colType=="string"&&(c=this._$foreignField?this._$foreignField:this.fName,l=this._$foreignData&&this._$foreignField?this._$foreignData:this._dataSource,this._openedFltr.find(".e-autocomplete").ejAutocomplete({fields:{text:c},dataSource:l,query:a,focusIn:function(){var n=this.element.closest("td").siblings().find(".e-dropdownlist").ejDropDownList("getSelectedValue"),t=this.element.closest(".e-dialog-scroller").find(".e-checkbox").prop("checked");this.model.caseSensitiveSearch=t;this.model.filterType=n==""?this.model.filterType:n}})),this._$colType=="date"&&this._$format!=""?this._openedFltr.find(".e-datepicker").ejDatePicker({dateFormat:this._$format.replace(/{0:|}/g,function(){return""}),enableStrictMode:!0}):this._$colType=="datetime"&&this._$format!=""&&this._openedFltr.find(".e-datetimepicker").ejDateTimePicker({dateTimeFormat:this._$format.replace(/{0:|}/g,function(){return""}),enableStrictMode:!0}),this._setFilteredData(r,i),t.isNullOrUndefined(this._customFilterHandler)||this._customFilterHandler(),u={requestType:"filterafteropen",filterModel:this,columnName:this.fName,columnType:this._$colType,isCustomFilter:!0},this._ctrlInstance._trigger(this._onActionComplete,u))},_setFilteredData:function(r,u){var o=n.inArray(this.fName,this.cFilteredCols),e=[],v=[],s,f,c,l,p,w;if(u!="top10"){o!=-1&&(e=t.DataManager(this.filteredColumn).executeLocal(t.Query().where("field","equal",this.fName)));o!=-1&&this._$foreignField&&(e=e[0].actuals);this._initialFName!=null&&this._initialFName==this.fName&&(e[0].isCustom=!0);s=e.length;var a=this._openedFltr.find(".e-dropdownlist"),h=this._openedFltr.find(".e-value input.e-ejinputtext.e-input"),y=this._openedFltr.find(".e-predicate");for(v=o!=-1&&s&&e[0].from!=i?[u,""]:u=="between"&&o!=-1&&s?[e[0].operator,t.isNullOrUndefined(e[1])?"":e[1].operator]:o!=-1&&s&&e[0].isCustom?[u!="customfilter"&&o!=-1?u:e[0].operator,u=="customfilter"&&e[1]?e[1].operator:""]:o==-1&&u=="customfilter"?["equal",""]:u=="between"||u=="customfilter"?u!="customfilter"?["greaterthanorequal","lessthanorequal"]:["",""]:[u,""],f=0;f<(o!=-1?s:2);f++)c=/\D*/.exec(v[f])[0],n(a[f]).prop("value",c),n(a[f]).ejDropDownList("setSelectedValue",c),n(a[f]).ejDropDownList({change:function(){this.element.closest(".e-fields").find(".e-autocomplete").val("")}}),l=o!=-1&&s&&e[f].isCustom&&(c==(this._$foreignField?e[f].actualFilterOperator:e[f].operator)||c=="customfilter"||c=="between")?this._$foreignField?c!=""?e[f].actualFilterValue:"":e[f].value:"",n(h[f]).hasClass("e-datepicker")?n("#"+h[f].id).ejDatePicker("model.value",o!=-1&&s&&e[f].isCustom?e[f].value:null):n(h[f]).hasClass("e-numerictextbox")?n("#"+h[f].id).ejNumericTextbox("model.value",l):n(h[f]).hasClass("e-datetimepicker")?n(h[f]).ejDateTimePicker("model.value",l):n(h[f]).val(l),p=o!=-1&&s&&e[f].isCustom&&e[f].predicate!=i?this._$foreignField?e[f].actualPredicate:e[f].predicate:"and",y.find("input[value="+p+"]").ejRadioButton({checked:!0}),this._$colType=="string"&&(w=o!=-1&&s&&e[f].isCustom?e[f].matchcase:this._matchCase,y.find("input.e-js[type='checkbox']").ejCheckBox({checked:w})),this._openedFltr.find(".e-value input:visible:eq(0)").select()}},_setDateObject:function(i){var f;if(i.value!=null){var s=i.value,u=n.extend(!0,{},i),r=n.extend(!0,{},i),e=new Date(u.value.setSeconds(u.value.getSeconds()-1)),o=new Date(r.value.setSeconds(r.value.getSeconds()+2));return i.value=new Date(i.value.setSeconds(r.value.getSeconds()-1)),u.value=e,r.value=o,i.operator=="equal"?(u.operator="greaterthan",u.predicate="and",r.operator="lessthan",r.predicate="and"):i.operator=="notequal"&&(u.operator="lessthanorequal",u.predicate="or",r.operator="greaterthanorequal",r.predicate="or"),f=t.Predicate(u.field,u.operator,u.value,!1),f=f[r.predicate](r.field,r.operator,r.value,!1),i.ejpredicate=f,i.type="date",i}return i},_getCDlgFields:function(){var h=this._openedFltr.find(".e-dropdownlist"),f,y=this._openedFltr.find(".e-checkbox"),c=!0,e=[],s=this._openedFltr.find(".e-value input.e-ejinputtext.e-input"),p=this._openedFltr.find(".e-value input"),w=this._openedFltr.find(".e-predicate input[type='radio']:checked").val(),r,l,t,u,a,v,o;for(n.inArray(this.fName,this.cFilteredCols)==-1&&this.cFilteredCols.push(this.fName),r=0,l=h.length;r<l;r++)if(t=n(h[r]).ejDropDownList("getSelectedValue"),this._$colType=="number"&&(u=parseFloat(s.eq(r).ejNumericTextbox("model.value"))),this._$colType=="guid"&&(u=p.eq(r).val()),this._$colType=="string"&&(u=s.eq(r).val(),c=y.is(":checked")),this._$colType=="date"&&(u=s.eq(r).ejDatePicker("model.value")),this._$colType=="datetime"&&(u=s.eq(r).ejDateTimePicker("model.value")),f={field:this.fName,predicate:r==1?w:"or",matchcase:c,isCustom:!0},t=="top"||t=="bottom")e.push(n.extend(!0,{value:"",operator:"notequal",take:u,from:t},f));else if(t!="")this._empties.indexOf(u+"")>-1||this._$colType=="number"&&isNaN(u)?(a=this.iterateAndGetCollection(this._empties.join(this._spliter),n.extend({},f,{predicate:t.toLowerCase()==="notequal"?"and":"or",operator:t.toLowerCase()})),v=this.generatePredicate(a),e.push(n.extend({},f,{ejpredicate:v,operator:t.toLowerCase()}))):(o={},n.extend(!0,o,{value:u,operator:t.toLowerCase(),isCustom:!0,actualFilterOperator:t.toLowerCase(),actualFilterValue:u,actualPredicate:f.predicate},f),this._$colType=="date"&&(o.type="date"),e.push(this._$colType=="date"&&["equal","notequal"].indexOf(t.toLowerCase())!=-1?this._setDateObject(o):o));else break;this._$foreignField==i?this.initiateFilter(e):this._filterForeignData(e,!0)},_fltrBtnHandler:function(){var i=[],u={},f,e;if(this._openedFltr.hasClass("e-dlgcustom"))i=this._getCDlgFields(),n.inArray(this.fName,this.cFilteredCols)==-1&&i[0]&&this.cFilteredCols.push(this.fName);else{if(!this._isFiltered&&this._listsWrap.find(".e-selectall").ejCheckBox("model.checked")&&this._searchCount==0)return this.closeXFDialog();var o=this._listsWrap.find("input.e-ftrchk").filter(":checked:not(.e-selectall)"),c=o.length,r,s=this.getType(),l=this._colType=="string"?"startswith":"equal",a=this._colType=="string"?this._matchCase:!0,h={field:this.fName,predicate:"or",operator:l,matchcase:a};for(f=0;f<c;f++){if(r=o[f].value,this.enableNormalize&&r.indexOf(this._spliter)!=-1){t.merge(i,this.iterateAndGetCollection(r,h));continue}r=this.processValue(r,s);n.extend(!0,u,{value:r},h);i.push(s=="date"?this._setDateObject(u):u);u={}}e=n.inArray(this.fName,this.cFilteredCols);e!=-1&&this.cFilteredCols.splice(e,1);this._isFiltered&&this._searchRequest&&(this._checkIsIndeterminate(this.fName,this.filteredColumn),this._isIndeterminate&&(t.merge(i,this.filteredColumn),i=t.distinct(i,"value",!0),this._searchRequest=!1));this.initiateFilter(i)}},initiateFilter:function(r){var f=r[0],e,u,o;if(!t.isNullOrUndefined(f)){for(isTake=f.from,e=f.ejpredicate?f.ejpredicate:t.Predicate(f.field,f.operator,f.value,!f.matchcase),u=1,o=r.length;u<o;u++)e=r[u].ejpredicate!=i?e[r[u].predicate](r[u].ejpredicate):e[r[u].predicate](r[u].field,r[u].operator,r[u].value,!r[u].matchcase);arg={action:"filtering",filterCollection:r,fieldName:this.fName,ejpredicate:e,tableID:this._$tableID};this._predicates[this._$key]==i&&(this._predicates[this._$key]={});this._predicates[this._$key][this.fName]=isTake?{from:f.from,take:f.take}:e;this._openedFltr.hasClass("e-dlgcustom")||!this._listsWrap.find(".e-selectall").ejCheckBox("model.checked")||this._searchCount||n.inArray(this.fName,this._columnsFiltered)==-1||(arg={action:"clearfiltering",filterDetails:{field:this.fName,operator:"",predicate:"or",value:""},fieldName:this.fName,tableID:this._$tableID});n.inArray(this.fName,this._columnsFiltered)==-1&&this._columnsFiltered.push(this.fName);this._filterHandler(arg)}this.closeXFDialog()},getDistinct:function(n,i,r,u){for(var s={},h=n.length,c=[],e,f,o;h--;)e=n[h],f=t.getObject(i,e),o=f,t.isNullOrUndefined(e)||(this.enableNormalize&&(o=this._formatting(this._$format,f,this._locale)),e.ejvalue=o,!u&&f in s||c.push(r?e:f),s[f]=!0);return t.group(t.mergeSort(c,i),"ejvalue")},iterateAndGetCollection:function(t,i){for(var r=t.split(this._spliter),u=r.length,f=[],e;u--;)e=this.processValue(r[u]),f.push(n.extend(!0,{value:e},i));return f},processValue:function(n,r){r=r||this.getType();r=this._empties.indexOf(n)!=-1?"empty":r;n=n===this.guid?this._blankValue+"":n;switch(r){case"empty":n=n=="null"?null:n=="undefined"?i:"";break;case"date":case"datetime":n=new Date(n);break;case"number":n=+n;break;case"boolean":n=!isNaN(n)&&typeof n=="string"?t.parseInt(n)!=0:n==="true"?!0:!1}return n},getType:function(){return t.isNullOrUndefined(this._$foreignField)?this._$colType:this._$foreignKeyType},replacer:function(n,t,i,r){return typeof i=="function"&&(i=i.call(this,r)),n.replace(t,i)},_virtualize:function(i){var f=n("#"+this.id+this._$colType+"_CheckBoxList").height(),r=this._chkList.not(".e-checkbox").filter(function(){if(this.offsetTop>i.scrollTop-this.offsetHeight&&i.scrollTop+f+70>this.offsetTop+this.offsetHeight)return this}),u;r.length!=0&&(r.filter(":checked").ejCheckBox({checked:!0}),r.filter(":not(:checked)").ejCheckBox({checked:!1}),r.ejCheckBox({change:t.proxy(this._checkHandler,this)}),u=this._listsWrap.ejScroller("instance"),u.refresh())},resetFilterModel:function(){this._blank=i;this._addAtLast=!1;this._isFiltered=!1;this._searchCount=0},resetExcelFilter:function(){var u,i,e=this.id,f,r,t;for(this._predicates=[],this.cFilteredCols=[],this.resetFilterModel(),u=0,f=this._posType.length;u<f;u++)i=this._posType[u],r=e+i,t=n("#"+r+"_CustomFDlg"),n("#"+r+"_CheckBoxList").ejWaitingPopup("destroy"),n("#"+r+"_excelDlg").remove(),t.find(".e-dropdownlist").ejDropDownList("destroy"),t.find(".e-button").ejButton("destroy"),(i=="string"||i=="boolean")&&t.find(".e-autocomplete").ejAutocomplete("destroy"),i=="number"&&t.find(".e-numerictextbox").ejNumericTextbox("destroy"),i=="date"&&t.find(".e-datepicker").ejDatePicker("destroy"),t.ejDialog("destroy"),n("#"+r+"_CustomFDlg").remove()},_wireEvents:function(){this._ctrlInstance._on(this._dialogContainer,"focus click",".e-searchbox",t.proxy(this._searchBoxFocus,this));this._ctrlInstance._on(this._dialogContainer,"keyup",".e-searchbox input",t.proxy(this._search,this))}};t.ExcelFilter.valueDelimiter="@|@";t.ExcelFilter.Locale=t.ExcelFilter.Locale||{};t.ExcelFilter.Locale["default"]=t.ExcelFilter.Locale["en-US"]={SortNoSmaller:"Sort Smallest to Largest",SortNoLarger:"Sort Largest to Smallest",SortTextAscending:"Sort A to Z",SortTextDescending:"Sort Z to A",SortDateOldest:"Sort by Oldest",SortDateNewest:"Sort by Newest",SortByColor:"Sort By Color",SortByCellColor:"Sort by Cell Color",SortByFontColor:"Sort by Font Color",FilterByColor:"Filter By Color",CustomSort:"Custom Sort",FilterByCellColor:"Filter by Cell Color",FilterByFontColor:"Filter by Font Color",ClearFilter:"Clear Filter",NumberFilter:"Number Filters",GuidFilter:"Guid Filters",TextFilter:"Text Filters",DateFilter:"Date Filters",DateTimeFilter:"Date Time Filters",SelectAll:"Select All",Blanks:"Blanks",Search:"Search",Showrowswhere:"Show rows where",NumericTextboxWaterMark:"Enter value",StringMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Starts With",value:"startswith"},{text:"Ends With",value:"endswith"},{text:"Contains",value:"contains"},{text:"Custom Filter",value:"customfilter"}],NumberMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"},{text:"Custom Filter",value:"customfilter"}],GuidMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Custom Filter",value:"customfilter"}],DateMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"},{text:"Custom Filter",value:"customfilter"}],DatetimeMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"},{text:"Custom Filter",value:"customfilter"}],Top10MenuOptions:[{text:"Top",value:"top"},{text:"Bottom",value:"bottom"}],title:"Custom Filter",PredicateAnd:"AND",PredicateOr:"OR",OK:"OK",MatchCase:"Match Case",Cancel:"Cancel",NoResult:"No Matches Found",CheckBoxStatusMsg:"Not all items showing",DatePickerWaterMark:"Select date",DateTimePickerWaterMark:"Select date time",True:"true",False:"false"}}(jQuery,Syncfusion),function(n,t){t.scheduleFeatures=t.scheduleFeatures||{};var r=function(){return"{{for resourceName}}{{for ~cols=colspan}}<td class='e-resourcecells' colspan='{{:~cols}}'> {{for ~resource=resourceNam}}<div class='e-resourceheadertext' align='center' title='{{if userResTemplId == true}}{{:resourceNam}}{{else}}{{:~resource}}{{/if}}'>{{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resource}}{{/if}}<\/div>{{/for}} <\/td>{{/for}}{{/for}}"};t.scheduleFeatures.resources={_getMultipleResourceCellsCount:function(n){var y,s,n,h,r,f,c,l,p,e,i,a,o,v,u;if(this._grouping.length===1){if(y=this._findResourceIndex(this._tempResource,"name",this._grouping[0]),s=this._resourceInfo[y].dataSource.length,this._resWorkWeek)for(n=0,h=this._resourceInfo[y].dataSource,u=0;u<h.length;u++)n=t.isNullOrUndefined(h[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?n+this.model.workWeek.length:n+h[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length}else{for(r=this._getResourceCollection(),f=[],i=0;i<r.length;i++)if(f=[],i==0)for(a=0;a<r[i].dataSource.length;a++)f.push({resourceNam:r[i].dataSource[a][r[i].text]});else for(i>1&&(r[i-1].dataSource=[],r[i-1].dataSource=this.res),this.res=[],c=t.group(r[i].dataSource,r[i].groupId),l=t.group(r[i-1].dataSource,r[i-1].id),this._resourceManager1=c instanceof t.DataManager?c:t.DataManager(c),o=0;o<l.length;o++)for(v=0;v<l[o].items.length;v++)if(p=(new t.Query).where("key",t.FilterOperators.equal,l[o].items[v][r[i-1].id]),e=this._resourceManager1.executeLocal(p),e.length>0)for(u=0;u<e[0].items.length;u++)f.push({resourceNam:e[0].items[u][r[i].text]}),this.res.push(e[0].items[u]);s=f.length;this.res1=f.length}return n=this._resWorkWeek?n:n*s,{resCount:s,count:n}},_initResourceData:function(n,t){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){n.dataSource=r.result;i._resourceInfo.push(n);t==i.model.resources.length-1&&(i._renderInitSchedule(),i._bindAppointmentsData("Load"))})},_showMultipleResourceDetails:function(n){var f,e,o,u,i,r;if(this._tempResource.length>0){for(u=this._resCollection,r=0;r<u.length;r++)this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText");for(i=0;i<this.render_Resources.length-1;i++)f=this.render_Resources[i+1]instanceof t.DataManager?this.render_Resources[i+1]:t.DataManager(this.render_Resources[i+1]),e=(new t.Query).where(u[i+1].groupId,t.FilterOperators.equal,n[this._appointmentSettings.resourceFields.toString().split(",")[i].trim()]),o=f.executeLocal(e),this._appointmentAddWindow.find(".owner_"+(i+1)).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+(i+1)).ejAutocomplete("option","dataSource",o);for(r=0;r<u.length;r++)this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(n[this._appointmentSettings.resourceFields.toString().split(",")[r].trim()])}},_renderAppWindowResources:function(n){for(var i=this.render_Resources,r=this.model.enableRTL?"margin-right:30px;margin-top:-18px":"",u=this.model.enableRTL?"float:none":"float:left",t=0;t<i.length;t++)n.find(".owner_"+t).ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",cssClass:this.model.cssClass,multiSelectMode:this._tempResource[t].allowMultiple?"visualmode":"none",emptyResultText:this._getLocalizedLabels("EmptyResultText"),dataSource:i[t],fields:{text:this._resCollection[t].text,key:this._resCollection[t].id},change:this._onResourceChange,template:"<div class='e-resourcediv' style='height:15px; margin-right:5px; margin-top:3px; float:left;width:15px;"+u+"; background-color: ${"+this._resCollection[t].color+"}'><\/div><div style= "+r+">${"+this._resCollection[t].text+"}<\/div>"})},_onResourceChange:function(i){var d,b,v,y,p,h,s;if(!t.isNullOrUndefined(i.value)&&i.value!=""){var g=n("#"+this._id.toString().split("_")[0]),f=g.ejSchedule("instance"),w=parseInt(this._id.toString().split("_")[2]),nt=f._appointmentAddWindow.find(".owner_"+w).ejAutocomplete("option","multiSelectMode"),o=this.getSelectedItems(),u=f._resCollection;if(w<f.render_Resources.length-1&&o.length>0){var r=w+1,k=f.render_Resources[r-1]instanceof t.DataManager?f.render_Resources[r-1]:t.DataManager(f.render_Resources[r-1]),tt=f.render_Resources[r]instanceof t.DataManager?f.render_Resources[r]:t.DataManager(f.render_Resources[r]),l,e,c=[];if(nt=="none"){if(t.isNullOrUndefined(i.value)||(d=(new t.Query).where(u[r-1].text,t.FilterOperators.equal,i.value),b=k.executeLocal(d)),v=!i.value||t.isNullOrUndefined(i.value)||b.length<=0?o[0][u[r-1].id]:b[0][u[r-1].id],!t.isNullOrUndefined(v))for(a=r;a<u.length;a++){for(e=new t.DataManager(u[r].dataSource).executeLocal((new t.Query).where(u[r].groupId,t.FilterOperators.equal,v)),e.length!=0&&(v=e[0][u[r-1].id]),c=[],s=0;s<e.length;s++)c.push(e[s]);e.length!=0?(f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c),f._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(e[0][u[r].id]),o=e[0][u[r].id]):(f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c));r++}}else{for(y=t.Predicate(u[r-1].id,t.FilterOperators.equal,o[0][u[r-1].id]),o=i.value.split(","),h=1;h<o.length;h++)y=y.or(u[r-1].text,t.FilterOperators.equal,o[h]);if(l=(new t.Query).where(y),resApp=k.executeLocal(l),resApp.length>0){for(p=t.Predicate(u[r].groupId,t.FilterOperators.equal,resApp[0][u[r-1].id]),h=1;h<resApp.length;h++)p=p.or(u[r].groupId,t.FilterOperators.equal,resApp[h][u[r-1].id]);for(l=(new t.Query).where(p),e=tt.executeLocal(l),c=[],s=0;s<e.length;s++)c.push(e[s]);f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText");f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c);f._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(e[0][u[r].id]);o.push(e[0][u[r].id])}}}}},_getResourceCollection:function(){var i=[],f,n,r,u;if(this._tempResource.length!=0){if(t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0)for(n=0;n<this._tempResource.length;n++)i.push({index:n});else{for(n=0;n<this._grouping.length;n++)f=this._findResourceIndex(this._tempResource,"name",this._grouping[n]),i.push({index:f,name:this._tempResource[n].name});i=i.sort(function(n,t){var i=n.index,r=t.index;return i<r?-1:i>r?1:0})}for(r=[],u=0;u<i.length;u++)r.push(this._resourceInfo[i[u].index]);return this._resCollection=r,r}},_resourceSort:function(){var r,u,e,o,s,f,h=[],n=[],l=[];if(this._tempResource.length>1){for(i=0;i<this._tempResource.length;i++)for(j=0;j<this._tempResource[i].resourceSettings.dataSource.length;j++)h.push(this._tempResource[i].resourceSettings.dataSource[j]);for(u=1,a=0;a<this._tempResource.length;a++){for(b=0,f=this._tempResource[a].resourceSettings.dataSource;b<f.length;b++)if(e=n.indexOf(f[b]),e==-1?n.push(f[b]):"",r=new t.DataManager(h).executeLocal((new t.Query).where(this._tempResource[u].resourceSettings.groupId,t.FilterOperators.equal,f[b][this._tempResource[a].resourceSettings.id])),r=r.filter(function(n){return f.indexOf(n)===-1}),o=n.indexOf(f[b]),r.length!=0)for(c=0;c<r.length;c++)s=o+c+1,e=n.indexOf(r[c]),e==-1?n.splice(s,0,r[c]):"";u++;u=u==this._tempResource.length?u-1:u}for(x=0;x<n.length;x++)o=this.res1.indexOf(n[x]),o!=-1&&l.push(n[x]);this.res1=l}else n=this.res1;return n},_renderMultipleResourceHeaderTemplate:function(i,r){var nt,p,c,tt,it,k,a,u,e,ft,et,o,g,d,l,y,s;this.res1=[];this.render_Resources=[];this.level_Resources=[];var v=this.currentView(),f=this._getResourceCollection(),ot=this.model.showWeekend?7:this.model.workWeek.length,h=v=="day"?1:v=="week"||v=="month"?ot:this.model.workWeek.length;if(h=v=="customview"&&this._dateRender.length>=7?ot:v=="customview"&&this._dateRender.length<7?this._dateRender.length:h,t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0){for(s=0;s<this._tempResource.length;s++)this.render_Resources.push(this._tempResource[s].resourceSettings.dataSource);this.res1=[0]}else if(nt=this.model.resourceHeaderTemplateId?!0:!1,p=[],this._grouping.length===1){for(u=0;u<this._grouping.length;u++)c=this._findResourceIndex(this._tempResource,"name",this._grouping[u]);for(u=0;u<this._resourceInfo[c].dataSource.length;u++)this._resWorkWeek&&(l=t.isNullOrUndefined(this._resourceInfo[c].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?h:this._resourceInfo[c].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length),this.currentView()!="agenda"&&p.push({resourceNam:this._resourceInfo[c].dataSource[u][this._resourceInfo[c].text],colspan:this._resWorkWeek?l:h,userResHeader:this._getResourceHeadTemplate(n.extend(this._resourceInfo[c].dataSource[u],{classname:"e-childnode"})),userResTemplId:nt}),this.res1.push(this._resourceInfo[c].dataSource[u]),this.level_Resources.push(this.res1[u]);this._valueCollection=this.res1;this.render_Resources.push(this.res1);this.model.orientation=="vertical"&&this.currentView()!="agenda"&&i!==null&&r!=null&&(tt=v=="month"?50:56,it=this.resourceHeadTemplate.render({cols:r,resourceName:p,leftWidth:tt}),i.append(t.buildTag("tr.e-headerbar").append(it)))}else{var st=[],lt=[],rt=[],b=0,ht=[],ut=[],at=[],ct=[];if(this.resourceValue=0,k=0,st=n.merge(st,f),this._tempResource.length){for(s=0,e=0;e<f[f.length-2].dataSource.length;e++)for(var d=(new t.Query).where(f[f.length-1].groupId,t.FilterOperators.equal,f[f.length-2].dataSource[e][f[f.length-2].id]),o=new t.DataManager(f[f.length-1].dataSource).executeLocal(d),w=0;w<o.length;)lt.push({resourceNam:o[w][f[f.length-1].text],colspan:1*h,userResHeader:this._getResourceHeadTemplate(n.extend(o[w],{classname:"e-childnode"})),userResTemplId:nt}),rt[s]=o[w],this.res1.push(o[w]),s++,w++;this._valueCollection=rt;f[f.length-1].dataSource=rt;a=n.extend(!0,[],f)}for(u=this._tempResource.length-1;u>=0;u--){for(at.push(u),e=0;e<f[u].dataSource.length;e++){if(ft=u!=0?this._findResourceIndex(f[u-1].dataSource,f[u-1].id,f[u].dataSource[e][f[u].groupId]):0,et=u!=this._tempResource.length-1?this._findResourceIndex(f[u+1].dataSource,f[u+1].groupId,f[u].dataSource[e][f[u].id]):this._tempResource.length-1,t.isNullOrUndefined(ft)&&t.isNullOrUndefined(et)?f[u].dataSource[e]=0:"",!t.isNullOrUndefined(ft)&&!t.isNullOrUndefined(et)&&f[u].dataSource[e]!==0){if(ut.push(f[u].dataSource[e]),this.resourceValue=ut.length,u<=this._tempResource.length-2){if(d=(new t.Query).where(f[u+1].groupId,t.FilterOperators.equal,f[u].dataSource[e][f[u].id]),o=new t.DataManager(f[u+1].dataSource).executeLocal(d),u<=this._tempResource.length-3){for(s=0;s<o.length;s++)b=b+(t.isNullOrUndefined(o[s].count)?0:o[s].count);k=this.model.orientation=="vertical"?b:b+o.length;f[u].dataSource[e].count=k;b=0}u==this._tempResource.length-2&&(f[u].dataSource[e].count=o.length,k=o.length);this.resourceValue=k;o.length=0}if(this._resWorkWeek){if(g=0,u!=this._tempResource.length-1)for(d=(new t.Query).where(a[u+1].groupId,t.FilterOperators.equal,a[u].dataSource[e][a[u].id]),l=new t.DataManager(a[u+1].dataSource).executeLocal(d),y=0;y<l.length;y++)g+=t.isNullOrUndefined(l[y][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?t.isNullOrUndefined(l[y].colspan)?h:l[y].colspan:l[y][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else g+=t.isNullOrUndefined(a[u].dataSource[e][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?h:a[u].dataSource[e][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;a[u].dataSource[e].colspan=g;this.resourceValue=g}this.currentView()!="agenda"&&p.push({resourceNam:f[u].dataSource[e][f[u].text],colspan:this._resWorkWeek?this.resourceValue:this.resourceValue*h,userResHeader:this._getResourceHeadTemplate(n.extend(f[u].dataSource[e],{classname:this._tempResource.length-1==u?"e-childnode":"e-parentnode"})),userResTemplId:nt});this.level_Resources.push(f[u].dataSource[e]);ut.length=0}this.model.orientation=="vertical"&&this.currentView()!="agenda"&&i!==null&&r!=null&&(tt=v=="month"?50:56,it=this.resourceHeadTemplate.render({cols:r,resourceName:p,leftWidth:tt}),ct[u]=t.buildTag("tr.e-headerbar").append(it)[0])}ht[u]=f[u].dataSource;p.length=0}this.render_Resources=ht;this.model.orientation=="vertical"&&this.currentView()!="agenda"?i.append(ct):""}return i},_getMultipleResourceAlldayApp:function(n,t,i,r){this.allDayCount=[];new Date(new Date(n[t]).setHours(0,0,0,0)).getTime()==new Date(new Date(this._processed[r][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&this._processed[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]&&(this._processed[r][this._appointmentSettings.allDay]===!0||(new Date(this._processed[r][this._appointmentSettings.endTime])-new Date(this._processed[r][this._appointmentSettings.startTime]))/36e5>=24)&&(this._setAllDayPos(this._processed[r],t,i),this.allDayCount.push(r))},_getResourceColor:function(n){var i=this._resCollection,f,r="",u="",e;if(t.isNullOrUndefined(this.model.group))f=this._findResourceIndex(this.render_Resources[this.render_Resources.length-1],i[i.length-1].id,n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()]),t.isNullOrUndefined(f)||(r=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].color])?r:this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].color],u=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].appointmentClass])?u:this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].appointmentClass]);else{for(e=0;e<this.render_Resources.length;e++)if(f=this._findResourceIndex(this.render_Resources[e],i[e].id,n[this._appointmentSettings.resourceFields.split(",")[e].trim()]),!t.isNullOrUndefined(f)&&(r=r==""||t.isNullOrUndefined(r)?this.render_Resources[e][f][i[e].color]:r,u=u==""||t.isNullOrUndefined(u)?this.render_Resources[e][f][i[e].appointmentClass]:u,!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(u)))break;r=!t.isNullOrUndefined(r)&&r!=""?r:"";u=!t.isNullOrUndefined(u)&&u!=""?u:""}return{appointData:r,appointCustomcss:u,applyFilter:!1}},_getResourceValue:function(n){var r,i;return t.scheduleFeatures.resources&&this._tempResource.length!=0&&(i=this._getResourceDetails(n),r=t.DataManager(this._resCollection[i.length-1].dataSource).executeLocal((new t.Query).where(this._tempResource[i.length-1].resourceSettings.id,"equal",i[0].id))[0]),r},_getResourceDetails:function(n,i){var e,s,f,h,o,l,a,c,r,u;if(this._tempResource.length!=0&&this._tempResource.length>0){if(e=this.currentView()=="day"?1:this.model.showWeekend&&(this.currentView()=="week"||this.currentView()=="month")?7:this.model.workWeek.length,e=this.model.showWeekend&&this.currentView()=="customview"&&this._dateRender.length>=7?7:this.currentView()=="customview"&&this._dateRender.length<7?this._dateRender.length:e,i=this.currentView()==="month"||this.currentView()=="customview"?n.index():!t.isNullOrUndefined(this._cellIndex)&&t.isNullOrUndefined(this._multiple)?this._cellIndex:n.index(),n.hasClass("e-detailedapp")?"":this.index=i,i=n.hasClass("e-detailedapp")?this.index:i,this._resWorkWeek){for(s=0,f=0;f<this._valueCollection.length;f++)if(s+=t.isNullOrUndefined(this._valueCollection[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this._valueCollection[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,s>n.index()){i=f;break}}else i=this.model.orientation=="vertical"?parseInt(i/e):t.isNullOrUndefined(this._workCellIndex)?n.parent().index():this._workCellIndex;for(h=this.model.orientation=="vertical"?this._valueCollection:this._resCollect,this._resourceCollection=[],r=this._resCollection,u=r.length-1;u>=0;u--)u==r.length-1?t.isNullOrUndefined(this.model.group)?(this._resourceCollection.push({id:r[r.length-1].dataSource[i][r[r.length-1].id]}),o=r[r.length-1].dataSource[i][r[r.length-1].groupId]):(this._resourceCollection.push({id:h[i][r[u].id]}),o=h[i][r[u].groupId]):(l=r[u].dataSource instanceof t.DataManager?r[u].dataSource:t.DataManager(r[u].dataSource),a=(new t.Query).where(r[u].id,t.FilterOperators.equal,o),c=l.executeLocal(a),this._resourceCollection.push({id:c[0][r[u].id]}),o=c[0][r[u].groupId]);return this._resourceCollection}},_getResourceFields:function(n){if(!t.isNullOrUndefined(this.model.group)||this._tempResource.length>1)for(var i=0,r=this._resourceCollection.length-1;i<this._resourceCollection.length;i++,r--)n[this._appointmentSettings.resourceFields.split(",")[i].trim()]=this._resourceCollection[r].id;else n[this._appointmentSettings.resourceFields.split(",")[0].trim()]=this._resourceCollection[0].id;return n},_getDragDropResourceData:function(n,i,r){var f,e,o,u,s;if(!t.isNullOrUndefined(i)){if(f=n.currentView()=="day"?1:n.model.showWeekend&&(n.currentView()=="week"||n.currentView()=="month")?7:n.model.workWeek.length,f=n.model.showWeekend&&n.currentView()=="customview"&&n._dateRender.length>=7?7:n.currentView()=="customview"&&n._dateRender.length<7?n._dateRender.length:f,e=n.model.enableRTL?n.res1.length-Math.floor(i/f)-1:Math.floor(i/f),n._resWorkWeek)for(o=0,u=0;u<n.res1.length;u++)if(o+=t.isNullOrUndefined(n.res1[u][n.model.resources[n.model.resources.length-1].resourceSettings.workWeek])?n.model.workWeek.length:n.res1[u][n.model.resources[n.model.resources.length-1].resourceSettings.workWeek].length,o>i){e=u;break}s=n.model.orientation=="vertical"?n.res1[e]:n._resCollect[i];r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]=s[n.model.resources[n.model.resources.length-1].resourceSettings.id];n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=s[n.model.resources[n.model.resources.length-1].resourceSettings.groupId])}return r},_renderResourceData:function(n,i){var f,u,r,e,s,o;if((n.hasClass("e-workcells")||n.hasClass("e-alldaycells")||n.hasClass("e-monthcells"))&&!n.hasClass("e-resourceheadercells")&&this._getResourceDetails(n),f=[],u=[],this._tempResource.length)for(r=this._resourceCollection.length-1;r>=0;r--)e=this._findResourceIndex(this._resCollection[r].dataSource,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id),f.push(this._resCollection[r].dataSource[e]),r!=0?(s=(new t.Query).where(t.Predicate(this._resCollection[r].groupId,t.FilterOperators.equal,this._resCollection[r].dataSource[e][this._resCollection[r].groupId])),o=new t.DataManager(this._resCollection[r].dataSource).executeLocal(s),i=this._findResourceIndex(o,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id),u=o,this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",u),this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(u[i][this._resCollection[r].id])):(this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(f[this._resourceCollection.length-1-r][this._resCollection[r].id]))},_bindResourcesData:function(){var i,n;if(this._tempResource.length!=0){for(this._resourceInfo=[],i=!1,n=0;n<this._tempResource.length;n++)t.isNullOrUndefined(this._tempResource[n].resourceSettings)||(!t.isNullOrUndefined(this._tempResource[n].resourceSettings.query)&&this._tempResource[n].resourceSettings.query instanceof t.Query||(this._tempResource[n].resourceSettings.query=t.Query()),this._tempResource[n].resourceSettings.dataSource instanceof t.DataManager?this._initResourceData(this._tempResource[n].resourceSettings,n):(this._resourceInfo.push(this._tempResource[n].resourceSettings),i=!0));i&&this._renderInitSchedule()}},_renderResourceElements:function(n){for(var t=0;t<this._tempResource.length;t++)n+="<tr><td class='e-leftfields e-textlabel'>"+this._tempResource[t].title+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"_ownerfield_"+t+"' class='owner_"+t+"' type='text' value=''/><div id='ownerlist'><\/div><\/td><\/tr>";return n},_renderResourcesTemplate:function(){this.model.orientation=="vertical"&&(this.resourceHeadTemplate=n.templates(r()))}}}(jQuery,Syncfusion),function(n,t,r){t.scheduleFeatures=t.scheduleFeatures||{};var u=function(){return"<table class='e-table e-workcellstab' height='100%'width='100%' cellpadding='0px' cellspacing='0px'><tbody>{{for cellrows ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}<tr>{{for ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}<td class='e-monthcells' width='{{:~cwidth}}' height='{{:~cheight}}'><div class='e-monthheader'><\/div>{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},f=function(){return"<div class='{{:appClass}} {{:appointCustomcss}}' id='Appointment_{{:id}}' guid= '{{:uid}}' resource='{{:resId}}' role='presentation' style='{{if rtl == true}}right{{else}}left{{/if}}: {{:left}}; {{if ignoreColorFilter == true}}filter:none;{{/if}} width: {{:appWidth}}; background: {{:appointData}}; color:{{:appointtextcolor}}; {{if appHeight}}height:{{:appHeight}}px;{{/if}} top: {{:top}}px;' >{{if appResize == true}}{{if appClass == 'e-appointment'}}{{if orientation == 'vertical'}}<div class='e-tophandle'><\/div><div class='e-bottomhandle'><\/div>{{else}}<div class='e-lefthandle'><\/div><div class='e-righthandle'><\/div>{{/if}}{{else}}{{if currentview != 'day'}}<div class='e-lefthandle'><\/div><div class='e-righthandle'><\/div>{{/if}}{{/if}}{{/if}}<span class='e-icon e-schedulemouseclose'/><\/span>{{if (priority!=undefined && priority!='') && ((priorityTemplate!=undefined && priorityTemplate!=''))}}{{if enablePriority==null}}<div class='e-priority e-{{:priorityTemplate}}'><\/div>{{else}}<div class='e-priority'>{{:priorityTemplate}}<\/div>{{/if}}{{/if}}{{if userAppTemplId == false}}{{if leftInd ==true}}<span class='e-icon e-arrow-sans-left e-leftind'><\/span>{{/if}}{{if rightInd ==true}}<span class='e-icon e-arrow-sans-right e-rightind'><\/span>{{/if}}{{if bottomInd ==true}}<span class='e-icon e-arrow-sans-down e-bottomind'><\/span>{{/if}}{{if topInd ==true}}<span class='e-icon e-arrow-sans-up e-topind'><\/span>{{/if}}<div class='e-appointinnertext'><div class='e-apptext {{if (priority!=undefined && priority!='')}}e-priorwidth{{/if}}'>{{if recurrence == true}}{{if recurrenceEdit == true}}<span class='e-icon e-recureditapp'><\/span>{{else}}<span class='e-icon e-recurapp'><\/span>{{/if}}{{/if}}{{:subject}} <\/div><div class='e-apptime {{if (priority!=undefined && priority!='')}}e-priorwidth{{/if}}'> {{:startTime}} - {{:endTime}}<\/div>{{if value == true}}<div class='e-multipleCategory'>{{:multiDiv}}<\/div>{{/if}}<\/div>{{else}}{{if recurrence == true}}{{if recurrenceEdit == true}}<span class='e-icon e-recureditapp'><\/span>{{else}}<span class='e-icon e-recurapp'><\/span>{{/if}}{{/if}}{{:userTemplate}}{{/if}}<\/div>"},e=function(){return"<div class='e-blocktimewrapper'><div class='e-blocktimeappointment {{:blockClass}} {{:customStyle}}' id='BlockTime_{{:id}}' role='presentation' style='width: {{:appWidth}}; height: {{:appHeight}}px; left: {{:left}}px; top: {{:top}}px;'>{{if userTempId == false}}{{:subject}}{{else}}{{:userTemplate}}{{/if}}<\/div><\/div>"},o=function(){return"{{for renderData }}<div style='background:{{:value}};height:11px;width:6px;float:left'><\/div>{{/for}}"},s=function(){return"{{for cols ~view=view ~colspan=colspan}}{{if cellToday == 'e-headerToday'}}<td class='e-headercells e-currentdayhighlight' colspan='{{:~colspan}}'>{{else}}<td class='e-headercells' colspan='{{:~colspan}}'>{{/if}}<div class='e-dateheadercell'> <span class='e-headerdaydisplay'>{{:currentDay}}<\/span><\/div><\/td>{{/for}}"},h=function(){return"<table class='e-table e-leftindenttable' height='100%' cellpadding='0px' cellspacing='0px'><tbody> {{for trs ~tdClass=tdClass ~divClass=divClass}} <tr>{{for ~tdClass=tdClass ~divClass=divClass}} <td class='{{:~tdClass}} {{if ~tdClass == 'e-leftindent' }}e-alldaycellsheight{{else}}e-headercellsheight{{/if}}'> <div class='{{:~divClass}}'><\/div><\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},l=function(){return"{{for cols ~colspan=colspan ~userTemp=userTemp ~allDayHtml=userHtml}}<td class='e-alldaycells e-alldaycellsheight' colspan='{{:~colspan}}'>{{if ~userTemp==true}}{{:~allDayHtml[#getIndex()]}}{{/if}}<\/td>{{/for}}"},v=function(){return"<table class='e-table e-workcellstab' width='100%' height='100%' cellpadding='0px' cellspacing='0px'><tbody >{{for cellrows ~timesc=timeScale ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}<tr>{{for ~index=#index ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}{{if ((~index+1) % ~timesc) == 0 }}<td class='e-workcells' width='{{:~cwidth}}' height='{{:~cheight}}'>{{else}}<td class='e-workcells e-alternatecells'width='{{:~cwidth}}' height='{{:~cheight}}'>{{/if}}{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},y=function(){return"<div class='e-scrolltimecells' style='width:auto;height:100%;'><table class='e-table e-timecelltable' width='100%' height='100%' cellpadding='0px' cellspacing='0px'><tbody>{{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template}}<tr>{{for ~name=time ~id=id ~view=~view1 ~index=#index }}{{if ~view == 0}}{{if ~userTemplateId==true}}<td class='e-timecells'>{{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}<div class='e-timecelldivs' style='height: 20px'>{{:~timeValue1[~index][#getIndex()]}}<\/div>{{else}}<div class='e-timecelldivs' style='height: 21px'>{{:~timeValue1[~index][#getIndex()]}}<\/div>{{/if}}{{/for}}<\/td>{{else}}<td class='e-timecells'><div class='e-timecelldivs'>{{if ~template==true}}{{:~name}}{{else}}{{:~name.slice(0,2)}}{{/if}}<\/div><\/td>{{/if}}<td class='e-timecells' rowspan='1'>{{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}<div class='e-ampmdisplay'><\/div> {{else}} {{if (#getIndex())== 0}}<div id='{{:~id}}' class='e-ampmdisplay e-ampmstyle e-idAmpmstyle'> {{if ~template ==true || ~userTemplateId==true }}{{else}}{{:~name.slice(3,6)}}{{/if}}<\/div>{{else}}<div class='e-ampmdisplay e-ampmstyle'><\/div>{{/if}} {{/if}}{{/for}}<\/td>{{else}}<td class='e-timecells'><div class='e-timecelldivs'><\/div><\/td>{{/if}}{{/for}}<\/tr>{{/for}}<\/tbody><\/table><\/div>"},p=function(){return"<div class='e-scrolltimecells'><table class='e-table' cellpadding='0px' cellspacing='0px' width='70px'><tbody>{{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template ~cheight = cheight}}<tr height='21px'>{{if ~timesc == 1}}<th class='e-timecells' rowspan='1'>{{else}}<th class='' rowspan='1'>{{/if}}{{:~timeValue1[#getIndex()][0]}}<\/th><\/tr>{{for ~cols1 ~name=time ~id=id ~view=~view1 ~index=#index ~timeSc=~timesc}}{{if (#getIndex()+2)% ~timeSc ==0}}<tr height='21px'><th class='e-timecells' style='text-align:left' rowspan='1'>{{:~timeValue1[~index][#getIndex()+1]}}<\/th><\/tr> {{else}}<tr height='21px'>{{if ~timesc == 1}}<th class='e-timecells' rowspan='1'>{{else}}<th class='' rowspan='1'>{{/if}}{{:~timeValue1[~index][#getIndex()+1]}}<\/th><\/tr>{{/if}}{{/for}}{{/for}}<\/tbody><\/table><\/div>"},w=function(){return"<tr>{{for cols}}<td class='e-headercells {{:className}} {{if (#index==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'><b>{{:headertext}}<\/b><\/div><\/td>{{/for}}<\/tr>"},k=function(){return"<table class='e-table e-agendacellstab' width='100%' cellpadding='0px' cellspacing='0px'><tbody >{{for cols}}<tr>{{if resGroup}}{{for resGroup}}<td class='e-agendacells {{:resId}} e-resourcecolumn {{if (#index==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{:text}}<\/div><\/td>{{/for}}{{/if}}{{if resChild}}<td rowspan={{:resRowSpan}} class='e-agendacells e-resourcecolumn {{if (resGroup.length==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{if userResourceId == false}}{{:resName}}{{else}}{{:userResourceHtml}}{{/if}}<\/div><\/td>{{/if}}{{if dayChild}}<td rowspan={{:dayRowSpan}} class='e-agendacells e-datecolumn {{if (resGroup.length != 0) }}{{else (resName =='')}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{if userDateId == false}}{{:date}}{{else}}{{:userDateHtml}}{{/if}}<\/div><\/td>{{/if}}<td class='e-agendacells e-timecolumn {{if dayBorderBottom==false}}e-alternatecells{{/if}}'><div class='e-textwrapper'>{{if userTimeId == false}}{{:time}}{{else}}{{:userTimeHtml}}{{/if}}<\/div><\/td><td class='e-agendacells e-eventcolumn {{if dayBorderBottom==false}}e-alternatecells{{/if}}'><div class='e-textwrapper'><div id='Appointment_{{:id}}' guid= '{{:uid}}' class='e-agendaappointment'>{{if userAppTemplId == false}}<span class='e-agendacolordiv' style='background:{{:background}}; {{if ignoreColorFilter == true}}filter:none;{{/if}}'/>{{:event}}{{else}}{{:userTemplate}}{{/if}}{{if readOnly == false}}<div class='e-agendahover'><span class='e-icon e-edit_05 e-editapp' title={{:edittext}}/><span class='e-icon e-close e-deleteapp' title={{:deletetext}}/><\/div>{{/if}}<\/div><\/div><\/td><\/tr>{{/for}}<\/tbody><\/table>"};t.widget("ejSchedule","ej.Schedule",{_rootCSS:"e-schedule",element:null,validTags:["div"],model:null,_requiresID:!0,defaults:{timeZoneCollection:{dataSource:[{text:"UTC -12:00",id:"1",value:"UTC -12:00"},{text:"UTC -11:00",id:"2",value:"UTC -11:00"},{text:"UTC -10:00",id:"3",value:"UTC -10:00"},{text:"UTC -09:00",id:"4",value:"UTC -09:00"},{text:"UTC -08:00",id:"5",value:"UTC -08:00"},{text:"UTC -07:00",id:"6",value:"UTC -07:00"},{text:"UTC -06:00",id:"7",value:"UTC -06:00"},{text:"UTC -05:00",id:"8",value:"UTC -05:00"},{text:"UTC -04:30",id:"9",value:"UTC -04:30"},{text:"UTC -04:00",id:"10",value:"UTC -04:00"},{text:"UTC -03:30",id:"11",value:"UTC -03:30"},{text:"UTC -03:00",id:"12",value:"UTC -03:00"},{text:"UTC -02:00",id:"13",value:"UTC -02:00"},{text:"UTC -01:00",id:"14",value:"UTC -01:00"},{text:"UTC +00:00",id:"15",value:"UTC +00:00"},{text:"UTC +01:00",id:"16",value:"UTC +01:00"},{text:"UTC +02:00",id:"17",value:"UTC +02:00"},{text:"UTC +03:00",id:"18",value:"UTC +03:00"},{text:"UTC +03:30",id:"19",value:"UTC +03:30"},{text:"UTC +04:00",id:"20",value:"UTC +04:00"},{text:"UTC +04:30",id:"21",value:"UTC +04:30"},{text:"UTC +05:00",id:"22",value:"UTC +05:00"},{text:"UTC +05:30",id:"23",value:"UTC +05:30"},{text:"UTC +05:45",id:"24",value:"UTC +05:45"},{text:"UTC +06:00",id:"25",value:"UTC +06:00"},{text:"UTC +06:30",id:"26",value:"UTC +06:30"},{text:"UTC +07:00",id:"27",value:"UTC +07:00"},{text:"UTC +08:00",id:"28",value:"UTC +08:00"},{text:"UTC +09:00",id:"29",value:"UTC +09:00"},{text:"UTC +09:30",id:"30",value:"UTC +09:30"},{text:"UTC +10:00",id:"31",value:"UTC +10:00"},{text:"UTC +11:00",id:"32",value:"UTC +11:00"},{text:"UTC +12:00",id:"33",value:"UTC +12:00"},{text:"UTC +13:00",id:"34",value:"UTC +13:00"}],text:"text",id:"id",value:"value"},views:["Day","Week","WorkWeek","Month","Agenda"],agendaViewSettings:{daysInAgenda:7,dateColumnTemplateId:null,timeColumnTemplateId:null},currentView:"week",timeMode:null,firstDayOfWeek:null,workWeek:["Monday","Tuesday","Wednesday","Thursday","Friday"],dateFormat:"",isDST:!1,timeZone:null,timeScale:{enable:!0,minorSlotCount:2,majorSlot:60,minorSlotTemplateId:null,majorSlotTemplateId:null},startHour:0,endHour:24,highlightBusinessHours:!0,enableLoadOnDemand:!1,enablePersistence:!1,showQuickWindow:!0,showLocationField:!1,showTimeZoneFields:!0,businessStartHour:9,businessEndHour:18,workHours:{highlight:!0,start:9,end:18},width:"100%",height:"1120px",cellHeight:"",cellWidth:"",currentDate:new Date,minDate:new Date(1900,01,01),maxDate:new Date(2099,12,31),cssClass:"",locale:"en-US",enableResize:!1,readOnly:!1,enableRTL:!1,enableAppointmentNavigation:null,showAppointmentNavigator:!0,appointmentTemplateId:null,allDayCellsTemplateId:null,dateHeaderTemplateId:null,workCellsTemplateId:null,resourceHeaderTemplateId:null,allowDragDrop:null,allowDragAndDrop:!0,enableAppointmentResize:!0,showCurrentTimeIndicator:!0,showAllDayRow:!0,showHeaderBar:!0,isResponsive:!0,showWeekend:!0,enableRecurrenceValidation:!0,appointmentDragArea:"",showOverflowButton:!0,reminderSettings:{enable:!1,alertBefore:5},contextMenuSettings:{enable:!1,menuItems:{appointment:[{id:"open",text:"Open Appointment"},{id:"delete",text:"Delete Appointment"}],cells:[{id:"new",text:"New Appointment"},{id:"recurrence",text:"New Recurring Appointment"},{id:"today",text:"Today"},{id:"gotodate",text:"Go to date"},{id:"settings",text:"Settings"},{id:"view",text:"View",parentId:"settings"},{id:"timemode",text:"TimeMode",parentId:"settings"},{id:"view_Day",text:"Day",parentId:"view"},{id:"view_Week",text:"Week",parentId:"view"},{id:"view_Workweek",text:"Workweek",parentId:"view"},{id:"view_Month",text:"Month",parentId:"view"},{id:"view_Agenda",text:"Agenda",parentId:"view"},{id:"timemode_Hour12",text:"12 Hours",parentId:"timemode"},{id:"timemode_Hour24",text:"24 Hours",parentId:"timemode"},{id:"workhours",text:"Work Hours",parentId:"settings"}]}},group:null,resources:null,allowKeyboardNavigation:!0,blockoutSettings:{enable:!1,templateId:null,dataSource:[],query:null,tableName:null,id:"Id",subject:"Subject",startTime:"StartTime",endTime:"EndTime",isBlockAppointment:"IsBlockAppointment",isAllDay:null,customStyle:null,resourceId:null},appointmentSettings:{applyTimeOffset:!0,dataSource:[],query:null,tableName:null,id:null,subject:null,description:null,startTime:null,endTime:null,recurrence:null,recurrenceRule:null,allDay:null,resourceFields:null,categorize:null,recurrenceId:null,recurrenceExDate:null,location:null,priority:null,startTimeZone:null,endTimeZone:null},renderDates:null,orientation:"vertical",categorizeSettings:{title:null,enable:!1,allowMultiple:!1,dataSource:[{text:"Blue Category",id:1,color:"#43b496",fontColor:"#ffffff"},{text:"Green Category",id:2,color:"#7f993e",fontColor:"#ffffff"},{text:"Orange Category",id:3,color:"#cc8638",fontColor:"#ffffff"},{text:"Purple Category",id:4,color:"#ab54a0",fontColor:"#ffffff"},{text:"Red Category",id:5,color:"#dd654e",fontColor:"#ffffff"},{text:"Yellow Category",id:6,color:"#d0af2b",fontColor:"#ffffff"}],text:"text",id:"id",color:"color",fontColor:"fontColor"},prioritySettings:{title:null,enable:!1,template:null,dataSource:[{text:"None",value:"none"},{text:"High",value:"high"},{text:"Medium",value:"medium"},{text:"Low",value:"low"}],text:"text",value:"value"},showTimeScale:!0,tooltipSettings:{enable:!1,templateId:null},showDeleteConfirmationDialog:!0,showNextPrevMonth:!0,cellClick:null,cellHover:null,appointmentClick:null,appointmentHover:null,cellDoubleClick:null,appointmentWindowOpen:null,appointmentSaved:null,appointmentEdited:null,appointmentDeleted:null,beforeAppointmentCreate:null,beforeAppointmentChange:null,beforeAppointmentRemove:null,appointmentCreated:null,appointmentChanged:null,appointmentRemoved:null,keyDown:null,navigation:null,dragStart:null,drag:null,dragStop:null,resizeStart:null,resize:null,resizeStop:null,menuItemClick:null,beforeContextMenuOpen:null,reminder:null,actionBegin:null,actionComplete:null,overflowButtonClick:null,overflowButtonHover:null,create:null,load:null,destroy:null,queryCellInfo:null},dataTypes:{views:"array",workWeek:"array",timeZoneCollection:{dataSource:"data",query:"data"},renderDates:"data",enablePersistence:"boolean",showTimeScale:"boolean",resources:"array",group:{resources:"array"},appointmentSettings:{dataSource:"data",query:"data",subject:"parent",description:"parent",startTime:"parent",endTime:"parent",recurrence:"parent",recurrenceRule:"parent",allDay:"parent",resourceFields:"parent",categorize:"parent",location:"parent",priority:"parent",startTimeZone:"parent",endTimeZone:"parent"},categorizeSettings:{dataSource:"data",query:"data"},prioritySettings:{dataSource:"data",query:"data"},contextMenuSettings:{menuItems:{appointment:"array",cells:"array"}},blockoutSettings:{dataSource:"data",query:"data"}},_ignoreOnPersist:["appointmentSettings.query","appointmentSettings.dataSource","timeZoneCollection.dataSource","allowKeyboardNavigation","showQuickWindow","cssClass","locale","enableResize","showHeaderBar","readOnly","enableRTL","enableAppointmentNavigation","showAppointmentNavigator","appointmentTemplateId","resourceHeaderTemplateId","allowDragDrop","allowDragAndDrop","enableAppointmentResize","showCurrentTimeIndicator","reminderSettings.enable","contextMenuSettings.enable","group","categorizeSettings.enable","categorizeSettings.dataSource","cellClick","overflowButtonClick ","overflowButtonHover","keyDown","appointmentClick","cellDoubleClick","appointmentWindowOpen","appointmentSaved","appointmentEdited","appointmentDeleted","beforeAppointmentCreate","beforeAppointmentChange","beforeAppointmentRemove","appointmentCreated","appiontmentChanged","appointmentRemoved","navigation","dragStart","dragStop","resizeStart","resize","resizeStop","menuItemClick","beforeContextMenuOpen","reminder","prioritySettings.dataSource","prioritySettings.enable","agendaViewSettings.daysInAgenda","agendaViewSettings.dateColumnTemplateId","agendaViewSettings.timeColumnTemplateId","blockoutSettings.dataSource"],_ignoreFromAppointmentOnExport:["dataSource","query","tableName","resourceFields"],_ignoreFromModelOnExport:["timezoneCollection","timeZoneCollection","contextMenuSettings","prioritySettings"],_resources:function(){this.element.empty();this._bindResourcesData();t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()},observables:["appointmentSettings.dataSource","currentView","currentDate"],_tags:[{tag:"timeZoneCollection",attr:[],singular:"timeZoneCollection"},{tag:"appointmentSettings.dataSource",attr:[],singular:"dataSource"},{tag:"resources",attr:["allowMultiple","field","title","name","resourceSettings"]},{tag:"contextMenuSettings.menuItems.appointment",attr:["id","text","parentId"]},{tag:"contextMenuSettings.menuItems.cells",attr:["id","text","parentId"]},{tag:"categorizeSettings.dataSource",attr:["text","id","color","fontColor"]},{tag:"timeZoneCollection.dataSource",attr:["text","id","value"]},{tag:"prioritySettings.dataSource",attr:["text","value"]}],currentView:t.util.valueFunction("currentView"),currentDate:t.util.valueFunction("currentDate"),dataSource:t.util.valueFunction("appointmentSettings.dataSource"),_init:function(){n.isEmptyObject(this.model.group)&&(this.model.group=null);this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale);this.model.locale!="en-US"&&this._recurrenceLocal();t.isNullOrUndefined(this.model.workHours.start)&&(this.model.workHours.start=this.model.businessStartHour);t.isNullOrUndefined(this.model.workHours.end)&&(this.model.workHours.end=this.model.businessEndHour);t.isNullOrUndefined(this.model.workHours.highlight)&&(this.model.workHours.highlight=this.model.highlightBusinessHours);t.isNullOrUndefined(this.model.timeZoneCollection)&&(this.model.timeZoneCollection=this.model.timezoneCollection);t.isNullOrUndefined(this.model.timeScale.enable)&&(this.model.timeScale.enable=this.model.showTimeScale);this.model.showAppointmentNavigator=t.isNullOrUndefined(this.model.enableAppointmentNavigation)?this.model.showAppointmentNavigator:this.model.enableAppointmentNavigation;this.model.allowDragAndDrop=t.isNullOrUndefined(this.model.allowDragDrop)?this.model.allowDragAndDrop:this.model.allowDragDrop;t.isNullOrUndefined(this.model.beforeAppointmentCreate)&&(this.model.beforeAppointmentCreate=this.model.appointmentSaved);t.isNullOrUndefined(this.model.beforeAppointmentChange)&&(this.model.beforeAppointmentChange=this.model.appointmentEdited);t.isNullOrUndefined(this.model.beforeAppointmentRemove)&&(this.model.beforeAppointmentRemove=this.model.appointmentDeleted);this._processAppointmentSettings();this._currentDateFormat(this.model.dateFormat);this._trigger("load");this.element.addClass("e-schedule");this.model.cssClass!=null&&this.element.addClass(this.model.cssClass);this._initPrivateProperties();t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._resourceSegregate();this.model.categorizeSettings.enable&&this.model.categorizeSettings.dataSource instanceof t.DataManager&&this._bindCategorizeData();this.model.prioritySettings.enable&&this.model.prioritySettings.dataSource instanceof t.DataManager&&this._bindPriorityData();t.scheduleFeatures.resources&&this._tempResource.length!=0?this._bindResourcesData():this._renderInitSchedule();this._wireEvents();t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null);this._bindAppointmentsData("Load");this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments());this.model.reminderSettings.enable&&(this._checkReminders(),this._reminderInterval=window.setInterval(n.proxy(this._checkReminders,this),6e4))},_processAppointmentSettings:function(){var i,r,u;!t.isNullOrUndefined(this.model.appointmentSettings.query)&&this.model.appointmentSettings.query instanceof t.Query||(this.model.appointmentSettings.query=t.Query());this._appointmentSettings={};resource="";this._applyTimeOffset=this.model.appointmentSettings.applyTimeOffset;for(i in this.model.appointmentSettings)if(i!="applyTimeOffset"&&i!=="tableName"&&i!=="query"&&i!=="dataSource"&&(this._appointmentSettings[i]=n.type(this.model.appointmentSettings[i])=="string"||t.isNullOrUndefined(this.model.appointmentSettings[i])?this.model.appointmentSettings[i]:this.model.appointmentSettings[i].field,i!=="resourceFields"&&i!=="categorize"&&i!=="priority"&&t.isNullOrUndefined(this._appointmentSettings[i])&&(this._appointmentSettings[i]=i.charAt(0).toUpperCase()+i.slice(1)),i=="resourceFields"&&t.isNullOrUndefined(this._appointmentSettings.resourceFields)&&!t.isNullOrUndefined(this.model.resources)))for(r=0,u=this.model.resources.length;r<u;r++)resource=this.model.resources[r].field.charAt(0).toUpperCase()+this.model.resources[r].field.slice(1),this._appointmentSettings[i]+=(r!==0?",":"")+resource},_setModel:function(i){var u=!1,r,e,o,s,f,h,c,l,a;t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.ejDialog("close");for(r in i)switch(r){case"views":this.model.views=i[r];this.model.views=this.model.views.length==0?this.currentView().toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(",");this.hTR.find("table.e-viewstable").remove();this.hTR.find("div.e-viewsdiv").append(this._renderViewNavigation(i[r].toString().toLowerCase().split(",")));this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview").attr("tabIndex",0).focus();t.isNullOrUndefined(this._scheduleDrawer)||(this._scheduleDrawer.ejNavigationDrawer("destroy"),n(this._scheduleDrawer).remove(),this._scheduleDrawer=null,(this._mediaQuery||this.element.width()<600)&&!n("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer());this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&(this._navView=!0,this.model.views.length==0?(this.model.views=this.currentView().toString().toLowerCase().split(","),u=!0):this._viewChange(null,null,this.model.views[0].toLowerCase()));break;case"currentView":this.model.views.toString().toLowerCase().split(",").indexOf(t.util.getVal(i[r]).toLowerCase())!=-1?(this._navView=!0,this._viewChange(null,null,t.util.getVal(i[r]).toLowerCase())):(this._navView=!1,this.currentView(this.element.find(".e-activeview")[0].className.split("e-")[2].split(" ")[0]));break;case"currentDate":if(n.type(i[r])=="string"?this._currentDateFormat(this.model.dateFormat):n.type(i[r])=="function"&&n.type(t.util.getVal(i[r]))=="string"&&this.currentDate(t.parseDate(this.currentDate(),this._datepattern())),this._keyPressed)return this._keyPressed=!1,!1;this._setCurrentDate=!0;this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate);this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate);this._navigateClick(null,"DateNavigation");break;case"minDate":case"maxDate":this._currentDateFormat(this.model.dateFormat);u=!0;break;case"timeMode":this.model.timeMode=this._timeMode=i[r]=="Hour12"?"12":i[r]=="Hour24"?"24":i[r];this._updateTimeMode();break;case"timeZone":this._setmodelvalue=!0;this.model.timeZone=i[r];this.element.find("div.e-categorybar").remove();this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this._bindAppointmentsData("Load");this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments());break;case"showTimeScale":case"timeScale":r=="showTimeScale"&&(this.model.timeScale.enable=i[r]);r=="timeScale"&&n.extend(this.model.timeScale,i[r]);this.currentView()!=="agenda"&&(u=!0);break;case"timezoneCollection":case"timeZoneCollection":n.extend(this.model.timeZoneCollection,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._appointmentAddWindow.find(".startutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});this._appointmentAddWindow.find(".endutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});break;case"showTimeZoneFields":this.model.showTimeZoneFields=i[r];t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.showTimeZoneFields?(this._appointmentAddWindow.find("#"+this._id+"_appStartTime").children().length<4&&(this._mediaQuery?(e="<td width='31%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>",o="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"):(e="<td width='28%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>",o="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),this._appointmentAddWindow.find("#"+this._id+"_appStartTime").append(e),this._appointmentAddWindow.find("#"+this._id+"_appEndTime").append(o),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._startUtc,this),cssClass:this.model.cssClass}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._endUtc,this),cssClass:this.model.cssClass})),this._timeZoneCollection(null)):(this._appointmentAddWindow.find("#"+this._id+"_appStartTime").children().last().remove(),this._appointmentAddWindow.find("#"+this._id+"_appEndTime").children().last().remove());break;case"startHour":this.model.startHour=i[r];this.model.startHour<0&&(this.model.startHour=0);this.currentView()!=="agenda"&&this._setNewStartEndHours();break;case"endHour":this.model.endHour=i[r];this.model.endHour>24&&(this.model.endHour=24);this.currentView()!=="agenda"&&this._setNewStartEndHours();break;case"highlightBusinessHours":case"businessStartHour":case"businessEndHour":case"workHours":r=="highlightBusinessHours"&&(this.model.workHours.highlight=i[r]);r=="businessStartHour"&&(this.model.workHours.start=i[r]);r=="businessEndHour"&&(this.model.workHours.end=i[r]);r=="workHours"&&n.extend(this.model.workHours,i[r]);this.currentView()!=="agenda"&&(this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells,.e-monthcells").removeClass("e-businesshighlightworkcells").removeClass("e-monthcellhighlight"),this._businessHourScroller(),this._renderUpDownIconPosition());break;case"showAllDayRow":this.model.showAllDayRow=i[r];this.model.timeScale.enable||(this.model.showAllDayRow=!1);this.model.orientation=="vertical"&&this.model.timeScale.enable&&this.currentView()!="agenda"&&this.currentView()!="month"&&!this._isCustomMonthView()&&(this.aTR.empty(),this._renderHeaderAllDayTemplate(),this._borderAddRemove(),this._headerbarWidth(),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.model.showAllDayRow&&this._reRenderAllDayAppointments(),this.model.orientation=="vertical"&&this.model.cellWidth&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-headercells").width()),this._reRenderScroller());break;case"isResponsive":this.model.isResponsive=i[r];this._onScheduleResize();break;case"isDST":this.model.isDST=i[r];t.isNullOrUndefined(this.model.timeZone)&&(s=new Date,this._timeValue=this._true==!1?-(s.getTimezoneOffset()-this._stdTimezoneOffset()):s.getTimezoneOffset()-this._stdTimezoneOffset(),this._true=this.model.isDST==!0?!1:!0,this._dayLight=!0,this.element.find("div.e-categorybar").remove(),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-appsoverflow").remove(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Load"));break;case"enableRecurrenceValidation":this.model.enableRecurrenceValidation=i[r];this.model.enableRecurrenceValidation&&t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._dataProcessing(this._currentAppointmentData);this._renderAppointmentAll();break;case"height":this.model.height=i[r];this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();u=!0;break;case"width":this.model.width=i[r];this._clientWidth=this.model.width;this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();u=!0;break;case"cssClass":this.element.removeClass(this.model.cssClass).addClass(i[r]);break;case"locale":this.model.locale=i[r];this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale);this.model.locale!="en-US"&&this._recurrenceLocal();this._culture=t.preferredCulture(this.model.locale);this._dayShortNames=this._culture.calendar.days.namesAbbr;this._dayFullNames=this._culture.calendar.days.names;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this.model.contextMenuSettings.enable&&(n("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0);u=!0;break;case"dateFormat":t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._appointmentAddWindow.find(".startenddate").ejDatePicker({dateFormat:i[r]});this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({dateFormat:i[r]});this._appointmentAddWindow.find(".e-until").ejDatePicker({dateFormat:i[r]});this._currentDateFormat(i[r]);break;case"enableResize":this.model.enableResize=i[r];this.model.enableResize&&(t.isTouchDevice()?this._on(n(window),"orientationchange",n.proxy(this._onScheduleResize,this)):this._on(n(window),"resize",n.proxy(this._onScheduleResize,this)));break;case"readOnly":this.model.readOnly=i[r];this._renderAppointmentAll();break;case"showCurrentTimeIndicator":this.model.showCurrentTimeIndicator=i[r];this.currentView()!=="agenda"&&(this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.showCurrentTimeIndicator||(this.currentView()!=="month"&&!this._isCustomMonthView()?this.element.find(".e-highlightcurrenttimeline").remove():n(this.element.find(".e-monthcells")).removeClass("e-monthcurrenttime")));break;case"enableRTL":i[r]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this.model.enableRTL=i[r];u=!0;this.model.contextMenuSettings.enable&&(n("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0);this._quickAppointWindow=null;break;case"appointmentTemplateId":this.model.appointmentTemplateId=i[r];this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this.element.find("div.e-categorybar").remove();t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"allDayCellsTemplateId":this.model.allDayCellsTemplateId=i[r];u=!0;break;case"dateHeaderTemplateId":this.model.dateHeaderTemplateId=i[r];u=!0;break;case"workCellsTemplateId":this.model.workCellsTemplateId=i[r];u=!0;break;case"showWeekend":this.model.showWeekend=i[r];u=!0;break;case"allowKeyboardNavigation":this.model.allowKeyboardNavigation=i[r];this.model.allowKeyboardNavigation?(this._on(this.element,"keydown",n.proxy(this._onKeyDown,this)),this._on(n(document),"keydown",n.proxy(this._documentOnKeyDown,this))):(this._off(this.element,"keydown"),this._off(n(document),"keydown"));break;case"renderDates":n.extend(this.model.renderDates,i[r]);this._navView=!0;this._viewChange(null,null,"customview");break;case"appointmentSettings":n.isEmptyObject(i[r])||(n.extend(this.model.appointmentSettings,i[r]),this._processAppointmentSettings(),this.element.find("div.e-categorybar").remove(),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-appsoverflow").remove(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null),this._setmodelvalue=!0,this._bindAppointmentsData("Load"));break;case"contextMenuSettings":n.extend(this.model.contextMenuSettings,i[r]);this.model.contextMenuSettings.enable&&(t.isNullOrUndefined(this._contextMenu)||this.model.categorizeSettings.enable)&&this._showContextMenu(this.model.contextMenuSettings.enable);break;case"reminderSettings":i[r].enable?this._checkReminders()&&(this._reminderInterval=window.setInterval(n.proxy(this._checkReminders,this),6e4)):window.clearInterval(this._reminderInterval);break;case"showAppointmentNavigator":case"enableAppointmentNavigation":this.model.showAppointmentNavigator=this.model.enableAppointmentNavigation=i[r];this.model.showAppointmentNavigator?(this._nextPrevAppointment(this.model.showAppointmentNavigator),this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon(),t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()):(this.element.find(".e-prevapp,.e-nextapp").remove(),this.element.find(".e-upicon,.e-downicon").remove());break;case"enableLoadOnDemand":this.model.enableLoadOnDemand=i[r];this.element.find("div.e-categorybar").remove();this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this._bindAppointmentsData("Load");break;case"resources":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(t.copyObject(this.model.resources,i[r]),this.model.resources=i[r],this.model.resources.length==0?(this.model.resources=null,this.model.group=null,u=!0):u=!0);break;case"categorizeSettings":n.extend(this.model.categorizeSettings,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)?(this._renderTemplates(),this._renderAppointmentWindow()):t.isNullOrUndefined(this.model.categorizeSettings)||(this.model.categorizeSettings.enable?(this._appointmentAddWindow.find(".e-categorizevalue").length==1&&this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove(),f="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Categorize")+":<\/td><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' class='e-categorizevalue' type='text' name='"+this._appointmentSettings.categorize+"' value=''/><\/td><\/tr>",this._appointmentAddWindow.find("."+this._id+"summary").after(f),this._renderTemplates(),this._renderCategoryItems(this._appointmentAddWindow)):this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove());this._showContextMenu(this.model.contextMenuSettings.enable);t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"group":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(n.extend(this.model.group,i[r]),n.isEmptyObject(this.model.group)&&(this.model.group=null),u=!0);break;case"cellWidth":this.model.cellWidth=i[r];this.currentView()!=="agenda"&&(u=!0);break;case"cellHeight":this.model.cellHeight=i[r];this.currentView()!=="agenda"&&(u=!0);break;case"orientation":this.model.orientation=i[r];t.scheduleFeatures.resources&&this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&this.model.orientation=="horizontal"&&this._on(this.element,"click",".e-parentnodecategory",n.proxy(this._onResourceClick,this));u=!0;break;case"resourceHeaderTemplateId":this.model.resourceHeaderTemplateId=i[r];t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&(this.currentView()!="agenda"?this.model.orientation=="horizontal"?(h=n(this.wTR.find("td")[0]),h.find("div.e-horizontresdiv").remove(),c=this._renderHorizontalResources(),h.html(c)):(this.aTR.empty(),this._renderHeaderAllDayTemplate(),this._borderAddRemove(),this._headerbarWidth(),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.model.showAllDayRow&&this._reRenderAllDayAppointments()):this._renderAgendaContent());break;case"showLocationField":this.model.showLocationField=i[r];t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.showLocationField?(f="<tr id='"+this._id+"showLocation' class='"+this._id+"showLocation'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>",this._appointmentAddWindow.find("."+this._id+"subjecttr").after(f)):this._appointmentAddWindow.find("."+this._id+"showLocation").remove();break;case"prioritySettings":n.extend(this.model.prioritySettings,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.prioritySettings.enable?(this._appointmentAddWindow.find("."+this._id+"priorityshow").length==1&&(this._appointmentAddWindow.find("."+this._id+"priorityshow").remove(),this._appointmentAddWindow.find("."+this._id+"prioritylistshow").remove()),f="<td colspan='1' class='e-textlabel "+this._id+"priorityshow'>"+this._getLocalizedLabels("Priority")+":<\/td><td colspan='1' class='"+this._id+"prioritylistshow'><input id='"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value='' /><div id='prioritylist'><\/div><\/td>",this._appointmentAddWindow.find("."+this._id+"parrow").prepend(f),this._renderPriorityItems(this._appointmentAddWindow),this._renderTemplates()):(this._appointmentAddWindow.find("."+this._id+"priorityshow").remove(),this._appointmentAddWindow.find("."+this._id+"prioritylistshow").remove());t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"showQuickWindow":this.model.showQuickWindow=i[r];t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow();t.isNullOrUndefined(this._quickAppointWindow)||(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this._quickWindow=this.model.showQuickWindow;break;case"allowDragAndDrop":case"allowDragDrop":if(this.model.allowDragAndDrop=this.model.allowDragDrop=i[r],this.currentView()=="agenda")return!1;this.model.allowDragAndDrop?this._dragdropAppointments():this._unWireDragDrop();break;case"enableAppointmentResize":if(this.model.enableAppointmentResize=i[r],this.currentView()=="agenda")return!1;this._renderAppointmentAll();break;case"showHeaderBar":this.model.showHeaderBar=i[r];this.model.showHeaderBar?(this.element.find(".e-scheduleheader").show(),this._reRenderHeaderBar()):(this.element.find(".e-scheduleheader").empty(),this.element.find(".e-scheduleheader").hide());this.refreshScroller();break;case"tooltipSettings":n.extend(this.model.tooltipSettings,i[r]);l=this.model.tooltipSettings.enable?".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendacells.e-eventcolumn,.e-appup,.e-appdown,.e-appsoverflow":".e-appup,.e-appdown,.e-appsoverflow";a=this.element.data("ejTooltip");a.setModel({target:l});break;case"showOverflowButton":this.model.showOverflowButton=i[r];u=!0;break;case"appointmentDragArea":this.model.appointmentDragArea=i[r];u=!0;break;case"firstDayOfWeek":this.model.firstDayOfWeek=this._firstdayofweek=i[r];this._firstdayofweek&&(u=!0);break;case"workWeek":this.model.workWeek=i[r];(this.model.workWeek==null||this.model.workWeek.length>=0)&&(u=!0);break;case"agendaViewSettings":n.extend(this.model.agendaViewSettings,i[r]);this.currentView()=="agenda"&&(this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this._renderAgendaContent());break;case"showNextPrevMonth":this.model.showNextPrevMonth=i[r];this.model.orientation=="vertical"&&this.currentView()=="month"&&(this._renderMonthTimeCells(),this._highlightBusinessHours(),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll());break;case"blockoutSettings":n.isEmptyObject(i[r])||(n.extend(this.model.blockoutSettings,i[r]),this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments()))}u&&(this.element.empty(),t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("destroy"),this._scheduleDrawer=null,this._quickAppointWindow=null,this._quickAppDetailsWindow=null,this._alertWindow=null,this._appointmentAddWindow=null,n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper").remove(),t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._resourceSegregate(),this._setmodelvalue=!0,this._tempResource.length==0&&this._grouping.length==0?this._renderInitSchedule():this._bindResourcesData(),this._businessHourScroller(),t.isNullOrUndefined(this.dataSource())||this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll(),this.model.blockoutSettings.enable&&this._renderBlockAppointments())},_touchSchedule:function(t){var u,h,e,r;if(n(t.target).is(".e-appointment,.e-alldayappointment,.e-monthappointment")||n(t.target).parents().is(".e-appointment,.e-alldayappointment,.e-monthappointment")||this.model.orientation=="horizontal")return!1;var s=this.model.enableRTL?t.type=="swipeleft"?"swiperight":"swipeleft":t.type,c=this.model.enableRTL?"margin-right":"margin-left",f,a=parseInt(this.element.find(".e-draggableworkarea").css(c)),o=Math.round(this.element.find(".e-draggableworkarea").width()/this.res1.length),l=this.element.find(".e-workleftindent").length>0?this.element.find(".e-workleftindent").outerWidth():0,i=Math.round(Math.abs((this.element.find(".e-draggableworkarea").offset().left-l-1)/o));if(this.currentView()=="month"||this._isCustomMonthView()){for(u=0,h=s=="swipeleft"?(i+1)*7:(i-1)*7,e=0;e<h;e++)u+=this.element.find(".e-draggableworkarea tr").eq(0).children().eq(e).outerWidth();u+=3}switch(s){case"swipeleft":if(this._mediaQuery&&this.currentView()!="agenda"&&this.model.orientation=="vertical"){if(i+1!=this.res1.length)return r=this.currentView()=="month"||this._isCustomMonthView()?-u:-((i+1)*o),this.element.find(".e-headrealldaytable").css("left","0px"),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate(this.model.enableRTL?{"margin-right":r}:{"margin-left":r},500),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").css(this.model.enableRTL?{"margin-left":0}:{"margin-right":0}),i+1==this.res1.length-1&&this._showScrollTd(),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css({marginLeft:"0px",marginRight:"0px"})}f={currentTarget:this.element.find(".e-navigatenext")};this._navigateClick(f,"Next");break;case"swiperight":if(this._mediaQuery&&this.currentView()!="agenda"&&this.model.orientation=="vertical"){if(i!=0)return r=this.currentView()=="month"||this._isCustomMonthView()?-u:-((i-1)*o),this.element.find(".e-headrealldaytable").css("left","0px"),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate(this.model.enableRTL?{"margin-right":r}:{"margin-left":r},500),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").css(this.model.enableRTL?{"margin-left":0}:{"margin-right":0}),i+1==this.res1.length-1&&this._showScrollTd(),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css({marginLeft:"0px",marginRight:"0px"})}f={currentTarget:this.element.find(".e-navigateprevious")};this._navigateClick(f,"Previous")}},_initPrivateProperties:function(){this._navSelected=this._navDrawer=this._alldayLevel=this._reminderClose=this._navView=this._editKey=this._cellClick=this._recurChecked=this._setCurrentDate=this._leftResizing=this._rightResizing=this._topResizing=this._bottomResizing=this._allDayDrag=this._dateNavigation=this._isQuickDialogOpened=!1;this._gotoDate=this._bindapp=this._showBlockAlert=this._seriesAlert=!0;this._tempStart=this._tempEnd=this._currentAction="";this._currentRowIndex=this._currentColIndex=0;this._appId=this._parentId=1;this._currentAppointmentData=[];this._currentViewAppointments=[];this._processed=[];this._renderedApp=[];this._renderedAllDay=[];this._dateRender=[];this._grouping=[];this._tempResource=[];this.res1=[0];this._appMainId=null;this._scheduleDrawer=null;this._quickAppointWindow=null;this._quickAppDetailsWindow=null;this._alertWindow=null;this._appointmentAddWindow=null;this._dayNamesArray=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];this._dayNames=["SU","MO","TU","WE","TH","FR","SA"];this._culture=t.preferredCulture(this.model.locale);this._dayShortNames=this._culture.calendar.days.namesAbbr;this._dayFullNames=this._culture.calendar.days.names;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this._browserInfo=t.browserInfo();this._safariBrowser=this._browserInfo.name=="webkit"&&!t.isTouchDevice();this._focused=null;Array.prototype.map=Array.prototype.map||function(n,t){var e,u,i,r,f,o,s;if(this==null)throw new TypeError("this is null or not defined");if(r=Object(this),f=r.length>>>0,typeof n!="function")throw new TypeError(n+" is not a function");for(arguments.length>1&&(e=t),u=new Array(f),i=0;i<f;)i in r&&(o=r[i],s=n.call(e,o,i,r),u[i]=s),i++;return u};String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.capitalizeFirstString=String.prototype.capitalizeFirstString||function(){return this.charAt(0).toUpperCase()+this.slice(1)};Date.prototype.parseISO8601=function(n){return typeof n=="string"?n.indexOf("Date")!=-1?new Date(parseInt(n.match(/\d+/).toString())):n.indexOf("T")!=-1?new Date(n):new Date(n.replace(/-/g,"/")):new Date(n)};Date.prototype._currentMonthDates=function(){return{start:new Date(this.getFullYear(),this.getMonth(),1),end:new Date(this.getFullYear(),this.getMonth()+1,0)}};Date.prototype._currentWeekDates=function(n){var i=this.getDay()-n,t=new Date(this.getFullYear(),this.getMonth(),this.getDate()+(i<0?i+7:i)*-1),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+6);return{start:new Date(t),end:new Date(r)}}},_destroy:function(){this.element.off();this._destorySubControls(n("#"+this._id+"_AddEditForm"));t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find("#"+this._id+"recurrenceEditor").ejRecurrenceEditor("destroy");this.element.find("#"+this._id+"_navigator").ejDatePicker("destroy");window.clearInterval(this._intervalID);t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("destroy");n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"gotoWindow_wrapper").remove();this.element.empty().removeClass("e-schedule")},_destorySubControls:function(t){for(var i,u=t.find(".e-timepicker,.e-datepicker,.e-dropdownlist,.e-autocomplete"),r=0;r<u.length;r++)i=n(u[r]),i.hasClass("e-timepicker")?i.ejTimePicker("destroy"):i.hasClass("e-datepicker")?i.ejDatePicker("destroy"):i.hasClass("e-dropdownlist")?i.ejDropDownList("destroy"):i.hasClass("e-autocomplete")&&i.ejAutocomplete("destroy")},_closeRecurence:function(i){var u,r,f,e,o;if(t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._appointmentAddWindow.find(".e-recuruntil").ejRadioButton("option","checked")&&i.model.text!=this._getLocalizedLabels("Cancel")&&this._appointmentAddWindow.find(".recurstartdate").ejDatePicker("option","value")>this._appointmentAddWindow.find(".e-until").ejDatePicker("option","value"))return this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("WrongPattern")),this._alertWindow.ejDialog("open"),!1;u=!0;i.model.text==this._getLocalizedLabels("Cancel")?this._appointmentAddWindow.find(".e-recurFinalRule").html()==""&&this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox({checked:!1}):(r=this._appointmentAddWindow.find(".e-recurEditor").data("ejRecurrenceEditor"),this._rRuleStr=r.closeRecurPublic(),f=r.element.find(".recurstartdate").ejDatePicker("option","value"),e=r.recurrenceDateGenerator(r._recRule,f),r._rRule.freq!="MONTHLY"||t.isNullOrUndefined(r._rRule.monthDay)||(o=e.filter(function(n){return new Date(n).getDate()==r._rRule.monthDay}),(!t.isNullOrUndefined(r._rRule.count)&&o.length!=e.length||t.isNullOrUndefined(r._rRule.count)&&[29,30,31].indexOf(r._rRule.monthDay)!=-1)&&(u=!1,this._alertWindow.find(".e-alertbtn").find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"})),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("RecurrenceDateValidation")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.addClass("e-recurAlert"),this._alertWindow.ejDialog("open"))),new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")).setHours(0,0,0,0)!=new Date(f).getTime()&&this._recurDateChange(f),u&&(this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(this._rRuleStr),this._appointmentAddWindow.find(".e-recuredit").css("display","inline")));u&&(this._appointmentAddWindow.find(".e-recurEditor").toggle(),this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","block"),this._appointmentAddWindow.find(".done").focus())},_wireEvents:function(){this._on((this.element,n(window)),"mousedown",n.proxy(this._onScheduleMouseDown,this));this._on(this.element,"click","div.e-navigateprevious,div.e-navigatenext",n.proxy(this._navigateClick,this));this._on(n(window),"resize",n.proxy(this._onScheduleResize,this));this._on(this.element,"click",".e-commonviewbutton",n.proxy(this._viewChange,this));this._on(this.element,"click",".e-datedisplay",n.proxy(this._viewCalendar,this));this._on(this.element,"click","div.e-appsoverflow",n.proxy(this._appOverflowClick,this));this._on(this.element,"click",".e-prevapp.enable,.e-nextapp.enable",n.proxy(this._nextPrev,this));this._on(this.element,"dblclick",".e-headercells",n.proxy(this._navigateView,this));this._on(this.element,"click",".e-headercells,.e-timecells,td.e-monthcells div.e-monthheader",n.proxy(this._navigateView,this));this._on(this.element,"mouseover","td.e-alldaycells,td.e-workcells:not('.e-resourceheadercells'),td.e-monthcells:not('.e-othermonths'),td.e-agendacells",n.proxy(this._onCellMouseOver,this));this._on(this.element,"mouseout","td.e-alldaycells,td.e-workcells:not('.e-resourceheadercells'),td.e-monthcells:not('.e-othermonths'),td.e-agendacells",n.proxy(this._onCellMouseOver,this));this._on(this.element,"click",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells",n.proxy(this._cellSelection,this));this._mediaQuery||t.isTouchDevice()||(this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",n.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",n.proxy(this._shiftSelection,this)));this._on(this.element,t.isMobile()?"click":t.isTouchDevice()&&(n.isFunction(n.fn.tap)||n.isFunction(n.fn.doubletap))?"doubletap":"dblclick",".e-workcells:not('.e-resourceheadercells'),.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells.e-eventcolumn,.e-agendacells.e-timecolumn",n.proxy(this._appointmentWindow,this));(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));t.isTouchDevice()&&this._on(this.element,n.isFunction(n.fn.tap)?"tap":"doubletap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));this._on(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",n.proxy(this._onAppointMouseOver,this));this._on(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",n.proxy(this._onAppointMouseOver,this));this._on(this.element,"click",".e-appup,.e-appdown",n.proxy(this._renderAppPosition,this));(this._mediaQuery||this.element.width()<600)&&this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this));this.model.allowKeyboardNavigation&&(this._on(this.element,"keydown",n.proxy(this._onKeyDown,this)),this._on(n(this.element),"keydown",n.proxy(this._documentOnKeyDown,this)));this.model.orientation=="horizontal"&&this._on(this.element,"click",".e-parentnodecategory",n.proxy(this._onResourceClick,this));(this._mediaQuery||t.isTouchDevice())&&this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",n.proxy(this._touchSchedule,this));this.model.enableResize&&(t.isTouchDevice()?this._on(n(window),"orientationchange",n.proxy(this._onScheduleResize,this)):this._on(n(window),"resize",n.proxy(this._onScheduleResize,this)));this._on(this.element,"click",".e-schedulemouseclose,.e-deleteapp",n.proxy(this._deleteAppoint,this));this._on(this.element,"click",".e-editapp",n.proxy(this._appointmentWindow,this))},_drawerOpen:function(){this._scheduleDrawer.ejNavigationDrawer("open")},_mouseButtonClick:function(i){var s,e,o;if(!i.altKey&&!i.shiftKey&&!i.ctrlKey&&i.which!=3&&(i.which==1||i.type=="touchstart")&&!n(i.target).hasClass("e-resourceheadercells")&&!n(i.target).hasClass("e-othermonths")){var u=i.target||document.activeElement||i.srcElement,f=this.element.find("div.e-draggableworkarea tr"),r=this;if(n(u).hasClass("e-alldaycells")&&(f=this.element.find(".e-alldaycells").parent()),n(u).hasClass("e-selectedAppointment")&&(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(f[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=n(u).parent()[0].rowIndex,this._currentColIndex=n(u)[0].cellIndex,s=r.model.orientation=="horizontal"&&r.currentView()=="month"?r.monthDays:r.model.orientation=="vertical"?r.dateRender:r._dateRender,e=n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7,this.model.orientation=="horizontal"&&(e=r.currentView()!=="month"?Math.floor(e/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):e),o=new Date(s[e]),o>=this.model.minDate&&o<=this.model.maxDate&&(n(u).hasClass("e-workcells")||n(u).hasClass("e-monthcells")||n(u).hasClass("e-alldaycells"))){f.on(t.eventType.mouseMove,function(i){var f,e;!t.isNullOrUndefined(r._quickAppointWindow)&&r.model.showQuickWindow&&(r._quickAppointWindow.ejDialog("close"),r._quickAppDetailsWindow.ejDialog("close"));i.preventDefault();f=i.target;i.type=="touchmove"&&(e=i.originalEvent.changedTouches[0],f=document.elementFromPoint(e.pageX,e.pageY));n(f).hasClass("e-selectedCell")&&r.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");r._mouseSelection(i,r,u,f);r._moveScrollContent(u,r)});f.on(t.eventType.mouseUp,function(){f.off(t.eventType.mouseMove)});this.element.find("e.workcells,e.alldaycells,.e-monthcells").removeClass("e-mousehover");this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment")}}},_mouseSelection:function(i,r,u,f){var h=r.element.find("div.e-draggableworkarea tr"),v=n(u).parent().index(),s=n(u).index(),nt=h.length-1,c,l,e,a=n(f).parent().index(),o=n(f).index(),w=r.element.find(".e-alldaycells").parent(),d=r.model.showAllDayRow,y,g,tt,b,k,p;if(this._resWorkWeek)for(y=0,g=0;g<this.res1.length;g++)if(tt=t.isNullOrUndefined(this.res1[g][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this.res1[g][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,o<=y+(tt-1)){b=y+tt;break}else y+=this.res1[g][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else var it=r.model.orientation=="horizontal"?h[0].cells.length:r.currentView()=="month"||r._isCustomMonthView()?h[0].cells.length/r.res1.length:r._dateRender.length,rt=Math.floor(n(f).index()/it),b=it*(rt+1),y=it*rt;if(n(f).hasClass("e-workcells"))if(r.model.orientation=="vertical")if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(s==o)if(a>v)for(e=parseInt(v);e<=a;e++)n(h[e].cells[s]).addClass("e-selectedCell");else if(a<v)for(e=parseInt(v);e>=a;e--)n(h[e].cells[s]).addClass("e-selectedCell");else n(h[a].cells[o]).addClass("e-selectedCell");else if(o>s){for(p=o-s,c=parseInt(v);c<=nt;c++)n(h[c].cells[s]).addClass("e-selectedCell");if(d&&n(w[0].cells[[s]]).addClass("e-selectedCell"),d&&n(w[0].cells[[o]]).addClass("e-selectedCell"),p>1)for(e=1;e<=p-1;e++){for(k=0;k<=nt;k++)n(h[k].cells[o-e]).addClass("e-selectedCell");d&&n(w[0].cells[[o-e]]).addClass("e-selectedCell")}for(l=0;l<=a;l++)n(h[l].cells[o]).addClass("e-selectedCell")}else if(o<s){for(p=s-o,c=parseInt(v);c>=0;c--)n(h[c].cells[s]).addClass("e-selectedCell");if(d&&n(w[0].cells[[s]]).addClass("e-selectedCell"),d&&n(w[0].cells[[o]]).addClass("e-selectedCell"),p>1)for(e=1;e<=p-1;e++){for(k=0;k<=nt;k++)n(h[k].cells[[o+e]]).addClass("e-selectedCell");d&&n(w[0].cells[[o+e]]).addClass("e-selectedCell")}for(l=parseInt(a);l<=nt;l++)n(h[l].cells[o]).addClass("e-selectedCell")}r._currentRowIndex=a;r._currentColIndex=o;n(h[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(v==a&&s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(o>s)for(l=s;l<=o;l++)n(h[a].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(o<=s)for(l=s;l>=o;l--)n(h[a].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(n(f).hasClass("e-alldaycells"))if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(o<s)for(e=s;e>=o;e--)n(w[0].cells[e]).addClass("e-selectedCell");else if(o>s)for(e=s;e<=o;e++)n(w[0].cells[e]).addClass("e-selectedCell");r._currentRowIndex=0;r._currentColIndex=o;n(w[0].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(n(f).hasClass("e-monthcells")){if(n(f).hasClass("e-othermonths"))return!1;if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(a==v)if(o<s)for(e=s;e>=o;e--)n(h[a].cells[e]).addClass("e-selectedCell");else if(o>s)for(e=s;e<=o;e++)n(h[a].cells[e]).addClass("e-selectedCell");else o==s&&n(h[a].cells[o]).addClass("e-selectedCell");else if(a>v){for(p=a-v,c=s;c<b;c++)n(h[v].cells[c]).addClass("e-selectedCell");if(p>1)for(e=1;e<=p-1;e++)for(c=y;c<b;c++)n(h[v+e].cells[c]).addClass("e-selectedCell");for(l=y;l<=o;l++)n(h[a].cells[l]).addClass("e-selectedCell")}else if(a<v){for(p=v-a,c=s;c>=y;c--)n(h[v].cells[c]).addClass("e-selectedCell");if(p>1)for(e=1;e<=p-1;e++)for(c=y;c<b;c++)n(h[v-e].cells[c]).addClass("e-selectedCell");for(l=b-1;l>=o;l--)n(h[a].cells[l]).addClass("e-selectedCell")}r._currentRowIndex=a;r._currentColIndex=o;n(h[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1}},_shiftSelection:function(i){var f,r,u;if(i.shiftKey==!0&&i.which==1&&!n(i.target).hasClass("e-resourceheadercells")){var e=this._focused,o=this,s=i.target;!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this.element.find("e.workcells,e.alldaycells,.e-monthcells").removeClass("e-mousehover");this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");f=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender;r=n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7;this.model.orientation=="horizontal"&&(r=this.currentView()!=="month"?Math.floor(r/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):r);u=new Date(f[r]);u>=this.model.minDate&&u<=this.model.maxDate&&this._mouseSelection(i,o,e,s)}},_moveScrollContent:function(t,i){var r,f,u;i.model.orientation==="horizontal"?(r=i.element.find(".e-draggableworkarea").scrollLeft(),r=i.model.enableRTL?i._browserInfo.name=="mozilla"?r>0?r:r*-1:i._browserInfo.name=="chrome"||i._browserInfo.name=="webkit"?i.element.find(".e-workcells")[0].offsetLeft+i.element.find(".e-workcells").width()-i.element.find(".e-draggableworkarea").scrollLeft()-i.element.find(".e-draggableworkarea").width():Math.abs(r):-r,i.currentView()!="month"?n(i.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",r+"px"):i.element.find(".e-headerdays").css("left",r+"px"),i.currentView()==="day"||i.currentView()==="month"||i.currentView()=="customview"&&i._dateRender.length>7||!i.model.timeScale.enable||(f=n(i.element.find(".e-headercells").find(".e-activeview").parent()).index(),u=Math.floor(Math.abs(r)/i.element.find(".e-workcells").outerWidth()/((i.model.endHour-i.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),f!==u&&i.element.find(".e-headercells").children().removeClass("e-activeview"),n(i.element.find(".e-headercells")[u]).children().addClass("e-activeview"))):n(t).hasClass("e-monthcells")||i.element.find(".e-scrolltimecells").css("top",-i.element.find(".e-draggableworkarea").scrollTop()+"px")},_onScheduleMouseDown:function(i){var r=n(i.target),u=r.hasClass("e-appointment,e-alldayappointment,e-monthappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment");r.hasClass("e-workcells")||u.hasClass("e-appointment")||u.hasClass("e-alldayappointment")||u.hasClass("e-monthappointment")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||r.parents(".e-scheduledialog").hasClass("e-scheduledialog")||(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),this.element.find(".e-workcells").removeClass("e-mousehover"),r.closest("#"+this._id).length>0&&this._scrollerPosition())},_onCellMouseOver:function(i){var r,u,e,f,o;if(n(i.target).closest(".e-appointment,.e-blocktimeappointment,.e-alldayappointment,.e-monthappointment").length>0)return!1;if(this.currentView()=="agenda"){if(this._mediaQuery==!0)return!1;r=n(i.currentTarget);i.type==="mouseover"?(this.element.find(".e-mousehover").removeClass("e-mousehover"),r.hasClass("e-agendacells")&&(r.parent().find(".e-timecolumn,.e-eventcolumn").addClass("e-mousehover"),r.parent().find(".e-editapp").parent().show())):i.type==="mouseout"&&r.hasClass("e-agendacells")&&(r.parent().find(".e-timecolumn,.e-eventcolumn").removeClass("e-mousehover"),r.parent().find(".e-editapp").parent().hide())}else if(r=n(i.currentTarget),u=n(i.target).hasClass("e-workcells")?n(i.target).index():n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7,this.model.orientation=="horizontal"&&(u=this.currentView()!=="month"?Math.floor(u/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):u),e=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender,f=new Date(e[u]),this._slotByElement(n(i.target),"cellHover"),o={cellIndex:u,startTime:new Date(this.cellHoverStartTime),endTime:new Date(this.cellHoverEndTime),target:i,resources:!t.isNullOrUndefined(this.model.cellHover)&&this._tempResource.length!=0?this._getResourceValue(r,u):null},f>=this.model.minDate&&f<=this.model.maxDate)if(i.type==="mouseover"){if(this._trigger("cellHover",o))return!1;this.element.find(".e-mousehover").removeClass("e-mousehover");(r.hasClass("e-workcells")||r.hasClass("e-monthcells"))&&!r.hasClass("e-resourceheadercells")&&r.addClass("e-mousehover")}else i.type==="mouseout"&&(r.hasClass("e-workcells")||r.hasClass("e-monthcells"))&&r.removeClass("e-mousehover");else return!1},_getAppDetails:function(i){var r=t.isNullOrUndefined(i.target)?n(i):n(i.target),o=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),u,f,e;return(this.currentView()=="agenda"&&r.hasClass("e-eventcolumn")&&(o=r.find(".e-agendaappointment")),appId=o.attr("guid"),t.isNullOrUndefined(appId))?!1:(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,appId)),u[0][this._appointmentSettings.recurrence]?(f=n.extend(!0,[],u),f[0][this._appointmentSettings.endTime]=f[f.length-1][this._appointmentSettings.endTime],e=u[0][this._appointmentSettings.recurrence]&&u[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")==1?this._getAppointmentByParentId(appId):f[0]):e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,appId))[0],e)},_onAppointMouseOver:function(i){var f,u,r;if(!this.model.readOnly){if(!t.isNullOrUndefined(this.model.appointmentHover)&&(f={appointment:this._getAppDetails(i)},this._trigger("appointmentHover",f)))return!1;if(this.currentView()=="agenda"){if(this._mediaQuery==!0)return!1;u=n(i.currentTarget);i.type==="mouseover"?(this.element.find(".e-mousehover").removeClass("e-mousehover"),u.hasClass("e-agendaappointment")&&(u.addClass("e-mousehover"),u.find(".e-editapp").parent().show())):i.type==="mouseout"&&u.hasClass("e-agendaappointment")&&(u.removeClass("e-mousehover"),u.find(".e-editapp").parent().hide())}else r=n(i.target).hasClass("e-appointment,e-alldayappointment,e-monthappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment"),r.hasClass("e-appointment")&&this.model.orientation=="vertical"?i.type==="mouseover"?(this.model.enableAppointmentResize&&(r.find(".e-bottomhandle,.e-tophandle").addClass("e-icon e-nsexpand"),r.find(".e-bottomhandle").addClass("e-appointresizer-bottom"),r.find(".e-tophandle").addClass("e-appointresizer-top")),r.find(".e-schedulemouseclose").css("display","block")):i.type==="mouseout"&&(this.model.enableAppointmentResize&&r.find(".e-bottomhandle,.e-tophandle").removeClass("e-icon e-nsexpand"),r.find(".e-schedulemouseclose").css("display","none")):((r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment"))&&this.model.orientation=="vertical"||this.model.orientation=="horizontal")&&(i.type==="mouseover"?(this.model.enableAppointmentResize&&(r.find(".e-lefthandle,.e-righthandle").addClass("e-icon e-ewexpand"),r.find(".e-lefthandle").addClass("e-appointresizer-left"),r.find(".e-righthandle").addClass("e-appointresizer-right")),r.find(".e-schedulemouseclose").css("display","block")):i.type==="mouseout"&&(this.model.enableAppointmentResize&&r.find(".e-lefthandle,.e-righthandle").removeClass("e-icon e-ewexpand"),r.find(".e-schedulemouseclose").css("display","none")))}},_quickWindowPosition:function(t,i,r,u){var a=u.find(".e-tableAppoint"),f=n("#"+u.prop("id")+"_wrapper").width(),e=this.element.offset().left,o=this.element.offset().left+this.element.width(),s=this.element.offset().top,p=this.element.offset().top+this.element.height(),l=r.width()/2,v="rotate(0deg)",h=!0,c="40%",y;return t>e&&t+f>o&&i>s?(t=o-f-5,c=r.offset().left-t+l):t<e&&t+f<o&&i>s?(t=e+5,c=r.offset().left-t+l):i<s&&(h=!1,v="rotate(180deg)",t<e?(t=e+5,c=r.offset().left-t+l):t+f>o&&(t=o-f-5,c=r.offset().left-t+l),y=u.prop("id")==this._id+"AppDetailsWindow"?r.height():this.model.orientation=="horizontal"?r.height()/2:r.height()-4,i=r.offset().top+10+y,(i<s||i>p-n("#"+u.prop("id")+"_wrapper").height())&&(i=s+4,h=!0,v="rotate(0deg)")),h?a.removeClass("e-tablePosition"):a.addClass("e-tablePosition"),u.find(".e-quickarrow").css("transform",v).css("top",h?a.outerHeight()+1:0).css("left",c),h?u.addClass("e-quickwinarrowbottom").removeClass("e-quickwinarrowtop"):u.addClass("e-quickwinarrowtop").removeClass("e-quickwinarrowbottom"),{X:t,Y:i}},_scrollerPosition:function(){var t,i,n;this.currentView()!="agenda"&&this.model.timeScale.enable&&(this.element.find(".e-vscroll").length>0||this.element.find(".e-hscroll").length>0)&&(t=this.element.find("#"+this._id+"_scroller").ejScroller("instance"),this.model.orientation=="vertical"?(t.isVScroll()&&(n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:n})),t.isHScroll()&&(n=this.element.find(".e-draggableworkarea").offset().left-this.element.find(".e-workcellstab").offset().left,this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:Math.abs(n)}))):this._grouping.length>0&&(t.isVScroll()&&this.element.find(".e-resourceheadertable").offset().top!=this.element.find(".e-workcellstab").offset().top&&(n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this._isQuickDialogOpened=!0,this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:n})),t.isHScroll()&&(i=this.currentView()=="month"||this._isCustomMonthView()?this.element.find(".e-headerdays").offset().left:this.element.find(".e-horizontaltabletimecell").closest("tr").offset().left,this.element.find(".e-workcellstab").offset().left!=i&&(n=this.element.find(".e-draggableworkarea").offset().left-this.element.find(".e-workcellstab").offset().left,this._isQuickDialogOpened=!0,this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:Math.abs(n)})))))},_cellSelection:function(r){var u,k,d,a,h,v,f,g,s,it,rt,w,b,ut,ft,et,ot,c,e;if(r.shiftKey||(t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide"),this.element.find("e.workcells,e.alldaycells,.e-monthcells,.e-agendacells").removeClass("e-mousehover"),this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),u=t.isNullOrUndefined(r.target)?n(r):n(r.target),u.hasClass("e-blocktimeappointment")||u.closest(".e-blocktimeappointment").length>0))return!1;if(this.currentView()=="agenda"||u.hasClass("e-schedulemouseclose")||t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(u=u.closest(".e-appointment,.e-monthappointment").length>0?u.closest(".e-appointment,.e-monthappointment"):u.hasClass("e-apptime")||u.hasClass("e-apptext")||u.hasClass("e-appointinnertext")||u.hasClass("e-schedulemouseclose")||u.hasClass("e-monthheader")?n(r.target):u.closest(".e-workcells, .e-alldaycells, .e-monthcells")),u.hasClass("e-appointwrapper")||u.hasClass("e-textwrapper")&&(u=n(u).parent()),t.isNullOrUndefined(r.type)||r.type!="beforeOpen"?this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell"):(k=this.element.find("td.e-selectedCell"),k.length>0&&!u.hasClass("e-selectedCell")&&this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell")),this.model.showQuickWindow&&t.isNullOrUndefined(this._quickAppointWindow)&&this._renderQuickWindow(),this.currentView()!="agenda"){if((u.hasClass("e-workcells")||u.hasClass("e-alldaycells")||u.hasClass("e-monthcells"))&&!u.hasClass("e-resourceheadercells")){if((this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"),this._slotByElement(u,"cellClick"),this.model.minDate>this.curDate||this.model.maxDate<this.curDate)||(d=this._dayFullNames[new Date(this.curDate).getDay()]+", "+t.format(new Date(this.curDate),"MMMM",this.model.locale)+" "+new Date(this.curDate).getDate()+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale),a={cellIndex:this._cellIndex,startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:r,resources:(this.model.cellClick!=null||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("cellClick")!=-1)&&this._tempResource.length!=0?this._getResourceValue(u):null,quickString:d},this._trigger("cellClick",a)))return!1;if(u.addClass("e-selectedCell").attr("tabIndex",0).focus(),this._scrollerPosition(),this.model.showQuickWindow){this._quickAppointWindow.find("#"+this._id+"_quickAppwindow").css("display","block");this._quickAppointWindow.find(".e-quickstartend").html(a.quickString);h=n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells")?n(r):n(r.target);r.type!="beforeOpen"&&!this.model.readOnly?this._quickAppointWindow.ejDialog("open"):"";this._quickAppointWindow.find(".subject").val("");var st=h.offset().left-(this._quickAppointWindow.width()-h.width())/2+10,ht=h.offset().top-this._quickAppointWindow.outerHeight()+4,c=this._quickWindowPosition(st,ht,h,this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:c.X,Y:c.Y}});t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(u,this._cellIndex)}this._focused=n(":focus");this.model.showQuickWindow&&this._quickAppointWindow.find(".subject").focus();this._cellClick=!0;t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("CreateAppointmentTitle")})}else if(!u.hasClass("e-resourceheadercells")&&!u.hasClass("e-appsoverflow")&&!u.hasClass("e-monthheader")&&!u.hasClass("e-categorybar")){if(this._cellClick=!1,t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.find("#"+this._id+"_quickAppDetailswindow").css("display","block"),!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close"),e=u.hasClass("e-appointment")||u.hasClass("e-monthappointment")||u.hasClass("e-alldayappointment")?u:u.closest(".e-appointment,.e-alldayappointment,.e-monthappointment"),this._appUid=e.attr("guid"),u.hasClass("e-schedulemouseclose"))return!1;for(this._processed=this._sortAppById(this._processed),v=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),i=0;i<v.length;i++){f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,v[i].Guid));break}for(i=0;i<f.length;i++)g=this.element.find("[guid="+f[i].Guid+"]"),g.addClass("e-selectedAppointment");this._mediaQuery&&(this._mAppId=this._appUid);var nt=this._sortAppById(f),l=nt[0][this._appointmentSettings.recurrence]?nt[0]:this._getAppointmentByParentId(this._appUid),y=(new Date).getTime()-l[this._appointmentSettings.startTime].getTime(),p=6e4,ct=60*p,lt=24*ct,tt=Math.abs(new Date-l[this._appointmentSettings.startTime]),o=Math.floor(tt/36e5);if(o=o<=9?"0"+o:o,s=new Date(tt).getUTCMinutes(),s=s<=9?"0"+s:s,it=Math.ceil(y/p-1)<0&&o<24?this._getLocalizedLabels("EventBeginsin")+" "+o+" "+this._getLocalizedLabels("Hours")+" "+s+" "+this._getLocalizedLabels("Minutes"):Math.ceil(y/p-1)<0&&o>=24?this._getLocalizedLabels("EventBeginsin")+" "+Math.abs(Math.ceil(y/lt))+" "+this._getLocalizedLabels("Days"):this._getLocalizedLabels("Overdue"),rt={appointment:f[0]},this._trigger("appointmentClick",rt))return n(".e-selectedAppointment").css({border:"none"}),!1;this.model.showQuickWindow&&(this._quickAppDetailsWindow&&this._quickAppDetailsWindow.find(".e-quicksubject").html(l[this._appointmentSettings.subject]).attr("title",l[this._appointmentSettings.subject]),w=this._timeMode=="12"?t.format(f[0][this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(f[0][this._appointmentSettings.startTime],"HH:mm",this.model.locale),b=this._timeMode=="12"?t.format(f[f.length-1][this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(f[f.length-1][this._appointmentSettings.endTime],"HH:mm",this.model.locale),this._quickAppDetailsWindow.find(".e-rightfields").html(it),ut=Math.ceil((f[0][this._appointmentSettings.endTime]-f[0][this._appointmentSettings.startTime])/36e5)/24,ft=f.length>1||this.model.orientation=="horizontal"&&this.currentView()=="month"&&ut>1||f[0][this._appointmentSettings.startTime].getDay()!=f[f.length-1][this._appointmentSettings.endTime].getDay()?this._dayFullNames[f[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(f[0][this._appointmentSettings.startTime],"MMMM",this.model.locale)+" "+f[0][this._appointmentSettings.startTime].getDate()+" - "+w+" to "+this._dayFullNames[f[f.length-1][this._appointmentSettings.endTime].getDay()]+", "+t.format(f[f.length-1][this._appointmentSettings.endTime],"MMMM",this.model.locale)+" "+f[f.length-1][this._appointmentSettings.endTime].getDate()+" - "+b:this._dayFullNames[f[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(f[0][this._appointmentSettings.startTime],"MMMM",this.model.locale)+" "+f[0][this._appointmentSettings.startTime].getDate()+", "+w+" - "+b,this._quickAppDetailsWindow.find(".e-quickstartendtime").html(ft),l[this._appointmentSettings.recurrence]==1?this._quickAppDetailsWindow.find(".e-editseries").removeClass("e-disable"):this._quickAppDetailsWindow.find(".e-editseries").addClass("e-disable"),r.type!="beforeOpen"?this._quickAppDetailsWindow.ejDialog("open"):"",this.model.readOnly?this._quickAppDetailsWindow.find(".e-scheduledelete").addClass("e-disable"):this._quickAppDetailsWindow.find(".e-scheduledelete").removeClass("e-disable"),et=n(e).width()>this.element.width()?n(e).offset().left>this.element.offset().left?n(e).offset().left:this.element.find(".e-draggableworkarea").scrollLeft()>n(e).width()?this.element.offset().left:this.element.width()/2-4:n(e).offset().left-((this._quickAppDetailsWindow.width()-n(e).width())/2-4),ot=n(e).offset().top-this._quickAppDetailsWindow.outerHeight()+4,c=this._quickWindowPosition(et,ot,e,this._quickAppDetailsWindow),this._quickAppDetailsWindow.ejDialog({position:{X:c.X,Y:c.Y}}),this._quickAppDetailsWindow.focus());t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("Editevent")})}n(u).hasClass("e-monthcells")||this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px")}else{if((this._cellIndex=0,this.cur_StartTime=new Date(new Date(this.currentDate()).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(this.currentDate()).setHours(23,59,59)),n(u).parentsUntil(".e-agendacellstab tbody").find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus(),e=u.hasClass("e-agendaappointment")?u:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),this._appUid=e.attr("guid"),this._mediaQuery&&(this._mAppId=this._appUid),u.hasClass("e-editapp")||u.hasClass("e-deleteapp"))||(e=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._trigger("appointmentClick",{appointment:e[0]})))return!1;this._cellClick=!1}},_getDateByElement:function(n){var t=this.model.showWeekend?7:this.model.workWeek.length,i;this._cellIndex=this.model.timeScale.enable?n.hasClass("e-workcells")?n.index():n.hasClass("e-alldaycells")?n.index():this._isCustomMonthView()&&this._oneWeek?n.index():t-((parseInt(n.index()/t)+1)*t-n.index())+n.parent().index()*t:this.model.orientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?t-((parseInt(n.index()/t)+1)*t-n.index())+n.parent().index()*t:n.index();this.model.orientation=="horizontal"&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):this._cellIndex:n.index(),this._workCellIndex=n.parent().index());i=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this._resWorkWeek?this._dateRender:this.dateRender:this._dateRender;i=this.model.orientation=="horizontal"&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:i;this.curDate=new Date(i[this._cellIndex])},_slotByElement:function(n,i){this._getDateByElement(n);var r=this.curDate;n.hasClass("e-workcells")&&this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?(this._calcCurrentTime(r,n,i),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1})):i=="cellHover"?(this.cellHoverStartTime=new Date(new Date(r).setHours(0,0,0)),this.cellHoverEndTime=new Date(new Date(r).setHours(23,59,59))):(this.cur_StartTime=new Date(new Date(r).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(r).setHours(23,59,59)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}))},_calcCurrentTime:function(n,t,i){var r=this.model.orientation=="vertical"?this.model.startHour*60+t.parent().index()*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount):this.model.startHour*60+t.index()*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*this._cellIndex*(60/this.model.timeScale.majorSlot)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),u;r=r*6e4;this._timeScaleMin=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;this._timeScaleMin=this._timeScaleMin*6e4;i=="cellHover"?(this.cellHoverStartTime=new Date(n).setMilliseconds(r),u=parseInt(new Date(this.cellHoverStartTime).getHours())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getHours()&&parseInt(new Date(this.cellHoverStartTime).getMinutes())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?r+(this._timeScaleMin-1):new Date(this.cellHoverStartTime).getMilliseconds()+this._timeScaleMin,this.cellHoverEndTime=new Date(new Date(this.cellHoverStartTime).setMilliseconds(u)),this.cellHoverEndTime=new Date(this.cellHoverStartTime).setHours(0,0,0,0)<new Date(this.cellHoverEndTime).setHours(0,0,0,0)?new Date(new Date(this.cellHoverStartTime).setHours(23,59,59)):this.cellHoverEndTime):(this.cur_StartTime=new Date(n).setMilliseconds(r),u=parseInt(new Date(this.cur_StartTime).getHours())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getHours()&&parseInt(new Date(this.cur_StartTime).getMinutes())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?r+(this._timeScaleMin-1):new Date(this.cur_StartTime).getMilliseconds()+this._timeScaleMin,this.cur_EndTime=new Date(new Date(this.cur_StartTime).setMilliseconds(u)),this.cur_EndTime=new Date(this.cur_StartTime).setHours(0,0,0,0)<new Date(this.cur_EndTime).setHours(0,0,0,0)?new Date(new Date(this.cur_StartTime).setHours(23,59,59)):this.cur_EndTime)},_checkReminders:function(){var n,i;for(this._todayAppointments=[],n=0;n<this._processed.length;n++)new Date(new Date(this._processed[n][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()>=new Date((new Date).setHours(0,0,0,0)).getTime()&&this._todayAppointments.push(this._processed[n]);i=this;jQuery.each(this._todayAppointments,function(n,r){var u,f,e,o;t.isNullOrUndefined(i.model.reminderSettings)||(u=i.model.reminderSettings.alertBefore,f=r[i._appointmentSettings.startTime],u!=-1&&u!=null&&(e=(new Date).getTime(),o=(e-new Date(f).getTime())/6e4,Math.round(o)==u*-1&&i._trigger("reminder",{reminderAppointment:r})))})},_showContextMenu:function(i){var e=!1,o=!1,s=this.model.contextMenuSettings.menuItems.cells,f,h,c,l,r,u,a;if(i){if(this._contextMenu=t.buildTag("ul#"+this._id+"contextMenu"),this.element.append(this._contextMenu),this._contextMenu.ejMenu({fields:{id:"id",text:"text",parentId:"parentId"},menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+this._id,width:"auto",click:n.proxy(this._onMenuSelect,this),beforeOpen:n.proxy(this._beforeopen,this)}),this.model.categorizeSettings.enable&&this.model.contextMenuSettings.menuItems.appointment){for(f=this.model.contextMenuSettings.menuItems.appointment,h=this.model.categorizeSettings.dataSource.length,r=0;r<f.length;r++)if(f[r].id=="categorize"){c=r;o=!0;break}if(o)for(l=new t.DataManager(this.model.contextMenuSettings.menuItems.appointment).executeLocal((new t.Query).where("parentId",t.FilterOperators.equal,"categorize")),new t.DataManager(this.model.contextMenuSettings.menuItems.appointment).saveChanges({added:[],changed:[],deleted:l},"parentId"),r=0;r<h;r++)u=this.model.categorizeSettings,this.model.contextMenuSettings.menuItems.appointment.push({text:u.dataSource[r][u.text],id:"categorize_"+u.dataSource[r][u.id],fontColor:u.dataSource[r][u.fontColor],color:u.dataSource[r][u.color],parentId:this.model.contextMenuSettings.menuItems.appointment[c].id.toString()})}if(this._gotoDate&&this.model.contextMenuSettings.enable){for(a in s)if(s[a].id=="gotodate"){e=!0;break}e&&(this._renderGotoWindow(),this._gotoDate=!1)}}},_beforeopen:function(i){var f,v,y,p,a,e,u,w,h;if(this.model.contextMenuSettings.enable){n(document).off(t.eventType.mouseMove);var r=n(i.target).closest(".e-alldayappointment,.e-appointment,.e-monthappointment,.e-workcells,.e-monthcells,.e-alldaycells"),c,o=null,s,l=n(r).parents(".e-draggableworkarea tr").length>0&&n(r).parentsUntil(".e-draggableworkarea tr").is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn")||n(r).is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn");if(r.hasClass("e-appointment")||r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||t.isNullOrUndefined(this.model.appointmentTemplateId)||(r=n(i.target).offsetParent()),i.cancel=r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointment")||r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-appointinnertext")||r.hasClass("e-monthcells")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||l?!1:!0,i.cancel==!0)return h=this._contextMenu.data("ejMenu"),h.hide(),!1;if(this.currentView()=="agenda"&&l&&(i=n(r).hasClass("e-agendaappointment")?i:n(r).parents(".e-draggableworkarea tr").find(".e-agendaappointment")),this._cellSelection(i),(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells"))&&(s={currentDate:this.curDate,cellIndex:this._cellIndex,events:i,resources:!t.isNullOrUndefined(this.model.beforeContextMenuOpen)&&this._tempResource.length!=0?this._getResourceValue(r,this._cellIndex):null}),(r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||r.hasClass("e-appointment"))&&(o=this._getAppDetails(i),s={appointment:o,events:i}),this.currentView()=="agenda"&&(o=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],s={appointment:o,events:i}),this._baseTarget=r,this._trigger("beforeContextMenuOpen",s))return!1;if(f=this._contextMenu.data("ejMenu"),c=r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointment")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||l?!1:!0,c?f.option("fields.dataSource",this.model.contextMenuSettings.menuItems.cells):f.option("fields.dataSource",this.model.contextMenuSettings.menuItems.appointment),this.model.readOnly?(f.disableItemByID("new"),f.disableItemByID("recurrence"),f.disableItemByID("delete"),f.disableItemByID("categorize")):(f.enableItemByID("new"),f.enableItemByID("recurrence"),f.enableItemByID("delete"),f.enableItemByID("categorize")),v=this.element.find("td.e-selectedCell"),v.length>1&&this.currentView()!="agenda"&&this._multipleCellAppointCreation(i),this._target=i,this.model.showQuickWindow&&!t.isNullOrUndefined(this._quickAppointWindow)&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),this.model.categorizeSettings.enable&&c==!1){if(y=this._contextMenu.find("li#categorize").find("li").children(),y.find("div").length==0)for(u=0;u<this.model.categorizeSettings.dataSource.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+this.model.categorizeSettings.dataSource[u][this.model.categorizeSettings.id]).children().append('<div><div style="border: 1px solid black;height: 12px;margin-left: 2px;margin-top: 2px;width: 12px;background-color:'+this.model.categorizeSettings.dataSource[u][this.model.categorizeSettings.color]+'"><\/div><\/div>');for(u=1;u<=this.model.categorizeSettings.dataSource.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+u).children().find("div:first-child.e-categorizeMenuSelected")&&this._contextMenu.find("li#categorize").find("li#categorize_"+u).children().find("div:first-child").removeClass("e-categorizeMenuSelected");if(p=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),a=t.DataManager(this._processed).executeLocal(p),a[0][this._appointmentSettings.categorize])if(e=a[0][this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(e[0].length>0)for(u=0;u<e.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+e[u]).children().find("div:first-child").addClass("e-categorizeMenuSelected")}else e[0].length>0&&(w=e.length-1,this._contextMenu.find("li#categorize").find("li#categorize_"+e[w]).children().find("div:first-child").addClass("e-categorizeMenuSelected"))}else this._contextMenu.find("li#categorize")&&this._contextMenu.find("li#categorize").css("display","none")}else return h=this._contextMenu.data("ejMenu"),h.hide(),!1},_onMenuSelect:function(i){var o=i.events.ID.split("_"),u="",c=this._baseTarget,l,d,p,e,s,r,g,f,h,a,k,y,v;if(n(c).is(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment")||c.parents(".e-appointment").hasClass("e-appointment")||c.parents(".e-monthappointment").hasClass("e-monthappointment")||c.parents(".e-alldayappointment").hasClass("e-alldayappointment")||this.currentView()=="agenda"&&this.element.find(".e-selectedCell").parent().find(".e-agendaappointment")?(l=t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u=l[0][this._appointmentSettings.recurrence]==1&&l[0][this._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1?l[0]:this._getAppointmentByParentId(this._appUid)):u={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,resourceInfo:this._getResourceDetails(c)},t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("menuItemClick")==-1||(i={ID:i.ID,type:i.type,text:i.text,parentId:i.parentId,parentText:i.parentText}),this._trigger("menuItemClick",{events:i,targetInfo:u}))return!1;d=u[this._appointmentSettings.categorize];switch(o[0]){case"new":this._appointmentWindow(this._target);break;case"recurrence":this._appointmentWindow(this._target);this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0});this._repeat(i={isChecked:!0,isInteraction:!0});break;case"open":this._appointmentWindow(this._target);break;case"today":this._navigateClick(this.currentDate(new Date),"DateNavigation");break;case"view":t.isNullOrUndefined(o[1])||(p=o[1].toLowerCase(),this._navView=!0,this.currentView()!=p&&this._viewChange(null,this.currentView(),p));break;case"timemode":t.isNullOrUndefined(o[1])||(this.model.timeMode=this._timeMode=o[1]=="Hour12"?"12":"24",this._updateTimeMode());break;case"businesshours":case"workhours":this.model.workHours.highlight=this.model.workHours.highlight?!1:!0;this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells")&&this.element.find(".e-monthcells").removeClass("e-monthcellhighlight");break;case"gotodate":this._gotoWindow.ejDialog("open");break;case"delete":this._deleteAppoint();break;case"print":this._printAppointment(this._appUid);break;case"categorize":if(t.isNullOrUndefined(o[1]))this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment").removeClass("e-selectedAppointment");else if(this.model.categorizeSettings.enable){if(e=o[1],s="",u[this._appointmentSettings.categorize])if(r=u[this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(r[0].length>0){for(f=0;f<r.length;f++)if(r[f]==e){g=!0;break}if(g==!0)for(f=0;f<r.length;f++)r[r.length-1]!=e?r[f]!=e&&(s+=r.length-1!=f?r[f]+",":r[f]):r[f]!=e&&(s+=r.length-2!=f?r[f]+",":r[f]);else s=u[this._appointmentSettings.categorize]+","+e}}else s=r[r.length-1]==e?"":e.toString();else s=e.toString();if(u[this._appointmentSettings.categorize]=s,!t.isNullOrUndefined(o[1])&&this._trigger("beforeAppointmentChange",{appointment:u}))return u[this._appointmentSettings.categorize]=d,!1;var w=this,nt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",b=this._dataManager.update(nt,u,this.model.appointmentSettings.query._fromTable);for(new t.DataManager(this._currentAppointmentData).update("AppTaskId",u),h=this._processed.filter(function(n){return n[w._appointmentSettings.id]==u[w._appointmentSettings.id]}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:h},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:h},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:h},"Guid"),a=0,v=h.length;a<v;a++)this._appointmentRemove(h[a]);for(this._appointmentProcessing(u),this._currentViewAppointments=this._appointmentCount(),k=this._currentViewAppointments.filter(function(n){return n.ParentId==u.ParentId}),y=0,v=k.length;y<v;y++)this._refreshDayAppointments(k[y]);this._trigger("appointmentChanged",{appointment:u});!t.isNullOrUndefined(b)&&n.isFunction(b.promise)&&this.dataSource()instanceof t.DataManager&&b.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&w._processUrlBinding(i)});break}}},_updateTimeMode:function(){var r=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,u=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,i=this._timeSlotCount(r,u),n,f,e,h,o,s;t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".startendtime").ejTimePicker({timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});this.model.orientation!="horizontal"||this.currentView()==="month"||this._isCustomMonthView()||this.currentView()==="agenda"?this.currentView()==="month"||this._isCustomMonthView()||this.currentView()==="agenda"||(o=this.currentView()=="month"?1:0,(r||u)&&this.currentView()!=="month"&&!this._isCustomMonthView()?(i.columnCount.pop(),s=this.userTimeCellTemplate.render({timerows:i.strTime,cols1:i.columnCount,viewclass:o,timeScale:this.model.timeScale.minorSlotCount,cheight:this.model.cellHeight,userTemplateId:r,timeValue1:i.timeValue1,template:u})):s=this.timeCellTemplate.render({timerows:i.strTime,cols1:i.columnCount,viewclass:o,timeScale:this.model.timeScale.minorSlotCount,userTemplateId:r,template:u}),this.$TimeCellTD.children().remove(),this.$TimeCellTD.append(s),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px"),this.element.find(".e-headercells").addClass("e-dateheaderselect"),this._highlightCurrentTime(this.model.showCurrentTimeIndicator)):(n=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",f=n=="day"?1:n=="week"?7:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:5,this.datesColumn=this._getHeaderAllDayCellsCount(),e=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)?!0:!1,h=r||u?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),heightclass:n=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",multiRes:e,view:n,timeTdCount:i.strTime,colspan:n=="month"?1:i.strTime.length/f*2,height:n=="month"?62:59,width:this.model.width,headercellWidth:n=="day"?"100%":"55px",column:i.columnCount,userTemplateId:r,template:u}):this.horizontalHeader.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),heightclass:n=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",multiRes:e,view:n,timeTdCount:i.strTime,colspan:n=="month"?1:i.strTime.length/f*2,height:n=="month"?62:59,width:this.model.width,headercellWidth:n=="day"?"100%":"55px",column:i.columnCount}),this.aTR.children().remove(),this.aTR.append(h),this._borderAddRemove(),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this.element.find(".e-headercells").addClass("e-dateheaderselect"),this._businessHourScroller());t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()},_gotoOk:function(t){var u,f,i,r;if(n(t.currentTarget).hasClass("e-gotoOk")){if(u=this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker("option","value"),f=this._gotoWindow.find("#"+this._id+"show").ejDropDownList("option","itemValue"),data={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:t},this._trigger("actionBegin",{data:data,requestType:"dateNavigate"}))return!1;if(i=this.currentDate(),r=this.currentView(),this.currentDate(new Date(u)),this.currentView(f.toLowerCase()),data={previousDate:i,currentDate:this.currentDate(),previousView:r,currentView:this.currentView(),target:t,requestType:"dateNavigate"},this._trigger("navigation",data))return this.currentDate(new Date(i)),this.currentView(r),this._navView=!1,!1;this._renderCurrentView("ViewChange");this._trigger("actionComplete",{data:data,requestType:"dateNavigate"})}this._gotoCancel()},_gotoCancel:function(){this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker({value:this.currentDate()});this._gotoWindow.find("#"+this._id+"show").ejDropDownList({value:this.currentView()});this._gotoWindow.ejDialog("close")},_renderGoto:function(){var n,t;for(this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate}),n=[],t=0;t<this.model.views.length;t++)switch(this.model.views[t]){case"day":n.push({text:this._getLocalizedLabels("Day"),value:"day"});break;case"week":n.push({text:this._getLocalizedLabels("Week"),value:"week"});break;case"workweek":n.push({text:this._getLocalizedLabels("WorkWeek"),value:"workweek"});break;case"month":n.push({text:this._getLocalizedLabels("Month"),value:"month"});break;case"customview":n.push({text:this._getLocalizedLabels("CustomView"),value:"customview"});break;case"agenda":n.push({text:this._getLocalizedLabels("Agenda"),value:"agenda"})}this._gotoWindow.find("#"+this._id+"show").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:n,width:"100%",selectedItemIndex:0,cssClass:this.model.cssClass});this._gotoWindow.find(".e-gotobutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"60px",cssClass:"e-flat"+this.model.cssClass})},_renderGotoWindow:function(){n("#"+this._id+"gotoWindow_wrapper")&&n("#"+this._id+"gotoWindow_wrapper").remove();this._gotoWindow=t.buildTag("div.e-gotodialog#"+this._id+"gotoWindow");var i="<div><table width='100%' cellpadding='5'><tbody><tr><td>"+this._getLocalizedLabels("Date")+":<\/td><td><input id='"+this._id+"gotodate' type='text' value='' /><\/td><\/tr><tr><td>"+this._getLocalizedLabels("Showin")+":<\/td><td><input type='text' id='"+this._id+"show' /><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-floatright'><table><tr><td><div><button id='"+this._id+"gotook' type='button' class='e-gotobutton e-gotoOk'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div><button id='"+this._id+"gotocancel' type='button' class='e-gotobutton e-gotoCancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>";this._on(this._gotoWindow,"click",".e-gotobutton",n.proxy(this._gotoOk,this));this._gotoWindow.append(i);this.element.append(this._gotoWindow);this._renderGoto();this._gotoWindow.ejDialog({width:300,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("Gotodate"),target:"#"+this._id,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._gotoCancel,this)});n("#"+this._id+"gotoWindow_wrapper").appendTo("body").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_highlightCurrentTime:function(i){var e,f,c,u;if(t.preferredCulture(this.model.locale),i&&this.model.timeScale.enable){for(e=!1,f=0,u=0;u<this._dateRender.length;u++)if(new Date(new Date(this._dateRender[u]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()){e=!0;f=u;break}if(c=this.element.find(".e-workcellstab tr").first().find("td"),this.currentView()==="month"||this._isCustomMonthView())if(e)if(this.model.orientation=="vertical"){var o=this.model.showWeekend?7:this.model.workWeek.length,s=Math.floor(f/o),h=Math.abs(f-s*o);for(this.model.group||(this.res1=["0"]),u=0;u<this.res1.length;u++)n(n(this.element.find(".e-workcellstab tr")[s]).children()[Math.floor(h)]).hasClass("e-othermonths")||n(n(this.element.find(".e-workcellstab tr")[s]).children()[Math.floor(h)]).addClass("e-currentdayhighlight"),h+=o}else this._renderHorizontalCurrentTime();else this.model.orientation=="vertical"?this.element.find(".e-monthcells").removeClass("e-currentdayhighlight"):this.element.find(".e-workcells").removeClass("e-currentdayhighlight");else if(e){var r=this,l=this.currentView()==="week"?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._dateRender.length:1,a=this.model.cellWidth?parseInt(this.model.cellWidth):this.element.find(".e-draggableworkarea")[0].offsetWidth/(l*this.res1.length);if((new Date).getHours()>=r.model.startHour&&(new Date).getHours()<=r.model.endHour)if(r.model.orientation=="vertical")for(u=0;u<this.res1.length;u++)this.element.find(".e-draggableworkarea").append('<div id="'+this._id+u+'_HighlightCurrentTimeline" class="e-highlightcurrenttimeline"><\/div>'),n("#"+this._id+u+"_HighlightCurrentTimeline").append('<div class="e-currenttime"><\/div>').append(t.buildTag("div.e-icon e-circle_01 e-timeidicatorcircle e-lefttimeindicator")).append(t.buildTag("div.e-icon e-circle_01 e-timeidicatorcircle e-righttimeindicator")).css("width",a+"px").css("left",c[f+l*u].offsetLeft+"px").find(".e-righttimeindicator").css("margin-left",a-3+"px");else this._renderHorizontalCurrentTime();function v(){var f,o,s,i;if(r.currentView()!="month"&&!r._isCustomMonthView()){var h=r.element.find(".e-workcellstab tr").first().find("td"),e=r.currentView()==="week"?r.model.showWeekend?7:r.model.workWeek.length:r.currentView()==="workweek"?r.model.workWeek.length:r.currentView()=="customview"?r._dateRender.length:1,u=new Date;if(u.setMinutes(u.getMinutes()),f=r._dateRender.indexOf(new Date(u).setHours(0,0,0,0)),u.getHours()>=r.model.startHour&&u.getHours()<=r.model.endHour)if(r.model.orientation=="vertical"){for(r.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),o=((u.getHours()-r.model.startHour)*60+u.getMinutes())*(r.element.find(".e-workcells").height()+1)*r.model.timeScale.minorSlotCount/r.model.timeScale.majorSlot,i=0;i<r.res1.length;i++)r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").css("top",o-1),r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").css("left",h[f+e*i].offsetLeft),n(r.element.find(".e-dateheader").children()[f+e*i]).addClass("e-currentdayhighlight");for(s=r._timeMode=="12"?t.format(new Date,"hh:mm tt",r.model.locale):t.format(new Date,"HH:mm",r.model.locale),i=0;i<r.res1.length;i++)r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").find(".e-currenttime").html(s),r._timeMode=="12"&&r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").find(".e-currenttime").addClass("e-timewidth")}else r._horizontalTimePosition(r,u)}}v();t.isNullOrUndefined(this._intervalID)&&(this._intervalID=window.setInterval(v,6e4))}else window.clearInterval(this._intervalID),this._intervalID=null,this.element.find(".e-highlightcurrenttimeline").remove()}},_filter:function(){for(var r=[],i=n.extend(!0,[],this._processed),t=0;t<i.length;t++)new Date(i[t][this._appointmentSettings.endTime])>=this.model.minDate&&new Date(i[t][this._appointmentSettings.endTime])<=this.model.maxDate&&r.push(i[t]);return r},_getPreviousNextAppointment:function(){var i=(this.model.orientation=="horizontal"||!this.model.showNextPrevMonth)&&this.currentView()=="month"?this.monthDays:this._dateRender,u=[],f=[],t=this._filter(),n,r;if(this.currentView()!="workweek")for(n=0;n<t.length;n++)new Date(t[n][this._appointmentSettings.startTime])<new Date(i[0])&&new Date(t[n][this._appointmentSettings.endTime])<new Date(i[0])?u.push(t[n]):new Date(t[n][this._appointmentSettings.startTime])>new Date(i[i.length-1])&&new Date(t[n][this._appointmentSettings.endTime])>new Date(i[i.length-1])&&f.push(t[n]);else for(n=0;n<t.length;n++)for(r=0;r<i.length;r++)new Date(t[n][this._appointmentSettings.startTime]).getDay()==new Date(i[r]).getDay()&&(new Date(t[n][this._appointmentSettings.startTime])<new Date(i[0])&&new Date(t[n][this._appointmentSettings.endTime])<new Date(i[0])?u.push(t[n]):new Date(t[n][this._appointmentSettings.startTime])>new Date(i[i.length-1])&&new Date(t[n][this._appointmentSettings.endTime])>new Date(i[i.length-1])&&f.push(t[n]));return{previous:u,next:f}},_nextPrevAppointment:function(n){var r,i;if(n&&!(this._browserInfo.name==="msie"&&this._browserInfo.version<9)){var u=this.element.find("#"+this._id+"_scroller"),o=u.ejScroller("instance").isVScroll()?this.element.find("#"+this._id+"_scroller").find(".e-vscroll").outerWidth():0,f=t.buildTag("div.e-prevapp enable",this._getLocalizedLabels("PreviousAppointment"),{},{}),e=t.buildTag("div.e-nextapp enable",this._getLocalizedLabels("NextAppointment"),{},{});u.append(f).append(e);r=u.height()/2-75;i=this.element.find(".e-scrolltimecells").parent().outerWidth();i=t.isNullOrUndefined(i)?0:i;this.model.enableRTL?(f.css({top:r+40+"px",transform:"rotate(-90deg)",right:i-61+"px"}),e.css({top:r+40+"px",transform:"rotate(90deg)",right:this.element.find(".e-workareadiv").width()-61-o-30+"px"})):(f.css({top:r+40+"px",transform:"rotate(90deg)",left:i-61+"px"}),e.css({top:r+40+"px",transform:"rotate(-90deg)",left:this.element.find(".e-workareadiv").width()-61-o-30+"px"}))}},_nextPrev:function(i){var u=this,r=this._getPreviousNextAppointment();n(i.currentTarget).hasClass("e-prevapp")?t.isNullOrUndefined(r)||(r.previous.sort(function(n,t){return new Date(t[u._appointmentSettings.startTime])-new Date(n[u._appointmentSettings.startTime])}),this.currentView()=="customview"&&(this._daterend=r.previous[0][this._appointmentSettings.startTime]),this._navigateClick(this.currentDate(new Date(new Date(r.previous[0][this._appointmentSettings.startTime]).setHours(0,0,0,0))),"Previous")):n(i.currentTarget).hasClass("e-nextapp")&&(t.isNullOrUndefined(r)||(r.next.sort(function(n,t){return new Date(n[u._appointmentSettings.startTime])-new Date(t[u._appointmentSettings.startTime])}),this.currentView()=="customview"&&(this._daterend=r.next[0][this._appointmentSettings.startTime]),this._navigateClick(this.currentDate(new Date(new Date(r.next[0][this._appointmentSettings.startTime]).setHours(0,0,0,0))),"Next")))},_nextPrevButton:function(){if(this._appointmentCount().length!=0)this.element.find(".e-prevapp,.e-nextapp").css("display","none");else{this.currentView()=="agenda"&&this._refreshAppNavigation();var n=this._getPreviousNextAppointment();this.element.find(".e-prevapp,.e-nextapp").css("display","block");n.previous.length==0?this.element.find(".e-prevapp").removeClass("enable").addClass("e-nextprevappdisable"):this.element.find(".e-prevapp").addClass("enable").removeClass("e-nextprevappdisable");n.next.length==0?this.element.find(".e-nextapp").removeClass("enable").addClass("e-nextprevappdisable"):this.element.find(".e-nextapp").addClass("enable").removeClass("e-nextprevappdisable")}},_navigateView:function(i){var e,u,o,f,c=this.currentView(),r=n(i.target),s,h;if(this.currentView()=="agenda")return!1;if(this.model.orientation=="vertical"){if(this.currentView()==="month"||this._isCustomMonthView()){if(r.hasClass("e-monthheader")){if(this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1)return!1;if(f=r.parent().index(),o=f>6?f%7:f,u=new Date(this._dateRender[r.parent().parent().index()*7+o]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(u);else return!1;e="day"}else if(r.hasClass("e-timecells")||r.hasClass("e-timecelldivs")){if(r=r.hasClass("e-timecells")?r:r.parent(),this.model.views.toString().toLowerCase().split(",").indexOf("week")==-1)return!1;if(u=new Date(this._dateRender[r.parent().index()*7]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(u);else return!1;e="week"}}else if(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7){if(s=r.hasClass("e-headercells")?r:r.parent().hasClass("e-headercells")?r.parent():r.closest(".e-headercells"),this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1||!s.hasClass("e-headercells"))return!1;if(f=s.index(),h=this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()==="customview"?this._dateRender.length:7,o=f>h-1?f%h:f,u=new Date(this._dateRender[o]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(new Date(u));else return!1;e="day"}this._navView=!0;c=="day"||t.isNullOrUndefined(e)||(this._viewChange(i,c,e),this._businessHourScroller())}else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._horizontalViewNavigation(i)},_appOverflowClick:function(i){var r;if(this.model.views.toString().toLowerCase().split(",").indexOf("day")!==-1){if(this._trigger("overflowButtonClick",{event:i,Datas:this._overflowApp}))return!1;t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");this.model.orientation=="vertical"?(r=n(i.target).closest(".e-monthcells,.e-workcells").parent().index()*7+n(i.target).closest(".e-monthcells,.e-workcells").index()%7,this.currentDate(new Date(this._dateRender[r]))):(r=parseInt(n(i.target).attr("id").split("_")[n(i.target).attr("id").split("_").length-1]),this.currentDate(this.currentView()=="month"||this._isCustomMonthView()?new Date(this.monthDays[r]):new Date(parseInt(n(i.target).attr("cellinfo")))));this._navView=!0;this._viewChange(i,this.currentView(),"day")}else return!1},_viewCalendar:function(){var u=this.element.find("#"+this._id+"_navigator").data("ejDatePicker"),i,t,r;u&&(u.show(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}),i=this.element.offset(),this.model.enableRTL?(t=i.left+this.element.width()-280,t<0&&(t=0)):(t=i.left+55,r=n(document).scrollLeft()+n(window).width(),r-t<n("#e-"+this._id+"_navigator").width()&&(t=r-n("#e-"+this._id+"_navigator").width())),n("#e-"+this._id+"_navigator").css({top:i.top+47+"px",left:t+"px"}));this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover");this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment").removeClass("e-selectedAppointment")},_viewChange:function(i,r,u){this._viewchange=!0;this._renderedApp=[];u=t.isNullOrUndefined(u)?i.currentTarget.className.split("e-")[2].split(" ")[0]:u;var e=!0,f;if(f={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i},this._trigger("actionBegin",{data:f,requestType:"viewNavigate"}))return!1;if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),r!==u||!r&&!u){if(r=this.currentView(),this._navView?this.currentView(u):(e=this.currentView()==i.currentTarget.className.split("e-")[2].split(" ")[0]?!1:!0,this.currentView(n(i.currentTarget).hasClass("e-activeview")?this.currentView():i.currentTarget.className.split("e-")[2].split(" ")[0])),f={previousView:r,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i,requestType:"viewNavigate"},this._trigger("navigation",f))return this.currentView(r),this._navView=!1,!1;e&&this._renderCurrentView("ViewChange")}f={previousView:r,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i,requestType:"viewNavigate"};this._mediaQuery&&r!=this.currentView()&&this.element.find(".e-workareadiv,.e-navigate").addClass("navigate");this._trigger("actionComplete",{data:f,requestType:"viewNavigate"})},_renderCurrentView:function(n){t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");this._resWorkWeek=this.model.orientation=="vertical"&&this.model.showWeekend&&this.currentView()=="workweek"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek);this.element.find(".e-commonviewbutton").blur().removeClass("e-activeview");this.model.orientation=="vertical"&&this.element.find(".e-headerdaydisplay,.e-datedisplay,.e-headrealldaytable").children().remove();this._getRenderDates();this.wTR.children().remove();this.aTR.children().remove();this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview").attr("tabIndex",0).focus();t.isNullOrUndefined(this._scheduleDrawer)||this._navSelected||this._scheduleDrawer.ejNavigationDrawer({listViewSettings:{selectedItemIndex:this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())+1}});this._renderHeaderAllDayTemplate();this._renderContentAreaTemplate();this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue());this._renderCommon();t.isNullOrUndefined(this.dataSource())||(n!="ScheduleResize"?this.model.enableLoadOnDemand?this._bindAppointmentsData(n):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):this._renderAppointmentAll());this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.blockoutSettings.enable&&this._renderBlockAppointments();this._navView=!1},_renderHeaderDays:function(){var f,u,e,h,r,o,i,s;if(this.dateRender=[],f=this._getRenderDates(),this.res1=t.isNullOrUndefined(this.model.group)?[0]:this.res1,!this._resWorkWeek)for(i=0;i<this.res1.length;i++)for(u=0;u<f.length;u++)this.dateRender.push(new Date(f[u]));if(this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate),this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate),this.model.orientation=="vertical")if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),this.currentView()==="month"||this._isCustomMonthView())this._renderMonthTimeCells();else{if(t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(i=0;i<this.dateRender.length;i++)e=this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this.dateRender[i]).getDay()]:this._dayShortNames[new Date(this.dateRender[i]).getDay()]:this._dayShortNames[new Date(this.dateRender[i]).getDay()],h=this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?t.format(new Date(this.dateRender[i]),this._pattern.D,this.model.locale):e+" "+new Date(this.dateRender[i]).getDate():e+" "+new Date(this.dateRender[i]).getDate(),this.element.find(".e-headerdaydisplay").eq(i).html(h),new Date(new Date(this.dateRender[i]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&this.element.find("td.e-headercells").eq(i).addClass("e-currentdayhighlight");else{if(r=[],o=this._getUserDateheaderTemplate(),this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(i=0;i<this.res1.length;i++)r=n.merge(r,o);else r=n.merge(r,o);for(i=0;i<this.dateRender.length;i++)this.element.find(".e-headerdaydisplay").eq(i).html(r[i].currentDay),new Date(new Date(this.dateRender[i]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&this.element.find("td.e-headercells").eq(i).addClass("e-currentdayhighlight")}if(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),!t.isNullOrUndefined(this.model.allDayCellsTemplateId)&&this.model.timeScale.enable){for(s=this._getUserAllDayCellsTemplate(),a=0;a<s.length;a++)this.element.find(".e-alldaycells").eq(a).html(s[a]);this.element.find(".e-leftindent").height(this.element.find(".e-alldaycells").height())}this.element.find(".e-headercells").addClass("e-dateheaderselect")}else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._renderHorizontalHeaderDays(this._culture)},_renderMonthTimeCells:function(){var s=0,u=this._dateRender,o=0,r=this.model.showWeekend?7:this.model.workWeek.length,f=t.isNullOrUndefined(this.model.group)?r:this.res1.length*r,h=this._tempResource.length!=0&&t.scheduleFeatures.resources?!0:!1,c,e,n,i;for(f=h?this._isCustomMonthView()&&this._oneWeek?this.res1.length*this._dateRender.length:this.res1.length*r:t.isNullOrUndefined(this.model.group)?r:this._isCustomMonthView()&&this._oneWeek?this.res1.length*this._dateRender.length:this.res1.length*7,c=h&&this._isCustomMonthView()&&this._oneWeek?!0:!1,e=this.element.find("div.e-monthheader"),n=0;n<u.length;n++){for(i=o;i<f;i=c?i+this._dateRender.length:i+r)e.eq(i).html(t.format(new Date(u[n]),"dd",this.model.locale).toString()),this.currentView()!=="customview"&&(new Date(u[n]).getMonth()!==new Date(this.currentDate()).getMonth()?this.model.showNextPrevMonth?e.eq(i).addClass("e-monthdateshighlight").closest(".e-monthcells").removeClass("e-othermonths").children().show():e.eq(i).addClass("e-monthdateshighlight").closest(".e-monthcells").addClass("e-othermonths").children().hide():e.eq(i).removeClass("e-monthdateshighlight").closest(".e-monthcells").removeClass("e-othermonths").children().show()),new Date(u[n]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&(this.element.find("td.e-monthcells").eq(i).hasClass("e-othermonths")||this.element.find("td.e-monthcells").eq(i).addClass("e-currentdayhighlight"));o++;(n+1)%r==0&&(o=f,f=f+(t.isNullOrUndefined(this.model.group)?1:this.res1.length)*r,this.model.showNextPrevMonth||this.currentView()=="customview"?(start=t.format(new Date(u[n-(r-1)]),"MMM dd",this.model.locale),end=t.format(new Date(u[n]),"MMM dd",this.model.locale)):(tempDate=new Date(this.currentDate()),start=n==r-1?t.format(new Date(tempDate.getFullYear(),tempDate.getMonth(),1),"MMM dd",this.model.locale):t.format(new Date(u[n-(r-1)]),"MMM dd",this.model.locale),end=n==u.length-1?t.format(new Date(tempDate.getFullYear(),tempDate.getMonth()+1,0),"MMM dd",this.model.locale):t.format(new Date(u[n]),"MMM dd",this.model.locale)),this.model.timeScale.enable&&this.element.find(".e-timecelldivs").eq(s).html(start+" - "+end),s++)}this.model.showNextPrevMonth||this.currentView()!="month"||this._refreshOtherMonthsBorder();this.element.find(".e-timecells").addClass("e-dateheaderselect");this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length))},_refreshOtherMonthsBorder:function(){for(var i,e,n,r=this.model.enableRTL?"e-borderright":"e-borderleft",u=this.element.find(".e-workcellstab tr").first().find(".e-othermonths").length,f=u/this.res1.length,t=f;t<u;t=t+f)this.element.find(".e-workcellstab tr").first().find(".e-othermonths").eq(t).addClass(r);for(i=this.element.find(".e-workcellstab tr").last().find(".e-othermonths").length,e=i/this.res1.length,n=0;n<i;n=n+e)this.element.find(".e-workcellstab tr").last().find(".e-othermonths").eq(n).addClass(r)},_nextPrevDate:function(n){var r,t=new Date(new Date(this.currentDate()).setHours(0,0,0,0)),i=this.currentView()==="day"||this.currentView()==="agenda"?1:this.currentView()==="customview"?this._dateRender.length:7,u,f,e;return this.currentView()==="month"?(u=n=="navigateprevious"?new Date(t.getFullYear(),t.getMonth()-1,t.getDate()):new Date(t.getFullYear(),t.getMonth()+1,t.getDate()),f=n=="navigateprevious"?new Date(t.getFullYear(),t.getMonth()-1,1):new Date(t.getFullYear(),t.getMonth()+1,1),r=u.getMonth()==f.getMonth()?new Date(u):new Date(f._currentMonthDates().end)):this.currentView()==="customview"?(this._daterend=this._dateRender,this._dateNavigation=!0,t=this.model.showWeekend?new Date(this._dateRender[0]):new Date(this._renderStart),i=this.model.showWeekend?i:this._isCustomMonthView()?this._numDays:this._renderDays,r=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i)):this.currentView()!="day"||this.model.showWeekend?r=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i):(e=n=="navigateprevious"?new Date(t.getTime()-864e5):new Date(t.getTime()+864e5),i=this._getPrevNextDateCount(e,n=="navigateprevious"?"previous":"next")+1,t=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i),r=new Date(t)),new Date(r.getFullYear(),r.getMonth(),r.getDate())},_navigateClick:function(i,r){var u,f,o,e;if(this._viewchange=!0,f=r,o=new Date(this.currentDate()),u={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i},this._trigger("actionBegin",{data:u,requestType:"dateNavigate"}))return!1;if(t.isNullOrUndefined(i)||t.isNullOrUndefined(i.value)||this.currentDate(t.parseDate(i.value,this._pattern.d)),i!=null&&!this._setCurrentDate){if(n(i.currentTarget).hasClass("e-disable"))return!1;n(i.currentTarget).hasClass("e-navigateprevious")?(this.currentDate(this._nextPrevDate("navigateprevious")),this.element.find(".e-navigateprevious").attr("tabIndex",0).focus(),f="Previous"):n(i.currentTarget).hasClass("e-navigatenext")&&(this.currentDate(this._nextPrevDate("navigatenext")),this.element.find(".e-navigatenext").attr("tabIndex",0).focus(),f="Next")}if(i!=null&&(n(i.currentTarget).hasClass("e-navigateprevious")||n(i.currentTarget).hasClass("e-navigatenext")||i.type=="select")&&(u={previousDate:o,currentDate:new Date(this.currentDate()),currentView:this.currentView(),target:i,requestType:"dateNavigate"}),this._trigger("navigation",u))return this.currentDate(new Date(o)),!1;this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");this.element.find(".e-appsoverflow").remove();this.element.find(".e-monthcells").removeClass("e-monthcurrenttime");this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));t.isNullOrUndefined(this._scheduleDrawer)||this._scheduleDrawer.ejNavigationDrawer("close");this.currentView()!=="month"&&this.currentView()!=="agenda"&&!this._isCustomMonthView()&&(this.currentView()!=="customview"||this.model.showWeekend)&&this.model.timeScale.enable&&t.isNullOrUndefined(this.model.workCellsTemplateId)?(this._renderHeaderDays(),t.isNullOrUndefined(this.model.queryCellInfo)||(this._renderQueryCellInfo("renderHeaderAllDayTemplate"),this._renderQueryCellInfo("renderContentAreaTemplate"),this._renderQueryCellInfo("emptycell")),this.model.showOverflowButton||this.model.orientation!="horizontal"||(this._horizontalRender(),this._reRenderScroller()),t.isNullOrUndefined(this.dataSource())||(this.model.enableLoadOnDemand?this._bindAppointmentsData(f):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll())),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this._businessHourScroller(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.blockoutSettings.enable&&this._renderBlockAppointments()):this._renderCurrentView(f);this._validateMinMaxDate();!t.isNullOrUndefined(this.oldDate)&&this.oldDate!=""&&this._setCurrentDate&&(this.currentDate(new Date(this.oldDate)),this.oldDate="");this._setCurrentDate=!1;this._mediaQuery&&!t.isNullOrUndefined(i)&&(e=n(i.currentTarget).hasClass("e-navigateprevious")?this.element.width():n(i.currentTarget).hasClass("e-navigatenext")||i.type=="select"?-this.element.width():0,this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll,.e-emptyscrolltd").toggle(),this.model.enableRTL?this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginRight:-e,marginLeft:e}).toggle().animate({marginLeft:0,marginRight:0},500,this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length==1?n.proxy(this._animateScroll,this):""):this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginLeft:-e,marginRight:e}).toggle().animate({marginLeft:0,marginRight:0},500,this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length==1?n.proxy(this._animateScroll,this):""));this._trigger("actionComplete",{data:u,requestType:"dateNavigate"})},_animateScroll:function(){this.element.find(".e-emptyscrolltd").toggle();this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginRight:0,marginLeft:0});(this._browserInfo.name=="webkit"||this._browserInfo.name=="msie")&&(highScrol=this.element.find(".e-businesshighlightworkcells").length!=0?this.element.find(".e-businesshighlightworkcells").first().parent()[0].rowIndex*n(".e-workcells").height():0,n("#"+this._id+"_scroller").ejScroller({scrollTop:highScrol+1}),this.element.find(".e-scrolltimecells").css("top",-(highScrol+1)+"px"))},_validateMinMaxDate:function(){this.element.find(".e-navigateprevious,.e-navigatenext").removeClass("e-disable");var i=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this._dateRender,n=new Date(i[0]),t=new Date(i[i.length-1]);this.currentView()=="workweek"&&(n=new Date(n.setDate(n.getDate()-1)),t=new Date(t.setDate(t.getDate()+1)));n<=this.model.minDate?this.element.find(".e-navigateprevious").addClass("e-disable"):this.element.find(".e-navigateprevious").removeClass("e-disable");t>=this.model.maxDate?this.element.find(".e-navigatenext").addClass("e-disable"):this.element.find(".e-navigatenext").removeClass("e-disable")},_onScheduleResize:function(){var s,u,c,l,a,o,r,i,f,e,h;if(t.isNullOrUndefined(this._scheduleDrawer)||(t.isNullOrUndefined(this._scheduleDrawer.data("ejNavigationDrawer"))?(n(this._scheduleDrawer).remove(),this._scheduleDrawer=null):this._scheduleDrawer.ejNavigationDrawer("close")),this._mediaQuery&&t.isMobile()){if(t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("refresh"),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("refresh"),window.orientation==this._screenOrientation)return!1;this._screenOrientation=window.orientation}if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),e=this._mediaQuery,s=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:(document.documentElement.clientWidth+(s?17:0)<361||t.isMobile())&&this.model.isResponsive,this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive"),u=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),this.currentView()!="agenda"?(c=u.isVScroll()?this.element.find("div#"+this._id+"_scroller").find(".e-vscroll").width():0,this.element.find(".e-nextapp").css("left",this.element.width()-c-90+"px"),this.model.enableRTL&&this.element.find(".e-nextapp").css("left","-45px"),this.model.enableRTL&&this.element.find(".e-prevapp").css("left",this.element.width()-this.element.find(".e-scrolltimecells").width()-89+"px"),this.model.orientation!="horizontal"||t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||(this.element.find(".resemptytd").width(this.element.find(".e-horizontalrestd").width()<100?5:this.element.find(".e-horizontalrestd").width()>=100&&this.element.find(".e-horizontalrestd").width()<=150?10:25),this.element.find(".e-horizontalresheader").width(this._mediaQuery?"50px":"100%"),this.element.find(".e-parentnodecategory").width(this._mediaQuery?"12px":"20px")),l=this.model.orientation==="vertical"?(s&&this._mediaQuery?this.element.outerWidth()+17:this.element.outerWidth())-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width(),u.model.width=parseInt(l)-2,u.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),u.refresh(),this.model.orientation=="vertical"?(this._renderHoriVerticalScroll(),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-upicon, .e-downicon").children().width(this.element.find(".e-workcells").width()),this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css("margin-left","0px"),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px")):this._isCustomMonthView()&&this.currentView()=="month"&&this.currentView()=="day"&&this.model.enableRTL&&!this.model.timeScale.enable||(this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this._horizontalRender(),this.model.showOverflowButton||this._renderAppointmentAll()),this.currentView()=="month"||this._isCustomMonthView()||this.model.orientation!="vertical"?(this._isCustomMonthView()||this.currentView()=="month"||this.currentView()=="day"||this.model.enableRTL||!this.model.timeScale.enable)&&this._renderCurrentView("ScheduleResize"):this.model.enableRTL&&(this.model.cellWidth||this.model.cellHeight)?this._renderCurrentView("ScheduleResize"):(this.model.showAllDayRow&&this.model.timeScale.enable&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments(),this.model.timeScale.enable||(this.element.find("div.e-monthappointment").remove(),this._currentViewAppointments=this._appointmentCount(),this._renderMonthAppointment()),this._bindAppointmentAction()),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator)):(u.model.width=parseInt(this.element.width())-2,u.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),u.refresh(),a=n("div#"+this._id+"_scroller"),this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),a.ejScroller("isVScroll")?this.element.find(".e-emptyscrolltd").show()&&this.element.find(".e-draggableworkarea").height(this.element.find(".e-draggableworkarea").height()+1):this.element.find(".e-emptyscrolltd").hide()),(this._mediaQuery||this.element.width()<600)&&!n("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer(),o=this._mediaQuery==e?!1:!0,!o&&(this.element.width()<600&&this.hTR.find(".e-mobileNavigation").length<1||this.element.width()>600&&this.hTR.find("table.e-viewstable").length<1)&&(this._reRenderHeaderBar(),this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this))),o){if(this.model.orientation=="horizontal")for(r=this._dateRender,i=0;i<r.length;i++)f=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(r[i]).getDay()].split("")[0]:this.currentView()==="day"?t.isNullOrUndefined(this._tempResource)&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(r[i]).getDay()]:this._dayShortNames[new Date(r[i]).getDay()]:this._dayShortNames[new Date(r[i]).getDay()],e=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?f+parseInt(t.format(new Date(r[i]),"dd",this.model.locale)):this.currentView()==="day"?t.isNullOrUndefined(this._tempResource)&&t.isNullOrUndefined(this.model.group)?f+" "+t.format(new Date(r[i]),"dd MMMM yyyy",this.model.locale):f+" "+t.format(new Date(r[i]),"dd MMM yy",this.model.locale):f+" "+new Date(r[i]).getDate(),this.element.find(".e-headerdaydisplay,.e-horizontalheaderdiv").length!=0&&(this.element.find(".e-headerdaydisplay,.e-horizontalheaderdiv")[i].innerHTML=e);this.model.showAppointmentNavigator=o&&!this._mediaQuery;this.model.showAppointmentNavigator?this._nextPrevAppointment(this.model.showAppointmentNavigator):this.element.find(".e-prevapp,.e-nextapp").remove();this.model.showHeaderBar&&this._reRenderHeaderBar();this.element.find(".e-leftindenttable").width(this.element.find(".e-workleftindent").width());this.element.find(".e-ampmdisplay").height(this.element.find(".e-workcells").height());this._businessHourScroller();this.model.showQuickWindow=this._mediaQuery?!1:this._quickWindow;t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow();this._refreshAppointmentWindow();t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close");t.isNullOrUndefined(this._recurEditWindow)||(this._recurEditWindow.ejDialog("close"),this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":360}));this._mediaQuery&&this._phoneChanges();this._renderAppointmentAll();this.model.blockoutSettings.enable&&this._renderBlockAppointments();this._mediaQuery?(this._off(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells"),this._off(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells"),this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this))):(this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells",n.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells",n.proxy(this._shiftSelection,this)),this.element.width()>600&&this._off(this.element,"click","#"+this._id+"navDrawerIcon"));this._mediaQuery||t.isTouchDevice()?this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",n.proxy(this._touchSchedule,this)):this._off(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab");this._on(this.element,t.isMobile()?"click":"dblclick",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells",n.proxy(this._appointmentWindow,this));this._mediaQuery||t.isMobile()?this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this)):this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment");h=n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper");this._mediaQuery?h.addClass("e-scheduleresponsive"):h.removeClass("e-scheduleresponsive");this._mediaQuery&&this.res1.length>1&&this.element.addClass("e-resources")}(this._mediaQuery||this.element.width()<600)&&this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36)},_reRenderHeaderBar:function(){var t=this.element.find(".e-scheduleheader");t.empty();this._renderHeaderBar(t);this.element.find("#"+this._id+"_navigator").ejDatePicker({enableRTL:this.model.enableRTL,buttonText:this._getLocalizedLabels("Today"),select:n.proxy(this._onselect,this),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate});this.element.find(".e-datecommondiv").find(".e-datewidget").css("display","none");this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview")},_renderTemplates:function(){this.model.orientation=="vertical"&&(this.workcellTemp=n.templates(v()),this.monthcellTemp=n.templates(u()),this.timeCellTemplate=n.templates(y()),this.userTimeCellTemplate=n.templates(p()),this.headTemplate=n.templates(s()),this.alldayTemp=n.templates(l()),this.leftIndent=n.templates(h()));t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._renderResourcesTemplate();this.agendaheadTemplate=n.templates(w());this.agendacellTemp=n.templates(k());this.appTemplate=n.templates(f());this.blockTimeTemplate=n.templates(e());t.scheduleFeatures.horizontal&&this.model.orientation==="horizontal"&&this._renderHorizontalTemplates();!t.isNullOrUndefined(this.model.categorizeSettings)&&this.model.categorizeSettings.enable&&(this._renderCategorizeTemplate(),this._categorizeMultipleTemplate=n.templates(o()))},_setNewStartEndHours:function(){this.currentView()==="month"||this._isCustomMonthView()||(this.model.orientation=="horizontal"&&(this.aTR.children().remove(),this._renderHeaderAllDayTemplate()),this.wTR.children().remove(),this._renderContentAreaTemplate(),this._borderAddRemove(),this.model.orientation=="horizontal"&&this._horizontalRender(),this._renderScroller(),this.element.find(".e-ampmdisplay").height(this.element.find(".e-workcells").height()),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").addClass("e-businesshighlightworkcells"),this._businessHourScroller(),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this._renderAppointmentAll(),this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments()))},_renderInitSchedule:function(){var u,i,r;this.element.addClass("e-scheduleouter");this._screenOrientation=window.orientation;this._quickWindow=this.model.showQuickWindow;u=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth;this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:(document.documentElement.clientWidth+(u?17:0)<361||t.isMobile())&&this.model.isResponsive;this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive");this._mediaQuery&&(this.model.showQuickWindow=!1);t.isNullOrUndefined(this._clientWidth)&&(this._clientWidth=this.model.width);this.currentView(this.currentView().toLowerCase());this.model.views=this.model.views.length==0?this.currentView().toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(",");this.model.workWeek=this.model.workWeek==""||this.model.workWeek==null?this._dayNamesArray:this.model.workWeek;this._resWorkWeek=this.model.orientation=="vertical"&&this.model.showWeekend&&this.currentView()=="workweek"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek);this.model.endHour>24&&(this.model.endHour=24);this.model.startHour<0&&(this.model.startHour=0);i=t.preferredCulture(this.model.locale);this._timeMode=this.model.timeMode==null?i.calendar.AM==null&&i.calendar.PM==null?"24":"12":this.model.timeMode=="Hour12"?"12":this.model.timeMode=="Hour24"?"24":this.model.timeMode;this.model.timeMode==null?this._pattern=i.calendar.patterns:this._pattern.t=this._timeMode=="12"?"h:mm tt":"HH:mm";this._firstdayofweek=this.model.firstDayOfWeek!=null?typeof this.model.firstDayOfWeek=="string"?this._dayNamesArray.indexOf(this.model.firstDayOfWeek.toString().toLowerCase()):this.model.firstDayOfWeek:i.calendar.firstDay;this.model.workWeek=this.model.workWeek.toString().toLowerCase().split(",");this.model.width=this.model.width?this.element.width(this._clientWidth).width():this.element.width();this.model.height=this.model.height?this.element.height(this.model.height).height():this.element.height();this.scWidth=this._scWidth?parseInt(this._scWidth):parseInt(this.model.width);this.scHeight=this._scHeight?parseInt(this._scHeight):parseInt(this.model.height);this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate);this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate);this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&this.currentView(this.model.views[0].toLowerCase());this._getRenderDates();this.element.css({width:this._clientWidth,height:this.model.height}).attr({role:"presentation",tabIndex:1});var e=this.model.orientation=="vertical"?"e-vertical":"e-horizontal",f=t.buildTag("div.e-scheduleinner "+e,"",{},{height:this.scHeight,width:this.scWidth}).css({height:this.scHeight-2+"px",position:"relative"}),o=t.buildTag("table.e-table","",{},{cellpadding:"0px",cellspacing:"0px"}).addClass("e-scheduleoutertable"),s=t.buildTag("tbody");this.hTR=t.buildTag("tr.e-scheduleheader");this.aTR=t.buildTag("tr.e-headerarearow");this.wTR=t.buildTag("tr.e-contentarearow");this.model.cellHeight?this.wTR.removeClass("e-celldefaultheight"):this.wTR.addClass("e-celldefaultheight");this._renderTemplates();this.model.showHeaderBar&&this._renderHeaderBar(this.hTR);this._renderHeaderAllDayTemplate();this._renderContentAreaTemplate();f.append(o.append(s.append(this.hTR).append(this.aTR).append(this.wTR)));this._mediaQuery&&this.res1.length>1&&this.element.addClass("e-resources");this._renderToolTip();this.element.append(f);this.model.showHeaderBar||this.element.find(".e-scheduleheader").hide();this.model.showHeaderBar&&(this.hTR.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview"),this.element.find("#"+this._id+"_navigator").ejDatePicker({startDay:this._firstdayofweek,enableRTL:this.model.enableRTL,buttonText:this._getLocalizedLabels("Today"),select:n.proxy(this._onselect,this),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate}),this.element.find("span.e-datewidget").css("display","none"));(this._mediaQuery||this.element.width()<600)&&this._renderNavigationDrawer();this._showContextMenu(this.model.contextMenuSettings.enable);r=n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper");this._mediaQuery?r.addClass("e-scheduleresponsive"):r.removeClass("e-scheduleresponsive");this._mediaQuery&&this._phoneChanges();this.model.enableRTL&&this._browserInfo.name=="webkit"&&!t.isNullOrUndefined(this._appointmentAddWindow)&&this._appointmentAddWindow.find(".e-chk-image").css("margin-right","-13px");this._renderCommon()},_renderToolTip:function(){var i=this,r;t.isNullOrUndefined(this.element.data("ejTooltip"))&&(r=this.model.tooltipSettings.enable?".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendacells.e-eventcolumn,.e-appup,.e-appdown,.e-appsoverflow":".e-appup,.e-appdown,.e-appsoverflow",this.element.ejTooltip({target:r,associate:"mousefollow",isBalloon:!1,beforeOpen:function(n){i._showToolTip(n)?i._openTooltip=!0:(n.cancel=!0,i._openTooltip=!1)},containment:"#"+this._id,tip:{adjust:{xValue:20,yValue:20}},position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}},tracking:function(t){(!i._openTooltip||n(t.event.target).is(".e-tophandle,.e-bottomhandle,.e-schedulemouseclose,.e-righthandle,.e-lefthandle,.e-schedulerepeat,.e-editapp,.e-deleteapp"))&&(t.cancel=!0,this.hide())}}))},_renderQuickWindow:function(){this.model.showQuickWindow&&(this._renderQuickAppWindow(),this._renderQuickAppDetailsView())},_renderDialogs:function(){this._renderQuickWindow();this._renderAppointmentWindow();this._renderRecurrenceEditor();this._renderRecurEditWindow();this._renderAlertWindow()},_renderCommon:function(){if(this.currentView()!="agenda"){if(this.model.orientation=="vertical"&&(this._headerbarWidth(),(this.currentView()==="month"||this._isCustomMonthView())&&this._renderMonthTimeCells(),this.model.timeScale.enable||(this.element.find(".e-headercells").first("td").css("border-left","none"),this.element.find(".e-workcellstab tr td:first-child").css("border-left","none")),!this.model.showAllDayRow&&this.model.cellWidth&&this.element.find(".e-workcellstab tr td:first-child").css({width:this.element.find(".e-headercells").width()}),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.element.find(".e-ampmdisplay").css({height:this.element.find(".e-workcells").height()})),this.currentView()!="agenda"&&this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0){var i=this.model.enableRTL?"border-right":"border-left";this.element.find(".e-horizontaldaterender").css(i,"0px");this.wTR.find(".e-workareadiv").parent().css(i,"0px");this.model.timeScale.enable||this.currentView()==="month"||this._isCustomMonthView()||this.element.find(".e-workcellstab tr td:nth-child(1)").css(i,"0px")}this.model.enableRTL&&this.element.addClass("e-rtl");this.model.timeScale.enable&&this._borderAddRemove();this.model.orientation=="vertical"?this.currentView()!=="month"&&!this._isCustomMonthView()?this.element.find(".e-headercells").addClass("e-dateheaderselect"):"":this.element.find(".e-headercells").addClass("e-dateheaderselect");this.model.orientation=="horizontal"&&(this.currentView()=="month"||this._isCustomMonthView())&&this.element.find(".e-workcells").width()<this.element.find(".e-dateheadercell").width()&&this.model.cellWidth==""&&(this.model.timeScale.enable?this.element.find(".e-workcells").css({width:this.element.find(".e-horizontmonthheaderdaytd").width()}):this.element.find(".e-headerdays table tr td:nth-child(1)").css({width:this.element.find(".e-horizontmonthheaderdaytd").width()+1}));this.model.orientation!="horizontal"||this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()||this.model.cellWidth!=""||this.element.find(".e-horizontmonthheaderdatetd,.e-horizontmonthheaderdaytd").width(this.element.find(".e-workcells").width());this.element.find(".e-horizontalresheader").css({width:this._mediaQuery?"50px":"100%"});this._renderScroller();this.model.showAppointmentNavigator&&this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon();this.model.orientation=="horizontal"?this._horizontalRender():this.model.showOverflowButton||this.currentView()!="month"?this.currentView()=="month"||this._isCustomMonthView()?this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length)):this.element.find(".e-ampmdisplay").height(this.model.timeScale.minorSlotCount==1?this.element.find(".e-timecelldivs").height():this.element.find(".e-workcells").height()):this._monthCellsRender();this._highlightCurrentTime(this.model.showCurrentTimeIndicator);this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal?(this.model.timeScale.enable||this.element.find(".e-headercells").removeClass("e-dateheaderselect"),t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0||this._horizontalResIcon(),t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView()||this.element.find(".e-headercells").parent().parent().parent().css("width",this.element.width()/10*this._dateRender.length+"px"),this.element.find(".e-parentnodecategory").css({width:this._mediaQuery?"12px":"20px"})):t.isNullOrUndefined(this.model.allDayCellsTemplateId)||this.element.find(".e-leftindent").css({height:this.element.find(".e-alldaycells").height()});this.model.workHours.highlight&&this.model.highlightBusinessHours?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");this._dateRender.length>60||n.isNumeric(this.element.find(".e-monthcells").height())&&this.element.find(".e-monthcells").height()!=n(this.element.find(".e-timecells")[3]).height()&&this.model.orientation=="vertical"&&this.model.showOverflowButton?this.element.find("td.e-timecells .e-timecelldivs").addClass("e-timedivcells"):"";this.model.orientation=="horizontal"&&this._safariBrowser&&this.element.find(".e-workcells.e-dayend").width(this.element.find(".e-workcells.e-dayend").outerWidth()+1);this._browserInfo.name=="msie"&&this._browserInfo.version<9&&this.model.orientation=="vertical"&&(this.element.find(".e-workleftindent").find("tr").last().find("td").addClass("e-lastcell"),this.element.find(".e-workcellstab").find("tr").last().find("td").addClass("e-lastcell"))}this._validateMinMaxDate();t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("emptycell");this._businessHourScroller()},_resourceSegregate:function(){var r="",i;if(this._tempResource=[],this._grouping=[],t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources))t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&n.merge(this._tempResource,this.model.resources);else{for(i=0;i<this.model.group.resources.length;i++)if(index=this._findResourceIndex(this.model.resources,"name",this.model.group.resources[i]),!t.isNullOrUndefined(index))if(this.model.resources.length!=0&&this.model.resources[index].resourceSettings.dataSource.length!=0)this._tempResource.push(this.model.resources[index]),this._grouping.push(this.model.group.resources[i]),r=i==this.model.group.resources.length-1?r+this.model.resources[index].field:r+this.model.resources[index].field+",";else return!1;this._appointmentSettings.resourceFields=r}},_borderAddRemove:function(){this.model.enableRTL?(this.element.find(".e-headrealldaytable tr td:first-child,.e-workcellstab tr td:first-child,.e-headerdays table tr td:first-child").css("border-right","none"),this.element.find(".e-horizontalheader,.e-horizontalrestd,.e-monthleftindent,.e-workleftindent,.e-empty").addClass("e-borderleft")):(this.element.find(".e-headrealldaytable tr td:first-child,.e-workcellstab tr td:first-child,.e-headerdays table tr td:first-child").css("border-left","none"),this.element.find(".e-horizontalheader,.e-horizontalrestd,.e-monthleftindent,.e-workleftindent,.e-empty").addClass("e-borderright"));this.model.orientation=="horizontal"?this.currentView()=="month"?this.element.find(".e-headerdays table tr td:first-child").width(this.element.find(".e-workcellstab tr td:first-child").width()):this._browserInfo.name=="webkit"&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-horizontaltimetd").first().width()):(this.model.cellWidth!=""&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-headercells").first().width()),this._safariBrowser&&(this.currentView()=="month"?this.element.find(".e-monthleftindent").width(this.element.find(".e-monthempty").width()+1):this.element.find(".e-workleftindent").attr("style","width:"+(this.element.find(".e-empty").width()+1)+"px !important")));t.isNullOrUndefined(this.oldDate)||this.oldDate==""||(this.currentDate(new Date(this.oldDate)),this.oldDate="")},_phoneChanges:function(){t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({allowDraggable:!1,position:{X:"0",Y:"0"}})},_dateConvert:function(i){if(t.isNullOrUndefined(i))r=null;else{var r=new Date(parseInt(i.match(/\d+/).toString()));r=n.type(r)=="date"?r:new Date}return r},_calculateCustomDays:function(){var r=n.type(this.model.renderDates.start)!="date"?t.parseDate(this.model.renderDates.start,this._datepattern()):new Date(this.model.renderDates.start),i;if(r=t.isNullOrUndefined(r)?new Date(this.model.renderDates.start).toString()=="Invalid Date"||new Date(this.model.renderDates.start).toString()=="NaN"?this._dateConvert(this.model.renderDates.start):new Date(this.model.renderDates.start):r,i=n.type(this.model.renderDates.end)!="date"?t.parseDate(this.model.renderDates.end,this._datepattern()):new Date(this.model.renderDates.end),i=t.isNullOrUndefined(i)?new Date(this.model.renderDates.end).toString()=="Invalid Date"||new Date(this.model.renderDates.end).toString()=="NaN"?this._dateConvert(this.model.renderDates.end):new Date(this.model.renderDates.end):i,t.isNullOrUndefined(this.model.minDate)||t.isNullOrUndefined(this.model.maxDate)||(r=this.model.minDate>=r&&this.model.maxDate<=r?r:this.model.minDate>=r&&this.model.maxDate>=r?this.model.minDate:this.model.maxDate<=r?this.model.minDate:r,i=this.model.minDate>=i&&this.model.maxDate<=i?i:this.model.minDate<=i&&this.model.maxDate<=i?this.model.maxDate:this.model.minDate>=i?this.model.maxDate:i),this._renderStart=t.isNullOrUndefined(r)?i:new Date(r.getFullYear(),r.getMonth(),r.getDate()),this._renderEnd=t.isNullOrUndefined(i)?r:new Date(i.getFullYear(),i.getMonth(),i.getDate()),this._renderDays=Math.round((this._renderEnd-this._renderStart)/864e5)+1,this.oldDate=this.currentDate(),this._dateNavigation||this._renderStart.getTime()>this.currentDate().getTime()||this._renderEnd.getTime()<this.currentDate().getTime()?(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+864e5*(this._renderDays-1)),this._dateNavigation=!1):this.currentDate(new Date(this._renderStart)),this._renderDays>7){var e=this.model.orientation=="vertical"?new Date(this._firstweekdate(this._renderStart)):new Date(this._renderStart),u=new Date(this._renderEnd),f=u.getDay();this._firstdayofweek==0&&f!=6?u.setDate(new Date(this._renderEnd).getDate()+(6-f)):u.setDate(new Date(this._renderEnd).getDate()+(6-f)+this._firstdayofweek);u=this.model.orientation=="vertical"?u:new Date(this._renderEnd);this._numDays=Math.round((u-e)/864e5)+1}return this},_isCustomMonthView:function(){return this.currentView()=="customview"?(this._oneWeek=this._dateRender.length>7?!1:!0,!this._oneWeek):!1},_headerbarWidth:function(){if(this.element.children().length==0)return!1;var i=this.currentView()=="workweek"?this.model.workWeek.length:this.currentView()=="day"?1:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:7,n=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.res1.length*i:i,r=this.element.outerWidth()-(this.element.find(".e-draggableworkarea").offset().left-this.element.offset().left)<parseInt(this.model.cellWidth)*n?1:0;this._browserInfo.name=="webkit"?this.aTR.find(".e-headrealldaytable").width(this.model.cellWidth?parseInt(this.model.cellWidth)*n+(r?0:n):"100%"):this.aTR.find(".e-headrealldaytable").width(this.model.cellWidth?parseInt(this.model.cellWidth)*n+n:"100%")},_renderScroller:function(){if(this.element.children().length==0)return!1;var r=this.element.find("div#"+this._id+"_scroller"),u=this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),i=this,f=this.model.orientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width()-1:this.element.width();r.ejScroller({enableRTL:this.model.enableRTL,height:u-1,width:parseInt(f)-2,cssClass:this.model.cssClass,thumbStart:function(t){var r=n(t.originalEvent.target);if(!i._mediaQuery&&r.closest(".e-workcells").hasClass("e-workcells")||r.closest(".e-appointment").hasClass("e-appointment")||r.closest(".e-monthappointment").hasClass("e-monthappointment")||r.closest(".e-categorybar").hasClass("e-categorybar"))return!1},scroll:function(r){var e,o,u,f;t.isNullOrUndefined(r.scrollTop)||(r.scrollTop=parseInt(r.scrollTop));e=i.element.find("div#"+i._id+"_scroller").data("ejScroller");(e.isVScroll()||e.isHScroll())&&(i.model.orientation==="vertical"?i.element.find(".e-scrolltimecells").css("top",-r.scrollTop+"px"):i.model.timeScale.enable&&i.currentView()!=="month"&&!i._isCustomMonthView()?n(i.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-r.scrollLeft+"px"):i.element.find(".e-headerdays").css("left",-r.scrollLeft+"px"),i.element.find(".e-vhandle").length==1&&i.element.find(".e-horires").css("top",-r.scrollTop+"px"),i.model.orientation=="vertical"?(i.element.find(".e-headrealldaytable").css("left",i.model.enableRTL?r.scrollData.scrollable-r.scrollLeft:-r.scrollLeft+"px"),o=i.element.find(".e-scrolltimecells").width()-3,i.element.find(".e-upicon, .e-downicon").css("left",-(r.scrollLeft-o)+"px"),i._timeMode!="12"||i.currentView()==="month"||i._isCustomMonthView()||(u=r.scrollTop/(i.element.find(".e-workcells").height()*i.model.timeScale.minorSlotCount),u=Math.round(u)<u?Math.round(u)+1:Math.round(u),f=t.preferredCulture(i.model.locale).calendar,f.AM&&f.PM&&i.element.find(".e-idAmpmstyle").each(function(t,i){t==u&&n(i).text().trim()=="00"?parseInt(n(i)[0].id)<12?n(i).text(f.AM[0]):n(i).text(f.PM[0]):(n(i).text()==f.AM[0]&&t>0||n(i).text()==f.PM[0]&&parseInt(n(i)[0].id)>12)&&n(i).text("00")})),i._mediaQuery&&i.element.find(".e-headrealldaytable").css("left","0px"),i.model.showAppointmentNavigator&&i.model.orientation=="vertical"&&e.isVScroll()&&i.currentView()!="month"&&!i._isCustomMonthView()&&!i._mediaQuery&&(i._renderUpDownIcon(),i._renderUpDownIconPosition())):t.scheduleFeatures.horizontal&&i.model.orientation=="horizontal"&&i._horizontalScroll(r,i));t.isNullOrUndefined(i._quickAppointWindow)||!i.model.showQuickWindow||i._isQuickDialogOpened||(i._isQuickDialogOpened=!1,i._quickAppointWindow.ejDialog("close"),i._quickAppDetailsWindow.ejDialog("close"))}});this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator);this._renderHoriVerticalScroll();this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);this._showScrollTd()},_showScrollTd:function(){var n=this.model.enableRTL?"e-borderright":"e-borderleft",i=this.model.orientation=="horizontal"?"16px":"17px";this.model.orientation=="horizontal"&&(this.element.find(".e-vscroll").length>0?(this.element.find(".e-scheduleheader td").first().attr("colspan","3"),this.element.find(".e-workareadiv").parent().attr("colspan","2"),this.element.find(".e-emptyscrolltd").length==0&&this.aTR.append(t.buildTag("td.e-emptyscrolltd","",{},{width:this._mediaQuery?"0px":"16px"})),this.element.find(".e-emptyscrolltd").addClass("e-horizontalemptytd")):(this.element.find(".e-scheduleheader td").first().attr("colspan","2"),this.element.find(".e-workareadiv").parent().attr("colspan","2")));this.element.find(".e-vscroll").length>0?this.element.find(".e-emptyscrolltd").addClass(n).attr("width",i).show():this.element.find(".e-emptyscrolltd").removeClass(n).attr("width","0px").hide()},_renderHoriVerticalScroll:function(){var i=this.element.find("div#"+this._id+"_scroller"),u=this.model.orientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width(),e,o,s;u=parseInt(u)-1;var r=parseInt(this.scHeight)-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),f=i.ejScroller("isVScroll")?18:0,h=i.ejScroller("isHScroll")?18:0;if(this.model.orientation=="vertical"){if(this.model.cellWidth||this.model.cellHeight){this.currentView()=="day"&&this.element.find(".e-headerdaydisplay").css("width",this.model.cellWidth);var c=(parseInt(this.model.cellWidth)+1)*this.element.find("div.e-draggableworkarea tr:first td").length,l=parseInt(this.model.cellHeight)*this.element.find("div.e-draggableworkarea tr").length,a=this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").width():0;this.element.find(".e-draggableworkarea").width(this.element.width()>c+a+f?c-1:u-1-f);this.model.cellHeight?this.element.find(".e-draggableworkarea").height(r>l?l:r-1-h):this.element.find(".e-draggableworkarea").height(r-1-h);this.model.cellWidth&&this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2)}else this.element.find(".e-draggableworkarea").height(r-1),!this.model.showOverflowButton&&(this.currentView()=="month"||this._isCustomMonthView())&&this._monthCellsRender(),this.element.find(".e-draggableworkarea").width(u-1-f);this._mediaQuery&&this.res1.length>1&&(this.element.find(".e-draggableworkarea").width(this.element.find(".e-draggableworkarea").width()*this.res1.length),this.element.find(".e-headrealldaytable").width(this.element.find(".e-draggableworkarea").width()));this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width());this.element.find(".e-scrolltimecells").height(this.element.find(".e-workcellstab").height())}else i.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").css("height","100%")&&this.element.find(".e-resfootertr").css("height","0px"),i.ejScroller("isVScroll")?"":this.element.find(".e-draggableworkarea").css("height",r-19),this._mediaQuery&&(this.element.find(".e-horizontresdiv").height(i.height()),this.element.find(".e-draggableworkarea").children().height("100%"),this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height()),this.element.find(".e-horires").children().height("100%")),(this.model.cellWidth||this.model.cellHeight)&&(e=n(this.element.find(".e-workcells")[0]).parent().find("td").length,i.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").width(parseInt(this.model.cellWidth)*e+e),(this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable)&&this.element.find(".e-headerdays").children().css("width",this.element.find(".e-draggableworkarea").children().width()+"px").css("table-layout","auto"),this.model.cellHeight&&!this._tempResource&&this.element.find(".e-draggableworkarea").height(parseInt(this.model.cellHeight)-1)),(this.currentView()=="month"||this._isCustomMonthView())&&(o=this.element.find(".e-workcellstab tr td:first-child").width(),this.element.find(".e-headerdays table tr td:first-child").width(this.model.timeScale.enable?o:o+1)),this.currentView()=="day"&&this.model.timeScale.enable&&n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-horizontaltabletimecell").width(this.element.find(".e-workcellstab").width()),!this.model.timeScale.enable||i.ejScroller("isHScroll")||this.currentView()=="month"||this._isCustomMonthView()||(s=Math.floor(this.element.find(".e-draggableworkarea").width()/n(this.element.find(".e-workcells")[0]).parent().find("td").length),this.element.find(".e-workcells").width(s),this.element.find(".e-horizontaltabletimecell").find("tr td").width(s),this.element.find(".e-horizontaltabletimecell").css("table-layout","fixed").width(this.element.find(".e-draggableworkarea").width()),i.ejScroller("refresh")),this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()||(this.model.cellWidth||this._browserInfo.name=="webkit"?this._browserInfo.name=="webkit"&&this.currentView()!="month"&&(this.model.cellWidth&&this.element.find(".e-headerdays").width(this.model.cellWidth),this.element.find(".e-workcells").width(this.element.find(".e-draggableworkarea").width/this._dateRender.length),this.element.find(".e-dateheadercell").width(this.element.find(".e-workcells").width()),this.element.find(".e-headerdays table tr td:not(:first-child)").find(".e-dateheadercell").width(this.element.find(".e-workcells").width()-1),this.element.find(".e-workcells").width(this.element.find(".e-workcells").width())):(this.element.find(".e-dateheadercell").width(this.element.find(".e-workcells").width()),this.element.find(".e-workcells").width(this.element.find(".e-horizontmonthheaderdaytd").width())))},_getDayNameIndex:function(n){var r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=[],t=this._firstdayofweek;do t>6&&(t=0),i.push(r[t]),t++;while(i.length<7);return i.indexOf(n.capitalizeFirstString())},_highlightBusinessHours:function(){var ot,r,f,e,it,a,ut,l,rt,u,et,i,v;if(this.currentView()=="agenda")return!1;if(ot=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek)||!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.start)||!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.end):!1,ot){this.element.find(".e-workcells, .e-monthcells").removeClass("e-businesshighlightworkcells e-monthcellhighlight");var c,k,d,y,p,w,nt,tt,g,l,o,s,a,st,ht,b=0,ct=[],u=this.element.find(".e-workcellstab tr"),h=this.model.orientation=="horizontal"&&this._grouping.length>1?this._resourceSort():this.res1;if(this.model.orientation=="vertical")for(i=0;i<h.length;i++)if(o=t.isNullOrUndefined(h[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:h[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(c=this.dateRender,(t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.start))&&t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.end)?(k=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,d=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour):(y=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.start],p=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.end],k=t.isNullOrUndefined(y)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:y>=this.model.startHour?y:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,d=t.isNullOrUndefined(p)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:p<=this.model.endHour?p:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end),w=this.model.endHour-this.model.startHour,nt=Math.floor(u.length/w*k)-this.model.startHour*this.model.timeScale.minorSlotCount,tt=Math.floor(u.length/w*d)-this.model.startHour*this.model.timeScale.minorSlotCount,l=this.currentView()==="week"?this.model.showWeekend?7:o.length:this.currentView()==="workweek"?o.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:1,r=nt;r<tt;r++)for(f=b;f<b+l;f++)for(e=0;e<o.length;e++)s=this._dayNamesArray.indexOf(o[e]),s==-1&&(s=this._getDayNameIndex(o[e])),s==new Date(c[f]).getDay()&&n(n(u[r]).children()[f]).addClass("e-businesshighlightworkcells");b+=l}else{if(this._resWorkWeek){for(r=0;r<o.length;r++)a=this._dayFullNames.indexOf(o[r].capitalizeFirstString()),a==-1&&(a=this._getDayNameIndex(o[r])),ct.push(this._renderDates[a]);c=ct}else c=this.currentView()!="month"&&!this._isCustomMonthView()?this.dateRender:this._dateRender;for(l=this._resWorkWeek?o.length:this.currentView()=="day"?1:7,st=this.currentView()!="month"&&!this._isCustomMonthView()?b:i*7,ht=this.currentView()!="month"&&!this._isCustomMonthView()?b+l:(i+1)*7,r=0;r<u.length;r++)for(f=st;f<ht;f++)for(e=0;e<o.length;e++)s=this._dayNamesArray.indexOf(o[e]),s==-1&&(s=this._getDayNameIndex(o[e])),s==new Date(c[f]).getDay()&&(n(n(u[r]).children()[f]).hasClass("e-othermonths")?n(n(u[r]).children()[f]).removeClass("e-monthcellhighlight"):n(n(u[r]).children()[f]).addClass("e-monthcellhighlight"));b+=l}else if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(c=this._dateRender,i=0;i<h.length;i++)if(h[i].classname!="e-parentnode")for(y=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.start],p=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.end],k=t.isNullOrUndefined(y)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:y>=this.model.startHour?y:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,d=t.isNullOrUndefined(p)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:p<=this.model.endHour?p:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end,w=this.model.endHour-this.model.startHour,g=n(u[i]).children().length/c.length,nt=Math.floor(g/w*k),tt=Math.floor(g/w*d),r=0;r<c.length;r++)for(f=0;f<this.model.workWeek.length;f++)if(s=this._dayNamesArray.indexOf(this.model.workWeek[f]),s==-1&&(s=this._getDayNameIndex(this.model.workWeek[f])),s==new Date(c[r]).getDay())for(e=g*r+nt;e<g*r+tt;e++)if(n(n(u[i]).children()[e]).addClass("e-businesshighlightworkcells"),this._grouping.length>1){it=i;a=this._tempResource.length-1;do ut=new t.DataManager(this._tempResource[a-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[a-1].resourceSettings.id,t.FilterOperators.equal,h[it][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])),t.isNullOrUndefined(ut)||(it=h.indexOf(ut[0]),n(n(u[it]).children()[e]).addClass("e-businesshighlightworkcells")),a-=1;while(a>0)}}else this._horizontalBusinessHighlight(null,null,null,null,null)}else if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");var c=this.dateRender,u=this.element.find(".e-workcells"),lt=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,at=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour,ft=60/this.model.timeScale.majorSlot*this.model.timeScale.minorSlotCount;if(this.res1=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.res1:[0],l=this.currentView()==="week"?this.model.showWeekend?7*this.res1.length:this.model.workWeek.length*this.res1.length:this.currentView()==="workweek"?this.model.workWeek.length*this.res1.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length*this.res1.length:1*this.res1.length,this.model.orientation=="vertical")for(i=lt*ft;i<at*ft;i++)for(v=0;v<l;v++)for(rt=0;rt<this.model.workWeek.length;rt++)this._dayNamesArray.indexOf(this.model.workWeek[rt])==new Date(c[v]).getDay()&&n(u[i*l+v]).addClass("e-businesshighlightworkcells");else this._horizontalBusinessHighlight(this._dateRender,lt,at,ft,u)}else if(this.model.orientation=="vertical")for(et=this.dateRender,u=this.element.find(".e-monthcells"),u.removeClass("e-monthcellhighlight"),i=0;i<et.length;i++)for(v=0;v<this.model.workWeek.length;v++)this._dayNamesArray.indexOf(this.model.workWeek[v])==new Date(et[i]).getDay()&&(n(u[i]).hasClass("e-othermonths")?n(u[i]).removeClass("e-monthcellhighlight"):n(u[i]).addClass("e-monthcellhighlight"));else this._horizontalBusinessHighlight(null,null,null,null,null)},_onselect:function(n){this._navigateClick(n,"DateNavigation")},_renderHeaderBar:function(n){var e=this.model.orientation=="vertical"?1:3,r=t.buildTag("td","",{},{colspan:e}),i=t.buildTag("div.e-datecommondiv").append(t.buildTag("div.e-icon e-navigateprevious","",{},{title:this._getLocalizedLabels("Previous")})).append(t.buildTag("div","",{},{"aria-live":"assertive",tabindex:0}).html(this._getCurrentDateHeaderValue()).addClass("e-datedisplay")).append(t.buildTag("input#"+this._id+"_navigator").css("display","none").addClass("dateCalendar")).append(t.buildTag("div.e-icon e-navigatenext","",{},{title:this._getLocalizedLabels("Next")})),u,f;this._mediaQuery||this.element.width()<600?(this._mediaQuery&&(i=t.buildTag("div.e-datecommondiv").append(t.buildTag("div.e-icon e-navigateprevious","",{},{title:this._getLocalizedLabels("Previous")})).append(t.buildTag("div.e-icon e-navigatenext","",{},{title:this._getLocalizedLabels("Next")})).append(t.buildTag("div","",{},{"aria-live":"assertive",tabindex:0}).html(this._getCurrentDateHeaderValue()).addClass("e-datedisplay")).append(t.buildTag("input#"+this._id+"_navigator").css("display","none").addClass("dateCalendar"))),u=t.buildTag("div#"+this._id+"navDrawerIcon.e-mobileNavigation e-icon"),n.append(r.append(t.buildTag("div").css("width","100%").append(i).append(u)))):(f=t.buildTag("div.e-viewsdiv"),n.append(r.append(t.buildTag("div").css("width","100%").append(i).append(f.append(this._renderViewNavigation(this.model.views))))));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderBar","",n)},_renderViewNavigation:function(n){for(var e=t.buildTag("table.e-table e-viewstable","",{},{cellspacing:"0px",cellpadding:"0px"}),o=t.buildTag("tbody"),u=t.buildTag("tr"),r=n,f,i=0;i<r.length;i++){f=r.length==1?"e-"+r[i].toLowerCase()+" e-singleview":i==0?"e-"+r[i].toLowerCase()+" e-firstview":i==r.length-1?"e-"+r[i].toLowerCase()+" e-lastview":"e-"+r[i].toLowerCase();switch(r[i]){case"day":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Day"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"week":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Week"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"workweek":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("WorkWeek"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"month":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Month"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"customview":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("CustomView"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"agenda":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Agenda"),{},{}).addClass("e-commonviewbutton").addClass(f)))}}return e.append(o.append(u)),e},_renderNavigationDrawer:function(){var r,i;if(t.isNullOrUndefined(this._scheduleDrawer)){for(this._scheduleDrawer=t.buildTag("div#"+this._id+"navDrawer.navDrawerMenu e-scheduledrawer"),r="<ul><li data-ej-imageClass='e-icon e-mAddEvent' data-ej-text='"+this._getLocalizedLabels("AddEvent")+"' id='addEvent'><\/li>",i=0;i<this.model.views.length;i++)switch(this.model.views[i]){case"day":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Day")+"' id='"+this.model.views[i]+"'><\/li>";break;case"week":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Week")+"' id='"+this.model.views[i]+"'><\/li>";break;case"workweek":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("WorkWeek")+"' id='"+this.model.views[i]+"'><\/li>";break;case"month":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Month")+"' id='"+this.model.views[i]+"'><\/li>";break;case"customview":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("CustomView")+"' id='"+this.model.views[i]+"'><\/li>";break;case"agenda":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Agenda")+"' id='"+this.model.views[i]+"'><\/li>"}r+="<\/ul>";this._scheduleDrawer.append(r);this.element.find(".e-scheduleinner").append(this._scheduleDrawer);this._navDrawer=!0;this._scheduleDrawer.ejNavigationDrawer({type:"overlay",targetId:this._id+"navDrawerIcon",direction:this.model.enableRTL?"left":"right",enableListView:!0,listViewSettings:{persistSelection:!0,selectedItemIndex:this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())+1,width:100,height:"auto",mouseUp:n.proxy(this._slideMenuClick,this)},position:"normal"});this.model.enableRTL&&this._scheduleDrawer.parent().css("left","0px");this._navDrawer=!1}},_slideMenuClick:function(t){var r,u,e,f,i,o;if(this._navDrawer)return!1;if(this._scheduleDrawer.ejNavigationDrawer("close"),r=t.item.find("div").hasClass("e-day")?"day":t.item.find("div").hasClass("e-week")?"week":t.item.find("div").hasClass("e-workweek")?"workweek":t.item.find("div").hasClass("e-month")?"month":t.item.find("div").hasClass("e-customview")?"customview":t.item.find("div").hasClass("e-agenda")?"agenda":"open",r!="open")this._navView=this._navSelected=!0,this.currentView()!=r&&this._viewChange(null,this.currentView(),r),this._navSelected=!1;else if(this.currentView()!="agenda"){for(u=new Date(this.currentDate()),f=0,u=new Date(u.setHours(0,0,0,0)),i=0;i<this.dateRender.length;i++)if(new Date(this.dateRender[i]).getTime()==u.getTime()){f=i;break}o=this.model.orientation=="vertical"?this.model.startHour+(new Date).getHours()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot):this.res1.length-1;e=this.currentView()!="month"&&this.currentView()!="customview"&&this.model.timeScale.enable?this.element.find(".e-draggableworkarea tr")[o].cells[f]:this.element.find(".e-monthcells")[f];n(e).addClass(".e-selectedCell").trigger(n.Event("click"));this._appointmentWindow({target:e})}},_renderAlertWindow:function(){this._alertWindow=t.buildTag("div.e-alertdialog#"+this._id+"alertWindow");var i="<div><div class='e-alerttext'><\/div><div class='e-alertbtn'><button id='"+this._id+"alertok' type='button' class='e-alertbutton e-alertOk e-buttonactive'>"+this._getLocalizedLabels("Ok")+"<\/button><\/div><\/div>";this._alertWindow.append(i);this.element.append(this._alertWindow);this._alertWindow.find(".e-alertbutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass});this._alertWindow.ejDialog({width:this._mediaQuery?"75%":450,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("RecurrenceAlert"),target:"#"+this._id,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._alertClose,this)});n("#"+this._id+"alertWindow_wrapper").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_alertClose:function(t){this._alertWindow.ejDialog("close");this._alertWindow.hasClass("e-recurAlert")?(this._alertWindow.removeClass("e-recurAlert"),n(t.target).hasClass("e-alertOk")?(this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0}),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(this._rRuleStr),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"),this._appointmentAddWindow.find(".e-recurEditor").toggle(),this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","block"),this._appointmentAddWindow.find(".done").focus()):this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!1})):this._alertWindow.hasClass("e-seriesAlert")?(this._alertWindow.removeClass("e-seriesAlert"),n(t.target).hasClass("e-alertOk")?this._appointmentAddWindow.find("#done").click():this._seriesAlert=!0):this._alertWindow.hasClass("e-deleteAlert")&&(this._alertWindow.removeClass("e-deleteAlert"),n(t.target).hasClass("e-alertOk")&&this._deletingAppointment());this._alertWindow.find("#"+this._id+"alertcancel").length!=0&&this._alertWindow.find("#"+this._id+"alertcancel").remove()},_renderAppointmentWindow:function(){var i,r;n("#"+this._id+"AppointmentAddEditWindow_wrapper")&&n("#"+this._id+"AppointmentAddEditWindow_wrapper").remove();this._appointmentAddWindow=t.buildTag("div.e-scheduledialog e-appointmentaddwindow#"+this._id+"AppointmentAddEditWindow");i="<div class='e-appwindow e-windowmargin'><form id='"+this._id+"_AddEditForm'><table class='e-table' width='100%' cellpadding='7'><tbody>";this._mediaQuery?(i+="<tr id='"+this._id+"subjectlabeltr'><td colspan='3' class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><\/tr><tr id='"+this._id+"subjecttr' class='"+this._id+"subjecttr'><td colspan='3' class='e-rightfields'><input id='"+this._id+"subject' tabIndex='0' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><input id='id' class='id' type='text' name='"+this._appointmentSettings.id+"' value='' style='display: none'/><\/td><\/tr>",this.model.showLocationField&&(i+="<tr><td colspan='3' class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>"),i+="<tr id='"+this._id+"_appStartTime'><td class='e-textlabel' colspan='3'>"+this._getLocalizedLabels("StartTime")+":<\/td><\/tr><tr><td width='37%'><input id='"+this._id+"startdate' class='startenddate' type='text' name='StartDate' value='' /><\/td><td width=31%'><input type='text' id='"+this._id+"starttime' class='startendtime' name='StartTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td width='31%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>"),i+="<\/tr>",i+="<tr id='"+this._id+"_appEndTime'><td class='e-textlabel' colspan='3'>"+this._getLocalizedLabels("EndTime")+":<\/td><\/tr><tr><td><input id='"+this._id+"enddate' class='startenddate' type='text' name='EndDate' value='' /><\/td><td><input type=''text' id='"+this._id+"endtime' class='startendtime' name='EndTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),i+="<\/tr>",this.model.prioritySettings.enable&&(i+="<tr><td class='e-leftfields e-textlabel' colspan='3'>"+this._getLocalizedLabels("Priority")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id= '"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value=''/><div id='prioritylist'><\/div><\/td><\/tr>"),i+="<tr class='"+this._id+"parrow'><td class='"+this._id+"allDay' colspan='3'><table class='e-table e-appchecktable' cellpadding='3'><tr><td><div class='e-allday e-checkboxmargin'><input id='"+this._id+"allday' tabIndex='0' class='allday' type='checkbox' name='"+this._appointmentSettings.allDay+"'/><\/div><\/td><td><div class='e-alldaytext'><label for='"+this._id+"allday'>"+this._getLocalizedLabels("AllDay")+"<\/label><\/div><\/td><td><div class='e-checkboxmargin e-recurrence'><input id='"+this._id+"recurrence' tabIndex='0' class='recurrence' type='checkbox' name='"+this._appointmentSettings.recurrence+"' value='recurrence'/><\/div><\/td><td><label class='e-repeatlbl' for='"+this._id+"recurrence'>"+this._getLocalizedLabels("Recurrence")+"<\/label><\/td><\/tr><\/table><\/td><\/tr>",i+="<tr id='"+this._id+"summary' class='"+this._id+"summary' style='display:none'><td class='e-textlabel'><label>"+this._getLocalizedLabels("Summary")+":<\/label><\/td><\/tr><tr class='"+this._id+"summary' style='display:none'><td colspan='4'><table><tr><td><label class='e-recurFinalRule'><\/label><\/td><td><div class='e-recuredit'><a class='e-recuredit' href='#' onclick='return false;'>"+this._getLocalizedLabels("Edit")+"<\/a><span class='e-icon e-edit_01 e-scheduleedit'><\/span><\/div><\/td><\/tr><\/table><\/td><\/tr>",this.model.categorizeSettings.enable&&(i+="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel' colspan='3'>"+this._getLocalizedLabels("Categorize")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' name='"+this._appointmentSettings.categorize+"' class='e-categorizevalue' type='text' value=''/><\/td><\/tr>"),this._tempResource.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="<tr><td colspan='3'><textarea class='e-description e-textarea e-animation e-inputtext' id='"+this._id+"description' name='"+this._appointmentSettings.description+"'><\/textarea><span class='e-ripple-bar'><\/td><\/tr>",i+="<\/tbody><\/table><\/form>",i+="<div class='e-floatright' style='width:100%'><table width='100%' class='e-table' cellpadding='5'><tr><td width='30%'><div class='e-btnmargin e-floatleft'><button id='mDelete' class='e-btndelete e-appdelete'>"+this._getLocalizedLabels("Delete")+"<\/button><\/div><\/td><td width='30%'><div class='e-btnmargin e-floatleft'><button id='done' class='e-btndone e-appsave e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td width='30%'><div class='e-btnmargin e-floatleft'><button id='cancel' class='e-appointcancel cancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>"):(i+="<tr id='"+this._id+"subjecttr' class='"+this._id+"subjecttr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"subject' tabIndex='0' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><input id='id' class='id' type='text' name='"+this._appointmentSettings.id+"' value='' style='display: none'/><\/td><\/tr>",this.model.showLocationField&&(i+="<tr id='"+this._id+"showLocation' class='"+this._id+"showLocation'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>"),i+="<tr id='"+this._id+"_appStartTime'><td class='e-textlabel'>"+this._getLocalizedLabels("StartTime")+":<\/td><td width='25%'><input id='"+this._id+"startdate' class='startenddate' type='text' name='StartDate' value='' /><\/td><td width=22%'><input type='text' id='"+this._id+"starttime' class='startendtime' name='StartTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td width='28%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>"),i+="<\/tr>",i+="<tr id='"+this._id+"_appEndTime'><td class='e-textlabel'>"+this._getLocalizedLabels("EndTime")+":<\/td><td><input id='"+this._id+"enddate' class='startenddate' type='text' name='EndDate' value='' /><\/td><td><input type=''text' id='"+this._id+"endtime' class='startendtime' name='EndTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),i+="<\/tr>",r=this.model.prioritySettings.enable?"<td colspan='1' class='e-textlabel "+this._id+"priorityshow'>"+this._getLocalizedLabels("Priority")+":<\/td><td colspan='1' class='"+this._id+"prioritylistshow'><input id='"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value='' /><div id='prioritylist'><\/div><\/td>":"",i+="<tr class='"+this._id+"parrow'>"+r+"<td class='"+this._id+"allDay' colspan='4'><table class='e-table e-appchecktable' cellpadding='3'><tr><td><div class='e-allday e-checkboxmargin'><input id='"+this._id+"allday' tabIndex='0' class='allday' type='checkbox' name='"+this._appointmentSettings.allDay+"'/><\/div><\/td><td><div class='e-alldaytext'><label for='"+this._id+"allday'>"+this._getLocalizedLabels("AllDay")+"<\/label><\/div><\/td><td><div class='e-checkboxmargin e-recurrence'><input id='"+this._id+"recurrence' tabIndex='0' class='recurrence' type='checkbox' name='"+this._appointmentSettings.recurrence+"' value='recurrence'/><\/div><\/td><td><label class='e-repeatlbl' for='"+this._id+"recurrence'>"+this._getLocalizedLabels("Recurrence")+"<\/label><\/td><\/tr><\/table><\/td><\/tr>",i+="<tr id='"+this._id+"summary' class='"+this._id+"summary' style='display:none'><td class='e-textlabel'><label>"+this._getLocalizedLabels("Summary")+":<\/label><\/td><td colspan='3'><table><tr><td><label class='e-recurFinalRule'><\/label><\/td><td><div class='e-recuredit'><a class='e-recuredit' href='#' onclick='return false;'>"+this._getLocalizedLabels("Edit")+"<\/a><span class='e-icon e-edit_01 e-scheduleedit'><\/span><\/div><\/td><\/tr><\/table><\/td><\/tr>",this.model.categorizeSettings.enable&&(i+="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Categorize")+":<\/td><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' name='"+this._appointmentSettings.categorize+"' class='e-categorizevalue' type='text' value=''/><\/td><\/tr>"),this._tempResource.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="<tr><td colspan='4'><textarea class='e-description e-textarea e-animation e-inputtext' id='"+this._id+"description' name='"+this._appointmentSettings.description+"'><\/textarea><span class='e-ripple-bar'><\/td><\/tr>",i+="<\/tbody><\/table><\/form>",i+="<div class='e-floatright'><table class='e-table' cellpadding='5'><tr><td><div class='e-btnmargin e-floatleft'><button id='done' class='e-btndone e-appsave e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div class='e-btnmargin e-floatleft'><button id='cancel' class='e-appointcancel cancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>");this._appointmentAddWindow.append(i);this.element.append(this._appointmentAddWindow);this._renderControls();this._appointmentAddWindow.ejDialog({width:this._mediaQuery?"100%":600,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("CreateAppointmentTitle"),target:"#"+this._id,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._onclose,this)});this._mediaQuery?n("#"+this._id+"AppointmentAddEditWindow_wrapper").appendTo("body").addClass("e-scheduledialog e-scheduleresponsive").find(".e-titlebar").addClass("e-dialogheader"):n("#"+this._id+"AppointmentAddEditWindow_wrapper").appendTo("body").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader");n("#"+this._id+"priority_popup_wrapper").addClass("e-schedulepriority");this._on(this._appointmentAddWindow,"click","a.e-recuredit",n.proxy(this._editRecurrence,this));this._mediaQuery&&this._appointmentAddWindow.ejDialog("refresh");n.isFunction(n.validator)&&this._setValidation();this._mediaQuery&&this._phoneChanges()},_renderRecurrenceEditor:function(){var i=t.buildTag("div.e-recurEditor#"+this._id+"recurrenceEditor").ejRecurrenceEditor({selectedRecurrenceType:1,frequencies:["daily","weekly","monthly","yearly","everyweekday"],startDate:this.currentDate(),minDate:this.model.minDate,maxDate:this.model.maxDate,firstDayOfWeek:this.model.firstDayOfWeek,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,locale:this.model.locale}),r="<div class='e-floatright'><table class='e-table' cellpadding='5'><tr><td><div class='e-btnmargin e-floatleft'><button id='"+this._id+"donerecur' class='recurbutton e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div class='e-btnmargin e-floatleft'><button id='"+this._id+"cancelrecur' class='e-cancelrecur recurbutton'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div>";n(i).insertAfter(this._appointmentAddWindow.find(".e-appwindow"));this._appointmentAddWindow.find(".e-recurEditor").append(r);this._appointmentAddWindow.find("#"+this._id+"donerecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._closeRecurence,this),cssClass:"e-flat"+this.model.cssClass});this._appointmentAddWindow.find("#"+this._id+"cancelrecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._closeRecurence,this),cssClass:"e-flat"+this.model.cssClass});this._appointmentAddWindow.find(".e-recurEditor").css("display","none");this._mediaQuery&&this._phoneChanges()},_refreshAppointmentWindow:function(){this._destorySubControls(n("#"+this._id+"_AddEditForm"));this._destorySubControls(n("#"+this._id+"_RecurForm"));n("#"+this._id+"AppointmentAddEditWindow_wrapper").remove();this._renderAppointmentWindow();n.isFunction(n.validator)&&this._setValidation()},_renderQuickAppWindow:function(){var i,r;this._quickAppointWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppointmentQuickWindow");i="<div id='"+this._id+"_quickAppwindow' class='e-tableAppoint'><table cellpadding='7' class='e-qappwindow'><tbody>";i+="<tr><td colspan='2'><div class='e-quickstartend'><\/div> <div title='"+this._getLocalizedLabels("Close")+"'class='e-icon e-scheduleclose e-schedclosemargin e-pointercursor'><\/div><\/td><\/tr><tr><td class='e-subjectlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><td colspan='2' class='e-rightfields'><form id='"+this._id+"_AddForm' onsubmit='return false;'><input id='"+this._id+"subject' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><\/span><\/form><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-quickcreatebottomcontainer'><div tabIndex='0' class='e-detailedapp e-detailedwindow'> "+this._getLocalizedLabels("Detailed")+" >><\/div><div style='margin-right:-3px;' class='e-floatright'><div class='e-quickAppDone'><button id='done' class='e-btndone e-qAppDone e-buttonactive' style='font-size:12px !important;'>"+this._getLocalizedLabels("CreateAppointmentTitle")+"<\/button><\/div><\/div><\/div><\/div>";this._quickAppointWindow.append(i);this.element.append(this._quickAppointWindow);this._quickAppointWindow.append(t.buildTag("div.e-quickarrow").append("<div class='e-outerarrowline'><\/div>").append("<div class='e-innerarrow'><\/div>"));r=this._quickAppointWindow;r.find(".e-btndone").ejButton({showRoundedCorner:!0,click:n.proxy(this._saveAppointment,this),cssClass:"e-flat"+this.model.cssClass,enableRTL:this.model.enableRTL});this._on(r.find(".e-scheduleclose"),"click",n.proxy(this._quickWindowClose,this));this._on(r.find(".e-detailedapp"),"click",n.proxy(this._appointmentWindow,this));this._quickAppointWindow.ejDialog({width:330,minHeight:0,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableAnimation:!1,showOnInit:!1,enableResize:!1,allowDraggable:!1,showHeader:!1,allowKeyboardNavigation:!1,close:n.proxy(function(){this._processFocus()},this)});n.isFunction(n.validator)&&this._setQuickValidation();n("#"+this._id+"AppointmentQuickWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppointmentQuickWindow").addClass("e-dialogouter")},_renderQuickAppDetailsView:function(){this._quickAppDetailsWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppDetailsWindow");var i="<div id='"+this._id+"_quickAppDetailswindow' class='e-tableAppoint e-appdetails'><table cellpadding='1' class='e-qappwindow'><tbody>";i+="<tr><td colspan='2'><div class='e-quicksubject e-textellipsis'><\/div> <div title='"+this._getLocalizedLabels("Close")+"' class='e-icon e-scheduleclose e-schedclosemargin e-pointercursor'><\/div><\/td><\/tr><tr><td colspan='2' class='e-quickduein e-rightfields'><\/td><\/tr><tr><td colspan='2'><div class='e-quickstartendtime'><\/div><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-quickbottomcontainer'><div title='"+this._getLocalizedLabels("Delete")+"' class='e-icon e-delete e-scheduledelete e-pointercursor' tabIndex='0'><\/div><div class='e-floatright'><div class='e-editevents'><div class='e-editevent e-textellipsis' tabIndex='0'>"+this._getLocalizedLabels("Editevent")+" | <\/div><div class='e-editseries e-textellipsis' tabIndex='0'>"+this._getLocalizedLabels("Editseries")+" >><\/div> <\/div><\/div><\/div><\/div>";this._quickAppDetailsWindow.append(i);this.element.append(this._quickAppDetailsWindow);this._quickAppDetailsWindow.append(t.buildTag("div.e-quickarrow").append("<div class='e-outerarrowline'><\/div>").append("<div class='e-innerarrow'><\/div>"));this._on(this._quickAppDetailsWindow.find(".e-scheduleclose"),"click",n.proxy(this._quickAppDetailWindowClose,this));this._on(this._quickAppDetailsWindow.find(".e-scheduledelete"),"click",n.proxy(this._deleteAppoint,this));this._on(this._quickAppDetailsWindow.find(".e-editevent,.e-editseries"),"click",n.proxy(this._editClick,this));this._quickAppDetailsWindow.ejDialog({width:270,minHeight:0,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableAnimation:!1,showOnInit:!1,enableResize:!1,allowDraggable:!1,showHeader:!1,allowKeyboardNavigation:!1,close:n.proxy(function(){this._processFocus()},this)});n("#"+this._id+"AppDetailsWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppDetailsWindow").addClass("e-dialogouter")},_editClick:function(i){if(n(i.target).hasClass("e-editseries")&&this._quickAppDetailsWindow.find(".e-editseries").hasClass("e-disable"))return!1;var u=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),r=new t.DataManager(this._processed).executeLocal(u);n(i.target).hasClass("e-editevent")?r[0][this._appointmentSettings.recurrence]==1?(this._parentId=r[0].ParentId,this._currentAction=t.Schedule.Actions.EditOccurrence,this._showAppointmentDetails(this._appUid,!0)):t.isNullOrUndefined(r[0][this._appointmentSettings.recurrence])?(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(this._appUid,!0)):(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(r[0].Guid,!0)):n(i.target).hasClass("e-editseries")&&r[0][this._appointmentSettings.recurrence]==1&&(this._parentId=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],this._currentAction=t.Schedule.Actions.EditSeries,this._showAppointmentDetails(this._parentId,!1));this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close")},_deleteAppoint:function(i){var r,f,u;this.model.readOnly||(t.isNullOrUndefined(i)||!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this._quickAppDetailsWindow.ejDialog("isOpen")?(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?(this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("isOpen")&&this._quickAppDetailsWindow.ejDialog("close"),this._deletingAppointment()):this._deleteConfirmation()):(r=n(i.target).parent(),f=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),this._appUid=f.attr("guid"),this._mediaQuery&&(this._mAppId=this._appUid),u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?this._deletingAppointment():this._deleteConfirmation()))},_deletingAppointment:function(){if(this._appUid=t.isNullOrUndefined(this._appUid)?this._deleteUid:this._appUid,this._appUid){this._currentAction=t.Schedule.Actions.Delete;var n=this._getAppointmentByParentId(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid);n[this._appointmentSettings.recurrence]?(t.isNullOrUndefined(this._recurEditWindow)&&this._renderRecurEditWindow(),this._parentId=n.ParentId,this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):this._deleteApp(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid)}t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close")},_deleteConfirmation:function(){!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"}),n("#"+this._id+"alertWindow").ejDialog({width:this._mediaQuery?"90%":450,title:this._getLocalizedLabels("MouseOverDeleteTitle")}),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("DeleteConfirmation")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Delete")));this._alertWindow.ejDialog("isOpen")||(this._alertWindow.addClass("e-deleteAlert"),this._alertWindow.ejDialog("open"),this._alertWindow.find(".e-alertOk").attr("tabIndex",0).focus())},_quickAppDetailWindowClose:function(){this._quickAppDetailsWindow.ejDialog("close");this._processFocus()},_alldayCheck:function(){if(this._appointmentAddWindow.find(".allday").ejCheckBox("option","checked"))this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._timeMode=="12"?"12:00 AM":"00:00",enabled:!1}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._timeMode=="12"?"11:59 PM":"23:59",enabled:!1}),this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!1});else{if(this._tempStart!=""||this._tempEnd!=""){var n=t.format(new Date((new Date).setHours(0,0,0)),this._pattern.t,this.model.locale),i=t.format(new Date((new Date).setHours(23,59,59)),this._pattern.t,this.model.locale);this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._tempStart});this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._tempEnd});(this._timeMode=="12"?this._tempStart==n&&this._tempEnd==i:this._tempStart=="00:00"&&this._tempEnd=="23:59")&&(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":00:00"),this._pattern.t,this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":30:00"),this._pattern.t,this.model.locale)}))}this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0});this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!0});this._endSlotChange=!0;this._startSlotChange=!0}},_renderRecurEditWindow:function(){n("#"+this._id+"RecurrenceEdit_wrapper")&&n("#"+this._id+"RecurrenceEdit_wrapper").remove();this._recurEditWindow=t.buildTag("div.e-scheduledialog#"+this._id+"RecurrenceEdit");var f=t.buildTag("div.e-recureditmsg",this._getLocalizedLabels("RecurrenceEditMessage")),i=this._getLocalizedLabels("RecurrenceEditOnly"),r=this._getLocalizedLabels("RecurrenceEditSeries"),u=t.buildTag("div.e-recureditbtns").append(t.buildTag("button.e-editonly#"+this._id+"Editonly",i,{},{name:"recurrenceeditonly",value:i})).append(t.buildTag("button.e-editseries#"+this._id+"EditSeries",r,{},{name:"recurrenceeditseries",value:r}));this._recurEditWindow.append(f).append(u);u.find(".e-editonly,.e-editseries").ejButton({cssClass:"e-flat"+this.model.cssClass,enableRTL:this.model.enableRTL,showRoundedCorner:!0});this._on(this._recurEditWindow,"click",".e-editonly,.e-editseries",n.proxy(this._recurBtnClick,this));this._on(this._recurEditWindow,"click","div.e-scheduleclose",n.proxy(this._recrConformClose,this));this._recurEditWindow.appendTo(this.element);this._mediaQuery&&this._recurEditWindow.find(".e-editonly,.e-editseries").css({"margin-top":"10px"});this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":360,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,title:this._getLocalizedLabels("RecurrenceEditTitle"),showOnInit:!1,enableModal:!0,enableResize:!1,target:"#"+this._id,allowKeyboardNavigation:!1,close:n.proxy(this._processFocus,this),beforeOpen:n.proxy(this._deleteBeforeOpen,this)});n("#"+this._id+"RecurrenceEdit_wrapper").appendTo("body").addClass("e-scheduledialog")},_recrConformClose:function(){t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("close");this._processFocus()},_deleteBeforeOpen:function(){n("#"+this._id+"RecurrenceEdit_title").addClass("e-dialogheader");n("#"+this._id+"RecurrenceEdit_title").find(".e-title").html(this._currentAction==t.Schedule.Actions.Delete?this._getLocalizedLabels("RecurrenceDeleteTitle"):this._getLocalizedLabels("RecurrenceEditTitle"))},_recurBtnClick:function(r){var u,y,l,a,f,e,s,p,h,c,b,v;if(n(r.target).hasClass("e-editonly"))if(this._editOnlyClicked=!0,this._currentAction==t.Schedule.Actions.Delete){if(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1){if(this._trigger("actionBegin",{id:this._appUid,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence})||(y=u[this._appointmentSettings.recurrenceId]==null?u.ParentId:u[this._appointmentSettings.recurrenceId],l=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,y)),this._trigger("beforeAppointmentRemove ",{appointment:l,currentAction:t.Schedule.Actions.DeleteOccurrence})))return!1;a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"Guid";f=this._dataManager.remove(a,u[a],this.model.appointmentSettings.query._fromTable);this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove("Guid",u);e=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:e},"Guid");new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:e},"Guid");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:e},"Guid");this._appointmentRemove(e[0]);this._refreshDayAppointments(e[0]);this._trigger("appointmentRemoved",{appointment:l,requestType:"appointmentDeleted",currentAction:t.Schedule.Actions.DeleteOccurrence});this._trigger("actionComplete",{appointment:l,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence});!t.isNullOrUndefined(f)&&n.isFunction(f.promise)&&this.dataSource()instanceof t.DataManager&&(v=this,f.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&v._processUrlBinding(i)}))}else{if(this._trigger("actionBegin",{id:this._appId,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence}))return!1;var y=u[this._appointmentSettings.recurrenceId]==null?u.ParentId:u[this._appointmentSettings.recurrenceId],k=this._deleteOcurrence(y,u[this._appointmentSettings.startTime]),w=this._timeZoneAppointments(k[0],"");if(this._trigger("beforeAppointmentRemove",{appointment:u,currentAction:t.Schedule.Actions.DeleteOccurrence}))return this._recurEditWindow.ejDialog("close"),!1;var a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",f=this._dataManager.update(a,w,this.model.appointmentSettings.query._fromTable),o=this._timeZoneAppointments(w,"reverse");if(new t.DataManager(this._currentAppointmentData).update("AppTaskId",o),this._refreshCellsHeight(),new Date(new Date(o[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(o[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(o[this._appointmentSettings.endTime]-o[this._appointmentSettings.startTime])/36e5<24&&o[this._appointmentSettings.allDay]!==!0)for(s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),h=[],i=0;i<s.length;i++)p=this._processed.filter(function(n){return n.Guid==s[i].Guid}),p.length>0&&h.push(p[0]),new t.DataManager(this._processed).remove("Guid",s[i].Guid),new t.DataManager(this._renderedApp).remove("Guid",s[i].Guid),new t.DataManager(this._renderedAllDay).remove("Guid",s[i].Guid);else h=this._processed.filter(function(n){return n.Guid==u.Guid}),new t.DataManager(this._processed).remove("Guid",this._appUid),new t.DataManager(this._renderedApp).remove("Guid",this._appUid),new t.DataManager(this._renderedAllDay).remove("Guid",this._appUid),this._appUid=null;for(c=0,b=h.length;c<b;c++)this._appointmentRemove(h[c]),this._refreshDayAppointments(h[c]);this._trigger("appointmentRemoved",{appointment:u,requestType:"appointmentDeleted",currentAction:t.Schedule.Actions.DeleteOccurrence});this._trigger("actionComplete",{appointment:u,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence});!t.isNullOrUndefined(f)&&n.isFunction(f.promise)&&this.dataSource()instanceof t.DataManager&&(v=this,f.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&v._processUrlBinding(i)}))}this._currentViewAppointments=this._appointmentCount();this.model.showAppointmentNavigator&&this._nextPrevButton()}else this._currentAction=t.Schedule.Actions.EditOccurrence,this._showAppointmentDetails(this._appUid,!0);else this._editOnlyClicked=!1,this._currentAction==t.Schedule.Actions.Delete?(this._actionType=t.Schedule.Actions.DeleteSeries,this._deleteApp(this._appUid)):(this._currentAction=t.Schedule.Actions.EditSeries,this._showAppointmentDetails(this._parentId,!1));t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("close")},_repeat:function(n){var i,r;n.isInteraction&&(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),this._appointmentAddWindow.find(".e-recurEditor").length==0&&this._renderRecurrenceEditor(),n.isChecked||this._recurChecked?this._currentAction==t.Schedule.Actions.EditSeries||this._appointmentAddWindow.find(".e-recurFinalRule").html()!=""?this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"):(this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").toggle(),this._appointmentAddWindow.find(".e-recurEditor").css("margin-left",700).toggle().animate({"margin-left":10},400),i=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),i.clearRecurrenceFields(),this._appointmentAddWindow.find(".e-recurEditor").css("display","block"),r=new Date(this._appointmentAddWindow.find(".startenddate").ejDatePicker("option","value")),i.model.startDate=r,i.setDefaultValues()):(this._currentAction==t.Schedule.Actions.EditSeries||this._appointmentAddWindow.find(".e-recurFinalRule").html()!="")&&this._appointmentAddWindow.find("."+this._id+"summary").css("display","none"),this._recurChecked=!1)},_resourceDaysReorder:function(n){var c=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],f=[],r=[],e=[],h=[],o=this._firstdayofweek,s,i,u;do o>6&&(o=0),f.push(c[o]),o++;while(f.length<7);for(s=0;s<n.length;s++)r.push(n[s].toLowerCase());for(i=0;i<r.length;i++)f.indexOf(r[i])!=-1&&(e[f.indexOf(r[i])]=r[i]);for(u=0;u<e.length;u++)t.isNullOrUndefined(e[u])||h.push(e[u]);return h},_daysReorder:function(n){var i=[],t=n,r=[0,1,2,3,4,5,6];do t>6&&(t=0),i.push(r[t]),t++;while(i.length<7);return i},_getWeekDays:function(){for(var t,r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],i=[],n=0;n<this.model.workWeek.length;n++)t=r.indexOf(this.model.workWeek[n]),t!=-1&&i.push(t);return i},_resourceRenderDates:function(){var s,u,h,c,f,r,e,i,o;if(this._tempResource.length>1){for(s=this._resourceSort(),u=[],x=0;x<s.length;x++)i=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource.indexOf(s[x]),i!=-1&&u.push(s[x]);this.res1=u}else u=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource;for(h=[],c=[],this._resDateRen={},f=0;f<u.length;f++)if(r=u[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],t.isNullOrUndefined(r))o=n.extend(!0,[],this._dateRender),o=o.filter(function(n){return new Date(n).getDay()!=0&&new Date(n).getDay()!=6}),n.merge(h,o),this._resDateRen[f]=o;else{for(r=this._resourceDaysReorder(r),e=0;e<r.length;e++)i=this._dayFullNames.indexOf(r[e].capitalizeFirstString()),i==-1&&(i=this._getDayNameIndex(r[e])),h.push(this._renderDates[i]),c.push(this._renderDates[i]);this._resDateRen[f]=c;c=[]}return h},_customviewRenderDates:function(){var u,f,e,r,n,o,i;if(t.isNullOrUndefined(this.model.renderDates))i=this._monthdates();else for(this._calculateCustomDays(),i=[],u=this._getWeekDays(),this._setCurrentDate&&this.model.orientation!="horizontal"&&(this.oldDate=this.currentDate(),this._renderStart.getTime()<this.currentDate().getTime()&&this._renderEnd.getTime()>this.currentDate().getTime()?this.currentDate(new Date(this._renderStart)):(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+(this._renderDays-1)*864e5))),f=this._renderDays<=7?new Date(this.currentDate()):this.model.orientation=="vertical"?this._firstweekdate(this.currentDate()):new Date(this.currentDate()),e=this._renderDays<=7?this._renderDays:this._numDays,r=0;r<e;r++)n=new Date(new Date(f).getTime()+864e5*r),this.model.showWeekend?i.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()):(o=u.indexOf(n.getDay()),o!=-1&&i.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()));return i},_getRenderDates:function(){var i,t,f,u,e;if(this.currentDate(new Date(new Date(this.currentDate()).setHours(0,0,0,0))),this._dateRender=[],this.currentView()==="week"||this.currentView()==="workweek"){if(this.model.showWeekend){i=this._firstweekdate(this.currentDate());do this._dateRender.push(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()),i.setDate(i.getDate()+1);while(this._dateRender.length<7);this._renderDates=n.extend(!0,[],this._dateRender)}else{u=this._getWeekDays();t=this._firstweekdate(this.currentDate());do f=u.indexOf(t.getDay()),f!=-1&&this._dateRender.push(new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()),t=new Date(new Date(t).getTime()+864e5);while(this._dateRender.length!=this.model.workWeek.length);this._renderDates=n.extend(!0,[],this._dateRender)}if(this._resWorkWeek)this.dateRender=this._dateRender=this._resourceRenderDates();else if(this.currentView()=="workweek"&&this.model.showWeekend){var o=this,s=this._daysReorder(this._firstdayofweek),h=this.model.workWeek.map(function(n){return o._dayNamesArray.indexOf(n)}),c=s.filter(function(n){return h.indexOf(n)!==-1}),l=this._dateRender.map(function(n){if(c.indexOf(new Date(n).getDay())!=-1)return n});this._dateRender=l.filter(function(n){return n!=r})}}else this.currentView()==="month"?this._dateRender=this._monthdates():this.currentView()==="customview"?this._dateRender=this._customviewRenderDates():(this.model.showWeekend||(u=this._getWeekDays(),u.indexOf(this.currentDate().getDay())==-1&&(e=this._getPrevNextDateCount(this.currentDate(),"next"),this.currentDate(new Date(this.currentDate().getTime()+864e5*e)))),this._dateRender.push(new Date(this.currentDate().getFullYear(),this.currentDate().getMonth(),this.currentDate().getDate()).getTime()));return this._dateRender},_getAgendaDateCount:function(){var t=this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0,r;if(!this.model.showWeekend){var u=this._getWeekDays(),i=0,n=agendaDate=new Date(this.currentDate());do r=u.indexOf(n.getDay()),r!=-1&&i++,n=new Date(new Date(n).getTime()+864e5);while(this.model.agendaViewSettings.daysInAgenda!=i);t=(n.getTime()-agendaDate.getTime())/864e5-1}return t},_getCurrentDateHeaderValue:function(){var i,n=this._resWorkWeek?this._renderDates:this._dateRender,u,f,r;return this.currentView()==="day"?this.model.dateFormat==""||t.isNullOrUndefined(this.model.dateFormat)?(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),i=r.toLowerCase().startsWith("d")?t.format(new Date(n[0]),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?t.format(new Date(n[0]),"MMM dd, yyyy",this.model.locale):t.format(new Date(n[0]),r,this.model.locale)):i=t.format(new Date(n[0]),this.model.dateFormat,this.model.locale):this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()=="agenda"?(u=this.currentView()=="agenda"?new Date(this.currentDate()):new Date(n[0]),f=this.currentView()=="agenda"?new Date(new Date(this.currentDate()).setDate(u.getDate()+this._getAgendaDateCount())):new Date(n[n.length-1]),i=this._formatDateHeaderValue(u,f)):this.currentView()==="customview"?n.length==1?this.model.dateFormat==""||t.isNullOrUndefined(this.model.dateFormat)?(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),i=r.toLowerCase().startsWith("d")?t.format(new Date(n[0]),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?t.format(new Date(n[0]),"MMM dd, yyyy",this.model.locale):t.format(new Date(n[0]),r,this.model.locale)):i=t.format(new Date(n[0]),this.model.dateFormat,this.model.locale):i=n.length>1&&n.length<=7?this._formatDateHeaderValue(new Date(n[0]),new Date(n[n.length-1])):new Date(n[0]).getFullYear()==new Date(n[n.length-1]).getFullYear()?new Date(n[0]).getMonth()==new Date(n[n.length-1]).getMonth()?t.format(new Date(this.currentDate()),"MMM yyyy",this.model.locale):t.format(new Date(n[0]),"MMM",this.model.locale)+" - "+t.format(new Date(n[n.length-1]),"MMM yyyy",this.model.locale):t.format(new Date(n[0]),"MMM yyyy",this.model.locale)+" - "+t.format(new Date(n[n.length-1]),"MMM yyyy",this.model.locale):i=t.format(new Date(this.currentDate()),"MMM yyyy",this.model.locale),i},_firstweekdate:function(n){var t=new Date(n),i=t.getDay(),r;return this._firstdayofweek==0?i!=0&&(t.setDate(t.getDate()-i),!this.model.timeScale.enable&&(this.currentView()=="workweek"||this._oneWeek)&&this._resize&&(t=new Date(this._dateRender[0]))):this._firstdayofweek!=0&&(r=t.getDay()-this._firstdayofweek<0?7+t.getDay()-this._firstdayofweek:t.getDay()-this._firstdayofweek,t=new Date(t.setDate(t.getDate()-r))),t},_formatDateHeaderValue:function(n,i){var r,u;return this.model.dateFormat!=""&&!t.isNullOrUndefined(this.model.dateFormat)?t.format(n,this.model.dateFormat,this.model.locale)+" - "+t.format(i,this.model.dateFormat,this.model.locale):(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),r.toLowerCase().startsWith("d")?new Date(n).getYear()===new Date(i).getYear()?new Date(n).getMonth()===new Date(i).getMonth()?t.format(new Date(n),"dd",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):t.format(new Date(n),"dd MMM",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):t.format(new Date(n),"dd MMM yyyy",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?new Date(n).getYear()===new Date(i).getYear()?new Date(n).getMonth()===new Date(i).getMonth()?t.format(new Date(n),"MMM dd",this.model.locale)+" - "+t.format(new Date(i),"dd, yyyy",this.model.locale):t.format(new Date(n),"MMM dd",this.model.locale)+" - "+t.format(new Date(i),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),"MMM dd, yyyy",this.model.locale)+" - "+t.format(new Date(i),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),r,this.model.locale)+" - "+t.format(new Date(i),r,this.model.locale))},_getHeaderAllDayCellsCount:function(){var c,f,e,o=[],r=[],s,u=1,h,i;if(this.dateRender=[],this._value=[],this.value=[],this.model.orientation=="vertical"){if(t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView())for(e=this._getColumnCount().length,this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(h=this._getMultipleResourceCellsCount(e),u=h.resCount,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(u=1)),i=0;i<e;i++)s=this.currentView()==="month"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],f=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday":"",c=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:s,currentDateClass:"",cellToday:""}:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?{currentDay:t.format(new Date(this._dateRender[i]),this._pattern.D,this.model.locale),currentDateClass:"",cellToday:f}:{currentDay:s+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:"",cellToday:f}:{currentDay:s+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:f},o.push(c),this._value.push(i);else o=this._getUserDateheaderTemplate(),this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(h=this._getMultipleResourceCellsCount(e),u=h.resCount,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(u=1));if(this._resWorkWeek)r=n.merge(r,o),this.dateRender=n.merge(this.dateRender,this._dateRender),this.value=n.merge(this.value,this._value);else for(i=0;i<u;i++)this.dateRender=n.merge(this.dateRender,this._dateRender),r=n.merge(r,o),this.value=n.merge(this.value,this._value)}else r=this._getHorizontalheaderCellCount(this._culture);return r},_findResourceIndex:function(n,t,i){for(var r=0;r<n.length;r++)if(n[r][t]===i)return r},_renderHeaderAllDayTemplate:function(){var r,e,i,g,w,nt,tt,b,k,o;if(this.currentView()!="agenda")if(t.scheduleFeatures.horizontal&&this.model.orientation=="horizontal")this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._renderMultipleResourceHeaderTemplate(null,null),this._renderHorizontalHeaderBar();else{var s=t.buildTag("div.e-headerscrolldiv"),h=t.buildTag("div.e-headeralldaydiv","",{},{height:"100%"}).css({position:"relative",overflow:"hidden"}),c=0,l=t.buildTag("table.e-table e-headrealldaytable","",{},{cellspacing:"0px",cellpadding:"0px",width:"100%"}),u=t.buildTag("tbody"),d=t.buildTag("tr.e-dateheader"),f=this._getHeaderAllDayCellsCount(),o=this.headTemplate.render({cols:f,view:this.currentView(),colspan:1});this._tempResource.length!=0&&t.scheduleFeatures.resources&&(u=this._renderMultipleResourceHeaderTemplate(u,f),c=t.isNullOrUndefined(this.model.group)?0:this._grouping.length,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(c=0));var a=t.buildTag("div.e-navigate","",{},{}),v=t.buildTag("table.e-table e-headertable","",{},{cellspacing:"0px",cellpadding:"0px"}),y=t.buildTag("tbody"),p=t.buildTag("tr.e-headertr");for(headTrCount=this.currentView()=="month"||this._isCustomMonthView()?1:2,r=c+headTrCount,e=[],i=0;i<r;i++)this.currentView()=="month"||this._isCustomMonthView()?e.push({tdClass:i==r-1?"e-monthleftcells":"e-resourceleftindentcells",divClass:i==r-1?"e-dateheadercell":""}):e.push({tdClass:i==r-1?"e-leftindent":i==r-2?"e-settingsindent":"e-resourceleftindentcells",divClass:i==r-1?"e-schedulesettings e-textellipsis":i==r-2?"e-dateheadercell":""});this.model.showAllDayRow||new t.DataManager(e).remove("tdClass","e-leftindent");g=this.leftIndent.render({trs:e});this.model.timeScale.enable?this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td.e-empty").addClass(this.currentView()=="month"||this._isCustomMonthView()?"e-monthempty":"").append(g)).append(t.buildTag("td").append(s.append(h.append(l.append(u.append(d.append(o))))))).append(t.buildTag("td.e-emptyscrolltd","",{},{width:this.currentView()=="month"||this._isCustomMonthView()?"0px":this._mediaQuery?"0px":"18px"}))))))):this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td").append(s.append(h.append(l.append(u.append(d.append(o))))))).append(t.buildTag("td.e-emptyscrolltd","",{},{width:this.currentView()=="month"||this._isCustomMonthView()?"0px":this._mediaQuery?"0px":"18px"})))))));this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable&&this.model.showAllDayRow&&(w=t.isNullOrUndefined(this.model.allDayCellsTemplateId)?!1:!0,w&&(nt=this._getUserAllDayCellsTemplate()),tt=this.alldayTemp.render({cols:f,colspan:1,userTemp:w,userHtml:nt}),u.append(t.buildTag("tr").append(tt)))}else{var a=t.buildTag("div.e-navigate","",{},{}),v=t.buildTag("table.e-table e-headertable","",{},{cellspacing:"0px",cellpadding:"0px"}),y=t.buildTag("tbody"),p=t.buildTag("tr.e-headertr"),s=t.buildTag("div.e-headerscrolldiv"),h=t.buildTag("div.e-headeralldaydiv","",{},{height:"100%"}).css({position:"relative",overflow:"hidden"}),l=t.buildTag("table.e-table e-headrealldaytable","",{},{cellspacing:"0px",cellpadding:"0px",width:"100%"}),u=t.buildTag("tbody tr"),f=[{headertext:this._getLocalizedLabels("Date"),className:"e-datecolumn"},{headertext:this._getLocalizedLabels("Time"),className:"e-timecolumn"},{headertext:this._getLocalizedLabels("Event"),className:"e-eventcolumn"}];if(this._tempResource.length!=0&&t.scheduleFeatures.resources){for(this._renderMultipleResourceHeaderTemplate(null,null),b=[],k=0;k<this.render_Resources.length;k++)b.push({headertext:"",className:"e-resourcecolumn"});t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0||(f=n.merge(b,f))}o=this.agendaheadTemplate.render({cols:f});this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td").append(s.append(h.append(l.append(u.append(o)))))).append(t.buildTag("td.e-emptyscrolltd","",{},{width:"18px"})))))))}t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderAllDayTemplate")},_getDateTime:function(n){var t=n,r,i;return(this._cellIndex=this.model.timeScale.enable?t.is(".e-workcells, .e-alldaycells")||this._isCustomMonthView()&&this._oneWeek?t.index():7-((parseInt(t.index()/7)+1)*7-t.index())+t.parent().index()*7:this.model.orientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?7-((parseInt(t.index()/7)+1)*7-t.index())+t.parent().index()*7:t.index(),this.model.orientation=="horizontal"&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):this._cellIndex:t.index(),this._workCellIndex=t.parent().index()),r=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this._resWorkWeek?this._dateRender:this.dateRender:this._dateRender,r=this.model.orientation=="horizontal"&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r,i=new Date(r[this._cellIndex]),this.model.minDate>i||this.model.maxDate<i)?!1:(t.hasClass("e-workcells")&&this.model.showTimeScale&&this.currentView()!=="month"&&!this._isCustomMonthView()?this._calcCurrentTime(i,t,""):(this.cur_StartTime=new Date(new Date(i).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(i).setHours(23,59,59))),t.hasClass("e-horizontmonthheaderdaytd")?{startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,currentDate:i,cellIndex:this._cellIndex,currentDate:i}:{startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,currentDate:i,cellIndex:this._cellIndex,currentDate:i,resources:this._tempResource.length!=0?this._getResourceValue(t,this._cellIndex):null})},_getAgendaAppointment:function(i){var r=[],o,u,f,s,e;if(i.hasClass("e-datecolumn")){if(o=n(i).attr("rowspan"),u=n(i).parent().nextAll("tr").andSelf().slice(0,parseInt(o)),u.length>0)for(f=0;f<u.length;f++)s=n(u[f]).find(".e-eventcolumn .e-agendaappointment").attr("guid"),r.push(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,s))[0])}else r=i.hasClass("e-agendaappointment")?i:i.parent().find(".e-agendaappointment"),e=r.attr("guid"),this._mediaQuery&&(this._mAppId=e),r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,e));return r},_monthdates:function(){var t=new Date(this.currentDate()),u=t._currentMonthDates(),i=u.start._currentWeekDates(this._firstdayofweek).start,o=u.end._currentWeekDates(this._firstdayofweek).end,r=[],f,n,e;this.monthDays=[];f=this._getWeekDays();n=new Date(i.getFullYear(),i.getMonth(),i.getDate());do this.model.showWeekend?(r.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()),new Date(t).getMonth()===new Date(n).getMonth()&&this.monthDays.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime())):(e=f.indexOf(new Date(n).getDay()),e!=-1&&(r.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()),new Date(t).getMonth()===new Date(n).getMonth()&&this.monthDays.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()))),n.setDate(n.getDate()+1);while(n.getTime()<=o.getTime());return this.model.orientation=="vertical"?r:this.monthDays},_getStartEndTime:function(){var i=[],f,u,e,o,r,n;if(this._timeInitial=0,u=this._culture.calendar,this.model.orientation==="vertical")if(this.currentView()=="month"||this._isCustomMonthView())for(e=this._dateRender.length,o=this.model.showWeekend?7:this.model.workWeek.length,n=0;n<e/o;n++)i.push(n);else if(t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId))for(r=new Date((new Date).setHours(0,0,0,0)),n=this.model.startHour*60;n<this.model.endHour*60;)this._timeMode=="12"?new Date(new Date(r).setHours(this.model.endHour,0,0,0)).getTime()>new Date(new Date(r).setHours(0,n,0,0)).getTime()&&(f=(n/60===this.model.startHour||n/60==12)&&u.AM&&u.PM?t.format(new Date(new Date(r).setHours(0,n,0,0)),"hh tt",this.model.locale):t.format(new Date(new Date(r).setHours(0,n,0,0)),"hh mm",this.model.locale),i.push({time:f,id:n/60})):i.push({time:new Date(new Date(r).setHours(0,n,0,0)).toTimeString().slice(0,5)+" 00"}),n=n+this.model.timeScale.majorSlot;else i=this._getUserTimeCellsTemplate();else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(i=this._getHoriStartEndTime(u));return i},_getWorkCellsCount:function(){var t=[],u=this.model.showWeekend?7:this.model.workWeek.length,f,r,i,n;if(this.model.timeScale.enable)if(this.currentView()=="month"||this._isCustomMonthView())for(i=this._dateRender.length,n=0;n<i/u;n++)t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});else for(f=this._getStartEndTime(),r=0,n=0;n<this.model.timeScale.minorSlotCount*f.length;n++)if(r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,r>(this.model.endHour-this.model.startHour)*60){t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});break}else t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});else for(i=this._resWorkWeek?1:this._dateRender.length,n=0;n<i/u;n++)t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});return t},_renderContentAreaTemplate:function(){var n=t.buildTag("div.e-workareadiv"),i=t.buildTag("table.e-table e-worktable","",{},{height:"100%",cellpadding:"0px",cellspacing:"0px",width:"100%"}),r=t.buildTag("tbody"),u=t.buildTag("tr"),f=t.buildTag("td"),e=t.buildTag("div#"+this._id+"_scroller"),c,v;if(this.$WorkCellDiv=t.buildTag("div.e-draggableworkarea").attr({width:"100%",height:"100%"}),this.currentView()!="agenda")if(t.scheduleFeatures.horizontal&&this.model.orientation=="horizontal")this._renderHorizontalContent(n,i,r,u,f,e);else{this.$TimeCellTD=t.buildTag("td","",{},{}).addClass(this.currentView()=="month"||this._isCustomMonthView()?"e-monthleftindent":"e-workleftindent");var l,a,o=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,s=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,y=this.currentView()=="month"||this._isCustomMonthView()?1:0,h=this._timeSlotCount(o,s);(o||s)&&this.currentView()!="month"&&!this._isCustomMonthView()?(h.columnCount.pop(),l=this.userTimeCellTemplate.render({timerows:this._getStartEndTime(),cols1:h.columnCount,viewclass:y,timeScale:this.model.timeScale.minorSlotCount,cheight:this.model.cellHeight,userTemplateId:o,timeValue1:h.timeValue1,template:s})):l=this.timeCellTemplate.render({timerows:this._getStartEndTime(),cols1:h.columnCount,viewclass:y,timeScale:this.model.timeScale.minorSlotCount,userTemplateId:o,template:s});c=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0;c&&(v=this._getUserWorkCellsTemplate());a=this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?this.workcellTemp.render({cellrows:this._getWorkCellsCount(),cols1:this.value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:c,userHtml:v}):this.monthcellTemp.render({cellrows:this._getWorkCellsCount(),cols1:this.value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:c,userHtml:v});this.model.timeScale.enable?this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(this.$TimeCellTD.append(l)).append(f.append(e.append(this.$WorkCellDiv.append(a))))))))):this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(a)))))))))}else this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv))))))));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderContentAreaTemplate")},_renderQueryCellInfo:function(i,r,u){var it,h,a,v,ft,et,p,st,ht,w,nt,tt,o,f,e,s;if(i=="renderHeaderBar"&&this._trigger("queryCellInfo",{element:u,requestType:"headerBar"}),i=="appointment"&&this._trigger("queryCellInfo",{appointment:r,element:u,requestType:"appointment"}),i=="blockAppointment"&&this._trigger("queryCellInfo",{appointment:r,element:u,requestType:"blockoutCells"}),i=="emptycell"&&(it=this.aTR.find(".e-emptyscrolltd"),this._trigger("queryCellInfo",{element:n(it[0]),requestType:"emptytd"})),i=="renderAgendaContent"){for(h=this.aTR.find(".e-headercells"),f=0;f<h.length;f++)this._trigger("queryCellInfo",{element:n(h[f]),cellType:"agendaheadercells",requestType:"agendacells"});var b=this.element.find(".e-draggableworkarea").find(".e-datecolumn"),k=this.element.find(".e-draggableworkarea").find(".e-timecolumn"),d=this.element.find(".e-draggableworkarea").find(".e-eventcolumn");if(this._tempResource.length!=0)for(a=this.element.find(".e-draggableworkarea").find(".e-resourcecolumn"),f=0;f<a.length;f++)e=this._getAgendaAppointment(n(a[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(a[f]),cellType:"agendaresourcecell",requestType:"agendacells"});for(f=0;f<b.length;f++)e=this._getAgendaAppointment(n(b[f])),this._trigger("queryCellInfo",{currentAppointmentDate:new Date(new Date(e[0][this._appointmentSettings.startTime]).setHours(0,0,0)),appointments:e,element:n(b[f]),cellType:"agendadatecell",requestType:"agendacells"});for(f=0;f<k.length;f++)e=this._getAgendaAppointment(n(k[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(k[f]),cellType:"agendatimecell",requestType:"agendacells"});for(f=0;f<d.length;f++)e=this._getAgendaAppointment(n(d[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(d[f]),cellType:"agendaeventcell",requestType:"agendacells"})}else if(i=="renderHeaderAllDayTemplate")if(this.model.orientation=="vertical"){var h=this.aTR.find(".e-headercells"),rt=this.res1,ut=this._getHeaderAllDayCellsCount();if(this.res1=rt,this.model.showAllDayRow)for(v=this.aTR.find(".e-alldaycells"),f=0;f<v.length;f++)e=this._getDateTime(n(v[f])),s={cellIndex:e.cellIndex,currentDate:e.currentDate,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(v[f]),requestType:"alldaycells"});if(this.currentView()!="agenda")for(ft=h.length/this.res1.length,f=0;f<h.length;f++)et=Math.floor(f/ft),this._trigger("queryCellInfo",{resource:this.res1[et],currentDay:ut[f].currentDay,element:n(h[f]),requestType:"headercells"});if(this._tempResource.length!=0){var y=[],c=this.aTR.find(".e-resourcecells"),ot=this.aTR.find(".e-resourceleftindentcells");for(p=0;p<this._tempResource.length;p++)n.merge(y,this._tempResource[p].resourceSettings.dataSource);for(f=0;f<c.length;f++)this._trigger("queryCellInfo",{resource:y[f],element:n(c[f]),cellType:"headercells",requestType:"resourceheadercells"});for(f=0;f<ot.length;f++)this._trigger("queryCellInfo",{element:n(ot[f]),cellType:"headerdivcells",requestType:"resourceheadercells"})}this.currentView()=="month"&&this._isCustomMonthView()||(st=this.aTR.find(".e-leftindent"),this._trigger("queryCellInfo",{element:st,requestType:"leftindentcells"}));ht=this.currentView()=="month"||this._isCustomMonthView()?this.aTR.find(".e-monthleftcells"):this.aTR.find(".e-settingsindent");this._trigger("queryCellInfo",{element:ht,requestType:"leftheadercells"})}else{var ct=this.aTR.find(".e-headercells"),rt=this.res1,ut=this._getHeaderAllDayCellsCount();this.res1=rt;var lt=this.aTR.find(".e-horizontaltimetd "),l=this.aTR.find(".e-horizontalalternatetd"),g=this._getStartEndTime();for(f=0;f<lt.length;f++)this._trigger("queryCellInfo",{cell:g[f],element:n(lt[f]),cellType:"timecell",requestType:"timecells"});for(f=0;f<l.length;f++)this._trigger("queryCellInfo",{element:n(l[f]),cellType:"timeampmcell",requestType:"timecells"});if(this.currentView()!="agenda")for(f=0;f<ct.length;f++)this._trigger("queryCellInfo",{currentDay:ut[f].currentDay,element:n(ct[f]),requestType:"headercells"});for(w=this.aTR.find(".e-horizontmonthheaderdaytd"),f=0;f<w.length;f++)e=this._getDateTime(n(w[f])),s={cellIndex:e.cellIndex,currentDate:e.currentDate},this._trigger("queryCellInfo",{cell:s,element:n(w[f]),requestType:"headerdate"});if(this._tempResource.length!=0)for(nt=this.aTR.find(".e-horizontalheader"),f=0;f<nt.length;f++)this._trigger("queryCellInfo",{element:n(nt[f]),requestType:"resourcegroupheader"})}else if(i=="renderContentAreaTemplate")if(this.model.orientation=="vertical"){for(l=this.wTR.find(".e-timecelldivs"),timeCellAMPM=this.wTR.find(".e-ampmdisplay"),g=this._getStartEndTime(),this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(o=this.wTR.find(".e-workcells"),tt="workcells"):(o=this.wTR.find(".e-monthcells"),tt="monthcells"),f=0;f<l.length;f++)this._trigger("queryCellInfo",{cell:g[f],element:n(l[f]).parent(),cellType:"timecell",requestType:"timecells"});for(f=0;f<timeCellAMPM.length;f++)this._trigger("queryCellInfo",{element:n(timeCellAMPM[f]),cellType:"timeampmcell",requestType:"timecells"});for(f=0;f<o.length;f++)e=this._getDateTime(n(o[f])),s=this.currentView()!="month"&&this.currentView()!="customview"&&this.model.timeScale.enable?{cellIndex:e.cellIndex,startTime:e.startTime,endTime:e.endTime,resources:e.resources}:{cellIndex:e.cellIndex,currentDate:e.currentDate,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(o[f]),requestType:tt})}else{if(o=t.isNullOrUndefined(this.$WorkCellDiv)?null:this.$WorkCellDiv.find(".e-workcells"),this._tempResource.length!=0&&!t.isNullOrUndefined(this.$WorkCellDiv)){var c=this.$WorkCellDiv.find(".e-resourceheadercells"),y=this._resourceSort(),at=this.wTR.find(".e-horizontresheaderdiv");for(f=0;f<at.length;f++)this._trigger("queryCellInfo",{resource:y[n(c[f]).index()],element:n(at[f]),cellType:"headerdivcells",requestType:"resourceheadercells"});for(f=0;f<c.length;f++)this._trigger("queryCellInfo",{resource:y[n(n(c[f]).parent()).index()],element:n(c[f]),cellType:"headercells",requestType:"resourceheadercells"})}if(!t.isNullOrUndefined(o))for(f=0;f<o.length;f++)n(o[f]).hasClass("e-childworkcell")&&n(o[f]).hasClass("e-workcells")&&(e=this._getDateTime(n(o[f])),s={cellIndex:e.cellIndex,startTime:e.startTime,endTime:e.endTime,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(o[f]),requestType:"workcells"}))}},_timeSlotCount:function(i,r){var e=0,o=[],a=[],h,v,f,c,u,l;if((i||r)&&this.currentView()!=="month"&&!this._isCustomMonthView()){for(u=0;u<this.model.timeScale.minorSlotCount;u++)o.push(u);c=o}else{for(h=this._getStartEndTime(),v=this.model.orientation=="vertical"?this.model.timeScale.minorSlotCount:this.model.timeScale.minorSlotCount-1,f=0;f<h.length;f++){for(u=0;u<v;u++)if(e=e+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,e>(this.model.endHour-this.model.startHour)*60){if(o.push(u),u==this.model.timeScale.minorslotcount-2){e=0;break}}else o.push(u);a.push(o);e=e+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;o=[]}c=a}if((i||r)&&this.currentView()!=="month"&&!this._isCustomMonthView()){var y=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),p=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),w=[],f=0;for(u=this.model.startHour;u<this.model.endHour;){for(var s=[],e=this.model.timeScale.majorSlot+f,b=f;f<e;)l=f,f=f*6e4,this._timeMode=="12"?l!=b||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?s.push(y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):s.push(p.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):l!=b||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?s.push(y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):s.push(p.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()),f=f/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:f>=60?u+1:u;f=f>=60?0:f;w.push(s)}r=!0}return{columnCount:c,timeValue1:w,strTime:h}},_renderAgendaContent:function(){var l,o,e,h,y,tt,p,it,pt,s,wt,bt,f,i,gt,u,n,a,v,c,rt;this.element.find(".e-agendacellstab").remove();var r=new Date(new Date(this.currentDate()).setHours(0,0,0,0)),w=[],ut=[],ft,et,ot,st,ht,b,ct,k,lt,d,at,g,vt,nt,yt;for(this.model.group||(this.res1=["0"]),l=this._getLocalizedLabels("Recurrence"),o=this._getAgendaDateCount(),e=0;e<this.res1.length;e++)if(f=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(r).setDate(r.getDate()+o)).setHours(23,59,59))),f=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?f.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.id]):f,h=new t.DataManager(this._processed).executeLocal((new t.Query).where(f)),h=this._appointmentSort(h),h.length>0){if(y=[],!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources){for(tt=this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.groupId],u=this._resCollection,n=u.length-1;n>0;n--)p=new t.DataManager(u[n-1].dataSource).executeLocal((new t.Query).where(u[n-1].id,t.FilterOperators.equal,tt)),y.push({resId:"resLevel_"+n+"_"+p[0][u[n-1].id],text:p[0][u[n-1].text]}),tt=p[0][u[n-1].groupId];y.reverse()}for(it=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?!0:!1,pt=h.length,nt=this.model.resourceHeaderTemplateId?!0:!1,yt=nt?this._getResourceHeadTemplate(this.res1[e]):"",s=0,new Date(r)<this.model.minDate&&(s=Math.floor((new Date(this.model.minDate)-new Date(r))/864e5)),new Date(new Date(r).setDate(r.getDate()+o))>this.model.maxDate&&(o=o-Math.floor((new Date(new Date(r).setDate(r.getDate()+o))-new Date(this.model.maxDate))/864e5));s<=o;s++)if((this.model.showWeekend||(wt=this._getWeekDays(),bt=new Date(new Date(r).setDate(r.getDate()+s)),wt.indexOf(bt.getDay())!=-1))&&(f=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(r).setDate(r.getDate()+s))).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(r).setDate(r.getDate()+s)).setHours(23,59,59))),f=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?f.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.id]):f,i=new t.DataManager(h).executeLocal((new t.Query).where(f)),i.length>0)){w.push(w.length+1);var ni=i.length,kt=!0,dt=!1;for(n=0;n<i.length;n++)n==i.length-1&&(dt=!0),ft=this._timeMode=="12"?t.format(i[n][this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[n][this._appointmentSettings.startTime],"HH:mm",this.model.locale),et=this._timeMode=="12"?t.format(i[n][this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[n][this._appointmentSettings.endTime],"HH:mm",this.model.locale),ot="<strong class='e-agendaday'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"dd",this.model.locale)+"<\/strong><span class='e-agendaweek'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"dddd",this.model.locale)+"<\/span><span class='e-agendamonth'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"MMM, yyyy",this.model.locale)+"<\/span>",st=!t.isNullOrUndefined(i[n][this._appointmentSettings.allDay])&&JSON.parse(i[n][this._appointmentSettings.allDay])?"<div class='e-icon e-circle e-scheduleallday'><\/div>"+this._getLocalizedLabels("AllDay"):ft+" - "+et,ht=!t.isNullOrUndefined(i[n][this._appointmentSettings.recurrence])&&JSON.parse(i[n][this._appointmentSettings.recurrence])?i[n][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?"<span class='e-icon e-schedulerepeatedit' title='"+l+"'/>"+i[n][this._appointmentSettings.subject]:"<span class='e-icon e-schedulerepeat' title='"+l+"'/>"+i[n][this._appointmentSettings.subject]:i[n][this._appointmentSettings.subject],b=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(i[n][this._appointmentSettings.categorize])&&i[n][this._appointmentSettings.categorize]!=""?this._getCategorizeColor(i[n]):this._tempResource.length!=0&&t.scheduleFeatures.resources?this._getResourceColor(i[n]):{appointData:"",appointCustomcss:"",appointtextcolor:""},ct=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&this._tempResource.length!=0?this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.text]:"",k=this.model.appointmentTemplateId?!0:!1,lt=k?i[n][this._appointmentSettings.recurrence]?i[n][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?"<span class='e-icon e-schedulerepeatedit' title='"+l+"'/>"+this._getUserAppointmentTemplate(i[n]):"<span class='e-icon e-schedulerepeat' title='"+l+"'/>"+this._getUserAppointmentTemplate(i[n]):this._getUserAppointmentTemplate(i[n]):"",d=this.model.agendaViewSettings.dateColumnTemplateId?!0:!1,at=d?this._getUserTemplate(this.model.agendaViewSettings.dateColumnTemplateId,i[n]):"",g=this.model.agendaViewSettings.timeColumnTemplateId?!0:!1,vt=g?this._getUserTemplate(this.model.agendaViewSettings.timeColumnTemplateId,i[n]):"",ut.push({readOnly:this.model.readOnly,edittext:this._getLocalizedLabels("Edit"),deletetext:this._getLocalizedLabels("Delete"),userResourceId:nt,userResourceHtml:yt,userDateId:d,userDateHtml:at,userTimeId:g,userTimeHtml:vt,userAppTemplId:k,userTemplate:lt,resGroup:y,resName:ct,resChild:it,resRowSpan:pt,id:i[n].AppTaskId,uid:i[n].Guid,dayRowSpan:i.length,dayChild:kt,dayBorderBottom:dt,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!b.applyFilter?!0:!1,background:b.appointData,date:ot,time:st,event:ht}),kt=!1,it=!1}}if(gt=this.agendacellTemp.render({rows:w,cols:ut}),this.element.find(".e-draggableworkarea").append(gt),!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(u=this.render_Resources,n=0;n<u.length-1;n++)for(a=0;a<u[n].length;a++)v="resLevel_"+(n+1)+"_"+u[n][a][this._resCollection[n].id],this.element.find("."+v).first().attr("rowspan",this.element.find("."+v).length),this.element.find("."+v).slice(1).addClass("e-hide"),this.element.find(".e-hide").remove(),this.model.resourceHeaderTemplateId&&this.element.find("."+v).children().empty().append(this._getResourceHeadTemplate(u[n][a]));c=this.element.find("div#"+this._id+"_scroller");t.isNullOrUndefined(c.data("ejScroller"))&&(c.ejScroller({enableRTL:this.model.enableRTL,height:this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top)-1,width:parseInt(this.element.width())-2,cssClass:this.model.cssClass}),this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator));c.ejScroller("refresh");rt=this.model.enableRTL?"e-borderright":"e-borderleft";c.ejScroller("isVScroll")?this.element.find(".e-emptyscrolltd").addClass(rt).show()&&this.element.find(".e-draggableworkarea").height(this.element.find(".e-draggableworkarea").height()+1):this.element.find(".e-emptyscrolltd").removeClass(rt).hide();this.element.find(".e-vscroll").css("left",this.model.enableRTL?0:this.element.outerWidth()-(c.ejScroller("isVScroll")?19:0));this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width());this.model.showAppointmentNavigator&&this._nextPrevButton();t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderAgendaContent")},_getUserTemplate:function(t,i){var r=n.extend(r,i);return r.View=this.currentView(),n.templates(n(t).html()).render(r)},_getColumnCount:function(){for(var t=[],i=this.currentView()==="month"||this._isCustomMonthView()?this._isCustomMonthView()?this._renderDays<=7?this._renderDays:this.model.showWeekend?7:this.model.workWeek.length:this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length,n=0;n<i;n++)t.push(n);return t},_bindAppointmentsData:function(i){if(t.isNullOrUndefined(this.model.appointmentSettings)||this.dataSource()==null)this.model.showAppointmentNavigator&&this._nextPrevButton();else if(this.model.enablePersistence&&(this.model.appointmentSettings.query=new t.Query,this._enablePersist=!0),!this.dataSource()instanceof t.DataManager&&this.dataSource().dataSource.offline&&this._dateFormat(this.dataSource()),this.dataSource()instanceof t.DataManager&&!this.dataSource().dataSource.offline)this._initDataSource(i);else{this._bindAppointments=this.dataSource().length>0?!0:!1;var r=i=="Refresh"?!1:this._viewchange;this._angular=this._bindAppointments&&!this._bindapp&&!this._setmodelvalue&&r==!0&&this._obj.length>0&&this.dataSource()[0][this._appointmentSettings.id]==this._obj[0][this._appointmentSettings.id];this._true=this.model.isDST==!0?!0:!1;this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&this.model.isDST==!1?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0;this._currentAppointmentData=this.dataSource();n.extend(!0,this._obj=[],this.dataSource());!t.isNullOrUndefined(this.dataSource().dataSource)&&this.dataSource().dataSource.json&&(this._currentAppointmentData=this.dataSource().dataSource.json);this._dataCount=this._currentAppointmentData.length;this._dataCount>0&&(this._dataProcessing(this._currentAppointmentData),this.element.children().length>0&&this._renderAppointmentAll());this.model.showAppointmentNavigator&&this._nextPrevButton();this.tzone=this.model.timeZone;this._bindapp=!1;this._setmodelvalue=!1;this._viewchange=!1}},_initDataSource:function(i){var e=this._columnToSelect(this.model.appointmentSettings,i),f=n.extend(!0,[],e._params),o,s,u,r,h;for(this._true=this.model.isDST==!0?!0:!1,this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&this.model.isDST==!1?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0,e._params=[],o=new Date(new Date(this.currentDate()).setHours(0,0,0)),s=new Date(o.getTime()+-this._timeZoneCalculate()*6e4),e.addParams("CurrentDate",s).addParams("CurrentView",this.currentView()).addParams("CurrentAction",i),u=0;u<f.length;u++)f[u].key!="CurrentDate"&&f[u].key!="CurrentView"&&f[u].key!="CurrentAction"&&e.addParams(f[u].key,f[u].value);r=this;h=this.dataSource().executeQuery(e);h.done(function(n){r._dataCount=n.result.length;t.isNullOrUndefined(n.result.result)||(r._dataCount=n.result.count+1,n.result=n.result.result);r._bindAppointments=n.result.length>0?!0:!1;r._currentAppointmentData=n.result;r._dataProcessing(n.result);r._renderAppointmentAll();r.model.showAppointmentNavigator&&r._nextPrevButton()});this.model.showAppointmentNavigator&&this._nextPrevButton()},_bindCategorizeData:function(){t.isNullOrUndefined(this.model.categorizeSettings)||(this._categoryInfo=[],!t.isNullOrUndefined(this.model.categorizeSettings.query)&&this.model.categorizeSettings.query instanceof t.Query||(this.model.categorizeSettings.query=t.Query()),this.model.categorizeSettings.dataSource instanceof t.DataManager?this._initCategorizeData(this.model.categorizeSettings):this._categoryInfo.push(this.model.categorizeSettings))},_initCategorizeData:function(n){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){t.isNullOrUndefined(i._appointmentAddWindow)&&i._renderAppointmentWindow();n.dataSource=r.result;i._categoryInfo.push(n);i._renderCategoryItems(i._appointmentAddWindow)})},_bindPriorityData:function(){t.isNullOrUndefined(this.model.prioritySettings)||(this._priorityInfo=[],!t.isNullOrUndefined(this.model.prioritySettings.query)&&this.model.prioritySettings.query instanceof t.Query||(this.model.prioritySettings.query=t.Query()),this.model.prioritySettings.dataSource instanceof t.DataManager?this._initPriorityData(this.model.prioritySettings):this._priorityInfo.push(this.model.prioritySettings))},_initPriorityData:function(n){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){t.isNullOrUndefined(i._appointmentAddWindow)&&i._renderAppointmentWindow();n.dataSource=r.result;i._priorityInfo.push(n);i._renderPriorityItems(i._appointmentAddWindow)})},_bindBlockData:function(){if(!t.isNullOrUndefined(this.model.blockoutSettings)&&(!t.isNullOrUndefined(this.model.blockoutSettings.query)&&this.model.blockoutSettings.query instanceof t.Query||(this.model.blockoutSettings.query=t.Query()),this.model.blockoutSettings.dataSource instanceof t.DataManager)){var i=this._columnToSelect(this.model.blockoutSettings),n=this,r=this.model.blockoutSettings.dataSource.executeQuery(i);r.done(function(t){n.model.blockoutSettings.dataSource=t.result;n._renderBlockAppointments()})}},_dateFormat:function(n){if(n.length>0&&new Date(n[0][this._appointmentSettings.startTime]).toString()=="Invalid Date")for(var t=0,i=n.length;t<i;t++)n[t][this._appointmentSettings.startTime]=(new Date).parseISO8601(n[t][this._appointmentSettings.startTime]),n[t][this._appointmentSettings.endTime]=(new Date).parseISO8601(n[t][this._appointmentSettings.endTime])},_columnToSelect:function(n){var i=t.Query();return t.isNullOrUndefined(n.tableName)||this.dataSource().dataSource.url.match(n.tableName+"$")?i=n.query:(i=n.query,i.from(n.tableName)),i},_getColumns:function(n){var r=[];for(var i in n)i!=="tableName"&&i!=="query"&&i!=="dataSource"&&(t.isNullOrUndefined(n[i])||r.push(n[i]));return r},_sortAppById:function(n){return n.sort(function(n,t){var i=n.AppTaskId,r=t.AppTaskId;return i<r?-1:i>r?1:0}),n},_stdTimezoneOffset:function(){return Math.max(new Date((new Date).getFullYear(),0,1).getTimezoneOffset(),new Date((new Date).getFullYear(),6,1).getTimezoneOffset())},_timeZoneCalculate:function(){var i,r,u,o,s,f,h,c,l,e=(new Date).toString().indexOf("Daylight Time")!=-1&&this.model.isDST==!1?-(new Date).getTimezoneOffset()-this._timeZoneOffset:-(new Date).getTimezoneOffset();return i=e,t.isNullOrUndefined(this.model.timeZone)||(this.model.timeZone.indexOf(":")!==-1?(t.isNullOrUndefined(this.tzone)&&(this.tzone=this.model.timeZone),r=this.model.timeZone.split(" ")[this.model.timeZone.split(" ").length-1].split(":"),u=this.tzone.split(" ")[this.tzone.split(" ").length-1].split(":"),n.isNumeric(parseInt(r[0]))&&parseInt(r[0]).toString.length<=2||r[0].indexOf("UTC")!==-1?(o=this.model.timeZone.indexOf("-")!==-1?-parseInt(r[0].replace(/\D/g,"")):parseInt(r[0].replace(/\D/g,"")),s=parseInt(r[1]),f=-(o*60+s),this._setmodelvalue==!0?this.tzone==this.model.timeZone?i=-(-e+f):(h=this.tzone.indexOf("-")!==-1?-parseInt(u[0].replace(/\D/g,"")):parseInt(u[0].replace(/\D/g,"")),c=parseInt(u[1]),l=-(h*60+c),i=-(-l+f)):i=-f):i=-e):i=-e),i},_timeZoneAppointments:function(i,r){if(this.model.appointmentSettings.applyTimeOffset){var o,s,u,f,e;if(i[this._appointmentSettings.allDay])i[this._appointmentSettings.startTime]=new Date(i[this._appointmentSettings.startTime]),i[this._appointmentSettings.endTime]=new Date(i[this._appointmentSettings.endTime]);else return t.isNullOrUndefined(this._dayLight)?(u=i[this._appointmentSettings.startTimeZone],f=i[this._appointmentSettings.endTimeZone],t.isNullOrUndefined(f)&&!t.isNullOrUndefined(u)&&(i[this._appointmentSettings.endTimeZone]=f=u),!t.isNullOrUndefined(f)&&t.isNullOrUndefined(u)&&(i[this._appointmentSettings.startTimeZone]=u=f),t.isNullOrUndefined(u)||t.isNullOrUndefined(f)||(u=u.indexOf("UTC")!=-1?parseInt(u.split(" ")[1].split(":")[0])*60+parseInt(u.split(" ")[1].split(":")[1]):parseInt(u.split(":")[0])*60+parseInt(u.split(":")[1]),f=f.indexOf("UTC")!=-1?parseInt(f.split(" ")[1].split(":")[0])*60+parseInt(f.split(" ")[1].split(":")[1]):parseInt(f.split(":")[0])*60+parseInt(f.split(":")[1])),e=t.isNullOrUndefined(u)&&!n.isNumeric(u)?this._timeZoneCalculate(i):u-this._timeZoneCalculate(i)):e=this._timeValue,e=r==""?-e:e,o=new Date(i[this._appointmentSettings.startTime]),s=new Date(i[this._appointmentSettings.endTime]),i[this._appointmentSettings.allDay]&&Math.round((new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5)<24?i:(i[this._appointmentSettings.startTime]=new Date(o.setMinutes(o.getMinutes()+e)),i[this._appointmentSettings.endTime]=new Date(s.setMinutes(s.getMinutes()+e)),i);return i}return i},_processtimeZone:function(n){var t=new Date(n[this.model.blockoutSettings.startTime]),i=new Date(n[this.model.blockoutSettings.endTime]),r;return n[this.model.blockoutSettings.isAllDay]?(n[this.model.blockoutSettings.startTime]=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n[this.model.blockoutSettings.endTime]=new Date(i.getFullYear(),i.getMonth(),i.getDate(),23,59,59)):(r=this._timeZoneCalculate(n),n[this.model.blockoutSettings.startTime]=new Date(t.setMinutes(t.getMinutes()+r)),n[this.model.blockoutSettings.endTime]=new Date(i.setMinutes(i.getMinutes()+r))),n},_dataProcessing:function(n){var u,i,r;if(this._processed=[],this._appMainId=null,n.length>0){for(u=this._sortAppById(n),this._maxId=t.isNullOrUndefined(n[0])||t.isNullOrUndefined(n[0].AppTaskId)?1:n[0].AppTaskId,i=0;i<n.length;i++)n[i][this._appointmentSettings.startTime]=(new Date).parseISO8601(n[i][this._appointmentSettings.startTime]),n[i][this._appointmentSettings.endTime]=(new Date).parseISO8601(n[i][this._appointmentSettings.endTime]),this._bindAppointments==!0&&!this._angular&&!this._setmodelvalue&&this._applyTimeOffset&&t.isNullOrUndefined(this._enablePersist)?(r=this._timeZoneAppointments(n[i],"reverse"),this._appointmentProcessing(r)):this._appointmentProcessing(n[i]);return this._bindAppointments=!1,this._setmodelvalue=!1,this._processed=this._sortAppById(this._processed),this._processed}},_guidFormatGenerate:function(){function n(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()},_RecurrenceAppointment:function(i){var u,e,o;t.RecurrenceEditor.prototype._initializePrivateProperties();u=t.RecurrenceEditor.prototype;u._rRule={};i.AppTaskId=t.isNullOrUndefined(i.AppTaskId)?this._maxId:i.AppTaskId;t.isNullOrUndefined(i[this._appointmentSettings.id])&&(i[this._appointmentSettings.id]=i.AppTaskId);u.model.startDate=new Date(this.currentDate());for(var c=u.recurrenceDateGenerator(i[this._appointmentSettings.recurrenceRule],i[this._appointmentSettings.startTime],i[this._appointmentSettings.recurrenceExDate]),s=0,h=c;s<h.length;){var r={},f=new Date(h[s]),l=i[this._appointmentSettings.endTime];u._rRule.freq!="MONTHLY"&&u._rRule.freq!="YEARLY"||t.isNullOrUndefined(u._rRule.setPositions)||(f=u._dayOfWeekInMonth(f,u._rRule.weekDays,u._rRule.setPositions));e=new Date(f.getFullYear(),f.getMonth(),f.getDate(),new Date(i[this._appointmentSettings.startTime]).getHours(),new Date(i[this._appointmentSettings.startTime]).getMinutes(),new Date(i[this._appointmentSettings.startTime]).getSeconds());o=new Date(new Date(e).setMilliseconds(i[this._appointmentSettings.endTime].getTime()-i[this._appointmentSettings.startTime].getTime()));this._idChecking();i[this._appointmentSettings.recurrenceId]=i[this._appointmentSettings.recurrenceId]||i[this._appointmentSettings.id]||i.AppTaskId;i.ParentId=i[this._appointmentSettings.recurrenceId];t.isNullOrUndefined(u._rRule.exDate)?r=this._addAppData(i,this._maxId,e,o,i.ParentId):u._rRule.exDate.indexOf(t.format(new Date(f),this._pattern.d,this.model.locale))==-1&&(r=this._addAppData(i,this._maxId,e,o,i.ParentId));new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.allDay]!==!0?(r.Guid=this._guidFormatGenerate(),this._multipleDayApp(r,this._maxId,r[this._appointmentSettings.startTime],o)):Math.round((r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5)>24?(r.Guid=this._guidFormatGenerate(),this._multipleSplit(r,this._maxId,r[this._appointmentSettings.startTime],r[this._appointmentSettings.endTime])):n.isEmptyObject(r)||(r.Guid=this._guidFormatGenerate(),this._processed.push(r));s++;this._maxId++}},_recurrenceAppSort:function(i){for(var e,u,f=[],r=0;r<i.length;r++)e=new t.DataManager(i).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i[r].Guid)),e.length>1?(u=n.extend(!0,[],e),u[0][this._appointmentSettings.endTime]=u[u.length-1][this._appointmentSettings.endTime],f.push(u[0]),r++):f.push(i[r]);return f},_appointmentProcessing:function(n){this._maxId=t.isNullOrUndefined(this._appMainId)?parseInt(this._maxId):parseInt(this._appMainId)+1;var i=t.RecurrenceEditor.prototype;i._rRule={};t.isNullOrUndefined(n[this._appointmentSettings.recurrence])||t.isNullOrUndefined(n[this._appointmentSettings.recurrenceRule])||i.recurrenceRuleSplit(n[this._appointmentSettings.recurrenceRule],n[this._appointmentSettings.recurrenceExDate]);n[this._appointmentSettings.recurrence]==1&&t.isNullOrUndefined(i._rRule.recurEditId)?this._RecurrenceAppointment(n):new Date(new Date(n[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(n[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(n[this._appointmentSettings.endTime]-n[this._appointmentSettings.startTime])/36e5<24&&n[this._appointmentSettings.allDay]!==!0&&(n[this._appointmentSettings.recurrence]&&!t.isNullOrUndefined(i._rRule.recurEditId)||!n[this._appointmentSettings.recurrence])?(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.id]:i._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._maxId=n.AppTaskId,this._multipleDayApp(n,this._maxId,n[this._appointmentSettings.startTime],n[this._appointmentSettings.endTime])):(n[this._appointmentSettings.endTime]-n[this._appointmentSettings.startTime])/36e5>=24?(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.id]:i._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._maxId=n.AppTaskId,this._multipleSplit(n,this._maxId,n[this._appointmentSettings.startTime],n[this._appointmentSettings.endTime])):n[this._appointmentSettings.recurrence]!=0&&t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.recurrence]!=r&&n[this._appointmentSettings.allDay]!=r||n[this._appointmentSettings.recurrence]||(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=n[this._appointmentSettings.id],n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,n.RecurrenceId=n.recurrenceExDate=null,this._processed.push(n)):(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.id]:i._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._processed.push(n));this._appMainId=t.isNullOrUndefined(this._appMainId)||this._appMainId<this._maxId?this._maxId:this._appMainId},_idChecking:function(){for(var n,i,r=0;r<this._currentAppointmentData.length;r++)if(n=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._maxId),i=new t.DataManager(this._currentAppointmentData).executeLocal(n),i.length==0){this._maxId;break}else this._maxId++;for(;;)if(n=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._maxId),i=new t.DataManager(this._processed).executeLocal(n),i.length==0){this._maxId;break}else this._maxId++;return this._maxId},_getTotalDays:function(n,t){var u=this._getWeekDays(),i=new Date(n),r=0;do r=u.indexOf(i.getDay())!=-1?r+1:r,i=new Date(new Date(i).getTime()+864e5);while(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()<=new Date(t).getTime());return r},_getPrevNextDateCount:function(n,t){for(var u=this._getWeekDays(),i=new Date(n),r=0;u.indexOf(i.getDay())<0;)i=t=="next"?new Date(new Date(i).getTime()+864e5):new Date(new Date(i).getTime()-864e5),r++;return r},_multipleDayApp:function(n,t,i,r){r.getHours()==0&&r.getMinutes()==0&&(r=new Date(r.getTime()-1e3));var f=new Date(i),u=new Date(r);for((this.model.orientation=="vertical"||this.model.orientation=="horizontal"&&(i<new Date(this._dateRender[0])||r>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))))&&(u=new Date(new Date(i).setHours(23,59,59)));f>=new Date(i)&&f<=u&&u<=new Date(r);)this._processed.push(this._addAppData(n,t,f,u,n.ParentId)),f=new Date(new Date(u).setHours(24,0,0)),u=n[this._appointmentSettings.endTime],this._maxId=t=this._idChecking()},_multipleSplit:function(t,i,r,u){var s,f,a,h,o,v,c,l,e,y;if(r=new Date(r),this.currentView()=="workweek"&&!this._resWorkWeek&&n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)==-1){for(s=1;s<this._dateRender.length;s++)if(n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()+s).getTime(),this._dateRender)>=0){c=n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()+s).getTime(),this._dateRender);r=new Date(this._dateRender[c]);break}this.currentView()!="workweek"||this._resWorkWeek||this.model.orientation!="horizontal"||n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)!=-1||(r=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate()+(7-this._dateRender.length)))}for(f=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate(),new Date(r).getHours(),new Date(r).getMinutes(),new Date(r).getSeconds()),a=new Date(new Date(u).getFullYear(),new Date(u).getMonth(),new Date(u).getDate(),23,59,59);f<=a;)h=0,o=new Date(f),this.currentView()!=="day"&&this.currentView()!="agenda"&&(v=o._currentWeekDates(this._firstdayofweek),!this._isCustomMonthView()&&this._oneWeek?(f=new Date(new Date(o).getFullYear(),new Date(o).getMonth(),new Date(o).getDate()),h=this._dateRender.indexOf(f.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(f.getTime()):f.getTime()<new Date(this._dateRender[0]).getTime()?(new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1)).getTime()-new Date(f).setHours(0,0,0,0))/864e5:f.getTime()>new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):this.currentView()!="month"||this.model.orientation!="horizontal"&&(this.model.showNextPrevMonth||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(f.getFullYear(),f.getMonth(),1).getTime())?(c=this.currentView()=="workweek"&&!this._resWorkWeek&&this._firstdayofweek==0?v.end.getDay()-new Date(this._dateRender[this._dateRender.length-1]).getDay():0,h=(v.end.getTime()-new Date(o).setHours(0,0,0))/864e5-c):h=new Date(o.getFullYear(),o.getMonth()+1,0).getDate()-o.getDate()),l=new Date(f.getFullYear(),f.getMonth(),f.getDate()+h),e=new Date(l).getDate()==new Date(a).getDate()&&this.currentView()!=="month"?new Date(new Date(l).setHours(u.getHours(),u.getMinutes(),u.getSeconds())):new Date(new Date(l).setHours(23,59,59)),e>=new Date(u)&&this.currentView!=="day"&&(e=t[this._appointmentSettings.endTime]),this.model.showNextPrevMonth||this.currentView()!="month"||new Date(f.getFullYear(),f.getMonth(),1).getTime()==new Date(e.getFullYear(),e.getMonth(),1).getTime()||(e=new Date(f.getFullYear(),f.getMonth()+1,0,e.getHours(),e.getMinutes(),e.getSeconds())),appointment=this._addAppData(t,i,o,e,t.ParentId),this._processed.push(appointment),this._maxId=i=this._idChecking(),y=this.model.showWeekend?this.currentView()=="workweek"&&this._firstdayofweek==0?8-this.model.workWeek.length:1:this._getPrevNextDateCount(new Date(new Date(e).setHours(0,0,0,0)+864e5),"next")+1,f=new Date(new Date(e).getFullYear(),new Date(e).getMonth(),new Date(e).getDate()+y)},_deleteOcurrence:function(n,i){var u,o,e,f,h;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties();var s=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),c=(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n),r=new t.DataManager(this._currentAppointmentData).executeLocal(c);if((this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()&&(u=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,i)),u=u.length==0?this._objDate:u,u=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u[0].AppTaskId))),!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceRule])){if(o=r[0][this._appointmentSettings.recurrenceRule],s.recurrenceRuleSplit(o,r[0][this._appointmentSettings.recurrenceExDate]),t.isNullOrUndefined(s._rRule.exDate))(this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()?u[0][this._appointmentSettings.startTime].getDay()==u[0][this._appointmentSettings.endTime].getDay()?(i=u[0][this._appointmentSettings.startTime],r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()):(r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()):(r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString());else{for(e=o.split(";"),recurRule="",f=0;f<e.length;f++)recurRule!=""&&(recurRule+=";"),h=e[f].replace(/ /g,"").split("="),h[0]=="EXDATE"&&((this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()?u[0][this._appointmentSettings.startTime].getDay()==u[0][this._appointmentSettings.endTime].getDay()?(i=u[0][this._appointmentSettings.startTime],e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale)):e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale):e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale)),recurRule+=e[f];r[0][this._appointmentSettings.recurrenceRule]=recurRule;r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()}return r}},_getWeekIndex:function(n){var i=0,t=new Date(n.getFullYear(),n.getMonth(),1),r=n.getDay();if(r!=t.getDay())do t=new Date(t.setDate(t.getDate()+1));while(r!=t.getDay());while(t.getDate()!=n.getDate())t=new Date(t.setDate(t.getDate()+7)),i++;return i},_addAppData:function(i,r,u,f,e){var s={},o,c,h,l;for(o in this._appointmentSettings)if(o!="dataSource"&&o!="query"&&o!="tableName"&&o!="resourceFields"&&(s[this._appointmentSettings[o]]=i[this._appointmentSettings[o]]),o=="resourceFields"&&!t.isNullOrUndefined(this._appointmentSettings.resourceFields))for(c=this._appointmentSettings.resourceFields.split(","),h=0,l=c.length;h<l;h++)s[c[h]]=i[c[h]];return t.isNullOrUndefined(r)||(s.AppTaskId=r),t.isNullOrUndefined(u)||(s[this._appointmentSettings.startTime]=u),t.isNullOrUndefined(f)||(s[this._appointmentSettings.endTime]=f),t.isNullOrUndefined(e)||(s.ParentId=e),n.extend({},i,s)},_renderAppointments:function(){var r=n.extend(!0,[],this._dateRender),h,u,f,s,e,o,i;for(this._overflowFlag=!1,this._renderedApp=[],this._renderedAllDay=[],h=1,this.level=0,this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length)),this.cellwidth=this.element.find(".e-workcells").width(),this.cellheight=this.element.find(".e-workcells").outerHeight(),this.model.orientation=="vertical"&&this.model.showAllDayRow&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none")),this.alldaycellsheight=this.element.find(".e-alldaycells").height(),this._horiHeaderCollection=this._horiGroupCollection(),this.leftPosition=0,this._variable=[],this.model.group&&(this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length!=0)||(this.res1=["0"]),this.resIndex=0,this._processed=this._appointmentSort(this._processed),u=0;u<this.res1.length;u++){if(f=0,e=r.length,new Date(r[0])<this.model.minDate&&(f=Math.floor((new Date(this.model.minDate)-new Date(r[0]))/864e5)),new Date(r[r.length-1])>this.model.maxDate&&(s=Math.floor((new Date(r[r.length-1])-new Date(this.model.maxDate))/864e5),e=r.length-s),this._resWorkWeek)for(e=0,f=0,o=0,i=0;i<u+1;i++)if(t.isNullOrUndefined(this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(e+=this.model.workWeek.length,i==u&&(o+=this.model.workWeek.length)):(e+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,i==u&&(o+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length)),i==u){f=e-o;break}for(f;f<e;f++)this._getDayAppointments(f,u)}(this._overflowFlag||this._allDayDrag)&&this._reRenderScroller();this._overflowFlag=this._allDayDrag=!1},_appointmentRemove:function(n){this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment").filter("div[guid="+n.Guid+"]").remove();this.element.find(".e-categorybar").filter("div[id=categorybar_"+n.Guid+"]").remove()},_refreshDayAppointments:function(n){var r,y,e,a,o,p,h;if(this.model.timeScale.enable&&this.currentView()!="agenda"&&this.currentView()!="month"&&!this._isCustomMonthView()){this._overflowFlag=!1;var f=new Date(n[this._appointmentSettings.startTime]).setHours(0,0,0,0),i=this._tempResource.length>0&&this._grouping.length>0&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]]):0,u=this._dateRender.indexOf(f),v=0;if(this.model.orientation=="vertical"&&this._grouping.length>0)if(this._resWorkWeek){var s=0,u=0,c=0,l=0;for(r=0;r<i+1;r++)if(t.isNullOrUndefined(this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(s+=this.model.workWeek.length,r==i&&(c+=this.model.workWeek.length,l=this._resDateRen[i].indexOf(f))):(s+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,r==i&&(c+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,l=this._resDateRen[i].indexOf(f))),r==i){u=s-c;break}u=u+l}else v+=i*(this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:this.currentView()=="week"||this.currentView()=="week"||this._isCustomMonthView()?this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length);this.model.orientation=="horizontal"&&(y=this._grouping.length>1?this._resCollect.indexOf(this.res1[i]):i);this.model.orientation=="vertical"?this.element.find(".e-workcellstab tr td:nth-child("+(u+v+1)+")").find(".e-appointwrapper").remove():this.element.find(".e-workcellstab tr:nth("+y+")").find(".e-appointwrapper").remove();this.model.orientation=="vertical"?(e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(f).setHours(23,59,59))),e=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,h=new t.DataManager(this._renderedApp).executeLocal((new t.Query).where(e))):(a=this._appointmentCount(),this._grouping.length>0&&(o=this,p=a.filter(function(t){return t[o._appointmentSettings.resourceFields.toString().split(",")[o._tempResource.length-1].trim()]==n[o._appointmentSettings.resourceFields.toString().split(",")[o._tempResource.length-1].trim()]})),h=this._grouping.length>0?p:a);new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:h},"AppTaskId");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:h},"AppTaskId");var s=this.model.orientation=="vertical"?1:this._dateRender.length,w=this.model.orientation=="vertical"?u:0,b=0,w=this.model.orientation=="vertical"?u:0;this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length));this.cellwidth=this.element.find(".e-workcells").width();this.cellheight=this.element.find(".e-workcells").outerHeight();this.alldaycellsheight=t.isNullOrUndefined(this.alldaycellsheight)?this.element.find(".e-alldaycells").height():this.alldaycellsheight;this._horiHeaderCollection=this._horiGroupCollection();do this._getDayAppointments(w,i),b++,w++;while(b<s);this.model.orientation=="vertical"&&this.model.showAllDayRow&&this._renderAllDayAppointments();this._overflowFlag&&(this._reRenderScroller(),this._overflowFlag=!1);this.model.showAppointmentNavigator&&this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIconPosition()}else this.currentView()=="agenda"?this._renderAgendaContent():this._renderMonthAppointment();this._bindAppointmentAction()},_renderUpDownIcon:function(){if(this.element.find(".e-upicon, .e-downicon").length==0){var t=downIcon=upIconHtml=downIconHtml="",i=this.element.find(".e-hscroll").length==0?"0px":this.element.find(".e-hscroll").outerHeight()+"px";for(a=0;a<this.dateRender.length;a++)t=t+"<td class='upicon_"+a+"' style='width:100%;height:100%;'><span class='e-icon e-arrow-sans-up e-appup'><\/span><\/td>",downIcon=downIcon+"<td class='downicon_"+a+"' style='width:100%;height:100%;'><span class='e-icon e-arrow-sans-down e-appdown'><\/span><\/td>";upIconHtml="<tr class='e-upicon' style='pointer-events:none;top:0px;'>"+t+"<\/tr>";downIconHtml="<tr class='e-downicon' style='pointer-events:none;bottom:"+i+";'>"+downIcon+"<\/tr>";n(upIconHtml).insertBefore(this.element.find(".e-draggableworkarea").parent());n(downIconHtml).insertAfter(this.element.find(".e-draggableworkarea").parent());this.model.enableRTL&&this.element.find(".e-appup, .e-appdown").addClass("e-rtl");this.element.find(".e-upicon, .e-downicon").css({width:this.element.find(".e-workcellstab").width()});this.element.find(".e-appup, .e-appdown").css({pointerEvents:"visible"});this.element.find(".e-upicon, .e-downicon").children().css({float:this.model.enableRTL?"right":"left",visibility:"hidden",width:Math.floor(this.element.find(".e-workcellstab").width()/this.element.find(".e-upicon").children().length)})}},_renderUpDownIconPosition:function(){var e,v,n,y,i,p;if(this.element.find(".e-upicon, .e-downicon").children().css({visibility:"hidden"}),this.element.find(".e-vscroll").length>0){var r=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),s=t.isNullOrUndefined(r._scrollYdata)?this.element.height():r._scrollYdata.scrollable,h=r.scrollTop(),l=h>s?s:h,w=l+this.element.find(".e-draggableworkarea").height(),k=parseInt(l/this.element.find(".e-workcells").outerHeight())+1,d=parseInt(w/this.element.find(".e-workcells").outerHeight()),u=this.element.find(".e-upicon"),f=this.element.find(".e-downicon"),g=(this.model.startHour*60+k*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,nt=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4,tt=(this.model.startHour*60+d*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4+nt;for(this._currentViewAppointments=this._appointmentCount(),e=this,appointments=this._currentViewAppointments.filter(function(n){return(n[e._appointmentSettings.endTime]-n[e._appointmentSettings.startTime])/36e5<24}),a=0;a<this._dateRender.length;a++){var it=this.model.endHour<24?new Date(new Date(this._dateRender[a]).setHours(this.model.endHour,0,0)):new Date(new Date(this._dateRender[a]).setHours(23,59,59)),rt=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(this._dateRender[a]).setHours(this.model.startHour,0,0))).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(it)),o=new t.DataManager(appointments).executeLocal((new t.Query).where(rt));if(o.length!=0){if(v=new Date(new Date(this._dateRender[a]).setMilliseconds(g)),n=new t.DataManager(o).executeLocal((new t.Query).where(this._appointmentSettings.endTime,t.FilterOperators.lessThan,new Date(v))),n=this._appointmentSort(n).reverse(),!t.isNullOrUndefined(u)&&n.length!=0)if(this._grouping.length==0)u.children().eq(a).css({visibility:"visible"});else for(b=0;b<this.res1.length;b++)y=new t.DataManager(n).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[b].id)),y.length!=0&&u.children().eq(a+b*this._dateRender.length).css({visibility:"visible"});if(i=new t.DataManager(o).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.greaterThan,new Date(new Date(this._dateRender[a]).setMilliseconds(tt)))),i=this._appointmentSort(i),!t.isNullOrUndefined(f)&&i.length!=0)if(this._grouping.length==0)f.children().eq(a).css({visibility:"visible"});else for(c=0;c<this.res1.length;c++)p=new t.DataManager(i).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[c].id)),p.length!=0&&f.children().eq(a+c*this._dateRender.length).css({visibility:"visible"})}}}},_renderAppPosition:function(i){var w=n(i.target).hasClass("e-appup")?"e-appup":"e-appdown",r=n(i.target).parent().index(),c=this._appointmentCount(),e=this.element.find("div#"+this._id+"_scroller").data("ejScroller");switch(w){case"e-appup":var l=e.scrollTop(),o=parseInt(l/this.element.find(".e-workcells").outerHeight())+1,g=this.element.find(".e-draggableworkarea").find("tr").eq(o),u=(this.model.startHour*60+o*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,f=new Date(new Date(this.dateRender[r]).setMilliseconds(u)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(this.dateRender[r])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(f)),v=new t.DataManager(c).executeLocal((new t.Query).where(a));if(v.length!=0){var b=Math.abs(v[0][this._appointmentSettings.startTime]-f),y=parseInt((u-b)/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4)),p=l-(o-y)*this.element.find(".e-workcells").height();this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:p});this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})}break;case"e-appdown":var k=e.scrollTop()+n(this.element.find(".e-vscroll")[0]).height(),s=parseInt(k/this.element.find(".e-workcells").height()),nt=this.element.find(".e-draggableworkarea").find("tr").eq(s),u=(this.model.startHour*60+s*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,f=new Date(new Date(this.dateRender[r]).setMilliseconds(u)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(this.dateRender[r]).setHours(23,59,59))),h=new t.DataManager(c).executeLocal((new t.Query).where(a));if(h.length!=0){var d=f.getTime()-h[0][this._appointmentSettings.endTime].getTime(),y=parseInt((u-d)/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4)),p=e.scrollTop()+(y-s)*this.element.find(".e-workcells").height()+this.element.find("div#Appointment_"+h[0].AppTaskId).height();this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:p});this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})}}this._renderUpDownIconPosition();t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide")},_findAllDayApp:function(n){var i;if(!n[this._appointmentSettings.allDay])return i=n[this._appointmentSettings.recurrence]?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n[this._appointmentSettings.id])):new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,n.ParentId)),t.isNullOrUndefined(i[0])?!1:(i[0][this._appointmentSettings.endTime]-i[0][this._appointmentSettings.startTime])/36e5>=24?!0:!1},_getDayAppointments:function(n,i){var f=this._dateRender,r=this._currentViewAppointments=this._appointmentCount(),s=this.model.endHour<24?new Date(new Date(f[n]).setHours(this.model.endHour,0,0)):new Date(new Date(f[n]).setHours(23,59,59)),a=t.Predicate(this._appointmentSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(s)),v=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(s)),o=a.or(v),h,u,c,e,l;if(o=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):o,r=new t.DataManager(r).executeLocal((new t.Query).where(o)),h=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(f[n-1]).setHours(24,0,0))).or(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])),r=new t.DataManager(r).executeLocal((new t.Query).where(h)),this.model.orientation=="vertical")for(u=0;u<r.length;u++)c=(r[u][this._appointmentSettings.endTime]-r[u][this._appointmentSettings.startTime])/36e5>=24,e=r[u][this._appointmentSettings.allDay],e=t.isNullOrUndefined(e)||e==""?!1:e,new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()==new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&e||c?this._setAllDayPos(r[u],n,i):new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()==new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!e&&(this._findAllDayApp(r[u])?this._setAllDayPos(r[u],n,i):(l=this._renderedApp.filter(function(n){return n.Guid==r[u]}),l.length==0&&this._renderApp(r[u],n,i)));else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._getHorizontalDayAppointments(r,f,n,i)},_startUtc:function(n){!t.isNullOrUndefined(this.startutcValue)&&t.isNullOrUndefined(this.tempValue)?this._utcValue(n,"startUtc"):n.model.value==""?"":n.model.value==this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value")&&this._appointmentAddWindow.find("#"+this._id+"startTimeZone").attr("aria-expanded")=="true"?this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:n.text,value:n.value}):""},_endUtc:function(n){this._appointmentAddWindow.find("#"+this._id+"endTimeZone").attr("aria-expanded")=="true"?this._utcValue(n,"endUtc"):this.startutcValue=this.tempValue=null},_utcValue:function(n,i){var h,d,g,nt,l,a;t.preferredCulture(this.model.locale);i=="endUtc"?this._appointmentAddWindow.find(".endutc").val(n.text):"";var v={StartDate:this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("model.value"),EndDate:this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("model.value")},y={StartTime:this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("model.value"),EndTime:this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("model.value")},p=this._timeFormat(y.StartTime).split(":"),w=this._timeFormat(y.EndTime).split(":"),f=new Date(v.StartDate.setHours(parseInt(p[0],10),parseInt(p[1],10))),e=new Date(v.EndDate.setHours(parseInt(w[0],10),parseInt(w[1],10))),b=new Date(f),tt=new Date(e),u=i=="Appoint"?this.endTimeAppoint:i=="endUtc"?n.value:this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value"),r=i=="Appoint"?this.startTimeAppoint:i=="startUtc"?n.value:this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("model.value");if(r=r==""?this._timezoneStringValue():r,u=u==""?this._timezoneStringValue():u,u=u.indexOf("UTC")!=-1?parseInt(u.split(" ")[1].split(":")[0])*60+parseInt(u.split(" ")[1].split(":")[1]):parseInt(u.split(":")[0])*60+parseInt(u.split(":")[1]),r=r.indexOf("UTC")!=-1?parseInt(r.split(" ")[1].split(":")[0])*60+parseInt(r.split(" ")[1].split(":")[1]):parseInt(r.split(":")[0])*60+parseInt(r.split(":")[1]),h=u-r,f=new Date(f.setMinutes(f.getMinutes()+h)),i=="Appoint"){var k=new Date(n[this._appointmentSettings.startTime]),s=new Date(n[this._appointmentSettings.endTime]),c=t.isNullOrUndefined(this.model.timeZone)?-(new Date).getTimezoneOffset()+this._timeZoneOffset:this.model.timeZone.indexOf("UTC")!=-1?parseInt(this.model.timeZone.split(" ")[1].split(":")[0])*60+parseInt(this.model.timeZone.split(" ")[1].split(":")[1]):parseInt(this.model.timeZone.split(":")[0])*60+parseInt(this.model.timeZone.split(":")[1]),o=r==c?0:c-r;o=new Date(k.setMinutes(k.getMinutes()-o));d=this._timeMode=="12"?t.format(new Date(o),this._pattern.t,this.model.locale):t.format(new Date(o),"HH:mm",this.model.locale);this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker({value:t.format(new Date(o),this._datepattern(),this.model.locale)});g=u-c;this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:d})}e=i=="endUtc"||i=="Appoint"?new Date(b.setMinutes(b.getMinutes()+h)):f;e=i=="Appoint"?new Date(s.setMinutes(s.getMinutes()+g)):e;nt=this._timeMode=="12"?t.format(new Date(f),this._pattern.t,this.model.locale):t.format(new Date(f),"HH:mm",this.model.locale);i=="Appoint"?a=this._timeMode=="12"?t.format(new Date(s),this._pattern.t,this.model.locale):t.format(new Date(s),"HH:mm",this.model.locale):(l=new Date(e.setMinutes(e.getMinutes()+30)),a=this._timeMode=="12"?t.format(new Date(l),this._pattern.t,this.model.locale):t.format(new Date(l),"HH:mm",this.model.locale));this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker({value:t.format(new Date(e),this._datepattern(),this.model.locale)});this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:a});this.startutcValue=1},_rowHandlesOver:function(t){this.model.enableAppointmentResize&&n(t.target).addClass("e-rowcursor")},_colHandlesOver:function(t){this.model.enableAppointmentResize&&n(t.target).addClass("e-columncursor")},_getDateCount:function(n){var u,i,r,f;if(this._resWorkWeek)for(f=[],i=t.isNullOrUndefined(this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],i=this._resourceDaysReorder(i),r=0;r<i.length;r++)u=this._dayFullNames.indexOf(i[r].capitalizeFirstString()),u==-1&&(u=this._getDayNameIndex(i[r])),f.push(this._renderDates[u]);else f=this._dateRender;return f},_renderApp:function(i,r,u){var k=this.cellheight,y=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.startHour):0,p=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.endHour):24,d=this._getDateCount(u),f=new Date(i[this._appointmentSettings.startTime]),s=new Date(i[this._appointmentSettings.endTime]),c,w,nt,tt,ut,st,ht,g,a,ct,h,o,v,lt,at,e,vt,it,yt,rt,pt;if(f=new Date(f).getHours()<y?new Date(new Date(f).setHours(y,f.getMinutes(),f.getSeconds())):f,this.model.orientation=="vertical"){if(h=-1,f<=s&&new Date(d[0]).getTime()<=f.getTime()&&new Date(new Date(d[d.length-1]).setHours(23,59,59))>=f.getTime()&&(nt=new Date(f).getHours()<y?new Date(f).getHours()+-new Date(f).getHours()+-new Date(f).getMinutes():new Date(f).getHours()+-y,tt=new Date(s).getHours()>p?new Date(s).getHours()+(-new Date(s).getHours()+(p-y))+-new Date(s).getMinutes():new Date(s).getHours()+-y,tt=new Date(s).getHours()==p?new Date(tt).getMinutes()+-new Date(s).getMinutes():tt,p<=s.getHours()?(ut=new Date(s.setHours(p,00,00)),w=parseFloat(new Date(ut).getHours()*60+new Date(ut).getMinutes()-(new Date(f).getHours()*60+new Date(f).getMinutes()))*k*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-2):(w=parseFloat(new Date(new Date(s).getTime())-new Date(new Date(f).getTime()))/6e4*k*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-2,w=i[this._appointmentSettings.endTime].getTimezoneOffset()-i[this._appointmentSettings.startTime].getTimezoneOffset()!=0?w-k*this.model.timeScale.minorSlotCount:w),st=(parseFloat(new Date(f).getHours()*60+new Date(f).getMinutes()+new Date(f).getSeconds()/60)-parseInt(nt*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-this.model.startHour*60)*k*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),this.model.startHour<=new Date(f).getHours())){if(ht=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.id]:null,g=this._overlapApp(i.AppTaskId,i[this._appointmentSettings.startTime],i[this._appointmentSettings.endTime],ht),o=this,a=this._grouping.length>0&&this._tempResource.length>0&&this._tempResource[0].resourceSettings.dataSource.length>0&&t.scheduleFeatures.resources?g.filter(function(n){return n[o._appointmentSettings.endTime]>i[o._appointmentSettings.startTime]&&n[o._appointmentSettings.startTime]<i[o._appointmentSettings.endTime]&&n[o._appointmentSettings.resourceFields.toString().split(",")[o._tempResource.length-1].trim()]==o.res1[u][o._tempResource[o._tempResource.length-1].resourceSettings.id]}):g.filter(function(n){return n[o._appointmentSettings.endTime]>i[o._appointmentSettings.startTime]&&n[o._appointmentSettings.startTime]<i[o._appointmentSettings.endTime]}),a.length>0){for(this._variable=[],v=0,lt=a.length;v<lt;v++)t.isNullOrUndefined(this._variable[a[v].Index])?this._variable[a[v].Index]=[a[v]]:this._variable[a[v].Index].push(a[v]);ct=n.map(a,function(n){return[n.Index]});h=this._smallestMissingNumber(ct)}for(h=h==-1?0:h,i.Index=h,g.push(i),g.length!=1?t.isNullOrUndefined(this._variable[h])?this._variable[h]=[i]:this._variable[h].push(i):(this._variable=[],this._variable.push([i])),c=(90-this._variable.length)/this._variable.length+"%",this.leftPosition="0%",at=this._resWorkWeek?0:this._dateRender.length*u,e=0,vt=this._variable.length;e<vt;e++)if(!t.isNullOrUndefined(this._variable[e]))for(it=0,yt=this._variable[e].length;it<yt;it++){var ft=this.element.find(".e-workcellstab tr td:nth-child("+(at+r+1)+")").find(".e-appointwrapper").find(".e-appointment"),rt=this._variable[e][it].Guid,l=ft.filter("div[guid="+rt+"]");t.isNullOrUndefined(l[0])||rt==i.Guid?(c=t.isNullOrUndefined(this._variable[e-1])?(90-this._variable.length)/this._variable.length:!t.isNullOrUndefined(this.element.find("[guid="+this._variable[e-1][0].Guid+"]")[0])&&parseFloat(ft.filter("div[guid="+this._variable[e-1][0].Guid+"]")[0].style.width),this.leftPosition=(c+1)*h+"%"):parseFloat(c)<=parseFloat(l[0].style.width)?(this.model.enableRTL?l[0].style.right=(parseFloat(c)+1)*e+"%":l[0].style.left=(parseFloat(c)+1)*e+"%",l[0].style.width=parseFloat(c)+"%"):(rt=this._variable[t.isNullOrUndefined(this._variable[e-1])?e:e-1][0].Guid,pt=ft.filter("div[guid="+rt+"]"),l[0].style.width=pt[0].style.width,this.model.enableRTL?l[0].style.right=(parseFloat(l[0].style.width)+1)*e+"%":l[0].style.left=(parseFloat(l[0].style.width)+1)*e+"%")}c=parseFloat(c)+"%";this._renderedApp.push(n.extend(!0,{},i));var b=this._appointmentColor(i),wt=this.model.appointmentTemplateId?!0:!1,kt=wt?this._getUserAppointmentTemplate(i):"",dt=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale),ni=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,bt=this._indicationApp(i),et=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:w,rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!b.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:this.leftPosition,top:st,appWidth:c,userAppTemplId:wt,userTemplate:kt,appClass:"e-appointment",appointData:b.appointColor.appointData,appointCustomcss:b.appointColor.appointCustomcss,appointtextcolor:b.appointColor.appointtextcolor,value:b.value,multiDiv:b.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:ni,topInd:bt.leftIndication,bottomInd:bt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),h=this._resWorkWeek?nt*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r:parseInt(nt*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*d.length*this.res1.length+r+d.length*u,ot=this.element.find("td.e-workcells").eq(h);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,et);ot.find("div.e-appointwrapper").length>0?ot.find("div.e-appointwrapper").append(et):ot.prepend(n("<div class='e-appointwrapper'><\/div>").append(et))}}else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._renderHorizontalApp(f,s,i,r,k,this.model.timeScale.minorSlotCount,y,p);delete i.Index},_priorityTemplate:function(n){return this.model.prioritySettings.template.replace("{","").replace("$","").replace("}","").replace(this.model.prioritySettings.template.indexOf("value")!=-1?this.model.prioritySettings.value:this.model.prioritySettings.text,n[this._appointmentSettings.priority])},_getUserAppointmentTemplate:function(t){var r=n.templates(n(this.model.appointmentTemplateId).html()),i=n.extend(i,t);return i.View=this.currentView(),r.render(i)},_getUserTimeCellsTemplate:function(){for(var t,f=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),r,u=[],i=this.model.startHour;i<this.model.endHour;){for(t=0;t<60;)t=t*6e4,r=f.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,t))}),u.push({time:r.trim(),id:i+"_"+t}),t=t/6e4+this.model.timeScale.majorSlot;i=this.model.timeScale.majorSlot>60?i+this.model.timeScale.majorSlot/60:i+1}return u},_getUserAllDayCellsTemplate:function(){var t=[],i,r,u;for(r=n.templates(n(this.model.allDayCellsTemplateId).html()),a=0;a<this.res1.length;a++)for(b=0;b<this._dateRender.length;b++)i=new Date(new Date(this._dateRender[b]).setHours(this.model.startHour,0,0)),u=r.render(object={date:i,view:this.currentView(),resource:this.res1[a],timescale:this.model.timeScale.enable}),t.push(u.trim());return t},_getUserDateheaderTemplate:function(){var r=[],u,f,e,o,s;for(u=n.templates(n(this.model.dateHeaderTemplateId).html()),i=0;i<this._dateRender.length;i++)f=u.render(object={date:new Date(this._dateRender[i])}),e=this.currentView()==="month"||this.currentView()==="day"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],o=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday":"",s=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:e,currentDateClass:"",cellToday:""}:{currentDay:f,currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:o},r.push(s),this._value.push(i);return r},_getUserWorkCellsTemplate:function(){var i,t=[],e=[],f,u,r=0,s=this.model.timeScale.minorSlotCount,h,k,g,p;if(f=n.templates(n(this.model.workCellsTemplateId).html()),this._isCustomMonthView(),this.model.orientation=="vertical")if(this.currentView()=="month"||this._isCustomMonthView())for(h=0,a=0;a<this._dateRender.length/7;a++){for(t=[],b=0;b<this.res1.length;b++)for(h=a*7,c=0;c<7;c++)i=new Date(new Date(this._dateRender[h]).setHours(this.model.startHour,r,0)),u=f.render(object={date:i,view:this.currentView(),resource:this.res1[b],timescale:this.model.timeScale.enable}),t.push(u.trim()),h++;e.push(t)}else for(a=0;a<(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);a++){for(t=[],b=0;b<this.res1.length;b++)for(c=0;c<this._dateRender.length;c++)i=new Date(new Date(this._dateRender[c]).setHours(this.model.startHour,r,0)),u=f.render(object={date:i,view:this.currentView(),resource:this.res1[b],timescale:this.model.timeScale.enable}),t.push(u.trim());r=r+this.model.timeScale.majorSlot/s;e.push(t)}else{var w,l=[],v=[],y=[],o=this._tempResource.length==0?this.res1:this._resourceSort();if(this.model.timeScale.enable&&this.currentView()!="month"&&!this._isCustomMonthView())for(a=0;a<o.length;a++){for(t=[],v=[],y=[],b=0;b<this._dateRender.length;b++)for(r=0,c=0;c<(this.model.endHour-this.model.startHour)*(60/this.model.timeScale.majorSlot);c++)for(d=0;d<s;d++)i=new Date(new Date(this._dateRender[b]).setHours(this.model.startHour,r,0)),d==0?(u=f.render(object={date:i,view:this.currentView(),resource:o[a],timescale:this.model.timeScale.enable}),t.push(u.trim())):(w=f.render(object={date:i,view:this.currentView(),resource:o[a],timescale:this.model.timeScale.enable}),l.push(w.trim()),l.length==s-1&&(y.push(l),l=[])),r=r+this.model.timeScale.majorSlot/s;k=n.extend(!0,[],t);g=n.extend(!0,[],y);v.push(k,g);e.push(v)}else for(p=!this.model.timeScale.enable&&this.currentView()!="month"||this.currentView()=="customview"&&this._oneWeek?this._dateRender:this.monthDays,a=0;a<o.length;a++){for(t=[],b=0;b<p.length;b++)i=new Date(new Date(p[b]).setHours(this.model.startHour,r,0)),u=f.render(object={date:i,view:this.currentView(),resource:o[a],timescale:this.model.timeScale.enable}),t.push(u.trim());e.push(t)}}return e},_overlapApp:function(i,r,u,f){var o=this._renderedApp,h=[],c=[],a=[],l=[],e,s;if(this.model.orientation=="vertical")e=this,h=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.filter(function(n){return n[e._appointmentSettings.endTime]>r&&n[e._appointmentSettings.startTime]<u&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==f}):o.filter(function(n){return n[e._appointmentSettings.endTime]>r&&n[e._appointmentSettings.startTime]<u}),h.forEach(function(i){a=!t.isNullOrUndefined(e.model.group)&&e._tempResource.length!=0&&e._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(i[e._appointmentSettings.startTime])&&n[e._appointmentSettings.startTime]<=new Date(i[e._appointmentSettings.endTime])&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==f}):o.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(i[e._appointmentSettings.startTime])&&n[e._appointmentSettings.startTime]<=new Date(i[e._appointmentSettings.endTime])});var r=n(a).not(h);return r.length!=0&&(c=n.merge(c,r)),c}),l=n.merge(h,c);else if(this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal)for(s=0;s<o.length;s++)t.scheduleFeatures.resources&&this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)?new Date(o[s][this._appointmentSettings.endTime])>new Date(r)&&new Date(o[s][this._appointmentSettings.startTime])<=new Date(u)&&o[s][this._tempResource[this._tempResource.length-1].field]==f&&new Date(new Date(o[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(r).setHours(0,0,0,0)).getTime()&&l.push(o[s]):new Date(o[s][this._appointmentSettings.endTime])>new Date(r)&&new Date(o[s][this._appointmentSettings.startTime])<=new Date(u)&&new Date(new Date(o[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(r).setHours(0,0,0,0)).getTime()&&l.push(o[s]);return l},_getOverlapCount:function(i,r,u,f){var e,s,c,h,a,v,y,o,l;if(this._renderedAllDay.length==0)i.Index=0,o=0;else{if(l=[],e=this,s=this.model.orientation=="horizontal"&&t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?this._renderedAllDay.filter(function(n){return(n[e._appointmentSettings.endTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))||n[e._appointmentSettings.startTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59)))&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==i[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]}):this._renderedAllDay.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))||n[e._appointmentSettings.startTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))}),c=[],this.model.orientation=="vertical")for(h=0,a=s.length;h<a;h++)v=(s[h][this._appointmentSettings.endTime]-s[h][this._appointmentSettings.startTime])/36e5>=24,y=s[h][this._appointmentSettings.allDay],(new Date(new Date(u[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(s[h][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&y||v)&&(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)?s[h][this._tempResource[this._tempResource.length-1].field]==f:!0)&&c.push(s[h]);else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(c=this._getHorizontalOverlapCount(s,u,r,i,f));o=-1;o=this._findResourceIndex(c,"AppTaskId",i.AppTaskId);l=n.map(c,function(n){return[n.Index]});o=this._smallestMissingNumber(l);i.Index=o;o=o==-1?0:o}return o},_smallestMissingNumber:function(n){var i,t;if(n.length==0)return 0;for(i=Math.max.apply(Math,n),t=0;t<i;t++)if(n.indexOf(t)==-1)return t;return i+1},_setAllDayPos:function(i,r,u){var o=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._getOverlapCount(i,r,this._dateRender,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getOverlapCount(i,r,this._dateRender,null),e=new Date(i[this._appointmentSettings.startTime]),f=new Date(i[this._appointmentSettings.endTime]),ut,p,k,l,ot,d,a,h,v,it;if(new Date(e)<=new Date(f)){var s=this._dateRender,rt,w=0,b=appHeight=this.element.find(".e-alldayappointment").length>0?this.element.find(".e-alldayappointment").outerHeight(!0):this._getElementHeight("e-alldayappointment");if(this.level<=o&&(ut=(o+1)*appHeight+this.alldaycellsheight,this.element.find(".e-alldaycells,.e-leftindent").removeClass("e-alldaycellsheight").css("height",ut+"px"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this.element.find(".e-vscroll").length==0&&this.level==0&&this._reRenderScroller()),this._overflowFlag=!0,this._resWorkWeek){for(k=[],p=t.isNullOrUndefined(this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],l=0;l<p.length;l++)h=this._dayFullNames.indexOf(p[l].capitalizeFirstString()),h==-1&&(h=this._getDayNameIndex(p[l])),k.push(this._renderDates[h]);s=k}if(ot=new Date(s[0]),d=new Date(new Date(s[s.length-1]).setHours(23,59,59)),f=new Date(f)>new Date(d)?d:f,(this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend)&&n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender)==-1)for(a=1;a<this._dateRender.length;a++)if(n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()-a).getTime(),this._dateRender)>0){h=n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()-a).getTime(),this._dateRender);f=new Date(new Date(this._dateRender[h]).setHours(i[this._appointmentSettings.endTime].getHours(),i[this._appointmentSettings.endTime].getMinutes(),i[this._appointmentSettings.endTime].getSeconds()));break}this._renderedAllDay.push(n.extend(!0,{},i));v=this._resWorkWeek||this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend?n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),s)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),s)+1:this.currentView()=="week"||this.currentView()=="day"||this.currentView()=="customview"&&parseFloat((f-e)/36e5)<=24?f.getHours()==0&&f.getMinutes()==0?Math.ceil((new Date(f)-new Date(e))/864e5):Math.ceil((new Date(f).setHours(23,59,59)-new Date(e).setHours(0,0,0))/864e5):n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),this._dateRender)+1;v<=0&&(v=1);var st=this.element.find(".e-alldaycells").width(),g=this._dateRender.length,nt=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._grouping.length:0,tt=this.currentView()==="day"?0:this._dateRender.indexOf(new Date(e).setHours(0,0,0));this._resWorkWeek?w=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[r].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[r].offsetLeft:t.isNullOrUndefined(this.element.find(".e-alldaycells")[tt+u*g])||(w=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[tt+u*g].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[tt+u*g].offsetLeft);rt=v*st+v-2;b=o*b+(o+1)+this.element.find(".e-headercells").outerHeight()+(nt!=0?nt*this.element.find(".e-headerbar").first().height():nt);var c=this._appointmentColor(i),ft=this.model.appointmentTemplateId?!0:!1,ht=ft?this._getUserAppointmentTemplate(i):"",ct=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),lt=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale),at=i[this._appointmentSettings.recurrence]?i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1:!1,y=this._indicationApp(i),et=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),top:b,rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!c.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:ct,endTime:lt,appHeight:this.model.appointmentTemplateId?appHeight:"",appWidth:rt+"px",allday:!0,left:w+"px",userAppTemplId:ft,userTemplate:ht,appClass:"e-alldayappointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:at,leftInd:y.leftIndication,rightInd:y.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,et);this.element.find(".e-headrealldaytable").append(et)}this._alldayLevel=!1;this.level=this.level<o?o:this.level;i[this._appointmentSettings.recurrence]!=1&&(it=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId)),new Date(i[this._appointmentSettings.endTime])<it[0][this._appointmentSettings.endTime]&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").children(".e-lefthandle").remove():this.element.find("[guid="+i.Guid+"]").children(".e-righthandle").remove()),new Date(i[this._appointmentSettings.startTime])>it[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").children(".e-righthandle").remove():this.element.find("[guid="+i.Guid+"]").children(".e-lefthandle").remove()));t.isNullOrUndefined(y)||(y.leftIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),y.rightIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")));delete i.Index},_indicationApp:function(i){var u=!1,f=!1,r=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId))[0],s,h,c,e,l,o;return t.isNullOrUndefined(r)?{leftIndication:!1,rightIndication:!1}:(r[this._appointmentSettings.endTime].getHours()==0&&r[this._appointmentSettings.endTime].getMinutes()==0&&(r=n.extend(!0,[],r),r[this._appointmentSettings.endTime]=new Date(r[this._appointmentSettings.endTime].getTime()-1e3)),c=this.currentView()=="day"?[new Date(this._dateRender[0]).getTime()]:this._dateRender,e=this.currentView()=="month"&&new Date(new Date(r[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(r[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5<24,s=n.inArray(new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime(),c),h=n.inArray(new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime(),c),i[this._appointmentSettings.recurrence]?(l=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid)),l.length>1&&(o=this._sortAppById(l),(o[0][this._appointmentSettings.startTime]<i[this._appointmentSettings.startTime]||s==-1)&&!e&&(this.model.enableRTL?f=!0:u=!0),(o[o.length-1][this._appointmentSettings.endTime]>i[this._appointmentSettings.endTime]||h==-1)&&!e&&(this.model.enableRTL?u=!0:f=!0))):((new Date(r[this._appointmentSettings.startTime])<i[this._appointmentSettings.startTime]||s==-1)&&!e&&(this.model.enableRTL?f=!0:u=!0),(new Date(r[this._appointmentSettings.endTime])>i[this._appointmentSettings.endTime]||h==-1)&&!e&&(this.model.enableRTL?u=!0:f=!0)),{leftIndication:t.isNullOrUndefined(u)?!1:u,rightIndication:t.isNullOrUndefined(f)?!1:f})},_reRenderScroller:function(){var i,u,e;t.isNullOrUndefined(this._appointmentAddWindow)||(i=this._appointmentAddWindow.data("ejDialog"),i.option("enableAnimation",!1),i.close());var n=this.element.find("div#"+this._id+"_scroller"),r=n.data("ejScroller"),f=this.model.orientation==="vertical"?parseInt(this.element.width())-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?parseInt(this.element.width())-parseInt(this.element.find(".e-resourceheadertable").width()):parseInt(this.element.width());r.model.width=parseInt(f)-2;r.model.height=this.scHeight-1-(this.wTR.find(".e-draggableworkarea").offset().top-this.element.offset().top);r.refresh();this.model.cellWidth!=""&&(u=(parseInt(this.model.cellWidth)+1)*this.element.find("div.e-draggableworkarea tr:first td").length,e=this.wTR.find(".e-scrolltimecells").length>0?this.wTR.find(".e-scrolltimecells").width():0,this.wTR.find(".e-draggableworkarea").width(this.element.width()>u+e+(n.ejScroller("isVScroll")?18:0)?u-1:f-2-(n.ejScroller("isVScroll")?18:0)),this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width()));this.model.orientation!="vertical"||this.model.cellHeight||this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable||this.element.find(".e-draggableworkarea").height(r.model.height-(n.ejScroller("isHScroll")?18:0));this.model.orientation=="vertical"&&this._mediaQuery&&this.res1.length>1&&this.element.find(".e-draggableworkarea").width(this.element.find(".e-draggableworkarea").width()*this.res1.length);this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width());this.wTR.find(".e-scrolltimecells").css("top",-this.wTR.find(".e-draggableworkarea").scrollTop()+"px");this._mediaQuery&&!t.isNullOrUndefined(this._appointmentAddWindow)&&this._appointmentAddWindow.ejDialog("close");t.isNullOrUndefined(this._appointmentAddWindow)||i.option("enableAnimation",!0);(this.model.orientation=="horizontal"&&n.ejScroller("isVScroll")||this._mediaQuery)&&this._renderHoriVerticalScroll();this._showScrollTd()},_appointmentSort:function(n){var t=this;return this.currentView()=="agenda"?n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime],f=n[t._appointmentSettings.endTime],e=i[t._appointmentSettings.endTime];return r.getTime()-u.getTime()||f.getTime()-e.getTime()}):this.currentView()!="day"?n.sort(function(n,i){var o=n[t._appointmentSettings.endTime]-n[t._appointmentSettings.startTime],s=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime],f=new Date(n[t._appointmentSettings.startTime]),e=new Date(i[t._appointmentSettings.startTime]),h=new Date(n[t._appointmentSettings.endTime]),c=new Date(i[t._appointmentSettings.endTime]),r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime];return f==e&&h==c?r-u||n.Guid.localeCompare(i.Guid):f-e==0?s-o||r-u||n.Guid.localeCompare(i.Guid):r-u||n.Guid.localeCompare(i.Guid)}):n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime],f=n[t._appointmentSettings.endTime]-n[t._appointmentSettings.startTime],e=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime];return r-u||e-f||n.Guid.localeCompare(i.Guid)}),n},_alldaySort:function(n){for(var i=[],t=0;t<n.length;t++)(new Date(n[t][this._appointmentSettings.endTime])-new Date(n[t][this._appointmentSettings.startTime]))/36e5<24&&!n[t][this._appointmentSettings.allDay]&&i.push(n[t]);return i},_appointmentRecurrenceSort:function(n){var t=this;return n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime];return r-u}),n},_renderMonthAppointment:function(){var f,r,o,s,c,u,l;this._overflowFlag=!1;this.filterData=[];this._renderedApp=[];this.element.find(".e-appointwrapper").remove();this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length));var n=this.model.orientation=="vertical"?this.currentView()=="month"&&!this.model.showNextPrevMonth?this.monthDays:this._dateRender:this.monthDays,i=this._currentViewAppointments=this._appointmentCount(),e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(n[0])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(n[n.length-1]).setHours(23,59,59))),h=new t.DataManager(i).executeLocal((new t.Query).where(e));for(i=h,n=this.model.orientation=="vertical"?this._dateRender:this.monthDays,this.model.group&&(this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length!=0)||(this.res1=["0"]),f=0;f<this.res1.length;f++)for(r=0,o=n.length,new Date(n[0])<this.model.minDate&&(r=Math.floor((new Date(this.model.minDate)-new Date(n[0]))/864e5)),new Date(n[n.length-1])>this.model.maxDate&&(o=n.length-Math.floor((new Date(n[n.length-1])-new Date(this.model.maxDate))/864e5)),r;r<o;r++)for(s=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(n[r])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(n[r]).setHours(23,59,59))),s=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[f][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,i=new t.DataManager(h).executeLocal((new t.Query).where(s)),c=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(n[r])),i=new t.DataManager(i).executeLocal((new t.Query).where(c)),u=0;u<i.length;u++)l=this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?new t.DataManager(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,i[u][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])):this.res1,l.length!=0&&new Date(new Date(n[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(i[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&this._renderAppointmentMonth(i[u],r,f);this._overflowFlag&&(this._reRenderScroller(),this._overflowFlag=!1);this.model.showAppointmentNavigator&&this._nextPrevButton()},_wireResizeEvents:function(){if(this.model.enableAppointmentResize&&!this.model.readOnly){this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").on("mousedown",n.proxy(this._appointmentResizeStart,this));this._on(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",n.proxy(this._colHandlesOver,this));this._on(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",n.proxy(this._rowHandlesOver,this))}},_unWireResizeEvents:function(){this.model.enableAppointmentResize&&(this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").off("mousedown",n.proxy(this._appointmentResizeStart,this)),this._off(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",n.proxy(this._colHandlesOver,this)),this._off(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",n.proxy(this._rowHandlesOver,this)))},_recuCollectionIndex:function(n,t){for(var r,u=this._appointmentSettings,i=0;i<n.length;i++)if(n[i].Guid==t.Guid&&n[i].AppTaskId==t.AppTaskId){r=i;break}return r},_getIndex:function(i,r,u,f,e){var h,o,v,s,a;if(this._renderedApp.length==0)r.Index=0,s=0;else{var a=[],c=this,y=u.length,l=[];for(h=this.model.orientation=="horizontal"&&t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?f.filter(function(n){return n[c._appointmentSettings.resourceFields.toString().split(",")[c._tempResource.length-1].trim()]==r[c._appointmentSettings.resourceFields.toString().split(",")[c._tempResource.length-1].trim()]}):f,o=0,v=h.length;o<v;o++)(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?h[o][this._tempResource[this._tempResource.length-1].field]==e:!0)&&new Date(new Date(h[o][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(h[o][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(u[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(h[o][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(h[o][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&l.push(h[o]);s=-1;l.length>0&&(a=n.map(l,function(n){return[n.Index]}),s=this._smallestMissingNumber(a));s=s==-1?0:s;r.Index=s}return s},_recurrenceLocal:function(){var r=t.RecurrenceEditor.Locale[this.model.locale]=n.extend(!0,{},t.RecurrenceEditor.Locale["en-US"]),i=this;n.each(r,function(n){t.RecurrenceEditor.Locale[i.model.locale][n]=i._getLocalizedLabels(n)})},_minMaxIndex:function(){var t=n.unique(this._dateRender.map(function(n){return new Date(n).getDay()})),i=Math.min.apply(Math,t),r=Math.max.apply(Math,t);return{minIndex:i,maxIndex:r}},_renderAppointmentMonth:function(i,r,u){var it=this.model.orientation=="vertical"?this._dateRender:this.monthDays,rt=this.model.orientation=="vertical"?"td.e-monthcells":"td.e-workcells",wt=this._renderedApp,y=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._getIndex(r,i,it,wt,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getIndex(r,i,it,wt,null),k=new Date(i[this._appointmentSettings.startTime]),bt=new Date(i[this._appointmentSettings.endTime]),s,v=0,ut=new Date(k),g=new Date(bt),kt=new Date(new Date(it[it.length-1]).setHours(23,59,59)),nt,d,f,ct,ot,c,o,ri,ui,ht,pt;g=g>kt?kt:g;this.leftPosition=0;this.CellWidth=this.model.orientation=="vertical"?this.element.find(".e-monthcells").width():this.element.find(".e-workcells").width();this.CellHeight=this.model.orientation=="vertical"?this.element.find(".e-monthcells").height():this.element.find(".e-workcells").height();this._renderedApp.push(n.extend(!0,{},i));var p=this.model.showWeekend?ut.getHours()==0&&g.getHours()==0?Math.ceil((new Date(g)-new Date(ut))/864e5):Math.ceil((new Date(g).setHours(23,59,59)-new Date(ut).setHours(0,0,0))/864e5):this._getTotalDays(ut,g),l=this.model.showWeekend?7:this._minMaxIndex().maxIndex+1,dt=!this.model.timeScale.enable&&this._oneWeek?l-it.indexOf(ut.getTime()):l-new Date(ut).getDay()+this._firstdayofweek;if(k.getTime()<=bt.getTime()){if(this.model.orientation=="vertical"?(p=p>=dt?dt:p,nt=Math.ceil((r+1)/(this.model.showWeekend?l:this.model.workWeek.length)),s=p*this.CellWidth-this.CellWidth/20):s=!this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()?this.model.cellWidth!=""?p*this.CellWidth+p:p*this.CellWidth:this.CellWidth*p-parseInt(this.CellWidth/10),d=this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):0,f=this.model.showWeekend?this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this.model.orientation=="vertical"?this.currentView()=="day"?d+1:this.currentView()=="workweek"||this._isCustomMonthView()&&this._oneWeek?d*this._dateRender.length+(r+1):this.currentView()=="workweek"?d*this._dateRender.length+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*this._dateRender.length:this._firstdayofweek==0?d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l:this.model.orientation=="vertical"&&this._firstdayofweek!=0?d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l-this._firstdayofweek:r+1:r+1:this.model.orientation=="vertical"&&this._isCustomMonthView()&&!this._oneWeek?d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l:r+1:this.model.orientation=="vertical"?(nt-1)*this.res1.length*this.model.workWeek.length+u*this.model.workWeek.length+r%this.model.workWeek.length+1:r+1,this.model.orientation=="vertical"&&this._firstdayofweek!=0&&new Date(k).getDay()<this._firstdayofweek&&(f=d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l-this._firstdayofweek+l),this.model.orientation=="horizontal"&&this.model.cellWidth==""&&p>1&&!this.model.enableRTL){var fi=this.element.find(".e-workcellstab tr:first").children().eq(f-1).offset().left,gt=this.element.find(".e-workcellstab tr:first").children().eq(f-2+p),ei=gt.offset().left+gt.width();s=ei-fi}var oi=s-1,ft=this.model.appointmentTemplateId?!0:!1,w=ft?this._getUserAppointmentTemplate(i):"",et=this.element.find(".e-monthheader").length!=0?this.element.find(".e-monthheader").height():0,h=this.model.appointmentTemplateId?n(w).css("height")=="100%"?this.model.showOverflowButton?this.CellHeight-et-15:this.initialCellHeight:n(w).css("height")=="0px"?this.element.find(".e-monthappointment").height():n(w).height():this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):this._getElementHeight("e-monthappointment");s=this.model.appointmentTemplateId?n(w).css("width")=="100%"||n(w).css("width")=="0px"?s:n(w).width():s;v=y*h;this.leftPosition=0;this._tempResource.length!=0&&(ct=this._resCollection,ot=this._horiGroupCollection());c=this.model.orientation=="vertical"?!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(ct[0].dataSource,ct[0].id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:0:!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(ot,this._tempResource[this._tempResource.length-2].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:0;var b=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()])+1:1,e=this._appointmentColor(i),si=this.element.find(".e-monthappointment").length!=0?this.element.find(".e-monthappointment").outerWidth(!0)-this.element.find(".e-monthappointment").width():0,ni=parseInt(this.CellWidth/(this.CellWidth<=s?this.CellWidth:s+si)),hi=parseInt((this.CellHeight-et-10)/(this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):h));this.CellHeight=this.model.orientation=="horizontal"?this.element.find(".e-workcellstab tr").eq(b+c-1).find(".e-workcells").height():this.element.find("td.e-monthcells").eq(f-1).parent().children().outerHeight();var tt=this._indicationApp(i),lt=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),at=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale);if(this.model.showOverflowButton&&ft&&n(w).css("height")!="0px"&&this.model.orientation!="horizontal"?y+1<=ni*hi:this.CellHeight>et+(y+1)*h+10){ft&&s<oi&&this.element.find(".e-appointwrapper").eq(f-1).attr("style","height:"+(parseInt(y/ni)+1)*h+"px !important;width:"+this.CellWidth+"px !important;position:absolute !important;");v>1&&(v=y*h);this.leftPosition=this.leftPosition>1?this.leftPosition-1:this.leftPosition;var vt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,a=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!e.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:lt,endTime:at,left:this.leftPosition+"px",top:v,appHeight:this.model.appointmentTemplateId?h:"",appWidth:s+"px",userAppTemplId:ft,userTemplate:w,appClass:"e-monthappointment",appointData:e.appointColor.appointData,appointCustomcss:e.appointColor.appointCustomcss,appointtextcolor:e.appointColor.appointtextcolor,value:e.value,multiDiv:e.multiDiv,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:vt,leftInd:tt.leftIndication,rightInd:tt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),o=this.model.orientation=="vertical"?this.element.find("td.e-monthcells").eq(f-1):this.element.find(".e-workcellstab tr").eq(b+c-1).find("td.e-workcells").eq(f-1);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,a);this.model.orientation=="vertical"?o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(a)):this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(ot,c,f-1,i,s,this.leftPosition));a=""}else{if(n("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(b+c-1)+"_"+(f-1)).length!=0&&n("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(b+c-1)+"_"+(f-1)).remove(),this.model.showOverflowButton){var ti=f-1,ii=new Date(i[this._appointmentSettings.startTime]).getTime(),ci=Math.round((i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/864e5),st=ti,li=y+1;do o=this.model.orientation=="vertical"?this.element.find("td.e-monthcells").eq(st):this.element.find(".e-workcellstab tr").eq(b+c-1).find("td.e-workcells").eq(st),ri='<div id="'+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(b+c-1)+"_"+st+'" class="e-icon e-arrowhead-down e-appsoverflow" cellinfo="'+it[r]+'" appcount="'+li+'"><\/div>',o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(ri):this.model.orientation=="vertical"?o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(a)):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),ii=ii+864e5,st++;while(st<ci+ti);this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(ot,c,f-1,i,s,this.leftPosition)}else{if(this.model.orientation=="vertical"){v=y*h;var vt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,ai=this.element.find("td.e-monthcells").eq(f-1).parent().index(),a=this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!e.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:lt,endTime:at,left:this.leftPosition+"px",top:v,appHeight:this.model.appointmentTemplateId?h:"",appWidth:s+"px",userAppTemplId:ft,userTemplate:w,appClass:"e-monthappointment",appointData:e.appointColor.appointData,appointCustomcss:e.appointColor.appointCustomcss,appointtextcolor:e.appointColor.appointtextcolor,value:e.value,multiDiv:e.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:vt,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}),o=this.element.find("td.e-monthcells").eq(f-1),yt=this.element.find("td.e-monthcells").eq(f-1).parent().children().outerHeight();this.CellHeight=yt>h*(y+1)+et?yt:yt+(h-1);this.element.find("td.e-monthcells").eq(f-1).parent().children().css("height",this.CellHeight+"px");this.element.find(".e-timecells").eq(ai).css("height",this.CellHeight+"px");o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(a))}else{v=y*h;this.CellHeight-10<h*(y+1)&&(this.element.find(".e-workcellstab tr").eq(b+c-1).find(".e-workcells").css("height",this.CellHeight+h+"px"),this.element.find(".e-resourceheadertable tr").eq(b+c-1).find(".e-childnode").css("height",this.CellHeight+h+"px"));var vt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,a=this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!e.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:lt,endTime:at,left:this.leftPosition+"px",top:v,appHeight:this.model.appointmentTemplateId?h:"",appWidth:s+"px",userAppTemplId:ft,userTemplate:w,appClass:"e-monthappointment",appointData:e.appointColor.appointData,appointCustomcss:e.appointColor.appointCustomcss,appointtextcolor:e.appointColor.appointtextcolor,value:e.value,multiDiv:e.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:vt,leftInd:tt.leftIndication,rightInd:tt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}),o=this.element.find(".e-workcellstab tr").eq(b+c-1).find("td.e-workcells").eq(f-1);o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(a));!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(ot,c,f-1,i,s,this.leftPosition)}this._overflowFlag=!0}ui=this.element.find(".e-appsoverflow").length>0?this.element.find(".e-appsoverflow").height():0;v=this.CellHeight-(et+ui-2);this.model.enableRTL?this.element.find(".e-icon.e-appsoverflow").css({right:this.CellWidth+this.leftPosition-25+"px",top:v+"px"}):this.element.find(".e-icon.e-appsoverflow").css({left:this.CellWidth+this.leftPosition-25+"px",top:v+"px"})}delete i.Index}i[this._appointmentSettings.recurrence]||(ht=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId)),pt=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid)),new Date(i[this._appointmentSettings.endTime])<ht[0][this._appointmentSettings.endTime]&&(this.model.enableRTL?this.element.find(rt).eq(f-1).find("[guid="+ht[0].Guid+"]").children(".e-lefthandle").remove():this.element.find(rt).eq(f-1).find("[guid="+ht[0].Guid+"]").children(".e-righthandle").remove()),new Date(i[this._appointmentSettings.startTime])>ht[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-righthandle").remove():this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-lefthandle").remove()));!t.isNullOrUndefined(pt)&&pt>1&&(this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-lefthandle").remove(),this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-righthandle").remove());t.isNullOrUndefined(tt)||(tt.leftIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),tt.rightIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")))},_getElementHeight:function(t){var i=n(document.createElement("div")).addClass(t).clone(!1),r;return i.css({visibility:"hidden",position:"absolute"}),i.appendTo(this.element.find(".e-scheduleinner")),r=i.outerHeight(!0),i.remove(),r},_quickWindowClose:function(){this._quickAppointWindow.find(".e-error").remove();this._quickAppointWindow.ejDialog("close");this._scrollerPosition();this._processFocus()},_appointmentWindow:function(i){var f,e,r,u,o;if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close"),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),this.currentView()=="agenda"||r.hasClass("e-detailedapp")||t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(r=t.isNullOrUndefined(n(i.target).closest(".e-appointment,.e-monthappointment"))?r.closest(".e-workcells, .e-alldaycells, .e-monthcells"):n(i.target).closest(".e-appointment,.e-monthappointment")),r.hasClass("e-appup")||r.hasClass("e-appdown")||r.closest(".e-blocktimeappointment").hasClass("e-blocktimeappointment")||r.closest(".e-categorybar").hasClass("e-categorybar"))return!1;var c=(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||this._cellClick||r.hasClass("e-detailedapp"))&&!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-schedulemouseclose")&&!r.hasClass("e-appointinnertext")&&!r.hasClass("e-apptext")&&!r.hasClass("e-apptime"),l=this.model.appointmentWindowOpen!=null||this.model.cellDoubleClick!=null||!t.isNullOrUndefined(this.model.serverEvents)&&(this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1||this.model.serverEvents.indexOf("cellDoubleClick")!=-1),s={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:i,resources:l&&c&&this._tempResource.length!=0?this._getResourceValue(r):null};if(!(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||this._cellClick||r.hasClass("e-detailedapp"))||r.hasClass("e-resourceheadercells")||r.hasClass("e-schedulemouseclose")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptext")||r.hasClass("e-apptime")){if(!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-schedulemouseclose")){if(r.hasClass("e-monthheader")||r.hasClass("e-appsoverflow"))return!1;u=this._editKey?n(i):r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-monthappointment,.e-appointment,.e-alldayappointment,.e-agendaappointment");this.currentView()=="agenda"&&(u=u.hasClass("e-agendaappointment")?u:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"));u.length>0&&!t.isNullOrUndefined(u[0].id)&&(this._currentAction=t.Schedule.Actions.Save,this._appUid=u.attr("guid"),o=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),o[0][this._appointmentSettings.recurrence]==1?(t.isNullOrUndefined(this._recurEditWindow)&&this._renderRecurEditWindow(),this._parentId=o[0].ParentId,this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):this._showAppointmentDetails(this._appUid,!0),!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"));this._editKey=!1}}else{if(!t.isNullOrUndefined(this.model.cellDoubleClick)&&this._trigger("cellDoubleClick",s))return!1;this._currentAction=t.Schedule.Actions.Add;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").css("display","block"));var a=this._cellIndex,v=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender,h=new Date(v[a]);if(this.model.minDate>h||this.model.maxDate<h||(f=new Date(this.cur_StartTime),e=new Date(this.cur_EndTime),(!t.isNullOrUndefined(this.model.appointmentWindowOpen)||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1)&&this._trigger("appointmentWindowOpen",s)))return!1;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find("#"+this._id+"subject").val(this.model.showQuickWindow?this._quickAppointWindow.find(".subject").val():""),this._appointmentAddWindow.find("#"+this._id+"location").val(this.model.showQuickWindow?this._quickAppointWindow.find(".location").val():""),this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option",{value:t.format(new Date(f),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option",{value:t.format(new Date(e),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(f),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(e),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option","value",this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]),(n(i.currentTarget).hasClass("e-alldaycells")||this.currentView()=="month"||this._isCustomMonthView())&&this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}),this._timeZoneCollection(null),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),this._alldayCheck(),t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._renderResourceData(r,this._cellIndex),this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave ,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open")),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus(),this._cellClick=!1)}},_editRecurrence:function(){this._appointmentAddWindow.find(".e-appwindow").toggle();this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","none");this._appointmentAddWindow.find(".e-recurEditor").css("margin-left",700).toggle().animate({"margin-left":10},300)},_showAppointmentDetails:function(n,i){var f,u,e;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties();f=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor");this._appUid=t.isNullOrUndefined(this._appUid)?n:this._appUid;this._currentAction=t.isNullOrUndefined(this._currentAction)||this._currentAction==""?t.Schedule.Actions.Save:this._currentAction;var o=i==!0?(new t.Query).where("Guid",t.FilterOperators.equal,n):(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n),s=i==!0?this._processed:this._currentAppointmentData,r=this._sortAppById(new t.DataManager(s).executeLocal(o)),h={appointment:r[0],edit:i};if(this._trigger("appointmentWindowOpen",h))return!1;r[0][this._appointmentSettings.endTime]=r[r.length-1][this._appointmentSettings.endTime];t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find(".subject").val(r[0][this._appointmentSettings.subject]),this._appointmentAddWindow.find(".location").val(r[0][this._appointmentSettings.location]),this._appointmentAddWindow.find(".id").val(r[0].AppTaskId),this._appointmentAddWindow.find(".e-description").val(r[0][this._appointmentSettings.description]?r[0][this._appointmentSettings.description]:""),u=r[0],this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",t.format(u[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",t.format(u[this._appointmentSettings.endTime],this._datepattern(),this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(u[this._appointmentSettings.startTime],this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(u[this._appointmentSettings.endTime],this._pattern.t,this.model.locale)),this.model.prioritySettings.enable&&(t.isNullOrUndefined(u[this._appointmentSettings.priority])?this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option",{value:this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]}):this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option",{value:r[0][this._appointmentSettings.priority]})),this._timeZoneCollection(u),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),r[0][this._appointmentSettings.allDay]==1&&this._appointmentAddWindow.find(".allday ").ejCheckBox({checked:!0}),r[0][this._appointmentSettings.recurrence]==1&&(f._recRule=r[0][this._appointmentSettings.recurrenceRule],i==!0?(t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceRule])||r[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")==-1||(this._currentAction=t.Schedule.Actions.Save),this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0,enabled:!1}),this._appointmentAddWindow.find(".e-repeatlbl").addClass("e-disable"),this._appointmentAddWindow.find("."+this._id+"summary").css("display","none"),this._appointmentAddWindow.find(".e-recurFinalRule").html("")):(f.recurrenceRuleSplit(r[0][this._appointmentSettings.recurrenceRule],u[this._appointmentSettings.recurrenceExDate]),this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({value:t.format(u[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(f.showRecurrenceSummary(n)),this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0}),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"))),this.model.categorizeSettings.enable&&!t.isNullOrUndefined(u[this._appointmentSettings.categorize])&&this._showCategorizeDetails(u),this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._showMultipleResourceDetails(u),(u[this._appointmentSettings.allDay]||this.currentView()=="agenda")&&this._alldayCheck(),e=this.model.readOnly?"disable":"enable",this._appointmentAddWindow.find(".e-appsave,#"+this._id+"donerecur").ejButton(e,!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","block"),this._appointmentAddWindow.ejDialog("open"),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus())},_recurDateChange:function(n){this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",n);this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")<this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")?this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",n):n!=this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")&&this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",n)},_cancel:function(){this._appointmentAddWindow.ejDialog("close")},_timeChange:function(n){var i=this._appointmentAddWindow.find("#"+this._id+"starttime").data("ejTimePicker");if(t.isNullOrUndefined(n.value)){i.option("value",new Date(this.cur_StartTime));return}if(i.showDropdown&&i._id==this._id+"starttime"){if(this._appointmentAddWindow.find(".startutc").val()!=this._appointmentAddWindow.find(".endutc").val())this._utcValue("","starttime");else{var u=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),f=new Date(new Date("1/1/2000").setHours(parseInt(u[0],10),parseInt(u[1],10))),e=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),r=new Date(new Date("1/1/2000").setHours(parseInt(e[0],10),parseInt(e[1],10))),o=this._timeFormat(n.prevTime).split(":"),s=new Date(new Date("1/1/2000").setHours(parseInt(o[0],10),parseInt(o[1],10))),h=new Date(new Date(r).setHours(r.getHours()+f.getHours()-s.getHours(),r.getMinutes()+f.getMinutes()-s.getMinutes()));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",h)}this._startSlotChange=!0}},_setQuickValidation:function(){var f,i,r,u;if(t.isNullOrUndefined(this._quickAppointWindow))return!1;f=this._id+"_AddForm";this._initValidator(f);t.isNullOrUndefined(this.model.appointmentSettings.subject)||t.isNullOrUndefined(this.model.appointmentSettings.subject.validationRules)||(i=this.model.appointmentSettings.subject.field,r=this.model.appointmentSettings.subject.validationRules,ele=this._quickAppointWindow.find(".subject"),ele.attr("name")||ele.attr("name",i),ele.rules("add",r),u=n("#"+this._id+"_AddForm").validate(),t.isNullOrUndefined(r.required)||(t.isNullOrUndefined(u.settings.messages[i])?u.settings.messages[i]={}:"",u.settings.messages[i].required=t.isNullOrUndefined(r.messages&&r.messages.required)?i+" is required.":r.messages.required))},_setValidation:function(){var r=this._id+"_AddEditForm",i;this._initValidator(r);i=this;n.each(this.model.appointmentSettings,function(n){t.isNullOrUndefined(i.model.appointmentSettings[n])||t.isNullOrUndefined(i.model.appointmentSettings[n].validationRules)||i._setValidationToField(n,i.model.appointmentSettings[n].field,i.model.appointmentSettings[n].validationRules)})},_initValidator:function(i){n("#"+i).validate({onfocusout:!1,ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,r){var e=r.closest("td"),u=n(i).addClass("e-error"),o=t.buildTag("div.e-errortail e-toparrow"),f;e.find(".e-error").remove();r.parent().hasClass("e-in-wrap")?u.insertAfter(r.closest(".e-widget")):u.insertAfter(r);u.prepend(o);f=r[0].type=="checkbox"||r[0].type=="hidden"?r.parent().offset().top+r.parent().height():r.offset().top+r.height();u.offset({top:f});u.fadeIn("slow")}})},_setValidationToField:function(i,r,u){var f,e,o;for(ele=i=="startTime"?this._appointmentAddWindow.find("#"+this._id+"startdate,#"+this._id+"starttime"):i=="endTime"?this._appointmentAddWindow.find("#"+this._id+"enddate,#"+this._id+"endtime"):i=="resourceFields"?n("#"+this._id+"AppointmentAddEditWindow").find("[id^="+this._id+"_ownerfield_][type!=hidden]").find(".e-autocomplete"):n("#"+this._id+"AppointmentAddEditWindow").find("[name="+r+"][type!=hidden]"),ele.length<1&&(ele=n("#"+this._id+i)),f=0;f<ele.length;f++)n(ele[f]).hasClass("e-autocomplete")&&(e=n(ele[f]).data("ejAutocomplete"),ele[f]=e.model.multiSelectMode=="visualmode"?e._hiddenInput:e.element),n(ele[f]).rules("add",u),o=n("#"+this._id+"_AddEditForm").validate(),t.isNullOrUndefined(u.required)||(t.isNullOrUndefined(o.settings.messages[r])?o.settings.messages[r]={}:"",o.settings.messages[r].required=t.isNullOrUndefined(u.messages&&u.messages.required)?r+" is required.":u.messages.required)},_endTimeChange:function(n){var i=this._appointmentAddWindow.find("#"+this._id+"endtime").data("ejTimePicker");if(t.isNullOrUndefined(n.value)){i.option("value",new Date(this.cur_EndTime));return}i.showDropdown&&i._id==this._id+"endtime"&&(this._endSlotChange=!0)},_renderControls:function(){var i=this._appointmentAddWindow;i.find(".allday").ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:n.proxy(this._alldayCheck,this)});i.find(".startenddate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),startDay:this._firstdayofweek,enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,dateFormat:this.model.dateFormat,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate});i.find("#"+this._id+"starttime").ejTimePicker({enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,change:n.proxy(this._timeChange,this),cssClass:this.model.cssClass,interval:30,timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});i.find("#"+this._id+"endtime").ejTimePicker({enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,change:n.proxy(this._endTimeChange,this),cssClass:this.model.cssClass,interval:30,timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});i.find("#"+this._id+"startTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._startUtc,this),cssClass:this.model.cssClass});i.find("#"+this._id+"endTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._endUtc,this),cssClass:this.model.cssClass});!this.model.prioritySettings.enable||this.model.prioritySettings.dataSource instanceof t.DataManager||this._renderPriorityItems(i);this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._renderAppWindowResources(i);!this.model.categorizeSettings.enable||this.model.categorizeSettings.dataSource instanceof t.DataManager||this._renderCategoryItems(i);i.find(".recurrence").ejCheckBox({enableRTL:this.model.enableRTL,change:n.proxy(this._repeat,this),cssClass:this.model.cssClass});i.find(".e-btndone").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:this._mediaQuery?"100%":"100px",click:n.proxy(this._saveAppointment,this),cssClass:"e-flat"+this.model.cssClass});i.find(".cancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:this._mediaQuery?"100%":"100px",click:n.proxy(this._cancel,this),cssClass:"e-flat"+this.model.cssClass});this._mediaQuery&&i.find(".e-btndelete").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100%",click:n.proxy(this._mobileAppDelete,this),cssClass:"e-flat"+this.model.cssClass})},_mobileAppDelete:function(){this._mediaQuery&&!t.isNullOrUndefined(this._editOnlyClicked)&&!this._editOnlyClicked&&this._appointmentAddWindow.find(".recurrence").ejCheckBox("option","checked")?this._deleteApp(this._appUid):this._deleteAppoint();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("close")},_renderPriorityItems:function(n){t.isNullOrUndefined(n)||n.find(".priority").ejDropDownList({enableRTL:this.model.enableRTL,template:t.isNullOrUndefined(this.model.prioritySettings.template)?"<div class='e-${"+this.model.prioritySettings.value+"}'><\/div><div>${"+this.model.prioritySettings.text+"}<\/div>":this.model.prioritySettings.template+"${"+this.model.prioritySettings.text+"}",dataSource:this.model.prioritySettings.dataSource,fields:{text:this.model.prioritySettings.text,value:this.model.prioritySettings.value},width:"100%",cssClass:this.model.cssClass})},_renderCategoryItems:function(i){t.isNullOrUndefined(i)||i.find(".e-categorizevalue").ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",cssClass:this.model.cssClass,multiSelectMode:this.model.categorizeSettings.allowMultiple?"visualmode":"none",focusOut:n.proxy(this._categorizeValidate,this),dataSource:this.model.categorizeSettings.dataSource,fields:{text:this.model.categorizeSettings.text,value:this.model.categorizeSettings.color,key:this.model.categorizeSettings.id,fontColor:this.model.categorizeSettings.fontColor},template:this._categorizeTemplate,emptyResultText:this._getLocalizedLabels("EmptyResultText")})},_categorizeValidate:function(){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddEditForm").validate().form())return!1},_appointmentColor:function(n){var i=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(n[this._appointmentSettings.categorize])&&n[this._appointmentSettings.categorize]!=""?this._getCategorizeColor(n):this._tempResource.length!=0&&t.scheduleFeatures.resources?this._getResourceColor(n):{appointData:"",appointCustomcss:"",appointtextcolor:"",applyFilter:!0};if(this.model.categorizeSettings.enable&&this.model.categorizeSettings.allowMultiple&&!t.isNullOrUndefined(n[this._appointmentSettings.categorize]))var f=n[this._appointmentSettings.categorize].split(","),e=f.length,r=e>1?!0:!1,u=this._categorizeMultipleDiv(n,f,e);return!t.isNullOrUndefined(u)&&i.appointData.length>0&&this.model.categorizeSettings.allowMultiple?{appointColor:i,value:r,multiDiv:u,applyFilter:!1}:i.appointData.length>0&&!this.model.categorizeSettings.allowMultiple||this._tempResource.length!=0&&t.scheduleFeatures.resources?{appointColor:i,applyFilter:!1}:(appointData="",appointCustomcss="",appointtextcolor="",r="",{appointColor:i,value:r,multiDiv:u,applyFilter:!0})},_categorizeMultipleDiv:function(n,r,u){var o=[],f,e;for(i=0;i<=u-1;i++)if(i!=u-1){if(f=this.model.categorizeSettings,e=this._findResourceIndex(f.dataSource,this.model.categorizeSettings.id,r[i]),t.isNullOrUndefined(e)&&(e=this._findResourceIndex(f.dataSource,this.model.categorizeSettings.id,parseInt(r[i]))),t.isNullOrUndefined(e))return n[this._appointmentSettings.categorize]="",null;o.push({text:f.dataSource[e][f.text],value:f.dataSource[e][f.color],key:f.dataSource[e][f.id],fontColor:f.dataSource[e][f.fontColor]})}return this._categorizeMultipleTemplate.render({renderData:o})},_getResCategorySaveData:function(n,i,r,u,f){var a=[],o,b,k,d=[],y,c,p,w,h,l,g,v,e,s;if(o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&!t.isNullOrUndefined(n[0][0])){for(y=n[n.length-1].length-1,c="",e=0;e<=y;e++)p=n[n.length-1][e][this.model.categorizeSettings.id],c=e!=y?c+p.toString()+",":c+p.toString();o[this._appointmentSettings.categorize]=c}if(i.length>0){if(w=o[this._appointmentSettings.categorize],s=this._appointmentSettings.resourceFields.toString().split(","),this._grouping.length!=0&&s.length!=this._grouping.length){for(e=0;e<this._grouping.length;e++)d.push(s[e]);s=d}if(h=this._getResourceCollection(),i[i.length-1].length>0)for(l=0;l<i[i.length-1].length;l++){for(o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=w),i[i.length-1].length>1&&(r.Guid=this._guidFormatGenerate(),u++,g=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u)),u=g.length==0?u:this._sortAppById(this._processed)[this._processed.length-1].AppTaskId+1,r[this._appointmentSettings.id]=f=u,this._currentAction==t.Schedule.Actions.EditSeries&&(r[this._appointmentSettings.recurrenceId]=u)),o[s[s.length-1].trim()]=i[s.length-1][l][h[h.length-1].id],v=i[s.length-1][l][h[h.length-1].id],e=s.length-1;e>0;e--)b=this.render_Resources[e]instanceof t.DataManager?this.render_Resources[e]:t.DataManager(this.render_Resources[e]),query=(new t.Query).where(h[e].id,t.FilterOperators.equal,v),appointId=b.executeLocal(query),k=this.render_Resources[e-1]instanceof t.DataManager?this.render_Resources[e-1]:t.DataManager(this.render_Resources[e-1]),query1=(new t.Query).where(h[e-1].id,t.FilterOperators.equal,appointId[0][h[e].groupId]),appointGroupId=k.executeLocal(query1),v=appointGroupId[0][h[e-1].id],o[s[e-1]]=v;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);a.push(o)}else{if(s=this._appointmentSettings.resourceFields.toString().split(","),o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=w),s.length>1)for(e=0;e<s.length;e++)o[s[e].trim()]=this._tempResource[e].resourceSettings.dataSource[0].id;else o[s[s.length-1].trim()]=this._tempResource[0].resourceSettings.dataSource[0].id;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);a.push(o)}}return i.length==0&&n.length>0&&(this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId),a.push(o)),a},_timeZoneCollection:function(n){var u;t.isNullOrUndefined(n)||(this.startTimeAppoint=n[this._appointmentSettings.startTimeZone],this.endTimeAppoint=n[this._appointmentSettings.endTimeZone]);this.startutcValue=this.tempValue=null;!t.isNullOrUndefined(n)&&this.endTimeAppoint&&(this._utcValue(n,"Appoint"),this.tempValue=1);var s=this.model.timeZone==null?this._timezoneStringValue():this.model.timeZone,e=t.isNullOrUndefined(n)?s:t.isNullOrUndefined(this.startTimeAppoint)?s:this.startTimeAppoint,r=e.indexOf("UTC")!=0?"UTC "+e:e,o=r.split(" ")[1].split(":")[0].length!=3?r.split(" ")[1].split(":")[0][0]=="+"?"+0"+r.split(" ")[1].split(":")[0].split("+")[1]+":"+r.split(" ")[1].split(":")[1]:"-0"+r.split(" ")[1].split(":")[0].split("-")[1]+":"+r.split(" ")[1].split(":")[1]:r,f=o.indexOf("UTC")!=0?"UTC "+o:o,i=t.isNullOrUndefined(this._findResourceIndex(this.model.timeZoneCollection.dataSource,this.model.timeZoneCollection.value,f))?"add":this._findResourceIndex(this.model.timeZoneCollection.dataSource,this.model.timeZoneCollection.value,f);t.isNullOrUndefined(n)||i==="add"?i!=="add"&&(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{text:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.text],value:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.text],value:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]})):(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{value:!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.startTimeAppoint)?this.startTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{value:!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.endTimeAppoint)?this.endTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}));i=="add"&&(u={},u[this.model.timeZoneCollection.text]=f,u[this.model.timeZoneCollection.id]=(this.model.timeZoneCollection.dataSource.length+1).toString(),u[this.model.timeZoneCollection.value]=f,this.model.timeZoneCollection.dataSource.push(u),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),n!=null?this._timeZoneCollection(n):this._timeZoneCollection(null));this.tempValue=null},_timezoneStringValue:function(){var t=-(new Date).getTimezoneOffset()+this._timeZoneOffset,i=t<0?"-":"+",n=Math.abs(t),r=Math.floor(n/60)<10?"0"+Math.floor(n/60):Math.floor(n/60),u=n%60<10?"0"+n%60:n%60;return i+r+":"+u},_showCategorizeDetails:function(t){var r=t[this._appointmentSettings.categorize].split(","),u;for(i=0;i<r.length;i++)u=n.type(r[i])=="string"?r[i]:parseInt(r[i]),this._appointmentAddWindow.find(".e-categorizevalue").data("ejAutocomplete").selectValueByKey(u)},_renderCategorizeTemplate:function(){var n=this.model.enableRTL?"margin-right:30px;margin-top:-18px":"",i=this.model.enableRTL?"float:none":"float:left";t.isNullOrUndefined(this.model.categorizeSettings)||(this._categorizeTemplate="<div class='e-categorizeTemplate' style='height:15px;margin-right:5px;margin-top:3px;"+i+";width:15px;background-color: ${"+this.model.categorizeSettings.color+"}'><\/div><div style= "+n+">${"+this.model.categorizeSettings.text+"}<\/div>")},_getCategorizeColor:function(n){var r=null,u="",o="",f="",e=n[this._appointmentSettings.categorize].split(","),s=e.length-1,i=this.model.categorizeSettings;return(r=this._findResourceIndex(i.dataSource,this.model.categorizeSettings.id,e[s]),t.isNullOrUndefined(r)&&(r=this._findResourceIndex(i.dataSource,this.model.categorizeSettings.id,parseInt(e[s]))),t.isNullOrUndefined(r))?(n[this._appointmentSettings.categorize]="",{appointData:u,appointCustomcss:o,appointtextcolor:f}):(u=t.isNullOrUndefined(i.dataSource[r][i.color])?u:i.dataSource[r][i.color],f=t.isNullOrUndefined(i.dataSource[r][i.fontColor])?f:i.dataSource[r][i.fontColor],{appointData:u,appointCustomcss:o,appointtextcolor:f,applyFilter:!1})},_currentDateFormat:function(i){var r,u,f,e;t.isNullOrUndefined(i)||n.type(this.currentDate())=="date"&&n.type(this.model.minDate)=="date"&&n.type(this.model.maxDate)=="date"?i=="MM/dd/yyyy"&&(n.type(this.currentDate())!="date"||n.type(this.model.minDate)!="date"||n.type(this.model.maxDate)!="date")&&(e=t.parseDate(this.currentDate()),r=t.parseDate(this.model.minDate),u=t.parseDate(this.model.maxDate),t.isNullOrUndefined(e)?this.currentDate(new Date):this.currentDate(e),this.model.minDate=t.isNullOrUndefined(r)?this.model.minDate:r,this.model.maxDate=t.isNullOrUndefined(u)?this.model.maxDate:u):(f=t.parseDate(this.currentDate(),this.model.dateFormat),r=t.parseDate(this.model.minDate,this.model.dateFormat),u=t.parseDate(this.model.maxDate,this.model.dateFormat),this.currentDate(t.isNullOrUndefined(f)?new Date(this.currentDate()).toString()=="Invalid Date"||new Date(this.currentDate()).toString()=="NaN"?this._dateConvert(this.currentDate()):new Date(this.currentDate()):f),this.model.minDate=t.isNullOrUndefined(r)?new Date(this.model.minDate).toString()=="Invalid Date"||new Date(this.model.minDate).toString()=="NaN"?this._dateConvert(this.model.minDate):new Date(this.model.minDate):r,this.model.maxDate=t.isNullOrUndefined(u)?new Date(this.model.maxDate).toString()=="Invalid Date"||new Date(this.model.maxDate).toString()=="NaN"?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate):u)},_datepattern:function(){return this.model.dateFormat!=""&&!t.isNullOrUndefined(this.model.dateFormat)?this.model.dateFormat:this._pattern.d},_businessHourScroller:function(){var n,i,r,u;if(this.currentView()=="agenda")return!1;n=0;this.model.orientation=="vertical"&&this.model.timeScale.enable&&this.currentView()!="month"&&!this._isCustomMonthView()?(n=this.element.find(".e-businesshighlightworkcells").length!=0&&this.model.workHours.highlight?this.element.find(".e-businesshighlightworkcells").first().parent().index()*this.element.find(".e-workcells").height():0,this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:n}),this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})):this.model.orientation=="horizontal"&&this.model.timeScale.enable&&(this.element.find(".e-businesshighlightworkcells").length!=0&&this.model.workHours.highlight&&this.currentView()!="month"?(n=this.element.find(".e-businesshighlightworkcells")[0].offsetLeft,(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7)&&(i=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index(),!t.isNullOrUndefined(i)&&i>=0&&(this.currentView()=="customview"?this.currentDate(new Date(this._dateRender[0])):this.currentDate(new Date(this._dateRender[i])),n=this.element.find(".e-workcells")[i*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)].offsetLeft,r=this.model.workHours.start-this.model.startHour<=0?1:this.model.workHours.start-this.model.startHour,[0,6].indexOf(new Date(this._dateRender[i]).getDay())==-1&&this.currentView()!="customview"&&(this.model.enableRTL?n-=r*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*this.element.find(".e-workcells").width():n+=r*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*this.element.find(".e-workcells").width()-this.element.find(".e-workcells").width())))):n=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index()!=-1?this.element.find(".e-workcells")[this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index()*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)].offsetLeft:0,u=this.model.enableRTL?this.element.find(".e-workcells")[0].offsetLeft-n:n,this.element.find("div#"+this._id+"_scroller").ejScroller({scrollLeft:u}))},_minToHour:function(n){return{h:parseInt(n/60),m:n%60}},_onclose:function(){this._appointmentAddWindow.find(".e-error").remove();this._appointmentAddWindow.find(".e-recurEditor").hide();this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).show().animate({"margin-left":10},300);this._clearFields();this._processFocus()},_printAppointment:function(i){var h=t.buildTag("div"),r,c,f,u,s,l,a;typeof i=="object"?r=i:(c=(new t.Query).where("Guid",t.FilterOperators.equal,i),list=new t.DataManager(this._processed).executeLocal(c),list.length>1?(f=n.extend(!0,[],list),f[0][this._appointmentSettings.endTime]=f[f.length-1][this._appointmentSettings.endTime],r=f[0]):r=list[0]);var e="<table align='center' style='margin-top:50px;margin-left:50;'>",o=this,v=["Guid","ParentId","RecurrenceId","RecurrenceExDate","AppTaskId"];return n.each(r,function(n,i){v.indexOf(n)!=-1||t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||n=="null"||((n==o._appointmentSettings.startTime||n==o._appointmentSettings.endTime)&&(i=i),e+="<tr style='height:30px'><td style='width:300px'><b>"+n+":<\/b><\/td><td style='width:600px'>"+i+"<\/td><\/tr>")}),e+="<\/table>",u="",this._tempResource.length!=0&&(t.isNullOrUndefined(r[this._tempResource[this._tempResource.length-1].field])||(s=o._appointmentSettings.resourceFields.split(","),n.each(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource,function(n,t){t.id==r[s[s.length-1].trim()]&&(u=t.text)}))),u=u==""?"Unknown":u,l="<font size='20' style='margin-top:50px;margin-left:50;font-family:Times New Roman'><b>"+u+"<\/b><\/font><\/br><hr style='margin-left:50' size='10'>",a=l+e,h.append(a),t.print(h),!1},_recurrenceValidate:function(n,i,r,u){var f=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),h,s,y,p,o,c,b,l,k,v,e;if(t.isNullOrUndefined(n)||f.recurrenceRuleSplit(n,i),t.isNullOrUndefined(u)?(y=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),h=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(y[0],10),parseInt(y[1],10)))):h=u,t.isNullOrUndefined(r)?(p=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),s=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(p[0],10),parseInt(p[1],10)))):s=r,o=t.isNullOrUndefined(r)?this._appointmentAddWindow.find(".recurstartdate").ejDatePicker("option","value"):r,c=f._rRule.interval,t.isNullOrUndefined(f._rRule.until))if(t.isNullOrUndefined(f._rRule.count))recurEndDate=new Date(new Date(this.currentDate()).setDate(o.getDate()+42*c));else switch(f._rRule.freq){case"DAILY":recurEndDate=new Date(new Date(o).setDate(o.getDate()+f._rRule.count*c));break;case"WEEKLY":b=f._rRule.weekDays.split(",");l=o.getDate()+f._rRule.count/b.length*7*c;recurEndDate=new Date(new Date(o).setDate(Math.round(l)<l?l+1:l));break;case"MONTHLY":recurEndDate=new Date(new Date(o).setMonth(o.getMonth()+f._rRule.count*c));break;case"YEARLY":recurEndDate=new Date(new Date(o).setFullYear(o.getFullYear()+f._rRule.count*c))}else recurEndDate=new Date(f._rRule.until),recurEndDate.setDate(recurEndDate.getDate()+1);if((recurEndDate-o)/864e5<(f._rRule.freq=="DAILY"?2:f._rRule.freq=="WEEKLY"?7:1))return!0;switch(f._rRule.freq){case"DAILY":return k=f._rRule.interval,(h-s)/36e5>parseInt(k)*24?!1:!0;case"WEEKLY":if(n.split(";")[1].split("=")[0]=="INTERVAL"){var a=f._rRule.weekDays.split(","),g={SU:0,MO:1,TU:2,WE:3,TH:4,FR:5,SA:6},w=[],d=[];for(e=0;e<a.length*(parseInt(f._rRule.interval)+1);e++)w[e]=a.length>e?g[a[e]]:w[e-a.length]+7*parseInt(f._rRule.interval);for(v=w.sort(function(n,t){return n-t}),e=1;e<v.length;e++)d.push(v[e]-v[e-1]);return(h-s)/36e5>Math.min.apply(Math,d)*24?!1:!0}return(h-s)/36e5>24?!1:!0;case"MONTHLY":return h.getTime()>new Date(s).setMonth(s.getMonth()+parseInt(f._rRule.interval))?!1:!0;case"YEARLY":return h.getTime()>new Date(s).setFullYear(s.getFullYear()+parseInt(f._rRule.interval))?!1:!0}return!0},_saveAppointment:function(){var nt,tr,tt,yi,i,ui,pt,wt,rt,o,v,b,pi,bt,kt,y,et,k,ei,fi,h,u,dt,si,oi,ht,c,gt,e,hi,li,bi,ni,ki,di,s,gi,lt,ti,at,vt,yt,d,ii,ci,w,l,p,it,ri,ot,ft,st,f,nr;if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),nt=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),this._currentAction!=""){if(t.isNullOrUndefined(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value"))||t.isNullOrUndefined(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")))return!1;if(start=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),end=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),startTime=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(start[0],10),parseInt(start[1],10))),endTime=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(end[0],10),parseInt(end[1],10))),startTime>endTime)return t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("StartEndError")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.ejDialog("open"),!1}if(this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked")&&nt._recRule!=""&&!t.isNullOrUndefined(nt._recRule)&&this.model.enableRecurrenceValidation&&this._currentAction=="add"&&!this._recurrenceValidate(nt._recRule))return this._alertCreateError(),!1;if(tr=this._sortAppById(this._processed),this._cellClick&&this.model.showQuickWindow){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddForm").validate().form())return!1;if(i={},tt=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,this.model.enableLoadOnDemand&&(tt=this._dataCount),i[this._appointmentSettings.id]=i.AppTaskId=i.ParentId=tt,i[this._appointmentSettings.subject]=this._quickAppointWindow.find(".subject").val(),i[this._appointmentSettings.startTime]=new Date(this.cur_StartTime),i[this._appointmentSettings.endTime]=new Date(this.cur_EndTime),i[this._appointmentSettings.allDay]=this.currentView()==="month"||new Date(this.cur_StartTime).getHours()==0&&new Date(this.cur_EndTime).getHours()==23&&new Date(this.cur_EndTime).getMinutes()==59||this._isCustomMonthView()?!0:!1,this.model.appointmentSettings.applyTimeOffset&&!i[this._appointmentSettings.allDay]&&(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),i[this._appointmentSettings.recurrence]=!1,(!t.isNullOrUndefined(this.model.group)||this._tempResource.length!=0&&t.scheduleFeatures.resources)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&(i=this._getResourceFields(i)),"null"in i&&delete i[null],ht=this._checkAvailability(i),u={appointment:i},this._trigger("actionBegin",{data:u.appointment,requestType:"appointmentSave"})||ht.length>0)return this._showBlockAlert&&ht.length>0&&this._alertBlockError(),t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close"),!1;if(this._trigger("beforeAppointmentCreate",u))return t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close"),!1;for(this._currentAction==t.Schedule.Actions.Add,u.appointment.Guid=this._guidFormatGenerate(),n.extend(!0,yi={},u.appointment),c=this._timeZoneAppointments(yi,""),w=this._dataManager.insert(c,this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u.appointment),new t.DataManager(this._currentAppointmentData).update("AppTaskId",u.appointment),this._appointmentProcessing(u.appointment),this._currentViewAppointments=this._appointmentCount(),ui=this._currentViewAppointments.filter(function(n){return n.Guid==u.appointment.Guid}),pt=0;pt<ui.length;pt++)this._refreshDayAppointments(ui[pt]);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;this._trigger("appointmentCreated",{appointment:u.appointment,requestType:"appointmentSaved"});this._trigger("actionComplete",{data:u.appointment,requestType:"appointmentSave"});this._cellClick=!1;t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close");this._scrollerPosition();!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(f=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(r))f._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(f._dateFormat(r.added),e=0,o=r.added.length;e<o;e++)u.appointment[f._appointmentSettings.id]=r.added[e][f._appointmentSettings.id],u.appointment[f._appointmentSettings.recurrence]||(u.appointment.ParentId=r.added[e][f._appointmentSettings.id]),new t.DataManager(f._processed).update("Guid",u.appointment)}))}else{if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddEditForm").validate().form())return!1;var a,i={},c={},ir=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));for(tt=this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOccurrence?this.model.enableLoadOnDemand?this._dataCount+1:t.isNullOrUndefined(this._appMainId)?parseInt(this._appId):this._appMainId+1:ir[0].AppTaskId,a=n("#"+this._id+"AppointmentAddEditWindow").find("#"+this._id+"_AddEditForm").get(0),wt=[],rt=[],o=0;o<a.length;o++)v=a[o].name,b=n(a[o]),v!=r&&(y=a[o].value,v!=""&&i[v]==null?(v==this._appointmentSettings.id&&(y=y==""?parseInt(tt):parseInt(y)),n(a[o]).hasClass("e-datepicker")?y=b.ejDatePicker("option","value"):n(a[o]).hasClass("e-timepicker")?y=b.ejTimePicker("option","value"):b.data("ejDropDownList")?y=b.ejDropDownList("model.value"):b.data("ejAutocomplete")&&(n(a[o])[0].id==this._id+"categorize"?rt.push(b.data("ejAutocomplete").getSelectedItems()):n(a[o])[0].id.indexOf(this._id+"_ownerfield_")==0&&wt.push(b.data("ejAutocomplete").getSelectedItems())),v!="StartDate"&&v!="EndDate"&&v!="StartTime"&&v!="EndTime"?i[v]=a[o].type!="checkbox"?y:n(a[o]).is(":checked"):c[v]=v=="StartDate"||v=="EndDate"?new Date(y):y):b.data("ejAutocomplete")&&(n(a[o])[0].id==this._id+"categorize"?rt.push(b.data("ejAutocomplete").getSelectedItems()):n(a[o])[0].id.indexOf(this._id+"_ownerfield_")==0&&wt.push(b.data("ejAutocomplete").getSelectedItems())));if(this.startutcValue=this.tempValue=null,this.model.showTimeZoneFields||(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),this.model.categorizeSettings.enable==!0&&this.model.categorizeSettings.allowMultiple!=!0&&(pi=this.model.categorizeSettings,categorizeDataIndex=this._findResourceIndex(pi.dataSource,this.model.categorizeSettings.text,i[this._appointmentSettings.categorize]),rt[0].push(this.model.categorizeSettings.dataSource[categorizeDataIndex]),rt[0].shift()),"null"in i&&delete i[null],bt=this._timeFormat(c.StartTime).split(":"),kt=this._timeFormat(c.EndTime).split(":"),i[this._appointmentSettings.startTime]=new Date(c.StartDate.setHours(parseInt(bt[0],10),parseInt(bt[1],10))),i[this._appointmentSettings.endTime]=new Date(c.EndDate.setHours(parseInt(kt[0],10),parseInt(kt[1],10))),i[this._appointmentSettings.recurrence]&&(i[this._appointmentSettings.recurrenceRule]=nt._recRule),this._publicMethodSave=!0,y=this._timeZoneSavingAppoint(i,c),i=y.obj,et=this._currentAction=="save"?"edit":this._currentAction,k=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),i[this._appointmentSettings.recurrenceRule]!=""&&!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&this.model.enableRecurrenceValidation&&(this._currentAction=="editSeries"||this._currentAction=="editOccurrence"||this._currentAction=="save"))if(this._currentAction=="editOccurrence"){var ct=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],fi=ct[this._appointmentSettings.recurrenceId]==null?ct.ParentId:ct[this._appointmentSettings.recurrenceId],ei=ct[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,g=new t.DataManager(this._processed).executeLocal((new t.Query).where(ei,t.FilterOperators.equal,fi)),rr=(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.endTime].getDate()!=i[this._appointmentSettings.startTime].getDate();rr&&(g=this._recurrenceAppSort(g));var g=this._appointmentRecurrenceSort(g),o=this._recuCollectionIndex(g,ct),ut=this._appointmentSettings;if(o==0?t.isNullOrUndefined(g[o+1])?!1:!(new Date(new Date(g[o+1][ut.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[ut.endTime]).setHours(0,0,0,0)).getTime()):o==g.length-1?!(new Date(new Date(g[o-1][ut.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[ut.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(g[o-1][ut.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[ut.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(g[o+1][ut.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[ut.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else if(!this._recurrenceValidate(i[this._appointmentSettings.recurrenceRule],k[0][this._appointmentSettings.recurrenceExDate]))return this._alertCreateError(),!1;if(this._currentAction==t.Schedule.Actions.EditOccurrence)this._objDate=k,ei=this._objDate[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,e=this._deleteOcurrence(this._objDate[0][ei],new Date(k[0][this._appointmentSettings.startTime])),i[this._appointmentSettings.recurrence]=1,i[this._appointmentSettings.recurrenceRule]=e[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+e[0].ParentId,i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId],i.Guid=this._appUid,i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExDate];else if(this._currentAction==t.Schedule.Actions.EditSeries){if(fi=k[0][this._appointmentSettings.recurrenceId]==null?k[0].ParentId:k[0][this._appointmentSettings.recurrenceId],e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,fi)),!t.isNullOrUndefined(e[0].RecurrenceExDate)&&this._seriesAlert)return this._seriesAlert=!1,t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._alertWindow.find(".e-alertbtn").find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"})),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("SeriesChangeAlert")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.addClass("e-seriesAlert"),this._alertWindow.ejDialog("open"),!1;t.isNullOrUndefined(e[0].RecurrenceExDate)||(this._seriesAlert=!0);i.AppTaskId=e[0].AppTaskId;i[this._appointmentSettings.id]=e[0][this._appointmentSettings.id];i.Guid=this._appUid;tt=e[0].AppTaskId;i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId];i[this._appointmentSettings.recurrenceExDate]=null;i[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(nt._recRule)||nt._recRule==""?e[0][this._appointmentSettings.recurrenceRule]:nt._recRule}if(this._currentAction!=t.Schedule.Actions.Add){if(i.Guid=k[0].Guid,i.AppTaskId=k[0].AppTaskId,i[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?k[0][this._appointmentSettings.id]:i[this._appointmentSettings.id],h=n.extend(h,i),this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:et}))return this._appointmentAddWindow.ejDialog("close"),!1}else if(i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,this._trigger("actionBegin",{data:i,requestType:"appointmentSave"}))return this._appointmentAddWindow.ejDialog("close"),!1;if(u=[],this._startTimezone!=this._endTimezone?i[this._appointmentSettings.endTime]=y.cloneEnddiffer:"",parId=this._currentAction==t.Schedule.Actions.Add?tt:k[0].ParentId,!t.isNullOrUndefined(this.model.categorizeSettings)&&rt.length>0&&!t.isNullOrUndefined(rt[0][0])||this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?u=this._getResCategorySaveData(rt,wt,i,tt,parId,bt,kt):(dt=this._addAppData(i,tt,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),parId),this._currentAction==t.Schedule.Actions.EditOccurrence&&(dt[this._appointmentSettings.id]=dt.AppTaskId),u.push(dt)),this._currentAction==t.Schedule.Actions.Add&&this._trigger("beforeAppointmentCreate",{appointment:u,currentAction:et}))return this._appointmentAddWindow.ejDialog("close"),!1;if(this._currentAction!=t.Schedule.Actions.Add){if(this._currentAction!=t.Schedule.Actions.EditOccurrence)oi=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.notEqual,h[this._appointmentSettings.id])),si=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,h[this._appointmentSettings.id]));else for(s=0;s<u.length;s++)si=new t.DataManager(u).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,h[this._appointmentSettings.id])),oi=new t.DataManager(u).executeLocal((new t.Query).where("ParentId",t.FilterOperators.notEqual,h[this._appointmentSettings.id]));if(_batch={added:oi,changed:si},this._trigger("beforeAppointmentChange",{appointment:_batch,currentAction:et}))return this._appointmentAddWindow.ejDialog("close"),!1}if(ht=this._checkAvailability(u[0]),u[this._appointmentSettings.startTime]>u[this._appointmentSettings.endTime]||ht.length>0)return this._showBlockAlert&&this._alertBlockError(),!1;if(this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOccurrence){for(c=[],d=0;d<u.length;d++)gt=u[d][this._appointmentSettings.startTimeZone],gt!=this.model.timeZone?c.push(this._timeZoneAppointments(u[d],"")):c.push(u[d]),new t.DataManager(this._currentAppointmentData).update("AppTaskId",u[d]);e=[];this._currentAction==t.Schedule.Actions.EditOccurrence&&(hi=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,this._parentId)),new t.DataManager(this._currentAppointmentData).update("AppTaskId",hi[0]),e.push(this._timeZoneAppointments(hi[0],"")));var ci=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:c,changed:e,deleted:[]},ci,this.model.appointmentSettings.query._fromTable),wi=[];for(l=0;l<c.length;l++)wi=gt!=this.model.timeZone?this._timeZoneAppointments(c[l],"reverse"):c[l],new t.DataManager(this._currentAppointmentData).update("AppTaskId",wi);for(li=[],l=0;l<e.length;l++)li=gt!=this.model.timeZone?this._timeZoneAppointments(e[l],"reverse"):e[l],new t.DataManager(this._currentAppointmentData).update("AppTaskId",li);for(p=0,bi=u.length;p<bi;p++)for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u[p]),ni=this._processed.filter(function(n){return n.Guid==u[p].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ni},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ni},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ni},"Guid"),this._maxId=t.isNullOrUndefined(this._maxId)?u[p].AppTaskId:this._maxId,this._appointmentProcessing(u[p]),this._currentViewAppointments=this._appointmentCount(),ot=this._currentViewAppointments.filter(function(n){return n.ParentId==u[p].ParentId}),ft=0,st=ot.length;ft<st;ft++)this._refreshDayAppointments(ot[ft]);this._trigger("appointmentCreated",{appointment:u[0],requestType:"appointmentSaved"});this._trigger("actionComplete",{data:u,requestType:"appointmentSave"});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(f=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(r))f._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(f._dateFormat(r.added),e=0,o=r.added.length;e<o;e++)u[0][f._appointmentSettings.id]=r.added[e][f._appointmentSettings.id],u[0][f._appointmentSettings.recurrence]||(u[0].ParentId=r.added[e][f._appointmentSettings.id]),new t.DataManager(f._processed).update("Guid",u[0])}))}else if(this._currentAction==t.Schedule.Actions.Save||this._currentAction==t.Schedule.Actions.EditSeries){var ai=[],h=[],vi=[];for(s=0;s<u.length;s++)ki=this._currentAction==t.Schedule.Actions.Save?u[s].Guid:u[s][this._appointmentSettings.recurrenceId],di=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId,e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(di,t.FilterOperators.equal,ki)),!t.isNullOrUndefined(e)&&e.length>0?h.push(u[s]):ai.push(u[s]);if(this._currentAction==t.Schedule.Actions.EditSeries)for(s=0;s<h.length;s++)for(gi=new t.DataManager(this._currentAppointmentData).executeLocal(t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+u[s][this._appointmentSettings.recurrenceId],!0))),vi=vi.concat(gi),this._appointmentAddWindow.find(".recurbutton").click(),h[s][this._appointmentSettings.recurrenceRule]=nt._recRule,h[s][this._appointmentSettings.recurrenceExDate]=null,new t.DataManager(this._currentAppointmentData).remove("ParentId",h[s].ParentId),lt=this._processed.filter(function(n){return n.ParentId==h[s].ParentId}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:lt},"Guid"),ti=this._appointmentCount(lt),at=0,st=ti.length;at<st;at++)this._appointmentRemove(ti[at]),this._refreshDayAppointments(ti[at]);for(vt=[],yt=[],d=0;d<ai.length;d++)vt.push(this._timeZoneAppointments(ai[d],""));for(ii=0;ii<h.length;ii++)yt.push(this._timeZoneAppointments(h[ii],""));for(ci=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:vt,changed:yt,deleted:vi},ci,this.model.appointmentSettings.query._fromTable),l=0;l<vt.length;l++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(vt[l],"reverse"));for(p=0;p<yt.length;p++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(yt[p],"reverse"));if(h.length>0){for(it=0;it<u.length;it++)for(new t.DataManager(this._currentAppointmentData).remove("Guid",u[it]),ri=this._processed.filter(function(n){return n.Guid==u[it].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ri},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ri},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ri},"Guid"),this._currentAppointmentData.push(u[it]),this._appointmentProcessing(u[it]),this._appointmentRemove(u[it]),this._currentViewAppointments=this._appointmentCount(),ot=this._currentViewAppointments.filter(function(n){return n.ParentId==u[it].ParentId}),ft=0,st=ot.length;ft<st;ft++)this._refreshDayAppointments(ot[ft]);this._trigger("appointmentChanged",{appointment:h[0],requestType:"appointmentChanged",currentAction:et});this._trigger("actionComplete",{data:h,requestType:"appointmentEdit",currentAction:et});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(f=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(r))f._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(f._dateFormat(r.added),e=0,o=r.added.length;e<o;e++)u[0][f._appointmentSettings.id]=r.added[e][f._appointmentSettings.id],u[0][f._appointmentSettings.recurrence]||(u[0].ParentId=r.added[e][f._appointmentSettings.id])}))}}this._clearFields();this._appointmentAddWindow.ejDialog("close")}this.element.find("div.e-draggableworkarea tr").find("td").hasClass("e-selectedCell")&&this._processFocus();this.model.orientation=="horizontal"&&this.currentView()!="agenda"&&this.element.find(".e-draggableworkarea").offset().top>this.element.find(".e-workcellstab").offset().top&&(nr=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-nr+"px"));this._recRule="";this.model.showAppointmentNavigator&&this._nextPrevButton()},_alertCreateError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("CreateError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_timeZoneSavingAppoint:function(n,i){var s,f,r,e;if(this.model.appointmentSettings.applyTimeOffset){if(this._startTimezone=n[this._appointmentSettings.startTimeZone],this._endTimezone=n[this._appointmentSettings.endTimeZone],!t.isNullOrUndefined(this._startTimezone)&&this._startTimezone!=""){var o=this._startTimezone.indexOf("UTC")!=-1?this._startTimezone.split(" ")[1].split(":"):this._startTimezone.split(":"),l=parseInt(o[0]),a=parseInt(o[1]),u=l*60+a;if(this.model.timeZone==null?(s=(new Date).getTimezoneOffset()-this._timeZoneOffset,r=this._minToHour(s+u)):(f=this.model.timeZone.indexOf("UTC")!=-1?this.model.timeZone.split(" ")[1].split(":"):this.model.timeZone.split(":"),r=this._minToHour(u),r.h=r.h-parseInt(f[0]),r.m=r.m-parseInt(f[1])),new Date(n[this._appointmentSettings.startTime].setHours(n[this._appointmentSettings.startTime].getHours()-r.h,n[this._appointmentSettings.startTime].getMinutes()-r.m)),this._startTimezone!=this._endTimezone&&this._publicMethodSave){this.startutcValue=null;this.tempValue=null;var h=this._endTimezone.indexOf("UTC")!=-1?this._endTimezone.split(" ")[1].split(":"):this._endTimezone.split(":"),v=parseInt(h[0]),y=parseInt(h[1]),p=v*60+y,w=u-p,b=new Date(i.StartDate),k=new Date(n[this._appointmentSettings.startTime]),c=new Date(i.EndDate);duration=new Date(c.setMinutes(c.getMinutes()+w));duration=new Date(duration.setMinutes(duration.getMinutes()-(r.h*60+r.m)));e=duration}else new Date(n[this._appointmentSettings.endTime].setHours(n[this._appointmentSettings.endTime].getHours()-r.h,n[this._appointmentSettings.endTime].getMinutes()-r.m))}return{obj:n,cloneEnddiffer:e}}return{obj:n,cloneEnddiffer:e}},_renderAllDayAppointments:function(){var s=this.element.find(".e-workcells").width()-20,f,r,o,e,i,u,n;if(this.level=0,f=this._dateRender,this._renderedAllDay=[],allDayCount=[],this.element.find(".e-alldayappointment").remove(),r=this._appointmentSort(this._processed),this.model.group||(this.res1=["0"]),this._resWorkWeek)for(o=0,e=0,i=0;i<this.res1.length;i++)for(o+=t.isNullOrUndefined(this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,e;e<o;e++)for(n=0;n<r.length;n++)this._getMultipleResourceAlldayApp(f,e,i,n),t.isNullOrUndefined(this.allDayCount[0])?"":allDayCount.push(this.allDayCount[0]);else for(i=0;i<this.res1.length;i++)for(u=0;u<f.length;u++)for(n=0;n<r.length;n++)this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?(this._getMultipleResourceAlldayApp(f,u,i,n),t.isNullOrUndefined(this.allDayCount[0])?"":allDayCount.push(this.allDayCount[0])):t.format(new Date(f[u]),this._pattern.d,this.model.locale)==t.format(new Date(r[n][this._appointmentSettings.startTime]),this._pattern.d,this.model.locale)&&(r[n][this._appointmentSettings.allDay]===!0||this._findAllDayApp(r[n]))&&(this._setAllDayPos(r[n],u,i),allDayCount.push(n));this.allDayLevel=allDayCount.length;allDayCount.length==0&&this.level==0&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"));this._reRenderScroller()},_renderSingleApp:function(){this.element.find(".e-prevapp,.e-nextapp").css("display","none");this._dataProcessing(this._currentAppointmentData);this._renderAppointmentAll()},_timeFormat:function(n){var e=t.parseDate(n,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale),i,r,o,u,f;return e?(i=e.getHours(),r=e.getMinutes()):(i=Number(n.match(/^(\d+)/)[1]),r=Number(n.match(/:(\d+)/)[1]),t.isNullOrUndefined(n.split(" ")[1])||(o=n.match(/\s(.*)$/)[1],t.isNullOrUndefined(this._culture.calendar.AM)||t.isNullOrUndefined(this._culture.calendar.PM)||(o==this._culture.calendar.PM[0]&&i<12&&(i=i+12),o==this._culture.calendar.AM[0]&&i==12&&(i=i-12)))),u=i.toString(),f=r.toString(),i<10&&(u="0"+u),r<10&&(f="0"+f),u+":"+f},_processEscapeKey:function(){t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.find(".e-error").remove();this._processFocus();this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")},_processFocus:function(){var h=this.element.find("div.e-selectedAppointment"),s,a;if(h.length!=0&&h.focus(),this.element.find("td.e-selectedCell").hasClass("e-workcells")){var u=this.element.find("div.e-draggableworkarea tr"),c=u.length-1,r,i,l,e,f,o=this.currentView(),v=this;this.element.find("td.e-selectedCell").each(function(t,s){var h=n(s).index(),a;if(h!=null&&!isNaN(h))if(r==null?(r=h,l=n(s).parent()[0].rowIndex):r<h?r=r:r!=h&&(r=h,l=n(s).parent()[0].rowIndex),i==null){if(i=h,o!="month")for(f=parseInt(i),a=0;a<=c;a++)n(u[a].cells[f]).hasClass("e-selectedCell")&&(e=a)}else if(i>h)i=i;else if(i!=h&&(i=h,o!="month"))for(f=parseInt(i),a=0;a<=c;a++)n(u[a].cells[f]).hasClass("e-selectedCell")&&(e=a)});o!="month"?n(u[e].cells[i]).attr("tabIndex",0).focus():(s=u.find("td.e-selectedCell"),a=parseInt(s.length)-1,n(s[a]).attr("tabIndex",0).focus())}else this.element.focus(),this.element.find("td.e-selectedCell").attr("tabIndex",0).focus(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("isOpened")&&this._appointmentAddWindow.find(".subject").focus()},_clearFields:function(){this._appointmentAddWindow.find(".subject").val("");this._appointmentAddWindow.find(".id").val("");this._appointmentAddWindow.find(".e-description").val("").css("height","");this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",new Date);this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",new Date);this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0});this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date,this._pattern.t,this.model.locale));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date,this._pattern.t,this.model.locale));this._appointmentAddWindow.find(".recurrence,.weekdays").ejCheckBox({checked:!1,enabled:!0});this._appointmentAddWindow.find(".e-repeatlbl").removeClass("e-disable");this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1});this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList("clearText");this._appointmentAddWindow.find("."+this._id+"summary").css("display","none");this._appointmentAddWindow.find(".e-recurFinalRule").html("");this._appointmentAddWindow.find(".e-recuredit").hide();this._appointmentAddWindow.find(".e-categorizevalue").ejAutocomplete("clearText")},_getNumericModel:function(){return numericModel={width:"100px",minValue:1,value:1,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,localize:this.model.locale}},_deleteApp:function(i){var s=this._actionType==t.Schedule.Actions.DeleteSeries?t.Schedule.Actions.DeleteSeries:t.Schedule.Actions.Delete,r,f,e,h,c,o,v,u,y,p;if(this._trigger("actionBegin",{id:i,requestType:"appointmentDelete",currentAction:s})||(r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i)),r.length==0)||this._trigger("beforeAppointmentRemove",{appointment:r[0],currentAction:s}))return!1;if(f=this._getAppointmentByParentId(i),f[this._appointmentSettings.recurrence])var l=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],a=r[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,w=t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(a,t.FilterOperators.equal,l)),e=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:[],changed:[],deleted:w},e,this.model.appointmentSettings.query._fromTable);else e=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.remove(e,f[e],this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove(e,f[e]);if(this._refreshCellsHeight(),this.currentView()!="agenda")if(this._currentAppointmentData.length>0)for(u=r[0][this._appointmentSettings.recurrence]?this._processed.filter(function(n){return n[a]==l}):this._processed.filter(function(n){return n.Guid==i}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:u},"Guid"),c=this._appointmentCount(u),o=0,v=c.length;o<v;o++)this._appointmentRemove(c[o]),this._refreshDayAppointments(c[o]);else this._processed=[],this._renderedApp=[],this._renderedAllDay=[],this.element.find("div.e-appointwrapper").remove(),this._appointmentRemove(r[0]),this._refreshDayAppointments(r[0]);else new t.DataManager(this._processed).remove("Guid",i),u=new t.DataManager(this._processed).executeLocal((new t.Query).where(t.Predicate("ParentId",t.FilterOperators.equal,r[0].ParentId))),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:u},"Guid"),this._renderAgendaContent();this._trigger("appointmentRemoved",{appointment:f,requestType:"appointmentDeleted",currentAction:s});this._trigger("actionComplete",{data:f,requestType:"appointmentDelete",currentAction:s});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&(y=this,h.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&y._processUrlBinding(i)}));this.model.timeScale.enable&&((r[0][this._appointmentSettings.endTime]-r[0][this._appointmentSettings.startTime])/36e5>24||r[0][this._appointmentSettings.allDay])&&this.currentView()!="month"&&!this._isCustomMonthView()&&this.currentView()!="agenda"&&this.allDayLevel==0&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this._reRenderScroller());this._currentViewAppointments=this._appointmentCount();this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.showOverflowButton||this.model.orientation!="horizontal"||this.currentView()=="agenda"||(p=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-p+"px"));this._appUid=null;this._actionType=""},_appointmentCount:function(n){var i=this.model.orientation=="horizontal"&&(this.currentView()=="month"||this._isCustomMonthView())?this.monthDays:this._resWorkWeek?this._renderDates:this._dateRender,u=t.isNullOrUndefined(n)?this._appointmentSort(this._processed):n,r=this.currentView()=="agenda"?new Date(new Date(this.currentDate()).setHours(0,0,0)):new Date(i[0]),f=this.currentView()=="agenda"?new Date(new Date(new Date(this.currentDate()).setDate(r.getDate()+(this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0))).setHours(23,59,59)):new Date(new Date(i[i.length-1]).setHours(23,59,59)),e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,r).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,f);return new t.DataManager(u).executeLocal((new t.Query).where(e))},_reRenderAllDayAppointments:function(){this._alldayLevel=this.level==1?!0:!1;this.model.showAllDayRow&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments();this._bindAppointmentAction()},_appointmentResizeStart:function(i){if(this.model.enableAppointmentResize){this._tooltipEvents("disable");this._appointdata=n(i.target).parent();var u=n(i.target).parent().attr("guid"),f=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,u))),r={element:n(i.target).parent(),appointment:f[0]};if(this._trigger("actionBegin",{data:r,requestType:"appointmentResize"})||this._trigger("resizeStart",r))return this._tooltipEvents("enable"),!1;i.preventDefault();!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this.resizeStart=!0;n(i.target).hasClass("e-lefthandle")||n(i.target).hasClass("e-righthandle")?(this.resize=i.pageX,this.appoint_width=n(i.target).parent().width(),this.appoint_left=parseInt(n(i.target).parent()[0].style.left),this._appointleft=parseInt(n(n(i.target).parent()[0]).offset().left),this._appointright=parseInt(n(n(i.target).parent()[0]).css("right")),this.model.orientation=="horizontal"&&this.model.enableRTL?n(i.target).hasClass("e-lefthandle")?this._rightResizing=!0:this._leftResizing=!0:n(i.target).hasClass("e-lefthandle")?this._leftResizing=!0:this._rightResizing=!0):(n(i.target).hasClass("e-tophandle")||n(i.target).hasClass("e-bottomhandle"))&&(this.resize=i.pageY,this.appoint_height=n(i.target).parent().height(),this.appoint_top=parseInt(n(i.target).parent()[0].style.top),n(i.target).hasClass("e-tophandle")?this._topResizing=!0:this._bottomResizing=!0);this._curElmt=n(i.target).parent();this.element.find(".e-workcells").removeClass("e-selectedCell,e-mousehover");n(document).on(t.eventType.mouseMove,n.proxy(this._appointmentResizing,this));n(document).on(t.eventType.mouseUp,n.proxy(this._appointmentResizeStop,this));if(n(i.target).hasClass("e-rowcursor")||n(i.target).hasClass("e-columncursor"))return!1}},_appointmentResizing:function(i){var o=n(i.target),u={element:o.parent(),interval:10},r,f,e;t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");r=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-alldayappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");n(".e-scheduleAppGlassy").length==0&&(r.find(".e-schedulemouseclose").addClass("e-schedulemouseclosetemp").removeClass("e-schedulemouseclose e-icon"),r.clone().prop("id","cloneElement").appendTo(r.parent()),r.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose").appendTo(r.parent()),this._topResizing||this._bottomResizing?(this.model.enableRTL?r.css("right","0"):r.css("left","0"),r.css("width","98%")):(this._rightResizing||this._leftResizing)&&(this.model.orientation!="horizontal"?this.currentView()==="month"||this._isCustomMonthView()?this._appointmentResizeHeight(r,-this.element.find(".e-monthheader").height(),"e-monthcells"):this.model.timeScale.enable?(r.css("top",this.element.find(".e-headerarearow").height()-this.element.find(".e-alldaycells").height()-2),r.css("height",this.element.find(".e-alldaycells").height()-2)):r.css("height",this.element.find(".e-monthcells").height()-2):this._appointmentResizeHeight(r,0,"e-workcells")));r=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-monthcells")||n(i.target).hasClass("e-alldayappointment")||n(i.target).hasClass("e-alldaycells")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");f=this.element.find(".e-workcells").height();e=n(r[0]).height()/f;this._topResizing?e>0&&!n(i.target).hasClass("e-alldaycells")&&!n(i.target).hasClass("e-apptext")&&(this._curElmt.height(this.appoint_height+this.resize-i.pageY+3),this._curElmt.css("top",this.appoint_top-(this.resize-i.pageY)-3)):this._bottomResizing?this._curElmt.height(this.appoint_height+(i.pageY-this.resize)+2):this._rightResizing?this.model.orientation=="horizontal"&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+this.resize-i.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-i.pageX)-3)):(this._curElmt.width(this.appoint_width+(i.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(i.pageX-this.resize)-2)):this._leftResizing&&(this.model.orientation=="horizontal"&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+(i.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(i.pageX-this.resize)-2)):(this._curElmt.width(this.appoint_width+this.resize-i.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-i.pageX)-3)));this._trigger("resize",u);this._resizeInterval=u.interval;this._curElmt.hasClass("e-appointment")&&this._appointmentCurrentTimeUpdate()},_appointmentResizeHeight:function(t,i,r){if(t.length>0){var u=this.model.showOverflowButton?this.element.find("."+r):t.closest("td");t.css("top",i).css("height",n(u).height()-2)}},_appointmentCurrentTimeUpdate:function(){var a=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(this._curElmt.attr("id").split("_")[1])))[0],r=new Date(a[this._appointmentSettings.startTime]),i=new Date(a[this._appointmentSettings.endTime]),s=this.element.find(".e-workcells").outerHeight(),h=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),w,o,b,l,d,u;if(this.currentView()!=="month"&&!this._isCustomMonthView())var e=this.element.find(".e-draggableworkarea"),g=n(this._curElmt[0]).offset().top,v=e.height()+e.scrollTop(),nt=n(this._curElmt[0]).outerHeight(),y=g-e.offset().top+e.scrollTop(),p=y-s/this.model.timeScale.minorSlotCount<v?y:v-nt;if(this._topResizing)o=p*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*s),r.setHours(parseInt(this.model.startHour)+parseInt(o/60)),r.setMinutes(parseInt(o%60)),h>=this._resizeInterval?r.setMinutes(Math.round(r.getMinutes()/this._resizeInterval)*this._resizeInterval):r.setMinutes(r.getMinutes()/this._resizeInterval*this._resizeInterval);else if(this._bottomResizing)w=n(this._curElmt[0]).outerHeight()/s,o=(p+w*s)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*s),i.setHours(parseInt(this.model.startHour)+parseInt(o/60)),i.setMinutes(o%60),h>=this._resizeInterval?i.setMinutes(Math.round(i.getMinutes()/this._resizeInterval)*this._resizeInterval):i.setMinutes(i.getMinutes()/this._resizeInterval*this._resizeInterval);else if(this._rightResizing){if(b=this.model.endHour-this.model.startHour==24?this._curElmt.width()-this.appoint_width:this._curElmt.width(),u=b*60/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),this.model.endHour-this.model.startHour==24?(i.setHours(new Date(i).getHours()+parseInt(u/60)),i.setMinutes(new Date(i).getMinutes()+parseInt(u%60))):(i.setHours(new Date(r).getHours()+parseInt(this._curElmt.width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),i.setMinutes(new Date(r).getMinutes()+parseInt(u%60))),h>=this._resizeInterval?i.setMinutes(Math.round(i.getMinutes()/this._resizeInterval)*this._resizeInterval):i.setMinutes(i.getMinutes()/this._resizeInterval*this._resizeInterval),i>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))&&(i=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))),this.model.endHour-this.model.startHour!=24){var tt=parseInt((this._curElmt.offset().left+(e.scrollLeft()-e.offset().left)+this._curElmt.width())/this.element.find(".e-workcells").width())-1,c=parseInt(tt/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),it=new Date(r),k=new Date(i).getHours()>=this.model.endHour?(this._dateRender[c]-new Date(new Date(new Date(r).setHours(0,0,0,0))).getTime())/864e5:0,rt=this.currentView()=="workweek"?(k-1)*(this.model.endHour-this.model.startHour):0,f=new Date(i).getHours()>=this.model.endHour?new Date(new Date(it).setHours(new Date(r).getHours()+rt+parseInt(n(this._curElmt).width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))+k*(24-this.model.endHour+this.model.startHour))):i;new Date(i).getHours()>=this.model.endHour&&f.setMinutes(new Date(r).getMinutes()+parseInt(u%60));new Date(new Date(f).setHours(0,0,0,0)).getTime()!=new Date(this._dateRender[c]).getTime()&&(f=new Date(this._dateRender[c]).setHours(new Date(f).getHours(),new Date(f).getMinutes(),new Date(f).getSeconds(),new Date(f).getMilliseconds()));i=new Date(f)}}else this._leftResizing&&(l=n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left<n(this._curElmt).offset().left?this._curElmt.offset().left-this._appointleft:n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left-this._appointleft,this.model.enableRTL&&(d=this._curElmt.width()-this.appoint_width,l=-d),u=l*60/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),r.setHours(parseInt(new Date(r).getHours())+parseInt(u/60)),r.setMinutes(new Date(r).getMinutes()+parseInt(u%60)),h>=this._resizeInterval?r.setMinutes(Math.round(r.getMinutes()/this._resizeInterval)*this._resizeInterval):r.setMinutes(r.getMinutes()/this._resizeInterval*this._resizeInterval),r<new Date(this._dateRender[0])&&(r=new Date(this._dateRender[0])));this.model.enableRTL?(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","left").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px")):(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","right").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px"));this._resizeNewStartTime=r;this._resizeNewEndTime=i},_leftRightResize:function(t,i,r,u,f,e){var s=this._leftResizing?f:e,o=this._leftResizing?e:f,p,l,v,a,y,h,b,c;if(this._resWorkWeek?(h=i.offset(),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none"),p=this._leftResizing?t.elementFromPoint(h.left-n(t).scrollLeft(),h.top-n(t).scrollTop()):t.elementFromPoint(h.left+i.width()-n(t).scrollLeft(),h.top-n(t).scrollTop()),l=this._leftResizing?Math.floor(i.offset().left/this.element.find(".e-alldaycells").width())-Math.floor(i.width()/this.element.find(".e-alldaycells").width()):Math.floor(i.offset().left/this.element.find(".e-alldaycells").width())+Math.floor(i.width()/this.element.find(".e-alldaycells").width()),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible")):l=this._leftResizing?r*u:r==this.res1.length-1?(r+1)*u-1:(r+1)*u,this.model.enableRTL)if(this._resWorkWeek){y=n.extend(!0,[],this._dateRender);y.reverse();h=i.offset();this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none");var p=this._rightResizing?t.elementFromPoint(h.left-n(t).scrollLeft(),h.top-n(t).scrollTop()):t.elementFromPoint(h.left+i.width()-n(t).scrollLeft(),h.top-n(t).scrollTop()),w=n.grep(p,function(t){if(n(t).closest("td").hasClass("e-alldaycells"))return t}),l=this.element.find(".e-alldaycells").length-1-n(w[0]).index();this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible");newEndTime=new Date(y[l]);newEndTime.setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())}else b=n(i[0]).width()-this.appoint_width,c=Math.round(n(i[0]).width()/this.element.find(".e-alldaycells").width())-1,newEndTime=this._rightResizing?new Date(e):new Date(s),this._rightResizing?newEndTime.setDate(new Date(newEndTime).getDate()-c):newEndTime.setDate(new Date(newEndTime).getDate()+c),newEndTime.setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()),newEndTime>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()))?newEndTime=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())):newEndTime<new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()))&&(newEndTime=new Date(new Date(this._dateRender[0]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())));else this._rightResizing?(a=i[0].offsetLeft+n(i[0]).width(),this._resWorkWeek||(c=Math.floor(a/this.element.find(".e-alldaycells").width())-r*u),v=r==this.res1.length-1?n(this.element.find(".e-alldaycells")[l]).offset().left+this.element.find(".e-alldaycells").width():n(this.element.find(".e-alldaycells")[l]).offset().left):(a=n(this.element.find(".e-alldaycells")[l]).offset().left,v=n(i[0]).offset().left),v>=a?(newStartTime=new Date(this._dateRender[0]),!this._resWorkWeek&&this._leftResizing&&(a=n(i[0]).offset().left-n(this.element.find(".e-alldaycells")[r*u]).offset().left,c=Math.round(a/(this.element.find(".e-alldaycells").width()+1))),this.model.workWeek.length>0?this._resWorkWeek?(newStartTime=new Date(this._dateRender[l]),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(this._dateRender[c]).getDate()),newStartTime.setMonth(new Date(this._dateRender[c]).getMonth()),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(newStartTime).getDate()+(c>=u?c-1:c)),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds()))):(this._rightResizing?this._rightResizing=!1:this._leftResizing=!1,this.model.enableRTL?newEndTime=e:newStartTime=f);return this.model.enableRTL?newEndTime:newStartTime},_appointmentResizeStop:function(i){var ct,hi,ni,ti,fr,er,pt,ii,vi,s,bt,yt,ri,v,k,wt,ui,o,pi,ei,lt,wi,bi,oi,si,rt,tt,c,l,ot,kt,it,d,dt,ki,gt,st,i,ht,g;this._tooltipEvents("enable");try{ct=this.element.find(".e-draggableworkarea");this.resizeStart=!1;n(document).off(t.eventType.mouseMove,n.proxy(this._appointmentResizing,this));n(document).off(t.eventType.mouseUp,n.proxy(this._appointmentResizeStop,this));var u=this._appointmentSettings,di=this.element.find(".e-workcellstab"),gi=di.find("tr").length*this.element.find(".e-workcells").height(),h=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-alldayappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");h.length==0&&(h=this._appointdata);h.attr("guid")!=this._appointdata.attr("guid")&&(h=this._appointdata);this._appUid=h.attr("guid");var a=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),et=a.length>1?!0:!1,w=a[0][u.recurrence]&&a[0][u.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):a[0][u.recurrence]?a[0]:this._getAppointmentByParentId(this._appUid),b=this.currentView()==="week"||this.currentView()==="month"||this._isCustomMonthView()?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="workweek"&&this.model.workWeek.length>0?this.model.workWeek.length:1;if(b=this.currentView()=="customview"&&this._renderDays<=7?this._renderDays:b,this._resWorkWeek&&(ni=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,a[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]])),hi=t.isNullOrUndefined(ni[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:ni[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],b=hi.length),w!=null||w!==r){var lr=w[this._appointmentSettings.startTime].getDate()<new Date(w[this._appointmentSettings.endTime]).getDate()?!0:!1,e=new Date(w[this._appointmentSettings.startTime]),f=new Date(w[this._appointmentSettings.endTime]);et&&a[0][u.recurrence]?(ti=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,a[0].Guid))),e=new Date(ti[0][this._appointmentSettings.startTime]),f=new Date(ti[1][this._appointmentSettings.endTime])):a[0][u.recurrence]&&(e=new Date(a[0][this._appointmentSettings.startTime]),f=new Date(a[0][this._appointmentSettings.endTime]));this.element.find("[guid="+a[0].Guid+"]").removeClass("e-selectedAppointment");var y=w[this._appointmentSettings.startTime],p=w[this._appointmentSettings.endTime],ci=n(h[0]).outerHeight(),vt=this.element.find(".e-workcells").outerHeight();if(this.currentView()!=="month"&&!this._isCustomMonthView())var nr=n(h[0]).offset().top,li=ct.height()+ct.scrollTop(),ai=nr-ct.offset().top+ct.scrollTop(),ut=ai-vt/this.model.timeScale.minorSlotCount<li?ai:li-ci;ut=t.isNullOrUndefined(ut)?0:ut;var tr=n(h[0]).outerHeight()/vt,ir=(ut+tr*vt)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*vt)/30,rr=ci-parseInt(ir),ur=ut+rr;if(this._topResizing)fr=this._topResizing,ut>0?e=this._resizeNewStartTime:e.setHours(0,0,0),this._topResizing=!1;else if(this._bottomResizing)er=this._bottomResizing,ut>=0&&ur<gi?f=this._resizeNewEndTime:f.setHours(23,59,59),this._bottomResizing=!1;else if(this._leftResizing){if(this.model.orientation=="vertical"){if(s=this.model.group?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,w[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-1].trim()]):0,this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable)this.model.enableRTL?f=this._leftRightResize(document,h,s,b,y,p):e=this._leftRightResize(document,h,s,b,y,p);else if(yt=this.model.enableRTL?n(this.element.find(".e-monthcells")[(s+1)*b-1]).offset().left:n(this.element.find(".e-monthcells")[s*b]).offset().left,n(h[0]).offset().left>yt)if(this.model.enableRTL)if(this.model.showWeekend)v=Math.round((n(h[0]).width()-this.appoint_width)/this.element.find(".e-monthcells").width()),f.setDate(new Date(f).getDate()+v),f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds());else{for(pt=this._getWeekDays();pt.indexOf(f.getDay())<0;)f=new Date(new Date(f).getTime()+864e5);k=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0))+v;f=new Date(this._dateRender[k]);f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds())}else if(this._resize=!0,e=new Date(this._firstweekdate(new Date(a[0][u.startTime]))),this._resize=!1,v=Math.round((n(h[0]).offset().left-n(this.element.find(".e-monthcells")[s*b]).offset().left)/this.element.find(".e-monthcells").width()),this.model.showWeekend)e.setDate(e.getDate()+v),e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds());else{for(pt=this._getWeekDays();pt.indexOf(e.getDay())<0;)e=new Date(new Date(e).getTime()+864e5);k=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+v;e=new Date(this._dateRender[k]);e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds())}}else ii=n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left<n(h[0]).offset().left?n(h[0]).offset().left-this._appointleft:n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left-this._appointleft,this.model.enableRTL&&(vi=n(h[0]).width()-this.appoint_width,ii=-vi),this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?(v=Math.round(ii/(this.element.find(".e-workcells").width()+1)),this.model.showWeekend?e.setDate(new Date(e).getDate()+v):(k=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+v,wt=new Date(new Date(this._dateRender[k]).setHours(new Date(e).getHours(),new Date(e).getMinutes(),new Date(e).getSeconds())),e=new Date(wt))):e=this._resizeNewStartTime;this._leftResizing=!1}else this._rightResizing&&(this.model.orientation=="vertical"?(s=this.model.group?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,w[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-1].trim()]):0,this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?this.model.enableRTL?e=this._leftRightResize(document,h,s,b,y,p):f=this._leftRightResize(document,h,s,b,y,p):(bt=this.element.find(".e-monthcells").width(),yt=this.model.enableRTL?n(this.element.find(".e-monthcells")[s*b]).offset().left+bt:s==this.res1.length-1?n(this.element.find(".e-monthcells")[(s+1)*b-1]).offset().left+bt:n(this.element.find(".e-monthcells")[(s+1)*b]).offset().left,yt>=n(h[0]).offset().left+n(h[0]).width()&&(v=Math.round((n(h[0]).width()-this.appoint_width)/bt),this.model.enableRTL?this.model.showWeekend?(e.setDate(new Date(e).getDate()-v),e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds())):(k=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))-v,e=new Date(this._dateRender[k]),e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds())):this.model.showWeekend?(f.setDate(new Date(f).getDate()+v),f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds())):(k=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0))+v,f=new Date(this._dateRender[k]),f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds()))))):(ri=this.model.endHour-this.model.startHour==24?n(h[0]).width()-this.appoint_width:n(h[0]).width(),this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?(ri=n(h[0]).width()-this.appoint_width,v=Math.round(ri/(this.element.find(".e-workcells").width()+1)),this.model.showWeekend?f.setDate(new Date(f).getDate()+v):(k=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0))+v,wt=new Date(new Date(this._dateRender[k]).setHours(new Date(f).getHours(),new Date(f).getMinutes(),new Date(f).getSeconds())),f=new Date(wt))):f=this._resizeNewEndTime),this._rightResizing=!1);if((e>=f||n(h[0]).width()==0)&&(e=a[0][u.startTime],f=a[0][u.endTime]),e.getTime()==a[0][u.startTime].getTime()&&f.getTime()==a[0][u.endTime].getTime())return this.element.find("#cloneElement").length>0&&(ui=this.element.find(".e-monthappointment").length>1?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),this.model.enableRTL?this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:ui,top:this.element.find("#cloneElement").css("top"),right:this.element.find("#cloneElement").css("right")}):this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:ui,top:this.element.find("#cloneElement").css("top"),left:this.element.find("#cloneElement").css("left")}),this._curElmt.find(".e-apptext").replaceWith(this.element.find("#cloneElement").find(".e-apptext")).prop("style",!1),this._curElmt.find(".e-apptime").html(this.element.find("#cloneElement").find(".e-apptime").text()).prop("style",!1),this._curElmt.css("width",this.element.find("#cloneElement")[0].style.width),this._curElmt.hasClass("e-alldayappointment")&&this._curElmt.height(19),this.element.find("#cloneElement").remove(),n(h[0]).find(".e-schedulemouseclosetemp").addClass("e-schedulemouseclose e-icon").removeClass("e-schedulemouseclosetemp")),!1;this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove();this._refreshCellsHeight();var yi=new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1),or=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),sr=!this.model.showNextPrevMonth&&this.model.orientation=="vertical"&&this.currentView()=="month"?yi.getTime()!=new Date(e.getFullYear(),e.getMonth(),1).getTime()||yi.getTime()!=new Date(f.getFullYear(),f.getMonth(),1).getTime():!1;if(!sr&&f>=new Date(this.model.minDate)&&f<=or)if(w[u.recurrence]==1&&w[u.recurrenceRule].toString().indexOf("RECUREDITID")==-1){var s,ft=!1,fi=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),nt=n.extend(!0,{},fi[0]);nt[this._appointmentSettings.endTime]=fi[fi.length-1][this._appointmentSettings.endTime];var ei=nt[this._appointmentSettings.recurrenceId]==null?nt.ParentId:nt[this._appointmentSettings.recurrenceId],hr=nt[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,c=new t.DataManager(this._processed).executeLocal((new t.Query).where(hr,t.FilterOperators.equal,ei));for(et&&(c=this._recurrenceAppSort(c)),c=this._appointmentRecurrenceSort(c),o=n.extend({},a[0]),et&&(o=n.extend({},c.filter(function(n){return n.Guid==a[0].Guid})[0])),this.model.enableRecurrenceValidation&&o[u.recurrence]&&(s=this._recuCollectionIndex(c,nt)),!this.model.enableRecurrenceValidation||!o[u.recurrence]||(s==0?t.isNullOrUndefined(c[s+1])?!0:new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime():s==c.length-1?new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime())?(prvStartTime=o[u.startTime],prvEndTime=o[u.endTime],o[u.startTime]=new Date(e),o[u.endTime]=new Date(f),ot=this._checkAvailability(o),kt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?{type:i.type}:i,this._trigger("resizeStop",{appointment:o,target:kt})||ot.length>0?(this._showBlockAlert&&ot.length>0&&this._alertBlockError(),o[u.startTime]=new Date(prvStartTime),o[u.endTime]=new Date(prvEndTime),ft=!0):(pi=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,ei=o[u.recurrenceId]==null?o.ParentId:o[u.recurrenceId],this._deleteOcurrence(ei,new Date(nt[u.startTime])),o[u.recurrenceRule]=a[0][u.recurrenceRule]+";RECUREDITID="+o.ParentId,o[u.id]=o.AppTaskId=pi)):(o[u.startTime]=nt[u.startTime],o[u.endTime]=nt[u.endTime],this._alertDragResizeError(),ft=!0),it=[],lt=[],it.push(this._timeZoneAppointments(o,"")),wi=o[this._appointmentSettings.recurrenceId]==null?o.ParentId:o[this._appointmentSettings.recurrenceId],bi=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,wi)),lt.push(this._timeZoneAppointments(bi[0],"")),dt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",ft||(d=this._dataManager.saveChanges({added:it,changed:lt,deleted:[]},dt,this.model.appointmentSettings.query._fromTable)),oi=[],rt=0;rt<it.length;rt++)oi=this._timeZoneAppointments(it[rt],"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",oi);for(si=[],rt=0;rt<lt.length;rt++)si=this._timeZoneAppointments(lt[rt],"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",si);if(ft)for(this._appointmentRemove(o),tt=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:tt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:tt},"Guid"),i=0,ht=tt.length;i<ht;i++)this._refreshDayAppointments(tt[i]);else for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(o),tt=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:tt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:tt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:tt},"Guid"),this._appointmentProcessing(o),this._appointmentRemove(o),this._currentViewAppointments=this._appointmentCount(),st=this._currentViewAppointments.filter(function(n){return n.Guid==o.Guid}),i=0,ht=st.length;i<ht;i++)this._refreshDayAppointments(st[i]);this._trigger("actionComplete",{data:o,requestType:"appointmentResize"});!t.isNullOrUndefined(d)&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(g=this,d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,u,f;if(n.isArray(r))g._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(g._dateFormat(r.added),u=0,f=r.added.length;u<f;u++)o[g._appointmentSettings.id]=r.added[u][g._appointmentSettings.id],new t.DataManager(g._processed).update("Guid",o)}),d.fail(function(){g._renderAppointmentAll()}))}else{var s,ft=!1,cr=et?this._currentAppointmentData:this._processed,at=new t.DataManager(cr).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,w.Guid)),c=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,at[0].ParentId));for(et&&(c=this._recurrenceAppSort(c)),c=this._appointmentRecurrenceSort(c),l=n.extend({},at[0]),this.model.enableRecurrenceValidation&&l[u.recurrence]&&(s=this._recuCollectionIndex(c,at[0])),!this.model.enableRecurrenceValidation||!l[u.recurrence]||(s==0?t.isNullOrUndefined(c[s+1])?!0:new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime():s==c.length-1?new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime())?(prevStartTime=l[u.startTime],prevEndTime=l[u.endTime],l[u.startTime]=e,l[u.endTime]=f,ot=this._checkAvailability(l),kt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?{type:i.type}:i,(this._trigger("resizeStop",{appointment:l,target:kt})||ot.length>0)&&(this._showBlockAlert&&ot.length>0&&this._alertBlockError(),l[u.startTime]=prevStartTime,l[u.endTime]=prevEndTime,ft=!0)):(l[u.startTime]=at[0][u.startTime],l[u.endTime]=at[0][u.endTime],this._alertDragResizeError(),ft=!0),it=this._timeZoneAppointments(l,""),dt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",ft||(d=this._dataManager.update(dt,it,this.model.appointmentSettings.query._fromTable)),ki=this._timeZoneAppointments(it,"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",ki),et?(gt=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,l.Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:gt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:gt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:gt},"Guid"),this._appointmentProcessing(l)):(new t.DataManager(this._processed).update("Guid",l),new t.DataManager(this._renderedApp).remove("Guid",l),new t.DataManager(this._renderedAllDay).remove("Guid",l)),this._appointmentRemove(l),this._currentViewAppointments=this._appointmentCount(),st=this._currentViewAppointments.filter(function(n){return n.Guid==l.Guid}),i=0,ht=st.length;i<ht;i++)this._refreshDayAppointments(st[i]);this._trigger("actionComplete",{data:l,requestType:"appointmentResize"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(d)&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(g=this,d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&g._processUrlBinding(i)}),d.fail(function(){g._renderAppointmentAll()}))}else this._renderAppointmentAll()}this.element.find("div.e-tophandle,div.e-bottomhandle").removeClass("e-rowcursor");this.element.find("div.e-lefthandle,div.e-righthandle").removeClass("e-columncursor")}catch(i){}},_dragdropAppointments:function(){var r,i,u;if(this.model.readOnly)return!1;this._topResizing=!1;this._bottomResizing=!1;this._leftResizing=!1;this._rightResizing=!1;this.model.allowDragAndDrop&&(i=this,u=this.element.find(".e-appointment"),u.ejDraggable({handle:".e-appointment",dragArea:i.model.appointmentDragArea==""?i.element.find("div.e-draggableworkarea",".e-headrealldaytable tr"[!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._grouping.length+1:1]):n(i.model.appointmentDragArea),cursorAt:i.model.appointmentDragArea==""?{top:0,left:0}:{top:-40,left:-40},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-appointment")?n(t.sender.target):n(t.sender.target).parents(".e-appointment"),i._appointElement(r,i)}}),u=this.element.find(".e-alldayappointment"),u.ejDraggable({handle:".e-alldayappointment",dragArea:i.model.appointmentDragArea==""?i.element:n(i.model.appointmentDragArea),cursorAt:{top:17,left:0},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-alldayappointment")?n(t.sender.target):n(t.sender.target).parents(".e-alldayappointment"),i._appointElement(r,i)}}),u=this.element.find(".e-monthappointment"),u.ejDraggable({handle:".e-monthappointment",dragArea:i.model.appointmentDragArea==""?i.element.find("div.e-draggableworkarea"):n(i.model.appointmentDragArea),cursorAt:i.model.appointmentDragArea==""?{top:0,left:0}:{top:-20,left:10},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-monthappointment")?n(t.sender.target):n(t.sender.target).parents(".e-monthappointment"),i._appointElement(r,i)}}))},_appointElement:function(t,i){var r=i.model.orientation=="vertical"&&t.hasClass("e-appointment")?t.closest("td").width()*.85:t.width();return t.find(".e-schedulemouseclose").removeClass("e-schedulemouseclose e-icon"),t.find(".e-tophandle").removeClass("e-tophandle e-appointresizer-top e-icon e-nsexpand"),t.find(".e-bottomhandle").removeClass("e-bottomhandle e-appointresizer-bottom e-icon e-nsexpand"),t.find(".e-lefthandle").removeClass("e-lefthandle e-appointresizer-left e-icon e-ewexpand"),t.find(".e-righthandle").removeClass("e-righthandle e-appointresizer-right e-icon e-ewexpand"),t.clone().prop("id","cloneElement").appendTo(t.parent()),t.css("cursor","move"),i.model.appointmentDragArea==""?t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",r+"px").appendTo(i.element):t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",r+"px").appendTo(n(document.body))},_dragStart:function(i){var s,f,e,u,r,o;if(n(i.element[0]).hasClass("e-appointment")||n(i.element[0]).hasClass("e-monthappointment")||n(i.element[0]).hasClass("e-alldayappointment")){if((this._tooltipEvents("disable"),(this._mediaQuery||t.isMobile())&&this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment"),s=this._curDragElmt=i.element,f=this._appointmentSettings,this._appUid=n(i.element[0]).attr("guid"),u=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),u.length>1?(r=n.extend(!0,[],u),r[0][f.endTime]=r[r.length-1][f.endTime],e=r[0]):e=u[0],o={target:s,appointment:e},this._trigger("actionBegin",{data:o,requestType:"appointmentDrag"}))||this._trigger("dragStart",o))return i.cancel=!0,n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove(),this._renderAppointmentAll(),this._tooltipEvents("enable"),(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this)),!1}else i.cancel=!0;!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"))},_dragOver:function(i){var c=n(i.element),e={target:c,interval:10},s,h,u,f;if(t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide"),this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover"),this._trigger("drag",e),this._dragInterval=e.interval,this.currentView()!="month"&&!this._isCustomMonthView()&&(n(i.element[0]).hasClass("e-appointment")||i.target.className.indexOf("e-workcells")>-1)&&this._dragAppointmentCurrentTime(i),this.model.orientation=="horizontal"&&this._tempResource.length!=0&&this._grouping.length!=0){if(i.element.css("pointer-events","none"),this.model.group.resources.length>1){var l=document.elementFromPoint(i.element.offset().left,i.element.offset().top),o=n(l).closest(".e-workcells").parent().index(),r=n(this.element.find(".e-resourceheadertable tr")[o]).children();if(r.hasClass("e-parentnode")&&n(r.children()[0]).hasClass("e-resourceexpand")){for(n(r.children()[0]).removeClass("e-resourceexpand").addClass("e-resourcecollapse"),s=n(r.children()[0]).attr("id").split("_")[0],h=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,s)),u=0;u<h.length;u++)f=o+u+1,n(this.element.find(".e-resourceheadertable tr")[f]).is(":hidden")&&(n(this.element.find(".e-resourceheadertable tr")[f]).toggle(),n(this.element.find(".e-workcellstab tr")[f]).toggle());this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height());this._horizontalRender();this.model.cellHeight&&this._reRenderScroller();this._horizontalResIcon()}}i.element.css("pointer-events","")}},_dragStop:function(i){var u,ut,at,vt,wi,c,b,st,yt,pt,ni,bi,ki,di,gi,ti,ft,a,nr,oi,e,v,tr,ht,si,s,w,tt,wt,hi,li,ci,ir,rr,y,nt,kt,ai,dt,bt,ur,rt,vi,ri,ot,yi,ui,l,ct,f,it,d,ii,fr,er,or,fi,pi,ei,lt;(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));this._tooltipEvents("enable");!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");var g=this,r=this._appointmentSettings,p=this.element.find(".e-draggableworkarea");if(this._appUid=i.element.attr("guid"),u=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),u.length>1&&!u[0][r.recurrence]?(ut=!0,f=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0]):(ut=u.length>1?!0:!1,at=n.extend(!0,[],u),at[0][r.endTime]=at[at.length-1][r.endTime],f=u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):u[0][r.recurrence]?u.length>1?at[0]:u[0]:this._getAppointmentByParentId(this._appUid)),(t.isNullOrUndefined(this._dragNewStartTime)||t.isNullOrUndefined(this._dragNewEndTime))&&u.length!=0&&(this._dragNewStartTime=new Date(u[0][this._appointmentSettings.startTime]),this._dragNewEndTime=new Date(u[u.length-1][this._appointmentSettings.endTime])),vt=n.extend(!0,{},f),wi=Math.ceil((vt[r.endTime]-vt[r.startTime])/36e5)<24&&vt[r.endTime].getDay()!=vt[r.startTime].getDay()?!0:!1,this.model.orientation=="vertical")if(n(i.element[0]).hasClass("e-appointment"))e=c=this._dragNewStartTime,v=b=this._dragNewEndTime,(i.target.className.indexOf("e-alldaycells")>-1||Math.ceil((this._dragNewEndTime.getTime()-this._dragNewStartTime.getTime())/36e5)>=24)&&(st=!0,c=new Date(c.setHours(0,0,0,0)),b=new Date(b.setHours(23,59,59,59))),s=Math.round((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-workcells").width());else if(n(i.element[0]).hasClass("e-alldayappointment"))if(i.target.className.indexOf("e-workcells")>-1)s=i.target.cellIndex,c=this._dragNewStartTime,b=this._dragNewEndTime,st=!1,this._allDayDrag=!0;else{e=f[r.startTime];v=f[r.endTime];u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(e=u[0][r.startTime],v=u[0][r.endTime]);yt=n(i.element[0]).offset().left+p.scrollLeft()-this.element.find(".e-alldaycells").offset().left-1;yt=this.model.enableRTL?Math.abs(yt):yt;var s=Math.round(yt/(this.element.find(".e-alldaycells").width()+1)),yr=Math.round(n(i.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),pr=Math.ceil((v-e)/864e5),wr=Math.round(n(i.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),gt=this.currentView()==="week"?7:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._renderDays:1;e=new Date(this._dateRender[s]);v=new Date(this._dateRender[s]);v.setHours(f[r.endTime].getHours(),f[r.endTime].getMinutes(),f[r.endTime].getSeconds());s<0?e<=new Date(this._dateRender[0])?(c=new Date(e),c.setDate(c.getDate()+s),c.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()),c=new Date(c)):(pt=new Date(this._dateRender[0]),pt.setDate(pt.getDate()+s),pt.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()),c=new Date(pt)):e<new Date(this._dateRender[0])?(ni=s>gt-1?s%gt:s,this._resWorkWeek?e=new Date(new Date(this._dateRender[s])):e.setDate(new Date(f[g._appointmentSettings.startTime]).getDate()+ni),e.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()),c=new Date(e)):(ni=s>gt-1?s%gt:s,c=new Date(new Date(this._dateRender[ni])),c.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()));bi=new Date(c);ki=new Date(f[r.endTime]).getTime()-new Date(f[r.startTime]).getTime();b=new Date(new Date(bi).setMilliseconds(ki))}else n(i.element[0]).hasClass("e-monthappointment")&&(w=f[r.startTime],tt=f[r.endTime],u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(w=u[0][r.startTime],tt=u[u.length-1][r.endTime]),e=new Date(new Date(this.model.currentDate).getFullYear(),new Date(this.model.currentDate).getMonth(),1),di=e.getDay(),e.setDate(e.getDate()-di),this.currentView()!="month"&&(this.currentView()!="customview"||this._oneWeek)?(gi=t.isNullOrUndefined(this.model.group)?this._dateRender.length:this._dateRender.length*this.res1.length,s=parseInt((n(i.element[0]).offset().left-p.offset().left)/Math.round(p.width()/gi))):(s=parseInt((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-monthcells").width()),s=this.model.enableRTL?6-s:s),wi&&parseInt(i.element.attr("id").split("_")[1])==u[u.length-1].AppTaskId&&(s-=1),ti=parseInt((n(i.element[0]).offset().top+p.scrollTop()-p.offset().top)/this.element.find(".e-monthcells").outerHeight()),this.model.showOverflowButton||(ti=this._findRowIndex(i)),ft=this.currentView()=="month"||this._isCustomMonthView()&&!this._oneWeek?this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length,a=this.model.enableRTL?ti*ft+(s-Math.floor(s/ft)*ft)-(tt.getDay()-w.getDay()):ti*ft+(s-Math.floor(s/ft)*ft),e=new Date(new Date(this._dateRender[a]).setHours(w.getHours(),w.getMinutes(),w.getSeconds())),Math.ceil((f[r.endTime]-f[r.startTime])/36e5)>24?(nr=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(i.element.attr("id").split("_")[1]))),oi=new Date(nr[0][r.startTime])-new Date(u[0][r.startTime]),c=new Date(e-oi),wt=e.getTime()-new Date(w).getTime()-new Date(oi).getTime()):(c=new Date(e),wt=e.getTime()-new Date(w).getTime()),v=new Date(new Date(tt).getTime()+wt),b=new Date(v));else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(e=c=this._dragNewStartTime,v=b=this._dragNewEndTime,tr=this.model.enableRTL?document.elementFromPoint(n(i.element[0]).offset().left,n(i.element[0]).offset().top-1).cellIndex-Math.round(n(i.element[0]).width()/30-1):Math.round((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-workcells").width()),ht=parseInt((n(i.element[0]).offset().top+p.scrollTop()-p.offset().top)/this.element.find(".e-workcells").outerHeight()),this.model.showOverflowButton||(ht=this._findRowIndex(i)),this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(ht+=n(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return n(this).css("display")!=="none"})[ht]).prevUntil("table.e-resourceheadertable").filter(function(){return n(this).css("display")=="none"}).length),si=n(this.element.find(".e-workcellstab tr")[ht]).find("td")[tr],n(si).hasClass("e-resourceheadercells")||t.isNullOrUndefined(si)||(this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(n(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-workcells").width()),s=ht,n(i.element[0]).hasClass("e-monthappointment")&&(w=new Date(f[r.startTime]),tt=new Date(f[r.endTime]),u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1?(w=u[0][r.startTime],tt=u[0][r.endTime]):u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")>0&&(f=u[0],w=u[0][r.startTime],tt=u[0][r.endTime]),e=new Date(this.monthDays[this._cellIndex]),e.setHours(w.getHours(),w.getMinutes(),w.getSeconds()),c=new Date(e),wt=e.getTime()-new Date(w).getTime(),v=new Date(new Date(tt).getTime()+wt),b=new Date(v))));if(hi=this.currentView()==t.Schedule.CurrentView.Month||this._isCustomMonthView(),this.model.orientation==t.Schedule.Orientation.Horizontal&&u[0][r.allDay]&&this.res1.length>1&&!hi&&(c=new Date(u[0][r.startTime]),b=new Date(u[0][r.endTime])),ci=!0,this._grouping.length>0&&(nt=n.extend(!0,{},u[0]),nt=this._getDragDropResourceData(this,s,nt),li=this._appointmentSettings.resourceFields.split(","),ci=nt[this._appointmentSettings.resourceFields.split(",")[li.length-1]]==u[0][this._appointmentSettings.resourceFields.split(",")[li.length-1]]),ci&&!t.isNullOrUndefined(e)&&new Date(e).getTime()==new Date(u[0][r.startTime]).getTime()&&new Date(v).getTime()==new Date(u[0][r.endTime]).getTime()&&!hi){if(this.element.find("#cloneElement").length>0){var k=this._curDragElmt.clone(),sr=this._timeMode=="12"?t.format(u[0][r.startTime],this._pattern.t,this.model.locale):t.format(u[0][r.startTime],"HH:mm",this.model.locale),hr=this._timeMode=="12"?t.format(u[0][r.endTime],this._pattern.t,this.model.locale):t.format(u[0][r.endTime],"HH:mm",this.model.locale);k.find(".e-apptime").remove();k.find(".e-appointinnertext").append(n("<div class='e-apptime'>"+sr+" - "+hr+"<\/div>"));this.model.enableRTL?k.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerWidth():this.element.find("#cloneElement").width(),height:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),top:this.element.find("#cloneElement").css("top"),right:this.element.find("#cloneElement").css("right"),cursor:""}):k.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerWidth():this.element.find("#cloneElement").width(),height:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),top:this.element.find("#cloneElement").css("top"),left:this.element.find("#cloneElement").css("left"),cursor:""});k.appendTo(this.element.find("#cloneElement").parent());this.element.find("#cloneElement").remove();!this.model.timeScale.enable||this.model.orientation!="vertical"||this.currentView()=="month"||this._isCustomMonthView()||k.hasClass("e-alldayappointment")?(k.children().eq(0).addClass("e-lefthandle e-appointresizer-left e-icon"),k.children().eq(1).addClass("e-righthandle e-appointresizer-right e-icon")):(k.children().eq(0).addClass("e-tophandle e-appointresizer-top e-icon"),k.children().eq(1).addClass("e-bottomhandle e-appointresizer-bottom e-icon"));k.children().eq(2).addClass("e-schedulemouseclose e-icon").removeAttr("style");this._bindAppointmentAction();n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove()}return!1}if(ir=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),rr=!this.model.showNextPrevMonth&&this.model.orientation=="vertical"&&this.currentView()=="month"?new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()!=new Date(c.getFullYear(),c.getMonth(),1).getTime():!1,!rr&&b>=new Date(this.model.minDate)&&b<=ir)if(this._refreshCellsHeight(),f[r.recurrence]==1&&f[r.recurrenceRule].indexOf("RECUREDITID")==-1){y=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)));y.length>1&&(nt=n.extend(!0,[],y),nt[0][r.endTime]=nt[nt.length-1][r.endTime]);y=y.length>1?nt[0]:y[0];var bt=y[r.recurrenceId]==null?y.ParentId:y[r.recurrenceId],cr=y[r.recurrenceId]==null?"ParentId":r.recurrenceId,l=new t.DataManager(this._processed).executeLocal((new t.Query).where(cr,t.FilterOperators.equal,bt));ut&&(l=this._recurrenceAppSort(l));var l=this._appointmentRecurrenceSort(l),o=n.extend({},y),a,et=!1;for(this.model.enableRecurrenceValidation&&o[r.recurrence]&&(a=this._recuCollectionIndex(l,y)),!this.model.enableRecurrenceValidation||!o[r.recurrence]||(a==0?t.isNullOrUndefined(l[a+1])?!0:new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime():a==l.length-1?new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime())?(kt=n.extend(!0,[],y),o[r.startTime]=c,o[r.endTime]=b,!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources&&(o=this._getDragDropResourceData(this,s,o)),t.isNullOrUndefined(st)||(o[r.allDay]=st),ct=this._checkAvailability(o),lt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,this._trigger("dragStop",{appointment:o,event:lt})||ct.length>0?(this._showBlockAlert&&ct.length>0&&this._alertBlockError(),o=n.extend(!0,[],kt),et=!0):(this._processed=this._sortAppById(this._processed),ai=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,this._appMainId=ai,bt=f[r.recurrenceId]==null?f.ParentId:f[r.recurrenceId],this._deleteOcurrence(bt,y[r.startTime]),o[r.recurrenceRule]=f[r.recurrenceRule]+";RECUREDITID="+o.ParentId,o[r.recurrenceExDate]=f[r.recurrenceExDate],o[r.id]=o.AppTaskId=ai)):(o[r.startTime]=y[r.startTime],o[r.endTime]=y[r.endTime],this._alertDragResizeError(),et=!0),it=[],dt=[],it.push(this._timeZoneAppointments(o,"")),bt=o[r.recurrenceId]==null?f.ParentId:o[r.recurrenceId],ur=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,bt)),dt.push(this._timeZoneAppointments(ur[0],"")),ii=this.dataSource()instanceof t.DataManager?r.id:"AppTaskId",et||(d=this._dataManager.saveChanges({added:it,changed:dt,deleted:[]},ii,this.model.appointmentSettings.query._fromTable)),rt=0;rt<it.length;rt++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(it[rt],"reverse"));for(rt=0;rt<dt.length;rt++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(dt[rt],"reverse"));if(et)for(this._appointmentRemove(o),ot=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ot},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ot},"Guid"),yi=this._processed.filter(function(n){return n.Guid==o.Guid}),ui=0;ui<yi.length;ui++)this._refreshDayAppointments(yi[ui]);else{for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(o),ot=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ot},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ot},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ot},"Guid"),this._appointmentProcessing(o),this._appointmentRemove(o),vi=this._processed.filter(function(n){return n.Guid==o.Guid}),ri=0;ri<vi.length;ri++)this._refreshDayAppointments(vi[ri]);this._refreshDayAppointments(kt)}this._trigger("actionComplete",{appointment:o,requestType:"appointmentDrag"});!t.isNullOrUndefined(d)&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,u,f;if(n.isArray(r))g._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(g._dateFormat(r.added),u=0,f=r.added.length;u<f;u++)o[g._appointmentSettings.id]=r.added[u][g._appointmentSettings.id],new t.DataManager(g._processed).update("Guid",o)}),d.fail(function(){g._renderAppointmentAll()}))}else{var a,et=!1,lr=ut?this._currentAppointmentData:this._processed,h=new t.DataManager(lr).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,u[0].Guid)),kt=n.extend(!0,{},h[0]),ar=h[0][r.startTime],vr=h[0][r.endTime],l=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,h[0].ParentId));if(ut&&(l=this._recurrenceAppSort(l)),l=this._appointmentRecurrenceSort(l),h[0][r.startTime]=c,h[0][r.endTime]=b,this.model.enableRecurrenceValidation&&(a=this._recuCollectionIndex(l,h[0])),!this.model.enableRecurrenceValidation||!h[0][r.recurrence]||(a==0?t.isNullOrUndefined(l[a+1])?!0:new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime():a==l.length-1?new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime())?(!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources&&(h[0]=this._getDragDropResourceData(this,s,h[0])),t.isNullOrUndefined(st)||(h[0][r.allDay]=st),ct=this._checkAvailability(h[0]),lt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,(this._trigger("dragStop",{appointment:h[0],event:lt})||ct.length>0)&&(this._showBlockAlert&&ct.length>0&&this._alertBlockError(),h[0]=n.extend(!0,{},kt),et=!0)):(h[0][r.startTime]=ar,h[0][r.endTime]=vr,this._alertDragResizeError(),et=!0),this.model.appointmentDragArea!=""&&(f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),f.length==0))return!1;for(it=this._timeZoneAppointments(h[0],""),ii=this.dataSource()instanceof t.DataManager?r.id:"AppTaskId",et||(d=this._dataManager.update(ii,it,this.model.appointmentSettings.query._fromTable)),fr=this._timeZoneAppointments(it,"reverse"),er=ut?"Guid":"AppTaskId",new t.DataManager(this._currentAppointmentData).update(er,fr),or=new Date(new Date(h[0][r.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(h[0][r.endTime]).setHours(0,0,0,0)).getTime(),or||ut?(fi=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,h[0].Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:fi},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:fi},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:fi},"Guid"),this._appointmentProcessing(h[0])):(new t.DataManager(this._processed).update("AppTaskId",h[0]),new t.DataManager(this._renderedApp).remove("AppTaskId",h[0]),new t.DataManager(this._renderedAllDay).remove("AppTaskId",h[0])),this._appointmentRemove(h[0]),pi=this._processed.filter(function(n){return n.Guid==h[0].Guid}),ei=0;ei<pi.length;ei++)this._refreshDayAppointments(pi[ei]);this._refreshDayAppointments(kt);this._trigger("actionComplete",{appointment:h[0],requestType:"appointmentDrag"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(d)&&d&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&g._processUrlBinding(i)}),d.fail(function(){g._renderAppointmentAll()}))}else this._renderAppointmentAll(),lt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,this._trigger("dragStop",{appointment:u[0],event:lt});n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove();this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove()},_findRowIndex:function(t){var i=n(t.element[0]).offset(),r,u;return this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none"),r=n(document.elementFromPoint(i.left-n(document).scrollLeft(),i.top-n(document).scrollTop()-1)),u=n(r).closest("td").parent().index(),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible"),u},_alertDragResizeError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("DragResizeError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_processUrlBinding:function(i){if(this.model.enableLoadOnDemand||this.dataSource()instanceof t.DataManager&&this.dataSource().adaptor instanceof t.ODataAdaptor)this._initDataSource("refresh");else{var r=t.isNullOrUndefined(i.record)?i:i.record;this._currentAppointmentData.length=0;this._dateFormat(r);this._bindAppointments=!0;this._currentAppointmentData=n.merge(this._currentAppointmentData,r);this._dataProcessing(r);this._renderAppointmentAll()}},_refreshCellsHeight:function(){if(this.currentView()=="agenda")return!1;this.model.orientation!="horizontal"||this.model.showOverflowButton||(this._horizontalRender(),this._reRenderScroller());this.model.orientation!="vertical"||this.model.showOverflowButton||this.currentView()!="month"||(this._monthCellsRender(),this._reRenderScroller())},_dragAppointmentCurrentTime:function(i){var w=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.element.attr("guid")))),e=this.element.find(".e-draggableworkarea"),ft=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),u=this,c=u._appointmentSettings,b,f,y,st,g,ht,ct,vt,h,a,nt,l,v,p,tt,rt,r,o,yt,wt,ut,bt,kt,it;if(w[0][c.recurrence]?(b=n.extend(!0,[],w),b[0][c.endTime]=b[b.length-1][c.endTime],f=w[0][c.recurrence]&&w[0][c.recurrenceRule].toString().indexOf("RECUREDITID")==1?this._getAppointmentByParentId(this._appUid):w[0][c.recurrence]?b[0]:this._getAppointmentByParentId(this._appUid)):f=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],this.model.orientation=="vertical"&&(n(i.element[0]).hasClass("e-appointment")||i.target.className.indexOf("e-workcells")>-1)){var et=e.height()+e.scrollTop(),gt=i.element[0].offsetHeight,k=this.element.find(".e-workcells").outerHeight(),ot=n(i.element[0]).offset().top-e.offset().top+e.scrollTop(),d=ot-k/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))<et?ot:et-gt,r,s,l,v;if(n(i.element[0]).hasClass("e-alldayappointment"))a=i.target.cellIndex,r=new Date(this.dateRender[a]),y=d>0?d*60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k),r.setHours(parseInt(this.model.startHour)+Math.round(y/60)),r.setMinutes(parseInt(y%60)),r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r),r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval),l=new Date(r),s=new Date(r).setMinutes(r.getMinutes()+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),v=new Date(s);else if((d>0||!this.model.showAllDayRow)&&i.target.className.indexOf("e-alldaycells")!=1){if(y=Math.round(d>0?d*60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k)),st=new Date(new Date(f[u._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(f[u._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()?!0:!1,u.currentView()==="month"||u._isCustomMonthView()?(r=f[c.startTime],s=new Date(r)):(g=new Date(u._firstweekdate(u.currentDate())),(u.currentView()==="workweek"||u.currentView()=="customview"&&u._renderDays==5)&&(ht=new Date(g).getDay(),ct=ht==0?1:0,g.setDate(g.getDate()+ct)),r=g,h=u.currentView()==="week"?7:u.currentView()==="workweek"?this.model.workWeek.length:u.currentView()=="customview"?u._renderDays:1,h=t.isNullOrUndefined(u.model.group)?h:h*u.res1.length,a=Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width()),r=this.model.enableRTL?new Date(this.dateRender[h-a-1]):new Date(this.dateRender[a]),s=r),st)r=this._getNewStartTime(y,r),l=new Date(r);else{var lt=(y%60).toFixed(1),at=lt.toString().split("."),ni=t.isNullOrUndefined(at[1])?0:at[1]/1;r.setHours(parseInt(this.model.startHour)+Math.round(y/60),parseInt(lt.toString().split(".")[0]),ni,0);r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r);ft>=this._dragInterval?r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval):r.setMinutes(r.getMinutes()/this._dragInterval*this._dragInterval);l=new Date(r)}vt=new Date(f[c.endTime]).getTime()-new Date(f[c.startTime]).getTime();v=new Date(new Date(r).setMilliseconds(vt))}else h=this.currentView()==="week"?7:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._renderDays:1,h=t.isNullOrUndefined(this.model.group)?h:h*this.res1.length,a=Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width()),r=this.model.enableRTL?new Date(this.dateRender[h-a-1]):new Date(this.dateRender[a]),l=new Date(r.setHours(0,0,0)),v=new Date(r.setHours(23,59,59))}else if(this.model.orientation=="horizontal"&&n(i.element[0]).hasClass("e-appointment")&&(l=new Date(f[u._appointmentSettings.startTime]),v=new Date(f[u._appointmentSettings.endTime]),p=this.model.enableRTL?document.elementFromPoint(n(i.element[0]).offset().left,n(i.element[0]).offset().top-1).cellIndex-Math.round(n(i.element[0]).width()/30-1):Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width()),tt=parseInt((n(i.element[0]).offset().top+e.scrollTop()-e.offset().top)/this.element.find(".e-workcells").outerHeight()),this.model.showOverflowButton||(tt=this._findRowIndex(i)),this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(tt+=n(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return n(this).css("display")!=="none"})[tt]).prevUntil("table.e-resourceheadertable").filter(function(){return n(this).css("display")=="none"}).length),rt=n(this.element.find(".e-workcellstab tr")[tt]).find("td")[p],!n(rt).hasClass("e-resourceheadercells")&&!t.isNullOrUndefined(rt))){r=new Date(this._dateRender[0]);nt=this.model.enableRTL?p*30:(n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/n(this.element.find(".e-workcells")[1]).outerWidth();o=this.model.startHour+p*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/60;yt=parseInt(p/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)));o=o>=this.model.endHour?Math.round(nt/60)+yt*(24-this.model.endHour+this.model.startHour):Math.round(nt/60);r.setHours(parseInt(u.model.startHour)+o);r.setMinutes(parseInt(nt%60));r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r);ft>=this._dragInterval?r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval):r.setMinutes(r.getMinutes()/this._dragInterval*this._dragInterval);l=new Date(r);var ti=f[u._appointmentSettings.startTime],ii=f[u._appointmentSettings.endTime],pt=(ii-ti)/1e3,ut=Math.floor(pt/3600),ri=parseInt(i.element.width()/this.element.find(".e-workcells").width())/this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);this.currentView()=="workweek"&&this.model.workWeek!=5&&new Date(f.StartTime).getDay()!=new Date(f.EndTime).getDay()&&(wt=new Date(f.EndTime).getDay()-new Date(f.StartTime).getDay(),ut=ut-(wt-1)*(this.model.endHour-this.model.startHour));bt=Math.round(Math.floor(pt%3600/60)/this._dragInterval)*this._dragInterval;s=u._getNewEndTime(r,ri,bt);new Date(f.StartTime).getDay()==new Date(f.EndTime).getDay()&&this.currentView()=="workweek"&&this.model.workWeek.length!=5&&(totalhrs=r.getHours()+ut,totalhrs>24&&(kt=n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)+1,s.setDate(new Date(this._dateRender[kt]).getDate())));it=parseInt(p)+parseInt(n(i.element[0]).width()/this.element.find(".e-workcells").width())-1;it=parseInt(it/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)));var dt=new Date(s).getHours()>=this.model.endHour?parseInt(parseInt((new Date(s)-new Date(new Date(new Date(r).setHours(0,0,0,0)).setHours(this.model.endHour)))/36e5)/(this.model.endHour-this.model.startHour)):0,ui=new Date(r),fi=this.currentView()=="workweek"?(dt-1)*(this.model.endHour-this.model.startHour):0;o=new Date(s).getHours()>=this.model.endHour?new Date(new Date(ui).setHours(new Date(r).getHours()+fi+parseInt(n(i.element[0]).width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))+dt*(24-this.model.endHour+this.model.startHour))):s;new Date(s).getHours()>=this.model.endHour&&o.setMinutes(new Date(r).getMinutes()+Math.round(parseInt(nt%60)/this._dragInterval)*this._dragInterval);this.model.endHour-this.model.startHour!=24&&new Date(new Date(o).setHours(0,0,0,0)).getTime()!=new Date(this._dateRender[it]).getTime()&&(o=new Date(this._dateRender[it]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds(),new Date(o).getMilliseconds()));v=new Date(o);this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(n(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width())}i.element.find(".e-apptime").html(t.format(l,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(v,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).insertBefore(i.element.find(".e-apptext")).css("font-size","12px").css("white-space","normal");this._dragNewStartTime=l;this._dragNewEndTime=v},_unWireDragDrop:function(){var n=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment");n.ejDraggable("destroy")},_getAppointmentByParentId:function(i){var f=this._currentAppointmentData,u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i)),r=new t.DataManager(f).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[0].ParentId));return n.isEmptyObject(r)?r:r[0]},_renderAppointmentAll:function(){if(this.element.children().length==0)return!1;if(this.currentView()=="agenda")this._renderAgendaContent();else if(t.preferredCulture(this.model.locale),this.element.find("div.e-appointwrapper,.e-alldayappointment,.e-scheduleAppGlassy").remove(),this._currentViewAppointments=this._appointmentCount(),this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(this.model.orientation=="vertical"&&this._reRenderScroller(),this._renderAppointments(),this.model.showAppointmentNavigator&&(this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&!this._mediaQuery&&this._renderUpDownIconPosition(),this._nextPrevButton())):this._renderMonthAppointment(),this._bindAppointmentAction(),!this.model.showOverflowButton&&this.model.orientation=="horizontal"){var n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top;this.element.find(".e-horires").css({top:-n+"px"})}},_bindAppointmentAction:function(){this._unWireResizeEvents();this._wireResizeEvents();this._dragdropAppointments()},_renderBlockAppointments:function(){var i,u,f,s,e,o,r;if(this.element.find(".e-blocktimewrapper").remove(),this.model.blockoutSettings.enable&&!(this.model.blockoutSettings.dataSource instanceof t.DataManager)&&this.currentView()!="agenda")for(this._processBlockApps(),i=this.model.orientation=="horizontal"&&this.currentView()=="month"?n.extend(!0,[],this.monthDays):n.extend(!0,[],this._dateRender),this.model.group||(this.res1=["0"]),u=0;u<this.res1.length;u++){if(f=0,e=i.length,new Date(i[0])<this.model.minDate&&(f=Math.floor((new Date(this.model.minDate)-new Date(i[0]))/864e5)),new Date(i[i.length-1])>this.model.maxDate&&(s=Math.floor((new Date(i[i.length-1])-new Date(this.model.maxDate))/864e5),e=i.length-s),this._resWorkWeek)for(e=0,f=0,o=0,r=0;r<u+1;r++)if(t.isNullOrUndefined(this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(e+=this.model.workWeek.length,r==u&&(o+=this.model.workWeek.length)):(e+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,r==u&&(o+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length)),r==u){f=e-o;break}for(f;f<e;f++)this._getBlockIntervals(f,u,i)}},_processBlockApps:function(){var i,t;for(this._processedIntervals=[],i=n.extend(!0,[],this.model.blockoutSettings.dataSource),t=0;t<i.length;t++)i[t]=this._processtimeZone(i[t]),new Date(new Date(i[t][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[t][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()?this._blockTimeSplit(i[t],new Date(i[t][this.model.blockoutSettings.startTime]),new Date(i[t][this.model.blockoutSettings.endTime])):this._processedIntervals.push(i[t])},_blockTimeSplit:function(t,i,r){for(var u=new Date(this._dateRender[0])<=i?i:new Date(this._dateRender[0]),l=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate(),23,59,59),c=0,o,s,f,e,h;u<=l;)if(o=0,f=u,(this.currentView()=="month"||this._isCustomMonthView()||this.currentView()!="agenda"&&this.currentView()!="day"&&this.model.orientation=="horizontal")&&(this.model.orientation=="horizontal"&&this.currentView()=="month"?o=new Date(f.getFullYear(),f.getMonth()+1,0).getDate()-f.getDate():this.currentView()=="customview"&&(this._renderDays<=7||this.model.orientation=="horizontal")?(u=new Date(new Date(f).getFullYear(),new Date(f).getMonth(),new Date(f).getDate()),o=this._dateRender.indexOf(u.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(u.getTime()):u.getTime()<new Date(this._dateRender[0]).getTime()?(new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1)).getTime()-new Date(u).setHours(0,0,0,0))/864e5:u.getTime()>new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):(o=this.model.showNextPrevMonth||this.currentView()!="month"||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(u.getFullYear(),u.getMonth(),1).getTime()?6-f.getDay()+this._firstdayofweek:new Date(f.getFullYear(),f.getMonth()+1,0).getDate()-f.getDate(),this._firstdayofweek>f.getDay()&&(o=6-f.getDay()-(7-this._firstdayofweek)))),s=new Date(new Date(u).getFullYear(),new Date(u).getMonth(),new Date(u).getDate()+o),e=new Date(s).getDate()==new Date(r).getDate()?new Date(new Date(s).setHours(r.getHours(),r.getMinutes(),r.getSeconds())):new Date(new Date(s).setHours(23,59,59)),e>=new Date(r)&&(e=t[this.model.blockoutSettings.endTime]),this.model.showNextPrevMonth||this.currentView()!="month"||new Date(u.getFullYear(),u.getMonth(),1).getTime()==new Date(e.getFullYear(),e.getMonth(),1).getTime()||(e=new Date(u.getFullYear(),u.getMonth()+1,0,e.getHours(),e.getMinutes(),e.getSeconds())),h={},h[this.model.blockoutSettings.startTime]=f,h[this.model.blockoutSettings.endTime]=e,this._processedIntervals.push(n.extend({},t,h)),c=this.model.orientation=="horizontal"&&this.currentView()=="workweek"&&new Date(this._dateRender[0]).getDay()==1&&new Date(this._dateRender[this._dateRender.length-1]).getDay()==5?3:1,u=new Date(new Date(e).getFullYear(),new Date(e).getMonth(),new Date(e).getDate()+c),new Date(this._dateRender[this._dateRender.length-1])<u)break},_getBlockIntervals:function(n,i,r){var u=this._processedIntervals,o=t.Predicate(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(r[n])).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r[n]).setHours(23,59,59))),s=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r[n])).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r[n]).setHours(23,59,59))),e=o.or(s),f;for(e=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?e.and(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,u=new t.DataManager(u).executeLocal((new t.Query).where(e)),f=0;f<u.length;f++)new Date(new Date(r[n]).setHours(0,0,0,0)).getTime()==new Date(new Date(u[f][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[n]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[f][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(u[f][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[f][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()&&(this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?u[f][this.model.blockoutSettings.isAllDay]&&this._renderMonthBlockTime(u[f],n,i):this._renderBlockTime(u[f],n,i))},_renderBlockTime:function(i,r,u){var b=this.element.find(".e-workcells").outerHeight(),h=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.startHour):0,p=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.endHour):24,l=this._getDateCount(u),f=i[this.model.blockoutSettings.startTime],e=i[this.model.blockoutSettings.endTime],c,s,k,d,a,ft,et,ot,g,o,nt,v;if(f=new Date(f).getHours()<h?new Date(new Date(f).setHours(h,f.getMinutes(),f.getSeconds())):f,e=p<=e.getHours()?new Date(new Date(e).setHours(p,00,00)):e,c=new Date(f).getHours()<h?new Date(f).getHours()+-new Date(f).getHours()+-new Date(f).getMinutes():new Date(f).getHours()+-h,f<=e&&new Date(l[0]).getTime()<=f.getTime()&&new Date(new Date(l[l.length-1]).setHours(23,59,59))>=f.getTime())if(this.model.orientation=="vertical")s="100%",a=0,k=parseFloat(new Date(new Date(e).getTime())-new Date(new Date(f).getTime()))/6e4*b*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,d=(parseFloat(new Date(f).getHours()*60+new Date(f).getMinutes()+new Date(f).getSeconds()/60)-parseInt(c*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-this.model.startHour*60)*b*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),v=this._generateBlockElement(i,s,k,d,a),this._resWorkWeek?n(this.element.find("td.e-workcells")[c*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r]).append(v):n(this.element.find("td.e-workcells")[parseInt(c*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*l.length*this.res1.length+r+l.length*u]).append(v);else{var ct=this._horiGroupCollection(),k=b,s,d=0,a,ut=0;if(!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(ft=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,i[this.model.blockoutSettings.resourceId])),ut=this._findResourceIndex(ct,this._tempResource[this._tempResource.length-2].resourceSettings.id,ft[0][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])+1),et=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource)?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId])+1:1,new Date(new Date(new Date(i[this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime())<new Date(new Date(new Date(i[this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime())){var st=new Date(e)<new Date(new Date(e).setHours(this.model.endHour,0,0))&&new Date(e)<new Date(new Date(e).setHours(this.model.startHour,0,0))?this.model.endHour*30:new Date(e).getHours()*60+new Date(e).getMinutes(),ht=new Date(f)>new Date(new Date(e).setHours(this.model.startHour,0,0))?this.model.startHour*60:new Date(f).getHours()*60+new Date(f).getMinutes(),w=1,tt,y,it,rt,ot;if(tt=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0)),y=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0)),tt==-1)while(w<7)if(new Date(this._dateRender[this._dateRender.length-w]).getTime()<new Date(e).setHours(0,0,0,0)){it=this._dateRender.length-w;st=this.model.endHour*60;break}else w++;else it=tt;y==-1?(rt=r,ht=this.model.startHour*60):rt=y;ot=it-rt;o=ot*(p-h)*60-ht+st;nt=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*r+(y==-1?0:c*this.model.timeScale.minorSlotCount)*(60/this.model.timeScale.majorSlot);s=this.element.find(".e-workcells").outerWidth()/30*o+(o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2);g>this._dateRender.length&&(g=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(f).getDay(),o=g*(p-h)*60,s=o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));a=y==-1?0:parseFloat(new Date(f).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot}else a=parseFloat(new Date(f).getMinutes()+new Date(f).getMilliseconds()/60)*n(this.element.find(".e-workcells")[1]).width()*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,o=new Date(e).getHours()*60+new Date(e).getMinutes()-(new Date(f).getHours()*60+new Date(f).getMinutes())+1,s=o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2)+1,nt=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*r+c*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);s=s+"px";v=this._generateBlockElement(i,s,k,d,a);n(n(this.element.find(".e-workcellstab tr")[et+ut-1]).find("td.e-workcells")[nt]).append(v)}},_generateBlockElement:function(i,r,u,f,e){var o=this.model.blockoutSettings.templateId?!0:!1,h=o?this._getUserTemplate(this.model.blockoutSettings.templateId,i):"",c=i[this.model.blockoutSettings.isBlockAppointment]?"e-blockenable":"",s=n(this.blockTimeTemplate.render({id:i[this.model.blockoutSettings.id],subject:i[this.model.blockoutSettings.subject],appWidth:r,appHeight:u,left:e,top:f,blockClass:c,customStyle:i[this.model.blockoutSettings.customStyle],userTempId:o,userTemplate:h}));return t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("blockAppointment",i,s),s},_renderMonthBlockTime:function(i,r){var b=this.model.orientation=="vertical"?this._dateRender:this.monthDays,u=new Date(i[this.model.blockoutSettings.startTime]),h=new Date(i[this.model.blockoutSettings.endTime]),k,d,l,it=this.model.orientation=="vertical"?this.element.find(".e-monthcells").width():this.element.find(".e-workcells").width(),f=new Date(u),g=new Date(new Date(b[b.length-1]).setHours(23,59,59)),a=new Date(h)>g?g:new Date(h),o=f.getHours()==0&&a.getHours()==0?Math.ceil((new Date(a)-new Date(f))/864e5):Math.ceil((new Date(a).setHours(23,59,59)-new Date(f).setHours(0,0,0))/864e5),v,y,p,e,nt,s,tt,w,c;u<=h&&(this.model.orientation=="vertical"&&(v=this._firstdayofweek==0?7-new Date(f).getDay():7-new Date(f).getDay()+this._firstdayofweek,o=o>=v?v:o,y=Math.ceil((r+1)/7)),k=o*it+"px",p=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId]):0,e=this.model.orientation=="vertical"?p*7+(new Date(u).getDay()+1)+(y-1)*this.res1.length*7-this._firstdayofweek:r+1,this.model.orientation=="vertical"&&this._firstdayofweek!=0&&new Date(u).getDay()<this._firstdayofweek&&(e=p*7+(new Date(u).getDay()+1)+(y-1)*this.res1.length*7-this._firstdayofweek+7),this.model.orientation=="vertical"?l=n(this.element.find("td.e-monthcells")[e-1]).closest("tr").find(".e-monthcells").outerHeight():(nt=this._horiGroupCollection(),s=0,!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(tt=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,i[this.model.blockoutSettings.resourceId])),s=this._findResourceIndex(nt,this._tempResource[this._tempResource.length-2].resourceSettings.id,tt[0][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])+1),w=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource)?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId])+1:1,l=n(this.element.find(".e-workcellstab tr")[w+s-1]).find(".e-workcells").height()),d=l-this.element.find(".e-monthheader").height(),c=this._generateBlockElement(i,k,d,0,0),this.model.orientation=="vertical"?n(this.element.find("td.e-monthcells")[e-1]).append(c):this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&n(n(this.element.find(".e-workcellstab tr")[w+s-1]).find("td.e-workcells")[e-1]).append(c))},_checkAvailability:function(n){if(this.model.blockoutSettings.enable){var r=new Date(n[this._appointmentSettings.startTime]),f=new Date(n[this._appointmentSettings.endTime]),u;!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(u=n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]);var e=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.greaterThanOrEqual,r).and(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThanOrEqual,r).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThan,f),o=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,r).and(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThan,r),i=e.or(o);return i=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?i.and(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,u):i,i=i.and(this.model.blockoutSettings.isBlockAppointment,t.FilterOperators.equal,!0),new t.DataManager(this._processedIntervals).executeLocal((new t.Query).where(i))}return[]},_alertBlockError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("BlockIntervalAlertTitle"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("BlockIntervalError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_getNewEndTime:function(n,t){var i=new Date(n);return i.setMilliseconds(36e5*t),i},_getNewStartTime:function(n,t){return t.setHours(t.getHours()+parseInt(this.model.startHour)+parseInt(n/60)),t.setMinutes(t.getMinutes()+parseInt(n%60)),t.setMinutes(Math.round(t.getMinutes()/10)*10),t},_documentOnKeyDown:function(n){if(this.model.allowKeyboardNavigation){var t=n.target||document.activeElement||n.srcElement;n.which==27?this._processEscapeKey():n.which==13?this._processEnterKey(t):n.shiftKey==!1&&n.which==9&&this._processWindowTab(t)}},_processWindowTab:function(i){n(i).hasClass("e-qAppDone")&&!t.isNullOrUndefined(this._quickAppointWindow)?this._quickAppointWindow.find(".subject").focus():!t.isNullOrUndefined(this._appointmentAddWindow)&&(n(i).hasClass("e-appointcancel")||n(i).hasClass("e-cancelrecur"))?this._appointmentAddWindow.find(".subject").focus():n(i).hasClass("e-editseries")&&!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.focus()},_onKeyDown:function(i){var u,r,f,o,s,e,l;if(this.model.allowKeyboardNavigation){if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),u=this.element.find("div.e-draggableworkarea tr"),r=i.target||document.activeElement||i.srcElement,n(r).hasClass("e-alldaycells")&&(u=this.element.find(".e-alldaycells").parent()),this._trigger("keyDown",{event:i}))return!1;if(n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells"))this._getDateByElement(n(r)),f=this.curDate,i.which==39&&f.setDate(f.getDate()+1),i.which==37&&f.setDate(f.getDate()-1),f>=this.model.minDate&&f<=this.model.maxDate&&(this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"),(n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells"))&&n(r).addClass("e-selectedCell"),i.shiftKey==!1&&i.which==38?(this._stopDefaultAction(i),this._processUpArrow(r,u)):i.shiftKey==!1&&i.which==40?(this._stopDefaultAction(i),this._processDown(r,u)):i.ctrlKey==!1&&i.shiftKey==!1&&i.which==39?(this._stopDefaultAction(i),this._processRight(r,u)):i.ctrlKey==!1&&i.shiftKey==!1&&i.which==37?(this._stopDefaultAction(i),this._processLeft(r,u)):i.shiftKey==!0&&i.which==38?(this._stopDefaultAction(i),this._processShiftUp(r,i,u)):i.shiftKey==!0&&i.which==40?(this._stopDefaultAction(i),this._processShiftDown(r,i,u)):i.shiftKey==!0&&i.which==37?(this._stopDefaultAction(i),this._processShiftLeft(r,i,u)):i.shiftKey==!0&&i.which==39&&(this._stopDefaultAction(i),this._processShiftRight(r,i,u)));else if(this.currentView()=="agenda"&&n(r).hasClass("e-agendacells")&&(this._stopDefaultAction(i),i.which==38||i.which==40)){this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");var a=u.length-1,h=this.element.find(".e-selectedCell").parent().index(),c=i.which==38?parseInt(h)-1:parseInt(h)+1;c>=0&&c<=a&&h!="undefined"&&(n(u).find(".e-eventcolumn,.e-timecolumn").removeClass("e-selectedCell"),n(u[c]).find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus())}i.altKey==!0&&i.which==67?(this._stopDefaultAction(i),this.element.find(".e-datedisplay").click()):i.ctrlKey==!0&&i.which==37?(this._stopDefaultAction(i),this.element.find("div.e-navigateprevious").click(),this.element.find("div.e-navigateprevious").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.ctrlKey==!0&&i.which==39?(this._stopDefaultAction(i),this.element.find("div.e-navigatenext").click(),this.element.find("div.e-navigatenext").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.altKey==!0&&i.which==107||i.altKey==!0&&i.which==187||i.altKey==!0&&i.which==61?(this._stopDefaultAction(i),this._navigateToolbarRight(i)):i.altKey==!0&&i.which==189||i.altKey==!0&&i.which==109||i.altKey==!0&&i.which==45||i.altKey==!0&&i.which==173?(this._stopDefaultAction(i),this._navigateToolbarLeft(i)):i.ctrlKey==!0&&i.which==67?(this._stopDefaultAction(i),this._cancel()):i.which==32?n(document.activeElement)[0]===this.element.find("div.e-navigateprevious")[0]?(this._stopDefaultAction(i),this.element.find("div.e-navigateprevious").click(),this.element.find("div.e-navigateprevious").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):n(document.activeElement)[0]===this.element.find("div.e-navigatenext")[0]&&(this._stopDefaultAction(i),this.element.find("div.e-navigatenext").click(),this.element.find("div.e-navigatenext").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.altKey==!0&&i.which==78?(this._stopDefaultAction(i),this.currentView()!="agenda"&&this._newAppWindow(r,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):i.ctrlKey==!0&&i.which==69?(this._stopDefaultAction(i),o=this.element.find(".e-selectedAppointment"),this.currentView()=="agenda"&&this.element.find(".e-selectedCell").length>0&&(e=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),e.hasClass("e-agendaappointment")&&(o=e)),o.length>0&&(this._editKey=!0,this._cellClick=!1,this._appointmentWindow(o),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"))):i.which==46?(this._stopDefaultAction(i),s=this.element.find(".e-selectedAppointment"),this.currentView()=="agenda"&&this.element.find(".e-selectedCell").length>0&&(e=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),e.hasClass("e-agendaappointment")&&(s=e)),s.length>0&&(this._appUid=s.attr("guid"),this._deleteAppoint())):i.shiftKey==!0&&i.which==9?(this._stopDefaultAction(i),this._reverseTab(r,i,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):i.shiftKey==!1&&i.which==9&&(this._stopDefaultAction(i),this._processTab(r,i,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"));l=this;this.currentView()!="agenda"&&this._moveScrollContent(r,l)}},_processShiftUp:function(t,i,r){var u,s,o;if(this.model.orientation=="horizontal")return!1;if(n(t).hasClass("e-workcells")){var h=r.length-1,e=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;e>0&&e<=h&&e!="undefined"?(u=parseInt(e)-1,u>=0&&(n(r[u].cells[f]).hasClass("e-selectedCell")?(n(r[u].cells[f]).attr("tabIndex",0).focus(),n(r[e].cells[f]).removeClass("e-selectedCell")):(n(r[e].cells[f]).addClass("e-selectedCell"),n(r[u].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus())),this._currentRowIndex=u,this._currentColIndex=f):(n(r[e].cells[f]).attr("tabIndex",0).focus(),this._currentRowIndex=e,this._currentColIndex=f)}else if(n(t).hasClass("e-monthcells")){var c=Math.floor(n(t).index()/7),h=r.length-1,l=7*(c+1),a=7*parseInt(c),e=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;if(e>0&&e<=h&&e!="undefined")if(u=parseInt(e)-1,u>=0)if(n(r[u].cells[f]).hasClass("e-selectedCell")){for(s=f;s>=a;s--)n(r[e].cells[s]).attr("tabIndex",0).focus(),n(r[e].cells[s]).removeClass("e-selectedCell");for(o=l-1;o>=f;o--)u>=0&&(n(r[u].cells[o]).attr("tabIndex",0).focus(),n(r[u].cells[o]).removeClass("e-selectedCell"));n(r[u].cells[f]).hasClass("e-othermonths")||n(r[u].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(s=f;s>=a;s--)n(r[e].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(o=l-1;o>=f;o--)u>=0&&(n(r[u].cells[o]).hasClass("e-othermonths")||n(r[u].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else n(r[u+1].cells[f]).attr("tabIndex",0).focus();else return!1}else return!1},_processShiftDown:function(t,i,r){var u,o,s;if(this.model.orientation=="horizontal")return!1;if(n(t).hasClass("e-workcells")){var h=r.length-1,f=n(t).parent()[0].rowIndex,e=n(t)[0].cellIndex;f>=0&&f<=h&&f!="undefined"&&(n(r[f].cells[e]).addClass("e-selectedCell").attr("tabIndex",0).focus(),u=parseInt(f)+1,u<=h?(n(r[u].cells[e]).hasClass("e-selectedCell")?(n(r[u].cells[e]).attr("tabIndex",0).focus(),n(r[f].cells[e]).removeClass("e-selectedCell")):(n(r[f].cells[e]).addClass("e-selectedCell"),n(r[u].cells[e]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=u,this._currentColIndex=e):(n(r[f].cells[e]).attr("tabIndex",0).focus(),this._currentRowIndex=f,this._currentColIndex=e))}else if(n(t).hasClass("e-monthcells")){var c=Math.floor(n(t).index()/7),h=r.length-1,l=7*(c+1),a=7*parseInt(c),f=n(t).parent()[0].rowIndex,e=n(t)[0].cellIndex;if(f>=0&&f<=h&&f!="undefined")if(u=parseInt(f)+1,u<this._dateRender.length/7)if(n(r[u].cells[e]).hasClass("e-selectedCell")){for(o=e;o<=l-1;o++)n(r[f].cells[o]).attr("tabIndex",0).focus(),n(r[f].cells[o]).removeClass("e-selectedCell");for(s=a;s<=e;s++)u<this._dateRender.length/7&&(n(r[u].cells[s]).attr("tabIndex",0).focus(),n(r[u].cells[s]).removeClass("e-selectedCell"));n(r[u].cells[e]).hasClass("e-othermonths")||n(r[u].cells[e]).addClass("e-selectedCell")}else{for(o=e;o<=l-1;o++)n(r[f].cells[o]).hasClass("e-othermonths")||n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(s=a;s<=e;s++)u<this._dateRender.length/7&&(n(r[u].cells[s]).hasClass("e-othermonths")||n(r[u].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else n(r[u-1].cells[e]).attr("tabIndex",0).focus();else return!1}else return!1},_processShiftLeft:function(t,i,r){var rt=r.length-1,c,l,h,v;if(n(t).hasClass("e-workcells")){var b=t,y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,d=this.model.orientation=="vertical"?y:this.currentView()=="month"?this.totdays.length:y*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),p=Math.floor(n(b).index()/d),g=d*p,o=n(b)[0].cellIndex,e=n(b).parent()[0].rowIndex,u=o-1,nt=this.model.orientation=="vertical"?0:e,tt=this.model.orientation=="vertical"?rt:e,it=this.model.orientation=="vertical"&&this.model.showAllDayRow?!0:!1,k=this.element.find(".e-alldaycells").parent();if(o>0&&u>parseInt(g)-1&&o!="undefined"){if(n(r[e].cells[u]).hasClass("e-selectedCell")){for(c=nt;c<=parseInt(e);c++)n(r[c].cells[o]).removeClass("e-selectedCell");for(l=tt;l>=parseInt(e);l--)n(r[l].cells[u]).removeClass("e-selectedCell");it&&n(k[0].cells[o]).removeClass("e-selectedCell").attr("tabIndex",0).focus();n(r[e].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(c=nt;c<=parseInt(e);c++)n(r[c].cells[o]).addClass("e-selectedCell");for(l=tt;l>=parseInt(e);l--)n(r[l].cells[u]).addClass("e-selectedCell");it&&(n(k[0].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(k[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus());n(r[e].cells[u]).attr("tabIndex",0).focus()}this._currentRowIndex=e;this._currentColIndex=u}else n(r[e].cells[u+1]).attr("tabIndex",0).focus(),this._currentRowIndex=e,this._currentColIndex=u+1}else if(n(t).hasClass("e-monthcells")){var p=Math.floor(n(t).index()/7),rt=r.length-1,a=7*(parseInt(p)+1),w=7*parseInt(p),s=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;if(f>=w&&f<=a&&f!="undefined")newcur=parseInt(f)-1,n(r[s].cells[newcur]).hasClass("e-selectedCell")?f==w&&s>=1?(h=parseInt(s)-1,v=parseInt(a)-1,h>=0&&(n(r[h].cells[v]).attr("tabIndex",0).focus(),n(r[h].cells[f]).removeClass("e-selectedCell"),n(r[s].cells[w]).removeClass("e-selectedClass"))):f<a&&(newcur=parseInt(f)-1,n(r[s].cells[newcur]).attr("tabIndex",0).focus(),n(r[s].cells[f]).removeClass("e-selectedCell")):f==w&&s>=0?(h=parseInt(s)-1,v=parseInt(a)-1,h>=0?n(r[h].cells[v]).hasClass("e-othermonths")||n(r[h].cells[v]).addClass("e-selectedCell").attr("tabIndex",0).focus():n(r[h+1].cells[f]).attr("tabIndex",0).focus()):f<a&&(newcur=parseInt(f)-1,n(r[s].cells[newcur]).hasClass("e-othermonths")||n(r[s].cells[newcur]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(t).hasClass("e-alldaycells")){var y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=Math.floor(n(t).index()/y),g=y*p,o=n(t)[0].cellIndex,u=o-1;o>0&&u>parseInt(g)-1&&o!="undefined"?(n(r[0].cells[u]).hasClass("e-selectedCell")?(n(r[0].cells[o]).removeClass("e-selectedCell"),n(r[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=u):(n(r[0].cells[u+1]).attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=u+1)}else return!1},_processShiftRight:function(t,i,r){var s,h,o;if(n(t).hasClass("e-workcells")){var g=r.length-1,l=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=this.model.orientation=="vertical"?l:this.currentView()=="month"?this.totdays.length:l*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),a=Math.floor(n(t).index()/p),c=p*(a+1),e=n(t).parent()[0].rowIndex,u=n(t)[0].cellIndex,f=parseInt(u)+1,w=this.model.orientation=="vertical"?0:e,b=this.model.orientation=="vertical"?g:e,y=this.element.find(".e-alldaycells").parent(),k=this.model.orientation=="vertical"&&this.model.showAllDayRow?!0:!1;if(u>=0&&u<parseInt(c)-1&&u!="undefined"){if(n(r[e].cells[f]).hasClass("e-selectedCell")){for(s=parseInt(e);s<=b;s++)n(r[s].cells[u]).removeClass("e-selectedCell");for(h=w;h<=e;h++)n(r[h].cells[f]).removeClass("e-selectedCell").attr("tabIndex",0).focus();k&&n(y[0].cells[u]).removeClass("e-selectedCell");n(r[e].cells[f]).addClass("e-selectedCell")}else{for(s=parseInt(e);s<=b;s++)n(r[s].cells[u]).addClass("e-selectedCell");for(h=w;h<=e;h++)n(r[h].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus();k&&(n(y[0].cells[f]).addClass("e-selectedCell"),n(y[0].cells[u]).addClass("e-selectedCell"))}this._currentRowIndex=e;this._currentColIndex=f}else n(r[e].cells[u]).attr("tabIndex",0).focus()}else if(n(t).hasClass("e-monthcells")){var a=Math.floor(n(t).index()/7),g=r.length-1,v=c=7*(parseInt(a)+1),d=7*parseInt(a),e=n(t).parent()[0].rowIndex,u=n(t)[0].cellIndex,f=parseInt(u)+1;if(u>=0&&u<=parseInt(c)-1&&u!="undefined")n(r[e].cells[f]).hasClass("e-selectedCell")?(f<v&&(n(r[e].cells[f]).attr("tabIndex",0).focus(),n(r[e].cells[u]).removeClass("e-selectedCell")),u==parseInt(c)-1&&e<this._dateRender.length/7&&(o=parseInt(e)+1,u=d,o<this._dateRender.length/7&&(n(r[o].cells[u]).hasClass("e-othermonths")||n(r[o].cells[u]).removeClass("e-selectedCell").attr("tabIndex",0).focus(),f<v&&(n(r[o].cells[f]).attr("tabIndex",0).focus(),n(r[o].cells[u]).removeClass("e-selectedCell"))))):(f<v&&(n(r[e].cells[f]).hasClass("e-othermonths")||n(r[e].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()),u==parseInt(c)-1&&e<this._dateRender.length/7&&(o=parseInt(e)+1,u=d,o<this._dateRender.length/7?(n(r[o].cells[u]).hasClass("e-othermonths")&&n(r[o].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),f<v&&n(r[o].cells[f]).hasClass("e-othermonths")&&n(r[o].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[o-1].cells[f-1]).attr("tabIndex",0).focus()));else return!1}else if(n(t).hasClass("e-alldaycells")){var l=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,a=Math.floor(n(t).index()/l),c=l*(a+1),u=n(t)[0].cellIndex,f=parseInt(u)+1;u>=0&&u<parseInt(c)-1&&u!="undefined"?(n(r[0].cells[f]).hasClass("e-selectedCell")?(n(r[0].cells[u]).removeClass("e-selectedCell"),n(r[0].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[0].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=f):n(r[0].cells[u]).attr("tabIndex",0).focus()}else return!1},_processEnterKey:function(i){var f,e,u,r;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();n(i).hasClass("e-workcells")||n(i).hasClass("e-monthcells")||n(i).hasClass("e-alldaycells")?(f=this.element.find("td.e-selectedCell"),e=f.length-1,e==0?this._cellSelection(i):this._multipleCellAppointCreation(i)):n(i).hasClass("e-detailedapp e-detailedwindow")?this._appointmentWindow(i):n(i).parent().hasClass("e-allday")?(u=this._appointmentAddWindow.find("#"+this._id+"allday").ejCheckBox("option","checked"),r=u?!1:!0,this._appointmentAddWindow.find(".allday").ejCheckBox({checked:r})):n(i).parent().hasClass("e-recurrence")?(u=this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked"),r=u?!1:!0,this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:r}),this._recurChecked=r?!0:!1,this._repeat(i)):n(i).hasClass("e-scheduledelete")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-scheduledelete").click():n(i).hasClass("e-editevent")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-editevent").click():n(i).hasClass(".e-editseries")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-editseries").click():n(i).hasClass("e-appointment")||n(i).hasClass("e-alldayappointment")||n(i).hasClass("e-monthappointment")?this._cellSelection(i):n(i).parent().hasClass("e-weekday")&&(u=this._appointmentAddWindow.find("#"+n(i).children()[0].id).ejCheckBox("option","checked"),r=u?!1:!0,this._appointmentAddWindow.find("#"+n(i).children()[0].id).ejCheckBox({checked:r}))},_findMinMaxCellIndex:function(){var u=this.element.find("div.e-draggableworkarea tr"),o=u.length-1,i,t,f,s,e,r=this.currentView(),h=r=="day"?1:r=="workweek"?this.model.workWeek.length:7,c=this;return this.element.find("td.e-selectedCell").each(function(h,c){var a=n(c).index(),l;if(a!=null&&!isNaN(a)){if(i==null?(i=a,f=n(c).parent()[0].rowIndex):i<a?i=i:i!=a&&(i=a,f=n(c).parent()[0].rowIndex),r!="month")for(l=0;l<=o;l++)if(n(u[l].cells[i]).hasClass("e-selectedCell")){f=l;break}if(t==null){if(t=a,r!="month")for(e=parseInt(t),l=0;l<=o;l++)n(u[l].cells[e]).hasClass("e-selectedCell")&&(s=l)}else if(t>a)t=t;else if(t!=a&&(t=a,r!="month"))for(e=parseInt(t),l=0;l<=o;l++)n(u[l].cells[e]).hasClass("e-selectedCell")&&(s=l)}}),{rowInx:f,maxrowInx:s,omincolIndex:i,omaxcolIndex:t}},_multipleCellAppointCreation:function(i){var r;if(t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow(),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),this._multiple=!0,this._slotByCellSelect(r),this.model.showQuickWindow&&i.type!=="beforeOpen"){this._quickAppointWindow.find("#"+this._id+"_quickAppwindow").css("display","block");new Date(new Date(this.cur_StartTime).setHours(0,0,0,0)).getTime()==new Date(new Date(this.cur_EndTime).setHours(0,0,0,0)).getTime()?this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"MMMM",this.model.locale)+" "+new Date(this.cur_StartTime).getDate()+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)):this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"MMMM",this.model.locale)+" "+new Date(this.cur_StartTime).getDate()+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+this._dayFullNames[new Date(this.cur_EndTime).getDay()]+", "+t.format(new Date(this.cur_EndTime),"MMMM",this.model.locale)+" "+new Date(this.cur_EndTime).getDate()+", "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale));this._quickAppointWindow.find(".subject").val("");this.model.readOnly||this._quickAppointWindow.ejDialog("open");var f=n(r).offset().left-(this._quickAppointWindow.width()-n(r).width())/2+10,e=n(r).offset().top-this._quickAppointWindow.height()-10,u=this._quickWindowPosition(f,e,n(r),this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:u.X,Y:u.Y}});this._quickAppointWindow.find(".subject").focus();t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(n(r))}this._cellClick=!0},_slotByCellSelect:function(t){var i=this.model.showWeekend?7:this.model.workWeek.length,u,f;this._cellIndex=n(t).hasClass("e-workcells")?n(t).index():n(t).hasClass("e-alldaycells")?n(t).index():i-((parseInt(n(t).index()/i)+1)*i-n(t).index())+n(t).parent().index()*i;this.model.orientation=="horizontal"&&(this._cellIndex=this.currentView()!=="month"?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)):this._cellIndex,this._workCellIndex=n(t).parent().index());var e=this._findMinMaxCellIndex(),o=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender,s=e.omincolIndex,h=e.omaxcolIndex,p=e.rowInx,c=e.maxrowInx,u=o[s],f=o[h];if(this.model.orientation=="vertical")if(n(t).hasClass("e-workcells")){var l=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,v=this.model.startHour*36e5+p*l*6e4,y=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)-1==c?this.model.startHour*36e5+(c+1)*l*6e4-1:this.model.startHour*36e5+(c+1)*l*6e4;this.cur_StartTime=new Date(new Date(u).setMilliseconds(v));this.cur_EndTime=new Date(new Date(f).setMilliseconds(y))}else if(n(t).hasClass("e-monthcells")){var r=this.element.find("td.e-selectedCell"),a=r.length-1,w=n(r[0]).parent().index()*i+(n(r[0]).index()-Math.floor(n(r[0]).index()/i)*i),b=n(r[a]).parent().index()*i+(n(r[a]).index()-Math.floor(n(r[a]).index()/i)*i),k=new Date(this._dateRender[w]),d=new Date(this._dateRender[b]);this.cur_StartTime=new Date(k.setHours(0,0,0));this.cur_EndTime=new Date(d.setHours(23,59,59))}else n(t).hasClass("e-alldaycells")&&(this.cur_StartTime=new Date(u),this.cur_EndTime=new Date(new Date(f).setHours(23,59,59)));else if(this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){var u=o[parseInt(s/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],f=o[parseInt(h/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],g=s%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),v=this.model.startHour+g/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),nt=h%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),y=this.model.startHour+nt/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot));this.cur_StartTime=new Date(u).setMinutes(v*60);this.cur_EndTime=new Date(f).setMinutes(y*60);this.cur_EndTime=new Date(new Date(this.cur_EndTime).setMinutes(new Date(this.cur_EndTime).getMinutes()+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))}else u=this.totdays[s],f=this.totdays[h],this.cur_StartTime=new Date(u),this.cur_EndTime=new Date(new Date(f).setHours(23,59,59))},_addCellSelection:function(t){var i=this.element.find("td.e-selectedCell"),r=i.length-1;r>0&&(this.element.find("td.e-selectedCell").removeClass("e-selectedCell"),n(t[this._currentRowIndex].cells[this._currentColIndex]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_processUpArrow:function(t,i){var e,r,u;if(n(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(t).hasClass("e-selectedCell")&&this._addCellSelection(i),e=this.element.find(".e-alldaycells"),n(t).hasClass("e-workcells")){var o=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)-1;if(r>0&&r<=o&&r!="undefined"){if(n(i[r-1].cells[u]).hasClass("e-resourceheadercells"))return!1;n(i[r].cells[u]).removeClass("e-selectedCell").blur();n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else r==0&&(this.model.orientation=="vertical"?(r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(this.element).attr("tabIndex",0).focus(),n(e[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else{if(n(t).hasClass("e-alldaycells"))return!1;if(n(t).hasClass("e-monthcells")){var o=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)-1;if(r>=0&&r<=o&&r!="undefined")f>=0?(n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._selectCurrentMonth(i,r,u);else return!1}else return!1}},_processDown:function(t,i){var o,s;if(n(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(t).hasClass("e-selectedCell")&&this._addCellSelection(i),n(t).hasClass("e-workcells")){var e=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)+1;if(r>=0&&r<=e&&r!="undefined")if(f<=e){if(n(i[r+1].cells[u]).hasClass("e-resourceheadercells"))return!1;n(i[r].cells[u]).removeClass("e-selectedCell").blur();n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else n(i[r].cells[u]).attr("tabIndex",0).focus()}else if(n(t).hasClass("e-alldaycells"))o=this.element.find("td.e-selectedCell")[0].cellIndex,s=this.element.find(".e-alldaycells"),n(s[o]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-workcells")[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(n(t).hasClass("e-monthcells")){var e=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)+1;r>=0&&r<e&&r!="undefined"&&(f<=7?(n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[f-1].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus());this._selectCurrentMonth(i,r,u)}else return!1},_processRight:function(i,r){var l,s,y,p,e,h;if(n(i).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i).hasClass("e-selectedCell")&&this._addCellSelection(r),n(i).hasClass("e-workcells")){var c=r[0].cells.length,f=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,o=parseInt(u)+1;if(u>=0&&u<parseInt(c)-1&&u!="undefined")n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(u==parseInt(c)-1)this.currentView()!="month"?(l=n(i).parent()[0].rowIndex,this.element.find("div.e-navigatenext").click(),n(r[l].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigatenext").click(),n(this.element.find("div.e-draggableworkarea tr")[f].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(i).hasClass("e-monthcells")){var a=Math.floor(n(i).index()/7),b=r.length-1,v=resmaxcolindex=7*(parseInt(a)+1),w=7*parseInt(a),f=n(i).parent()[0].rowIndex,u=n(i)[0].cellIndex,o=parseInt(u)+1;o<v&&(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus());u==parseInt(resmaxcolindex)-1&&f<this._dateRender.length/7&&(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),s=parseInt(f)+1,u=w,s<this._dateRender.length/7?(n(r[s].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),o<v&&n(r[s].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(y=u/7,this.element.find("div.e-navigatenext").click(),p=t.isNullOrUndefined(this.model.group)?0:y*7,n(this.element.find(".e-monthcells")[p]).addClass("e-selectedCell").attr("tabIndex",0).focus()));this._selectCurrentMonth(r,f,u)}else if(n(i).hasClass("e-alldaycells"))if(e=this.element.find("td.e-selectedCell")[0].cellIndex,h=parseInt(this.element.find(".e-alldaycells").length)-1,e>=0&&e<h)n(this.element.find(".e-alldaycells")[e]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-alldaycells")[parseInt(e)+1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(e==h)this.element.find("div.e-navigatenext").click(),n(this.element.find(".e-alldaycells")[0]).addClass("e-selectedCell").attr("tabIndex",0).focus();else return!1;this._keyPressed=!0},_processLeft:function(i,r){var l,f,u,h,w,b,k,d,e,c;if(n(i).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i).hasClass("e-selectedCell")&&this._addCellSelection(r),n(i).hasClass("e-workcells")){var o=r[0].cells.length,f=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,s=parseInt(u)-1;if(u>0&&u<=parseInt(o)-1&&u!="undefined")n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(u==0)this.currentView()!="month"?(l=n(i).parent()[0].rowIndex,this.element.find("div.e-navigateprevious").click(),n(r[l].cells[o-1]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigateprevious").click(),n(this.element.find("div.e-draggableworkarea tr")[f].cells[this.totdays.length-1]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(i).hasClass("e-monthcells")){var a=Math.floor(n(i).index()/7),nt=r.length-1,v=7*(parseInt(a)+1),g=7*parseInt(a),y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=this.model.orientation=="vertical"?y:this.currentView()=="month"?this.totdays.length:y*(this.model.endHour-this.model.startHour)*2;o=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&this.model.orientation=="vertical"?this.render_Resources[this.render_Resources.length-1].length*p:p;f=this.element.find("td.e-selectedCell").parent()[0].rowIndex;u=this.element.find("td.e-selectedCell")[0].cellIndex;u==g&&f>=0?(h=parseInt(f)-1,w=parseInt(v)-1,h>=0?(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[h].cells[w]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(b=u/7,this.element.find("div.e-navigateprevious").click(),k=this._dateRender.length/7,d=t.isNullOrUndefined(this.model.group)?0:b*7,n(this.element.find("div.e-draggableworkarea tr")[k-1].cells[d+6]).addClass("e-selectedCell").attr("tabIndex",0).focus())):u<v&&(s=parseInt(u)-1,n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus());this._selectCurrentMonth(r,f,u)}else if(n(i).hasClass("e-alldaycells"))if(e=this.element.find("td.e-selectedCell")[0].cellIndex,c=parseInt(this.element.find(".e-alldaycells").length)-1,e>0&&e<=c)n(this.element.find(".e-alldaycells")[e]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-alldaycells")[parseInt(e)-1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(e==0)this.element.find("div.e-navigateprevious").click(),n(this.element.find(".e-alldaycells")[c]).addClass("e-selectedCell").attr("tabIndex",0).focus();else return!1;this._keyPressed=!0},_selectCurrentMonth:function(t,i,r){t.find(".e-selectedCell").hasClass("e-othermonths")&&(t.find(".e-selectedCell").removeClass("e-selectedCell").blur(),n(t[i].cells[r]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_navigateToolbarRight:function(n){var t=this.model.views,i=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index(),r;i<t.length-1&&(r=t[i+1].toLowerCase(),this._navView=!0,this._viewChange(n,this.currentView(),r),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_navigateToolbarLeft:function(n){var t=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index(),i;t>0&&(i=this.model.views[t-1].toLowerCase(),this._navView=!0,this._viewChange(n,this.currentView(),i),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_newAppWindow:function(i){var u,f,b,v,k,w;if(n(i).hasClass("e-selectedCell")){t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._currentAction=t.Schedule.Actions.Add;var h=i==null?w:i,ut=n(h).parent().index(),ft=n(h).index(),r=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this.dateRender:this._dateRender;if(r=this.model.orientation=="horizontal"&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r,u=parseInt(this.element.find("td.e-selectedCell").length)-1,_target=n(h),this._cellIndex=this.model.timeScale.enable?_target.hasClass("e-workcells")?_target.index():_target.hasClass("e-alldaycells")?_target.index():this._isCustomMonthView()&&this._oneWeek?_target.index():7-((parseInt(_target.index()/7)+1)*7-_target.index())+_target.parent().index()*7:this.model.orientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?7-((parseInt(_target.index()/7)+1)*7-_target.index())+_target.parent().index()*7:_target.index(),this.model.orientation=="horizontal"&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*2)):this._cellIndex:_target.index(),this._workCellIndex=_target.parent().index()),u==0){if(f=new Date(r[this._cellIndex]),this.model.minDate>f||this.model.maxDate<f)return!1;_target.hasClass("e-workcells")&&this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?(b=this.model.orientation=="vertical"?this.model.startHour+_target.parent().index()/2:this.model.startHour+(_target.index()-(this.model.endHour-this.model.startHour)*2*this._cellIndex)/2,v=b.toString().split("."),startTime=new Date(f).setHours(parseInt(v[0]),parseInt(v[1])==5?30:00),k=parseInt(new Date(startTime).getHours())==23&&parseInt(new Date(startTime).getMinutes())==30?new Date(startTime).getMinutes()+29:new Date(startTime).getMinutes()+30,endTime=new Date(new Date(startTime).setMinutes(k)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1})):(startTime=new Date(new Date(f).setHours(0,0,0)),endTime=new Date(new Date(f).setHours(23,59,59)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}))}else if(u>0){var c=this._findMinMaxCellIndex(),l=c.omincolIndex,a=c.omaxcolIndex,d=c.rowInx,g=c.maxrowInx;if(this.model.orientation=="vertical")if(n(i).hasClass("e-workcells")){var y=r[l],p=r[a],e=(this.model.startHour+d/2).toString().split("."),o=(this.model.startHour+g/2).toString().split(".");startTime=new Date(new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:00));endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:00);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else if(n(i).hasClass("e-monthcells")){var s=this.element.find("td.e-selectedCell"),nt=n(s[0]).parent().index()*7+(n(s[0]).index()-Math.floor(n(s[0]).index()/7)*7),tt=n(s[u]).parent().index()*7+(n(s[u]).index()-Math.floor(n(s[u]).index()/7)*7),it=new Date(this._dateRender[nt]),rt=new Date(this._dateRender[tt]);startTime=new Date(new Date(it).setHours(0,0,0));endTime=new Date(new Date(rt).setHours(23,59,59))}else n(i).hasClass("e-alldaycells")&&(startTime=new Date(new Date(r[l]).setHours(0,0,0)),endTime=new Date(new Date(r[a]).setHours(23,59,59)));else if(this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){var y=r[0],p=r[0],e=(this.model.startHour+l/2).toString().split("."),o=(this.model.startHour+a/2).toString().split(".");startTime=new Date(new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:00));endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:00);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else{var y=this.totdays[l],p=this.totdays[a],e=this.model.startHour.toString().split("."),o=this.model.startHour.toString().split(".");startTime=new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:00);endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:00);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30));endTime=new Date(new Date(endTime).setHours(23,59,59))}}if(w={startTime:new Date(startTime),endTime:new Date(endTime),target:_target,resources:(this.model.appointmentWindowOpen!=null||this.model.cellDoubleClick!=null)&&this._tempResource.length!=0?this._getResourceValue(_target):null},this._trigger("appointmentWindowOpen",w))return!1;t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._renderResourceData(n(h),this._cellIndex);this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",new Date(startTime));this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",new Date(endTime));this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(startTime),this._pattern.t,this.model.locale));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(endTime),this._pattern.t,this.model.locale));(n(i).hasClass("e-alldaycells")||this.currentView()=="month"||this._isCustomMonthView())&&this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0});this._timeZoneCollection(null);this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value");this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value");this._alldayCheck();this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open"));this._appointmentAddWindow.find(".subject").focus();this._cellClick=!1}},_tooltipEvents:function(n){var i;n=="disable"?t.isNullOrUndefined(this.element.data("ejTooltip"))||(i=this.element.ejTooltip("instance"),i._wireEvents(!1)):t.isNullOrUndefined(this.element.data("ejTooltip"))||(i=this.element.ejTooltip("instance"),i._wireEvents(!0))},_showToolTip:function(i){var i=i.event,u,r,f;if(t.isNullOrUndefined(i.target))return!1;if(u=this.element.data("ejTooltip"),n(i.target).hasClass("e-appup")||n(i.target).hasClass("e-appdown"))return u.setModel({content:this._getLocalizedLabels("AppointmentIndicator")}),!0;if(n(i.target).hasClass("e-appsoverflow"))return this._showAppCount(i);if(this.model.tooltipSettings.enable&&!t.isTouchDevice()){if(r=this._getAppDetails(i.currentTarget),r==!1)return!1;if(t.isNullOrUndefined(this.model.tooltipSettings.templateId))var e=this._timeMode=="12"?t.format(r[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(r[this._appointmentSettings.startTime],"HH:mm",this.model.locale),o=this._timeMode=="12"?t.format(r[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(r[this._appointmentSettings.endTime],"HH:mm",this.model.locale),s=r[this._appointmentSettings.subject]==""||t.isNullOrUndefined(r[this._appointmentSettings.subject])?this._getLocalizedLabels("NoTitle"):r[this._appointmentSettings.subject],f=s+": ("+e+"-"+o+")";else f=n(this.model.tooltipSettings.templateId).render(r).trim();return u.setModel({content:f}),!0}return!1},_showAppCount:function(i){var f=i.target.id.split("_"),l=this.currentView()!="day"?new Date(parseInt(n(i.currentTarget).attr("cellinfo"))):new Date(n(i.currentTarget).attr("cellinfo")),a,r,s,h,u,c,b;if(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&(a=this._resourceSort()[parseInt(f[f.length-2])].id),this.model.orientation=="horizontal"&&this.currentView()!="month")var k=parseInt(f[f.length-1]),v=new Date(l.setMilliseconds((this.model.startHour*60+k*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4)),d=new Date(v.setMilliseconds(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4));if(r=n.templates(n(this.model.appointmentTemplateId).html()),s=this.element.find(".e-appsoverflow").height(),this.model.orientation=="vertical"){var y=this.element.find(".e-monthcells").outerHeight(),e=this.element.find(".e-monthappointment").outerHeight(),g=this.element.find(".e-monthheader").height();t.isNullOrUndefined(e)&&(e=this.model.appointmentTemplateId?n(r.markup).css("height")=="100%"?y-this.element.find(".e-monthheader").height()-15:n(r.markup).css("height")=="0px"?20:n(r.markup).height():19);var p=parseInt(n(i.currentTarget).attr("appcount")),w=p*e+g+s,o=Math.round((w-y)/e);o=o==0?1:o}else{h=this.element.find(".e-workcells").outerHeight();u=this.currentView()=="month"?u=this.element.find(".e-monthappointment").outerHeight():this.element.find(".e-appointment").height();t.isNullOrUndefined(u)&&(u=this.model.appointmentTemplateId?n(r.markup).css("height")=="100%"?h-15:n(r.markup).css("height")=="0px"?20:n(r.markup).height():20);var s=this.element.find(".e-appsoverflow").height(),p=parseInt(n(i.currentTarget).attr("appcount")),w=p*u+s,o=Math.ceil((w-h)/u)}return(c={Date:l,ResourceValue:a,StartTime:v,EndTime:d},this._overflowApp=c,b=this.element.data("ejTooltip"),this._trigger("overflowButtonHover",{event:i,datas:c}))?!1:(b.setModel({content:o+" "+this._getLocalizedLabels("OverFlowAppCount")}),!0)},_horizontalRender:function(){var u,i,r,n,f;t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this.element.find(".resemptytd").width(this.element.find(".e-horizontalrestd").width()<100?5:this.element.find(".e-horizontalrestd").width()>=100&&this.element.find(".e-horizontalrestd").width()<=150?10:25);this._mediaQuery?this.element.find(".e-parentnode,.e-childnode").css({height:this.element.find(".e-workcells").height()}):(u=this._tempResource.length==0?this.res1.length:this._resourceSort().length,i=this.element.find("div#"+this._id+"_scroller").ejScroller("isHScroll")?this.element.find("div#"+this._id+"_scroller").find(".e-hscroll").outerHeight():0,i=t.isNullOrUndefined(i)?0:i,r=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top+i),t.isNullOrUndefined(this.model.group)||this._tempResource.length==0?this.element.find(".e-workcells").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):Math.round(r-1)+"px"}):(n=Math.round(r/u)-1,n=n<20?20:n,this.element.find(".e-workcells").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.element.find(".e-childnode").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.element.find(".e-parentnode").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.currentView()!="agenda"&&(f=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css({top:-f+"px"}))));this.element.find(".e-workcells").height()>r&&this.element.find("div#"+this._id+"_scroller").ejScroller("refresh");this.element.find("div#"+this._id+"_scroller").ejScroller("isVScroll")&&this._showScrollTd()},_monthCellsRender:function(){var n=this.element.find(".e-workcellstab tr").length,t=parseInt(this.scHeight)-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top);this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:Math.round(t/n))},_processTab:function(t,i,r){var u=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment"),h,c,o,e,f,s;if((t.id==this._id||n(t).hasClass("e-datedisplay"))&&(u.length!=0?n(u[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),n(t).hasClass("e-selectedCell")&&u.length!=0){if(h=this.element.find("td.e-selectedCell"),c=parseInt(h.length)-1,c>0)for(o=0;o<=c;o++)h.eq(o).removeClass("e-selectedCell").blur();else n(t).removeClass("e-selectedCell").blur();n(u[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}n(t).hasClass("e-navigateprevious")?this.element.find(".e-navigatenext").attr("tabIndex",0).focus():n(t).hasClass("e-navigatenext")&&(n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(r[0].cells[0]).hasClass("e-resourceheadercells")&&n(r[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());(n(t).hasClass("e-appointment")||n(t).hasClass("e-alldayappointment")||n(t).hasClass("e-monthappointment")||n(t).hasClass("e-agendaappointment"))&&(e=u.length,f=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),f<e&&f>=0?(n(u[f]).removeClass("e-selectedAppointment").blur(),s=parseInt(f)+1,s<e?n(u[s]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():s==e&&this.element.find(".e-navigateprevious").attr("tabIndex",0).focus()):f==e&&this.element.find(".e-navigateprevious").attr("tabIndex",0).focus())},_reverseTab:function(t,i,r){var u=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment"),h,e,c,l,o,f,s;if((t.id==this._id||n(t).hasClass("e-datedisplay"))&&(e=parseInt(u.length)-1,u.length!=0&&n(u[e]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()),h=u.length,n(t).hasClass("e-selectedCell")&&(e=u.length-1,u.length!=0)){if(c=this.element.find("td.e-selectedCell"),l=parseInt(c.length)-1,l>0)for(o=0;o<=l;o++)c.eq(o).removeClass("e-selectedCell").blur();else n(t).removeClass("e-selectedCell").blur();n(u[e]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}n(t).hasClass("e-navigatenext")?n(this.element).find(".e-navigateprevious").attr("tabIndex",0).focus():n(t).hasClass("e-navigateprevious")&&(n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(r[0].cells[0]).hasClass("e-resourceheadercells")&&n(r[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());(n(t).hasClass("e-appointment")||n(t).hasClass("e-alldayappointment")||n(t).hasClass("e-monthappointment")||n(t).hasClass("e-agendaappointment"))&&(f=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),f<h&&f>0?(n(u[f]).removeClass("e-selectedAppointment").blur(),s=parseInt(f)-1,s<h&&f>=0?n(u[s]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():s==0&&n(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()):f==0&&(n(u[f]).removeClass("e-selectedAppointment").blur(),n(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()))},_stopDefaultAction:function(n){n.cancelBubble=!0;n.returnValue=!1;n.stopPropagation();n.preventDefault()},_getLocalizedLabels:function(n){return n=="Categorize"?t.isNullOrUndefined(this.model.categorizeSettings.title)?this._localizedLabels[n]===r?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]:this.model.categorizeSettings.title:n=="Priority"?t.isNullOrUndefined(this.model.prioritySettings.title)?this._localizedLabels[n]===r?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]:this.model.prioritySettings.title:this._localizedLabels[n]===r?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]},_refreshDatasource:function(){var i,n,r;if(!t.isNullOrUndefined(this.dataSource())&&this.dataSource().length>0)for(i=this.dataSource(),n=0,r=i.length;n<r;n++)this._timeZoneAppointments(i[n],"")},refreshAppointments:function(){t.isNullOrUndefined(this._appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null);this._refreshDatasource();this._bindAppointmentsData("Refresh")},refresh:function(){this._refreshDatasource();this._destroy();this._init()},getSlotByElement:function(i){var r=t.isNullOrUndefined(i)?n(this.element.find("td.e-selectedCell")):n(i);return t.isNullOrUndefined(r)||r.length==0||this.currentView()=="agenda"?!1:((r.hasClass("e-workcells")||r.hasClass("e-monthcells")||r.hasClass("e-alldaycells"))&&(r.length==1?this._slotByElement(r,""):this._slotByCellSelect(r)),{startTime:new Date(this.cur_StartTime),endTime:new Date(this.cur_EndTime),resources:!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._getResourceValue(r):null})},saveAppointment:function(i){var tt,ri,d,gt,k,r,a,v,vt,ut,et,u,g,yt,ni,ht,s,ft,e,ti,ii,ct,rt,st,h,dt,lt,nt,b,at,y;if(!this.model.readOnly){if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties(),tt=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),ri=this._sortAppById(this._processed),this._publicMethodSave=!1,this.model.appointmentSettings.applyTimeOffset&&(t.isNullOrUndefined(i[this._appointmentSettings.startTimeZone])&&(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),t.isNullOrUndefined(i[this._appointmentSettings.endTimeZone])&&(i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone)),gt=this._timeZoneSavingAppoint(i,""),i=gt.obj,t.isNullOrUndefined(i[this._appointmentSettings.id])&&!i[this._appointmentSettings.id]!=""||(k=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i[this._appointmentSettings.id])),t.isNullOrUndefined(k[0])||(i.Guid=k[0].Guid,i.AppTaskId=k[0].AppTaskId,i[this._appointmentSettings.recurrenceId]=k[0][this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=k[0][this._appointmentSettings.recurrenceExDate],i.ParentId=k[0].ParentId)),r=this,this._maxId=d=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,a=this._currentAction=="save"?"edit":this._currentAction,t.isNullOrUndefined(i.AppTaskId)||i.AppTaskId==""){if((i[this._appointmentSettings.id]=t.isNullOrUndefined(i[this._appointmentSettings.id])||i[this._appointmentSettings.id]==""?d:i[this._appointmentSettings.id],i.AppTaskId=i.ParentId=d,i.Guid=this._guidFormatGenerate(),this._trigger("actionBegin",{data:i,requestType:"appointmentSave",methodType:"public"}))||this._trigger("beforeAppointmentCreate",{appointment:i,methodType:"public"}))return!1;for(v=this._timeZoneAppointments(i,""),h=this._dataManager.insert(v,this.model.appointmentSettings.query._fromTable),new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(v,"reverse")),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(v),this._appointmentProcessing(i),this._currentViewAppointments=this._appointmentCount(),vt=this._currentViewAppointments.filter(function(n){return i.ParentId==n.ParentId}),ut=0,y=vt.length;ut<y;ut++)this._refreshDayAppointments(vt[ut]);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;this._trigger("appointmentCreated",{appointment:v,requestType:"appointmentSaved",methodType:"public"});this._trigger("actionComplete",{data:v,requestType:"appointmentSave",methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var u=t.isNullOrUndefined(i.record)?i:i.record,f,e;if(n.isArray(u))r._processUrlBinding(i);else if(n.isPlainObject(u)&&u.added.length>0)for(r._dateFormat(u.added),f=0,e=u.added.length;f<e;f++)v[r._appointmentSettings.id]=u.added[f][r._appointmentSettings.id],v[r._appointmentSettings.recurrence]||(v.ParentId=u.added[f][r._appointmentSettings.id]),new t.DataManager(r._processed).update("Guid",v)})}else if(this._currentAction=="editOccurrence"){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:a})||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:a}))return!1;var p=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],ft=p[this._appointmentSettings.recurrenceId]==null?p.ParentId:p[this._appointmentSettings.recurrenceId],et=p[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,c=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(et,t.FilterOperators.equal,ft))),l=this._recuCollectionIndex(c,p),o=this._appointmentSettings;if(l==0?t.isNullOrUndefined(c[l+1])?!1:!(new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()):l==c.length-1?!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1;s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));this._objDate=s;et=this._objDate[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId;e=this._deleteOcurrence(this._objDate[0][et],new Date(s[0][this._appointmentSettings.startTime]));i[this._appointmentSettings.recurrence]=1;i[this._appointmentSettings.recurrenceRule]=e[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+e[0].ParentId;i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId];i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExdate];i.Guid=s[0].Guid;i[this._appointmentSettings.id]=s[0][this._appointmentSettings.id];u=[];g=this._addAppData(i,d,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),i[this._appointmentSettings.recurrenceId]);g[this._appointmentSettings.id]=g.AppTaskId;u.push(g);var w=[],e=[],ot=u[0][this._appointmentSettings.startTimeZone];ot!=this.model.timeZone?w.push(this._timeZoneAppointments(u[0],"")):w.push(u[0]);yt=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,this._parentId));ot!=this.model.timeZone?e.push(this._timeZoneAppointments(yt[0],"")):e.push(yt[0]);var st=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:w,changed:e,deleted:[]},st,this.model.appointmentSettings.query._fromTable),ui=ot!=this.model.timeZone?this._timeZoneAppointments(w[0],"reverse"):w[0];for(new t.DataManager(this._currentAppointmentData).update("AppTaskId",ui),ni=ot!=this.model.timeZone?this._timeZoneAppointments(e[0],"reverse"):e[0],new t.DataManager(this._currentAppointmentData).update("AppTaskId",ni),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u[0]),ht=this._processed.filter(function(n){return n.Guid==u[0].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ht},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ht},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ht},"Guid"),this._appointmentProcessing(u[0]),this._currentViewAppointments=this._appointmentCount(),nt=this._currentViewAppointments.filter(function(n){return n.ParentId==u[0].ParentId}),b=0,y=nt.length;b<y;b++)this._refreshDayAppointments(nt[b]);this._trigger("appointmentChanged",{appointment:u[0],requestType:"appointmentChanged",currentAction:a,methodType:"public"});this._trigger("actionComplete",{data:u,requestType:"appointmentEdit",currentAction:a,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var f=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(f))r._processUrlBinding(i);else if(n.isPlainObject(f)&&f.added.length>0)for(r._dateFormat(f.added),e=0,o=f.added.length;e<o;e++)u[0][r._appointmentSettings.id]=f.added[e][r._appointmentSettings.id],u[0][r._appointmentSettings.recurrence]||(u[0].ParentId=f.added[e][r._appointmentSettings.id]),new t.DataManager(r._processed).update("Guid",u[0])})}else if(this._currentAction=="save"&&i[this._appointmentSettings.recurrence]||this._currentAction==t.Schedule.Actions.EditSeries){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:a})||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:a}))return!1;if(s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._currentAction!=t.Schedule.Actions.EditSeries){t.isNullOrUndefined(s[0][this._appointmentSettings.recurrenceRule])||(i[this._appointmentSettings.recurrenceRule]=s[0][this._appointmentSettings.recurrenceRule]);var p=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],ft=p[this._appointmentSettings.recurrenceId]==null?p.ParentId:p[this._appointmentSettings.recurrenceId],et=p[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,c=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(et,t.FilterOperators.equal,ft))),l=this._recuCollectionIndex(c,p),o=this._appointmentSettings;if(l==0?t.isNullOrUndefined(c[l+1])?!1:!(new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()):l==c.length-1?!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else ft=s[0][this._appointmentSettings.recurrenceId]==null?s[0].ParentId:s[0][this._appointmentSettings.recurrenceId],e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,ft)),d=i.AppTaskId=e[0].AppTaskId,i[this._appointmentSettings.id]=e[0][this._appointmentSettings.id],i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExate],i[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(tt._recRule)||tt._recRule==""?e[0][this._appointmentSettings.recurrenceRule]:tt._recRule;i.Guid=s[0].Guid;i[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?s[0][this._appointmentSettings.id]:i[this._appointmentSettings.id];var u=[],g,pt=this._currentAction==t.Schedule.Actions.EditOccurrence||!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?this._parentId:this._currentAction==t.Schedule.Actions.Save?s[0].AppTaskId:d,wt=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&this._currentAction!=t.Schedule.Actions.EditOccurrence&&i[this._appointmentSettings.allDay]==!0?pt:this._currentAction==t.Schedule.Actions.Save?s[0].AppTaskId:this._appMainId+1;wt=this._currentAction==t.Schedule.Actions.EditSeries?pt:wt;g=this._addAppData(i,wt,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),pt);u.push(g);var w=[],f=[],it=[],fi=this._currentAction==t.Schedule.Actions.Save?u[0].Guid:u[0][this._appointmentSettings.recurrenceId],ei=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId,e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(ei,t.FilterOperators.equal,fi));if(!t.isNullOrUndefined(e)&&e.length>0?f.push(u[0]):w.push(u[0]),this._currentAction==t.Schedule.Actions.EditSeries)for(ti=t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+u[0].ParentId,!0)),ii=new t.DataManager(this._currentAppointmentData).executeLocal(ti),it=it.concat(ii),f[0][this._appointmentSettings.recurrenceRule]=tt._recRule,f[0][this._appointmentSettings.recurrenceExDate]=null,new t.DataManager(this._currentAppointmentData).remove("ParentId",f[0].ParentId),ct=this._processed.filter(function(n){return n.ParentId==f[0].ParentId}),this._processed=this._processed.filter(function(n){return n.ParentId!=f[0].ParentId}),this._renderedAllDay=this._renderedAllDay.filter(function(n){return n.ParentId!=f[0].ParentId}),this._renderedApp=this._renderedApp.filter(function(n){return n.ParentId!=f[0].ParentId}),rt=0,y=ct.length;rt<y;rt++)this._appointmentRemove(ct[rt]),this._refreshDayAppointments(ct[rt]);var r=this,bt=[],kt=[];for(w.length>0&&bt.push(this._timeZoneAppointments(w[0],"")),f.length>0&&kt.push(this._timeZoneAppointments(f[0],"")),st=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:bt,changed:kt,deleted:it},st,this.model.appointmentSettings.query._fromTable),f.length>0&&(dt=this._timeZoneAppointments(kt[0],"reverse")),w.length>0&&(dt=this._timeZoneAppointments(bt[0],"reverse")),new t.DataManager(this._currentAppointmentData).update("AppTaskId",dt),new t.DataManager(this._currentAppointmentData).remove("Guid",f[0]),lt=this._processed.filter(function(n){return n.Guid==f[0].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:lt},"Guid"),this._currentAppointmentData.push(f[0]),this._appointmentProcessing(f[0]),this._currentViewAppointments=this._appointmentCount(),nt=this._currentViewAppointments.filter(function(n){return n.ParentId==f[0].ParentId}),b=0,y=nt.length;b<y;b++)this._refreshDayAppointments(nt[b]);for(at=0,y=it.length;at<y;at++)this._refreshDayAppointments(it[at]);this._trigger("appointmentChanged",{appointment:f[0],requestType:"appointmentChanged",currentAction:a,methodType:"public"});this._trigger("actionComplete",{data:f,requestType:"appointmentEdit",currentAction:a,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var u=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(u))r._processUrlBinding(i);else if(n.isPlainObject(u)&&u.added.length>0)for(r._dateFormat(u.added),e=0,o=u.added.length;e<o;e++)f[0][r._appointmentSettings.id]=u.added[e][r._appointmentSettings.id],f[0][r._appointmentSettings.recurrence]||(f[0].ParentId=u.added[e][r._appointmentSettings.id])})}else{if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:a,methodType:"public"})||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:a,methodType:"public"}))return!1;var v=this._timeZoneAppointments(i,""),st=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.update(st,v,this.model.appointmentSettings.query._fromTable);new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(v,"reverse"));this._renderSingleApp();this._trigger("appointmentChanged",{appointment:i,requestType:"appointmentChanged",currentAction:a,methodType:"public"});this._trigger("actionComplete",{data:i,requestType:"appointmentEdit",currentAction:a,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(u){var f=t.isNullOrUndefined(u.record)?u:u.record,e,o;if(n.isArray(f))r._processUrlBinding(u);else if(n.isPlainObject(f)&&f.added.length>0)for(r._dateFormat(f.added),e=0,o=f.added.length;e<o;e++)i[r._appointmentSettings.id]=f.added[e][r._appointmentSettings.id],i[r._appointmentSettings.recurrence]||(i.ParentId=f.added[e][r._appointmentSettings.id])})}this._currentViewAppointments=this._appointmentCount();this.model.showAppointmentNavigator&&this._nextPrevButton()}},print:function(i){if(t.isNullOrUndefined(i)){var r=this.element.clone();this.currentView()=="agenda"?(r.width(this.element.find(".e-agendacellstab").width()+2),r.height(n("#"+this._id+" .e-headertr").height()+this.element.find(".e-agendacellstab").height()+n("#"+this._id+" .e-scheduleheader").height()+2),r.find("div#"+this._id+"_scroller").ejScroller({width:this.element.find(".e-agendacellstab").width(),height:this.element.find(".e-agendacellstab").height()+2}),r.find(".e-commonviewbutton").css({"margin-top":"0px"}),r.find(".e-viewstable").css({"padding-top":"15px"})):(r.find(".e-upicon,.e-downicon").remove(),this.model.orientation=="vertical"?this.model.timeScale.enable?(this.currentView()=="month"||this._isCustomMonthView()&&this._renderDays>7?r.width(this.element.find(".e-workcellstab").width()+n(".e-monthleftindent").width()):r.width(this.element.find(".e-workcellstab").width()+n(".e-workleftindent").width()),r.height(n("#"+this._id+" .e-headertr").height()+n("#"+this._id+" .e-workcellstab").height()+n("#"+this._id+" .e-scheduleheader").height()+2),r.find(".e-scroller").ejScroller({width:n(".e-dateheader").width(),height:n("#"+this._id+" .e-workcellstab").height()+2}),r.find(".e-scrolltimecells").css({top:0}),r.find(".e-commonviewbutton").css({"margin-top":"0px"}),r.find(".e-viewstable").css({"padding-top":"15px"}),r.children().first().css({border:"0px solid #bbbcbb"}),r.css({border:"1px solid #bbbcbb"}),this.currentView()=="month"&&r.find(".e-draggableworkarea").css({height:this.element.find(".e-timecells").height()*this.element.find(".e-timecells").length+2})):(r.width(this.element.find(".e-workcellstab").width()+n(".e-workleftindent").width()),r.find(".e-workcellstab").css({left:-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"})):this.currentView()=="month"||this._isCustomMonthView()&&this._renderDays>7?r.width(this.element.find(".e-workcellstab").width()):(r.find(".e-workcellstab").css({left:-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"}),r.find(".e-horizontaltimecells tr:nth-child(2)").css("left",-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft()+"px")));this._schedulePrint(r)}else this._printAppointment(i)},_schedulePrint:function(i,r){var f=t.buildTag("div"),o=i.clone(),s=Math.round(o.width()/100)*100,r,e,u;f.append(o);r||(r=window.open("","print","height=452,width="+s+",tabbar=no"));r.document.write("<!DOCTYPE html>");e=n("head").find("link").add("style");t.browserInfo().name==="msie"?(u="",e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.write("<html><head><\/head><body>"+u+f[0].innerHTML+"<\/body><\/html>")):(u="",r.document.write("<html><head>"),e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.writeln(u+"<\/head><body>"),r.document.writeln(f[0].innerHTML+"<\/body><\/html>"));r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},1e3))},1e3)},notifyChanges:function(i,r){var e,u,f;t.isNullOrUndefined(r)&&r.length==0||(e=t.isNullOrUndefined(r)?r[0]:r,u=n.extend(!0,{},e),u[this._appointmentSettings.startTime]=new Date(u[this._appointmentSettings.startTime]),u[this._appointmentSettings.endTime]=new Date(u[this._appointmentSettings.endTime]),i=="beforeAppointmentCreate"?(new t.DataManager(this._currentAppointmentData).insert(u),this._appointmentProcessing(u),this._renderAppointmentAll()):i=="beforeAppointmentChange"?(new t.DataManager(this._currentAppointmentData).update(this._appointmentSettings.id,u),new t.DataManager(this._processed).remove(this._appointmentSettings.id,u[this._appointmentSettings.id]),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):i=="beforeAppointmentRemove"&&(f=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[this._appointmentSettings.id])),new t.DataManager(this._currentAppointmentData).remove(this._appointmentSettings.id,f[0][this._appointmentSettings.id]),new t.DataManager(this._processed).remove(this._appointmentSettings.id,f[0][this._appointmentSettings.id]),this._renderAppointmentAll()))},deleteAppointment:function(n){var i;this.model.readOnly||(typeof n=="string"?(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,n)),i[0][this._appointmentSettings.recurrence]?(this._deleteUid=n,this._deletingAppointment()):this._deleteApp(n)):typeof n=="object"&&(this._deleteUid=n.Guid,t.isNullOrUndefined(this._deleteUid)&&(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,n.ParentId)),this._deleteUid=i[0].Guid),n[this._appointmentSettings.recurrence]?this._deletingAppointment():this._deleteApp(this._deleteUid)))},getAppointments:function(){return this.dataSource()},searchAppointments:function(n,i,r,u){var e=t.isNullOrUndefined(i)?this._getColumns(this._appointmentSettings):i,o=t.isNullOrUndefined(r)?"contains":r,s=t.isNullOrUndefined(u)?!0:u,f;return typeof n=="string"?f=n==""?[]:new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).search(n,e,o,s)):typeof n=="object"&&(f=this.filterAppointments(n)),f},filterAppointments:function(n){var e,o=t.Query(),u,r,f,i;if(!t.isNullOrUndefined(n)){for(r=n[0],u=t.isNullOrUndefined(r.matchcase)?!0:r.matchcase,f=t.Predicate(r.field,r.operator,r.value,u),i=1;i<n.length;i++)u=t.isNullOrUndefined(n[i].matchcase)?!0:n[i].matchcase,f=f[n[i].predicate](n[i].field,n[i].operator,n[i].value,u);o.where(f);e=new t.DataManager(this._currentAppointmentData).executeLocal(o)}return e},refreshScroller:function(){var i=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),r=this.model.orientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width();i.model.width=parseInt(r)-2;i.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top);i.refresh();this.model.orientation=="vertical"?(this._renderHoriVerticalScroll(),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px")):(n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-horizontresdiv").height(this.element.find(".e-draggableworkarea").height()));this._reRenderHeaderBar();this.model.showAppointmentNavigator&&this._refreshAppNavigation();this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();this._highlightCurrentTime(this.model.showCurrentTimeIndicator);(this.currentView()=="month"||this._isCustomMonthView())&&this.model.orientation=="vertical"&&this._renderCurrentView("ScheduleResize");this._showScrollTd();this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36)},_refreshAppNavigation:function(){var i=this.element.find("#"+this._id+"_scroller");if((this._browserInfo.name!=="msie"||!(this._browserInfo.version<9))&&!t.isNullOrUndefined(i.data("ejScroller"))){var u=i.ejScroller("instance").isVScroll()?i.find(".e-vscroll").outerWidth():0,r=i.height()/2-75,n=this.element.find(".e-scrolltimecells").parent().outerWidth();n=t.isNullOrUndefined(n)?0:n;this.model.enableRTL?(this.element.find(".e-prevapp").css({top:r+40+"px",transform:"rotate(-90deg)",right:n-61+"px"}),this.element.find(".e-nextapp").css({top:r+40+"px",transform:"rotate(90deg)",right:this.element.find(".e-workareadiv").width()-61-u-30+"px"})):(this.element.find(".e-prevapp").css({top:r+40+"px",transform:"rotate(90deg)",left:n-61+"px"}),this.element.find(".e-nextapp").css({top:r+40+"px",transform:"rotate(-90deg)",left:this.element.find(".e-workareadiv").width()-61-u-30+"px"}))}},getDifference:function(n){var t="";return n.toString().indexOf("-")!=-1?(t=n.toString().substring(n.toString().indexOf("-")+1,n.toString().indexOf("-")+5),-(parseInt(t.substring(0,2))*60)+parseInt(t.substring(2,4))):(t=n.toString().substring(n.toString().indexOf("+")+1,n.toString().indexOf("+")+5),parseInt(t.substring(0,2))*60+parseInt(t.substring(2,4)))},exportSchedule:function(i,r,u){var l={},e=[],o=[],h,y,a,v,f,w,b,k,d;for(n.extend(!0,l,this.model),n.extend(!0,e,this._processed),n.extend(!0,o,this._processedIntervals),f=0;f<e.length;f++)e[f][this._appointmentSettings.startTime]=new Date(e[f][this._appointmentSettings.startTime].getTime()+this.getDifference(e[f][this._appointmentSettings.startTime])*6e4),e[f][this._appointmentSettings.endTime]=new Date(e[f][this._appointmentSettings.endTime].getTime()+this.getDifference(e[f][this._appointmentSettings.endTime])*6e4);for(h=0;h<o.length;h++)o[h][this.model.blockoutSettings.startTime]=new Date(o[h][this.model.blockoutSettings.startTime].getTime()+this.getDifference(o[h][this.model.blockoutSettings.startTime])*6e4),o[h][this.model.blockoutSettings.endTime]=new Date(o[h][this.model.blockoutSettings.endTime].getTime()+this.getDifference(o[h][this.model.blockoutSettings.endTime])*6e4);y=new Date(new Date(this.currentDate()).setHours(0,0,0));l.currentDate=new Date(y.getTime()+this.getDifference(y)*6e4);a=JSON.parse(JSON.stringify(this._appointmentSettings));n.extend(!0,l.appointmentSettings,a);v=JSON.parse(JSON.stringify(this.model.blockoutSettings));n.extend(!0,l.blockoutSettings,v);var c=JSON.parse(JSON.stringify(l)),g={action:i,method:"post"},s=t.buildTag("form","",null,g),p=this.currentView()=="day"?"Day":this.currentView()=="month"?"Month":this.currentView()=="week"?"Week":this.currentView()=="agenda"?"Agenda":this.currentView()=="workweek"?"WorkWeek":"CustomView";if(this._ignoreFromAppointmentOnExport)for(f=0;f<this._ignoreFromAppointmentOnExport.length;f++)delete a[this._ignoreFromAppointmentOnExport[f]],delete v[this._ignoreFromAppointmentOnExport[f]];if(this._ignoreFromModelOnExport)for(f=0;f<this._ignoreFromModelOnExport.length;f++)delete c[this._ignoreFromModelOnExport[f]];if(delete c.appointmentSettings.dataSource,delete c.blockoutSettings.dataSource,t.raiseWebFormsServerEvents)w={model:c,originalEventType:r},b={appSetting:JSON.stringify(a),appId:u,processedApp:JSON.stringify(e),blockedApp:JSON.stringify(o),model:JSON.stringify(c),locale:this._getLocalizedLabels(p)+","+this._getLocalizedLabels("AllDay")+","+this._getLocalizedLabels("Date")+","+this._getLocalizedLabels("Time")+","+this._getLocalizedLabels("Event")},t.raiseWebFormsServerEvents(r,w,b);else{var nt={name:"ScheduleApps",type:"hidden",value:JSON.stringify(a)},tt=t.buildTag("input","",null,nt),it={name:"ScheduleBlockedApps",type:"hidden",value:JSON.stringify(v)},rt=t.buildTag("input","",null,it),ut={name:"ScheduleModel",type:"hidden",value:JSON.stringify(c)},ft=t.buildTag("input","",null,ut),e={name:"ScheduleProcesedApps",type:"hidden",value:JSON.stringify(e)},et=t.buildTag("input","",null,e),o={name:"ScheduleProcesedIntervalsApps",type:"hidden",value:JSON.stringify(o)},ot=t.buildTag("input","",null,o),st={name:"Locale",type:"hidden",value:this._getLocalizedLabels(p)+","+this._getLocalizedLabels("AllDay")+","+this._getLocalizedLabels("Date")+","+this._getLocalizedLabels("Time")+","+this._getLocalizedLabels("Event")},ht=t.buildTag("input","",null,st);s.append(ft);s.append(et);s.append(ot);s.append(ht);t.isNullOrUndefined(u)||(k={name:"AppointmentId",type:"hidden",value:u},d=t.buildTag("input","",null,k),s.append(d));s.append(tt);s.append(rt);s.append(this);n("body").append(s);s.submit()}return!0}});t.scheduleFeatures.resources&&n.extend(t.Schedule.prototype,t.scheduleFeatures.resources);t.scheduleFeatures.horizontal&&n.extend(t.Schedule.prototype,t.scheduleFeatures.horizontal);t.Schedule.Locale=t.Schedule.Locale||{};t.Schedule.Locale["default"]=t.Schedule.Locale["en-US"]={ReminderWindowTitle:"Reminder window",CreateAppointmentTitle:"Create Appointment",RecurrenceEditTitle:"Edit Repeat Appointment",RecurrenceEditMessage:"How would you like to change the appointment in the series?",RecurrenceEditOnly:"Only this appointment",RecurrenceEditSeries:"Entire series",PreviousAppointment:"Previous Appointment",NextAppointment:"Next Appointment",AppointmentSubject:"Subject",StartTime:"Start Time",EndTime:"End Time",AllDay:"All day",StartTimeZone:"Start TimeZone",EndTimeZone:"End TimeZone",Today:"Today",Recurrence:"Repeat",Done:"Done",Cancel:"Cancel",Ok:"OK",Repeat:"Repeat",RepeatBy:"Repeat by",RepeatEvery:"Repeat every",RepeatOn:"Repeat on",StartsOn:"Starts on",Ends:"Ends",Summary:"Summary",Daily:"Daily",Weekly:"Weekly",Monthly:"Monthly",Yearly:"Yearly",Every:"Every",EveryWeekDay:"Every weekday",Never:"Never",After:"After",Occurrence:"Occurrence(s)",On:"On",Edit:"Edit",RecurrenceDay:"Day(s)",RecurrenceWeek:"Week(s)",RecurrenceMonth:"Month(s)",RecurrenceYear:"Year(s)",The:"The",OfEvery:"of every",First:"First",Second:"Second",Third:"Third",Fourth:"Fourth",Last:"Last",WeekDay:"Weekday",WeekEndDay:"Weekendday",Subject:"Subject",Categorize:"Categories",DueIn:"Due In",DismissAll:"Dismiss All",Dismiss:"Dismiss",OpenItem:"Open Item",Snooze:"Snooze",Day:"Day",Week:"Week",WorkWeek:"Work Week",Month:"Month",AddEvent:"Add Event",CustomView:"Custom View",Agenda:"Agenda",Detailed:"Edit Appointment",EventBeginsin:"Appointment Begins in",Editevent:"Edit Appointment",Editseries:"Edit Series",Times:"times",Until:"until",Eventwas:"Appointment was",Hours:"hrs",Minutes:"mins",Overdue:"Overdue Appointment",Days:"day(s)",Event:"Event",Select:"select",Previous:"Previous",Next:"Next",Close:"Close",Delete:"Delete",Date:"Date",Showin:"Show in",Gotodate:"Go To Date",Resources:"RESOURCES",RecurrenceDeleteTitle:"Delete Repeat Appointment",Location:"Location",Priority:"Priority",RecurrenceAlert:"Alert",RecurrenceDateValidation:"Some months have fewer than selected dates. For these months, the occurrence will fall on the last date of the month.",NoTitle:"No Title",OverFlowAppCount:"more appointment(s)",AppointmentIndicator:"Click for more appointments",WrongPattern:"The recurrence pattern is not valid",CreateError:"The duration of the appointment must be shorter than how frequently it occurs. Shorten the duration, or change the recurrence pattern in the Appointment Recurrence dialog box.",DragResizeError:"Cannot reschedule an occurrence of the recurring appointment if it skips over a later occurrence of the same appointment.",StartEndError:"End time should be greater than start time",SeriesChangeAlert:"The changes made to specific instances of this series will be cancelled and those appointments will match the series again.",MouseOverDeleteTitle:"Delete Appointment",DeleteConfirmation:"Are you sure you want to delete this appointment?",Time:"Time",EmptyResultText:"No suggestions",BlockIntervalAlertTitle:"Alert",BlockIntervalError:"The selected time interval has been blocked and is unavailable for selection."};t.Schedule.Actions={Add:"add",Save:"save",Delete:"delete",DeleteOccurrence:"deleteOccurrence",DeleteSeries:"deleteSeries",EditOccurrence:"editOccurrence",EditSeries:"editSeries"};t.Schedule.CurrentView={Day:"day",Week:"week",Workweek:"workweek",Month:"month",CustomView:"customview",Agenda:"agenda"};t.Schedule.TimeMode={Hour12:"12",Hour24:"24"};t.Schedule.Orientation={Vertical:"vertical",Horizontal:"horizontal"};t.Schedule.DayOfWeek={Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};RecurrenceEditor=function(n){function t(t,i){return n.call(this),this.defaults={frequencies:["never","daily","weekly","monthly","yearly","everyweekday"],firstDayOfWeek:null,enableSpinners:!0,startDate:new Date,locale:"en-US",enableRTL:!1,value:"",dateFormat:"",selectedRecurrenceType:0,minDate:new Date(1900,1,1),maxDate:new Date(2099,12,31),cssClass:"",change:null,create:null},this.dataTypes={frequencies:"array",enableSpinners:"boolean",enableRTL:"boolean"},this.rootCSS="e-recurrenceeditor",this.PluginName="ejRecurrenceEditor",this._id="null",this.validTags=["div"],this.model=this.defaults,t&&(this._id=t[0].id,t.jquery||(t=$("#"+t)),t.length)?$(t).ejRecurrenceEditor(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype._setModel=function(n){var i=!1;for(var t in n){switch(t){case"frequencies":this.model.frequencies=n[t];i=!0;break;case"firstDayOfWeek":this.model.firstDayOfWeek=this._firstDayOfWeek=n[t];i=!0;break;case"enableSpinners":this.model.enableSpinners=n[t];i=!0;break;case"startDate":$.type(n[t])=="string"?this._currentDateFormat(this.model.dateFormat):$.type(n[t])=="function"&&$.type(ej.util.getVal(n[t]))=="string"&&(this.model.startDate=ej.parseDate(this.model.startDate.toString(),this._datepattern()));this.model.startDate<this.model.minDate?this.model.startDate=this.model.minDate:"";this.model.startDate>this.model.maxDate?this.model.startDate=this.model.maxDate:"";this._recurrenceContent.find(".recurstartdate").ejDatePicker("option","value",this.model.startDate);break;case"locale":this.model.locale=n[t];i=!0;break;case"enableRTL":this.model.enableRTL=n[t];this._recurrenceLayout.addClass("e-rtl");break;case"value":this.model.value=n[t];break;case"dateFormat":this.model.dateFormat=n[t];this._recurrenceContent.find(".recurstartdate").ejDatePicker("option","dateFormat",this.model.dateFormat);this._recurrenceContent.find(".until").ejDatePicker("option","dateFormat",this.model.dateFormat);break;case"selectedRecurrenceType":this.model.selectedRecurrenceType=n[t];this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:this.model.selectedRecurrenceType});break;case"minDate":case"maxDate":this._currentDateFormat(this.model.dateFormat);this._recurrenceContent.find(".recurstartdate").ejDatePicker({minDate:this.model.minDate,maxDate:this.model.maxDate});break;case"cssClass":this.model.cssClass=n[t];this.element.removeClass(this.model.cssClass).addClass(n[t])}i==!0&&this._render()}},t.prototype._init=function(){ej.isNullOrUndefined(this.element)||this._render()},t.prototype._destroy=function(){var i,t,n;for(this.element.off(),i=this.element.find(".e-datepicker,.e-dropdownlist"),t=0;t<i.length;t++)n=$(i[t]),n.hasClass("e-datepicker")?n.ejDatePicker("destroy"):n.hasClass("e-dropdownlist")&&n.ejDropDownList("destroy");this.element.empty().removeClass("e-recurrenceeditor")},t.prototype._render=function(){var t,n;for($("#"+this._id+"recurrenceeditor").remove(),this._currentDateFormat(this.model.dateFormat),this._initializePrivateProperties(),t=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:document.documentElement.clientWidth+(t?17:0)<361||ej.isMobile(),this.model.frequencies=this.model.frequencies.toString().toLowerCase().split(","),n=0;n<this.model.frequencies.length;n++)this.model.frequencies[n]=this.model.frequencies[n]=="everyweekday"?"EveryWeekDay":this.model.frequencies[n].replace(/^./,function(n){return n.toUpperCase()});this._renderRecurrenceEditor()},t.prototype._initializePrivateProperties=function(){this._rRule={};this.flag=!0;this._subControlChange=!1;this._culture=ej.preferredCulture(this.model.locale);this._dayNamesArray=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];this._firstDayOfWeek=this.model.firstDayOfWeek!=null?typeof this.model.firstDayOfWeek=="string"?this._dayNamesArray.indexOf(this.model.firstDayOfWeek.toString().toLowerCase()):this.model.firstDayOfWeek:this._culture.calendar.firstDay;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this._browserInfo=ej.browserInfo();this._dayNamesValue=["SU","MO","TU","WE","TH","FR","SA"];this._dayNames=[];this._dayShortNames=[];this._dayFullNames=[];var n=this._firstDayOfWeek;do n>6&&(n=0),this._dayFullNames.push(this._culture.calendar.days.names[n]),this._dayShortNames.push(this._culture.calendar.days.namesAbbr[n]),this._dayNames.push(this._dayNamesValue[n]),n++;while(this._dayNames.length<7);this._mediaQuery=!1},t.prototype._currentDateFormat=function(n){var t,i,r,u;ej.isNullOrUndefined(n)||$.type(this.model.startDate)=="date"&&$.type(this.model.minDate)=="date"&&$.type(this.model.maxDate)=="date"?n=="MM/dd/yyyy"&&($.type(this.model.startDate)!="date"||$.type(this.model.minDate)!="date"||$.type(this.model.maxDate)!="date")&&(u=ej.parseDate(this.model.startDate.toString(),n),t=ej.parseDate(this.model.minDate.toString(),n),i=ej.parseDate(this.model.maxDate.toString(),n),this.model.startDate=ej.isNullOrUndefined(u)?this.model.startDate:u,this.model.minDate=ej.isNullOrUndefined(t)?this.model.minDate:t,this.model.maxDate=ej.isNullOrUndefined(i)?this.model.maxDate:i):(r=ej.parseDate(this.model.startDate.toString(),this.model.dateFormat),t=ej.parseDate(this.model.minDate.toString(),this.model.dateFormat),i=ej.parseDate(this.model.maxDate.toString(),this.model.dateFormat),this.model.startDate=ej.isNullOrUndefined(r)?new Date(this.model.startDate.toString()).toString()=="Invalid Date"||new Date(this.model.startDate.toString()).toString()=="NaN"?this._dateConvert(this.model.startDate):new Date(this.model.startDate.toString()):r,this.model.minDate=ej.isNullOrUndefined(t)?new Date(this.model.minDate.toString()).toString()=="Invalid Date"||new Date(this.model.minDate.toString()).toString()=="NaN"?this._dateConvert(this.model.minDate):new Date(this.model.minDate.toString()):t,this.model.maxDate=ej.isNullOrUndefined(i)?new Date(this.model.maxDate.toString()).toString()=="Invalid Date"||new Date(this.model.maxDate.toString()).toString()=="NaN"?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate.toString()):i)},t.prototype._renderRecurrenceEditor=function(){var n,t;for(this._recurrenceLayout=ej.buildTag("div#"+this._id+"recurrenceeditor","",{},{}),this.model.enableRTL&&this._recurrenceLayout.addClass("e-rtl"),n="<table style='width:100%'><tr><td style='width:20%'><div class='e-textlabel'>"+this._getLocalizedLabels("Repeat")+":<\/div><\/td><td><input class='e-recurrencetype' id='"+this._id+"_recurrenceType' type='text' name='RecurrenceType' value='' /><\/td><\/tr><\/table><div id='"+this._id+"_recurtypelist'><ul>",t=0;t<this.model.frequencies.length;t++)n+="<li>"+this._getLocalizedLabels(this.model.frequencies[t])+"<\/li>";n+="<\/ul><\/div>";this.element.append(this._recurrenceLayout.append(n));this._renderRecurrenceContent();this._initialSubControlRender=!0;this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_recurtypelist",width:this._mediaQuery?"140px":"33%",change:$.proxy(this._recurrenceTypeChange,this),cssClass:this.model.cssClass});this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:this.model.selectedRecurrenceType})},t.prototype._renderRecurrenceContent=function(){for(var i,c,n,t,r,u,f,e,o,s,h=0;h<this._dayNames.length;h++)this._dayNames[h]=this._dayNames[h].toUpperCase();if(i=[this._getLocalizedLabels("First"),this._getLocalizedLabels("Second"),this._getLocalizedLabels("Third"),this._getLocalizedLabels("Fourth"),this._getLocalizedLabels("Last")],c=this.model.enableRTL?"margin-right":"margin-left",this._recurrenceContent=ej.buildTag("div.e-recurrencecontent#"+this._id+"recurrencecontent","",{},{}),this._mediaQuery){for(n="<form id='"+this._id+"_recurrenceForm'><table class='e-table' width='100%' cellpadding='7'><tbody>",n+="<tr id='"+this._id+"_every' style='display:none'><td width='16%' id='everylabel' class='e-textlabel'>"+this._getLocalizedLabels("Every")+":<\/td><td id='everycount' class='e-tdpadding'><table><tr><td><div class='e-floatleft'><input id='"+this._id+"_recurevery' class='recurevery' type='text' /><\/div><\/td><td><div id='"+this._id+"_recurtypes' class='e-appcheckbox e-labelcursor'>"+this._getLocalizedLabels("RecurrenceDay")+"<\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_weekly' class='"+this._id+"_weekly' style='display:none'><td colspan='2' id='weeklabel' class='e-textlabel'><div>"+this._getLocalizedLabels("RepeatOn")+":<\/div><\/td><\/tr><tr class='"+this._id+"_weekly' style='display:none'><td colspan='2' id='weekcount'><table class='e-table' cellpadding='3'><tr>",t=0;t<this._dayShortNames.length;t++)n+="<td><div class='e-weekday "+this._dayShortNames[t]+"'><input id='"+this._id+"_"+this._dayNames[t]+"' class='weekdays e-weekly"+this._dayNames[t]+"'name='weekdays' type='checkbox'/><label class='e-textmargin' for='"+this._id+"_"+this._dayNames[t]+"'>"+this._dayShortNames[t]+"<\/label><\/div><\/td>";for(n+="<\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_monthly' class='"+this._id+"_monthly' style='display:none'><td colspan='2' id='monthlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><\/tr><tr class='"+this._id+"_monthly' style='display:none'><td colspan='2' id='monthcount'><table class='e-table' cellpadding='3'><tr id='monthdaytr'><td><div><input id='"+this._id+"_monthday' class='monthdaytype' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthday'>"+this._getLocalizedLabels("Day")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthdate' class='monthdate' type='text'/><\/div><\/td><\/tr><tr id='monthweekdaytr'><td><div><input id='"+this._id+"_monthon' class='monthposition' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthon'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthsrt' class='monthsrt' type='text' name='monthsrt' value=''/><div id='"+this._id+"_monthsrtlist'><ul>",r=0;r<i.length;r++)n+="<li>"+i[r]+"<\/li>";for(n+="<\/div><\/div><\/td>",n+="<td><div class='e-appcheckbox e-labelcursor'><input id='"+this._id+"_monthsrtday' class='e-monthsrtday monthsrtday' type='text' name='monthsrtday' value=''/><div id='"+this._id+"_monthsrtdaylist'><ul>",u=0;u<this._dayFullNames.length;u++)n+="<li>"+this._dayFullNames[u]+"<\/li>";for(n+="<\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_yearly' class='"+this._id+"_yearly' style='display:none'><td colspan='2' id='yearlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><\/tr><tr class='"+this._id+"_yearly' style='display:none'><td colspan='2' id='yearcount' ><table class='e-table' cellpadding='3'><tr id='yeardaytr'><td><div><input id='"+this._id+"_yearday' class='yearrecurday' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearday'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearmonth' class='yearmonth' type='text' name='yearmonth' value=''/><\/div><\/td><div id='"+this._id+"_yearmonthlist'><ul>",f=0;f<this._monthNames.length-1;f++)n+="<li>"+this._monthNames[f]+"<\/li>";for(n+="<\/ul><\/div><td><input id='"+this._id+"_yeardate' class='yeardate' text='text'/><\/td><\/tr><tr id='yearweekdaytr'><td><div><input id='"+this._id+"_yearother' class='yearrecurposi' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearother'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_yearsrt' class='yearsrt' type='text' name='yearsrt' value=''/><div id='"+this._id+"_yearsrtlist'><ul>",e=0;e<i.length;e++)n+="<li>"+i[e]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearsrtday' class='yearsrtday' type='text' name='yearsrtday' value=''/><div id='"+this._id+"_yearsrtdaylist'><ul>",o=0;o<this._dayFullNames.length;o++)n+="<li>"+this._dayFullNames[o]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div><span>"+this._getLocalizedLabels("OfEvery")+"<\/span><\/div><\/td><\/tr><tr><td><\/td><td><div><input id='"+this._id+"_yearsrtmonth' class='yearsrtmonth' type='text' name='yearsrtmonth' value=''/><div id='"+this._id+"_yearsrtmonthlist'><ul>",s=0;s<this._monthNames.length-1;s++)n+="<li>"+this._monthNames[s]+"<\/li>";n+="<\/ul><\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>";n+="<tr id='"+this._id+"_startson' ><td colspan='2' id='startsonlabel' class='e-textlabel'>"+this._getLocalizedLabels("StartsOn")+":<\/td><\/tr><tr><td colspan='2' id='startsoncount'><input id='"+this._id+"_recurstartdate' class='recurstartdate' type='text' name='RecurStartDate' value=''/><\/td><\/tr>";n+="<tr id='"+this._id+"_endson' ><td colspan='2' id='endsonlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("Ends")+":<\/div><\/td><\/tr><tr><td colspan='2' id='endsoncount'><table class='e-table' cellpadding='3'><tr id='endsonnever'><td><div><input id='"+this._id+"_repeatendnever' class='recurends e-recurnoend' type='radio' name='"+this._id+"_repeatend' value='Never'/><label class='e-textmargin' for='"+this._id+"_repeatendnever'>"+this._getLocalizedLabels("Never")+"<\/label><\/div><\/td><\/tr><tr id='endsonafter'><td><div><input id='"+this._id+"_repeatendafter' class='recurends e-recurafter' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendafter'>"+this._getLocalizedLabels("After")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_recurcount' class='recurcount' type='text'/><\/div><\/td><td><span class='e-labelcursor' style='"+c+": -80px;'>"+this._getLocalizedLabels("Occurrence")+"<\/span><\/td><\/tr><tr id='endsonuntil'><td><div><input id='"+this._id+"_repeatendon' class='recurends e-recuruntil' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendon'>"+this._getLocalizedLabels("On")+"<\/label><\/div><\/td><td><input id='"+this._id+"_daily' class='e-until until' type='text' name='daily' value=''/><\/td><\/tr> <\/table><\/td><\/tr>";n+="<tr style='display:none'><td><span class='e-textlabel'>Summary:<\/span><\/td><td><span class=e-recurRule><\/span><\/td><\/tr><\/tbody><\/table><\/form>"}else{for(n="<form id='"+this._id+"_recurrenceForm'><table class='e-table' width='100%' cellpadding='7'><tbody>",n+="<tr id='"+this._id+"_every' style='display:none'><td width='20%' id='everylabel' class='e-textlabel'>"+this._getLocalizedLabels("Every")+":<\/td><td id='everycount' class='e-tdpadding'><table><tr><td><div class='e-floatleft'><input id='"+this._id+"_recurevery' class='recurevery' type='text' /><\/div><\/td><td><div id='"+this._id+"_recurtypes' class='e-appcheckbox e-labelcursor'>"+this._getLocalizedLabels("RecurrenceDay")+"<\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_weekly' class='"+this._id+"_weekly' style='display:none'><td id='weeklabel' class='e-textlabel'><div>"+this._getLocalizedLabels("RepeatOn")+":<\/div><\/td><td id='weekcount'><table class='e-table' cellpadding='3'><tr>",t=0;t<this._dayShortNames.length;t++)n+="<td><div class='e-weekday "+this._dayShortNames[t]+"'><input id='"+this._id+"_"+this._dayNames[t]+"' class='weekdays e-weekly"+this._dayNames[t]+"'name='weekdays' type='checkbox'/><label class='e-textmargin' for='"+this._id+"_"+this._dayNames[t]+"'>"+this._dayShortNames[t]+"<\/label><\/div><\/td>";for(n+="<\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_monthly' class='"+this._id+"_monthly' style='display:none'><td id='monthlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><td id='monthcount'><table class='e-table' cellpadding='3'><tr id='monthdaytr'><td><div><input id='"+this._id+"_monthday' class='monthdaytype' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthday'>"+this._getLocalizedLabels("Day")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthdate' class='monthdate' type='text'/><\/div><\/td><\/tr><tr id='monthweekdaytr'><td><div><input id='"+this._id+"_monthon' class='monthposition' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthon'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthsrt' class='monthsrt' type='text' name='monthsrt' value=''/><div id='"+this._id+"_monthsrtlist'><ul>",r=0;r<i.length;r++)n+="<li>"+i[r]+"<\/li>";for(n+="<\/div><\/div><\/td>",n+="<td><div class='e-appcheckbox e-labelcursor'><input id='"+this._id+"_monthsrtday' class='e-monthsrtday monthsrtday' type='text' name='monthsrtday' value=''/><div id='"+this._id+"_monthsrtdaylist'><ul>",u=0;u<this._dayFullNames.length;u++)n+="<li>"+this._dayFullNames[u]+"<\/li>";for(n+="<\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_yearly' class='"+this._id+"_yearly' style='display:none'><td id='yearlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><td id='yearcount' ><table class='e-table' cellpadding='3'><tr id='yeardaytr'><td><div><input id='"+this._id+"_yearday' class='yearrecurday' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearday'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearmonth' class='yearmonth' type='text' name='yearmonth' value=''/><\/div><\/td><div id='"+this._id+"_yearmonthlist'><ul>",f=0;f<this._monthNames.length-1;f++)n+="<li>"+this._monthNames[f]+"<\/li>";for(n+="<\/ul><\/div><td><input id='"+this._id+"_yeardate' class='yeardate' text='text'/><\/td><\/tr><tr id='yearweekdaytr'><td><div><input id='"+this._id+"_yearother' class='yearrecurposi' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearother'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_yearsrt' class='yearsrt' type='text' name='yearsrt' value=''/><div id='"+this._id+"_yearsrtlist'><ul>",e=0;e<i.length;e++)n+="<li>"+i[e]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearsrtday' class='yearsrtday' type='text' name='yearsrtday' value=''/><div id='"+this._id+"_yearsrtdaylist'><ul>",o=0;o<this._dayFullNames.length;o++)n+="<li>"+this._dayFullNames[o]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div><span>"+this._getLocalizedLabels("OfEvery")+"<\/span><\/div><\/td><td><div><input id='"+this._id+"_yearsrtmonth' class='yearsrtmonth' type='text' name='yearsrtmonth' value=''/><div id='"+this._id+"_yearsrtmonthlist'><ul>",s=0;s<this._monthNames.length-1;s++)n+="<li>"+this._monthNames[s]+"<\/li>";n+="<\/ul><\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>";n+="<tr id='"+this._id+"_startson' style='display:none'><td width='20%' id='startsonlabel' class='e-textlabel'>"+this._getLocalizedLabels("StartsOn")+":<\/td><td id='startsoncount'><input id='"+this._id+"_recurstartdate' class='recurstartdate' type='text' name='RecurStartDate' value=''/><\/td><\/tr>";n+="<tr id='"+this._id+"_endson' style='display:none'><td id='endsonlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("Ends")+":<\/div><\/td><td id='endsoncount'><table class='e-table' cellpadding='3'><tr id='endsonnever'><td><div><input id='"+this._id+"_repeatendnever' class='recurends e-recurnoend' type='radio' name='"+this._id+"_repeatend' value='Never'/><label class='e-textmargin' for='"+this._id+"_repeatendnever'>"+this._getLocalizedLabels("Never")+"<\/label><\/div><\/td><\/tr><tr id='endsonafter'><td><div><input id='"+this._id+"_repeatendafter' class='recurends e-recurafter' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendafter'>"+this._getLocalizedLabels("After")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_recurcount' class='recurcount' type='text'/><\/div><\/td><td><span class='e-labelcursor' style='"+c+": -80px;'>"+this._getLocalizedLabels("Occurrence")+"<\/span><\/td><\/tr><tr id='endsonuntil'><td><div><input id='"+this._id+"_repeatendon' class='recurends e-recuruntil' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendon'>"+this._getLocalizedLabels("On")+"<\/label><\/div><\/td><td><input id='"+this._id+"_daily' class='e-until until' type='text' name='daily' value=''/><\/td><\/tr> <\/table><\/td><\/tr>";n+="<tr style='display:none'><td><span class='e-textlabel'>Summary:<\/span><\/td><td><span class=e-recurRule><\/span><\/td><\/tr><\/tbody><\/table><\/form>"}this._recurrenceLayout.append(this._recurrenceContent.append(n));this._renderControls()},t.prototype._renderControls=function(){var n=this._recurrenceContent;n.find(".weekdays").ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._weeklyClick,this)});n.find(".monthsrt").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_monthsrtlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._monthSrt,this)});n.find(".monthsrtday").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_monthsrtdaylist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._monthSrt,this)});n.find(".yearsrt").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearsrtlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearsrt,this)});n.find(".yearmonth").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearmonthlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearmonth,this)});n.find(".yearsrtday").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearsrtdaylist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearsrt,this)});n.find(".yearsrtmonth").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearsrtmonthlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearsrt,this)});n.find(".recurstartdate").ejDatePicker({buttonText:"Today",startDay:this._firstDayOfWeek,enableRTL:this.model.enableRTL,locale:this.model.locale,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,value:this.model.startDate,minDate:this.model.minDate,maxDate:this.model.maxDate,change:$.proxy(this._startDateChange,this)});n.find(".until").ejDatePicker({buttonText:"Today",startDay:this._firstDayOfWeek,enableRTL:this.model.enableRTL,locale:this.model.locale,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,change:$.proxy(this._recurUntil,this)});n.find(".recurcount").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"recurcount",minValue:1,value:10,width:"65px",decimalPlaces:0,cssClass:this.model.cssClass,change:$.proxy(this._recurCount,this)});n.find(".recurevery").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"recurevery",minValue:1,value:1,decimalPlaces:0,width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._everyCount,this)});n.find(".monthdate").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"monthdate",minValue:1,decimalPlaces:0,maxValue:31,value:1,width:"70px",cssClass:this.model.cssClass,change:$.proxy(this._monthDate,this)});n.find(".yeardate").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"yeardate",minValue:1,decimalPlaces:0,maxValue:31,value:1,width:"70px",cssClass:this.model.cssClass,change:$.proxy(this._yearmonth,this)});n.find(".recurends").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._recurEndChange,this)});n.find(".monthposition,.monthdaytype").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._recurEndChange,this)});n.find(".yearrecurposi,.yearrecurday").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._recurEndChange,this)})},t.prototype._recurrenceTypeChange=function(n){this._recurrenceType(n);this._rRuleFreq!=""&&this.closeRecurPublic();this._rRuleFreq==""&&(this._recRule=undefined);this._trigger("change",{recurrenceRule:this._recRule})},t.prototype._recurrenceType=function(n){var i,t,r,u;if(this._rRuleFreq="",i="",t=$.type(this.model.startDate)=="string"?this._dateConvert(this.model.startDate):this.model.startDate,this.flag&&(this._subControlChange=!0,this._recurrenceContent.find(".until").ejDatePicker({value:new Date(new Date(t.toDateString()).setDate(new Date(t.toDateString()).getDate()+70))}),this._subControlChange=!1,this._recurrenceContent.find(".e-recurnoend").ejRadioButton({checked:!0}),this.flag=!1),this._mediaQuery||this._recurrenceContent.find("#"+this._id+"_startson,#"+this._id+"_endson").css("display","table-row"),n.itemId!=null){this._recurrenceContent.find("#"+this._id+"_every").css("display","table-row");r=this._getLocalizedLabels(this.model.frequencies[n.itemId]);switch(r){case this._getLocalizedLabels("Never"):this._recurrenceContent.css("display","none");break;case this._getLocalizedLabels("Daily"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceDay");this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_monthly,."+this._id+"_yearly").css("display","none");this._rRuleFreq="DAILY";i=this._getLocalizedLabels("RecurrenceDay").toLowerCase();break;case this._getLocalizedLabels("Weekly"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceWeek");u=this._dayShortNames.indexOf(ej.format(t,"ddd",this.model.locale));this._initialSubControlRender=!0;this._recurrenceContent.find(".e-weekly"+this._dayNames[u]).ejCheckBox({checked:!0});i=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+this._dayFullNames[t.getDay()];this._rRuleFreq="WEEKLY";this._recurrenceContent.find("."+this._id+"_monthly,."+this._id+"_yearly").css("display","none");this._recurrenceContent.find("."+this._id+"_weekly").css("display","table-row");break;case this._getLocalizedLabels("Monthly"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceMonth");this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_yearly").css("display","none");this._recurrenceContent.find("."+this._id+"_monthly").css("display","table-row");this._initialSubControlRender=!0;this._recurrenceContent.find(".monthdate").ejNumericTextbox({value:t.getDate()});this._recurrenceContent.find(".monthsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(ej.format(t,"ddd","en-US").substr(0,2).toUpperCase())});this._recurrenceContent.find(".monthsrt").ejDropDownList({selectedItemIndex:this._getWeekIndex(t)});this._recurrenceContent.find(".monthdaytype").ejRadioButton({checked:!0});this._rRuleFreq="MONTHLY";i=this._getLocalizedLabels("RecurrenceMonth").toLowerCase();break;case this._getLocalizedLabels("Yearly"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceYear");this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_monthly").css("display","none");this._recurrenceContent.find("."+this._id+"_yearly").css("display","table-row");this._initialSubControlRender=!0;this._recurrenceContent.find(".yearmonth").ejDropDownList({selectedItemIndex:t.getMonth()});this._recurrenceContent.find(".yeardate").ejNumericTextbox({value:t.getDate()});this._recurrenceContent.find(".yearsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(ej.format(t,"ddd","en-US").substr(0,2).toUpperCase())});this._recurrenceContent.find(".yearsrtmonth").ejDropDownList({selectedItemIndex:t.getMonth()});this._recurrenceContent.find(".yearsrt").ejDropDownList({selectedItemIndex:this._getWeekIndex(t)});this._recurrenceContent.find(".yearrecurday").ejRadioButton({checked:!0});this._rRuleFreq="YEARLY";i=this._getLocalizedLabels("RecurrenceYear").toLowerCase();break;case this._getLocalizedLabels("EveryWeekDay"):this._recurrenceContent.css("display","block");this._rRuleFreq="WEEKDAYS";this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_yearly,#"+this._id+"_every,."+this._id+"_monthly").css("display","none");i=n.text}this._initialSubControlRender=!1}this._recurrenceContent.find(".e-recurRule").html(i)},t.prototype._getWeekIndex=function(n){var i=0,t=new Date(n.getFullYear(),n.getMonth(),1),r=n.getDay();if(r!=t.getDay())do t=new Date(t.setDate(t.getDate()+1));while(r!=t.getDay());while(t.getDate()!=n.getDate())t=new Date(t.setDate(t.getDate()+7)),i++;return i},t.prototype._weeklyClick=function(){this._initialSubControlRender||this._stringGenerate()},t.prototype._monthSrt=function(){this._subControlChange=!0;this._recurrenceContent.find("#"+this._id+"_monthon").ejRadioButton("option","checked",!0);this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._yearsrt=function(){this._subControlChange=!0;this._recurrenceContent.find("#"+this._id+"_yearother").ejRadioButton("option","checked",!0);this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._yearmonth=function(){this._subControlChange=!0;this._recurrenceContent.find("#"+this._id+"_yearday").ejRadioButton("option","checked",!0);this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._startDateChange=function(n){this.model.startDate=new Date(n.model.value);(!this._recurrenceContent.find("#"+this._id+"_repeatendon").ejRadioButton("model.checked")||this.model.startDate>this._recurrenceContent.find(".until").ejDatePicker("option","value"))&&(this._subControlChange=!0,this._recurrenceContent.find(".until").ejDatePicker("option","value",new Date(new Date(n.model.value).setDate(n.model.value.getDate()+70))));this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._recurUntil=function(){this._subControlChange||(this._subControlChange=!0,this._recurrenceContent.find("#"+this._id+"_repeatendon").ejRadioButton("option","checked",!0),this._subControlChange=!1,this._initialSubControlRender||this._stringGenerate())},t.prototype._recurCount=function(){this._recurrenceContent.find("#"+this._id+"_repeatendafter").ejRadioButton("option","checked",!0);this._initialSubControlRender||this._stringGenerate()},t.prototype._everyCount=function(){this._initialSubControlRender||this._stringGenerate()},t.prototype._monthDate=function(){this._recurrenceContent.find("#"+this._id+"_monthday").ejRadioButton("option","checked",!0);this._initialSubControlRender||this._stringGenerate()},t.prototype._recurEndChange=function(){this._subControlChange||this._initialSubControlRender||this._stringGenerate()},t.prototype._stringGenerate=function(){this.closeRecurPublic();this._trigger("change",{recurrenceRule:this._recRule})},t.prototype._findInterval=function(n){var t;return t=n.ejNumericTextbox("model.value"),ej.isNullOrUndefined(t)?0:t},t.prototype._weeklyDayFind=function(n,t){var i=n,r;do i=new Date(i.setDate(i.getDate()+1)),r=this._dayNamesValue[new Date(i).getDay()].toUpperCase();while(t.indexOf(r)==-1);return i},t.prototype._dayOfWeekInMonth=function(n,t,i){for(var f=this._dayNamesValue.indexOf(t),r=i==-1?new Date(n.getFullYear(),n.getMonth()+1,0):new Date(n.getFullYear(),n.getMonth(),1),u;r.getDay()!=f;)r=new Date(i==-1?r.setDate(r.getDate()-1):r.setDate(r.getDate()+1));return u=Math.abs(Math.ceil((r.getDate()-1-r.getDay())/7)),new Date(i==1||i==-1?r.toString():new Date(r.setDate(r.getDate()+(i-u-1)*7)).toString())},t.prototype._findRecurCount=function(n,t,i){var l=0,n,t,u=!1,e,o,s=this._interval,r=new Date(this._recurrenceContent.find(".recurstartdate").ejDatePicker("model.value")),h,a,c,v,f;for(ej.isNullOrUndefined(this._actualDate)||this._actualDate==0||(h=new Date(r.getFullYear(),r.getMonth()+1,0),r=h.getDate()<this._actualDate?h:new Date(r.getFullYear(),r.getMonth(),this._actualDate)),o=e=new Date(r.toString()),a=new Date(this.element.find(".e-until").ejDatePicker("model.value"));r<=a;){switch(this._rRuleFreq){case"DAILY":r=new Date(r.setDate(r.getDate()+n));u=!0;break;case"WEEKLY":case"WEEKDAYS":for(c=t.split(","),v=i._dayNames[new Date(r.toString()).getDay()],f=0;f<c.length;f++)if(c[f]==v){if(s==this._interval){u=!0;s=1;break}s++}break;case"MONTHLY":r=new Date(r.setMonth(r.getMonth()+n));!ej.isNullOrUndefined(this._month)&&this._month&&e.getMonth()>r.getMonth()&&(r=new Date(r.setDate(e.getDate())));r.getDate()!=o.getDate()&&(ej.isNullOrUndefined(this._month)||!this._month)&&(this._month=!0,r=new Date(r.setDate(r.getDate()-r.getDate())));u=!0;break;case"YEARLY":r=new Date(r.setFullYear(r.getFullYear()+n));u=!0}u&&l++;u=!1;(this._rRuleFreq=="WEEKLY"||this._rRuleFreq=="WEEKDAYS")&&(r=new Date(r.setDate(r.getDate()+1)));o=new Date(r.toString())}return this._month=!1,this._actualDate=0,l},t.prototype._getLocalizedLabels=function(n){return ej.isNullOrUndefined(ej.RecurrenceEditor.Locale[this.model.locale])?ej.RecurrenceEditor.Locale["en-US"][n]:ej.RecurrenceEditor.Locale[this.model.locale][n]},t.prototype._datepattern=function(){return this.model.dateFormat!=""&&!ej.isNullOrUndefined(this.model.dateFormat)?this.model.dateFormat:this._pattern.d},t.prototype._dateConvert=function(n){if(ej.isNullOrUndefined(n))t=null;else{var t=new Date(parseInt(n.match(/\d+/).toString()));t=$.type(t)=="date"?t:new Date}return t},t.prototype.recurrenceDateGenerator=function(n,t,i){var s=[],rt=n.split(";"),r,l,nt,tt,p,e,f,u,c,w,a,v,b,h,k,y;if(this._recurDates={},r=new Date(t),l=0,p=new Date(r),ej.isNullOrUndefined(i)&&(i=null),this.recurrenceRuleSplit(n,i),ej.isNullOrUndefined(this._rRule.recurEditId)){if(f="",u=ej.isNullOrUndefined(this._rRule.interval)?1:this._rRule.interval,ej.isNullOrUndefined(this._rRule.weekDays)||(f=this._rRule.weekDays.split(",")),ej.isNullOrUndefined(this._rRule.until))if(ej.isNullOrUndefined(this._rRule.count))e=new Date(new Date(this.model.startDate.toString()).setDate(r.getDate()+42*u));else switch(this._rRule.freq){case"DAILY":e=new Date(new Date(r).setDate(r.getDate()+this._rRule.count*u));break;case"WEEKLY":c=r.getDate()+this._rRule.count/f.length*7*u;e=new Date(new Date(r).setDate(Math.round(c)<c?c+1:c));break;case"MONTHLY":e=new Date(new Date(r).setMonth(r.getMonth()+this._rRule.count*u));break;case"YEARLY":e=new Date(new Date(r).setFullYear(r.getFullYear()+this._rRule.count*u))}else e=new Date(this._rRule.until),e.setDate(e.getDate()+1);switch(this._rRule.freq){case"WEEKLY":f=this._rRule.weekDays.split(",");f.indexOf(this._dayNamesValue[new Date(r).getDay()].toUpperCase())==-1&&(r=this._weeklyDayFind(r,f));break;case"MONTHLY":if(ej.isNullOrUndefined(this._rRule.monthDay))r=new Date(this._getWeekIndex(r)+1>this._rRule.setPositions&&this._rRule.setPositions!=-1?new Date(r.getFullYear(),r.getMonth(),1):r);else for(w=new Date(r).getDate()==new Date(r.getFullYear(),r.getMonth()+1,0).getDate()?!0:!1;new Date(r).getDate()!=this._rRule.monthDay;)r=new Date(r.setDate(r.getDate()+1));nt=tt=new Date(r);break;case"YEARLY":ej.isNullOrUndefined(this._rRule.monthDay)?ej.isNullOrUndefined(this._rRule.setPositions)||(r=new Date(r.getFullYear(),this._rRule.month-1,r.getDate()),r=new Date(this._getWeekIndex(r)+1>this._rRule.setPositions&&this._rRule.setPositions!=-1?new Date(r.getFullYear(),r.getMonth(),1):r)):(a=new Date(p.setMonth(this._rRule.month-1)),v=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),this._rRule.monthDay>v&&(this._rRule.monthDay=v),r=r.getMonth()+1>=this._rRule.month&&r.getDate()>this._rRule.monthDay?new Date(r.getFullYear()+1,this._rRule.month-1,this._rRule.monthDay):new Date(r.getFullYear(),this._rRule.month-1,this._rRule.monthDay))}while(r<=e){this._rRule.freq!="MONTHLY"&&this._rRule.freq!="YEARLY"||ej.isNullOrUndefined(this._rRule.setPositions)||(r=this._dayOfWeekInMonth(r,this._rRule.weekDays,this._rRule.setPositions));ej.isNullOrUndefined(this._rRule.exDate)?b=0:this._rRule.exDate.indexOf(ej.format(new Date(r),this._pattern.d,this.model.locale))==-1&&(b=2);h=new Date(r);switch(this._rRule.freq){case"DAILY":s.push(new Date(h.toString()).getTime());r=new Date(r.setDate(r.getDate()+u));break;case"WEEKLY":k=this._dayNamesValue[new Date(r).getDay()].toUpperCase();f.length-1!=f.indexOf(k)?(s.push(new Date(h.toString()).getTime()),r=this._weeklyDayFind(r,f)):(s.push(new Date(h.toString()).getTime()),r=new Date(r.setDate(r.getDate()+r.getDay()*-1)),r=new Date(r.setDate(r.getDate()+u*7-1)),r=this._weeklyDayFind(r,f));break;case"MONTHLY":if(s.push(new Date(h.toString()).getTime()),w)r=new Date(r.getFullYear(),r.getMonth()+u+1,0);else if(ej.isNullOrUndefined(this._rRule.setPositions)){var d=new Date(r),o=new Date(d.setMonth(d.getMonth()+u)),g=new Date(o.getFullYear(),o.getMonth()+1,0),it=r.getFullYear()==o.getFullYear()?r.getMonth()+u:o.getMonth();it==o.getMonth()?r=o>g?new Date(g.toString()):new Date(o.setDate(this._rRule.monthDay)):(y=new Date(o.setMonth(o.getMonth()-1)),r=new Date(y.getFullYear(),y.getMonth()+1,0))}else r=new Date(r.getFullYear(),r.getMonth()+u,1);break;case"YEARLY":s.push(new Date(h.toString()).getTime());r=new Date(r.setFullYear(r.getFullYear()+u))}if(l++,!ej.isNullOrUndefined(this._rRule.count)&&l==this._rRule.count)break}}return s},t.prototype.recurrenceRuleSplit=function(n,t){var r,f,o,e,u,i;if(this._rRule={},f=t,o=n.split(";"),!ej.isNullOrUndefined(t)&&!ej.isNullOrUndefined(f.split(",")))for(u=f.split(","),this._rRule.exDate=[],i=0;i<u.length;i++)this._rRule.exDate[i]=u[i];for(e=0;e<o.length;e++){r=o[e].split("=");switch($.trim(r[0]).toUpperCase()){case"FREQ":this._rRule.freq=$.trim(r[1]).toUpperCase();break;case"INTERVAL":this._rRule.interval=parseInt(r[1],10);break;case"COUNT":this._rRule.count=parseInt(r[1],10);break;case"UNTIL":this._rRule.until=new Date(r[1]);break;case"BYDAY":this._rRule.weekDays=r[1];break;case"BYMONTHDAY":this._rRule.monthDay=parseInt(r[1],10);break;case"BYMONTH":this._rRule.month=parseInt(r[1],10);break;case"BYSETPOS":this._rRule.setPositions=parseInt(r[1],10);break;case"WKST":this._rRule.weekStart=r[1];break;case"EXDATE":if(ej.isNullOrUndefined(t)||ej.isNullOrUndefined(f.split(",")))for(u=r[1].split(","),this._rRule.exDate=[],i=0;i<u.length;i++)this._rRule.exDate[i]=u[i];else for(u=f.split(","),this._rRule.exDate=[],i=0;i<u.length;i++)this._rRule.exDate[i]=u[i];break;case"RECUREDITID":this._rRule.recurEditId=parseInt(r[1])}}return this._rRule},t.prototype.clearRecurrenceFields=function(){for(var t=this.element.find("input.weekdays"),n=0;n<t.length;n++)$(t[n]).ejCheckBox({checked:!1});this.element.find(".recurevery").ejNumericTextbox({value:1});this.element.find(".recurcount").ejNumericTextbox({value:10});this.element.find(".e-recurRule").html("")},t.prototype.setDefaultValues=function(){var n=this.model.startDate.toString();this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:0});this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:1});this.element.find(".recurstartdate").ejDatePicker({value:new Date(n)});this.element.find(".e-until").ejDatePicker({value:new Date(new Date(n).setDate(new Date(n).getDate()+70))});this.element.find(".e-recurnoend").ejRadioButton({checked:!0})},t.prototype.showRecurrenceSummary=function(){for(var r,n=0;n<this._dayNames.length;n++)this._dayNames[n]=this._dayNames[n].toUpperCase();var t="",i="",u=this.element.find("#"+this._id+"_recurrenceType");t=ej.isNullOrUndefined(this._rRule.interval)?this._getLocalizedLabels("Every")+" ":this._getLocalizedLabels("Every")+" "+this._rRule.interval+" ";u.ejDropDownList({selectedItemIndex:this.model.frequencies.indexOf(this._rRule.freq.toLowerCase().replace(/^./,function(n){return n.toUpperCase()}))});switch(this._rRule.freq){case"DAILY":t+=this._getLocalizedLabels("RecurrenceDay").toLowerCase();this._rRuleFreq="DAILY";break;case"WEEKLY":for(this._rRuleFreq="WEEKLY",this.element.find(".weekdays").ejCheckBox({checked:!1}),r=this._rRule.weekDays.split(","),n=0;n<r.length;n++)this.element.find(".e-weekly"+r[n]).ejCheckBox({checked:!0}),i+=this._dayShortNames[this._dayNames.indexOf(r[n])]+(n==r.length-1?"":", ");t+=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+i;break;case"MONTHLY":this._rRuleFreq="MONTHLY";ej.isNullOrUndefined(this._rRule.monthDay)?(this.element.find(".e-monthposition").ejRadioButton({checked:!0}),this.element.find(".e-monthsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(this._rRule.weekDays)}),this.element.find(".monthsrt").ejDropDownList({selectedItemIndex:this._rRule.setPositions-1}),i=this.element.find(".monthsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[this._dayNames.indexOf(this._rRule.weekDays)]):(this.element.find(".e-monthdaytype").ejRadioButton({checked:!0}),this.element.find(".e-monthdate").ejNumericTextbox({value:parseInt(this._rRule.monthDay)}),i=parseInt(this._rRule.monthDay).toString());t+=this._getLocalizedLabels("RecurrenceMonth").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+i;break;case"YEARLY":this._rRuleFreq="YEARLY";ej.isNullOrUndefined(this._rRule.monthDay)?(this.element.find(".e-yearrecurposi").ejRadioButton({checked:!0}),this.element.find(".yearsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(this._rRule.weekDays)}),this.element.find(".yearsrtmonth").ejDropDownList({selectedItemIndex:this._rRule.month-1}),this.element.find(".yearsrt").ejDropDownList({selectedItemIndex:this._rRule.setPositions-1}),i=this.element.find(".yearsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[this._dayNames.indexOf(this._rRule.weekDays)]+" "+this._monthNames[this._rRule.month-1]):(this.element.find(".e-yearrecurday").ejRadioButton({checked:!0}),this.element.find(".yearmonth").ejDropDownList({selectedItemIndex:this._rRule.month-1}),this.element.find(".yeardate").ejNumericTextbox({value:parseInt(this._rRule.monthDay)}),i=this._monthNames[this._rRule.month-1]+" "+parseInt(this._rRule.monthDay));t+=this._getLocalizedLabels("RecurrenceYear").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+i}return this.element.find(".recurevery").ejNumericTextbox({value:ej.isNullOrUndefined(this._rRule.interval)?1:this._rRule.interval}),ej.isNullOrUndefined(this._rRule.count)?ej.isNullOrUndefined(this._rRule.until)?this.element.find(".e-recurnoend").ejRadioButton({checked:!0}):(this.element.find(".e-recuruntil").ejRadioButton({checked:!0}),this.element.find(".e-until").ejDatePicker({value:new Date(this._rRule.until)}),t+=" "+this._getLocalizedLabels("Until").toLowerCase()+" "+ej.format(new Date(this._rRule.until),this._datepattern(),this.model.locale)):(this.element.find(".e-recurafter").ejRadioButton({checked:!0}),this.element.find(".recurcount").ejNumericTextbox({value:this._rRule.count}),t+=", "+this._rRule.count+this._getLocalizedLabels("Times").toLowerCase()),t},t.prototype.getRecurrenceRule=function(){return this.closeRecurPublic(),this._recRule},t.prototype.closeRecurPublic=function(){var u=this._rRuleFreq,n,v,y="",o="",i="",t="",f,e,b,k,r,h,c,w,l,a,d,g;n=this._interval=this._findInterval(this.element.find(".recurevery"));switch(u){case"DAILY":t="FREQ="+u+";INTERVAL="+n;break;case"WEEKDAYS":t="FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR";i="MO,TU,WE,TH,FR";break;case"WEEKLY":var p=this.element.find("input.weekdays"),s="";for(f=0;f<p.length;f++)$(p[f]).ejCheckBox("model.checked")==!0?i+=(i!=""?",":"")+this._dayNames[f].toUpperCase():"",$(p[f]).ejCheckBox("model.checked")==!0?s+=(s!=""?", ":"")+this._dayShortNames[f]:"";for(e=0;e<this._dayNamesValue.length;e++)"".indexOf(this._dayNamesValue[e])!=-1&&(i+=(i!=""?",":"")+this._dayNamesValue[e]),"".indexOf(this._culture.calendar.days.namesAbbr[e])!=-1&&(s+=(s!=""?",":"")+this._culture.calendar.days.namesAbbr[e]);i==""&&(b=this.element.find(".recurstartdate").ejDatePicker("model.value"),i=this._dayNames[b.getDay()].toUpperCase());k=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" on "+s;this.element.find(".e-recurRule").html(k);t="FREQ="+u+";INTERVAL="+n+";BYDAY="+i;break;case"MONTHLY":this.element.find(".monthdaytype").ejRadioButton("model.checked")?(v=this.element.find(".monthdate").ejNumericTextbox("model.value"),t="FREQ="+u+";BYMONTHDAY="+v+";INTERVAL="+n,o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+v):(r=this.element.find(".monthsrt").ejDropDownList("selectedItemIndex"),h=this.element.find(".e-monthsrtday").ejDropDownList("selectedItemIndex"),r=r<5?r+1:-1,t="FREQ="+u+";BYDAY="+this._dayNames[h]+";BYSETPOS="+r+";INTERVAL="+n,o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+this.element.find(".monthsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[h]);break;case"YEARLY":if(this.element.find("#"+this._id+"_yearday").ejRadioButton("model.checked"))c=this.element.find(".yearmonth").ejDropDownList("selectedItemIndex"),w=this._findInterval(this.element.find(".yeardate")),t="FREQ="+u+";BYMONTHDAY="+w+";BYMONTH="+(c+1)+";INTERVAL="+n,o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+this._monthNames[c]+" "+w;else{var r=this.element.find(".yearsrt").ejDropDownList("selectedItemIndex"),c=this.element.find(".yearsrtmonth").ejDropDownList("selectedItemIndex"),h=this.element.find(".yearsrtday").ejDropDownList("selectedItemIndex");r=r<5?r+1:-1;t="FREQ="+u+";BYDAY="+this._dayNames[h]+";BYMONTH="+(c+1)+";BYSETPOS="+r+";INTERVAL="+n;o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+this.element.find(".yearsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[h]+" "+this._monthNames[c]}break;case"NEVER":this._recRule=undefined}return this.element.find(".e-recurafter").ejRadioButton("model.checked")?(l=this._findInterval(this.element.find(".recurcount")),t+=";COUNT="+l,y=l?", "+l+" "+this._getLocalizedLabels("Times"):", "):this.element.find(".e-recuruntil").ejRadioButton("model.checked")&&(a=this._findRecurCount(n,i,this),t+=";COUNT="+a,y=a?", "+a+" "+this._getLocalizedLabels("Times"):", "),d=(this._rRuleFreq!="WEEKDAYS"?this._getLocalizedLabels("Every"):"")+" "+(n>1?n+" ":""),g=d+this.element.find(".e-recurRule").html()+o+y,this._recRule=t,g},t}(ej.WidgetBase);ej.widget("ejRecurrenceEditor","ej.RecurrenceEditor",new RecurrenceEditor);ej.RecurrenceEditor.Locale={};ej.RecurrenceEditor.Locale["en-US"]={Repeat:"Repeat",Never:"Never",Daily:"Daily",Weekly:"Weekly",Monthly:"Monthly",Yearly:"Yearly",First:"First",Second:"Second",Third:"Third",Fourth:"Fourth",Last:"Last",EveryWeekDay:"Every weekday",Every:"Every",RecurrenceDay:"Day(s)",RecurrenceWeek:"Week(s)",RecurrenceMonth:"Month(s)",RecurrenceYear:"Year(s)",RepeatOn:"Repeat on",RepeatBy:"Repeat by",StartsOn:"Starts on",Times:"times",Ends:"Ends",Day:"Day",The:"The",OfEvery:"Of",After:"After",On:"On",Occurrence:"Occurrence(s)",Until:"Until"},function(n,r,u){r.widget("ejGantt","ej.Gantt",{_rootCSS:"e-gantt",element:null,validTags:["div"],model:null,_tags:[{tag:"holidays",attr:["day","background","label"],content:"template"},{tag:"stripLines",attr:["day","label","lineStyle","lineColor","lineWidth"],content:"template"},{tag:"editDialogFields",attr:["field","editType"],content:"template"},{tag:"addDialogFields",attr:["field","editType"],content:"template"},{tag:"sortSettings.sortedColumns",attr:["field","direction"]},{tag:"dayWorkingTime",attr:["from","to"],singular:"dayWorkingTime"}],_holidays:function(){this._$ganttchartHelper.ejGanttChart("refreshHolidays");this._trigger("refresh")},_stripLines:function(){this._$ganttchartHelper.ejGanttChart("refreshStripLines");this._trigger("refresh")},_editDialogFields:function(){this._trigger("refresh")},_addDialogFields:function(){this._trigger("refresh")},defaults:{expandStateMapping:"",allowSorting:!1,allowColumnResize:!1,allowSelection:!0,allowMultipleExporting:!1,allowDragAndDrop:!1,dragTooltip:{showTooltip:!1,tooltipItems:[],tooltipTemplate:""},dataSource:null,showColumnChooser:!1,showColumnOptions:!1,query:null,splitterSettings:{position:"",index:-1},splitterPosition:"",taskIdMapping:"",parentTaskIdMapping:"",taskNameMapping:"",startDateMapping:"",endDateMapping:"",baselineStartDateMapping:"",baselineEndDateMapping:"",childMapping:"",durationMapping:"",milestoneMapping:"",progressMapping:"",predecessorMapping:"",resourceInfoMapping:"",taskSchedulingModeMapping:"",workMapping:"",notesMapping:"",resources:[],holidays:[],searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},highlightWeekends:!0,scheduleStartDate:null,scheduleEndDate:null,enableProgressBarResizing:!0,rowHeight:30,includeWeekend:!0,taskSchedulingMode:"auto",validateManualTasksOnLinking:!1,toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},stripLines:[],workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",workUnit:"hour",taskType:"fixedUnit",perMinuteWidth:null,perHourWidth:null,perDayWidth:null,perWeekWidth:null,perMonthWidth:null,minuteInterval:null,scheduleHeaderSettings:{weekHeaderFormat:"MMM dd , yyyy",dayHeaderFormat:"",yearHeaderFormat:"yyyy",monthHeaderFormat:"MMM",hourHeaderFormat:"HH",scheduleHeaderType:"week",minutesPerInterval:"auto",weekendBackground:"",timescaleStartDateMode:"auto",timescaleUnitSize:"100%",weekStartDay:0},taskbarBackground:"",progressbarBackground:"",connectorLineBackground:"",parentTaskbarBackground:"",parentProgressbarBackground:"",connectorlineWidth:1,readOnly:!1,showTaskNames:!0,leftTaskLabelMapping:"",rightTaskLabelMapping:"",leftTaskLabelTemplate:"",rightTaskLabelTemplate:"",showGridCellTooltip:!1,cellTooltipTemplate:null,showGridExpandCellTooltip:!1,showProgressStatus:!0,showResourceNames:!0,enableTaskbarDragTooltip:!0,enableTaskbarTooltip:!0,enableWBS:!1,enableWBSPredecessor:!1,editSettings:{allowEditing:!1,allowAdding:!1,allowDeleting:!1,allowIndent:!1,editMode:"normal",beginEditAction:"dblclick",rowPosition:"belowselectedrow"},flatRecords:[],parentRecords:[],currentViewData:[],updatedRecords:[],ids:[],allowKeyboardNavigation:!0,cssClass:"",locale:"en-US",allowMultiSorting:!1,sortSettings:{sortedColumns:[]},enableAltRow:!0,enableVirtualization:!1,progressbarHeight:100,taskbarTooltipTemplate:"",progressbarTooltipTemplate:"",taskbarTooltipTemplateId:"",dateFormat:"",resourceIdMapping:"",resourceNameMapping:"",resourceUnitMapping:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",selectedRowIndex:-1,allowGanttChartEditing:!0,sizeSettings:{height:"",width:""},selectedItem:null,selectionType:"single",selectionMode:"row",selectedCellIndexes:[],weekendBackground:"",baselineColor:"#fba41c",treeColumnIndex:0,editDialogFields:[],addDialogFields:[],columnDialogFields:[],renderBaseline:!1,enableContextMenu:!1,enableResize:!0,isResponsive:!0,enableCollapseAll:!1,enablePredecessorValidation:!0,taskbarTemplate:"",parentTaskbarTemplate:"",milestoneTemplate:"",durationUnitMapping:"",dayWorkingTime:[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}],exportToExcelAction:"",exportToPdfAction:"",rowSelecting:null,rowSelected:null,rowDragStart:null,rowDrag:null,rowDragStop:null,cellSelecting:null,cellSelected:null,queryCellInfo:null,queryTaskbarInfo:null,beginEdit:null,endEdit:null,rowDataBound:null,expanding:null,expanded:null,collapsing:null,collapsed:null,actionBegin:null,actionComplete:null,taskbarEditing:null,taskbarEdited:null,load:null,create:null,contextMenuOpen:null,taskbarClick:null,taskbarHeight:20,criticalTask:""},dataTypes:{allowSorting:"boolean",allowColumnResize:"boolean",allowSelection:"boolean",dataSource:"data",query:"data",taskIdMapping:"string",parentTaskIdMapping:"string",taskNameMapping:"string",startDateMapping:"string",endDateMapping:"string",baselineStartDateMapping:"string",baselineEndDateMapping:"string",childMapping:"string",durationMapping:"string",milestoneMapping:"string",progressMapping:"string",predecessorMapping:"string",resourceInfoMapping:"string",taskSchedulingModeMapping:"string",notesMapping:"string",workMapping:"string",resources:"array",holidays:"array",dayWorkingTime:"array",highlightWeekends:"boolean",scheduleStartDate:"data",scheduleEndDate:"data",enableProgressBarResizing:"boolean",rowHeight:"number",includeWeekend:"boolean",taskSchedulingMode:"string",validateManualTasksOnLinking:"boolean",toolbarSettings:{showToolbar:"boolean",toolbarItems:"array",customToolbarItems:"array"},stripLines:"array",scheduleHeaderSettings:"data",roundOffDayworkingTime:"boolean",taskbarBackground:"string",progressbarBackground:"string",connectorLineBackground:"string",parentTaskbarBackground:"string",parentProgressbarBackground:"string",connectorlineWidth:"number",readOnly:"boolean",showTaskNames:"boolean",leftTaskLabelMapping:"string",rightTaskLabelMapping:"string",leftTaskLabelTemplate:"string",rightTaskLabelTemplate:"string",showProgressStatus:"boolean",showResourceNames:"boolean",enableTaskbarDragTooltip:"boolean",enableTaskbarTooltip:"boolean",editSettings:"data",flatRecords:"array",parentRecords:"array",currentViewData:"array",ids:"array",updatedRecords:"array",allowKeyboardNavigation:"boolean",cssClass:"string",locale:"string",allowMultiSorting:"boolean",showGridExpandCellTooltip:"boolean",sortSettings:{sortedColumns:"array"},enableAltRow:"boolean",enableVirtualization:"boolean",progressbarHeight:"number",taskbarTooltipTemplate:"string",progressbarTooltipTemplate:"string",taskbarTooltipTemplateId:"string",dateFormat:"string",resourceIdMapping:"string",resourceNameMapping:"string",resourceUnitMapping:"string",progressbarTooltipTemplateId:"string",taskbarEditingTooltipTemplateId:"string",taskbarEditingTooltipTemplate:"string",allowGanttChartEditing:"boolean",size:{height:"string",width:"string"},weekendBackground:"string",baselineColor:"string",renderBaseline:"boolean",enableContextMenu:"boolean",showGridCellTooltip:"boolean",treeColumnIndex:"number",editDialogFields:"array",addDialogFields:"array",showColumnChooser:"boolean",enableResize:"boolean",isResponsive:"boolean",enableCollapseAll:"boolean",enablePredecessorValidation:"boolean",durationUnitMapping:"string",taskbarTemplate:"string",parentTaskbarTemplate:"string",milestoneTemplate:"string",taskbarHeight:"number",criticalTask:"string"},ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","enableRTL","rowDataBound","editSettings","localization","cssClass","dataSource","allowKeyboardNavigation"],observables:["selectedItem","selectedRowIndex","selectedCellIndexes","splitterPosition","dataSource","splitterSettings.position"],selectedItem:r.util.valueFunction("selectedItem"),selectedRowIndex:r.util.valueFunction("selectedRowIndex"),selectedCellIndexes:r.util.valueFunction("selectedCellIndexes"),splitterPosition:r.util.valueFunction("splitterSettings.position"),dataSource:r.util.valueFunction("dataSource"),_splitterPosition:r.util.valueFunction("splitterPosition"),getColumns:function(){return this._columns},setColumns:function(n){this._columns=n},customColumnFields:function(){for(var t=this,u=t.model,i=t._columns,r=i.length,n=0;n<r;n++)t._columnHeaderTexts[i[n].field]||(t._columnHeaderTexts[i[n].field]=i[n].headerText)},_init:function(){var t=this,n=t.model,i=n.scheduleHeaderSettings.minutesPerInterval,u=n.durationUnit;n.isdesignMode&&(n.taskIdMapping="Id",n.taskNameMapping="Name",n.startDateMapping="StartDate",n.durationMapping="Duration",n.progressMapping="Progress",n.scheduleStartDate="02/23/2014",n.scheduleEndDate="03/10/2014",this.dataSource([{Id:1,Name:"Task 1",StartDate:"02/23/2014",Duration:5,Progress:40},{Id:2,Name:"Task 2",StartDate:"02/24/2014",Duration:5,Progress:40},{Id:3,Name:"Task 3",StartDate:"02/25/2014",Duration:5,Progress:40}]),n.sizeSettings.height="300px",n.sizeSettings.width="800px");n.scheduleStartDate||n.scheduleEndDate||i!="auto"||(n.scheduleHeaderSettings.minutesPerInterval=r.Gantt.minutesPerInterval.FiveMinutes);n.workMapping!=""&&(n.taskType=r.Gantt.TaskType.FixedWork);t._initPrivateProperties();t._trigger("load");t.element.addClass("e-gantt-core");this.dataSource()!==null?this._checkDataBinding():t._initialize()},_setTaskbarHeight:function(n){this.taskbarHeight=n<this.model.rowHeight?n:this.model.rowHeight;this._milesStoneWidth=Math.floor(this.taskbarHeight/2)*2},_deSelectRowItem:function(){var n=this,t=n.model;n._$ganttchartHelper.ejGanttChart("selectRows",-1);n._$treegridHelper.ejTreeGrid("selectRows",-1);this.selectedRowIndex(-1);t.selectedItem=null},_checkDataBinding:function(){var t=this,i=t.model,e,o,u,f;if(this.dataSource()==null&&this.dataSource([]),this.dataSource()instanceof r.DataManager)this._initDataSource();else if(this.dataSource().length>0){if(i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t._retrivedData=t.dataSource(),o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o);t._createGanttRecords(t.secondaryDatasource)}else t._createGanttRecords(this.dataSource());t._initialize()}else t._initialize()},_initDataSource:function(){var t=this,i=t.model,u=this._columnToSelect(),f=this.dataSource().executeQuery(u);f.done(r.proxy(function(r){var e,o,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=r.result,o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createGanttRecords(t.secondaryDatasource);t._initialize()}))},_columnToSelect:function(){var t=this,n=t.model,i=r.Query();return n.query?n.query:i},_intersectionObjects:function(n,t){for(var r=[],i;n.length>0&&t.length>0;)i=t.indexOf(n[0]),i==-1?n.shift():(r.push(n.shift()),t.splice(i,1));return r},_reconstructDatasource:function(n){var u=this,f=u.model,i,s,e,t,o,h,c;for(s=r.Predicate(f.parentTaskIdMapping,r.FilterOperators.notEqual,"null"),i=r.DataManager(n).executeLocal(r.Query().where(s).group(f.parentTaskIdMapping)),e=[],t=0;t<i.length;t++){if(!r.isNullOrUndefined(i[t].key)&&(o=u._taskIds.indexOf(i[t].key),o>-1)){n[o][f.childMapping]=i[t].items;continue}h=i[t].items;for(c in i[t].items)e.push(h[c])}u.secondaryDatasource=u._intersectionObjects(n,e)},updateScheduleDates:function(t,i){var u=this,e=this.model,o=e.scheduleHeaderSettings.scheduleHeaderType,s,f;e.scheduleStartDate=t;e.scheduleEndDate=i;u._scheduleDays=[];u._scheduleMonths=[];u._scheduleWeeks=[];u._scheduleYears=[];u._scheduleHours=[];u._scheduleMinutes=[];u._calculateHeaderDates();s=n("#ejGanttChart"+u._id).ejGanttChart("instance");f=s.model;u._isTreeGridRendered=!1;u._isGanttChartRendered=!1;u._isChartRendering=!0;u._updateGanttRecords();f.projectStartDate=u._getDateFromFormat(u._projectStartDate);f.projectEndDate=u._getDateFromFormat(u._projectEndDate);f.scheduleDays=u._scheduleDays;f.scheduleMonths=u._scheduleMonths;f.scheduleWeeks=u._scheduleWeeks;f.scheduleYears=u._scheduleYears;f.scheduleHours=u._scheduleHours;f.scheduleMinutes=u._scheduleMinutes;f.renderBaseline=e.renderBaseline;f.scheduleHeaderSettings.scheduleHeaderType=o;o=="week"?(f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.weekHeaderFormat=e.scheduleHeaderSettings.weekHeaderFormat,f.scheduleHeaderSettings.dayHeaderFormat=e.scheduleHeaderSettings.dayHeaderFormat,f.durationUnit=e.durationUnit,f.perDayWidth=u._perDayWidth):o=="day"?(f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.dayHeaderFormat=e.scheduleHeaderSettings.dayHeaderFormat,f.scheduleHeaderSettings.hourHeaderFormat=e.scheduleHeaderSettings.hourHeaderFormat,f.durationUnit=e.durationUnit,f.perHourWidth=u._perHourWidth,f.perDayWidth=u._perDayWidth):o=="hour"?(f.dateFormat=e.dateFormat,f.durationUnit=r.Gantt.DurationUnit.Minute,f.scheduleHeaderSettings.minutesPerInterval=e.scheduleHeaderSettings.minutesPerInterval,f.workingTimeScale=e.workingTimeScale,f.minuteInterval=u._minuteInterval,f.perMinuteWidth=u._perMinuteWidth,f.perDayWidth=u._perDayWidth):o=="month"?(f.durationUnit=e.durationUnit,f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.monthHeaderFormat=e.scheduleHeaderSettings.monthHeaderFormat,f.scheduleHeaderSettings.weekHeaderFormat=e.scheduleHeaderSettings.weekHeaderFormat,f.perDayWidth=u._perDayWidth,f.perWeekWidth=u._perWeekWidth):o=="year"&&(f.durationUnit=e.durationUnit,f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.yearHeaderFormat=e.scheduleHeaderSettings.yearHeaderFormat,f.perDayWidth=u._perDayWidth,f._perMonthWidth=u._perMonthWidth);n("#ejGanttChart"+u._id).ejGanttChart("refreshChartHeader",u._getDateFromFormat(t),u._getDateFromFormat(i));n("#ejGanttChart"+u._id).ejGanttChart("refreshContainersWidth");u._$ganttchartHelper.ejGanttChart("refreshHelper",u.model.currentViewData,u.model.updatedRecords,u._totalCollapseRecordCount);e.predecessorMapping&&(u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._connectorlineIds=[],u._connectorLinesCollection=[],u._isValidationEnabled=!1,u._createConnectorLinesCollection(),u._isValidationEnabled=!0);s._$bodyContainer.ejScroller("refresh");u._isTreeGridRendered=!0;u._isGanttChartRendered=!0;u._isChartRendering=!1},reRenderChart:function(t){var i=this,u=i.model,e=i._getDateFromFormat(u.scheduleStartDate),o=i._getDateFromFormat(u.scheduleEndDate),f,s;u.flatRecords=[];u.parentRecords=[];n("#ejGanttChart"+i._id).empty();switch(t){case r.Gantt.ScheduleHeaderType.Week:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Week;i._perDayWidth=u.perDayWidth;i._calculateWeekSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Day:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Day;i._perHourWidth=u.perHourWidth;i._perDayWidth=i._perHourWidth*24;i._calculateDaySplit(e,o);break;case r.Gantt.ScheduleHeaderType.Month:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Month;i._perDayWidth=u.perDayWidth;i._perWeekWidth=u.perWeekWidth;i._calculateMonthSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Year:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Year;i._perDayWidth=u.perDayWidth;i._perMonthWidth=u.perMonthWidth;i._calculateYearSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Hour:if(u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Hour,f=u.scheduleHeaderSettings.minutesPerInterval,s=r.Gantt.minutesPerInterval,i._perMinuteWidth=u.perMinuteWidth,f)if(f==s.Auto){var h=o-e;h>864e6?(i._minuteInterval=30,i._perDayWidth=i._perMinuteWidth*48):h>6048e5?(i._minuteInterval=15,i._perDayWidth=i._perMinuteWidth*96):h>1728e5?(i._minuteInterval=5,i._perDayWidth=i._perMinuteWidth*288):(i._minuteInterval=1,i._perDayWidth=i._perMinuteWidth*1440)}else f==s.OneMinute?(i._minuteInterval=1,i._perDayWidth=i._perMinuteWidth*1440):f==s.FiveMinutes?(i._minuteInterval=5,i._perDayWidth=i._perMinuteWidth*288):f==s.FifteenMinutes?(i._minuteInterval=15,i._perDayWidth=i._perMinuteWidth*96):f==s.ThirtyMinutes&&(i._minuteInterval=30,i._perDayWidth=i._perMinuteWidth*48);i._calculateHourSplit(e,o)}i.element.ejGantt("destroy").ejGantt(u);i._isTreeGridRendered=!1;i._isGanttChartRendered=!1},changeTaskMode:function(n,t){var i=this,f=i.model,u={};u.data=n;i._isValidationEnabled=!0;t==r.Gantt.TaskSchedulingMode.Manual?(n.isAutoSchedule=!1,n.item[f.taskSchedulingModeMapping]=!0):t==r.Gantt.TaskSchedulingMode.Auto&&(n.isAutoSchedule=!0,n.item[f.taskSchedulingModeMapping]=!1);u.columnName="taskMode";i._updateEditedGanttRecords(u);i._isValidationEnabled=!1},autoSchedule:function(n){var t=this,u=t.model,i,f=u.updatedRecords;i=f.filter(function(t){return t.taskId===n});t.changeTaskMode(i[0],r.Gantt.TaskSchedulingMode.Auto)},manualSchedule:function(n){var t=this,u=t.model,i,f=u.updatedRecords;i=f.filter(function(t){return t.taskId===n});t.changeTaskMode(i[0],r.Gantt.TaskSchedulingMode.Manual)},_updateGanttRecords:function(){for(var i=this,f=i.model,e=f.flatRecords,o=e.length,n,t,u,r=0;r<o;r++)n=e[r],n.hasChildRecords===!1&&(n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n.width=n.isMilestone==!0?i._milesStoneWidth:f.flatRecords[r].width,n.progressWidth=n._calculateProgressWidth(n.width,n.status)),n.baselineStartDate&&n.baselineEndDate?(n.baselineLeft=n._calculateBaselineLeft(this),n.baselineRight=n._calculateBaselineRight(this),n.baselineWidth=n._calculateBaseLineWidth(this)):(n.baselineLeft=0,n.baselineRight=0,n.baselineWidth=0),t=n.parentItem,u=t&&t.childRecords,t&&u.indexOf(n)==u.length-1&&n.hasChildRecords===!1&&(t.isAutoSchedule?i._updateParentItem(n):i._updateManualParentItem(n))},_initPrivateProperties:function(){var n=this;model=n.model;scheduleMode=model.scheduleHeaderSettings.scheduleHeaderType;n._isFromGantt=!0;n._disabledToolItems=[];n._id=n.element.attr("id");n._scheduleWeeks=[];n._taskIds=[];n._duplicate=!1;n._wrongenddate=!1;n._addPosition=null;n._scheduleYears=[];n._scheduleMonths=[];n._scheduleYears=[];n._scheduleDays=[];n._scheduleHours=[];n._projectStartDate;n._projectEndDate;n._columns=[];n._storedIndex=-1;n._perDayWidth;n._prevDayWidth=0;n._rowIndexOfLastSelectedCell=-1;n._perMonthWidth;n._perWeekWidth;n._$treegridPane=null;n._$ganttchartPane=null;n._$treegrid=null;n._$ganttchart=null;n._$ejGantt=null;n._$treegridHelper=null;n._$ganttchartHelper=null;n._tdsOffsetWidth=[];n._subPosx=[];n._predecessorsCollection=[];n._connectorLinesCollection=[];n._updatedConnectorLineCollection=[];n._connectorlineIds=[];n._gridRows=null;n._collapsedRecordCount=0;n._expandedRecordsCount=0;n._totalCollapseRecordCount=0;n._isInExpandCollapse=!1;n._hiddenRecordCount=0;n.prevPredecessorTO=null;n.prevPredecessorFrom=null;n.prevPredecessorcount=0;n._isValidationEnabled=!0;n._isTreeGridRendered=!1;n._isGanttChartRendered=!1;n._isChartRendering=!1;n._holidaysList=n._getHoliday();n._stringHolidays=n._getStringHolidays();n._isinBeginEdit=!1;n._isMileStoneEdited=!1;n._cellEditColumn=null;n._isinAddnewRecord=!1;n._contextMenuItems=null;n._totalBorderWidth=2;n._totalBorderHeight=r.browserInfo().name=="msie"&&r.browserInfo().version<9?model.toolbarSettings.showToolbar?3:2:model.toolbarSettings.showToolbar?1:0;n._columnHeaderTexts=null;n._predecessorEditingTexts=null;n._editDialogTexts=null;n._toolboxTooltipTexts=null;n._durationUnitTexts=null;n._durationUnitEditText=null;n._workUnitTexts=null;n._taskTypeTexts=null;n._effortDrivenTexts=null;n._contextMenuTexts=null;n._columnMenuTexts=null;n._editTypeText=null;n._clipModeText=null;n._textAlignTypeText=null;n._columnDialogTitle=null;n._deleteColumnText=null;n._okButtonText=null;n._cancelButtonText=null;n._confirmDeleteText=null;n._columnDialogTexts=null;n._newTaskTexts=null;n._months=null;n._days=null;n._dialogTabTitleTexts=null;n._isLoad=!0;n._updatedColumn="";n._isExistingUnitIsUpdated=!1;n._isDurationUpdated=!1;n._isResourceAddedOrRemoved=!1;n._newRecordResourceCollection=[];n._alertTexts=null;n._commonColumnWidth=150;n._searchString="";n._emptyDataColumns=[];n.secondaryDatasource=[];n._datasourceChildItems=[];n._$predecessorTable=null;n._mappingItems=[];n._editedDialogRecord=null;n._calculateDimensions();n._retrivedData=this.dataSource();n._isInExpandCollapseAll=!1;n._preTableCollection=[];n._defaultStartTime=null;n._defaultEndTime=null;n._workingTimeRanges=[];n._nonWorkingHours=[];this._validateTimeRange();JSON.stringify(model.dayWorkingTime)=='[{"from":"08:00 AM","to":"12:00 PM"},{"from":"01:00 PM","to":"05:00 PM"}]'&&(model.dayWorkingTime=model.workingTimeScale!=r.Gantt.workingTimeScale.TimeScale8Hours?[{from:"12:00 AM",to:"12:00 AM"}]:[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}]);n._secondsPerDay=n._getSecondsPerDay();n._timelineWidthCalculation();n._localizedLabels=n._getLocalizedLabels();n._setCultureInfo();n.setColumns(model.columns&&model.columns.length?model.columns:n.createTreeGridColumns());model.isRerender&&n._updateColumnDropDownData();n._updateColumnLocaleText();n._isRefreshAddedRecord=!1;n._isInAdd=!1;n._activeMenuItemId=null;n._isAddEditDialogSave=!1;n._setTaskbarHeight(model.taskbarHeight);n.isCriticalPathEnable=!1;n.criticalPathCollection=[];n.detailPredecessorCollection=[];n.collectionTaskId=[];n._enableDisableCriticalIcon=!1;n._generalTabColumnFields=[];n._addDialogGeneralColumns=[];n._addDialogcustomColumns=[];n._editDialogGeneralColumns=[];n._editDialogCustomColumns=[];model.resourceUnitMapping==""&&(model.resourceUnitMapping="unit");n._dialogTab=["General","Predecessors","Resources","Custom Fields","Notes"]},_updateModelsWidth:function(){var n=this,t=n.model;t.perDayWidth=n._perDayWidth?n._perDayWidth:null;t.perMonthWidth=n._perMonthWidth?n._perMonthWidth:null;t.perWeekWidth=n._perWeekWidth?n._perWeekWidth:null;t.perHourWidth=n._perHourWidth?n._perHourWidth:null;t.perMinuteWidth=n._perMinuteWidth?n._perMinuteWidth:null;t.minuteInterval=n._minuteInterval?n._minuteInterval:null},_timelineWidthCalculation:function(n){var t=this,f=t.model,e=!0,h=f.scheduleHeaderSettings.scheduleHeaderType,a=f.scheduleHeaderSettings.timescaleUnitSize,c=a.toString(),i,l,o,s;if(n==u&&a!="100%"&&(e=!1,l=c.indexOf("-"),i=l!=-1?100:+c.match(/\d+/)[0],i<50?i=50:i>500&&(i=500),f.scheduleHeaderSettings.timescaleUnitSize=i+"%"),n!=u&&(e=!1,l=c.indexOf("-"),i=l!=-1?a:+c.match(/\d+/)[0],i<50?i=50:i>500&&(i=500),f.scheduleHeaderSettings.timescaleUnitSize=i+"%"),h=="week")t._perDayWidth=e?30:Math.round(i*.3),t._perMinuteWidth=t._perDayWidth/1440;else if(h=="year")t._perDayWidth=e?3:Math.round(i*.03),t._perMonthWidth=t._perDayWidth*30,t._perMinuteWidth=t._perDayWidth/1440;else if(h=="month")t._perDayWidth=e?10:Math.round(i*.1),t._perWeekWidth=t._perDayWidth*7,t._perHourWidth=t._perDayWidth/24,t._perMinuteWidth=t._perDayWidth/1440;else if(h=="day")t._perHourWidth=e?20:Math.round(i*.2),t._perMinuteWidth=t._perHourWidth/60,t._perDayWidth=t._perHourWidth*24;else if(h=="hour"&&(o=f.scheduleHeaderSettings.minutesPerInterval,s=r.Gantt.minutesPerInterval,t._perMinuteWidth=e?20:Math.round(i*.2),o))if(o==s.Auto){var y=t._getDateFromFormat(f.scheduleStartDate),p=t._getDateFromFormat(f.scheduleEndDate),v=p-y;v>864e6?(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48):v>6048e5?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):v>1728e5?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440)}else o==s.OneMinute?(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440):o==s.FiveMinutes?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):o==s.FifteenMinutes?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):o==s.ThirtyMinutes&&(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48);t._updateModelsWidth()},_updateTimescaleUnitSize:function(n){var t=this,i=t.model,u=i.scheduleHeaderSettings,f=u.timescaleUnitSize,r;u.timescaleUnitSize=n;t._timelineWidthCalculation(n);t.updateScheduleDates(i.scheduleStartDate,i.scheduleEndDate);r=t.selectedRowIndex();r>=0&&t.focusOnTask(r)},_validateTimeRange:function(){for(var n,o="01/01/2016",a=this,f=this.model,l=f.dayWorkingTime.length,i=!0,u=null,e=0;e<l;e++)if(n=f.dayWorkingTime[e],n.from&&n.to){var s=r.parseDate(o+" "+n.from,"MM/dd/yyyy h:mm tt","en-US"),h=n.to!="12:00 AM"?r.parseDate(o+" "+n.to,"MM/dd/yyyy h:mm tt","en-US"):r.parseDate("01/02/2016 "+n.to,"MM/dd/yyyy h:mm tt","en-US"),v=h.getTime()-s.getTime(),c=this._getSecondsInDecimal(s),t=this._getSecondsInDecimal(h);t==0&&(t=86400);c>=t?i=!1:u==null?u=t:(u>=c||u>=t)&&(i=!1)}else i=!1;i||(f.dayWorkingTime=[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}])},_getParsedDate:function(n,t,i){return r.parseDate(n,t,i)},_setTime:function(n,t){var i=parseInt(n/3600),r=parseInt((n-i*3600)/60),u=n-i*3600-r*60;t.setHours(i,r,u,0)},_checkStartDate:function(n,t){var i=new Date(n),e=this.model,u=this._getSecondsInDecimal(i),f,o,l,s,h,c;if(u<this._defaultStartTime)this._setTime(this._defaultStartTime,i);else if(u!=this._defaultEndTime||t&&t.isMilestone){if(u>this._defaultEndTime)i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(f=0;f<this._workingTimeRanges.length;f++)if(o=this._workingTimeRanges[f],u>=o.to&&this._workingTimeRanges[f+1]&&u<this._workingTimeRanges[f+1].from){u!=o.to||t&&t.isMilestone?u!=o.to&&this._setTime(this._workingTimeRanges[f+1].from,i):this._setTime(this._workingTimeRanges[f+1].from,i);break}}else i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i);do if(l=new Date(i),!r.isNullOrUndefined(t)&&t.isAutoSchedule&&(!e.includeWeekend||e.holidays.length>0)||r.isNullOrUndefined(t)&&(!e.includeWeekend||e.holidays.length>0))for(e.includeWeekend||(i.getDay()==0?(i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i)):i.getDay()==6&&(i.setDate(i.getDate()+2),this._setTime(this._defaultStartTime,i))),s=0;s<e.holidays.length;s++)h=this._getDateFromFormat(e.holidays[s].day),c=new Date(h),h.setHours(0,0,0,0),c.setHours(23,59,59,59),i.getTime()>=h.getTime()&&i.getTime()<c.getTime()&&(i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i));while(l.getTime()!=i.getTime());return new Date(i)},_checkEndDate:function(n,t){var i=new Date(n),u=this.model,e=this._getSecondsInDecimal(i),f,l,a,s;if(e>this._defaultEndTime)this._setTime(this._defaultEndTime,i);else if(e<=this._defaultStartTime)i.setDate(i.getDate()-1),this._setTime(this._defaultEndTime,i);else if(e>this._defaultStartTime&&e<this._defaultEndTime)for(f=0;f<this._workingTimeRanges.length;f++)if(l=this._workingTimeRanges[f],e>l.to&&this._workingTimeRanges[f+1]&&e<=this._workingTimeRanges[f+1].from){this._setTime(this._workingTimeRanges[f].to,i);break}do if(a=new Date(i),!r.isNullOrUndefined(t)&&t.isAutoSchedule&&(!u.includeWeekend||u.holidays.length>0)||r.isNullOrUndefined(t)&&(!u.includeWeekend||u.holidays.length>0))for(u.includeWeekend||(i.getDay()==0?(i.setDate(i.getDate()-2),this._setTime(this._defaultEndTime,i)):i.getDay()==6?(i.setDate(i.getDate()-1),this._setTime(this._defaultEndTime,i)):i.getDay()==1&&this._defaultEndTime==86400&&this._getSecondsInDecimal(i)==0&&i.setDate(i.getDate()-2)),s=0;s<u.holidays.length;s++){var o=this._getDateFromFormat(u.holidays[s].day),h=new Date(o),c=new Date(i);c.setMinutes(i.getMinutes()-2);o.setHours(0,0,0,0);h.setHours(23,59,59,59);(i.getTime()>=o.getTime()&&i.getTime()<h.getTime()||c.getTime()>=o.getTime()&&c.getTime()<h.getTime())&&(i.setDate(i.getDate()-1),i.getTime()==o.getTime()&&this._defaultEndTime==86400&&this._getSecondsInDecimal(i)==0||this._setTime(this._defaultEndTime,i))}while(a.getTime()!=i.getTime());return new Date(i)},_checkBaseLineStartDate:function(n){var t=new Date(n),e=this.model,u=this._getSecondsInDecimal(t),i,f;if(r.isNullOrUndefined(n))return"";if(u<this._defaultStartTime)this._setTime(this._defaultStartTime,t);else if(u>=this._defaultEndTime)t.setDate(t.getDate()+1),this._setTime(this._defaultStartTime,t);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(i=0;i<this._workingTimeRanges.length;i++)if(f=this._workingTimeRanges[i],u>=f.to&&this._workingTimeRanges[i+1]&&u<this._workingTimeRanges[i+1].from){this._setTime(this._workingTimeRanges[i+1].from,t);break}return t},_checkBaseLineEndDate:function(n){var t=new Date(n),e=this.model,u=this._getSecondsInDecimal(t),i,f;if(r.isNullOrUndefined(n))return"";if(u>this._defaultEndTime)this._setTime(this._defaultEndTime,t);else if(u<=this._defaultStartTime)t.setDate(t.getDate()-1),this._setTime(this._defaultEndTime,t);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(i=0;i<this._workingTimeRanges.length;i++)if(f=this._workingTimeRanges[i],u>f.to&&this._workingTimeRanges[i+1]&&u<=this._workingTimeRanges[i+1].from){this._setTime(this._workingTimeRanges[i].to,t);break}return t},_getTaskLeft:function(n){var t=new Date(n),u=this.model,i=u.scheduleHeaderSettings.scheduleHeaderType;return(i==r.Gantt.ScheduleHeaderType.Week||i==r.Gantt.ScheduleHeaderType.Month||i==r.Gantt.ScheduleHeaderType.Year)&&this._getSecondsInDecimal(t)==this._defaultStartTime&&t.setHours(0,0,0,0),this._projectStartDate?(t.getTime()-this._projectStartDate.getTime())/864e5*this._perDayWidth:0},_getTaskWidth:function(n,t){var i=new Date(n),u=new Date(t),e=this.model,f=e.scheduleHeaderSettings.scheduleHeaderType;return(f==r.Gantt.ScheduleHeaderType.Week||f==r.Gantt.ScheduleHeaderType.Month||f==r.Gantt.ScheduleHeaderType.Year)&&(this._getSecondsInDecimal(i)==this._defaultStartTime&&i.setHours(0,0,0,0),this._getSecondsInDecimal(u)==this._defaultEndTime&&u.setHours(24)),timeDiff=u.getTime()-i.getTime(),timeDiff/864e5*this._perDayWidth},_getHolidaysCount:function(n,t){for(var i,f=this.model,e=this.model.holidays,r=0,u=0;u<e.length;u++)i=this._getDateFromFormat(e[u].day),n.getTime()<i.getTime()&&t.getTime()>=i.getTime()&&(f.includeWeekend||i.getDay()==0||i.getDay()==6?f.includeWeekend&&(r+=1):r+=1);return r},_getWeekendCount:function(n,t){var i=new Date(n),u=new Date(t),r=0;for(i.setHours(0,0,0,0),i.setDate(i.getDate()+1),u.setHours(0,0,0,0);i.getTime()<u.getTime();)i.getDay()==0&&(r+=1,i.setDate(i.getDate()+5)),i.getTime()<t.getTime()&&i.getDay()==6&&(r+=1),i.setDate(i.getDate()+1);return r},_getDayDiff:function(n,t){return(t.getTime()-n.getTime())/864e5},_getNumberOfSeconds:function(n,t){var i=new Date(n),r=new Date(t),u=0;return i.setHours(0,0,0,0),i.setDate(i.getDate()+1),r.setHours(0,0,0,0),i.getTime()<r.getTime()&&(u=(r.getTime()-i.getTime())/1e3),u},_getEndDate:function(n,t,i,u){for(var e=0,s=-1,h=0,f=new Date(n),l=-1,o,c,e=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Hour?t*3600:t*60:this._secondsPerDay*t;e>0;){for(s=this._getSecondsInDecimal(f),o=0;o<this._workingTimeRanges.length;o++)if(c=this._workingTimeRanges[o],s>=c.from&&s<=c.to){l=o;break}if(h=Math.round(this._workingTimeRanges[l].to-s),h<=e)f.setSeconds(f.getSeconds()+h),e-=h;else{f.setSeconds(f.getSeconds()+e);break}e>0&&(f=this._checkStartDate(f,u))}return f},_getStartDate:function(n,t,i,u){for(var e=0,o=-1,h=0,f=new Date(n),l=-1,s,c,e=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Hour?t*3600:t*60:this._secondsPerDay*t;e>0;){for(o=this._getSecondsInDecimal(f),this._workingTimeRanges.length>0&&this._workingTimeRanges[this._workingTimeRanges.length-1].to==86400&&o==0&&(o=86400),s=0;s<this._workingTimeRanges.length;s++)if(c=this._workingTimeRanges[s],o>=c.from&&o<=c.to){l=s;break}if(h=Math.round(o-this._workingTimeRanges[l].from),h<=e)f.setSeconds(f.getSeconds()-h),e-=h;else{f.setSeconds(f.getSeconds()-e);break}e>0&&(f=this._checkEndDate(f,u))}return f},_getDuration:function(n,t,i,u){var e=t.getTime()-n.getTime(),s,h=!this.model.includeWeekend&&u?this._getWeekendCount(n,t):0,c=0,f=0,o=this._getNumberOfSeconds(n,t),l=u?this._getHolidaysCount(n,t):0;return e=e/1e3,o=(o-h*86400-l*86400)/86400,c=this._getNonWorkingSecondsOnDate(n,t),f=e-o*(86400-this._secondsPerDay)-h*86400-l*86400-c,s=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Minute?f/60:f/3600:f/this._secondsPerDay,parseFloat(s.toFixed(2))},_getSecondsInDecimal:function(n){return n.getHours()*3600+n.getMinutes()*60+n.getSeconds()+n.getMilliseconds()/1e3},_getNonWorkingSecondsOnDate:function(n,t){for(var u,i=this,s=this._getSecondsInDecimal(n),h=this._getSecondsInDecimal(t),f=-1,e=-1,o=0,r=0;r<this._workingTimeRanges.length;r++)u=this._workingTimeRanges[r],s>=u.from&&s<=u.to&&(f=r),h>=u.from&&h<=u.to&&(e=r);return n.getDate()!=t.getDate()?o=i._nonWorkingHours[i._nonWorkingHours.length-1-f]+86400-i._defaultEndTime+(i._nonWorkingHours[e]+i._defaultStartTime):f!=e&&(o=i._nonWorkingHours[e]-i._nonWorkingHours[f]),o},_getSecondsPerDay:function(){for(var i,e="01/01/2016",n=this,o=this.model,s=o.dayWorkingTime.length,h=0,t=0;t<s;t++)if(i=o.dayWorkingTime[t],i.from&&i.to){var c=r.parseDate(e+" "+i.from,"MM/dd/yyyy h:mm tt","en-US"),l=i.to!="12:00 AM"?r.parseDate(e+" "+i.to,"MM/dd/yyyy h:mm tt","en-US"):r.parseDate("01/02/2016 "+i.to,"MM/dd/yyyy h:mm tt","en-US"),a=l.getTime()-c.getTime(),f=this._getSecondsInDecimal(c),u=this._getSecondsInDecimal(l);u==0&&(u=86400);h+=a/1e3;t==0&&(n._defaultStartTime=f);t==s-1&&(n._defaultEndTime=u);t>0?n._nonWorkingHours.push(n._nonWorkingHours[n._nonWorkingHours.length-1]+f-n._workingTimeRanges[t-1].to):n._nonWorkingHours.push(0);n._workingTimeRanges.push({from:f,to:u})}return h},_updateColumnLocaleText:function(){var i=this.model,n=i.columns,t;if(n&&n.length>0)for(t=0;t<n.length;t++)n[t].field&&this._columnHeaderTexts[n[t].field]&&(n[t].headerText=this._columnHeaderTexts[n[t].field])},_calculateDimensions:function(){var t=this,u=this.model.sizeSettings,i=u.height,r=u.width,n=t.element,f=n[0].style.height,e=n[0].style.width,o=n.parent().height(),s=n.parent().width();r&&n.css("width",r);i&&n.css("height",i);i||f||(f="450px",n.css("height","450px"));r||e||(e="100%",t.element.css("width","100%"));t._ganttHeight=n.height();t._ganttWidth=n.width();t._ganttHeight===0&&(t._ganttHeight=450,n.css("450px"))},_setCultureInfo:function(){var i=this,e=i.model,f=e.locale,t=n.extend({},i._localizedLabels,r.isNullOrUndefined(r.cultures[f])?r.cultures["default"]:r.cultures[f]),u=n.extend({},r.cultures["default"],r.Gantt.Locale["default"]);e.dateFormat=e.dateFormat?e.dateFormat:t&&t.calendars&&t.calendars.standard.patterns?t.calendars.standard.patterns.d:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.patterns.d:u.calendars.standard.patterns.d;i._emptyRecordText=t&&t.emptyRecord?t.emptyRecord:u.emptyRecord;i._columnHeaderTexts=t&&t.columnHeaderTexts?t.columnHeaderTexts:u.columnHeaderTexts;i._columnHeaderTexts=n.extend({},u.columnHeaderTexts,i._columnHeaderTexts);i._taskModeTexts=t&&t.taskModeTexts?t.taskModeTexts:u.taskModeTexts;i._taskModeTexts=n.extend({},u.taskModeTexts,i._taskModeTexts);i._editDialogTexts=t&&t.editDialogTexts?t.editDialogTexts:u.editDialogTexts;i._editDialogTexts=n.extend({},u.editDialogTexts,i._editDialogTexts);i._columnDialogTexts=t&&t.columnDialogTexts?t.columnDialogTexts:u.columnDialogTexts;i._toolboxTooltipTexts=t&&t.toolboxTooltipTexts?t.toolboxTooltipTexts:u.toolboxTooltipTexts;i._toolboxTooltipTexts=n.extend({},u.toolboxTooltipTexts,i._toolboxTooltipTexts);i._durationUnitTexts=t&&t.durationUnitTexts?t.durationUnitTexts:u.durationUnitTexts;i._durationUnitTexts=n.extend({},u.durationUnitTexts,i._durationUnitTexts);i._durationUnitEditText=t&&t.durationUnitEditText?t.durationUnitEditText:u.durationUnitEditText;i._durationUnitEditText=n.extend({},u.durationUnitEditText,i._durationUnitEditText);i._workUnitTexts=t&&t.workUnitTexts?t.workUnitTexts:u.workUnitTexts;i._workUnitTexts=n.extend({},u.workUnitTexts,i._workUnitTexts);i._taskTypeTexts=t&&t.taskTypeTexts?t.taskTypeTexts:u.taskTypeTexts;i._taskTypeTexts=n.extend({},u.taskTypeTexts,i._taskTypeTexts);i._effortDrivenTexts=t&&t.effortDrivenTexts?t.effortDrivenTexts:u.effortDrivenTexts;i._effortDrivenTexts=n.extend({},u.effortDrivenTexts,i._effortDrivenTexts);i._contextMenuTexts=t&&t.contextMenuTexts?t.contextMenuTexts:u.contextMenuTexts;i._contextMenuTexts=n.extend({},u.contextMenuTexts,i._contextMenuTexts);i._newTaskTexts=t&&t.newTaskTexts?t.newTaskTexts:u.newTaskTexts;i._months=t&&t.calendars?t.calendars.standard.months.namesAbbr:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.months.namesAbbr:u.calendars.standard.months.namesAbbr;i._days=t&&t.calendars?t.calendars.standard.months.namesAbbr:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.days.namesAbbr:u.calendars.standard.days.namesAbbr;i._columnMenuTexts=t&&t.columnMenuTexts?t.columnMenuTexts:u.columnMenuTexts;i._columnMenuTexts=n.extend({},u.contextMenuTexts,i._columnMenuTexts);i._columnDialogTitle=t&&t.columnDialogTitle?t.columnDialogTitle:u.columnDialogTitle;i._deleteColumnText=t&&t.deleteColumnText?t.deleteColumnText:u.deleteColumnText;i._okButtonText=t&&t.okButtonText?t.okButtonText:u.okButtonText;i._cancelButtonText=t&&t.cancelButtonText?t.cancelButtonText:u.cancelButtonText;i._confirmDeleteText=t&&t.confirmDeleteText?t.confirmDeleteText:u.confirmDeleteText;i._predecessorEditingTexts=t&&t.predecessorEditingTexts?t.predecessorEditingTexts:u.predecessorEditingTexts;i._predecessorEditingTexts=n.extend({},u.contextMenuTexts,i._predecessorEditingTexts);i._alertTexts=t&&t.alertTexts?t.alertTexts:u.alertTexts;i._alertTexts=n.extend({},u.alertTexts,i._alertTexts);i._dialogTabTitleTexts=t&&t.dialogTabTitleTexts?t.dialogTabTitleTexts:u.dialogTabTitleTexts;i._dialogTabTitleTexts=n.extend({},u.dialogTabTitleTexts,i._dialogTabTitleTexts);i._predecessorCollectionText=t&&t.predecessorCollectionText?t.predecessorCollectionText:u.predecessorCollectionText;i._editTypeText=t&&t.editTypeTexts?t.editTypeTexts:u.editTypeTexts;i._textAlignTypeText=t&&t.textAlignTypes?t.textAlignTypes:u.textAlignTypes;i._clipModeText=t&&t.clipModeTexts?t.clipModeTexts:u.clipModeTexts},_getMappingItems:function(){for(var n=this,u=n.model,i=[],r=n._columns.length,t=0;t<r;t++)i.push(n._columns[t].mappingName);return i},_getContextMenuItems:function(){var t=this,n=this._contextMenuTexts;return[{headerText:n.taskDetailsText,eventHandler:null,isDefault:!0,menuId:"Task"},{headerText:n.addNewTaskText,eventHandler:null,isDefault:!0,menuId:"Add"},{headerText:n.indentText,eventHandler:null,isDefault:!0,menuId:"Indent"},{headerText:n.outdentText,eventHandler:null,isDefault:!0,menuId:"Outdent"},{headerText:n.deleteText,eventHandler:null,isDefault:!0,menuId:"Delete"},{iconPath:null,headerText:n.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:n.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_initialize:function(){if(!this._isFromSetModel){var n=this,t=n.model;n._$treegridPane=r.buildTag("div.e-treegridPane");n._$ganttchartPane=r.buildTag("div.e-ganttchartPane");n._$ejGantt=r.buildTag("div.e-gantt-Spliter#e-ejSpliter"+n._id,"",{},{unselectable:"on"});t.predecessorMapping&&n._updatePredecessors();n._render();t.updatedRecords=t.flatRecords.slice();t.currentViewData=t.flatRecords.slice();t.predecessorMapping&&t.enablePredecessorValidation&&n._updatedRecordsDateByPredecessor();n._calculateScheduleDates();n._calculateHeaderDates();n._updateGanttRecords();n._checkDataManagerUpdate();n._renderTreeGrid();t.updatedRecords=n.getUpdatedRecords();t.currentViewData=n.getCurrentViewData();n._renderGanttChart();n._enableCreateCollection=!0;n._isValidationEnabled=!1;n._isLoad=!1;t.predecessorMapping&&n._createConnectorLinesCollection();n._isValidationEnabled=!0;n._$treegridPane.css({overflow:"hidden"});n._initiateDialogTemplates();n._isTreeGridRendered=!0;n._isGanttChartRendered=!0;n._gridRows=n.getRows();n._ganttChartRows=n.getGanttChartRows();n._createContextMenuTemplate();n._wireEvents();n._initialEndRendering();n._getLocalizedLabels()}},_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},_initialEndRendering:function(){var n=this,t=this.model,i;t.enableCollapseAll?(this.selectedRowIndex()!=-1&&n._deSelectRowItem(),n._collapseAll()):t.expandStateMapping&&n._collapseRecordOnLoad();n.selectedRowIndex()>=0&&n.selectedRowIndex()<n.model.updatedRecords.length&&t.selectionMode=="row"&&(i={},i.recordIndex=n.selectedRowIndex(),i.previousIndex=t.selectedItem?t.updatedRecords.indexOf(t.selectedItem):-1,n.rowSelecting(i)&&(n.selectRows(n.selectedRowIndex()),n._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")))},_checkDataManagerUpdate:function(){var n=this,t=this.dataSource();n._isDataManagerUpdate=!1;n._jsonData=null;t instanceof r.DataManager&&(t.dataSource.offline&&t.dataSource.json?(n._isDataManagerUpdate=!0,n._jsonData=t.dataSource.json):t.dataSource.offline||(n._isDataManagerUpdate=!0,n._jsonData=n._retrivedData))},_initiateDialogTemplates:function(){var t=this,i=this.model,u;t.customColumnFields();(i.editSettings.allowEditing||i.editSettings.editMode=="normal"||i.editSettings.editMode=="dialogTemplate")&&(t.editDialogTemplate(),n("#"+this._id+"_dialogEdit").length===0&&t.element.append(t._renderDialog()));i.editSettings.allowAdding&&(t.addDialogTemplate(),n("#"+this._id+"_dialogAdd").length===0&&(u=r.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none","overflow-x":"hidden"},{id:this._id+"_dialogAdd"}),t.element.append(u)))},_render:function(){var n=this,t=n.element,i=n.model;n.model.toolbarSettings.showToolbar&&t.append(n._renderToolBar());n._ganttHeight=parseInt(n._ganttHeight)-n._getToolBarHeight()-n._totalBorderHeight;n._$treegrid=r.buildTag("div.ejTreeGrid#ejTreeGrid"+n._id,"",{height:n._ganttHeight},{});n._$ganttchart=r.buildTag("div.ejGanttChart#ejGanttChart"+n._id,"",{height:n._ganttHeight},{});n._$ganttchartPane.append(n._$ganttchart);n._$treegridPane.append(n._$treegrid);n._$ejGantt.append(n._$treegridPane);n._$ejGantt.append(n._$ganttchartPane);t.append(n._$ejGantt);n._renderGantt()},_renderDialog:function(){return r.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none","overflow-x":"hidden"},{id:this._id+"_dialogEdit"})},editDialogTemplate:function(){var t=this,f=t.model,u=n.extend([],t._columns),s=u.length,f=t.model,ft=-1,et=-1,at=t._$treegridHelper.data("ejTreeGrid"),ot,st=t._dialogTab,vt=st.length,w,l,b,a,e,y,k,d,i,g,nt,tt,it,rt,ut;if(t._editDialogGeneralColumns=[],t._editDialogCustomColumns=[],t._generalTabColumnFields=["taskId","taskMode","taskName","startDate","endDate","duration","resourceInfo","status","work","taskType","effortDriven","baselineStartDate","baselineEndDate","predecessor","WBS","notesText"],t._mappingItems=t._getMappingItems(),s!=0){if(f.editDialogFields.length>0){for(w=[],l=0;l<f.editDialogFields.length;l++)b=n.grep(t._columns,function(n){return n.mappingName===f.editDialogFields[l].field}),b.length&&w.push(b[0]);u=w}else f.enableWBS&&(f.enableWBSPredecessor&&(a=u.filter(function(n){return n.mappingName!="WBSPredecessor"})),a&&a.length&&(u=a));for(e=n.map(u,function(n,t){if(n.mappingName==f.taskNameMapping)return t}),(e[0]+1)%3==0&&u.splice(e[0]-1,0,u.splice(e[0],1)[0]),s=u.length,i=0;i<s;i++)if(n.inArray(u[i].mappingName,t._mappingItems)!=-1){if(!f.resourceInfoMapping&&(u[i].field=="work"||u[i].field=="taskType"||u[i].field=="effortDriven"))continue;u[i].mappingName!==f.predecessorMapping&&u[i].mappingName!=f.resourceInfoMapping&&u[i].mappingName!=f.notesMapping?(e=n.map(t._generalTabColumnFields,function(n,t){if(n==u[i].field)return t}),e.length>0?t._editDialogGeneralColumns.push(u[i]):t._editDialogCustomColumns.push(u[i])):u[i].mappingName!==f.baselineStartDateMapping&&u[i].mappingName!==f.baselineEndDateMapping&&(u[i].mappingName!==f.predecessorMapping?et=i:ft=i)}var v=r.buildTag("div","",{},{}),o=r.buildTag("div","",{},{id:t._id+"EditTab"}),h=r.buildTag("ul","",{},{});for(o.append(h),v.append(o),y=0;y<vt;y++)switch(st[y]){case"General":h.append("<li><a href='#"+t._id+"EditGeneral'>"+t._dialogTabTitleTexts.generalTabText+"<\/a><\/li>");k=r.buildTag("div.e-gantt-editor-container","",{},{id:t._id+"EditGeneral"});d=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"GeneralEditForm"});k.append(d);o.append(k);$form=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"EditForm"});$genearlTable=r.buildTag("table.e-general-edit-div","",{"border-spacing":"2px","border-collapse":"separate"},{});$tr=r.buildTag("tr");var p=0,c=t._editDialogGeneralColumns,s=c.length;for(i=0;i<s;i++)p<3?(c[i].mappingName!==f.taskNameMapping?(p++,$td=r.buildTag("td.e-property-container","",{},{})):(p+=2,$td=r.buildTag("td.e-property-container","",{},{colspan:"2"})),$innerTable=r.buildTag("table","",{outline:"none","border-spacing":"2px","border-collapse":"separate"},{}),$inTr=r.buildTag("tr","",{"line-height":"1.4"},{}),$inTd=r.buildTag("td.editLabel","",{},{}),$inTd.append("<label for='"+c[i].field+"'>"+t._columnHeaderTexts[c[i].field]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue","",{},{}),ot=t._columns.indexOf(c[i]),r.TreeGrid._initCellEditType(at,$inTd2,t._id,ot,"Edit"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($genearlTable.append($tr),$tr=$tempTr=r.buildTag("tr"),i--,p=0);$genearlTable.append($tr);d.append($genearlTable);break;case"Predecessors":f.predecessorMapping&&ft!=-1&&(h.append("<li><a href='#"+t._id+"EditPredecessors'>"+t._dialogTabTitleTexts.predecessorsTabText+"<\/a><\/li>"),g=r.buildTag("div.e-gantt-predecessor-container","",{},{id:t._id+"EditPredecessors"}),nt=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"PredecessorEditForm"}),g.append(nt),o.append(g),$predecessorTable=r.buildTag("table#"+t._id+"predecessoreditTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},""),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"EditDialog_PredecesorAdd' class='e-addpre e-icon e-enable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"EditDialog_PredecesorDelete' class='e-deletepre e-icon e-disable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$predecessorTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"predecessorEdit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$predecessorTable.append($inTr2),nt.append($predecessorTable));break;case"Resources":f.resourceInfoMapping&&et!=-1&&(h.append("<li><a href='#"+t._id+"EditResources'>"+t._dialogTabTitleTexts.resourcesTabText+"<\/a><\/li>"),tt=r.buildTag("div.e-gantt-resource-container","",{},{id:t._id+"EditResources"}),it=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"ResourceEditForm"}),tt.append(it),o.append(tt),$resourceTable=r.buildTag("table#"+t._id+"resourceeditTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"EditDialog_ResourceAdd' class='e-addpre e-icon e-enable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"EditDialog_ResourceDelete' class='e-deletepre e-icon e-disable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$resourceTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"resourceEdit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$resourceTable.append($inTr2),it.append($resourceTable));break;case"Custom Fields":t._editDialogCustomColumns.length>0&&(h.append("<li><a href='#"+t._id+"EditCustomFields'>"+t._dialogTabTitleTexts.customFieldsTabText+"<\/a><\/li>"),rt=r.buildTag("div.e-gantt-csfield-container","",{},{id:t._id+"EditCustomFields"}),ut=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"CustomFieldsEditForm"}),rt.append(ut),o.append(rt),$customFieldTable=r.buildTag("table#"+t._id+"customFieldeditTable","",{width:"100%",outline:"none",position:"relative",left:"-2px",top:"4px","border-collapse":"collapse"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse"},""),$inTd=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"customFieldEdit","",{},{}),$inTd.append($preDiv),$inTr.append($inTd),$customFieldTable.append($inTr),ut.append($customFieldTable));break;case"Notes":var ht=f.editDialogFields,s=ht.length,e=n.map(ht,function(n,t){if(n.field==f.notesMapping)return t});if(f.notesMapping&&s==0||s>0&&e.length>0){h.append("<li><a href='#"+t._id+"EditNotes'>"+t._dialogTabTitleTexts.notesTabText+"<\/a><\/li>");var ct=r.buildTag("div.e-gantt-notes-container","",{},{id:t._id+"EditNotes"}),lt=r.buildTag("div","",{padding:"0px",position:"relative",top:"5px",left:"-1px"},{}),yt=r.buildTag("textarea","",{},{id:t._id+"EditAreaNotes"});lt.append(yt);ct.append(lt);o.append(ct)}}v=t.renderDiaglogButton("edit",v);n.templates(t._id+"_JSONDialogEditingTemplate",v.html())}},addDialogTemplate:function(){var t=this,f=t.model,u=n.extend([],t._columns),s=u.length,f=t.model,ft=-1,et=-1,at=t._$treegridHelper.data("ejTreeGrid"),ot,st=t._dialogTab,vt=st.length,w,l,b,a,e,y,k,d,i,g,nt,tt,it,rt,ut;if(t._addDialogGeneralColumns=[],t._addDialogCustomColumns=[],t._generalTabColumnFields=["taskId","taskMode","taskName","startDate","endDate","duration","resourceInfo","status","work","taskType","effortDriven","baselineStartDate","baselineEndDate","predecessor","WBS","notesText"],t._mappingItems=t._getMappingItems(),s!=0){if(f.addDialogFields.length>0){for(w=[],l=0;l<f.addDialogFields.length;l++)b=n.grep(t._columns,function(n){return n.mappingName===f.addDialogFields[l].field}),b.length&&w.push(b[0]);u=w}else f.enableWBS&&(f.enableWBSPredecessor&&(a=u.filter(function(n){return n.mappingName!="WBSPredecessor"})),a&&a.length&&(u=a));e=n.map(u,function(n,t){if(n.mappingName==f.taskNameMapping)return t});(e[0]+1)%3==0&&u.splice(e[0]-1,0,u.splice(e[0],1)[0]);var v=r.buildTag("div","",{},{}),o=r.buildTag("div","",{},{id:t._id+"AddTab"}),h=r.buildTag("ul","",{},{});for(o.append(h),v.append(o),s=u.length,i=0;i<s;i++)if(n.inArray(u[i].mappingName,t._mappingItems)!=-1){if(!u[i].mappingName&&u[i].field=="work"||u[i].field=="taskType"||u[i].field=="effortDriven")continue;u[i].mappingName!==f.predecessorMapping&&u[i].mappingName!=f.resourceInfoMapping&&u[i].mappingName!=f.notesMapping?(e=n.map(t._generalTabColumnFields,function(n,t){if(n==u[i].field)return t}),e.length>0?t._addDialogGeneralColumns.push(u[i]):t._addDialogCustomColumns.push(u[i])):u[i].mappingName===f.predecessorMapping?ft=i:u[i].mappingName===f.resourceInfoMapping&&(et=i)}for(y=0;y<vt;y++)switch(st[y]){case"General":h.append("<li><a href='#"+t._id+"AddGeneral'>"+t._dialogTabTitleTexts.generalTabText+"<\/a><\/li>");k=r.buildTag("div.e-gantt-editor-container","",{},{id:t._id+"AddGeneral"});d=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"GeneralAddForm"});k.append(d);o.append(k);$form=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"AddForm"});$genearlTable=r.buildTag("table.e-general-edit-div","",{"border-spacing":"2px","border-collapse":"separate"},{});$tr=r.buildTag("tr");var p=0,c=t._addDialogGeneralColumns,s=c.length;for(i=0;i<s;i++)p<3?(c[i].mappingName!==f.taskNameMapping?(p++,$td=r.buildTag("td.e-property-container","",{},{})):(p+=2,$td=r.buildTag("td.e-property-container","",{},{colspan:"2"})),$innerTable=r.buildTag("table","",{outline:"none","border-spacing":"2px","border-collapse":"separate"},{}),$inTr=r.buildTag("tr","",{"line-height":"1.4"},{}),$inTd=r.buildTag("td.editLabel","",{},{}),$inTd.append("<label for='"+c[i].field+"'>"+t._columnHeaderTexts[c[i].field]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue","",{},{}),ot=t._columns.indexOf(c[i]),r.TreeGrid._initCellEditType(at,$inTd2,t._id,ot,"Add"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($genearlTable.append($tr),$tr=$tempTr=r.buildTag("tr"),i--,p=0);$genearlTable.append($tr);d.append($genearlTable);break;case"Predecessors":f.predecessorMapping&&ft!=-1&&(h.append("<li><a href='#"+t._id+"AddPredecessors'>"+t._dialogTabTitleTexts.predecessorsTabText+"<\/a><\/li>"),g=r.buildTag("div.e-gantt-predecessor-container","",{},{id:t._id+"AddPredecessors"}),nt=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"PredecessorAddForm"}),g.append(nt),o.append(g),$predecessorTable=r.buildTag("table#"+t._id+"predecessoraddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"AddDialog_PredecesorAdd' class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"AddDialog_PredecesorDelete' class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$predecessorTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"predecessorAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$predecessorTable.append($inTr2),nt.append($predecessorTable));break;case"Resources":f.resourceInfoMapping&&et!=-1&&(h.append("<li><a href='#"+t._id+"AddResources'>"+t._dialogTabTitleTexts.resourcesTabText+"<\/a><\/li>"),tt=r.buildTag("div.e-gantt-resource-container","",{},{id:t._id+"AddResources"}),it=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"ResourceAddForm"}),tt.append(it),o.append(tt),$resourceTable=r.buildTag("table#"+t._id+"resourceaddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"AddDialog_ResourceAdd' class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"AddDialog_ResourceDelete' class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$resourceTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"resourceAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$resourceTable.append($inTr2),it.append($resourceTable));break;case"Custom Fields":t._addDialogCustomColumns.length>0&&(h.append("<li><a href='#"+t._id+"AddCustomFields'>"+t._dialogTabTitleTexts.customFieldsTabText+"<\/a><\/li>"),rt=r.buildTag("div.e-gantt-csfield-container","",{},{id:t._id+"AddCustomFields"}),ut=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"CustomfFieldsAddForm"}),rt.append(ut),o.append(rt),$customFieldTable=r.buildTag("table#"+t._id+"customfieldaddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"4px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"customFieldAdd","",{},{}),$inTd.append($preDiv),$inTr.append($inTd),$customFieldTable.append($inTr),ut.append($customFieldTable));break;case"Notes":var ht=f.addDialogFields,s=ht.length,e=n.map(ht,function(n,t){if(n.field==f.notesMapping)return t});if(f.notesMapping&&s==0||s>0&&e.length>0){h.append("<li><a href='#"+t._id+"AddNotes'>"+t._dialogTabTitleTexts.notesTabText+"<\/a><\/li>");var ct=r.buildTag("div.e-gantt-notes-container","",{},{id:t._id+"AddNotes"}),lt=r.buildTag("div","",{padding:"0px",position:"relative",top:"5px",left:"-1px"},{}),yt=r.buildTag("textarea","",{},{id:t._id+"AddAreaNotes"});lt.append(yt);ct.append(lt);o.append(ct)}}v=t.renderDiaglogButton("add",v);n.templates(t._id+"_JSONDialogAddingTemplate",v.html())}},_clearContextMenu:function(){n(".e-contextmenu").remove();n(".e-innerContextmenu").remove()},_createContextMenuTemplate:function(){var t=this,u={},i,f,r;u["_"+t._id+"getHeaderName"]=n.proxy(t._getHeaderName,t);n.views.helpers(u);i="<li style='list-style-type:none;margin:0px;'>";f="<div class='e-menuitem{{if disable}} e-disable{{/if}}{{if ~_"+t._id+"getHeaderName(#data)}} e-parent-menuitem{{/if}}' id={{:menuId}} style='display:table;cursor:pointer;min-width:100px;'>{{if iconPath}}<div class='e-icon e-contextmenu-image' style='background-image:{{:iconPath}};background-repeat:no-repeat;'/>{{else}}<div class='e-icon {{:iconClass}} e-contextmenu-icon'/>{{/if}}<div class='e-contextmenu-label'><span>{{:headerText}}<\/span><\/div>{{if ~_"+t._id+"getHeaderName(#data)}}<div class='e-icon e-expander e-contextmenu-icon'/> {{/if}}";i+=f;i+="<\/div><\/li>";r={};r[t._id+"contextMenuTemplate"]=i;n.templates(r)},_getHeaderName:function(n){var t=this._contextMenuItems.filter(function(t){if(n.menuId!=null&&n.menuId==t.parentMenuId)return!0});return t.length>0?!0:!1},initCellEditType:function(t,i,u){var f=this,o=f.model,e,s={},h,c,l,a;e=u?u:"";r.isNullOrUndefined(t.editType)&&(t.editType="stringedit");switch(t.editType){case"stringedit":t.mappingName===o.predecessorMapping?(s["_"+f._id+"predecessor"]=f._getPredecessorsValue,n.views.helpers(s),i.html(r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+f._id+"predecessor('"+f._id+"Object','"+o.predecessorMapping+"','"+t.field+"')}}",id:f._id+t.field,name:t.field}))):i.html(r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u}));break;case"booleanedit":i.html("{{if "+t.field+'}} <input class="e-field e-checkbox" type ="checkbox" id='+f._id+t.field+" name="+t.field+' checked="checked"><\/input>{{else}} <input class="e-field e-checkbox" type ="checkbox" id='+f._id+t.field+" name="+t.field+" > {{/if}}");break;case"numericedit":h=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(h);break;case"datepicker":case"datetimepicker":c=r.buildTag("input.e-"+t.editType+" e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(c);break;case"dropdownedit":l=r.buildTag("input.e-field e-dropdownlist e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(l);break;case"maskedit":a=r.buildTag("input .e-field e-maskedit","",{},{value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(a)}},_getPredecessorsValue:function(n,t){return this.data.item?this.data.item[t]:""},_onHoliDayCheckBefore:function(n){var i=this,r=i.model.holidays,e=i.model.includeWeekend,t,u,f;if(isAutoSchedule&&r&&r.length){for(t=0,u=r.length,t=0;t<u;t++)if(f=i._getDateFromFormat(r[t].day),f.getTime()==n.getTime())n.setDate(n.getDate()-1),this.model.includeWeekend===!1&&i._setBeforeWeekend(n);else return n;return n}return n},_onHoliDayCheck:function(n){var i=this,r=i.model.holidays,e=i.model.includeWeekend,t,u,f;if(isAutoSchedule&&r&&r.length&&!i.hasChildRecords){for(t=0,u=r.length,t=0;t<u;t++)if(f=i._getDateFromFormat(r[t].day),f.getTime()==n.getTime())n.setDate(n.getDate()+1),this.model.includeWeekend===!1&&(n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2));else return n;return n}return n},_getDurationValues:function(n,t){var f=0,e=this.model,i=e.durationUnit,u,o;return typeof n=="string"?(u=n.match(/(\d*\.*\d+|[A-z]+)/g),u&&u.length<=2&&(f=parseFloat(u[0]),i=u[1]?u[1].toLowerCase():"",i=this._durationUnitEditText.minute.indexOf(i)!=-1?r.Gantt.DurationUnit.Minute:this._durationUnitEditText.hour.indexOf(i)!=-1?r.Gantt.DurationUnit.Hour:this._durationUnitEditText.day.indexOf(i)!=-1?r.Gantt.DurationUnit.Day:e.durationUnit)):(f=n,i=e.durationUnit),isNaN(f)&&(f=t?this._editedDialogRecord.duration:0,i=t?this._editedDialogRecord.durationUnit:e.durationUnit),o={},o.duration=f,o.durationUnit=i,o},_editStartDateChange:function(t,i){var e=this,f=e._id,c=e.model,l=t.attr("id"),ft=this.model.holidays,it=t.attr("dialog"),et=c.selectionMode=="row"?this.selectedItem():c.updatedRecords[e._rowIndexOfLastSelectedCell],r=this._editedDialogRecord,rt=r.effortDriven=="true"?!0:!1,a,s,v,y,p,d,g,nt,tt,w,b;if(!this._editedDialogRecord.isUpdatedFromDialog){this._editedDialogRecord.isUpdatedFromDialog=!0;it==="Add"?(a="#"+f+"startDateAdd",s="#"+f+"endDateAdd",v="#"+f+"durationAdd",effortDrivenId="#"+f+"effortDrivenAdd",typeId="#"+f+"taskTypeAdd",workId="#"+f+"workAdd",y="#"+f+"baselineStartDateAdd",p="#"+f+"baselineEndDateAdd"):(a="#"+f+"startDateEdit",s="#"+f+"endDateEdit",v="#"+f+"durationEdit",effortDrivenId="#"+f+"effortDrivenEdit",typeId="#"+f+"taskTypeEdit",workId="#"+f+"workEdit");var h=n(a).val(),o=n(s).val(),k=n(v).val(),ut=n(workId).val();(l===f+"startDateEdit"||l===f+"startDateAdd")&&(h||(h=r?r.startDate:u));k||(k=r?r.duration:u);o||(o=r?r.endDate:u);l===f+"startDateEdit"||l===f+"startDateAdd"?(h=i.value?e._getDateFromFormat(i.value):h,h=e._checkStartDate(h,r),e.getFormatedDate(h)!=i.value&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",h):n(a).ejDatePicker("option","value",h)),nt=e._getEndDate(h,r.duration,r.durationUnit,r),r.startDate=h,r.endDate=nt,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",nt):n(s).ejDatePicker("option","value",nt)):l===f+"endDateEdit"||l===f+"endDateAdd"?(o=i.value?e._getDateFromFormat(i.value):o,o.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,o),o=this._checkEndDate(o,r),e.getFormatedDate(o)!=i.value&&(c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)),r.isMilestone&&(r.startDate=this._checkStartDate(r.startDate,r),e.getFormatedDate(r.startDate)!=h&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",r.startDate):n(a).ejDatePicker("option","value",r.startDate)),e._updateResourceRelatedFields(r),n(workId).ejNumericTextbox("option","value",r.work),n(v).val(e._getDurationStringValue(r))),r.startDate.getTime()<=o.getTime()?(r.endDate=o,r.duration=this._getDuration(r.startDate,o,r.durationUnit,r.isAutoSchedule),k=e._getDurationStringValue(r),n(v).val(k)):c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",r.endDate):n(s).ejDatePicker("option","value",r.endDate)):l===f+"durationEdit"||l===f+"durationAdd"?(tt=e._getDurationValues(k,!0),d=tt.duration,g=tt.durationUnit,(r.duration!=d||r.durationUnit!=g)&&(r.duration=d,r.durationUnit=g,r.isMilestone&&(r.startDate=this._checkStartDate(r.startDate,r),e.getFormatedDate(r.startDate)!=h&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",r.startDate):n(a).ejDatePicker("option","value",r.startDate))),o=this._getEndDate(r.startDate,d,g,r),r.endDate=o,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)),e._updateResourceRelatedFields(r),rt||n(workId).ejNumericTextbox("option","value",r.work),n(v).val(e._getDurationStringValue(r)),r.taskType=="fixedWork"&&e._updateResourceDataSource(r)):l===f+"workEdit"||l===f+"workAdd"?(r.work=parseInt(ut),e._updateResourceRelatedFields(r),r.taskType!="fixedDuration"&&r.isAutoSchedule?(n(v).val(e._getDurationStringValue(r)),o=this._getEndDate(r.startDate,r.duration,r.durationUnit,r),r.endDate=o,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)):e._updateResourceDataSource(r)):l===f+"baselineStartDateAdd"?n(p).length>0&&(w=e._getDateFromFormat(n(y).val()),b=e._getDateFromFormat(n(p).val()),w&&b&&w.getTime()>b.getTime()&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(y).ejDateTimePicker("option","value",i.prevDate):n(y).ejDatePicker("option","value",i.prevDate))):l===f+"baselineEndDateAdd"&&n(y).length>0&&(w=e._getDateFromFormat(n(y).val()),b=e._getDateFromFormat(n(p).val()),w&&b&&w.getTime()>b.getTime()&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(p).ejDateTimePicker("option","value",i.prevDate):n(p).ejDatePicker("option","value",i.prevDate)));this._editedDialogRecord.isUpdatedFromDialog=!1}},_taskNameCollection:function(){var i=this,t=i.model.flatRecords,r=[],n,u,f;for(idsCollection=[],i._preTableCollection=[],n=0;n<t.length;n++)u={id:t[n].taskId.toString(),text:t[n].taskId.toString()+"-"+t[n].taskName,value:t[n].taskId.toString()+"-"+t[n].taskName},f={id:t[n].taskId.toString()+"-"+t[n].taskName,text:t[n].taskId.toString(),value:t[n].taskId.toString()},r.push(u),idsCollection.push(f);i._preTableCollection.push(idsCollection);i._preTableCollection.push(r)},_idFromPredecessor:function(n){for(var u,i,r=n.split(","),f=[],t=0;t<r.length;t++){for(u=[],i=0;i<r[t].length;i++)if(isNaN(r[t].charAt(i)))break;else u.push(r[t].charAt(i));f.push(u.join(""))}return f},_preIdChangByName:function(){var i=this,r=n("#"+i._id+"PreEditForm");$targetTr=r.closest("tr");$val=r.find(".onEdit");var f=$val.val(),u=i._taskNameCollection(),t=n.map(u,function(n){if(n.text===$val.val())return n.id});t=t[0];$targetTr.find(".id").html(t)},_preEndEdit:function(t,i,u){var c=this,o=u.model.dataSource,f=u.model.selectedItem,l,s,h,e;c._taskNameCollection();u.value!==null&&(u.columnName==="name"||u.columnName==="id")&&(u.columnName==="name"&&u.value.length>0&&(l=u.value.split("-"),s=n.map(c._preTableCollection[1],function(n){if(n.id===l[0])return n.id}),s=s[0],f.id=s,f.name=u.value,e=o.indexOf(f.item),e===-1&&(o.push(f.item),e=o.indexOf(f.item)),o[e].id=s,o[e].name=u.value),u.columnName==="id"&&u.value.length>0&&(h=n.map(c._preTableCollection[0],function(n){if(n.value===u.value)return n.id}),h=h[0],f.name=h,f.id=s,e=o.indexOf(f.item),e===-1&&(o.push(f.item),e=o.indexOf(f.item)),o[e].name=h),f.type||r.isNullOrUndefined(e)||(f.type="Finish-Start",o[e].type="Finish-Start"),n(t).ejTreeGrid("refreshRow",u.model.selectedRowIndex),n(t).ejTreeGrid("selectRows",u.model.selectedRowIndex),c._enbleDisablePredecessorAddButton("enable",i))},_enableDisablePredecessorDelete:function(t){var i=this,r;r=t=="add"?n("#"+i._id+"AddDialog_PredecesorDelete"):n("#"+i._id+"EditDialog_PredecesorDelete");n(r).unbind("click",n.proxy(i._deletepredecessor,i)).bind("click",n.proxy(i._deletepredecessor,i));n(r).removeClass("e-disable").addClass("e-enable")},_enableDisableResouceDelete:function(t){var i=this,r;r=t=="add"?n("#"+i._id+"AddDialog_ResourceDelete"):n("#"+i._id+"EditDialog_ResourceDelete");n(r).unbind("click",n.proxy(i._deleteResource,i)).bind("click",n.proxy(i._deleteResource,i));n(r).removeClass("e-disable").addClass("e-enable")},_predecessorEditCollection:function(){var u=this,y=u.model,o,k,s,l=[],i,n,h,p,w,a,f,e,c,v,b;if(k="#"+u._id+"predecessor",s=u._predecessorCollectionText,l=[],i=y.selectedItem,u._taskNameCollection(),o=u._preTableCollection[1],!r.isNullOrUndefined(i)&&!r.isNullOrUndefined(i.predecessor)&&!r.isNullOrUndefined(i.item[y.predecessorMapping])){var t=i.predecessor,d=t.length,g=s.length,nt=o.length;for(n=0;n<d;n++)if(h=t[n].from,i.taskId.toString()!==h.toString()){for(a=0,f=0;f<nt;f++)if(o[f].id===h){p=o[f].value;break}for(e=0;e<g;e++)s[e].id==t[n].predecessorsType&&(w=s[e].text);c=t[n].offset!=1;v="";v+=t[n].offsetDurationUnit=="day"?c?this._durationUnitTexts.days:this._durationUnitTexts.day:t[n].offsetDurationUnit=="hour"?c?this._durationUnitTexts.hours:this._durationUnitTexts.hour:c?this._durationUnitTexts.minutes:this._durationUnitTexts.minute;a=t[n].offset+" "+v;b={id:h,name:p,type:w,offset:a};l.push(b)}}return l},_getResourceInfoIndex:function(n,t){var i=0,r=[];if(n&&t)for(i;i<n.length;i++)t[n[i]]&&r.push(n[i]);return r},_refreshEditForm:function(t){var i=this,vt=!1,ot,o=0,ii,f,p="165px",e=i.model,yt,s={},h,pt,nt,wt,d,b=e.selectionMode=="row"?e.selectedItem:e.updatedRecords[i._rowIndexOfLastSelectedCell],g,bt,kt,ft,dt,st,l,c,ht,gt,it,ni,lt,w,k,ct,y,v,ti;if(t.requestType=="add"){var ui=document.getElementById(i._id+"AddTab"),ri=n("#"+i._id+"_dialogAdd_wrapper"),ii=document.getElementById(i._id+"GeneralAddForm"),d="#treegrid"+i._id+"predecessorAdd",tt="#"+i._id+"AddAreaNotes",rt="#treegrid"+i._id+"resourceAdd",ut="#treegrid"+i._id+"customFieldAdd";!r.isNullOrUndefined(e.dataSource)&&e.dataSource.length==0&&e.predecessorMapping&&n(d).length>0?(g=[],g[0]=i._dialogTab.indexOf("Predecessors"),n("#"+i._id+"AddTab").ejTab("option","disabledItemIndex",g)):(g=[],g[0]=i._dialogTab.indexOf("Predecessors"),n("#"+i._id+"AddTab").ejTab("option","enabledItemIndex",g),n("#"+i._id+"AddTab").find("div.e-content").css("overflow","visible"));nt=i.model.flatRecords.length;nt=i._getNewTaskId(nt);i.model.enableWBS&&(bt=e.editSettings.rowPosition.toLowerCase(),kt=i._getNewWBSid(bt))}else{var ui=document.getElementById(i._id+"EditTab"),ri=n("#"+i._id+"_dialogEdit_wrapper"),ii=document.getElementById(i._id+"GeneralEditForm"),d="#treegrid"+i._id+"predecessorEdit",tt="#"+i._id+"EditAreaNotes",rt="#treegrid"+i._id+"resourceEdit",ut="#treegrid"+i._id+"customFieldEdit";e.flatRecords.length<=2&&e.parentRecords.length==1&&e.predecessorMapping&&n(d).length>0&&n("#"+i._id+"EditTab").ejTab("removeItem",1)}for(ot=n(ii).find("input,select"),k=ot.length,o;o<k;o++){if(f=ot.eq(o),s={},p=180,h=r.TreeGrid.getColumnByField(i._columns,f.prop("name")),h)v=t.data[h.field];else continue;if(f.hasClass("e-numerictextbox"))yt=p,s.width=yt,s.showSpinButton=!0,s.cssClass=e.cssClass,l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&(l=="statusEdit"||l=="workEdit")&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),(l=="statusEdit"||l=="statusAdd")&&(s.maxValue=100,s.minValue=0),l=="workEdit"&&(s.change=function(){i._updatedColumn="work";i._editStartDateChange(n(this.element[0]))}),s.value=v&&v.toString().length?parseFloat(v):0,r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejNumericTextbox(s),f.prop("name",f.prop("name").replace(i._id,""));else if(f.hasClass("e-datepicker"))s.width=p,s.cssClass=e.cssClass,s.dateFormat=e.dateFormat,s.locale=e.locale,s.startDay=e.scheduleHeaderSettings.weekStartDay,s.change=function(n){this.option("value",n.value);i._updatedColumn=this.element[0].name;i._editStartDateChange(this.element,n)},l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&b.isAutoSchedule&&(l=="startDateEdit"||l=="endDateEdit")&&t.requestType!=="add"&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),s.value=v&&v.toString().length?i._getDateFromFormat(v.toString()):i._getDateFromFormat(e.scheduleStartDate),h.format!==u&&h.format.length>0&&(pt=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),wt=pt.exec(h.format),s.dateFormat=wt[2],s.value=r.format(new Date(s.value),s.dateFormat,s.locale),f.val(s.value)),r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejDatePicker(s);else if(f.hasClass("e-datetimepicker"))s={width:p,rtl:e.rtl,locale:e.locale,cssClass:e.css,dateTimeFormat:e.dateFormat,startDay:e.scheduleHeaderSettings.weekStartDay},s.change=function(n){i._updatedColumn=this.element[0].name;this.option("value",n.value);this._prevDateTimeVal&&i._editStartDateChange(this.element,n)},l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&b.isAutoSchedule&&b.isAutoSchedule&&(l=="startDate"||l=="endDate")&&t.requestType!=="add"&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),s.value=v&&v.toString().length?i._getDateFromFormat(v.toString()):i._getDateFromFormat(e.scheduleStartDate),r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejDateTimePicker(s);else if(f.hasClass("e-dropdownlist"))ft=h.dropdownData,h.field==="resourceInfo"?f.ejDropDownList({cssClass:e.cssClass,width:p,showCheckbox:!0,dataSource:ft,fields:{id:e.resourceIdMapping,text:e.resourceNameMapping,value:e.resourceNameMapping},selectedItems:t.requestType=="add"?i._getResourceInfoIndex(t.data.resourceInfo,e.resources):i.getIndexofresourceInfo(ft,t.data)}):(c={},c.cssClass=e.cssClass,c.width=p,c.dataSource=ft,c.value=v,c.change=function(){i._updateEditDialogFields(this)},r.isNullOrUndefined(h.editParams)||n.extend(c,h.editParams),f.val.length&&(h.field=="taskMode"?(v=t.requestType=="beginedit"?!t.data.isAutoSchedule:e.taskSchedulingMode=="manual"?!0:!1,c.value=v.toString()):h.field=="taskType"?c.value=t.requestType=="beginedit"?t.data.taskType:i.model.taskType:h.field=="effortDriven"&&(c.value=t.requestType=="beginedit"?t.data.effortDriven:e.taskType=="fixedWork"?!0:!1)),t.requestType!="beginedit"||t.data.isAutoSchedule||h.field!="taskType"&&h.field!="effortDriven"||(c.enabled=!1),t.data.taskType=="fixedWork"&&h.field=="effortDriven"&&(c.enabled=!1),t.requestType=="add"&&h.field=="effortDriven"&&e.taskType=="fixedWork"&&(c.enabled=!1),(h.field=="taskType"||h.field=="effortDriven")&&t.data.hasChildRecords&&(c.enabled=!1),h.field=="taskMode"&&e.taskSchedulingMode!=r.Gantt.TaskSchedulingMode.Custom&&(c.enabled=!1),f.val(c.value),f.ejDropDownList(c),dt=f.ejDropDownList("instance"),dt._setValue(f.val()));else if(f.hasClass("e-maskedit"))c={},c.locale=e.locale,c.cssClass=e.cssClass,c.width=p,r.isNullOrUndefined(h.editParams)||n.extend(c,h.editParams),f.ejMaskEdit(c);else switch(f.prop("tagName")){case"INPUT":f.attr("type")!="checkbox"?(f.attr("name")==="taskId"?t.requestType!=="add"?(f.attr("readonly","readonly"),f.css("opacity",.5),f.val(t.data.taskId)):t.requestType==="add"&&(t.data.taskId==""||r.isNullOrUndefined(t.data.taskId)?f.val(nt):f.val(t.data.taskId)):f.attr("name")==="taskName"?t.requestType==="add"?t.data.taskName==""||r.isNullOrUndefined(t.data.taskName)?f.val(i._newTaskTexts.newTaskName+" "+nt):f.val(t.data.taskName):f.val(t.data.taskName):f.attr("name")==="duration"?(t.data&&f.val(i._getDurationStringValue(t.data)),st=i._getDurationValues(t.data),t.requestType!=="add"&&t.data.hasChildRecords&&t.data.isAutoSchedule?(f.attr("readonly","readonly"),f.css("opacity",.5)):t.requestType=="add"&&t.data.duration==""?f.val("0 "+i._durationUnitTexts[st.durationUnit]):f.val(t.data.duration+" "+i._durationUnitTexts[st.durationUnit]),f.change(function(){i._updatedColumn="duration";i._editStartDateChange(n(this))}),f.keyup(function(t){t.keyCode==13&&i._editStartDateChange(n(this))})):f.attr("name")==="WBS"?t.requestType!=="add"?(f.attr("readonly","readonly").css("opacity",.5),f.val(t.data.WBS)):t.requestType==="add"&&(f.val(kt),f.attr("readonly","readonly").css("opacity",.5)):f.attr("name")==="WBSPredecessor"&&f.attr("readonly","readonly").css("opacity",.5),f.attr("name")==="taskName"&&(p=380),l=f[0].id,l=l.replace(i._id,""),f.css("text-align",f.attr("name")!=null&&r.TreeGrid.getColumnByField(i._columns,f.prop("name"))!=null?r.TreeGrid.getColumnByField(i._columns,f.attr("name")).textAlign:"center"),f.outerWidth(p)):(c={},c.cssClass=e.cssClass,c.size="medium",r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejCheckBox(c));break;case"SELECT":f.width(p).height(23)}f.is(":disabled")||vt||f.is(":hidden")&&typeof f.data("ejDropDownList")!="object"||i._isEnterKeyPressed||(i._focusElements(f.closest("td")),vt=!0)}if(e.predecessorMapping&&n(d).length&&(ht=[],t.requestType!=="add"&&(ht=i._predecessorEditCollection()),i._taskNameCollection(),gt=i._predecessorCollectionText,n(d).ejTreeGrid({dataSource:ht,allowSorting:!1,columns:[{headerText:i._columnHeaderTexts.taskId,field:"id",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:i._preTableCollection[0],width:"89px"},{headerText:i._columnHeaderTexts.taskName,field:"name",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:i._preTableCollection[1],width:"300px"},{headerText:i._columnHeaderTexts.type,field:"type",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:gt,width:"141px"},{headerText:i._columnHeaderTexts.offset,field:"offset",editType:r.TreeGrid.EditingType.String,width:"88px"}],enableAltRow:!1,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",rowPosition:"bottom",beginEditAction:r.TreeGrid.BeginEditAction.Click},locale:e.locale,endEdit:n.proxy(i._preEndEdit,i,d,t.requestType),beginEdit:n.proxy(i._preBeginEdit,i),rowSelected:n.proxy(i._enableDisablePredecessorDelete,i,t.requestType),actionComplete:function(n){n.requestType=="delete"&&(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._disablePredecessorAddButton(d,t.requestType))},treeColumnIndex:5,predecessorTable:i._isFromGantt,sizeSettings:{width:"620px",height:"198px"},isResponsive:!1}),e.selectedItem&&e.selectedItem.hasChildRecords&&t.requestType!=="add"?(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._enbleDisablePredecessorAddButton("disable",t.requestType)):(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._enbleDisablePredecessorAddButton("enable",t.requestType))),e.resourceInfoMapping&&n(rt).length){if(it=[],ct=n.extend(!0,[],e.resources),t.requestType!="add")for(w=t.data.resourceInfo,k=w?w.length:0,o=0;o<k;o++)it.push({name:w[o][e.resourceIdMapping],unit:w[o][e.resourceUnitMapping]});else if(t.data.resourceInfo.length!=0)for(ganttRecord=new r.Gantt.GanttRecord,ganttRecord.item=t.data,ni=e.resources,lt=t.data.resourceInfo,ganttRecord.resourceInfo=lt&&ganttRecord._setResourceInfo(lt,e.resourceIdMapping,e.resourceNameMapping,e.resourceUnitMapping,ni),w=ganttRecord.resourceInfo,k=w?w.length:0,o=0;o<k;o++)it.push({name:w[o][e.resourceIdMapping],unit:w[o][e.resourceUnitMapping]});ct=n.extend(!0,[],e.resources);n(rt).ejTreeGrid({dataSource:it,columns:[{headerText:i._columnHeaderTexts.resourceInfo,field:"name",width:"309px",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:ct,editParams:{fields:{text:e.resourceNameMapping,value:e.resourceIdMapping}}},{headerText:i._columnHeaderTexts.unit,field:"unit",width:"309px",editType:r.TreeGrid.EditingType.Numeric,visible:!0,headerTextAlign:"center"}],enableAltRow:!1,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",beginEditAction:r.TreeGrid.BeginEditAction.Click},locale:e.locale,endEdit:n.proxy(i._resourceEndEdit,i,rt,t.requestType),beginEdit:n.proxy(i._resourceBeginEdit,i,rt),rowSelected:n.proxy(i._enableDisableResouceDelete,i,t.requestType),actionBegin:function(t){(t.requestType=="delete"||t.requestType=="sorting")&&(this.model.columns[0].dropdownData=n.extend(!0,[],i.model.resources))},actionComplete:function(n){n.requestType=="delete"&&(i._enableDisableResourceAddButton(n,!0,t.requestType),i.enbleDisableDeleteResourceButton("disable",t.requestType))},treeColumnIndex:3,resourceTable:i._isFromGantt,sizeSettings:{width:"620px",height:"198px"},isResponsive:!1});t.requestType!=="add"&&it.length==e.resources.length?(i.enbleDisableDeleteResourceButton("enable",t.requestType),i.enbleDisableAddResourceButton("disable",t.requestType)):(i.enbleDisableDeleteResourceButton("disable",t.requestType),i.enbleDisableAddResourceButton("enable",t.requestType))}if(n(ut).length){if(t.requestType=="add"){var a=i._addDialogCustomColumns,at=[],et=0,k=a.length;for(o=0;o<k;o++)et++,y={},y.id=et,y.field=a[o].field,y.headerText=a[o].headerText,y.value=t.data[a[o].field],y.text=t.data[a[o].field],y.editType=a[o].editType?a[o].editType.toLowerCase():"stringedit",at.push(y)}else{var a=i._editDialogCustomColumns,at=[],et=0,k=a.length;for(o=0;o<k;o++)et++,y={},y.id=et,y.field=a[o].field,y.headerText=a[o].headerText,y.value=t.data[a[o].field],y.editType=a[o].editType?a[o].editType.toLowerCase():"stringedit",y.text=a[o].editType.toLowerCase()=="dropdownedit"?r.isNullOrUndefined(t.data[a[o].field])?"":i._getDropDownText(a[o],t.data[a[o].field]):t.data[a[o].field],at.push(y)}n(ut).ejTreeGrid({dataSource:at,allowSorting:!1,locale:e.locale,enableAltRow:!1,rowHeight:30,columns:[{headerText:i._columnHeaderTexts.dialogCustomFieldName,field:"headerText",allowEditing:!1},{headerText:"Original Value",field:"value",visible:!1},{headerText:"Field",field:"field",visible:!1},{headerText:i._columnHeaderTexts.dialogCustomFieldValue,field:"text",editTemplate:{create:function(){return"<input style='width:100%;'>"},read:n.proxy(i._customColumnRead,i,ut),write:n.proxy(i._customColumnWrite,i,a,ut)}}],allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",beginEditAction:r.TreeGrid.BeginEditAction.Click},sizeSettings:{width:"620px",height:"234px"},isResponsive:!1})}e.notesMapping&&n(tt).length&&(t.requestType=="add"?v=t.data.notes:(ti=t.data.item[e.notesMapping],v=ti),n(tt).ejRTE({width:"620px",isResponsive:!1,height:"281px",value:v,locale:e.locale,tools:{font:["fontName","fontSize","fontColor","backgroundColor"],style:["bold","italic","underline","strikethrough"],alignment:["justifyLeft","justifyCenter","justifyRight","justifyFull"],doAction:["undo","redo"],indenting:[],clear:[],links:["createLink","removeLink"],images:[],media:[],tables:[],lists:["unorderedList"],clipboard:[],edit:[],formatStyle:[],view:[]}}),n(tt+"_wrapper").find(".e-toolbar.e-toolbarspan").css("border-bottom","none"),n(tt+"_editor").height("208"),n(tt+"_Iframe")[0].style.height="203px",n(ri).removeClass("e-rte"))},_enbleDisablePredecessorDeleteButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_PredecesorDelete"):n("#"+r._id+"EditDialog_PredecesorDelete");t==="enable"?(n(u).unbind("click",n.proxy(r._deletepredecessor,r)).bind("click",n.proxy(r._deletepredecessor,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._deletepredecessor,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_enbleDisablePredecessorAddButton:function(t,i){var r=this,u="";u=i=="add"?n("#"+r._id+"AddDialog_PredecesorAdd"):n("#"+r._id+"EditDialog_PredecesorAdd");t==="enable"?(n(u).unbind("click",n.proxy(r._addpredecessor,r)).bind("click",n.proxy(r._addpredecessor,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._addpredecessor,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_disablePredecessorAddButton:function(t,i){var f=this,e=n(t+"e-table"),o=!1,s=e[0].rows.length,r,u;for(f._enbleDisablePredecessorAddButton("disable",i),r=0;r<s;r++)u=e[0].rows[r],u.cells.length===4&&u.cells[1].innerText===""&&(o=!0);o||f._enbleDisablePredecessorAddButton("enable",i)},_updateEditDialogFields:function(t){var f=this,e=n(t.element).attr("dialog"),i,u;e=="Add"?(i=n("#"+f._id+"effortDrivenAdd").data("ejDropDownList"),u=n("#"+f._id+"taskTypeAdd").data("ejDropDownList")):(i=n("#"+f._id+"effortDrivenEdit").data("ejDropDownList"),u=n("#"+f._id+"taskTypeEdit").data("ejDropDownList"));r.isNullOrUndefined(i)||t._name!="taskType"||(t.model.value=="fixedWork"?(i.selectItemByValue("true"),i.disable()):i.enable(),f._editedDialogRecord[t._name]=t.model.value);t._name=="taskMode"&&(t.model.text=="Auto"&&(r.isNullOrUndefined(i)||r.isNullOrUndefined(u)||u.model.value=="fixedWork"||i.enable(),r.isNullOrUndefined(u)||u.enable(),f._editedDialogRecord.isAutoSchedule=!0),t.model.text=="Manual"&&(r.isNullOrUndefined(i)||i.disable(),r.isNullOrUndefined(u)||u.disable(),f._editedDialogRecord.isAutoSchedule=!1))},_customColumnWrite:function(t,i,r){var e=this,o=r.rowdata!==u?r.rowdata.text:"",s=n(i).ejTreeGrid("instance").model,h=t[s.selectedRowIndex],f={},c,l;h.editParams&&(f=n.extend(!0,{},h.editParams));f.value=o;f.locale=e.model.locale;switch(r.rowdata.editType.toLowerCase()){case"numericedit":f.height="25px";r.element.ejNumericTextbox(f);break;case"stringedit":n(r.element).val(o).css({padding:"0px",border:"0px",height:"25px"}).addClass("e-ejinputtext");break;case"datepicker":f.width="100%";f.height="25px";f.startDay=e.model.scheduleHeaderSettings.weekStartDay;r.element.ejDatePicker(f);break;case"datetimepicker":f.width="100%";f.height="25px";f.startDay=e.model.scheduleHeaderSettings.weekStartDay;r.element.ejDateTimePicker(f);break;case"maskedit":f.width="100%";f.height="25px";r.element.ejMaskEdit(f);break;case"dropdownedit":f.width="100%";f.height="25px";f.dataSource=h.dropdownData;f.value=s.currentViewData[s.selectedRowIndex].value;r.element.ejDropDownList(f);break;case"booleanedit":f.cssClass=model.cssClass;f.size="small";f.checked=o;r.element.ejCheckBox(f);c=r.element.parent(".e-chkbox-wrap");l=c.parent("form");l.length>0?l.css("margin-left","45%"):c.css("margin-left","45%")}},_customColumnRead:function(t,i){var u,r,f=n(t).ejTreeGrid("instance"),e=f.model.selectedRowIndex,o=f.model.updatedRecords;return n(i).blur(),n(i).focusout(),n(i[0]).hasClass("e-numerictextbox")?u=r=n(i).ejNumericTextbox("getValue"):n(i[0]).hasClass("e-datepicker")?u=r=n(i).ejDatePicker("getValue"):n(i[0]).hasClass("e-datepicker")?u=r=n(i).ejDatePicker("getValue"):n(i[0]).hasClass("e-dattimeepicker")?u=r=n(i).ejDateTimePicker("getValue"):n(i[0]).hasClass("e-maskedit")?u=r=n(i[0]).ejMaskEdit("model.value"):n(i[0]).hasClass("e-dropdownlist")?(r=n(i[0]).ejDropDownList("model.text"),u=n(i[0]).ejDropDownList("getSelectedValue")):u=n(i[0]).hasClass("e-checkbox")?r=n(i[0]).ejCheckBox("isChecked"):r=n(i).val(),o[e].value=u,o[e].text=r,f.refreshRow(e),r},_enableDisableResourceAddButton:function(t,i,r){var u=this,f=t.model.dataSource,e=!1,o;u.enbleDisableAddResourceButton("disable",r);i&&(o=n.map(f,function(n,t){if(n.name==""||n.name==null)return t}),o.length>0&&f.length>0&&(e=!0),e||u.enbleDisableAddResourceButton("enable",r))},_addpredecessor:function(t){var i=this,f,r,u;n(t.target).hasClass("e-edit-dialog")?(f="#treegrid"+i._id+"predecessorEdit",u="edit"):(f="#treegrid"+i._id+"predecessorAdd",u="add");i._enbleDisablePredecessorAddButton("disable",u);r=n(f).ejTreeGrid("instance");r.addRow({id:"",name:"",type:"Finish-Start",offset:"0"});r.clearSelection(r.model.selectedRowIndex);i._enbleDisablePredecessorDeleteButton("disable",u)},_deletepredecessor:function(t){var u=this,i,f,e,o;n(t.target).hasClass("e-edit-dialog")?(i="#treegrid"+u._id+"predecessorEdit",f="edit"):(i="#treegrid"+u._id+"predecessorAdd",f="add");e=n(i).ejTreeGrid("option","selectedRowIndex");o={};o.requestType=r.TreeGrid.Actions.Delete;e!==-1&&(n(i).ejTreeGrid("deleteRow"),u._enbleDisablePredecessorDeleteButton("disable",f));u._disablePredecessorAddButton(i,f)},enbleDisableDeleteResourceButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_ResourceDelete"):n("#"+r._id+"EditDialog_ResourceDelete");t==="enable"?(n(u).unbind("click",n.proxy(r._deleteResource,r)).bind("click",n.proxy(r._deleteResource,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._deleteResource,r)),n(u).addClass("e-disable").removeClass("e-enable"))},enbleDisableAddResourceButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_ResourceAdd"):n("#"+r._id+"EditDialog_ResourceAdd");t==="enable"?(n(u).unbind("click",n.proxy(r._addResource,r)).bind("click",n.proxy(r._addResource,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._addResource,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_addResource:function(t){var i=this,f,r,u;n(t.target).hasClass("e-edit-dialog")?(u="edit",f="#treegrid"+i._id+"resourceEdit"):(u="add",f="#treegrid"+i._id+"resourceAdd");i.enbleDisableAddResourceButton("disable",u);r=n(f).ejTreeGrid("instance");r.clearSelection(r.model.selectedRowIndex);r.addRow({name:"",unit:"100"},"bottom");i.enbleDisableDeleteResourceButton("disable",u)},_deleteResource:function(t){var u=this,i,f,e;i=n(t.target).hasClass("e-edit-dialog")?"#treegrid"+u._id+"resourceEdit":"#treegrid"+u._id+"resourceAdd";f=n(i).ejTreeGrid("option","selectedRowIndex");e={};e.requestType=r.TreeGrid.Actions.Delete;f!==-1&&n(i).ejTreeGrid("deleteRow")},_resourceEndEdit:function(t,i,r){var u=this,f=r.model.columns;f[0].dropdownData=n.extend(!0,[],u.model.resources);enableResourceAdd=r.model.dataSource.length<u.model.resources.length;u._enableDisableResourceAddButton(r,enableResourceAdd,i)},_resourceBeginEdit:function(t,i){for(var o,s=this,h=s.model.resourceIdMapping,f=i.model,c=f.columns,e=c[0].dropdownData,u=f.dataSource,l=u.length,a=i.data.item.name,r=0;r<l;r++)u[r].name!=""&&u[r].name!=null&&a!=u[r].name&&(o=n.map(e,function(n,t){if(n[h].toString()==u[r].name)return t}),e.splice(o[0],1))},getColumnIndexByField:function(n){var r=this,i=r.model.columns,u=i.length,t=0;for(t;t<u;t++)if(i[t].field==n)break;return t},getIndexofresourceInfo:function(n,t){var r=t.resourceInfo,i=0,f=r?r.length:0,u=[];for(i;i<f;i++)n.indexOf(r[i])!=-1&&u.push(n.indexOf(r[i]));return u},_focusElements:function(n){if(n.length){n.focus();var t=n.children();t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t.find(".e-ddl").focus():t.find("input,select").select().focus()}},renderDiaglogButton:function(n,t){var e,i=this,u=i.model,o,l,a,s,v,h,f,c;return e=n=="edit"?"EditDialog_":"AddDialog_",o=r.buildTag("input","",{"border-radius":"3px","min-width":"70px"},{type:"button",id:e+i._id+"_Save"}),l=n=="edit"?i._editDialogTexts.saveButton:i._editDialogTexts.addButton,o.ejButton({cssClass:u.cssClass,text:l,width:"auto"}),a=i._editDialogTexts.cancelButton,s=r.buildTag("input","",{"margin-left":"18px","border-radius":"3px","min-width":"70px"},{type:"button",id:e+i._id+"_Cancel"}),s.ejButton({cssClass:u.cssClass,text:a,width:"auto"}),v=i._editDialogTexts.deleteButton,h=r.buildTag("input","",{"border-radius":"3px","min-width":"90px"},{type:"button",id:"EditDialog_"+i._id+"_Delete"}),h.ejButton({cssClass:u.cssClass,text:v,width:"auto"}),f=r.buildTag("div","",{float:"right","z-index":"10"},{"class":"e-editform-btn e-editfrom-btn-right"}),c=r.buildTag("div","",{float:"left","z-index":"10"},{"class":"e-editform-btn e-editfrom-btn-left"}),f.append(o),n=="edit"&&u.editSettings.allowDeleting&&c.append(h),f.append(s),f.appendTo(t),c.appendTo(t),t},_renderToolBar:function(){var t=this,f=t.model,u=r.buildTag("div.e-gantttoolbar#e-gantttoolbar"+t._id,"",{height:"50px"},{id:t._id+"_toolbarItems"}),e,o,s,h,i;return!r.isNullOrUndefined(f.toolbarSettings.toolbarItems)&&f.toolbarSettings.toolbarItems.length&&(e=r.buildTag("ul","",{},{}),t._renderLi(e),u.append(e)),!r.isNullOrUndefined(f.toolbarSettings.customToolbarItems)&&f.toolbarSettings.customToolbarItems.length&&(o=r.buildTag("ul","",{},{}),t._renderCustomLi(o),u.append(o)),f.toolbarSettings.toolbarItems.indexOf(r.Gantt.ToolbarItems.Search)!=-1&&(s=r.buildTag("ul.e-gantt-search-container","",{float:"right"},{}),h=r.buildTag("li","",{},{id:t._id+"_"+r.Gantt.ToolbarItems.Search,tabindex:"0"}),t._renderLiContent(h,r.Gantt.ToolbarItems.Search),s.append(h),u.append(s)),i={},i.click=t._toolBarClick,i.cssClass="",i.rtl=!1,i.itemSeparator=!1,i.width=t._ganttWidth,i.fields={id:"",tooltipText:"",imageUrl:"",text:"",imageAttributes:"",spriteCSS:"",htmlAttributes:""},u.ejToolbar(i),u.ejToolbar("disableItem",t._disabledToolItems),t._disabledToolItems=n(),u},_renderCustomLi:function(t){for(var e,o=this,h=o.model,f,s,u=h.toolbarSettings.customToolbarItems,i=0;i<u.length;i++)(u[i].text||u[i].templateID)&&(u[i].text?(e=u[i].tooltipText?u[i].tooltipText:u[i].text,f=r.buildTag("li","",{},{id:o._id+"_"+u[i].text,title:e}),s=r.buildTag("a.e-toolbaricons e-icon e-ganttcustomtoolbaritem","",{}).addClass(u[i].text),f.addClass("e-gantttoolbaritem")):(e=u[i].tooltipText?u[i].tooltipText:u[i].templateID.replace("#",""),f=r.buildTag("li","",{},{id:o._id+"_"+u[i].templateID.replace("#",""),title:e}),s=n(u[i].templateID).hide().html()),f.html(s),t.append(f))},_renderLi:function(n){var f=this,i=f.model.toolbarSettings.toolbarItems,e=i.length,t=0,u;for(t;t<e;t++)u=r.buildTag("li","",{},{id:f._id+"_"+i[t],tabindex:"0"}),i[t]!=="search"&&(u.addClass("e-gantttoolbaritem"),f._renderLiContent(u,i[t]),n.append(u))},_renderLiContent:function(t,i){var f,u,e=this.selectedRowIndex(),tt=this.model.editSettings,s,h,c,l,a,v,y,p,w,b,k,d,o,g,nt;switch(i){case"add":f=r.buildTag("a.e-addnewitem e-toolbaricons e-icon e-gantt-add","",{});s=this._toolboxTooltipTexts.addTool;t.attr("title",s);this.model.readOnly!=!0&&this.model.editSettings.allowAdding||this._disabledToolItems.push(t.get(0));break;case"edit":f=r.buildTag("a.e-edititem e-toolbaricons e-icon e-gantt-edit","",{});h=this._toolboxTooltipTexts.editTool;t.attr("title",h);this.model.readOnly!=!0&&this.model.editSettings.allowEditing&&e!=-1&&this.model.editSettings.beginEditAction!="click"||this._disabledToolItems.push(t.get(0));break;case"delete":c=this._toolboxTooltipTexts.deleteTool;t.attr("title",c);f=r.buildTag("a.e-deleteitem e-toolbaricons e-icon e-gantt-delete","",{});this.model.readOnly!=!0&&this.model.editSettings.allowDeleting&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"update":l=this._toolboxTooltipTexts.saveTool;t.attr("title",l);f=r.buildTag("a.e-saveitem e-toolbaricons e-icon e-gantt-save e-disabletool","",{});this._disabledToolItems.push(t.get(0));break;case"cancel":a=this._toolboxTooltipTexts.cancelTool;t.attr("title",a);f=r.buildTag("a.e-cancel e-toolbaricons e-icon e-gantt-cancel e-disabletool","",{});this._disabledToolItems.push(t.get(0));break;case"indent":v=this._toolboxTooltipTexts.indentTool;t.attr("title",v);u=r.buildTag("a.e-indent e-toolbaricons e-icon e-disabletool e-gantt-indent","",{},{});t.append(u);this.model.readOnly!=!0&&this.model.editSettings.allowIndent&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"outdent":y=this._toolboxTooltipTexts.outdentTool;t.attr("title",y);u=r.buildTag("a.e-outdent e-toolbaricons e-icon e-disabletool e-gantt-outdent","",{},{});t.append(u);this.model.readOnly!=!0&&this.model.editSettings.allowIndent&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"expandAll":p=this._toolboxTooltipTexts.expandAllTool;t.attr("title",p);u=r.buildTag("a.e-expandall e-toolbaricons e-icon e-gantt-expandall","",{},{});t.append(u);break;case"collapseAll":w=this._toolboxTooltipTexts.collapseAllTool;t.attr("title",w);u=r.buildTag("a.e-collapseall e-toolbaricons e-icon e-gantt-collapseall","",{},{});t.append(u);break;case"prevTimeSpan":b=this._toolboxTooltipTexts.prevTimeSpanTool;t.attr("title",b);u=r.buildTag("a.e-prevtimespan e-toolbaricons e-icon e-gantt-prevtimespan","",{},{});t.append(u);break;case"nextTimeSpan":k=this._toolboxTooltipTexts.nextTimeSpanTool;t.attr("title",k);u=r.buildTag("a.e-nexttimespan e-toolbaricons e-icon e-gantt-nexttimespan","",{},{});t.append(u);break;case"criticalPath":d=this._toolboxTooltipTexts.criticalPathTool;t.attr("title",d);u=r.buildTag("a.e-criticaltask e-toolbaricons e-icon e-gantt-criticaltask","",{},{});t.append(u);break;case"search":o=this._toolboxTooltipTexts.searchTool;u=r.buildTag("input.e-ejinputtext","",{margin:"4px","text-indent":"4px"},{type:"text",placeholder:o},{color:"#E8E9E9"});t.css({float:"right",padding:"2px"});t.attr("title",o);t.addClass("e-search");t.append(u);this.model.allowSearching=!0;u.keydown(n.proxy(this._keyDown,this));break;case"excelExport":g=this._toolboxTooltipTexts.excelExportTool;t.attr("title",g);u=r.buildTag("a.e-excelIcon e-toolbaricons e-icon e-gantt-excelexport","",{},{});t.append(u);break;case"pdfExport":nt=this._toolboxTooltipTexts.pdfExportTool;t.attr("title",nt);u=r.buildTag("a.e-pdfIcon e-toolbaricons e-icon","",{},{});t.append(u)}t.append(f)},_keyDown:function(n){if(n.which===13)return this._toolbarOperation(this._id+"_search",n.currentTarget.value),n.preventDefault(),!1},_updateToolbarOptions:function(){var v=this,e=v.model,o=e.editSettings,i=n("#"+v._id+"_toolbarItems"),f=n(i).find(".e-addnewitem").parent()[0],r=n(i).find(".e-edititem").parent()[0],u=n(i).find(".e-deleteitem").parent()[0],s=n(i).find(".e-indent").parent()[0],h=n(i).find(".e-outdent").parent()[0],c=n(i).find(".e-saveitem").parent()[0],l=n(i).find(".e-cancel").parent()[0],t=[],a=[];e.readOnly==!0?(f&&t.push(n(f)),r&&t.push(n(r)),u&&t.push(n(u)),s&&t.push(n(s)),h&&t.push(n(h)),c&&t.push(n(c)),l&&t.push(n(l)),n(i).ejToolbar("disableItem",t)):(o.allowAdding?f&&a.push(f):f&&t.push(n(f)),e.selectedItem?(o.allowEditing&&e.editSettings.beginEditAction!="click"?r&&a.push(r):r&&t.push(n(r)),o.allowDeleting?u&&a.push(u):u&&t.push(n(u)),v.updateIndentOutdentOption(e.selectedItem)):(o.allowEditing&&r&&t.push(n(r)),o.allowDeleting&&u&&t.push(n(u)),c&&c&&t.push(n(c)),l&&l&&t.push(n(l)),s&&s&&t.push(n(s)),h&&h&&t.push(n(h))),n(i).ejToolbar("disableItem",t),n(i).ejToolbar("enableItem",a))},_renderGantt:function(){var i=this,a=i.model,t,c,u=parseInt(i._ganttWidth),e=i.splitterPosition(),s=!1,l=a.splitterSettings.index,h,o,f;if(e||(e=i._splitterPosition(),i.splitterPosition(e)),e||l>-1){if(e)typeof e=="string"&&e.indexOf("%")!=-1?(t=parseInt(e),s=!0):(t=parseInt(e)/u*100,s=!1);else{for(h=i.getColumns(),o=0,columnIndex=l,columnIndex>=h.length&&(columnIndex=h.length-1),f=0;f<=columnIndex;f++)o+=h[f].width;if(o<=u)t=parseInt(o)/u*100,l=f-1;else for(o=0,f=0;f<=columnIndex;f++)if(o+h[f].width<=u)o+=h[f].width,l=f;else{t=parseInt(o)/u*100;break}a.splitterSettings.index=l}(isNaN(t)||t<0)&&(t=0);t>100&&(t=(2*i._commonColumnWidth+3)/u*100,t=t<30?t:30,s=!0)}else t=(2*i._commonColumnWidth+3)/u*100,t=t<30?t:30,s=!0;c=100-t-900/u;c<=0?(s?i.splitterPosition("100%"):i.splitterPosition(u.toString()),t=100-900/u,c=0):c>0&&(s?i.splitterPosition(Math.round(t)+"%"):i.splitterPosition(Math.round(t*u/100).toString()));i._splitterPosition(i.splitterPosition());n("#e-ejSpliter"+i._id).ejSplitter({height:i._ganttHeight,width:u,orientation:r.Orientation.Horizontal,properties:[{paneSize:t+"%",collapsible:!1},{paneSize:c+"%",collapsible:!1}],enableAutoResize:!1,resize:n.proxy(i._onResize,i)})},_renderTreeGrid:function(){var i=this,t=i.model;i._$treegridHelper=n("#ejTreeGrid"+i._id).ejTreeGrid({enableAltRow:t.enableAltRow,allowColumnResize:t.allowColumnResize,enableVirtualization:t.enableVirtualization,allowSorting:t.allowSorting,showColumnChooser:t.showColumnChooser,showColumnOptions:t.showColumnOptions,allowMultiSorting:t.allowMultiSorting,sortSettings:t.sortSettings,allowSelection:t.allowSelection,selectionType:t.selectionMode=="cell"?t.selectionType:"single",selectionMode:t.selectionMode,selectedRowIndex:this.selectedRowIndex(),allowDragAndDrop:t.allowDragAndDrop,dragTooltip:t.dragTooltip,allowSearching:t.allowSearching,parentIdMapping:t.parentTaskIdMapping,baselineStartDateMapping:t.baselineStartDateMapping,baselineEndDateMapping:t.baselineEndDateMapping,allowKeyboardNavigation:t.allowKeyboardNavigation,cssClass:t.cssClass,locale:t.locale,columns:i.getColumns(),editSettings:t.editSettings,toolbarSettings:t.toolbarSettings,rowTemplate:t.rowTemplate,rowDataBound:t.rowDataBound,queryCellInfo:t.queryCellInfo,cellSelecting:t.cellSelecting,cellSelected:t.cellSelected,selectedCellIndexes:this.selectedCellIndexes(),dataSource:this.dataSource(),flatRecords:t.flatRecords,parentRecords:t.parentRecords,ids:i.model.ids,columns:i._columns,dateFormat:t.dateFormat,resourceInfoMapping:t.resourceInfoMapping,resourceNameMapping:t.resourceNameMapping,resourceIdMapping:t.resourceIdMapping,resourceUnitMapping:t.resourceUnitMapping,idMapping:t.taskIdMapping,readOnly:t.readOnly,notesMapping:t.notesMapping,showGridCellTooltip:t.showGridCellTooltip,cellTooltipTemplate:t.cellTooltipTemplate,showGridExpandCellTooltip:t.showGridExpandCellTooltip,taskNameMapping:t.taskNameMapping,taskSchedulingModeMapping:t.taskSchedulingModeMapping,startDateMapping:t.startDateMapping,endDateMapping:t.endDateMapping,childMapping:t.childMapping,durationMapping:t.durationMapping,durationUnitMapping:t.durationUnitMapping,durationUnit:t.durationUnit,progressMapping:t.progressMapping,predecessorMapping:t.predecessorMapping,rowHeight:t.rowHeight,emptyRecordText:i._emptyRecordText,isFromGantt:i._isFromGantt,treeColumnIndex:t.treeColumnIndex,workingTimeScale:t.workingTimeScale,enableWBS:t.enableWBS,enableWBSPredecessor:t.enableWBSPredecessor,columnMenuTexts:i._columnMenuTexts,editTypeText:i._editTypeText,clipModeText:i._clipModeText,textAlignTypeText:i._textAlignTypeText,columnDialogTitle:i._columnDialogTitle,deleteColumnText:i._deleteColumnText,okButtonText:i._okButtonText,cancelButtonText:i._cancelButtonText,confirmDeleteText:i._confirmDeleteText,columnDialogFields:t.columnDialogFields,columnDialogTexts:i._columnDialogTexts,workMapping:t.workMapping,workUnit:i._workUnitTexts[t.workUnit],taskTypeTexts:i._taskTypeTexts,effortDrivenTexts:i._effortDrivenTexts,dataManagerUpdate:{isDataManagerUpdate:i._isDataManagerUpdate,jsonData:i._jsonData},durationUnitEditText:this._durationUnitEditText,durationUnitTexts:i._durationUnitTexts,enableCollapseAll:t.enableCollapseAll,weekStartDay:t.scheduleHeaderSettings.weekStartDay,indentLevelWidth:this.indentLevelWidth})},_renderGanttChart:function(){var i=this,t=this.model;i._$ganttchartHelper=n("#ejGanttChart"+i._id).ejGanttChart({dataSource:this.dataSource(),scheduleStartDate:t.scheduleStartDate,scheduleEndDate:t.scheduleEndDate,startDateMapping:t.startDateMapping,endDateMapping:t.endDateMapping,taskNameMapping:t.taskNameMapping,taskIdMapping:t.taskIdMapping,progressMapping:t.progressMapping,durationMapping:t.durationMapping,childPropertyName:t.childMapping,predecessorMapping:t.predecessorMapping,enableVirtualization:t.enableVirtualization,highlightWeekends:t.highlightWeekends,milestoneMapping:t.milestoneMapping,enableRowHover:t.enableRowHover,perDayWidth:i._perDayWidth,workingTimeScale:t.workingTimeScale,roundOffDayworkingTime:t.roundOffDayworkingTime,durationUnit:t.durationUnit,isCriticalPathEnable:this.isCriticalPathEnable,criticalPathCollection:this.criticalPathCollection,perMonthWidth:i._perMonthWidth,perWeekWidth:i._perWeekWidth,perHourWidth:i._perHourWidth,perMinuteWidth:i._perMinuteWidth,perTopHourWidth:i._perTopHourWidth,minuteInterval:i._minuteInterval,includeWeekend:t.includeWeekend,connectorlineWidth:t.connectorlineWidth,workingTimeRanges:i._workingTimeRanges,secondsPerDay:i._secondsPerDay,scheduleHeaderSettings:t.scheduleHeaderSettings,taskbarBackground:t.taskbarBackground,progressbarBackground:t.progressbarBackground,connectorLineBackground:t.connectorLineBackground,parentTaskbarBackground:t.parentTaskbarBackground,parentProgressbarBackground:t.parentProgressbarBackground,holidays:t.holidays,dateFormat:t.dateFormat,locale:t.locale,enableTaskbarTooltip:t.enableTaskbarTooltip,enableTaskbarDragTooltip:t.enableTaskbarDragTooltip,flatRecords:t.flatRecords,parentRecords:t.parentRecords,scheduleWeeks:i._scheduleWeeks,projectStartDate:i._projectStartDate,projectEndDate:i._projectEndDate,scheduleYears:i._scheduleYears,scheduleMonths:i._scheduleMonths,scheduleDays:i._scheduleDays,scheduleHours:i._scheduleHours,progressbarHeight:t.progressbarHeight,tooltipTemplate:t.taskbarTooltipTemplate,tooltipTemplateId:t.taskbarTooltipTemplateId,progressbarTooltipTemplate:t.progressbarTooltipTemplate,progressbarTooltipTemplateId:t.progressbarTooltipTemplateId,queryTaskbarInfo:t.queryTaskbarInfo,readOnly:t.readOnly,showTaskNames:t.showTaskNames,leftTaskLabelMapping:t.leftTaskLabelMapping,rightTaskLabelMapping:t.rightTaskLabelMapping,leftTaskLabelTemplate:t.leftTaskLabelTemplate,rightTaskLabelTemplate:t.rightTaskLabelTemplate,showProgressStatus:t.showProgressStatus,showResourceNames:t.showResourceNames,resourceInfoMapping:t.resourceInfoMapping,resourceNameMapping:t.resourceNameMapping,resourceUnitMapping:t.resourceUnitMapping,enableProgressBarResizing:t.enableProgressBarResizing,allowGanttChartEditing:t.allowGanttChartEditing,taskbarEditingTooltipTemplateId:t.taskbarEditingTooltipTemplateId,taskbarEditingTooltipTemplate:t.taskbarEditingTooltipTemplate,ids:i.model.ids,stripLines:t.stripLines,_predecessorCollection:i._predecessorsCollection,_columns:i._columns,weekendBackground:t.weekendBackground,allowKeyboardNavigation:t.allowKeyboardNavigation,updatedRecords:i.model.updatedRecords,renderBaseline:t.renderBaseline,baselineColor:t.baselineColor,editSettings:t.editSettings,columnHeaderTexts:i._columnHeaderTexts,durationUnitTexts:i._durationUnitTexts,predecessorEditingTexts:i._predecessorEditingTexts,localizedDays:i._days,localizedMonths:i._months,rowHeight:t.rowHeight,allowSelection:t.allowSelection,selectionMode:t.selectionMode,taskbarTemplate:t.taskbarTemplate,parentTaskbarTemplate:t.parentTaskbarTemplate,milestoneTemplate:t.milestoneTemplate,durationUnitEditText:this._durationUnitEditText,taskbarClick:t.taskbarClick,predecessorText:i._getPredecessorText(),taskbarHeight:i.taskbarHeight})},_getPredecessorText:function(){var n=this._predecessorCollectionText[1],t={};return n=n.value.split("-"),t.Start=n[0],t.Finish=n[1],t},_updateColumnDropDownData:function(){for(var n=this,r=n.model,i=r.columns,u=i.length,t=0;t<u;t++)i[t].field=="taskMode"&&(i[t].dropdownData=[{id:1,text:n._taskModeTexts.manual,value:"true"},{id:2,text:n._taskModeTexts.auto,value:"false"}]),i[t].field=="taskType"&&(i[t].dropdownData=[{id:1,text:n._taskTypeTexts.fixedWork,value:"fixedWork"},{id:2,text:n._taskTypeTexts.fixedUnit,value:"fixedUnit"},{id:3,text:n._taskTypeTexts.fixedDuration,value:"fixedDuration"}]),i[t].field=="effortDriven"&&(i[t].dropdownData=[{id:1,text:n._effortDrivenTexts.yes,value:"true"},{id:2,text:n._effortDrivenTexts.no,value:"false"}])},createTreeGridColumns:function(){var u=this,i=u.model,t,f=[],n=i.taskIdMapping,e;return n.length&&(t=i.showColumnChooser?{field:"taskId",headerText:u._columnHeaderTexts.taskId,width:40,editType:r.Gantt.EditingType.String,mappingName:n,allowEditing:!1,allowCellSelection:!0}:{field:"taskId",headerText:u._columnHeaderTexts.taskId,width:30,editType:r.Gantt.EditingType.String,mappingName:n,allowEditing:!1,allowCellSelection:!0},f.push(t)),n=i.taskNameMapping,n.length&&(t={field:"taskName",headerText:u._columnHeaderTexts.taskName,width:150,editType:r.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},f.push(t)),n=i.startDateMapping,n.length&&(t={field:"startDate",headerText:u._columnHeaderTexts.startDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},f.push(t)),n=i.endDateMapping,n.length&&(t={field:"endDate",headerText:u._columnHeaderTexts.endDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},f.push(t)),n=i.resourceInfoMapping,n.length&&(t={field:"resourceInfo",headerText:u._columnHeaderTexts.resourceInfo,width:150,editType:r.Gantt.EditingType.Dropdown,mappingName:n,allowCellSelection:!0,dropdownData:i.resources},f.push(t)),n=i.durationMapping,n.length&&(t={field:"duration",headerText:u._columnHeaderTexts.duration,width:150,editType:r.Gantt.EditingType.String,allowCellSelection:!0,mappingName:n},f.push(t)),n=i.progressMapping,n.length&&(t={field:"status",headerText:u._columnHeaderTexts.status,width:150,editType:r.Gantt.EditingType.Numeric,mappingName:n,allowCellSelection:!0},f.push(t)),n=i.predecessorMapping,n.length&&(t={field:"predecessor",headerText:u._columnHeaderTexts.predecessor,width:150,editType:r.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},f.push(t)),i.renderBaseline&&i.baselineStartDateMapping&&i.baselineEndDateMapping&&(n=i.baselineStartDateMapping,n.length&&(t={field:"baselineStartDate",headerText:u._columnHeaderTexts.baselineStartDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},f.push(t)),n=i.baselineEndDateMapping,n.length&&(t={field:"baselineEndDate",headerText:u._columnHeaderTexts.baselineEndDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},f.push(t))),i.enableWBS&&(n="WBS",n.length&&(t={field:"WBS",headerText:u._columnHeaderTexts.WBS,width:150,editType:r.Gantt.EditingType.String,allowEditing:!1,mappingName:n},f.push(t))),i.enableWBS&&i.enableWBSPredecessor&&(n="WBSPredecessor",n.length&&(t={field:"WBSPredecessor",headerText:u._columnHeaderTexts.WBSPredecessor,width:150,editType:r.Gantt.EditingType.String,allowEditing:!1,mappingName:n},f.push(t))),n=i.notesMapping,n.length&&(t={field:"notesText",headerText:u._columnHeaderTexts.notes,width:150,editType:"stringedit",mappingName:n,allowEditing:!0,allowCellSelection:!0},f.push(t)),n=i.taskSchedulingModeMapping,n.length&&(e=!1,i.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom&&(e=!0),t={field:"taskMode",headerText:u._columnHeaderTexts.taskMode,width:100,editType:r.Gantt.EditingType.Dropdown,allowCellSelection:e,allowEditing:e,mappingName:n,dropdownData:[{id:1,text:u._taskModeTexts.manual,value:"true"},{id:2,text:u._taskModeTexts.auto,value:"false"}],editParams:{field:{text:"text",value:"value"}}},f.push(t)),n=i.workMapping,t={field:"work",headerText:u._columnHeaderTexts.work,width:150,editType:r.Gantt.EditingType.Numeric,allowEditing:!0,allowCellSelection:!0,visible:n?!0:!1},n.length&&(t.mappingName=n),f.push(t),t={field:"taskType",headerText:u._columnHeaderTexts.taskType,width:150,editType:r.Gantt.EditingType.Dropdown,dropdownData:[{id:1,text:u._taskTypeTexts.fixedWork,value:"fixedWork"},{id:2,text:u._taskTypeTexts.fixedUnit,value:"fixedUnit"},{id:3,text:u._taskTypeTexts.fixedDuration,value:"fixedDuration"}],editParams:{field:{text:"text",value:"value"}},allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),t={field:"effortDriven",headerText:u._columnHeaderTexts.effortDriven,width:150,editType:r.Gantt.EditingType.Dropdown,dropdownData:[{id:1,text:u._effortDrivenTexts.yes,value:"true"},{id:2,text:u._effortDrivenTexts.no,value:"false"}],editParams:{field:{text:"text",value:"value"}},allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),f},_createGanttRecords:function(n){var t=this,r=t.model,e=r.flatRecords,o=n.length,f=0,i,s=r.parentRecords,c=r.allowSorting,l=r.enableAltRow,h=t.model.ids;for(f;f<o;f++)r.enableWBS&&(n[f].WBS=(f+1).toString()),i=t._createGanttRecord(n[f],0,null,u,"Load"),t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,h[t._storedIndex]=i.taskId.toString(),e.push(i),s.push(i),i.childRecords&&t._addNestedGanttRecords(i.childRecords);r.enableWBS&&r.enableWBSPredecessor&&t.createWBSPredecessor()},createWBSPredecessor:function(){var c=this,n=c.model,u,r,i,s,h,o;if(n.enableWBS&&n.enableWBSPredecessor&&n.predecessorMapping)for(u=n.flatRecords.filter(function(n){return n&&n.predecessor}),r=0;r<u.length;r++){var f=u[r],e=f.predecessor,t=null;for(i=0;i<e.length;i++)s=+e[i].from,h=n.flatRecords.filter(function(n){return n&&n.taskId==s}),o=h[0].WBS+e[i].predecessorsType,t=t?t+","+o:o;f.WBSPredecessor=t;f.item.WBSPredecessor=t}},_calculateScheduleDates:function(t){var o=this,r,i,f,e,u=this.model,s=u.flatRecords,h;(!u.scheduleEndDate||!u.scheduleStartDate)&&s.length>0||t?(n.each(s,function(n,t){f=new Date(t.startDate);e=new Date(t.endDate);baseLineStartDate=t.baselineStartDate?new Date(t.baselineStartDate):null;baseLineEndDate=t.baselineEndDate?new Date(t.baselineEndDate):null;r?(r.getTime()>=f.getTime()&&(r=f),baseLineStartDate&&u.renderBaseline&&r.getTime()>=baseLineStartDate.getTime()?r=baseLineStartDate:baseLineEndDate&&u.renderBaseline&&r.getTime()>=baseLineEndDate.getTime()&&(r=baseLineEndDate)):r=baseLineStartDate&&u.renderBaseline&&f.getTime()>=baseLineStartDate.getTime()?baseLineStartDate:baseLineEndDate&&u.renderBaseline&&f.getTime()>=baseLineEndDate.getTime()?baseLineEndDate:f;i?(i.getTime()<=e.getTime()&&(i=e),baseLineEndDate&&u.renderBaseline&&i.getTime()<=baseLineEndDate.getTime()?i=baseLineEndDate:baseLineStartDate&&u.renderBaseline&&i.getTime()<=baseLineStartDate.getTime()&&(i=baseLineStartDate)):(baseLineEndDate&&u.renderBaseline&&e.getTime()<=baseLineEndDate.getTime()&&(i=baseLineEndDate),i=baseLineStartDate&&u.renderBaseline&&e.getTime()<=baseLineStartDate.getTime()?baseLineStartDate:e)}),h=o._updateScheduleDatesByTaskLables(r,i),r=h.minStartDate,i=h.maxEndDate):u.scheduleEndDate&&u.scheduleStartDate||s.length!==0||(r=o._getDateFromFormat(new Date),i=o._getDateFromFormat(new Date(r)),i.setDate(i.getDate()+20));t?(t.minStartDate=r,t.maxEndDate=i):(u.scheduleStartDate=r?o.getFormatedDate(r):u.scheduleStartDate,u.scheduleEndDate=i?o.getFormatedDate(i):u.scheduleEndDate)},_updateScheduleDatesByTaskLables:function(n,t){var f=this,e=this.model,s=e.scheduleHeaderSettings.scheduleHeaderType,h=r.Gantt.ScheduleHeaderType,i=f._getResourceStringWidth(),o,u={},c=e.scheduleEndDate&&this._getDateFromFormat(e.scheduleEndDate);return s==h.Week&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perDayWidth+7:7,t.setDate(t.getDate()+o))),s==h.Year&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perMonthWidth+1:1,t.setMonth(t.getMonth()+o))),s==h.Month&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perDayWidth+7:7,t.setDate(t.getDate()+o))),s==h.Day&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perHourWidth+7:7,t.setHours(t.getHours()+o))),s==h.Hour&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(numOfHours=i>0?i/f._perMinuteWidth+5:5,t.setHours(t.getHours()+numOfHours),n.setHours(n.getHours()-1))),u=f._updateScheduleDatesByStripLines(n,t),n=u.startDate,t=u.endDate,u=f._updateScheduleDatesByHolidays(n,t),n=u.startDate,t=u.endDate,u.minStartDate=n,u.maxEndDate=t,u},_updateScheduleDatesByHolidays:function(t,i){var u=this,f=this.model,r={};return u._holidaysList.length>0&&n.each(u._holidaysList,function(n,r){r.getTime()>t.getTime()&&r.getTime()<i.getTime()||(r.getTime()<t.getTime()?t=new Date(r):i=new Date(r))}),r.startDate=t,r.endDate=i,r},_updateScheduleDatesByStripLines:function(t,i){var f=this,u=this.model,r={};return u.stripLines.length>0&&n.each(u.stripLines,function(n,r){var u=f._getDateFromFormat(r.day);u.getTime()>t.getTime()&&u.getTime()<i.getTime()||(u.getTime()<t.getTime()?t=new Date(u):i=new Date(u))}),r.startDate=t,r.endDate=i,r},_getResourceStringWidth:function(){var s=this,u=this.model,f=u.resources,e="",o,i,t;if(f.length>0&&u.showResourceNames){for(i=0;i<f.length;i++)e+=f[i][u.resourceNameMapping]+" ,";return t=r.buildTag("span","",{"font-family":"Segoe UI","font-size":"12px"},{}),t.text(e),n(document.body).append(t),o=t.width(),t.remove(),o}return 0},_calculateHeaderDates:function(){var n=this,e=this.model,t=n._getDateFromFormat(e.scheduleStartDate),i=n._getDateFromFormat(e.scheduleEndDate),u=e.scheduleHeaderSettings.scheduleHeaderType,f=r.Gantt.ScheduleHeaderType;u==f.Week&&n._calculateWeekSplit(t,i);u==f.Year&&n._calculateYearSplit(t,i);u==f.Month&&n._calculateMonthSplit(t,i);u==f.Day&&n._calculateDaySplit(t,i);u==f.Hour&&n._calculateHourSplit(t,i)},_addNestedGanttRecords:function(n){var t=this,o=t.model.ids,s=t.model,h=s.flatRecords,u=0,c=n.length,f=[],r,a=s.enableAltRow;for(u;u<c;u++)if(r=n[u],t._storedIndex++,r.isAltRow=t._storedIndex%2==0?!1:!0,r.index=t._storedIndex,o[t._storedIndex]=r.taskId.toString(),h.push(r),f=r.childRecords,f){var e=0,l=f.length,i=null;for(e;e<l;e++)i=f[e],t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,o[t._storedIndex]=i.taskId.toString(),h.push(i),i.childRecords&&t._addNestedGanttRecords(i.childRecords)}},_createGanttRecord:function(n,t,i,f,e){var h=this,o,s=h.model,y=h._columns,tt=y.length,l=n[s.childMapping],b=r.isNullOrUndefined(n[s.durationMapping])?null:n[s.durationMapping],it=n[s.progressMapping]?isNaN(parseFloat(n[s.progressMapping]))?0:parseFloat(n[s.progressMapping]):0,a=h._getDateFromFormat(n[s.startDateMapping]),c=h._getDateFromFormat(n[s.endDateMapping]),k=r.isNullOrUndefined(n[s.workMapping])?null:n[s.workMapping],ft=n[s.resourceInfoMapping],p=n[s.predecessorMapping],d=n[s.notesMapping],et=h._getDateFromFormat(n[s.baselineStartDateMapping]),w=h._getDateFromFormat(n[s.baselineEndDateMapping]),ot=n.WBS?n.WBS:null,st=s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Auto?!0:s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Manual?!1:s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom?n[s.taskSchedulingModeMapping]==!0?!1:!0:s.taskSchedulingMode,g=s.durationUnitMapping&&n[s.durationUnitMapping]?h._validateDurationUnitMapping(n[s.durationUnitMapping]):null,rt=s.milestoneMapping&&n[s.milestoneMapping],ht=a?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes()).getTime():null,ct=c?new Date(c.getFullYear(),c.getMonth(),c.getDate(),c.getHours(),c.getMinutes()).getTime():null,ut,nt,v;if(o=new r.Gantt.GanttRecord,o.taskId=n[s.taskIdMapping],o.taskName=n[s.taskNameMapping],h._addItemValue(o,n,e),o.isAutoSchedule=st,o.startDate=this._checkStartDate(a,o),ut=h._isinAddnewRecord?h._newRecordResourceCollection:s.resources,o.resourceInfo=ft&&o._setResourceInfo(n[s.resourceInfoMapping],s.resourceIdMapping,s.resourceNameMapping,s.resourceUnitMapping,ut),h._updateResourceName(o),!r.isNullOrUndefined(rt)&&rt?(o.duration=0,o.durationUnit=g,o.isMilestone=!0,o.endDate=new Date(o.startDate)):s.workMapping?(o.durationUnit=s.durationUnit,isNaN(k)||r.isNullOrUndefined(k)?(o.work=0,o.duration=0,o.isMilestone=!0,o.endDate=new Date(o.startDate)):(o.work=k,o._updateDurationWithWork(h),o.duration==0?(o.isMilestone=!0,o.endDate=new Date(o.startDate)):o.endDate=this._getEndDate(o.startDate,o.duration,o.durationUnit,o)),r.isNullOrUndefined(n[s.durationMapping])||(n[s.durationMapping]=o.duration),r.isNullOrUndefined(n[s.durationMapping])||(n[s.endDateMapping]=o.endDate)):r.isNullOrUndefined(b)?c?(c.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,c),o.endDate=this._checkEndDate(c,o),o.startDate.getTime()>=o.endDate.getTime()?(o.endDate=new Date(o.startDate),o.isMilestone=!0,o.duration=0):o.duration=this._getDuration(o.startDate,o.endDate,s.durationUnit,o.isAutoSchedule),o.durationUnit=s.durationUnit):!c&&r.isNullOrUndefined(b)&&(o.isMilestone=!0,o.duration=0,o.endDate=new Date(o.startDate)):(nt=this._getDurationValues(b),o.duration=nt.duration,o.durationUnit=g?g:nt.durationUnit,o.duration==0?(o.isMilestone=!0,o.endDate=new Date(o.startDate)):o.endDate=this._getEndDate(o.startDate,o.duration,o.durationUnit,o)),o.baselineStartDate=this._checkBaseLineStartDate(et),w&&w.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,w),o.baselineEndDate=this._checkBaseLineEndDate(w),o.WBS=ot,o.notes=d,o.notesText=d?h._getPlainText(d):"",tt)for(v=0;v<tt;v++)o[y[v].field]==u&&(o[y[v].field]=n[y[v].mappingName]);return o.status=it,o.predecessor=p&&o._calculatePredecessor(p,this._durationUnitEditText,s.durationUnit),o.predecessorsName=p,o.parentItem=i,o.level=t,e||(o.width=o._calculateWidth(this),o.left=o._calculateLeft(this),o.progressWidth=o._calculateProgressWidth(o.width,it),o.baselineStartDate&&o.baselineEndDate&&(o.baselineLeft=o._calculateBaselineLeft(this),o.baselineRight=o._calculateBaselineRight(this),o.baselineWidth=o._calculateBaseLineWidth(this))),h._updateItemValueInRecord(o),o.childRecords=l&&l.length>0&&h._createChildRecords(l,t+1,o),o.hasChildRecords=l&&l.length>0?!0:!1,o.isMilestone=o.hasChildRecords?!1:o.isMilestone,s.expandStateMapping&&o.hasChildRecords&&(r.isNullOrUndefined(n[s.expandStateMapping])?r.isNullOrUndefined(n[s.expandStateMapping])&&!s.enableCollapseAll?o[s.expandStateMapping]=o.item[s.expandStateMapping]=n[s.expandStateMapping]=!0:r.isNullOrUndefined(n[s.expandStateMapping])&&s.enableCollapseAll&&(o[s.expandStateMapping]=o.item[s.expandStateMapping]=n[s.expandStateMapping]=!1):o[s.expandStateMapping]=o.item[s.expandStateMapping]=n[s.expandStateMapping]),o.expanded=f!==u?f:l?l.length>0:!1,s.enableVirtualization===!1&&(o.isExpanded=!0),o.hasChildRecords&&(o.manualStartDate=o.startDate,o.manualEndDate=o.endDate,o.manualDuration=o.duration),o.taskType=n.taskType?n.taskType:s.taskType,o.effortDriven=n.effortDriven?n.effortDriven:o.taskType!="fixedWork"?"false":"true",s.workMapping||o._updateWorkWithDuration(h),p&&h._predecessorsCollection.push(o),o},_validateDurationUnitMapping:function(n){var t=n;return this._durationUnitEditText.minute.indexOf(t)!=-1?t=r.Gantt.DurationUnit.Minute:this._durationUnitEditText.hour.indexOf(t)!=-1?t=r.Gantt.DurationUnit.Hour:this._durationUnitEditText.day.indexOf(t)!=-1&&(t=r.Gantt.DurationUnit.Day),t==r.Gantt.DurationUnit.Day||t==r.Gantt.DurationUnit.Hour||t==r.Gantt.DurationUnit.Minute?t:this.model.durationUnit},_updateItemValueInRecord:function(n){var t=this.model,i;n.item&&(i=n.item,t.startDateMapping&&(i[t.startDateMapping]=n.startDate),t.endDateMapping&&(i[t.endDateMapping]=n.endDate),t.durationMapping&&(i[t.durationMapping]=n.duration),t.durationUnitMapping&&(i[t.durationUnitMapping]=n.durationUnit),t.workMapping&&(i[t.workMapping]=n.work),t.taskSchedulingModeMapping&&(i[t.taskSchedulingModeMapping]=!n.isAutoSchedule))},_addItemValue:function(n,t,i){var f=this,e=this.model,o,u;e.parentTaskIdMapping&&i?(o=t[e.taskIdMapping],u=f._taskIds.indexOf(o),n.item=u>-1?f._retrivedData[u]:[]):this.dataSource()instanceof r.DataManager&&this.dataSource().dataSource.json&&this.dataSource().dataSource.offline&&i?e.parentTaskIdMapping?(o=t[e.taskIdMapping],u=f._taskIds.indexOf(o),n.item=u>-1?f._retrivedData[u]:[]):n.item=t:n.item=t},_getPlainText:function(n){var t=document.createElement("DIV");return t.innerHTML=n,t.textContent||t.innerText||""},_updateResourceName:function(n){var f=this,i=n.resourceInfo,r=[],u,t;if(i){for(u=i.length,n.item?n.item[this.model.resourceInfoMapping]=[]:null,t=0;t<u;t++)r.push(i[t][this.model.resourceNameMapping]),n.item&&n.item[this.model.resourceInfoMapping].push(i[t][this.model.resourceIdMapping]);n.resourceNames=r.join(",")}},_updateResourceRelatedFields:function(n){var t=this,u=t.model,e=n.taskType,i=n.isAutoSchedule,f=n.effortDriven==="true";if(!r.isNullOrUndefined(n.resourceInfo))if(n.work>0||t._updatedColumn=="work")switch(e){case"fixedUnit":i&&n.resourceInfo.length&&(t._updatedColumn=="work"||f&&t._updatedColumn=="resourceInfo")?n._updateDurationWithWork(t):i||t._updatedColumn!="work"?n._updateWorkWithDuration(t):n._updateUnitWithWork(t);break;case"fixedWork":if(n.resourceInfo.length==0)return;i?t._updatedColumn=="duration"||t._updatedColumn=="endDate"?(n._updateUnitWithWork(t),n.duration==0&&(n.work=0,u.workMapping&&(n.item[u.workMapping]=0))):n._updateDurationWithWork(t):t._updatedColumn=="work"?n._updateUnitWithWork(t):n._updateWorkWithDuration(t);break;case"fixedDuration":n.resourceInfo.length&&(t._updatedColumn=="work"||i&&f&&t._updatedColumn=="resourceInfo")?n._updateUnitWithWork(t):n._updateWorkWithDuration(t)}else n._updateWorkWithDuration(t)},_updateResourceDataSource:function(t){for(var o,f,i,s,e=this,r=[],h=t.resourceInfo?t.resourceInfo.length:0,u=0;u<h;u++)r.push({name:t.resourceInfo[u][e.model.resourceIdMapping],unit:t.resourceInfo[u][e.model.resourceUnitMapping]});for(o="#treegrid"+e._id+"resourceEdit",f=n(o).data("ejTreeGrid").model.dataSource,i=0;i<f.length;i++)s=r.filter(function(n){return n.name===parseInt(f[i].name)}),s&&s.length==0&&r.push(f[i]);n(o).ejTreeGrid("option","dataSource",r)},_getHoliday:function(){var n;if(this.model.holidays!=null){var t=this.model.holidays,i=[],r=t.length;if(r>0){for(n=0;n<r;n++)i[n]=this._getDateFromFormat(t[n].day);return i}}return!1},_getStringHolidays:function(){var n;if(this._holidaysList!=null&&this._holidaysList.length>0){var t=this._holidaysList,i=[],u=t.length;if(u>0){for(n=0;n<u;n++)i[n]=r.format(t[n],this.model.dateFormat,this.model.locale);return i}}return[]},_createChildRecords:function(n,t,i){for(var f=[],s=this,r=0,h=n.length,e,o,r=0;r<h;r++)model.enableWBS&&(e=i.WBS,n[r].WBS=e+"."+(r+1)),n[r]&&(o=s._createGanttRecord(n[r],t,i,u,"Load"),f.push(o));return f},_createResourceInfoCollection:function(n){var i=this,t=0,r=n.length;for(t;t<r;t++)i._resourceInfoCollection.push(i._createResourceInfo(n[t]))},_createResourceInfo:function(n){var i=this.model,t={};return t.resourceId=n[i.resourceIdMapping],t.resourceName=n[i.resourceNameMapping],t},_calculateWeekSplit:function(n,t){var i=this,u=i.model,f=u.scheduleHeaderSettings.weekStartDay,e,r,o;e=u.scheduleHeaderSettings.timescaleStartDateMode=="month"?new Date(n.getFullYear(),n.getMonth(),1):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?new Date(n.getFullYear(),0,1):n;n=e;r=f>=0&&f<7?f:0;o=n.getDay()<=r?n.getDate()-(7-r+n.getDay()):n.getDate()-n.getDay()+r;n.setDate(o);n.setHours(0,0,0,0);do i._scheduleWeeks.push(new Date(n)),n.setDate(n.getDate()+7);while(!(n>t));i._projectStartDate=new Date(i._scheduleWeeks[0]);i._projectEndDate=new Date(i._scheduleWeeks[i._scheduleWeeks.length-1])},_calculateYearSplit:function(n,t){var i=this,r=i.model,u,f,e,o;if(r.scheduleHeaderSettings.timescaleStartDateMode=="month"){u=new Date(n.getFullYear(),n.getMonth(),1);n=u;do i._scheduleYears.push(new Date(n)),n=new Date(n.getFullYear()+1,0,1);while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0].getFullYear(),i._scheduleYears[0].getMonth(),1);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}else if(r.scheduleHeaderSettings.timescaleStartDateMode=="week"){f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay();n.setDate(f);do i._scheduleYears.push(new Date(n)),n=n.getDate()==29&&n.getMonth()==0&&n.getFullYear()%4!=0?new Date(n.getFullYear()+1,n.getMonth(),n.getDate()-1):new Date(n.getFullYear()+1,n.getMonth(),n.getDate());while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0]);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}else{n.setMonth(0);n.setDate(1);n.setHours(0,0,0,0);do i._scheduleYears.push(new Date(n)),n.setMonth(n.getMonth()+12);while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0].getFullYear(),i._scheduleYears[0].getMonth(),1);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}},_calculateDaySplit:function(n,t){var i=this,u=i.model,f,r;u.scheduleHeaderSettings.timescaleStartDateMode=="week"?(f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay(),n.setDate(f)):u.scheduleHeaderSettings.timescaleStartDateMode=="month"?(r=new Date(n.getFullYear(),n.getMonth(),1),n=r):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?(r=new Date(n.getFullYear(),0,1),n=r):n.setHours(0,0,0,0);do i._scheduleDays.push(new Date(n)),n.setDate(n.getDate()+1);while(n<=t);i._projectStartDate=new Date(i._scheduleDays[0]);i._projectEndDate=new Date(i._scheduleDays[i._scheduleDays.length-1])},_calculateHourSplit:function(n,t){var i=this,u=i.model,f,r;u.scheduleHeaderSettings.timescaleStartDateMode=="week"?(f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay(),n.setDate(f)):u.scheduleHeaderSettings.timescaleStartDateMode=="month"?(r=new Date(n.getFullYear(),n.getMonth(),1),n=r):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?(r=new Date(n.getFullYear(),0,1),n=r):n.setMinutes(0);do i._scheduleHours.push(new Date(n)),n.setHours(n.getHours()+1);while(n<=t);i._projectStartDate=new Date(i._scheduleHours[0]);i._projectEndDate=new Date(i._scheduleHours[i._scheduleHours.length-1])},_calculateMonthSplit:function(n,t){var i=this,f=i.model,e,u,o,r;if(f.scheduleHeaderSettings.timescaleStartDateMode=="week"){e=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay();n.setDate(e);do i._scheduleMonths.push(new Date(n)),n=n.getDate()==29&&n.getMonth()==0&&n.getFullYear()%4!=0?new Date(n.getFullYear(),n.getMonth()+1,n.getDate()-1):new Date(n.getFullYear(),n.getMonth()+1,n.getDate());while(!(n>=t))}else if(f.scheduleHeaderSettings.timescaleStartDateMode=="year"){u=new Date(n.getFullYear(),0,1);n=u;do i._scheduleMonths.push(new Date(n)),n.getMonth()==0||n.getMonth()==2||n.getMonth()==4||n.getMonth()==6||n.getMonth()==7||n.getMonth()==9||n.getMonth()==11?n.setDate(n.getDate()+31):n.getMonth()==3||n.getMonth()==5||n.getMonth()==8||n.getMonth()==10?n.setDate(n.getDate()+30):n.getMonth()==1&&(n.getFullYear()%4==0?n.setDate(n.getDate()+29):n.setDate(n.getDate()+28));while(!(n>=t))}else{u=new Date(n.getFullYear(),n.getMonth(),1);n=u;do i._scheduleMonths.push(new Date(n)),n.getMonth()==0||n.getMonth()==2||n.getMonth()==4||n.getMonth()==6||n.getMonth()==7||n.getMonth()==9||n.getMonth()==11?n.setDate(n.getDate()+31):n.getMonth()==3||n.getMonth()==5||n.getMonth()==8||n.getMonth()==10?n.setDate(n.getDate()+30):n.getMonth()==1&&(n.getFullYear()%4==0?n.setDate(n.getDate()+29):n.setDate(n.getDate()+28));while(!(n>=t))}o=new Date(i._scheduleMonths[0]);r=new Date(i._scheduleMonths[i._scheduleMonths.length-1]);r=new Date(r.getFullYear(),r.getMonth()+1,0);i._projectStartDate=o;i._projectEndDate=r},_updatePredecessors:function(){var u=this,i=0,f=u._predecessorsCollection,h=f.length,e,o,r=0,n,s,t;for(i;i<h;i++)for(e=f[i],o=e.predecessor,s=o.length,r=0;r<s;r++)t=o[r],n=u.model.flatRecords[u.model.ids.indexOf(t.from)],t.from!==e.taskId.toString()&&n&&(n.predecessor?n.predecessor.push(t):(n.predecessor=[],n.predecessor.push(t),f.push(n)))},getDateType:function(n){if(n!=null){if(typeof n=="object")return n;var t=new RegExp("\\-","g"),i=new RegExp("\\.","g");return n=n.replace(t,"/"),n=n.replace(i,"/"),new Date(n)}return null},getFormatedDate:function(n){return r.format(n,this.model.dateFormat,this.model.locale)},_getProgressWidth:function(n,t){return n*t/100},_wireEvents:function(){var t=this,u=t.model,i=n("#ejTreeGrid"+t._id),r=n("#ejGanttChart"+t._id),f=t._$ejGantt;t._on(t.element,"click",t.clickHandler);t._on(t.element,"click",".e-ejinputtext",t._searchTextFocusIn);t._on(t.element,"focusout",".e-ejinputtext",t._searchTextFocusOut);u.enableContextMenu&&(t._on(t.element,"contextmenu",t._rightClick),t._on(t.element,"keyup",this._preventContextMenu));u.enableResize&&u.isResponsive&&t._on(n(window),"resize",t.windowResize);i.ejTreeGrid({rowSelecting:n.proxy(t.rowSelecting,t)});i.ejTreeGrid({rowSelected:n.proxy(t.rowSelected,t)});i.ejTreeGrid({cellSelecting:n.proxy(t.cellSelecting,t)});i.ejTreeGrid({cellSelected:n.proxy(t.cellSelected,t)});i.ejTreeGrid({rowDrag:n.proxy(t.rowDrag,t)});i.ejTreeGrid({rowDragStart:n.proxy(t.rowDragStart,t)});i.ejTreeGrid({rowDragStop:n.proxy(t.rowDragStop,t)});i.ejTreeGrid({actionBegin:n.proxy(t.actionBegin,t)});i.ejTreeGrid({actionComplete:n.proxy(t.actionComplete,t)});i.ejTreeGrid({expandAllCollapseAllRequest:n.proxy(t.expandAllCollapseAllRequest,t)});i.ejTreeGrid({contextMenuAction:n.proxy(t.contextMenuAction,t)});i.ejTreeGrid({subContextMenuAction:n.proxy(t.subContextMenuAction,t)});i.ejTreeGrid({setInitialData:n.proxy(t.setInitialData,t)});u.queryCellInfo&&i.ejTreeGrid({queryCellInfo:n.proxy(t._queryCellInfo,t)});u.rowDataBound&&i.ejTreeGrid({rowDataBound:n.proxy(t._rowDataBound,t)});i.ejTreeGrid({beginEdit:n.proxy(t._beginEdit,t)});i.ejTreeGrid({endEdit:n.proxy(t._endEdit,t)});i.ejTreeGrid({expanding:n.proxy(t.expanding,t)});i.ejTreeGrid({collapsing:n.proxy(t.collapsing,t)});i.ejTreeGrid({expanded:n.proxy(t.expanded,t)});i.ejTreeGrid({collapsed:n.proxy(t.collapsed,t)});i.ejTreeGrid({refreshRow:n.proxy(t.refreshRow,t)});i.ejTreeGrid({cancelEditCell:n.proxy(t.cancelEditCell,t)});r.ejGanttChart({rowSelecting:n.proxy(t.rowSelecting,t)});r.ejGanttChart({rowSelected:n.proxy(t.rowSelected,t)});r.ejGanttChart({rowHover:n.proxy(t._ganttChartRowHover,t)});r.ejGanttChart({actionBegin:n.proxy(t.actionBegin,t)});r.ejGanttChart({actionComplete:n.proxy(t.chartactionComplete,t)});r.ejGanttChart({refreshRow:n.proxy(t.refreshRowData,t)});r.ejGanttChart({zooming:n.proxy(t.zoomingChart,t)});r.ejGanttChart({queryTaskbarInfo:n.proxy(t.queryTaskbarInfo,t)});r.ejGanttChart({expanding:n.proxy(t.expanding,t)});r.ejGanttChart({collapsing:n.proxy(t.collapsing,t)});r.ejGanttChart({expanded:n.proxy(t.expanded,t)});r.ejGanttChart({collapsed:n.proxy(t.collapsed,t)});r.ejGanttChart({expandAllCollapseAllRequest:n.proxy(t.expandAllCollapseAllRequest,t)});r.ejGanttChart({taskbarEditing:n.proxy(t.taskbarEditing,t)});r.ejGanttChart({taskbarEdited:n.proxy(t.taskbarEdited,t)});r.ejGanttChart({calculateEndDate:n.proxy(t.calculateEndDate,t)});r.ejGanttChart({calculateDuration:n.proxy(t.calculateDuration,t)});r.ejGanttChart({clearColumnMenu:n.proxy(t.clearColumnMenu,t)});r.ejGanttChart({deleteRow:n.proxy(t.deleteRow,t)});r.ejGanttChart({cancelEditCell:n.proxy(t.cancelEditCell,t)});f.ejSplitter({allowResizing:n.proxy(t._onResize,t)});t._on(t.element,"mousedown",t._mousedownhandler);t._enableEditingEvents()},_preventContextMenu:function(n){if(n.keyCode==93)return n.preventDefault(),n.stopPropagation(),!1},_onResize:function(t){var i=this,r=!1,u=i.splitterPosition();i._isinBeginEdit&&n("#ejTreeGrid"+i._id+"EditForm").length>0&&(i._$treegridHelper.ejTreeGrid("cancelEditCell"),i._isinBeginEdit=!1);r=u.indexOf("%")!=-1?!0:!1;r?i.splitterPosition(Math.round(t.prevPane.size/i._ganttWidth*100)+"%"):i.splitterPosition(Math.round(t.prevPane.size).toString());i._splitterPosition(i.splitterPosition());i._$treegridHelper.ejTreeGrid("refreshScroller",t.prevPane.size);i._$ganttchartHelper.ejGanttChart("refreshScroller",t.nextPane.size-1)},_searchTextFocusOut:function(t){var r=this,u=this._toolboxTooltipTexts.searchTool,i=n(t.target);n(i).closest("li")&&n(i).closest("li").attr("id")==r._id+"_search"&&n(i).attr("placeholder",u)},_searchTextFocusIn:function(t){var u=this,i=n(t.target),r=n(i).attr("placeholder");i.hasClass("e-ejinputtext")&&r&&i.removeAttr("placeholder")},clickHandler:function(t){var r=this,i=n(t.target);(r._clearContextMenu(),i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vhandlespace")||i.hasClass("e-vdown"))||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hup")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||(r._isinBeginEdit&&document.getElementById(r._id).contains(i[0])&&(i.closest("td").hasClass("e-editedcell")||i.hasClass("e-date")||i.hasClass("e-arrow")||i.hasClass("e-down-arrow")||i.closest("form#ejTreeGrid"+r._id+"EditForm").length!=0||!(n("#ejTreeGrid"+r._id+"EditForm").length>0)||(r._$treegridHelper.ejTreeGrid("saveCell"),r._isinBeginEdit=!1)),r.clearColumnMenu())},windowResize:function(){var nt,tt,it,rt,ut,v,ft,b,e,h,y;if(this.element.is(":visible")){var t=this,p="#e-ejSpliter"+this._id,l="#"+this._id+"_toolbarItems",k="#ejGanttChart"+this._id,et="#ejTreeGrid"+this._id,o=".e-ganttviewerbodyContianer",w=".e-ganttviewerheaderContainer",ot="#ejTreeGrid"+this._id,c="#ejTreeGrid"+this._id+"e-gridcontent",s=t.model.sizeSettings.width,a=t.model.sizeSettings.height,d=t.element[0].style.height,g=t.element[0].style.width,i,u,f;s&&typeof s!="number"&&s.indexOf("%")!=-1||g.indexOf("%")!=-1?(v=s?s:g,nt=n(t.element).parent().width()?n(t.element).parent().width():n(t.element).width(),i=nt/100*parseInt(v)):i=n(t.element).width();t.splitterPosition().indexOf("%")==-1?(tt=parseInt(t.splitterPosition())+7+2,t._ganttWidth=i=Math.max(i,tt)):t._ganttWidth=i;a&&typeof s!="number"&&a.indexOf("%")!=-1||d.indexOf("%")!=-1?(it=a?a:d,rt=n(t.element).parent().height()?n(t.element).parent().height():n(t.element).height(),ut=n(t.element).parent().height()?rt/100*parseInt(it):n(t.element).height(),u=ut):u=n(t.element).height();u=u-t._totalBorderHeight;i=Math.round(i);h=n(l).length?n(l).height():0;n(p).css("width",i);n(p).css("height",u-h);n(p).ejSplitter("refresh");n(l).length&&n(l).css("width",i);v=n(k).width();ft=n(et).width();n(k).height(u-h);b=n(o).ejScroller("option","scrollTop");e=n(o).ejScroller("option","scrollLeft");n(o).ejScroller({width:v,height:u-h-n(w).height()-parseInt(n(w).css("border-bottom-width"))});n(o).ejScroller("refresh");f=t._$ganttchartHelper.ejGanttChart("getMaxScrollWidth");e>f&&(e=f>0?f:0);n(o).ejScroller("option","scrollTop",b);n(o).ejScroller("option","scrollLeft",e);n(ot).height(u-h);n(c).height(u-h-n(w).height()-t._totalBorderHeight);e=n(c).ejScroller("option","scrollLeft");n(c).width(ft);n(c).ejScroller("refresh");f=t._$treegridHelper.ejTreeGrid("getMaxScrollWidth");e>f&&(e=f>0?f:0);n(c).ejScroller("option","scrollLeft",e);t._$treegridHelper.ejTreeGrid("updateViewPortHeight");t._$ganttchartHelper.ejGanttChart("updateViewPortHeight");t.model.enableVirtualization&&(t._$treegridHelper.ejTreeGrid("cancelRowEditCell"),y={},y.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("processBindings",y),t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",y),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords),t._$ganttchartHelper.ejGanttChart("onScrollHelper",b));t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._updateRowHeightInConnectorLine(t._connectorLinesCollection);t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection);t.setSplitterPosition(t.splitterPosition())}},_updateRowHeightInConnectorLine:function(t){var u,i,r;if(t&&t.length&&(u=n("#ejGanttChart"+this._id).ejGanttChart("instance"),i=n("#"+u._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height,i&&!isNaN(i)))for(r=0;r<t.length;r++)t[r].RowHeight=i},setScrollTop:function(n){var t=this,i=t._$treegridHelper.ejTreeGrid("getMaxScrollHeight");t._isinBeginEdit&&t._$treegridHelper.ejTreeGrid("saveCell");(typeof n=="number"||typeof parseInt(n)=="number")&&(n=parseInt(n),n>=0&&(i>=n?t._$ganttchartHelper.ejGanttChart("onScrollHelper",n):t._$ganttchartHelper.ejGanttChart("onScrollHelper",i)))},_rightClick:function(t){t.preventDefault();var i=this,e=i.model,o=n(t.target),h=o.closest("tr"),s,c,r,u,l,f={};i._$treegridHelper.ejTreeGrid("disableTooltip");i.clearColumnMenu();n(h).hasClass("e-chartcell")||n(h).hasClass("e-ganttrowcell")?(s=i._$ganttchartHelper.ejGanttChart("getGanttChartRows"),f.target="ejTreeGrid"):(s=n(i._$treegridHelper.ejTreeGrid("getRows")),f.target="ejGanttChart");c=o.closest("tr");r=s.index(c);i.model.currentViewData=i.getCurrentViewData();u=i.model.currentViewData[r];r=i.model.updatedRecords.indexOf(u);f.data=u;f.recordIndex=r;u&&i.model.enableContextMenu?(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._updateIndentOutdentContextmenuOption(u),i._clearContextMenu(),i._contextMenuItems.length>0&&(i.model.readOnly!=!0&&i.model.editSettings.allowAdding||(i._removeContextMenuItem("Below"),i._removeContextMenuItem("Above")),i._renderContextMenu(t,r,u)),e.selectionMode=="row"&&(r!=i.model.selectedRowIndex&&i.rowSelected(f),i._$treegridHelper.ejTreeGrid("selectRows",r),i._$ganttchartHelper.ejGanttChart("selectRows",r),i.updateIndentOutdentOption(f.data)),e.selectionMode=="cell"&&(i._rowIndexOfLastSelectedCell=r,l=i._$treegridHelper.ejTreeGrid("getCellIndex",t),n(o.closest("td")).hasClass("e-chartcell")||i.selectCells([{rowIndex:r,cellIndex:l}])),e.editSettings.beginEditAction=="click"&&n("#ejTreeGrid"+i._id+"EditForm").length>0&&(i._$treegridHelper.ejTreeGrid("saveCell"),i._isinBeginEdit=!1)):i.model.flatRecords.length===0&&i.model.enableContextMenu&&(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._contextMenuItems.splice(5,2),i._updateIndentOutdentContextmenuOption(u),i._clearContextMenu(),i._contextMenuItems.length>0&&i._renderContextMenu(t,r,u))},_mousedownhandler:function(t){var i=n(t.target),r=this;r._clearContextMenu();(i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vdown")||i.hasClass("e-vhandlespace")||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||i.hasClass("e-splitbar"))&&r.clearColumnMenu()},_removeContextMenuItem:function(n){var u=this,r,t=u._contextMenuItems,i;i=t.filter(function(t){if(t.menuId===n)return!0});i.length>0&&(r=t.indexOf(i[0]),t.splice(r,1))},_updateIndentOutdentContextmenuOption:function(n){var t=this,i=t.model,u=this.model.flatRecords,r=u.indexOf(n),f;t.model.readOnly==!0?(t._removeContextMenuItem("Add"),t._removeContextMenuItem("Task"),t._removeContextMenuItem("Delete"),t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")):(r===0?(t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")):r>0?n.level===0?t._removeContextMenuItem("Outdent"):(f=u[r-1],n.level-f.level==1&&t._removeContextMenuItem("Indent")):r<0&&(t._removeContextMenuItem("Task"),t._removeContextMenuItem("Delete"),t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")),i.editSettings.allowAdding||t._removeContextMenuItem("Add"),i.editSettings.allowDeleting||t._removeContextMenuItem("Delete"),i.editSettings.allowEditing||t._removeContextMenuItem("Task"),i.editSettings.allowIndent||(t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")))},queryTaskbarInfo:function(n){this._trigger("queryTaskbarInfo",n)},zoomingChart:function(n){var t=this;t.reRenderChart(n.delta)},refreshRowData:function(n){var t=this,i=t._$treegridHelper.ejTreeGrid("instance");r.TreeGrid.refreshRow(i,n.index)},expanding:function(n){var t=this;if(!t._trigger("expanding",n)){if(t.model.enableVirtualization)r.TreeGrid.sendExpandCollapseRequest(t,n);else{if(t._isInExpandCollapse=!0,t._isRefreshAddedRecord){n.data.expanded=!0;t._$treegridHelper.ejTreeGrid("updateExpandStatus",n.data,!0);t._refreshChartAndGridRows();t._isRefreshAddedRecord=!1;return}r.TreeGrid.sendExpandCollapseRequest(t,n);t._isInExpandCollapse=!1}t.updateSelectedItemIndex()}},collapsing:function(t){var i=this,o=this.model,u=n("#"+i._id+"_toolbarItems"),f,e;if(!i._trigger("collapsing",t)){if(i.model.enableVirtualization)r.TreeGrid.sendExpandCollapseRequest(i,t);else{if(i._isInExpandCollapse=!0,i._isRefreshAddedRecord){t.data.expanded=!1;i._$treegridHelper.ejTreeGrid("updateExpandStatus",t.data,!1);i._refreshChartAndGridRows();i._isRefreshAddedRecord=!1;return}i._gridRows=i.getRows();r.TreeGrid.sendExpandCollapseRequest(i,t);i._isInExpandCollapse=!1}f=i.selectedItem();f&&(e=i.getExpandStatus(f),e||t.expanded?i.updateSelectedItemIndex():(i._deSelectRowItem(),o.toolbarSettings.showToolbar&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&(n(u).ejToolbar("disableItem",n(u).find(".e-deleteitem").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-indent").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-outdent").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-edititem").parent()[0]))))}},refreshRow:function(n){var t=this;t._$ganttchartHelper.ejGanttChart("refreshRow",n.recordIndex)},_enableEditingEvents:function(){var t=this,i=t.model;t._off(n("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick);t._off(n("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick);(i.editSettings.allowEditing||i.editSettings.editMode=="dialogTemplate"||i.toolbarSettings.showToolbar&&(i.editSettings.allowAdding&&i.toolbarSettings.toolbarItems.indexOf("add")!==-1||i.editSettings.allowEditing&&i.toolbarSettings.toolbarItems.indexOf("index")!==-1))&&(t._on(n("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick),t._on(n("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick))},cancelEditCell:function(){var t=this;n("#ejTreeGrid"+t._id+"EditForm").length>0&&t._$treegridHelper.ejTreeGrid("cancelEditCell")},_keyPressed:function(){},_buttonClick:function(t){var e;if(t.type!="click"&&t.keyCode!==u&&t.keyCode!=13)return!0;var i=this,f=i.model;return f.editSettings.allowEditing||f.editSettings.editMode=="dialogTemplate"||f.toolbarSettings.showToolbar&&(f.editSettings.allowAdding&&f.toolbarSettings.toolbarItems.indexOf("add")!==-1||f.editSettings.allowEditing&&f.toolbarSettings.toolbarItems.indexOf("index")!==-1)?t.target.id=="EditDialog_"+i._id+"_Save"?i._sendSaveRequest("Edit")||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+i._id+"_Cancel"?(f.selectedItem.resourceInfo&&f.selectedItem._updateUnitWithWork(i),n("#"+i._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+i._id+"_Delete"?(e=f.allowSelection!=!1||r.isNullOrUndefined(i._contextMenuSelectedIndex)?i._$treegridHelper.ejTreeGrid("deleteRow"):i._$treegridHelper.ejTreeGrid("deleteRow",null,!0,i._contextMenuSelectedIndex),e==!0||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogEdit").ejDialog("close"))):t.target.id=="AddDialog_"+i._id+"_Save"?i._sendSaveRequest("Add")||this._duplicate||this._wrongenddate||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogAdd").ejDialog("close")):t.target.id=="AddDialog_"+i._id+"_Cancel"&&n("#"+i._id+"_dialogAdd").ejDialog("close"):i._sendCancelRequest(),!1},rowDrag:function(n){var t=this;t.model.selectedCellIndexes=[];t._trigger("rowDrag",n)},rowDragStart:function(n){var t=this;t._trigger("rowDragStart",n)},rowDragStop:function(n){var t=this;t._trigger("rowDragStop",n)},cellSelecting:function(n){var t=this,i=t.model;t._trigger("cellSelecting",n)},cellSelected:function(n){var t=this,i=t.model;t._trigger("cellSelected",n);i.selectedCellIndexes=t._$treegridHelper.ejTreeGrid("instance").model.selectedCellIndexes;t._rowIndexOfLastSelectedCell=i.selectedCellIndexes[0].rowIndex},rowSelecting:function(n){var i=this,t={},u=this.model;return i.model.rowSelecting&&u.selectionMode=="row"&&(t.recordIndex=n.recordIndex,t.previousIndex=n.previousIndex,t.previousData=u.updatedRecords[n.previousIndex],t.data=u.updatedRecords[n.recordIndex],t.previousChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",n.previousIndex),t.previousGridRow=r.TreeGrid.getRowByIndex(this,n.previousIndex),t.targetChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",n.recordIndex),t.targetGridRow=r.TreeGrid.getRowByIndex(this,n.recordIndex),i._trigger("rowSelecting",t))?!1:!0},rowSelected:function(t){var i=this,e=this.model,u=n("#"+i._id+"_toolbarItems"),h,o,s,f;e.allowSelection&&(t.target=="ejTreeGrid"&&i._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex),t.target=="ejGanttChart"&&i._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex));h=t.recordIndex;this.selectedItem(t.data);this.selectedRowIndex(h);i.model.toolbarSettings.showToolbar&&t.requestType!="rowDragAndDrop"&&(i.model.readOnly==!0?(o=[],o.push(n(u).find(".e-deleteitem").parent()[0]),o.push(n(u).find(".e-addnewitem").parent()[0]),o.push(n(u).find(".e-edititem").parent()[0]),n(u).ejToolbar("disableItem",o)):((i.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1||i.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1)&&i.model.allowSelection&&i.updateIndentOutdentOption(t.data),s=[],i.model.editSettings.allowDeleting&&i.model.allowSelection&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&s.push(n(u).find(".e-deleteitem").parent()[0]),i.model.editSettings.allowAdding&&i.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&s.push(n(u).find(".e-addnewitem").parent()[0]),i.model.editSettings.allowEditing&&i.model.allowSelection&&e.editSettings.beginEditAction!="click"&&i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&s.push(n(u).find(".e-edititem").parent()[0]),n(u).ejToolbar("enableItem",s)));f={};f.recordIndex=t.recordIndex;data=n.extend({},e.updatedRecords[t.recordIndex]);delete data.childRecords;delete data.parentItem;f.data=data;f.targetChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",t.recordIndex);f.targetGridRow=r.TreeGrid.getRowByIndex(this,t.recordIndex);e.allowSelection&&e.selectionMode=="row"&&i._trigger("rowSelected",f)},_treeGridRowHover:function(n){var t=this;n.reason=="mouseenter"?t._$ganttchartHelper.ejGanttChart("addRowHover",n.index):n.reason=="mouseleave"&&t._$ganttchartHelper.ejGanttChart("removeRowHover")},updateIndentOutdentOption:function(t){var r=this,e=r.model.flatRecords,o=e.indexOf(t),s,i=n("#"+r._id+"_toolbarItems"),u=n(i).find(".e-indent").parent()[0],f=n(i).find(".e-outdent").parent()[0];o===0||r.model.editSettings.allowIndent==!1||r.model.readOnly==!0?(u&&n(i).ejToolbar("disableItem",u),f&&n(i).ejToolbar("disableItem",f)):t.level===0&&r.model.editSettings.allowIndent==!0?(u&&n(i).ejToolbar("enableItem",u),f&&n(i).ejToolbar("disableItem",f)):(s=e[o-1],t.level-s.level==1&&r.model.editSettings.allowIndent==!0&&r.selectedRowIndex()!=-1?(f&&n(i).ejToolbar("enableItem",f),u&&n(i).ejToolbar("disableItem",u)):r.model.editSettings.allowIndent==!0&&r.selectedRowIndex()!=-1&&(u&&n(i).ejToolbar("enableItem",u),f&&n(i).ejToolbar("enableItem",f)))},_ganttChartRowHover:function(n){var t=this;n.reason=="mouseenter"?t._$treegridHelper.ejTreeGrid("addRowHover",n.index):n.reason=="mouseleave"&&t._$treegridHelper.ejTreeGrid("removeRowHover")},_removeChildRecordsPredecessor:function(n){var i=this,r,t;if(n.hasChildRecords)for(r=n.childRecords.length,t=0,t;t<r;t++)n.childRecords[t].predecessor&&i._removePredecessor(n.childRecords[t].predecessor,n.childRecords[t]),n.childRecords[t].hasChildRecords&&i._removeChildRecordsPredecessor(n.childRecords[t])},getExpandedRecordCount:function(n,t){var i,u=this,r;if(!n.hasChildRecords)return 0;for(r=0;r<n.childRecords.length;r++)i=n.childRecords[r],u.getExpandStatus(i)&&t++,i.hasChildRecords&&(t=u.getExpandedRecordCount(i,t));return t},_updateExpandStatus:function(){for(var i=this,t=this.model.flatRecords,r=t.length,u,n=0;n<r;n++)u=t[n].isExpanded,i.getExpandStatus(t[n])!==t[n].isExpanded&&(t[n].isExpanded=i.getExpandStatus(t[n]),t[n].isExpanded?i._totalCollapseRecordCount--:i._totalCollapseRecordCount++)},actionComplete:function(n){var t=this,i=t.model,o=-1,h,c,f,e,s;if(t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t._gridRows=t.getRows(),t._ganttChartRows=t.getGanttChartRows(),t._totalCollapseRecordCount=t._$treegridHelper.ejTreeGrid("getCollapsedRecordCount"),(n.requestType==="searching"||n.requestType==="sorting")&&(t._isRefreshAddedRecord=!1,t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords,t._totalCollapseRecordCount),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection(),this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)),n.requestType=="sorting"&&t._deSelectRowItem(),n.requestType==="delete"){if(t._isRefreshAddedRecord=!1,this.dataSource(t._$treegridHelper.ejTreeGrid("getDataSource")),t._isDataManagerUpdate&&(this._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),t.model.flatRecords=t._$treegridHelper.ejTreeGrid("getFlatRecords"),t.model.ids=t._$treegridHelper.ejTreeGrid("getUpdatedIds"),t.model.updatedRecords=t.getUpdatedRecords(),i.selectedItem=null,this.selectedRowIndex(-1),h=0,c=0,i.parentRecords.indexOf(n.data)!==-1&&i.parentRecords.splice(i.parentRecords.indexOf(n.data),1),n.data.hasChildRecords&&t._removeChildRecordsPredecessor(n.data),n.isDragAndDropDelete||n.data.predecessor&&t._removePredecessor(n.data.predecessor,n.data),n.data.parentItem&&(parentRecord=n.data.parentItem,n.data.parentItem.childRecords.length>0?n.data.parentItem.isAutoSchedule?t._updateParentItem(n.data):n.data.parentItem.isAutoSchedule||t._updateManualParentItem(n.data):(parentRecord.expanded=!1,parentRecord.hasChildRecords=!1,t.refreshGanttRecord(parentRecord))),n.isDragAndDropDelete)return;t._isValidationEnabled=!1;t.model.predecessorMapping&&(t._connectorlineIds=[],t._connectorLinesCollection=[],t._predecessorsCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection());this.isCriticalPathEnable==!0&&this.showCriticalPath(!0,!0);t._$ganttchartHelper.ejGanttChart("refreshHelper",t.getCurrentViewData(),t.getUpdatedRecords(),t._totalCollapseRecordCount);t._updateToolbarOptions();t.updateAltRow(t.getUpdatedRecords(),0,1);this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)}if(n.requestType==="selection"&&t._$ganttchartHelper.ejGanttChart("selectRows",n.recordIndex),n.requestType==="rowHover"&&t._$ganttchartHelper.ejGanttChart("addRowHover",n.index),n.requestType==="scroll"&&t._$ganttchartHelper.ejGanttChart("onScrollHelper",n.delta),n.requestType=="dragAndDrop"&&(t._isRefreshAddedRecord=!1,this.dataSource(t._$treegridHelper.ejTreeGrid("getDataSource")),t._isDataManagerUpdate&&(this._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),i.flatRecords=t._$treegridHelper.ejTreeGrid("getFlatRecords"),i.ids=t._$treegridHelper.ejTreeGrid("getUpdatedIds"),i.updatedRecords=t.getUpdatedRecords(),f=n.draggedRow.parentItem,n.droppedPosition=="insertAsChild"&&f&&(f.taskType=r.Gantt.TaskType.FixedDuration,f.effortDriven="false"),i.predecessorMapping&&(n.droppedPosition=="insertAsChild"&&(f.predecessor&&t._removePredecessor(f.predecessor,f),f.item[i.predecessorMapping]=u,f.predecessorsName=u,f.predecessor=u),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection(),t._isValidationEnabled=!0),n.draggedRow.parentItem&&n.draggedRow.parentItem.isAutoSchedule?t._updateParentItem(n.draggedRow):n.draggedRow.parentItem&&!n.draggedRow.parentItem.isAutoSchedule&&t._updateManualParentItem(n.draggedRow),this.isCriticalPathEnable==!0&&this.showCriticalPath(!0,!0),n.draggedRow&&t._$ganttchartHelper.ejGanttChart("refreshHelper",t.getCurrentViewData(),t.getUpdatedRecords(),t._totalCollapseRecordCount),this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)),n.requestType==="save"&&(n._cAddedRecord?(i.enableWBS&&i.enableWBSPredecessor&&i.predecessorMapping&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n._cAddedRecord),t._renderAddedRow(n.index,n._cAddedRecord),n._cAddedRecord.parentItem&&n._cAddedRecord.parentItem.isAutoSchedule?t._updateParentItem(n._cAddedRecord):n._cAddedRecord.parentItem&&!n._cAddedRecord.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cAddedRecord),r.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0),t.selectRows(i.updatedRecords.indexOf(n._cAddedRecord)),o=t.selectedRowIndex(),i.enableVirtualization||(e={},e.index=e.recordIndex=i.currentViewData.indexOf(n._cAddedRecord),t.refreshRowData(e),t.refreshRow(e))):n._cModifiedData&&(n._cModifiedData.hasChildRecords&&n._cModifiedData.isAutoSchedule?(n._cModifiedData.startDate=t._checkStartDate(n._cModifiedData.manualStartDate,n._cModifiedData),n._cModifiedData.left=n._cModifiedData._calculateManualLeft(this),n._cModifiedData.width=n._cModifiedData._calculateManualWidth(this),n._cModifiedData.progressWidth=n._cModifiedData._getProgressWidth(n._cModifiedData.width,n._cModifiedData.status),n._cModifiedData.endDate=n._cModifiedData.manualEndDate,n._cModifiedData._calculateDuration(this)):n._cModifiedData.hasChildRecords&&!n._cModifiedData.isAutoSchedule?(n._cModifiedData.left=n._cModifiedData._calculateLeft(this),n._cModifiedData.width=n._cModifiedData._calculateWidth(this),n._cModifiedData._calculateDuration(this),n._cModifiedData.manualStartDate=n._cModifiedData.startDate,n._cModifiedData.manualEndDate=n._cModifiedData.endDate,t._updateManualParentItem(n._cModifiedData,null,!0)):(n._cModifiedData.startDate=t._checkStartDate(n._cModifiedData.startDate,n._cModifiedData),n._cModifiedData.endDate=t._getEndDate(n._cModifiedData.startDate,n._cModifiedData.duration,n._cModifiedData.durationUnit,n._cModifiedData),n._cModifiedData.left=n._cModifiedData._calculateLeft(this),n._cModifiedData.width=n._cModifiedData._calculateWidth(this),n._cModifiedData.progressWidth=n._cModifiedData._getProgressWidth(n._cModifiedData.width,n._cModifiedData.status)),i.enableWBS&&i.enableWBSPredecessor&&i.predecessorMapping&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n._cModifiedData),t.refreshGanttRecord(n._cModifiedData),n._cModifiedData.parentItem&&n._cModifiedData.parentItem.isAutoSchedule?t._updateParentItem(n._cModifiedData):n._cModifiedData.parentItem&&!n._cModifiedData.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cModifiedData),n._cModifiedData.predecessor&&n.previousValue&&t._removeConnectorLine(n.previousValue,n._cModifiedData)),t.model.predecessorMapping&&(t._isValidationEnabled=n._cModifiedData&&n._cModifiedData.predecessor?!0:!1,n._cAddedRecord?(n._cAddedRecord.predecessor&&(t._validatePredecessorDates(n._cAddedRecord),t._addConnectorLine(n._cAddedRecord)),t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection()):n._cModifiedData&&(n.previousValue&&t._removeConnectorLine(n.previousValue,n._cModifiedData),t._addConnectorLine(n._cModifiedData),n._cModifiedData.predecessor&&(t._isUpdateOffset&&(t._editedTaskBarItem=n._cModifiedData),t._isMileStoneEdited=n._cModifiedData.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._validatePredecessor(n._cModifiedData,n.previousValue),t._isUpdateOffset&&(t._editedTaskBarItem=null),t._updatedConnectorLineCollection.length>0&&(t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection))),n._cModifiedData.parentItem&&n._cModifiedData.parentItem.isAutoSchedule?t._updateParentItem(n._cModifiedData):n._cModifiedData.parentItem&&!n._cModifiedData.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cModifiedData))),this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))),n.requestType==="validatePredecessor"){s=t._editedPredecessorValidation(n);n.result=s;return}t._ganttActionCompleteTrigger(n);o>=0&&t.focusOnTask(o)},focusOnTask:function(n){var r=this,h=r.model,o=r.element.find(".e-ganttviewerbodyContianer"),u=o.ejScroller("instance"),f=h.updatedRecords[n].left,s=u.model.width,i=u.model.scrollLeft,e=u._hScrollbar,t;e&&(e.model.maximum<i&&(i=e.model.maximum),(i>f||i+s<f)&&(t=f-s/2,t=t<0?0:t,o.ejScroller("scrollX",t,!0)));r._$ganttchartHelper.ejGanttChart("updateScrollBar")},calculateEndDate:function(n){var t=this,i=this._getEndDate(t._checkStartDate(n.startDate,n.record),n.duration,n.durationUnit,n.record);t._$ganttchartHelper.ejGanttChart("updateEditedRecordEndDate",t._checkEndDate(i,n.record))},calculateDuration:function(n){var t=this,i=this._getDuration(t._checkStartDate(n.startDate,n.record),t._checkEndDate(n.endDate,n.record),n.durationUnit,n.isAutoSchedule);t._$ganttchartHelper.ejGanttChart("updateEditedRecordDuration",i)},expandAllCollapseAllRequest:function(t){var r=this,i=n(r.element),u=i.ejGantt("instance"),f=i.attr("id");u._toolbarOperation(f+"_"+t.requestType)},chartactionComplete:function(n){var t=this,f,o,i,s,e;t.model.updatedRecords=t.getUpdatedRecords();t.model.currentViewData=t.getCurrentViewData();n.requestType==="updateConnectors"&&t.model.predecessorMapping&&(f=n.ganttRecord,t._isMileStoneEdited=f.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._editedTaskBarItem=f,t._validatePredecessor(f),t._updatedConnectorLineCollection.length>0&&(t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection)),t._editedTaskBarItem=null);n.requestType==="rowHover"&&t._$treegridHelper.ejTreeGrid("addRowHover",n.index);n.requestType==="scroll"&&(t._isTreeGridRendered=!1,t._isGanttChartRendered=!1,n.vscrollExsist&&n.delta!==u&&t._$treegridHelper.ejTreeGrid("onScrollHelper",n.delta),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t.model.enableVirtualization&&t.model.predecessorMapping&&(t._connectorLinesCollection.length>0&&t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection()),t._isTreeGridRendered=!0,t._isGanttChartRendered=!0);n.requestType==="selection"&&t._$treegridHelper.ejTreeGrid("selectRows",n.recordIndex);n.requestType==="validatePredecessor"&&(o=t._editedPredecessorValidation(n),n.predecessorValidation=o);n.requestType==="drawConnectorLine"&&(i=n.toItem._calculatePredecessor(n.predecessor,this._durationUnitEditText,this.model.durationUnit),n.toItem.item[t.model.predecessorMapping]=n.predecessorString[0],n.toItem.predecessorsName=n.toItem.item[t.model.predecessorMapping],model.enableWBS&&model.enableWBSPredecessor&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n.toItem),n.fromItem.predecessor?n.fromItem.predecessor.push(i[0]):n.fromItem.predecessor=i,n.toItem.predecessor?n.toItem.predecessor.push(i[0]):(n.toItem.predecessor=[],n.toItem.predecessor.push(i[0])),t._isMileStoneEdited=n.toItem.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._isValidationEnabled=t.model.enablePredecessorValidation&&(n.toItem.isAutoSchedule||t.model.validateManualTasksOnLinking)?!0:!1,t._validatePredecessor(n.toItem),t._updatedConnectorLineCollection.length>0&&(t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection)),n.toItem.isAutoSchedule||t.model.validateManualTasksOnLinking||(s=t._$treegridHelper.ejTreeGrid("instance"),r.TreeGrid.refreshRow(s,t.model.currentViewData.indexOf(n.toItem))),e={},e.data=n.toItem,t._updateScheduleDatesOnEditing(e),this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0)));t._ganttActionCompleteTrigger(n)},hideColumn:function(n){var t=this;t._$treegridHelper.ejTreeGrid("hideColumn",n)},showColumn:function(n){var t=this;t._$treegridHelper.ejTreeGrid("showColumn",n)},clearColumnMenu:function(){var n=this;n._$treegridHelper.ejTreeGrid("clearColumnMenu")},deleteRow:function(){var n=this;n._$treegridHelper.ejTreeGrid("deleteRow")},taskbarEditing:function(n){this._trigger("taskbarEditing",n)},setInitialData:function(){this._setInitialData()},sortColumn:function(n,t){var i=this;i._$treegridHelper.ejTreeGrid("sortColumn",n,t)},clearSorting:function(){var n=this,t=n.model;n._$treegridHelper.ejTreeGrid("clearSorting")},"export":function(t,i,f){var o=this,e=o.model,ft={action:t,method:"post","data-ajax":"false"},c,s,v,h,it,rt,ut;n("form#"+o._id+"export").remove();var l=r.buildTag("form#"+o._id+"export","",null,ft),a=o.ignoreOnExport,nt=a.length;if(e.criticalTask=this.criticalPathCollection.join(),!f){var y=e.updatedRecords,p=e.currentViewData,w=e.flatRecords,b=e.parentRecords,k=e.selectedItem,d=e.selectedItems,g=e.workUnit;for(o._$treegridHelper.ejTreeGrid("contextMenuOperations","Cancel"),delete e.updatedRecords,delete e.currentViewData,delete e.flatRecords,delete e.parentRecords,delete e.selectedItem,delete e.selectedItems,delete e.workUnit,c=n.extend(!0,{},e),e.updatedRecords=y,e.currentViewData=p,e.flatRecords=w,e.parentRecords=b,e.selectedItem=k,e.selectedItems=d,e.workUnit=g,s=c.columns,v=s.length,h=0;h<v;h++)if(c.columns[h].editType!=u)switch(s[h].editType){case"stringedit":s[h].editType="string";break;case"numericedit":s[h].editType="numeric";break;case"dropdownedit":s[h].editType="dropdown";break;case"booleanedit":s[h].editType="boolean"}if(this.ignoreOnExport)for(h=0;h<nt;h++)delete c[a[h]]}if(r.raiseWebFormsServerEvents){var tt={durationText:o._durationUnitTexts,durationEditText:o._durationUnitEditText,taskTypeTexts:o._taskTypeTexts,effortDrivenTexts:o._effortDrivenTexts,taskModeTexts:o._taskModeTexts},et={model:c,originalEventType:i},ot={model:JSON.stringify(c),locale:JSON.stringify(tt)};r.raiseWebFormsServerEvents(i,et,ot)}else{it={};f?n("body").find(".e-gantt").each(function(t,i){var c=n(i).data("ejGantt"),f,h,o,tt,rt;if(!r.isNullOrUndefined(c)){for(f=c.model,y=f.updatedRecords,w=f.flatRecords,p=f.currentViewData,b=f.parentRecords,k=f.selectedItem,d=f.selectedItems,g=e.workUnit,delete f.updatedRecords,delete f.flatRecords,delete f.currentViewData,delete f.parentRecords,delete f.selectedItem,delete f.selectedItems,delete f.workUnit,h=JSON.parse(JSON.stringify(f)),f.updatedRecords=y,f.flatRecords=w,f.currentViewData=p,f.parentRecords=b,f.selectedItem=k,f.selectedItems=d,f.workUnit=g,s=h.columns,v=s.length,o=0;o<v;o++)if(s[o].editType!=u)switch(s[o].editType){case"stringedit":s[o].editType="string";break;case"numericedit":s[o].editType="numeric";break;case"dropdownedit":s[o].editType="dropdown";break;case"booleanedit":s[o].editType="boolean"}if(a){for(o=0;o<nt;o++)delete h[a[o]];it[t]=JSON.stringify(h);tt={name:"GanttModel",type:"hidden",value:JSON.stringify(h)};rt=r.buildTag("input","",null,tt);l.append(rt)}}}):(rt={name:"GanttModel",type:"hidden",value:JSON.stringify(c)},ut=r.buildTag("input","",null,rt),l.append(ut),l.append(this));var tt={durationText:o._durationUnitTexts,durationEditText:o._durationUnitEditText,taskTypeTexts:o._taskTypeTexts,effortDrivenTexts:o._effortDrivenTexts,taskModeTexts:o._taskModeTexts},st={name:"locale",type:"hidden",value:JSON.stringify(tt)},ht=r.buildTag("input","",null,st);l.append(ht);n("body").append(l);l.submit()}return!0},_refreshParent:function(n){this.refreshGanttRecord(n);n.parentItem&&this._refreshParent(n.parentItem)},taskbarEdited:function(n){var i=this,t=n.data,s=i.model,l=new Date(i._projectStartDate),f,u,h,c,e=s.scheduleHeaderSettings.scheduleHeaderType,o=r.Gantt.ScheduleHeaderType,nt=r.Gantt.DurationUnit,g,b,k,d,v,a;if(i._isValidationEnabled=!1,n.dragging){if(v="dragging",n.previousData.left!==t.left){if(f=t.left%i._perDayWidth,h=(t.left-f)/i._perDayWidth,u=f/i._perDayWidth,(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.left=t.left-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.left=t.left-f+a):u>.75&&(h+=1,u=0,t.left=t.left-f+i._perDayWidth)),c=e==o.Day||e==o.Hour?24:i._secondsPerDay/3600,c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);l=t._startDateUpdate(l,h,w,i._workingTimeRanges,e);t.startDate=i._checkStartDate(l,t);s.startDateMapping&&(t.item[s.startDateMapping]=t.startDate);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._isValidationEnabled=!0}}else if(n.rightResizing){if(v="Resizing",n.previousData.width!==t.width){if(e==o.Day||e==o.Hour?(g=new Date(t.startDate),b=new Date(t.startDate),b.setHours(0,0,0,0),k=g.getTime()-b.getTime(),d=k>0?t.width+k/864e5*i._perDayWidth:t.width,f=d%i._perDayWidth,h=(d-f)/i._perDayWidth,c=24):(f=t.width%i._perDayWidth,h=(t.width-f)/i._perDayWidth,c=i._secondsPerDay/3600),u=f/i._perDayWidth,startDate=i._getDateFromFormat(t.startDate),(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.width=t.width-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.width=t.width-f+a):u>.75&&(h+=1,u=0,t.width=t.width-f+i._perDayWidth)),c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);endDate=t._endDateUpdate(startDate,h-1,w,i._workingTimeRanges,e);t.endDate=i._checkEndDate(endDate,t);s.endDateMapping&&(t.item[s.endDateMapping]=t.endDate);t._calculateDuration(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._updatedColumn="duration";i._updateResourceRelatedFields(t)}}else if(n.leftResizing&&(v="Resizing",n.previousData.left!==t.left)){if(f=t.left%i._perDayWidth,h=(t.left-f)/i._perDayWidth,u=f/i._perDayWidth,(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.left=t.left-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.left=t.left-f+a):u>.75&&(h+=1,u=0,t.left=t.left-f+i._perDayWidth)),c=e==o.Day||e==o.Hour?24:i._secondsPerDay/3600,c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);l=t._startDateUpdate(l,h,w,i._workingTimeRanges,e);t.startDate=i._checkStartDate(l,t);s.startDateMapping&&(t.item[s.startDateMapping]=t.startDate);t.endDate=i._checkEndDate(t.endDate,t);t.isAutoSchedule&&s.includeWeekend==!1&&(e==o.Hour||e==o.Day)&&t._calculateEndDate(this);t._calculateDuration(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._updatedColumn="duration";i._updateResourceRelatedFields(t)}n.progressResizing?n.previousData.status!=n.data.status&&(t.status=t._getProgressPercent(t.width,t.progressWidth),t.parentItem&&t._updateParentProgress(t.parentItem,s.progressMapping),i._refreshParent(t)):(i._isValidationEnabled=!0,i._updateEditedGanttRecord(t),t.predecessor&&(i._isMileStoneEdited=t.isMilestone,i._updatedConnectorLineCollection=[],i._connectorlineIds=[],i._editedTaskBarItem=t,s.enablePredecessorValidation?i._validatePredecessor(t):i._validatePredecessorOnEditing(t),i._updatedConnectorLineCollection.length>0&&(i._$ganttchartHelper.ejGanttChart("appendConnectorLine",i._updatedConnectorLineCollection),this._updateConnectorLineCollection(i._updatedConnectorLineCollection))),i._editedTaskBarItem=null,t.isAutoSchedule||!t.hasChildRecords||n.isChildren||n.rightResizing||i._validateAutoChildRecords(n),t.parentItem&&t.parentItem.isAutoSchedule?i._updateParentItem(t,v):t.parentItem&&!t.parentItem.isAutoSchedule&&i._updateManualParentItem(t,v));i.refreshGanttRecord(t);i._trigger("taskbarEdited",n);!n.cancel&&(n.leftResizing||n.rightResizing||n.dragging)&&i._isValidationEnabled&&i._updateScheduleDatesOnEditing(n);this.isCriticalPathEnable==!0&&(i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_validatePredecessorOnEditing:function(n,t){var i=this,r=i.model,s=n.taskId.toString(),r=this.model,h=n.predecessor,u=r.flatRecords,f=r.ids,c=null,o=h.filter(function(n){return n.to===s}),l=h.filter(function(n){return n.from===s}),a=o.length,v,e;for(count=0;count<a;count++)predecessor=o[count],isOffsetChanged=i._isOffsetChange(predecessor,c,count),parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],t&&(i._validateChildGanttRecord(parentGanttRecord,record,predecessor,r.enablePredecessorValidation,isOffsetChanged),t=!1),connectorLineId="parent"+parentGanttRecord.taskId+"child"+record.taskId,i._$ganttchartHelper&&(i._$ganttchartHelper.ejGanttChart("removeConnectorline",connectorLineId),this._updateConnectorLineCollection(connectorLineId));for(count=0;count<a;count++)(predecessor=o[count],parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],r.enableVirtualization!==!1||parentGanttRecord.isExpanded!==!1&&record.isExpanded!=!1)&&(connectorLineObject=i._createConnectorLineObject(parentGanttRecord,record,predecessor),connectorLineObject&&(i._connectorlineIds.length>0&&i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)==-1?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.length==0?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)!=-1&&(e=i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId),i._updatedConnectorLineCollection[e]=connectorLineObject)));for(v=l.length,count=0;count<v;count++)(predecessor=l[count],parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],connectorLineId="parent"+parentGanttRecord.taskId+"child"+record.taskId,isOffsetChanged=i._isOffsetChange(predecessor,c,count),i._$ganttchartHelper&&(i._$ganttchartHelper.ejGanttChart("removeConnectorline",connectorLineId),this._updateConnectorLineCollection(connectorLineId)),t&&(i._validateChildGanttRecord(parentGanttRecord,record,predecessor,r.enablePredecessorValidation,isOffsetChanged),t=!1),r.enableVirtualization!==!1||parentGanttRecord.isExpanded!==!1&&record.isExpanded!=!1)&&(connectorLineObject=i._createConnectorLineObject(parentGanttRecord,record,predecessor),connectorLineObject&&(i._connectorlineIds.length>0&&i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)==-1?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.length==0?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)!=-1&&(e=i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId),i._updatedConnectorLineCollection[e]=connectorLineObject)))},_validateAutoChildRecords:function(t){for(var e=this,f=t.data,o=t.previousData,r=f.childRecords,u={},s=f.left-o.left,i=0;i<r.length;i++)r[i].isAutoSchedule&&!r[i].hasChildRecords&&(u.previousData=n.extend({},r[i]),r[i].left+=s,u.data=r[i],u.dragging=!0,t.isChildren=!0,e.taskbarEdited(u))},actionBegin:function(n){var t=this;t._trigger("actionBegin",n)||n.requestType==="beginedit"&&t._sendEditRequest()},_ganttActionCompleteTrigger:function(n){this._trigger("actionComplete",n);n.cancel||n.requestType!=="save"||(n._cModifiedData&&(n.data=n._cModifiedData),n._cAddedRecord&&(n.data=n._cAddedRecord),this._updateScheduleDatesOnEditing(n))},_queryCellInfo:function(n){this._trigger("queryCellInfo",n)},_beginEdit:function(t){var i=this,r=n("#"+i._id+"_toolbarItems"),u;if(!i._trigger("beginEdit",t)&&(i._isinBeginEdit=!0,i.model.toolbarSettings.showToolbar)){var f=[],e=n(r).find(".e-cancel").parent()[0],o=n(r).find(".e-saveitem").parent()[0];e&&f.push(e);o&&f.push(o);n(r).ejToolbar("enableItem",f);u=[];i.model.editSettings.allowAdding&&i.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&u.push(n(r).find(".e-addnewitem").parent()[0]);i.model.editSettings.allowEditing&&i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&u.push(n(r).find(".e-edititem").parent()[0]);i.model.editSettings.allowDeleting&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&u.push(n(r).find(".e-deleteitem").parent()[0]);n(r).ejToolbar("disableItem",u)}},_endEdit:function(t){var i=this,s=this.model,e=n("#"+i._id+"_toolbarItems"),u,r,o,f;i._trigger("endEdit",t)?(u="",t.data[t.columnName]=t.previousValue,t.columnName==="predecessor"?(u=i._predecessorToString(t.data.predecessor,t.data),t.data.item[t.columnObject.mappingName]=u,t.data.predecessorsName=u):(t.data.item[t.columnObject.mappingName]=t.previousValue,t.columnName==="resourceInfo"&&(i._updateResourceName(t.data),i._updateResourceRelatedFields(t.data)))):(i._updatedColumn=t.columnName,t.columnName=="taskType"&&t.value=="fixedWork"&&(t.data.effortDriven="true"),(t.columnName==="duration"||t.columnName=="work")&&i._updateResourceRelatedFields(t.data),t.columnName==="resourceInfo"&&(i._updateResourceName(t.data),i._updateResourceRelatedFields(t.data),i._isDurationUpdated==!1&&(r=t.data,o=t.data.hasChildRecords?!0:!1,o&&r.isAutoSchedule?i._updateParentItem(r,null,!0):o&&!r.isAutoSchedule&&i._updateManualParentItem(r,null,!0),r.parentItem&&r.parentItem.isAutoSchedule?i._updateParentItem(r,null,!1):r.parentItem&&!r.parentItem.isAutoSchedule&&i._updateManualParentItem(r,null,!1))),(t.isModified||i._isDurationUpdated)&&(i.model.currentViewData=i._$treegridHelper.ejTreeGrid("getCurrentViewData"),i._isValidationEnabled=t.data.isAutoSchedule||s.validateManualTasksOnLinking?!0:!1,i._updateEditedGanttRecords(t)));i._isDurationUpdated=!1;i._isinBeginEdit=!1;i.refreshGanttRecord(t.data);delete t.isModified;i.model.toolbarSettings.showToolbar&&(f=[],i.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&f.push(n(e).find(".e-cancel").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&f.push(n(e).find(".e-saveitem").parent()[0]),n(e).ejToolbar("disableItem",f));t.cancel||t.columnName!=="startDate"&&t.columnName!=="endDate"&&t.columnName!=="duration"&&t.columnName!=="baselineStartDate"&&t.columnName!=="baselineEndDate"||i._updateScheduleDatesOnEditing(t);t.cancel||t.columnName!=="taskMode"&&t.columnName!=="startDate"&&t.columnName!=="endDate"&&t.columnName!=="duration"&&t.columnName!=="status"&&t.columnName!=="predecessor"||this.isCriticalPathEnable==!0&&(i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_updateScheduleDatesOnEditing:function(n){var i=this,t=this.model,o=i._getDateFromFormat(n.data.startDate),c=i._getDateFromFormat(n.data.endDate),s=i._projectStartDate,l=i._getDateFromFormat(t.scheduleEndDate),v,y,p,w,u=!1,r=t.scheduleStartDate,b,f=t.scheduleEndDate,e;if(n.data.hasChildRecords&&!n.data.isAutoSchedule&&(o=i._getDateFromFormat(n.data.manualStartDate),c=i._getDateFromFormat(n.data.manualEndDate)),i._calculateDatesForScheduleCheck(o),t.predecessorMapping)e={},e.onEditing=!0,i._calculateScheduleDates(e),i._calculateDatesForScheduleCheck(e.minStartDate),e.minStartDate.getTime()<s&&(r=n.data._getFormatedDate(e.minStartDate,t.dateFormat,t.locale),u=!0),e.maxEndDate.getTime()>l&&(f=n.data._getFormatedDate(e.maxEndDate,t.dateFormat,t.locale),u=!0),u&&i.updateScheduleDates(r,f);else{if(o.getTime()>=s.getTime()&&o.getTime()<=l.getTime()||(o.getTime()<s.getTime()?(v=o,s=o):(y=i._getDateFromFormat(n.data.startDate),l=i._getDateFromFormat(n.data.startDate))),c.getTime()>=s.getTime()&&c.getTime()<=l.getTime()||(c.getTime()<s.getTime()?v=c:y=c),y&&(u=!0,f=n.data._getFormatedDate(y,t.dateFormat,t.locale)),v&&(u=!0,r=n.data._getFormatedDate(v,t.dateFormat,t.locale)),t.renderBaseline&&n.data.baselineStartDate&&n.data.baselineEndDate){var h=i._getDateFromFormat(n.data.baselineStartDate),a=i._getDateFromFormat(n.data.baselineEndDate),r=i._getDateFromFormat(r),f=i._getDateFromFormat(f);h.getTime()>=r.getTime()&&h.getTime()<=f.getTime()||(h.getTime()<r.getTime()?(p=h,s=h):(w=h,l=h));a.getTime()>=r.getTime()&&a.getTime()<=f.getTime()||(a.getTime()<r.getTime()?p=a:w=a)}w&&(u=!0,f=n.data._getFormatedDate(w,t.dateFormat,t.locale));p&&(u=!0,r=n.data._getFormatedDate(p,t.dateFormat,t.locale));u&&(b=i._updateScheduleDatesByTaskLables(i._getDateFromFormat(r),i._getDateFromFormat(f)),i.updateScheduleDates(n.data._getFormatedDate(b.minStartDate,t.dateFormat,t.locale),n.data._getFormatedDate(b.maxEndDate,t.dateFormat,t.locale)))}},_calculateDatesForScheduleCheck:function(n){var f=this,u=this.model,t=u.scheduleHeaderSettings.scheduleHeaderType,i=r.Gantt.ScheduleHeaderType;t==i.Week&&n.setDate(n.getDate()-3);t==i.Year&&n.setDate(n.getDate()-5);t==i.Month&&n.setDate(n.getDate()-3);t==i.Day&&n.setHours(n.getHours()-2);t==i.Hour&&n.setMinutes(n.getMinutes()-5)},_updateScheduleDatesByToolBar:function(t){var i=this,f=this.model,u=t==="prevTimeSpan"?i._projectStartDate:i._getDateFromFormat(i.model.scheduleStartDate);endDate=i._getDateFromFormat(i.model.scheduleEndDate);chartObject=n("#ejGanttChart"+i._id).ejGanttChart("instance");scheduleHeaderType=f.scheduleHeaderSettings.scheduleHeaderType;scheduleHeaderValue=r.Gantt.ScheduleHeaderType;maxScrollWidth=0;scheduleHeaderType==scheduleHeaderValue.Week&&(t==="prevTimeSpan"?u.setDate(u.getDate()-6):endDate.setDate(endDate.getDate()+7));scheduleHeaderType==scheduleHeaderValue.Year&&(t==="prevTimeSpan"?u.setDate(u.getDate()-360):endDate.setDate(endDate.getDate()+365));scheduleHeaderType==scheduleHeaderValue.Month&&(t==="prevTimeSpan"?u.setMonth(u.getMonth()-1):endDate.setDate(endDate.getDate()+30));scheduleHeaderType==scheduleHeaderValue.Day&&(t==="prevTimeSpan"?u.setDate(u.getDate()-1):endDate.setDate(endDate.getDate()+1));scheduleHeaderType==scheduleHeaderValue.Hour&&(t==="prevTimeSpan"?u.setHours(u.getHours()-1):endDate.setHours(endDate.getHours()+1));t==="prevTimeSpan"?(i.updateScheduleDates(i._getFormatedDate(u,f.dateFormat,f.locale),i._getFormatedDate(endDate,f.dateFormat,f.locale)),chartObject._$bodyContainer.ejScroller("scrollX",0,!0),i.isCriticalPathEnable==!0&&f.predecessorMapping&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",i.criticalPathCollection,i.detailPredecessorCollection,!0,i.collectionTaskId)):t==="nextTimeSpan"&&(i.updateScheduleDates(i._getFormatedDate(u,f.dateFormat,f.locale),i._getFormatedDate(endDate,f.dateFormat,f.locale)),maxScrollWidth=chartObject.getMaxScrollWidth(),chartObject._$bodyContainer.ejScroller("scrollX",maxScrollWidth,!0),i.isCriticalPathEnable==!0&&f.predecessorMapping&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",i.criticalPathCollection,i.detailPredecessorCollection,!0,i.collectionTaskId))},_rowDataBound:function(n){this._trigger("rowDataBound",n)},_refreshToolBar:function(){var t=n("#"+this._id+"_toolbarItems");t.find("li").removeClass("e-hover")},_toolBarClick:function(t){var f=this,c=f.model,e=n(this.itemsContainer).closest(".e-gantt"),r=e.ejGantt("instance"),i=e.attr("id"),o=n("#"+r._id+"_toolbarItems");if(r._clearContextMenu(),t.event==u&&t.target.tagName=="INPUT"&&t.currentTarget.id==i+"_search")return!1;r.model.dateFormat.toLowerCase().indexOf("hh")!=-1?n.isFunction(n.fn.ejDateTimePicker)&&n("#"+i+"EditForm").find(".e-datetimepicker").ejDateTimePicker("hide"):n.isFunction(n.fn.ejDatePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDatePicker("hide");var s=t.currentTarget,l=t.target,h={itemName:t.text,currentTarget:s,model:r.model};if(e.ejGantt("instance")._trigger("toolbarClick",h))return!1;n(o).ejToolbar("deselectItem",t.currentTarget);switch(t.currentTarget.id){case i+"_excelExport":r._toolbarOperation(i+"_excelExport");break;case i+"_pdfExport":r._toolbarOperation(i+"_pdfExport");break;case i+"_add":r._toolbarOperation(i+"_add");break;case i+"_edit":r._toolbarOperation(i+"_edit");break;case i+"_delete":r._toolbarOperation(i+"_delete");break;case i+"_update":r._toolbarOperation(i+"_update");break;case i+"_cancel":r._toolbarOperation(i+"_cancel");break;case i+"_search":r._toolbarOperation(i+"_search",n(t.currentTarget).find("input").val());break;case i+"_indent":r._toolbarOperation(i+"_indent");break;case i+"_outdent":r._toolbarOperation(i+"_outdent");break;case i+"_expandAll":r._toolbarOperation(i+"_expandAll");break;case i+"_criticalPath":r._enableDisableCriticalIcon?r._enableDisableCriticalIcon&&r._toolbarOperation(i+"_criticalDisable"):r._toolbarOperation(i+"_criticalEnable");break;case i+"_collapseAll":r._toolbarOperation(i+"_collapseAll");break;case i+"_prevTimeSpan":r._toolbarOperation(i+"_prevTimeSpan");break;case i+"_nextTimeSpan":r._toolbarOperation(i+"_nextTimeSpan");break;case"milestoneTemplate":f._milestoneTemplate(options[option]);break;case"taskbarTemplate":f._taskbarTemplate(options[option]);break;case"parentTaskbarTemplate":f._parentTaskbarTemplate(options[option])}return!1},_toolbarOperation:function(t,i){var o=this.element,f=o.ejGantt("instance"),u=o.attr("id"),r=this,s=r.selectedRowIndex(),e;f._exportTo=f["export"];e=n("#"+r._id+"_toolbarItems");switch(t){case u+"_add":r._sendAddRequest();break;case u+"_edit":r._sendEditRequest();break;case u+"_delete":r._$treegridHelper.ejTreeGrid("deleteRow");r._isRefreshAddedRecord=!1;break;case u+"_update":r._$treegridHelper.ejTreeGrid("endEdit");r.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&r._disabledToolItems.push(n(e).find(".e-cancel").parent()[0]);r.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&r._disabledToolItems.push(n(e).find(".e-saveitem").parent()[0]);n(e).ejToolbar("disableItem",r._disabledToolItems);r._disabledToolItems=[];break;case u+"_cancel":r._$treegridHelper.ejTreeGrid("cancelEditCell");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_criticalEnable":r.showCriticalPath(!0);r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_criticalDisable":r.showCriticalPath(!1);r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_search":r.cancelEditCell();r._searchString!=i&&(r._$treegridHelper.ejTreeGrid("search",i),r._searchString=i,r.updateSelectedItemIndex(),r._updateToolbarOptions(),r._isRefreshAddedRecord=!1);break;case u+"_indent":r._sendIndentRequest();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");r._isRefreshAddedRecord=!1;break;case u+"_outdent":r._sendOutdentRequest();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");r._isRefreshAddedRecord=!1;break;case u+"_expandAll":r._expandAll();r.updateSelectedItemIndex();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_collapseAll":r._collapseAll();r.updateSelectedItemIndex();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_prevTimeSpan":r._updateScheduleDatesByToolBar("prevTimeSpan");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_nextTimeSpan":r._updateScheduleDatesByToolBar("nextTimeSpan");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_excelExport":r._exportTo(f.model.exportToExcelAction,"excelExporting",f.model.allowMultipleExporting);break;case u+"_pdfExport":r._exportTo(f.model.exportToPdfAction,"pdfExporting",f.model.allowMultipleExporting)}return r._refreshToolBar(),!1},updateSelectedItemIndex:function(){var n=this,t=this.model,u=t.updatedRecords,i;t.allowSelection&&!r.isNullOrUndefined(this.selectedItem())?n.getExpandStatus(this.selectedItem())?(i=u.indexOf(this.selectedItem()),n.selectRows(i)):n.selectRows(-1):t.allowSelection||r.isNullOrUndefined(this.selectedItem())||n.selectRows(-1)},clearSelection:function(){var n=this;n.model.selectedCellIndexes=[];n._$treegridHelper.ejTreeGrid("clearSelection");n._$ganttchartHelper.ejGanttChart("clearSelection")},selectCells:function(n,t){var i=this,r=i.model;r.selectionMode=="cell"&&r.allowSelection&&i._$treegridHelper.ejTreeGrid("selectCells",n,t)},selectRows:function(n){var i=this,u=this.model,t;u.selectionMode!="cell"&&(n!==-1&&!r.isNullOrUndefined(n)&&n<u.updatedRecords.length?(t={},t.recordIndex=n,t.data=u.updatedRecords[t.recordIndex],t.target="ejTreeGrid",i.rowSelecting(t)&&(i.rowSelected(t),i._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex),i._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex)),i.updateIndentOutdentOption(t.data)):n===-1&&(i._deSelectRowItem(),i._updateToolbarOptions()))},_setModel:function(t){var i=this,u,f=i.model,o,s,e;for(u in t)switch(u){case"sortSettings":i._sendSortingRequest(t[u]);break;case"allowSorting":i._sortingRequest(t[u]);f.showColumnChooser&&f.showColumnOptions&&i._$treegridHelper.ejTreeGrid("columnAddDialogTemplate");break;case"allowMultiSorting":f.allowMultiSorting=t[u];i._$treegridHelper.ejTreeGrid("model.allowMultiSorting",f.allowMultiSorting);break;case"destroy":i.destroy();break;case"treeColumnIndex":i._columnIndex(t[u]);break;case"allowGanttChartEditing":i._ganttChartEditing(t[u]);break;case"enableProgressBarResizing":i._resizeProgressbar(t[u]);break;case"enableTaskbarTooltip":i._showTooltip(t[u]);break;case"enableTaskbarDragTooltip":i._showEditingTooltip(t[u]);break;case"validateManualTasksOnLinking":f.validateManualTasksOnLinking=t[u];break;case"enableAltRow":i._updateAltRow(t[u]);break;case"locale":f.flatRecords=[];f.parentRecords=[];i._clearContextMenu();f.locale=t[u];f.isRerender=!0;i.element.ejGantt("destroy").ejGantt(f);break;case"allowSelection":f.allowSelection=t[u];f.allowSelection?(i._$treegridHelper.ejTreeGrid("instance").model.allowSelection=!0,i._$ganttchartHelper.ejGanttChart("instance").model.allowSelection=!0):(i._deSelectRowItem(),i._$treegridHelper.ejTreeGrid("instance").model.allowSelection=!1,i._$ganttchartHelper.ejGanttChart("instance").model.allowSelection=!1);i._updateToolbarOptions();break;case"editSettings":n.extend(f.editSettings,t[u]);i._updateEditSettings(t[u]);i._initiateDialogTemplates();i._enableEditingEvents();this.cancelEditCell();break;case"taskbarBackground":i._updateTaskbarBackground(t[u]);break;case"progressbarBackground":i._updateProgressbarBackground(t[u]);break;case"parentTaskbarBackground":i._updateParentTaskbarBackground(t[u]);break;case"parentProgressbarBackground":i._updateParentProgressbarBackground(t[u]);break;case"showTaskNames":i._updateRenderTaskNames(t[u]);break;case"leftTaskLabelMapping":i._refreshLeftTaskLabelMapping(t[u]);break;case"rightTaskLabelMapping":i._refreshRightTaskLabelMapping(t[u]);break;case"leftTaskLabelTemplate":i._refreshLeftTaskLabelTemplate(t[u]);break;case"rightTaskLabelTemplate":i._refreshRightTaskLabelTemplate(t[u]);break;case"showProgressStatus":i._updateRendeProgressStatus(t[u]);break;case"showResourceNames":i._updateRenderResourceNames(t[u]);break;case"progressbarHeight":i._updateProgressbarHeight(t[u]);break;case"baselineColor":i._updateBaselineColor(t[u]);break;case"renderBaseline":i._updateRenderBaseline(t[u]);break;case"allowColumnResize":i._updateAllowColumnResize(t[u]);break;case"allowKeyboardNavigation":i._updateAllowKeyboardNavigation(t[u]);break;case"selectedItem":i._updateSelectedItem(t[u]);break;case"dataSource":i._deSelectRowItem();i._updateToolbarOptions();this._refreshDataSource(t[u]);i._enableDisableCriticalIcon&&i.showCriticalPath(!0);break;case"readOnly":i._updateReadOnly(t[u]);break;case"showGridCellTooltip":i._updateShowGridCellTooltip(t[u]);break;case"showGridExpandCellTooltip":i._updateShowGridExpandCellTooltip(t[u]);break;case"highlightWeekends":i._updateHighlightWeekends(t[u]);break;case"connectorLineBackground":i._updateConnectorLineBackground(t[u]);i._enableDisableCriticalIcon&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId);break;case"connectorlineWidth":i._updateConnectorlineWidth(t[u]);i._enableDisableCriticalIcon&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId);break;case"weekendBackground":i._updateWeekendBackground(t[u]);break;case"scheduleHeaderSettings":o=t[u];for(setting in o)switch(setting){case"timescaleUnitSize":i._updateTimescaleUnitSize(o[setting]);break;case"scheduleHeaderType":i._changeChartSchedule(o[setting])}break;case"enableContextMenu":f.enableContextMenu=t[u];i._clearContextMenu();i._off(i.element,"contextmenu",i._rightClick);f.enableContextMenu&&i._on(i.element,"contextmenu",i._rightClick);break;case"enableResize":f.enableResize?(i.model.enableResize=t[u],i._on(n(window),"resize",i.windowResize)):i._off(n(window),"resize",i.windowResize);break;case"isResponsive":f.isResponsive?(i.model.isResponsive=t[u],i._on(n(window),"resize",i.windowResize)):i._off(n(window),"resize",i.windowResize);break;case"selectedRowIndex":this.selectedRowIndex()===-1||this.selectedRowIndex()===""?(i._deSelectRowItem(),i._updateToolbarOptions()):this.selectedRowIndex()!==-1&&!r.isNullOrUndefined(this.selectedRowIndex())&&this.selectedRowIndex()<i.model.updatedRecords.length&&(s={},s.recordIndex=i.selectedRowIndex(),s.previousIndex=f.selectedItem?f.updatedRecords.indexOf(f.selectedItem):-1,i.rowSelecting(s)&&(e={},e.recordIndex=this.selectedRowIndex(),e.data=i.model.updatedRecords[e.recordIndex],e.target="ejTreeGrid",i._$treegridHelper.ejTreeGrid("selectRows",e.recordIndex),i.rowSelected(e)));break;case"selectedCellIndexes":f.allowSelection&&f.selectionMode=="cell"&&i.selectCells(t[u]);break;case"selectionMode":f.allowSelection&&(i.clearSelection(),i._$treegridHelper.ejTreeGrid("selectRows",-1),i._$ganttchartHelper.ejGanttChart("selectRows",-1),f.selectedItem=null,f.selectionMode=t[u],i._$treegridHelper.ejTreeGrid("option","selectionMode",t[u]),i._$ganttchartHelper.ejGanttChart("option","selectionMode",t[u]),t[u]=="row"&&(i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType="single"),i._updateToolbarOptions());break;case"selectionType":f.allowSelection&&(i.clearSelection(),f.selectionMode=="cell"?(f.selectionType=t[u],i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType=t[u]):(f.selectionType="single",i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType="single"));break;case"showColumnChooser":f.showColumnChooser=t[u];i._$treegridHelper.ejTreeGrid("setModel",{showColumnChooser:f.showColumnChooser});break;case"showColumnOptions":f.showColumnOptions=t[u];i._$treegridHelper.ejTreeGrid("setModel",{showColumnOptions:f.showColumnOptions});break;case"splitterPosition":i.setSplitterPosition(i._splitterPosition());break;case"addDialogFields":f.editSettings.allowAdding&&(f.addDialogFields=t[u],i.addDialogTemplate());break;case"dragTooltip":i._$treegridHelper.ejTreeGrid("setModel",{dragTooltip:t[u]});break;case"allowDragAndDrop":f.allowDragAndDrop=t[u];i._$treegridHelper.ejTreeGrid("setModel",{allowDragAndDrop:f.allowDragAndDrop});break;case"editDialogFields":f.editSettings.allowEditing&&(f.editDialogFields=t[u],i.editDialogTemplate());break;case"toolbarSettings":n.extend(i.model.toolbarSettings,t[u]);i._updateToolbar();break;case"holidays":f.holidays=t[u];i._refreshHolidays();break;case"stripLines":f.stripLines=t[u];i._updateStripLines();break;case"splitterSettings":n.extend(f.splitterSettings,t[u]);!r.isNullOrUndefined(t[u].index)&&r.isNullOrUndefined(t[u].position)?i.setSplitterIndex(f.splitterSettings.index):i.setSplitterPosition(i.splitterPosition());break;case"enablePredecessorValidation":f.enablePredecessorValidation=t[u];break;case"sizeSettings":this._calculateDimensions();this.windowResize();break;case"dayWorkingTime":f.dayWorkingTime=t[u].slice();f.flatRecords=[];f.parentRecords=[];f.updatedRecords=[];f.ids=[];f.scheduleStartDate=f.scheduleStartDate;f.scheduleEndDate=f.scheduleEndDate;i._storedIndex=-1;i.selectedRowIndex(-1);i._predecessorsCollection=[];i.element.ejGantt("destroy").ejGantt(f);break;case"workUnit":f.workUnit=t[u];this._updateWorkUnit();break;case"resources":i._updateResourcesData(t[u])}},_updateResourcesData:function(t){var u=this,i=u.model,e,f=-1,o=u.getColumns();i.resources=n.extend(!0,[],t);n.each(o,function(n,t){if(t.mappingName==i.resourceInfoMapping){f=n;return}});f>-1&&(o[f].dropdownData=i.resources);flatRecords=i.flatRecords.slice();flatRecords.reverse();e=r.Gantt.GanttRecord.prototype;n.each(flatRecords,function(n,t){t.resourceInfo&&t.resourceInfo.length>0&&(t.resourceInfo=e._setResourceInfo(t.item[i.resourceInfoMapping],i.resourceIdMapping,i.resourceNameMapping,i.resourceUnitMapping,i.resources),u._updateResourceName(t),u._updateResourceRelatedFields(t),t.hasChildRecords?t.isAutoSchedule?u._updateParentItem(t,null,!0):t.isAutoSchedule||u._updateManualParentItem(t,null,!0):u.refreshGanttRecord(t))})},_changeChartSchedule:function(n){var t=this,i=t.model,u,f;switch(n){case r.Gantt.ScheduleHeaderType.Week:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Week;t._perDayWidth=30;break;case r.Gantt.ScheduleHeaderType.Day:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Day;t._perHourWidth=20;i.workingTimeScale==r.Gantt.workingTimeScale.TimeScale24Hours?t._perDayWidth=t._perHourWidth*24:i.workingTimeScale==r.Gantt.workingTimeScale.TimeScale8Hours&&(t._perDayWidth=t._perHourWidth*24);break;case r.Gantt.ScheduleHeaderType.Month:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Month;t._perDayWidth=10;t._perWeekWidth=70;break;case r.Gantt.ScheduleHeaderType.Year:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Year;t._perDayWidth=3;t._perMonthWidth=90;break;case r.Gantt.ScheduleHeaderType.Hour:if(i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Hour,u=i.scheduleHeaderSettings.minutesPerInterval,f=r.Gantt.minutesPerInterval,t._perMinuteWidth=20,u)if(u==f.Auto){var e=endDate-startDate;e>864e6?(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48):e>6048e5?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):e>1728e5?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440)}else u==f.OneMinute?(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440):u==f.FiveMinutes?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):u==f.FifteenMinutes?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):u==f.ThirtyMinutes&&(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48)}t._updateModelsWidth();t.updateScheduleDates(i.scheduleStartDate,i.scheduleEndDate)},_updateWorkUnit:function(){var n=this,f=n.model,e=f.flatRecords,s=n.getCurrentViewData(),o=n._$treegridHelper.ejTreeGrid("instance"),i,t,u;for(o.model.workUnit=n._workUnitTexts[f.workUnit],i=0;i<e.length;i++)t=e[i],u=s.indexOf(t),t._updateWorkWithDuration(n),t.parentItem&&n._updateParentItem(t),u!=-1&&r.TreeGrid.refreshRow(o,u)},_dataBindingForSetModel:function(){var t=this,i=t.model,s,h,e,o,u,f;if(this.dataSource()==null&&this.dataSource([]),this.dataSource()instanceof r.DataManager)s=this._columnToSelect(),h=this.dataSource().executeQuery(s),h.done(r.proxy(function(r){var e,o,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createGanttRecords(t.secondaryDatasource);t._refreshGanttWithNewRecords()}));else if(this.dataSource().length>0){if(i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o);t._createGanttRecords(t.secondaryDatasource)}else t._createGanttRecords(this.dataSource());this._refreshGanttWithNewRecords()}else this._refreshGanttWithNewRecords();i.expandStateMapping&&t._collapseRecordOnLoad()},_refreshGanttWithNewRecords:function(){var n=this,t=this.model,i={};this._updatePredecessors();this._$treegridHelper.ejTreeGrid("setUpdatedRecords",t.flatRecords,t.updatedRecords,t.ids,t.parentRecords,this.dataSource());this._$treegridHelper.ejTreeGrid("processBindings");n.model.updatedRecords=n.getUpdatedRecords();n.model.currentViewData=n.getCurrentViewData();n._gridRows=n.getRows();n._totalCollapseRecordCount=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");this._$ganttchartHelper.ejGanttChart("setUpdatedRecords",t.currentViewData,t.updatedRecords,t.flatRecords,t.ids);this._calculateScheduleDates();this.updateScheduleDates(t.scheduleStartDate,this.model.scheduleEndDate);i.requestType=r.TreeGrid.Actions.Refresh;n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i);this._isFromSetModel=!1},_refreshDataSource:function(n){var t=this;this.resetModelCollections();this.dataSource(n);this._isFromSetModel=!0;t.secondaryDatasource=[];t._retrivedData=this.dataSource();this._dataBindingForSetModel()},resetModelCollections:function(){var t=this,n=t.model;n.dataSource=[];n.flatRecords=[];n.parentRecords=[];n.updatedRecords=[];n.ids=[];n.scheduleStartDate=n.scheduleStartDate;n.scheduleEndDate=n.scheduleEndDate;t._storedIndex=-1;t.selectedRowIndex(-1);t._predecessorsCollection=[]},_refreshHolidays:function(){var n=this,i=this.model,t,r;n._holidaysList=n._getHoliday();n._stringHolidays=n._getStringHolidays();t=n._updateScheduleDatesByHolidays(new Date(n._projectStartDate),new Date(n._projectEndDate));t.startDate.getTime()!==n._projectStartDate.getTime()||t.endDate.getTime()!==n._projectEndDate.getTime()?(r=n._$ganttchartHelper.data("ejGanttChart"),r.model.holidays=i.holidays,n.updateScheduleDates(t.startDate,t.endDate)):(n._isTreeGridRendered=!1,n._isGanttChartRendered=!1,n._updateGanttRecords(),n._$ganttchartHelper.ejGanttChart("refreshHelper",n.model.currentViewData,n.model.updatedRecords,n._totalCollapseRecordCount),i.predecessorMapping&&(n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._connectorlineIds=[],n._connectorLinesCollection=[],n._isValidationEnabled=!1,n._createConnectorLinesCollection(),n._isValidationEnabled=!0),this._$ganttchartHelper.ejGanttChart("refreshHolidays",i.holidays),n._isTreeGridRendered=!0,n._isGanttChartRendered=!0);n._$treegridHelper.ejTreeGrid("renderRecords")},_updateStripLines:function(){var n=this,r=this.model,t,i;t=n._updateScheduleDatesByStripLines(new Date(n._projectStartDate),new Date(n._projectEndDate));t.startDate.getTime()!==n._projectStartDate.getTime()||t.endDate.getTime()!==n._projectEndDate.getTime()?(i=n._$ganttchartHelper.data("ejGanttChart"),i.model.stripLines=r.stripLines,n.updateScheduleDates(t.startDate,t.endDate)):this._$ganttchartHelper.ejGanttChart("refreshStripLines",this.model.stripLines)},_updateWeekendBackground:function(n){var t=this;this.model.weekendBackground=n;t._$ganttchartHelper.ejGanttChart("updateWeekendBackground",n)},_updateConnectorlineWidth:function(n){var t=this;this.model.connectorlineWidth=n;t._$ganttchartHelper.ejGanttChart("updateConnectorlineWidth",n);t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection)},_updateConnectorLineBackground:function(n){var t=this;this.model.connectorLineBackground=n;t._$ganttchartHelper.ejGanttChart("updateConnectorLineBackground",n);t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection)},_updateHighlightWeekends:function(n){var t=this;this.model.highlightWeekends=n;t._$ganttchartHelper.ejGanttChart("updateHighlightWeekends",n)},_updateReadOnly:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateReadOnly",n);t._$ganttchartHelper.ejGanttChart("updateReadOnly",n);t._updateToolbarOptions()},_updateShowGridCellTooltip:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateShowGridCellTooltip",n)},_updateShowGridExpandCellTooltip:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateShowGridExpandCellTooltip",n)},_updateSelectedItem:function(n){var t=this,i={};n[t.model.taskIdMapping]!=null&&(i.recordIndex=t.model.ids.indexOf(n[t.model.taskIdMapping].toString()),i.item=t.model.flatRecords[i.recordIndex],i.target="ejTreeGrid",t.rowSelected(i),t._$treegridHelper.ejTreeGrid("selectRows",i.recordIndex),t._$ganttchartHelper.ejGanttChart("selectRows",i.recordIndex),t._$ganttchartHelper.ejGanttChart("updateSelectedItem",i.recordIndex))},_updateAllowKeyboardNavigation:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateAllowKeyboardNavigation",n);t._$ganttchartHelper.ejGanttChart("updateAllowKeyboardNavigation",n)},_updateAllowColumnResize:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateAllowColumnResize",n)},_updateProgressbarHeight:function(n){var t=this;this.model.progressbarHeight=n;t._$ganttchartHelper.ejGanttChart("updateProgressbarHeight",n)},_updateBaselineColor:function(n){var t=this;this.model.baselineColor=n;t._$ganttchartHelper.ejGanttChart("updateBaselineColor",n)},_showBaselineColumns:function(){var i=this,n=i.model,u,t;n.renderBaseline&&n.baselineStartDateMapping&&n.baselineEndDateMapping&&(t=n.baselineStartDateMapping,t.length&&(u={field:"baselineStartDate",headerText:i._columnHeaderTexts.baselineStartDate,width:150,editType:n.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:t,format:"{0:"+n.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},i._columns.push(u)),t=n.baselineEndDateMapping,t.length&&(u={field:"baselineEndDate",headerText:i._columnHeaderTexts.baselineEndDate,width:150,editType:n.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:t,format:"{0:"+n.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},i._columns.push(u)))},_updateRenderBaseline:function(n){var t=this,i=t.model,r,u;this.model.renderBaseline=n;t._$ganttchartHelper.ejGanttChart("updateRenderBaseline",n);i.renderBaseline&&(t._showBaselineColumns(),t._trigger("load"));i.renderBaseline||(r=t._getbaselineColumnIndex(t._columns).indexOf("baselineStartDate"),t._columns.splice(r,1),u=t._getbaselineColumnIndex(t._columns).indexOf("baselineEndDate"),t._columns.splice(u,1));t._$treegridHelper.ejTreeGrid("updateColumns",t._columns);t.addDialogTemplate();t.editDialogTemplate()},_getbaselineColumnIndex:function(n){for(var r=this,i=[],t=0;t<n.length;t++)i[t]=n[t].field;return i},_updateRenderTaskNames:function(n){var t=this;this.model.showTaskNames=n;t._$ganttchartHelper.ejGanttChart("updateRenderTaskNames",n)},_refreshLeftTaskLabelMapping:function(n){var t=this;this.model.leftTaskLabelMapping=n;t._$ganttchartHelper.ejGanttChart("refreshLeftTaskLabelMapping",n)},_refreshRightTaskLabelMapping:function(n){var t=this;this.model.rightTaskLabelMapping=n;t._$ganttchartHelper.ejGanttChart("refreshRightTaskLabelMapping",n)},_refreshLeftTaskLabelTemplate:function(n){var t=this;this.model.leftTaskLabelTemplate=n;t._$ganttchartHelper.ejGanttChart("refreshLeftTaskLabelTemplate",n)},_refreshRightTaskLabelTemplate:function(n){var t=this;this.model.rightTaskLabelTemplate=n;t._$ganttchartHelper.ejGanttChart("refreshRightTaskLabelTemplate",n)},_updateRendeProgressStatus:function(n){var t=this;this.model.showProgressStatus=n;t._$ganttchartHelper.ejGanttChart("updateRendeProgressStatus",n)},_updateRenderResourceNames:function(n){var t=this;this.model.showResourceNames=n;t._$ganttchartHelper.ejGanttChart("updateRenderResourceNames",n)},_updateTaskbarBackground:function(n){var t=this;this.model.taskbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateTaskbarBackground",n)},_updateProgressbarBackground:function(n){var t=this;this.model.progressbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateProgressbarBackground",n)},_updateParentTaskbarBackground:function(n){var t=this;this.model.parentTaskbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateParentTaskbarBackground",n)},_updateParentProgressbarBackground:function(n){var t=this;this.model.parentProgressbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateParentProgressbarBackground",n)},_updateEditSettings:function(n){var t=this;t._$ganttchartHelper.ejGanttChart("updateEditSettings",n);t._$treegridHelper.ejTreeGrid("updateEditSettings",n);t._updateToolbarOptions()},_updateRowSelection:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateRowSelection",n)},_updateAltRow:function(n){var t=this;t._$treegridHelper.ejTreeGrid("option","enableAltRow",n)},_renderAddedRow:function(n,t){var i=this,u=this.model,f;u.currentViewData=i._$treegridHelper.ejTreeGrid("getUpdatedCurrentViewData");i._$ganttchartHelper.ejGanttChart("setUpdatedRecords",u.currentViewData,u.updatedRecords,u.flatRecords,u.ids);u.enableVirtualization?(f={},f.requestType=r.TreeGrid.Actions.Refresh,i._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",f),i._$ganttchartHelper.ejGanttChart("refreshHelper",u.currentViewData,u.updatedRecords,i._totalCollapseRecordCount)):(i._$treegridHelper.ejTreeGrid("renderNewAddedRow",n,t),i._$ganttchartHelper.ejGanttChart("renderNewAddedRow",n,t));i._$treegridHelper.ejTreeGrid("updateHeight");i._gridRows=i.getRows();i._ganttChartRows=i.getGanttChartRows()},_getVisibleChildRecordCount:function(n,t,i){var e=this,o=this.model,u,f,r;if(n.hasChildRecords)for(u=n.childRecords,f=u.length,r=0;r<f;r++)i.indexOf(u[r])!==-1&&t++,u[r].hasChildRecords&&(t=e._getVisibleChildRecordCount(u[r],t,i));else i.indexOf(n)!==-1&&t++;return t},_validateAddRecordPrecessorValue:function(n){var u=this,i=n.data,t=this.model,r;return t.predecessorMapping&&i[t.predecessorMapping]&&i[t.predecessorMapping].length>0?(r={},r.currentRecord=n.currentRecord,r.predecessorString=i[t.predecessorMapping].split(","),u._editedPredecessorValidation(r)?!0:(i[t.predecessorMapping]="",n.currentRecord.predecessor=null,n.currentRecord.predecessorsName="",!1)):!0},openAddDialog:function(){this.cancelEditCell();this._sendAddRequest()},openEditDialog:function(){this.cancelEditCell();this._sendEditRequest()},searchItem:function(t){var i=this;i.cancelEditCell();i._searchString!=t&&(i._$treegridHelper.ejTreeGrid("search",t),i._searchString=t,n("#gantt_search input").val(t))},addRecord:function(t,i){var f=this,o=this.model,it=o.selectionMode=="row"?this.selectedRowIndex():f._rowIndexOfLastSelectedCell,e=o.updatedRecords[it],u,nt=o.taskIdMapping,c=o.updatedRecords,w=o.flatRecords,b=o.parentRecords,tt=o.ids,l=this.dataSource(),y=0,k,h={},s,p,a,v,d,rt,g,ut;f.clearSelection();f.cancelEditCell();n.type(l)==="array"||l instanceof r.DataManager||(this.dataSource([]),l=this.dataSource());Object.prototype.toString.call(t)!=="[object Object]"&&(t={});(it!==-1||i!==r.Gantt.RowPosition.AboveSelectedRow&&i!==r.Gantt.RowPosition.BelowSelectedRow&&i!==r.Gantt.RowPosition.Child)&&i||(i=r.Gantt.RowPosition.Top);t[nt]&&(t[nt]=o.ids.indexOf(t[nt].toString())!=-1?null:isNaN(parseInt(t[nt]))?null:parseInt(t[nt]));f._updateAddData(t,i);f._isDataManagerUpdate&&(f._jsonData=f._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData"));switch(i){case r.Gantt.RowPosition.Top:if(y=0,s=null,u=f._createGanttRecord(t,y),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;w.splice(0,0,u);c.splice(0,0,u);tt.splice(0,0,u.taskId.toString());b.splice(0,0,u);f._isDataManagerUpdate?f._jsonData.splice(0,0,u.item):l.splice(0,0,u.item);k=0;break;case r.Gantt.RowPosition.Bottom:if(y=0,s=null,u=f._createGanttRecord(t,y),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;w.push(u);c.push(u);tt.push(u.taskId.toString());b.push(u);f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item);k=c.indexOf(u);break;case r.Gantt.RowPosition.AboveSelectedRow:if(y=e.level,s=e.parentItem,u=f._createGanttRecord(t,y,s),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;a=w.indexOf(e);v=c.indexOf(e);w.splice(a,0,u);c.splice(v,0,u);tt.splice(a,0,u.taskId.toString());r.isNullOrUndefined(s)?(b.splice(b.indexOf(e),0,u),f._isDataManagerUpdate?f._jsonData.splice(f._jsonData.indexOf(e.item),0,u.item):l.splice(l.indexOf(e.item),0,u.item)):(p=s.childRecords.indexOf(e),s.childRecords.splice(p,0,u),o.parentTaskIdMapping?(u.item[o.parentTaskIdMapping]=u.parentItem.taskId,f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item)):s.item[o.childMapping].splice(p,0,u.item));k=v;break;case r.Gantt.RowPosition.BelowSelectedRow:if(y=e.level,s=e.parentItem,u=f._createGanttRecord(t,y,s),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;d=w.indexOf(e);e.hasChildRecords?(dataChildCount=f._$treegridHelper.ejTreeGrid("getChildCount",e,0),a=d+dataChildCount+1,v=c.indexOf(e)+f._getVisibleChildRecordCount(e,0,c)+1):(a=d+1,v=c.indexOf(e)+1);w.splice(a,0,u);c.splice(v,0,u);tt.splice(a,0,u.taskId.toString());r.isNullOrUndefined(s)?(b.splice(b.indexOf(e)+1,0,u),f._isDataManagerUpdate?f._jsonData.splice(f._jsonData.indexOf(e.item)+1,0,u.item):l.splice(l.indexOf(e.item)+1,0,u.item)):(p=s.childRecords.indexOf(e),s.childRecords.splice(p+1,0,u),o.parentTaskIdMapping?(u.item[o.parentTaskIdMapping]=u.parentItem.taskId,f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item)):s.item[o.childMapping].splice(p+1,0,u.item));k=v;break;case r.Gantt.RowPosition.Child:if(y=e.level+1,s=e,u=f._createGanttRecord(t,y,s),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;d=w.indexOf(e);e.hasChildRecords?(dataChildCount=f._$treegridHelper.ejTreeGrid("getChildCount",e,0),a=d+dataChildCount+1,e.expanded||(rt={},rt.expanded=!0,rt.data=e,f._isInAdd=!0,f.expanding(rt),f._isInAdd=!1,c=f.getUpdatedRecords()),v=c.indexOf(e)+f._getVisibleChildRecordCount(e,0,c)+1):(e.hasChildRecords=!0,e.childRecords=[],e.expanded=!0,o.parentTaskIdMapping||(e.item[o.childMapping]=[]),e.isMilestone=!1,a=d+1,v=c.indexOf(e)+1,e.predecessor&&f._updatePredecessorOnIndentOutdent(e));w.splice(a,0,u);c.splice(v,0,u);tt.splice(a,0,u.taskId.toString());r.isNullOrUndefined(s)||(p=s.childRecords.indexOf(e),s.childRecords.splice(p+1,0,u),o.parentTaskIdMapping?(u.item[o.parentTaskIdMapping]=u.parentItem.taskId,f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item)):s.item[o.childMapping].splice(p+1,0,u.item));k=v}return f._deSelectRowItem(),f._$treegridHelper.ejTreeGrid("setUpdatedRecords",o.flatRecords,o.updatedRecords,o.ids,o.parentRecords,this.dataSource()),g={},g.requestType="save",g._cAddedRecord=g.addedRecord=u,g.index=k,f.actionComplete(g),o.enableWBS&&f.updateWBSdetails(),ut=f._$treegridHelper.ejTreeGrid("instance"),o.enableVirtualization===!1&&(ut.model.sortSettings.sortedColumns.length>0||ut._searchString.length>0)&&(f._isRefreshAddedRecord=!0),o.selectionMode=="cell"?(it=o.updatedRecords.indexOf(u),f._$treegridHelper.ejTreeGrid("updateScrollBar",it)):f._$treegridHelper.ejTreeGrid("updateScrollBar"),!0},updateWBSdetails:function(n,t,i){var h=this,e=h.model,r=n?n:e.selectionMode=="row"?e.selectedItem:e.updatedRecords[h._rowIndexOfLastSelectedCell],c,o,l,u,s,a,v,f,y;newWBS=r.WBS;r.parentItem?(c=r.parentItem.childRecords,o=c.indexOf(r),u=c,s=u.length):e.flatRecords.length&&(a=e.flatRecords,v=a.filter(function(n){return n&&n.level==0}),u=v,o=u.indexOf(r),s=u.length);l=t?u.slice(o,s):u.slice(o+1,s);l.length&&(f=newWBS.lastIndexOf(".")!=-1?parseInt(newWBS.substr(newWBS.lastIndexOf(".")+1)):parseInt(newWBS),y=r.parentItem?r.parentItem.WBS:null,t&&!i?f--:t&&i?f=f:f++,h.reCalculateWBS(l,f,y))},deleteItem:function(){var n=this;n.cancelEditCell();n._$treegridHelper.ejTreeGrid("deleteRow")},expandAllItems:function(){this.cancelEditCell();this._expandAll();this.updateSelectedItemIndex();this._$treegrid.focus()},collapseAllItems:function(){this._collapseAll();this.updateSelectedItemIndex();this._$treegrid.focus()},indentItem:function(){var e=this,r=this.model,u=e.model.flatRecords,n=r.selectedItem,t=!0,i,f;if(r.editSettings.allowIndent==!1)return!0;if(n&&(i=u.indexOf(n),i===0?t=!1:n.level===0?t=!0:(f=u[i-1],t=n.level-f.level==1?!1:!0)),t)this._sendIndentRequest();else return!1},outdentItem:function(){this._sendOutdentRequest()},updateGanttColumns:function(n){var t=this,i=t.model;i.columns=n;t._columns=n},cancelEdit:function(){this.sendCancelRequest()},expandCollapseRecord:function(t){var e=this,u={},i,o=this.model,h,s,f;i=o.flatRecords[o.ids.indexOf(t.toString())];!r.isNullOrUndefined(i)&&i.hasChildRecords&&(u={},u.expanded=i.expanded==!0?!1:!0,h=e.getExpandStatus(i),h?(u.data=i,u.expanded?e.expanding(u):e.collapsing(u)):(i.expanded=u.expanded,s=o.currentViewData.indexOf(i),s==-1||o.enableVirtualization||(f=n(e.getRows()[s]),i.expanded?(f.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),f.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")):(f.find(".e-treegridexpand").removeClass("e-treegridexpand").addClass("e-treegridcollapse"),f.removeClass("e-treegridrowexpand").addClass("e-treegridrowcollapse")))))},saveEdit:function(){var n=this;n._$treegridHelper.ejTreeGrid("endEdit")},setSplitterIndex:function(t){var r=this,e=r.model,f=r.getColumns(),u=0,o=n("#ejTreeGrid"+r._id+"e-gridcontent"),i;if(columnIndex=parseInt(t),columnIndex>-1&&columnIndex<f.length){for(i=0;i<=columnIndex;i++)u+=f[i].width;if(u>r._ganttWidth)for(u=0,i=0;i<=columnIndex;i++)if(u+f[i].width<=r._ganttWidth)u+=f[i].width,t=i;else{e.splitterSettings.index=t;break}else e.splitterSettings.index=columnIndex;o.ejScroller("isHScroll")&&o.ejScroller("scrollLeft",0);r.setSplitterPosition(u.toString())}},showCriticalPath:function(n,t){var a=this,tt=this.model.ids,h=this.model.flatRecords,y,e,g,yt,et,i,u,pt,ut,wt,l,ot,st;if(n==!0)if(this.isCriticalPathEnable=!0,h.length!=0){var r=[],ct,it,f=[],s=[],c=[],nt=[],lt=[],at=[],o=this.model.flatRecords,b=this.model.parentRecords,kt=[],ft=0,rt=0,vt=[],v,ht;for(v=this.model.parentRecords[0].endDate,this.model.parentRecords[0].manualEndDate>this.model.parentRecords[0].endDate&&!this.model.parentRecords[0].isAutoSchedule&&(v=this.model.parentRecords[0].manualEndDate),ht=this.model.parentRecords[0].taskId,y=1;y<b.length;y++)b[y].endDate>=v&&(v=b[y].endDate,ht=b[y].taskId),b[y].isAutoSchedule||b[y].manualEndDate>=v&&(v=b[y].manualEndDate,ht=b[y].taskId);for(e=0;e<o.length;e++)o[e].isCritical=!1,ft=a._getDuration(o[e].endDate,v,o[e].durationUnit,o[e].isAutoSchedule),o[e].slack=ft+" "+o[e].durationUnit,o[e].endDate>=v&&nt.push(o[e].taskId),o[e].predecessor&&o[e].predecessor.length!=0&&(r.push(o[e]),lt.push(o[e].taskId));for(g=0;g<nt.length;g++)lt.indexOf(nt[g])==-1?(rt=tt.indexOf(nt[g].toString()),h[rt].status<100&&(h[rt].isCritical=!0),h[rt].slack=0+h[rt].durationUnit,at.push(nt[g])):kt.push(nt[g]);for(yt=r.length,et=[],i=0;i<yt;i++){var p=-1,w=-1,k=-1,d=-1;for(ct=r[i].predecessor.length,it=parseInt(r[i].taskId),currentIndex=i,u=0;u<ct;u++)r[i].predecessor[u].from==it&&(p==-1?r[i].predecessor[u].offset?(p=r[i].predecessor[u].to+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,k=r[i].predecessor[u].predecessorsType):(p=r[i].predecessor[u].to,k=r[i].predecessor[u].predecessorsType):r[i].predecessor[u].offset?(p=p+","+r[i].predecessor[u].to+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,k=k+","+r[i].predecessor[u].predecessorsType):(p=p+","+r[i].predecessor[u].to,k=k+","+r[i].predecessor[u].predecessorsType)),r[i].predecessor[u].to==it&&(w==-1?r[i].predecessor[u].offset?(w=r[i].predecessor[u].from+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,d=r[i].predecessor[u].predecessorsType):(w=r[i].predecessor[u].from,d=r[i].predecessor[u].predecessorsType):r[i].predecessor[u].offset?(w=w+","+r[i].predecessor[u].from+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,d=d+","+r[i].predecessor[u].predecessorsType):(w=w+","+r[i].predecessor[u].from,d=d+","+r[i].predecessor[u].predecessorsType));w==-1&&(w=null,d=null);p==-1&&(p=null,k=null);f.push({from:w,fromPredecessor:d,taskid:it,to:p,toPredecessor:k,currentIndex:currentIndex,slack:null,ff:0,fs:0,enddate:null,fsslack:0});s.push(parseInt(it))}for(pt=f.length,ut=0,l=0;l<pt;l++)f[l].to||(wt=f[l].taskid,ut=tt.indexOf(wt.toString()),ft=a._getDuration(h[ut].endDate,v,"minute",h[ut].isAutoSchedule),f[l].slack=ft,f[l].fs=-1,f[l].enddate=h[ut].endDate,et.push({fromdata:f[l].from,todateID:f[l].taskid,fromDataPredecessor:f[l].fromPredecessor}));for(ot=0;ot<et.length;ot++)vt.push(et[ot]),a._slackCalculation(vt,f,s,v,h,tt);c=a._finalCriticalPath(f,at,h,tt);this.criticalPathCollection=c;this.detailPredecessorCollection=f;this.collectionTaskId=s;t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),a._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!0}else{var c=[],f=[],s=[];t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),this._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!0}if(n==!1){var c=[],f=[],s=[],bt=0;for(this.isCriticalPathEnable=!1,st=0;st<a.criticalPathCollection.length;st++)bt=tt.indexOf(a.criticalPathCollection[st].toString()),h[bt].isCritical=!1;t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),this._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!1}},_finalCriticalPath:function(n,t,i,r){for(var o=this,e=[],u,f=0;f<n.length;f++)u=r.indexOf(n[f].taskid.toString()),i[u].durationUnit=="day"?(i[u].slack=n[f].slack/60/(o._secondsPerDay/3600),i[u].slack=i[u].slack%1!=0?i[u].slack.toFixed(2)+" day":i[u].slack+" day"):i[u].durationUnit=="hour"?(i[u].slack=n[f].slack/60,i[u].slack=i[u].slack%1!=0?i[u].slack.toFixed(2)+" hour":i[u].slack+" hour"):i[u].slack=n[f].slack+" minutes",n[f].slack<=0&&i[u].status<100&&(i[u].isCritical=!0,e.push(n[f].taskid));return e.concat(t)},_slackCalculation:function(n,t,i,u,f,e){var l=this,w=n[0].fromdata.split(","),p=n[0].fromDataPredecessor.split(","),s=[],o,c,b=w.length,y,v,h,a;for(xx=0;xx<b;xx++)s=w[xx].split(":"),o=i.indexOf(parseInt(s[0])),c=i.indexOf(parseInt(n[0].todateID)),p[xx]=="FS"&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexfromtaskid].endDate>f[indexenddate].startDate?-l._getDuration(f[indexenddate].startDate,f[indexfromtaskid].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,f[indexenddate].startDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="SS"&&(indexfromtaskid=e.indexOf(s[0].toString()),f[indexfromtaskid].isAutoSchedule?(indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexfromtaskid].startDate>f[indexenddate].startDate?-l._getDuration(f[indexenddate].startDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].startDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate)):f[indexfromtaskid].isAutoSchedule||(enddate=0,h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&t[o].slack!=0&&(t[o].slack=h)),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="FF"&&(t[c].fs==1||t[c].ff==1||t[c].fs==-1?(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),t[c].fs==1?(y=f[indexenddate].endDate,v=t[c].slack):t[c].ff==1&&(y=f[indexenddate].endDate,v=t[c].slack),t[c].fs==-1&&(y=t[c].enddate,v=t[c].slack),h=y>f[indexfromtaskid].endDate?-l._getDuration(f[indexfromtaskid].endDate,y,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(y,f[indexfromtaskid].endDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=v-h<0?0:v-h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack-h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].ff=1,t[o].enddate=y,t[o].fsslack=v):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=v-h<0?0:v-h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack-h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].ff=1,t[o].enddate=y,t[o].fsslack=v)):(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?s.length<=1?r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&(t[o].slack=h):s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&(t[o].slack=h):s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0))),t[o].ff=1),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="SF"&&(indexfromtaskid=e.indexOf(s[0].toString()),f[indexfromtaskid].isAutoSchedule?r.isNullOrUndefined(t[o].slack)?(s.length<=1?r.isNullOrUndefined(t[c].to)?(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack=h):r.isNullOrUndefined(t[c].to)||(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].startDate?-l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack=t[c].slack+h<0?0:t[c].slack+h):s.length>1&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].endDate?f[indexfromtaskid].startDate>f[indexenddate].endDate?-l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):(s.length<=1?(r.isNullOrUndefined(t[c].to)?(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule)):r.isNullOrUndefined(t[c].to)||(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].startDate?-l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule)),t[o].slack>h&&t[o].slack!=0&&(r.isNullOrUndefined(t[c].to)?t[o].slack=h:r.isNullOrUndefined(t[c].to)||(t[o].slack=t[c].slack+h<0?0:t[c].slack+h))):s.length>1&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].endDate?f[indexfromtaskid].startDate>f[indexenddate].endDate?-l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack>h&&t[o].slack!=0&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0))),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):f[indexfromtaskid].isAutoSchedule||(h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&t[o].slack!=0&&(t[o].slack=h)),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),t[o].from&&n.push({fromdata:t[o].from,todateID:t[o].taskid,fromDataPredecessor:t[o].fromPredecessor});n&&(n.splice(0,1),n.length>0&&l._slackCalculation(n,t,i,u,f,e))},setSplitterPosition:function(t){var i=this,o=i.model,e=0,f;if(ganttWidth=parseInt(i._ganttWidth)-i._totalBorderWidth,isPercentage=!1,!r.isNullOrUndefined(t)){if(t.indexOf("%")!=-1?(u=parseInt(t),isPercentage=!0):(u=parseInt(t)/i._ganttWidth*100,isPercentage=!1),u=isNaN(u)?0:u,u<=100)u=u<0?0:u,e=100-u-900/ganttWidth,e<=0?(isPercentage?i.splitterPosition("100%"):i.splitterPosition(ganttWidth.toString()),u=100-900/ganttWidth,e=0):e>0&&(isPercentage?i.splitterPosition(Math.round(u)+"%"):i.splitterPosition(Math.round(u*i._ganttWidth/100).toString())),f=n("#e-ejSpliter"+i._id).ejSplitter("instance"),f.model.properties[0].paneSize=u+"%",f.model.properties[1].paneSize=e+"%",f.refresh(),i._$treegridHelper.ejTreeGrid("refreshScroller",Math.round(u*ganttWidth/100)),i._$ganttchartHelper.ejGanttChart("refreshScroller",f.model.properties[1].paneSize-1),i._clearContextMenu();else{var f=n("#e-ejSpliter"+i._id).ejSplitter("instance"),u=f.model.properties[0].paneSize,e=f.model.properties[1].paneSize;parseInt(e)==0?isPercentage?i.splitterPosition("100%"):i.splitterPosition(ganttWidth.toString()):isPercentage?i.splitterPosition(Math.round(parseInt(u)/ganttWidth*100)+"%"):i.splitterPosition(u.toString())}i._splitterPosition(i.splitterPosition())}},_showTooltip:function(n){var t=this;this.model.enableTaskbarTooltip=n;t._$ganttchartHelper.ejGanttChart("showTooltip",n)},_showEditingTooltip:function(n){var t=this;this.model.enableTaskbarDragTooltip=n;t._$ganttchartHelper.ejGanttChart("showEditingTooltip",n)},_ganttChartEditing:function(t){var i=this;i.model.allowGanttChartEditing=t;i._$ganttchartHelper.ejGanttChart("ganttChartEditing",t);t?(n(".e-gantt-childtaskbar, .e-tasklabel, .progressbar").css({cursor:"move"}),n(".taskbarresizer-right").css({cursor:"w-resize"}),n(".taskbarresizer-left").css({cursor:"e-resize"})):n(".e-gantt-childtaskbar, .e-tasklabel, .progressbar, .taskbarresizer-right, .taskbarresizer-left").css({cursor:"auto"})},_resizeProgressbar:function(n){var t=this;t.model.enableProgressBarResizing=n;t._$ganttchartHelper.ejGanttChart("resizeProgressbar",n)},_milestoneTemplate:function(n){var t=this;t.model.milestoneTemplate=n;t._$ganttchartHelper.ejGanttChart("changeMilestoneTemplate",t.model.milestoneTemplate)},_taskbarTemplate:function(n){var t=this;t.model.taskbarTemplate=n;t._$ganttchartHelper.ejGanttChart("changeTaskbarTemplate",t.model.taskbarTemplate)},_parentTaskbarTemplate:function(n){var t=this;t.model.parentTaskbarTemplate=n;t._$ganttchartHelper.ejGanttChart("changeParentTaskbarTemplate",t.model.parentTaskbarTemplate)},_sendSortingRequest:function(n){var t=this;t.model.sortSettings=n;t._$treegridHelper.ejTreeGrid("option","sortSettings",n)},_sortingRequest:function(n){var t=this,i=t.model;t.model.allowSorting=n;t._$treegridHelper.ejTreeGrid("sortSetting",n)},_columnIndex:function(n){var t=this;t._$treegridHelper.ejTreeGrid("columnIndex",n)},sendCancelRequest:function(){var t=this,i=n("#"+t._id+"_toolbarItems");t._$treegridHelper.ejTreeGrid("cancelEditCell");t.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&t._disabledToolItems.push(n(i).find(".e-cancel").parent()[0]);t.model.toolbarSettings.toolbarItems.indexOf("save")!==-1&&t._disabledToolItems.push(n(i).find(".e-saveitem").parent()[0]);n(i).ejToolbar("disableItem",t._disabledToolItems);t._disabledToolItems=[]},_sendAddRequest:function(){var t=this,i=t._columns,f=i.length,n=0,u={},r={};for(t._isinAddnewRecord=!0,n;n<f;n++)i[n].mappingName&&(u[i[n].mappingName]="");r.data=u;r.requestType="add";t.renderedEditDialog(r)},_sendEditRequest:function(t){var i=this,e=i.model,u={},f;r.isNullOrUndefined(t)?(i._currentTrIndex=e.selectionMode=="row"?this.selectedRowIndex():i._rowIndexOfLastSelectedCell,i._$currentTr=n(i._$treegridHelper.ejTreeGrid("getRows")).eq(this.selectedRowIndex())):(i._currentTrIndex=t.index(),i._$currentTr=t);f=i.getUpdatedRecords()[i._currentTrIndex];u.data=f;u.requestType="beginedit";u.data&&i.renderedEditDialog(u)},_updateAddData:function(n,t){var u=this,i=this.model,f,e;n[i.taskIdMapping]||(f=i.flatRecords.length,f=u._getNewTaskId(f),n[i.taskIdMapping]=f);i.taskNameMapping&&!n[i.taskNameMapping]&&(n[i.taskNameMapping]=u._newTaskTexts.newTaskName+" "+n[i.taskIdMapping]);n[i.startDateMapping]||(n[i.startDateMapping]=i.scheduleStartDate);i.durationMapping&&r.isNullOrUndefined(n[i.durationMapping])&&(n[i.endDateMapping]||(n[i.durationMapping]="5"));i.progressMapping&&(n[i.progressMapping]=n[i.progressMapping]?n[i.progressMapping]>100?100:n[i.progressMapping]:0);!n[i.endDateMapping]&&i.endDateMapping&&(n[i.durationMapping]||(e=u._getDateFromFormat(i.scheduleStartDate),e.setDate(e.getDate()+4),n[i.endDateMapping]=r.format(e,this.model.dateFormat,this.model.locale)));i.enableWBS&&!n.WBS&&(n.WBS=u._getNewWBSid(t));i.enableWBS&&!n.WBS&&(n.WBS=u._getNewWBSid(t));r.isNullOrUndefined(i.selectedItem)||(n.taskType=i.workMapping?r.Gantt.TaskType.FixedWork:i.selectedItem.taskType,n.effortDriven=i.workMapping?"true":i.selectedItem.effortDriven)},_sendSaveRequest:function(t){var e={},wt=document,i=this,u=i.model,v,bt,ti,p,it,l,rt,d,g,w,ft,f={},c,et,b,ot,a,o,st,ht,ut,ct,s,yt,kt,nt,dt,h,y,k,pt,gt,tt,ni;if(this._duplicate=!1,this._wrongenddate=!1,t==="Add"){if(v=wt.querySelectorAll("#"+i._id+"GeneralAddForm","#"+i._id+"PredecessorAddForm","#"+i._id+"ReosurceAddForm","#"+i._id+"CustomFieldsAddForm"),bt=v&&v.length,rt="Add",d="#treegrid"+i._id+"predecessorAdd",g="#treegrid"+i._id+"resourceAdd",w="#treegrid"+i._id+"customFieldAdd",ft="#"+i._id+"AddAreaNotes",p=n("#"+i._id+"taskId"+rt),it=r.TreeGrid.getColumnByField(i._columns,"taskId"),i._cellEditColumn=it,c=i._addDialogGeneralColumns,et=c.length,b=i._addDialogCustomColumns,ot=b.length,it&&p.length>0&&(l=i.getCurrentEditCellData(p,it.dropdownData)),i.model.ids.indexOf(l)!=-1&&l?this._duplicate=!0:l&&(this._duplicate=!1),!this.addFormValidate())return!0}else if(v=wt.getElementById(i._id+"GeneralEditForm"),bt=v&&v.length,d="#treegrid"+i._id+"predecessorEdit",g="#treegrid"+i._id+"resourceEdit",w="#treegrid"+i._id+"customFieldEdit",ft="#"+i._id+"EditAreaNotes",rt="Edit",c=i._editDialogGeneralColumns,et=c.length,b=i._editDialogCustomColumns,ot=b.length,!this.editFormValidate())return!0;if(ti=n(v).closest("div"),this._duplicate)return alert(i._alertTexts.idValidationAlert),!0;for(o=0;o<et;o++)if(p=n(v).find("#"+i._id+c[o].field+rt),p.length>0){if(i._cellEditColumn=c[o],i._cellEditColumn.field=="duration"||i._cellEditColumn.field=="startDate"||i._cellEditColumn.field=="endDate"){e[c[o].mappingName]=this._editedDialogRecord[i._cellEditColumn.field];i._cellEditColumn.field=="duration"&&u.durationUnitMapping&&(e[u.durationUnitMapping]=this._editedDialogRecord.durationUnit);continue}l=i.getCurrentEditCellData(p,c[o].dropdownData);i._isinAddnewRecord===!1&&c[o].mappingName===i.model.predecessorMapping&&(f.previousValue=i._updatePredecessorValue(null,l));c[o].mappingName===i.model.progressMapping&&r.isNullOrUndefined(l)&&(l=0);(u.workMapping||i._cellEditColumn.field!="work")&&i._cellEditColumn.field!="taskType"&&i._cellEditColumn.field!="effortDriven"?e[c[o].mappingName]=l:e[c[o].field]=l}if(n(w).length)for(n(w).ejTreeGrid("model.isEdit")&&n(w).ejTreeGrid("saveCell"),a=n(w).ejTreeGrid("model.updatedRecords"),o=0;o<ot;o++)e[b[o].mappingName]=b[o].editType=="dropdownedit"?a[o].value:a[o].text;if(st=n(ft),st.length&&(e[u.notesMapping]=st.ejRTE("getHtml")),date1=i._getDateFromFormat(e[u.startDateMapping]),date2=i._getDateFromFormat(e[u.endDateMapping]),ht=0,date1&&date2&&(ht=date2.getTime()-date1.getTime()),this._wrongenddate=ht<0?!0:!1,this._wrongenddate)return alert(i._alertTexts.dateValidationAlert),!0;if(ut=n(g),ct=!0,ut.length>0){n(ut).ejTreeGrid("model.isEdit")&&n(ut).ejTreeGrid("saveCell");var lt=[],a=n(g).ejTreeGrid("option","dataSource"),ii=n(g).ejTreeGrid("option","selectedRowIndex");if(n.each(a,function(f,o){var l,c,v,y;if(o.name!=null&&o.name!="")if(c=n.map(u.resources,function(n,t){if(n[u.resourceIdMapping].toString()==o.name)return t}),l=u.resources[c[0]],t==="Add")lt.push(l[u.resourceIdMapping]),l[u.resourceUnitMapping]=o.unit,i._newRecordResourceCollection.push(l);else{r.isNullOrUndefined(u.selectedItem.resourceInfo)&&(u.selectedItem.resourceInfo=[]);var p=i.model,h=p.selectedItem,s=h.resourceInfo,w=p.resourceIdMapping;if((r.isNullOrUndefined(s)||s.length!=a.length)&&(i._isResourceAddedOrRemoved=!0),s)for(c=0;c<s.length;c++)if(s[c][w]===l[w]){v=c;break}else v=-1;else s=[];(r.isNullOrUndefined(v)||v==-1)&&s.length!=a.length&&(y=n.extend({},l),p.selectedItem._updateResourceUnit(l,y,u.resourceUnitMapping),y[u.resourceUnitMapping]=100,s.push(y));s[f][u.resourceUnitMapping]!=a[f].unit&&(i._isExistingUnitIsUpdated=!0);s[f][u.resourceIdMapping]=parseInt(a[f].name);s[f][u.resourceNameMapping]=u.resources[parseInt(a[f].name)-1][u.resourceNameMapping];s[f][u.resourceUnitMapping]=a[f].unit;lt.push(s[f]);i._isExistingUnitIsUpdated&&(h.isAutoSchedule&&h.taskType!="fixedDuration"?h._updateDurationWithWork(i):h._updateWorkWithDuration(i),e.Duration=h.duration,u.workMapping?e[u.workMapping]=h.work:e.work=h.work,i._editedDialogRecord.duration=h.duration,i._editedDialogRecord.work=h.work,i._isExistingUnitIsUpdated=!1)}else return ct=!1,!1}),ct)e[u.resourceInfoMapping]=lt;else return alert(i._alertTexts.dialogResourceAlert),!0}e[u.taskIdMapping]||t!=="Edit"||(e[u.taskIdMapping]=i._editedDialogRecord.taskId);f.data=e;var at=[],vt=!1;if(u.predecessorMapping&&(t==="Edit"?(vt=u.editDialogFields.length===0?!0:!1,at=n.grep(u.editDialogFields,function(n){return n.field===u.predecessorMapping})):t==="Add"&&(vt=u.addDialogFields.length===0?!0:!1,at=n.grep(u.addDialogFields,function(n){return n.field===u.predecessorMapping}))),at.length>0||vt){if(s=[],yt=!0,n(d).ejTreeGrid("model.isEdit")&&n(d).ejTreeGrid("saveCell"),s=n(d).ejTreeGrid("option","dataSource"),n.each(s,function(n,t){(r.isNullOrUndefined(t.id)||r.isNullOrUndefined(t.name)||r.isNullOrUndefined(t.type)||!(t.id.length>0&&t.name.length&&t.type.length))&&(yt=!1)}),yt){for(kt=[],nt=[],types=i._predecessorCollectionText,h=0;h<s.length;h++){for(y={},y.from=e.taskID,y.to=s[h].id,y.isdrawn=!1,y.offset=s[h].offset,k=0;k<types.length;k++)if(s[h].type==types[k].text){y.predecessorType=types[k].id;dt=types[k].id;break}pt=s[h].id+dt;s[h].offset=parseFloat(s[h].offset);s[h].offset!==0&&(pt+=s[h].offset<0?s[h].offset.toString():"+"+s[h].offset.toString());nt.push(pt);kt.push(y)}f.predecessorString=nt}else return alert(i._alertTexts.predecessorAddingValidationAlert),!0;if(i._isinAddnewRecord===!1)if(f.currentRecord=u.selectionMode=="row"?this.selectedItem():u.updatedRecords[i._rowIndexOfLastSelectedCell],i._editedPredecessorValidation(f))f.previousValue=i._updatePredecessorValue(null,nt.join(","));else return alert(i._alertTexts.predecessorEditingValidationAlert),!0;e[u.predecessorMapping]=nt.join(",")}if(f.requestType=r.TreeGrid.Actions.Save,f.recordIndex=this.selectedRowIndex()!==-1?this.selectedRowIndex():-1,i._trigger("actionBegin",f))return!0;if(t==="Edit")f._cModifiedData=i._updateRecord(e),i._editedDialogRecord&&(f._cModifiedData.startDate=new Date(i._editedDialogRecord.startDate),f._cModifiedData.endDate=new Date(i._editedDialogRecord.endDate),f._cModifiedData.duration=i._editedDialogRecord.duration,f._cModifiedData.durationUnit=i._editedDialogRecord.durationUnit,i._isResourceAddedOrRemoved&&i._updateResourceRelatedFields(f._cModifiedData),u.durationUnitMapping&&(f._cModifiedData.item[u.durationUnitMapping]=i._editedDialogRecord.durationUnit),i._editedDialogRecord=null),f.data[u.endDateMapping]&&(r.isNullOrUndefined(f.data[u.durationMapping])||f.data[u.durationMapping]==="")&&i._isDurationUpdated==!1&&(f._cModifiedData.startDate=i._checkStartDate(f._cModifiedData.startDate,f._cModifiedData),f._cModifiedData.endDate=i._checkEndDate(f._cModifiedData.endDate,f._cModifiedData),f._cModifiedData._calculateDuration(this)),f._cModifiedData.isMilestone=f._cModifiedData.duration==0&&f._cModifiedData.startDate.getTime()==f._cModifiedData.endDate.getTime()?!0:!1,f.data[u.baselineStartDateMapping]&&f.data[u.baselineEndDateMapping]&&(gt=i._getDateFromFormat(f.data[u.baselineStartDateMapping]),tt=i._getDateFromFormat(f.data[u.baselineEndDateMapping]),tt&&tt.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,tt),f._cModifiedData.baselineStartDate=this._checkBaseLineStartDate(gt),f._cModifiedData.baselineEndDate=this._checkBaseLineEndDate(tt),f._cModifiedData.baselineLeft=f._cModifiedData._calculateBaselineLeft(this),f._cModifiedData.baselineRight=f._cModifiedData._calculateBaselineRight(this),f._cModifiedData.baselineWidth=f._cModifiedData._calculateBaseLineWidth(this)),f.modifiedRecord=f._cModifiedData,i.actionComplete(f);else if(t==="Add"&&(ni=i._addPosition!=null?i._addPosition:u.editSettings.rowPosition,!i.addRecord(e,ni)))return alert(i._alertTexts.predecessorEditingValidationAlert),!0;return i._cModifiedData=null,i._cAddedRecord=null,i._primaryKeyValues=[],i._isinAddnewRecord=!1,i._isResourceAddedOrRemoved=!1,!1},_recordReturnerByID:function(n){for(var r=this,i=r.model.flatRecords,t=0;t<i.length;t++)if(i[t].taskId.toString()===n.toString())return i[t];return null},_editedPredecessorValidation:function(t){var h=this,c=t.currentRecord.taskId,i,l=t.predecessorString.join(","),u,e,o,s,y,f,p,w;if(l.length>0)for(u=h._idFromPredecessor(l),e=0;e<u.length;e++){if(o=t.currentRecord,o&&o.parentItem&&u.indexOf(o.parentItem.taskId.toString())!==-1)return!1;var b=u.slice(0),a=[],v=!0;if(n.each(b,function(n,t){a.indexOf(t)===-1?a.push(t):v=!1}),v===!1)return!1;for(i=u[e],s=[],y=u.slice(0),y.splice(e,1);i!==null;)if(f=[],s.indexOf(i)===-1){if((currentRecord=h._recordReturnerByID(i),r.isNullOrUndefined(currentRecord))||(!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0&&n.each(currentRecord.predecessor,function(n,t){currentRecord.taskId.toString()!==t.from&&(f.push(t.from.toString()),p=n)}),c.toString()===currentRecord.taskId.toString()||f.indexOf(c.toString())!==-1))return!1;if(s.push(i),!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0){if(f.length>1?w=this._predecessorValidation(f,t):f.length==1&&(i=currentRecord.predecessor[p].from),w===!1)return!1}else break}else break}return!0},_predecessorValidation:function(t,i){for(var f,s,e,h=this,o=i.currentRecord.taskId,u=0;u<t.length;u++)for(currentId=t[u],f=[],s=t.slice(0),s.splice(u,1);currentId!==null;)if(e=[],f.indexOf(currentId)===-1){if((currentRecord=h._recordReturnerByID(currentId),r.isNullOrUndefined(currentRecord))||(!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0&&n.each(currentRecord.predecessor,function(n,t){currentRecord.taskId.toString()!==t.from&&e.push(t.from.toString())}),o.toString()===currentRecord.taskId.toString()||e.indexOf(o.toString())!==-1))return!1;if(f.push(currentId),!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0)currentId=currentRecord.predecessor[0].from;else break}else break;return!0},_sendCancelRequest:function(){var t=this,u=t.model,i={};u.dateFormat.toLowerCase().indexOf("hh")!=-1?n("#"+t._id+"EditForm").find(".e-datepicker").ejDateTimePicker("destroy"):n("#"+t._id+"EditForm").find(".e-datepicker").ejDatePicker("destroy");i.requestType=r.TreeGrid.Actions.Cancel;t._$treegridHelper.ejTreeGrid("processBindings",i);t._primaryKeyValues=[];t.model.currentData=null},_updatePredecessorValue:function(n,t){var e=this,u,o,a=0,h,c=[],s=0,i=r.isNullOrUndefined(n)?model.selectionMode=="row"?e.selectedItem():model.updatedRecords[e._rowIndexOfLastSelectedCell]:n,f,l;for(u=i.predecessor,t.length>0&&(o=i._calculatePredecessor(t,this._durationUnitEditText,this.model.durationUnit)),o&&(a=o.length),f=0,l=0,u&&(l=u.length),f=0;f<l;f++)h=u[f],h.from===i.taskId.toString()&&c.push(h);for(s=0;s<a;s++)c.push(o[s]);return i.predecessor=c,e.model.predecessorMapping&&(i.item[e.model.predecessorMapping]=t,i.predecessorsName=t),u},getCurrentEditCellData:function(t,i){var u=this,o=u.model,e,f;if(n("#"+u._id+"EditForm").length||n("#"+u._id+"GeneralAddForm").length||n("#"+u._id+"GeneralEditForm").length){f="";switch(u._cellEditColumn.editType){case r.TreeGrid.EditingType.String:f=t.val();break;case r.TreeGrid.EditingType.Numeric:f=t.ejNumericTextbox("getValue");break;case r.TreeGrid.EditingType.Dropdown:f=t.attr("id").indexOf("resourceInfo")>0?u._getSelectedItem(t.ejDropDownList("model.selectedItems"),i):t.attr("id").indexOf("taskMode")>0?t.ejDropDownList("model.value")=="true"?!0:!1:t.ejDropDownList("model.value");break;case r.TreeGrid.EditingType.Boolean:f=t.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:e=t.ejDatePicker("model.value");f=u._cellEditColumn&&!u._cellEditColumn.format?u.getFormatedDate(e):e;break;case r.TreeGrid.EditingType.DateTimePicker:e=t.ejDateTimePicker("model.value");f=u._cellEditColumn&&!u._cellEditColumn.format?f=u.getFormatedDate(e):e;break;case r.TreeGrid.EditingType.Maskedit:f=t.ejMaskEdit("model.value")}return f}return null},_getSelectedItem:function(t,i){var r=0,f=t.length,u=[];if(i)for(r=0;r<f;r++)n.each(i,function(n,i){t[r]===n&&u.push(i)});return u},_getDropDownText:function(t,i){var s,u,o,f,h=t.dropdownData,e;for(i=i.split(","),selectedDropDownText=[],s=i.length,u=t.editParams,u&&u.fields?(f=u.fields.text?u.fields.text:"text",o=u.fields.value?u.fields.value:"value"):(o="value",f="text"),e=0;e<s;e++)n.each(h,function(n,t){if(r.isNullOrUndefined(t[o])){if(i[e]===t[f].toString())return selectedDropDownText.push(t[f].toString()),!1}else if(i[e]===t[o].toString())return selectedDropDownText.push(t[f]),!1});return selectedDropDownText.join(",")},_updateRecord:function(t){var f=this,e=this.model,r=f._columns,c,i=0,l=e.selectionMode=="row"?this.selectedRowIndex():f._rowIndexOfLastSelectedCell,u=f.getUpdatedRecords()[l],s,o,h;if(f._isUpdateOffset=!1,e.editDialogFields.length>0){for(s=[],o=0;o<e.editDialogFields.length;o++)h=n.grep(f._columns,function(n){return n.mappingName===e.editDialogFields[o].field}),h.length&&s.push(h[0]);r=s}for(c=r.length,i=0;i<c;i++)r[i].field.toString()!=="predecessor"&&(r[i].field=="startDate"&&u[r[i].field].getTime()!=t[r[i].mappingName].getTime()&&(f._isUpdateOffset=!0),r[i].field=="endDate"&&u[r[i].field].getTime()!=t[r[i].mappingName].getTime()&&(f._isUpdateOffset=!0),r[i].field=="duration"&&u[r[i].field]!=t[r[i].mappingName]&&(f._isUpdateOffset=!0),r[i].field=="taskMode"&&(u.isAutoSchedule=!t[e.taskSchedulingModeMapping]),r[i].field!="work"&&r[i].field!="taskType"&&(u[r[i].field]=t[r[i].mappingName],u.item[r[i].mappingName]=t[r[i].mappingName]),r[i].field=="work"&&(e.workMapping?(u[r[i].field]=t[r[i].mappingName],u.item[r[i].mappingName]=t[r[i].mappingName]):u[r[i].field]=t[r[i].field]),(r[i].field=="taskType"||r[i].field=="effortDriven")&&(u[r[i].field]=t[r[i].field]),r[i].field.toString()==="resourceInfo"&&f._updateResourceName(u),r[i].field.toString()==="notesText"&&(u.notes=t[e.notesMapping],u.notesText=f._getPlainText(t[e.notesMapping]),u.item[e.notesMapping]=t[e.notesMapping]));return u},updateRecordByTaskId:function(n){var f=this,t=f.model,u,i=n[t.taskIdMapping],o,e;id=typeof i=="number"?i.toString():typeof i=="string"?i:null;r.isNullOrUndefined(id)||(u=t.ids.indexOf(id),u>-1&&(o=t.flatRecords[u],e=t.updatedRecords.indexOf(o),f.updateRecordByIndex(e,n)))},updateRecordByIndex:function(n,t){var h=this,o=h.model,y=o.updatedRecords,c={},a=n,i=a>-1?y.length>0?y[a]:null:null,f,v,l,s,e,p;if(h.cancelEditCell(),!r.isNullOrUndefined(i)){for(v=h.getColumns(),t[o.taskIdMapping]=i.item[o.taskIdMapping],f=h._createGanttRecord(t,i.level,i.parentItem,u),i.isAutoSchedule=f.isAutoSchedule,i.isMilestone=f.isMilestone,l=0;l<v.length;l++)if(s=v[l],e=s.field,!r.isNullOrUndefined(s.mappingName)){if(e=="taskId")continue;else if(i.hasChildRecords&&i.isAutoSchedule&&(e=="startDate"||e=="endDate"||e=="duration"||e=="status"||e=="predecessor"||e=="WBSPredecessor"))continue;e=="predecessor"?(p=r.isNullOrUndefined(f.item[o.predecessorMapping])?"":f.item[o.predecessorMapping],c.previousValue=h._updatePredecessorValue(i,p)):e!="duration"||r.isNullOrUndefined(f.item[o.durationUnitMapping])?e=="notesText"?(i.notes=f.notes,i.notesText=f.notesText,i.item[o.notesMapping]=f.item[o.notesMapping]):(i[e]=f[e],i.item[s.mappingName]=f.item[s.mappingName]):(i.item[o.durationUnitMapping]=f.item[o.durationUnitMapping],i.durationUnit=f.durationUnit,i[e]=f[e],i.item[s.mappingName]=f.item[s.mappingName])}c.requestType=r.TreeGrid.Actions.Save;c.recordIndex=a;c._cModifiedData=i;h.actionComplete(c)}},_sendIndentRequest:function(){var t=this,i=t.model,n=t.getCurrentData(),f={},c={},u,s=!1,y=t._$treegridHelper.ejTreeGrid("instance"),l,o,e,p,h,a,v,w;if(t.cancelEditCell(),r.isNullOrUndefined(n))alert(t._alertTexts.indentAlert);else if(u=i.flatRecords[i.flatRecords.indexOf(n)-1],f.data=n,f.requestType="indent",!t._trigger("actionBegin",f)){if(n.parentItem?(l=n.parentItem.childRecords.indexOf(n),n.parentItem.childRecords.splice(l,1),i.parentTaskIdMapping||n.parentItem.item[i.childMapping].splice(l,1)):this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?(o=this.dataSource().dataSource.json.indexOf(n.item),i.parentTaskIdMapping||this.dataSource().dataSource.json.splice(o,1)):t._isDataManagerUpdate&&(o=t._jsonData.indexOf(n.item),i.parentTaskIdMapping||(t._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),t._jsonData.splice(o,1))):(o=this.dataSource().indexOf(n.item),i.parentTaskIdMapping||this.dataSource().splice(o,1)),n.level===u.level?u.childRecords?u.expanded||(u.childRecords.splice(u.childRecords.length,0,n),n.parentItem=u,i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.taskId:u.item[i.childMapping].splice(u.childRecords.length,0,n.item)):(u.childRecords=[],u.childRecords.push(n),u.expanded=!0,u.taskType=r.Gantt.TaskType.FixedDuration,u.effortDriven="false",n.parentItem=u,u.item[i.childMapping]=[],i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.taskId:u.item[i.childMapping].push(n.item)):u.level-n.level==1?(u.parentItem.childRecords.splice(u.parentItem.childRecords.length,0,n),i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.parentItem.taskId:u.parentItem.item[i.childMapping].splice(u.parentItem.childRecords.length,0,n.item),n.parentItem=u.parentItem):u.level-n.level>1&&(e=t.getParentItem(u,n.level),e.childRecords.splice(e.childRecords.length,0,n),i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=e.taskId:e.item[i.childMapping].splice(e.childRecords.length,0,n.item),n.parentItem=e),n.parentItem.isMilestone&&(n.parentItem.isMilestone=!1),u.hasChildRecords=u.childRecords?u.childRecords.length>0:!1,n.level+=1,(y._searchString.length>0||y.model.sortSettings.sortedColumns.length>0)&&(s=!0),t.updateLevel(n,1,s),s||t.refreshGanttRecord(n),u.level===0&&i.parentRecords.indexOf(u)===-1&&i.parentRecords.push(u),n.level>0&&i.parentRecords.indexOf(n)!==-1&&(p=i.parentRecords.indexOf(n),i.parentRecords.splice(p,1)),n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n),n.parentItem&&n.parentItem.predecessor&&i.predecessorMapping&&t._updatePredecessorOnIndentOutdent(n.parentItem),s||t.refreshGanttRecord(u),t.getExpandStatus(n)||(h={},h.expanded=!0,h.data=n.parentItem,t.expanding(h)),t._$treegridHelper.ejTreeGrid("setUpdatedRecords",i.flatRecords,i.updatedRecords,i.ids,i.parentRecords,this.dataSource()),s&&(f.requestType="indent",t._$treegridHelper.ejTreeGrid("processBindings",f),a={},a.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",a),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",i.currentViewData,i.updatedRecords,i.flatRecords,i.ids),t._$ganttchartHelper.ejGanttChart("refreshHelper",i.currentViewData,i.updatedRecords,t._totalCollapseRecordCount),t.updateAltRow(i.updatedRecords,0,1)),i.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection()),v=i.updatedRecords.indexOf(n),w=t.getGanttChartRows(),f={rowElement:w.eq(v),data:t.model.selectedItem,recordIndex:v},t._$ganttchartHelper.ejGanttChart("selectRows",f.recordIndex),t._$treegridHelper.ejTreeGrid("selectRows",f.recordIndex),this.selectedItem(f.data),this.selectedRowIndex(f.recordIndex),i.allowSelection&&i.selectionMode!="cell"&&t.updateIndentOutdentOption(n),i.enableWBS){var b=n.parentItem.WBS,k=n.parentItem.childRecords.length,d=[n];t.reCalculateWBS(d,k,b);t.updateWBSdetails(n.parentItem)}c.data=n;c.requestType="indent";this._trigger("actionComplete",c)}this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_updatePredecessorOnIndentOutdent:function(n){for(var o,i=this,h=n.predecessor.length,u=n.predecessor,e,t,f,s=[],r=0;r<h;r++)u[r].to===n.taskId.toString()?(t=i.model.flatRecords[i.model.ids.indexOf(u[r].from)],e=t.predecessor.indexOf(u[r]),t.predecessor.splice(e,1),f="parent"+t.taskId+"child"+n.taskId,i._$ganttchartHelper.ejGanttChart("removeConnectorline",f),this._updateConnectorLineCollection(f)):u[r].from===n.taskId.toString()&&(t=i.model.flatRecords[i.model.ids.indexOf(u[r].to)],n.childRecords.indexOf(t)!==-1?(e=t.predecessor.indexOf(u[r]),t.predecessor.splice(e,1),o=i._predecessorToString(t.predecessor,t),t.item[model.predecessorMapping]=o,t.predecessorsName=o,model.enableWBS&&model.enableWBSPredecessor&&i._$treegridHelper.ejTreeGrid("updateWBSPredecessor",t),f="parent"+n.taskId+"child"+t.taskId,i._$ganttchartHelper.ejGanttChart("removeConnectorline",f),this._updateConnectorLineCollection(f),i.refreshGanttRecord(t)):s.push(u[r]));n.predecessor=s;n.item[model.predecessorMapping]="";n.predecessorsName="";model.enableWBS&&model.enableWBSPredecessor&&(n.WBSPredecessor="",n.item.WBSPredecessor="")},_removePredecessor:function(n,t){var r=this,o=n.length,u=0,f=r.model,i,e;for(u;u<o;u++)n[u].from!==t.taskId.toString()?i=r.model.flatRecords[r.model.ids.indexOf(n[u].from)]:n[u].to!==t.taskId.toString()&&(i=r.model.flatRecords[r.model.ids.indexOf(n[u].to)]),i&&(e=i.predecessor.indexOf(n[u]),e!==-1&&i.predecessor.splice(e,1),i.item[f.predecessorMapping]&&(i.item[f.predecessorMapping]=r._predecessorToString(i.predecessor,i),i.predecessorsName=i.item[f.predecessorMapping],f.enableWBS&&f.enableWBSPredecessor&&r._$treegridHelper.ejTreeGrid("updateWBSPredecessor",i),r.refreshGanttRecord(i)))},_predecessorToString:function(n,t){var e=this,u=[],i=0,f=n.length,r;for(i;i<f;i++)t.taskId.toString()!==n[i].from&&(r=n[i].from+n[i].predecessorsType,n[i].offset=isNaN(n[i].offset)?0:n[i].offset,n[i].offset!==0&&(n[i].offset<0?r+=n[i].offset.toString()+"d":n[i].offset>0&&(r+="+"+n[i].offset.toString()+"d")),u.push(r));return u.join(",")},getParentItem:function(n,t){var i=this;return n.parentItem.level===t?n.parentItem:i.getParentItem(n.parentItem,t)},getSubChangeIndex:function(n,t,i){for(var u=this,f,r=0;r<u.model.updatedRecords.length;r++)if(u.model.updatedRecords[r].level==n&&u.model.updatedRecords[r].index>t){i.parentItem&&u.model.updatedRecords[r].parentItem.taskId==i.parentItem.taskId&&(f=u.model.updatedRecords[r].index);break}return f},_nextSameLevelItem:function(n,t){var e=this,r=n.parentItem.level,f=t.indexOf(n),u;for(i=f;i<t.length;i++)if(r===t[i].level||r>t[i].level){u=t[i];break}return u},_sendOutdentRequest:function(){var t=this,u=t.model,n=t.getCurrentData(),f={},y={},o,s,p,a,v,e,c,w,h,b,d,k,g,nt,l;if(t.cancelEditCell(),r.isNullOrUndefined(n))alert(t._alertTexts.outdentAlert);else if(f.data=n,f.requestType="outdent",!t._trigger("actionBegin",f)){if(n.level===0||u.editSettings.allowIndent==!1)return;if(o=t._nextSameLevelItem(n,u.flatRecords),p=u.flatRecords.indexOf(n),a=n.parentItem,v=n.parentItem.childRecords.indexOf(n),e=n.parentItem.parentItem,c=e&&n.parentItem.parentItem.childRecords.indexOf(o),n.parentItem.childRecords.splice(v,1),u.parentTaskIdMapping||n.parentItem.item[u.childMapping].splice(v,1),n.parentItem.childRecords.length==0?(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1):n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n.parentItem.childRecords[0]):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n.parentItem.childRecords[0]),e?(c!=-1?e.childRecords.splice(c,0,n):e.childRecords.push(n),u.parentTaskIdMapping?n.item[u.parentTaskIdMapping]=e.taskId:c!=-1?e.item[u.childMapping].splice(c,0,n.item):e.item[u.childMapping].push(n.item),n.parentItem=e):(this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?u.parentTaskIdMapping||this.dataSource().dataSource.json.push(n.item):t._isDataManagerUpdate&&(u.parentTaskIdMapping||(t._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),t._jsonData.push(n.item))):u.parentTaskIdMapping||(o?(d=this.dataSource().indexOf(o.item),this.dataSource().splice(d,0,n.item)):this.dataSource().push(n.item)),n.parentItem=null,u.parentTaskIdMapping&&(n.item[u.parentTaskIdMapping]=null)),w=t._$treegridHelper.ejTreeGrid("getChildCount",n,0),h=u.flatRecords.splice(p,w+1),b=u.ids.splice(p,w+1),s=o?u.flatRecords.indexOf(o):u.flatRecords.length,n.hasChildRecords&&n.childRecords.length>0)for(i=0;i<h.length;i++)u.flatRecords.splice(s,0,h[i]),u.ids.splice(s,0,b[i]),h[i].level-=1,s++;else u.flatRecords.splice(s,0,h[0]),u.ids.splice(s,0,b[0]),h[0].level-=1;n.parentItem&&(n.parentItem.isMilestone&&(n.parentItem.isMilestone=!1),n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n));n.hasChildRecords&&(n.isAutoSchedule?t._updateParentItem(n,null,!0):t._updateManualParentItem(n,null,!0));n.level===0&&u.parentRecords.indexOf(n)===-1&&u.parentRecords.push(n);n.predecessor&&n.predecessor.length>0&&u.predecessorMapping&&n.hasChildRecords&&t._updatePredecessorOnIndentOutdent(n);u.updatedRecords=u.enableVirtualization?t._$treegridHelper.ejTreeGrid("getExpandedRecords",u.flatRecords):u.flatRecords.slice();t._$treegridHelper.ejTreeGrid("setUpdatedRecords",u.flatRecords,u.updatedRecords,u.ids,u.parentRecords,this.dataSource());f.requestType="outdent";t._$treegridHelper.ejTreeGrid("processBindings",f);k={};k.requestType=r.TreeGrid.Actions.Refresh;t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",k);t.model.updatedRecords=t.getUpdatedRecords();t.model.currentViewData=t.getCurrentViewData();t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",u.currentViewData,u.updatedRecords,u.flatRecords,u.ids);t.model.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection());t._$ganttchartHelper.ejGanttChart("refreshHelper",u.currentViewData,u.updatedRecords,t._totalCollapseRecordCount);t.updateAltRow(u.updatedRecords,0,1);g=u.updatedRecords.indexOf(n);nt=t.getGanttChartRows();f={data:t.model.selectedItem,recordIndex:g};t._$ganttchartHelper.ejGanttChart("selectRows",f.recordIndex);t._$treegridHelper.ejTreeGrid("selectRows",f.recordIndex);this.selectedItem(f.data);this.selectedRowIndex(f.recordIndex);u.allowSelection&&u.selectionMode!="cell"&&t.updateIndentOutdentOption(n);u.enableWBS&&(l=a.childRecords&&a.childRecords[v],l&&t.updateWBSdetails(l,!0),t.updateWBSdetails(a),l&&t.updateWBSdetails(l,!0,!0));y.data=n;y.requestType="outdent";this._trigger("actionComplete",y)}this.isCriticalPathEnable==!0&&(this.showCriticalPath(!0,!0),t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId))},_refreshChildLevel:function(n){for(var r=this,t=0,u=n.childRecords,f=u.length,i,t=0;t<f;t++)i=u[t],r.refreshGanttRecord(i),i.hasChildRecords&&r._refreshChildLevel(i)},_updateChildLevel:function(n){for(var u=this,i=0,r=n.childRecords,f=r.length,t,i=0;i<f;i++)t=r[i],t.level=t.level-1,t.hasChildRecords&&u._updateChildLevel(t)},_removeChildRecords:function(n,t){if(n.parentItem){var o=this,i=o.model,u=0,r,f=0,e=0;for(parentChildRecords=n.parentItem.childRecords,parentChildRecordsLength=parentChildRecords&&parentChildRecords.length,u=t;u<parentChildRecordsLength;u++)r=parentChildRecords[u],r&&(n.childRecords?(e=n.childRecords.length,n.childRecords.splice(e,0,r),i.parentTaskIdMapping?r.item[i.parentTaskIdMapping]=n.taskId:n.item[i.childMapping].splice(e,0,r.item)):(n.childRecords=[],n.item[i.childMapping]=[],n.childRecords.push(r),i.parentTaskIdMapping?r.item[i.parentTaskIdMapping]=n.taskId:n.item[i.childMapping].push(r.item)),r.parentItem=n,f++);n.parentItem.childRecords&&(n.parentItem.childRecords.splice(t,f),i.parentTaskIdMapping||n.parentItem.item[i.childMapping].splice(t,f),n.parentItem.childRecords.length==0&&(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1,o.refreshGanttRecord(n.parentItem)))}},updateChildGanttRecordLevel:function(n,t){for(var r=0,u=this,f=u.model,e=n.parentItem&&n.parentItem.parentItem&&n.parentItem.parentItem.childRecords,o=e&&e.length,i,r=t;r<o;r++)i=e[r],i.childRecords?(i.childRecords.splice(i.childRecords.length,0,i),i.item[f.childMapping].splice(i.childRecords.length,0,i.item)):(i.childRecords=[],i.item[f.childMapping]=[],i&&(i.childRecords.push(i),i.item[f.childMapping].push(i.item))),u.refreshGanttRecord(n.parentItem),n.parentItem=i,++addedChildGanttRecordCount;n.parentItem.childRecords.splice(t,addedChildGanttRecordCount);n.parentItem.childRecords.length==0&&(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1);u.refreshGanttRecord(n.parentItem)},updateLevel:function(n,t,i){var e=this,u=0,f=n.childRecords,o=f&&f.length,r;for(u;u<o;u++)r=f[u],r.level+=t,i||e.refreshGanttRecord(r),r.childRecords&&e.updateLevel(r,t,i)},addNewGanttRecord:function(){var t=this,n={},i;i=this.model.flatRecords[this.model.flatRecords.length].item;n.requestType="save";n._cAddedRecord=n.addedRecord=jQuery.extend(!0,{},i);n.recordIndex=index+1;t.subContextMenuAction(n);t._clearContextMenu()},getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this.getExpandStatus(t.parentItem):!0:!0},subContextMenuAction:function(t){var u=this,f=u.model,i=n.extend(!0,{},u._contextMenuSelectedItem.item),e;f.durationUnitMapping||(i.duration=this._getDurationStringValue(u._contextMenuSelectedItem));delete i[f.childMapping];delete i[f.predecessorMapping];delete i.WBSPredecessor;delete i[f.taskNameMapping];e=t.position==="Below"?r.Gantt.RowPosition.BelowSelectedRow:r.Gantt.RowPosition.AboveSelectedRow;f.enableWBS&&(i.WBS=u._getNewWBSid(e));u.addRecord(i,e)},reCalculateWBS:function(n,t,i){var u=this,e=u.model,f,r;if(i)for(r=0;r<n.length;r++)f=t+r,n[r].WBS=i+"."+f,n[r].item.WBS=i+"."+f,e.enableWBSPredecessor&&e.predecessorMapping&&u._getPredecessorIds(n[r]),u.refreshGanttRecord(n[r]),n[r].hasChildRecords&&u._updateChildWBS(n[r]);else for(r=0;r<n.length;r++)f=(t+r).toString(),n[r].WBS=f,n[r].item.WBS=f,e.enableWBSPredecessor&&e.predecessorMapping&&u._getPredecessorIds(n[r]),u.refreshGanttRecord(n[r]),n[r].hasChildRecords&&u._updateChildWBS(n[r])},_updateChildWBS:function(n){for(var r=this,u=r.model,i=n.childRecords,f=n.WBS,t=0;t<i.length;t++)i[t].WBS=f+"."+(t+1),i[t].item.WBS=f+"."+(t+1),u.enableWBSPredecessor&&u.predecessorMapping&&r._getPredecessorIds(i[t]),r.refreshGanttRecord(i[t]),i[t].hasChildRecords&&r._updateChildWBS(i[t])},_getPredecessorIds:function(n){var r=this,u=r.model,f=n.taskId,e=u.flatRecords,i=e.filter(function(n){var i,t,r,u;if(n.predecessorsName)for(i=n.predecessorsName.split(","),t=0;t<i.length;t++)if(r=i[t].match(/(\d+|[A-z]+)/g),u=+r[0],u==f)return n});if(i.length)for(t=0;t<i.length;t++)r._$treegridHelper.ejTreeGrid("updateWBSPredecessor",i[t]),r.refreshGanttRecord(i[t])},_getNewWBSid:function(n){var e=this,u=e.model,i=u.selectionMode=="row"?u.selectedItem:u.updatedRecords[e._rowIndexOfLastSelectedCell],t,o,f,s;return t=i?i.WBS:1,i&&n==r.Gantt.RowPosition.BelowSelectedRow&&(o=t.lastIndexOf(".")!=-1?parseInt(t.substr(t.lastIndexOf(".")+1)):parseInt(t),f=o+1,i.parentItem?(s=i.parentItem?i.parentItem.WBS:null,t=s+"."+f):t=f),t.toString()},_getNewTaskId:function(n){var t=this;return t.model.ids.indexOf(n.toString())==-1?n==0?1:n:(n++,t._getNewTaskId(n))},contextMenuAction:function(n){var t=this;n.requestType=="contextMenuAdd"&&t._sendAddRequest();n.requestType=="contextMenuIndent"&&t._sendIndentRequest();n.requestType=="contextMenuOutdent"&&t._sendOutdentRequest();n.requestType=="contextMenuDelete"&&t._$treegridHelper.ejTreeGrid("deleteRow",null,!0,t._contextMenuSelectedIndex);n.requestType=="contextMenuTaskDetails"&&t._sendEditRequest()},_renderContextMenu:function(t,i,f){var e=this,s={},h,w,l,o,v,b,c,k,p;if((e._contextMenuSelectedIndex=i,e._contextMenuSelectedItem=f,e._contextMenuEvent=t,b=e._$treegridHelper.ejTreeGrid("getCellIndex",t),t||(t=window.event),t.pageX||t.pageY?(w=h=t.pageX,l=t.pageY):(t.clientX||t.clientY)&&(w=h=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),c=this._$treegridHelper.ejTreeGrid("getOffsetRect",e.element[0]),c.bottom=c.top+this.element[0].offsetHeight,c.right=c.left+n(this.element).width(),s.requestType="ContextMenuOpen",s.contextMenuItems=e._contextMenuItems,s.columnIndex=b,s.item=e._contextMenuSelectedItem,s.targetElement=t,s.index=i,!e._trigger("contextMenuOpen",s))&&(e._activeMenuItemId=null,e._contextMenuItems=s.contextMenuItems,e._contextMenuItems.length!=0)){o=r.buildTag("div.e-contextmenu","",{position:"absolute","z-index":e._$treegridHelper.ejTreeGrid("getMaxZIndex")+1},{id:e._id+"_ContextMenu"});k=s.contextMenuItems.filter(function(n){if(n.parentMenuId==null||n.parentMenuId==u)return!0});v=r.buildTag("ul.e-gantt-contextmenu",n.render[e._id+"contextMenuTemplate"](k),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"});o.append(v);n(document.body).append(o);var d=n(o).outerHeight(),a=n(o).outerWidth(),y=o.find(".e-menuitem");y.width(a+2);a=n(o).outerWidth();(c.left>h||c.right<h+a)&&(c.right<h+a&&(h=h-a),h<0&&(h=c.left+10));c.bottom<l+n(v).outerHeight()?(p=l-n(v).outerHeight(),p>0&&(l=p)):n(window).height()+n(window).scrollTop()<l+d&&(l=l-d);o.css({left:h+"px",top:l+"px"});e._$treegridHelper.ejTreeGrid("setFocusOnTreeGridElement");n(o).css({height:"auto"});e._on(o,"contextmenu",function(n){n.preventDefault()});n(y).click(function(){e._contextMenuClickHandler(this)});n(y).mouseenter(function(){n(this).hasClass("e-disable")||(o.find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),e._activeMenuItemId=n(this).attr("id"),e._showSubContextMenu(this,s.contextMenuItems))});t.preventDefault()}},_showSubContextMenu:function(t,i){var v=this.model,f=this,e=[],s=n(t).attr("id"),u,a,h=[],o,c,l;h=i.filter(function(n){return n.menuId==s&&(e=n),n.parentMenuId==s?!0:void 0});e.parentMenuId||n(".e-innerContextmenu").remove();e.parentMenuId&&this._removeContextMenu(e,i);h.length>0&&(u=r.buildTag("div.e-innerContextmenu","",{position:"absolute","z-index":f._$treegridHelper.ejTreeGrid("getMaxZIndex")+1},{id:this._id+"_SubContextMenu"+s}),a=r.buildTag("ul.e-gantt-innercontextmenu",n.render[f._id+"contextMenuTemplate"](h),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),u.append(a),n(document.body).append(u),o=u.find(".e-menuitem"),c=n(u).outerWidth(),o.width(c>100?c:100),l=f._getSubContextMenuPosition(t,u),n(u).css({top:l.top,left:l.left}),n(o).mouseenter(function(){n(this).hasClass("e-disable")||(f._showSubContextMenu(this,i),n(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),f._activeMenuItemId=n(this).attr("id"))}),f._on(u,"contextmenu",function(n){n.preventDefault()}),n(o).click(function(){f._contextMenuClickHandler(this)}))},_removeContextMenu:function(t,i){var e=n("#"+this._id+"_SubContextMenu"+t.parentMenuId),r=n(e).find(".e-contextmenu-mouseover"),u,f;n(r).length>0&&(u=i.filter(function(t){if(t.menuId==n(r).attr("id"))return!0}),u.length>0&&(f=i.filter(function(n){if(n.parentMenuId==u[0].menuId)return!0}),f.length>0&&this._removeContextMenu(f[0],i)),n("#"+this._id+"_SubContextMenu"+n(r).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var a=this.model,s=n(i).outerWidth(),h=n(i).outerHeight(),c=this._$treegridHelper.ejTreeGrid("getOffsetRect",t),u={top:"",left:""},o=n(t).closest(".e-contextmenu"),f,l,r,e;return o.length==0&&(o=n(t).closest(".e-innerContextmenu")),l=n(o).outerWidth(),u.top=c.top-1,u.left=c.left+n(o).width()+1,f=u.left,r=this._$treegridHelper.ejTreeGrid("getOffsetRect",this.element[0]),r.bottom=r.top+this.element[0].offsetHeight,r.right=r.left+n(this.element).width(),(r.left>f||r.right<f+s)&&(r.right<f+s&&(f=f-l-s),f>0&&(u.left=f)),r.bottom<u.top+h&&(e=u.top+h-r.bottom,e=u.top-e-2,e>0&&(u.top=e)),u},_contextMenuClickHandler:function(t){var u=n(t).attr("id"),i=this,r={};if(!n(t).hasClass("e-disable")&&n(t).find(".e-expander").length==0)switch(u){case"Task":r.requestType="contextMenuTaskDetails";i.contextMenuAction(r);i._clearContextMenu();break;case"Indent":r.requestType="contextMenuIndent";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Outdent":r.requestType="contextMenuOutdent";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Delete":r.requestType="contextMenuDelete";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Above":r.requestType="save";r.position="Above";i.subContextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Below":r.requestType="save";r.position="Below";i.subContextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Open":r.requestType="contextMenuAdd";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Add":i._setInitialData();break;default:r.data=i._contextMenuSelectedItem;i._triggerMenuEventHandler(u,r);i._clearContextMenu()}},_triggerMenuEventHandler:function(t,i){var s=this,e=s._contextMenuItems,f,o,u;r.isNullOrUndefined(e)||(f=e.filter(function(n){if(n.menuId.toString()===t)return!0}),f.length>0&&(o=f[0],i.menuId=t,u=o.eventHandler,u&&(typeof u=="string"&&(u=r.util.getObject(u,window)),n.isFunction(u)&&(args=r.event("customContextMenuHandler",this.model,i),u.call(this,args)))))},_setInitialData:function(){var n=this,t=n.model;t.flatRecords.length==0&&(n.addRecord(),n._clearContextMenu())},updateConnectorLines:function(t,i){for(var f=this,s=t.length/2,r=0,e,u,o,r=0;r<s;r++)e=t[r],u=n(f._gridRows).index(e),u!==-1&&(o=f.model.currentViewData[u],o.isExpanded=i)},updateAltRow:function(t,i,r){var f=this;if(f.model.enableAltRow)for(var u=0,h=f.model.currentViewData,c=h.length,e=t.isAltRow,o,s=n(f._gridRows),u=i+r;u<c;u++)n(s[u]).css("display")!=="none"&&(o=h[u],o.isAltRow=!e,e=o.isAltRow,e?n(s[u]).addClass("e-alt-row"):n(s[u]).removeClass("e-alt-row"))},renderedEditDialog:function(t){var i=this,e=this.model,y=e.columns,k=y.length,p={},c,v,w,s,o,u,b,l,h,f,a;switch(t.requestType){case r.TreeGrid.Actions.Add:if(s=document.createElement("div"),o=n("#"+i._id+"_dialogAdd"),n(s).addClass("e-addedrow"),s.innerHTML=n.render[i._id+"_JSONDialogAddingTemplate"](t.data),n(o).html(n(s)),u={},u.cssClass=e.cssClass,u.enableModal=!0,u.width="650px",u.height="auto",u.enableResize=!1,u.contentSelector="#"+i._id,u.rtl=e.rtl,u.showOnInit=!1,u.allowKeyboardNavigation=!1,u.close=function(){n("#"+i._id+"AddAreaNotes").data("ejRTE")&&n("#"+i._id+"AddAreaNotes").ejRTE("destroy")},u.beforeClose=function(n){i._closeAddEditDialog(n,"Add")?n.cancel=!0:i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")},l=i._editDialogTexts.addFormTitle,u.title=l,i._editedDialogRecord={},h=n("#"+i._id+"AddTab"),n(h).ejTab({headerSize:"25px",height:"auto",locale:e.locale,itemActive:function(t){var u=n(t.activeHeader).find("a").attr("href"),r;u=="#"+i._id+"AddNotes"?n("#"+i._id+"AddAreaNotes_Iframe").height("202"):u=="#"+i._id+"AddCustomFields"?(r=n("#treegrid"+i._id+"customFieldAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"280px"}})):u=="#"+i._id+"AddPredecessors"?(r=n("#treegrid"+i._id+"predecessorAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}})):u=="#"+i._id+"AddResources"&&(r=n("#treegrid"+i._id+"resourceAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}}))}}),n(h).find("div.e-content").css("overflow","visible"),n(h).find("div.e-hidebottom.e-addborderbottom.e-content").css("min-height","283px"),n(o).ejDialog(u),f={},f.data=t.data,f.rowPosition=e.editSettings.rowPosition,f.requestType="beforeOpenAddDialog",f.element=n("#"+i._id+"_dialogAdd"),!i._trigger("actionBegin",f)){for(c=0;c<k;c++)p[y[c].field]=f.data[y[c].mappingName];t.data=p;i._refreshEditForm(t);f.data=t.data;f.requestType="OpenAddDialog";f.element=n("#"+i._id+"_dialogAdd");i._trigger("actionBegin",f)||(a=n("#"+i._id+"_dialogAdd_wrapper"),n(o).find(".e-addedrow").css("overflow","visible"),a.addClass("e-ganttdialog"),n(o).ejDialog("refresh"),n(o).ejDialog("open"))}i._addPosition=f.rowPosition;v=this._getDateFromFormat(e.scheduleStartDate);this._getSecondsInDecimal(v)!=this._defaultStartTime&&this._setTime(this._defaultStartTime,v);this._editedDialogRecord.isUpdatedFromDialog=!1;w=e.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Auto?!0:e.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Manual?!1:e.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom?t.data.taskMode==!0?!1:!0:e.taskSchedulingMode;i._editedDialogRecord.isAutoSchedule=w;i._editedDialogRecord.startDate=t.data.startDate?this._checkStartDate(new Date(t.data.startDate)):this._checkStartDate(new Date(v));i._editedDialogRecord.endDate=t.data.endDate?i._editedDialogRecord.startDate.getTime()>new Date(t.data.endDate).getTime()?new Date(i._editedDialogRecord.startDate):new Date(t.data.endDate):new Date(i._editedDialogRecord.startDate);i._editedDialogRecord.duration=t.data.duration!=""?t.data.duration:0;i._editedDialogRecord.durationUnit=e.durationUnit;break;case r.TreeGrid.Actions.BeginEdit:s=document.createElement("div");o=n("#"+i._id+"_dialogEdit");n(s).addClass("e-editedrow");s.innerHTML=n.render[i._id+"_JSONDialogEditingTemplate"](t.data);n(o).html(n(s));u={};u.cssClass=i.model.cssClass;u.rtl=e.rtl;u.width="650px";u.height="auto";u.enableResize=!1;u.contentSelector="#"+i._id;u.enableModal=!0;u.showOnInit=!1;u.allowKeyboardNavigation=!1;u.close=function(){n("#"+i._id+"EditAreaNotes").data("ejRTE")&&n("#"+i._id+"EditAreaNotes").ejRTE("destroy")};u.beforeClose=function(n){i._closeAddEditDialog(n,"Edit")?n.cancel=!0:i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")};b=e.selectionMode=="row"?i.selectedItem():i.model.updatedRecords[i._rowIndexOfLastSelectedCell];l=i._editDialogTexts.editFormTitle;u.open=function(){var r=this,i=this._id,t=n("#"+i+"_title").children(".e-title");t.width("450px");t.css({"word-wrap":"normal","text-overflow":"ellipsis","white-space":"nowrap",display:"inline-block","overflow-x":"hidden",float:"left"});t.attr("title",l)};u.title=l;h=n("#"+i._id+"EditTab");n(h).ejTab({headerSize:"25px",height:"auto",locale:e.locale,itemActive:function(t){var u=n(t.activeHeader).find("a").attr("href"),r;u=="#"+i._id+"EditNotes"?n("#"+i._id+"EditAreaNotes_Iframe").height("202"):u=="#"+i._id+"EditCustomFields"?(r=n("#treegrid"+i._id+"customFieldEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"279px"}})):u=="#"+i._id+"EditPredecessors"?(r=n("#treegrid"+i._id+"predecessorEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}})):u=="#"+i._id+"EditResources"&&(r=n("#treegrid"+i._id+"resourceEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}}))}});n(h).find("div.e-content").css("overflow","visible");n(h).find("div.e-hidebottom.e-addborderbottom.e-content").css("min-height","283px");n(o).ejDialog(u);f={};f.data=t.data;f.requestType="beforeOpenEditDialog";f.element=n("#"+i._id+"_dialogEdit");i._trigger("actionBegin",f)||(i._editedDialogRecord=jQuery.extend({},b),this._editedDialogRecord.isUpdatedFromDialog=!1,i._refreshEditForm(t),f.data=t.data,f.requestType="openEditDialog",f.element=n("#"+i._id+"_dialogEdit"),i._trigger("actionBegin",f)||(a=n("#"+i._id+"_dialogEdit_wrapper"),n(o).find(".e-editedrow").css("overflow","visible"),a.addClass("e-ganttdialog"),n(o).ejDialog("refresh"),n(o).ejDialog("open")));this._editedDialogRecord&&(this._editedDialogRecord.isUpdatedFromDialog=!1)}},_closeAddEditDialog:function(n,t){var i=this,r;if(i._isAddEditDialogSave)i._isAddEditDialogSave=!1;else return r={},r.requestType=t==="Add"?"closeAddDialog":"closeEditDialog",i._trigger("actionBegin",r)},editFormValidate:function(){return n.isFunction(n.validator)?n("#"+this._id+"GeneralEditForm").validate().form():!0},addFormValidate:function(){return n.isFunction(n.validator)?n("#"+this._id+"GeneralAddForm").validate().form():!0},getCurrentData:function(){var n=this,t=n.getUpdatedRecords(),i=n.model.selectionMode=="row"?this.selectedRowIndex():n._rowIndexOfLastSelectedCell;return t&&t[i]},getCurrentViewData:function(){return this._$treegridHelper.ejTreeGrid("getCurrentViewData")},getUpdatedCurrentViewData:function(){return this._$treegridHelper.ejTreeGrid("getUpdatedCurrentViewData")},getRows:function(){return this._$treegridHelper.ejTreeGrid("getRows")},getSelectedCells:function(){return this._$treegridHelper.ejTreeGrid("getSelectedCells")},getGanttChartRows:function(){return this._$ganttchartHelper.ejGanttChart("getGanttChartRows")},getUpdatedRecords:function(){return this._$treegridHelper.ejTreeGrid("getUpdatedRecords")},_getToolBarHeight:function(){var n=0;return this.model.toolbarSettings.showToolbar&&(n=this.element.find(".e-gantttoolbar").height()),n},_initValidator:function(){var t=this;n("#"+this._id+"EditForm").validate({errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,u){var e=u.closest("td"),f=n(i).addClass("e-error"),o=r.buildTag("div.e-errortail e-toparrow");e.find(".e-error").remove();u.hasClass("e-numerictextbox")?f.insertAfter(u.closest(".e-numeric")):f.insertAfter(u);f.prepend(o);t.model.editSettings.editMode!="normal"&&f.offset({left:u.offset().left});f.fadeIn("slow")}})},setValidation:function(){this._initValidator();for(var n=0;n<this._columns.length;n++)r.isNullOrUndefined(this._columns[n].validationRules)||this.setValidationToField(this._columns[n].field,this._columns[n].validationRules)},setValidationToField:function(t,i){var f=n("#"+this._id+t).length>0?n("#"+this._id+t):n("#"+t),u;f.rules("add",i);u=n("#"+this._id+"EditForm").validate();r.isNullOrUndefined(i.required)||(u.settings.messages.Name={},u.settings.messages.Name.required=r.TreeGrid.getColumnByField(proxy._columns,t).headerText+" is required")},_createConnectorLinesCollection:function(n){var u=this,r=this.model,e=r.currentViewData.length,i,f,t,s=u._predecessorsCollection,h=s.length,l=h/2,c=r.enableVirtualization,o;if(r.enableVirtualization&&n==="Load")for(e=r.updatedRecords.length,i=0;i<e;i++)t=r.updatedRecords[i],f=t.predecessor,f&&(o=t,u._addPredecessorsCollection(t,f));else for(i=0;i<e;i++)(t=r.currentViewData[i],c!==!1||t.isExpanded!==!1)&&r.currentViewData.indexOf(t)!==-1&&(f=t.predecessor,f&&(o=t,u._addPredecessorsCollection(t,f)));u._$ganttchartHelper&&u._$ganttchartHelper.ejGanttChart("renderConnectorLines",u._connectorLinesCollection)},_addPredecessorsCollection:function(t,i){var r=this,v,o,e,s,u,h=r.model,f={},c=h.flatRecords,y=h.updatedRecords,l=h.ids,a,p;if(i){for(v=i.length,o=0;o<v;o++)(e=i[o],s=c[l.indexOf(e.from)],u=c[l.indexOf(e.to)],!h.enableVirtualization&&(s&&s.isExpanded===!1||u&&u.isExpanded===!1))||r._isValidationEnabled&&!r._isInExpandCollapse&&u&&r._validatePredecessorDates(u);if(!r._enableCreateCollection)return;for(a=0,n.each(i,function(n,i){return i.to===t.taskId.toString()&&a++,a}),o=0;o<v;o++)(e=i[o],a>1&&(e.isdrawn=!1),s=c[l.indexOf(e.from)],u=c[l.indexOf(e.to)],y.indexOf(s)!==-1&&y.indexOf(u)!=-1)&&(h.enableVirtualization||s.isExpanded!==!1&&u.isExpanded!==!1)&&s&&u&&(f=r._createConnectorLineObject(s,u,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._connectorLinesCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._connectorLinesCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._connectorLinesCollection[p]=f),e.isdrawn=!0))}},_createConnectorLineObject:function(t,i,u){var f={},a=this,v=a.model,l=v.updatedRecords,e=l.indexOf(t),o=l.indexOf(i),c=0,s=0,h,y,p;if(e!==-1&&o!==-1){if(!v.enableVirtualization)if(h=0,o>e){for(c=0;c<e;c++)l[c].isExpanded===!1&&++h;for(s=e,e-=h,s;s<o;s++)l[s].isExpanded===!1&&++h;o-=h}else if(e>o){for(c=0;c<o;c++)l[c].isExpanded===!1&&++h;for(s=o,o-=h,s;s<e;s++)l[s].isExpanded===!1&&++h;e-=h}return y=n("#ejGanttChart"+a._id).ejGanttChart("instance"),p=r.browserInfo().name=="msie"&&r.browserInfo().version<9?v.rowHeight:n("#"+y._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height,e!=-1&&o!=-1?(f.ParentLeft=t.left,f.ChildLeft=i.left,f.ParentWidth=t.width==0||t.isMilestone?a._milesStoneWidth:t.width,f.ChildWidth=i.width==0||i.isMilestone?a._milesStoneWidth:i.width,f.ParentIndex=e,f.ChildIndex=o,f.RowHeight=p,f.Type=u.predecessorsType,f.ConnectorLineId="parent"+t.taskId+"child"+i.taskId,f.milestoneParent=t.isMilestone?!0:!1,f.milestoneChild=i.isMilestone?!0:!1,f):void 0}},_getDateAfterWeekendHolidays:function(n,t){var o=this,r=this.model,e=this._getStringHolidays(),u=new Date(n),i=!1,f;return u.setHours(0,0,0,0),f=this._getFormatedDate(u,r.dateFormat,r.locale),t&&e.indexOf(f)!=-1&&(n.setDate(n.getDate()+1),i=!0),t&&r.includeWeekend===!1&&(n.getDay()==0?(n.setDate(n.getDate()+1),i=!0):n.getDay()==6&&(n.setDate(n.getDate()+2),i=!0)),i?this._getDateAfterWeekendHolidays(n,t):n},_getDateBeforeWeekendHolidays:function(n,t){var o=this,r=this.model,e=this._getStringHolidays(),u=new Date(n),i=!1,f;return u.setHours(0,0,0,0),f=this._getFormatedDate(u,r.dateFormat,r.locale),t&&e.indexOf(f)!=-1&&(n.setDate(n.getDate()-1),i=!0),t&&r.includeWeekend===!1&&(n.getDay()==0?(n.setDate(n.getDate()-2),i=!0):n.getDay()==6&&(n.setDate(n.getDate()-1),i=!0)),i?this._getDateBeforeWeekendHolidays(n,t):n},_updateDateByOffset:function(n,t,i,r){var u,f=t.offset,e=t.offsetDurationUnit;return f<0?u=this._getStartDate(this._checkEndDate(n,r),f*-1,e,r):(u=this._getEndDate(n,f,e,r),i||(u=this._checkStartDate(u,r))),u},_setStartDateByDurationEndDate:function(n){var s=this,f=this.model,h=f.scheduleHeaderSettings.scheduleHeaderType,c=r.Gantt.ScheduleHeaderType,i=f.durationUnit,e=n.isAutoSchedule,o=i==r.Gantt.DurationUnit.Day?n.duration-1:n.duration,t,u;if(n.isMilestone)n.startDate=n.endDate;else{for(t=new Date(n.endDate),u=0;u<o;u++)i==r.Gantt.DurationUnit.Hour?t.setHours(t.getHours()-1):i==r.Gantt.DurationUnit.Day?t.setDate(t.getDate()-1):i==r.Gantt.DurationUnit.Minute&&t.setMinutes(t.getMinutes()-1),t=this._getDateBeforeWeekendHolidays(t,e);n.startDate=new Date(t)}},_validateChildGanttRecord:function(n,t,i){var r=this,h=r.model;if(r._editedTaskBarItem!==t){switch(i.predecessorsType){case"SS":var f=t.taskId.toString(),u=t.predecessor,e=u.filter(function(n){return n.to===f}),o=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(o);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"SF":var f=t.taskId.toString(),u=t.predecessor,e=u.filter(function(n){return n.to===f}),o=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(o);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"FS":var u=t.predecessor,f=t.taskId.toString(),e=u&&u.filter(function(n){return n.to===f}),s=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(s);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"FF":var f=t.taskId.toString(),u=t.predecessor,e=u&&u.filter(function(n){return n.to===f});t.startDate=r._getPredecessorDate(t,e,i.predecessorsType);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status)}this._updateItemValueInRecord(t);t.parentItem&&t.parentItem.isAutoSchedule?r._updateParentItem(t):t.parentItem&&!t.parentItem.isAutoSchedule&&r._updateManualParentItem(t);(r._isTreeGridRendered||r._isGanttChartRendered)&&r.refreshGanttRecord(t)}},_calculateOffset:function(n,t){var r=this,e=r.model,i=r._daydiff(n,t),u,f;return e.includeWeekend||(u=r._calculateWeekendCount(n,i),i=i>0?i-u:i+u),e.holidays.length&&(f=r._calculateHolidayCount(n,t),i=i>0?i-f:i+f),i},_getValidatedStartDate:function(n,t,i){var e=i.predecessorsType,u=i.offset,r,f;switch(e){case"FS":r=new Date(t.endDate);n.isMilestone&&u==0||(r=this._checkStartDate(r,n));u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));f=n.isMilestone?new Date(r):this._checkStartDate(r,n);break;case"FF":r=new Date(t.endDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));n.isMilestone||(r=this._checkEndDate(r,n));f=this._getStartDate(r,n.duration,n.durationUnit,n);break;case"SF":r=new Date(t.startDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));n.isMilestone||(r=this._checkEndDate(r,n));f=this._getStartDate(r,n.duration,n.durationUnit,n);break;case"SS":r=new Date(t.startDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));f=n.isMilestone?r:this._checkStartDate(r,n)}return f},_getPredecessorDate:function(n,t){var e=this.model,i=null,o,r,s=e.flatRecords,h=e.ids,u,c,l,f=t.filter(function(t){if(t.to===n.taskId.toString())return!0});if(f)for(o=f.length,r=0;r<o;r++)predecessor=f[r],c=s[h.indexOf(predecessor.from)],l=s[h.indexOf(predecessor.to)],u=this._getValidatedStartDate(l,c,predecessor),i==null?i=new Date(u):u.getTime()>i.getTime()&&(i=new Date(u));return i},_setBeforeWeekend:function(n){n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1)},_setAfterWeekend:function(n){n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2)},_updateEditedGanttRecords:function(t){var r=this,f=r.model,i=t.data,s=new Date(i.startDate),p=i.isAutoSchedule,y=!1,l,h,e,c,a,o,v;t.columnName==="startDate"?(l=n.extend({},t.data),s=r._checkStartDate(s,i),i.startDate=new Date(s),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate),i._calculateEndDate(this),i.left=i._calculateLeft(this),i.width=i._calculateWidth(this),i.hasChildRecords?(h={},h.previousData=l,h.data=i,r._validateAutoChildRecords(h)):i.progressWidth=i._calculateProgressWidth(i.width,i.status),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName==="endDate"?(e=new Date(i.endDate),e.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,e),e=this._checkEndDate(e,i),i.endDate=new Date(e),f.endDateMapping&&(i.item[f.endDateMapping]=i.endDate),i.isMilestone&&(i.startDate=this._checkStartDate(i.startDate,i),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate)),s.getTime()<=e.getTime()?(i._calculateDuration(this),i.width=i._calculateWidth(this),i.hasChildRecords||(i.progressWidth=i._calculateProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):(i.endDate=t.previousValue,i.item[f.endDateMapping]=t.previousValue),i.isMilestone=i.duration===0?!0:!1,r._updateResourceRelatedFields(i)):t.columnName=="duration"||r._isDurationUpdated?(c=i.duration,c!=0&&i.isMilestone&&(i.startDate=this._checkStartDate(i.startDate,i),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate)),i._calculateEndDate(this),i.isMilestone=c===0?!0:!1,i.width=i._calculateWidth(this),i.hasChildRecords||(i.progressWidth=i._calculateProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName=="predecessor"?(y=!0,t.previousValue&&r._removeConnectorLine(t.previousValue,i),r._addConnectorLine(i)):t.columnName=="status"?(i.status=i.status>100?100:i.status,i.hasChildRecords||(i.progressWidth=r._getProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName=="taskMode"?r._updateGanttRecord(i):(t.columnName=="baselineStartDate"||t.columnName=="baselineEndDate")&&(a=r._getDateFromFormat(i.baselineStartDate),o=r._getDateFromFormat(i.baselineEndDate),o&&o.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,o),i.baselineStartDate=this._checkBaseLineStartDate(a),i.baselineEndDate=this._checkBaseLineEndDate(o),i.baselineStartDate&&i.baselineEndDate&&(i.baselineLeft=i._calculateBaselineLeft(this),i.baselineRight=i._calculateBaselineRight(this),i.baselineWidth=i._calculateBaseLineWidth(this)));i.predecessor&&(r._isMileStoneEdited=i.isMilestone,r._updatedConnectorLineCollection=[],r._connectorlineIds=[],t.columnName==="predecessor"?f.enablePredecessorValidation?r._validatePredecessor(i,t.previousValue):(v=!0,r._validatePredecessorOnEditing(i,v)):r._validatePredecessor(i,u,"successor"),r._updatedConnectorLineCollection.length>0&&(r._$ganttchartHelper.ejGanttChart("appendConnectorLine",r._updatedConnectorLineCollection),this._updateConnectorLineCollection(r._updatedConnectorLineCollection)));r._isValidationEnabled=!1;r.refreshGanttRecord(i)},_removeConnectorLine:function(n,t){for(var c=this,o=this.model,u,r,f,i=0,l=n&&n.length,e=-1,s=o.flatRecords,h=o.ids,i=0;i<l;i++)r=s[h.indexOf(n[i].from)],f=s[h.indexOf(n[i].to)],t.taskId.toString()===n[i].to.toString()&&(e=r.predecessor.indexOf(n[i]),e>=0&&r.predecessor.splice(e,1)),r&&f&&(u="parent"+r.taskId+"child"+f.taskId,c._$ganttchartHelper.ejGanttChart("removeConnectorline",u),this._updateConnectorLineCollection(u))},_addConnectorLine:function(n){var f=this,r=0,e=f.model,u=n.predecessor,o,i,s=e.flatRecords,h=e.ids,t;if(u)for(o=u.length,r=0;r<o;r++)i=u[r],i.to===n.taskId.toString()&&(t=s[h.indexOf(i.from)]),t&&(t.predecessor?t.predecessor.push(i):(t.predecessor=[],t.predecessor.push(i),f._predecessorsCollection.push(t)))},_calculateUpdatedDate:function(n,t){var i=this,f=i.model,e=r.Gantt.DurationUnit,u=0,o;if(t>0)for(u;u<t;u++)f.durationUnit==e.Day?n=i.dateUpdate(n,1,0):f.durationUnit==e.Hour?n=i.dateUpdate(n,0,1):f.durationUnit==e.Minute&&(n=i.dateUpdate(n,0,0,1)),n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2);else for(o=-1*t,u=0;u<o;u++)f.durationUnit==e.Day?n=i.dateUpdate(n,-1,0):f.durationUnit==e.Hour&&(n=i.dateUpdate(n,0,-1)),n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1);return new Date(n)},_updateEditedGanttRecord:function(n){var t=this;if(n.predecessor)for(var s=n.predecessor,u=0,a=s.length,r,f,e,o,i,h=t.model,c=h.flatRecords,l=h.ids,u=0;u<a;u++)t._updatedConnectorLineCollection=[],t._connectorlineIds=[],r=s[u],r.to===n.taskId.toString()&&(f=c[l.indexOf(r.from)],e=c[l.indexOf(r.to)],f&&e&&(o="parent"+f.taskId+"child"+e.taskId,t._$ganttchartHelper.ejGanttChart("removeConnectorline",o),this._updateConnectorLineCollection(o),i=t._createConnectorLineObject(f,e,r),i&&(t._connectorlineIds.length>0&&t._connectorlineIds.indexOf(i.ConnectorLineId)==-1?(t._updatedConnectorLineCollection.push(i),t._connectorlineIds.push(i.ConnectorLineId)):t._connectorlineIds.length==0&&(t._updatedConnectorLineCollection.push(i),t._connectorlineIds.push(i.ConnectorLineId)),t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection))))},_updateTargetGanttRecord:function(n){var t=this,i=t.model;n.startDate=t._checkStartDate(n.startDate,n);n.endDate=this._getEndDate(n.startDate,n.duration,n.durationUnit,n);n.left=n._calculateLeft(this);n.width=n._calculateWidth(this);n.progressWidth=n._calculateProgressWidth(n.width,n.status);n.parentItem&&(n.parentItem.isAutoSchedule==!0?t._updateParentItem(n):t._updateManualParentItem(n));t.refreshGanttRecord(n)},_updateGanttRecord:function(n){var t=this,i=t.model;n.hasChildRecords&&n.isAutoSchedule?(n.startDate=t._checkStartDate(n.manualStartDate,n),n.left=n._calculateManualLeft(this),n.width=n._calculateManualWidth(this),n.progressWidth=n._calculateProgressWidth(n.width,n.status),n.endDate=n.manualEndDate,n._calculateDuration(this)):n.hasChildRecords&&!n.isAutoSchedule?(n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n._calculateDuration(this),n.manualStartDate=n.startDate,n.manualEndDate=n.endDate,t._updateManualParentItem(n,null,!0)):(n.startDate=t._checkStartDate(n.startDate,n),n.endDate=this._getEndDate(n.startDate,n.duration,n.durationUnit,n),n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n.progressWidth=n._calculateProgressWidth(n.width,n.status));n.parentItem&&n.parentItem.isAutoSchedule&&t._updateParentItem(n);n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n);t.refreshGanttRecord(n)},refreshGanttRecord:function(n){var t=this,u,f,i;t._isTreeGridRendered&&(t.model.currentViewData=t.getCurrentViewData(),u=t.model.currentViewData.indexOf(n),f=t._$treegridHelper.ejTreeGrid("instance"),f.model.allowSelection=t.model.allowSelection,r.TreeGrid.refreshRow(f,u),t._isGanttChartRendered&&t._$ganttchartHelper.ejGanttChart("refreshRow",u),i={},i.data=n,i.item=n.item,i.requestType="recordUpdate",t._trigger("actionComplete",i))},_updateManualParentItem:function(n,t,i){var e=this,u=i?n:n.parentItem,o=e.model,ht=o.scheduleHeaderSettings.scheduleHeaderType,ct=r.Gantt.ScheduleHeaderType,lt=new Date(u.startDate),k=new Date(u.manualStartDate),ut=new Date(n.startDate),d=new Date(u.endDate),y=new Date(u.manualEndDate),c=new Date(n.endDate),a,v,b;ut.getTime()<k.getTime()&&(u.manualStartDate=n.startDate);c.getTime()>d.getTime()&&e._isLoad&&(dateDiff=e._daydiff(d,c));c.getTime()>y.getTime()&&(u.manualEndDate=n.endDate,dateManualDiff=e._daydiff(y,c));for(var l=0,p=u.childRecords,g=p&&p.length,f,nt=null,s=null,h=null,w=0,tt=0,it=0,rt=0,l=0;l<g;l++){if(f=p[l],!f.isAutoSchedule&&f.hasChildRecords)var ft=new Date(f.manualStartDate),et=new Date(f.manualEndDate),ot=new Date(f.startDate),st=new Date(f.endDate),a=ft.getTime()<ot.getTime()?f.manualStartDate:f.startDate,v=et.getTime()>st.getTime()?f.manualEndDate:f.endDate;else a=f.startDate,v=f.endDate;s===null&&(s=new Date(a));h===null&&(h=new Date(v),nt=o.flatRecords.indexOf(f));v.getTime()>h.getTime()&&(h=new Date(v),nt=o.flatRecords.indexOf(f));a.getTime()<s.getTime()&&(s=new Date(a));rt+=parseInt(f.work);f.isMilestone?tt++:it+=parseInt(f.status)}k.getTime()!==s.getTime()&&(u.manualStartDate=new Date(s));y.getTime()!=h.getTime()&&(u.manualEndDate=new Date(h));(e._isLoad||e._isChartRendering)&&(u._calculateDuration(this),u.width=u._calculateWidth(this));u.left=u._calculateLeft(this);u.manualLeft=u._calculateManualLeft(this);u._calculateManualDuration(this);u.manualWidth=u._calculateManualWidth(this);u._updateWorkWithDuration(e);u.work+=rt;o.workMapping&&(u.item[o.workMapping]=u.work);b=g-tt;w=b>0?it/b:0;u.progressWidth=e._getProgressWidth(u.manualWidth,w);u.status=Math.floor(w);o.progressMapping&&(u.item[o.progressMapping]=u.status);(e._isTreeGridRendered||e._isGanttChartRendered)&&e.refreshGanttRecord(u);u.parentItem&&u.parentItem.isAutoSchedule&&!i?e._updateParentItem(u):!u.parentItem||u.parentItem.isAutoSchedule||i||e._updateManualParentItem(u,t)},_updateParentItem:function(n,t,i){var o=this,u=i?n:n.parentItem,e=o.model,ut=e.scheduleHeaderSettings.scheduleHeaderType,ft=r.Gantt.ScheduleHeaderType,k=new Date(u.startDate),rt=new Date(n.startDate),v=new Date(u.endDate),d=new Date(n.endDate),c,l,b;rt.getTime()<k.getTime()&&(u.startDate=n.startDate,e.startDateMapping&&(u.item[e.startDateMapping]=u.startDate));d.getTime()>v.getTime()&&(dateDiff=o._daydiff(v,d),u.endDate=n.endDate,e.endDateMapping&&(u.item[e.endDateMapping]=u.endDate));for(var a=0,y=u.childRecords,g=y&&y.length,f,nt=null,s=null,h=null,p=0,w=0,tt=0,it=0,a=0;a<g;a++)f=y[a],c=f.startDate,l=f.endDate,f.hasChildRecords&&!f.isAutoSchedule&&(c=f.startDate.getTime()>f.manualStartDate.getTime()?f.manualStartDate:f.startDate),f.hasChildRecords&&!f.isAutoSchedule&&(l=f.endDate.getTime()<f.manualEndDate.getTime()?f.manualEndDate:f.endDate),s===null&&(s=new Date(c)),h===null&&(h=new Date(l),nt=e.flatRecords.indexOf(f)),l.getTime()>h.getTime()&&(h=new Date(l),nt=e.flatRecords.indexOf(f)),c.getTime()<s.getTime()&&(s=new Date(c)),it+=parseInt(f.work),f.isMilestone?w++:tt+=parseInt(f.status);k.getTime()!==s.getTime()&&(u.startDate=new Date(s),e.startDateMapping&&(u.item[e.startDateMapping]=u.startDate));v.getTime()!=h.getTime()&&(u.endDate=new Date(h),e.endDateMapping&&(u.item[e.endDateMapping]=u.endDate));u._calculateDuration(this);u.left=u._calculateLeft(this);u.width=u._calculateWidth(this);w==u.childRecords.length&&(u.startDate.getTime()==u.endDate.getTime()?u.width=Math.floor((e.rowHeight-6)/2)*2:u.width+=Math.floor((e.rowHeight-6)/2)*2);b=g-w;p=b>0?tt/b:0;u.progressWidth=o._getProgressWidth(u.width,p);u.status=Math.floor(p);u._updateWorkWithDuration(o);u.work+=it;e.workMapping&&(u.item[e.workMapping]=u.work);u.taskType=r.Gantt.TaskType.FixedDuration;u.effortDriven="false";e.progressMapping&&(u.item[e.progressMapping]=u.status);(o._isTreeGridRendered||o._isGanttChartRendered)&&o.refreshGanttRecord(u);u.parentItem&&u.parentItem.isAutoSchedule&&!i?o._updateParentItem(u):!u.parentItem||u.parentItem.isAutoSchedule||i||o._updateManualParentItem(u)},UpdatePredecessor:function(){var n=this;n._updatedRecordsDateByPredecessor();n._$ganttchartHelper.ejGanttChart("clearConnectorLines");n._connectorLinesCollection=[];n._createConnectorLinesCollection();n._$ganttchartHelper.ejGanttChart("renderConnectorLines",n._connectorLinesCollection)},_updatedRecordsDateByPredecessor:function(){for(var r=this,i=this.model,t=i.flatRecords,u=t.length,n=0;n<u;n++)t[n].predecessor&&t[n].item[i.predecessorMapping]&&r._validatePredecessorDates(t[n])},_validatePredecessorDates:function(n){var f=this,r=f.model,y;if(n.predecessor){for(var e=n.predecessor,o,u=null,i,s=r.flatRecords,h=r.ids,c=n.taskId.toString(),l=e.filter(function(n){return n.to===c}),a=e.filter(function(n){return n.from===c}),v=l.length,t=0;t<v;t++)i=l[t],o=s[h.indexOf(i.from)],u=s[h.indexOf(i.to)],(u.isAutoSchedule||r.validateManualTasksOnLinking)&&f._validateChildGanttRecord(o,u,i);y=a.length}},_validatePredecessor:function(n,t,i){var r=this,c=r.model,nt,p;if(n.predecessor){for(var b=n.predecessor,h,o=null,l,e,f,a=c.flatRecords,v=c.ids,y=!1,k=n.taskId.toString(),w=b.filter(function(n){return n.to===k}),d=b.filter(function(n){return n.from===k}),g=w.length,s=0;s<g;s++)e=w[s],y=r._isOffsetChange(e,t,s),h=a[v.indexOf(e.from)],o=a[v.indexOf(e.to)],l="parent"+h.taskId+"child"+o.taskId,r._$ganttchartHelper&&(r._$ganttchartHelper.ejGanttChart("removeConnectorline",l),this._updateConnectorLineCollection(l)),r._isValidationEnabled=c.enablePredecessorValidation&&(o.isAutoSchedule||c.validateManualTasksOnLinking)?!0:!1,(n.taskId.toString()===e.to||n.taskId.toString()===e.from)&&(!i||i=="predecessor")&&r._isValidationEnabled&&r._validateChildGanttRecord(h,o,e,c.enablePredecessorValidation,y);for(s=0;s<g;s++)(e=w[s],h=a[v.indexOf(e.from)],o=a[v.indexOf(e.to)],c.enableVirtualization!==!1||h.isExpanded!==!1&&o.isExpanded!=!1)&&(f=r._createConnectorLineObject(h,o,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._updatedConnectorLineCollection[p]=f)));for(nt=d.length,s=0;s<nt;s++)(e=d[s],h=a[v.indexOf(e.from)],o=a[v.indexOf(e.to)],l="parent"+h.taskId+"child"+o.taskId,y=r._isOffsetChange(e,t,s),r._isValidationEnabled=c.enablePredecessorValidation&&(o.isAutoSchedule||c.validateManualTasksOnLinking)?!0:!1,r._$ganttchartHelper&&(r._$ganttchartHelper.ejGanttChart("removeConnectorline",l),this._updateConnectorLineCollection(l)),i!="predecessor"&&r._isValidationEnabled&&r._validateChildGanttRecord(h,o,e,c.enablePredecessorValidation,y),c.enableVirtualization!==!1||h.isExpanded!==!1&&o.isExpanded!=!1)&&(f=r._createConnectorLineObject(h,o,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._updatedConnectorLineCollection[p]=f)),o&&r._validatePredecessor(o,u,"successor"))}},_updateConnectorLineCollection:function(n){var t,r,u,i;if(typeof n=="string"){for(t=0;t<this._connectorLinesCollection.length;t++)if(this._connectorLinesCollection[t].ConnectorLineId==n){this._connectorLinesCollection.splice(t,1);break}}else for(t=0;t<n.length;t++){for(u=0,i=0;i<this._connectorLinesCollection.length;i++)if(this._connectorLinesCollection[i].ConnectorLineId==n[t].ConnectorLineId){r=n[t];u=t;break}r?this._connectorLinesCollection[u]=r:this._connectorLinesCollection.push(n[t])}},_isOffsetChange:function(n,t,i){var e=this,o=e.model,u=!1;if(!o.enablePredecessorValidation)if(t&&t.length){var s=n.offset?parseInt(n.offset):0,f=t[i],h=f.offset?parseInt(f.offset):0;u=s!=h?!0:!1}else u=r.isNullOrUndefined(t)?!1:!0;return u},_calculateDateDifference:function(n,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(n,t):t+this._calculateWeekendCount(n,t)},_calculateWeekendCount:function(n,t){var u=t>=0?t:-1*t,r=0,i=0;if(t>0)for(i=0;i<t;i++)n.getDay()==0?(r++,n.setDate(n.getDate()+1)):n.getDay()==6?(r+=2,++i,n.setDate(n.getDate()+2)):n.setDate(n.getDate()+1);else for(i=0;i<u;i++)n.setDate(n.getDate()-1),(n.getDay()==0||n.getDay()==6)&&(r+=1);return r},_daydiff:function(n,t){return(new Date(t)-new Date(n))/864e5},_calculateHolidayCount:function(n,t){for(var r=this,e=r.model,u=e.holidays,o=u.length,s=n<t?n:t,h=n>t?n:t,f=0,i=0;i<o;i++)r._getDateFromFormat(u[i].day)>=s&&r._getDateFromFormat(u[i].day)<=h&&f++;return f},dateUpdate:function(n,t,i,r){return r||(r=0),new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours()+i,n.getMinutes()+r,n.getSeconds(),n.getMilliseconds())},_refreshChartAndGridRows:function(){var n=this,t=this.model,i;n._$treegridHelper.ejTreeGrid("processBindings");i={};i.requestType=r.TreeGrid.Actions.Refresh;n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i);n.model.updatedRecords=n.getUpdatedRecords();n.model.currentViewData=n.getCurrentViewData();collapsedRecordCount=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");n._totalCollapseRecordCount=collapsedRecordCount;height=(n.model.updatedRecords.length-collapsedRecordCount)*t.rowHeight;n._$ganttchartHelper.ejGanttChart("setUpdatedRecords",t.currentViewData,t.updatedRecords,t.flatRecords,t.ids);n._$ganttchartHelper.ejGanttChart("refreshHelper",t.currentViewData,t.updatedRecords,n._totalCollapseRecordCount);n._isInAdd||(n._$treegridHelper.ejTreeGrid("updateHeight"),n._$ganttchart.ejGanttChart("updateHeight",height),n._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",collapsedRecordCount),n._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",n.model.updatedRecords.length-collapsedRecordCount),t.enableAltRow&&t.currentViewData.length>0&&r.TreeGrid.updateAltRow(n,t.currentViewData[0],0,0),t.predecessorMapping&&(n._isValidationEnabled=!1,n._connectorlineIds=[],n._connectorLinesCollection=[],n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._createConnectorLinesCollection()))},_refreshGanttOnExpandCollapseAll:function(){var n=this,u={},t=this.model,i=0,f=0;if(t.enableVirtualization)u.requestType=r.TreeGrid.Actions.ExpandCollapse,n._$treegridHelper.ejTreeGrid("updateAltRowOnCollapseAll"),n._$treegridHelper.ejTreeGrid("updateAltRowOnRendering"),n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",u),t.updatedRecords=n.getUpdatedRecords(),t.currentViewData=n.getCurrentViewData(),n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._$ganttchartHelper.ejGanttChart("refreshHelper",n.model.currentViewData,n.model.updatedRecords),n._$treegridHelper.ejTreeGrid("updateHeight");else{if(n._isRefreshAddedRecord){n._refreshChartAndGridRows();n._isRefreshAddedRecord=!1;return}i=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");n._totalCollapseRecordCount=i;f=(n.model.updatedRecords.length-i)*t.rowHeight;n._$ganttchartHelper.ejGanttChart("clearConnectorLines");n._$treegridHelper.ejTreeGrid("updateHeight");n._$ganttchart.ejGanttChart("updateHeight",f);n._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",i);n._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",n.model.updatedRecords.length-i);t.enableAltRow&&t.currentViewData.length>0&&r.TreeGrid.updateAltRow(n,t.currentViewData[0],0,0)}t.predecessorMapping&&(n._isValidationEnabled=!1,n._connectorlineIds=[],n._connectorLinesCollection=[],n._createConnectorLinesCollection());n.isCriticalPathEnable==!0&&n._$ganttchartHelper.ejGanttChart("criticalConnectorLine",n.criticalPathCollection,n.detailPredecessorCollection,!0,n.collectionTaskId)},_collapsedRecords:function(){var t=this,n=t.model;return n.updatedRecords.filter(function(t){return t.parentItem==null?t:t.parentItem[n.expandStateMapping]||r.isNullOrUndefined(t.parentItem[n.expandStateMapping])?t:void 0})},_collapseRecordOnLoad:function(){var n=this,i=n.model,u=0,t,f={},e,s=i.enableVirtualization,o=n.getRows();for(n._gridRows=o,n._isInExpandCollapseAll=!0,e=n._collapsedRecords(),u=0;u<e.length;u++)if(t=e[u],!t[i.expandStateMapping]){if(t[i.expandStateMapping]||r.isNullOrUndefined(t[i.expandStateMapping]))continue;f.data=t;f.recordIndex=u;f.expanded=!1;t.hasChildRecords&&(t[i.expandStateMapping]||r.TreeGrid.sendExpandCollapseRequest(n,f))}i.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapseAll=!1},_collapseAll:function(){var n=this,f=n.model,t=0,i,u={},o=f.enableVirtualization,e=n.getRows();for(n._$treegridHelper.ejTreeGrid("cancelEditCell"),n._gridRows=e,n._isInExpandCollapse=!0,n._isInExpandCollapseAll=!0,t=0;t<n.model.parentRecords.length;t++)i=n.model.parentRecords[t],u.data=i,u.recordIndex=t,u.expanded=!1,i.hasChildRecords&&(n._expandCollapseInnerLevelRecord(i,u.expanded),i.expanded&&r.TreeGrid.sendExpandCollapseRequest(n,u));f.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapse=!1;n._isInExpandCollapseAll=!1},_expandCollapseInnerLevelRecord:function(n,t){for(var f=this,e=n.childRecords.length,u={},i=0;i<e;i++)n.childRecords[i].hasChildRecords&&(f._expandCollapseInnerLevelRecord(n.childRecords[i],t),u.data=n.childRecords[i],u.expanded=t,n.childRecords[i].expanded!==t&&r.TreeGrid.sendExpandCollapseRequest(f,u))},_expandAll:function(){var n=this,f=n.model,t=0,i,u={},s=f.enableVirtualization,e=f.parentRecords,o=e.length;for(n._isInExpandCollapse=!0,n._isInExpandCollapseAll=!0,t=0;t<o;t++)i=e[t],u.data=i,u.recordIndex=t,u.expanded=!0,i.hasChildRecords&&(n._expandCollapseInnerLevelRecord(i,u.expanded),i.expanded||r.TreeGrid.sendExpandCollapseRequest(n,u));f.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapse=!1;n._isInExpandCollapseAll=!1},_getDateFromFormat:function(n){if(n!=null)return typeof n=="object"?new Date(n):n?r.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):r.parseDate(n,this.model.dateFormat,this.model.locale):void 0},_getFormatedDate:function(n,t,i){return r.format(n,t,i)},_destroy:function(){var t=this,i,r;this.element.off();t._off(n(window),"resize",t.windowResize);n("#"+t._id+"_dialogEdit").data("ejDialog")&&n("#"+t._id+"_dialogEdit").data("ejDialog").destroy();n("#"+t._id+"_dialogAdd").data("ejDialog")&&n("#"+t._id+"_dialogAdd").data("ejDialog").destroy();n("#"+t._id+"_dialogAdd").remove();n("#"+t._id+"_dialogEdit").remove();n("#"+this._id+"_toolbarItems_Main").remove();n("#"+this._id+"_dialogEdit_wrapper").remove();n("#"+this._id+"startDateEdit_popup").remove();n("#"+this._id+"endDateEdit_popup").remove();n("#"+this._id+"startDateAdd_popup").remove();n("#"+this._id+"endDateAdd_popup").remove();n("#"+this._id+"taskTypeEdit_popup_wrapper").remove();n("#"+this._id+"_dialogAdd_wrapper").remove();n("#"+this._id+"effortDrivenEdit_popup_wrapper").remove();i=t._$ganttchartHelper.ejGanttChart("instance");i.destroy();r=t._$treegridHelper.ejTreeGrid("instance");r.destroy();t.element.empty().removeClass("e-gantt-core e-gantt "+t.model.cssClass)},_updateToolbar:function(){var t=this,u=t.model,e;n("#"+t._id+"_toolbarItems").remove();u.toolbarSettings.showToolbar&&(t._renderToolBar().insertBefore(n("#e-ejSpliter"+t._id)),t._updateToolbarOptions(""));t._totalBorderHeight=r.browserInfo().name=="msie"&&r.browserInfo().version<9?u.toolbarSettings.showToolbar?3:2:u.toolbarSettings.showToolbar?1:0;t._$treegridHelper.ejTreeGrid("cancelEditCell");var o=n("#"+t._id+"_toolbarItems"),i=t.element.find(".e-ganttviewerbodyContianer"),l=t.element.find(".e-ganttviewerheaderContainer"),s="#ejTreeGrid"+t._id+"e-gridcontent",a=n("#e-ejSpliter"+t._id),h=n(t.element).height()-t._totalBorderHeight,f=h-l.height()-2-o.height(),c=i.ejScroller("option","scrollTop"),v=i.ejScroller("option","scrollLeft");i.ejScroller({height:f});ganttHeight=h-o.height();a.height(ganttHeight);n("#ejTreeGrid"+t._id).height(ganttHeight);n("#ejGanttChart"+t._id).height(ganttHeight);n(s).height(f);i.height(f);n(s).ejScroller("refresh");i.ejScroller("option","scrollTop",c);i.ejScroller("option","scrollLeft",v);t._$treegridHelper.ejTreeGrid("updateViewPortHeight");t._$ganttchartHelper.ejGanttChart("updateViewPortHeight");t.model.enableVirtualization&&(t._$treegridHelper.ejTreeGrid("processBindings"),e={},e.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",e),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords),t._$ganttchartHelper.ejGanttChart("onScrollHelper",c));t._clearContextMenu()},_getDurationStringValue:function(n){var i="",t;return n.duration!=null&&n.duration!=u&&(i+=n.duration+" "),n.durationUnit!=null&&n.durationUnit!=u&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this._durationUnitTexts.days:this._durationUnitTexts.day:n.durationUnit=="hour"?t?this._durationUnitTexts.hours:this._durationUnitTexts.hour:t?this._durationUnitTexts.minutes:this._durationUnitTexts.minute),i}});r.Gantt.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedEdit"};r.Gantt.ToolbarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",Search:"search",Indent:"indent",Outdent:"outdent",ExpandAll:"expandAll",CollapseAll:"collapseAll",PrevTimeSpan:"prevTimeSpan",NextTimeSpan:"nextTimeSpan",NextTimeSpan:"nextTimeSpan",CriticalPath:"criticalPath",ExcelExport:"excelExport",PdfExport:"pdfExport"};r.Gantt.ScheduleHeaderType={Year:"year",Month:"month",Week:"week",Day:"day",Hour:"hour"};r.Gantt.minutesPerInterval={Auto:"auto",OneMinute:"oneMinute",FiveMinutes:"fiveMinutes",FifteenMinutes:"fifteenMinutes",ThirtyMinutes:"thirtyMinutes"};r.Gantt.DurationUnit={Day:"day",Hour:"hour",Minute:"minute"};r.Gantt.WorkUnit={Day:"day",Hour:"hour",Minute:"minute"};r.Gantt.TaskType={FixedUnit:"fixedUnit",FixedWork:"fixedWork",FixedDuration:"fixedDuration"};r.Gantt.workingTimeScale={TimeScale8Hours:"TimeScale8Hours",TimeScale24Hours:"TimeScale24Hours"};r.Gantt.RowPosition={Top:"top",Bottom:"bottom",AboveSelectedRow:"aboveselectedrow",BelowSelectedRow:"belowselectedrow",Child:"child"};r.Gantt.BeginEditAction={DblClick:"dblClick",Click:"click"};r.Gantt.SelectionType={Single:"single",Multiple:"multiple"};r.Gantt.TimescaleRoundMode={Auto:"auto",Year:"year",Month:"month",Week:"week"};r.Gantt.SelectionMode={Row:"row",Cell:"cell"};r.Gantt.TaskSchedulingMode={Auto:"auto",Manual:"manual",Custom:"custom"};r.Gantt.Locale=r.Gantt.Locale||{};r.Gantt.Locale["default"]=r.Gantt.Locale["en-US"]={emptyRecord:"No records to display",alertTexts:{indentAlert:"There is no gantt record is selected to perform the Indent",outdentAlert:"There is no gantt record is selected to perform the Outdent",predecessorEditingValidationAlert:"Cyclic Dependency Occured, Please Check The Predecessor",predecessorAddingValidationAlert:"Fill all the columns in predecessor table",idValidationAlert:"Duplicate ID",dateValidationAlert:"Invalid End date",dialogResourceAlert:"Fill All the columns in resource table"},columnHeaderTexts:{taskId:"ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",resourceInfo:"Resources",duration:"Duration",status:"Progress",taskMode:"Task Mode",subTasksStartDate:"SubTasks Start Date",subTasksEndDate:"SubTasks End Date",scheduleStartDate:"Schedule Start Date",scheduleEndDate:"Schedule End Date",predecessor:"Predecessors",type:"Type",offset:"Offset",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",WBS:"WBS",WBSPredecessor:"WBS Predecessor",dialogCustomFieldName:"Column Name",dialogCustomFieldValue:"Value",notes:"Notes",taskType:"Task Type",work:"Work",unit:"Unit",effortDriven:"Effort Driven"},editDialogTexts:{addFormTitle:"New Task",editFormTitle:"Task Information",saveButton:"Save",deleteButton:"Delete Task",cancelButton:"Cancel",addPredecessor:"Add New",removePredecessor:"Remove",addButton:"Add"},columnDialogTexts:{field:"Field",headerText:"Header Text",editType:"Edit Type",filterEditType:"Filter Edit Type",allowFiltering:"Allow Filtering",allowFilteringBlankContent:"Allow Filtering Blank Content",allowSorting:"Allow Sorting",visible:"Visible",width:"Width",textAlign:"Text Alignment",headerTextAlign:"Header Text Alignment",columnsDropdownData:"Column Dropdown Data",dropdownTableText:"Text",dropdownTableValue:"Value",addData:"Add",deleteData:"Remove",allowCellSelection:"Allow Cell Selection",displayAsCheckbox:"Display As Checkbox",clipMode:"Clip Mode",tooltip:"Tooltip",headerTooltip:"Header Tooltip"},toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",saveTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",searchTool:"Search",indentTool:"Indent",outdentTool:"Outdent",expandAllTool:"Expand All",collapseAllTool:"Collapse All",nextTimeSpanTool:"Next Timespan",prevTimeSpanTool:"Previous Timespan",prevTimeSpanTool:"Previous Timespan",criticalPathTool:"Critical Path",excelExportTool:"Excel Export",pdfExportTool:"PDF Export"},durationUnitTexts:{days:"days",hours:"hours",minutes:"minutes",day:"day",hour:"hour",minute:"minute"},durationUnitEditText:{minute:["m","min","minute","minutes"],hour:["h","hr","hour","hours"],day:["d","dy","day","days"]},workUnitTexts:{day:"days",hour:"hours",minute:"minutes"},taskTypeTexts:{fixedWork:"Fixed Work",fixedUnit:"Fixed Units",fixedDuration:"Fixed Duration"},effortDrivenTexts:{yes:"Yes",no:"No"},contextMenuTexts:{taskDetailsText:"Task Details...",addNewTaskText:"Add New Task",indentText:"Indent",outdentText:"Outdent",deleteText:"Delete",aboveText:"Above",belowText:"Below"},newTaskTexts:{newTaskName:"New Task"},columnMenuTexts:{sortAscendingText:"Sort Ascending",sortDescendingText:"Sort Descending",columnsText:"Columns",insertColumnLeft:"Insert Column Left",insertColumnRight:"Insert Column Right",deleteColumn:"Delete Column",renameColumn:"Rename Column"},taskModeTexts:{manual:"Manual",auto:"Auto"},editTypeTexts:{string:"String",numeric:"Numeric",datePicker:"Date Picker",dateTimePicker:"Date Time Picker",dropdown:"Dropdown",boolean:"Boolean"},textAlignTypes:{right:"Right",left:"Left",center:"Center"},clipModeTexts:{clip:"Clip",ellipsis:"Ellipsis"},columnDialogTitle:{insertColumn:"Insert Column",deleteColumn:"Delete Column",renameColumn:"Rename Column"},deleteColumnText:"Are you sure you want to delete this column?",okButtonText:"OK",cancelButtonText:"Cancel",confirmDeleteText:"Confirm Delete",predecessorEditingTexts:{fromText:"From",toText:"To"},dialogTabTitleTexts:{generalTabText:"General",predecessorsTabText:"Predecessors",resourcesTabText:"Resources",customFieldsTabText:"Custom Fields",notesTabText:"Notes"},predecessorCollectionText:[{id:"SS",text:"Start-Start",value:"Start-Start"},{id:"SF",text:"Start-Finish",value:"Start-Finish"},{id:"FS",text:"Finish-Start",value:"Finish-Start"},{id:"FF",text:"Finish-Finish",value:"Finish-Finish"}]};r.Gantt.GanttRecord=function(){var n=this;n.taskId=null;n.taskName=null;n.startDate=null;n.endDate=null;n.duration=null;n.isMilestone=!1;n.status=null;n.predecessor=null;n.resourceInfo=null;n.parentItem=null;n.isSelected=!1;n.childRecords=null;n.hasChildRecords=!1;n.expanded=!1;n.level=0;n.left=0;n.width=0;n.progressWidth=0;n.item=null;n.baselineLeft=0;n.baselineWidth=0;n.baselineStartDate=null;n.baselineEndDate=null;n.isCritical=!1;n.slack=null;n.isReadOnly=!1;n.hasFilteredChildRecords=!0;n.taskbarBackground=null;n.progressbarBackground=null;n.parentProgressbarBackground=null;n.cellBackgroundColor=null;n.rowBackgroundColor=null;n.treeMappingName=[];n.dragState=!0;n.isSelected=!1;n.durationUnit="";n.isAutoSchedule=!0;n.manualStartDate=null;n.manualEndDate=null;n.manualLeft=0;n.manualDuration=0;n.manualWidth=0};r.Gantt.GanttRecord.prototype={_calculateLeft:function(n){return n._getTaskLeft(this.startDate)},_calculateManualLeft:function(n){return n._getTaskLeft(this.manualStartDate)},_calculateBaselineLeft:function(n){var t=new Date(this.baselineStartDate),i=new Date(this.baselineEndDate);return t&&i?n._getTaskLeft(t):0},_calculateBaselineRight:function(n){var i=new Date(this.baselineStartDate),t=new Date(this.baselineEndDate);return i&&t?n._getTaskLeft(t):0},_updateHoliday:function(n,t,i){var r=0,u=t&&t.length,f;if(u>0){for(r=0;r<u;r++)f=new Date(n),f.setHours(0,0,0,0),this._getFormatedDate(t[r],i.dateFormat,i.locale)==this._getFormatedDate(n,i.dateFormat,i.locale)&&n.setDate(n.getDate()+1);i.includeWeekend==!1&&n.getDay()==6&&n.setDate(n.getDate()+2)}},_calculateGanttRecordLeft:function(n,t,i){var r=this,u=r._daydiff(t,n);return u*i},_calculateReverseLeft:function(n,t,i){var h,u=this,e=0,r=u.startDate,o=u.duration&&parseInt(u.duration),f,s;if(r==null&&(r=new Date(u.endDate),r.setDate(r.getDate()-o)),i==!1){for(f=new Date(u.endDate),s=0;s<o;s++)f.getDay()==0?(e+=2,f.setDate(f.getDate()-2)):f.getDay()==6&&e++,f.setDate(f.getDate()-1);r=new Date(u.endDate);e=o===0?1:e;r.setDate(r.getDate()-(o+e-1))}return u.startDate=new Date(r),h=Math.ceil((r-n)/864e5),h*t},_calculateReverseWidth:function(n,t,i,r){var e=this,s=0,a,u,h=0,f=e.startDate,c=e.duration&&parseInt(e.duration),o=e.endDate,l;if(f==null&&(f=new Date(o),f.setDate(f.getDate()-c+1)),i==!1){for(u=new Date(o),h=0;h<c;h++)u.getDay()==0?(s+=2,u.setDate(u.getDate()-2)):u.getDay()==6&&s++,u.setDate(u.getDate()-1);f=new Date(o);f.setDate(f.getDate()-(c+s-1))}if(r!=null&&r.length>0){for(u=new Date(f),h=0;h<c;h++){for(u.setDate(u.getDate()+1),l=0;l<r.length;l++)e._getDateFromFormat(r[l].day).getDate()==u.getDate()&&s++;i==!1&&(u.getDay()==0||u.getDay()==6)&&s++}o=new Date(e.startDate);o.setDate(o.getDate()+(c+s-1))}return a=Math.ceil((new Date(o)-e.startDate)/864e5)+1,a*n},_calculateWidth:function(n){var t=this,i=new Date(t.startDate),r=new Date(t.endDate);return n._getTaskWidth(i,r)},_calculateManualWidth:function(n){var t=this,i=new Date(t.manualStartDate),r=new Date(t.manualEndDate);return n._getTaskWidth(i,r)},_calculateBaseLineWidth:function(n){var r=this,t=new Date(this.baselineStartDate),i=new Date(this.baselineEndDate);return n._getTaskWidth(t,i)},_getFormatedDate:function(n,t,i){return r.format(n,t,i)},_getDateFromFormat:function(n,t,i){if(n)return r.parseDate(n,t,i)==null?new Date(n):r.parseDate(n,t,i)},_calculateProgressWidth:function(n,t){return n*t/100},_setResourceInfo:function(t,i,r,u,f){var c=this,e=0,h=[],o,s;for(e;e<t.length;e++)o=f.filter(function(n){return t[e]===n[i]}),s=n.extend({},o[0]),o.length?(h.push(s),c._updateResourceUnit(o[0],s,u)):(t.splice(e,1),e--);return h},_updateResourceUnit:function(n,t,i){i!=""?r.isNullOrUndefined(n[i])&&(t[i]=100):t.unit=100},_updateEndDate:function(n,t){var i=this,s=new Date(n),h=new Date(i.startDate),e=i._daydiff(s,h),r=new Date(i.endDate),o=0,u,f;if(t==!1)for(u=0,u;u<=e;u++)r.setDate(r.getDate()+1),(r.getDay()==0||r.getDay()==6)&&(o+=1);f=i.endDate;f.setDate(f.getDate()+e+o);i.endDate=new Date(f)},_calculateFormatedDate:function(n,t,i){return r.format(n,t,i)},_updateParentProgress:function(n,t){var i=0,r=n.childRecords,e=r?r.length:0,o=0,s=0,f=0,u,h;if(r){for(u=0;u<e;u++)r[u].isMilestone?s+=1:o+=parseInt(r[u].status);f=e-s;i=f>0?o/f:0;isNaN(i)&&(i=0);h=n.isAutoSchedule?n.width:n.manualWidth;n.progressWidth=this._getProgressWidth(h,i);n.status=Math.floor(i);t&&(n.item[t]=n.status)}n.parentItem&&this._updateParentProgress(n.parentItem,t)},_getProgressWidth:function(n,t){return n*t/100},_calculatePredecessor:function(n,t,i){var o=[],f,r={},u,s=this.taskId.toString(),e,h=this;return typeof n=="string"&&n.split(",").forEach(function(n){u=n.split("+");e="+";n.indexOf("-")>=0&&(u=n.split("-"),e="-");f=u[0].match(/(\d+|[A-z]+)/g);r={from:f[0],predecessorsType:f.length>1?f[1].toUpperCase():"FS",offset:u.length>1?e+""+u[1]:"0",isdrawn:!1,to:s};var c=h._getOffsetDurationUnit(r.offset,t,i);r.offset=c.duration;r.offsetDurationUnit=c.durationUnit;o.push(r)}),o},_getOffsetDurationUnit:function(n,t,i){var e=0,u=i,f,o;return typeof n=="string"?(f=n.match(/(-?\d*\.*\d+|[A-z]+)/g),f&&f.length<=2&&(e=parseFloat(f[0]),u=f[1]?f[1].toLowerCase():"",u=t.minute.indexOf(u)!=-1?r.Gantt.DurationUnit.Minute:t.hour.indexOf(u)!=-1?r.Gantt.DurationUnit.Hour:t.day.indexOf(u)!=-1?r.Gantt.DurationUnit.Day:i)):(e=n,u=i),isNaN(e)&&(e=0,u=r.Gantt.DurationUnit.Day),o={},o.duration=e,o.durationUnit=u,o},_updateGanttRecord:function(n,t,i,r,u,f,e,o){var s=this,h=s.left%f,c=(s.left-h)/f;startDate=new Date(u);startDate.setDate(u.getDate()+c);startDate.getDay()==0?startDate.setDate(startDate.getDate()+1):startDate.getDay()==6&&startDate.setDate(startDate.getDate()+2);s.startDate=new Date(startDate);s.left=s._calculateLeft(this);s.width=s._calculateWidth(this);s.parentItem&&s._updateParentItem(s,n,t,i,r,u,f,e,o)},_calculateUpdatedDate:function(n,t){var r=this,i=0,u;if(t>0)for(i;i<t;i++)n=r._dataSubtract(n,1),n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2);else for(u=-1*t,i=0;i<u;i++)n=r._dataSubtract(n,-1),n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1);return new Date(n)},_dataSubtract:function(n,t){return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())},_calculateEndDate:function(n){var t=n.model,i=n._getEndDate(this.startDate,this.duration,this.durationUnit,this);this.endDate=new Date(i);t.endDateMapping&&(this.item[t.endDateMapping]=this.endDate)},_calculateTimeScale8Hour:function(n,t){24-n>8&&(t=this.duration<8?this.duration:this.duration%8);(24-n<8||this.duration>8)&&(n=8);t==0&&(t=8);var i=n;do n>=8&&n<13||n>13&&n<=17?(i++,t--,n=n==24?0:n+1):(n=n==24?0:n+1,i++,t--);while(t>0);return i},_dateUpdate:function(n,t,i,r){return r||(r=0),new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours()+i,n.getMinutes()+r,n.getSeconds(),n.getMilliseconds())},_calculateDuration:function(n){var t=n._getDuration(this.startDate,this.endDate,this.durationUnit,this.isAutoSchedule);this.duration=t;model.durationMapping&&this.item&&(this.item[model.durationMapping]=t,model.durationUnitMapping&&(this.item[model.durationUnitMapping]=this.durationUnit))},_calculateManualDuration:function(n){var t=n._getDuration(this.manualStartDate,this.manualEndDate,this.durationUnit,this.isAutoSchedule);this.manualDuration=t},_calculateDateDifference:function(n,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(n,t)+1:t+this._calculateWeekendCount(n,t)},_calculateWeekendCount:function(n,t){var u=t>=0?t:-1*t,r=0,i=0;if(t>0)for(i=0;i<t;i++)n.getDay()==0?(r++,n.setDate(n.getDate()+1)):n.getDay()==6?(r+=2,++i,n.setDate(n.getDate()+2)):n.setDate(n.getDate()+1);else for(i=0;i<u;i++)n.setDate(n.getDate()-1),(n.getDay()==0||n.getDay()==6)&&(r+=1);return r},_updateDurationWithWork:function(n){for(var e,c,r=n.model,o,u=this.resourceInfo,s=u?u.length:0,h=0,t=0,i=n._secondsPerDay/3600,f=0;f<s;f++)e=u[f][r.resourceUnitMapping],c=e>0?i*e/100:i,h+=c;o=this._getTotalWorksInHours(r,i);s!=0&&(t+=o/h);this.durationUnit=="minute"&&(t=t*i*60);this.durationUnit=="hour"&&(t=t*i);t%1!=0&&(t=t.toFixed(2));n._isDurationUpdated=!0;this.duration=t;r.durationMapping&&(this.item[r.durationMapping]=this.duration)},_updateWorkWithDuration:function(n){for(var e,o,i=n.model,u=this.resourceInfo,s=u?u.length:0,t=0,r=n._secondsPerDay/3600,h=this._getDurationInDays(r),f=0;f<s;f++)e=u[f][i.resourceUnitMapping],o=e>0?r*e/100:r,t+=o*h;i.workUnit=="minute"&&(t=t*60);i.workUnit=="day"&&(t=t/r);t%1!=0&&(t=t.toFixed(2));this.work=parseFloat(t);i.workMapping&&(this.item[i.workMapping]=this.work)},_updateUnitWithWork:function(n){var e=n.model,r=this.resourceInfo,u=r?r.length:0,f=n._secondsPerDay/3600,i;if(u!=0){var o=this._getDurationInDays(f),h=this._getTotalWorksInHours(e,f),s=o>0?h/(o*f)*100:0,t=s>0?s/u:100;for(t%1!=0&&(t=t.toFixed(2)),i=0;i<u;i++)r[i][e.resourceUnitMapping]=t}},_getTotalWorksInHours:function(n,t){var i=this;return n.workUnit=="day"?i.work*t:n.workUnit=="minute"?i.work/60:i.work},_getDurationInDays:function(n){var t=this;return this.durationUnit=="hour"?t.duration/n:this.durationUnit=="minute"?t.duration/(n*60):t.duration},_daydiff:function(n,t){return(t-n)/864e5},_hourdiff:function(n,t){return(t-n)/36e5},_getProgressPercent:function(n,t){return Math.ceil((t/n*100).toFixed(2))},_minutediff:function(n,t){return(t-n)/6e4},_setTime:function(n,t){var i=parseInt(n/3600),r=parseInt((n-i*3600)/60),u=n-i*3600-r*60;t.setHours(i,r,u,0)},_endDateUpdate:function(n,t,i,r,u){i||(i=0);var f=new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());return u=="day"||u=="hour"?(f.setHours(24),f.setMinutes(i)):r.length&&(i>0?(f.setHours(24),this._setTime(r[0].from,f),f.setMinutes(i)):this._setTime(r[r.length-1].to,f)),f},_startDateUpdate:function(n,t,i,r,u){i||(i=0);var f=new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());return u=="day"||u=="hour"?f.setMinutes(i):r.length&&(i>0?(this._setTime(r[0].from,f),f.setMinutes(i)):this._setTime(r[0].from,f)),f}};r.Gantt._getPredecessorsValue=function(n){var e=n.predecessor,o,r,u,t,i,f;if(e)for(o=e.length,r="",u=0;u<o;u++)t=e[u],i="",t.from!=n.taskId&&(i=t.from+t.predecessorsType,t.offset!=0&&(i+=t.offset>0?"+"+t.offset+" ":t.offset+" ",f=t.offset!=1,i+=t.offsetDurationUnit=="day"?f?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:t.offsetDurationUnit=="hour"?f?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:f?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r=r.length>0?r+","+i:i);return r};r.Gantt._getDurationStringValue=function(n){var i="",t;return n.duration!=null&&n.duration!=u&&(i+=n.duration+" "),n.durationUnit!=null&&n.durationUnit!=u&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.durationUnit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),i};r.Gantt._getCellValue=function(n){var t=this.data[n];return t?t:this.data.item&&this.data.item[n]}}(jQuery,Syncfusion),function(n,r,u){r.widget("ejTreeGrid","ej.TreeGrid",{_rootCSS:"e-treegrid",element:null,validTags:["div"],model:null,_requiresID:!0,_tags:[{tag:"columns",attr:["field","headerText","allowSorting","editType","allowFiltering","filterEditType","width","visible","editParams","format","isFrozen","allowFreezing","headerTemplateID","allowCellSelection","showCheckbox","showInColumnChooser","validationRules.minlength","validationRules.maxlength","validationRules.range","validationRules.number","validationRules.required","displayAsCheckbox"],content:"template"},{tag:"summaryRows",attr:["title","summaryColumns"],content:"template"},{tag:"summaryRows.summaryColumns",attr:["summaryType","dataMember","displayColumn","prefix","suffix","format"],content:"template"},{tag:"sortSettings.sortedColumns",attr:["field","direction"]},{tag:"sizeSettings",attr:["height","width"]},{tag:"columnResizeSettings",attr:["columnResizeMode"]}],_columns:function(n,t,i){var r=this.element.find(".e-headercelldiv");r[n.columns].innerHTML=i;this._trigger("refresh")},keyConfigs:{focus:"e",editRecord:"113",saveRequest:"13",cancelRequest:"27",firstRowSelection:"36",lastRowSelection:"35",leftArrow:"37",upArrow:"38",rightArrow:"39",downArrow:"40",moveCellRight:"9",moveCellLeft:"shift+9",shiftDownArrow:"shift+40",shiftUpArrow:"shift+38",shiftRightArrow:"shift+39",shiftLeftArrow:"shift+37",shiftHomeButton:"shift+36",shiftEndButton:"shift+35",selectedRowExpand:"alt+40",totalRowExpand:"ctrl+40",selectedRowCollapse:"alt+38",totalRowCollapse:"ctrl+38",deleteRecord:"46",spaceBar:"32",topRowSelection:"ctrl+36",bottomRowSelection:"ctrl+35",nextPage:"33",prevPage:"34"},defaults:{expandStateMapping:"",allowFiltering:!1,allowDragAndDrop:!1,dragTooltip:{showTooltip:!1,tooltipItems:[],tooltipTemplate:""},allowSorting:!1,allowColumnResize:!1,allowSelection:!0,allowPaging:!1,dataSource:null,query:r.Query(),idMapping:"",parentIdMapping:"",readOnly:!1,showGridCellTooltip:!1,cellTooltipTemplate:null,showGridExpandCellTooltip:!1,showColumnChooser:!1,showColumnOptions:!1,enableAltRow:!0,selectedItem:null,toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},editSettings:{allowEditing:!1,allowAdding:!0,allowDeleting:!0,editMode:"cellEditing",rowPosition:"top",beginEditAction:"dblclick",dialogEditorTemplateID:""},enableVirtualization:!1,allowMultiSorting:!1,sortSettings:{sortedColumns:[]},filterSettings:{filterBarMode:"immediate",filteredColumns:[],filterType:"filterbar"},selectionType:"single",selectionMode:"row",selectionSettings:{selectionType:"single",selectionMode:"row",enableHierarchySelection:!0,enableSelectAll:!0},selectedCellIndexes:[],selectedRowIndex:-1,showSummaryRow:!1,summaryRows:[],showTotalSummary:!1,allowKeyboardNavigation:!0,cssClass:"",locale:"en-US",isEdit:!1,allowScrolling:!1,scrollSettings:{frozenColumns:0},groupSettings:{groupedColumns:[]},sizeSettings:{height:"",width:""},enableResize:!0,isResponsive:!0,showDetailsRow:!1,showDetailsRowInfoColumn:!1,detailsTemplate:"",detailsRowHeight:100,rowDataBound:null,load:null,create:null,queryCellInfo:null,rowSelecting:null,rowSelected:null,cellSelecting:null,cellSelected:null,beginEdit:null,endEdit:null,expanding:null,expanded:null,collapsing:null,collapsed:null,actionComplete:null,actionBegin:null,currentViewData:[],flatRecords:[],parentRecords:[],updatedRecords:[],summaryRowRecords:[],selectedItems:[],ids:[],columns:[{field:"",headerText:"",editType:"",filterEditType:"",allowFiltering:!1,allowFilteringBlankContent:!0,allowSorting:!1,visible:"",textAlign:r.TextAlign.Left,headerTextAlign:r.TextAlign.Left,allowCellSelection:!0,clipMode:"",headerTooltip:"",tooltip:"",showInColumnChooser:!0},],columnDialogFields:[],commonWidth:150,dateFormat:"MM/dd/yyyy",rowHeight:30,emptyRecordText:"No Records To Display",treeColumnIndex:0,workingTimeScale:"TimeScale8Hours",childMapping:"",enableCollapseAll:!1,rowTemplateID:"",altRowTemplateID:"",parseRowTemplate:!0,contextMenuSettings:{showContextMenu:!1,contextMenuItems:[]},contextMenuOpen:null,rowDragStart:null,rowDrag:null,rowDragStop:null,detailsDataBound:null,detailsShown:null,detailsHidden:null,toolbarClick:null,columnResizeStart:null,columnResizeEnd:null,columnResized:null,recordClick:null,exportToPdfAction:"",exportToExcelAction:"",allowMultipleExporting:!1,headerTextOverflow:"none",pageSettings:{pageSize:12,pageCount:8,currentPage:1,totalPages:0,totalRecordsCount:null,pageSizeMode:"all",template:null},allowColumnReordering:!1,columnResizeSettings:{columnResizeMode:"normal"}},dataTypes:{columns:"array",summaryRows:"array",summaryRows:{summaryColumns:"array"},sortSettings:{sortedColumns:"array"},filterSettings:{filteredColumns:"array",filterType:"string"},dataSource:"data",query:"data",currentViewData:"array",flatRecords:"array",parentRecords:"array",updatedRecords:"array",summaryRowRecords:"array",ids:"array",contextMenuSettings:{contextMenuItems:"array"},toolbarSettings:{toolbarItems:"array",customToolbarItems:"array"},selectedItem:"data",summaryRows:"array"},ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","enableRTL","rowDataBound","rowTemplate","parseRowTemplate","detailsTemplate","editSettings","localization","cssClass","dataSource","allowKeyboardNavigation","pageSettings","columnResizeSettings"],observables:["selectedRowIndex","dataSource","selectedCellIndexes","pageSettings.currentPage"],selectedItem:r.util.valueFunction("selectedItem"),selectedRowIndex:r.util.valueFunction("selectedRowIndex"),selectedCellIndexes:r.util.valueFunction("selectedCellIndexes"),dataSource:r.util.valueFunction("dataSource"),_currentPage:r.util.valueFunction("pageSettings.currentPage"),_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},getHeaderTable:function(){return this._$gridHeaderTable},setGridHeaderTable:function(n){this._$gridHeaderTable=n},getHeaderContent:function(){return this._$gridHeaderContent},setGridHeaderContent:function(n){this._$gridHeaderContent=n},getContentTable:function(){return this._$gridContentTable},getContent:function(){return this._$gridContent},setGridContentTable:function(n){this._$gridContentTable=n},getRows:function(){return this._excludeDetailRows()},getSelectedCells:function(){var n=this,i=n.model,t=[];return this._selectedCellDetails.forEach(function(r){var f=r.data,u=i.currentViewData.indexOf(f);u!=-1&&(r.cellElement=n.getRows()[u].childNodes[r.cellIndex]);t.push(r.cellElement)}),t},setGridRows:function(n){this._$gridRows=n},getCurrentViewData:function(){return this.model.currentViewData},getUpdatedCurrentViewData:function(){return this._updateCurrentViewData(),this.model.currentViewData},getFlatRecords:function(){return this.model.flatRecords},setHeight:function(n){this._totalHeight=n},getUpdatedRecords:function(){var n=this.model;return!this._isFromGantt&&n.allowPaging?this._updatedPageData:n.updatedRecords},getsummaryRowRecords:function(){return this.model.summaryRowRecords},getDataSource:function(){return this.dataSource()},getUpdatedIds:function(){return this.model.ids},getRecordsCount:function(){return this._recordsCount},setRecordsCount:function(n){this._recordsCount=n},setFocusOnTreeGridElement:function(){this._focusTreeGridElement()},updateCollapsedRecordCount:function(){var n=this,i=this.model,t=[];t=i.updatedRecords.filter(function(t){return n.getExpandStatus(t)==!1});n._totalCollapsedRecordCount=t.length},_getDetailsExpandedRecords:function(n){var t=this;return n.filter(function(n){return n.isDetailsExpanded==!0})},_getExpandedDetailsRowHeight:function(){var t=this,u=this.model,i,n,r=t.getUpdatedRecords();return i=this.getExpandedRecords(r),n=this._getDetailsExpandedRecords(i),n=t._spliceSummaryRows(n),t._detailsRowHeight*n.length},getCollapsedRecordCount:function(){return this._totalCollapsedRecordCount},_colgroupRefresh:function(){var e=this.model,i,t;this._frozenColumnsLength>0?(i=n(this.getHeaderTable()).find("colgroup"),t=n(this.getContentTable()).find("colgroup")):(i=n(this.getHeaderTable()).find("colgroup")[0],t=n(this.getContentTable()).find("colgroup")[0]);var r=n(i).clone(),u=n(t).clone(),f=n(t).clone();n(t).remove();n(i).remove();this._frozenColumnsLength>0?(n(r[0]).prependTo(this.getHeaderTable()[0]),n(r[1]).prependTo(this.getHeaderTable()[1]),n(u[0]).prependTo(this.getContentTable()[0]),n(u[1]).prependTo(this.getContentTable()[1]),this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(f[0]).prependTo(this._$footertableContent[0]),n(f[1]).prependTo(this._$footertableContent[1])),this._$totalSummaryRowContainer&&this.getBrowserDetails().browser=="safari"&&this._$totalSummaryRowContainer.find("#e-movablefooter"+this._id).css("margin-left","auto"),this.getBrowserDetails().browser=="safari"&&this.getHeaderContent().find("#e-movableheader"+this._id).add(this.getContent().find("#e-movablecontainer"+this._id)).css("margin-left","auto"),n("#e-frozencontentdiv"+this._id).length&&n("#e-frozencontentdiv"+this._id).css("width","100%")):(n(r).prependTo(this.getHeaderTable()),n(u).prependTo(this.getContentTable()),this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(f).prependTo(this._$footertableContent)))},_detailColsRefresh:function(){if(this._$headerCols=this.getHeaderTable().children("colgroup").find("col"),this._$contentCols=this.getContentTable().children("colgroup").find("col"),this.model.detailsTemplate&&this.model.showDetailsRow&&this.model.showDetailsRowInfoColumn||this.model.isFromGantt){var n=this.model.columns.length;this._$headerCols.length>n&&this._$headerCols.splice(n,1);this._$contentCols.length>n&&this._$contentCols.splice(n,1)}},_swipeAction:function(n){var u=this,t=this._currentPage(),r=!0,i=(this.getScrollObject()||{})._scrollXdata;i&&(r=n.type=="swipeleft"?i.scrollable-i.sTop==0:i.sTop==0);switch(n.type){case"swipeleft":this.model.allowPaging&&t!=this.model.pageSettings.totalPages&&!this.model.isEdit&&(r||!u.getScrollElement().ejScroller("isHScroll"))&&this.element.ejTreeGrid("gotoPage",t+1);break;case"swiperight":this.model.allowPaging&&t>1&&!this.model.isEdit&&(r||!u.getScrollElement().ejScroller("isHScroll"))&&this.element.ejTreeGrid("gotoPage",t-1)}},gotoPage:function(n){if(this.model.allowPaging){var t=this,u=t.model,i={},f;r.isNullOrUndefined(n)?n=t._currentPage():n<=0?n=1:n>u.pageSettings.totalPages&&(n=u.pageSettings.totalPages);n=r.isNullOrUndefined(n)?t._currentPage():n;i.previousPage=this._prevPageNo;this._currentPage(n);i.currentPage=n;u.allowPaging&&(i.requestType=r.TreeGrid.Actions.Paging);t._setScrollTop();t._updateCurrentViewData();t.renderRecords(i);t.updateHeight();t.getScrollElement().ejScroller("refresh");t._updateScrollCss();f&&this._currentPage(i.previousPage);i.previousPage!=i.currentPage&&(t.clearSelection(-1),t.selectedRowIndex(-1),t.model.selectedItem=null,t._cancelSaveTools(),t._clearContextMenu(),t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&t._clearMultiSelectPopup(),this._prevPageNo=i.currentPage)}},_pagerClickHandler:function(n){var t=this;if(this._prevPageNo!=n.currentPage)return t._isNextPage=!0,t._isRowEdit?t.cancelRowEditCell():t.model.isEdit&&t.cancelEditCell(),this.gotoPage(n.currentPage),!1},_init:function(){var n=this,t,i,r;if(n.model.isdesignMode){for(n.model.columns=[{field:"Column1",HeaderText:"Column1"},{field:"Column2",HeaderText:"Column2"},{field:"Column3",HeaderText:"Column3"},{field:"Column4",HeaderText:"Column4"}],n.model.childMapping="Children",t=[{Column1:"Value 1",Column2:"Value 2",Column3:"Value 3",Column4:"Value 4",Children:[]}],i=1;i<4;i++)r={Column1:"Value 1",Column2:"Value 2",Column3:"Value 3",Column4:"Value 4"},t[0].Children.push(r);this.dataSource(t);this.model.sizeSettings.height="250px";this.model.sizeSettings.width="600px"}n._trigger("load");n._validateColumnFields();n._initPrivateProperties();n._setCultureInfo();n._initDatasource();n._processEditing();n.model.showColumnChooser&&n.model.showColumnOptions&&(n.columnAddDialogTemplate(),n._renderUpdateConfirmDialog());n._createDragTooltipTemplate();n._createTooltipTemplate()},_renderEditDialog:function(){return r.buildTag("div.e-editdialog-padding","",{display:"none"},{id:this._id+"_dialogEdit"})},_validateColumnFields:function(){var i=this,t=i.model.columns,n;if(!r.isNullOrUndefined(t))for(n=0;n<t.length;n++)r.isNullOrUndefined(t[n].field)&&(t[n].field="",t[n].allowEditing=!1,t[n].allowSorting=!1,t[n].allowFiltering=!1),r.isNullOrUndefined(t[n].editType)&&(t[n].editType="stringedit")},_treeGridAddEditDialog:function(){var t;if(this.model.columns.length!=0){var i=r.buildTag("div"),o=r.buildTag("form.treegridform","",{},{id:this._id+"EditFormDialog"}),s=r.buildTag("table","",{margin:"0 auto"},{}),f,h,e,l,c;for(t=0;t<this.model.columns.length;t++)(this.model.columns[t].visible||r.isNullOrUndefined(this.model.columns[t].visible))&&this.model.columns[t].field!="checkboxState"&&(l="tr",c="td",f=r.buildTag(l),h=r.buildTag(c+".e-editdialoglabel","",{"text-align":"right"}),e=r.buildTag(c+".e-editdialogrowcell","",{"text-align":"left"}),f.append(h.get(0)).append(e.get(0)),this.model.columns[t].headerText==u&&(this.model.columns[t].headerText=this.model.columns[t].field),h.append("<label for='"+this.model.columns[t].field+"'>"+this.model.columns[t].headerText+"<\/label>"),this.model.columns[t].allowEditing!=!1&&this.model.columns[t].field&&r.TreeGrid._initCellEditType(this,e,this._id,t),this.model.columns[t].allowEditing==!1&&e.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[t].visible===!1&&f.addClass("e-hide"),s.append(f));o.append(s);o.appendTo(i);i=this._renderDiaglogButton(o,i,s);n.templates(this._id+"_JSONDialogEditingTemplate",i.html())}},_treeGridAddEditDialogTemplate:function(){if(this.model.columns.length!=0){var t=r.buildTag("div","",{display:"none"}),i=r.buildTag("form.treegridform","",{},{id:this._id+"EditFormDialog"}),u=this.model.editSettings.dialogEditorTemplateID;i.html(n(u).html());t=this._renderDiaglogButton(i,t);n.templates(this._id+"_JSONdialogTemplateMode",t.html())}},_renderDiaglogButton:function(n,t,i){var u,s=this._contextMenuTexts,f,e,o;return u="EditFormDialog_",r.isNullOrUndefined(i)?(f=r.buildTag("input.e-save e-button e-btnsub e-flat","",{"margin-left":"33%"},{type:"button",id:u+this._id+"_Save"}),f.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.saveText,width:"30%"}),e=r.buildTag("input.e-cancel e-button e-btncan e-flat","",{"margin-left":"7%"},{type:"button",id:u+this._id+"_Cancel"}),e.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.cancelText,width:"30%"})):(f=r.buildTag("input.e-save e-button e-btnsub e-flat","",{"margin-left":"0px"},{type:"button",id:u+this._id+"_Save"}),f.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.saveText,width:"45%"}),e=r.buildTag("input.e-cancel e-button e-btncan e-flat","",{"margin-left":"10%"},{type:"button",id:u+this._id+"_Cancel"}),e.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.cancelText,width:"45%"})),o=r.buildTag("div","",{},{"class":"e-editform-btn e-editdialogbutton"}),r.isNullOrUndefined(i)||($innerTr=r.buildTag("tr"),$innerTd1=r.buildTag("td.e-editdialoglabel"),$innerTd2=r.buildTag("td.e-editdialogrowcell")),o.append(f),o.append(e),r.isNullOrUndefined(i)||($innerTd2.append(o),$innerTr.append($innerTd1),$innerTr.append($innerTd2),i.append($innerTr)),n.appendTo(t),r.isNullOrUndefined(i)?n.append(o):n.append(i),t},updateAllowKeyboardNavigation:function(n){this.model.allowKeyboardNavigation=n},_refreshFooterSummaryRecords:function(){var t=this,f=this.model,i,u;f.showTotalSummary&&t._$footerContainer.length>0&&(this._frozenColumnsLength>0?(t._$footerContainer.html(this._renderSummaryByFrozenDesign()),this._renderFrozenSummary()):(i=r.buildTag("table.e-table#"+t._id+"summarye-table","",{top:"0px"},{cellspacing:"0px"}),u=r.buildTag("tbody"),i.append(t.getContentTable().find("colgroup").clone()).append(u),u.html(n.render[this._id+"_Template"](t._footerSummaryRecord)),t._$footerContainer.empty().append(i)),t._$footertableContent=t._$footerContainer.find(".e-table"))},_updateHeaderScrollLeft:function(n){var t=this,i=this.model;r.isNullOrUndefined(n)&&(n=t.getScrollElement().ejScroller("option","scrollLeft"));this._frozenColumnsLength>0?(t._$gridHeaderContainer.find("#e-movableheader"+this._id).scrollLeft(n),t.model.showTotalSummary&&t._$footerContainer&&t._$footerContainer.find("#e-movablefooter"+this._id).scrollLeft(n)):(t._$gridHeaderContainer.scrollLeft(n),t.model.showTotalSummary&&t._$footerContainer&&t._$footerContainer.scrollLeft(n))},updateColumns:function(n){var t=this,i=this.model;i.columns=n;t._refreshFrozenColumns()},updateToGanttColumns:function(){var t=this,i=t.model,r=i.columns,u=n("#"+t._id.replace("ejTreeGrid","")).data("ejGantt");u.updateGanttColumns(r)},_updateAddEditDialogTemplate:function(){var t=this,r=t.model,u=r.columns,i=n("#"+t._id.replace("ejTreeGrid","")).data("ejGantt");i.addDialogTemplate();i.editDialogTemplate()},_refreshFrozenColumns:function(){var t=this,i=this.model,f=!1,o,s,u,h,e,c,l;if(t._initFrozenColumns(),t._processEditing(),t._$gridHeaderContent.replaceWith(t._renderGridHeader()),t._addInitTemplate(),i.isFromGantt&&t._$gridContent.removeClass("e-borderbox"),this._frozenColumnsLength>0&&t._$frozenTableContent.length==0?(f=!0,o=t._$gridContent.css("width"),s=t._$gridContent.css("height"),t._$gridContent.ejScroller("destroy"),t._$gridContent.css("width",o),t._$gridContent.css("height",s),t._$gridContainer.html(t._renderByFrozenDesign()),t.setGridContentTable(t._$gridContainer.find(".e-table")),t._$gridContainer.find("#e-movablecontent"+t._id+",#e-movablecontentdiv"+t._id+",#e-frozencontentdiv"+t._id).css("height",t._$gridContainer.css("height")),t._renderScroller(!0)):t._$frozenTableContent.length>0&&this._frozenColumnsLength==0&&(f=!0,t._$gridContent.find("#e-movablecontainer"+t._id).ejScroller("destroy"),u=r.buildTag("table.e-table#"+t._id+"e-table","",{top:"0px",position:"relative"},{cellspacing:"0px"}),h=r.buildTag("tbody"),u.append(t.getHeaderTable().find("colgroup").clone()).append(h),t._$gridContainer.html(u),t.setGridContentTable(u),t._renderScroller(!0)),t._$frozenTableContent=n("#"+t._id+"frozene-table"),t._$movableTableContent=n("#"+t._id+"movablee-table"),t._$tableContent=n("#"+t._id+"e-table"),i.showTotalSummary&&t._$footerContainer.length>0&&t._refreshFooterSummaryRecords(),f)t.onScrollHelper(0);e={};e.requestType=r.TreeGrid.Actions.Refresh;t._isRendered=!1;t.sendDataRenderingRequest(e);t.setWidthToColumns();t._isRendered=!0;t._trigger("refresh");this._eventBindings();this._hideCollapsedDetailsRows();t.getScrollElement().ejScroller("refresh");t._updateScrollCss();i.isFromGantt&&(c=t.getScrollElement(),l=c.ejScroller("isHScroll"),l?t._$gridContent.removeClass("e-borderbox"):t._$gridContent.addClass("e-borderbox"));i.showColumnChooser&&t._renderColumnChooserList(!0);t._updateHeaderScrollLeft();i.isFromGantt&&(t._addEmptyColumntoGrid(),t.updateToGanttColumns())},freezePrecedingColumns:function(n){var s=this,f=this.model,e=f.columns,o=this.getColumnByField(n),t=e.indexOf(o),i,u;if((this.editFormValidate()&&(f.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),this._clearContextMenu(),this._removeDetailsRow(),this._clearColumnMenu(),r.isNullOrUndefined(o)||t==-1)||t==0&&t<=this._frozenColumnsLength||(i=this._getFrozenColumnWidth(t),i=i+18,i>this._gridWidth))return!1;for(u=0;u<t;u++)e[u].isFrozen=!0;s._refreshFrozenColumns()},freezeColumn:function(n,t){var i=this,u=this.model,s=u.columns,f=this.getColumnByField(n),e,o;if((this.editFormValidate()&&(u.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),this._clearContextMenu(),this._removeDetailsRow(),this._clearColumnMenu(),u.selectionSettings.selectionMode=="cell"&&i.clearSelection(),r.isNullOrUndefined(f))||i._frozenColumnsLength==u.columns.length-1&&t||f.isFrozen==t||(e=this._getFrozenColumnWidth(),o=s.indexOf(f),e=e+(t?this.columnsWidthCollection[o]+18:-this.columnsWidthCollection[o]),e>this._gridWidth))return!1;f.isFrozen=t;i._refreshFrozenColumns();i._off(i.element,"mousewheel DOMMouseScroll",i._mouseWheel);this._frozenColumnsLength&&i._on(i.element,"mousewheel DOMMouseScroll",i._mouseWheel)},updateCheckboxColumn:function(t){var i=this,h=i.model,u=h.columns,s=i.getColumnByField(t),f,e,o;i._checkboxSelection&&(n.each(u,function(n,t){t.showCheckbox=!1}),r.isNullOrUndefined(s)||(f=u.indexOf(s),f>-1&&(u[f].showCheckbox=!0)),e={},o={},e.selectionType=r.TreeGrid.SelectionType.Checkbox,o.selectionSettings=e,i._refreshSelectionSettings(o,"selectionSettings"))},_refreshSelectionSettings:function(t,i){var u=this,f=u.model,o=!1,e,s,h;o=!r.isNullOrUndefined(t[i].selectionType)||!r.isNullOrUndefined(t[i].selectionMode);i=="selectionType"?(f.selectionSettings.selectionType=t[i],o=!0):i=="selectionMode"?(f.selectionSettings.selectionMode=t[i],o=!0,f.showColumnChooser&&f.showColumnOptions&&u.columnAddDialogTemplate()):n.extend(f.selectionSettings,t[i]);e=f.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox&&f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row;(!r.isNullOrUndefined(t[i].enableHierarchySelection)&&f.selectedItems.length>0||!e&&u._checkboxSelection)&&(u._isFromSetmodel=!0,u.selectAllRows(!1),u._isFromSetmodel=!1);(u._checkboxSelection||e)&&(u._checkboxSelection=e,u._processEditing(),(!e&&u._checkboxColumnName=="checkboxState"||f.columns[0].nonColumn&&u._checkboxColumnName!="checkboxState")&&(s=f.columns[f.treeColumnIndex],f.columns[0].isFrozen&&(f.columns[0].isFrozen=!1,u._frozenColumnsLength-=1,h=u._frozenColumns.indexOf(f.columns[0]),u._frozenColumns.splice(h,1),f.scrollSettings.frozenColumns=this._frozenColumnsLength),f.columns.splice(0,1),s&&(f.treeColumnIndex=f.columns.indexOf(s))),u._checkboxSelection||(u._checkboxColumnName=null),u._$gridHeaderContent.replaceWith(u._renderGridHeader()),u._setWidthToHeaders(),f.allowFiltering&&u._resizeFilteringElements(),o&&(u._addInitTemplate(),this.renderRecords()),u.setWidthToColumns(),u._updateScrollCss(),u._updateHeaderScrollLeft(),f.selectedItems.length>0&&u.selectAllRows())},_setModel:function(t){var i=this,u=i.model,y=i.getUpdatedRecords(),f,tt,g,lt,it,ot,v,at,l,p,st,ht,w,rt,c,b,k,d,h,s,vt,ut,ft,nt,ct;for(f in t)switch(f){case"enableAltRow":u.enableAltRow=t[f];i._addInitTemplate();i.renderRecords(c);break;case"allowFiltering":!u.allowFiltering&&i._filteredColumnValueID.length>0&&i._clearAllFilter(i._filteredColumnValue);u.allowFiltering=t[f];i._initiateSetModel();u.allowFiltering=t[f];var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),et=0,o=e.scrollTop();i._$gridHeaderContent.replaceWith(i._renderGridHeader());i._setWidthToHeaders();u.showTotalSummary&&(et=i.element.find(".e-footersummaryrowdiv").outerHeight());n("#"+i._id).addClass("e-treegrid-overflow");i._viewPortHeight=i.element.height()-(i._getNonContentHeight()+et);n("#"+i._id).removeClass("e-treegrid-overflow");i._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight);e.option("height",i._viewPortHeight);u.enableVirtualization&&(h=u.currentViewData.length,s=u.rowHeight,s+=u.showDetailsRow&&!u.showDetailsRowInfoColumn?u.detailsRowHeight:0,h*s<i._viewPortHeight&&(h>0?(o=o-(i._viewPortHeight-(h-1)*s),o<0&&(o=0)):(i.processBindings(),i.renderRecords())));u.showColumnChooser&&u.showColumnOptions&&i.columnAddDialogTemplate();u.allowFiltering&&u.filterSettings.filterType=="menu"&&i._renderedFilterMenuDialog.length==0&&i._renderFilterMenu();this.setWidthToColumns();e.scrollY(o,!0);e.scrollX(a,!0);i._updateHeaderScrollLeft(a);i._updateScrollCss();break;case"enableResize":i.model.enableResize=t[f];u.enableResize?i._on(n(window),"resize",i._windowResize):i._off(n(window),"resize",i._windowResize);break;case"isResponsive":i.model.isResponsive=t[f];u.isResponsive?(i._on(n(window),"resize",i._windowResize),n("#"+i._id+"_toolbarItems").addClass("e-treegridadaptivetoolbar"),i._mediaQueryUpdate(),i._off(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this)),i._on(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this))):(i._off(n(window),"resize",i._windowResize),i._off(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this)),n("#"+i._id+"_toolbarItems").removeClass("e-treegridadaptivetoolbar"),i._mediaQueryUpdate());break;case"headerTextOverflow":u.headerTextOverflow=t[f];i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.updateViewPortHeight();u.enableVirtualization&&(i.cancelRowEditCell(),i.processBindings(),tt={},s=u.rowHeight,tt.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(tt),u.showDetailsRow&&u.detailsTemplate&&!u.showDetailsRowInfoColumn&&(s+=u.detailsRowHeight),u.currentViewData.length*s<i._viewPortHeight&&(g=o-(i._viewPortHeight-u.currentViewData.length*s),g<0&&(g=0),i._$gridContent.ejScroller("scrollY",g,!0)));i._$gridContent.ejScroller({height:i._viewPortHeight});i._updateScrollCss();i.setWidthToColumns();break;case"enableVirtualization":u.enableVirtualization=t[f];lt=i._prevSelectedItem;it=i.selectedRowIndex()&&y[i.selectedRowIndex()];i.processBindings();u.enableVirtualization||(this._frozenColumnsLength>0?(i._$frozenTableContent.css({top:0}),i._$movableTableContent.css({top:0})):i._$tableContent.css({top:0}));it&&i.selectedRowIndex(y.indexOf(it));c={};c.requestType=r.TreeGrid.Actions.Refresh;i.sendDataRenderingRequest(c);i._isRowEdit=u.isEdit=!1;i._cancelSaveTools();i._clearColumnMenu();i._clearContextMenu();this._removeDetailsRow();break;case"allowColumnResize":u.allowColumnResize=t[f];u.allowColumnResize&&(i._resizer=new r.gridFeatures.gridResize(i));i._enableColumnResizeEvents();break;case"allowSorting":u.allowSorting=t[f];i.sortSetting(t[f]);u.showColumnChooser&&u.showColumnOptions&&i.columnAddDialogTemplate();break;case"allowPaging":if(u.allowPaging){i.element.append(i._renderGridPager());i.element.append(i.element.find(".e-pager").first());i.element.find(".e-pager").css({width:i._gridWidth-2});var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),o=e.scrollTop();i._viewPortHeight=i._getViewPortHeight();u.showTotalSummary&&(i._viewPortHeight-=i._$totalSummaryRowContainer.outerHeight());e.option("height",i._viewPortHeight);e.scrollY(o,!0);e.scrollX(a,!0);i._pagerHeight=i.element.find(".e-pager").outerHeight();i.gotoPage()}else ot=i.element.find(".e-pager").first().outerHeight(),i.element.find(".e-pager").first().remove(),i._viewPortHeight=i._viewPortHeight+ot,this._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight),i.getScrollElement().ejScroller({height:i._viewPortHeight}),u.pageSettings.totalRecordsCount>0?i._refreshDataSource():i.refreshContent(),i.renderRecords(),i._isRefreshAddedRecord=!1;break;case"dragTooltip":v=t[f].tooltipItems;v&&!n.isArray(v)&&(v=v.length>0?v.split(","):[],t[f].tooltipItems=v);n.extend(u.dragTooltip,t[f]);i._createDragTooltipTemplate();i.refreshContent();break;case"allowDragAndDrop":u.allowDragAndDrop=t[f];at=jQuery.uaMatch(navigator.userAgent);i.refreshContent();break;case"sortSettings":n.extend(u.sortSettings,t[f]);i.refreshContent();l={};l.requestType=r.TreeGrid.Actions.Refresh;i.sendDataRenderingRequest(l);break;case"allowSelection":u.allowSelection=t[f];u.allowSelection||(i._checkboxSelection&&u.selectedItems.length>0&&(i._isFromSetmodel=!0,i.selectAllRows(!1),i._isFromSetmodel=!1),i.clearSelection(-1),i.selectedRowIndex(-1),i.model.selectedItem=null,i._cancelSaveTools());break;case"selectionType":case"selectionMode":case"selectionSettings":this._initiateSetModel();i.clearAllSelection();i._refreshSelectionSettings(t,f);i.model.allowSelection&&i.model.selectionSettings.selectionType=="multiple"&&n("#"+i._id+"_selectionpopup").length==0&&!i.model.isFromGantt&&i._renderMultiSelectionIndicator();break;case"showSummaryRow":u.showSummaryRow=t[f];u.showSummaryRow?(i._createSummaryRow(),l={},l.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(l)):(n(i.element).find(".e-summaryrow").hide(),u.updatedRecords=i._spliceSummaryRows(u.updatedRecords),u.allowPaging&&(i._updateCurrentViewData(),l={},l.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(l)));i.updateCollapsedRecordCount();i.updateHeight();break;case"showTotalSummary":u.showTotalSummary=t[f];u.showTotalSummary?(i._createTotalSummaryRow(),i._setWidthToFooters(),i._viewPortHeight=i._getViewPortHeight(),i._viewPortHeight-=n(i._$totalSummaryRowContainer).height()):(n(i.element).find(".e-footersummaryrowdiv").remove(),i._viewPortHeight=i._getViewPortHeight());var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),o=e.scrollTop();i._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight);e.option("height",i._viewPortHeight);u.enableVirtualization&&(h=u.currentViewData.length,s=u.rowHeight,s+=u.showDetailsRow&&!u.showDetailsRowInfoColumn?u.detailsRowHeight:0,h*s<i._viewPortHeight&&(h>0?(o=o-(i._viewPortHeight-(h-1)*s),o<0&&(o=0)):(i.processBindings(),i.renderRecords())));e.scrollY(o,!0);e.scrollX(a,!0);i._updateHeaderScrollLeft(a);i._updateScrollCss();break;case"selectedRowIndex":this.isEdit||this._isRowEdit?this.selectedRowIndex(y.indexOf(i._prevSelectedItem)):(this.selectedRowIndex()>=0&&!r.isNullOrUndefined(this.selectedRowIndex())&&u.allowSelection&&y.length>this.selectedRowIndex()&&this.getExpandStatus(y[this.selectedRowIndex()])?(p=this.selectedRowIndex(),i._rowSelectingEventTrigger(this._previousIndex,p)||(u.showSummaryRow&&(st=i._spliceSummaryRows(u.updatedRecords),ht=st[p],p=y.indexOf(ht)),i.selectRows(p),i._rowSelectedEventTrigger(p))):(i.clearSelection(-1),i.selectedRowIndex(-1),i.model.selectedItem=null,i._previousIndex=-1),i._cancelSaveTools());break;case"selectedCellIndexes":u.allowSelection&&u.selectionSettings.selectionMode=="cell"&&i.selectCells(t[f]);break;case"editSettings":n.extend(u.editSettings,t[f]);i._processEditing();i._enableEditingEvents();i._updateToolbarItems();break;case"allowKeyboardNavigation":u.allowKeyboardNavigation=t[f];break;case"dataSource":i._isRowEdit||i.model.isEdit||i._refreshDataSource();break;case"columns":u.columns=t[f].slice(0);i._validateColumnFields();i._refreshFrozenColumns();break;case"rowHeight":u.rowHeight=t[f];i._addInitTemplate();i.renderRecords(c);i.updateHeight();break;case"treeColumnIndex":i.columnIndex(t[f]);break;case"showColumnChooser":u.showColumnChooser=t[f];i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.setWidthToColumns();i.getScrollElement().ejScroller("refresh");i._updateScrollCss();u.showColumnChooser?(i._renderColumnChooser(),u.allowFiltering&&u.filterSettings.filterType=="menu"&&i._renderedFilterMenuDialog.length==0&&i._renderFilterMenu()):(i._clearColumnMenu(),n("#"+i._id+"ccDiv_wrapper").remove(),n("#"+i._id+"filterMenu_wrapper").remove());u.isFromGantt&&(i._addEmptyColumntoGrid(),this._updateHeaderScrollLeft(this.getScrollElement().ejScroller("model.scrollLeft")));break;case"showColumnOptions":u.showColumnOptions=t[f];i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.setWidthToColumns();i.getScrollElement().ejScroller("refresh");i._updateScrollCss();u.showColumnChooser&&u.showColumnOptions?(i.columnAddDialogTemplate(),i._renderUpdateConfirmDialog()):(i._clearColumnMenu(),n("#"+i._id+"ccDiv_wrapper").remove(),n("#"+i._id+"filterMenu_wrapper").remove());u.isFromGantt&&i._addEmptyColumntoGrid();break;case"locale":i._clearContextMenu();i._clearColumnMenu();i._removeDetailsRow();u.locale=t[f];i._setCultureInfo();i._processEditing();i._addInitTemplate();i.refreshContent();i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.renderRecords(c);i.setWidthToColumns();i.getScrollElement().ejScroller("refresh");i._updateScrollCss();u.showColumnChooser&&i._renderColumnChooserList(!0);u.toolbarSettings.showToolbar&&i._updateToolbar();u.allowPaging&&i.getPager().ejPager("option",t[f]).ejPager("refreshPager");i.model.showColumnChooser&&i.model.showColumnOptions&&(i.columnAddDialogTemplate(),i._renderUpdateConfirmDialog());u.allowFiltering&&u.filterSettings.filterType=="menu"&&i._renderFilterMenu();break;case"toolbarSettings":n.extend(i.model.toolbarSettings,t[f]);i._updateToolbar();break;case"contextMenuSettings":n.extend(i.model.contextMenuSettings,t[f]);u.contextMenuSettings.showContextMenu||i._clearContextMenu();this._removeDetailsRow();break;case"enableCollapseAll":u.enableCollapseAll=t[f];u.enableCollapseAll?i.collapseAll():i.expandAll();break;case"showDetailsRow":u.showDetailsRow=t[f];this._updateDetailsRowProperties("showDetailsRow");break;case"detailsRowHeight":u.detailsRowHeight=t[f];this._updateDetailsRowProperties("detailsRowHeight");break;case"detailsTemplate":u.detailsTemplate=t[f];this._updateDetailsRowProperties("detailsTemplate");break;case"showDetailsRowInfoColumn":u.showDetailsRowInfoColumn=t[f];this._updateDetailsRowProperties("showDetailsRowInfoColumn");break;case"altRowTemplateID":this._initiateSetModel();u.altRowTemplateID=t[f];i._addInitTemplate();i.renderRecords(c);this.updateHeight();break;case"rowTemplateID":this._initiateSetModel();u.rowTemplateID=t[f];i._addInitTemplate();i.renderRecords(c);this.updateHeight();break;case"pageSettings":this._initiateSetModel();u.allowPaging&&(n.extend(u.pageSettings,t[f]),this.getPager().ejPager("option",u.pageSettings).ejPager("refreshPager"),t[f].totalRecordsCount>0?i._refreshDataSource():i.gotoPage());break;case"sizeSettings":this._initiateSetModel();n.extend(u.sizeSettings,t[f]);this._calculateDimensions();this._getViewPortHeight()<=0&&(u.sizeSettings.height="450px",this._updateElementHeight());this._windowResize();break;case"readOnly":u.readOnly=t[f];break;case"showGridCellTooltip":u.showGridCellTooltip=t[f];break;case"showGridExpandCellTooltip":u.showGridExpandCellTooltip=t[f];break;case"allowMultiSorting":u.allowMultiSorting=t[f];break;case"query":i=this;u.query=r.isNullOrUndefined(t[f])?r.Query():t[f];i._refreshDataSource();break;case"filterSettings":if(u.allowFiltering)if(t.filterSettings.filterType||u.filterSettings.filterType!="filterbar"){if(t.filterSettings.filterType){u.allowFiltering=!0;n.extend(i.model.filterSettings,t[f]);i._initiateSetModel();var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),o=e.scrollTop();i._$gridHeaderContent.replaceWith(i._renderGridHeader());i._setWidthToHeaders();n("#"+i._id).addClass("e-treegrid-overflow");i._viewPortHeight=i._getViewPortHeight();n("#"+i._id).removeClass("e-treegrid-overflow");u.filterSettings.filterType=="menu"&&i._renderedFilterMenuDialog.length==0&&i._renderFilterMenu();i._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight);e.option("height",i._viewPortHeight);u.enableVirtualization&&(h=u.currentViewData.length,s=u.rowHeight,s+=u.showDetailsRow&&!u.showDetailsRowInfoColumn?u.detailsRowHeight:0,h*s<i._viewPortHeight&&(h>0?(o=o-(i._viewPortHeight-(h-1)*s),o<0&&(o=0)):(i.processBindings(),i.renderRecords())));u.showColumnChooser&&u.showColumnOptions&&i.columnAddDialogTemplate();this.setWidthToColumns();e.scrollY(o,!0);e.scrollX(a,!0);i._updateHeaderScrollLeft(a);i._updateScrollCss()}}else{for(c={},n.extend(i.model.filterSettings,t[f]),w=i.model.filterSettings,rt=r.isNullOrUndefined(w.filterBarMode)?"immediate":w.filterBarMode,b=n.extend([],w.filteredColumns),k=0;k<u.columns.length;k++)u.columns[k].allowFiltering&&i._clearFilterElementValue(u.columns[k]);for(w.filteredColumns=b,w.filterBarMode=rt,c.requestType="filtering",d=0;d<b.length;d++)n("#"+i._id+"_"+b[d].field.split(".").join("")+"_filterbarcell").val(b[d].value);i._ensureDataSource(c);i._off(i.element,"keyup",".e-filterbarcell input",i._filterBarHandler);i._off(i.element,"click",".e-filterbarcell .e-checkbox",i._filterBarHandler);rt=="immediate"&&(i._on(i.element,"keyup",".e-filterbarcell input",i._filterBarHandler),i._off(i.element,"click",".e-filterbarcell .e-checkbox")._on(i.element,"click",".e-filterbarcell .e-checkbox",i._filterBarHandler))}break;case"columnResizeSettings":this._initiateSetModel();n.extend(u.columnResizeSettings,t[f]);this._updateGridResizeSettings();ct=u.columnResizeSettings.columnResizeMode;ct==r.TreeGrid.ColumnResizeMode.FixedColumns?this._updateTableWidth():(this._frozenColumnsLength>0?(ut=n(this.getHeaderTable()[1]),ft=n(this.getContentTable()[1]),nt=u.showTotalSummary?n(this._$footertableContent[1]):null):(ut=this.getHeaderTable(),ft=this.getContentTable(),nt=u.showTotalSummary?n(this._$footertableContent[0]):null),ut.css("width","").removeClass("e-tableLastCell"),ft.css("width","").removeClass("e-tableLastCell"),nt&&nt.css("width","").removeClass("e-tableLastCell"));this._updateScrollCss()}},_initiateSetModel:function(){var n=this.model;this.editFormValidate()&&(n.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());this._clearContextMenu();this._clearColumnMenu();this._removeDetailsRow()},_updateDetailsRowProperties:function(n){var t=this,i=this.model,u;if((i.isEdit||this._isRowEdit)&&(this.cancelRowEditCell(),this._cancelSaveTools()),this.clearColumnMenu(),this._clearContextMenu(),this._removeDetailsRow(),t._detailsRowHeight=i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn?i.detailsRowHeight:0,i.flatRecords.forEach(function(n){n.isDetailsExpanded=i.showDetailsRow&&i.detailsTemplate?i.showDetailsRowInfoColumn?!1:!0:!1}),(n=="detailsTemplate"||n=="detailsRowHeight")&&i.showDetailsRowInfoColumn)t._addInitTemplate();else{t._$gridHeaderContent.replaceWith(t._renderGridHeader());t._addInitTemplate();this.onScrollHelper(0);t.refreshContent();t._isRendered=!1;u={};u.requestType=r.TreeGrid.Actions.Refresh;t.sendDataRenderingRequest(u);t.setWidthToColumns();t._isRendered=!0;t._trigger("refresh");this._eventBindings();this._hideCollapsedDetailsRows();t.getScrollElement().ejScroller("refresh");t._updateScrollCss()}},_hideCollapsedDetailsRows:function(){var t=this,i=this.model;i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(this._frozenColumnsLength>0?n(t.getTreeGridRows()[0]).add(t.getTreeGridRows()[1]).filter("tr.collapsedrowexpandeddetailsrow").css("display","none"):n(t.getTreeGridRows()).filter("tr.collapsedrowexpandeddetailsrow").css("display","none"))},_updateToolbar:function(){var t=this,r=t.model,i=t.getScrollElement().ejScroller("instance"),u=i.scrollLeft(),f=i.scrollTop();n("#"+t._id+"_toolbarItems").remove();r.toolbarSettings.showToolbar&&t._renderToolbarTemplate().insertBefore(n("#"+t._id+"e-gridheader"));r.isEdit&&t.cancelEditCell();t._isRowEdit&&(t.cancelRowEditCell(),t._cancelSaveTools());t._viewPortHeight=t._getViewPortHeight();t._frozenColumnsLength>0&&t._$gridContent.css("height",t._viewPortHeight);i.option("height",t._viewPortHeight);r.enableVirtualization&&(t.processBindings(),t.renderRecords());i.option("scrollTop",f);i.option("scrollLeft",u);t._clearContextMenu();this._removeDetailsRow()},_refreshDataSource:function(){var t=this,i=this.model,o,e,u,f;if((t._isRowEdit||t.model.isEdit)&&t.cancelRowEditCell(),t.resetModelCollections(),t._createdAt="load",this.dataSource()instanceof r.DataManager)o=this.dataSource().executeQuery(i.query),o.done(r.proxy(function(u){var o,f,e;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:u.result,i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(o=[],t._taskIds=[],f=0;f<t._retrivedData.length;f++)e=t._retrivedData[f],o.push(n.extend(!0,{},e)),e[i.idMapping]&&t._taskIds.push(e[i.idMapping]);t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createRecords(t.secondaryDatasource);args={};args.requestType=r.TreeGrid.Actions.RefreshDataSource;t._ensureDataSource(args);t.selectedRowIndex()!==-1&&t.selectedRowIndex()<t.model.currentViewData.length&&t.selectRows(t.selectedRowIndex());t.getScrollElement().hasClass("e-scroller")&&t.getScrollElement().ejScroller("refresh");t._createdAt=null}));else if(this.dataSource()){if(t._retrivedData=t.dataSource(),i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(e=[],t._taskIds=[],u=0;u<t._retrivedData.length;u++)f=t._retrivedData[u],e.push(n.extend(!0,{},f)),f[i.idMapping]&&t._taskIds.push(f[i.idMapping]);t._reconstructDatasource(e);t._createRecords(t.secondaryDatasource)}else i.flatRecords.length===0&&this.dataSource()!==null&&t._createRecords(this.dataSource());args={};args.requestType=r.TreeGrid.Actions.RefreshDataSource;t._ensureDataSource(args);this.selectedRowIndex()!==-1&&this.selectedRowIndex()<t.model.currentViewData.length&&t.selectRows(this.selectedRowIndex());t.getScrollElement().hasClass("e-scroller")&&t.getScrollElement().ejScroller("refresh");t._createdAt=null}else this.dataSource()==null&&(args={},args.requestType=r.TreeGrid.Actions.RefreshDataSource,t._ensureDataSource(args),t._createdAt=null);n(".e-tooltiptable").remove();(i.showSummaryRow||i.showTotalSummary)&&t._summaryRow()},refreshContent:function(){var t=this,n={};n.requestType=r.TreeGrid.Actions.Refresh;t.processBindings(n)},resetModelCollections:function(){var n=this,t=n.model;t.currentViewData=[];t.flatRecords=[];t.parentRecords=[];t.updatedRecords=[];t.summaryRowRecords=[];t.ids=[];n.secondaryDatasource=[];n._parentRecords=[];n._storedIndex=-1;n._idGenerator=-1;n._taskIds=[]},_initPrivateProperties:function(){var t=this,i=this.model;t._id=t.element.attr("id");t.columnsWidthCollection=[];t._cSortedColumn=null;t._taskIds=[];t._cSortedDirection=null;t._dataManager=null;t._disabledSortableColumns=[];t._filteredRecords=[];t._disabledToolItems=[];proxy_currentFilterColumn=[];t._fieldColumnNames=[];t._multiSortRequest=null;t._$gridContainer=null;t._$gridContent=null;t._$gridContentTable=null;t._$gridHeaderTable=null;t._$gridHeaderContainer=null;t._$totalSummaryRowContainer=null;t._recordsCount=null;t._$gridRows=null;t._gridRows=null;this._frozenColumnsLength=0;t._initFrozenColumns();t._allowFreezingDefault=this._frozenColumnsLength>0?!0:!1;t._calculateDimensions();t._headerColumnNames=[];t._hiddenColumns=[];t._multiSelectCtrlRequest=!1;t._multiSelectShiftRequest=!1;t._offset=0;t._previousIndex=-1;t._prevRBottom=0;t._prevRTop=0;t._prevScrollTop=0;t._prevScrollLeft=0;t._prevVBottom=0;t._resizer=null;t._scrollTop=0;t._scrollLeft=0;t._searchString="";t._fieldName="";t._selectedCellsinARow=[];t._currentRecordIndex=-1;t._sortedRecords=[];t._storedIndex=-1;t._rowIndex=-1;t._$tableContent=null;t._$footertableContent=null;t._$footerContainer=null;t._tempsortedrecords=[];t._totalHeight=0;t._viewPortHeight=0;t._recordIndexCount=0;t._totalCollapsedRecordCount=0;t._visibleColumns=[];t._visibleRange=null;t._vScrollDir=1;t._vScrollDist=0;t._cellEditTemplate=n();t._tooltipTimer;t._totalBorderWidth=2;t._totalBorderHeight=1;t._toolboxTooltipTexts=null;t._contextMenuTexts=null;t._columnMenuTexts=null;t._deleteColumnText=null;t._okButtonText=null;t._cancelButtonText=null;t._confirmDeleteText=null;t._dropDownListBlanksText=null;t._editTypeText=null;t._textAlignType=null;t._clipMode=null;t._dropDownListClearText=null;t._trueText=null;t._falseText=null;t._rowDragIndexes=[];t._dropCancel=!1;t._cellEditingDetails={cellValue:null,rowIndex:-1,columnIndex:-1,fieldName:null,_data:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],data:null};t._previousSelectedCellDetails={rowElement:null,cellElement:null,cellIndex:-1,rowIndex:-1};t._shiftKeyFirstElementDetails={firstElementRowIndex:-1,firstElementCellIndex:-1};t._selectedCellDetails=[];t._focusingRowIndex=-1;t._rowIndexOfLastSelectedCell=-1;t._lastSelectedCellIndex=-1;t._tdsOffsetWidth=[];t._isEnterKeyPressed=!1;t._isShiftKeyNavigation=!1;t._scrollBarHeight=18;t._removedCount=0;t._$gridHeaderContent=null;t.secondaryDatasource=[];t._contextMenuItems=null;t._subContextMenuItems=null;t._createContextMenuTemplate();t._createColumnMenuTemplate();t._retrivedData=this.dataSource();t._createdAt="load";t._isInExpandCollapseAll=!1;t._dataManager=t.dataSource()instanceof r.DataManager?t.dataSource():t.dataSource()!=null?r.DataManager(t.dataSource()):null;t._dragMouseDown=!1;t._dragTooltip=!1;t._dragMouseLeave=!1;_timerDragDown=null;_timerDragUp=null;t._isDataManagerUpdate=!1;t._jsonData=null;t._isRefreshAddedRecord=!1;t._isInAdd=!1;t._maxRowIndex=0;t._isRendered=!1;this._updateGridResizeSettings();t._isSummaryRow=!1;t._flatChildRecords=[];t._footerSummaryRecord=[];t._filteredChildRecords=[];t._parentRecords=[];t._zerothLevelParentRecords=[];t._detailsRowHeight=0;i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(t._detailsRowHeight=i.detailsRowHeight);t._isEmptyRow=!1;t._isPublicAdd=!1;t._prevSelectedItem=null;t._dataSourcefields=[];t._columnDialogTexts=null;t._columnDialogTitle=null;t._addColumnFields=[];t._addColumnFieldsTxt=[];t._targetColumnIndex=0;t._insertPosition=null;t._updateconfirmDialog=null;t._columnRenameDialog=null;t._renderedSubMenuType=null;t.localizedLabels=t._getLocalizedLabels();t._gridRecordsCount=i.pageSettings.totalRecordsCount;t._gridPager=null;t._summaryRowsCount=0;t._updatedPageData=[];t._isNextPage=!1;i.selectionSettings.selectionType=i.selectionSettings.selectionType!="single"?i.selectionSettings.selectionType:i.selectionType!="single"?i.selectionType:i.selectionSettings.selectionType;i.selectionSettings.selectionMode=i.selectionSettings.selectionMode!="row"?i.selectionSettings.selectionMode:i.selectionMode!="row"?i.selectionMode:i.selectionSettings.selectionMode;t._idGenerator=-1;t._checkboxColumnName=null;t._isFromSetmodel=!1;t._flatFilteredRecords=[];t._checkboxSelection=i.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox&&i.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row;t._addCheckboxColumn=this._getDefaultCheckboxColumn();t._filteredColumnValue=[];t._filteredColumnValueID=[];t._filterIconTarget=null;t._renderedFilterMenuDialog=[];t._filtermenutext=null;t._headerDragStatus="";t._draggedColumn=null;t._mouseDragged=!1;t.treeIndentLevelWidth=!r.isNullOrUndefined(i.indentLevelWidth)&&i.isFromGantt?i.indentLevelWidth:t.treeIndentLevelWidth?t.treeIndentLevelWidth:10;t._draggedColumnTemplate=null;t._viewPortWidth=t._gridLeft=0;t._responsiveMinWidth=768;t._dy=t._dx=0;t._isTouchEvent=!1;t._isTouchTrigger=!1;t._currentEditRecordDialogIndex=-1;t._isTreeAddEditDialogSave=!1;t._displayContextMenu=i.contextMenuSettings.showContextMenu?!0:!1;t._isEmptyRowDeleted=!1},_getDefaultCheckboxColumn:function(){return{field:"checkboxState",headerText:"",allowEditing:!1,allowDelete:!1,allowSorting:!1,allowCellSelection:!1,isFrozen:!1,nonColumn:!0,editType:"booleanedit",width:50,textAlign:"center"}},_updateGridResizeSettings:function(){var n={resizeMode:this.model.columnResizeSettings.columnResizeMode=="fixedcolumns"?"control":this.model.columnResizeSettings.columnResizeMode};this.model.resizeSettings=n},_calculateDimensions:function(){var n=this,t=this.model,u,i;if(t.isFromGantt||(t.sizeSettings.width&&n.element.css("width",t.sizeSettings.width),t.sizeSettings.height?n.element.css("height",t.sizeSettings.height):n.element[0].style.height?t.sizeSettings.height=n.element[0].style.height:n.element.height(450)),n._gridHeight=Math.round(n.element.height()),n._gridWidth=Math.round(n.element.width()),this._frozenColumnsLength>0){for(u=0,i=0;i<=this._frozenColumnsLength;i++)t.columns[i]&&(u+=r.isNullOrUndefined(t.columns[i].width)?150:parseInt(t.columns[i].width));n._gridWidth<u&&(n.element.css("width",u),t.sizeSettings.width=n._gridWidth=u)}},_initFrozenColumns:function(){for(var u=[],e=[],s=0,h=0,f=this.model,i=f.columns,o=i[f.treeColumnIndex],t=0;t<i.length;t++)i[t].isFrozen===!0?(u.push(i[t]),(r.isNullOrUndefined(i[t].visible)||i[t].visible)&&(s+=1)):(e.push(i[t]),(r.isNullOrUndefined(i[t].visible)||i[t].visible)&&(h+=1));u.length>0&&(f.columns.length&&f.columns.length==u.length&&(e=u.splice(u.length-1,1),e[0].isFrozen=!1),f.columns=n.merge(n.merge([],u),e));this._frozenColumns=u;this._unFrozenColumns=e;s==0&&this._frozenColumns[0]&&(this._frozenColumns[0].visible=!0);h==0&&this._unFrozenColumns[0]&&(this._unFrozenColumns[0].visible=!0);o&&(f.treeColumnIndex=f.columns.indexOf(o));this._frozenColumnsLength=u.length;f.scrollSettings.frozenColumns=this._frozenColumnsLength},updateAltRowOnCollapseAll:function(){var i=this,n=i.model,t;if(n.enableAltRow&&n.enableCollapseAll)for(t=n.parentRecords,count=0;count<t.length;count++)(record=t[count],record.isSummaryRow)||(record.isAltRow=count%2==0?!1:!0)},updateAltRowOnRendering:function(){var t=this,i=t.model,n=i.updatedRecords.filter(function(n){return n.parentItem==null?n:n.parentItem.expanded?n:void 0});for(count=0;count<n.length;count++)(record=n[count],record.isSummaryRow)||(record.isAltRow=count%2==0?!1:!0)},_checkDataBinding:function(){var t=this,i=t.model;n("#"+t._id).addClass("e-treegrid-overflow");t._createdAt=null;t.element.addClass("e-treegrid-core");t.element.attr("tabindex","0");t._renderToolbar();t._checkboxSelection&&t._updateCheckboxColumnName();t._renderAfterColumnInitialize();t.model.showColumnChooser?(t._renderColumnChooser(),t.model.allowFiltering&&t.model.filterSettings.filterType=="menu"&&t._renderFilterMenu()):t.model.allowFiltering&&t.model.filterSettings.filterType=="menu"&&t._renderFilterMenu();t._setWidthToHeaders();t.model.allowPaging&&(t.element.append(t._renderGridPager()),t.element.append(t.element.find(".e-pager").attr({id:this._id+"Pager"})));t._viewPortHeight=t._getViewPortHeight();!i.isFromGantt&&t._viewPortHeight<0&&t._updateElementHeight();t._ensureDataSource();i.showSummaryRow&&t._createSummaryRow();i.isFromGantt||t.updateAltRowOnCollapseAll();i.expandStateMapping&&i.enableAltRow&&t.updateAltRowOnRendering();t._initGridRender();t._$gridContent=n("#"+t._id+"e-gridcontent");t._$gridContainer=n("#"+t._id+"e-gridcontainer");t._$tableContent=n("#"+t._id+"e-table");t._$frozenTableContent=n("#"+t._id+"frozene-table");t._$movableTableContent=n("#"+t._id+"movablee-table");t._viewPortHeight=t._getViewPortHeight();t._$gridContent.css({height:t._viewPortHeight+"px"});t.element.find(".e-pager").css({width:t._gridWidth-2});t._pagerHeight=t.element.find(".e-pager").outerHeight();i.showTotalSummary&&(t._createTotalSummaryRow(),t._viewPortHeight=t._getViewPortHeight(),(!i.allowPaging||i.sizeSettings.height)&&(t._viewPortHeight=t._viewPortHeight-t._$totalSummaryRowContainer.outerHeight()));t._updatePagerTextAlignment();t.updateHeight();t._wireEvents();t.setWidthToColumns();t._renderScroller();t._updateScrollCss();t._resizeFilteringElements();t._initialEndRendering();i.isFromGantt&&t._addEmptyColumntoGrid();i.isFromGantt?(t._isDataManagerUpdate=i.dataManagerUpdate.isDataManagerUpdate,t._jsonData=i.dataManagerUpdate.jsonData):t._checkDataManagerUpdate();t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&!t.model.isFromGantt&&t._renderMultiSelectionIndicator();n("#"+t._id).removeClass("e-treegrid-overflow")},_renderMultiSelectionIndicator:function(){this._multiSelectPopup=r.buildTag("div.e-treegridpopup#"+this._id+"_selectionpopup","",{display:"none"});var n=r.buildTag("div.e-popupcontent"),t=r.buildTag("div.e-downtail e-tail"),i=r.buildTag("span.e-rowselect e-icon");n.append(i);this._multiSelectPopup.append(n);this._multiSelectPopup.append(t);this.element.append(this._multiSelectPopup)},getUpdatedDataManagerData:function(){var n=this;return n._jsonData},_checkDataManagerUpdate:function(){var n=this,t=this.dataSource();n._isDataManagerUpdate=!1;n._jsonData=null;t instanceof r.DataManager&&(t.dataSource.offline&&t.dataSource.json?(n._isDataManagerUpdate=!0,n._jsonData=t.dataSource.json):t.dataSource.offline||(n._isDataManagerUpdate=!0,n._jsonData=n._retrivedData))},_initDatasource:function(){var t=this,i=t.model,o,e,u,f;if(i.isFromGantt)t._checkDataBinding();else if(this.dataSource()instanceof r.DataManager)o=this.dataSource().executeQuery(i.query),o.done(r.proxy(function(r){var e,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(e=[],t._taskIds=[],u=0;u<t._retrivedData.length;u++)f=t._retrivedData[u],e.push(n.extend(!0,{},f)),f[i.idMapping]&&t._taskIds.push(f[i.idMapping]);t._reconstructDatasource(e);t._createRecords(t.secondaryDatasource)}else t._retrivedData&&t._createRecords(t._retrivedData);t._checkDataBinding()}));else if(this.dataSource()){if(t._retrivedData=t.dataSource(),i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(e=[],t._taskIds=[],u=0;u<t._retrivedData.length;u++)f=t._retrivedData[u],e.push(n.extend(!0,{},f)),f[i.idMapping]&&t._taskIds.push(f[i.idMapping]);t._reconstructDatasource(e);t._createRecords(t.secondaryDatasource)}else i.flatRecords.length===0&&this.dataSource()!==null&&t._createRecords(this.dataSource());t._checkDataBinding()}else t._checkDataBinding()},_intersectionObjects:function(n,t){for(var r=[],i;n.length>0&&t.length>0;)i=t.indexOf(n[0]),i==-1?n.shift():(r.push(n.shift()),t.splice(i,1));return r},_reconstructDatasource:function(n){var f=this,u=f.model,i,s,e,t,o,h,c;for(s=r.Predicate(u.parentIdMapping,r.FilterOperators.notEqual,"null"),i=r.DataManager(n).executeLocal(r.Query().where(s).group(u.parentIdMapping)),e=[],u.chidMapping||(u.childMapping="Children"),t=0;t<i.length;t++){if(!r.isNullOrUndefined(i[t].key)&&(o=f._taskIds.indexOf(i[t].key),o>-1)){n[o][u.childMapping]=i[t].items;continue}h=i[t].items;for(c in i[t].items)e.push(h[c])}f.secondaryDatasource=f._intersectionObjects(n,e)},_windowResize:function(){var t,i,rt,ut,ft,k,et,d,g,nt,a,ot,o,e,v,y,p;if(this.element.is(":visible")){t=this;i=this.model;n("#"+t._id).addClass("e-treegrid-overflow");var s=t._$gridHeaderContent,w=t._$totalSummaryRowContainer,b,l=n("#"+t._id+"_toolbarItems"),h=i.sizeSettings.height,c=i.sizeSettings.width,tt=t.element[0].style.width,it=t.element[0].style.height,u,f;if(t._clearContextMenu(),t.model.isResponsive||r.isTouchDevice()?r.isTouchDevice()||t._clearColumnMenu("resize"):(t._clearColumnMenu(),t._clearFilterMenu()),b=this._frozenColumnsLength>0?this.element.find("#e-movablecontainer"+this._id):n("#"+t._id+"e-gridcontent"),n("#"+this._id+"detailscellwrapper").length>0&&this._removeDetailsRow(),c&&typeof c!="number"&&c.indexOf("%")!=-1||tt.indexOf("%")!=-1){var st=c?c:tt,ht=n(t.element).parent().width()?n(t.element).parent().width():n(t.element).width(),ct=ht/100*parseInt(st);u=ct}else u=n(t.element).width();if(t._gridWidth=u,t._frozenColumnsLength>0){for(o=0,e=0;e<=t._frozenColumnsLength;e++)o+=t.columnsWidthCollection[e];u<o&&(t._gridWidth=u=o)}if(h&&typeof h!="number"&&h.indexOf("%")!=-1||it.indexOf("%")!=-1?(rt=h?h:it,ut=n(t.element).parent().height()?n(t.element).parent().height():n(t.element).height(),ft=n(t.element).parent().height()?ut/100*parseInt(rt):n(t.element).height(),f=ft):f=n(t.element).height(),f=f-t._totalBorderHeight,t._$totalSummaryRowContainer&&(f-=t._$totalSummaryRowContainer.outerHeight()),u=Math.round(u-t._totalBorderWidth),d=l.length>0?l.outerHeight():0,k=b.ejScroller("option","scrollTop"),et=b.ejScroller("option","scrollLeft"),g=u,nt=0,i.allowPaging&&(a=t.element.find(".e-pager").outerHeight(),ot=r.isNullOrUndefined(i.pageSettings.template)?!1:!0,f-=a,!i.sizeSettings.height)){for(o=0,a>t._pagerHeight&&!ot&&(nt=a-t._pagerHeight),e=0;e<t.columnsWidthCollection.length;e++)o+=t.columnsWidthCollection[e];o>t._gridWidth&&(f=f+t._scrollBarHeight)}this._frozenColumnsLength>0&&(t._$gridContent.css("width",u),t._$gridContent.css("height",f-n(s).outerHeight()-d),g=u-this._getFrozenColumnWidth()-1);t.getScrollElement().ejScroller({width:g,height:f-n(s).outerHeight()-d+nt});t._updateScrollCss();n(s).hasClass("e-scrollcss")&&t.getScrollElement().children(".e-vscrollbar").length>0?n(s).width(u-17):n(s).width(u);t._$totalSummaryRowContainer&&(t._$totalSummaryRowContainer.outerHeight()>=90&&t._$totalSummaryRowContainer.hasClass("e-scroller")?t._$totalSummaryRowContainer.ejScroller("refresh"):n(w).hasClass("e-scrollcss")&&t.getScrollElement().children(".e-vscrollbar").length>0?n(w).width(u-17):n(w).width(u));i.toolbarSettings.showToolbar&&l.length>0&&l.width(u);t.getScrollElement().ejScroller("refresh");t.updateViewPortHeight();i.showTotalSummary&&(t._viewPortHeight=t._viewPortHeight-t._$totalSummaryRowContainer.outerHeight());t.getScrollElement().ejScroller("option","scrollTop",k);t.getScrollElement().ejScroller("option","scrollLeft",et);t._updateHeaderScrollLeft();i.enableVirtualization&&(t.cancelRowEditCell(),v={},y=i.rowHeight,v.requestType=r.TreeGrid.Actions.Refresh,t.processBindings(v),t.sendDataRenderingRequest(v),i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(y+=i.detailsRowHeight),i.currentViewData.length*y<t._viewPortHeight&&(p=k-(t._viewPortHeight-i.currentViewData.length*y),p<0&&(p=0),t.getScrollElement().ejScroller("scrollY",p,!0)));i.allowPaging&&t.element.find(".e-pager").css({width:t._gridWidth-2});t._resizeFilteringElements();i.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||i.isFromGantt||this._updateTableWidth(!0);t.model.isResponsive&&!t.model.isFromGantt&&t._mediaQueryUpdate();t._updatePagerTextAlignment();t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&t._alignMultiSelectPopup();n("#"+t._id).removeClass("e-treegrid-overflow")}},_updatePagerTextAlignment:function(){var t=this,i,r;t.model.allowPaging&&(n("#"+t._id+"Pager").find(".e-pagercontainer").outerWidth()+n("#"+t._id+"Pager").find(".e-parentmsgbar").outerWidth()+10>n("#"+t._id).width()?(i=(n("#"+t._id).width()-n("#"+t._id+"Pager").find(".e-pagercontainer").outerWidth())/2,r=(n("#"+t._id).width()-n("#"+t._id+"Pager").find(".e-parentmsgbar").width())/2,i>0&&n("#"+t._id+"Pager").find(".e-pagercontainer").css("margin-left",i+"px"),r>0&&n("#"+t._id+"Pager").find(".e-parentmsgbar").css("margin-right",r-6+"px")):(n("#"+t._id+"Pager").find(".e-pagercontainer").css("margin-left",""),n("#"+t._id+"Pager").find(".e-parentmsgbar").css("margin-right","")))},_alignMultiSelectPopup:function(){var n=this,r=n._$gridContent.offset().top+n._$gridContent.outerHeight(),u=n._$gridContent.offset().left+n._$gridContent.outerWidth(),t,i;(n._multiSelectPopup.offset().top+n._multiSelectPopup.outerHeight()+10>r||n._multiSelectPopup.offset().top<n._$gridContent.offset().top||n._multiSelectPopup.offset().left+n._multiSelectPopup.outerWidth()>u||n._multiSelectPopup.offset().left<n._$gridContent.offset().left)&&(t=n._$gridContent.offset().top+n._$gridContent.outerHeight()/2,i=n._$gridContent.offset().left+n._$gridContent.outerWidth()/2,n._$gridContent.find(".e-hscrollbar").length>0&&(t=t-n._$gridContent.find(".e-hscrollbar").outerHeight()),n._$gridContent.find(".e-vscrollbar").length>0&&(i=i-n._$gridContent.find(".e-vscrollbar").outerWidth()),n._multiSelectPopup.offset({top:t-this._multiSelectPopup.height()/2-5,left:i-this._multiSelectPopup.width()/2}))},_mediaQueryUpdate:function(){var t=this,i=t.getOffsetRect(n("#"+t._id)[0]),u,e,f;n("#"+t._id+"_dialogColumnAdd_wrapper").length>0&&n("#"+t._id+"_dialogColumnAdd_wrapper").css("display")!="none"&&(n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive?(n("#"+t._id+"_dialogColumnAdd").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css("width",n("#"+t._id).width()-80+"px"),n("#"+t._id+"_dialogColumnAdd").ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,allowDraggable:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"_dialogColumnAdd_wrapper").css({left:i.left+"px",top:i.top+"px"}),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-shadow"),n("#"+t._id+"_dialogColumnAdd").removeClass("e-shadow")):(n("#"+t._id+"_dialogColumnAdd").ejDialog({width:"auto",height:"auto",minHeight:0,minWidth:0,showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+t._id+"_dialogColumnAdd").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").addClass("e-treegridadaptivedialog e-treegrid-dialog"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css("width","438px"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").addClass("e-shadow")));n("#"+t._id+"ColumnRenameDialog_wrapper").length>0&&n("#"+t._id+"ColumnRenameDialog_wrapper").css("display")!="none"&&(n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive?(n("#"+t._id+"ColumnRenameDialog").removeClass("e-treegridadaptivedialog"),t._columnRenameDialog.ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",position:{X:i.left,Y:i.top},minHeight:"50px",minWidth:"50px",showOnInit:!1,allowDraggable:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"ColumnRenameDialog_wrapper").css({left:i.left+"px",top:i.top+"px"}),n("#"+t._id+"ColumnRenameDialog_wrapper").removeClass("e-shadow"),n("#"+t._id+"ColumnRenameDialog").removeClass("e-shadow"),n("#"+t._id+"ColumnRenameDialog_wrapper").removeClass("e-treegridadaptivedialog")):(t._columnRenameDialog.ejDialog({width:"auto",height:"auto",minHeight:0,minWidth:0,showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+t._id+"ColumnRenameDialog").addClass("e-treegridadaptivedialog"),n("#"+t._id+"ColumnRenameDialog_wrapper").addClass("e-treegridadaptivedialog e-treegrid-dialog")));t._renderedSubMenuType?(u="",t._renderedSubMenuType.indexOf("Desktop")==-1?u=t._renderedSubMenuType:(e=t._renderedSubMenuType.indexOf("Desktop"),u=t._renderedSubMenuType.slice(0,e)),n(u+"_wrapper").length>0&&n(u+"_wrapper").css("display")!="none"?n(window).width()<=t._responsiveMinWidth&&t._renderedSubMenuType.indexOf("Desktop")==-1&&t.model.isResponsive?(f=n("#"+t._id).height()-50+"px",n(t._renderedSubMenuType+"_wrapper").find("div.e-dialog-scroller").addClass("e-treegridadaptivewidth"),n(t._renderedSubMenuType).ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",position:{X:i.left+"px",Y:i.top+"px"},minHeight:"50px",minWidth:"50px",showOnInit:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n(t._renderedSubMenuType).height()>n(t._renderedSubMenuType+"_wrapper").height()-48?(n(t._renderedSubMenuType+"_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-48+"px",width:"auto",padding:"0px"}),n(t._renderedSubMenuType).ejDialog("refresh")):n(t._renderedSubMenuType+"_wrapper").find("div.e-dialog-scroller").css({height:f,width:"auto"})):r.isTouchDevice()?(t._renderedSubMenuType.indexOf("Desktop")==-1&&n(window).width()>t._responsiveMinWidth||t._renderedSubMenuType.indexOf("Desktop")!=-1&&n(window).width()<=t._responsiveMinWidth)&&(t._clearColumnMenu(),t._clearFilterMenu()):t._clearFilterMenu():(r.isTouchDevice()&&!t._renderedSubMenuType||r.isTouchDevice()&&n(u+"_wrapper").length>0&&n(u+"_wrapper").css("display")=="none")&&t._clearColumnMenu()):(r.isTouchDevice()&&!t._renderedSubMenuType||r.isTouchDevice()&&n(u+"_wrapper").length>0&&n(u+"_wrapper").css("display")=="none")&&t._clearColumnMenu();n("#"+t._id+"ccDiv_wrapper").length>0&&n("#"+t._id+"ccDiv_wrapper").css("display")!="none"&&(n(window).width()<t._responsiveMinWidth&&t._renderedSubMenuType.indexOf("AdaptiveColChooser")==0&&t.model.isResponsive?(f=n("#"+t._id).height()-66+"px",n("#"+t._id+"ccDiv").ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"ccDiv").css({width:"100%",height:"auto"}),n("#"+t._id+"ccDiv").height()>n("#"+t._id+"ccDiv_wrapper").height()-48?(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-48+"px",width:"auto",padding:"0px"}),n("#"+t._id+"ccDiv").removeClass("e-columnSelector"),n("#"+t._id+"ccDiv").ejDialog("refresh")):(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:f,width:"auto",padding:"8px 16px"}),n("#"+t._id+"ccDiv").css({padding:"0px"})),n("#"+t._id+"ccDiv_wrapper").removeClass("e-shadow"),n("#"+t._id+"ccDiv").removeClass("e-shadow")):t._clearColumnMenu());n("#"+t._id+"_dialogEdit").length>0&&n("#"+t._id+"_dialogEdit").css("display")!="none"&&(n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive?(n("#"+t._id+"_dialogEdit").ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,allowDraggable:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"_dialogEdit_wrapper").css({left:i.left+"px",top:i.top+"px"}),n("#"+t._id+"_dialogEdit_wrapper").removeClass("e-shadow").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogEdit").removeClass("e-shadow")):(n("#"+t._id+"_dialogEdit").ejDialog({width:"auto",height:"auto",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+t._id+"_dialogEdit_wrapper").addClass("e-shadow").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogEdit").addClass("e-shadow")));t._renderedSubMenuType&&(t._renderedSubMenuType.indexOf("AdaptiveColChooser")==0||t._renderedSubMenuType.indexOf("ColumnDesktop")==0)&&t._clearColumnMenu()},updateResponsiveMinWidth:function(n){var t=this;parseInt(n)<150&&(n=150);t._responsiveMinWidth=parseInt(n);t._mediaQueryUpdate()},processBindings:function(t){var i=this,u=i.model;if(u.query=new r.Query,!i._isEmptyRow&&i._trigger("actionBegin",t))return t.requestType=="filtering"&&n("#"+i._id+"_"+t.currentFilteringColumn+"_filterbarcell").val(""),!0;i._ensureDataSource(t)},setUpdatedRecords:function(n,t,i,r,u){var f=this.model;f.flatRecords=n;f.updatedRecords=t;f.ids=i;f.parentRecords=r;this.dataSource(u)},getExpandedRecords:function(n){var t=this;return n.filter(function(n){return t.getExpandStatus(n)==!0})},updateExpandStatus:function(n,t){for(var u=this,r=n.childRecords,i=0;i<r.length;i++)r[i].isExpanded=t,r[i].hasChildRecords&&r[i].expanded&&u.updateExpandStatus(r[i],t)},_ensureDataSource:function(t){var i=this,u=i.model,y=u.sortSettings.sortedColumns,f=u.filterSettings.filteredColumns,s=!1,a=this.dataSource(),p=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),h,e,o,c,v,l;if(i._filteredRecords=[],i._flatFilteredRecords=[],u.query.requiresCount(),i._queryManagar=u.query,n.type(a)==="array"||a instanceof r.DataManager||(this.dataSource([]),a=this.dataSource()),t&&t.requestType===r.TreeGrid.Actions.ExpandCollapse&&(s=!0,i._filteredRecords=[],t.data.expanded=t.expanded,r.isNullOrUndefined(t.data.item[u.expandStateMapping])||(t.data[u.expandStateMapping]=t.expanded,t.data.item[u.expandStateMapping]=t.expanded),u.updatedRecords=[],i._flatFilteredRecords=u.flatRecords,i._filteredRecords=i._flatFilteredRecords.filter(function(n){return i.getExpandStatus(n)==!0}),u.updatedRecords=i._filteredRecords),t&&t.requestType=="filtering"||u.allowFiltering&&!u.isFromGantt&&f.length){if(u.showSummaryRow&&(u.updatedRecords=i._spliceSummaryRows(u.updatedRecords),u.flatRecords=i._spliceSummaryRows(u.flatRecords)),u.allowFiltering&&!u.isFromGantt&&f.length){for(e=f[0],e.value==i._dropDownListBlanksText?(h=r.Predicate(e.field,"equal",null),h=h.or(e.field,"equal","")):h=e.isComplex?e:r.Predicate(e.field,e.operator,e.value,!e.matchcase),r.isNullOrUndefined(t)&&i._storePreviousFilteredValue(e.field,e.value,e.operator),o=1;o<f.length;o++)h=f[o].isComplex?h.and(f[o]):h[f[o].predicate](f[o].field,f[o].operator,f[o].value,!f[o].matchcase),r.isNullOrUndefined(t)&&i._storePreviousFilteredValue(f[o].field,f[o].value,f[o].operator);i._queryManagar.where(h);i._filteredRecords=u.flatRecords.slice();c=new r.DataManager(i._filteredRecords);i._tempfilteredrecords=c.executeLocal(i._queryManagar).result;i._updateFilteredRecords(i._tempfilteredrecords);u.updatedRecords=i._filteredRecords;u.allowPaging&&u.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(u.parentRecords=i._getParentRecords(u.updatedRecords,i,!0));u.allowSorting&&u.sortSettings.sortedColumns.length>0&&i._sortingRecords()}else u.updatedRecords=u.enableVirtualization?i.getExpandedRecords(u.flatRecords):u.flatRecords.slice(),i._updateHasFilteredChildRecordsStatus(u.updatedRecords),u.allowPaging&&u.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(u.parentRecords=i._getParentRecords(u.updatedRecords,i,!0));t&&!u.isFromGantt&&t.requestType=="filtering"&&i._checkboxSelection&&u.selectionSettings.enableHierarchySelection&&t.requestType=="filtering"&&(n.each(u.updatedRecords,function(n,t){t.hasChildRecords&&i._updateParentSelection(t)}),i.selectAllRows());u.showSummaryRow&&i._createSummaryRow(t);t&&u.showTotalSummary&&i._updateTotalSummaryRow(t);i.updateCollapsedRecordCount();i.updateHeight();s=!0;u.enableAltRow&&i.updateAltRow()}u.allowSearching&&i._searchString.length||t&&t.requestType==="searching"?(i._queryManagar.search(i._searchString,i.getColumnFieldNames(),r.FilterOperators.contains,!0),i._filteredRecords=u.flatRecords.filter(function(n){return n.hasChildRecords===!1}),u.isFromGantt&&(p.model.searchSettings={fields:i._getColumnMappingNames(),key:i._queryManagar.queries[0].e.searchKey,operator:"contains",ignoreCase:!0}),c=new r.DataManager(i._filteredRecords),i._tempfilteredrecords=c.executeLocal(i._queryManagar).result,i._updateFilteredRecords(i._tempfilteredrecords),u.updatedRecords=i._filteredRecords,u.allowSorting&&u.sortSettings.sortedColumns.length>0&&i._sortingRecords(),i.updateCollapsedRecordCount(),i.updateHeight(),s=!0,u.enableAltRow&&i.updateAltRow(),i.clearSelection()):(u.allowSorting&&y.length>0||t&&t.requestType=="sorting")&&(i._sortingRecords(),u.showSummaryRow&&i._createSummaryRow(t),s||(i.updateCollapsedRecordCount(),i.updateHeight(),s=!0));t&&(t.requestType==="outdent"||t.requestType==="indent")&&(t={},t.requestType=r.TreeGrid.Actions.Refresh,s=!0);t&&u.allowPaging&&t.requestType=="delete"&&(v={},v.totalRecordsCount=i.getExpandedRecords(u.flatRecords).length,i.getPager().ejPager("option",v).ejPager("refreshPager"),l=l=this.getPager().ejPager("model"),i._currentPage()>l.totalPages&&i._currentPage(l.totalPages),s=!0);s||(i._zerothLevelParentRecords=u.parentRecords.slice(),u.updatedRecords=u.enableVirtualization?u.enableCollapseAll&&!t?i._zerothLevelParentRecords:i.getExpandedRecords(u.flatRecords):u.flatRecords.slice(),i.updateCollapsedRecordCount(),i.updateHeight());t||(t={},t.requestType=u.allowPaging?r.TreeGrid.Actions.Paging:r.TreeGrid.Actions.Refresh,t.inital=!0);i._updateCurrentViewData();(u.isFromGantt||t.requestType!=="save")&&t.requestType!=="sorting"&&t.requestType!=="searching"&&t.requestType!=="delete"&&t.requestType!=="refreshDataSource"&&t.requestType!=="filtering"&&t.requestType!=="dragAndDrop"&&(t.inital||t.requestType!=="paging")||(i._isRefreshAddedRecord=!1,i.renderRecords(t),i._setScrollTop(),i.getScrollElement().ejScroller("refresh"),i._updateScrollCss())},_removeChildRecords:function(n,t){var e=this,o=e.model,u=r.isNullOrUndefined(t.childRecords)?[]:t.childRecords,f=n.indexOf(t),i;for(f>-1&&(t.checkboxState="unchecked",n.splice(f,1)),i=0;i<u.length;i++)u[i].hasChildRecords?e._removeChildRecords(n,u[i]):(f=n.indexOf(u[i]),f>-1&&(u[i].checkboxState="unchecked",n.splice(f,1)));t.parentItem&&o.selectionSettings.enableHierarchySelection&&e._updateParentSelection(t.parentItem)},_removeChildItem:function(n){for(var i,t,u=this,f=0;f<n.childRecords.length;f++)t=n.childRecords[f],this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?(i=this.dataSource().dataSource.json.indexOf(t.item),i!==-1&&this.dataSource().dataSource.json.splice(i,1),t.hasChildRecords&&u._removeChildItem(t)):u._isDataManagerUpdate&&(i=u._jsonData.indexOf(t.item),i!==-1&&u._jsonData.splice(i,1),t.hasChildRecords&&u._removeChildItem(t)):(i=this.dataSource().indexOf(t.item),i!==-1&&this.dataSource().splice(i,1),t.hasChildRecords&&u._removeChildItem(t))},_updateCheckboxColumnName:function(){var n=this,t=n.model,i,u;n._checkboxSelection&&(i=t.columns.filter(function(n){return n.showCheckbox==!0}),n._addCheckboxColumn=this._getDefaultCheckboxColumn(),n._checkboxColumnName=i.length>0?i[0].isTemplateColumn?null:i[0].field:null,r.isNullOrUndefined(n._checkboxColumnName)&&(u=t.columns[t.treeColumnIndex],t.columns[0].nonColumn?n._checkboxColumnName=t.columns[0].field:(t.columns.splice(0,0,n._addCheckboxColumn),n._checkboxColumnName=n._addCheckboxColumn.field),u&&(t.treeColumnIndex=t.columns.indexOf(u))),n._frozenColumnsLength>0&&!t.columns[0].isFrozen&&n._checkboxColumnName==n._addCheckboxColumn.field&&(t.columns[0].isFrozen=!0,n._frozenColumnsLength+=1,n._frozenColumns.splice(0,0,t.columns[0]),t.scrollSettings.frozenColumns=this._frozenColumnsLength))},_processEditing:function(){var i=this,t=i.model;i._checkboxSelection&&i._updateCheckboxColumnName();(t.editSettings.allowEditing||t.editSettings.allowAdding)&&(t.editSettings.editMode.toLowerCase()==="cellediting"||t.editSettings.editMode.toLowerCase()==="rowediting"||t.editSettings.editMode.toLowerCase()==="normal"&&t.selectionSettings.selectionMode.toLowerCase()==="cell"?i._addCellEditTemplate():t.editSettings.editMode.toLowerCase()==="dialogediting"&&(r.isNullOrUndefined(t.editSettings.dialogEditorTemplateID)||t.editSettings.dialogEditorTemplateID=="")?(i._treeGridAddEditDialog(),n("#"+this._id+"_dialogEdit").length==0&&this.element.append(this._renderEditDialog())):t.editSettings.editMode.toLowerCase()!=="dialogediting"||r.isNullOrUndefined(t.editSettings.dialogEditorTemplateID)||t.editSettings.dialogEditorTemplateID==""||(i._treeGridAddEditDialogTemplate(),n("#"+this._id+"_dialogEdit").length==0&&this.element.append(this._renderEditDialog())))},_toolBarClick:function(t){if(t.event.which&&(t.event.which==3||t.event.which==2)||t.event.button&&t.event.button==2)return!1;var e=this,c=e.model,f=n(this.itemsContainer).closest(".e-treegrid"),r=f.ejTreeGrid("instance"),i=f.attr("id"),o=n("#"+r._id+"_toolbarItems");if(t.event==u&&t.target.tagName=="INPUT"&&t.currentTarget.id==i+"_search")return!1;r.model.dateFormat.toLowerCase().indexOf("hh")!=-1?n.isFunction(n.fn.ejDateTimePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDateTimePicker("hide"):n.isFunction(n.fn.ejDatePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDatePicker("hide");var s=t.currentTarget,l=t.target,h={itemName:t.text,currentTarget:s,model:r.model,sender:t};if(f.ejTreeGrid("instance")._trigger("toolbarClick",h))return!1;n(o).ejToolbar("deselectItem",t.currentTarget);switch(t.currentTarget.id){case i+"_add":r._toolbarOperation(i+"_add",t);break;case i+"_edit":r._toolbarOperation(i+"_edit",t);break;case i+"_delete":r._toolbarOperation(i+"_delete",t);break;case i+"_update":r._toolbarOperation(i+"_update",t);break;case i+"_cancel":r._toolbarOperation(i+"_cancel",t);break;case i+"_expandAll":r._toolbarOperation(i+"_expandAll",t);break;case i+"_collapseAll":r._toolbarOperation(i+"_collapseAll",t);break;case i+"_pdfExport":r._toolbarOperation(i+"_pdfExport",t);break;case i+"_excelExport":r._toolbarOperation(i+"_excelExport",t)}return!1},_toolbarOperation:function(n,t){var e=this.element,u=e.ejTreeGrid("instance"),r=e.attr("id"),i=this,s=this.selectedItem(),h=t.target,o=i.model.allowPaging?this._updatedPageData.indexOf(s):this.selectedRowIndex(),f;u._exportTo=u["export"];switch(n){case r+"_add":i.model.selectionSettings.selectionMode=="cell"&&(i.model.editSettings.rowPosition="top");i.model.editSettings.allowEditing&&i.model.editSettings.editMode=="dialogEditing"?i._showTreeGridAddEditDialog(-1,"add"):i._startAdd(h,null);break;case r+"_edit":i.updateScrollBar();i.model.editSettings.allowEditing&&i.model.editSettings.editMode=="dialogEditing"?i._showTreeGridAddEditDialog(o):i._editRow(o);break;case r+"_delete":i.deleteRow();i._cancelSaveTools();i._isRefreshAddedRecord=!1;break;case r+"_update":f=i.model.editSettings.editMode;f.toLowerCase()=="cellediting"?this.editFormValidate()&&(i.model.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()):f.toLowerCase()=="rowediting"&&this.editFormValidate()&&i.saveRow();i._clearContextMenu();this._removeDetailsRow();i._focusTreeGridElement();break;case r+"_cancel":f=i.model.editSettings.editMode;f.toLowerCase()=="cellediting"?i._isRowEdit?i.cancelRowEditCell():i.cancelEditCell():f.toLowerCase()=="rowediting"&&i.cancelRowEditCell();i._cancelSaveTools();i._clearContextMenu();this._removeDetailsRow();break;case r+"_expandAll":i.expandAll();break;case r+"_collapseAll":i.collapseAll();break;case r+"_pdfExport":u._exportTo(u.model.exportToPdfAction,"pdfExporting",u.model.allowMultipleExporting);break;case r+"_excelExport":u._exportTo(u.model.exportToExcelAction,"excelExporting",u.model.allowMultipleExporting)}return i._refreshToolBar(),!1},contextMenuOperations:function(n){var t=this,i=t.model,u=t._contextMenuSelectedIndex,o=t._contextMenuEvent,s=t._contextMenuSelectedItem,f,h,e;switch(n){case"Delete":t.deleteRow(null,!0);t._cancelSaveTools();t._clearContextMenu();break;case"Above":t._subContextMenuAction(s,u,"Above");t._focusTreeGridElement();break;case"Below":t._subContextMenuAction(s,u,"Below");t._focusTreeGridElement();break;case"Add":t._setInitialData();t._clearContextMenu();break;case"Edit":i.editSettings.editMode.toLowerCase()=="cellediting"?(f=i.columns[t.getCellIndex(o)],r.isNullOrUndefined(f)||f.allowEditing==!1||(t._focusTreeGridElement(),t._cellEditingDetails.columnIndex=t.getCellIndex(o),t._editedRowIndex=t._cellEditingDetails.rowIndex=t.getRowIndex(o),fieldName=t._cellEditingDetails.columnIndex>=0&&f.field,fieldName&&(t.updateScrollBar(),i.editSettings.allowEditing&&i.editSettings.editMode==r.TreeGrid.EditMode.CellEditing&&t.cellEdit(t._cellEditingDetails.rowIndex,fieldName)&&t._editAddTools()))):i.editSettings.editMode.toLowerCase()=="rowediting"?(t.updateScrollBar(),t._editRow(u)):t.model.editSettings.editMode.toLowerCase()=="dialogediting"&&t._showTreeGridAddEditDialog(u);t._clearContextMenu();break;case"Save":if(i.editSettings.editMode.toLowerCase()=="cellediting")if(this.editFormValidate())t._isRowEdit?t._endEdit():t.saveCell();else return!0;else i.editSettings.editMode.toLowerCase()=="rowediting"&&this.editFormValidate()&&t.saveRow();t._clearContextMenu();t._focusTreeGridElement();break;case"Cancel":h=t.model.editSettings.editMode;h.toLowerCase()=="cellediting"?t._isRowEdit?t.cancelRowEditCell():i.isEdit&&t.cancelEditCell():h.toLowerCase()=="rowediting"&&t.cancelRowEditCell();t._clearContextMenu();t._focusTreeGridElement();break;default:e={};e.data=s;e.menuId=n;t._triggerMenuEventHandler(n,e);t._clearContextMenu()}i.enableAltRow&&i.currentViewData[0]&&r.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0)},_setCultureInfo:function(){var t=this,u=t.model,f=u.locale,n=t.localizedLabel,i=r.TreeGrid.Locale["default"];n=u.predecessorTable||u.resourceTable?r.Gantt.Locale[f]:r.TreeGrid.Locale[f];t._toolboxTooltipTexts=n&&n.toolboxTooltipTexts?n.toolboxTooltipTexts:i.toolboxTooltipTexts;t._contextMenuTexts=n&&n.contextMenuTexts?n.contextMenuTexts:i.contextMenuTexts;t.model.isFromGantt?(t._columnMenuTexts=t.model.columnMenuTexts,t._deleteColumnText=t.model.deleteColumnText,t._okButtonText=t.model.okButtonText,t._cancelButtonText=t.model.cancelButtonText,t._columnDialogTexts=t.model.columnDialogTexts,t._columnDialogTitle=t.model.columnDialogTitle,t._confirmDeleteText=t.model.confirmDeleteText,t._editTypeText=t.model.editTypeText,t._textAlignTypeText=t.model.textAlignTypeText,t._clipModeText=t.model.clipModeText):(t._columnMenuTexts=n&&n.columnMenuTexts?n.columnMenuTexts:i.columnMenuTexts,t._columnDialogTexts=n&&n.columnDialogTexts?n.columnDialogTexts:i.columnDialogTexts,t._columnDialogTitle=n&&n.columnDialogTitle?n.columnDialogTitle:i.columnDialogTitle,t._deleteColumnText=n&&n.deleteColumnText?n.deleteColumnText:i.deleteColumnText,t._okButtonText=n&&n.okButtonText?n.okButtonText:i.okButtonText,t._cancelButtonText=n&&n.cancelButtonText?n.cancelButtonText:i.cancelButtonText,t._confirmDeleteText=n&&n.confirmDeleteText?n.confirmDeleteText:i.confirmDeleteText,t._editTypeText=n&&n.editTypeTexts?n.editTypeTexts:i.editTypeTexts,t._textAlignTypeText=n&&n.textAlignTypes?n.textAlignTypes:i.textAlignTypes,t._clipModeText=n&&n.clipModeTexts?n.clipModeTexts:i.clipModeTexts,t._dropDownListBlanksText=n&&n.dropDownListBlanksText?n.dropDownListBlanksText:i.dropDownListBlanksText,t._dropDownListClearText=n&&n.dropDownListClearText?n.dropDownListClearText:i.dropDownListClearText,t._trueText=n&&n.trueText?n.trueText:i.trueText,t._falseText=n&&n.falseText?n.falseText:i.falseText,t.model.emptyRecordText=n&&n.emptyRecord?n.emptyRecord:i.emptyRecord,t._filterMenuTexts=n&&n.filterMenuTexts?n.filterMenuTexts:i.filterMenuTexts)},_createNewRowInstance:function(n){var t=[];for(var i in n)t.push(i);return t},refresh:function(n,t){var i=this,u=i.model,f;r.isNullOrUndefined(n)?(f={},f.requestType=r.TreeGrid.Actions.Refresh,this.sendDataRenderingRequest(f)):(i.resetModelCollections(),u.dataSource=n,u.query=t,i.element.ejTreeGrid("destroy").ejTreeGrid(u))},_getNewIndex:function(){var n=this;return n._maxRowIndex+=1,n._maxRowIndex},_addRecord:function(t,i,u,f){var e=this,t,ft,ct,k,g,w,tt,et,yt,pt,ot;(e.model.isEdit||e._isRowEdit)&&e.cancelRowEditCell();var s=this.model,lt=this.selectedRowIndex(),o,c=s.updatedRecords,d=s.flatRecords,nt=s.parentRecords,h=s.selectionSettings.selectionMode=="row"?this.selectedItem():c[e._rowIndexOfLastSelectedCell],st=s.columns,p=this.dataSource(),b=0,y,it=-1,ht=!1,at=!1,v=this._getNewIndex(),l,vt=!1,a={},rt,ut;if(n.type(p)==="array"||p instanceof r.DataManager||(this.dataSource([]),p=this.dataSource()),r.isNullOrUndefined(t)){for(t=null,ft=0;ft<st.length;ft++)t=e._restoreCustomData(t,"",st[ft].field);at=!0}if(s.idMapping&&s.parentIdMapping&&!r.isNullOrUndefined(t[e.model.parentIdMapping])&&(ct=s.flatRecords.filter(function(n){return n[s.idMapping]==t[s.parentIdMapping]}),ct.length>0&&(h=ct[0],i=r.TreeGrid.RowPosition.Child,vt=!0)),(lt===-1&&e._rowIndexOfLastSelectedCell==-1&&(i===r.TreeGrid.RowPosition.Above||i===r.TreeGrid.RowPosition.Below||i===r.TreeGrid.RowPosition.Child)||!i||s.selectedItems.length>1&&!e._checkboxSelection)&&(vt||(i=r.TreeGrid.RowPosition.Top)),i==r.TreeGrid.RowPosition.Top||i==r.TreeGrid.RowPosition.Bottom?(rt=0,ut=null):i==r.TreeGrid.RowPosition.Above||i==r.TreeGrid.RowPosition.Below?(rt=h.level,ut=h.parentItem):i==r.TreeGrid.RowPosition.Child&&(rt=h.level+1,ut=h),a.requestType="add",a.data=t,a.level=rt,a.rowPosition=i,a.parentItem=ut,e._trigger("actionBegin",a)){if(f=="dialog")return!0}else{t=a.data;i!=a.rowPosition&&(i=a.rowPosition);t[s.childMapping]&&t[s.childMapping].length&&delete t[s.childMapping];e.selectRows(-1);switch(i){case r.TreeGrid.RowPosition.Top:b=0;l=null;o=e._createRecord(t,b);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);d.splice(0,0,o);c.splice(0,0,o);nt.splice(0,0,o);e._isDataManagerUpdate?e._jsonData.splice(0,0,o.item):p.splice(0,0,o.item);y=0;break;case r.TreeGrid.RowPosition.Bottom:b=0;l=null;o=e._createRecord(t,b);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);d.push(o);c.push(o);nt.push(o);e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item);y=c.indexOf(o);break;case r.TreeGrid.RowPosition.Above:b=h.level;l=h.parentItem;o=e._createRecord(t,b,l);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);g=d.indexOf(h);w=c.indexOf(h);d.splice(g,0,o);c.splice(w,0,o);r.isNullOrUndefined(l)?(nt.splice(nt.indexOf(h),0,o),e._isDataManagerUpdate?e._jsonData.splice(e._jsonData.indexOf(h.item),0,o.item):p.splice(p.indexOf(h.item),0,o.item)):(k=l.childRecords.indexOf(h),l.childRecords.splice(k,0,o),s.parentIdMapping?(o.item[s.parentIdMapping]=o.parentItem.item[s.idMapping],o[s.parentIdMapping]=o.parentItem.item[s.idMapping],e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item)):l.item[s.childMapping].splice(k,0,o.item));y=w;break;case r.TreeGrid.RowPosition.Below:b=h.level;l=h.parentItem;o=e._createRecord(t,b,l);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);tt=d.indexOf(h);h.hasChildRecords?(dataChildCount=e.getChildCount(h,0),g=tt+dataChildCount+1,w=c.indexOf(h)+e._getVisibleChildRecordCount(h,0,c)+1):(g=tt+1,w=c.indexOf(h)+1);d.splice(g,0,o);c.splice(w,0,o);r.isNullOrUndefined(l)?(nt.splice(nt.indexOf(h)+1,0,o),e._isDataManagerUpdate?e._jsonData.splice(e._jsonData.indexOf(h.item)+1,0,o.item):p.splice(p.indexOf(h.item)+1,0,o.item)):(k=l.childRecords.indexOf(h),l.childRecords.splice(k+1,0,o),s.parentIdMapping?(o.item[s.parentIdMapping]=o.parentItem.item[s.idMapping],o[s.parentIdMapping]=o.parentItem.item[s.idMapping],e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item)):l.item[s.childMapping].splice(k+1,0,o.item));y=w;break;case r.TreeGrid.RowPosition.Child:b=h.level+1;l=h;o=e._createRecord(t,b,l);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);tt=d.indexOf(h);h.hasChildRecords?(dataChildCount=e.getChildCount(h,0),g=tt+dataChildCount+1,h.expanded&&e.getExpandStatus(h)||(et={},et.expanded=!0,et.data=h,e._isInAdd=!0,e._isRefreshAddedRecord?(et.data.expanded=!0,e.updateExpandStatus(a.data,a.expanded),e.refreshContent(),e._isRefreshAddedRecord=!1):e._expandRecord(h),e._isInAdd=!1,c=e.getUpdatedRecords()),w=c.indexOf(h)+e._getVisibleChildRecordCount(h,0,c)+1-s.summaryRows.length):(e.getExpandStatus(h)||e._expandRecord(h.parentItem),c=e.getUpdatedRecords(),h.hasChildRecords=!0,h.childRecords=[],h.expanded=!0,s.parentIdMapping||(h.item[s.childMapping]=[]),h.isMilestone=!1,g=tt+1,w=c.indexOf(h)+1);d.splice(g,0,o);c.splice(w,0,o);r.isNullOrUndefined(l)||(k=l.childRecords.indexOf(h),l.childRecords.splice(k+1,0,o),s.parentIdMapping?(o.item[s.parentIdMapping]=o.parentItem.item[s.idMapping],o[s.parentIdMapping]=o.parentItem.item[s.idMapping],e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item)):l.item[s.childMapping].splice(k+1,0,o.item));y=w}if(s.allowPaging&&(i==r.TreeGrid.RowPosition.Below||i==r.TreeGrid.RowPosition.Child?(s.pageSettings.pageSizeMode!=="root"||r.isNullOrUndefined(h.parentItem))&&(yt=e._updatedPageData[e._updatedPageData.length-1],pt=e._updatedPageData.length==s.pageSettings.pageSize?s.updatedRecords.indexOf(yt):y,y>pt&&(e._currentPage(this._currentPage()+1),it=0)):i==r.TreeGrid.RowPosition.Top&&(e._currentPage()>1||e._currentPage()<1)?(e._currentPage(1),it=0):i==r.TreeGrid.RowPosition.Bottom&&e._currentPage()<s.pageSettings.totalPages&&(e._currentPage(s.pageSettings.totalPages),it=y)),!at&&(r.TreeGrid.RowPosition.Above||r.TreeGrid.RowPosition.Below)){var a={},st=s.columns,wt=st.length;s.allowPaging||(it=y);a.rowIndex=y;a.requestType="addNewRow";a.addedRow=t;e._trigger("actionComplete",a)?c.splice(y,1):(e._renderAddedRow(y,o),s.showSummaryRow&&(a.requestType=="addNewRow"&&i=="child"&&e._createAndRenderSummaryRecords(a),e._updateSummaryRow(a)),s.showTotalSummary&&e._updateTotalSummaryRow(a),ht=!0)}else e._renderAddedRow(y,o),ht=!0;s.enableVirtualization===!1&&(s.sortSettings.sortedColumns.length>0||s.filterSettings.filteredColumns.length>0)&&(e._isRefreshAddedRecord=!0);s.allowPaging&&(c=e._updatedPageData);ot=ht?c.indexOf(o):lt;s.allowSelection&&s.selectionSettings.selectionMode=="row"&&(e._rowSelectingEventTrigger(this._previousIndex,ot)||(e.selectRows(ot),s.selectionSettings.enableSelectAll&&e.selectAllRows(),e._checkboxSelection&&s.selectionSettings.enableHierarchySelection&&o.parentItem&&e._updateParentSelection(o.parentItem),e._rowSelectedEventTrigger(ot)));s.selectionSettings.selectionMode=="cell"&&(e._rowIndexOfLastSelectedCell=c.indexOf(o));e.updateScrollBar();u=="isEditRow"?e._editRow(c.indexOf(o),o):(r.TreeGrid.refreshRow(e,s.currentViewData.indexOf(o)),e._cancelSaveTools(),s.enableAltRow&&r.TreeGrid.updateAltRow(e,e.model.currentViewData[0],0,0));o.parentItem&&i==r.TreeGrid.RowPosition.Child&&(o.parentItem.childRecords.length==1||!o.parentItem.hasFilteredChildRecords)&&(o.parentItem.hasFilteredChildRecords=!0,r.TreeGrid.refreshRow(e,s.currentViewData.indexOf(o.parentItem)))}},_validateIdValue:function(t){var u=this,i=u.model,r=[],f=i.flatRecords;return r=n.map(f,function(n){if(n[i.idMapping]==t)return n}),r.length?!0:!1},_closeTreegridAddEditDialog:function(n,t){var i=this,r={};if(i._isTreeAddEditDialogSave)i._isTreeAddEditDialogSave=!1;else return r.requestType=t==="Add"?"closeAddDialog":"closeEditDialog",i._trigger("actionBegin",r)},showAddDialog:function(){var n=this;n.model.editSettings.allowAdding&&n.model.editSettings.editMode=="dialogEditing"&&n._showTreeGridAddEditDialog(null,"add")},showEditDialog:function(n){var t=this;t.model.editSettings.allowEditing&&t.model.editSettings.editMode=="dialogEditing"&&t._showTreeGridAddEditDialog(n)},_showTreeGridAddEditDialog:function(t,i){var s=document.createElement("div"),u=this,c=n(s),l=u.getOffsetRect(n("#"+u._id)[0]),o=[],a=u.model.columns,v=u._contextMenuTexts,h,f,e,arguments;if((r.isNullOrUndefined(t)||t==-1)&&!i&&(t=u.model.selectionSettings.selectionMode=="cell"?u.selectedCellIndexes()[0].rowIndex:u.selectedRowIndex()),o[0]=u.model.allowPaging?this._updatedPageData[t]:u.model.updatedRecords[t],i&&i.toLowerCase()==="add"){if(r.isNullOrUndefined(o[0]))for(o[0]=null,h=0;h<a.length;h++)o[0]=u._restoreCustomData(o[0],"",a[h].field);c.addClass("e-dialogaddrow")}else c.addClass("e-dialogeditedrow");r.isNullOrUndefined(u.model.editSettings.dialogEditorTemplateID)||u.model.editSettings.dialogEditorTemplateID==""?s.innerHTML=n.render[this._id+"_JSONDialogEditingTemplate"](o):r.isNullOrUndefined(u.model.editSettings.dialogEditorTemplateID)||u.model.editSettings.dialogEditorTemplateID==""||(s.innerHTML=n.render[this._id+"_JSONdialogTemplateMode"](o));this.model.editSettings.editMode=="dialogEditing"&&(n("#"+this._id+"_dialogEdit").html(n(s)),f={},f.cssClass=this.model.cssClass,f.enableRTL=!1,f.enableResize=!1,f.showOnInit=!1,f.content="#"+this._id,n(window).width()<=u._responsiveMinWidth&&u.model.isResponsive?(f.width=n("#"+u._id).width()+"px",f.height=n("#"+u._id).height()+"px",f.enableModal=!1,f.isResponsive=!1,f.allowDraggable=!1):(f.width="auto",f.height="auto",f.enableModal=!0,f.isResponsive=!1,f.allowDraggable=!0),f.allowKeyboardNavigation=!1,i&&i.toLowerCase()==="add"?(f.title=v.addRowText,f.beforeClose=function(n){u._closeTreegridAddEditDialog(n,"Add")&&(n.cancel=!0)}):(f.title=v.editText,f.beforeClose=function(n){u._closeTreegridAddEditDialog(n,"Edit")&&(n.cancel=!0)}),n("#"+this._id+"_dialogEdit").ejDialog(f),e={},e.data=o[0],i&&i.toLowerCase()==="add"?(e.requestType="beforeOpenAddDialog",e.rowPosition=u.model.editSettings.rowPosition):e.requestType="beforeOpenEditDialog",e.element=n("#"+u._id+"_dialogEdit"),u._trigger("actionBegin",e)||(arguments={},arguments.columnIndex=t,arguments.data=e.data,arguments.requestType="beginEdit",u._refreshEditForm(arguments),e.data=arguments.data,e.requestType=i&&i.toLowerCase()==="add"?"openAddDialog":"openEditDialog",e.element=n("#"+u._id+"_dialogEdit"),u._trigger("actionBegin",e)||(n("#"+this._id+"_dialogEdit").ejDialog("open"),u._currentEditRecordDialogIndex=t,n(window).width()<=u._responsiveMinWidth&&u.model.isResponsive?(n("#"+u._id+"_dialogEdit_wrapper").css({left:l.left+"px",top:l.top+"px"}),n("#"+u._id+"_dialogEdit_wrapper").removeClass("e-shadow").removeClass("e-treegridadaptivedialog"),n("#"+u._id+"_dialogEdit").removeClass("e-shadow")):(n("#"+u._id+"_dialogEdit_wrapper").addClass("e-shadow").addClass("e-treegridadaptivedialog"),n("#"+u._id+"_dialogEdit").addClass("e-shadow")),this._on(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",u._buttonClick),n("#"+u._id+"_dialogEdit").ejDialog("refresh"))));n.isFunction(n.validator)&&(u._initValidator(),u.setValidation())},addRow:function(n,t){var i=this,r=i.model;if(i._cancelEditState(),n)if(r.idMapping&&r.parentIdMapping)if(n[r.idMapping]&&!i._validateIdValue(n[r.idMapping]))i._isPublicAdd=!0,i._addRecord(n,t),i._isPublicAdd=!1;else return!1;else i._addRecord(n,t);else i._addRecord(null,t,"isEditRow")},_startAdd:function(){var n=this,t=this.model;n.model.allowSelection&&n.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&n._clearMultiSelectPopup();n._addRecord(null,t.editSettings.rowPosition,"isEditRow")},_getRecordIndexByItem:function(n,t){var i=r.DataManager(t).executeLocal(r.Query().where("item",r.FilterOperators.equal,n));return i.length>0?t.indexOf(i[0]):-1},_expandRecord:function(n){for(var t=n,i={};t!=null;)t.expanded==!1&&(i.expanded=!0,i.data=t,this._isInExpandCollapseAll=t.parentItem?!0:!1,r.TreeGrid.sendExpandCollapseRequest(this,i)),t=t.parentItem},scrollOffset:function(n,t){var i=this._$gridContent.data("ejScroller"),r=this.model;this.editFormValidate()&&(r.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());(typeof t=="number"||typeof parseInt(t)=="number")&&(t=parseInt(t),t>=0&&this.getMaxScrollHeight()>t&&i.scrollY(t,!0));(typeof n=="number"||typeof parseInt(n)=="number")&&(n=parseInt(n),n>=0&&this.getMaxScrollWidth()>n&&i.scrollX(n,!0))},getScrollTopOffset:function(){return this.getScrollElement().ejScroller("model.scrollTop")},getScrollLeftOffset:function(){return this.getScrollElement().ejScroller("model.scrollLeft")},scrollToTop:function(){var i=this.model,t=proxy.getUpdatedRecords(),r,n=-1;this.editFormValidate()&&(i.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());t=i.allowPaging?t:this.getExpandedRecords(i.updatedRecords);t.length>0&&(n=0,r=t[0],n=t.indexOf(r),i.allowSelection&&!this._rowSelectingEventTrigger(this.selectedRowIndex(),n)&&(this.selectRows(n),this._rowSelectedEventTrigger(n)),this.updateScrollBar(n))},scrollToBottom:function(){var t=this.model,i,r,n=-1;this.editFormValidate()&&(t.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());i=this.getExpandedRecords(t.updatedRecords);i.length>0&&(n=i.length-1,r=i[n],n=t.updatedRecords.indexOf(r),t.allowSelection&&!this._rowSelectingEventTrigger(this.selectedRowIndex(),n)&&(this.selectRows(n),this._rowSelectedEventTrigger(n)),this.updateScrollBar(n))},_editAddTools:function(){var u=this,e=u.model,t=n("#"+u._id+"_toolbarItems"),f=u.model.editSettings,i,r;toolbarItems=e.toolbarSettings.toolbarItems;i=[];f.allowAdding&&toolbarItems.indexOf("add")!==-1&&!n(t).find(".e-addnew").parent("li").hasClass("e-disable")&&i.push(n(t).find(".e-addnew").parent()[0]);f.allowEditing&&toolbarItems.indexOf("edit")!==-1&&!n(t).find(".e-edit").parent("li").hasClass("e-disable")&&i.push(n(t).find(".e-edit").parent()[0]);f.allowDeleting&&toolbarItems.indexOf("delete")!==-1&&!n(t).find(".e-delete").parent("li").hasClass("e-disable")&&e.editSettings.beginEditAction!="click"&&i.push(n(t).find(".e-delete").parent()[0]);i.forEach(function(i){n(t).ejToolbar("disableItem",i)});r=[];toolbarItems.indexOf("cancel")!==-1&&r.push(n(t).find(".e-cancel").parent()[0]);toolbarItems.indexOf("update")!==-1&&r.push(n(t).find(".e-save").parent()[0]);r.forEach(function(i){n(t).ejToolbar("enableItem",i)})},_cancelSaveTools:function(){var u=this,f=u.model,e=u.model.editSettings,t=n("#"+u._id+"_toolbarItems"),s=[],r=f.toolbarSettings.toolbarItems,o,i;if(f.isFromGantt){var t=n("#"+u._id.replace("ejTreeGrid","")+"_toolbarItems"),o=[],i=[];f.readOnly==!0?(i=[],i.push(n(t).find(".e-addnewitem").parent()[0]),i.push(n(t).find(".e-edititem").parent()[0]),i.push(n(t).find(".e-edititem").parent()[0])):(e.allowAdding&&r.indexOf("add")!==-1&&o.push(n(t).find(".e-addnewitem").parent()[0]),e.allowEditing&&r.indexOf("edit")!==-1&&f.allowSelection&&e.beginEditAction!="click"&&(u.selectedRowIndex()!=-1?o.push(n(t).find(".e-edititem").parent()[0]):i.push(n(t).find(".e-edititem").parent()[0])),e.allowDeleting&&r.indexOf("delete")!==-1&&f.allowSelection&&(u.selectedRowIndex()!=-1?o.push(n(t).find(".e-deleteitem").parent()[0]):i.push(n(t).find(".e-deleteitem").parent()[0])),e.allowIndent&&(r.indexOf("indent")!==-1||r.indexOf("outdent")!==-1)&&f.allowSelection&&u.selectedRowIndex()==-1&&(i.push(n(t).find(".e-indent").parent()[0]),i.push(n(t).find(".e-outdent").parent()[0])),n(t).ejToolbar("enableItem",o),r.indexOf("cancel")!==-1&&i.push(n(t).find(".e-cancel").parent()[0]),r.indexOf("update")!==-1&&i.push(n(t).find(".e-saveitem").parent()[0]));i.forEach(function(i){n(t).ejToolbar("disableItem",i)})}else o=[],i=[],e.allowAdding?r.indexOf("add")!==-1&&o.push(n(t).find(".e-addnew").parent()[0]):i.push(n(t).find(".e-addnew").parent()[0]),e.allowEditing&&r.indexOf("edit")!==-1?u.selectedRowIndex()!=-1&&f.allowSelection&&(f.selectedItems.length==1||u._checkboxSelection)&&e.beginEditAction!="click"?o.push(n(t).find(".e-edit").parent()[0]):n(t).find(".e-edit").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-edit").parent()[0]):i.push(n(t).find(".e-edit").parent()[0]),e.allowDeleting&&r.indexOf("delete")!==-1?u.selectedRowIndex()!=-1&&f.allowSelection&&f.selectedItems.length>0?o.push(n(t).find(".e-delete").parent()[0]):n(t).find(".e-delete").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-delete").parent()[0]):i.push(n(t).find(".e-delete").parent()[0]),s=u._getParentRecords(f.updatedRecords,u),s.length<=0?(r.indexOf("expandAll")===-1||n(t).find(".e-expandall").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-expandall").parent()[0]),r.indexOf("collapseAll")===-1||n(t).find(".e-collapseall").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-collapseall").parent()[0])):(r.indexOf("expandAll")!==-1&&o.push(n(t).find(".e-expandall").parent()[0]),r.indexOf("collapseAll")!==-1&&o.push(n(t).find(".e-collapseall").parent()[0])),e.beginEditAction=="click"&&(e.beginEditAction!="click"||f.isEdit)||(r.indexOf("cancel")===-1||n(t).find(".e-cancel").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-cancel").parent()[0]),r.indexOf("update")===-1||n(t).find(".e-save").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-save").parent()[0])),i.forEach(function(i){n(t).ejToolbar("disableItem",i)}),o.forEach(function(i){n(t).ejToolbar("enableItem",i)})},_checkIsEmptyRow:function(n){var i=this.model.columns,t;for(itemIndex=0;itemIndex<i.length;itemIndex++)if(t=this._getCustomCellValue(n,i[itemIndex].field),t!==" "&&t!==null&&t!==""&&t!==!1)return!1;return!0},_beginEdit:function(){var n=this;n._trigger("beginEdit",args);n._isinBeginEdit=!0},_endEdit:function(){var t=this,i,u;if(t._isinBeginEdit=!1,i=this.selectedRowIndex(),u=r.TreeGrid.getRowByIndex(t,i),this.editFormValidate())n("tr").hasClass("e-addedrow")||n("tr").hasClass("e-rowedit")?t.saveRow():t.saveCell();else return!0},_refreshTreeGridOnExpandCollapseAll:function(n){var t=this,i=this.model,u;if(i.enableVirtualization)i.enableAltRow&&t.updateAltRow(),t.sendDataRenderingRequest(n),t._setScrollTop(),t.updateHeight();else{if(i.allowPaging&&(u={},u.totalRecordsCount=this.getExpandedRecords(i.updatedRecords).length,t.getPager().ejPager("option",u).ejPager("refreshPager"),pagerModel=this.getPager().ejPager("model"),t._currentPage(pagerModel.currentPage),u.requestType="paging",t.processBindings(u)),t._isRefreshAddedRecord){t.processBindings();this.renderRecords();t._isRefreshAddedRecord=!1;return}t.updateHeight();i.enableAltRow&&i.currentViewData.length>0&&r.TreeGrid.updateAltRow(t,t.model.currentViewData[0],0,0)}},_expandCollapseInnerLevelRecord:function(n,t){for(var f=this,e=n.childRecords.length,u={},i=0;i<e;i++)n.childRecords[i].hasChildRecords&&(f._expandCollapseInnerLevelRecord(n.childRecords[i],t),u.data=n.childRecords[i],u.expanded=t,r.TreeGrid.sendExpandCollapseRequest(f,u))},_expandParentLevelRecord:function(n,t){var u=this,i={},f=u.getExpandStatus(treegridRecord);n.expanded&&f||(i.data=n,i.expanded=t,r.TreeGrid.sendExpandCollapseRequest(u,i),i.data.parentItem&&u._expandParentLevelRecord(i.data.parentItem,t))},expandAtLevel:function(n){var t=this,i={},u=t._getParentRecords(t.model.updatedRecords,t);for(count=0;count<u.length;count++)treegridRecord=u[count],treegridRecord.level==n&&(i.data=treegridRecord,i.expanded=!0,r.TreeGrid.sendExpandCollapseRequest(t,i),treegridRecord.parentItem&&t._expandParentLevelRecord(treegridRecord.parentItem,i.expanded))},collapseAtLevel:function(n){var t=this,i={},e=t.model,u=t._getParentRecords(e.updatedRecords,t),f;for(count=0;count<u.length;count++)treegridRecord=u[count],treegridRecord.level==n&&treegridRecord.expanded&&(f=t.getExpandStatus(treegridRecord),f&&(i.data=treegridRecord,i.expanded=!1,r.TreeGrid.sendExpandCollapseRequest(t,i)))},expandCollapseRow:function(n){var t=this,i={};n=parseInt(n);t.model.updatedRecords.length>n&&n>=0&&(treegridRecord=t.model.updatedRecords[n],treegridRecord.hasChildRecords&&(i.data=treegridRecord,i.expanded=treegridRecord.expanded?!1:!0,r.TreeGrid.sendExpandCollapseRequest(t,i)))},expandAll:function(){var n=this,f=n.model,i=0,u,t={};for(n._isRowEdit?n.cancelRowEditCell():n.model.isEdit&&n.cancelEditCell(),t.requestType=r.TreeGrid.Actions.ExpandCollapse,n._isInExpandCollapseAll=!0,i=0;i<n.model.parentRecords.length;i++)u=n.model.parentRecords[i],t.data=u,t.recordIndex=i,t.expanded=!0,u.hasChildRecords&&(n._expandCollapseInnerLevelRecord(u,t.expanded),r.TreeGrid.sendExpandCollapseRequest(n,t));f.flatRecords.length>0&&n._refreshTreeGridOnExpandCollapseAll(t);n._isInExpandCollapseAll=!1},_refreshToolBar:function(){var t=n("#"+this._id+"_toolbarItems");t.find("li").removeClass("e-hover")},_renderToolbar:function(){var t=this,i=t.model;if(!i.isFromGantt){var t=this,r=t.element,i=t.model;t.model.toolbarSettings.showToolbar&&r.append(t._renderToolbarTemplate());t.model.isResponsive&&n("#"+t._id+"_toolbarItems").addClass("e-treegridadaptivetoolbar")}},_renderToolbarTemplate:function(){var t=this,f=t.model,u=r.buildTag("div.e-treegridtoolbar#"+t._id+"_toolbarItems","",{height:"36px",border:"1px solid"},{unselectable:"on"}),e,o,i;return!r.isNullOrUndefined(f.toolbarSettings.toolbarItems)&&f.toolbarSettings.toolbarItems.length&&(e=r.buildTag("ul","",{},{}),t._renderLi(e),u.append(e)),!r.isNullOrUndefined(f.toolbarSettings.customToolbarItems)&&f.toolbarSettings.customToolbarItems.length&&(o=r.buildTag("ul","",{},{}),t._renderCustomLi(o),u.append(o)),i={},i.click=t._toolBarClick,i.cssClass="",i.rtl=!1,i.itemSeparator=!1,i.itemLeave=t._toolbarItemLeave,i.width=t._gridWidth,i.fields={id:"",tooltipText:"",imageUrl:"",text:"",imageAttributes:"",spriteCSS:"",htmlAttributes:""},u.ejToolbar(i),u.ejToolbar("disableItem",t._disabledToolItems),t._disabledToolItems=n(),u},_renderCustomLi:function(t){for(var e,o=this,h=o.model,f,s,u=h.toolbarSettings.customToolbarItems,i=0;i<u.length;i++)(u[i].text||u[i].templateID)&&(u[i].text?(e=u[i].tooltipText?u[i].tooltipText:u[i].text,f=r.buildTag("li","",{},{id:o._id+"_"+u[i].text,title:e}),s=r.buildTag("a.e-toolbaricons e-icon e-treegridcustomtoolbaritem","",{}).addClass(u[i].text),f.addClass("e-treegridtoolbaritem")):(e=u[i].tooltipText?u[i].tooltipText:u[i].templateID.replace("#",""),f=r.buildTag("li","",{},{id:o._id+"_"+u[i].templateID.replace("#",""),title:e}),s=n(u[i].templateID).hide().html()),f.html(s),t.append(f))},_renderLi:function(n){var i=this,u=i.model.toolbarSettings.toolbarItems,e=u.length,t=0,f;for(t;t<e;t++)f=r.buildTag("li.e-treegridtoolbaritem","",{},{id:i._id+"_"+u[t]}),i._renderLiContent(f,u[t]),n.append(f)},_renderLiContent:function(n,t){var u,i,f=this.selectedRowIndex(),p=this.model.editSettings,e,o,s,h,c,l,a,v,y;switch(t){case"add":u=r.buildTag("a.e-addnew e-toolbaricons e-icon e-treegrid-add","",{});e=this._toolboxTooltipTexts.addTool;n.attr("title",e);this.model.editSettings.allowAdding||this._disabledToolItems.push(n.get(0));break;case"edit":u=r.buildTag("a.e-edit e-toolbaricons e-icon e-treegrid-edit","",{});o=this._toolboxTooltipTexts.editTool;n.attr("title",o);this.model.editSettings.allowEditing&&f!=-1&&this.model.allowSelection&&this.model.editSettings.beginEditAction!="click"||this._disabledToolItems.push(n.get(0));break;case"delete":s=this._toolboxTooltipTexts.deleteTool;n.attr("title",s);u=r.buildTag("a.e-delete e-toolbaricons e-icon e-treegrid-delete","",{});this.model.editSettings.allowDeleting&&f!=-1&&this.model.allowSelection||this._disabledToolItems.push(n.get(0));break;case"update":h=this._toolboxTooltipTexts.updateTool;n.attr("title",h);u=r.buildTag("a.e-save e-toolbaricons e-icon e-treegrid-save e-disabletool","",{});this._disabledToolItems.push(n.get(0));break;case"cancel":c=this._toolboxTooltipTexts.cancelTool;n.attr("title",c);u=r.buildTag("a.e-cancel e-toolbaricons e-icon e-treegrid-cancel e-disabletool","",{});this._disabledToolItems.push(n.get(0));break;case"expandAll":l=this._toolboxTooltipTexts.expandAllTool;n.attr("title",l);i=r.buildTag("a.e-expandall e-toolbaricons e-icon e-treegrid-expandall","",{},{});n.append(i);break;case"collapseAll":a=this._toolboxTooltipTexts.collapseAllTool;n.attr("title",a);i=r.buildTag("a.e-collapseall e-toolbaricons e-icon e-treegrid-collapseall","",{},{});n.append(i);break;case"pdfExport":v=this._toolboxTooltipTexts.pdfExportTool;n.attr("title",v);i=r.buildTag("a.e-pdfIcon e-toolbaricons e-icon","",{},{});n.append(i);break;case"excelExport":y=this._toolboxTooltipTexts.excelExportTool;n.attr("title",y);i=r.buildTag("a.e-excelIcon e-toolbaricons e-icon","",{},{});n.append(i)}n.append(u)},_updateToolbarItems:function(){var t=this,i=t.model,u=i.toolbarSettings.toolbarItems,f=i.editSettings,e=n("#"+t._id+"_toolbarItems"),o=t.selectedRowIndex(),r=f.editMode;disableToolItems=[];enableToolItems=[];u=i.toolbarSettings.toolbarItems;r.toLowerCase()=="cellediting"||r.toLowerCase()=="dialogediting"?t._isRowEdit?t.cancelRowEditCell():i.isEdit&&t.cancelEditCell():r.toLowerCase()=="rowediting"&&t.cancelRowEditCell();t._cancelSaveTools()},_renderAfterColumnInitialize:function(){var n=this;n.element.append(n._renderGridHeader())},filterEditType:function(n,t,i){var u=this,h=u.model,f=n.field.split(".").join(""),e,o,s;r.isNullOrUndefined(n.filterEditType)&&(n.filterEditType=n.editType);switch(n.filterEditType){case"stringedit":t.html(r.buildTag("input.e-ejinputtext e-filtertext e-field e-filterwidth","",{},{id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i}));break;case"numericedit":e=r.buildTag("input.e-numerictextbox e-field","",{width:n.width-15},{type:"text",id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i});t.append(e);break;case"datepicker":case"datetimepicker":o=r.buildTag("input.e-"+n.filterEditType+" e-field","",{},{type:"text",id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i});t.append(o);break;case"booleanedit":case"dropdownedit":s=r.buildTag("input.e-field e-dropdownlist e-field","",{},{type:"text",id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i});t.append(s)}},_filteringElements:function(t){var i=this,s=i.model,et=!1,rt,ot,st,f,a,o={},h,y,w,b,e,k,v;for(selectedItem=s.selectedItem,t.requestType=="filtering"&&(ot=document.getElementById(i._id+"_filterBar"+t.fieldname.split(".").join(""))),e=y=r.TreeGrid.getColumnByField(s.columns,t.fieldname),rt=n(ot).find("input,select"),st=rt.length,k=0;k<st;k++){if(f=rt.eq(k),o={},inputWidth=f.closest("div").width()-2,f.hasClass("e-numerictextbox"))a=inputWidth,h=f.val(),o.width=a,o.showSpinButton=!0,o.cssClass=s.cssClass,o.locale=s.locale,o.height=28,o.focusIn=n.proxy(i._cancelEditState,i,f),v=f[0].id,v=v.replace(i._id,""),o.change=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null,o.value=h.length?parseFloat(h):null,y=r.TreeGrid.getColumnByField(i.model.columns,f.prop("name")),r.isNullOrUndefined(y)||r.isNullOrUndefined(y.editParams)||n.extend(o,y.editParams),f.ejNumericTextbox(o),f.prop("name",f.prop("name").replace(i._id,""));else if(f.hasClass("e-datepicker"))a=inputWidth,o.width=a,o.cssClass=s.cssClass,o.dateFormat=s.dateFormat,o.locale=s.locale,o.height=28,o.focusIn=n.proxy(i._cancelEditState,i,f),v=f[0].id,v=v.replace(i._id,""),o.select=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null,e=r.TreeGrid.getColumnByField(i.model.columns,f.prop("name")),e.format!==u&&e.format.length>0&&(w=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),b=w.exec(e.format),o.dateFormat=b[2]),r.isNullOrUndefined(e.editParams)||n.extend(o,e.editParams),s.dateFormat.toLowerCase().indexOf("hh")!=-1?f.ejDateTimePicker(o):f.ejDatePicker(o),i._preventDoubleClick(e);else if(f.hasClass("e-datetimepicker"))a=inputWidth,o={width:a,rtl:s.rtl,locale:s.locale,cssClass:s.cssClass,showButton:!1,focusIn:n.proxy(i._cancelEditState,i,f)},o.height=28,o.close=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null,e=r.TreeGrid.getColumnByField(i.model.columns,f.prop("name")),e.format!==u&&e.format.length>0&&(w=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),b=w.exec(e.format),o.dateTimeFormat=b[2]),r.isNullOrUndefined(e.editParams)||n.extend(o,e.editParams),f.ejDateTimePicker(o),i._preventDoubleClick(e);else if(f.hasClass("e-dropdownlist")){e=r.TreeGrid.getColumnByField(s.columns,t.fieldname);var p=e.editParams&&e.editParams.fields&&e.editParams.fields.text?e.editParams.fields.text:"text",h=e.editParams&&e.editParams.fields&&e.editParams.fields.value?e.editParams.fields.value:"value",d,g,c=[],ut,nt,tt;e.dropdownData&&e.dropdownData.length>0?c=n.extend(!0,[],e.dropdownData):e.editType=="booleanedit"?(c=[],nt={},nt[p]=i._trueText,nt[h]="true",c.push(nt),tt={},tt[p]=i._falseText,tt[h]="false",c.push(tt)):c=i._dropDownArrayCollection(e,t.fieldname);d={};d[p]=i._dropDownListClearText;d[h]="";c.splice(0,0,d);ut=e.allowFilteringBlankContent==u?!0:e.allowFilteringBlankContent;ut&&(g={},g[p]=i._dropDownListBlanksText,g[h]=i._dropDownListBlanksText,c.push(g));var l={},ft=f.val(),it,ht=n("#"+f[0].id).data("ejDropDownList");ht&&(it=n(ht.popupList));l.width=inputWidth;l.showCheckbox=!1;l.dataSource=c;l.height=28;l.popupShown=n.proxy(i._cancelEditState,i,f);l.fields={text:p,value:h};l.popupHide=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null;f.ejDropDownList(l);it&&(it.find(".e-ul :first-child").find(".e-ddltxt").css("font-style","italic"),ut&&it.find(".e-ul :last-child").find(".e-ddltxt").css("font-style","italic"));ft==i._dropDownListClearText&&(ft="");f.ejDropDownList("selectItemByValue",ft);i._preventDoubleClick(e)}else switch(f.prop("tagName")){case"INPUT":f.width(inputWidth-4);e.filterEditType=="stringedit"&&i._on(n("#"+i._id+"_"+e.field.split(".").join("")+"_filterbarcell"),"focus",i._cancelEditState);break;case"SELECT":f.width(inputWidth).height(15)}f.is(":disabled")||et||f.is(":hidden")&&typeof f.data("ejDropDownList")!="object"||i._isEnterKeyPressed||(et=!0)}},_dropDownArrayCollection:function(t,i){var u=this,s=u.model,f=i,e=[],r=[],o=[],h=t.editType;return e=n.map(s.flatRecords,function(n){if(n.item[f])return n.item[f]}),n.each(e,function(t,i){i=n.trim(i);n.inArray(i,r)===-1&&r.push(i)}),h!="numericedit"?r.sort(u.stringCompare):r=r.sort(function(n,t){return n-t}),n.each(r,function(n,t){o.push({text:t,value:t})}),o},stringCompare:function(n,t){var i=[],r=[];for(n.replace(/(\d+)|(\D+)/g,function(n,t,r){i.push([t||Infinity,r||""])}),t.replace(/(\d+)|(\D+)/g,function(n,t,i){r.push([t||Infinity,i||""])});i.length&&r.length;){var u=i.shift(),f=r.shift(),e=u[0]-f[0]||u[1].localeCompare(f[1]);if(e)return e}return i.length-r.length},_preventDoubleClick:function(t){var i=this,u=n("#"+i._id+"_"+t.field.split(".").join("")+"_filterbarcell_popup");if(u.length!=0)n(u).on("click",function(){r.isTouchDevice()?i._off(i.element,"doubletap ",".e-gridcontent",i._editdblClickHandler):i._off(i.element,"dblclick ",".e-gridcontent",i._editdblClickHandler);setTimeout(function(){r.isTouchDevice()?i._on(i.element,"doubletap ",".e-gridcontent",i._editdblClickHandler):i._on(i.element,"dblclick ",".e-gridcontent",i._editdblClickHandler)},300)})},_renderFiltering:function(t,i){var l=this,f=this.model,o,s,u,h,c,e,a;if(totColumns=f.columns,filteredColumns=f.filterSettings.filteredColumns,o=r.buildTag("tr.e-filterbar","",{},{}),l.model.allowFiltering&&(n.each(totColumns,function(n,t){r.isNullOrUndefined(t.allowFiltering)&&(t.allowFiltering=!0)}),s=!1,n.each(totColumns,function(n,t){if(t.allowFiltering==!0)return s=!0,!1}),s))for(u=0;u<t.length;u++)if(h=r.buildTag("th.e-filterbarcell .e-editValue","",{},{}),t[u].visible===!1&&h.addClass("e-hide"),$div=r.buildTag("div.e-filterdiv","",{},{id:l._id+"_filterBar"+t[u].field.split(".").join("")}),o.append(h.append($div)),t[u].allowFiltering==!1)continue;else{if(c="",filteredColumns.length>0)for(e=0;e<filteredColumns.length;e++)t[u].field==filteredColumns[e].field&&(c=filteredColumns[e].value);this.filterEditType(t[u],$div,c);a=r.buildTag("span.e-cancel e-icon e-hide e-spanstyle");$div.append(a)}return f.showDetailsRow&&f.detailsTemplate&&f.showDetailsRowInfoColumn&&i&&o.append(r.buildTag("th.e-filterbarcell e-detailheadercell",'<div style="width:35px;"><\/div>')),o},_getIndentCol:function(){return r.buildTag("col","",{width:"35px"})},_renderGridHeader:function(){var n=this,i=n.model,o=document,u,e,t=r.buildTag("div.e-gridheadercontainer","",{overflow:"hidden"},{unselectable:"on"}),f=i.isFromGantt?r.buildTag("div.e-gridheader#"+n._id+"e-gridheader","",{"border-left-style":"solid","border-left-width":"1px"},""):r.buildTag("div.e-gridheader#"+n._id+"e-gridheader","",{"border-top-style":"solid","border-left-style":"solid","border-right-style":"solid","border-top-width":"1px","border-left-width":"1px","border-right-width":"1px",width:n._gridWidth},"");return i.allowFiltering==!0&&i.filterSettings.filterType==r.TreeGrid.FilterType.FilterBar&&t.addClass("e-headercontent-material-filterbar"),t.addClass("e-headercontent"),n.setGridHeaderContent(f),n._$gridHeaderContainer=t,n._hiddenColumns=[],n._visibleColumns=[],n.columnsWidthCollection=[],this._frozenColumnsLength>0?(t.addClass("e-frozen-header-container"),u=r.buildTag("div.e-frozenheaderdiv#e-frozenheaderdiv"+n._id,this._renderGridHeaderInternalDesign(i.columns.slice(0,this._frozenColumnsLength),!1)),i.allowFiltering==!0&&i.filterSettings.filterType==r.TreeGrid.FilterType.FilterBar&&u.addClass("e-filterbar-header-material"),e=r.buildTag("div.e-movableheader#e-movableheader"+n._id,r.buildTag("div.e-movableheaderdiv#e-movableheaderdiv"+n._id,this._renderGridHeaderInternalDesign(this.model.columns.slice(this._frozenColumnsLength),!0))),t.append(u).append(e)):(t.append(this._renderGridHeaderInternalDesign(this.model.columns,!0)),t.removeClass("e-frozen-header-container")),f.html(t),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),f},getPager:function(){return this._gridPager},setTreeGridPager:function(n){this._gridPager=n},_renderGridPager:function(){var t=this,u=n(document.createElement("div")),i={},f=t.model.pageSettings,e,o;return f.click=n.proxy(t._pagerClickHandler,t),f.totalRecordsCount=t._gridRecordsCount,n.extend(i,f),i.locale=t.model.locale,t._currentPage()<0&&t._currentPage(1),i.currentPage=this._prevPageNo=t._currentPage(),i.masterObject=t,t.setTreeGridPager(u),u.ejPager(i),u.ejPager("refreshPager"),i=u.ejPager("model"),f.totalPages=i.totalPages,t._currentPage()!==i.currentPage&&t._currentPage(i.currentPage),!r.isNullOrUndefined(f.template)&&f.template.length>0&&(u.children().remove(),e=r.buildTag("div.e-pagercontainer"),o=this._createTemplateElement(f,!0),e.append(o.innerHTML),u.append(e)),u},_addHeaderCheckboxTemplate:function(){var n=this.model;return n.flatRecords.length==n.selectedItems.length?'<div><span class="e-chkbox-wrap e-widget" style="margin-left:5px;padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-act"><span class="e-checkbox e-checkmark e-chk-image e-icon e-headerCheckbox"id ='+this._id+"_headerCheckbox><\/span><\/span><\/div><\/span><\/div>":n.flatRecords.length>n.selectedItems.length&&n.selectedItems.length>0?'<div><span class="e-chkbox-wrap e-widget" style="margin-left:5px;padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-indeter"><span class="e-checkbox e-stop e-chk-image e-icon e-headerCheckbox"id ='+this._id+"_headerCheckbox><\/span><\/span><\/div><\/span><\/div>":'<div><span class="e-chkbox-wrap e-widget" style="margin-left:5px;padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-inact"><span class="e-checkbox e-chk-image e-icon e-headerCheckbox"id ='+this._id+"_headerCheckbox><\/span><\/span><\/div><\/span><\/div>"},_renderGridHeaderInternalDesign:function(t,i){var e=this,o=e.model,l=document,b=r.buildTag("table.e-table","",{},{cellspacing:"0px","border-spacing":"0px"}),v=r.buildTag("thead"),it=r.buildTag("tbody.e-hide"),a=r.buildTag("tr.e-columnheader"),y=n(l.createElement("colgroup")),nt=n(l.createElement("tr")),f=0,tt=t.length,s,k,h,p,w,d,g,c;for((o.allowSorting||o.showColumnChooser||o.allowColumnReordering)&&a.css({cursor:"pointer"}),o.headerTextOverflow==="wrap"?e.element.addClass("e-wrap"):e.element.removeClass("e-wrap"),f;f<tt;f++)if(t[f]){if(d=t[f].headerTextAlign?t[f].headerTextAlign:t[f].textAlign?t[f].textAlign:r.TextAlign.Left,(e.model.showColumnChooser||!e.model.showColumnChooser&&e.model.allowFiltering&&e.model.filterSettings.filterType=="menu")&&t[f].field!="checkboxState"?r.isNullOrUndefined(t[f].allowFiltering)||t[f].allowFiltering||e.model.showColumnChooser?(s=r.buildTag("th.e-headercell","",{},{}),s.addClass("e-column-menu-padding")):s=r.buildTag("th.e-headercell","",{},{}):s=r.buildTag("th.e-headercell","",{},{}),e.model.allowFiltering&&e.model.filterSettings.filterType==r.TreeGrid.FilterType.FilterBar&&s.addClass("e-filterbar-material"),k=l.createElement("td"),h=r.buildTag("div.e-headercelldiv","",{"text-align":d},{"ej-mappingname":t[f].field,unselectable:"on"}),t[f].clipMode&&t[f].clipMode==r.TreeGrid.ClipMode.Ellipsis&&h.addClass("e-treegridtrimcell"),e._checkboxSelection&&o.selectionSettings.enableSelectAll&&e._checkboxColumnName==t[f].field&&h.append(e._addHeaderCheckboxTemplate()),t[f].field=="checkboxState"&&s.css({cursor:"default"}),g=r.buildTag("span",t[f].headerText==u?t[f].headerText=t[f].field:t[f].headerText),h.append(g),s.append(h),e.model.showColumnChooser&&!t[f].nonColumn)$columnChooser=r.buildTag("div.e-columnmenu-icon e-icon e-columnicon","",{cursor:"pointer"}),$columnChooser.data("isClicked",!1),s.append($columnChooser);else if(!e.model.showColumnChooser&&e.model.allowFiltering&&e.model.filterSettings.filterType=="menu"&&(r.isNullOrUndefined(t[f].allowFiltering)||t[f].allowFiltering)&&t[f].field!="checkboxState"){if($columnFilter=e._filteredColumnValueID.indexOf(t[f].field)!=-1?r.buildTag("div.e-column-filtered-icon e-icon e-filtericon","",{cursor:"pointer"}):r.buildTag("div.e-column-filter-icon e-icon e-filtericon","",{cursor:"pointer"}),e.model.filterSettings.filteredColumns)for(c=0;c<e.model.filterSettings.filteredColumns.length;c++)e.model.filterSettings.filteredColumns[c].field==t[f].field&&e.model.filterSettings.filteredColumns[c].value.toString()!=""&&($columnFilter=r.buildTag("div.e-column-filtered-icon e-icon e-filtericon","",{cursor:"pointer"}));$columnFilter.data("isClicked",!1);s.append($columnFilter)}p=l.createElement("col");nt.append(k);a.append(s);y.append(p);t[f].visible===!1&&t[f]!=o.columns[o.treeColumnIndex]?s.addClass("e-hide")&&n(p).css("display","none")&&e._hiddenColumns.push(t[f].headerText):(e._visibleColumns.push(t[f].headerText),t[f].visible=!0);t[f].allowSorting===!1&&(e._disabledSortableColumns.push(t[f].headerText),s.css({cursor:"normal"}));r.isNullOrUndefined(t[f].headerTemplateID)||h.html(n(t[f].headerTemplateID).hide().html()).parent().addClass("e-headertemplate");t[f].allowCellSelection==u&&(t[f].allowCellSelection=!0);t[f].showInColumnChooser==u&&(t[f].showInColumnChooser=!0);t[f].width==u&&o.commonWidth!==u?(e.columnsWidthCollection.push(o.commonWidth),t[f].width=o.commonWidth):(e.columnsWidthCollection.push(parseFloat(t[f].width)),t[f].width=parseFloat(t[f].width));e._fieldColumnNames[t[f].headerText]=t[f].field;e._headerColumnNames[t[f].field]=t[f].headerText}return o.isFromGantt&&e.updateToGanttColumns(),o.showDetailsRow&&o.detailsTemplate&&o.showDetailsRowInfoColumn&&i&&(a.append(r.buildTag("th.e-headercell e-detailheadercell",'<div style="width:35px;"><\/div>',{},{})),y.append(this._getIndentCol())),o.allowFiltering&&!o.isFromGantt&&o.filterSettings.filterType=="filterbar"&&(w=this._renderFiltering(t,i)),v.append(a),w&&v.append(w),b.append(y).append(v),b},_initGridRender:function(){var n=this;n._addInitTemplate();n._renderGrid();n.model.allowColumnResize&&(n._resizer=new r.gridFeatures.gridResize(n))},_summaryRow:function(){var n=this,t=n.model;t.showSummaryRow&&n._createSummaryRow();t.showTotalSummary&&(n._createTotalSummaryRow(),n._viewPortHeight=n._viewPortHeight-n._$totalSummaryRowContainer.outerHeight())},_renderGrid:function(){var n=this;n._renderGridContent().insertAfter(n.element.children(".e-gridheader"))},_renderFrozenSummary:function(){this._$footerContainer.find("#e-frozenfooterdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[0]);this._$footerContainer.find("#e-movablefooterdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[1]);this._$footerContainer.find("#e-frozenfooterdiv"+this._id+" .e-table tbody").html(n.render[this._id+"_JSONFrozenTemplate"](this._footerSummaryRecord));this._$footerContainer.find("#e-movablefooterdiv"+this._id+" .e-table tbody").html(n.render[this._id+"_Template"](this._footerSummaryRecord))},_renderSummaryByFrozenDesign:function(){var i=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),t={};return t.colgroup1=i.append(r.buildTag("colgroup").append(u.splice(0,this._frozenColumnsLength))).html(),t.colgroup2=i.html(r.buildTag("colgroup").append(u)).html(),n.templates[this._id+"_FrozenSummaryTemplate"]||this.addFrozenSummaryTemplate(),n.render[this._id+"_FrozenSummaryTemplate"](t)},_spliceSummaryRows:function(n){var i=this,r=i.model,t=[],u=n.filter(function(n){n.isSummaryRow||t.push(n)});return t},addFrozenSummaryTemplate:function(){var i="<div class='e-frozenfooterdiv' id='e-frozenfooterdiv"+this._id+"'><table class='e-table' style='width:100%' cellspacing='0' id='"+this._id+"frozensummarye-table'>{{:colgroup1}}<tbody><\/tbody><\/table><\/div><div class='e-movablefooter' id='e-movablefooter"+this._id+"'><div class='e-movablefooterdiv' id='e-movablefooterdiv"+this._id+"'><table class='e-table' id='"+this._id+"movablesummarye-table' cellspacing='0'>{{:colgroup2}}<tbody><\/tbody><\/table><\/div><\/div>",t={};t[this._id+"_FrozenSummaryTemplate"]=i;n.templates(t)},_createTotalSummaryRow:function(){var t=this,f,i=t.model,p=i.flatRecords,l=i.summaryRows,y=l.length,w=i.updatedRecords,b=i.parentRecords,a=i.columns,v=r.buildTag("tbody"),u,e,o,s,h,c;for(t._footerSummaryRecord=[],t._footerSummaryRows=[],n("#"+t._id+"-footersummaryrow").remove(),f=r.buildTag("div.e-footersummaryrowdiv#"+t._id+"-footersummaryrow","",{overflow:"hidden",cursor:"default"}),u=r.buildTag("div.e-footercontainer#e-footercontainer"+t._id,"",{overflow:"hidden"}),t._flatChildRecords=t._spliceSummaryRows(i.updatedRecords),e=1;e<=y;e++){for(o={},s=0;s<a.length;s++)o[a[s].field]="";o=t._createSummaryItem(o,l[e-1]);h=t._createRecord(o,0);h.footerSummaryRowRecord=!0;h.index=e;t._footerSummaryRecord.push(h)}t._$footerContainer=u;this._frozenColumnsLength>0?(u.html(this._renderSummaryByFrozenDesign()),this._renderFrozenSummary()):(c=r.buildTag("table.e-table#"+t._id+"summarye-table","",{top:"0px"},{cellspacing:"0px"}),c.append(t.getContentTable().find("colgroup").clone()).append(v),v.html(n.render[this._id+"_Template"](t._footerSummaryRecord)),u.append(c));t._$totalSummaryRowContainer=f;t._$footertableContent=u.find(".e-table");f.append(u);i.allowPaging?t.element.append(n("#"+this._id+"Pager").before(f)):t.element.append(f);t._flatChildRecords=[];this._setWidthToFooters();this._$totalSummaryRowContainer.outerHeight()<90?t.isVScroll()&&t._$totalSummaryRowContainer.addClass("e-scrollcss"):t._$totalSummaryRowContainer.ejScroller({height:90})},_getFooterRows:function(){var t=n();return this.model.showTotalSummary&&this._$footertableContent&&(t=this._$footertableContent.get(0).rows,this._frozenColumnsLength>0&&(t=[t,this._$footertableContent.get(1).rows])),n(t)},_setWidthToFooters:function(){var r=this._gridWidth,t,i,n;if(this._frozenColumnsLength>0){for(t=0,n=0;n<this.columnsWidthCollection.length;n++)t+=this.columnsWidthCollection[n],this._frozenColumnsLength-1==n&&(i=Math.ceil(t));this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).width(r).next().css("margin-left",i+"px");this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).outerWidth(i).end().find("#e-movablefooterdiv"+this._id).css("width","100%")}},_excludeSummaryRows:function(){var t=n(),i=this.model;return this.getTreeGridRows()&&this.getTreeGridRows().length>0&&(t=this._frozenColumnsLength>0?[n(this.getTreeGridRows()[0]).not(".e-summaryrow"),n(this.getTreeGridRows()[1]).not(".e-summaryrow")]:n(this.getTreeGridRows()).not(".e-summaryrow")),t},_createSummaryRow:function(n){var i=this,t=i.model,f,s={},c,p=t.summaryRows,w=p.length,b=t.columns,h,v,k,l,o,a,e,u,y,d;if(n&&(n.requestType=="dragAndDrop"||n.requestType=="addNewRow"||n.requestType=="sorting")){if(f=i._getParentRecords(t.updatedRecords,i),n.requestType=="dragAndDrop")for(h=0;h<f.length;h++)v=[],v=f[h].childRecords.filter(function(n){if(!n.isSummaryRow)return!0}),f[h].childRecords=v.slice()}else f=i._parentRecords;for(k=f.length,n&&r.isNullOrUndefined(n.filterCollection)&&(n.filterCollection=[]),t.enableCollapseAll&&t.enableVirtualization&&!n&&(t.updatedRecords=t.flatRecords.slice()),t.updatedRecords=i._spliceSummaryRows(t.updatedRecords),t.flatRecords=i._spliceSummaryRows(t.flatRecords),t.summaryRowRecords=[],i._flatChildRecords=[],l=0;l<k;l++)if(parentRecord=f[l],c=i._getChildRecordsLength(parentRecord,t.updatedRecords),c!=0){for(o=1;o<=w;o++){for(a=0;a<b.length;a++)s[b[a].field]="";s=i._createSummaryItem(s,p[o-1],parentRecord);e=t.updatedRecords.indexOf(parentRecord)+c+o;u=i._createRecord(s,e);i._isSummaryRow=!0;u.level=parentRecord.level+1;u.parentItem=parentRecord;u.isSummaryRow=!0;u.index=t.flatRecords.length+1;t.enableVirtualization?(t.updatedRecords.splice(e,0,u),(!n||n&&n.filterCollection)&&t.summaryRowRecords.push(t.updatedRecords[e])):(t.updatedRecords.splice(e,0,u),t.summaryRowRecords.push(t.updatedRecords[e]));e=t.flatRecords.indexOf(parentRecord)+c+o;t.flatRecords.splice(e,0,u);y=parentRecord.childRecords.filter(function(n){if(n.isSummaryRow&&u.summaryColumn.summaryType==n.summaryColumn.summaryType)return!0});y.length>0?(d=parentRecord.childRecords.indexOf(y[0]),parentRecord.childRecords.splice(d,1),parentRecord.childRecords.push(u)):parentRecord.childRecords.push(u);s={};o==w&&(u.isLastSummary=!0)}i._flatChildRecords=[]}i._isSummaryRow=!1;i._summaryRowsCount=f.length;t.enableVirtualization&&(t.updatedRecords=i.getExpandedRecords(t.updatedRecords),t.enableAltRow&&i.updateAltRow());this._updateCurrentViewData()},_getInnerParentRecords:function(n,t,i){for(var u=n.childRecords.length,r=0;r<n.childRecords.length;r++)n.childRecords[r].hasChildRecords&&(i.indexOf(n.childRecords[r])==-1&&i.push(n.childRecords[r]),t._getInnerParentRecords(n.childRecords[r],t,i))},_getParentRecords:function(n,t,i){for(var o=n.length,u,f=[],e=0;e<o;e++)u=n[e],i?r.isNullOrUndefined(u.parentItem)&&f.push(u):u.childRecords&&u.childRecords.length>0&&(t.model.enableVirtualization||t.model.allowPaging&&t.model.showSummaryRow?(f.indexOf(u)==-1&&f.push(u),t._getInnerParentRecords(u,t,f)):f.push(u));return f},_getChildRecordsLength:function(n,t){for(var r=this,f=t.length,i,u=0;u<f;u++)(i=t[u],i.summaryRow)||n==i.parentItem&&(r._flatChildRecords.push(i),i.hasChildRecords&&r._getChildRecordsLength(i,t));return r._flatChildRecords.length},_createSummaryItem:function(n,t){for(var u,f=this,c=t.summaryColumns,l=c.length,s=0;s<l;s++){var i=c[s],e=i.prefix,o=i.suffix,h=i.displayColumn;r.isNullOrUndefined(h)&&(h=i.dataMember);r.isNullOrUndefined(e)&&(e="");r.isNullOrUndefined(o)&&(o="");n.summaryColumn=i;n.summaryRow=t;for(u in n)u==h&&(n[u]=n[u]?n[u]+" "+e+f._getSummaryValues(i,f._flatChildRecords)+o:e+f._getSummaryValues(i,f._flatChildRecords)+o)}return n},_getSummaryValues:function(n,t){var f=n.dataMember,h=n.format,i=t,e,u,c,o,s;i instanceof r.DataManager?(e=i,i=i.dataSource.json):e=r.DataManager(i);switch(n.summaryType){case r.TreeGrid.SummaryType.Sum:u=r.sum(i,f);break;case r.TreeGrid.SummaryType.Average:u=r.avg(i,f);break;case r.TreeGrid.SummaryType.Maximum:o=r.max(i,f);u=parseInt(this._getCustomCellValue(o,n.dataMember));break;case r.TreeGrid.SummaryType.Minimum:c=i.filter(function(n){if(n[f]!=="")return!0});o=r.min(c,f);u=parseInt(this._getCustomCellValue(o,n.dataMember));break;case r.TreeGrid.SummaryType.MaximumDate:u=this._getMaxDate(i,f);break;case r.TreeGrid.SummaryType.MinimumDate:u=this._getMinDate(i,f);break;case r.TreeGrid.SummaryType.Count:u=i.length;break;case r.TreeGrid.SummaryType.TrueCount:s=r.Predicate(n.dataMember,"equal",!0);u=e.executeLocal(r.Query().where(s)).length;break;case r.TreeGrid.SummaryType.FalseCount:s=r.Predicate(n.dataMember,"equal",!1);u=e.executeLocal(r.Query().where(s)).length}return r.isNullOrUndefined(h)||(u=this.formatting(h,u,this.model.locale)),u},_getMaxDate:function(n,t){for(var r=0,u=null,i=0;i<n.length;i++){var f=n[i],o=new Date(f[t]),e=o.getTime();e>r&&(r=e,u=f[t])}return u},_getMinDate:function(n,t){for(var o=new Date(n[0][t]),r=o.getTime(),u=n[0][t],i=0;i<n.length;i++){var f=n[i],s=new Date(f[t]),e=s.getTime();e<r&&(r=e,u=f[t])}return u},_createAndRenderSummaryRecords:function(n){var t=this,i;t._createSummaryRow(n);i={};i.requestType=r.TreeGrid.Actions.Refresh;t.sendDataRenderingRequest(i);t.updateCollapsedRecordCount();t.updateHeight()},_updateSummaryRow:function(t){var i=this,u=i.model,h,o,y=[],f=[],c,e=i.getUpdatedRecords(),l,a,s,v;if(t&&t.requestType=="dragAndDrop"&&(t.rowIndex=e.indexOf(i._droppedRecord)),t&&t.requestType=="delete"){i._updateAfterDeleteRecord(t);return}if(t&&t.editType=="celledit"&&(t.columnObject.editType=="numericedit"&&(c=parseInt(t.value),t.value=isNaN(c)?"":c,t.data[t.columnName]=t.value),t.currentValue=t.value,l=i.getIndexByRow(t.rowElement),a=u.enableVirtualization?u.currentViewData[l]:e[l],t.rowIndex=e.indexOf(a)),t.currentValue!=t.previousValue||t.requestType=="dragAndDrop"||t.requestType=="addNewRow"){if(o=t.requestType=="addNewRow"?u.updatedRecords[t.rowIndex]:e[t.rowIndex],o.parentItem&&(f=i._getpRecords(o,i)),r.isNullOrUndefined(f))return;for(s=0;s<f.length;s++)v=u.summaryRowRecords,i._getChildRecordsLength(f[s],e),n.each(v,function(c,l){var k,p,g,d,v;if(h=l.summaryRow,l.parentItem===f[s])for(k=h.summaryColumns.length,p=0;p<k;p++){var a=h.summaryColumns[p],w=a.prefix,b=a.suffix;r.isNullOrUndefined(w)&&(w="");r.isNullOrUndefined(b)&&(b="");t.editType=="rowedit"&&(t.columnName=a.dataMember,g=u.columns,d=i.getColumnIndexByField(t.columnName),u.columns[d].editType=="numericedit"&&(o[t.columnName]=parseInt(o[t.columnName])));v=a.displayColumn;v||(v=a.dataMember);recordindex=u.enableVirtualization?u.currentViewData.indexOf(l):e.indexOf(l);columnIndex=i.getColumnIndexByField(v);t.data=l;i._frozenColumnsLength>0?i._frozenColumnsLength>columnIndex?t.rowElement=n(i.getRows()[0][recordindex]):(t.rowElement=n(i.getRows()[1][recordindex]),columnIndex-=i._frozenColumnsLength):t.rowElement=n(i.getRows()[recordindex]);t.cellElement=t.rowElement.find(".e-rowcell").eq(columnIndex);value=i._getSummaryValues(a,i._flatChildRecords);l[v]=w+value+b;t.cellElement.empty().html(w+value+b);y.push(l)}}),i._flatChildRecords=[],i._summaryRowCount=f.length}},_updateTotalSummaryRow:function(t){var f,o,b;if(t.requestType!="dragAndDrop"&&!t.isDragAndDropDelete){var i=this,l=i.model,p=l.summaryRows,a,w,e,k=p.length;if(l.updatedRecords.length==0){n("#"+i._id+"-footersummaryrow").hide();return}for(n("#"+i._id+"-footersummaryrow").show(),f=0;f<k;f++)for(summaryRow=p[f],a=summaryRow.summaryColumns,w=a.length,e=i._footerSummaryRecord[f],o=0;o<w;o++){var u=a[o],s=u.prefix,h=u.suffix;if(r.isNullOrUndefined(s)&&(s=""),r.isNullOrUndefined(h)&&(h=""),t.editType=="rowedit"&&(t.columnName=u.dataMember),c||(c=u.dataMember),u.dataMember==t.columnName||t.requestType=="delete"||t.requestType=="filtering"||t.requestType=="addNewRow"){var c=u.displayColumn,v=i._footerSummaryRecord.indexOf(e),y=i.getColumnIndexByField(c);t.data=e;this._frozenColumnsLength>0?this._frozenColumnsLength>y?t.rowElement=this._getFooterRows()[0][v]:(t.rowElement=this._getFooterRows()[1][v],y-=this._frozenColumnsLength):t.rowElement=this._getFooterRows()[v];t.cellElement=t.rowElement.childNodes[y];b=i._spliceSummaryRows(l.updatedRecords);value=i._getSummaryValues(u,b);e[c]=s+value+h;t.cellElement.innerHTML=s+value+h}}}},_updateAfterDeleteRecord:function(t){var i=this,e=i.model,o,c=[],u,f,s,h;if(deletedRecord=t.data,deletedRecord.parentItem&&(u=i._getpRecords(deletedRecord,i)),!r.isNullOrUndefined(u))for(f=0;f<u.length;f++)(s=e.summaryRowRecords,h=u[f].childRecords,h.length!=0)&&(i._getChildRecordsLength(u[f],e.updatedRecords),n.each(s,function(s,h){var b,l;if(o=h.summaryRow,h.parentItem===u[f]){for(b=o.summaryColumns.length,l=0;l<b;l++){var a=o.summaryColumns[l],k=a.displayColumn,v=e.updatedRecords.indexOf(h),w=i.getColumnIndexByField(k),y=a.prefix,p=a.suffix;r.isNullOrUndefined(y)&&(y="");r.isNullOrUndefined(p)&&(p="");t.data=h;i._frozenColumnsLength>0?i._frozenColumnsLength>w?t.tr=n(i.getRows()[0][v]):(t.tr=n(i.getRows()[1][v]),w-=i._frozenColumnsLength):t.tr=n(i.getRows()[v]);t.tr=n(i.getRows()[v]);t.cellElement=t.tr.find(".e-rowcell").eq(w);value=i._getSummaryValues(a,i._flatChildRecords);h[k]=y+value+p;t.cellElement.empty().html(y+value+p)}c.push(h)}}),i._flatChildRecords=[])},_getpRecords:function(n){var t=[];do n=n.parentItem,t.push(n);while(n.parentItem);return t},_renderGridContent:function(){var t=this,o=document,i=t.model,h=n(o.createElement("tbody")),e=r.buildTag("div.e-gridcontent#"+t._id+"e-gridcontent","",{height:t._viewPortHeight}),u=r.buildTag("div.e-gridcontainer#"+t._id+"e-gridcontainer","",{},{}),s,f;return $scrolllerContentDiv=r.buildTag("div",{},{width:"auto",height:"auto"}),$scrolllerContentDiv.append(u),(i.enableVirtualization||i.allowPaging)&&u.css({height:t._totalHeight}),this._frozenColumnsLength>0?(u.html(t._renderByFrozenDesign()),t.setGridContentTable(u.find(".e-table"))):(s=r.buildTag("table.e-table#"+t._id+"e-table","",{top:"0px",position:"relative"},{cellspacing:"0px","border-spacing":"0px"}),s.append(t.getHeaderTable().find("colgroup").clone()).append(h),u.html(s),t.setGridContentTable(s)),e.html($scrolllerContentDiv),t._$gridContent=e,this.dataSource()===null||this.model.currentViewData.length==0?this._frozenColumnsLength>0?(f=r.buildTag("td",i.emptyRecordText,{},{colSpan:this._frozenColumns.length}),u.find("#e-frozencontentdiv"+t._id+" .e-table tbody").append(n(o.createElement("tr")).append(f)),f=r.buildTag("td",i.emptyRecordText,{visibility:"hidden"},{colSpan:this._unFrozenColumns.length}),u.find("#e-movablecontentdiv"+t._id+" .e-table tbody").append(n(o.createElement("tr")).append(f))):(f=r.buildTag("td",i.emptyRecordText,{},{colSpan:i.columns.length}),h.append(n(o.createElement("tr")).append(f)),u.css("height",i.rowHeight)):t.renderRecords(),i.isFromGantt?e.css({"border-left-style":"solid","border-left-width":"1px"}):e.css({"border-bottom-style":"solid","border-bottom-width":"1px","border-left-style":"solid","border-left-width":"1px","border-right-style":"solid","border-right-width":"1px",width:"auto",height:"auto",cursor:"default"}),e},_initialEndRendering:function(){var n=this,t=n.model,e=n.getExpandedRecords(t.updatedRecords),i=n.selectedRowIndex(),r=n.selectedCellIndexes(),u,f;t.allowSelection&&(t.selectionSettings.selectionMode!="row"||i==-1||t.isFromGantt||(t.showSummaryRow&&(u=n._spliceSummaryRows(t.updatedRecords),f=u[i],i=t.updatedRecords.indexOf(f)),n._rowSelectingEventTrigger(this._previousIndex,i)||(n.selectRows(i),n._cancelSaveTools(),n._rowSelectedEventTrigger(i))),t.selectionSettings.selectionMode=="cell"&&r.length>0&&(n.selectedRowIndex(-1),n.selectCells(r),n._cancelSaveTools()));n._isRendered=!0;n._trigger("refresh");n._eventBindings();n._hideCollapsedDetailsRows()},_addCellEditTemplate:function(){for(var t=this,o=t.model,i=o.columns,n=0,u=r.buildTag("div","",{display:"none"},{id:t._id+"_CellEditTemplate"}),f,e,n=0;n<i.length;n++)i[n]&&(e=t._getFieldValue(i[n].field,n),f=r.buildTag("div","",{},{id:e+"_CellEdit"}),r.TreeGrid._initCellEditType(t,f,t._id,n),u.append(f));u.children().length&&(t._cellEditTemplate=u)},_getState:function(){return this.data.parentItem?!1:!0},_getCellIndex:function(n,t){for(var u=this,r=[],i=0;i<n.length;i++)r[i]=n[i][t];return r},_getSelectedCellClass:function(n,t){var i=this,o=i.model,u=parseInt(t),e=i._selectedCellDetails,f;return o.selectionSettings.selectionMode=="cell"&&e.length>0&&(i._getSelectedCellsinARow(n.index,e),i._selectedCellsinARow.length>0&&(f=r.browserInfo().name=="msie"&&r.browserInfo().version<9?i._getCellIndex(i._selectedCellsinARow,"cellIndex").indexOf(u):i._selectedCellsinARow.map(function(n){return n.cellIndex}).indexOf(u),f!=-1&&i._selectedCellsinARow[f].cellIndex==u))?"selectingcell":""},_getSelectedCellsinARow:function(n,t){var i=this;i._selectedCellsinARow=[];t.forEach(function(t){t.data.index==n&&i._selectedCellsinARow.push(t)});i._currentRecordIndex=n},_getrowName:function(){var n=this;return"gridrowIndex"+(n.data.index.toString()+"level"+n.data.level.toString())},_getDetailsColSpan:function(n){var i=this.model,t=[];return this._frozenColumnsLength>0?n?(t=this._frozenColumns.filter(function(n){return n.visible!==!1}),t.length):(t=this._unFrozenColumns.filter(function(n){return n.visible!==!1}),t.length):i.showDetailsRowInfoColumn?this._visibleColumns.length+1:this._visibleColumns.length},_getDetailsExpandStatus:function(n){var t=this;return t.getExpandStatus(n)&&n.isDetailsExpanded?!0:!1},_createDetailsRowTemplate:function(t){var i=this,r=this.model,f={},u,e,s,o;return f["_"+i._id+"getDetailsColSpan"]=n.proxy(i._getDetailsColSpan,i),f["_"+i._id+"getDetailsExpandStatus"]=n.proxy(i._getDetailsExpandStatus,i),f["_"+i._id+"getExpandStatus"]=n.proxy(i.getExpandStatus,i),n.views.helpers(f),u="{{if !isSummaryRow && !footerSummaryRowRecord}}<tr class='e-detailsrow e-treegridrows detailsrow{{:~_"+i._id+"rowClassName()}} {{if isDetailsExpanded}}e-detailsrowexpanded{{else}}e-detailsrowcollapsed{{/if}}{{if !~_"+i._id+"getExpandStatus(#data) && isDetailsExpanded}} collapsedrowexpandeddetailsrow{{/if}}' style='{{if ~_"+i._id+"getDetailsExpandStatus(#data)}}display:table-row;{{else}}visibility:none;{{/if}}height:"+r.detailsRowHeight+"px;'><td class='e-detailsrowcell' colspan='{{:~_"+i._id+"getDetailsColSpan("+t+")}}'><div class='e-detailscellwrapper' style='height:"+(r.detailsRowHeight-1)+"px;'>",e="",r.detailsTemplate&&r.detailsTemplate.length>0&&(e=document.getElementById(r.detailsTemplate)?"#"+r.detailsTemplate:r.detailsTemplate),t||(n("#treeGridDetailsRowTemplateElement"+i._id).remove(),s=this._createDetailRowTemplateElement(e),u+="{{:~_treeGridTemplating('"+s.id+"')}}"),u+="<\/div><\/td><\/tr>",u+="{{/if}}",t||(o={},o[i._id+"_detailRowTemplate"]=u,n.templates(o)),u},_SelectState:function(){var t=this,n=this.model;return n.allowSelection?!0:!1},_addInitTemplate:function(){var t=this,f=t.model,k=f.columns,s=0,yt=k.length,e,i,h,o={},st,a,w,nt,c,et,tt,l,ot,ht,b,ut,y,ft,rt,it,ct;if(k.length===0)return!1;if(this._frozenColumnsLength>0&&(this.addFrozenTemplate(),f.showTotalSummary&&this.addFrozenSummaryTemplate()),o["_"+t._id+"rowClassName"]=r.TreeGrid._getrowClassName,o["_"+t._id+"SummaryRowtdClassName"]=r.TreeGrid._getSummaryRowtdClassName,o["_"+t._id+"isSelectedCell"]=n.proxy(t._getSelectedCellClass,t),o["_"+t._id+"summaryTitle"]=t._getSummaryTitle,o["_"+t._id+"rowName"]=t._getrowName,o.getState=t._getState,o.SelectState=n.proxy(t._SelectState,t),o["_"+t._id+"expandStatus"]=n.proxy(t._getExpandStatusRecord,t),o["_"+t._id+"cellValue"]=n.proxy(t._getCellValue,t),o["_"+t._id+"TemplateCellValue"]=n.proxy(t._getTemplateCellValue,t),o["_"+t._id+"isTreeColumnIndex"]=n.proxy(t._isTreeColumnIndex,t),o["_"+t._id+"getIndentWidth"]=n.proxy(t._getIndentWidth,t),o["_"+t._id+"checkColumn"]=n.proxy(t._getCellColumn,t),o["_"+t._id+"formatting"]=n.proxy(t.formatting,t),o._treeGridTemplating=r.proxy(t._gridTemplate,null,t),o["_"+t._id+"getCheckboxState"]=n.proxy(t._getCheckboxState,t),o.isTrimCell=n.proxy(t._checkIsTrimCell,t),n.views.helpers(o),f.parseRowTemplate&&(f.rowTemplateID.length>0||f.altRowTemplateID.length>0)){var p=r.buildTag("tbody","",{},{}),v=r.buildTag("tbody","",{},{}),d="",g="",lt=f.altRowTemplateID.length>0?n("#"+f.altRowTemplateID):n("#"+f.rowTemplateID),at=f.rowTemplateID.length>0?n("#"+f.rowTemplateID):n("#"+f.altRowTemplateID),pt=lt[0].innerHTML,wt=at[0].innerHTML;if(n(p[0]).html(pt),n(v[0]).html(wt),v[0].childNodes.length>0)for(a=0;a<v[0].childNodes.length;a++)if(v[0].childNodes[a].nodeName=="TR"&&(v[0].className=v[0].childNodes[a].className,v[0].style.cssText=v[0].childNodes[a].style.cssText,v[0].childNodes[a].childNodes.length>0))for(w=0,nt=0;nt<v[0].childNodes[a].childNodes.length;nt++)c=v[0].childNodes[a].childNodes[nt],c.nodeName=="TD"&&(et=c.innerHTML,tt=t._id+"RowTemplateElement"+w,n("#"+tt).remove(),rt=this._createRowTemplateElement(et,tt,at[0].type),c.innerHTML="{{:~_treeGridTemplating('"+rt.id+"')}}",c.className+=" e-rowcell e-templatecell",k[w]&&(i=k[w],e=i.field,y=i.visible==u?!0:i.visible,l="",i.headerText==t._visibleColumns[0]&&(l="{{if isSummaryRow || footerSummaryRowRecord}}<div class='e-summarytitle{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='float:left;display:block;'>{{:~_"+t._id+"summaryTitle()}}<\/div>{{/if}}"),w==f.treeColumnIndex?(ot="<div class='e-inner-treecolumn-container' style='height:20px;' unselectable='on'><div class='intend' style='height:1px; float:left;width:{{:~_"+t._id+"getIndentWidth(#data)}}; display:inline-block;'>{{if !~getState() || !hasChildRecords }}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='childIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='cancelIcon e-icon' style='position:relative;float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{if ~getState() && hasChildRecords}}<div class='intendparent'><div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:left;display:none;'><\/span><span class='belowIcon e-icon' style='float:left;display:none;'><\/span><span class='childIcon e-icon' style='float:left;display:none;'><\/span><span class='cancelIcon e-icon' style='float:left;display:none;'><\/span><\/div><\/div>{{/if}}<div class='{{if expanded && hasFilteredChildRecords}}e-treegridexpand e-icon{{else hasChildRecords && hasFilteredChildRecords}}e-treegridcollapse e-icon{{/if}}' style='height:20px;width:30px;margin:auto;float:left;margin-left:10px;display:inline-block;'><\/div><div class='e-cell{{if "+(i.showCheckbox&&this.model.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox)+"}} e-treecheckboxcolumn{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='overflow: hidden;'>",d+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"'>"+ot+"{{else}}'>{{/if}}{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",d+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",d+="<\/div><\/div><\/td>"):(d+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",d+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",d+="<\/td>"),this._frozenColumnsLength>0&&this._frozenColumnsLength==w+1&&(st="",st+=d,st+="<\/tr>",d=""),w++));if(p[0].childNodes.length>0)for(a=0;a<p[0].childNodes.length;a++)if(p[0].childNodes[a].nodeName=="TR")for(p[0].className=p[0].childNodes[a].className,p[0].style.cssText=p[0].childNodes[a].style.cssText,w=0,nt=0;nt<p[0].childNodes[a].childNodes.length;nt++)c=p[0].childNodes[a].childNodes[nt],c.nodeName=="TD"&&(et=c.innerHTML,tt=t._id+"AltRowTemplateElement"+w,n("#"+tt).remove(),rt=this._createRowTemplateElement(et,tt,lt[0].type),c.innerHTML="{{:~_treeGridTemplating('"+rt.id+"')}}",c.className+=" e-rowcell e-templatecell",k[w]&&(i=k[w],e=i.field,y=i.visible==u?!0:i.visible,l="",i.headerText==t._visibleColumns[0]&&(l="{{if isSummaryRow || footerSummaryRowRecord}}<div class='e-summarytitle{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='float:left;display:block;'>{{:~_"+t._id+"summaryTitle()}}<\/div>{{/if}}"),w==f.treeColumnIndex?(ot="<div class='e-inner-treecolumn-container' style='height:20px;'><div class='intend' style='height:1px; float:left;width:{{:~_"+t._id+"getIndentWidth(#data)}}; display:inline-block;'>{{if !~getState() || !hasChildRecords }}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='childIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='cancelIcon e-icon' style='position:relative;float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{if ~getState() && hasChildRecords}}<div class='intendparent'><div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:left;display:none;'><\/span><span class='belowIcon e-icon' style='float:left;display:none;'><\/span><span class='childIcon e-icon' style='float:left;display:none;'><\/span><span class='cancelIcon e-icon' style='float:left;display:none;'><\/span><\/div><\/div>{{/if}}<div class='{{if expanded&& hasFilteredChildRecords}}e-treegridexpand e-icon{{else hasChildRecords && hasFilteredChildRecords}}e-treegridcollapse e-icon{{/if}}' style='height:20px;width:30px;margin:auto;float:left;margin-left:10px;display:inline-block;'><\/div><div class='e-cell{{if "+i.showCheckbox+"}} e-treecheckboxcolumn{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='overflow:hidden'>",g+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"'>"+ot+"{{else}}'>{{/if}}{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",g+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",g+="<\/div><\/div><\/td>"):(g+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",g+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",g+="<\/td>"),this._frozenColumnsLength>0&&this._frozenColumnsLength==w+1&&(ht="",ht+=g,ht+="<\/tr>",g=""),w++));f.showDetailsRow&&f.detailsTemplate&&f.showDetailsRowInfoColumn&&(g+="<td class='{{if isSelected && ~SelectState()}}e-selectionbackground{{/if}} {{if isDetailsExpanded}}e-detailsrowexpand{{else}}e-detailsrowcollapse{{/if}} e-detailsrowcell{{if isLastSummary}} e-lastsummaryrow{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-detailsiconcell e-icon {{if isDetailsExpanded}}e-detailsinfoiconhide{{else}}e-detailsinfoiconshow{{/if}}'><\/div>{{/if}}",d+="<td class='{{if isSelected && ~SelectState()}}e-selectionbackground{{/if}} {{if isDetailsExpanded}}e-detailsrowexpand{{else}}e-detailsrowcollapse{{/if}} e-detailsrowcell{{if isLastSummary}} e-lastsummaryrow{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-detailsiconcell e-icon {{if isDetailsExpanded}}e-detailsinfoiconhide{{else}}e-detailsinfoiconshow{{/if}}'><\/div>{{/if}}");b="{{if isAltRow}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+p[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+p[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+g+"<\/tr>{{else}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+v[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+v[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+d+"<\/tr>{{/if}}";it="{{if isAltRow}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+p[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+p[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+st+"<\/tr>{{else}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+v[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+v[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+ht+"<\/tr>{{/if}}"}else if(!f.parseRowTemplate&&(f.rowTemplateID.length>0||f.altRowTemplateID.length>0))f.rowTemplateID&&f.altRowTemplateID?b="{{if isAltRow}}"+n("#"+f.rowTemplateID).html().trim()+"{{else}}"+n("#"+f.altRowTemplateID).html().trim()+"{{/if}}":f.rowTemplateID.length>0?b=n("#"+f.rowTemplateID).html().trim():f.altRowTemplateID.length>0&&(b=n("#"+f.altRowTemplateID).html().trim());else{for(b="<tr class='e-treegridrows {{:~_"+t._id+"rowClassName()}} ",f.enableAltRow&&(b+="{{if isAltRow}}e-alt-row{{/if}} "),ut="",s=0;s<yt;s++){if(k[s]){if(e=k[s].field,i=k[s],y=k[s].visible==u?!0:k[s].visible,ft=k[s].textAlign,l="",i.headerText==t._visibleColumns[0]&&(l="{{if isSummaryRow || footerSummaryRowRecord}}<div class='e-summarytitle{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='float:left;display:block;'>{{:~_"+t._id+"summaryTitle()}}<\/div>{{/if}}"),i.isTemplateColumn){b+="e-templaterow ";var tt=i.templateID,vt=i.template,bt=i.angularTemplate;bt?(n("#"+t._id+i.headerText+s+"_Template").remove(),rt=this._createTemplateElement(i),h="<td class='{{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} e-rowcell e-templatecell{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='text-Align:"+ft+"'role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}{{:~_treeGridTemplating('"+rt.id+"')}}{{else}}"+l+"{{/if}}",h+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",h+="<\/td>"):tt?(h="<td class='{{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} e-rowcell e-templatecell{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='text-Align:"+ft+";padding-left:10px;' role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+n("#"+tt)[0].innerHTML+"{{else}}"+l+"{{/if}}",h+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",h+="<\/td>"):vt&&(h="<td class='{{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} e-rowcell e-templatecell{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='text-Align:"+ft+"';padding-left:10px; role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+vt+"{{else}}"+l+"{{/if}}",h+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",h+="<\/td>")}else s===f.treeColumnIndex?(h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground e-intend {{else}}e-rowcell {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} {{/if}} {{:~_"+t._id+"SummaryRowtdClassName()}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='padding-left:{{if ~_"+t._id+"isTreeColumnIndex('"+e+"') && isSummaryRow }}{{:((level)*"+t.treeIndentLevelWidth+")}}px{{/if}};background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-inner-treecolumn-container' style='height:20px;'>{{if hasChildRecords && hasFilteredChildRecords}}<div class='intend'style='height:1px; float:left; width:{{:((level)*"+t.treeIndentLevelWidth+")}}px; display:inline-block;'>{{if !~getState() || !hasChildRecords}}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><span class='childIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><span class='cancelIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{else !hasChildRecords || (!hasFilteredChildRecords && hasChildRecords)}}<div class='intend'style='height:1px; float:left; width:{{:(level*"+t.treeIndentLevelWidth+")+24}}px; display:inline-block;'>{{if !~getState() || !hasChildRecords}}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon iconMargin e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon iconMargin e-icon' style='float:right;display:none;'><\/span><span class='childIcon iconMargin e-icon' style='float:right;display:none;'><\/span><span class='cancelIcon iconMargin e-icon' style='float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{/if}}{{if ~getState() && hasChildRecords}}<div class='intendparent'><div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:left;display:none;'><\/span><span class='belowIcon e-icon' style='float:left;display:none;'><\/span><span class='childIcon e-icon' style='float:left;display:none;'><\/span><span class='cancelIcon e-icon' style='float:left;display:none;'><\/span><\/div><\/div>{{/if}}<div class='{{if expanded && hasFilteredChildRecords}}e-treegridexpand e-icon{{else hasChildRecords && hasFilteredChildRecords}}e-treegridcollapse e-icon{{/if}}'style='float:left;display:inline-block; font-size:10px;'><\/div><div class='e-cell{{if "+(i.showCheckbox&&this.model.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox)+"}} e-treecheckboxcolumn{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='overflow: hidden;padding-left:{{if ~_"+t._id+"isTreeColumnIndex('"+e+"') && isSummaryRow}}{{:(level*"+t.treeIndentLevelWidth+")+24}}px{{/if}};'>{{/if}}{{:~_"+t._id+"getCheckboxState(#data, '"+e+"', '"+t._checkboxColumnName+"')}}",r.isNullOrUndefined(i.format)?f.isFromGantt&&i.mappingName===f.resourceInfoMapping?(o={},o["_"+t._id+"resourceName"]=t._getResourceName,n.views.helpers(o),h+="{{:~_"+t._id+"resourceName('"+t._id+"Object','"+f.resourceNameMapping+"','"+f.resourceUnitMapping+"','"+e+"')}}<\/div><\/div><\/td>"):f.isFromGantt&&i.mappingName===f.predecessorMapping?(o={},o["_"+t._id+"predecessor"]=n.proxy(t._getPredecessorsValue,t),n.views.helpers(o),h+="{{:~_"+t._id+"predecessor(#data)}}<\/div><\/div><\/td>"):(h+="{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}"+l+"{{if !isSummaryRow && !footerSummaryRowRecord}}<\/div><\/div><\/td>{{/if}}",l=""):h+="{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}"):f.isFromGantt&&i.mappingName===f.resourceInfoMapping?(o={},o["_"+t._id+"resourceName"]=t._getResourceName,n.views.helpers(o),h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell {{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}}'style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{:~_"+t._id+"resourceName('"+t._id+"Object','"+f.resourceNameMapping+"','"+f.resourceUnitMapping+"','"+e+"')}}<\/td>"):f.isFromGantt&&i.mappingName===f.predecessorMapping?(o={},o["_"+t._id+"predecessor"]=n.proxy(t._getPredecessorsValue,t),n.views.helpers(o),h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell {{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}}' style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{:~_"+t._id+"predecessor(#data)}}<\/td>"):f.isFromGantt&&i.mappingName===f.durationMapping?(o={},o["_"+t._id+"getDurationString"]=n.proxy(t._getDurationString,t),n.views.helpers(o),h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell {{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}}' style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{:~_"+t._id+"getDurationString(#data)}}<\/td>"):i.editType=="booleanedit"&&t._checkboxSelection&&e=="checkboxState"?h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}} {{:~_"+t._id+"SummaryRowtdClassName()}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};text-Align: center;role='gridcell'>"+l+"{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"', '"+t._checkboxColumnName+"')}}":(h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}} {{:~_"+t._id+"SummaryRowtdClassName()}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};text-Align:"+ft+"'role='gridcell'>{{:~_"+t._id+"getCheckboxState(#data, '"+e+"', '"+t._checkboxColumnName+"')}}"+l,h+=r.isNullOrUndefined(i.format)?"{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}":"{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}",h+="<\/td>",l="");ut+=h}this._frozenColumnsLength>0&&this._frozenColumnsLength==s+1&&(it="",it+=ut,it+="<\/tr>",ut="")}f.showDetailsRow&&f.detailsTemplate&&f.showDetailsRowInfoColumn&&(ut+="<td class='{{if isSelected && ~SelectState()}}e-selectionbackground{{/if}} {{if isDetailsExpanded}}e-detailsrowexpand{{else}}e-detailsrowcollapse{{/if}} e-detailsrowcell{{if isLastSummary}} e-lastsummaryrow{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-detailsiconcell e-icon {{if isDetailsExpanded}}e-detailsinfoiconhide{{else}}e-detailsinfoiconshow{{/if}}'><\/div>{{/if}}");b+="{{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} 'style='background-color:{{if rowBackgroundColor }}{{:rowBackgroundColor}}{{else}}none{{/if}}; height:"+f.rowHeight+"px;display:{{:~_"+t._id+"expandStatus(#data)}}'role='row'>";it=b+it;b+=ut;b+=f.isFromGantt?"<td class='e-extendcolumn'><\/td><\/tr>":"<\/tr>"}f.showDetailsRow&&f.detailsTemplate&&(b+="{{if isDetailsExpanded}}"+t._createDetailsRowTemplate()+"{{/if}}",it+="{{if isDetailsExpanded}}"+t._createDetailsRowTemplate(!0)+"{{/if}}");ct={};ct[t._id+"_Template"]=b;ct[t._id+"_JSONFrozenTemplate"]=it;n.templates(ct)},_gridTemplate:function(n,t){return n._renderEjTemplate("#"+t,this.data,this.data.index)},_getIndentWidth:function(n){var t=n.level;return t*this.treeIndentLevelWidth+"px"},_createDetailRowTemplateElement:function(t){var u=/^#([\w-]*)/.exec(t),i={name:"SCRIPT",type:"text/x-template",text:t,id:"treeGridDetailsRowTemplateElement"+this._id};return scripEle=u&&u[1]?document.getElementById(u[1]):/^<script/i.test(t)?n(t).get(0):r.buildTag(i.name,i.text).get(0),scripEle.id=scripEle.id||i.id,scripEle.type=scripEle.type||i.type,n("body").append(scripEle),scripEle},_createRowTemplateElement:function(t,i,r){var u=document.createElement("script");return u.id=i,u.type=r||"text/x-template",u.text=t,n("body").append(u),u},_createTemplateElement:function(t,i){var u=i?"Pager":t.headerText+n.inArray(t,this.model.columns)+"_Template",r=document.createElement("script");return r.id=("treeGrid"+u).split(" ").join(""),r.type="text/x-template",r.text=n(t.angularTemplate?t.angularTemplate:t.template).html(),n("body").append(r),r},_getCheckboxState:function(n,t,i){if(t==i)return n.isSummaryRow==!0||n.summaryColumn||n.summaryRow?void 0:n.checkboxState=="indeterminate"?'<span class="e-chkbox-wrap e-widget" style="padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-indeter"><span class="e-checkbox e-chk-image e-icon e-stop" id ='+this._id+"_checkbox"+n.ejRowId+"><\/span><\/span><\/div><\/span>":n.checkboxState=="unchecked"?'<span class="e-chkbox-wrap e-widget" style="padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-inact"><span class="e-checkbox e-chk-image e-icon" id ='+this._id+"_checkbox"+n.ejRowId+"><\/span><\/span><\/div><\/span>":'<span class="e-chkbox-wrap e-widget" style="padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-act"><span class=" e-checkbox e-chk-image e-icon e-checkmark" id ='+this._id+"_checkbox"+n.ejRowId+"><\/span><\/span><\/div><\/span>"},_checkIsTrimCell:function(n){var t=this;return n&&n=="ellipsis"?!0:!1},_getCustomCellValue:function(n,t){if(!r.isNullOrUndefined(n)){var u=(t||"").split("."),i;if(u.length<=1)i=n[t];else{if(i=n[u[0]],r.isNullOrUndefined(i))return null;for(splitKeyIndex=1;splitKeyIndex<u.length;splitKeyIndex++)if(i=i[u[splitKeyIndex]],r.isNullOrUndefined(i))return null}return i}},_restoreCustomData:function(n,t,i){var s=this,e=0,o=0,i,f,u;if(r.isNullOrUndefined(i)&&(i=s._cellEditingDetails.fieldName),f=(i||"").split("."),u={},f.length<=1)r.isNullOrUndefined(n)?(n={},n[i]=t):n[i]=t;else{for(r.isNullOrUndefined(n)?(n={},u=n,o=0):(u=n[f[0]],r.isNullOrUndefined(u)&&(u={},n[f[0]]=u),o=1),e=o;e<f.length-1;e++)r.isNullOrUndefined(u[f[e]])&&(u[f[e]]={}),u=u[f[e]];u[f[e]]=t}return n},_getTemplateCellValue:function(t,i,f){var a=this,s=a.getColumnByField(i),y=s.editType,e=a._getCustomCellValue(t,i),l,h,o,p,c,v;if(e=r.isNullOrUndefined(e)?t.item&&t.item[i]:e,y==r.TreeGrid.EditingType.Boolean&&i==f?e=a._getCheckboxState(t,i,f):t.isSummaryRow||t.footerSummaryRowRecord||y!=r.TreeGrid.EditingType.Boolean||i==f||!(r.isNullOrUndefined(s.displayAsCheckbox)||s.displayAsCheckbox)||(e=e=="true"||e==!0?"<input class='e-treegrid-chekboxcell' type='checkbox' disabled='disabled' checked/>":"<input class='e-treegrid-chekboxcell' type='checkbox' disabled='disabled'/>"),i=="work"&&(e+=" "+a.model.workUnit),i=="taskMode"&&(e=!t.isAutoSchedule),i=="unit"&&(e+="%"),i=="duration"&&(e=a._getDurationString(t)),y==r.TreeGrid.EditingType.Dropdown)if(o=s.editParams,e=e!=null||e!=u?e:"",o&&o.fields?(h=o.fields.text?o.fields.text:"text",l=o.fields.value?o.fields.value:"value"):(l="value",h="text"),o&&o.showCheckbox){if(cellValueCollection=e.split(","),p=cellValueCollection.length,e="",s.dropdownData)for(c=0;c<p;c++)v=s.dropdownData,dropdownValue=n.map(v,function(n){if(r.isNullOrUndefined(n[l])){if(n[h]==cellValueCollection[c])return n[h]}else if(n[l].toString()==cellValueCollection[c].toString())return n[h]}),dropdownValue[0]=dropdownValue[0]?dropdownValue[0]:"",e+=c==0?dropdownValue[0]:","+dropdownValue[0]}else s.dropdownData&&(v=s.dropdownData,dropdownValue=n.map(v,function(n){if(r.isNullOrUndefined(n[l])){if(n[h].toString()==e)return n[h]}else if(n[l].toString()==e.toString())return n[h]}),dropdownValue[0]=r.isNullOrUndefined(dropdownValue[0])?"":dropdownValue[0],e=dropdownValue[0]);return e},_getCellValue:function(n,t){var i=this._getCustomCellValue(n,t);return i||i===0?i:n.item&&n.item[t]},_isTreeColumnIndex:function(n){var r=this,t=r.model,i=t.columns[t.treeColumnIndex];return i&&i.field==n?!0:!1},_getSummaryTitle:function(){var n=this,t=n.data.summaryRow.title;return t?t:n.data.item&&n.data.item.summaryRow.title},_getCellColumn:function(n,t){var i=this;return t.treeMappingName.indexOf(n)!==-1?n:"none"},_getResourceName:function(n,t,i,r){var h=this,u=h.data[r],f=0,e,o,c=u&&u.length,s=[];if(u&&u.length>0)for(f;f<c;f++)e=u[f][t],o=u[f][i],o!=100&&(e+="["+o+"%]"),s.push(e);return s},_getDurationString:function(n){var i="",t;return n.duration!=null&&(i+=n.duration+" "),n.durationUnit!=null&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.durationUnit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),i},_getPredecessorsValue:function(n){var e=n.predecessor,o,r,u,t,i,f;if(e)for(o=e.length,r="",u=0;u<o;u++)t=e[u],i="",t.from!=n.taskId&&(i=t.from+t.predecessorsType,t.offset!=0&&(i+=t.offset>0?"+"+t.offset+" ":t.offset+" ",f=t.offset!=1,i+=t.offsetDurationUnit=="day"?f?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:t.offsetDurationUnit=="hour"?f?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:f?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r=r.length>0?r+","+i:i);return r},_getExpandStatusRecord:function(n){var t=this;return t.getExpandStatus(n)?"table-row":"none"},_createRecords:function(n){var i=this,t=i.model,c=i.model.ids,s=t.flatRecords,e=n.length,o=0,h=!0,u,l=t.parentRecords,f;for(!t.isFromGantt&&t.enableCollapseAll&&(h=!1),t.allowPaging&&t.pageSettings.totalRecordsCount>0&&t.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(e=t.pageSettings.totalRecordsCount<e?t.pageSettings.totalRecordsCount:e),o;o<e;o++)u=i._createRecord(n[o],0,null,h),i._storedIndex++,u.isAltRow=i._storedIndex%2==0?!1:!0,l.push(u),u.index=i._storedIndex,c[i._storedIndex]=u.index,s.push(u),u.hasChildRecords&&i._parentRecords.push(u),u.childRecords&&i._addNestedRecords(u.childRecords);t.allowPaging&&t.pageSettings.totalRecordsCount>0&&t.pageSettings.pageSizeMode!==r.TreeGrid.PageSizeMode.Root&&t.pageSettings.totalRecordsCount<=s.length&&(f=t.pageSettings.totalRecordsCount,t.flatRecords=s.slice(0,f),t.flatRecords[f-1].hasChildRecords&&(t.flatRecords[f-1].hasChildRecords=!1,t.flatRecords[f-1].expanded=!1,t.flatRecords[f-1].childRecords=null,t.flatRecords[f-1].hasFilteredChildRecords=!1));i._maxRowIndex=this.model.flatRecords.length},_createRecord:function(t,i,f,e){var h=this,o,c=t[h.model.childMapping],s=this.model,a,l,v;return o=n.extend({},t),s.parentIdMapping&&h._createdAt==="load"?(a=t[s.idMapping],l=h._taskIds.indexOf(a),o.item=l>-1?h._retrivedData[l]:[]):this.dataSource()instanceof r.DataManager&&this.dataSource().dataSource.json&&this.dataSource().dataSource.offline&&h._createdAt==="load"?s.parentIdMapping?(a=t[s.idMapping],l=h._taskIds.indexOf(a),o.item=l>-1?h._retrivedData[l]:[]):o.item=t:o.item=t,o.parentItem=f,o.childRecords=c&&c.length>0&&h._createChildRecords(c,i+1,o),o.hasChildRecords=c&&c.length>0?!0:!1,s.expandStateMapping&&o.hasChildRecords?(r.isNullOrUndefined(t[s.expandStateMapping])?r.isNullOrUndefined(t[s.expandStateMapping])&&!s.enableCollapseAll?o[s.expandStateMapping]=o.item[s.expandStateMapping]=t[s.expandStateMapping]=!0:r.isNullOrUndefined(t[s.expandStateMapping])&&s.enableCollapseAll&&(o[s.expandStateMapping]=o.item[s.expandStateMapping]=t[s.expandStateMapping]=!1):o[s.expandStateMapping]=o.item[s.expandStateMapping]=t[s.expandStateMapping],v=t[s.expandStateMapping]):v=!0,o.expanded=e!==u&&c!==u&&o.hasChildRecords==!0&&v?e:v&&c?c.length>0:!1,o.dragState=!0,o.isSelected=!1,o.hasFilteredChildRecords=!0,o.level=i,o.cellBackgroundColor=null,o.rowBackgroundColor=null,o.treeMappingName=[],o.isDetailsExpanded=s.showDetailsRow&&s.detailsTemplate?s.showDetailsRowInfoColumn?!1:!0:!1,s.isFromGantt||(o.ejRowId=++h._idGenerator),o.checkboxState="unchecked",delete o[s.childMapping],o},_createChildRecords:function(n,t,i){var f=this,e=f.model,o=[],r=0,c=n.length,u=null,s,h;for(!e.isFromGantt&&e.enableCollapseAll&&(s=!1),r=0;r<c;r++)u=n[r],u&&(h=f._createRecord(u,t,i,s),o.push(h));return o},_addNestedRecords:function(n){for(var t=this,o=t.model,s=t.model.ids,h=o.flatRecords,c=o.updatedRecords,u=0,l=n.length,f=[],i,u=0;u<l;u++)if(i=n[u],t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,s[t._storedIndex]=i.index,h.push(i),c.push(i),i.hasChildRecords&&t._parentRecords.push(i),f=i.childRecords,f)for(var e=0,a=f.length,r=null,e=0;e<a;e++)r=f[e],t._storedIndex++,r.index=t._storedIndex,s[t._storedIndex]=r.index,r.isAltRow=t._storedIndex%2==0?!1:!0,h.push(r),c.push(i),r.hasChildRecords&&t._parentRecords.push(r),r.childRecords&&t._addNestedRecords(r.childRecords)},_enableColumnResizeEvents:function(){var n=this;n.model.allowColumnResize?n._on(n.element,"mousemove",n._mouseMove):n._off(n.element,"mousemove",n._mouseMove)},_wireEvents:function(){var t=this,i=t.model,u=jQuery.uaMatch(navigator.userAgent);r.isTouchDevice()?(t._on(t.element,"tap",t._onRecordClick),t._on(t.element,"tap",t._onClick)):(t._on(t.element,"click",t._onRecordClick),t._on(t.element,"click",t._onClick));t._on(t.element,"keydown",t._keyDown);t._on(t.element,"click","#"+t._id+"e-gridheader",t._onHeaderClick);t._on(t.element,"mousedown touchstart","#"+t._id+"e-gridheader",t._headerMouseDown);t._on(n(document),"mousedown touchstart",t._mouseDownHandler);t._on(t.element,"mousedown touchstart",".e-gridcontent",t._contentMouseDown);this.model.isResponsive&&this._on(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this));t.model.allowColumnResize&&t._on(t.element,"mousemove",t._mouseMove);i.filterSettings.filterBarMode=="immediate"&&(t._on(t.element,"keyup",".e-filterbarcell input",t._filterBarHandler),t._off(t.element,"click",".e-filterbarcell .e-checkbox")._on(t.element,"click",".e-filterbarcell .e-checkbox",t._filterBarHandler));t._on(t.element,"focus click",".e-filterbarcell input",t._filterBarClose);t._on(t.element,"click",".e-filterbarcell .e-cancel",t._filterBarClose);t.model.showGridCellTooltip&&!t.model.showGridExpandCellTooltip?r.browserInfo().name=="msie"?t._on(t.element,"mouseenter",".e-rowcell",t._mouseHover):t._on(t.element,"mousemove",".e-rowcell",t._mouseHover):t._on(t.element,"mouseenter",".e-rowcell",t._mouseHover);t.model.showGridCellTooltip&&(r.browserInfo().name=="msie"?t._on(t.element,"mouseenter",".e-headercelldiv",t._headermouseHover):t._on(t.element,"mousemove",".e-headercelldiv",t._headermouseHover));t._on(t.element,"mouseleave",".e-rowcell",t._cellMouseLeave);t._on(t.element,"mouseleave",t._cellMouseLeave);t._on(t.element,"mouseleave",".e-headercelldiv",t._headerMouseLeave);t._on(t.element,"mouseleave",t._headerMouseLeave);(i.isFromGantt||this._frozenColumnsLength)&&t._on(t.element,"mousewheel DOMMouseScroll",t._mouseWheel);i.enableResize&&i.isResponsive&&!i.isFromGantt&&t._on(n(window),"resize",t._windowResize);t._enableEditingEvents();i.contextMenuSettings.showContextMenu&&t._on(t.element,"keyup",this._preventContextMenu)},_preventContextMenu:function(n){return this._off(this.element,"contextmenu",this._preventContextMenu),n.keyCode==93||n.type=="contextmenu"||n.type=="taphold"?(n.preventDefault(),n.stopPropagation(),!1):void 0},_mouseDownHandler:function(t){var r=this,i=n(t.target);i.closest("div.e-columnmenuitem").length!=0||i.closest("div.e-columnMenuListDiv").length!=0||(i.hasClass("e-columnmenu-icon")||i.hasClass("e-column-filter-icon")||i.hasClass("e-column-filtered-icon"))&&n(t.target).closest("#"+r._id).length!=0||i.closest("div.e-"+r._id+"filterStringSelector").length!=0||i.closest("div#"+r._id+"filterStringDropDown_popup_list_wrapper").length!=0||i.closest("div#"+r._id+"filterStringInputBox_suggestion").length!=0||i.closest("div.e-"+r._id+"filterNumericSelector").length!=0||i.closest("div#"+r._id+"filterNumericDropDown_popup_list_wrapper").length!=0||i.closest("div.e-"+r._id+"filterDatepickerSelector").length!=0||i.closest("div#"+r._id+"filterDatepickerDropDown_popup_list_wrapper").length!=0||i.closest("div#e-"+r._id+"filterDatepickerInputBox").length!=0||i.closest("div.e-"+r._id+"filterDatetimepickerSelector").length!=0||i.closest("div#"+r._id+"filterDatetimepickerDropDown_popup_list_wrapper").length!=0||i.closest("div#"+r._id+"filterDatetimepickerInputBox_popup").length!=0||i.closest("div.e-"+r._id+"filterDropdownSelector").length!=0||i.closest("div#"+r._id+"filterDropdownDropDown_popup_list_wrapper").length!=0||i.closest("div.e-"+r._id+"filterBooleanSelector").length!=0||r._clearColumnMenu();i.closest("div.e-menuitem").length==0&&r._clearContextMenu();i.closest("div.e-detailscellwrapperfly").length==0&&r._removeDetailsRow(t)},_mouseout:function(t){var i=this,r=i.model,u,c,a=i._gridPosition,e=a.top,f=i._gridHeight,v=i._$gridHeaderContainer.height()+e,h,y,l,s;if(r.toolbarSettings.showToolbar&&(h=r.isFromGantt?i._id.replace("ejTreeGrid",""):i._id,v+=n("#"+h+"_toolbarItems").length>0?n("#"+h+"_toolbarItems").outerHeight():0),r.allowPaging&&(f=f-i.element.find(".e-pager").first().outerHeight()),r.showTotalSummary&&(f=f-i._$totalSummaryRowContainer.outerHeight()),i._dragMouseDown){if(y=a.left,l=t.pageY,i.model.isFromGantt){var h=i._id.replace("ejTreeGrid",""),o=n("#"+h).find(".e-ganttviewerbodyContianer"),p=o.ejScroller("isVScroll"),s=p?o.find(".e-content").get(0).scrollHeight-1:0;c=o.ejScroller("isHScroll")?f+e-r.rowHeight/2-18:f+e-r.rowHeight/2}else s=i.isVScroll()?i.getMaxScrollHeight()-1:0,c=i.getScrollElement().ejScroller("isHScroll")?f+e-r.rowHeight/2-18:f+e-r.rowHeight/2;topScrollPos=v+r.rowHeight/2;l>c?s>i._scrollTop?_timerDragDown||(_timerDragDown=window.setInterval(function(){s>i._scrollTop&&(u=s>i._scrollTop?i._scrollTop+20:s,i.model.isFromGantt?o.ejScroller("scrollY",u,!0):i.getScrollElement().ejScroller("scrollY",u,!0))},100)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));l<topScrollPos&&i._scrollTop!=0?i._scrollTop>0?_timerDragUp||(_timerDragUp=window.setInterval(function(){i._scrollTop>0&&(u=i._scrollTop-20,u<0&&(u=0),i.model.isFromGantt?o.ejScroller("scrollY",u,!0):i.getScrollElement().ejScroller("scrollY",u,!0))},100)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp))}},getRange:function(t,i,u){var f=this,l=f.model;roundOff=0;rowHeight=u[0].offsetHeight;s=f.getOffsetRect(n("#"+f._id)[0]);height=f._$gridHeaderContainer.height()+s.top;rowHeight+=f._detailsRowHeight;l.toolbarSettings.showToolbar&&(height+=r.isNullOrUndefined(n("#"+f._id+"_toolbarItems").height())?0:n("#"+f._id+"_toolbarItems").height());f._scrollTop!=0&&(roundOff=rowHeight-f._scrollTop%rowHeight);var e=i*rowHeight+height+roundOff+7,a=e+u[0].offsetHeight,v=a-e,o=v/3,h=e+o,c=h+o,y=c+o,s={topRowSegment:h,middleRowSegment:c,bottomRowSegment:y};return s},_childValidation:function(n){var i,u=this,f=u._draggedRecord,t=f.parentItem,r;t&&(r=t.childRecords,i=r.indexOf(this._draggedRecord),n==t&&i!=-1&&(this._childItem=!0))},_isColumnHidable:function(n){var u=this.model,t=[],i=[],r=!0;return t=this._frozenColumns.filter(function(n){return n.visible==!0}),i=this._unFrozenColumns.filter(function(n){return n.visible==!0}),t.length==1&&t[0].field==n.field&&(r=!1),i.length==1&&i[0].field==n.field&&(r=!1),r},_updateColumnMenuVisibility:function(){var u=this.model,i=[],r=[],t;u.showColumnChooser&&(i=this._frozenColumns.filter(function(n){return n.visible==!0}),r=this._unFrozenColumns.filter(function(n){return n.visible==!0}),i.length==1&&(t=n("#"+this._id+"_columnMenu_"+i[0].field.split(".").join("")).data("ejCheckBox"),t&&t.option("enabled",!1)),r.length==1&&(t=n("#"+this._id+"_columnMenu_"+r[0].field.split(".").join("")).data("ejCheckBox"),t&&t.option("enabled",!1)))},_renderToolTip:function(t,i,r,u){var f=this,a=this.model,e=[],rt=document,b,ut=f.model.columns,ft=a.dragTooltip.tooltipItems.length,o=u.closest("tr"),y=f.getIndexByRow(o),e={},v,p,s=f.getUpdatedRecords(),l,c;f._insertAbove=!1;f._insertAsChild=!1;f._insertBelow=!1;f._childItem=!1;f._currentRecord=a.currentViewData[y];b=f._draggedRecord;y!=f._draggedIndex&&(f._displayContextMenu=!1);n(".intend").find(".e-icon").css({display:"none"});n(".intendparent").find(".e-icon").css({display:"none"});n(".e-error").css({display:"none"});n(".e-treegridexpand").css({display:"inline-block"});n(".e-treegridcollapse").css({display:"inline-block"});a.rowTemplateID?(v=s,l=s.indexOf(f._currentRecord)):(v=f.getExpandedRecords(s),f.getVisibleRange(),currentViewData=v.slice(f._visibleRange.top,f._visibleRange.bottom),f._scrollTop!=0?(p=s.indexOf(f._draggedRecord)-1,l=currentViewData.indexOf(f._currentRecord)-1):(p=s.indexOf(f._draggedRecord),l=currentViewData.indexOf(f._currentRecord)));var w=s.indexOf(f._currentRecord),k=f._currentRecord&&f._checkPrevNextRecord(f._draggedRecord,w,f._currentRecord.level,"next"),d=f._currentRecord&&f._checkPrevNextRecord(f._draggedRecord,w,f._currentRecord.level,"prev"),g=f._gridPosition.left,h=t.pageY;f._currentRecord&&(e=f.getRange(f._currentRecord,l,o));var nt=h<=e.topRowSegment,tt=h>e.topRowSegment&&h<=e.middleRowSegment,it=h>e.middleRowSegment&&h<=e.bottomRowSegment;f._currentRecord&&(f.data=f._currentRecord,c=this._getrowName(),f._childValidation(f._currentRecord),f._currentRecord.parentItem?f._currentRecord.hasChildRecords&&(f._currentRecord.expanded?o.find(".e-treegridexpand").css({display:"inline-block"}):o.find(".e-treegridcollapse").css({display:"inline-block"})):f._currentRecord.hasChildRecords&&(f._currentRecord.expanded?o.find(".e-treegridexpand").css({display:"none"}):o.find(".e-treegridcollapse").css({display:"none"})),f._currentRecord.dragState==!0&&r.canDrop!=!1?nt&&!d?(n(f.element).find("."+c).find(".aboveIcon").css({display:"block"}),f._insertAbove=!0):tt&&f._childItem==!1?(n(f.element).find("."+c).find(".childIcon").css({display:"block"}),f._insertAsChild=!0):it&&!k&&(n(f.element).find("."+c).find(".belowIcon").css({display:"block"}),f._insertBelow=!0):(n(f.element).find("."+c).find(".cancelIcon").css({display:"block"}),f.cancelDrop=!0));n(f._dragmouseOverTooltip).css({top:h+20+"px",left:g+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"})},_checkPrevNextRecord:function(n,t,i,r){var f=this,o=f.model,u=f.getUpdatedRecords(),e=t;for(r=="next"?t++:t--;u[t];){if(u[t].level==i)return u[t]==n&&n.parentItem==u[e].parentItem?!0:!1;r=="next"?t++:t--}return!1},_createDragTooltipTemplate:function(){var t=this,r=t.model.dragTooltip.tooltipTemplate,u,f,i;r&&(f=r.charAt(0),u=f=="#"?n(t.model.dragTooltip.tooltipTemplate)[0].innerHTML:t.model.dragTooltip.tooltipTemplate);i={};i[t._id+"dragtooltipTemplate"]=u;n.templates(i)},_updateDragStateFalse:function(n,t){var i,f=this,u,r;if(n.dragState=!1,n.hasChildRecords)for(u=n.childRecords.length,r=0;r<u;r++)i=n.childRecords[r],i.dragState=!1,i.hasChildRecords&&(t=f._updateDragStateFalse(i,t));return},_updateDragStateTrue:function(n,t){var i,e=this,f,u;if(!r.isNullOrUndefined(n)&&(n.dragState=!0,n.hasChildRecords))for(f=n.childRecords.length,u=0;u<f;u++)i=n.childRecords[u],i.dragState=!0,i.hasChildRecords&&(t=e._updateDragStateTrue(i,t));return},_getCoordinate:function(n){var t=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"||n.type=="tap")&&(t=n.originalEvent.changedTouches[0]),t},_getElementByPosition:function(t,i){return n(document.elementFromPoint(t-window.pageXOffset,i-window.pageYOffset))},dragRecord:function(t){var g,it,k,a,s,y,e,nt,tt,d,h;if(t.ctrlKey||t.shiftKey||t.which==2||t.which==3)return!0;var i=this,o=i.model,l,c={},p=i._getCoordinate(t),v=n(t.target),f=v.closest("tr");if(updatedRecords=i.getUpdatedRecords(),window.clearTimeout(this._dragTooltipTimer),this._dragTooltipTimer=null,!i._mouseDown)return!0;if(!f.hasClass("e-editedrow")&&i.editFormValidate()){if(o.selectionSettings.selectionMode=="cell"&&i.clearSelection(),i._clearColumnMenu(),i._removeDetailsRow(),i._saveCellHandler(t),i._posx=p.pageX,i._posy=p.pageY,v.hasClass("e-summaryrowcell")||v.hasClass("e-footersummaryrowcell")||v.hasClass("e-summarytitle"))return;o.enableVirtualization?(i._currentIndex=i.getIndexByRow(f),record=o.currentViewData[i._currentIndex],i._currentIndex=updatedRecords.indexOf(record)):i._currentIndex=i.getIndexByRow(f);i._draggedIndex=l=i.getIndexByRow(f);i._draggedRecord=i.model.currentViewData[l];c.draggedRowIndex=l;c.draggedRow=i._draggedRecord;i._trigger("rowDragStart",c);c.draggedRow&&c.draggedRow.isSummaryRow&&(c.cancel=!0);i._gridPosition=i.getOffsetRect(n("#"+i._id)[0]);i._frozenColumnsLength>0&&l!=-1&&(it=f.index(),g=f.closest(".e-movablecontentdiv").length>0?n(i._gridRows[0])[l]:n(i._gridRows[1])[l],f=f.add(g));var w=i._gridPosition.left,b=p.pageY,rt=i._$gridContainer[0].scrollWidth,u=f.clone();if(u.find(".e-hide").remove(),k=o.dragTooltip.tooltipItems.length,a=r.buildTag("table","",{padding:"1",width:"100%","border-collapse":"collapse"},{cellspacing:"1"}),i.model.dragTooltip.showTooltip&&i._dragTooltip==!1)if(i.model.dragTooltip.tooltipTemplate||i.model.dragTooltip.tooltipItems.length!=0)if(k!=0){for(s=o.columns,h=r.buildTag("tbody","",{},{}),tooltiptr=r.buildTag("tr.e-dragtooltipbackground","",{},{}),y=0;y<k;y++)for(e=0;e<s.length;e++)if(s[e].visible!=!1&&(columnTooltipValue=o.isFromGantt?s[e].mappingName:s[e].field,o.dragTooltip.tooltipItems[y]==columnTooltipValue)){nt=columnTooltipValue.split(".");tt=nt.length;d=tt==1?r.isNullOrUndefined(i._draggedRecord.item[s[e].field])?!1:i._draggedRecord.item[s[e].field].toString():i._getCustomCellValue(i._draggedRecord,s[e].field);d&&($td=r.buildTag("td.e-dragrowcell",d.toString(),{padding:"5px",width:i.columnsWidthCollection[e],height:o.rowHeight},{}),tooltiptr.append($td));tooltiptr.append($td);break}h.append(tooltiptr);a.append(h);i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltiptreegrid"+i._id+"",a,{top:b+20+"px",left:w+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"},{});n(i._dragmouseOverTooltip).addClass("e-dragtooltipbackground").addClass("e-dragrowcell");i._dragTooltip=!0}else i.model.dragTooltip.tooltipTemplate&&(i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltiptreegrid"+i._id+"","",{top:b+20+"px",left:w+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"},{}),i.tooltipState="TemplateID",h=r.buildTag("tbody",n.render[i._id+"dragtooltipTemplate"](i._draggedRecord),{},{}),i._dragmouseOverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",i._dragTooltip=!0);else h=r.buildTag("tbody","",{},{}),u.find(".e-treegridexpand").css({display:"none"}),u.find("td.e-detailsrowcell").css({display:"none"}),u.find(".e-treegridcollapse").css({display:"none"}),n(u.find(".intend")).css({width:0}),u.find(".e-intend").removeClass("e-intend"),u.find(".e-rowcell ").removeClass("e-rowcell ").addClass("e-dragrowcell"),u.addClass("e-dragtooltipbackground"),o.isFromGantt&&u.find("td:last").remove(),u.length==2&&this._frozenColumnsLength>0&&(n(u[0]).append(n(u[1].childNodes)),u.splice(1,1)),h.append(u),a.append(h),i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltiptreegrid"+i._id+"",a,{top:b+20+"px",left:w+15+"px",position:"absolute","z-index":"5",padding:"0","border-radius":"3px","border-right":"0","border-bottom":"0",width:rt},{}),n(i._dragmouseOverTooltip).addClass("e-dragtooltipbackground").addClass("e-dragrowcell"),i._dragTooltip=!0;i._draggedRecord&&(i._draggedElement=f,i._updateDragStateFalse(i._draggedRecord),i._dragMouseDown=!0,t.type=="touchstart"?(n(document.body).append(i._dragmouseOverTooltip),i._off(i.element,"touchmove","#"+i._id+"e-gridcontent",i._touchScroll),i._on(i.element,"touchmove",".e-treegridrows, .e-templatecell",i.dragToolTip)):(i._off(i.element,"mousemove","#"+i._id+"e-gridcontent",i._touchScroll),i._on(i.element,"mousemove",".e-treegridrows, .e-templatecell",i.dragToolTip)));c.cancel&&(i._dragMouseDown=!1,i._updateDragStateTrue(i._draggedRecord),i._dragTooltip=!1,i._dragmouseOverTooltip&&i._dragmouseOverTooltip.remove(),i._dragmouseOverTooltip=null,t.type=="touchstart"?i._off(i.element,"touchmove",".e-treegridrows, .e-templatecell",i.dragToolTip):i._off(i.element,"mousemove",".e-treegridrows, .e-templatecell",i.dragToolTip))}},dragToolTip:function(t){var i=this,y=i.model,u={},h,c,s,e,o,f=i._getCoordinate(t),l,a,v;(t.preventDefault(),l=Math.abs(f.pageX-i._posx),a=Math.abs(f.pageY-i._posy),r.isNullOrUndefined(i._posx)||r.isNullOrUndefined(i._posy)||l<10&&a<10)||i._dragMouseDown==!0&&i.model.allowDragAndDrop==!0&&(t.type=="touchmove"?e=i._getElementByPosition(f.pageX,f.pageY):(e=n(t.target),n(document.body).append(i._dragmouseOverTooltip)),o=e.closest("tr"),h=i.getIndexByRow(o),v=i.getUpdatedRecords(),h!=-1?(c=i.model.currentViewData[h],o=r.TreeGrid.getRowByIndex(i,i._currentIndex),s=o.clone(),s.find(".e-hide").remove(),i._dragTargetItem=c,u.targetRowIndex=h,u.targetRow=c,u.canDrop=!0,u.draggedRow=i._draggedRecord,u.draggedRowIndex=v.indexOf(i._draggedRecord),i._trigger("rowDrag",u),i._renderToolTip(f,s,u,e),u.targetRow&&u.targetRow.isSummaryRow?(i._draggedRecord.canDrop=!1,n(".intend").find(".e-icon").css({display:"none"}),n(".intendparent").find(".e-icon").css({display:"none"})):i._draggedRecord.canDrop=u.canDrop==!1?!1:!0):i._draggedRecord&&i._dragMouseDown&&(c=null,o=r.TreeGrid.getRowByIndex(i,i._currentIndex),s=o.clone(),$tr_summary=e.closest("tr"),u.targetRowIndex=null,u.targetRow=null,i._dragTargetItem=null,u.canDrop=!0,u.draggedRow=i._draggedRecord,u.draggedRowIndex=i._draggedRecord.index,i._trigger("rowDrag",u),$tr_summary.hasClass("e-footersummaryrow")||i._renderToolTip(f,s,u,e)),i._mouseout(f))},_mouseupHandler:function(t){var i=this,r=i.model;t.type=="touchstart"?i._off(i.element,"touchmove","#"+i._id+"e-gridcontent",i._touchScroll):i._off(i.element,"mousemove","#"+i._id+"e-gridcontent",i._touchScroll);i._off(n(document),"mouseup touchend",i._mouseupHandler);i._mouseDown=!1;i._isTouchEvent=!1;window.clearTimeout(i._dragTooltipTimer);r.allowDragAndDrop&&i._dragMouseDown&&i.dragMouseUp(t);r.contextMenuSettings.showContextMenu&&i._contextMenuHandler&&i._displayContextMenu?i._rightClick(t):i._contextMenuHandler=!1;i._displayContextMenu=!0;i._dy=i._dx=0},dragMouseUp:function(t){var v=0,o={},h={},u=this,e=u.model,k,l,f=u._draggedRecord,ct=u._currentRecord,nt,ft=e.selectedItems.length,y,tt=u._getCoordinate(t),p,d,a,c,et,s,b,g,w,it,rt;if(_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)),_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)),e.allowDragAndDrop&&(t.type=="touchstart"?u._off(u.element,"touchmove",".e-treegridrows, .e-templatecell",u.dragToolTip):u._off(u.element,"mousemove",".e-treegridrows, .e-templatecell",u.dragToolTip),nt=r.isNullOrUndefined(f)?!0:f.canDrop),window.clearTimeout(u._dragTooltipTimer),u._dragMouseDown=!1,n(u._dragmouseOverTooltip).remove(),u._dragTooltip=!1,k=t.type=="touchend"?u._getElementByPosition(tt.pageX,tt.pageY):n(t.target),l=k.closest("tr"),n(".intend").find(".e-icon").css({display:"none"}),n(".intendparent").find(".e-icon").css({display:"none"}),p=e.currentViewData[u.getIndexByRow(l)],this.cancelDrop!=!0||r.isNullOrUndefined(p)||p.parentItem!=null||(d=r.TreeGrid.getRowByIndex(this,e.updatedRecords.indexOf(p)),p.expanded?d.find(".e-treegridexpand").css({display:"inline-block"}):d.find(".e-treegridcollapse").css({display:"inline-block"})),u._dragMouseLeave=!0,k.closest("div#"+u._id).length!=1||r.isNullOrUndefined(f)||u._dropCancel!=!1)u._updateDragStateTrue(f);else if(e.allowDragAndDrop&&nt)if(u._dragMouseLeave=!1,a=u.getIndexByRow(l),a!=u._currentIndex&&a!=-1)if(u._droppedRecord=e.currentViewData[a],droppedRecord=u._droppedRecord,c=e.flatRecords,o.previousParentItem=f.parentItem,r.isNullOrUndefined(f.parentItem)||(o.parentChildState=f.parentItem.hasChildRecords,o.parentExpandedState=f.parentItem.expanded),h.targetRow=n.extend({},u._droppedRecord),h.targetRow.item=n.extend({},u._droppedRecord.item),h.targetRowIndex=e.updatedRecords.indexOf(droppedRecord),h.draggedRow=n.extend({},u._draggedRecord),h.draggedRow.item=n.extend({},u._draggedRecord.item),h.draggedRowIndex=e.updatedRecords.indexOf(f),o.previousItem=h.draggedRow,o.previousItemIndex=c.indexOf(u._draggedRecord),o.previousTarget=u._droppedRecord,o.previousTargetItemIndex=c.indexOf(u._droppedRecord),o.clonedTarget=n.extend({},u._droppedRecord),o.hasChildRecords=droppedRecord.hasChildRecords,o.expanded=droppedRecord.expanded,o.childIndex=o.previousParentItem?o.previousParentItem.childRecords.indexOf(f):0,o.previousLevel=f.level,et=[],droppedRecord.dragState==!0){if(u._updateDragStateTrue(f),u._insertAbove==!0||u._insertBelow==!0||u._insertAsChild==!0){for(u.model.isEdit||u._isRowEdit||u._cancelSaveTools(),i=0;i<ft;i++)u.clearSelection(e.selectedItems[i]);u._deleteDragRow();s=c.indexOf(droppedRecord);u._checkboxSelection&&e.selectionSettings.enableHierarchySelection&&f.parentItem&&u._updateParentSelection(f.parentItem);u._insertAbove==!0?(y="insertAbove",o.index=s,f.parentItem=c[s].parentItem,f.level=c[s].level,c.splice(s,0,f),e.updatedRecords.splice(s,0,f),e.isFromGantt&&e.ids.splice(s,0,f.taskId.toString()),f.hasChildRecords&&(b=1,u._updateChildRecord(f,s),u._updateChildRecordLevel(f,b)),droppedRecord.parentItem&&droppedRecord.parentItem.childRecords.splice(droppedRecord.parentItem.childRecords.indexOf(droppedRecord),0,f)):u._insertBelow==!0?(y="insertBelow",o.index=s+1,droppedRecord.hasChildRecords?(v=u.getChildCount(droppedRecord,0),c.splice(s+v+1,0,f),e.updatedRecords.splice(s+v+1,0,f),e.isFromGantt&&e.ids.splice(s+v+1,0,f.taskId.toString())):(c.splice(s+1,0,f),e.updatedRecords.splice(s+1,0,f),e.isFromGantt&&e.ids.splice(s+1,0,f.taskId.toString())),f.parentItem=c[s].parentItem,f.level=c[s].level,f.hasChildRecords&&(b=1,u._updateChildRecordLevel(f,b),u._updateChildRecord(f,s+v+1)),droppedRecord.parentItem&&droppedRecord.parentItem.childRecords.splice(droppedRecord.parentItem.childRecords.indexOf(droppedRecord)+1,0,f)):u._insertAsChild==!0&&(y="insertAsChild",o.index=s+1,f.hasChildRecords?(c.splice(s+1,0,f),e.updatedRecords.splice(s+1,0,f),e.isFromGantt&&e.ids.splice(s+1,0,f.taskId.toString()),u._recordLevel(a),u._updateChildRecord(f,s+1,droppedRecord.expanded)):(c.splice(s+1,0,f),e.updatedRecords.splice(s+1,0,f),e.isFromGantt&&e.ids.splice(s+1,0,f.taskId.toString()),u._recordLevel(a)))}if(u._checkboxSelection&&e.selectionSettings.enableHierarchySelection&&(f.parentItem&&u._updateParentSelection(f.parentItem),u.selectAllRows()),f.parentItem==null&&(g=e.parentRecords.indexOf(u._droppedRecord),u._insertBelow==!0?e.parentRecords.splice(g+1,0,f):u._insertAbove==!0&&e.parentRecords.splice(g,0,f)),o.requestType="dragAndDrop",o.draggedRow=f,o.targetRow=droppedRecord,o.droppedPosition=y,u._updateDataSource(),e.showSummaryRow&&u._insertAsChild==!0&&u._createSummaryRow(o),u.processBindings(o),h.draggedRow=o.draggedRow,h.draggedRow.item=o.draggedRow.item,h.draggedRowIndex=e.updatedRecords.indexOf(f),h.requestType=y,u._trigger("rowDragStop",h),e.enableAltRow&&e.currentViewData.length>0&&r.TreeGrid.updateAltRow(u,u.model.currentViewData[0],0,0),h.cancel&&u._revertDragging(o),e.enableWBS&&!h.cancel){f.parentItem?w=f.parentItem.childRecords:(it=e.flatRecords,rt=it.filter(function(n){return n&&n.level==0}),w=rt);var ut=w.indexOf(f),ot=w.slice(ut,w.length),st=f.parentItem?f.parentItem.WBS:null,ht=ut+1;u.reCalculateWBS(ot,ht,st)}e.allowSelection&&(e.selectionSettings.selectionMode=="row"&&u._selectDraggedRow(l),e.selectionSettings.selectionMode=="cell"&&u.updateScrollBar(e.updatedRecords.indexOf(u._draggedRecord)))}else u._updateDragStateTrue(f);else u._updateDragStateTrue(f),u.model.isEdit||u._isRowEdit||u._cancelSaveTools();else return u._updateDragStateTrue(f),u._resetPrivateProperties(),0;r.isNullOrUndefined(u._currentRecord)||u._currentRecord.parentItem==null&&(l=r.TreeGrid.getRowByIndex(u,e.updatedRecords.indexOf(u._currentRecord)),u._currentRecord.expanded?l.find(".e-treegridexpand").css({display:"inline-block"}):l.find(".e-treegridcollapse").css({display:"inline-block"}));e.showSummaryRow&&o.requestType=="dragAndDrop"&&u._insertAsChild!=!0&&u._updateSummaryRow(o);u._dropCancel=!1;u._resetPrivateProperties();r.isNullOrUndefined(f)||u.model.isEdit||u._isRowEdit||u._cancelSaveTools()},dragColumn:function(t){var u=n(t.target),i=this,s=i._getCoordinate(t),e;if(i._posx=s.pageX,i._posy=s.pageY,t.ctrlKey||t.shiftKey||t.which==2||t.which==3)return!0;var o=i.model,c=o.columns,h,f={};if(u.css("cursor")!="col-resize"&&u.closest(".e-headercelldiv")&&!u.hasClass("e-columnmenu-icon")){if(e=u.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),r.isNullOrUndefined(e)&&r.isNullOrUndefined(this.getColumnByField(e)))return;if(this.editFormValidate()&&(o.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),u.hasClass("e-checkbox"))return!1;if(i._draggedColumn=this.getColumnByField(e),h=c.indexOf(i._draggedColumn),f.draggedColumnIndex=h,f.draggedColumn=i._draggedColumn,f.requestType="columnDragStart",i._draggedColumnTemplate=r.isNullOrUndefined(i._draggedColumn.headerTemplateID)?null:u.closest(".e-headertemplate"),!r.isNullOrUndefined(i._draggedColumn.nonColumn))return;if(i._trigger("columnDragStart",f),f.cancel)return;o.selectionSettings.selectionMode=="cell"&&i.clearSelection();i._headerDragStatus="mousedown";i._dragMouseDown=!0;i._mouseDragged=!1;gridPos=i.getOffsetRect(i.element[0]);i._gridLeft=gridPos.left;i._touchstart=!0;t.type!="touchstart"&&i._on(i.element,"mousemove touchmove",i.dragColumnToolTip)}},dragColumnToolTip:function(t){var i=this,a=i.model,u={},v,w=a.columns,f={},s=i._getCoordinate(t),h=s.pageX,c=s.pageY,e,l,y,o,p;if(i._touchstart){i._touchstart=!1;return}if(t.type=="touchmove"?(t.preventDefault(),v=i._getElementByPosition(s.pageX,s.pageY)):v=n(t.target),i._headerDragStatus.length>0&&a.allowColumnReordering==!0)if(a.selectionSettings.selectionMode=="cell"&&i._headerDragStatus!="mousemove"&&i.clearSelection(),e=v.closest(".e-headercell"),l=e.find(".e-headercelldiv").attr("ej-mappingname"),r.isNullOrUndefined(l)||r.isNullOrUndefined(this.getColumnByField(l)))r.isNullOrUndefined(i._dragmouseOverTooltip)||n(i._dragmouseOverTooltip).css({top:c+"px",left:h-i._dragmouseOverTooltip.width/2+"px"});else{if(y=this.getColumnByField(l),i._currentIndex=w.indexOf(y),u.targetColumnIndex=i._currentIndex,u.draggedColumnIndex=w.indexOf(i._draggedColumn),u.draggedColumn=i._draggedColumn,u.targetColumn=y,u.requestType="columnDrag",u.canDrop=!0,i._trigger("columnDrag",u),u.cancel)return;f.pos=i.getOffsetRect(e[0]);f.height=n(e).height();f.width=n(e).outerWidth();f.pos.top=i.getOffsetRect(e.closest(".e-gridheader")[0]).top;f.pos.left=u.draggedColumnIndex>u.targetColumnIndex?f.pos.left-2:f.pos.left+f.width-2;f.display="block";u.column=f;u.direction=u.draggedColumnIndex>u.targetColumnIndex?"left":"right";i._autoHscroll(h,c,u);(u.draggedColumnIndex==u.targetColumnIndex||!r.isNullOrUndefined(u.targetColumn.nonColumn)||f.pos.left-8>i._gridWidth+i._gridLeft)&&(f.display="none");i._headerDragStatus=="mousemove"||i._dragTooltip?(n(i._reordervline).css({height:i._reordervline.height,width:0,"border-width":0,position:"absolute",top:f.pos.top+"px",left:f.pos.left+"px","border-left-width":"3px","border-style":"solid",display:f.display}),n(i._dragmouseOverTooltip).css({top:c+"px",left:h-i._dragmouseOverTooltip.width/2+"px"})):(o=i._gridHeight-1,i.model.toolbarSettings.showToolbar&&(o-=r.isNullOrUndefined(n("#"+i._id+"_toolbarItems").outerHeight())?0:n("#"+i._id+"_toolbarItems").outerHeight()),o-=i.getScrollElement().ejScroller("isHScroll")?18:0,p=r.buildTag("div",i._draggedColumn.headerText,{"margin-top":"5px"}),r.isNullOrUndefined(i._draggedColumnTemplate)||r.isNullOrUndefined(i._draggedColumn)||r.isNullOrUndefined(i._draggedColumn.headerTemplateID)||(p[0].innerHTML=i._draggedColumnTemplate[0].innerHTML),i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#columnreordertooltip"+i._id+"",p,{top:c+"px",left:h-57+"px",position:"absolute","z-index":i.getMaxZIndex()+1},{}),i._reordervline=r.buildTag("div.e-vline#reorderline"+i._id+"",{height:o,width:0,"border-width":0,position:"absolute",top:f.pos.top+"px",left:f.pos.left+"px","border-left-width":"3px","border-style":"solid",display:f.display}),n(document.body).append(i._dragmouseOverTooltip),n(document.body).append(i._reordervline),n(i._dragmouseOverTooltip).addClass("e-headertooltip"),n(i._reordervline).addClass("e-headervline"),i._dragmouseOverTooltip.width=n(i._dragmouseOverTooltip).outerWidth(),i._reordervline.height=o,i._dragTooltip=!0);i._headerDragStatus="mousemove"}},reorderColumn:function(n,t){var i=this,o=i.model,f=o.columns,r,u,s,h,c,e;if(c=f[o.treeColumnIndex],r=i.getColumnByField(n),u=f.indexOf(r),h=i.columnsWidthCollection[u],s=f[t],!s||!s.nonColumn){if(i._frozenColumnsLength>0)if(e=this._getFrozenColumnWidth(),i._frozenColumnsLength<=u&&i._frozenColumnsLength>t&&i._frozenColumns.indexOf(r)==-1){if(e=e+(this.columnsWidthCollection[u]+18),e>this._gridWidth)return!1;r.isFrozen=!0;i._frozenColumns.splice(t,0,r)}else i._frozenColumnsLength>u&&i._frozenColumnsLength<=t&&i._frozenColumns.indexOf(r)!=-1&&(r.isFrozen=!1,i._frozenColumns.splice(u,1),i._checkboxSelection&&i._frozenColumns.length==1&&i._frozenColumns[0].nonColumn&&(i._frozenColumns[0].isFrozen=!1,i._frozenColumns.splice(0,1)));f.splice(u,1);i.columnsWidthCollection.splice(u,1);f.splice(t,0,r);i.columnsWidthCollection.splice(t,0,h);o.treeColumnIndex=f.indexOf(c);i._refreshFrozenColumns()}},_autoHscroll:function(n){var t=this,o=t.model,r,u,s=o.columns,i=0,h=t.columnsWidthCollection,f,e;gridContent=t.getScrollElement();u=gridContent.ejScroller("isHScroll");r=u?gridContent.find(".e-content").get(0).scrollWidth:0;t._viewPortWidth=gridContent.find(".e-content").width();t._frozenColumnsLength>0&&(i=this._getFrozenColumnWidth());f=Math.round((t._gridLeft+t._gridWidth)/10)+18;e=Math.round(t._gridLeft/10)+18;t._gridLeft+t._gridWidth-f<n?_timerDragDown||(_timerDragDown=window.setInterval(function(){r>t._scrollLeft+t._viewPortWidth&&(topvalue=t._scrollLeft,topvalue=topvalue+50,t.getScrollElement().ejScroller("scrollX",topvalue,!0))},300)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));n<t._gridLeft+i+e&&n>t._gridLeft+i&&t._scrollLeft!=0?t._scrollLeft>0?_timerDragUp||(_timerDragUp=window.setInterval(function(){t._scrollLeft>0&&(topvalue=t._scrollLeft,topvalue=topvalue-50,topvalue<0&&(topvalue=0),t.getScrollElement().ejScroller("scrollX",topvalue,!0))},300)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp))},_resetPrivateProperties:function(){_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp));var t=this,i=t.model;t.cancelDrop=!1;t._draggedRecord=null;t._dragMouseDown=!1;_timerDragDown=null;_timerDragUp=null;t._childItem=!1;t._dragMouseLeave=!1;t._currentRecord=null;t._currentIndex=null;t._droppedRecord=null;t._insertAsChild=!1;t._insertAbove=!1;t._insertBelow=!1;i.allowDragAndDrop&&i.enableVirtualization&&(r.browserInfo().name=="chrome"||r.isTouchDevice())&&(t._dummyElement&&n(t._draggedElement).remove(),t._dummyElement=!1,t._draggedElement=null);t._dragTooltipTimer=null;t._dragColumnTooltipTimer=null;t._dragmouseOverTooltip=null},_selectDraggedRow:function(){var n=this,t=n.model,i=n.getUpdatedRecords();rowIndex=i.indexOf(n._draggedRecord);n._focusTreeGridElement();t.allowSelection&&!n._rowSelectingEventTrigger(this.selectedRowIndex(),rowIndex)&&(n.selectRows(rowIndex),n._rowSelectedEventTrigger(rowIndex))},_addChildItem:function(n){for(var t,i=this,f=0,f=n.childRecords.length,u=0;u<f;u++)t=n.childRecords[u],i.dataSource()instanceof r.DataManager?i.dataSource().dataSource.offline&&i.dataSource().dataSource.json&&(i.dataSource().dataSource.json.push(t.item),t.hasChildRecords&&i._addChildItem(t)):(i.dataSource().push(t.item),t.hasChildRecords&&i._addChildItem(t))},_updateDataSource:function(){var n=this,i=n.model,t=n._draggedRecord,u=n._droppedRecord,f,e,o;n.dataSource()instanceof r.DataManager?n.dataSource().dataSource.offline&&n.dataSource().dataSource.json&&(f=n.dataSource().dataSource.json):f=n.dataSource();f&&!u.parentItem?(e=f.indexOf(u.item),n._insertAbove?i.parentIdMapping||f.splice(e,0,t.item):n._insertBelow&&(i.parentIdMapping||f.splice(e+1,0,t.item))):!i.parentIdMapping&&u.parentItem&&(o=u.parentItem.childRecords.indexOf(t),n._insertAbove?u.parentItem.item[n.model.childMapping].splice(o,0,t.item):n._insertBelow&&u.parentItem.item[n.model.childMapping].splice(o,0,t.item));i.parentIdMapping&&(t.parentItem?n._insertAbove||n._insertBelow?i.isFromGantt==!0?t.item[i.parentIdMapping]=u.item[n.model.parentIdMapping]:(t[i.parentIdMapping]=u[n.model.parentIdMapping],t.item[i.parentIdMapping]=u[n.model.parentIdMapping]):i.isFromGantt==!0?t.item[i.parentIdMapping]=u.item[n.model.idMapping]:(t[i.parentIdMapping]=u[n.model.idMapping],t.item[i.parentIdMapping]=u[n.model.idMapping]):(t.item[i.parentIdMapping]=null,t[i.parentIdMapping]=null),n.dataSource()instanceof r.DataManager?n.dataSource().dataSource.offline&&n.dataSource().dataSource.json&&n.dataSource().dataSource.json.push(t.item):((n._insertAbove||n._insertBelow||n._insertAsChild)&&n.dataSource().push(t.item),t.hasChildRecords&&n._addChildItem(t)))},_deleteDragRow:function(n){var t=this,o=t.model,c,i,f={},l=t.getUpdatedRecords(),u,e,s,a,v,h;if(c=l.indexOf(t._draggedRecord),i=l[c],f.tr=n,f.data=i,f.requestType=r.TreeGrid.Actions.Delete,f.isDragAndDropDelete=!0,t._trigger("actionBegin",f))return!0;t.model.enableWBS&&(s=!1,i&&i.parentItem?(u=i.parentItem.childRecords,e=u.indexOf(i)):o.flatRecords.length&&(a=o.flatRecords,v=a.filter(function(n){return n&&n.level==0}),u=v,e=u.indexOf(i)),e!=u.length-1&&(s=!0));t._removeRecords(f);s&&(i.parentItem?h=u[e]:(u.splice(e,1),h=u[e]),t.updateWBSdetails(h));t._checkboxSelection||(o.selectedItems=[]);t._previousIndex=-1},_revertDragging:function(t){var i=this,f=i.model,u=f.flatRecords,o,e;i._draggedRecord=t.draggedRow;i._deleteDragRow();i._draggedRecord.hasChildRecords?(u.splice(t.previousItemIndex,0,i._draggedRecord),r.isNullOrUndefined(u[t.previousItemIndex].parentItem)||(u[t.previousItemIndex].parentItem=t.previousParentItem,r.isNullOrUndefined(t.previousParentItem)||u[t.previousItemIndex].parentItem.childRecords.splice(t.childIndex,0,i._draggedRecord)),o=f.flatRecords.indexOf(i._draggedRecord),i._updateChildRecord(i._draggedRecord,o,t.previousItem.index),i._draggedRecord.level=t.previousLevel,i._updateChildRecordLevel(i._draggedRecord,t.previousLevel)):(u.splice(t.previousItemIndex,0,i._draggedRecord),u[t.previousItemIndex].parentItem=t.previousItem.parentItem,r.isNullOrUndefined(t.previousParentItem)||(u[t.previousItemIndex].parentItem.childRecords.splice(t.childIndex,0,i._draggedRecord),u[t.previousItemIndex].parentItem.hasChildRecords=!0,u[t.previousItemIndex].parentItem.hasFilteredChildRecords=!0,u[t.previousItemIndex].parentItem.expanded=!0),u[t.previousItemIndex].level=t.previousLevel);f.parentIdMapping&&(u[t.previousItemIndex][f.parentIdMapping]=t.previousItem[f.parentIdMapping],u[t.previousItemIndex].item[f.parentIdMapping]=t.previousItem[f.parentIdMapping]);r.isNullOrUndefined(t.previousItem.parentItem)||(t.previousItem.parentItem.hasChildRecords=t.parentChildState,t.previousItem.parentItem.expanded=t.parentExpandedState,f.childMapping&&t.previousItem.parentItem.item[i.model.childMapping]&&t.previousItem.parentItem.item[i.model.childMapping].splice(t.childIndex,0,t.previousItem.item));f.isFromGantt&&(u[t.previousTargetItemIndex]=t.previousTarget,t.previousTarget.isAutoSchedule==!0?(t.previousTarget.startDate=t.previousTarget.item[t.model.startDateMapping]=new Date(t.clonedTarget.startDate),t.previousTarget.endDate=new Date(t.clonedTarget.endDate),t.previousTarget.duration=t.clonedTarget.duration,t.previousTarget.status=t.clonedTarget.status,t.model.endDateMapping&&(t.previousTarget.item[t.model.endDateMapping]=new Date(t.clonedTarget.endDate)),t.model.progressMapping&&(t.previousTarget.item[t.model.progressMapping]=t.clonedTarget.status),t.model.durationMapping&&(t.previousTarget.item[t.model.durationMapping]=t.clonedTarget.duration),t.previousTarget.expanded=t.clonedTarget.expanded,e=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),e._updateTargetGanttRecord(t.previousTarget)):(t.previousTarget.manualStartDate=new Date(t.clonedTarget.manualStartDate),t.previousTarget.manualEndDate=new Date(t.clonedTarget.manualEndDate),t.previousTarget.manualDuration=t.clonedTarget.manualDuration,t.previousTarget.status=t.clonedTarget.status,t.model.progressMapping&&(t.previousTarget.item[t.model.progressMapping]=t.clonedTarget.status),t.previousTarget.expanded=t.clonedTarget.expanded,e=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),e._updateGanttRecord(t.previousTarget)));i.processBindings(t);f.currentViewData.length>0&&r.TreeGrid.updateAltRow(i,f.currentViewData[0],0,0)},_updateChildRecord:function(n,t){var i,f=this,r=f.model,e,u;if(!n.hasChildRecords)return 0;for(e=n.childRecords.length,u=0;u<e;u++)i=n.childRecords[u],t++,r.flatRecords.splice(t,0,i),r.updatedRecords.splice(t,0,i),r.isFromGantt&&r.ids.splice(t,0,i.taskId.toString()),i.hasChildRecords&&(t=f._updateChildRecord(i,t));return t},_recordLevel:function(){var u=this,e=u.model,i=u._draggedRecord,t=u._droppedRecord,f=u.model.childMapping,o;t.hasChildRecords||(t.hasChildRecords=!0,t.hasFilteredChildRecords=!0,(r.util.isNullOrUndefined(t.childRecords)||n.isEmptyObject(t.childRecords))&&(t.childRecords=[],e.parentIdMapping||(t.item[f]=[])));u._insertAsChild&&(i.parentItem=t,t.childRecords.splice(0,0,i),r.isNullOrUndefined(i)||r.isNullOrUndefined(t.item[f])||e.parentIdMapping||t.item[f].splice(0,0,i.item),i.hasChildRecords?(o=1,i.level=t.level+1,u._updateChildRecordLevel(i,o)):i.level=t.level+1,t.expanded=!0,u._parentRecords.push(t))},_updateChildRecordLevel:function(n,t){var u=this,r=0,i;if(t++,!n.hasChildRecords)return 0;for(r=n.childRecords.length,i=0;i<r;i++)currentRecord=n.childRecords[i],currentRecord.level=n.parentItem?n.parentItem.level+t:n.level+1,currentRecord.hasChildRecords&&(t--,t=u._updateChildRecordLevel(currentRecord,t));return t},_filterBarClose:function(t){var i=n(t.target),r;t.type=="click"&&i.hasClass("e-cancel")&&(r=i.prev(),r.focus().val(""),r.prop("checked",!1),r.trigger("keyup"),t.stopPropagation());t.type=="focusin"&&(i=n(t.target).next(),this.getHeaderTable().find(".e-cancel").addClass("e-hide"),i.removeClass("e-hide"))},_checkIdenticalValue:function(n,t){for(var u,f=this,e=f.model,r=e.filterSettings.filteredColumns,o=r.length,i=0;i<o;i++)if(r[i].value===n&&r[i].field==t.field){u=!0;break}return u},_filterBarHandler:function(t){var i=this,o=i.model,c,f,v,y,p,l,a,h,s,e;if(i.model.isEdit?i.cancelEditCell():i._isRowEdit&&i.cancelRowEditCell(),i._isRefreshAddedRecord=!1,i.clearAllSelection(),f=t.target==u?n(t):n(t.target),this.model.allowFiltering){if(v=i.model.columns,y=i._cellEditingDetails,p=i._queryManagar.queries[0],l=f.hasClass("e-ddl")?f.find("input.e-field"):f,i._fieldName=l[0].id.replace(i._id+"_","").replace("_filterbarcell",""),this._currentFilterColumn=r.TreeGrid.getColumnByField(o.columns,i._fieldName),i._fieldName=this._currentFilterColumn.field,a=this._currentFilterColumn,f.hasClass("e-checkbox"))i._searchString=f[0].checked;else if(f.hasClass("e-ddl")){if(f=f.find("input.e-dropdownlist"),s=n("#"+f[0].id).data("ejDropDownList"),s.selectedIndexValue==-1||i._checkIdenticalValue(s._selectedValue,this._currentFilterColumn))return!0;i._searchString=s._selectedValue}else if(f.hasClass("e-dropdownlist")){if(e=n("#"+f[0].id).data("ejDropDownList"),e.selectedIndexValue==-1||i._checkIdenticalValue(e._selectedValue,this._currentFilterColumn))return!0;i._searchString=e._selectedValue==i._dropDownListClearText?"":e._selectedValue}else i._searchString=f.closest("input").val();if((this._currentFilterColumn.filterEditType=="datepicker"||this._currentFilterColumn.filterEditType=="datetimepicker")&&i._searchString!=""&&i._searchString&&(h=a.format?i._getDateFormat(this._currentFilterColumn.format):i.model.dateFormat,i._searchString=r.isNullOrUndefined(r.parseDate(i._searchString,h,o.locale))?"":r.parseDate(i._searchString,h,o.locale)),i._searchString==""&&(c=o.filterSettings.filteredColumns.filter(function(n){if(n.field===i._fieldName)return!0}),!c.length))return i._resizeFilteringElements(),!0;i._validateFilterValue(i._searchString);i.filterColumn(i._fieldName,this._operator,i._searchString,this._predicate);i._storePreviousFilteredValue(i._fieldName,i._searchString,this._operator);i.model.currentViewData.length>0&&i.model.enableAltRow&&r.TreeGrid.updateAltRow(i,i.model.currentViewData[0],0,0)}},_validateFilterValue:function(n){var t=this,i,f;this._predicate="and";switch(this._currentFilterColumn.filterEditType){case"numericedit":this._operator=r.FilterOperators.equal;break;case"datepicker":this._operator=r.FilterOperators.equal;i=this._currentFilterColumn.format==""||this._currentFilterColumn.format==u?r.preferredCulture().calendar.patterns.d:this._currentFilterColumn.format.split(":")[1].replace("}","");this._currentFilterbarValue!=""&&(this._currentFilterbarValue=r.format(n,i,this.model.locale));break;case"datetimepicker":this._operator=r.FilterOperators.equal;i=this._currentFilterColumn.format==""||this._currentFilterColumn.format==u?r.preferredCulture().calendar.patterns.f:this._currentFilterColumn.format.split(":")[1].replace("}","");this._currentFilterbarValue!=""&&(this._currentFilterbarValue=r.format(n,i,this.model.locale));break;case"stringedit":this._operator=r.FilterOperators.startsWith;break;case"dropdownedit":f=this._currentFilterColumn;this._operator=f.editType=="dropdownedit"&&f.editParams&&f.editParams.showCheckbox?r.FilterOperators.contains:r.FilterOperators.equal;break;case"booleanedit":t._searchString==!0||t._searchString=="1"?t._searchString=!0:(t._searchString=="false"||t._searchString=="0")&&(t._searchString=!1);this._operator=r.FilterOperators.equal;break;default:this._operator=r.FilterOperators.equal}},_headermouseHover:function(t){var i,v,d,b,s,y;if(t.preventDefault(),i=this,v=i.model,v.showGridCellTooltip&&!i._dragTooltip){var p=n(t.target),u=0,f=0,g=p.closest("div.e-headercelldiv"),w,s,e,h,c,l,a,o,k;i._headerMouseLeave();t||(t=window.event);t.originalEvent.pageX||t.originalEvent.pageY?(u=t.originalEvent.pageX,f=t.originalEvent.pageY):(t.originalEvent.clientX||t.originalEvent.clientY)&&(u=t.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,f=t.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop);e=g.clone();e.find(".e-ascending").length>0?e.find(".e-ascending").remove():e.find(".e-descending").length>0&&e.find(".e-descending").remove();e=p.closest(".e-headercell").hasClass("e-headertemplate")?e.clone():e.find("span").clone();w=r.buildTag("table.e-tooltiptable","",{padding:"0"},{cellspacing:"1"});s=r.buildTag("tbody",e,{},{});w.append(s);y=n(e).text().replace(/[ \t\r]+/g,"").length>0?!0:!1;s&&(k=p.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),o=this.getColumnByField(k),o&&(r.isNullOrUndefined(o.headerTooltip)||o.headerTooltip=="")?v.showGridCellTooltip&&y&&(d=n("#"+this._id+"detailscellwrapper").length>0?110:5,i._headerMouseOverTooltip=r.buildTag("div.e-tooltipgantt#headertooltip"+i._id+"",w,{top:f+10+"px",left:u+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),i._headerTooltipTimer=setTimeout(function(){n(document.body).append(i._headerMouseOverTooltip);var t=n("#"+i._id.replace("ejTreeGrid","")),r=i.getOffsetRect(t[0]);l=n(t).width()+r.left;a=n(t).height()+r.top;h=n(i._headerMouseOverTooltip).width();c=n(i._headerMouseOverTooltip).height();u+h+15>=l&&(u=u-h-15);f+c+10>=a&&(f=f-c-10);n(i._headerMouseOverTooltip).css({top:f,left:u})},700)):o&&!r.isNullOrUndefined(o.headerTooltip)&&o.headerTooltip!=""&&(d=n("#"+this._id+"detailscellwrapper").length>0?110:5,b={},b.column=o,i._createColumnTooltipTemplate(o.headerTooltip),i._headerMouseOverTooltip=r.buildTag("div.e-tooltipgantt#headertooltip"+i._id+"","",{top:f+10+"px",left:u+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),s=r.buildTag("tbody",n.render[i._id+"columnTooltipTemplate"](b),{},{}),i._headerMouseOverTooltip[0].innerHTML="<table>"+s[0].innerHTML+"<\/table>",y=n(s).text().replace(/[ \t\r]+/g,"").length>0?!0:!1,y&&(i._headerTooltipTimer=setTimeout(function(){var r,t;n(document.body).append(i._headerMouseOverTooltip);v.isFromGantt?(r=n("#"+i._id.replace("ejTreeGrid","")),t=i.getOffsetRect(r[0]),l=n(r).width()+t.left,a=n(r).height()+t.top):(t=i.getOffsetRect(i.element[0]),l=n(i.element).width()+t.left,a=n(i.element).height()+t.top);h=n(i._headerMouseOverTooltip).width();c=n(i._headerMouseOverTooltip).height();u+h+15>=l&&(u=u-h-15);f+c+10>=a&&(f=f-c-10);n(i._headerMouseOverTooltip).css({top:f,left:u})},700))))}},_mouseHover:function(t){var i,u,w,rt,k,c,b;if(t.preventDefault(),i=this,u=i.model,u.showGridCellTooltip&&this._dragMouseDown!=!0){var tt=n(t.target),i=this,f=0,e=0,ut=i.getRows(),p=tt.closest("tr"),s=tt.closest("td.e-rowcell"),d=this.getIndexByRow(p),g=u.currentViewData[d],nt,c,h,l,a,v,y,it=u.columns,o;p.hasClass("e-footersummaryrow")&&(d=i._getFooterRows().index(p),g=i._footerSummaryRecord[d]);(d>=0||p.hasClass("e-footersummaryrow"))&&(columnIndex=i.getCellIndex(t),i._cellMouseLeave(),o=it[columnIndex],t||(t=window.event),t.originalEvent.pageX||t.originalEvent.pageY?(f=t.originalEvent.pageX,e=t.originalEvent.pageY):(t.originalEvent.clientX||t.originalEvent.clientY)&&(f=t.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e=t.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop),(g||p.hasClass("e-footersummaryrow"))&&(columnIndex!=u.treeColumnIndex?(w=s.clone(),w.find(".e-chkbox-wrap").remove(),h=w.children().length?w.children().clone():w.clone()):s.find(".e-cell").length>0?(h=s.find(".e-cell").clone(),h.find(".e-chkbox-wrap").remove()):s.hasClass("e-summaryrowcell")&&(s.find(".e-summarytitle").length>0?h=s.find(".e-summarytitle").clone():(h=s.clone(),n(h).css({cssText:"padding-left: 0px;"}))),nt=r.buildTag("table.e-tooltiptable","",{padding:"0"},{cellspacing:"1"}),(!u.showGridExpandCellTooltip||u.showGridExpandCellTooltip&&columnIndex==i.model.treeColumnIndex)&&(c=r.buildTag("tbody",h,{},{})),nt.append(c),b=n(h).text().replace(/[ \t\r]+/g,"").length>0?!0:!1,c&&n(s).find("#"+i._id+"EditForm").length==0&&(!u.cellTooltipTemplate&&(r.isNullOrUndefined(o.tooltip)||o.tooltip=="")||u.cellTooltipTemplate&&!r.isNullOrUndefined(o.tooltip)&&o.tooltip==""?(!u.showGridExpandCellTooltip&&b||u.showGridExpandCellTooltip&&b)&&(rt=n("#"+this._id+"detailscellwrapper").length>0?110:5,i._mouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltipgantt"+i._id+"",nt,{top:e+10+"px",left:f+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),i._tooltipTimer=setTimeout(function(){var r,t;n(document.body).append(i._mouseOverTooltip);u.isFromGantt?(r=n("#"+i._id.replace("ejTreeGrid","")),t=i.getOffsetRect(r[0]),v=n(r).width()+t.left,y=n(r).height()+t.top):(t=i.getOffsetRect(i.element[0]),v=n(i.element).width()+t.left,y=n(i.element).height()+t.top);l=n(i._mouseOverTooltip).width();a=n(i._mouseOverTooltip).height();f+l+15>=v&&(f=f-l-15);e+a+10>=y&&(e=e-a-10);n(i._mouseOverTooltip).css({top:e,left:f})},700)):(u.cellTooltipTemplate||!r.isNullOrUndefined(o.tooltip)&&o.tooltip!="")&&(rt=n("#"+this._id+"detailscellwrapper").length>0?110:5,k={},k.record=g,k.column=it[columnIndex],r.isNullOrUndefined(o.tooltip)||i._createColumnTooltipTemplate(o.tooltip),i._mouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltipgantt"+i._id+"","",{top:e+10+"px",left:f+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),i.tooltipState="Template",c=r.isNullOrUndefined(o.tooltip)?r.buildTag("tbody",n.render[i._id+"tooltipTemplate"](k),{},{}):r.buildTag("tbody",n.render[i._id+"columnTooltipTemplate"](k),{},{}),i._mouseOverTooltip[0].innerHTML="<table>"+c[0].innerHTML+"<\/table>",b=n(c).text().replace(/[ \t\r]+/g,"").length>0?!0:!1,b&&(i._tooltipTimer=setTimeout(function(){var r,t;n(document.body).append(i._mouseOverTooltip);u.isFromGantt?(r=n("#"+i._id.replace("ejTreeGrid","")),t=i.getOffsetRect(r[0]),v=n(r).width()+t.left,y=n(r).height()+t.top):(t=i.getOffsetRect(i.element[0]),v=n(i.element).width()+t.left,y=n(i.element).height()+t.top);l=n(i._mouseOverTooltip).width();a=n(i._mouseOverTooltip).height();f+l+15>=v&&(f=f-l-15);e+a+10>=y&&(e=e-a-10);n(i._mouseOverTooltip).css({top:e,left:f})},700))))))}},_cellMouseLeave:function(){var t=this;t._mouseOverTooltip!=null&&(n("#tooltipgantt").remove(),window.clearTimeout(t._tooltipTimer),n(t._mouseOverTooltip).remove())},_headerMouseLeave:function(){var t=this;t._headerMouseOverTooltip!=null&&(n("#headertooltip").remove(),window.clearTimeout(t._headerTooltipTimer),n(t._headerMouseOverTooltip).remove())},disableTooltip:function(){this._cellMouseLeave()},_createTooltipTemplate:function(){var i=this,e,s=i.model.columnHeaderTexts,o={_getTaskName:i._tooltipTaskName},r=i.model.cellTooltipTemplate,t=null,u,f;n.views.helpers(o);u="";r?(u=document.getElementById(r)?n("#"+r)[0].innerHTML:r,t=u):(t="<tr class='e-tooltip_rowcell'>",e="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='height:auto;width:auto;font-weight:normal;'>{{:ttiptaskname}}<\/td>{{/if}}",t+=e,t+="<\/tr>");f={};f[i._id+"tooltipTemplate"]=t;n.templates(f)},_tooltipTaskName:function(){return this.data.ttiptaskname},_createColumnTooltipTemplate:function(t){var f=this,r=null,u="",i;t&&(u=document.getElementById(t)?n("#"+t)[0].innerHTML:t.slice(0,1)==="#"&&document.getElementById(t.slice(1,t.length))?n(t)[0].innerHTML:t,r=u);i={};i[f._id+"columnTooltipTemplate"]=r;n.templates(i)},getMaxZIndex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==u||t==null)&&(t=1),t},_onScroll:function(t){var i=this,e=this.model,f,o;if(i._popupHide(),i._clearContextMenu(),n("#"+this._id+"detailscellwrapper").length>0&&this._removeDetailsRow(),i.model.showGridCellTooltip&&(i._cellMouseLeave(),i._headerMouseLeave()),!e.isFromGantt&&i._dragTooltip&&!_timerDragDown&&!_timerDragUp){t.cancel=!0;return}if(!i.isVScroll()&&!i.model.isFromGantt&&t.source==="wheel"){t.cancel=!0;return}t.scrollLeft!=u&&(i._scrollLeft=t.scrollLeft,f=Math.abs(i._scrollLeft-i._prevScrollLeft));t.scrollTop!=u&&(i._scrollTop=t.scrollTop,o=Math.abs(i._scrollTop-i._preVScrollTop));f&&(i._updateHeaderScrollLeft(i._scrollLeft),i._prevScrollLeft=i._scrollLeft);t.scrollTop!=u&&(i.model.isEdit?(i.cancelEditCell(),i._focusTreeGridElement()):i._isRowEdit&&(i.cancelRowEditCell(),i._focusTreeGridElement()),i._vScrollDist=Math.abs(i._scrollTop-i._prevScrollTop),i._preVScrollTop=i._scrollTop,i.model.enableVirtualization&&(i._vScrollDir=i._prevScrollTop<=i._scrollTop?1:-1,i._vScrollDist&&i._scrollTop!=i._prevScrollTop&&(i._updateCurrentViewData(r.TreeGrid.Actions.Scroll),i._prevScrollTop=i._scrollTop)),i._scrollTop=t.scrollTop,this._frozenColumnsLength&&i.getContent().find("#e-frozencontainer"+i._id).scrollTop(i._scrollTop))},editFormValidate:function(){if(n.isFunction(n.validator)){if(n("#"+this._id+"EditForm").length>0)return n("#"+this._id+"EditForm").validate().form();if(n("#"+this._id+"EditFormDialog").length>0)return n("#"+this._id+"EditFormDialog").validate().form()}return!0},saveRow:function(){var t=this,f=t.model,s,h,v,b,d,c,e,w,a,g;t.model.editSettings.allowEditing&&t.model.editSettings.editMode=="dialogEditing"?(s=n("#"+t._id+"EditFormDialog"),h=t._currentEditRecordDialogIndex,v=!0):(s=n("#"+t._id+"EditForm"),h=this.getIndexByRow(s.closest("tr")));var k=n("#"+t._id+"EditFrozenForm"),nt=k.add(s).find("td"),p=s.closest("tr").hasClass("e-addedrow"),o=f.columns,y=o.length,u=f.currentViewData[h],l={};if(previousValue={},args={},t._focusTreeGridElement(),!(s.length<=0)||h!=-1){for(i=0;i<y;i++)if(column=o[i],!r.isNullOrUndefined(column)&&column.field!="")if(column.visible){if(b=r.isNullOrUndefined(column.editType)?"stringedit":column.editType,value=t.getCurrentEditCellDataForRowEdit(column.field,b,i),t._checkboxSelection&&column.field=="checkboxState")continue;f.idMapping&&f.parentIdMapping&&column.field==f.idMapping&&t._validateIdValue(value)&&(value=u[column.field]);d=(column.field||"").split(".");d.length<=1?(previousValue[column.field]=u.item[column.field],l[column.field]=u[column.field]=u.item[column.field]=value):(e=t._getCustomCellValue(u.item,column.field),previousValue=t._restoreCustomData(previousValue,e,column.field),l=t._restoreCustomData(l,value,column.field),u=t._restoreCustomData(u,value,column.field),u.item=t._restoreCustomData(u.item,value,column.field))}else e=t._getCustomCellValue(u,column.field),previousValue=t._restoreCustomData(previousValue,e,column.field),l=t._restoreCustomData(l,e,column.field);if(p){if(args.rowIndex=t.selectedRowIndex(),args.previousValue=previousValue,args.requestType="addNewRow",args.addedRow=t._checkIsEmptyRow(u.item)?null:u.item,args.rowElement=s.closest("tr"),t._trigger("actionComplete",args))for(i=0;i<y;i++)column=o[i],r.isNullOrUndefined(column)||column.visible&&(e=t._getCustomCellValue(previousValue,column.field),u=t._restoreCustomData(u,e,column.field),u.item=t._restoreCustomData(u.item,e,column.field))}else if(args.previousValue=previousValue,args.requestType="update",v?(args.rowIndex=t._currentEditRecordDialogIndex,args.element=n("#"+t._id+"_dialogEdit")):(args.rowIndex=t.selectedRowIndex(),args.rowElement=s.add(k).closest("tr")),args.currentValue=u.item,v){if(t._trigger("actionBegin",args)){for(i=0;i<y;i++)column=o[i],r.isNullOrUndefined(column)||column.visible&&(e=t._getCustomCellValue(previousValue,column.field),u=t._restoreCustomData(u,e,column.field),u.item=t._restoreCustomData(u.item,e,column.field));return!0}for(c=0;c<o.length;c++)(o[c].editType==r.TreeGrid.EditingType.Dropdown||o[c].editType==r.TreeGrid.EditingType.DatePicker||o[c].editType==r.TreeGrid.EditingType.DateTimePicker)&&($element=n("#"+t._id+t._getFieldValue(o[c].field)),$element.data("ejWidgets")&&$element[$element.data("ejWidgets")[0]]("destroy"))}else if(t._trigger("endEdit",args))for(i=0;i<y;i++)column=o[i],r.isNullOrUndefined(column)||column.visible&&(e=t._getCustomCellValue(previousValue,column.field),u=t._restoreCustomData(u,e,column.field),u.item=t._restoreCustomData(u.item,e,column.field));t._checkIsEmptyRow(u.item)&&p?(w=!1,t._isEmptyRow=!0,f.editSettings.allowDeleting||(w=!0,f.editSettings.allowDeleting=!0),t._checkboxSelection?t.deleteRow(null,!0,null):t.deleteRow(),t._isEmptyRow=!1,t._isEmptyRowDeleted=!0,w&&(f.editSettings.allowDeleting=!1)):(r.TreeGrid.refreshRow(t,h),p&&u.parentItem&&u.parentItem.childRecords.length==1&&r.TreeGrid.refreshRow(t,f.currentViewData.indexOf(u.parentItem)),f.showSummaryRow&&(args.editType="rowedit",args.requestType=="addNewRow"&&f.editSettings.rowPosition=="child"&&t._createAndRenderSummaryRecords(args),t._updateSummaryRow(args)),f.showTotalSummary&&(args.editType="rowedit",t._updateTotalSummaryRow(args)),v&&(a={},a.data=f.currentViewData[h],a.item=f.currentViewData[h].item,a.requestType="recordUpdate",t._trigger("actionComplete",a)));t._isRowEdit=!1;f.currentViewData.length>0&&f.enableAltRow&&!f.enableVirtualization&&r.TreeGrid.updateAltRow(t,f.currentViewData[0],0,0);t._cancelSaveTools();g=o.filter(function(n){if(n.filterEditType=="dropdownedit"&&n.editType!="dropdownedit")return!0});f.allowFiltering&&g.length&&t._resizeFilteringElements()}},_excludeDetailRows:function(){var t=n(),i=this.model;return this.getTreeGridRows()&&this.getTreeGridRows().length>0&&(t=i.showDetailsRow&&i.detailsTemplate?this._frozenColumnsLength>0?[n(this.getTreeGridRows()[0]).not(".e-detailsrow"),n(this.getTreeGridRows()[1]).not(".e-detailsrow")]:n(this.getTreeGridRows()).not(".e-detailsrow"):this._frozenColumnsLength>0?[n(this.getTreeGridRows()[0]),n(this.getTreeGridRows()[1])]:n(this.getTreeGridRows())),t},getIndexByRow:function(t){var r=this._excludeDetailRows(),i=-1;return this._frozenColumnsLength>0?(i=n(r[0]).index(t),i==-1&&(i=n(r[1]).index(t)),i):r.index(t)},getTreeGridRows:function(){return this._gridRows},_keyDown:function(n){var t=this;n.shiftKey&&t._shiftKeyFirstElementDetails.firstElementRowIndex==-1&&(t._shiftKeyFirstElementDetails.firstElementRowIndex=t._focusingRowIndex,t._shiftKeyFirstElementDetails.firstElementCellIndex=t._cellIndex)},_focusTreeGridElement:function(){if(r.browserInfo().name=="msie")try{this.element[0].setActive()}catch(n){}else this.element[0].focus()},_onRecordClick:function(t){var f=this,u=n(t.target),s=f.model,e,h=u.closest("td"),i={},o=u.closest("tr");(u.hasClass("e-rowcell")||u.parent().hasClass("e-rowcell")||u.closest("td").hasClass("e-rowcell")||u.closest("td").hasClass("e-rowcell")&&u.hasClass("e-cell"))&&o.find(".e-editedcell").length==0&&!o.hasClass("e-summaryrow")&&(i.cell=h,i.cellIndex=f.getCellIndex(t),i.row=o,i.rowIndex=f.getIndexByRow(i.row),i.data=f.model.currentViewData[i.rowIndex],e=s.columns[i.cellIndex],i.columnName=e.headerText,i.cellValue=r.isNullOrUndefined(i.data)?"":i.data[e.field],f._trigger("recordClick",i))},_addRemoveAnimateClass:function(t){var i=this;this._$gridContentTable&&this._$gridContentTable.find(".e-treegrid-animate").removeClass("e-treegrid-animate");i._$gridHeaderContainer&&i._$gridHeaderContainer.find(".e-treegrid-animate").removeClass("e-treegrid-animate");n(t).addClass("e-treegrid-animate")},_onClick:function(t){var i=this,f=i.model,u=n(t.target),e,o={},l=-1,y,w=u.closest(".e-treegrid").attr("id"),a=i.getUpdatedRecords(),nt,k,it,c,d,ut;if(u.closest(".e-treegrid").attr("id")!==this._id)return!1;if(i._clearContextMenu(),this._removeDetailsRow(t),f.allowDragAndDrop&&window.clearTimeout(i._dragTooltipTimer),f.allowColumnReordering&&(window.clearTimeout(this._dragColumnTooltipTimer),this._dragColumnTooltipTimer=null),i._cellIndex=i.getCellIndex(t),this.getHeaderTable().find(".e-cancel").addClass("e-hide"),f.selectionSettings.selectionMode=="cell"&&f.editSettings.editMode!="dialogEditing"&&(f.editSettings.editMode="cellEditing"),l=i.getRowIndex(t),(f.editSettings.beginEditAction=="click"||u.hasClass("e-treegridexpand")||u.hasClass("e-treegridcollapse"))&&u.closest(".e-scrollbar").length==0&&this.editFormValidate()&&(f.editSettings.editMode.toLowerCase()=="cellediting"&&(i._cellEditingDetails.rowIndex=l),y=f.currentViewData&&f.currentViewData[l]),!i.model.allowSelection||i.model.selectionSettings.selectionType!="multiple"||i.model.isFromGantt||u.hasClass("e-downtail")||(u.hasClass("e-rowselect")?u.hasClass("e-spanclicked")?i._clearMultiSelectPopup():u.addClass("e-spanclicked"):n("#"+w+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")||this._multiSelectPopup.hide()),i._saveCellHandler(t),!u.hasClass("e-summaryrowcell")&&!u.hasClass("e-footersummaryrowcell")&&!u.hasClass("e-summarytitle")){if((u.hasClass("e-treegridexpand")||u.hasClass("e-treegridcollapse"))&&l!=-1){var ft=u.closest("tr"),b=a.indexOf(y),o={},g;u.removeClass("e-treegrid-animate");o.data=s;o.data=y;o.recordIndex=b;o.expanded=ft.hasClass("e-treegridrowexpand")?!1:!0;n("#"+i._id+"EditForm").length==0&&(u.hasClass("e-rowcell")||!u.closest(".e-rowcell").hasClass("e-templatecell"))?i._focusTreeGridElement():i._cancelEditState();g=o.expanded?i._trigger("expanding",o):i._trigger("collapsing",o);g||f.isFromGantt||(i._isRefreshAddedRecord?(o.data.expanded=o.expanded,i.updateExpandStatus(o.data,o.expanded),i.refreshContent(),i.renderRecords(),i._isRefreshAddedRecord=!1):r.TreeGrid.sendExpandCollapseRequest(i,o));f.allowPaging||f.enableVirtualization?(nt=i.getUpdatedRecords(),k=r.TreeGrid.getRowByIndex(this,nt.indexOf(y)),k&&i._addRemoveAnimateClass(n(k).find(".e-treegridcollapse,.e-treegridexpand"))):i._addRemoveAnimateClass(u)}else if(u.hasClass("e-rowcell")||u.parent().hasClass("e-rowcell")||u.closest("td").hasClass("e-rowcell")||u.parent().hasClass("e-detailsrowcell")||u.hasClass("e-detailsrowcell")||u.closest("td").hasClass("e-rowcell")&&u.hasClass("e-cell")){if(n("#"+w+"_selectionpopup").is(":visible")&&(n("#"+w+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")?(t.ctrlKey=!0,f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row&&(i._multiSelectCtrlRequest=!0)):(t.ctrlKey=!1,i._multiSelectCtrlRequest=!1)),n("#"+i._id+"EditForm").length==0&&(u.hasClass("e-rowcell")||!u.closest(".e-rowcell").hasClass("e-templatecell"))&&i._focusTreeGridElement(),e=i.getIndexByRow(u.closest("tr")),f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row){if(i._checkboxSelection&&(n("#"+i._id+"EditForm").length==0||f.editSettings.beginEditAction=="click")&&i.editFormValidate()){var s=i.model.currentViewData[e],b=a.indexOf(s),tt=!1;e==-1||i._rowSelectingEventTrigger(this.selectedRowIndex(),e)||(u.hasClass("e-checkbox")&&(tt=!0),i.selectRows(b,null,tt),i._cancelSaveTools(),i._rowSelectedEventTrigger(b))}f.selectionSettings.selectionType==r.TreeGrid.SelectionType.Multiple&&(t.ctrlKey&&(i._multiSelectCtrlRequest=!0),t.shiftKey&&(e=i.getIndexByRow(u.closest("tr")),s=f.currentViewData[e],e=a.indexOf(s),i._multiSelectShiftRequest=!0,i._rowSelectingEventTrigger(this.selectedRowIndex(),e)||(i.getRows()&&i._prevSelectedItem!=null?i.getExpandStatus(i._prevSelectedItem)?i.selectRows(a.indexOf(i._prevSelectedItem),e):i.selectRows(e):i.getRows()&&i._prevSelectedItem==null&&i.selectRows(0,e),i._cancelSaveTools(),i._rowSelectedEventTrigger(e))));i._checkboxSelection||i._multiSelectShiftRequest||n("#"+i._id+"EditForm").length!=0||l!=-1&&(s=f.currentViewData[l],e=a.indexOf(s),f.allowSelection&&!i._rowSelectingEventTrigger(this.selectedRowIndex(),e)&&(i.selectRows(e),i._cancelSaveTools(),i._rowSelectedEventTrigger(e)));i._multiSelectShiftRequest=!1}if(f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Cell&&n("#"+i._id+"EditForm").length==0&&i._cellIndex!=-1&&e!=-1&&f.allowSelection){it=i._cellIndex>=i._frozenColumnsLength?1:0;targetRow=i._frozenColumnsLength>0?i.getRows()[it][e]:i.getRows()[e];var et=f.columns,s=f.currentViewData&&f.currentViewData[e],v=a.indexOf(s),rt=i._cellIndex>=i._frozenColumnsLength?i._cellIndex-i._frozenColumnsLength:i._cellIndex,ot=targetRow.childNodes[rt],st=i._previousSelectedCellDetails.rowIndex,ht=i._previousSelectedCellDetails.cellIndex,h=n(ot).closest("td"),p;if(i._focusingRowIndex=v,e!=-1){if(s.isSummaryRow)return;o={rowIndex:v,cellIndex:i._cellIndex,rowElement:targetRow,cellElement:h[0]};c={rowIndex:v,cellIndex:i._cellIndex,cellElement:h[0],data:s};!i._cellSelectingEventTrigger(o)&&et[rt].allowCellSelection&&(f.selectionSettings.selectionType=="multiple"&&(t.ctrlKey||t.shiftKey)?t.ctrlKey?(p=r.browserInfo().name=="msie"&&r.browserInfo().version<9?i._getCellIndex(i._selectedCellDetails,"cellElement").indexOf(h[0]):i._selectedCellDetails.map(function(n){return n.cellElement}).indexOf(h[0]),p==-1?(n(h[0]).addClass("selectingcell"),i._selectedCellDetails.push(c),f.selectedCellIndexes.push({rowIndex:c.rowIndex,cellIndex:c.cellIndex}),i._cellSelectedEventTrigger(o,i._previousSelectedCellDetails)):(n(h[0]).removeClass("selectingcell"),i._selectedCellDetails.splice(p,1),f.selectedCellIndexes.splice(p,1))):t.shiftKey&&(o={rowIndex:v,cellIndex:i._cellIndex},i._shiftKeySelectCells(o),i._rowIndexOfLastSelectedCell=v,i._focusingRowIndex=i._shiftKeyFirstElementDetails.firstElementRowIndex):(i._selectedCellDetails=[],f.selectedCellIndexes=[],n("#"+i._id).find(".selectingcell").removeClass("selectingcell"),n(h[0]).addClass("selectingcell"),i._selectedCellDetails.push(c),f.selectedCellIndexes.push({rowIndex:c.rowIndex,cellIndex:c.cellIndex}),i._cellSelectedEventTrigger(o,i._previousSelectedCellDetails),i._shiftKeyFirstElementDetails={firstElementRowIndex:-1,firstElementCellIndex:-1},i._updateSecondRowIndexBy=1),t.shiftKey||(i._previousSelectedCellDetails={rowElement:targetRow,cellElement:h[0],cellIndex:o.cellIndex,rowIndex:v},i._rowIndexOfLastSelectedCell=i._focusingRowIndex,i._isShiftKeyNavigation=!1));i._cancelSaveTools();i._lastSelectedCellIndex=i._cellIndex}}i._isTouchTrigger&&i.model.allowSelection&&this.model.selectionSettings.selectionType=="multiple"&&!i.model.isFromGantt&&(i._isTouchTrigger&&this._multiSelectPopup!=null&&!this._multiSelectPopup.is(":visible")&&this._multiSelectPopup.find(".e-rowselect").hasClass("e-spanclicked")&&this._multiSelectPopup.show(),i._isTouchTrigger&&this._multiSelectPopup!=null&&!this._multiSelectPopup.find(".e-rowselect").hasClass("e-spanclicked")&&(u.hasClass("e-detailsrowcell")||u.parent("td").hasClass("e-detailsrowcell")||u.closest("tr").hasClass("e-detailsrow")||(this._multiSelectPopup.removeAttr("style"),d=u.closest(".e-rowcell").offset(),this._multiSelectPopup.offset({top:0,left:0}).offset({left:d.left+(u.closest(".e-rowcell").outerWidth()/2-this._multiSelectPopup.width()/2),top:d.top-this._multiSelectPopup.outerHeight()-10}).show())),i._isTouchTrigger=!1)}(u.hasClass("e-detailsrowcell")||u.parent("td").hasClass("e-detailsrowcell"))&&!u.closest("tr").hasClass("e-detailsrow")&&(t.ctrlKey||t.shiftKey||(ut=n("#"+this._id+"EditForm").length>0?this.editFormValidate()?!0:!1:!0,i._isRowEdit?this.saveRow():ut&&i._detailsExpandCollapse(u)));i._isRowEdit&&u.focus();u.closest("#"+i._id+"_ColumnMenu").hasClass("e-columnmenu")||i._clearColumnMenu();f.editSettings.beginEditAction!="click"||u.closest("#"+i._id+"EditForm").length!=0||i._isShiftKeyNavigation||i._isEmptyRowDeleted||i._editdblClickHandler(t);i._isEmptyRowDeleted=!1}},selectAllRows:function(t){var u=this,e=u.model,s=-1,i=u._flatFilteredRecords.length>0?u._flatFilteredRecords:e.flatRecords,c=u.getUpdatedRecords(),o=0,f,h;if(e.selectionSettings.enableSelectAll||u._isFromSetmodel){if(e.showSummaryRow&&(i=u._spliceSummaryRows(i)),!r.isNullOrUndefined(t)){for(t||(i=u._flatFilteredRecords.length>0?u._flatFilteredRecords:n.extend([],e.selectedItems)),f=0;f<i.length;f++)if(t){if(i[f].checkboxState=="checked")continue;i[f].checkboxState="checked";e.selectedItems.push(i[f]);n("#"+this._id+"_checkbox"+i[f].ejRowId).removeClass("e-stop").addClass("e-checkmark");n("#"+this._id+"_checkbox"+i[f].ejRowId).parent("span").removeAttr("class").addClass("e-chk-act")}else s=e.selectedItems.indexOf(i[f]),s>-1&&(i[f].checkboxState="unchecked",e.selectedItems.splice(s,1),n("#"+this._id+"_checkbox"+i[f].ejRowId).removeClass("e-checkmark"),n("#"+this._id+"_checkbox"+i[f].ejRowId).parent("span").removeAttr("class").addClass("e-chk-inact"),(e.selectionSettings.enableHierarchySelection||u._isFromSetmodel)&&u._updateParentSelection(i[f]));u._cancelSaveTools()}u._flatFilteredRecords.length>0&&e.selectedItems.length>0?(h=u._flatFilteredRecords.filter(function(n){return n.checkboxState=="checked"}),o=h.length):o=e.selectedItems.length;o>0?o!=i.length?(n("#"+this._id+"_headerCheckbox").removeClass("e-checkmark").addClass("e-stop"),n("#"+this._id+"_headerCheckbox").parent("span").removeAttr("class").addClass("e-chk-indeter")):(n("#"+this._id+"_headerCheckbox").removeClass("e-stop").addClass("e-checkmark"),n("#"+this._id+"_headerCheckbox").parent("span").removeAttr("class").addClass("e-chk-act")):(n("#"+this._id+"_headerCheckbox").removeClass("e-stop e-checkmark"),n("#"+this._id+"_headerCheckbox").parent("span").removeAttr("class").addClass("e-chk-inact"))}},_updateSelectedItems:function(t,i){var u=this,r=u.model;selectedRowIndex=-1;recordIndex=-1;updatedRecords=u.getUpdatedRecords();recordIndex=updatedRecords.indexOf(t);t.checkboxState=i;selectedRowIndex=n.inArray(t,r.selectedItems);t.checkboxState=="unchecked"?(selectedRowIndex!=-1&&r.selectedItems.splice(selectedRowIndex,1),recordIndex>-1&&(n("#"+this._id+"_checkbox"+t.ejRowId).removeClass("e-checkmark e-stop"),n("#"+this._id+"_checkbox"+t.ejRowId).parent("span").removeAttr("class").addClass("e-chk-inact"))):t.checkboxState=="checked"&&(selectedRowIndex==-1&&r.selectedItems.push(t),recordIndex>-1&&(n("#"+this._id+"_checkbox"+t.ejRowId).removeClass("e-stop").addClass("e-checkmark"),n("#"+this._id+"_checkbox"+t.ejRowId).parent("span").removeAttr("class").addClass("e-chk-act")))},_traverseSelection:function(n,t,i){var f=this,e=0,r,o=this.model,s,u;if(f._updateSelectedItems(n,t),!i&&n.parentItem&&o.selectionSettings.enableHierarchySelection&&f._updateParentSelection(n.parentItem),n.hasChildRecords&&o.selectionSettings.enableHierarchySelection)for(r=n.childRecords,f._flatFilteredRecords.length>0&&(s=r.filter(function(n){return f._flatFilteredRecords.indexOf(n)>-1}),r=s),e=r.length,u=0;u<e;u++)r[u].hasChildRecords?f._traverseSelection(r[u],t,!0):r[u].isSummaryRow||f._updateSelectedItems(r[u],t)},_updateParentSelection:function(t){var u=this,e=0,i=[],o,f,r;t&&t.childRecords&&(i=u._spliceSummaryRows(t.childRecords));u._flatFilteredRecords.length>0&&model.selectionSettings.enableHierarchySelection&&(o=i.filter(function(n){return u._flatFilteredRecords.indexOf(n)>-1}),i=o);e=i&&i.length;callMe=!1;f=i.filter(function(n){return n.checkboxState=="indeterminate"});r=i.filter(function(n){return n.checkboxState=="checked"});f.length>0||r.length>0&&r.length!=e?(t.checkboxState=="checked"?(this._updateSelectedItems(t,"unchecked"),callMe=!0):t.checkboxState=="unchecked"&&(callMe=!0),callMe&&(n("#"+this._id+"_checkbox"+t.ejRowId).addClass("e-stop"),n("#"+this._id+"_checkbox"+t.ejRowId).parent("span").removeAttr("class").addClass("e-chk-indeter"),t.checkboxState="indeterminate",t.parentItem&&this._updateParentSelection(t.parentItem))):r.length==0&&f.length==0?(n("#"+this._id+"_checkbox"+t.ejRowId).removeClass("e-stop e-checkmark").parent("span").removeClass("e-chk-indeter"),t.checkboxState=="checked"?this._updateSelectedItems(t,"unchecked"):t.checkboxState="unchecked",t.parentItem&&this._updateParentSelection(t.parentItem)):(t.checkboxState="checked",this._updateSelectedItems(t,"checked"),t.parentItem&&this._updateParentSelection(t.parentItem))},_removeInnerDetailRows:function(t,i){var f=n(".e-detailscellwrapperfly"),s=f.length,u=0,h=!1,e;for(u;u<s;u++)if(n.contains(f[u],t[0])||t==f[u]){h=!0;break}e=!1;r.isNullOrUndefined(f[u])&&(u=f.index(n("#"+this._id+"detailscellwrapper")),e=!0);var c=e?"":",",l=n(f[u]).attr("parentTreeGridIds"),o=n("[parentTreeGridIds$='"+c+l+"']"),a=o.length;this._triggerDetailRowHideEvent(o,i)},_triggerDetailRowHideEvent:function(t,i){var h=this,o=this.model,f=t.length,r=0,u;if(f>0&&n("#"+this._id+"detailscellwrapper").length>0){var c=n("#"+this._id+"detailscellwrapper"),s=o.selectedItem,e={};if(e.rowData=s,!this._trigger("detailsHidden",e)||i)for(r;r<f;r++)u=n(t[r]).attr("id").replace("detailscellwrapper",""),n("#"+u).find(".e-detailsrowexpand").removeClass("e-detailsrowexpand").addClass("e-detailsrowcollapse"),n("#"+u).find(".e-detailsinfoiconhide").removeClass("e-detailsinfoiconhide").addClass("e-detailsinfoiconshow"),n(t[r]).remove()}},_removeDetailsRow:function(t,i){var y=this.model,u,e,h;if(t){if(u=n(t.target),e=u,u.parent("td").hasClass("e-detailsrowcell")&&(e=u.parent("td")),u.closest(".e-popup").length==0&&u[0]!=n("html").get(0)){var o=n(".e-detailscellwrapperfly"),c=o.length,f=0,s=!1;for(f;f<c;f++)if(n.contains(o[f],u[0])||u[0]==o[f]){s=!0;break}if(u.hasClass("e-detailscellwrapperfly")||e.hasClass("e-detailsrowexpand")||e.hasClass("e-detailsrowcollapse")||s||this._removeInnerDetailRows(n("#"+this._id+"detailscellwrapper"),i),u.hasClass("e-detailscellwrapperfly")||e.hasClass("e-detailsrowcollapse")||!e.hasClass("e-detailsrowexpand")&&s){h=!1;r.isNullOrUndefined(o[f])&&(f=o.index(n("#"+this._id+"detailscellwrapper")),h=!0);var l=h?"":",",a=n(o[f]).attr("parentTreeGridIds"),v=n("[parentTreeGridIds$='"+l+a+"']");this._triggerDetailRowHideEvent(v,i)}}}else n("#"+this._id+"detailscellwrapper").length>0&&this._removeInnerDetailRows(n("#"+this._id+"detailscellwrapper")[0],i),this._triggerDetailRowHideEvent(n("#"+this._id+"detailscellwrapper"),i)},showHideDetailsRow:function(t){var u=this,i=this.model,e,f;this.editFormValidate()&&(i.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());i.showDetailsRow&&i.detailsTemplate&&i.showDetailsRowInfoColumn&&!r.isNullOrUndefined(t)&&t<=i.updatedRecords.length&&u.getExpandStatus(i.updatedRecords[t])&&(t!=this.selectedRowIndex()&&t!=-1&&n.inArray(t,u._selectedRowsIndexes==-1)&&i.allowSelection&&i.updatedRecords.length>t&&(u._rowSelectingEventTrigger(this.selectedRowIndex(),t)||(u.selectRows(t),u._rowSelectedEventTrigger(t))),this.updateScrollBar(t),e=n(r.TreeGrid.getRowByIndex(u,t)),e.length>0&&i.updatedRecords[t]&&u.getExpandStatus(i.updatedRecords[t])&&(f=n(e).find(".e-detailsrowcell"),n(f).length>0&&n(f).hasClass("e-detailsrowcell")&&(this.element.find(".e-detailsrowexpand")[0]!=f[0]&&this._removeDetailsRow(),this._detailsExpandCollapse(n(f)))))},_detailsExpandCollapse:function(t){var i=this,b=this.model,s,l,k,e,o,h,g,p,nt,w,c,u;if(t.parent("td").hasClass("e-detailsrowcell")&&(t=t.parent("td")),s=t.closest("tr"),l=s.find(".e-detailsrowcell"),l.hasClass("e-detailsrowcollapse")){if(k=this.getIndexByRow(s),e=this.model.currentViewData[k],r.isNullOrUndefined(e)||e.isSummaryRow)return;for(var a=this.getOffsetRect(s[0]),tt=n(n.render[i._id+"_detailRowTemplate"](e)),f=n(tt).find(".e-detailscellwrapper").attr({id:this._id+"detailscellwrapper"}),it=i._gridWidth-(i.element.find(".e-scrollcss").length>0?18:0)-2,v=this.element.parents().filter(".e-detailscellwrapperfly"),d=this._id,y="";v.length>0;)y=v.attr("id").replace("detailscellwrapper",""),d+=","+y,v=n("#"+y).parents().filter(".e-detailscellwrapperfly");f.attr("parentTreeGridIds",d);o=this.getOffsetRect(i._$gridContent[0]);o.bottom=o.top+i._$gridContent[0].offsetHeight;h=a.top+s[0].offsetHeight;g=h+b.detailsRowHeight;(h>o.bottom||g>o.bottom)&&(p=a.top-b.detailsRowHeight,p>o.top&&(h=p));f.removeClass("e-detailscellwrapper").addClass("e-detailscellwrapperfly");nt=i.getScrollElement().ejScroller("isHScroll")?i.getScrollElement().ejScroller("option","scrollLeft"):0;w=0;this._frozenColumnsLength>0&&(w=n(this.element).find("#e-frozencontentdiv"+this._id).width());f.css({top:h,left:a.left+nt-w,"z-index":i.getMaxZIndex()+1,position:"absolute",width:it}).appendTo(this.element);this._trigger("refresh");c={};c.detailsElement=f;c.data=e;c.rowIndex=this.selectedRowIndex();this._trigger("detailsDataBound",c);u={};u.detailsElement=f;u.data=e;u.rowIndex=this.selectedRowIndex();u.appendTarget=null;this._trigger("detailsShown",u)?this._removeInnerDetailRows(t):(l.find(".e-detailsinfoiconshow").removeClass("e-detailsinfoiconshow").addClass("e-detailsinfoiconhide"),l.removeClass("e-detailsrowcollapse").addClass("e-detailsrowexpand"),u.appendTarget&&(n(f).css({top:"auto",left:"auto",position:"auto"}),n(f).detach().appendTo(n("#"+u.appendTarget))))}else this._removeInnerDetailRows(t)},_onHeaderClick:function(t){var u=this,f=u.model,i,e,h,c,o,s;if(u._cellMouseLeave(),u._headerMouseLeave(),u._clearContextMenu(),this._removeDetailsRow(),n(t.target).is(".e-ascending, .e-descending")&&(t.target=t.target.parentNode),i=n(t.target),o=!0,u.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive"),u._mouseDragged&&f.allowColumnReordering&&(o=!1),u._checkboxSelection&&f.allowSelection&&f.selectionSettings.enableSelectAll&&i.hasClass("e-headerCheckbox")&&(u.selectAllRows(!i.hasClass("e-checkmark")&&!i.hasClass("e-stop")),o=!1),i.closest(".e-headercelldiv")&&!i.hasClass("e-columnmenu-icon")&&!i.hasClass("e-column-filter-icon")&&!i.hasClass("e-column-filtered-icon"))if(e=i.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),!o||r.isNullOrUndefined(e)&&r.isNullOrUndefined(this.getColumnByField(e))||this.getColumnByField(e).allowSorting==!1){if((f.isEdit||this._isRowEdit)&&this.editFormValidate()&&(f.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),!i.hasClass("e-checkbox"))return!1}else o&&f.allowSorting&&(c=this.getColumnByField(e),h=i.closest(".e-headercell").find("span").hasClass("e-ascending")?r.sortOrder.Descending:r.sortOrder.Ascending,f.allowMultiSorting&&t.ctrlKey&&(u._multiSortRequest=!0),u._isRefreshAddedRecord=!1,f.isFromGantt?u.sortColumn(c.mappingName,h):u.sortColumn(c.field,h),u.model.isFromGantt&&this.selectedRowIndex()>=0&&(s={},s.data=u.model.selectedItem,s.target="ejTreeGrid",s.recordIndex=this.selectedRowIndex(),u._trigger("rowSelected",s)));return i.hasClass("e-column-filter-icon")||i.hasClass("e-column-filtered-icon")?(i.data("isClicked")?(u._clearColumnMenu(),i.data("isClicked",!1)):(u._updateFilterMenuList(t),n(".e-filtericon").data("isClicked",!1),i.data("isClicked",!0)),this._addRemoveAnimateClass(i)):i.hasClass("e-columnmenu-icon")?(i.data("isClicked")?(u._clearColumnMenu(),i.data("isClicked",!1)):(u._renderColumnMenu(t),n(".e-columnicon").data("isClicked",!1),i.data("isClicked",!0)),this._addRemoveAnimateClass(i)):u._clearColumnMenu(),i.hasClass("e-checkbox")?!0:!1},_triggerColumnResize:function(t,i,u){var f=this,l=f.model,a=f.getHeaderTable().find(".e-columnheader"),v=a.find(".e-headercell"),o=f._cellIndex,y,w=n(f._target),c,s,p,e,h;return col=[],t=="columnResizeStart"&&(f._orgX=i,o=f._currentCell=f._cellIndex=f.getCellIndex(u)),f._currentCell!=-1?(c=v[f._currentCell],s=c.offsetWidth,t=="columnResizeStart"?(e={},e={columnIndex:o,column:f.model.columns[o],target:n(c),oldWidth:s},f._trigger("columnResizeStart",e)):t=="columnResizeEnd"?(p=a.find(".e-headercell").not(".e-detailheadercell").filter(":visible"),h=i-f._orgX,f._newWidth=s+h,f.__oldWidth=s,e={},e={columnIndex:o,column:l.columns[o],target:n(c),oldWidth:s,newWidth:f._newWidth,extra:h},f._trigger("columnResizeEnd",e)):(this.model.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||this.model.isFromGantt?!this.model.isFromGantt&&this.model.columnResizeSettings.columnResizeMode==r.TreeGrid.ColumnResizeMode.NextColumn&&this.model.showTotalSummary&&this._colgroupRefresh():this._updateTableWidth(),e={},h=i-f._orgX,y=s+h,e={columnIndex:o,column:l.columns[o],oldWidth:f.__oldWidth,newWidth:f._newWidth},f._trigger("columnResized",e))):void 0},_headerMouseDown:function(t){var i=this,u=i._getCoordinate(t),r,f,e=i.model,o,s,h,c,l,a;if(i._cellMouseLeave(),i._headerMouseLeave(),t.type=="touchstart"?(r=i._getElementByPosition(u.pageX,u.pageY),i._on(i.element,"touchmove",i._mouseMove)):r=n(t.target),i._on(n(document),"mouseup touchend",i._headerMouseUp),i._on(i.element,"contextmenu",this._preventContextMenu),e.allowColumnReordering&&(r.closest(".e-columnheader").length>0&&i.dragColumn(t),t.type=="touchstart"&&(i._dragColumnTooltipTimer=window.setTimeout(function(){i._touchstart=!1;i._dragTooltip||t.type!="touchstart"||(i.dragColumnToolTip(t),i._dragTooltip&&i._on(i.element,"touchmove",i.dragColumnToolTip))},550))),i.model.allowColumnResize){if(e.isFromGantt?i._on(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._on(i.element,"mouseup touchend",i._mouseUp),f=r.closest("tr"),this._target=r,o=u.pageX,s=u.pageY,navigator.userAgent.indexOf("WebKit")!=-1&&(o=u.pageX,s=u.pageY-document.body.scrollTop),f.length>0&&f[0].style.cursor=="col-resize"&&!r.hasClass("e-columnicon")&&(r.is(".e-headercelldiv")&&(r=n(r[0].parentNode)),this._target=r,i._frozenColumnsLength>0&&(c=r.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),l=i.getColumnByField(c),h=i._frozenColumns.indexOf(l)>-1?!0:!1),h||this._triggerColumnResize("columnResizeStart",o,t)))return;i._resizer._mouseDown(t)}n(t.target).hasClass("headercelldiv")&&n(t.target).hasClass("headercell")&&(a=n(t.target).hasClass("headercelldiv")?n(t.target).parent():n(t.target),e.headerEffects&&a.addClass("headercellactive"))},_headerMouseUp:function(t){var i=this,f=i.model,u={},e=i._getCoordinate(t),o,s;t.type=="touchend"?(o=i._getElementByPosition(e.pageX,e.pageY),i._off(i.element,"touchmove",i._mouseMove)):o=n(t.target);i._off(n(document),"mouseup touchend",i._headerMouseUp);i.model.allowColumnResize&&(f.isFromGantt?i._off(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._off(i.element,"mouseup touchend",i._mouseUp));f.allowColumnReordering&&(window.clearTimeout(this._dragColumnTooltipTimer),this._dragColumnTooltipTimer=null,i._off(i.element,"mousemove touchmove",i.dragColumnToolTip),n(i._reordervline).remove(),n(i._dragmouseOverTooltip).remove(),(i._posx!=e.pageX||i._posy!=e.pageY)&&(i._mouseDragged=!0),f.allowColumnReordering&&o.closest(".e-headercell").length>0&&i._headerDragStatus=="mousemove"&&(s=f.columns,u.targetColumn=s[i._currentIndex],u.targetColumnIndex=i._currentIndex,u.draggedColumn=i._draggedColumn,u.draggedColumnIndex=s.indexOf(i._draggedColumn),r.isNullOrUndefined(u.targetColumn.nonColumn)&&!r.isNullOrUndefined(u.targetColumnIndex)&&u.targetColumnIndex!=u.draggedColumnIndex&&(i._trigger("columnDrop",u),u.cancel||i.reorderColumn(u.draggedColumn.field,u.targetColumnIndex))));i._resetHeaderPrivateProperties()},_resetHeaderPrivateProperties:function(){_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp));var n=this,t=n.model;n._draggedColumn=null;n._dragMouseDown=!1;n._dragTooltip=!1;n._headerDragStatus="";_timerDragDown=null;_timerDragUp=null;n._currentIndex=null;n._dragmouseOverTooltip=null},_contentMouseDown:function(t){var u=n(t.target),i=this,f=i.model,e=i._getCoordinate(t),o=u.closest(".e-treegrid").attr("id");if(i._contentPageY=e.pageY,i._contentPageX=e.pageX,i._on(n(document),"mouseup touchend",i._mouseupHandler),t.type=="touchstart"&&(i._isTouchEvent=!0,i._isTouchTrigger=!0),n("#"+o+"_selectionpopup").is(":visible")&&(n("#"+o+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")?(t.ctrlKey=!0,i.model.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row&&(i._multiSelectCtrlRequest=!0)):(t.ctrlKey=!1,i._multiSelectCtrlRequest=!1)),i.model.isFromGantt||(r.isTouchDevice()?i._on(i.element,"taphold",i._contextMenuAction):i._on(i.element,"contextmenu",i._contextMenuAction)),!(u.hasClass("e-vhandle")||u.hasClass("e-vscrollbar")||u.hasClass("e-vup")||u.hasClass("e-vdown")||u.hasClass("e-vhandlespace")||u.hasClass("e-hhandle")||u.hasClass("e-hscrollbar")||u.hasClass("e-hdown")||u.hasClass("e-hhandlespace")||u.closest(".e-editedcell").length>0)){if(i._mouseDown=!0,r.isTouchDevice()&&t.preventDefault(),f.allowDragAndDrop&&(u.closest(".e-treegridrows").length>0||u.closest(".e-templatecell").length>0)&&(t.type=="touchstart"?i._dragTooltipTimer=window.setTimeout(function(){i.dragRecord(t);i._multiSelectPopup&&i._multiSelectPopup.is(":visible")&&i._dragTooltip&&i._clearMultiSelectPopup()},550):i.dragRecord(t)),t.ctrlKey||t.shiftKey||t.which==2||t.which==3)return!0;f.isFromGantt||t.type=="touchstart"&&i._on(i.element,"touchmove","#"+i._id+"e-gridcontent",i._touchScroll)}},_touchScroll:function(t){var i=this,l=i.model,r=i._getCoordinate(t),u,o,s,h=i._contentPageX,c=i._contentPageY,f=r.pageX,e=r.pageY;i._isTouchTrigger=!1;dx=f-h;dy=e-c;t.type=="touchmove"&&t.preventDefault();i._mouseDown&&!i._dragMouseDown&&(window.clearTimeout(this._dragTooltipTimer),this._dragTooltipTimer=null,window.clearTimeout(this._dragColumnTooltipTimer),this._dragColumnTooltipTimer=null,u=t.type=="touchmove"?i._getElementByPosition(r.pageX,r.pageY):n(t.target),!l.isFromGantt&&u.closest("div").find(".e-content")&&(s=c<e?-Math.abs(dy):Math.abs(dy),o=h<f?-Math.abs(dx):Math.abs(dx),i._contentPageX=f,i._contentPageY=e,i._updateScrollPosition(u,o,s)))},_updateScrollPosition:function(n,t,i){var r=this,s=r.getScrollElement().ejScroller("option","scrollTop"),h=r.getScrollElement().ejScroller("option","scrollLeft"),u=h+t,f=s+i,e=r.isVScroll()?r.getMaxScrollHeight():null,o=r.getScrollElement().ejScroller("isHScroll")?r.getScrollElement().find(".e-content").get(0).scrollWidth:null;e&&(f=e<f?e:f<0?0:f,(f>0&&s>0||f<e&&s<e)&&(r._$gridContent.scrollTop(0),r.getScrollElement().ejScroller("scrollY",f,!0)));o&&(u=o<u?o:u<0?0:u,(u>0&&h>0||u<o&&h<o)&&(r._$gridContent.scrollLeft(0),r.getScrollElement().ejScroller("scrollX",u,!0)))},_mouseMove:function(t){var i=this,r=this.model;window.clearTimeout(this._dragColumnTooltipTimer);this._dragColumnTooltipTimer=null;i.model.allowColumnResize&&i._headerDragStatus.length==0&&(i._resizer._mouseMove(t),i._resizer._expand&&i._cancelEditState(),n(t.target).parent().css("cursor")!=="col-resize"&&((r.allowSorting||r.showColumnChooser||!r.showColumnChooser&&r.allowFiltering&&r.filterSettings.filterType=="menu")&&!n(t.target).closest("th").hasClass("e-detailheadercell")?i.getHeaderTable().find(".e-columnheader").css({cursor:"pointer"}):i.getHeaderTable().find(".e-columnheader").css({cursor:"default"})))},_mouseUp:function(t){var i=this,u=i.model,f,e;if(i._headerDragStatus!="mousemove"&&u.allowColumnResize)if((n(t.target).hasClass("e-headercelldiv")||n(t.target).hasClass("e-reSizeColbg"))&&(i._focusTreeGridElement(),i._clearColumnMenu()),n(t.target).hasClass("e-reSizeColbg")||n(t.target).closest(".e-gridheader").length>0){if(i._resizer._expand){if(f=t.clientX,e=t.clientY,navigator.userAgent.indexOf("WebKit")!=-1&&(f=t.pageX,e=t.pageY),!r.isNullOrUndefined(i._currentCell)&&this._triggerColumnResize("columnResizeEnd",f,t)){this.element.find(".e-reSizeColbg").remove();i._resizer._expand=!1;u.isFromGantt?i._off(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._off(i.element,"mouseup touchend",i._mouseUp);return}if(i._resizer._mouseUp(t),!r.isNullOrUndefined(i._currentCell)&&i._currentCell>=0&&i._currentCell<u.columns.length&&u.columns[i._currentCell]&&(u.columns[i._currentCell].width=i._resizer._newWidth),!r.isNullOrUndefined(i._currentCell)&&this._triggerColumnResize("columnResized",f,t))return;i.getScrollElement().ejScroller("refresh");i._updateHeaderScrollLeft();i._updateScrollCss()}}else this.element.find(".e-reSizeColbg").remove(),i._resizer._expand=!1,u.isFromGantt?i._off(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._off(i.element,"mouseup touchend",i._mouseUp)},_resizeFilteringElements:function(){var t=this,i,u,n;if(t.model.allowFiltering)for(i={},u=t.model.columns.length,r.TreeGrid.Actions.Filter="filtering",i.requestType=r.TreeGrid.Actions.Filter,n=0;n<u;n++)t.model.columns[n].width=t.columnsWidthCollection[n],i.fieldname=t.model.columns[n].field,this._filteringElements(i)},_enableEditingEvents:function(){var n=this,t=n.model;t.editSettings.allowEditing?r.isTouchDevice()?(n._off(n.element,"doubletap ",".e-gridcontent",n._editdblClickHandler),n._on(n.element,"doubletap ",".e-gridcontent",n._editdblClickHandler)):(n._off(n.element,"dblclick ",".e-gridcontent",n._editdblClickHandler),n._on(n.element,"dblclick ",".e-gridcontent",n._editdblClickHandler)):r.isTouchDevice()?n._off(n.element,"doubletap ",".e-gridcontent",n._editdblClickHandler):n._off(n.element,"dblclick ",".e-gridcontent",n._editdblClickHandler)},_saveCellHandler:function(t){var i=n(t.target),u=this,f=u.model,e;if(f.isFromGantt&&i.closest("tr").length){var o=i.closest("tr"),c=u.getRows(),s=this.getIndexByRow(o),h=f.currentViewData&&f.currentViewData[s];e=f.updatedRecords.indexOf(h)}i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vdown")||i.hasClass("e-vhandlespace")||i.hasClass("e-vscroll")||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hup")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||i.hasClass("e-hscroll")||((i.closest(".e-gridcontent").length>0||i.hasClass(".e-gridcontent"))&&(u._isRowEdit&&this.editFormValidate()?i.closest("form#"+u._id+"EditForm").length==0&&i.closest("form#"+u._id+"EditFrozenForm").length==0&&n("#"+u._id+"EditForm").length>0&&u.saveRow():i.closest(".e-popup").length==0&&i.closest(".e-rowcell").find("#"+u._id+"EditForm").length==0&&i.closest("form#"+u._id+"EditFrozenForm").length==0&&n("#"+u._id+"EditForm").length>0&&this.editFormValidate()&&u.saveCell()),f.selectedMode!="row"||!f.isFromGantt||!f.updatedRecords.length||r.isNullOrUndefined(e)||i.hasClass("e-treegridexpand")||i.hasClass("e-treegridcollapse")||this.selectedRowIndex()==e||u._rowSelectingEventTrigger(this.selectedRowIndex(),e)||(f.allowSelection&&u.selectRows(e),u._rowSelectedEventTrigger(e)))},_contextMenuAction:function(t){var i=this,r,f=i.model,u=i._getCoordinate(t);if(r=t.type=="taphold"?i._getElementByPosition(u.pageX,u.pageY):n(t.target),t.preventDefault(),f.contextMenuSettings.showContextMenu&&r.closest(".e-gridcontent").length>0){if(t.which!=3||i._isTouchEvent)return i._contextMenuHandler=!0,!0;i._rightClick(t)}else return t.preventDefault(),t.stopPropagation(),!1},_rightClick:function(t){var i=this,e=i.model,u=n(t.target),l=u[0].parentNode,h,f,o,c={},s=!1,a=i.getUpdatedRecords();if(u.closest(".e-treegrid").attr("id")!==this._id)return!1;if(e.selectionSettings.selectionMode=="cell"&&e.editSettings.editMode!="dialogEditing"&&(e.editSettings.editMode="cellEditing"),i.model.contextMenuSettings.showContextMenu){if(i._clearContextMenu(),this._removeDetailsRow(),i.disableTooltip(),u.hasClass("e-summaryrowcell")||u.hasClass("e-summarytitle"))return;(u.hasClass("e-cell")||u.hasClass("e-treegridexpand"))&&(l=u.closest("tr"));h=u.closest("tr");f=i.getIndexByRow(h);i.model.currentViewData=i.getCurrentViewData();o=i.model.currentViewData[f];f=a.indexOf(o);c.data=o;c.recordIndex=f;e.isEdit?s=u.closest(".e-rowcell").find("form#"+i._id+"EditForm").length>0||u.closest(".e-rowcell").find("form#"+i._id+"EditFrozenForm").length>0:this._isRowEdit&&(s=u.closest(".e-rowedit").find("form#"+i._id+"EditForm").length>0||u.closest(".e-rowedit").find("form#"+i._id+"EditFrozenForm").length>0||u.closest(".e-addedrow").find("form#"+i._id+"EditForm").length>0||u.closest(".e-addedrow").find("form#"+i._id+"EditFrozenForm").length>0);!s&&i.editFormValidate()&&(e.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());i.dataSource()==null||i.dataSource().length==0||s||e.flatRecords.length==0?(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._subContextMenuItems=[],i._updateContextmenuOption(f,o),i._clearContextMenu(),i._contextMenuItems.length>0&&i._renderContextMenu(t,f,o,s)):o&&(t.preventDefault(),i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._subContextMenuItems=[],i._subContextMenuItems=i._getsubContextMenuItems(),i._updateContextmenuOption(f,o),i._clearContextMenu(),e.selectionSettings.selectionMode=="row"&&e.allowSelection&&!i._rowSelectingEventTrigger(this.selectedRowIndex(),f)&&(i.selectRows(f),i._rowSelectedEventTrigger(f)),e.selectionSettings.selectionMode=="cell"&&(selectCellIndex=i.getCellIndex(t),i.selectCells([{rowIndex:f,cellIndex:selectCellIndex}]),i._rowIndexOfLastSelectedCell=f),i._contextMenuItems.length>0&&i._renderContextMenu(t,f,o,s),i.editFormValidate()&&i._cancelSaveTools())}i._clearColumnMenu();i._contextMenuHandler=!1;!i.model.isFromGantt&&e.contextMenuSettings.showContextMenu&&(r.isTouchDevice()?i._off(i.element,"taphold",i._contextMenuAction):i._off(i.element,"contextmenu",i._contextMenuAction));return},_editdblClickHandler:function(t){var i=this,e=i.model,s=n("#"+i._id+"EditForm"),c={},f=n(t.target),a=f.closest("tr"),h,v=i._cellEditingDetails,o,l;if(e.readOnly==!0)return!0;if((updatedRecords=i.getUpdatedRecords(),!f.hasClass("e-vhandle")&&!f.hasClass("e-vscrollbar")&&!f.hasClass("e-vup")&&!f.hasClass("e-vdown")&&!f.hasClass("e-vhandlespace")&&!f.hasClass("e-treegridexpand")&&!f.hasClass("e-treegridcollapse"))&&!f.hasClass("e-hhandle")&&!f.hasClass("e-hscrollbar")&&!f.hasClass("e-hup")&&!f.hasClass("e-hdown")&&!f.hasClass("e-hhandlespace")&&!f.hasClass("e-summaryrowcell")&&!f.hasClass("e-footersummaryrowcell")&&!f.hasClass("e-summarytitle")&&!f.hasClass("e-lastsummaryrow")){if(f.closest(".e-treegrid").length&&f.closest(".e-treegrid").attr("id")!==this._id)return!1;if(f.hasClass("e-rowcell")||f.parent().hasClass("e-rowcell")||f.closest("td").hasClass("e-rowcell")||f.closest("td").hasClass("e-rowcell")&&f.hasClass("e-cell")){if(e.editSettings.editMode==="normal"&&e.editSettings.allowEditing&&(c.requestType=r.TreeGrid.Actions.BeginEdit,i._trigger("actionBegin",c)),i._cellEditingDetails.cancelSave){i._cellEditingDetails.cancelSave=!1;return}if(s.length===0&&i.getRows()!==null){if(e.editSettings.editMode.toLowerCase()=="cellediting"){if(i._focusTreeGridElement(),i._cellEditingDetails.columnIndex=i.getCellIndex(t),e.editSettings.beginEditAction!="click"&&(i._cellEditingDetails.rowIndex=i.getRowIndex(t)),h=e.currentViewData[i._cellEditingDetails.rowIndex],h.summaryRow)return;if(e.selectedItem=h,e.columns[v.columnIndex].allowEditing==!1)return;fieldName=i._cellEditingDetails.columnIndex>=0&&e.columns[i._cellEditingDetails.columnIndex].field;fieldName&&(i.updateScrollBar(),e.editSettings.allowEditing&&e.editSettings.editMode.toLowerCase()==r.TreeGrid.EditMode.CellEditing.toLowerCase()&&i.cellEdit(i._cellEditingDetails.rowIndex,fieldName))}else(e.editSettings.editMode.toLowerCase()=="rowediting"||e.editSettings.editMode.toLowerCase()=="dialogediting")&&(e.currentViewData=i.getCurrentViewData(),i.getCellIndex(t)!=-1&&i.getRowIndex(t)!=-1&&(i._cellEditingDetails.columnIndex=i.getCellIndex(t),o=i.getRowIndex(t),e.enableVirtualization&&(l=e.selectionSettings.selectionMode=="row"?e.selectedItem:e.updatedRecords[i._rowIndexOfLastSelectedCell],o=updatedRecords.indexOf(l)),i.model.editSettings.editMode.toLowerCase()=="dialogediting"?i._showTreeGridAddEditDialog(o):(i.updateScrollBar(),i._editRow(o,u,i._cellEditingDetails.columnIndex))));s=n("#"+i._id+"EditForm");s.length>0&&i._editAddTools();n.isFunction(n.validator)&&(i._initValidator(),i.setValidation())}i.model.allowSelection||a.find(".e-active").removeClass("e-active").removeClass("e-selectionbackground");i._clearContextMenu();this._removeDetailsRow()}}},_popupHide:function(t){var u=this,f=u.model.columns,o=null,c=null,s=null,h=t&&n(t).closest("td"),l,e;for(u.model.allowFiltering&&u.model.filterSettings.filterType=="filterbar"&&(h=t&&n(t).closest("td, th")),l=n("#"+u._id+"_ColumnMenu").length,l>0&&(r.isTouchDevice()||u._clearColumnMenu()),i=0;i<f.length;i++)o=null,f[i]&&(s=f[i].field.split(".").join(""),f[i].editType=="datepicker"||f[i].editType=="datetimepicker"?o=n("#"+u._id+s).data("ejDatePicker"):f[i].editType=="dropdownedit"&&(e=n("#"+u._id+s).data("ejDropDownList"),e&&n(h).find("#"+e._id).length==0&&e.hidePopup()),o&&n(h).find("#"+o._id).length==0&&o.hide(),(f[i].filterEditType=="datepicker"||f[i].filterEditType=="datetimepicker")&&(c=n("#"+u._id+"_"+s+"_filterbarcell").data("ejDatePicker"),c&&n(h).find("#"+c._id).length==0&&c.hide()),f[i].filterEditType=="dropdownedit"&&(e=n("#"+u._id+"_"+s+"_filterbarcell").data("ejDropDownList"),e&&n(h).find("#"+e._id).length==0&&e.hidePopup()))},_mouseWheel:function(n){var t=this,i=null,e=n;if(t._popupHide(),n=n.originalEvent,t.getScrollElement().height()>t._$gridContainer.height()){t.getScrollElement().ejScroller("scrollY",0,!0);return}if(n.wheelDelta?(i=-n.wheelDelta/120,window.opera&&parseFloat(window.opera.version,10)<10&&(i=-i)):n.detail&&(i=n.detail/3),!i)return!1;var u=t.getScrollElement().ejScroller("option","scrollTop"),r=u+i*57,f=this.model.isFromGantt?parseInt(t.model.updatedRecords.length*model.rowHeight)-(t._viewPortHeight-18):this.getMaxScrollHeight();if(r>f&&(r=f),r<0&&(r=0),u!=r)try{n.preventDefault?n.preventDefault():e.preventDefault()}catch(o){}return t.updateScrollTop(r),!0},_getCollapsedParentItem:function(n){var t=n.parentItem;return t?this.getExpandStatus(t)===!0?t:this._getCollapsedParentItem(t):null},updateScrollBar:function(n){var t=this,u=t.model,o=0,f,a,s=u.rowHeight+t._detailsRowHeight,v,h,e=t.getUpdatedRecords(),y,l;y=u.allowSelection?u.selectionSettings.selectionMode=="row"?this.selectedItem():e[t._rowIndexOfLastSelectedCell]:this.selectedItem();f=u.allowPaging?e:t.getExpandedRecords(e);a=n||n==0?f.indexOf(e[n]):f.indexOf(y);var i=a*s,w=i+u.rowHeight,c,p=t.getScrollElement().children(".e-content").length;c=p?t.getScrollElement().children(".e-content").scrollTop():t.getScrollElement().scrollTop();(t.getScrollElement().ejScroller("isHScroll")||t.element.find(".e-borderbox").length>0)&&(o=18);v=i<c;h=c+t._viewPortHeight-o<=w;(v||h)&&(i+t._viewPortHeight>f.length*s&&(i=f.length*s-t._viewPortHeight,h&&(i+=o)),l={requestType:r.TreeGrid.Actions.Scroll,delta:i},p?t.updateScrollTop(i):(t.getScrollElement().scrollTop(l.delta),t._completeAction(l)),u.enableVirtualization&&t._focusTreeGridElement())},_keyPressed:function(t,i){var u=this,f=this.model,ct,c,s=u.getUpdatedRecords(),ui,kt,v=f.allowPaging?s:u.getExpandedRecords(f.updatedRecords),ut,e,pt,b,a,fi,h,et,ci,ot,li,dt,ai,ei,wt,st,o,rt,lt,at,ht,nt,tt,vt,y,oi,si,yi,pi,d,yt,g,k,gt,hi,it,ft,ri,bt,w,l,p,ni;if(this._removeDetailsRow(),!f.allowKeyboardNavigation)return!1;if(this.model.editSettings.editMode=="dialogEditing"&&n(i).closest("#"+this._id+"_dialogEdit").length||(pt=!1,b=n(i),$form=n("#"+u._id+"EditForm"),t!="downArrow"&&t!="upArrow"&&t!="saveRequest"&&t!="moveCellLeft"&&t!="moveCellRight"&&t!="cancelRequest"&&b.prop("tagName")=="INPUT"))return!0;f.isFromGantt?(a=n("#"+u._id.replace("ejTreeGrid","")+"_ContextMenu"),fi=n("#"+u._id.replace("ejTreeGrid","")+"_SubContextMenu")):(a=n("#"+u._id+"_ContextMenu"),fi=n("#"+u._id+"_SubContextMenu"));h=n("#"+u._id+"_ColumnMenu");et=n("#"+u._id+"ccDiv_wrapper");u._columnMenuTarget&&(dt=n.trim(u._columnMenuTarget.prev("div.e-headercelldiv").attr("ej-mappingname")),o=u.getColumnByField(dt),o&&(o.filterEditType?(rt=o.filterEditType.indexOf("edit"),filtertype=o.filterEditType):(rt=o.editType.indexOf("edit"),filtertype=o.editType),rt!=-1?(ui=filtertype.slice(0,rt),kt=ui.charAt(0).toUpperCase()+ui.slice(1),ut=n("#"+u._id+"filter"+kt+"MenuDiv_wrapper")):(kt=filtertype.charAt(0).toUpperCase()+filtertype.slice(1),ut=n("#"+u._id+"filter"+kt+"MenuDiv_wrapper"))),li=!r.isNullOrUndefined(ut)&&ut.is(":visible"));ci=fi.css("visibility")=="visible"?!0:!1;ot=et.is(":visible");switch(t){case"saveRequest":if(a.length==0&&h.length==0)(u._isRowEdit||u.model.isEdit)&&(b.blur(),u._endEdit(),u._focusTreeGridElement()),f.filterSettings.filterBarMode=="onEnter"&&f.filterSettings.filterType=="filterbar"&&f.allowFiltering&&b.closest("th").hasClass("e-filterbarcell")&&u._filterBarHandler(i);else if(a.length)u._moveToNextMenuItem("save");else if(h.length&&(g=null,k=et.find("div.e-columnmenuselection"),ot?g=k.data("column"):(d=h.find("div.e-columnmenuselection"),d.length>0&&(g=d[0].id)),!r.isNullOrUndefined(g))){b=u._columnMenuTarget;dt=n.trim(b.prev("div.e-headercelldiv").attr("ej-mappingname"));o=u.getColumnByField(dt);switch(g){case u._id+"_SortAscendingChooser":u.model.allowMultiSorting&&(u._multiSortRequest=!0);f.isFromGantt?u.sortColumn(o.mappingName,r.sortOrder.Ascending):u.sortColumn(o.field,r.sortOrder.Ascending);u._multiSortRequest=!1;break;case u._id+"_SortDescendingChooser":u.model.allowMultiSorting&&(u._multiSortRequest=!0);f.isFromGantt?u.sortColumn(o.mappingName,r.sortOrder.Descending):u.sortColumn(o.field,r.sortOrder.Descending);u._multiSortRequest=!1;break;case u._id+"_FreezeColumnsChooser":o&&!n(u._id+"_FreezeColumnChooser").hasClass("e-disable")&&(u._checkboxSelection&&f.columns[0].nonColumn&&!f.columns[0].isFrozen&&(f.columns[0].isFrozen=!0),u.freezeColumn(o.field,!0));break;case u._id+"_UnfreezeColumnsChooser":o&&!n(u._id+"_UnfreezeColumnChooser").hasClass("e-disable")&&(u._checkboxSelection&&u._frozenColumnsLength==2&&f.columns[0].nonColumn&&f.columns[0].isFrozen&&(f.columns[0].isFrozen=!1),u.freezeColumn(o.field,!1));break;case u._id+"_FreezePrecedingColumnsChooser":o&&!n(u._id+"_FreezePrecedingColumnsChooser").hasClass("e-disable")&&u.freezePrecedingColumns(o.field);break;case u._id+"_ColumnLeftChooser":o&&!n(u._id+"_ColumnLeftChooser").hasClass("e-disable")&&u.insertColumnChooser(o,"left");break;case u._id+"_ColumnRightChooser":o&&!n(u._id+"_ColumnRightChooser").hasClass("e-disable")&&u.insertColumnChooser(o,"right");break;case u._id+"_DeleteColumnChooser":o&&!n(u._id+"_DeleteColumnChooser").hasClass("e-disable")&&(u._targetColumnIndex=f.columns.indexOf(o),u._updateConfirmDialog.ejDialog("open"),u._clearColumnMenu());break;case u._id+"_RenameColumnChooser":o&&!n(u._id+"_RenameColumnChooser").hasClass("e-disable")&&(u._targetColumnIndex=f.columns.indexOf(o),u._renderColumnRenameDialog(o),u._columnRenameDialog.ejDialog("open"),u._clearColumnMenu());break;case u._id+"_FilterChooser":o&&n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon")&&(ai=ut[0].id.substring(u._id.length,ut[0].id.indexOf("MenuDiv")),u._showFilterMenu(null,ai,null,null,null,null,null,null,o));break;case u._id+"_ColumnsChooser":o&&n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon")&&!u.model.isFromGantt&&u._adaptiveColumnChooser();break;default:k.find("span").hasClass("e-disable")||(gt=k.find("span").attr("aria-checked"),gt=="true"?u.hideColumn(g):u.showColumn(g))}}break;case"cancelRequest":a.length==0&&h.length==0?($form.length>0&&(st=f.editSettings.editMode,st.toLowerCase()=="cellediting"?u._isRowEdit?u.cancelRowEditCell():u.cancelEditCell():st.toLowerCase()=="rowediting"&&u.cancelRowEditCell(),u._cancelSaveTools()),u._focusTreeGridElement(),u._dragMouseDown==!0&&(n(u._dragmouseOverTooltip).remove(),n(".intend").find(".e-icon").css({display:"none"}),n(".intendparent").find(".e-icon").css({display:"none"}),u._dropCancel=!0,u._dragMouseDown=!1,u._dragTooltip=!1,u._headerDragStatus="",u._dragTargetItem&&u._dragTargetItem.hasChildRecords&&u._dragTargetItem.level==0&&(ei=r.TreeGrid.getRowByIndex(this,s.indexOf(u._dragTargetItem)),u._dragTargetItem?ei.find(".e-treegridexpand").css({display:"inline-block"}):ei.find(".e-treegridcollapse").css({display:"inline-block"})),u._off(u.element,"touchmove",".e-treegridrows, .e-templatecell",u.dragToolTip),u._off(u.element,"mousemove",".e-treegridrows, .e-templatecell",u.dragToolTip))):(u._clearContextMenu(),u._clearColumnMenu());break;case"editRecord":if(a.length==0&&h.length==0&&(f.selectionSettings.selectionMode=="cell"&&f.editSettings.editMode!="dialogEditing"&&(f.editSettings.editMode="cellEditing"),wt=f.editSettings,st=wt.editMode,f.readOnly==!1&&(wt.allowEditing&&f.selectedItems.length==1||wt.allowEditing&&f.selectionSettings.selectionMode=="cell"||wt.allowEditing&&f.selectedItem&&u._checkboxSelection)))if(st.toLowerCase()=="cellediting"||f.selectionSettings.selectionMode=="cell"){if(o=u.model.columns[u._cellIndex],r.isNullOrUndefined(o)||!o.visible||o.allowEditing==!1)return;u._cellEditingDetails.rowIndex=f.selectionSettings.selectionMode==="cell"?this._rowIndexOfLastSelectedCell:this.selectedRowIndex();u._cellEditingDetails.columnIndex=u._cellIndex;f.selectedItem=s[this.selectedRowIndex()];u._cellEditingDetails.columnIndex>-1&&(u.updateScrollBar(),fieldName=o.field,fieldName&&u.cellEdit(u._cellEditingDetails.rowIndex,fieldName),u._editAddTools())}else st.toLowerCase()!="rowediting"||u._isRowEdit||f.selectionSettings.selectionMode=="cell"?st.toLowerCase()=="dialogediting"&&f.selectionSettings.selectionMode!="cell"&&(rt=u.selectedRowIndex(),rt>=0&&u._showTreeGridAddEditDialog(rt)):(rt=u.selectedRowIndex(),rt>=0&&(u.updateScrollBar(),u._editRow(rt)));break;case"topRowSelection":if(f.allowPaging&&a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(lt=0,s[0].isSummaryRow&&(nt=u._getNextRecord(lt+1,s,t),lt=s.indexOf(nt)),u._rowSelectingEventTrigger(this.selectedRowIndex(),lt)||(u.selectRows(lt),u._focusTreeGridElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(lt)))}break;case"nextPage":f.allowPaging&&(at=u._currentPage(),u._focusTreeGridElement(),at<f.pageSettings.totalPages&&u.gotoPage(at+1));break;case"prevPage":f.allowPaging&&(at=u._currentPage(),u._focusTreeGridElement(),at!=1&&u.gotoPage(at-1));break;case"bottomRowSelection":if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(ht=s.length-1,s[ht].isSummaryRow&&(nt=u._getNextRecord(ht-1,s,t),ht=s.indexOf(nt)),u._rowSelectingEventTrigger(this.selectedRowIndex(),ht)||(u.selectRows(ht),u._focusTreeGridElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(ht)))}break;case"firstRowSelection":if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(f.selectionSettings.selectionMode=="row"?(f.allowPaging&&u.gotoPage(1),f.allowSelection&&!u._rowSelectingEventTrigger(this.selectedRowIndex(),0)&&(u.selectRows(0),u.updateScrollBar(),u._focusTreeGridElement(),u._rowSelectedEventTrigger(0))):f.selectionSettings.selectionMode=="cell"&&(p=u._focusingRowIndex,tt={rowIndex:p,cellIndex:0},u._isShiftKeyNavigation=!1,u._cellIndex=0,u.selectCells([tt])),u._cancelSaveTools())}break;case"lastRowSelection":if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(ct=v.length-1,e=v[ct],e.isSummaryRow&&(e=u._getNextRecord(ct-1,v,t)),f.allowPaging&&e&&(u.gotoPage(f.pageSettings.totalPages),s=u._updatedPageData),c=s.indexOf(e),f.selectionSettings.selectionMode=="row"?f.allowSelection&&!u._rowSelectingEventTrigger(this.selectedRowIndex(),c)&&(u.selectRows(c),u._focusTreeGridElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(c)):f.selectionSettings.selectionMode=="cell"&&(p=u._focusingRowIndex,ni=f.columns,u._isShiftKeyNavigation=!1,u._cellIndex=ni.length-1,tt={rowIndex:p,cellIndex:u._cellIndex},u.selectCells([tt])),u._cancelSaveTools())}break;case"moveCellLeft":a.length==0&&h.length==0&&(u._isRowEdit?(previousElement=b.closest("td").prev("td"),this._frozenColumnsLength>0&&previousElement.length==0&&b.closest("#"+u._id+"EditForm").length>0&&(previousElement=n("#"+u._id+"EditFrozenForm").find("td").last()),previousElement.length&&u._focusElementsForRowEdit(previousElement)):f.editSettings.allowEditing&&f.editSettings.editMode.toLowerCase()=="cellediting"&&$form.length>0&&u.editFormValidate()&&(b.blur(),pt=u._moveCurrentCell("left")),f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&!u._isRowEdit&&(u._focusingRowIndex!=0||u._cellIndex!=0)&&(u.model.isEdit?(u._focusingRowIndex=u._cellEditingDetails.rowIndex,u._cellIndex=u._cellEditingDetails.columnIndex,tt={rowIndex:u._focusingRowIndex,cellIndex:u._cellIndex},u.selectCells([tt])):u._selectNextCell("left",t)));break;case"moveCellRight":a.length==0&&h.length==0&&(u._isRowEdit?(nextElement=b.closest("td").next("td"),this._frozenColumnsLength>0&&nextElement.length==0&&b.closest("#"+u._id+"EditFrozenForm").length>0&&(nextElement=n($form).find("td").eq(0)),nextElement.length&&u._focusElementsForRowEdit(nextElement)):f.editSettings.allowEditing&&(f.editSettings.editMode=="cellEditing"||f.selectionSettings.selectionMode=="cell")&&b&&$form.length>0&&this.editFormValidate()&&(b.blur(),pt=u._moveCurrentCell("right")),f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&!u._isRowEdit&&(u._focusingRowIndex!=u.getRows().length-1||u._cellIndex!=bt-1)&&(u.model.isEdit?(u._focusingRowIndex=u._cellEditingDetails.rowIndex,u._cellIndex=u._cellEditingDetails.columnIndex,tt={rowIndex:u._focusingRowIndex,cellIndex:u._cellIndex},u.selectCells([tt])):u._selectNextCell("right",t)));break;case"downArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;if(s.length>0&&f.selectedItem&&u.selectedRowIndex()>-1&&f.selectionSettings.selectionMode=="row")ct=s.length-1,u.selectedRowIndex()!=ct&&(it=s[u.selectedRowIndex()],c=v.indexOf(it),e=v[c+1],e&&e.isSummaryRow&&(e=u._getNextRecord(c+1,v)),c=s.indexOf(e),e&&c<=ct&&f.allowSelection&&!u._rowSelectingEventTrigger(this.selectedRowIndex(),c)&&(u.selectRows(c),u.updateScrollBar(),u._focusTreeGridElement(),u._rowSelectedEventTrigger(u.selectedRowIndex()))),u._cancelSaveTools();else if(f.selectionSettings.selectionMode=="cell"&&u.selectedCellIndexes().length>0){var p=u._focusingRowIndex+1,w=u._cellIndex,vi=s.length;u._isShiftKeyNavigation=!1;p<vi&&(it=s[u._rowIndexOfLastSelectedCell],c=v.indexOf(it),e=v[c+1],e&&e.isSummaryRow&&(e=u._getNextRecord(c+1,v),p=s.indexOf(e)),e&&(tt={rowIndex:p,cellIndex:w},u._focusingRowIndex=p,u.selectCells([tt]),u.updateScrollBar()))}}else a.length?u._moveToNextMenuItem("next"):h.length&&(ot?(k=et.find("div.e-columnmenuselection"),vt=k.next("div.e-columnMenuListDiv"),vt.length>0&&(k.removeClass("e-columnmenuselection"),vt.addClass("e-columnmenuselection"))):(d=h.find("div.e-columnmenuselection"),vt=u._findNextColumnMenuItem(d,"next"),vt.length>0&&(d.removeClass("e-columnmenuselection"),vt.addClass("e-columnmenuselection"),u._focusTreeGridElement(),u._clearFilterMenu())));break;case"rightArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;var p=u.selectedRowIndex(),nt=s[p],l={},ti;l.data=nt;l.recordIndex=p;l.expanded=!0;nt&&nt.hasChildRecords&&!nt.expanded&&u.selectedRowIndex()>=0&&(ti=u._trigger("expanding",l),ti||f.isFromGantt||r.TreeGrid.sendExpandCollapseRequest(u,l),f.enableVirtualization&&u._focusTreeGridElement(),u.updateScrollBar());u._cancelSaveTools();f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&(u._focusingRowIndex!=u.getRows().length-1||u._cellIndex!=bt-1)&&u._selectNextCell("right",t)}else if(a.length&&!ci)u._moveToNextMenuItem("expand");else if(h.length&&!ot)if(y={},y.width="auto",y.height="auto",y.minWidth="0px",y.minHeight="0px",y.showHeader=!1,y.position={X:1,Y:1},y.enableModal=!1,y.isResponsive=!1,y.enableResize=!1,n("#"+u._id+"ccDiv_wrapper").addClass("e-treegridadaptivedialog"),n("#"+u._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content"),n("#"+u._id+"ccDiv").ejDialog(y),n("#"+u._id+"ccDiv").css({height:"auto"}),d=h.find("div.e-columnmenuselection"),oi=et.find("div.e-columnMenuListDiv"),columnListPosX=u._columnListPosX,columnFilterPosX=u._columnFilterPosX,columnChooserListIndex=u._columnChooserListIndex,windowWidth=n(document).width(),d.length>0&&d[0].id==u._id+"_ColumnsChooser"&&!n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon"))si=n("#"+u._id+"ccDiv").ejDialog("instance"),yi=n("#"+u._id+"ccDiv_wrapper").width(),si.open(),windowWidth<columnListPosX+h.width()&&(columnListPosX=columnListPosX-h.width()-yi),pi={X:columnListPosX,Y:posY+n("#"+u._id+"_ColumnsChooser").position().top},si.option({position:pi}),et.css("z-index",u.getMaxZIndex()+1),oi.removeClass("e-columnmenuselection"),oi.eq(0).addClass("e-columnmenuselection"),u._focusTreeGridElement(),u._renderedSubMenuType="ColumnDesktop";else if(d.length>0&&d[0].id==u._id+"_FilterChooser"&&!n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon")){var ki=ut[0].id.indexOf("_"),ii="#"+ut[0].id.slice(0,ki),wi=n(ii).ejDialog("instance"),bi,di,u=this,y={};y.width="auto";y.height="auto";y.minWidth="0px";y.minHeight="0px";y.showHeader=!1;y.position={X:1,Y:1};y.enableModal=!1;y.isResponsive=!1;y.enableResize=!1;n(ii+"_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content");n(ii).ejDialog(y);windowWidth<columnFilterPosX+n("#"+ut[0].id).width()&&(columnFilterPosX=columnFilterPosX-h.width()-n("#"+FilterMenuDiv[0].id).width());di=h.find("div.e-columnmenuselection").closest("li").index();bi={X:columnFilterPosX,Y:posY+n("#"+u._id+"_FilterChooser").position().top};wi.option({position:bi});wi.open();u._updatePreviousFilteredValue(o);ut.css("z-index",u.getMaxZIndex()+1);u._focusTreeGridElement();u._renderedSubMenuType=ii+"Desktop"}break;case"leftArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;var p=u.selectedRowIndex(),nt=s[p],l={},ti;l.data=nt;l.recordIndex=p;l.expanded=!1;nt&&nt.hasChildRecords&&nt.expanded&&u.selectedRowIndex()>=0&&(ti=u._trigger("collapsing",l),ti||f.isFromGantt||r.TreeGrid.sendExpandCollapseRequest(u,l),f.enableVirtualization&&u._focusTreeGridElement(),u.updateScrollBar());u._cancelSaveTools();f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&(u._focusingRowIndex!=0||u._cellIndex!=0)&&u._selectNextCell("left",t)}else a.length?u._moveToNextMenuItem("collapse"):h.length&&(ot||li)&&(n("#"+u._id+"ccDiv").ejDialog("close"),u._clearFilterMenu());break;case"upArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;if(f.selectionSettings.selectionMode=="row"&&this.selectedRowIndex()>0&&s.length>0&&f.selectedItem)it=s[u.selectedRowIndex()],c=v.indexOf(it),e=v[c-1],e.isSummaryRow&&(e=u._getNextRecord(c-1,v,t)),c=s.indexOf(e),c==-1||u._rowSelectingEventTrigger(this.selectedRowIndex(),c)||(u.selectRows(c),u.updateScrollBar(),u._focusTreeGridElement(),u._rowSelectedEventTrigger(u.selectedRowIndex())),u._cancelSaveTools();else if(f.selectionSettings.selectionMode=="cell"){var p=u._focusingRowIndex-1,w=u._cellIndex,vi=f.flatRecords.length;u._isShiftKeyNavigation=!1;p!=-1&&(it=s[u._rowIndexOfLastSelectedCell],c=v.indexOf(it),e=v[c-1],e&&e.isSummaryRow&&(e=u._getNextRecord(c-1,v,t),p=s.indexOf(e)),e&&(tt={rowIndex:p,cellIndex:w},u._focusingRowIndex=p,u.selectCells([tt]),u.updateScrollBar()))}}else a.length?u._moveToNextMenuItem("prev"):h.length&&(ot?(k=et.find("div.e-columnmenuselection"),yt=k.prev("div.e-columnMenuListDiv"),yt.length>0&&(k.removeClass("e-columnmenuselection"),yt.addClass("e-columnmenuselection"))):(d=h.find("div.e-columnmenuselection"),yt=u._findNextColumnMenuItem(d,"prev"),yt.length>0&&(d.removeClass("e-columnmenuselection"),yt.addClass("e-columnmenuselection"),u._clearFilterMenu())));break;case"deleteRecord":if(f.readOnly==!1&&f.editSettings.allowDeleting&&a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;u.selectedRowIndex()>=0&&(u.deleteRow(),u._cancelSaveTools(),u._focusTreeGridElement())}break;case"totalRowCollapse":if(a.length==0&&h.length==0){u.model.isFromGantt?(l={},l.requestType="collapseAll",u._trigger("expandAllCollapseAllRequest",l)):u.collapseAll();break}case"totalRowExpand":a.length==0&&h.length==0&&(u.model.isFromGantt?(l={},l.requestType="expandAll",u._trigger("expandAllCollapseAllRequest",l)):u.expandAll());break;case"spaceBar":g=null;h.length&&ot&&(k=et.find("div.e-columnmenuselection"),g=k.data("column"),r.isNullOrUndefined(g)||k.find("span").hasClass("e-disable")||(gt=k.find("span").attr("aria-checked"),gt=="true"?u.hideColumn(g):u.showColumn(g)));u._checkboxSelection&&b.hasClass("e-treegrid")&&n("#"+u._id+"EditForm").length==0&&(u.selectRows(this.selectedRowIndex(),null,!0),u._cancelSaveTools());break;case"shiftDownArrow":if(f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"){var vi=s.length,hi=u._selectedCellDetails.length,it=s[u._rowIndexOfLastSelectedCell];if(c=v.indexOf(it),e=v[c+1],e&&e.isSummaryRow&&(e=u._getNextRecord(c+1,v)),!e)return;if(nextRowIndex=s.indexOf(e),u._focusingRowIndex>u._rowIndexOfLastSelectedCell){for(u._rowIndexOfLastSelectedCell=nextRowIndex,u._selectedCellDetails.sort(function(n,t){return parseFloat(n.rowIndex)-parseFloat(t.rowIndex)}),u._getSelectedCellsinARow(u._selectedCellDetails[0].data.index,u._selectedCellDetails),ft=0;ft<u._selectedCellsinARow.length;ft++)ri=u._selectedCellDetails.indexOf(u._selectedCellsinARow[ft]),n(u._selectedCellsinARow[ft].cellElement).removeClass("selectingcell"),u._selectedCellDetails.splice(ri,1);u.updateScrollBar()}else nextRowIndex<vi&&(l={rowIndex:nextRowIndex,cellIndex:u._lastSelectedCellIndex},u.updateScrollBar(),u._shiftKeySelectCells(l),u._rowIndexOfLastSelectedCell=nextRowIndex)}break;case"shiftUpArrow":if(f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"){if(hi=u._selectedCellDetails.length,it=s[u._rowIndexOfLastSelectedCell],c=v.indexOf(it),e=v[c-1],e&&e.isSummaryRow&&(e=u._getNextRecord(c-1,v,"upArrow")),!e)return;if(nextRowIndex=s.indexOf(e),hi>0&&u._focusingRowIndex<u._rowIndexOfLastSelectedCell){for(u._rowIndexOfLastSelectedCell=nextRowIndex,u._getSelectedCellsinARow(u._selectedCellDetails[hi-1].data.index,u._selectedCellDetails),ft=0;ft<u._selectedCellsinARow.length;ft++)ri=u._selectedCellDetails.indexOf(u._selectedCellsinARow[ft]),n(u._selectedCellsinARow[ft].cellElement).removeClass("selectingcell"),u._selectedCellDetails.splice(ri,1);u.updateScrollBar()}else nextRowIndex>=0&&(l={rowIndex:nextRowIndex,cellIndex:u._lastSelectedCellIndex},u._rowIndexOfLastSelectedCell=nextRowIndex,u.updateScrollBar(),u._shiftKeySelectCells(l))}break;case"shiftRightArrow":f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(bt=f.columns.length,w=u._lastSelectedCellIndex+1,w<bt-1&&(!f.columns[w].visible||!f.columns[w].allowCellSelection)&&(w=u.getUpNextVisibleColumnIndex(w)),w<bt&&(l={rowIndex:u._rowIndexOfLastSelectedCell,cellIndex:w},u._shiftKeyFirstElementDetails.firstElementRowIndex=u._focusingRowIndex,u._shiftKeySelectCells(l),u._lastSelectedCellIndex=w));break;case"shiftLeftArrow":f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(w=u._lastSelectedCellIndex-1,w==-1||f.columns[w].visible&&f.columns[w].allowCellSelection||(w=u.getPreviousVisibleColumnIndex(w)),l={rowIndex:u._rowIndexOfLastSelectedCell,cellIndex:w},w!=-1&&(u._shiftKeyFirstElementDetails.firstElementRowIndex=u._focusingRowIndex,u._shiftKeySelectCells(l),u._lastSelectedCellIndex=w));break;case"shiftHomeButton":f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(p=u._rowIndexOfLastSelectedCell,l={rowIndex:p,cellIndex:0},u._cellIndex=0,u._lastSelectedCellIndex=0,u._shiftKeySelectCells(l));break;case"shiftEndButton":f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(p=u._rowIndexOfLastSelectedCell,ni=f.columns,u._cellIndex=ni.length-1,l={rowIndex:p,cellIndex:u._cellIndex},u._lastSelectedCellIndex=u._cellIndex,u._shiftKeySelectCells(l));break;default:pt=!0}return pt},_clearAllFilter:function(){var n=this,t=n.model.filterSettings.filteredColumns[0];n.model.allowFiltering=!0;n.model.filterSettings.filteredColumns=[];n.filterColumn(t.field,t.operator,"","and");n._filteredColumnValue=[];n._filteredColumnValueID=[]},filterColumn:function(t,i,u,f,e,o){var p=this,k=p.model,h=k.filterSettings.filteredColumns,c,v,d,l,s,a,y,b;if(this.model.allowFiltering){for(c={},r.TreeGrid.Actions.Filter="filtering",c.requestType=r.TreeGrid.Actions.Filter,c.currentFilterObject=[],n.isArray(i)||(i=n.makeArray(i)),n.isArray(u)||(u=n.makeArray(u)),v=!1,d=this._filterCollection,r.util.isNullOrUndefined(this._currentFilterColumn)&&(this._currentFilterColumn=this.getColumnByField(t)),l=0;l<i.length;l++){if(s={field:t,operator:i[l],value:u[l],matchcase:e,predicate:f,actualFilterValue:o},this._$colType="string",h.length==0&&s.value!=="")this._$colType=="date"&&(i=="equal"||i=="notequal")&&typeof s.value!="string"?this._setDateFilters(s):h.push(s);else{if(p=this,!v){var g=r.DataManager(h),nt=(new r.Query).where("field",r.FilterOperators.equal,s.field),w=g.executeLocal(nt);for(a=0;a<w.length;a++)y=n.inArray(w[a],h),y!=-1&&h.splice(y,1)}s.value!==""&&(this._$colType=="date"&&(i=="equal"||i=="notequal")&&typeof s.value!="string"?this._setDateFilters(s):h.push(s))}v=!0;c.currentFilterObject.push(s)}c.filterCollection=h;c.currentFilteringColumn=t;c.fieldName=t;b=this.processBindings(c);b&&(h.reverse().splice(0,i.length),h.reverse())}},_cellSelectingEventTrigger:function(n){var i=this,e=i.model,t={},r=n.rowIndex,u=n.cellIndex,f=i.getUpdatedRecords();return t.data=f[r],t.targetRow=n.rowElement,t.targetCell=n.cellElement,t.rowIndex=r,t.cellIndex=u,i._trigger("cellSelecting",t)},_cellSelectedEventTrigger:function(n,t){var r=this,h=r.model,i={},u=n.rowIndex,o=n.cellIndex,f=t.rowIndex,s=t.cellIndex,e=r.getUpdatedRecords();return i.PreviousTargetRow=t.rowElement,i.previousTargetCell=t.cellElement,i.previousData=e[f],i.previousRowIndex=f,i.previousCellIndex=s,i.data=e[u],i.targetRow=n.rowElement,i.targetCell=n.cellElement,i.rowIndex=u,i.cellIndex=o,r._trigger("cellSelected",i)},_rowSelectingEventTrigger:function(n,t){var u=this,e=u.model,i={},f;return updatedRecords=u.getUpdatedRecords(),i.targetRow=r.TreeGrid.getRowByIndex(u,t),i.previousTreeGridRow=r.TreeGrid.getRowByIndex(u,n),i.data=updatedRecords[t],i.previousData=updatedRecords[n],i.recordIndex=t,i.previousIndex=n,u.model.isFromGantt&&(i.target="ejTreeGrid"),f=u._trigger("rowSelecting",i),f&&(e.selectedItem=i.data),f},_rowSelectedEventTrigger:function(t){var i=this,e=i.model,u={},o=i.getUpdatedRecords(),f=n.extend({},o[t]);delete f.childRecords;delete f.parentItem;u={targetRow:r.TreeGrid.getRowByIndex(i,t),recordIndex:t};i.model.isFromGantt?(u.target="ejTreeGrid",u.data=e.updatedRecords[t]):u.data=f;i._trigger("rowSelected",u)},_eventBindings:function(t){var u=this,f=u.model,i=0,o,c=u.getUpdatedRecords(),s=u.getRows(),e,h;if(r.isNullOrUndefined(t)?(e=this._frozenColumnsLength>0?n(s[0]).length:n(s).length,t=f.currentViewData):e=t.length,f.queryCellInfo!=null||f.rowDataBound!=null||f.detailsDataBound)for(i;i<e;i++)h=c.indexOf(t[i]),o=r.TreeGrid.getRowByIndex(this,h),u._rowEventTrigger(o,t[i])},_rowEventTrigger:function(t,i){var f=this,e=this.model,u;e.rowDataBound&&f._trigger("rowDataBound",{rowElement:t,data:i});var l=t.cells,o=n(t).find(".e-rowcell"),r=0,h=o.length,s=null,c=f.model.columns;if(e.queryCellInfo)for(r;r<h;r++)n(o[r]).hasClass("e-rowcell")&&(s=c[r]),s&&f._cellEventTrigger(o[r],i,s);e.detailsDataBound&&n(t).next("tr").hasClass("e-detailsrow")&&(u=n(t).next("tr"),this._frozenColumnsLength>0&&(u=n(u[1])),this._trigger("detailsDataBound",{detailsElement:u,data:i}))},_cellEventTrigger:function(n,t,i){var r={cellElement:n,data:t,column:i};r.cellValue=r.column&&this._getCustomCellValue(t,r.column.field);this._trigger("queryCellInfo",r)},_completeAction:function(t){var i=this,u=i.model,e=u.sortSettings.sortedColumns,s=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),f,o;if(u.isEdit=!1,u.allowPaging&&t.requestType!=r.TreeGrid.Actions.Scroll&&this._refreshGridPager(),r.TreeGrid.Actions.Sorting==t.requestType&&u.allowSorting||r.TreeGrid.Actions.Refresh==t.requestType){if(u.allowSorting)for(i._multiSortRequest||(i.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending").remove(),i.getHeaderTable().find("[aria-sort]").removeAttr("aria-sort")),f=0;f<e.length;f++)i._addSortElementToColumn(e[f].field,e[f].direction);i._multiSortRequest=!1}else r.TreeGrid.Actions.BeginEdit==t.requestType||r.TreeGrid.Actions.Add==t.requestType?(o=n("#"+i._id+"EditForm"),i.model.isEdit=!0,i.setWidthToColumns(),r.TreeGrid.Actions.Add==t.requestType&&o.find(".e-field:disabled").not(".e-identity").removeAttr("disabled").removeClass("e-disable"),n.isFunction(n.validator)&&this._initValidator()):u.isFromGantt&&t.requestType===r.TreeGrid.Actions.Scroll&&i._updateCurrentViewData();u.isFromGantt&&(s.model.sortSettings=u.sortSettings);i._trigger("actionComplete",t)},sendDataRenderingRequest:function(t){var i=this,y=this.model,a,e,u,c,l,v;if(i.model.currentViewData.length)switch(t.requestType){case r.TreeGrid.Actions.Delete:case r.TreeGrid.Actions.Refresh:case r.TreeGrid.Actions.Save:case r.TreeGrid.Actions.Filter:case r.TreeGrid.Actions.Sorting:case r.TreeGrid.Actions.Searching:case r.TreeGrid.Actions.ExpandCollapse:case r.TreeGrid.Actions.RefreshDataSource:case r.TreeGrid.Actions.DragAndDrop:case r.TreeGrid.Actions.Paging:case r.TreeGrid.Actions.Scroll:if(a=document.createElement("div"),t.requestType!=r.TreeGrid.Actions.Scroll)this._frozenColumnsLength>0?i._renderFrozenRecords():(i.getContentTable().find("colgroup").first().replaceWith(i._getMetaColGroup()),u=i.getContentTable().children("tbody"),u.empty(),a.innerHTML=["<table>",n.render[i._id+"_Template"](i.model.currentViewData),"<\/table>"].join(""),i.getContentTable().get(0).replaceChild(a.firstChild.firstChild,i.getContentTable().get(0).lastChild),i.setGridRows(n(i.getContentTable().get(0).rows)));else{var u=i.getContentTable().children("tbody"),p=i.model.currentViewData,o=i._visibleRange,w=this._frozenColumnsLength>0?n(u[0]).children("tr").length:u.children("tr").length,s=!1;if(i._scrollTop>i._prevScrollTop){var f=o.top-i._prevRTop,h=o.bottom-i._prevRBottom,e=h?p.slice(-h):[];s=!0}else{var f=w-(i._prevRBottom-o.bottom+1),h=i._prevRTop-o.top,e=p.slice(0,h);f=f>=0?f:-w-1;s=!1}this._frozenColumnsLength>0?i._renderFrozenRecords(e,h,f,s):(i.getContentTable().find("colgroup").first().replaceWith(i._getMetaColGroup()),s?(u.children(":visible:lt("+f+")").remove(),c=n.render[i._id+"_Template"](e),u.append(c)):(u.children(":visible:gt("+f+")").remove(),c=n.render[i._id+"_Template"](e),u.prepend(c)),i._gridRows=i.getContentTable().find("tr"),i.setGridRows(i._gridRows))}this._gridRows=this.getContentTable().get(0).rows;this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);i._$gridContent&&i._isRendered&&(i._trigger("refresh"),i._eventBindings(e),this._hideCollapsedDetailsRows())}else i._frozenColumnsLength>0?(l=r.buildTag("td",y.emptyRecordText,{},{colSpan:this._frozenColumns.length}),v=document,i.getContent().find("#e-frozencontentdiv"+i._id+" .e-table tbody").empty().append(n(v.createElement("tr")).append(l)),l=r.buildTag("td",y.emptyRecordText,{visibility:"hidden"},{colSpan:this._unFrozenColumns.length}),i.getContent().find("#e-movablecontentdiv"+i._id+" .e-table tbody").empty().append(n(v.createElement("tr")).append(l)),i._$gridContainer.find("#e-movablecontentdiv"+i._id+",#e-frozencontentdiv"+i._id).css("height","30px")):(i.getContentTable().find("tbody").empty().append(i._getEmptyTbody()),i._$gridContainer&&i._$gridContainer.css({height:"30px"})),i._gridRows=null,i.setGridRows(null);(i.model.showGridCellTooltip||i.model.showGridExpandCellTooltip)&&(i._cellMouseLeave(),i._headerMouseLeave());t.requestType==r.TreeGrid.Actions.Scroll&&t.requestType==r.TreeGrid.Actions.Refresh;i._completeAction(t)},_renderFrozenRecords:function(t,i,u,f){var e,o,s;this.getContent().find("#e-frozencontentdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[0]);this.getContent().find("#e-movablecontentdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[1]);e=this.getContentTable().children("tbody");r.isNullOrUndefined(t)?(e.empty(),temp=document.createElement("div"),temp.innerHTML=["<table>",n.render[this._id+"_JSONFrozenTemplate"](this.model.currentViewData),"<\/table>"].join(""),this.getContentTable().get(0).replaceChild(temp.firstChild.firstChild,this.getContentTable().get(0).lastChild),temp=document.createElement("div"),temp.innerHTML=["<table>",n.render[this._id+"_Template"](this.model.currentViewData),"<\/table>"].join(""),this.getContentTable().get(1).replaceChild(temp.firstChild.firstChild,this.getContentTable().get(1).lastChild)):f?(n(e.get(0)).children(":visible:lt("+u+")").remove(),n(e.get(1)).children(":visible:lt("+u+")").remove(),o=n.render[this._id+"_JSONFrozenTemplate"](t),s=n.render[this._id+"_Template"](t),n(e.get(0)).append(o),n(e.get(1)).append(s)):(n(e.get(0)).children(":visible:gt("+u+")").remove(),n(e.get(1)).children(":visible:gt("+u+")").remove(),o=n.render[this._id+"_JSONFrozenTemplate"](t),s=n.render[this._id+"_Template"](t),n(e.get(0)).prepend(o),n(e.get(1)).prepend(s));this.setGridContentTable(this.getContent().find(".e-table"))},_renderByFrozenDesign:function(){var i=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),t={};return t.colgroup1=i.append(r.buildTag("colgroup").append(u.splice(0,this._frozenColumnsLength))).html(),t.colgroup2=i.html(r.buildTag("colgroup").append(u)).html(),n.render[this._id+"_FrozenTemplate"](t)},addFrozenTemplate:function(){var i="<div class='e-frozencontainer' id='e-frozencontainer"+this._id+"' style='overflow:hidden;float:left;'><div class='e-frozencontentdiv' id='e-frozencontentdiv"+this._id+"' style='width:100%;'><table class='e-table' style='width:100%' cellspacing='0' id='"+this._id+"frozene-table'>{{:colgroup1}}<tbody><\/tbody><\/table><\/div><\/div><div class='e-movablecontainer' id='e-movablecontainer"+this._id+"'><div class='e-movablecontent' id='e-movablecontent"+this._id+"'><div class='e-movablecontentdiv' id='e-movablecontentdiv"+this._id+"'><table class='e-table' id='"+this._id+"movablee-table' cellspacing='0'>{{:colgroup2}}<tbody><\/tbody><\/table><\/div><\/div><\/div>",t={};t[this._id+"_FrozenTemplate"]=i;n.templates(t)},sortSetting:function(t){var r=this,i;if(ascendingIcon=n("#"+r._id).find(".e-ascending.e-icon"),descendingIcon=n("#"+r._id).find(".e-descending.e-icon"),r.model.allowSorting=t,ascendingIcon.length>0)for(i=0;i<ascendingIcon.length;i++)n(ascendingIcon[i]).css("visibility","hidden");if(descendingIcon.length>0)for(i=0;i<descendingIcon.length;i++)n(descendingIcon[i]).css("visibility","hidden")},columnIndex:function(n){var t=this,i=t.model;!isNaN(parseInt(n))&&parseInt(n)>=0&&parseInt(n)<i.columns.length&&(i.treeColumnIndex=parseInt(n),t._addInitTemplate(),this.renderRecords(),i.showColumnChooser&&t._renderColumnChooserList(!0))},sortColumn:function(t,i){var f=this,o=f.model,h=o.sortSettings.sortedColumns,s={},e=0,l=h.length,c;if(f._cancelEditState(),f.clearSelection(),o.allowSorting&&n.inArray(t,f._disabledSortableColumns)==-1&&t.length!=0){for(f._multiSortRequest||(o.sortSettings.sortedColumns=[]),s.requestType=r.TreeGrid.Actions.Sorting,s.columnName=t,f._cSortedColumn=t,f._cSortedDirection=s.columnSortDirection=i===u?r.sortOrder.Ascending:i,e;e<l;e++)if(h[e].field==f._cSortedColumn){h.splice(e,1);break}o.sortSettings.sortedColumns.push({field:f._cSortedColumn,direction:f._cSortedDirection});c=f.processBindings(s);c&&(f._cSortedDirection=f._cSortedColumn=null);f.selectedRowIndex()>=0&&f._isRendered&&f.selectedRowIndex(f._sortedRecords.indexOf(this.selectedItem()));f._clearColumnMenu()}},clearSorting:function(){var t=this,i=t.model,n;i.sortSettings.sortedColumns=[];n={};n.requestType=r.TreeGrid.Actions.Sorting;t.processBindings(n)},deleteRow:function(t,i,u){var f=this,s,h={},e=f.model,w=n.extend([],e.selectedItems),a=i?1:w.length,v=f.getUpdatedRecords(),l,o,c,y,b,k,p;if(f._isEmptyRow&&e.selectionSettings.selectionMode=="cell"&&(a=1),!e.editSettings.allowDeleting||a==0)return!1;for(l=0;l<a;l++){if(h.data=e.isFromGantt&&i?v[u]:f._checkboxSelection&&i?e.selectionSettings.selectionMode=="row"?e.selectedItem:v[f._rowIndexOfLastSelectedCell]:e.selectionSettings.selectionMode=="row"?w[l]:v[f._rowIndexOfLastSelectedCell],s=h.data,f.model.enableWBS&&(y=!1,s&&s.parentItem?(o=s.parentItem.childRecords,c=o.indexOf(s)):e.flatRecords.length&&(b=e.flatRecords,k=b.filter(function(n){return n&&n.level==0}),o=k,c=o.indexOf(s)),c!=o.length-1&&(y=!0)),e.flatRecords.indexOf(h.data)!=-1&&(h.requestType=r.TreeGrid.Actions.Delete,h.isFromContextmenu=i,f._selectedCellDetails=[],f._removeRecords(h)))return!0;y&&(s.parentItem?p=o[c]:(o.splice(c,1),p=o[c]),f.updateWBSdetails(p))}f._ensureDataSource(h);f.updateHeight();e.currentViewData.length>0&&e.enableAltRow&&r.TreeGrid.updateAltRow(f,e.currentViewData[0],0,0);f._checkboxSelection?(e.selectedCellIndexes=[],f._prevSelectedItems=null,i||(e.selectedItems=[]),e.selectedItem=null,f.selectedRowIndex(-1),f.selectAllRows()):(e.selectedItems=[],e.selectedCellIndexes=[],e.selectedItem=null,f.selectedRowIndex(-1),f._prevSelectedItems=null,this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&!f.model.isFromGantt&&f._clearMultiSelectPopup())},_removeRecords:function(n){var u=this,i=u.model,f=this.dataSource(),t,s,o,c,h,l,a,e;if(n&&(i.editSettings.allowDeleting||n.isDragAndDropDelete)&&n.requestType===r.TreeGrid.Actions.Delete){if(t=n.data,u._trigger("actionBegin",n))return!0;if(s=i.flatRecords.indexOf(t),t.parentItem&&(c=t.parentItem.childRecords,childIndex=c.indexOf(t),t.parentItem.childRecords.splice(childIndex,1),i.showSummaryRow&&(h=i.summaryRows.length,h==c.length&&(t.parentItem.childRecords.splice(0,h),i.flatRecords.splice(s,h))),i.parentIdMapping||t.parentItem.item[i.childMapping].splice(childIndex,1)),u._checkboxSelection&&!n.isDragAndDropDelete)if(n.isFromContextmenu)u._removeChildRecords(i.selectedItems,n.data);else while(i.selectedItems.length>0)u._removeChildRecords(i.selectedItems,i.selectedItems[0]);l=i.parentRecords.indexOf(t);l!==-1&&i.parentRecords.splice(l,1);s!==-1&&(a=u.getChildCount(t,0),i.flatRecords.splice(s,a+1),i.ids&&i.ids.splice(s,a+1));i.updatedRecords=i.enableVirtualization?u.getExpandedRecords(i.flatRecords):i.flatRecords.slice();u.updateCollapsedRecordCount();i.parentIdMapping?(t.hasChildRecords&&t.childRecords.length>0&&u._removeChildItem(t),f instanceof r.DataManager?f.dataSource.offline&&f.dataSource.json?(e=f.dataSource.json.indexOf(t.item),e!==-1&&f.dataSource.json.splice(e,1)):u._isDataManagerUpdate&&(e=u._jsonData.indexOf(t.item),e!==-1&&u._jsonData.splice(e,1)):(e=f.indexOf(t.item),e!==-1&&f.splice(e,1))):f instanceof r.DataManager?f.dataSource.offline&&f.dataSource.json?(o=f.dataSource.json.indexOf(t.item),o!==-1&&f.dataSource.json.splice(o,1)):u._isDataManagerUpdate&&(o=u._jsonData.indexOf(t.item),u._jsonData.splice(o,1)):(o=f.indexOf(t.item),o!==-1&&f.splice(o,1));t.parentItem&&t.parentItem.childRecords.length==0&&(t.parentItem.expanded=!1,t.parentItem.hasChildRecords=!1,t.parentItem.hasFilteredChildRecords=!1);i.showSummaryRow&&u._updateSummaryRow(n);i.showTotalSummary&&u._updateTotalSummaryRow(n)}},updateWBSdetails:function(n){var h=this,c=h.model,t=n,r=t.WBS,u,f,e,i,o,l,a,s,v;t.parentItem?(u=t.parentItem.childRecords,f=u.indexOf(t),i=u,o=i.length):c.flatRecords.length&&(l=c.flatRecords,a=l.filter(function(n){return n&&n.level==0}),i=a,f=i.indexOf(t),o=i.length);e=i.slice(f,o);e.length&&(s=r.lastIndexOf(".")!=-1?parseInt(r.substr(r.lastIndexOf(".")+1)):parseInt(r),v=t.parentItem?t.parentItem.WBS:null,s--,h.reCalculateWBS(e,s,v))},reCalculateWBS:function(n,t,i){var u=this,e=u.model,o=e.currentViewData,f,r;if(i)for(r=0;r<n.length;r++)f=t+r,n[r].WBS=i+"."+f,n[r].item.WBS=i+"."+f,e.enableWBSPredecessor&&u._getPredecessorIds(n[r]),u.refreshRow(o.indexOf(n[r])),n[r].hasChildRecords&&u._updateChildWBS(n[r]);else for(r=0;r<n.length;r++)f=(t+r).toString(),n[r].WBS=f,n[r].item.WBS=f,e.enableWBSPredecessor&&u._getPredecessorIds(n[r]),u.refreshRow(o.indexOf(n[r])),n[r].hasChildRecords&&u._updateChildWBS(n[r])},_updateChildWBS:function(n){for(var r=this,u=r.model,e=u.currentViewData,i=n.childRecords,f=n.WBS,t=0;t<i.length;t++)i[t].WBS=f+"."+(t+1),i[t].item.WBS=f+"."+(t+1),u.enableWBSPredecessor&&r._getPredecessorIds(i[t]),r.refreshRow(e.indexOf(i[t])),i[t].hasChildRecords&&r._updateChildWBS(i[t])},_getPredecessorIds:function(n){var i=this,u=i.model,f=n.taskId,e=u.flatRecords,o=u.updatedRecords,r=e.filter(function(n){var i,t,r,u;if(n.predecessorsName)for(i=n.predecessorsName.split(","),t=0;t<i.length;t++)if(r=i[t].match(/(\d+|[A-z]+)/g),u=+r[0],u==f)return n});for(t=0;t<r.length;t++)i.updateWBSPredecessor(r[t]),i.refreshRow(o.indexOf(r[t]))},search:function(n){var i=this,t={};t.requestType=r.TreeGrid.Actions.Searching;t.keyValue=n;i._searchString=n;i.processBindings(t)},endEdit:function(){var n=this;if(n.model.editSettings.editMode.toLowerCase()!="cellediting"||n._isRowEdit){if(n.model.editSettings.editMode.toLowerCase()=="dialogediting")return n.saveRow()}else return this.editFormValidate()?n.saveCell():!0;return!0},updateReadOnly:function(n){var t=this;t.model.readOnly=n},updateShowGridExpandCellTooltip:function(n){var t=this;t.model.showGridExpandCellTooltip=n;t.refreshContent()},updateShowGridCellTooltip:function(n){var t=this;t.model.showGridCellTooltip=n;t.refreshContent()},getVisibleRange:function(){var n=this,o=n.model,u=n.model.rowHeight+n._detailsRowHeight,r=n._scrollTop/u,f=r-Math.floor(r),t,i,e=n.getUpdatedRecords();return n._offset=f*u,t=Math.floor(r),i=n._getRowPosition(n._scrollTop+n._viewPortHeight),t=Math.max(0,t),i=Math.min(e.length,i),n._visibleRange={top:t,bottom:i},n._visibleRange},_setWidthToHeaders:function(){var r=this._gridWidth,t,i,n;if(this._frozenColumnsLength>0){for(t=0,n=0;n<this.columnsWidthCollection.length;n++)t+=this.columnsWidthCollection[n],this._frozenColumnsLength-1==n&&(i=Math.ceil(t));this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).width(r).next().css("margin-left",i+"px");this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).outerWidth(i).end().find("#e-movableheaderdiv"+this._id).css("width","100%")}},setWidthToColumns:function(){for(var c,s,i,t=this,f=t.model,h=t.getContentTable().children("colgroup").find("col"),e=t.getHeaderTable().children("colgroup").find("col"),l=t._gridWidth,o=f.columns.length,u=0;u<e.length;u++)r.isNullOrUndefined(t.columnsWidthCollection[u])||(h.eq(u).width(t.columnsWidthCollection[u]),e.eq(u).width(t.columnsWidthCollection[u]));f.isFromGantt||(h.length>o&&h.eq(o).width(35),e.length>o&&e.eq(o).width(35));f.showTotalSummary&&this._$totalSummaryRowContainer&&(c=n(this.getHeaderTable()).find("colgroup"),s=n(c).clone(),this._frozenColumnsLength>0?this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(s[0]).prependTo(this._$footertableContent[0]),n(s[1]).prependTo(this._$footertableContent[1])):this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(s).prependTo(this._$footertableContent)));this._frozenColumnsLength>0&&(i=this._getFrozenColumnWidth(),this.getContent().find("#e-movablecontainer"+this._id).css("margin-left",i+"px"),this.getContent().find("#e-frozencontainer"+this._id).outerWidth(i),this.getScrollElement().data("ejScroller")&&(this.getScrollElement().ejScroller("option","width",this._gridWidth-i-this._totalBorderWidth-1),this.getScrollElement().ejScroller("option","scrollTop",t._scrollTop),this.getScrollElement().ejScroller("option","scrollLeft",t._scrollLeft)),this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).next().css("margin-left",i+"px"),this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).outerWidth(i).end().find("#e-movableheaderdiv"+this._id).css("width","100%"),this._$totalSummaryRowContainer&&(this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).width(l).next().css("margin-left",i+"px"),this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).outerWidth(i).end().find("#e-movablefooterdiv"+this._id).css("width","100%"),this.getBrowserDetails().browser=="safari"&&this._$totalSummaryRowContainer.find("#e-movablefooter"+this._id).css("margin-left","auto")),this.getBrowserDetails().browser=="safari"&&this.getHeaderContent().find("#e-movableheader"+this._id).add(this.getContent().find("#e-movablecontainer"+this._id)).css("margin-left","auto"));f.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||f.isFromGantt||this._updateTableWidth()},_updateTableWidth:function(t){var i=0,u,f,e,r;for(model=this.model,frozenColumnWidth=this._getFrozenColumnWidth(),columnLength=model.columns.length,r=0;r<columnLength;r++)(model.columns[r].isFrozen||model.columns[r].visible!=!1)&&(i+=model.columns[r].width);this._frozenColumnsLength>0?(i-=frozenColumnWidth,u=n(this.getHeaderTable()[1]),f=n(this.getContentTable()[1]),e=model.showTotalSummary?n(this._$footertableContent[1]):null):(u=this.getHeaderTable(),f=this.getContentTable(),e=model.showTotalSummary?n(this._$footertableContent[0]):null);model.showDetailsRow&&model.showDetailsRowInfoColumn&&model.detailsTemplate&&(i+=35);t||(u.width(i),f.width(i),e&&e.width(i));i<this._gridWidth-frozenColumnWidth&&model.columns[columnLength-1].visible?(u.addClass("e-tableLastCell"),f.addClass("e-tableLastCell")):(u.removeClass("e-tableLastCell"),f.removeClass("e-tableLastCell"))},_convertHtml:function(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},cellEdit:function(t,i){var f=this,b,s=f.model,v,k=t,d=f.getUpdatedRecords(),o,w,nt;if(o=s.allowSelection==!0?s.selectionSettings.selectionMode=="row"?this.selectedItem():d[f._rowIndexOfLastSelectedCell]:this.selectedItem(),f.model.showGridCellTooltip&&f._cellMouseLeave(),f.model.isEdit&&f.saveCell(),b=n("#"+f._id+"EditForm"),b.length>0)return!0;if(!o||s.isFromGantt&&o.hasChildRecords&&(i==="status"||i==="startDate"&&o.isAutoSchedule||i==="endDate"&&o.isAutoSchedule||i==="duration"&&o.isAutoSchedule||i==="work"||i==="effortDriven"||i==="taskType"||i==="predecessor"||i==="taskId")||s.isFromGantt&&(o.isAutoSchedule&&o.taskType=="fixedWork"&&i=="effortDriven"||!o.isAutoSchedule&&(i=="taskType"||i=="effortDriven")))return!1;if((s.enableVirtualization||s.selectionSettings.selectionMode==="cell")&&(k=d.indexOf(o),t=s.currentViewData.indexOf(o)),v=r.TreeGrid.getRowByIndex(this,k),v&&n(v).find(".e-rowcell").length>0){var c=n(v),l=f.getColumnIndexByField(i),y=c.find(".e-rowcell").eq(l),h=f.model.columns[l],e=o,p=f._getCustomCellValue(e,h.field),a={},u={validationRules:r.isNullOrUndefined(h.validationRules)?{}:n.extend(!0,{},h.validationRules),columnName:h.field,value:r.isNullOrUndefined(p)?e.item&&e.item[i]:p,data:e,columnObject:h,cell:y},g=!0;return(h.field=="notesText"?(u.value=r.isNullOrUndefined(e[i])?e.item&&e.item[i]:e[i],u.value=u.value?f._convertHtml(u.value):u.value):u.value=r.isNullOrUndefined(p)?e.item&&e.item[i]:p,s.isFromGantt&&u.columnName==="predecessor"&&(w=u.data.item[f.model.predecessorMapping],u.value=w?w:""),s.isFromGantt&&u.columnName==="taskMode"&&(nt=!u.data.isAutoSchedule,u.value=nt),a.data=e,a.columnIndex=l,a.rowElement=c,a.cellElement=y,f._cellEventTrigger(y,e,u.columnObject),f._trigger("beginEdit",a))?!1:(c.hasClass("e-insertedrow")&&!u.columnObject.isTemplateColumn&&(g=!0),g&&n.extend(f._cellEditingDetails,{rowIndex:t,cellValue:u.value,columnIndex:l,fieldName:i,cellEditType:u.columnObject.editType,data:e}),u.columnIndex=l,f._renderCellEditObject(u,y),c.hasClass("e-templaterow")||c.addClass("e-editedrow"),u.cell&&u.cell.addClass("e-editedcell"),f._updateHorizontalScrollBar(i),!0)}},_updateHorizontalScrollBar:function(t){var i=this,o=i.getScrollElement(),k=o.ejScroller("isHScroll"),f,u;if(k){var c=i.model,p=c.columns,d=p.length,l=i.getColumnIndexByField(t),s=0,h=0,a=0,v=0,w=o.find(".e-content").width(),r=o.ejScroller("option","scrollLeft"),y=n("#"+i._id+"EditForm"),b,e=[];if(c.selectionSettings.selectionMode=="cell"&&y.length==0?e=n("#"+i._id).find(".selectingcell"):(b=n(y).closest("tr.e-treegridrows"),e=n(b).find("td.e-rowcell")),i._frozenColumnsLength>0&&l<i._frozenColumnsLength)return!1;for(f=i._frozenColumnsLength;f<=l;f++)u=c.selectionSettings.selectionMode=="cell"&&y.length==0?e[e.length-1]:n(e[f-i._frozenColumnsLength]),f==l&&(h=s,a=s+n(u).width()+parseFloat(n(u).css("padding-left"))+parseFloat(n(u).css("padding-right"))+1),p[f].visible&&(s=s+n(u).width()+parseFloat(n(u).css("padding-left"))+parseFloat(n(u).css("padding-right"))+1);(h<r||a>r+w)&&(v=h<r?r-(r-h)-3:r+(a-(r+w)+3),o.ejScroller("option",{scrollLeft:v}),i._updateHeaderScrollLeft(v))}},updateAllowColumnResize:function(n){var t=this,i=t.model;i.allowColumnResize=n;i.allowColumnResize&&(t._resizer=new r.gridFeatures.gridResize(t));t._enableColumnResizeEvents()},_validatePredecessorString:function(n){var i=this,t;if(n.length>0)n.split(",").forEach(function(n){values=n.split("+");offsetvalue="+";n.indexOf("-")>=0&&(values=n.split("-"),offsetvalue="-");match=values[0].match(/(\d+|[A-z]+)/g);match&&i.model.ids.indexOf(match[0])!=-1?match[1]&&(match[1].toUpperCase()=="FS"||match[1].toUpperCase()=="FF"||match[1].toUpperCase()=="SF"||match[1].toUpperCase()=="SS"||(t=!1)):t=!1});else return!0;return t===u||t?!0:!1},saveCell:function(){var i=this,u=i.model,w,e,f,o,tt,it,h,ft,et,s,v,y;if(n("#"+i._id+"EditForm").length>0){if(!i.editFormValidate())return!0;if(i._cellEditingDetails.columnIndex>=0){i._focusTreeGridElement();var ot=n("#"+i._id+"EditForm"),st=u.allowPaging?i._updatedPageData.indexOf(i._cellEditingDetails.data):u.updatedRecords.indexOf(i._cellEditingDetails.data),g=r.TreeGrid.getRowByIndex(this,st),ht=ot.closest("td"),nt,t={},c=u.columns[i._cellEditingDetails.columnIndex],p=n("#"+i._id+i._cellEditingDetails.fieldName.split(".").join("")),l;if(t={columnName:c.field,value:i.getCurrentEditCellData(),data:i._cellEditingDetails.data,previousValue:i._cellEditingDetails.cellValue,columnObject:c,cellElement:ht,rowElement:g},(i._cellEditingDetails.cellEditType=="datetimepicker"||i._cellEditingDetails.cellEditType=="dropdownedit"||i._cellEditingDetails.cellEditType=="datepicker")&&p.data("ejWidgets")&&p[p.data("ejWidgets")[0]]("destroy"),r.isNullOrUndefined(c.format)?t.columnObject.type=="boolean"?(w={},w[t.columnObject.field]=t.value,t.cellElement.empty().html(n(n.templates.Grid_JSONTemplate.render(w))[0].cells[i._cellEditingDetails.columnIndex].innerHTML)):t.columnObject.field=="notesText"?t.cellElement.empty().html(i._convertHtml(t.value)):t.cellElement.empty().html(t.value):(nt=i.formatting(c.format,t.value,u.locale),t.cellElement.empty().html(nt)),e=(i._cellEditingDetails.cellEditType=="datepicker"||i._cellEditingDetails.cellEditType=="datetimepicker")&&t.value instanceof Date&&t.previousValue instanceof Date?t.value.getTime()!==t.previousValue.getTime():t.value!==t.previousValue,u.isEdit=!1,f=i._cellEditingDetails.fieldName,!u.isFromGantt&&u.idMapping&&u.parentIdMapping&&f==u.idMapping&&i._validateIdValue(t.value)&&(t.value=t.previousValue,e=!1),u.isFromGantt&&f==="taskMode"&&(e=t.value!==t.previousValue?!0:!1),u.isFromGantt&&t.value&&(f==="startDate"||f==="endDate")&&this.getFormatedDate(t.value)==this.getFormatedDate(t.data[f])&&(e=!1),u.isFromGantt&&f==="predecessor"){o={};t.value=t.value.trim();tt=i._validatePredecessorString(t.value);tt?(o.predecessorString=t.value.split(","),o.currentRecord=t.data,o.requestType="validatePredecessor",i._trigger("actionComplete",o),it=o.result,it||(t.value=t.previousValue)):t.value=t.previousValue;var b=[],rt=[],k=[],a=0,ut,d;for(t.previousValue=t.data.predecessor,rt=t.previousValue,t.value.length>0&&(k=t.data._calculatePredecessor(t.value,u.durationUnitEditText,u.durationUnit)),ut=k.length,h=0,ft=t.previousValue&&t.previousValue.length,h=0;h<ft;h++)d=rt[h],d.from===t.data.taskId.toString()&&b.push(d);for(a=0;a<ut;a++)b.push(k[a]);t.data[i._cellEditingDetails.fieldName]=b;t.data.item[u.predecessorMapping]=t.value;t.data.predecessorsName=t.value;u.enableWBS&&u.enableWBSPredecessor&&i.updateWBSPredecessor(t.data)}else if(u.isFromGantt&&f==="duration")et=t.value,duration=t.data.duration,durationUnit=t.data.durationUnit,s=et.match(/(\d*\.*\d+|[A-z]+)/g),s&&s.length<=2&&(duration=parseFloat(s[0]),durationUnit=s[1]?s[1].toLowerCase():"",durationUnit=u.durationUnitEditText.minute.indexOf(durationUnit)!=-1?r.Gantt.DurationUnit.Minute:u.durationUnitEditText.hour.indexOf(durationUnit)!=-1?r.Gantt.DurationUnit.Hour:u.durationUnitEditText.day.indexOf(durationUnit)!=-1?r.Gantt.DurationUnit.Day:u.durationUnit),isNaN(duration)?t.data.item[u.durationMapping]=t.previousValue:(t.data.item[u.durationMapping]=t.data.duration=duration,t.data.durationUnit=durationUnit);else if(e){if(u.isFromGantt)switch(f){case"taskId":t.data.item[u.idMapping]=t.value;break;case"taskName":t.data.item[u.taskNameMapping]=t.value;break;case"startDate":t.value||(t.value=t.previousValue);t.data.item[u.startDateMapping]=t.value;break;case"endDate":t.value||(t.value=t.previousValue);t.data.item[u.endDateMapping]=t.value;break;case"resourceInfo":t.data.item[u.resourceInfoMapping]=i._getResourceId(t.value);break;case"status":t.data.item[u.progressMapping]=t.value;break;case"notesText":t.data.item[u.notesMapping]=t.value;t.data.notes=t.value;t.data.notesText=t.value;break;case"taskMode":t.data.item[u.taskSchedulingModeMapping]=t.value;t.data.isAutoSchedule=t.value==!0?!1:!0;break;case"work":u.workMapping?t.data.item[u.workMapping]=t.value:t.data.item[i._cellEditingDetails.fieldName]=t.value;break;case"baselineStartDate":t.data.item[u.baselineStartDateMapping]=t.value;break;case"baselineEndDate":t.data.item[u.baselineEndDateMapping]=t.value;break;default:t.data.item[i._cellEditingDetails.fieldName]=t.value}else v=(i._cellEditingDetails.fieldName||"").split("."),v<=1?t.data.item[i._cellEditingDetails.fieldName]=t.value:t.data.item=i._restoreCustomData(t.data.item,t.value);v=(i._cellEditingDetails.fieldName||"").split(".");v<=1?t.data[i._cellEditingDetails.fieldName]=t.value:t.data=i._restoreCustomData(t.data,t.value)}(u.isFromGantt&&(t.columnName==="startDate"||t.columnName==="endDate"||t.columnName==="duration"||t.columnName==="taskMode"&&e||t.columnName==="predecessor"||t.columnName=="status")||t.columnName=="baselineStartDate"||t.columnName=="baselineEndDate")&&(t.isModified=!0);this._frozenColumnsLength>0?(u.allowSelection||(t.data.isSelected=!1),l=i._cellEditingDetails.columnIndex<this._frozenColumnsLength?n(n.render[i._id+"_JSONFrozenTemplate"](t.data))[0].cells[i._cellEditingDetails.columnIndex]:n(n.render[i._id+"_Template"](t.data))[0].cells[i._cellEditingDetails.columnIndex-this._frozenColumnsLength]):(u.allowSelection||(t.data.isSelected=!1),l=n(n.render[i._id+"_Template"](t.data))[0].cells[i._cellEditingDetails.columnIndex]);t.cellElement.removeClass("e-editedcell").replaceWith(l);t.cellElement=n(l);u.showDetailsRow&&!u.showDetailsRowInfoColumn&&u.detailsTemplate&&this._refreshDetailsRow(u.currentViewData.indexOf(t.data));i._trigger("refresh");t.data.treeMappingName||(t.data.treeMappingName=[]);t.data.treeMappingName.push(t.columnName);i._trigger("endEdit",t)&&(t.data[t.columnName]=t.previousValue,t.data.item[t.columnObject.field]=t.previousValue,i.selectRows(this.selectedRowIndex()),r.TreeGrid.refreshRow(i,u.currentViewData.indexOf(t.data)));i._cellEventTrigger(t.cellElement[0],t.data,t.columnObject);g.removeClass("e-editedrow")}u.showSummaryRow&&(t.editType="celledit",i._updateSummaryRow(t));u.showTotalSummary&&(t.editType="celledit",i._updateTotalSummaryRow(t));i._cancelSaveTools();y=t.columnObject;u.allowFiltering&&y&&u.filterSettings.filterType=="filterbar"&&y.filterEditType=="dropdownedit"&&y.editType!="dropdownedit"&&i._resizeFilteringElements()}return!1},updateWBSPredecessor:function(n){var h=this,c=h.model,u=n.predecessorsName,t=null,f,r,e;if(u&&u.length>0){for(f=u.split(","),r=0;r<f.length;r++){var o=f[r].match(/(\d+|[A-z]+)/g),l=+o[0],s=o[1],i;i=c.flatRecords.filter(function(n){return n&&n.taskId==l});e=s?i[0]&&i[0].WBS+s:i[0]&&i[0].WBS;t=t?t+","+e:e}n.WBSPredecessor=t;n.item.WBSPredecessor=t}else n.WBSPredecessor="",n.item.WBSPredecessor=""},getCurrentEditCellData:function(){var u=this,e=u.model,l=e.columns,f,o,i,t;if(n("#"+u._id+"EditForm").length){i=n("#"+u._id+u._cellEditingDetails.fieldName.split(".").join(""));f=l[u._cellEditingDetails.columnIndex];switch(u._cellEditingDetails.cellEditType){case r.TreeGrid.EditingType.String:t=i.val();break;case r.TreeGrid.EditingType.Numeric:t=parseFloat(i.val());t=e.isFromGantt&&(f.field=="work"||f.field=="status"||f.field=="duration")||f.field=="unit"?isNaN(t)?u._cellEditingDetails.cellValue:t:i.ejNumericTextbox("model.value");break;case r.TreeGrid.EditingType.Maskedit:t=i.ejMaskEdit("model.value");break;case r.TreeGrid.EditingType.Dropdown:t=e.isFromGantt&&u._cellEditingDetails.fieldName==="resourceInfo"?u._getSelectedItem(i.ejDropDownList("model.selectedItems")):e.isFromGantt&&u._cellEditingDetails.fieldName==="taskMode"?i.ejDropDownList("model.value")=="true"?!0:!1:i.ejDropDownList("model.value");break;case r.TreeGrid.EditingType.Boolean:t=i.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:t=f&&!f.format?r.format(i.ejDatePicker("model.value"),this.model.dateFormat,this.model.locale):i.ejDatePicker("model.value");t==""&&e.isFromGantt&&(t=u._cellEditingDetails.cellValue);break;case r.TreeGrid.EditingType.DateTimePicker:var a=i.ejDateTimePicker("model.value"),s=i.ejDateTimePicker("model.dateTimeFormat"),h=i.ejDateTimePicker("model.locale"),c;t=f&&!f.format?r.format(i.ejDateTimePicker("model.value"),this.model.dateFormat,this.model.locale):i.ejDateTimePicker("model.value");o=r.format(i.val(),s,h);c=r.format(a,s,h);o!==c&&e.isFromGantt&&(t=u._cellEditingDetails.cellValue);break;case"edittemplate":temp1=f.editTemplate.read;typeof temp1=="string"&&(temp1=r.util.getObject(temp1,window));t=temp1(i)}return typeof t=="string"&&t.length&&e.columns[u._cellEditingDetails.columnIndex].type=="number"&&(t=parseFloat(t)),t}return null},getCurrentEditCellDataForRowEdit:function(t,i,u){var o=this,c=o.model,v=c.columns,s,t=t.split(".").join(""),l,f,h,e,a;if(o.model.editSettings.allowEditing&&o.model.editSettings.editMode=="dialogEditing"?(l=n("#"+o._id+"EditFormDialog").length,f=n("#"+o._id+t),h=!0):(l=n("#"+o._id+"EditForm").length,f=n("#"+o._id+t)),l){s=v[u];switch(i){case r.TreeGrid.EditingType.String:e=f.val();break;case r.TreeGrid.EditingType.Numeric:e=parseFloat(f.val());e=f.data("ejNumericTextbox")?f.ejNumericTextbox("model.value"):e;break;case r.TreeGrid.EditingType.Dropdown:e=f.data("ejDropDownList")?f.ejDropDownList("model.value"):f.val();h||f.data("ejWidgets")&&f[f.data("ejWidgets")[0]]("destroy");break;case r.TreeGrid.EditingType.Boolean:e=f.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:a=f.hasClass("e-datepicker")?c.dateFormat.toLowerCase().indexOf("hh")==-1?f.ejDatePicker("model.value"):f.ejDateTimePicker("model.value"):f.val();e=s&&!s.format?o.getFormatedDate(a):a;h||f.data("ejWidgets")&&f[f.data("ejWidgets")[0]]("destroy");break;case r.TreeGrid.EditingType.DateTimePicker:e=f.hasClass("e-datetimepicker")?s&&!s.format?r.format(f.ejDateTimePicker("model.value"),this.model.dateFormat,this.model.locale):f.ejDateTimePicker("model.value"):f.val();h||f.data("ejWidgets")&&f[f.data("ejWidgets")[0]]("destroy");break;case r.TreeGrid.EditingType.Maskedit:e=f.ejMaskEdit("model.value");break;case"edittemplate":temp1=s.editTemplate.read;typeof temp1=="string"&&(temp1=r.util.getObject(temp1,window));e=temp1(f)}return typeof e=="string"&&e.length&&c.columns[u].type=="number"&&(e=parseFloat(e)),e}return null},_getResourceId:function(n){for(var i=[],t=0,r=n.length,t=0;t<r;t++)i.push(n[t][this.model.resourceIdMapping]);return i},_getSelectedItem:function(t){var h=this,e=h.model,i=0,u,l=t.length,a=e.resourceUnitMapping,v=e.resourceIdMapping,c=e.columns[h._cellEditingDetails.columnIndex].dropdownData,o=e.selectedItem.resourceInfo,s=[],f;if(c)for(i=0;i<l;i++){if(o)for(f=0;f<o.length;f++)if(o[f][v]===t[i]+1){u=f;break}else u=-1;r.isNullOrUndefined(u)||u==-1?n.each(c,function(r,u){if(t[i]===r){var f=n.extend({},u);f[a]=100;s.push(f)}}):s.push(o[u])}return s},getFormatedDate:function(n){return r.format(n,this.model.dateFormat,this.model.locale)},getDateFromFormat:function(n){return typeof n=="object"?new Date(n):n?r.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):r.parseDate(n,this.model.dateFormat,this.model.locale):void 0},formatting:function(t,i,u){var f,h,o,s,c,l,e;return t=t.replace(/%280/g,'"').replace(/</g,"<").replace(/>/g,">"),u=r.preferredCulture[u]?u:"en-US",f=t,h=t.split("{0:"),c=t.split("}"),o=h[0],s=c[1],typeof i=="string"&&n.isNumeric(i)&&(i=Number(i)),t.indexOf("{0:")!=-1?(l=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),e=l.exec(t),e!=null&&i!=null?o!=null&&s!=null?o+r.format(i,e[2],u)+s:r.format(i,e[2],u):i!=null?i:""):this.data!=null&&this.data.Value==null?(n.each(this.data,function(n,t){f=f.replace(new RegExp("\\{"+n+"\\}","gm"),t)}),f):this.data.Value},getColumnIndexByField:function(n){var r=this,i=r.model.columns,u=i.length,t=0;for(t;t<u;t++)if(i[t].field==n)break;return t==i.length?-1:t},getUpNextVisibleColumnIndex:function(n,t){var r=this,i=r.model.columns;for(n||(n=0),n;n<=i.length;n++)if(n==i.length&&(t=="rightArrow"||t=="moveCellRight")&&(n=0,r._focusingRowIndex+=1),i[n].visible&&i[n].allowCellSelection)return i.indexOf(i[n])},getPreviousVisibleColumnIndex:function(n,t){var r=this,i=r.model.columns;for(n||(n=i.length-1),n;n<i.length;n--)if(n<0&&(t=="leftArrow"||t=="moveCellLeft")&&(n=i.length-1,r._focusingRowIndex-=1),i[n].visible&&i[n].allowCellSelection)return i.indexOf(i[n])},getBrowserDetails:function(){var n=navigator.userAgent.match(/(firefox|chrome|opera|msie|safari)\s?\/?(\d+(.\d+)*)/i);return!navigator.userAgent.match(/Trident\/7\./)?{browser:n[1].toLowerCase(),version:n[2]}:{browser:"msie",version:jQuery.uaMatch(navigator.userAgent).version}},mobileDevice:function(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)?!0:!1},getFieldNameByHeaderText:function(n){var t=this;return r.isNullOrUndefined(t._fieldColumnNames[n])?null:t._fieldColumnNames[n]},clearSelection:function(t){var i=this,u=i.model,a=i.getUpdatedRecords(),e,t,s,l,h,o,c,f;if(this.selectedRowIndex()!=-1||this.selectedRowIndex()==-1&&i._previousIndex!=-1||t==-1){if(e=this._frozenColumnsLength?n(i.getRows()[0]).add(i.getRows()[1]):i.getRows(),r.isNullOrUndefined(t)||t==-1){if(e&&e.find(".e-rowcell,.e-detailsrowcell").removeClass("e-selectionbackground").removeClass("e-active"),l=new r.DataManager(u.flatRecords),h=new r.Query,h.search(!0,["isSelected"],r.FilterOperators.Equals,!0),o=l.executeLocal(h),c=o&&o.length,c>0)for(f=0,f=0;f<c;f++)o[f].isSelected=!1}else r.TreeGrid.getRowByIndex(i,t).find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),s=a[t],s&&(s.isSelected=!1);i._checkboxSelection?(i.selectedRowIndex(-1),u.selectedItem=null,i._cancelSaveTools()):u.selectedItems.length&&(!u.selectedItems.length||i._multiSelectCtrlRequest)&&t!=-1||(i.selectedRowIndex(-1),u.selectedItem=null,u.selectedItems=[],i._cancelSaveTools());i.model.allowSelection&&i.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&!e.find(".e-rowcell,.e-detailsrowcell").hasClass("e-selectionbackground")&&!n("#"+i._id+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")&&i._clearMultiSelectPopup()}u.selectionSettings.selectionMode=="cell"&&(i._selectedCellDetails=[],u.selectedCellIndexes=[],n("#"+i._id).find(".selectingcell").removeClass("selectingcell"),i._rowIndexOfLastSelectedCell=-1,i._lastSelectedCellIndex=-1,i._focusingRowIndex=-1);i.model.allowSelection&&i.model.selectionSettings.selectionType=="multiple"&&r.isNullOrUndefined(t)&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&i._clearMultiSelectPopup()},_clearMultiSelectPopup:function(){var t=this;n("#"+t._id+"_selectionpopup").find(".e-rowselect").removeClass("e-spanclicked");t._multiSelectPopup.hide();t._multiSelectCtrlRequest=!1;t._isTouchTrigger=!1},getChildRecordsCount:function(n){var r=this,i=n.childRecords,t=0,f=i?i.length:0,u;for(t;t<f;t++)r._filteredRecords.length>0?(u=r._filteredRecords.indexOf(i[t]),u!=-1&&(++r._removedCount,i[t].hasChildRecords&&i[t].expanded&&r.getChildRecordsCount(i[t]))):(++r._removedCount,i[t].hasChildRecords&&i[t].expanded&&r.getChildRecordsCount(i[t]));return r._removedCount},getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this.getExpandStatus(t.parentItem):!0:!0},getColumnFieldNames:function(){var i=[],t=this.model.columns,n=0,r=t.length;for(n;n<r;n++)t[n].field&&t[n].field!="resourceInfo"&&t[n].field!="predecessor"?i.push(t[n].field):t[n].field=="resourceInfo"?i.push("resourceNames"):t[n].field=="predecessor"&&i.push("predecessorsName");return i},_getColumnMappingNames:function(){var i=[],t=this.model.columns,n=0,r=t.length;for(n;n<r;n++)t[n].field&&t[n].field!="resourceInfo"&&t[n].field!="predecessor"&&t[n].field!="work"&&t[n].field!="taskType"&&t[n].field!="effortDriven"?i.push(t[n].mappingName):t[n].field=="resourceInfo"?i.push("resourceNames"):t[n].field=="work"?i.push(t[n].field):t[n].field=="taskType"?i.push(t[n].field):t[n].field=="effortDriven"?i.push(t[n].field):t[n].field=="predecessor"&&i.push("predecessorsName");return i},renderRecords:function(n){var t=this,i=t.model;n||(n={},!i.isFromGantt&&i.enableCollapseAll?(n.requestType=r.TreeGrid.Actions.ExpandCollapse,t._isInExpandCollapseAll=!0):n.requestType=r.TreeGrid.Actions.Refresh);this.sendDataRenderingRequest(n);t._isInExpandCollapseAll=!1},_shiftKeySelectCells:function(t){var i=this,h=i.model,c=i.getUpdatedRecords(),l=i._shiftKeyFirstElementDetails.firstElementRowIndex,a=r.isNullOrUndefined(i._shiftKeyFirstElementDetails.firstElementCellIndex)?-1:i._shiftKeyFirstElementDetails.firstElementCellIndex,v=t.rowIndex,y=t.cellIndex,o=[l,v],s=[a,y],u,f,p,e;for(o.sort(function(n,t){return n-t}),s.sort(function(n,t){return n-t}),i._isShiftKeyNavigation=!0,i._selectedCellDetails=[],h.selectedCellIndexes=[],n("#"+i._id).find(".selectingcell").removeClass("selectingcell"),u=o[0];u<=o[1];u++)if(f=c&&c[u],p=h.currentViewData.indexOf(f),!r.isNullOrUndefined(f)&&!f.isSummaryRow)for(e=s[0];e<=s[1];e++)i.selectCells([{rowIndex:u,cellIndex:e}])},selectCells:function(t,i){var u=this,e=u.model,v=u.getUpdatedRecords(),c=u.getRows(),o,f,y=t.length,l=e.columns,s,a,p,w,h;if(e.selectionSettings.selectionType=="single"&&(y=1),(!i||r.isNullOrUndefined(i))&&u._isShiftKeyNavigation==!1&&(u._selectedCellDetails=[],e.selectedCellIndexes=[],n("#"+u._id).find(".selectingcell").removeClass("selectingcell")),e.selectionSettings.selectionMode=="cell"&&e.allowSelection&&c.length>0)for(index=0;index<y;index++)t[index].rowIndex!=-1&&((s=v&&v[t[index].rowIndex],a=e.currentViewData.indexOf(s),s.isSummaryRow)||(p=t[index].cellIndex>=u._frozenColumnsLength?1:0,w=t[index].cellIndex>=u._frozenColumnsLength?t[index].cellIndex-u._frozenColumnsLength:t[index].cellIndex,o=u._frozenColumnsLength>0?c[p][a]:c[a],!r.isNullOrUndefined(s)&&r.isNullOrUndefined(o)&&(o=n(n.render[u._id+"_Template"](s))[0]),f=o.childNodes[w],t[index].cellIndex!=-1&&l[t[index].cellIndex].allowCellSelection&&l[t[index].cellIndex].visible&&!u._cellSelectingEventTrigger({rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,rowElement:o,cellElement:f})&&(n(f).addClass("selectingcell"),h={rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,cellElement:f,data:s},currentCellIndex=r.browserInfo().name=="msie"&&r.browserInfo().version<9?u._getCellIndex(u._selectedCellDetails,"cellElement").indexOf(f):u._selectedCellDetails.map(function(n){return n.cellElement}).indexOf(f),currentCellIndex==-1&&(u._selectedCellDetails.push(h),e.selectedCellIndexes.push({rowIndex:h.rowIndex,cellIndex:h.cellIndex})),u._cellSelectedEventTrigger({rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,rowElement:o,cellElement:f},u._previousSelectedCellDetails),u._previousSelectedCellDetails={rowElement:o,cellElement:f,cellIndex:t[index].cellIndex,rowIndex:t[index].rowIndex},u._updateHorizontalScrollBar(l[t[index].cellIndex].field))));u._isShiftKeyNavigation==!1&&(u._shiftKeyFirstElementDetails.firstElementRowIndex=u._focusingRowIndex,u._shiftKeyFirstElementDetails.firstElementCellIndex=u._cellIndex,u._rowIndexOfLastSelectedCell=h?h.rowIndex:u._rowIndexOfLastSelectedCell,u._lastSelectedCellIndex=u._cellIndex)},selectRows:function(t,i,u){var f=this,e=f.model,v=f.getRows(),y,o,l,s,c,h,p,a;if((e.selectionSettings.selectionMode!="cell"||t==-1)&&!r.TreeGrid.getRowByIndex(f,t).hasClass("e-summaryrow")){if((e.editSettings.allowEditing||e.editSettings.allowAdding)&&!f._isRowEdit&&e.editSettings.beginEditAction!="click"&&n("#"+f._id+"EditForm").length>0&&f.endEdit()){v=f.getRows();return}if(this._frozenColumnsLength>0&&(v=n(f.getRows()[0])),updatedRecords=f.getUpdatedRecords(),r.isNullOrUndefined(i)||r.isNullOrUndefined(t)){t=r.isNullOrUndefined(t)?i:t;switch(e.selectionSettings.selectionType){case r.TreeGrid.SelectionType.Checkbox:return o=updatedRecords[t],f.clearSelection(-1),u&&(y=o.checkboxState=="unchecked"?"checked":"unchecked",f._traverseSelection(o,y,!1),f.selectAllRows()),updatedRecords[t]&&!updatedRecords[t].isSelected&&(e.allowSelection&&r.TreeGrid.getRowByIndex(f,t).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"),updatedRecords[t].isSelected=!0,e.selectedItem=updatedRecords[t]),f._prevSelectedItem&&f._prevSelectedItem!=e.selectedItem&&(f._prevSelectedItem.isSelected=!1),f._prevSelectedItem=updatedRecords[t],this.selectedRowIndex(t),!1;case r.TreeGrid.SelectionType.Multiple:if(f._multiSelectCtrlRequest){o=updatedRecords[t];l=n.inArray(o,e.selectedItems);f._prevSelectedItem=updatedRecords[t];l!=-1&&(f.clearSelection(t),e.selectedItems.splice(l,1),o.isSelected=!1,e.selectedItem=e.selectedItems.length>0?e.selectedItems[e.selectedItems.length-1]:null);l==-1&&(e.selectedItems.push(o),e.allowSelection&&r.TreeGrid.getRowByIndex(f,t).attr("aria-selected","true").find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active").attr("tabindex","0"),o.isSelected=!0,e.selectedItem=updatedRecords[t]);break}case r.TreeGrid.SelectionType.Single:f.clearSelection(-1);e.selectedItem=null;t<=updatedRecords.length-1&&(t!=-1&&e.selectedItems.push(updatedRecords[t]),f._prevSelectedItem=updatedRecords[t],e.allowSelection&&r.TreeGrid.getRowByIndex(f,t).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"),updatedRecords[t]&&(updatedRecords[t].isSelected=!0,e.selectedItem=updatedRecords[t]),f._prevSelectedItem&&f._prevSelectedItem!=e.selectedItem&&(f._prevSelectedItem.isSelected=!1))}e.selectedItems.length&&e.selectedItems.indexOf(updatedRecords[t])!=-1?(f._prevSelectedItem=updatedRecords[t],this.selectedRowIndex()!=t&&this.selectedRowIndex(t)):e.selectedItems.length==0&&this.selectedRowIndex()!=-1?this.selectedRowIndex(-1):this.selectedRowIndex(e.updatedRecords.indexOf(e.selectedItems[e.selectedItems.length-1]))}else if(e.selectionSettings.selectionType==r.TreeGrid.SelectionType.Multiple)for(f.clearSelection(-1),f.selectedRowIndex(t),e.selectedItem=e.updatedRecords[t],s=0,c=t-i<0?updatedRecords.slice(t,i+1):updatedRecords.slice(i,t+1),s;s<c.length;s++)f.getExpandStatus(c[s])&&(c[s].isSelected=!0,p=updatedRecords.indexOf(c[s]),h=r.TreeGrid.getRowByIndex(f,p),this._frozenColumnsLength?(a=n(h[0]).add(h[1]),h=h[0]):a=h,a&&n(a).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"));return e.selectedItems=f.getSelectedRecords(),f._multiSelectCtrlRequest=!1,e.isFromGantt&&f._cancelSaveTools(),!1}},getSelectedRecords:function(){var i=this,t=this.model,n=[];return n=t.updatedRecords.filter(function(n){return n.isSelected}),n.slice()},clearAllSelection:function(){var t=this,i=this.model;t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&t._clearMultiSelectPopup();t.selectRows(-1);i.selectedItem=null;t._selectedCellDetails=[];i.selectedCellIndexes=[];t._rowIndexOfLastSelectedCell=-1;t._lastSelectedCellIndex=-1;t._focusingRowIndex=-1;n("#"+t._id).find(".selectingcell").removeClass("selectingcell");t._cancelSaveTools()},getCellIndex:function(t,i){var r=n(t.target),u=-1,h=this.model,f;if(i&&(r=n(i)),r.hasClass("e-detailsrowcell")||r.closest("td").hasClass("e-detailsrowcell"))return-1;if(r.prop("tagName")=="TD")u=r.index();else if(r.prop("tagName")=="DIV"&&r.hasClass("e-cell"))f=r.closest("td"),u=f.index();else if(r.prop("tagName")=="DIV"&&n(r.closest("td")[0]).hasClass("e-templatecell"))f=r.closest("td"),u=f.index();else if(n(r.closest("td")[0]).hasClass("e-templatecell")&&n(r.closest("tr")[0]).hasClass("e-templaterow"))f=r.closest("td"),u=f.index();else if(r.parent().prop("tagName")=="TD")f=r.closest("td"),u=r.parent().index();else if(r.prop("tagName")=="TH"||r.prop("tagName")=="DIV"&&n(r.closest("th")[0]).css("cursor")=="col-resize"){var e=r.prop("tagName")=="TH"?n(r):r.closest("th"),o=r[0].getBoundingClientRect(),s=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft;u=this._orgX<o.left+5+s?e.prevAll(":visible:first")[0].cellIndex:e.index()}else r.closest("td.e-rowcell").length>0&&(f=r.closest("td.e-rowcell"),u=f.index());return u!=-1&&this._frozenColumnsLength>0&&(r.closest(".e-movablecontentdiv").length>0||r.closest(".e-movableheaderdiv").length>0||r.closest(".e-movablefooterdiv").length>0)&&(u+=this._frozenColumnsLength),u},getRowIndex:function(t){var e=this,i=n(t.target),r=e.getRows(),u=-1,o=this.model,f;return i.closest(".e-gridcontainer").length>0&&(this._frozenColumnsLength>0&&(i.closest(".e-frozencontentdiv").length>0||i.closest(".e-frozencontainer").length>0?r=n(r[0]):(i.closest(".e-movablecontentdiv").length>0||i.closest(".e-movablecontainer").length>0)&&(r=n(r[1]))),u=r.index(i),u==-1&&(f=i.closest("tr"),u=r.index(f))),u},_cancelEditState:function(n){var t=this,i;r.isNullOrUndefined(n)||(r.isNullOrUndefined(n.target)||n.stopImmediatePropagation(),i=t.getScrollElement().ejScroller("option","scrollLeft"),headerScrollLeft=0,headerScrollLeft=this._frozenColumnsLength>0?t._$gridHeaderContainer.find("#e-movableheader"+this._id).scrollLeft():t._$gridHeaderContainer.scrollLeft(),i!=headerScrollLeft&&(t.getScrollElement().ejScroller("option","scrollLeft",headerScrollLeft),t.model.showTotalSummary&&t._$footerContainer&&(this._frozenColumnsLength>0?t._$footerContainer.find("#e-movablefooter"+this._id).scrollLeft(headerScrollLeft):t._$footerContainer.scrollLeft(headerScrollLeft))));t.model.isEdit?t.cancelEditCell():t._isRowEdit&&t.cancelRowEditCell()},cancelEditCell:function(){var t=this,e=t.model,i,s=t.model.selectedItem,u,r=t._cellEditingDetails.columnIndex,f={},o=e.columns[r];if(e.isFromGantt&&!e.isEdit)return!0;f={columnName:o.field,value:t.getCurrentEditCellData(),data:t._cellEditingDetails.data,previousValue:t._cellEditingDetails.cellValue,columnObject:o};this._frozenColumnsLength>0?this._frozenColumnsLength<=t._cellEditingDetails.columnIndex?(r=t._cellEditingDetails.columnIndex-this._frozenColumnsLength,i=n(t.getRows()[1])[t._cellEditingDetails.rowIndex],n(i).hasClass("e-editedrow")&&n(i).removeClass("e-editedrow"),u=i.cells[r],n(u).removeClass("e-editedcell").empty().html(n(n.render[t._id+"_Template"](f.data))[0].cells[r].innerHTML)):(i=n(t.getRows()[0])[t._cellEditingDetails.rowIndex],n(i).hasClass("e-editedrow")&&n(i).removeClass("e-editedrow"),u=i.cells[r],n(u).removeClass("e-editedcell").empty().html(n(n.render[t._id+"_JSONFrozenTemplate"](f.data))[0].cells[r].innerHTML)):(i=n(t.getRows())[t._cellEditingDetails.rowIndex],n(i).hasClass("e-editedrow")&&n(i).removeClass("e-editedrow"),u=i.cells[r],n(u).removeClass("e-editedcell").empty().html(n(n.render[t._id+"_Template"](f.data))[0].cells[r].innerHTML));t._cellEventTrigger(n(u)[0],f.data,f.columnObject);t.model.isEdit=!1;t._cancelSaveTools();t._trigger("refresh")},_destroyWidgetElements:function(){var r=this,e=this.model,u=e.columns,o=u.length,f,t;for(i=0;i<o;i++)f=r._getFieldValue(u[i].field,i),t=n("#"+r._id+f),t.data("ejWidgets")&&t[t.data("ejWidgets")[0]]("destroy")},cancelRowEditCell:function(){var t=this,u=this.model,e=u.editSettings.allowDeleting,f=n(document.getElementById(t._id+"EditForm")),i,o=n("#"+t._id+"EditFrozenForm"),r;(f.length>0&&this._destroyWidgetElements(),i=n(f.closest("tr")),r=o.closest("tr"),rowIndex=t.getIndexByRow(i),data=u.currentViewData[rowIndex],rowIndex!=-1||f.length!=0)&&(i.hasClass("e-addedrow")&&(t.model.editSettings.allowDeleting||(t.model.editSettings.allowDeleting=!0)),i.hasClass("e-editedrow")?(i.removeClass("e-editedrow").empty().html(n(n.render[t._id+"_Template"](data))[0].innerHTML),r.length>0&&r.removeClass("e-editedrow").empty().html(n(n.render[t._id+"_JSONFrozenTemplate"](data))[0].innerHTML),t._rowEventTrigger(i,data)):i.hasClass("e-rowedit")?(i.removeClass("e-rowedit").empty().html(n(n.render[t._id+"_Template"](data))[0].innerHTML),r.length>0&&r.removeClass("e-rowedit").empty().html(n(n.render[t._id+"_JSONFrozenTemplate"](data))[0].innerHTML),t._rowEventTrigger(i,data)):i.hasClass("e-addedrow")&&(t._isRefreshAddedRecord=!1,t._isEmptyRow=!0,t._checkboxSelection?t.deleteRow(null,!0,null):t.deleteRow(),t._isEmptyRow=!1),u.isEdit=t._isRowEdit=!1,u.editSettings.allowDeleting=e,t._cancelSaveTools(),t._trigger("refresh"))},refreshRow:function(t){var i=this,u=i.model,e=u.allowPaging?i._updatedPageData:u.updatedRecords,f=e[t],o=i.getIndexByRow(n("#"+i._id+"EditForm").closest("tr"));(u.enableVirtualization||u.allowPaging)&&(t=u.currentViewData.indexOf(f));f&&t>-1&&(r.TreeGrid.refreshRow(this,t),o==t&&(i._isRowEdit=i.model.isEdit=!1,i._cancelSaveTools()))},_refreshDetailsRow:function(t){var i=this,o=this.model,r=i.model.currentViewData[t],u={},f,e;r&&(u=this._frozenColumnsLength>0?n(i.getRows()[1]):n(i.getRows()),f=n(u[t]).next("tr"),f.hasClass("e-detailsrow")&&(f.remove(),e=n(n.render[i._id+"_detailRowTemplate"](r)),n(u[t]).after(e),i.setGridRows(n(i.getContentTable().get(0).rows)),this._gridRows=this.getContentTable().get(0).rows,this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]),i._trigger("refresh"),o.detailsDataBound&&this._trigger("detailsDataBound",{detailsElement:e,data:r})))},_refreshedCellEventTrigger:function(t){var f=this,i=this.model,o;if(i.queryCellInfo!=null||i.rowDataBound!=null||i.detailsDataBound!=null){i.rowDataBound!=null&&f._trigger("rowDataBound",{rowElement:t.rowElement,data:t.data});var u=t.rowElement.cells,s=n(t.rowElement).find(".e-rowcell"),r=0,h=u.length,e=null,c=f.model.columns;if(i.queryCellInfo!=null)for(r;r<h;r++)n(u[r]).hasClass("e-rowcell")&&(e=c[s.index(u[r])]),e&&f._cellEventTrigger(u[r],t.data,e);i.detailsDataBound&&n(t.rowElement).next("tr").hasClass("e-detailsrow")&&(o=n(t.rowElement).next("tr"),this._frozenColumnsLength>0&&(o=n(o[1])),this._trigger("detailsDataBound",{detailsElement:n(t.rowElement).next("tr"),data:t.data}))}},_refreshGridPager:function(){if(this.getPager()!=null){var n=this,i=n.model,r=this.getPager().ejPager("model"),t={};if(t.currentPage=this._currentPage(),i.currentViewData.length==0&&i.updatedRecords.length>0&&r.totalPages!=1){n.gotoPage(t.currentPage-1);return}t.totalRecordsCount=n._gridRecordsCount;this.getPager().ejPager("option",t).ejPager("refreshPager");r=this.getPager().ejPager("model");i.pageSettings.totalPages=r.totalPages;n._updatePagerTextAlignment()}},_getVisibleChildRecordCount:function(n,t,i){var e=this,o=this.model,u,f,r;if(n.hasChildRecords)for(u=n.childRecords,f=u.length,r=0;r<f;r++)i.indexOf(u[r])!==-1&&t++,u[r].hasChildRecords&&(t=e._getVisibleChildRecordCount(u[r],t,i));else i.indexOf(n)!==-1&&t++;return t},_renderAddedRow:function(n,t){var i=this,f=this.model,u;i._updateCurrentViewData();f.enableVirtualization||f.allowPaging?(i.updateAltRow(),u={},u.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(u)):i.renderNewAddedRow(n,t);i.updateHeight()},renderNewAddedRow:function(t,i){var u=this,y=this.model,f=u.getRows(),h=n.render[this._id+"_Template"](i),e=this._frozenColumnsLength>0,o,c,s,l,a,v;e&&(f=n(u.getRows()[1]),c=n(u.getRows()[0]),o=n.render[this._id+"_JSONFrozenTemplate"](i));!r.isNullOrUndefined(f)&&f.length>0?f.length==t?(s=f.eq(t-1),e&&(l=c.eq(t-1)),n(s).next("tr").hasClass("e-detailsrow")?(n(s).next("tr").after(h),e&&n(l).next("tr").after(o)):(n(s).after(h),e&&n(l).after(o))):(f.eq(t).before(h),e&&c.eq(t).before(o)):this._frozenColumnsLength>0?u._renderFrozenRecords():(u.getContentTable().find("tbody").empty().append(u._getEmptyTbody()),a=document.createElement("div"),u.getContentTable().find("colgroup").first().replaceWith(u._getMetaColGroup()),v=u.getContentTable().children("tbody"),v.empty(),a.innerHTML=["<table>",n.render[u._id+"_Template"](u.model.currentViewData),"<\/table>"].join(""),u.getContentTable().get(0).replaceChild(a.firstChild.firstChild,u.getContentTable().get(0).lastChild));this._gridRows=this.getContentTable().get(0).rows;this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);u.setGridRows(n(u.getContentTable().get(0).rows))},onScrollHelper:function(n,t){var i=this,r;i._isFromChart=t;i.getScrollElement().ejScroller("scrollY",n,!0);r=i.getScrollElement().ejScroller("isHScroll");!r&&this.model.isFromGantt&&i.getScrollElement().scrollTop(n)},isVScroll:function(){return this.getScrollElement().hasClass("e-scroller")?this.getScrollElement().ejScroller("isVScroll"):!1},refreshScroller:function(n){var t=this,f,i,r,u;t._$gridContent.removeClass("e-borderbox");f=t.getScrollElement().ejScroller("option","scrollTop");i=t.getScrollElement().ejScroller("option","scrollLeft");t.getScrollElement().ejScroller("option",{persist:!0});t.getScrollElement().ejScroller("option",{width:n});r=t.getMaxScrollWidth();i>r&&(i=r>0?r:0);t._$gridContent.css("height",t._viewPortHeight);t.getScrollElement().ejScroller("refresh");u=t.getScrollElement().ejScroller("isHScroll");t.model.isFromGantt&&u&&t._$gridContent.removeClass("e-borderbox");t.getScrollElement().ejScroller("option",{scrollTop:f});u&&t.getScrollElement().ejScroller("option",{scrollLeft:i});t._$gridHeaderContainer.scrollLeft(i);u?this.getScrollElement().scrollTop(0):this.getScrollElement().scrollTop(f)},getMaxScrollHeight:function(){var n=this;return n.getScrollElement().children(".e-content").children().height()-this.getScrollElement().children(".e-content").height()},getMaxScrollWidth:function(){var n=this;return n.getScrollElement().children(".e-content").children(".e-gridcontainer").children(".e-table").width()-this.getScrollElement().children(".e-content").width()},refreshHeight:function(){var n=this;n.getScrollElement().ejScroller("refresh")},getColumnByHeaderText:function(n){for(var r=this,u=r.model.columns.length,i=r.model.columns,t=0;t<u;t++)if(i[t].headerText==n)break;return t==i.length?null:i[t]},hideColumn:function(t){var i=this,f=i.model,c=this.getColumnByHeaderText(t),u=n.inArray(c,f.columns),k=n.inArray(t,i._hiddenColumns),l,y,p,s,v,e,b;if(!c||i._isColumnHidable(c)){if(u!=-1&&u!=f.treeColumnIndex&&k==-1){i._cancelEditState();i._hiddenColumns.push(t);i.model.columns[u].visible=!1;i.getHeaderTable().removeClass("e-table");i.getContentTable().removeClass("e-table");l=i.getHeaderTable().find("colgroup").find("col");n(l).eq(u).hide();y=i.getHeaderTable().find("thead").find("th.e-headercell");n(y).eq(u).addClass("e-hide");f.allowFiltering&&f.filterSettings.filterType=="filterbar"&&(p=i.getHeaderTable().find("thead").find("th.e-filterbarcell"),n(p).eq(u).addClass("e-hide"));var h=i.getContentTable().find("colgroup").find("col"),w=!0,a=u,o;n(h).eq(u).hide();h=i.getRows();o=this._getFooterRows();this._frozenColumnsLength>0?u<this._frozenColumnsLength?(h=n(i.getRows()[0]),o=n(o[0]),i._gridRows&&n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s-1))):(h=n(i.getRows()[1]),o=n(o[1]),w=!1,a=u-this._frozenColumnsLength,i._gridRows&&n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s-1))):i._gridRows&&n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s-1));h.each(function(){var t=n(this).children("td").eq(a);n(t).addClass("e-hide");f.showSummaryRow&&n(t).hasClass("e-summaryrowcell")&&w&&i._updateSummaryRowTitleCell(l,t[0].parentElement)});f.showTotalSummary&&(v=i._$footertableContent.find("colgroup").find("col"),n(v).eq(u).hide(),o.each(function(){var t=n(this).children("td").eq(a);n(t).addClass("e-hide");n(t).hasClass("e-footersummaryrowcell")&&i._updateSummaryRowTitleCell(v,t[0].parentElement)}));i.getHeaderTable().addClass("e-table");i.getContentTable().addClass("e-table");e=i.getScrollElement();f.isFromGantt&&(b=e.ejScroller("isHScroll"),b?e.removeClass("e-borderbox"):e.addClass("e-borderbox"));f.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||f.isFromGantt||this._updateTableWidth();e.ejScroller("refresh");i._updateScrollCss();i._updateHeaderScrollLeft();f.isFromGantt&&!e.ejScroller("isHScroll")&&e.scrollTop(e.data("ejScroller").scrollTop());u=n.inArray(t,i._visibleColumns);u!=-1&&i._visibleColumns.splice(u,1);f.showColumnChooser&&(i._renderColumnChooserList(!0,t),i._updateColumnMenuVisibility());i._addInitTemplate()}f.isFromGantt&&i.updateToGanttColumns()}},clearFilter:function(t){var i=this,e=i.model,u,s,f,o;if(r.isNullOrUndefined(t))for(u=e.filterSettings.filteredColumns,s=u&&u.length;u&&u.length>0;)i.clearFilter(u[0].field);else f=i.getColumnByField(t),o=n.grep(e.filterSettings.filteredColumns,function(n){return n.field===t}),f&&o.length>0&&(e.filterBarMode=="immediate"&&f.filterEditType=="numericedit"||(i._searchString="",i._fieldName="",i.filterColumn(t,"equal","","and"),i._storePreviousFilteredValue(i._fieldName,i._searchString,this._operator)),i._clearFilterElementValue(f))},getColumnByField:function(n){for(var r=this,u=r.model,i=u.columns,t=0;t<i.length;t++)if(i[t].field==n)break;return t==i.length?null:i[t]},_clearFilterElementValue:function(t){var r=this,u=t.field.split(".").join(""),i=n("#"+r._id+"_"+u+"_filterbarcell");switch(t.filterEditType){case"stringedit":n(i).val("");break;case"booleanedit":n(i).prop("checked",!1);break;case"numericedit":n(i).ejNumericTextbox("instance").option("value","");break;case"dropdownedit":n(i).ejDropDownList("instance").option("value","");break;case"datepicker":n(i).ejDatePicker("instance").option("value","");break;case"datetimepicker":n(i).ejDateTimePicker("instance").option("value","")}},_updateSummaryRowTitleCell:function(t,i){for(var u,f,e=t.length,r=0;r<e;r++)if(n(t[r]).css("display")!="none"){if(u=n(i).find(".e-summarytitle")[0],f=n(i.childNodes[r]).find(".e-summarytitle")[0],f)return;n(i.childNodes[r]).append(u);return}},showColumn:function(t){var i=this,f=i.model,b=this.getColumnByHeaderText(t),u=n.inArray(b,f.columns),k=n.inArray(t,i._visibleColumns),c,v,y,s,a,e,w;if(u!=-1&&k==-1){i._cancelEditState();i._visibleColumns.push(t);i.model.columns[u].visible=!0;c=i.getHeaderTable().find("colgroup").find("col");n(c).eq(u).show();v=i.getHeaderTable().find("thead").find("th.e-headercell");n(v).eq(u).removeClass("e-hide");f.allowFiltering&&f.filterSettings.filterType=="filterbar"&&(y=i.getHeaderTable().find("thead").find("th.e-filterbarcell"),n(y).eq(u).removeClass("e-hide"));var h=i.getContentTable().find("colgroup").find("col"),p=!0,l=u,o;n(h).eq(u).show();h=i.getRows();o=this._getFooterRows();this._frozenColumnsLength>0?u<this._frozenColumnsLength?(h=n(i.getRows()[0]),o=n(o[0]),i._gridRows&&n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s+1))):(h=n(i.getRows()[1]),o=n(o[1]),p=!1,l=u-this._frozenColumnsLength,i._gridRows&&n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s+1))):i._gridRows&&n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s+1));h.each(function(){var t=n(this).children("td").eq(l);n(t).removeClass("e-hide");f.showSummaryRow&&n(t).hasClass("e-summaryrowcell")&&p&&i._updateSummaryRowTitleCell(c,t[0].parentElement)});f.showTotalSummary&&(a=i._$footertableContent.find("colgroup").find("col"),n(a).eq(u).show(),o.each(function(){var t=n(this).children("td").eq(l);n(t).removeClass("e-hide");n(t).hasClass("e-footersummaryrowcell")&&i._updateSummaryRowTitleCell(a,t[0].parentElement)}));i._addInitTemplate();e=i.getScrollElement();f.isFromGantt&&(w=e.ejScroller("isHScroll"),w?e.removeClass("e-borderbox"):e.addClass("e-borderbox"));f.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||f.isFromGantt||this._updateTableWidth();e.ejScroller("refresh");i._updateScrollCss();i._updateHeaderScrollLeft();f.isFromGantt&&!e.ejScroller("isHScroll")&&e.scrollTop(e.data("ejScroller").scrollTop());u=n.inArray(t,i._hiddenColumns);u!=-1&&i._hiddenColumns.splice(u,1);f.showColumnChooser&&(i._renderColumnChooserList(!0,t),i._updateColumnMenuVisibility())}f.isFromGantt&&i.updateToGanttColumns()},getHiddenColumns:function(){for(var n=this,f=n.model,i=n._hiddenColumns,u=i.length,r=[],t=0;t<u;t++)r.push(n.getColumnByHeaderText(i[t]));return r},getColumnByIndex:function(n){var i=this,r=i.model,t=r.columns;return t.length>n?t[n]:null},getVisibleColumns:function(){for(var n=this,f=n.model,i=n._visibleColumns,u=i.length,r=[],t=0;t<u;t++)r.push(n.getColumnByHeaderText(i[t]));return r},cancelEdit:function(){this._isRowEdit?this.cancelRowEditCell():this.model.isEdit&&this.cancelEditCell()},redraw:function(){this.resetModelCollections();this._clearColumnMenu();this._clearContextMenu();this._removeDetailsRow();this.element.empty();this.element.off();var u=jQuery.uaMatch(navigator.userAgent),t=this,i=this.model;t._off(t.element,"click",t._onClick);t._off(t.element,"keydown",t._keyDown);t._off(t.element,"click","#"+t._id+"e-gridheader",t._onHeaderClick);t._off(t.element,"mousedown touchstart","#"+t._id+"e-gridheader",t._headerMouseDown);t._off(n(document),"mousedown touchstart",t._mouseDownHandler);t._off(t.element,"mousedown touchstart",".e-gridcontent",t._contentMouseDown);t._off(t.element,"click",t._onRecordClick);i.filterSettings.filterBarMode=="immediate"&&(t._off(t.element,"keyup",".e-filterbarcell input",t._filterBarHandler),t._off(t.element,"click",".e-filterbarcell .e-checkbox")._off(t.element,"click",".e-filterbarcell .e-checkbox",t._filterBarHandler));t._off(t.element,"focus click",".e-filterbarcell input",t._filterBarClose);t._off(t.element,"click",".e-filterbarcell .e-cancel",t._filterBarClose);t.model.showGridCellTooltip&&!t.model.showGridExpandCellTooltip?r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover):t._off(t.element,"mousemove",".e-rowcell",t._mouseHover):t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover);t.model.showGridCellTooltip&&(r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-headercelldiv",t._headermouseHover):t._off(t.element,"mousemove",".e-headercelldiv",t._headermouseHover));t._off(t.element,"mouseleave",".e-rowcell",t._cellMouseLeave);t._off(t.element,"mouseleave",t._cellMouseLeave);t._off(t.element,"mouseleave",".e-headercelldiv",t._headerMouseLeave);t._off(t.element,"mouseleave",t._headerMouseLeave);(i.isFromGantt||this._frozenColumnsLength)&&t._off(t.element,"mousewheel DOMMouseScroll",t._mouseWheel);i.enableResize&&i.isResponsive&&!i.isFromGantt&&t._off(n(window),"resize",t._windowResize);r.isTouchDevice()?t._off(t.element,"doubletap ",".e-gridcontent",t._editdblClickHandler):t._off(t.element,"dblclick ",".e-gridcontent",t._editdblClickHandler);i.contextMenuSettings.showContextMenu&&t._off(t.element,"keyup",this._preventContextMenu);this._init()},clearColumnMenu:function(){var n=this;n._clearColumnMenu()},"export":function(t,i,u){var f=this,s=f.model,o,h,e,c,l,a,v,y;return f.contextMenuOperations("Cancel"),o=f._getExportModel(s),h={action:t,method:"post","data-ajax":"false"},n("form#"+f._id+"export").remove(),e=r.buildTag("form#"+f._id+"export","",null,h),r.raiseWebFormsServerEvents?(c={model:o,originalEventType:i},l={model:JSON.stringify(o)},r.raiseWebFormsServerEvents(i,c,l)):(a={},u?n("body").find(".e-treegrid").each(function(t,i){var o=n(i).data("ejTreeGrid"),l,u,h,c;r.isNullOrUndefined(o)||(l=o.model,u=f._getExportModel(s),a[t]=JSON.stringify(u),h={name:"TreeGridModel",type:"hidden",value:JSON.stringify(u)},c=r.buildTag("input","",null,h),e.append(c))}):(v={name:"TreeGridModel",type:"hidden",value:JSON.stringify(o)},y=r.buildTag("input","",null,v),e.append(y),e.append(this)),n("body").append(e),e.submit()),!0},_getExportModel:function(t){var h=this,r=t,l=r.updatedRecords,a=r.currentViewData,v=r.flatRecords,y=r.parentRecords,p=r.summaryRowRecords,w=r.selectedItem,b=r.selectedItems,e,s,c,i;delete r.updatedRecords;delete r.currentViewData;delete r.flatRecords;delete r.parentRecords;delete r.summaryRowRecords;delete r.selectedItem;delete r.selectedItems;e=n.extend(!0,{},r);r.updatedRecords=l;r.currentViewData=a;r.flatRecords=v;r.parentRecords=y;r.selectedItem=w;r.selectedItems=b;r.summaryRowRecords=p;var f=e.columns,k=f.length,o=e.filterSettings.filteredColumns,d=o.length;for(i=0;i<k;i++){if(e.columns[i].editType!=u)switch(f[i].editType){case"stringedit":case"edittemplate":f[i].editType="string";break;case"numericedit":f[i].editType="numeric";break;case"dropdownedit":f[i].editType="dropdown";break;case"booleanedit":f[i].editType="boolean"}if(f[i].filterEditType!=u)switch(f[i].filterEditType){case"stringedit":f[i].filterEditType="string";break;case"numericedit":f[i].filterEditType="numeric";break;case"dropdownedit":f[i].filterEditType="dropdown";break;case"booleanedit":f[i].filterEditType="boolean"}}for(i=0;i<d;i++)o[i].operator=="equal"?o[i].operator="equals":e.filterSettings.filteredColumns[i].operator=="notequal"&&(o[i].operator="notequals");if(s=h.ignoreOnExport,c=s.length,h.ignoreOnExport)for(i=0;i<c;i++)delete e[s[i]];return e},_getNonContentHeight:function(){var t=this,f=t.model,i=0,u=0;return u=t.model.isFromGantt?0:1,i=t._$gridHeaderContent.outerHeight()+parseFloat(u),t.model.toolbarSettings.showToolbar&&(i+=r.isNullOrUndefined(n("#"+t._id+"_toolbarItems").outerHeight())?0:n("#"+t._id+"_toolbarItems").outerHeight()),f.allowPaging&&(i+=t.element.find(".e-pager").outerHeight()),i},_getViewPortHeight:function(){return this.element.height()-this._getNonContentHeight()},updateViewPortHeight:function(){var n=this;n._viewPortHeight=n._getViewPortHeight()},_updateScrollCss:function(){var n=this,t=n.model,i;if(!t.isFromGantt){var u=n.isVScroll(),f=n._$gridHeaderContent.hasClass("e-scrollcss"),r=/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor);r&&n._$gridHeaderContent.removeClass("e-gridheader");u?(this.mobileDevice()||n._$gridHeaderContent.addClass("e-scrollcss"),t.showTotalSummary&&n._$totalSummaryRowContainer&&n._$totalSummaryRowContainer.outerHeight()<90&&(this.mobileDevice()||n._$totalSummaryRowContainer.addClass("e-scrollcss"),this.mobileDevice()?n._$totalSummaryRowContainer.width(n._$gridContent.width()):n._$totalSummaryRowContainer.width(n._$gridContent.width()-17))):(n._$gridHeaderContent.removeClass("e-scrollcss"),t.showTotalSummary&&n._$totalSummaryRowContainer&&n._$totalSummaryRowContainer.outerHeight()<90&&(n._$totalSummaryRowContainer.removeClass("e-scrollcss"),n._$totalSummaryRowContainer.width(n._$gridContent.width())));this._updateHeaderScrollLeft(this.getScrollElement().ejScroller("model.scrollLeft"));this._frozenColumnsLength&&(i=this.getContent().find("#e-movablecontent"+n._id).height(),i!=this.getContent().find("#e-frozencontainer"+n._id).height()&&this.getContent().find("#e-frozencontainer"+n._id).height(i));r&&(n._$gridHeaderContent[0].style.width=n._gridWidth+"px",n._$gridHeaderContent.addClass("e-gridheader"));n._resizeFilteringElements()}},_updatePagerIndex:function(){var n=this,u=n.model,h=[],i=-1,f=-1,e=u.updatedRecords,t,l,a;if(u.allowPaging){if(t=u.pageSettings.pageSize,u.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root){var c=u.parentRecords.slice(),o=-1,s=-1;n._gridRecordsCount=c.length;l=n._gridRecordsCount<1?0:t==0?0:Math.ceil(n._gridRecordsCount/t);n._currentPage()>l&&n._currentPage(l);o=n._currentPage()*t>n._gridRecordsCount?n._gridRecordsCount:n._currentPage()*t;s=n._gridRecordsCount<=t?0:n._currentPage()*t-t;i=e.indexOf(c[o]);s>o?s=o-t:n._gridRecordsCount==o&&(i=e.length);f=e.indexOf(c[s]);n._updatedPageData=this.getExpandedRecords(e.slice(f,i))}else h=this.getExpandedRecords(e),n._gridRecordsCount=u.enableVirtualization?e.length:h.length,a=n._gridRecordsCount<1?0:t==0?0:Math.ceil(n._gridRecordsCount/t),n._currentPage()>a&&n._currentPage(a),i=n._currentPage()*t>n._gridRecordsCount?n._gridRecordsCount:n._currentPage()*t,f=n._gridRecordsCount<t?0:n._currentPage()*t-t,f>i&&(f=i-t),n._updatedPageData=h.slice(f,i);n.updateHeight()}},_updateCurrentViewData:function(t){var i=this,u=i.model,o={},f,s=!1,h,e;u.enableVirtualization?(u.allowPaging?(t!=r.TreeGrid.Actions.Scroll&&i._updatePagerIndex(),i.getVisibleRange(),u.currentViewData=u.sizeSettings.height?i._updatedPageData.slice(i._visibleRange.top,i._visibleRange.bottom):i._updatedPageData):(i.getVisibleRange(),u.currentViewData=i.model.updatedRecords.slice(i._visibleRange.top,i._visibleRange.bottom)),u.allowDragAndDrop&&i._dragMouseDown&&(r.browserInfo().name=="chrome"||r.isTouchDevice())&&(h=i.getUpdatedRecords(),e=h.indexOf(i._draggedRecord),(i._visibleRange.top>e||i._visibleRange.bottom<e)&&(i._dummyElement||(n(document.body).append(i._draggedElement),i._dummyElement=!0,n(i._draggedElement).hide()))),i._vScrollDist!==0&&(f=i._scrollTop-i._offset,o.requestType=t&&t==r.TreeGrid.Actions.Scroll?r.TreeGrid.Actions.Scroll:r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(o),s=!0,this._frozenColumnsLength>0?(i._$frozenTableContent.css({top:f}),i._$movableTableContent.css({top:f})):i._$tableContent.css({top:f})),i._prevRTop=i._visibleRange.top,i._prevRBottom=i._visibleRange.bottom):u.allowPaging?(i._updatePagerIndex(),u.currentViewData=i._updatedPageData):u.currentViewData=i.model.updatedRecords.slice();i._isEnterKeyPressed&&(i._isEnterKeyPressed=!1,u.allowSelection&&u.editSettings.allowEditing&&(s||(i._cellEditingDetails.rowIndex+=1),i._rowSelectingEventTrigger(this.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex)),i.cellEdit(i._cellEditingDetails.rowIndex,i.model.columns[i._cellEditingDetails.columnIndex].field)))},_getRowPosition:function(n){return Math.ceil(n/(this.model.rowHeight+this._detailsRowHeight))},_getMetaColGroup:function(){return this.getHeaderTable().find("colgroup").clone()},_getEmptyTbody:function(){var t=this,i=r.buildTag("td",t.model.emptyRecordText,{},{colSpan:t.model.columns.length});return n(document.createElement("tr")).append(i)},_addSortElementToColumn:function(t,i){var u=this,s=this.model,e,o,f;e=s.isFromGantt?r.TreeGrid.getColumnByMappingName(u.model.columns,t):r.TreeGrid.getColumnByField(u.model.columns,t);o=n.inArray(e,u.model.columns);f=u.getHeaderTable().find("thead").find(".e-headercell").eq(o).find(".e-headercelldiv");f.find(".e-ascending,.e-descending").remove();f.append(u._createSortElement().addClass("e-"+i).addClass("e-icon"));f.parent().attr("aria-sort",i)},_createSortElement:function(){return r.buildTag("span"," ")},_renderCellEditObject:function(t,i){var f=this,a=r.buildTag("form.#"+f._id+"EditForm","",{},{}),v=f._cellEditTemplate,u,l,o={},e=t.columnObject,s=e.field.split(".").join(""),c=t.value,h;e.editType=="dropdownedit"&&c==!1&&(c=c.toString());o[s]=c;columnIndex=f.getColumnIndexByField(e.field);i.empty();i.addClass("e-validError");l=v.find("#"+s+"_CellEdit").html();u=e.field==="predecessor"||e.field==="duration"?n(n.templates(l).render(t.data)):n(n.templates(l).render(o));u.get(0).tagName=="SELECT"&&(u.val(o[s]),u.val()==null&&u.val(u.find("option").first().val()));u.get(0).tagName=="INPUT"&&f.model.isFromGantt?e.field!="predecessor"&&e.field!="duration"&&u.val(o[s]):u.get(0).tagName=="INPUT"&&u.val(o[s]);a.append(u);i.append(a);f._setoffsetWidth();h={};h.columnIndex=t.columnIndex;h.data=t.data.item;h.requestType="beginEdit";f._refreshEditForm(h);n.isFunction(n.validator)&&!n.isEmptyObject(t.validationRules)&&(f._initValidator(),f.setValidation());f.model.isEdit=!0},_setoffsetWidth:function(){var u=this,f=u.model,t,e=n("#"+u._id+"EditForm"),h=n("#"+u._id+"EditFrozenForm"),r=0,o=u._cellEditingDetails.rowIndex,s,i;for(t=f.editSettings.editMode.toLowerCase()!="cellediting"||u._isRowEdit?h.add(e).find("tr").find(".e-rowcell"):e.closest("td"),s=t.length,r;r<s;r++)i=n(t.children()[0]).children(),u._tdsOffsetWidth[r]=i.length>1?f.currentViewData[o].level==0&&f.currentViewData[o].hasChildRecords?n(t.get(r)).width()-(n(t.children()[0]).outerWidth()-n(t.children()[0]).width())-i[0].offsetWidth-i[2].offsetWidth-(n(i[3]).outerWidth()-n(i[3]).width()):n(t.get(r)).width()-(n(t.children()[0]).outerWidth()-n(t.children()[0]).width())-i[0].offsetWidth-i[1].offsetWidth-(n(i[3]).outerWidth()-n(i[3]).width()):n(t.get(r)).width()},getIndexofresourceInfo:function(n){var u=this,o=u.model,f=o.resourceIdMapping,s=u._cellEditingDetails.data,r=s.resourceInfo,i=0,h=r&&r.length,e=[],t;for(i;i<h;i++)for(t=0;t<n.length;t++)n[t][f]==r[i][f]&&e.push(t);return e},_refreshEditForm:function(t){var s=this,b,c,rt,a,g,ot,nt,tt,h,it,v;s.model.editSettings.allowEditing&&s.model.editSettings.editMode=="dialogEditing"?(b=n("#"+s._id+"EditFormDialog"),c="",rt=!0):(b=n("#"+s._id+"EditForm"),c=s.model.rowHeight-5);var st=n("#"+s._id+"EditFrozenForm"),ut=!1,ft=st.add(b).find("input,select,textarea"),y=0,ht=ft.length,f,l,o=s.model,et,i={},k,e,p,w,d;for(y;y<ht;y++)if(f=ft.eq(y),d=f.attr("edittype"),e=r.TreeGrid.getColumnByField(o.columns,f.prop("name")),r.isNullOrUndefined(e)&&s.model.editSettings.editMode=="dialogEditing"){if(f.hasClass("e-btn")||s.model.editSettings.editMode=="dialogEditing"&&!r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)&&o.editSettings.dialogEditorTemplateID!="")return;f.closest("tr").addClass("e-hide")}else{s.model.editSettings.editMode!="dialogEditing"||r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)||o.editSettings.dialogEditorTemplateID==""||(d=e.editType);l="100%";switch(d){case r.TreeGrid.EditingType.Numeric:i={};et=l;k=f.val();i.width=et;i.locale=o.locale;i.height=c;i.showSpinButton=!0;i.cssClass=o.cssClass;k.length&&(i.value=parseFloat(k));o.isFromGantt&&e.field==="status"&&(i.minValue=0,i.maxValue=100,i.decimalPlaces=0);r.isNullOrUndefined(e.editParams)||n.extend(i,e.editParams);f.ejNumericTextbox(i);f.prop("name",f.prop("name").replace(s._id,""));break;case r.TreeGrid.EditingType.DatePicker:i={};i.width=l;i.height=c;i.locale=o.locale;i.cssClass=o.cssClass;i.dateFormat=o.dateFormat;i.enableStrictMode=!0;o.isFromGantt&&(i.startDay=o.weekStartDay);f.val().length&&(i.value=s.getDateFromFormat(f.val()));e.format!==u&&e.format.length>0&&(p=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),w=p.exec(e.format),i.dateFormat=w[2],f.val().length&&(i.value=r.format(new Date(f.val()),i.dateFormat,i.locale),f.val(i.value)));r.isNullOrUndefined(e.editParams)||n.extend(i,e.editParams);o.dateFormat.toLowerCase().indexOf("hh")==-1?f.ejDatePicker(i):f.ejDateTimePicker(i);break;case r.TreeGrid.EditingType.DateTimePicker:i={};i.width=l;i.height=c;i.locale=o.locale;i.cssClass=o.cssClass;i.displayDefaultDate=!0;i.dateTimeFormat=o.dateFormat;i.enableStrictMode=!0;o.isFromGantt&&(i.startDay=o.weekStartDay);f.val().length&&(i.value=s.getDateFromFormat(f.val()));e.format!==u&&e.format.length>0&&(p=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),w=p.exec(e.format),i.dateTimeFormat=w[2],f.val().length&&(i.value=r.format(new Date(f.val()),i.dateTimeFormat,i.locale),f.val(i.value)));r.isNullOrUndefined(e.editParams)||n.extend(i,e.editParams);f.ejDateTimePicker(i);break;case r.TreeGrid.EditingType.Dropdown:s._isRowEdit?(a=e.dropdownData,g=e.field):(a=e.dropdownData,g=e.field);o.isFromGantt&&g==="resourceInfo"?f.ejDropDownList({width:l,height:c,showCheckbox:!0,dataSource:a,fields:{id:o.resourceIdMapping,text:o.resourceNameMapping,value:o.resourceNameMapping},selectedItems:s.getIndexofresourceInfo(a)}):(h={},h.cssClass=o.cssClass,h.width=l,h.height=c,h.dataSource=a,r.isNullOrUndefined(e.editParams)||n.extend(h,e.editParams),f.ejDropDownList(h),ot=f.ejDropDownList("instance"),ot._setValue(f.attr("cellValue")));break;case r.TreeGrid.EditingType.String:s.model.editSettings.allowEditing&&s.model.editSettings.editMode=="dialogEditing"?f.outerWidth("100%").height(27):f.outerWidth(l).height(o.rowHeight-9);break;case r.TreeGrid.EditingType.Boolean:s._checkboxSelection&&e.nonColumn?f[0].style.display="none":(h={},h.cssClass=o.cssClass,h.size="small",r.isNullOrUndefined(e.editParams)||n.extend(h,e.editParams),f.ejCheckBox(h),nt=f.parent(".e-chkbox-wrap"),tt=nt.parent("form"),rt||(tt.length>0?tt.css("margin-left","45%"):nt.css("margin-left","45%")));break;case r.TreeGrid.EditingType.Maskedit:h={};h.locale=o.locale;h.cssClass=o.cssClass;h.width=l;h.height=c;r.isNullOrUndefined(e.editParams)||n.extend(h,e.editParams);f.ejMaskEdit(h);break;case"edittemplate":it={rowdata:t.data,column:e,element:f,requestType:t.requestType};v=e.editTemplate.write;r.isNullOrUndefined(t)||t.requestType!="add"||(it.rowdata={});typeof v=="string"&&(v=r.util.getObject(v,window));v(it)}f.is(":disabled")||ut||f.is(":hidden")&&typeof(f.data("ejDropDownList")||f.data("ejNumericTextbox")||f.data("ejDatePicker")||f.data("ejCheckBox"))!="object"||(s._isEnterKeyPressed||e!=o.columns[t.columnIndex])&&(t.columnIndex&&t.columnIndex!=-1||s._isEnterKeyPressed)||(s._focusElements(f.closest("td")),ut=!0)}},_getRecordIndex:function(){var n=this,t=n.model,i,r=t.allowPaging?n._updatedPageData:n.getExpandedRecords(t.updatedRecords);return n.getVisibleRange(),i=r.slice(n._visibleRange.top,n._visibleRange.bottom),i.indexOf(t.selectedItem)},_initValidator:function(){for(var r=this,i=n("#"+this._id+"EditForm").length>0?n("#"+this._id+"EditForm"):n("#"+this._id+"EditFormDialog"),t=0;t<i.length;t++)i.eq(t).validate({ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(n,t){r._renderValidator(n,t)}})},_renderValidator:function(t,i){var a,v,c,l;if(i.is(":hidden")&&(i=i.siblings("input:visible")),i.length){var o=this,u=o.model,f,e=i.closest(".e-rowcell"),s=n(t).addClass("e-error"),h=r.buildTag("div.e-errortail");e=e.length?e:e=i.closest("td");e.find(".e-error").remove();u.editSettings.editMode!="dialogEditing"?(f=o._getRecordIndex(),a=(f+1)*u.rowHeight,u.enableVirtualization||(v=o.getExpandedRecords(u.updatedRecords),f=u.allowPaging?o._updatedPageData.indexOf(u.selectedItem):v.indexOf(u.selectedItem)),f==-1&&(u.editSettings.rowPosition=="bottom"?f=u.updatedRecords.length-1:u.editSettings.rowPosition=="top"&&(f=0),a=(f+1)*u.rowHeight),o._viewPortHeight<a+45?(h.addClass("e-bottomarrow"),c=f*u.rowHeight-45,l="append"):(h.addClass("e-toparrow"),c=(f+1)*u.rowHeight,l="prepend")):(c=e.offset().top-n("#"+this._id+"EditFormDialog").offset().top+e.parent()[0].offsetHeight,h.addClass("e-toparrow"),l="prepend");n(s).css({top:c});i.parent().hasClass("e-in-wrap")?s.insertAfter(i.closest(".e-widget")):s.insertAfter(i);s[l](h);s.show("slow")}},setValidation:function(){for(var i=this,n=i.model,t=0;t<this.model.columns.length;t++)if(!r.isNullOrUndefined(n.columns[t].validationRules))if(n.editSettings.editMode==r.TreeGrid.EditMode.RowEditing||n.editSettings.editMode==r.TreeGrid.EditMode.DialogEditing||i.element.find(".e-rowedit").length>0||i.element.find(".e-addedrow").length>0)this.setValidationToField(n.columns[t].field,n.columns[t].validationRules);else if(n.editSettings.editMode==r.TreeGrid.EditMode.CellEditing&&i._cellEditingDetails.columnIndex==t){this.setValidationToField(n.columns[t].field,n.columns[t].validationRules);return}},setValidationToField:function(t,i){var u=t,f,o,s,e;r.isNullOrUndefined(t)||(u=u.replace(/[^a-z0-9\s_]/gi,""));o=n("#"+this._id+"EditForm").length>0?n("#"+this._id+"EditForm"):n("#"+this._id+"EditFormDialog");f=o.find("#"+this._id+u).length>0?o.find("#"+this._id+u):o.find("#"+u);i.regex&&(i[t+"regex"]=i.regex,delete i.regex,n.validator.addMethod(u+"regex",function(n,t,i){var r=i instanceof RegExp?i:new RegExp(i);return r.test(n)},r.getObject("messages.regex",i)||this.getColumnByField(t).headerText+" should match the given pattern"));f.attr("name")||f.attr("name",t);f.rules("add",i);s=n("#"+this._id+"EditForm").length>0?n("#"+this._id+"EditForm").validate():n("#"+this._id+"EditFormDialog").validate();s.settings.messages[t]=s.settings.messages[t]||{};r.isNullOrUndefined(i.required)||(e=r.isNullOrUndefined(i.messages&&i.messages.required)?n.validator.messages.required:i.messages.required,e.indexOf("This field")==0&&(e=e.replace("This field",this.getColumnByField(t).headerText)),s.settings.messages[t].required=e,f.hasClass("e-datepicker")&&f.ejDatePicker({watermarkText:""}))},_focusElements:function(n){var i=this,t,u,f;n.length&&(n.focus(),t=n.children(),t[0]&&(t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t.find(".e-ddl").focus():t.find(".e-chkbox-wrap.e-widget").length?t.find(".e-chkbox-wrap.e-widget").focus():t.find(".e-datepicker").length<=0?t.find("input,select").select().focus():t.find("input,select").select()));u=i.getScrollElement().children(".e-content").scrollLeft();f=i.getScrollElement().ejScroller("option","scrollLeft");i.getScrollElement().hasClass("e-scroller")&&u!=f&&(r.isNullOrUndefined(u)||i.getScrollElement().ejScroller("option","scrollLeft",u));i._updateHeaderScrollLeft(i.getScrollElement().children(".e-content").scrollLeft())},_focusElementsForRowEdit:function(n){if(n.length){var t=n.children();t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t[0].focus():t.hasClass("e-chkbox-wrap")?t[0].focus():t.find(".e-datepicker").length<=0?t.find("input:visible,select").first().select().focus():t.find("input,select").select()}},updateHeight:function(){var n=this,t=this.model,i=0,u=0,r;n._$gridContainer&&n._$gridContent&&(i=t.allowPaging?t.rowHeight*n._updatedPageData.length:t.enableVirtualization?t.updatedRecords.length*t.rowHeight:t.rowHeight*(t.updatedRecords.length-n.getCollapsedRecordCount()),t.showDetailsRow&&t.detailsTemplate&&!t.showDetailsRowInfoColumn&&(u=n._getExpandedDetailsRowHeight()),i+=u,i==0&&(t.currentViewData.length==0||t.flatRecords.length==0)&&(i=30),t.allowPaging&&!t.sizeSettings.height&&(r=i,this._frozenColumnsLength>0?n._$gridContent.css("height",i):n.getScrollElement().hasClass("e-scroller")&&(n.getScrollElement().ejScroller("isHScroll")&&(r=i+n._scrollBarHeight),n.getScrollElement().ejScroller({height:r})),n._viewPortHeight=r,n._gridHeight=i+n._getNonContentHeight(),n._summaryRowsCount>0&&t.showTotalSummary&&(n._gridHeight+=n._$totalSummaryRowContainer.outerHeight()),n.element.height(n._gridHeight)),n._$gridContainer.css({height:i+"px",width:"auto"}),this._frozenColumnsLength&&n._$gridContainer.find("#e-movablecontentdiv"+n._id+",#e-frozencontentdiv"+n._id).css("height",i+"px"),n.getScrollElement().hasClass("e-scroller")&&(n.getScrollElement().ejScroller("refresh"),n._updateScrollCss()))},_setScrollTop:function(){var t=this,i=this.model,u=0,r=t._scrollTop,f=i.rowHeight,e=i.currentViewData.length,o=i.isFromGantt?t._id.replace("ejTreeGrid",""):t._id;ganttbody=n("#"+o).find(".e-ganttviewerbodyContianer");i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(f+=t._detailsRowHeight);i.allowPaging&&t._isNextPage&&(r=0,t._isNextPage=!1,t.getScrollElement().ejScroller("scrollY",r,!0));r!==0&&(i.enableVirtualization?e*f<t._viewPortHeight&&(e>0&&(u=r-(t._viewPortHeight-(e-1)*f),u<0&&(u=0)),i.isFromGantt?ganttbody.ejScroller("scrollY",u,!0):t.getScrollElement().ejScroller("scrollY",u,!0)):i.isFromGantt?ganttbody.ejScroller("scrollY",r,!0):t.getScrollElement().ejScroller("scrollY",r,!0))},getChildCount:function(n,t){var r,u=this,i;if(!n.hasChildRecords)return 0;for(i=0;i<n.childRecords.length;i++)r=n.childRecords[i],t++,r.hasChildRecords&&(t=u.getChildCount(r,t));return t},_updateFilteredRecords:function(n){var t=this,r=0,u=n.length,i,f=t.model.enableVirtualization;for(t._flatFilteredRecords=[],t._filteredRecords=[],t._filteredGanttRecords=[],r;r<u;r++)i=n[r],t._addParentRecord(i),this.model.isFromGantt||(i.hasChildRecords&&i.childRecords.length>0&&(i.hasFilteredChildRecords=this._checkChildExsist(i,n)?!0:!1),i.parentItem&&(i.parentItem.hasFilteredChildRecords=!0));t._filteredRecords=f?t.getExpandedRecords(t._flatFilteredRecords):t._flatFilteredRecords.slice()},_checkChildExsist:function(t,i){for(var u=t.childRecords,e=u.length,f=!1,r=0;r<e;r++)if(n.inArray(u[r],i)!=-1){f=!0;break}else u[r].hasChildRecords&&(f=this._checkChildExsist(u[r],i));return f},_updateHasFilteredChildRecordsStatus:function(n){var t=0,r=n.length,i;for(t;t<r;t++)i=n[t],i.hasChildRecords&&!i.hasFilteredChildRecords&&(i.hasFilteredChildRecords=!0)},_addParentRecord:function(t){var i=this;t.parentItem&&i._addParentRecord(t.parentItem);n.inArray(t,i._flatFilteredRecords)===-1&&i._flatFilteredRecords.push(t)},_updateExpandCollapseForSortedRecords:function(n,t){var i=this,r=0,o=i._sortedRecords.length,u,f=i._sortedRecords.indexOf(n),e;if(t)i._addNestedSortRecords(n,f);else{for(e=0,r=f+1;r<o;r++)if(u=i._sortedRecords[r],u.level===n.level)break;else i.getExpandStatus(u)||e++;i._sortedRecords.splice(f+1,e)}},_addNestedSortRecords:function(t,i){var u=this,c,o=u.model.sortSettings.sortedColumns,s,e,l,h,f;if(o.length)for(s=o.length-1,u._queryManagar.queries=[],e=s;e>=0;e--)u._queryManagar.sortBy(o[e].field,o[e].direction);if(t.hasChildRecords)for(l=r.DataManager(t.childRecords),c=l.executeLocal(u._queryManagar).result,s=c.length,h=0;h<s;h++)f=c[h],u._filteredRecords.length?n.inArray(f,u._filteredRecords)!==-1&&u._sortedRecords.splice(++i,0,f):u._sortedRecords.splice(++i,0,f),f.hasChildRecords&&f.expanded&&u._addNestedSortRecords(f,i)},updateEditSettings:function(n){var t=this;n&&(n.editMode&&(t.model.editSettings.editMode==="normal"&&n.editMode==="cellEditing"?(t.model.editSettings.editMode=n.editMode,t._processEditing()):t.model.editSettings.editMode=n.editMode),r.isNullOrUndefined(n.allowAdding)||(t.model.editSettings.allowAdding=n.allowAdding),r.isNullOrUndefined(n.allowEditing)||(t.model.editSettings.allowEditing=n.allowEditing),r.isNullOrUndefined(n.allowDeleting)||(t.model.editSettings.allowDeleting=n.allowDeleting),r.isNullOrUndefined(n.beginEditAction)||(t.model.editSettings.beginEditAction=n.beginEditAction),t._enableEditingEvents())},updateAltRow:function(){for(var i=this,t=0,r=i.model.updatedRecords,f=r.length,n,u=!0,t=0;t<f;t++)(n=r[t],!n.isSummaryRow&&i.getExpandStatus(n))&&(n.isAltRow=!u,u=n.isAltRow)},_getFilteredChildRecordsCount:function(n){for(var t=this,u=t.model,f=n&&n.childRecords&&n.childRecords.length,i=0,r,i=0;i<f;i++)r=n.childRecords[i],u.enableVirtualization?t.getExpandStatus(r)&&t._removedCount++:t._removedCount++,r.childRecords&&t._getFilteredChildRecordsCount(r);return t._removedCount},_sortingRecords:function(){var n=this,t=n.model,f=t.sortSettings.sortedColumns,e,u,i,o,s,h;if(n._queryManagar.queries=[],f.length)for(e=f.length-1,u=e;u>=0;u--)t.isFromGantt?(o=r.TreeGrid.getColumnByMappingName(n.model.columns,f[u].field),i=o.field):i=f[u].field,t.isFromGantt&&(i==="resourceInfo"?i="resourceNames":i==="predecessor"&&(i="predecessorsName")),n._queryManagar.sortBy(i,f[u].direction);return s=new r.DataManager(t.parentRecords),h=s.executeLocal(n._queryManagar).result,n._sortedRecords=[],n._storedIndex=-1,n._rowIndex=-1,n._createSortedRecords(h),n._tempsortedrecords=n._sortedRecords,n.model.updatedRecords=n._sortedRecords,t.allowPaging&&t.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(t.parentRecords=n._getParentRecords(n.model.updatedRecords,n,!0)),!0},_createSortedRecords:function(t){var i=this,f=i.model,u=i._sortedRecords,e,o=i.model.enableAltRow,f=this.model;t=i._spliceSummaryRows(t);n.each(t,function(n,t){var s,h;if(t.isSummaryRow){s=t.parentItem.childRecords.indexOf(t);t.parentItem.childRecords.splice(s,1);return}i._searchString.length>0||f.filterSettings.filteredColumns.length>0?i._filteredRecords.length>0&&i._filteredRecords.indexOf(t)!==-1&&(i._storedIndex++,i._rowIndex++,o&&(t.isAltRow=i._rowIndex%2==0?!1:!0),u[i._storedIndex]=t):(i._storedIndex++,i._rowIndex++,o&&(t.isAltRow=i._rowIndex%2==0?!1:!0),u[i._storedIndex]=t);t.hasChildRecords&&t.expanded?(t.childRecords=i._spliceSummaryRows(t.childRecords),e=r.DataManager(t.childRecords),h=e.executeLocal(i._queryManagar).result,i._createSortedRecords(h)):!t.hasChildRecords||t.expanded||f.enableVirtualization||(t.childRecords=i._spliceSummaryRows(t.childRecords),i._setChildRecords(t,u))})},_setChildRecords:function(n,t){var i=this,o=i.model,e=i.model.enableAltRow,s=n.childRecords.length,f,u;for(dataManager=r.DataManager(n.childRecords),f=dataManager.executeLocal(i._queryManagar).result,u=0;u<s;u++)i._searchString.length>0||o.filterSettings.filteredColumns.length>0?i._filteredRecords.length>0&&i._filteredRecords.indexOf(f[u])!==-1&&(i._storedIndex++,e&&(f[u].isAltRow=i._storedIndex%2==0?!1:!0),t[i._storedIndex]=f[u],f[u].hasChildRecords&&this._setChildRecords(f[u],t)):(i._storedIndex++,e&&(f[u].isAltRow=i._storedIndex%2==0?!1:!0),t[i._storedIndex]=f[u],f[u].hasChildRecords&&this._setChildRecords(f[u],t))},_updateSortedRecords:function(t){var u=this,f=0,s=t.length,i,h=this.model,e,o;for(f;f<s;f++)i=t[f],h.enableVirtualization||(u._filteredRecords.length>0?n.inArray(i,u._filteredRecords)!==-1&&n.inArray(i,u._sortedRecords)===-1&&u._sortedRecords.push(i):n.inArray(i,u._sortedRecords)===-1&&u._sortedRecords.push(i),i.hasChildRecords&&i.childRecords.length>0&&(e=r.DataManager(i.childRecords),o=e.executeLocal(u._queryManagar).result,u._updateSortedRecords(o)))},_removeSortElementFromColumn:function(t){var i=this,f=r.TreeGrid.getColumnByField(i.model.columns,t),e=n.inArray(f,i.model.columns),u=i.getHeaderTable().find("thead").find(".e-headercell").eq(e).find(".e-headercelldiv");u.find(".ascending,.descending").remove();u.parent().removeAttr("aria-sort")},_addEmptyColumntoGrid:function(){var t=this;n(t.element).find(".e-gridheadercontainer table colgroup").append(r.buildTag("col","",{width:"auto"},{}));t._$gridContainer.find("table colgroup").append(r.buildTag("col","",{width:"auto"},{}));n(t.element).find(".e-gridheadercontainer table thead tr").append(r.buildTag("th.e-headercell"))},updateScrollTop:function(n,t){var u={},i=this,f;u.requestType=r.TreeGrid.Actions.Scroll;u.delta=n;f=i.getScrollElement().ejScroller("isHScroll");!f&&this.model.isFromGantt?i._$gridContent.scrollTop(n):i._$gridContent.scrollTop(0);i.getScrollElement().ejScroller("scrollY",n,!0);i.model.isFromGantt&&!t?(i._completeAction(u),i._focusTreeGridElement()):i._isFromChart=!1},_selectNextCell:function(n,t){var i=this,h=i.model,u=h.columns,e=u.length,r=i.getUpdatedRecords(),f=h.allowPaging?r:i.getExpandedRecords(h.updatedRecords),o,s;i._isShiftKeyNavigation=!1;switch(n){case"right":if(i._focusingRowIndex>=r.length-1&&i._cellIndex>=e-1||i._focusingRowIndex==-1||i._cellIndex==-1){i.element[0].focus();return}if(i._cellIndex+=1,i._cellIndex==e){if(i._cellIndex=0,o=r[i._rowIndexOfLastSelectedCell],selectingRowIndex=f.indexOf(o),currentSelectingRecord=f[selectingRowIndex+1],currentSelectingRecord&¤tSelectingRecord.isSummaryRow&&(currentSelectingRecord=i._getNextRecord(selectingRowIndex+1,f)),!currentSelectingRecord)return;i._focusingRowIndex=r.indexOf(currentSelectingRecord)}if(i._focusingRowIndex>=r.length)return;(!u[i._cellIndex].visible||!u[i._cellIndex].allowCellSelection)&&$form.length<=0&&(i._cellIndex=i.getUpNextVisibleColumnIndex(i._cellIndex,t));$form.length>0&&u[i._cellEditingDetails.columnIndex].allowCellSelection&&(i._cellIndex=i._cellEditingDetails.columnIndex);s={rowIndex:i._focusingRowIndex,cellIndex:i._cellIndex};i.selectCells([s]);i.updateScrollBar();break;case"left":if(i._cellIndex-=1,e=u.length,i._cellIndex<0){if(i._cellIndex=e-1,o=r[i._rowIndexOfLastSelectedCell],selectingRowIndex=f.indexOf(o),currentSelectingRecord=f[selectingRowIndex-1],currentSelectingRecord&¤tSelectingRecord.isSummaryRow&&(currentSelectingRecord=i._getNextRecord(selectingRowIndex-1,f,"upArrow")),!currentSelectingRecord)return;i._focusingRowIndex=r.indexOf(currentSelectingRecord)}if(i._focusingRowIndex<0)return;i._focusingRowIndex>=r.length&&(i._focusingRowIndex=r.length-1);(!u[i._cellIndex].visible||!u[i._cellIndex].allowCellSelection)&&$form.length<=0&&(i._cellIndex=i.getPreviousVisibleColumnIndex(i._cellIndex,t));$form.length>0&&u[i._cellEditingDetails.columnIndex].allowCellSelection&&(i._cellIndex=i._cellEditingDetails.columnIndex);s={rowIndex:i._focusingRowIndex,cellIndex:i._cellIndex};i.selectCells([s]);i.updateScrollBar()}},_moveCurrentCell:function(t){var i=this,u=i._cellEditingDetails.rowIndex,a=i._cellEditingDetails.columnIndex,f=i.model,h=i.getUpdatedRecords(),k,y,c;if(u==-1&&a==-1)return!1;i.model.isEdit&&(i.saveCell(),i.model.isEdit=!1);f.enableVirtualization&&(k=f.currentViewData[u],i._cellEditingDetails.rowIndex=u=h.indexOf(k));switch(t){case"right":var s=f.columns,d=s.length,p=i.getHiddenColumns(),l=n.extend([],s),e,v,w;if(p&&p.forEach(function(n){l.splice(l.indexOf(n),1)}),v=l.indexOf(s[a]),w=l.length,u==h.length-1&&v==w-1)return!0;if(v==w-1){for(e=0;!s[e].visible;)e++;if(i._cellEditingDetails.columnIndex=e,i._getNextRow(t,u,i))return!0}else{for(e=a+1;!s[e].visible;)e++;i._cellEditingDetails.columnIndex=e}while(f.columns[e].allowEditing==!1||!s[e].visible){if(e+1==f.columns.length){if(i._cellEditingDetails.columnIndex=e=0,i._getNextRow(t,u,i))return!0;continue}i._cellEditingDetails.columnIndex=++e}i.updateScrollBar();i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);i._editAddTools();break;case"left":var s=f.columns,d=s.length,p=i.getHiddenColumns(),l=n.extend([],s),o,v,w;if(p&&p.forEach(function(n){l.splice(l.indexOf(n),1)}),v=l.indexOf(s[a]),w=l.length,u==0&&v==0)return!0;if(v==0){for(o=f.columns.length-1;!s[o].visible;)o--;if(i._cellEditingDetails.columnIndex=o,i._getNextRow(t,u,i))return!0}else{for(o=a-1;!s[o].visible;)o--;i._cellEditingDetails.columnIndex=o}while(f.columns[o].allowEditing==!1||!s[o].visible){if(o-1==-1){if(i._cellEditingDetails.columnIndex=o=d-1,i._getNextRow(t,u,i))return!0;continue}i._cellEditingDetails.columnIndex=--o}i.updateScrollBar();i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);i._editAddTools();break;case"up":if(u==0)return!0;i._cellEditingDetails.rowIndex=u-1;i.selectRows(i._cellEditingDetails.rowIndex);i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex);i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);break;case"down":if(u+1==h.length&&(i._focusTreeGridElement(),i._isEnterKeyPressed=!0),f.showSummaryRow&&u+1==h.length-f.summaryRows.length&&(i._isEnterKeyPressed=!0),i._isEnterKeyPressed)i._isEnterKeyPressed=!1;else{if(h.length>u+1)if(f.enableVirtualization){if(c=h[u+1],c&&c.isSummaryRow&&(c=i._getNextRecord(u+1,h)),y=h.indexOf(c),y==-1)return!0;i._cellEditingDetails.rowIndex=y}else{var g=h[u],b=f.allowPaging?h:i.getExpandedRecords(f.updatedRecords),c=b[b.indexOf(g)+1];if(c&&c.isSummaryRow&&(c=i._getNextRecord(u+1,b)),y=h.indexOf(c),u==b.length-1&&a==f.columns.length-1||y==-1)return!0;i._cellEditingDetails.rowIndex=y}i._rowSelectingEventTrigger(i.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex));i.updateScrollBar();args={};args.requestType=r.TreeGrid.Actions.Scroll;args.delta=i._$gridContent.children(".e-content").scrollTop();i._trigger("actionComplete",args);i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);i._editAddTools()}}return!1},_getNextRecord:function(n,t,i){do nextRecord=t[n],i=="upArrow"||i=="lastRowSelection"||i=="bottomRowSelection"?n--:n++;while(nextRecord&&nextRecord.isSummaryRow);return nextRecord},_getNextRow:function(n,t,i){var u,e=i.model,f=i.getUpdatedRecords(),r,o;if(u=n=="right"?1:-1,e.enableVirtualization){if(r=f[t+u],r&&r.isSummaryRow&&(o=u>0?"":"lastRowSelection",r=i._getNextRecord(t+u,f,o)),e.allowPaging&&r&&(index=f.indexOf(r),index<0&&u==1?i.gotoPage(i._currentPage()+1):index<0&&u==-1&&i.gotoPage(i._currentPage()-1)),index=f.indexOf(r),index==-1)return!0;i._cellEditingDetails.rowIndex=index}else{var h=f[t],s=e.allowPaging?f:i.getExpandedRecords(e.updatedRecords),r=s[s.indexOf(h)+u];if(r&&r.isSummaryRow&&(o=u>0?"":"lastRowSelection",r=i._getNextRecord(t+u,s,o)),e.allowPaging&&r&&(index=f.indexOf(r),index<0&&u==1?i.gotoPage(i._currentPage()+1):index<0&&u==-1&&i.gotoPage(i._currentPage()-1)),index=f.indexOf(r),index==-1)return!0;i._cellEditingDetails.rowIndex=index}e.allowSelection&&e.selectionSettings.selectionMode=="cell"?(e.selectedItem=f[i._cellEditingDetails.rowIndex],i._rowIndexOfLastSelectedCell=i._cellEditingDetails.rowIndex):i._rowSelectingEventTrigger(i.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex))},_findColumnsWidth:function(){for(var t=this,i=t.model.columns.length,r=t.getHeaderTable().find("colgroup").find("col"),n=0;n<i;n++)t.columnsWidthCollection[n]=r.eq(n).width()},_calculateWidth:function(){for(var t=this.getHeaderTable().find("colgroup").find("col"),i=0,n=0;n<t.length;n++)i+=t.eq(n).width();return i},getScrollObject:function(){return this.getScrollElement().data("ejScroller")},_updateElementHeight:function(){var n=this;n._calculateDimensions();n.updateViewPortHeight()},getScrollElement:function(){return this._frozenColumnsLength>0?this.element.find("#e-movablecontainer"+this._id):this._$gridContent},_getFrozenColumnWidth:function(n){var i=0,n=r.isNullOrUndefined(n)?this._frozenColumnsLength:n,u=r.isNullOrUndefined(n)?this._frozenColumns:this.model.columns,t;if(n>0)for(t=0;t<n;t++)i+=u[t]?this.columnsWidthCollection[t]:0;return i},_renderScroller:function(t){var i=this,u=i.model,a=u.flatRecords.length*u.rowHeight,c=i._viewPortHeight,s=!1,o,h;if(i._$gridContent.hasClass("e-scroller")&&(!u.allowPaging||u.sizeSettings.height))i.getScrollElement().ejScroller("refresh");else{var e=i._gridHeight?c:"auto",l=!1,f=this._gridWidth;this._frozenColumnsLength>0&&(i._$gridContent.css("width",f-i._totalBorderWidth),f=f-this._getFrozenColumnWidth()-1);u.isFromGantt||(l=!0);this.mobileDevice()&&!u.isFromGantt&&(s=!0,i._scrollBarHeight=10);i.getScrollElement().ejScroller({enableTouchScroll:!1,autoHide:s,scrollerSize:i._scrollBarHeight,height:i.model.isFromGantt?0:e,width:i.model.isFromGantt?f:f-i._totalBorderWidth,scroll:n.proxy(i._onScroll,i)})}i.getScrollElement().ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""});r.isNullOrUndefined(t)&&i._updateScrollCss();o=i.getScrollElement().ejScroller("isHScroll");u.allowPaging&&!u.sizeSettings.height&&o&&(h=e+i._scrollBarHeight,i.getScrollElement().ejScroller({height:h}),i.getScrollElement().ejScroller("refresh"));i.model.isFromGantt&&(o?i._$gridContent.removeClass("e-borderbox"):i._$gridContent.addClass("e-borderbox"));!this.mobileDevice()&&this.getBrowserDetails().browser=="safari"&&this._frozenColumnsLength>0&&(this.getHeaderContent().find("#e-movableheader"+i._id).add(this.getContent().find("#e-movablecontainer"+i._id)).css("margin-left","auto"),this._$totalSummaryRowContainer&&this._$totalSummaryRowContainer.find("#e-movablefooter"+i._id).css("margin-left","auto"));this._frozenColumnsLength>0&&(i._$gridContent.height(e),i.getContent().find("#e-frozencontainer"+i._id).height(i.getContent().find("#e-movablecontent"+i._id).height()))},_destroy:function(){var t=this,i=this.model,e=i.columns,u,f;if(t.element.off(),t._off(t.element,"click",t._onClick),t._off(t.element,"keydown",t._keyDown),t._off(t.element,"click","#"+t._id+"e-gridheader",t._onHeaderClick),t._off(t.element,"mousedown touchstart","#"+t._id+"e-gridheader",t._headerMouseDown),t._off(n(document),"mousedown touchstart",t._mouseDownHandler),t._off(t.element,"mousedown touchstart",".e-gridcontent",t._contentMouseDown),t._off(t.element,"click",t._onRecordClick),i.filterSettings.filterBarMode=="immediate"&&(t._off(t.element,"keyup",".e-filterbarcell input",t._filterBarHandler),t._off(t.element,"click",".e-filterbarcell .e-checkbox")._off(t.element,"click",".e-filterbarcell .e-checkbox",t._filterBarHandler)),t._off(t.element,"focus click",".e-filterbarcell input",t._filterBarClose),t._off(t.element,"click",".e-filterbarcell .e-cancel",t._filterBarClose),t.model.showGridCellTooltip&&!t.model.showGridExpandCellTooltip?r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover):t._off(t.element,"mousemove",".e-rowcell",t._mouseHover):t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover),t.model.showGridCellTooltip&&(r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-headercelldiv",t._headermouseHover):t._off(t.element,"mousemove",".e-headercelldiv",t._headermouseHover)),t._off(t.element,"mouseleave",".e-rowcell",t._cellMouseLeave),t._off(t.element,"mouseleave",t._cellMouseLeave),t._off(t.element,"mouseleave",".e-headercelldiv",t._headerMouseLeave),t._off(t.element,"mouseleave",t._headerMouseLeave),(i.isFromGantt||this._frozenColumnsLength)&&t._off(t.element,"mousewheel DOMMouseScroll",t._mouseWheel),i.enableResize&&i.isResponsive&&!i.isFromGantt&&t._off(n(window),"resize",t._windowResize),r.isTouchDevice()?t._off(t.element,"doubletap ",".e-gridcontent",t._editdblClickHandler):t._off(t.element,"dblclick ",".e-gridcontent",t._editdblClickHandler),i.contextMenuSettings.showContextMenu&&t._off(t.element,"keyup",this._preventContextMenu),this._clearColumnMenu(),this._clearContextMenu(),this._removeDetailsRow(),t._columnRenameDialog&&(t._columnRenameDialog.data("ejDialog")&&t._columnRenameDialog.data("ejDialog").destroy(),n("#"+t._columnRenameDialog.attr("id")+"_wrapper").remove(),n("#"+t._id+"ColumnRenameDialog").remove()),this.model.showColumnChooser&&(n("#"+this._id+"ccDiv").data("ejDialog")&&n("#"+this._id+"ccDiv").data("ejDialog").destroy(),n("#"+t._id+"ccDiv_wrapper").remove(),n("#"+this._id+"ccDiv").remove()),t._updateConfirmDialog&&(t._updateConfirmDialog.data("ejDialog")&&t._updateConfirmDialog.data("ejDialog").destroy(),n("#"+t._updateConfirmDialog.attr("id")+"_wrapper").remove(),n("#"+t._id+"ConfirmDialog").remove()),n("#"+t._id+"_dialogColumnAdd_wrapper").length>0&&(n("#"+t._id+"_dialogColumnAdd").data("ejDialog")&&n("#"+t._id+"_dialogColumnAdd").data("ejDialog").destroy(),n("#"+t._id+"_dialogColumnAdd_wrapper").remove(),n("#"+t._id+"_dialogColumnAdd").remove()),i.allowFiltering&&!i.isFromGantt)for(u=0;u<e.length;u++)f=n("#"+this._id+"_"+e[u].field.split(".").join("")+"_filterbarcell"),f.data("ejWidgets")&&n(f).data(n(f).data("ejWidgets")[0]).destroy();t.element.empty().removeClass("e-treegrid-core e-treegrid "+t.model.cssClass)},collapseAll:function(){var n=this,u=n.model,i=0,t={},f=u.enableVirtualization,e=n.getRows();for((n._isRowEdit||n.model.isEdit)&&(n._isRowEdit?n.cancelRowEditCell():n.cancelEditCell(),n.selectRows(-1),n._cancelSaveTools()),t.requestType=r.TreeGrid.Actions.ExpandCollapse,n._isInExpandCollapseAll=!0,i=0;i<n.model.parentRecords.length;i++)treegridRecord=n.model.parentRecords[i],t.data=treegridRecord,t.recordIndex=i,t.expanded=!1,treegridRecord.hasChildRecords&&(n._expandCollapseInnerLevelRecord(treegridRecord,t.expanded),r.TreeGrid.sendExpandCollapseRequest(n,t));u.flatRecords.length>0&&n._refreshTreeGridOnExpandCollapseAll(t);n._isInExpandCollapseAll=!1},_getContextMenuItems:function(){return proxy=this,contextMenuLabel=proxy._contextMenuTexts,[{headerText:contextMenuLabel.addRowText,eventHandler:null,isDefault:!0,disable:!1,menuId:"Add",parentMenuId:null},{iconClass:"e-edit",headerText:contextMenuLabel.editText,eventHandler:null,isDefault:!0,disable:!1,menuId:"Edit",parentMenuId:null},{headerText:contextMenuLabel.deleteText,eventHandler:null,isDefault:!0,disable:!1,menuId:"Delete",parentMenuId:null},{iconClass:"e-save",headerText:contextMenuLabel.saveText,eventHandler:null,isDefault:!0,isEdit:!0,disable:!1,menuId:"Save",parentMenuId:null},{iconClass:"e-cancel",headerText:contextMenuLabel.cancelText,eventHandler:null,isDefault:!0,isEdit:!0,disable:!1,menuId:"Cancel",parentMenuId:null},{iconPath:null,headerText:contextMenuLabel.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:contextMenuLabel.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_getsubContextMenuItems:function(){return proxy=this,contextMenuLabel=proxy._contextMenuTexts,[{iconPath:null,headerText:contextMenuLabel.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:contextMenuLabel.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_clearContextMenu:function(){n(".e-contextmenu").remove();n(".e-innerContextmenu").remove()},_renderContextMenu:function(t,i,f,e){var o=this,w=o.model,s={},l,a,h,b,k=o._getCoordinate(t),c,d,p;if(o._contextMenuSelectedIndex=i,o._contextMenuSelectedItem=f,o._contextMenuEvent=t,e||this.editFormValidate()){if(t||(t=window.event),subposX=l=k.pageX,subposY=a=k.pageY,c=this.getOffsetRect(o.element[0]),c.bottom=c.top+this.element[0].offsetHeight,c.right=c.left+n(this.element).width(),s.targetElement=t,s.item=f,s.index=i,s.columnIndex=o.getCellIndex(t),s.requestType="ContextMenuOpen",s.contextMenuItems=o._contextMenuItems,o._trigger("contextMenuOpen",s))return!1;o._activeMenuItemId=null;o._contextMenuItems=s.contextMenuItems;h=r.buildTag("div.e-contextmenu","",{display:"table",position:"absolute","z-index":o.getMaxZIndex()+1},{id:o._id+"_ContextMenu"});d=s.contextMenuItems.filter(function(n){if(n.parentMenuId==null||n.parentMenuId==u)return!0});b=r.buildTag("ul.e-treegrid-contextmenu",n.render[o._id+"contextMenuTemplate"](d),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"});h.append(b);n(document.body).append(h);r.browserInfo().name=="msie"&&r.browserInfo().version<9&&w.isResponsive&&o._off(n(window),"resize",o.windowResize);var g=n(h).outerHeight(),v=n(h).outerWidth(),y=h.find(".e-menuitem"),nt=y.eq(0);y.outerWidth(v+2);(c.left>l||c.right<l+v)&&(c.right<l+v&&(l=l-v),l<0&&(l=c.left+10));c.bottom<a+g&&(p=a-g,p>0&&(a=p));h.css({left:l+"px",top:a+"px"});o._focusTreeGridElement();n(h).css({height:"auto"});o._on(h,"contextmenu",function(n){n.preventDefault()});n(y).click(function(){o._contextMenuClickHandler(this)});n(y).mouseenter(function(){n(this).hasClass("e-disable")||(h.find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),o._activeMenuItemId=n(this).attr("id"),o._showSubContextMenu(this,s.contextMenuItems))});o.model.allowSelection&&o.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&o._clearMultiSelectPopup();r.browserInfo().name=="msie"&&r.browserInfo().version<9&&w.isResponsive&&o._on(n(window),"resize",o.windowResize);t.preventDefault()}},_showSubContextMenu:function(t,i){var v=this.model,u=this,e=[],s=n(t).attr("id"),f,a,h=[],o,c,l;h=i.filter(function(n){return n.menuId==s&&(e=n),n.parentMenuId==s?!0:void 0});e.parentMenuId||n(".e-innerContextmenu").remove();e.parentMenuId&&this._removeContextMenu(e,i);h.length>0&&(f=r.buildTag("div.e-innerContextmenu","",{display:"table",position:"absolute","z-index":u.getMaxZIndex()+1},{id:this._id+"_SubContextMenu"+s}),a=r.buildTag("ul",n.render[u._id+"contextMenuTemplate"](h),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),f.append(a),n(document.body).append(f),o=f.find(".e-menuitem"),c=n(f).outerWidth(),o.outerWidth(c>100?c:100),l=u._getSubContextMenuPosition(t,f),n(f).css({top:l.top,left:l.left}),n(o).mouseenter(function(){n(this).hasClass("e-disable")||(u._showSubContextMenu(this,i),n(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),u._activeMenuItemId=n(this).attr("id"))}),u._on(f,"contextmenu",function(n){n.preventDefault()}),n(o).click(function(){u._contextMenuClickHandler(this)}),r.browserInfo().name=="msie"&&r.browserInfo().version<9&&v.isResponsive&&u._on(n(window),"resize",u.windowResize))},_removeContextMenu:function(t,i){var e=n("#"+this._id+"_SubContextMenu"+t.parentMenuId),r=n(e).find(".e-contextmenu-mouseover"),u,f;n(r).length>0&&(u=i.filter(function(t){if(t.menuId==n(r).attr("id"))return!0}),u.length>0&&(f=i.filter(function(n){if(n.parentMenuId==u[0].menuId)return!0}),f.length>0&&this._removeContextMenu(f[0],i)),n("#"+this._id+"_SubContextMenu"+n(r).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var a=this,y=this.model,s,c,l,f={top:"",left:""},h=n(t).closest(".e-contextmenu"),e,v,u,o;return h.length==0&&(h=n(t).closest(".e-innerContextmenu")),r.browserInfo().name=="msie"&&r.browserInfo().version<9&&y.isResponsive&&a._off(n(window),"resize",a.windowResize),s=n(i).outerWidth(),c=n(i).height(),l=this.getOffsetRect(t),v=n(h).outerWidth(),f.top=l.top-1,f.left=l.left+n(h).width()+1,e=f.left,u=this.getOffsetRect(this.element[0]),u.bottom=u.top+this.element[0].offsetHeight,u.right=u.left+n(this.element).width(),(u.left>e||u.right<e+s)&&(u.right<e+s&&(e=e-v-s),e>0&&(f.left=e)),u.bottom<f.top+c&&(o=f.top+c-u.bottom,o=f.top-o-2,o>0&&(f.top=o)),f},_contextMenuClickHandler:function(t){var r=n(t).attr("id"),i=this;if(!n(t).hasClass("e-disable")&&n(t).find(".e-expander").length==0)switch(r){case"Delete":i.contextMenuOperations("Delete");break;case"Above":i.contextMenuOperations("Above");break;case"Below":i.contextMenuOperations("Below");break;case"Add":i.contextMenuOperations("Add");break;case"Edit":i.contextMenuOperations("Edit");break;case"Save":i.contextMenuOperations("Save");break;case"Cancel":i.contextMenuOperations("Cancel");break;default:i.contextMenuOperations(r)}},_triggerMenuEventHandler:function(t,i){var s=this,e=s._contextMenuItems,f,o,u;r.isNullOrUndefined(e)||(f=e.filter(function(n){if(n.menuId.toString()===t)return!0}),f.length>0&&(o=f[0],u=o.eventHandler,u&&(typeof u=="string"&&(u=r.util.getObject(u,window)),n.isFunction(u)&&(args=r.event("customContextMenuHandler",this.model,i),u.call(this,args)))))},_createContextMenuTemplate:function(){var t=this,u={},i,f,r;u["_"+t._id+"getHeaderName"]=n.proxy(t._getHeaderName,t);n.views.helpers(u);i="<li style='list-style-type:none;margin:0px;'>";f="<div class='e-menuitem {{if disable}}e-disable{{/if}}{{if ~_"+t._id+"getHeaderName(#data)}} e-parent-menuitem{{/if}}' id={{:menuId}} style='display:table;cursor:{{if disable}}default{{else}}pointer{{/if}};min-width:100px;'>{{if iconPath}}<div class='e-icon e-contextmenu-image' style='background-image:{{:iconPath}};background-repeat:no-repeat;'/> {{else}}<div class='e-icon {{:iconClass}} e-contextmenu-icon'/>{{/if}}<div class='e-contextmenu-label'><span>{{:headerText}}<\/span><\/div>{{if ~_"+t._id+"getHeaderName(#data)}}<div class='e-icon e-expander'/> {{/if}}";i+=f;i+="<\/div><\/li>";r={};r[t._id+"contextMenuTemplate"]=i;n.templates(r)},_getHeaderName:function(n){var t=this._contextMenuItems.filter(function(t){if(n.menuId!=null&&n.menuId==t.parentMenuId)return!0});return t.length>0?!0:!1},_getColumnId:function(n){return n.name.replace(/\s/g,"")},_updateContextmenuOption:function(t){var r,s;if(Array.prototype.clean=function(n){for(var t=0;t<this.length;t++)this[t]==n&&(this.splice(t,1),t--);return this},r=this,r._isRowEdit||r.model.isEdit)r._contextMenuItems.splice(0,3);else{r._contextMenuItems.splice(3,2);var e=r.model.editSettings,o=n.extend(!0,[],r._contextMenuItems),h=r.model.contextMenuSettings.contextMenuItems.clean("").clean(u),f=[];if(n.each(h,function(t,i){n.inArray(i.toLowerCase(),f)===-1&&f.push(i.toLowerCase())}),r._contextMenuItems=[],t==-1)(f.indexOf("add")!=-1||f.length==0)&&(r._contextMenuItems[0]=o[0]),e.allowAdding||(r._contextMenuItems[0].disable=!0),r._contextAddMenuIndex=0;else if(f.length==0)r._contextMenuItems[0]=o[0],e.allowAdding||(r._contextMenuItems[0].disable=!0),r._contextAddMenuIndex=0,r._contextMenuItems[1]=o[2],e.allowDeleting||(r._contextMenuItems[1].disable=!0),r._contextMenuItems.push.apply(r._contextMenuItems,r._subContextMenuItems);else{for(i=0;i<f.length;i++){s=f[i];switch(s.toLowerCase()){case"add":r._contextMenuItems[i]=o[0];r._contextAddMenuIndex=i;e.allowAdding||(r._contextMenuItems[i].disable=!0);break;case"delete":r._contextMenuItems[i]=o[2];e.allowDeleting||(r._contextMenuItems[i].disable=!0);break;case"edit":r._contextMenuItems[i]=o[1];e.allowEditing||(r._contextMenuItems[i].disable=!0)}}r._contextMenuItems.push.apply(r._contextMenuItems,r._subContextMenuItems)}}},_setInitialData:function(){var u=this,f=u.model,o=[],e,t={},n;for(i=0;i<f.columns.length;i++){n=f.columns[i];switch(n.editType){case"booleanedit":t[n.field]=!1;break;case"stringedit":t[n.field]=null;break;case"datepicker":t[n.field]=r.format(new Date,this.model.dateFormat,this.model.locale);break;case"datetimepicker":today=new Date;t[n.field]=r.format(new Date,"MM/dd/yyyy hh:mm tt",this.model.locale);break;case"numericedit":t[n.field]=0;break;default:t[n.field]=null}}o.push(t);(u.dataSource()==null||u.dataSource().length==0||f.flatRecords.length==0)&&(e=u._createRecord(o[0],0,null),e.index=0,u._addRecord(e,r.TreeGrid.RowPosition.Top),u._clearContextMenu(),this._removeDetailsRow())},_subContextMenuAction:function(n,t,i){var f=this,e=f.model,u;({}).requestType="save";u=jQuery.extend(!0,{},n.item);u[f.model.childMapping]=null;e.idMapping&&e.parentIdMapping&&u[e.parentIdMapping]&&delete u[e.parentIdMapping];i=="Above"?f._addRecord(u,r.TreeGrid.RowPosition.Above):i=="Below"&&f._addRecord(u,r.TreeGrid.RowPosition.Below);f._clearContextMenu()},_appendEditTemplateRow:function(t,i,u,f,e){var a=this.model,o=this,w=o.model.rowHeight,b,v,c,y,k=[],tt=o.getUpdatedRecords(),p,g,s,h,l,nt,d;for(this._editedRowIndex=u,c=r.buildTag("table.e-table","",{},{cellspacing:"0px",cellpadding:"0"}),this._frozenColumnsLength>0?f?(v=r.buildTag("form.#"+o._id+"EditFrozenForm","",{margin:"-2px 0px"},{}),c.append(o._$gridHeaderContainer.find("#e-frozenheaderdiv"+o._id).find("colgroup").clone())):(v=r.buildTag("form.#"+o._id+"EditForm","",{margin:"-2px 0px"},{}),c.append(o._$gridHeaderContainer.find("#e-movableheaderdiv"+o._id).find("colgroup").clone())):(v=r.buildTag("form.#"+o._id+"EditForm","",{margin:"-2px 0px"},{}),c.append(o.getHeaderTable().find("colgroup").clone())),!f&&a.showDetailsRow&&a.showDetailsRowInfoColumn&&a.detailsTemplate&&(y=i.find("td.e-detailsrowcell")),i.empty(),e?(i.addClass("e-addedrow"),i.next("tr").hasClass("e-detailsrow")&&i.next("tr").remove()):i.addClass("e-rowedit"),k=t.filter(function(n){return!(n.visible===!1)}),b=r.buildTag("td","",{},{colspan:y?k.length+1:k.length}),p=a.allowSelection?r.buildTag("tr.e-treegridrows e-selectionbackground e-active",{height:w},{}):r.buildTag("tr.e-treegridrows",{height:w},{}),$tbody=r.buildTag("tbody"),$cellEditTemplate=o._cellEditTemplate,g=t.length,s=0;s<g;s++)r.isNullOrUndefined(s)||t[s].visible&&(h={},l=o._getFieldValue(t[s].field,a.columns.indexOf(t[s])),htmlString=$cellEditTemplate.find("#"+l+"_CellEdit").html(),nt=o._getCustomCellValue(tt[u],t[s].field),h[l]=nt,t[s].editType=="dropdownedit"&&h[t[s].field]==!1&&(h[l]=h[l].toString()),$element=n(n.templates(htmlString).render(h)),d=r.buildTag("td.e-rowcell e-editedcell","",{height:w,"vertical-align":"middle;",overflow:"hidden"},{}),d.addClass("e-validError"),t[s].allowEditing==!1&&$element.attr("disabled",!0).addClass("e-disable"),$element.get(0).tagName=="SELECT"&&($element.val(h[t[s].field]),$element.val()==null&&$element.val($element.find("option").first().val())),$element.get(0).tagName=="INPUT"&&$element.val(h[l]),p.append(d.append($element)),$tbody.append(p));y&&p.append(y);c.append($tbody);v.append(c);b.append(v);i.append(b)},_editRow:function(t,i,u){var f=this,s=f.model,l=s.rowHeight,h=f.getUpdatedRecords(),c=!1,e,o,arguments;if(f._editedRowIndex=t,e=r.TreeGrid.getRowByIndex(f,t),e.hasClass("e-summaryrow")){f._editAddTools();return}if(r.isNullOrUndefined(i)){if(o={},o.data=h[t],o.rowElement=e,o.rowIndex=t,o.columnIndex=u,c=!1,f._trigger("beginEdit",o))return!1}else c=!0;this._frozenColumnsLength>0?(f._appendEditTemplateRow(f._frozenColumns,n(e[0]),t,!0,i),f._appendEditTemplateRow(f._unFrozenColumns,n(e[1]),t,!1,i)):f._appendEditTemplateRow(s.columns,n(e),t,!1,i);f._isRowEdit=!0;f._setoffsetWidth();f._editAddTools();arguments={};c?(arguments.data={},arguments.requestType="add"):(arguments.columnIndex=u,arguments.data=h[t],arguments.requestType="beginEdit");f._refreshEditForm(arguments);n.isFunction(n.validator)&&(f._initValidator(),f.setValidation());s.selectedItem=h[t]},_renderColumnChooser:function(){var t=this,i=r.buildTag("div.e-columnSelector","","",{id:this._id+"ccDiv"});n("#"+t._id+"ccDiv_wrapper").remove();t._renderColumnChooserList(!1);i.append(t._columnChooserList);i.insertAfter(t.element);i.data("columnMenuDialog","TreeGrid");i.ejDialog({showOnInit:!1,allowKeyboardNavigation:!1,enableResize:!1,enableRTL:!1,showHeader:!1,width:"auto",allowDraggable:!1,position:{X:1,Y:1},enableAnimation:!1,minWidth:"0px",minHeight:"0px"});n("#"+t._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content").addClass("e-treegrid-columnchooser")},_renderFilterMenu:function(n){var r=this,u=0,f=0,e=0,o=0,s=0,h=0,i=this.model.columns,c,t;if(!n)for(t=0;t<i.length;t++)(i[t].filterEditType=="numericedit"||i[t].editType=="numericedit")&&u++,(i[t].filterEditType=="stringedit"||i[t].editType=="stringedit")&&f++,(i[t].filterEditType=="datepicker"||i[t].editType=="datepicker")&&e++,(i[t].filterEditType=="datetimepicker"||i[t].editType=="datetimepicker")&&s++,(i[t].filterEditType=="booleanedit"||i[t].editType=="booleanedit")&&h++,(i[t].filterEditType=="dropdownedit"||i[t].editType=="dropdownedit")&&(o++,c=i[t]);(f>0||n=="stringedit")&&(r._renderEdittypeFilterMenu("String"),r._renderedFilterMenuDialog.push("stringedit"));(u>0||n=="numericedit")&&(r._renderEdittypeFilterMenu("Numeric"),r._renderedFilterMenuDialog.push("numericedit"));(e>0||n=="datepicker")&&(r._renderEdittypeFilterMenu("Datepicker"),r._renderedFilterMenuDialog.push("datepicker"));(s>0||n=="datetimepicker")&&(r._renderEdittypeFilterMenu("Datetimepicker"),r._renderedFilterMenuDialog.push("datetimepicker"));(o>0||n=="dropdownedit")&&(r._renderEdittypeFilterMenu("Dropdown",c),r._renderedFilterMenuDialog.push("dropdownedit"));(h>0||n=="booleanedit")&&(r._renderEdittypeFilterMenu("Boolean"),r._renderedFilterMenuDialog.push("booleanedit"))},_renderEdittypeFilterMenu:function(t,i){var f=this,o,e=r.buildTag("div.e-"+f._id+"filter"+t+"Selector e-filterMenuDiv e-treegridmenufilterwraper","",{},{id:this._id+"filter"+t+"MenuDiv"}),u=f._filterMenuTexts;o=t=="Dropdown"?"<div class='e-filter-container'><div class='e-dropdown-filter-container'><input id='"+this._id+"filter"+t+"DropDown'/><\/div><div class='e-filter-button-container'><div class='e-filter-btn-filter'><button id='"+this._id+"filter"+t+"MenuButton' class='e-filterMenuDiv'>"+u.filterButton+"<\/button><\/div><div class='e-filter-btn-clear'><button id='"+this._id+"filter"+t+"ClearButton' class='e-filterMenuDiv'>"+u.clearButton+"<\/button><\/div><\/div><\/div>":t=="Boolean"?"<div class='e-filter-container'><div class='e-checkbox-filter-container'><span class='e-checkbox-filter-text'>"+u.filterValue+"<\/span><div class='e-checkbox-filter-control' style='padding-bottom:14px;padding-left: 48%;'><input id='"+this._id+"filter"+t+"InputBox'/><\/div><div class='e-filter-button-container'><div class='e-filter-btn-filter'><button id='"+this._id+"filter"+t+"MenuButton' class='e-filterMenuDiv'>"+u.filterButton+"<\/button><\/div><div class='e-filter-btn-clear'><button id='"+this._id+"filter"+t+"ClearButton' class='e-filterMenuDiv'>"+u.clearButton+"<\/button><\/div><\/div><\/div>":"<div class='e-filter-container'><div class='e-filter-operator'><input id='"+this._id+"filter"+t+"DropDown'/><\/div><span class='e-filter-text'>"+u.filterValue+"<\/span><div class='e-filter-value'><input id='"+this._id+"filter"+t+"InputBox'/><\/div><div class='e-filter-button-container'><div class='e-filter-btn-filter'><button id='"+this._id+"filter"+t+"MenuButton' class='e-filterMenuDiv'>"+u.filterButton+"<\/button><\/div><div class='e-filter-btn-clear'><button id='"+this._id+"filter"+t+"ClearButton' class='e-filterMenuDiv'>"+u.clearButton+"<\/button><\/div><\/div><\/div>";e.append(o);e.insertAfter(f.element);f._renderFilterMenuDialog(t+"MenuDiv",t,i,u);e.data("filter"+t+"MenuDialog","TreeGrid");e.ejDialog({showOnInit:!1,allowKeyboardNavigation:!1,enableResize:!1,enableRTL:!1,showHeader:!1,width:"auto",allowDraggable:!1,position:{X:1,Y:1},enableAnimation:!1});n("#"+f._id+"filter"+t+"MenuDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css({height:"auto",width:"auto"}).removeClass("e-widget-content");n("#"+f._id+"filter"+t+"MenuDiv_wrapper").css("outline","none").addClass("e-treegrid-columnchooser")},_renderFilterMenuDialog:function(t,i,r,u){var f=this,e,s,o;i=="String"&&(e=u.stringMenuOptions,s="endswith",o={value:"value",text:"text"});(i=="Numeric"||i=="Datepicker"||i=="Datetimepicker")&&(e=u.numberMenuOptions,s="GreaterThan",o={value:"value",text:"text"});i=="Dropdown"&&(e=r.dropdownData,o=r.editParams?{value:r.editParams.fields.value,text:r.editParams.fields.text}:{value:"value",text:"text"});i=="String"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejAutocomplete({width:"100%",watermarkText:u.enterValueText,filterType:s,enableResize:!1,enableDistinct:!0,locale:f.model.locale});i=="Numeric"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejNumericTextbox({decimalPlaces:2,width:"100%",locale:f.model.locale});i=="Boolean"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejCheckBox({size:"small"});i=="Datetimepicker"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejDateTimePicker({width:"100%",locale:f.model.locale});i=="Datepicker"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejDatePicker({width:"100%",locale:f.model.locale});i!="Boolean"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"DropDown").ejDropDownList({dataSource:e,selectedIndex:1,fields:o,select:function(t){if(i=="String"){var r=n("#"+f._id+"filter"+i+"InputBox").data("ejAutocomplete");r.option("filterType",t.value)}},width:"100%"});n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"MenuButton").ejButton({size:"normal",width:"100%",click:function(t){var e=n.trim(f._columnMenuTarget.prev("div.e-headercelldiv").attr("ej-mappingname")),u=f.getColumnByField(e),i,r;t.e.target.id==f._id+"filterStringMenuButton"&&(i=n("#"+f._id+"filterStringInputBox").data("ejAutocomplete"),r=n("#"+f._id+"filterStringMenuDiv").find("#"+f._id+"filterStringDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.value(),r.model.value));t.e.target.id==f._id+"filterNumericMenuButton"&&(i=n("#"+f._id+"filterNumericInputBox").data("ejNumericTextbox"),r=n("#"+f._id+"filterNumericMenuDiv").find("#"+f._id+"filterNumericDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.model.value,r.model.value));t.e.target.id==f._id+"filterDropdownMenuButton"&&(r=n("#"+f._id+"filterDropdownMenuDiv").find("#"+f._id+"filterDropdownDropDown").data("ejDropDownList"),f._performMenuFilter(u,r.model.value,"equal"));t.e.target.id==f._id+"filterDatepickerMenuButton"&&(i=n("#"+f._id+"filterDatepickerInputBox").data("ejDatePicker"),r=n("#"+f._id+"filterDatepickerMenuDiv").find("#"+f._id+"filterDatepickerDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.model.value,r.model.value));t.e.target.id==f._id+"filterDatetimepickerMenuButton"&&(i=n("#"+f._id+"filterDatetimepickerInputBox").data("ejDateTimePicker"),r=n("#"+f._id+"filterDatetimepickerMenuDiv").find("#"+f._id+"filterDatetimepickerDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.model.value,r.model.value));t.e.target.id==f._id+"filterBooleanMenuButton"&&(i=n("#"+f._id+"filterBooleanInputBox").data("ejCheckBox"),i.model.checkState=="uncheck"?f._performMenuFilter(u,!1,"equal"):i.model.checkState=="check"&&f._performMenuFilter(u,!0,"equal"))}});n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"ClearButton").ejButton({size:"normal",width:"100%",click:function(t){var u=n.trim(f._columnMenuTarget.prev("div.e-headercelldiv").attr("ej-mappingname")),r=f.getColumnByField(u),i;t.e.target.id==f._id+"filterStringClearButton"&&(i=n("#"+f._id+"filterStringMenuDiv").find("#"+f._id+"filterStringDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterNumericClearButton"&&(i=n("#"+f._id+"filterNumericMenuDiv").find("#"+f._id+"filterNumericDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterDropdownClearButton"&&(i=n("#"+f._id+"filterDropdownMenuDiv").find("#"+f._id+"filterDropdownDropDown").data("ejDropDownList"),f._performMenuFilter(r,"","equal"));t.e.target.id==f._id+"filterDatepickerClearButton"&&(i=n("#"+f._id+"filterDatepickerMenuDiv").find("#"+f._id+"filterDatepickerDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterDatetimepickerClearButton"&&(i=n("#"+f._id+"filterDatetimepickerMenuDiv").find("#"+f._id+"filterDatetimepickerDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterBooleanClearButton"&&f._performMenuFilter(r,"","equal")}})},_renderColumnChooserList:function(t,i){for(var u,h,f=this,v=f.model.columns.length,c=f.model.columns,s=r.buildTag("div","",{"margin-left":"0px",width:"auto"}),e=0;e<v;e++)if(f.model.treeColumnIndex!=e&&c[e].showInColumnChooser==!0){if(u=c[e],u.nonColumn)continue;if(!r.isNullOrUndefined(u)){var o=r.buildTag("div","","",{"class":"e-columnMenuListDiv"}),l=r.isNullOrUndefined(u.headerText)?u.field:u.headerText,a=r.buildTag("input","",{},{id:f._id+"_columnMenu_"+u.field.split(".").join(""),value:l,type:"checkbox"}),y=r.buildTag("label",l,{width:"auto"},{"for":f._id+"_columnMenu_"+u.field.split(".").join("")});o.append(a);o.append(y);o.data("column",u.headerText);s.append(o);u.headerText==i&&o.addClass("e-columnmenuselection");a.ejCheckBox({checked:r.isNullOrUndefined(u.visible)?!0:u.visible,change:function(n){var t="";t=r.browserInfo().name=="msie"&&r.browserInfo().version<9?this.element.closest(".e-columnMenuListDiv").data().column:n.model.value;n.isChecked?f.showColumn(t):f.hideColumn(t)}})}}t?(f._columnChooserList.empty().append(s.children()),f._focusTreeGridElement()):f._columnChooserList=s;h=f._columnChooserList.find("div.e-columnMenuListDiv");n(h).mouseenter(function(){h.removeClass("e-columnmenuselection");n(this).addClass("e-columnmenuselection")})},_createColumnMenuTemplate:function(){var t=this,r="<li style='list-style-type:none;'><div class='e-columnmenuitem{{if enabled==false}} e-disable{{/if}}{{if (menuId =='Columns' || menuId =='Filter')}} e-parent-menuitem{{/if}}' style='display:table;cursor:pointer' id='"+t._id+"_{{:menuId}}Chooser'><div class='e-icon {{:icon}} e-treegridicon' style='display:inline-block;'><\/div><div class='e-menuitem-label' style='display:inline-block;width:auto'><span>{{:name}}<\/span><\/div>{{if (menuId =='Columns' || menuId =='Filter')}}<div class='e-icon e-expander e-treegridicon' style='display:inline-block;float:right;'/> {{/if}}<\/div>{{if menuId == 'RenameColumn' || menuId == 'SortDescending'}}<hr class='e-menuitem-hr'>{{/if}}<\/li>",i={};i[t._id+"columnMenuTemplate"]=r;n.templates(i)},_updateFilterMenuList:function(t){var i=this,a=i.model,v=columnFilterPosX=posY=0,f=n(t.target),y=o=0,y=f[0].offsetWidth,o=f[0].offsetHeight,p=n.trim(f.prev("div.e-headercelldiv").attr("ej-mappingname")),u,s,l,h,c,e,r=i.getColumnByField(p);i._clearFilterMenu();i._clearColumnMenu("columnmenu");i._columnMenuTarget=f;i._filterIconTarget=t;this.editFormValidate()&&(a.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());u=i.getOffsetRect(f[0]);u.top=u.top+o;posY=i.model.isFromGantt?u.top+o:u.top+o;s=a.isFromGantt?n(this.element).closest(".e-gantt"):n(this.element);containerOffset=this.getOffsetRect(s[0]);containerOffset.bottom=containerOffset.top+s[0].offsetHeight;containerOffset.right=containerOffset.left+n(s).width();r.filterEditType?(c=r.filterEditType.indexOf("edit"),e=r.filterEditType):(c=r.editType.indexOf("edit"),e=r.editType);c!=-1?(l=e.slice(0,c),h=l.charAt(0).toUpperCase()+l.slice(1),i._showFilterMenu("filtermenu","filter"+h,u,y,containerOffset.right,v,null,null,r)):(h=e.charAt(0).toUpperCase()+e.slice(1),i._showFilterMenu("filtermenu","filter"+h,u,y,containerOffset.right,v,null,null,r));i._updatePreviousFilteredValue(r)},_renderColumnMenu:function(t){var i=this,f=i.model,c=columnListPosX=columnFilterPosX=posY=0,y=n(t.target),ot=nt=0,o=[],w=0,ot=y[0].offsetWidth,nt=y[0].offsetHeight,s=i._columnMenuTexts,st=n.trim(y.prev("div.e-headercelldiv").attr("ej-mappingname")),e=i.getColumnByField(st),b,ht=e.allowSorting==u?!0:e.allowSorting,tt,it,p,l,rt,k,ut,lt,h,d,a,et,g;if(i._clearColumnMenu("columnmenu"),i._columnMenuTarget=y,f.isEdit||this._isRowEdit)if(this.editFormValidate())f.isEdit?this.saveCell():this._isRowEdit&&this.saveRow();else return!0;f.showColumnChooser&&f.showColumnOptions&&(tt=i._enableDisableInsertLabel(),o.push({name:s.insertColumnLeft,icon:"e-column-insertleft-icon",menuId:"ColumnLeft",enabled:tt}),o.push({name:s.insertColumnRight,icon:"e-column-insertright-icon",menuId:"ColumnRight",enabled:tt}),o.push({name:s.deleteColumn,icon:"e-column-delete-icon",menuId:"DeleteColumn",enabled:i._enableDisableDEL(e)}),o.push({name:s.renameColumn,icon:"e-column-rename-icon",menuId:"RenameColumn"}));f.allowFiltering&&(r.isNullOrUndefined(e.allowFiltering)||e.allowFiltering)&&f.filterSettings.filterType=="menu"&&(i._filteredColumnValueID.indexOf(e.field)!=-1?(o.push({name:s.menuFilter,icon:"e-column-filtered-icon",menuId:"Filter"}),b=o.length):(o.push({name:s.menuFilter,icon:"e-column-filter-icon",menuId:"Filter"}),b=o.length));f.allowSorting&&ht&&(o.push({name:s.sortAscendingText,icon:"e-columnmenu-ascending",menuId:"SortAscending"}),o.push({name:s.sortDescendingText,icon:"e-columnmenu-descending",menuId:"SortDescending"}));f.showColumnChooser&&(w=o.length,o.push({name:s.columnsText,icon:"e-columnchooser-icon",menuId:"Columns"}));f.isFromGantt||(e.allowFreezing||i._allowFreezingDefault&&r.isNullOrUndefined(e.allowFreezing))&&(p=!1,i._frozenColumnsLength!=f.columns.length-1||e.isFrozen||(it=!0),l=this._getFrozenColumnWidth(),rt=f.columns.indexOf(e),l=l+this.columnsWidthCollection[rt]+18,l>this._gridWidth&&(it=!0),o.push({name:s.freezeText,icon:"e-freezecolumn-icon",menuId:"FreezeColumns",enabled:it?!1:!e.isFrozen}),o.push({name:s.unfreezeText,icon:"e-unfreezecolumn-icon",menuId:"UnfreezeColumns",enabled:e.isFrozen==!0}),i._checkboxSelection?f.columns[0].nonColumn&&f.columns.indexOf(e)!=1&&f.columns.indexOf(e)>this._frozenColumnsLength&&(p=!0):f.columns.indexOf(e)!=0&&f.columns.indexOf(e)>this._frozenColumnsLength&&(p=!0),l=this._getFrozenColumnWidth(rt),l=l+18,l>this._gridWidth&&(p=!1),o.push({name:s.freezePrecedingColumnsText,icon:"e-freezecolumnbefore-icon",menuId:"FreezePrecedingColumns",enabled:p}));k=i.getOffsetRect(y[0]);ut=i.getOffsetRect(i.element[0]);posY=i.model.isFromGantt?k.top+nt:k.top+nt;i._columnChooserListIndex=w;var v=r.buildTag("div.e-columnmenu","",{display:"table",position:"absolute",top:posY,"z-index":i.getMaxZIndex()+1},{id:i._id+"_ColumnMenu"}),ft=r.buildTag("ul.e-treegrid-columnmenu","",{},{}),ct=n.render[i._id+"columnMenuTemplate"](o);ft.append(ct);v.append(ft);n(document.body).append(v);lt=v.height();h=v.outerWidth()+1;c=k.left+ot-h;c<=ut.left&&(c=ut.left);columnListPosX=c+h;columnFilterPosX=c+h;i._columnListPosX=columnListPosX;i._columnFilterPosX=columnFilterPosX;v.css({left:c});v.find(".e-columnmenuitem").outerWidth(h);d=f.isFromGantt?n(this.element).closest(".e-gantt"):n(this.element);a=this.getOffsetRect(d[0]);a.bottom=a.top+d[0].offsetHeight;a.right=a.left+n(d).width();f.isFromGantt||(i.model.isResponsive&&n(window).width()<=i._responsiveMinWidth?n("#"+i._id+"_ColumnMenu").find(".e-expander").addClass("e-treegridadaptivesubicon"):n("#"+i._id+"_ColumnMenu").find(".e-expander").removeClass("e-treegridadaptivesubicon"));n("#"+i._id+"_ColumnsChooser").on("mouseenter click",function(t){var r,s;if(t.type=="mouseenter"&&n(window).width()>i._responsiveMinWidth||!i.model.isResponsive||t.type=="click"&&n(window).width()<=i._responsiveMinWidth&&i.model.isResponsive||f.isFromGantt){if(n(window).width()>i._responsiveMinWidth||!i.model.isResponsive||f.isFromGantt){r={};r.width="auto";r.height="auto";r.minWidth="0px";r.minHeight="0px";r.showHeader=!1;r.position={X:1,Y:1};r.enableModal=!1;r.isResponsive=!1;r.enableResize=!1;n("#"+i._id+"ccDiv_wrapper").addClass("e-treegridadaptivedialog");n("#"+i._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content");n("#"+i._id+"ccDiv").ejDialog(r);n("#"+i._id+"ccDiv").css({height:"auto"});i._updateColumnMenuVisibility();var e=n("#"+i._id+"ccDiv").ejDialog("instance"),u=n("#"+i._id+"ccDiv_wrapper"),o=u.find("div.e-columnMenuListDiv");e.open();a.right<columnListPosX+u.width()&&(columnListPosX=columnListPosX-u.width()-h,columnListPosX<=h&&(columnListPosX=c+h));i._columnListPosX=columnListPosX;s={X:columnListPosX,Y:posY+n("#"+i._id+"_ColumnsChooser").position().top};e.option({position:s});u.css("z-index",i.getMaxZIndex()+1);o.removeClass("e-columnmenuselection");o.eq(0).addClass("e-columnmenuselection");i._focusTreeGridElement();i._renderedSubMenuType="ColumnDesktop"}else i._adaptiveColumnChooser();f.allowFiltering&&f.filterSettings.filterType=="menu"&&i._clearFilterMenu()}});n("#"+i._id+"_FilterChooser").on("mouseenter click",function(t){if(t.type=="mouseenter"&&n(window).width()>i._responsiveMinWidth||!i.model.isResponsive||t.type=="click"&&n(window).width()<=i._responsiveMinWidth&&i.model.isResponsive){var r,f,u;i._updateColumnMenuVisibility();e.filterEditType?(r=e.filterEditType.indexOf("edit"),filtertype=e.filterEditType):(r=e.editType.indexOf("edit"),filtertype=e.editType);r!=-1?(f=filtertype.slice(0,r),u=f.charAt(0).toUpperCase()+f.slice(1),i._showFilterMenu("columnchooser","filter"+u,columnFilterPosX,h,a.right,c,w,b,e)):(u=filtertype.charAt(0).toUpperCase()+filtertype.slice(1),i._showFilterMenu("columnchooser","filter"+u,columnFilterPosX,h,a.right,c,w,b,e));i._updatePreviousFilteredValue(e);n("#"+i._id+"ccDiv").ejDialog("close")}});n("#"+i._id+"_SortAscendingChooser,#"+i._id+"_SortDescendingChooser,#"+i._id+"_FreezeColumnsChooser,#"+i._id+"_UnfreezeColumnsChooser,#"+i._id+"_FreezePrecedingColumnsChooser,#"+i._id+"_ColumnLeftChooser,#"+i._id+"_ColumnRightChooser,#"+i._id+"_DeleteColumnChooser,#"+i._id+"_RenameColumnChooser").mouseenter(function(){n("#"+i._id+"ccDiv").ejDialog("close");f.allowFiltering&&f.filterSettings.filterType=="menu"&&i._clearFilterMenu()});n("#"+i._id+"_SortAscendingChooser").click(function(){f.allowMultiSorting&&(i._multiSortRequest=!0);f.isFromGantt?i.sortColumn(e.mappingName,r.sortOrder.Ascending):i.sortColumn(e.field,r.sortOrder.Ascending);i._multiSortRequest=!1});n("#"+i._id+"_SortDescendingChooser").click(function(){f.allowMultiSorting&&(i._multiSortRequest=!0);f.isFromGantt?i.sortColumn(e.mappingName,r.sortOrder.Descending):i.sortColumn(e.field,r.sortOrder.Descending);i._multiSortRequest=!1});n("#"+i._id+"_FreezeColumnsChooser").click(function(){n(this).hasClass("e-disable")||(i._checkboxSelection&&f.columns[0].nonColumn&&!f.columns[0].isFrozen&&(f.columns[0].isFrozen=!0),i.freezeColumn(e.field,!0))});n("#"+i._id+"_UnfreezeColumnsChooser").click(function(){n(this).hasClass("e-disable")||(i._checkboxSelection&&i._frozenColumnsLength==2&&f.columns[0].nonColumn&&f.columns[0].isFrozen&&(f.columns[0].isFrozen=!1),i.freezeColumn(e.field,!1))});n("#"+i._id+"_FreezePrecedingColumnsChooser").click(function(){n(this).hasClass("e-disable")||i.freezePrecedingColumns(e.field)});n("#"+i._id+"_ColumnLeftChooser").click(function(){if(n(this).hasClass("e-disable"))return!1;i.insertColumnChooser(e,"left")});n("#"+i._id+"_ColumnRightChooser").click(function(){if(n(this).hasClass("e-disable"))return!1;i.insertColumnChooser(e,"right")});n("#"+i._id+"_DeleteColumnChooser").click(function(){if(n(this).hasClass("e-disable"))return!1;i._targetColumnIndex=f.columns.indexOf(e);i._updateConfirmDialog.ejDialog("open");i._clearColumnMenu()});n("#"+i._id+"_RenameColumnChooser").click(function(){i._targetColumnIndex=f.columns.indexOf(e);i._renderColumnRenameDialog(e);i._columnRenameDialog.ejDialog("open");i._clearColumnMenu()});et=n("#"+i._id+"_ColumnMenu");g=et.find("div.e-columnmenuitem");g.eq(0).addClass("e-columnmenuselection");n(g).mouseenter(function(){n(this).hasClass("e-disable")||(g.removeClass("e-columnmenuselection"),n(this).addClass("e-columnmenuselection"))})},_adaptiveColumnChooser:function(){var t=this,i={},r=t.getOffsetRect(n("#"+t._id)[0]),f=t._columnMenuTexts,u;i.cssClass=t.model.cssClass;i.enableModal=!1;i.enableResize=!1;i.enableResize=!1;i.contentSelector="#"+t._id;i.rtl=t.model.rtl;i.allowDraggable=!1;i.showHeader=!0;i.minHeight="50px";i.minWidth="50px";i.width=n("#"+t._id).width()+"px";i.height=n("#"+t._id).height()+"px";i.position={X:r.left+"px",Y:r.top+"px"};i.isResponsive=!1;i.allowKeyboardNavigation=!1;i.title=f.columnsText;n("#"+t._id+"ccDiv_wrapper").removeClass("e-treegridadaptivedialog");n("#"+t._id+"ccDiv_wrapper").addClass("e-dialog").addClass("e-shadow").find("div.e-dialog-scroller").css("height","100%");n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").addClass("e-treegridadaptivedialog");n("#"+t._id+"ccDiv").ejDialog(i);n("#"+t._id+"ccDiv").ejDialog("open");n("#"+t._id+"ccDiv").css({width:"100%",height:"100%"});t.model.isResponsive&&(u=n("#"+t._id).height()-50+"px",n("#"+t._id+"ccDiv_wrapper").css({width:n("#"+t._id).width(),height:n("#"+t._id).height()}),n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"ccDiv").css({width:"100%",height:"auto"}),n("#"+t._id+"ccDiv").height()>n("#"+t._id+"ccDiv_wrapper").height()-48?(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-48+"px",width:"auto",padding:"0px"}),n("#"+t._id+"ccDiv").removeClass("e-columnSelector"),n("#"+t._id+"ccDiv").ejDialog("refresh")):(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:u,width:"auto"}),n("#"+t._id+"ccDiv").css({padding:"8px 16px"})),n("#"+t._id+"ccDiv_wrapper").removeClass("e-shadow"),n("#"+t._id+"ccDiv").removeClass("e-shadow"));t._renderedSubMenuType="AdaptiveColChooser";n("#"+t._id+"_ColumnMenu").remove()},_updatePreviousFilteredValue:function(t){var i=this,f,l,a,v,u,o=[],c,s,h,e;s=t.filterEditType?t.filterEditType:t.editType;s=="stringedit"&&(e=n("#"+i._id+"filterStringInputBox").data("ejAutocomplete"),f=n("#"+i._id+"filterStringMenuDiv").find("#"+i._id+"filterStringDropDown").data("ejDropDownList"),a=r.Query().select(t.field),l=new r.DataManager(i.model.flatRecords.slice()),v=l.executeLocal(a),e.option("dataSource",v),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","startswith"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value),n("#"+i._id+"filterStringInputBox").val(i._filteredColumnValue[u].value)):(f.option("value","startswith"),e.option("value",null)));s=="numericedit"&&(e=n("#"+i._id+"filterNumericInputBox").data("ejNumericTextbox"),f=n("#"+i._id+"filterNumericMenuDiv").find("#"+i._id+"filterNumericDropDown").data("ejDropDownList"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","lessthan"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value),n("#"+i._id+"filterNumericInputBox").val(i._filteredColumnValue[u].value)):(e.option("value",null),f.option("value","lessthan")));s=="datepicker"&&(e=n("#"+i._id+"filterDatepickerInputBox").data("ejDatePicker"),f=n("#"+i._id+"filterDatepickerMenuDiv").find("#"+i._id+"filterDatepickerDropDown").data("ejDropDownList"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","lessthan"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value)):(e.option("value",null),f.option("value","lessthan")),t.format&&e.option("dateFormat",i._getDateFormat(t.format)));s=="datetimepicker"&&(e=n("#"+i._id+"filterDatetimepickerInputBox").data("ejDateTimePicker"),f=n("#"+i._id+"filterDatetimepickerMenuDiv").find("#"+i._id+"filterDatetimepickerDropDown").data("ejDropDownList"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","lessthan"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value)):(e.option("value",null),f.option("value","lessthan")),t.format&&e.option("dateFormat",i._getDateFormat(t.format)));s=="dropdownedit"&&(n.extend(o,t.dropdownData),t.editParams?(c={value:t.editParams.fields.value,text:t.editParams.fields.text},h={},h[t.editParams.fields.text]=i._dropDownListBlanksText,h[t.editParams.fields.value]="(Blanks)"):(c={value:"value",text:"text"},h={text:i._dropDownListBlanksText,value:"(Blanks)"}),f=n("#"+i._id+"filterDropdownDropDown").data("ejDropDownList"),r.isNullOrUndefined(o)||o.length==0?(o=i._dropDownArrayCollection(t,t.field),(t.allowFilteringBlankContent||r.isNullOrUndefined(t.allowFilteringBlankContent))&&o.unshift(h),f.option("dataSource",o)):((t.allowFilteringBlankContent||r.isNullOrUndefined(t.allowFilteringBlankContent))&&o.unshift(h),f.option("dataSource",o)),f.option("fields",c),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),f.option("value",i._filteredColumnValue[u].value)):f.option("value",null));s=="booleanedit"&&(e=n("#"+i._id+"filterBooleanInputBox").data("ejCheckBox"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?e.option("checkState","uncheck"):e.option("value",i._filteredColumnValue[u].value)):e.option("selectedIndex",""))},_performMenuFilter:function(n,t,i){var u=this,f;u.clearAllSelection();f=n.filterEditType?n.filterEditType:n.editType;r.isNullOrUndefined(t)&&(t="");u._searchString=t;u._filteredColumnValueID.indexOf(n.field)==-1&&t.toString()==""?(u.clearColumnMenu(),u._clearFilterMenu()):(f=="numericedit"||f=="datepicker"||f=="datetimepicker"?(f=="datepicker"||f=="datepicker")&&(i=="equal"||i=="notequal")?u.filterColumn(n.field,i,t,"and"):u.filterColumn(n.field,i,t,"and",!0):u.filterColumn(n.field,i,t,"and"),u.model.showColumnChooser||(u._filterIconTarget.target.className=t.toString()!=""||t.toString()=="false"?"e-column-filtered-icon e-icon e-filtericon":"e-column-filter-icon e-icon e-filtericon"),u._storePreviousFilteredValue(n.field,t,i),u._searchString=t,u.clearColumnMenu(),u._clearFilterMenu())},_storePreviousFilteredValue:function(n,t,i){var r=this;r._filteredColumnValueID.indexOf(n)==-1&&(t.toString()!=""||t.toString()=="false")?(r._filteredColumnValue.push({column:n,value:t,dropdown:i}),r._filteredColumnValueID.push(n)):t.toString()!=""||t.toString()=="false"?(filteredColumnIdIndex=r._filteredColumnValueID.indexOf(n),r._filteredColumnValue[filteredColumnIdIndex].value=t,r._filteredColumnValue[filteredColumnIdIndex].dropdown=i):r._filteredColumnValueID.indexOf(n)!=-1&&(filteredColumnIdIndex=r._filteredColumnValueID.indexOf(n),r._filteredColumnValue.splice(filteredColumnIdIndex,1),r._filteredColumnValueID.splice(filteredColumnIdIndex,1))},_showFilterMenu:function(t,i,r,u,f,e,o,s,h){var k,l,c,y,a,p,v,w;if(this.editFormValidate())if(n(window).width()<=this._responsiveMinWidth&&this.model.isResponsive&&!this.model.isFromGantt){var c=this,l={},b=c.getOffsetRect(n("#"+c._id)[0]);l.cssClass=this.model.cssClass;l.enableModal=!1;l.isResponsive=!1;l.enableRTL=this.model.enableRTL;l.enableResize=!1;l.allowDraggable=!1;l.minWidth="50px";l.minHeight="50px";l.width=n("#"+c._id).width()+"px";l.height=n("#"+c._id).height()+"px";l.position={X:b.left+"px",Y:b.top+"px"};l.contentSelector="#"+c._id;l.rtl=c.model.rtl;l.allowKeyboardNavigation=!1;l.showHeader=!0;l.title=h.headerText;n("#"+c._id+i+"MenuDiv").removeClass("e-treegridadaptivedialog");n("#"+c._id+i+"MenuDiv").ejDialog(l);n("#"+c._id+i+"MenuDiv_wrapper").addClass("e-dialog").addClass("e-shadow").find("div.e-dialog-scroller").addClass("e-treegridadaptivewidth");n("#"+c._id+i+"MenuDiv").css({width:"100%",height:"auto"});k=n("#"+c._id).height()-50+"px";n("#"+c._id+i+"MenuDiv").ejDialog("open");n("#"+c._id+i+"MenuDiv_wrapper").find("div.e-dialog-scroller").css({height:k});n("#"+c._id+i+"MenuDiv_wrapper").removeClass("e-shadow");n("#"+c._id+i+"MenuDiv").removeClass("e-shadow");n("#"+c._id+i+"MenuDiv").height()>n("#"+c._id+i+"MenuDiv_wrapper").height()-48&&n("#"+c._id+i+"MenuDiv").ejDialog("refresh");c._renderedSubMenuType="#"+c._id+i+"MenuDiv";n("#"+c._id+"_ColumnMenu").remove()}else c=this,l={},l.width="auto",l.height="auto",l.minWidth="0px",l.minHeight="0px",l.showHeader=!1,l.position={X:1,Y:1},l.enableModal=!1,l.isResponsive=!1,l.enableResize=!1,n("#"+c._id+i+"MenuDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content"),n("#"+c._id+i+"MenuDiv").ejDialog(l),c=this,y=n("#"+c._id+i+"MenuDiv").ejDialog("instance"),a=n("#"+c._id+i+"MenuDiv_wrapper"),t=="columnchooser"?(windowWidth=n(document).width(),(f<r+a.width()||windowWidth<r+a.width())&&r-u-a.width()>0&&(r=r-u-a.width()),p={X:r,Y:posY+n("#"+c._id+"_FilterChooser").position().top},y.option({position:p}),y.open()):(t="filtermenu")&&(v=r,w=u,e=v.left+w-a.width(),v.left=e+a.width()+4,f<v.left+a.width()&&(v.left=v.left-a.width()-w),p={X:v.left,Y:v.top},y.option({position:p}),y.open()),c._renderedSubMenuType="#"+c._id+i+"MenuDivDesktop"},_clearResponsiveColumnMenu:function(){var t=this;n("div[id$='ccDiv']").each(function(){n(this).data("columnMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({padding:"0px"});n("#"+t._id+"ccDiv").addClass("e-columnSelector");n("div[id$='filterStringMenuDiv']").each(function(){n(this).data("filterStringMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterNumericMenuDiv']").each(function(){n(this).data("filterNumericMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterBooleanMenuDiv']").each(function(){n(this).data("filterBooleanMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterDatepickerMenuDiv']").each(function(){n(this).data("filterDatepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterDatetimepickerMenuDiv']").each(function(){n(this).data("filterDatetimepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterDropdownMenuDiv']").each(function(){n(this).data("filterDropdownMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='ColumnRenameDialog']").each(function(){n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='dialogColumnAdd']").each(function(){n(this).data("ejDialog")&&n(this).ejDialog("close")});n("#"+t._id).find(".e-filtericon").data("isClicked",!1)},_clearColumnMenu:function(t){var i=this;t==="columnmenu"&&n(window).width()<i._responsiveMinWidth&&i._clearResponsiveColumnMenu();i.model.isResponsive&&n(window).width()<i._responsiveMinWidth?(n("#"+i._id+"_ColumnMenu").remove(),i._renderedSubMenuType&&i._renderedSubMenuType.indexOf("AdaptiveColChooser")==-1&&(n("div[id$='"+i._id+"ccDiv']").each(function(){n(this).data("columnMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("#"+i._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({padding:"0px"}),n("#"+i._id+"ccDiv").addClass("e-columnSelector"))):(n("#"+i._id+"_ColumnMenu").remove(),t!="resize"&&(n("div[id$='"+i._id+"ccDiv']").each(function(){n(this).data("columnMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("#"+i._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({padding:"0px"}),n("#"+i._id+"ccDiv").addClass("e-columnSelector"),t!="resize"&&i.model.allowFiltering&&i.model.filterSettings.filterType=="menu"&&i._clearFilterMenu()));n("#"+i._id).find(".e-columnicon").data("isClicked",!1);n("#"+i._id).find(".e-filtericon").data("isClicked",!1)},_clearFilterMenu:function(){var t=this,i,r;t.model.allowFiltering&&t.model.filterSettings.filterType=="menu"&&(n("div[id$='"+t._id+"filterStringMenuDiv']").each(function(){n(this).data("filterStringMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterNumericMenuDiv']").each(function(){n(this).data("filterNumericMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterBooleanMenuDiv']").each(function(){n(this).data("filterBooleanMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterDatepickerMenuDiv']").each(function(){n(this).data("filterDatepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterDatetimepickerMenuDiv']").each(function(){n(this).data("filterDatetimepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterDropdownMenuDiv']").each(function(){n(this).data("filterDropdownMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("#"+t._id+"filterStringDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterStringInputBox_suggestion").hide(),n("#"+t._id+"filterNumericDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterNumericInputBox_suggestion").hide(),n("#"+t._id+"filterDatepickerDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterDatepickerInputBox_suggestion").hide(),n("#"+t._id+"filterDatetimepickerDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterDatetimepickerInputBox_suggestion").hide(),n("#"+t._id+"filterDropdownDropDown_popup_list_wrapper").hide(),n("#"+t._id).find(".e-filtericon").data("isClicked",!1),i=n("#"+t._id+"filterDatetimepickerInputBox").data("ejDateTimePicker"),i&&i.hide(),r=n("#"+t._id+"filterDatepickerInputBox").data("ejDatePicker"),r&&r.hide())},_getDateFormat:function(n){var t=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),i=t.exec(n);return i[2]},_enableDisableDEL:function(n){var u=this,t=u.model,i=n.field,r=t.columns.indexOf(n);return t.isFromGantt?i!="taskId"&&i!="taskName"&&i!="startDate"&&i!="endDate"&&(i!="duration"||t.endDateMapping)&&r!=t.treeColumnIndex?!0:!1:r==t.treeColumnIndex?!1:!0},_enableDisableInsertLabel:function(){var t=this,i=t.model,n;return!i.isFromGantt&&t._frozenColumnsLength>0?(n=this._getFrozenColumnWidth(),n=n+250,n>this._gridWidth?!1:!0):!0},insertColumnChooser:function(t,i){var u=this,e=u.model,f;n("#"+u._id+"_dialogColumnAdd").length===0&&(f=r.buildTag("div.e-dialog e-dialog-content e-widget-content","",{display:"none"},{id:u._id+"_dialogColumnAdd"}),u.element.append(f),u._on(n("#"+u._id+"_dialogColumnAdd"),"click keypress","#ColumnAddDialog_"+u._id+"_Ok ,#ColumnAddDialog_"+u._id+"_Cancel",u._buttonClick));u.renderColumnAddDialog();u._targetColumnIndex=e.columns.indexOf(t);u._insertPosition=i},renameColumn:function(n,t){var r=this,f=r.model,u=f.columns,i={};i.requestType="renameColumn";i.columnObject=u[n];i.previousName=u[n].headerText;i.currentName=t;r._trigger("actionComplete",i)||(u[n].headerText=t,r._refreshFrozenColumns())},_renderColumnRenameDialog:function(t){var i=this,o=i._columnMenuTexts,f=r.buildTag("div.e-treegridrenamedialog","",{},{unselectable:"on"}),s=n("#"+i._id).width(),h=n("#"+i._id).height(),e=r.buildTag("form","",{height:"100%",width:"100%","font-size":"14px"},{id:i._id+"ColumnRenameForm",onsubmit:"return false"}),u;$buttons=r.buildTag("span.e-buttons","<input class='e-treegrid-rename-dialog-btn-ok' type='button' id="+i._id+"RenameDialogOK value="+i._okButtonText+" /> <input class='e-treegrid-rename-dialog-btn-cancel' type='button' id="+i._id+"RenameDialogCancel value='"+i._cancelButtonText+"' />");btnDiv=r.buildTag("div","",{},{"class":"e-treegrid-rename-dialog-btn"});$innerTable=r.buildTag("table","",{outline:"none",width:"100%"},{unselectable:"on"});$inTr1=r.buildTag("tr");$inTd=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"});$inTd.append("<label style='font-weight:normal;'>"+i._columnDialogTitle.renameColumn+"<\/label>");$inTr1.append($inTd);$innerTable.append($inTr1);$inTr2=r.buildTag("tr");$inTd2=r.buildTag("td.e-editValue");$input=r.buildTag("input.e-field e-ejinputtext","",{},{value:t.headerText,id:i._id+"RenameHeaderText",name:t.field,dialog:"RenameHeaderText"});$inTd2.html($input);$inTr2.append($inTd2);$innerTable.append($inTr2);e.append($innerTable);f.append(e);i._columnRenameDialog=r.buildTag("div","","",{title:o.renameColumn,id:i._id+"ColumnRenameDialog"});btnDiv.append($buttons);i._columnRenameDialog.append(f).append(btnDiv);i.element.append(i._columnRenameDialog);$buttons.find("input").ejButton({cssClass:i.model.cssClass,showRoundedCorner:!0,size:"normal",click:n.proxy(i._triggerRenameColumn,i)});n(window).width()<=i._responsiveMinWidth&&i.model.isResponsive&&!i.model.isFromGantt?i.model.isResponsive&&(u=i.getOffsetRect(n("#"+i._id)[0]),n("#"+i._id+"ColumnRenameDialog").removeClass("e-treegridadaptivedialog"),i._columnRenameDialog.ejDialog({width:s+"px",height:h+"px",position:{X:u.left+"px",Y:u.top+"px"},minHeight:"50px",minWidth:"50px",showOnInit:!1,allowDraggable:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n("#"+i._id+"ColumnRenameDialog_wrapper").removeClass("e-shadow").addClass("e-treegrid-dialog"),n("#"+i._id+"ColumnRenameDialog").removeClass("e-shadow")):(i._columnRenameDialog.ejDialog({width:"auto",height:"auto",minHeight:0,minWidth:240,showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+i._id+"ColumnRenameDialog_wrapper").addClass("e-treegrid-dialog"));$input.focus().select()},_triggerRenameColumn:function(n){var t=this,i,f;n!==u&&n.model.text==t._okButtonText&&(i=t._columnRenameDialog.find("#"+t._id+"RenameHeaderText"),f=i.val(),t.renameColumn(t._targetColumnIndex,f),this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&(r.isNullOrUndefined(t.model.editSettings.dialogEditorTemplateID)||t.model.editSettings.dialogEditorTemplateID=="")?t._treeGridAddEditDialog():this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&!r.isNullOrUndefined(t.model.editSettings.dialogEditorTemplateID)&&t.model.editSettings.dialogEditorTemplateID!=""&&t._treeGridAddEditDialogTemplate());t._columnRenameDialog.ejDialog("close")},renderColumnAddDialog:function(){var t=this,h=t.model,e=h.columnDialogFields,r={},o=t.getOffsetRect(n("#"+t._id)[0]),u,s,f,i;if(r.requestType="openColumnAddDialog",e.length)for(r.data={},u=0;u<e.length;u++)s=e[u],r.data[s]="";else r.data={field:"",headerText:"",editType:""};t._trigger("actionBegin",r)||(r.requestType="columnAdd",f=document.createElement("div"),n(f).addClass("e-addedColumn"),f.innerHTML=n.render[t._id+"_ColumnAddTemplate"](r.data),n("#"+t._id+"_dialogColumnAdd").html(n(f)),i={},i.cssClass=this.model.cssClass,i.enableResize=!1,i.width="auto",i.height="auto",i.contentSelector="#"+t._id,i.rtl=t.model.rtl,i.allowKeyboardNavigation=!1,title=t._columnDialogTitle.insertColumn,i.title=title,(n(window).width()>t._responsiveMinWidth||!t.model.isResponsive||t.model.isFromGantt)&&(i.enableModal=!0,i.allowDraggable=!0,i.isResponsive=!0,n("#"+t._id+"_dialogColumnAdd").ejDialog(i),n("#"+t._id+"_dialogColumnAdd").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").addClass("e-treegridadaptivedialog e-treegrid-dialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd").ejDialog("open"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css("width","438px")),n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive&&!t.model.isFromGantt&&(i.isResponsive=!1,i.enableResize=!1,i.enableModal=!1,i.allowDraggable=!1,i.width=n("#"+t._id).width()+"px",i.height=n("#"+t._id).height()+"px",i.minHeight="150px",i.minWidth="150px",n("#"+t._id+"_dialogColumnAdd").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css({width:n("#"+t._id).width()-80+"px",height:"150px"}),n("#"+t._id+"_dialogColumnAdd").ejDialog(i),n("#"+t._id+"_dialogColumnAdd").ejDialog("open"),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-treegridadaptivedialog").addClass("e-treegrid-dialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").css({left:o.left+"px",top:o.top+"px"}),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-shadow"),n("#"+t._id+"_dialogColumnAdd").removeClass("e-shadow"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-50+"px"})),t._clearColumnMenu(),t._refreshColumnAddForm(),n("#"+t._id+"_dialogColumnAdd").ejDialog("refresh"))},setAddColumnFields:function(){var t=this,r=t.model,u,i;if(r.columnDialogFields.length){for(t._addColumnFields=r.columnDialogFields,u=["field","headerText","editType"],i=0;i<u.length;i++)if(n.inArray(u[i],t._addColumnFields)==-1)switch(u[i]){case"field":t._addColumnFields.splice(0,0,u[i]);break;case"headerText":t._addColumnFields.splice(1,0,u[i]);break;case"editType":t._addColumnFields.splice(2,0,u[i])}for(r.isFromGantt?(r.allowSorting||t._addColumnFields.indexOf("allowSorting")==-1||t._addColumnFields.splice(t._addColumnFields.indexOf("allowSorting"),1),r.selectionSettings.selectionMode=="row"&&t._addColumnFields.indexOf("allowCellSelection")!=-1&&t._addColumnFields.splice(t._addColumnFields.indexOf("allowCellSelection"),1)):(r.allowSorting||t._addColumnFields.indexOf("allowSorting")==-1||t._addColumnFields.splice(t._addColumnFields.indexOf("allowSorting"),1),r.allowFiltering||t._addColumnFields.indexOf("allowFiltering")==-1||t._addColumnFields.splice(t._addColumnFields.indexOf("allowFiltering"),1),r.selectionSettings.selectionMode=="row"&&t._addColumnFields.indexOf("allowCellSelection")!=-1&&t._addColumnFields.splice(t._addColumnFields.indexOf("allowCellSelection"),1)),t._addColumnFields.indexOf("displayAsCheckbox")!=-1&&t._addColumnFields.push(t._addColumnFields.splice(t._addColumnFields.indexOf("displayAsCheckbox"),1)[0]),t._addColumnFieldsTxt=[],i=0;i<t._addColumnFields.length;i++)switch(t._addColumnFields[i]){case"field":t._addColumnFieldsTxt.push(t._columnDialogTexts.field);break;case"headerText":t._addColumnFieldsTxt.push(t._columnDialogTexts.headerText);break;case"editType":t._addColumnFieldsTxt.push(t._columnDialogTexts.editType);break;case"filterEditType":t._addColumnFieldsTxt.push(t._columnDialogTexts.filterEditType);break;case"allowFiltering":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowFiltering);break;case"allowFilteringBlankContent":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowFilteringBlankContent);break;case"allowSorting":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowSorting);break;case"visible":t._addColumnFieldsTxt.push(t._columnDialogTexts.visible);break;case"width":t._addColumnFieldsTxt.push(t._columnDialogTexts.width);break;case"textAlign":t._addColumnFieldsTxt.push(t._columnDialogTexts.textAlign);break;case"headerTextAlign":t._addColumnFieldsTxt.push(t._columnDialogTexts.headerTextAlign);break;case"isFrozen":t._addColumnFieldsTxt.push(t._columnDialogTexts.isFrozen);break;case"allowFreezing":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowFreezing);break;case"allowCellSelection":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowCellSelection);break;case"showInColumnChooser":t._addColumnFieldsTxt.push(t._columnDialogTexts.showInColumnChooser);break;case"clipMode":t._addColumnFieldsTxt.push(t._columnDialogTexts.clipMode);break;case"tooltip":t._addColumnFieldsTxt.push(t._columnDialogTexts.tooltip);break;case"headerTooltip":t._addColumnFieldsTxt.push(t._columnDialogTexts.headerTooltip);break;case"displayAsCheckbox":t._addColumnFieldsTxt.push(t._columnDialogTexts.displayAsCheckbox)}}else t._addColumnFields=["field","headerText","editType"],t._addColumnFieldsTxt=[t._columnDialogTexts.field,t._columnDialogTexts.headerText,t._columnDialogTexts.editType]},setColumnCelEditType:function(n){var i=this,u=i.model,f=u.columns,t;return n=="field"||n=="filterEditType"||n=="editType"||n=="textAlign"||n=="headerTextAlign"||n=="clipMode"?t=r.buildTag("input.e-field e-dropdownlist","",{},{value:"{{:#data['"+n+"']}}",id:i._id+n+"ColumnAdd",name:n,dialog:"ColumnAdd"}):n=="headerText"||n=="tooltip"||n=="headerTooltip"?t=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+n+"']}}",id:i._id+n+"ColumnAdd",name:n,dialog:"ColumnAdd"}):n=="allowFiltering"||n=="allowSorting"||n=="isFrozen"||n=="allowFreezing"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog ="ColumnAdd" name="'+n+'" edittype="booleanedit">':n=="allowFilteringBlankContent"||n=="visible"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog = "ColumnAdd" checked = "checked" name="'+n+'" edittype="booleanedit">':n=="allowCellSelection"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog = "ColumnAdd" checked = "checked" name="'+n+'" edittype="booleanedit">':n=="showInColumnChooser"||n=="displayAsCheckbox"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog = "ColumnAdd" checked = "checked" name="'+n+'" edittype="booleanedit">':n=="width"&&(t=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+n+"']}}",id:i._id+n+"ColumnAdd",name:n,dialog:"ColumnAdd"}),t.attr("edittype","numericedit")),t},columnAddDialogTemplate:function(){var t=this,f=t.model,s=f.columns,h=s.length,e,u,i,o;if(h!=0){for(t.setAddColumnFields(),u=r.buildTag("div","",{},{unselectable:"on"}),$form=r.buildTag("form","",{height:"100%",width:"100%","font-size":"14px"},{id:t._id+"ColumnAddForm"}),$table=r.buildTag("table","",{width:"100%"},{unselectable:"on"}),$tr=r.buildTag("tr","",{width:"100%"}),i=0;i<t._addColumnFields.length;i++)$tr.children("td").length<2?($td=r.buildTag("td.e-add-property-container","",{},{unselectable:"on"}),$innerTable=r.buildTag("table","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr=r.buildTag("tr"),$inTd=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append("<label style='font-weight:normal;'>"+t._addColumnFieldsTxt[i]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue"),e=t.setColumnCelEditType(t._addColumnFields[i]),$inTd2.html(e),$inTr2.append($inTd2),$innerTable.append($inTr2),t._addColumnFields[i]=="displayAsCheckbox"&&$innerTable.addClass("e-display-checkbox-conatiner").css("display","none"),$td.append($innerTable),$tr.append($td)):($table.append($tr),$tr=$tempTr=r.buildTag("tr"),i--);$table.append($tr);$tr2=r.buildTag("tr");f.showColumnChooser&&($td=r.buildTag("td.e-add-property-container","",{},{colspan:2,unselectable:"on"}),$innerTable=r.buildTag("table#"+t._id+"dropdownDataTable","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr3=r.buildTag("tr"),$inTd3=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd3.append("<label for='dropdownData' style='font-weight:normal;'>"+t._columnDialogTexts.columnsDropdownData+"<\/label>"),$inTr3.append($inTd3),$innerTable.append($inTr3),$inTr=r.buildTag("tr"),$inTd=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append("<span class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;'>"+t._columnDialogTexts.addData+"<\/span>      <span class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;'>  "+t._columnDialogTexts.deleteData+"<\/span>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue"),n("#"+t._id).width()<=t._responsiveMinWidth?(o=n("#"+t._id).width()-80+"px",$inTd3=r.buildTag("div.dropdowntreegrid","",{width:o,overflow:"hidden"})):$inTd3=r.buildTag("div.dropdowntreegrid","",{width:"438px",overflow:"hidden"}),$preDiv=r.buildTag("div#treegrid"+t._id+"dropdownData","",{width:"100%",height:"150px"},{}),$inTd3.append($preDiv),$inTd2.append($inTd3),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr2.append($td),$table.append($tr2));$form.append($table);u=t.renderColumnAddDialogButton($form,u);n.templates(t._id+"_ColumnAddTemplate",u.html())}},renderColumnAddDialogButton:function(n,t){var f="ColumnAddDialog_",i=this,e=i.model,o=r.buildTag("div.e-add-dialog-btn-ok","",{},{}),s=r.buildTag("div","",{},{}),h=r.buildTag("input","",{"border-radius":"3px"},{type:"button",id:f+i._id+"_Ok"}),v=i._okButtonText,u;h.ejButton({cssClass:e.cssClass,text:v,width:"100%"});var c=r.buildTag("div.e-add-dialog-btn-cancel","",{},{}),l=r.buildTag("div","",{},{}),y=i._cancelButtonText,a=r.buildTag("input","",{"border-radius":"3px"},{type:"button",id:f+i._id+"_Cancel"});return a.ejButton({cssClass:e.cssClass,text:y,width:"100%"}),u=r.buildTag("div","",{},{"class":"e-treegrid-add-btn"}),s.append(h),o.append(s),u.append(o),l.append(a),c.append(l),u.append(c),n.appendTo(t),u.appendTo(t),t},_buttonClick:function(t){var v,d,l,e,y,k;if(t.keyCode!=0&&t.keyCode!==u&&t.keyCode!=13)return!0;var f=this,o=f.model,p=o.treeColumnIndex,w=!1,h,i={},b=f._addColumnFields,nt=o.columns,c,s={},k,a;if(t.target.id=="ColumnAddDialog_"+f._id+"_Ok"){for(v=document.getElementById(f._id+"ColumnAddForm"),l=0;l<b.length;l++)if(e=b[l],h=n(v).find("#"+f._id+e+"ColumnAdd"),e=="editType"||e=="filterEditType"||e=="textAlign"||e=="headerTextAlign"||e=="clipMode"){if(d=h.data("ejDropDownList"),i[e]=d._selectedValue,e=="editType"&&i[e]=="dropdownedit"){var tt=n(v).find("#treegrid"+f._id+"dropdownData"),it=tt.data("ejTreeGrid"),g=it.model.dataSource;g.length>0&&(i.dropdownData=g)}}else e=="showInColumnChooser"||e=="allowCellSelection"||e=="allowSorting"||e=="allowFiltering"||e=="allowFilteringBlankContent"||e=="visible"||e=="isFrozen"||e=="allowFreezing"||e=="displayAsCheckbox"?(ch=h.data("ejCheckBox"),i[e]=ch._isChecked):h.val()==""&&(e=="headerText"||e=="field")?e=="field"?i[e]="Column"+(o.columns.length+1):e=="headerText"&&(i[e]="Column "+(o.columns.length+1)):i[e]=h.val();f._insertPosition=="left"?c=f._targetColumnIndex:f._insertPosition=="right"&&(c=f._targetColumnIndex+1);c<=p&&(o.treeColumnIndex=p+1);o.isFromGantt||c<=f._frozenColumnsLength-1&&(w=!0);y={};y=o.isFromGantt?{field:i.field,headerText:i.headerText,editType:i.editType,allowSorting:r.isNullOrUndefined(i.allowSorting)?null:i.allowSorting,visible:i.visible==!1?!1:!0,width:i.width?i.width:150,textAlign:i.textAlign?i.textAlign:"left",headerTextAlign:i.headerTextAlign?i.headerTextAlign:"left",dropdownData:i.dropdownData?i.dropdownData:null,allowCellSelection:r.isNullOrUndefined(i.allowCellSelection)?null:i.allowCellSelection,mappingName:i.field,displayAsCheckbox:i.displayAsCheckbox==!1?!1:!0,clipMode:i.clipMode?i.clipMode:"clip",tooltip:i.tooltip,headerTooltip:i.headerTooltip}:{field:i.field,headerText:i.headerText,editType:i.editType,filterEditType:i.filterEditType?i.filterEditType:"stringedit",allowFiltering:r.isNullOrUndefined(i.allowFiltering)?null:i.allowFiltering,allowFilteringBlankContent:r.isNullOrUndefined(i.allowFilteringBlankContent)?null:i.allowFilteringBlankContent,allowSorting:r.isNullOrUndefined(i.allowSorting)?null:i.allowSorting,visible:i.visible==!1?!1:!0,width:i.width?i.width:150,textAlign:i.textAlign?i.textAlign:"left",headerTextAlign:i.headerTextAlign?i.headerTextAlign:"left",clipMode:i.clipMode?i.clipMode:"clip",tooltip:i.tooltip,headerTooltip:i.headerTooltip,isFrozen:i.isFrozen==!0||w==!0?!0:!1,allowFreezing:r.isNullOrUndefined(i.allowFreezing)?null:i.allowFreezing,dropdownData:i.dropdownData?i.dropdownData:null,allowCellSelection:r.isNullOrUndefined(i.allowCellSelection)?null:i.allowCellSelection,showInColumnChooser:i.showInColumnChooser==!1?!1:!0,displayAsCheckbox:i.displayAsCheckbox==!1?!1:!0};s.requestType="insertColumn";s.columnObject=y;s.insertIndex=c;f._trigger("actionComplete",s)||(nt.splice(s.insertIndex,0,s.columnObject),f._refreshFrozenColumns(),o.isFromGantt&&f._updateAddEditDialogTemplate());n("#"+f._id+"_dialogColumnAdd").ejDialog("close");o.allowFiltering&&o.filterSettings.filterType=="menu"&&(a=s.columnObject.filterEditType?s.columnObject.filterEditType:s.columnObject.editType,k=f._renderedFilterMenuDialog.indexOf(a),k==-1&&f._renderFilterMenu(a));this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&(r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)||o.editSettings.dialogEditorTemplateID=="")?f._treeGridAddEditDialog():this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&!r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)&&o.editSettings.dialogEditorTemplateID!=""&&f._treeGridAddEditDialogTemplate()}else t.target.id=="ColumnAddDialog_"+f._id+"_Cancel"&&n("#"+f._id+"_dialogColumnAdd").ejDialog("close");if(this.model.editSettings.editMode=="dialogEditing")if(t.target.id=="EditFormDialog_"+this._id+"_Save"){if(!f.editFormValidate())return!0;this.element.find(".e-dialogaddrow .treegridform").length>0?(f.model.allowSelection&&f.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&f._clearMultiSelectPopup(),f._treegridDialogAddRow()||(f._isTreeAddEditDialogSave=!0,n("#"+this._id+"_dialogEdit").ejDialog("close"),this._off(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",f._buttonClick))):this.element.find(".e-dialogeditedrow .treegridform").length>0&&(f.endEdit()||(f._isTreeAddEditDialogSave=!0,n("#"+this._id+"_dialogEdit").ejDialog("close"),this._off(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",f._buttonClick)))}else t.target.id=="EditFormDialog_"+this._id+"_Cancel"&&(n("#"+this._id+"_dialogEdit").ejDialog("close"),this._off(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",f._buttonClick));return!1},_treegridDialogAddRow:function(){var n=this,u=n.model.columns,t={},f;for(i=0;i<u.length;i++)if(column=u[i],!r.isNullOrUndefined(column)&&column.field!=""&&column.visible){if(value=n.getCurrentEditCellDataForRowEdit(column.field,column.editType,i),n._checkboxSelection&&column.field=="checkboxState")continue;f=(column.field||"").split(".");f.length<=1?t[column.field]=value:t=n._restoreCustomData(t,value,column.field)}if(n._addRecord(t,n.model.editSettings.rowPosition,null,"dialog"))return!0},_refreshColumnAddForm:function(){var t=this,g=n("#"+t._id+"ColumnAddForm"),nt=g.find("input,select"),v=0,tt=!1,et=nt.length,u,o,f=t.model,e={},w,i,c,s,b=[],ot=t.model.rowHeight,h=t._editTypeText,d=t._textAlignTypeText,it=t._clipModeText,y,a,l,rt,ut,p,ft;for(v;v<et;v++){if(u=nt.eq(v),o="100%",i=u.prop("name"),u.hasClass("e-dropdownlist"))if(i=="field"){for(l=[],y=[],f.columns.length&&(b=n.map(f.columns,function(n){return f.isFromGantt?n.mappingName?n.mappingName:n.field:n.field})),t._dataSourcefields.length||(t._dataSourcefields=n.extend(!0,[],b),t.getAllDataSourceFields()),k=0;k<t._dataSourcefields.length;k++)n.inArray(t._dataSourcefields[k],b)==-1&&t._dataSourcefields[k]!=f.notesMapping&&y.push(t._dataSourcefields[k]);for(a=0;a<y.length;a++)l.push({id:a+1,text:y[a]});u.ejDropDownList({width:o,dataSource:l,fields:{id:"id",text:"text",value:"text"}})}else i=="editType"||i=="filterEditType"?(l=[{id:"1",text:h.string,value:"stringedit"},{id:"2",text:h.numeric,value:"numericedit"},{id:"3",text:h.datePicker,value:"datepicker"},{id:"4",text:h.dateTimePicker,value:"datetimepicker"},{id:"5",text:h.dropdown,value:"dropdownedit"},{id:"6",text:h.boolean,value:"booleanedit"}],u.ejDropDownList({width:o,dataSource:l,fields:{id:"id",text:"text",value:"value"},selectedIndex:0,change:function(i){var u=!1,r;s.hidden==!0&&i.value=="dropdownedit"?(s.hidden=!1,u=!0):s.hidden==!1&&i.value!="dropdownedit"&&(s.hidden=!0,u=!0);r=n("#"+t._id+"_dialogColumnAdd").find(".e-display-checkbox-conatiner");i.value=="booleanedit"&&r.length>0&&r.css("display")=="none"?(r.css("display","block"),u=!0):i.value!="booleanedit"&&r.length>0&&r.css("display")=="block"&&(r.css("display","none"),u=!0);u&&n("#"+t._id+"_dialogColumnAdd").ejDialog("refresh")}})):i=="textAlign"||i=="headerTextAlign"?(rt=[{id:"1",text:d.left,value:"left"},{id:"2",text:d.right,value:"right"},{id:"3",text:d.center,value:"center"}],u.ejDropDownList({width:o,dataSource:rt,fields:{id:"id",text:"text",value:"value"},selectedIndex:0})):i=="clipMode"&&(ut=[{id:"1",text:it.clip,value:"clip"},{id:"2",text:it.ellipsis,value:"ellipsis"}],u.ejDropDownList({width:o,dataSource:ut,fields:{id:"id",text:"text",value:"value"},selectedIndex:0}));else u.hasClass("e-numerictextbox")&&i=="width"?(w=u.val(),e.width=o,e.showSpinButton=!0,e.cssClass=f.cssClass,e.maxValue=250,e.minValue=30,e.value=w.length?parseFloat(w):150,u.ejNumericTextbox(e)):(i=="showInColumnChooser"||i=="allowCellSelection"||i=="allowFiltering"||i=="allowFilteringBlankContent"||i=="allowSorting"||i=="visible"||i=="isFrozen"||i=="allowFreezing"||i=="displayAsCheckbox")&&(p={},p.cssClass=f.cssClass,p.size="small",u.ejCheckBox(p));u.is(":disabled")||tt||u.is(":hidden")&&typeof u.data("ejDropDownList")!="object"||t._isEnterKeyPressed||(t._focusElements(u.closest("td")),tt=!0)}c="#treegrid"+t._id+"dropdownData";n(c).length&&(ft=[],n(c).ejTreeGrid({dataSource:ft,allowSorting:!1,allowAdding:!0,columns:[{headerText:t._columnDialogTexts.dropdownTableText,field:"text",editType:r.TreeGrid.EditingType.String,width:"150px"},{headerText:t._columnDialogTexts.dropdownTableValue,field:"value",editType:r.TreeGrid.EditingType.String,width:"150px"}],enableAltRow:!0,allowColumnResize:!0,enableResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing"},locale:f.locale,treeColumnIndex:5,emptyRecordText:"Add values for dropdown",rowSelected:function(i){i.data&&(n(".e-deletepre").addClass("e-enable").removeClass("e-disable"),n(".e-deletepre").bind("click",n.proxy(t._deleteDropDownRow,t,n(c))))}}),s=g.find("#"+t._id+"dropdownDataTable").parent()[0],s.hidden=!0,n(".e-addpre").bind("click",n.proxy(t._addDropDownRow,t,n(c))))},_addDropDownRow:function(n){var f=this,t=n.data("ejTreeGrid"),r=t.model.dataSource,i=r.length,u={text:"Text "+(i+1),value:"Value"+(i+1)};t.addRow(u,"bottom")},_deleteDropDownRow:function(t){var r=this,i=t.data("ejTreeGrid"),u=i.model.updatedRecords,f=u.length,e=i.model.selectedItem;f!=0&&e&&(i.deleteRow(),n(".e-deletepre").addClass("e-disable").removeClass("e-enable"),n(".e-deletepre").unbind("click",n.proxy(r._deleteDropDownRow,r,t)))},getAllDataSourceFields:function(){for(var u,t,i=this,r=i.model,e=r.dataSource,f=0;f<e.length;f++){u=e[f];for(t in u)t==r.childMapping?i.getChildKeys(u[t]):n.inArray(t,i._dataSourcefields)==-1&&(r.isFromGantt?t!="undefined"&&t!=r.notesMapping&&i._dataSourcefields.push(t):typeof u[t]!="object"&&i._dataSourcefields.push(t))}},getChildKeys:function(t){var r=this,e=r.model,u,f,i;if(t)for(u=0;u<t.length;u++){f=t[u];for(i in f)i==e.childMapping?r.getChildKeys(f[i]):n.inArray(i,r._dataSourcefields)==-1&&typeof f[i]!="object"&&r._dataSourcefields.push(i)}},_renderUpdateConfirmDialog:function(){var t=this,f=t._confirmDeleteText,e=r.buildTag("div.e-content",t._deleteColumnText),i=r.buildTag("span.e-buttons","<input class='e-confirm-dialog-btn-ok' type='button' id="+t._id+"ConfirmDialogOK value="+t._okButtonText+" /> <input class='e-confirm-dialog-btn-cancel' type='button' id="+t._id+"ConfirmDialogCancel value='"+t._cancelButtonText+"' />"),u=r.buildTag("div","",{},{"class":"e-confirm-dialog-btn"});u.append(i);t._updateConfirmDialog=r.buildTag("div","","",{title:f,id:t._id+"ConfirmDialog"});t._updateConfirmDialog.append(e).append(u);t.element.append(t._updateConfirmDialog);i.find("input").ejButton({cssClass:t.model.cssClass,showRoundedCorner:!0,size:"normal",click:n.proxy(t._triggerUpdateConfirm,t)});t._updateConfirmDialog.ejDialog({width:"auto",minHeight:0,minWidth:0,showOnInit:!1,isResponsive:!0,enableResize:!1,enableModal:!0});n("#"+t._id+"ConfirmDialog_wrapper").addClass("e-treegrid-dialog")},_triggerUpdateConfirm:function(n){var t=this;n!==u&&n.model.text==t._okButtonText&&t._updateConfirmDialog.find(".e-content").text()==t._deleteColumnText&&t.deleteColumn(t._targetColumnIndex);t._updateConfirmDialog.ejDialog("close")},deleteColumn:function(t){var r=this,i=r.model,o=i.columns,s,u=i.sortSettings&&i.sortSettings.sortedColumns.length?i.sortSettings.sortedColumns:null,h=o[t],f={},e;f.requestType="deleteColumn";f.columnObject=h;f.deleteIndex=t;r._trigger("actionComplete",f)||(s=o.splice(t,1),u&&(e=n.grep(u,function(n){return n.field==s[0].field}),e.length&&u.splice(u.indexOf(e[0]),1)),r._targetColumnIndex<=i.treeColumnIndex&&(i.treeColumnIndex=i.treeColumnIndex-1),r._refreshFrozenColumns(),i.isFromGantt&&r._updateAddEditDialogTemplate())},getOffsetRect:function(n){var r=n.getBoundingClientRect(),t=document.body,i=document.documentElement,u=window.pageYOffset||i.scrollTop||t.scrollTop,f=window.pageXOffset||i.scrollLeft||t.scrollLeft,e=i.clientTop||t.clientTop||0,o=i.clientLeft||t.clientLeft||0,s=r.top+u-e,h=r.left+f-o;return{top:Math.round(s),left:Math.round(h)}},_moveToNextMenuItem:function(t){var i,u,o,s=this.model,r={},h,e,f;s.isFromGantt?(i=n("#"+this._id.replace("ejTreeGrid","")).data("ejGantt"),o=n("#"+this._id.replace("ejTreeGrid","")+"_ContextMenu")):(i=this,o=n("#"+this._id+"_ContextMenu"));u=n("#"+i._activeMenuItemId);switch(t){case"next":u.length==0?r=o.find("div.e-menuitem:not(.e-disable)").first():(r=u.closest("li").next("li").find("div.e-menuitem"),r.length>0&&r.hasClass("e-disable")&&(r=this._findContextMenuItem(r,"next")));e=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId);e.remove();break;case"prev":r=this._findContextMenuItem(u,"prev");e=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId);e.remove();break;case"expand":u.length>0&&(i._showSubContextMenu(u[0],i._contextMenuItems),f=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),f.length>0&&(r=f.find("div.e-menuitem:not(.e-disable)").first()));break;case"collapse":f=n(u).closest(".e-innerContextmenu");f.length>0&&(h=f.attr("id").replace(i._id+"_SubContextMenu",""),r=n("#"+h),e=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),e.remove(),f.remove());break;case"save":u.length>0&&(n("#"+i._activeMenuItemId).find(".e-expander").length==0?(s.isFromGantt?i._contextMenuClickHandler(n("#"+i._activeMenuItemId)):i.contextMenuOperations(i._activeMenuItemId),i._clearContextMenu()):(i._showSubContextMenu(u[0],i._contextMenuItems),f=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),f.length>0&&(r=f.find("div.e-menuitem:not(.e-disable)").first())))}r.length>0&&((t=="next"||t=="prev")&&u.removeClass("e-contextmenu-mouseover"),r.addClass("e-contextmenu-mouseover"),i._activeMenuItemId=n(r).attr("id"))},_findNextColumnMenuItem:function(n,t){var i=this;return t==="next"?(nextItem=n.closest("li").next("li").find("div.e-columnmenuitem"),nextItem.length>0?nextItem.hasClass("e-disable")?i._findNextColumnMenuItem(nextItem,"next"):nextItem:nextItem):(prevItem=n.closest("li").prev("li").find("div.e-columnmenuitem"),prevItem.length>0?prevItem.hasClass("e-disable")?i._findNextColumnMenuItem(prevItem,"prev"):prevItem:prevItem)},_getFieldValue:function(n,t){return n!=""?n.split(".").join(""):"TGcolumn"+t},_findContextMenuItem:function(n,t){var i=this;return t==="next"?(nextItem=n.closest("li").next("li").find("div.e-menuitem"),nextItem.length>0?nextItem.hasClass("e-disable")?i._findContextMenuItem(nextItem,"next"):nextItem:nextItem):(prevItem=n.closest("li").prev("li").find("div.e-menuitem"),prevItem.length>0?prevItem.hasClass("e-disable")?i._findContextMenuItem(prevItem,"prev"):prevItem:prevItem)}});r.TreeGrid.Actions={Sorting:"sorting",BeginEdit:"beginedit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Refresh:"refresh",Searching:"searching",ExpandCollapse:"expandcollapse",Selection:"selection",rowHover:"rowHover",Scroll:"scroll",ContextMenuAdd:"contextMenuAdd",RefreshDataSource:"refreshDataSource",DragAndDrop:"dragAndDrop",Paging:"paging"};r.TreeGrid.SelectionType={Single:"single",Multiple:"multiple",Checkbox:"checkbox"};r.TreeGrid.FilterType={FilterBar:"filterbar",Menu:"menu"};r.TreeGrid.EditMode={CellEditing:"cellEditing",RowEditing:"rowEditing",DialogEditing:"dialogEditing"};r.TreeGrid.ClipMode={Clip:"clip",Ellipsis:"ellipsis"};r.TreeGrid.PageSizeMode={All:"all",Root:"root"};r.TreeGrid.RowPosition={Top:"top",Bottom:"bottom",Above:"aboveSelectedRow",Below:"belowSelectedRow",Child:"child"};r.TreeGrid.BeginEditAction={DblClick:"dblClick",Click:"click"};r.TreeGrid.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedit"};r.TreeGrid.ContextMenuItems={Add:"add",Edit:"edit",Delete:"delete"};r.TreeGrid.ColumnResizeMode={Normal:"normal",FixedColumns:"fixedcolumns",NextColumn:"nextcolumn"};r.TreeGrid=r.TreeGrid||{};r.TreeGrid._initCellEditType=function(t,i,u,f,e){var s=t,p=s.model,o=p.columns,h=o[f],e=e?e:"",g=(o[f].field||"").split("."),c,v,l,b,y,k,a,d,w;o[f].editTemplate?o[f].editType="edittemplate":r.isNullOrUndefined(o[f].editType)&&(h.editType="stringedit");c=s.model.editSettings.editMode=="dialogEditing"?o[f].field:s._getFieldValue(o[f].field,f);switch(h.editType){case"stringedit":p.isFromGantt?(v={},h.field==="predecessor"&&(v["_"+u+"predecessorCell"]=n.proxy(r.Gantt._getPredecessorsValue,s)),n.views.helpers(v),h.field==="predecessor"?l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+u+"predecessorCell(#data)}}",id:u+h.field+e,name:h.field,dialog:e}):h.field==="duration"?(v={},v["_"+u+"getDurationStringValue"]=n.proxy(r.Gantt._getDurationStringValue,s),n.views.helpers(v),l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+u+"getDurationStringValue(#data)}}",id:u+h.field+e,name:h.field,dialog:e})):l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+p.columns[f].field+e,name:p.columns[f].field,dialog:e})):l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(h.field,f)+e,name:h.field,dialog:e});l.attr("edittype",o[f].editType);i.html(l);break;case"maskedit":l=r.buildTag("input.e-field e-maskedit","",{},{value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(h.field,f)+e,name:h.field,dialog:e});l.attr("edittype",o[f].editType);i.html(l);break;case"booleanedit":i.html("{{if true===~_"+s._id+'cellValue(#data,"'+c+'")}}<input type ="checkbox" id="'+u+s._getFieldValue(o[f].field,f)+e+'" dialog ="'+e+'" name="'+o[f].field+'" checked="checked" edittype="'+o[f].editType+'"><\/input> {{else}}<input type ="checkbox" id="'+u+s._getFieldValue(o[f].field,f)+e+'" dialog ="'+e+'" name="'+o[f].field+'" edittype="'+o[f].editType+'">{{/if}}');break;case"numericedit":b=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});b.attr("edittype",o[f].editType);i.append(b);break;case"datepicker":y=r.buildTag("input.e-datepicker e-field","",{},{type:"text",value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});y.attr("edittype",o[f].editType);i.append(y);break;case"datetimepicker":y=r.buildTag("input.e-datetimepicker e-field","",{},{type:"text",value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});y.attr("edittype",o[f].editType);i.append(y);break;case"dropdownedit":k=r.buildTag("input.e-field e-dropdownlist","",{},{type:"text",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});k.attr("edittype",o[f].editType).attr("cellValue","{{:~_"+s._id+"cellValue(#data,'"+c+"')}}");i.append(k);break;case"edittemplate":a=o[f].editTemplate.create;typeof a=="string"?(d=r.util.getObject(a,window),w=n.isFunction(d)?n(d()).attr({id:u+s._getFieldValue(h.field,f),name:h.field}):n(a).length==1&&n(a).get(0).tagName=="SCRIPT"?n(n(a).html()).attr({id:u+s._getFieldValue(h.field,f),name:h.field}):n(a).attr({id:u+s._getFieldValue(h.field,f),name:h.field})):w=n(a()).attr({id:u+s._getFieldValue(h.field,f),name:h.field});w.attr("edittype",o[f].editType);i.append(w)}};r.TreeGrid.ToolbarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",ExpandAll:"expandAll",CollapseAll:"collapseAll",PdfExport:"pdfExport",ExcelExport:"excelExport"};r.TreeGrid.SummaryType={Sum:"sum",Average:"average",Maximum:"maximum",Minimum:"minimum",Count:"count",MinimumDate:"minimumDate",MaximumDate:"maximumDate",TrueCount:"trueCount",FalseCount:"falseCount"};r.TreeGrid.SelectionMode={Row:"row",Cell:"cell"};r.TreeGrid.Locale=r.TreeGrid.Locale||{};r.TreeGrid.Locale["default"]=r.TreeGrid.Locale["en-US"]={toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",updateTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",expandAllTool:"Expand All",collapseAllTool:"Collapse All",pdfExportTool:"PDF Export",excelExportTool:"Excel Export"},contextMenuTexts:{addRowText:"Add Row",editText:"Edit",deleteText:"Delete",saveText:"Save",cancelText:"Cancel",aboveText:"Above",belowText:"Below"},filterMenuTexts:{stringMenuOptions:[{text:"Starts With",value:"startswith"},{text:"Ends With",value:"endswith"},{text:"Contains",value:"contains"},{text:"Equals",value:"equal"},{text:"Does Not Equal",value:"notequal"}],numberMenuOptions:[{text:"Less Than",value:"lessthan"},{text:"Greater Than",value:"greaterthan"},{text:"Less Than Or Equal To",value:"lessthanorequal"},{text:"Greater Than Or Equal To",value:"greaterthanorequal"},{text:"Equals",value:"equal"},{text:"Does Not Equal",value:"notequal"}],filterValue:"Filter Value",filterButton:"Filter",clearButton:"Clear",enterValueText:"enter value"},columnMenuTexts:{sortAscendingText:"Sort Ascending",sortDescendingText:"Sort Descending",columnsText:"Columns",freezeText:"Freeze",unfreezeText:"Unfreeze",freezePrecedingColumnsText:"Freeze Preceding Columns",insertColumnLeft:"Insert Column Left",insertColumnRight:"Insert Column Right",deleteColumn:"Delete Column",renameColumn:"Rename Column",menuFilter:"Filter"},columnDialogTexts:{field:"Field",headerText:"Header Text",editType:"Edit Type",filterEditType:"Filter Edit Type",allowFiltering:"Allow Filtering",allowFilteringBlankContent:"Allow Filtering Blank Content",allowSorting:"Allow Sorting",visible:"Visible",width:"Width",textAlign:"Text Alignment",headerTextAlign:"Header Text Alignment",isFrozen:"Is Frozen",allowFreezing:"Allow Freezing",columnsDropdownData:"Column Dropdown Data",dropdownTableText:"Text",dropdownTableValue:"Value",addData:"Add",deleteData:"Remove",allowCellSelection:"Allow Cell Selection",showInColumnChooser:"Show In Column Chooser",clipMode:"Clip Mode",tooltip:"Tooltip",headerTooltip:"Header Tooltip",displayAsCheckbox:"Display As Checkbox"},columnDialogTitle:{insertColumn:"Insert Column",deleteColumn:"Delete Column",renameColumn:"Rename Column"},editTypeTexts:{string:"String",numeric:"Numeric",datePicker:"Date Picker",dateTimePicker:"Date Time Picker",dropdown:"Dropdown",boolean:"Boolean"},textAlignTypes:{right:"Right",left:"Left",center:"Center"},clipModeTexts:{clip:"Clip",ellipsis:"Ellipsis"},deleteColumnText:"Are you sure you want to delete this column?",okButtonText:"OK",cancelButtonText:"Cancel",confirmDeleteText:"Confirm Delete",dropDownListBlanksText:"(Blanks)",dropDownListClearText:"(Clear Filter)",trueText:"True",falseText:"False",emptyRecord:"No records to display"};r.TreeGrid._getrowClassName=function(){var n="gridrowIndex",t=this;return t.data.parentItem&&(n+=t.data.parentItem.index.toString()),n+="level",n+=t.data.level.toString(),t.data.isSummaryRow&&(n+=" ",n+="e-summaryrow"),t.data.footerSummaryRowRecord&&(n+=" ",n+="e-footersummaryrow"),n};r.TreeGrid._getSummaryRowtdClassName=function(){proxy=this;var n="";return proxy.data.isSummaryRow&&(n+=" ",n+="e-summaryrowcell"),proxy.data.footerSummaryRowRecord&&(n+=" ",n+="e-footersummaryrowcell"),n};r.TreeGrid.getColumnByField=function(n,t){var i=0;for(i;i<n.length;i++)if(n[i].field.split(".").join("")==t.split(".").join(""))break;return i==n.length?null:n[i]};r.TreeGrid.getColumnByMappingName=function(n,t){var i=0;for(i;i<n.length;i++)if(n[i].mappingName==t)break;return i==n.length?null:n[i]};r.TreeGrid.sendExpandCollapseRequest=function(t,i){var u=t,f=u.model,k=f.toolbarSettings.toolbarItems,a,l,s,h,y;if(i.requestType=r.TreeGrid.Actions.ExpandCollapse,u._isRowEdit?u.cancelRowEditCell():u.model.isEdit&&u.cancelEditCell(),f.enableVirtualization)u._isFromGantt?u._$treegridHelper.ejTreeGrid("processBindings",i):u.processBindings(i),u._isFromGantt?u._isInExpandCollapseAll===!1&&(f.enableAltRow&&u._$treegridHelper.ejTreeGrid("updateAltRow"),u._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i),u._$treegridHelper.ejTreeGrid("updateHeight"),u.model.updatedGanttRecords=u.getUpdatedRecords(),u.model.currentViewData=u.getCurrentViewData(),u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._$ganttchartHelper.ejGanttChart("refreshHelper",u.model.currentViewData,u.model.updatedGanttRecords)):u._isInExpandCollapseAll===!1&&(f.enableAltRow&&u.updateAltRow(),u.sendDataRenderingRequest(i),u._setScrollTop(),u.updateHeight());else{var e=i.data,c,o,v=0,d=e.expanded!==i.expanded;c=u.model.currentViewData.indexOf(e);u._frozenColumnsLength&&u.getRows()?o=n(u.getRows()[0][c]).add(u.getRows()[1][c]):u.getRows()&&(o=u.getRows()&&n(u.getRows()[c]));i.expanded?(e.expanded=i.expanded,o&&r.TreeGrid.expandRecord(u,e,i.expanded,i),e.hasFilteredChildRecords&&(o&&o.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),o&&o.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")),f.enableAltRow&&u._isInExpandCollapseAll===!1&&!f.allowPaging&&r.TreeGrid.updateAltRow(u,e,c,1)):(u._collapsedRecordCount=0,o&&r.TreeGrid.collapseRecord(u,e,i.expanded),e.expanded=i.expanded,e.hasFilteredChildRecords&&(o&&o.find(".e-treegridexpand").removeClass("e-treegridexpand").addClass("e-treegridcollapse"),o&&o.removeClass("e-treegridrowexpand").addClass("e-treegridrowcollapse")),f.enableAltRow&&u._isInExpandCollapseAll===!1&&u._collapsedRecordCount!=0&&!f.allowPaging&&r.TreeGrid.updateAltRow(u,e,c,u._collapsedRecordCount));l=0;u._isFromGantt?(u._$treegridHelper.ejTreeGrid("updateExpandStatus",e,i.expanded),u._$treegridHelper.ejTreeGrid("updateCollapsedRecordCount"),l=u._$treegridHelper.ejTreeGrid("getCollapsedRecordCount")):(u.updateExpandStatus(e,i.expanded),u.updateCollapsedRecordCount(),l=u.getCollapsedRecordCount());v=(u.model.updatedRecords.length-l)*f.rowHeight;f.allowPaging&&(i.type=="ejTreeGridcollapsing"||i.type=="ejTreeGridexpanding")&&(r.isNullOrUndefined(u.getPager())||u.gotoPage(),f.enableAltRow&&u._isInExpandCollapseAll===!1&&r.TreeGrid.updateAltRow(u,e,c,1));u._isFromGantt?u._isInExpandCollapseAll===!1&&(u._totalCollapseRecordCount=l,u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._$treegridHelper.ejTreeGrid("updateHeight"),u._$ganttchartHelper.ejGanttChart("updateHeight",v),u._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",l),u._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",u.model.updatedRecords.length-l)):u._isInExpandCollapseAll===!1&&u.updateHeight()}if(u._isFromGantt&&u.model.predecessorMapping&&u._isInExpandCollapseAll===!1&&(u._isValidationEnabled=!1,u._connectorlineIds=[],u._connectorLinesCollection=[],u._createConnectorLinesCollection(),t.isCriticalPathEnable==!0&&u._$ganttchartHelper.ejGanttChart("criticalConnectorLine",t.criticalPathCollection,t.detailPredecessorCollection,!0,t.collectionTaskId)),u._isFromGantt){var p=u._$treegridHelper.ejTreeGrid("instance"),w=u._$ganttchart.ejGanttChart("instance"),b=p._$gridContent.ejScroller("option","scrollTop");w._$bodyContainer.ejScroller("option","scrollTop",b)}s={};s.recordIndex=i.recordIndex;s.data=i.data;s.requestType=i.requestType;s.expanded=i.expanded;r.isNullOrUndefined(s.data.item[f.expandStateMapping])||(s.data[f.expandStateMapping]=i.expanded,s.data.item[f.expandStateMapping]=i.expanded);i.expanded?u._trigger("expanded",s):u._trigger("collapsed",s);h=u.selectedItem();!u._isFromGantt&&h&&(f.selectedItems.length==1||u._checkboxSelection)&&(y=u.getExpandStatus(h),y||i.expanded||(u.selectRows(-1),u.selectedRowIndex(-1),h.isSelected=!1,f.selectedItem=null,h=null),a=f.allowPaging?u._updatedPageData:u.model.updatedRecords,f.enableVirtualization&&h&&a.indexOf(h)!==u.selectedRowIndex()&&u.selectRows(a.indexOf(h)),u._cancelSaveTools())};r.TreeGrid.expandRecord=function(t,i,u){var f=t,a=".gridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),p=".detailsrowgridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),v=n(f.element).find(a),o=0,h=v.length,c,s,w=f.model,b=n(f.element).find(p),l=n(f.element).find(a),e,k=f.getRows(),y=n(k[e]);for(e=w.currentViewData.indexOf(i),i.hasChildRecords&&i.childRecords.length>0&&(y.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),y.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")),f._expandedRecordsCount+=f._isFromGantt||f._frozenColumnsLength>0?l.length/2:l.length,l.css({display:"table-row"}),b.filter("tr.e-detailsrowexpanded").css("display","table-row"),(f._isFromGantt||f._frozenColumnsLength>0)&&(h=h/2),o;o<h;o++)c=v[o],e=-1,e=f._frozenColumnsLength>0?n(f.getRows()[0]).index(c):f.getRows().index(c),e!==-1&&(s=f._isFromGantt?f.model.updatedRecords[e]:f.model.updatedRecords[e],s.isExpanded=!0,s.expanded&&r.TreeGrid.expandRecord(f,s,u))};r.TreeGrid.collapseRecord=function(t,i,u){var f=t,w=f.model,a=".gridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),y=".detailsrowgridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),v=n(f.element).find(a),e=0,s=v.length,h,o,c,p=n(f.element).find(y),l=n(f.element).find(a),b=f.getRows();for(f._collapsedRecordCount+=f._isFromGantt||f._frozenColumnsLength>0?l.length/2:l.length,l.css({display:"none"}),p.css({display:"none"}),(f._isFromGantt||f._frozenColumnsLength>0)&&(s=s/2),e;e<s;e++)h=v[e],o=-1,o=f._frozenColumnsLength>0?n(f.getRows()[0]).index(h):f.getRows().index(h),o!==-1&&(c=f.getUpdatedRecords()[o],c.expanded&&r.TreeGrid.collapseRecord(f,c,u))};r.TreeGrid.updateAltRow=function(t,i,r,u){var e=t,f=0,s=e.model,v=s.currentViewData,y=v.length,h=i.isAltRow,c,l,a=e.getRows(),o;if(l=e._frozenColumnsLength?e.getRows()[0]:e.getRows(),!s.rowTemplateID&&!s.altRowTemplateID)for(f=r+u;f<y;f++)n(l[f]).hasClass("e-summaryrow")||n(l[f]).css("display")!=="none"&&(c=v[f],f!=0&&(c.isAltRow=!h),h=c.isAltRow,o={},o=e._frozenColumnsLength?n(a[0][f]).add(a[1][f]):n(a[f]),h?n(o).addClass("e-alt-row"):n(o).removeClass("e-alt-row"))};r.TreeGrid.refreshRow=function(t,i){var u=t,e=u.model,f=u.model.currentViewData[i],o,h,s,c;f&&(u._frozenColumnsLength>0?(h=n(u.getRows()[0][i]),o=n(u.getRows()[1][i]),e.showDetailsRow&&e.detailsTemplate&&f.isDetailsExpanded&&(s=h.next("tr"),s.hasClass("e-detailsrow")&&(s.remove(),o.next("tr").remove())),h.replaceWith(n(n.render[u._id+"_JSONFrozenTemplate"](f))),o.replaceWith(n(n.render[u._id+"_Template"](f)))):(o=n(u.getRows()[i]),e.showDetailsRow&&e.detailsTemplate&&f.isDetailsExpanded&&(s=o.next("tr"),s.hasClass("e-detailsrow")&&s.remove()),e.allowSelection||(f.isSelected=!1),o.replaceWith(n(n.render[u._id+"_Template"](f)))),u.setGridRows(n(u.getContentTable().get(0).rows)),u._gridRows=u.getContentTable().get(0).rows,u._frozenColumnsLength>0&&(u._gridRows=[u._gridRows,u.getContentTable().get(1).rows]),c=r.TreeGrid.getRowByIndex(u,u.getUpdatedRecords().indexOf(e.currentViewData[i])),u._trigger("refresh"),u._rowEventTrigger(c,f))};r.TreeGrid.getRowByIndex=function(t,i,u){var f,e,h,o,s;try{return f=t.pluginName=="ejTreeGrid"?t:t._$treegridHelper.data("ejTreeGrid"),e=f.getRows(),h=f.model,updatedRecords=f.getUpdatedRecords(),$row=n(),f.model.enableVirtualization&&(o=updatedRecords[i],i=f.model.currentViewData.indexOf(o)),r.isNullOrUndefined(u)?f._frozenColumnsLength>0?(e[0][i]&&($row.push(e[0][i]),$row.push(e[1][i])),$row):n(e[i]):(f.model.enableVirtualization&&(s=updatedRecords[u],u=f.model.currentViewData.indexOf(s)),f._frozenColumnsLength>0)?($row.push(n(e[0]).slice(i,u)),$row.push(n(e[1]).slice(i,u)),$row):n(e.slice(i,u))}catch(c){return n()}}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejRibbon","ej.Ribbon",{element:null,validTags:["div"],model:null,_rootCSS:"e-ribbon",_requiresID:!0,defaults:{width:null,buttonDefaults:{width:null,height:null,enableRTL:!1,showRoundedCorner:!1,enabled:!0,cssClass:null},expandPinSettings:{toolTip:null,customToolTip:{title:null,content:null,prefixIcon:null}},collapsePinSettings:{toolTip:null,customToolTip:{title:null,content:null,prefixIcon:null}},applicationTab:{type:"menu",backstageSettings:{text:null,height:null,width:null,headerWidth:null,pages:[{id:null,text:null,itemType:"tab",contentID:null,enableSeparator:!1}]},menuItemID:null,menuSettings:{}},tabs:[{id:null,text:null,groups:[{id:null,text:null,type:null,contentID:null,customContent:null,alignType:"rows",enableGroupExpander:!1,groupExpanderSettings:{toolTip:null,customToolTip:{title:null,content:null,prefixIcon:null}},content:[{groups:[{id:null,text:null,toolTip:null,quickAccessMode:"none",isMobileOnly:"false",customToolTip:{title:null,content:null,prefixIcon:null},columns:null,itemHeight:null,itemWidth:null,expandedColumns:null,type:"button",galleryItems:[{text:null,toolTip:null,customToolTip:{},buttonSettings:{}}],customGalleryItems:[{text:null,toolTip:null,customToolTip:{},customItemType:"button",buttonSettings:{},menuId:"",menuSettings:{}}],contentID:null,enableSeparator:!1,isBig:!1,cssClass:null,buttonSettings:{},splitButtonSettings:{},toggleButtonSettings:{},dropdownSettings:{}}],defaults:{}}]}]}],contextualTabs:[{backgroundColor:null,borderColor:null,tabs:[]}],tabSelect:null,tabClick:null,tabAdd:null,tabRemove:null,load:null,beforeTabRemove:null,tabCreate:null,create:null,groupClick:null,beforeTabClick:null,galleryItemClick:null,backstageItemClick:null,collapse:null,expand:null,pinState:null,toggleButtonClick:null,groupExpand:null,qatMenuItemClick:null,selectedItemIndex:1,enabledItemIndex:[],disabledItemIndex:[0],allowResizing:!1,isResponsive:!1,showQAT:!1,showBelowQAT:!1,enableOnDemand:!1,collapsible:!1,locale:"en-US",enableRTL:!1,destory:null,_destroyed:null},dataTypes:{tabs:"array",contextualTabs:"array",disabledItemIndex:"data",enabledItemIndex:"data",selectedItemIndex:"number",applicationTab:{backstageSettings:{pages:"array"}}},_destroy:function(){var i,r,u,f,e,o,s,t;for(f=this._applicationTab.find(".e-menu"),f.length>0&&f.data("ejMenu").destroy(),this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").hide(),i=this.element.find(".e-gallerymenu"),e=i.length,t=0;t<e;t++)i.eq(t).data("ejMenu").destroy(),i.eq(t).remove();for(this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").appendTo(this.element.parent()),r=n(".e-rbn-ddl.e-ddl").find(".e-dropdownlist"),o=r.length,t=0;t<o;t++)r.eq(t).data("ejDropDownList").destroy(),r.siblings("ul").appendTo(this.element.parent());for(u=n(".e-rbn-splitbtn.e-splitbutton"),s=u.length,t=0;t<s;t++)u.eq(t).data("ejSplitButton").destroy(),u.siblings("ul").appendTo(this.element.parent());this.element.children().remove();this.element.hasClass("e-ribwithout-apptab")&&this.element.removeClass("e-ribwithout-apptab");this.model.enableOnDemand&&this.element.ejWaitingPopup("destroy");this._trigger("_destroyed")},_tags:[{tag:"applicationTab.backstageSettings.pages",attr:["id","text","itemType","contentID","enableSeparator"]},{tag:"tabs",attr:["id","text",[{tag:"groups",attr:["id","text","alignType","type","contentID","enableGroupExpander",[{tag:"content",attr:["defaults.type","defaults.width","defaults.height","defaults.isBig",[{tag:"groups",attr:["id","columns","itemHeight","itemWidth","expandedColumns","contentID","text","type","toolTip","isMobileOnly","quickAccessMode","width","enableSeparator","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","splitButtonSettings.contentType","splitButtonSettings.prefixIcon","splitButtonSettings.targetID","splitButtonSettings.buttonMode","splitButtonSettings.arrowPosition","splitButtonSettings.type","splitButtonSettings.click","splitButtonSettings.enabled","splitButtonSettings.showRoundedCorner","splitButtonSettings.enableRTL","splitButtonSettings.size","splitButtonSettings.height","splitButtonSettings.imagePosition","splitButtonSettings.width","splitButtonSettings.text","splitButtonSettings.suffixIcon","splitButtonSettings.create","splitButtonSettings.itemMouseOver","splitButtonSettings.itemSelected","splitButtonSettings.beforeOpen","splitButtonSettings.destroy","splitButtonSettings.cssClass","dropdownSettings.dataSource","dropdownSettings.text","dropdownSettings.value","dropdownSettings.select","dropdownSettings.width","dropdownSettings.showRoundedCorner","dropdownSettings.showPopupOnLoad","dropdownSettings.allowMultiSelection","dropdownSettings.enableRTL","dropdownSettings.enabled","dropdownSettings.caseSensitiveSearch","dropdownSettings.showCheckbox","dropdownSettings.checkAll","dropdownSettings.uncheckAll","dropdownSettings.enablePersistence","dropdownSettings.enableIncrementalSearch","dropdownSettings.readOnly","dropdownSettings.allowGrouping","dropdownSettings.fields","dropdownSettings.selectedItems","dropdownSettings.itemsCount","dropdownSettings.height","dropdownSettings.cssClass","dropdownSettings.itemValue","dropdownSettings.popupHeight","dropdownSettings.targetID","dropdownSettings.waterMarkText","dropdownSettings.template","dropdownSettings.cascadeTo","dropdownSettings.query","dropdownSettings.create","dropdownSettings.popupHide","dropdownSettings.popupShown","dropdownSettings.beforePopupShown","dropdownSettings.change","dropdownSettings.checkChange","dropdownSettings.enableAnimation","dropdownSettings.destroy","toggleButtonSettings.contentType","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.type","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.click","toggleButtonSettings.enabled","toggleButtonSettings.showRoundedCorner","toggleButtonSettings.enableRTL","toggleButtonSettings.enablePersistence","toggleButtonSettings.toggleState","toggleButtonSettings.preventToggle","toggleButtonSettings.size","toggleButtonSettings.imagePosition","toggleButtonSettings.height","toggleButtonSettings.width","toggleButtonSettings.cssClass","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.defaultSuffixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.create","toggleButtonSettings.change","toggleButtonSettings.destroy","customToolTip.title","customToolTip.content","customToolTip.prefixIcon",[{tag:"galleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy"]},{tag:"customGalleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","menuId","customItemType","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","menuSettings.openOnClick","menuSettings.enableCenterAlign","menuSettings.showRooltLevelArrows","menuSettings.showSubLevelArrows","menuSettings.enableSeparator","menuSettings.enabled","menuSettings.orientation","menuSettings.menuType","menuSettings.animationType","menuSettings.subMenuDirection","menuSettings.fields","menuSettings.cssClass","menuSettings.contextMenuTarget","menuSettings.excludeTarget","menuSettings.height","menuSettings.width","menuSettings.titleText","menuSettings.create","menuSettings.beforeOpen","menuSettings.open","menuSettings.close","menuSettings.mouseover","menuSettings.mouseout","menuSettings.keydown","menuSettings.destroy"]}]]}]]}]]}]]},{tag:"contextualTabs",attr:["backgroundColor","borderColor",[{tag:"tabs",attr:["id","text",[{tag:"groups",attr:["id","text","alignType","type","contentID",[{tag:"content",attr:["defaults.type","defaults.width","defaults.height","defaults.isBig",[{tag:"groups",attr:["id","columns","itemHeight","itemWidth","expandedColumns","contentID","text","type","toolTip","width","enableSeparator","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","splitButtonSettings.contentType","splitButtonSettings.prefixIcon","splitButtonSettings.targetID","splitButtonSettings.buttonMode","splitButtonSettings.arrowPosition","splitButtonSettings.type","splitButtonSettings.click","splitButtonSettings.enabled","splitButtonSettings.showRoundedCorner","splitButtonSettings.enableRTL","splitButtonSettings.size","splitButtonSettings.height","splitButtonSettings.imagePosition","splitButtonSettings.width","splitButtonSettings.text","splitButtonSettings.suffixIcon","splitButtonSettings.create","splitButtonSettings.itemMouseOver","splitButtonSettings.itemSelected","splitButtonSettings.beforeOpen","splitButtonSettings.destroy","splitButtonSettings.cssClass","dropdownSettings.dataSource","dropdownSettings.text","dropdownSettings.value","dropdownSettings.select","dropdownSettings.width","dropdownSettings.showRoundedCorner","dropdownSettings.showPopupOnLoad","dropdownSettings.allowMultiSelection","dropdownSettings.enableRTL","dropdownSettings.enabled","dropdownSettings.caseSensitiveSearch","dropdownSettings.showCheckbox","dropdownSettings.checkAll","dropdownSettings.uncheckAll","dropdownSettings.enablePersistence","dropdownSettings.enableIncrementalSearch","dropdownSettings.readOnly","dropdownSettings.allowGrouping","dropdownSettings.fields","dropdownSettings.selectedItems","dropdownSettings.itemsCount","dropdownSettings.height","dropdownSettings.cssClass","dropdownSettings.itemValue","dropdownSettings.popupHeight","dropdownSettings.targetID","dropdownSettings.waterMarkText","dropdownSettings.template","dropdownSettings.cascadeTo","dropdownSettings.query","dropdownSettings.create","dropdownSettings.popupHide","dropdownSettings.popupShown","dropdownSettings.beforePopupShown","dropdownSettings.change","dropdownSettings.checkChange","dropdownSettings.enableAnimation","dropdownSettings.destroy","toggleButtonSettings.contentType","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.type","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.click","toggleButtonSettings.enabled","toggleButtonSettings.showRoundedCorner","toggleButtonSettings.enableRTL","toggleButtonSettings.enablePersistence","toggleButtonSettings.toggleState","toggleButtonSettings.preventToggle","toggleButtonSettings.size","toggleButtonSettings.imagePosition","toggleButtonSettings.height","toggleButtonSettings.width","toggleButtonSettings.cssClass","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.defaultSuffixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.create","toggleButtonSettings.change","toggleButtonSettings.destroy","customToolTip.title","customToolTip.content","customToolTip.prefixIcon",[{tag:"galleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy"]},{tag:"customGalleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","menuId","customItemType","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","menuSettings.openOnClick","menuSettings.enableCenterAlign","menuSettings.showRooltLevelArrows","menuSettings.showSubLevelArrows","menuSettings.enableSeparator","menuSettings.enabled","menuSettings.orientation","menuSettings.menuType","menuSettings.animationType","menuSettings.subMenuDirection","menuSettings.fields","menuSettings.cssClass","menuSettings.contextMenuTarget","menuSettings.excludeTarget","menuSettings.height","menuSettings.width","menuSettings.titleText","menuSettings.create","menuSettings.beforeOpen","menuSettings.open","menuSettings.close","menuSettings.mouseover","menuSettings.mouseout","menuSettings.keydown","menuSettings.destroy"]}]]}]]}]]}]]}]]}],_ribbonRerender:function(){var n=this.model,r=this.element,t,i,u;if(i=this.element.find(".e-content.e-content-item"),this.element.find(".e-collapse-content").length>0)for(u=i.length,t=0;t<u;t++)if(i.eq(t).hasClass("e-active-content")&&i.eq(t).hasClass("e-collapse-content")){this._selectedItemIndex=t;this._isCollapsed=!0;break}this._isCollapsed?(n.selectedItemIndex=this._selectedItemIndex,n._isCollapsed=!0):n._isCollapsed=!1;this.element.data("ejTab")&&(this.element.data("ejTab")._destroy(),this.element=r,this.model=n);this.element.ejRibbon("destroy").ejRibbon(n);this.model=n;this.element=r;this.model._isCollapsed&&this.collapse()},_setModel:function(i){var e,u,l,s,r,v,f,y,o,a,p;for(e in i)switch(e){case"applicationTab":t.isNullOrUndefined(i.applicationTab.backstageSettings)||t.isNullOrUndefined(i.applicationTab.backstageSettings.pages)||(this.model.applicationTab.backstageSettings.pages=i.applicationTab.backstageSettings.pages);this.model.enableOnDemand?this._createAppTabOnDemand():this._createApplicationTab();break;case"selectedItemIndex":this.model.selectedItemIndex>0&&this._tabObj.model.disabledItemIndex.indexOf(this.model.selectedItemIndex)===-1&&(this._ribbonTabs.eq(this.model.selectedItemIndex).is(":visible")||this._responsiveTabText.eq(t.isNullOrUndefined(t.isNullOrUndefined(this.model.applicationTab))?this.model.selectedItemIndex:this.model.selectedItemIndex-1).is(":visible"))&&this._tabObj.option({selectedItemIndex:this.model.selectedItemIndex});break;case"disabledItemIndex":var u,w=this.model.disabledItemIndex.length,h=this.model.disabledItemIndex,b=this.element.find(".e-link"),c;for(this.model.disabledItemIndex.push(0),this._tabObj.option({disabledItemIndex:this.model.disabledItemIndex}),r=0;r<w;r++)u=this._ribbonTabs.eq(h[r]).parent().parent(),(u.hasClass("e-contextli")||u.hasClass("e-contextliset"))&&u.addClass("e-disable"),this._tabObj.model.selectedItemIndex!=0&&this._tabObj.model.selectedItemIndex===h[r]&&(c=b.eq(h[r]).attr("href"),n(c).append(this.element.find("#"+this._id+"_disabled")),n(c).css("position","relative"),this.element.find("#"+this._id+"_disabled").show());break;case"enabledItemIndex":for(l=this.model.enabledItemIndex.length,s=this._tabUl.find(".e-contextualtabset"),this._ribbonTabs=this._ribbonTabs.not("span,.e-ribresmenu,.e-responsiveqat"),r=0;r<l;r++)this.model.enabledItemIndex[r]!==0&&this._ribbonTabs.eq(this.model.enabledItemIndex[r]).is(":visible")||(this.model.enabledItemIndex.splice(r,1),--l,--r);for(this._conTabsRemove(),this._tabObj.option({enabledItemIndex:this.model.enabledItemIndex}),this._contextualTabs(),v=this.model.enabledItemIndex.length,f=0;f<v;f++)this._tabText.eq(this.model.enabledItemIndex[f]).parent().removeClass("e-disable"),this._tabText.eq(this.model.enabledItemIndex[f]).parent().css("position",""),u=this._ribbonTabs.eq(this.model.enabledItemIndex[f]).parent().parent(),(u.hasClass("e-contextli")||u.hasClass("e-contextliset"))&&u.removeClass("e-disable"),this.model.enabledItemIndex[f]==this._tabObj.model.selectedItemIndex&&this.element.find("#"+this._id+"_disabled").hide();for(y=s.length,o=0;o<y;o++)n(s[o]).hasClass("e-disable")&&n(s[o]).parents(".e-contextliset").addClass("e-disable");break;case"allowResizing":this._ribbonWindowResize();break;case"isResponsive":this._ribbonWindowResize();break;case"width":this.element.width(i[e]);this._ribbonWindowResize();break;case"enableRTL":this.model.enableRTL=i[e];a=this.model;p=this.element;this.element.data("ejTab")&&(this.element.data("ejTab")._destroy(),this.element=p,this.model=a);this.element.ejRibbon("destroy");n("#"+this._id).ejRibbon(a);break;case"locale":this.model.locale=i[e];this._ribbonRerender()}},_setTabContentHeight:function(){var i,f,r,e,u,t;for(this.element.find(".e-ribGroupContent").height("auto"),i=0,f=this.element.find(".e-content.e-content-item"),u=n("#"+this._id).parents(),n(f).addClass("e-content-show"),n("#"+this._id).is(":hidden")&&n("#"+this._id).addClass("e-ribbon-show"),t=0;t<u.length;t++)u.eq(t).is(":hidden")&&u.eq(t).addClass("e-ribbon-show");for(r=this.element.find(".e-separatordivrow"),e=r.length,t=0;t<e;t++)n(r).eq(t).height(n(r).eq(t).prev().height());this.element.find(".e-ribGroupContent").each(function(){i=Math.max(i,n(this).height())});this.element.find(".e-ribGroupContent").height(i);n(f).removeClass("e-content-show");n("#"+this._id).hasClass("e-ribbon-show")&&(this._ribbonResize(),n(".e-ribbon-show").removeClass("e-ribbon-show"))},_init:function(){t.isNullOrUndefined(this.element)||(this._trigger("load"),this._render(),this._wireEvents())},_render:function(){var i,e,o,u,f;this.model.enableOnDemand&&n.isFunction(n.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),n("#"+this._id+"_WaitingPopup").addClass("e-ribbonwaitingpopup"));this.model.disabledItemIndex.length==0&&this.model.disabledItemIndex.push(0);this._renderTab();this.model.showQAT&&(i=t.buildTag("div.e-rbnquickaccessbar").click(n.proxy(this._onQatClick,this)),this.model.showBelowQAT?(i.removeClass("e-rbnabove").addClass("e-rbnbelow"),this.element.append(i).addClass("e-rbnwithqatbelow")):(i.removeClass("e-rbnbelow").addClass("e-rbnabove"),this.element.prepend(i).addClass("e-rbnwithqatabove")),this.element.addClass("e-rbnwithqat"));this._initPrivateProperties();this.model.enableOnDemand?this.model.collapsible?this._createQAT():(this._groupContent(),this.element.find(".e-header").addClass("e-rbnondemand"),this._createQAT()):(this._groupingControls(),this._createQAT());this._initial=!0;this._customization();this._initialRender=!0;this.model.collapsible&&this.collapse();this._ribbonResponsive();this._responsiveTabText=this.element.find(".e-responsivetabheader li");this._phoneMode&&this._ribbonWindowResize();this._tabObj.initialRender=!1;this.element.append(t.buildTag("div#"+this._id+"_disabled"));this.element.append(t.buildTag("div#"+this._id+"_modelDiv"));e=this.element.find(".e-content");this.element.find("#"+this._id+"_disabled").height(this.element.find(".e-active-content").height()).width(this.model.width);this.element.find("#"+this._id+"_disabled").css({top:0,left:0,position:"absolute"}).addClass("e-disable");this.element.find("#"+this._id+"_disabled").hide();this.element.find("#"+this._id+"_modelDiv").height(n(e).height()).width(this.model.width);this.element.find("#"+this._id+"_modelDiv").css({top:0,left:0,position:"absolute"}).addClass("e-modelDiv");this.element.find("#"+this._id+"_modelDiv").hide();o=t.buildTag("div#"+this._id+"_resize").addClass("e-resizediv").hide().click(n.proxy(this._onResizeDivClick,this));this.element.append(o);var r=t.buildTag("div#"+this._id+"_tooltip").addClass("e-tooltipdiv").hide(),s=t.buildTag("div#"+this._id+"_toolTip_title").addClass("e-tooltiptitle"),h=t.buildTag("div#"+this._id+"_toolTip_Desc").addClass("e-tooltipdesc");r.append(s);r.append(h);this.element.append(r);this._applicationTab.hasClass("e-active")&&!t.isNullOrUndefined(this.model.tabs[0].id)&&(this._applicationTab.removeClass("e-active"),this.element.find(".e-content.e-content-item").remove(),this._tabUl.find(".e-expandcollapse").remove());u=this.element.find(".e-empty-content");f=this.element.find(".e-groupdiv").eq(0);n(u).length>0&&n(f).length>0&&n(u).height(n(f).parent().height());this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").show()},_createQuickAccessBar:function(){var u,e,r,o,i,s,f;if(this.model.showQAT){for(u=t.buildTag("div.e-splitbtnqatdiv").attr("title",this.localizedLabels.CustomizeQuickAccess),e=t.buildTag("button#"+this._id+"_qatsplitbtn").addClass("e-splitbtnqat e-rbn-button"),u.append(e.ejButton({size:"normal",type:"button",contentType:"imageonly",height:30,width:14,prefixIcon:"e-icon e-ribbon e-qatexpand",click:n.proxy(this._onQatExpandBtnClick,this)})),this._qAccessBar.append(u),r=t.buildTag("ul.e-rbnqatmenu","<div>"+this.localizedLabels.CustomizeQuickAccess+"<\/div>").click(n.proxy(this._onQatMenuClick,this)),o=this._qatControlsName.length,i=0;i<o;i++)s=t.buildTag("li#"+this._qatControlsName[i].id+"_menuli.e-qatmenuli e-removemenuli","<p>"+this._qatControlsName[i].text+"<\/p>").appendTo(r).attr("title",this.localizedLabels.RemoveFromQuickAccessToolbar),this._qatControlsName[i].qAccess=="menu"&&s.addClass("e-addmenuli").removeClass("e-removemenuli").attr("title",this.localizedLabels.AddToQuickAccessToolbar);f="";f=this.model.showBelowQAT?"<li class='e-rbnshowabove e-qatmenuli'>"+this.localizedLabels.ShowAboveTheRibbon+"<\/li>":"<li class='e-rbnshowbelow e-qatmenuli'>"+this.localizedLabels.ShowBelowTheRibbon+"<\/li>";r.append("<li class='e-qatmenuli e-qatseparator'><\/li><li class='e-qatmorecommands e-qatmenuli' title="+this.localizedLabels.CustomizeQuickAccess+">"+this.localizedLabels.MoreCommands+"<\/li>"+f);this._qAccessBar.append(r.hide())}},_tooltip:function(t){var i=this.element.find(".e-controlclicked");(i.length<=0||n(i).find(".e-ribbonbtn").length>0)&&(this.element.find("#"+t.data.ribbonId+"_resize").is(":visible")||this.element.find(".e-gallexpandcontent").is(":visible")?(n(t.target).parents(".e-resizediv").length>0||n(t.target).parents(".e-gallexpandcontent").length>0)&&this._toolTipShow(t):this._toolTipShow(t))},_toolTipShow:function(i){var u=this.element.find("#"+i.data.ribbonId+"_tooltip"),f,e,s,b,o,l,v,k,y,h,p,r,w,a,c;(u.find(".e-tooltiptitle").length<=0&&(k=t.buildTag("div#"+i.data.ribbonId+"_toolTip_title").addClass("e-tooltiptitle"),u.prepend(k)),u.removeClass("e-tooltipdivwithimg"),l=u.find(".e-tooltiptitle"),l.children().remove(),n(i.target).is("li"))||(n(i.target).hasClass("e-rarrowup-2x")&&!t.isNullOrUndefined(this.model.expandPinSettings.toolTip)&&n(n(i.target).parent()).attr("title",this.model.expandPinSettings.toolTip),!n(i.target).hasClass("e-rarrowup-2x")||t.isNullOrUndefined(this.model.expandPinSettings.customToolTip.title)&&t.isNullOrUndefined(this.model.expandPinSettings.customToolTip.content)||(r=i.data.value.expandObj),n(i.target).hasClass("e-ribbonpinicon")&&!t.isNullOrUndefined(this.model.collapsePinSettings.toolTip)?n(n(i.target).parent()).attr("title",this.model.collapsePinSettings.toolTip):!n(i.target).hasClass("e-ribbonpinicon")||t.isNullOrUndefined(this.model.collapsePinSettings.customToolTip.title)&&t.isNullOrUndefined(this.model.collapsePinSettings.customToolTip.content)?n(i.target).hasClass("e-rarrowup-2x")||n(i.target).hasClass("e-ribbonpinicon")||(r=i.data.value):r=i.data.value.collapseObj,t.isNullOrUndefined(r)||t.isNullOrUndefined(r.customToolTip)||t.isNullOrUndefined(r.customToolTip.title)?l.remove():l.append(r.customToolTip.title),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.customToolTip)||t.isNullOrUndefined(r.customToolTip.content)||(l.children().length<=0&&l.empty().append("<b>"+r.customToolTip.title+"<\/b>"),o=u.find(".e-tooltipdesc"),o.children().remove(),o.append(r.customToolTip.content),o.children().length<=0&&o.empty().append("<h6>"+r.customToolTip.content+"<\/h6>"),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.customToolTip.prefixIcon)?o.children().addClass("e-tooltipcontent"):(o.prepend("<span class=e-tooltipimg><\/span>"),o.find(".e-tooltipimg").addClass(r.customToolTip.prefixIcon),o.children().not("."+r.customToolTip.prefixIcon).addClass("e-tooltipcntwithimg"),u.addClass("e-tooltipdivwithimg"))),t.isNullOrUndefined(r))||(e=this.element.find("#"+i.delegateTarget.id).offset(),f=this.element.find("#"+i.delegateTarget.id),u.stop(!0).delay(700).show(0).addClass("e-rbntooltipshadow"),b=this.element.find("#"+i.data.ribbonId+"_resize"),v=n(i.target).parents(".e-gallexpandcontent"),this.element.css({position:"relative"}),y=this.element.width()+this.element.offset().left-(e.left+parseInt(n(u).width(),10)),e.left=y<=0?e.left+y-this.element.offset().left:e.left-this.element.offset().left,p=this.element.find(".e-active-content").eq(0),h=p.is(":visible")?this._tabUl.height()+p.height():this._tabUl.height(),b.is(":visible")&&!v.is(":visible")?(u.offset({left:e.left}),s=f.parents(".e-galleryrow").length>0?h+f.position().top+f.parents(".e-galleryrow").height():h+f.position().top+f.height(),u.css({top:s})):v.is(":visible")?(w=f.parents(".e-galleryrow").length>0?f.parents(".e-galleryrow"):f.parents(".e-galleryexpanderrow").length>0?f.parents(".e-galleryexpanderrow"):f,s=n(v).parents(".e-resizediv").length>0?w.height()+h+f.position().top+12:w.height()+this._tabUl.height()+f.position().top+12,u.offset({left:e.left}),u.css({top:s})):n(i.target).parents(".e-qatooldiv").length>0||n(i.target).hasClass("e-qatooldiv")?(a=this.element.find(".e-qaresizediv"),c=this.element.find(".e-rbnquickaccessbar"),c.hasClass("e-rbnabove")&&a.length>0?a.is(":visible")&&u.offset({top:a.height()+c.height()+4,left:e.left}):c.hasClass("e-rbnabove")?u.offset({top:c.height()+4,left:e.left}):(s=a.is(":visible")?c.height()+a.height()+h+4:h+c.height()+4,u.offset({top:s,left:e.left}))):(s=h+3,u.offset({top:s,left:e.left})))},_toolTipOut:function(n){var t=this.element.find("#"+n.data.ribbonId+"_tooltip");t.hide(0);t.css({top:"",left:""});t.find(".e-tooltiptitle").children().remove();t.find(".e-tooltipdesc").children().remove()},_responsiveScrollRemove:function(){var t=this.element.find(".e-active-content .e-responsiveScroll"),n=this.element.find(".e-rescontentScroll");n.length>0&&(n.data("ejScroller")._destroy(),n.parent().append(n.find("div:first").children()),n.remove());t.length>0&&(t.data("ejScroller")._destroy(),this.element.find(".e-active-content").append(t.find("div:first").children()),t.remove())},_onGroupClick:function(i){var f,y,r,h,c,l,rt,o,e,a,k,v,d,g,nt,tt,it,ut,ft;if(this._toolTipCustomization(i),parentElem=n(i.target).parents(".e-resizebtnselect"),this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active"),f=n(i.target).parents(".e-resizediv"),n(i.target).hasClass("e-resizebtnselect")?n(i.target).removeClass("e-resizebtnselect e-active"):parentElem.length>0?parentElem.removeClass("e-resizebtnselect e-active"):(parentElem=n(i.target).parents(".e-resizebtn"),parentElem.length>0?parentElem.addClass("e-resizebtnselect e-active"):n(i.target).hasClass("e-resizebtn")&&n(i.target).addClass("e-resizebtnselect e-active")),this.model.showQAT&&!n(i.target).parents(".e-mobdiv").length>0&&(n(i.target).hasClass("e-togglebutton e-btn")||n(i.target).parents(".e-togglebutton.e-btn").length>0)&&(r=n(i.target),n(i.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(i.target).parents(".e-togglebutton.e-btn")),y=this._QATclick?r.parent().find("input").attr("id")+"_mobEle":r.parent().find("input").attr("id")+"_qatEle",n(".e-ribbon.e-rbnwithqat").find("#"+y).length>0&&this._rbnToggleBtnCustomization(i,y)),!this._phoneMode)if(f.length<=0&&(n(i.target).hasClass("e-resizebtn")?f=n(i.target):t.isNullOrUndefined(n(i.target).parents(".e-resizebtn"))||(f=n(i.target).parents(".e-resizebtn"))),this.element.find(".e-resizediv").is(":visible")&&this.element.find(".e-resizediv .e-gallexpandcontent").is(":visible"))n(i.target).hasClass("e-gallerymoveicon")||n(i.target).hasClass("e-gallerymovediv")||n(i.target).hasClass("e-expgallerydiv")||n(i.target).hasClass("e-scrollbar")||n(i.target).parents().hasClass("e-scrollbar")?expClick=i.target:n(i.target).parents().hasClass("e-gallerymenu")&&(n(i.target).hasClass("e-haschild")||n(i.target).hasClass("aschild")||n(i.target).hasClass("e-arrows"))&&(expClick=i.target),t.isNullOrUndefined(expClick)&&(this._ribbonGalleryShow(),this.element.find(".e-resizediv").show().css("visibility",""),this.element.find(".e-resizediv .e-gallexpandcontent").hide().css("visibility",""));else if(f.length<=0){if(!n(i.target).parents(".e-content").length>0&&n(i.target).parents(".e-rbn-ddl").length>0||n(i.target).parents(".e-rbn-splitbtn").length>0||n(i.target).parents(".e-presetWrapper").length>0||n(i.target).parents(".e-ribbonpopup").length>0||n(i.target).parents(".e-colorpicker.e-ribbon:visible").length>0)return!1;this._resizeDivHide()}else n(f).hasClass("e-resizebtn")&&(this.element.find(".e-resizediv").is(":visible")?f.parent().siblings(".e-contentbottom").length<=0?this._resizeDivHide():(this._resizeDivHide(),this._resizeDivShow(f)):this._resizeDivShow(f));if(this._phoneMode){var u=this.element.find(".e-active-content"),s=0,p,w,b,r=i.target;if(n(r).hasClass("e-groupresponsive e-ribdownarrow")){for(p=u.find(".e-resptoolbarScroll .e-scrollbar").height(),b=u.children(".e-groupdiv,.e-groupmobdiv"),h=0;h<b.length;h++)s+=b.eq(h).outerHeight();s+=t.isNullOrUndefined(p)?0:p;w=u.find(".e-respmobcontent").length>0?s-u.find(".e-respmobcontent").outerHeight()>this._responsiveHeight:s>this._responsiveHeight;u.height(w?u.find(".e-respmobcontent").length>0?this._responsiveHeight+u.find(".e-respmobcontent").outerHeight():this._responsiveHeight:s).removeClass("e-responsiveheight e-rbnmobheader e-responsiveToolbarScroll");w&&(c=t.buildTag("div#"+this._id+"_responsiveScroller").addClass("e-responsiveScroll").append(t.buildTag("div")),u.find(".e-respmobcontent").length>0?c.find("div").append(u.children().eq(0).siblings()):c.find("div").append(u.children()),u.append(c),u.find(".e-responsiveScroll").ejScroller({height:this._responsiveHeight,scrollerSize:8,buttonSize:0}));n(r).removeClass("e-ribdownarrow").addClass("e-ribuparrow");n(r).parents(".e-groupdiv").find(".e-ribdownarrow").removeClass("e-ribdownarrow").addClass("e-ribuparrow")}else if(n(r).hasClass("e-groupresponsive e-ribuparrow"))u.addClass("e-responsiveheight e-rbnmobheader"),u.find(".e-resptoolbarScroll").length>0&&u.addClass("e-responsiveToolbarScroll"),this._responsiveScrollRemove(),n(r).removeClass("e-ribuparrow").addClass("e-ribdownarrow");else if(this.element.find(".e-responsivecontent").is(":hidden")&&(n(r).hasClass("e-resizebtn")||n(r).parents(".e-resizebtn").length>0||n(r).hasClass("e-groupresponsive e-ribrightarrow")||n(r).hasClass("e-ribrightdivarrow"))){if(n(r).hasClass("e-resizebtn")?(this._responsiveTarget=n(r).parents(".e-groupdiv"),this._responsiveContent=n(r).parent().siblings()):n(r).parents(".e-resizebtn").length>0?(this._responsiveTarget=n(r).parents(".e-resizebtn").parents(".e-groupdiv"),this._responsiveContent=n(r).parents(".e-resizebtn").parent().siblings()):(n(r).hasClass("e-groupresponsive e-ribrightarrow")||n(r).hasClass("e-ribrightdivarrow"))&&(l=n(r).parents(".e-resizegroupdiv").find(".e-resizebtn"),l.length>0&&(this._responsiveTarget=l.parents(".e-groupdiv"),this._responsiveContent=l.parent().siblings())),rt=this._responsiveContent.eq(0).removeClass("e-reshide"),o=this.element.find(".e-content.e-responsivecontent"),o.children().not(".e-responsiveback").remove(),o.append(rt),this.element.find(".e-restopbackcontent").text(this._responsiveTarget.find(".e-resizebtn .e-btntxt").text()),e=o.find(".e-ribbongallery"),e.length>0){for(a=this._responsiveGallery,k=Math.floor(e.find(".e-galleryrow").children().length/a),e.find(".e-galleryrow").children().length%a>0&&++k,v=1;v<=k;v++){for(d=t.buildTag("div#"+e.attr("id")+"_galleryExpanderRow_"+v).addClass("e-galleryexpanderrow").click({model:e},n.proxy(this._onGalleryItemClick,this)),g=0;g<a;g++)e.find(".e-galleryrow").children().eq(0).appendTo(d);d.appendTo(o.parent().find(".e-expandercontent"))}e.hide();o.parent().find(".e-gallexpandcontent").show()}this._responsiveContentShow(o)}}nt=n(i.target).hasClass("e-groupdiv")?n(i.target).index():n(i.target).parents(".e-groupdiv").index();nt!=-1&&(i.groupItems=this._groupClickEventArgs(nt,i));n(i.target).parents(".e-ribbongallerycontrol").length===0&&(this._trigger("groupClick",i),i.cancel||!t.raiseWebFormsServerEvents||t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("groupClick")!=-1&&(tt=n.extend(!0,{},this.model),it=i.target.id?i.target.id:i.target.parentNode.id,ut={model:tt,originalEventType:"groupClick",id:it},ft={model:tt,id:it},t.raiseWebFormsServerEvents("groupClick",ut,ft)))},_groupClickEventArgs:function(i,r){var f=this._tabUl.find(".e-active"),u=f.index(),o,e;return this._phoneMode&&n(r.target).parents(".e-groupdiv").siblings(".e-groupmobdiv").length>0&&(i-=1),t.isNullOrUndefined(this.model.applicationTab)||f.hasClass("e-contextualtabset")||(u=u-1),(u<0)?void 0:(e=f.hasClass("e-contextualtabset")?this.model.contextualTabs[f.parents(".e-contextual").index()].tabs[u]:this.model.tabs[u],t.isNullOrUndefined(e)||(o=e.groups[i]),o)},goToMainContent:function(){var i=this.element.find(".e-responsivebackstage"),n=this.element.find(".e-responsivetabheader"),r={},t=this.element.find(".e-active-content"),f=this.element.find(".e-responsivebackstage"),u=this.element.find(".e-responsivebackstagecontent");n.removeClass("e-resshow");i.is(":visible")&&i.removeClass("e-backstageshowanimate").addClass("e-reshide");u.is(":visible")&&u.hide();this.element.find(".e-responsivecontent").is(":visible")&&this._responsiveContentBack();t.hasClass("e-responsiveheight")||(t.addClass("e-responsiveheight e-rbnmobheader"),this._responsiveScrollRemove(),t.find(".e-groupresponsive.e-ribuparrow").removeClass("e-ribuparrow").addClass("e-ribdownarrow"),r.type="collapse",this._trigger("collapse",r));n.hasClass("e-resshow")&&n.removeClass("e-resshow")},_onResizeDivClick:function(t){var f,r,i,u;this._toolTipCustomization(t);this.model.showQAT&&(n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0)&&(r=n(t.target),n(t.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(t.target).parents(".e-togglebutton.e-btn")),f=r.parent().find("input").attr("id")+"_qatEle",this._rbnToggleBtnCustomization(t,f));this._phoneMode&&((n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0)&&(r=n(t.target),n(t.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(t.target).parents(".e-togglebutton.e-btn")),f=r.parent().find("input").not(".e-active").attr("id")+"_mobEle",this._rbnToggleBtnCustomization(t,f)),n(t.target).hasClass("e-ribleftarrow")&&this._responsiveContentBack());n(t.currentTarget).find(".e-ribGroupContent").length>0&&(i=n(t.currentTarget).find(".e-ribGroupContent").attr("id").split("_"),u=this.element.find("#"+i[0]+"_"+i[1]+"_"+i[2]).index(),this._phoneMode&&u>0&&this.element.find("#"+i[0]+"_"+i[1]+"_"+i[2]).siblings(".e-groupmobdiv").length>0&&(u-=1),u!=-1&&(t.groupItems=this._groupClickEventArgs(u,t)));t.targetElement="resizedGroup";this._trigger("groupClick",t)},_toolTipCustomization:function(t){var i=n(t.target).parents(".e-controlpadding");n(i).find(".e-ribbongallerycontrol").length<=0&&n(t.target).find(".e-disable").length<=0&&!n(t.target).hasClass("e-disable")&&(this.element.find(".e-tooltipdiv").hide(0),n(i).hasClass("e-controlclicked")?n(i).removeClass("e-controlclicked"):n(i).addClass("e-controlclicked"))},_onTabClick:function(i){var e;this._trigger("beforeTabClick",i);this.model.enableOnDemand&&(n("#"+this._id+"_WaitingPopup").is(":hidden")&&this.element.find(".e-content.e-content-item").eq(i.activeIndex).children().length==0&&this.element.ejWaitingPopup("show"),this._groupContent(i));var l=this.element.find(".e-rarrowup-2x"),o=this._tabUl.find("li.e-active"),f=this.element.find(".e-collapseactive"),s,c,h=this.element.find(".e-active-content").eq(0);if(this._phoneMode){this._responsiveScrollRemove();this.element.find(".e-mobribgroupactive").removeClass("e-mobribgroupactive");var a=i.activeIndex,r=this.element.find(".e-content.e-content-item").eq(a),u=this._tabUl.children(".e-tab").index(i.activeHeader);if(t.isNullOrUndefined(this.model.applicationTab)&&(--i.activeIndex,--i.prevActiveIndex),this.element.find(".e-content.e-content-item").eq(i.prevActiveIndex).removeClass("e-responsiveheight e-rbnmobheader"),this.element.find(".e-content.e-content-item").eq(i.activeIndex).addClass("e-responsiveheight e-rbnmobheader"),this.element.find(".e-responsivecontent").is(":visible")&&this.element.find(".e-responsivecontent").hasClass("e-resshow")&&this.element.find(".e-responsivecontent").removeClass("e-resshow"),t.isNullOrUndefined(this._responsiveContent)||this._responsiveTarget.append(this._responsiveContent).css(this._responsiveContentStyle),u!=-1&&this._mobileContents[u].mobileContent.length>0&&!r.find(".e-respmobcontent").length>0){for(r.prepend(t.buildTag("div#"+this._id+"_mobcontent").addClass("e-respmobcontent e-groupmobdiv").append(t.buildTag("div#"+this._id+"_mobribgroup").addClass("e-mobribgroup e-mobribgroupactive").append(t.buildTag("div.e-ribupdivarrow").addClass("e-toolbaralign").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))))).click(n.proxy(this._onGroupClick,this)).click(n.proxy(this._onMobContentClick,this)),r.find(".e-resgroupheader").removeClass("e-resgroupheader"),e=0;e<this._mobileToolbar[u].Content.length;e++)r.find(".e-mobribgroup").append(this._mobileToolbar[u].Content[e]);r.find(".e-mobribgroup").append(r.find(".e-mobribgroup .e-ribupdivarrow"))}u!=-1&&this._mobileContents[u].mobileContent.length>0&&!r.find(".e-mobribgroup").hasClass("e-mobribgroupactive")&&r.find(".e-mobribgroup").addClass("e-mobribgroupactive")}o.length>0?(o.removeClass("e-active"),o.children().removeClass("e-active"),h.removeClass("e-active-content").hide()):f.length>0&&(i.activeHeader.textContent===f.find(".e-link").text()?(f.addClass("e-active").removeClass("e-collapseactive"),h.removeClass("e-collapse-content").slideDown("fast","swing",n.proxy(this._ribExpand,this))):(s=this.element.find(".e-link"),f.removeClass("e-collapseactive"),this.element.find(".e-collapse-content").removeClass("e-collapse-content"),h.removeClass("e-active-content"),c=s.eq(i.activeIndex).attr("href"),s.eq(i.activeIndex).addClass("e-active"),n(c).slideDown("fast","swing",n.proxy(this._ribExpand,this))));l.length>0&&this.element.find(".e-collapsed").length>0&&this._addRibbonPin();this._initialRender||this._trigger("tabClick",i);this._clickValue="click"},_onTabSelect:function(i){var u,f,e,o,r,h;if(this.model.enableOnDemand&&(this._initialRender&&n("#"+this._id+"_WaitingPopup").is(":hidden")&&this.element.ejWaitingPopup("show"),this._setTabContentHeight()),u=this.element.find("li.e-active"),r=this.element.find(".e-expandcollapse"),this.model.selectedItemIndex=i.activeIndex,u.hasClass("e-disable")||(f=this.element.find(".e-link"),e=f.eq(i.activeIndex).attr("href"),o=n(e).find("#"+this._id+"_disabled"),o&&this.element.find("#"+this._id+"_disabled").hide()),r.length>0&&r.appendTo(this.element.find(".e-active-content").eq(0)),this._phoneMode||this._ribbonResize(),!this._initialRender&&(this._trigger("tabSelect",i),n(".e-menu-wrap").children(".e-split:visible").length>0&&n(n(".e-menu-wrap").children(".e-split")).css("display","none"),n(".e-rbn-ddl").parent(".e-ddl-popup:visible").length>0&&n(n(".e-rbn-ddl").parent(".e-ddl-popup:visible")).css("display","none"),n(".e-popupWrapper").parent(".e-colorpicker.e-ribbon:visible").length>0&&n(n(".e-popupWrapper").parent(".e-colorpicker.e-ribbon")).css("display","none"),t.isOnWebForms&&t.raiseWebFormsServerEvents&&!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("tabSelect")!=-1)){var s=n.extend(!0,{},this.model),c={model:s,originalEventType:"tabSelect",activeIndex:i.activeIndex,prevActiveIndex:i.prevActiveIndex},l={model:s,activeIndex:i.activeIndex,prevActiveIndex:i.prevActiveIndex};t.raiseWebFormsServerEvents("tabSelect",c,l)}this._phoneMode&&!this._initialRender&&this._ribbonWindowResize();this._initialRender=!1;h=this;this.model.enableOnDemand&&n("#"+this._id+"_WaitingPopup").is(":visible")&&setTimeout(function(){h.element.ejWaitingPopup("hide")},300)},_create:function(n){this.model.enableOnDemand&&this.element.find(".e-content.e-content-item").addClass("e-rbn-ondemand");this._trigger("tabCreate",n)},_onGalMoveUpClick:function(t){var i=this.element.find("#"+t.data.galleryId),r=i.find(".e-gallerycontent").children(":visible").first().prev();this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow();r.length>0&&(i.find(".e-gallerycontent").children(":visible").last().hide(),r.show().width(i.find(".e-galleryrow").first().width()),n(r).hasClass("e-gryfirstrow")&&i.find(".e-moveupdiv").addClass("e-disablegrymovebtn"),i.find(".e-movedowndiv").removeClass("e-disablegrymovebtn"))},_onGalMoveDownClick:function(t){var i=this.element.find("#"+t.data.galleryId),r=i.find(".e-gallerycontent").children(":visible").last().next();this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow();r.length>0&&(i.find(".e-gallerycontent").children(":visible").first().hide(),r.show().width(i.find(".e-galleryrow").first().width()),n(r).hasClass("e-grylastrow")&&i.find(".e-movedowndiv").addClass("e-disablegrymovebtn"),i.find(".e-moveupdiv").removeClass("e-disablegrymovebtn"))},_onQatMenuItemClick:function(t){var i={target:n(t.target),cancel:!1,text:n(t.target).text()};this._trigger("qatMenuItemClick",i)},_onQatResizeBtnClick:function(t){var i=this.element.find(".e-qaresizediv"),r=this.element.find(".e-qaresizebtn"),u;r.hasClass("e-active")?r.removeClass("e-tbtn e-active"):r.addClass("e-tbtn e-active");i.is(":hidden")?(n(t.e.currentTarget).position().left+i.width()>this.element.width()?(u=n(t.e.currentTarget).position().left+i.width()-this.element.width(),i.show().css({left:n(t.e.currentTarget).position().left-u})):i.show().css({top:this._qAccessBar.height(),left:n(t.e.currentTarget).position().left}),this._qAccessBar.hasClass("e-rbnbelow")?i.css({top:this.element.height()}):i.css({top:this._qAccessBar.height()})):i.hide().css({top:"",left:""})},_onQatExpandBtnClick:function(t){var f=0,o=this.element.find(".e-splitbtnqat"),e=this.element.find(".e-qaresizediv"),i=this.element.find(".e-rbnqatmenu"),r=n(t.e.currentTarget),u;if(o.hasClass("e-active")){o.removeClass("e-tbtn e-active");i.hide();return}o.addClass("e-tbtn e-active");e.length>0&&e.is(":visible")?(u=e.position().left+r.position().left+i.width(),u>this.element.width()&&(f=u-this.element.width()),i.show().css({top:e.height()-6,left:e.position().left+r.position().left-(f+6)})):(u=r.position().left+i.width(),this.model.enableRTL&&(u=this.element.width()-r.offset().left+i.width()),u>this.element.width()&&(f=u-this.element.width()),this.model.enableRTL&&i.show().css({right:this.element.width()-r.offset().left+this.element.offset().left-r.outerWidth()-f}),i.show().css({left:r.position().left-f}),this.element.hasClass("e-grpdivhide")&&(this.element.removeClass("e-grpdivhide"),this.element.find(".e-active-content").eq(0).addClass("e-resdivshow")))},_onQatClick:function(t){if(this._QATclick||(this._QATclick=!0),this.model.showQAT&&(n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0)){var i,r=n(t.target);n(t.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(t.target).parents(".e-togglebutton.e-btn"));i=r.parents(".e-qatooldiv").attr("id").slice(0,-7);this._rbnToggleBtnCustomization(t,i)}this._QATclick=!1},_onMobContentClick:function(t){if(n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0){var r,i=n(t.target);if(n(t.target).parents(".e-togglebutton.e-btn").length>0&&(i=n(t.target).parents(".e-togglebutton.e-btn")),!i.parents(".e-mobdiv").length>0)return;r=i.parents(".e-mobdiv").attr("id").slice(0,-7);this._rbnToggleBtnCustomization(t,r)}},_rbnToggleBtnCustomization:function(n,t){var r=this.element.find("#"+t+":input.e-togglebutton.e-chkbx-hidden"),f=r.parent().siblings(".e-togglebutton"),u,i;this._rbnToggleBtnAction&&r.length>0&&(this._rbnToggleBtnAction=!1,i=r.data("ejToggleButton"),u=i.model.click,i.model.click="",f.click(),i.model.click=u);this._rbnToggleBtnAction=!0},_onQatMenuClick:function(t){var f=this.element.find(".e-rbnquickaccessbar"),r,i=n(t.target),u=i.parents(".e-qatmenuli");(i.hasClass("e-qatmenuli")||u.length>0)&&(u.length>0&&(i=u),i.attr("id")&&(r=this.element.find("#"+this._id+"_"+i.attr("id").slice(0,-7)+"_qatEle").parents(".e-qatooldiv"),r.is(":visible")?(r.hide(),i.addClass("e-addmenuli").removeClass("e-removemenuli").attr("title",this.localizedLabels.AddToQuickAccessToolbar)):(r.show(),i.removeClass("e-addmenuli").addClass("e-removemenuli").attr("title",this.localizedLabels.RemoveFromQuickAccessToolbar))),i.hasClass("e-rbnshowbelow")?(this.element.append(f.removeClass("e-rbnabove").addClass("e-rbnbelow")).removeClass("e-rbnwithqatabove").addClass("e-rbnwithqatbelow"),i.addClass("e-rbnshowabove").removeClass("e-rbnshowbelow").text(this.localizedLabels.ShowAboveTheRibbon),this.model.showBelowQAT=!0):i.hasClass("e-rbnshowabove")&&(this.element.prepend(f.removeClass("e-rbnbelow").addClass("e-rbnabove")).removeClass("e-rbnwithqatbelow").addClass("e-rbnwithqatabove"),i.addClass("e-rbnshowbelow").removeClass("e-rbnshowabove").text(this.localizedLabels.ShowBelowTheRibbon),this.model.showBelowQAT=!1),this.element.find(".e-rbnqatmenu").hide().css({top:"",left:""}),this.element.find(".e-qaresizebtn,.e-splitbtnqat").removeClass("e-tbtn e-active"),(this.model.allowResizing||this.model.isResponsive)&&(this._qatResize(),this._qatResizeRemove()))},_onGalContentClick:function(t){var i=this.element.find("#"+t.data.galleryId);n(t.target).hasClass("e-gallerybtn")?(i.find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).addClass("e-galleryselect")):n(t.target).parents(".e-gallerybtn")&&(i.find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).parents(".e-gallerybtn").addClass("e-galleryselect"))},_onExpandContentClick:function(t){var i=this.element.find("#"+t.data.galleryId);n(t.target).hasClass("e-gallerybtn")?(i.parent().find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).addClass("e-galleryselect")):n(t.target).parents(".e-gallerybtn")&&(i.parent().find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).parents(".e-gallerybtn").addClass("e-galleryselect"))},_onExpandGalleryClick:function(i){var e,r=this.element.find("#"+i.data.galleryId),u=i.data.expandedColumns,f,o,s,h;for(this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow(),t.isNullOrUndefined(i.data.expandedColumns)&&(u=i.data.columns),e=Math.floor(r.find(".e-galleryrow").children().length/u),r.find(".e-galleryrow").children().length%u>0&&++e,f=1;f<=e;f++){for(o=t.buildTag("div#"+r.attr("id")+"_galleryExpanderRow_"+f).addClass("e-galleryexpanderrow").click({model:r},n.proxy(this._onGalleryItemClick,this)),s=0;s<u;s++)r.find(".e-galleryrow").children().eq(0).appendTo(o);o.appendTo(this.element.find("#"+r.attr("id")).parent().find(".e-expandercontent"))}for(r.hide(),h=0;h<i.data.columns;h++)r.find(".e-galleryrow").eq(0).append("<div><\/div>");this.element.find(".e-resizediv").is(":visible")&&(this.element.find(".e-resizediv").css("visibility","hidden"),this.element.find(".e-resizediv .e-gallexpandcontent").css("visibility","visible"));this.element.find("#"+r.attr("id")).parent().find(".e-gallexpandcontent").show();this.element.find("#"+r.attr("id")).parent().find(".e-expandercontent").height()>160&&!this._phoneMode&&this.element.find("#"+r.attr("id")).parent().find(".e-gallscrollcontent").ejScroller({height:160})},_onGalleryItemClick:function(i){var r,f,u,e,o;r={target:i.target,galleryModel:i.data.model,cancel:!1};n(r.target).hasClass("e-galleryexpanderrow")||(this._trigger("galleryItemClick",r),i.preventDefault(),t.raiseWebFormsServerEvents&&!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("galleryItemClick")!=-1&&(f=n.extend(!0,{},this.model),u=r.target.id?r.target.id:r.target.parentNode.id,e={model:f,originalEventType:"galleryItemClick",id:u},o={model:i.data.model,id:u},t.raiseWebFormsServerEvents("galleryItemClick",e,o)))},_ribbonKeyDown:function(n){(n.keyCode===40||n.keyCode===39)&&this._tabUl.find(".e-tab:visible,.e-contextualtabset:visible").length===this._tabObj.model.selectedItemIndex&&n.stopImmediatePropagation()},_OnKeyDown:function(t){var i,r;t.keyCode===27&&(i=this.element.find(".e-resizediv"),this.element.find(".e-ribbonbackstagepage").is(":visible")?this.hideBackstage():n(".e-menu-wrap").children(".e-split:visible").length<=0&&i.find(".e-ddl").parents(".e-controlclicked").length<=0&&i.is(":visible")?this._resizeDivHide():this.element.find(".e-gallexpandcontent").is(":visible")&&this._ribbonGalleryShow(),i.is(":visible")&&i.find(".e-controlclicked").removeClass("e-controlclicked"),r=this.element.find("#"+this._id+"_modelDiv"),r.is(":visible")&&r.css("display","none"))},_ribCollapse:function(n){var n={clickType:this._clickValue};this._clickValue==null&&(n={clickType:"click"});this._clickValue=null;this._trigger("collapse",n)},_ribExpand:function(n){this.element.find(".e-ribbonpin").length>0&&this._tabContents.width(this.element.width());var n={clickType:this._clickValue};this._clickValue==null&&(n={clickType:"click"});this._clickValue=null;this._trigger("expand",n)},collapse:function(){var t=this.element.find(".e-active-content").eq(0),i=this.element.find("#"+this._id+"_togglebutton");this._initialRender&&this.model.collapsible?t.hide():t.slideUp("fast","swing",n.proxy(this._ribCollapse,this));this.element.find("li.e-active").eq(0).removeClass("e-active").addClass("e-collapseactive e-select");t.addClass("e-collapse-content");this._selectedItemIndex=this._tabObj.model.selectedItemIndex;this._tabObj.option({selectedItemIndex:0});this._tabObj.model.selectedItemIndex=0;this.model.selectedItemIndex=0;i.removeClass("e-expanded").addClass("e-collapsed");this._isCollapsed=!0},expand:function(){var t=this.element.find(".e-active-content").eq(0),i;t.hasClass("e-rbn-ondemand")&&this._groupContent({activeIndex:this.model.selectedItemIndex+1});i=this.element.find("#"+this._id+"_togglebutton");t.slideDown("fast","swing",n.proxy(this._ribExpand,this));this.element.find(".e-collapseactive").addClass("e-active").removeClass("e-collapseactive");t.removeClass("e-collapse-content");this._tabObj.model.selectedItemIndex=this._selectedItemIndex;this.model.selectedItemIndex=this._selectedItemIndex;i.removeClass("e-collapsed").addClass("e-expanded");i.find("span").addClass("e-rarrowup-2x");this._phoneMode||(this._ribbonResize(),this._addRibbonPin())},_addRibbonPin:function(){if(this.element.find(".e-ribbonpinicon").length<=0){var t=this.element.find(".e-expandcollapse"),n=this.element.find(".e-rarrowup-2x");n.parent().removeClass("e-collapsed").addClass("e-expanded e-ribbonpin");n.removeClass("e-rarrowup-2x").addClass("e-ribbonpinicon");this._isCollapsed=!1}this._tabContents.css({position:"absolute"}).width(this.element.width());this.element.hasClass("e-grpdivhide")&&this._tabContents.css({position:""}).width(this.element.width());this.element.hasClass("e-grpdivhide")&&this.element.find(".e-ribbonpin").length>0&&this.model.showQAT&&this._qAccessBar.hasClass("e-rbnbelow")&&this.element.find(".e-rbnquickaccessbar").css({position:"absolute"})},_removeRibbonPin:function(){var n=this.element.find("#"+this._id+"_togglebutton");this._tabContents.css({position:"",width:""});n.removeClass("e-ribbonpin");n.find("span").removeClass("e-ribbonpinicon").addClass("e-rarrowup-2x")},_onRbnPinDivClick:function(){this._removeRibbonPin()},_onGroupExpandClick:function(n){this._trigger("groupExpand",n)},_onBackStageItemClick:function(i){var e,o,r,s,h,u,f,c,l;this._phoneMode&&this.element.find(".e-responsivebackstagecontent .e-backstageTitle").text(n(i.currentTarget).text());u=this.element.find(i.data.contentDivId);i.preventDefault();n(i.target).hasClass("e-backstagebutton")&&(this.element.find(".e-ribbonbackstagepage").hide(),this._phoneMode&&this.element.find(".e-responsivebackstage").is(":visible")&&this.element.find(".e-responsivebackstage").removeClass("e-backstageshowanimate"));this.element.find(".e-backstageactive-content").removeClass("e-backstageactive-content").hide();this.element.find(".e-backstageactive").removeClass("e-backstageactive");this.model.enableOnDemand&&u.children().length==0&&(f=this.model.applicationTab.backstageSettings,c=f.pages.length,this.model.enableOnDemand&&c>0&&(l=n(i.currentTarget).index()-n(i.currentTarget).prevAll(".e-backstageseparator").length,u.append(n("#"+f.pages[l].contentID).addClass("e-backstagetabarea").show())));this.element.find(i.data.contentDivId).addClass("e-backstageactive-content").show();n(i.target).hasClass("e-backstageli")?n(i.target).addClass("e-backstageactive"):n(i.target).parents(".e-backstageli").addClass("e-backstageactive");e=this.element.find(".e-ribbonbackstagetop").height();this.element.find(".e-backstagescrollcontent").ejScroller({height:0});h=this.model.applicationTab.backstageSettings.height;r=t.isNullOrUndefined(n(i.target).text())?n(i.target).children("a").text():n(i.target).text();o=t.isNullOrUndefined(n(i.target).attr("id"))?n(i.target).parent().attr("id"):n(i.target).attr("id");s={id:o,text:r,target:i.target,type:"backstageItemClick",cancel:!1};!this.element.find(i.data.contentDivId).children().hasClass("e-backstagetitlecontent")&&this.model.enableOnDemand?t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent").text(r).prependTo(u):this.model.enableOnDemand&&this.element.find(".e-backstagetitlecontent").text("").append(r);this._backStageHeightCalculate(h,e);n(i.target).parents(".e-backstageheader").length>0&&(n(i.target).find("a").length>0||i.target.localName=="a")&&this._phoneMode&&(this.element.find(".e-responsivebackstagecontent").show(),this.element.find(".e-responsivebackstage").removeClass("e-backstageshowanimate"));this._trigger("backstageItemClick",s)},_onBackStageTopIcon:function(){this.hideBackstage()},_backStageHeightCalculate:function(i,r){var u=this.model.applicationTab.backstageSettings.width;t.isNullOrUndefined(i)||(i.toString().endsWith("%")?i=this.element.find(".e-ribbonbackstagepage").height():i.toString().endsWith("px")&&(i=parseInt(i,10)),this.model.applicationTab.backstageSettings.height!="100%"&&(this.element.find(".e-backstageactive-content").height()>i-r?(this.element.find(".e-ribbonbackstagepage").height(i).width(u),this.element.find(".e-backstagescrollcontent").ejScroller({height:i-r,scroll:n.proxy(this._scroll,this)})):t.isNullOrUndefined(i)&&this.element.find(".e-backstageactive-content").height()>this.element.height()-r&&this.element.find(".e-backstagescrollcontent").ejScroller({height:this.element.height()-r,scroll:n.proxy(this._scroll,this)})));t.isNullOrUndefined(u)||(u.toString().endsWith("%")?u=this.element.find(".e-ribbonbackstagepage").width():u.toString().endsWith("px")&&(i=parseInt(u,10)),this.model.applicationTab.backstageSettings.width!="100%"&&(this.element.find(".e-backstageactive-content").width()>u-this.element.find(".e-backstageheader").width()?(this.element.find(".e-ribbonbackstagepage").height(i).width(u),this.element.find(".e-backstagescrollcontent").ejScroller({width:u})):t.isNullOrUndefined(u)&&this.element.find(".e-backstageactive-content").width()>this.element.width()&&this.element.find(".e-backstagescrollcontent").ejScroller({width:this.element.width()})));this._refreshBackstageScroller()},_refreshBackstageScroller:function(){var i=this;this.element.find(".e-backstagescrollcontent").find(".e-content").scroll(t.proxy(function(t){i.element.find(".e-backstagetopcontent").css({position:"relative",left:-n(t.currentTarget).scrollLeft()});i.element.find(".e-backstagetopicon").css({left:n(t.currentTarget).scrollLeft()+26})}))},_onApplicationTabClick:function(n){n.preventDefault();var t=this.element.find(".e-backstagecontent");this.model.enableOnDemand&&t.length==0&&this._createApplicationTab();t=this.element.find(".e-backstagecontent");this.showBackstage()},showBackstage:function(){var h,w,b,f,r,c,o,e,l,a=this.element.find(".e-backstagecontent"),y,s,u,i,p;if(this.model.enableOnDemand&&a.length==0&&this._createApplicationTab(),e=this.element.find(".e-ribbonbackstagebody"),l=this.element.find(".e-backstageheader"),f=this.model.applicationTab.backstageSettings.height,backStageWidth=this.model.applicationTab.backstageSettings.width,this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage){t.isNullOrUndefined(f)?(this.element.find(".e-ribbonbackstagepage").height(this.element.height()).width(this.element.width()),e.height(this.element.height()-92),l.height(this.element.height()-92)):(e.height(f-92),l.height(f-92));t.isNullOrUndefined(backStageWidth)?(this.element.find(".e-ribbonbackstagepage").height(this.element.height()).width(this.element.width()),e.width(this.element.width())):e.width(backStageWidth);this.element.css({position:"relative"});this.element.find(".e-ribbonbackstagepage").show();h=this.element.find(".e-backstageheader").width();this.element.find(".e-backstagetopcontent").width(h);this.element.find(".e-backstageheader").width(h);o=this.element.find(".e-backstageli");o.width(o.width());b=this.element.find(".e-ribbonbackstagetop").height();this.element.find(".e-backstageactive-content").removeClass("e-backstageactive-content").hide();this.element.find(".e-backstageactive").removeClass("e-backstageactive");o.first().addClass("e-backstageactive");this.element.find(".e-backstagecontent").first().addClass("e-backstageactive-content").show();this.element.find(".e-backstagescrollcontent").ejScroller({height:0,width:0});r=this.element.find(".e-backstageli").first();c=t.isNullOrUndefined(n(r).text())?n(r).children("a").text():n(r).text();var v=this.model.applicationTab.backstageSettings,k=v.pages.length,a=this.element.find(".e-backstagecontent");this._phoneMode||this.model.enableOnDemand&&k>0&&!t.isNullOrUndefined(v.pages[0].text)&&(y=n(".e-backstageactive-content").index()-1,s=n(a).filter(".e-backstageactive-content"),y!=-1&&n(s).append(n("#"+v.pages[y].contentID).addClass("e-backstagetabarea").show()),n(s).children().hasClass("e-backstagetitlecontent")||n(s).prepend(t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent")));this._backStageHeightCalculate(f,b);a=this.element.find(".e-backstagecontent");u=this.element.find(".e-responsivebackstage").removeClass("e-reshide");i=u.find(".e-backstageheader");this._phoneMode&&(this.element.find(".e-responsivetabheader").is(":visible")&&this.element.find(".e-responsivetabheader").removeClass("e-resshow"),u.children().length>0&&(p=parseInt(i.css("top")),this.element.parent(".e-js").length>0&&document.documentElement.clientHeight-u.find(".e-backstageheader").offset().top>this.element.parent(".e-js").height()?i.css({width:this.element.find(".e-header").outerWidth()/2,height:this.element.parent().height()}):i.css({width:this.element.find(".e-header").outerWidth()/2,height:document.documentElement.clientHeight-u.find(".e-backstageheader").offset().top}),i.offset().top!=p&&i.height(i.height()-p)),u.addClass("e-backstageshowanimate"),this.element.find(".e-backstageactive").removeClass("e-backstageactive"));w={id:n(r).attr("id"),text:c,target:n(r).children(),type:"backstageItemClick",cancel:!1};this.model.enableOnDemand&&this.element.find(".e-backstagetitlecontent").text("").append(c);this._trigger("backstageItemClick",w)}},hideBackstage:function(){this.element.find(".e-ribbonbackstagepage").hide();this._phoneMode&&this.goToMainContent()},_initPrivateProperties:function(){this._initialRender=!1;this._tabUl=this.element.find(".e-header");this._applicationTab=this.element.find(".e-apptab");this._ribbonTabs=this._tabUl.find(":not('a')");this._tabText=this.element.find(".e-link");this._id=this.element.attr("id");this._tabObj=this.element.data("ejTab");this._isCollapsed=!1;this._contextualTabSet="";this._resizeWidth=0;this._selectedItemIndex=0;this._clickValue=null;this._tabContents=this.element.children().attr("role","tabpanel").not(".e-header,.e-disable,.e-resizediv,.e-tooltipdiv,.e-ribbonbackstagepage");this._qatControlsName=[];this._qAccessBar=this.element.find(".e-rbnquickaccessbar");this._rbnToggleBtnAction=!0;this.localizedLabels=this._getLocalizedLabels();this._phoneMode=(this.model.allowResizing||this.model.isResponsive)&&document.documentElement.clientWidth<420?!0:!1;this._responsiveTarget=null;this._responsiveContent=null;this._responsiveContentStyle=null;this._responsiveGallery=null;this._mobileToolbar=[];this._mobileContents=[];this._responsiveTabText=null;this._responsiveHeight=document.documentElement.clientHeight*(parseInt("40%")/100);this._QATclick=!1},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_customization:function(){var f,r={},u,i=this;this._initial&&(this.model.contextualTabs.length>0&&this.model.contextualTabs[0].tabs.length>0&&this._contextualTabs(),f="<div id="+this._id+'_togglebutton class="e-expanded"><span class="e-icon e-rarrowup-2x"><\/span><\/div>',u=t.buildTag("li#"+this._id+"_expandCollapse.e-expandcollapse",f),this.element.find(".e-active-content").eq(0).append(u),r.expandObj=this.model.expandPinSettings,r.collapseObj=this.model.collapsePinSettings,u.mouseover({value:r,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)));this.model.enableOnDemand?this._createAppTabOnDemand():this._createApplicationTab();this.element.find(".e-content.e-content-item").on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){i.element.hasClass("e-responsive")&&(i.element.find(".e-ribupdivarrow .e-icon").hasClass("e-ribuparrow")?i._ribExpand(this):i.element.find(".e-ribupdivarrow .e-icon").hasClass("e-ribdownarrow")&&i._ribCollapse(this))})},_createAppTabOnDemand:function(){this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Menu?(this._applicationTab.find(".e-link").hide(),this.model.applicationTab.menuSettings&&(model=this.model.applicationTab.menuSettings),this.model.applicationTab.menuItemID&&(n("#"+this.model.applicationTab.menuItemID).appendTo(this._applicationTab),model.enableRTL=this.model.enableRTL,model.isResponsive=!1,n("#"+this.model.applicationTab.menuItemID).addClass("e-rbncustomelement").ejMenu(model)),n("#"+this._id+"_"+this.model.applicationTab.type.replace(/\s/g,"")).hide()):this._applicationTab.find(".e-link").text(this.model.applicationTab.backstageSettings.text);this._applicationTab.click(n.proxy(this._onApplicationTabClick,this));this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&this._applicationTab.find("a").addClass("e-apptabanchor")},_createApplicationTab:function(){var e=this.element.find(".e-ribbonbackstagepage"),s=this.element.find(".e-backstageheader"),l,a,w,b,h=this.element.find(".e-ribbonbackstagebody"),k=this.element.find(".e-backstagetopcontent"),rt,v,r,nt,f,c,y,u,p,d,g,o,tt,i,it;if(r=this.model.applicationTab.backstageSettings,nt=r.pages.length,this.model.applicationTab.type!==t.Ribbon.ApplicationTabType.Menu||this.model.enableOnDemand?this._applicationTab.find(".e-link").text(this.model.applicationTab.backstageSettings.text):(this._applicationTab.find(".e-link").hide(),this.model.applicationTab.menuSettings&&(model=this.model.applicationTab.menuSettings),this.model.applicationTab.menuItemID&&(n("#"+this.model.applicationTab.menuItemID).appendTo(this._applicationTab),model.enableRTL=this.model.enableRTL,model.isResponsive=!1,n("#"+this.model.applicationTab.menuItemID).addClass("e-rbncustomelement").ejMenu(model)),n("#"+this._id+"_"+this.model.applicationTab.type.replace(/\s/g,"")).hide()),this._applicationTab.click(n.proxy(this._onApplicationTabClick,this)),this.element.find(".e-content.e-content-item").css("box-sizing","content-box"),this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage){for(f=this.model.applicationTab.backstageSettings.height,f.toString().endsWith("%")?f=n(document).height()*(parseInt(f.slice(0,-1),10)/100):f.toString().endsWith("px")&&(f=parseInt(f,10)),e.length==0&&(e=t.buildTag("div#"+this._id+"_BackStage").addClass("e-ribbonbackstagepage"),h=t.buildTag("div#"+this._id+"_BackStageBody").addClass("e-ribbonbackstagebody"),s=t.buildTag("ul#"+this._id+"_BackStageHeader").addClass("e-backstageheader")),e.height(f).width(this.model.applicationTab.backstageSettings.width).hide(),h.height(f-50),s.height(f-50),i=0;i<nt;i++)c=this.element.find("#"+r.pages[i].id+"_backStageTab"),y=this.element.find("#"+r.pages[i].id+"_backStageBtn"),t.isNullOrUndefined(r.pages[i].itemType)&&(r.pages[i].itemType=t.Ribbon.ItemType.Tab),r.pages[i].itemType==t.Ribbon.ItemType.Button&&(c=this.element.find("#"+r.pages[i].id+"_backStageBtn"),y=this.element.find("#"+r.pages[i].id+"_backStageTab")),this.element.find(".e-ribbonbackstagepage").length==0||c.length==0&&y.length==0?(l=t.buildTag("li").addClass("e-backstageli").attr("tabindex",0).click({contentDivId:"#"+this._id+"_BackStage_"+r.pages[i].id.replace(/\s/g,""),height:r.height},n.proxy(this._onBackStageItemClick,this)),r.pages[i].itemType==t.Ribbon.ItemType.Tab?(a=t.buildTag("a",r.pages[i].text,{},{href:"#"+this._id+"_BackStage_"+r.pages[i].id.replace(/\s/g,"")}).focus(function(){n(this).parents(".e-backstageli").addClass("e-bsmaterial-focus")}).focusout(function(){n(this).parents(".e-backstageli").removeClass("e-bsmaterial-focus")}),l.append(a).attr("id",r.pages[i].id+"_backStageTab")):l.append(r.pages[i].text).addClass("e-backstagebutton").attr("id",r.pages[i].id+"_backStageBtn"),s.append(l),r.pages[i].enableSeparator&&(v=t.buildTag("li").addClass("e-backstageseparator"),s.append(v)),r.pages[i].itemType==t.Ribbon.ItemType.Tab&&this._addBackStageTabCont(r,h,i)):(u=y,c.length>0&&(u=c),r.pages[i].itemType==t.Ribbon.ItemType.Button?(u.find("a").length>0&&(this._removeBackStageTabCont(this.element.find(u.find("a").attr("href"))),u.attr("id",r.pages[i].id+"_backStageBtn").addClass("e-backstagebutton"),u.find("a").remove()),u.text(r.pages[i].text)):(u.hasClass("e-backstagebutton")&&(a=t.buildTag("a",r.pages[i].text,{},{href:"#"+this._id+"_BackStage_"+r.pages[i].id.replace(/\s/g,"")}).focus(function(){n(this).parents(".e-backstageli").addClass("e-bsmaterial-focus")}).focusout(function(){n(this).parents(".e-backstageli").removeClass("e-bsmaterial-focus")}),u.append(a).attr("id",r.pages[i].id+"_backStageTab").removeClass("e-backstagebutton"),this._addBackStageTabCont(r,h,i)),u.find("a").text(r.pages[i].text),p=this.element.find(u.find("a").attr("href")),r.pages[i].contentID!=p.find(".e-backstagetabarea").attr("id")&&(p.find(".e-backstagetabarea").removeClass("e-backstagetabarea").appendTo("body"),p.append(n("#"+r.pages[i].contentID).addClass("e-backstagetabarea")))),r.pages[i].enableSeparator?u.next().length>0&&!u.next().hasClass("e-backstageseparator")&&(v=t.buildTag("li").addClass("e-backstageseparator"),u.after(v)):u.next().length>0&&u.next().hasClass("e-backstageseparator")&&u.next().remove());if(this.element.find(".e-ribbonbackstagepage").length==0)h.prepend(s),b=t.buildTag("div#"+this._id+"_BackStageTop").addClass("e-ribbonbackstagetop").height(92),k=t.buildTag("div#"+this._id+"_BackStageTopContent").addClass("e-backstagetopcontent").appendTo(b),rt=t.buildTag("div#"+this._id+"_BackStageTopIcon","<div class='e-ribbonbackicon'><span><\/span><\/div>").addClass("e-backstagetopicon").click(n.proxy(this._onBackStageTopIcon,this)).appendTo(k),e.append(b),w=t.buildTag("div#"+this._id+"_backStageScrollContent","<div><\/div>").addClass("e-backstagescrollcontent"),w.children().append(h),e.append(w),this._applicationTab.addClass("e-backstagetab"),this._applicationTab.find("a").addClass("e-apptabanchor"),this.element.find(".e-ribbonbackstagepage").length>0&&this.element.find(".e-ribbonbackstagepage").remove(),this.element.append(e),d=this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent"),e.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this._phoneMode&&(d.children().remove(),d.append(e.find(".e-ribbonbackstagebody .e-backstagecontent")));else{for(g=[],i=0;i<this.model.applicationTab.backstageSettings.pages.length;i++)g.push(this.model.applicationTab.backstageSettings.pages[i].id);for(i=0;i<this.element.find(".e-backstageli").length;i++)o=this.element.find(".e-backstageli").eq(i),tt=o.attr("id").split("_")[0],n.inArray(tt,g)<0&&(o.find("a").length>0&&this._removeBackStageTabCont(this.element.find(o.find("a").attr("href"))),o.next().length>0&&o.next().hasClass("e-backstageseparator")&&o.next().remove(),o.remove(),--i);for(i=0;i<r.pages.length;i++)this._checkBackstageTabOrder(r.pages[i],i)}t.isNullOrUndefined(r.headerWidth)||(k.css("width",r.headerWidth),s.css("width",r.headerWidth))}this.model.enableOnDemand&&this._phoneMode&&(backstage=this.element.find(".e-responsivebackstage"),backstagePage=this.element.find(".e-ribbonbackstagepage"),this._tabUl.find(".e-backstagetab").length>0&&backstage.length==1&&(it=backstagePage.find(".e-ribbonbackstagebody .e-backstageheader"),backstage.append(it).addClass("e-reshide")))},_addBackStageTabCont:function(i,r,u){var f=t.buildTag("div#"+this._id+"_BackStage_"+i.pages[u].id.replace(/\s/g,"")).addClass("e-backstagecontent").css({width:"auto"});u>0&&f.hide();i.pages[u].contentID&&!this.model.enableOnDemand&&(backStageTitleContent=t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent").appendTo(n(f)),n(backStageTitleContent).text("").append(i.pages[u].text),n(f).append(n("#"+i.pages[u].contentID).addClass("e-backstagetabarea").show()));r.append(f)},_removeBackStageTabCont:function(n){n.find(".e-backstagetabarea").removeClass("e-backstagetabarea").appendTo("body");n.remove()},_conTabsRemove:function(){for(var r=this.element.find(".e-contextli,.e-contextliset"),t,u=r.length,i=0;i<u;i++)t=n(r[i]),t.is(":visible")?t.find("li").insertAfter(t.eq(0)):t.find("li").hide().insertAfter(t.eq(0)),t.remove()},_contextualTabs:function(){var i,f,e,o,r,s,u;if(this.model.contextualTabs)for(o=this.model.contextualTabs.length,r=0;r<o;r++)if(i=this.model.contextualTabs[r],i.tabs.length>0){for(f=t.buildTag("li#e-contextlisetIn_"+r).addClass("e-contextliset"),this._contextualTabSet=this._tabUl.children(".e-contextualtabset").filter(function(){return n(this).text()===i.tabs[0].text}),this._contextualTabSet.before(f),this._tabUl.children(".e-contextualtabset").find("a").css("color",i.borderColor),e=t.buildTag("ul.e-contextual","",{background:i.backgroundColor,"border-top-color":i.borderColor}),s=i.tabs.length,u=0;u<s;u++)e.append(this._tabUl.children(".e-contextualtabset").filter(function(){return n(this).text()===i.tabs[u].text}));e.appendTo(f)}},addBackStageItem:function(n,i){var r=this.model.applicationTab.backstageSettings.pages.length;t.isNullOrUndefined(i)||(r=i);this.model.applicationTab.backstageSettings.pages.splice(r,0,n);this._initial=!1;this._customization();this._phoneMode&&(backstagePage=this.element.find(".e-ribbonbackstagepage"),backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").append(backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent")))},_checkBackstageTabOrder:function(n,t){var i=this.element.find("#"+n.id+"_backStageTab"),r;i.length==0&&(i=this.element.find("#"+n.id+"_backStageBtn"));i.index()!=t&&(r=this.element.find(".e-backstageli").eq(t),n.enableSeparator&&i.next().hasClass("e-backstageseparator")&&(r=i.next().insertBefore(r)),i.insertBefore(r),this.element.find("#"+this._id+"_BackStage_"+n.id).insertBefore(this.element.find(".e-backstagecontent").eq(t)))},removeBackStageItem:function(t){var r,i;r=this.model.applicationTab.backstageSettings.pages[t].id;i="#"+this._id+"_BackStage_"+r;this.model.applicationTab.backstageSettings.pages.splice(t,1);this.element.find(i).hasClass("e-backstagecontent")&&this.element.find(i).remove();n(this.element.find(".e-backstageli")[t]).remove();this.hideBackstage()},updateBackStageItem:function(t,i){n.extend(this.model.applicationTab.backstageSettings.pages[t],i);this._initial=!1;this._customization();this._phoneMode&&(backstagePage=this.element.find(".e-ribbonbackstagepage"),backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").append(backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent")))},showContextualTab:function(t){this.element.find(".e-contexttitle").filter(function(){return n(this).text()===t}).parent().parent().show()},hideContextualTab:function(t){this.element.find(".e-contexttitle").filter(function(){return n(this).text()===t}).parent().parent().hide();this._tabObj.option({selectedItemIndex:this._tabObj.model.selectedItemIndex+1})},_createQAT:function(){if(this.model.showQAT&&(!t.isNullOrUndefined(this.model.qatItems)||this.element.find(".e-rbnquickaccessbar").children().length==0)){if(this.model.enableOnDemand&&(t.isNullOrUndefined(this.model.tabs)||this._createCollapseQuickaccess(this.model.tabs),!t.isNullOrUndefined(this.model.contextualTabs)))for(var n=0;n<this.model.contextualTabs.length;n++)this._createCollapseQuickaccess(this.model.contextualTabs[n].tabs);this.model.showQAT&&!t.isNullOrUndefined(this.model.qatItems)&&this._createCollapseQuickaccess()}this._createQuickAccessBar()},_createCollapseQuickaccess:function(n){var i,r,u,f,e;if(t.isNullOrUndefined(n)||t.isNullOrUndefined(this.model.qatItems)&&this.element.find(".e-rbnquickaccessbar").children().length!=0)this._createqatItems(this.model.qatItems);else for(i=0;i<n.length;i++)if(!t.isNullOrUndefined(n[i].groups))for(r=0;r<n[i].groups.length;r++)if(!t.isNullOrUndefined(n[i].groups[r].content))for(u=0;u<n[i].groups[r].content.length;u++)f=n[i].groups[r].content[u].groups,e=n[i].groups[r].content[u].defaults,n[i].groups[r].content[u].defaults,this._createqatItems(f,e)},_createqatItems:function(i,r){var c,l,u,f,a,v,o,s,e,h;for(this.model.showQAT&&(!t.isNullOrUndefined(this.model.qatItems)||this.element.find(".e-rbnquickaccessbar").children().length==0)&&(c=t.buildTag("div#"+this._id+"order")),l=[],u=0;u<i.length;u++)if(!t.isNullOrUndefined(i[u])){t.isNullOrUndefined(r)||t.isNullOrUndefined(r.type)||(i[u].type=r.type);t.isNullOrUndefined(i[u].type)&&(i[u].type=t.Ribbon.Type.Button);t.isNullOrUndefined(i[u].isBig)&&!t.isNullOrUndefined(r)&&(i[u].isBig=r.isBig);f=this.model.buttonDefaults;t.isNullOrUndefined(i[u].height)&&(t.isNullOrUndefined(i[u].buttonSettings)||t.isNullOrUndefined(i[u].buttonSettings.height)?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.height)?t.isNullOrUndefined(f)||t.isNullOrUndefined(f.height)||(a=f.height):a=r.height:a=i[u].buttonSettings.height,i[u].height=a,a=null);t.isNullOrUndefined(i[u].width)&&(t.isNullOrUndefined(i[u].buttonSettings)||t.isNullOrUndefined(i[u].buttonSettings.width)?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.width)?t.isNullOrUndefined(f)||t.isNullOrUndefined(f.width)||(v=f.width):v=r.width:v=i[u].buttonSettings.width,i[u].width=v,v=null);t.isNullOrUndefined(i[u].buttonSettings)||(o=i[u].buttonSettings,!t.isNullOrUndefined(o.enabled)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enabled)||(o.enabled=f.enabled),!t.isNullOrUndefined(o.enableRTL)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enableRTL)||(o.enableRTL=f.enableRTL),!t.isNullOrUndefined(o.cssClass)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cssClass)||(o.cssClass=f.cssClass),!t.isNullOrUndefined(o.showRoundedCorner)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.showRoundedCorner)||(o.showRoundedCorner=f.showRoundedCorner));t.isNullOrUndefined(i[u].splitButtonSettings)||(s=i[u].splitButtonSettings,!t.isNullOrUndefined(s.enabled)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enabled)||(s.enabled=f.enabled),!t.isNullOrUndefined(s.enableRTL)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enableRTL)||(s.enableRTL=f.enableRTL),!t.isNullOrUndefined(s.cssClass)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cssClass)||(s.cssClass=f.cssClass),!t.isNullOrUndefined(s.showRoundedCorner)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.showRoundedCorner)||(s.showRoundedCorner=f.showRoundedCorner));t.isNullOrUndefined(i[u].toggleButtonSettings)||(!t.isNullOrUndefined(i[u].toggleButtonSettings.enabled)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enabled)||(i[u].toggleButtonSettings.enabled=f.enabled),!t.isNullOrUndefined(i[u].toggleButtonSettings.enableRTL)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enableRTL)||(i[u].toggleButtonSettings.enableRTL=f.enableRTL),!t.isNullOrUndefined(i[u].toggleButtonSettings.cssClass)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cssClass)||(i[u].toggleButtonSettings.cssClass=f.cssClass),!t.isNullOrUndefined(i[u].toggleButtonSettings.showRoundedCorner)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.showRoundedCorner)||(i[u].toggleButtonSettings.showRoundedCorner=f.showRoundedCorner));t.isNullOrUndefined(i[u].quickAccessMode)&&(i[u].quickAccessMode="none");switch(i[u].type){case t.Ribbon.Type.SplitButton:split=i[u];model={};split.splitButtonSettings&&(model=JSON.parse(JSON.stringify(split.splitButtonSettings)));model.height=t.isNullOrUndefined(model.height)?i[u].height:model.height;model.width=t.isNullOrUndefined(model.width)?i[u].width:model.width;model.cssClass=model.cssClass?model.cssClass.concat(" e-rbn-splitbtn e-rbn-button"):"e-rbn-splitbtn e-rbn-button";model.enableRTL=this.model.enableRTL;split.quickAccessMode!="none"&&this.model.showQAT&&(this._splitButtonQAT=t.buildTag("button#"+this._id+"_"+split.id+"_qatEle",split.text,{},{type:"button"}).addClass(split.cssClass),e=t.buildTag("div#"+this._id+"_"+split.id+"_qatDiv",this._splitButtonQAT).addClass("e-qatooldiv"),c.append(e),model.height=30,model.arrowPosition=t.ArrowPosition.Right,model.contentType=t.ContentType.ImageOnly,n.isEmptyObject(split.customToolTip)?t.isNullOrUndefined(split.toolTip)||e.attr("title",split.toolTip):e.mouseover({value:split,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._splitButtonQAT.ejSplitButton(model),split.quickAccessMode=="menu"&&e.hide(),t.isNullOrUndefined(split.text)?t.isNullOrUndefined(split.splitButtonSettings.text)||(h=split.splitButtonSettings.text):h=split.text,l.push({id:split.id,text:h,qAccess:split.quickAccessMode}));break;case t.Ribbon.Type.ToggleButton:toggle=i[u];model={};toggle.toggleButtonSettings&&(model=JSON.parse(JSON.stringify(toggle.toggleButtonSettings)));model.height=t.isNullOrUndefined(model.height)?i[u].height:model.height;model.width=t.isNullOrUndefined(model.width)?i[u].width:model.width;toggle.quickAccessMode!="none"&&this.model.showQAT&&(this._toggleButtonQAT=t.buildTag("input#"+this._id+"_"+toggle.id+"_qatEle","","",{type:"checkbox"}).addClass(toggle.cssClass),e=t.buildTag("div#"+this._id+"_"+toggle.id+"_qatDiv",this._toggleButtonQAT).addClass("e-qatooldiv e-rbn-button"),model.height=30,model.contentType=t.ContentType.ImageOnly,n.isEmptyObject(toggle.customToolTip)?t.isNullOrUndefined(toggle.toolTip)||e.attr("title",toggle.toolTip):e.mouseover({value:toggle,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._toggleButtonQAT.ejToggleButton(model).addClass("e-ribbonbtn"),e.find("button").addClass("e-rbn-button"),c.append(e),toggle.quickAccessMode=="menu"&&e.hide(),t.isNullOrUndefined(toggle.text)?t.isNullOrUndefined(toggle.toggleButtonSettings.defaultText)||(h=toggle.toggleButtonSettings.defaultText):h=toggle.text,l.push({id:toggle.id,text:h,qAccess:toggle.quickAccessMode}));break;case t.Ribbon.Type.Button:button=i[u];model={};button.buttonSettings&&(model=JSON.parse(JSON.stringify(button.buttonSettings)));model.height=t.isNullOrUndefined(model.height)?i[u].height:model.height;model.width=t.isNullOrUndefined(model.width)?i[u].width:model.width;button.quickAccessMode!="none"&&this.model.showQAT&&(this._buttonQAT=button.buttonSettings?button.buttonSettings.type?t.buildTag("button#"+this._id+"_"+button.id+"_qatEle",button.text,{},{type:button.buttonSettings.type}).addClass(button.cssClass):t.buildTag("button#"+this._id+"_"+button.id+"_qatEle",button.text).addClass(button.cssClass):t.buildTag("button#"+this._id+"_"+button.id+"_qatEle",button.text).addClass(button.cssClass),e=t.buildTag("div#"+this._id+"_"+button.id+"_qatDiv",this._buttonQAT).addClass("e-qatooldiv"),model.height=30,model.contentType=t.ContentType.ImageOnly,n.isEmptyObject(button.customToolTip)?t.isNullOrUndefined(button.toolTip)||e.attr("title",button.toolTip):e.mouseover({value:button,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._buttonQAT.ejButton(model).addClass("e-ribbonbtn e-rbn-button"),c.append(e),button.quickAccessMode=="menu"&&e.hide(),t.isNullOrUndefined(button.text)?t.isNullOrUndefined(button.buttonSettings.text)||(h=button.buttonSettings.text):h=button.text,l.push({id:button.id,text:h,qAccess:button.quickAccessMode}))}}c.children().prependTo(this._qAccessBar);this._qatControlsName=n.merge(l,this._qatControlsName)},_resizeTabName:function(i){var r,u,f;if(!t.isNullOrUndefined(this.model.tabs))for(r=0;r<this.model.tabs.length;r++)if(this.model.tabs[r].text===i)return n(this._tabUl.find(".e-tab")[r]);if(!t.isNullOrUndefined(this.model.contextualTabs))for(r=0;r<this.model.contextualTabs.length;r++)for(u=0;u<this.model.contextualTabs[r].tabs.length;u++)if(this.model.contextualTabs[r].tabs[u].text===i)return n(this._tabUl.find(".e-contextliset")[r]).children().find(".e-contextualtabset").eq(u)},hideTab:function(i){var u=this._tabText.map(function(t){if(n(this).text()===i)return t})[0],r,l=this._tabObj.model.disabledItemIndex.length,c=!0,h,f,e,o,s;for(this._width=this.element.width(),t.isNullOrUndefined(u)&&(f=this._resizeTabName(i),this._phoneMode&&(f=this._responsiveTabText.filter(function(){return n(this).text()===i}),this.element.find(".e-responsivetabheader").addClass("e-resshow")),t.isNullOrUndefined(f)||f.hide()),e=this.element.find(".e-link").eq(u).attr("href"),h=this._tabText.filter(function(){return n(this).text()===i}).parents(".e-contextualtabset"),o=0;o<l;o++)this._tabObj.model.disabledItemIndex[o]===u&&(c=!1);c&&(h.length>0?(h.hide(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?u:u-1).hide()):(this._tabText.filter(function(){return n(this).text()===i}).parent().hide(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?u:u-1).hide()),n(e).hasClass("e-active-content")&&(n(e).hide(),n(e).removeClass("e-active-content")));this._tabUl.find(".e-active").is(":hidden")&&(this._phoneMode?(this.element.find(".e-responsivetabheader").addClass("e-resshow"),r=this._getVisibleItemIndex(this._responsiveTabText)):r=this._getVisibleItemIndex(this._tabText),r&&(s=this.element.find(".e-link").eq(r).attr("href"),n(this._tabText[r]).parent().hasClass("e-disable")?(n(this._tabText[u]).parent().removeClass("e-active"),n(this._tabText[r]).parent().addClass("e-active"),n(s).append(this.element.find("#"+this._id+"_disabled")),n(s).css("position","relative"),this.element.find("#"+this._id+"_disabled").show(),n(s).show(),this._tabObj.option("selectedItemIndex",r)):this._tabObj.option("selectedItemIndex",r),this._tabObj.model.selectedItemIndex=r,this.model.selectedItemIndex=r));this.element.hasClass("e-responsive")&&this.element.find(".e-responsivetabheader").removeClass("e-resshow")},showTab:function(i){var r=this._tabText.map(function(t){if(n(this).text()===i)return t})[0],f,u,e,o;t.isNullOrUndefined(r)&&(u=this._resizeTabName(i),this._phoneMode&&(u=this._responsiveTabText.filter(function(){return n(this).text()===i}),this.element.find(".e-responsivetabheader").addClass("e-resshow")),t.isNullOrUndefined(u)||u.show());e=this._tabText.filter(function(){return n(this).text()===i}).parent();f=this._tabText.filter(function(){return n(this).text()===i}).parents(".e-contextualtabset");f.length>0?(f.show(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?r:r-1).show()):(this._tabText.filter(function(){return n(this).text()===i}).parent().show(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?r:r-1).show());o=this.element.find(".e-content").eq(r);e.hasClass("e-active")?o.css("display")=="none"&&o.show():e.addClass("e-select");this.element.hasClass("e-responsive")&&this.element.find(".e-responsivetabheader").removeClass("e-resshow")},hideGroups:function(t,i){if(typeof i=="string")n("#"+this._id+"_"+t+"_"+i).hide();else for(var r=0;r<i.length;r++)n("#"+this._id+"_"+t+"_"+i[r]).hide()},showGroups:function(t,i){if(typeof i=="string")n("#"+this._id+"_"+t+"_"+i).show();else for(var r=0;r<i.length;r++)n("#"+this._id+"_"+t+"_"+i[r]).show()},hideGroupItems:function(t,i,r){if(typeof r=="string")n("#"+this._id+"_"+t+"_"+i+"_"+r).hide();else for(var u=0;u<r.length;u++)n("#"+this._id+"_"+t+"_"+i+"_"+r[u]).hide()},showGroupItems:function(t,i,r){if(typeof r=="string")n("#"+this._id+"_"+t+"_"+i+"_"+r).show();else for(var u=0;u<r.length;u++)n("#"+this._id+"_"+t+"_"+i+"_"+r[u]).show()},_getVisibleItemIndex:function(t){for(var i=1;i<t.length;){if(n(t[i]).is(":visible"))return i;i++}},removeApplicationTab:function(){if(this._ribbonTabs=this._tabUl.find(".e-link").parent(),href=this._ribbonTabs.eq(0).children().attr("href"),curTab=this._ribbonTabs.eq(0),curTab.hasClass("e-apptab")){this._tabObj.contentPanels.splice(0,1);this._tabObj.items.splice(0,1);this._tabObj.selectedItemIndex(this._tabObj.model.selectedItemIndex-1);curTab.remove();n(href).remove();n(this._tabUl.find(".e-link").parent(".e-active")).find("a").addClass("e-removeapptab");var t=this._tabUl.find("li").eq(0);t.hasClass("e-disable")||t.hasClass("e-apptab")||(this._tabObj.option({enabledItemIndex:[0]}),this.model.disabledItemIndex.splice(0));this.element.addClass("e-ribwithout-apptab");this._ribbonWindowResize()}},removeTab:function(t){var i,r,u,f;this._tabObj.model&&t>0&&(u={index:t},this._trigger("beforeTabRemove",u),this._ribbonTabs=this._tabUl.find(".e-link").parent(),r=this._ribbonTabs.eq(t).children().attr("href"),i=this._ribbonTabs.eq(t),this._phoneMode&&(curResTab=this._responsiveTabText.eq(t-1)),i.hasClass("e-contextualtab")?i.parent().remove():i.hasClass("e-contextualtabset")?i.siblings(".e-contextualtabset").length===0?i.parent().remove():i.remove():i.remove(),this._phoneMode&&curResTab.remove(),this._responsiveTabText=this.element.find(".e-responsivetabheader li"),f=this.element.find(".e-expandcollapse"),n(r).remove(),this._ribbonTabs=this._tabUl.find(".e-link").parent(),this._tabObj.model.selectedItemIndex===t&&(i=this._ribbonTabs.eq(t),this._phoneMode&&(curResTab=this._responsiveTabText.eq(t-1),curResTab.addClass("e-resactive"),this.element.find(".e-ribresmenu .e-reslink").text(this._responsiveTabText.filter(".e-resactive").text())),i.addClass("e-active"),r=i.children().attr("href"),n(r).append(f.click(n.proxy(this._tabExpandCollapse,this))),n(r).addClass("e-active-content e-activetop").show()),this._isCollapsed&&this.element.find(this._ribbonTabs.eq(t).children().attr("href")).append(f.click(n.proxy(this._tabExpandCollapse,this))),this._tabObj.contentPanels.splice(t,1),this._tabObj.items.splice(t,1),this.model.tabs.splice(t-1,1),this._phoneMode&&(this._mobileContents.splice(t-1,1),this._mobileToolbar.splice(t-1,1),this._ribbonWindowResize()),u={removedIndex:t},this._trigger("tabRemove",u))},removeTabGroup:function(i,r){var e,l,o,c,s,y,u,a,h,v,f;if(e=n(n(".e-ribbon .e-content")[i]).find(".e-groupdiv"),l=this._tabUl.find(".e-select,.e-active").eq(i),n(l).hasClass("e-tab"))for(o=this.model.tabs[i-1].groups,u=0;u<o.length;u++)o[u].text==r?(o.splice(u,1),n(e[u]).remove()):t.isNullOrUndefined(r)&&n(e[u]).remove();else for(c=this.model.tabs.length,y=this.model.contextualTabs.length,u=0;u<this.model.contextualTabs.length;u++)for(a=this.model.contextualTabs[u].tabs.length,h=0;h<a;h++)if(++c,c===i)for(s=this.model.contextualTabs[u].tabs[h].groups,v=s.length,f=0;f<v;f++)s[f].text==r?(s.splice(f,1),n(e[f]).remove()):t.isNullOrUndefined(r)&&n(e[f]).remove()},_addTabGrpIntoCollec:function(t,i,r){var e=i.length,o=r,u,f;for(n.isPlainObject(i)&&(e=1),u=0;u<e;u++)f=i,n.isPlainObject(i)||(f=i[u],u>0&&++o),t.groups.splice(o,0,f);return t},addTabGroup:function(i,r,u){var s,a=0,c=0,o,v,y,b,p,k,d,f,g,h,w,e,l;if(v=this._tabUl.find(".e-select,.e-active").eq(i),s=v.children("a").attr("href"),n(v).hasClass("e-tab"))for(k=this.model.tabs.length,f=0;f<k;f++)f===i-1&&(c=this.model.tabs[f].groups.length,t.isNullOrUndefined(u)&&(u=c),o=this._addTabGrpIntoCollec(this.model.tabs[f],r,u));else for(a=this.model.tabs.length,d=this.model.contextualTabs.length,f=0;f<d;f++)for(g=this.model.contextualTabs[f].tabs.length,h=0;h<g;h++)++a,a===i&&(c=this.model.contextualTabs[f].tabs[h].groups.length,t.isNullOrUndefined(u)&&(u=c),o=this._addTabGrpIntoCollec(this.model.contextualTabs[f].tabs[h],r,u));if(!t.isNullOrUndefined(o.groups[u])&&!this.element.find(".e-content.e-content-item").eq(i).hasClass("e-rbn-ondemand")){for(w=r.length,e=u,n.isPlainObject(r)&&(w=1),l=0;l<w;l++)!n.isPlainObject(r)&&l>0&&++e,y=t.isNullOrUndefined(o.groups[e].id)?t.isNullOrUndefined(o.groups[e].text)?o.groups[e].text:o.groups[e].text.replace(/\s/g,""):o.groups[e].id.replace(/\s/g,""),b=this._createControls(e,o,y,i),p=this._addControlsToGroup(e,o,y,b),n(s).children().eq(e).length>0?n(s).children().eq(e).before(p):n(s).append(p);n(s).hasClass("e-empty-content")&&n(s).removeClass("e-empty-content")}n(s).hasClass("e-parentdiv")||n(s).addClass("e-parentdiv");this._setTabContentHeight()},addTabGroupContent:function(i,r,u,f,e){var l,p=0,s,w,v,y,b,c,k,a,d,g,nt=!1,tt,it,rt,o,ut,h,ft;if(w=this._tabUl.find(".e-select,.e-active").eq(i),l=w.children("a").attr("href"),t.isNullOrUndefined(f)&&(f=0),t.isNullOrUndefined(e)&&(e=0),w.hasClass("e-tab"))for(it=this.model.tabs.length,o=0;o<it;o++)o===i-1&&(t.isNullOrUndefined(this.model.tabs[o].groups[r].content)||(g=this.model.tabs[o].groups[r].alignType,f!=0&&t.isNullOrUndefined(this.model.tabs[o].groups[r].content[f-1])||(t.isNullOrUndefined(this.model.tabs[o].groups[r].content[f])?(this.model.tabs[o].groups[r].content[f]=u,nt=!0):this.model.tabs[o].groups[r].content[f].groups.splice(e,0,u),s=this.model.tabs[o])));else for(p=this.model.tabs.length,rt=this.model.contextualTabs.length,o=0;o<rt;o++)for(ut=this.model.contextualTabs[o].tabs.length,h=0;h<ut;h++)++p,p===i&&(t.isNullOrUndefined(this.model.contextualTabs[o].tabs[h].groups[r].content)||(g=this.model.contextualTabs[o].tabs[h].groups[r].alignType,t.isNullOrUndefined(f)&&(f=this.model.contextualTabs[o].tabs[h].groups[r].content[0].groups.length),f!=0&&t.isNullOrUndefined(this.model.contextualTabs[o].tabs[h].groups[r].content[f-1])||(t.isNullOrUndefined(this.model.contextualTabs[o].tabs[h].groups[r].content[f])?(this.model.contextualTabs[o].tabs[h].groups[r].content[f]=u,nt=!0):this.model.contextualTabs[o].tabs[h].groups[r].content[f].groups.splice(e,0,u),s=this.model.contextualTabs[o].tabs[h])));t.isNullOrUndefined(s)||t.isNullOrUndefined(s.groups[r])||this.element.find(".e-content.e-content-item").eq(i).hasClass("e-rbn-ondemand")||(v=t.isNullOrUndefined(s.groups[r].id)?t.isNullOrUndefined(s.groups[r].text)?s.groups[r].text:s.groups[r].text.replace(/\s/g,""):s.groups[r].id.replace(/\s/g,""),y=this._createControls(r,s,v,i),a=t.buildTag("div"),tt=y.find(".e-innerdiv,.e-innerdivrow").eq(f).find(".e-controlpadding"),b=nt?tt:tt.eq(e),k=y.find("#"+b.attr("id")).next(),k.hasClass("e-separatordivrow")&&a.append(k),a.prepend(b),c=n(l).children().eq(r).find(".e-innerdiv,.e-innerdivrow").eq(f),!c.length>0&&(ft=g==t.Ribbon.alignType.columns?t.buildTag("div#"+this._id+"_"+s.id+"_"+v+"_"+(f+1)).addClass("e-innerdiv"):t.buildTag("div#"+this._id+"_"+s.id+"_"+v+"_"+(f+1)).addClass("e-innerdivrow"),n(l).children().eq(r).find(".e-ribGroupContent").append(ft),c=n(l).children().eq(r).find(".e-innerdiv,.e-innerdivrow").eq(f)),d=n(c).parent().height(),c.find(".e-controlpadding").eq(e).length>0?c.find(".e-controlpadding").eq(e).before(a.children()):c.append(a.children()),n(c).parent().height()>d&&this.element.find(".e-content").height(this.element.find(".e-content").height()+(n(c).parent().height()-d)),y.children().remove(),n(l).hasClass("e-empty-content")&&n(l).removeClass("e-empty-content"),this._setTabContentHeight())},removeTabGroupContent:function(i,r,u,f){var nt,p,c,w,s,a,y,e,b,k,o,d,v,g,h,l;if(nt=n(n(".e-ribbon .e-content")[i]).find(".e-groupdiv"),p=this._tabUl.find(".e-select,.e-active").eq(i),a=p.children("a").attr("href"),n(p).hasClass("e-tab")){for(c=this.model.tabs[i-1].groups,b=c.length,o=0;o<b;o++)if(c[o].text==r)if(t.isNullOrUndefined(u)){if(c[o].type===t.Ribbon.type.custom&&c[o].text==r&&t.isNullOrUndefined(c[o].content))e=n(a).find(".e-groupdiv").eq(o).find(".e-ribGroupContent"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent")),e.children().remove(),c[o].contentID=null;else if(c[o].text==r&&t.isNullOrUndefined(u)){if(s=c[o].content,!t.isNullOrUndefined(s))for(conlen=c[o].content.length,l=0;l<conlen;l++)s[l].groups.splice(0,s[l].groups.length);e=n(a).find(".e-groupdiv").eq(o).find(".e-ribGroupContent");this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent"));e.children().remove()}}else if(t.isNullOrUndefined(f)||t.isNullOrUndefined(c[o].content[u].groups))s=c[o].content[u],e=n(a).children(".e-groupdiv").eq(o).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),e.eq(u).children().remove(),s.groups.splice(0,s.groups.length);else{for(s=c[o].content[u].groups,e=n(a).children(".e-groupdiv").eq(o).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),y=e.eq(u),v=0;v<y.children().length;v++)s.splice(v,1);y.children().eq(f).remove();e.children().length==0&&e.remove()}}else for(w=this.model.tabs.length,k=this.model.contextualTabs.length,o=0;o<k;o++)for(d=this.model.contextualTabs[o].tabs.length,v=0;v<d;v++)if(++w,w===i)for(s=this.model.contextualTabs[o].tabs[v].groups,g=s.length,h=0;h<g;h++)if(s[h].text==r)if(t.isNullOrUndefined(u)){if(s[h].type===t.Ribbon.type.custom&&s[h].text==r&&t.isNullOrUndefined(s[h].content))e=n(a).find(".e-groupdiv").eq(h).find(".e-ribGroupContent"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent")),e.children().remove(),s[h].contentID=null;else if(t.isNullOrUndefined(u)){if(contTabGrp=s[h].content,!t.isNullOrUndefined(contTabGrp))for(conlen=s[h].content.length,l=0;l<conlen;l++)contTabGrp[l].groups.splice(0,contTabGrp[l].groups.length);e=n(a).find(".e-groupdiv").eq(h).find(".e-ribGroupContent");this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent"));e.children().remove()}}else if(t.isNullOrUndefined(f)||t.isNullOrUndefined(s[h].content[u].groups))contTabGrp=s[h].content[u],e=n(a).children(".e-groupdiv").eq(h).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),e.eq(u).children().remove(),contTabGrp.groups.splice(0,contTabGrp.groups.length);else{for(contTabGrp=s[h].content[u].groups,e=n(a).children(".e-groupdiv").eq(h).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),y=e.eq(u),m=0;m<y.children().length;m++)contTabGrp.splice(m,1);y.children().eq(f).remove();e.children().length==0&&e.remove()}},addTab:function(r,u,f){var s={id:r.replace(/\s/g,""),text:r,groups:u},p=this.model.tabs.length,h,e,c,l,o;if(t.isNullOrUndefined(f)&&(f=this._tabUl.find(".e-select,.e-active").length),f>0){for(this._conTabsRemove(),this._tabObj.addItem("#"+this._id+"_"+r.replace(/\s/g,""),r,f),this._tabUl.find(".e-ribresmenu").nextAll("li.e-select").length>0&&(l=this._tabUl.find(".e-select,.e-active").not(".e-apptab,.e-tab"),l.insertBefore(this._tabUl.find(".e-ribresmenu"))),this._contextualTabs(),this._tabUl.find(".e-select,.e-active").eq(f).addClass("e-tab"),this._tabUl.find(".e-select > a,.e-active > a ").eq(f).addClass("e-link"),t.isNullOrUndefined(this.model.tabs[0].id)?(this.model.tabs[0]=s,this._tabObj.showItem(1)):this.model.tabs.splice(f-1,0,s),i=0;i<1;i++)for(tabs=this.model.tabs[f-1],o=tabs.groups.length,o==0&&this.element.find("#"+this._id+"_"+tabs.id).addClass("e-empty-content"),j=0;j<o;j++)if(!t.isNullOrUndefined(tabs.groups[j])){var a=t.isNullOrUndefined(tabs.groups[j].id)?t.isNullOrUndefined(tabs.groups[j].text)?tabs.groups[j].text:tabs.groups[j].text.replace(/\s/g,""):tabs.groups[j].id.replace(/\s/g,""),v=this._createControls(j,tabs,a,f),y=this._addControlsToGroup(j,tabs,a,v);e=this.element.find("#"+this._id+"_"+tabs.id);e.append(y).addClass("e-parentdiv")}this._setTabContentHeight();this.element.find(".e-content.e-content-item").css("box-sizing","content-box");this._ribbonTabs=this._tabUl.find(".e-link").parent();this._tabContents=this.element.children().attr("role","tabpanel").not(".e-header,.e-disable,.e-resizediv,.e-tooltipdiv,.e-ribbonbackstagepage");this._applicationTab.click(n.proxy(this._onApplicationTabClick,this));h=this._tabUl.find(".e-select,.e-active").eq(f);c={tabHeader:h,tabContent:e};this._trigger("tabAdd",c)}this._tabText=this.element.find(".e-link");this._applicationTab.hasClass("e-active")&&this._applicationTab.removeClass("e-active");n(e).hasClass("e-parentdiv")||n(e).addClass("e-parentdiv")},addContextualTabs:function(i,r){var l,f,u,e,o,s,h;if(this._tabUl.find(".e-tab").length<r&&(l=this.model.contextualTabs.length,t.isNullOrUndefined(r)&&(r=this._tabUl.find(".e-select,.e-active").length),r>0)){for(this._conTabsRemove(),f=i.tabs.length,u=0;u<f;u++)t.isNullOrUndefined(this._mobileContents[r-1])?(this._mobileContents[r-1]={tab:i.tabs[u].text,mobileContent:[]},this._mobileToolbar[r-1]={tab:i.tabs[u].text,Content:[]}):(this._mobileContents.splice(r-1,0,{tab:i.tabs[u].text,mobileContent:[]}),this._mobileToolbar.splice(r-1,0,{tab:i.tabs[u].text,Content:[]})),this._tabObj.addItem("#"+this._id+"_"+i.tabs[u].id,i.tabs[u].text,r),e=t.buildTag("li",i.tabs[u].text).addClass("e-responsivetabli e-resContextual"),o=n.isEmptyObject(this.model.applicationTab.menuSettings)&&t.isNullOrUndefined(this.model.applicationTab.menuItemID)&&t.isNullOrUndefined(this.model.applicationTab.backstageSettings.pages[0].id),e.insertBefore(this.element.find(".e-rescontent").children(".e-responsivetabli ").eq(r-(o?0:1))),this._responsiveTabText=this.element.find(".e-responsivetabheader li"),this._tabUl.find(".e-ribresmenu").nextAll("li.e-select").length>0&&(s=this._tabUl.find(".e-select,.e-active").not(".e-apptab,.e-tab"),s.insertBefore(this._tabUl.find(".e-ribresmenu"))),this._tabUl.find(".e-select,.e-active").eq(r).addClass("e-contextualtabset"),this._tabUl.find(".e-select > a ,.e-active > a ").eq(r).addClass("e-link"),++r;for(this.model.contextualTabs[0].tabs.length>0?this.model.contextualTabs.splice(r-1,0,i):this.model.contextualTabs[0]=i,this._contextualTabs(),f=i.tabs.length,u=0;u<f;u++)for(tabs=i.tabs[u],h=tabs.groups.length,j=0;j<h;j++)if(!t.isNullOrUndefined(tabs.groups[j])){var c=t.isNullOrUndefined(tabs.groups[j].id)?t.isNullOrUndefined(tabs.groups[j].text)?tabs.groups[j].text:tabs.groups[j].text.replace(/\s/g,""):tabs.groups[j].id.replace(/\s/g,""),a=this._createControls(j,tabs,c),v=this._addControlsToGroup(j,tabs,c,a);tabcont=this.element.find("#"+this._id+"_"+tabs.id);tabcont.append(v).addClass("e-parentdiv")}this._setTabContentHeight();this.element.find(".e-content.e-content-item").css("box-sizing","content-box");this._ribbonTabs=this._tabUl.find(".e-link").parent();this._tabContents=this.element.children().attr("role","tabpanel").not(".e-header,.e-disable,.e-resizediv,.e-tooltipdiv,.e-ribbonbackstagepage");this._applicationTab.click(n.proxy(this._onApplicationTabClick,this))}},setTabText:function(t,i){this._tabText.filter(function(){return n(this).text()===t}).text(i);this._phoneMode&&(this._responsiveTabText.filter(function(){return n(this).text()===t}).text(i),this.element.find(".e-ribresmenu .e-reslink").text(this._responsiveTabText.filter(".e-resactive").text()))},getTabText:function(n){return this._tabText.eq(n).text()},updateGroup:function(i,r,u){var nt,e,y,p,c,l,a,g,w,b,k,v,d,f,s,h,o;if(nt=this._tabUl.find(".e-select,.e-active").eq(i),n(nt).hasClass("e-tab")){for(e=this.model.tabs[i-1].groups,w=e.length,f=0;f<w;f++)if(!t.isNullOrUndefined(e[f].content))for(b=e[f].content.length,s=0;s<b;s++)for(k=e[f].content[s].groups.length,h=0;h<k;h++)e[f].content[s].groups[h].id==r&&(o=e[f].content[s].groups[h],t.isNullOrUndefined(u.buttonSettings)||(n.extend(o.buttonSettings,u.buttonSettings),n(u).removeProp("buttonSettings")),t.isNullOrUndefined(u.dropdownSettings)||(n.extend(o.dropdownSettings,u.dropdownSettings),n(u).removeProp("dropdownSettings")),t.isNullOrUndefined(u.toggleButtonSettings)||(n.extend(o.toggleButtonSettings,u.toggleButtonSettings),n(u).removeProp("toggleButtonSettings")),t.isNullOrUndefined(u.splitButtonSettings)||(n.extend(o.splitButtonSettings,u.splitButtonSettings),n(u).removeProp("splitButtonSettings")),t.isNullOrUndefined(u.customToolTip)||(n.extend(o.customToolTip,u.customToolTip),n(u).removeProp("customToolTip")),n.extend(o,u),l=t.isNullOrUndefined(e[f].id)?t.isNullOrUndefined(e[f].text)?e[f].text:e[f].text.replace(/\s/g,""):e[f].id.replace(/\s/g,""),c=this.model.tabs[i-1],p=this._createControls(f,c,l,i),a="#"+this._id+"_"+c.id+"_"+l+"_"+r,y=this.element.find(a),groupDiv=p.find(a),y.replaceWith(groupDiv))}else for(g=this.model.tabs.length,v=0;v<this.model.contextualTabs.length;v++)for(d=0;d<this.model.contextualTabs[v].tabs.length;d++)if(++g,g===i)for(e=this.model.contextualTabs[v].tabs[d].groups,w=e.length,f=0;f<w;f++)if(!t.isNullOrUndefined(e[f].content))for(b=e[f].content.length,s=0;s<b;s++)for(k=e[f].content[s].groups.length,h=0;h<k;h++)e[f].content[s].groups[h].id==r&&(o=e[f].content[s].groups[h],t.isNullOrUndefined(u.buttonSettings)||(n.extend(o.buttonSettings,u.buttonSettings),n(u).removeProp("buttonSettings")),t.isNullOrUndefined(u.dropdownSettings)||(n.extend(o.dropdownSettings,u.dropdownSettings),n(u).removeProp("dropdownSettings")),t.isNullOrUndefined(u.toggleButtonSettings)||(n.extend(o.toggleButtonSettings,u.toggleButtonSettings),n(u).removeProp("toggleButtonSettings")),t.isNullOrUndefined(u.splitButtonSettings)||(n.extend(o.splitButtonSettings,u.splitButtonSettings),n(u).removeProp("splitButtonSettings")),t.isNullOrUndefined(u.customToolTip)||(n.extend(o.customToolTip,u.customToolTip),n(u).removeProp("customToolTip")),n.extend(o,u),l=t.isNullOrUndefined(e[f].id)?t.isNullOrUndefined(e[f].text)?e[f].text:e[f].text.replace(/\s/g,""):e[f].id.replace(/\s/g,""),c=this.model.contextualTabs[0].tabs[0],p=this._createControls(f,c,l,i),a="#"+this._id+"_"+c.id+"_"+l+"_"+r,y=this.element.find(a),groupDiv=p.find(a),y.replaceWith(groupDiv))},isVisible:function(t){var i=this._tabText.filter(function(){return n(this).text()===t}).parent();return i.is(":visible")},isEnable:function(t){for(var r=!0,u=this._tabText.filter(function(){return n(this).text()===t}).parent().index(),f=this.model.disabledItemIndex.length,i=0;i<f;i++)this.model.disabledItemIndex[i]==u&&(r=!1);return r},_renderTab:function(){var r=t.buildTag("ul"),u,f,c=this.model.applicationTab.type,s,h,i,e,o=this.model.tabs,l=o.length,a,v;if(c!=null&&(f=t.buildTag("a","",{},{href:"#"+this._id+"_"+c.replace(/\s/g,"")})),u=t.buildTag("li.e-apptab",f),r.append(u),l>=1&&!t.isNullOrUndefined(o[0].id)&&!t.isNullOrUndefined(o[0].text))for(i=0;i<l;i++)s=o[i],f=t.buildTag("a",s.text,{},{href:"#"+this._id+"_"+s.id}),u=t.buildTag("li",f).addClass("e-tab"),r.append(u);if(this.model.contextualTabs)for(a=this.model.contextualTabs.length,i=0;i<a;i++)if(this.model.contextualTabs[i].tabs)for(v=this.model.contextualTabs[i].tabs.length,e=0;e<v;e++)h=this.model.contextualTabs[i].tabs[e],f=t.buildTag("a",h.text,{},{href:"#"+this._id+"_"+h.id}),u=t.buildTag("li",f).addClass("e-contextualtabset").css("border-bottom-color",this.model.contextualTabs[i].backgroundColor),r.append(u);r.append(t.buildTag("li.e-ribresmenu").append(t.buildTag("span.e-icon").addClass("e-ribdownarrow")).prepend(t.buildTag("a#"+this._id+"_responsivelink").addClass("e-reslink")).click(n.proxy(this._onResponsiveHeaderClick,this)));this.model.showQAT&&r.append(t.buildTag("li#"+this._id+"_responsiveqat").addClass("e-responsiveqat").click(n.proxy(this._onQatClick,this)));this.element.append(r);this.element.ejTab({width:this.model.width,allowKeyboardNavigation:!1,disabledItemIndex:this.model.disabledItemIndex,enabledItemIndex:this.model.enabledItemIndex,enableTabScroll:!1,itemActive:n.proxy(this._onTabSelect,this),beforeActive:n.proxy(this._onTabClick,this),create:n.proxy(this._create,this),selectedItemIndex:this.model.selectedItemIndex,enableRTL:this.model.enableRTL})},_createControls:function(i,u,f,e){var d,vt,y,ot,o={},a,h,w,nt,v,tt,ni,ti,c,g,l,st,ht,ut,ft,bt,k,it,b,yt,ui,fi,ei,kt,pt,ct,s,et,dt,rt,lt,wt,ri,p,at;if(f=t.isNullOrUndefined(f)?f:f.replace(/\&/g,""),ot=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_content").addClass("e-ribGroupContent"),u.groups[i].type==="custom")u.groups[i].contentID?(vt=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+u.groups[i].type).addClass("e-innerdiv"),n("#"+u.groups[i].contentID).addClass("e-rbncustomelement").appendTo(vt).show()):vt=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+u.groups[i].type,u.groups[i].customContent).addClass("e-innerdiv"),i===0&&ot.append(t.buildTag("div.e-ribupdivarrow").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))).addClass("e-resgroupheader"),ot.append(vt);else if(u.groups[i].content)for(i===0&&ot.append(t.buildTag("div.e-ribupdivarrow").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))).addClass("e-resgroupheader"),ni=u.groups[i].content.length,p=0;p<ni;p++)if(u.groups[i].content[p]!=r)for(c=u.groups[i].content[p].groups,g=u.groups[i].content[p].defaults,u.groups[i].content.length==1&&(centerAlign=!0),t.isNullOrUndefined(u.groups[i].alignType)&&(u.groups[i].alignType=t.Ribbon.AlignType.Rows),u.groups[i].alignType===t.Ribbon.AlignType.Columns?d=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+(p+1)).addClass("e-innerdiv"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(d=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+(p+1)).addClass("e-innerdivrow"),++s),ti=c.length,s=0;s<ti;s++)if(!t.isNullOrUndefined(c[s])){t.isNullOrUndefined(g)||t.isNullOrUndefined(g.type)||(c[s].type=g.type);t.isNullOrUndefined(c[s].type)&&(c[s].type=t.Ribbon.Type.Button);t.isNullOrUndefined(c[s].isBig)&&!t.isNullOrUndefined(g)&&(c[s].isBig=g.isBig);l=this.model.buttonDefaults;t.isNullOrUndefined(c[s].height)&&(t.isNullOrUndefined(c[s].buttonSettings)||t.isNullOrUndefined(c[s].buttonSettings.height)?t.isNullOrUndefined(g)||t.isNullOrUndefined(g.height)?t.isNullOrUndefined(l)||t.isNullOrUndefined(l.height)||(st=l.height):st=g.height:st=c[s].buttonSettings.height,c[s].height=st,st=null);t.isNullOrUndefined(c[s].width)&&(t.isNullOrUndefined(c[s].buttonSettings)||t.isNullOrUndefined(c[s].buttonSettings.width)?t.isNullOrUndefined(g)||t.isNullOrUndefined(g.width)?t.isNullOrUndefined(l)||t.isNullOrUndefined(l.width)||(ht=l.width):ht=g.width:ht=c[s].buttonSettings.width,c[s].width=ht,ht=null);t.isNullOrUndefined(c[s].buttonSettings)||(ut=c[s].buttonSettings,!t.isNullOrUndefined(ut.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(ut.enabled=l.enabled),!t.isNullOrUndefined(ut.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(ut.enableRTL=l.enableRTL),!t.isNullOrUndefined(ut.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(ut.cssClass=l.cssClass),!t.isNullOrUndefined(ut.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(ut.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].splitButtonSettings)||(ft=c[s].splitButtonSettings,!t.isNullOrUndefined(ft.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(ft.enabled=l.enabled),!t.isNullOrUndefined(ft.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(ft.enableRTL=l.enableRTL),!t.isNullOrUndefined(ft.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(ft.cssClass=l.cssClass),!t.isNullOrUndefined(ft.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(ft.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].dropdownSettings)||(!t.isNullOrUndefined(c[s].dropdownSettings.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(c[s].dropdownSettings.enabled=l.enabled),!t.isNullOrUndefined(c[s].dropdownSettings.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(c[s].dropdownSettings.enableRTL=l.enableRTL),!t.isNullOrUndefined(c[s].dropdownSettings.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(c[s].dropdownSettings.cssClass=l.cssClass),!t.isNullOrUndefined(c[s].dropdownSettings.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(c[s].dropdownSettings.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].toggleButtonSettings)||(!t.isNullOrUndefined(c[s].toggleButtonSettings.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(c[s].toggleButtonSettings.enabled=l.enabled),!t.isNullOrUndefined(c[s].toggleButtonSettings.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(c[s].toggleButtonSettings.enableRTL=l.enableRTL),!t.isNullOrUndefined(c[s].toggleButtonSettings.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(c[s].toggleButtonSettings.cssClass=l.cssClass),!t.isNullOrUndefined(c[s].toggleButtonSettings.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(c[s].toggleButtonSettings.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].quickAccessMode)&&(c[s].quickAccessMode="none");switch(c[s].type){case t.Ribbon.Type.Custom:nt=c[s];u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+nt.contentID).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+nt.contentID).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(nt.customToolTip)?t.isNullOrUndefined(nt.toolTip)||y.attr("title",nt.toolTip):y.mouseover({value:nt,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));n("#"+nt.contentID).addClass("e-rbncustomelement").appendTo(y);t.isNullOrUndefined(c[s])||(t.isNullOrUndefined(c[s].height)||y.children().height(c[s].height),t.isNullOrUndefined(c[s].width)||y.children().width(c[s].width));t.isNullOrUndefined(nt.isBig)||(nt.isBig?y.children().addClass("e-big"):y.children().addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+nt.toolTip).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.SplitButton:a=c[s];this._splitButtonControl=t.buildTag("button#"+this._id+"_"+a.id,a.text,{},{type:"button"}).addClass(a.cssClass);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+a.id,this._splitButtonControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+a.id,this._splitButtonControl).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(a.customToolTip)?t.isNullOrUndefined(a.toolTip)||y.attr("title",a.toolTip):y.mouseover({value:a,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));o={};a.splitButtonSettings&&(o=a.splitButtonSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;o.cssClass=o.cssClass?o.cssClass.concat(" e-rbn-splitbtn e-rbn-button"):"e-rbn-splitbtn e-rbn-button";o.enableRTL=this.model.enableRTL;this._splitButtonControl.ejSplitButton(o);y.find(".e-split").addClass("e-rbn-split");a.isMobileOnly&&(this._mobileSplitButton=t.buildTag("button#"+this._id+"_"+a.id+"_mobEle",a.text,{},{type:"button"}).addClass(a.cssClass),it=t.buildTag("div#"+this._id+"_"+a.id+"_mobDiv",this._mobileSplitButton).addClass("e-mobdiv"),o.height=a.splitButtonSettings.height,o.width=a.splitButtonSettings.width,o.arrowPosition=t.ArrowPosition.Right,o.imagePosition=a.splitButtonSettings.imagePosition,o.contentType=a.splitButtonSettings.contentType,this._mobileSplitButton.ejSplitButton(o),it.find("button").addClass("e-rbn-button"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(a.text)?t.isNullOrUndefined(a.splitButtonSettings.text)||(b=a.splitButtonSettings.text):b=a.text,this._mobileContents[e].mobileContent.push({id:a.id,text:b,isMobileOnly:a.isMobileOnly}));a.quickAccessMode!="none"&&this.model.showQAT&&!this.model.enableOnDemand&&(this._splitButtonQAT=t.buildTag("button#"+this._id+"_"+a.id+"_qatEle",a.text,{},{type:"button"}).addClass(a.cssClass),k=t.buildTag("div#"+this._id+"_"+a.id+"_qatDiv",this._splitButtonQAT).addClass("e-qatooldiv"),o.height=30,o.arrowPosition=t.ArrowPosition.Right,o.contentType=t.ContentType.ImageOnly,n.isEmptyObject(a.customToolTip)?t.isNullOrUndefined(a.toolTip)||k.attr("title",a.toolTip):k.mouseover({value:a,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._splitButtonQAT.ejSplitButton(o),k.find("button").addClass("e-rbn-button"),k.appendTo(this._qAccessBar),a.quickAccessMode=="menu"&&k.hide(),t.isNullOrUndefined(a.text)?t.isNullOrUndefined(a.splitButtonSettings.text)||(b=a.splitButtonSettings.text):b=a.text,this._qatControlsName.push({id:a.id,text:b,qAccess:a.quickAccessMode}));t.isNullOrUndefined(a.isBig)||(a.isBig?y.children().prop("style",!1).addClass("e-big"):y.children().prop("style",!1).addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+a.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.ToggleButton:v=c[s];this._toggleButtonControl=t.buildTag("input#"+this._id+"_"+v.id,"","",{type:"checkbox"}).addClass(v.cssClass);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+v.id,this._toggleButtonControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+v.id,this._toggleButtonControl).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(v.customToolTip)?t.isNullOrUndefined(v.toolTip)||y.attr("title",v.toolTip):y.mouseover({value:v,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));o={};v.toggleButtonSettings&&(o=v.toggleButtonSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;bt=n("#"+this._toggleButtonControl.attr("id")+"_qatDiv button.e-togglebutton");this.model.enableOnDemand&&this.model.showQAT&&bt.is(":visible")&&bt.hasClass("e-active")&&(o.toggleState=!0);this._toggleButtonControl.ejToggleButton(o).addClass("e-ribbonbtn e-rbn-button");y.find("button").addClass("e-rbn-button");v.isMobileOnly&&(this._mobileToggleButton=t.buildTag("button#"+this._id+"_"+v.id+"_mobEle","","",{type:"checkbox"}).addClass(v.cssClass),it=t.buildTag("div#"+this._id+"_"+v.id+"_mobDiv",this._mobileToggleButton).addClass("e-mobdiv"),o.height=v.toggleButtonSettings.height,o.width=v.toggleButtonSettings.width,o.contentType=v.toggleButtonSettings.contentType,o.imagePosition=v.toggleButtonSettings.imagePosition,this._mobileToggleButton.ejToggleButton(o).addClass("e-ribbonbtn"),it.find("button").addClass("e-rbn-button"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(v.text)?t.isNullOrUndefined(v.toggleButtonSettings.defaultText)||(b=v.toggleButtonSettings.defaultText):b=v.text,this._mobileContents[e].mobileContent.push({id:v.id,text:b,isMobileOnly:v.isMobileOnly}));v.quickAccessMode!="none"&&this.model.showQAT&&!this.model.enableOnDemand&&(this._toggleButtonQAT=t.buildTag("input#"+this._id+"_"+v.id+"_qatEle","","",{type:"checkbox"}).addClass(v.cssClass),k=t.buildTag("div#"+this._id+"_"+v.id+"_qatDiv",this._toggleButtonQAT).addClass("e-qatooldiv"),o.height=30,o.contentType=t.ContentType.ImageOnly,n.isEmptyObject(v.customToolTip)?t.isNullOrUndefined(v.toolTip)||k.attr("title",v.toolTip):k.mouseover({value:v,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._toggleButtonQAT.ejToggleButton(o).addClass("e-ribbonbtn"),k.find("button").addClass("e-rbn-button"),k.appendTo(this._qAccessBar),v.quickAccessMode=="menu"&&k.hide(),t.isNullOrUndefined(v.text)?t.isNullOrUndefined(v.toggleButtonSettings.defaultText)||(b=v.toggleButtonSettings.defaultText):b=v.text,this._qatControlsName.push({id:v.id,text:b,qAccess:v.quickAccessMode}));t.isNullOrUndefined(v.isBig)||(v.isBig?y.find(".e-togglebutton.e-tbtn.e-btn").addClass("e-big"):y.find(".e-togglebutton.e-tbtn.e-btn").addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+v.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.Button:h=c[s];this._buttonControl=h.buttonSettings?h.buttonSettings.type?t.buildTag("button#"+this._id+"_"+h.id,h.text,{},{type:h.buttonSettings.type}).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id,h.text).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id,h.text).addClass(h.cssClass);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+h.id,this._buttonControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+h.id,this._buttonControl).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(h.customToolTip)?t.isNullOrUndefined(h.toolTip)||y.attr("title",h.toolTip):y.mouseover({value:h,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));o={};h.buttonSettings&&(o=h.buttonSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;this._buttonControl.ejButton(o).addClass("e-ribbonbtn e-rbn-button");h.isMobileOnly&&(this._mobileButton=h.buttonSettings?h.buttonSettings.type?t.buildTag("button#"+this._id+"_"+h.id+"_mobEle",h.text,{},{type:h.buttonSettings.type}).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_mobEle",h.text).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_mobEle",h.text).addClass(h.cssClass),it=t.buildTag("div#"+this._id+"_"+h.id+"_mobDiv",this._mobileButton).addClass("e-mobdiv"),this._mobileButton.ejButton(o).addClass("e-ribbon-resbtn e-rbn-button"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(h.text)?t.isNullOrUndefined(h.buttonSettings.text)||(b=h.buttonSettings.text):b=h.text,this._mobileContents[e].mobileContent.push({id:h.id,text:b,isMobileOnly:h.isMobileOnly}));h.quickAccessMode!="none"&&this.model.showQAT&&!this.model.enableOnDemand&&(this._buttonQAT=h.buttonSettings?h.buttonSettings.type?t.buildTag("button#"+this._id+"_"+h.id+"_qatEle",h.text,{},{type:h.buttonSettings.type}).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_qatEle",h.text).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_qatEle",h.text).addClass(h.cssClass),k=t.buildTag("div#"+this._id+"_"+h.id+"_qatDiv",this._buttonQAT).addClass("e-qatooldiv"),o.height=30,o.contentType=t.ContentType.ImageOnly,n.isEmptyObject(h.customToolTip)?t.isNullOrUndefined(h.toolTip)||k.attr("title",h.toolTip):k.mouseover({value:h,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._buttonQAT.ejButton(o).addClass("e-ribbonbtn e-rbn-button"),k.appendTo(this._qAccessBar),h.quickAccessMode=="menu"&&k.hide(),t.isNullOrUndefined(h.text)?t.isNullOrUndefined(h.buttonSettings.text)||(b=h.buttonSettings.text):b=h.text,this._qatControlsName.push({id:h.id,text:b,qAccess:h.quickAccessMode}));t.isNullOrUndefined(h.isBig)||(h.isBig?y.children().addClass("e-big"):y.children().addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+h.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.DropDownList:w=c[s];this._dropdownControl=t.buildTag("input#"+this._id+"_"+w.id,{type:"text"}).addClass(w.cssClass);w.dropdownSettings&&(u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+w.id,this._dropdownControl).append(n("#"+w.dropdownSettings.targetID)).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+w.id,this._dropdownControl).append(n("#"+w.dropdownSettings.targetID)).addClass("e-innerdivchild e-controlpadding")),n.isEmptyObject(w.customToolTip)?t.isNullOrUndefined(w.toolTip)||y.attr("title",w.toolTip):y.mouseover({value:w,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)));o={};w.dropdownSettings&&(o=w.dropdownSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;o.cssClass=o.cssClass?o.cssClass.concat(" e-rbn-ddl"):"e-rbn-ddl";w.isMobileOnly&&(this._mobileDropdown=t.buildTag("input#"+this._id+"_"+w.id+"_mobEle","","",{type:"text"}).addClass(w.cssClass),it=t.buildTag("div#"+this._id+"_"+w.id+"_mobDiv",this._mobileDropdown).addClass("e-mobdiv"),this._mobileDropdown.ejDropDownList(o).addClass("e-ribbonbtn"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(w.text)?t.isNullOrUndefined(w.dropdownSettings.defaultText)||(b=w.dropdownSettings.defaultText):b=w.text,this._mobileContents[e].mobileContent.push({id:w.id,text:b,isMobileOnly:w.isMobileOnly}));o.enableRTL=this.model.enableRTL;this._dropdownControl.ejDropDownList(o);d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+w.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.Gallery:for(gallery=c[s],this._galleryControl=t.buildTag("div#"+this._id+"_"+gallery.id+"_gallerycontrol").addClass("e-ribbongallerycontrol"),this._gallery=t.buildTag("div#"+this._id+"_"+gallery.id).addClass("e-ribbongallery"),ct=t.buildTag("div#"+this._id+"_"+gallery.id+"_ContentDiv").addClass("e-gallerycontent").height(65).width(gallery.columns*gallery.itemWidth).click({galleryId:this._gallery.attr("id")},n.proxy(this._onGalContentClick,this)),pt=Math.floor(gallery.galleryItems.length/gallery.columns),gallery.galleryItems.length%gallery.columns>0&&++pt,s=1;s<=pt;s++){for(et=t.buildTag("div#"+this._id+"_"+gallery.id+"_galleryrow_"+s).addClass("e-galleryrow").click({model:gallery},n.proxy(this._onGalleryItemClick,this)),s===1?et.addClass("e-gryfirstrow"):s===pt&&et.addClass("e-grylastrow"),dt=1;dt<=gallery.columns;dt++)rt=ct.find(".e-galleryrow").children().length+et.children().length,t.isNullOrUndefined(gallery.galleryItems[rt])||(lt=t.buildTag("button#"+gallery.id+"_galleryItem_"+(rt+1),gallery.galleryItems[rt].text,{},{type:"button"}).addClass("e-gallerybtn e-rbn-button"),n.isEmptyObject(gallery.galleryItems[rt].customToolTip)?t.isNullOrUndefined(gallery.galleryItems[rt].toolTip)||lt.attr("title",gallery.galleryItems[rt].toolTip):lt.mouseover({value:gallery.galleryItems[rt],ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),o={},gallery.galleryItems[rt].buttonSettings&&(o=gallery.galleryItems[rt].buttonSettings),o.height=gallery.itemHeight<=65?gallery.itemHeight:65,o.width=gallery.itemWidth,lt.ejButton(o),lt.appendTo(et));kt=gallery.itemHeight>65?1:ct.height()/gallery.itemHeight;s>kt&&et.hide();et.appendTo(ct)}this._gallery.append(ct);var yt=t.buildTag("div#"+this._id+"_"+gallery.id+"_PagesDiv").addClass("e-gallerymovediv"),ui=t.buildTag("div#"+this._id+"_"+gallery.id+"_prevPage","<span class='e-icon e-galleryup e-gallerymoveicon'><\/span>").click({galleryId:this._gallery.attr("id"),rowCnt:kt},n.proxy(this._onGalMoveUpClick,this)).addClass("e-moveupdiv e-disablegrymovebtn"),fi=t.buildTag("div#"+this._id+"_"+gallery.id+"_nextPage","<span class='e-icon e-gallerydown e-gallerymoveicon'><\/span>").click({galleryId:this._gallery.attr("id")},n.proxy(this._onGalMoveDownClick,this)).addClass("e-movedowndiv"),ei=t.buildTag("div#"+this._id+"_"+gallery.id+"_expandGallery","<span class='e-icon e-galleryexpand e-gallerymoveicon'><\/span>").click({galleryId:this._gallery.attr("id"),columns:gallery.columns,expandedColumns:gallery.expandedColumns,itemWidth:gallery.itemWidth},n.proxy(this._onExpandGalleryClick,this)).addClass("e-expgallerydiv");this._responsiveGallery=gallery.expandedColumns;yt.append(ui);yt.append(fi);yt.append(ei);this._gallery.append(yt);var gt=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExpandContent").addClass("e-gallexpandcontent").hide(),ii=t.buildTag("div#"+this._id+"_"+gallery.id+"_scrollContent","<div><\/div>").addClass("e-gallscrollcontent"),oi=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExpanderContent").addClass("e-expandercontent").click({galleryId:this._gallery.attr("id")},n.proxy(this._onExpandContentClick,this));if(ii.children().append(oi),gt.append(ii),!t.isNullOrUndefined(gallery.customGalleryItems)){for(wt=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExtraContent").addClass("e-extracontent").click({model:gallery},n.proxy(this._onGalleryItemClick,this)),ri=gallery.customGalleryItems.length,p=0;p<ri;p++)t.isNullOrUndefined(gallery.customGalleryItems[p].customItemType)&&(gallery.customGalleryItems[p].customItemType=t.Ribbon.CustomItemType.Button),gallery.customGalleryItems[p].customItemType===t.Ribbon.CustomItemType.Button?(at=t.buildTag("button#"+gallery.id+"__extraItem_"+p,gallery.customGalleryItems[p].text,{},{type:"button"}).addClass("e-galleryextrabtn e-rbn-button"),n.isEmptyObject(gallery.customGalleryItems[p].customToolTip)?t.isNullOrUndefined(gallery.customGalleryItems[p].toolTip)||at.attr("title",gallery.customGalleryItems[p].toolTip):at.mouseover({value:gallery.customGalleryItems[p],ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),o={},gallery.customGalleryItems[p]&&(gallery.customGalleryItems[p].buttonSettings&&(o=gallery.customGalleryItems[p].buttonSettings),at.ejButton(o)),at.appendTo(wt)):(o={},gallery.customGalleryItems[p].menuSettings&&(o=gallery.customGalleryItems[p].menuSettings),o.menuType=t.MenuType.NormalMenu,o.orientation=t.Orientation.Vertical,o.enableRTL=this.model.enableRTL,n("#"+gallery.customGalleryItems[p].menuId).ejMenu(o).addClass("e-gallerymenu"),n("#"+gallery.customGalleryItems[p].menuId).appendTo(wt).css("width","100%"));gt.append(wt)}this._galleryControl.append(this._gallery);this._galleryControl.append(gt);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+gallery.id,this._galleryControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+gallery.id,this._galleryControl).addClass("e-innerdivchild e-controlpadding"));d.append(y)}ot.append(d)}return ot},_groupContent:function(i){var f=0,e,u,o,s,r,h;if(t.isNullOrUndefined(i)?index=this._tabUl.find(".e-active").index()-1:(f=n(i.activeHeader).parents(".e-contextliset").length>0?n(i.activeHeader).parents(".e-contextliset").prevAll(".e-tab").eq(0).prevAll().not(".e-tab,.e-apptab").length:n(i.activeHeader).prevAll().not(".e-tab,.e-apptab").length,index=i.activeIndex-(f+1)),e=this.element.find(".e-content-item").eq(index+(1+f)),e.hasClass("e-rbn-ondemand")&&!(index<0)){if(ribbonModel=n.extend(!0,{},this.model),u=this.model.tabs.length,contextIndex=t.isNullOrUndefined(i)?-1:n(i.activeHeader).hasClass("e-contextualtabset")?u-n(i.activeHeader).index():-1,this.model.contextualTabs&&contextIndex!=-1&&(o=n(i.activeHeader).parents(".e-contextliset").attr("id"),contextIndex=parseInt(o[o.length-1]),contextualTab=this.model.contextualTabs[contextIndex],contextualTab.tabs))for(s=contextualTab.tabs.length,r=0;r<s;r++)!t.isNullOrUndefined(contextualTab.tabs[r].groups)&&contextualTab.tabs[r].groups.length>0&&(this.model.tabs[u]=contextualTab.tabs[r],index=u);if(tabs=this.model.tabs[index],this._mobileContents[this._tabObj.model.selectedItemIndex-1]={tab:tabs.text,mobileContent:[]},this._mobileToolbar[this._tabObj.model.selectedItemIndex-1]={tab:tabs.text,Content:[]},t.isNullOrUndefined(tabs.groups))this.element.find(".e-content.e-content-item").eq(index+1).addClass("e-empty-content");else for(h=tabs.groups.length,j=0;j<h;j++)t.isNullOrUndefined(tabs.groups[j])||(tabGroupText=t.isNullOrUndefined(tabs.groups[j].id)?t.isNullOrUndefined(tabs.groups[j].text)?tabs.groups[j].text:tabs.groups[j].text.replace(/\s/g,""):tabs.groups[j].id.replace(/\s/g,""),contDiv=this._createControls(j,tabs,tabGroupText,index),groupDiv=this._addControlsToGroup(j,tabs,tabGroupText,contDiv),tabcont=this.element.find("#"+this._id+"_"+tabs.id),tabcont.append(groupDiv).addClass("e-parentdiv"));e.removeClass("e-rbn-ondemand");this.model=ribbonModel}},_groupingControls:function(){var s=this.model.tabs.length,f,i,a,v,y,u,r,h,w=n.extend(!0,{},this.model),p,o,c,e,l;if(this.model.contextualTabs)for(p=this.model.contextualTabs.length,o=0;o<p;o++)if(f=this.model.contextualTabs[o],f.tabs)for(c=f.tabs.length,c==0&&this.element.find(".e-content.e-content-item").eq(u+1).addClass("e-empty-content"),e=0;e<c;e++)!t.isNullOrUndefined(f.tabs[e].groups)&&f.tabs[e].groups.length>0&&(this.model.tabs[s]=f.tabs[e],++s);for(u=0;u<s;u++)if(i=this.model.tabs[u],this._mobileContents[u]={tab:i.text,mobileContent:[]},this._mobileToolbar[u]={tab:i.text,Content:[]},t.isNullOrUndefined(i.groups))this.element.find(".e-content.e-content-item").eq(u+1).addClass("e-empty-content");else for(l=i.groups.length,l==0&&this.element.find(".e-content.e-content-item").eq(u+1).addClass("e-empty-content"),r=0;r<l;r++)t.isNullOrUndefined(i.groups[r])||(h=t.isNullOrUndefined(i.groups[r].id)?t.isNullOrUndefined(i.groups[r].text)?i.groups[r].text:i.groups[r].text.replace(/\s/g,""):i.groups[r].id.replace(/\s/g,""),v=this._createControls(r,i,h,u),a=this._addControlsToGroup(r,i,h,v),y=this.element.find("#"+this._id+"_"+i.id),y.append(a).addClass("e-parentdiv"));this._setTabContentHeight();this.model=w},_addControlsToGroup:function(i,r,u,f){var s=t.buildTag("div.e-contentbottom"),h=!1,e,o,c=t.buildTag("div.e-captionarea",r.groups[i].text);return s.append(c),r.groups[i].enableGroupExpander&&(o=t.buildTag("div#"+this._id+"_"+u+"_e-groupexpander.e-icon e-expander e-groupexpander"),s.append(o),t.isNullOrUndefined(r.groups[i].groupExpanderSettings)||(t.isNullOrUndefined(r.groups[i].groupExpanderSettings.toolTip)||o.attr("title",r.groups[i].groupExpanderSettings.toolTip),n.isEmptyObject(r.groups[i].groupExpanderSettings.customToolTip)||o.mouseover({value:r.groups[i].groupExpanderSettings,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)))),e=t.buildTag("div#"+this._id+"_"+r.id+"_"+u).addClass("e-groupdiv").click(n.proxy(this._onGroupClick,this)),t.isNullOrUndefined(r.groups[i].content)||r.groups[i].content.length==1&&(h=!0),r.groups[i].width&&e.width(r.groups[i].width),e.append(f),h&&(e.addClass("e-centeralign"),h==!1),e.append(s),e},_tabExpandCollapse:function(t){var i,r,u;(t.type=="touchend"&&t.preventDefault(),i=t.target.tagName=="div"?t.target:t.target.parentNode,u=i.className=="e-expanded"?"collapse":"expand",r={target:n(i),type:t.type,action:u,cancel:!1},this._trigger("toggleButtonClick",r),r.cancel)||(this.element.find(".e-rarrowup-2x").length>0?this.collapse():(this._removeRibbonPin(),this.model.showQAT&&this._qAccessBar.show(),this._trigger("pinState",{action:"pin"})),this._clickValue="click")},_responsiveback:function(){this.element.find(".e-resizebtnselect").removeClass("e-active e-resizebtnselect");this.element.find(".e-responsivebackstagecontent").is(":visible")&&this.element.find(".e-responsivebackstagecontent").hide();!this.element.find(".e-responsivecontent").hasClass("e-resshow")||this.element.find(".e-responsivecontent").find(".e-split.e-active").length>0||this._responsiveContentBack();this.element.find(".e-respcontent").is(":visible")&&(this.element.find(".e-active-content").addClass("e-responsiveheight e-rbnmobheader"),this.element.find(".e-respcontent .e-groupresponsive.e-ribuparrow").removeClass("e-ribuparrow").addClass("e-ribdownarrow"));return},_ribbonResponsive:function(){for(var f,e,u=t.buildTag("ul#"+this._id+"_responsivetabContent").addClass("e-rescontent"),r=this.model.tabs.length,o=!0,i=0;i<r;i++)u.append(t.buildTag("li",this.model.tabs[i].text).addClass("e-responsivetabli"));if(r=this.model.contextualTabs.length,r==1&&(o=this.model.contextualTabs[0].tabs.length>0?!0:!1),r!=0&&o)for(i=0;i<r;i++)u.append(t.buildTag("li",this.model.contextualTabs[i].tabs[0].text).addClass("e-responsivetabli").addClass("e-resContextual"));f=t.buildTag("div#"+this._id+"_responsivetabHeader").addClass("e-responsivetabheader").click(n.proxy(this._onResponsiveHeaderClick,this));f.append(u);this.element.append(f);this._initialRender&&this._tabUl.find("li.e-ribresmenu a").not(".e-backstagetab").text(this._tabUl.find("li.e-active a").text());this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&(this.element.prepend(t.buildTag("div#"+this._id+"_responsivebackstage").addClass("e-responsivebackstage")),e=t.buildTag("div#"+this._id+"_resbackstagecontent").addClass("e-responsivebackstagecontent").append(t.buildTag("div.e-resbackstagecontent")),e.prepend(t.buildTag("div#"+this._id+"backstagetop").addClass("e-backstagerestop").append(t.buildTag("div.e-backstagerestopcontent").append(t.buildTag("span.e-icon").addClass("e-ribleftarrow")).append(t.buildTag("div#"+this._id+"resbacstageTitle").addClass("e-backstageTitle")))),this.element.prepend(e.hide()))},_onResponsiveHeaderClick:function(t){if(n(t.target).hasClass("e-responsivetabli")){var i=n(t.target).parent("ul").children().index(t.target);this.element.find(".e-responsivetabheader").removeClass("e-resshow");this.element.find(".e-ribresmenu a").text(t.target.textContent);n(this._tabUl.find(".e-tab,.e-contextliset").find("a")[i]).trigger("click");n(t.target).parent("ul").children(".e-resactive").removeClass("e-resactive");n(t.target).addClass("e-resactive");return}if(n(t.target).parent(".e-ribresmenu").length>0){this.element.find(".e-responsivetabheader").addClass("e-resshow");return}},_ribbonResGroup:function(){var i=this._tabUl.find(".e-tab,.e-contextualtabset").index(this._tabUl.find("li.e-active")),c,o,r,h;i<0&&(i=this._tabUl.find(".e-tab,.e-contextualtabset").index(this._tabUl.find("li.e-collapseactive")));t.isNullOrUndefined(this.model.applicationTab)||(tabIndex=i+1);var f=this.element.find(".e-content.e-content-item"),u=this.element.find(".e-active-content"),l=f.eq(tabIndex).attr("id"),s=f.eq(tabIndex).children(".e-groupdiv").length,a=f.eq(tabIndex).children(".e-groupdiv")[s-1],e=f.eq(tabIndex).children(".e-groupdiv").eq(s-1).find(".e-resizebtn");if(i!=-1&&this.element.find(".e-content-item").eq(tabIndex).children().not(".e-expandcollapse").length>0&&this._mobileContents[i].mobileContent.length>0&&!u.find(".e-respmobcontent").length>0){for(u.prepend(t.buildTag("div#"+this._id+"_mobcontent").addClass("e-respmobcontent e-groupmobdiv").append(t.buildTag("div#"+this._id+"_mobribgroup").addClass("e-mobribgroup e-mobribgroupactive").append(t.buildTag("div.e-ribupdivarrow").addClass("e-toolbaralign").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))))).click(n.proxy(this._onGroupClick,this)).click(n.proxy(this._onMobContentClick,this)),u.find(".e-resgroupheader").removeClass("e-resgroupheader"),c=this._mobileToolbar[i].Content.length,o=0;o<c;o++)u.find(".e-mobribgroup").append(this._mobileToolbar[i].Content[o]);u.find(".e-mobribgroup").append(u.find(".e-mobribgroup .e-ribupdivarrow"))}for(r=s-1;r>=0;r--)e=f.eq(tabIndex).children(".e-groupdiv").eq(r).find(".e-resizebtn"),e.length==0&&(r!=0||this._mobileContents[i].mobileContent.length>0)?this._createResizeBtn(tabIndex,r):r==0&&e.length>0&&!this._mobileContents[i].mobileContent.length>0&&(h=e.parent().siblings(),e.parent().remove(),h.show(),h.not(".e-contentbottom").css("width",""))},_ribbonWindowResize:function(){var o,e,s,h,w,b,k,d,tt,g,f,r,l;this._phoneMode=(this.model.allowResizing||this.model.isResponsive)&&document.documentElement.clientWidth<420?!0:!1;var nt=this._tabUl.find(".e-tab,.e-contextualtabset").index(this._tabUl.find("li.e-active")),y=this.element.find(".e-ribbonpin"),u=this.element.find(".e-active-content").eq(0),a=this.element.find(".e-ribresmenu"),v,c,i,p=this.element.find(".e-respcontent");if(t.isNullOrUndefined(this.model.applicationTab)||(tabIndex=nt+1),this.element.find(".e-ribGroupContent.e-resshow").addClass("e-reshide"),this._phoneMode){this._responsiveScrollRemove();p.is(":hidden")&&this.element.find(".e-responsivecontent").is(":hidden")&&p.removeClass("e-reshide");this._isCollapsed?this._tabUl.find(".e-active").length>0?a.find("a").text(this._tabUl.find(".e-active a").text()):(this._responsiveTabText.eq(0).addClass("e-resactive"),a.find("a").text(this._responsiveTabText.filter(".e-resactive").text())):(this._responsiveTabText.filter(".e-resactive").removeClass("e-resactive"),this._responsiveTabText.eq(n(this._ribbonTabs.filter(".e-tab ,.e-contextualtabset")).index(this._ribbonTabs.filter(".e-active"))).addClass("e-resactive"),a.find("a").text(this._responsiveTabText.filter(".e-resactive").text()));y.length>0&&y.trigger("click");u.addClass("e-responsiveheight e-rbnmobheader").addClass("e-tab_"+this._tabUl.find(".e-active a").text());u.hasClass("e-respcontent")||u.addClass("e-respcontent");o=u.find(".e-groupresponsive");(n(o).eq(0).hasClass("e-ribdownarrow")||o.hasClass("e-ribuparrow"))&&o.hasClass("e-ribuparrow")&&o.eq(0).removeClass("e-ribuparrow").addClass("e-ribdownarrow");t.isNullOrUndefined(this.model.applicationTab)||this.element.find(".e-ribresmenu").css("padding-left","12px");this._ribbonResGroup();this.element.addClass("e-responsive");this.element.find(".e-rbn-ddl.e-ddl").addClass("e-rbn-resize");c=this.element.find(".e-ribbonbackstagepage");v=this.element.find(".e-responsivebackstage");e=this.element.find(".e-header").width();this.model.enableOnDemand&&this.element.find(".e-backstagetab .e-resbackstage").length==0?(this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&this._applicationTab.addClass("e-backstagetab"),this.element.find(".e-backstagetab").append(t.buildTag("span.e-icon").addClass("e-ribbon e-resbackstage").click(n.proxy(this._onResponsiveHeaderClick,this))),this.element.find(".e-header").addClass("e-resheader")):this.model.applicationTab.type==t.Ribbon.ApplicationTabType.Backstage&&this.element.find(".e-backstagetab .e-resbackstage").length==0?(this.element.find(".e-backstagetab").append(t.buildTag("span.e-icon").addClass("e-ribbon e-resbackstage").click(n.proxy(this._onResponsiveHeaderClick,this))),this.element.find(".e-header").addClass("e-resheader")):this.model.applicationTab.type==t.Ribbon.ApplicationTabType.Menu&&this.model.applicationTab.menuItemID&&(this.element.find(".e-header").addClass("e-resheader"),this.element.find(".e-rescontent").addClass("e-rescontent-menu"));this.model.showQAT&&(this._tabUl.find("li.e-responsiveqat").append(this.element.find(".e-rbnquickaccessbar.e-rbnabove").children()),s=this.element.find(".e-ribdownarrow").not(".e-groupresponsive"),this.element.find(".e-resqatScroll").length>0&&(h=this.element.find(".e-resqatScroll"),h.data("ejScroller")._destroy(),h.parent().append(h.find("div:first").children()),h.remove()),w=e-(s.offset().left+s.outerWidth())<e-this.element.find("li.e-responsiveqat").offset().left,w&&!this.element.find(".e-resqatScroll").length>0&&(b=e-this.element.find("li.e-responsiveqat").offset().left-(e-(s.offset().left+s.outerWidth())),r=t.buildTag("div#"+this._id+"_responsiveqat").addClass("e-resqatScroll").append(t.buildTag("div")),r.find("div").append(this._tabUl.find("li.e-responsiveqat").children()),this._tabUl.find("li.e-responsiveqat").append(r),k=this.element.find(".e-resqatScroll"),k.ejScroller({width:e-this.element.find("li.e-responsiveqat").offset().left-b,height:"",scrollerSize:3,buttonSize:0})));u.find(".e-groupdiv .e-resizebtn").length>0&&!u.find(".e-groupdiv .e-groupresponsive").not(".e-ribdownarrow").length>0&&u.find(".e-groupdiv").find(".e-resizebtn").parent("div").prepend(t.buildTag("div.e-ribrightdivarrow").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribrightarrow")));this._tabUl.find(".e-backstagetab").length>0&&v.length==1&&(d=c.find(".e-ribbonbackstagebody .e-backstageheader"),v.append(d).addClass("e-reshide"));!this.element.find(".e-responsivecontent").length>0&&(r=t.buildTag("div#"+this._id+"_responsive").addClass("e-content e-responsivecontent").click(n.proxy(this._onResizeDivClick,this)),r.append(t.buildTag("div#"+this._id+"_resback").addClass("e-responsiveback").append(t.buildTag("span").addClass("e-groupresponsive e-icon e-ribleftarrow")).append(t.buildTag("div#"+this._id+"+rescontentback").addClass("e-restopbackcontent"))),this.element.append(r.hide()));c.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").append(c.find(".e-ribbonbackstagebody .e-backstagecontent"));tt=this.element.find(".e-header");g=document.documentElement.clientHeight;i=this.element.find(".e-mobribgroup.e-mobribgroupactive");this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").css({height:g-this.element.find(".e-backstagerestop").outerHeight()});i.find(".e-ribupdivarrow").removeClass("e-toolbaralign");f=i.find(".e-resptoolbarScroll");f.length>0&&(f.data("ejScroller")._destroy(),f.parent().append(f.find("div:first").children()),f.parents(".e-active-content").removeClass("e-responsiveToolbarScroll"),f.remove());this._phoneMode&&i.outerWidth()>this.element.find(".e-header").outerWidth()?(r=t.buildTag("div#"+this._id+"_responsivetoolbar").addClass("e-resptoolbarScroll").append(t.buildTag("div")),r.find("div").append(i.children()),i.append(r),l=this.element.find(".e-respmobcontent .e-resptoolbarScroll"),l.find(".e-toolbaralign").removeClass("e-toolbaralign"),l.ejScroller({width:this.element.find(".e-header").width(),height:"",scrollerSize:4,buttonSize:0}),l.parents(".e-active-content").addClass("e-responsiveToolbarScroll")):i.find(".e-resptoolbarScroll").length>0&&!i.find("e-responsiveToolbarScroll").length>0?i.parents(".e-active-content").addClass("e-responsiveToolbarScroll"):i.find(".e-ribupdivarrow").addClass("e-toolbaralign");this.goToMainContent();return}this.element.hasClass("e-responsive")&&(this.element.removeClass("e-responsive"),this._ribbonRerender());(this.model.allowResizing||this.model.isResponsive)&&(this.element.find(".e-ribbonpin").length>0&&this.element.find(".e-active-content").eq(0).is(":visible")?this.collapse():this._ribbonResize());this.element.find(".e-ribbonpin").length>0&&this._tabContents.width(this.element.width())},_ribbonResize:function(){var dt,e,r,a,v,ut,i,at,p,w,vt,yt=0,c,b=[],d,o,ft,f,pt=this.element.find(".e-active-content").eq(0),g,u,k,et,ot=this.element.find(".e-ribbonpin"),nt,wt,tt,it,bt,kt,s,l,y,h,ht,rt,ct,lt;if(u=this._tabUl.find("li.e-select:visible,li.e-active:visible"),k=this.element.find(".e-resizediv"),expandDiv=this.element.find(".e-expandcollapse"),o=this.element.find(".e-header"),ot.length>0&&(this._removeRibbonPin(),expandDiv.children().addClass("e-ribbonpin")),o.is(":hidden")&&pt.is(":hidden")&&this._resizeWidth<=this.element.width()+this.element.offset().left&&(o.show(),this._qAccessBar.show(),(this.element.find(".e-expandcollapse").children().hasClass("e-expanded")||o.find(".e-active").length>0)&&(ot.length<=0?(pt.show(),expandDiv.children().addClass("e-expanded").removeClass("e-collapsed")):ot.length>0&&this.collapse())),g=o.find("li.e-select,li.e-active"),ut=g.length,o.is(":visible")){for(l=ut-1;l>0;l--)for(i=g.eq(l).children(),at=i.text().length-1,y=at;y>1;y--)u.length>0&&(a=u.last().offset().left,v=u.last().width(),(this.element.width()+this.element.offset().left-30-(a+v)<=0||this.model.enableRTL&&u.last().offset().left<this.element.offset().left)&&(i.hasClass("e-resizeHead")?i.text(i.text().slice(0,-1)):i.text(i.text().slice(0,-1)).addClass("e-resizeHead")));et=o.find(".e-resizeHead");ut-1===et.length&&et.eq(0).text().length<=2&&u.length>0&&(a=u.last().offset().left,v=u.last().width(),this.element.width()+this.element.offset().left-30-(a+v)<=0&&(this._resizeWidth=this.element.width()+this.element.offset().left))}if(r=this._tabObj.model.selectedItemIndex,f=this.element.find(".e-content.e-content-item"),dt=f.eq(r).attr("id"),p=f.eq(r).children(".e-groupdiv").length,e=f.eq(r).children(".e-groupdiv")[p-1],ft=f.eq(r).children().eq(p-1).find(".e-resizebtn"),!t.isNullOrUndefined(e)){for(s=p-1;s>=0;s--)ft=f.eq(r).children().eq(s).find(".e-resizebtn"),(this.element.width()+this.element.offset().left-25-(e.offsetWidth+n(e).offset().left)<=0||this.model.enableRTL&&n(window).width()-this.element.offset().left+25-(n(window).width()-n(e).offset().left+e.offsetWidth)<=0)&&ft.length===0&&this._createResizeBtn(r,s);this.element.width()+this.element.offset().left-25-(e.offsetWidth+n(e).offset().left)<=0||this.model.enableRTL&&n(window).width()-this.element.offset().left+25-(n(window).width()-n(e).offset().left+e.offsetWidth)<=0?p===f.eq(r).find(".e-resizebtn").length&&(this._resizeWidth=this.element.width()+this.element.offset().left,this.element.addClass("e-grpdivhide"),this.element.find(".e-expandcollapse").css("display","none")):(this.element.removeClass("e-grpdivhide"),this.element.find(".e-expandcollapse").css("display","block"))}for(this._qatResize(),k.is(":visible")&&(nt=k.children().eq(0).attr("id"),nt="#"+nt.replace("_content",""),k.children().hide().appendTo(nt),k.hide()),wt=this.model.tabs.length,tt=0;tt<wt;tt++)it=this.model.tabs[tt].text,b.push(it);if(this.model.contextualTabs)for(bt=this.model.contextualTabs.length,h=0;h<bt;h++)if(this.model.contextualTabs[h].tabs)for(kt=this.model.contextualTabs[h].tabs.length,s=0;s<kt;s++)it=this.model.contextualTabs[h].tabs[s].text,b.push(it);if(resizeHeadLen=o.find(".e-resizeHead").length,o.is(":visible"))for(l=0;l<resizeHeadLen;l++)if(i=o.find(".e-resizeHead").eq(0),i.hasClass("e-resizeHead")){var st=g.find(".e-link").not(".e-resizeHead").length-1,gt=i.text().length,ni=b[st].length;for(y=gt;y<=ni;y++)u.length>0&&(a=u.last().offset().left,v=u.last().width()+15,(this.element.width()+this.element.offset().left-30>=a+v&&!this.model.enableRTL||this.model.enableRTL&&u.last().offset().left-15>this.element.offset().left)&&(i.text().length===b[st].length?i.removeClass("e-resizeHead"):this._width!=this.element.width()&&i.text(b[st].slice(0,i.text().length+1))))}for(yt=f.eq(r).find(".e-resizebtn").length,h=0;h<yt;h++)if(c=f.eq(r).find(".e-resizebtn").eq(0),n(c).is(":visible")){if(vt=this.element.width()+this.element.offset().left-25,w=c.offset().left+c.parent().siblings().not(".e-contentbottom").width(),this.model.enableRTL&&(w=this.element.width()+this.element.offset().left-c.offset().left+c.parent().siblings().not(".e-contentbottom").width()),ht=f.eq(r).find(".e-resizebtn").length,ht>1)for(rt=0;rt<ht;rt++)w=w+f.eq(r).find(".e-resizebtn").eq(rt).parents(".e-groupdiv").width()+7;vt>w&&(ct=c.parent().siblings(),c.parent().remove(),ct.show(),ct.not(".e-contentbottom").css("width",""))}this._qatResizeRemove();d=this.element.find(".e-tooltipdiv");d.hide();d.find(".e-tooltiptitle").children().remove();d.find(".e-tooltipdesc").children().remove();this.element.find(".e-ribbonpin").length>0&&this.element.find(".e-active-content").eq(0).is(":visible")&&(this._addRibbonPin(),this._tabContents.width(this.element.width()));this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active");this.model.showQAT&&(lt=this.element.find(".e-rbnqatmenu"),lt.is(":visible")&<.hide().css({top:"",left:""}),this.element.find(".e-qaresizebtn,.e-splitbtnqat").removeClass("e-tbtn e-active"))},_qatResize:function(){var r,i,e,u,f,o;if(this.model.showQAT&&this._qAccessBar.is(":visible")){for(e=this._qAccessBar.children(":visible").length,u=0;u<e;u++)r=this._qAccessBar.children(":visible").last(),this.element.width()-(r.width()+n(r).position().left+6)<=0&&(r.hasClass("e-splitbtnqatdiv")?(f=t.buildTag("div.e-qaresizebtndiv").attr("title","More Controls"),o=t.buildTag("button.e-qaresizebtn"),i=t.buildTag("div.e-qaresizediv").hide(),this.element.append(i),i.append(r.prev()),f.append(o.ejButton({size:"normal",type:"button",contentType:"imageonly",height:30,width:14,prefixIcon:"e-icon e-ribbon e-qaresizebtnicon",click:n.proxy(this._onQatResizeBtnClick,this)})),i.append(r),f.insertBefore(this.element.find(".e-rbnqatmenu"))):r.hasClass("e-qaresizebtndiv")&&(i=this.element.find(".e-qaresizediv"),i.prepend(r.prevAll(":visible").first())));i=this.element.find(".e-qaresizediv");i.is(":visible")&&i.hide()}},_qatResizeRemove:function(){var n=this.element.find(".e-qaresizediv"),e=this.element.width(),i=0,r,u,f,t;if(n.length>0&&this._qAccessBar.is(":visible")&&this.model.showQAT){for(n.show(),r=this.element.find(".e-qaresizebtndiv"),u=this._qAccessBar.children(":visible").length,f=n.children().length,t=0;t<u;t++)i=i+this._qAccessBar.children(":visible").eq(t).width()+6;for(t=0;t<=f;t++)i=n.children().length>2?i+n.children().eq(0).width():i+n.width(),e>i&&(n.children().length>2?n.children().eq(0).insertBefore(r):(n.children().insertBefore(r),this.element.find(".e-qaresizebtndiv").remove(),n.remove()));n.hide()}},_createResizeBtn:function(i,r){var e,l,o=this.element.find(".e-content.e-content-item"),u,s,f,h;u=o.eq(i).children(".e-groupdiv").eq(r);f=u.height();h=t.isNullOrUndefined(this.model.tabs[i-1].groups[r].id)?this.model.tabs[i-1].groups[r].text:this.model.tabs[i-1].groups[r].id;e=u.find(".e-contentbottom").text();s=u.children().not(".e-contentbottom");l=s.width();t.isNullOrUndefined(this._responsiveContentStyle)&&(this._responsiveContentStyle={height:f});u.children().hide();s.css("width",l);var a=t.buildTag("div.e-resizegroupdiv#"+this._id+"_resizeDiv_"+h),c=t.buildTag("button#"+this._id+"_resizebtn_"+h,e,{},{type:"button"}).addClass("e-resizebtn e-rbn-button"),v={target:o.eq(i).children(".e-groupdiv").eq(r).children()};c.ejButton({click:n.proxy(this._resizeBtnClick,v),contentType:t.ContentType.TextAndImage,imagePosition:t.ImagePosition.ImageBottom,prefixIcon:"e-icon e-ribbonresize"});u.height(f);c.find("div").prepend("<span class='e-icon e-"+e+"'><\/span>").height(f-5);c.appendTo(a);a.appendTo(o.eq(i).children(".e-groupdiv").eq(r))},_resizeBtnClick:function(){},_responsiveCustomize:function(n){n.find(".e-rbn-resize").parents(".e-controlpadding").addClass("e-rbn-resize").addClass("e-rbn-dll-cus");n.find(".e-rbn-resize").parents(".e-innerdivrow").addClass("e-rbn-resize").next().css("display","inline-block")},_responsiveContentShow:function(n){var r=this.element.find(".e-active-content"),i;this._responsiveCustomize(n);r.addClass("e-reshide");n.addClass("e-resshow");this.element.find(".e-responsivecontent .e-ribGroupContent").addClass("e-resshow");n.find(".e-ribGroupContent").height()>this._responsiveHeight&&(i=t.buildTag("div#"+this._id+"_responsivecontentScroll").addClass("e-rescontentScroll").append(t.buildTag("div")),i.find("div").append(n.children(".e-ribGroupContent")),n.append(i),n.find(".e-rescontentScroll").ejScroller({height:this._responsiveHeight,scrollerSize:8,buttonSize:0}));r.find(".e-resizebtnselect").removeClass("e-resizebtnselect")},_responsiveContentBack:function(){this._responsiveTarget.append(this._responsiveContent).find(".e-ribGroupContent").addClass("e-reshide").css(this._responsiveContentStyle);this._responsiveContent=null;this.element.find(".e-resizebtn.e-active").removeClass("e-active e-resizebtnselect");this.element.find(".e-galleryexpand.e-gallerymoveicon").length>0&&this.element.find(".e-galleryexpand.e-gallerymoveicon").trigger("click");this.element.find(".e-content.e-responsivecontent").children().not(".e-responsiveback").remove();this.element.find(".e-active-content").removeClass("e-reshide");this.element.find(".e-responsivecontent").removeClass("e-resshow")},_ribbonDocClick:function(i){var u,y,h,f,c,e,l;if(this.element.hasClass("e-responsive")){var r=i.target,o={},k=this,s=this.element.find(".e-responsivebackstage"),a=this.element.find(".e-responsivetabheader"),v=this.element.find(".e-active-content"),d=this.element.find(".e-responsivebackstage");if(!n(i.target).parents(".e-ribbon").length>0&&!(i.target==document.documentElement)&&!n(i.target).parents(".e-rbn-ddl").length>0&&!n(i.target).parents(".e-popup").length>0&&!this.element.find(".e-responsivecontent").is(":visible")){if(a.removeClass("e-resshow"),s.is(":visible")&&s.removeClass("e-backstageshowanimate"),this.element.find(".e-responsivecontent").is(":visible")&&this._responsiveContentBack(),this.element.find(".e-responsivebackstagecontent").hide(),!v.hasClass("e-responsiveheight")){v.addClass("e-responsiveheight e-rbnmobheader");this._responsiveScrollRemove();v.find(".e-groupresponsive.e-ribuparrow").removeClass("e-ribuparrow").addClass("e-ribdownarrow");o.isMobile=this.element.hasClass("e-responsive");o.target=r;o.currentTarget=i.currentTarget;o.eventType=i.type;this.element.find(".e-content.e-content-item").on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){k._trigger("collapse",o)})}return}if((n(r).hasClass("e-header")||n(r).hasClass("e-ribGroupContent")||n(r).hasClass("e-groupresponsive")||n(r).hasClass("e-respmobcontent"))&&(a.hasClass("e-resshow")&&a.removeClass("e-resshow"),s.is(":visible")&&s.removeClass("e-backstageshowanimate")),n(r).parent().hasClass("e-backstagerestopcontent")&&!n(".e-ddl-popup").is(":visible")){n(r).parents(".e-responsivebackstagecontent").hide();return}return}if(l=this.element.find(".e-gallexpandcontent"),f=this.element.find("#"+this._id+"_modelDiv"),c=this.element.find(".e-active-content"),f.is(":visible")&&f.hide(),l.hasClass("e-gallerypopupshow")&&(l.removeClass("e-gallerypopupshow"),f.hide()),(n(".e-rbn-splitbtn").parents().hasClass("e-active")||this.element.find(".e-resizebtn").hasClass("e-resizebtnselect")||n(".e-ddl-popup.e-rbn-ddl:visible").length>0||this.element.find(".e-colorwidget").hasClass("e-active"))&&c.append(f.show().height("100%")),e=n(".e-ribbonpopup:visible"),e.length>0&&!e.hasClass("e-ribbonpopupshow")?(e.addClass("e-ribbonpopupshow"),c.append(f.show().height("100%"))):e.hasClass("e-ribbonpopupshow")&&e.removeClass("e-ribbonpopupshow"),(n(i.target).hasClass("e-expgallerydiv")||n(i.target).parents(".e-expgallerydiv").length>0)&&(l.addClass("e-gallerypopupshow"),c.append(f.show().height("100%"))),n(i.target).hasClass("e-gallerymoveicon")||n(i.target).hasClass("e-gallerymovediv")||n(i.target).hasClass("e-expgallerydiv")||n(i.target).hasClass("e-scrollbar")||n(i.target).parents().hasClass("e-scrollbar")?u=i.target:n(i.target).parents().hasClass("e-gallerymenu")&&(n(i.target).hasClass("e-haschild")||n(i.target).hasClass("aschild")||n(i.target).hasClass("e-arrows"))&&(u=i.target),t.isNullOrUndefined(u)&&this._ribbonGalleryShow(),y=this.element.find(".e-tooltipdiv"),disabled=n(i.target).find(".e-disable"),y.is(":visible")&&n(disabled).length<=0&&!n(i.target).hasClass("e-disable")&&y.hide(),(n(i.target).hasClass("e-backstagechild")||n(i.target).parents(".e-backstagechild").length>0||n(i.target).hasClass("e-ribbonbackstagepage")||n(i.target).hasClass("e-apptab")||n(i.target).parents(".e-ribbonbackstagepage").length>0||n(i.target).parents(".e-apptab").length>0)&&(u=i.target),t.isNullOrUndefined(u)&&n(document).find(n(i.target)).length==0&&(u=n(i.currentTarget.activeElement)),t.isNullOrUndefined(u)&&this.element.find(".e-ribbonbackstagepage").hide(),!n(i.target).hasClass("e-disable-item")&&n(i.target).parents(".e-disable-item").length<=0&&this.element.find(".e-controlclicked").removeClass("e-controlclicked"),h=n(i.target).parents(".e-controlpadding"),h.length>0&&n(disabled).length<=0&&!n(i.target).hasClass("e-disable")&&n(h).find(".e-ribbongallerycontrol").length<=0&&n(h).addClass("e-controlclicked"),this.element.find(".e-ribbonpin").is(":visible")&&n(i.target).parents(".e-ribbon").length<=0&&!n(i.target).hasClass("e-scrollbar")&&!n(i.target).parents().hasClass("e-scrollbar")&&this.collapse(),this.element.find(".e-resizediv").is(":hidden")&&this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active"),this._tabUl.find(".e-link.e-active").removeClass("e-active"),this.model.showQAT){var p=this.element.find(".e-rbnqatmenu"),w=this.element.find(".e-qaresizediv"),b=this.element.find(".e-splitbtnqat");!n(i.target).hasClass("e-splitbtnqatdiv")&&n(i.target).parents(".e-splitbtnqatdiv").length<=0&&n(i.target).parents(".e-rbnqatmenu").length<=0&&p.hide().css({top:"",left:""});!n(i.target).hasClass("e-qaresizebtndiv")&&p.is(":hidden")&&n(i.target).parents(".e-qaresizediv").length<=0&&n(i.target).parents(".e-qaresizebtndiv").length<=0&&!n(i.target).hasClass("e-splitbtnqatdiv")&&n(i.target).parents(".e-splitbtnqatdiv").length<=0&&w.hide().css({top:"",left:""});w.is(":hidden")&&this.element.find(".e-qaresizebtn").hasClass("e-active")&&!n(i.target).hasClass("e-qaresizebtndiv")&&n(i.target).parents(".e-qaresizebtndiv").length<=0&&n(i.target).parents(".e-rbnqatmenu").length<=0&&this.element.find(".e-qaresizebtn").removeClass("e-tbtn e-active");b.hasClass("e-active")&&!n(i.target).hasClass("e-splitbtnqatdiv")&&n(i.target).parents(".e-splitbtnqatdiv").length<=0&&n(i.target).parents(".e-rbnqatmenu").length<=0&&b.removeClass("e-tbtn e-active")}},_ribbonGalleryShow:function(){var f=0,r,e,u,i,o,s,t;if(this.element.find(".e-gallexpandcontent:visible").length>0){for(r=0,e=0,gallery=this.element.find(".e-gallexpandcontent:visible").parent().find(".e-ribbongallery"),u=gallery.find(".e-galleryrow").length,t=1;t<=u;t++)gallery.find(".e-galleryrow").eq(t-1).css("display")==="block"&&(r===0&&(f=t-1),++r);for(gallery.find(".e-galleryrow").hide(),gallery.parent().find(".e-gallexpandcontent").hide(),gallery.show(),gryColumns=gallery.find(".e-galleryrow").eq(0).children().length,gallery.find(".e-galleryrow").eq(0).children().remove(),u=gallery.find(".e-galleryrow").length,i=0;i<u;i++)for(o=0;o<gryColumns;o++)if(s=gallery.parent().find(".e-galleryexpanderrow").children().eq(0),n(s).hasClass("e-galleryselect")){for(gallery.find(".e-galleryrow").eq(i).append(gallery.parent().find(".e-galleryexpanderrow").children().eq(0)).show(),--r,t=1;t<=r;t++)gallery.find(".e-galleryrow").eq(i+t).length>0?gallery.find(".e-galleryrow").eq(i+t).show():(++e,gallery.find(".e-galleryrow").eq(i-e).show());gallery.find(".e-galleryrow").last().is(":visible")?gallery.parent().find(".e-movedowndiv").addClass("e-disablegrymovebtn"):gallery.parent().find(".e-movedowndiv").removeClass("e-disablegrymovebtn");gallery.find(".e-galleryrow").first().is(":visible")?gallery.parent().find(".e-moveupdiv").addClass("e-disablegrymovebtn"):gallery.parent().find(".e-moveupdiv").removeClass("e-disablegrymovebtn")}else gallery.find(".e-galleryrow").eq(i).append(gallery.parent().find(".e-galleryexpanderrow").children().eq(0));if(gallery.find(".e-galleryselect").length<=0)for(t=0;t<r;t++)gallery.find(".e-galleryrow").eq(f).show(),++f;gallery.parent().find(".e-galleryexpanderrow").remove()}},_resizeDivHide:function(){var i=this.element.find(".e-resizediv"),r;this._off(n(document),"mousedown",this._rbndocumentClick);n(i).is(":visible")&&(r=n(i).children().eq(0).attr("id"),t.isNullOrUndefined(r)||(r="#"+r.slice(0,-8),n(i).children().hide().appendTo(r),this.element.find("#"+this._id+"_disabled").hide(),n(i).hide()),this.element.find(".e-ribbonpin").length>0&&n(i).css({top:""}))},_resizeDivShow:function(t){var u,f,i,e,r=this.element.find(".e-resizediv");i=this.element.find("#"+t[0].id).parent().siblings();u=i.not(".e-contentbottom").width()+i.parent().offset().left;this.model.enableRTL&&(u=i.not(".e-contentbottom").width()+(this.element.width()+this.element.offset().left-i.parent().offset().left));this.element.css({position:"relative"});n(r).css({left:""});u>this.element.width()+this.element.offset().left?(f=i.parent().position().left-(u-(this.element.width()+this.element.offset().left)),this.model.enableRTL&&(f=this.element.width()+(this.element.offset().left-i.parent().offset().left)-(u-(this.element.width()+this.element.offset().left-i.parent().width()))),e=parseInt(n(r).css("padding-left"),10)+parseInt(n(r).css("padding-right"),10),this.model.enableRTL?n(r).css({right:f+e-1}):n(r).offset({left:f-e})):this.model.enableRTL?n(r).css({right:this.element.width()+(this.element.offset().left-i.parent().offset().left)-i.parent().outerWidth()}):n(r).offset({left:i.parent().position().left});this.element.find(".e-ribbonpin").length>0&&n(r).offset({top:this.element.height()+this.element.find(".e-active-content").eq(0).height()});n(r).width(i.not(".e-contentbottom").css("width"));n(r).append(i.show()).show();this.element.hasClass("e-grpdivhide")&&(this.element.removeClass("e-grpdivhide"),this.element.find(".e-active-content").eq(0).addClass("e-resdivshow"));this._on(n(document),"mousedown",this._rbndocumentClick)},_rbndocumentClick:function(t){this.element.find(".e-resizediv").is(":visible")&&n(t.target).parents(".e-resizediv").length<=0&&n(t.target).parents(".e-rbn-ddl").length<=0&&!n(t.target).hasClass("e-rbn-splitbtn")&&n(t.target).parents(".e-colorpicker.e-ribbon:visible").length<=0&&n(t.target).parents(".e-rbn-splitbtn:visible").length<=0&&this._resizeDivHide();this.element.find(".e-resizediv").is(":hidden")&&this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active")},_ribbonDocRightClick:function(t){var r,i;r=n(t.target).parents(".e-resizediv");r.length<=0&&this._resizeDivHide();this.element.find(".e-resizediv").is(":hidden")&&this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active");this.element.find(".e-gallexpandcontent").hasClass("e-gallerypopupshow")&&this._ribbonGalleryShow();n(this.element.find(".e-ribbonbackstagepage")).is(":visible")&&this.element.find(".e-ribbonbackstagepage").hide();i=this.element.find(".e-tooltipdiv");i.is(":visible")&&i.hide()},_onTabDblClick:function(t){this._phoneMode||this.element.find(".e-apptab .e-menu ul").is(":visible")||this.element.find(".e-ribbonbackstagepage").is(":visible")||(n(t.target).closest(".e-tab.e-disable").length||(this.element.find(".e-collapsed .e-rarrowup-2x").length&&this.expand(),this.element.find(".e-expanded .e-rarrowup-2x").length&&this.collapse(),this.element.find(".e-expanded.e-ribbonpin").length&&this._removeRibbonPin()),this._clickValue=t.type)},_ribbonhover:function(t){this._phoneMode&&(t.type=="mouseover"?n(t.currentTarget).hasClass("e-resizegroupdiv")&&n(t.currentTarget).addClass("e-reshover"):t.type=="mouseout"&&n(t.currentTarget).hasClass("e-resizegroupdiv e-reshover")&&n(t.currentTarget).removeClass("e-reshover"))},_wireEvents:function(){this._on(n(document),"keydown",this._OnKeyDown);this._on(this.element,"keydown",this._ribbonKeyDown);this._on(this.element,"mouseover mouseout",".e-resizegroupdiv",this._ribbonhover);this._on(this.element.find("#"+this._id+"_expandCollapse"),t.eventType.click,this._tabExpandCollapse);this._on(this.element.find(".e-groupexpander"),t.eventType.click,this._onGroupExpandClick);this._on(this.element.find(".e-qatmenuli"),t.eventType.click,this._onQatMenuItemClick);this._on(n(window),"resize",this._ribbonWindowResize);this._on(n(document),"click",this._ribbonDocClick);this._on(n(document),"contextmenu",this._ribbonDocRightClick);this._on(this.element.find(".e-header > li"),"dblclick",this._onTabDblClick)}});t.Ribbon.alignType={rows:"rows",columns:"columns"};t.Ribbon.AlignType={Rows:"rows",Columns:"columns"};t.Ribbon.applicationTabType={menu:"menu",backstage:"backstage"};t.Ribbon.ApplicationTabType={Menu:"menu",Backstage:"backstage"};t.Ribbon.quickAccessMode={none:"none",toolBar:"toolbar",menu:"menu"};t.Ribbon.QuickAccessMode={None:"none",ToolBar:"toolbar",Menu:"menu"};t.Ribbon.type={button:"button",splitButton:"splitbutton",dropDownList:"dropdownlist",custom:"custom",toggleButton:"togglebutton",gallery:"gallery"};t.Ribbon.Type={Button:"button",SplitButton:"splitbutton",DropDownList:"dropdownlist",Custom:"custom",ToggleButton:"togglebutton",Gallery:"gallery"};t.Ribbon.customItemType={button:"button",menu:"menu"};t.Ribbon.CustomItemType={Button:"button",Menu:"menu"};t.Ribbon.itemType={button:"button",tab:"tab"};t.Ribbon.ItemType={Button:"button",Tab:"tab"};t.Ribbon.Locale=t.Ribbon.Locale||{};t.Ribbon.Locale["default"]=t.Ribbon.Locale["en-US"]={CustomizeQuickAccess:"Customize Quick Access Toolbar",RemoveFromQuickAccessToolbar:"Remove from Quick Access Toolbar",AddToQuickAccessToolbar:"Add to Quick Access Toolbar",ShowAboveTheRibbon:"Show Above the Ribbon",ShowBelowTheRibbon:"Show Below the Ribbon",MoreCommands:"More Commands..."}}(jQuery,Syncfusion);InternalAdaptive=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._kbnTimeoutSearch=function(n,t){var i=n.data("ejKanban"),r;r=t.currentTarget;i._searchTout&&(i._searchTout=window.clearInterval(i._searchTout));i._searchTout=window.setInterval(function(){$(".e-kanbanwaitingpopup").removeClass("e-kanbanwaitingpopup").addClass("e-kbnsearchwaitingpopup");n.data("ejWaitingPopup").show();$(".e-kbnsearchwaitingpopup").css({top:"1px",left:"1px"});var u=setTimeout(function(){var f=$(r).find("input").val(),e,o;ej.isNullOrUndefined(f)&&(f=$(r).val());e={itemName:r.title,itemId:r.id,target:r,currentTarget:r,itemIndex:$(r).index(),toolbarData:t,itemText:f};i._trigger("toolbarClick",e);i.KanbanFilter.searchCards(f);i.element.find(".e-searchbar .e-search.e-tooltxt").addClass("e-highliht-kbnsearchbar");$(".e-kbnsearchwaitingpopup").addClass("e-kanbanwaitingpopup").removeClass("e-kbnsearchwaitingpopup").css({top:"0px",left:"0px"});ej.isNullOrUndefined(i.model.fields.swimlaneKey)||(o=(new ej.Query).where(ej.Predicate.or(i.keyPredicates)).select(i.model.fields.swimlaneKey),i._kbnAdaptDdlData=new ej.DataManager(i._currentJsonData).executeLocal(o),i._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(i._kbnAdaptDdlData)),i.KanbanAdaptive._adaptiveSwimlaneRefresh());n.data("ejWaitingPopup").hide();clearTimeout(u)},300);i._searchTout=window.clearInterval(i._searchTout)},1e3)},n.prototype._kbnRightSwipe=function(){var n=this.kanbanObj,h=n.element.width(),l=n.element.find(".e-rowcell:visible"),o,r=n.element.find(".e-stackedHeaderCell"),f=0,u,e,i,a=n,t,c,s;if(n._kbnSwipeCount>0){for(n._kbnSwipeCount==1?n._kbnSwipeWidth=0:(i=l.eq(n._kbnSwipeCount-1),i.length==0&&(i=n.element.find(".e-headercell:visible").not(".e-stackedHeaderCell").eq(n._kbnSwipeCount-1)),n._kbnSwipeWidth=n._kbnSwipeWidth-i.offset().left,window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?o=(h-i.width())/2:(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(o=(h-i.width())/8),n._kbnSwipeWidth=n._kbnSwipeWidth+o),t=0;t<r.length;t++)if(c=n.headerContent.find("col:eq(0)").width(),u=f,e=n._kbnSwipeCount-1,f=f+parseInt($(r).eq(t).attr("colspan")),e>=u&&e<f)if(u==n._kbnSwipeCount-1){n.element.find(".e-adapt-stheader").removeClass("e-adapt-stheader");$(r).eq(t).find("div").css({position:"",left:""});s=$(r).eq(t).prev(".e-stackedHeaderCell");s.length>0&&s.addClass("e-adapt-stheader");break}else if(u<n._kbnSwipeCount-1){$(r).eq(t).find("div").css({position:"relative",left:c*(n._kbnSwipeCount-1-u)+8*(e-1)});break}n._kbnTransitionEnd=!1;n._kbnSwipeCount>1&&(n._kbnSwipeWidth=n._kbnSwipeWidth+n.element.offset().left);n.headerContent.find("table").css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""}).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){a._kbnTransitionEnd=!0});n.kanbanContent.find("table").eq(0).css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""});--n._kbnSwipeCount}},n.prototype._kbnLeftSwipe=function(){var n=this.kanbanObj,e=n.element.width(),l=n.element.find(".e-rowcell:visible"),o,r=n.element.find(".e-stackedHeaderCell"),s=0,f,u,i,a=n,c,t,h;if((window.matchMedia("(max-width: 600px)").matches||window.matchMedia("((max-device-width: 800px)").matches)&&n._kbnSwipeCount<n.model.columns.length-1||(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&n._kbnSwipeCount<n.model.columns.length-2){for(i=l.eq(n._kbnSwipeCount+1),i.length==0&&(i=n.element.find(".e-headercell:visible").not(".e-stackedHeaderCell").eq(n._kbnSwipeCount+1)),n._kbnSwipeWidth=n._kbnSwipeWidth-i.offset().left,window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?o=n._kbnSwipeCount==n.model.columns.length-2?e-i.width():(e-i.width())/2:(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(n._kbnSwipeCount==n.model.columns.length-3?(c=parseInt(n.contentTable.css("border-spacing").split("px")[0]),o=e-(i.width()+c)*2):o=(e-i.width())/8),n._kbnSwipeWidth=n._kbnSwipeWidth+o,t=0;t<r.length;t++)if(h=n.headerContent.find("col:eq(0)").width(),f=s,u=n._kbnSwipeCount+1,s=s+parseInt($(r).eq(t).attr("colspan")),u>f&&u<s)if(t==0){$(r).eq(t).addClass("e-adapt-stheader");$(r).eq(t).find("div").css({position:"relative",left:h*u+8*(u-1)});break}else if(f==n._kbnSwipeCount+1){n.element.find(".e-adapt-stheader").removeClass("e-adapt-stheader");$(r).eq(t-1).find("div").css({position:"",left:""});$(r).eq(t).addClass("e-adapt-stheader");break}else if(f<n._kbnSwipeCount+1){$(r).eq(t).find("div").css({position:"relative",left:h*(n._kbnSwipeCount+1-f)+8*(u-1)});break}n._kbnTransitionEnd=!1;n._kbnSwipeWidth=n._kbnSwipeWidth+n.element.offset().left;n.headerContent.find("table").css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""}).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){a._kbnTransitionEnd=!0});n.kanbanContent.find("table").eq(0).css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""});++n._kbnSwipeCount}},n.prototype._clearAdaptSearch=function(n){var u=this.kanbanObj,t,r=u.element,i=r.data("ejKanban");ej.isNullOrUndefined(n)||(t=$(n.target));ej.isNullOrUndefined(t)||t.hide();r.data("ejWaitingPopup").show();setTimeout(function(){var e,f,o;ej.isNullOrUndefined(t)||(f=t.prev(".e-input"));(ej.isNullOrUndefined(f)||f.length==0)&&(f=ej.isNullOrUndefined(t)?r.find(".e-kanbantoolbar .e-searchdiv > .e-input"):t.next(".e-search").find("input"));e=ej.isNullOrUndefined(t)?{itemText:f.val()}:{target:t,currentTarget:t,itemIndex:t.index(),toolbarData:n,itemText:f.val()};i._trigger("toolbarClick",e);u.KanbanFilter.searchCards("");u.element.find(".e-searchbar .e-search.e-tooltxt").removeClass("e-highliht-kbnsearchbar");ej.isNullOrUndefined(i.model.fields.swimlaneKey)||(o=(new ej.Query).where(ej.Predicate.or(i.keyPredicates)).select(i.model.fields.swimlaneKey),i._kbnAdaptDdlData=new ej.DataManager(i._currentJsonData).executeLocal(o),i._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(i._kbnAdaptDdlData)),i.KanbanAdaptive._adaptiveSwimlaneRefresh());r.data("ejWaitingPopup").hide()},300)},n.prototype._adaptiveKbnClick=function(n){var t=this.kanbanObj,i=$(n.target),r,s,e=t.element.find(".e-swimlane-window"),y,rt,ut,p,o,w,ft,c,l,h,et,u,g,nt,b,k,tt,a,v,ot,d,it,f;if(t.element.hasClass("e-responsive")){if(r=$(".e-kanbanfilter-window"),s=t.element.find(".e-kanbanfilter-icon"),i.hasClass("e-searchitem")&&(y=i.parents(".e-searchbar"),i.prev().show(),i.prev().children(":first").removeAttr("style"),y.siblings().hide(),y.find(".e-adapt-search").length==0&&(rt=ej.buildTag("div.e-icon e-adapt-search e-searchfind","",{}),ut=ej.buildTag("div.e-icon e-adapt-cancel e-cancel","",{}),i.siblings(".e-searchdiv").append(ut).prepend(rt)),i.parents(".e-search").css({border:""}),i.parents("body").addClass("e-kbnwindow-modal"),i.parents(".e-kanbantoolbar").addClass("e-adaptive-search"),y.find(".e-adapt-cancel").show(),i.hide(),n.type==="tap"&&n.preventDefault()),i.hasClass("e-adapt-cancel")&&(this._clearAdaptSearch(n),i.parents(".e-searchbar").siblings(".e-print,.e-kanbanfilter-icon,.e-customtoolbar").show(),p=i.parents(".e-search"),p.find(".e-searchdiv").hide(),p.find(".e-searchitem").show(),p.css({border:"none"}),i.parents("body").removeClass("e-kbnwindow-modal"),i.parents(".e-kanbantoolbar").removeClass("e-adaptive-search")),(i.hasClass("e-filter-done")||i.hasClass("e-clearfilter"))&&(h=i.text(),r.parents("body").removeClass("e-kbnwindow-modal"),i.hasClass("e-clearfilter")&&(h=i.val()),o={target:i,currentTarget:i,itemIndex:i.index(),toolbarData:n,itemText:h},t._trigger("toolbarClick",o),i.hasClass("e-clearfilter")?(t._kbnFilterCollection=[],t._kbnFilterObject=[],t._filterCollection=[],t._kbnAdaptFilterObject=[],i.hide(),s.removeClass("e-kbnclearfl-icon"),r.find(".e-kbnfilter-check").parents('[aria-checked~="true"]').click()):(s.hasClass("e-kbnclearfl-icon")||s.addClass("e-kbnclearfl-icon"),t._kbnFilterObject.length==0&&s.hasClass("e-kbnclearfl-icon")&&s.removeClass("e-kbnclearfl-icon")),o={},o.requestType=ej.Kanban.Actions.Filtering,o.currentFilterObject=[],o.filterCollection=t._kbnFilterCollection,o.currentFilterObject=t._kbnFilterObject,w=t._dataSource()instanceof ej.DataManager?t._dataSource().dataSource.json:t._dataSource(),w.length==0&&t._currentJsonData.length>0&&(w=t._currentJsonData),t._initialData=w,t.KanbanCommon._processBindings(o),ej.isNullOrUndefined(t.model.fields.swimlaneKey)||(t._currentJsonData.length==0?(t.element.find(".e-swimlane-ddl,.e-swimlane-window").remove(),t.kanbanContent.data("ejScroller").destroy()):(ft=(new ej.Query).where(ej.Predicate.or(t.keyPredicates)).select(t.model.fields.swimlaneKey),t._kbnAdaptDdlData=new ej.DataManager(t._currentJsonData).executeLocal(ft),t._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(t._kbnAdaptDdlData)),t.KanbanAdaptive._adaptiveSwimlaneRefresh())),r.hide(),t.kanbanWindowResize(),n.type==="tap"&&n.preventDefault()),i.hasClass("e-filterback-icon")){for(c=[],u=0;u<t.model.filterSettings.length;u++)c.push(t.model.filterSettings[u].text);for(u=0;u<t._kbnAdaptFilterObject.length;u++)h=t._kbnAdaptFilterObject[u].text,et=$.inArray(h,c),c.splice(et,1),l=r.find("label.e-filterlabel:contains("+h+")").prev(),l.attr("aria-checked")=="false"&&l.click();for(u=0;u<c.length;u++)l=r.find("label.e-filterlabel:contains("+c[u]+")").prev(),l.attr("aria-checked")=="true"&&l.click();r.hide();n.type==="tap"&&n.preventDefault()}i.hasClass("e-kanbanfilter-icon")&&(g=r.find(".e-clearfilter"),k=0,tt=r.find(".e-filter-scrollcontent"),e.is(":visible")&&e.hide(),r.show(),i.hasClass("e-kbnclearfl-icon")?g.show():g.hide(),nt=r.find(".e-kbnfilterwindow-head").height(),b=r.find(".e-clearfilter"),b.is(":visible")&&(tt.ejScroller({height:0,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),k=b.outerHeight()+parseInt(b.css("bottom"))),$(window).height()-k<r.find(".e-filter-content").height()+nt&&tt.ejScroller({height:$(window).height()-(nt+k+10),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),r.parents("body").addClass("e-kbnwindow-modal"),n.type==="tap"&&n.preventDefault());(i.attr("id")==this._id+"_Cancel"||i.parent().attr("id")==this._id+"_closebutton")&&t.KanbanEdit.cancelEdit();i.attr("id")==t._id+"_Save"&&t.KanbanEdit.endEdit()}a=t.element.find(".e-slwindow-scrollcontent");(i.hasClass("e-swimlane-item")||i.parents(".e-swimlane-item").length>0)&&(v=i,i.parents(".e-swimlane-item").length>0&&(v=i.parents(".e-swimlane-item")),v.parents(".e-swimlane-ul").find(".e-selected-item").removeClass("e-selected-item"),v.addClass("e-selected-item"),e=$("#"+t._id+"_slWindow"),t._kbnAdaptDdlIndex=t._freezeSlOrder=e.find(".e-swimlane-item").index(v),f=$("#"+t._id+"_toolbarItems"),f.find(".e-kbnhide").removeClass("e-kbnhide"),f.removeClass("e-kbntoolbar-body").prependTo(t.element),e.removeClass("e-kbnslwindow-body").appendTo(t.element).hide(),t.element.find(".e-swimlane-text").text(t._kbnAdaptDdlData[t._kbnAdaptDdlIndex]),ot=t.element[0].getElementsByClassName("e-columnrow"),t.kanbanWindowResize(),d=t.kanbanContent.data("ejScroller"),d.scrollY(0,!0),d.scrollY($(ot[t._kbnAdaptDdlIndex]).offset().top-t.kanbanContent.offset().top,!0),t._freezeScrollTop=d.scrollTop(),a.hasClass("e-scroller")&&a.data("ejScroller").refresh());(i.hasClass("e-swimlane-ddl")||i.parents(".e-swimlane-ddl").length>0)&&(it=36,e.is(":hidden")?(t.element.parents("body").addClass("e-kbnwindow-modal"),f=t.element.find(".e-kanbantoolbar"),f.children().not(".e-swimlane-ddl").addClass("e-kbnhide"),f.addClass("e-kbntoolbar-body").appendTo("body"),t.element.find(".e-swimlane-window").addClass("e-kbnslwindow-body").appendTo("body"),e.show(),$(window).height()<it+a.height()&&a.ejScroller({height:$(window).height()-it,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0})):(e.hide(),f=$("#"+t._id+"_toolbarItems"),f.find(".e-kbnhide").removeClass("e-kbnhide"),f.removeClass("e-kbntoolbar-body").prependTo(t.element),$("#"+t._id+"_slWindow").removeClass("e-kbnslwindow-body").appendTo(t.element).hide(),t.element.parents("body").removeClass("e-kbnwindow-modal")))},n.prototype._kbnFilterChange=function(n){var t=this,s=$(n.event.target).closest(".e-kanban"),l=s.data("ejKanban"),e=$(n.event.target).parents(".e-chkbox-wrap").next().text(),c,o,u,i,f,r,h;if(!t._kbnAutoFilterCheck){for(e==""&&(e=$(n.event.target).next().text()),c=s.find(".e-kanbanfilter-icon"),o=$(".e-kanbanfilter-window .e-filter-done"),o.is(":hidden")&&o.show(),i=0;i<t.model.filterSettings.length;i++)if(t.model.filterSettings[i].text==e)break;if(u=i==t.model.filterSettings.length?null:t.model.filterSettings[i],n.isChecked)for(t._kbnFilterObject.push(u),r=0;r<t.model.filterSettings.length;r++)t.model.filterSettings[r].text==u.text&&(h=t.model.filterSettings[r].query.queries[0].e,t._kbnFilterCollection.push(h));else f=$.inArray(u,t._kbnFilterObject),f>=0&&(t._kbnFilterObject.splice(f,1),t._kbnFilterCollection.splice(f,1))}},n.prototype._kbnAdaptSwimlaneData=function(){var n=this.kanbanObj,r=n,t,i;n.model.isResponsive&&(ej.isNullOrUndefined(n.model.minWidth)||n.model.minWidth==0)&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey)&&(t=new ej.Query,ej.isNullOrUndefined(n.model.keyField)||n._addColumnFilters(),n.model.query._fromTable!=""&&t.from(n.model.query._fromTable),n._dataSource()instanceof ej.DataManager&&t.queries.length&&!n._dataManager.dataSource.offline?(i=n._dataSource().executeQuery(t),i.done(ej.proxy(function(i){this._kbnAdaptDdlData=new ej.DataManager(i.result);t=(new ej.Query).where(ej.Predicate.or(n.keyPredicates)).select(n.model.fields.swimlaneKey);n._kbnAdaptDdlData=n._kbnAdaptDdlData.executeLocal(t);n._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(n._kbnAdaptDdlData))}))):(t=(new ej.Query).where(ej.Predicate.or(n.keyPredicates)).select(n.model.fields.swimlaneKey),n._dataManager.dataSource.offline&&n._dataManager.dataSource.json.length&&(n._kbnAdaptDdlData=n._dataManager.executeLocal(t)),n._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(n._kbnAdaptDdlData))))},n.prototype._setResponsiveHeightWidth=function(){var n=this.kanbanObj;if(typeof n.model.scrollSettings.width=="string"?n._originalScrollWidth=n.element.width():n.model.scrollSettings.width>0&&(n._originalScrollWidth=n.model.scrollSettings.width),typeof n.model.scrollSettings.height=="string"?n._originalScrollHeight=n.getContent().height():n.model.scrollSettings.height>0&&(n._originalScrollHeight=n.model.scrollSettings.height),n.model.isResponsive){$(window).on("resize",$.proxy(n.kanbanWindowResize,n));n.kanbanWindowResize()}},n.prototype._renderResponsiveKanban=function(n,t,i,r,u){var f=this.kanbanObj,e;n?(f.model.scrollSettings.width=ej.isNullOrUndefined(f._originalScrollWidth)?Math.min(i,u):Math.min(f._originalScrollWidth,Math.min(i,u)),e=Math.min(r,t),e=ej.isNullOrUndefined(f._originalScrollHeight)?e:Math.min(f._originalScrollHeight,r),f.model.scrollSettings.height=e,f._originalScrollWidth<u&&(f.model.scrollSettings.width=Math.min(i,u)),f.KanbanScroll&&f.KanbanScroll._renderScroller()):(f.model.scrollSettings.width="100%",ej.isNullOrUndefined(f._originalScrollWidth)||(f.model.scrollSettings.width=Math.min(f._originalScrollWidth,i)),e=f.element.outerHeight(),ej.isNullOrUndefined(f._originalScrollHeight)||(e=Math.min(f._originalScrollHeight,r)),f.model.scrollSettings.height=e,f.KanbanScroll&&f.KanbanScroll._renderScroller())},n.prototype._columnTimeoutAdapt=function(){var t=this.kanbanObj,i,e,o,f,n,s,r,u;for(Math.floor(t.element.width())>$(window).width()&&(t.element.width($(window).width()-t.element.offset().left-5),t.headerContent.removeClass("e-scrollcss"),t.headerContent.find(".e-hscrollcss").removeClass("e-hscrollcss")),n=t,window.matchMedia("(max-width: 480px)").matches?i=t.element.width()*(80/100):window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?i=t.element.width()*(60/100):(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(i=t.element.width()*(43/100)),e=t.element.find(".e-headercell"),o=t.element.find(".e-columnrow .e-rowcell"),t.kanbanContent.find("table:eq(0) > colgroup col").width(i),o.width(i),t.headerContent.find("table > colgroup col").width(i),e.not(".e-stackedHeaderCell").width(i),f=t.element.find(".e-stackedHeaderCell"),u=0;u<f.length;u++)$(f).eq(u).width(parseInt($(f).eq(u).attr("colspan"))*i);s=setTimeout(function(){var u,f,h;n._kbnSwipeCount>0&&(r=o.eq(n._kbnSwipeCount),r.length==0&&(r=e.not(".e-stackedHeaderCell").eq(t._kbnSwipeCount)),n._kbnSwipeWidth=n._kbnSwipeWidth-r.offset().left,u=n.element.width(),f=r.width(),window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?i=n._kbnSwipeCount==n.model.columns.length-1?n.element.hasClass("e-swimlane-responsive")?u-(f+18):u-f:(u-f)/2:(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(n._kbnSwipeCount==n.model.columns.length-3?(h=parseInt(n.contentTable.css("border-spacing").split("px")[0]),eqWidth=u-(f+h)*2):i=(u-f)/8),n._kbnSwipeWidth=n._kbnSwipeWidth+i+t.element.offset().left,n.headerContent.find("table").css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":"0ms"}),n.kanbanContent.find("table").eq(0).css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":"0ms"}),clearTimeout(s))},2500)},n.prototype._addSwimlaneName=function(){for(var r,i,n,u,f=this.kanbanObj.element.find(".e-columnrow"),t=0;t<f.length;t++)for(r=f.eq(t).find(".e-rowcell"),i=0;i<r.length;i++)n=r.eq(i).find(".e-limits"),n.length==0&&(n=ej.buildTag("div.e-limits","",{},{})),n.find(".e-swimlane-name").length==0?(n.append(ej.buildTag("div.e-swimlane-name",this.kanbanObj._kbnAdaptDdlData[t],{},{})),r.eq(i).prepend(n)):(u=n.find(".e-swimlane-name"),u.text(this.kanbanObj._kbnAdaptDdlData[t]),u.show(),u.parents(".e-limits").show())},n.prototype._kbnAdaptSwimlaneDdl=function(){var n=this.kanbanObj,r=ej.buildTag("div.e-swimlane-ddl","",{}),o=n.model.fields.swimlaneKey,u,t,f,e=n.element.find(".e-kanbantoolbar"),i;for(n.element.addClass("e-swimlane-responsive"),ej.buildTag("div.e-swimlane-text",n._kbnAdaptDdlData[0]).appendTo(r),ej.buildTag("div.e-swimlane-arrow").appendTo(r),u=ej.buildTag("div#"+n._id+"_slWindow.e-swimlane-window","",{}),t=ej.buildTag("ul.e-swimlane-ul ","",{}),i=0;i<n._kbnAdaptDdlData.length;i++)ej.buildTag("li.e-swimlane-item ","<div>"+n._kbnAdaptDdlData[i]+"<\/div>",{}).appendTo(t);t.find(".e-swimlane-item:eq(0)").addClass("e-selected-item");this._addSwimlaneName();f=ej.buildTag("div#"+n._id+"_slScrollContent","<div><\/div>").addClass("e-slwindow-scrollcontent");f.children().append(t);f.appendTo(u);u.appendTo(n.element).hide();e.length==0&&(n._renderToolBar().insertBefore(n.element.find(".e-kanbanheader").first()),e=n.element.find(".e-kanbantoolbar").css("padding","0px").addClass("e-sladapt-bar"));e.prepend(r);n.element.find(".e-swimlanerow").hide()},n.prototype._kbnAdaptFilterWindow=function(){var n=this.kanbanObj,h=n.element.find(".e-kanbantoolbar"),i,e,u,o,c,r,s,t,f;for(h.find(".e-quickfilter").parent().hide(),r=ej.buildTag("div.e-kanbanfilter-window","",{}),i=ej.buildTag("div.e-kbnfilterwindow-head","",{}),ej.buildTag("div.e-filterback-icon","",{}).appendTo(i),ej.buildTag("div.e-text","FILTER",{}).appendTo(i),ej.buildTag("div.e-text e-filter-done","DONE",{}).appendTo(i).hide(),i.appendTo(r),$("body").append(r.hide()),e=ej.buildTag("div.e-kbnfilterwindow-body","",{}),o=ej.buildTag("div.e-filter-content"),t=0;t<n.model.filterSettings.length;t++)f=ej.buildTag("div","",{}),f.append("<input type='checkbox' class='e-kbnfilter-check' id='check"+t+"' /><label for='check"+t+"' class='e-filterlabel'>"+n.model.filterSettings[t].text+"<\/label><\/td>"),o.append(f),f.find("input").ejCheckBox({change:$.proxy(this._kbnFilterChange,n)});e.append(o);s=ej.buildTag("div#"+n._id+"_filterScrollContent","<div><\/div>").addClass("e-filter-scrollcontent");s.children().append(e);s.appendTo(r);u=ej.buildTag("input.e-clearfilter","",{},{type:"button",id:n._id+"_ClearFilter"});u.ejButton({text:"ClearFilter"});r.append(u);u.hide();c=ej.buildTag("div.e-kanbanfilter-icon","",{float:"right"});h.append(c)},n.prototype._setAdaptiveSwimlaneTop=function(){var n=this.kanbanObj,i,r,t;n.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey)&&(i=n.kanbanContent.data("ejScroller"),r=n.element[0].getElementsByClassName("e-columnrow"),t=n._freezeScrollTop,i.scrollY(t,!0),n._freezeScrollTop=t)},n.prototype._adaptiveSwimlaneRefresh=function(){var n=this.kanbanObj,r,i,t;for(n.element.find(".e-swimlane-window .e-swimlane-ul").empty(),i=0;i<n._kbnAdaptDdlData.length;i++)ej.buildTag("li.e-swimlane-item ","<div>"+n._kbnAdaptDdlData[i]+"<\/div>",{}).appendTo(n.element.find(".e-swimlane-window .e-swimlane-ul"));if(n.KanbanAdaptive&&n.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey)){for(n.KanbanAdaptive._addSwimlaneName(),r=n.kanbanContent.find(".e-columnrow"),t=0;t<r.length;t++)if(r.eq(t).offset().top>=0){n.element.find(".e-swimlane-text").text(n._kbnAdaptDdlData[t]);break}n.kanbanContent.hasClass("e-scroller")&&n.kanbanContent.data("ejScroller").refresh()}},n.prototype._removeKbnAdaptItems=function(){var n=this.kanbanObj,u,nt,l,a,f,v,tt,e,y,p,w,t,b,s,o,k;if(n.element.hasClass("e-responsive")){var i=n.element.find(".e-kanbantoolbar"),d=n.element.find(".e-stackedHeaderCell"),h,g=n.element.find(".e-swimlane-ddl"),c=$(".e-kanbanfilter-window"),r;if(g.length>0&&(g.remove(),n.element.find(".e-swimlane-window").remove()),i.hasClass("e-sladapt-bar")&&i.remove(),c.length>0){for(u=c.find(".e-filter-content").children(),t=0;t<u.length;t++)u.eq(t).find("span.e-chkbox-wrap").attr("aria-checked")=="true"&&(nt=u.index(u.eq(t)),n.element.find(".e-quickfilter").nextAll("li.e-tooltxt").eq(nt).addClass("e-select"));c.remove()}if(d.length>0&&d.width(""),n.element.find(".e-rowcell,.e-headercell").width(""),n.kanbanContent.find("table:eq(0) > colgroup col").width(""),n.headerContent.find("table > colgroup col").width(""),!n.element.hasClass("e-swimlane-responsive"))for(h=n.element.find(".e-rowcell .e-cell-scrollcontent:visible"),t=0;t<h.length;t++)l=$(h[t]).data("ejScroller"),ej.isNullOrUndefined(l)||l.destroy();for(i.length>0&&i.is(":visible")&&(i.css("display","block"),a=i.find(".e-quickfilter"),f=i.find(".e-searchbar"),i.find(".e-adapt-cancel").is(":visible")&&f.find(".e-searchitem").addClass("e-cancel").removeClass("e-searchfind"),i.find(".e-adapt-cancel,.e-adapt-search").hide(),a.length>0&&(i.find(".e-kanbanfilter-icon").remove(),a.parent(".e-ul.e-horizontal").show()),v=f.find(".e-searchdiv"),v.length>0&&(v.show(),f.find(".e-search").css("border",""),f.find(".e-searchitem").show(),i.parents("body").removeClass("e-kbnwindow-modal"),i.removeClass("e-adaptive-search"))),n.headerContent.find("table").css({transform:"","transition-duration":""}),n.kanbanContent.find("table").eq(0).css({transform:"","transition-duration":""}),r=n.element.find(".e-cell-scrollcontent"),t=0;t<r.length;t++)tt=r.eq(t).children(),tt.children().appendTo(r.eq(t).parents(".e-rowcell")),r.eq(t).remove();if(e=n.element.find(".e-kanbandialog"),e.is(":visible")&&(y=e.parents(".e-dialog-scroller"),p=e.parents(".e-dialog"),p.css({top:"",left:""}).removeClass("e-kbnadapt-editdlg"),y.css("height","auto"),y.ejScroller({height:0,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),e.parents("body").removeClass("e-kbnwindow-modal"),p.hide(),n.KanbanEdit._onKbnDialogOpen()),!ej.isNullOrUndefined(n.model.fields.swimlaneKey))for(n.kanbanContent.hasClass("e-scroller")&&n.kanbanContent.data("ejScroller").destroy(),n.element.parents("body").removeClass("e-kbnwindow-modal"),n.element.find(".e-swimlanerow").show(),w=n.element.find(".e-columnrow"),t=0;t<w.length;t++)for(b=w.eq(t).find(".e-rowcell"),s=0;s<b.length;s++)o=b.eq(s).find(".e-swimlane-name"),o.length>0&&(o.siblings().length==0?o.parents(".e-limits").hide():o.hide());k=n.element.find(".e-adapt-stheader");k.length>0&&k.find("div").css({position:"",left:""});n.element.removeClass("e-responsive");n.element.removeClass("e-swimlane-responsive")}},n.prototype._setAdaptEditWindowHeight=function(){var r=this.kanbanObj,n,t,i;n=$("#"+r._id+"_dialogEdit");t=n.parents(".e-dialog-scroller");i;n.parents(".e-dialog").css({top:"0",left:"0"}).addClass("e-kbnadapt-editdlg");n.parents("body").addClass("e-kbnwindow-modal");i=t.prev(".e-titlebar");t.ejScroller({height:$(window).height()-i.outerHeight(),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0});t.data("ejScroller").refresh();n.css("height",t.height())},n}();window.ej.createObject("ej.KanbanFeatures.Adaptive",InternalAdaptive,window);InternalScroller=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._initScrolling=function(){var n=this.kanbanObj;(n.model.width||n.model.height)&&(n.model.allowScrolling=!0,n.model.width&&(n.model.scrollSettings.width=n.model.width),n.model.height&&(n.model.scrollSettings.height=n.model.height));n._originalScrollWidth=n.model.scrollSettings.width},n.prototype._renderScroller=function(){var n=this.kanbanObj,i,r,u,f,t,e;n.model.scrollSettings||(n.model.scrollSettings={});typeof n._originalScrollWidth=="string"&&(n.element.css("width","auto"),i=n.element.width(),(n.model.scrollSettings.width=="auto"||n._originalScrollWidth=="auto")&&(n._originalScrollWidth="100%"),n.model.scrollSettings.width=i*(parseFloat(n._originalScrollWidth)/100));typeof n.model.scrollSettings.height=="string"&&(r=n.element.height(),n.model.scrollSettings.height=="auto"&&(n.model.scrollSettings.height="100%"),n.model.scrollSettings.height=r*(parseFloat(n.model.scrollSettings.height)/100));(n.model.scrollSettings.width||n.model.width)&&n.element.width(n.model.scrollSettings.width||n.model.width);u=n.model.scrollSettings.height!=0?n.model.scrollSettings.height-n.getHeaderTable().height()-(!ej.isNullOrUndefined(n._filterToolBar)&&n._filterToolBar.height()):n.model.scrollSettings.height;f=n.getContent().attr("tabindex","0");n.element.addClass("e-kanbanscroll");f.ejScroller({enableRTL:n.model.enableRTL,height:u,width:n.model.scrollSettings.width,thumbStart:$.proxy(n._kbnThumbStart,n),scroll:$.proxy(n._freezeSwimlane,n)});n.getContent().ejScroller("isVScroll")?(n.element.find(".e-kanbanheader").addClass("e-scrollcss"),n.getHeaderContent().find("div").first().addClass("e-headercontent")):n.element.find(".e-kanbanheader").removeClass("e-scrollcss");(n.model.scrollSettings.width||n.model.width)&&n.element.width(n.model.scrollSettings.width||n.model.width);t=n.getContent().data("ejScroller");e=t&&t.isVScroll()?"addClass":"removeClass";n.getHeaderContent().find(".e-headercontent")[e]("e-hscrollcss");this._refreshHeaderScroller()},n.prototype._refreshHeaderScroller=function(){var n=this.kanbanObj;this.kanbanObj.getContent().find(".e-content").scroll(ej.proxy(function(t){n.getHeaderContent().find("div").first().scrollLeft($(t.currentTarget).scrollLeft())}));this.kanbanObj.element.find(".e-kanbanheader").find(".e-headercontent").scroll(ej.proxy(function(t){var i=$(t.currentTarget);n.getContent().find(".e-content").first().scrollLeft(i.scrollLeft())}))},n.prototype._refreshScroller=function(n){var t=this.kanbanObj,i=t.getContent().first();ej.isNullOrUndefined(i.data("ejScroller"))||(n.requestType=="beginedit"&&t.getScrollObject().scrollY(0,!0),i.ejScroller("refresh"),i.ejScroller({enableRTL:t.model.enableRTL}),i.ejScroller("isVScroll")&&!t.getScrollObject().model.autoHide?(t.getHeaderContent().addClass("e-scrollcss"),t.getHeaderContent().find(".e-headercontent").hasClass("e-hscrollcss")||t.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):t.element.find(".e-kanbanheader").removeClass("e-scrollcss"))},n}();window.ej.createObject("ej.KanbanFeatures.Scroller",InternalScroller,window);InternalSelection=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._cardSelection=function(n,t,i){var r=this.kanbanObj,l,c,f=null,o=null,w,s,d,v,y,h,p;if(l=t.parent("td.e-rowcell"),r._currentRowCellIndex.length>0&&(r._previousRowCellIndex=[[r._currentRowCellIndex[0][0],[r._currentRowCellIndex[0][1][0]],[r._currentRowCellIndex[0][2][0]]]]),ej.isNullOrUndefined(t.attr("id"))||(w=new ej.DataManager(r._currentJsonData),o=w.executeLocal((new ej.Query).where(r.model.fields.primaryKey,ej.FilterOperators.equal,t.attr("id")))),ej.isNullOrUndefined(r._previousRowCellIndex)||r._previousRowCellIndex.length==0||(f=r.KanbanCommon._getCardbyIndexes(r._previousRowCellIndex)),c={currentCell:l,target:t,cellIndex:n[0][1][0],cardIndex:n[0][2][0],data:o,previousRowCellIndex:r._previousRowCellIndex,previousCard:f,selectedCardsData:r._selectedCardData},!r._trigger("beforeCardSelect",c)){if($(t).hasClass("e-cardselection")||(r.model.selectionType!="multiple"||r._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")||r._kTouchBar.hide(),i.pointerType!="touch"||r._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")||r.model.selectionType!="multiple"||(s=$(t).offset(),r._kTouchBar.show(),r._kTouchBar.offset({top:s.top,left:s.left}))),i.pointerType=="touch"&&$(t).hasClass("e-cardselection")&&r._kTouchBar.is(":hidden")&&(s=$(t).offset(),r._kTouchBar.show(),r._kTouchBar.offset({top:s.top,left:s.left})),r.model.selectionType=="multiple"&&i.shiftKey){var a,e,u=0,b=0,g=t,k=[];for(ej.isNullOrUndefined(f)?e=t.parents(".e-columnrow").find(".e-kanbancard"):(a=f.parents(".e-columnrow"),a.find(".e-cardselection").not(f).removeClass("e-cardselection"),e=a.find(".e-kanbancard"),u=e.index(f)),r._selectedCards=[],r._selectedCardData=[],r.selectedRowCellIndexes=[];b<=0;)y=[],d=$(e[u]).parents(".e-columnrow"),v=$(e[u]).parents(".e-rowcell"),$(e[u]).addClass("e-cardselection"),k.push(e[u]),r._selectedCardData.push(r.KanbanCommon._getKanbanCardData(r._currentJsonData,e[u].id)[0]),y=[[r.element.find(".e-columnrow").index(d),[v.index()],[v.find($(e[u])).index()]]],e[u].id==g.attr("id")&&(b=1),this._pushIntoSelectedArray(y),ej.isNullOrUndefined(f)?++u:n[0][1][0]<r._previousRowCellIndex[0][1][0]?--u:n[0][1][0]==r._previousRowCellIndex[0][1][0]?n[0][2][0]<r._previousRowCellIndex[0][2][0]?--u:++u:++u;ej.isNullOrUndefined(f)&&(r._previousRowCellIndex=r._currentRowCellIndex=[[0,[0],[0]]],f=r.KanbanCommon._getCardbyIndexes(r._previousRowCellIndex));r._selectedCards=[];r._selectedCards[r._selectedCards.length]=k;!ej.isNullOrUndefined(f)||i.ctrlKey||i.shiftKey||r._enableMultiTouch||($(t).addClass("e-cardselection"),r._selectedCards.push(t[0]),r._selectedCardData.push(r.KanbanCommon._getKanbanCardData(r._currentJsonData,t.id)[0]),this._pushIntoSelectedArray(n))}if(r.model.selectionType=="multiple"&&(i.ctrlKey||r._enableMultiTouch))if($(t).hasClass("e-cardselection")){for($(t).removeClass("e-cardselection"),this._popFromSelectedArray(n[0][0],n[0][1],n[0][2],i),h=0;h<r._selectedCardData.length;h++)if(o[0][r.model.fields.primaryKey]==r._selectedCardData[0][r.model.fields.primaryKey])break;r._selectedCardData.splice(h,1);r._selectedCards.splice(h,1);r._currentRowCellIndex=n}else $(t).addClass("e-cardselection"),r._selectedCards.push(t[0]),this._pushIntoSelectedArray(n),r._selectedCardData.push(o[0]);else r.model.selectionType=="multiple"&&i.shiftKey||(p=n[0][2],r.element.find(".e-cardselection").removeClass("e-cardselection"),r._selectedCards=[],r.selectedRowCellIndexes=[],$(t).addClass("e-cardselection"),r._selectedCardData=[],r._selectedCardData.push(o[0]),r._selectedCards.push(t[0]),r.model.selectionType=="multiple"&&(p=[n[0][2]]),r.selectedRowCellIndexes.push({rowIndex:n[0][0],cellIndex:n[0][1],cardIndex:p}));(c={currentCell:l,target:t,cellIndex:n[0][1][0],cardIndex:n[0][2][0],data:o,selectedRowCellIndex:r.selectedRowCellIndexes,previousRowCellIndex:r._previousRowCellIndex,previousCard:f,selectedCardsData:r._selectedCardData},r.model.selectionType=="multiple"&&i.shiftKey&&$(t).hasClass("e-cardselection")?(r._previousRowCellIndex.length==0&&(r._currentRowCellIndex=[[t.parents(".e-columnrow").index(),[0],[0]]]),r._currentRowCellIndex.length==0&&(r._currentRowCellIndex=n)):$(t).hasClass("e-cardselection")&&(r._currentRowCellIndex=n),r._trigger("cardSelect",c))||r.element.focus()}},n.prototype.clear=function(){var n=this.kanbanObj,t;n.model.allowSelection&&(t=$(n._kanbanRows).not(".e-swimlanerow"),$(t).find(".e-rowcell .e-kanbancard").removeClass("e-cardselection"),n.selectedRowCellIndexes=[],n._selectedCardData=[],n._selectedCards=[],n._previousRowCellIndex=[],n._currentRowCellIndex=[])},n.prototype._pushIntoSelectedArray=function(n){for(var i=this.kanbanObj,r=0,f=!0,e=!0,u,o,t=0;t<i.selectedRowCellIndexes.length;t++)if(u=i.selectedRowCellIndexes[t],u.rowIndex==n[0][0]){for(f=!1,r=0;r<u.cellIndex.length;r++)if(o=u.cellIndex[r],o==n[0][1][0]){e=!1;break}break}f&&i.selectedRowCellIndexes.push({rowIndex:n[0][0],cellIndex:n[0][1],cardIndex:[n[0][2]]});e?f||(i.selectedRowCellIndexes[t].cellIndex.push(n[0][1][0]),i.selectedRowCellIndexes[t].cardIndex.push([n[0][2][0]])):i.selectedRowCellIndexes[t].cardIndex[r].push(n[0][2][0])},n.prototype._popFromSelectedArray=function(n,t,i,r){var e=this.kanbanObj,o,f,s,u,h,c;if(e.model.selectionType=="multiple"&&(r.ctrlKey||r.shiftKey||e._enableMultiTouch))for(o=0;o<e.selectedRowCellIndexes.length;o++)if(u=e.selectedRowCellIndexes[o],u.rowIndex==n)for(f=0;f<u.cellIndex.length;f++)if(h=u.cellIndex[f],h==t[0])if(r.shiftKey){u.cardIndex=[];break}else for(s=0;s<u.cardIndex[f].length;s++)if(c=u.cardIndex[f][s],c==i[0]){u.cardIndex[f].splice(s,1);u.cardIndex[f].length==0&&(u.cardIndex.splice(f,1),u.cellIndex.splice(f,1));u.cellIndex.length==0&&e.selectedRowCellIndexes.splice(o,1);break}},n.prototype._selectionOnRerender=function(){var s,e,t,o=!0,n=this.kanbanObj,r,u,i,f,c,h;if(n.model.allowSelection){if(n.model.selectionType=="single")n._selectedCards.length>0&&(u=$(n._selectedCards[0]),i=n.element.find("#"+u[0].id),i.hasClass("e-kanbancard")?(e=$(i).parents(".e-columnrow"),t=$(i).parents(".e-rowcell"),n._selectedCards=[],n._selectedCards=i.addClass("e-cardselection"),n._currentRowCellIndex=n._previousRowCellIndex=[],n._currentRowCellIndex.push([e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]]),n._currentRowCellIndex=n._previousRowCellIndex,n.selectedRowCellIndexes=[],n.selectedRowCellIndexes.push({rowIndex:n._currentRowCellIndex[0][0],cellIndex:n._currentRowCellIndex[0][1][0],cardIndex:n._currentRowCellIndex[0][2][0]})):(n._selectedCards=[],n._selectedCardData=[],n.selectedRowCellIndexes=[],n._currentRowCellIndex=n._previousRowCellIndex=[]));else{for(r=0;r<n._selectedCards.length;r++)if($(n._selectedCards[r]).length>1)for(f=0;f<n._selectedCards[r].length;f++)u=$(n._selectedCards[r][f]),i=n.element.find("#"+u[0].id),e=$(i).parents(".e-columnrow"),t=$(i).parents(".e-rowcell"),i.hasClass("e-kanbancard")?(o=!0,n._selectedCards[r].splice(f,0,i[0]),i.addClass("e-cardselection"),n._selectedCards[r].splice(f+1,1),r==0&&f==0&&(n._currentRowCellIndex=n._previousRowCellIndex=[],n._currentRowCellIndex.push([e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]]),n._currentRowCellIndex=n._previousRowCellIndex,n.selectedRowCellIndexes=[]),c=[e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]],this._pushIntoSelectedArray([c])):(o=!1,n._selectedCards[r].splice(f,1),h=n._selectedCardData.indexOf(n.KanbanCommon._getKanbanCardData(n._selectedCardData,u[0].id)[0]),n._selectedCardData.splice(h,1),--f);else u=$(n._selectedCards[r]),i=n.element.find("#"+u[0].id),e=$(i).parents(".e-columnrow"),t=$(i).parents(".e-rowcell"),i.hasClass("e-kanbancard")?(o=!0,i.addClass("e-cardselection"),n._selectedCards[r]=i[0],r==0&&(n._currentRowCellIndex=n._previousRowCellIndex=[],n._currentRowCellIndex.push([e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]]),n._currentRowCellIndex=n._previousRowCellIndex,n.selectedRowCellIndexes=[]),c=[e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]],this._pushIntoSelectedArray([c])):(o=!1,n._selectedCards.splice(r,1),h=n._selectedCardData.indexOf(n.KanbanCommon._getKanbanCardData(n._selectedCardData,u[0].id)[0]),n._selectedCardData.splice(h,1),--r);!o&&n._selectedCards.length<=0&&(n._currentRowCellIndex=n._previousRowCellIndex=n.selectedRowCellIndexes=[])}s=n.element.find(".e-columnrow").index(n.element.find(".e-cardselection").eq(0).parents(".e-columnrow"));s>=0&&(n.selectedRowCellIndexes[0].rowIndex=n._currentRowCellIndex[0][0]=s,n._previousRowCellIndex.length>0&&(n._previousRowCellIndex[0][0]=s))}},n.prototype._renderKanbanTouchBar=function(){var n=this.kanbanObj;n._kTouchBar=ej.buildTag("div.e-kanbantouchbar","",{display:"none"},{});var t=ej.buildTag("div.e-content","",{},{}),i=ej.buildTag("div.e-downtail e-tail","",{},{}),r=ej.buildTag("span.e-cardtouch e-icon","",{},{});t.append(r);n._kTouchBar.append(t);n._kTouchBar.append(i);n.element.append(n._kTouchBar)},n.prototype._updateSelectedCardIndexes=function(n){var e,f,t=this.kanbanObj,i,r,u;if(t.selectedRowCellIndexes.length>0)for($(n).hasClass("e-rowcell")?f=$(n).index():(n=t.element.find("#"+$(n).attr("id")),f=$(n).parents(".e-rowcell").index()),e=$(n).parents(".e-columnrow"),$.inArray(f,t.selectedRowCellIndexes[0].cellIndex)==-1&&t.selectedRowCellIndexes[0].cellIndex.push(f),i=0;i<t.selectedRowCellIndexes[0].cellIndex.length;i++)if(r=e.find(".e-rowcell").eq(t.selectedRowCellIndexes[0].cellIndex[i]).find(".e-cardselection"),r.length>0)for(t.selectedRowCellIndexes[0].cardIndex.splice(i,1),t.element.find(".e-targetclone").remove(),u=0;u<r.length;u++)u>0?t.selectedRowCellIndexes[0].cardIndex[i].push($(r[u]).index()):t.selectedRowCellIndexes[0].cardIndex.splice(i,0,[$(r[0]).index()]);else t.selectedRowCellIndexes[0].cellIndex.splice(i,1),t.selectedRowCellIndexes[0].cardIndex.splice(i,1),--i},n}();window.ej.createObject("ej.KanbanFeatures.Selection",InternalSelection,window);InternalFilter=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._filterHandler=function(n,t){var i=this.kanbanObj,u={requestType:"filtering",currentFilterObject:[],filterCollection:i._filterCollection},f,o,r,s,e;if(u.currentFilterObject.push(n),i.model.isResponsive){for(f=[],i._kbnFilterObject=i._kbnFilterObject.concat(u.currentFilterObject),r=0;r<i._kbnFilterObject.length;r++)e=$.inArray(i._kbnFilterObject[r],f),e<0&&f.push(i._kbnFilterObject[r]);i._kbnFilterObject=f}for(o=i._dataSource()instanceof ej.DataManager?i._dataSource().dataSource.json:i._dataSource(),o.length==0&&i._currentJsonData.length>0&&(o=i._currentJsonData),i._initialData=o,r=0;r<i.model.filterSettings.length;r++)if(i.model.filterSettings[r].text==u.currentFilterObject[0].text){s=i.model.filterSettings[r].query.queries[0].e;ej.isNullOrUndefined(u.filterCollection[0])?(u.filterCollection.push(s),$(t).addClass("e-select")):$(t).hasClass("e-select")?($(t).removeClass("e-select"),e=$.inArray(s,u.filterCollection),u.filterCollection.splice(e,1)):($(t).addClass("e-select"),u.filterCollection.push(s));break}i.KanbanCommon._processBindings(u)},n.prototype.filterCards=function(n){var t={requestType:"filtering",filterCollection:this.kanbanObj._filterCollection},n=n.queries[0].e;t.filterCollection.push(n);this.kanbanObj.KanbanCommon._processBindings(t)},n.prototype.clearFilter=function(){var n=this.kanbanObj,t;n._filterCollection.length!=0&&(t={requestType:"filtering"},n._filterCollection=[],n.element.find(".e-kanbantoolbar .e-tooltxt").removeClass("e-select"),n.KanbanCommon._processBindings(t))},n.prototype._filterLimitCard=function(n){for(var u,i,f,e,o,t=this.kanbanObj,r=0;r<t.model.columns.length;r++)u=t.model.columns[r],i=t.getHeaderContent().find("span.e-totalcount"),t.model.enableTotalCount&&(i=$(i[r]),f=$(i).text().indexOf(t.localizedLabels.FilterOfText),!ej.isNullOrUndefined(n)&&(n.requestType=="drop"||n.requestType=="beginedit"||n.requestType=="save"||n.requestType=="cancel"||n.requestType=="refresh"||n.requestType=="add"||(n.requestType=="filtering"?n.filterCollection.length>0?!0:t.model.searchSettings.key==""?!1:!0:n.requestType=="search"?t.model.searchSettings.key!=""?!0:t.model.filterSettings.length>0?t.element.find(".e-kanbantoolbar .e-tooltxt").hasClass("e-select"):!1:!1))?((f!=-1||t.model.filterSettings.length!=0||t.model.searchSettings.key.length!=0)&&(e=new ej.DataManager(t.model.dataSource).executeLocal((new ej.Query).where(t.model.keyField,ej.FilterOperators.equal,u.key)).length,$(i).text(e)),o=t.KanbanCommon._multikeySeparation(u.key),$(i).text($($(t.element.find(".e-columnrow")).find('td[ej-mappingkey="'+o+'"] > div.e-kanbancard')).length+" "+t.localizedLabels.FilterOfText+" "+$(i).text())):ej.isNullOrUndefined(u.constraints)?$(i).text($(i).text().slice(f+3)):t.KanbanCommon._renderLimit())},n.prototype.searchCards=function(n){var u,t=this.kanbanObj,i=$("#"+t._id+"_toolbarItems_search"),r;i.find("input").val()!=n&&i.find("input").val(n);t.element.hasClass("e-responsive")||(i.parent().addClass("e-highliht-kbnsearchbar"),i.find("input").val()==""&&i.parent().removeClass("e-highliht-kbnsearchbar"));u={requestType:"search",keyValue:n};(n!=""||t.model.searchSettings.key!="")&&(t.model.searchSettings.key=n,t.model.searchSettings.key.length>0&&(r=t._dataSource()instanceof ej.DataManager?t._dataSource().dataSource.json:t._dataSource(),r.length==0&&t._currentJsonData.length>0&&(r=t._currentJsonData),t._initialData=r),t.KanbanCommon._processBindings(u))},n.prototype.clearSearch=function(){var n=this.kanbanObj;n.element.find(".e-kanbantoolbar #"+n._id+"_toolbarItems_search").val("");this.searchCards("");$.extend(n.model.searchSettings,n.defaults.searchSettings)},n.prototype._onToolbarKeypress=function(n){var t=this.KanbanFilter.kanbanObj,i=t.element,r=i.data("ejKanban");t.model.isResponsive&&i.hasClass("e-responsive")&&($(t.itemsContainer).parent().children().not(".e-searchbar").hide(),t.KanbanAdaptive._kbnTimeoutSearch(i,n))},n}();window.ej.createObject("ej.KanbanFeatures.Filter",InternalFilter,window);InternalDragAndDrop=function(){function n(n){this.kanbanObj=null;this._dragEle=null;this._dropEle=null;this._dropTarget=null;this.kanbanObj=n}return n.prototype._addDragableClass=function(){var n=this.kanbanObj;n._dropped=!1;this._dragEle=n.getContent().find(".e-columnrow td.e-drag .e-kanbancard");this._dropEle=n.getContent().find(".e-columnrow .e-rowcell.e-drop");this._dropEle.addClass("e-droppable");this._dragEle.addClass("e-draggable e-droppable");this._enableDragDrop();n._on(n.element,"mouseup touchstart pointerdown MSPointerDown","",$.proxy(n.element.focus(),this))},n.prototype._enableDragDrop=function(){var n=this.kanbanObj;this._drag();$(n.getContent()).ejDroppable({accept:$(n.getContent()).find("div.e-kanbancard"),drop:function(n,t){$(t.helper).hide()}})},n.prototype._selectedPrevCurrentCards=function(){var t,i,n=this.kanbanObj;n._previousRowCellIndex.length>0&&(t=n.KanbanCommon._getCardbyIndexes(n._previousRowCellIndex),n._pCardId=t.attr("id"));n._previousRowCellIndex=n._currentRowCellIndex;n._pCardId=n._cCardId;n._currentRowCellIndex.length>0&&(i=n.KanbanCommon._getCardbyIndexes(n._currentRowCellIndex),n._cCardId=i.attr("id"))},n.prototype._getPriorityIndex=function(n){for(var i=null,r=this.kanbanObj,t=0;t<r._priorityCollection.length;t++)if(r._priorityCollection[t].primaryKey==n.attr("id")){i=r._priorityCollection[t];break}return ej.isNullOrUndefined(i)?this._getPriorityKey(n.attr("id")):parseInt(i.dropKey)},n.prototype._removeFromPriorirtyCollec=function(n){for(var i=null,r=this.kanbanObj,t=0;t<r._priorityCollection.length;t++)if(r._priorityCollection[t].primaryKey==n){i=t;break}ej.isNullOrUndefined(i)||r._priorityCollection.splice(i,1)},n.prototype._columnDataOndrop=function(n,t){var r=this.kanbanObj,h=new ej.DataManager(r._initialData),u,f,e,o,s,i=new ej.Query;return f=r.model.keyField,e=r.model.fields.swimlaneKey,o=$(n).hasClass("e-rowcell")?$(n).attr("ej-mappingkey"):$(n).parents(".e-rowcell").attr("ej-mappingkey"),s=$(n).parents(".e-columnrow").prev(".e-swimlanerow").find(".e-slkey").text(),i=ej.isNullOrUndefined(e)?i.where(f,ej.FilterOperators.equal,o):i.where(f,ej.FilterOperators.equal,o).where(e,ej.FilterOperators.equal,s),u=h.executeLocal(i),u.sort(function(n,i){return n[t]-i[t]}),u},n.prototype._dropToColumn=function(n,t){var i=this.kanbanObj,h,u,f=[],c=!1,e=i.model.fields.priority,l,a,w=n.parent().has(t).length,o,v,s,r,y,p;for(ej.isNullOrUndefined(i._filterToolBar)||(l=i._filterToolBar.find(".e-select")),n.hasClass("e-targetclone")&&(n=n.parent()),n.hasClass("e-columnkey")&&(n=n.parent().parent()),this._selectedPrevCurrentCards(),e&&(!ej.isNullOrUndefined(i._filterToolBar)&&l.length>0||i._searchBar!=null&&i._searchBar.find(".e-cancel").length>0)?(f=this._columnDataOndrop(n,e),c=f.length>0):c=$(n).children(".e-kanbancard").length>1,a=this._getSelectedCards(t),i.model.selectionType=="multiple"&&a.length>0&&$(t).hasClass("e-cardselection")&&(t=a),o=0;o<t.length;o++)for(v=t[o],s=0;s<$(v).length;s++)r=$(v)[s],$(r).is(":visible")&&(e&&c&&(h=!ej.isNullOrUndefined(i._filterToolBar)&&l.length>0||i._searchBar!=null&&i._searchBar.find(".e-cancel").length>0?f[f.length-1][e]:this._getPriorityIndex(n.find(".e-kanbancard").last()),u=this._getPriorityIndex($(r)),h>=u&&(u=++h),this._removeFromPriorirtyCollec($(r).attr("id")),i._priorityCollection.push({primaryKey:$(r).attr("id"),dropKey:u}),y=i.KanbanCommon._getKanbanCardData(i._currentJsonData,$(r)[0].id)[0],ej.isNullOrUndefined(u)||(y[e]=u,f.push(y))),$(n).find(".e-customaddbutton").length>0?$(r).insertBefore($(n).find(".e-customaddbutton")):i.element.hasClass("e-responsive")?(p=n.find(".e-cell-scrollcontent"),p.length>0?p.children().append(r):$(n).append(r)):$(n).append(r));this._updateDropAction(n,t);w==0&&!ej.isNullOrUndefined(i.model.fields.swimlaneKey)&&i.model.swimlaneSettings.allowDragAndDrop&&i.refresh(!0)},n.prototype._updateDropAction=function(n,t){var a,i=this.kanbanObj,f,r,e,o,s,c,u,l,h;for(a=$(n).hasClass("e-rowcell")?n:$(n).closest("td.e-rowcell"),i._selectedCardData=[],r=0;r<t.length;r++)if(ej.isNullOrUndefined(t[r].length))($(t[r]).is(":visible")||$(n).hasClass("e-hide")&&i.model.contextMenuSettings.enable)&&(e=$(t[r]).attr("id"),this._updateDropData(n,t[r],e),u=i.element.find("#"+e),f=u.parents(".e-rowcell"),u.parents(".e-rowcell").hasClass("e-shrink")&&u.addClass("e-hide"),s=parseInt(f.find(".e-shrinkcount").html()),f.find(".e-shrinkcount").html(++s));else for(o=0;o<t[r].length;o++)($(t[r][o]).is(":visible")||$(n).hasClass("e-hide")&&i.model.contextMenuSettings.enable)&&(e=t[r][o].id,this._updateDropData(n,t[r][o],e),u=i.element.find("#"+e),f=u.parents(".e-rowcell"),u.parents(".e-rowcell").hasClass("e-shrink")&&u.addClass("e-hide"),s=parseInt(f.find(".e-shrinkcount").html()),f.find(".e-shrinkcount").html(++s));if(i.model.fields.priority&&i._priorityCollection.length>0)while(i._priorityCollection.length>0)c=i._priorityCollection[0].primaryKey,u=i.element.find("#"+c),this._updateDropData(n,u,c);h=i._bulkUpdateData[0][i.model.fields.primaryKey];i._bulkUpdateData.length>1&&(h="bulk");l={data:i._bulkUpdateData,requestType:"drop",primaryKeyValue:h};i._saveArgs=l;i.updateCard(h,i._bulkUpdateData);(i.model.allowSelection&&!ej.isNullOrUndefined(t[0].length)&&t[0].length>1||t.length>1||t.length==1&&$(t).hasClass("e-cardselection"))&&(i._previousRowCellIndex=ej.isNullOrUndefined(i._pCardId)?[]:this._updateRowCellIndexes(i._pCardId,i._previousRowCellIndex),i._currentRowCellIndex=ej.isNullOrUndefined(i._cCardId)?[]:this._updateRowCellIndexes(i._cCardId,i._currentRowCellIndex),i.KanbanSelection._selectionOnRerender(),ej.isNullOrUndefined(i._pCardId)&&(i._previousRowCellIndex=i._currentRowCellIndex),i.model.selectionType=="single"?i.selectedRowCellIndexes=i._currentRowCellIndex:i.KanbanSelection._updateSelectedCardIndexes(n));i._priorityCollection=[]},n.prototype._getPriorityKey=function(n){var t=this.kanbanObj,i=t.KanbanCommon._getKanbanCardData(t._currentJsonData,n);return i[0][t.model.fields.priority]},n.prototype._dropAsSibling=function(n,t,i){var r=this.kanbanObj,s=0,g=0,rt=0,w,ut,f,k,nt,ft,et,u=[],lt,c=r.model.fields.priority,b,p,ot,at=n.parent().has(t).length,l,st,v,o,ht,ct,d,tt,y,e,a,h,it;for(ej.isNullOrUndefined(r._filterToolBar)||(b=r._filterToolBar.find(".e-select")),p=r.model.fields.primaryKey,this._selectedPrevCurrentCards(),c&&(!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)&&(u=this._columnDataOndrop(n,c)),$(n).hasClass("e-targetclone")&&(n.next().length==0&&$(n).addClass("e-targetappend"),ft=$(n).prevAll(".e-kanbancard")[0],et=$(n).nextAll(".e-kanbancard")[0],$(n).hasClass("e-targetappend")?(i=!0,n=ft,ej.isNullOrUndefined(n)&&(n=et)):(i=!1,n=et,ej.isNullOrUndefined(n)&&(n=ft))),nt=n,ot=this._getSelectedCards(t),r.model.selectionType=="multiple"&&ot.length>0&&$(t).hasClass("e-cardselection")&&(t=ot),l=0;l<t.length;l++)for(st=t[l],v=0;v<$(st).length;v++)if(o=$(st)[v],$(o).is(":visible")&&(i&&(v>0&&t[l][v-1]!=nt?n=t[l][v-1]:v==0&&l>0&&t[l-1]!=nt&&(n=t[l-1])),o!=nt&&(i?$(o).insertAfter(n):$(o).insertBefore(n),c&&(!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)&&(ht=r.KanbanCommon._getKanbanCardData(u,$(n).attr("id")),h=u.indexOf(ht[0]),d=r.KanbanCommon._getKanbanCardData(r._currentJsonData,$(o)[0].id),ht[0][r.model.keyField]==d[0][r.model.keyField]&&u.splice(u.indexOf(d[0]),1),i?u.splice(h+1,0,d[0]):u.splice(h,0,d[0]),lt=$(o)[0].id)),c)){if(!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)for(a=r.KanbanCommon._getKanbanCardData(u,$(n).attr("id")),s=a[0][c],a=r.KanbanCommon._getKanbanCardData(u,lt),k=[],y=u.indexOf(a[0]);y<u.length;y++)k.push(u[y]);else s=this._getPriorityIndex($(n)),tt=$(o).nextAll(".e-kanbancard"),k=ej.isNullOrUndefined(tt.addBack)?tt.andSelf():tt.addBack();for(y=0;y<k.length;y++){if(e=k[y],!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0?(a=null,f=e[c],!i&&$(o)[0].id==e[p]&&s<f&&(f=s),a=r.KanbanCommon._getKanbanCardData(u,e[p]),h=ct=u.indexOf(a[0]),h-1>=0&&(g=u[h-1][c]),a=r.KanbanCommon._getKanbanCardData(u,e[p]),h=ct=u.indexOf(a[0]),h+1<u.length?(rt=u[h+1][c],w=u[h+1]):w=[]):(f=this._getPriorityKey($(e).attr("id")),!i&&$(o)[0]==e&&s<f&&(f=s),ut=$(e).prevAll(".e-kanbancard"),ut.length>0&&(g=this._getPriorityIndex(ut.eq(0))),w=$(e).nextAll(".e-kanbancard"),w.length>0&&(rt=this._getPriorityIndex(w.eq(0)))),!isNaN(g)&&g<f&&(f<rt||w.length==0))break;!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0?(!i&&$(o)[0].id==e[p]?!i&&$(o)[0].id==e[p]&&s<f||(f=s):f=++s,u[ct][c]=f,it=e[p]):(!i&&$(o)[0]==e?!i&&$(o)[0]==e&&s<f||(f=s):f=++s,it=$(e).attr("id"));this._removeFromPriorirtyCollec(it);r._priorityCollection.push({primaryKey:it,dropKey:f});s=f}}this._updateDropAction(n,t);this._dropTarget=null;at==0&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&r.model.swimlaneSettings.allowDragAndDrop&&r.refresh(!0)},n.prototype._updateDropData=function(n,t,i){var r=this.kanbanObj,e,h,c,u,a,l,v,o,y,s,f;if(!ej.isNullOrUndefined(r.model.fields.primaryKey)){if(u=[],h=r.model.fields.priority,c=r.model.fields.primaryKey,ej.isNullOrUndefined(i)&&(i=$(n).attr("id")),e=$(n).hasClass("e-rowcell")?$(n):$(n).parents(".e-rowcell"),e.index()<0&&(e=r.element.find("#"+$(n).attr("id")).parents(".e-rowcell")),u=$.extend(!0,[],r.KanbanCommon._getKanbanCardData(r._currentJsonData,i)),l=r.model.columns[e.index()].key,a=typeof l=="object"?l:l.split(","),u.length>0&&($(e).find(".e-targetclonemulti").length>0?u[0][r.model.keyField]=$(e).find(".e-columnkey.e-active .e-text").eq(0).text():a.length==1&&(u[0][r.model.keyField]=a[0]),r.model.fields.swimlaneKey&&(v=$(n).parents("tr.e-columnrow").prev().find("div.e-slkey").html(),u[0][r.model.fields.swimlaneKey]=ej.isNullOrUndefined(v)?r.element.find("#"+n.id).parents("tr.e-columnrow").prev().find("div.e-slkey").html():v)),r._dropped=!0,h&&r._priorityCollection.length>0){for(s=0;s<r._priorityCollection.length;s++)if(r._priorityCollection[s].primaryKey==i){o=r._priorityCollection[s];r._priorityCollection.splice(s,1);break}if(!ej.isNullOrUndefined(o)&&u.length>0&&(u[0][h]=o.dropKey),!ej.isNullOrUndefined(r._filterToolBar)&&r._filterToolBar.find(".e-select").length>0&&!ej.isNullOrUndefined(o)||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)for(f=0;f<r._initialData.length;f++)if(o.primaryKey==r._initialData[f][c]){u.length>0?r._initialData[f]=u[0]:r._initialData[f][h]=o.dropKey;y=r._initialData[f];break}}if(u.length>0){if($(t).hasClass("e-cardselection")){for(f=0;f<r._selectedCardData.length;f++)if(u[0][c]==r._selectedCardData[f][c])break;r._selectedCardData.splice(f,1);r._selectedCardData.push(u[0])}r._bulkUpdateData.push(u[0])}else h&&r.KanbanCommon._getKanbanCardData(r._bulkUpdateData,y[c]).length<=0&&r._bulkUpdateData.push(y)}},n.prototype._updateRowCellIndexes=function(n,t){var f,i,r=[],u;return ej.isNullOrUndefined(n)?r=t:(u=this.kanbanObj.element.find("#"+n),f=$(u).parents(".e-columnrow"),i=$(u).parents(".e-rowcell"),r.push([f.index(),[i.index()],[i.find(".e-kanbancard").index(i.find("#"+n))]])),r},n.prototype._dragStop=function(n,t,i){var e=this,c,nt,v,tt,o,r=this.kanbanObj,h,it,u,rt,f,k,d,l,y,a,w,b,g,st,ft;if(n.element.dropped||t&&t.remove(),n.target=this._getCursorElement(n),u=$(n.target).closest(".e-kanbancard").length>0?$(n.target).closest(".e-kanbancard")[0]:n.target,r.element.hasClass("e-responsive")&&!$(u).hasClass("e-targetclone")&&(l=$(u).parents(".e-rowcell"),!$(u).hasClass("e-kanbancard")&&$(u).parents(".e-kanbancard").length==0&&l.length>0&&$(u).parents(".e-kanbancard").is(":visible")&&(n.target=u=l[0])),v=$(n.element).parents(".e-columnrow"),rt=v.find(u).parents(".e-rowcell").height()-r._tdHeightDiff,r.element.find(".e-kanban-draggedcard").removeClass("e-kanban-draggedcard"),r.element.find(".e-targetdragclone").remove(),e._dropEle.removeClass("e-dropping e-dragged e-dragpossible"),r.element.find(".e-droppableremove").removeClass("e-droppableremove e-droppable"),r.element.find(".e-dragpossible").removeClass("e-dragpossible e-drop"),c={data:n.dragData,draggedElement:n.dragEle,dropTarget:$(u),event:n.event},r._trigger("cardDragStop",c))return!1;v=$(n.element).parents(".e-columnrow");nt=v.find(".e-cardselection");tt=v.find(".e-rowcell");o=$(n.target).parents(".e-targetclonemulti").length>0?r.element.find(".e-targetclonemulti"):r.element.find(".e-targetclone");h=$(n.element).parents(".e-rowcell");it=r.element.find(".e-rowcell.e-drag").index(h);var ut=$(u).parent().children().hasClass("e-customaddbutton"),p=$(u).parent().children().hasClass("e-limits"),et=$(u).parent().children().hasClass("e-shrinkheader"),s=$(u).parent().children(),ot=et?ut?p?s.length==4:s.length==3:p?s.length==3:s.length==2:ut?p?s.length==3:s.length==2:p?s.length==2:s.length==1;return(o.is(":visible")&&document.body.style.cursor==""&&u.style.cursor==""&&($(u).parents(".e-targetclonemulti").length>0?e._dropToColumn($(u).parents(".e-rowcell"),$(n.element)):u.nodeName=="TD"&&$(u).parent().hasClass("e-columnrow")&&o.is(":visible")||o.siblings().length<=0||ot?(d=$(u).find(".e-cell-scrollcontent"),f=d.length>0?d.children().eq(0).children().last():$(u).children().last(),f.hasClass("e-targetclone")&&(f=f.prev()),k=o.siblings().not(".e-shrinkheader").not(".e-customaddbutton").not(".e-limits"),($(u).children().length==0||k.length<=0||f.hasClass("e-customaddbutton")&&f.prev().hasClass("e-targetclone")||!f.hasClass("e-customaddbutton")&&$(f).offset().top+$(f).height()<$(o).offset().top)&&(f.next().hasClass("e-targetclone")||k.length<=0?e._dropToColumn($(u),$(n.element)):(i=!1,e._dropAsSibling($(o.next()),$(n.element),i)))):u.nodeName=="DIV"&&($(u).hasClass("e-kanbancard")||$(u).hasClass("e-targetclone"))&&($(u).hasClass("e-targetclone")?(l=$(u).parents(".e-rowcell"),$(u).next().length==0&&$(l).find(".e-kanbancard").length==0?e._dropToColumn($(l),$(n.element)):e._dropAsSibling($(u),$(n.element),i)):(o.is(":visible")||nt.length>1)&&e._dropAsSibling($(u),$(n.element),i)),r._kbnBrowserContext="contextmenu"),e._removeKanbanCursor(),r.element.hasClass("e-responsive")&&r.element.parents("body").removeClass("e-kbnwindow-modal"),r._autoKbnSwipeLeft=!1,r._autoKbnSwipeRight=!1,r.element.find(".e-targetclone").remove(),y=r.element.find(".e-targetclonemulti"),y.length>0&&(y.parent().find(".e-kanbancard").show(),$(n.target).parents(".e-rowcell").css("border-style",""),r.element.find(".e-responsive")&&y.parent().find(".e-limits").show(),y.remove()),$(n.element)[0]!=u&&tt.height(rt),r._on(r.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard",r._cardHover),$(t).length>0&&$(t).remove(),r._eventBindings(),r.model.isResponsive&&r.kanbanWindowResize(),a=r.element.find("#"+n.element.attr("id")),$(a).hasClass("e-cardselection")&&(a=$(a).parents(".e-columnrow").find(".e-cardselection:visible")),r.KanbanAdaptive&&r.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&r.KanbanAdaptive._addSwimlaneName(),h=r.element.find(".e-rowcell.e-drag").eq(it),c.draggedElement=a,c.draggedParent=h,c.data=r._bulkUpdateData,r.model.allowScrolling&&!r.element.hasClass("e-responsive")&&r.kanbanContent.data("ejScroller").refresh(),r._trigger("cardDrop",c))?!1:(r._bulkUpdateData=[],w=h.parent().find(".e-rowcell"),b=a.parents(".e-rowcell"),r.model.isResponsive&&r.element.hasClass("e-responsive")&&b[0]!=h[0]&&w.index(b)!=r._kbnSwipeCount&&(w.index(b)>w.index(h)?r.KanbanAdaptive._kbnLeftSwipe():r.KanbanAdaptive._kbnRightSwipe()),r.KanbanEdit&&r.element.find(".e-form-container .e-disable").attr("value")==n.dragEle[0].id&&r.element.find(".e-form-container").css("display")=="block"&&(r.model.editSettings.editMode=="externalform"||r.model.editSettings.editMode=="externalformtemplate")&&r.KanbanEdit.startEdit(n.dragEle),r.element.find(".e-togglevisible").removeClass("e-togglevisible"),r.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&r._kbnAdaptDdlIndex>0&&(g=r.kanbanContent.data("ejScroller"),ft=r._freezeScrollTop,st=r.element[0].getElementsByClassName("e-columnrow"),g.scrollY(0,!0),r._freezeScrollTop=ft,g.scrollY(r._freezeScrollTop,!0)),!0)},n.prototype._getCursorElement=function(n){var i=$(n.target).closest(".dragClone"),t=n.event;return i.length>0&&(i.hide(),n.target=t.type=="touchmove"||t.type=="touchstart"||t.type=="touchend"?document.elementFromPoint(t.originalEvent.changedTouches[0].pageX,t.originalEvent.changedTouches[0].pageY):document.elementFromPoint(t.clientX,t.clientY),i.show()),n.target},n.prototype._getSelectedCards=function(n){for(var r,t=this.kanbanObj,i=0;i<t._selectedCards.length;i++)if($(t._selectedCards[i]).length>1)for(r=0;r<t._selectedCards[i].length;r++)$(t._selectedCards[i][r])[0]==n[0]&&(t._selectedCards[i].splice(r,1),t._selectedCards[i].splice(0,0,n[0]),t._selectedCards.splice(0,0,t._selectedCards[i]),t._selectedCards.splice(i+1,1));else $(t._selectedCards[i])[0]==n[0]&&(t._selectedCards.splice(0,0,t._selectedCards[i]),t._selectedCards.splice(i+1,1));return t._selectedCards},n.prototype._kanbanAutoScroll=function(n){var nt=this,t=this.kanbanObj,r,u,e=null,o=null,s=null,i=null,f=t.element.find(".e-draggedcard"),g=t.element.find(".e-columnrow .e-rowcell"),b,a,k,v,y,c,d,p,h,w,l;v=ej.isNullOrUndefined(n.event.clientX)?n.event.originalEvent.changedTouches[0].clientX:n.event.clientX;y=ej.isNullOrUndefined(n.event.clientY)?n.event.originalEvent.changedTouches[0].clientY:n.event.clientY;b=t.element.width();r=t.element.hasClass("e-responsive")&&!t.element.hasClass("e-swimlane-responsive")?$(g).eq(t._kbnSwipeCount).find(".e-cell-scrollcontent"):t.getContent();u=r.data("ejScroller");a=t.element.offset().left;k=t.element.offset().top;p=r.find(".e-hup");d=r.find(".e-hdown");l=r.find(".e-vup");w=r.find(".e-vdown");c=r.find(".e-hhandle.e-box");h=r.find(".e-vhandle.e-box");!t.element.hasClass("e-responsive")&&t.model.allowScrolling&&(v>a+b-10?(t.element.removeClass("e-view-horizontal"),o=window.setInterval(function(){(f.length<=0||f.length>0&&f.is(":hidden"))&&o&&(o=window.clearInterval(o));c.length>0&&c.width()+c.offset().left<=d.offset().left&&!t.element.hasClass("e-view-horizontal")?u.scrollX(u.scrollLeft()+5,!0):o&&(o=window.clearInterval(o))},100)):v-10<a?(t.element.removeClass("e-view-horizontal"),u.scrollLeft()>0&&(e=window.setInterval(function(){(f.length<=0||f.length>0&&f.is(":hidden"))&&e&&(e=window.clearInterval(e));c.offset().left>=p.offset().left+p.width()&&!t.element.hasClass("e-view-horizontal")?u.scrollX(u.scrollLeft()-5,!0):e&&(e=window.clearInterval(e))},100))):(t.element.addClass("e-view-horizontal"),o&&(o=window.clearInterval(o)),e&&(e=window.clearInterval(e))));!ej.isNullOrUndefined(r)&&r.length>0&&r.hasClass("e-scroller")&&(y>k+t.getHeaderContent().height()+(r.height()-60)&&h.length>0&&w.length>0?(t.element.removeClass("e-view-vertical"),i=window.setInterval(function(){(f.length<=0||f.length>0&&f.is(":hidden"))&&i&&(i=window.clearInterval(i));h.height()+h.offset().top<=w.offset().top&&!t.element.hasClass("e-view-vertical")&&u.scrollTop()<t.kanbanContent.find(".e-table").height()-t.kanbanContent.height()?u.scrollY(u.scrollTop()+5,!0):i&&(i=window.clearInterval(i))},100)):y-30<t.element.find(".e-kanbancontent").offset().top&&h.length>0&&l.length>0?u.scrollTop()>0&&(t.element.removeClass("e-view-vertical"),s=window.setInterval(function(){i&&(i=window.clearInterval(i));(f.length<=0||f.length>0&&f.is(":hidden"))&&s&&(i=window.clearInterval(s));h.offset().top>=l.offset().top+l.height()&&!t.element.hasClass("e-view-vertical")?u.scrollY(u.scrollTop()-5,!0):s&&(s=window.clearInterval(s))},100)):(t.element.addClass("e-view-vertical"),i&&(i=window.clearInterval(i)),s&&(s=window.clearInterval(s))))},n.prototype._changeKanbanCursor=function(n,t,i){var f=$(n).parents(".e-kanbancard"),e=$(n).hasClass("e-kanbancard"),u,r;f.length>0||e?(r=e?$(n):f,r[0].style.cursor="not-allowed"):$(n).hasClass("e-shrinkheader")||$(n).parents(".e-shrinkheader").length>0||$(n).hasClass("e-slexpandcollapse")||$(n).parents(".e-slexpandcollapse").length>0?(r=$(n),$(n).parents(".e-shrinkheader").length>0?r=$(n).parents(".e-shrinkheader"):$(n).parents(".e-slexpandcollapse").length>0&&(r=$(n).parents(".e-slexpandcollapse")),r[0].style.cursor="not-allowed"):$(n).hasClass("e-shrink")?$(n)[0].style.cursor="not-allowed":$(n).parents(".e-columnrow").has(i.element).length==0||$(n).parents(".e-swimlanerow").length>0||$(n).hasClass("e-columnkey e-disable")||$(n).parents(".e-columnkey.e-disable").length>0?document.body.style.cursor="not-allowed":$(n).hasClass("e-rowcell")&&($(n)[0].style.cursor="not-allowed");u=$(t).find(".e-kanbancard");u.length>0&&(u[0].style.cursor="not-allowed")},n.prototype._removeKanbanCursor=function(){document.body.style.cursor="";this.kanbanObj.element.find(".e-kanbancard,.e-shrink,.e-shrinkheader,.e-slexpandcollapse,.e-rowcell").css("cursor","")},n.prototype._multicloneremove=function(n){if(n.hasClass("e-rowcell")){var t=this.kanbanObj;$(trgtCloneMulti).parents(".e-rowcell").css("border-style","");$(trgtCloneMulti).siblings(".e-kanbancard").show();$(trgtCloneMulti).siblings(".e-targetdragclone").show();t.element.find(".e-responsive")&&$(trgtCloneMulti).siblings(".e-limits").show();$(trgtCloneMulti).remove();trgtCloneMulti.children().remove()}},n.prototype._multiKeyCardDrop=function(n,t,i,r,u){var o=this.kanbanObj,h,f,s,e;for($(i).height(n.height()),n.css("border-style","none"),n.children().hide(),o.element.find(".e-responsive")&&n.find(".e-limits").hide(),n.append(i),r=typeof r=="object"?r:r.split(","),h=o.KanbanCommon._getKanbanCardData(o._currentJsonData,u.attr("id")),f=0;f<t;f++)s=n.find(".e-targetclonemulti"),s.append(ej.buildTag("div.e-columnkey")),e=s.find(".e-columnkey").eq(f).addClass(o.KanbanCommon._preventCardMove(h[0][o.model.keyField],r[f])?"":"e-disable"),e.append(ej.buildTag("div.e-text").text(r[f])),e.css({height:n.height()/t-(1+1/t)}),e.find(".e-text").css("top",e.height()/2-e.find(".e-text").height()/2)},n.prototype._createCardClone=function(n,t){var i=this.kanbanObj,r;return n=i.element.find(".e-draggedcard"),n.length>0&&n.remove(),!ej.isNullOrUndefined(t)&&$(t).hasClass("e-draggable")&&(n=ej.buildTag("div.e-draggedcard"),n.addClass(i.model.cssClass),r=$(t).clone().addClass("dragClone"),$(n).css({width:t.width()}),n.append(r),$(n).find("div:first").removeClass("e-hover"),n.appendTo(i.element)),n},n.prototype._drag=function(){var i=this,u=null,t=null,h=null,c=null,l=null,a,o,f,e=[],r,s,n=this.kanbanObj;n.element!=null&&(h=n.getContent().find("div:first"));$(n.getContent()).find(".e-rowcell.e-drag div.e-kanbancard").not(".e-js").ejDraggable({dragArea:h,clone:!0,cursorAt:{left:-20,top:-20},dragStart:function(r){var h,c,o;if(n.model.enableTouch&&!ej.isNullOrUndefined(n._cardSelect)&&n._cardSelect=="touch")return!1;for(n.element.hasClass("e-responsive")&&n.element.parents("body").addClass("e-kbnwindow-modal"),n._off(n.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard"),s=n.element.find(".e-draggedcard"),t=$(r.element).hasClass("e-cardselection")?$(r.element).parents(".e-columnrow").find(".e-cardselection:visible"):$(r.element),t.length>1&&(h=ej.buildTag("div.e-dragmultiple"),h.append(t.length+n.localizedLabels.Cards),s.children().remove(),s.append(h).css("width","90px")),o=0;o<t.length;o++)c=ej.buildTag("div.e-targetdragclone"),$(t).eq(o).after(c),$(c).css({width:$(t).eq(o).width(),height:$(t).eq(o).height()}),$(t).eq(o).addClass("e-kanban-draggedcard");for(e.length!=0&&(e=[]),o=0;o<t.length;o++)t[o].id!=""&&(a=new ej.DataManager(n._currentJsonData),e.push(a.executeLocal((new ej.Query).where(n.model.fields.primaryKey,ej.FilterOperators.equal,t[o].id))));if(i&&!ej.isNullOrUndefined(r.target)){if(f={draggedElement:t,dragTarget:r.target,data:e,event:r.event},n._trigger("cardDragStart",f))return r.cancel=!0,u&&u.remove(),!1}else return!1;return n._dropinside=typeof f.allowInternalDrop=="boolean"?f.allowInternalDrop:!1,!0},drag:function(s){var p=null,d=null,rt=n.element.find(".e-draggedcard"),h,a,v,ut,ft,ht,bt,nt,ct,et,lt,at,y,g,vt,yt,tt,wt,it,st,ot;if(o=!1,n._cardSelect=null,n.element.find(".e-kanbantooltip").hide(),rt.addClass("e-left-rotatecard"),n._kbnMouseX=ej.isNullOrUndefined(s.event.clientX)?s.event.originalEvent.changedTouches[0].clientX:s.event.clientX,$(".e-kanban-context").length>0&&$(".e-kanban-context").css("visibility","hidden"),ej.isNullOrUndefined(n._kTouchBar)||n._kTouchBar.hide(),!n._autoKbnSwipeRight&&n.element.hasClass("e-responsive")&&n.element.offset().left+n.element.width()-50<n._kbnMouseX&&(p=window.setInterval(function(){rt.is(":hidden")?p&&(p=window.clearInterval(p)):n.element.offset().left+n.element.width()<n._kbnMouseX?p=window.clearInterval(p):n.element.offset().left+n.element.width()-50<n._kbnMouseX?n.KanbanAdaptive._kbnLeftSwipe():p&&(p=window.clearInterval(p))},1500),n._autoKbnSwipeRight=!0,n._autoKbnSwipeLeft=!1),!n._autoKbnSwipeLeft&&n.element.hasClass("e-responsive")&&n.element.offset().left+20>n._kbnMouseX&&(d=window.setInterval(function(){rt.is(":hidden")?d&&(d=window.clearInterval(d)):n.element.offset().left+20>n._kbnMouseX?n.KanbanAdaptive._kbnRightSwipe():d&&(d=window.clearInterval(d))},1500),n._autoKbnSwipeLeft=!0,n._autoKbnSwipeRight=!1),(n.model.allowScrolling||n.model.isResponsive)&&i._kanbanAutoScroll(s),$(s.target).closest(".dragClone").length>0&&(s.target=c,clearTimeout(l),l=setTimeout(function(){s.target=i._getCursorElement(s)},10)),$(s.target).hasClass("e-targetclone")||$(s.target).hasClass("e-rowcell")||$(s.target).hasClass("e-customaddbutton")||$(r).remove(),h=$(s.target).closest(".e-kanbancard").length>0?$(s.target).closest(".e-kanbancard")[0]:s.target,ft=!ej.isNullOrUndefined(n.model.fields.swimlaneKey)&&n.model.swimlaneSettings.allowDragAndDrop,v=$(s.element).closest("td.e-rowcell").addClass("e-dragged"),ht=v.siblings().length,v.parent().find(".e-dragpossible").length==0&&ht>0)for(bt=n.KanbanCommon._getKanbanCardData(n._currentJsonData,$(s.element).attr("id"))[0],nt=0;nt<ht;nt++)if(n.KanbanCommon._preventCardMove(bt[n.model.keyField],n.model.columns[v.parent().children().index(v.siblings()[nt])].key)&&(v.siblings().eq(nt).addClass("e-dragpossible"),ft))for(ct=n.element.find(".e-columnrow"),et=0;et<ct.length;et++)lt=ct.eq(et).find(".e-rowcell"),at=v.parent().children(),lt.eq(at.index(v.siblings().eq(nt))).addClass("e-dragpossible"),lt.eq(at.index(v)).addClass("e-dragpossible");if(v.siblings(".e-drop.e-dragpossible").addClass("e-dropping"),n._dropinside?v.addClass("e-dragpossible e-drop e-droppable e-droppableremove"):v.addClass("e-dragpossible e-drop"),f={draggedElement:t,data:e,dragTarget:h,event:s.event},c=a=$(h).closest("td.e-rowcell"),ut=a.parents(".e-columnrow").find(".e-cardselection"),a&&a.hasClass("e-droppable")&&(ft?!0:$(a).parent().has(s.element[0]).length>0)&&(h!=s.element[0]||ut.length>1)){if(document.body.style.cursor="",$(r).parents(".e-rowcell").index()!=a.index()&&$(r).remove(),a.find(".e-kanbancard").removeClass("e-hover"),n.element.hasClass("e-responsive")&&(vt=$(h).parents(".e-rowcell"),!$(h).hasClass("e-kanbancard")&&$(h).parents(".e-kanbancard").length==0&&vt.length>0&&(h=vt,a=$(h).find(".e-cell-scrollcontent").children().eq(0))),y=a.children().last(),y.hasClass("e-shrinkheader")&&(y=y.prev()),($(h).hasClass("e-columnkey")||$(h).parents(".e-columnkey").length>0||$(h).find(".e-columnkey").length>0)&&(yt=$(h).hasClass("e-rowcell")?$(h):$(h).parents(".e-rowcell"),tt=s.target,$(tt).hasClass("e-columnkey")&&!$(tt).hasClass("e-disable")||$(tt).parents(".e-columnkey").length>0&&!$(tt).parents(".e-disable").length>0?(i._removeKanbanCursor(),yt.find(".e-columnkey.e-active").removeClass("e-active"),yt.find(".e-columnkey.e-multiclonestyle").removeClass("e-multiclonestyle"),$(tt).closest(".e-columnkey").not(".e-disable").addClass("e-active"),$(a).find(".e-active").prev().addClass("e-multiclonestyle")):i._changeKanbanCursor(h,u,s)),($(h).hasClass("e-rowcell")||$(h).hasClass("e-kanbancard")||$(h).hasClass("e-targetdragclone")||$(h).hasClass("e-swimlane-name")||$(h).hasClass("e-limits")||$(h).parents(".e-rowcell").not(".e-drop").length>0)&&$(trgtCloneMulti).is(":visible")&&$(h).index()!=trgtCloneMulti.parents(".e-rowcell").index())$(trgtCloneMulti).siblings(".e-kanbancard").not(".e-kanban-draggedcard").show(),$(trgtCloneMulti).parents(".e-rowcell").css("border-style",""),$(trgtCloneMulti).siblings(".e-targetdragclone,.e-customaddbutton,.e-limits").show(),$(trgtCloneMulti).remove(),trgtCloneMulti.children().remove();else if($(h).hasClass("e-rowcell")&&(s.element[0]!=y[0]||ut.length>1)&&!$(h).hasClass("e-shrink")&&!$(y[0]).hasClass("e-targetclonemulti")){var it=$(h).hasClass("e-dragpossible"),kt=$(h).parent().children().index(h),b=n.model.columns[kt].key,k=(typeof b=="object"?b:b.split(",")).length;if(y.length==0||a.children().length==0||y.offset().top+y.height()<$(u).offset().top||k>1)if(it&&(k==1||kt==$(v).parent().children().index(v)&&(t.length==1||t.length>1&&n.selectedRowCellIndexes[0].cellIndex.length==1)||t.length>1&&!n.selectedRowCellIndexes[0].cellIndex.length>1&&$.inArray(a.index(),n.selectedRowCellIndexes[0].cellIndex)!=-1)){g=$(h).height();var dt=$(s.element[0]).height(),gt=$(h).width(),y=a.children().last(),ni=a,pt=a.find(".e-cell-scrollcontent");n.element.hasClass("e-responsive")&&pt.length>0&&(y=pt.children().last(),ni=pt.children());y.hasClass("e-customaddbutton")?y.before($(r).height(dt).width(gt-28)):ni.append($(r).height(dt).width(gt-28));g<$(h).height()&&(a.height(a.height()),n._tdHeightDiff=$(h).height()-g)}else it&&k>1?(!a.find(".e-columnkey").length>0&&i._multicloneremove(a),i._multiKeyCardDrop(a,k,trgtCloneMulti,b,t)):i._changeKanbanCursor(h,u,s)}else if($(h).hasClass("e-rowcell")&&$(h).hasClass("e-shrink")&&$(h).hasClass("e-dragpossible")||($(h).hasClass("e-shrinkheader IE")||$(h).hasClass("e-shrinkcount")||$(h).hasClass("e-shrinklabel"))&&$(h).parents(".e-rowcell").hasClass("e-dragpossible"))wt=$(h).hasClass("e-rowcell")?$(h):$(h).parents(".e-rowcell"),ot=new ej.DataManager(n.model.columns).executeLocal((new ej.Query).where("key",ej.FilterOperators.equal,wt.attr("ej-mappingkey"))),n.toggleColumn(ot[0].headerText),n.element.find(".e-draggedcard").width(n.element.find(".e-targetdragclone").width()),r.width(n.element.find(".e-targetdragclone").width()),wt.addClass("e-togglevisible");else if($(h).hasClass("e-shrink")&&!$(h).hasClass("e-dragpossible"))i._changeKanbanCursor(h,u,s);else if($(h).hasClass("e-kanbancard")||$(h).hasClass("e-targetclone")){var w=$(h).parents(".e-rowcell"),ti,b=n.model.columns[w.parent().children().index(w)].key,k=(typeof b=="object"?b:b.split(",")).length;g=w.height();it=$(h).parents(".e-rowcell").hasClass("e-dragpossible");ti=ej.isNullOrUndefined(s.event.pageY)?s.event.originalEvent.changedTouches[0].pageY:s.event.pageY;$(h).offset().top+$(h).height()/2>=ti&&it&&(t.length>1&&!n.selectedRowCellIndexes[0].cellIndex.length>1&&$.inArray(a.index(),n.selectedRowCellIndexes[0].cellIndex)!=-1||k==1||$(a).parent().children().index(a)==$(v).parent().children().index(v)&&v.parents("tr").index()==a.parents("tr").index())?$(h).prev()[0]!=s.element[0]||ut.length>1?!$(h).hasClass("e-targetclone")&&($(h).prev().length==0||$(h).prev().length>0&&!$(h).prev().hasClass("e-targetdragclone"))&&(i._removeKanbanCursor(),$(r).insertBefore($(h)).height(rt.find(".e-kanbancard").outerHeight()).width($(h).width()).removeClass("e-targetappend")):i._changeKanbanCursor(h,u,s):($(h).next()[0]!=s.element[0]||ut.length>1)&&it&&(t.length>1&&!n.selectedRowCellIndexes[0].cellIndex.length>1&&$.inArray(a.index(),n.selectedRowCellIndexes[0].cellIndex)!=-1||k==1||$(a).parent().children().index(a)==$(v).parent().children().index(v)&&(v.parents("tr").index()==a.parents("tr").index()||ft))?(g=$(h).parents(".e-rowcell").height(),!$(h).hasClass("e-targetclone")&&($(h).next().length==0||$(h).next().length>0&&!$(h).next().hasClass("e-targetdragclone"))&&(o=!0,i._removeKanbanCursor(),$(r).insertAfter($(h)).height(rt.find(".e-kanbancard").outerHeight()).width($(h).width()).addClass("e-targetappend"))):it&&k>1&&!w.find(".e-columnkey").length>0&&!($(a).parent().children().index(a)==$(v).parent().children().index(v))?(i._multicloneremove(a),i._multiKeyCardDrop(w,k,trgtCloneMulti,b,t)):i._changeKanbanCursor(h,u,s);g<w.height()&&(w.height(w.height()),n._tdHeightDiff=w.height()-g)}$(r).parent().hasClass("e-rowcell")&&v.parent().has($(r).parent()).length==0&&ft?(n.element.find(".e-columnrow .e-rowcell.e-drop").addClass("e-dropping"),v.removeClass("e-dropping").addClass("e-dragged")):(n.element.find(".e-columnrow .e-rowcell").removeClass("e-dropping"),v.addClass("e-dragged"),v.siblings(".e-drop.e-dragpossible ").addClass("e-dropping"))}else($(h).parents(".e-rowcell").not(".e-droppable").length>0||$(h).hasClass("e-swimlane-name")||$(h).hasClass("e-limits")||$(h).hasClass("e-swimlanerow")||$(h).parents(".e-swimlanerow").length>0)&&$(trgtCloneMulti).is(":visible")&&($(trgtCloneMulti).siblings(".e-kanbancard").not(".e-kanban-draggedcard").show(),$(trgtCloneMulti).parents(".e-rowcell").css("border-style",""),$(trgtCloneMulti).siblings(".e-targetdragclone,.e-customaddbutton,.e-limits").show(),$(trgtCloneMulti).remove(),trgtCloneMulti.children().remove()),($(h).hasClass("e-swimlanerow")||$(h).parents(".e-swimlanerow").length>0)&&$(r).is(":visible")&&$(r).remove(),i._changeKanbanCursor(h,u,s);return(st=n.element.find(".e-togglevisible"),st.length>0&&!$(h).hasClass("e-togglevisible")&&$(h).parents(".e-togglevisible").length==0&&(ot=new ej.DataManager(n.model.columns).executeLocal((new ej.Query).where("key",ej.FilterOperators.equal,st.attr("ej-mappingkey"))),n.toggleColumn(ot[0].headerText),n.element.find(".e-draggedcard").width(n.element.find(".e-targetdragclone").width()),r.width(n.element.find(".e-targetdragclone").width()),st.removeClass("e-togglevisible")),n._trigger("cardDrag",f))?!1:!0},dragStop:function(r){n._cardSelect=null;r.dragData=e;r.dragEle=t;i._dragStop(r,u,o)},helper:function(t){return n.model.enableTouch&&!ej.isNullOrUndefined(n._cardSelect)&&n._cardSelect=="touch"?!1:(r=ej.buildTag("div.e-targetclone"),trgtCloneMulti=ej.buildTag("div.e-targetclonemulti"),$(r).css({width:t.element.width(),height:t.element.height()}),u=i._createCardClone(u,t.element))}})},n}();window.ej.createObject("ej.KanbanFeatures.DragAndDrop",InternalDragAndDrop,window);InternalEdit=function(){function n(n){this.kanbanObj=null;this._dropDownManager=null;this._editForm=null;this._onKbnDialogBeforeClose=function(){var n=this.kanbanObj,t=n.element.find("#"+n._id+"_dialogEdit_wrapper");t.addClass("e-kbndialog-transitionclose")};this._onKbnDialogBeforeOpen=function(){var n=this.kanbanObj,t=n.element.find("#"+n._id+"_dialogEdit_wrapper");t.removeClass("e-kbndialog-transitionclose")};this.kanbanObj=n}return n.prototype._processEditing=function(){var n=this.kanbanObj,t=this._columnToSelect(),i=this,r;n.model.query._fromTable!=""&&t.from(n.model.query._fromTable);n._dataSource()instanceof ej.DataManager&&t.queries.length&&!n._dataManager.dataSource.offline?(r=n._dataSource().executeQuery(t),r.done(ej.proxy(function(n){i._dropDownManager=new ej.DataManager(n.result);i._addDialogEditingTemplate()}))):i._addDialogEditingTemplate()},n.prototype._renderDialog=function(){return ej.buildTag("div.e-dialog e-kanbandialog e-dialog-content e-shadow e-widget-content","",{display:"none"},{id:this.kanbanObj._id+"_dialogEdit"})},n.prototype._columnToSelect=function(){for(var i=[],t=this.kanbanObj,n=0;n<t.model.editSettings.editItems.length;n++)t.model.editSettings.editItems[n].editType=="dropdownedit"&&ej.isNullOrUndefined(t.model.editSettings.editItems[n].dataSource)&&i.push(t.model.editSettings.editItems[n].field);return i.length?(new ej.Query).select(i):new ej.Query},n.prototype.cancelEdit=function(){var n=this.kanbanObj,t;(n.model.editSettings.allowEditing||n.model.editSettings.allowAdding)&&(n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="dialogtemplate"?$("#"+n._id+"_dialogEdit").ejDialog("close"):(n.model.editSettings.editMode=="externalform"||n.model.editSettings.editMode=="externalformtemplate")&&(n.model.editSettings.formPosition=="right"&&$(n.element).children().css("width","100%"),$("#"+n._id+"_externalEdit").css("display","none")),n.refreshTemplate(),t={requestType:"cancel"},n.KanbanCommon._processBindings(t));n.element.parents("body").removeClass("e-kbnwindow-modal");n.element.hasClass("e-responsive")&&n.kanbanWindowResize()},n.prototype._renderExternalForm=function(){var n=this.kanbanObj,f=ej.buildTag("div","",{display:"none"},{id:n._id+"_externalEdit","class":"e-form-container"}),t=ej.buildTag("div","","",{id:n._id+"_eFormHeader","class":"e-form-titlebar"}),e=ej.buildTag("span","","",{"class":"e-form-title"}),i=ej.buildTag("div","","",{id:n._id+"_closebutton","class":"e-externalform-icon"}),o=ej.buildTag("span","","",{"class":"e-icon e-externaledit e-cancel"});i.append(o);t.append(e).append(i);var r=ej.buildTag("div","","",{id:n._id+"_eFormContent","class":"e-form-content"}),u=ej.buildTag("div","","",{id:n._id+"_externalForm","class":"e-externalform"}),s=ej.buildTag("div","","",{"class":"e-externalformedit"});return u.append(s),r.append(u),f.append(t).append(r)},n.prototype._maxZindex=function(){var n=1;return n=Math.max.apply(null,$.map($("body *"),function(n){if($(n).css("position")=="absolute")return parseInt($(n).css("z-index"))||1})),(n==undefined||n==null)&&(n=1),n},n.prototype.addCard=function(n,t){var i=this.kanbanObj,o,e,r,f,u;if(i._currentJsonData.length==0){o=[];o.push(t);i.element.ejKanban({dataSource:o});return}if(i.model.editSettings.allowAdding)if(r=i.model.fields.primaryKey,n!="bulk"&&$.type(i._currentJsonData[0][r])=="number"&&(n=parseInt(n)),e={data:t,requestType:"save",action:"add",primaryKeyValue:n},i._cAddedRecord=t,i._saveArgs=e,n&&t)i.updateCard(n,t);else{for(f=i.model.editSettings.editItems,e={requestType:"add"},i._currentData={},i._isAddNewClick&&(i.model.fields.swimlaneKey&&(i._currentData[i.model.fields.swimlaneKey]=$(i._newCard).parent().prev(".e-swimlanerow").find(".e-slkey").text()),i.model.keyField&&(i._currentData[i.model.keyField]=i.model.columns[$(i._newCard).index()].key)),u=0;u<f.length;u++)i._currentData[f[u].field]=ej.isNullOrUndefined(f[u].defaultValue)?ej.isNullOrUndefined(i._currentData[f[u].field])?"":i._currentData[f[u].field]:f[u].defaultValue;i._currentData[r]=i._currentJsonData[i._currentJsonData.length-1][r];$.type(i._currentJsonData[0][r])=="string"&&(i._currentData[r]=parseInt(i._currentData[r]));i._currentData[r]=i._currentData[r]+1;$.type(i._currentJsonData[0][r])=="string"&&(i._currentData[r]=i._currentData[r].toString());e.data=i._currentData;i.element.find(".e-kanbandialog").removeAttr("data-id");i.KanbanCommon._processBindings(e)}},n.prototype.deleteCard=function(n){var u,t=this.kanbanObj,f,i,e,r,o=t.model.fields.primaryKey,t=this.kanbanObj;if(f=t.element.find("#"+n),e=new ej.DataManager(t._currentJsonData),r=new ej.Query,r=r.where(t.model.fields.primaryKey,ej.FilterOperators.equal,n),i=e.executeLocal(r),$.type(t._currentJsonData[0][o])=="number"&&(n=parseInt(n)),u={div:f,data:i[0],requestType:"delete",primaryKeyValue:n},t._saveArgs=u,t._trigger("actionBegin",u))return!0;t._cDeleteData=i;t.updateCard(n,i[0])},n.prototype.startEdit=function(n){var t=this.kanbanObj;if($.type(n)!="object"&&(n=t.element.find("#"+n)),t.model.editSettings.allowEditing&&n.hasClass("e-kanbancard")){var f,i,e=t.model.fields.primaryKey,r=n.attr("id"),s=n.hasClass("e-rowcell")?n.index():n.closest(".e-rowcell").index(),h=t.getIndexByRow(n.closest("tr")),o,u=new ej.Query;if(f=n.closest(".e-kanbancard"),t._cardEditClick==!0?t._currentData.data=t._dblArgs.data:(o=new ej.DataManager(t._currentJsonData),u=u.where(e,ej.FilterOperators.equal,n.attr("id")),t._currentData=o.executeLocal(u)),$.type(t._currentJsonData[0][e])=="number"&&(r=parseInt(r)),i={target:n,rowIndex:h,data:t._currentData[0],columnIndex:s,cardIndex:f.index(),primaryKeyValue:r},t._trigger("beginEdit",i),i.requestType="beginedit",i.cancel)return;t.KanbanCommon._processBindings(i)}},n.prototype._refreshEditForm=function(n){var t=this.kanbanObj,v,s,b,d,y,l,p,f,i,r,u,c,a,o,h,e,k,w;for(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate"?(b=t.element.find("#"+t._id+"_dialogEdit_wrapper"),y=95,b.show(),l=$("#"+t._id+"_dialogEdit"),v=l.find("tr").find(".e-rowcell")):(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&(d=t.element.find("#"+t._id+"_externalEdit"),y=133,d.show(),l=$("#"+t._id+"_externalForm"),v=l.find("div").find(".e-rowcell")),e=0;e<v.length;e++)t._tdsOffsetWidth[e]=v.get(e).offsetWidth;for((t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate")&&(s=ej.max(t._tdsOffsetWidth)*(y/100)),p=0;p<t.model.editSettings.editItems.length;p++){if(f=t.model.editSettings.editItems[p],i=l.find("#"+t._id+"_"+f.field),(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&(s=ej.max(t._tdsOffsetWidth)*(y/100),$(i).parent().css("width",s+"px")),f.editType=="stringedit"&&i.width(s-4),c=f.editType=="textarea",a=t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate",u=f.editParams,!ej.isNullOrUndefined(u)&&c?(ej.isNullOrUndefined(u.width)||(i.width(u.width),c&&a&&i.parent().width(u.width+8)),ej.isNullOrUndefined(u.height)||(i.height(u.height),c&&a&&i.parent().height(u.height+8))):c&&(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate")?i.width(250).height(95):c&&a&&t.model.editSettings.formPosition=="bottom"?(i.height(95),$(i).css({width:"400px"}),$(i).parent().css({width:"500px"})):c&&a&&t.model.editSettings.formPosition=="right"&&(i.css({width:s-8}),i.height(150),$(i).parent().css("width",s+8)),f.editType=="rteedit")r={width:"450px",height:"260px",minHeight:"240px",locale:t.model.locale,enableRTL:t.model.enableRTL},u=f.editParams,r.toolsList=["style","links"],r.tools={style:["bold","italic","underline"],casing:["upperCase","lowerCase"],links:["createLink"]},ej.isNullOrUndefined(u)||$.extend(r,u),l.find("#"+t._id+"_"+f.field).ejRTE(r);else if(f.editType=="dropdownedit"){if(r={width:s,enableIncrementalSearch:!0,enableRTL:t.model.enableRTL},o=i.val(),u=f.editParams,h=[],f.field==t.model.keyField&&n.requestType==="beginedit")for(e=0;e<i.children().length;e++)k=i.children().eq(e).val(),ej.isNullOrUndefined(t.model.workflows)||(t.KanbanCommon._preventCardMove(o,i.children().eq(e).val())?!0:h.push(e)),o!=k&&(t.model.columns[t._getColumnKeyIndex(k)].allowDrop||$.inArray(e,h)===-1&&h.push(e),t.model.columns[t._getColumnKeyIndex(o)].allowDrag||$.inArray(e,h)===-1&&h.push(e));if(h.length>0)for(w=h.length-1;w>=0;w--)$(i.children()).eq(h[w]).remove();i.hasClass("e-disable")&&(r.enabled=!1);ej.isNullOrUndefined(u)||$.extend(r,u);t._kbnDdlWindowResize=!0;i.ejDropDownList(r);i.ejDropDownList("setSelectedValue",i.val());t._kbnDdlWindowResize=!1}else f.editType=="numericedit"?(r={width:s},o=i.val(),u=f.editParams,r.cssClass=t.model.cssClass,r.showSpinButton=!0,r.enableRTL=t.model.enableRTL,r.locale=t.model.locale,o.length&&(r.value=parseFloat(o)),i.hasClass("e-disable")&&(r.enabled=!1),ej.isNullOrUndefined(u)||$.extend(r,u),i.ejNumericTextbox(r)):f.editType=="datepicker"?(r={width:s},o=i.val(),u=f.editParams,r.cssClass=t.model.cssClass,r.displayDefaultDate=!0,r.enableRTL=t.model.enableRTL,r.locale=t.model.locale,o.length&&(r.value=new Date(o)),i.hasClass("e-disable")&&(r.enabled=!1),ej.isNullOrUndefined(u)||$.extend(r,u),i.ejDatePicker(r)):f.editType=="datetimepicker"&&(r={width:s,cssClass:t.model.cssClass,locale:t.model.locale,showPopupButton:!1,enableRTL:t.model.enableRTL},o=i.val(),u=f.editParams,o.length&&(r.value=new Date(o)),i.hasClass("e-disable")&&(r.enabled=!1),ej.isNullOrUndefined(u)||$.extend(r,u),i.ejDateTimePicker(r));f.editType!="textarea"&&$(i.outerWidth(s)).height(28);ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8&&i.css("line-height","26px")}a&&(t._editForm=t.element.find(".e-externalform"));(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate")&&(t._editForm=t.element.find(".kanbanform"),b.hide());this._formFocus()},n.prototype._setKanbanDdlValue=function(n){for(var e,i,r=n.find("select.e-field"),u,f=n.find("input.e-field.e-dropdownlist"),t=0;t<r.length;t++)e={},e[this.kanbanObj._id+"drpDownTempl"]="{{:"+r[t].name.replace(/[^a-z0-9\s]/gi,"")+"}}",$.templates(e),u=$.render[this.kanbanObj._id+"drpDownTempl"](this.kanbanObj._currentData),n.find("select").eq(t).val(u).attr("selected","selected"),r.eq(t).val(u);for(i=0;i<f.length;i++)f.eq(i).val(ej.getObject(f.eq(i).attr("name"),this.kanbanObj._currentData[0]))},n.prototype._editAdd=function(n){var f,t=this.kanbanObj,p=t.element.find(".e-kanbandialog"),e=$(n.target),a,h=new ej.Query,c=t.model.fields.primaryKey,o=document.createElement("div"),l=$(o),i,r,u,v,s,y;n.requestType=="add"?l.addClass("e-addedrow"):(t._currentData={},e.hasClass("e-kanbancard")?i=e.attr("id"):e.parents(".e-kanbancard").length>0&&(i=e.parents(".e-kanbancard").attr("id")),$.type(t._currentJsonData[0][c])=="number"&&(i=parseInt(i)),a=new ej.DataManager(t._currentJsonData),h=h.where(c,ej.FilterOperators.equal,i),t._currentData=a.executeLocal(h),l.addClass("e-editedrow"));o.innerHTML=$.render[t._id+"_dialogEditingTemplate"](t._currentData);this._setKanbanDdlValue(l);n.requestType=="add"?ej.isNullOrUndefined(t.model.fields.title)||$.isEmptyObject(t._newData)?u=t.localizedLabels.AddFormTitle:(r=t.model.fields.title,u=t.localizedLabels.EditFormTitle+t._newData[r]):(r=c,ej.isNullOrUndefined(t.model.fields.title)||(r=t.model.fields.title),u=t.localizedLabels.EditFormTitle+t._currentData[0][r]);t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate"?(f=$("#"+t._id+"_dialogEdit"),f.html($(o)),v={cssClass:t.model.cssClass,enableRTL:t.model.enableRTL,width:"auto",content:"#"+t._id,close:$.proxy(this.cancelEdit,this),beforeClose:$.proxy(this._onKbnDialogBeforeClose,this),beforeOpen:$.proxy(this._onKbnDialogBeforeOpen,this),open:$.proxy(this._onKbnDialogOpen,this),enableModal:!0,enableResize:!1,title:u},f.ejDialog(v),f.ejDialog("open"),p.attr("data-id",i),s=t.element.find("#"+t._id+"_dialogEdit_wrapper"),s.css("left","0"),y=self!=parent?ej.browserInfo().name=="chrome"?$(window).scrollTop():-$(window.frameElement).offset().top:$(window).scrollTop(),s.css("top",y),s.hide()):(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&($("#"+t._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),$("#"+t._id+"_externalForm").find(".e-externalformedit").html($(o)),$("#"+t._id+"_eFormHeader").find(".e-form-title").text(u),$("#"+t._id+"_externalForm").attr("data-id",i),this._externalFormPosition());$.isFunction($.validator)&&(this.initValidator(),this.setValidation())},n.prototype._onKbnDialogOpen=function(){var n=this.kanbanObj,t=n.element.find("#"+n._id+"_dialogEdit_wrapper"),i,r,e,u,f,o,s,c,h,l;t.css("position","absolute");e=$(n.element)[0];u=e.offsetTop;f=e.offsetLeft;o=$(e).find(".e-kanbancontent")[0].offsetWidth;s=$(e).find(".e-kanbancontent")[0].offsetHeight+$(n.element).find(".e-kanbanheader")[0].offsetHeight;window.pageYOffset>u?(i=u+s>window.pageYOffset+window.innerHeight?Math.max(0,(window.innerHeight-t.outerHeight())/2):Math.max(0,(u+s-window.pageYOffset-t.outerHeight())/2),i=window.pageYOffset+i):(i=u+s>window.pageYOffset+window.innerHeight?Math.max(0,(window.innerHeight-(u-window.pageYOffset)-t.outerHeight())/2):Math.max(0,(s-t.outerHeight())/2),i=u+i);window.pageXOffset>f?(r=f+o>window.pageXOffset+window.innerWidth?Math.max(0,(window.innerWidth-t.outerWidth())/2):Math.max(0,(f+o-window.pageXOffset-t.outerWidth())/2),r=window.pageXOffset+r):(r=f+o>window.pageXOffset+window.innerWidth?Math.max(0,(window.innerWidth-(f-window.pageXOffset)-t.outerWidth())/2):Math.max(0,(o-t.outerWidth())/2),r=f+r);t.css("top",i+"px");t.css("left",r+"px");t.show();this._formFocus();n._editForm.find(".e-rte").length>0&&n.element.find("#"+n._id+"_dialogEdit").data("ejDialog")._resetScroller();n.model.isResponsive&&n.element.hasClass("e-responsive")?(n._on($(".e-kanban-editdiv"),$.isFunction($.fn.tap)&&n.model.enableTouch?"tap":"click","",n._kbnAdaptEditClickHandler),n.KanbanAdaptive._setAdaptEditWindowHeight(),t.parents(".e-kanban").length>0&&t.appendTo("body")):$(window).scrollTop()+$(window).height()<t.height()+i&&(c=$("#"+n._id+"_dialogEdit"),h=c.parents(".e-dialog-scroller"),l,l=h.prev(".e-titlebar"),h.ejScroller({height:$(window).height()-(l.height()+n.element.find(".e-kanbandialog").offset().top)}),h.data("ejScroller").refresh(),c.css("height",h.height()))},n.prototype._externalFormPosition=function(){var n=this.kanbanObj,t=$(n.element).offset(),r=$(n.element).width(),u=$(n.element).height(),i=$("#"+n._id+"_externalEdit");switch(n.model.editSettings.formPosition){case"right":$(i).find(".e-close").removeClass("e-bottomleft").addClass("e-topright");$("#"+n._id+"_eFormContent").height("auto");n.model.allowScrolling||n.model.isResponsive?($(i).css({left:t.left+r+2+"px",top:t.top+"px",position:"absolute",width:"25%"}),$(".e-externalrow").css("padding-right","0px")):($(n.element).css({width:"100%"}),$(n.element).children().not(".e-form-container").css("width","73%"),$(i).css({left:t.left+$(n.element).children().width()+2+"px",top:t.top+"px",position:"absolute",width:"25%"}));break;case"bottom":$(i).find(".e-close").removeClass("e-topright").addClass("e-bottomleft");$(i).css({left:t.left+"px",top:t.top+u+1+"px"});$("#"+n._id+"_eFormContent").width("100%");(n.element.find(".e-scrollbar").hasClass("e-hscrollbar")||n.model.isResponsive)&&$("#"+n._id+"_externalEdit").css({border:"none","border-top":"1px solid"})}},n.prototype._formFocus=function(){for(var n,i=$(this.kanbanObj._editForm).find("input,select,div.e-field,textarea.e-field"),r=!1,t=0;t<i.length;t++)n=i.eq(t),(n.is(":disabled")||r||n.is(":hidden")&&typeof(n.data("ejDropDownList")||n.data("ejNumericTextbox"))!="object")&&!n.hasClass("e-rte")||(this._focusKbnDialogEle(n),r=!0)},n.prototype._focusKbnDialogEle=function(n){if(n.length)if((n[0].tagName.toLowerCase()!="select"||n.hasClass("e-field e-dropdownlist"))&&n[0].tagName.toLowerCase()!="input"&&(n[0].tagName.toLowerCase()!="textarea"||n.hasClass("e-numerictextbox")))n.hasClass("e-field e-dropdownlist")?n.closest(".e-ddl").focus():n.hasClass("e-numerictextbox")?n.siblings("input:visible").first().select().focus():n.find("input:visible,select").first().select().focus();else if(n.hasClass("e-rte")){var t=n.data("ejRTE");$(t).focus();t.selectAll()}else n.focus().select(),n[0].focus()},n.prototype.endEdit=function(){var n=this.kanbanObj,u,c,t,l,a,i,f,r,o,e,s,v,h;if(n.model.editSettings.allowEditing||n.model.editSettings.allowAdding){if(u=n.model.fields.primaryKey,c=n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="dialogtemplate"?$("#"+n._id+"_dialogEdit"):n.element.find(".e-externalform"),f={},!this.editFormValidate())return!0;for(t=document.getElementById(n._id+"EditForm"),l=$(t),a=l.closest("div"),ej.isNullOrUndefined(c.attr("data-id"))?(i=n._currentJsonData[n._currentJsonData.length-1][u],$.type(n._currentJsonData[0][u])=="string"&&(i=parseInt(i)),i=i+1,$.type(n._currentJsonData[0][u])=="string"&&(i=i.toString()),f[u]=i):(i=c.attr("data-id"),$.type(n._currentJsonData[0][u])=="number"&&(i=parseInt(i))),r=0;r<t.length;r++)if(!a.hasClass("e-addedrow")||!$(t[r]).hasClass("e-identity")){if(o=t[r].name,e=$(t[r]),(e.hasClass("e-dropdownlist")||e.hasClass("e-input"))&&(ej.isNullOrUndefined(e.attr("id"))||e.attr("id").indexOf("_input")!=-1||e.attr("id").indexOf("_hidden")!=-1)){!ej.isNullOrUndefined(l[1])&&ej.isNullOrUndefined(t[r+1])&&(t=l[1],r=-1);continue}o!=undefined&&(o==""&&(t[r].id.indexOf("Save")!=-1||t[r].id.indexOf("Cancel")!=-1?o="":(o=t[r].id.replace(n._id+"_",""),o=o.replace("_hidden",""))),o!=""&&f[o]==null?(s=t[r].value,$(t[r]).hasClass("e-datepicker")?s=e.ejDatePicker("model.value"):$(t[r]).hasClass("e-datetimepicker")?s=e.ejDateTimePicker("model.value"):e.is(".e-numerictextbox")?(s=e.ejNumericTextbox("getValue"),ej.isNullOrUndefined(s)||(s=s.toString())):e.data("ejDropDownList")&&(s=e.ejDropDownList("getSelectedValue")),v=t[r].type!="checkbox"?s:$(t[r]).is(":checked"),f[o]=v):o==u&&(f[u]=t[r].value))}if(n._editForm=$("#"+n._id+"EditForm"),f[u]=isNaN(f[u])?i:$.type(n._currentJsonData[0][u])=="number"?i=parseInt(f[u]):i=f[u],h={data:f,requestType:"save"},n._trigger("actionBegin",h))return!0;$(n._editForm).hasClass("e-formdestroy")?n.refresh(!0):ej.isNullOrUndefined(c.attr("data-id"))?(h.action="add",h.primaryKeyValue=i,n._cAddedRecord=f):(h.action="edit",h.primaryKeyValue=i,n._cModifiedData=f);h.primaryKey=u;n._saveArgs=h;n.updateCard(i,f);n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="dialogtemplate"?(c.removeAttr("data-id"),$("#"+n._id+"_dialogEdit").ejDialog("close")):(n.model.editSettings.editMode=="externalform"||n.model.editSettings.editMode=="externalformtemplate")&&(n.model.editSettings.formPosition=="right"&&$(n.element).children().css("width","100%"),c.removeAttr("data-id"),$("#"+n._id+"_externalEdit").css("display","none"))}n.element.hasClass("e-responsive")&&(n.kanbanWindowResize(),n.element.find(".e-kbnadapt-editdlg").length==0&&$("#"+n._id+"_dialogEdit_wrapper").appendTo(n.element))},n.prototype.initValidator=function(){for(var n=this.kanbanObj,i=n.element.find(".kanbanform"),t=0;t<i.length;t++)i.eq(t).validate({ignore:".e-hide,:hidden",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(t,i){i.is(":hidden")&&(i=i.siblings("input:visible"));var u=i.closest("td"),r=$(t).addClass("e-error"),f=ej.buildTag("div.e-errortail e-toparrow");n.model.editSettings.editMode!="dialog"&&u.find(".e-error").remove();i.parent().hasClass("e-in-wrap")?r.insertAfter(i.closest(".e-widget")):r.insertAfter(i);r.prepend(f);n.model.enableRTL?n.model.editSettings.editMode!="dialog"&&r.offset({left:i.offset().left,top:i.offset().top+i.height()}):n.model.editSettings.editMode!="dialog"&&r.offset({left:i.offset().left,top:i.offset().top+i.height()});r.fadeIn("slow")}})},n.prototype.setValidation=function(){for(var t=this.kanbanObj,n=0;n<t.model.editSettings.editItems.length;n++)ej.isNullOrUndefined(t.model.editSettings.editItems[n].validationRules)||this.setValidationToField(t.model.editSettings.editItems[n].field,t.model.editSettings.editItems[n].validationRules)},n.prototype.setValidationToField=function(n,t){var i=n,u,r,f=this.kanbanObj,e,o;ej.isNullOrUndefined(n)||(i=i.replace(/[^a-z0-9\s_]/gi,""));e=$("#"+f._id+"EditForm");u=e.find("#"+f._id+"_"+i).length>0?e.find("#"+f._id+"_"+i):e.find("#"+i);u.attr("name")||u.attr("name",n);u.rules("add",t);o=$("#"+f._id+"EditForm").validate();o.settings.messages[n]=o.settings.messages[n]||{};ej.isNullOrUndefined(t.required)||(r=ej.isNullOrUndefined(t.messages&&t.messages.required)?$.validator.messages.required:t.messages.required,r.indexOf("This field")==0&&(r=r.replace("This field",n)),o.settings.messages[n].required=r)},n.prototype.editFormValidate=function(){return $.isFunction($.validator)?$("#"+this.kanbanObj._id+"EditForm").validate().form():!0},n.prototype._addDialogEditingTemplate=function(){var n=this.kanbanObj,h=ej.buildTag("div"),u,y,f,p,r,w,b,e,k,c,o,i,t,l,tt,d,it,g,a,v,rt,s,nt;if(n.model.columns.length!=0){if(u=ej.buildTag("form.kanbanform","",{},{id:n._id+"EditForm"}),y=ej.buildTag("table","",{},{cellspacing:"14px"}),ej.isNullOrUndefined(n.model.editSettings.editMode)&&(n.model.editSettings.editMode="dialog"),n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="externalform")for(o=0;o<n.model.editSettings.editItems.length;o++){i=n.model.editSettings.editItems[o];t=i.field;n.model.editSettings.editMode=="dialog"?(k="tr",c="td"):(k="div.e-externalrow",c="div");f=ej.buildTag(k);p=ej.buildTag(c,"",{}).addClass("e-label");r=ej.buildTag(c,"",{"text-align":"left"}).addClass("e-rowcell");o==n.model.editSettings.editItems.length-1&&r.addClass("e-last-rowcell");f.append(p.get(0)).append(r.get(0));p.append("<label style='text-transform:capitalize' for='"+t+"'>"+t+"<\/label>");n.model.editSettings.editMode=="externalform"&&n.model.editSettings.formPosition=="right"&&f.css({width:"300px","padding-right":"0px"});ej.isNullOrUndefined(i.editType)&&(i.editType="stringedit");ej.isNullOrUndefined(t)||(t=t.replace(/[^a-z0-9\s_]/gi,""));switch(i.editType){case"stringedit":n.model.fields.primaryKey==t?r.html(ej.buildTag("input.e-field e-ejinputtext e-disable","",{},{value:"{{html:#data['"+t+"']}}",id:n._id+"_"+t,name:t,disabled:"disabled"})):r.html(ej.buildTag("input.e-field e-ejinputtext","",{},{value:"{{html:#data['"+t+"']}}",id:n._id+"_"+t,name:t}));break;case"numericedit":r.html(ej.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+t+"']}}",id:n._id+"_"+t,name:t}));break;case"dropdownedit":if(l=[],ej.isNullOrUndefined(i.dataSource))for(v=(new ej.Query).where(ej.Predicate.or(n.keyPredicates)).select(i.field),ej.isNullOrUndefined(this._dropDownManager)||!n._dataManager.dataSource.offline&&n._dataManager.dataSource.json.length?g=n._dataManager.executeLocal(v):(n._dataManager.adaptor instanceof ej.JsonAdaptor&&i.field.indexOf(".")!=-1&&(rt=i.field.replace(/\./g,ej.pvt.consts.complexPropertyMerge),v=(new ej.Query).select(rt)),g=this._dropDownManager.executeLocal(v)),a=ej.dataUtil.mergeSort(ej.dataUtil.distinct(g)),s=0;s<a.length;s++)l.push({text:a[s],value:a[s]});else l=i.dataSource;d=ej.buildTag("select");it=ej.buildTag("option","{{:text}}",{},{value:"{{html:#data['value']}}"});d.append(it);tt=$.templates(d.html());r.get(0).innerHTML=ej.isNullOrUndefined(i.editParams)||ej.isNullOrUndefined(i.dataSource)?["<select>",tt.render(l),"<\/select>"].join(""):"<input>";r.find("select,input").prop({id:n._id+"_"+t,name:t}).addClass("e-field e-dropdownlist");break;case"rteedit":r.html(ej.buildTag("textarea.e-field e-rte","{{html:#data['"+t+"']}}",{},{id:n._id+"_"+t,name:t}));break;case"textarea":r.html(ej.buildTag("textarea.e-field e-kanbantextarea e-ejinputtext","{{html:#data['"+t+"']}}",{},{id:n._id+"_"+t,name:t}));break;case"datepicker":case"datetimepicker":r.html(ej.buildTag("input.e-"+i.editType+" e-field","",{},{type:"text",value:"{{:#data['"+t+"']}}",id:n._id+"_"+t,name:t}))}n.model.editSettings.editMode=="dialog"?(u.append(y),y.append(f)):u.append(f);u.appendTo(h)}else n.model.editSettings.editMode=="dialogtemplate"&&n.model.editSettings.dialogTemplate!=null&&(nt=n.model.editSettings.dialogTemplate),n.model.editSettings.editMode=="externalformtemplate"&&n.model.editSettings.externalFormTemplate!=null&&(nt=n.model.editSettings.externalFormTemplate),u.html($(nt).html()),u.appendTo(h);w=ej.buildTag("input.e-save","",{},{type:"button",id:n._id+"_Save"});w.ejButton({text:n.localizedLabels.SaveButton});b=n.model.editSettings.formPosition!="right"?ej.buildTag("input.e-cancel","",{},{type:"button",id:n._id+"_Cancel"}):ej.buildTag("input.e-cancel","",{},{type:"button",id:n._id+"_Cancel"});b.ejButton({text:n.localizedLabels.CancelButton});e=n.model.editSettings.editMode!="dialog"&&n.model.editSettings.editMode!="dialogtemplate"?ej.buildTag("div","","",{"class":"e-editform-btn"}):ej.buildTag("div#"+n._id+"_EditBtnDiv","",{},{"class":"e-kanban-editdiv"});e.append(w);e.append(b);n.model.editSettings.editMode!="dialog"&&n.model.editSettings.editMode!="dialogtemplate"?e.appendTo(h):u.append(e);$.templates(n._id+"_dialogEditingTemplate",h.html())}},n}();window.ej.createObject("ej.KanbanFeatures.Edit",InternalEdit,window);InternalContext=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._renderContext=function(){var n=this.kanbanObj,u,l,h,i,r,t,e,y,a,f,p,c,o,s,v;for(u=n.model.contextMenuSettings.menuItems,f=ej.buildTag("ul","",{},{id:n._id+"_Context"}),p=n.model.contextMenuSettings.disableDefaultItems,s=0;s<u.length;s++)(u[s]==""||u[s]==" ")&&u.splice(s,1);for(t=0;t<u.length;t++)i=u[t],$.inArray(i,p)==-1&&(r=this._items(i,"menuItem")),f.append(r);for(c=n.model.contextMenuSettings.customMenuItems,e=0;e<c.length;e++)y=c[e].text,a=this._items(y,"custom"),c[e].template&&a.append($(c[e].template)),f.append(a);for(o=ej.buildTag("ul","",{},{id:n._id+"_SubContext"}),t=0;t<n.model.columns.length;t++)i=n.model.columns[t].headerText,l=ej.buildTag("input","",{},{type:"checkbox",name:i}),r=this._items(i,"subMenuItem"),r.find("span").append(l),r.find("span").addClass("e-checkbox e-visiblecolumns"),o.append(r),l.ejCheckBox({checked:n.model.columns[t].visible});if($(f).find("li.e-column.e-visiblecolumn").append(o),n.model.fields.swimlaneKey){for(o=ej.buildTag("ul","",{},{id:n._id+"_SubContext"}),v=(new ej.Query).select([n.model.fields.swimlaneKey]),h=n._dataManager.dataSource.offline?n._dataManager.executeLocal(v):n._contextSwimlane.executeLocal(v),h=ej.dataUtil.mergeSort(ej.dataUtil.distinct(h)),t=0;t<h.length;t++)i=h[t],r=this._items(i,"subMenuItem"),o.append(r);$(f).find("li.e-move.e-swimlane").append(o)}$(f).ejMenu({menuType:ej.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+n._id,click:$.proxy(n._clickevent,n),width:"auto",cssClass:"e-kanban-context",beforeOpen:$.proxy(n._menu,n),open:$.proxy(this._contextopen,n)});n._conmenu=f.data("ejMenu")},n.prototype._contextopen=function(){var n=this._conmenu.element;n.length>0&&(n.find("li").is(":visible")||n.css("visibility","hidden"))},n.prototype._kanbanContextClick=function(n,t){var u,i,r,o,e,f,h,s,l,c;if(f=n.parentText!=null?n.parentText:n.events.text,u=$(t._contexttarget),n.targetelement=t._contexttarget,i=u.closest(".e-kanbancard"),r=i.length,i.length>0&&(n.card=i,n.index=i.parent(".e-rowcell").find(".e-kanbancard").index(i),n.cellIndex=i.parent(".e-rowcell").index(),n.rowIndex=t.getIndexByRow(i.parents(".e-columnrow")),n.cardData=t.KanbanCommon._getKanbanCardData(t._currentJsonData,i.attr("id"))[0]),!t._trigger("contextClick",n)){switch(f){case t.localizedLabels.AddCard:t._isAddNewClick=!0;t._newCard=$(t._contexttarget);t.KanbanEdit&&t.KanbanEdit.addCard();break;case t.localizedLabels.EditCard:r>0&&!ej.isNullOrUndefined(t.model.fields.primaryKey)&&t.KanbanEdit&&t.KanbanEdit.startEdit(i);break;case t.localizedLabels.HideColumn:u.closest(".e-headercell").find(".e-headercelldiv").length>0&&t.hideColumns($.trim(u.closest(".e-headercell").find(".e-headercelldiv .e-headerdiv").text()).split("[")[0]);break;case t.localizedLabels.DeleteCard:!ej.isNullOrUndefined(t.model.fields.primaryKey)&&i.length>0&&t.KanbanEdit&&(t.KanbanEdit.deleteCard(i.attr("id")),t.KanbanCommon._showhide(t._hiddenColumns,"hide"),t.model.enableTotalCount&&t.KanbanCommon._totalCount());break;case t.localizedLabels.MoveRight:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropToColumn($(t._contexttarget).closest("td.e-rowcell").next(),i),t.model.enableTotalCount&&t.KanbanCommon._totalCount());break;case t.localizedLabels.MoveLeft:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropToColumn($(t._contexttarget).closest("td.e-rowcell").prev(),i),t.model.enableTotalCount&&t.KanbanCommon._totalCount());break;case t.localizedLabels.MoveUp:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(i.prev(),i,!1));break;case t.localizedLabels.MoveDown:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(i.next(),i,!0));break;case t.localizedLabels.TopofRow:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(u.closest("td.e-rowcell").find(".e-kanbancard").first(),i,!1));break;case t.localizedLabels.BottomofRow:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(u.closest("td.e-rowcell").find(".e-kanbancard").last(),i,!0));break;case t.localizedLabels.MovetoSwimlane:f!=n.text&&r>0&&(o=u.closest(".e-kanbancard").attr("id"),e=new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(t.model.fields.primaryKey,ej.FilterOperators.equal,o))[0],e[t.model.fields.swimlaneKey]=n.text,f={data:e,requestType:"save",primaryKeyValue:e[t.model.fields.primaryKey]},t._saveArgs=f,t.updateCard(o,e),t.KanbanCommon._showhide(t._hiddenColumns,"hide"),t._dataManager.dataSource.offline&&(t._saveArgs=null));break;case t.localizedLabels.PrintCard:r>0&&t.print(i);break;case t.localizedLabels.VisibleColumns:f!=n.text&&(h=$(n.element.parentElement).find("li").index(n.element),t.model.columns[h].visible?(t.hideColumns(n.text),$($(n.element).find("input.e-checkbox")).ejCheckBox({checked:!1})):(t.showColumns(n.text),$($(n.element).find("input.e-checkbox")).ejCheckBox({checked:!0})))}t.model.isResponsive&&t.kanbanWindowResize();t.model.allowScrolling&&!t.element.hasClass("e-responsive")&&t.kanbanContent.data("ejScroller").refresh();t.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(t.model.fields.swimlaneKey)&&t._kbnAdaptDdlIndex>0&&(s=t.kanbanContent.data("ejScroller"),c=t._freezeScrollTop,l=t.element[0].getElementsByClassName("e-columnrow"),s.scrollY(0,!0),t._freezeScrollTop=c,s.scrollY(t._freezeScrollTop,!0))}},n.prototype._kanbanMenu=function(n,t){var i,f,e,w,a,o,b,s,u,h,r,v,c,y,p,l;if(i=t._conmenu.element,t._contexttarget=n.target,f=$(n.target),e=$(t._contexttarget).closest("td.e-rowcell"),w=$(t._contexttarget).closest("tr.e-columnrow"),a=f.closest(".e-rowcell"),o=$(f).closest(".e-kanbancard"),y=t.KanbanCommon._getKanbanCardData(t._currentJsonData,o.attr("id"))[0],b=t.model.contextMenuSettings.menuItems,i.css("visibility","visible"),i.find("li").hide(),f.closest(".e-kanban").attr("id")!==t._id){i.css("visibility","hidden");return}if(i.find(".e-customitem").length>0)for(s=t.model.contextMenuSettings.customMenuItems,u=i.find(".e-customitem"),r=0;r<u.length;r++)if(s[r].target||(s[r].target="all"),s[r].target&&s[r].text==i.find(".e-customitem").children("a").eq(r).text())switch(s[r].target){case"content":t.getContentTable().find(f).length>0?($(u[r]).show(),$(u[r]).find("li").length>0&&$(u[r]).find("li").show()):$(u[r]).hide();break;case"header":t.getHeaderContent().find(f).length>0?($(u[r]).show(),$(u[r]).find("li").length>0&&$(u[r]).find("li").show()):$(u[r]).hide();break;case"card":t.element.find(".e-kanbancard").find(f).length>0?($(u[r]).show(),$(u[r]).find("li").length>0&&$(u[r]).find("li").show()):$(u[r]).hide();break;case"all":$(u[r]).show();$(u[r]).find("li").length>0&&$(u[r]).find("li").show()}if(t.getContentTable().find(f).length>0){if(a.length==0||f.filter(".e-targetclone,.e-targetdragclone").length>0){i.css("visibility","hidden");return}if($(f).closest(".e-swimlanerow").length>0){i.css("visibility","hidden");return}o.length>0?(p=$(f).closest("td.e-rowcell").find(".e-kanbancard"),c=p.index(o),v=p.length,$(i.find("li").not(".e-customitem")).hide(),$(i.find(".e-customitem li")).show(),!ej.isNullOrUndefined(t.model.fields.primaryKey)&&t.model.editSettings.allowEditing&&i.find(".e-content.e-cardedit").show(),e.hasClass("e-drag")&&(c>1&&i.find(".e-move.e-up").show(),c!=v-1&&e.hasClass("e-drop")&&i.find(".e-row.e-bottom").show(),c!=0&&e.hasClass("e-drop")&&i.find(".e-row.e-top").show(),v-1-c>1&&i.find(".e-move.e-down").show(),e.next().length>0&&e.next().hasClass("e-drop")&&!t._checkMultikey(e.next())&&t.KanbanCommon._preventCardMove(y[t.model.keyField],t.model.columns[e.next().index()].key)&&i.find(".e-move.e-right").show(),e.prev().length>0&&e.prev().hasClass("e-drop")&&!t._checkMultikey(e.prev())&&t.KanbanCommon._preventCardMove(y[t.model.keyField],t.model.columns[e.prev().index()].key)&&i.find(".e-move.e-left").show(),t.model.fields.swimlaneKey&&t.model.fields.primaryKey&&i.find(".e-move.e-swimlane").length>0&&(i.find(".e-move.e-swimlane").show(),i.find(".e-move.e-swimlane").find("li").show(),i.find(".e-move.e-swimlane").find("li").eq(t._columnRows.index(w)).hide())),ej.isNullOrUndefined(t.model.fields.primaryKey)||i.find(".e-content.delete").show(),t.model.allowPrinting&&i.find(".e-print").show()):a.length>0&&($(i.find("li").not(".e-customitem")).hide(),$(i.find(".e-customitem li")).show(),t.model.editSettings.allowAdding&&i.find(".e-add").show())}else if(t.getHeaderContent().find(f).length>0)if(l=i.find(".e-column"),$(f).closest(".e-headercell").not(".e-stackedHeaderCell").length>0){for($(i.find("li").not(".e-customitem")).hide(),$(i.find(".e-customitem li")).show(),$(i.find("li.e-haschild").find("li")).show(),l.show(),h=0;h<i.find(".e-column.e-visiblecolumn").find("li").length;h++)t.element.find(".e-headercell").not(".e-stackedHeaderCell").eq(h).hasClass("e-hide")?l.find("li input.e-checkbox").eq(h).ejCheckBox({checked:!1}):l.find("li input.e-checkbox").eq(h).ejCheckBox({checked:!0});l.find("li").show()}else{i.css("visibility","hidden");return}else{i.css("visibility","hidden");return}t.model.contextOpen&&(n.card=o,n.index=o.parent(".e-rowcell").find(".e-kanbancard").index(o),n.cellIndex=o.parent(".e-rowcell").index(),n.rowIndex=t.getIndexByRow(o.parents(".e-columnrow")),n.cardData=t.KanbanCommon._getKanbanCardData(t._currentJsonData,o.attr("id"))[0],t._trigger("contextOpen",n))},n.prototype._items=function(n,t){var i,r,u,f;return n==""||ej.isNullOrUndefined(n)?!1:(t=="menuItem"?n.indexOf("Card")!=-1?(i=ej.buildTag("li","",{},{"class":"e-content"}),i.css("display","none"),n.indexOf("Add")!=-1&&(i.addClass("e-add"),r=this.kanbanObj.localizedLabels.AddCard),n.indexOf("Edit")!=-1&&(i.addClass("e-cardedit"),r=this.kanbanObj.localizedLabels.EditCard),n.indexOf("Delete")!=-1&&(i.addClass("delete"),r=this.kanbanObj.localizedLabels.DeleteCard),n.indexOf("Print")!=-1&&(i.addClass("e-print"),r=this.kanbanObj.localizedLabels.PrintCard),i.css("display","none")):n.indexOf("Column")!=-1||n.indexOf("Columns")!=-1?(i=ej.buildTag("li","",{},{"class":"e-column"}),n.indexOf("Hide")!=-1&&(i.addClass("e-hidecolumn"),r=this.kanbanObj.localizedLabels.HideColumn),n.indexOf("Visible")!=-1&&(i.addClass("e-visiblecolumn"),r=this.kanbanObj.localizedLabels.VisibleColumns),i.css("display","none")):n.indexOf("Row")!=-1?(i=ej.buildTag("li","",{},{"class":"e-row"}),n.indexOf("Top")!=-1?(i.addClass("e-top"),r=this.kanbanObj.localizedLabels.TopofRow):(i.addClass("e-bottom"),r=this.kanbanObj.localizedLabels.BottomofRow),i.css("display","none")):n.indexOf("Move")!=-1&&(i=ej.buildTag("li","",{},{"class":"e-move"}),n.indexOf("Left")!=-1?(i.addClass("e-left"),r=this.kanbanObj.localizedLabels.MoveLeft):n.indexOf("Right")!=-1?(i.addClass("e-right"),r=this.kanbanObj.localizedLabels.MoveRight):n.indexOf("Up")!=-1?(i.addClass("e-up"),r=this.kanbanObj.localizedLabels.MoveUp):n.indexOf("Down")!=-1?(i.addClass("e-down"),r=this.kanbanObj.localizedLabels.MoveDown):n.indexOf("Swimlane")!=-1&&(i.addClass("e-swimlane"),r=this.kanbanObj.localizedLabels.MovetoSwimlane),i.css("display","none")):t=="subMenuItem"?i=ej.buildTag("li","",{},{}):t=="custom"&&(i=ej.buildTag("li","",{},{"class":"e-customitem"}),i.css("display","block")),u=document.createElement("a"),f="",f=typeof n=="string"?n.indexOf("Move to")!=-1?n.split(" ")[2].toLowerCase():n.indexOf("Move")!=-1?n.split(" ")[1].toLowerCase():n.split(" ")[0].toLowerCase():n,u.innerHTML=ej.isNullOrUndefined(r)?n:r,$(u).append(ej.buildTag("span","",{},{"class":"e-kanbancontext e-icon e-context"+f})),i.append(u),i)},n.prototype._kbnBrowserContextMenu=function(n){this._kbnBrowserContext=="contextmenu"&&this.model.enableTouch&&n.preventDefault();this._kbnBrowserContext="null"},n}();window.ej.createObject("ej.KanbanFeatures.Context",InternalContext,window);InternalSwimlane=function(){function n(n){this.kanbanObj=null;this._removeFreezeRow=function(n){var n=this.kanbanObj;(n.model.scrollSettings.allowFreezeSwimlane||$.isEmptyObject(n._freezeSwimlaneRow))&&(!n.element.hasClass("e-responsive")||ej.isNullOrUndefined(n.model.fields.swimlaneKey)||!n.model.scrollSettings.allowFreezeSwimlane)||this._removeFreezeslRow()};this._removeFreezeslRow=function(n){var n=this.kanbanObj,t;n._freezeSwimlaneRow.remove();n.headerContent.css({position:"",top:""});n.kanbanContent.css({position:"",top:""});t=n.element.find(".e-kanbantoolbar");t.length>0&&t.css({position:"",top:""})};this.kanbanObj=n}return n.prototype.expandAll=function(){var t=this.kanbanObj.element.find(".e-swimlanerow .e-slcollapse"),n;if(t.length!=0)for(n=0;n<t.length;n++)this.toggle($(t[n]))},n.prototype.collapseAll=function(){var t=this.kanbanObj.element.find(".e-swimlanerow .e-slexpand"),n;if(t.length!=0)for(n=0;n<t.length;n++)this.toggle($(t[n]))},n.prototype.toggle=function(n){var t,i,r=this.kanbanObj,u;if(typeof n=="string"||typeof n=="number")t=r.KanbanCommon._removeIdSymbols(n),i=r.element.find('tr[id="'+t+'"]'),this._toggleSwimlaneRow($(i).find(".e-rowcell .e-slexpandcollapse"));else if(typeof n=="object"&&n[0].nodeName!="DIV")for(u=0;u<n.length;u++)t=r.KanbanCommon._removeIdSymbols(n[u]),i=r.element.find('tr[id="'+t+'"]'),this._toggleSwimlaneRow($(i).find(".e-rowcell .e-slexpandcollapse"));else this._toggleSwimlaneRow(n)},n.prototype._toggleSwimlaneRow=function(n){var t=this.kanbanObj,s,a=t._swimlaneRows.index(n.parents(".e-swimlanerow")),v,y=t.currentViewData[a],p=n.parent().next(".e-slkey").html(),u,i,f,h,e,o,r,c,l;if(n=n.hasClass("e-slexpandcollapse")?n.find("div:first"):n,n.hasClass("e-slexpand")||n.hasClass("e-slcollapse")){if(u=n.closest("tr"),u.next(".e-collapsedrow").remove(),i=u.next(),f=t.KanbanCommon._removeIdSymbols(n.parent().next(".e-slkey").html()),v=n.hasClass("e-slexpand")?"collapse":"expand",s={target:n,swimlaneRow:u,data:y.items,cards:i.find(".e-kanbancard"),id:p,key:y.key,rowIndex:a,action:v},t._trigger("swimlaneClick",s),s.cancel)return!1;if(n.hasClass("e-slexpand")){for(i.hide(),h=ej.buildTag("tr","",{},{"class":"e-collapsedrow"}),e=t.model.columns,r=0;r<e.length;r++)o=ej.buildTag("td","",{},{"class":"e-rowcell",role:"kanbancell"}),e[r].visible||o.addClass("e-hide"),e[r].isCollapsed&&o.addClass("e-shrink"),h.append(o);i.before(h);n.removeClass("e-slexpand").addClass("e-slcollapse");$.inArray(f,t._collapsedSwimlane)==-1&&t._collapsedSwimlane.push(f)}else i.show(),n.removeClass("e-collapsedrow").removeClass("e-slcollapse").addClass("e-slexpand"),c=$.inArray(f,t._collapsedSwimlane),c!=-1&&t._collapsedSwimlane.splice(c,1);t.model.allowScrolling&&(l=t.headerContent.find(".e-hscrollcss"),t.KanbanScroll._refreshScroller({requestType:"refresh"}),t.getContent().find(".e-vscrollbar").length>0?l.removeClass("e-vscroll-area"):l.addClass("e-vscroll-area"))}},n.prototype._freezeRow=function(n,t){var c=t.model.fields.swimlaneKey,k=t.element.find(".e-kanbantoolbar"),o,p,l,a,w,d;if(t._freezeSwimlaneRow=t.element.find(".e-freezeswimlanerow"),this._removeFreezeRow(),(!t.element.hasClass("e-responsive")||!ej.isNullOrUndefined(c))&&(t.element.hasClass("e-responsive")||t.model.scrollSettings.allowFreezeSwimlane&&!ej.isNullOrUndefined(c)&&(ej.isNullOrUndefined(n.scrollLeft)||t._freezeSwimlaneRow.length!=0))){if(t._freezeSwimlaneRow.length<=0&&t.model.scrollSettings.allowFreezeSwimlane&&!t.element.hasClass("e-responsive"))t._freezeSwimlaneRow=ej.buildTag("div.e-freezeswimlanerow e-swimlanerow","<div><\/div>",{},{}),o=t.headerContent.offset().top+t.headerContent.height()-(t.element.offset().top+1),d=t.element.height(),t._freezeSwimlaneRow.prependTo(t.element).css({top:o}),o=t._freezeSwimlaneRow.height(),t.headerContent.css({position:"relative",top:-o}),t.kanbanContent.css({position:"relative",top:-o}),k.length>0&&k.css({position:"relative",top:-o}),t.element.height(d),p=t._swimlaneRows.eq(0),t._freezeSwimlaneRow.children().append(p.find(".e-slkey,.e-slcount").clone()),t._freezeSwimlaneRow.width(t.headerContent.width()-1).height(p.height()),t._freezeSlOrder=0,l=ej.buildTag("table.e-table e-freeze-table","",{},{cellspacing:"0.25px"}),l.append(t.getContentTable().find("colgroup").clone()),a=ej.buildTag("tbody","",{},{}),l.append(a),a.append(t.getContentTable().find(".e-columnrow").eq(0).clone().removeClass("e-columnrow").addClass("e-collapsedrow")),w=a.find("td"),w.removeClass("e-droppable").removeAttr("ej-mappingkey").height(0),w.children().remove(),t._freezeSwimlaneRow.append(l);else if(t._freezeSwimlaneRow.length>0||!ej.isNullOrUndefined(c)&&t.element.hasClass("e-responsive")){var i,r=0,h=0,b=0,v,y=t.element.find(".e-swimlane-text"),u,s,e,f;!ej.isNullOrUndefined(c)&&t.element.hasClass("e-responsive")?(v=t.element.find(".e-columnrow"),i=t.getContent().offset().top,s=v.eq(t._freezeSlOrder),u=v.eq(t._freezeSlOrder+1),e=v.eq(t._freezeSlOrder-1),u.length>0&&(r=u.offset().top),s.length>0&&(h=s.offset().top),e.length>0&&(b=e.offset().top)):t._freezeSwimlaneRow.length>0&&(i=t.getContent().offset().top+t._freezeSwimlaneRow.height(),s=t._swimlaneRows.eq(t._freezeSlOrder),u=t._swimlaneRows.eq(t._freezeSlOrder+1),e=t._swimlaneRows.eq(t._freezeSlOrder-1),u.length>0&&(r=u.offset().top+u.height()),h=s.offset().top+s.height(),b=e.offset().top+e.height());f=t.element.find(".e-freezeswimlanerow >div");t._freezeScrollTop>n.scrollTop&&(h=h,i>=r&&(r=i+1));t._freezeScrollTop<n.scrollTop&&(r=r);(n.source=="wheel"||n.source=="button")&&(t._freezeScrollTop<n.scrollTop?r=r-n.model.scrollOneStepBy:t._freezeScrollTop>n.scrollTop&&(i=i-n.model.scrollOneStepBy));i>=r&&t._freezeSlOrder<t._swimlaneRows.length-1?(f.length>0&&(f.children().remove(),f.append(u.find(".e-slkey,.e-slcount").clone())),y.length>0&&(y.text(t._kbnAdaptDdlData[t._kbnAdaptDdlIndex+1]),++t._kbnAdaptDdlIndex),++t._freezeSlOrder):i<h&&i>b&&t._freezeSlOrder>0&&(f.length>0&&(f.children().remove(),f.append(e.find(".e-slkey,.e-slcount").clone())),y.length>0&&(y.text(t._kbnAdaptDdlData[t._kbnAdaptDdlIndex-1]),--t._kbnAdaptDdlIndex),--t._freezeSlOrder);n.scrollTop==0&&this._removeFreezeslRow();ej.isNullOrUndefined(n.scrollLeft)||(f.css({left:-n.scrollLeft}),t._freezeSwimlaneRow.find("table").css({left:-n.scrollLeft}))}t._freezeScrollTop=n.scrollTop}},n.prototype._swimlaneLimit=function(){for(var i,s,e,h,o,c,r,a,t,n=this.kanbanObj,u=0;u<n.model.columns.length;u++)if(i=n.model.columns[u].constraints,s=n.KanbanCommon._multikeySeparation(n.model.columns[u].key),!ej.isNullOrUndefined(i)){var l=!ej.isNullOrUndefined(i.min),v=!ej.isNullOrUndefined(i.max),f=$($(n.getContent().find(".e-columnrow")).find('td[ej-mappingkey="'+s+'"]'));if(i.type=="swimlane"&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey))for(r=0;r<f.length;r++)$(f).eq(r).find(".e-limits").length==0&&(a=ej.buildTag("div.e-limits"),$(f).eq(r).prepend(a)),t=$(f).eq(r).find(".e-limits"),l&&(e=ej.buildTag("div.e-min",n.localizedLabels.Min,"",{}),h=ej.buildTag("span.e-minlimit"," "+i.min.toString(),"",{}),e.append(h),t.find(".e-min").length>0&&t.find(".e-min").remove(),t.append(e)),v&&(o=ej.buildTag("div.e-max",n.localizedLabels.Max,"",{}),c=ej.buildTag("span.e-maxlimit"," "+i.max.toString(),"",{}),o.append(c),t.find(".e-max").length>0&&t.find(".e-max").remove(),l&&t.append("/"),t.append(o)),n.getHeaderContent().find(".e-headercell").eq(u).hasClass("e-shrinkcol")&&$(f).eq(r).find(".e-limits").addClass("e-hide")}},n}();window.ej.createObject("ej.KanbanFeatures.Swimlane",InternalSwimlane,window);InternalCommon=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._updateGroup=function(n,t){var i=this.kanbanObj;ej.isNullOrUndefined(i._saveArgs)&&new ej.DataManager(i._currentJsonData).update(i.model.fields.primaryKey,t,"");$.type(t)&&!t.count&&this._renderSingleCard(n,t)},n.prototype._removeIdSymbols=function(n){return typeof n=="string"&&(n=n.replace(/[-\s']/g,"_")),n},n.prototype._enableKanbanRTL=function(){this.kanbanObj.model.enableRTL?this.kanbanObj.element.addClass("e-rtl"):this.kanbanObj.element.removeClass("e-rtl")},n.prototype._getEmptyTbody=function(){var n=ej.buildTag("td.e-emptycard",this.kanbanObj.localizedLabels.EmptyCard,{},{colSpan:this.kanbanObj.model.columns.length});return $(document.createElement("tr")).append(n)},n.prototype._renderSingleCard=function(n,t){var i=this.kanbanObj,u=i.element.find("div[id='"+n+"']"),a=i,f,r,e,o,c,s,h,l;i._dropped?(h=$.render[i._id+"_cardTemplate"](t),ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?$(u).after(h):($(u).replaceWith(h),l=$.inArray(n,i._collapsedCards),l!=-1&&i.toggleCard(n))):(e=a.model.fields.swimlaneKey,ej.isNullOrUndefined(e)?f=i.element.find(".e-columnrow:first"):(o=i.model.swimlaneSettings.unassignedGroup,o.enable&&o.keys.length>0&&(t=i._checkKbnUnassigned(t)),c=this._removeIdSymbols(t[e]),s=i.element.find("tr[id='"+c+"']"),s.length>0&&(f=s.next())),r=$(f).find("td.e-rowcell").eq(i._getColumnKeyIndex(t[i.model.keyField])),$(u).remove(),r.length>0&&($(r).children().hasClass("e-customaddbutton")?$($.render[i._id+"_cardTemplate"](t)).insertBefore($(r).find(".e-customaddbutton")):$(r).append($.render[i._id+"_cardTemplate"](t))));i.KanbanDragAndDrop&&i.KanbanDragAndDrop._addDragableClass();i.KanbanSelection&&i.KanbanSelection._selectionOnRerender()},n.prototype._getKanbanCardData=function(n,t){return new ej.DataManager(n).executeLocal((new ej.Query).where(this.kanbanObj.model.fields.primaryKey,ej.FilterOperators.equal,t))},n.prototype._kbnHeaderAndCellEvents=function(n){var t=this.kanbanObj,i={},l=n.find(".e-kanbancard"),r=n,s=n.find(".e-cardselection"),h,tt=this,f=n.index(),a=n.parents(".e-columnrow"),v,e,u,c;if(v=t.element.find(".e-rowcell.e-droppable"),u=n.attr("ej-mappingkey"),r.parents(".e-headercell").length>0&&(r=n.parents(".e-headercell")),r.hasClass("e-headercell")&&(h=f=r.index(),e=v.eq(h),u=e.attr("ej-mappingkey"),t.model.fields.swimlaneKey&&(e=$("td[ej-mappingkey~='"+u+"']")),l=e.find(".e-kanbancard"),s=e.find(".e-cardselection"),a=e.parents(".e-columnrow")),n.hasClass("e-rowcell")||!r.hasClass("e-stackedHeaderCell")){var it=a.prev(".e-swimlanerow").find(".e-slkey").text(),y=[],o=[];if(ej.isNullOrUndefined(u))o.push(new ej.Predicate(t.model.keyField,ej.FilterOperators.equal,u,!0));else for(u=typeof u=="object"?u:u.split(","),c=0;c<u.length;c++)o.push(new ej.Predicate(t.model.keyField,ej.FilterOperators.equal,u[c],!0));i.cardsInfo=function(){var i={},r;return i.cards=l,i.cardsData=t.model.fields.swimlaneKey&&n.hasClass("e-rowcell")?new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(ej.Predicate.or(o)).where(t.model.fields.swimlaneKey,ej.FilterOperators.equal,it)):new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(ej.Predicate.or(o))),i.cardsCount=l.length,t._selectedCardData.length>0&&(r=$.inArray(f,t.selectedRowCellIndexes[0].cellIndex),!ej.isNullOrUndefined(r)&&r>=0&&y.push(t.selectedRowCellIndexes[0].cardIndex[r])),i.selectedCardsIndexes=y,i.selectedCardsData=new ej.DataManager(tt._selectedCardData).executeLocal((new ej.Query).where(ej.Predicate.or(o))),i.selectedCards=s,i}}if(n.hasClass("e-rowcell")&&(i.rowIndex=t.getIndexByRow(a),i.cellIndex=f,t._trigger("cellClick",i)),r.hasClass("e-stackedHeaderCell")){i.text=n.text();var p=[],s,w=[],b=[],k=[],d,g=[],nt=[];d=t.element.find(".e-stackedHeaderRow");i.data=function(){var i,h=0,e,y=t.model.stackedHeaderRows[d.index(r.parents(".e-stackedHeaderRow"))].stackedHeaderColumns,o,u,c,l,a,n;for(i=y[r.index()].column,i=i.split(","),o=0;o<i.length;o++)u=new ej.DataManager(t.model.columns).executeLocal((new ej.Query).where("headerText",ej.FilterOperators.equal,i[o])),c=$("td[ej-mappingkey~='"+u[0].key+"']"),l=c.find(".e-kanbancard"),p.push(l),g.push(new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(t.model.keyField,ej.FilterOperators.equal,u[0].key))),f=v.index($("td[ej-mappingkey~='"+u[0].key+"']")[0]),t._selectedCardData.length>0&&(e=$.inArray(f,t.selectedRowCellIndexes[0].cellIndex),!ej.isNullOrUndefined(e)&&e>=0&&(a=c.find(".e-cardselection"),s.push(a),nt.push(new ej.DataManager(t._selectedCardData).executeLocal((new ej.Query).where(t.model.keyField,ej.FilterOperators.equal,u[0].key))),a.length>0&&(b.push(f),k.push(t.selectedRowCellIndexes[0].cardIndex[e])))),h=h+l.length,w.push(f);return n={},n.count=h,n.cards=p,n.cardsData=g,n.cellIndexes=w,n.selectedCellCardIndexes={cellIndex:b,cardIndex:k},n.selectedCards=s,n.selectedCardsData=nt,n};t._trigger("headerClick",i)}else r.hasClass("e-headercell")&&(i["text "]=r.text(),i.cellIndex=h,i.target=r,i.columnData=t.model.columns[h],t._trigger("headerClick",i),t.model.allowScrolling&&t.model.allowToggleColumn&&(t.KanbanCommon._setWidthToColumns(),t.kanbanContent.data("ejScroller").destroy(),t.KanbanScroll._renderScroller()))},n.prototype._toggleCardByTarget=function(n){var t=this.kanbanObj,s,e,o;if(n=n.hasClass("e-expandcollapse")?n.find("div:first"):n,n.hasClass("e-cardexpand")||n.hasClass("e-cardcollapse")){var i=n.closest("div.e-cardheader"),r=i.next(),h=i.find(".e-primarykey").text(),u=$(n).closest(".e-kanbancard"),f=u.attr("id");n.hasClass("e-cardexpand")?(n.removeClass("e-cardexpand").addClass("e-cardcollapse"),u.addClass("e-collapsedcard"),i.append(r.find(".e-text").clone()),r.hide(),$.inArray(f,t._collapsedCards)==-1&&t._collapsedCards.push(f),s=r.find(".e-bottom-triangle").clone(),i.append(s)):(n.removeClass("e-cardcollapse").addClass("e-cardexpand"),u.removeClass("e-collapsedcard"),i.find(".e-text,.e-bottom-triangle").remove(),r.show(),e=$.inArray(f,t._collapsedCards),e!=-1&&t._collapsedCards.splice(e,1));t.model.allowScrolling&&((t.getScrollObject().isVScroll()||t.getScrollObject().isHScroll())&&t.getScrollObject().refresh(),t.getScrollObject().isVScroll()?t.element.find(".e-kanbanheader").addClass("e-scrollcss").children().addClass("e-hscrollcss"):t.element.find(".e-kanbanheader").removeClass("e-scrollcss").children().removeClass("e-hscrollcss"));t.element.hasClass("e-responsive")&&(o=n.parents(".e-cell-scrollcontent"),o.length>0&&o.data("ejScroller").refresh())}},n.prototype._priorityColData=function(n,t){var u,f=this.kanbanObj.model.fields.primaryKey,i=this.kanbanObj.model.fields.priority,r;return u=$.map(n,function(n,i){if(n[f]==t[f])return i}),ej.isNullOrUndefined(u[0])||n.splice(u,1),r=t[i]-1,ej.isNullOrUndefined(n[r-1])||n[r-1][i]==t[i]&&--r,n.splice(r,0,t),n.sort(function(n,t){return n[i]-t[i]}),n},n.prototype._getPriorityData=function(n,t){var i,r=this.kanbanObj.model.fields.primaryKey;return i=$.map(n,function(n,i){if(n[r]==t[r])return i}),ej.isNullOrUndefined(i[0])?n.push(t):n[i][this.kanbanObj.model.fields.priority]=t[this.kanbanObj.model.fields.priority],n},n.prototype._preventCardMove=function(n,t){for(var s,i,r,u,e,h=this.kanbanObj,o=typeof t=="object"?t:t.split(","),f=0;f<o.length;f++){if(n==o[f])return!0;if(s=!0,i=h.model.workflows,!ej.isNullOrUndefined(i)&&i.length>0)for(r=0;r<i.length;r++)if(i[r].key==n&&!ej.isNullOrUndefined(i[r].allowedTransitions)){if(u=typeof i[r].allowedTransitions=="object"?i[r].allowedTransitions:i[r].allowedTransitions.split(","),u.length==1&&u[0].length==0)return!0;for(e=0;e<u.length;e++){if(o[f]==u[e])return!0;s=!1}}}return s?!0:!1},n.prototype._updateKbnPriority=function(n,t){var f=this.kanbanObj,o=f._currentJsonData,i,l,s=f.model.fields.primaryKey,u=f.model.fields.priority,h=f.model.fields.swimlaneKey,a,v,c,e,r;if((!ej.isNullOrUndefined(f._filterToolBar)&&f._filterToolBar.find(".e-select").length>0||f._searchBar!=null&&f._searchBar.find(".e-cancel").length>0)&&(o=f._initialData),l=this._getKanbanCardData(o,t[s])[0],t[u]=parseInt(t[u]),i=ej.isNullOrUndefined(h)?new ej.DataManager(o).executeLocal((new ej.Query).where(f.model.keyField,ej.FilterOperators.equal,t[f.model.keyField])):new ej.DataManager(o).executeLocal((new ej.Query).where(f.model.keyField,ej.FilterOperators.equal,t[f.model.keyField]).where(h,ej.FilterOperators.equal,t[h])),i=i.slice(),a=f,v=t[s],i.sort(function(n,t){return n[u]-t[u]}),f._bulkPriorityData.length>0){for(r=0;r<i.length;r++)c=$.map(f._bulkPriorityData,function(n,t){if(n[s]==i[r][s])return t}),ej.isNullOrUndefined(c[0])||(i[r][f.model.fields.priority]=f._bulkPriorityData[c][f.model.fields.priority]);i.sort(function(n,t){return n[u]-t[u]})}for(i=ej.isNullOrUndefined(h)?this._priorityColData(i,t):this._priorityColData(i,t),e=t[u]-1,e!=$.inArray(t,i)&&(e=$.inArray(t,i)),t[u]-1>i.length&&(e=i.length-1),e<0&&(e=0),r=e;r<i.length;r++)ej.isNullOrUndefined(i[r])||(r<i.length-1&&!ej.isNullOrUndefined(i[r+1])&&i[r][u]>=i[r+1][u]?(i[r+1][u]=i[r][u]+1,n=this._getPriorityData(n,i[r+1])):r!=i.length-1||ej.isNullOrUndefined(i[r-1])||i[r][u]<i[r-1][u]&&(i[r][u]=i[r-1][u]+1,n=this._getPriorityData(n,i[r])));for(r=e;r>=0;r--)ej.isNullOrUndefined(i[r])||(ej.isNullOrUndefined(i[r-1])?r!=0||ej.isNullOrUndefined(i[r+1])||i[r][u]>i[r+1][u]&&(i[r][u]=i[r+1][u]-1,n=this._getPriorityData(n,i[r])):r>0&&i[r-1][u]>=i[r][u]&&(i[r-1][u]=i[r][u]-1,n=this._getPriorityData(n,i[r-1])));return n},n.prototype._kbnBulkUpdate=function(n,t,i){var r=this.kanbanObj,u,f;r._dataManager instanceof ej.DataManager&&!r._dataManager.dataSource.offline||r._dataSource().adaptor instanceof ej.remoteSaveAdaptor?(f={added:n,deleted:t,changed:i},$("#"+r._id).data("ejWaitingPopup").show(),u=r._dataManager.saveChanges(f,r.model.fields.primaryKey,r.model.query._fromTable),$.isFunction(u.promise)&&(u.done(function(){r.KanbanCommon._processBindings(r._saveArgs);r._cModifiedData=null;r._cAddedRecord=null;r._isAddNewClick=!1;r._currentData=null;r._newCard=null;r._saveArgs=null;r._cardEditClick=null;r._dblArgs=null;r._cDeleteData=null;$("#"+r._id).data("ejWaitingPopup").hide()}),u.fail(function(n){var t;ej.isNullOrUndefined(r._saveArgs)?t=n:(r._saveArgs.error=n&&n.error?n.error:n,t=r._saveArgs);r._renderAllCard();r._enableDragandScroll();r._cModifiedData=null;r._cAddedRecord=null;r._isAddNewClick=!1;r._currentData=null;r._newCard=null;r._saveArgs=null;r._cardEditClick=null;r._dblArgs=null;r._cDeleteData=null;r._trigger("actionFailure",t);$("#"+r._id).data("ejWaitingPopup").hide()}))):r.KanbanCommon._processBindings(r._saveArgs);u!=undefined&&$.isFunction(u.promise)||(r._cModifiedData=null,r._cAddedRecord=null,r._isAddNewClick=!1,r._currentData=null,r._newCard=null,r._saveArgs=null,r._cardEditClick=null,r._dblArgs=null,r._cDeleteData=null)},n.prototype._checkSkipAction=function(n){switch(n.requestType){case"save":case"delete":return!0}return!1},n.prototype._processBindings=function(n){var t=this.kanbanObj,r,i;if(n.primaryKey=t.model.fields.primaryKey,!this._checkSkipAction(n)&&t._trigger("actionBegin",n))return!0;t._ensureDataSource(n);t._editForm=t.element.find(".kanbanform");n.requestType=="beginedit"||n.requestType=="drop"||t._editForm.length==0||(t._editForm.length>1&&n.requestType=="save"&&n.action=="edit"&&(t._editForm=$(t._editForm[0])),$(t._editForm).find("select.e-dropdownlist").ejDropDownList("destroy"),$(t._editForm).find("textarea.e-rte").ejRTE("destroy"),$(t._editForm).find(".e-datepicker").ejDatePicker("destroy"),$(t._editForm).find(".e-datetimepicker").ejDateTimePicker("destroy"),$(t._editForm).find(".e-numerictextbox").ejNumericTextbox("destroy"),$(t._editForm).addClass("e-formdestroy"));n&&n.requestType=="delete"&&n.div.remove();n.requestType=="drop"&&(t._templateRefresh=!0);t._dataSource()instanceof ej.DataManager&&n.requestType!="beginedit"&&n.requestType!="cancel"&&n.requestType!="add"?(t.element.ejWaitingPopup("show"),r=t._queryPromise=t._dataSource().executeQuery(t.model.query),i=t,i._dataSource().ready?i._dataSource().ready.done(function(){i.KanbanCommon._processDataRequest(i,n,r)}):i.KanbanCommon._processDataRequest(i,n,r)):t.sendDataRenderingRequest(n)},n.prototype._processDataRequest=function(n,t,i){i.done(ej.proxy(function(i){n.element.ejWaitingPopup("hide");n._currentJsonData=n.currentViewData=i.result==null?[]:i.result;n.KanbanCommon._processData(i,t)}));i.fail(ej.proxy(function(i){n.element.ejWaitingPopup("hide");t.error=i.error;i=[];n.currentViewData=[];n.KanbanCommon._processData(i,t);n._trigger("actionFailure",t)}))},n.prototype._processData=function(n,t){var i=this.kanbanObj;ej.isNullOrUndefined(i.model.filterSettings)||(t.requestType=="filtering"||i.model.filterSettings.length>0&&t.requestType=="refresh")&&(i._filteredRecordsCount=n.count);i.sendDataRenderingRequest(t)},n.prototype._moveCurrentCard=function(n,t,i){var h,u,e,f,s,c,b,l,y,p,k,r=this.kanbanObj,a,v,w,o;if(u=r.selectedRowCellIndexes[0],a=u.cardIndex,h=u.cellIndex[u.cellIndex.length-1],t=="down"||t=="up"){if(k=$(r._columnRows[n]).find("td.e-rowcell").eq(h),s=k.find(".e-kanbancard"),f=$(s).index(k.find(".e-cardselection")),l=s.length,t=="down")if(ej.isNullOrUndefined(r.model.fields.swimlaneKey)?f=r.model.selectionType=="multiple"?a[u.cellIndex.length-1][a[u.cellIndex.length-1].length-1]:a[u.cellIndex.length-1]:(i.shiftKey||i.ctrlKey)&&r.model.selectionType=="multiple"&&(f=a[u.cellIndex.length-1][a[u.cellIndex.length-1].length-1]),f==l-1||l==0){if(n==r._columnRows.length-1)return;if((i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single")return;this._moveCurrentCard(n+1,t,i)}else s.eq(f+1).hasClass("e-cardselection")?r.KanbanSelection._cardSelection([[n,[h],[f]]],$(s[f]),i):r.KanbanSelection._cardSelection([[n,[h],[f+1]]],$(s[f+1]),i);else if(t=="up")if(ej.isNullOrUndefined(r.model.fields.swimlaneKey)?f=r.model.selectionType=="multiple"?u.cardIndex[u.cellIndex.length-1][u.cardIndex[u.cellIndex.length-1].length-1]:u.cardIndex[u.cellIndex.length-1]:(i.shiftKey||i.ctrlKey)&&r.model.selectionType=="multiple"&&(f=u.cardIndex[u.cellIndex.length-1][u.cardIndex[u.cellIndex.length-1].length-1]),l==0||f==0){if(n==0)return;if((i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single")return;this._moveCurrentCard(n-1,t,i)}else s.eq(f-1).hasClass("e-cardselection")?r.KanbanSelection._cardSelection([[n,[h],[f]]],$(s[f]),i):f!=-1?r.KanbanSelection._cardSelection([[n,[h],[f-1]]],$(s[f-1]),i):r.KanbanSelection._cardSelection([[n,[h],[l-1]]],$(s[l-1]),i);(i.shiftKey||i.ctrlKey)&&!1||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse"))}else if(b=$(r._columnRows[u.rowIndex]),c=b.find("td.e-rowcell"),s=c.eq(n).find(".e-kanbancard"),e=c.eq(n).find(".e-kanbancard"),y=c.eq(n+1),p=c.eq(n-1),v=r.element.find(".e-kanbancard"),w=r.element.find(".e-cardselection"),p.is(":visible")&&y.is(":visible")||ej.isNullOrUndefined(r.model.fields.swimlaneKey)||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")),f=(i.shiftKey||i.ctrlKey)&&r.model.selectionType=="multiple"?u.cardIndex[u.cellIndex.length-1][u.cardIndex[u.cellIndex.length-1].length-1]:r.model.selectionType=="single"?u.cardIndex[0]:u.cardIndex[0][0],t=="right"){if(o=v.eq(v.index(w)+1),n==c.length-1){o.length>0&&(!i.shiftKey&&!i.ctrlKey||r.model.selectionType=="single")&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&(r.KanbanSelection._cardSelection([[r._columnRows.index(o.closest("tr.e-columnrow")),[o.closest("tr.e-columnrow").find("td.e-rowcell").index(o.closest("td.e-rowcell"))],[0]]],o,i),r.element.find(".e-cardselection").closest("tr:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")));return}y.find(".e-kanbancard:visible").length>0?(e=y.find(".e-kanbancard"),e.eq(f).length>0?r.KanbanSelection._cardSelection([[u.rowIndex,[n+1],[f]]],$(e[f]),i):r.KanbanSelection._cardSelection([[u.rowIndex,[n+1],[e.length-1]]],$(e[e.length-1]),i),(i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single"||ej.isNullOrUndefined(r.model.fields.swimlaneKey)||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse"))):this._moveCurrentCard(n+1,t,i)}else if(t=="left"){if(v.index(w)!=0&&(o=v.eq(v.index(w)-1)),n==0){if(!i.shiftKey&&!i.ctrlKey&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)){if(r.KanbanSwimlane.toggle($(b).prev().find(".e-slexpand")),ej.isNullOrUndefined(o))return;(o.length>0&&!i.shiftKey&&!i.ctrlKey||r.model.selectionType=="single")&&(r.KanbanSelection._cardSelection([[r._columnRows.index(o.closest("tr.e-columnrow")),[o.closest("tr.e-columnrow").find("td.e-rowcell").index(o.closest("td.e-rowcell"))],[0]]],o,i),r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")))}return}p.find(".e-kanbancard:visible").length>0?(e=p.find(".e-kanbancard"),e.eq(f).length>0?r.KanbanSelection._cardSelection([[u.rowIndex,[n-1],[f]]],$(e[f]),i):r.KanbanSelection._cardSelection([[u.rowIndex,[n-1],[e.length-1]]],$(e[e.length-1]),i),(i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single"||ej.isNullOrUndefined(r.model.fields.swimlaneKey)||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slexpand"))):this._moveCurrentCard(n-1,t,i)}},n.prototype._kanbanKeyPressed=function(n,t,i){var u,s,f,h,a=$(t),c=!0,r=this.kanbanObj,l,e,o;u=r.element.find(".e-cardselection");s=r.element.find(".e-kanbancard:visible");i.code==13&&t.tagName=="INPUT"&&a.closest("#"+r._id+"_toolbarItems_search").length&&(n="searchRequest");f=r.selectedRowCellIndexes[0];l=!ej.isNullOrUndefined(r.model.fields.swimlaneKey);switch(n){case"editCard":u.length>0&&r.model.editSettings.allowEditing&&(h=f.cellIndex,u=r._columnRows.eq(f.rowIndex).find("td.e-rowcell").eq(h[h.length-1]).find(".e-kanbancard").eq(f.cardIndex[h.length-1]),r.KanbanEdit.startEdit(u));break;case"insertCard":r.model.editSettings.allowAdding&&r.KanbanEdit.addCard();break;case"swimlaneExpandAll":r.KanbanSwimlane&&r.KanbanSwimlane.expandAll();break;case"swimlaneCollapseAll":r.KanbanSwimlane&&r.KanbanSwimlane.collapseAll();break;case"downArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.rowIndex,"down",i);break;case"upArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.rowIndex,"up",i);break;case"leftArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"left",i);r.model.isResponsive&&r.element.hasClass("e-responsive")&&r._kbnTransitionEnd&&r.KanbanAdaptive._kbnRightSwipe();break;case"rightArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"right",i);r.model.isResponsive&&r.element.hasClass("e-responsive")&&r._kbnTransitionEnd&&r.KanbanAdaptive._kbnLeftSwipe();break;case"multiSelectionByDownArrow":i.ctrlKey=!0;u.length>0&&this._moveCurrentCard(f.rowIndex,"down",i);break;case"multiSelectionByUpArrow":i.ctrlKey=!0;u.length>0&&this._moveCurrentCard(f.rowIndex,"up",i);break;case"multiSelectionByRightArrow":i.shiftKey=!0;u.length>0&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"right",i);break;case"multiSelectionByLeftArrow":i.shiftKey=!0;u.length>0&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"left",i);break;case"firstCardSelection":r.model.allowSelection&&document.activeElement.id==r._id&&(r.KanbanSelection.clear(),s.eq(0).addClass("e-cardselection"),u=r.element.find(".e-cardselection"),e=$(r._columnRows).find(".e-cardselection").index(),o=$(r._columnRows).find(".e-cardselection").parent().children().eq(0).hasClass("e-limits")?e-1:e,r.model.selectionType=="multiple"?r.selectedRowCellIndexes.push({cardIndex:[[o]],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}):r.selectedRowCellIndexes.push({cardIndex:[o],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}));break;case"lastCardSelection":r.model.allowSelection&&document.activeElement.id==r._id&&(r.KanbanSelection.clear(),s.eq(s.length-1).addClass("e-cardselection"),u=r.element.find(".e-cardselection"),u=r.element.find(".e-cardselection"),e=$(r._columnRows).find(".e-cardselection").index(),o=$(r._columnRows).find(".e-cardselection").parent().children().eq(0).hasClass("e-limits")?e-1:e,r.model.selectionType=="multiple"?r.selectedRowCellIndexes.push({cardIndex:[[o]],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}):r.selectedRowCellIndexes.push({cardIndex:[o],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}));break;case"cancelRequest":$("#"+r._id+"_dialogEdit:visible").length>0?r.KanbanEdit.cancelEdit():u.length>0&&r.KanbanSelection.clear();break;case"searchRequest":r.KanbanFilter.searchCards(a.val());c=!1;break;case"saveRequest":$("#"+r._id+"_dialogEdit:visible").length>0&&r.KanbanEdit.endEdit();break;case"deleteCard":u.length>0&&$("#"+r._id+"_dialogEdit:visible").length<=0&&!ej.isNullOrUndefined(r.model.fields.primaryKey)&&r.KanbanEdit.deleteCard(u.attr("id"));break;case"selectedSwimlaneExpand":u.length>0&&l&&(u.is(":visible")||r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slexpandcollapse")));break;case"selectedSwimlaneCollapse":u.length>0&&l&&u.is(":visible")&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().find(".e-slexpandcollapse"));break;case"selectedColumnCollapse":u.length>0&&this._toggleField(r.model.columns[r.selectedRowCellIndexes[0].cellIndex[0]].headerText);break;case"selectedColumnExpand":r._collapsedColumns.length!=0&&this._toggleField(r._collapsedColumns[r._collapsedColumns.length-1]);break;case"focus":r.element.find(".e-cardselection").focus();break;default:c=!0}return c},n.prototype._createStackedRow=function(n){for(var c,l,o,f,r,a,i,s,e,u,p,w,v=ej.buildTag("tr.e-columnheader e-stackedHeaderRow","",{},{}),t=[],y=this.kanbanObj,h=0;h<y.model.columns.length;h++)if(c=y.model.columns[h],c.visible!=!1){for(l="",o=n.stackedHeaderColumns,f=0;f<o.length;f++)o[f].column.indexOf(c.headerText)!=-1&&(l=o[f].headerText);t.push(l)}for(r=[],a="",i=0;i<t.length;i++){for(s=1,e=i+1;e<t.length;e++)if(t[i]!=""&&t[e]!=""&&t[i]==t[e])s++;else break;r.push({sapnCount:s,headerText:t[i],css:t[i]!=""?a:"e-sheader"});i+=s-1;a=""}for(u=0;u<r.length;u++)p=ej.buildTag("div",r[u].headerText,{},{}),w=ej.buildTag("th.e-headercell e-stackedHeaderCell "+r[u].css+"","",{},{colspan:r[u].sapnCount}).append(p),v.append(w);return v},n.prototype._refreshStackedHeader=function(){for(var u,n=this.kanbanObj,i=n.model.stackedHeaderRows,r=n.element.find(".e-stackedHeaderRow"),t=0;t<i.length;t++)u=this._createStackedRow(i[t]),r.length>0&&r.remove(),$(n.getHeaderTable().find(".e-columnheader").before(u));n.model.allowScrolling&&n.KanbanScroll._refreshScroller({requestType:"refresh"})},n.prototype._stackedHeadervisible=function(){for(var t=this.kanbanObj.element.find(".e-columnheader .e-stackedHeaderCell "),n=0;n<t.length;n++)t[n].offsetWidth<t[n].scrollWidth&&t.eq(n).find("div").addClass("e-hide")},n.prototype._kanbanUpdateCard=function(n,t){var s,i=this.kanbanObj,f=i._saveArgs,it=i.model.fields.swimlaneKey,b=i.model.swimlaneSettings.unassignedGroup,a,u,l,p,c,h,v,o,nt,e,y,w,r,tt;if(!ej.isNullOrUndefined(it)&&b.enable&&b.keys.length>0)if(ej.isNullOrUndefined(t.length))t=i._checkKbnUnassigned(t);else for(r=0;r<t.length;r++)t[r]=i._checkKbnUnassigned(t[r]);if(!ej.isNullOrUndefined(t.length)||$.inArray(t[i.model.keyField],i._keyValue)!=-1){if(ej.isNullOrUndefined(f)&&(i._saveArgs=f={data:t,requestType:"save",action:"edit",primaryKeyValue:n},i._cModifiedData=t),(ej.isNullOrUndefined(f)||!ej.isNullOrUndefined(f)&&f.requestType!="drop")&&(s=i._dataSource()instanceof ej.DataManager?i._dataSource().dataSource.json:i._dataSource(),s.length==0&&i._currentJsonData.length>0&&(s=i._currentJsonData),i.model.fields.priority))if(a=[],$.isPlainObject(t))a.push(t),ej.isNullOrUndefined(t[i.model.fields.priority])&&(e=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.fields.primaryKey,ej.FilterOperators.equal,t[i.model.fields.primaryKey])),e.length>0?t[i.model.fields.priority]=e[0][i.model.fields.priority]:(c=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.keyField,ej.FilterOperators.equal,t[i.model.keyField])),t[i.model.fields.priority]=c[c.length-1][i.model.fields.priority]+1)),t=i.KanbanCommon._updateKbnPriority(a,t);else{for(p=i.model.fields.primaryKey,r=0;r<t.length;r++)for(a=$.extend(!0,[],t),ej.isNullOrUndefined(t[r][i.model.fields.priority])&&(e=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.fields.primaryKey,ej.FilterOperators.equal,t[r][i.model.fields.primaryKey])),e.length>0?t[r][i.model.fields.priority]=e[0][i.model.fields.priority]:(c=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.keyField,ej.FilterOperators.equal,t[r][i.model.keyField])),t[r][i.model.fields.priority]=c[c.length-1][i.model.fields.priority]+1)),u=t[r],l=i.KanbanCommon._updateKbnPriority(a,u),h=0;h<l.length;h++)i._bulkPriorityData.length>0?(v=$.map(i._bulkPriorityData,function(n,t){if(n[p]==l[h][p])return t}),ej.isNullOrUndefined(v[0])?i._bulkPriorityData.push(l[h]):(i._bulkPriorityData.splice(v,1),i._bulkPriorityData.splice(v,0,l[h]))):i._bulkPriorityData.push(l[h]);t=i._bulkPriorityData;i._bulkPriorityData=[]}var u=[],k=[],d=[],g=[];if(ej.isNullOrUndefined(t)&&n&&(t=new ej.DataManager(i._currentJsonData).executeLocal((new ej.Query).where(i.model.fields.primaryKey,ej.FilterOperators.equal,n))[0]),t=ej.isNullOrUndefined(t)?null:t,$.isPlainObject(t)?u.push(t):u=t,i._isLocalData){for(o=i.model.query,nt=o.clone(),r=0;r<u.length;r++)o=o.where(i.model.fields.primaryKey,ej.FilterOperators.equal,u[r][i.model.fields.primaryKey]),e=i._dataManager.executeLocal(o),y=i._dataSource()instanceof ej.DataManager?$.inArray(e.result[0],i._dataSource().dataSource.json):$.inArray(e.result[0],i._dataSource()),y>=0?i._dataSource()instanceof ej.DataManager?$.extend(i._dataSource().dataSource.json[y],u[r]):$.extend(i._dataSource()[y],u[r]):(w=u[r],i._cAddedRecord=null,i._dataSource()instanceof ej.DataManager?i._dataSource().dataSource.json.push(w):i._dataSource(undefined,!0).splice(i._dataSource().length,0,w)),o.queries=o.queries.slice(o.queries.length);o.queries=nt.queries}if(f.requestType!="drop"&&(f.data=u),i._saveArgs=f,i._dataManager instanceof ej.DataManager&&!i._dataManager.dataSource.offline||i._dataSource().adaptor instanceof ej.remoteSaveAdaptor){if(f.requestType=="delete")d.push(f.data[0]);else for(r=0;r<u.length;r++)tt=this._getKanbanCardData(i._currentJsonData,u[r][i.model.fields.primaryKey]),tt.length>0?g.push(u[r]):k.push(u[r]);i.KanbanCommon._kbnBulkUpdate(k,d,g)}else i.KanbanCommon._processBindings(i._saveArgs),i._cModifiedData=null,i._cAddedRecord=null,i._isAddNewClick=!1,i._currentData=null,i._newCard=null,i._saveArgs=null,i._cardEditClick=null,i._dblArgs=null}},n.prototype._getMetaColGroup=function(){for(var i,r=ej.buildTag("colgroup","",{},{}),n=this.kanbanObj,t=0;t<n.model.columns.length;t++)i=$(document.createElement("col")),n.model.allowToggleColumn&&n.model.columns[t].isCollapsed===!0&&i.addClass("e-shrinkcol"),n.model.columns[t].visible===!1&&i.addClass("e-hide"),r.append(i);return r},n.prototype._kanbanToolbarClick=function(n,t){var i=n.currentTarget,u=n.target,e,f,o,r;if($(i).hasClass("e-quickfilter")||(t.KanbanFilter&&u.tagName=="INPUT"&&$(u).parent().next().hasClass("e-cancel")&&$(u).val().length==0&&t.KanbanFilter.searchCards(""),t.model.isResponsive&&t.element.hasClass("e-responsive")&&($(t.itemsContainer).parent().children().not(".e-searchbar").hide(),n.keyCode==8&&t.KanbanAdaptive._kbnTimeoutSearch(t.element,n)),n.event==undefined))return!1;for(e=$(i).text(),f=0;f<t.model.filterSettings.length;f++)if(t.model.filterSettings[f].text==e)break;return(o=f==t.model.filterSettings.length?null:t.model.filterSettings[f],r={itemName:$(i).attr("data-content"),itemId:i.id,target:u,currentTarget:i,itemIndex:$(i).index(),toolbarData:n,itemText:e,model:t.model,cancel:!1,type:"toolbarClick"},t._trigger("toolbarClick",r))?!1:(r.itemId==t._id+"_toolbarItems_search"?(r.target.nodeName=="A"&&t.model.allowSearching&&t._searchBar!=null&&$(r.currentTarget).find("input").val().length!=0&&($(u).is(t._searchBar.find(".e-searchfind"))?t.KanbanFilter.searchCards($(r.currentTarget).find("input").val()):$(u).is(t._searchBar.find(".e-cancel"))&&t.KanbanFilter.searchCards("")),t._isWatermark||(t._searchInput.blur(function(){t._searchInput.val()||t._hiddenSpan.css("display","block")}),t._hiddenSpan.css("display","none"))):$(r.currentTarget).hasClass("e-printlist")?t.print():t.KanbanFilter&&!$(i).parent().hasClass("e-customtoolbar")&&t.KanbanFilter._filterHandler(o,i),!1)},n.prototype._kanbanSetModel=function(n,t){var i,e,h,u,s,o,r,f,c;for(i in n)switch(i){case"columns":h=n.columns;t.model.columns=[];t._keyValue=[];t.columns(h,"add");break;case"cssClass":t.element.removeClass(t.model.cssClass).addClass(n[i]);break;case"allowFiltering":case"filterSettings":i=="allowFiltering"?(t.model.allowFiltering=n[i],t.model.allowFiltering&&(t.KanbanFilter=new ej.KanbanFeatures.Filter(t)),t.model.allowSearching||t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||(t.KanbanFilter=null)):(i=="filterSettings"&&(t.model.filterSettings=n[i]),t.model.filterSettings.length>0?(t.element.find(".e-kanbantoolbar").remove(),t._filterCollection=[],t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.filterSettings.length>0&&(t.KanbanFilter=new ej.KanbanFeatures.Filter(t))):(t.element.find(".e-kanbantoolbar").remove(),t.model.filterSettings=[],t._filterCollection=[],t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.allowSearching||t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||t.element.find(".e-kanbantoolbar").remove(),$(t.element.find(".e-kanbanheader")).replaceWith(t._renderHeader()),t.refresh()));break;case"allowSearching":if(t.model.allowSearching=n[i],u=[],t.model.filterSettings.length!=0||t.model.allowFiltering)for(s=t.element.find(".e-kanbantoolbar .e-tooltxt.e-select"),o=0;o<s.length;o++)u.push(s.eq(o).index());if(t.model.allowSearching){for(t.element.find(".e-kanbantoolbar").remove(),t.model.searchSettings.key="",t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),r=0;r<u.length;r++)t.element.find(".e-kanbantoolbar .e-tooltxt").eq(u[r]).addClass("e-select");t.model.allowSearching&&(t.KanbanFilter=new ej.KanbanFeatures.Filter(t))}else if(t.KanbanFilter.clearSearch(),t.element.find(".e-kanbantoolbar").remove(),t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||t.element.find(".e-kanbantoolbar").remove(),t.model.filterSettings.length!=0||t.model.allowFiltering)for(r=0;r<u.length;r++)t.element.find(".e-kanbantoolbar .e-tooltxt").eq(u[r]).addClass("e-select");t._on($("#"+t._id+"_searchbar"),"keyup","",t._onToolbarClick);break;case"enableTotalCount":t.model.enableTotalCount=n[i];$(t.element.find(".e-kanbanheader")).replaceWith(t._renderHeader());t.model.enableTotalCount&&this._totalCount();t.refresh();break;case"fields":i=="fields"&&($(t.element.find(".e-kanbanheader")).replaceWith(t._renderHeader()),t.model.allowSearching&&t.KanbanFilter.searchCards(""),!ej.isNullOrUndefined(t.model.fields.swimlaneKey)&&t.model.contextMenuSettings.enable&&t.KanbanContext._renderContext(),t.model.filterSettings.length>0&&t.KanbanFilter.clearFilter(),t.model.filterSettings.length!=0&&$("#Kanban").find(".e-kanbantoolbar .e-tooltxt").removeClass("e-select"),t.getHeaderContent().replaceWith(t._renderHeader()),this._refreshDataSource(t._dataSource()),this._renderLimit(),t.model.enableTotalCount&&this._totalCount(),t.element.find(".e-kanbantoolbar").remove(),t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.allowSearching||t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||t.element.find(".e-kanbantoolbar").remove(),t.model.fields&&!ej.isNullOrUndefined(t.model.fields.swimlaneKey)&&(t.KanbanSwimlane=new ej.KanbanFeatures.Swimlane(t)),t._on($("#"+t._id+"_searchbar"),"keyup","",t._onToolbarClick));break;case"enableTouch":t.model.enableTouch=n[i];t.model.enableTouch?(t._off(t.element,"dblclick",".e-kanbancard"),t.model.editSettings.allowEditing&&t._on(t.element,$.isFunction($.fn.doubletap)&&t.model.enableTouch?"doubletap":"dblclick",".e-kanbancard",t._cardDblClickHandler),t._on(t.element,$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._clickHandler),t._on($(".e-swimlane-window,.e-kanbanfilter-window,.e-kanbantoolbar"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptClickHandler),t._on($(".e-kanban-editdiv"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptEditClickHandler),t.KanbanAdaptive&&(t._on(t.element,"taphold","",t.KanbanAdaptive._kbnHoldHandler),t._on(t.element,"touchend","",t.KanbanAdaptive._kbnTouchEndHandler),t._on(t.element,"swipeleft swiperight",".e-kanbancontent",$.proxy(t._swipeKanban,t)))):(t._off(t.element,"doubletap",".e-kanbancard"),t.model.editSettings.allowEditing&&t._on(t.element,$.isFunction($.fn.doubletap)&&t.model.enableTouch?"doubletap":"dblclick",".e-kanbancard",t._cardDblClickHandler),t.KanbanAdaptive&&(t._off(t.element,"taphold","",t.KanbanAdaptive._kbnHoldHandler),t._off(t.element,"touchend","",t.KanbanAdaptive._kbnTouchEndHandler),t._off(t.element,"swipeleft swiperight",".e-kanbancontent",$.proxy(t._swipeKanban,t))),t._on(t.element,$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._clickHandler),t._on($(".e-swimlane-window,.e-kanbanfilter-window,.e-kanbantoolbar"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptClickHandler),t._on($(".e-kanban-editdiv"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptEditClickHandler));break;case"allowHover":t.model.allowHover=n[i];t._enableCardHover();break;case"enableRTL":t.model.enableRTL=n[i];this._enableKanbanRTL();t.refresh(!0);t.KanbanScroll._refreshScroller({requestType:"refresh"});this._renderLimit();break;case"tooltipSettings":$.extend(t.model.tooltipSettings,n[i]);!ej.isNullOrUndefined(t.model.tooltipSettings)&&t.model.tooltipSettings.enable?(t.element.find(".e-kanbantooltip").remove(),t.element.append($("<div class='e-kanbantooltip'><\/div>")),t.element.find(".e-kanbantooltip").hide(),t._on(t.element,"mouseover",".e-kanbancard",$.proxy(t._showToolTip,t)),t._on(t.element,"mouseout",".e-kanbancard",$.proxy(t._hideToolTip,t))):(t._off(t.element,"mouseover",".e-kanbancard"),t._off(t.element,"mouseout",".e-kanbancard"));break;case"allowScrolling":case"scrollSettings":if(e=t.getContent(),t.model.allowScrolling=n[i],i!="allowScrolling"){if(!ej.isNullOrUndefined(n.scrollSettings)){if($.isEmptyObject(n.scrollSettings))break;$.extend(t.model.scrollSettings,n.scrollSettings)}ej.isNullOrUndefined(n.allowScrolling)||(t.model.allowScrolling=n.allowScrolling);ej.isNullOrUndefined(e.data("ejScroller"))||e.ejScroller("destroy");t.model.allowScrolling?(t.KanbanScroll=new ej.KanbanFeatures.Scroller(t),t.getHeaderContent().find("div").first().addClass("e-headercontent"),t._originalScrollWidth=t.model.scrollSettings.width,t.KanbanScroll._renderScroller()):(t.element.children(".e-kanbanheader").removeClass("e-scrollcss"),t.element.css("width","auto"),t.element.removeClass("e-kanbanscroll"),t.element.find(".e-headercontent").removeClass("e-hscrollcss"));ej.isNullOrUndefined(t.model.fields.swimlaneKey)||(t._swimlaneRows=t.element.find(".e-swimlanerow"));!$.isEmptyObject(t._freezeSwimlaneRow)&&t.KanbanSwimlane&&t.KanbanSwimlane._removeFreezeRow()}break;case"dataSource":e=t.element.find(".e-kanbancontent").first();this._refreshDataSource(t._dataSource());this._addLastRow();break;case"swimlaneSettings":ej.isNullOrUndefined(t.model.fields.swimlaneKey)||($.extend(t.model.swimlaneSettings,n[i]),ej.isNullOrUndefined(n[i].showCount)||t.refresh(!0));break;case"editSettings":$.extend(t.model.editSettings,n[i]);t.KanbanEdit._processEditing();t._tdsOffsetWidth=[];(t.model.editSettings.allowEditing||t.model.editSettings.allowAdding)&&(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate"?($("#"+t._id+"_dialogEdit").data("ejDialog")&&$("#"+t._id+"_dialogEdit").ejDialog("destroy"),$("#"+t._id+"_dialogEdit_wrapper,#"+t._id+"_dialogEdit").remove(),ej.isNullOrUndefined($("#"+t._id+"_externalEdit"))||$("#"+t._id+"_externalEdit").remove(),t.element.append(t.KanbanEdit._renderDialog())):(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&(ej.isNullOrUndefined(t.element.find(".e-kanbandialog"))||t.element.find(".e-kanbandialog").remove(),$("#"+t._id+"_externalEdit").remove(),t.element.append(t.KanbanEdit._renderExternalForm())),t._isEdit=!1);t._enableEditingEvents();break;case"allowSelection":n[i]&&(t._off(t.element,"click"),t._on(t.element,"click","",t._clickHandler));break;case"query":t.model.query=$.extend(!0,{},n[i]);break;case"stackedHeaderRows":i=="stackedHeaderRows"&&(t.model.stackedHeaderRows=n[i]);t.model.stackedHeaderRows.length>0?this._refreshStackedHeader():(t.element.find(".e-stackedHeaderRow").remove(),t.model.stackedHeaderRows=[]);break;case"cardSettings":ej.isNullOrUndefined(n.cardSettings)||$.extend(t.model.cardSettings,n.cardSettings);t.element.find(".e-kanbancard").remove();t.refreshTemplate();t._renderAllCard();t._enableDragandScroll();break;case"allowToggleColumn":t.model.allowToggleColumn=n[i];t.refreshTemplate();t.getHeaderContent().replaceWith(t._renderHeader());t.sendDataRenderingRequest({requestType:"refresh"});t.model.allowToggleColumn||t.element.find(".e-shrinkheader").not(".e-hide").addClass("e-hide");t.model.enableTotalCount&&this._totalCount();this._renderLimit();break;case"locale":t.model.locale=n[i];f=t.model;c=t.element;f.query.queries=f.query.queries.slice(0,f.query.queries.length-1);t.element.ejKanban("destroy").ejKanban(f);t.element=c;t.model=f;t._collapsedCards.length!=0&&t.toggleCard(t._collapsedCards)}},n.prototype._setWidthToColumns=function(){for(var n=this.kanbanObj,r=n.getContentTable().children("colgroup").find("col"),i=n.getHeaderTable().children("colgroup").find("col"),u=n._originalWidth-n._collapsedColumns.length*50,t=0;t<i.length;t++)if(ej.isNullOrUndefined(n._columnsWidthCollection[t])||n.model.allowToggleColumn){if(n.model.allowScrolling)if(u=n.element.width()-n._collapsedColumns.length*50,n.headerTable.find(".e-shrinkcol").length==0&&!ej.isNullOrUndefined(n._initialKanbanModel.columns[t].width)&&($.isNumeric(n._initialKanbanModel.scrollSettings.width)||$.isNumeric(n._initialKanbanModel.columns[t].width)||(n._initialKanbanModel.scrollSettings.width.indexOf("%")>0||n._initialKanbanModel.scrollSettings.width=="auto")&&n._initialKanbanModel.columns[t].width.indexOf("%")>0))r.eq(t).width(n._initialKanbanModel.columns[t].width),i.eq(t).width(n._initialKanbanModel.columns[t].width);else{var o=parseInt((u/n._expandedColumns.length).toFixed(2)),e=parseInt(n.kanbanContent.find("table:first").css("border-spacing").split("px")[0])*n.model.columns.length+18,f=o-e;n.model.columns[t].isCollapsed?n._columnsWidthCollection[t]=parseInt((u/n.model.columns.length).toFixed(2))-e:(r.eq(t).css("width",f+"px"),i.eq(t).css("width",f+"px"),n.model.columns[t].width=f)}}else r.eq(t).width(n._columnsWidthCollection[t]),i.eq(t).width(n._columnsWidthCollection[t])},n.prototype._getCardbyIndexes=function(n){return $(this.kanbanObj.getRowByIndex(n[0][0]).find(".e-rowcell:eq("+n[0][1][0]+")").find("div.e-kanbancard:eq("+n[0][2][0]+")"))},n.prototype._addLastRow=function(){var n=this.kanbanObj,r=n.getContentTable().find("tr:last").find("td"),i=0,t;if(n.model.allowScrolling&&!ej.isNullOrUndefined(n.model.dataSource)&&!ej.isNullOrUndefined(n._kanbanRows)){for(t=0;t<n._kanbanRows.length;t++)i+=$(n._kanbanRows[t]).height();i<n.getContent().height()-1&&r.addClass("e-lastrowcell")}},n.prototype._refreshDataSource=function(n){var t=this.kanbanObj;t._dataManager=n instanceof ej.DataManager?n:new ej.DataManager(n);t._isLocalData=!(t._dataSource()instanceof ej.DataManager)||t._dataManager.dataSource.offline||t._isRemoteSaveAdaptor;t.refresh(!0)},n.prototype._cardClick=function(n,t){var i,r=null,u;ej.isNullOrUndefined(t.attr("id"))||(u=new ej.DataManager(this.kanbanObj._currentJsonData),r=u.executeLocal((new ej.Query).where(this.kanbanObj.model.fields.primaryKey,ej.FilterOperators.equal,t.attr("id"))));i={target:n,currentCard:t,data:r};this.kanbanObj._trigger("cardClick",i)},n.prototype._validateLimit=function(n,t,i){var e=this.kanbanObj,o=this._multikeySeparation(n.key),r=$($(e.element.find(".e-columnrow")).find('td[ej-mappingkey="'+o+'"]')),u,s=!ej.isNullOrUndefined(n.constraints.min),h=!ej.isNullOrUndefined(n.constraints.max),f=!ej.isNullOrUndefined(e.model.fields.swimlaneKey)&&i==0;n.constraints.type=="column"?u=r.find(".e-kanbancard").length:(u=$(r[i]).find(".e-kanbancard").length,r=$(r[i]));s&&(n.constraints.min>u?(r.addClass("e-deceed"),f&&$(t).addClass("e-deceed")):(r.removeClass("e-deceed"),f&&$(t).removeClass("e-deceed")));h&&(n.constraints.max<u?(r.addClass("e-exceed"),f&&$(t).addClass("e-exceed")):(r.removeClass("e-exceed"),f&&$(t).removeClass("e-exceed")));r.find(".e-limits").addClass("e-hide");n.isCollapsed||$(t).find(".e-limits").removeClass("e-hide")},n.prototype._totalCount=function(){for(var i,n=this.kanbanObj,t=0;t<n.model.columns.length;t++)if(i=n.model.columns[t],n.model.enableTotalCount){var r=n.getHeaderContent().find("span.e-totalcount")[t],u=this._multikeySeparation(i.key),f=$($(n.element.find(".e-columnrow")).find('td[ej-mappingkey="'+u+'"]')),e=f.find(".e-kanbancard").length;$(r).text(e)}},n.prototype._multikeySeparation=function(n){var i=typeof n=="object"?n:n.split(","),n="",r=i.length,t;if(r==1)n=i[0];else for(t=0;t<r;t++)n=n+i[t],t!=r-1&&(n+=",");return n},n.prototype._renderLimit=function(){for(var n,f,e,t=this.kanbanObj,u={},r=0;r<t.model.columns.length;r++)if(n=t.model.columns[r],!ej.isNullOrUndefined(n.constraints)){f=!ej.isNullOrUndefined(n.constraints.min);e=!ej.isNullOrUndefined(n.constraints.max);(f||e)&&(u=t.getHeaderContent().find(".e-columnheader").not(".e-stackedHeaderRow").find(".e-headercell")[r]);var s=typeof n.key=="object"?n.key:n.key.split(","),h=t.KanbanCommon._multikeySeparation(s),o=$($(t.element.find(".e-columnrow")).find('td[ej-mappingkey="'+h+'"]')),i=0;ej.isNullOrUndefined(n.constraints.type)&&(n.constraints.type="column");switch(n.constraints.type){case"column":this._validateLimit(n,u,i);break;case"swimlane":for(i=0;i<o.length;i++)this._validateLimit(n,u,i),t.getHeaderContent().find(".e-headercell").eq(r).hasClass("e-shrinkcol")||o.eq(i).find(".e-limits").removeClass("e-hide");ej.isNullOrUndefined(t.model.fields.swimlaneKey)||$(u).find(".e-limits").addClass("e-hide")}}},n.prototype._showhide=function(n,t){var i=this.kanbanObj,r,w=0,c,e=i.model.columns,o,u,h,p,s;c=t==="show"?"_visibleColumns":"_hiddenColumns";var b=i.getHeaderTable().find("thead"),l=b.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),a=i.getHeaderTable().find("colgroup").find("col"),v,y=i.getContentTable().find("colgroup").find("col"),f=i._columnRows;for(r=0;r<e.length;r++)$.inArray(e[r].headerText,i[c])!=-1&&(e[r].visible=t==="show"?!0:!1,w++),v=i.getColumnByHeaderText(n[r]),o=$.inArray(v,i.model.columns),o!=-1&&(t=="show"?(l.eq(o).removeClass("e-hide"),a.eq(o).css("display","")):(l.eq(o).addClass("e-hide"),a.eq(o).css("display","none")));for(r=0;r<e.length;r++)for(u=0;u<f.length;u++)ej.isNullOrUndefined(i.model.fields.swimlaneKey)||($(f[u]).is(":visible")?f.eq(u).prev().find(".e-rowcell").attr("colspan",i.getVisibleColumnNames().length):(f.eq(u).prev().prev(".e-swimlanerow").find(".e-rowcell").attr("colspan",i.getVisibleColumnNames().length),e[r].visible?f.eq(u).prev(".e-collapsedrow").find("td.e-rowcell").eq(r).removeClass("e-hide"):f.eq(u).prev(".e-collapsedrow").find("td.e-rowcell").eq(r).addClass("e-hide"))),h=f.eq(u).find("td.e-rowcell[ej-mappingkey='"+i.model.columns[r].key+"']"),e[r].visible?(h.removeClass("e-hide"),y.eq(r).removeClass("e-hide")):(h.addClass("e-hide"),y.eq(r).addClass("e-hide"));for(p=i.element.find(".e-kanbanheader"),i._columnsWidthCollection=[],s=0;s<i.model.columns.length;s++)ej.isNullOrUndefined(i.model.columns[s].width)||i._columnsWidthCollection.push(i.model.columns[s].width);i.element[0].replaceChild(i._renderHeader()[0],p[0]);i.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup());this._setWidthToColumns();i.KanbanScroll&&i.KanbanScroll._refreshScroller({requestType:"refresh"})},n.prototype._showExpandColumns=function(n,t,i,r){var u=this.kanbanObj,f,o,e;if(!ej.isNullOrUndefined(n)){if(n!=null)if($.isArray(t))for(f=0;f<t.length;f++)o=u.getColumnByHeaderText(t[f]),t[f]=o!=null?o.headerText:t[f];else t=n.headerText;if($.isArray(t))for(f=0;f<t.length;f++)e=$.inArray(t[f],u[i]),e!=-1?(u[i].splice(e,1),u[r].push(t[f])):e!=-1||$.inArray(t[f],u[r])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t[f]))||(u[r].push(u.getColumnByHeaderText(t[f]).key)&&u[r].push(t[f]),u[i].splice($.inArray(u.getColumnByHeaderText(t[f]).key,u[i]),1)&&u[i].splice($.inArray(t[f],u[i]),1));else e=$.inArray(t,u[i]),e!=-1?(u[i].splice(e,1),u[r].push(t)):e!=-1||$.inArray(t,u[r])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t))||(u[r].push(u.getColumnByHeaderText(t).key)&&u[r].push(t),u[i].splice($.inArray(u.getColumnByHeaderText(t).key,u[i]),1)&&u[i].splice($.inArray(t,u[i]),1))}},n.prototype._expandColumns=function(n){var i,r="_expandedColumns",t=this.kanbanObj;i=typeof n=="string"?t.getColumnByHeaderText(n):t.getColumnByHeaderText(n[0]);this._showExpandColumns(i,n,"_collapsedColumns",r);this._expandCollapse(t[r],"expand");t.model.allowScrolling&&this._setWidthToColumns();t.model.stackedHeaderRows.length>0&&this._refreshStackedHeader()},n.prototype._toggleField=function(n){var u,i,t=this.kanbanObj;if(t.model.allowToggleColumn){if($.isArray(n))for(i=0;i<n.length;i++)u=$.inArray(n[i],t._collapsedColumns),u!=-1?this._expandColumns(n[i]):this._collapseColumns(n[i]);else $.inArray(n,t._collapsedColumns)!=-1?this._expandColumns(n):this._collapseColumns(n);if(t.model.allowScrolling){var o=t.getContentTable().children("colgroup").find("col"),f=t.getHeaderTable().children("colgroup").find("col"),e=t._originalWidth-t._collapsedColumns.length*50;for(i=0;i<f.length;i++){var s=parseInt((e/t._expandedColumns.length).toFixed(2)),h=parseInt((e/(t.model.scrollSettings.buttonSize||18)/100).toFixed(2)),r=s-h;t.model.columns[i].isCollapsed||(o.eq(i).css("width",r+"px"),f.eq(i).css("width",r+"px"),t.model.columns[i].width=r)}}t.KanbanScroll&&t.KanbanScroll._refreshScroller({requestType:"refresh"})}},n.prototype._hideCollapseColumns=function(n,t,i,r){var f,e,u=this.kanbanObj;if(!ej.isNullOrUndefined(n))if($.isArray(t))for(f=0;f<t.length;f++)e=$.inArray(t[f],u[r]),e!=-1?(u[i].push(t[f]),u[r].splice(e,1)):e!=-1||$.inArray(t[f],u[i])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t[f]))||(u[i].push(u.getColumnByHeaderText(t[f]).key)&&u[i].push(u.getColumnByHeaderText(t[f]).key),u[r].splice($.inArray(u.getColumnByHeaderText(t[f]).key,u[r]),1)&&u[r].splice($.inArray(t[f],u[r]),1));else e=$.inArray(t,u[r]),e!=-1?(u[i].push(t),u[r].splice(e,1)):e!=-1||r!=r||$.inArray(t,u[i])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t))||(u[i].push(u.getColumnByHeaderText(t).key)&&u[i].push(u.getColumnByHeaderText(t).key),u[r].splice($.inArray(u.getColumnByHeaderText(t).key,u[r]),1)&&u[r].splice($.inArray(t,u[r]),1))},n.prototype._expandCollapse=function(n,t){var i=this.kanbanObj,f,d=0,w,l=i.model.columns,u,a,v,e,h,y,c,p;w=t==="expand"?"_expandedColumns":"_collapsedColumns";var g=i.getHeaderTable().find("thead"),o=g.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),s=i.getHeaderTable().find("colgroup").find("col"),b,r,k=i.getContentTable().find("colgroup").find("col");for(f=0;f<l.length;f++)if($.inArray(l[f].headerText,i[w])!=-1&&(l[f].isCollapsed=t==="expand"?!1:!0,d++),b=i.getColumnByHeaderText(n[f]),u=$.inArray(b,i.model.columns),a=t=="expand"?!0:!1,u!=-1&&(a?s.eq(u).hasClass("e-shrinkcol")&&(o.eq(u).find(".e-headercelldiv,.e-totalcard,.e-limits").removeClass("e-hide"),o.eq(u).removeClass("e-shrinkcol"),s.eq(u).removeClass("e-shrinkcol"),k.eq(u).removeClass("e-shrinkcol"),o.eq(u).find(".e-clcollapse").addClass("e-clexpand").removeClass("e-clcollapse")):s.eq(u).hasClass("e-shrinkcol")||(o.eq(u).find(".e-headercelldiv,.e-totalcard,.e-limits").addClass("e-hide"),o.eq(u).addClass("e-shrinkcol"),s.eq(u).addClass("e-shrinkcol"),k.eq(u).addClass("e-shrinkcol"),o.eq(u).find(".e-clexpand").addClass("e-clcollapse").removeClass("e-clexpand"))),v=i.model.columns[f].isCollapsed,a){if(!v)for(e=0;e<i._columnRows.length;e++)if(r=i._columnRows.eq(e).find("td.e-rowcell").eq(f),r.hasClass("e-shrink"))r.removeClass("e-shrink").find(".e-shrinkheader").addClass("e-hide").parent().find(".e-kanbancard").removeClass("e-hide"),i.element.hasClass("e-responsive")&&r.find(".e-cell-scrollcontent").length>0&&r.find(".e-cell-scrollcontent").removeClass("e-hide"),i.model.enableRTL&&r.find(".e-shrinkheader").css({position:"",top:""}),r.find(".e-customaddbutton").removeClass("e-hide"),r.find(".e-limits").removeClass("e-hide"),r.find(".e-shrinkcount").text(i._columnCardcount(i.currentViewData,i.model.columns[f].key,i.model.fields.swimlaneKey?e:null,i));else break}else if(v)for(e=0;e<i._columnRows.length;e++)if(r=i._columnRows.eq(e).find("td.e-rowcell").eq(f),r.hasClass("e-shrink"))break;else r.addClass("e-shrink").find(".e-shrinkheader").removeClass("e-hide").parent().find(".e-kanbancard").addClass("e-hide"),i._checkMultikey(r)&&r.addClass("e-shrink").find(".e-shrinkheader").show(),i.element.hasClass("e-responsive")&&r.find(".e-cell-scrollcontent").length>0&&r.find(".e-cell-scrollcontent").addClass("e-hide"),h=r.offset().top,y=r.find(".e-shrinkcount").offset().top,i.model.enableRTL&&h>y&&(c=h-y,p=r.find(".e-shrinkheader"),c=p.offset().top-(h+i.element.offset().top)+c,p.css({position:"relative",top:c-6})),r.find(".e-customaddbutton").addClass("e-hide"),r.find(".e-limits").addClass("e-hide"),r.find(".e-shrinkcount").text(i._columnCardcount(i.currentViewData,i.model.columns[f].key,i.model.fields.swimlaneKey?e:null,i))},n.prototype._collapseColumns=function(n){for(var t=this.kanbanObj,r,u,f="_collapsedColumns",e=0,i=0;i<n.length;i++)r=$.inArray(n[i],t._expandedColumns),r!=-1&&e++;t._expandedColumns.length==e||t.getVisibleColumnNames().length-t._collapsedColumns.length==1||t.model.columns.length-t._collapsedColumns.length==1?t._collapsedColumns.length>0&&(this._expandColumns(t._collapsedColumns[0]),this._collapseColumns(n)):(u=typeof n=="string"?t.getColumnByHeaderText(n):t.getColumnByHeaderText(n[0]),this._hideCollapseColumns(u,n,f,"_expandedColumns"),this._expandCollapse(t[f],"collapse"),t.model.allowScrolling&&this._setWidthToColumns(),t.model.stackedHeaderRows.length>0&&this._refreshStackedHeader())},n}();window.ej.createObject("ej.KanbanFeatures.Common",InternalCommon,window);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};Kanban=function(n){function t(t,i){return n.call(this),this.element=null,this.PluginName="ejKanban",this.id="null",this.validTags=["div"],this.observables=["dataSource"],this._tags=[{tag:"columns",attr:["headerTemplate","headerText","key","isCollapsed","showAddButton","visible","constraints.type","constraints.min","constraints.max","allowDrag","allowDrop","totalCount.text"]},{tag:"workflows",attr:["key","allowedTransitions"]},{tag:"stackedHeaderRows",attr:[[{tag:"stackedHeaderColumns",attr:["headerText","column"]}]]},{tag:"contextMenuSettings",attr:["customMenuItems","menuItems","disableDefaultItems"]},{tag:"filterSettings",attr:["text","query","description"]},{tag:"editSettings.editItems",attr:["field","editType","validationRules","editParams","defaultValue"]}],this.localizedLabels=null,this.currentViewData=null,this.keyConfigs={focus:"e",insertCard:"45",deleteCard:"46",editCard:"113",saveRequest:"13",cancelRequest:"27",firstCardSelection:"36",lastCardSelection:"35",upArrow:"38",downArrow:"40",rightArrow:"39",leftArrow:"37",swimlaneExpandAll:"ctrl+40",swimlaneCollapseAll:"ctrl+38",selectedSwimlaneExpand:"alt+40",selectedSwimlaneCollapse:"alt+38",selectedColumnCollapse:"ctrl+37",selectedColumnExpand:"ctrl+39",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40",multiSelectionByLeftArrow:"shift+37",multiSelectionByRightArrow:"shift+39"},this.dataTypes={dataSource:"data",query:"data",columns:"array",stackedHeaderRows:"array",contextMenuSettings:{disableDefaultItems:"array",menuItems:"array",customMenuItems:"array"},filterSettings:"array",editSettings:{editMode:"enum",editItems:"array"},searchSettings:{fields:"array"}},this.defaults={dataSource:null,keyField:null,keySettings:null,allowTitle:!1,cssClass:"",allowSelection:!0,allowSearching:!1,allowToggleColumn:!1,enableTotalCount:!1,enableTouch:!0,selectionType:"single",allowKeyboardNavigation:!1,allowDragAndDrop:!0,allowHover:!0,allowScrolling:!1,allowPrinting:!1,enableRTL:!1,stackedHeaderRows:[],filterSettings:[],scrollSettings:{width:"auto",height:0,allowFreezeSwimlane:!1},swimlaneSettings:{showCount:!0,allowDragAndDrop:!1,unassignedGroup:{enable:!0,keys:["null","undefined",""]}},fields:{content:null,tag:null,color:null,imageUrl:null,swimlaneKey:null,primaryKey:null,priority:null},cardSettings:{colorMapping:{},template:null},columns:[],contextMenuSettings:{enable:!1,menuItems:["Add Card","Edit Card","Delete Card","Top of Row","Bottom of Row","Move Up","Move Down","Move Left","Move Right","Move to Swimlane","Hide Column","Visible Columns","Print Card"],customMenuItems:[]},customToolbarItems:[],editSettings:{editItems:[],allowEditing:!1,allowAdding:!1,dialogTemplate:null,externalFormTemplate:null,formPosition:"bottom"},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},tooltipSettings:{enable:!1,template:null},minWidth:0,isResponsive:!1,locale:"en-US",query:null,create:null,actionBegin:null,actionComplete:null,actionFailure:null,load:null,destroy:null,beginEdit:null,endEdit:null,endAdd:null,endDelete:null,beforeCardSelect:null,cardSelect:null,toolbarClick:null,cardDoubleClick:null,cardDragStart:null,cardDrag:null,cardDragStop:null,cardDrop:null,contextClick:null,contextOpen:null,cardClick:null,beforePrint:null,cellClick:null,headerClick:null,dataBound:null,queryCellInfo:null},this._dataSource=ej.util.valueFunction("dataSource"),this._rootCSS="e-kanban",this._requiresID=!0,this._id=null,this.KanbanDragAndDrop=null,this.KanbanEdit=null,this.KanbanCommon=null,this.KanbanAdaptive=null,this.KanbanScroll=null,this.KanbanContext=null,this.KanbanSwimlane=null,this.KanbanSelection=null,this.KanbanFilter=null,this._currentJsonData=null,this._kanbanRows=null,this._columnRows=null,this._swimlaneRows=null,this._filterToolBar=null,this._filteredRecordsCount=0,this._filteredRecords=null,this._contexttarget=null,this._editForm=null,this._newData=null,this._isAddNew=!1,this._isRemoteSaveAdaptor=!1,this._queryPromise=null,this._kanbanWidth=null,this.keyPredicates=null,this._cloneQuery=null,this._isLocalData=!0,this._previousRowCellIndex=[],this.selectedRowCellIndexes=[],this._bulkUpdateData=[],this._bulkPriorityData=[],this._kbnFilterObject=[],this._kbnAdaptFilterObject=[],this._kbnFilterCollection=[],this._kbnAdaptDdlData=[],this._kbnAdaptDdlIndex=0,this._kbnSwipeWidth=0,this._kbnSwipeCount=0,this._searchTout=null,this._cardSelect=null,this._kbnBrowserContext=null,this._kbnMouseX=null,this._kbnAutoFilterCheck=!1,this._autoKbnSwipeLeft=!1,this._autoKbnSwipeRight=!1,this._kbnTransitionEnd=!0,this._kbnDdlWindowResize=!1,this._conmenu=null,this._rowIndexesColl=[],this.templates={},this.initialRender=!1,this._columnsWidthCollection=[],this._slTemplate="",this._cardTemplate="",this._tdsOffsetWidth=[],this._scrollObject=null,this._templateRefresh=!1,this._action="",this._hiddenColumns=[],this._visibleColumns=[],this._filterCollection=[],this.collapsedColumns=null,this._expandedColumns=null,this._headerColumnNames=null,this._isWatermark=null,this._searchInput=null,this._hiddenSpan=null,this._currentRowCellIndex=[],this._recordsCount=0,this._dropinside=!1,this._selectedCards=[],this._selectedCardData=[],this._tableBEle=null,this._saveArgs=null,this._cModifiedData=null,this._dropped=null,this._cAddedRecord=null,this._cDeleteData=null,this._isAddNewClick=!1,this._isEdit=!1,this._currentData=null,this._newCard=null,this._cardEditClick=null,this._collapsedCards=[],this._collapsedSwimlane=[],this._keyValue=[],this._dblArgs=null,this._freezeSwimlaneRow={},this._freezeScrollTop=0,this._freezeSlOrder=0,this._originalWidth=null,this._originalScrollWidth=0,this._collapsedColumns=[],this._enableMultiTouch=!1,this._enableSwimlaneCount=!0,this._kTouchBar=null,this._contextSwimlane=null,this._initialData=null,this._searchBar=null,this._originalScrollHeight=null,this._dataManager=null,this._priorityCollection=[],this._initialKanbanModel=[],this._kbnAdaptEditClickHandler=function(n){if(this.element.hasClass("e-responsive")){var t=$(n.target);(t.attr("id")==this._id+"_Cancel"||t.parent().attr("id")==this._id+"_closebutton")&&this.KanbanEdit.cancelEdit();t.attr("id")==this._id+"_Save"&&this.KanbanEdit.endEdit()}},this._keyPressed=function(n,t,i,r){return this.KanbanCommon._kanbanKeyPressed(n,t,i,r)},this._freezeSwimlane=function(n){this.KanbanSwimlane&&this.KanbanSwimlane._freezeRow(n,this)},this.getCurrentJsonData=function(){return this._currentJsonData},t&&(this._id=t[0].id,t.jquery||(t=$("#"+t)),t.length)?$(t).ejKanban(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.getHeaderTable=function(){return this.headerTable},t.prototype.setHeaderTable=function(n){this.headerTable=n},t.prototype.getColumnByHeaderText=function(n){var i,t;if(!ej.isNullOrUndefined(n)){for(i=this.model.columns,t=0;t<i.length;t++)if(i[t].headerText==n)break;return t==i.length?null:i[t]}},t.prototype._getColumnKeyIndex=function(n){for(var r,i=this.model.columns,u,t=0;t<i.length;t++)for(u=typeof i[t].key=="object"?i[t].key:i[t].key.split(","),r=0;r<u.length;r++)if(u[r]==n)return t;return t==i.length?null:i[t]},t.prototype._checkMultikey=function(n){var i=n.index(),t;return t=this.model.columns[i].key,t=typeof t=="object"?t:t.split(","),t.length>1?!0:!1},t.prototype._destroy=function(){var i,n,r,t;if(this.element.off(),this.element.find(".e-kanbanheader").find(".e-headercontent").add(this.getContent().find(".e-content")).off("scroll"),ej.isNullOrUndefined(this._filterToolBar)||this._filterToolBar.ejToolbar("destroy"),!ej.isNullOrUndefined(this._editForm)){for(i=this._editForm.find(".e-field"),t=0;t<i.length;t++)n=$(i[t]),n.hasClass("e-ejinputtext")&&this.element.find(".e-ejinputtext").remove(),n.hasClass("e-kanbantextarea")&&this.element.find(".e-kanbantextarea").remove(),n.hasClass("e-dropdownlist")&&n.ejDropDownList("destroy"),n.hasClass("e-numerictextbox")&&n.ejNumericTextbox("destroy"),r=n.parent("div").find("textarea.e-rte"),r.length&&(r.ejRTE("destroy"),n.parent().find("textarea").remove());$("#"+this._id+"_dialogEdit").ejDialog("destroy")}this.element.ejWaitingPopup("destroy");this.model.contextMenuSettings.enable&&($("#"+this._id+"_Context").ejMenu("destroy"),$("#"+this._id+"_Context").remove());this.element.children().remove();this.model.isResponsive&&$(window).off("resize",$.proxy(this.kanbanWindowResize,this))},t.prototype._menu=function(n){this.KanbanContext&&this.KanbanContext._kanbanMenu(n,this)},t.prototype._setModel=function(n){this.KanbanCommon._kanbanSetModel(n,this)},t.prototype._onToolbarClick=function(n){var i=$(this.itemsContainer).closest(".e-kanban"),t=n.type=="keyup"?this:i.data("ejKanban");t.KanbanCommon._kanbanToolbarClick(n,t)},t.prototype._showToolTip=function(n){var t=this,o,s,f,e;if(t.model.tooltipSettings.enable){if($(n.target).hasClass("e-kanbantooltip"))return;if(f=t.element.find(".e-kanbantooltip"),e=ej.isNullOrUndefined(t.model.tooltipSettings.template),e&&!($(n.target).hasClass("e-tag")||$(n.target).hasClass("e-text")||$(n.target).closest(".e-primarykey").length>0))return;e?f.html($(n.target).text()).removeClass("e-tooltiptemplate"):(f.addClass("e-tooltiptemplate"),s=new ej.DataManager(t._currentJsonData),o=s.executeLocal((new ej.Query).where(t.model.fields.primaryKey,ej.FilterOperators.equal,$(n.currentTarget).attr("id"))),f.html($(t.model.tooltipSettings.template).render(o[0])));var r=ej.isNullOrUndefined(n.originalEvent)?n.originalEvent.clientX:n.pageX,u=ej.isNullOrUndefined(n.originalEvent)?n.originalEvent.clientY:n.pageY,i=$(t.element).find(".e-kanbantooltip");r=r+i.width()<$(t.element).width()?r:r-i.width();u=u+i.height()<$(t.element).height()?u:u-i.height();i.css("left",r);i.css("top",u);t.model.enableRTL==!0&&i.addClass("e-rtl");$(t.element).find(".e-kanbantooltip").show()}},t.prototype._hideToolTip=function(){this.model.tooltipSettings.enable&&this.element.find(".e-kanbantooltip").hide()},t.prototype.showColumns=function(n){var t,i="_visibleColumns";t=typeof n=="string"?this.getColumnByHeaderText(n):this.getColumnByHeaderText(n[0]);this.KanbanCommon._showExpandColumns(t,n,"_hiddenColumns",i);this.KanbanCommon._showhide(this[i],"show");this.KanbanCommon._renderLimit();this.KanbanCommon._totalCount();this.model.stackedHeaderRows.length>0&&this.KanbanCommon._refreshStackedHeader()},t.prototype.print=function(n){var i={},t,o,s,r,n,u,f,e;i.requestType="print";this._trigger("actionBegin",i);ej.isNullOrUndefined(this.element.find("#"+this._id+"_externalEdit"))||this.element.find("#"+this._id+"_externalEdit").css("display","none");t=this.element.clone();t.find(".e-kanbantouchbar").remove();this.model.allowScrolling&&(o=this.model.scrollSettings.width,s=this.model.scrollSettings.height,(this.getScrollObject().isVScroll()||this.getScrollObject().isHScroll())&&(r=this.getContent().find(".e-content")[0],t.find(".e-kanbancontent").height(r.scrollHeight),t.find(".e-kanbancontent").ejScroller({width:r.scrollWidth,height:r.scrollHeight}),t.width(r.scrollWidth)));(!ej.isNullOrUndefined(this.model.filterSettings)||this.model.allowSearching||this.model.allowPrinting||!ej.isNullOrUndefined(this.model.customToolbarItems))&&t.find(".e-kanbantoolbar").remove();t.find(".e-kanbancontent div:first").nextAll().remove();n&&((typeof n=="string"||typeof n=="number")&&(n=this.element.find("div.e-kanbancard[id="+n+"]")),t.find(".e-kanbanheader").remove(),u=n.parent().clone(),f=n.clone(),u.children().remove(),t.find('table[role="kanban"]').remove(),t.find(".e-kanbancontent").children().append(u.append(f)),t.css("border-style","none"),this.model.allowScrolling?(t.css({width:"auto",height:"auto"}),t.find(".e-kanbancontent").css({width:"auto",height:"auto"})):t.find(".e-kanbancard").css("width","30%"));e=window.open("","print","height=452,width=1024,tabbar=no");i={requestType:"print",element:t};this._trigger("beforePrint",i);ej.isNullOrUndefined(i.element)||(t=i.element);ej.print(t,e);this._trigger("actionComplete",i)},t.prototype._kbnAdaptClickHandler=function(n){this.KanbanAdaptive&&this.KanbanAdaptive._adaptiveKbnClick(n)},t.prototype._kbnTouchEndHandler=function(){var n=this.element.find(".e-draggedcard");n.length>0&&n.remove();this._cardSelect="null"},t.prototype._kbnTouchClick=function(n){if(this.model.selectionType=="multiple"&&this._kTouchBar.is(":visible")&&!$(n.target).hasClass("e-cardselection")&&$(n.target).parents(".e-cardselection").length<=0&&!$(n.target).hasClass("e-cardtouch")&&$(n.target).parents(".e-cardtouch").length<=0&&!this._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")&&this._kTouchBar.hide(),n.type=="touchstart"&&(this._cardSelect="touch"),this.model.allowSearching&&!this.element.hasClass("e-responsive")){var t=this.element.find(".e-searchbar.e-ul");$(n.target).hasClass("e-searchitem")&&$(n.target).hasClass("e-cancel")||$(n.target).parents(".e-searchdiv").length>0&&$(n.target).parents(".e-searchbar").find(".e-cancel").length>0?t.addClass("e-highliht-kbnsearchbar"):$(n.target).hasClass("e-searchitem")&&$(n.target).hasClass("e-searchfind")&&t.removeClass("e-highliht-kbnsearchbar")}},t.prototype._kbnHoldHandler=function(n){if(this.model.enableTouch&&($(n.target).hasClass("e-kanbancard")||$(n.target).parents(".e-kanbancard").length>0)&&n.type=="taphold"&&n.pointerType=="touch"){this._cardSelect="hold";var i=$(n.target),t=null;$(n.target).parents(".e-kanbancard").length>0&&(i=$(n.target).parents(".e-kanbancard"));this.KanbanDragAndDrop&&(t=this.KanbanDragAndDrop._createCardClone(t,i),t.css({position:"absolute",top:n.originalEvent.changedTouches[0].pageY,left:n.originalEvent.changedTouches[0].pageX}),t.addClass("e-left-rotatecard"))}},t.prototype._swipeKanban=function(n){if(this.element.hasClass("e-responsive")&&this._kbnTransitionEnd&&this.element.find(".e-targetclone").length==0)switch(n.type){case"swipeleft":this.KanbanAdaptive._kbnLeftSwipe();break;case"swiperight":this.KanbanAdaptive._kbnRightSwipe()}},t.prototype._wireEvents=function(){if(this._on(this.element,$.isFunction($.fn.tap)&&this.model.enableTouch?"tap":"click","",this._clickHandler),this._on($("#"+this._id+"_searchbar"),"keyup","",this._onToolbarClick),this._on($(document),"click touchstart","",this._kbnTouchClick),this._on(this.element,"taphold","",this._kbnHoldHandler),this._on(this.element,"touchend","",this._kbnTouchEndHandler),this._on(this.element,$.isFunction($.fn.doubletap)&&this.model.enableTouch?"doubletap":"dblclick",".e-kanbancard",this._cardDblClickHandler),this.KanbanAdaptive&&this._on(this.element,"swipeleft swiperight",".e-kanbancontent",$.proxy(this._swipeKanban,this)),this.KanbanContext&&this._on(this.element,"contextmenu","",this.KanbanContext._kbnBrowserContextMenu),this.KanbanFilter&&this._on($("#"+this._id+"_searchbar"),"keypress","",this.KanbanFilter._onToolbarKeypress),this.KanbanEdit){if(ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8)$(window).on("resize",$.proxy(this.kanbanWindowResize,this));this._enableEditingEvents()}this._enableCardHover();this.model.tooltipSettings.enable&&(this._on(this.element,"mouseover",".e-kanbancard",this._showToolTip),this._on(this.element,"mouseout",".e-kanbancard",this._hideToolTip));this.model.allowKeyboardNavigation&&(this.element[0].tabIndex=this.element[0].tabIndex==-1?0:this.element[0].tabIndex,this.element[0].accessKey=!ej.isNullOrUndefined(this.element[0].accessKey)&&this.element[0].accessKey!=""?this.element[0].accessKey:"e",this._on(this.element,"keyup","",undefined))},t.prototype._enableEditingEvents=function(){this.model.editSettings.allowAdding?this._on(this.element,"dblclick doubletap",".e-kanbancontent .e-columnrow .e-rowcell",this._cellDblClickHandler):this._off(this.element,"dblclick doubletap",".e-kanbancontent .e-columnrow .e-rowcell");this.model.editSettings.allowEditing||this.model.editSettings.allowAdding?this._on($("#"+this._id+"_dialogEdit"),"click keypress","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel",this._clickHandler):this._off($("#"+this._id+"_dialogEdit"),"click","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel")},t.prototype._cardDblClickHandler=function(n){this._dblArgs=n;var i,f=this.model.fields.primaryKey,r,u,t=new ej.Query;if(i=$(n.target).closest(".e-kanbancard"),r=i.attr("id"),u=new ej.DataManager(this._currentJsonData),t=t.where(f,ej.FilterOperators.equal,r),this._currentData=u.executeLocal(t),this._dblArgs.data=this._currentData[0],this._trigger("cardDoubleClick",this._dblArgs),!this._isEdit){if(this._cardEditClick=!0,!ej.isNullOrUndefined(this._cardEditClick)&&this._cardEditClick&&this._dblArgs.cancel){this._cardEditClick=null;return}this.model.editSettings.allowEditing&&this.KanbanEdit.startEdit($(n.target).closest(".e-kanbancard"))}},t.prototype._cellDblClickHandler=function(n){$(n.target).hasClass("e-rowcell")&&(this._isAddNewClick=!0,this._newCard=$(n.target),this.KanbanEdit.addCard())},t.prototype._enableCardHover=function(){this.model.allowHover?this._on(this.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard",this._cardHover):this._off(this.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard")},t.prototype.refreshColumnConstraints=function(){this.KanbanCommon._renderLimit();this.KanbanSwimlane&&this._enableSwimlaneCount&&this.KanbanSwimlane._swimlaneLimit(args);this._enableSwimlaneCount=!1},t.prototype.hideColumns=function(n){for(var i,r=0,u,f="_hiddenColumns",t=0;t<this._visibleColumns.length;t++)i=$.inArray(this._collapsedColumns[t],this._visibleColumns),i!=-1&&r++;if(this._visibleColumns.length-1>r)u=typeof n=="string"?this.getColumnByHeaderText(n):this.getColumnByHeaderText(n[0]),this.KanbanCommon._hideCollapseColumns(u,n,f,"_visibleColumns"),this.KanbanCommon._showhide(this[f],"hide"),this.model.stackedHeaderRows.length>0&&this.KanbanCommon._refreshStackedHeader();else{if(this._visibleColumns.length==1)return;this._visibleColumns[0]==n?this.KanbanCommon._expandColumns(this._visibleColumns[1]):this.KanbanCommon._expandColumns(this._visibleColumns[0]);this.hideColumns(n)}this.KanbanCommon._renderLimit();this.KanbanCommon._totalCount();this.KanbanCommon._stackedHeadervisible()},t.prototype._cardHover=function(n){var r=$(n.target),i=$(this._kanbanRows),t=$(r).closest(".e-kanbancard");return t.length<=0?!1:(this.model.allowHover&&(n.type=="mouseenter"?ej.isNullOrUndefined(i)||t.index()!=-1&&t.addClass("e-hover"):i.find(".e-kanbancard").removeClass("e-hover")),!1)},t.prototype.toggleCard=function(n){var t,i;if(typeof n=="string"||typeof n=="number")t=this.element.find("div.e-kanbancard[id="+n+"]"),this.KanbanCommon._toggleCardByTarget($(t).find(".e-cardheader .e-icon"));else if(typeof n=="object"&&n[0].nodeName!="DIV")for(i=0;i<n.length;i++)t=this.element.find("div.e-kanbancard[id="+n[i]+"]"),this.KanbanCommon._toggleCardByTarget($(t).find(".e-cardheader .e-icon"));else this.KanbanCommon._toggleCardByTarget(n)},t.prototype.toggleColumn=function(n){var u,i,f,t,r,s,e,o;if(typeof n=="string"||"object"&&n[0].nodeName!="DIV"&&n[0].nodeName!="TD")this.KanbanCommon._toggleField(n);else if(n[0].nodeName=="TD")this.KanbanCommon._toggleField(n.closest(".e-shrink").find(".e-shrinkheader").text().split("[")[0]);else if(s=this.model.columns,this.model.stackedHeaderRows.length&&(r=this.model.stackedHeaderRows[0].stackedHeaderColumns),f=n.closest(".e-headercell").not(".e-stackedHeaderCell"),i=this.element.find(".e-columnheader").not(".e-stackedHeaderRow").find(".e-hide"),f.length>0)this.KanbanCommon._toggleField(s[f.index()].headerText);else if(n.closest(".e-shrink").find(".e-shrinkheader").length>0)for(t=0;t<i.length;t++)e=$(i[t]).find(".e-headerdiv").text().split("[")[0],e==n.closest(".e-shrink").find(".e-shrinkheader").text().split("[")[0]&&($(i[t]).next().find(".e-clcollapse").addClass("e-clexpand"),$(i[t]).next().find(".e-clexpand").removeClass("e-clcollapse"),this.KanbanCommon._toggleField(e));else if(n.closest(".e-stackedHeaderRow").length>0)for(u=n.closest(".e-stackedHeaderCell"),t=0;t<r.length;t++)r[t].headerText==$(u).text()&&(u.hasClass("e-collapse")?this.element.find(".e-stackedHeaderCell").eq(t).removeClass("e-collapse"):this.element.find(".e-stackedHeaderCell").eq(t).addClass("e-collapse"),this.KanbanCommon._toggleField(r[t].column.split(",")));this.element.find(".e-targetdragclone").is(":visible")&&(o=this.element.find(".e-targetdragclone").next(".e-kanbancard").eq(0),o.length>0?this.element.find(".e-targetdragclone").width(o.width()):this.element.find(".e-targetdragclone").width(""));this.model.allowScrolling&&this.model.allowToggleColumn&&(this.KanbanCommon._setWidthToColumns(),this.KanbanScroll._renderScroller())},t.prototype._clickevent=function(n){this.KanbanContext&&this.KanbanContext._kanbanContextClick(n,this)},t.prototype._clickHandler=function(n){var t=$(n.target),i,f=t.hasClass("e-rowcell")?t.index():t.closest(".e-rowcell").index(),r=this.getIndexByRow(t.closest("tr.e-columnrow")),u;i=t.closest(".e-kanbancard");($(n.target).hasClass("e-customaddbutton")||$(n.target).parents(".e-customaddbutton").length>0)&&(this._isAddNewClick=!0,this._newCard=$(n.target).parents(".e-rowcell"),this.KanbanEdit&&this.KanbanEdit.addCard());(t.hasClass("e-cardexpand")||t.hasClass("e-cardcollapse")||t.hasClass("e-expandcollapse"))&&this.toggleCard(t);(t.closest(".e-clexpand").length||t.closest(".e-clcollapse").length||t.closest(".e-shrink").length||t.closest(".e-stackedHeaderRow").length)&&this.model.allowToggleColumn&&this.toggleColumn(t);!ej.isNullOrUndefined(this.model.fields.swimlaneKey)&&(t.hasClass("e-slexpandcollapse")||t.hasClass("e-slexpand")||t.hasClass("e-slcollapse"))&&this.KanbanSwimlane.toggle(t);this.model.allowSelection&&this.KanbanSelection&&i.length>0&&t.closest(".e-expandcollapse").length<=0&&(u=$(i.parent()).children().eq(0).hasClass("e-limits")?i.index()-1:i.index(),this.model.selectionType=="single"?this.KanbanSelection._cardSelection([[r,[f],[u]]],i,n):this.model.selectionType=="multiple"&&(n.shiftKey||n.ctrlKey||this._enableMultiTouch?(this._currentRowCellIndex.length==0||r==this._currentRowCellIndex[0][0])&&this.KanbanSelection._cardSelection([[r,[f],[u]]],i,n):this.KanbanSelection._cardSelection([[r,[f],[u]]],i,n)));i.length>0&&this.KanbanCommon._cardClick(t,i);(t.attr("id")==this._id+"_Cancel"||t.parent().attr("id")==this._id+"_closebutton")&&this.KanbanEdit.cancelEdit();t.attr("id")==this._id+"_Save"&&this.KanbanEdit.endEdit();t.hasClass("e-cardtouch")&&(t.hasClass("e-spanclicked")?(t.removeClass("e-spanclicked"),this._enableMultiTouch=!1,this._kTouchBar.hide()):(t.addClass("e-spanclicked"),this._enableMultiTouch=!0));this.KanbanCommon._kbnHeaderAndCellEvents(t)},t.prototype.getRowByIndex=function(n){if(!ej.isNullOrUndefined(n))return $(this._columnRows[n])},t.prototype.getScrollObject=function(){return(this._scrollObject==null||ej.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},t.prototype.getIndexByRow=function(n){return $(this._columnRows).index(n)},t.prototype._initialize=function(){},t.prototype._initPrivateProperties=function(){this.currentViewData=null;this._filterCollection=[];this._collapsedColumns=[];this._expandedColumns=[];this._dataManager=this._dataSource()instanceof ej.DataManager?this._dataSource():this._dataSource()!=null?new ej.DataManager(this._dataSource()):null;this._originalWidth=this.element.width();this._recordsCount=this._dataSource()!==null?this._dataSource().length:0;ej.Kanban.Locale["default"]=ej.Kanban.Locale["en-US"]={EmptyCard:"No cards to display",SaveButton:"Save",CancelButton:"Cancel",EditFormTitle:"Details of ",AddFormTitle:"Add New Card",SwimlaneCaptionFormat:"- {{:count}}{{if count == 1 }} item {{else}} items {{/if}}",FilterSettings:"Filters:",FilterOfText:"of",Max:"Max",Min:"Min",Cards:" Cards",ItemsCount:"Items Count :",Unassigned:"Unassigned",AddCard:"Add Card",EditCard:"Edit Card",DeleteCard:"Delete Card",TopofRow:"Top of Row",BottomofRow:"Bottom of Row",MoveUp:"Move Up",MoveDown:"Move Down",MoveLeft:"Move Left",MoveRight:"Move Right",MovetoSwimlane:"Move to Swimlane",HideColumn:"Hide Column",VisibleColumns:"Visible Columns",PrintCard:"Print Card",Search:"Search"};this.localizedLabels=this._getLocalizedLabels()},t.prototype._init=function(){if(this._initPrivateProperties(),this._initialKanbanModel=$.extend(!0,{},this.model),this._trigger("load"),!ej.isNullOrUndefined(this.model.query)&&this.model.query instanceof ej.Query||(this.model.query=new ej.Query),this._initSubModules(),this._initialize(),this.model.columns.length==0)return!1;this.KanbanAdaptive&&this.KanbanAdaptive._kbnAdaptSwimlaneData();this.element.removeClass("e-kanbanscroll");this.KanbanScroll&&this.KanbanScroll._initScrolling();this._checkDataBinding()},t.prototype._initSubModules=function(){var n=this.model;this.KanbanCommon=new ej.KanbanFeatures.Common(this);n.allowDragAndDrop&&(this.KanbanDragAndDrop=new ej.KanbanFeatures.DragAndDrop(this));(n.editSettings.allowEditing||n.editSettings.allowAdding)&&(this.KanbanEdit=new ej.KanbanFeatures.Edit(this));n.isResponsive&&(this.KanbanAdaptive=new ej.KanbanFeatures.Adaptive(this));n.isResponsive&&n.minWidth>0&&(n.allowScrolling=!0);n.allowScrolling&&(this.KanbanScroll=new ej.KanbanFeatures.Scroller(this));n.contextMenuSettings.enable&&(this.KanbanContext=new ej.KanbanFeatures.Context(this));n.fields&&!ej.isNullOrUndefined(n.fields.swimlaneKey)&&(this.KanbanSwimlane=new ej.KanbanFeatures.Swimlane(this));n.allowSelection&&(this.KanbanSelection=new ej.KanbanFeatures.Selection(this));(n.filterSettings.length>0||n.allowFiltering||n.customToolbarItems.length>0||n.allowPrinting||n.allowSearching)&&(this.KanbanFilter=new ej.KanbanFeatures.Filter(this))},t.prototype.kanbanWindowResize=function(n){var e,h,u,g,a,i,f,r,nt,tt,o,it,v,y,t,p,rt,w,c,ut,b,l,k,s,d,ft;if(this.KanbanAdaptive)if(this._kbnDdlWindowResize&&ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8&&n.stopImmediatePropagation(),e=this.element.find(".e-kanbantoolbar"),h=this.model.fields.swimlaneKey,this.model.isResponsive&&(ej.isNullOrUndefined(this.model.minWidth)||this.model.minWidth==0)){if(g=$(".e-kanbanfilter-window"),a=!0,ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)<=9&&(a=!1),a)if(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches){if(this.model.isResponsive&&this.kanbanContent.hasClass("e-scroller")&&this.kanbanContent.data("ejScroller").destroy(),this.element.hasClass("e-responsive")||(this.element.addClass("e-responsive"),e.css("display","table"),e.find(".e-searchdiv").hide(),e.find(".e-search").css({border:"none"}),ej.isNullOrUndefined(h)||this.KanbanAdaptive._kbnAdaptSwimlaneDdl(),this.model.filterSettings.length>0&&(this.KanbanAdaptive._kbnAdaptFilterWindow(),this._kbnFilterCollection=this._filterCollection.slice()),this._on($(".e-swimlane-window,.e-kanbanfilter-window,.e-kanbantoolbar"),$.isFunction($.fn.tap)&&this.model.enableTouch?"tap":"click","",this._kbnAdaptClickHandler)),this.KanbanAdaptive._columnTimeoutAdapt(),!this.element.hasClass("e-swimlane-responsive"))for(i=this.element.find(".e-rowcell:visible"),t=0;t<i.length;t++)i.eq(t).height()+i.eq(t).offset().top>$(window).height()&&(f=i.eq(t).find(".e-cell-scrollcontent"),f.length>0?(f.ejScroller({height:$(window).height()-(this.kanbanContent.offset().top+2),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),i.eq(t).find(".e-shrinkheader").prependTo(i.eq(t))):(f=ej.buildTag("div.e-cell-scrollcontent","<div><\/div>"),i.eq(t).append(f),f.children().append(i.eq(t).children(":not('.e-cell-scrollcontent')")),f.ejScroller({height:$(window).height()-(this.kanbanContent.offset().top+2),thumbStart:$.proxy(this._kbnThumbStart,this),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),i.eq(t).find(".e-shrinkheader").prependTo(i.eq(t))));if(u=this.element.find(".e-searchbar"),u.length>0&&u.find(".e-ejinputtext").val().length>0&&(r=u.find(".e-searchitem"),r.addClass("e-searchfind"),r.prev().show(),u.siblings().hide(),u.find(".e-adapt-search").length==0&&(nt=ej.buildTag("div.e-icon e-adapt-search e-searchfind","",{}),tt=ej.buildTag("div.e-icon e-adapt-cancel e-cancel","",{}),r.siblings(".e-searchdiv").append(tt).prepend(nt)),r.parents(".e-search").css({border:""}),r.parents("body").removeClass("e-kbnwindow-modal"),r.parents(".e-kanbantoolbar").addClass("e-adaptive-search"),u.find(".e-adapt-cancel").show(),r.hide()),this.model.filterSettings.length>0)for(o=this.element.find(".e-quickfilter").nextAll(".e-tooltxt"),t=0;t<o.length;t++)o.eq(t).hasClass("e-select")&&(it=o.index(o.eq(t)),v=this.element.find(".e-kanbanfilter-icon"),this._kbnAutoFilterCheck=!0,g.find(".e-filter-content span.e-chkbox-wrap").eq(it).click(),this._kbnAutoFilterCheck=!1,v.hasClass("e-kbnclearfl-icon")||v.addClass("e-kbnclearfl-icon"),o.eq(t).removeClass("e-select"));if(ej.isNullOrUndefined(h)||this.kanbanContent.ejScroller({height:$(window).height()-(this.headerContent.offset().top+this.headerContent.height()+5),scroll:$.proxy(this._freezeSwimlane,this),thumbStart:$.proxy(this._kbnThumbStart,this),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),!this.element.hasClass("e-swimlane-responsive"))for(y=this.element.find(".e-rowcell .e-cell-scrollcontent:visible"),t=0;t<y.length;t++)p=$(y[t]).data("ejScroller"),ej.isNullOrUndefined(p)||p.refresh();rt=this.element.find(".e-kanbandialog");w=this.element.find(".e-swimlane-window");rt.is(":visible")&&this.KanbanAdaptive&&this.KanbanAdaptive._setAdaptEditWindowHeight();!ej.isNullOrUndefined(h)&&w.is(":visible")&&(c=this.element.find(".e-slwindow-scrollcontent"),ut=this.headerContent.offset().top,c.ejScroller({height:$(window).height()-c.offset().top,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),c.data("ejScroller").refresh(),w.css({height:$(window).height()-ut}));this.KanbanSwimlane&&this.KanbanSwimlane._removeFreezeRow();this.model.allowSearching&&ej.browserInfo().name=="webkit"&&this.element.find(".e-searchitem").addClass("e-webkitadapt-search")}else this.KanbanAdaptive&&(b=$("#"+this._id+"_toolbarItems"),b.parents(".e-kanban").length==0&&(b.removeClass("e-kbntoolbar-body").prependTo(this.element),$("#"+this._id+"_slWindow").removeClass("e-kbnslwindow-body").appendTo(this.element)),this.KanbanAdaptive._removeKbnAdaptItems(),this.element.find(".e-webkitadapt-search").removeClass("e-webkitadapt-search"),this.model.allowScrolling&&(this.KanbanCommon._setWidthToColumns(),this.KanbanScroll._renderScroller()));!ej.isNullOrUndefined(this.model.fields.swimlaneKey)&&this.kanbanContent.hasClass("e-scroller")&&this.kanbanContent.data("ejScroller").refresh();this.KanbanAdaptive._setAdaptiveSwimlaneTop()}else this.model.scrollSettings.width=this._originalScrollWidth,this.element.outerWidth("100%"),this.getContentTable().width("100%"),this.getHeaderTable().width("100%"),l=this.element.outerWidth(),k=$(window).width()-this.element.offset().left,s=$(window).height()-this.element.offset().top,e.length>0&&(s=s-(e.outerHeight()+25)),d=this.headerContent.outerHeight()+this.getContentTable().height(),ft=this.model.minWidth>l||k<=l||s<=d,this.KanbanAdaptive&&this.KanbanAdaptive._renderResponsiveKanban(ft,d,l,s,k)},t.prototype._initKanbanRender=function(){var n=this,t;this._addInitTemplate();this.model.keySettings&&$.extend(this.model.keyConfigs,this.model.keySettings);this._render();this._trigger("dataBound",{});this.model.contextMenuSettings.enable&&(this._dataManager.dataSource.offline?this.KanbanContext._renderContext():(t=n._dataSource().executeQuery(this.model.query),t.done(ej.proxy(function(t){n._contextSwimlane=new ej.DataManager(t.result);n.KanbanContext._renderContext()}))));this.KanbanEdit&&(this.KanbanEdit._processEditing(),this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?this.element.append(this.KanbanEdit._renderDialog()):(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&this.element.append(this.KanbanEdit._renderExternalForm()));this.KanbanAdaptive&&this.KanbanAdaptive._setResponsiveHeightWidth();this.KanbanSelection&&this.KanbanSelection._renderKanbanTouchBar();this._wireEvents();this.model.tooltipSettings.enable&&(this.element.append($("<div class='e-kanbantooltip'><\/div>")),this.element.find(".e-kanbantooltip").hide());this.initialRender=!1},t.prototype._render=function(){this.element.addClass(this.model.cssClass+"e-widget");this._renderContent().insertAfter(this.element.children(".e-kanbanheader"));this.model.enableTotalCount&&this.KanbanCommon._totalCount();this.KanbanCommon._renderLimit();this._enableDragandScroll();ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow"));this.initialRender&&this.KanbanCommon._addLastRow()},t.prototype._renderHeader=function(){var e=ej.buildTag("div.e-kanbanheader","",{},{}),a=ej.buildTag("div","",{},{}),tt=$(document.createElement("colgroup")),s,rt,i,c,w,u,b,et,k,ot,d,st,g,nt,f,l;ej.isNullOrUndefined(this.model.fields.swimlaneKey)||e.addClass("e-slheader");this.model.allowScrolling&&a.addClass("e-headercontent");e.append(a);var o=ej.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"kanban"}),v=ej.buildTag("thead","",{},{}),it=ej.buildTag("tbody.e-hide","",{},{});for(s=0;s<this.model.stackedHeaderRows.length;s++)rt=this.KanbanCommon._createStackedRow(this.model.stackedHeaderRows[s]),v.append(rt);var y=ej.buildTag("tr.e-columnheader","",{},{}),ut=$(document.createElement("tr")),r=this.model.columns;for(this._visibleColumns=[],this._expandedColumns=[],this._headerColumnNames={},i=0;i<r.length;i++){var n=r[i],t=ej.buildTag("th.e-headercell","",{},{role:"columnheader"}),h=document.createElement("col"),ht=document.createElement("td"),p=ej.buildTag("div.e-headercelldiv","",{},{}),ft=ej.buildTag("div.e-headerdiv",n.headerText!=null?n.headerText:n.key,{},{});if(ej.isNullOrUndefined(n.headerTemplate)||ft.html($(n.headerTemplate).hide().html()),u=null,this.model.enableTotalCount&&(c=ej.buildTag("div.e-totalcard","",{},{}),w=ej.buildTag("span.e-totalcount","",{},{}),ej.isNullOrUndefined(n.totalCount)||ej.isNullOrUndefined(n.totalCount.text)?c.append(this.localizedLabels.ItemsCount).append(w):c.append(n.totalCount.text+" : ").append(w),t.append(c)),ej.isNullOrUndefined(n.constraints)||(b=!ej.isNullOrUndefined(n.constraints.min),et=!ej.isNullOrUndefined(n.constraints.max),u=ej.buildTag("div.e-limits","",{},{}),b&&(k=ej.buildTag("div.e-min",this.localizedLabels.Min,"",{}),ot=ej.buildTag("span.e-minlimit"," "+n.constraints.min.toString(),"",{}),k.append(ot),u.append(k)),et&&(d=ej.buildTag("div.e-max",this.localizedLabels.Max,"",{}),st=ej.buildTag("span.e-maxlimit"," "+n.constraints.max.toString(),"",{}),d.append(st),b&&u.append("/"),u.append(d)),this.model.enableTotalCount&&u.children().length>0&&u.prepend("|")),p.append(ft),t.prepend(p),t.append(u),this.model.allowToggleColumn&&(r[i].isCollapsed===!0?t.append(ej.buildTag("div.e-icon e-clcollapse","",{},{})).addClass("e-shrinkcol"):t.append(ej.buildTag("div.e-icon e-clexpand","",{},{}))),r[i].isCollapsed===!0&&this.model.allowToggleColumn?(t.find(".e-headercelldiv,.e-totalcard,.e-limits").addClass("e-hide")&&$(h).addClass("e-shrinkcol"),$.inArray(r[i].headerText,this._collapsedColumns)==-1&&this._collapsedColumns.push(r[i].headerText)):(t.find(".e-headercelldiv,.e-totalcard").removeClass("e-hide")&&$(h).removeClass("e-shrinkcol"),ej.isNullOrUndefined(r[i].constraints)||r[i].constraints.type!="column"?t.find(".e-limits").addClass("e-hide"):t.find(".e-limits").removeClass("e-hide"),this._expandedColumns.push(r[i].headerText),r[i].isCollapsed=!1),tt.append(h),y.append(t),ut.append(ht),n.visible===!1?(t.addClass("e-hide")&&$(h).css("display","none"),$.inArray(n.headerText,this._hiddenColumns)==-1&&this._hiddenColumns.push(n.headerText)):(this._visibleColumns.push(n.headerText),n.visible=!0),g=t.find(".e-limits"),nt=t.find(".e-totalcard"),(t.find(".e-clexpand").length>0||r[i].isCollapsed)&&(nt.length==0&&g.length==0?t.addClass("e-toggleonly"):nt.length==0&&g.children().length==0&&t.addClass("e-toggleonly")),t.hasClass("e-toggleonly"))for(l=0;l<this.model.columns.length;l++)f=this.model.columns[l],ej.isNullOrUndefined(f.constraints)||ej.isNullOrUndefined(f.constraints.min)&&ej.isNullOrUndefined(f.constraints.max)||t.addClass("e-toggle-withoutcount");f=this.model.columns[i];!this.model.enableTotalCount&&(ej.isNullOrUndefined(f.constraints)||ej.isNullOrUndefined(f.constraints.min)&&ej.isNullOrUndefined(f.constraints.max))||(t.addClass("e-toggle-withcount"),y.addClass("e-header-withcount"));(ej.isNullOrUndefined(n.allowDrag)||n.allowDrag!=!1)&&(n.allowDrag=!0);(ej.isNullOrUndefined(n.allowDrop)||n.allowDrop!=!1)&&(n.allowDrop=!0);ej.isNullOrUndefined(n.headerTemplate)||p.parent().addClass("e-headertemplate");this.initialRender&&(typeof n.width=="string"&&n.width.indexOf("%")!=-1?this._columnsWidthCollection.push(parseInt(n.width)/100*this.element.width()):this._columnsWidthCollection.push(n.width))}return v.append(y),o.append(tt).append(v),it.append(ut),o.append(it),a.append(o),this.setHeaderContent(e),this.setHeaderTable(o),e},t.prototype._renderContent=function(){var t=ej.buildTag("div.e-kanbancontent","",{},{}),i=ej.buildTag("div","",{},{}),u=ej.buildTag("tbody","",{},{}),n=ej.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"kanban"}),r;return n.append(this.getHeaderTable().find("colgroup").clone()).append(u),i.append(n),t.append(i),this.setContent(t),this.setContentTable(n),n.attr("role","kanban"),r={requestType:"refresh"},this.sendDataRenderingRequest(r),t},t.prototype.refreshTemplate=function(){this._addInitTemplate();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this.KanbanEdit._addDialogEditingTemplate()},t.prototype.getContentTable=function(){return this.contentTable},t.prototype.setContentTable=function(n){this.contentTable=n},t.prototype.getVisibleColumnNames=function(){return this._visibleColumns},t.prototype.getHeaderContent=function(){return this.headerContent},t.prototype.setHeaderContent=function(n){this.headerContent=n},t.prototype.getContent=function(){return this.kanbanContent},t.prototype.setContent=function(n){this.kanbanContent=n},t.prototype._initDataSource=function(){var n=this,t;this._isLocalData=!(this._dataSource()instanceof ej.DataManager)||this._dataSource().dataSource.offline;this._ensureDataSource();this._trigger("actionBegin");t=this._dataSource().executeQuery(this.model.query);this.element.is(":visible")||this.element.ejWaitingPopup("hide");t.done(ej.proxy(function(t){n.element.ejWaitingPopup("hide");n._currentJsonData=n.currentViewData=t.result;n._recordsCount=t.count==0&&t.result.length?t.result.length:t.count;n._initKanbanRender()}))},t.prototype.columns=function(n,t,i){var u,r,f,o,e,s;if(!ej.isNullOrUndefined(n)){for(u=!1,typeof n=="string"?(n=[n],u=!0):n instanceof Array&&n.length&&typeof n[0]=="string"&&(u=!0),r=0;r<n.length;r++)f=$.inArray(this.getColumnByHeaderText(u?n[r]:n[r].headerText),this.model.columns),i=="add"||ej.isNullOrUndefined(i)?f==-1?this.model.columns.push(u?{headerText:n[r],key:t}:n[r]):this.model.columns[f]=u?{headerText:n[r],key:t}:n[r]:f!=-1&&this.model.columns.splice(f,1);for(o=this.element.find(".e-kanbanheader"),this._columnsWidthCollection=[],e=0;e<this.model.columns.length;e++)ej.isNullOrUndefined(this.model.columns[e].width)||this._columnsWidthCollection.push(this.model.columns[e].width);this.element[0].replaceChild(this._renderHeader()[0],o[0]);u?(this._keyValue.push(t),this.keyPredicates.push(new ej.Predicate(this.model.keyField,ej.FilterOperators.equal,t,!0))):this._addColumnFilters();s={requestType:"addcolumn"};this.refresh(!0);this.KanbanScroll&&this.KanbanScroll._refreshHeaderScroller();this.KanbanCommon._totalCount()}},t.prototype._checkDataBinding=function(){var n,t;(this.model.columns.length||(this._dataSource()!=null&&this._dataSource().length||this._dataSource()instanceof ej.DataManager)&&(!(this._dataSource()instanceof ej.DataManager)||this._dataManager.dataSource.url!=undefined||this._dataSource().dataSource.json.length))&&(ej.isNullOrUndefined(this.model.keyField)||this._addColumnFilters(),this.initialRender=!0,this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),(this.model.filterSettings.length>0||this.model.allowSearching||this.model.customToolbarItems.length>0||this.model.allowPrinting)&&this.element.append(this._renderToolBar()),n=this.model.columns,n&&n.length&&(this.element.append(this._renderHeader()),this.KanbanCommon._stackedHeadervisible()),$.isFunction($.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),$("#"+this._id+"_WaitingPopup").addClass("e-kanbanwaitingpopup")),this._dataSource()instanceof ej.DataManager?(this.element.ejWaitingPopup("show"),this._dataSource().ready!=undefined?(t=this,this._dataSource().ready.done(function(n){t._initDataSource();t.model.dataSource=new ej.DataManager(n.result)})):(this.element.ejWaitingPopup("show"),this._initDataSource())):(this._trigger("actionBegin"),this._ensureDataSource(),this._initKanbanRender(),this.KanbanCommon._enableKanbanRTL()))},t.prototype._renderToolBar=function(){var n=ej.buildTag("div.e-kanbantoolbar","",{},{id:this._id+"_toolbarItems"}),o,s,f,r,u,t,v;if(this.model.allowSearching){this._isWatermark="placeholder"in document.createElement("input");var e=ej.buildTag("ul.e-searchbar","",{},{}),i=ej.buildTag("li.e-search","",{},{id:this._id+"_toolbarItems_search"}),c=ej.buildTag("a.e-searchitem e-toolbaricons e-disabletool e-icon e-searchfind","",{float:"right"},{});ej.browserInfo().name=="msie"&&c.css("position","absolute");o=ej.buildTag("input.e-ejinputtext e-input","",{},{type:"text",id:this._id+"_searchbar",placeholder:this.localizedLabels.Search,height:"33px"});s=ej.buildTag("div.e-searchdiv","",{display:"inline-table",width:"83%"},{});s.append(o);i.append(s);i.append(c);e.append(i);this._searchInput=o;ej.isNullOrUndefined(this.model.searchSettings.key)||this._searchInput.val(this.model.searchSettings.key);this._searchBar=i;this._isWatermark||(this._hiddenSpan=ej.buildTag("span.e-input e-placeholder","Search",{display:"block"},{}).insertAfter(this._searchInput))}for(ej.isNullOrUndefined(this.model.customToolbarItems)||(f=ej.buildTag("ul.e-customtoolbar"),this.model.filterSettings.length>0&&f.addClass("e-customtoolbarseparator"),!ej.isNullOrUndefined(this.model.customToolbarItems)&&this.model.customToolbarItems.length&&this._renderCustomLi(f),n.append(f)),this.model.filterSettings.length>0&&(r=ej.buildTag("ul","",{},{}),u=ej.buildTag("li","",{},{"class":"e-quickfilter",tabindex:"0"}),u.append("<label class='e-toolbartext e-text'>"+this.localizedLabels.FilterSettings+"<\/label>"),r.append(u)),t=0;t<this.model.filterSettings.length;t++){var l=this.model.filterSettings[t].description,i=ej.buildTag("li","",{},{id:this._id+"_"+this.model.filterSettings[t].text,title:ej.isNullOrUndefined(l)?this.model.filterSettings[t].text:l,tabindex:"0","class":"e-kbnfilter-tbtn"}),a=ej.buildTag("a.e-toolbartext e-text",this.model.filterSettings[t].text,{},{});i.append(a);r.append(i)}if(this.model.allowPrinting){var h=ej.buildTag("ul.e-print","",{},{}),u=ej.buildTag("li","",{},{"class":"e-printlist",title:"Print",tabindex:"0"}),a=ej.buildTag("a.e-printicon e-icon","",{});u.append(a);h.append(u)}return ej.isNullOrUndefined(r)||n.append(r),ej.isNullOrUndefined(h)||n.append(h),ej.isNullOrUndefined(e)||n.append(e),v={click:this._onToolbarClick},n.ejToolbar(v),this._filterToolBar=n,n},t.prototype._renderCustomLi=function(n){for(var i,r,u,t=0;t<this.model.customToolbarItems.length;t++){r=this.model.customToolbarItems[t].template?this.model.customToolbarItems[t].template.replace("#",""):this.model.customToolbarItems[t];i=ej.buildTag("li","",{},{id:this._id+"_"+r,title:r});switch(typeof this.model.customToolbarItems[t]){case"string":u=ej.buildTag("a.e-toolbaricons e-icon","",{}).addClass(this.model.customToolbarItems[t].text);break;case"object":i.attr("title",this.model.customToolbarItems[t].template.replace("#",""));u=$(this.model.customToolbarItems[t].template).hide().html()}i.html(u);n.append(i)}},t.prototype.dataSource=function(n,t){t&&(this._templateRefresh=!0);this._dataSource(n);this.KanbanCommon._refreshDataSource(n);this.model.enableTotalCount&&this.KanbanCommon._totalCount();this.KanbanCommon._addLastRow()},t.prototype._ensureDataSource=function(n){var t,f,s,i,r,e,h,u,c,o,l;if(this._dataSource()==null&&!(this._dataSource()instanceof ej.DataManager)){if(ej.isNullOrUndefined(n)||n.requestType!="add")return;this.dataSource([],!1)}if(this.model.query.requiresCount(),t=this.model.query,u=t.clone(),this._dataSource()instanceof ej.DataManager||(this._currentJsonData=this.currentViewData=this._dataSource()),(this.model.filterSettings.length||this.model.allowFiltering)&&!ej.isNullOrUndefined(n)&&n.requestType=="filtering"||!ej.isNullOrUndefined(n)&&n.requestType=="search"||this.model.searchSettings.key.length){for(t.queries=t.queries.slice(t.queries.length),this.model.allowSearching&&(s=this._searchBar.find(".e-toolbaricons"),this.model.searchSettings.key.length!=0?(i=this.model.searchSettings,s.removeClass("e-searchfind").addClass("e-cancel"),i.fields.length==0&&(ej.isNullOrUndefined(this.model.fields.content)||i.fields.push(this.model.fields.content),ej.isNullOrUndefined(this.model.fields.swimlaneKey)||i.fields.push(this.model.fields.swimlaneKey),ej.isNullOrUndefined(this.model.fields.primaryKey)||i.fields.push(this.model.fields.primaryKey),ej.isNullOrUndefined(this.model.fields.title)||i.fields.push(this.model.fields.title),ej.isNullOrUndefined(this.model.fields.tag)||i.fields.push(this.model.fields.tag),ej.isNullOrUndefined(this.model.fields.imageUrl)||i.fields.push(this.model.fields.imageUrl),ej.isNullOrUndefined(this.model.fields.priority)||i.fields.push(this.model.fields.priority),ej.isNullOrUndefined(this.model.fields.color)||i.fields.push(this.model.fields.color)),t.search(i.key,i.fields,i.operator||"contains",i.ignoreCase)):s.removeClass("e-cancel").addClass("e-searchfind")),this.element.hasClass("e-responsive")&&(this._filterCollection=this._kbnFilterCollection.slice()),r=0;r<this._filterCollection.length;r++)f=f!=undefined?f.and(this._filterCollection[r]):this._filterCollection[r];for(t.where(ej.Predicate.or(this.keyPredicates)),r=0;r<t.queries.length;r++)t.queries[r].fn=="onWhere"&&f&&(t.queries[r].e=t.queries[r].e.and(f));this._isLocalData&&(this._filteredRecords=this._dataManager.executeLocal(t).result,this._filteredRecordsCount=this._filteredRecords.length);this._isLocalData&&this.model.filterSettings.length==0&&(!ej.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount>0)&&(this._filteredRecordsCount=null,this._filteredRecords=[])}this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!ej.isNullOrUndefined(this._cModifiedData)||!ej.isNullOrUndefined(this._cAddedRecord))&&(t.queries=u.queries);n&&n.requestType=="delete"&&!ej.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof ej.DataManager?(e=$.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(e,1)):(e=$.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(undefined,!0).splice(e,1)));this._cloneQuery=t.clone();this._isLocalData&&(!ej.isNullOrUndefined(n)&&(n.requestType=="addcolumn"||n.requestType=="refresh")&&this._filterCollection.length<=0&&(ej.isNullOrUndefined(this._searchInput)||this._searchInput.val().length<=0)?(u=t.clone(),u.queries=[],u.where(ej.Predicate.or(this.keyPredicates)),h=u):h=t,c=this._dataManager.dataSource.json,o=this._dataSource().dataSource,!ej.isNullOrUndefined(o)&&this._dataSource()instanceof ej.DataManager&&(this._dataManager.dataSource.json=c!=o.json?o.json:c),l=this._dataManager.executeLocal(h),this.currentViewData=this._currentJsonData=l.result,this._recordsCount=l.count)},t.prototype._addColumnFilters=function(){for(var n,t,u=this.model.columns,i=[],f=this.model.query,r=0;r<u.length;r++)for(n=u[r].key,ej.isNullOrUndefined(n)||(n=typeof n=="object"?n:n.split(",")),t=0;t<n.length;t++)i.push(new ej.Predicate(this.model.keyField,ej.FilterOperators.equal,n[t],!0)),this._keyValue.push(n[t]);i.length>0&&f.where(ej.Predicate.or(i));this.keyPredicates=i},t.prototype.refresh=function(n){n&&this.refreshTemplate();this.KanbanCommon._processBindings({requestType:"refresh"})},t.prototype.sendDataRenderingRequest=function(n){var t,r;if(this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1),t=this.model.query,r=t.clone(),this.currentViewData!=null&&this.currentViewData.length){switch(n.requestType){case"save":case"drop":case"delete":case"refresh":case"search":case"filtering":this.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(n.currentFilterObject)&&(this._kbnAdaptFilterObject=n.currentFilterObject.slice());case"cancel":if(this.element.find(".e-kbnadapt-editdlg").length==0&&this.element.hasClass("e-responsive")&&(this.model.editSettings.allowAdding||this.model.editSettings.allowEditing)&&$("#"+this._id+"_dialogEdit_wrapper").appendTo(this.element),this.getContentTable().find("colgroup").first().replaceWith(this.KanbanCommon._getMetaColGroup()),!ej.isNullOrUndefined(this.model.fields.swimlaneKey)){var i=this,f=this.model.fields.swimlaneKey,u=this.model.swimlaneSettings.unassignedGroup;t=t.group(f);this.currentViewData.GROUPGUID||(u.enable&&u.keys.length>0&&$.map(i.currentViewData,function(n,t){i.currentViewData[t]=i._checkKbnUnassigned(n)}),this.currentViewData.GROUPGUID||(this.currentViewData=new ej.DataManager(this.currentViewData).executeLocal(t).result))}this._renderAllCard();this.element.hasClass("e-responsive")&&(ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this.element.find(".e-swimlanerow").hide(),this.KanbanAdaptive&&this.KanbanAdaptive._addSwimlaneName()));this._enableSwimlaneCount=!0;this._eventBindings();this._enableDragandScroll();break;case"beginedit":case"add":this.KanbanEdit&&(this.KanbanEdit._editAdd(n),this._enableSwimlaneCount=!1)}t.queries=r.queries}else this.getContentTable().find("tbody").empty().first().append(this.KanbanCommon._getEmptyTbody());(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&(this._editForm=this.element.find(".e-externalform"),this.KanbanEdit._formFocus());("beginedit"==n.requestType||"add"==n.requestType)&&(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform")&&this.KanbanEdit._refreshEditForm(n);this._renderComplete(n);this.KanbanSwimlane&&this._enableSwimlaneCount&&(this.KanbanSwimlane._swimlaneLimit(n),this._swimlaneRows=this.element.find(".e-swimlanerow"));this.KanbanCommon._renderLimit();this._filterCollection.length==0&&this.model.searchSettings.key.length==0&&this.KanbanCommon._totalCount();(this._filterCollection.length>0||this.model.searchSettings.key.length>0)&&this.KanbanFilter._filterLimitCard(n);this._newData=null;this.element.hasClass("e-responsive")&&(this.kanbanWindowResize(),ej.isNullOrUndefined(this.model.fields.swimlaneKey)||this.KanbanAdaptive._setAdaptiveSwimlaneTop())},t.prototype._checkKbnUnassigned=function(n){for(var u,i=this.model.swimlaneSettings.unassignedGroup,r=n[this.model.fields.swimlaneKey],f=this.model.fields.swimlaneKey,t=0;t<i.keys.length;t++)typeof i.keys[t]=="string"&&(i.keys[t].replace(/^\s+|\s+$/g,"")==""&&$.inArray("",i.keys)>=0&&t<$.inArray("",i.keys)?i.keys.splice(t,1):i.keys[t].replace(/^\s+|\s+$/g,"")==""&&(i.keys[t]=i.keys[t].replace(/^\s+|\s+$/g,"")));if(r!=undefined&&r!=null&&typeof r=="string"&&(r=r.replace(/^\s+|\s+$/g,"")),r==null||r==undefined)for(t=0;t<i.keys.length;t++)typeof i.keys[t]=="string"&&(i.keys[t].toLowerCase()=="null"||i.keys[t].toLowerCase()=="undefined")?n[f]=this.localizedLabels.Unassigned:(i.keys[t]==null||i.keys[t]==undefined)&&(n[f]=this.localizedLabels.Unassigned);else for(t=0;t<i.keys.length;t++)u=i.keys[t],typeof r=="number"&&u.startsWith("'")&&u.endsWith("'")&&(u=u.split("'")[1]),u==r&&(n[f]=this.localizedLabels.Unassigned);return n},t.prototype._renderAllCard=function(){var n=document.createElement("div");n.innerHTML=["<table>",$.render[this._id+"_JSONTemplate"]({columns:this.model.columns,dataSource:this.currentViewData}),"<\/table>"].join("");ej.isNullOrUndefined(n.firstChild)||ej.isNullOrUndefined(n.firstChild.lastChild)||this.getContentTable().get(0).replaceChild(n.firstChild.lastChild,this.getContentTable().get(0).lastChild);ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow"));this._cardCollapse();this._swimlaneCollapse();this.KanbanSelection&&this.KanbanSelection._selectionOnRerender()},t.prototype._editEventTrigger=function(n){if(n.requestType=="save"||n.requestType=="delete"){var t={data:n.data,action:n.action!==undefined?n.action:n.requestType};this._trigger("end"+t.action.charAt(0).toUpperCase()+t.action.slice(1),t)}},t.prototype._renderComplete=function(n){n.requestType!="beginedit"&&this.KanbanCommon._setWidthToColumns();(n.requestType=="save"||n.requestType=="cancel")&&(this._isAddNew=!1,this._isEdit=!1);n.requestType=="beginedit"&&(this._isEdit=!0);("delete"==n.requestType||"save"==n.requestType)&&this._editEventTrigger(n);this._tableBEle=this.getContentTable().get(0);this._kanbanRows=this._tableBEle.rows;this._columnRows=$(this._kanbanRows).not(".e-swimlanerow");this.model.allowScrolling&&!this.initialRender&&this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell");this._trigger("actionComplete",n);!this.initialRender&&this.model.allowScrolling&&(n.requestType=="add"||n.requestType=="cancel"||n.requestType=="save"||n.requestType=="delete"||n.requestType=="filtering"||n.requestType=="search"||n.requestType=="refresh"||n.requestType=="drop")&&this.KanbanScroll._refreshScroller(n);this.model.allowDragAndDrop&&this.KanbanDragAndDrop&&this.KanbanDragAndDrop._addDragableClass()},t.prototype._createTemplate=function(n,t){var i=document.createElement("script"),r;return i.id=this._id+t+"_Template",r=this.element.parents("body").find("#"+i.id),i.type="text/x-jsrender",i.text=n,r&&r.remove(),$("body").append(i),i},t.prototype._addInitTemplate=function(){var n=this,t={},r=!ej.isNullOrUndefined(n.model.keyField),u=ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8,f=this.model.allowToggleColumn,i=!ej.isNullOrUndefined(n.model.fields.swimlaneKey);this._slTemplate="";t[n._id+"Object"]=this;t["_"+n._id+"columnKeys"]=this._getColumnKeyItems;t["_"+n._id+"tagItems"]=this._gettagItems;t["_"+n._id+"colorMaps"]=this._getColorMaps;t["_"+n._id+"getId"]=this.KanbanCommon._removeIdSymbols;t["_"+n._id+"getData"]=this._columnData;t["_"+n._id+"getCardCount"]=this._columnCardcount;t["_"+n._id+"getStatus"]=this._columnStatus;$.views.helpers(t);i&&(this._slTemplate+="{{for dataSource ~columns=columns ~ds=dataSource}}",this._slTemplate+="<tr id='{{: ~_"+n._id+"getId(key)}}' class='e-swimlanerow' role='kanbanrow'><td class='e-rowcell' role='kanbancell' colspan='"+n.getVisibleColumnNames().length+"'><div class='e-slexpandcollapse'><div class='e-icon e-slexpand'><\/div><\/div><div class='e-slkey'>{{:key}}<\/div>{{if "+this.model.swimlaneSettings.showCount+"}}<div class='e-slcount'>"+n.localizedLabels.SwimlaneCaptionFormat+"<\/div>{{/if}}<\/td><\/tr>");this._slTemplate+="<tr class='e-columnrow' role='kanbanrow'>";this._slTemplate+=i?"{{for ~columns ~items=#data.items}}":"{{for columns}}";this._slTemplate+="<td ej-mappingkey='{{:key}}' class='e-rowcell {{if !#data.visible}} e-hide {{/if}}{{if #data.allowDrag}} e-drag {{/if}}{{if #data.allowDrop}} e-drop {{/if}}{{if (#data.isCollapsed && "+f+")}}e-shrink{{/if}}'role='kanbancell'>{{if "+r+"}}{{for ~_"+n._id+"columnKeys('"+n._id+"Object')}}";this._slTemplate+=this._cardCustomization()+"{{/for}}{{/if}}{{if "+this.model.allowToggleColumn+"}}<div class='e-shrinkheader{{if "+u+"}} IE{{/if}}{{if !#data.isCollapsed}} e-hide {{/if}}'>{{:headerText}}<div class='e-shrinklabel'>[<div class='e-shrinkcount'>{{:~_"+n._id+"getCardCount(~root.dataSource,key,#parent.parent.getIndex(),'"+n._id+"Object') }}<\/div>]<\/div><\/div>{{/if}}{{if "+this.model.editSettings.allowAdding+"}}{{if #data.showAddButton}} <div class='e-customaddbutton{{if #data.isCollapsed}} e-hide {{/if}}'><div class='e-columnadd e-icon'><\/div><\/div>{{/if}}{{/if}}<\/td>{{/for}}<\/tr>";i&&(this._slTemplate+="{{/for}}");this.templates[this._id+"_JSONTemplate"]=$.templates(this._createTemplate(this._slTemplate,"_swinlaneContent"));this.templates[this._id+"_cardTemplate"]=$.templates(this._createTemplate(this._cardTemplate,"_cardTemplate"));$.templates(this.templates)},t.prototype._cardCustomization=function(){var t=this,u=this.model.allowToggleColumn,i=this.model.cardSettings.template?!0:!1,r=this.model.fields.imageUrl?!0:!1,n=this.model.fields,o=!ej.isNullOrUndefined(n.title),f=n.title?n.title:n.primaryKey?n.primaryKey:null,e=!ej.isNullOrUndefined(n.tag)||!ej.isNullOrUndefined(n.content);return r||this.element.addClass("e-onlycontent"),this._cardTemplate="<div id='{{:"+t.model.fields.primaryKey+"}}' class='e-kanbancard {{if ~_"+t._id+"getData(#parent) && "+u+" }}e-hide{{/if}} {{if "+i+"}}e-templatecell{{/if}}'>{{if "+i+"}}"+$(t.model.cardSettings.template).html()+"{{else}}{{if "+t.model.allowTitle+"}}<div class='e-cardheader'><div class='e-primarykey'>{{:"+f+"}}<\/div><div class='e-expandcollapse'><div class='e-icon e-cardexpand'><\/div><\/div><\/div>{{/if}}<div class='e-cardcontent'><table class='e-cardtable'><tbody><tr><td class='e-contentcell'>{{if "+e+"}}<div class='e-text'>{{:"+n.content+"}}<\/div><\/td>{{if "+r+" }} <td class='e-imagecell'><div class='e-card_image'>{{if "+n.imageUrl+"}}<img class='e-image' src='{{:"+n.imageUrl+"}}'><\/img>{{else}}<div class='e-image e-no-user'><\/div>{{/if}}<\/div><\/td>{{/if}}<\/tr><tr><td>{{if "+n.tag+"}}{{for ~_"+t._id+"tagItems("+n.tag+")}}{{:#data}}{{/for}}{{/if}}<\/div>{{/if}}<\/td><td class='e-trainglecell'><div class='e-bottom-triangle'{{if "+n.color+" }} style='border-bottom-color:{{for ~_"+t._id+"colorMaps('"+t._id+"Object',"+n.color+")}}{{:#data}}{{/for}}'{{/if}}><\/div><\/td><\/tr><\/tbody><\/table><\/div>{{/if}}<\/div><\/div>",this._cardTemplate},t.prototype._columnStatus=function(n){var t=this.getRsc("helpers",n),i=t.getBrowserDetails();return i.browser=="msie"?!0:!1},t.prototype._columnCardcount=function(n,t,i,r){var o=r,e,u,f;if(typeof r=="string"&&(o=this.getRsc("helpers",r)),e=0,t=typeof t=="object"?t:t.split(","),ej.isNullOrUndefined(i)){for(u=0;u<n.length;u++)for(f=0;f<t.length;f++)n[u][o.model.keyField]===t[f]&&e++;return e}for(u=0;u<n[i].items.length;u++)for(f=0;f<t.length;f++)n[i].items[u][o.model.keyField]===t[f]&&e++;return e},t.prototype._columnData=function(n){return ej.isNullOrUndefined(n)?!1:n.parent.data.isCollapsed},t.prototype._getColorMaps=function(n,t){var e=this.getRsc("helpers",n),f,r=e.model.cardSettings.colorMapping,i,u;for(i in r){if(r[i].indexOf(",")==-1&&r[i]==t)return i;for(f=r[i].split(","),u=0;u<f.length;u++)if(f[u]==t)return i}},t.prototype._gettagItems=function(n){var i="<div class='e-tags'>",t;for(n=n.split(","),t=0;t<n.length;t++)i=i.concat("<div class='e-tag'>"+n[t]+"<\/div>");return i.concat("<\/div>")},t.prototype._getColumnKeyItems=function(n){var i=this.getRsc("helpers",n),f,s=this.ctx.root.dataSource,r,h=i.model.query,t=h.clone(),e,o,u;for(i._filterCollection.length<=0&&i.model.allowSearching&&i._searchInput.val().length<=0?(t.queries=[],t.where(ej.Predicate.or(i.keyPredicates))):t.queries=t.queries.slice(0,t.queries.length-1),e=typeof this.data.key=="object"?this.data.key:this.data.key.split(","),o=[],u=0;u<e.length;u++)o.push(new ej.Predicate(i.model.keyField,ej.FilterOperators.equal,e[u],!0));return t=t.where(ej.Predicate.or(o)),f=s.GROUPGUID?new ej.DataManager(this.ctx.items).executeLocal(t).result:new ej.DataManager(s).executeLocal(t).result,r=i.model.fields.priority,r&&f.sort(function(n,t){return n[r]-t[r]}),f},t.prototype._kbnThumbStart=function(n){var t=$(n.originalEvent.target);return t.hasClass("e-kanbancard")||t.parents(".e-kanbancard").hasClass("e-kanbancard"),!1},t.prototype._enableDragandScroll=function(){this.model.allowDragAndDrop&&this.KanbanDragAndDrop&&this.KanbanDragAndDrop._addDragableClass();this.model.allowScrolling&&(this.initialRender&&this.element.find(".e-kanbancontent").length>0?(ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow")),this.KanbanScroll._renderScroller()):this.KanbanScroll._refreshScroller({requestType:"refresh"}))},t.prototype._cardCollapse=function(){this._collapsedCards.length>0&&this.toggleCard(this._collapsedCards)},t.prototype._swimlaneCollapse=function(){var t,n;if(this._collapsedSwimlane.length>0)for(t=this.element.find(".e-swimlanerow"),n=0;n<t.length;n++)$.inArray(t.eq(n).attr("id"),this._collapsedSwimlane)!=-1&&this.KanbanSwimlane._toggleSwimlaneRow($(t.eq(n)).find(".e-rowcell .e-slexpandcollapse"))},t.prototype.updateCard=function(n,t){this.KanbanCommon._kanbanUpdateCard(n,t)},t.prototype._eventBindings=function(){var i,t,u,r,n,f;if(this._kanbanRows=this.getContentTable().get(0).rows,i=$(this._kanbanRows).not(".e-swimlanerow"),this._currentJsonData.length!=0&&this.model.queryCellInfo!=null)for(t=0;t<i.length;t++)for(u=i[t],r=this.model.columns,n=0;n<r.length;n++)f=$(u).find(".e-rowcell")[n],this._cellEventTrigger(f,r[n])},t.prototype._cellEventTrigger=function(n,t){for(var r=$(n).find(".e-kanbancard"),i=0;i<r.length;i++){var u=r[i].id,f=this.KanbanCommon._getKanbanCardData(this._currentJsonData,u),e={card:r[i],cell:n,column:t,data:f[0]};this._trigger("queryCellInfo",e)}},t.prototype._getLocalizedLabels=function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)},t}(ej.WidgetBase);window.ej.widget("ejKanban","ej.Kanban",new Kanban);ej.Kanban.Actions={Filtering:"filtering",BeginEdit:"beginedit",Edit:"edit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Refresh:"refresh",Search:"searching",Print:"print"};ej.Kanban.EditingType={String:"stringedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",TextArea:"textarea",RTE:"rteedit"};ej.Kanban.EditMode={Dialog:"dialog",DialogTemplate:"dialogtemplate",ExternalForm:"externalform",ExternalFormTemplate:"externalformtemplate"};ej.Kanban.FormPosition={Bottom:"bottom",Right:"right"};ej.Kanban.Type={Column:"column",Swimlane:"swimlane"};ej.Kanban.SelectionType={Multiple:"multiple",Single:"single"};ej.Kanban.MenuItem={AddCard:"Add Card",EditCard:"Edit Card",DeleteCard:"Delete Card",TopofRow:"Top of Row",BottomofRow:"Bottom of Row",MoveUp:"Move Up",MoveDown:"Move Down",MoveLeft:"Move Left",MoveRight:"Move Right",MovetoSwimlane:"Move to Swimlane",HideColumn:"Hide Column",VisibleColumns:"Visible Columns",PrintCard:"Print Card"};ej.Kanban.Target={Header:"header",Content:"content",Card:"card",All:"all"};ej.Kanban.Locale={},function(n,t,r){t.widget("ejSpreadsheet","ej.Spreadsheet",{_rootCSS:"e-spreadsheet",element:null,_excelFilter:null,validTags:["div"],model:null,_requiresID:!0,defaults:{allowFreezing:!0,enableContextMenu:!0,allowEditing:!0,allowResizing:!0,allowMerging:!0,allowWrap:!0,allowUndoRedo:!0,allowClipboard:!0,allowDataValidation:!0,allowConditionalFormats:!0,allowSearching:!0,allowKeyboardNavigation:!0,allowAutoFill:!0,allowSelection:!0,allowSorting:!0,allowDragAndDrop:!0,allowCellType:!0,allowAutoCellType:!1,allowCharts:!0,enablePersistence:!1,allowCellFormatting:!0,allowFormulaBar:!0,showRibbon:!0,showPager:!0,allowComments:!0,allowFiltering:!0,allowInsert:!0,allowDelete:!0,allowFormatPainter:!0,allowHyperlink:!0,allowImport:!0,allowFormatAsTable:!0,allowAutoSum:!0,enablePivotTable:!1,allowLockCell:!0,enableTouch:!0,allowOverflow:!0,allowClear:!0,isReadOnly:!1,columnCount:21,rowCount:20,rowHeight:20,columnWidth:64,sheetCount:1,undoRedoStep:20,activeSheetIndex:1,apWidth:300,activationPanelWidth:300,_isActPanelVisible:!1,cssClass:"",userName:"",locale:"en-US",pageSize:"A4",sheets:[],nameManager:[],customFormulas:[],currentViewData:null,query:null,create:null,actionBegin:null,actionComplete:null,beforeCellFormat:null,cellFormatting:null,beforeOpen:null,beforeDrop:null,drop:null,cellEdit:null,pagerClick:null,cellClick:null,_pivotPrint:null,tabClick:null,tabSelect:null,_createPivotTable:null,beforePanelOpen:null,load:null,loadComplete:null,editRangeBegin:null,editRangeComplete:null,cellHover:null,menuClick:null,contextMenuClick:null,ribbonClick:null,dragStart:null,drag:null,cellSave:null,beforeCellSelect:null,cellSelected:null,autoFillBegin:null,autoFillComplete:null,openFailure:null,onImport:null,onExport:null,beforeBatchSave:null,keyUp:null,keyDown:null,dragShape:null,resizeStart:null,resizeEnd:null,refresh:null,beforeEditComment:null,beforeTabClick:null,scrollStop:null,scrollSettings:{width:"100%",height:"100%",allowScrolling:!0,scrollMode:"infinite",isResponsive:!0,allowVirtualScrolling:!0,allowSheetOnDemand:!1},pageSettings:{pageCount:10,currentPage:1,pagerHeight:26},exportSettings:{allowExporting:!0,excelUrl:null,csvUrl:null,pdfUrl:null,password:null},pictureSettings:{allowPictures:!0,height:220,width:440},selectionSettings:{selectionType:"default",selectionUnit:"multirange",enableAnimation:!1,animationType:"linear",animationTime:.001,activeCell:""},chartSettings:{height:220,width:440},formatSettings:{allowFontFamily:!0,allowDecimalPlaces:!0,allowCellBorder:!0},autoFillSettings:{fillType:"fillseries",showFillOptions:!0},importSettings:{importMapper:"",importUrl:"",password:"",allowSheetOnDemand:!1,importOnLoad:!1},printSettings:{allowPageSetup:!0,allowPageSize:!1,allowPrinting:!0},ribbonSettings:{enableOnDemand:!1,applicationTab:{type:t.Ribbon.ApplicationTabType.Backstage,menuSettings:{isAppend:!1,dataSource:[]}}}},dataTypes:{pageSize:"enum",sheets:"array",nameManager:"array",scrollSettings:{scrollMode:"enum"},selectionSettings:{selectionType:"enum",selectionUnit:"enum",animationType:"enum"},autoFillSettings:{fillType:"enum"}},_dataSource:function(n){return this.getSheet(n).dataSource},getSheet:function(n){return this.model.sheets[this._getSheetIndex(n)]},getSheets:function(){return this.model.sheets},getSheetElement:function(n){return this.element.find("#"+this._id+"_"+this.getSheet(n).sheetInfo.value)},getDataSettings:function(n){var i,r=[],t=this.getSheet(n),u=t.rangeSettings.length;if(u)while(u--)i=t.rangeSettings[u],i.dataSource&&r.push(i);return r.length?r:t.dataSource?[t]:null},_getJSSheetHeader:function(n){return this._sheets[n]._sheetHeader},_setJSSheetHeader:function(n,t){this._sheets[t]._sheetHeader=n},_getInputBox:function(){return this._inputBox},_setInputBox:function(n){this._inputBox=n},_getIndexBox:function(){return this._indexBox},_setIndexBox:function(n){this._indexBox=n},_getJSSheetRowHeader:function(n){return this._sheets[n]._sheetRowHeader},_setJSSheetRowHeader:function(n,t){this._sheets[t]._sheetRowHeader=n},_getJSSheetRowHeaderContent:function(n){return this._sheets[n]._sheetRowHeaderContent},_setJSSheetRowHeaderContent:function(n,t){this._sheets[t]._sheetRowHeaderContent=n},_getJSSheetContent:function(n){return this._sheets[n]._sheetContent},_setJSSheetContent:function(n,t){this._sheets[t]._sheetContent=n},_getContent:function(n){return this._sheets[n]._content},_setContent:function(n,t){this._sheets[t]._content=n},getPager:function(){return this._spreadSheetPager},setPager:function(n){this._spreadSheetPager=n},getFooter:function(){return this._footer},setFooter:function(n){this._footer=n},getMainPanel:function(){return this._mainPanel},setMainPanel:function(n){this._mainPanel=n},getGroupPanel:function(){return this._groupPanel},setGroupPanel:function(n){this._groupPanel=n},getActivationPanel:function(){return this._activationPanel},setActivationPanel:function(n){this._activationPanel=n},getActiveSheetIndex:function(){return this.model.activeSheetIndex},setActiveSheetIndex:function(n){this.model.activeSheetIndex=n},getRows:function(n){return this._sheets[n]._Rows},setRows:function(n,t){this._sheets[t]._Rows=n},getFrozenRows:function(n){return this.getSheet(this._getSheetIndex(n)).frozenRows},setFrozenRows:function(n,t){this.model.isReadOnly||(this.getSheet(this._getSheetIndex(t)).frozenRows=n)},getFrozenColumns:function(n){return this.getSheet(n).frozenColumns},setFrozenColumns:function(n,t){this.model.isReadOnly||(this.getSheet(t).frozenColumns=n)},setFocusTopElem:function(n){this._focusTopElem=n},getFocusTopElem:function(){return this._focusTopElem},setFocusRightElem:function(n){this._focusRightElem=n},getFocusRightElem:function(){return this._focusRightElem},setFocusBottomElem:function(n){this._focusBottomElem=n},getFocusBottomElem:function(){return this._focusBottomElem},setFocusLeftElem:function(n){this._focusLeftElem=n},getFocusLeftElem:function(){return this._focusLeftElem},setAutoFillElem:function(n){this._autoFillElem=n},getAutoFillElem:function(){return this._autoFillElem},_setAutoFillOptElem:function(n){this._autoFillOptElem=n},_getAutoFillOptElem:function(){return this._autoFillOptElem},_getColWidth:function(n,t){return this.getSheet(t).columnsWidthCollection[n]},_getRowHeight:function(n,t){return this.getSheet(t).rowsHeightCollection[n]},setActiveCell:function(n,i,r){var f=this.getSheet(r?r:this.getActiveSheetIndex()),u;typeof n=="string"&&(u=this.getRangeIndices(n),n=u[0],i=u[1]);f._activeCell=t.isNullOrUndefined(n)&&t.isNullOrUndefined(i)?f._startCell:{rowIndex:n,colIndex:i}},getActiveCell:function(n){return this.getSheet(this._getSheetIndex(n))._activeCell},_setFormulaSuggElem:function(n){this._formulaSuggElem=n},_getFormulaSuggElem:function(){return this._formulaSuggElem},_setRowHdrTBody:function(n,t){this._sheets[t]._rowHdrTBody=n},_getRowHdrTBody:function(n){return this._sheets[n]._rowHdrTBody},_setContTBody:function(n,t){this._sheets[t]._contTBody=n},_getContTBody:function(n){return this._sheets[n]._contTBody},_init:function(){var n=this.model.importSettings,t;this._initBegin();this.model.allowImport&&(n.importUrl.length||n.importOnLoad)?this["import"]({url:n.importUrl,password:this._encrypt(n.password),allowSheetOnDemand:n.allowSheetOnDemand}):(this.showWaitingPopUp(),this._initBase(),this._initComplete());this._isAutoWHMode&&(t=this._getElementDimension(),this.element.css({height:t.height,width:t.width}))},_initBegin:function(){var r="touch-action",i=this.model.scrollSettings,f=i.width,e=i.height,u;t.support.stableSort=!1;this._isInitLoad=!0;this._isAutoWHMode=!i.allowScrolling;this._isAutoWHMode&&(i.isResponsive=!1,i.scrollMode="normal",i.allowVirtualScrolling=!1);this._minWidth=280;this._minHeight=200;this._isAutoWHMode||this.element.css({"min-height":this._minHeight,"min-width":this._minWidth,height:i.height,width:i.width});this._updateResponsiveSettings();this._isAutoWHMode||i.isResponsive||(i.width.toString().indexOf("%")>-1&&(i.width=this._responsiveWidth),i.height.toString().indexOf("%")>-1&&(i.height=this._responsiveHeight),this.element.css({height:i.height,width:i.width}));this._browserDetails=t.browserInfo();this.localizedLabels=t.getLocalizedConstants(this.sfType,this.model.locale);this.element.attr("tabindex",0);this._browserDetails.name==="msie"&&(r="-ms-"+r);this.element.css(r,"double-tap-zoom pinch-zoom");u=t.buildTag("div#"+this._id+"_wait","",{position:"absolute"});n(document.body).append(u);u.ejWaitingPopup({showOnInit:!1,target:this.element})},_initBase:function(){this._refreshModel(this.isImport?this._impData.model:null);this._initProps();this._initCSSTag();this._initLayout();this._wireEvents("_on");this._isInitLoad=!1;this.XLRibbon._renderNameManagerDlg()},_initProps:function(){var r=this.model,i=t.spreadsheetFeatures;this.XLClipboard=new i.clipboard(this);this.XLEdit=new i.editing(this);this.XLPrint=new i.print(this);this.XLRibbon=new i.ribbon(this);this.XLScroll=new i.scroller(this);r.allowDragAndDrop&&(this.XLDragDrop=new i.dragAndDrop(this));r.allowKeyboardNavigation&&(this.XLCellNav=new i.cellNavigation(this));r.allowFiltering&&(this.XLFilter=new i.filter(this));r.allowAutoFill&&(this.XLDragFill=new i.dragFill(this));(r.allowCellFormatting||r.allowFormatAsTable||r.allowFormatPainter)&&(this.XLFormat=new i.cellFormatting(this));r.allowCellFormatting&&(this.XLCellFrmtDlg=new i.formatCellDialog(this));r.allowConditionalFormats&&(this.XLCFormat=new i.cFormat(this));r.allowSearching&&(this.XLSearch=new i.findnreplace(this));r.allowCharts&&(this.XLChart=new i.chart(this));r.exportSettings.allowExporting&&(this.XLExport=new i.exporting(this));r.allowSorting&&(this.XLSort=new i.sorting(this));r.allowFreezing&&(this.XLFreeze=new i.freezepane(this));r.allowComments&&(this.XLComment=new i.comments(this));r.allowSelection&&(this.XLSelection=new i.selection(this));(r.allowCharts||r.pictureSettings.allowPictures)&&(this.XLShape=new i.shape(this));r.allowResizing&&(this.XLResize=new i.resizing(this));r.enableContextMenu&&(this.XLCMenu=new i.contextmenu(this));r.allowDataValidation&&(this.XLValidate=new i.validation(this));r.allowCellType&&(this.XLCellType=new i.cellType(this));r.enablePivotTable&&(this.XLPivot=new i.pivot(this));i.math&&n.extend(t.Spreadsheet.prototype,i.math);this._initPvtProps();this._initFATProps();this.model.customFormulas.length&&this._updateCustomFormulas(this.model.customFormulas,"add");this.model.nameManager.length&&this._refreshNameMngr(this.model.nameManager)},_initPvtProps:function(){var u=1,i={rowIndex:0,colIndex:0},r=this._getLocStr("AutoFillOptions").split("/"),e=this.getActiveSheetIndex(),f=t.preferredCulture(this.model.locale).numberFormat;for(this._dataContainer=this.isImport?n.extend(!0,{},this._impData.dataContainer):{sheets:{},sheetCellType:{},hashCode:[],sharedData:[],cellType:[],valData:[],cFormatData:[]},this._newSIndex=1,this.isImport=this.isImport||!1,this.mergeCenter=!1,this.isDirty=!1,this._calcID=CalcEngine.createSheetFamilyID(),this._calcEngine=new CalcEngine(this,this._calcID),this._calcEngine.setUseDependencies(!0),this._calcEngine.setExcelLikeComputations(!0),this._calcEngine.setUseDatesInCalculations(!0),this._calcEngine.setEnableFormulaErrorValidation(!0),this._calcEngine.setCalculatingSuspended(n("#"+this._id+"_CalcManual").find("span").hasClass("e-ss-calcauto")),this._sheets=[],this._cellProp=["value","value2","type","cFormatRule","range","thousandSeparator","rule","format","border","picture","chart","calcValue","align","hyperlink","formats","borders","tformats","tborders","isFilterHeader","filterState","tableName","comment","formatStr","decimalPlaces","cellType","isFilterHighlight","pivot"],this.isImport||(this.model.sheets.splice(0,0,{}),this._updateCellType());u<=this.model.sheetCount;)this.isImport||(this._dataContainer.sheets[u]={}),this._sheetSettings(u),this._newSIndex++,u++;this._detachTable=null;this._isPrint=!1;this._isSheetInsert=!1;this._isSheetRename=!1;this._isTableRename=!1;this._tableClassName=null;this._isSheetNavigate=!1;this._sheetCopy={isSheetCopy:!1,sheetContent:null};this._alertDialog={element:null,action:null};this._dataManager=null;this._isUndo=!1;this._undoCollection=[];this._redoCollection=[];this._ctrlKeyCount=0;this._formulaRange=[];this._formulaHeight=36;this._isSort=!1;this._isPaste=!1;this._isFATResize=!1;this._isDisplayHeader=!1;this._currencySymbol=f.currency.symbol||"$";this._percentSymbol=f.percent.symbol||"%";this._decimalSeparator=f["."]||".";this.operators={"<":function(n,t){return n<t},">":function(n,t){return n>t},">=":function(n,t){return n>=t},"<=":function(n,t){return n<=t},"==":function(n,t){return n===t},"!=":function(n,t){return n!==t},"!":function(n){return!n},"=":function(n){return n}};this.parse={parseInt:function(n){return parseInt(n)},parseFloat:function(n){return parseFloat(n)},parseDate:function(n){return new Date(n).getTime()},parseTime:function(n){return new Date("01/01/1990 "+n).getTime()},length:function(n){return n.charAt(0)==="^"?parseInt(n.split("^")[1]):n.length}};this._selMergeCells=[];this._mergeType="merge-cells";this._delCells=[];this._deletedText=[];this._removeMergeColl=[];this._insData={};this._deletedDimension=[];this._insDelStatus="";this._isUndoRedo=!1;this._indexBox=null;this._inputBox=null;this._focusTopElem=null;this._focusRightElem=null;this._focusBottomElem=null;this._focusLeftElem=null;this._dStartCell=i;this._dEndCell=i;this._pStartCell=i;this._pEndCell=i;this._pFillCell=i;this._borderFocus=["e-focusright","e-focusbottom"];this._cutFocus=["e-cutright","e-cutbottom"];this._autoFillFocus=["e-autofillright","e-autofillbottom"];this._formulaBorder=[["e-bborderright","e-bborderbottom"],["e-rborderright","e-rborderbottom"],["e-vborderright","e-vborderbottom"],["e-gborderright","e-gborderbottom"],["e-pborderright","e-pborderbottom"],["e-oborderright","e-oborderbottom"]];this._ctrlFormulaBorder=[["e-bctrlborderright","e-bctrlborderbottom"],["e-rctrlborderright","e-rctrlborderbottom"],["e-vctrlborderright","e-vctrlborderbottom"],["e-gctrlborderright","e-gctrlborderbottom"],["e-pctrlborderright","e-pctrlborderbottom"],["e-octrlborderright","e-octrlborderbottom"]];this._borderTypes=[{id:"bottomborder",text:this._getLocStr("BottomBorder"),parentId:null,sprite:"e-icon e-ss-bottomborder"},{id:"topborder",text:this._getLocStr("TopBorder"),parentId:null,sprite:"e-icon e-ss-topborder"},{id:"leftborder",text:this._getLocStr("LeftBorder"),parentId:null,sprite:"e-icon e-ss-leftborder"},{id:"rightborder",text:this._getLocStr("RightBorder"),parentId:null,sprite:"e-icon e-ss-rightborder"},{id:"noborder",text:this._getLocStr("NoBorder"),parentId:null,sprite:"e-icon e-ss-noborder"},{id:"allborder",text:this._getLocStr("AllBorder"),parentId:null,sprite:"e-icon e-ss-allborder"}];this._datePattern=["year","month","day","hours","minutes","seconds"];this._styleColl={};this._borderStyle="solid";this._borderColor="#000000";this._borderStyles=["solid","dashed","dotted"];this._ddlCell=null;this._cOpt={};this._shapeChange=!1;this._dupDetails=!1;this._paste=!1;this._autoFillElem=null;this._autoFillOptElem=null;this._fillOptionMenuData=[{id:"copycells",text:r[0],parentId:null,sprite:"e-icon e-ss-fillselect"},{id:"fillseries",text:r[1],parentId:null,sprite:"e-icon e-ss-filloption"},{id:"fillformattingonly",text:r[2],parentId:null,sprite:"e-icon e-ss-filloption"},{id:"fillwithoutformatting",text:r[3],parentId:null,sprite:"e-icon e-ss-filloption"},{id:"flashfill",text:r[4],parentId:null,sprite:"e-icon e-ss-filloption"}];this._formulaSuggElem=null;this._isFormulaSuggestion=!1;this._shiftKeyEnabled=!1;this._preventctrlkey=!1;this._rAlign="e-ralign";this._cAlign="e-calign";this._chartBorder=[["e-rcbright","e-rcbbottom"],["e-vcbright","e-vcbbottom"],["e-bcbright","e-bcbbottom"]];this._selectionBorder=["e-selecttop","e-selectright","e-selectbottom","e-selectleft"];this._autofillBorder=["e-autofilltop","e-autofillright","e-autofillbottom","e-autofillleft"];this._thinBorder=["e-thinright","e-thinbottom"];this._rcRegx=new RegExp("\\be-rc.*\\b","g");this._formatRegx=new RegExp("\\be-format.*?\\b","g");this._borderRegx=new RegExp("\\be-border.*?\\b","g");this._formulaChanged=[];this._ref=[];this._prevText="";this._prevVal="";this._dlgHLClick=!1;this._selectDataval={};this._undoInputobj={};this._cureditedCell="";this._colHeaderHeight=22;this._rowHeaderWidth=30;this._scrollerHeight=18;this._scrollerWidth=18;this._bufferCnt=5;this._maxRowCnt=1048576;this._maxColCnt=16384;this._impData=this._impData||null;this._isNew=!1;this._isSheetReq=!1;this._intrnlReq=!1;this._isFilterApplied=!1;this._commentCount=0;this._tableCnt=1;this._uploadImage=!1;this._responsiveWidth=0;this._responsiveHeight=0;this._celltypes=[];this._reqCnt=0;this._resCnt=0;this._pageClickArgs=null;this._gotoPageArgs=null;this._updateFormulaCollection();this._isRibbonClick=!1;this._intrnlUpdate=!1;this._isPvtNameEdit=!1;this._hlColor="#428bca";this._isFilter=!1;this._isShowHide=!1;this._insRows={};this._isTotalRow=!1;this._scrollReverse=!1;this._phoneMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth<420;this._tabMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth>419&&document.documentElement.clientWidth<617;this._dlgHeight=this._responsiveHeight-2;this._dlgWidth=this._responsiveWidth-2;this._isTouchEvt=!1;this._isTouchMoveSel=!1;this._isTouchScroll=!1;this._startXY=null;this._touchArgs=null;this._isResized=!1;this._isRibbonDestroyed=!1;this._resizeColl=[];this._delWrapColl={};this._fRowHtColl={};this._isInsdel=!1;this._canOverflow=!0;this.preventFilterPopup=!1;this._FATStyles={};this._isFiltered=!1;this._dautoFillCell={rowIndex:0,colIndex:0};this._isPublic=!1;this._fRow={rowAdj:!0,fRowCnt:0};this._fCol={colAdj:!0,fColCnt:0};this.isPasteValuesOnly=!1;this._isSaveAsJSON=!1},_initFATProps:function(){var o,g,t="w:bold",i="c:#FFFFFF",n="c:#000000",l="c:#2F75B5",a="c:#ED7D31",v="c:#FFC000",r="1px solid #000000",u="1px solid #2f75b5",f="1px solid #ED7D31",e="1px solid #FFC000",y="b:#D9D9D9",s="b:#DDEBF7",p="b:#FCE4D6",w="b:#FFF2CC",nt="b:#000000",tt="b:#FFE2C6",it="b:#FFF1BF",h="b:#000000",rt="b:#D7D7D7",b="b:#FFC000",k="b:#5B9BD5",ut="b:#Ed7D31",d="hl?"+t+";"+n+";bo:tb-"+r+"&cl?"+y+";"+n+","+n+"&cb?b-"+r+"/hl?"+t+";bo:tb-"+u+";"+l+"&cl?"+s+";"+l+","+l+"&cb?b-"+u+"/hl?"+t+";bo:tb-"+f+";"+a+"&cl?"+p+";"+a+","+a+"&cb?b-"+f+"/hl?"+t+";bo:tb-"+e+";"+v+"&cl?"+w+";"+v+","+v+"&cb?b-"+e+"/hl?"+t+";"+nt+";"+i+";bo:o-"+r+"&cl?bo:t-"+r+";"+n+"&cb?o-"+r+"/hl?bo:o-"+u+";"+t+";"+k+";"+i+"&cl?bo:t-"+u+";"+n+"&cb?o-"+u+"/hl?"+t+";b:#EB7E2F;"+i+";bo:o-"+f+"&cl?bo:t-"+f+";"+n+"&cb?o-"+f+"/hl?"+t+";"+b+";"+i+";bo:o-"+e+"&cl?bo:t-"+e+";"+n+"&cb?o-"+e+"/hl?"+t+";bo:gb-"+r+";"+n+"&cl?"+y+";"+n+","+n+"&cb?gb-"+r+"/hl?"+t+";bo:gb-"+u+";"+n+"&cl?"+s+";"+n+","+n+"&cb?gb-"+u+"/hl?"+t+";bo:gb-"+f+";"+n+"&cl?"+p+";"+n+","+n+"&cb?gb-"+f+"/hl?"+t+";bo:gb-"+e+";"+n+"&cl?"+w+";"+n+","+n+"&cb?gb-"+e+"/hl?"+t+";"+nt+";"+i+"&cl?b:#A6A6A6;"+n+","+y+";"+n+"/hl?"+t+";"+k+";"+i+"&cl?b:#BDD7EE;"+n+","+s+";"+n+"/hl?"+t+";"+ut+";"+i+"&cl?b:#F8CBAD;"+n+","+p+";"+n+"/hl?"+t+";"+b+";"+i+"&cl?b:#FFE699;"+n+","+w+";"+n+"/hl?"+t+";"+rt+";"+n+";bo:gb-"+r+"&cl?b:#A7A7A7;"+n+","+rt+";"+n+"&cb?gb-"+r+"/hl?"+t+";b:#DBECF6;"+n+";bo:gb-"+u+"&cl?b:#BED8F1;"+n+","+s+";"+n+"&cb?gb-"+u+"/hl?"+t+";"+tt+";"+n+";bo:gb-"+f+"&cl?b:#F6CAAD;"+n+","+tt+";"+n+"&cb?gb-"+f+"/hl?"+t+";"+it+";"+n+";bo:gb-"+e+"&cl?b:#FDE18D;"+n+","+it+";"+n+"&cb?gb-"+e+"/hl?"+t+";"+h+";"+i+"&cl?b:#404040;"+i+",b:#737373;"+i+"/hl?"+t+";"+h+";"+i+"&cl?b:#2F75B5;"+i+","+k+";"+i+"/hl?"+t+";"+h+";"+i+"&cl?b:#C65911;"+i+","+ut+";"+i+"/hl?"+t+";"+h+";"+i+"&cl?b:#BF8F00;"+i+","+b+";"+i,c=["Light1","Light2","Light3","Light5","Light8","Light9","Light10","Light12","Light15","Light16","Light17","Light19","Medium8","Medium9","Medium10","Medium12","Medium22","Medium23","Medium24","Medium26","Dark1","Dark2","Dark3","Dark5"];for(d=d.split("/"),o=0,g=c.length;o<g;)this._FATStyles["TableStyle"+c[o]]={format:this.XLRibbon._getFormatAsTableInput(d[o]),formatName:"TableStyle"+c[o]},o++;this.XLFormat._formatAsTableStyle=this._FATStyles["TableStyle"+c[0]]},_updateResponsiveSettings:function(){var i=t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0",n=this.element[0].getClientRects()[0];this._responsiveHeight=Math.floor(i?this.element[0].offsetHeight:n?n.height:0);this._responsiveWidth=Math.floor(i?this.element[0].offsetWidth:n?n.width:0)},_getElementDimension:function(){var f=0,t,e=0,o=0,i,r,u;return this.model.showRibbon&&(i=n("#"+this._id+"_Ribbon").data("ejRibbon"),t=i.element[0].offsetWidth,f=i.element[0].offsetHeight),this.model.allowFormulaBar&&(r=n("#"+this._id+"_formulabar")[0],e=r.offsetHeight,t||(t=r.offsetWidth)),u=this.element.find(".e-spreadsheetmainpanel")[0],o=u.offsetHeight,t||(t=u.offsetWidth),{width:t+2,height:f+e+o+1}},_sheetSettings:function(i){var o,f,u,s,c,r,e,l,h;if(this._isSheetReq?f=this.getSheet(i):(r=this.getSheet(i),c=this._generateSheetName(this._newSIndex),f=this.model.sheets[i]={colCount:r&&r.colCount||this.model.columnCount,rowCount:r&&r.rowCount||this.model.rowCount,_formulaCollection:{},columnsWidthCollection:[],_colWidthCollection:[],_ofColWidthColl:[],rowsHeightCollection:[],_rowHeightCollection:[],_rowIdxColl:[],_spreadSheetPager:null,showHeadings:r&&!this.isUndefined(r.showHeadings)?r.showHeadings:!0,showGridlines:r&&!this.isUndefined(r.showGridlines)?r.showGridlines:!0,dataSource:r&&r.dataSource||null,_jsonData:r?r.dataSource instanceof t.DataManager?null:r.dataSource:null,_dataManager:r&&r.dataSource instanceof t.DataManager?r.dataSource:null,query:r&&r.query||null,primaryKey:r&&r.primaryKey||"",startCell:r&&r.startCell||"A1",topLeftCell:r&&r.topLeftCell||"A1",fieldAsColumnHeader:r&&r.fieldAsColumnHeader||!1,showHeader:r&&r.showHeader===!1?!1:!0,headerStyles:r&&r.headerStyles||null,batchChanges:{added:[],changed:[],deleted:[]},range:[0,0,0,0],fields:[],_isDataManager:!1,_isOffline:!1,_hasDataSrc:!1,columns:r&&r.columns||[],_columnStyles:{},_rowStyles:{},cellTypes:r&&r.cellTypes||[],rows:r&&r.rows||null,_excelFilter:null,filterSettings:{filteredColumns:[],maxFilterChoices:1e3,filteredRange:[],range:"",tableRange:[]},frozenRows:r&&r.frozenRows||0,frozenColumns:r&&r.frozenColumns||0,_frozenRows:r&&r.frozenRows&&r.frozenRows+1||1,_frozenColumns:r&&r.frozenColumns&&r.frozenColumns+1||1,paneTopLeftCell:r&&r.paneTopLeftCell||"A1",_selectedRange:{},_selectedCellColors:[],columnWidth:r&&r.columnWidth||this.model.columnWidth,rowHeight:this.model.rowHeight,_frozenHeight:0,_frozenWidth:0,_firstRow:{idx:0,value:0},_firstCol:{idx:0,value:0},_topRow:{idx:0,value:0},_bottomRow:{idx:0,value:0},_leftCol:{idx:0,value:0},_rightCol:{idx:0,value:0},_filterColl:{},_filteredColumns:[],_commentColl:{},_mergeColl:{},_unmergeColl:{},_delmergeColl:{},_hideMergeColl:{},_clrMergeColl:[],_clrWrapColl:[],_selectedCells:[],selectedRange:[0,0,0,0],tableManager:{},_header:{},_selectedCellIndexes:[],_startCell:{rowIndex:0,colIndex:0},_endCell:{rowIndex:0,colIndex:0},_activeCell:{rowIndex:0,colIndex:0},_autoFillCell:{rowIndex:0,colIndex:0},rangeSettings:r&&r.rangeSettings||[],sheetInfo:{text:c,value:this._getLocStr("Sheet")+this._newSIndex,isVisible:!0},_multipleFiltering:!1,_multifilterIdx:[],_filteredByColor:"",staticWidth:0,_fRow:0,_fCol:0,hideColsCollection:{},hideRowsCollection:r&&r.hideRowsCollection||[],_hiddenFreezeRows:[],_hiddenFreezeCols:[],_filterHRowsColl:[],_restrictedHeightRows:[],filteredRowsCollection:[],_rHeightCollection:[],_frHiddenHeight:0,_fpHiddenHeight:0,_fpHiddenWidth:0,_pTarget:{},_cSpan:1,_rSpan:1,usedRange:{rowIndex:0,colIndex:0},mergedCells:[],shapeMngr:{picture:{},chart:{},sharedPics:[]},pivotMngr:{pivot:{}},_nmValue:{},_nmEdit:!1,_wrapHtCollection:{},_isChartBorderDrawn:!1,_virtualBlockCnt:0,_virtualBlockRowCnt:0,_virtualContBlockIdx:1,_virtualTopTBodyHgt:0,_virtualBottomTBodyHgt:0,_virtualTBodyHgt:0,_scrollTop:0,_scrollLeft:0,_virtualRowIdx:[],_virtualTopTBodyOffset:{top:0,bottom:0},_virtualContTBodyOffset:{top:0,bottom:0},_virtualBottomTBodyOffset:{top:0,bottom:0},_virtualDataLoadedBlks:[],_virtualDataMngrLoadedBlks:[1,2],_isVirtualTopReached:!0,_isVirtualEndReached:!1,_isLoaded:!1,_isImpSLoad:!1,_isRowSelected:!1,_isColSelected:!1,_isSheetSelected:!1,isSheetProtected:!1,_contWidth:0,_isRangeSelected:!1,_isEmptyActiveCell:!1,_isMultiSelect:!1,_isImported:this.isImport,_isRequested:!1,_goToCollection:{multiple:!1,selected:[]},_showLockCellAlert:!1,_reqCnt:0,_resCnt:0,_templateColCount:0,_isTemplate:!1,_cFormatFormula:{},_isVPRendered:!1,_isDataMoved:!1,_vPortHgt:0,_vPortWth:0,cFormatRule:r&&r.cFormatRule||[],mergeCells:r&&r.mergeCells||[],hideRows:r&&r.hideRows||[],hideColumns:r&&r.hideColumns||[],border:r&&r.border||[],isResized:!1,_isOpened:!1,_wrapColl:{},_isFreezed:!1,_ftopRowIdx:0,_fleftColIdx:0,_contScrollTop:0,_contScrollLeft:0,_fDivTop:0,_fDivLeft:0,_isRibCollapsed:!1},this._initRangeSettings(i),s=f.sheetInfo.value,psheet=this._sheets[i]={_contentColGroup:null,_content:null,_sheetRowHeaderContent:null,_sheetHeader:null,_sheetRowHeader:null,_sheetContent:null,_Rows:null,_contTBody:null,_rowHdrTBody:null},this._calcEngine.registerGridAsSheet(s,s,this._calcID)),this.isImport&&(u=this._impData.model.sheets[i],o=this.getRangeIndices(u.topLeftCell||"A1"),f.sheetInfo.text=u.sheetInfo.text,f.sheetInfo.isVisible=this.isUndefined(u.sheetInfo.isVisible)?!0:u.sheetInfo.isVisible,this.model.importSettings.allowSheetOnDemand&&i!==this.getActiveSheetIndex()||(f._isRequested=!0),f._isRequested)){if(u.usedRange&&(u.usedRange.rowIndex&&(f.usedRange.rowIndex=u.usedRange.rowIndex),u.usedRange.colIndex&&(f.usedRange.colIndex=u.usedRange.colIndex)),u._startCell&&(u._startCell.rowIndex&&(f._startCell.rowIndex=u._startCell.rowIndex),u._startCell.colIndex&&(f._startCell.colIndex=u._startCell.colIndex)),u._endCell&&(u._endCell.rowIndex&&(f._endCell.rowIndex=u._endCell.rowIndex),u._endCell.colIndex&&(f._endCell.colIndex=u._endCell.colIndex)),u._activeCell&&(u._activeCell.rowIndex&&(f._activeCell.rowIndex=u._activeCell.rowIndex),u._activeCell.colIndex&&(f._activeCell.colIndex=u._activeCell.colIndex)),u.columnsWidthCollection&&(f.columnsWidthCollection=u.columnsWidthCollection),u.rowsHeightCollection){for(h=u.hideRowsCollection||[],e=0,l=h.length;e<l;e++)u.rowsHeightCollection[parseInt(h[e])]=0;f.rowsHeightCollection=n.extend(!0,[],u.rowsHeightCollection)}t.isNullOrUndefined(u.showGridlines)||(f.showGridlines=u.showGridlines);u.hideRowsCollection&&(f.hideRowsCollection=u.hideRowsCollection||[]);u.shapeMngr.picture.length&&(f.shapeMngr.sharedPics=u.shapeMngr.sharedPics);u.isSheetProtected&&(f.isSheetProtected=u.isSheetProtected);u._restrictedHeightRows&&(f._restrictedHeightRows=u._restrictedHeightRows||[]);u._isColSelected&&(f._isColSelected=u._isColSelected);u._isRowSelected&&(f._isRowSelected=u._isRowSelected);u.showHeadings===!1&&(f.showHeadings=!1);u.frozenRows&&(f.frozenRows=f._frozenRows=o[0]+u.frozenRows,f._frozenRows=f.frozenRows+1);u.frozenColumns&&(f.frozenColumns=f._frozenColumns=o[1]+u.frozenColumns,f._frozenColumns=f.frozenColumns+1)}},_generateSheetName:function(n){var t,f,r,o=1,u=this.model.sheets,e=this._getLocStr("Sheet"),i=u[n];for(r=i&&i.sheetName||e+n,t=1,f=u.length;t<f;t++)u[t].sheetInfo&&r===u[t].sheetInfo.text&&(t=0,r=i&&i.sheetName?i.sheetName+o++:e+ ++n);return r},_initRangeSettings:function(n){var i,u=this.getSheet(n),r=u.rangeSettings.length;if(r)while(r--)i=u.rangeSettings[r],i.dataSource&&(i._jsonData=i._dataManager=null,i.dataSource instanceof t.DataManager?i._dataManager=i.dataSource:i._jsonData=i.dataSource,i.showHeader!=!1&&(i.showHeader=!0))},_initCSSTag:function(){if(!document.getElementById(this._id+"_sscustomformat")){this.isImport&&(this._dataContainer.hashCode=[]);var n,r,i=0,t;if(t=this._renderStyleTag("custom"),this.isImport)this._refreshImpStyles(this._impData.dataContainer.hashCode);else if(this.XLFormat)for(n="s:11pt/b:#FFC7CE;c:#82012A;f:calibri;s:11pt/b:#C6EED2;c:#0A7043;f:calibri;s:11pt/b:#FEEC9B;c:#826717;f:calibri;s:11pt/f:Calibri;w:bold;v:top;s:11pt/f:calibri;s:18pt/b:#DDE5F6;f:calibri;s:11pt/b:#FDE0D2;f:calibri;s:11pt/b:#EEEEEC;f:calibri;s:11pt/b:#FEF4CD;f:calibri;s:11pt/b:#9CC0E7;f:calibri;s:11pt/b:#F9AD7B;f:calibri;s:11pt/b:#C9C9C9;f:calibri;s:11pt/b:#FED965;f:calibri;s:11pt/b:#559AD9;c:#FFFFFF;f:calibri;s:11pt/b:#EB7E2F;c:#FFFFFF;f:calibri;s:11pt/b:#A5A5A5;c:#FFFFFF;f:calibri;s:11pt/b:#FDBF01;c:#FFFFFF;f:calibri;s:11pt".split("/"),r=n.length;i<r;)this.XLFormat._createFormatClass(this._getStyleAsJSON(n[i]),null,!0),i++;n=".e-spreadsheet .e-hide, .e-spreadsheet .e-mc-hide, .e-spreadsheet .e-fr-hide, .e-spreadsheet .e-fc-hide, .e-spreadsheet .e-c-hide, .e-spreadsheet .e-r-hide, .e-spreadsheet .e-col-hide{ display: none}";n+=".e-spreadsheet .e-rowcell.e-redft { background-color: #FFC7CE; color: #9C0055;} .e-spreadsheet .e-rowcell.e-yellowft { background-color: #FFEB9C; color: #9C6500;}";n+=".e-spreadsheet .e-rowcell.e-greenft { background-color: #C6EFCE; color: #006100;} .e-spreadsheet .e-rowcell.e-redf { background-color: #FFC7CE;} .e-spreadsheet .e-rowcell.e-redt { color: #9C0055;}";n+=".e-spreadsheet .e-rowcell.e-hlcell { background-color: #FFFF00; color: #FF0000;} .e-spreadsheet .e-rowcell.e-goto-blank { background-color: #C6C6C6;}";t.styleSheet?t.styleSheet.cssText+=n:t.appendChild(document.createTextNode(n))}this._renderStyleTag("showhide")},_initEditForm:function(){var n,i,r;n=t.buildTag("input","",{display:"none"},{id:this._id+"_AutoComplete"});n.addClass("e-hide");this.element.append(n);this.XLEdit._renderAutoComplete(n,"",null,!0);n.data("ejAutocomplete")._setListPosition=function(){};i=t.buildTag("form","",{width:1,height:1,display:"none"},{id:this._id+"EditForm"});r=t.buildTag("input","",{width:1,height:1,overflow:"hidden",opacity:0},{id:this._id+"_ValElem"});i.append(r);r.data("id",this._id);this.element.append(i)},_getStyleAsJSON:function(n){var t,i=0,r={},u={b:"background-color",c:"color",f:"font-family",s:"font-size",w:"font-weight",v:"vetical-align",bo:"border"};for(n=n.split(";"),len=n.length;i<len;)t=n[i].split(":"),r[u[t[0]]]=t[0]==="bo"?this.XLRibbon._getBorderObj(t[1].split("-")[0],t[1].split("-")[1]):t[1],i++;return r},_initLayout:function(){this.model.showRibbon&&(this.XLRibbon._renderRibbon(),this._tabMode&&n("#"+this._id+"_Ribbon").ejRibbon("collapse"));this.model.allowFormulaBar&&this._renderFormulaBar();this._renderFUpload();this._renderLayout()},_renderLayout:function(){var n,t;for(this._renderPanel(),this._initTags(),this._initDependencies(),this._renderFooter(),this._refreshSheetLayout(),this.model.scrollSettings.allowVirtualScrolling||this.model.scrollSettings.allowSheetOnDemand?n=t=this.getActiveSheetIndex():(n=1,t=this.model.sheetCount);n<=t;)this._initSheet(n),n++},_renderPanel:function(){var i,n,r=this.model.scrollSettings;i=t.buildTag("div.e-spreadsheetgrppanel","",{},{id:this._id+"GroupPanel"});this.setGroupPanel(i);n=t.buildTag("div.e-spreadsheetmainpanel",this._renderDIV("e-spreadsheet-list",""),{},{id:this._id+"MainPanel"});i.append(n);this.setMainPanel(n);n=t.buildTag("div.e-spreadsheetactpanel","",{height:r.height,width:this.model.activationPanelWidth-1,display:"none"},{id:this._id+"ActivationPanel"});i.append(n);this.setActivationPanel(n);this.element.append(i)},_refreshSheetLayout:function(){var t,i=-1,r=this.model.pageSettings.pagerHeight+1;this._updateResponsiveSettings();this.XLRibbon._ribbonState&&(i=n("#"+this._id+"_Ribbon").find(".e-content:eq(1)").height());t=this._phoneMode?n("#"+this._id+"_Ribbon").height():n("#"+this._id+"_Ribbon").find(".e-header").height()+i+2;formulaHeight=this.model.allowFormulaBar?this._formulaHeight:0;ribbonHeight=t&&this.model.showRibbon&&n("#"+this._id+"_Ribbon").is(":visible")?t:0;this.model.showPager&&this.element.find(".e-spreadsheetfooter").is(":visible")||(r=1);contentHt=this._responsiveHeight-(ribbonHeight+formulaHeight+2);this._browserDetails.name=="msie"||this._isAutoWHMode||this.element.find(".e-spreadsheet-list").height(contentHt-r)},_initTags:function(){var n=t.buildTag("span#"+this._id+"_emptySpan"),i=t.buildTag("div#"+this._id+"_emptyDiv");this.element.find(".e-spreadsheetmainpanel")[0].insertBefore(n[0],this.element.find(".e-spreadsheetmainpanel").find(".e-spreadsheet-list")[0]);this.element.find(".e-spreadsheetmainpanel")[0].insertBefore(i[0],this.element.find(".e-spreadsheetmainpanel").find(".e-spreadsheet-list")[0]);this._refreshGlobalSpan()},_refreshGlobalSpan:function(t,i){t=t||document.getElementById(this._id+(i?"_emptyDiv":"_emptySpan"));t.textContent=t.className="";this._browserDetails.name==="msie"&&this._browserDetails.version==="8.0"?n(t).removeAttr("style").text(""):t.style=""},_initSheet:function(n){var u,t=0,i=this.getSheet(n),r=this.getDataSettings(n);if(this._updateResponsiveSettings(),this._initViewPort(n),r&&!this._sheetCopy.isSheetCopy)for(u=r.length;t<u;)this._initDataSrc(n,i,r[t]),t++;i._reqCnt===i._resCnt&&this._renderSheet(n)},_initViewPort:function(t){var r=-1,u=ribbonHgt=scrollerHgt=scrollerWth=colHdrHgt=rowHdrWth=formulaHgt=0,f=this.model.scrollSettings,i=this.getSheet(t);f.allowScrolling&&(scrollerHgt=this._scrollerHeight,scrollerWth=this._scrollerWidth);i.showHeadings&&(colHdrHgt=this._colHeaderHeight,rowHdrWth=this._rowHeaderWidth);this.model.showRibbon&&(ribbonHgt=n("#"+this._id+"_Ribbon").height(),ribbonHgt=ribbonHgt<189?ribbonHgt:188);this.model.allowFormulaBar&&(formulaHgt=this._formulaHeight);this.model.showPager&&this.element.find(".e-spreadsheetfooter").is(":visible")&&(r=this.model.pageSettings.pagerHeight);this.getActivationPanel().is(":visible")&&(u=this.getActivationPanel().width());i._vPortHgt=this._responsiveHeight-(ribbonHgt+formulaHgt+colHdrHgt+r+scrollerHgt);i._vPortWth=this._responsiveWidth-(u+scrollerWth+rowHdrWth);f.allowVirtualScrolling&&(i._virtualBlockRowCnt=Math.ceil(i._vPortHgt/i.rowHeight)+this._bufferCnt)},_initDataSrc:function(n,i,r){if(r._dataManager){if(r._dataManager instanceof t.DataManager)if(r._dataManager.ready){var u=this;i._reqCnt++;this._reqCnt++;r._dataManager.ready.done(function(){u._initDataMngr(n,i,r)})}else this._initDataMngr(n,i,r)}else r._jsonData&&(r.count=r._jsonData.length)},_initDataMngr:function(n,i,r){var u,f,h,s,c,e,o=0,l=this;if(r._isDataManager=!0,r._isOffline=r._dataManager.dataSource.offline,r.query||(r.query=new t.Query),r.query.requiresCount(),this.model.scrollSettings.allowVirtualScrolling){if(s=r.query.queries,u=s.length,u)while(u--)f=s[u],f.fn==="onTake"?(o=f.e.nos,s.splice(u,1)):f.fn==="onSkip"&&(r._skip=f.e.nos);e=i._virtualBlockRowCnt*2;r.startCell&&(h=this.getRangeIndices(r.startCell),h[0]&&(e-=h[0]-0));o&&o<e&&(e=o);r.query.take(e)}c=r._dataManager.executeQuery(r.query);c.done(function(t){u=t.count||t.result.length;u&&(r._jsonData=t.result,r.count=o||u);l._respHandler(n)});c.fail(function(){l._respHandler(n)});r._dataManager.isDataAvailable||(i._reqCnt++,this._reqCnt++)},_respHandler:function(n){var t=this.getSheet(n);t._resCnt++;this._resCnt++;t._reqCnt===t._resCnt&&this._renderSheet(n);this._initComplete()},_renderSheet:function(i){var u,e,c,o,f=this.getActiveSheetIndex(),r=this.getSheet(i),l=r.sheetInfo.value,s={},h=this.element.find("#"+this._id+"_"+l);this._resizeColl[i-1]=!1;this._isInitLoad&&this._trigger("load",{sheetIndex:i});this._initTmplColumns(i);u=h.length===1?h:t.buildTag("div.e-sheet e-hide ","",{},{id:this._id+"_"+l});u.append(this._renderContent(i));h.length||(this.model.allowFreezing&&(o=this.XLFreeze._getHFreeze()),o?o.before(u):this.element.find(".e-spreadsheet-list").append(u));r.showGridlines===!1&&n("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").ejCheckBox({checked:r.showGridlines});this.model.enableContextMenu&&(this.XLCMenu._initContextMenu(),this.XLCMenu._initColorDialog(),this.XLCMenu._initCMenuFooter());this._updateResponsiveSettings();this._removeClass(u,"e-hide");s.width=this._responsiveWidth;s.height=this._responsiveHeight;this.model.showRibbon&&!this._isAutoWHMode&&(this._tabMode||this._responsiveHeight<280)&&n("#"+this._id+"_Ribbon").ejRibbon("collapse");this._setSheetWidthHeight(i,s,null,"refresh","initial");this._refreshCellBinding(i);this._refreshImpResRowHght(i);this.refreshContent(i);i===f&&this._updateHiddenRows(f);this._initializePicture(i);this.isImport&&this.model.allowCellType&&this.model.allowAutoCellType&&this._celltypes.length&&this._processCellTypes(this._celltypes,i);this.model.allowCellType&&!this.model.scrollSettings.allowVirtualScrolling&&this.XLCellType._rangeCellTypes(r.cellTypes,i);r._isImported&&!this._sheetCopy.isSheetCopy&&(this.setActiveSheetIndex(i),this._refreshImpSheets(i),this.setActiveSheetIndex(f));i!==f?u.hide():this._initSelection();this._initSheetModel(i);this.isImport&&r._isFreezed&&(c=this._impData.model.sheets[i],e=this.getRangeIndices(c.paneTopLeftCell),this._isFrozen(r.frozenRows)&&this.XLScroll._vScroller(i).scroll(this._getRowOffsetTop(r,e[0])-r._frozenHeight),this._isFrozen(r.frozenColumns)&&this.XLScroll._hScroller(i).scroll(this._getColOffsetLeft(r,e[1])-r._frozenWidth));r._isLoaded=!0;!this._isSheetInsert&&(this._pageClickArgs||this._gotoPageArgs)&&this._pageLoadComplete(i);this.getSheet(f)._isOpened=!0;this.model.showRibbon&&(n("#"+this._id+"_Ribbon")[0].style.overflow==="hidden"&&(n("#"+this._id+"_Ribbon")[0].style.overflow="",this.model.showRibbon&&this.XLRibbon._refreshBackstageHeight()),r._isRibCollapsed=!this.XLRibbon._ribbonState);this._isAutoWHMode&&this._autoSSWidthHeight(i)},_initSheetModel:function(n){var u,f,e,o,r=this.getSheet(n),t=this.getFrozenRows(n),i=this.getFrozenColumns(n);r.showHeadings===!1&&this.showHeadings(r.showHeadings);this.isImport&&(o=this._impData.model.sheets[n],u=this.getRangeIndices(o.topLeftCell||"A1"));f=this.isImport?u[0]:this._isFrozen(t)&&r._bottomRow.idx<=t?t-1:0;e=this.isImport?u[1]:this._isFrozen(i)&&r._rightCol.idx<=i?i-1:0;this.model.scrollSettings.allowScrolling&&(f>0&&this.XLScroll._vScroller(n).scroll(this._getRowOffsetTop(r,f)),e>0&&this.XLScroll._hScroller(n).scroll(this._getColOffsetLeft(r,e)));this.model.allowFreezing&&(this._isFrozen(t)&&this._isFrozen(i)?this.XLFreeze.freezePanes(t,i):this._isFrozen(t)?this.XLFreeze._freeze(t):this._isFrozen(i)&&this.XLFreeze._freeze(null,i))},_initTmplColumns:function(n){var u,f,i,r,t=this.getSheet(n);if(!this._sheetCopy.isSheetCopy&&!t.rangeSettings.length&&t.dataSource&&t._jsonData&&t.fieldAsColumnHeader&&(r=t._jsonData[0],range=this.getRangeIndices(t.startCell),u=range[1]+1,r)){for(i in r)r.hasOwnProperty(i)&&(f=r[i],typeof r[i]=="object"&&(i=this._iterateComplxObj(r[i],i).prop),t.columns[u-1]={field:this._generateHeaderText(u),text:i,type:f!=null?f.getDay?"date":typeof f:null},u++);t.colCount=t._templateColCount=t.columns.length;t._isTemplate=!0}},_refreshCellBinding:function(n){var t,r,f,l=this.getSheet(n),e=l.mergeCells,o=l.hideRows,u,i,s,h,c;if(e.length)for(u=0,f=e.length;u<f;u++)for(i=this.getRangeIndices(e[u]),s=i[2]-i[0]+1,h=i[3]-i[1]+1,c,t=0;t<s;t++)for(r=0;r<h;r++)c=t==0&&r==0?{merge:{isMerge:!0,mRange:e[u],isCenterAlign:!1,mSpan:{colSpan:h,rowSpan:s}}}:{isMHide:!0,mergeIdx:{rowIndex:i[0],colIndex:i[1]}},this.XLEdit._updateDataContainer({rowIndex:i[0]+t,colIndex:i[1]+r},{dataObj:c,sheetIdx:n,skipCell:!0});if(o.length&&this.model.scrollSettings.allowVirtualScrolling)for(t=0,f=o.length;t<f;t++)this._cellBindHiddenRows(o[t],o,n)},_cellBindHiddenRows:function(n,t,i){var r,u,e=this.getSheet(i),f=this.XLEdit;e.hideRowsCollection.push(n);this.XLScroll._getRowHeights(i,t.sort()[0]);u=n===0?{rowIndex:n,colIndex:0}:{rowIndex:n-1,colIndex:0};r={rowIndex:n,colIndex:0};f._updateDataContainer(u,{dataObj:{hRow:!0},sheetIdx:i,skipCell:!0});f._updateDataContainer(r,{dataObj:{isRHide:!0},sheetIdx:i,skipCell:!0})},_updateHiddenRows:function(n){var i,r,h,u=this.getSheet(n),s=u.hideRows,f,l=u.cFormatRule,e,o=u.hideColumns,c=u.border;if(s.length&&!this.model.scrollSettings.allowVirtualScrolling)for(i=0,r=s.length;i<r;i++)f=s[i],h=this.getRows(n),rows=h[1],hdrRows=h[0],this.addClass(rows[f],"e-r-hide"),this.addClass(hdrRows[f],"e-r-hide"),f>0&&this.addClass(hdrRows.eq(f-1).find("td")[0],"e-hrow"),this._cellBindHiddenRows(f,s,n);if(o.length&&!this.model.scrollSettings.allowVirtualScrolling){for(i=0,r=o.length;i<r;i++)u.hideColsCollection[o[i]]||this._updateHiddenColumns({rowIndex:0,colIndex:o[i]},n);this.XLScroll._getColWidths(n,o.sort()[0])}if(!t.isNullOrUndefined(l)&&l.length)for(i=0,r=u.cFormatRule.length;i<r;i++)e=u.cFormatRule[i],this.XLCFormat._cFormat(e.action,e.inputs[0],e.inputs[1],e.color,e.range,n);if(c.length&&!this.model.scrollSettings.allowVirtualScrolling)for(i=0,r=c.length;i<r;i++)this._updateCellBorder(c[i],n)},_updateHiddenColumns:function(n,t){var h=n.rowIndex,i=n.colIndex,u=this.getSheet(t),f={isCHide:!0},r=this._getJSSheetHeader(t),e=r.find("th"),o=r.find("col"),s=this._getContent(t).find("col");u.hideColsCollection[i]=u.columnWidth;u.columnsWidthCollection[i]=0;i===0&&(f.hCol=!0);this._writeRule(i,t);this.addClass(e[i],"e-hide");this.addClass(o[i],"e-hide");this.addClass(s[i],"e-hide");r.find("th:eq("+(i-1)+")").hasClass("e-hide")||this.addClass(r.find("th:eq("+(i-1)+")")[0],"e-hcol");this.XLEdit._updateDataContainer({rowIndex:0,colIndex:i},{dataObj:f,sheetIdx:t,skipCell:!0});i>0&&this.isUndefined(this.XLEdit.getPropertyValue(0,i-1,"isCHide"))&&this.XLEdit._updateDataContainer({rowIndex:0,colIndex:i-1},{dataObj:{hCol:!0},sheetIdx:t,skipCell:!0})},_renderContent:function(n){var r=[],i=t.buildTag("div.e-spreadsheetheader"),o=t.buildTag("div.e-headercontent"),h=t.buildTag("div.e-spreadsheetcolumnheader e-icon e-ss-selectall e-ss-cursor","",{},{}),u=t.buildTag("div.e-spreadsheetcontentcontainer","",{"-webkit-tap-highlight-color":"rgba(0,0,0,0)"}),s=t.buildTag("div.e-content e-ss-cursor"),f=t.buildTag("div.e-spreadsheetrowheader","",{float:"left",width:"30px"},{}),e=t.buildTag("div.e-rowheadercontent");return this._isAutoWHMode&&(s.addClass("e-rmvbtmbdr"),o.addClass("e-rmvrghtbdr"),e.addClass("e-rmvbtmbdr")),this._setJSSheetHeader(i,n),i.append(h),i.append(o),r.push(i),i=t.buildTag("div.e-spreadsheetcontent"),this._setJSSheetContent(i,n),this._setContent(u,n),this._setJSSheetRowHeader(f,n),this._setJSSheetRowHeaderContent(e,n),f.append(e),u.append(s),i.append(f),i.append(u),r.push(i),r},refreshContent:function(n){n=n||this.getActiveSheetIndex();var t,i,e=this.getSheet(n),u=this.model.scrollSettings,f=u.allowVirtualScrolling,r=this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content");this._initDataRange(n);this._refreshRowColCnt(n);this._getJSSheetHeader(n).find(".e-headercontent").html(this._renderHeaderColumns(n));this._refreshTemplates(n);this._getJSSheetRowHeaderContent(n).html(this._renderHdrRows(n));r.find(".e-table").remove();r.prepend(this._renderContTable(n));this._initViewPortCont(n);this._isAutoWHMode?this._isInitLoad||this._autoSSWidthHeight(n):this.XLScroll._refreshScroller(n,"refresh","all");f||(this.XLScroll._getFirstRow(n),this.XLScroll._getFirstColumn(n));t=this._getContTBody(n).find("tr");i=this._getRowHdrTBody(n).find("tr");this.setRows([i,t],n)},_autoSSWidthHeight:function(t,i){var r={},f=this.model.scrollSettings,u=n("#"+this._id+"_Ribbon").data("ejRibbon");t=t||this._getSheetIndex();this._responsiveWidth=this._dlgWidth=r.width=this._getContTBody(t).width()+this._getJSSheetRowHeader(t).width();this._responsiveHeight=this._dlgHeight=r.height=this.element.height();this.model.showRibbon&&r.width<=480?(r.width=480,this._getContent(t).find(".e-content").removeClass("e-rmvrghtbdr")):i||this._getContent(t).find(".e-content").addClass("e-rmvrghtbdr");i||this._setSheetWidthHeight(t,r,null,"refresh");this.model.showRibbon&&(r.width<=480&&this._alignFormulaBar(r.width),this.XLRibbon._refreshBackstageHeight(),u.setModel({width:r.width}))},_initDataRange:function(n){var c,r,t,e,o,u,f,s=0,i=this.getSheet(n),h=this.getDataSettings(n);if(h)for(c=h.length;s<c;)t=h[s],t._jsonData&&(t.batchChanges={added:[],changed:[],deleted:[]},t.fields=this.getObjectKeys(t._jsonData[0]),r=t.startCell?this._toIntrnlRange(t.startCell,n):[0,0,0,0],r[2]=r[0]+(!t.fieldAsColumnHeader&&t.showHeader?t.count:t.count-1),r[3]=r[1]+this.getObjectLength(t._jsonData[0])-1,t.range=r,u=r[2],f=r[3],(this._isAutoWHMode||i.usedRange.rowIndex<u)&&(i.usedRange.rowIndex=u),(this._isAutoWHMode||i.usedRange.colIndex<f)&&(i.usedRange.colIndex=f),e=u+1,o=f+1,(this._isAutoWHMode||i.rowCount<e)&&(i.rowCount=e),(this._isAutoWHMode||i.colCount<=o)&&(i.colCount=o),i._hasDataSrc=!0),s++},_renderStyleTag:function(n){var i,t;return i=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0],t=document.createElement("style"),t.type="text/css",n=="custom"?(t.setAttribute("id",this._id+"_sscustomformat"),i.appendChild(t)):n!=="showhide"||document.getElementById(this._id+"_sshide")||(t.setAttribute("id",this._id+"_sshide"),i.appendChild(t)),t},_renderHeaderColumns:function(n){var u,i,f,r,e=document.createElement("thead");return r=this._renderHeaderCol(n,0,this.getSheet(n).colCount),i=t.buildTag("table.e-table","",this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal?{width:this._getEntireColWidth(n)}:{},{cellspacing:"0.25px"})[0],f=r[1],u=r[0],e.appendChild(u),i.appendChild(f),i.appendChild(e),i},_renderHeaderCol:function(n,i,r){var e,h,c,b,l,a,v,y,o,s=0,p=[],f=i,u=this.getSheet(n),w=document.createElement("tr"),k=document.createElement("colgroup");for(w.className="e-columnheader",this.isImport||(u._colWidthCollection.length=0,u._ofColWidthColl.length=0),u._colWidthCollection.push(s),u._ofColWidthColl.push(s);f<r;)e="e-headercell",l="col",o=u.columnsWidthCollection[f],this.isUndefined(o)&&(o=u.columnsWidthCollection[f]=u.columnWidth),f!=r-1&&(s=u._colWidthCollection[u._colWidthCollection.length-1]+o,u._colWidthCollection.push(s),u._ofColWidthColl.push(s)),this.model.allowSelection&&this._inColumn(u.selectedRange,f)&&(e+=" e-colhighlight",u._isColSelected&&(e+=" e-colselected")),o<1?(l+=".e-hide",e+=" e-hide"):u._hiddenFreezeCols.indexOf(f)>-1&&(l+=".e-fcol-hide",e+=" e-fcol-hide"),(this.IsImport||u._isLoaded)&&this.XLEdit.getPropertyValue(0,f,"hCol")&&(e+=" e-hcol"),h=document.createElement("th"),h.className=e,a=v=this._generateHeaderText(f+1),u.fieldAsColumnHeader&&u.columns[f]&&(a=u.columns[f].text),c=document.createElement("div"),c.className="e-headercelldiv",c.innerHTML=a,h.appendChild(c),b=t.buildTag(l,"",{width:o},{}),w.appendChild(h),k.appendChild(b[0]),this._sheetCopy.isSheetCopy||u.columns[f]||(u.columns[f]={field:v,text:v,type:y!=null?y.getDay?"date":typeof y:null}),f++;return p.push(w),p.push(k),p},_getWidth:function(n,t,i){for(var r=0,u=this.getSheet(i);n<=t;n++)r+=u.columnsWidthCollection[n];return r},_getEntireColWidth:function(n){var t=this.getSheet(n),i=this._getIdxWithOffset(null,this._getLastColIdx(t)).xOffset;return i+t.columnsWidthCollection[t.columnsWidthCollection.length-1]},_getLastColIdx:function(n){for(var t=n.colCount-1;t>-1;){if(!(t in n.hideColsCollection)&&n._hiddenFreezeCols.indexOf(t)===-1)break;t--}return t},_getIdxWithOffset:function(n,i,r,u,f){u=u||[];var s,h,a,e=idx=pos=offset=0,l={},c=t.Spreadsheet.HideTypes,o=this.getSheet(f);if(!t.isNullOrUndefined(n)){if(r)for(a=o.rowsHeightCollection.length;e<a;){if(s=h=!1,u.indexOf(c.Default)===-1&&o.hideRowsCollection.indexOf(e)>-1&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeRows.indexOf(e)>-1&&(h=!0),!s&&!h){if(pos+=o.rowsHeightCollection[e],pos>n){idx=e;break}offset=pos}e++}else{while(e<n)s=h=!1,u.indexOf(c.Default)===-1&&o.hideRowsCollection.indexOf(e)>-1&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeRows.indexOf(e)>-1&&(h=!0),s||h||(offset+=o.rowsHeightCollection[e]),e++;idx=n}l.rowIdx=idx;l.yOffset=offset}if(!t.isNullOrUndefined(i)){if(r)for(e=idx=pos=offset=0,a=o.columnsWidthCollection.length;e<a;){if(s=h=!1,u.indexOf(c.Default)===-1&&e in o.hideColsCollection&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeCols.indexOf(e)>-1&&(h=!0),!s&&!h){if(pos+=o.columnsWidthCollection[e],pos>i){idx=e;break}offset=pos}e++}else{while(e<i)s=h=!1,u.indexOf(c.Default)===-1&&e in o.hideColsCollection&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeCols.indexOf(e)>-1&&(h=!0),s||h||(offset+=o.columnsWidthCollection[e]),e++;idx=i}l.colIdx=idx;l.xOffset=offset}return l},_renderHdrRows:function(n){var r,a,v,b,k,p,d,u,o,s,h,g,c,l,f,e,y,i=this.getSheet(n),w=this.model.scrollSettings.allowVirtualScrolling;if(c=t.buildTag("table.e-table","<colgroup><col style='width: 30px;'><\/colgroup>",{},{cellspacing:"0"}),!this._sheetCopy.isSheetCopy){for(u=f=0,y=i.rows,r=0,p=i.rowCount,i._rowHeightCollection=[],i._rowIdxColl=[],i._rowHeightCollection.push(u);r<p;)l=i.rowsHeightCollection[r],l||(l=i.rowsHeightCollection[r]=i.rowHeight),w&&(i.hideRowsCollection.indexOf(r)!==-1||i._hiddenFreezeRows.indexOf(r)!==-1)?l=0:i._rowIdxColl.push(r),r!=p-1&&i._rowHeightCollection.push(i._rowHeightCollection[i._rowHeightCollection.length-1]+l),r++;if(y){for(e=-1,k=y.length,g=this._browserDetails.name==="mozilla"?2:1,a=0;a<k;a++){for(o=y[a],b=o.cells.length,this.isUndefined(o.index)||(f=o.index),u=o.height||i.rowHeight,i.rowHeight<u&&(i.rowsHeightCollection[f]=u,e===-1&&(e=f)),v=0;v<b;v++)s=o.cells[v],s.style&&s.style["font-size"]&&(h=document.getElementById(this._id+"_emptySpan"),d=this.XLFormat._createFormatClass(s.style),this.addClass(h,d),h.textContent=s.value,u=h.offsetHeight+g,u>i.rowsHeightCollection[f]&&(i.rowsHeightCollection[f]=u,e===-1&&(e=f)),this._refreshGlobalSpan(h)),this.isUndefined(s.value)||(i._hasDataSrc=!0);f++}e!==-1&&this.XLScroll._getRowHeights(n,e,!0)}}return w?c.append("<tbody class='e-ss-virtualtop'><\/tbody><tbody><\/tbody><tbody class='e-ss-virtualbottom'><\/tbody>"):c.append("<tbody>"+this._renderRowHdr(i._rowIdxColl,n)+"<\/tbody>"),this._setRowHdrTBody(c.find("tbody").eq(w?1:0),n),c},_renderRowHdr:function(i,r){for(var u,f,o=0,h=[],e=this.getSheet(r),s=i?i.length:e.rowCount;o<s;)u=i?i[o]:o,(t.isNullOrUndefined(this.XLEdit.getPropertyValue(u,0,"isFilterHide",r))||t.isNullOrUndefined(this.XLEdit.getPropertyValue(u,0,"isRHide",r)))&&(f={height:e.rowsHeightCollection[u]<this.model.rowHeight?this.model.rowHeight:e.rowsHeightCollection[u],rowidx:u},f.className=this.XLEdit.getPropertyValue(u,0,"hRow",r)?"e-rowheader e-hrow ":"e-rowheader",this.XLEdit.getPropertyValue(u,0,"isFilterHighlight",r)&&(f.className+=" e-filterhiglight"),f.wrap=this.XLEdit.getPropertyValue(u,0,"wrapRow",r)?" e-sswraprow":"",this.model.allowSelection&&this._inRow(e.selectedRange,u)&&(f.className+=" e-rowhighlight",e._isRowSelected&&(f.className+=" e-rowselected")),h.push(f)),o++;return n.render[this._id+"JSONRowHdrTemplate"+r](h)},_refreshDataSrc:function(n,t){var r,e,f,o,h,u,i,p,l,s,a,c=isSheetData=!1,v=0,w=this.getSheet(t),y=this.getDataSettings(t);if(!w.rangeSettings.length&&w.dataSource&&(isSheetData=!0),y)for(p=y.length;v<p;){if(i=y[v],i.range)if(s=i.range,c=isSheetData?!i.fieldAsColumnHeader&&i.showHeader:i.showHeader,this.getObjectLength(i.headerStyles)&&this.model.allowCellFormatting&&(l=this.XLFormat._createFormatClass(i.headerStyles)),n)for(r=n[0],e=n[2],o=n[3];r<=e;){if(this._inRow(s,r))for(f=n[1];f<=o;)this._inColumn(s,f)&&(a=i.fields[f-i.range[1]],c&&r===s[0]?(u=i._jsonData[r-i.range[0]],u&&this._refreshCell(r,f,t,i,u,a,!1,l)):(u=i._jsonData[r-(i.range[0]+(c?1:0))],u&&this._refreshCell(r,f,t,i,u,a,!0))),f++;r++}else{if(r=0,e=s[0],o=s[1],f=s[2],c){u=i._jsonData[r];for(h in u)this._refreshCell(e,o,t,i,u,h,!1,l),o++;e++}while(e<=f){u=i._jsonData[r];o=s[1];for(h in u)this._refreshCell(e,o,t,i,u,h,!0),o++;r++;e++}}v++}},_refreshCell:function(n,t,i,r,u,f,e,o){var s,h=this._iterateComplxObj(u[f],f);s=this.XLEdit._parseValue(e?h.value:h.prop,{rowIndex:n,colIndex:t});s.sheetIdx=i;r.rangeName&&(s.rangeName=r.rangeName);e?r.primaryKey===f&&(s.isReadOnly=!0):(o&&(s.format=o,s.formats=r.headerStyles),isSheetData&&(s.isReadOnly=!0));this.XLEdit._updateDataContainer({rowIndex:n,colIndex:t},{dataObj:s,sheetIdx:i,skipCell:!0})},_iterateComplxObj:function(n,t,i){var r,u,e,o=i||t,f={prop:o,value:n};if(this._isObject(n)){e=".";for(r in n){if(u=n[r],this.isUndefined(u))return f;if(n.hasOwnProperty(r)&&this._isObject(u)&&!this._isDateTime(u))o+=e+r,f=this._iterateComplxObj(u,r,o);else return f.prop+=e+r,f.value=u,f}}return f},_refreshCellData:function(t,i){var f,c,w,u,a,e,r,k,v,y,o=0,s=this.getSheet(i),p=s.rows,h=s.hideColumns,b=s.border;if(p){for(f=0,len=p.length;f<len;f++){if(e=0,w=p[f],a=p[f].cells,w.index&&(o=w.index),(!t||this._inRow(t,o))&&a)for(c=0,l=a.length;c<l;c++)u=a[c],u.index&&(e=u.index),(!t||this._inColumn(t,e))&&(r=this.isUndefined(u.value)?{}:this.XLEdit._parseValue(u.value,{rowIndex:o,colIndex:e}),r.value=this.isUndefined(r.value)?this.isUndefined(this.XLEdit.getPropertyValue(o,e))?"":this.XLEdit.getPropertyValue(o,e):r.value,v=this.isFormula(r.value),v&&(this.XLEdit._refreshCalcEngine(o,e,!0,r.value,i),this._applyFormula(i,o,e)),u.format&&(y=this.XLFormat._getFormatObj(u.format),r.type=u.format.type,r.formatStr=y.format.formatStr,r.decimalPlaces=y.format.decimalPlaces,r.thousandSeparator=y.format.thousandSeparator?!0:!1),r.value2=this.XLFormat._format(v?this.XLEdit.getPropertyValue(o,e,"value2"):r.value,{formatStr:r.formatStr,type:r.type,thousandSeparator:r.thousandSeparator,decimalPlaces:r.decimalPlaces,cellObj:r}),u.hyperlink&&(r.hyperlink=u.hyperlink.webAddr?u.hyperlink.webAddr.indexOf("http")===-1?{webAddr:"http://"+u.hyperlink.webAddr}:{webAddr:u.hyperlink.webAddr}:{cellAddr:u.hyperlink.cellAddr+"_"+u.hyperlink.sheetIndex||i},r.formats={color:this._hlColor}),u.comment&&(k=(this.model.userName.length?this.model.userName:this._getLocStr("UserName"))+":\n",r.comment={value:k+(u.comment.value||""),isVisible:u.comment.isVisible||!1}),u.isLocked&&(r.isLocked=!0,this.protectSheet(!0)),u.style&&(r.formats=n.extend(r.formats,u.style)),r.formats&&(r.format=this.XLFormat._createFormatClass(r.formats)),this.XLEdit._updateDataContainer({rowIndex:o,colIndex:e},{dataObj:r,sheetIdx:i,skipCell:!0}),this.XLEdit._refreshCellAlignment({cellIdx:{rowIndex:o,colIndex:e},value:r.value,type:r.type}),v||this.XLEdit._refreshCalcEngine(o,e,!1,null,i)),e++;o++}this.model.scrollSettings.allowVirtualScrolling&&(s._virtualTBodyHgt=s._rowHeightCollection[s._rowHeightCollection.length-1]+s.rowsHeightCollection[s.rowsHeightCollection.length-1])}if(h.length&&this.model.scrollSettings.allowVirtualScrolling){for(f=0,len=h.length;f<len;f++)s.hideColsCollection[h[f]]||this._updateHiddenColumns({rowIndex:0,colIndex:h[f]},i);this.XLScroll._getColWidths(i,h.sort()[0])}if(b.length&&this.model.scrollSettings.allowVirtualScrolling)for(f=0,len=b.length;f<len;f++)this._updateCellBorder(b[f],i)},_updateCellBorder:function(n,t){var r,u,f,i,e=this.getRangeIndices(n.range);if(f={top:{top:"1px solid"},right:{right:"1px solid"},bottom:{bottom:"1px solid"},left:{left:"1px solid"},outside:{top:"1px solid",right:"1px solid",bottom:"1px solid",left:"1px solid"},allborder:{top:"1px solid",right:"1px solid",bottom:"1px solid",left:"1px solid"},thickbox:{top:"2px solid",right:"2px solid",bottom:"2px solid",left:"2px solid"},thickbottom:{bottom:"2px solid"},topandbottom:{top:"1px solid",bottom:"1px solid"},topandthickbottom:{top:"1px solid",bottom:"2px solid"}},i=f[n.type],borderColl=this.getObjectKeys(i),borderColl.length)for(r=0,u=borderColl.length;r<u;r++)i[borderColl[r]]=i[borderColl[r]].concat(" "+n.color);i.skipCell=!0;i.sheetIdx=t;n.type==="allborder"?this.XLFormat._applyAllBorderCss(i,e):this.XLFormat._applyBorderCss(i,e)},_renderContTable:function(i){var r;return this._sheetCopy.isSheetCopy?r=n(this._sheetCopy.sheetContent):(r=t.buildTag("table.e-table",this._sheets[i]._contentColGroup.outerHTML,this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal?{width:this._getEntireColWidth(i)}:{},{cellspacing:"0"}),this.model.scrollSettings.allowVirtualScrolling?r.append("<tbody class='e-ss-virtualtop'><\/tbody><tbody><\/tbody><tbody class='e-ss-virtualbottom'><\/tbody>"):r.append("<tbody><\/tbody>")),this._setContTBody(r.find("tbody").eq(this.model.scrollSettings.allowVirtualScrolling?1:0),i),r},_initViewPortCont:function(n){var i,t=this.getSheet(n);this.model.scrollSettings.allowVirtualScrolling?this._refreshViewport(this._initLoad?0:this._isFrozen(this.getFrozenRows())?t._contScrollTop:t._scrollTop,n):(i=this.getRangeData({property:["value","value2","comment","hyperlink","format","border","type","isFilterHide","isRHide","isFHide","isFilterHeader","isFilterVisible","filterState","isMHide","merge","hRow","isLocked","wrap","isOverflow","align","picture","cFormatRule","isOfBrdr","formatStr"],sheetIdx:n,rowIdxs:t._rowIdxColl,withRowIdx:!0}),this._getContTBody(n).html(this._renderData(i,n)),this.model.allowComments&&this.XLComment._updateCmntArrowPos(null,n));t._isVPRendered=!0},_processCellTypes:function(n,t){for(var r=[],i=0,u=n.length;i<u;i++)n[i].cellType.type==="DatePicker"?r.push({range:this._getAlphaRange(t,n[i].rowIndex,n[i].colIndex,n[i].rowIndex,n[i].colIndex),settings:{type:n[i].cellType.type,value:n[i].value}}):r.push({range:this._getAlphaRange(t,n[i].rowIndex,n[i].colIndex,n[i].rowIndex,n[i].colIndex),settings:{type:n[i].cellType.type,isChecked:n[i].cellType.isChecked}});this.XLCellType._rangeCellTypes(r,t);this._celltypes=[]},_initDependencies:function(){var t=this.model;this._renderAlertdlg();this._renderAlertDlgContent(n("#"+this._id+"_alertdlg"),"Alert","");this._initEditForm();t.allowClipboard&&this.XLClipboard._initCopyPaste();t.allowEditing&&(this.XLEdit._processEditing(),this.getMainPanel().append(this.XLEdit._editElem),this.XLEdit._editElem.hide());this._renderDDownList();this.clearUndoRedo();t.showRibbon&&this.XLRibbon._disableButtons(["clearfilter"],"ejButton");t.allowDataValidation&&this.XLValidate._addDVMethod();t.enableContextMenu&&this.XLCMenu._initCMenuFooter();t.allowFiltering&&this.XLFilter._renderExcelFilter();t.allowFreezing&&this.XLFreeze._initFreeze()},_initComplete:function(){this._reqCnt===this._resCnt&&(this._trigger("loadComplete",{}),this.isDirty=!1,this.clearUndoRedo(),this.hideWaitingPopUp(),this.XLRibbon.updateRibbonIcons())},_showDialog:function(t,i){var e,u="e-dialog",f=this.model,r;switch(t){case this._id+"_Ribbon_Home_Styles_ConditionalFormatting":r=n("#"+this._id+"_CFDialog");!r.length&&f.allowConditionalFormats&&(r=this.XLRibbon._initCFDialog());r.ejDialog("open");break;case this._id+"_chartname":r=n("#"+this._id+"_chartnamedlg");r.length||this.XLRibbon._renderChartNameDlg();break;case this._id+"_Ribbon_ChartDesign_Type_ChangeChartType":r=n("#"+this._id+"_charttypedlg");r.length||(r=this.XLRibbon._renderChartTypeDialog());break;case this._id+"_ImportPasswordDialog":r=n("#"+this._id+"_ImportPasswordDialog");r.length||(r=this._importPasswordDlg());r.ejDialog("open");break;case this._id+"_Ribbon_Insert_Links_Hyperlink":this.model.isReadOnly||(f.allowHyperlink&&!this._hasClass(document.getElementById(this._id+"_HLDialog"),u)&&this.XLRibbon._initHLDialog(),this._hlDlgOpen());break;case this._id+"_Ribbon_Others_Cells_InsertCellOptions":f.allowInsert&&(this._hasClass(document.getElementById(this._id+"_insertdeletedlg"),u)||this._renderInsertDeleteDialog(),this._refreshInsDelDialog("Insert"));break;case this._id+"_Ribbon_Others_Cells_DeleteCellOptions":f.allowDelete&&(this._hasClass(document.getElementById(this._id+"_insertdeletedlg"),u)||this._renderInsertDeleteDialog("delete"),this._refreshInsDelDialog("Delete"));break;case this._id+"_FormatCells":f.allowCellFormatting&&!this._hasClass(document.getElementById(this._id+"_formatdlg"),u)&&this.XLCellFrmtDlg._renderCellFrmtDlg();this.XLCellFrmtDlg._initFormatCellDlg();break;case this._id+"_MoveorCopy":this._hasClass(document.getElementById(this._id+"_moveCopyDlg",u))||this._initMoveCopyDlg();this._renderMoveCopyDlg();break;case this._id+"_UnhideSheet":this._hasClass(document.getElementById(this._id+"_UnhideDlg",u))||this._initUnhideDlg();this._renderUnhideDlg();break;case this._id+"_Ribbon_Data_DataTools_DataValidation":case this._id+"_Ribbon_Data_DataTools_DataValidationOptions":this.model.allowDataValidation&&!this._hasClass(document.getElementById(this._id+"_ValDialog"),u)&&(e=this.XLRibbon._initValDialog(),this.XLRibbon._renderValDialog(e));break;case this._id+"_Filter":document.getElementById(this._id+i+"_excelDlg")||document.getElementById(this._id+"_filter_custom_"+i)||this.XLFilter._renderFilterDialogs(i);break;case this._id+"_Ribbon_Review_Changes_ProtectWorkbook":this._hasClass(document.getElementById(this._id+"_PasswordDialog"),u)||this._passwordDlg();break;case this._id+"_Ribbon_Insert_Tables_Table":f.allowFormatAsTable&&!this._hasClass(document.getElementById(this._id+"_fatnamedlg"),u)&&this.XLRibbon._renderFATNameDlg();break;case this._id+"_Ribbon_Insert_Tables_PivotTable":f.enablePivotTable&&!this._hasClass(document.getElementById(this._id+"_PvtDialog"),u)&&(this.XLRibbon._initPvtDialog(),this.XLRibbon._renderPvtDialog());break;case this._id+"_Ribbon_Others_Editing_FindSelect":f.allowSearching&&!this._hasClass(document.getElementById(this._id+"_FRDialog"),u)&&(this.XLRibbon._initFRDialog(),this.XLRibbon._renderFRDialog(),this.model.isReadOnly||(e=this.XLRibbon._initGoToDialog(),this.XLRibbon._renderGoToDialog(e)));this.model.isReadOnly?n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option",{disabledItemIndex:[1,2]}):n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option",{enabledItemIndex:[1,2]});break;case this._id+"_Ribbon_ChartDesign_Data_SelectData":f.allowCharts&&!this._hasClass(document.getElementById(this._id+"_chartrangedlg",u))&&this.XLChart._renderChartRangeDialog();break;case this._id+"_Ribbon_Others_NameManager":document.getElementById(this._id+"_nmdlg")||this.XLRibbon._renderNameManagerDlg();break;case this._id+"_Ribbon_Design_Tools_ResizeTable":document.getElementById(this._id+"_fatresizetabledlg")||this.XLRibbon._renderFATResizeTableDlg()}},_generateHeaderText:function(n){var t="Z";return n/26>1?this._generateHeaderText(n%26==0?n/26-1:Math.floor(n/26))+String.fromCharCode(n%26==0?t.charCodeAt(t):64+n%26):String.fromCharCode(64+n)},_generateColCount:function(n){var i=0,t;for(n=n.split("").reverse().join(""),t=n.length-1;t>=0;t--)i+=(n[t].charCodeAt(n[t])-64)*Math.pow(26,t);return i},_getSheetIndex:function(n){return n||this.getActiveSheetIndex()},_getSheetIdxFromSheetValue:function(n){for(var t=1,i=this.model.sheets,r=i.length-1;t<=r;){if(i[t].sheetInfo.value.toLowerCase()===n.toLowerCase())return t;t++}return-1},getAlphaRange:function(n,t,i,r){return this.isUndefined(i)&&this.isUndefined(r)&&(i=n,r=t),this._getAlphaRange(null,n,t,i,r)},_getAlphaRange:function(n,t,i,r,u){return t=t+1,i=i+1,r=r+1,u=u+1,t===r&&i===u?this._generateHeaderText(i)+t:this._generateHeaderText(i)+t+":"+this._generateHeaderText(u)+r},_getProperAlphaRange:function(n,t,i,r,u){var f=this._getAlphaRange(n,t,i,r,u);return f.indexOf(":")===-1?f+":"+f:f},_getDollarAlphaRange:function(n,t){var u=this.getActiveSheetIndex(),i=this.getSheet(u).sheetInfo.text,r=i.match(/\s/g)?"'"+i+"'":i;return t&&!this.isRange(n)?r+"!$"+this._generateHeaderText(n[1]+1)+"$"+(n[0]+1):r+"!$"+this._generateHeaderText(n[1]+1)+"$"+(n[0]+1)+":$"+this._generateHeaderText(n[3]+1)+"$"+(n[2]+1)},_toIntrnlRange:function(n,t){return n?this._isString(n)&&(n=this.getRangeIndices(n)):n=this.getSheet(t).selectedRange,n},_getMaxRowColCnt:function(n,t,i){for(var u,f,r,e=0,o=0,n=n?n:this.model.sheets,s=i?i:1,h=i?i+1:n.length;s<h;)r=n[s],t&&r.usedRange?(u=r.usedRange.rowIndex,f=r.usedRange.colIndex):(u=r.rowCount,f=r.colCount),e<u&&(e=u),o<f&&(o=f),s++;return{rowCount:e,colCount:o}},_generateEJMenu:function(n,i,r){return{menuType:n==="normal"?t.MenuType.NormalMenu:t.MenuType.ContextMenu,orientation:i==="vertical"?t.Orientation.Vertical:t.orientation.Horizontal,cssClass:r}},_generateEJDD:function(t,i,r,u,f,e){return{dataSource:t,fields:i,selectedItemIndex:r,width:u,cssClass:"e-"+this._id+"-ddl",change:n.proxy(this.XLRibbon._frTypeChange,this,e)}},_heightWidthCalculation:function(t,i){var r,u=this.getActivationPanel(),f=u.is(":visible");this._isDisplayHeader?(r=n("#"+this._id+"_Ribbon").height(),this._isDisplayHeader=!1):r=this.XLRibbon._ribbonState?this.element.find(".e-ribbon").height()-1:this.element.find(".e-ribbon .e-header").height();this._refreshSheetWithScreen(t);this._updateResponsiveSettings();this._initViewPort(t);this._setSheetWidthHeight(t,{width:this._responsiveWidth,height:this._responsiveHeight},r,"refresh",i.action);f&&u.height(this.getMainPanel().height()-1);this.refreshContent(t)},_refreshSheetWithScreen:function(t){n("#"+this._id+"GroupPanel")[0].style.height="0px";n("#"+this._id+"MainPanel")[0].style.height="0px";this.model.allowFormulaBar&&(this.element.find(".e-formulabar")[0].style.width="0px");this.getSheetElement(t).find(".e-spreadsheetcontentcontainer")[0].style.height="0px";this.getSheetElement(t).find(".e-spreadsheetrowheader")[0].style.height="0px"},_refreshWidthHeight:function(i,r,u,f){var s,y=1,p=0,e=this._getContent(i),h,c,w=this.model.pageSettings.pagerHeight+1,b,l=this.getSheet(i),a=this._getJSSheetRowHeader(i),v,k,d=-1,g=n("#"+this._id+"_Ribbon").ejRibbon("instance"),o,nt;return b=this.model.showRibbon?g.model.selectedItemIndex<1?1:g.model.selectedItemIndex:0,this.XLRibbon._ribbonState&&(d=n("#"+this._id+"_Ribbon").find(".e-content:eq("+b+")").height()),v=this._phoneMode?n("#"+this._id+"_Ribbon").height():n("#"+this._id+"_Ribbon").find(".e-header").height()+d+2,c=this.model.allowFormulaBar?this._formulaHeight:0,u=v&&this.model.showRibbon&&n("#"+this._id+"_Ribbon").is(":visible")?v:0,l.showHeadings&&(y=22,p=a.width()),this._isAutoWHMode||(h=r.height-(u+c+1),this.getGroupPanel().height(h-1),this.getMainPanel().height(h-1),this.model.showPager&&(f==="initial"||this.element.find(".e-spreadsheetfooter").is(":visible"))||(w=1),k=this._browserDetails.name==="chrome"?1:2,r.height=r.height-(y+w+c+u+k),this.element.find(".e-spreadsheet-list")[0].style.height=""),this.model._isActPanelVisible?r.width=r.width-(this.model.activationPanelWidth+2):t.isNullOrUndefined(r.isActPanel)||r.isActPanel||(r.width=r.width+this.model.activationPanelWidth+2),o=this.model.scrollSettings,this.getMainPanel().width(!this.model._isActPanelVisible&&o.isResponsive?"100%":r.width),e.find("#hscrollBar").length>0&&(e.find("#hscrollBar").remove(),a.removeClass("e-scrollrowcss"),this._getJSSheetRowHeaderContent(i).height(r.height),this._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").height(r.height-1)),e.find("#vscrollBar").length>0&&(nt=l._scrollTop,e.find("#vscrollBar").data("ejScrollBar").scroll(0),l._scrollTop=nt,e.find("#vscrollBar").remove(),this._getJSSheetHeader(i).removeClass("e-scrollcss"),this._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").width(o.isResponsive?r.width-2:r.width)),this._isAutoWHMode||(e.height(r.height),a.height(r.height)),this._getJSSheetContent(i).width(o.isResponsive?"100%":r.width),s=this.getFooter(),s&&s.width(o.isResponsive?"100%":r.width),this._alignFormulaBar(this._responsiveWidth),this._initViewPort(i),this.model.allowFreezing&&this.XLFreeze._refreshFreeze(),r.width=r.width-p,r.height=r.height,r},_setSheetWidthHeight:function(t,i,r,u,f){var e=this.getSheet(t),b=n(document),o=this._getContent(t),s,h,a,v,c,l=this._getJSSheetRowHeader(t),y,p=this.model.scrollSettings.isResponsive,k=e.showHeadings?l.width():0,w;p?(f!="initial"&&u!="resize"&&(this._refreshSheetWithScreen(t),this._updateResponsiveSettings(),i={width:this._responsiveWidth,height:this._responsiveHeight}),this._resizeColl[t-1]=this._isResized,u!=="resize"||this.model.allowResizing&&(!this.model.allowResizing||this.XLResize._resizeStart)||f=="toggleBtn"||(this.model.activationPanelWidth=Math.floor(i.width/3)),u==="refresh"&&(w=this._browserDetails,w.name.indexOf("msie")>-1&&(b=this.model.showRibbon?n(document):n("body"))),y=this._refreshWidthHeight(t,n.extend(!0,{},i),r,f,u),this._updateResponsiveSettings(),u!=="resize"||this.model.allowResizing&&(!this.model.allowResizing||this.XLResize._resizeStart)||f=="toggleBtn"||(this.model.activationPanelWidth=Math.floor(i.width/3)),i=y):(this._isAutoWHMode||(i.width=i.width-2),i=this._refreshWidthHeight(t,n.extend(!0,{},i),r,f,u));this.getMainPanel().width(!this.model._isActPanelVisible&&p?"100%":i.width+k);this.model.scrollSettings.allowScrolling&&(this.model._isActPanelVisible&&(i.width+=2),this._renderScroller(t,n.extend(!0,{},i),f),h=o.find("#vscrollBar"),s=o.find("#hscrollBar"),h.length>0&&this._getJSSheetHeader(t).addClass("e-scrollcss"),s.length>0&&(c=o.height(),l.height(c-18),this._getJSSheetRowHeaderContent(t).height(c-(s[0].style.display==="none"?0:18)),l.addClass("e-scrollrowcss")),f!="initial"&&(v=h.data("ejScrollBar"),a=s.data("ejScrollBar"),v.scroll(e._scrollTop),a.scroll(e._scrollLeft)));e.showHeadings||o.find(".e-content")[this.model.allowFormulaBar?"addClass":"removeClass"]("e-viewbrdr");this._isAutoWHMode||(this._dlgWidth=this._phoneMode||this._tabMode||this._responsiveWidth<350?this._responsiveWidth-2:this._responsiveWidth/2,this._dlgHeight=this._phoneMode||this._tabMode||this._responsiveHeight<350?this._responsiveHeight-2:this._responsiveHeight/1.5)},setWidthToColumns:function(n,t){var f=t||this.getActiveSheetIndex(),i=this.getSheet(f),l,a,s=0,u,r,h=!1,c,e,v,o;if(!this.isUndefined(i)){for(typeof n[0]=="object"&&(h=!0),i._isLoaded&&(l=this._getContent(f).find("col"),a=this._getJSSheetHeader(f).find("col")),e=0,v=n.length;e<v;e++){if(u=h?n[e].width:n[e],r=h?n[e].colIndex:e,c=this.XLEdit._getPropWithCellIdx([0,r,i.rowCount-1,r],"isOfBrdr",f),u===0&&(u=64),u<i.columnsWidthCollection[r]&&this.XLEdit.getPropertyValue(0,r,"wrapCol")){s+=u;continue}for(i._isLoaded&&(a[r].style.width=u+"px",l[r].style.width=u+"px"),s+=u,this.XLEdit.getPropertyValue(0,r,"isCHide",f)?(i.hideColsCollection[r]=u,i.columnsWidthCollection[r]=0):i.columnsWidthCollection[r]=u,this.XLScroll._getColWidths(f,r),o=0;o<c.length;o++)cellIdx=c[o],this._textClip(cellIdx.rowIdx,cellIdx.colIdx,"delete","",!0),this._textClip(cellIdx.rowIdx,cellIdx.colIdx,"add","",!0)}i.staticWidth=s;i._isLoaded&&this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(f,"refresh","horizontal");(!i._isImported||i._isLoaded)&&(this.model.allowSelection&&this.XLSelection._refreshBorder(),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this.model.allowComments&&this.XLComment._updateCmntArrowPos(),this._isAutoWHMode&&this._autoSSWidthHeight())}},setHeightToRows:function(n){var u,t=this.getActiveSheetIndex(),e=0,r=this.getSheet(t),f=!1,o=this.getRows(t),h=o[1],c=o[0],i,s;for(typeof n[0]=="object"&&(f=!0),i=0,s=n.length;i<s;i++){if(height=f?n[i].height:n[i],rowIdx=f?n[i].rowIndex:i,height===0&&(height=22),height<r.rowsHeightCollection[rowIdx]&&this.XLEdit.getPropertyValue(rowIdx,0,"wrapRow")){e+=height;continue}this._isRowViewable(t,rowIdx)&&rowIdx!=-1&&(u=this._getRowIdx(rowIdx,t),h[u].style.height=height+"px",c[u].style.height=height+"px");e+=height;r.rowsHeightCollection[rowIdx]=height}this.model.scrollSettings.allowScrolling&&(this.XLScroll._getRowHeights(t,1),this.XLScroll._refreshScroller(t,"refresh","vertical"),this.XLScroll._getFirstRow(t));this.model.allowSelection&&(!r._isImported||r._isLoaded)&&(this.XLSelection._refreshBorder(),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())},_refreshRowColCnt:function(n){var f,o,r,e,u=buffHgt=buffWth=actPnlWidth=ribbonHgt=formulaHgt=0,h=this.model.scrollSettings,c=scrollerHgt=scrollerWth=colHdrHgt=rowHdrWth=0,s=h.scrollMode===t.Spreadsheet.scrollMode.Infinite,i=this.getSheet(n),l=this._responsiveHeight,a=this._responsiveWidth;i.rowCount>this._maxRowCnt&&(i.rowCount=this._maxRowCnt);f=this._getMaxHgt(n,this.isImport);s&&(buffHgt=i._vPortHgt+this._bufferCnt*i.rowHeight,f<buffHgt&&(r=buffHgt-f,u=Math.ceil(r/i.rowHeight),i.rowCount+=u,f+=u*i.rowHeight));h.allowVirtualScrolling&&(e=i.rowCount-(i.hideRowsCollection.length+(this.isImport?i._hiddenFreezeRows.length:0)),s&&(r=e%i._virtualBlockRowCnt,r&&(u=i._virtualBlockRowCnt-r,i.rowCount+=u,e+=u,f+=u*i.rowHeight)),i._virtualBlockCnt=Math.ceil(e/i._virtualBlockRowCnt),i._virtualTBodyHgt=f);i.colCount>this._maxColCnt?i.colCount=this._maxColCnt:s&&(buffWth=i._vPortWth+this._bufferCnt*i.columnWidth,o=this.isImport?this._getMaxWth(n):i.colCount*i.columnWidth,o<buffWth&&(r=buffWth-o,i.colCount+=Math.ceil(r/i.columnWidth)))},_getMaxHgt:function(n,t,i){var f,u=val=0,r=this.getSheet(n);if(t)for(f=r.rowsHeightCollection.length;u<f;)i&&r.hideRowsCollection.indexOf(u)!==-1||(val+=r.rowsHeightCollection[u]),u++;else val=(r.rowCount-(r.hideRowsCollection.length+r._hiddenFreezeRows.length))*r.rowHeight;return val},_getMaxWth:function(n){for(var i=0,t=0,r=this.getSheet(n),u=r.columnsWidthCollection.length;t<u;)i+=r.columnsWidthCollection[t],t++;return i},_refreshTemplates:function(i,r,u,f){for(var h,e,o,s=t.isNullOrUndefined(u)?0:u,l={},a=this.getSheet(i),v=t.buildTag("colgroup"),y=this.model.scrollSettings.allowVirtualScrolling,p=t.isNullOrUndefined(f)?a.colCount:f,c=y?"<tr style = 'height: {{:height}}px' idx = '{{:rowidx}}'>":"<tr style = 'height: {{:height}}px'>";s<p;)h=a.columnsWidthCollection[s],o=this._generateHeaderText(s+1),e=document.createElement("col"),h<1?e.setAttribute("class","e-hide"):a._hiddenFreezeCols.indexOf(s)>-1&&e.setAttribute("class","e-fcol-hide"),e.style.width=h+"px",c+="<td class='{{:"+o+"_className}}' rowspan=' {{:"+o+"_rspan}}' colspan=' {{:"+o+"_cspan}}'>{{:"+o+"_value}}<\/td>",v.append(e),s++;l[this._id+"JSONTemplate"+i]=c+"<\/tr>";r||(l[this._id+"JSONRowHdrTemplate"+i]=y?"<tr class='{{:wrap}}' style='height:{{:height}}px' idx='{{:rowidx}}'><td class='{{:className}}'>{{:rowidx + 1}}<\/td><\/tr>":"<tr class='{{:wrap}}' style='height:{{:height}}px'><td class='{{:className}}'>{{:rowidx + 1}}<\/td><\/tr>");n.templates(l);this._sheets[i]._contentColGroup=v.get(0)},_renderData:function(i,r,u,f,e){var y,h,p,s,o,d,ft,ht,ct,et,it,l,a,k,lt,w,ot,rt,at,v,vt,g=eCol=0,b=" ",nt=[],c=this.getSheet(r),st=e?f:c.colCount,tt=c._goToCollection,yt=tt.selected.length,ut,pt;if(i)for(ft=i.data,it=ft.length/st;g<it;){for(s={},y=eCol,l=i.rowIdx[g],a=e?u:0;y<eCol+st;){if(o=ft[y],o){if(k=this._generateHeaderText(a+1),h=k+"_className",p=k+"_value",s[h]="e-rowcell e-wrapword ",c.showGridlines||(s[h]+=" e-hborder"),!tt.multiple&&yt&&tt.selected.indexOf(l+":"+a)>-1&&(s[h]+=" e-selected"),a in c.hideColsCollection&&(s[h]+=" e-soverflow"),c._hiddenFreezeCols.indexOf(a)>-1&&(s[h]+=" e-fcol-hide"),this.model.allowSelection&&this.inRange(c.selectedRange,l,a)&&(rt=!0,tt.multiple&&(rt=!1,yt&&tt.selected.indexOf(l+":"+a)>-1&&(rt=!0)),rt&&(s[h]+=" e-selected"),c._activeCell.rowIndex===l&&c._activeCell.colIndex===a&&(s[h]+=" e-activecell")),this.isImport&&this.model.allowCellType&&this.model.allowAutoCellType&&((o.type=="shortdate"||o.type=="longdate")&&this._celltypes.push({rowIndex:l,colIndex:a,sheetIndex:r,cellType:{type:"DatePicker"},value:o.value2}),o.value2&&["true","yes","false","no"].indexOf(o.value2.toLowerCase())>-1&&this._celltypes.push({rowIndex:l,colIndex:a,sheetIndex:r,cellType:{type:"CheckBox",isChecked:["yes","true"].indexOf(o.value2.toLowerCase())>-1?!0:!1}})),this.isImport&&o.type=="date"&&this.XLFormat.addCustomFormatSpecifier(null,o.formatStr.replace(/^\{0\:|\}$/g,""),o.type),o.format&&(s[h]+=b+o.format,this._isClassHasProperty(o.format,"text-align","right")&&(s[h]+=" e-rightalign")),o.border&&(s[h]+=b+o.border),o.align?o.align===t.Spreadsheet.Align.Center?s[h]+=b+this._cAlign:o.align===t.Spreadsheet.Align.Right&&(s[h]+=b+this._rAlign):this._isGeneral(o.type)&&(typeof o.value=="object"&&this._isDateTime(o.value)||this.isNumber(o.value))&&(s[h]+=b+this._rAlign),o.isMHide&&(s[h]+=" e-mc-hide",s[h]+=" e-moverflow"),o.isOfBrdr&&(s[h]+=" e-ofbrdr"),o.isOverflow===!1&&(s[h]+=" e-overflow"),o.merge&&(ht=k+"_rspan",ct=k+"_cspan",et=o.merge.mSpan,s[ht]=et.rowSpan,s[ct]=et.colSpan,s[h]+=" e-moverflow",o.merge.isCenterAlign&&(s[h]+=b+this._cAlign)),o.cFormatRule)for(ut=0,pt=o.cFormatRule.length;ut<pt;ut++)ot=o.cFormatRule[ut].split("_"),ot[7]==="true"&&(s[h]+=" e-"+ot[4]);o.wrap&&(c._isImported&&!this.isFormula(o.value)||!c._isImported)&&(s[h]+=" e-sswraptext",v=this._dataContainer.sheets[r],this.isUndefined(v[l])&&(v[l]={}),this.isUndefined(v[l][0])&&(v[l][0]={}),v[l][0].wrapRow=!0,this.isUndefined(v[0])&&(v[0]={}),this.isUndefined(v[0][a])?v[0][a]={wrapCol:!0,wrapWidth:c.columnsWidthCollection[a]}:(v[0][a].wrapCol=!0,v[0][a].wrapWidth=c.columnsWidthCollection[a]),this._wrapCollection(l,a,this._detailsFromGlobalSpan(l,a,"height",this.XLEdit.getPropertyValue(l,a,"value"),c.columnsWidthCollection[a]),r));d=o.value2||"";o.hyperlink?e?(s[h]+=" e-hyperlinks",s[p]=d):s[p]=o.hyperlink.webAddr?String.format("<a href={0} class='e-hyperlinks' target='_blank'>{1}<\/a>",o.hyperlink.webAddr,d):String.format("<a class='e-hyperlinks'>{0}<\/a>",d):s[p]=o.merge&&o.wrap?"<div id ="+this._id+"_MergeWrap style = 'border :0px;overflow: hidden;max-height:"+(Math.floor(c._rowHeightCollection[l+o.merge.mSpan.rowSpan]-c._rowHeightCollection[l])-1)+"px'>"+d+"<\/div>":d;o.comment&&(s[h]+=" e-commentcell",vt=o.comment.isVisible?"visible":"none",s[p]=String.format("<span class='e-comment'><span class='e-celltoparrow'><\/span><textarea class='e-comment-txtarea' style='display:{0};z-index:9'>{1}<\/textarea><\/span>",vt,o.comment.value)+s[p]);o.rule&&o.rule.isApply&&!this.XLValidate._checkValidation(s[p],o.rule.customVal.split("_"),!0,r)&&(s[h]+=" e-hlcell");!o.isFilterHeader||this.isUndefined(c._filterColl[l])||this.isUndefined(c._filterColl[l][a])||(lt="e-icon e-spanfilter e-filterspan "+c._filterColl[l][a].status,at=o.isFilterVisible?"display: visible":"display: none",s[p]=String.format('<span class="{0}" style="{1}"><\/span>',lt,at)+s[p],s[h]=s[h].replace("e-ralign",""),b=b.replace("e-ralign",""));o.altTxt&&!o.wrap&&(s[h]+=" e-alt-unwrap")}a++;y++}s.rowidx=l;w=c.rowsHeightCollection[l];s.height=this.isUndefined(w)||w<this.model.rowHeight?this.model.rowHeight:w;nt.push(s);eCol=y;g++}else if(it=this.model.scrollSettings.allowVirtualScrolling?c._virtualBlockRowCnt:c.rowCount,c._dummyData)nt=c._dummyData;else while(g<it){for(s={},y=0;y<st;)k=this._generateHeaderText(y+1),h=k+"_className",s[h]="e-rowcell e-wrapword ",y++;w=c.rowsHeightCollection[g];s.height=this.isUndefined(w)||w<this.model.rowHeight?this.model.rowHeight:w;s.rowidx=l;nt.push(s);g++}return c._dummyData=nt,n.render[this._id+"JSONTemplate"+r](nt)},_isGeneral:function(n){return this.isUndefined(n)&&(n=t.Spreadsheet.CellType.General),n===t.Spreadsheet.CellType.General},_isFormulaError:function(n){var t,i=["#NA","#DIV/0!","#NAME?","circular reference","TypeError","wrong"];for(t=0,len=i.length;t<len;t++)if(n.indexOf(i[t])>-1)return!0;return!1},_refreshViewport:function(n,t){var e,f,o,a,c,s,l,r,h,u,i=this.getSheet(t),v=this.XLShape._getCellIndexFromOffset(n,0);i._virtualContBlockIdx=this._getVirtualBlockIdx(t,v.rowIndex).idx;o=(i._virtualContBlockIdx-1)*i._virtualBlockRowCnt;a=this._getRowIdx(o,t,!0);s=i._virtualContBlockIdx*i._virtualBlockRowCnt;l=this._getRowIdx(s,t,!0);i._virtualContTBodyOffset.top=this._getRowOffsetTop(i,a);i._virtualBlockCnt===1?(i._virtualTopTBodyOffset.top=i._virtualTopTBodyOffset.bottom=i._virtualTopTBodyHgt=0,i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom=i._virtualBottomTBodyHgt=0,i._virtualContTBodyOffset.bottom=this._getRowOffsetBottom(i._rowIdxColl[i._rowIdxColl.length-1],t),f=i._rowIdxColl,i._isVirtualTopReached=i._isVirtualEndReached=!0):i._virtualContBlockIdx===1?(i._virtualTopTBodyOffset.top=i._virtualTopTBodyOffset.bottom=i._virtualTopTBodyHgt=0,i._virtualContTBodyOffset.bottom=i._virtualBottomTBodyOffset.top=this._getRowOffsetTop(i,l),r=this._getRowIdx(s+(i._virtualBlockRowCnt-1),t,!0),i._virtualBottomTBodyOffset.bottom=this._getRowOffsetBottom(r,t),i._virtualBottomTBodyHgt=i._virtualTBodyHgt-(i._virtualContTBodyOffset.bottom-i._virtualContTBodyOffset.top+(i._virtualBottomTBodyOffset.bottom-i._virtualBottomTBodyOffset.top)),f=i._rowIdxColl.slice(0,i._rowIdxColl.indexOf(r)+1),i._isVirtualTopReached=!0,i._isVirtualEndReached=!1):i._virtualContBlockIdx===i._virtualBlockCnt?(h=(i._virtualContBlockIdx-2)*i._virtualBlockRowCnt,i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom=i._virtualBottomTBodyHgt=0,c=this._getRowIdx(o+(i._virtualBlockRowCnt-1),t,!0),i._virtualContTBodyOffset.bottom=this._getRowOffsetBottom(c,t),u=this._getRowIdx(h,t,!0),i._virtualTopTBodyOffset.top=this._getRowOffsetTop(i,u),i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.top,i._virtualTopTBodyHgt=i._virtualTBodyHgt-(i._virtualContTBodyOffset.bottom-i._virtualContTBodyOffset.top+(i._virtualTopTBodyOffset.bottom-i._virtualTopTBodyOffset.top)),f=i._rowIdxColl.slice(i._rowIdxColl.indexOf(u),i._rowIdxColl.indexOf(c)+1),i._isVirtualEndReached=!0,i._isVirtualTopReached=!1):(h=o-i._virtualBlockRowCnt,u=this._getRowIdx(h,t,!0),i._virtualTopTBodyOffset.top=this._getRowOffsetTop(i,u),i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.top,i._virtualContTBodyOffset.bottom=i._virtualBottomTBodyOffset.top=this._getRowOffsetTop(i,l),r=this._getRowIdx(s+(i._virtualBlockRowCnt-1),t,!0),i._virtualBottomTBodyOffset.bottom=this._getRowOffsetBottom(r,t),i._virtualTopTBodyHgt=n-(i._virtualTopTBodyOffset.bottom-i._virtualTopTBodyOffset.top+(n-i._virtualContTBodyOffset.top)),i._virtualBottomTBodyHgt=i._virtualTBodyHgt-i._virtualBottomTBodyOffset.bottom,f=i._rowIdxColl.slice(i._rowIdxColl.indexOf(u),i._rowIdxColl.indexOf(r)+1),i._isVirtualTopReached=i._isVirtualEndReached=!1);e=this.getRangeData({property:["value","value2","comment","hyperlink","rule","cFormatRule","format","border","type","isFilterHide","isRHide","isFHide","isFilterHeader","isFilterVisible","filterState","isMHide","merge","hRow","isLocked","wrap","isOverflow","align","isOfBrdr","altTxt","formatStr"],sheetIdx:t,rowIdxs:f,withRowIdx:!0});this._getRowHdrTBody(t).html(this._renderRowHdr(e.rowIdx,t));this._getContTBody(t).html(this._renderData(e,t));this._refreshRows(t);this._refreshTBodiesHgt(t);this.model.allowComments&&this.XLComment._updateCmntArrowPos(null,t);i._virtualRowIdx=e.rowIdx;this.model.allowCellType&&this.XLCellType._rangeCellTypes(i.cellTypes,t);this._refreshViewVar(n,i._isLoaded?null:0,t)},refreshOverflow:function(n,t){this._refreshOverflow(n,t)},_refreshOverflow:function(n,t){t=this._getSheetIndex(t);var r,e,i,u,f,o=this.getSheet(t);for(n=n||[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],f=this.XLEdit._getPropWithCellIdx(n,"value2"),r=f.length-1;r>-1;r--)i=f[r].rowIdx,u=f[r].colIdx,this.model.allowOverflow?this._textClip(i,u,"add","",!0):(this._isRowViewable(t,i)&&(e=this.getCell(i,u)[0]),this._removeClass(e,"e-overflow"),this._textClip(i,u,"delete","",!0),this.addClass(e,"e-overflow"),this.XLEdit._updateDataContainer({rowIndex:i,colIndex:u},{dataObj:{isOverflow:!1},skipCell:!0}))},_getVirtualBlockIdx:function(n,t,i){for(var r=1,u={},f=this.getSheet(n),e=this._getRowIdx(t,n,!1,!0);r<=f._virtualBlockCnt;){if(e<r*f._virtualBlockRowCnt){u.idx=r;break}r++}if(i)for(r=0;++r;)if(t<r*f._virtualBlockRowCnt){u.orgIdx=r;break}return u},_getBlockInfo:function(n,t,i){var r,f=this.getSheet(t),u=[0,0,0,f.colCount-1];return r=this._getVirtualBlockIdx(t,n,i),u[0]=f._virtualBlockRowCnt*(r.idx-1),u[2]=f._virtualBlockRowCnt*r.idx-1,r.range=u,i&&(u=[0,0,0,f.colCount-1],u[0]=f._virtualBlockRowCnt*(r.orgIdx-1),u[2]=f._virtualBlockRowCnt*r.orgIdx-1,r.orgRange=u),r},_getRowOffsetTop:function(n,t){return n._rowHeightCollection[t]},_getRowOffsetBottom:function(n,t){return this.getSheet(t)._rowHeightCollection[n]+this.getSheet(t).rowsHeightCollection[n]},_getColOffsetLeft:function(n,t){return n._colWidthCollection[t]},_getCellIdx:function(n){return{rowIndex:this.model.scrollSettings.allowVirtualScrolling?Number(n.parentNode.attributes.getNamedItem("idx").value):n.parentNode.rowIndex,colIndex:n.cellIndex}},_getMidCell:function(){var t,i={},n=this.getSheet();return t=n._bottomRow.idx-n._topRow.idx+1,i.rowIdx=n._topRow.idx+Math.floor(t/2),t=n._rightCol.idx-n._leftCol.idx+1,i.colIdx=n._leftCol.idx+Math.floor(t/2),i},_removeRange:function(t,i){var r=this.getActiveSheetIndex(),e=this._getRowHdrTBody(r),u=n(this._getRowHdrTBody(r)[0].rows),o=this._getContTBody(r),f=n(this._getContTBody(r)[0].rows);u.splice(t,i);f.splice(t,i);this.setRows([u,f],r);o.html(f);e.html(u)},_refreshTBodiesHgt:function(n){var t="px",n=this._getSheetIndex(n),i=this.getSheet(n),r=this._getJSSheetRowHeaderContent(n)[0].getElementsByTagName("tbody"),u=this._getContent(n)[0].getElementsByTagName("tbody");r[0].style.height=u[0].style.height=i._virtualTopTBodyHgt+t;r[2].style.height=u[2].style.height=i._virtualBottomTBodyHgt+t},_renderTD:function(n,t,i){return String.format("<td class='{0}' style='{1}' >{2}<\/td>",n,t,i)},_renderDIV:function(n,t,i){return i?String.format("<div class='{0}' title='{2}'>{1}<\/div>",n,t,i):String.format("<div class='{0}'>{1}<\/div>",n,t)},_renderTR:function(n,t,i){var r=this._sheetCopy.isSheetCopy?this.getSheet(i).rowsHeightCollection[t]:this.model.rowHeight,u="height:"+r+"px";return String.format("<tr style='{0}'>"+n+"<\/tr>",u)},_renderFooter:function(){var h=this.model.scrollSettings,i,r=t.buildTag("div.e-spreadsheetfooter","",{display:this.model.showPager?"block":"none"}),e=t.buildTag("table.e-table","",{},{}),o=n(document.createElement("tbody")),s=n(document.createElement("tr")),f=n(document.createElement("td")),c=this.model.scrollSettings,u;this._updateResponsiveSettings();i=h.isResponsive?"100%":this._responsiveWidth-2;f.append(this._renderSpreadSheetPager());f.find(".e-pagercontainer").append(t.buildTag("div#"+this._id+"_AddSheet.e-new e-icon e-default","",null,{title:this._getLocStr("NewSheet")}));s.append(f);o.append(s);e.append(o);r.append(e);this.getMainPanel().append(r);this.model.scrollSettings.isResponsive||this._isAutoWHMode||(i=i);this._refreshSpreadSheetPager();u=this.element.find(".e-spreadsheetfooter").outerHeight();this.model.showPager&&u>this.model.pageSettings.pagerHeight&&(this.model.pageSettings.pagerHeight=u<37?u:36);r.width(i).height(this.model.showPager?this.model.pageSettings.pagerHeight:0);this.element.find(".e-spreadsheetfooter .e-table").height(this.model.pageSettings.pagerHeight);this.setFooter(r)},gotoPage:function(t,i){var y;if((i||!(t>this.model.sheetCount))&&!(t<1)){var e,u,o=this.model.sheets,w=this.getPager(),s={},h=this._impData,c,l,f={reqType:"gotoSheet",gotoIndex:t,newSheet:i,prevSheetIdx:this.getActiveSheetIndex()},a,v,p=!this.XLRibbon._ribbonState,b={reqType:f.reqType,gotoSheetIndex:f.gotoIndex,isNewSheet:f.newSheet,prevSheetIndex:f.prevSheetIdx};(this._gotoPageArgs=n.extend(!0,{},f),this._isSheetNavigate=i?!1:!0,this._trigActionBegin(b))||(this.isImport||this.hideActivationPanel(),this.setActiveSheetIndex(t),u=o[t],i||u._isRequested||!u._isImported?(this.element.find(".e-sheet").hide(),i&&(this._addSheet(t),u=o[t]),this._isSheetInsert&&(e=w.ejPager("option","currentPage"),this._swapSheetDtCntr(o.length-1,e),this.model.activeSheetIndex=t=e,this._isSheetInsert=!1),this._isNew||(this.model.scrollSettings.allowVirtualScrolling||this.model.scrollSettings.allowSheetOnDemand)&&!u._isLoaded?(this.showWaitingPopUp(),this._initSheet(t)):(this.element.find("#"+this._id+"_"+u.sheetInfo.value).show(),i||this._initSelection(),this._isAutoWHMode&&(this._autoSSWidthHeight(),u._isOpened||this._refreshOverflow(r,t)),this._gotoPageArgs&&this._pageLoadComplete(t)),u._isResized&&(this._refreshSheetWithScreen(t),this._updateResponsiveSettings(),s.width=this._responsiveWidth,s.height=this._responsiveHeight,this._setSheetWidthHeight(t,s,null,"refresh"),u._isResized=!1),this.model.scrollSettings.allowVirtualScrolling||u._isOpened||this._updateHiddenRows(t),this.model.allowFreezing&&this.XLFreeze._refreshFreeze(),this._isSheetNavigate=!1):this._importSheet(t),u._isOpened=!0,h&&!this._isExport&&!u._isImpSLoad&&u._isImported&&(c=h.model.sheets[t]._scrollTop,l=h.model.sheets[t]._scrollLeft,c>0&&this.XLScroll._vScroller(t).scroll(c),l>0&&this.XLScroll._hScroller(t).scroll(l),u._isImpSLoad=!0),a=this.getActiveCell(t),v=this.XLEdit.getPropertyValue(a.rowIndex,a.colIndex,"rule",t),v&&v.type==="list"&&this._setddlCell(),u._isRibCollapsed!=p&&(this._heightWidthCalculation(this.getActiveSheetIndex(),n.extend(!0,{},this.model.scrollSettings)),u._isRibCollapsed=p),this._isAutoWHMode&&(y=this._getElementDimension(),this.element.css({height:y.height,width:y.width})))}},insertSheet:function(){if(this.model.allowInsert&&!this.model.isReadOnly){var n=this.getPager(),t=n.ejPager("option","totalRecordsCount")+1;n.ejPager("option",{totalRecordsCount:t});this._isSheetInsert=!0;this.gotoPage(t,!0);this.setSheetFocus()}},_renameSheet:function(i){var r=this.element.find(".e-currentitem"),u=t.buildTag("input#"+this._id+"_Sheet_RenamePanel","",{width:r.width()+5+"px",padding:0},{type:"input",value:i||r.text(),maxlength:"31"});r.hide();u.insertAfter(r).select().focus();this._isSheetRename=!0;this.model.showRibbon&&this.XLRibbon._disableRibbonIcons();this.model.enableContextMenu&&n("#"+this._id+"_contextMenuFooter").data("ejMenu")._contextMenuEvents("_off")},deleteSheet:function(n){if(this.model.allowDelete&&!this.model.isReadOnly){var t=this.getActiveSheetIndex(),i=this._getSheetNames(!0).length;n=n||t;i>1?(n!==t&&this.gotoPage(n,!1),this.getObjectLength(this._dataContainer.sheets[n])?this._showAlertDlg("","SheetDeleteAlert","sheetDeleteActn",470):this._removeSheet(n)):this._showAlertDlg("Alert","SheetDeleteErrorAlert","",430)}},hideSheet:function(t){if(!this.model.isReadOnly){var i=this._getSheetNames(!0),u=this._getSheetNames(),r=n.isNumeric(t)?t:this._getSheetIndexByName(t)||this.getActiveSheetIndex();i.length>1?(u[r-1].isVisible=!1,this.gotoPage(this._getNxtVisibleSheet(r,null,i))):this._showAlertDlg("Alert","SheetDeleteErrorAlert","",377)}},unhideSheet:function(t){if(!this.model.isReadOnly){var r=this._getSheetNames(),i=n.isNumeric(t)?t:this._getSheetIndexByName(t);r[i-1].isVisible||(r[i-1].isVisible=!0,this.gotoPage(i));this.hideWaitingPopUp()}},_getNxtVisibleSheet:function(n,t,i){var r=this._getSheetNames(),u=r.length,f="<=",e=1,o=this._getSheetNames(!0),s=r[n-1].value===(i&&i[i.length-1].value||o[o.length-1].value);for((t||s)&&(u=0,f=">=",e=-1);this.operators[f](n,u);){if(r[n-1].isVisible)return n;n=n+e}},_renderSpreadSheetPager:function(){var r,i={},t=n(document.createElement("div"));return this.model.pageSettings.click=n.proxy(this._spreadSheetPagerClickHandler,this),this.model.pageSettings.totalRecordsCount=this.model.sheetCount,this.model.pageSettings.locale=this.model.locale,n.extend(i,this.model.pageSettings),i.currentPage=this.getActiveSheetIndex(),i.pageSize=1,i.showGotoPage=!1,this.setPager(t),t.ejPager(i),inst=t.data("ejPager"),inst._$first[0].title=this._getLocStr("Firstsheet"),inst._$last[0].title=this._getLocStr("Lastsheet"),inst._$next[0].title=this._getLocStr("Nextsheet"),inst._$prev[0].title=this._getLocStr("Prevsheet"),t.find(".e-parentmsgbar").remove(),r=t.find(".e-pagercontainer")[0],r.appendChild(t.find("a.e-PP")[0]),r.appendChild(t.find(".e-numericcontainer")[0]),r.appendChild(t.find("a.e-NP")[0]),t},_getPageCount:function(){var y=this.model.scrollSettings.isResponsive,p=this.model.pageSettings.pageCount;if(y){var r=0,h,i,u,c=this.getPager(),l,f,e=c.find(".e-currentitem"),w=c.find(".e-numericcontainer"),o=this._getSheetNames(),a=c.width(),s=250,b=w.children(":visible"),t=this.getActiveSheetIndex(),k=n(b[0]).data("index"),v=!0;for(i=this._browserDetails.name==="msie"&&this._browserDetails.version==="8.0",i?(u=n("#"+this._id+"_emptySpan"),u.css({"font-size":e.css("font-size"),"font-family":e.css("font-family")})):(l=document.createElement("canvas"),f=l.getContext("2d"),f.font=e.css("font-size")+" "+e.css("font-family"));t>k-1;){if(s+=i?u.text(o[t-1].text).width()+19:f.measureText(o[t-1].text).width+19,a<=s)return r||1;t--;r++}for(t=this.getActiveSheetIndex();v;){if(h=this.isUndefined(o[t])?this._getLocStr("Sheet")+t:o[t].text,s+=i?u.text(h).width()+19:f.measureText(h).width+19,a<=s){v=!1;break}t++;r++}return i&&this._refreshGlobalSpan(),r||1}return p},_spreadSheetPagerClickHandler:function(i){var o,e,s=!1,r=this,f,u=n(i.event.target),h=r.getPager().data("ejPager");if(r._filterClose(u),!r._hasClass(u[0],"e-disable")&&(!u.hasClass("e-new")||!r.model.exportSettings.password))return(r.model.allowComments&&r.XLComment._isCommentEdit||r.XLEdit._isEdit||!r.model.allowInsert||r.model.isReadOnly)&&(i.event&&(u.hasClass("e-pager")||u.hasClass("e-new"))||r.element.find(".e-field-validation-error").length)?void 0:(r.model.allowComments&&r.XLComment._isCommentEdit&&r.XLComment._updateCurCmntVal(),r.XLEdit._isEdit&&r.XLEdit.saveCell(),!t.isNullOrUndefined(i.event)&&(u.hasClass("e-prevpage")||u.hasClass("e-nextpage")||u.hasClass("e-firstpage")||u.hasClass("e-lastpage"))&&(i.currentPage=r._getNxtVisibleSheet(i.currentPage,u.hasClass("e-prevpage")||u.hasClass("e-lastpage"))),f={activeSheet:r.getActiveSheetIndex(),gotoSheet:i.currentPage,newSheet:i.event&&u.hasClass("e-new")},f.newSheet?(o=r.getPager(),e=o.ejPager("option","totalRecordsCount")+1,f.gotoSheet=e):f.gotoSheet=i.currentPage,i.currentPage=f.gotoSheet,!t.isNullOrUndefined(i.event)&&i.event.target.id.indexOf("_Sheet_RenamePanel")>-1||r._isSheetRename&&!r._updateSheetNames(null,!1)||h._prevPageNo===i.currentPage)?void 0:(f.newSheet&&(o.ejPager("option",{totalRecordsCount:e,currentPage:e}),i.currentPage=e,s=!0),r._pageClickArgs=n.extend(!0,{},f),r.gotoPage(i.currentPage,s),n(i.event.target).hasClass("e-pager")||(r._completeAction({reqType:"paging",sheetIndex:f.activeSheet,nSheetIndex:i.currentPage}),r._trigActionComplete({reqType:"paging",sheetIndex:f.activeSheet,newSheetIndex:i.currentPage})),!1)},_pageLoadComplete:function(t){var u,f,r=this.getSheet(t),e="option",o="checked",i=this._gotoPageArgs,s=this.model.allowSelection;if(s&&t!==i.prevSheetIdx&&(this.XLSelection._isGridBordering||this.XLSelection._isOutsideBordering)&&(this._getContent(i.prevSheetIdx).find("div:first-child").removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor"),this.XLSelection._isGridBordering=this.XLSelection._isOutsideBordering=!1),(!r._isImported||r._isLoaded)&&this.model.enableContextMenu&&this.XLCMenu.hideCMenu(),this._refreshSpreadSheetPager(i.newSheet),s&&this.getSheetElement(t).find(".e-ss-activeimg").length&&this.XLSelection._cleanUp(!0),this.model.showRibbon&&(this._updateRibbonTab(r._activeCell),this.isImport||(this.model.allowLockCell&&(r.isSheetProtected?this.XLRibbon._disableRibbonIcons():this.XLRibbon._enableRibbonIcons(),this.XLRibbon._updateRibbonIcons()),this.model.allowComments&&this.XLComment._updateCmntRibIcons()),n("#"+this._id+"_Ribbon_PageLayout_Show_Headings").ejCheckBox(e,o,r.showHeadings),n("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").ejCheckBox(e,o,r.showGridlines)),this.model.allowCellFormatting&&(u=this.getSheetElement(t).find(".e-content")[0],this.XLFormat._formatEnable?(this._removeClass(u,"e-ss-cursor"),this.addClass(u,"e-ss-fpcursor")):(this.addClass(u,"e-ss-cursor"),this._removeClass(u,"e-ss-fpcursor"))),this._pageClickArgs){if(this._pageClickArgs.activeSheet=this.getActiveSheetIndex(),this._trigger("pagerClick",this._pageClickArgs))return;this.model.scrollSettings.isResponsive&&this._isResized&&!this._resizeColl[t-1]&&(this._refreshSheetonResize(),this._resizeColl.toString().indexOf("f")<0&&(this._isResized=!1,this._resizeColl.fill(!1)))}this.hideWaitingPopUp();this._pageClickArgs=this._gotoPageArgs=null;f={gotoSheetIndex:i.gotoIndex,isNewSheet:i.newSheet,prevSheetIndex:i.prevSheetIdx,reqType:i.reqType};this._trigActionComplete(f)},_createTemplateElement:function(t,i){var r=document.createElement("script");return r.id=(this._id+t+i.field+n.inArray(i,this.getSheet(t).columns)+"_Template").split(" ").join(""),r.type="text/x-jsrender",r.text=i.templateContent?i.templateContent:n(i.templateID).html(),n("body").append(r),n(i.templateID).hide(),r},_refreshSpreadSheetPager:function(n){var t=this.getPager(),i={currentPage:this.getActiveSheetIndex()},u=t.height(),r;(this.isImport||this._isNew||t===null)&&(i.totalRecordsCount=this.model.sheetCount);(n||this._isInitLoad||this._isSheetInsert||this._isNew)&&(i.pageCount=this._getPageCount());t.ejPager("option",i).ejPager("refreshPager");this._updatePageContainer(t,i.currentPage);r=t.height();u!==r&&(i.pageCount=this._getPageCount(),t.ejPager("option",i).ejPager("refreshPager"),this._updatePageContainer(t,i.currentPage));this.model.allowInsert||this.addClass(document.getElementById(this._id+"_AddSheet"),"e-disable")},_updatePageContainer:function(t,i){var l,w,s,f,e,h,r=0,o=0,u=t.data("ejPager"),et=this.model.sheets,b=t.find(".e-numericcontainer").children(":visible"),k=u.model.pageCount,d=[u._$first[0],u._$prev[0]],g=["e-firstpagedisabled e-disable","e-firstpage e-default","e-prevpagedisabled e-disable","e-prevpage e-default"],nt=[u._$last[0],u._$next[0]],tt=["e-lastpagedisabled e-disable","e-lastpage e-default","e-nextpagedisabled e-disable","e-nextpage e-default"],it=b.length,ot=r+1===it;for(u._$next[0].className=u._$next[0].className.replace("-2x",""),u._$prev[0].className=u._$prev[0].className.replace("-2x","");r<it;){if(f=n(b[r]),s=f.data("index"),h=et[s].sheetInfo,e=h.text,ot){for(var v,st=t.outerWidth(),y,rt,p,ut=!0,c=e,ft=3,a=this._browserDetails.name==="msie"&&this._browserDetails.version==="8.0";ut;){if(a?(v=n("#"+this._id+"_emptySpan"),v.css({"font-size":f.css("font-size"),"font-family":f.css("font-family")}),y=248+(v.text(c).width()+19)):(rt=document.createElement("canvas"),p=rt.getContext("2d"),p.font=f.css("font-size")+" "+f.css("font-family"),y=248+(p.measureText(c).width+19)),st<=y&&e.length>=ft){c=e.slice(0,e.length-ft++)+"...";continue}ut=!1;e=c}a&&this._refreshGlobalSpan()}f.text(e);h.isVisible?w=s%k:f.hide();!l&&h.isVisible&&(l=s%k);r++}if(l===i)for(r=0;r<2;r++)this.addClass(d[r],g[o]),this._removeClass(d[r],g[o+1]),o+=2;if(o=0,w===i)for(r=0;r<2;r++)this.addClass(nt[r],tt[o]),this._removeClass(nt[r],tt[o+1]),o+=2},_updateSheetNames:function(i,r){var l,a,d,s,ht=this.getPager(),rt,v=ht.find(".e-currentitem"),y=this.model.sheets,g=n("#"+this._id+"_Sheet_RenamePanel"),ut=!0,b=[],nt,h,c,f,ft,et,ot,p,tt,u,o,e,w,st=[],k,it;if(t.isNullOrUndefined(i)&&(i=g.val().trim()),a=y[v.data("index")].sheetInfo.text,l={reqType:"renameSheet",prevName:a,newName:i},this._trigActionBegin(l)&&(r=!0),i=l.newName,r)return g.remove(),v.show(),this.model.showRibbon&&this.XLRibbon._enableRibbonIcons(),this.model.enableContextMenu&&n("#"+this._id+"_contextMenuFooter").data("ejMenu")._contextMenuEvents("_on"),this._isSheetRename=!1,!1;if(i.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*"))&&(i=!1),!i)return this._showAlertDlg("Alert",["SheetRenameEmptyAlert","SheetRenameEmptyCharExceedAlert","SheetRenameEmptySplCharAlert","SheetRenameEmptyBlankAlert"],"sheetRenameActn",500),!1;for(u=1,rt=y.length;u<rt;u++)v.text()!==y[u].sheetInfo.text&&i.toLowerCase()===y[u].sheetInfo.text.toLowerCase()&&(ut=!1);if(ut){if(this.model.enablePivotTable&&this.XLPivot._updateSheetName(i),y[v.data("index")].sheetInfo.text=i){g.remove();v.show();calcObj=this._calcEngine;k=calcObj.getDependentCells().items;for(it in k)k.hasOwnProperty(it)&&st.push(it);for(nt=st,h=this._getSheetNames(),u=0;u<nt.length;u++)for(c=k[nt[u]],o=0;o<c.length;o++){if(f=calcObj.getFormulaInfoTable().items[c[o]],f)for(f=f.getFormulaText(),e=0;e<h.length;e++)h[e].text!==h[e].value&&(p=new RegExp(h[e].value+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi"),f.match(p)&&(f=f.replace(p,e+"/"),b.push(e),tt=!0));if(tt){for(w=0;w<b.length;)p=new RegExp(b[w]+'/(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi"),f=f.replace(p,h[b[w]].text),w++;ft=calcObj.rowIndex(c[o])-1;et=calcObj.colIndex(c[o])-1;ot=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+(parseInt(c[o].split("!")[1])+1));this.XLEdit._updateDataContainer({rowIndex:ft,colIndex:et},{dataObj:{value:f},sheetIdx:ot});tt=!1}}this._isSheetRename=!1}this._refreshSpreadSheetPager(!0);this.model.allowFormulaBar&&this.updateFormulaBar();nMngr=this.model.nameManager;for(u in nMngr)s=nMngr[u].refersto,s&&s.indexOf(a)>-1&&(s=s.replace(/[\']/g,""),nMngr[u].refersto=s.replace(a,i.match(/\s/g)?"'"+i+"'":i));return this.model.showRibbon&&(this.XLRibbon._enableRibbonIcons(),d=n("#"+this._id+"_nmgrid").data("ejGrid"),d&&(d.refreshContent(),n("#"+this._id+"_nmrange").val(""))),this.model.enableContextMenu&&n("#"+this._id+"_contextMenuFooter").data("ejMenu")._contextMenuEvents("_on"),l={reqType:"renameSheet",prevName:a,newName:i},this._trigActionComplete(l),!0}this._showAlertDlg("Alert","SheetRenameAlert","sheetRenameActn",325)},_getSheetIndexByName:function(n){var i=this._getSheetNames(),t,r;for(n=n&&n.replace(/^'|'$/g,""),n&&(n=n.toLowerCase()),t=0,r=i.length;t<r;t++)if(i[t].text.toLowerCase()===n)return t+1;return!1},_removeSheet:function(t){var r=this.model.sheetCount,k=this._dataContainer.sheets,i,a=this.model.sheets,d,u,e,s,o,v=[],y,p,g,c,h,nt,w=[],f,b,l;if(r>1){if(c=a[t].sheetInfo.value,this._getAutoFillOptElem().appendTo(this.element),this.element.find("#"+this._id+"_"+c).remove(),r===this.getActiveSheetIndex()){for(i=1;i<r;i++)if(a[t-i].sheetInfo.isVisible){this.setActiveSheetIndex(t-i);break}}else this.setActiveSheetIndex(t);this._swapSheetDtCntr(t,r);r in k&&delete k[r];this._sheets.splice(r,1);a.splice(r,1);r=--this.model.sheetCount;this.getPager().ejPager("option",{totalRecordsCount:r,pageCount:this._getPageCount()});this.gotoPage(this.getActiveSheetIndex(),!1);this._getAutoFillOptElem().appendTo(this._getJSSheetContent(this.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content"));this._rebindScrollEvnt();h=this.model.nameManager;for(i in h)nt=h[i].refersto,nt.indexOf(c)>-1&&(w.push(h[i].name),h[i].refersto="#REF!");f=this._calcEngine;l=f.getDependentCells().items;for(i in l)l.hasOwnProperty(i)&&v.push(i);for(i=0;i<v.length;i++)for(e=l[v[i]],u=0;u<e.length;u++)if(s=f.getFormulaInfoTable().items[e[u]],p=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+(parseInt(e[u].split("!")[1])+1)),s&&p>-1){o=s.getFormulaText();y=new RegExp(c+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi");o.match(y)&&(o=o.replace(y,"#REF"),this.XLEdit._updateDataContainer({rowIndex:f.rowIndex(e[u])-1,colIndex:f.colIndex(e[u])-1},{dataObj:{value:o},sheetIdx:p}),f.refresh(s.getParsedFormula()));for(g in w)o.indexOf(w[g])>-1&&f.refresh(s.getParsedFormula())}if(this.model.showRibbon&&(b=n("#"+this._id+"_nmgrid").data("ejGrid"),b&&(b.refreshContent(),n("#"+this._id+"_nmrange").val(""))),d={sheetIndex:t,reqType:"remove-sheet"},this.clearUndoRedo(),this._trigActionComplete(d))return}},_rebindScrollEvnt:function(){for(var n=1;n<=this.model.sheetCount;n++)this.getSheet(n)._isLoaded&&(this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content").off("scroll"),this.element.find("#"+this._id+"_"+this.model.sheets[n].sheetInfo.value).find(".e-headercontent").off("scroll"),this._refreshScrollerEvent(n))},_getSheetNames:function(n){for(var u=[],i=this.model.sheets,t=1,r=i.length;t<r;t++)(this.isUndefined(n)||(!n||i[t].sheetInfo.isVisible)&&(n||!i[t].sheetInfo.isVisible))&&u.push(i[t].sheetInfo);return u},_initMoveCopyDlg:function(){var n=this._id+"_moveCopyDlg",i,r,f,e,o,s,u,h,c;i=t.buildTag("div#"+n,"",{display:"none"});r=t.buildTag("div#"+n+"_sheetContent.e-dlgctndiv e-dlg-fields",t.buildTag("label.e-dlg-fields",this._getLocStr("Beforesheet")));h=t.buildTag("div.e-dlg-fields");s=t.buildTag("ul#"+n+"_list");r.append(h.append(s));u=t.buildTag("input#"+n+"_createcopy");r.append(u);u.ejCheckBox({cssClass:"e-dlg-fields"});u.parent().append(t.buildTag("label",this._getLocStr("CreateaCopy"),{"margin-left":6}));i.append(r);o=t.buildTag("div#"+n+"_btndiv.e-dlg-btnfields");c=t.buildTag("div.e-dlg-btnctnr");f=t.buildTag("input#"+n+"_okbtn","");e=t.buildTag("input#"+n+"_cnlbtn");f.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,click:t.proxy(this._moveCopyBtnClick,this,"ok"),cssClass:"e-ss-okbtn",width:60});e.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._moveCopyBtnClick,this,"cancel"),showRoundedCorner:!0,width:60});o.append(c.append(f,e));i.append(o);this.element.append(i);i.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("MoveorCopy"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg e-ss-movedlg"});s.ejListBox({dataSource:this._getSheetNames(),height:"197px",width:"250px",fields:{text:"text",value:"value"}})},_renderMoveCopyDlg:function(){var r=n("#"+this._id+"_moveCopyDlg"),t=n("#"+this._id+"_moveCopyDlg_list").data("ejListBox"),i=this._getSheetNames();i.push({text:this._getLocStr("MoveToEnd"),value:this._getLocStr("MoveToEnd")});r.ejDialog("open");t.model.dataSource=i;t.option("fields",{dataSource:i});t.unSelectAll();t.selectItemByIndex(0)},_initUnhideDlg:function(){var n=this._id+"_UnhideDlg",i,r,u,f,e,o,s;i=t.buildTag("div#"+n,"",{display:"none"});r=t.buildTag("div#"+n+"_sheetContent.e-dlgctndiv e-dlg-fields",t.buildTag("label.e-dlg-fields",this._getLocStr("UnhideDlgText")));o=t.buildTag("ul#"+n+"_list");r.append(o);i.append(r);e=t.buildTag("div#"+n+"_btndiv.e-dlg-btnfields");s=t.buildTag("div.e-dlg-btnctnr");u=t.buildTag("input#"+n+"_okbtn");f=t.buildTag("input#"+n+"_cnlbtn");u.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:"25%",click:t.proxy(this._unhideBtnClick,this,"ok"),cssClass:"e-ss-okbtn"});f.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._unhideBtnClick,this,"cancel"),showRoundedCorner:!0,width:"25%"});e.append(s.append(u,f));i.append(e);this.element.append(i);i.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("UnhideSheet"),width:280,height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg"});o.ejListBox({dataSource:this._getSheetNames(),height:"197px",width:"250px",fields:{text:"text",value:"value"}})},_renderUnhideDlg:function(){var r=n("#"+this._id+"_UnhideDlg"),t=n("#"+this._id+"_UnhideDlg_list").data("ejListBox"),i=this._getSheetNames(!1);i.length>0&&(r.ejDialog("open"),t.model.dataSource=i,t.option("fields",{dataSource:i}),t.unselectAll(),t.selectItemByIndex(0))},_moveCopyBtnClick:function(i){switch(i){case"ok":var c,r,u,y,e,p=!1,l=2,f,o=n(this.element).find(".e-currentitem"),w=n("#"+this._id+"_moveCopyDlg_list").data("ejListBox"),h=n("#"+this._id+"_moveCopyDlg_createcopy").data("ejCheckBox"),v=w.getSelectedItems()[0].text,s=w.getIndexByText(v),a=this.model.sheets;if(!h.isChecked()&&v===o.text()){n("#"+this._id+"_moveCopyDlg").ejDialog("close");this.setSheetFocus();return}for(u=1;u<a.length;u++)v===a[u].sheetInfo.text&&(r=u),o.text()===a[u].sheetInfo.text&&(f=u);if(c={reqType:"moveSheet",toSheetIndex:s,fromSheetIndex:f,isCopy:h.isChecked()},this._trigActionBegin(c))return n("#"+this._id+"_moveCopyDlg").ejDialog("close"),!1;if(s=c.toSheetIndex,f=c.fromSheetIndex,h.isChecked()){for(o.text().match(".*[ ]+[(]+[0-9]+[)]$")===null?e=o.text()+" ("+l+")":o.text().lastIndexOf(" ")!==-1&&(l=parseInt(o.text().substring(o.text().lastIndexOf("(")+1,o.text().lastIndexOf(")"))),e=o.text().substring(0,o.text().lastIndexOf(" "))+" ("+l+")");!p;){for(e=e.substring(0,e.lastIndexOf(" "))+" ("+l+")",u=1,y=a.length;u<y;u++)e===a[u].sheetInfo.text&&l++;l===parseInt(e.substring(e.lastIndexOf("(")+1,e.lastIndexOf(")")))&&(p=!0)}this._copySheetProcess(f,e);f=this.model.sheetCount;t.isNullOrUndefined(r)&&(r=f)}else!t.isNullOrUndefined(r)&&r>f&&(r=r-1);if(t.isNullOrUndefined(r)&&(r=s),!h.isChecked()&&r===f){n("#"+this._id+"_moveCopyDlg").ejDialog("close");this.setSheetFocus();break}this._swapSheetDtCntr(f,r);n("#"+this._id+"_moveCopyDlg").ejDialog("close");r<=f&&(s=s+1);this.getPager().ejPager("option",{currentPage:s});this.gotoPage(s,!1);this._rebindScrollEvnt();c={reqType:"moveSheet",toSheetIndex:s,fromSheetIndex:f,isCopy:h.isChecked()};this._trigActionComplete(c);h._unChecked();h._isChecked=!1;this.setSheetFocus();break;case"cancel":n("#"+this._id+"_moveCopyDlg").ejDialog("close")}},_unhideBtnClick:function(t){if(t==="ok"){var i=n("#"+this._id+"_UnhideDlg_list").data("ejListBox");this.unhideSheet(i.getSelectedItems()[0].text)}n("#"+this._id+"_UnhideDlg").ejDialog("close")},_swapSheetDtCntr:function(n,t){var f=this._dataContainer.sheets,i=this.model.sheets,e=this._sheets,o=this._getLocStr("Sheet"),s=[{}],h,l=this._getSheetNames(),u,r,c;for(u in f)f.hasOwnProperty(u)&&(s[parseInt(i[u].sheetInfo.value.replace(o,""))]=f[u]);for(i.splice(t,0,i.splice(n,1)[0]),e.splice(t,0,e.splice(n,1)[0]),r=1,c=i.length;r<c;r++)h=parseInt(i[r].sheetInfo.value.replace(o,"")),this._dataContainer.sheets[r]=s[h];this.clearUndoRedo()},_copySheetProcess:function(t,i){var e,p,r,h,c,u,a=this.getPager(),v=a.ejPager("option","totalRecordsCount")+1,o=this.model.sheets,l,y,f,s;for(this._impData&&this.XLExport._renderAll(),a.ejPager("option",{totalRecordsCount:v,currentPage:v}),o.push(jQuery.extend(!0,{},o[t])),this._sheetCopy={isSheetCopy:!0,sheetContent:this._getContent(t).find(".e-table").clone(!0).get(0)},r=this.model.sheetCount+1,o[r].sheetInfo.text=i,h=o[r].sheetInfo.value=this._getLocStr("Sheet")+this._newSIndex,this._newSIndex++,this.setActiveSheetIndex(r),this._dataContainer.sheets[r]=n.extend(!0,{},this._dataContainer.sheets[t]),p=this._sheets[r]={_contentColGroup:null,_content:null,_sheetRowHeaderContent:null,_sheetHeader:null,_sheetRowHeader:null,_sheetContent:null,_Rows:null},this._initSheet(r),this.model.sheetCount++,this._sheetCopy={isSheetCopy:!1,sheetContent:null},this._calcEngine.registerGridAsSheet(h,h,this._calcID),c=o[r].shapeMngr.picture,s=this.getObjectLength(c),f=1;f<=s;f++)u=c[this._id+"_picture"+f],this.XLShape._createPicture(r,{rowIndex:u.rowIndex,colIndex:u.colIndex},this.getSheet(r).shapeMngr.sharedPics[u.data],u.top,u.left,u.width,u.height,null,u.bcolor,u.bstyle,u.bwidth);if(!this.model.scrollSettings.allowVirtualScrolling)for(l=this._getContent(r).find(".e-commentcell"),f=0,s=l.length;f<s;f++)y=n(l[f]),e=this._getCellIdx(n(".e-commentcell")[0]),y.removeClass("e-commentcell")&&this.XLComment.setComment([e.rowIndex,e.colIndex,e.rowIndex,e.colIndex],null,!1);this.model.allowComments&&this.XLComment._updateCmntArrowPos()},showActivationPanel:function(n){var i,t=this.getActiveSheetIndex(),r=this.getActivationPanel(),u=this.model.scrollSettings;if(!this.model.enablePivotTable||this._phoneMode)return!1;if(this.isUndefined(n))this._getContent(t).find(".e-ss-activepivot").length&&this.XLPivot._displayActPanel&&(this.model._isActPanelVisible=!0,this._setSheetWidthHeight(t,{width:this._responsiveWidth,height:this._responsiveHeight,isActPanel:!0},null,"refresh"),this._refreshActivationPanel());else if(i=this.getSheet(t).rangeSettings[n],i.showPanel){if(this._trigger("beforePanelOpen",{activationPanel:r,range:i,sheetIndex:t}))return;this.model._isActPanelVisible=!0;this._setSheetWidthHeight(t,{width:this._responsiveWidth,height:this._responsiveHeight,isActPanel:!0},null,"refresh");this._refreshActivationPanel()}},_refreshActivationPanel:function(){var n=this.getActivationPanel(),i=this.getMainPanel().height(),t=n.data("ejScroller"),r;n.width(this.model.activationPanelWidth-1).height(i);n.find(".e-ss-pivotfield").hide();n.find("#"+this._id+"_PivotTableSchema_"+this._getContent(this.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).show();n.find(".e-ss-pivotfield").width(this.model.activationPanelWidth-20);n.show();r=this.getActivationPanel().find("#"+this._id+"_PivotTableSchema_"+this._getContent(this.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).data("ejPivotSchemaDesigner");r._reSizeHandler();t&&(t.option({width:this.model.activationPanelWidth-1,height:i}),t.refresh())},hideActivationPanel:function(){var n=this.getActivationPanel(),t=this.model.scrollSettings;n.is(":visible")&&(n.find(".e-ss-pivotfield").hide(),this.model._isActPanelVisible=!1,n.hide(),this._isNew||this._setSheetWidthHeight(this.getActiveSheetIndex(),{width:this._responsiveWidth,height:this._responsiveHeight},null,"refresh"))},_addSheet:function(n){this._sheetSettings(n);this._dataContainer.sheets[n]={};this._initSheet(n);this._newSIndex++;this.model.sheetCount++},addNewSheet:function(){this.model.allowInsert&&!this.model.isReadOnly&&this.element.find(".e-pager .e-new").click()},_createFocusElement:function(){this.setFocusTopElem(n("<div class='e-focustop e-hide' ><\/div>"));this.setFocusRightElem(n("<div class='e-focusright e-hide' ><\/div>"));this.setFocusBottomElem(n("<div class='e-focusbottom e-hide' ><\/div>"));this.setFocusLeftElem(n("<div class='e-focusleft e-hide' ><\/div>"))},_createAutoFillElement:function(){var i,r=this._getJSSheetContent(this.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content");this.model.allowAutoFill&&(i=n("<div class='e-autofill e-hide'><\/div>"),r.append(i),this.setAutoFillElem(i));this.element.append(t.buildTag("ul.e-spreadsheet","",{width:"auto"},{id:this._id+"_ctxtmenu"}));i=n("<div class='e-splitspan e-hide' title="+this._getLocStr("AutoFillTitle")+"><button id="+this._id+"_dragfilloptionbtn type='button'><\/button><\/div>");r.append(i);this._setAutoFillOptElem(i);this._initializeSplitButton()},_initializeSplitButton:function(){this._getAutoFillOptElem().find("button").ejSplitButton({size:"normal",contentType:"imageonly",targetID:this._id+"_ctxtmenu",prefixIcon:"e-icon e-ss-autofill",isSeparator:!1,buttonMode:t.ButtonMode.Dropdown,imagePosition:t.ImagePosition.ImageLeft,arrowPosition:t.ArrowPosition.Right,fields:{dataSource:this._fillOptionMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},beforeOpen:n.proxy(this.model.allowAutoFill&&this.XLDragFill._autoFillClick,this),itemSelected:n.proxy(this.model.allowAutoFill&&this.XLDragFill._autoFillOptionClick,this),width:"42px",height:"24px",cssClass:"e-spreadsheet e-autofillbtn"})},_renderFormulaBar:function(t){var i,r="<div id="+this._id+"_formulabar class='e-formulabar' ><div id="+this._id+"_indexbox class='e-indexbox' title='"+this._getLocStr("NameBox")+"'><\/div><div class='e-inputbox' ><input id="+this._id+"_inputbox type='text' title='"+this._getLocStr("FormulaBar")+"'/><\/div><\/div>",u;t?this.model.showRibbon?n("#"+this._id+"_Ribbon").after(r):this.element.prepend(r):this.element.append(r);this._setIndexBox(n("#"+this._id+"_indexbox"));i=n("#"+this._id+"_inputbox");this._setInputBox(i);this.XLEdit._renderAutoComplete(i,"",26);this._alignFormulaBar();u=this.element.find(".e-formulabar").height();u>36&&(this._formulaHeight=u);this.model.isReadOnly&&(this.element.find(".e-formulabar")[0].disabled=!0)},_alignFormulaBar:function(n){var u=this.model.scrollSettings,i,r,t;n=n||this._responsiveWidth;this.element.find(".e-formulabar").width(u.isResponsive?n-2:n);n=parseInt(n);i=n/10;r=n-(i+24);t=this.element.find(".e-inputbox");t.hide();t.width(Math.floor(r));this.element.find(".e-indexbox").width(Math.floor(i));t.show()},hideFormulaBar:function(){n("#"+this._id+"_formulabar").hide()},showFormulaBar:function(){this.model.allowFormulaBar&&(n("#"+this._id+"_formulabar").show(),this.updateFormulaBar())},_getlocaleNumVal:function(n,i){if(n=typeof n!="object"&&Number(n)?Number(n):!t.isNullOrUndefined(n)&&typeof n!="object"?t.parseFloat(n+"",this.model.locale):null,n&&i){var r=t.preferredCulture(this.model.locale).numberFormat,u=n.toString();r["."]!="."&&u.indexOf(r["."])<0&&(n=u.replace(".",r["."]))}return n},updateFormulaBar:function(){if(!this.model.isReadOnly){var r,u,o,e=this.getActiveSheetIndex(),i=this.getSheet(e)._activeCell,f=this._getContent(e).find(".e-ss-activeimg")[0];u=this.getRangeData({range:[i.rowIndex,i.colIndex,i.rowIndex,i.colIndex],property:["value","value2","isLocked"]})[0];r=t.isNullOrUndefined(u)?"":t.isNullOrUndefined(u.value)?"":u.value;this._isDateTime(r)&&(r=u.value2);this.isNumber(r)&&(r=this._getlocaleNumVal(r,!0));this._getInputBox().val(r);this.XLEdit.getPropertyValue(i.rowIndex,i.colIndex,"isReadOnly")||this.model.allowLockCell&&this.getSheet(e).isSheetProtected&&u.isLocked?this._getInputBox().attr("readonly","readonly"):this._getInputBox().prop("readonly",!1);o=f&&(f.id.indexOf(this._id+"_picture")>-1||f.id.indexOf(this._id+"_chart")>-1)?f.id.replace(n(f).data("parentID")+"_",""):this._generateHeaderText(i.colIndex+1)+(i.rowIndex+1);this._getIndexBox().html(o)}},_initSelection:function(){var r,i=this.model,f=this.getActiveSheetIndex(),n=this.getSheet(f),u=this._getJSSheetContent(f).find(".e-spreadsheetcontentcontainer > .e-content"),e=i.selectionSettings.selectionType,o=t.Spreadsheet.SelectionType,s=i.selectionSettings.activeCell;i.allowSelection&&(this.getFocusTopElem()||this._createFocusElement(),u.append(this.getFocusTopElem(),this.getFocusRightElem(),this.getFocusBottomElem(),this.getFocusLeftElem()),s&&(r=this.getRangeIndices(s),!this.isRange(r)&&r[0]<n.rowCount&&r[1]<n.colCount&&(n._startCell=n._endCell=n._activeCell={rowIndex:r[0],colIndex:r[1]})),(!n._isImported||n._isLoaded)&&n._selectedCells.length?(this.XLSelection.selectRange(n._selectedCells[0],n._selectedCells[n._selectedCells.length-1]),this.XLSelection._refreshBorder()):(this.XLSelection._processBoundary(),e===o.Row||n._isRowSelected?this.XLSelection.selectRows(n._startCell.rowIndex,n._endCell.rowIndex):e===o.Column||n._isColSelected?this.XLSelection.selectColumns(n._startCell.colIndex,n._endCell.colIndex):this.XLSelection.selectRange(n._startCell,n._endCell)));i.allowAutoFill&&(this.getAutoFillElem()||this._createAutoFillElement(),this.getAutoFillElem().appendTo(u),this.XLDragFill.positionAutoFillElement(),i.autoFillSettings.showFillOptions&&i.allowAutoFill&&(this._getAutoFillOptElem().appendTo(u),this.XLDragFill.hideAutoFillOptions()));i.allowSelection&&n._isFreezed&&this.XLFreeze._refreshSelection()},_updateRibbonTab:function(t){var i,u,r=this.getActiveSheetIndex(),o=n("#"+this._id+"_Ribbon").data("ejRibbon"),f=this.XLRibbon,s=this.element.find(".e-ribbon .e-contextual a:visible"),e=s.length,h=o.element.find("#"+this._id+"_Ribbon_togglebutton");if(t&&(u=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"tableName",r)),e)while(e--)o.hideTab(s[e].text);f._toggleAnalyzeTab();h.is(":visible")&&h.hasClass("e-ribbonpin")&&this._refreshSheetonResize();i=this._getContent(r).find(".e-ss-activeimg");i.length?i[0].id.indexOf("chart")>-1?this.XLRibbon._chartDesignTabUpdate(i):this.XLRibbon._formatTabUpdate():u?f._designTabUpdate(this._getTableID(u),t):this._getContent(r).find(".e-ss-activepivot").length&&(f._analyzeTabUpdate(),this.XLSelection._cleanUp(!0),this.getActivationPanel().find("#"+this._id+"_PivotTableSchema_"+this._getContent(r).find(".e-ss-activepivot")[0].id).show(),this.showActivationPanel())},_updateCellType:function(){var n,i=t.Spreadsheet.CellType;for(n in i)this._dataContainer.cellType.push(i[n])},_updateFormulaCollection:function(){var n,i=this._calcEngine.getLibraryFunctions(),t=[];for(n in i.items)t.push({text:"="+n,display:n});this._formulaCollection=t},_renderScroller:function(n,t,i){this.XLScroll._createScroller(n,t,i);this._refreshScrollerEvent(n)},_refreshScrollerEvent:function(i){this._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").scroll(t.proxy(function(t){var i=this.getActiveSheetIndex(),r=this.getSheet(i),u=this._isFrozen(this.getFrozenColumns(i))?n(t.target).scrollLeft():r._scrollLeft;this._getJSSheetHeader(i).find(".e-headercontent").scrollLeft(u);this._getJSSheetRowHeaderContent(i).scrollTop(n(t.currentTarget).scrollTop())},this));this.element.find("#"+this._id+"_"+this.model.sheets[i].sheetInfo.value).find(".e-headercontent").scroll(t.proxy(function(t){var i=this.getActiveSheetIndex(),r=this._isFrozen(this.getFrozenColumns(i))?n(t.target).scrollLeft():this.getSheet(i)._scrollLeft;this._getContent(i).find(".e-content").scrollLeft(r);this.getSheet(i)._scrollLeft=this._getContent(i).find(".e-content").scrollLeft()},this))},_clickHandler:function(i){if(this.XLEdit._isFEdit=!1,this._hasClass(i.target,"e-ssfilter"))this._excelFilter._openedFltr&&n(this._excelFilter._openedFltr).is(":visible")?this._excelFilter.closeXFDialog():this.XLFilter._filterClickHandler(i);else{if(this._isExport||!this.model.cellClick)return!1;var o,r=i.target,s=this.getActiveSheetIndex(),u,f,e;if(i.target.tagName==="TD"&&n(i.target).parents("div")[0].className.indexOf("e-content")>-1&&i.target.className.indexOf("e-rowcell")>-1&&n(i.target).find(".e-chk-image").length<1){if(u=r.cellIndex,f=n.inArray(n(r).closest("tr").get(0),this.getRows(s)[1]),e=this.getSheet(s).columns[u],o={columnName:e.field,value:this.XLEdit.getPropertyValue(f,u),columnIndex:u,rowIndex:f,columnObject:e,cell:r,eventArgs:i,event:i,target:i.target},this._trigger("cellClick",o))return}else if(!t.isNullOrUndefined(n(i.target).parents("div"))&&n(i.target).parents("div")[0].className.indexOf("e-content")>-1&&i.target.className.indexOf("e-rowcell")>-1&&n(i.target).find(".e-chk-image").length<1&&(r=n(i.target).parents("td").get(0),!t.isNullOrUndefined(r)&&(u=r.cellIndex,f=n.inArray(n(r).closest("tr").get(0),this.getRows(s)[1]),e=this.getSheet(s).columns[u],o={columnName:e.field,value:this.XLEdit.getPropertyValue(f,u),columnIndex:u,rowIndex:f,columnObject:e,cell:r,eventArgs:i,event:i,target:i.target},this._trigger("cellClick",o))))return}},_wireEvents:function(t){var i=this.element,r=this._id;this.model.enableTouch&&parseInt(this._browserDetails.version)>8?this._wireTouchEvts("_on"):this._wireTouchEvts("_off");this[t](i,"mousedown",".e-spreadsheetcontentcontainer .e-content, .e-spreadsheetrowheader, .e-spreadsheetheader, .e-spreadsheetactpanel, .e-ribbon, .e-spreadsheetcontentcontainer .e-vscroll, .e-spreadsheetcontentcontainer .e-hscroll",this._mouseDownHandler);this[t](i,"mousemove",this._mouseMoveHandler);this[t](i,"mouseup",this._mouseUpHandler);this[t](i,"keydown",this._keyDownHandler);this[t](i,"keyup",this._keyUpHandler);this[t](i,"click",".e-spreadsheetcontentcontainer .e-content,.e-spreadsheetrowheader,.e-spreadsheetheader,.e-spreadsheetactpanel, .e-ss-object",this._clickHandler);this[t](i,n.isFunction(n.fn.doubletap)&&this.model.enableTouch&&parseInt(this._browserDetails.version)>8&&!this._browserDetails.isMSPointerEnabled?"doubletap":"dblclick",".e-spreadsheetcontentcontainer, .e-spreadsheetheader, .e-spreadsheetrowheader, .e-numericcontainer .e-numericitem",this._dblClickHandler);this[t](i,"mouseleave",".e-spreadsheetrowheader, .e-spreadsheetheader, .e-viewhdrlbl, .e-vheading, .e-viewlinlbl, .e-vgridlines",this._mouseLeaveHandler);this[t](i,"mouseover",".e-spreadsheetcontentcontainer .e-content .e-rowcell, .e-viewhdrlbl, .e-vheading, .e-viewlinlbl, .e-vgridlines, .e-rowheadercontent, .e-vscrollbar, .e-hscrollbar, .e-spreadsheetfooter, .e-spreadsheetheader",this._mouseHoverHandler);this.model.allowFormulaBar&&this[t](this._getInputBox(),"input",this.XLEdit._formulaBoxInputChange);this[t](n(".e-"+r+".e-chartcell"),"click",this._chartClickHandler);this[t](n("#"+r+"_cellstyles"),"click",this._cellStyleClick);this[t](n("#"+r+"_formatastable"),"click",this._formatAsTableClick);this[t](n("#"+r+"_nmuseinformula"),"click",".e-nmuseinformularow",this._useInFormulaClick);this.model.scrollSettings.allowScrolling&&this[t](this.element.find(".e-spreadsheet-list"),"mousewheel DOMMouseScroll",n.proxy(this.XLScroll._spreadMouseWheel,this.XLScroll));this.model.scrollSettings.isResponsive&&this[t](n(window),"resize",n.proxy(this._resizeHandler,this))},_wireTouchEvts:function(n){(this._browserDetails.name!="msie"||["11.0","10.0"].indexOf(this._browserDetails.version)===-1)&&this[n](this.element,this._getBrowserEvt(),".e-spreadsheetcontentcontainer .e-content, .e-spreadsheetrowheader, .e-spreadsheetheader, .e-spreadsheetactpanel, .e-ribbon, .e-spreadsheetcontentcontainer .e-vscroll, .e-spreadsheetcontentcontainer .e-hscroll",this._mouseDownHandler);this[n](this.element,this._getBrowserEvt("move"),this._mouseMoveHandler);this[n](this.element,this._getBrowserEvt("end"),this._mouseUpHandler);this[n](this.element,"swipeleft swiperight",".e-spreadsheetfooter",this._swipeHandler)},_getBrowserEvt:function(n,t){return n==="move"?this._browserDetails.isMSPointerEnabled?this._browserDetails.pointerEnabled?"pointermove":"MSPointerMove":t?"mousemove":"touchmove":n==="end"?this._browserDetails.isMSPointerEnabled?this._browserDetails.pointerEnabled?"pointerup":"MSPointerUp":t?"mouseup":"touchend":this._browserDetails.isMSPointerEnabled?this._browserDetails.pointerEnabled?"pointerdown":"MSPointerDown":"touchstart"},_swipeHandler:function(n){var t=this.getActiveSheetIndex();this.gotoPage(n.type==="swiperight"?--t:++t)},_isTouchEvent:function(n){return this.model.enableTouch&&(n.type.indexOf("touch")>-1||n.type.indexOf("pointer")>-1)&&n.originalEvent.pointerType!=="mouse"&&n.originalEvent.pointerType!==4?!0:!1},_getOriginalEvt:function(n){return n.originalEvent.changedTouches?n.originalEvent.changedTouches[0]:n.originalEvent},_allChartType:function(t){n("#"+this._id+"_allchart").find(".e-chartimg").removeClass("e-chartselect");n(t.target).addClass("e-chartselect")},refreshSpreadsheet:function(){this._responsiveHeight>350&&(this._refreshSheetonResize(),this.model.showRibbon&&n("#"+this._id+"_Ribbon").data("ejRibbon")._ribbonResize())},_resizeHandler:function(){var t,n=this;n.element.is(":hidden")||(t&&clearTimeout(t),t=setTimeout(function(){n._refreshSheetonResize();for(var t=1,i=n.model.sheets.length;t<i;t++)n.getSheet(t)._isResized=t!=n.getActiveSheetIndex()},100))},_refreshSheetonResize:function(){var i=this.getActiveSheetIndex(),u,h=n(".e-menu:visible[id^="+this._id+"], .e-ddl-popup:visible[id^="+this._id+"]"),t,r,c=["CFormat","Validation","PageSize","FPane","Ins","Del","FindRep"],e,l,v=this._phoneMode,o,s,f,a;if(this._resizeColl[i-1]=this._isResized=!0,this.element.find(".e-inputbox").hide(),this.model.enablePivotTable&&this.hideActivationPanel(),this._phoneMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth<420,this._tabMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth>419&&document.documentElement.clientWidth<617,u={width:this._responsiveWidth,height:this._responsiveHeight},this.model.showRibbon&&(this._tabMode||this._responsiveHeight<280)&&n("#"+this._id+"_Ribbon").ejRibbon("collapse"),this._refreshSheetWithScreen(i),this._updateResponsiveSettings(),this._initViewPort(i),this.refreshContent(i),u.width=this._responsiveWidth,u.height=this._responsiveHeight,this._setSheetWidthHeight(i,u,null,"refresh"),contentrows=this._getContTBody(i).find("tr"),rowhdrrows=this._getRowHdrTBody(i).find("tr"),this.setRows([rowhdrrows,contentrows],i),this._dlgWidth=this._phoneMode||this._tabMode||this._responsiveWidth<350?this._responsiveWidth-2:this._responsiveWidth/1.5,this._dlgHeight=this._phoneMode||this._tabMode||this._responsiveHeight<350?this._responsiveHeight-2:this._responsiveHeight/1.2,this.model._isActPanelVisible&&this._refreshActivationPanel(),this.element.find(".e-inputbox").show(),this.model.showPager&&(this._isSheetRename&&(e=this.getPager().find("#"+this._id+"_Sheet_RenamePanel"),l=e.val(),e.remove()),this._refreshSpreadSheetPager(!0),this._isSheetRename&&this._renameSheet(l)),this._phoneMode&&(n("#"+this._id+"_CFormat").css("width",""),n("#"+this._id+"_Ribbon_Border").css("width",""),n("#"+this._id+"_indexbox").css({"text-overflow":"ellipsis",overflow:"hidden"})),this.model.showRibbon&&(this.XLRibbon._refreshBackstageHeight(),this._phoneMode&&!v&&this.XLRibbon._hideRibbonElem()),h.length&&(t=h[0].id.split("_",3),t.indexOf("Ribbon")===-1&&t.splice(1,0,"Ribbon"),t[2]=c.indexOf(t[2])>-1?["Home_Styles_ConditionalFormatting","Data_DataTools_DataValidationOptions","PageLayout_PageLayout_PageSizeOptions","Others_Window_FreezePanes","Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Editing_FindSelect"][c.indexOf(t[2])]:t[2].toLowerCase(),t=t.join("_"),t.length&&(r=n("#"+t),r.hasClass("e-splitbutton")&&r.ejSplitButton("hide"),r.hasClass("e-dropdownlist")&&r.ejDropDownList("hidePopup"))),this._isResized=!1,this._isRibbonDestroyed){if(o=n("#"+this._id+"_Ribbon").ejRibbon("instance"),this.model.ribbonSettings.enableOnDemand)tabText=o.getTabText(o.model.selectedItemIndex),this.XLRibbon._createTabControls(tabText);else for(s=[this._getLocStr("HOME"),this._getLocStr("DATATAB"),this._getLocStr("PAGELAYOUT"),this._getLocStr("OTHERS")],f=0,a=s.length;f<a;f++)this.XLRibbon._updateRibCustomCss(s[f]);this._on(n(".e-"+this._id+".e-chartcell"),"click",this._chartClickHandler);this._on(n("#"+this._id+"_cellstyles"),"click",this._cellStyleClick);this._on(n("#"+this._id+"_formatastable"),"click",this._formatAsTableClick)}this._isRibbonDestroyed=!1;this._trigger("refresh")},_chartClickHandler:function(t){var i=n(t.target),r=n.extend(!0,{},n(t.target).data());i.parents().eq(1).hide();this.XLChart.createChart(null,r)},_useInFormulaClick:function(t){var i,r,e="=",o=!1,u=t.target.textContent,c=this.getActiveSheetIndex(),s=this.getActiveCell(c),f=this.XLEdit._editElem,h=f.text();if(this.XLEdit.editCell(s.rowIndex,s.colIndex,!0),h===e)f.text(e+u);else{if(r=this.XLDragFill._parseFormula(h),i=r.length,i){while(i--)if(r[i]===","||r[i]==="("){r.splice(i+1,0,u);o=!0;break}else if(this._isCellReference(r[i])||this.isNumber(r[i])){r[i]=u;o=!0;break}u=o?r.join(""):u}f.text(e+u)}f.focusEnd();n("#"+this._id+"_nmuseinformula").hide()},_formatAsTableClick:function(t){var u,f,i=t.target,e=this.getActiveSheetIndex(),o=this.getSheet(e),r=o._selectedCells;r.length!==0&&(i.parentNode.className==="e-formatastablecell"&&(u=this.XLEdit.getPropertyValue(r[0].rowIndex,r[0].colIndex,"tableName",e),this._showDialog(this._id+"_Ribbon_Insert_Tables_Table"),u?(this.XLFormat._formatAsTableStyle=this._FATStyles[i.parentNode.id.replace(/ /g,"")],this.XLFormat._createTable(this._getTableID(u),this.XLFormat._formatAsTableStyle)):r.length>1?(f=n("#"+this._id+"_fatname"),n("#"+this._id+"_fatnamedlg").ejDialog("open"),n("#"+this._id+"_fatheader").data("ejCheckBox").option("checked",!1),f.val("Table"+this._tableCnt).focus().setInputPos(f.val().length),this.model.allowCellFormatting&&(this.XLFormat._formatAsTableStyle=this._FATStyles[i.parentNode.id.replace(/ /g,"")])):this._showAlertDlg("Alert","FormatAsTableAlert",null,445)),(i.className.indexOf("back")>-1||i.parentNode.className==="e-formatastablecell")&&n("#"+this._id+"_Ribbon_Home_Styles_FormatAsTable").length&&n("#"+this._id+"_Ribbon_Home_Styles_FormatAsTable").data("ejSplitButton")._hidePopup())},_borderSelectionClick:function(t){var r={ID:t.target.parentNode.id},u,f=t.target,e=this.getActiveSheetIndex(),i=this.getSheet(e)._selectedCells;i.length!==0&&(this._borderStyles.indexOf(r.ID)>-1&&this.XLRibbon._updateBordeStyle(r),hexcode=this._borderColor||"#000000",u=this._getAlphaRange(e,i[0].rowIndex,i[0].colIndex,i[i.length-1].rowIndex,i[i.length-1].colIndex),this.model.allowSelection&&(this.XLSelection._isOutsideBordering||this.XLSelection._isGridBordering)?!(this._borderStyles.indexOf(r.ID)>-1)&&r.ID.indexOf("bordercolor")<0&&(this.XLSelection._isOutsideBordering=this.XLSelection._isGridBordering=!1):this.setBorder({type:r.ID,color:hexcode,style:this._borderStyle},u),(f.className.indexOf("back")>-1||f.parentNode.className==="e-bordercell")&&n("#"+this._id+"_bordercontainer").hide())},_getTableID:function(n,t){var i,r=this.getSheet(this.getActiveSheetIndex()).tableManager;if(t){for(i in r)if(t===r[i].name)return Number(i)}else for(i in r)if(n.indexOf("e-table"+i)>-1)return Number(i)},_cellStyleClick:function(t){var i=this.model.sheets[this.getActiveSheetIndex()].selectedRange,r=t.target.className,f=this.XLFormat.getFormatClass(r),u={range:i,sheetIndex:this.getActiveSheetIndex(),reqType:"cell-styles",opr:t.target.innerText,beforeFormat:this.getRangeData({range:i,property:["format","formats"]})};r.indexOf("e-cellstylecell")>-1&&this.XLFormat.updateUniqueFormat(f,i,t.target.innerText);(r.indexOf("e-cellstylecell")>-1||r.indexOf("back")>-1)&&n("#"+this._id+"_Ribbon_Home_Styles_CellStyles").length&&n("#"+this._id+"_Ribbon_Home_Styles_CellStyles").data("ejSplitButton")._hidePopup();u.afterFormat=this.getRangeData({range:i,property:["format","formats"]});this.isUndoRedo||(this._completeAction(u),this._trigActionComplete(u));this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()},_mouseHoverHandler:function(t){var i=t.target,r;this._hasClass(t.target,"e-viewhdrlbl")||this._hasClass(t.target,"e-vheading")?this.element.find(".e-vheading .e-chk-act, .e-vheading .e-chk-inact").addClass("e-chkhover"):this._hasClass(t.target,"e-viewlinlbl")||this._hasClass(t.target,"e-vgridlines")?this.element.find(".e-vgridlines .e-chk-act, .e-vgridlines .e-chk-inact").addClass("e-chkhover"):this.model.allowDragAndDrop&&this.XLDragDrop._allowDragAndDrop&&(n(t.target).parents(".e-vscrollbar").length>0||t.target.className.indexOf("e-rowheader")>-1||n(t.target).parents(".e-spreadsheetfooter").length>0||t.target.className.indexOf("e-headercell")>-1||t.target.className.indexOf("e-spreadsheetfooter")>-1||n(t.target).parents(".e-hscrollbar").length>0||this.getSheet()._isFreezed&&t.target.className.indexOf("e-rowcell")>-1)?this.XLDragDrop._scrollHover(t):this._hasClass(t.target,"e-rowcell")&&(r=this._getCellIdx(i),this._trigger("cellHover",{target:i,event:t,cellIndex:r}))},_mouseDownHandler:function(i){var o,a,y,p,f,s,h,w,b,k,g=!0,nt=!0,v="e-ss-object",c="e-ss-pivot",r=i.target,u=n(r),e=this.getActiveSheetIndex(),d=this.getSheet(e),tt=this.getSheetElement(e),l=n("#"+this._id+"_Ribbon").data("ejRibbon");if(i.currentTarget.className.indexOf("e-ribbon")<0&&this.element.find(".e-bordercontainer").hide(),this.element.find("#"+this._id+"ddl_popup").has(r).length)return!1;if(this._isTouchEvt=this._isTouchEvent(i),this._isTouchEvt&&(this._touchArgs=i,this._startXY=this._setXY(i,navigator.userAgent.indexOf("WebKit")>-1),this.model.allowDragAndDrop&&this.XLDragDrop._dragtouch(this._startXY[0],this._startXY[1]),!this._hasClass(r,"e-autofill")&&this.model.allowAutoFill&&(y=this._hasClass(r,"e-headercell")?10:20,o=this._setXY(i),a=o[1],o=o[0],o=Math.abs(o-this.getAutoFillElem().offset().left),a=Math.abs(a-this.getAutoFillElem().offset().top),o<=y&&o>=0&&a<=y&&a>=0&&(u=this.getAutoFillElem(),r=i.target=u[0]))),u.parents(".e-ribbon").length||u.parents(".e-vscroll").length||u.parents(".e-hscroll").length)this._excelFilter&&(this.XLFilter._isSearchEdit=!1,this._excelFilter.closeXFDialog());else if(this._hasClass(r,"e-ssddl"))this._ddlopen(i);else{if(i.target=this._changeTargetWithOffset(i),this.model.allowCharts&&d._isChartBorderDrawn&&this.XLChart._clearChartRange(this._arrayAsString(this._chartBorder)),(this.model.pictureSettings.allowPictures||this.model.allowCharts)&&(u.hasClass(v)||n(u).parents("."+v).length)?(u.hasClass(v)||(r=i.target=n(u).parents("."+v)[0]),this.XLShape._shapeMouseDown(i)):(nt=!1,this.XLShape._shapeROStart&&this.XLShape._shapeRSStart||this._getContent(e).find(".e-ss-activeimg").removeClass("e-ss-activeimg e-ss-imgcresize e-ss-imgrresize")),(r.nodeName==="TD"||r.nodeName==="TH")&&(this.XLRibbon._isPanelVisible=!1),this.model.enablePivotTable&&(this._isPvtNameEdit&&(this._isPvtNameEdit=!1,this.XLPivot._changePvtName()),u.hasClass(c)||u.parents("."+c).length?(u.hasClass(c)||(r=i.target=u.parents("."+c)[0]),this.XLPivot._pivotMouseDown(i)):u.parents(".e-ss-pivotfield").length||u.hasClass("e-ss-pivotfield")||u.hasClass("e-vhandle")||u.hasClass("e-hhandle")||u.css("cursor")==="col-resize"||(this.hideActivationPanel(),this.getSheetElement(e).find(".e-ss-activepivot").removeClass("e-ss-activepivot"))),w=r.className,r.id.indexOf("picture")===-1&&this.model.showRibbon&&(l.model.selectedItemIndex===this.XLRibbon._getTabIndex("format")||l.isVisible(this._getLocStr("FORMAT")))&&this.XLRibbon._toggleFormatTab(),this.model.showRibbon&&r.id.indexOf("chart")>-1?this.XLRibbon._chartDesignTabUpdate(n(r)):this.model.showRibbon&&(l.model.selectedItemIndex===this.XLRibbon._getTabIndex("cdesign")||l.isVisible(this._getLocStr("CHARTDESIGN")))&&this.XLRibbon._toggleChartDesignTab(),this.XLEdit._isEdit&&r.nodeName!="TD"&&!this._hasClass(r,"e-autofill"))return;if(this.model.allowDragAndDrop&&this.XLDragDrop._isDragAndDropStart&&w!=="e-autofill"&&w.indexOf("e-filterspan")<0&&this.XLDragDrop._dMouseDown(i),this.model.allowResizing&&!this.XLEdit._isEdit&&(n(r).hasClass("e-headercelldiv")||n(r).hasClass("e-headercell")?this.XLResize._headerMouseDown(i):n(r).hasClass("e-rowheader")?this.XLResize._rowMouseDown(i):(n(r).hasClass("e-spreadsheetactpanel")||n(r).parents(".e-spreadsheetactpanel").length)&&this.XLResize._apMouseDown(i)),n(r).parents("div.e-spreadsheetactpanel").length>0)return;if(this.model.allowEditing&&this.XLEdit._editElem.html()==="="&&(this._isFormulaSuggestion=!1,this.XLEdit._isFormulaEdit=!0),g=this.XLEdit._isEdit?(this._isFormulaSuggestion||!this.XLEdit._isFormulaEdit)&&this.XLEdit.saveCell():!0,!g&&!this.XLEdit._isFormulaEdit)return!1;this.model.allowComments&&!u.hasClass("e-pager")&&this.getSheetElement(e).find(".e-commentcell").length&&this.XLComment._commentMouseDownHandler(i);r.tagName!=="SPAN"&&r.tagName!=="A"||t.isNullOrUndefined(u.parent("td")[0])?r.tagName==="TD"&&this._hasClass(r,"e-rowcell")?(s=r,f=this._getCellIdx(s),this.model.showRibbon&&this.XLRibbon.updateRibbonIcons()):f=this.getActiveCell():(s=u.parent("td")[0],f=this._getCellIdx(s));r.tagName==="A"?(d._activeCell=f,this.model.allowSelection&&(this.XLSelection.selectRange(f,f),this.XLDragFill.positionAutoFillElement()),i.which!==3&&this._hlClick(this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"hyperlink",e))):(i.button!==2||i.which!==3||this.getSheetElement(e).find(".e-selected, .e-colselected .e-headercelldiv, .e-rowselected").index(r)===-1)&&this.model.allowSelection&&!nt&&(t.isNullOrUndefined(this.XLDragDrop)||!this.XLDragDrop._allowDragAndDrop)&&(this.XLResize&&this.XLResize._resizeStart||u.hasClass("e-comment-txtarea")||u.hasClass(c)||n(u).parents("."+c).length||this.XLSelection._selectionMouseDownHandler(i));this._filterClose(i.target);this._undoInputobj={};r.tagName==="TD"&&n(r).parents("div")[0].className==="e-content"&&this.displayActivationPanel(this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"range"));r.tagName==="TD"&&r.className.indexOf("e-rowheader")<0&&(t.isNullOrUndefined(this._ddlCell)||(this.element.find("#"+this._id+"ddl").ejDropDownList("hidePopup"),this.element.find("#"+this._id+"ddlspan").remove(),this._ddlCell=null));r.tagName==="TD"&&this._hasClass(r,"e-rowcell")&&(k=this._getCellIdx(r),t.isNullOrUndefined(this.XLEdit.getPropertyValue(k.rowIndex,k.colIndex,"rule",e))||this._setddlCell(i));this._isTableRename&&(this.XLFormat._renameTable(this._tableClassName),this._isTableRename=!1);this._isSheetRename&&this._updateSheetNames(null,!1);this.element.find("#"+this._id+"ddl").ejDropDownList("hidePopup");this._hasClass(r,"e-rowcell")&&(b=this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"tableName",e));b?(p=this._getTableID(b),this.isNumber(p)&&this.XLRibbon._designTabUpdate(p,f)):this.model.showRibbon&&(l.model.selectedItemIndex===this.XLRibbon._getTabIndex("design")||l.isVisible(this._getLocStr("Design")))&&this.XLRibbon._toggleDesignTab(f);this.model.allowEditing&&(s=d._activeCell,this.XLEdit._isEdit&&i.target.id!==this._id+"_inputbox"&&(h=n(i.target).hasClass("e-ss-input")||!this.XLEdit._isFBarFocused?this.element.find("#"+this._id+"_Edit"):this._getInputBox(),h&&(i.target.id!==h[0].id&&h.focus().setInputPos(h[0].selectionStart,h[0].selectionEnd),h.hasClass("e-ss-input")&&(this.XLEdit._isFBarFocused=!1))),this.model.allowComments&&this.XLComment._isCommentEdit||this._isSheetRename||i.target.id!==this._id+"_inputbox"||(i.target.readOnly?this.setSheetFocus():(this.XLEdit._isEdit||this.XLEdit.editCell(s.rowIndex,s.colIndex,!0),this._getInputBox().focus(),this.XLEdit._isFBarFocused=!0)))}},_renderDDownList:function(){this.element.append(t.buildTag("input.e-"+this._id+"-ddl","","",{id:this._id+"ddl",style:"display:none"}));n("#"+this._id+"ddl").ejDropDownList({fields:{id:"Types",text:"text",value:"text"},beforePopupShown:n.proxy(this._drppopupshow,this),cssClass:"e-"+this._id+"-ddl e-ss-ddlwrap",width:.1,height:.1,change:n.proxy(this._changeddl,this)});n(document.body).append(n("#"+this._id+"ddl_popup_wrapper"))},_setddlCell:function(i){var v,u=[],h=[],d=[],y,a,f,p,w=this.getActiveSheetIndex(),g,b,e,r,l,o,k,s,c;if((t.isNullOrUndefined(i)||i.type!=="mousedown"?(f=this.getActiveCell(),p=n("#"+this._id+"GroupPanel").find("div.e-content")[0]):(f=this._getCellIdx(i.target),p=i.currentTarget),a=this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"rule",w),a)&&(y=a.customVal.split("_"),a&&y[1]==="list")){if(this._ddlCell=f,e=y[0],o=[],e.startsWith("=")&&e.indexOf(",")<0){for(u=n.trim(e.replace("=","")),u.indexOf("!")>-1&&(k=u.split("!"),w=this._getSheetIndexByName(k[0]),u=k[1]),u.indexOf("$")>-1&&(u=u.split("$").join("")),u.indexOf(":")<0&&(u=u+":"+u),range=this.getRangeIndices(u),s=this._getMultiRangeCells(range),c=this.getRangeData({range:[s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex],property:["value","value2"],sheetIdx:w}),r=0,l=c.length;r<l;r++)t.isNullOrUndefined(c[r].value)||t.isNullOrUndefined(c[r].value2)?(o.push(""),h.push("")):(o.push(c[r].value),h.push(c[r].value2));o.length||(o.push(e),h.push(e))}else e.indexOf(",")>-1?h=o=e.split(","):(o=[],o.push(e),h.push(e));for(r=0,l=o.length;r<l;r++)d[r]={id:r+1,text:h[r],value:o[r]};f=this.getCell(f.rowIndex,f.colIndex);v={top:f[0].offsetTop,left:f[0].offsetLeft};p.insertAdjacentHTML("beforeEnd","<span id='"+this._id+"ddlspan' class='e-icon e-ssddl e-spanddl e-ddlspan' role='button'><\/span>");b=n("#"+this._id+"ddlspan");g=f.height()-(b.height()+3);b.css({top:v.top+g,left:v.left+f.width()+3});n("#"+this._id+"ddl").ejDropDownList("option","dataSource",d)}},_drppopupshow:function(){if(this._ddlCell){var t=this.getCell(this._ddlCell.rowIndex,this._ddlCell.colIndex);n("#"+this._id+"ddl_popup").css({width:this.getActiveCellElem().width()+20,"font-size":"11",top:t.position().top,left:t.position().left})}},_ddlPosition:function(){if(this._ddlCell){var i,t=this.getCell(this._ddlCell.rowIndex,this._ddlCell.colIndex),r={top:t[0].offsetTop,left:t[0].offsetLeft};i=n("#"+this._id+"ddlspan");i.css({top:r.top+t.height()-(i.height()+3),left:r.left+t.width()+3})}},_changeddl:function(n){if(this._ddlCell&&this.model.allowEditing){var t=this.getActiveCell(),i=n.model.dataSource[n.itemId].value,r=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex);this.XLEdit._updateCellValue(t,i);this.getActiveCellElem().hasClass("e-hlcell")&&this.XLValidate.highlightInvalidData();this._trigrDdlActnCmplt(i,r,n.itemId);this.model.allowFormulaBar&&this.updateFormulaBar()}},_trigrDdlActnCmplt:function(n,t,i){if(this.model.actionComplete!==null){var e=this.getActiveCell(),s=this.getActiveSheetIndex(),o,f,r,u,h;if(o=this.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"rule",s),f={reqType:"edit",sheetIndex:s,currValue:n,prevValue:t,rowIndex:e.rowIndex,colIndex:e.colIndex,hasValidation:!0,rule:o,isRefreshVal:!1},o.type=="list"&&n!==""&&(r=o.customVal.split("_")[0],r[0]=="="&&r.indexOf(",")<0)){if(f.isRefrsVal=!0,r=r.replace("=",""),u=r.split("!"),f.refrValSheetIdx=refrSheetIdx=u.length==1?s:this._getSheetIndexByName(u[0]),refrRange=u.length==1?u[0]:u[1],refrRange.indexOf("$")>-1&&(refrRange=refrRange.replace(/\$/g,"")),range=this.getRangeIndices(refrRange),this.isUndefined(i)){h=this.getRangeData({range:range});for(idx in h)h[idx].value==n&&(i=parseInt(idx))}f.refrValCellAddr=range[0]===range[2]?this.getAlphaRange(range[0],range[1]+i):this.getAlphaRange(range[0]+i,range[1])}this._trigActionComplete(f)}},_ddlopen:function(i){var e=this.getActiveSheetIndex(),u=this.getActiveCell(e),o=this.getSheet(e).rowsHeightCollection[u.rowIndex],r,s,f;if(this.XLEdit._isEdit&&this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"rule").customVal.split("_")[2]==="true")return!1;this.XLEdit.saveCell();r=n("#"+this._id+"ddl").data("ejDropDownList");s=this.getCell(this._ddlCell.rowIndex,this._ddlCell.colIndex);i.stopPropagation();t.isNullOrUndefined(r)||(r._isPopupShown()?r._hideResult():(r._showResult(),n("#"+this._id+"ddl_popup").css({width:this.getActiveCellElem().width()+20,"font-size":"11",top:20,left:100}),f=this._getXYPos(s,n("#"+this._id+"ddl_popup"),o,0),n("#"+this._id+"ddl_popup_list_wrapper").css({top:f.yPos+o,left:f.xPos})))},_mouseMoveHandler:function(i){i.target=this._changeTargetWithOffset(i);var r=n(i.target),u,f;this._isTouchEvt=this._isTouchEvent(i);this._isTouchEvt&&(i.preventDefault(),u=this._setXY(i,navigator.userAgent.indexOf("WebKit")>-1),this.model.allowDragAndDrop&&this.XLDragDrop._dragtouch(u[0],u[1]));!this.model.allowResizing||!(this.XLResize._resizeType==="Col"||r.hasClass("e-headercelldiv")||r.hasClass("e-headercell")||r.hasClass("e-reSizeColbg"))||this.XLEdit._isEdit||this.XLCMenu&&this.XLCMenu._isMenuOpened?!this.model.allowResizing||!(this.XLResize._resizeType==="Row"||r.hasClass("e-rowheader")||r.hasClass("e-reSizeRowbg"))||this.XLEdit._isEdit||this.XLCMenu&&this.XLCMenu._isMenuOpened?this.model.allowResizing&&(this.XLResize._resizeType==="AP"||r.hasClass("e-spreadsheetactpanel")||r.parents(".e-spreadsheetactpanel").length>0)?this.XLResize._apMouseMove(i):(this.model.pictureSettings.allowPictures||this.model.allowCharts)&&(r.hasClass("e-ss-object")||r.parents(".e-ss-object").length||this.XLShape._shapeROStart||this.XLShape._shapeRSStart||r.hasClass("e-ss-imgvisual"))&&this.XLShape._imgMouseMove(i):this.XLResize._rMouseMove(i):this.XLResize._cMouseMove(i);this.model.allowSelection&&this.model.allowDragAndDrop&&t.spreadsheetFeatures.dragAndDrop&&r.parents(".e-spreadsheetmainpanel").length&&r.hasClass("e-rowcell")&&!this.XLEdit._isEdit&&this._getJSSheetHeader(this.getActiveSheetIndex())[0].querySelector(".e-spreadsheetcolumnheader").className.indexOf("e-sheetselected")===-1&&this.XLDragDrop._dMouseMove(i);this.model.allowComments&&!this.XLComment._isCommentEdit&&this.getSheetElement(this.getActiveSheetIndex()).find(".e-commentcell").length>0&&this.XLComment._commentMouseMove(i);t.isNullOrUndefined(i.target.parentNode)||i.target.id.indexOf("_svg")<0&&i.target.parentNode.className.indexOf("e-content")<0&&!n(i.target).is("td.e-rowcell")&&this.XLShape._shapeMouseUp(i);this._isTouchEvt&&!this._isSelected(i.target)&&!this._isTouchMoveSel&&this._touchArgs&&!this._isUniqueTarget(this._touchArgs,i)&&r.parents(".e-table").length&&r.parents(".e-spreadsheetcontentcontainer").length&&!this.XLDragDrop._allowDragAndDrop&&(f=this._getClientDiff(this._startXY,u),this._scrollContent(f),this._startXY=u,this._touchArgs=i,this._isTouchScroll=!0)},_mouseLeaveHandler:function(t){this._hasClass(t.target,"e-viewhdrlbl")||this._hasClass(t.target,"e-vheading")?this.element.find(".e-vheading .e-chk-act, .e-vheading .e-chk-inact").removeClass("e-chkhover"):this._hasClass(t.target,"e-viewlinlbl")||this._hasClass(t.target,"e-vgridlines")?this.element.find(".e-vgridlines .e-chk-act,.e-vgridlines .e-chk-inact").removeClass("e-chkhover"):this.model.allowResizing&&n(".e-ss-colresize, .e-ss-rowresize").removeClass("e-ss-colresize e-ss-rowresize")},_mouseUpHandler:function(t){var i=n(t.target),u=this.getActiveSheetIndex(),r=this.XLScroll._vScroller(u),f=this.XLScroll._hScroller(u);if(this.model.allowResizing&&(this.XLResize._resizeType==="Col"?this.XLResize._cMouseUp(t):this.XLResize._resizeType==="Row"?this.XLResize._rMouseUp(t):this.XLResize._resizeType==="AP"&&this.XLResize._apMouseUp(t)),this.model.showRibbon&&!this._phoneMode&&this.element.find(".e-ribbonpin").is(":visible")&&n(t.target).parents(".e-ribbon").length<=0&&n("#"+this._id+"_Ribbon").ejRibbon("collapse"),this.model.allowDragAndDrop&&this.XLDragDrop._allowDragAndDrop&&this.XLDragDrop._dMouseUp(t),this.model.allowComments&&this.XLComment._isCommentEdit&&this.getActiveCellElem().find("textarea").focus(),this._isSheetRename&&n("#"+this._id+"_Sheet_RenamePanel").focus(),this.model.pictureSettings.allowPictures&&this.XLShape._shapeMouseUp(t),this.model.enablePivotTable&&this.XLPivot._pivotMouseUp(t),this.XLEdit._isEdit&&i[0].id!==this.XLEdit._editElem[0].id&&this.XLEdit._editElem.setCursorPosition(this._browserDetails.version==="8.0"?document.selection.anchorOffset:window.getSelection().anchorOffset),this._hasClass(i[0],"e-vhandle")||this._hasClass(i[0],"e-vhandlespace")||this._hasClass(i[0],"e-vup")||this._hasClass(i[0],"e-vdown")){this._trigger("scrollStop",{scrollData:r._scrollData,position:r.model.value,reqType:"vertical"});return}if(this._hasClass(i[0],"e-hhandle")||this._hasClass(i[0],"e-hhandlespace")||this._hasClass(i[0],"e-hdown")||this._hasClass(i[0],"e-hup")){this._trigger("scrollStop",{scrollData:r._scrollData,position:f.model.value,reqType:"horizontal"});return}},_scrollContent:function(n,i){var r,u,e=this.getActiveSheetIndex(),f=this.getSheet(e);n.x&&(r=i?n.x:f._scrollLeft+n.x,u=this.XLScroll._hScroller(e),r<0?r=0:this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal?n.x>0&&u.model.maximum<r+u._scrollData.handle&&(r=u.model.maximum):u._scrollData.step=n.x<0?-1:1,f._scrollLeft!=r&&u.scroll(r));n.y&&(r=i?n.y:f._scrollTop+n.y,u=this.XLScroll._vScroller(e),r<0?r=0:this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&(u._scrollData.step=n.y<0?-1:1),(r||f._scrollTop!=r)&&u.scroll(r))},_keyDownHandler:function(i){var s,e,h,c,o,a=!0,l=!1,f=this.getActiveSheetIndex(),r=this.element.find("#"+this._id+"_AutoComplete").data("ejAutocomplete"),v=n("#"+this._id+"_Ribbon").data("ejRibbon"),u=this.getSheet(f)._activeCell;if(!this._trigger("keyDown",{event:i,isEdit:this.model.allowEditing&&this.XLEdit._isEdit,isCommentEdit:this.model.allowComments&&this.XLComment._isCommentEdit,isSheetRename:this._isSheetRename,sheetIndex:this._getSheetIndex()})){if(this._getContent(f).find(".e-ss-activeimg").length&&(n(i.target).hasClass("e-numerictextbox")&&i.keyCode===13&&i.preventDefault(),l=!0,c=document.activeElement.id,c.indexOf(this._id+"_Ribbon_Format_Size_PictureHeight")<0&&c.indexOf(this._id+"_Ribbon_Format_Size_PictureWidth")<0&&this.XLShape._imgKeyDown(i)),navigator.platform.toLowerCase().indexOf("mac")>-1&&i.metaKey){i.keyCode==67?this.XLClipboard.copy():i.keyCode==86?this.XLClipboard.paste():i.keyCode==88&&this.XLClipboard.cut();return}if(r.showSuggestionBox&&r.suggestionList){if(i.keyCode===38){r._removeListHover();r._activeItem=r._activeItem>1?r._activeItem-1:r._listSize;r._addListHover();r._targetFocus();return}if(i.keyCode===40){r._removeListHover();r._activeItem=r._activeItem<r._listSize?r._activeItem+1:1;r._addListHover();return}}if(i.target.id.indexOf("_Edit")>-1&&this.model.allowKeyboardNavigation&&(this.XLCellNav._canKeyBoardNavigate=!0),this.XLEdit._editElem&&(o=this.XLEdit._editElem.text()),i.target.id.indexOf("_Edit")>-1&&i.keyCode===9&&o.indexOf("=")===0&&o.indexOf(")")!=o.length-1){if(i.preventDefault(),!r.suggestionList.is(":visible")&&this.model.allowKeyboardNavigation){this._isFormulaSuggestion&&(i.keyCode===39||i.keyCode===37||i.keyCode===13&&!i.altKey)&&this.XLEdit.saveCell();this.XLCellNav._selectionKeyDownHandler(i);u=this.getSheet(f)._activeCell;return}e=r.getActiveText();this.XLEdit._isNamedRange(e)||(e+="(");this.XLEdit._editElem.text(e);this.model.allowFormulaBar&&this._getInputBox().val(e);i.target.id.indexOf("_Edit")>-1&&this.XLEdit._editElem.focusEnd();this.XLCellNav._canKeyBoardNavigate=!1;return}if(this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"wrap")&&this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"merge")&&i.keyCode===46&&(this.getCell(u.rowIndex,u.colIndex,f).find("#"+this._id+"_MergeWrap")[0].textContent=""),i.target.id.indexOf("_Custom")<0&&i.target.id.indexOf("_Ribbon")<0){if((i.stopImmediatePropagation(),this.model.allowFiltering&&this.XLFilter._isSearchEdit&&i.keyCode!==27)||(n(i.target).parents(".e-formulabar").length&&this.XLEdit._isEdit&&this.model.allowKeyboardNavigation&&(this.XLCellNav._isNavigate=i.keyCode===13),this._isSheetRename||this.XLEdit._isEdit||this.XLComment&&this.XLComment._isCommentEdit||!this.model.allowClipboard||this.XLClipboard._copyPasteHandler(i),l||this._isSheetRename||((this.XLComment&&this.XLComment._isCommentEdit)?this.model.allowKeyboardNavigation&&(this.XLCellNav._isNavigate=!1):this.model.allowEditing&&(document.activeElement.id.indexOf("_inputbox")===-1||i.keyCode===27)&&this.XLEdit._editingHandler(i)),this._isFormulaSuggestion&&(i.keyCode===39||i.keyCode===37||i.keyCode===13&&!i.altKey)?this.XLEdit.saveCell():this.XLEdit._isFormulaEdit||i.keyCode!==9&&(i.keyCode!==13||i.altKey)&&i.keyCode!==37&&i.keyCode!==38&&i.keyCode!==39&&i.keyCode!==40||(a=this.XLEdit._isEdit&&this.model.allowKeyboardNavigation&&this.XLCellNav._isNavigate?this.XLEdit.saveCell():!0),n(i.target).hasClass("e-field-validation-error")||i.target.id==this._id+"_Ribbon_Home_Font_FontFamily_wrapper"||i.target.id==this._id+"_Ribbon_Home_Number_NumberFormat_wrapper"||i.target.id==this._id+"_Ribbon_Home_Font_FontSize_wrapper"))return!0;if(this.model.allowDataValidation&&this.XLValidate._isErrorVisible&&(i.keyCode===37||i.keyCode===39||i.keyCode===38||i.keyCode===40))return this.XLValidate._isErrorVisible=!1,!0;if(!a&&!this.XLEdit._isFormulaEdit||i.keyCode===13&&i.altKey)return!1;!this.model.allowKeyboardNavigation||l||this._isSheetRename||(this.model.allowComments&&this.XLComment._isCommentEdit||n(i.target).parents(".e-formulabar").length&&i.keyCode!==9&&(i.keyCode!==13||i.altKey)||this.XLCellNav._selectionKeyDownHandler(i),u=this.getSheet(f)._activeCell,this._keyboardShortCuts(i));this.model.allowUndoRedo&&(this.model.allowComments&&!this.XLComment._isCommentEdit?this._undoRedoOperation(i):this.model.allowComments||this._undoRedoOperation(i));this.XLEdit._isFormulaEdit&&i.keyCode===9&&!this.XLCellNav._canKeyBoardNavigate&&(this.XLCellNav._canKeyBoardNavigate=!0)}if(i.target.id===this._id+"_Ribbon_Analyze_PivotTable_PivotTableName")return this._isPvtNameEdit=!0,!0;if(this._isPvtNameEdit&&(this._isPvtNameEdit=!1,this.XLPivot._changePvtName()),i.target.tagName!=="DIV"||this.XLEdit._isEdit||t.isNullOrUndefined(this._ddlCell)||(this.element.find("#"+this._id+"ddl").ejDropDownList("hidePopup"),this.element.find("#"+this._id+"ddlspan").remove(),this._ddlCell=null),h=this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"tableName",f),i.target.id===this._id+"_Ribbon_Design_Properties_TableName")if(this._isTableRename=!0,this._tableClassName=this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"tableName")||"",this._isTableRename&&(i.keyCode===13||i.keyCode===9||i.keyCode===27))i.keyCode===13&&i.preventDefault(),this.XLFormat._renameTable(this._tableClassName);else return;h&&this._getContent(f).find(".e-ss-activeimg").length===0?(s=this._getTableID(h),this.isNumber(s)&&this.XLRibbon._designTabUpdate(s,u)):this.model.showRibbon&&(v.model.selectedItemIndex===this.XLRibbon._getTabIndex("design")||v.isVisible(this._getLocStr("Design")))&&this.XLRibbon._toggleDesignTab(u);this.XLEdit._isEdit||t.isNullOrUndefined(this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"rule",f))||this._setddlCell(i);this._isSheetRename&&(i.keyCode===13||i.keyCode===9||i.keyCode===27)&&(i.preventDefault(),this._updateSheetNames(null,i.keyCode===27)&&this.setSheetFocus());r.suggestionList.is(":visible")&&(this.XLEdit._editElem.text()===""||i.keyCode===13)&&r._hideResult();this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()}},_keyUpHandler:function(n){var t=this.element.find("#"+this._id+"_Edit").text();this.model.allowEditing&&this.XLEdit._isEdit&&t.indexOf("=")>-1&&t.length>0&&t.indexOf(")")==-1&&(this.XLEdit._isFEdit||(this.XLCellNav._isNavigate=!0),n.keyCode!==40&&n.keyCode!==38&&t.length>1&&this.XLEdit._captureEditing(n));this._trigger("keyUp",{event:n,isEdit:this.model.allowEditing&&this.XLEdit._isEdit,isCommentEdit:this.model.allowComments&&this.XLComment._isCommentEdit,isSheetRename:this._isSheetRename,sheetIndex:this._getSheetIndex()})},_dblClickHandler:function(t){var i,e,r,u,f;if(this.XLEdit._isFEdit=!1,t.target.tagName!=="A")if(this._hasClass(t.target,"e-numericitem")){if(this.XLEdit&&this.XLEdit._isEdit&&this.getActiveCellElem().find(".e-error").length)return;this._isSheetRename||this._renameSheet()}else{if(t.target.id.indexOf("chart")>-1||this._hasClass(t.target,"e-comment-txtarea")||this._hasClass(t.target,"e-filterspan")||n(t.target).parents(".e-ss-pivot").length)return;if(u=this.getActiveSheetIndex(),f=this.getSheet(u),t.target=this._changeTargetWithOffset(t),!this.model.allowEditing||!this.model.allowSelection)return;if(this.XLSelection._isOutsideBordering||this.XLSelection._isGridBordering){i=this._getContent(u).find("div:first-child");i.addClass("e-ss-cursor");i.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor");this.XLSelection.selectRange(f._startCell,f._endCell);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this.XLSelection._isOutsideBordering=this.XLSelection._isGridBordering=!1;return}if(!this.XLEdit._isEdit&&(n(t.target).hasClass("e-rowcell")||n(t.target).parents("td").hasClass("e-rowcell"))&&!this._hasClass(n(t.target),"e-readonly")&&!n(t.target).hasClass("e-cellreadonly")){if(this._isTouchEvt&&t.preventDefault(),n(".e-cdata").length&&n(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),e=n(t.target),e.closest("#"+this._id+"EditForm").length)return;r=t.target.id.length<1?this._getCellIdx(t.target):this._getCellIdx(n(t.target).parents("td")[0]);this.XLEdit.editCell(r.rowIndex,r.colIndex,!0)}this.model.allowResizing&&(n(t.target).hasClass("e-headercell")||n(t.target).hasClass("e-headercelldiv"))&&(n(t.target).css("cursor")==="col-resize"||this._isTouchEvt)&&(n(t.target).hasClass("e-headercelldiv")&&(t.target=t.target.parentNode),this.XLResize._resizeToFitWidth(t));this.model.allowResizing&&(n(t.target).hasClass("e-ss-rowresize")||this._isTouchEvt&&n(t.target).hasClass("e-rowheader"))&&this.XLResize._resizeToFitHeight(t)}},_setAndSelectActiveCell:function(n,t,i){this.setActiveCell(n,t);this._selectActiveCell(n,t,"",i)},_selectActiveCell:function(n,t,i,r){var e=this.getActiveSheetIndex(),f=i?{rowIndex:i.rowIndex,colIndex:i.colIndex}:{rowIndex:n,colIndex:t},u=this.getSheet(e);if(this.model.allowSelection&&this.model.allowKeyboardNavigation&&this.model.scrollSettings.allowScrolling){this.XLEdit.getPropertyValue(n,t,"mergeIdx")?(u._activeCell=u._endCell=u._startCell=f,this.XLSelection._processBoundary(),u._activeCell=u._startCell,this.XLSelection.selectRange(u._startCell,u._endCell)):this.XLSelection.selectRange(this._getAlphaRange(e,n,t,f.rowIndex,f.colIndex));this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();switch(r){case"Home":this._scrollContent({x:[i?i.colIndex*u.columnWidth:0]-u._scrollLeft});break;case"End":u._isFreezed?this.XLCellNav._navToCell(n,t):(n<u._topRow.idx||n>u._bottomRow.idx||t<u._leftCol.idx||t>u._rightCol.idx)&&this.XLScroll.scrollToCell(this._getAlphaRange(e,n,t,f.rowIndex,f.colIndex));break;case"Ctrl + Home":case"Ctrl + Shift + Home":this.XLScroll.scrollToCell(this._getAlphaRange(e,n,t,f.rowIndex,f.colIndex))}this.XLScroll._getFirstColumn(e)}},_pageUpDown:function(n){if(!this._isAutoWHMode){var u,h,o,e,c,f=0,s,r=this.getActiveCell(),l=this.getActiveSheetIndex(),i=this.getSheet(l),a=this.model.scrollSettings.allowVirtualScrolling;(o=i._rowHeightCollection[r.rowIndex],i.rowCount-1===i._bottomRow.idx&&n===1||(this._isFrozen(i.frozenRows)?r.rowIndex>i.frozenRows&&i._ftopRowIdx===i.frozenRows:i._topRow.idx===0)&&n===-1)||(e=i._bottomRow.value+i.rowsHeightCollection[i._bottomRow.idx],this._isFrozen(i.frozenRows)&&(r.rowIndex<i.frozenRows&&n===1&&(o=i._rowHeightCollection[i.frozenRows]),f=n===1?this._getRowOffsetTop(i,i.frozenRows):this._getIdxWithOffset(i._ftopRowIdx,null,!1,["freeze"]).yOffset),c=n*(e-(f?f:i._topRow.value)),u=o+c>0?o+c:0,f?n===1?(s=r.rowIndex>i._ftopRowIdx?this._getIdxWithOffset(r.rowIndex).yOffset-i._frozenHeight:0,r.rowIndex<i.frozenRows?this._scrollContent({y:n*(e-i.rowsHeightCollection[i._bottomRow.idx]-f)+1}):this._scrollContent({y:this._getIdxWithOffset(i._bottomRow.idx,null,!1,["freeze"]).yOffset-i._frozenHeight},!0),u=this._getIdxWithOffset(i._ftopRowIdx).yOffset+s):(s=r.rowIndex>i._ftopRowIdx?this._getIdxWithOffset(r.rowIndex).yOffset-i._frozenHeight:0,r.rowIndex>i.frozenRows&&a?this._scrollContent({y:f-(e-i.rowsHeightCollection[i._bottomRow.idx])+1},!0):this._scrollContent({y:u+i.rowsHeightCollection[i._bottomRow.idx]-i._frozenHeight+1},!0),u=this._getIdxWithOffset(i._ftopRowIdx).yOffset+s):n===1&&this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal&&i._bottomRow.value+this.model.rowHeight+i._vPortHgt>=i._rowHeightCollection[i._rowHeightCollection.length-1]?u=i._rowHeightCollection[i._rowHeightCollection.length-1]:this._scrollContent({y:n*(e-i._scrollTop)}),h=this._getIdxWithOffset(u,i._colWidthCollection[r.colIndex],!0),this._setAndSelectActiveCell(h.rowIdx,h.colIdx))}},_keyboardShortCuts:function(i){var v,p,c,y,w,a;if(this.model.allowEditing&&this.XLEdit._isEdit||this.model.allowComments&&this.XLComment._isCommentEdit&&i.keyCode!==27)return!1;var h,s,e,o=this.XLFormat,l=this.getActiveSheetIndex(),u=this.getSheet(l),f=u._selectedCells,r=!1;if(this.model.allowLockCell&&u.isSheetProtected&&(r=!0),!i.ctrlKey&&!i.shiftKey)switch(i.keyCode){case 33:i.preventDefault();this._pageUpDown(-1);break;case 34:i.preventDefault();this._pageUpDown(1);break;case 36:i.preventDefault();this._setAndSelectActiveCell(this.getActiveCell(l).rowIndex,this._isFrozen(u.frozenColumns)?u._frozenColumns-1:0,"Home")}if(i.ctrlKey&&!i.shiftKey){if(!this.element.find("#"+this._id+"_Ribbon .e-ribbonbackstagepage").is(":visible"))switch(i.keyCode){case 65:i.preventDefault();this.model.allowSelection&&(h=this.getActiveCellElem(),this.selectAll(),t.isNullOrUndefined(this.XLCellNav)||this.XLCellNav._updateActiveCell(n(h[0]).closest("tr").index(),h[0].cellIndex,{keyCode:i.keyCode}),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement());break;case 66:i.preventDefault();r||this._toggleFontPrpty("bold");break;case 68:case 82:i.preventDefault();this.model.allowAutoFill&&this.XLDragFill._fillRange(i.keyCode===68);break;case 73:i.preventDefault();r||this._toggleFontPrpty("italic");break;case 75:i.preventDefault();this.model.allowHyperlink&&!r&&this._showDialog(this._id+"_Ribbon_Insert_Links_Hyperlink");break;case 85:i.preventDefault();r||this._toggleFontPrpty("underline");break;case 32:if(i.preventDefault(),!this.model.allowSelection)return;v=f[0].colIndex;p=f[f.length-1].colIndex;s={rowIndex:0,colIndex:v};e={rowIndex:u.rowCount-1,colIndex:p};this.model.allowSelection&&this.XLSelection.selectRange(s,e);u._startCell=s;u._endCell=e;u._isColSelected=!0;t.isNullOrUndefined(this.XLCellNav)||this.XLCellNav._updateActiveCell(f[0].rowIndex,v);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();break;case 35:i.preventDefault();e=this._getUsedRangeFromSheet(l).endCell;this._setAndSelectActiveCell(e.rowIndex,e.colIndex,"End");break;case 36:i.preventDefault();this._setAndSelectActiveCell(this._isFrozen(u.frozenRows)?u._frozenRows-1:0,this._isFrozen(u.frozenColumns)?u._frozenColumns-1:0,"Ctrl + Home");break;case 49:i.preventDefault();this._showDialog(this._id+"_FormatCells");break;case 53:i.preventDefault();r||this._toggleFontPrpty("line-through");break;case 56:i.shiftKey||r||(i.preventDefault(),this._hideColumn(u._startCell.colIndex,u._endCell.colIndex));break;case 57:i.shiftKey||(i.preventDefault(),r||this._hideRow(u._startCell.rowIndex,u._endCell.rowIndex,"isRHide"));break;case 220:i.shiftKey||(i.preventDefault(),this.model.allowSearching&&this.XLSearch._applyGotoRowDiff());break;case 90:i.preventDefault();break;case 89:i.preventDefault();break;case 114:i.preventDefault();this.model.showRibbon&&!r&&this.XLRibbon._openNameManagerDlg();break;case 70:i.preventDefault();this._showDialog(this._id+"_Ribbon_Others_Editing_FindSelect");n("#"+this._id+"_FRDialog").ejDialog("open");this.XLRibbon._refreshFRDlg();n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option","selectedItemIndex",0);break;case 71:i.preventDefault();this._showDialog(this._id+"_Ribbon_Others_Editing_FindSelect");n("#"+this._id+"_GoDialog").ejDialog("open");n("#"+this._id+"_GoToDlgTab").ejTab("option","selectedItemIndex",0);break;case 72:i.preventDefault();this._showDialog(this._id+"_Ribbon_Others_Editing_FindSelect");n("#"+this._id+"_FRDialog").ejDialog("open");this.XLRibbon._refreshFRDlg();n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option","selectedItemIndex",1)}switch(i.keyCode){case 80:i.preventDefault();this.XLPrint.printSheet();break;case 79:if(i.preventDefault(),this.model.allowImport){if(this.model.importSettings.importMapper.length<1){this._showAlertDlg("Alert","ImportExportUrl","",266);return}this.isDirty&&this._browserDetails.name!=="msie"?this._showAlertDlg("","ImportAlert","Open",470,135):n("#"+this._id+"_file .e-uploadinput").click()}break;case 83:i.preventDefault();this.model.exportSettings.allowExporting&&this.XLExport["export"]("Excel")}}if(i.ctrlKey&&i.shiftKey){if(!this.element.find("#"+this._id+"_Ribbon .e-ribbonbackstagepage").is(":visible")){this._browserDetails.name==="mozilla"&&i.keyCode===173&&(i.keyCode=189);switch(i.keyCode){case 192:i.preventDefault();r||o.format({type:"general"});break;case 52:i.preventDefault();r||o.format({type:"currency"});break;case 53:i.preventDefault();r||o.format({type:"percentage"});break;case 54:i.preventDefault();r||o.format({type:"scientific"});break;case 51:i.preventDefault();r||o.format({type:"shortdate"});break;case 50:i.preventDefault();r||o.format({type:"time"});break;case 49:i.preventDefault();r||o.format({type:"number"});break;case 55:i.preventDefault();this.model.allowCellFormatting&&this.model.formatSettings.allowCellBorder&&!r&&this.XLFormat.applyBorder({top:"1px solid #000000",right:"1px solid #000000",bottom:"1px solid #000000",left:"1px solid #000000"});break;case 189:i.preventDefault();this.model.allowCellFormatting&&this.model.formatSettings.allowCellBorder&&!r&&this.XLFormat.applyBorder("noborder");break;case 73:i.preventDefault();this.model.allowInsert&&!r&&this._showDialog(this._id+"_Ribbon_Others_Cells_InsertCellOptions");break;case 68:i.preventDefault();this.model.allowDelete&&!r&&this._showDialog(this._id+"_Ribbon_Others_Cells_DeleteCellOptions");break;case 113:i.preventDefault();c=n("#"+this._id+"_Ribbon").data("ejRibbon");this.model.showRibbon&&(c._isCollapsed?(c.expand(),c._removeRibbonPin()):c.collapse());break;case 56:i.preventDefault();!r&&this.model.allowSelection&&this._showColumn(f[0].colIndex,f[f.length-1].colIndex);break;case 57:i.preventDefault();!r&&this.model.allowSelection&&this._showRow(f[0].rowIndex,f[f.length-1].rowIndex,"isRHide");break;case 79:i.preventDefault();this.XLSearch._applyGotoComments();break;case 220:i.preventDefault();this.XLSearch._applyGotoColDiff();break;case 36:i.preventDefault();e=this.getActiveCell(l);this._selectActiveCell(0,0,e,"Ctrl + Shift + Home")}}}else if(i.shiftKey)i.keyCode===32?(i.preventDefault(),this.model.allowSelection&&(y=f[0].rowIndex,w=f[f.length-1].rowIndex,s={rowIndex:y,colIndex:0},e={rowIndex:w,colIndex:u.colCount-1},this.XLSelection.selectRange(s,e),u._startCell=s,u._endCell=e,u._isRowSelected=!0,t.isNullOrUndefined(this.XLCellNav)||this.XLCellNav._updateActiveCell(y,f[0].colIndex),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())):i.keyCode===113?(this._dupDetails=!0,i.preventDefault(),h=this.getActiveCellElem(),this.model.allowComments&&!r&&(this._isRibbonClick=!0,h.hasClass("e-commentcell")?this.XLComment.editComment():this.XLComment.setComment(),this._isRibbonClick=!1),this._dupDetails=!1):i.keyCode===122&&(i.preventDefault(),this.addNewSheet());else if(i.keyCode===27){if(this.model.allowComments&&this.XLComment._isCommentEdit&&(this.XLComment._updateCurCmntVal(),this.XLComment._updateCmntRibIcons()),this.model.allowContextMenu&&(this.XLCMenu._isMenuOpened||n("#"+this._id+"_contextMenuColumnHeader").is(":visible")||n("#"+this._id+"_contextMenuRowHeader").is(":visible"))&&this.XLCMenu.hideCMenu(),this.model.allowFiltering&&this._excelFilter&&this._excelFilter._openedFltr&&n(this._excelFilter._openedFltr).is(":visible")){if(a=this._excelFilter._menuWrap.data("ejMenu"),a.element.find(".e-mhover li:visible").length){a._isContextMenuOpen||a._closeMenu();return}this.XLFilter._isSearchEdit=!1;this._excelFilter.closeXFDialog()}this.setSheetFocus()}else i.altKey&&(i.keyCode===112&&this.model.showRibbon&&this.model.allowCharts&&!r?(i.preventDefault(),this.XLChart.createChart(null,{type:"column",enable3D:!1,marker:{visible:!1}})):i.keyCode===84&&this.model.showRibbon&&!this.XLRibbon._isDirtySelect&&!r&&this.model.allowFormatAsTable&&(this._showDialog(this._id+"_Ribbon_Insert_Tables_Table"),i.preventDefault(),this.XLRibbon._openFATDlg()))},_triggerTBtnClick:function(t){var i=n("#"+t).data("ejToggleButton");i.buttontag.click()},_toggleFontPrpty:function(n){var e=this.getActiveCell(),o=this.XLFormat,u={style:{}},f,t,i,r;f=this.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"format");i=!this.isUndefined(f)&&this.XLFormat.getFormatFromHashCode(f);t=n==="bold"?"font-weight":n==="italic"?"font-style":"text-decoration";r=n.charAt(0).toUpperCase()+n.slice(1).toLowerCase();r==="Line-through"&&(r="StrikeThrough");i[t]===n?(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!1),u.style[t]="none"):t==="text-decoration"&&(i[t]==="underline"||i[t]==="line-through")?(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!0),u.style[t]=i[t]==="underline"?n+" "+i[t]:i[t]+" "+n):t==="text-decoration"&&(i[t]==="line-through underline"||i[t]==="underline line-through")?(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!1),i[t]=i[t].split(" ").join(""),u.style[t]=i[t].replace(n,"")):(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!0),u.style[t]=n);o.format(u)},_getLocStr:function(n){return this.localizedLabels[n]},_checkIndicesInContainer:function(n,t,i,r){var u=this._dataContainer.sheets;return n in u&&t in u[n]&&i in u[n][t]?r?r in u[n][t][i]?!0:!1:!0:!1},_textFormatting:function(t){switch(t){case"wrapText":var i=n("#"+this._id+"_Ribbon_Home_Alignment_WrapText").data("ejToggleButton");i&&this.setWrapText(i.model.toggleState?"wrap":"unwrap",null)}},wrapText:function(n){this.model.allowWrap&&!this.model.isReadOnly&&this.setWrapText("wrap",n)},unWrapText:function(n){this.model.allowWrap&&!this.model.isReadOnly&&this.setWrapText("unwrap",n)},setWrapText:function(n,i){var u,tt,k;if(this.model.allowWrap&&!this.model.isReadOnly){var r,a,f,e=this.getActiveSheetIndex(),v,s,w,o=this.getSheet(e),h=0,y,l=this.model.rowHeight,p,d=this.getRows(e),ot=d[1],it=d[0],g,nt=o.rowsHeightCollection,st=o.columnsWidthCollection,l=0,b=o._wrapHtCollection,c=!1,rt,ut=this.model.scrollSettings.allowVirtualScrolling,ft=o._clrWrapColl,et;if(a=this._getRangeArgs(i,"object"),r=this._getSelectedCells(e,a).selCells,r.length!==0){for(g=r.length>1?this._getProperAlphaRange(e,r[0].rowIndex,r[0].colIndex,r[r.length-1].rowIndex,r[r.length-1].colIndex):this._getAlphaRange(e,r[0].rowIndex,r[0].colIndex,r[r.length-1].rowIndex,r[r.length-1].colIndex),u=0,tt=r.length;u<tt;u++)if(rt=ut?this._getRowIdx(r[u].rowIndex):r[u].rowIndex,et=r[r.length-1],c=this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"wrap"),this._isPaste||(n!=="unwrap"||c)&&(n!=="wrap"||!c)){if(n==="unwrap"&&c)this._isUndoRedo||ft.push({rowIdx:r[u].rowIndex,colIdx:r[u].colIndex}),this._isRowViewable(e,r[u].rowIndex)&&(f=this.getCell(r[u].rowIndex,r[u].colIndex),this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"merge")&&!this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"cellType")&&(v=f.find("#"+this._id+"_MergeWrap"),v.length&&(f[0].innerHTML=v[0].innerHTML,v.remove())),s=r[u].rowIndex,w=r[u].colIndex,f&&this._removeClass(f[0],"e-sswraptext"),this._removeClass(it[s],"e-sswraprow"),this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"altTxt")&&this.addClass(f[0],"e-alt-unwrap"),s in o._wrapColl&&w in o._wrapColl[s]&&(delete o._wrapColl[s][w],y=t.max(this._getObjectValues(o._wrapColl[s])),this._fRowHtColl[s]&&y<this._fRowHtColl[s]&&(y=this._fRowHtColl[s]),this.getObjectLength(o._wrapColl[s])||delete o._wrapColl[s]),f.find(".e-filterspan").length>0&&(p=f.find(".e-filterspan"),this.model.allowFiltering&&this.XLFilter._postionFilterIcon(f,p))),this.XLEdit._clearDataContainer({cellIdx:r[u],property:["wrap"]}),this.XLEdit._clearDataContainer({cellIdx:{rowIndex:r[u].rowIndex,colIndex:0},property:["wrapRow"]}),this.XLEdit._clearDataContainer({cellIdx:{rowIndex:0,colIndex:r[u].colIndex},property:["wrapCol","wrapWidth"]}),h=this._getWrapCellHeight(e,r[u].rowIndex,r[u].colIndex,y),this._textClip(r[u].rowIndex,r[u].colIndex,"add");else if(n==="wrap"&&!c){if(this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"isFilterHeader"))continue;this._textClip(r[u].rowIndex,r[u].colIndex,"delete");this._wrapCollection(r[u].rowIndex,r[u].colIndex,nt[r[u].rowIndex],e);this.XLEdit._updateDataContainer({rowIndex:r[u].rowIndex,colIndex:r[u].colIndex},{dataObj:{wrap:!0}});this._isRowViewable(e,r[u].rowIndex)&&(f=this.getCell(r[u].rowIndex,r[u].colIndex),(f.is(":visible")||this._isPaste)&&this.model.allowResizing&&!this.XLResize._preventRowResize(r[u].rowIndex)&&(this.addClass(f[0],"e-sswraptext"),this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"altTxt")&&this._removeClass(f[0],"e-alt-unwrap"),f.find(".e-filterspan").length>0&&(p=f.find(".e-filterspan"),this.model.allowFiltering&&this.XLFilter._postionFilterIcon(f,p))));h=this._getWrapCellHeight(e,r[u].rowIndex,r[u].colIndex);h.rowHt<l&&(h.rowHt=l);l=h.rowHt;this._wrapCollection(r[u].rowIndex,r[u].colIndex,h.cellHt,e);this.XLEdit._updateDataContainer({rowIndex:r[u].rowIndex,colIndex:r[u].colIndex},{dataObj:{wrap:!0}});b[r[u].rowIndex]=u>0&&r[u].rowIndex===r[u-1].rowIndex?b[r[u-1].rowIndex]:b[r[u].rowIndex]=nt[r[u].rowIndex];t.isNullOrUndefined(this.XLEdit.getPropertyValue(r[u].rowIndex,0,"wrapCol"))&&this.XLEdit._updateDataContainer({rowIndex:0,colIndex:r[u].colIndex},{dataObj:{wrapCol:!0,wrapWidth:this.getSheet(e).columnsWidthCollection[r[u].colIndex]}})}h.rowHt>0&&(r[u].colIndex===a[3]||this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"merge"))&&(this.setHeightToRows([{rowIndex:r[u].rowIndex,height:h.rowHt}]),l=0,n!=="wrap"||c||t.isNullOrUndefined(this.XLEdit.getPropertyValue(r[u].rowIndex,0,"wrapRow"))&&this.XLEdit._updateDataContainer({rowIndex:r[u].rowIndex,colIndex:0},{dataObj:{wrapRow:!0}}));this.model.allowFreezing&&(this.XLFreeze._refreshFRowResize(r[u].rowIndex),this.XLFreeze._refreshSelection());r[u].colIndex===a[3]&&(l=0);h=0}this.model.allowComments&&this.XLComment._updateCmntArrowPos();this.model.scrollSettings.allowScrolling&&this.XLScroll._getRowHeights(e,r[0].rowIndex+1);(!o._isImported||o._isLoaded)&&(k={sheetIndex:e,selectedCell:r,reqType:"textwrap",operation:n,range:g},this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(e,"refresh","all"),this.model.allowSelection&&this.XLSelection._refreshBorder(),this._isUndoRedo||this._dupDetails||(this._completeAction(k),this._trigActionComplete(k)))}}},_getWrapCellHeight:function(n,t,i,r){var u,o,f=0,s=0,e,h=this.getSheet(n),c=h.rowsHeightCollection,l=h.columnsWidthCollection;if(o=this.XLEdit.getPropertyValue(t,i,"merge"),f=c[t],s=l[i],o){for(u=t+1;u<t+o.mSpan.rowSpan;u++)f=f+c[u];for(u=i+1;u<i+o.mSpan.colSpan;u++)s=s+l[u]}return o?(f=this._getRowHeight(t,n),e=r?r:f):(e=r?r:this._detailsFromGlobalSpan(t,i,"height",this.XLEdit.getPropertyValue(t,i,"value2"),s),e=e<this.model.rowHeight?this.model.rowHeight:e,f=e),{cellHt:e,rowHt:f}},_wrapCollection:function(n,t,i,r){var u=this.getSheet(r?r:this.getActiveSheetIndex());u._wrapColl[n]||(u._wrapColl[n]={});this.getObjectLength(u._wrapColl[n])>-1&&(u._wrapColl[n][t]=i);u.rowsHeightCollection[n]<i&&!this._isInMrgeRnge(n,t,!u._isLoaded)&&(u.rowsHeightCollection[n]=i,this.model.scrollSettings.allowScrolling&&this.XLScroll._getRowHeights(r,n,!0),this._getRowHdrTBody(r).find('tr[idx="'+n+'"]').height(i))},_isInMrgeRnge:function(n,t,r){if(!r)return this.XLEdit.getPropertyValue(n,t,"merge");var f=this._getSheetIndex(),u=this._impData?this._impData.model.sheets[f].mergedCells:[];for(u||(u=[]),i=0;i<u.length;i++)if(range=this.getRangeIndices(u[i].range),range[0]<=n&&range[2]>=n&&range[1]<=t&&range[3]>=t)return!0;return!1},_setWrapHeight:function(t,i,r,u,f,e){var o,h,c=r[i],s=this.getSheet(t),l=s.rowsHeightCollection;l[i]>0?o=l[i]:(s.hideRowsCollection.indexOf(i)===-1||e==="visible")&&(h=n(r[i].outerHTML).attr("id","ss"),f[0].insertBefore(h[0],f[0].childNodes[0]),o=f[0].rows[0].getBoundingClientRect().height,f[0].rows[0].parentNode.removeChild(f[0].rows[0]));o=o<20?20:o;parseInt(c.style.height)<o&&(c.style.height=o+"px",n(u[i])[0].style.height=o+"px",s.rowsHeightCollection[i]=o)},_setRowHdrHeight:function(n,t){var r=this._getRowIdx(t),u,f,i=this.getSheet(n),e=this.getRows(n),o=i.rowsHeightCollection[t];this._isRowViewable(n,t)&&(f=parseInt(e[0][r].style.height),f!=o&&(e[0][r].style.height=o+"px",this.model.allowSelection&&(u=this._intrnlReq,this._intrnlReq=!0,this.XLSelection.refreshSelection(),i._isFreezed&&this.XLFreeze._refreshSelection(),this._intrnlReq=u),(!i._isImported||i._isLoaded)&&this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()))},_refreshRangeTRHght:function(n,t){for(var r=t[0]<1?t[0]:t[0]-1,u=this.getSheet(n),i=r;i<=t[2];i++)this._setRowHdrHeight(n,i);this.XLScroll._getRowHeights(n,r);(!u._isImported||u._isLoaded)&&this.model.allowSelection&&this.XLSelection._refreshBorder()},_renderAlertdlg:function(){var u,f,e,o,s,r,h="<div class='e-dlg-btnctnr' id=",i=this._id+"_alertdlg",c={text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._alertOkClick,this),enabled:!0,cssClass:"e-ss-okbtn"};document.getElementById(this._id+"_alertdlg")||(o="<input id="+this._id+"_dialog_Ok ><\/input><input id="+this._id+"_dialog_Can style= 'margin-left: 10'; ><\/input>",u="<input id="+this._id+"_dialog_alertOk > <\/input>",e=h+i+"_condiv >"+o+"<\/div>",f=h+i+"_alertdiv >"+u+"<\/div>",r="<div class='e-alertdlgcontent' id="+i+"_dlgcontent > <\/div>",r=r+"<div class='e-dlg-btnfields' id="+i+"_dlgbtncontent >"+e+f+"<\/div>",s=n("<div id="+i+" class='e-alertdlg' style= 'display : none;'>"+r+"<\/div>"),this.element[0].appendChild(s[0]),n("#"+this._id+"_dialog_alertOk").ejButton(c),n("#"+this._id+"_dialog_Ok").ejButton(c),n("#"+this._id+"_dialog_Can").ejButton({text:this._getLocStr("Cancel"),showRoundedCorner:!0,width:60,click:t.proxy(this._alertCanClick,this)}))},alert:function(t){var i=n("#"+this._id+"_alertdlg");this._renderAlertDlgContent(i,"Alert",t);i.ejDialog("open")},_renderAlertDlgContent:function(n,i,r,u,f,e){var o=n.find("#"+this._id+"_alertdlg_dlgcontent"),s=n.find("#"+this._id+"_alertdlg_condiv"),h=n.find("#"+this._id+"_alertdlg_alertdiv");this._tabMode||this._phoneMode?f>this._responsiveWidth/1.2&&(f=this._responsiveWidth/1.2):f=f||400;e=e||"";i==="Alert"?(s.hide(),h.show()):(s.show(),h.hide());o.text("");o.html(r);n.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,enableAnimation:!1,allowKeyboardNavigation:!1,title:this._getLocStr("Title"),width:f,height:"auto",minHeight:0,cssClass:"e-ss-dialog e-"+this._id+"-dlg"+e,open:t.proxy(this._alertDlgOpen)});this._alertDialog={element:n,action:u}},_alertDlgOpen:function(){this.element.find("input:visible:first").focus()},_alertOkClick:function(){var u,r=1,i=this.getActiveSheetIndex(),f,e=this._isUndoRedo,t;this._alertDialog.element.ejDialog("close");switch(this._alertDialog.action){case"findPrevComment":this.gotoPage(this.model.sheetCount,!1);u=this.model.sheets[this.model.sheetCount];this.XLComment._updateCurrentCell(u.rowCount-1,u.colCount-1);this.XLComment.findPrevComment();this._alertDialog.action=null;break;case"findNextComment":this.gotoPage(1,!1);this.XLComment._updateCurrentCell(0,0);this.XLComment.findNextComment();this._alertDialog.action=null;break;case"sheetRenameActn":n("#"+this._id+"_Sheet_RenamePanel").select().focus();break;case"sheetDeleteActn":this._removeSheet(i);this._alertDialog.action=null;break;case"New":this._isNew=!0;this._destroy();this._dataContainer.sheets[r]={};this.clearUndoRedo();this._updateCellType();this.model.sheetCount=r;this.model.activeSheetIndex=r;this._sheetSettings(r);this._newSIndex++;this._initCSSTag();this.gotoPage(r,!1);this.model.allowLockCell&&this.protectSheet(!1);f=n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").data("ejToggleButton");f&&(f.option("toggleState",!1),this.model.exportSettings.password=null,n("#"+this._id+"_AddSheet").removeClass("e-disable"));this.XLRibbon._toggleFormatTab();this.XLRibbon._toggleChartDesignTab();this.XLRibbon._toggleAnalyzeTab();this._refreshSpreadSheetPager();this.hideWaitingPopUp();this._isNew=!1;break;case"Open":n("#"+this._id+"_file .e-uploadinput").click();break;case"MergeCells":this._mergeCells(i,this.model.sheets[i]._selectedCells,{},[]);this._alertDialog.action=null;break;case"MergeAcrossCells":this._mergeAcrossCells(i,this.model.sheets[i]._selectedCells);this._alertDialog.action=null;break;case"MergeInsertDelete":this._refreshMergeCells();this._alertDialog.action=null;break;case"InvalidChartTitleActn":n("#"+this._id+"_chartnamedlg").find("input:first").focus();break;case"ConvertToRange":this.XLFormat._convertToRange({});break;case"TotalRow":this._isUndoRedo=this._dupDetails=!0;this.insertEntireRow(this._insRows.startRow,this._insRows.endRow);this.XLFormat._calculateTotalRow(i,null,!0,!1,!0);this._isUndoRedo=e;break;case"Drop":t=this.getSheet(i);this.XLDragDrop.moveRangeTo([t._startCell.rowIndex,t._startCell.colIndex,t._endCell.rowIndex,t._endCell.colIndex],[this._dStartCell.rowIndex,this._dStartCell.colIndex,this._dEndCell.rowIndex,this._dEndCell.colIndex]);t._startCell=this._dStartCell;t._endCell=this._dEndCell;this._trigger("drop",{sheetIndex:i,target:this.XLDragDrop._target,currentCell:this.XLDragDrop._dragAndDropCell,dragAndDropRange:{startCell:t._startCell,endCell:t._endCell}});break;case"FormulaAlert":this.XLEdit._editElem.focus();break;case"NMUniqueNameAlert":case"NMNameAlert":document.getElementById(this._id+"_nmgridname").focus();break;case"NMRangeAlert":document.getElementById(this._id+"_nmgridrefersto").focus();break;default:this.setSheetFocus()}},_alertCanClick:function(){var t=this._alertDialog,i;(t.action=="findNextComment"||t.action=="findPrevComment")&&n(this.getActiveCellElem()).find(".e-comment-txtarea").css("display","inline-table");t.action=="TotalRow"&&n("#"+this._id+"_Ribbon_Design_TableStyleOptions_TotalRow").length&&(this.XLRibbon._isSetModel=!0,n("#"+this._id+"_Ribbon_Design_TableStyleOptions_TotalRow").data("ejCheckBox").option("checked",!1),this.XLRibbon._isSetModel=!1);t.element&&t.element.ejDialog("close");switch(t.action){case"Drop":i=this.getSheet(this.getActiveSheetIndex());this.performSelection(i._startCell,i._endCell)}this.hideWaitingPopUp()},_showAlertDlg:function(t,i,r,u,f){var o=n("#"+this._id+"_alertdlg"),s="Alert",e,h={reqType:"alert",action:r};if(i instanceof Array?i[0]==="SheetRenameEmptyAlert"?e="<ul><li>"+this._getLocStr(i[0])+"<\/li><li>"+this._getLocStr(i[1])+"<\/li><li>"+this._getLocStr(i[2])+"\\ / ? * ["+this._getLocStr("OR")+" ] <\/li><li>"+this._getLocStr(i[3])+"<\/li><\/ul>":i[0]==="ClipboardAccessError"&&(e=this._getLocStr(i[0])+"<br /><br />"+this._getLocStr(i[1])+"<br />"+this._getLocStr(i[2])+"<br />"+this._getLocStr(i[3])):e=i.indexOf("T-")===0?i.slice(2):this._getLocStr(i),this._trigActionBegin(h)){this._alertDialog.action=r;this._alertCanClick();return}t===s?this._renderAlertDlgContent(o,s,e,r,u,f):this._renderAlertDlgContent(o,"",e,r,u,f);o.ejDialog("open")},_isSheetsDirty:function(){var n=1,t=this._dataContainer.sheets,i=this.getObjectLength(t)+1;if(this.model.nameManager.length||this.getObjectLength(t)>1)return!0;while(n<i){if(this.getObjectLength(t[n]))return!0;n++}return!1},getCell:function(t,i,r){var u=0,r=this._getSheetIndex(r),f=this.getSheet(r);return this.model.scrollSettings.allowVirtualScrolling&&(u=1,t=this._getRowIdx(t,r),t===-1)?null:(this.isImport||f._isImported||this._isPrint)&&this._detachTable?n(this._detachTable[0].tBodies[u].rows[t].cells[i]):this._getContTBody(r)?n(this._getContTBody(r)[0].rows[t].cells[i]):null},getRange:function(i,r,u){i=this._getRangeArgs(i,"object",r);var l=i[0],e=i[1],h=i[2],f=i[3],o,y,c,s,a,w,v,p=[],r=this._getSheetIndex(r),b=this.getSheet(r);if(c=(this.isImport||b._isImported)&&this._detachTable?n(this._detachTable[0].tBodies[1].rows):n(this._getContTBody(r)[0].rows),l>h&&(a=l,l=h,h=a),e>f&&(a=e,e=f,f=a),this.model.scrollSettings.allowVirtualScrolling)for(o=l;o<=h;o++)y=this._getRowIdx(o),y>-1&&(s=n(c[y].cells),v=f===e?[s[f]]:this._browserDetails.version==="8.0"?s.slice(e,f+1).toArray():s.slice(e,f+1),t.merge(p,v));else for(c=h!==l?c.slice(l,h+1):c.eq(h),w=c.length,o=0;o<w;o++)u&&this._isHiddenRow(o,r)||(s=n(c[o].cells),v=f===e?[s[f]]:this._browserDetails.version==="8.0"?s.slice(e,f+1).toArray():s.slice(e,f+1),t.merge(p,v));return n(p)},getRangeIndices:function(n){n=n.indexOf(":")===-1?n+":"+n:n;var r=n.split(":"),t,i=[];return t=r[0].split(/[A-Z]/i),i.push(parseInt(t[t.length-1])-1),i.push(this._generateColCount(r[0].split(/[0-9]/)[0].toUpperCase())-1),t=r[1].split(/[A-Z]/i),i.push(parseInt(t[t.length-1])-1),i.push(this._generateColCount(r[1].split(/[0-9]/)[0].toUpperCase())-1),this.swapRange(i),i},swapRange:function(n){return n[0]>n[2]&&t.dataUtil.swap(n,0,2),n[1]>n[3]&&t.dataUtil.swap(n,1,3),n},updateRange:function(n,t){var v;if(!this.model.isReadOnly){var u,o,y,s,p,h,c,f,l,i=[],a=[],e=t.dataSource,w=e.length,b=this.getObjectLength(e[0]);if(c=t.startCell,t.range?i=t.range:(h=c.split(/[A-Z]/i),i.push(parseInt(h[h.length-1])-1),i.push(this._generateColCount(c[0].split(/[0-9]/)[0].toUpperCase())-1),i.push(i[0]+w-(t.showHeader?0:1)),i.push(i[1]+b-1)),f=this._getSelectedRange({rowIndex:i[0],colIndex:i[1]},{rowIndex:i[2],colIndex:i[3]}),p=this._getContent(n),l=this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content >table"),this.model.allowAutoCellType&&this.model.allowCellType||l.detach(),t.showHeader)for(s in e[0])a.push(s);for(o=0;o<w;o++)if(e[o]!=r)for(s in e[0])a.push(e[o][s]);for(this._dupDetails=!0,u=0,y=f.length;u<y;u++)this.XLEdit._updateCell(f[u],a[u],n),t.showHeader&&u<b&&(i=t.startCell+":"+(this._generateHeaderText(f[f.length-1].colIndex+1)+(f[0].rowIndex+1)),t.headerStyles&&this.XLFormat.format({style:t.headerStyles},i));this._dupDetails=!1;this.model.allowAutoCellType&&this.model.allowCellType||p.find(".e-content").append(l);this._isUndoRedo||(v={sheetIndex:n,reqType:"update-range",rangeSettings:t},this._completeAction(v),this._trigActionComplete(v))}},editRange:function(t,i){var o,s,a,f,v,r,l,u=this.getActiveSheetIndex(),e=this.getSheet(u).rangeSettings[t],h=this.getRangeIndices(e.range),c=this.getRange(h);for(this._trigger("editRangeBegin",{range:e,sheetIndex:u}),e.cssClass&&c.addClass(e.cssClass),e.readOnly&&c.addClass("e-readonly"),v=this._getContent(u),l=this._getJSSheetContent(u).find(".e-spreadsheetcontentcontainer > .e-content >table"),l.detach(),o=0,a=c.length;o<a;o++)f=c[o],$cell=n(f),n.trim(t).length&&this.XLEdit._updateDataContainer({rowIndex:f.parentNode.rowIndex,colIndex:f.cellIndex},{dataObj:{range:t}}),r=i(f,f.cellIndex,o),typeof r=="string"?this.XLEdit._updateCell($cell,r):typeof r=="object"&&(r.Value.indexOf("=")!==0?this.XLEdit._updateCell($cell,r.Value):this.XLEdit._updateCellValue($cell,r.Value),$cell.data("value2",r.Value2),$cell.data("type",r.NumberFormat),r.StyleIndex>1&&$cell.addClass(this._styleColl[r.StyleIndex]));for(v.find(".e-content").append(l),s=h[0];s<h[2]+1;s++)this._setRowHdrHeight(u,s);this._trigger("editRangeComplete",{range:e,sheetIndex:u});this.XLScroll._getRowHeights(u,h[0])},removeRange:function(n){this.clearRange(n);delete this.getSheet(this.getActiveSheetIndex()).rangeSettings[n]},clearRange:function(n){if(!this.model.isReadOnly){var r,t,i=this.getSheet(this.getActiveSheetIndex()).rangeSettings[n];r=this.getRangeIndices(i.range);t=this.getRange(r);i.cssClass&&t.removeClass(i.cssClass);i.readOnly&&t.removeClass("e-readonly");this.clearRangeData(null,["range","value","type","value2"],t);t.empty()}},getObjectLength:function(n){var t,i=0;if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},Object.keys)return Object.keys(n).length;for(t in n)n.hasOwnProperty(t)&&i++;return i},getObjectKeys:function(n){var t,i=[];if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},!Object.keys){for(t in n)n.hasOwnProperty(t)&&i.push(t);return i}if(Object.keys)return Object.keys(n)},toArrayLowerCase:function(n){for(var t=0;t<n.length;t++)n[t]=n[t].toString().toLowerCase();return n},_isValueAlreadyExist:function(n,t,i){for(var r=0,u=n.length;r<u;){if(n[r][t]===i)return!0;r++}return!1},addClass:function(n,t){if(n){(n instanceof jQuery||n instanceof Array)&&(n=n[0]);var i=n.className;i.indexOf(t)===-1&&(n.className=i+" "+t)}},_removeClass:function(n,t){n&&((n instanceof jQuery||n instanceof Array)&&(n=n[0]),n.className=t?n.className.replace(new RegExp(t,"g"),"").replace(/ +/g," "):"")},_hasClass:function(n,t){return n?((n instanceof jQuery||n instanceof Array)&&(n=n[0]),!n||this._isAnimatedString(n.className))?!1:n.className.indexOf(t)>-1:!1},isUndefined:function(n){return n===r},_isString:function(n){return typeof n=="string"},_isEmptyString:function(n){return!n.toString().length},_isObject:function(n){return typeof n!="object"?!1:Object.prototype.toString.call(n)==="[object Object]"},_getObjectValues:function(n){var t,i=[];n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{};for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);return i},_isAnimatedString:function(n){return Object.prototype.toString.call(n)==="[object SVGAnimatedString]"},_isBool:function(n){return n=n+"",n=n.toUpperCase(),n==="TRUE"||n==="FALSE"},isRange:function(n){return n[0]!==n[2]||n[1]!==n[3]},_isMultiRange:function(n){return!this._isString(n)&&!this.isNumber(n[0])},inRange:function(n,t,i){return t>=n[0]&&t<=n[2]&&i>=n[1]&&i<=n[3]},_inRow:function(n,t){return t>=n[0]&&t<=n[2]},_inColumn:function(n,t){return t>=n[1]&&t<=n[3]},_isUniqueRange:function(n,t){return n.toString()===t.toString()},_isUniqueTarget:function(n,t){var i=this._getOriginalEvt(t),r=document.elementFromPoint(i.clientX,i.clientY);return n.target===r},_getClientDiff:function(n,t){return{x:n[0]-t[0],y:n[1]-t[1]}},hasSpan:function(n){return this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge")?!0:!1},_isFrozen:function(n){return n>0},_isSelected:function(t){return this._hasClass(t,"e-selected")||this._hasClass(t,"e-rowselected")||this._hasClass(t,"e-colselected")||n(t).parents(".e-colselected").length?!0:!1},_getMergedIdx:function(n,t){var u,e,o,s,h,i,c,l=ccount=0,f=this.getActiveSheetIndex(),r=this.XLEdit.getPropertyValue(n,t,"merge",f);if(r){if(r.mRange){if(u=this.getRangeIndices(r.mRange),c=this.getSheet(f),c.hideRowsCollection.length&&(e=u[0],o=u[2],o-e>1))for(i=e+1;i<o;)this.XLEdit.getPropertyValue(i,0,["isRHide"],f)&&l++,i++;if(this.getObjectLength(c.hideColsCollection)&&(s=u[1],h=u[3],h-s>1))for(i=s+1;i<h;)this.XLEdit.getPropertyValue(0,i,["isCHide"],f)&&ccount++,i++}if(r.mSpan)return{rowIndex:n+r.mSpan.rowSpan+l-1,colIndex:t+r.mSpan.colSpan+ccount-1}}return{rowIndex:n,colIndex:t}},_getMergeParent:function(n,t){var i=this.XLEdit.getPropertyValue(n,t,"mergeIdx");return i?{rowIndex:i.rowIndex,colIndex:i.colIndex}:{rowIndex:n,colIndex:t}},_getCellInfo:function(n,t){var i=this.getSheet(this._getSheetIndex(t)),s,h,u,f=0,e=0,o,r;if(s=n.rowIndex>=i._frozenRows?i._rowHeightCollection[n.rowIndex]-(i._rowHeightCollection[i._ftopRowIdx]-i._rowHeightCollection[i._frozenRows-1]):i._rowHeightCollection[n.rowIndex],h=n.colIndex>=i._frozenColumns?i._colWidthCollection[n.colIndex]-(i._colWidthCollection[i._fleftColIdx]-i._colWidthCollection[i._frozenColumns-1]):i._colWidthCollection[n.colIndex],u=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge"),u){for(o=u.mSpan,r=0;r<o.rowSpan;r++)e+=i.hideRowsCollection.indexOf(n.rowIndex+r)===-1?i.rowsHeightCollection[n.rowIndex+r]:0;for(r=0;r<o.colSpan;r++)f+=i.columnsWidthCollection[n.colIndex+r]}else e=i.hideRowsCollection.indexOf(n.rowIndex)===-1?i.rowsHeightCollection[n.rowIndex]:0,f=i.columnsWidthCollection[n.colIndex];return{top:s-1,left:h-1,height:e,width:f}},_getRowIdx:function(n,t,i,r){var u,f=this.getSheet(t);return i?(u=f._rowIdxColl[n],n=this.isUndefined(u)?f._rowIdxColl[f._rowIdxColl.length-1]:u):r?(u=f._rowIdxColl.indexOf(n),n=u===-1?n:u):this.model.scrollSettings.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&(n=f._virtualRowIdx.indexOf(n)),n},_getMinRowIdx:function(n){for(var t=0;t<n.rowCount;t++)if(n.hideRowsCollection.indexOf(t)===-1&&n._hiddenFreezeRows.indexOf(t)===-1)return t;return 0},_arrayAsString:function(n){return n.join(" ").replace(/,/g," ")},_rangeHasData:function(n){var t,i,r;for(n=this.swapRange(n),t=this._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]}),i=t.length;i--;)if(r=t[i],this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex))return!0;return!1},_isTableRange:function(n,t,i){i=this._getSheetIndex(i);var r,u=this.getSheet(i).tableManager;for(r in u)if(this.inRange(u[r].range,n,t))return!0;return!1},_hasCellStyle:function(n,t,i){for(var r,u=["borders","formats"],f=u.length;f--;)if(r=this.XLEdit.getPropertyValue(n,t,u[f],i),r)return!0;return!1},_isHiddenRow:function(n,t){return this.XLEdit.getPropertyValue(n,0,"isFilterHide",t)||this.XLEdit.getPropertyValue(n,0,"isRHide",t)||!1},_refreshViewVar:function(n,i,r){r=this._getSheetIndex(r);var u=this.getSheet(r);t.isNullOrUndefined(n)||(u._topRow.idx=this.XLShape._getCellIndexFromOffset(n,null,r).rowIndex,u._topRow.value=this._getRowOffsetTop(u,u._topRow.idx),u._bottomRow.idx=u._rowIdxColl[u._topRow.idx+(u._virtualBlockRowCnt-this._bufferCnt-1)],u._bottomRow.value=this._getRowOffsetTop(u,u._bottomRow.idx),u.topLeftCell=this.getAlphaRange(u._topRow.idx,u._leftCol.idx));t.isNullOrUndefined(i)||(u._leftCol.idx=this.XLShape._getCellIndexFromOffset(null,i,r).colIndex,u._leftCol.value=this._getColOffsetLeft(u,u._leftCol.idx),u._rightCol.idx=this.XLShape._getCellIndexFromOffset(null,i+u._vPortWth,r).colIndex||u.colCount-1,u._rightCol.value=this._getColOffsetLeft(u,u._rightCol.idx),u.topLeftCell=this.getAlphaRange(u._topRow.idx,u._leftCol.idx))},_getFormatString:function(n,i){var r=t.Spreadsheet.CellFormat[n];return this.isNumber(i)&&!t.isNullOrUndefined(r)&&(r="{0:"+r.substr(3,1)+i+"}"),r||""},_refreshVrtlBlocks:function(n){for(var r,i=idx=0,u=["_virtualTopTBodyOffset","_virtualContTBodyOffset","_virtualBottomTBodyOffset"],n=this._getSheetIndex(n),t=this.getSheet(n);i<3;)(i||t._isVirtualTopReached)&&i!==1&&(i!==2||t._isVirtualEndReached)||(r=t._virtualRowIdx[idx],t[u[i]].top=this._getRowOffsetTop(t,r),idx+=t._virtualBlockRowCnt,r=t._virtualRowIdx[idx-1],t[u[i]].bottom=this._getRowOffsetBottom(r,n)),i++;t._virtualTBodyHgt=t._rowHeightCollection[t._rowHeightCollection.length-1]+t.rowsHeightCollection[t.rowsHeightCollection.length-1]},getRangeDataAsObject:function(n,i,r){var f,s,e,h,c,w=t.Spreadsheet.CellType,o=this._dataContainer,d=this.getActiveSheetIndex(),l=o.sheets[this.getActiveSheetIndex()],u,a,v,y,b=[],k=[],p=[];for(n.rowIndex>i.rowIndex?(u=i.rowIndex,a=n.rowIndex):(u=n.rowIndex,a=i.rowIndex),n.colIndex>i.colIndex?(v=i.colIndex,y=n.colIndex):(v=n.colIndex,y=i.colIndex);u<=a;){if(!r||!this._isHiddenRow(u)){for(h={},c={},f=v;f<=y;f++)s=this._generateHeaderText(f+1),u in l&&f in l[u]&&(e=l[u][f],h[s]=o.sharedData[e.value],c[s]=[w.General,w.Text].indexOf(o.cellType[e.type])===-1?e.value2:o.sharedData[e.value2]);b.push(h);k.push(c)}u++}return p.push(b),p.push(k),p},getRangeDataAsJSON:function(n,i,r,u){var o,y,e,h,a=t.Spreadsheet.CellType,c=this._dataContainer,s=c.sheets[u?u:this.getActiveSheetIndex()],f,p,w,b,k=[],v=!0,d=[],l;for(n.rowIndex>i.rowIndex?(f=i.rowIndex,p=n.rowIndex):(f=n.rowIndex,p=i.rowIndex),n.colIndex>i.colIndex?(w=i.colIndex,b=n.colIndex):(w=n.colIndex,b=i.colIndex);f<=p;){if(!r||!this._isHiddenRow(f)){for(h={},o=w;o<=b;o++)v?f in s&&o in s[f]&&(e=s[f][o],d[o]=this.isUndefined(e.type)||[a.General,a.Text].indexOf(c.cellType[e.type])!==-1?c.sharedData[e.value2]:e.value2):(y=d[o],f in s&&o in s[f]?(e=s[f][o],l=this.isUndefined(e.type)||[a.General,a.Text].indexOf(c.cellType[e.type])!==-1?c.sharedData[e.value2]:e.value2,h[y]=t.isNullOrUndefined(l)?"":this.isNumber(l)?parseInt(l):l):h[y]="");!v&&this.getObjectLength(h)&&k.push(h)}f++;v&&(v=!1)}return k},_getColorFromFormat:function(n){var r=[],i,u,f;return t.isNullOrUndefined(n)||(i=n.replace("e-format","").toLowerCase(),u=i.startsWith("6n")?"#"+i.substr(2,6):"#"+i.substr(6,6),f="#"+i.substr(0,6),r.push(f),r.push(u)),r},getRangeData:function(n){n=n||{};n.sheetIdx=this._getSheetIndex(n.sheetIdx);n.range=this._toIntrnlRange(n.range,n.sheetIdx);n.property=n.property||["value","value2","type","formatStr","decimalPlaces","thousandSeparator","range","format","border","comment","hyperlink","picture","cFormatRule","rule","chart","isLocked","wrap","formats","cellType","altTxt"];var e=0,c,l,i,r,o,s,u,h=[],f=[],a=this.getSheet(n.sheetIdx);if(n.rowIdxs)for(c=n.rowIdxs.length;e<c;)this._pushRowData(n,n.rowIdxs[e],0,a.colCount-1,f,h),e++;else for(u=!1,this.model.scrollSettings.allowVirtualScrolling&&n.skipHiddenRow&&!t.isNullOrUndefined(n.virtualRowIdx)?(u=!0,i=n.virtualRowIdx,r=i+(n.virtualRowCount-1),o=a.colCount-1):(i=n.range[0],r=n.range[2],o=n.range[3]);i<=r;)s=this._isHiddenRow(i,n.sheetIdx),u&&s?r++:n.skipHiddenRow&&s||(l=u?0:n.range[1],this._pushRowData(n,i,l,o,f,h,!0)),i++;return n.withRowIdx?{rowIdx:h,data:f}:f},_pushRowData:function(n,t,i,r,u,f,e){var o,h,c,s,a,v="value",p=this._intrnlUpdate,y=this._dataContainer,l=y.sheets[n.sheetIdx];if(e||this.XLEdit._refreshContainer(t,n.sheetIdx),l[t])if(n.valueOnly)while(i<=r)o="",s=l[t][i],s&&v in s&&(a=y.sharedData,o=a[s[v]],n.skipDateTime&&this._isDateTime(o)?o=this.XLEdit.getPropertyValue(t,i,"value2",n.sheetIdx):n.skipFormula&&this.isFormula(o)&&(o=this.XLEdit.getPropertyValue(t,i,"calcValue",n.sheetIdx))),n.skipEmptyCell&&(this.isUndefined(o)||!o.toString().length)||u.push(o),i++;else{for(this._intrnlUpdate=!0;i<=r;){if(s=l[t][i],s){h={};for(c in s)n.property.indexOf(c)>-1&&(h[c]=this.XLEdit.getPropertyValue(t,i,c,n.sheetIdx));(!n.skipEmptyCell||this.getObjectLength(h))&&u.push(h)}else n.skipEmptyCell||u.push({});i++}this._intrnlUpdate=p}else if(!n.skipEmptyCell)while(i<=r)n.valueOnly?u.push(""):u.push({}),i++;f.push(t)},_processBindings:function(n){if(this.model.query=new t.Query,this._trigger("actionBegin",n))return!0;this._ensureDataSource(n);n.action==="sorting"?(this.XLSort._sortComplete(n),this._isUndoRedo||(this._completeAction(n),this._trigActionComplete(n))):(this._completeAction(n),this._trigActionComplete(n))},_ensureDataSource:function(n){var i,v,o,u,s,h,f,c,l=this.getActiveSheetIndex(),a=this.getSheet(l),e,y;if(n.action==="filtering"||n.action==="clearfiltering"||n.requestType==="filterbycell"){for(i=a.filterSettings.filteredRange==null?this._dataSource(l):a.filterSettings.filteredRange,c=a.filterSettings.tableRange,e=0,y=c.length;e<y;e++)if(c[e].tableID===n.tableID){c[e].filteredRange=i;break}if(this._dataManager=t.DataManager(i),i instanceof t.DataManager||(this.model.currentViewData=i),this.model.query.requiresCount(),n.filteredcolumns.length){s=this._excelFilter._predicates[l];v=i[0];for(o in s)v.hasOwnProperty(o)&&(h=s[o]),h=s[o],u=u!=r?u.and(h):h;t.isNullOrUndefined(u)||this.model.query.where(u);i instanceof t.DataManager||(f=this._dataManager.executeLocal(this.model.query),this._filteredRecordsCount=f.count,this.model.currentViewData=f.result)}}else n.requestType==="sorting"&&(this._dataManager=t.DataManager(n.rangeData),n.rangeData instanceof t.DataManager||(this.model.currentViewData=n.rangeData),this.model.query.sortBy(n.columnName,n.sortDirection),n.rangeData instanceof t.DataManager||(f=this._dataManager.executeLocal(this.model.query),this.model.currentViewData=f));this._dataManager=null},_toArrayData:function(n){for(var u,t,i=0,r=[],f=n.length;i<f;){if(t=n[i],this.getObjectLength(t))for(u in t)r.push(t[u]);else r.push("");i++}return r},_updateRangeStyle:function(n,t,i){for(var u=this._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]}),r=0;r<u.length;r++)this.model.allowCellFormatting&&this.XLFormat._hasFormat(t[r].format)&&(this.XLFormat._updateFormatClass(u[r],t[r].format),this.XLEdit._updateDataContainer(u[r],{dataObj:{formats:t[r].formats},sheetIdx:this.getActiveSheetIndex(),status:i}))},updateRangeData:function(n,i){var u,f,r;if(!this.model.isReadOnly&&(n=this._getRangeArgs(n,"object"),n.length&&(n.startCell={rowIndex:n[0],colIndex:n[1]},n.endCell={rowIndex:n[2],colIndex:n[3]}),u=this._getSelectedRange(n.startCell,n.endCell),f=this._toArrayData(i),f.length===u.length))for(r=0;r<u.length;r++)t.isNullOrUndefined(f[r])||this.XLEdit._updateCellValue(this.getCell(u[r].rowIndex,u[r].colIndex),f[r])},updateData:function(n,i,r){if(!this.model.isReadOnly){var f,a,e,v,c,o,u,h,y=0,p="clear-format",s={},l=this._cellProp,w=this.getActiveSheetIndex(),b=this.getSheet(w);for(i=this._getRangeArgs(i,"object"),f=i[0],a=i[2],v=i[3];f<=a;){for(e=i[1];e<=v;)u=n[y],o=this.getCell(f,e,w),"wrap"in u&&this.setWrapText("wrap",i),this.XLEdit._updateDataContainer({rowIndex:f,colIndex:e},{dataObj:u}),o&&(l[13]in u&&(h=u.hyperlink,h&&(r===p?o.find("a").css({color:this._hlColor,"text-decoration":"underline"}).addClass("e-hyperlinks"):h.webAddr?o.html(t.buildTag("a",u.value2,"",{href:h.webAddr,target:"_blank","class":"e-hyperlinks"})):o.html(t.buildTag("a",u.value2,"",{"class":"e-hyperlinks"})))),r===p&&(u.formatStr&&(s.formatStr=u.formatStr),u.type&&(s.type=u.type),t.isNullOrUndefined(u.decimalPlaces)||(s.decimalPlaces=u.decimalPlaces),t.isNullOrUndefined(u.thousandSeparator)||(s.thousandSeparator=u.thousandSeparator),this.XLFormat.format(s,[f,e,f,e])),l[21]in u&&this.XLComment._updateCmntFrmCntnr(f,e),l[0]in u&&(c=u.value,this.XLEdit._refreshCalcEngine(f,e,this.isFormula(c),c))),y++,e++;f++}}},updateUniqueData:function(n,t,i,r){if(!this.model.isReadOnly){t=this._getRangeArgs(t,"object");var u,f={dataObj:n},e=t[0],o=t[2],s=t[3];for(i&&(f.skipCell=i),f.sheetIdx=r;e<=o;){for(u=t[1];u<=s;)this.XLEdit._updateDataContainer({rowIndex:e,colIndex:u},f),u++;e++}}},clearRangeData:function(n,t,i,r,u,f){if(!this.model.isReadOnly){var e,o,s,h,c=this.getActiveSheetIndex();for(n=this._getRangeArgs(n,"object",c),t=t?t:["value","value2","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","isFilterHighlight"],e=n[0],s=n[2],h=n[3];e<=s;){if(!r||!this._isHiddenRow(e))for(o=n[1];o<=h;)this.XLEdit._clearDataContainer({cellIdx:{rowIndex:e,colIndex:o},property:t,status:u,skipCell:f}),o++;t.indexOf("wrap")>-1&&this._setRowHdrHeight(c,e);e++}}},_getArrayRangeCells:function(n){return n?(n=this.swapRange(n),this.getRange(n)):this._getContent(this.getActiveSheetIndex()).find(".e-selected")},_getAlphaRangeCells:function(n){return n?(n=this.getRangeIndices(n),this.getRange(n)):this._getContent(this.getActiveSheetIndex()).find(".e-selected")},_getMultiRangeCells:function(n){var i,t,u,r,f;if(n){if(i=0,u=[],r=[],this._isString(n))r.push(this.getRangeIndices(n));else if(this.isNumber(n[0]))r.push(n);else for(f=n.length;i<f;)t=n[i],r.push(Array.isArray(t)?t:this.getRangeIndices(t)),i++;for(i=0,f=r.length;i<f;)t=r[i],u=u.concat(this._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]})),i++}else n=this._getRangeArgs(n,"object"),u=this._getSelectedCells(this.getActiveSheetIndex(),n).selCells;return u},_completeAction:function(n){var u=this.getActiveSheetIndex(),e=this.getSheet(u),i,s,v,y,h,c,l,r,f,o,a;if(n.reqType==="filter"){if(n.operation!=="apply-filter"&&n.operation!=="remove-filter"&&n.operation!=="clearfilter")for(s=n.model.currentViewData,i={sheetIndex:u,range:e._selectedRange,currentViewData:s,fieldName:n.currentFilteringColumn,ejpredicate:n.ejpredicate,activeCell:n.activeCell,filteredValue:n.filteredValue,filterCollection:n.filteredcolumns,requestType:n.requestType,reqType:n.reqType,selectedCell:n.selectedCell,action:n.action,operation:"filter",selectedDataSource:e.selectedDataSource,tableID:n.tableID,filteredCells:n.filteredCells,fltrdIdxes:[],selRange:n.selRange},r=0,len=s.length;r<len;r++)i.fltrdIdxes.push(i.range.startRow+e.filterSettings.filteredRange.indexOf(s[r]));else i=n.operation==="remove-filter"||n.operation==="clearfilter"?n:{sheetIndex:u,filteredCells:n.filteredCells,reqType:"filter",operation:"apply-filter",tableID:n.tableID,fRange:this.getSheet(u).filterSettings.range};i.rowIndex=n.rowIndex;i.colIndex=n.colIndex}else if(n.requestType===t.Spreadsheet.Actions.Sorting){for(l=[],c=n.filterIcon.length>0?n.range[0]-1:n.range[0],r=0;r<n.filterIcon.length;r++)h=this.XLFilter._getFilterHeader(u,c,n.filterIcon[r].colIndex),v=t.isNullOrUndefined(h)?"":h.status.indexOf("-asc")>-1?"-asc":h.status.indexOf("-dsc")>-1?"-dsc":"",y=n.filterIcon[r].colIndex===this._generateColCount(n.columnName)-1?n.sortDirection==="ascending"?"-asc":"-dsc":"",l.push({rowIdx:c,colIdx:n.filterIcon[r].colIndex,prevIcon:v,currIcon:y});i={sheetIndex:u,filterIcons:l,isSortByFilter:n.isSortByFilter,colSelected:n.colSelected,range:n.range,columnName:n.columnName,rangeData:n.rangeData,reqType:"sort",direction:n.sortDirection,operation:"unsort"}}else if(n.requestType==="sortbycolor"||n.requestType==="filterbycolor"){if(i={sheetIndex:u,operation:n.operation,oprType:n.oprType,requestType:n.requestType,action:n.action,bgcolor:n.bgcolor,fgcolor:n.fgcolor,tableID:n.tableID,reqType:n.requestType,sortRange:n.sortRange},i.columnName=n.requestType==="sortbycolor"?n.sortColumn:n.filterColumn,n.requestType==="filterbycolor"){for(o=[],a=this._generateColCount(i.columnName),r=n.range.endRow;r>=n.range.startRow;r--)f=this.XLEdit.getPropertyValue(r,a-1,"formats"),t.isNullOrUndefined(f)||(n.operation==="filterbgcolor"?t.isNullOrUndefined(f["background-color"])||n.bgcolor.toLowerCase()===f["background-color"].toLowerCase()&&o.push(r):t.isNullOrUndefined(f.color)||n.fgcolor.toLowerCase()===f.color.toLowerCase()&&o.push(r));i.fltrdIdxes=o;i.rowIndex=n.range.startRow-1;i.colIndex=a-1}}else i=n;!this.model.allowUndoRedo||i.requestType==="sortbycolor"||this._dupDetails||this.updateUndoRedoCollection(i);(n.requestType==="filtering"||n.requestType==="filterbycolor"||n.requestType==="sortbycolor"||n.requestType==="filterbycell")&&n.operation!=="apply-filter"&&n.operation!=="remove-filter"&&this.sendDataRenderingRequest(i,this.getActiveSheetIndex());this.model.allowAutoFill&&n.reqType!=="find-replace"&&this.element.find(".e-ss-activeimg").length<1&&!e._isFreezed&&this.XLDragFill.positionAutoFillElement();this.XLComment&&this.XLComment._isCommentEdit||this._updateUndoRedoIcons();n.reqType!=="paging"&&n.reqType==="edit"&&n.hasValidation&&this._trigrDdlActnCmplt(n.cValue,n.pValue)},updateUndoRedoCollection:function(n){this._isUndoRedo||n.reqType==="update-range"||(this._undoCollection.push(n),this._redoCollection=[]);this._undoCollection.length>this.undoRedoStep&&this._undoCollection.splice(0,1);this.model.showRibbon&&this.XLRibbon._updateRibbonIcons();this._updateUndoRedoIcons()},_trigActionBegin:function(n){return!this._isSaveAsJSON&&this._trigger("actionBegin",n)},_trigActionComplete:function(n){return!this._isSaveAsJSON&&this._trigger("actionComplete",n)},_updateUndoRedoIcons:function(){if(!this.model.showRibbon||!this.model.allowUndoRedo){this.XLComment&&this.XLComment._isCommentEdit||this.setSheetFocus();return}if(n("#"+this._id+"_Ribbon_Home_Actions_Undo").length&&n("#"+this._id+"_Ribbon_Home_Actions_Redo").length&&!this.model.isReadOnly){var t=n("#"+this._id+"_Ribbon_Home_Actions_Undo").data("ejButton"),i=n("#"+this._id+"_Ribbon_Home_Actions_Redo").data("ejButton");t&&(this._undoCollection.length?t.enable():t.disable());i&&(this._redoCollection.length?i.enable():i.disable());this.XLEdit._isEdit||this.XLComment&&this.XLComment._isCommentEdit||this._isSheetRename||!document.activeElement||!(document.activeElement.id.indexOf(this._id+"_Ribbon")<0)||this.setSheetFocus()}},_filterMergeCells:function(n,t){for(var s=this.getActiveSheetIndex(),h=this._dataContainer.sheets[s],e=this.getObjectKeys(h[n]),r,i,o=!1,u,f=0;f<e.length;f++)u=this.XLEdit.getPropertyValue(n,e[f],"mergeIdx"),u&&(r=u,o=!0);o&&(i=this.getCell(r.rowIndex,r.colIndex)[0],i.rowSpan=t==="incr"?i.rowSpan+1:i.rowSpan-1)},_isRowVisible:function(n,t){var i=this._dataContainer.sheets[n];return t in i?0 in i[t]&&(i[t][0].isRHide||i[t][0].isFRHide)?!1:!0:!0},_selectFirstCell:function(n,t,i,r){var u=this.getSheet(n);return u._isImported&&!u._isLoaded||r||(r=!r,this.performSelection({rowIndex:t,colIndex:i},{rowIndex:t,colIndex:i})),r},_clearAllMergeCells:function(t,i,r,u,f,e){var a=this.getSheet(t),y=!1,b=this._dupDetails,p,v=a._mergeColl,k=a._unmergeColl,d=this._removeMergeColl,o,c,g=this._dataContainer.sheets[t],l={isCancel:!1,isAlert:!0},s,w,h;for(this._dupDetails=!0,o=this.getObjectKeys(v),o.length<1&&(y=!0),s=0,w=o.length;s<w;s++)for(c=this.getObjectKeys(v[o[s]]),h=0;h<c.length;h++)mergeObj=n.extend(!0,{},this.XLEdit.getPropertyValue(o[s],c[h],"merge")),p=this.getRangeIndices(mergeObj.mRange),l=this._checkFilterMerge(t,p,i,r,u,f,e,"merge",y,o[s],c[h],mergeObj),l.isClear&&(o[s]in k||(a._unmergeColl[o[s]]={}),a._unmergeColl[o[s]][c[h]]={type:v[o[s]][c[h]],merge:mergeObj,isClear:!0},this.unmergeCells(mergeObj.mRange,!0)),l.isClear=!1;return this._dupDetails=b,{isCancel:l.isCancel,isAlert:l.isAlert}},_checkFilterMerge:function(n,t,i,r,u,f,e,o,s,h,c,l){var v,p=this.getSheet(n),y=this._getSelectedCells(n,t).range,a=!1,w=p._mergeColl;return e.indexOf("shift")>-1||o!="merge"&&(e.indexOf("insert")>-1||e.indexOf("delete")>-1)?(o==="merge"&&(this._removeMergeColl=[]),e.indexOf("Bottom")>-1||e.indexOf("Up")>-1||o!="merge"&&e.indexOf("Row")>-1?(u>=t[1]||t[3]>=u+f-1||e.indexOf("Row")>-1?(i>=t[2]||i<=t[2])&&(u<t[1]&&u+f-1<t[1]?s=!0:u>t[3]&&u+f-1>t[3]?s=!0:this._isTotalRow||u!==t[1]||t[3]!==u+f-1||(a=!0,s=!0),!s&&i>t[2]&&(s=!0)):u<t[1]&&t[3]<u+f-1&&(s=!0,a=!0),o!=="merge"||this._isUndoRedo||e.indexOf("Up")>-1&&this.XLEdit._rangeHasProperty(y,"merge")&&(this._showAlertDlg("Alert","MergePreventInsertDelete","MergePreventInsertDelete",450),a=!1,v=!0)):(e.indexOf("Right")>-1||e.indexOf("Left")>-1||o!="merge"&&e.indexOf("Column")>-1)&&(i>=t[0]||t[2]>=i+r-1||e.indexOf("Column")>-1?(u>=t[3]||u<=t[3])&&(i<t[0]&&i+r-1<t[0]?s=!0:i>t[2]&&i+r-1>t[2]?s=!0:i===t[0]&&t[2]===i+r-1&&(a=!0,s=!0),!s&&u>t[3]&&(s=!0)):i<t[0]&&t[2]<i+r-1&&(s=!0,a=!0),o!=="merge"||this._isUndoRedo||e.indexOf("Left")>-1&&this.XLEdit._rangeHasProperty(y,"merge")&&(this._showAlertDlg("Alert","CtrlKeyErrorAlert","CtrlKeyErrorAction",450),a=!1,v=!0)),o!=="merge"||s||a||this._removeMergeColl.push({type:w[h][c],merge:l})):(this._isUndoRedo&&(s=!0),(i===-1||i!=-1&&t[0]<=i&&t[2]>i)&&(a=!0),(u===-1||u!=-1&&t[1]<=u&&t[3]>u)&&(a=!0)),{isClear:a,isAlert:s,isCancel:v}},_checkTableApplied:function(n,t,i,r,u,f){var l=this.getSheet(n),o,s=l.tableManager,h=this.getObjectKeys(s),e,c;for(this._isTableApplied=!1,e=0,c=h.length;e<c;e++)if(o=s[h[e]].range,chkObj=this._checkFilterMerge(n,o,t,i,r,u,f,"filter",!1),this._isTableApplied=!chkObj.isAlert,this._isTableApplied)return!0;return!1},_refreshAllMergeCells:function(n,i,r,u,f,e){var p=this.getSheet(n),y=!1,b=p._unmergeColl,d=this._dupDetails,g,nt,h,l,o,tt=this._dataContainer.sheets[n],a,v,w,s,k,c;for(h=this.getObjectKeys(b),this._dupDetails=!0,s=0,k=h.length;s<k;s++)for(g=parseInt(h[s])>i?e.indexOf("insert")>-1?parseInt(h[s])+r:parseInt(h[s])-r:h[s],l=this.getObjectKeys(b[h[s]]),c=0;c<l.length;c++)nt=parseInt(l[c])>u?e.indexOf("insert")>-1?parseInt(l[c])+f:parseInt(l[c])-f:l[c],mergeObj=p._unmergeColl[h[s]][l[c]].merge,this.mergeCenter=p._unmergeColl[h[s]][l[c]].type==="center",w=p._unmergeColl[h[s]][l[c]].isClear,o=this.getRangeIndices(mergeObj.mRange),(i>-1||u>-1)&&(t.isNullOrUndefined(o)||(e.indexOf("Shift")>-1?(this._unMergeRange=mergeObj.mRange,this._showAlertDlg("","MergeCellsAlert","MergeCellsInsertAlert",498)):(i>-1&&(o[0]===o[2]&&(y=!0),(!y||w)&&(a=o[0],v=o[2],i<=o[0]&&(a=e==="insert"?o[0]+r:o[0]-r),i<=o[2]&&(v=e==="insert"?o[2]+r:o[2]-r),a<=v&&(o[0]=a),v>=a&&(o[2]=v))),u>-1&&(o[1]===o[3]&&(y=!0),(!y||w)&&(a=o[1],v=o[3],u<=o[1]&&(a=e==="insert"?o[1]+f:o[1]-f),u<=o[3]&&(v=e==="insert"?o[3]+f:o[3]-f),a<=v&&(o[1]=a),v>=a&&(o[3]=v))),!y||y&&e==="insert"?(mRange=this._getAlphaRange(n,o[0],o[1],o[2],o[3]),this.mergeCells(mRange,!0),delete p._unmergeColl[h[s]][l[c]],y=!1,isPMerge=!1):p._unmergeColl[h[s]][l[c]].isClear=!1)));this._dupDetails=d},_clearMergeColl:function(n,t,i){n[t]&&delete n[t][i];this.getObjectKeys(n[t]).length<1&&delete n[t]},_refreshSHMergeCells:function(t,i,r,u,f){var p=this.getSheet(t),o,a,w=n.extend(!0,{},p._mergeColl),h,v,ut=0,y,e,g,nt,ft=!1,et,k,d,tt,it,ot=!1,st,ht,s,ct,l,lt,c,rt,b;if(h=this.getObjectKeys(w),hideColl=u==="column"?this.getObjectKeys(p.hideColsCollection):p.hideRowsCollection,f==="hide")for(s=0,st=h.length;s<st;s++)for(v=this.getObjectKeys(w[h[s]]),l=0,ht=v.length;l<ht;l++)if(isModified=!1,g=!1,newSpan=0,isSamePosn=!1,isMerge=!1,y=this.XLEdit.getPropertyValue(h[s],v[l],"merge"),!(this.getObjectKeys(y).length<1)){for(e=this.getRangeIndices(y.mRange),o=u==="column"?e[1]:e[0],a=u==="column"?e[3]:e[2],c=o;c<=a;c++)i.indexOf(c)>-1&&(isMerge=!0);if(isMerge){if(this._dupDetails=!0,stIdx=i[0],enIdx=i[i.length-1],diff=enIdx-stIdx+1,this.mergeCenter=w[h[s]][v[l]].type==="center",this.unmergeCells(y.mRange),enIdx<o)g=!0,o=o+diff,a=a+diff;else if(a<stIdx)g=!1;else{for(ut=0,nt=!1,c=0,rt=i.length;c<rt;c++)i[c]>=o&&i[c]<=a&&ut++,i[c]===o&&(nt=!0);for((o in i)&&(nt=!0),et=0,b=o;b<=a;b++)u==="column"&&(b=b.toString()),hideColl.indexOf(b)>-1&&et++;et===a-o+1&&(ft=!0);nt&&!ft&&(o=o+ut)}k=u==="row"?o:e[0];tt=u==="row"?a:e[2];d=u==="column"?o:e[1];it=u==="column"?a:e[3];ft?h[s]in p._delmergeColl?p._delmergeColl[h[s]][v[l]]={type:w[h[s]][v[l]].type,merge:y}:(p._delmergeColl[h[s]]={},p._delmergeColl[h[s]][v[l]]={type:w[h[s]][v[l]].type,merge:y}):this.mergeCells(this._getAlphaRange(t,k,d,tt,it),!0);this.mergeCenter=!1;this._updateMergeColl(t,k,d,w[h[s]][v[l]].type,f==="hide")}}if(f==="show")for(this.getObjectLength(p._delmergeColl)>0&&(w=n.extend(!0,{},p._delmergeColl),h=this.getObjectKeys(w)),s=0,ct=h.length;s<ct;s++)for(v=this.getObjectKeys(w[h[s]]),isMerge=!1,l=0,lt=v.length;l<lt;l++){if(y=w[h[s]][v[l]].merge,this.getObjectKeys(y).length<1&&(y=this.XLEdit.getPropertyValue(h[s],v[l],"merge")),this.getObjectKeys(y).length>0){for(e=this.getRangeIndices(y.mRange),o=u==="column"?e[1]:e[0],a=u==="column"?e[3]:e[2],stIdx=i[0],enIdx=i[i.length-1],c=o;c<=a;c++)stIdx<=c&&(isMerge=!0);if(!isMerge||this.getObjectLength(p._delmergeColl)>0)continue;for(this.getObjectLength(p._delmergeColl)===0&&(this._dupDetails=!0,diff=enIdx-stIdx+1,this.mergeCenter=y.isCenterAlign,this.unmergeCells(y.mRange),enIdx<o&&(g=!0,o=o-diff,diff!=1&&(a=a-diff),k=u==="row"?o:e[0],tt=u==="row"?a:e[2],d=u==="column"?o:e[1],it=u==="column"?a:e[3],this.mergeCells(this._getAlphaRange(t,k,d,tt,it),!0),this._updateMergeColl(t,k,d,w[h[s]][v[l]].type,f==="hide"))),ot=!1,c=0,rt=i.length;c<rt;c++)if(u==="row"&&e[0]<=i[c]||u==="column"&&e[1]<=i[c]){ot=!0;break}if(ot){for(e=this.getRangeIndices(y.mRange),diff=0,b=o;b<=a;b++)if(hideColl.indexOf(b)>-1)diff++;else break;o=o+diff;u==="column"?e[1]=o:e[0]=o;this.mergeCells(this._getAlphaRange(t,e[0],e[1],e[2],e[3]),!0);this._updateMergeColl(t,e[0],e[1],w[h[s]][v[l]].type,!0);this._clearMergeColl(p._delmergeColl,h[s],v[l])}}this.mergeCenter=!1}this._dupDetails=!1},_getSpanFromMCells:function(n,t,i){var u=this.getSheet(this.getActiveSheetIndex()),r=u._hideMergeColl;return!this.isUndefined(r[n])&&!this.isUndefined(r[n][t])?i==="row"?r[n][t].rowspan:r[n][t].colspan:0},_setSpanToMCells:function(n,t,i,r){var f=this.getSheet(this.getActiveSheetIndex()),u=f._hideMergeColl;this.isUndefined(u[n])&&(u[n]={});this.isUndefined(u[n][t])&&(u[n][t]={});i==="row"?u[n][t].rowspan=r:u[n][t].colspan=r},sendDataRenderingRequest:function(i,u){for(var f,it=!1,ri,g,at,lt,ui=this._rAlign,o=this.getSheet(u),tt=this.model.scrollSettings.allowVirtualScrolling,e=o._selectedRange,k=[],h,fi,kt,l=o.filteredRowsCollection,v,ft,y,p=o.filterSettings.tableRange,et=[],dt,ot,b=[],st,ut,w,pt,gt,s,wt,bt,d,ni,ct,ti,ii,a=0,rt=p.length;a<rt;a++)if(p[a].tableID==i.tableID){y=a;break}if(tt&&(ri=o.rowsHeightCollection,g=o.hideRowsCollection),this._dupDetails=!0,t.isNullOrUndefined(i)||i.reqType!="filter"){if(!t.isNullOrUndefined(i)&&(i.requestType==="sortbycolor"||i.requestType==="filterbycolor")){var ei=e.startRow,vt=[],ht,yt=[],h=this._generateColCount(i.columnName)-1,c,nt;if(i.prev={},i.cur={},i.oprType.indexOf("Put")<0&&(o._filterColl[e.startRow-1][h].status.indexOf("e-ssfilter")>-1&&i.requestType==="filterbycolor"?this._isRowViewable(u,e.startRow-1)&&(kt=this.getCell(e.startRow-1,h),kt.removeClass(ui),this.XLFilter._changeFilterIcon({rowIndex:e.startRow-1,colIndex:h},"filter",this.XLEdit.getPropertyValue(e.startRow-1,h,"filterState"))):o._filterColl[e.startRow-1][h].status.indexOf("-asc")&&(i.prev.icon=o._filterColl[e.startRow-1][h].status,this._isRowViewable(u,e.startRow-1)&&(kt=this.getCell(e.startRow-1,h),this.XLFilter._changeSortIcon({rowIndex:e.startRow-1,colIndex:h},"ascending")),i.cur.icon=o._filterColl[e.startRow-1][h].status)),i.requestType==="sortbycolor"){for(c=[e.startRow,h,e.endRow,h],nt=this.getRangeData({range:c,skipHiddenRow:!0}),a=0,ut=nt.length;a<ut;a++)ht=nt[a].formats,t.isNullOrUndefined(ht)||(i.operation==="sortbgcolor"?t.isNullOrUndefined(ht["background-color"])||i.bgcolor===ht["background-color"].toLowerCase()&&vt.push(a):t.isNullOrUndefined(ht.color)||i.fgcolor===ht.color.toLowerCase()&&vt.push(a));if((i.oprType==="PutCellColor"||i.oprType==="PutFontColor")&&(c=i.sortRange),this.isUndefined(i.tableID))for(w=[],bt=c[1];bt<=c[3];bt++)w.push(bt);else w=p[y].multifilterIdx;for(c=[e.startRow,w[0],e.endRow,w[w.length-1]],nt=this.getRangeData({range:c,skipHiddenRow:!0}),i.prev.data=n.extend(!0,[],nt),c.colIndex=h,i.range=c,s=0,rt=w.length;s<rt;s++){for(pt=[],gt=[],c=[e.startRow,w[s],e.endRow,w[s]],nt=this.getRangeData({range:c,skipHiddenRow:!0}),wt=vt.length-1;wt>=0;wt--)pt.push(nt.splice(vt[wt],1)[0]);gt=pt.reverse().concat(nt);pt.length>0&&(this._isSort=!0,this._dupDetails=!0,this.XLComment.deleteComment(c,null,!0,null),this._removeHyperlink(null,null,!0,c),this.clearRangeData(c,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0),this.XLFormat.removeStyle(c,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0}),this._isSort=!1,this._dupDetails=!1,this.XLEdit.updateCellWithContainer(gt,c,u,!0))}c=[e.startRow,w[0],e.endRow,w[w.length-1]];i.cur.data=n.extend(!0,[],this.getRangeData({range:c,skipHiddenRow:!0}));this.updateUndoRedoCollection(i)}else{for(yt=[],et=[],p[y].fltrdIdxes=k=i.fltrdIdxes,v=e.startRow===0?0:e.startRow,f=v;f<=e.endRow;f++){for(st=!1,s=0,ut=k.length;s<ut;s++)k[s]==f&&(st=!0);st?(ct=this.XLEdit.getPropertyValue(f,h,"value2"),ct=t.isNullOrUndefined(ct)?"":ct,dt={field:i.columnName,value:ct,predicate:"or",operator:"equal",matchcase:!1},ot=t.Predicate(i.columnName,"equal",ct),this.XLEdit.getPropertyValue(f,0,"filterID")===i.tableID&&(delete this._dataContainer.sheets[u][f][0].isFilterHide,delete this._dataContainer.sheets[u][f][0].filterID,tt?(g.splice(g.indexOf(f),1),this._refreshSHMergeCells(u,[f],1,"row","show")):(this._dupDetails=this._isFilter=!0,this._showRow(f+1,f),this._dupDetails=this._isFilter=!1,l.indexOf(f)>-1&&l.splice(l.indexOf(f),1),o._isImported&&!o._isLoaded||it||(it=!it,this.performSelection({rowIndex:f,colIndex:h},{rowIndex:f,colIndex:h})))),yt.push(dt),b.push(dt),d=b[0],ni=d.from):(t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isRHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFilterHide"))&&(this.XLEdit._updateDataContainer({rowIndex:f,colIndex:0},{dataObj:{isFilterHide:!0,filterID:i.tableID}}),ft=!0),tt?ft&&(g.push(f),this._refreshSHMergeCells(u,[f],1,"row","hide")):(this._dupDetails=this._isFilter=!0,this._hideRow(f,f,"isFilterHide"),this._dupDetails=this._isFilter=!1,l.indexOf(f)===-1&&l.push(f)),ft=!1)}for(tt&&(!o._isImported||o._isLoaded)&&(this.refreshContent(u),this.performSelection({rowIndex:k[0],colIndex:h},{rowIndex:k[0],colIndex:h})),this.XLScroll._getRowHeights(u,v),i.filterCollection=yt,ot=d.ejpredicate?d.ejpredicate:t.Predicate(d.field,d.operator,d.value,!d.matchcase),s=1;s<b.length;s++)ot=b[s].ejpredicate!=r?ot[b[s].predicate](b[s].ejpredicate):ot[b[s].predicate](b[s].field,b[s].operator,b[s].value,!b[s].matchcase);t.isNullOrUndefined(p[y].predicate[i.columnName])&&(p[y].predicate[i.columnName]={});p[y].filteredColumns=yt;p[y].predicate[i.columnName]=ni?{from:d.from,take:d.take}:ot;p[y].hiddenIdx=n.extend(!0,[],et);et=[]}}}else if(h=this._generateColCount(i.fieldName)-1,idx=n.inArray(i.fieldName,o._filteredColumns),i.action.indexOf("clearfiltering")>-1?o._filteredColumns.splice(idx,1):idx<0&&o._filteredColumns.push(i.fieldName),e=i.range,et=p[y].hiddenIdx,at=i.currentViewData,i.requestType.indexOf("filtering")>-1||i.requestType.indexOf("filterbycell")>-1||i.action.indexOf("clearfiltering")===-1){for(lt=o.filterSettings.filteredRange,at.length<1&&k.push(lt[lt.length-1].idx+1),a=0,rt=at.length;a<rt;a++)idx=lt.indexOf(at[a]),idx>-1&&k.push(lt[idx].idx);for(p[y].fltrdIdxes=k,v=e.startRow===0?0:e.startRow,f=v;f<=e.endRow;f++){for(st=!1,s=0,ut=k.length;s<ut;s++)k[s]==f&&(st=!0);st?(t.isNullOrUndefined(this._dataContainer.sheets[u][f])||t.isNullOrUndefined(this._dataContainer.sheets[u][f][0])||(delete this._dataContainer.sheets[u][f][0].isFilterHide,delete this._dataContainer.sheets[u][f][0].filterID,o._filterHRowsColl.indexOf(f)>-1&&o._filterHRowsColl.splice(o._filterHRowsColl.indexOf(f),1)),tt?(g.indexOf(f)>-1&&(this._refreshSHMergeCells(u,[f],1,"row","show"),g.splice(g.indexOf(f),1)),v=f===0?0:f-1,this.XLEdit.getPropertyValue(v,0,"hRow")&&(delete this._dataContainer.sheets[u][v][0].hRow,l.indexOf(f)>-1&&l.splice(l.indexOf(f),1))):(this._dupDetails=this._isFilter=!0,this._showRow(f+1,f),this._dupDetails=this._isFilter=!1,l.indexOf(f)>-1&&l.splice(l.indexOf(f),1),o._isImported&&!o._isLoaded||it||(it=!it,this.performSelection({rowIndex:f,colIndex:h},{rowIndex:f,colIndex:h})))):(t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isRHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFilterHide"))&&(this.XLEdit._updateDataContainer({rowIndex:f,colIndex:0},{dataObj:{isFilterHide:!0,filterID:i.tableID}}),l.indexOf(f)<0&&l.push(f),ft=!0),tt?(ft&&(g.push(f),ft=!1,this._refreshSHMergeCells(u,[f],1,"row","hide")),v=f===0?0:f-1,this.XLEdit._updateDataContainer({rowIndex:v,colIndex:0},{dataObj:{hRow:!0}}),l.indexOf(f)<0&&l.push(f)):(this._dupDetails=this._isFilter=!0,this._hideRow(f,f,"isFilterHide"),this._dupDetails=this._isFilter=!1,l.indexOf(f)===-1&&l.push(f)))}v=e.startRow===0?0:e.startRow-1;tt&&(!o._isImported||o._isLoaded)&&(this.refreshContent(u),this.performSelection({rowIndex:v,colIndex:h},{rowIndex:v,colIndex:h}));this.XLScroll._getRowHeights(u,v);fi=o.columns;i.action==="clearfiltering"&&(o._filteredByColor=-1,this._excelFilter.closeXFDialog());this.model.allowFiltering&&this.XLFilter._updateFilterIcons(v,e.startRow,h,i.action);p[y].hiddenIdx=n.extend(!0,[],et);et=[]}t.isNullOrUndefined(i)||i.action!=="filter"&&i.action!=="filtering"&&i.action!=="filterbycolor"?i.action==="clearfiltering"&&(i.tableID>-1&&o.filterSettings.tableRange[y].filterColumnName.pop(i.fieldName),this.XLFilter._fltrRowHighlight(e.startRow,e.endRow,"clear",i.tableID,i.filterCollection.length)):(i.tableID>-1&&o.filterSettings.tableRange[y].filterColumnName.push(i.fieldName),this.XLFilter._fltrRowHighlight(e.startRow,e.endRow,"add",i.tableID,i.filterCollection.length));this._dupDetails=!1;this.model.showRibbon&&this.model.allowFiltering&&(ti=n("#"+this._id+"_Ribbon_Data_SortFilter_ClearFilter").data("ejButton"),ii={rowIndex:this.getActiveCell().rowIndex,colIndex:this.getActiveCell().colIndex},this.XLRibbon._changeClrFltrStatus(ti,"button",ii));this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(u,"refresh","vertical","filter")},_filterClose:function(t){this.model.allowFiltering&&!this._hasClass(t,"e-filterspan")&&n(t).parents(".e-excelfilter").length<1&&this._excelFilter._openedFltr&&n(this._excelFilter._openedFltr).is(":visible")&&(this._excelFilter.closeXFDialog(),this.XLFilter._isSearchEdit=!1)},showPager:function(n){this.model.showPager=n;settings=this.model.scrollSettings;this.element.find(".e-spreadsheetfooter").css("display",n?"block":"none");this._setSheetWidthHeight(this.getActiveSheetIndex(),{width:this._responsiveWidth,height:this._responsiveHeight})},_refreshClipboard:function(n,t){var r=this.model,i=this._id;n.length&&(r.allowFormatPainter&&r.allowCellFormatting||n.find("#"+i+"_Ribbon_home_Clipboard")[t](),n.find("#"+i+"_Ribbon_home_Clipboard_1")[t](),n.find("#"+i+"_Ribbon_home_Clipboard_Home_Clipboard_Cut")[t](),n.find("#"+i+"_Ribbon_home_Clipboard_Home_Clipboard_Copy")[t]())},_setModel:function(i){var f,a,g,h,w,c=this.getActiveSheetIndex(),e=this.model,y=e.scrollSettings,u=this._id,s=n("#"+u+"_Ribbon").ejRibbon("instance"),r=this.model.showRibbon?s.element:[],b,k,d,l,o,nt,tt,it,p,v;for(a in i){f=i[a];switch(a){case"allowClipboard":f?(this._refreshClipboard(r,"show"),t.isNullOrUndefined(this.XLClipboard)&&(this.XLClipboard=new t.spreadsheetFeatures.clipboard(this)),this.XLClipboard._initCopyPaste()):this._refreshClipboard(r,"hide");break;case"activeSheetIndex":this.gotoPage(f,!1);break;case"pageSettings":this.isUndefined(i.pageSettings.currentPage)||this.gotoPage(i.pageSettings.currentPage,!1);this.isUndefined(i.pageSettings.pageCount)||(this.getPager().ejPager("option","pageCount",i.pageSettings.pageCount),this._refreshSpreadSheetPager(!0));break;case"allowComments":f?(t.isNullOrUndefined(this.XLComment)&&(this.XLComment=new t.spreadsheetFeatures.comments(this)),r.length&&r.find("#"+u+"_Ribbon_review_Comments").show(),this.XLComment._updateCmntRibIcons()):this.model.showRibbon&&r.find("#"+u+"_Ribbon_review_Comments").hide();break;case"allowFormatPainter":e.allowCellFormatting&&(f?(e.allowClipboard||r.find("#"+u+"_Ribbon_home_Clipboard").show(),t.isNullOrUndefined(this.XLFormat)&&(this.XLFormat=new t.spreadsheetFeatures.cellFormatting(this)),r.length&&r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").show()):r.length&&(e.allowClipboard||r.find("#"+u+"_Ribbon_home_Clipboard").hide(),r.length&&r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").hide()));break;case"allowFormulaBar":f?(g=n("#"+this._id+"_formulabar"),g.length?this.showFormulaBar():this._renderFormulaBar(!0)):this.hideFormulaBar();this._setSheetWidthHeight(c,{width:this._responsiveWidth,height:this._responsiveHeight});break;case"allowHyperlink":r.length&&(f?r.find("#"+u+"_Ribbon_insert_Links").show():r.find("#"+u+"_Ribbon_insert_Links").hide());break;case"enableContextMenu":f&&t.isNullOrUndefined(this.XLCMenu)&&(this.XLCMenu=new t.spreadsheetFeatures.contextmenu(this),this.XLCMenu._initContextMenu(),this.XLCMenu._initColorDialog(),this.XLCMenu._initCMenuFooter());break;case"allowEditing":f?(t.isNullOrUndefined(this.XLEdit)&&(this.XLEdit=new t.spreadsheetFeatures.editing(this)),this.model.showRibbon&&r.length&&r.find("#"+u+"_Ribbon_home_Editing").show(),this.XLEdit._processEditing(),this.model.enableContextMenu&&this.XLCMenu._enableMenuOpt(["RenameSheet"],"contextMenuFooter")):(r.length&&r.find("#"+u+"_Ribbon_home_Editing").hide(),this.model.enableContextMenu&&this.XLCMenu._disableMenuOpt(["RenameSheet"],"contextMenuFooter"));break;case"allowResizing":f&&t.isNullOrUndefined(this.XLResize)&&(this.XLResize=new t.spreadsheetFeatures.resizing(this));break;case"allowDataValidation":f?(r.find("#"+u+"_Ribbon_data_DataTools").show(),t.isNullOrUndefined(this.XLValidate)&&(this.XLValidate=new t.spreadsheetFeatures.validation(this),this.XLRibbon._renderValDialog(this.XLRibbon._initValDialog()),this.XLValidate._addDVMethod())):r.length&&r.find("#"+u+"_Ribbon_data_DataTools").hide();break;case"allowConditionalFormats":f?(r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_ConditionalFormatting").show(),this.XLRibbon._initCFDialog(),t.isNullOrUndefined(this.XLCFormat)&&(this.XLCFormat=new t.spreadsheetFeatures.cFormat(this))):r.length&&r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_ConditionalFormatting").hide();break;case"allowSearching":this.model.allowSearching=f;f?(t.isNullOrUndefined(this.XLSearch)&&(this.XLSearch=new t.spreadsheetFeatures.findnreplace(this)),r.length&&r.find("#"+u+"_Ribbon_others_Editing").show()):r.length&&r.find("#"+u+"_Ribbon_others_Editing").hide();break;case"pictureSettings":for(w in f)switch(w){case"allowPictures":e.pictureSettings.allowPictures=f[w];f[w]?(t.isNullOrUndefined(this.XLShape)&&(this.XLShape=new t.spreadsheetFeatures.shape(this)),r.length&&r.find("#"+u+"_Ribbon_insert_Illustrations").show()):r.length&&r.find("#"+u+"_Ribbon_insert_Illustrations").hide()}break;case"showRibbon":this.model.showRibbon=f;b=n("#"+u+"_Ribbon");f?(b.length?b.show():this.XLRibbon._renderRibbon(!0),s=n("#"+u+"_Ribbon").ejRibbon("instance"),r=s.element,r[0].style.overflow==="hidden"&&(r[0].style.overflow="")):b.hide();this.refreshSpreadsheet();break;case"exportSettings":for(h in f)switch(h){case"allowExporting":e.exportSettings.allowExporting=f[h];f[h]?((e.exportSettings.excelUrl||e.exportSettings.csvUrl||e.exportSettings.pdfUrl)&&r.length&&r.find("#saveas_backStageTab").show(),t.isNullOrUndefined(this.XLExport)&&(this.XLExport=new t.spreadsheetFeatures.exporting(this))):(r.length&&r.find("#saveas_backStageTab").hide(),r.length&&r.find("#"+u+"_Ribbon_BackStage_saveas").hide());break;case"excelUrl":e.exportSettings.excelUrl=f[h];f[h]?(r.length&&r.find("#saveas_backStageTab").show(),r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").show()):r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").hide();break;case"csvUrl":e.exportSettings.csvUrl=f[h];f[h]?(r.length&&r.find("#saveas_backStageTab").show(),r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").show()):r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").hide();break;case"pdfUrl":e.exportSettings.pdfUrl=i[a][h];f[h]?(r.length&&r.find("#saveas_backStageTab").show(),r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").show()):r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").hide()}break;case"allowKeyboardNavigation":f&&t.isNullOrUndefined(this.XLCellNav)&&(this.XLCellNav=new t.spreadsheetFeatures.cellNavigation(this));break;case"enablePivotTable":f?(t.isNullOrUndefined(this.XLPivot)&&(this.XLPivot=new t.spreadsheetFeatures.pivot(this)),r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").show()):(r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").hide(),this.hideActivationPanel(),this.XLRibbon._toggleAnalyzeTab(),this.getSheetElement(c).find(".e-ss-activepivot").removeClass("e-ss-activepivot"));break;case"allowAutoFill":f?(t.isNullOrUndefined(this.XLDragFill)?(this.XLDragFill=new t.spreadsheetFeatures.dragFill(this),this._createAutoFillElement()):this.getAutoFillElem().show(),this.XLDragFill.positionAutoFillElement()):this.getAutoFillElem().hide();break;case"autoFillSettings":for(autofillProp in f)switch(autofillProp){case"fillType":e.allowAutoFill&&(e.autoFillSettings.fillType=f[autofillProp]);break;case"showFillOptions":e.allowAutoFill&&(e.autoFillSettings.showFillOptions=f.showFillOptions)}break;case"allowSelection":f&&t.isNullOrUndefined(this.XLSelection)&&(this.XLSelection=new t.spreadsheetFeatures.selection(this),this._initSelection());break;case"allowDragAndDrop":f&&t.isNullOrUndefined(this.XLDragDrop)&&(this.XLDragDrop=new t.spreadsheetFeatures.dragAndDrop(this));break;case"allowCellFormatting":f?((e.allowConditionalFormats||e.allowFormatAsTable)&&r.find("#"+u+"_Ribbon_home_Styles").show(),r.length&&(r.find("#"+u+"_Ribbon_home_Font").show(),r.find("#"+u+"_Ribbon_home_Number").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_TopAlign").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_MiddleAlign").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_BottomAlign").show(),r.find("#"+u+"_Ribbon_separator_bottom").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignLeft").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignCenter").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignRight").show(),r.find("#"+u+"_Ribbon_separator_right").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_DecreaseIndent").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_IncreaseIndent").show(),r.find("#"+u+"_Ribbon_home_separator_right").show(),r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_CellStyles").show(),e.allowFormatPainter&&r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").show(),e.allowClipboard&&r.find("#"+u+"_Ribbon_home_Clipboard").show()),t.isNullOrUndefined(this.XLFormat)&&(this.XLFormat=new t.spreadsheetFeatures.cellFormatting(this)),t.isNullOrUndefined(this.XLCellFrmtDlg)&&(this.XLCellFrmtDlg=new t.spreadsheetFeatures.formatCellDialog(this)),n("#"+u+"_formatdlg").length===0&&this.XLCellFrmtDlg._renderCellFrmtDlg()):r.length&&(r.find("#"+u+"_Ribbon_home_Font").hide(),r.find("#"+u+"_Ribbon_home_Number").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_TopAlign").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_MiddleAlign").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_BottomAlign").hide(),r.find("#"+u+"_Ribbon_separator_bottom").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignLeft").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignCenter").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignRight").hide(),r.find("#"+u+"_Ribbon_separator_right").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_DecreaseIndent").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_IncreaseIndent").hide(),r.find("#"+u+"_Ribbon_home_separator_right").hide(),r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_CellStyles").hide(),r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").hide(),e.allowClipboard||r.find("#"+u+"_Ribbon_home_Clipboard").hide(),e.allowConditionalFormats||e.allowFormatAsTable||r.find("#"+u+"_Ribbon_home_Styles").hide());break;case"allowImport":r.length&&(f?r.find("#open_backStageTab").show():r.find("#open_backStageTab").hide());break;case"importSettings":for(importProp in f)switch(h){case"importMapper":e.importSettings.importMapper=f[importProp];break;case"importUrl":e.importSettings.importUrl=f[importProp];break;case"password":e.importSettings.password=f[importProp]}break;case"allowSorting":if(k=document.getElementById(u+"number_MenuItem"),d=document.getElementById(u+"string_MenuItem"),f?(p=n("#"+u+"_Ribbon_SortFilter").data("ejMenu"),t.isNullOrUndefined(this.XLSort)&&(this.XLSort=new t.spreadsheetFeatures.sorting(this)),r.length&&(r.find("#"+u+"_Ribbon_data_SortFilter_1").show(),r.find("#"+u+"_Ribbon_data_Sort").show(),r.find("#"+u+"_Ribbon_home_Editing_1").show()),p.enableItemByID("Ribbon_SortAtoZ"),p.enableItemByID("Ribbon_SortZtoA")):r.length&&(r.find("#"+u+"_Ribbon_data_SortFilter_1").hide(),this.model.allowFiltering||(r.find("#"+u+"_Ribbon_data_Sort").hide(),r.find("#"+u+"_Ribbon_home_Editing_1").hide())),this.model.allowFiltering)for(o=0;o<3;o++)t.isNullOrUndefined(k)||(k.childNodes[o].style.display=this.model.allowSorting?o===2?"block":"inline":"none"),t.isNullOrUndefined(d)||(d.childNodes[o].style.display=this.model.allowSorting?o===2?"block":"inline":"none");break;case"formatSettings":if(e.allowCellFormatting)for(l in f)switch(l){case"allowFontFamily":e.formatSettings.allowFontFamily=f[l];r.length&&(f[l]?r.find("#"+u+"_Ribbon_home_Font_Home_Font_FontFamily").show():r.find("#"+u+"_Ribbon_home_Font_Home_Font_FontFamily").hide());break;case"allowDecimalPlaces":e.formatSettings.allowDecimalPlaces=f[l];r.length&&(f[l]?(r.find("#"+u+"_Ribbon_home_Number_Home_Number_IncreaseDecimal").show(),r.find("#"+u+"_Ribbon_home_Number_Home_Number_DecreaseDecimal").show(),r.find("#"+u+"_Ribbon_separator_Home_Number_CommaStyle").show()):(r.find("#"+u+"_Ribbon_home_Number_Home_Number_IncreaseDecimal").hide(),r.find("#"+u+"_Ribbon_home_Number_Home_Number_DecreaseDecimal").hide(),r.find("#"+u+"_Ribbon_separator_Home_Number_CommaStyle").hide()));break;case"allowCellBorder":e.formatSettings.allowCellBorder=f[l];r.length&&(f[l]?(r.find("#"+u+"_Ribbon_separator_border").show(),r.find("#"+u+"_Ribbon_home_Font_Home_Font_Border").show()):(r.find("#"+u+"_Ribbon_separator_border").hide(),r.find("#"+u+"_Ribbon_home_Font_Home_Font_Border").hide()))}break;case"sheets":for(o=0,nt=f.length;o<nt;o++)for(tt in f[o]){if(this.model.sheetCount<o+1&&f.length>c)return;switch(tt){case"showGridlines":o+1===c?this._showGridlines(f[o].showGridlines,c):this.getSheet(o+1).showGridlines=f[o].showGridlines;break;case"showHeadings":o+1===c?this._showHeadings(f[o].showHeadings,c):this.getSheet(o+1).showHeadings=f[o].showHeadings}}break;case"scrollSettings":y={};it=e.scrollSettings.isResponsive;t.isNullOrUndefined(i.scrollSettings)||(t.isNullOrUndefined(i.scrollSettings.allowScrolling)||(e.scrollSettings.allowScrolling=i.scrollSettings.allowScrolling),t.isNullOrUndefined(i.scrollSettings.allowVirtualScrolling)||(e.scrollSettings.allowVirtualScrolling=i.scrollSettings.allowVirtualScrolling),t.isNullOrUndefined(i.scrollSettings.isResponsive)||(it=e.scrollSettings.isResponsive=i.scrollSettings.isResponsive),t.isNullOrUndefined(i.scrollSettings.scrollMode)||(e.scrollSettings.scrollMode=i.scrollSettings.scrollMode==="normal"?t.Spreadsheet.scrollMode.Normal:t.Spreadsheet.scrollMode.Infinite),t.isNullOrUndefined(i.scrollSettings.width)||(e.scrollSettings.width=i.scrollSettings.width),t.isNullOrUndefined(i.scrollSettings.height)||(e.scrollSettings.height=i.scrollSettings.height));e.scrollSettings.isResponsive||(n.extend(!0,y,this.model.scrollSettings),this.element.height(y.height).width(y.width),n("#"+this._id+"_Ribbon").ejRibbon("option",{width:y.width}),this._updateResponsiveSettings(),this._setSheetWidthHeight(c,{height:this._responsiveHeight,width:this._responsiveWidth}));break;case"allowFiltering":f?(p=n("#"+u+"_Ribbon_SortFilter").data("ejMenu"),r.length&&(r.find("#"+u+"_Ribbon_data_SortFilter_2").show(),r.find("#"+u+"_Ribbon_data_Sort").show(),r.find("#"+u+"_Ribbon_home_Editing_1").show()),p.enableItemByID("Ribbon_Filter"),t.isNullOrUndefined(this.XLFilter)&&(this.XLFilter=new t.spreadsheetFeatures.filter(this)),this.XLFilter._renderExcelFilter()):r.length&&(this.model.allowSorting||(r.find("#"+u+"_Ribbon_data_Sort").hide(),r.find("#"+u+"_Ribbon_home_Editing_1").hide()),r.find("#"+u+"_Ribbon_data_SortFilter_2").hide());break;case"allowInsert":f?(r.length&&!e.allowDelete&&r.find("#"+u+"_Ribbon_others_Cells").show(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_1").show(),this.getPager().find(".e-new").removeClass("e-disable"),e.enableContextMenu&&this.XLCMenu._enableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter")):(r.length&&!e.allowDelete&&r.find("#"+u+"_Ribbon_others_Cells").hide(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_1").hide(),this.getPager().find(".e-new").addClass("e-disable"),e.enableContextMenu&&this.XLCMenu._disableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter"));break;case"allowDelete":f?(!e.allowInsert&&r.length&&r.find("#"+u+"_Ribbon_others_Cells").show(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_2").show(),e.enableContextMenu&&this._getSheetNames(!0).length>1&&this.XLCMenu._enableMenuOpt(["DeleteSheet"],"contextMenuFooter")):(!e.allowInsert&&r.length&&r.find("#"+u+"_Ribbon_others_Cells").hide(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_2").hide(),e.enableContextMenu&&this.XLCMenu._disableMenuOpt(["DeleteSheet"],"contextMenuFooter"));break;case"allowFreezing":f?(t.isNullOrUndefined(this.XLFreeze)&&(this.XLFreeze=new t.spreadsheetFeatures.freezepane(this),this.XLFreeze._initFreeze()),r.length&&r.find("#"+u+"_Ribbon_others_Window").show()):r.length&&r.find("#"+u+"_Ribbon_others_Window").hide();break;case"allowMerging":r.length&&(f?r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_Merge").show():r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_Merge").hide());break;case"allowWrap":r.length&&(f?r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_WrapText").show():r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_WrapText").hide());break;case"allowUndoRedo":r.length&&(f?r.find("#"+u+"_Ribbon_home_Actions").show():r.find("#"+u+"_Ribbon_home_Actions").hide());break;case"frozenRows":e.allowFreezing&&this.XLFreeze.freezeRows(f);break;case"frozenColumns":e.allowFreezing&&this.XLFreeze.freezeColumns(f);break;case"freezePanes":e.allowFreezing&&this.XLFreeze.freezePanes(f.rowIndex,f.colIndex);case"allowFormatAsTable":f?(e.enablePivotTable||r.find("#"+u+"_Ribbon_insert_Tables").show(),t.isNullOrUndefined(this.XLFormat)&&(this.XLFormat=new t.spreadsheetFeatures.cellFormatting(this)),r.length&&(r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_FormatAsTable").show(),r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_Table").show())):r.length&&(e.enablePivotTable||r.find("#"+u+"_Ribbon_insert_Tables").hide(),r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_FormatAsTable").hide(),r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_Table").hide());break;case"enablePivotTable":r.length&&(f?(!e.allowFormatAsTable&&r.length&&r.find("#"+u+"_Ribbon_insert_Tables").show(),r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").show()):(!e.allowFormatAsTable&&r.length&&r.find("#"+u+"_Ribbon_insert_Tables").hide(),r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").hide()));break;case"allowAutoSum":r.length&&(f?r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_AutoSum").show():r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_AutoSum").hide());break;case"allowCharts":f?((t.isNullOrUndefined(this.XLChart)||t.isNullOrUndefined(this.XLShape))&&(this.XLShape=new t.spreadsheetFeatures.shape(this),this.XLChart=new t.spreadsheetFeatures.chart(this)),r.length&&r.find("#"+u+"_Ribbon_insert_Charts").show()):r.length&&r.find("#"+u+"_Ribbon_insert_Charts").hide();break;case"printSettings":for(v in f)switch(v){case"allowPrinting":e.printSettings.allowPrinting=f[v];f[v]?(this.XLPrint=new t.spreadsheetFeatures.print(this),r.length&&(r.find("#"+u+"_Ribbon_pagelayout_Print").show(),r.find("#print_backStageTab").show())):r.length&&(r.find("#print_backStageTab").hide(),r.find("#"+u+"_Ribbon_pagelayout_Print").hide());break;case"allowPageSize":e.printSettings.allowPageSize=f[v];r.length&&(f[v]?r.find("#"+u+"_Ribbon_pagelayout_PageLayout").show():r.find("#"+u+"_Ribbon_pagelayout_PageLayout").hide())}break;case"allowLockCell":r.length&&(f?(r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_ProtectSheet").show(),r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_LockCell").show()):(r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_ProtectSheet").hide(),r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_LockCell").hide()));break;case"undoRedoStep":this.undoRedoStep=f;break;case"enableTouch":this._wireTouchEvts(f?"_on":"_off");break;case"showPager":this.showPager(i[a]);this._refreshSpreadSheetPager();break;case"allowOverflow":this._refreshOverflow();break;case"allowClear":r.length&&(f?r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_Clear").show():r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_Clear").hide());break;case"isReadOnly":this._readOnly();break;case"locale":this.model.locale=i[a];this._destroy();this.model.sheets.splice(0,1);this._init();break;case"allowCellType":f&&(this.XLCellType=new t.spreadsheetFeatures.cellType(this));break;case"activationPanelWidth":this.model.apWidth=f;this.getActivationPanel().width(f-1)}}r.length&&(e.allowAutoSum||e.allowFiltering||e.allowUndoRedo||e.allowSorting||e.allowClipboard||e.allowFormatPainter||e.allowCellFormatting||e.allowMerging||e.allowWrap||e.allowConditionalFormats||e.allowFormatAsTable?s.showTab(this._getLocStr("HOME")):s.hideTab(this._getLocStr("HOME")),e.allowFormatAsTable||e.allowPictures||e.allowHyperlink||e.allowCharts?s.showTab(this._getLocStr("INSERT")):s.hideTab(this._getLocStr("INSERT")),e.allowDataValidation||e.allowFiltering||e.allowSorting?s.showTab(this._getLocStr("DATATAB")):s.hideTab(this._getLocStr("DATATAB")),e.printSettings.allowPrinting?s.showTab(this._getLocStr("PAGELAYOUT")):s.hideTab(this._getLocStr("PAGELAYOUT")),e.allowComments||e.allowLockCell?s.showTab(this._getLocStr("REVIEW")):s.hideTab(this._getLocStr("REVIEW")),e.allowFreezing||e.allowInsert||e.allowDelete||e.allowSearching?s.showTab(this._getLocStr("OTHERS")):s.hideTab(this._getLocStr("OTHERS")))},"import":function(t){if(this.model.allowImport){!t.dataContainer&&this.model.allowCellFormatting&&this.XLFormat&&this.getObjectLength(this.XLFormat._customFontFamily)>0&&(t.dataContainer=JSON.stringify({customFontFamily:this.XLFormat._customFontFamily}));var r=this,i={type:"POST",data:this._import(t),async:this.isUndefined(t.async)?!0:t.async,url:this.model.importSettings.importMapper,success:function(n){r._importSuccess(n)},error:function(n,t){r._importFailed({type:t,xhr:{status:n.status,statusText:n.statusText}})}};(this._browserDetails.name!=="msie"||this._browserDetails.version!=="9.0"||i.data.append)&&(i.processData=!1,i.contentType=!1);n("#"+this._id+"_Ribbon_BackStage").hide();r.showWaitingPopUp();n.ajax(i)}},_import:function(n){if(window.FormData&&this._isObject(n)){var t=new FormData;for(prop in n)prop!="async"&&t.append(prop,n[prop]);return t}return n},_importSuccess:function(n){var t=["UnsupportedFile","IncorrectPassword","InvalidUrl","NeedPassword"];if(t.indexOf(n)>-1){switch(n){case t[0]:case t[1]:case t[2]:this._showAlertDlg("Alert",n,"",null,110);break;case t[3]:this._showDialog(this._id+"_ImportPasswordDialog");this.model.importSettings.password=""}this.hideWaitingPopUp()}else this.loadFromJSON(JSON.parse(n))},loadFromJSON:function(t){this.isImport=!0;n("#"+this._id+"_file").ejUploadbox("option","autoUpload",!0);var i,f,r=1,o,u=t.model&&t.model.nameManager,e;if(u&&u.length)for(e in u)u[e].refersto=this._decode(u[e].refersto);if(this._isSheetReq)i=Number(this.getObjectKeys(t.dataContainer.sheets)[0]),this._refreshImpStyles(t.dataContainer.hashCode),this._impData.dataContainer=n.extend(!0,{},t.dataContainer),this._impData.dataContainer.sheets=this._dataContainer.sheets,this._impData.dataContainer.cellType=this._dataContainer.cellType,this._impData.dataContainer.sheets[i]=t.dataContainer.sheets[i],this._impData.model.sheets[i]=t.sheet,this._dataContainer=n.extend(!0,{},this._impData.dataContainer),this._dataContainer.sheetCellType={},this._refreshModel(t.sheet,!0,i),this._sheetSettings(i),this._intrnlReq||this.gotoPage(i,!1),this._isSheetReq=!1;else if(this.model.scrollSettings.allowVirtualScrolling||(f=this._getMaxRowColCnt(t.model.sheets,!0)),this.model.scrollSettings.allowVirtualScrolling||t.dataContainer.sharedData.length<50001&&f.rowCount<10001&&f.colCount<126){if(this._impData=t,o={importData:t},this._trigger("onImport",o))return;if(this._isInitLoad)this._initBase();else{for(this._destroy(),this._refreshModel(t.model),this._dataContainer=n.extend(!0,{},t.dataContainer),this._dataContainer.sheetCellType={},this._initCSSTag();r<=this.model.sheetCount;)this._sheetSettings(r),this._newSIndex++,r++;for(r=1;r<=this.model.sheetCount;)this.model.scrollSettings.allowVirtualScrolling||this.model.importSettings.allowSheetOnDemand||this._initSheet(r),r++;this._refreshNameMngr(t.model.nameManager);this.gotoPage(this.getActiveSheetIndex(),!1);this._isRibbonDestroyed=!1}this._trigger("loadComplete");this.clearUndoRedo()}else this._showAlertDlg("Alert","HugeDataAlert");this._intrnlReq||(this.isImport=!1);this._intrnlReq=!1;this._renderDDownList();this.hideWaitingPopUp()},_importFailed:function(n){var t={failureType:n.type};n.xhr?(t.status=n.xhr.status,t.statusText=n.xhr.statusText):t.statusText=n.error;this.hideWaitingPopUp();this._trigger("openFailure",t)},_importSheet:function(n,t){var i={},r=this.model.importSettings;this._isSheetReq=!0;i={sheetIndex:n,allowSheetOnDemand:r.allowSheetOnDemand,password:this._encrypt(r.password),async:t};i.dataContainer=JSON.stringify({hashCode:this._dataContainer.hashCode,sharedData:this._dataContainer.sharedData,valData:this._dataContainer.valData,cFormatData:this._dataContainer.cFormatData});this["import"](i);this.getSheet(n)._isRequested=!0},_decode:function(t){return n("<div/>").html(t).text()},_refreshModel:function(n,t,i){var u,e,r,f=1;if(n)if(t)r=this.model.sheets[this._getSheetIndex(i)],r.rowCount=n.rowCount||this.defaults.rowCount,r.colCount=n.colCount||this.defaults.colCount;else{for(this.model.sheetCount=n.sheetCount||this.defaults.sheetCount,this.model.activeSheetIndex=n.activeSheetIndex||this.defaults.activeSheetIndex,this.model.rowHeight=n.rowHeight||this.defaults.rowHeight,this.model.columnWidth=n.columnWidth||this.defaults.columnWidth,this.model.sheets=[{}],u=n.sheets.length;f<u;)r=n.sheets[f],e={rowCount:r.rowCount||this.defaults.rowCount,colCount:r.colCount||this.defaults.colCount},this.model.sheets.push(e),f++;n.nameManager&&n.nameManager.length&&(this.model.nameManager=n.nameManager)}else u=this.model.sheets.length,this.model.sheetCount<u&&(this.model.sheetCount=u);this.model.apWidth===300&&this.model.activationPanelWidth!==300?this.model.apWidth=this.model.activationPanelWidth:this.model.apWidth!==300&&this.model.activationPanelWidth===300&&(this.model.activationPanelWidth=this.model.apWidth)},_refreshImpStyles:function(n){for(var r,t,i=0,u=n.length;i<u;)t=n[i],this._dataContainer.hashCode.indexOf(t)===-1&&(t.indexOf("e-format")===-1?(this._dataContainer.hashCode.push(t),t.length<25&&this.XLFormat._writeCssRules(t,this.XLFormat._getCssPropertyAsString({border:this.XLFormat.getBorderFromHashCode(t)}))):(r=this.XLFormat.getFormatFromHashCode(t),this.XLFormat._createFormatClass(r))),i++},_refreshImpSheets:function(t){var i=this._impData.model.sheets[t];this._refreshImpCells(t);this._refreshImpCF(t);this.model.allowMerging&&i.mergedCells&&this._refreshImpMC(i.mergedCells);this.model.allowFiltering&&i.filterSettings&&i.filterSettings.range&&this.XLFilter._filterCellRange(t,i.filterSettings.range);this._refreshImpHC(i.hideColsCollection);this._refreshImpHR(i.hideRowsCollection);this._refreshImpTable(i.tableManager);this._refreshOverflow();this.model.allowCellType&&this._refreshSheetCellTypes(this._impData.dataContainer.sheetCellType,t);this._refreshShapePosOnImp(i.shapeMngr,t);this._refreshImpCharts(i.shapeMngr.chart);this._refreshImpPics(i.shapeMngr,t);this._refreshImpPvts(i.pivotMngr,t);i.showGridlines===!1&&n("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").ejCheckBox({checked:i.showGridlines});i.isSheetProtected&&this.protectSheet(!0)},_refreshImpCells:function(n){for(var t,i=0,u=this.getSheet(n).usedRange,r=this.XLEdit._getPropWithCellIdx([0,0,u.rowIndex,u.colIndex],"value",n,!0),f=r.length;i<f;)t=r[i],this.XLEdit._refreshCalcEngine(t.rowIdx,t.colIdx,!0,t.value,n),i++;if(this.model.allowCellFormatting&&this.model.formatSettings.allowCellBorder)for(i=0,r=this.XLEdit._getPropWithCellIdx([0,0,u.rowIndex,u.colIndex],"borders",n),f=r.length;i<f;)t=r[i],this.XLFormat.applyBorder(t.value,[t.rowIdx,t.colIdx,t.rowIdx,t.colIdx]),i++},_refreshSheetCellTypes:function(n,t){var r=[],i,u;if(!(this.getObjectLength(n)<1)){for(i=1,u=this.getObjectLength(n[t]);i<=u;i++)r.push({range:n[t][i].settings.range,settings:n[t][i].settings});this.XLCellType._rangeCellTypes(r,t,!0)}},_refreshImpCF:function(n){if(this.model.allowConditionalFormats)for(var t,r=this._impData.dataContainer.cFormatData.length,i=0;i<r;i++)t=this._impData.dataContainer.cFormatData[i].split("_"),idx=Number(t[4]),idx===n&&(this.XLCFormat._cFormat(t[0],t[1],t[2],t[3],t[5],idx,this.getRangeIndices(t[5])),this._impData.dataContainer.cFormatData.splice(i,1),r=this._impData.dataContainer.cFormatData.length,i--)},_refreshImpMC:function(n){var t,i=n.length;if(i)while(i--)t=n[i],t.isCenterAlign&&(this.mergeCenter=!0),this.mergeCells(t.range,!0),this.mergeCenter=!1},_refreshImpHC:function(n){var t,r=this.getObjectKeys(n),i=r.length;if(i)while(i--)t=parseInt(r[i]),this._hideColumn(t,t)},_refreshImpResRowHght:function(n){for(var e,f,h,t,u,o=this.getSheet(n),v=o._restrictedHeightRows,p=this._dataContainer.sheets[n],w=this._dataContainer.hashCode,i,c,l=!0,y=this._impData&&this._impData.model.sheets[n]&&this._impData.model.sheets[n].mergedCells?this._impData.model.sheets[n].mergedCells:[],a=[],s,r=0;r<y.length;r++)i=this.getRangeIndices(y[r].range),a.push(i);for(f=this.element.find("#"+this._id+"_emptyDiv"),e=0;e<v.length;e++){u=v[e];cellsData=p[u];for(t in cellsData)if((s=this._dataContainer.sharedData[cellsData[t].value],s&&!this.isFormula(s))&&(hashIdx=cellsData[t].formats,hashIdx)){if(h=w[hashIdx],cellsData[t].wrap){for(r in a)if(i=a[r],i[0]<=u&&i[2]>=u&&i[1]<=t&&i[3]>=t){l=!1;break}l&&(f.width(o.columnsWidthCollection[t]-3),h+=" e-sswraptext")}this.addClass(f[0],h);f.text(s);c=f[0].offsetHeight+1;o.rowsHeightCollection[u]<c&&(o.rowsHeightCollection[u]=c);this._refreshGlobalSpan(null,!0);l=!0}}},_refreshImpHR:function(n){for(var t,i,u=this.getActiveSheetIndex(),s=this.getSheet(u),n=n||[],f=this.getRows(u),h=f[1],c=f[0],e=this._getJSSheetRowHeaderContent(u),l=e.find("tr"),r=0,o=n.length;r<o;r++)t=parseInt(n[r]),i=t?t-1:0,this.isUndefined(this.XLEdit.getPropertyValue(i,0,"isRHide"))&&this.XLEdit._updateDataContainer({rowIndex:i,colIndex:0},{dataObj:{hRow:!0}}),this.model.scrollSettings.allowVirtualScrolling?this.addClass(e.find("[idx ="+i+"] .e-rowheader")[0],"e-hrow"):(this.addClass(l.find(".e-rowheader")[i],"e-hrow"),this.addClass(h[t],"e-r-hide"),this.addClass(c[t],"e-r-hide")),this.XLScroll._getRowHeights(u,s.hideRowsCollection.sort()[0])},_refreshImpTable:function(n){var i,r,t,u=this.getObjectLength(n);if(this.model.allowFormatAsTable&&u)while(u--)t=n[u],i=t.range,r=this.XLFormat._getTableLayoutFromName(t.formatName),r||(r=this.XLFormat._formatAsTableStyle,t.formatName=r.formatName),this.XLFormat.createTable({header:!0,name:"Table"+this._tableCnt,format:r.format,formatName:t.formatName,showHeaderRow:t.showHeaderRow},this._getAlphaRange(this.getActiveSheetIndex(),i[0],i[1],i[2],i[3]))},_refreshImpCharts:function(n){if(this.model.allowCharts)for(var i,t,r=0,u=this.getObjectLength(n);r<u;)t=n["chart"+r],i=this.getSheet(t.dataSheetIdx),t.dataSheetIdx!=this.getActiveSheetIndex()&&i._isImported&&!i._isRequested&&(this._intrnlReq=!0,this._importSheet(t.dataSheetIdx,!1)),this.XLChart.createChart(t.range,{type:t.commonSeriesOptions.type,enable3D:t.enable3D,marker:t.commonSeriesOptions.marker,top:t.top,left:t.left,height:t.size.height,width:t.size.width,title:t.title,legend:t.legend,primaryYAxis:t.primaryYAxis,primaryXAxis:t.primaryXAxis,dataSheetIdx:t.dataSheetIdx}),r++},_refreshImpPics:function(n,t){if(this.model.pictureSettings.allowPictures)for(var i,r=0,u=this.getObjectKeys(n.picture),f=u.length;r<f;)i=n.picture[u[r]],i.sheetIdx=t,this.getSheet(t)._isUpdated?(i.imgData=n.sharedPics[i.data],this.XLShape._refreshPictureElement(i)):this.XLShape._createPicture(t,null,n.sharedPics[i.data],i.top,i.left,i.width,i.height,null,i.bcolor,i.bstyle,i.bwidth,i),r++},_refreshShapePosOnImp:function(n,t){var f=n.chart,e=n.picture,i,o,r,s,u,c=this.getSheet(t),a=c._rowHeightCollection,l=c.rowsHeightCollection,h=this._impData?this._impData.model.sheets[t].rowsHeightCollection:[];if(!this.getObjectLength(e)&&!this.getObjectLength(f))return!1;for(i=0;i<h.length;i++)if(h[i]!==l[i]){o=l[i]-h[i];s=a[i+1]-o;for(r in e)u=e[r].top,u>s&&(e[r].top=u+o);for(r in f)u=f[r].top,u>s&&(f[r].top=u+o)}},_refreshImpPvts:function(n,t){if(this.model.enablePivotTable&&n)for(var i,r=0,e=this.getObjectLength(n.pivot),u=this.getObjectKeys(n.pivot),f;r<e;)i=n.pivot[u[r]],f={rows:i.rows,columns:i.columns,values:i.values,filters:i.filters},this.getSheet(t)._isUpdated?this.XLPivot._refreshPivotElement(i.dataSheetName+"!"+this._getProperAlphaRange(this._getSheetIndexByName(i.dataSheetName),i.dataRange[0],i.dataRange[1],i.dataRange[2],i.dataRange[3]),this.getSheet(i.sheetIdx).sheetInfo.text+"!"+this._getProperAlphaRange(i.sheetIdx,i.rowIndex,i.colIndex,i.rowIndex,i.colIndex),u[r],f,i):this.XLPivot.createPivotTable(i.dataSheetName+"!"+this._getProperAlphaRange(this._getSheetIndexByName(i.dataSheetName),i.dataRange[0],i.dataRange[1],i.dataRange[2],i.dataRange[3]),this.getSheet(i.sheetIdx).sheetInfo.text+"!"+this._getProperAlphaRange(i.sheetIdx,i.rowIndex,i.colIndex,i.rowIndex,i.colIndex),u[r],f,i),r++;this._isExport||this._getContent(t).find(".e-ss-activepivot").removeClass("e-ss-activepivot");this.hideActivationPanel()},_refreshNameMngr:function(t){t=t||this.model.nameManager;var i=t.length;if(this.model.showRibbon){if(i)while(i--)this.XLRibbon._updateNamedRanges(t[i].name,t[i].refersto,!0);n("#"+this._id+"_nmgrid").ejGrid("option",{dataSource:t});this.XLRibbon._updateUseInFormulaTrgt()}this.XLEdit._refreshAutoComplete()},_getBorderInput:function(n){n=n.split("_");for(var t=4,i={},r=["top","right","bottom","left"];t--;)n[t].length&&(i[r[t]]=n[t]);return i},_refreshHashCode:function(n){n=n||this._dataContainer.hashCode;for(var t,i=n.length;i--;)t=n[i],t.indexOf("e-format")===-1&&t.indexOf("e-border")===-1&&(n[i]="")},clearUndoRedo:function(){this._undoCollection=[];this._redoCollection=[];this._updateUndoRedoIcons()},_initializePicture:function(n){this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content").append(t.buildTag("div.e-ss-imgvisual"))},_getShapePositionInManager:function(n,t,i,r){for(var o=this.getActiveSheetIndex(),f=this._dataContainer.sheets[o][n][t],u=0,e=f.length;u<e;u++)if(f[r][u].id===i)break;return u},_swapVal:function(n){var t=n.prev;n.prev=n.cur;n.cur=t},_getValue:function(n,t){for(var i,r=n.length;r--;)if(i=n[r],i.value===t)return i.value},_isRowViewable:function(n,t){var i=this.getSheet(n),r=i._isVPRendered;return this.model.scrollSettings.allowVirtualScrolling&&(r=i._virtualRowIdx.indexOf(t)>-1),r},_isColumnViewable:function(){return!0},_undoRedoOperation:function(t){var r,u,i=this.getActiveCell();(t.which===90||t.keyCode===90)&&t.ctrlKey?(t.preventDefault(),t.target.id.indexOf("_Edit")>-1||t.target.id.indexOf("_input")>-1?(r=this.XLEdit.getCurrentEditCellData(),r!==this._cureditedCell&&(u=r,t.target.id.indexOf("_Edit")>-1?t.target.textContent=this._cureditedCell:n("#"+this._id+"_Edit")[0].textContent=this._cureditedCell,this.model.allowFormulaBar&&this._getInputBox().val(this._cureditedCell),this._undoInputobj={value:u,rowIndex:i.rowIndex,colIndex:i.colIndex})):(this._isUndo=!0,this._performUndoRedo())):(t.which===89||t.keyCode===89)&&t.ctrlKey&&(t.preventDefault(),t.target.id.indexOf("_Edit")>-1||t.target.id.indexOf("_input")>-1?i.rowIndex===this._undoInputobj.rowIndex&&i.colIndex===this._undoInputobj.colIndex&&(t.target.id.indexOf("_Edit")>-1?t.target.textContent=this._undoInputobj.value:n("#"+this._id+"_Edit")[0].textContent=this._undoInputobj.value,this.model.allowFormulaBar&&this._getInputBox().val(this._undoInputobj.value)):(this._isUndo=!1,this._performUndoRedo()))},_performUndoRedo:function(){var n=this._isUndo?this._undoCollection.pop():this._redoCollection.pop(),i,r;if(!t.isNullOrUndefined(n)){n.sheetIndex!==this.getActiveSheetIndex()&&this.gotoPage(n.sheetIndex,null);this._isUndoRedo=!0;switch(n.reqType){case"auto-fill":this._undoForAutoFill(n);break;case"auto-sum":this._undoForAutoSum(n);break;case"cell-format":this._undoForFormat(n);break;case"cell-styles":this._undoForStyle(n);break;case"clear-all":this._undoForClAll(n);break;case"clear-comment":this._undoForClComment(n);break;case"clear-content":this._undoForClContent(n);break;case"clear-format":this._undoForClFormat(n);break;case"clear-link":this._undoForCLLink(n);break;case"comment":this._undoForComment(n);break;case"cond-format":this._undoForCondFormat(n);break;case"copy-paste":this._undoForCopyPaste(n);break;case"cut-paste":this._undoForCutPaste(n);break;case"delete":this._undoForDel(n);break;case"edit":this._undoForEdit(n);break;case"filter":this._undoForFilter(n);break;case"filterbycolor":this._undoForFilterByColor(n);break;case"find-replace":this._undoForFind(n);break;case"format-painter":this._undoForFormatPaint(n);break;case"format-table":this._undoForFormatTable(n);break;case"hyperlink":this._undoForHyperlink(n);break;case"insert":this._undoForIns(n);break;case"merge-cells":this._undoForMerge(n);break;case"paging":r=n.nSheetIndex;n.nSheetIndex=n.sheetIndex;n.sheetIndex=r;break;case"pivotgrid":this._undoForPivot(n);break;case"resize-column":this._undoForResizeCol(n);break;case"resize-row":this._undoForResizeRow(n);break;case"resize-fit-height":this._undoForResizeFHeight(n);break;case"resize-fit-width":this._undoForResizeFWidth(n);break;case"reorder-cells":this._undoForReOrder(n);break;case"show-hide":this._undoForShowHide(n);break;case"shape":this._undoForShape(n);break;case"sort":this._undoForSort(n);break;case"sortbycolor":this._undoForSortByColor(n);break;case"textwrap":this._undoForTextWrap(n);break;case"validation":this._undoForValidation(n)}if(this._isUndo?this._redoCollection.push(n):this._undoCollection.push(n),i={sheetIdx:n.sheetIndex,reqType:this._isUndo?"undo":"redo",operation:n},this._undoCollection.length>this.undoRedoStep&&this._undoCollection.splice(0,1),this._redoCollection.length>this.undoRedoStep&&this._redoCollection.splice(0,1),this._updateUndoRedoIcons(),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),this._isUndoRedo=!1,this._isUndo=!1,this.model.allowSelection&&n.reqType!="shape"&&this.XLSelection._refreshBorder(),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this._trigActionComplete(i))return}},_undoForAutoFill:function(t){var i=this.getSheet(t.sheetIndex);this._isUndo?(this.clearRangeData(t.range,this._cellProp),this.model.allowCellFormatting&&(this.XLFormat.removeStyle(t.range),this.XLFormat.updateFormat(t.bFormat,t.range)),this.updateData(n.extend(!0,[],t.bData),t.range),t.actionType=="flash-fill"&&this.updateData(n.extend(!0,[],t.bdData),t.bRange),t.colSel?this.XLSelection.selectColumns(i._startCell.colIndex,i._endCell.colIndex):t.rowSel?this.XLSelection.selectRows(i._startCell.rowIndex,i._endCell.rowIndex):this.performSelection({rowIndex:t.bRange[0],colIndex:t.bRange[1]},{rowIndex:t.bRange[2],colIndex:t.bRange[3]})):(this.model.allowCellFormatting&&this.XLFormat.updateFormat(t.aFormat,t.range),this.updateData(n.extend(!0,[],t.aData),t.range),this.XLCFormat.refreshCFormat(),t.actionType=="flash-fill"&&this.updateData(n.extend(!0,[],t.adData),t.bRange),this.performSelection({rowIndex:t.bRange[0],colIndex:t.bRange[1]},{rowIndex:t.range[2],colIndex:t.range[3]}))},_undoForAutoSum:function(t){var e=this._dataContainer.sheets[t.sheetIndex],r,u,i,f;if(this._isUndo){for(i=0,f=t.updCell.length;i<f;i++)r=this.getCell(t.updCell[i].rowIndex,t.updCell[i].colIndex,t.sheetIndex),this._clearFormula(t.updCell[i].rowIndex,t.updCell[i].colIndex),this.clearRangeData([t.updCell[i].rowIndex,t.updCell[i].colIndex,t.updCell[i].rowIndex,t.updCell[i].colIndex],["value2"],null,!0),u=n.extend(!0,{},t.updCell[i].pObj),e[t.updCell[i].rowIndex][t.updCell[i].colIndex]=u,r.text(t.updCell[i].pValue);this.performSelection(t.range)}else this.XLRibbon.autoSum(t.oprType,t.range)},_undoForClAll:function(t){var u=this.model.sheets[t.sheetIndex],i,r;if(this._isPaste=this._dupDetails=!0,this._isUndo){for(this.updateData(n.extend(!0,[],t.bData),t.range),this.XLFormat.updateFormat(n.extend(!0,[],t.bBorder),t.range),i=0,r=t.wrapColl.length;i<r;i++)this.setWrapText("wrap",[t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx,t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx]);for(i=0,r=t.mergeColl.length;i<r;i++)this.mergeCenter=t.mergeColl[i].mergeObj.isCenterAlign,this.mergeCells(t.mergeColl[i].mergeObj.mRange,!0)}else this.model.showRibbon&&this.XLRibbon._isMergeSelect&&this.XLRibbon._isFilterSelect.status?(this.clearRangeData(t.range,["value","value2","hyperlink","cFormatRule","comment"],"",!1),this.XLFormat.removeStyle(null,{cellStyle:!0,format:!0})):this.clearRangeData(t.range,["value","value2","format","formats","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","comment","cFormatRule"]),this.setWrapText("unwrap",t.range),this.unmergeCells(t.range);this._isPaste=this._dupDetails=!1;t.tblObj&&(this._isUndo?(this.XLClipboard._isCut=!0,this.XLFormat.createTable(t.tblObj,t.tblObj.range),this.XLClipboard._isCut=!1):(this.XLFormat.removeTable(t.tblObj.tblId),this.clearRangeData(t.range,["value","value2","format","formats","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","comment","cFormatRule"]),this.XLRibbon._toggleDesignTab(this.getActiveCell())));this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t.range);this.model.allowDataValidation&&!this._isUndo&&this.XLValidate.clearDV();this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForClComment:function(n){var i,u,f,t,e;if(n.selectedCell.length){if(u={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},f={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},this._isUndo)for(t=0,e=n.selectedCell.length;t<e;t++)i={rowIndex:n.selectedCell[t].rowIndex,colIndex:n.selectedCell[t].colIndex},this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[t].rowIndex,colIndex:n.selectedCell[t].colIndex},{dataObj:{comment:n.selectedCell[t].prevComment}}),this.XLSelection.selectRange(i,i),this.XLComment.setComment(),this.XLComment._updateCurCmntVal();else this.XLSelection.selectRange(u,f),this.XLComment.deleteComment(r,null,!1,"clear");this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()}},_undoForClContent:function(t){this._isUndo?this.updateData(n.extend(!0,[],t.bData),t.range):this.clearRangeData(t.range,["value","value2","type","hyperlink"],t.reqType);this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t.range);this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForClFormat:function(t){var u=this._dataContainer.sheets[t.sheetIndex],i,r;if(this._isUndo){for(i=0,r=t.wrapColl.length;i<r;i++)this.setWrapText("wrap",[t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx,t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx]);for(i=0,r=t.mergeColl.length;i<r;i++)this.mergeCenter=t.mergeColl[i].mergeObj.isCenterAlign,this.mergeCells(t.mergeColl[i].mergeObj.mRange,!0);this.updateData(n.extend(!0,[],t.bData),t.range,t.reqType)}else this.XLRibbon._isMergeSelect&&this.XLRibbon._isFilterSelect.status?(this.clearRangeData(t.range,["decimalPlaces","thousandSeparator","hyperlink","cFormatRule"],"",!1,details.reqType),this.XLFormat.removeStyle(null,{cellStyle:!0,format:!0})):this.clearRangeData(t.range,["format","formats","border","type","formatstr","decimalPlaces","thousandSeparator","hyperlink","cFormatRule"],"",!1,t.reqType),this.setWrapText("unwrap",t.range),this.unmergeCells(t.range);this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t.range)},_undoForCLLink:function(n){var f={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},e,u,o={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},i,r;if(this.setActiveCell(n.selectedCell[0].rowIndex,n.selectedCell[0].colIndex),this.XLSelection.selectRange(f,o),this._isUndo)for(i=0,r=n.selectedCell.length;i<r;i++)n.selectedCell[i].prevLink&&(u=this.getCell(n.selectedCell[i].rowIndex,n.selectedCell[i].colIndex),n.selectedCell[i].prevLink.webAddr?u.html(t.buildTag("a.e-hyperlinks",n.selectedCell[i].prevText,"",{href:n.selectedCell[i].prevLink.webAddr,target:"_blank"})):u.html(t.buildTag("a.e-hyperlinks",n.selectedCell[i].prevText,"")),this.isUndefined(n.selectedCell[i].prevLink.cellAddr)?this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},{dataObj:{hyperlink:{webAddr:n.selectedCell[i].prevLink.webAddr}}}):this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},{dataObj:{hyperlink:{cellAddr:n.selectedCell[i].prevLink.cellAddr}}}));else this._removeHyperlink("clear",n.selectedCell);for(this.XLSelection.selectRange(f,o),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),i=0,r=n.selectedCell.length;i<r;i++)e=n.selectedCell[i].prevLink,n.selectedCell[i].prevLink=n.selectedCell[i].curLink,n.selectedCell[i].curLink=e},_undoForComment:function(n){var t,u,f,r,i,e;for(u={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},f={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},i=0,e=n.selectedCell.length;i<e;i++)t={rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},this.XLSelection.selectRange(t,t),this.getSheet(n.sheetIndex)._startCell=t,n.action==="add"?(n.selectedCell[i].prevComment=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"comment"),this.XLComment&&this.XLComment.deleteComment()):n.action==="edit"?(this._isRowViewable(n.sheetIndex,t.rowIndex)&&this.getCell(t.rowIndex,t.colIndex).find(".e-comment-txtarea").val(n.selectedCell[i].prevComment.value),this.XLComment._updateCurCmntVal(),r=n.selectedCell[i].prevComment,n.selectedCell[i].prevComment=n.selectedCell[i].curComment,n.selectedCell[i].curComment=r):(this.XLEdit._updateDataContainer(t,{dataObj:{comment:n.selectedCell[i].prevComment}}),this.XLComment.setComment([t.rowIndex,t.colIndex,t.rowIndex,t.colIndex],null,!1),this.XLSelection.selectRange(t,t),this.XLComment._updateCurCmntVal(),r=n.selectedCell[i].prevComment,n.selectedCell[i].prevComment=n.selectedCell[i].curComment,n.selectedCell[i].curComment=r);n.action==="add"?n.action="delete":n.action==="delete"&&(n.action="add");this.XLSelection.selectRange(u,f);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForCondFormat:function(n){var i,e,l,s,c,r,o=[],h,a,u,f,v;if(n.range=n.data,this._isUndo){if(n.action==="add"){for(u=this._getSelectedRange({rowIndex:n.range[0],colIndex:n.range[1]},{rowIndex:n.range[2],colIndex:n.range[3]}),c=this.XLEdit.getPropertyValue(u[0].rowIndex,u[0].colIndex,"cFormatRule"),n.poppedRule=c[c.length-1],i=0,e=u.length;i<e;i++){if(h=this.XLEdit.getPropertyValue(u[i].rowIndex,u[i].colIndex,"cFormatRule"),!this.isUndefined(h))for(h.pop(),f=0,l=h.length;f<l;f++)s=h[f],o.length===0?(r=s.indexOf("true")>-1?s.replace("_true",""):s.replace("_false",""),o.push(r)):o=this._addCondFormatRule(o,s);this._isRowViewable(n.sheetIndex,u[i].rowIndex)&&(a=this.getCell(u[i].rowIndex,u[i].colIndex,n.sheetIndex),a.removeClass("e-redft e-yellowft e-greenft e-redf e-redt"))}for(this.clearRangeData(n.range,["cFormatRule"],u),i=0,e=o.length;i<e;i++)r=o[i].split("_"),this.XLCFormat._cFormat(r[0],r[2],r[3],r[4],r[5],n.sheetIndex,n.range)}else if(n.action==="clear")for(i=0,e=n.rule.length;i<e;i++)for(f=0,v=n.rule[i].length;f<v;f++)this.XLCFormat.setCFRule(n.rule[i][f])}else n.action==="add"?t.isNullOrUndefined(n.poppedRule)||(r=n.poppedRule.split("_"),this.XLCFormat._cFormat(r[0],r[2],r[3],r[4],r[5],n.sheetIndex,n.range)):n.action==="clear"&&(n.selection?this.XLCFormat.clearCF(n.range):this.XLCFormat.clearCF())},_getCopyText:function(n){for(var i,u,e=[],r,t=0,f=n.length;t<f;t++)for(r=n[t].split("\t"),i=0,u=r.length;i<u;i++)e.push(r[i]);return e},_cutShape:function(t,i,r,u){for(var o,h,e=["picture","chart"],s,f=0,c=e.length;f<c;f++)if(e[f]in t)for(this.XLShape._picCellIdx={rowIndex:i.rowIndex,colIndex:i.colIndex},o=0,h=t[e[f]].length;o<h;o++)s=n.extend(!0,{},r[e[f]][t[e[f]][o]]),this.XLShape._deleteShape(u,this.element.find("#"+s.id))},_pasteShape:function(t,i,r,u){for(var h,l,s=["picture","chart"],f,e,c,o=0,a=s.length;o<a;o++)if(s[o]in t){for(h=0,l=t.picture.length;h<l;h++)f=n.extend(!0,{},r[s[o]][t[s[o]][h]]),this.XLChart._shapeCnt===1||this.XLChart._shapeCnt--,s[o]==="picture"?(c=this._id+"_picture",this.XLShape._createPicture(u,{rowIndex:i.rowIndex,colIndex:i.colIndex},r.sharedPics[f.data],f.top,f.left,f.width,f.height,parseInt(f.id.replace(c,"")))):(e=f.range,this.XLChart.createChart(this._getAlphaRange(u,e[0],e[1],e[2],e[3]),f));s[o]==="chart"&&this.XLSelection.selectRange({rowIndex:e[0],colIndex:e[1]},{rowIndex:e[2],colIndex:e[3]},pSheetIndex)}},_undoForCopyPaste:function(i){var f={},e=this._dataContainer,k,l=this.getSheet(i.pSheetIndex).shapeMngr,u,tt,h,s,d;if(i.operation==="shape")k=i.pShapeId.indexOf("picture")>-1?"picture":"chart",u=n.extend(!0,{},i.pasteCell.obj),t.isNullOrUndefined(u)||(this.XLShape._picCellIdx={rowIndex:i.pasteCell.rowIndex,colIndex:i.pasteCell.colIndex},k==="chart"?"chart"in u&&(this._isUndo?(f=n.extend(!0,{},l.chart[i.pShapeId]),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex]={}),e.sheets[i.pSheetIndex][i.pasteCell.rowIndex][i.pasteCell.colIndex]=u,this.XLShape._deleteShape(i.pSheetIndex,this.element.find("#"+f.id))):(this.setActiveCell(i.pasteCell.rowIndex,i.pasteCell.colIndex,i.pSheetIndex),f=n.extend(!0,{},i.pasteCell.shapeObj),o=f.range,this.XLChart.createChart(this._getAlphaRange(i.sheetIndex,o[0],o[1],o[2],o[3]),f),this.XLSelection.selectRange({rowIndex:o[0],colIndex:o[1]},{rowIndex:o[2],colIndex:o[3]},i.cSheetIndex))):"picture"in u&&(this._isUndo?(f=n.extend(!0,{},l.picture[i.pShapeId]),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex]={}),e.sheets[i.pSheetIndex][i.pasteCell.rowIndex][i.pasteCell.colIndex]=u,this.XLShape._deleteShape(i.pSheetIndex,this.element.find("#"+f.id))):(f=n.extend(!0,{},i.pasteCell.shapeObj),it=this._id+"_picture",this.XLShape._createPicture(i.pSheetIndex,{rowIndex:i.pasteCell.rowIndex,colIndex:i.pasteCell.colIndex},l.sharedPics[f.data],f.top,f.left,f.width,f.height,parseInt(f.id.replace(it,"")),f.bcolor,f.bstyle,f.bwidth)))),this.XLScroll._getRowHeights(i.pSheetIndex,i.pasteCell.rowIndex);else{var a,s,g,d,v,c,nt,tt,o,y,p,it,w,b,r,rt=!1,ut=[],e=this._dataContainer;for(this._getCopyText(i.text),this._dupDetails=!0,this.element.find(".e-cdata").length&&n("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),this.setActiveSheetIndex(i.pSheetIndex),a=0,g=i.pasteCells.length;a<g;a++)r=i.pasteCells[a],u=t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex])?{}:e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex],this._isUndo||"merge"in r.prevObj&&(this.mergeCenter=r.prevObj.merge.isCenterAlign,this.mergeCells(r.prevObj.merge.mRange,!0)),this._isRowViewable(i.pSheetIndex,r.rowIndex)&&(v=this.getCell(r.rowIndex,r.colIndex,i.pSheetIndex)[0],this._isUndo||(v.textContent=ut[a]),rt=!0),t.isNullOrUndefined(u)||(this._cutShape(u,r,l,i.pSheetIndex),c=this._generateHeaderText(r.colIndex+1)+(r.rowIndex+1),"wrap"in u&&this.setWrapText("unwrap",c+":"+c),"merge"in u&&this._isUndo&&(r.newObj=n.extend(!0,{},e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex]),this.unmergeCells(this._getAlphaRange(i.pSheetIndex,r.rowIndex,r.colIndex,r.rowIndex,r.colIndex)),this.getCell(r.rowIndex,r.colIndex,i.pSheetIndex).prop("rowspan",!1).prop("colspan",!1),"merge"in r.prevObj&&(this.mergeCenter=r.prevObj.merge.isCenterAlign,this.mergeCells(r.prevObj.merge.mRange,!0),this.mergeCenter=!1))),rt&&this._isUndo&&(v.textContent="",this._removeClass(v,"e-commentcell")),t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex])&&(e.sheets[i.pSheetIndex][r.rowIndex]={}),t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex])||(w=e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex].overflow),this.model.allowCellFormatting&&this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0,border:!0}),e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex]=n.extend(!0,{},r.prevObj),w&&(e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex].overflow=w),this._textClip(r.rowIndex,r.colIndex,"delete"),this._setRowHdrHeight(i.pSheetIndex,r.rowIndex),u=t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex])?{}:e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex],y=r.rowIndex,p=r.colIndex,this._applyCommentLink(u,{rowIndex:r.rowIndex,colIndex:r.colIndex},y,p),this._isPaste=!0,t.isNullOrUndefined(u)||(this._pasteShape(u,{rowIndex:y,colIndex:p},l,i.pSheetIndex),"cellType"in u&&(this._isUndo?this._removeClass(v,"e-cellreadonly"):(b=this._dataContainer.sheetCellType[u.cellType],b.text="",this.model.allowCellType&&this.XLCellType._renderControls(r.rowIndex,r.colIndex,i.pSheetIndex,b,!0))),c=this._generateHeaderText(r.colIndex+1)+(r.rowIndex+1),"wrap"in u&&(this.XLEdit._clearDataContainer({cellIdx:r,property:["wrap"]}),this.setWrapText("wrap",c+":"+c)),this._isPaste=!1),nt=r.prevObj,r.prevObj=r.newObj,r.newObj=nt;if(i.isSpecial&&(this.model.allowCellFormatting&&(this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0}),this.isUndefined(i.pasteBorder.prevBorder)||this.XLFormat.updateFormat(i.pasteBorder.prevBorder,i.pasteBorder.range,"format")),tt=i.pasteBorder.prevBorder,i.pasteBorder.prevBorder=i.pasteBorder.newBorder,i.pasteBorder.newBorder=tt),!t.isNullOrUndefined(i.pfat))for(h=i.pfat.ptable,s=0,d=h.length;s<d;s++)t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),this._isUndo?(this.XLFormat.removeTable(h[s].id),this.XLFormat.removeStyle(h[s].range)):(h[s].header=!0,this.XLFormat.createTable(h[s],h[s].range)));t.isNullOrUndefined(i.filter)||(this.XLFilter.clearFilter(),this.XLFilter.filter(details.filter));this._dupDetails=!1}i.operation!=="shape"&&(this._isUndo?(t.isNullOrUndefined(i.cSheetIndex)||this.setActiveSheetIndex(i.cSheetIndex),i.cutCells.length>0&&this.XLSelection._focusBorder(i.cutCells[0],i.cutCells[i.cutCells.length-1],this._cutFocus),this.setActiveSheetIndex(i.pSheetIndex),this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1])):(t.isNullOrUndefined(i.cSheetIndex)||this.setActiveSheetIndex(i.cSheetIndex),i.cutCells.length>0&&this.XLSelection._focusBorder(i.cutCells[0],i.cutCells[i.cutCells.length-1],this._cutFocus),this.setActiveSheetIndex(i.pSheetIndex),i.pasteCells.length>0&&this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1])),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this.XLScroll._getRowHeights(i.pSheetIndex,i.pasteCells[0].rowIndex))},_undoForCutPaste:function(i){var u,y,o={},e=this._dataContainer,p=this.getSheet(i.pSheetIndex).shapeMngr,ft,it,wt,d,et,ot,st,g,v,h,k,f,c,a,ht,ct,rt,r,s,ut,vt,yt,pt;if(i.operation==="shape")d=i.pShapeId.indexOf("picture")>-1?"picture":"chart",u=n.extend(!0,{},i.pasteCell.obj),t.isNullOrUndefined(u)||(this.XLShape._picCellIdx={rowIndex:i.pasteCell.rowIndex,colIndex:i.pasteCell.colIndex},o=n.extend(!0,{},p[d][i.pShapeId]),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex]={}),e.sheets[i.pSheetIndex][i.pasteCell.rowIndex][i.pasteCell.colIndex]=u,this.XLShape._deleteShape(i.pSheetIndex,this.element.find("#"+o.id))),u=n.extend(!0,{},i.cutCell.obj),d=i.cShapeId.indexOf("picture")>-1?"picture":"chart",t.isNullOrUndefined(u)||(this.setActiveCell(i.cutCell.rowIndex,i.cutCell.colIndex,i.cSheetIndex),d==="chart"?"chart"in u&&(o=n.extend(!0,{},i.cutCell.shapeObj),h=o.range,this.setActiveSheetIndex(i.cSheetIndex),this.XLChart.createChart(this._getAlphaRange(i.sheetIndex,h[0],h[1],h[2],h[3]),o),this.setActiveSheetIndex(i.sheetIndex),this.XLSelection.selectRange({rowIndex:h[0],colIndex:h[1]},{rowIndex:h[2],colIndex:h[3]},i.cSheetIndex)):"picture"in u&&(o=n.extend(!0,{},i.cutCell.shapeObj),ft=this._id+"_picture",this.XLShape._createPicture(i.cSheetIndex,{rowIndex:i.cutCell.rowIndex,colIndex:i.cutCell.colIndex},p.sharedPics[o.data],o.top,o.left,o.width,o.height,parseInt(o.id.replace(ft,"")),o.bcolor,o.bstyle,o.bwidth))),this.XLShape._picCellIdx={rowIndex:i.cutCell.rowIndex,colIndex:i.cutCell.colIndex},et=i.pasteCell,i.pasteCell=i.cutCell,i.cutCell=et,ot=i.pShapeId,i.pShapeId=i.cShapeId,i.cShapeId=ot;else{for(ct=[],e=this._dataContainer,this.element.find(".e-cdata").length&&n("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),this._getCopyText(i.text),r=0,st=i.pasteCells.length;r<st;r++)t.isNullOrUndefined(i.pSheetIndex)||(this.isUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex])||(u=e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex]),v=this._generateHeaderText(i.pasteCells[r].colIndex+1)+(i.pasteCells[r].rowIndex+1),"wrap"in u&&this.setWrapText("unwrap",v+":"+v),this._isRowViewable(i.pSheetIndex,i.pasteCells[r].rowIndex)&&(k=this.getCell(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,i.pSheetIndex)[0],k.textContent="",this._removeClass(k,"e-commentcell")),this.isUndefined(u)||(this._cutShape(u,i.pasteCells[r],p,i.pSheetIndex),"merge"in u&&(this._isUndo?(n.extend(!0,i.pasteCells[r].newObj,e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex]),this.setActiveSheetIndex(i.pSheetIndex),this.unmergeCells(u.merge.mRange),this.getCell(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,i.pSheetIndex).prop("rowspan",!1).prop("colspan",!1),"merge"in i.pasteCells[r].prevObj&&(this.mergeCenter=i.pasteCells[r].prevObj.merge.isCenterAlign,this.mergeCells(i.pasteCells[r].prevObj.merge.mRange,!0),this.mergeCenter=!1)):(this.setActiveSheetIndex(i.pSheetIndex),this.unmergeCells(u.merge.mRange,!0),"merge"in i.pasteCells[r].prevObj&&(this.mergeCenter=i.pasteCells[r].prevObj.merge.isCenterAlign,this.mergeCells(i.pasteCells[r].prevObj.merge.mRange,!0),this.mergeCenter=!1),this.setActiveSheetIndex(i.cSheetIndex),this.unmergeCells(this._getAlphaRange(i.pSheetIndex,i.cutCells[r].rowIndex,i.cutCells[r].colIndex,i.cutCells[r].rowIndex,i.cutCells[r].colIndex)),h=this.getRangeIndices(i.cutCells[r].prevObj.merge.mRange),this.XLSelection.selectRange({rowIndex:h[0],colIndex:h[1]},{rowIndex:h[2],colIndex:h[3]},i.sheetIndex))),"cellType"in u&&this._removeClass(k,"e-cellreadonly")),this.isUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex]={}),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex])||(y=e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex].overflow),this.model.allowCellFormatting&&this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0,border:!0}),e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex].wrap&&(it=!0),wt=this.XLEdit.getPropertyValue(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,"tableName")||"",e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex]=n.extend(!0,{},i.pasteCells[r].prevObj),this._textClip(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,"delete"),this.isUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex])||(y&&(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex].overflow=y),this._setRowHdrHeight(i.pSheetIndex,i.pasteCells[r].rowIndex),u=e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex],c=i.pasteCells[r].rowIndex,a=i.pasteCells[r].colIndex,this._applyCommentLink(u,{rowIndex:c,colIndex:a},c,a),it&&(u.wrap=it),this._isPaste=!0,t.isNullOrUndefined(u)||(this._pasteShape(u,{rowIndex:c,colIndex:a},p,i.pSheetIndex,i.sheetIndex),v=this._generateHeaderText(a+1)+(c+1),"wrap"in u&&(this.XLEdit._clearDataContainer({cellIdx:i.pasteCells[r],property:["wrap"]}),this.setWrapText("wrap",v+":"+v)))),g=i.pasteCells[r].prevObj,i.pasteCells[r].prevObj=i.pasteCells[r].newObj,i.pasteCells[r].newObj=g,this._isPaste=!1);for(r=0;r<i.cutCells.length;r++)t.isNullOrUndefined(i.cSheetIndex)||(f=i.cutCells[r],this._isRowViewable(i.cSheetIndex,f.rowIndex)&&(ht=this.getCell(f.rowIndex,f.colIndex,i.cSheetIndex)[0],ht.textContent=ct[r]),this.setActiveSheetIndex(i.cSheetIndex),u=t.isNullOrUndefined(e.sheets[i.cSheetIndex][f.rowIndex])?{}:e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex],t.isNullOrUndefined(u)||this._cutShape(u,f,p,i.cSheetIndex),t.isNullOrUndefined(e.sheets[i.cSheetIndex][f.rowIndex])&&(e.sheets[i.cSheetIndex][f.rowIndex]={}),t.isNullOrUndefined(e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex])||(y=e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex].overflow),f.prevObj.tableName&&delete f.prevObj.tableName,e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex]=n.extend(!0,{},f.prevObj),this.getObjectLength(y)>0&&(e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex].overflow=y)&&(y={}),g=f.prevObj,f.prevObj=f.newObj,f.newObj=g,c=f.rowIndex,a=f.colIndex,this._setRowHdrHeight(i.cSheetIndex,c),this.XLScroll._getRowHeights(i.cSheetIndex,c),u=t.isNullOrUndefined(e.sheets[i.cSheetIndex][c])?{}:e.sheets[i.cSheetIndex][c][a],this._applyCommentLink(u,{rowIndex:c,colIndex:a},c,a),this._isPaste=!0,t.isNullOrUndefined(u)||(this._pasteShape(u,{rowIndex:c,colIndex:a},p,i.cSheetIndex),"merge"in u&&(this.mergeCenter=u.merge.isCenterAlign,this.mergeCells(u.merge.mRange,!0),this.mergeCenter=!1),"cellType"in u&&(rt=this._dataContainer.sheetCellType[u.cellType],rt.text="",this.model.allowCellType&&this.XLCellType._renderControls(f.rowIndex,f.colIndex,i.pSheetIndex,rt,!0)),this._dupDetails=!0,v=this._generateHeaderText(f.colIndex+1)+(f.rowIndex+1),"wrap"in u&&(this.XLEdit._clearDataContainer({cellIdx:f,property:["wrap"]}),this.setWrapText("wrap",v+":"+v)),this._dupDetails=!1),this._isPaste=!1);if(this.XLScroll._getRowHeights(i.pSheetIndex,i.pasteCells[0].rowIndex<i.cutCells[0].rowIndex?i.pasteCells[0].rowIndex:i.cutCells[0].rowIndex),this.model.allowCellFormatting&&!t.isNullOrUndefined(i.pSheetIndex)&&(this.setActiveSheetIndex(i.pSheetIndex),this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0}),this.isUndefined(i.pasteBorder.prevBorder)||this.XLFormat.updateFormat(i.pasteBorder.prevBorder,i.pasteBorder.range,"format")),nBrdr=i.pasteBorder.prevBorder,i.pasteBorder.prevBorder=i.pasteBorder.newBorder,i.pasteBorder.newBorder=nBrdr,this.model.allowCellFormatting&&!t.isNullOrUndefined(i.cSheetIndex)&&(this.setActiveSheetIndex(i.cSheetIndex),i.isSpecial&&this.XLFormat.removeStyle(i.cutBorder.range,{cellStyle:!0,tableStyle:!0,format:!0}),i.cutBorder.prevBorder&&this.XLFormat.updateFormat(i.cutBorder.prevBorder,i.cutBorder.range,"format")),nBrdr=i.cutBorder.prevBorder,i.cutBorder.prevBorder=i.cutBorder.newBorder,i.cutBorder.newBorder=nBrdr,!t.isNullOrUndefined(i.pfat)){var w,l=i.pfat.table,b,lt=i.pfat.minRowIdx,at=i.pfat.minColIdx,nt,tt=i.pfat.range;for(s=0,ut=l.length;s<ut;s++)b=l[s].range,t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),nt=l[s].tblObj.tblId,w=i.pfat.ptable[s].range,this.XLFormat.removeTable(nt),this.XLFormat.removeStyle(w)),t.isNullOrUndefined(i.cSheetIndex)||(this.setActiveSheetIndex(i.cSheetIndex),this.XLClipboard._isCut=!0,this._isUndo?(this.XLFormat.createTable(l[s].tblObj,l[s].range),l[s].tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,nt,l[s].tblObj.fnNumber,l[s].range,!0)):(w=this.getRangeIndices(this._getAlphaRange(i.cSheetIndex,b[0]+lt-tt[0],b[1]+at-tt[1],lt-tt[0]+b[2],at-tt[1]+b[3])),this.XLFormat.createTable(l[s].tblObj,w),l[s].tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,nt,l[s].tblObj.fnNumber,w,!0)),this.XLClipboard._isCut=!1)}t.isNullOrUndefined(i.filter)||(this.XLFilter.clearFilter(),this.XLFilter.filter(details.filter))}i.operation!=="shape"&&(this._isUndo?(t.isNullOrUndefined(i.cSheetIndex)||(this.setActiveSheetIndex(i.cSheetIndex),this.XLSelection.selectRange(i.cutCells[0],i.cutCells[i.cutCells.length-1])),t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1]))):(t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),this.XLSelection._focusBorder(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1],this._cutFocus),this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1])),t.isNullOrUndefined(i.cSheetIndex)||(this.setActiveSheetIndex(i.cSheetIndex),this.XLSelection.selectRange(i.cutCells[0],i.cutCells[i.cutCells.length-1]))));this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();vt=i.pasteCells;i.pasteCells=i.cutCells;i.cutCells=vt;yt=i.pasteBorder;i.pasteBorder=i.cutBorder;i.cutBorder=yt;pt=i.cSheetIndex;i.cSheetIndex=i.pSheetIndex;i.pSheetIndex=pt},_undoForDel:function(t){this._delCells=n.extend(!0,[],t.delCells);this._deletedText=n.extend(!0,[],t.text);this._removeMergeColl=n.extend(!0,[],t.removeMerge);this._deletedDimension=n.extend(!0,[],t.deletedDimension);this._isUndo&&(this._fRow.fRowCnt=t.fRow.fRowCnt,this._fCol.fColCnt=t.fCol.fColCnt,this._fRow.rowAdj=t.fRow.rowAdj,this._fCol.colAdj=t.fCol.colAdj);switch(t.action){case"deleteShiftUp":this.deleteShiftUp(t.startCell,t.endCell);break;case"deleteShiftLeft":this.deleteShiftLeft(t.startCell,t.endCell);break;case"deleteRow":this.deleteEntireRow(t.startCell.rowIndex,t.endCell.rowIndex);break;case"deleteColumn":this.deleteEntireColumn(t.startCell.colIndex,t.endCell.colIndex)}},_undoForEdit:function(n){var f,h,l,e,o,s=n.cFormatRule,u={rowIndex:n.rowIndex,colIndex:n.colIndex},c,r,a,v=this.getRows(n.sheetIndex);if(this.setActiveCell(n.rowIndex,n.colIndex,n.sheetIndex),this.XLSelection.selectRange(n.startCell,n.endCell),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this._isRowViewable(n.sheetIndex,n.rowIndex)&&(r=this.getCell(n.rowIndex,n.colIndex),a=r.find("a").css("text-decoration"),n.altwrap&&(this._isUndo?this.XLEdit._clearDataContainer({cellIdx:u,property:["altTxt"]}):this.XLEdit._updateDataContainer(u,{dataObj:{altTxt:!0}}))),f=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"hyperlink",n.sheetIndex),t.isNullOrUndefined(f)||(h=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value2"),n.action=h.length<1?"add":"delete",n.reqType="edit",u.prevLink=f,u.prevText=h,n.selectedCell=[]),c=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"comment"),this.XLEdit._updateCellValue({rowIndex:n.rowIndex,colIndex:n.colIndex},n.pValue),this._dupDetails=!0,s&&s.length){for(i=0,len=s.length;i<len;i++)o=s[i].split("_"),this.XLCFormat._cFormat(o[0],o[2],o[3],o[4],o[5]);this.XLCFormat.refreshCFormat(this._getAlphaRange(n.sheetIndex,n.rowIndex,n.colIndex,n.rowIndex,n.colIndex))}n.prevFrmtObj&&n.curFrmtObj&&(l=this._isUndo?n.prevFrmtObj:n.curFrmtObj,this.XLFormat.format(l,this._getAlphaRange(n.sheetIndex,n.rowIndex,n.colIndex,n.rowIndex,n.colIndex)));this._dupDetails=!1;this._textClip(n.rowIndex,n.colIndex,n.pValue.length>0?"add":"delete");t.isNullOrUndefined(c)||(this.XLEdit._updateDataContainer({rowIndex:n.rowIndex,colIndex:n.colIndex},{dataObj:{comment:c}}),this.XLComment.setComment(),this.XLComment._updateCurCmntVal());this._isRowViewable(n.sheetIndex,n.rowIndex)&&(f&&(f.webAdr?r.html(t.buildTag("a",r.text(),"",{href:hldata.webAdr,target:"_blank","class":"e-hyperlinks"})):r.html(t.buildTag("a",r.text(),"",{"class":"e-hyperlinks"}))),r.find("a").css("text-decoration",a),r.removeClass("e-commentcell"));t.isNullOrUndefined(f)||(u.curLink=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"hyperlink"),u.curText=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value2"),n.selectedCell.push(u));n.prevHeight!=n.newHeight&&(this.getSheet(n.sheetIndex).rowsHeightCollection[n.rowIndex]=n.prevHeight,this._isRowViewable(n.sheetIndex,n.rowIndex)&&(v[0][n.rowIndex].style.height=n.prevHeight+"px",v[1][n.rowIndex].style.height=n.prevHeight+"px"),this._setRowHdrHeight(n.sheetIndex,n.rowIndex),this.XLScroll._getRowHeights(n.sheetIndex,n.rowIndex),e=n.newHeight,n.newHeight=n.prevHeight,n.prevHeight=e);e=n.cValue;n.cValue=n.pValue;n.pValue=e;this.XLEdit._isEdit=!1;e=n.previousValue;n.previousValue=n.value;n.value=e;this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForFilter:function(i){var y=!1,v=[],u,d,c=[],b,o,s,f,g=i.sheetIndex||this.getActiveSheetIndex(),k=this._dataContainer.sheets[g],p,nt,r,e,l,a,tt,w,h;if(i.operation==="filter"&&i.requestType!=="filterbycell")if(this._isUndo){for(r=this._undoCollection.length-1;r>=0;r--){if(this._undoCollection[r].reqType==="filter"&&this._undoCollection[r].tableID===i.tableID&&this._undoCollection[r].action==="filtering"&&this._undoCollection[r].status!=="apply-filterIcon"&&this._undoCollection[r].rowIndex===i.rowIndex&&this._undoCollection[r].colIndex===i.colIndex){for(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],u=this._undoCollection[r],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,u.tableID),r=0,e=u.filterCollection.length;r<e;r++)v.push(u.filterCollection[r]);this.model.sheets[u.sheetIndex].filterSettings.filteredColumns=v;t.isNullOrUndefined(this._excelFilter._predicates[u.sheetIndex][u.fieldName])&&(this._excelFilter._predicates[u.sheetIndex][u.fieldName]={});this._excelFilter._predicates[u.sheetIndex][u.fieldName]=u.ejpredicate;this.model.sheets[u.sheetIndex]._selectedRange=u.range;this.XLFilter._filterHandler(u);b="undo";y=!0;break}if(this._undoCollection[r].reqType==="filter"&&this._undoCollection[r].tableID===i.tableID&&this._undoCollection[r].action==="clearfiltering"){delete this._excelFilter._predicates[i.sheetIndex][i.fieldName];u=this._undoCollection[r];this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,u.tableID);y=!0;break}if(this._undoCollection[r].requestType==="filterbycell"&&this._undoCollection[r].rowIndex===i.rowIndex&&this._undoCollection[r].colIndex===i.colIndex){u=this._undoCollection[r];delete this._excelFilter._predicates[u.sheetIndex][u.fieldName];this.XLFilter._clearFilterColumn(u.fieldName,"","","Or",null,null,u.tableID);n.extend(!0,c,u.selCells);this.XLFilter._filterActiveCell(u.sheetIndex,u.activeCell,c,u.filteredValue,u.selRange);b="undo";y=!0;break}}y||(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID))}else{for(v=[],delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),r=0,e=i.filterCollection.length;r<e;r++)v.push(i.filterCollection[r]);this.model.sheets[i.sheetIndex].filterSettings.filteredColumns=v;t.isNullOrUndefined(this._excelFilter._predicates[i.sheetIndex][i.fieldName])&&(this._excelFilter._predicates[i.sheetIndex][i.fieldName]={});this._excelFilter._predicates[i.sheetIndex][i.fieldName]=i.ejpredicate;i.filterCollection.length&&this.XLFilter._filterHandler(i);b="redo"}else if(this._isUndo){if(i.operation==="apply-filter"&&i.requestType!=="filterbycell")for(r=0,e=i.filteredCells.length;r<e;r++)o=i.filteredCells[r].rowIndex,s=i.filteredCells[r].colIndex,f=this.getCell(o,s,i.sheetIndex),f.find(".e-ssfilter").remove(),this._removeClass(f[0],"e-filterhdr"),this.addClass(f[0],"e-wrapword"),(this.isNumber(f.text())||this.XLEdit._parseValue(f.text(),{rowIndex:o,colIndex:s}).type==="datetime"||this.XLEdit._parseValue(f.text(),{rowIndex:o,colIndex:s}).type==="currency"||this.XLEdit._parseValue(f.text()).type==="percentage",{rowIndex:o,colIndex:s})&&f.addClass(this._rAlign),delete k[o][s].isFilterHeader,delete k[o][s].filterState,delete k[o][s].isFilterVisible,this.XLEdit.getPropertyValue(o,s,"isFilterWrap")&&this.setWrapText("wrap",this._getAlphaRange(g,o,s,o,s));if(i.requestType==="filterbycell"&&(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),!this.isUndefined(i.filteredCells)))for(r=0,e=i.filteredCells.length;r<e;r++)f=this.getCell(i.filteredCells[r].rowIndex,i.filteredCells[r].colIndex,i.sheetIndex),f.find(".e-ssfiltered, .e-ssfilter").remove(),this._removeClass(f[0],"e-filterhdr"),this.addClass(f[0],"e-wrapword"),(this.isNumber(f.text())||this.XLEdit._parseValue(f.text(),{rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex}).type==="datetime"||this.XLEdit._parseValue(f.text(),{rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex}).type==="currency"||this.XLEdit._parseValue(f.text(),{rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex}).type==="percentage")&&f.addClass(this._rAlign);if(this.model.sheets[i.sheetIndex].filterSettings.range="",i.operation==="apply-filter"&&i.requestType!="filterbycell"||i.requestType==="filterbycell"&&!this.isUndefined(i.filteredCells)){for(p=this.model.sheets[i.sheetIndex].filterSettings.tableRange,r=0,e=p.length;r<e;r++)if(p[r].tableID===i.tableID){nt=r;break}i.filterRange=p.splice(nt,1)[0]}if(i.operation==="remove-filter"){if(l=this._undoCollection[this._undoCollection.length-1],h=this.getSheet(i.sheetIndex),l.requestType==="filterbycell")n.extend(!0,c,l.selCells),this.XLFilter._filterActiveCell(l.sheetIndex,l.activeCell,c,l.filteredValue,l.selRange);else for(r=0,e=i.filteredCells.length;r<e;r++)w=this.XLFilter._getFilterIcon(),this.XLFilter._applyFilterIcon(i.filteredCells[r],w);for(h._selectedRange=i.selRange,h.filterSettings.filteredRange=i.fltrdRange,h.filterSettings.filteredColumns=i.filteredCols,h.filterSettings.range=i.fRange,h.filterSettings.tableRange.push(i.filterRange),a=0,tt=i.filterCollection.length;a<tt;a++)this._excelFilter._predicates[i.sheetIndex][i.filterCollection[a].fieldName]=i.filterCollection[a].predicate,this.XLFilter._filterHandler(i.filterCollection[a])}}else if(i.operation==="remove-filter"&&(i.requestType==="filterbycell"?(this._isRowViewable(i.sheetIndex,i.activeCell.rowIndex)&&(d=this.getCell(i.activeCell.rowIndex,i.activeCell.colIndex),d.find("span.e-ssfilter").remove()),delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),n.extend(!0,c,i.selectedCell),this.XLFilter._filterActiveCell(i.sheetIndex,i.activeCell,c,i.filteredValue,i.selRange)):this.XLFilter.clearFilter("remove")),i.operation==="filter"&&i.requestType==="filterbycell"&&(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),n.extend(!0,c,i.selectedCell),this.XLFilter._filterActiveCell(i.sheetIndex,i.activeCell,c,i.filteredValue,i.selRange)),i.operation==="apply-filter"){for(h=this.getSheet(i.sheetIndex),r=0,e=i.filteredCells.length;r<e;r++)w=this.XLFilter._getFilterIcon(),this.XLFilter._applyFilterIcon({rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex},w);h.filterSettings.range=i.fRange;h.filterSettings.tableRange.push(i.filterRange)}},_undoForFilterByColor:function(n){var i,r=[],t;for(r.push(n),i=this._isUndo?this._undoCollection:r,delete this._excelFilter._predicates[n.sheetIndex][n.columnName],this.XLFilter._clearFilterColumn(n.columnName,"","","Or",null,null,n.tableID),t=i.length-1;t>=0;t--)if(i[t].reqType==="filterbycolor"&&i[t].tableID===n.tableID&&i[t].rowIndex===n.rowIndex&&i[t].colIndex===n.colIndex){this.XLFilter._filterHandler(i[t]);break}},_undoForFind:function(n){var i,t,r,u;switch(n.operation){case"replace":this.XLEdit._updateCellValue({rowIndex:n.rowIndex,colIndex:n.colIndex},n.prevData.value,null,n.sheetIndex);u=n.prevData;n.prevData=n.newData;n.newData=u;this.XLSelection.selectRange({rowIndex:n.rowIndex,colIndex:n.colIndex},{rowIndex:n.rowIndex,colIndex:n.colIndex});break;case"replaceAll":for(t=0,r=n.selectedCell.length;t<r;t++)this.XLEdit._updateCellValue({rowIndex:n.selectedCell[t].rowIndex,colIndex:n.selectedCell[t].colIndex},n.selectedCell[t].prevData.value,null,n.selectedCell[t].sheetIndex),u=n.selectedCell[t].prevData,n.selectedCell[t].prevData=n.selectedCell[t].newData,n.selectedCell[t].newData=u;break;case"blanks":case"conditions":case"validations":case"formulas":case"rowdiff":case"coldiff":case"comments":case"constants":for(t=0,r=n.selectedCell.length;t<r;t++)i=this.getCell(n.selectedCell[t].rowIndex,n.selectedCell[t].colIndex,n.sheetIndex),this._isUndo?i.operation==="coldiff"||i.operation==="rowdiff"?n.selectedCell[t].isApply?i.removeClass("e-selected"):i.addClass("e-selected"):n.selectedCell[t].isApply?i.addClass("e-selected"):i.removeClass("e-selected"):i.removeClass("e-selected")}this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForFormat:function(i){var c=!1,y,r,f,e,o=this._dataContainer.sheets[i.sheetIndex],l,s,a,h="",u,v;if(t.isNullOrUndefined(i.process))for(i.oprType==="style"&&(this.XLFormat.removeStyle(i.range,{cellStyle:!0,format:!0}),h="e-format",!t.isNullOrUndefined(i.process)&&i.process.indexOf("border")>-1&&(h="e-border"),a=new RegExp("\\b"+h+".*?\\b","g")),y={startCell:i.selectedCell[0],endCell:i.selectedCell[i.selectedCell.length-1]},u=0,v=i.selectedCell.length;u<v;u++)r=i.selectedCell[u],this._isRowViewable(i.sheetIndex,r.rowIndex)&&(e=this.getCell(r.rowIndex,r.colIndex)[0],c=!0),t.isNullOrUndefined(o[r.rowIndex])&&(o[r.rowIndex]={}),t.isNullOrUndefined(o[r.rowIndex][r.colIndex])&&(o[r.rowIndex][r.colIndex]={}),n.extend(!0,o[r.rowIndex][r.colIndex],i.selectedCell[u].beforeFormat),c&&(i.oprType==="format"?(l=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2"),this.XLEdit._refreshTextNode(e,t.isNullOrUndefined(l)?"":l),this.XLEdit._refreshCellAlignment({cellIdx:{rowIndex:r.rowIndex,colIndex:r.colIndex}})):(f=h==="e-format"?this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"format"):this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border"),e.className=e.className.replace(a,""),f=t.isNullOrUndefined(f)?"":f,this.addClass(e,f))),i.selectedCell[0].colIndex===i.selectedCell[u].colIndex&&this.model.allowResizing&&(this._isUndo?this.XLResize.setRowHeight(i.selectedCell[u].rowIndex,i.selectedCell[u].bRowHeight):this.XLResize.setRowHeight(i.selectedCell[u].rowIndex,i.selectedCell[u].aRowHeight)),s=i.selectedCell[u].beforeFormat,i.selectedCell[u].beforeFormat=i.selectedCell[u].afterFormat,i.selectedCell[u].afterFormat=s,c=!1;!t.isNullOrUndefined(i.process)&&i.process.indexOf("border")>-1&&(this.XLFormat.removeStyle(i.range,{cellStyle:!0,tableStyle:!0,format:!1,border:!0}),this._isUndo?this.XLFormat.updateFormat(i.beforeFormat,i.range):i.process==="noborder"?this.XLFormat.format({border:{}},i.range):this.XLFormat.applyBorder(n.extend(!0,{},i.options),i.range),s=i.beforeFormat,i.beforeFormat=i.afterFormat,i.afterFormat=s);i.status="undo-cellformat";this.performSelection(i.range)},_undoForFormatPaint:function(t){var r,i,e,o,s=this._dataContainer.sheets[t.sheetIndex],u,f;for(this.XLCFormat.clearCF(t.range),this.XLFormat.removeStyle(t.range),this.updateData(n.extend(!0,[],t.beforeData),t.range),this.XLCFormat.refreshCFormat(t.range),e=this.getRangeData({range:t.range}),o=this._getSelectedRange({rowIndex:t.range[0],colIndex:t.range[1]},{rowIndex:t.range[2],colIndex:t.range[3]}),i=0,f=t.unwrapCells.length;i<f;i++)this.setWrapText("unwrap",this._getAlphaRange(t.sheetIndex,t.unwrapCells[i].rowIndex,t.unwrapCells[i].colIndex,t.unwrapCells[i].rowIndex,t.unwrapCells[i].colIndex));for(i=0,u=t.wrapCells.length;i<u;i++)this.setWrapText("wrap",this._getAlphaRange(t.sheetIndex,t.wrapCells[i].rowIndex,t.wrapCells[i].colIndex,t.wrapCells[i].rowIndex,t.wrapCells[i].colIndex));r=t.unwrapCells;t.unwrapCells=t.wrapCells;t.wrapCells=r;r=t.beforeData;t.beforeData=t.afterData;t.afterData=r},_undoForFormatTable:function(i){var o,k,h,c,l,s,y,p,v,f=0,u=i.sheetIndex,r=this.getSheet(u).tableManager,g,e=i.header,nt=n("#"+this._id+"_Ribbon").data("ejRibbon"),a,tt=this._isUndo,w,d,b;switch(i.action){case"Design_Tools_ConvertToRange":this._isUndo?(r[i.tableID]={name:i.name,range:i.beforeRange,format:i.format,formatName:i.formatName},this.performSelection(this._getAlphaRange(u,i.beforeRange[0],i.beforeRange[1],i.beforeRange[2],i.beforeRange[3])),this.XLFilter._filterTable(u,i.tableID),this.updateUniqueData({tableName:"e-table"+i.tableID},r[i.tableID].range),r[i.tableID].isFilter=i.isFilter,r[i.tableID].firstColumn=i.firstColumn,r[i.tableID].lastColumn=i.lastColumn,r[i.tableID].totalRow=i.totalRow,r[i.tableID].fnNumber=i.fnNumber,this.getSheet(u)._header[i.tableID]=e,range=this._getDollarAlphaRange(r[i.tableID].range,!0),this.XLRibbon.addNamedRange(i.name,range,null,u)):i.tableID in r&&(g="e-table"+i.tableID,this.XLFormat.removeTable(i.tableID),this.XLFilter._clearFilterTable(u,i.tableID),delete r[i.tableID],delete this.model.sheets[u]._header[i.tableID]);break;case"filtericon":w=n("#"+i.id).data("ejCheckBox");d=i.tableId;i.check?w.option("checked",!1):w.option("checked",!0);r[d].isFilter=!i.check;i.check=!i.check;break;case"firstlastcolumn":b=n("#"+i.id).data("ejCheckBox");i.check?(this.XLFormat.format({style:{"font-weight":"normal"}},i.range),b.option("checked",!1)):(this.XLFormat.format({style:{"font-weight":"bold"}},i.range),b.option("checked",!0));r[i.tableId][i.prop]=!i.check;i.check=!i.check;break;case"totalrow":n("#"+i.id).ejCheckBox("option",{checked:!i.check});i.check=!i.check;break;case"Design_Tools_ResizeTable":if(this._isUndo){for(this._isFATResize=!0,i.afterRange=n.extend(!0,[],i.afterRange),i.totalRow&&(this._dupDetails=!0,this.XLFormat._calculateTotalRow(u,i.tableId,!1),i.beforeRange[2]-=1,r[i.tableId].range[2]-=1),l=r[i.tableId].name,this.XLFormat.removeTable(i.tableId),this.XLFormat.removeStyle(i.afterRange),h=i.beforeRange[3]-i.beforeRange[1]+1,s=e[i.tableId].header?this.getRangeData({range:i.beforeRange}):this.getRangeData({range:i.beforeRange}).splice(h,this.getRangeData({range:i.beforeRange}).length),this.clearRangeData(i.beforeRange),e[i.tableId].header?this.updateData(s,[i.beforeRange[0],i.beforeRange[1],i.beforeRange[2],i.beforeRange[3]]):this.updateData(s,[i.beforeRange[0],i.beforeRange[1],i.beforeRange[2]-1,i.beforeRange[3]]),r[i.tableId]={header:e[i.tableId].header,tblId:i.tableId,name:l,range:i.beforeRange,format:i.format,formatName:i.formatName,firstColumn:i.firstColumn,lastColumn:i.lastColumn,isFilter:i.isFilter,totalRow:i.totalRow},this.XLClipboard._isCut=!0,e[i.tableId].header?this.XLFormat.createTable(r[i.tableId],i.beforeRange):this.XLFormat.createTable(r[i.tableId],[i.beforeRange[0],i.beforeRange[1],i.beforeRange[2]-1,i.beforeRange[3]]),i.totalRow&&(this._dupDetails=!0,this.XLFormat._calculateTotalRow(u,i.tableId,!0),i.beforeRange=r[i.tableId].range),a=this.getSheet(u).filterSettings.tableRange,f=0;f<a.length;f++)if(a[f].tableID==i.tableId){a[f].endRow=a[f].selectedRange.endRow=i.beforeRange[2];break}this.XLClipboard._isCut=!1;this._isFATResize=!1}else this._isFATResize=!0,i.beforeRange=n.extend(!0,[],i.beforeRange),i.totalRow&&(this.XLFormat._calculateTotalRow(u,i.tableId,!1),i.afterRange=r[i.tableId].range=[i.afterRange[0],i.afterRange[1],i.afterRange[2]-1,i.afterRange[3]]),l=r[i.tableId].name,this.XLFormat.removeTable(i.tableId),this.XLFormat.removeStyle(i.beforeRange),h=i.beforeRange[3]-i.beforeRange[1]+1,s=e[i.tableId].header?this.getRangeData({range:i.afterRange}):this.getRangeData({range:i.afterRange}).splice(h,this.getRangeData({range:i.afterRange}).length),this.clearRangeData(i.afterRange),e[i.tableId].header?this.updateData(s,i.afterRange):this.updateData(s,[i.afterRange[0],i.afterRange[1],i.afterRange[2]-1,i.afterRange[3]]),r[i.tableId]={header:e[i.tableId].header,tblId:i.tableId,name:l,range:i.beforeRange,format:i.format,formatName:i.formatName,firstColumn:i.firstColumn,lastColumn:i.lastColumn,isFilter:i.isFilter,totalRow:i.totalRow},this.XLClipboard._isCut=!0,e[i.tableId].header?this.XLFormat.createTable(r[i.tableId],i.afterRange):this.XLFormat.createTable(r[i.tableId],[i.afterRange[0],i.afterRange[1],i.afterRange[2]-1,i.afterRange[3]]),this.XLFilter._extendFilterRange(i.tableId,i.afterRange),i.totalRow&&(this.XLFormat._calculateTotalRow(u,i.tableId,!0),i.afterRange=r[i.tableId].range),this.XLClipboard._isCut=!1,this._isFATResize=!1;break;case"renaming":this.XLRibbon.removeNamedRange(r[i.tableId].name);document.getElementById(this._id+"_Ribbon_Design_Properties_TableName")&&(document.getElementById(this._id+"_Ribbon_Design_Properties_TableName").value=r[i.tableId].name=this._isUndo?i.prevName:i.newName);this.XLRibbon.addNamedRange(r[i.tableId].name,i.range,null,u);nt.showTab(this._getLocStr("Design"));break;default:if(this._isUndo){if(l=r[i.tableID].name,this.XLFormat.removeTable(i.tableID),this.XLFormat.removeStyle(i.afterRange),i.tableStyle.header)for(o=0,k=i.beforeRangeHeader.length;o<k;o++)t.isNullOrUndefined(i.beforeRangeHeader[o].value2)?this.XLEdit._updateCellValue(this._getCellIdx(i.pcells[o]),""):this.isNumber(i.pcells[o].innerHTML)&&this.XLEdit._refreshCellAlignment({cellIdx:this._getCellIdx(i.pcells[o])});else h=i.afterRange[3]-i.afterRange[1]+1,this.clearRangeData(i.afterRange),this.updateData(n.extend(!0,[],i.beforeRangeData),i.afterRange);if(this.XLFormat.updateFormat(i.beforeFormat,i.afterRange),y=i.beforeMergeRange,p=y.length,p)while(f<p)v=y[f].value,v&&(c=this.getRangeIndices(v.mRange),selCell=this._getSelectedRange({rowIndex:c[0],colIndex:c[1]},{rowIndex:c[2],colIndex:c[3]}),this.mergeCenter=v.isCenterAlign,this._mergeCells(i.sheetIndex,selCell,{},[])),f++}else this.XLFormat.createTable(i.tableStyle,i.beforeRange)}},_autosumFormatUpdate:function(n,t,i,r){var f={},u,e=this.getActiveSheetIndex();n.type!=="general"&&(this._dupDetails=!0,f.type=n.type,u=i?this._getAlphaRange(e,t[2]+1,t[3],t[2]+1,t[3]):this._getAlphaRange(e,t[0],t[1],t[2],t[3]),r?this.XLFormat.format({type:"general"},u+":"+u):this.XLFormat.format(f,u+":"+u),this._dupDetails=!1)},_undoForHyperlink:function(n){var t,i,r={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},u={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},f,e,o;for(this.setActiveCell(n.selectedCell[0].rowIndex,n.selectedCell[0].colIndex),this.XLSelection.selectRange(u,r),n.action==="add"?this._removeHyperlink(n.reqType,n.selectedCell):n.action==="edit"?this._setLink(n.selectedCell):this._setLink(n.selectedCell),t=0,i=n.selectedCell.length;t<i;t++)f=n.selectedCell[t].prevLink,n.selectedCell[t].prevLink=n.selectedCell[t].curLink,n.selectedCell[t].curLink=f,e=n.selectedCell[t].prevText,n.selectedCell[t].prevText=n.selectedCell[t].curText,n.selectedCell[t].curText=e,o=n.selectedCell[t].prevColor,n.selectedCell[t].prevColor=n.selectedCell[t].curColor,n.selectedCell[t].curColor=o;n.action==="add"?n.action="delete":n.action==="delete"&&(n.action="add");this.XLSelection.selectRange(u,r);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForIns:function(t){n.extend(!0,this._delCells,t.delCells);n.extend(!0,this._deletedText,t.text);n.extend(!0,this._removeMergeColl,t.removeMerge);switch(t.action){case"insertShiftRight":this.insertShiftRight(t.startCell,t.endCell);break;case"insertShiftBottom":this.insertShiftBottom(t.startCell,t.endCell);break;case"insertRow":this.insertEntireRow(t.startCell.rowIndex,t.endCell.rowIndex);break;case"insertColumn":this.insertEntireColumn(t.startCell.colIndex,t.endCell.colIndex)}},_undoForMerge:function(n){var r,u,s,e,f,h,i,o;this._delCells=n.hideCells;this._selMergeCells=[];switch(n.action){case"merge-all":case"merge-across":case"un-merge":for(i=0,o=n.mCells.length;i<o;i++)e=t.isNullOrUndefined(n.mCells[i].prevObj)?{}:t.isNullOrUndefined(n.mCells[i].prevObj.merge)?{}:n.mCells[i].prevObj.merge,f=t.isNullOrUndefined(n.mCells[i].curObj)?{}:t.isNullOrUndefined(n.mCells[i].curObj.merge)?{}:n.mCells[i].curObj.merge,n.action==="un-merge"?t.isNullOrUndefined(e.mRange)||(r=this.getRangeIndices(e.mRange),u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]}),this.mergeCenter=e.isCenterAlign,this._mergeCells(n.sheetIndex,u,{},[])):(s=this._getHiddenRowColumnCount(n.sheetIndex,f.mRange),this._unMergeAllCells(n.sheetIndex,i,n.mCells,[],s.hRow,s.hCol)),h=n.mCells[i].prevObj,n.mCells[i].prevObj=n.mCells[i].curObj,n.mCells[i].curObj=h;if(n.action!=="un-merge")for(i=0,o=n.mCells.length;i<o;i++)e=t.isNullOrUndefined(n.mCells[i].prevObj)?{}:t.isNullOrUndefined(n.mCells[i].prevObj.merge)?{}:n.mCells[i].prevObj.merge,f=t.isNullOrUndefined(n.mCells[i].curObj)?{}:t.isNullOrUndefined(n.mCells[i].curObj.merge)?{}:n.mCells[i].curObj.merge,t.isNullOrUndefined(f.mRange)||(r=this.getRangeIndices(f.mRange),u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]}),this.mergeCenter=f.isCenterAlign,this._mergeCells(n.sheetIndex,u,{},[]));n.action=n.action==="un-merge"?"merge-all":"un-merge"}r=this._getSelectedCells(n.sheetIndex,n.range).range;u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]});this.performSelection(u[0],u[u.length-1]);this._delCells=[]},_undoForReOrder:function(i){var r=this.getSheet(i.sheetIndex),u=this.getSheet(i.sheetIndex).tableManager;this._isUndo?(this.XLComment&&this.XLComment.deleteComment(),this.clearRangeData(i.destinationRange),this.XLFormat.removeStyle(i.destinationRange),this.XLCFormat.clearCF(i.destinationRange),this.isUndefined(i.tblObj)||(this.XLFormat.removeTable(i.tblObj.tblId),this.XLClipboard._isCut=!0,this.XLFormat.createTable(i.tblObj,i.sourceRange),i.tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,i.tblObj.tblId,i.tblObj.fnNumber,i.sourceRange,!1),this.XLClipboard._isCut=!1),this.updateData(n.extend(!0,[],i.sourceData),i.sourceRange),this.updateData(n.extend(!0,[],i.destinationData),i.destinationRange),i.tRange&&(this._dupDetails=!0,this.XLFilter.clearFilter("remove"),this.XLFilter.filter(i.tRange),this._dupDetails=!1),this.XLFormat.updateFormat(i.sourceFormat,i.sourceRange),this.XLFormat.updateFormat(i.destinationFormat,i.destinationRange),this.isUndefined(i.sourceCFormat)||i.sourceCFormat instanceof Array||this.XLCFormat.setCFRule(i.sourceCFormat),this.setActiveCell(i.sourceRange[0],i.sourceRange[1]),this.XLSelection.selectRange({rowIndex:i.sourceRange[0],colIndex:i.sourceRange[1]},{rowIndex:i.sourceRange[2],colIndex:i.sourceRange[3]},i.sheetIndex),r._startCell={rowIndex:i.sourceRange[0],colIndex:i.sourceRange[1]},r._endCell={rowIndex:i.sourceRange[2],colIndex:i.sourceRange[3]},this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this.setHeightToRows(i.prevDestRowHt)):(this.XLSelection.selectRange({rowIndex:i.sourceRange[0],colIndex:i.sourceRange[1]},{rowIndex:i.sourceRange[2],colIndex:i.sourceRange[3]},i.sheetIndex),this.XLComment&&this.XLComment.deleteComment(),this.clearRangeData(i.sourceRange),this.clearRangeData(i.destinationRange),t.isNullOrUndefined(this.XLEdit.getPropertyValue(i.destinationRange[0],i.destinationRange[1],"tableName"))&&this.XLFormat.removeStyle(i.destinationRange),this.isUndefined(i.tblObj)||(this.XLFormat.removeTable(i.tblObj.tblId),this.XLClipboard._isCut=!0,this.XLFormat.createTable(i.tblObj,i.destinationRange),this.XLClipboard._isCut=!1),t.isNullOrUndefined(this.XLEdit.getPropertyValue(i.sourceRange[0],i.sourceRange[1],"tableName"))&&this.XLFormat.removeStyle(i.sourceRange),this.XLCFormat.clearCF(i.sourceRange),this.updateData(n.extend(!0,[],i.sourceData),i.destinationRange),i.tRange&&(this._dupDetails=!0,this.XLFilter.clearFilter("remove"),this.XLFilter.filter(i.destinationRange),this._dupDetails=!1),this.XLFormat.updateFormat(i.sourceFormat,i.destinationRange),i.tblObj&&i.tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,i.tblObj.tblId,i.tblObj.fnNumber,i.destinationRange,!1),this.isUndefined(i.destinationCFormat)||i.destinationCFormat instanceof Array||this.XLCFormat.setCFRule(i.destinationCFormat),this.setHeightToRows(i.destHeight),this.setActiveCell(i.destinationRange[0],i.destinationRange[1]),this.XLSelection.selectRange({rowIndex:i.destinationRange[0],colIndex:i.destinationRange[1]},{rowIndex:i.destinationRange[2],colIndex:i.destinationRange[3]},i.sheetIndex),r._startCell={rowIndex:i.destinationRange[0],colIndex:i.destinationRange[1]},r._endCell={rowIndex:i.destinationRange[2],colIndex:i.destinationRange[3]},this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())},_undoForPivot:function(n){var t=this._isUndo?this._undoCollection:this._redoCollection,i={curOperation:n,prevOperation:t[t.length-1],isUndo:this._isUndo};this._trigger("_readUndoRedo",i)},_undoForResizeCol:function(n){this.XLResize._resizeColumnUsingDiff(n.oldWidth,n.newWidth,n.cols);var t=n.oldWidth;n.oldWidth=n.newWidth;n.newWidth=t;this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForResizeRow:function(n){this.XLResize._resizeRowUsingDiff(n.oldHeight,n.newHeight,n.rows);var t=n.oldHeight;n.oldHeight=n.newHeight;n.newHeight=t;this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForResizeFHeight:function(n){var t=this._isUndo,i=n.newHeight;n.newHeight=n.oldHeight;n.oldHeight=i;this.XLResize.setRowHeight(n.rowIndex,n.newHeight);this._isUndo?this.XLEdit._clearDataContainer({sheetIdx:n.sheetIndex,cellIdx:{rowIndex:n.rowIndex,colIndex:0},property:["isFitHeight"]}):this.XLEdit._updateDataContainer({rowIndex:n.rowIndex,colIndex:0},{dataObj:{isFitHeight:!0}});this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this._isUndo=t},_undoForResizeFWidth:function(n){var t=this.getCell(0,n.colIndex).get(0),i=this._isUndo,r=n.newWidth;n.newWidth=t.offsetWidth===n.oldWidth?n.newWidth:n.oldWidth;n.oldWidth=r;this.XLResize._applyWidth(n.target,n.sheetIndex,n.colIndex,n.newWidth);this.XLScroll._getColWidths(n.sheetIndex,n.colIndex);this._isUndo?this.XLEdit._clearDataContainer({sheetIdx:n.sheetIndex,cellIdx:{rowIndex:0,colIndex:n.colIndex},property:["isFitWidth"]}):this.XLEdit._updateDataContainer({rowIndex:0,colIndex:n.colIndex},{dataObj:{isFitWidth:!0}});this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this._isUndo=i},_undoForShape:function(i){var u,r,v,b,nt=0,k,ot=this.getSheet(i.sheetIndex).shapeMngr,y,p,l,rt,c,ut,w,ft,g,h,e,s,a,et;this.model.showRibbon&&(k=this.XLRibbon._chartThemes);i.action!="chartType"&&i.action!=="create"&&i.action!=="remove"&&i.action!=="edit"&&i.action!=="border"&&i.action!=="resetpicture"&&i.action!=="changepicture"&&i.action!=="picturesize"&&i.action!=="chartTheme"&&i.action!=="chartType"&&i.action!=="selectData"&&(u=n("#"+i.cid).data("ejChart"),r=this.getSheet(i.sheetIndex).shapeMngr.chart[this.XLEdit.getPropertyValue(i.rowIndex,i.colIndex,"chart")[0]]);switch(i.action){case"remove":this.XLShape._picCellIdx=this.XLShape._getCellIndexFromOffset(i.position.top,i.position.left);this.XLShape._deleteShape(i.sheetIndex,n("#"+i.id));i.action="create";break;case"create":i.shapeType==="picture"?(this.XLShape._createPicture(i.sheetIndex,i.actCell,i.img,i.position.top,i.position.left,i.position.width,i.position.height,i.cnt,i.bcolor,i.bstyle,i.bwidth),this.XLRibbon._formatTabUpdate(),n(i.actCell).addClass("e-activecell")):(this.XLSelection.selectRange({rowIndex:i.range[0],colIndex:i.range[1]},{rowIndex:i.range[0],colIndex:i.range[1]},i.sheetIndex),this.setActiveCell(i.range[0],i.range[1],i.sheetIndex),this.XLChart.createChart(this._getAlphaRange(i.sheetIndex,i.range[0],i.range[1],i.range[2],i.range[3]),i.options,i.id));i.action="remove";break;case"edit":var tt,h=this._dataContainer.sheets[i.sheetIndex],o=i.id.split("_")[1].replace(/[0-9]/g,""),d={},it,f;n("#"+i.id).css({left:i.prev.left,top:i.prev.top,height:i.prev.height,width:i.prev.width});o==="chart"&&this.XLChart.resizeChart(i.id,i.prev.height,i.prev.width);i.visualImg.hide();this.XLShape._picCellIdx=this.XLShape._getCellIndexFromOffset(i.prev.top,i.prev.left);f=this.XLShape._getCellIndexFromOffset(i.cur.top,i.cur.left);tt=this._getShapePositionInManager(f.rowIndex,f.colIndex,i.id,o);d[o]=i.obj[o][tt];i.actionType!="resize"&&(this.getObjectLength(h[f.rowIndex][f.colIndex])<2&&h[f.rowIndex][f.colIndex][o].length<2?delete h[f.rowIndex][f.colIndex]:h[f.rowIndex][f.colIndex][o].length<2?delete h[f.rowIndex][f.colIndex][o]:(h[f.rowIndex][f.colIndex][o].some(function(n,t){if(d.id===n.id)return it=t,!0}),h[f.rowIndex][f.colIndex][o].splice(it,1)));this.XLEdit._updateDataContainer({rowIndex:this.XLShape._picCellIdx.rowIndex,colIndex:this.XLShape._picCellIdx.colIndex},{dataObj:d});this.getCell(this.XLShape._picCellIdx.rowIndex,this.XLShape._picCellIdx.colIndex,i.sheetIndex).addClass("e-activecell");this.model.showRibbon&&this.element.find(".e-ss-activeimg").length<1&&(o==="picture"?this.XLRibbon._toggleFormatTab():this.XLRibbon._toggleChartDesignTab());this.XLRibbon._setShapeWidthHeight({width:i.prev.width,height:i.prev.height,shapeType:o});this._swapVal(i);break;case"PHAxis":case"PVAxis":y=i.action=="PHAxis"?"primaryXAxis":"primaryYAxis";p=i.action==="PHAxis"?"xAxis":"yAxis";i.visibility=!i.visibility;u.option(y,{visible:i.visibility});r[p].visible=i.visibility;break;case"PX":case"PY":y=i.action=="PX"?"primaryXAxis":"primaryYAxis";p=i.action==="PX"?"xAxis":"yAxis";t.isNullOrUndefined(i.prev.text)&&(i.prev.text="");u.option(y,{title:{text:i.prev.text}});r[p].title.text=i.prev.text;this._swapVal(i);break;case"CT":u.option("title",{textAlignment:i.prev.align,text:i.prev.text});r.title={text:i.prev.text,textAlignment:i.prev.align};this._swapVal(i);break;case"DLNone":u.option({series:i.prev.series});r.dataLabel={visible:i.prev.series[0].marker.dataLabel.visible};this._swapVal(i);break;case"DL":u.option({series:i.prev.series});r.dataLabel={visible:i.prev.series[0].marker.dataLabel.visible,vAlign:i.prev.series[0].marker.dataLabel.verticalTextAlignment,tPosn:i.prev.series[0].marker.dataLabel.textPosition};this._swapVal(i);break;case"PMajorH":i.visibility=!i.visibility;u.option("primaryYAxis",{majorGridLines:{visible:i.visibility}});r.yAxis.majorGridLines={visible:i.visibility};break;case"PMajorV":i.visibility=!i.visibility;u.option("primaryXAxis",{majorGridLines:{visible:i.visibility}});r.xAxis.majorGridLines={visible:i.visibility};break;case"PMinorH":i.visibility=!i.visibility;u.option("primaryYAxis",{minorGridLines:{visible:i.visibility},minorTicksPerInterval:5,minorTickLines:{visible:i.visibility}});r.yAxis.minorGridLines={visible:i.visibility};break;case"PMinorV":i.visibility=!i.visibility;u.option("primaryXAxis",{minorGridLines:{visible:i.visibility},minorTicksPerInterval:5,minorTickLines:{visible:i.visibility}});r.xAxis.minorGridLines={visible:i.visibility};break;case"LNone":i.visibility=!i.visibility;u.option("legend",{visible:i.visibility});r.legend.visible=i.visibility;break;case"Legend":u.option("legend",{position:i.prev.position});r.legend.position=i.prev.position;this._swapVal(i);break;case"width":s={width:i.prev.width,height:i.prev.height,shapeType:"chart"};l=n("#"+u._id);u.option("size",n.extend(!0,{},s));l[0].style.height=i.prev.height+"px";l[0].style.width=i.prev.width+"px";r.width=i.prev.width;r.height=i.prev.height;this.XLRibbon._setShapeWidthHeight(s);this._swapVal(i);break;case"height":s={width:i.prev.width,height:i.prev.height,shapeType:"chart"};l=n("#"+u._id);u.option("size",n.extend(!0,{},s));l[0].style.height=i.prev.height+"px";l[0].style.width=i.prev.width+"px";r.width=i.prev.width;r.height=i.prev.Height;this.XLRibbon._setShapeWidthHeight(s);this._swapVal(i);break;case"srcolumn":u.model.series.length=0;r.isRowColSwitched=!r.isRowColSwitched;rt={xRange:r.xRange,yRange:r.yRange,lRange:r.lRange,isRowColSwitched:r.isRowColSwitched,dataSheetIdx:r.dataSheetIdx};c=this.XLChart._processChartSeries(rt);u.option({series:c.series});this.getActiveSheetIndex()===r.dataSheetIdx&&this.XLChart._focusChartRange(c.xRange,c.yRange,c.lRange);r.xAxis.range=c.xRange;r.yAxis.range=c.yRange;r.legend.range=c.lRange;break;case"border":ft=this._dataContainer.sheets[i.sheetIndex][i.cellIdx.rowIndex][i.cellIdx.colIndex].picture[i.picIdx];e=n("#"+i.id);this._removeClass(e[0],i.curClass);this.addClass(e[0],i.prevClass);w=this.XLShape._getImgStyleFromHashCode(i.prevClass);ft={bcolor:w["border-color"],bstyle:w["border-style"],bwidth:w["border-width"]};ut=i.prevClass;i.prevClass=i.curClass;i.curClass=ut;break;case"resetpicture":e=n("#"+i.id);g=new RegExp("\\be-shapebdr.*?\\b","g");this._isUndo?e[0].className.match(g)&&this.XLShape.changePictureBorder(e[0].id,i.prev.bwidth,i.prev.bstyle,i.prev.bcolor):e[0].className=e[0].className.replace(g,"");i.actionType!=="resetpicture"&&(e.css({width:i.prev.width,height:i.prev.height}),this.XLShape._selectImg(e),this.XLShape._updateShapeObj(e[0]));this._swapVal(i);break;case"changepicture":h=this._dataContainer;n("#"+i.id).css("background-image","url('"+i.prev.img+"')");ot.picture[i.prev.pcIdx].data=i.prev.data;this._swapVal(i);break;case"picturesize":e=n("#"+i.id);s={width:i.prev.width,height:i.prev.height,shapeType:"picture"};e.css(s);this.XLRibbon._setShapeWidthHeight(s);this._swapVal(i);break;case"chartTheme":for(v=this.element.find("#"+this._id+"_chart").val(),b=n("#"+this._id+"_Ribbon_ChartDesign_ChartThemes_ChartThemes").data("ejDropDownList"),i.prev.theme.indexOf("dark")>-1?n("#"+v).addClass("e-ss-charttheme"):n("#"+v).removeClass("e-ss-charttheme"),this.XLChart.refreshChart(v,{theme:i.prev.theme}),a=0,et=k.length;et>a;a++)if(i.prev.theme===k[a].value.toLowerCase()){nt=a;break}b&&b.option({selectedItemIndex:nt});this._swapVal(i);break;case"chartType":this.XLChart.refreshChart(i.chartId,{type:i.prev.chartType,enable3D:i.prev.enable3D,marker:i.prev.marker});this._swapVal(i);break;case"selectData":this.XLChart.changeDataRange(document.getElementById(this._id+"_chart").value,i.prev.xRange,i.prev.yRange,i.prev.lRange);this._swapVal(i)}},_undoForShowHide:function(n){var t,i,r,u,f,e,o;if(n.operation==="row"){for(r=this._getJSSheetRowHeaderContent(n.sheetIndex),n.action==="show"?this._hideRow(n.hideRows[0],n.hideRows[n.hideRows.length-1],"isRHide"):this._showRow(n.hideRows[0],n.hideRows[n.hideRows.length-1],"isRHide"),t=0,i=n.remBRows.length;t<i;t++)this.addClass(r.find("td")[n.remBRows[t]],"e-hrow"),this.XLEdit._updateDataContainer({rowIndex:n.remBRows[t],colIndex:0},{dataObj:{hRow:!0}});for(t=0,i=n.addBRows.length;t<i;t++)this._removeClass(r.find("td")[n.addBRows[t]],"e-hrow"),this._dataContainer.sheets[n.sheetIndex][n.addBRows[t]][0].hRow;this.setActiveCell(n.bSelect.startRow,0);n.bSelect.startRow===n.bSelect.endRow?this.XLSelection.selectRow(n.bSelect.startRow,n.sheetIndex):this.XLSelection.selectRows(n.bSelect.startRow,n.bSelect.endRow,n.sheetIndex);f=n.addBRows;n.addBRows=n.remBRows;n.remBRows=f}else{for(u=this._getJSSheetHeader(n.sheetIndex).find("th"),n.action==="show"?this._hideColumn(n.hideCols[0],n.hideCols[n.hideCols.length-1]):this._showColumn(n.hideCols[0],n.hideCols[n.hideCols.length-1]),t=0,i=n.remBCols.length;t<i;t++)this.XLEdit._updateDataContainer({rowIndex:0,colIndex:n.remBCols[t]},{dataObj:{hCol:!0}}),this.addClass(u[n.remBCols[t]],"e-hcol");for(t=0,i=n.addBCols.length;t<i;t++)this._removeClass(u[n.addBCols[t]],"e-hcol"),this._dataContainer.sheets[n.sheetIndex][0][n.addBCols[t]].hCol;this.setActiveCell(0,n.bSelect.startCol);n.bSelect.startCol===n.bSelect.endCol?this.XLSelection.selectColumn(n.bSelect.startCol,n.sheetIndex):this.XLSelection.selectColumns(n.bSelect.startCol,n.bSelect.endCol,n.sheetIndex);e=n.addBCols;n.addBCols=n.remBCols;n.remBCols=e}n.action=n.action==="show"?"hide":"show";o=n.bSelect;n.bSelect=n.aSelect;n.aSelect=o;this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForSort:function(n){var o=this.XLEdit.getColumnIndexByField(n.columnName),u,i,r,f,e=this.getSheet(n.sheetIndex)._filterColl,t;if(n.colSelected<1&&(f=n.range[0],n.range[0]>0&&(f=n.range[0]-1)),n.operation==="unsort"?(this._dupDetails=!0,this.XLComment.deleteComment(n.range,null,!0,null),this._removeHyperlink(null,null,!0,n.range),this.clearRangeData(n.range,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0),this.XLFormat.removeStyle(n.range,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0}),this.XLEdit.updateCellWithContainer(n.rangeData,n.range,n.sheetIndex,!0),this.XLSort._refreshRowHeight(n.range,n.rangeData),this._dupDetails=!1,n.operation="sort"):(this.XLSort._isSortByFilter=n.isSortByFilter,this.XLSort.sortByRange(n.range,n.columnName,n.direction),n.operation="unsort"),n.isSortByFilter)for(t=0;t<n.filterIcons.length;t++)r=e[n.filterIcons[t].rowIdx][n.filterIcons[t].colIdx],r.status=r.status.indexOf("-asc")>1?r.status.replace("-asc",n.filterIcons[t].prevIcon):r.status.indexOf("-dsc")>1?r.status.replace("-dsc",n.filterIcons[t].prevIcon):r.status+n.filterIcons[t].prevIcon,this._isRowViewable(n.sheetIndex,n.filterIcons[t].rowIdx)&&(i=this.getCell(n.filterIcons[t].rowIdx,n.filterIcons[t].colIdx).find(".e-filterspan")[0],i.className=i.className.indexOf("-asc")>1?i.className.replace("-asc",n.filterIcons[t].prevIcon):i.className.indexOf("-dsc")>1?i.className.replace("-dsc",n.filterIcons[t].prevIcon):i.className.indexOf("e-ssfiltered")>-1?i.className.replace("e-ssfiltered","e-ssfiltered"+n.filterIcons[t].prevIcon):i.className.replace("e-ssfilter","e-ssfilter"+n.filterIcons[t].prevIcon)),u=n.filterIcons[t].prevIcon,n.filterIcons[t].prevIcon=n.filterIcons[t].currIcon,n.filterIcons[t].currIcon=u},_undoForSortByColor:function(n){var t=n.range,r=n.prev.data,u=this._generateColCount(n.columnName)-1,i;this.XLComment.deleteComment(t,null,!0,null);this._isSort=!0;this._dupDetails=!0;this._removeHyperlink(null,null,!0,t);this._isSort=!1;this._dupDetails=!1;this.clearRangeData(t,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0);this.XLFormat.removeStyle(t,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0});this.XLEdit.updateCellWithContainer(r,t,n.sheetIndex,!0);n.oprType.indexOf("Put")<0&&(i=this.getCell(t[0]-1,u).find(".e-filterspan"),i.length>0&&(i[0].className=i[0].className.replace(n.cur.icon,n.prev.icon)));this._swapVal(n)},_undoForStyle:function(n){this.XLFormat.updateUniqueFormat(n.beforeFormat,n.range,n.opr);this._updateRangeStyle(n.range,n.beforeFormat);var t=this.changePosition(n.beforeFormat,n.afterFormat);this._refreshRangeTRHght(this.getActiveSheetIndex(),n.range);n.beforeFormat=t[1];n.afterFormat=t[0];this._isUndoRedo=!0;n.status="undo-cellstyles"},_undoForTextWrap:function(n){n.operation==="wrap"?(this.setWrapText("unwrap",n.range),n.operation="unwrap"):(this.setWrapText("wrap",n.range),n.operation="wrap");this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForValidation:function(n){var i,f,e=this.getRangeIndices(n.range),r,u,s,o;if(this.performSelection({rowIndex:e[0],colIndex:e[1]},{rowIndex:e[2],colIndex:e[3]}),n.operation==="cl-hl-data")this.XLValidate.highlightInvalidData(n.range),n.operation="hl-data";else if(n.operation==="apply-validation"){for(r=n.selectedCell,o=[],i=0,f=r.length;i<f;i++)s=this.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"rule"),u=this.changePosition(r[i].prevRule,s),n.selectedCell[i].prevRule=u[1],t.isNullOrUndefined(u[0])||(u[0].customVal=u[0].customVal,this.XLEdit._updateDataContainer({rowIndex:r[i].rowIndex,colIndex:r[i].colIndex},{dataObj:{rule:u[0]}})),o.push(r[i]);t.isNullOrUndefined(u[0])&&this.clearRangeData(null,["rule"],o)}else if(n.operation==="hl-data")this.XLValidate.clearHighlightedValData(n.range),n.operation="cl-hl-data";else if(this._isUndo){for(i=0,f=n.selectedCell.length;i<f;i++)this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},{dataObj:{rule:n.selectedCell[i].rules}});n.hlStatus&&this.XLValidate.highlightInvalidData(n.range)}else this.XLValidate.clearDV(n.range)},_applyCommentLink:function(i,r,u,f){var a=this._dataContainer,w=a.cFormatData,e,c=!1,l=this.getActiveSheetIndex(),v,y,o,h,p,s;if(this._isRowViewable(l,r.rowIndex)&&(e=this.getCell(r.rowIndex,r.colIndex),c=!0,n(e).removeClass("e-redft e-yellowft e-greenft e-redf e-redt")),i){if(v=this.isNumber(i.value2)?a.sharedData[i.value2]:i.value2,i=n.extend(!0,{},i),this.XLEdit._updateCellValue(r,v),"cFormatRule"in i)for(y=i.cFormatRule,h=0,p=y.length;h<p;h++)o=w[h].split("_"),this.XLCFormat._cFormat(o[0],o[2],o[3],o[4],null,null,[u,f,u,f]);"hyperlink"in i&&(s=i.hyperlink,c&&(s&&!s.webAddr?e.html(t.buildTag("a.e-hyperlinks",this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2",l),"")):e.html(t.buildTag("a.e-hyperlinks",this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2",l),"",{href:s.webAddr,target:"_blank"}))));"comment"in i&&(c&&e.removeClass("e-commentcell"),this.XLComment.setComment([r.rowIndex,r.colIndex,r.rowIndex,r.colIndex],null,!1))}},changePosition:function(n,i){var r=[];return r.push(i),r.push(n),t.swap(r,0,1),r},_addValidationRule:function(t,i){var u=[],r,f;for(n.extend(!0,u,t),r=0,f=t.length;r<f;r++)t[r].customVal!==i.customVal&&t[r].required!==i.required&&t[r].Number!==i.number&&u.push(i);return u},_addCondFormatRule:function(t,i){var f=!1,u=[],r,e;for(n.extend(!0,u,t),r=0,e=t.length;r<e;r++)if(i=i.indexOf("true")>-1?i.replace("_true",""):i.replace("_false",""),t[r]===i){f=!0;break}return f||u.push(i),u},getCellClass:function(n){var t=this._formatRegx;return n&&n.className.indexOf("e-format")>-1?n.className.match(t)[0]:""},_renderInsertDeleteDialog:function(){var n=this._id+"_insertdeletedlg",i,r,u,f,e,o;i=t.buildTag("div#"+n,"",{display:"none"});o=t.buildTag("div#"+n+"_content.e-dlg-fields e-dlgctndiv");i.append(o);f=t.buildTag("div#"+n+"_btndiv.e-dlg-btnfields");e=t.buildTag("div");r=t.buildTag("input#"+n+"_okbtn","",{"margin-left":4});u=t.buildTag("input#"+n+"_cantn");r.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._insertDeleteOk,this),enabled:!0,cssClass:"e-ss-okbtn"});u.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._insertDeleteCancel,this),showRoundedCorner:!0,width:60});f.append(e.append(r,u));i.append(f);i.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,width:"auto",height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg e-ss-insdeldlg",minWidth:150})},_refreshInsDelDialog:function(t){var i=n("#"+this._id+"_insertdeletedlg"),r,u;i.ejDialog({title:this._getLocStr(t)});i.ejDialog("open");this._insDelStatus=t.toLowerCase();r=n("#"+i[0].id+"_content");u=this._insDelStatus==="insert"?["ShiftRight","ShiftBottom","EntireRow","EntireColumn"]:["ShiftLeft","ShiftUp","EntireRow","EntireColumn"];r.children().empty();this._createRadioButton(i,r,u);enableBtn=this._insDelStatus==="insert"?"ShiftBottom":"ShiftLeft";n("#"+i[0].id+"_"+enableBtn).ejRadioButton({checked:!0});i.find("input[type='submit']:first").focus()},_createRadioButton:function(n,i,r){var o,h,s,e,u,f,c;for(s=t.buildTag("table"),f=0,c=r.length;f<c;f++)e=t.buildTag("tr"),u=t.buildTag("td"),h=t.buildTag("label",this._getLocStr(r[f]),{"padding-bottom":4},{"for":n[0].id+"_"+r[f]}),o=t.buildTag("input#"+n[0].id+"_"+r[f],"",{},{type:"radio",name:"inserdelete"}),u.append(o),e.append(u),u=t.buildTag("td"),u.append(h),o.ejRadioButton({size:"medium"}),e.append(u),s.append(e);i.append(s)},_getSelectedOption:function(t){for(var u,f=this._id+"_insertdeletedlg",r=0,i=0;i<4;i++)if(u=n("#"+f+"_"+t[i]).data("ejRadioButton"),u.model.checked){r=i;break}return r},_insertDeleteOk:function(){var o,f;this._isUndo=!1;this._isUndoRedo=!1;this._delCells=[];this._deletedText=[];this._removeMergeColl=[];this._deletedDimension=[];var t,i,e=this.getActiveSheetIndex(),r=this.model.sheets[e]._selectedCells[0],u=this.model.sheets[e]._selectedCells[this.model.sheets[e]._selectedCells.length-1];for(this._insDelStatus.indexOf("insert")>-1?(t=["ShiftRight","ShiftBottom","EntireRow","EntireColumn"],i=this._getSelectedOption(t),t[i].indexOf("ShiftRight")>-1?this.insertShiftRight(r,u):t[i].indexOf("ShiftBottom")>-1?this.insertShiftBottom(r,u):t[i].indexOf("EntireRow")>-1?this.insertEntireRow(r.rowIndex,u.rowIndex):this.insertEntireColumn(r.colIndex,u.colIndex)):(t=["ShiftLeft","ShiftUp","EntireRow","EntireColumn"],i=this._getSelectedOption(t),t[i].indexOf("ShiftLeft")>-1?this.deleteShiftLeft(r,u):t[i].indexOf("ShiftUp")>-1?this.deleteShiftUp(r,u):t[i].indexOf("EntireRow")>-1?this.deleteEntireRow(r.rowIndex,u.rowIndex):this.deleteEntireColumn(r.colIndex,u.colIndex)),n("#"+this._id+"_insertdeletedlg").ejDialog("close"),o=this.model.sheets[this.model.activeSheetIndex].shapeMngr.chart,f=0;f<o.length;f++)this.XLChart._refreshChart(o[f])},_insertDeleteCancel:function(){n("#"+this._id+"_insertdeletedlg").ejDialog("close")},_undoredoDetails:function(t,i,r,u,f){var e={sheetIndex:t,startCell:i,endCell:r,reqType:u,action:f,delCells:n.extend(!0,[],this._delCells),text:this._deletedText,deletedDimension:this._deletedDimension,removeMerge:this._removeMergeColl,fRow:n.extend(!0,{},this._fRow),fCol:n.extend(!0,{},this._fCol)};this.isImport||this._isExport||this._intrnlReq||(this._completeAction(e),this._trigActionComplete(e));this._removeMergeColl=[];this._delCells=[];this._fRow.fRowCnt=0;this._fCol.fColCnt=0;this._fRow.rowAdj=!0;this._fCol.colAdj=!0},_getRangeFrmFormula:function(n){var t=n.substring(n.indexOf("(")+1,n.indexOf(")")),i=new RegExp("^\\b[a-zA-Z][0-9]*:[a-zA-Z][0-9]*\\b$","g");if(i.test(t))return t;if(t.indexOf(",")>1){if(i.test(t.split(",")[1]))return t.split(",")[1];if(i.test(t.replace(",",":")))return t.replace(",",":")}},_refreshFormula:function(n,i,r,u,f,e,o){var y=this.getActiveSheetIndex(),c,h,a=this.XLEdit.getPropertyValue(n,i,"value"),l,v,s,p,w=this.getSheet(y);if((!this._isUndo||this._formulaChanged.pop()!=="true")&&this.isFormula(a)){if(l=this._getRangeFrmFormula(a),t.isNullOrUndefined(l))return;s=this.getRangeIndices(l);c=f==="column"?u==="insert"?s[3]+r:s[3]-r:u==="insert"?s[2]+r:s[2]-r;h=f==="column"?u==="insert"?s[1]+r:s[1]-r:u==="insert"?s[0]+r:s[0]-r;f==="column"?e>s[1]&&(h=s[1]):e>s[0]&&(h=s[0]);f==="column"?e>s[3]&&(c=s[3]):e>s[2]&&(c=s[2]);o&&(s[1]===s[3]||s[0]!==s[2]||(f==="column"?s[1]===s[3]&&(c=s[3],h=s[1]):s[0]===s[2]&&(c=s[2],h=s[0])),f==="column"?c<s[1]&&(c=s[3]):c<s[0]&&(c=s[2]),f==="column"?h<s[1]&&(h=s[1]):h<s[0]&&(h=s[0]),f==="row"&&(u==="delete"?h<s[2]&&s[1]!=i&&(c=s[2],h=s[0]):s[1]!=i&&(c=s[2],h=s[0])),f==="column"&&(u==="delete"?h<s[3]&&s[0]!=n&&(c=s[3],h=s[1]):s[0]!=n&&(c=s[3],h=s[1])));v=f==="column"?this._getAlphaRange(y,s[0],h,s[2],c):this._getAlphaRange(y,h,s[1],c,s[3]);n===s[0]&&i===s[1]&&(v="#REF!",this._ref.push(l));this._isUndo&&l==="#REF!"&&(v=this._ref.pop());a=a.replace(l,v);p=new ValueChangedArgs(n+1,i+1,a);this._calcEngine.valueChanged(w.sheetInfo.value,p);this.XLEdit._updateDataContainer({rowIndex:n,colIndex:i},{dataObj:{value:a}});this._applyFormula(y,n,i);this._isUndo||(l===v?this._formulaChanged.push("true"):this._formulaChanged.push("false"))}},_applyFormula:function(n,i,r){var u,f=this.getSheet(n),e=f._formulaCollection[i];t.isNullOrUndefined(e)&&(f._formulaCollection[i]={});u=this._calcEngine.getFormulaInfoTable().values();f._formulaCollection[i][r]=u[u.length-1]},_clearFormula:function(n,t){var u,f,i,e=this.getActiveSheetIndex(),s=this.XLEdit.getPropertyValue(n,t,"value"),r,o;if(this.isFormula(s)){for(u=this.model.sheets[e]._formulaCollection[n][t],i=this._calcEngine.getFormulaInfoTable().values(),f=i.indexOf(u),i.splice(f,1),this._calcEngine.getFormulaInfoTable().clear(),r=0,o=i.length;r<o;r++)this._calcEngine.getFormulaInfoTable().add(i[r]);delete this.model.sheets[e]._formulaCollection[n][t]}},_refreshValAndCF:function(n,t,i,r,u,f,e){var p=this.getActiveSheetIndex(),a=this._dataContainer.sheets[p],s=this._dataContainer.cFormatData,c,l,v,o,y,h;this.isUndefined(i)&&this.isUndefined(r)?delete a[n][t]:(this.isUndefined(i)||(a[n][t]={rule:i}),this.isUndefined(r)||(cFormatRule=s[r[0]],cFormatRule.indexOf("true")>-1?(h=cFormatRule.replace("true","false"),y=s.indexOf()):(h=cFormatRule.replace("false","true"),y=s.indexOf(h)),l=cFormatRule.split("_")[5],o=this.getRangeIndices(l),e.indexOf("Bottom")>-1||e.indexOf("Row")>-1?o[2]=o[2]+u:o[3]=o[3]+f,v=this._getAlphaRange(p,o[0],o[1],o[2],o[3]),cFormatRule=cFormatRule.replace(l,v),h=h.replace(l,v),s[r[0]]=cFormatRule,s[y]=h,c=cFormatRule.replace("true","false"),s.indexOf(c)<0&&s.push(c),a[n][t]={cFormatRule:[s.indexOf(c)]}))},_refreshRows:function(n){var t=this._getRowHdrTBody(n).find("tr"),i=this._getContTBody(n).find("tr");this.setRows([t,i],n)},_refreshFilterColl:function(t,i,r,u,f){var s=this.getSheet(t),w=s._filterColl,h=this.getObjectKeys(w),c,a,l,v,y,p,e,o;if(u==="row")if(f==="insert")for(e=parseInt(h[h.length-1]);e>=parseInt(h[0]);e--)e=parseInt(e),e>=i&&(s._filterColl[e+r]=n.extend(!0,{},s._filterColl[e]),delete s._filterColl[e]);else for(e=parseInt(h[0]);e<=parseInt(h[h.length-1]);e++)e=parseInt(e),e>=i&&(s._filterColl[e-r]=n.extend(!0,{},s._filterColl[e]),delete s._filterColl[e]);else for(p=this.model.scrollSettings.allowVirtualScrolling,e=parseInt(h[0]);e<=parseInt(h[h.length-1]);e++)if(c=this.getObjectKeys(s._filterColl[e]),f==="insert")for(y=!1,o=parseInt(c[c.length-1]);o>=parseInt(c[0]);o--)(o>=i||y)&&(y=!0,a=s._filterColl[e][o],a.status.indexOf("filtered")>-1&&(l=n.inArray(this._generateHeaderText(o+1),s._filteredColumns),l>-1&&s._filteredColumns.splice(l,1),v=n.inArray(this._generateHeaderText(o+r+1),s._filteredColumns),v<0&&s._filteredColumns.push(this._generateHeaderText(o+r+1))),s._filterColl[e][o+r]=n.extend(!0,{},s._filterColl[e][o]),p?(s._filterColl[e][o].status="e-ssfilter",this.XLEdit._updateDataContainer({rowIndex:e,colIndex:o},{dataObj:{isFilterHeader:!0,filterState:"filter",isFilterVisible:!0},sheetIdx:t})):delete s._filterColl[e][o]);else for(o=parseInt(c[0]);o<=parseInt(c[c.length-1]);o++)o=parseInt(o),o>=i&&(a=s._filterColl[e][o],a.status.indexOf("filtered")>-1&&(l=n.inArray(this._generateHeaderText(o+1),s._filteredColumns),l>-1&&s._filteredColumns.splice(l,1),v=n.inArray(this._generateHeaderText(o-r+1),s._filteredColumns),v<0&&s._filteredColumns.push(this._generateHeaderText(o-r+1))),o-r>=0&&(s._filterColl[e][o-r]=n.extend(!0,{},s._filterColl[e][o])),delete s._filterColl[e][o])},_refreshDataContainer:function(i,u){var p,dt,w,gt,st,ht,e,s,v,ni,ot=0,ui=0,fi,lt,k,d,si,hi,ci=0,li=0,o=this._dataContainer.sheets[i],ei,wt,ai,h,l,a,ct,g,nt,rt,at=this.model.scrollSettings.allowVirtualScrolling,c=this.getSheet(i),bt=c.usedRange,ut=this.getFrozenRows(),ft=this.getFrozenColumns(),it,ti,ii,ri,f,b,pt,oi,tt,kt,et,vt,y,yt;for(lt=parseInt(this.getObjectKeys(o)[this.getObjectLength(o)-1]),y=c.rowsHeightCollection,vt=c.columnsWidthCollection,f=0;f<=lt;f++)t.isNullOrUndefined(o[f])||(fi=this.getObjectKeys(o[f]),ui=parseInt(fi[fi.length-1]),ui>ot&&(ot=ui));if(ai=u.startCol<=ot?u.colCount+u.startCol:ot-1,ei=u.status.indexOf("shift")>-1?ai:ot-1,wt=u.status.indexOf("shift")>-1?u.rowCount+u.startRow:lt,p=u.startRow,dt=u.startRow+u.rowCount-1,w=u.startCol,gt=u.startCol+u.colCount-1,this._isFrozen(ut-1)&&ut>p){for(f=c._frozenRows-1;f<c._ftopRowIdx;f++)ci+=c.rowsHeightCollection[f];this._scrollContent({y:-ci})}if(this._isFrozen(ft-1)&&ft>w){for(f=c._frozenColumns-1;f<c._fleftColIdx;f++)li+=c.columnsWidthCollection[f];this._scrollContent({x:-li})}switch(u.status){case"insertRow":for(f=lt,v=u.startRow;f>=v;f--){if(!t.isNullOrUndefined(o[f])){if(o[f+u.rowCount]=n.extend(!0,{},o[f]),!t.isNullOrUndefined(o[f+u.rowCount]))for(a=this.getObjectKeys(o[f+u.rowCount]),e=0,ni=a.length;e<ni;e++)this._clearFormula(f,a[e]),this._checkIndicesInContainer(i,f,a[e],"wrap")&&(this._wrapCollection(f+u.rowCount,a[e],c._wrapColl[f][a[e]],i),delete c._wrapColl[f][a[e]]),f>=p&&f<=dt?(st=this._checkIndicesInContainer(i,p,a[e],"rule")?this._dataContainer.sheets[i][p][a[e]].rule:r,ht=this._checkIndicesInContainer(i,p,a[e],"cFormatRule")?this._dataContainer.sheets[i][p][a[e]].cFormatRule:r,this._refreshValAndCF(f,a[e],st,ht,u.rowCount,0,u.status),at||p<1||this.addClass(this.getCell(f,a[e])[0],this.XLFormat.getFormatClass(this.getCell(p-1,a[e])[0].className,!1))):delete o[f][a[e]],this._refreshFormula(f+u.rowCount,parseInt(a[e]),u.rowCount,"insert","row",u.startRow,!1),this.XLEdit._refreshCalcEngine(f+u.rowCount,parseInt(a[e]));this.getObjectLength(o[f])<1&&delete o[f]}y[f+u.rowCount]=y[f];y[f]=this.model.rowHeight;c._rowIdxColl[f+u.rowCount]=c._rowIdxColl[f]+u.rowCount}if(this._refreshHideRowColCollection(c.hideRowsCollection,u.startRow,u.rowCount,"row","insert"),this._refreshFilterColl(i,u.startRow,u.rowCount,"row","insert"),this._isUndo&&this._delCells.length>0){for(h=this._delCells,ct=h[h.length-1].row-h[0].row,f=0,v=h.length;f<v;f++){for(o[h[f].row]=h[f].value,a=this.getObjectKeys(o[h[f].row]),e=0,ni=a.length;e<ni;e++)this._refreshFormula(h[f].row,parseInt(a[e]),ct,"insert","row","",!1),this.XLEdit._refreshCalcEngine(h[f].row,parseInt(a[e])),this._checkIndicesInContainer(i,h[f].row,a[e],"wrap")&&this._wrapCollection(h[f].row,a[e],this._delWrapColl[h[f].row][a[e]],i);y[h[f].row]=h[f].height}this._delWrapColl={}}this.model.allowFreezing&&this._isFrozen(ut)&&(p<ut||this._isUndo&&this._fRow.fRowCnt>0)&&(k=c.frozenRows+(this._fRow.fRowCnt>0?this._fRow.fRowCnt:u.rowCount),d=c.frozenColumns,this._fRow.fRowCnt=0,this._fRow.rowAdj||(k-=1,this._fRow.rowAdj=!this._fRow.rowAdj),this._isFrozen(ft)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(k,d)):this.XLFreeze.freezeRows(k));this.XLScroll._getRowHeights(i,u.startRow);break;case"insertColumn":for(ti=!1,f=0;f<=wt;f++)for(e=ot,v=u.startCol;e>=v;e--)g=nt=null,f==0&&(t.isNullOrUndefined(o[0])||t.isNullOrUndefined(o[0][e])||"isCHide"in o[0][e]&&(this._deleteRule(e,i),ti=!0)),t.isNullOrUndefined(o[f])||(t.isNullOrUndefined(o[f][e])||(t.isNullOrUndefined(o[f][e+u.colCount])||(t.isNullOrUndefined(o[f][e+u.colCount].picture)||(g=o[f][e+u.colCount].picture),t.isNullOrUndefined(o[f][e+u.colCount].chart)||(nt=o[f][e+u.colCount].chart)),o[f][e+u.colCount]=o[f][e],t.isNullOrUndefined(o[f][e].picture)&&t.isNullOrUndefined(o[f][e].chart)||(t.isNullOrUndefined(o[f][e].picture)||(g=o[f][e].picture),t.isNullOrUndefined(o[f][e].chart)||(nt=o[f][e].chart)),t.isNullOrUndefined(o[f][e+u.colCount])||(t.isNullOrUndefined(g)||(o[f][e+u.colCount].picture=g),t.isNullOrUndefined(nt)||(o[f][e+u.colCount].chart=nt)),o[f][e].wrap&&(this._wrapCollection(f,e+u.colCount,c._wrapColl[f][e],i),delete c._wrapColl[f][e])),this._clearFormula(f,e),e>=w&&e<=gt?(st=this._checkIndicesInContainer(i,f,w,"rule")?this._dataContainer.sheets[i][f][w].rule:r,ht=this._checkIndicesInContainer(i,f,w,"cFormatRule")?this._dataContainer.sheets[i][f][w].cFormatRule:r,this._refreshValAndCF(f,e,st,ht,0,u.colCount,u.status),at||!w<1&&this.addClass(this.getCell(f,e)[0],this.XLFormat.getFormatClass(this.getCell(f,w-1)[0].className,!1))):delete o[f][e],!t.isNullOrUndefined(o[f][e])||t.isNullOrUndefined(g)&&t.isNullOrUndefined(nt)||(o[f][e]={}),t.isNullOrUndefined(g)||(o[f][e].picture=g),t.isNullOrUndefined(nt)||(o[f][e].chart=nt),this._refreshFormula(f,e+u.colCount,u.colCount,"insert","column",u.startCol,!1),this.XLEdit._refreshCalcEngine(f,e+u.colCount)),f===0&&(ti&&(this._writeRule(e+u.colCount,i),ti=!1),at&&!this._isUndoRedo&&(vt[e+u.colCount]=vt[e],vt[e]=c.columnWidth));if(this._refreshHideRowColCollection(c.hideColsCollection,u.startCol,u.colCount,"column","insert"),this._refreshFilterColl(i,u.startCol,u.colCount,"column","insert"),this.model.allowFreezing&&this._isFrozen(ft)&&(w<ft||this._isUndo&&this._fCol.fColCnt>0)&&(k=c.frozenRows,d=c.frozenColumns+(this._fCol.fColCnt>0?this._fCol.fColCnt:u.colCount),this._fCol.fColCnt=0,this._fCol.colAdj||(d-=1,this._fCol.colAdj=!this._fCol.colAdj),this._isFrozen(ut)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(k,d)):this.XLFreeze.freezeColumns(d)),this._isUndo&&this._delCells.length>0)for(h=this._delCells,ct=h[h.length-1].col-h[0].col,s=0,v=h.length;s<v;s++)t.isNullOrUndefined(o[h[s].row])&&(o[h[s].row]={}),o[h[s].row][h[s].col]=h[s].value,this._refreshFormula(h[s].row,h[s].col,ct,"insert","column","",!1),this.XLEdit._refreshCalcEngine(h[s].row,h[s].col),h[s].value.wrap&&this._wrapCollection(h[s].row,h[s].col,h[s].height,i);break;case"deleteRow":for(this._delCells=[],l=[],f=u.startRow;f<=lt;f++){if(f<u.startRow+u.rowCount){if(this._delCells.push({row:f,value:n.extend(!0,{},o[f]),height:y[f]}),!t.isNullOrUndefined(o[f]))for(a=this.getObjectKeys(o[f]),e=0,v=a.length;e<v;e++)this._clearFormula(f,a[e]),this._checkIndicesInContainer(i,f,a[e],"wrap")&&(this._delWrapColl[f]||(this._delWrapColl[f]={}),this._delWrapColl[f][a[e]]=n.extend(!0,{},c._wrapColl[f][a[e]]),delete c._wrapColl[f][a[e]]),o[f][a[e]]={};o[f]={};l.push({row:f})}if(!t.isNullOrUndefined(o[f+u.rowCount])){for(o[f]=n.extend(!0,{},o[f+u.rowCount]),a=this.getObjectKeys(o[f]),e=0,v=a.length;e<v;e++)this._checkIndicesInContainer(i,f+u.rowCount,a[e],"wrap")&&(this._wrapCollection(f,a[e],c._wrapColl[f+u.rowCount][a[e]],i),delete c._wrapColl[f+u.rowCount][a[e]]),this._clearFormula(f+u.rowCount,a[e]),o[f+u.rowCount][a[e]]={},this._refreshFormula(f,parseInt(a[e]),u.rowCount,"delete","row",u.startRow,!1);o[f+u.rowCount]={};l.push({row:f+u.rowCount})}y[f]=y[f+u.rowCount];y[f+u.rowCount]=this.model.rowHeight;c._rowIdxColl[f]=c._rowIdxColl[f+u.rowCount]-u.rowCount}for(this._refreshHideRowColCollection(c.hideRowsCollection,u.startRow,u.rowCount,"row","delete"),s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row])===0&&(this._clearFormula(l[s].row,l[s].col),delete o[l[s].row]);if(this._refreshFilterColl(i,u.startRow,u.rowCount,"row","delete"),this.XLScroll._getRowHeights(i,u.startRow),this.model.allowFreezing&&this._isFrozen(ut)&&p<ut){if(dt>=ut)for(f=p;f<ut;f++)this._fRow.fRowCnt++;else this._fRow.fRowCnt=0;k=c.frozenRows-(this._fRow.fRowCnt>0?this._fRow.fRowCnt:u.rowCount);si=c.frozenRows-(this._fRow.fRowCnt>0?this._fRow.fRowCnt:u.rowCount)-c._topRow.idx;d=c.frozenColumns;this._fRow.rowAdj=si>1;this._isFrozen(ft)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(this._fRow.rowAdj?k:k+1,d)):this.XLFreeze.freezeRows(this._fRow.rowAdj?k:1)}break;case"deleteColumn":for(this._delCells=[],l=[],ii=!1,ri=n.extend(!0,{},o[0]),f=0;f<=wt;f++){for(e=u.startCol;e<=ot;e++)g=nt=null,f==0&&(t.isNullOrUndefined(ri)||t.isNullOrUndefined(ri[e])||"isCHide"in ri[e]&&(this._deleteRule(e,i),ii=!0)),e<u.startCol+u.colCount&&(t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e])||(this._delCells.push({row:f,col:e,value:n.extend(!0,{},o[f][e],o[f][e].wrap?c._wrapColl[f][e]:y[f])}),this._clearFormula(f,e),o[f][e]={},t.isNullOrUndefined(this._delCells[this._delCells.length-1])||(rt=this._delCells.length-1,t.isNullOrUndefined(this._delCells[rt].value.picture)||(o[f][e].picture=this._delCells[rt].value.picture),t.isNullOrUndefined(this._delCells[rt].value.chart)||(o[f][e].chart=this._delCells[rt].value.chart)),l.push({row:f,col:e}),c._wrapColl[f]&&delete c._wrapColl[f][e])),t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e+u.colCount])||(o[f][e]=n.extend(!0,{},o[f][e+u.colCount]),o[f][e+u.colCount].wrap&&(this._wrapCollection(f,e,c._wrapColl[f][e+u.colCount],i),delete c._wrapColl[f][e+u.colCount]),t.isNullOrUndefined(o[f][e+u.colCount].picture)||(g=o[f][e+u.colCount].picture),t.isNullOrUndefined(o[f][e+u.colCount].chart)||(nt=o[f][e+u.colCount].chart),this._clearFormula(f,e+u.colCount),o[f][e+u.colCount]={},t.isNullOrUndefined(g)||(o[f][e+u.colCount].picture=g),t.isNullOrUndefined(nt)||(o[f][e+u.colCount].chart=nt),t.isNullOrUndefined(this._delCells[this._delCells.length-1])||(rt=this._delCells.length-1,t.isNullOrUndefined(this._delCells[rt].value.picture)||(o[f][e].picture=this._delCells[rt].value.picture),t.isNullOrUndefined(this._delCells[rt].value.chart)||(o[f][e].chart=this._delCells[rt].value.chart)),l.push({row:f,col:e+u.colCount}),this._refreshFormula(f,e,u.colCount,"delete","column",u.startCol,!1),at||this.XLComment&&this.XLComment._updateCmntFrmCntnr(f,e)),f==0&&ii&&(this._writeRule(e-u.colCount,i),ii=!1);for(s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row][l[s].col])===0&&(this._clearFormula(l[s].row,l[s].col),delete o[l[s].row][l[s].col]);l=[]}if(this._refreshHideRowColCollection(c.hideColsCollection,u.startCol,u.colCount,"column","delete"),this.model.allowFreezing&&this._isFrozen(ft)&&w<ft){if(gt>=ft)for(f=w;f<ft;f++)this._fCol.fColCnt++;else this._fCol.fColCnt=0;k=c.frozenRows;d=c.frozenColumns-(this._fCol.fColCnt>0?this._fCol.fColCnt:u.colCount);hi=c.frozenColumns-(this._fCol.fColCnt>0?this._fCol.fColCnt:u.colCount)-c._leftCol.idx;this._fCol.colAdj=hi>1;this._isFrozen(ut)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(k,this._fCol.colAdj?d:d+1)):this.XLFreeze.freezeColumns(this._fCol.colAdj?d:1)}this._refreshFilterColl(i,u.startCol,u.colCount,"column","delete");break;case"shiftRight":for(f=u.startRow;f<wt;f++)for(e=ot,v=u.startCol;e>=v;e--)t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e])||(o[f][e+u.colCount]=n.extend(!0,{},o[f][e]),o[f][e].wrap&&(this._wrapCollection(f,e+u.colCount,c._wrapColl[f][e],i),delete c._wrapColl[f][e]),this._clearFormula(f,e),e>=w&&e<=gt?(this._checkIndicesInContainer(i,f,w,"rule")&&(st=this._dataContainer.sheets[i][f][w].rule),this._checkIndicesInContainer(i,f,w,"cFormatRule")&&(ht=this._dataContainer.sheets[i][f][w].cFormatRule),this._refreshValAndCF(f,e,st,ht,0,u.colCount,u.status),w<1||this.addClass(this.getCell(f,e)[0],this.XLFormat.getFormatClass(this.getCell(f,w-1)[0].className,!1))):delete o[f][e],this._refreshFormula(f,e+u.colCount,u.colCount,"insert","column",u.startCol,!0),this.XLEdit._refreshCalcEngine(f,e+u.colCount),this.XLEdit._refreshCalcEngine(f,e));if(this._isUndo&&this._delCells.length>0)for(h=this._delCells,ct=h[h.length-1].col-h[0].col,s=0,v=h.length;s<v;s++)o[h[s].row][h[s].col]=h[s].value,this._refreshFormula(h[s].row,h[s].col,ct,"insert","column",u.startRow,!1),this.XLEdit._refreshCalcEngine(h[s].row,h[s].col),at||this.XLComment&&this.XLComment._updateCmntFrmCntnr(h[s].row,h[s].col),h[s].value.wrap&&this._wrapCollection(h[s].row,h[s].col,h[s].height,i);break;case"shiftLeft":for(this._delCells=[],l=[],f=u.startRow;f<wt;f++){for(e=u.startCol;e<=ot;e++)e<u.startCol+u.colCount&&!t.isNullOrUndefined(o[f])&&(t.isNullOrUndefined(o[f][e])||(this._delCells.push({row:f,col:e,value:n.extend(!0,{},o[f][e]),height:o[f][e].wrap?c._wrapColl[f][e]:y[f]}),this._clearFormula(f,e),o[f][e].wrap&&delete c._wrapColl[f][e],o[f][e]={},l.push({row:f,col:e}))),t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e+u.colCount])||(o[f][e]=n.extend(!0,{},o[f][e+u.colCount]),o[f][e+u.colCount].wrap&&(this._wrapCollection(f,e,c._wrapColl[f][e+u.colCount],i),delete c._wrapColl[f][e+u.colCount]),tt=this.getCell(f+u.rowCount,e),it=this.getCell(f,e),tt&&(currText=tt[0].outerHTML,this.clearTextNode(tt)),it&&(remText=it[0].outerHTML,this.clearTextNode(it,this.XLEdit.getPropertyValue(f,e,"value2"))),l.push({row:f,col:e+u.colCount}),this._clearFormula(f,e+u.colCount),o[f][e+u.colCount]={},this._refreshFormula(f,e,u.colCount,"delete","column",u.startCol,!0),tt&&(tt[0].outerHTML=currText),it&&(it[0].outerHTML=remText)),this.XLEdit._refreshCalcEngine(f,e);for(s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row][l[s].col])===0&&(this._clearFormula(l[s].row,l[s].col),this.XLEdit._refreshCalcEngine(l[s].row,l[s].col),delete o[l[s].row][l[s].col]);l=[]}break;case"shiftBottom":for(vt=this.getSheet(i).columnsWidthCollection,y=this.getSheet(i).rowsHeightCollection,f=lt,v=u.startRow;f>=v;f--){for(et=this._checkIndicesInContainer(i,f,0,"wrapRow"),e=u.startCol;e<ei;e++)t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e])||(t.isNullOrUndefined(o[f+u.rowCount])&&(o[f+u.rowCount]={}),et&&(yt=c._wrapColl[f][e],y[f+u.rowCount]=t.max([yt,y[f+u.rowCount]]),this._checkIndicesInContainer(i,f+u.rowCount,0,"wrapRow")||this.XLEdit._updateDataContainer({rowIndex:f+u.rowCount,colIndex:0},{dataObj:{wrapRow:!0}}),this._wrapCollection(f+u.rowCount,e,yt,i)),o[f+u.rowCount][e]=n.extend(!0,{},o[f][e]),this._clearFormula(f,e),f>=p&&f<=dt?(this._checkIndicesInContainer(i,p,e,"rule")&&(st=this._dataContainer.sheets[i][p][e].rule),this._checkIndicesInContainer(i,p,e,"cFormatRule")&&(ht=this._dataContainer.sheets[i][p][e].cFormatRule),this._refreshValAndCF(f,e,st,ht,u.rowCount,0,u.status),at||p<1||this.addClass(this.getCell(f,e)[0],this.XLFormat.getFormatClass(this.getCell(p-1,e)[0].className,!1))):delete o[f][e],et&&delete c._wrapColl[f][e],this._refreshFormula(f+u.rowCount,e,u.rowCount,"insert","row",u.startRow,!0)),this.XLEdit._refreshCalcEngine(f,e),this.XLEdit._refreshCalcEngine(f+u.rowCount,e);et&&(y[f]=t.max(this._getObjectValues(c._wrapColl[f])),y[f]||(y[f]=this.model.rowHeight),this.getObjectLength(c._wrapColl[f])||delete this._dataContainer.sheets[i][f][0].wrapRow);t.isNullOrUndefined(o[f])||this.getObjectLength(o[f])===0&&delete o[f]}if(this._isUndo&&this._delCells.length>0)for(h=this._delCells,ct=h[h.length-1].row-h[0].row,f=0,v=h.length;f<v;f++)b=h[f].row,pt=h[f].col,t.isNullOrUndefined(o[b])&&(o[b]={}),o[b][pt]=h[f].value,this._refreshFormula(b,pt,ct,"insert","row",u.startRow,!0),this.XLEdit._refreshCalcEngine(b,pt),et=this._checkIndicesInContainer(i,b,0,"wrapRow"),oi=h[f].value.wrap,(et||oi)&&(yt=oi?h[f].height:this.model.rowHeight,y[b]=t.max([yt,y[b]]),this._checkIndicesInContainer(i,b,0,"wrapRow")||this.XLEdit._updateDataContainer({rowIndex:b,colIndex:0},{dataObj:{wrapRow:!0}}),this._wrapCollection(b,pt,yt,i)),at||this.XLComment&&this.XLComment._updateCmntFrmCntnr(b,pt);break;case"shiftUp":for(l=[],vt=this.getSheet(i).columnsWidthCollection,y=this.getSheet(i).rowsHeightCollection,f=u.startRow;f<=lt;f++){for(kt=this._checkIndicesInContainer(i,f,0,"wrapRow"),et=this._checkIndicesInContainer(i,f+u.rowCount,0,"wrapRow"),e=u.startCol;e<ei;e++)f<u.startRow+u.rowCount&&!t.isNullOrUndefined(o[f])&&(t.isNullOrUndefined(o[f][e])||(this._delCells.push({row:f,col:e,value:n.extend(!0,{},o[f][e]),height:kt?c._wrapColl[f][e]:y[f]}),this._clearFormula(f,e),o[f][e]={},l.push({row:f,col:e}),kt&&delete c._wrapColl[f][e])),t.isNullOrUndefined(o[f+u.rowCount])?y[f+u.rowCount]=this.model.rowHeight:t.isNullOrUndefined(o[f+u.rowCount][e])||(t.isNullOrUndefined(o[f])&&(o[f]={}),o[f][e]=n.extend(!0,{},o[f+u.rowCount][e]),et&&(this._wrapCollection(f,e,c._wrapColl[f+u.rowCount][e],i),delete c._wrapColl[f+u.rowCount][e]),tt=this.getCell(f+u.rowCount,e),it=this.getCell(f,e),tt&&(currText=tt[0].outerHTML,this.clearTextNode(tt)),it&&(remText=it[0].outerHTML,this.clearTextNode(it,this.XLEdit.getPropertyValue(f,e,"value2"))),this._clearFormula(f+u.rowCount,e),o[f+u.rowCount][e]={},l.push({row:f+u.rowCount,col:e}),this._refreshFormula(f,e,u.rowCount,"delete","row",u.startRow,!0),tt&&(tt[0].outerHTML=currText),it&&(it[0].outerHTML=remText)),this.XLEdit._refreshCalcEngine(f,e);kt&&this.getObjectLength(c._wrapColl[f])<1&&delete this._dataContainer.sheets[i][f][0].wrapRow;et&&(this.XLEdit._updateDataContainer({rowIndex:f,colIndex:0},{dataObj:{wrapRow:!0}}),y[f+u.rowCount]=t.max(this._getObjectValues(c._wrapColl[f+u.rowCount])),y[f+u.rowCount]||(y[f+u.rowCount]=this.model.rowHeight),this.getObjectLength(c._wrapColl[f+u.rowCount])||delete this._dataContainer.sheets[i][f+u.rowCount][0].wrapRow);(kt||et)&&(y[f]=t.max(this._getObjectValues(c._wrapColl[f])),y[f]||(y[f]=this.model.rowHeight))}for(s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row][l[s].col])===0&&(this._clearFormula(l[s].row,l[s].col),delete o[l[s].row][l[s].col]),this.getObjectLength(o[l[s].row])===0&&delete o[l[s].row]}u.status.indexOf("insert")>-1&&(bt.rowIndex=bt.rowIndex+u.rowCount,bt.colIndex=bt.colIndex+u.colCount,this.getSheet(i).usedRange=bt)},_undoInsDelMerge:function(){if(this._isUndo){this._dupDetails=!0;for(var n=0,t=this._removeMergeColl.length;n<t;n++)this.mergeCenter=this._removeMergeColl[n].merge.isCenterAlign,this.mergeCells(this._removeMergeColl[n].merge.mRange,!0);this._dupDetails=!1}},_updateCommentColl:function(n){this.getSheet(n)._commentColl={};this._isInsdel=!0;this.XLComment._updateCmntArrowPos();this._isInsdel=!1},insertShiftRight:function(n,t){if(this.model.allowInsert&&!this.model.isReadOnly){var r,f=!1,u=this.getActiveSheetIndex(),i;this._isUndo?(r="shiftLeft",this._insDelStatus="delete"):(r="shiftRight",this._insDelStatus="insert");i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:r};this.model.allowFiltering&&this.XLFilter._checkFilterApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._checkTableApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._isFilterApplied||this._isTableApplied?this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630):(f=this._clearAllMergeCells(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r),f.isAlert?this._insertShiftRight(u,n,t,i):(this._insData={sheetIdx:u,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge())}},_insertShiftRight:function(t,i,r,u){var c=r.colIndex-i.colIndex+1,l=this.getRows(t)[1],a=this._getJSSheetHeader(t).find("col"),v=this._getContent(t).find("col"),o,s,e,f,h;if(this._isUndo){for(s=i.rowIndex;s<=r.rowIndex;s++)for(iTd=n(l[this._getRowIdx(s)]).find("td"),o=iTd.length-1,e=i.colIndex;e<=o-c;e++)iTd[e].outerHTML=iTd[e+c].outerHTML;for(f=o;f>o-c;f--)for(a.eq(f).remove(),v.eq(f).remove(),h=0;h<l.length;h++)n(l[this._getRowIdx(h)]).find("td:eq("+f+")").remove()}else this.XLScroll._createNewColumn(t,i,r,"shift");this.performSelection(i,r);this._refreshDataContainer(t,u);this._isUndo?this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"delete"):this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"insert");this.model.allowComments&&this._updateCommentColl(t);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._isUndoRedo||this._undoredoDetails(t,i,r,"insert","insertShiftRight");this._refreshRows(t)},insertShiftBottom:function(n,t){if(this.model.allowInsert&&!this.model.isReadOnly){var f=!1,r=this.getActiveSheetIndex(),u,i;if(u=this._isUndo?"shiftUp":"shiftBottom",i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:u},this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._checkTableApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._isFilterApplied||this._isTableApplied)if(this._isTotalRow)if(this._isUndoRedo)this._isUndoRedo=this._dupDetails=!0,this.deleteEntireRow(this._insRows.startRow,this._insRows.endRow),this.XLFormat._calculateTotalRow(r,null,!0,!1),this._isUndoRedo=!1;else return this._showAlertDlg("","TotalRowAlert","TotalRow",630),!0;else this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630);else f=this._clearAllMergeCells(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),f.isAlert?this._insertShiftBottom(r,n,t,i):(this._insData={sheetIdx:r,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge()}},_insertShiftBottom:function(t,i,r,u){var w=this.model.scrollSettings.allowVirtualScrolling,f,e,c,a;if(this._refreshDataContainer(t,u),w)this._refreshViewport(this.getSheet(t)._scrollTop,t);else{var h,s,l,v=this.getSheet(t).rowsHeightCollection,p=this.getRows(t),o=p[1],y=p[0];if(this._isUndo){for(o=this._getContent(t).find("tbody").get(0).rows,f=i.rowIndex,a=o.length;f<a;f++){if(h=f+(r.rowIndex-i.rowIndex+1),l=n(o[f]).find("td"),h<o.length)for(s=n(o[h]).find("td"),e=i.colIndex;e<=r.colIndex;e++)l[e].outerHTML=s[e].outerHTML,s[e].innerHTML="";o[f].style.height=v[f]+"px";y[f].style.height=v[f]+"px"}for(e=i.colIndex;e<=r.colIndex;e++)for(c=a-1,length=a-1-(r.rowIndex-i.rowIndex+1);c>length;c--)n(o[c]).remove(),n(y[c]).remove(),this.model.sheets[t].rowCount=this.model.sheets[t].rowCount-1;this.XLScroll._refreshScroller(1,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"all")}else{for(f=i.rowIndex;f<=r.rowIndex;f++)this.XLScroll._createNewRow(t,-1,-1,"insert");for(f=o.length-1;f>=i.rowIndex;f--){if(h=f-(r.rowIndex-i.rowIndex+1),l=n(o[f]).find("td"),h>=i.rowIndex)for(s=n(o[h]).find("td"),e=i.colIndex;e<=r.colIndex;e++)l[e].outerHTML=s[e].outerHTML,s[e].innerHTML="",l[e].className=s[e].className,s[e].className="e-rowcell e-wrapword";o[f].style.height=v[f]+"px";y[f].style.height=v[f]+"px"}}this._refreshRows(t)}this.XLScroll._getRowHeights(t,i.rowIndex);this.performSelection(i,r);this.model.allowComments&&this._updateCommentColl(t);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._isUndo?this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"delete"):this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"insert");this._isUndoRedo||this._dupDetails||this._undoredoDetails(t,i,r,"insert","insertShiftBottom")},insertEntireRow:function(t,i){var h,v,c,l;if(this.model.allowInsert&&!this.model.isReadOnly){var y=this.model.scrollSettings.allowVirtualScrolling,u,a,o,e,r=this.getActiveSheetIndex(),f=this.getSheet(r),k=f.rowsHeightCollection,p=f._isRowSelected,s=f._selectedCells,w=s[0].colIndex,b=s[s.length-1].colIndex;if(this._isUndo?(o="deleteRow",this._insDelStatus="delete"):(o="insertRow",this._insDelStatus="insert"),e={startCol:0,colCount:f.colCount,startRow:t,rowCount:i-t+1,status:o},this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,t,e.rowCount,0,f.colCount,o)){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(r,t,e.rowCount,-1,0,o),this._refreshDataContainer(r,e),y)this.model.allowFiltering&&this.XLFilter._updateFilterCollection(r,t,i-t,"row",this._insDelStatus),this._refreshViewport(this._isFrozen(f.frozenRows)?this._getContent(r).find(".e-content").scrollTop():f._scrollTop,r);else{if(this._isUndo){for(h=this.getRows(r),v=h[1],c=h[0],u=i;u>=t;u--)n(v[u]).remove(),n(c[u]).remove(),f.rowCount=f.rowCount-1;for(l=c.find("td"),u=0,a=l.length;u<a;u++)n(l[u]).text(u+1)}else for(u=t;u<=i;u++)this.XLScroll._createNewRow(r,u,0,"insert");this.model.allowFiltering&&this.XLFilter._updateFilterCollection(r,t,i-t,"row",this._insDelStatus);this.XLScroll._getRowHeights(r,t);this._refreshRows(r)}this._isFrozen(f.frozenRows)&&(t<f._frozenRows||i<f._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv();this._isUndo?(this._refreshAllMergeCells(r,t,e.rowCount,-1,0,"delete"),this._batchDeleteRow(t,i,r,!0)):(this._refreshAllMergeCells(r,t,e.rowCount,-1,0,"insert"),this._batchAddRow(t,i,r));p?this.XLSelection.selectRows(t,i):this.performSelection({rowIndex:t,colIndex:w},{rowIndex:i,colIndex:b});this.model.allowComments&&this._updateCommentColl(r);this._isUndoRedo||this._dupDetails||this._undoredoDetails(r,{rowIndex:t,colIndex:0},{rowIndex:i,colIndex:f.colCount-1},"insert","insertRow")}},insertEntireColumn:function(n,t){if(this.model.allowInsert&&!this.model.isReadOnly){var h=this.model.scrollSettings.allowVirtualScrolling,f,i=this.getActiveSheetIndex(),u,r=this.getSheet(i),l=r._isColSelected,e,o,s=r._selectedCells,a=s[0].rowIndex,v=s[s.length-1].rowIndex,c=r.columnsWidthCollection;if(this._isUndo?(this._insDelStatus="delete",f="deleteColumn"):(f="insertColumn",this._insDelStatus="insert"),!r._isTemplate||!(n<r._templateColCount||t<r._templateColCount)){if(u={startCol:n,colCount:t-n+1,startRow:0,rowCount:r.rowCount,status:f},this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(i,u.startRow,r.rowCount,n,u.colCount,f)){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(i,-1,0,n,u.colCount,f),f==="deleteColumn"&&h)for(j=t;j>=n;j--)c.splice(j,1),c.push(r.columnWidth);this._refreshDataContainer(i,u);e={rowIndex:a,colIndex:n};o={rowIndex:v,colIndex:t};h?this.refreshContent(i):this.XLScroll._createNewColumn(i,e,o,"insert");this._isUndo?this._refreshAllMergeCells(i,-1,0,n,u.colCount,"delete"):this._refreshAllMergeCells(i,-1,0,n,u.colCount,"insert");this.model.allowFiltering&&this.XLFilter._updateFilterCollection(i,n,t-n,"column",this._insDelStatus);this._isFrozen(r.frozenColumns)&&(n<r._frozenColumns||t<r._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv();this._isUndoRedo||this._undoredoDetails(i,e,o,"insert","insertColumn");this.model.allowComments&&this._updateCommentColl(i);l?this.XLSelection.selectColumns(n,t):this.performSelection(e,o);this._refreshRows(i);this._isAutoWHMode&&this._autoSSWidthHeight(i)}}},deleteShiftLeft:function(n,t){if(this.model.allowDelete&&!this.model.isReadOnly){var f=!1,u=this.getActiveSheetIndex(),r,i;this._isUndo?(this._insDelStatus="insert",r="shiftRight"):(this._insDelStatus="delete",r="shiftLeft");i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:r};this.model.allowFiltering&&this.XLFilter._checkFilterApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._checkTableApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._isFilterApplied||this._isTableApplied?this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630):(f=this._clearAllMergeCells(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r),f.isAlert?f.isCancel||this._deleteShiftLeft(u,n,t,i):(this._insData={sheetIdx:u,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge())}},_deleteShiftLeft:function(t,i,r,u){var o,s,f,e,h,c=r.colIndex-i.colIndex+1,a=this.getRows(t)[1],l=[],v;if(this._isUndo)for(n.extend(!0,l,this._deletedText),o=i.rowIndex;o<=r.rowIndex;o++){for(h=this._getRowIdx(o),f=n(a[h]).find("td"),v=f.length-1,e=v-c;e>i.colIndex-1;e--)f[e+c].outerHTML=f[e].outerHTML;for(s=i.colIndex;s<=r.colIndex;s++)f[s].outerHTML=l.shift()}else for(this._insDelStatus="delete",o=i.rowIndex;o<=r.rowIndex;o++){for(h=this._getRowIdx(o),f=n(a[h]).find("td"),s=i.colIndex;s<=r.colIndex;s++)l.push(f[s].outerHTML);for(e=i.colIndex,length=f.length;e<length-c;e++)f[e].outerHTML=f[e+c].outerHTML}this.performSelection(i,r);this._refreshDataContainer(t,u);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._deletedText=l;this.model.allowComments&&this._updateCommentColl(t);this._isUndo?this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"insert"):this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"delete");this._isUndoRedo||this._undoredoDetails(t,i,r,"delete","deleteShiftLeft");this._refreshRows(t)},deleteShiftUp:function(n,t){if(this.model.allowDelete&&!this.model.isReadOnly){var f=!1,r=this.getActiveSheetIndex(),u,i;if(u=this._isUndo?"shiftBottom":"shiftUp",i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:u},this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._checkTableApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._isFilterApplied||this._isTableApplied){if(this._isTotalRow)return;this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630)}else f=this._clearAllMergeCells(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),f.isAlert?f.isCancel||this._deleteShiftUp(r,n,t,i):(this._insData={sheetIdx:r,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge()}},_deleteShiftUp:function(t,i,r,u){var b=this.model.scrollSettings.allowVirtualScrolling,f,e,y,a=[],c,s;if(this._refreshDataContainer(t,u),b)this._refreshViewport(this.getSheet(t)._scrollTop,t);else{var h,l,v=this.getSheet(t).rowsHeightCollection,p=this.getRows(t),o=p[1],w=p[0];if(!this._isUndo||this._isTotalRow)for(f=i.rowIndex,y=o.length;f<y;f++){if(c=f+(r.rowIndex-i.rowIndex+1),s=this._getRowIdx(f),h=n(o[s]).find("td"),c<o.length)for(l=n(o[this._getRowIdx(c)]).find("td"),e=i.colIndex;e<=r.colIndex;e++)a.push(h[e].outerHTML),h[e].outerHTML=l[e].outerHTML,l[e].innerHTML="";o[s].style.height=v[f]+"px";w[s].style.height=v[f]+"px"}else{for(n.extend(!0,a,this._deletedText),f=o.length-1;f>=i.rowIndex;f--){if(c=f-(r.rowIndex-i.rowIndex+1),s=this._getRowIdx(f),h=n(o[s]).find("td"),c>=i.rowIndex)for(l=n(o[this._getRowIdx(c)]).find("td"),e=i.colIndex;e<=r.colIndex;e++)h[e].outerHTML=l[e].outerHTML,l[e].innerHTML="";o[s].style.height=v[f]+"px";w[s].style.height=v[f]+"px"}for(f=i.rowIndex;f<=r.rowIndex;f++)for(h=n(o[this._getRowIdx(f)]).find("td"),e=i.colIndex;e<=r.colIndex;e++)h[e].outerHTML=a.shift()}this._refreshRows(t)}this.XLScroll._getRowHeights(t,i.rowIndex);this.performSelection(i,r);this.model.allowComments&&this._updateCommentColl(t);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._deletedText=a;this._isUndo?this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"insert"):this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"delete");this._isUndoRedo||this._dupDetails||this._undoredoDetails(t,i,r,"delete","deleteShiftUp")},deleteEntireRow:function(t,i){if(this.model.allowDelete&&!this.model.isReadOnly){var k=this.model.scrollSettings.allowVirtualScrolling,u,v,s,r=this.getActiveSheetIndex(),f=this.getSheet(r),c=f._selectedCells,d=c[0].colIndex,g=c[c.length-1].colIndex;if(rowHeightColl=f.rowsHeightCollection,this._isUndo?(this._insDelStatus="insert",s="insertRow"):(s="deleteRow",this._insDelStatus="delete"),o={startCol:0,colCount:f.colCount,startRow:t,rowCount:i-t+1,status:s},!this._isUndoRedo&&(this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,t,o.rowCount,0,f.colCount,s))){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(r,t,o.rowCount,-1,0,s),this._refreshDataContainer(r,o),k)this._refreshViewport(this._isFrozen(f.frozenRows)?this._getContent(r).find(".e-content").scrollTop():this.getSheet(r)._scrollTop,r);else{var l,e,y,h=[],p,o,w=this.getRows(r),a=w[1],b=w[0];if(this._isUndo){for(n.extend(!0,h,this._deletedText),u=t;u<=i;u++)e=this._getRowIdx(u),p=h.pop(),n(a[e]).before(p),y=this.XLScroll._rowHeaderTemplate(1,rowHeightColl[u]),n(b[e]).before(y),f.rowCount=f.rowCount+1;this._refreshRows(r)}else for(u=i;u>=t;u--)e=this._getRowIdx(u),h.push(a[e].outerHTML),n(a[e]).remove(),n(b[e]).remove(),f.rowCount=f.rowCount-1,this.XLScroll._createNewRow(r,-1,-1,"insert");for(l=n(this.getRows(r)[0]).find("td"),u=0,v=l.length;u<v;u++)n(l[u]).text(u+1);this._refreshRows(r)}this._isFrozen(f.frozenRows)&&(t<f._frozenRows||i<f._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv();f._isRowSelected?this.XLSelection.selectRows(t,i):this.performSelection({rowIndex:t,colIndex:d},{rowIndex:i,colIndex:g});this._deletedText=h;this.model.allowComments&&this._updateCommentColl(r);this._isUndo?(this._refreshAllMergeCells(r,t,o.rowCount,-1,0,"insert"),this._batchAddRow(t,i,r,!0)):(this._refreshAllMergeCells(r,t,o.rowCount,-1,0,"delete"),this._batchDeleteRow(t,i,r));this.model.allowFiltering&&this.XLFilter._updateFilterCollection(r,t,i-t,"row",this._insDelStatus);this.XLScroll._getRowHeights(r,t);this._isUndoRedo||this._dupDetails||this._undoredoDetails(r,{rowIndex:t,colIndex:0},{rowIndex:i,colIndex:f.colCount-1},"delete","deleteRow")}},deleteEntireColumn:function(i,r){var h,g;if(this.model.allowDelete&&!this.model.isReadOnly){var u,f,p,w,tt=0,e=this.getActiveSheetIndex(),it=this.getFrozenColumns(),o=this.getSheet(e),a=this.getRows(e)[1],v=this._getContent(e).find("col"),b=this._getJSSheetHeader(e).find("col"),c=this._getJSSheetHeader(e).find("th"),nt=o._selectedCells,et=nt[0].rowIndex,ot=nt[nt.length-1].rowIndex,y,s=[],l,rt,k,ut=this.XLScroll._colGroupTemplate(1),d=o.columnsWidthCollection,ft=this.model.scrollSettings.allowVirtualScrolling,st=ft?this._getContent(e).find("tbody").get(1):this._getContent(e).find("tbody").get(0);if(this._isUndo?(y="insertColumn",this._insDelStatus="insert"):(y="deleteColumn",this._insDelStatus="delete"),!o._isTemplate||!(i<o._templateColCount||r<o._templateColCount)){if(l={startCol:i,colCount:r-i+1,startRow:0,rowCount:o.rowCount,status:y},!this._isUndoRedo&&(this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(e,l.startRow,l.rowCount,0,o.colCount,y))){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(e,-1,0,i,l.colCount,y),this._isUndo){for(s=n.extend(!0,s,this._deletedText),h=0,u=a.length-1;u>=0;u--){for(w=n(a[u]).find("td"),f=i;f<=r;f++)w.eq(f-h).before(s.pop()),h++;h=0}for(f=i;f<=r;f++)v.eq(f-h).before(s.pop()),c.eq(f-h).before("<th class='e-headercell'><div class='e-headercelldiv'><\/div><\/th>"),b.eq(f-h).before(s.pop()),h++;k=d.splice(0,i);t.merge(k,this._deletedDimension.reverse());t.merge(k,d);o.columnsWidthCollection=k;this._deletedDimension=[]}else{if(this._deletedDimension=[],this._isFrozen(it)&&it>=i){for(u=o._frozenColumns-1;u<o._fleftColIdx;u++)tt+=o.columnsWidthCollection[u];this._scrollContent({x:-tt})}for(f=r;f>=i;f--)s.push(b[f].outerHTML),s.push(v[f].outerHTML),this._deletedDimension.push(d.splice(f,1)[0]),b.eq(f).remove(),v.eq(f).remove(),b.parent().append(ut),v.parent().append(ut),d.push(o.columnWidth);for(u=0,p=a.length;u<p;u++)for(w=n(a[u]).find("td"),f=r;f>=i;f--)rt=this.XLScroll._columnTemplate(),n(a[u]).append(rt),s.push(w[f].outerHTML),n(st.rows[u]).find("td:eq("+f+")").remove()}for(this.XLScroll._getColWidths(e,i),this._isFrozen(o.frozenColumns)&&(i<o._frozenColumns||r<o._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv(),this.model.allowFiltering&&this.XLFilter._updateFilterCollection(e,i,r-i,"column",this._insDelStatus),o.colCount=v.length,c=this._getJSSheetHeader(e).find("th"),this._refreshDataContainer(e,l),u=0,p=c.length;u<p;u++)this._checkIndicesInContainer(e,0,u,"hCol")&&(g="e-hcol"),this._checkIndicesInContainer(e,0,u,"isCHide")&&(g+="e-hide"),this._removeClass(c[u],"e-hcol"),this._removeClass(c[u],"e-hide"),this.addClass(c[u],g),g="",n(c[u]).find("div").text(this._generateHeaderText(u+1));ft&&this.refreshContent(e);this._isUndo?this._refreshAllMergeCells(e,-1,0,i,l.colCount,"insert"):this._refreshAllMergeCells(e,-1,0,i,l.colCount,"delete");o._isColSelected?this.XLSelection.selectColumns(i,r):this.performSelection({rowIndex:et,colIndex:i},{rowIndex:ot,colIndex:r});this._deletedText=s;this.model.allowComments&&this._updateCommentColl(e);this._isUndoRedo||this._undoredoDetails(e,{rowIndex:0,colIndex:i},{rowIndex:o.rowCount-1,colIndex:r},"delete","deleteColumn");this._refreshRows(e)}}},_getSelectedRange:function(n,t){for(var r,e,o=[],u=this.swapRange([n.rowIndex,n.colIndex,t.rowIndex,t.colIndex]),i=u[0],f=u[2];i<=f;){for(r=u[1],e=u[3];r<=e;)o.push({rowIndex:i,colIndex:r}),r++;i++}return o},performSelection:function(n,t){var r=this.getActiveSheetIndex(),i,c=this.getSheet(r),u,f,e,o,s,h;this.getObjectLength(n)||(i=this._getRangeArgs(n,"object"),n={rowIndex:i[0],colIndex:i[1]},t={rowIndex:i[2],colIndex:i[3]});this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(r,"refresh","all");this.setActiveCell(n.rowIndex,n.colIndex);this.model.allowSelection&&(e=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge"),o=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"merge"),e&&(s=this.getRangeIndices(e.mRange),n={rowIndex:s[0],colIndex:s[1]}),o&&(h=this.getRangeIndices(o.mRange),t={rowIndex:h[2],colIndex:h[3]}),this.XLSelection.selectRange(n,t));this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();c._startCell=n;c._endCell=t;this.model.showRibbon&&this.XLRibbon._updateRibbonIcons();u=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"tableName",r);u&&(f=this._getTableID(u),this.isNumber(f)&&this.XLRibbon._designTabUpdate(f,n))},_checkRowCol:function(n,i){if(n!==0&&i!==0)return t.isNullOrUndefined(i)&&(i=n),{start:n,end:i}},hideRow:function(n,t){var i=this._checkRowCol(n,t);this._hideRow(i.start-1,i.end-1,"isRHide")},showRow:function(n,t){var i=this._checkRowCol(n,t);this._showRow(i.start,i.end,"isRHide")},hideColumn:function(n,t){var i=this._checkRowCol(n,t);this._hideColumn(i.start-1,i.end-1)},showColumn:function(n,t){var i=this._checkRowCol(n,t);this._showColumn(i.start,i.end)},_hideRow:function(n,i,r,u){var e=this.getActiveSheetIndex(),f=this.getSheet(e),a=this.getRows(e),y=a[1],p=a[0],h=this.model.scrollSettings,s=h.allowVirtualScrolling,v=f.hideRowsCollection,c=[],w=f.rowsHeightCollection,o,l;for(this._isUndoRedo||u||(this.XLEdit._updateDataContainer({rowIndex:n?n-1:n,colIndex:0},{dataObj:{hRow:!0}}),s||this.addClass(this._getJSSheetRowHeaderContent(e).find(".e-rowheader")[n?n-1:n],"e-hrow")),o=n;o<=i;o++)r==="isRHide"&&this.XLEdit._updateDataContainer({rowIndex:o,colIndex:0},{dataObj:{isRHide:!0}}),c.push(o),v.indexOf(o)===-1&&(v.push(o),s||(this._isRowViewable(e,o)&&(this.addClass(y[o],"e-r-hide"),this.addClass(p[o],"e-r-hide")),h.allowScrolling&&h.scrollMode===t.Spreadsheet.scrollMode.Infinite&&(!f._isImported||f._isLoaded)&&this.XLScroll._createNewRow(e,-1,-1,"insert")));this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(n,i,!0,!0);this._isFilter||this.XLScroll._getRowHeights(e,n);this._showHideRows(e,f,c,n,i,s,"hide");f._isImported&&!f._isLoaded||this._isFilter||this._isExport||(this.model.allowComments&&this.XLComment._updateCmntArrowPos(),this._isFrozen(f.frozenRows)&&(n<f._frozenRows||i<f._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv(),this.model.scrollSettings.allowScrolling&&!s&&this.XLScroll._refreshScroller(e,"refresh","vertical"),this._isUndoRedo||u||(f._activeCell.rowIndex=i+1,l={sheetIndex:e,reqType:"show-hide",action:"hide",operation:"row",bSelect:{startRow:n,endRow:i},aSelect:{startRow:i+1,endRow:i+1},addBRows:n?[n-1]:[n],remBRows:[],hideRows:c},this._completeAction(l),this._trigActionComplete(l)));u||(this.XLSelection.selectRow(i+1,e),this.model.allowAutoFill&&this.XLDragFill.hideAutoFillElement())},_showRow:function(i,r,u,f){var c,l,e=this.getActiveSheetIndex(),w=this._isUndoRedo?i:i-1>0?i-1:0,o=this.getSheet(e),b=this.getRows(e),k=b[1],a=b[0],v=[],d=[],it=o.rowsHeightCollection,g=o.hideRowsCollection,tt=n(this._getJSSheetHeader(e).find("colgroup")[0].outerHTML).attr("id","ss"),h=t.buildTag("table#wrapTable.e-table",{}),y=this._dataContainer.sheets[e],s=this.model.scrollSettings.allowVirtualScrolling,rt=o.columnsWidthCollection,nt=this.element.find(".e-spreadsheetcolumnheader"),p;for(s||(h.append(tt),this.element[0].insertBefore(h[0],this.element[0].childNodes[0])),this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(i,r,!0),j=w;j<=r;j++)c=g.indexOf(j),c>-1&&(u==="isRHide"&&delete y[j][0].isRHide,v.push(j),g.splice(c,1),s||(this._removeClass(k[j],"e-r-hide"),this._removeClass(a[j],"e-r-hide")),!this._isUndoRedo&&j>0&&!f?(d.push(j-1),delete y[j-1][0].hRow,s||this._removeClass(n(a[j-1]).find("td")[0],"e-hrow")):j!==0||f||(delete y[0][0].hRow,s||(nt.height(20.5),this._removeClass(nt[0],"e-hrow")))),s||(this._setWrapHeight(e,j,k,a,h,"visible"),h.remove()),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this._isFilter||this.XLScroll._getRowHeights(e,w);this._showHideRows(e,o,v,i,r,s,"show");f||o._isImported&&!o._isLoaded||this._isUndoRedo||this._isFilter||(i<r?(this.setActiveCell(i,0),this.XLSelection.selectRows(i,r,e),l={startRow:i,endRow:r}):i>0&&(this.setActiveCell(i-1,0),this.XLSelection.selectRow(i-1,e),l={startRow:i-1,endRow:i-1}),this.XLDragFill.positionAutoFillElement(),p={sheetIndex:e,reqType:"show-hide",action:"show",operation:"row",bSelect:{startRow:i,endRow:r},aSelect:l,addBRows:[],remBRows:d,hideRows:v},this._completeAction(p),this._trigActionComplete(p));this._isFrozen(o.frozenRows)&&(i<o._frozenRows||r<o._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv();this._isFilter||((!o._isImported||o._isLoaded)&&this.model.allowComments&&this.XLComment._updateCmntArrowPos(),this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(e,"refresh","vertical"))},_showHideRows:function(n,t,i,r,u,f,e){f&&(e==="show"&&this.refreshContent(n),this._refreshViewport(this._isFrozen(t.frozenRows)?t._contScrollTop:t._scrollTop,n));this._refreshSHMergeCells(n,i,u-r+1,"row",e);f&&e==="hide"&&this.refreshContent(n);t.selectedRange[0]<r&&t.selectedRange[2]>u&&(this.model.allowSelection&&this.XLSelection.selectRange(t._activeCell,t._activeCell),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())},_colgroupRefresh:function(t){var i,r,u,f;this.model.allowResizing&&(i=this._getJSSheetHeader(t).find("colgroup"),r=this._getContent(t).find("colgroup"));u=n(i).clone();f=n(r).clone();n(r).remove();n(i).remove();n(u).prependTo(this._getJSSheetHeader(t).find(".e-table"));n(f).prependTo(this._getContent(t).find(".e-table"))},_updateFilterIcon:function(n,i,r){t.isNullOrUndefined(r)&&(r=this.getActiveSheetIndex());for(var o=this.getSheet(r).filterSettings.tableRange,u,e,f=0,s=o.length;f<s;f++)e=o[f].multifilterIdx,n>=e[0]&&n<=e[e.length-1]&&(u=o[f].startRow-1,this._isRowViewable(r,u)&&(i==="hide"?this.addClass(this.getCell(u,n).find(".e-filterspan")[0],"e-hide"):this._removeClass(this.getCell(u,n).find(".e-filterspan")[0],"e-hide")),this.XLEdit._updateDataContainer({rowIndex:u,colIndex:n},{dataObj:{isFilterVisible:i!="hide"}}))},_hideColumn:function(n,i){for(var e,a,o,v=!1,u=this.getActiveSheetIndex(),b=this._getJSSheetHeader(u).find("th"),k=this._getJSSheetHeader(u).find("col"),y,f=this.getSheet(u),d=f.hideColsCollection,s=[],h=[],g=this._getContent(u).find("col"),p=f._filterColl,nt,c=f.columnsWidthCollection,w=this.element.find(".e-spreadsheetcolumnheader"),l,r=n;r<=i;r++)if(this._getContent(u).find(".e-rowcell:nth-child("+(r+1)+")").addClass("e-soverflow"),y=this.XLEdit.getPropertyValue(0,r,"isCHide"),this._isColumnViewable(u,r)&&(v=!0),t.isNullOrUndefined(y))for(this.XLEdit._updateDataContainer({rowIndex:0,colIndex:r},{dataObj:{isCHide:!0}}),this._writeRule(r,u),v&&(this.addClass(b[r],"e-hide"),this.addClass(k[r],"e-hide"),this.addClass(g[r],"e-hide")),s.push(r),d[r]=c[r],c[r]=0,fltrKeys=this.getObjectKeys(p),e=0,a=fltrKeys.length;e<a;e++)t.isNullOrUndefined(p[fltrKeys[e]])||(nt=fltrKeys[e],t.isNullOrUndefined(this.XLEdit.getPropertyValue(fltrKeys[e],r,"isSpanHide"))&&this.XLEdit._updateDataContainer({rowIndex:fltrKeys[e],colIndex:r},{dataObj:{isSpanHide:!0}}));this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(n,i,!1,!0);this._isUndoRedo||(n?h.push(n-1):h.push(n),this._isColumnViewable(u,n)&&(n===0?(w.width(28),this.addClass(w[0],"e-hfcol"),this.XLEdit._updateDataContainer({rowIndex:0,colIndex:0},{dataObj:{hCol:!0}})):(this.XLEdit._updateDataContainer({rowIndex:0,colIndex:n-1},{dataObj:{hCol:!0}}),this.addClass(this._getJSSheetHeader(u).find("th:eq("+(n-1)+")")[0],"e-hcol"))));this._refreshSHMergeCells(u,s,i-n+1,"column","hide");this.XLScroll._getColWidths(u,n);this._isFrozen(f.frozenColumns)&&(n<f._frozenColumns||i<f._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv();this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(u,"refresh","horizontal");!f._isImported||f._isLoaded?(c.length-1===i?(this.XLSelection.selectColumn(i-1,u),this.setActiveCell(0,i-1),o={startCol:i-1,endCol:i-1}):(o={startCol:i+1,endCol:i+1},this.setActiveCell(0,i+1),this.XLSelection.selectColumn(i+1,u)),this.XLDragFill.positionAutoFillElement(),this._isUndoRedo||(l={sheetIndex:u,reqType:"show-hide",action:"hide",operation:"column",bSelect:{startCol:n,endCol:i},aSelect:o,hideCols:s,addBCols:h,remBCols:[]},this._completeAction(l),this._trigActionComplete(l)),this.model.allowComments&&this.XLComment._updateCmntArrowPos()):this.setActiveCell(0,0);this._browserDetails.name.indexOf("msie")>-1&&this._colgroupRefresh(u)},_showColumn:function(n,t){var i=this.getActiveSheetIndex(),u=this._isUndoRedo?n:n-1>0?n-1:0,r=this.getSheet(i),f=r.hideColsCollection,e=[],o=!1,h=[],c=this._getJSSheetHeader(i).find("th"),l=this._getContent(i).find("col"),a=this._getJSSheetHeader(i).find("col"),y=r.columnsWidthCollection,v=this.element.find(".e-spreadsheetcolumnheader"),s;for(this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(n,t),j=u;j<=t;j++)this._getContent(i).find(".e-rowcell:nth-child("+(j+1)+")").removeClass("e-soverflow"),j in f&&(this._deleteRule(j,i),this._isColumnViewable(i,j)&&(o=!0),o&&(this._removeClass(c[j],"e-hide"),this._removeClass(a[j],"e-hide"),this._removeClass(l[j],"e-hide"),l[j].style.width=f[j]+"px",a[j].style.width=f[j]+"px"),y[j]=f[j],delete f[j],delete this._dataContainer.sheets[i][0][j].isCHide,this.model.allowFiltering&&this._updateFilterIcon(j,"show",i),e.push(j),!this._isUndoRedo&&j>0?(o&&this._removeClass(c.get(j-1),"e-hcol"),delete this._dataContainer.sheets[i][0][j-1].hCol,h.push(j-1)):j===0&&(v.width(29),this._removeClass(v[0],"e-hfcol"),delete this._dataContainer.sheets[i][0][0].hCol));this._refreshSHMergeCells(i,e,t-n+1,"column","show");this.XLScroll._getColWidths(i,u);this._isUndoRedo||r._isImported&&!r._isLoaded||(n<t?(this.XLSelection.selectColumns(n,t,i),aSelect={startCol:n,endCol:t}):(this.XLSelection.selectColumn(u,i),aSelect={startCol:u,endCol:u}),this.XLDragFill.positionAutoFillElement(),s={sheetIndex:i,reqType:"show-hide",action:"show",operation:"column",bSelect:{startCol:n,endCol:t},aSelect:aSelect,addBCols:[],remBCols:h,hideCols:e},this._completeAction(s),this._trigActionComplete(s));this._browserDetails.name.indexOf("msie")>-1&&this._colgroupRefresh(i);(!r._isImported||r._isLoaded)&&this.model.allowComments&&this.XLComment._updateCmntArrowPos();this._isFrozen(r.frozenColumns)&&(n<r._frozenColumns||t<r._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv();this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(i,"refresh","horizontal")},_refreshHideRowColCollection:function(n,t,i,r,u){var f;if(r==="row"){for(f=0;f<n.length;f++)if(n[f]>=t+i){u==="insert"?n[f]+=i:n[f]-=i;break}}else for(coll=this.getObjectKeys(n),f=coll.length-1;f>=0;f--)if(coll[f]>=t+i){u==="insert"?(n[parseInt(coll[f])+i]=n[coll[f]],delete n[coll[f]]):(n[parseInt(coll[f])-i]=n[coll[f]],delete n[coll[f]]);break}},_destroySheet:function(n){this.element.find("#"+this._id+"_"+this.model.sheets[n].sheetInfo.value).empty()},_destroy:function(){var r,i=1,t;if(n("#"+this._id+"_sscustomformat").remove(),this.isImport||this._isNew){while(i<=this.model.sheetCount)delete n.templates[this._id+"JSONTemplate"+i],delete n.templates[this._id+"JSONRowHdrTemplate"+i],r=this.getSheet(i).sheetInfo.value,CalcEngine.unregisterGridAsSheet(r,r),i++;this.model.sheets=[];this.model.nameManager=[];this._sheets=[];this.getActivationPanel().empty();this.model.enablePivotTable&&(this.XLPivot._hasPvtField=!1);this.isDirty=!1;t=this.getCalcEngine();t.getFormulaInfoTable().clear();t.getDependentCells().clear();t.getDependentFormulaCells().clear();t.getNamedRanges().clear();t.getDependentNamedRangeCells().clear();this.isImport?(this._detachTable=null,this._updateFormulaCollection()):(document.getElementById(this._id+"_nmgrid")&&n("#"+this._id+"_nmgrid").ejGrid("option",{dataSource:[]}),this._dataContainer={sheets:{},hashCode:[],sharedData:[],cellType:[],valData:[],cFormatData:[]},this.XLRibbon._updateUseInFormulaTrgt(),this.XLEdit._refreshAutoComplete());this.element.append([this.getFocusTopElem(),this.getFocusRightElem(),this.getFocusBottomElem(),this.getFocusLeftElem(),this.getAutoFillElem(),this._getAutoFillOptElem()]);this.element.find(".e-spreadsheet-list .e-sheet").remove();document.getElementById(n("#"+this._id+"ddl"))&&n("#"+this._id+"ddl").data("ejDropDownList").destroy();n("#"+this._id+"ddl").remove();this._tableCnt=this._newSIndex=1;this.XLChart&&(this.XLChart._shapeCnt=1);CalcEngine._tokenCount=0;this._isVPRendered=!1}else this._wireEvents("_off"),this._destroySubControls(),this.element.empty(),this.element.css({height:"",width:"","min-height":"","min-width":""}),this.element.prop("tabindex",!1),this.element.removeEleEmptyAttrs(),this._removeClass(this.element[0],"e-spreadsheet"),document.getElementById(this._id+"_sshide")&&document.getElementById(this._id+"_sshide").remove(),n("#"+this._id+" _formatastable").parent().remove(),n("#"+this._id+" _cellstyles").parent().remove(),n("#"+this._id+"_Ribbon_Home_Font_BorderColor_popup").remove();this._isRibbonDestroyed=!0},_destroySubControls:function(){var r,u=this._id,t,f,i,o,e;if(t=n("span.e-"+u+"-ddl input.e-dropdownlist"),t.length)for(i=0,o=t.length;i<o;i++)f=n(t[i]).data("ejDropDownList"),f&&f.destroy();if(this.model.allowFiltering){e=n(".e-"+this._id+"_customddl");e.length&&e.ejDropDownList("destroy").remove();var s=n("#"+this._id+"_filter_custom_string_acString"),h=n("#"+this._id+"_filter_custom_number_acString"),c=n("#"+this._id+"_filter_custom_date_acString");s.length&&s.ejAutocomplete("destroy").remove();h.length&&h.ejNumericTextbox("destroy").remove();c.length&&c.ejDatePicker("destroy").remove()}n("#"+this._id+"_colordlg_cpicker").ejColorPicker("destroy").remove();this.model.showRibbon&&(this.XLRibbon._rbnDestroy({destroy:!0}),document.getElementById(this._id+"_nmgrid")&&n("#"+this._id+"_nmgrid").ejGrid("destroy"),n(".e-"+this._id+"-spltbtn").ejSplitButton("destroy"),n("#"+this._id+"_Ribbon").ejRibbon("destroy"));r=n(".e-"+u+"-dlg");r.length&&r.remove();this.model.allowFormulaBar&&n("#"+this._id+"_inputbox").ejAutocomplete("destroy");n("#"+this._id+"_AutoComplete").ejAutocomplete("destroy");this.model.allowAutoFill&&n("#"+this._id+"_dragfilloptionbtn").ejSplitButton("destroy");this.model.enableContextMenu&&(n("#"+this._id+"_contextMenuCell").ejMenu("destroy").remove(),n("#"+this._id+"_contextMenuColumnHeader").ejMenu("destroy").remove(),n("#"+this._id+"_contextMenuRowHeader").ejMenu("destroy").remove(),n("#"+this._id+"_contextMenuFooter").ejMenu("destroy").remove(),n(".e-"+u+"-cmenu").remove());this.model.allowFiltering&&(this._excelFilter.resetExcelFilter(),n("#"+this._id+"number_excelDlg").remove(),n("#"+this._id+"string_excelDlg").remove(),n("#"+this._id+"date_excelDlg").remove());n("#"+this._id+"_copyPaste").remove();n("#"+this._id+"_wait").ejWaitingPopup("destroy");n("#"+this._id+"_wait").remove()},_getXYPos:function(n,t,i,r){var e=this.element.offset().top,o=this.element.offset().left,s=t.height(),h=t.width(),u=n.offset().left-o,f=n.offset().top-e;return f+i+s>this._responsiveHeight?f=f-(f+i+s-this._responsiveHeight)+(e-6):f+=e,f<e&&(f+=e-f),u+r+h>this._responsiveWidth?u=u-(u+r+h-this._responsiveWidth)+(o-6):u+=o+r,u<o&&(u+=o-u),{xPos:u,yPos:f}},getValueRowCol:function(n,t,i){var n=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+n),r=this.getSheet(n);return n==-1?"#REF!":(r._isImported&&!r._isRequested&&(this._intrnlReq=!0,this._importSheet(n,!1)),this.XLEdit.getPropertyValue(t-1,i-1,"value",n))},setValueRowCol:function(n,i,r,u){if(r--,u--,r!==-2||u!==-2){var f,e,s={rowIndex:r,colIndex:u},h=!1,o,c;(typeof i=="string"&&(i=i.replace(/^\"|\"$/g,"")),n=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+n),f=this.getRangeData({range:[r,u,r,u],property:["value","formatStr","type","thousandSeparator","decimalPlaces"],sheetIdx:n})[0],f.formatStr&&(isNaN(parseInt(i))&&!isNaN(Date.parse(i))&&(i=new Date(i)),e=this.XLFormat._format(i,{formatStr:f.formatStr,type:f.type,thousandSeparator:f.thousandSeparator,decimalPlaces:f.decimalPlaces})),f.type=="fraction"&&(e=this.XLFormat._format(i,{type:f.type})),e=t.isNullOrUndefined(e)?i:e,this._isInitLoad&&!this.isImport&&(h=!0),o={value2:e,calcValue:this.XLEdit._parseValue(i,{rowIndex:r,colIndex:u}).value},f.type&&(o.type=f.type),c={isRefCells:!0,calcValue:o.calcValue,value:f.value,rowIndex:r,colIndex:u},this._isInitLoad||this.isImport||this.XLEdit._EditCellDetails.rowIndex===r&&this.XLEdit._EditCellDetails.columnIndex===u||!this._trigger("cellSave",c))&&(this.XLEdit._updateDataContainer(s,{dataObj:o,sheetIdx:n,skipCell:h}),this.XLEdit._refreshCellAlignment({cellIdx:s,value:i,type:f.type}))}},getActiveCellElem:function(n){n=this._getSheetIndex(n);var t=this.getSheet(n);return this.getCell(t._activeCell.rowIndex,t._activeCell.colIndex,n)},_hlDlgOpen:function(){var f=this.getActiveSheetIndex(),e=this.getActiveCellElem(f),o;if(!e.length||!this.model.allowEditing)return!1;if(this.XLEdit._rangeHasProperty(this.getSheet(f).selectedRange,"cellType")){this._showAlertDlg("Alert","CellTypeAlert","CellTypeAlert",372);return}var t=this._id,c,l=n("#"+t+"_Ribbon_webAddress"),a=n("#"+t+"_Ribbon_cellAddress"),s=n("#"+t+"_Ribbon_findText"),i,r=this.XLEdit.getPropertyValue(e.parent("tr").index(),e[0].cellIndex,"hyperlink",f),v,h,u=n("#"+t+"_Ribbon_cellText");n("#"+t+"_HLDialog").ejDialog("open");this._responsiveHeight<365&&n("#"+this._id+"_HLDialog_wrapper").css("top","0px");h=n("#"+t+"_Ribbon_sheentName").data("ejTreeView");h.option("fields",{dataSource:this.XLRibbon._sheetData()});c=n("#"+t+"_HLDialogTab").data("ejTab");u.attr("disabled",!1);s.attr("disabled",!1);this.isUndefined(r)?c.model.selectedItemIndex===0?(l.val("http://"),u.val("")):(h.selectNode(f+1),u.val(h.getText(f+1)+"!A1"),a.val("A1")):(this.isUndefined(r.webAddr)?c.option({selectedItemIndex:1}):c.option({selectedItemIndex:0}),this.isUndefined(r.cellAddr)?(l.val(r.webAddr),a.val("A1")):(a.val(r.cellAddr.split("_")[0]),v=parseInt(r.cellAddr.split("_")[1])+1,h.selectNode(v),l.val("http://")));n.validator&&(n("#"+t+"_Form_Ribbon_cellAddress").validate().resetForm(),n("#"+t+"_Form_Ribbon_webAddress").validate().resetForm());s.val("");i=this.XLEdit.getPropertyValueByElem(e);this.isUndefined(i)||(o=this.XLEdit.getPropertyValueByElem(e,"type"),this.isFormula(i)||o&&o.indexOf("date")>-1||n.isNumeric(i)||o&&o.indexOf("time")>-1?(u.val(this._getLocStr("HyperLinkHide")),s.val(this._getLocStr("HyperLinkHide")),u.attr("disabled",!0),s.attr("disabled",!0)):(u.val(i),s.val(i)))},_setLink:function(i){var o,h,s,c,e,y,l,a=this.getActiveSheetIndex(),p,u,r=this.getActiveCell(a),f,v;e=this.getSheet(a).selectedRange;n("#"+this._id+"_HLDialog").length||this.XLRibbon._initHLDialog();v=n("#"+this._id+"_HLDialogTab").ejTab("option","selectedItemIndex");o=n("#"+this._id+"_Ribbon_cellText").val();h=n("#"+this._id+"_Ribbon_cellAddress").val();s=n("#"+this._id+"_Ribbon_findText").val();c=n("#"+this._id+"_Ribbon_webAddress").val();l=n("#"+this._id+"_Ribbon_sheentName").data("ejTreeView");y=this._getSheetIndexByName(l.getSelectedNode().text()||this._getSheetNames()[this.getActiveSheetIndex()-1].text);o.length||s.length||(o=l.getSelectedNode().text()+"!"+h,s=c);f=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex);this._prevText=t.isNullOrUndefined(f)?"":this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2");this._prevVal=t.isNullOrUndefined(f)?"":this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value");u=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"type")&&(this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"type").indexOf("date")>-1||this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"type").indexOf("time")>-1)?this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2"):n.isNumeric(f)||this.isFormula(f)?f:v===0?s:o;this._isUndoRedo&&(u=i[0].prevText);this.XLEdit._updateCellValue(r,u);(this.isFormula(u)||n.isNumeric(u))&&(u=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2"));p=v===0?{webAddr:c,text:u}:{cellAddr:h,text:u};this.setHyperlink(this._getAlphaRange(a,e[0],e[1],e[2],e[3]),p,y,i);this._dlgHLClick=!1},_getRangeArgs:function(n,i,r){return t.isNullOrUndefined(n)&&(n=this.getSheet(r).selectedRange),i===typeof n?n:typeof n=="object"?this._getAlphaRange(this.getActiveSheetIndex(),n[0],n[1],n[2],n[3]):this.getRangeIndices(n)},setHyperlink:function(i,r,u,f){var h;if(i=this._getRangeArgs(i,"string"),this.model.allowHyperlink&&!this.model.isReadOnly){if(h={range:i,address:r.webAddr,text:r.text,sheetIndex:u,reqType:"hyperlink",action:"add"},this.XLEdit._rangeHasProperty(i,"cellType")){this._showAlertDlg("Alert","CellTypeAlert","CellTypeAlert",372);return}if(this._trigActionBegin(h))return;i=h.range;r.webAddr=h.address;r.text=h.text;u=h.sheetIndex;var y,s,rt,p,d,b,g=this.getActiveSheetIndex(),ut=this.getSheet(g),w,nt,l=[],tt,c,e,a,o=this._getAlphaRangeCells(i),v={sheetIndex:this.getActiveSheetIndex(),reqType:"hyperlink"},it,k;if(rng=this._getRangeArgs(i,"object"),selCellObj=this._getSelectedCells(v.sheetIndex,rng).selCells,v.action=t.isNullOrUndefined(this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"hyperlink"))?"add":"edit",this._isUndoRedo)for(e=0,a=selCellObj.length;e<a;e++)!f||t.isNullOrUndefined(f[e])||t.isNullOrUndefined(f[e].prevLink)||(this.XLEdit._updateDataContainer({rowIndex:selCellObj[e].rowIndex,colIndex:selCellObj[e].colIndex},{dataObj:{hyperlink:f[e].prevLink}}),this._isRowViewable(u,selCellObj[e].rowIndex)&&(it=n(o[e]).text(),n(o[e]).find("a").remove(),o[e].lastChild?o[e].lastChild.textContent="":n(o[e]).text(""),e===0?t.isNullOrUndefined(this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink").cellAddr)?n(o[e]).append(t.buildTag("a",f[e].prevText,"",{href:this.XLEdit.getPropertyValueByElem(n(o[e]),"hyperlink").webAddr,target:"_blank"})):n(o[e]).append(t.buildTag("a",f[e].prevText,"")):t.isNullOrUndefined(this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink").cellAddr)?n(o[e]).append(t.buildTag("a",it,"",{href:this.XLEdit.getPropertyValueByElem(n(o[e]),"hyperlink").webAddr,target:"_blank"})):n(o[e]).append(t.buildTag("a",it,"")),n(o[e]).find("a").addClass("e-hyperlinks")),this._dupDetails=!0,this.XLFormat.format({style:{color:this._hlColor}}),this._dupDetails=!1);else{for(t.isNullOrUndefined(r.webAddr)?(s=r.cellAddr,y=t.isNullOrUndefined(r.text)?this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value2"):r.text,s.indexOf("!")>-1&&(w=s.split("!"),u=w[0].indexOf("=")>-1?this._getSheetIndexByName(w[0].split("=")[1]):this._getSheetIndexByName(w[0]),s=w[1]),s.indexOf("$")>-1&&(cellAdr=s.split("$").join("")),nt=t.isNullOrUndefined(y)?s:y):(d=r.webAddr,p=t.isNullOrUndefined(r.text)?this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value2"):r.text,nt=t.isNullOrUndefined(p)?d:p),this._dlgHLClick||(k=this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value2"),this._prevText=t.isNullOrUndefined(k)?"":k,this._prevVal=t.isNullOrUndefined(k)?"":this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value"),this.XLEdit._updateCellValue({rowIndex:selCellObj[0].rowIndex,colIndex:selCellObj[0].colIndex},nt)),e=0,a=selCellObj.length;e<a;e++)l.push({rowIndex:selCellObj[e].rowIndex,colIndex:selCellObj[e].colIndex,prevLink:this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink"),prevColor:this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"formats")});for(this.isUndefined(h.text)||this.XLEdit._updateCellValue(selCellObj[0],h.text),this.isUndefined(s)?this.updateUniqueData({hyperlink:{webAddr:d}},rng):this.updateUniqueData({hyperlink:{cellAddr:s+"_"+u}},rng),e=0,a=selCellObj.length;e<a;e++)c=this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"value2"),l[e].prevText=e===0?this._prevText:c,l[e].prevVal=e===0?this._prevVal:this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"value"),this._isRowViewable(g,selCellObj[e].rowIndex)&&(n(o.eq(e).find("a")).remove(),this.XLEdit._refreshTextNode(o[e]),b=!0),tt=this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink",g),tt.cellAddr?(c=e===0?y:c,b&&o.eq(e).append(t.buildTag("a",c,"")),l[e].curText=y):(c=e===0?p:c,b&&o.eq(e).append(t.buildTag("a",c,"",{href:tt.webAddr,target:"_blank"})),l[e].curText=p),l[e].curLink=this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink"),b&&n(o[e]).find("a").addClass("e-hyperlinks");this._dupDetails=!0;this.XLFormat.format({style:{color:this._hlColor}},i);this._dupDetails=!1;v.selectedCell=l;rt={sheetIndex:this.getActiveSheetIndex(),reqType:"hyperlink",selectedCell:v.selectedCell,action:v.action,adrress:r.webAddr};ut._isImported&&(!ut._isLoaded||this._isExport)||(this._completeAction(v),this._trigActionComplete(rt))}}},removeHyperlink:function(n,i,r,u,f){if(!this.model.allowHyperlink||this.model.isReadOnly)return!1;var e,c,s,a,v=[],b=this._dupDetails,o,h=this.getActiveSheetIndex(),p=this.getSheet(h),w=[],y,l={sheetIndex:h,reqType:"hyperlink",action:"delete",range:n};for(o=this._getMultiRangeCells(n),e=0,c=o.length;e<c;e++)f&&this._isHiddenRow(o[e].rowIndex)||(s={rowIndex:o[e].rowIndex,colIndex:o[e].colIndex,prevLink:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"hyperlink"),prevText:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"value2"),prevVal:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"value"),prevColor:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"formats")},this._dupDetails=!0,s.prevLink&&(i?this.XLFormat.format({style:{"text-decoration":"underline"}},this._getAlphaRange(h,o[e].rowIndex,o[e].colIndex,o[e].rowIndex,o[e].colIndex)):(t.isNullOrUndefined(u)||this.isUndefined(u[e].prevColor)||(a=u[e].prevColor.color),this.XLFormat.format({style:{color:this.isUndefined(a)?"#444445":a,"text-decoration":"none"}},this._getAlphaRange(h,o[e].rowIndex,o[e].colIndex,o[e].rowIndex,o[e].colIndex))),s.curColor=this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"formats")),this._dupDetails=b,this.clearRangeData([o[e].rowIndex,o[e].colIndex,o[e].rowIndex,o[e].colIndex],["hyperlink"]),this._isUndoRedo||(s.curLink=this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"hyperlink")),this._isUndoRedo&&!this._dupDetails&&(t.isNullOrUndefined(u[e].prevText)||this.XLEdit._updateDataContainer({rowIndex:o[e].rowIndex,colIndex:o[e].colIndex},{dataObj:{value2:u[e].prevText,value:u[e].prevVal},sheetIdx:h})),this._isUndoRedo||(s.curText=this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"value2")),!this._isUndoRedo||this._dupDetails||t.isNullOrUndefined(u[e].prevLink)||(this.XLEdit._updateDataContainer({rowIndex:o[e].rowIndex,colIndex:o[e].colIndex},{dataObj:{hyperlink:u[e].prevLink}}),y={rowIndex:u[e].rowIndex,colIndex:u[e].colIndex},this.XLSelection.selectRange(y,y),this._setLink([u[e]]),v.push(e)),w.push(s));for(e=0,c=v.length;e<c;e++)o.splice(v[e],1);l.selectedCell=w;l.reqType=t.isNullOrUndefined(r)?"hyperlink":"clear-link";p._isImported&&!p._isLoaded||this._isUndoRedo||this._dupDetails||this._isExport||(this._completeAction(l),this._trigActionComplete(l))},_removeHyperlink:function(n,t,i,r){var u=this.getActiveSheetIndex(),r=r?r:this.getSheet(u).selectedRange;this.removeHyperlink(this._getAlphaRange(u,r[0],r[1],r[2],r[3]),n==="clear",n,t,i)},_openLink:function(){var n=this.getActiveSheetIndex(),t=this.getSheetElement(n).find(".e-activecell");this._hlClick(this.XLEdit.getPropertyValue(t.closest("tr").index(),t[0].cellIndex,"hyperlink",n))},_hlClick:function(n){var r,f,t,e,s=this.getActiveSheetIndex(),h=this._getLocStr("HyperLinkAlert").split("-"),o,u,i=this.getSheet(s);this.model.enableContextMenu&&this.XLCMenu.hideCMenu();n.cellAddr?(u=n.cellAddr.split("_"),o=u[0].indexOf("$")>-1?u[0].split("$").join(""):u[0],r=this.getRangeIndices(o),t={rowIndex:r[0],colIndex:r[1]},e={rowIndex:r[2],colIndex:r[3]},f=Number(u[1]),this.gotoPage(f,!1),i._activeCell=t,this.XLSelection.selectRange(t,e,f),i._startCell=t,i._endCell=e,this.XLScroll._scrollSelectedPosition(f,t),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()):(t={rowIndex:i._activeCell.rowIndex,colIndex:i._activeCell.colIndex},i._startCell=t,i._endCell=t,this._isValidUrl(n.webAddr)?window.open(n.webAddr,"_blank"):this._showAlertDlg("Alert","HyperLinkAlert"))},_isValidUrl:function(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)},showWaitingPopUp:function(){n("#"+this._id+"_wait").data("ejWaitingPopup").show()},hideWaitingPopUp:function(){n("#"+this._id+"_wait").data("ejWaitingPopup").hide()},_getSelRange:function(n){var t,i,r=this.getActiveSheetIndex();return t=n[0],i=n[n.length-1],this._generateHeaderText(t.colIndex+1)+(t.rowIndex+1)+":"+this._generateHeaderText(i.colIndex+1)+(i.rowIndex+1)},_getSelectedCells:function(n,i){var u,r,f=this.getSheet(n?n:this.getActiveSheetIndex());return t.isNullOrUndefined(i)?(u=f._selectedCells,u.length>0?(i=this._getSelRange(u),r=this.getRangeIndices(i)):(r=[0,0,0,0],u=[{rowIndex:0,colIndex:0}])):(r=this._getRangeArgs(i,"object"),u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]})),{range:r,selCells:u}},_getHiddenCells:function(i,r,u,f){var e=this._dataContainer.sheets[i],h,o,s;return t.isNullOrUndefined(f[u.rowIndex])&&(f[u.rowIndex]={}),t.isNullOrUndefined(f[u.rowIndex][u.colIndex])&&(f[u.rowIndex][u.colIndex]={value:{},text:""}),t.isNullOrUndefined(e[u.rowIndex])||(f[u.rowIndex][u.colIndex].value=n.extend(!0,{},e[u.rowIndex][u.colIndex]),h=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2",i),o=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"wrap",i),s=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"wrapRow",i),delete e[u.rowIndex][u.colIndex],f[u.rowIndex][u.colIndex].text=t.isNullOrUndefined(h)?"":h,(o||s)&&(t.isNullOrUndefined(e[u.rowIndex])&&(e[u.rowIndex]={}),t.isNullOrUndefined(e[u.rowIndex][u.colIndex])&&(e[u.rowIndex][u.colIndex]={}),o&&(e[u.rowIndex][u.colIndex].wrap=o),s&&(e[u.rowIndex][u.colIndex].wrapRow=s))),this._isRowViewable(i,r.rowIndex)&&(r=this.getCell(r.rowIndex,r.colIndex,i).empty()),f},_getRowSpan:function(n,i){for(var u=0,e=this.model.scrollSettings.allowVirtualScrolling,r=i[0].rowIndex,f=i[i.length-1].rowIndex;r<=f;r++)t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isRHide",n))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isFHide",n))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isFilterHide",n))&&(u=u+1);return u},_getColSpan:function(n,i){var u=0,e=this.model.scrollSettings.allowVirtualScrolling,o,r,f;for(e||(o=this._getJSSheetHeader(n).find("col")),r=i[0].colIndex,f=i[i.length-1].colIndex;r<=f;r++)t.isNullOrUndefined(this.XLEdit.getPropertyValue(0,r,"isCHide",n))&&(u=u+1);return u},_getHiddenRowColumnCount:function(n,i){var f=this.getRangeIndices(i),e=0,o=0,r,u,s=this.model.scrollSettings.allowVirtualScrolling,h;for(s||(h=this._getJSSheetHeader(n).find("col")),r=f[0];r<=f[2];r++)t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isRHide",n))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isFHide",n))||(e=e+1);for(u=f[1];u<=f[3];u++)(s||!s&&this._hasClass(h[u],"e-hide")||!t.isNullOrUndefined(this.XLEdit.getPropertyValue(0,u,"isCHide",n)))&&(o=o+1);return{hRow:e,hCol:o}},_updateMergeColl:function(n,i,r,u,f,e,o){var h=this.getSheet(n),s=h._mergeColl;t.isNullOrUndefined(s[i])?(s[i]={},s[i][r]={}):t.isNullOrUndefined(s[i][r])&&(s[i][r]={});s[i][r].type=u;f&&(s[i][r].isSamePosn=f);h.mergedCells.push({isCenterAlign:o,range:e})},mergeCells:function(i,r){if(!this.model.isReadOnly){var u,o,c=1,l=1,a,p=[],e=this.getActiveSheetIndex(),v=this.getSheet(e),b=n("#"+this._id+"_alertdlg"),f,h=!1,y,s=this._getRangeArgs(i,"object",e),w=s[2]-s[0]||s[3]-s[1];if(this.model.allowMerging&&(this.model.allowSelection||w)&&!(this.getSheetElement(e).find(".e-ss-activeimg").length>0)&&!this.model.isReadOnly){if(f=this._getSelectedCells(e,s).selCells,this._selMergeCells=[],this._mergeType="merge-cells",(!v._isImported||v._isLoaded)&&!this._isUndoRedo)if(this.performSelection(s),this.mergeCenter){for(h=!1,u=0,a=f.length;u<a;u++)o=this.XLEdit.getPropertyValue(f[u].rowIndex,f[u].colIndex,"merge",e),t.isNullOrUndefined(o)||(c=o.mSpan.rowSpan,l=o.mSpan.colSpan,(c>1||l>1)&&(y=this._getHiddenRowColumnCount(e,this.XLEdit.getPropertyValue(f[u].rowIndex,f[u].colIndex,"merge").mRange),this._unMergeAllCells(e,u,f,p,y.hRow,y.hCol),h=!0));!h||this._dupDetails||this._isUndoRedo||(t.isNullOrUndefined(i)&&(i=this._getSelRange(f)),details={sheetIndex:e,cells:f,range:i,reqType:"merge-cells",action:"un-merge",operation:"un-merge",mCells:p},this._completeAction(details),this._trigActionComplete(details));this.performSelection(s)}else for(u=0,a=f.length;u<a;u++)if(o=this.XLEdit.getPropertyValue(f[u].rowIndex,f[u].colIndex,"merge",e),t.isNullOrUndefined(o)||(c=o.mSpan.rowSpan,l=o.mSpan.colSpan),c===1&&l===1){h=!1;break}v._isImported&&!v._isLoaded||this._isUndoRedo||!this._rangeHasData(s)||r||h||!w?h||this._mergeCells(e,f,{},[]):this._showAlertDlg("","MergeCellsAlert","MergeCells",498);this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()}}},_mergeCells:function(i,r,u,f){var a,w,g=0,l=this._dataContainer.sheets[i],v,y,e,s,nt={},c,p,b,h=this.getSheet(i),k=this.XLEdit,d,it=h.columnsWidthCollection,o,tt;if(w=e=r[0].rowIndex,s=r[0].colIndex,this.model.scrollSettings.allowVirtualScrolling||(b=this._getJSSheetHeader(i).find("col")),(t.isNullOrUndefined(k.getPropertyValue(e,0,"isFRHide"))||t.isNullOrUndefined(k.getPropertyValue(e,0,"isRHide")))&&b&&b.eq(s).hasClass("e-fc-hide"))return{hideCell:[],mCells:[]};for(a={rowSpan:this._getRowSpan(i,r),colSpan:this._getColSpan(i,r)},t.isNullOrUndefined(l[e])||t.isNullOrUndefined(l[e][s])||(delete l[e][s].isMHide,delete l[e][s].mergeIdx),this._isRowViewable(i,e)&&(c=this.getCell(e,s),c[0].colSpan=a.colSpan,c[0].rowSpan=a.rowSpan,c[0].className=c[0].className.replace("e-mc-hide",""),this.mergeCenter&&c.addClass("e-calign "),c.hasClass("e-commentcell")&&this.model.allowComments&&this.XLComment._updateCmntArrowPos(c)),this._selMergeCells.push(r[0]),this._textClip(r[0].rowIndex,r[0].colIndex,"add"),this._textClip(r[0].rowIndex,r[0].colIndex,"delete","",!0),this._isRowViewable(i,r[0].rowIndex)&&this.addClass(this.getCell(r[0].rowIndex,r[0].colIndex)[0],"e-moverflow"),g=this._getRowHeight(r[0].rowIndex,i),o=1,tt=r.length;o<tt;o++)this._isRowViewable(i,r[o].rowIndex)&&(p=this.getCell(r[o].rowIndex,r[o].colIndex),this._hasClass(p[0],"e-mc-hide")||this.addClass(p[0],"e-mc-hide"),this.addClass(p[0],"e-moverflow")),w!==r[o].rowIndex&&h.hideRowsCollection.indexOf(r[o].rowIndex)==-1&&(g+=this._getRowHeight(r[o].rowIndex,i),w=r[o].rowIndex),this._textClip(r[o].rowIndex,r[o].colIndex,"add"),this._textClip(r[o].rowIndex,r[o].colIndex,"delete","",!0),u=this._getHiddenCells(i,{rowIndex:r[o].rowIndex,colIndex:r[o].colIndex},r[o],u),this.XLEdit._updateDataContainer({rowIndex:r[o].rowIndex,colIndex:r[o].colIndex},{dataObj:{isMHide:!0,mergeIdx:{rowIndex:e,colIndex:s}},sheetIdx:i}),this._selMergeCells.push(r[o]);return t.isNullOrUndefined(l[e])||n.extend(!0,nt,l[e][s]),y=this._getSelRange(r),h._activeCell=r[0],(!h._isImported||h._isLoaded)&&this.performSelection(r[0],r[r.length-1]),this.XLEdit._updateDataContainer({rowIndex:e,colIndex:s},{dataObj:{merge:{mSpan:a,isMerge:!0,mRange:y,isCenterAlign:this.mergeCenter}}}),this._updateMergeColl(i,e,s,this.mergeCenter?"center":"merge",null,y,this.mergeCenter),f.push({rowIndex:e,colIndex:s,prevObj:nt,curObj:n.extend(!0,{},l[e][s])}),k.getPropertyValue(e,s,"wrap")&&(d=this._getWrapCellHeight(i,e,s).rowHt,(this._getRowHeight(e,i)<=d||h._isImported||!h._isLoaded)&&this.setHeightToRows([{rowIndex:e,height:d}])),h._isImported&&!h._isLoaded||this._isUndoRedo||this._dupDetails||this._paste||this._mergeType!=="merge-cells"||(v={sheetIndex:i,cells:[{rowIndex:e,colIndex:s}],range:y,reqType:"merge-cells",action:"merge-all",hideCells:u,mCells:f},v.operation=this.mergeCenter?"merge-center":"merge-all",this._paste||(this._completeAction(v),this._trigActionComplete(v))),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),this.mergeCenter=!1,this._paste=!1,this.XLEdit._updateUsedRange(e+a.rowSpan,s+a.colSpan),{hideCells:u,mCells:f}},mergeAcrossCells:function(t,i){if(!this.model.isReadOnly){var u=this.getActiveSheetIndex(),f=this.getSheet(u),o=n("#"+this._id+"_alertdlg"),e,r;(r=this._getRangeArgs(t,"object",u),isMultiCell=r[2]-r[0]||r[3]-r[1],isMultiCol=r[3]-r[1],!this.model.allowMerging||this.getSheetElement(u).find(".e-ss-activeimg").length>0||!isMultiCell||this.model.isReadOnly)||(this._selMergeCells=[],e=this._getSelectedCells(u,r),this.isUndefined(t)||this.performSelection(r),!this._isUndoRedo&&this._rangeHasData(r)&&(!f._isImported||f._isLoaded)&&!i&&isMultiCol?this._showAlertDlg("","MergeCellsAlert","MergeAcrossCells",498):isMultiCol&&this._mergeAcrossCells(u,e.selCells),this.performSelection(r),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons())}},_mergeAcrossCells:function(i,r){var u,e,a,o,s=1,v=1,h=!0,c,y,p,w,b,l=[],f={mCells:[],hideCells:{}},k=this.getSheet(i);for(this._mergeType="merge-across",u=0,a=r.length;u<a;u++)if(o=this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"merge",i),t.isNullOrUndefined(o)||(s=o.mSpan.rowSpan,v=o.mSpan.colSpan),s===1&&v===1){h=!1;break}else s>1&&(h=!1);if(!h)for(w=r[0].rowIndex,b=r[r.length-1].rowIndex,y=r[0].colIndex,p=r[r.length-1].colIndex,u=w;u<=b;u++){for(l=[],e=y;e<=p;e++)l.push({rowIndex:u,colIndex:e});f=this._mergeCells(i,l,f.hideCells,f.mCells)}k._isImported&&!k._isLoaded||this._isUndoRedo||this._dupDetails||(c={sheetIndex:i,cells:n.extend(!0,[],this._selMergeCells),range:this._getSelRange(this._selMergeCells),reqType:"merge-cells",action:"merge-across",operation:"merge-across",hideCells:f.hideCells,mCells:f.mCells},this._paste||(this._completeAction(c),this._trigActionComplete(c)),this._paste=!1);this.performSelection(r[0],r[r.length-1])},unmergeCells:function(n){var u,l;if(!this.model.isReadOnly){var r=this.getActiveSheetIndex(),e=this.getSheet(r),o=[],i,s,h,f,a=e._clrMergeColl,c=this._getRangeArgs(n,"object",r);if(this.model.allowMerging&&!(this.getSheetElement(r).find(".e-ss-activeimg").length>0)&&!this.model.isReadOnly){for(this._selMergeCells=[],i=this._getSelectedCells(r,c).selCells,u=0,l=i.length;u<l;u++)f=this.XLEdit.getPropertyValue(i[u].rowIndex,i[u].colIndex,"merge",r),this.isUndefined(f)||(h=this._getHiddenRowColumnCount(r,f.mRange),o=this._unMergeAllCells(r,u,i,o,h.hRow,h.hCol),a.push({rowIdx:i[u].rowIndex,colIdx:i[u].colIndex,mergeObj:f}));t.isNullOrUndefined(n)&&(n=this._getSelRange(i));this.performSelection(c);e._isImported&&!e._isLoaded||this._isUndoRedo||this._dupDetails||this._isExport||(s={sheetIndex:r,cells:i,range:n,reqType:"merge-cells",action:"un-merge",operation:"un-merge",mCells:o},this._completeAction(s),this._trigActionComplete(s));this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()}}},_unMergeAllCells:function(i,r,u,f,e,o){var s,h,e,o,y,k,d=1,g=1,w,b=!1,l=this._dataContainer.sheets[i],rt={},p,nt,v,c,a,ut,tt,ft=this.getSheet(i),it;if(c=u[r].rowIndex,a=u[r].colIndex,rowhdrrows=this.getRows(i)[0],p=this.getCell(c,a),y=this.XLEdit.getPropertyValue(c,a,"merge",i),t.isNullOrUndefined(y)||(d=y.mSpan.rowSpan,g=y.mSpan.colSpan),g>1||d>1)for(tt=l[c][a],n.extend(!0,rt,tt),delete tt.merge,this._clearMergeColl(ft._mergeColl,c,a),this._isRowViewable(i,c)&&(p=this.getCell(c,a),this.XLEdit.getPropertyValue(c,a,"wrap",i)&&!this.XLEdit.getPropertyValue(c,a,"cellType",i)&&(k=p.find("#"+this._id+"_MergeWrap"),k.length&&(p[0].innerHTML=k[0].innerHTML,k.remove())),t.isNullOrUndefined(y.isCenterAlign)||p.removeClass("e-calign"),p[0].colSpan=p[0].rowSpan=1,it=p[0].offsetHeight,n(rowhdrrows[c]).height()<it&&this.XLEdit.getPropertyValue(c,a,"wrap")&&this.setHeightToRows([{rowIndex:c,height:it}]),this.XLScroll._getRowHeights(i,c)),f.push({rowIndex:c,colIndex:a,prevObj:rt,curObj:n.extend(!0,{},l[c][a])}),ut=[],s=c;s<c+d+e;s++)for(h=a;h<a+g+o;h++)this._selMergeCells.push({rowIndex:s,colIndex:h}),this._isRowViewable(i,s)&&(v=this.getCell(s,h,i),b=!0),t.isNullOrUndefined(this.XLEdit.getPropertyValue(s,h,"isMHide",i))||(this._isUndoRedo&&(w=this.XLEdit.getPropertyValue(s,h,"merge",i),t.isNullOrUndefined(w)||(w.mergeSpan.rowSpan>1||w.mergeSpan.colSpan>1)&&(ut.push({rowIndex:s,colIndex:h,rowSpan:w.mergeSpan.rowSpan,colSpan:w.mergeSpan.colSpan}),l[s][h].merge.mSpan={rowSpan:1,colSpan:1},v[0].rowSpan=1,v[0].colSpan=1)),mergeIdx=this.XLEdit.getPropertyValue(s,h,"mergeIdx",i),t.isNullOrUndefined(mergeIdx)||mergeIdx.rowIndex===c&&mergeIdx.colIndex===a&&(b&&(v.removeClass("e-mc-hide"),v[0].rowSpan=1,v[0].colSpan=1),delete l[s][h].isMHide,delete l[s][h].mergeIdx)),this._isUndoRedo&&!t.isNullOrUndefined(this._delCells)&&(t.isNullOrUndefined(this._delCells[s])||t.isNullOrUndefined(this._delCells[s][h])||t.isNullOrUndefined(l[s])||(nt=!t.isNullOrUndefined(l[s][h])&&l[s][h].overflow,l[s][h]=this._delCells[s][h].value,nt&&(l[s][h].overflow=nt),b&&v.text(this._delCells[s][h].text),y=this.XLEdit.getPropertyValue(s,h,"merge"),!t.isNullOrUndefined(y)&&y.isMerge&&this.mergeCells(y.mRange,!0))),b&&v.hasClass("e-commentcell")&&this.model.allowComments&&this.XLComment._updateCmntArrowPos(v),b&&(this._removeClass(v[0],"e-moverflow"),v.text().length>0?this._textClip(s,h,"add"):this._textClip(s,h,"delete")),t.isNullOrUndefined(l[s])||(this.getObjectLength(l[s][h])<1&&delete l[s][h],this.getObjectLength(l[s])<1&&delete l[s]);return f},_refreshMergeCells:function(){var i,t,r,n;for(this._dupDetails=!0,i=this._removeMergeColl,t=0,r=i.length;t<r;t++)this.unmergeCells(i[t].merge.mRange,!0);this._dupDetails=!1;n=this._insData;switch(n.value.status){case"shiftRight":this._insertShiftRight(n.sheetIdx,n.startCell,n.endCell,n.value);break;case"shiftBottom":this._insertShiftBottom(n.sheetIdx,n.startCell,n.endCell,n.value);break;case"shiftUp":this._deleteShiftUp(n.sheetIdx,n.startCell,n.endCell,n.value);break;case"shiftLeft":this._deleteShiftLeft(n.sheetIdx,n.startCell,n.endCell,n.value)}},_showHeadings:function(n,t){if(!this.model.isReadOnly){var t=t?t:this.getActiveSheetIndex(),i=this.getSheet(t),f=this._getJSSheetHeader(t),e=this._getContent(t).find(".e-content"),o=this._getJSSheetRowHeader(t),r=this.getFrozenRows(),u=this.getFrozenColumns();i.showHeadings=n;this._isDisplayHeader=!0;i.showHeadings?(o.show(),f.show(),e.removeClass("e-viewbrdr")):(o.hide(),f.hide(),e.addClass("e-viewbrdr"));this._heightWidthCalculation(t,{action:i._isLoaded?"":"initial"});this.model.showRibbon&&(checkObj=this.element.find("#"+this._id+"_Ribbon_PageLayout_Show_Headings").data("ejCheckBox"),checkObj&&(n?checkObj._checked():checkObj._unChecked()));this.model.allowFreezing&&i._isFreezed&&(this.XLFreeze.unfreezePanes(),this._isFrozen(r)&&this._isFrozen(u)?this.XLFreeze.freezePanes(r,u):this._isFrozen(r)?this.XLFreeze.freezeRows(r):this._isFrozen(u)&&this.XLFreeze.freezeColumns(u))}},showHeadings:function(n){this._showHeadings(n)},showGridlines:function(n){this._showGridlines(n)},_showGridlines:function(n,t){if(!this.model.isReadOnly){var t=t?t:this.getActiveSheetIndex(),i=this.getSheet(t),r=this._getContent(t).find(".e-rowcell");this.model.showRibbon&&(checkObj=this.element.find("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").data("ejCheckBox"),checkObj&&(n?checkObj._checked():checkObj._unChecked()));i.showGridlines=n;i.showGridlines?r.removeClass("e-hborder"):r.addClass("e-hborder")}},setSheetFocus:function(){this._hasClass(document.activeElement,"e-datepicker")||this.element.focus();this._isInitLoad||window.scrollTo(window.pageXOffset,window.pageYOffset)},_diffNumbers:function(n,t){return n-t},_isValidDate:function(n){var t,i;return/^\d{1,4}[\.|\/|-]\d{1,2}[\.|\/|-]\d{1,4}$/.test(n)?(n=n.replace(/0*(\d*)/gi,"$1"),t=n.split(/[\.|\/|-]/),t[0]=t[0]-1,t[2].length<4&&(t[2]=parseInt(t[2])<50?2e3+parseInt(t[2]):1900+parseInt(t[2])),i=new Date(t[2],t[0],t[1]),i.getDate()!=t[1]||i.getMonth()!=t[0]||i.getFullYear()!=t[2]?!1:!0):!1},_isValidTime:function(n){for(var t,r,i=0,o=!1,f,e,u=0,s=n.length;u<s;u++){if(t=n.substring(u,u+1),(t<"0"||t>"9")&&t!=":"&&t!=" "&&t!="a"&&t!="A"&&t!="p"&&t!="P"&&t!="m"&&t!="M")return!1;t==":"&&i++;(t=="p"||t=="P"||t=="a"||t=="A")&&(o=!0)}return i<1||i>2?!1:(r=n.substring(0,n.indexOf(":")),parseFloat(r)<0||parseFloat(r)>23)?!1:o&&(parseFloat(r)<1||parseFloat(r)>12)?!1:(f=i==2?n.substring(n.indexOf(":")+1,n.lastIndexOf(":")):n.substring(n.indexOf(":")+1,n.length),parseFloat(f)<0||parseFloat(f)>59)?!1:(e=i==2?n.substring(n.lastIndexOf(":")+1,n.length):"00",parseFloat(e)<0||parseFloat(e)>59)?!1:!0},_setXY:function(n,t){var i=0,r=0;return t=t?"page":"client",n.type==="mousemove"||n.type==="mousedown"||n.type==="mouseup"?(i=n[t+"X"],r=n[t+"Y"]):n.type==="touchmove"||n.type==="touchstart"||n.type==="touchend"?(i=n.originalEvent.changedTouches[0][t+"X"],r=n.originalEvent.changedTouches[0][t+"Y"]):(n.type==="MSPointerMove"||n.type==="pointermove"||n.type==="MSPointerUp"||n.type==="pointerup"||n.type==="MSPointerDown"||n.type==="pointerdown")&&(i=n.originalEvent[t+"X"],r=n.originalEvent[t+"Y"]),[i,r]},_getSelectedItems:function(n,i,r){var f,e,o,u;return n=n?n:this.getActiveSheetIndex(),u=this.getSheet(n),t.isNullOrUndefined(r)&&t.isNullOrUndefined(i)?(f=u._selectedCells,e=u._startCell,o=u._endCell,r=this._generateHeaderText(e.colIndex+1)+(e.rowIndex+1)+":"+this._generateHeaderText(o.colIndex+1)+(o.rowIndex+1)):(i=this.isUndefined(i)?this.getRangeIndices(r):i,f=this.getRange(i,n),r=this._generateHeaderText(i[1]+1)+(i[0]+1)+":"+this._generateHeaderText(i[3]+1)+(i[2]+1)),[f,r]},setBorder:function(n,t){if(this.model.allowCellFormatting&&!this.model.isReadOnly){var f="",e=!1,l=n.style,u=n.type,h=n.color,o,a,c,v,r,y,s=this._getContent(this.getActiveSheetIndex()).find("div:first-child");if(this.model.allowSelection||u!=="drawborder"&&u!=="drawbordergrid"){o=["bottom","top","left","right","outside","allborder"];a=["thickbox","thickbottom","topandbottom","topandthickbottom"];c={top:{top:""},right:{right:""},bottom:{bottom:""},left:{left:""},outside:{top:"",right:"",bottom:"",left:""},thickbox:{top:"2px solid",right:"2px solid",bottom:"2px solid",left:"2px solid"},thickbottom:{bottom:"2px solid"},topandbottom:{top:"1px solid",bottom:"1px solid"},topandthickbottom:{top:"1px solid",bottom:"2px solid"}};v={solid:"1px solid",dashed:"1px dashed",dotted:"1px dotted"};this.model.allowSelection&&(this.XLSelection._isGridBordering=this.XLSelection._isOutsideBordering=!1);switch(!0){case o.indexOf(u)>-1:e=u===o[5];r=c[e?o[4]:u];for(i in r)r[i]=v[l]+" "+h;e&&(r.isGridBorder=e);r.property=n;this.XLFormat.applyBorder(r,t);break;case a.indexOf(u)>-1:r=c[u];for(i in r)f="",y=r[i].split(" "),f=y.length===2?f+r[i]+" "+h:f+r[i]+" "+l+" "+h,r[i]=f;r.property=n;this.XLFormat.applyBorder(r,t);break;case u==="noborder":this.XLFormat.applyBorder("noborder",t);break;case u==="drawborder":this.XLSelection._isOutsideBordering=!0;s.removeClass("e-ss-cursor");s.addClass("e-ss-drwbrdrcursor");this.XLSelection._cleanUp(!0);break;case u==="drawbordergrid":this.XLSelection._isGridBordering=!0;s.removeClass("e-ss-cursor");s.addClass("e-ss-drwbrdrgridcursor");this.XLSelection._cleanUp(!0)}}}},clearBorder:function(n){this.model.isReadOnly||(n=this._getRangeArgs(n,"object"),this.XLFormat.removeStyle(n,{cellStyle:!0,tableStyle:!0,border:!0}))},clearHyperlinks:function(){this.model.allowClear&&!this.model.isReadOnly&&this._removeHyperlink("clear")},clearComments:function(n){this.model.allowClear&&!this.model.isReadOnly&&this.model.allowComments&&this.XLComment.deleteComment(r,n,!1,"clear")},clearAllFormat:function(i){if(this.model.allowClear&&!this.model.isReadOnly){var c,s=this.getActiveSheetIndex(),l=this._dataContainer.sheets[s],f=[],e,o,h=this.getSheet(s),r=this._getRangeArgs(i,"object"),a,u={sheetIndex:s,reqType:"clear-format",range:r};(u.bData=n.extend(!0,[],this.getRangeData({range:r,property:["format","tformats","type","formatStr","decimalPlaces","thousandSeparator","formats","hyperlink","cFormatRule"]})),this._dupDetails=!0,e=this.getObjectKeys(l),f[0]=r[0]>parseInt(e[0])?r[0]:parseInt(e[0]),f[2]=r[2]<parseInt(e[e.length-1])?r[2]:parseInt(e[e.length-1]),o=this.getObjectKeys(l[f[2]]),f[1]=r[1]>parseInt(o[0])?r[1]:parseInt(o[0]),f[3]=r[3]<parseInt(o[o.length-1])?r[3]:parseInt(o[o.length-1]),t.isNullOrUndefined(e))||(a=this._checkTableRange(this._getAlphaRange(s,f[0],f[1],f[2],f[3])),a.status!=="partial")&&(this.clearRangeData(r,["format","formatStr","decimalPlaces","thousandSeparator","formats","hyperlink","cFormatRule","border"],"",!1,u.reqType),this.clearBorder(i),this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(r),h._clrWrapColl=[],h._clrMergeColl=[],this._isPaste=!0,this.setWrapText("unwrap",r),this._isPaste=!1,this.unmergeCells(r),u.wrapColl=n.extend(!0,[],h._clrWrapColl),u.mergeColl=n.extend(!0,[],h._clrMergeColl),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),this._dupDetails=!1,this._isUndoRedo||(this._completeAction(u),c={sheetIndex:u.sheetIndex,reqType:u.reqType,range:u.range,prevData:u.bData,prevMergeColl:u.mergeColl,prevWrapColl:u.wrapColl},this._trigActionComplete(c)))}},clearContents:function(t){if(!this.model.isReadOnly){t=this._getRangeArgs(t,"object");var r=this.getActiveSheetIndex(),u,f=this.getRangeData({range:t,property:["value","value2","type","hyperlink"]}),i={sheetIndex:r,reqType:"clear-content",range:t,bData:n.extend(!0,[],f)};this.model.allowClear&&!this._isPropExists([t],"isReadOnly",r)&&(this.clearRangeData(t,["value","value2","hyperlink"],"",!1,i.reqType),this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t),this._completeAction(i),u={sheetIndex:i.sheetIndex,reqType:i.reqType,range:i.range,prevData:i.bData},this._trigActionComplete(u),this.setSheetFocus(),this.model.allowFormulaBar&&this.updateFormulaBar())}},clearAll:function(i){if(!this.model.isReadOnly){var e,o,l,c,s=this.getActiveSheetIndex(),h=this.getSheet(s),f=[],u=this._getRangeArgs(i,"object"),r={sheetIndex:s,reqType:"clear-all",range:u},a=this._dataContainer.sheets[s];if(this.model.allowClear&&!this._isPropExists([u],"isReadOnly",s)&&(this._dupDetails=!0,e=this.getObjectKeys(a),f[0]=u[0]>parseInt(e[0])?u[0]:parseInt(e[0]),f[2]=u[2]<parseInt(e[e.length-1])?u[2]:parseInt(e[e.length-1]),o=this.getObjectKeys(a[f[2]]),f[1]=u[1]>parseInt(o[0])?u[1]:parseInt(o[0]),f[3]=u[3]<parseInt(o[o.length-1])?u[3]:parseInt(o[o.length-1]),c=this._getAlphaRange(s,f[0],f[1],f[2],f[3]),!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(o))){if(r.bData=n.extend(!0,[],this.getRangeData({range:u,property:["value","value2","hyperlink","merge","rule","cFormatRule","comment","format","formatStr","formats","tformat","decimalPlaces","thousandSeparator","type","borders","tborders"],sheetIdx:s})),r.bBorder=this.XLFormat.getHashCodeClassAsArray(u),isTable=this._checkTableRange(c),isTable.status==="full")r.tblObj=isTable.tableObj,r.tblObj.tblId=isTable.tblId,r.tblObj.header=!0,this.XLFormat.removeTable(r.tblObj.tblId);else if(isTable.status==="partial")return;this.clearRangeData(u,["value","value2","hyperlink","cFormatRule","comment","format","formats","formatStr","decimalPlaces","thousandSeparator"],"",!1);this.clearBorder(c);this.model.allowFiltering&&this.XLFilter.clearFilter("remove");h._clrMergeColl=[];h._clrWrapColl=[];this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(u);this.model.allowDataValidation&&this.XLValidate.clearDV();this._isPaste=!0;this.setWrapText("unwrap",u);this._isPaste=!1;this.unmergeCells(u);r.mergeColl=n.extend(!0,[],h._clrMergeColl);r.wrapColl=n.extend(!0,[],h._clrWrapColl);this._dupDetails=!1;this.model.showRibbon&&(this.XLRibbon._updateRibbonIcons(),this.XLRibbon._toggleDesignTab(this.getActiveCell()));this._completeAction(r);l={sheetIndex:r.sheetIndex,reqType:r.reqType,range:r.range,prevData:r.bData,prevBorder:r.bBorder,tblObj:r.tblObj,mergeColl:r.mergeColl,wrapColl:r.wrapColl};this._trigActionComplete(l)}}},_checkTableRange:function(n,t){var e,o=this.getActiveSheetIndex(),s=this.model.sheets[o],r,u,h=this.getRangeIndices(n),i,f;return t?i=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"tableName"):(f=this.XLEdit._getPropWithCellIdx(h,"tableName"),f.length&&(i=f[0].value)),i?(r=this._getTableID(i),u=s.tableManager[r],tRange=u.range,e=this._getAlphaRange(o,tRange[0],tRange[1],tRange[2],tRange[3]),n===e?{status:"full",tableObj:u,tblId:r}:{status:"partial"}):{status:"no-table"}},_checkFilterRange:function(n,t){var u,s=this.getActiveSheetIndex(),h=this.getSheet(s),i,c=this.getRangeIndices(n),f,e,o=h.filterSettings.tableRange,r;if(t?f=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"isFilterHeader"):(e=this.XLEdit._getPropWithCellIdx(c,"isFilterHeader"),e.length&&(f=e[0].value)),f){for(r=0;r<o.length;r++)if(o[r].tableID===-1)return i=o[r],u=this._getAlphaRange(s,i.startRow-1,i.multifilterIdx[0],i.endRow,i.multifilterIdx[i.multifilterIdx.length-1]),n===u?{status:"full",tRange:u,tblId:-1}:{status:"partial"};return{status:"no-table"}}return{status:"no-table"}},clearTextNode:function(n,i){if(!t.isNullOrUndefined(n)&&!this.model.isReadOnly){var r=this.getActiveSheetIndex(),u=n[0].parentNode.rowIndex,f=n[0].cellIndex,o=this._dataContainer.sheets[r],e=n[0].childNodes[n[0].childNodes.length-1];(i=i||"",this._checkIndicesInContainer(r,u,f,"rule")&&o[u][f].rule.type==="list")||t.isNullOrUndefined(e)||e.hasChildNodes("a")||(n[0].lastChild.textContent=i)}},_isClassHasProperty:function(n,t,i){var r=this.XLFormat.getFormatFromHashCode(n);return r[t]&&r[t].toLowerCase()===i?!0:!1},_changeTargetWithOffset:function(t){var r,i=n(t.target),u=t.offsetX||t.pageX-i.offset().left;if(this._hasClass(document.activeElement,"e-datepicker")&&t.type==="mouseup"&&n("#"+this._id).focus(),i.is("a")&&(r=t.target,t.target=t.target.parentNode),i.is("#"+this._id+"_MergeWrap"))return i.parents().closest("td")[0];if(this._hasClass(i.parents().closest("td"),"e-cellreadonly"))return this._hasClass(i,"e-datepicker")&&t.type==="mouseup"&&i.focus(),i.parents().closest("td")[0];if(i.is("td")&&this._hasClass(i,"e-cellreadonly")&&i.find(".e-chk-image").length>0&&t.type==="mouseup")return n("#"+i.find(".e-checkbox")[0].id).ejCheckBox("instance")._checkedHandler(),t.target;if((u>t.target.offsetWidth||u<0)&&i.is("td")&&i.parents(".e-spreadsheetmainpanel").length&&this._hasClass(i,"e-rowcell")){var f=this.getSheet(this.getActiveSheetIndex()),e=this._getCellIdx(t.target),o=f._colWidthCollection[e.colIndex]+u,s=f._rowHeightCollection[e.rowIndex];return r&&this.addClass(r,"e-rmanchor"),this.getCell(this.XLShape._getCellIndexFromOffset(s,o).rowIndex,this.XLShape._getCellIndexFromOffset(s,o).colIndex)[0]}return r?(this._removeClass(r,"e-rmanchor"),r):(this._removeClass(i.find("a")[0],"e-rmanchor"),t.target)},_textClip:function(n,i,r,u,f){var g,e,v,o;if(this._canOverflow&&!this.XLEdit.getPropertyValue(n,i,"merge")&&!this.XLEdit.getPropertyValue(n,i,"wrap")){var p,w,y,a,nt,l,et,it,ct,ot,c,st,rt,ut=!1,d=!1,b=!1,ht=!1,s=this.XLEdit,h=this.getActiveSheetIndex(),ft=this.getSheet(h),k=ft._isLoaded||this.isImport,g=this.getCell(n,i),tt=s.getPropertyValue(n,i,"format",h);if(g&&(y=g[0]),this._isClassHasProperty(tt,"text-align","right")&&(b=!0),!(s.getPropertyValue(n,i,"cellType",h)>-1)){if(this._dupDetails||(this._dupDetails=ut=!0),r==="add"){if(!this.model.allowOverflow){this.addClass(y,"e-overflow");s._updateDataContainer({rowIndex:n,colIndex:i},{dataObj:{isOverflow:!1},skipCell:!0});ut&&(this._dupDetails=!1);return}if(this._hasClass(y,"e-overflow")&&this._removeClass(y,"e-overflow"),this.clearRangeData([n,i,n,i],["isOverflow"],"","","",!0),s.getPropertyValue(n,i+1,"value2",h)&&!b&&(d=!0),d||(ct=ft._rowHeightCollection,ot=ft._ofColWidthColl,rt=y?this.XLFormat.getFormatFromHashCode(this.XLFormat.getFormatClass(y.className)):{},u||(span=document.getElementById(this._id+"_emptySpan"),this.addClass(span,"e-rowcell e-wrapword"),this.addClass(span,tt),span.textContent=s.getPropertyValue(n,i,"value2",h),u="text-indent"in rt?Math.round(4/3*Number(rt[t.Spreadsheet.SupportedStyles.TextIndent].replace("pt",""))+this._detailsFromGlobalSpan(n,i,"width",span.textContent)):span.offsetWidth),this._refreshGlobalSpan(span),et=this.XLShape._getCellIndexFromOffset(null,ot[i]+u,h,!0),w=et.colIndex-i),!f&&s.getPropertyValue(n,i,"value2",h)&&(c=s.getPropertyValue(n,i,"overflow",h),!t.isNullOrUndefined(c)&&c.rowIndex===n))if(it=this.getCell(c.rowIndex,c.colIndex),it&&this.addClass(it[0],"e-overflow"),s._updateDataContainer({rowIndex:c.rowIndex,colIndex:c.colIndex},{dataObj:{isOverflow:!1},skipCell:!0}),c.colIndex<i)for(e=0,v=c.cellCount;e<=v;e++)e!==0&&this.clearRangeData([n,c.colIndex+e,n,c.colIndex+e],["overflow"],"","","",!0),e!==v&&(a=this.getCell(n,c.colIndex+e),k&&a&&this._removeClass(a[0],"e-ofbrdr"),this.clearRangeData([n,c.colIndex+e,n,c.colIndex+e],["isOfBrdr"],"","","",!0));else for(e=c.cellCount;e>0;e--)this.clearRangeData([n,c.colIndex-e,n,c.colIndex-e],["overflow"],"","","",!0),a=this.getCell(n,c.colIndex-e),k&&a&&this._removeClass(a[0],"e-ofbrdr"),this.clearRangeData([n,c.colIndex-e,n,c.colIndex-e],["isOfBrdr"],"","","",!0);if(b||d){for(e=i-1,v=i-w;e>=v;e--)if(l=s.getPropertyValue(n,e,"overflow",h),l&&l.colIndex!==i&&!ht&&(ht=!0,this._textClip(l.rowIndex,l.colIndex,"delete","",!0),g=this.getCell(l.rowIndex,l.colIndex),g&&this.addClass(g[0],"e-overflow")),s.getPropertyValue(n,e,"value2",h)){d=!0;break}}else for(e=1;e<=w;e++)if(s.getPropertyValue(n,i+e,"value2",h)||s.getPropertyValue(n,i+e,"merge",h)||s.getPropertyValue(n,i+e,"isMHide",h)||s.getPropertyValue(n,i+e,"overflow",h)&&s.getPropertyValue(n,i+e,"overflow",h).colIndex!==i){d=!0;break}if(d)this.addClass(y,"e-overflow"),s._updateDataContainer({rowIndex:n,colIndex:i},{dataObj:{isOverflow:!1},skipCell:!0});else if(w!==0)for(e=0;e<=w;e++)nt=b?i-e:i+e,e&&s._updateDataContainer({rowIndex:n,colIndex:nt},{dataObj:{overflow:{rowIndex:n,colIndex:i,cellCount:w}},skipCell:!0}),((!b||b&&e!==0)&&e!==w||e===w&&b)&&(k&&this._isRowViewable(h,n)&&this.addClass(this.getCell(n,nt)[0],"e-ofbrdr"),s._updateDataContainer({rowIndex:n,colIndex:nt},{dataObj:{isOfBrdr:!0},skipCell:!0}))}else if(r==="delete"){if(st=this._dataContainer.sheets[h],keys=this.getObjectKeys(st[n]),this._hasClass(y,"e-overflow"))this._removeClass(y,"e-overflow"),this.clearRangeData([n,i,n,i],["isOverflow"],"","","",!0);else if(b){if(l=s.getPropertyValue(n,i-1,"overflow",h),!t.isNullOrUndefined(l)&&l.colIndex===i)for(o=i-1,v=i-l.cellCount;o>=v;o--)this.clearRangeData([n,o,n,o],["overflow"],"","","",!0),k&&(a=this.getCell(n,o),a&&this._removeClass(a[0],"e-ofbrdr")),this.clearRangeData([n,o,n,o],["isOfBrdr"],"","","",!0)}else if(l=s.getPropertyValue(n,i+1,"overflow",h),!t.isNullOrUndefined(l)&&l.colIndex===i)for(o=i,v=i+1+l.cellCount;o<v;o++)o!==i&&this.clearRangeData([n,o,n,o],["overflow"],"","","",!0),o!==v&&(k&&(a=this.getCell(n,o),a&&this._removeClass(a[0],"e-ofbrdr")),this.clearRangeData([n,o,n,o],["isOfBrdr"],"","","",!0));if(!f&&this.model.allowOverflow){for(o=keys.indexOf(i.toString())-1;o>-1;o--)if(k&&(p=this.getCell(n,keys[o])),s.getPropertyValue(n,keys[o],"value2",h)||s.getPropertyValue(n,keys[o],"isMHide",h)){this._hasClass(p,"e-overflow")&&(p&&this._removeClass(p[0],"e-overflow"),this.clearRangeData([n,keys[o],n,keys[o]],["isOverflow"],"","","",!0),this._textClip(n,parseInt(keys[o]),"add"));break}for(o=keys.indexOf(i.toString())+1;o<keys.length;o++)if(k&&(p=this.getCell(n,keys[o])),s.getPropertyValue(n,keys[o],"value2",h)||s.getPropertyValue(n,keys[o],"isMHide",h)){tt=s.getPropertyValue(n,keys[o],"format",h);this._hasClass(p,"e-overflow")&&this._isClassHasProperty(tt,"text-align","right")&&(p&&this._removeClass(p[0],"e-overflow"),this.clearRangeData([n,keys[o],n,keys[o]],["isOverflow"],"","","",!0),this._textClip(n,parseInt(keys[o]),"add"));break}}}ut&&(this._dupDetails=!1)}}},selectAll:function(n){if(this.model.allowSelection){var y=[],w=[],k=[],b=[],r,i,s,g=!1,p=0,v=this.XLEdit,nt=this.getActiveCell(),e=nt.rowIndex,o=nt.colIndex,a=this.getActiveSheetIndex(),rt=this._dataContainer.sheets[a],d=this.getObjectKeys(rt),ut=parseInt(d[0]),ft=parseInt(d[d.length-1]),c=this.getSheet(a),tt=this._getUsedRangeFromSheet(a,!1),it=tt.rowCount+tt.colCount;if(c._startCell.rowIndex!==c._endCell.rowIndex||c._startCell.colIndex!==c._endCell.colIndex&&c._isMultiSelect){var f={rowIndex:c._startCell.rowIndex,colIndex:c._startCell.colIndex},u={rowIndex:c._endCell.rowIndex,colIndex:c._endCell.colIndex},l={rowIndex:c._startCell.rowIndex,colIndex:c._startCell.colIndex},h={rowIndex:c._endCell.rowIndex,colIndex:c._endCell.colIndex};for(g=!0,r=1;r<it;r++){for(i=l.colIndex;i<h.colIndex+2;i++)(v.getPropertyValue(l.rowIndex-1,i,"value2")||this._getDataObj(l.rowIndex-1,i,"mergeIdx",a))&&(f.colIndex=l.colIndex<i?l.colIndex:i,u.colIndex=h.colIndex>i?h.colIndex:i,f.rowIndex=l.rowIndex<l.rowIndex-1?l.rowIndex:l.rowIndex-1);for(i=l.rowIndex;i<h.rowIndex+2;i++)(v.getPropertyValue(i,h.colIndex+1,"value2")||this._getDataObj(i,h.colIndex+1,"mergeIdx",a))&&(u.rowIndex=h.rowIndex>i?h.rowIndex:i);for(i=h.colIndex;i>l.colIndex-2;i--)(v.getPropertyValue(h.rowIndex+1,i,"value2")||this._getDataObj(h.rowIndex+1,i,"mergeIdx",a))&&(u.rowIndex=h.rowIndex>h.rowIndex+1?h.rowIndex:h.rowIndex+1,f.colIndex=l.colIndex<i?l.colIndex:i);for(i=h.rowIndex;i>l.rowIndex-2;i--)(v.getPropertyValue(h.rowIndex+1,i,"value2")||this._getDataObj(h.rowIndex+1,i,"mergeIdx",a))&&(u.rowIndex=h.rowIndex>h.rowIndex+1?h.rowIndex:h.rowIndex+1,f.colIndex=l.colIndex<i?l.colIndex:i);if(u.colIndex===h.colIndex&&u.rowIndex===h.rowIndex&&f.rowIndex===l.rowIndex&&f.colIndex===l.colIndex)if(r===1){c._isRangeSelected=!0;break}else{c._isRangeSelected=!1;break}l={rowIndex:f.rowIndex,colIndex:f.colIndex};h={rowIndex:u.rowIndex,colIndex:u.colIndex}}}if(!c._isRangeSelected&&!g){var f={rowIndex:e,colIndex:o},u={rowIndex:e,colIndex:o},l={rowIndex:e,colIndex:o},h={rowIndex:e,colIndex:o};for(r=1;r<it+1;r++){for(i=-p;i<p+1;i++)(v.getPropertyValue(e+i,o+r,"value2")||this._getDataObj(e+i,o+r,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+i?u.rowIndex:e+i,u.colIndex=u.colIndex>o+r?u.colIndex:o+r);for((v.getPropertyValue(e+r,o+r,"value2")||this._getDataObj(e+r,o+r,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+r?u.rowIndex:e+r,u.colIndex=u.colIndex>o+r?u.colIndex:o+r),i=-p;i<p+1;i++)(v.getPropertyValue(e+r,o+i,"value2")||this._getDataObj(e+r,o+i,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+r?u.rowIndex:e+r,u.colIndex=u.colIndex>o+i?u.colIndex:o+i);if(!v.getPropertyValue(e,o,"value2")&&u.colIndex===h.colIndex&&u.rowIndex===h.rowIndex&&f.rowIndex===l.rowIndex&&f.colIndex===l.colIndex&&p===0){c._isRangeSelected=!0;break}for((v.getPropertyValue(e+r,o-r,"value2")||this._getDataObj(e+r,o-r,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+r?u.rowIndex:e+r,f.colIndex=f.colIndex<o-r?f.colIndex:o-r),i=-p;i<p+1;i++)(v.getPropertyValue(e+i,o-r,"value2")||this._getDataObj(e+i,o-r,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e+i?f.rowIndex:e+i,f.colIndex=f.colIndex<o-r?f.colIndex:o-r,u.rowIndex=u.rowIndex>e+i?u.rowIndex:e+i);for((v.getPropertyValue(e-r,o-r,"value2")||this._getDataObj(e-r,o-r,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e-r?f.rowIndex:e-r,f.colIndex=f.colIndex<o-r?f.colIndex:o-r),i=-p;i<p+1;i++)(v.getPropertyValue(e-r,o+i,"value2")||this._getDataObj(e-r,o+i,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e-r?f.rowIndex:e-r,f.colIndex=f.colIndex<o+i?f.colIndex:o+i,u.colIndex=u.colIndex>o+i?u.colIndex:o+i);if((v.getPropertyValue(e-r,o+r,"value2")||this._getDataObj(e-r,o+r,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e-r?f.rowIndex:e-r,u.colIndex=u.colIndex>o+r?u.colIdx:o+r),u.colIndex===h.colIndex&&u.rowIndex===h.rowIndex&&f.rowIndex===l.rowIndex&&f.colIndex===l.colIndex)if(p!==0){c._isRangeSelected=!1;break}else{c._isRangeSelected=!0;break}l={rowIndex:f.rowIndex,colIndex:f.colIndex};h={rowIndex:u.rowIndex,colIndex:u.colIndex};p++;y.push(u.colIndex);w.push(f.rowIndex);k.push(u.rowIndex);b.push(f.colIndex)}for(b=t.dataUtil.mergeSort(t.distinct(b)),f.colIndex=b[b.length-1],s=b.length-1;s>-1;s--)if(b[s-1]===b[s]-1)f.colIndex=b[s-1];else break;for(k=t.dataUtil.mergeSort(t.distinct(k)),u.rowIndex=k[0],s=0,len=k.length-1;s<len;s++)if(k[s+1]===k[s]+1)u.rowIndex=k[s+1];else break;for(w=t.dataUtil.mergeSort(t.distinct(w)),f.rowIndex=w[w.length-1],s=w.length-1;s>-1;s--)if(w[s-1]===w[s]-1)f.rowIndex=w[s-1];else break;for(y=t.dataUtil.mergeSort(t.distinct(y)),u.colIndex=y[0],s=0,len=y.length-1;s<len;s++)if(y[s+1]===y[s]+1)u.colIndex=y[s+1];else break;for(s=0,len=y.length-1;s<len;s++)if(y[s+1]===y[s]+1)u.colIndex=y[s+1];else break}c._isEmptyActiveCell||(!c._isRangeSelected&&!d.length<1?(this.XLSelection.selectRange(f,u,a,n),c._isMultiSelect=!1,c._startCell=f,c._endCell=u,c._isRangeSelected=!0,c._isEmptyActiveCell=v.getPropertyValue(e,o,"value2")?!1:!0):(this.XLSelection.selectSheet(),c._isRangeSelected=!0))}},_getDataObj:function(n,t,i,r){var u=this._dataContainer.sheets[r?r:this.getActiveSheetIndex()];return u[n]&&u[n][t]?u[n][t][i]:!1},_getUsedRangeFromSheet:function(n,t){n=this._getSheetIndex(n);var u,e=this.getSheet(n),s=this._dataContainer,o=s.sheets[n],f=this.getObjectKeys(o),r={rowIndex:parseInt(f[0])||0,colIndex:0},i={rowIndex:parseInt(f[f.length-1])||0,colIndex:0};for(u=0,length=f.length;u<length;u++)colKeys=this.getObjectKeys(o[parseInt(f[u])]),u===0?(r.colIndex=parseInt(colKeys[0]),i.colIndex=parseInt(colKeys[colKeys.length-1])):(r.colIndex=r.colIndex<parseInt(colKeys[0])?r.colIndex:parseInt(colKeys[0]),i.colIndex=i.colIndex>parseInt(colKeys[colKeys.length-1])?i.colIndex:parseInt(colKeys[colKeys.length-1]));return i.rowIndex<e.usedRange.rowIndex&&(i.rowIndex=e.usedRange.rowIndex),i.colIndex<e.usedRange.colIndex&&(i.colIndex=e.usedRange.colIndex),t?this._getAlphaRange(n,r.rowIndex,r.colIndex,i.rowIndex,i.colIndex):{startCell:r,endCell:i,rowCount:i.rowIndex-r.rowIndex+1,colCount:i.colIndex-r.colIndex+1}},sheetRename:function(n){this.model.isReadOnly||this._updateSheetNames(n)},_isSubMenuOpen:function(){for(var i=["_formatastable","_cellstyles","_Ribbon_CElement","_contextMenuCell","_contextMenuColumnHeader","_contextMenuRowHeader","_contextMenuFooter"],t=0,r=i.length;t<r;){if(n("#"+this._id+i[t]).is(":visible"))return!0;t++}return!1},copySheet:function(n,i,r){if(!this.model.isReadOnly){var y=this._getSheetIndex(y),u,f,a,e,v=!1,c=2,h,s=this.model.sheets,o=this.element.find(".e-numericcontainer").children().eq(n-1),l=i;if(!r&&s[l].sheetInfo.text===o.text()){this.setSheetFocus();return}for(f=1,a=s.length;f<a;f++)s.length-1!==l&&s[l].sheetInfo.text===s[f].sheetInfo.text&&(u=f),o.text()===s[f].sheetInfo.text&&(h=f);if(r){for(o.text().match(".*[ ]+[(]+[0-9]+[)]$")===null?e=o.text()+" ("+c+")":o.text().lastIndexOf(" ")>-1&&(c=parseInt(o.text().substring(o.text().lastIndexOf("(")+1,o.text().lastIndexOf(")"))),e=o.text().substring(0,o.text().lastIndexOf(" "))+" ("+c+")");!v;){for(e=e.substring(0,e.lastIndexOf(" "))+" ("+c+")",f=1,a=s.length;f<a;f++)e===s[f].sheetInfo.text&&c++;c===parseInt(e.substring(e.lastIndexOf("(")+1,e.lastIndexOf(")")))&&(v=!0)}this._copySheetProcess(h,e);h=this.model.sheetCount;t.isNullOrUndefined(u)&&(u=h)}else!t.isNullOrUndefined(u)&&u>h&&(u=u-1);t.isNullOrUndefined(u)&&(u=l);r||u!==h?(this._swapSheetDtCntr(h,u),this.getPager().ejPager("option",{currentPage:l}),this.gotoPage(l,!1),this.setSheetFocus()):this.setSheetFocus()}},getHyperlink:function(n){return this.XLEdit.getPropertyValueByElem(n,"hyperlink",this.getActiveSheetIndex())},getComment:function(n){return this.XLEdit.getPropertyValueByElem(n,"comment",this.getActiveSheetIndex())},saveAsJSON:function(){var nt,u,tt,w;if(!this.model.isReadOnly){var y,c,e=1,i,f,s,b,o,l,a,r,k=[],it,v,d,p,g,t,h,rt=["_activeCell","_endCell","_startCell","colCount","rowHeight","columnWidth","columnsWidthCollection","rowsHeightCollection","rowCount","frozenColumns","frozenRows","styleIndex","usedRange","sheetName","dataAttribute","filterSettings","tableManager","sheetInfo","hideColsCollection","hideRowsCollection","mergedCells","showGridlines","showHeadings","isSheetProtected","shapeMngr","pivotMngr","chart","rangeSettings","cellTypes","startCell","primaryKey","showHeader","fieldAsColumnHeader","headerStyles","rows"],ut=["type","value","value2","decimalPlaces","format","formats","borders","formatStr","comment","hyperlink","rule","cFormatRule","wrap","merge","picture","chart","pivot","thousandSeparator","isLocked","align","isRHide"];this._isSaveAsJSON=!0;this._isExport=!0;this.model.exportSettings.allowExporting&&this.XLExport._renderAll();this._isExport=!1;y={dataContainer:n.extend(!0,{},this._dataContainer),model:n.extend(!0,{},this.model)};f=y.dataContainer;s=y.model;it=b=f.hashCode.length;v=f.sheetCellType;f.sheetCellType={};for(t in f.hashCode)r=f.hashCode[t],r.indexOf("e-border")>-1&&r.length<25&&k.push(r);for(t=0;t<k.length;t++)f.hashCode.splice(f.hashCode.indexOf(k[t]),1);t="sheets";for(o in f[t])for(l in f[t][o]){for(a in f[t][o][l]){for(r in f[t][o][l][a])["format","formats","borders"].indexOf(r)>-1&&(nt=this._dataContainer.hashCode[this._dataContainer[t][o][l][a][r]],f[t][o][l][a][r]=f.hashCode.indexOf(nt)),ut.indexOf(r)<0&&delete f[t][o][l][a][r];this.getObjectLength(f[t][o][l][a])||delete f[t][o][l][a]}this.getObjectLength(f[t][o][l])||delete f[t][o][l]}for(t in s)s[t]===this.defaults[t]||Object.prototype.toString.call(s[t])===Object.prototype.toString()?delete s[t]:Array.isArray(s[t])&&(s[t].length||delete s[t]);for(c=s.sheets;e<c.length;){i=c[e];for(t in i){switch(t){case"frozenColumns":case"frozenRows":i[t]===0&&delete i[t];break;case"fieldAsColumnHeader":case"isSheetProtected":i[t]||delete i[t];break;case"showHeadings":case"showGridlines":case"showHeader":i[t]&&delete i[t];break;case"filterSettings":for(r in i[t])r==="range"?this._isEmptyString(i[t][r])&&delete i[t][r]:delete i[t][r];break;case"sheetInfo":for(r in i[t])if(r!=="text"){if(r==="isVisible"&&!i[t][r])continue;delete i[t][r]}break;case"_startCell":case"_endCell":case"_activeCell":case"usedRange":for(r in i[t])i[t][r]===0&&delete i[t][r];break;case"columnWidth":i[t]===64&&delete i[t];break;case"rowHeight":i[t]===20&&delete i[t];break;case"primaryKey":i[t].length||delete i[t];break;case"startCell":i[t]==="A1"&&delete i[t]}rt.indexOf(t)<0||i[t]===null?delete i[t]:Object.prototype.toString.call(i[t])===Object.prototype.toString()?this.getObjectLength(i[t])||delete i[t]:Array.isArray(i[t])&&(i[t].length||delete i[t])}if(p=c[e].shapeMngr.picture,g={},this.getObjectLength(p)){h=0;for(t in p)g["picture"+h]=p[t],h++;c[e].shapeMngr.picture=n.extend(!0,{},g)}if(charts=c[e].shapeMngr.chart,chartMngr={},this.getObjectLength(charts)){h=0;for(t in charts)u=n.extend(!0,{},charts[t]),tt={commonSeriesOptions:{type:u.type,marker:u.marker},enable3D:u.enable3D,top:u.top,left:u.left,size:{width:u.width,height:u.height},title:u.title,legend:u.legend,primaryXAxis:u.xAxis,primaryYAxis:u.yAxis,dataSheetIdx:u.dataSheetIdx,animation:u.animation,isRowColSwitched:u.isRowColSwitched,colIndex:u.colIndex,rowIndex:u.rowIndex,theme:u.theme,range:this._getAlphaRange(e,u.range[0],u.range[1],u.range[2],u.range[3])},u.colIndex&&u.rowIndex?f.sheets[e][u.rowIndex][u.colIndex].chart=[]:f.sheets[e][u.activeCell.rowIndex][u.activeCell.colIndex].chart=[],chartMngr["chart"+h]=tt,h++;c[e].shapeMngr.chart=chartMngr}if(tables=c[e].tableManager,tbMngr={},this.getObjectLength(tables)){h=0;for(t in tables){w=n.extend(!0,{},tables[t]);delete w.format;for(r in s.nameManager)s.nameManager[r].name===w.name&&s.nameManager.splice(parseInt(r),1);tbMngr[h]=w;h++}c[e].tableManager=tbMngr}i.cellTypes=[];b=this.getObjectLength(v);b&&(f.sheetCellType[e]={});h=1;for(t in v)(r=v[t],this.getObjectLength(r))&&(d=r.id.split("_")[2],o=parseInt(d.match(/[0-9]+/)[0]),e===o&&(delete r.id,r.range=d.replace(/[0-9]+/,""),f.sheetCellType[e][h]={settings:r},v[t]={},h++));c[e]._scrollTop=this.getSheet(e)._scrollTop;c[e]._scrollLeft=this.getSheet(e)._scrollLeft;e++}return this._isSaveAsJSON=!1,y}},_isvalidRange:function(n){var t=new RegExp(/^\$?(?:\b[a-z]{1,3})\$?(?:\d{1,7}):\$?(?:\b[a-z]{1,3})\$?(?:\d{1,7})$/i);return t.test(n)},_renderFUpload:function(){this.element.append(t.buildTag("div","",{height:"0px"},{id:this._id+"_file"}));n("#"+this._id+"_file").ejUploadbox({width:"0px",height:"0px",uploadName:"file",autoUpload:!0,showFileDetails:!1,dialogAction:{content:this.element},saveUrl:this.model.importSettings.importMapper,fileSelect:n.proxy(this._fileSelect,this),complete:n.proxy(this._changeImport,this),error:n.proxy(this._importFailed,this)});n("#"+this._id+"_file_SelectButton").hide()},_fileSelect:function(t){if(t.files.length){var r=t.files[0],i=r.extension;if(this._uploadImage&&i===".xlsx"||!this._uploadImage&&((this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10)?i.indexOf("jpg")>-1||i.indexOf("png")>-1||i.indexOf("jpeg")>-1||i.indexOf("gif")>-1:r.rawFile.type.indexOf("image")>-1))return this._showAlertDlg("Alert","CorrectFormat","",290),this._uploadImage=!1,!1;if(this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10||this._uploadImage)this.showWaitingPopUp();else return n("#"+this._id+"_file").ejUploadbox("option","autoUpload",!1),this["import"]({file:r.rawFile,password:this._encrypt(this.model.importSettings.password),allowSheetOnDemand:this.model.importSettings.allowSheetOnDemand}),this._uploadImage=!1,!1;this._uploadImage=!1}},_changeImport:function(t){var r,i=n("#"+this._id+"_file").data("ejUploadbox");((this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10)?t.files[0].extension.indexOf("jpg")>-1||t.files[0].extension.indexOf("png")>-1||t.files[0].extension.indexOf("jpeg")>-1||t.files[0].extension.indexOf("gif")>-1:t.files.rawFile.type.indexOf("image")>-1)?(i.updialog.ejDialog("close"),this.XLShape._insertPicture(t),this.model.showRibbon&&this.XLRibbon._formatTabUpdate(),i.option("autoUpload",!0)):(r=this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10?t.responseText:t.xhr.response,i.updialog.ejDialog("close"),this._importSuccess(r));this.hideWaitingPopUp()},_dlgBeforeOpen:function(){var t=n("#"+this._id+"_PasswordDialog").data("ejDialog");this.hideWaitingPopUp();n("#"+this._id+"_workBookName").text("'"+n("#"+this._id+"_file").data("ejUploadbox")._files[0].name+"'"+this._getLocStr("Protect"))},_dlgOk:function(){var t,i=n("#"+this._id+"_PasswordDialog").data("ejDialog"),r=n("#"+this._id+"_xlpassword"),u=n("#"+this._id+"_confirmpassword");t=n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").data("ejToggleButton");i.model.title==="Protect Workbook"?r.val().length&&u.val().length?r.val()===u.val()?(this.model.exportSettings.password=r.val(),n("#"+this._id+"_AddSheet").addClass("e-disable"),n("#"+this._id+"_confirm").hide(),i.option("title",this._getLocStr("UnProtectWorkbook"))):(n("#"+this._id+"_confirm").show(),this._showAlertDlg("Alert","PasswordAlert1"),t&&t.option("toggleState",!1),i.option("title",this._getLocStr("ProtectWorkbook"))):(n("#"+this._id+"_confirm").show(),t&&t.option("toggleState",!1),i.option("title",this._getLocStr("ProtectWorkbook")),this._showAlertDlg("Alert","PasswordAlert2")):i.model.title==="Unprotect Workbook"&&(this.model.exportSettings.password===r.val()?(n("#"+this._id+"_AddSheet").removeClass("e-disable"),this.model.exportSettings.password=null,n("#"+this._id+"_confirm").show(),i.option("title",this._getLocStr("ProtectWorkbook"))):(i.option("title",this._getLocStr("UnProtectWorkbook")),t&&t.option("toggleState",!0),this._showAlertDlg("Alert","PasswordAlert3")));r.val("");u.val("");n("#"+this._id+"_PasswordDialog").ejDialog("close")},_passwordDlg:function(){var n,f,i,r,u,e;n=t.buildTag("div","","",{id:this._id+"_PasswordDialog"});u=t.buildTag("div.e-dlg-btnfields");e=t.buildTag("div.e-dlg-btnctnr");f="<div class= 'e-dlgctndiv'><table><tr class= 'e-dlgtd-fields'><td><label>"+this._getLocStr("Password")+":<\/label><\/td><td><input id ='"+this._id+"_xlpassword' type ='password' class = 'ejinputtext'/><\/td><\/tr><tr class= 'e-dlgtd-fields' id ='"+this._id+"_confirm'><td><label>"+this._getLocStr("ConfirmPassword")+"<\/label><\/td><td><input id ='"+this._id+"_confirmpassword' type ='password' class = 'ejinputtext'/><\/td><\/tr><\/table><\/div>";n.append(f);i=t.buildTag("input","","",{type:"submit"});r=t.buildTag("input");i.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgOk,this),enabled:!0,cssClass:"e-ss-okbtn"});r.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._dlgCancel,this),showRoundedCorner:!0,width:60});u.append(e.append(i,r));n.append(u);n.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("ProtectWorkbook"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg e-ss-pwddlg",close:t.proxy(this._dlgCancel,this)})},_importPasswordDlg:function(){var i,e,r,u,f,o;return i=t.buildTag("div","","",{id:this._id+"_ImportPasswordDialog"}),f=t.buildTag("div.e-dlg-btnfields"),o=t.buildTag("div.e-dlg-btnctnr"),e="<div class= 'e-dlgctndiv'><table><tr class= 'e-dlgtd-fields'><td><label id ='"+this._id+"_workBookName' ><\/label><\/td><\/tr><tr class= 'e-dlgtd-fields'><td><label>"+this._getLocStr("Password")+":<\/label><\/td><td><input id ='"+this._id+"_importpassword' type ='password' class = 'ejinputtext'/><\/td><\/tr><\/table><\/div>",i.append(e),r=t.buildTag("input","","",{type:"submit"}),u=t.buildTag("input"),r.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._importDlgOk,this),enabled:!0}),u.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._dlgCancel,this),showRoundedCorner:!0,width:60}),f.append(o.append(r,u)),i.append(f),i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("Password"),beforeOpen:n.proxy(this._dlgBeforeOpen,this),width:420,height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg",close:t.proxy(this._dlgCancel,this)}),i},_dlgCancel:function(){this._showDialog(this._id+"_Ribbon_Review_Changes_ProtectWorkbook");var t=n("#"+this._id+"_PasswordDialog").data("ejDialog");t.model.title==="Protect Workbook"?n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").ejToggleButton("option","toggleState",!1):t.model.title==="Unprotect Workbook"&&n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").ejToggleButton("option","toggleState",!0);n("#"+this._id+"_confirmpassword").val("");n("#"+this._id+"_xlpassword").val("");n("#"+this._id+"_importpassword").val("");n("#"+this._id+"_PasswordDialog").ejDialog("close");n("#"+this._id+"_ImportPasswordDialog").ejDialog("close")},_importDlgOk:function(){var t={},i=n("#"+this._id+"_importpassword");this.model.importSettings.password=i.val();i.val("");n("#"+this._id+"_ImportPasswordDialog").ejDialog("close");t.file=n("#"+this._id+"_file").data("ejUploadbox")._files[0].rawFile;t.password=this._encrypt(this.model.importSettings.password);t.allowSheetOnDemand=this.model.importSettings.allowSheetOnDemand;this["import"](t)},lockCells:function(n,t){if(!this.model.isReadOnly){var i,r,u=this.getActiveSheetIndex(),f=this.getSheet(u);if(r=t!=!1,this.model.allowLockCell&&!f.isSheetProtected){if(n=this._getRangeArgs(n,"object",u),i={reqType:"lockCells",range:n,isLock:r},this._trigActionBegin(i))return;if(n=i.range,r=i.isLock,r?this.updateUniqueData({isLocked:!0},n):this.clearRangeData(n,["isLocked"]),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),i={reqType:"lockCells",range:n,isLocked:r},this._trigActionComplete(i))return}}},protectSheet:function(t){if(!this.model.isReadOnly){var i,r,f,u=this.getActiveSheetIndex(),o=this.getSheet(u),e=this.XLRibbon;if(r=t!==!1,this.model.allowLockCell){if(i={reqType:"protectSheet",isProtect:t,sheetIdx:u},this._trigActionBegin(i))return;if(r=i.isProtect,o.isSheetProtected=r,this.model.showRibbon&&(f=n("#"+this._id+"_Ribbon_Review_Changes_LockCell").data("ejToggleButton"),f&&f.option("enabled",!r),r?e._disableRibbonIcons():e._enableRibbonIcons(),e._updateRibbonIcons()),o._showLockCellAlert=!0,this.model.allowFormulaBar&&this.updateFormulaBar(),this.model.allowUndoRedo&&(this.model.sheetCount>1?this._removeUndoRedoForCurSheet(u,"undo"):(this._undoCollection=[],this._redoCollection=[])),i={reqType:"protectSheet",isSheetProtected:t,sheetIdx:u},!this._isSheetNavigate&&this._trigActionComplete(i))return}}},_readOnly:function(){var r=this.XLRibbon,u=n("#"+this._id+"_FRDialog_FPDlgTab").data("ejTab"),t=this.element.find("#"+this._id+"_Ribbon_BackStage"),i=this.element.find("#"+this._id+"_inputbox");this.model.isReadOnly?(r._disableRibbonIcons(),r.enableRibbonItems(["Spreadsheet_Ribbon_Home_Clipboard_Copy","Spreadsheet_Ribbon_Review_Comments_ShowAllComments","Spreadsheet_Ribbon_Others_Editing_FindSelect"]),this.XLCMenu&&this.XLCMenu._disableMenuOpt(["Replace","GoTo","GoToSpecial","Formulas","Comments","CFormat","Constants","DataValidation"],"Ribbon_FindRep"),t.length&&(t.find("#saveas_backStageTab").hide(),t.find("#print_backStageTab").hide()),this.addClass(this.element.find("#"+this._id+"_AddSheet")[0],"e-disable"),i.length&&(i[0].disabled=!0)):(r._enableRibbonIcons(),this.XLCMenu&&this.XLCMenu._enableMenuOpt(["Replace","GoTo","GoToSpecial","Formulas","Comments","CFormat","Constants","DataValidation"],"Ribbon_FindRep"),t.length&&(t.find("#saveas_backStageTab").show(),t.find("#print_backStageTab").show()),this._removeClass(this.element.find("#"+this._id+"_AddSheet")[0],"e-disable"),i.length&&(i[0].disabled=!1))},_isPropExists:function(n,t,i,r){for(var u,f,h,e,c,s=0,o=!1;s<n.length;){for(u=this.swapRange(n[s]),f=u[0],h=u[2];f<=h;){for(e=u[1],c=u[3];e<=c;){if(this.XLEdit.getPropertyValue(f,e,t,i)){r||(t==="isLocked"?this._popUplockCellAlert():t==="isReadOnly"&&this._showAlertDlg("Alert","ReadOnly","",400));o=!0;break}e++}if(o)break;f++}if(o)break;s++}return o},_isCellProtected:function(n,t,i){return this.model.allowLockCell&&this.getSheet(this.getActiveSheetIndex()).isSheetProtected&&this.XLEdit.getPropertyValue(n,t,"isLocked")?(i&&this._popUplockCellAlert(),!0):this.XLEdit.getPropertyValue(n,t,"isReadOnly")?(this._showAlertDlg("Alert","ReadOnly","",400),!0):void 0},_popUplockCellAlert:function(){this.getSheet(this.getActiveSheetIndex())._showLockCellAlert&&this._showAlertDlg("Alert","LockAlert","",500)},_removeUndoRedoForCurSheet:function(n,t){var r=t==="undo"?this._undoCollection:this._redoCollection,i=r.length;if(i)while(i--)n===r[i].sheetIndex&&r.splice(i,1);t==="undo"&&this._removeUndoRedoForCurSheet(n,"redo")},_detailsFromGlobalSpan:function(i,r,u,f,e,o){var s,h,f=f||"K",c="e-rowcell e-wrapword ",l=this.getRangeData({range:[i,r,i,r],property:["format","border","wrap"]})[0],v=l.format,y=l.border,p=l.wrap,a;return a=!t.isNullOrUndefined(e),s=a?n("#"+this._id+"_emptyDiv"):n("#"+this._id+"_emptySpan"),e&&(s[0].style.width=e-4+"px"),t.isNullOrUndefined(v)||(c+=v+" "),t.isNullOrUndefined(y)?s[0].className.indexOf("e-rowcell")>-1&&(s[0].style.borderRight=0):c+=y+" ",t.isNullOrUndefined(p)||(c+="e-sswraptext"),this.addClass(s[0],c),s[0].className.indexOf("e-rowcell")>-1&&(s[0].style.padding=0),s.text(f),u==="height"?(h=s.outerHeight(),!o&&this.model.rowHeight>h&&(h=this.model.rowHeight)):(h=s.outerWidth(),!o&&this.model.columnWidth>h&&(h=this.model.columnWidth)),this._refreshGlobalSpan(null,a),h},_encrypt:function(n){if(!t.isNullOrUndefined(n)){for(var r="",i=0;i<n.length;++i)r+=String.fromCharCode(129^n.charCodeAt(i));return r}},_writeRule:function(n,t){var i,r,t=this.getSheetElement(t).index()+1;r="#"+this._id+" .e-sheet:nth-child("+t+") .e-content td.e-rowcell:nth-of-type("+(n+1)+")";i=document.getElementById(this._id+"_sshide");i.sheet.insertRule(r+"{display: none}",i.sheet.cssRules.length)},_deleteRule:function(n,t){var t=this.getSheetElement(t).index()+1,r,u,i,s;r=document.getElementById(this._id+"_sshide");var f=r.sheet.cssRules,e=" .e-sheet:nth-child("+t+") ",o=".e-rowcell:nth-of-type("+(n+1)+")";for(this._browserDetails.name==="msie"&&(e=" :nth-child("+t+").e-sheet ",o=":nth-of-type("+(n+1)+").e-rowcell"),u="#"+this._id+e+".e-content td"+o,i=0,s=f.length;i<s;i++)if(f[i].selectorText===u){r.sheet.deleteRule(i);break}},_refreshRowHeight:function(n,t){var i=this.XLEdit.getPropertyValue(t,0,"pHeight"),r=this.getSheet(n);this.isUndefined(i)||(this.XLEdit._updateDataContainer({rowIndex:t,colIndex:0},{dataObj:{cHeight:i,pHeight:r.rowsHeightCollection[t]}}),r.rowsHeightCollection[t]=i,this._isRowViewable(n,t)&&(this.getRows(n)[1][this._getRowIdx(t)].style.height=i+"px"))},_batchAddRow:function(n,t,i,r){var c,f,o,u,s,h=0,e=n,a=this.getSheet(i),l=this.getDataSettings(i);if(l)while(e<=t){while(h<l.length)f=l[h],u=f.range,s=f.batchChanges.deleted,e>u[0]&&e<=u[2]+1?(o=u[0]?this._getPosDiff(e,u[0]):e,!f.fieldAsColumnHeader&&f.showHeader&&(o=o-1),c=this._getRowData(e,u[1],u[3],f),f._jsonData.splice(o,0,c),f._isDataManager&&(r?s.length?s.pop():s.push(c):f.batchChanges.added.push(f._jsonData[o])),u[2]++):e<=u[0]&&(u[2]++,u[0]++),h++;h=0;e++}},_batchDeleteRow:function(n,t,i,r){var s,f,h,u,o,l,c=0,e=t,v=this.getSheet(i),a=this.getDataSettings(i);if(a)while(e>=n){while(c<a.length)f=a[c],u=f.range,o=f.batchChanges.added,e>=u[0]&&e<=u[2]?(h=u[0]?this._getPosDiff(e,u[0]):e,!f.fieldAsColumnHeader&&f.showHeader&&(h=h-1),s=f._jsonData.splice(h,1)[0],f._isDataManager&&(r?o.length?(l=o.indexOf(s),l>-1&&o.splice(l,1)):o.push(s):f.batchChanges.deleted.push(s)),u[2]--):e<u[0]&&(u[2]--,u[0]--),c++;c=0;e--}},_updateBatchDetails:function(t,i,r){var o,l,u,s,f,e,h,a=!0,c=0,v=this.getSheet(r);if(settings=this.getDataSettings(r),settings)while(c<settings.length){if(setting=settings[c],u=setting.range,u&&this.inRange(u,t,i)){h=setting.batchChanges.changed;o=u[0]?this._getPosDiff(t,u[0]):t;l=u[1]?this._getPosDiff(i,u[1]):i;!setting.fieldAsColumnHeader&&setting.showHeader&&(t===u[0]?a=!1:o=o-1);a&&(e=setting._jsonData[o],s=setting.fields[l],f=this.getRangeData({range:[t,i,t,i],valueOnly:!0,sheetIdx:r,skipFormula:!0})[0],(this.isUndefined(f)||this._isEmptyString(f))&&(f=null),e[s]!==f&&(e[s]=f,!setting.primaryKey||s!==setting.primaryKey||this.XLEdit.getPropertyValue(t,i,"isReadOnly",r)||this.isUndefined(f)||this.XLEdit._updateDataContainer({rowIndex:t,colIndex:i},{dataObj:{isReadOnly:!0}}),setting._isDataManager&&n.inArray(e,h)===-1&&n.inArray(e,setting.batchChanges.added)===-1&&h.push(e)));break}c++}},_getRowData:function(n,i,r,u){for(var f,s={},e=i,o=0,c=this.getSheet(this.getActiveSheetIndex()),h=u.fields;e<=r;)f=this.getRangeData({range:[n,e,n,e],valueOnly:!0,skipDateTime:!0})[0],this._isEmptyString(f)&&(f=null),u.primaryKey&&h[o]===u.primaryKey&&t.isNullOrUndefined(f)&&(f=0),s[h[o]]=f,e++,o++;return s},saveBatchChanges:function(n){var e,r,i,o,u=0,s=this,t=this.getSheet(n),f=this.getDataSettings(n);if(f)while(u<f.length)setting=f[u],setting._isDataManager&&(i=setting.batchChanges,e={sheetIdx:n,dataSetting:setting,batchChanges:i},o=this._trigger("beforeBatchSave",e),!o&&(i.changed.length||i.added.length||i.deleted.length)&&(r=setting._dataManager.saveChanges(i,setting.primaryKey,setting.query._fromTable),setting._isOffline||(this.showWaitingPopUp(),r.done(function(){t._resCnt++;t._reqCnt===t._resCnt&&s.hideWaitingPopUp()}),r.fail(function(){t._resCnt++;t._reqCnt===t._resCnt&&s.hideWaitingPopUp()})),t._reqCnt++,setting.batchChanges={added:[],changed:[],deleted:[]})),u++},setReadOnly:function(n){this.updateUniqueData({isReadOnly:!0},n)},removeReadOnly:function(n){this.clearRangeData(n,["isReadOnly"])},_updateCustomFormulas:function(n,t){var r=this._calcEngine,u;for(var i in n)t==="add"&&this.isUndefined(this.getCalcEngine().getLibraryFunctions().getItem(n[i].formulaName))&&!this.XLEdit._isNamedRange("="+n[i].formulaName)?(u=r.addCustomFunction(n[i].formulaName,n[i].functionName),this._formulaCollection.push({text:"="+n[i].formulaName,display:n[i].formulaName})):t==="delete"&&r.getCustomLibraryFunctions().contains(n[i].formulaName)?u=r.removeFunction(n[i].formulaName,n[i].functionName):this._showAlertDlg("Alert","CorrectFormula","FormulaAlert",372);return u},addCustomFormula:function(n,t){if(!this.model.isReadOnly){var i=this._updateCustomFormulas([{formulaName:n,functionName:t}],"add");i&&(this.model.customFormulas.push({formulaName:n,functionName:t}),this.XLEdit._refreshAutoComplete())}},removeCustomFormula:function(n,t){if(!this.model.isReadOnly){var r=this._updateCustomFormulas([{formulaName:n.toUpperCase(),functionName:t}],"delete"),i;if(r){i=this.model.customFormulas;for(key in i)i[key].formulaName===n&&i.splice(1,parseInt(key));this._updateFormulaCollection();this.XLEdit._refreshCalcEngine(null,null,!1,null,null);this.XLEdit._refreshAutoComplete()}}},getValueFromFormulaArg:function(n){var f=1,s,c=this._getSheetIndex(),e=this._calcEngine,r,t,o={},u=[],i,h;for(r=n.split(e.getParseArgumentSeparator()),i=0,h=r.length;i<h;i++)u=u.concat(r[i].indexOf(":")>-1?e.getCellsFromArgs(r[i]):[r[i]]);for(s in u)t=e.getValueFromArg(u[s]),o["arg"+f]=this.XLEdit._parseValue(t).value,u.indexOf(t)>-1&&t[0]==='"'&&t[t.length-1]==='"'&&(o["arg"+f]=t.substring(1,t.length-1)),f++;return o},getCalcEngine:function(){return this._calcEngine}});t.Spreadsheet.Locale=t.Spreadsheet.Locale||{};t.Spreadsheet.Locale["default"]=t.Spreadsheet.Locale["en-US"]={Cut:"Cut",Copy:"Copy",FormatPainter:"Format Painter",Paste:"Paste",PasteValues:"Paste Values Only",PasteSpecial:"Paste",Filter:"Filter",FilterContent:"Turn on filtering for the selected cells.",FilterSelected:"Filter by Selected Cell's value",Sort:"Sort",Clear:"Clear",ClearContent:"Delete everything in the cell, or remove just the formatting, contents, comments or hyperlinks.",ClearFilter:"Clear Filter",ClearFilterContent:"Clear the filter and sort state for the current range of data.",SortAtoZ:"Sort A to Z",SortAtoZContent:"Lowest to Highest.",SortZtoA:"Sort Z to A",SortZtoAContent:"Highest to Lowest.",SortSmallesttoLargest:"Sort Smallest to Largest",SortLargesttoSmallest:"Sort Largest to Smallest",SortOldesttoNewest:"Sort Oldest to Newest",SortNewesttoOldest:"Sort Newest to Oldest",Insert:"Insert",InsertTitle:"Insert Cells",InsertContent:"Add new cells, rows, or columns to your workbook.",MultipleInsertContent:"FYI: To insert multiple rows or columns at a time, select multiple rows or columns in the sheet, and click Insert.",InsertSBContent:"Add cells, rows, columns, or sheets to your workbook.",Delete:"Delete",DeleteTitle:"Delete Cells",DeleteContent:"Delete cells, rows, columns, or sheets from your workbook. ",MultipleDeleteContent:"FYI: To delete multiple rows or columns at a time, select multiple rows or columns in the sheet, and click Delete.",FindSelectTitle:"Find & Select",FindSelectContent:"Click to see options for finding text in your document.",CalculationOptions:"Calculation Options",CalcOptTitle:"Calculation Options",CalcOptContent:"Choose to calculate formulas automatically or manually.",CalcOptRecalcContent:"If you make a change that affects a value, Spreadsheet will automatically recalculate it.",CalculateSheet:"Calculate Sheet",CalculateNow:"Calculate Now",CalculateNowContent:"Calculate the entire workbook now.",CalculateNowTurnOffContent:"You only need to use this if automatic calculation is turned off.",CalculateSheetContent:"Calculate the active sheet now.",CalculateSheetTurnOffContent:"You only need to use this if automatic calculation is turned off.",Title:"Spreadsheet",ColorPicker:"Color Picker",Ok:"OK",Cancel:"Cancel",Alert:"We couldn't do this for the selected range of cells. Select a single cell within a range of data and then try again.",HeaderAlert:"The command could not be completed as you are attempting to filter with the filter header. Select a single cell in the filter range and try the command again.",FlashFillAlert:"All the data next to your selection was checked and there was no pattern for filling in values.",Formatcells:"Format Cells",FontFamily:"Font",FFContent:"Pick a new font for your text.",FontSize:"Font Size",FSContent:"Change the size of your text.",IncreaseFontSize:"Increase Font Size",IFSContent:"Make your text a bit bigger.",DecreaseFontSize:"Decrease Font Size",DFSContent:"Make your text a bit smaller.",Bold:"Bold",Italic:"Italic",Underline:"Underline",Linethrough:"Linethrough",FillColor:"Fill Color",FontColor:"Font Color",TopAlign:"Top Align",TopAlignContent:"Align text to the top.",MiddleAlign:"Middle Align",MiddleAlignContent:"Align text so that it is centered between the top and bottom of the cell.",BottomAlign:"Bottom Align",BottomAlignContent:"Align text to the bottom.",WrapText:"Wrap Text",WrapTextContent:"Wrap extra-long text into multiple lines so you can see all of it.",AlignLeft:"Align Left",AlignLeftContent:"Align your content to the left.",AlignCenter:"Center",AlignCenterContent:"Center your content.",AlignRight:"Align Right",AlignRightContent:"Align your content to the right.",IncreaseIndent:"Increase Indent",IncreaseIndentContent:"Move your content farther away from the cell border.",DecreaseIndent:"Decrease Indent",DecreaseIndentContent:"Move your content closer to the cell border.",Undo:"Undo",Redo:"Redo",NumberFormat:"Number Format",NumberFormatContent:"Choose the format for your cells, such as percentage, currency, date or time.",AccountingStyle:"Accounting Style",AccountingStyleContent:"Format as dollar accounting number format.",PercentageStyle:"Percent Style",PercentageStyleContent:"Format as a percent.",CommaStyle:"Comma Style",CommaStyleContent:"Format with a thousands separator.",IncreaseDecimal:"Increase Decimal",IncreaseDecimalContent:"Show more decimal places for a more precise value.",DecreaseDecimal:"Decrease Decimal",DecreaseDecimalContent:"Show fewer decimal places.",AutoSum:"AutoSum",AutoSumTitle:"Sum",AutoSumContent:"Automatically add a quick calculation to your worksheet, such as sum or average.",Fill:"Fill",ExportXL:"Excel",ExportCsv:"CSV",ExportPdf:"PDF",SaveXml:"Save XML",BackgroundColor:"Fill Color",BGContent:"Color the background of the cells to make them stand out.",ColorContent:"Change the color of your text.",Border:"Border",BorderContent:"Apply borders to the currently selected cells.",BottomBorder:"Bottom Border",TopBorder:"Top Border",LeftBorder:"Left Border",RightBorder:"Right Border",OutsideBorder:"Outside Borders",NoBorder:"No Border",AllBorder:"All Borders",ThickBoxBorder:"Thick Box Border",ThickBottomBorder:"Thick Bottom Border",TopandThickBottomBorder:"Top and Thick Bottom Border",DrawBorderGrid:"Draw Border Grid",DrawBorder:"Draw Border",TopandBottomBorder:"Top and Bottom Border",BorderColor:"Line Color",BorderStyle:"Line Style",Number:"Number is used for general display of numbers. Currency and Accounting offer specialized formatting for monetary value.",General:"General format cells have no specific number format.",Currency:"Currency formats are used for general monetary values. Use Accounting formats to align decimal points in a column.",Accounting:"Accounting formats line up the currency symbols and decimal points in a column.",Text:"Text format cells are treated as text even when a number is in the cell. The cell is displayed exactly as entered.",Percentage:"Percentage formats multiply the cell value by 100 and displays the result with a percent symbol.",CustomMessage:"Type number format code, using one of existing codes as a starting point.",Fraction:"Fraction is used to indicate a part of a whole number or a ratio between two numbers.",Scientific:"Scientific is used to represent a decimal number between 1 and 10 multiplied by ten, so the large numbers using less digits.",Type:"Type:",CustomFormatAlert:"Enter a valid format",Date:"Date formats display date and time serial numbers as date values.",Time:"Time formats display date and time serial numbers as date values.",File:"FILE",New:"New",Open:"Open",SaveAs:"Save As",Print:"Print",PrintContent:"Print the current sheet.",PrintSheet:"Print Sheet",PrintSelected:"Print Selected",PrintSelectedContent:"Select an area on the sheet you would like to print.",HighlightVal:"Format Invalid Data",ClearVal:"Clear Validation",Validation:"Validation",DataValidation:"Data Validation",DVContent:"Pick from a list of rules to limit the type of data that can be entered in a cell.",A4:"A4",A3:"A3",Letter:"Letter",PageSize:"Page Size",PageSizeContent:"Choose a page size for your document.",FormatCells:"FormatCells",ConditionalFormat:"Conditional Formatting",CFContent:"Easily spot trends and patterns in your data using colors to visually highlight important values.",And:"and",With:"with",GTTitle:"Greater Than",GTContent:"Format cells that are GREATER THAN:",LTTitle:"Less Than",LTContent:"Format cells that are LESS THAN:",BWTitle:"Between",BWContent:"Format cells that are BETWEEN:",EQTitle:"Equal To",EQContent:"Format cells that are EQUAL TO:",DateTitle:"A Date Occurring",DateContent:"Format cells that contain a DATE:",ContainsTitle:"Text That Contains",ContainsContent:"Format cells that contain the text:",GreaterThan:"Greater Than",LessThan:"Less Than",Between:"Between",EqualTo:"Equal To",TextthatContains:"Text that Contains",DateOccurring:"A Date Occurring",ClearRules:"Clear Rules",ClearRulesfromSelected:"Clear Rules from Selected Cells",ClearRulesfromEntireSheets:"Clear Rules from Entire Sheet",CellStyles:"Cell Styles",CellStylesContent:"A colorful style is a great way to make important data stand out on the sheet.",CellStyleHeaderText:"Good, Bad and Neutral/Titles and Headings/Themed Cell Styles",Custom:"Type the number format code, using one of the existing codes as starting point.",CellStyleGBN:"Normal/Bad/Good/Neutral",CellStyleTH:"Heading 4/Title",CellsStyleTCS:"20% - Accent1/20% - Accent2/20% - Accent3/20% - Accent4/60% - Accent1/60% - Accent2/60% - Accent3/60% - Accent4/Accent1/Accent2/Accent3/Accent4",Style:"Style",FormatAsTable:"Format As Table",FormatasTable:"Format as Table",FATContent:"Quickly convert a range of cells to a table with its own style.",FATHeaderText:"Light/Medium/Dark",FATNameDlgText:"Table Name:/My table has headers",InvalidReference:"The range you have specified is invalid",ResizeAlert:"The specified range is invalid. The top of the table must remain in the same row, and the resulting table must overlap the original table. Specify a valid range.",RangeNotCreated:"Increasing the row beyond the maximum sheet rowcount is restricted in Format as Table.",ResizeRestrictAlert:"Increase or decrease of column count and decrease of row count is restricted in Format as Table.",FATResizeTableText:"Enter new data range for your table:",FATReizeTableNote:"Note: The headers must remain in the same row and the resulting table range must overlap the original table range.",FormatAsTableAlert:"Cannot create a table with a single row. A table must have at least two rows, one for the table header, and one for data",FormatAsTableTitle:"Light 1/Light 2/Light 3/Light 5/Light 8/Light 9/Light 10/Light 12/Light 15/Light 16/Light 17/Light 19/Medium 8/Medium 9/Medium 10/Medium 12/Medium 22/Medium 23/Medium 24/Medium 26/Dark 1/Dark 2/Dark 3/Dark 5",NewTableStyle:"New Table Style",ResizeTable:"Resize Table",ResizeTableContent:"Resize this table by adding or removing rows and columns.",ConvertToRange:"Convert to Range",ConvertToRangeContent:"Convert this table into a normal range of cells.",ConverToRangeAlert:"Do you want to convert the table to a normal range?",TableID:"Table ID:",Table:"Table",TableContent:"Create a table to organize and analyze related data.",TableStyleOptions:"First Column/Last Column/Total Row/Filter Button",Format:"Format",NameManager:"Name Manager",NameManagerContent:"Create, edit, delete and find all the names used in the workbook.",NameManagerFormulaContent:"Names can be used in formulas as substitutes for cell references.",DefinedNames:"Defined Names",DefineName:"Define Name",DefineNameContent:"Define and apply names.",UseInFormula:"Use In Formula",UseInFormulaContent:"Choose a name used in this workbook and insert it into the current formula.",RefersTo:"Refers To",Name:"Name",Scope:"Scope",NMNameAlert:"The name that you entered is not valid./Reason for this can include:/The name does not begin with a letter or an underscore/The name contains a space or other invalid characters/The name conflicts with a spreadsheet built-in name or the name of another object in the workbook",NMUniqueNameAlert:"The name entered already exists. Enter a unique name.",NMRangeAlert:"Enter a valid range",FORMULAS:"FORMULAS",Value:"Values",DataValue:"Values:",Formula:"Formulas",MissingParenthesisAlert:"Your formula is missing a parenthesis--) or (. Check the formula, and then add the parenthesis in the appropriate place.",UnsupportedFile:"Unsupported File",IncorrectPassword:"Unable to open the file or worksheet with the given password",InvalidUrl:"Please specify proper URL",Up:"Up",Down:"Down",Sheet:"Sheet",Workbook:"Workbook",Rows:"By Rows",Columns:"By Columns",FindReplace:"Find Replace",FindnReplace:"Find and Replace",Find:"Find",Replace:"Replace",FindLabel:"Find what:",ReplaceLabel:"Replace with:",ReplaceAll:"Replace All",Close:"Close",FindNext:"Find Next",FindPrev:"Find Prev",Automatic:"Automatic",Manual:"Manual",Settings:"Settings",MatchCase:"Match case",MatchAll:"Match entire cell contents",Within:"Within:",Search:"Search:",Lookin:"Look in:",ShiftRight:"Shift cells right",ShiftBottom:"Shift cells down",EntireRow:"Entire row",EntireColumn:"Entire column",ShiftUp:"Shift cells up",ShiftLeft:"Shift cells left",Direction:"Direction:",GoTo:"Go To",GoToName:"Go to:",Reference:"Reference:",Special:"Special",Select:"Select",Comments:"Comments",Formulas:"Formulas",Constants:"Constants",RowDiff:"Row differences",ColDiff:"Column differences",LastCell:"Last cell",CFormat:"Conditional formats",Blanks:"Blanks",GotoError:"Error",GotoLogicals:"Logicals",GotoNumbers:"Numbers",GotoText:"Text",FindSelect:"Find & Select",Comment:"Comment",NewComment:"New",InsertComment:"Insert Comment",EditComment:"Edit",DeleteComment:"Delete Comment",DeleteCommentContent:"Delete the selected comment.",HideComment:"Hide Comment",Next:"Next",NextContent:"Jump to the next comment.",Previous:"Previous",PreviousContent:"Jump to the previous comment.",ShowHide:"Show/Hide Comment",ShowHideContent:"Show or hide the comment on the active cell.",ShowAll:"Show All Comments",ShowAllContent:"Display all comments in the sheet.",UserName:"User Name",Hide:"Hide",Unhide:"Unhide",Add:"Add",DropAlert:"Do you want to replace the existing data?",PutCellColor:"Put Selected Cell Color To The Top",PutFontColor:"Put Selected Font Color To The Top",WebPage:"Web Page",WorkSheet:"Worksheet Reference",SheetReference:"Sheet Reference",InsertHyperLink:"Insert Hyperlink",HyperLink:"Hyperlink",EditLink:"Editlink",OpenLink:"Openlink",HyperlinkText:"Text:",RemoveLink:"Removelink",WebAddress:"Web Address:",CellAddress:"Cell Reference:",SheetIndex:"Select a place in this document",ClearAll:"Clear All",ClearFormats:"Clear Formats",ClearContents:"Clear Contents",ClearComments:"Clear Comments",ClearHyperLinks:"Clear Hyperlinks",SortFilter:"Sort & Filter",SortFilterContent:"Organize your data so it's easier to analyze.",NumberStart:"Minimum:",NumberEnd:"Maximum:",DecimalStart:"Minimum:",DecimalEnd:"Maximum:",DateStart:"Start Date:",DateEnd:"End Date:",ListStart:"Source:",FreeText:"Show error after invalid data is entered",ListEnd:"Cell Reference:",TimeStart:"Start Time:",TimeEnd:"End Time:",TextLengthStart:"Minimum:",TextLengthEnd:"Maximum:",CommentFindEndAlert:"Spreadsheet reached the end of the workbook. Do you want to continue reviewing from the beginning of the workbook?",InsertSheet:"Insert",DeleteSheet:"Delete",RenameSheet:"Rename",MoveorCopy:"Move or Copy",HideSheet:"Hide",UnhideSheet:"Unhide",SheetRenameAlert:"That name is already taken. Try a different one.",SheetRenameEmptyAlert:"You typed an invalid name for a sheet. Make sure that:",SheetRenameEmptyCharExceedAlert:"The name that you type does not exceed 31 characters.",SheetRenameEmptySplCharAlert:"The name does not contain any of the following characters: ",SheetRenameEmptyBlankAlert:"You did not leave the name blank.",SheetDeleteAlert:"You can't undo deleting sheets, and you might be removing some data. If you don't need it, click OK to delete.",SheetDeleteErrorAlert:"A workbook must contain at least one visible worksheet. To hide, delete, or move the selected sheet, you must first insert a new sheet or unhide a sheet that is already hidden.",CtrlKeyErrorAlert:"That command cannot be used on multiple selections.",ClipboardAccessError:"Your browser can't access the clipboard, so use these shortcuts:",ClipboardAccessCutError:"Cut = Ctrl + X",ClipboardAccessCopyError:"Copy = Ctrl + C",ClipboardAccessPasteError:"Paste = Ctrl + V",MoveToEnd:"Move To End",Beforesheet:"Before sheet:",CreateaCopy:"Create a copy",AutoFillOptions:"Copy Cells/Fill Series/Fill Formatting Only/Fill Without Formatting/Flash Fill",NumberValidationMsg:"Enter only digits",DateValidationMsg:"Enter only date",Required:"Required",TimeValidationMsg:"The time you entered for the Time is invalid.",CellAddrsValidationMsg:"Reference is not valid.",PivotTable:"Pivot Table",PivotTableContent:"Easily arrange and summarize complex data in a PivotTable.",NumberTab:"Number",AlignmentTab:"Alignment",FontTab:"Font",FillTab:"Fill",TextAlignment:"Text alignment",Horizontal:"Horizontal:",Vertical:"Vertical:",Indent:"Indent",TextControl:"Text Control",FontGroup:"Font:",FontStyle:"Font style:",Size:"Size:",PSize:"Page size",Effects:"Effects:",StrikeThrough:"Strikethrough",Overline:"Overline",NormalFont:"Normal font",Preview:"Preview",PreviewText:"AaBbCcYyZz",Line:"Line",Presets:"Presets",None:"None",Outline:"Outline",AllSide:"All sides",InsCells:"Insert Cells",InsRows:"Insert Sheet Rows",InsCols:"Insert Sheet Columns",InsSheet:"Insert Sheet",DelCells:"Delete Cells",DelRows:"Delete Sheet Rows",DelCols:"Delete Sheet Columns",DelSheet:"Delete Sheet",HyperLinkAlert:"The address of this site is not valid.Check the address and try again.",ReplaceData:"All done. We made / replacements.",NotFound:"We couldn't find what you were looking for. Select settings tab for more ways to search",Data:"Data:",Allow:"Allow:",IgnoreBlank:"Ignore blank",NotFind:"Unable to find the match to replace",FreezeTopRow:"Freeze Top Row",FreezeFirstColumn:"Freeze First Column",UnFreezePanes:"Unfreeze Panes",DestroyAlert:"Are you sure you want to destroy the current workbook without saving and create a new workbook?",ImageValAlert:"Upload image files only",Pictures:"Pictures",PicturesTitle:"From File",PicturesContent:"Insert pictures from computer or from other computers that you are connected to.",ImportAlert:"Are you sure you want to destroy the current workbook without saving and open a new workbook?",UnmergeCells:"Unmerge Cells",MergeCells:"Merge Cells",MergeAcross:"Merge Across",MergeAndCenter:"Merge & Center",MergeAndCenterContent:"Combine and center the contents of the selected cells in a new larger cell.",MergeCellsAlert:"Merging Cells keeps only upper left cell value and discards the other values.",MergeInsertAlert:"This operation will causes some merged cells to unmerge. Do you wish to continue ?",Axes:"Axes",PHAxis:"Primary Horizontal",PVAxis:"Primary Vertical",AxisTitle:"Axis Title",CTNone:"None",CTCenter:"Center",CTFar:"Far",CTNear:"Near",DataLabels:"Data Labels",DLNone:"None",DLCenter:"Center",DLIEnd:"Inside End",DLIBase:"Inside Base",DLOEnd:"Outside End",ErrorBar:"Error Bars",Gridline:"Gridlines",PMajorH:"Primary Major Horizontal",PMajorV:"Primary Major Vertical",PMinorH:"Primary Minor Horizontal",PMinorV:"Primary Minor Vertical",Legend:"Legends",LNone:"None",LLeft:"Left",LRight:"Right",LBottom:"Bottom",LTop:"Top",ChartTitleDlgText:"Enter Title",ChartTitle:"Title",InvalidTitle:"You typed an invalid name for the Title.",CorrectFormat:"Select the correct Format File",ResetPicture:"Reset Picture",ResetPictureContent:"Discard all of the formatting changes made to this picture.",PictureBorder:"Picture Border",PictureBorderContent:"Pick the color, width, and line style for the outline of your shape.",ResetSize:"Reset Picture & Size",Height:"Height",Width:"Width",ThemeColor:"Theme Colors",NoOutline:"No Outline",Weight:"Weight",Dashes:"Dashes",ColumnChart:"2-D Column/3-D Column",ColumnChartTitle:"Insert Column Chart",ColumnChartContent:"Use this chart type to visually compare values across a few categories.",BarChart:"2-D Bar/3-D Bar",BarChartTitle:"Insert Bar Chart",BarChartContent:"Use this chart type to visually compare values across a few categories when the chart shows duration or the category text is long.",StockChart:"Radar",StockChartTitle:"Insert Radar Chart",StockChartContent:"Use this chart type to show values relative to a center point.",LineChart:"2-D Line",LineChartTitle:"Insert Line Chart",LineChartContent:"Use this chart type to show trends over time (years, months, and days) or categories.",AreaChart:"2-D Area/3-D Area",AreaChartTitle:"Insert Area Chart",AreaChartContent:"Use this chart type to show trends over time (years, months, and days) or categories. Use it to highlight the magnitude of change over time.",ComboChart:"Combo",PieChart:"Pie",PieChartTitle:"Insert Pie/Doughnut Chart",PieChartContent:"Use this chart type to show proportions of a whole. Use it when the total of your numbers is 100%.",ScatterChart:"Scatter",ScatterChartTitle:"Insert Scatter (X, Y) Chart",ScatterChartContent:"Use this chart type to show the relationship between sets of values.",ClusteredColumn:"Clustered Column",StackedColumn:"Stacked Column",Stacked100Column:"100% Stacked Column",Cluster3DColumn:"3-D Clustered Column",Stacked3DColumn:"3-D Stacked Column",Stacked100Column3D:"3-D 100% Stacked Column",ClusteredBar:"Clustered Bar",StackedBar:"Stacked Bar",Stacked100Bar:"100% Stacked Bar",Cluster3DBar:"3-D Clustered Bar",Stacked3DBar:"3-D Stacked Bar",Stacked100Bar3D:"3-D 100% Stacked Bar",Radar:"Radar",RadarMarkers:"Radar with Markers",LineMarkers:"Line with Markers",Area:"Area",StackedArea:"Stacked Area",Stacked100Area:"100% Stacked Area",Pie:"Pie",Pie3D:"3-D Pie",Doughnut:"Doughnut",Scatter:"Scatter",ChartRange:"Chart Range",XAxisRange:"Enter X-axis range:",YAxisRange:"Enter Y-axis range:",LegendRange:"Enter legend range:",YAxisMissing:"Enter Y-axis range to create chart",InvalidYAxis:"Y-axis range must be within the selected range",InvalidXAxis:"X-axis range must be within the selected range",InvalidLegend:"Legend range must be within the selected range",InvalidXAxisColumns:"X-axis range should be within a single column",FreezePanes:"Freeze Panes",FreezePanesContent:"Freeze a portion of the sheet to keep it visible while you scroll through the rest of the sheet.",PasteTitle:"Paste (Ctrl+V)",PasteContent:"Add content on the Clipboard to your document.",PasteSplitContent:"Pick a paste option, such as keeping formatting or pasting only content.",CutTitle:"Cut (Ctrl+X)",CutContent:"Remove the selection and put it on the Clipboard so you can paste it somewhere else.",CopyTitle:"Copy (Ctrl+C)",CopyContent:"Put a copy of the selection on the Clipboard so you can paste it somewhere else.",FPTitle:"Format Painter",FPContent:"Like the look of a particular selection? You can apply that look to other content in the document.",BoldTitle:"Bold (Ctrl+B)",BoldContent:"Make your text bold.",ItalicTitle:"Italic (Ctrl+I)",ItalicContent:"Italicize your text.",ULineTitle:"Underline (Ctrl+U)",ULineContent:"Underline your text.",LineTrTitle:"Strike Through (Ctrl+5)",LineTrContent:"Cross something out by drawing a strike through it.",UndoTitle:"Undo (Ctrl+Z)",UndoContent:"Undo your last action.",RedoTitle:"Redo (Ctrl+Y)",RedoContent:"Redo your last action.",TableTitle:"Table (Ctrl+T)",HyperLinkTitle:"Add a Hyperlink (Ctrl+K)",HyperLinkContent:"Create a link in your document for quick access to webpages and files. ",HyperLinkPlaceContent:"Hyperlinks can also take you to places in your document.",NewCommentTitle:"Insert a Comment",NewCommentContent:"Add a note about this part of the document.",RefreshTitle:"Refresh",RefreshContent:"Get the latest data from the source connected to the active cell",FieldListTitle:"Field List",FieldListContent:"Show or hide the Field List.",FieldListRemoveContent:"The field list allows you to add and remove fields from your PivotTable report",AddChartElement:"Add Chart Element",AddChartElementContent:"Add elements to the created chart.",SwitchRowColumn:"Switch Row/ Column",SwitchRowColumnContent:"Swap the data over the axis.",MergeAlert:"We can't do that to a merged cell.",UnhideDlgText:"Unhide Sheet:",ChartThemes:"Chart Themes",ChartThemesContent:"Pick a new theme for your chart.",ChangePicture:"Change Picture",ChangePictureContent:"Change to a different picture, preserving the formatting and size of the current picture.",ChangeChartType:"Change Chart Type",SelectData:"Select Data",SelectDataContent:"Change the data range included in the chart.",Sum:"Sum",Average:"Average",CountNumber:"Count Numbers",Max:"Max",Min:"Min",ChartType:"Change Chart Type",ChartTypeContent:"Change to a different chart type.",AllCharts:"All Charts",defaultfont:"Default",LGeneral:"General",LCurrency:"Currency",LAccounting:"Accounting",LDate:"Date",LTime:"Time",LPercentage:"Percentage",LFraction:"Fraction",LScientific:"Scientific",LText:"Text",LCustom:"Custom",FormatSample:"Sample",Category:"Category:",Top:"Top",Center:"Center",Bottom:"Bottom",Left:"Left (Indent)",Right:"Right",Justify:"Justify",GeneralTxt:"General format cells have no specific number format.",NegativeNumbersTxt:"Negative Numbers",ThousandSeparatorTxt:"Use 1000 Separator",DecimalPlacesTxt:"Decimal Places:",TextTxt:"Text format cells are treated as text even when a number is in the cell. The cell is displayed exactly as entered.",BoldItalic:"Bold Italic",Regular:"Regular",HyperLinkHide:"<<Selection in Document>>",InvalidSheetIndex:"Specify proper SheetIndex",HugeDataAlert:"File too large to open.",ImportExportUrl:"Give import/export URL and try again.",TitleColumnChart:"Clustered Column/Stacked Column/100% Stacked Column/3D Clustered Column/3D Stacked Column/ 3D 100% Stacked Column",TitleBarChart:"Clustered Bar/Stacked Bar/100% Stacked Bar/3D Clustered Bar/3D Stacked Bar/3D 100% Stacked Bar",TitleRadarChart:"Radar/Radar with Markers",TitleLineChart:"Line/Line with Markers",TitleAreaChart:"Area/Stacked Area/100% Stacked Area",TitlePieChart:"Pie/3D Pie/Doughnut",TitleScatterChart:"Scatter",BetweenAlert:"The Maximum must be greater or equal to the Minimum.",BorderStyles:"Solid/Dashed/Dotted",FPaneAlert:"Freeze Pane is not applied for the First Cell",ReplaceNotFound:"Spreadsheet cannot find a match.",BlankWorkbook:"Blank workbook",SaveAsExcel:"Save As Excel",SaveAsCsv:"Save As CSV",SaveAsPdf:"Save As PDF",Design:"DESIGN",NewName:"New Name",FormulaBar:"Formula Bar",NameBox:"Name Box",NumberValMsg:"Decimal values cannot be used for number conditions.",NumberAlertMsg:"Enter only digits.",ListAlert:"Cell range is incorrect, Please enter correct cell range.",ListValAlert:"The list source must be a delimited list, or a reference to single row or column.",ListAlertMsg:"The value you entered is not valid",AutoFillTitle:"AutoFillOptions",NewSheet:"New Sheet",FullSheetCopyPasteAlert:"We can't paste because the Copy area and paste area aren't the same size.",Heading:"Headings",Gridlines:"Gridlines",Firstsheet:"Scroll to the first sheet",Lastsheet:"Scroll to the last sheet",Nextsheet:"Scroll to the next sheet",Prevsheet:"Scroll to the previous sheet",ProtectWorkbook:"Protect Workbook",UnProtectWorkbook:"Unprotect Workbook",ProtectWBContent:"Keep others from making structural changes to your workbook",Password:"Password",ConfirmPassword:"Reenter password to proceed:",PasswordAlert1:"Confirmation password is not identical.",PasswordAlert2:"Please enter a password.",PasswordAlert3:"The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.",Protect:"is protected.",Lock:"LockCell",Unlock:"UnlockCell",Protectsheet:"Protect Sheet",ProtectSheetToolTip:"Prevent unwanted changes from others by limiting their ability to edit",Unprotect:"Unprotect Sheet",LockAlert:"The cell you are trying to change is on protected sheet. To make changes, click Unprotect Sheet in the Review tab.",InsertDeleteAlert:"This operation is not allowed. The operation is attempting to shift cells in a table/Filter range on your worksheet.",CreateRule:"New Rule",NewRule:"New Formatting Rule",NewRuleLabelContent:"Format values where this formula is true:",ReadOnly:"The range you are trying to change contains readonly cells.",CreatePivotTable:"Create PivotTable",Range:"Range:",ChoosePivotTable:"Choose where you want the PivotTable to be placed",NewWorksheet:"New Worksheet",ExistingWorksheet:"Existing Worksheet",Location:"Location:",Refresh:"Refresh",PivotRowsAlert:"This command requires at least two rows of source data. You cannot use the command on a selection in only one row.",PivotLabelsAlert:"The PivotTable field name is not valid, To create a PivotTable report, you must use data that is organized as a list with labeled columns. If you are changing the name of a PivotTable field, you must type a new name for the field.",FieldList:"Field List",MergeSortAlert:"To do this, all the merged cells need to be the same size.",FormulaSortAlert:"The sort range with formula cannot be sorted.",MergePreventInsertDelete:"This operation is not allowed. The operation is attempting to shift a merge cells on your worksheet.",FormulaRuleMsg:"Please enter correct format.",MovePivotTable:"Move PivotTable",MovePivotTableContent:"Move the PivotTable to another location in the workbook.",ClearAllContent:"Remove fields and filters.",ChangeDataSource:"Modify",ChangeDataSourceContent:"Change the source data for this PivotTable",ChangePivotTableDataSource:"Change PivotTable Data Source",TotalRowAlert:"This operation is not allowed. The operation is attempting to shift cells in a table on your worksheet. Click OK to proceed with entire row.",CellTypeAlert:"This operation is not allowed in cell type applied range.",PivotOverlapAlert:"A PivotTable report cannot overlap another PivotTable report",NoCellFound:"No cells were found",CorrectArgument:"Please enter the correct argument",CorrectFormula:"Please enter the correct formula",CorrectCellAddress:"Please enter the correct cell address",ChartType:"Chart Type",NumberValidationAlert:"The Maximum must be greater than or equal to Minimum",DateValidationAlert:"The End Date must be greater than or equal to Start Date",TimeValidationAlert:"The End Time must be greater than or equal to Start Time",NewRuleAlert:"There's a problem with this formula",DragAlert:"The command could not be completed as you are attempting to move cells within the filter range. Select a range out of the filter range and try the command again.",OR:"or",HOME:"HOME",INSERT:"INSERT",DATATAB:"DATA",PAGELAYOUT:"PAGE LAYOUT",REVIEW:"REVIEW",OTHERS:"OTHERS",FORMAT:"Format",DESIGN:"DESIGN",CHARTDESIGN:"Chart Design",ANALYZE:"Analyze"};t.Spreadsheet.scrollMode={Normal:"normal",Infinite:"infinite"};t.Spreadsheet.AutoFillOptions={CopyCells:"copycells",FillSeries:"fillseries",FillFormattingOnly:"fillformattingonly",FillWithoutFormatting:"fillwithoutformatting",FlashFill:"flashfill"};t.Spreadsheet.autoFillDirection={Up:"up",Right:"right",Down:"down",Left:"left"};t.Spreadsheet.pageSize={A4:"A4",A3:"A3",Letter:"Letter"};t.Spreadsheet.Actions={Sorting:"sorting",Selection:"selection",AutoFill:"autofill",CellNavigation:"cellnavigation",Filtering:"filtering"};t.Spreadsheet.exportType={Excel:"Excel",Csv:"Csv",Pdf:"Pdf"};t.Spreadsheet.CustomCellType={Button:"Button",CheckBox:"CheckBox",DropDownList:"DropDownList",DatePicker:"DatePicker"};t.Spreadsheet.CellType={String:"string",Number:"number",Custom:"custom",Formula:"formula",Time:"time",LongDate:"longdate",ShortDate:"shortdate",Scientific:"scientific",Fraction:"fraction",Text:"text",General:"general",Accounting:"accounting",Currency:"currency",Percentage:"percentage",Date:"date",DateTime:"datetime"};t.Spreadsheet.SupportedStyles={FontFamily:"font-family",FontSize:"font-size",FontStyle:"font-style",FontWeight:"font-weight",TextAlign:"text-align",TextDecoration:"text-decoration",VerticalAlign:"vertical-align",TextIndent:"text-indent"};t.Spreadsheet.Validation={">":"GreaterThan",">=":"GreaterOrEqualTo","<":"LessThan","<=":"LessThanOrEqualTo","==":"EqualTo","!=":"NotEqualTo","!":"Not","=":""};t.Spreadsheet.ValidationText={">":"greater than",">=":"greater than or equal to","<":"less than","<=":"less than or equal to","==":"equal to","!=":"not equal to","!":" not","=":""};t.Spreadsheet.msg=" ";t.Spreadsheet.getMsg=function(){return t.Spreadsheet.msg};t.Spreadsheet.SelectionType={Row:"row",Column:"column",Default:"default"};t.Spreadsheet.SelectionUnit={Single:"single",Range:"range",MultiRange:"multirange"};t.Spreadsheet.Align={Left:"left",Right:"right",Center:"center"};t.Spreadsheet.CFormatRule={GreaterThan:"greaterthan",LessThan:"lessthan",Between:"between",EqualTo:"equalto",TextContains:"textcontains",DateOccur:"dateoccur"};t.Spreadsheet.ContextMenu={Cell:"cell",RowHeader:"rowheader",ColumnHeader:"columnheader",Footer:"footer"};t.Spreadsheet.CFormatHighlightColor={RedFillwithDarkRedText:"redft",YellowFillwithDarkYellowText:"yellowft",GreenFillwithDarkGreenText:"greenft",RedFill:"redf",RedText:"redt"};t.Spreadsheet.BorderType={Top:"top",Left:"left",Right:"right",Bottom:"bottom",OutSide:"outside",AllBorder:"allborder",ThickBox:"thickbox",ThickBottom:"thickbottom",TopandBottom:"topandbottom",TopandThickBottom:"topandthickbottom"};t.Spreadsheet.ChartProperties={PrimaryHorizontal:"PHAxis",PrimaryVertical:"PVAxis",PrimaryHorizontalAxisTitle:"PHAxisTitle",PrimaryVerticalAxisTitle:"PVAxisTitle",TitleNone:"CTNone",TitleCenter:"CTCenter",TitleFar:"CTFar",TitleNear:"CTNear",DataLabelNone:"DLNone",DataLabelCenter:"DLCenter",DataLabelInsideBase:"DLIBase",DataLabelInsideEnd:"DLIEnd",DataLabelOutsideEnd:"DLOEnd",PrimaryMajorHorizontal:"PMajorH",PrimaryMajorVertical:"PMajorV",PrimaryMinorHorizontal:"PMinorH",PrimaryMinorVertical:"PMinorV",LegendsNone:"LNone",LegendsLeft:"LLeft",LegendsRight:"LRight",LegendsBottom:"LBottom",LegendsTop:"LTop"};t.Spreadsheet.HideTypes={Default:"default",Freeze:"freeze"}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.selection=function(n){this.XLObj=n;this._isRightClick=!1;this._colhdrClick=!1;this._rowhdrClick=!1;this._aFillDownHandler=!1;this._isOutsideBordering=!1;this._isGridBordering=!1;this._isRowSelected=!1;this._isColSelected=!1;this._isEndReached=!0;this._canTouchMove=!1};t.spreadsheetFeatures.selection.prototype={_selectionMouseDownHandler:function(i){var e,o,r=this.XLObj,f=r.getSheet(),u=i.target;r._isTouchEvt?(r._browserDetails.name==="msie"&&i.preventDefault(),(r._isSelected(i.target)||r._hasClass(i.target,"e-autofill"))&&(e=r._getBrowserEvt("move"),this._canTouchMove=!0),o=r._getBrowserEvt("end")):(i.preventDefault(),e=r._getBrowserEvt("move",!0),o=r._getBrowserEvt("end",!0)+" mouseleave");r._on(n(document),o,this._mouseUpHandler);i.which===3||i.button===2||r.model.selectionSettings.selectionUnit===t.Spreadsheet.SelectionUnit.Single?this._isRightClick=!0:e&&r._on(r.element,e,this._mouseMoveHandler);u.tagName=="TD"?(r.XLEdit._isFormulaEdit?(i.ctrlKey&&(this._clearBorder(r._arrayAsString(r._ctrlFormulaBorder)),r._ctrlKeyCount=r._formulaRange.length),r._dStartCell=r._getCellIdx(u)):i.shiftKey&&f._startCell.rowIndex!=-1?f._endCell=r._getCellIdx(u):(f._startCell=r._getCellIdx(u),f._activeCell=r._getCellIdx(u)),u.className.indexOf("e-rowheader")>-1&&(this._rowhdrClick=!0)):u.parentNode.tagName=="TH"?(i.shiftKey&&f._startCell.rowIndex!=-1?f._endCell={rowIndex:0,colIndex:u.parentNode.cellIndex}:(f._startCell={rowIndex:0,colIndex:u.parentNode.cellIndex},f._activeCell={rowIndex:0,colIndex:u.parentNode.cellIndex}),u.className.indexOf("e-headercelldiv")>-1&&(this._colhdrClick=!0)):u.className=="e-autofill"&&(this._aFillDownHandler=!0)},_mouseMoveHandler:function(i){var o,l,a,u=this,e=u.XLSelection,s=u.getActiveSheetIndex(),r=u.getSheet(s),f=i.target,v,h=u.model.selectionSettings.selectionType,c=t.Spreadsheet.SelectionType,y=n(i.target).get(0);if(!u._isTouchEvt||(u._isTouchMoveSel=!0,l=u._getOriginalEvt(i),f=document.elementFromPoint(l.clientX,l.clientY),f))if(n(f).hasClass("e-rowcell")||n(f).hasClass("e-rowheader")){if(this.XLSelection._isEndReached=!1,u._getContent(s).find("td").removeClass(u._ctrlFormulaBorder[u._ctrlKeyCount%6].join(" ")),u.XLEdit._isFormulaEdit){i.ctrlKey?(u._dEndCell=u._getCellIdx(f),e._processFormulaRange(u._ctrlFormulaBorder,!0)):(u._dEndCell=u._getCellIdx(f),e._processFormulaRange(u._ctrlFormulaBorder,!0));return}if(e._aFillDownHandler&&n(f).parents(".e-rowheadercontent").length===0){if(u.model.allowAutoFill){a=u._getCellIdx(i.target);r._isFreezed&&a.rowIndex<=r.frozenRows&&r._hiddenFreezeRows.indexOf(r.frozenRows)>-1?e._scrollCalculation(s,f,{position:"vertical",action:"Decrement"}):r._isFreezed&&a.colIndex<=r.frozenColumns&&r._hiddenFreezeCols.indexOf(r.frozenColumns)>-1?e._scrollCalculation(s,f,{position:"horizontal",action:"Decrement"}):u.XLDragFill._selectAutoFillRange(f);return}}else if(r._startCell=r._activeCell,r._endCell=u._getCellIdx(f),r._isFreezed&&u.XLFreeze._selectionScroll(),e._processBoundary(),n(f).parents(".e-spreadsheetcontentcontainer").length>0){if(i.ctrlKey&&u.model.selectionSettings.selectionType===t.Spreadsheet.SelectionType.Default&&u.model.selectionSettings.selectionUnit===t.Spreadsheet.SelectionUnit.MultiRange){u._getContent(u.getActiveSheetIndex()).find("td").removeClass("e-activecell e-focusright e-focusbottom");v=u.swapRange([r._startCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex]);u.getRange(v).addClass("e-ctrlselected");e._focusRange(r._startCell,r._endCell,u._selectionBorder);u.model.allowAutoFill&&u.XLDragFill.hideAutoFillElement();return}h===c.Row||e._rowhdrClick?e.selectRows(r._startCell.rowIndex,r._endCell.rowIndex):h===c.Column||e._colhdrClick?e.selectColumns(r._startCell.colIndex,r._endCell.colIndex):e.selectRange(r._startCell,r._endCell,f);r._isFreezed&&u.XLFreeze._refreshSelection()}else if(n(f).parents(".e-rowheadercontent").length>0)e._colhdrClick||e._rowhdrClick?(h===c.Column?e.selectColumns(0,r.colCount-1):e.selectRows(r._startCell.rowIndex,r._endCell.rowIndex),r._isFreezed&&u.XLFreeze._refreshSelection()):(o={position:"horizontal",action:"Decrement"},e._scrollCalculation(s,f,o));else return}else if(t.isNullOrUndefined(f.parentNode)||f.parentNode.tagName!="TH")if(y.id.indexOf("chart")<1&&(f.className.indexOf("e-hhandlespace")>-1||f.className.indexOf("e-hhandle")>-1||f.className.indexOf("e-hup")>-1||f.className.indexOf("e-hdown")>-1))o={position:"vertical",action:"Increment"},e._scrollCalculation(s,f,o);else if(y.id.indexOf("chart")<1&&(f.className.indexOf("e-vhandlespace")>-1||f.className.indexOf("e-vhandle")>-1||f.className.indexOf("e-vup")>-1||f.className.indexOf("e-vdown")>-1))o={position:"horizontal",action:"Increment"},e._scrollCalculation(s,f,o);else return;else r._endCell={rowIndex:0,colIndex:f.parentNode.cellIndex},r._startCell=r._activeCell,r._isFreezed&&u.XLFreeze._selectionScroll(),e._processBoundary(),e._colhdrClick||e._rowhdrClick?(h===c.Row?e.selectRows(0,r.rowCount-1):e.selectColumns(r._startCell.colIndex,r._endCell.colIndex),r._isFreezed&&u.XLFreeze._refreshSelection()):(o={position:"vertical",action:"Decrement"},e._scrollCalculation(s,f,o))},_mouseUpHandler:function(i){i.target=this._changeTargetWithOffset(i);var e,h,v,l,k,d,a,o,g,nt,y,tt,it,p=!0,r=this,u=r.XLSelection,s=r.getActiveSheetIndex(),f=r.getSheet(s),rt=f.selectedRange,ut=r.getSheetElement(s),w=r.model.selectionSettings.selectionType,ft=f._startCell,et=f._endCell,b=t.Spreadsheet.SelectionType,c=r._getJSSheetContent(s).find(".e-spreadsheetcontentcontainer > .e-content");if(r.XLEdit._isEdit||r.setSheetFocus(),r._isTouchEvt?(tt=r._getBrowserEvt("end"),u._canTouchMove&&(y=r._getBrowserEvt("move")),r._isTouchMoveSel=!1):(y=r._getBrowserEvt("move",!0),tt=r._getBrowserEvt("end",!0)+" mouseleave"),y&&r._off(r.element,y,u._mouseMoveHandler),r._off(n(document),tt,u._mouseUpHandler),r._isTouchEvt){if(!u._aFillDownHandler&&r._isTouchScroll||!u._canTouchMove&&!r._isUniqueTarget(r._touchArgs,i)){u._canTouchMove=r._isTouchScroll=!1;return}if(u._canTouchMove=r._isTouchScroll=!1,it=r._getOriginalEvt(i),e=document.elementFromPoint(it.clientX,it.clientY),!e){this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();return}}if(e=e||i.target,h=n(e),e.tagName=="TD"||e.tagName=="INPUT"&&!h.parents(".e-formulabar").length||u._aFillDownHandler){if(h.parents(".e-rowheadercontent").length&&(u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor")),r._preventctrlkey=i.ctrlKey,r.XLEdit._isFormulaEdit){c.find("td").removeClass(r._ctrlFormulaBorder.join(" ").replace(/,/g," "));i.ctrlKey?(r._dEndCell=r._getCellIdx(e),u._processFormulaRange(r._formulaBorder)):(u._clearBorder(r._formulaBorder.join(" ").replace(/,/g," ")+" "+r._ctrlFormulaBorder.join(" ").replace(/,/g," ")),r._ctrlKeyCount=0,r._dEndCell=r._getCellIdx(e),u._processFormulaRange(r._formulaBorder),r._formulaRange=[]);r._formulaRange.push(r._getProperAlphaRange(s,r._dStartCell.rowIndex,r._dStartCell.colIndex,r._dEndCell.rowIndex,r._dEndCell.colIndex));return}if(u._aFillDownHandler){if(a=e.tagName==="TD"?r._getCellIdx(e):r._dautoFillCell,r.model.allowAutoFill&&(o=r.XLDragFill._getAutoFillRange(a)),!o||!o.fillRange){u._aFillDownHandler=!1;r.XLDragFill.positionAutoFillElement();return}if(k=r.swapRange(o.fillRange),r.model.allowLockCell&&r.getSheet(s).isSheetProtected&&r._isPropExists([k],"isLocked",s)&&(p=!1),p&&r._isPropExists([k],"isReadOnly",s)&&(p=!1),p)"direction"in o?(r._pStartCell=f._startCell,r._pEndCell=f._endCell,r._pFillCell=a,r.inRange(f.selectedRange,a.rowIndex,a.colIndex)?r.clearRangeData(null,null,n(u.getSelectedCells()).not(".e-autofillcell")):r.model.allowAutoFill&&r.XLDragFill.autoFill({dataRange:f.selectedRange,fillRange:o.fillRange,direction:o.direction,fillType:r.model.autoFillSettings.fillType}),f._startCell=o.startCell,f._endCell=o.endCell):u._aFillDownHandler=!1;else{u._aFillDownHandler=!1;r.XLSelection.selectRange(ft,et);r.XLDragFill.positionAutoFillElement();return}u.refreshSelection(r.swapRange([o.startCell.rowIndex,o.startCell.colIndex,o.endCell.rowIndex,o.endCell.colIndex]))}else if(u._isOutsideBordering||u._isGridBordering)if(l="1px "+r._borderStyle+" "+r._borderColor,u._isRightClick?f._endCell=f._startCell:(f._startCell=f._activeCell,f._endCell=r._getCellIdx(e),u._processBoundary()),h.parents(".e-spreadsheetcontentcontainer").length)g={top:l,right:l,bottom:l,left:l},u._isGridBordering&&(g.isGridBorder=!0),r.XLFormat.applyBorder(g,r.swapRange([f._startCell.rowIndex,f._startCell.colIndex,f._endCell.rowIndex,f._endCell.colIndex])),u._cleanUp(!0);else return;else if(e.tagName=="INPUT"&&h.parents("tr").length?f._endCell=u._isRightClick?f._startCell:r._getCellIdx(h.parents("td")[0]):u._isRightClick?f._endCell=f._startCell:(f._startCell=f._activeCell,f._endCell=r._getCellIdx(e),u._processBoundary()),h.parents(".e-spreadsheetcontentcontainer").length){if(i.ctrlKey&&r.model.selectionSettings.selectionType===t.Spreadsheet.SelectionType.Default&&r.model.selectionSettings.selectionUnit===t.Spreadsheet.SelectionUnit.MultiRange){c.find("td").removeClass("e-activecell e-focustop e-focusleft e-ctrlselected");rt=r.swapRange([f._startCell.rowIndex,f._startCell.colIndex,f._endCell.rowIndex,f._endCell.colIndex]);r.getRange(rt).addClass("e-selected");r.getCell(f._activeCell.rowIndex,f._activeCell.colIndex).addClass("e-activecell");u._focusRange(f._startCell,f._endCell,r._selectionBorder);r.model.allowAutoFill&&r.XLDragFill.hideAutoFillElement();r.getSheet(s)._selectedCells.push(r._getSelectedRange(r.getSheet(s)._startCell,r.getSheet(s)._endCell));r.model.showRibbon&&r.model.allowComments&&ut.find(".e-selected.e-commentcell").length&&r.XLRibbon._enableButtons(["Review_Comments_DeleteComment"],"ejButton");return}w===b.Row||u._rowhdrClick?u.selectRows(f._startCell.rowIndex,f._endCell.rowIndex):w===b.Column||u._colhdrClick?u.selectColumns(f._startCell.colIndex,f._endCell.colIndex):u.selectRange(f._startCell,f._endCell,e);f._isFreezed&&r.XLFreeze._refreshSelection()}else if(h.parents(".e-rowheadercontent").length)(u._colhdrClick||u._rowhdrClick)&&(w===b.Column?u.selectColumns(0,f.colCount-1):u.selectRows(f._startCell.rowIndex,f._endCell.rowIndex),u._hdrClick=!1),u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor");else return;e.tagName==="TD"&&r.model.showRibbon&&(nt=n("#"+r._id+"_Ribbon_clearfilter").data("ejButton"),nt&&r.XLRibbon._changeClrFltrStatus(nt,"button",r._getCellIdx(e)))}else u._aFillDownHandler||t.isNullOrUndefined(e.parentNode)||e.parentNode.tagName!="TH"?typeof e.className!="object"&&e.className&&e.className.indexOf("e-spreadsheetcolumnheader")>-1&&(u.selectSheet(!0),u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor")):(f._startCell=f._activeCell,f._endCell=u._isRightClick?f._startCell:{rowIndex:0,colIndex:e.parentNode.cellIndex},u._processBoundary(),(u._colhdrClick||u._rowhdrClick)&&(w===b.Row?u.selectRows(0,f.rowCount-1):u.selectColumns(f._startCell.colIndex,f._endCell.colIndex)),u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor"));r.model.allowCellFormatting&&r.XLFormat._formatEnable&&r.XLFormat._fPMouseUp(i);r.model.showRibbon&&(r.XLEdit._isEdit?r.XLRibbon._disableRibbonIcons():r.XLRibbon._updateRibbonIcons());!r.model.allowAutoFill||u._isOutsideBordering||u._isGridBordering||r.XLDragFill.positionAutoFillElement(u._aFillDownHandler);u._isRightClick=u._aFillDownHandler=!1;u._colhdrClick=u._rowhdrClick=!1;r.model.showRibbon&&(v=n("#"+r._id+"_Ribbon_merge").data("ejSplitButton"),t.isNullOrUndefined(v)||!r.model.allowLockCell||f.isSheetProtected||(r.XLRibbon._isDirtySelect?v.option("enabled",!1):v.option("enabled",!0)));r.model.allowEditing&&this.XLEdit._isEdit&&(d=r.getSheet(s)._startCell,r.getCell(d.rowIndex,d.colIndex).find(".e-ss-input").focus())},_processBoundary:function(){var u,o,f,t,e,r,s=[],i=this.XLObj,c=i.getActiveSheetIndex(),h=i.getSheet(c),l=h._startCell,a=h._endCell,n=i.swapRange([l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]);for(h._startCell={rowIndex:n[0],colIndex:n[1]},h._endCell={rowIndex:n[2],colIndex:n[3]},t=i._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[0],colIndex:n[3]}),t=t.concat(i._getSelectedRange({rowIndex:n[0],colIndex:n[3]},{rowIndex:n[2],colIndex:n[3]})),t=t.concat(i._getSelectedRange({rowIndex:n[2],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]})),t=t.concat(i._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[1]})),u=t.length;u--;)if(f=t[u],e=i.XLEdit.getPropertyValue(t[u].rowIndex,t[u].colIndex,"mergeIdx",c),r=(f.rowIndex+":"+f.colIndex).toString(),o=i.hasSpan(f)&&s.indexOf(r)===-1&&(s.push(r),this._updateRange(f,n)),e&&(r=(e.rowIndex+":"+e.colIndex).toString(),s.indexOf(r)===-1&&(s.push(r),o=this._updateRange(e,n))),o)break;o&&this._processBoundary()},_updateRange:function(n,t){var r=this.XLObj,c=r.getActiveSheetIndex(),u=r.getSheet(c),i=t.slice(0),f=r._getMergedIdx(n.rowIndex,n.colIndex),e=n.rowIndex,o=n.colIndex,s=f.rowIndex,h=f.colIndex;return e<t[0]&&(t[0]=e),o<t[1]&&(t[1]=o),s>t[2]&&(t[2]=s),h>t[3]&&(t[3]=h),t[0]!=i[0]||t[1]!=i[1]||t[2]!=i[2]||t[3]!=i[3]?(u._startCell={rowIndex:t[0],colIndex:t[1]},u._endCell={rowIndex:t[2],colIndex:t[3]},!0):void 0},selectRange:function(n,t,i,r){var s,c,l,e,v,a,y,p,f,h,o=n,u=this.XLObj;if(u.model.allowSelection&&(u._isObject(n)||(n=u._getRangeArgs(n,"object"),o={rowIndex:n[0],colIndex:n[1]},t={rowIndex:n[2],colIndex:n[3]}),h=u.getActiveSheetIndex(),f=u.getSheet(h),y=u.model.scrollSettings.allowVirtualScrolling,y&&(f._goToCollection={multiple:!1,selected:[]}),p=f.selectedRange,e=u.swapRange([o.rowIndex,o.colIndex,t.rowIndex,t.colIndex]),v=!u.isImport&&(!f._isImported||f._isLoaded),!v||!u.model.beforeCellSelect||(s={prevRange:p,currRange:e,sheetIdx:h},i&&(s.target=i),u._intrnlReq||!u._trigger("beforeCellSelect",s)))){if(u._dStartCell=o,u._dEndCell=t,f.selectedRange=e.slice(0),this._cleanUp(!1),u.model.scrollSettings.allowScrolling&&y&&f._isColSelected&&(f._virtualRowIdx.indexOf(e[0])===-1&&(e[0]=f._virtualRowIdx[0]),f._virtualRowIdx.indexOf(e[2])===-1&&(e[2]=f._virtualRowIdx[f._virtualRowIdx.length-1])),a=u.isUndefined(r),a&&(c=u.getRange(e),l=c.length,l))while(l--)u.addClass(c[l],"e-selected");u.inRange(f.selectedRange,f._activeCell.rowIndex,f._activeCell.colIndex)||(f._activeCell={rowIndex:f.selectedRange[0],colIndex:f.selectedRange[1]});f._activeCell=u._getMergeParent(f._activeCell.rowIndex,f._activeCell.colIndex);u._isRowViewable(h,f._activeCell.rowIndex)&&u.addClass(u.getCell(f._activeCell.rowIndex,f._activeCell.colIndex)[0],"e-activecell");a&&(this._focusRange(o,t,u._selectionBorder),this._highlightHeader(e));f._selectedCells=u._getSelectedRange(o,t);u.model.allowFormulaBar&&u.updateFormulaBar();o.rowIndex===0&&t.rowIndex===f.rowCount-1&&(this._isColSelected=!0);o.colIndex===0&&t.colIndex===f.colCount-1&&(this._isRowSelected=!0);a&&(u.model.enableContextMenu||u.model.showRibbon)&&u.XLRibbon._dirtySelect(c);u._isMultiSelect=!0;u.model.showRibbon&&u.XLRibbon._updateRibbonIcons();u._isSheetNavigate||(f._isEmptyActiveCell=f._isRangeSelected=f._isRowSelected=f._isColSelected=f._isSheetSelected=!1);v&&u.model.cellSelected&&(s={selectedRange:f.selectedRange,target:i,sheetIdx:h},u._intrnlReq||u._trigger("cellSelected",s))}},selectRow:function(n){var i=this.XLObj,t=i.getSheet(i.getActiveSheetIndex());i.model.allowSelection&&(t._startCell={rowIndex:n,colIndex:0},t._endCell={rowIndex:n,colIndex:t.colCount-1},this.selectRange(t._startCell,t._endCell),this._selectRow(i._getRowIdx(n),"e-rowselected"),t._isRowSelected=!0)},selectRows:function(n,t){var i,r=this.XLObj;r.model.allowSelection&&(i=r.getSheet(r.getActiveSheetIndex()),i._startCell={rowIndex:n,colIndex:0},i._endCell={rowIndex:t,colIndex:i.colCount-1},this.selectRange(i._startCell,i._endCell),this._markHeaderSelection([i._startCell.rowIndex,i._startCell.colIndex,i._endCell.rowIndex,i._endCell.colIndex],"row"),i._isRowSelected=!0)},selectColumn:function(n){var t,i=this.XLObj;i.model.allowSelection&&(t=i.getSheet(i.getActiveSheetIndex()),t._startCell={rowIndex:0,colIndex:n},t._endCell={rowIndex:t.rowCount-1,colIndex:n},this.selectRange(t._startCell,t._endCell),this._selectColumn(n,"e-colselected"),t._isColSelected=!0)},selectColumns:function(n,t){var i,r=this.XLObj;r.model.allowSelection&&(i=r.getSheet(r.getActiveSheetIndex()),i._startCell={rowIndex:0,colIndex:n},i._endCell={rowIndex:i.rowCount-1,colIndex:t},this.selectRange(i._startCell,i._endCell),this._markHeaderSelection([i._startCell.rowIndex,i._startCell.colIndex,i._endCell.rowIndex,i._endCell.colIndex],"column"),i._isColSelected=!0)},selectSheet:function(n){var i=this.XLObj,t=i.getSheet(i.getActiveSheetIndex());i.model.allowSelection&&(n&&(t._activeCell={rowIndex:t._topRow.idx,colIndex:0}),t._startCell={rowIndex:0,colIndex:0},t._endCell={rowIndex:t.rowCount-1,colIndex:t.colCount-1},this.selectRange(t._startCell,t._endCell),i.element.find(".e-spreadsheetcolumnheader").addClass("e-sheetselected"),t._isSheetSelected=!0)},refreshSelection:function(n){var t=this.XLObj,i=t.getSheet(t.getActiveSheetIndex()),n=t._getRangeArgs(n,"object"),r=n[0],u=n[1],f=n[2],e=n[3];i._isRowSelected?this.selectRows(r,f):i._isColSelected?this.selectColumns(u,e):i._isSheetSelected?this.selectSheet():this.selectRange({rowIndex:r,colIndex:u},{rowIndex:f,colIndex:e})},getSelectedCells:function(n){return this.XLObj._getContent(this.XLObj._getSheetIndex(n))[0].querySelectorAll("td.e-selected")},_select:function(n,t){var i=this.XLObj.getCell(n.rowIndex,n.colIndex);i&&i.addClass(t)},_selectRow:function(n,t){var i=this.XLObj._getJSSheetRowHeaderContent(this.XLObj.getActiveSheetIndex()).find("td:eq("+n+")");i&&i.addClass(t)},_selectRows:function(n,t,i){var r,e,u,f=this.XLObj,h=f.getActiveSheetIndex(),s=f.getSheet(h),o=f._getJSSheetRowHeaderContent(h).find("td");if(e=f._getRowIdx(n),u=f._getRowIdx(t),e===-1)if(n<s._virtualRowIdx[0])e=0;else return;if(u===-1)if(r=s._virtualRowIdx.length-1,t>s._virtualRowIdx[r])u=r;else return;if(o=e!==u?o.slice(e,u+1):o.eq(u),r=o.length,r)while(r--)f.addClass(o[r],i)},_selectColumn:function(n,t){var i=this.XLObj._getJSSheetHeader(this.XLObj.getActiveSheetIndex()).find("th:eq("+n+")");i&&i.addClass(t)},_selectColumns:function(n,t,i){var u,f=this.XLObj,r=f._getJSSheetHeader(f.getActiveSheetIndex()).find("th");if(r=t!==n?r.slice(n,t+1):r.eq(t),u=r.length,u)while(u--)f.addClass(r[u],i)},_focusBorder:function(n,t,i){var r=this.XLObj,e=r.swapRange([n.rowIndex,n.colIndex,t.rowIndex,t.colIndex]),u=e[0],f=e[1],o=e[2],s=e[3];u&&r.getRange([u-1,f,u-1,s]).addClass(i[1]);r.getRange([u,s,o,s]).addClass(i[0]);r.getRange([o,f,o,s]).addClass(i[1]);f&&r.getRange([u,f-1,o,f-1]).addClass(i[0])},_focusRange:function(n,t,i){for(var u=4,r=this.XLObj,f=[r.getFocusTopElem(),r.getFocusRightElem(),r.getFocusBottomElem(),r.getFocusLeftElem()],e=["e-focustop ","e-focusright ","e-focusbottom ","e-focusleft "];u--;)elem=f[u][0],r._removeClass(elem),r.addClass(elem,e[u]+i[u]);this._refreshBorder(r.swapRange([n.rowIndex,n.colIndex,t.rowIndex,t.colIndex]))},_refreshBorder:function(n){n=n?n:this.XLObj.getSheet().selectedRange;for(var u,f,r="e-hide",a=4,v=n[0],y=n[1],i=this.XLObj,t=this._focusInfo(n),e=i.getFocusTopElem(),s=i.getFocusRightElem(),h=i.getFocusBottomElem(),o=i.getFocusLeftElem(),tt=[e,s,h,o],p=ttop=t.topLeft.top,w=lleft=tleft=t.topLeft.left,b=t.topRight.left+t.topRight.width-t.topLeft.left,c=t.topRight.top,k=t.topRight.left+t.topRight.width,d=t.bottomRight.top+t.bottomRight.height-c,l=t.bottomLeft.top+t.bottomLeft.height,g=t.bottomRight.left+t.bottomRight.width-t.bottomLeft.left,nt=l-ttop;a--;)i._removeClass(tt[a][0],r);i.model.selectionSettings.enableAnimation?(u=i.model.selectionSettings.animationType,f=i.model.selectionSettings.animationTime,v?e.animate({top:ttop.toString(),left:tleft.toString(),width:b.toString()},f,u):e.addClass(r),s.animate({top:c.toString(),left:k.toString(),height:d.toString()},f,u),h.animate({top:l.toString(),left:w.toString(),width:g.toString()},f,u),y?o.removeClass(r).animate({top:p.toString(),left:lleft.toString(),height:nt.toString()},f,u):o.addClass(r)):(v?e.css({top:ttop,left:tleft,width:b}):e.addClass(r),s.css({top:c,left:k,height:d}),h.css({top:l,left:w,width:g}),y?o.css({top:p,left:lleft,height:nt}):o.addClass(r))},_focusInfo:function(n){var i={},u=n[0],f=n[1],e=n[2],r=n[3],t=this.XLObj;return i.topLeft=t._getCellInfo({rowIndex:u,colIndex:f}),i.topRight=t._getCellInfo(f===r?{rowIndex:u,colIndex:r}:t._getMergedIdx(u,r)),i.bottomLeft=t._getCellInfo({rowIndex:e,colIndex:f}),i.bottomRight=t._getCellInfo(t._getMergedIdx(e,r)),i},_highlightHeader:function(n){this._selectRows(n[0],n[2],"e-rowhighlight");this._selectColumns(n[1],n[3],"e-colhighlight")},_hideShowSelElem:function(n){(xlObj=this.XLObj,method=n==="block"?"_removeClass":"addClass",xlObj.model.allowSelection)&&(xlObj[method](xlObj.getAutoFillElem()[0],"e-hide"),xlObj[method](xlObj.getFocusBottomElem()[0],"e-hide"),xlObj[method](xlObj.getFocusTopElem()[0],"e-hide"),xlObj[method](xlObj.getFocusLeftElem()[0],"e-hide"),xlObj[method](xlObj.getFocusRightElem()[0],"e-hide"))},_markHeaderSelection:function(n,t){var i,r,u=this.XLObj;if(n=u.swapRange(n),i=n[0],t==="row")for(r=n[2];i<=r;)u._isRowViewable(u.getActiveSheetIndex(),i)&&this._selectRow(u._getRowIdx(i),"e-rowselected"),i++;else for(i=n[1],r=n[3];i<=r;)this._selectColumn(i,"e-colselected"),i++},_processFormulaRange:function(n){var u,t=this.XLObj,f=t.getActiveSheetIndex(),i=t._dStartCell,r=t._dEndCell,e=t._getContent(f).find(".e-editedcell");this._focusBorder(i,r,n[t._ctrlKeyCount%6]);t.model.allowAutoFill&&(u=t._getAlphaRange(f,i.rowIndex,i.colIndex,r.rowIndex,r.colIndex),t.XLDragFill.hideAutoFillElement(),t.XLEdit._updateFormulaCellRange(u));t.XLEdit._isCellEdit?t.XLEdit._focusElements(e):t._getInputBox().focus()},_scrollCalculation:function(n,i,r){var s,c,e,o,f=this.XLObj,u,h;f.model.scrollSettings.allowVirtualScrolling||(u=f.getSheet(f.getActiveSheetIndex()),f.XLSelection._isEndReached=!0,s=setInterval(function(){if(e=f.XLScroll._hScroller(n),o=f.XLScroll._vScroller(n),!f.XLSelection._isEndReached){clearInterval(s);return}if(r.position==="horizontal")r.action=="Increment"?(c=Math.ceil(parseFloat(e.element.find(".e-hhandle").css("left")))+Math.ceil(parseFloat(e.element.find(".e-hhandle").width()))>=e.element.find(".e-hhandlespace").width()-2,c?f.model.scrollSettings.scrollMode!=t.Spreadsheet.scrollMode.Normal?f.XLScroll._scrollX(n):clearInterval(s):e.scroll(e.value()+u.columnWidth,!0),f.XLShape._shapeROStart||f.XLShape._shapeRSStart||(u._endCell.colIndex=u.colCount-1)):(h=e.value()-u.columnWidth,h<0&&(h=0),e.value()>=0&&e.scroll(h,!0),f.XLSelection._aFillDownHandler&&(u._endCell.colIndex=u._leftCol.idx),u._frozenColumns>1&&(u._startCell=u._activeCell,u._endCell.rowIndex=u.selectedRange[2]===u._startCell.rowIndex?u.selectedRange[0]:u.selectedRange[2],u._endCell.colIndex=u._fleftColIdx));else if(r.position==="vertical")if(r.action=="Increment")c=Math.ceil(parseFloat(o.element.find(".e-vhandle").css("top")))+Math.ceil(parseFloat(o.element.find(".e-vhandle").height()))>=o.element.find(".e-vhandlespace").height()-2,c?f.model.scrollSettings.scrollMode!=t.Spreadsheet.scrollMode.Normal?f.XLScroll._scrollY(n):clearInterval(s):o.scroll(o.value()+f.model.rowHeight,!0),f.XLShape._shapeROStart||f.XLShape._shapeRSStart||(u._endCell.rowIndex=u.rowCount-1);else if(h=o.value()-f.model.rowHeight,h<0&&(h=0),o.value()>0&&o.scroll(h,!0),!f.XLShape._shapeROStart&&!f.XLShape._shapeRSStart){if(u._topRow.idx<1&&u._ftopRowIdx+1===u._frozenRows)return;u._startCell=u._activeCell;u._endCell.rowIndex=u._frozenRows>1?u._ftopRowIdx:u._topRow.idx-1;u._endCell.colIndex=u._frozenRows>1?u.selectedRange[3]===u._startCell.colIndex?u.selectedRange[1]:u.selectedRange[3]:i.parentNode.cellIndex}f.XLShape._shapeROStart||f.XLShape._shapeRSStart||(f.XLSelection._aFillDownHandler?f.XLDragFill._selectAutoFillRange(null,u._endCell):f.XLSelection.selectRange(u._startCell,u._endCell))},200),f._browserDetails.name==="msie"&&f._browserDetails.version==="8.0"?(i.attachEvent("onmouseup",function(){clearInterval(s)}),document.attachEvent("onmouseup",function(){clearInterval(s)})):(i.addEventListener("mouseup",function(){clearInterval(s)}),document.addEventListener("mouseup",function(){clearInterval(s)})))},_cleanUp:function(n){var i,r,o=!1,u="e-hide",t=this.XLObj,f=t.getActiveSheetIndex(),s=t.getSheet(f),h=t.getFocusTopElem(),e=t.getSheetElement(f);for(t.model.allowAutoFill&&t.XLDragFill._autoFillCleanUp(),s._isSheetSelected&&!t.model.scrollSettings.allowVirtualScrolling&&(o=!0,e.detach()),r=e[0].querySelectorAll(".e-selected,.e-rowselected,.e-colselected,.e-rowhighlight,.e-colhighlight,.e-sheetselected,.e-activecell"),i=r.length;i--;)r[i].className=r[i].className.replace(new RegExp("e-activecell|e-selected|e-rowhighlight|e-colhighlight|e-rowselected|e-colselected|e-sheetselected","g"),"").replace(/ +/g," ");o&&t.getMainPanel(f).find(".e-spreadsheet-list").append(e);n&&h&&(t.addClass(h[0],u),t.addClass(t.getFocusRightElem()[0],u),t.addClass(t.getFocusBottomElem()[0],u),t.addClass(t.getFocusLeftElem()[0],u));s._selectedCells=[]},clearAll:function(n){this._cleanUp(!n)},_clearBorder:function(n){var t=this.XLObj;t._getContent(t.getActiveSheetIndex()).find("td").removeClass(n)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.filter=function(n){this.XLObj=n;this._isSearchEdit=!1;this._isDecimal=!1;this._colName="";this._colType="";this._tableId=""};t.spreadsheetFeatures.filter.prototype={_renderExcelFilter:function(){var n=this.XLObj,i={instance:n,showSortOptions:n.model.allowSorting,maxFilterLimit:n.model.sheets[n.getActiveSheetIndex()].filterSettings.maxFilterChoices,filterHandler:t.proxy(this._filterHandler,this),cancelHandler:t.proxy(this._cancelHandler,this),customFilterHandler:t.proxy(this._customFilterHandler,this),enableComplexBlankFilter:!1,blankValue:"",interDeterminateState:!0};n._excelFilter=new t.excelFilter(i);n.element.append(t.buildTag("div#"+n._id+"_filter_custom.e-filterdlg.e-"+n._id+"-dlg","",{display:"none"}))},_customFilterHandler:function(){var t=this.XLObj;this._isDecimal&&(n("#"+t._id+"number_CustomValue1").ejNumericTextbox("option",{decimalPlaces:2}),n("#"+t._id+"number_CustomValue2").ejNumericTextbox("option",{decimalPlaces:2}))},_renderFilterDialogs:function(t){var i=this.XLObj;document.getElementById(i._id+"_filter_custom").className.indexOf("e-dialog")<0&&this._renderCustomFilter();i._excelFilter.renderDialog(t);this._refreshCustomFilter(t);i.element.find(".e-excelfilter.e-dlgcontainer").hide();n(document.body).append(n("#"+i._id+t+"_excelDlg"))},_createSelection:function(n,t,i,r,u){for(var e=this.XLObj,c=e.getSheet(n).usedRange.rowIndex,o=i,s,h,f=i;f<=c;f++){if(s=e.XLEdit.getPropertyValue(f,0,"isHide"),h=e.XLEdit.getPropertyValue(f,r,"value2",n),e.XLEdit.getPropertyValue(f,r,"tableName",n))break;if(!s&&!e.XLEdit.getPropertyValue(f,r,"isMHide")&&!h&&f>=i)return{endRowIndex:f,filteredIndex:u};!s&&h?(o=f+1,u.push(f)):o=o}return{endRowIndex:o,filteredIndex:u}},_getSelectedRangeData:function(n,i,r,u){var o=this.XLObj,s=0,p=o.getActiveSheetIndex(),c=o.getSheet(p),b=[],v,f,h,l,k=[],y,d,g=[],a=o._dataContainer,e=a.sheets[p],w=o.getSheet(p)._multifilterIdx;for(r===-1&&(c.filterSettings.range=o._generateHeaderText(w[0]+1)+n.rowIndex+":"+o._generateHeaderText(w[w.length-1]+1)+(i.rowIndex+1)),c._multipleFiltering&&(i.colIndex=c._multifilterIdx[c._multifilterIdx.length-1]),f=n.rowIndex;f<=i.rowIndex;f++){for(temp={},h=n.colIndex;h<=i.colIndex;h++)v=o._generateHeaderText(h+1),f in e&&(!(s in e[f])||s in e[f]&&t.isNullOrUndefined(e[f][s].isRHide)&&t.isNullOrUndefined(e[f][s].isFHide))&&(!(s in e[f])||s in e[f]&&(t.isNullOrUndefined(e[f][s].isFilterHide)||!t.isNullOrUndefined(e[f][s].isFilterHide)&&e[f][s].filterID===r))&&(temp.idx=f,f in e&&h in e[f]?(l=e[f][h],h===u&&(y=o.XLEdit.getPropertyValue(f,h,"formats"),t.isNullOrUndefined(y)||(d={id:h,background:y["background-color"],foreground:y.color},k.push(d))),temp[v]=t.isNullOrUndefined(a.sharedData[l.value])?"":o._isDateTime(a.sharedData[l.value])||o.isFormula(a.sharedData[l.value])?l.value2:a.sharedData[l.value]):temp[v]=""),!(f in e)&&f<i.rowIndex&&(temp.idx=f,temp[v]="");o.getObjectLength(temp)>0&&(g.push(temp),b.push(f))}c._selectedCellColors=k;c._selectedRange={startRow:n.rowIndex,endRow:i.rowIndex,dataSourceIndexes:b};c.filterSettings.filteredRange=g},_getColumnType:function(t,i,r,u){for(var o="string",e,s,f=i;f<r;f++)if(e=this.XLObj.XLEdit.getPropertyValue(f,u,"value",t),s=this.XLObj.XLEdit.getPropertyValue(f,u,"type",t),s!="text"&&n.isNumeric(e))this._isDecimal||(this._isDecimal=e%1!=0),o="number";else return"string";return o},_getColumnByField:function(n,t){for(var u=this.XLObj,r=u.getSheet(n),i=0;i<r.columns.length;i++)if(r.columns[i].field===t)break;return i===r.columns.length?null:r.columns[i]},_checkEmptyText:function(n){for(var r=this.XLObj,u=r.model.sheets[n]._selectedCells,i=0,f=u.length;i<f;i++)if(!t.isNullOrUndefined(r.XLEdit.getPropertyValue(u[i].rowIndex,u[i].colIndex,"value",n)))return!0;return r._showAlertDlg("Alert","Alert",null,440),!1},_getFilterIcon:function(){var n=t.buildTag("span .e-icon","",{});return n.addClass("e-spanfilter e-filterspan e-ssfilter"),n},filterByActiveCell:function(){var n=this.XLObj,i=n.getActiveSheetIndex(),r;if(n.model.allowFiltering&&!n.model.isReadOnly){var t=n.model.sheets[i]._activeCell,u=n.getCell(t.rowIndex,t.colIndex),f=n.model.sheets[i]._selectedCells;this._checkEmptyText(i)&&(u.find("span").is(".e-ssfiltered, .e-ssfilter, .e-ssfilter-asc, .e-ssfiltered-asc, .e-ssfilter-dsc, .e-ssfiltered-dsc")?n._showAlertDlg("Alert","HeaderAlert","",440):(r=n.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"value",i),r=n._isDateTime(r)?n.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"value2",i):r,this._filterActiveCell(i,t,f,r)))}},_filterActiveCell:function(n,t,i,r,u){var f=this.XLObj,e=f.getSheet(n);e._activeCell=t;this._filterByValue(n,u,e.columns[t.colIndex].field,"or","equal",r,i);f.model.allowComments&&f.XLComment._updateCmntArrowPos()},_filterByValue:function(i,r,u,f,e,o,s){var c=this.XLObj,s,a,p,k,tt,it,d,g=-1,rt,w,h,v,ut=c.XLEdit.getColumnIndexByField(u),y=c.getSheet(i),b,nt,l;if(t.isNullOrUndefined(r)?s=s:(a=c.getRangeIndices(r),s=c._getSelectedRange({rowIndex:a[0]+1,colIndex:a[1]},{rowIndex:a[2],colIndex:a[3]})),p=s[0],!t.isNullOrUndefined(r)&&(w=c.XLEdit.getPropertyValue(p.rowIndex,p.colIndex,"value2",i),t.isNullOrUndefined(w)||w!==o))for(l=a[0];l<a[2];l++)if(w=c.XLEdit.getPropertyValue(l,ut,"value2",i),!t.isNullOrUndefined(w)&&w===o){p={rowIndex:l,colIndex:ut};break}for(v={currentFilteringColumn:u,action:"filter",predicated:f,requestType:"filterbycell",reqType:"filter",filteredValue:o,selCells:n.extend(!0,[],s),activeCell:p},h=this._applyFilterByValue(i,p,s,o),c._excelFilter._predicates[i]={},k={field:u,value:o,predicate:f,operator:e,matchcase:!1},{}.currentFilterCollection=o,c._excelFilter._predicates[i][u]=t.Predicate(u,e,o),y.filterSettings.filteredColumns.push(k),tt=t.DataManager(y.filterSettings.filteredColumns),it=(new t.Query).where("field",t.FilterOperators.equal,u),d=tt.executeLocal(it),l=0,rt=d.length;l<rt;l++)g=n.inArray(d[l],y.filterSettings.filteredColumns),g>-1&&y.filterSettings.filteredColumns.splice(g,1);if(y.filterSettings.filteredColumns.push(k),v.filteredcolumns=h.filteredColumns=y.filterSettings.filteredColumns,h.filteredColumns.length<1)for(b=h.multifilterIdx,l=b[0];l<=b[b.length-1];l++)nt=c._generateHeaderText(l+1),t.isNullOrUndefined(h.fColumns[nt])||(h.fColumns[nt]=[]);else h.fColumns[u]=n.extend(!0,[],h.filteredColumns);h.predicate=c._excelFilter._predicates[i];v.tableID=h.tableID;v.filteredCells=h.filteredCells;c.XLSelection._refreshBorder();v.operation="filterbycell";v.selRange=c._getAlphaRange(i,h.startRow-1,h.multifilterIdx[0],h.endRow,h.multifilterIdx[h.multifilterIdx.length-1]);c._processBindings(v)&&(y.filterSettings.filteredColumns=temp)},_applyFilterByValue:function(i,r,u){var s=this.XLObj,e=s.getSheet(i),b=[],v,h,y,tt,a,ft=s.getCell(r.rowIndex,r.colIndex)[0].className,c=e.filterSettings.tableRange,it=[],o,l,rt=!1,d,p,et=s.model.scrollSettings.allowVirtualScrolling,g=s.getSheet(i)._filterColl,w,k,nt,f,ut;for(a=s.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tableName",i),a=a?s._getTableID(a):-1,f=0,p=c.length;f<p;f++)if(c[f].tableID===a){l=f;break}if(!t.isNullOrUndefined(l)&&c[l].tableID===a&&c[l].selectedCellIndexes.indexOf(r.colIndex)!==-1&&c[f].startRow<=r.rowIndex&&c[f].endRow>=r.rowIndex)o=c[l],e.filterSettings.filteredRange=c[l].filteredRange,e._selectedRange=c[l].selectedRange;else{for(e._multipleFiltering=!1,e._multifilterIdx=[],s._dupDetails=!0,this.clearFilter("remove"),s._dupDetails=!1,w=s.getObjectKeys(g),f=w.length-1;f>=0;f--)for(k=s.getObjectKeys(g[f]),j=k.length-1;j>=0;j--)s._isRowViewable(i,w[f])&&(nt=s.getCell(w[f],k[j]),nt.find(".e-filterspan").remove(),nt.removeClass("e-filterhdr")),delete g[w[f]][k[j]];if(u.length<2||u[0].rowIndex===u[u.length-1].rowIndex){for(h=-1,y=u[u.length-1].rowIndex,f=u[0].rowIndex;f>=0;f--)if(t.isNullOrUndefined(s.XLEdit.getPropertyValue(f,u[0].colIndex,"value2"))){h=f;break}h=h===-1?1:h+2;y=this._createSelection(i,h,y,u[0].colIndex,[]).endRowIndex-1;v={rowIndex:y,colIndex:r.colIndex};this._getSelectedRangeData({rowIndex:h,colIndex:r.colIndex},v,-1,r.colIndex)}else h=r.rowIndex,y=this._createSelection(i,h,u[u.length-1].rowIndex,u[0].colIndex,[]).endRowIndex-1,v={rowIndex:y,colIndex:r.colIndex},this._getSelectedRangeData({rowIndex:h,colIndex:r.colIndex},v,-1,r.colIndex);for(ut=s.getSheet(i)._filterColl,f=u[0].colIndex,p=u[u.length-1].colIndex;f<=p;f++)b.push(f),tt=this._getFilterIcon(),h=h===0?1:h,d={rowIndex:h-1,colIndex:f},this._applyFilterIcon(d,tt),it.push(d);for(s.XLScroll._getColWidths(i,u[0].colIndex),b.length>1&&(e._multipleFiltering=!0),e._multifilterIdx=b,e._selectedCellIndexes=b,f=0,p=c.length;f<p;f++)if(c[f].tableID===a){l=f;rt=!0;break}rt?(o=c[l],o.startRow=r.rowIndex,o.endRow=v.rowIndex,o.multiFiltering=e._multipleFiltering,o.multifilterIdx=e._multifilterIdx,o.selectedCellIndexes=e._multifilterIdx,o.selectedRange=n.extend(!0,{},e._selectedRange),o.filteredRange=n.extend(!0,{},e.filterSettings.filteredRange),o.hiddenIdx=[],o.flterdIdxes=[],o.fColumns={},o.tableID=a,o.filterCollection=[]):(e.filterSettings.tableRange.push({filterCollection:[],startRow:h,endRow:v.rowIndex,tableID:-1,fColumns:{},flterdIdxes:[],multiFiltering:e._multipleFiltering,multifilterIdx:e._multifilterIdx,selectedCellIndexes:e._multifilterIdx,selectedRange:n.extend(!0,{},e._selectedRange),filteredRange:e.filterSettings.filteredRange,hiddenIdx:[]}),o=c[c.length-1]);o.filteredCells=it}return o},clearFilter:function(i){var r=this.XLObj,k;if(!r.model.isReadOnly){var d=!1,f=r.getActiveSheetIndex(),y,a=r.getSheet(f),p=n.extend(!0,{},a._filterColl),rt=r._dupDetails,g,l=a.filterSettings.tableRange,v=-1,u,e,nt,tt=[],b=r._dataContainer.sheets[f],o,h,c=r.getObjectKeys(p),s,w,it=[],ut=a.filterSettings.filteredRange,ft=a.filterSettings.filteredColumns,et=a.filterSettings.range;if(l.length){for(u=0;u<l.length;u++)if(l[u].tableID===-1){v=u;break}for(g=l[v].selectedRange,u=c.length-1;u>=0;u--)for(s=r.getObjectKeys(p[c[u]]),e=s.length-1;e>=0;e--)o=parseInt(c[u]),h=parseInt(s[u]),t.isNullOrUndefined(r.XLEdit.getPropertyValue(o,h,"tableName",f))&&(tt.push({rowIndex:o,colIndex:h}),fltrdCol=p[c[u]][s[e]],fltrdCol.status.indexOf("e-ssfiltered")>-1&&(y=r.model.sheets[f].columns[s[e]].field,it.push({fieldName:y,predicate:l[v].predicate,filterCollection:l[v].filterCollection,action:"filtering",tableID:-1,predicate:r._excelFilter._predicates[f][y]}),delete r._excelFilter._predicates[f][y],r._dupDetails=!0,this._clearFilterColumn(y,"","","Or","","",-1),r._dupDetails=!1,d=!0),i==="remove"&&(delete p[c[u]][s[e]],delete b[c[u]][s[e]].isFilterHeader,delete b[c[u]][s[e]].filterState,delete b[c[u]][s[e]].isFilterVisible,r._isRowViewable(f,o)&&(w=r.getCell(o,h),n.isNumeric(r.XLEdit.getPropertyValue(o,h))&&w.addClass(r._rAlign),w.find(".e-filterspan").remove(),r.addClass(w[0],"e-wrapword"),r.XLEdit.getPropertyValue(o,h,"isFilterWrap")&&r.setWrapText("wrap",r._getAlphaRange(f,o,h,o,h)),r._removeClass(w[0],"e-filterhdr"))));i==="remove"&&(r._dupDetails=rt,a._filterColl=p,v>-1&&(nt=l.splice(v,1)[0]),r.model.allowComments&&r.XLComment._updateCmntArrowPos(),r._isUndoRedo||r._dupDetails||(k={sheetIndex:f,operation:"remove-filter",status:i,process:"apply-filter",filteredCells:tt,requestType:"filter",reqType:"filter",fRange:r.getSheet(f).filterSettings.range,filterRange:nt,filterCollection:it,filteredCols:ft,fltrdRange:ut,selRange:g},r._completeAction(k),r._trigActionComplete(k)));d&&(n("#"+r._id+"_Ribbon_Data_SortFilter_ClearFilter").ejButton("disable"),n("#"+r._id+"_Ribbon_SortFilter").ejMenu("disableItemByID","Ribbon_ClearFilter"))}}},filter:function(n){var i=this.XLObj;if(i.model.allowFiltering&&!i.model.isReadOnly){var f=i.getActiveSheetIndex(),u=i.getSheet(f),o=!1,y=u._activeCell,e,c,h=u.filterSettings.tableRange,l,r,a,p,v,s;for(u._multipleFiltering=!1,u._multifilterIdx=[],e=i.XLEdit.getPropertyValue(y.rowIndex,y.colIndex,"tableName",f),t.isNullOrUndefined(e)||(e=i._getTableID(e)),r=0,a=h.length;r<a;r++)h[r].tableID===-1&&(o=!0),l=r;if(s={range:i._getRangeArgs(n,"string"),reqType:t.Spreadsheet.Actions.Filtering,sheetIndex:f},i._trigActionBegin(s))return!0;if(n=s.range,o&&(this.clearFilter("remove"),u.filterSettings.filteredRange=[],u._selectedRange={},u._selectedCellIndexes=[],u.filterSettings.filteredColumns=[],i._excelFilter._predicates[f]={}),!t.isNullOrUndefined(e)&&e>-1){for(p=h[l].startRow,c=h[l].multifilterIdx,r=0,a=c.length;r<colLen;r++)v=this._getFilterHeader(f,p,c[r]),!t.isNullOrUndefined(v)&&v.status.indexOf("e-ssfiltered")>-1&&this._clearFilterColumn(u.columns[r].field,"","","","","",e);this._clearFilterTableIcon(f,e);o=!0}if(o){if(s={sheetIdx:f,reqType:"clear-Filter"},i._trigActionComplete(s))return}else this._filterCellRange(f,n);i._isFiltered=!o;i.model.allowComments&&i.XLComment._updateCmntArrowPos()}},_applyFilterIcon:function(n,t){var r=this.XLObj,h=this.XLObj._rAlign,f=r.getActiveSheetIndex(),i=n.rowIndex,u=n.colIndex,c=r.getSheet(f),o=r._isRowViewable(f,i),e=c._filterColl,s=!1;o&&(activeEle=r.getCell(i,u,f),activeEle[0].insertBefore(t[0],activeEle[0].childNodes[activeEle[0].childNodes.length-1]),activeEle.addClass("e-filterhdr"),activeEle.removeClass("e-ralign"));r.XLEdit.getPropertyValue(i,u,"wrap",f)&&(s=!0,r.setWrapText("unwrap",r._getAlphaRange(f,i,u,i,u)));r.XLEdit._updateDataContainer({rowIndex:i,colIndex:u},{dataObj:{isFilterHeader:!0,filterState:"filter",isFilterVisible:!0,isFilterWrap:s},sheetIdx:f});r.isNumber(r.model.allowFiltering&&r.XLEdit.getPropertyValue(i,u,"value2",f))&&o&&r._removeClass(activeEle[0],h);i in e||(e[i]={});u in e[i]||(e[i][u]={});e[i][u].status="e-ssfilter";e[i][u].isTable=t[0].className.indexOf("e-ft")>-1},_postionFilterIcon:function(n,t){var i=this.XLObj,u=n||i.getActiveCellElem(),o=t||u.find(".e-filterspan"),f,e,r=i._getCellIdx(u[0]);i.model.allowResizing&&(f=i.XLResize._getContentWidth(r.colIndex,i.getActiveSheetIndex(),r.rowIndex,r.rowIndex),e=i.XLResize._getContentHeight(r.rowIndex,i.getActiveSheetIndex()))},_filterCellRange:function(n,i){var e=this.XLObj,u,w=!1,tt,it,b,rt,k=[],s=-1,ut=!1,ft=0,et,f,h,a,ot,y,v,p,o,r=e.getSheet(n),st=[],ht=!1,c,l=[],d=[],g=!1,nt={sheetIndex:n,reqType:"filter",operation:"apply-filter"};if(t.isNullOrUndefined(i)){if(!e.model.allowSelection)return;u=r._selectedCells}else y=e.getRangeIndices(i),u=e._getSelectedRange({rowIndex:y[0],colIndex:y[1]},{rowIndex:y[2],colIndex:y[3]});for(u.length<2&&(c=u,t.isNullOrUndefined(i)||e.performSelection(i,n),e.selectAll(!1),u=r._selectedCells,ht=!0),f=u[0].colIndex,a=u[u.length-1].colIndex;f<=a;f++){if(k.push(f),s=u[0].rowIndex,ht)r._isSheetSelected||(l.push(f),r._multifilterIdx.push(f),w=!0);else{if(!ut||k.length>0)for(h=s,ot=u[u.length-1].rowIndex;h<=ot;h++)rt=e._isRowVisible(n,h),rt&&(e.XLEdit.getPropertyValue(h,f,"value2",n)||l.length&&e.XLEdit.getPropertyValue(0,f,"isCHide",n))&&((s===-1||s>h)&&(s=h),ut=!0,w=!0,g=!0),s<h&&ft===0&&st.push(h);g&&(l.push(f),r._multifilterIdx.push(f),g=!1)}ft++}if(l.length>1&&(r._multipleFiltering=!0),d=[],w){for(f=0,a=l.length;f<a;f++)et=this._getFilterIcon(),this._applyFilterIcon({rowIndex:s,colIndex:l[f]},et),d.push({rowIndex:s,colIndex:l[f]});for(v={rowIndex:s+1,colIndex:u[0].colIndex},p={rowIndex:u[u.length-1].rowIndex},r._selectedRange={startRow:v.rowIndex,endRow:p.rowIndex,dataSourceIndexes:st},this._getSelectedRangeData(v,u[u.length-1],-1,v.colIndex),r._selectedCellIndexes=k,nt={sheetIndex:n,filteredCells:d,reqType:"filter",operation:"apply-filter",tableID:-1},b=r.filterSettings.tableRange,f=0,a=b.length;f<a;f++)b[f].tableID===-1&&(tt=!0,it=f);tt?(o=r.filterSettings.tableRange[it],o.startRow=v.rowIndex,o.endRow=p.rowIndex,o.multiFiltering=r._multipleFiltering,o.multifilterIdx=r._multifilterIdx,o.selectedCellIndexes=r._multifilterIdx,o.selectedRange=r._selectedRange,o.filteredRange=r.filterSettings.filteredRange,o.filteredColumns=r.filterSettings.filteredColumns,o.predicate=e._excelFilter._predicates[n],o.hiddenIdx=[],o.flterdIdxes=[],o.fColumns={},o.filterColumnName=[],o.filterCollection=[]):r.filterSettings.tableRange.push({filterCollection:[],startRow:v.rowIndex,endRow:p.rowIndex,tableID:-1,multiFiltering:r._multipleFiltering,multifilterIdx:r._multifilterIdx,selectedCellIndexes:r._multifilterIdx,selectedRange:r._selectedRange,filteredRange:r.filterSettings.filteredRange,filteredColumns:r.filterSettings.filteredColumns,fColumns:{},predicate:{},hiddenIdx:[],fltrdIdxes:[],filterColumnName:[]});e.XLScroll._getColWidths(n,r._multifilterIdx[0]);r._isImported&&!r._isLoaded||e._isExport||(i=c?[c[0].rowIndex,c[0].colIndex,c[c.length-1].rowIndex,c[c.length-1].colIndex]:e.isUndefined(i)?[u[0].rowIndex,u[0].colIndex,u[u.length-1].rowIndex,u[u.length-1].colIndex]:e.getRangeIndices(i),e._completeAction(nt),e._trigActionComplete(nt),t.isNullOrUndefined(i)||e.performSelection(i,n))}else e._showAlertDlg("Alert","Alert","",440)},openFilterDialog:function(n){var t,i=this.XLObj;i.model.isReadOnly||(typeof n=="string"&&(n=i.getRangeIndices(n)),t=i.getCell(n[0],n[1]).find("span.e-filterspan"),t.length>0&&this._filterClickHandler({target:t[0]}))},_filterClickHandler:function(i){var r=this.XLObj,tt,it,w=n(i.target),o=r.getActiveSheetIndex(),e=r.getSheet(o),st=!1,c,y,b,ht,l,rt,ut,a,ft,h,s,f,ct=[],lt={},et,ot,k,v,p,at=r.model.scrollSettings.allowVirtualScrolling,vt=n(i.target).position(),yt=r.getSheetElement(o).find(".e-spreadsheetcontentcontainer").position(),d,g,nt=["showItems","hideItems"],u;if(y=r._generateHeaderText(i.target.parentNode.cellIndex+1),this._isDecimal=!1,(!r.model.allowLockCell||!r.getSheet(o).isSheetProtected)&&!r.preventFilterPopup){if(w[0].className.indexOf("e-ssfiltered")>-1&&(st=!0),a=i.target.parentNode.cellIndex,w[0].className.indexOf("e-ssfilter")>-1){for(f=r.model.sheets[o].filterSettings.tableRange,tt=r._getCellIdx(w.parent()[0]),it=r.XLEdit.getPropertyValue(tt.rowIndex,tt.colIndex,"tableName"),h=t.isNullOrUndefined(it)?-1:parseInt(it.replace("e-table","")),u=0,l=f.length;u<l;u++)f[u].tableID===h&&(v=u,f[u].multiFiltering?(rt=f[u].multifilterIdx[0],ut=f[u].multifilterIdx[f[u].multifilterIdx.length-1]):rt=ut=i.target.parentNode.cellIndex,ot={rowIndex:f[u].startRow,colIndex:rt},k={rowIndex:f[u].endRow,colIndex:ut},e._multipleFiltering=f[u].multiFiltering,e._multifilterIdx=f[u].multifilterIdx,s=e._selectedRange=f[u].selectedRange,e.filterSettings.filteredRange=f[u].filteredRange,e._selectedCellIndexes=f[u].selectedCellIndexes);if(h===-1){if(p=this._createSelection(o,s.startRow,s.endRow,a,s.dataSourceIndexes),c=p.endRowIndex>s.endRow?p.endRowIndex-1:p.endRowIndex,s.endRow!=c)for(u=s.endRow+1;u<=c;u++)ft={field:y,value:r.XLEdit.getPropertyValue(u,a,"value2",o),matchcase:!1,operator:"equal",predicate:"or"},e.filterSettings.filteredColumns.push(ft),f[v].filteredColumns.push(ft),f[v].selectedRange.endRow=c;k={rowIndex:c,colIndex:a};f[v].selectedRange=e._selectedRange={startRow:ot.rowIndex,endRow:k.rowIndex,dataSourceIndexes:p.filteredIndex};f[v].endRow=c}for(this._getSelectedRangeData(ot,k,h,a),b=e.columns,ht=this._getColumnType(o,s.startRow,s.endRow,a),u=0,l=b.length;u<l;u++)if(b[u].field===y){r._$colType=ht;r._$curFieldName=b[u].field;break}for(r._showDialog(r._id+"_Filter",r._$colType),et=r._getXYPos(w,n("#"+r._id+r._$colType+"_excelDlg"),18,18),f=r.model.sheets[o].filterSettings.tableRange,u=0,l=f.length;u<l;u++)f[u].tableID===h&&(ct=f[u].filteredColumns,lt=f[u].predicate);r._excelFilter._predicates[o]=lt;this._isSearchEdit=!0;n.extend(!0,r._excelFilter._columnsFiltered,e._filteredColumns);r._phoneMode||r._tabMode?this._openNormalFilterDlg(y,r._$colType,h,v):r._excelFilter.openXFDialog({field:y,dataSource:e.filterSettings.filteredRange?e.filterSettings.filteredRange:e.dataSource,position:{X:et.xPos,Y:et.yPos},type:r._$colType,format:r._$colFormat,filteredColumns:ct,sortedColumns:[],key:o,tableID:h,selectedColors:e._selectedCellColors,isFiltered:st,blank:"",enableColor:!0,filteredByColor:e._filteredByColor})}d=n("#"+r._id+"string_MenuItem").data("ejMenu");g=n("#"+r._id+"number_MenuItem").data("ejMenu");d&&d[r.model.allowSorting?nt[0]:nt[1]](d.element.find("li:lt(4)"));g&&g[r.model.allowSorting?nt[0]:nt[1]](g.element.find("li:lt(4)"))}},_cancelHandler:function(){this._isSearchEdit=!1},applyFilter:function(n){var i=this.XLObj,u=t.Predicate(n.field,n.operator,n.value,!n.matchcase),e,f=[],r=i.getActiveSheetIndex();e=i.model.sheets[r].filterSettings.tableRange;i._isFiltered||i.XLFilter.filter(n.filterRange);t.isNullOrUndefined(i._excelFilter._predicates[r])&&(i._excelFilter._predicates[r]={},i._excelFilter._predicates[r][n.field]={});i._excelFilter._predicates[r][n.field]=u;f.push({actualFilterOperator:n.operator,actualFilterValue:n.value,actualPredicate:n.predicate,field:n.field,isCustom:!0,matchcase:n.matchcase,operator:n.operator,predicate:n.predicate,value:n.value});this._filterHandler({action:"filtering",fieldName:n.field,tableID:-1,ejpredicate:u,filterCollection:f})},_filterHandler:function(i){var d,b,it,s,k,f,a,y,rt,ut,ft;if(!i.originalEvent||(d=i.originalEvent.target.parentElement.className,!d||!(d.indexOf("hdr")>-1))){var f,a,e,et=!1,o=-1,g,h,u={},ot,r=this.XLObj,l=r.getActiveSheetIndex(),v=r.getSheet(l),st,nt,tt,c=[],p={},w;for(u.requestType=i.action==="sorting"||i.action==="filterbycolor"?i.action:"filtering",e=v.filterSettings.tableRange,r.XLFilter._isSearchEdit=!1,f=0,a=e.length;f<a;f++)e[f].tableID===i.tableID&&(n.extend(!0,c,e[f].filteredColumns),p=e[f].predicate,et=!0,o=f);if(u.tableID=i.tableID,i.action==="filtering"||i.action==="clearfiltering"){for(u.rowIndex=e[o].startRow-1,u.colIndex=r._generateColCount(i.fieldName)-1,ot=t.DataManager(c),st=(new t.Query).where("field",t.FilterOperators.equal,i.fieldName),nt=ot.executeLocal(st),u.filteredColumns=c,f=0,a=nt.length;f<a;f++)tt=n.inArray(nt[f],c),tt>=0&&c.splice(tt,1);i.action==="clearfiltering"?delete r._excelFilter._predicates[l][i.fieldName]:t.merge(c,i.filterCollection);p=r._excelFilter._predicates[l]}if(et)if(e[o].filteredColumns=c,e[o].filterCollection=i.filterCollection,e[o].predicate=p,e[o].action=i.action,c.length<1)for(b=e[o].multifilterIdx,f=b[0];f<=b[b.length-1];f++)it=r._generateHeaderText(f+1),t.isNullOrUndefined(e[o].fColumns[it])||(e[o].fColumns[it]=[]);else e[o].fColumns[i.fieldName]=n.extend(!0,[],c);if(h=v.filterSettings.tableRange[o].selectedRange,s=v.filterSettings.tableRange[o].selectedCellIndexes,k=v._filterColl,i.action==="filtering"||i.action==="clearfiltering")u.currentFilteringColumn=i.fieldName,u.ejpredicate=i.ejpredicate,u.filterCollection=n.extend(!0,[],i.filterCollection),u.action=i.action,u.reqType="filter",u.sheetIndex=l,u.filteredcolumns=c,u.predicate=p;else if(i.action==="sorting"){if(!r.model.allowSorting)return;if(u.requestType=u.action=i.action,g=r.XLEdit.getColumnIndexByField(i.sortDetails.field),r.XLSort._isSortByFilter=!0,r.XLSort.sortByRange(r.swapRange([h.startRow,s[0],h.endRow,s[s.length-1]]),i.sortDetails.field,i.sortDetails.direction,i.tableID))return;for(this._changeSortIcon({rowIndex:h.startRow-1,colIndex:g},i.sortDetails.direction),f=0,a=s.length;f<a;f++)s[f]!=g&&(k[h.startRow-1][s[f]].status.indexOf("-asc")>-1||k[h.startRow-1][s[f]].status.indexOf("-dsc")>-1)&&(k[h.startRow-1][s[f]].status="e-ssfilter",r._isRowViewable(l,h.startRow-1)&&(w=r.getCell(h.startRow-1,s[f]).find(".e-filterspan")[0],r._removeClass(w,"e-ssfilter-asc"),r._removeClass(w,"e-ssfilter-dsc"),r.addClass(w,"e-ssfilter")))}else{if(u.requestType=u.action=i.action,u.range=v._selectedRange,r.model.allowSorting&&r.XLSort._sortRangeAlert([h.startRow,s[0],h.endRow,s[s.length-1]]))return;i.action==="sortbycolor"?(u.sortColumn=i.sortDetails.field,u.operation=i.sortDetails.operation,y=i.sortDetails.color.replace("rgb(","").replace(")","").split(",")):(r._isUndoRedo?(u.filterColumn=i.columnName,u.operation=i.operation):(u.filterColumn=i.filterDetails.field,u.operation=i.filterDetails.operation,y=i.filterDetails.color.replace("rgb(","").replace(")","").split(",")),u.tableID=i.tableID,r.model.sheets[l]._filteredByColor=u.filterColumn);r._isUndoRedo||(rt=y[0],ut=y[1],ft=y[2]);u.operation==="sortbgcolor"||u.operation==="filterbgcolor"?u.bgcolor=r._isUndoRedo?i.bgcolor:this._convertrgbtohex(parseInt(rt),parseInt(ut),parseInt(ft)):u.fgcolor=r._isUndoRedo?i.fgcolor:this._convertrgbtohex(parseInt(rt),parseInt(ut),parseInt(ft))}u.oprType="filter";u.selRange=r._getAlphaRange(l,e[o].startRow-1,e[o].multifilterIdx[0],e[o].endRow,e[o].multifilterIdx[e[o].multifilterIdx.length-1]);i.action!=="sorting"&&r._processBindings(u)&&(c=temp);i.action==="clearfiltering"&&(r.XLRibbon._isFilterSelect.status=!1);r.model.allowComments&&r.XLComment._updateCmntArrowPos();r.XLSelection._refreshBorder();r.model.showRibbon&&r.XLRibbon._refreshRibbonIcons();r._isFrozen(r.getFrozenRows())&&r.XLFreeze._refreshFreezeRowDiv()}},_convertrgbtohex:function(n,t,i){return"#"+(16777216+(n<<16)+(t<<8)+i).toString(16).slice(1)},_clearFilterColumn:function(i,r,u,f,e,o,s){var c=this.XLObj,v,l={},h,k,w=c.getActiveSheetIndex(),a=c.getSheet(w),it=!1,d={},rt,ut,g,nt,y=a.filterSettings.tableRange,p=[],tt,b,ft;for(l.requestType=t.Grid.Actions.Filtering,l.currentFilterObject=[],n.isArray(r)||(r=n.makeArray(r)),n.isArray(u)||(u=n.makeArray(u)),this._currentFilterColumn=this._getColumnByField(w,i),b=0,ft=r.length;b<ft;b++)if(d={field:i,operator:r[b],value:u[b],matchcase:e,predicate:f,actualFilterValue:o},!it){for(h=0,k=y.length;h<k;h++)y[h].tableID===s&&(v=y[h],n.extend(!0,p,y[h].filteredColumns),c._excelFilter._predicates[w]=y[h].predicate,a.filterSettings.filteredRange=a.filterSettings.tableRange[h].filteredRange,a._selectedCellIndexes=y[h].selectedCellIndexes,a._selectedRange=y[h].selectedRange,a._multifilterIdx=y[h].multifilterIdx);for(rt=t.DataManager(p),ut=(new t.Query).where("field",t.FilterOperators.equal,d.field),g=rt.executeLocal(ut),h=0,k=g.length;h<k;h++)nt=n.inArray(g[h],p),nt!==-1&&p.splice(nt,1)}(tt=n.inArray(i,a._filteredColumns),tt>-1&&a._filteredColumns.splice(tt,1),c._isUndoRedo&&c.isUndefined(v))||(it=!0,delete c._excelFilter._predicates[w][i],v.filteredColumns=p,v.predicate=c._excelFilter._predicates[w],l.currentFilterObject.push(d),l.filterCollection=p,l.currentFilteringColumn=i,l.filteredcolumns=p,l.action="clearfiltering",l.reqType="filter",l.tableID=s,l.selRange=c._getAlphaRange(w,v.startRow-1,v.multifilterIdx[0],v.endRow,v.multifilterIdx[v.multifilterIdx.length-1]),c._processBindings(l)&&(a.filterSettings.filteredColumns.reverse().splice(0,r.length),a.filterSettings.filteredColumns.reverse()),c.model.allowComments&&c.XLComment._updateCmntArrowPos(),this.XLObj.XLSelection._refreshBorder())},_getFilterHeader:function(n,i,r){var f=this.XLObj,e=f.getSheet(n),u=e._filterColl;if(!t.isNullOrUndefined(u[i])&&!t.isNullOrUndefined(u[i][r]))return u[i][r]},_filterTable:function(i,r,u){var c=this.XLObj,e=c.getSheet(i),l=[],y=!1,p=!1,s,a,w,v,h,o,f,b;for(e._multipleFiltering=!1,e._multifilterIdx=[],h=u?u.endCell:n.extend(!0,{},e._endCell),o=u?u.startCell:n.extend(!0,{},e._startCell),f=o.colIndex;f<=h.colIndex;f++)v=this._getFilterHeader(i,o.rowIndex,f),!t.isNullOrUndefined(v)&&v.status.indexOf("e-ssfilter")>-1?y=!0:(a=this._getFilterIcon(),w="e-ft"+r,a.addClass(w),this._applyFilterIcon({rowIndex:o.rowIndex,colIndex:f},a),l.push(f),e._multifilterIdx.push(f));if(c.XLScroll._getColWidths(i,o.colIndex),!y)if(l.length>1&&(e._multipleFiltering=!0,p=!0),o.rowIndex=o.rowIndex+1,this._getSelectedRangeData(o,h,r,o.colIndex),c._isFATResize){if(s=e.filterSettings.tableRange,s.length)for(f=0,b=s.length;f<b;f++)if(s[f].tableID===r){s[f].endRow=h.rowIndex;break}c._isFATResize=!1}else e.filterSettings.tableRange.push({filterCollection:[],startRow:o.rowIndex,endRow:h.rowIndex,tableID:r,multiFiltering:p,multifilterIdx:l,selectedCellIndexes:l,selectedRange:n.extend(!0,{},e._selectedRange),filteredRange:e.filterSettings.filteredRange,filteredColumns:e.filterSettings.filteredColumns,fColumns:{},predicate:{},hiddenIdx:[],filterColumnName:[]})},_clearFilterTable:function(n,t,i){var e=this.XLObj.getSheet(n?n:this.getActiveSheetIndex()),u,r,f;for(u=e.filterSettings.tableRange,r=0,f=u.length;r<f;r++)u[r].tableID===t&&(this._clearAllFilter(n,r,i),f=u.length)},_clearAllFilter:function(i,r,u){var s=this.XLObj,a=s._dataContainer.sheets[i],c=s.getSheet(i),h=c.filterSettings.tableRange,l,y,f,p,w,e,o,v;for(c._selectedRange=h[r].selectedRange,e=h[r].multifilterIdx,o=h[r].startRow,f=0,p=e.length;f<p;f++)w=c.columns[e[f]].field,v=s.XLEdit.getPropertyValue(o-1,e[f],"filterState"),!t.isNullOrUndefined(v)&&v.indexOf("filtered")>-1&&this._clearFilterColumn(w,"","","Or","","",h[r].tableID),u||(s._isRowViewable(i,o-1)&&(l=s.getCell(o-1,e[f]),s.addClass(l[0],"e-wrapword"),y=l.find(".e-filterspan"),n(y).remove(),l.removeClass("e-filterhdr")),a[o-1][e[f]]&&(delete a[o-1][e[f]].isFilterHeader,delete a[o-1][e[f]].filterState),delete c._filterColl[o-1][e[f]]);u||(h.splice(r,1),len=h.length)},_clearFilterTableIcon:function(n,t){for(var i=this.XLObj,h,c,l=i.getSheet(n),u=l.filterSettings.tableRange,e,o,f,a,s,r=0,v=u.length;r<v;r++)if(u[r].tableID===t)for(l._selectedRange=u[r].selectedRange,l.filterSettings.filteredRange=u[r].filteredRange,e=u[r].multifilterIdx,o=u[r].startRow,f=0,a=e.length;f<a;f++)h=i.XLEdit.getPropertyValue(o-1,e[f],"isFilterVisible"),i._isRowViewable(n,o-1)&&(s=i.getCell(o-1,e[f]),c=s.find(".e-filterspan"),h?(c.hide(),i._removeClass(s[0],"e-filterhdr")):(i.addClass(s[0],"e-filterhdr"),c.show())),i.XLEdit._updateDataContainer({rowIndex:o-1,colIndex:e[f]},{dataObj:{isFilterVisible:!h}})},_insertFilterIcon:function(n,t,i){var r;r=this._getFilterIcon();i.tableID>-1&&this.XLObj.XLEdit._updateDataContainer({rowIndex:n,colIndex:t},{dataObj:{tableName:"e-table"+i.tableID}});this._applyFilterIcon({rowIndex:n,colIndex:t},r)},_changeFilterIcon:function(n,t,i){var f,s,h,c=!1,r=this.XLObj,u=n.rowIndex,e=n.colIndex,l=r._rAlign,o=r.getActiveSheetIndex();h=this._getFilterHeader(o,u,e).status;r._isRowViewable(o,u)&&(s=r.getCell(u,e),f=s.find(".e-filterspan")[0],s.removeClass(l),c=!0);t==="filter"?i.indexOf("filtered")<0&&(r.XLEdit._updateDataContainer({rowIndex:u,colIndex:e},{dataObj:{filterState:i.replace("filter","filtered")}}),r.getSheet(o)._filterColl[u][e].status=h.replace("e-ssfilter","e-ssfiltered"),c&&(f.className=f.className.replace("e-ssfilter","e-ssfiltered"))):(r.XLEdit._updateDataContainer({rowIndex:u,colIndex:e},{dataObj:{filterState:i.replace("filtered","filter")}}),r.getSheet(o)._filterColl[u][e].status=h.replace("e-ssfiltered","e-ssfilter"),c&&!r.isUndefined(f)&&(f.className=f.className.replace("e-ssfiltered","e-ssfilter")))},_changeSortIcon:function(n,t){var u=this.XLObj,h=u.getActiveSheetIndex(),r,i,e,o=!1,s=u.getSheet(h)._filterColl,f;i=s[n.rowIndex][n.colIndex].status;r=i.indexOf("e-ssfiltered")>-1?12:10;e=i.substr(0,r);u._isRowViewable(h,n.rowIndex)&&(f=u.getCell(n.rowIndex,n.colIndex).find(".e-filterspan")[0],i=f.className,r=i.indexOf("e-ssfilter")+r,o=!0);t==="ascending"?(s[n.rowIndex][n.colIndex].status=e+"-asc",o&&(f.className=i.substr(0,r)+"-asc")):(s[n.rowIndex][n.colIndex].status=e+"-dsc",o&&(f.className=i.substr(0,r)+"-dsc"))},_extendFilterRange:function(n,t){var o=this.XLObj,u,r=o.getSheet(o.getActiveSheetIndex()).filterSettings.tableRange,i,e,f;if(r.length)for(i=0,f=r.length;i<f;i++)if(r[i].tableID==n){if(r[i].endRow<t[2]&&(u=r[i].selectedRange.dataSourceIndexes,r[i].endRow=r[i].selectedRange.endRow=t[2],u[u.length-1]<r[i].endRow))for(e=u[u.length-1],f=r[i].endRow;e<f;e++)u.push(e+1);break}},_updateFilterIcons:function(t,i,r,u){for(var o=this.XLObj,f,s,h=n("#"+o._id+"numberSelectAll").ejCheckBox("instance"),l=h?!1:h.model.checked,c=n("#"+o._id+"stringSelectAll").ejCheckBox("instance"),a=c?!1:c.model.checked,e=t;e<=i;e++){s={rowIndex:e,colIndex:r};f=o.XLEdit.getPropertyValue(e,r,"filterState");f.indexOf("filtered")>-1&&(u=="clearfiltering"||l||a)?this._changeFilterIcon(s,"filtered",f):f.indexOf("filtered")<0&&u!="clearfiltering"&&this._changeFilterIcon(s,"filter",f);break}},_fltrRowHighlight:function(t,i,r){var f=this.XLObj,c=f.getActiveSheetIndex(),h=f._getJSSheetRowHeaderContent(c),l=h.find("table tr:gt("+(t-1)+"):lt("+(i-t+1)+")"),e=f.model.sheets[c].filterSettings.tableRange,a,u,s=f.model.sheets[c].filteredRowsCollection,o;if(f.model.scrollSettings.allowVirtualScrolling&&(l=h.find("table tr").filter(function(){return n(this).attr("idx")>=t&&n(this).attr("idx")<=i})),r==="clear"){if(l.find("td").removeClass("e-filterhiglight"),f.clearRangeData([t,0,i,0],["isFilterHighlight"]),s.length)for(o=0;o<s.length;o++)for(u=0,a=e.length;u<a;u++)s[o]>=e[u].startRow&&s[o]<=e[u].endRow&&!f.XLEdit.getPropertyValue(s[o],0,"isRHide")&&(f.updateUniqueData({isFilterHighlight:!0},[e[u].startRow,0,e[u].endRow,0]),f.model.scrollSettings.allowVirtualScrolling?h.find("table tr").filter(function(){return n(this).attr("idx")>=e[u].startRow&&n(this).attr("idx")<=e[u].endRow}).find("td").addClass("e-filterhiglight"):h.find("table tr:gt("+(e[u].startRow-1)+"):lt("+(e[u].endRow-e[u].startRow+1)+")").find("td").addClass("e-filterhiglight"))}else r==="add"&&(l.find("td").addClass("e-filterhiglight"),f.updateUniqueData({isFilterHighlight:!0},[t,0,i,0]))},_checkFilterApplied:function(n,t,i,r,u,f){var s=this.XLObj,l=s.getSheet(n),o=l.filterSettings.tableRange,h,e,c;for(s._isFilterApplied=!1,e=0,c=o.length;e<c;e++)if(h=!1,o[e].filteredColumns.length?(chkObj=s._checkFilterMerge(n,[o[e].startRow-1,o[e].multifilterIdx[0],o[e].endRow,o[e].multifilterIdx[o[e].multifilterIdx.length-1]],t,i,r,u,f,"filter",h),s._isFilterApplied=!chkObj.isAlert):s._isFilterApplied=!1,s._isFilterApplied)return!0;return!1},_updateFilterCollection:function(i,r,u,f,e){var l,h,a,p,d,g,c=this.XLObj,v=c.getSheet(i),w=v.filterSettings.tableRange,o,s,it=c.model.scrollSettings.allowVirtualScrolling,k,nt,tt,b,y;if(u=u+1,f==="row")for(l=0,p=w.length;l<p;l++)o=w[l],s=o.multifilterIdx,e==="insert"?r<=o.endRow&&(o.endRow=o.endRow+u,r<o.startRow?(o.startRow=o.startRow+u,o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u,isInsertBefore:!0})):o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u})):r<=o.endRow&&(o.endRow=o.endRow-u,r<o.startRow?(o.startRow=o.startRow-u,o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u,isInsertBefore:!0})):o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u})),startCell={rowIndex:o.startRow,colIndex:s[0]},endCell={rowIndex:o.endRow,colIndex:s[s.length-1]},this._getSelectedRangeData(startCell,endCell,o.tableID),o.selectedRange=n.extend(!0,{},v._selectedRange),o.filteredRange=n.extend(!0,{},v.filterSettings.filteredRange);else for(tt=c._dataContainer.sheets[i],b=0,l=0,p=w.length;l<p;l++){if(o=w[l],s=o.multifilterIdx,y=n.extend(!0,[],s),this._updateFilteredColumns(l,r,u,e),e==="insert"){if(r<=s[0]){for(h=s.length-1;h>=0;h--)s[b]=s[b]+u,b++;o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u,isInsertBefore:!0})}else if(r<=s[s.length-1])for(o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u}),h=y[y.length-1],d=y[y.length-1]+u;h<=d;h++)s.indexOf(h)===-1&&s.push(h)}else if(r<=s[0]){for(h=0;h<s.length;h++)s[h]=s[h]-u;o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u,isInsertBefore:!0})}else if(r<=s[s.length-1]){for(a=r,g=s[s.length-1];a<=g;a++)nt=c._generateHeaderText(a+1),k=c.XLEdit.getPropertyValue(o.startRow-1,a,"filterState"),!t.isNullOrUndefined(k)&&k.indexOf("filtered")>-1&&this._clearFilterColumn(nt,"","","Or","","",o.tableID);s.splice(s.length-u,u);o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u})}startCell={rowIndex:o.startRow,colIndex:s[0]};endCell={rowIndex:o.endRow,colIndex:s[s.length-1]};this._getSelectedRangeData(startCell,endCell,o.tableID);o.selectedRange=n.extend(!0,{},v._selectedRange);o.filteredRange=n.extend(!0,{},v.filterSettings.filteredRange);s.length<2&&(o.multiFiltering=!1)}},_updateFilteredColumns:function(t,i,r,u){var f=this.XLObj,k,nt=f.getActiveSheetIndex(),e=f.getSheet(nt).filterSettings.tableRange[t],y=n.extend(!0,[],e.filteredColumns),d=n.extend(!0,{},e.fColumns),l=n.extend(!0,{},e.fColumns),g,o,c,v;for(colIdxes=e.multifilterIdx,o=0,g=y.length;o<g;o++)colIdx=f.XLEdit.getColumnIndexByField(e.filteredColumns[o].field),i<=colIdx&&(u==="delete"?i===colIdx?y.splice(o,1):y[o].field=f._generateHeaderText(colIdx-r+1):y[o].field=f._generateHeaderText(colIdx+r+1));e.filteredColumns=y;var s,p,w,h,a,tt=f.getObjectKeys(e.fColumns),b=f.getObjectKeys(d);for(e.predicate=e.predicate,o=b.length-1;o>=0;o--)for(k=f.XLEdit.getColumnIndexByField(b[o]),c=i;c<i+r;c++)if(c<=k){for(s=n.extend(!0,[],d[b[o]]),v=0;v<s.length;v++)colIdx=f.XLEdit.getColumnIndexByField(s[v].field),c<=colIdx&&(u==="delete"?c===colIdx?s.splice(o,1):s[v].field=f._generateHeaderText(colIdx-r+1):s[v].field=f._generateHeaderText(colIdx+r+1));p=f.XLEdit.getColumnIndexByField(b[o]);h=f._generateHeaderText(p+1);u==="delete"?(w=p-r,c===p?(delete e.predicate[h],delete l[h]):(a=f._generateHeaderText(w+1),l[a]=s,delete l[h],e.predicate[a]=f._excelFilter.generatePredicate(s),delete e.predicate[h])):(w=p+r,a=f._generateHeaderText(w+1),l[a]=s,delete l[h],e.predicate[a]=f._excelFilter.generatePredicate(s),delete e.predicate[h])}e.fColumns=l},_renderCustomFilter:function(){var i=this.XLObj,r=i._id+"_filter_custom",u=n("#"+r),o=t.buildTag("div#"+r+"_content"),f=t.buildTag("input#"+r+"_filterBtn.e-filter",{},{},{type:"button",value:"Filter"}),e=t.buildTag("input#"+r+"_clearBtn.e-clear",{},{},{type:"button",value:"Clear"});u.append(o.append(t.buildTag("div.e-fltrbtndiv").append(f).append(e)));this._createButton("filter",f);this._createButton("clear",e);u.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("Filter"),width:"100%",height:"100%",cssClass:"e-ss-dialog e-"+i._id+"-dlg",open:function(){n("#"+i._id+"_formatdlg_okbtn").focus()},close:t.proxy(this._customFltrDlgClose,this)})},_customFltrDlgClose:function(){n("#"+this.XLObj._id+"_filter_custom_"+this._colType).hide()},_refreshCustomFilter:function(i){var e=this.XLObj,r=e._id+"_filter_custom",u=t.buildTag("input#"+r+"_"+i+"_ddinput.e-"+e._id+"_customddl",{},{},{type:"text"}),f=t.buildTag("input#"+r+"_"+i+"_acString.e-filterval",{},{height:"26px",width:"100%"},{type:"text"}),o,s=n("#"+r+"_content");s.prepend(t.buildTag("div#"+r+"_"+i,"",{display:"none"}).append(t.buildTag("div.e-operdiv").append(u)).append(t.buildTag("div.e-textdiv").append(f)));u.ejDropDownList({dataSource:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"}],width:"100%",fields:{id:"value",text:"text",value:"value"},select:n.proxy(this._onNumFormatSelect,this),selectedItemIndex:0});switch(i){case"string":u.ejDropDownList("option",{dataSource:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Starts With",value:"startswith"},{text:"Ends With",value:"endswith"},{text:"Contains",value:"contains"}],selectedItemIndex:0});f.ejAutocomplete({width:"100%",height:26,enableDistinct:!0,focusIn:function(){o=u.ejDropDownList("model.value")}});break;case"number":f.ejNumericTextbox({showSpinButton:!1,height:"26px",decimalPlaces:2,width:"100%"});break;case"boolean":$tchkBox.ejCheckBox({});break;case"date":f.ejDatePicker({width:"100%"})}},_createButton:function(n,i){var r=n=="filter"?t.proxy(this._fltrBtnHandler,this):t.proxy(this._fltrClrHandler,this);i.ejButton({size:"normal",type:"button",height:22,width:60,click:r,showRoundedCorner:!0})},_fltrBtnHandler:function(){var r=this.XLObj,e=r.getActiveSheetIndex(),i=r._id+"_filter_custom",u=n("#"+i+"_"+this._colType+"_ddinput").ejDropDownList("model.value"),f=n("#"+i+"_"+this._colType+"_acString").val();arg={action:"filtering",filterCollection:[{field:this._colName,matchcase:!0,operator:u,value:f,predicate:"or"}],fieldName:this._colName,ejpredicate:{field:this._colName,operator:u,value:f,isComplex:!1,ignoreCase:!1},tableID:this._tableId};r._excelFilter._predicates[e][this._colName]=t.Predicate(this._colName,u,f);this._filterHandler(arg);n("#"+i).ejDialog("close");n("#"+i+"_"+this._colType).hide()},_fltrClrHandler:function(){var i=this.XLObj,t=i._id+"_filter_custom",r=n("#"+t+"_"+this._colType+"_ddinput").ejDropDownList("model.value");this._clearFilterColumn(this._colName,"","","Or","","",this._tableId);n("#"+t).ejDialog("close");n("#"+t+"_"+this._colType).hide()},_openNormalFilterDlg:function(t,i,r,u){var e=this.XLObj,f=e._id+"_filter_custom";n("#"+f+"_"+i).show();n("#"+f).ejDialog("open");n("#"+f+"_"+i+"_ddinput").ejDropDownList("option",{selectedItemIndex:0});this._colName=t;this._colType=i;this._tableId=r;i==="string"&&n("#"+f+"_"+i+"_acString").ejAutocomplete("option",{fields:{key:this._colName,text:this._colName},dataSource:e.getSheet(e.getActiveSheetIndex()).filterSettings.tableRange[u].filteredRange})}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.ribbon=function(n){this.XLObj=n;this._appTabCollection={};this._tabCollection=[];this._contextualTabCollection=[];this._smallBtnHeight=25;this._mediumBtnHeight=35;this._bigBtnHeight=75;this._splitBtnHeight=75;this._dropDownHeight=25;this._ribbonState=!0;this._isSetModel=!1;this._isDesignTab=!0;this._isDirtySelect=!1;this._isMergeSelect=!1;this._isFilterSelect={};this._hasTitle="";this._isNmgrid="";this._isPanelVisible=!1;this._ctrlCreated=!1;this._homeBtnIds=["Home_Clipboard_Paste","Home_Font_IncreaseFontSize","Home_Font_DecreaseFontSize","Home_Alignment_DecreaseIndent","Home_Alignment_IncreaseIndent","Home_Number_IncreaseDecimal","Home_Number_DecreaseDecimal","Home_Actions_Undo","Home_Actions_Redo","Home_Number_Accounting","Home_Number_CommaStyle","Home_Number_Percentage","Home_Clipboard_Cut","Home_Clipboard_Copy"];this._homeSptBtnIds=["Home_Clipboard_PasteOptions","Home_Font_Border","Home_Styles_ConditionalFormatting","Home_Styles_FormatAsTable","Home_Styles_CellStyles","Others_Editing_FindSelect","Home_Editing_Clear","Home_Alignment_Merge","Home_Editing_SortFilter","Home_Editing_AutoSum"];this._homeToggleBtnIds=["Home_Font_Bold","Home_Font_Italic","Home_Font_Underline","Home_Font_StrikeThrough","Home_Alignment_AlignLeft","Home_Alignment_AlignRight","Home_Alignment_AlignCenter","Home_Alignment_TopAlign","Home_Alignment_MiddleAlign","Home_Alignment_BottomAlign","Home_Alignment_WrapText","Home_Clipboard_FormatPainter"];this._homeDdIds=["Home_Number_NumberFormat","Home_Font_FontSize","Home_Font_FontFamily"];this._homeCpIds=["Home_Font_FillColor","Home_Font_FontColor"];this._insertBtnIds=["Insert_Tables_PivotTable","Insert_Tables_Table","Insert_Links_Hyperlink","Insert_Illustrations_Pictures"];this._insertSptBtnIds=["Insert_Charts_ColumnChart","Insert_Charts_BarChart","Insert_Charts_StockChart","Insert_Charts_LineChart","Insert_Charts_AreaChart","Insert_Charts_PieChart","Insert_Charts_ScatterChart"];this._dataBtnIds=["Data_SortFilter_SortAtoZ","Data_SortFilter_SortZtoA","Data_SortFilter_Filter","Data_SortFilter_ClearFilter","Data_DataTools_DataValidation"];this._dataSptBtnIds=["Data_DataTools_DataValidationOptions"];this._pageLayChckBxIds=["PageLayout_Show_Headings","PageLayout_Show_Gridlines"];this._pageLayBtnIds=["PageLayout_PageLayout_PageSize","PageLayout_Print_Print","PageLayout_Print_PrintSelected"];this._pageLaySptBtnIds=["PageLayout_PageLayout_PageSizeOptions"];this._reviewTglBtnIds=["Review_Changes_ProtectSheet","Review_Changes_ProtectWorkbook","Review_Changes_LockCell"];this._cmntBtnIds=["Review_Comments_NewComment","Review_Comments_DeleteComment","Review_Comments_PreviousComment","Review_Comments_NextComment","Review_Comments_ShowHideComment"];this._cmntTglBtnIds=["Review_Comments_ShowAllComments"];this._othersBtnIds=["Others_Cells_InsertCell","Others_Cells_DeleteCell","Others_Formulas_NameManager","Others_Formulas_DefineName","Others_CalCulation_CalculateNow","Others_CalCulation_CalculateSheet"];this._othersSptBtnIds=["Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Editing_FindSelect","Others_Window_FreezePanes","Others_CalCulation_CalculationOptions"];this._contextualBtnIds=["Design_Tools_ResizeTable","Design_Tools_ConvertToRange"];this._contextualInputIds=["Ribbon_Design_Properties_TableName"];this._contextualCheckBoxIds=["Design_TableStyleOptions_FirstColumn","Design_TableStyleOptions_LastColumn","Design_TableStyleOptions_TotalRow","Design_TableStyleOptions_FilterColumn"];this._protectStateBtnIds=["Home_Clipboard_Cut","Home_Clipboard_Copy","Others_Editing_FindSelect","Home_Clipboard_Paste","Home_Clipboard_PasteOptions","Home_Actions_Undo","Home_Actions_Redo","Review_Changes_ProtectSheet","Review_Changes_ProtectWorkbook","PageLayout_Print_Print","PageLayout_Print_PrintSelected","Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Cells_InsertCell","Others_Cells_DeleteCell"];this._chartDesignBtnIds=["ChartDesign_Data_SwitchRowColumn","ChartDesign_Data_SelectData","ChartDesign_Type_ChangeChartType"];this._chartDesignSptBtnIds=["ChartDesign_ChartLayouts_AddChartElement"];this._chartDesignDdIds=["ChartDesign_ChartThemes_ChartThemes"];this._formatBtnIds=["Format_Adjust_ChangePicture"];this._formatSptBtnIds=["Format_Adjust_ResetPicture","Format_Border_PictureBorder"];this._pasteMenuData=[{id:"PasteSpecial",text:n._getLocStr("PasteSpecial"),parentId:null},{id:"PasteValues",text:n._getLocStr("PasteValues"),parentId:null}];this._fontFamily=[{value:"1",text:"Angsana New"},{value:"2",text:"Arial"},{value:"3",text:"Arial Black"},{value:"4",text:"Batang"},{value:"5",text:"Book Antiqua"},{value:"6",text:"Browallia New"},{value:"7",text:"Calibri"},{value:"8",text:"Cambria"},{value:"9",text:"Candara"},{value:"10",text:"Century"},{value:"11",text:"Comic Sans MS"},{value:"12",text:"Consolas"},{value:"13",text:"Constantia"},{value:"14",text:"Corbel"},{value:"15",text:"Cordia New"},{value:"16",text:"Courier"},{value:"17",text:"Courier New"},{value:"18",text:"DilleniaUPC"},{value:"19",text:"Dotum"},{value:"20",text:"FangSong"},{value:"21",text:"Garamond"},{value:"22",text:"Georgia"},{value:"23",text:"Gulim"},{value:"24",text:"GungSuh"},{value:"25",text:"KaiTi"},{value:"26",text:"JasmineUPC"},{value:"27",text:"Malgun Gothic"},{value:"28",text:"Mangal"},{value:"29",text:"Meiryo"},{value:"30",text:"Microsoft JhengHei"},{value:"31",text:"Microsoft YaHei"},{value:"32",text:"MingLiu"},{value:"33",text:"MingLiU_HKSCS"},{value:"34",text:"MS Gothic"},{value:"35",text:"MS Mincho"},{value:"36",text:"MS PGothic"},{value:"37",text:"MS PMincho"},{value:"38",text:"PMingliU"},{value:"39",text:"PMingLiU-ExtB"},{value:"40",text:"SimHei"},{value:"41",text:"SimSun"},{value:"42",text:"SimSun-ExtB"},{value:"43",text:"Tahoma"},{value:"44",text:"Times"},{value:"45",text:"Times New Roman"},{value:"46",text:"Trebuchet MS"},{value:"47",text:"Verdana"},{value:"48",text:"Yu Gothic"},{value:"49",text:"Yu Mincho"}];this._fontSize=[{value:"8pt",text:"8"},{value:"9pt",text:"9"},{value:"10pt",text:"10"},{value:"11pt",text:"11"},{value:"12pt",text:"12"},{value:"14pt",text:"14"},{value:"16pt",text:"16"},{value:"18pt",text:"18"},{value:"20pt",text:"20"},{value:"22pt",text:"22"},{value:"24pt",text:"24"},{value:"26pt",text:"26"},{value:"28pt",text:"28"},{value:"36pt",text:"36"},{value:"48pt",text:"48"},{value:"72pt",text:"72"}];this._mergeMenuData=[{id:"MergeAndCenter",text:n._getLocStr("MergeAndCenter"),parentId:null,sprite:"e-icon e-ss-mergecenter"},{id:"MergeAcross",text:n._getLocStr("MergeAcross"),parentId:null,sprite:"e-icon e-ss-mergeacross"},{id:"MergeCells",text:n._getLocStr("MergeCells"),parentId:null,sprite:"e-icon e-ss-merge"},{id:"UnmergeCells",text:n._getLocStr("UnmergeCells"),parentId:null,sprite:"e-icon e-ss-unmerge"}];this._sortFltrMenuData=[{id:"Ribbon_SortAtoZ",text:this.XLObj._getLocStr("SortAtoZ"),parentId:null,sprite:"e-icon e-ssdrop-sortatoz"},{id:"Ribbon_SortZtoA",text:this.XLObj._getLocStr("SortZtoA"),parentId:null,sprite:"e-icon e-ssdrop-sortztoa"},{id:"Ribbon_Filter",text:this.XLObj._getLocStr("Filter"),parentId:null,sprite:"e-icon e-ssdrop-filter"},{id:"Ribbon_ClearFilter",text:this.XLObj._getLocStr("ClearFilter"),parentId:null,sprite:"e-icon e-ssdrop-clearfilter"}];this._findMenuData=[{id:"Find",text:n._getLocStr("Find")+"...",parentId:null,sprite:"e-icon e-ss-find"},{id:"Replace",text:n._getLocStr("Replace")+"...",parentId:null,sprite:"e-icon e-ss-replace"},{id:"GoTo",text:n._getLocStr("GoTo")+"...",parentId:null,sprite:"e-icon e-ss-goto"},{id:"GoToSpecial",text:n._getLocStr("GoTo")+" "+n._getLocStr("Special")+"...",parentId:null},{id:"Formulas",text:n._getLocStr("Formulas"),parentId:null},{id:"Comments",text:n._getLocStr("Comments"),parentId:null},{id:"CFormat",text:n._getLocStr("ConditionalFormat"),parentId:null},{id:"Constants",text:n._getLocStr("Constants"),parentId:null},{id:"DataValidation",text:n._getLocStr("DataValidation"),parentId:null}];this._calcOptData=[{id:this.XLObj._id+"_CalcAuto",text:n._getLocStr("Automatic"),parentId:null,sprite:"e-icon e-ss-calcauto"},{id:this.XLObj._id+"_CalcManual",text:n._getLocStr("Manual"),parentId:null,sprite:"e-icon"}];this._valMenuData=[{id:"Validation",text:n._getLocStr("DataValidation")+"...",parentId:null,sprite:"e-icon e-ss-validation"},{id:"HighlightVal",text:n._getLocStr("HighlightVal"),parentId:null,sprite:"e-icon e-ss-hlval"},{id:"ClearHLVal",text:n._getLocStr("ClearFormats"),parentId:null,sprite:"e-icon e-ss-clearval"},{id:"ClearVal",text:n._getLocStr("ClearVal"),parentId:null,sprite:"e-icon e-ss-clearval"}];this._pageSizes=[{id:"A4",text:n._getLocStr("A4"),parentId:null,sprite:"e-icon e-ss-A4size"},{id:"A3",text:n._getLocStr("A3"),parentId:null,sprite:"e-icon e-ss-A3size"},{id:"Letter",text:n._getLocStr("Letter"),parentId:null,sprite:"e-icon e-ss-lettersize"}];this._viewMenuData=[{id:"freezePanes",text:n._getLocStr("FreezePanes"),parentId:null,sprite:"e-icon e-ss-frzpane"},{id:"FreezeTopRow",text:n._getLocStr("FreezeTopRow"),parentId:null,sprite:"e-icon e-ss-frzrow"},{id:"FreezeFirstColumn",text:n._getLocStr("FreezeFirstColumn"),parentId:null,sprite:"e-icon e-ss-frzcln"}];this._insertMenuData=[{id:"InsertCells",text:n._getLocStr("InsCells")+"...",parentId:null,sprite:"e-icon e-ssr-inscell"},{id:"InsertSheetRows",text:n._getLocStr("InsRows"),parentId:null,sprite:"e-icon e-ssr-insrow"},{id:"InsertSheetColumns",text:n._getLocStr("InsCols"),parentId:null,sprite:"e-icon e-ssr-inscol"},{id:"InsertSheet",text:n._getLocStr("InsSheet"),parentId:null,sprite:"e-icon e-ssr-inssheet"}];this._resetPicture=[{id:"resetpicture",text:n._getLocStr("ResetPicture"),parentId:null,sprite:"e-icon e-ss-resetpicture"},{id:"resetsize",text:n._getLocStr("ResetSize"),parentId:null,sprite:"e-icon e-ss-resetpicture"}];var t=n._getLocStr("BorderStyles").split("/");this._borderMenuData=[{id:"bottom",text:n._getLocStr("BottomBorder"),parentId:null,sprite:"e-icon e-ss-bottom"},{id:"top",text:n._getLocStr("TopBorder"),parentId:null,sprite:"e-icon e-ss-top"},{id:"left",text:n._getLocStr("LeftBorder"),parentId:null,sprite:"e-icon e-ss-left"},{id:"right",text:n._getLocStr("RightBorder"),parentId:null,sprite:"e-icon e-ss-right"},{id:"noborder",text:n._getLocStr("NoBorder"),parentId:null,sprite:"e-icon e-ss-noborder"},{id:"allborder",text:n._getLocStr("AllBorder"),parentId:null,sprite:"e-icon e-ss-allborder"},{id:"outside",text:n._getLocStr("OutsideBorder"),parentId:null,sprite:"e-icon e-ss-outside"},{id:"thickbox",text:n._getLocStr("ThickBoxBorder"),parentId:null,sprite:"e-icon e-ss-thickbox"},{id:"thickbottom",text:n._getLocStr("ThickBottomBorder"),parentId:null,sprite:"e-icon e-ss-thickbottom"},{id:"topandbottom",text:n._getLocStr("TopandBottomBorder"),parentId:null,sprite:"e-icon e-ss-topandbottom"},{id:"topandthickbottom",text:n._getLocStr("TopandThickBottomBorder"),parentId:null,sprite:"e-icon e-ss-topandthickbottom"},{id:"drawborder",text:n._getLocStr("DrawBorder"),parentId:null,sprite:"e-icon e-ss-drawborder"},{id:"drawbordergrid",text:n._getLocStr("DrawBorderGrid"),parentId:null,sprite:"e-icon e-ss-drawbordergrid"},{id:n._id+"_bordercolor",text:n._getLocStr("BorderColor"),parentId:null},{id:n._id+"_Ribbon_borderstyle",text:n._getLocStr("BorderStyle"),parentId:null},{id:n._id+"_Ribbon_bordercolor",text:"",parentId:n._id+"_bordercolor"},{id:"solid",text:t[0],parentId:n._id+"_Ribbon_borderstyle"},{id:"dashed",text:t[1],parentId:n._id+"_Ribbon_borderstyle"},{id:"dotted",text:t[2],parentId:n._id+"_Ribbon_borderstyle"}];this._cFormatMenuData=[{id:n._id+"_HLCellRules",text:"Highlight Cell Rules",parentId:null,sprite:"e-icon e-ss-hlcellrules"},{id:"greaterthan",text:n._getLocStr("GreaterThan")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-greaterthan"},{id:"lessthan",text:n._getLocStr("LessThan")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-lessthan"},{id:"between",text:n._getLocStr("Between")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-between"},{id:"equalto",text:n._getLocStr("EqualTo")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-equalto"},{id:"textcontains",text:n._getLocStr("TextthatContains")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-textcontains"},{id:"dateoccur",text:n._getLocStr("DateOccurring")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-dateoccur"},{id:n._id+"_CreateRule",text:n._getLocStr("CreateRule"),parentId:null,sprite:"e-icon e-ss-createrule"},{id:n._id+"_ClearRules",text:n._getLocStr("ClearRules"),parentId:null,sprite:"e-icon e-ss-clearrules"},{id:"clearselected",text:n._getLocStr("ClearRulesfromSelected"),parentId:n._id+"_ClearRules"},{id:"clearall",text:n._getLocStr("ClearRulesfromEntireSheets"),parentId:n._id+"_ClearRules"}];this._textAlign=[{value:"1",text:"Left"},{value:"2",text:"Center"},{value:"3",text:"Right"}];this._verticalAlign=[{value:"1",text:"Top"},{value:"2",text:"Middle"},{value:"3",text:"Bottom"}];this._actions=[{value:"Greater",text:"greater than"},{value:"GreaterOrEqual",text:"greater or equal to"},{value:"Less",text:"less than"},{value:"LessOrEqual",text:"less than or equal to"},{value:"Equal",text:"equal to"},{value:"NotEqual",text:"not equal to"},{value:"Between",text:"between"},{value:"NotBetween",text:"not between"}];this._types=[{value:"number",text:"Number"},{value:"decimal",text:"Decimal"},{value:"date",text:"Date"},{value:"time",text:"Time"},{value:"text",text:"TextLength"},{value:"list",text:"List"}];this._cFormatData={greaterthan:["GTTitle","GTContent"],lessthan:["LTTitle","LTContent"],between:["BWTitle","BWContent"],equalto:["EQTitle","EQContent"],textcontains:["ContainsTitle","ContainsContent"],dateoccur:["DateTitle","DateContent"]};this._styles=[{value:"redft",text:"Light Red Fill with Dark Red Text"},{value:"yellowft",text:"Yellow Fill with Dark Yellow Text"},{value:"greenft",text:"Green Fill with Dark Green Text"},{value:"redf",text:"Red Fill"},{value:"redt",text:"Red Text"}];this._currentCFormat="";this._addrList=[];this._within=[{value:"sheet",text:n._getLocStr("Sheet")},{value:"workbook",text:n._getLocStr("Workbook")}];this._sType=[{value:"columns",text:n._getLocStr("Columns")},{value:"rows",text:n._getLocStr("Rows")}];this._vType=[{value:"value",text:n._getLocStr("Value")},{value:"formula",text:n._getLocStr("Formula")},{value:"comment",text:n._getLocStr("Comments")}];this._direction=[{value:"down",text:n._getLocStr("Down")},{value:"up",text:n._getLocStr("Up")}];this._gotoRBtnSet1=["Comments","Blanks","LastCell","Formulas","Constants"];this._gotoRBtnSet2=["RowDiff","ColDiff","CFormat","DataValidation"];this._gotoChkBox=["GotoNumbers","GotoText","GotoLogicals","GotoError"];this._numberFormat=[{value:"1",text:"General"},{value:"2",text:"Number"},{value:"3",text:"Currency"},{value:"4",text:"Accounting"},{value:"5",text:"Percentage"},{value:"6",text:"Text"},{value:"7",text:"Shortdate"},{value:"8",text:"Longdate"},{value:"9",text:"Time"},{value:"10",text:"Scientific"},{value:"11",text:"Fraction"},{value:"12",text:"Custom"}];this._deleteMenuData=[{id:"DeleteCells",text:n._getLocStr("DelCells")+"...",parentId:null,sprite:"e-icon e-ssr-delcell"},{id:"DeleteSheetRows",text:n._getLocStr("DelRows"),parentId:null,sprite:"e-icon e-ssr-delrow"},{id:"DeleteSheetColumns",text:n._getLocStr("DelCols"),parentId:null,sprite:"e-icon e-ssr-delcol"},{id:"DeleteSheet",text:n._getLocStr("DelSheet"),parentId:null,sprite:"e-icon e-ssr-delsheet"}];this._clearMenuData=[{id:"Clear_All",text:n._getLocStr("ClearAll"),parentId:null,sprite:"e-icon e-ss-clear"},{id:"Clear_Formats",text:n._getLocStr("ClearFormats"),parentId:null,sprite:"e-icon e-ss-clearformat"},{id:"Clear_Contents",text:n._getLocStr("ClearContents"),parentId:null},{id:"Clear_Comments",text:n._getLocStr("ClearComments"),parentId:null},{id:"Clear_Hyperlinks",text:n._getLocStr("ClearHyperLinks"),parentId:null}];this._autosumMenuData=[{id:"Sum",text:n._getLocStr("Sum"),parentId:null,sprite:"e-icon e-ss-autosum"},{id:"Average",text:n._getLocStr("Average"),parentId:null},{id:"Count",text:n._getLocStr("CountNumber"),parentId:null},{id:"Max",text:n._getLocStr("Max"),parentId:null},{id:"Min",text:n._getLocStr("Min"),parentId:null}];this._chartThemes=[{value:"flatlight",text:"Flat Light"},{value:"flatdark",text:"Flat Dark"},{value:"azure",text:"Azure"},{value:"azuredark",text:"Azure Dark"},{value:"lime",text:"Lime"},{value:"limedark",text:"Lime Dark"},{value:"saffron",text:"Saffron"},{value:"saffrondark",text:"Saffron Dark"}];this._isCustomCellStyleReset=!1;this.allButtonIds=["Home_Clipboard_Paste","Home_Font_IncreaseFontSize","Home_Font_DecreaseFontSize","Home_Alignment_DecreaseIndent","Home_Alignment_IncreaseIndent","Home_Number_IncreaseDecimal","Home_Number_DecreaseDecimal","Home_Actions_Undo","Home_Actions_Redo","Home_Number_Accounting","Home_Number_CommaStyle","Home_Number_Percentage","Home_Clipboard_Cut","Home_Clipboard_Copy","Insert_Tables_PivotTable","Insert_Tables_Table","Insert_Links_Hyperlink","Insert_Illustrations_Pictures","Data_SortFilter_SortAtoZ","Data_SortFilter_SortZtoA","Data_SortFilter_Filter","Data_SortFilter_ClearFilter","Data_DataTools_DataValidation","PageLayout_PageLayout_PageSize","PageLayout_Print_Print","PageLayout_Print_PrintSelected","Review_Comments_NewComment","Review_Comments_DeleteComment","Review_Comments_PreviousComment","Review_Comments_NextComment","Review_Comments_ShowHideComment","Others_Cells_InsertCell","Others_Cells_DeleteCell","Others_Formulas_NameManager","Others_Formulas_DefineName","Others_CalCulation_CalculateNow","Others_CalCulation_CalculateSheet","Design_Tools_ResizeTable","Design_Tools_ConvertToRange","ChartDesign_Data_SwitchRowColumn","ChartDesign_Data_SelectData","ChartDesign_Type_ChangeChartType","Format_Adjust_ChangePicture"];this.allSplitButtonIds=["Home_Clipboard_PasteOptions","Home_Font_Border","Home_Styles_ConditionalFormatting","Home_Styles_FormatAsTable","Home_Styles_CellStyles","Others_Editing_FindSelect","Home_Editing_Clear","Home_Alignment_Merge","Home_Editing_SortFilter","Home_Editing_AutoSum","Insert_Charts_ColumnChart","Insert_Charts_BarChart","Insert_Charts_StockChart","Insert_Charts_LineChart","Insert_Charts_AreaChart","Insert_Charts_PieChart","Insert_Charts_ScatterChart","Data_DataTools_DataValidationOptions","PageLayout_PageLayout_PageSizeOptions","Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Editing_FindSelect","Others_Window_FreezePanes","Others_CalCulation_CalculationOptions","ChartDesign_ChartLayouts_AddChartElement","Format_Adjust_ResetPicture","Format_Border_PictureBorder"];this.allToggleButtonIds=["Home_Font_Bold","Home_Font_Italic","Home_Font_Underline","Home_Font_StrikeThrough","Home_Alignment_AlignLeft","Home_Alignment_AlignRight","Home_Alignment_AlignCenter","Home_Alignment_TopAlign","Home_Alignment_MiddleAlign","Home_Alignment_BottomAlign","Home_Alignment_WrapText","Home_Clipboard_FormatPainter","Review_Comments_ShowAllComments","Review_Changes_ProtectSheet","Review_Changes_ProtectWorkbook","Review_Changes_LockCell"];this.allDropDownIds=["ChartDesign_ChartThemes_ChartThemes","Home_Number_NumberFormat","Home_Font_FontSize","Home_Font_FontFamily"];this.colorPickerIds=["Home_Font_FillColor","Home_Font_FontColor"];this.checkBoxIds=["PageLayout_Show_Headings","PageLayout_Show_Gridlines","Design_TableStyleOptions_FirstColumn","Design_TableStyleOptions_LastColumn","Design_TableStyleOptions_TotalRow","Design_TableStyleOptions_FilterColumn"];this.InputIds=["Ribbon_Design_Properties_TableName"];this._fileMenuData=[{id:"File",text:n._getLocStr("File"),parentId:null},{id:"New",text:n._getLocStr("New"),parentId:"File",sprite:"e-icon e-ss-newsheet"},{id:"Open",text:n._getLocStr("Open")+"...",parentId:"File",sprite:"e-icon e-ss-open"},{id:"Save",text:n._getLocStr("SaveAs"),parentId:"File",sprite:"e-icon e-ss-saveas"},{id:"Print",text:n._getLocStr("Print"),parentId:"File",sprite:"e-icon e-ssm-print"},{id:"ExportXL",text:n._getLocStr("ExportXL"),parentId:"Save",sprite:"e-icon e-ssm-exportxl"},{id:"ExportCsv",text:n._getLocStr("ExportCsv"),parentId:"Save",sprite:"e-icon e-ssm-exportcsv"},{id:"ExportPdf",text:n._getLocStr("ExportPdf"),parentId:"Save",sprite:"e-icon e-ssm-exportpdf"},{id:"PrintSheet",text:n._getLocStr("PrintSheet"),parentId:"Print",sprite:"e-icon e-ssm-print"},{id:"PrintSelected",text:n._getLocStr("PrintSelected"),parentId:"Print",sprite:"e-icon e-ssm-printselected"}];this._isAppTabCreate=!1;this._isHomeTabCreate=!1;this._isInsertTabCreate=!1;this._isDataTabCreate=!1;this._isPageLayoutTabCreate=!1;this._isReviewTabCreate=!1;this._isOthersTabCreate=!1;this._isDesignTabCreate=!1;this._isFormatTabCreate=!1;this._isChartTabCreate=!1;this._analyzeTabCreate=!1;this._isHomeTabTrgt=!1;this._isInsertTabTrgt=!1;this._isDataTabTrgt=!1;this._isPageLayoutTrgtTab=!1;this._isReviewTabTrgt=!1;this._isOthersTabTrgt=!1;this._isDesignTabTrgt=!1;this._isFormatTabTrgt=!1;this._isChartTabTrgt=!1;this._analyzeTabTrgt=!1};t.spreadsheetFeatures.ribbon.prototype={_renderChartTypeDialog:function(){var i,u,f,e,o,s,h,c,l,a,n=this.XLObj,r=n._id+"_charttypedlg";return i=t.buildTag("div#"+r+".e-chartdialog","",{},{overflow:"hidden"}),u=t.buildTag("div#"+r+"_allcharttab.e-chtdlgtab"),l=t.buildTag("div.e-dlg-fields e-dlgctndiv"),s=t.buildTag("ul .e-ul","",""),c=t.buildTag("a",n._getLocStr("AllCharts"),{},{href:"#"+n._id+"_allchart"}),h=t.buildTag("li",c),i.append(l.append(u.append(s.append(h)))),o=t.buildTag("div#"+r+"_btndiv.e-dlg-btnfields"),a=t.buildTag("div.e-dlg-btnctnr"),f=t.buildTag("input#"+r+"_okbtn","",{},{type:"button"}),e=t.buildTag("input#"+r+"_cantn","",{},{type:"button"}),f.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._chartTypeOk,this),enabled:!0,cssClass:"e-ss-okbtn"}),e.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._chartTypeCancel,this),showRoundedCorner:!0,width:60}),o.append(a.append(f,e)),i.append(o),n.element.append(i),u.ejTab({cssClass:"e-ss-dlgtab",width:"100%",height:"auto"}),this._renderAllChartTab(),i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("ChartType"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-charttype-dlg e-ss-mattab e-"+n._id+"-dlg",close:t.proxy(this._dialogClose,this)}),i},_renderAllChartTab:function(){var u,f,w,s,a,i,v,b,k=[],y="",d="",h=this.XLObj,r=h._id,p=r+"_chartdlg_allcharttab",c=["Column-6","Bar-6","Radar-2","Line-2","Area-3","Pie-3","Scatter-1"],l,e,o;for($leftdiv=t.buildTag("div#"+p+"_content.e-ss-leftdiv",""),a=t.buildTag("div#"+p+"_content.e-chtdlgcontent e-ss-rightdiv","",{overflow:"auto",float:"right"}),$listUl=t.buildTag("ul #"+p+"_list .e-ul"),e=0,o=c.length;e<o;e++)i=c[e].split("-")[0],d+="<li><span class='e-icon e-ss-dlg"+i.toLowerCase()+"chart'><\/span>"+i+"<\/li>",k.push(i);for($listUl.append(n(d)),l=t.buildTag("div#"+r+"_allchart_table.e-ss-maindiv","",{cellspacing:"0",cellpadding:"0",display:"inline-flex",width:"100%"}),n("#"+r+"_allchart").append(l),l.append($leftdiv.append($listUl)),this._createChartList(k),l.append(a),f=0,o=c.length;f<o;f++){for(s=c[f].split("-"),b=h._getLocStr("Title"+s[0]+"Chart").split("/"),i=s[0].toLowerCase(),v=t.buildTag("div#"+r+"_"+i+"chart"),u=1,w=parseInt(s[1]);u<=w;u++)y+="<div class='e-chartimg e-dlg"+i+"chart"+u+"' title='"+b[u-1]+"'><\/div>";a.append(v.append(y));n("#"+r+"_"+i+"chart").find(".e-dlg"+i+"chart1").addClass("e-chartselect");v.hide();y=""}h._on(n("#"+r+"_allchart").find(".e-chartimg"),"click",h._allChartType);n("#"+r+"_columnchart").show()},_createChartList:function(i){var r=this.XLObj,f=r._id+"_chartdlg_allcharttab",s=n("#"+r._id+"_allchart").height(),u,e=n("#"+f+"_list"),o=t.buildTag("div.e-ss-drpdiv");u=t.buildTag("input#"+f+"_input");n("#"+r._id+"_allchart").prepend(o.append(u));u.ejDropDownList({dataSource:i,width:"100%",fields:{id:"value",text:"text",value:"text"},select:n.proxy(this._onChartChange,this),selectedItemIndex:0});e.ejListBox({selectedItemIndex:0,width:"120",height:"250",fields:{text:"text",value:"value"},select:n.proxy(this._onChartChange,this),allowMultiSelection:!1})},_onChartChange:function(t){for(var r=this.XLObj,u=t.value?t.value.toLowerCase():t.text.toLowerCase(),f=["column","bar","radar","line","area","pie","scatter"],i=0;i<f.length;i++)n("#"+r._id+"_"+f[i]+"chart").hide();n("#"+r._id+"_"+u+"chart").show();n("#"+r._id+"_allchart").find(".e-chartimg").removeClass("e-chartselect");n("#"+r._id+"_"+u+"chart").find(".e-dlg"+u+"chart1").addClass("e-chartselect")},_initValDialog:function(){var i,r,u,f,e,o,s,h,n=this.XLObj,c,l;i=t.buildTag("div#"+n._id+"_ValDialog");r=t.buildTag("div#"+n._id+"_ValDialog_valDlgTab");c=t.buildTag("div.e-dlg-fields e-dlgctndiv");o=t.buildTag("ul .e-ul");h=t.buildTag("a","Settings",{},{href:"#"+n._id+"_Validation"});s=t.buildTag("li",h);o.append(s);r.append(o);i.append(c.append(r));e=t.buildTag("div#"+n._id+"btnDiv.e-dlg-btnfields");l=t.buildTag("div.e-dlg-btnctnr");u=t.buildTag("input#"+n._id+"Dialog_OkBtn","",{},{type:"button"});f=t.buildTag("input#"+n._id+"Dialog_CancelBtn","",{},{type:"button"});u.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._valDlgBtnClick,this,"ok"),enabled:!0,cssClass:"e-ss-okbtn"});f.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._valDlgBtnClick,this,"cancel"),showRoundedCorner:!0,width:60});e.append(l.append(u,f));n.element.append(i.append(e));r.ejTab({width:"100%",height:"auto",cssClass:"e-ss-dlgtab"});this._renderValDialog();i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("DataValidation"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-valdlg e-ss-mattab e-"+n._id+"-dlg",close:t.proxy(this._dialogClose,this)});this._dialogValidate("_ValDialog")},_initCFDialog:function(){var n=this.XLObj,i,e,r,u,f,o;return i=t.buildTag("div#"+n._id+"_CFDialog"),n.element.append(i),e=t.buildTag("div#"+n._id+"_CondFormat.e-dlgctndiv"),i.append(e),f=t.buildTag("div#"+n._id+"cfBtnDiv.e-dlg-btnfields"),o=t.buildTag("div.e-dlg-btnctnr"),r=t.buildTag("input#"+n._id+"cfDialog_OkBtn","",{},{type:"button"}),u=t.buildTag("input#"+n._id+"cfDialog_CancelBtn","",{},{type:"button"}),r.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:"25%",click:t.proxy(this._dlgCFOk,this),enabled:!0,cssClass:"e-ss-okbtn"}),u.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._dlgCFCancel,this),showRoundedCorner:!0,width:"25%"}),f.append(o.append(r,u)),i.append(f),i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("ConditionalFormat"),width:"auto",cssClass:"e-ss-dialog e-ss-cfdlg e-"+n._id+"-dlg",close:t.proxy(this._dialogClose,this)}),i},_initHLDialog:function(){var i=this.XLObj,r,u,f,e,o,s,h,c,l;r=t.buildTag("div#"+i._id+"_HLDialog");u=t.buildTag("div#"+i._id+"_HLDialogTab");l=t.buildTag("div.e-dlg-fields e-dlgctndiv");f=t.buildTag("ul .e-ul");o=t.buildTag("a",i._getLocStr("WebPage"),{},{href:"#"+i._id+"_Web"});e=t.buildTag("li",o);f.append(e);o=t.buildTag("a",i._getLocStr("WorkSheet"),{},{href:"#"+i._id+"_Doc"});e=t.buildTag("li",o);f.append(e);u.append(f);r.append(l.append(u));s=t.buildTag("div#"+i._id+"hlBtnDiv.e-dlg-btnfields");$btnctnr=t.buildTag("div.e-dlg-btnctnr");h=t.buildTag("input#"+i._id+"hlDialog_OkBtn","",{},{type:"button"});c=t.buildTag("input#"+i._id+"hlDialog_CancelBtn","",{},{type:"button"});h.ejButton({text:i._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgHLOk,this),enabled:!0,cssClass:"e-ss-okbtn"});c.ejButton({text:i._getLocStr("Cancel"),click:t.proxy(this._dlgHLCancel,this),showRoundedCorner:!0,width:60});s.append($btnctnr.append(h,c));r.append(s);r.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("InsertHyperLink"),width:"auto",cssClass:"e-ss-dialog e-ss-hyperlinkdlg e-ss-mattab e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),open:t.proxy(function(){var t=n("#"+i._id+"_Ribbon_webAddress"),r=n("#"+i._id+"_Ribbon_cellAddress");t.focus().setInputPos(t.val().length);r.focus().setInputPos(r.val().length)})});u.ejTab({width:"100%",itemActive:t.proxy(this._hlTabChange,this),cssClass:"e-ss-dlgtab"});this._renderHLDialog()},_initFRDialog:function(){var i=this.XLObj,e,o,s,h,c,l,y,f,r,p,u,a,v;e=t.buildTag("div#"+i._id+"_FRDialog");o=t.buildTag("div#"+i._id+"_FRDialog_FPDlgTab");p=t.buildTag("div.e-dlg-fields e-dlgctndiv");f=t.buildTag("ul .e-ul");u=t.buildTag("a",i._getLocStr("Find"),{},{href:"#"+i._id+"_Find"});r=t.buildTag("li",u);f.append(r);u=t.buildTag("a",i._getLocStr("Replace"),{},{href:"#"+i._id+"_Replace"});r=t.buildTag("li",u);f.append(r);u=t.buildTag("a",i._getLocStr("Settings"),{},{href:"#"+i._id+"_Settings"});r=t.buildTag("li",u);f.append(r);o.append(f);e.append(p.append(o));l=t.buildTag("div#"+i._id+"btnFRDiv.e-dlg-btnfields");y=t.buildTag("div.e-dlg-btnctnr");a=t.buildTag("input#"+i._id+"FR_ReplaceBtn","",{"margin-left":0},{type:"button"});v=t.buildTag("input#"+i._id+"FR_ReplaceAllBtn","",{},{type:"button"});s=t.buildTag("input#"+i._id+"FR_NextBtn","",{},{type:"button"});h=t.buildTag("input#"+i._id+"FR_PrevBtn","",{},{type:"button"});c=t.buildTag("input#"+i._id+"FR_CloseBtn","",{},{type:"button"});a.ejButton({text:i._getLocStr("Replace"),showRoundedCorner:!0,width:55,click:t.proxy(this._btnFROnClick,this,"FR_ReplaceBtn"),enabled:!0}).css("visibility","hidden");v.ejButton({text:i._getLocStr("ReplaceAll"),showRoundedCorner:!0,click:t.proxy(this._btnFROnClick,this,"FR_ReplaceAllBtn"),enabled:!0}).css("visibility","hidden");s.ejButton({text:i._getLocStr("FindNext"),showRoundedCorner:!0,width:69,click:t.proxy(this._btnFROnClick,this,"FR_NextBtn"),enabled:!0});h.ejButton({text:i._getLocStr("FindPrev"),showRoundedCorner:!0,width:69,click:t.proxy(this._btnFROnClick,this,"FR_PrevBtn"),enabled:!0});c.ejButton({text:i._getLocStr("Close"),click:t.proxy(this._btnFROnClick,this,"FR_CloseBtn"),showRoundedCorner:!0,width:47});l.append(y.append(a,v,s,h,c));e.append(l);e.ejDialog({showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("FindnReplace"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-mattab e-ss-frdlg e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),open:t.proxy(function(){i._phoneMode?(n("#"+i._id+"FR_ReplaceBtn").hide(),n("#"+i._id+"FR_ReplaceAllBtn").hide()):(n("#"+i._id+"FR_ReplaceBtn").show(),n("#"+i._id+"FR_ReplaceAllBtn").show());var t=n("#"+i._id+"_Ribbon_textFind");t.focus().setInputPos(t.val().length)})});o.ejTab({width:"100%",itemActive:t.proxy(this._findTabChange,this),cssClass:"e-ss-dlgtab"})},_initGoToDialog:function(){var n=this.XLObj,i,e,h,r,u,f,o,s,c;i=t.buildTag("div#"+n._id+"_GoDialog");e=t.buildTag("div#"+n._id+"_GoToDlgTab");c=t.buildTag("div.e-dlg-fields e-dlgctndiv");r=t.buildTag("ul .e-ul");f=t.buildTag("a",n._getLocStr("GoTo"),{},{href:"#"+n._id+"_GoTo"});u=t.buildTag("li",f);r.append(u);f=t.buildTag("a",n._getLocStr("GoTo")+" "+n._getLocStr("Special"),{},{href:"#"+n._id+"_GoToSp"});u=t.buildTag("li",f);r.append(u);e.append(r);i.append(c.append(e));h=t.buildTag("div#"+n._id+"btnDiv.e-dlg-btnfields");$btnctnr=t.buildTag("div.e-dlg-btnctnr");i.append(h.append($btnctnr));o=t.buildTag("input#"+n._id+"Dialog_GoOkBtn","",{},{type:"button"});s=t.buildTag("input#"+n._id+"Dialog_GoCancelBtn","",{},{type:"button"});o.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:"23%",click:t.proxy(this._gotoBtnClick,this,"ok"),cssClass:"e-ss-okbtn"});s.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._gotoBtnClick,this,"cancel"),showRoundedCorner:!0,width:60});$btnctnr.append(o,s);n.element.append(i)},_initPvtDialog:function(){var n=this.XLObj,i,r,u,f,e;i=t.buildTag("div#"+n._id+"_PvtDialog");n.element.append(i);i.append(t.buildTag("div#"+n._id+"_Pivot.e-dlgctndiv"));f=t.buildTag("div#"+n._id+"pvtBtnDiv.e-dlg-btnfields");e=t.buildTag("div.e-dlg-btnctnr");r=t.buildTag("input#"+n._id+"PvtDialog_OkBtn");u=t.buildTag("input#"+n._id+"PvtDialog_CancelBtn");r.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:"25%",click:t.proxy(this._dlgPvtOk,this),enabled:!0,cssClass:"e-ss-okbtn"});u.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._dlgPvtCancel,this),showRoundedCorner:!0,width:"25%"});f.append(e.append(r,u));i.append(f);i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("CreatePivotTable"),width:"auto",cssClass:"e-ss-dialog e-"+n._id+"-dlg e-ss-pvtdlg",close:t.proxy(this._dialogClose,this)})},_dialogClose:function(){this.XLObj.setSheetFocus()},_beforeDlgClose:function(t){var i=n("#"+this.XLObj._id+"_nmgrid_dialogEdit_overLay");i.length&&(t.cancel=!0)},_homeTabObj:function(){var n,f=this.XLObj,u="imagetop",r={id:"home",text:f._getLocStr("HOME"),groups:[]},i=f._id,e=f.model;n={text:"Clipboard",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Home_Clipboard_Paste","paste","textandimage","e-icon e-ssr-paste",45,this._mediumBtnHeight,"PasteTitle","PasteContent",!1,u),this._generateSplitBtn("Home_Clipboard_PasteOptions","Paste","textandimage",i+"_Ribbon_Paste",{dataSource:this._pasteMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,45,this._mediumBtnHeight,"bottom","","dropdown","e-ssr-pastesbtn","PasteTitle","PasteSplitContent")]},{groups:[this._generateBtn("Home_Clipboard_Cut","Cut","textandimage","e-icon e-ssr-cut",58,this._smallBtnHeight,"CutTitle","CutContent"),this._generateBtn("Home_Clipboard_Copy","Copy","textandimage","e-icon e-ssr-copy",67,this._smallBtnHeight,"CopyTitle","CopyContent"),this._generateToggleBtn("Home_Clipboard_FormatPainter","FormatPainter","textandimage","e-icon e-ss-formatpainter","FPTitle",110,this._smallBtnHeight,"FPContent")]}]};r.groups.push(n);n={text:"Font",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateDD("Home_Font_FontFamily","FontFamily",this._fontFamily,"7",150,this._smallBtnHeight,"FontFamily","FFContent"),this._generateDD("Home_Font_FontSize","FontSize",this._fontSize,"11pt",65,this._smallBtnHeight,"FontSize","FSContent"),this._generateBtn("Home_Font_IncreaseFontSize","IncreaseFontSize","imageonly","e-icon e-ss-increasefontsize","",this._smallBtnHeight,"IncreaseFontSize","IFSContent"),this._generateBtn("Home_Font_DecreaseFontSize","DecreaseFontSize","imageonly","e-icon e-ss-decreasefontsize","",this._smallBtnHeight,"DecreaseFontSize","DFSContent")]},{groups:[this._generateToggleBtn("Home_Font_Bold","Bold","imageonly","e-icon e-ss-bold","BoldTitle","",this._smallBtnHeight,"BoldContent"),this._generateToggleBtn("Home_Font_Italic","Italic","imageonly","e-icon e-ss-italic","ItalicTitle","",this._smallBtnHeight,"ItalicContent"),this._generateToggleBtn("Home_Font_Underline","Underline","imageonly","e-icon e-ss-underline","ULineTitle","",this._smallBtnHeight,"ULineContent"),this._generateToggleBtn("Home_Font_StrikeThrough","Linethrough","imageonly","e-icon e-ss-linethrough","LineTrTitle",25,this._smallBtnHeight,"LineTrContent",!0),this._generateSplitBtn("Home_Font_Border","Border","imageonly",i+"_Ribbon_Border",{dataSource:this._borderMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-bottom",!0,37,this._smallBtnHeight,"","","","e-borderbtn","Border","BorderContent"),this._generateCustomControl(i+"_Ribbon_Home_Font_FillColor","BackgroundColor","BackgroundColor","BGContent"),this._generateCustomControl(i+"_Ribbon_Home_Font_FontColor","FontColor","Color","ColorContent")]}]};r.groups.push(n);n={text:"Alignment",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateToggleBtn("Home_Alignment_TopAlign","TopAlign","imageonly","e-icon e-ss-topalign","TopAlign","","","TopAlignContent"),this._generateToggleBtn("Home_Alignment_MiddleAlign","MiddleAlign","imageonly","e-icon e-ss-middlealign","MiddleAlign","","","MiddleAlignContent"),this._generateToggleBtn("Home_Alignment_BottomAlign","BottomAlign","imageonly","e-icon e-ss-bottomalign","BottomAlign","","","BottomAlignContent",!0),this._generateToggleBtn("Home_Alignment_WrapText","WrapText","textandimage","e-icon e-ss-wraptext","WrapText",85,25,"WrapTextContent")]},{groups:[this._generateToggleBtn("Home_Alignment_AlignLeft","AlignLeft","imageonly","e-icon e-ss-alignleft","AlignLeft","","","AlignLeftContent"),this._generateToggleBtn("Home_Alignment_AlignCenter","AlignCenter","imageonly","e-icon e-ss-aligncenter","AlignCenter","","","AlignCenterContent"),this._generateToggleBtn("Home_Alignment_AlignRight","AlignRight","imageonly","e-icon e-ss-alignright","AlignRight","","","AlignRightContent",!0),this._generateSplitBtn("Home_Alignment_Merge","MergeAndCenter","textandimage",i+"_Ribbon_Merge",{dataSource:this._mergeMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-merge",!1,136,25,"right","","","e-spreadsheet e-mergebtn","MergeAndCenter","MergeAndCenterContent")]},{groups:[this._generateBtn("Home_Alignment_DecreaseIndent","DecreaseIndent","imageonly","e-icon e-ss-decreaseindent","",this._smallBtnHeight,"DecreaseIndent","DecreaseIndentContent"),this._generateBtn("Home_Alignment_IncreaseIndent","IncreaseIndent","imageonly","e-icon e-ss-increaseindent","",this._smallBtnHeight,"IncreaseIndent","IncreaseIndentContent")]}]};r.groups.push(n);n={text:"Actions",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Home_Actions_Undo","Undo","textandimage","e-icon e-ss-undo",40,this._bigBtnHeight,"UndoTitle","UndoContent",!1,u,""),this._generateBtn("Home_Actions_Redo","Redo","textandimage","e-icon e-ss-redo",40,this._bigBtnHeight,"RedoTitle","RedoContent",!1,u,"")]}]};r.groups.push(n);n={text:"Number",alignType:t.Ribbon.alignType.rows,enableGroupExpander:!0,content:[{groups:[this._generateDD("Home_Number_NumberFormat","NumberFormat",this._numberFormat,"1",125,this._smallBtnHeight,"NumberFormat","NumberFormatContent")]},{groups:[this._generateBtn("Home_Number_Accounting","AccountingStyle","imageonly","e-icon e-ss-accounting","",this._smallBtnHeight,"AccountingStyle","AccountingStyleContent"),this._generateBtn("Home_Number_Percentage","PercentageStyle","imageonly","e-icon e-ss-percentage","",this._smallBtnHeight,"PercentageStyle","PercentageStyleContent"),this._generateBtn("Home_Number_CommaStyle","CommaStyle","imageonly","e-icon e-ss-comma","",this._smallBtnHeight,"CommaStyle","CommaStyleContent",!0),this._generateBtn("Home_Number_IncreaseDecimal","IncreaseDecimal","imageonly","e-icon e-ss-increasedecimal","",this._smallBtnHeight,"IncreaseDecimal","IncreaseDecimalContent"),this._generateBtn("Home_Number_DecreaseDecimal","DecreaseDecimal","imageonly","e-icon e-ss-decreasedecimal","",this._smallBtnHeight,"DecreaseDecimal","DecreaseDecimalContent")]}]};r.groups.push(n);n={text:"Styles",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateSplitBtn("Home_Styles_ConditionalFormatting","ConditionalFormat","textandimage",i+"_CFormat",{dataSource:this._cFormatMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-condformat",!1,75,this._splitBtnHeight,"bottom",u,"dropdown","e-spreadsheet e-cformatbtn","ConditionalFormat","CFContent"),this._generateSplitBtn("Home_Styles_FormatAsTable","FormatasTable","textandimage",i+"_formatastable","","e-icon e-ssr-formatastable",!1,65,this._splitBtnHeight,"bottom",t.ImagePosition.ImageTop,"dropdown","e-spreadsheet e-formatastablebtn","FormatAsTable","FATContent"),this._generateSplitBtn("Home_Styles_CellStyles","CellStyles","textandimage",i+"_cellstyles","","e-icon e-ssr-cellstyles",!1,55,this._splitBtnHeight,"bottom",t.ImagePosition.ImageTop,"dropdown","e-spreadsheet e-cellstylebtn","CellStyles","CellStylesContent")]}]};r.groups.push(n);n={text:"Editing",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Home_Editing_SortFilter","SortFilter","textandimage",i+"_Ribbon_SortFilter",{dataSource:this._sortFltrMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-sortfilter",!1,50,this._splitBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-sortfltrbtn","SortFilter","SortFilterContent")]},{groups:[this._generateSplitBtn("Home_Editing_AutoSum","AutoSum","textandimage",i+"_Ribbon_AutoSum",{dataSource:this._autosumMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-autosum",!1,100,25,"right","","","e-spreadsheet e-autosumbtn","AutoSumTitle","AutoSumContent"),this._generateSplitBtn("Home_Editing_Clear","Clear","textandimage",i+"_Ribbon_Clear",{dataSource:this._clearMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-clear",!1,80,25,"right","","dropdown","e-spreadsheet e-clearbtn","Clear","ClearContent")]}]};r.groups.push(n);this._tabCollection.push(r)},_insertTabObj:function(){var n,f=this.XLObj,u="imagetop",r={id:"insert",text:f._getLocStr("INSERT"),groups:[]},i=f._id;n={text:"Tables",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Insert_Tables_PivotTable","PivotTable","textandimage","e-icon e-ssr-pivottable",65,this._bigBtnHeight,"PivotTable","PivotTableContent",!1,u),this._generateBtn("Insert_Tables_Table","Table","textandimage","e-icon e-ssr-table",50,this._bigBtnHeight,"Table","TableContent",!1,u)]}]};r.groups.push(n);n={text:"Illustrations",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Insert_Illustrations_Pictures","Pictures","textandimage","e-icon e-ssr-pictures",50,this._bigBtnHeight,"PicturesTitle","PicturesContent",!1,u,"")]}]};r.groups.push(n);n={text:"Links",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Insert_Links_Hyperlink","HyperLink","textandimage","e-icon e-ssr-hyperlink",60,this._bigBtnHeight,"HyperLinkTitle",["HyperLinkContent","HyperLinkPlaceContent"],!1,u,"")]}]};r.groups.push(n);n={text:"Charts",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateSplitBtn("Insert_Charts_ColumnChart","ColumnChart","imageonly",i+"_Ribbon_ColumnChart","","e-icon e-ss-colchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","ColumnChartTitle","ColumnChartContent"),this._generateSplitBtn("Insert_Charts_BarChart","BarChart","imageonly",i+"_Ribbon_BarChart","","e-icon e-ss-barchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","BarChartTitle","BarChartContent"),this._generateSplitBtn("Insert_Charts_StockChart","StockChart","imageonly",i+"_Ribbon_StockChart","","e-icon e-ss-stockchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","StockChartTitle","StockChartContent")]},{groups:[this._generateSplitBtn("Insert_Charts_LineChart","LineChart","imageonly",i+"_Ribbon_LineChart","","e-icon e-ss-linechart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","LineChartTitle","LineChartContent"),this._generateSplitBtn("Insert_Charts_AreaChart","AreaChart","imageonly",i+"_Ribbon_AreaChart","","e-icon e-ss-areachart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","AreaChartTitle","AreaChartContent"),this._generateSplitBtn("Insert_Charts_PieChart","PieChart","imageonly",i+"_Ribbon_PieChart","","e-icon e-ss-piechart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","PieChartTitle","PieChartContent")]},{groups:[this._generateSplitBtn("Insert_Charts_ScatterChart","ScatterChart","imageonly",i+"_Ribbon_ScatterChart","","e-icon e-ss-scterchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","ScatterChartTitle","ScatterChartContent")]}]};r.groups.push(n);this._tabCollection.push(r)},_dataTabObj:function(){var n,r=this.XLObj,i={id:"data",text:r._getLocStr("DATATAB"),groups:[]};n={text:"Sort & Filter",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Data_SortFilter_SortAtoZ","SortAtoZ","textandimage","e-icon e-ssr-sortatoz",90,this._smallBtnHeight,"SortAtoZ","SortAtoZContent",!1,"","e-datapadding"),this._generateBtn("Data_SortFilter_SortZtoA","SortZtoA","textandimage","e-icon e-ssr-sortztoa",90,this._smallBtnHeight,"SortZtoA","SortZtoAContent",!1,"","e-datapadding")]},{groups:[this._generateBtn("Data_SortFilter_Filter","Filter","textandimage","e-icon e-ssr-filter",60,this._smallBtnHeight,"Filter","FilterContent",!1,"","e-datapadding"),this._generateBtn("Data_SortFilter_ClearFilter","ClearFilter","textandimage","e-icon e-ss-clearfilter",90,this._smallBtnHeight,"ClearFilter","ClearFilterContent",!1,"","e-datapadding")]}]};i.groups.push(n);n={text:"Data Tools",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Data_DataTools_DataValidation","Validation","imageonly","e-icon e-ssr-validation",70,39,"DataValidation","DVContent",!1,"imagetop"),this._generateSplitBtn("Data_DataTools_DataValidationOptions","DataValidation","textandimage",r._id+"_Ribbon_Validation",{dataSource:this._valMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,70,this._mediumBtnHeight,"bottom","","dropdown","e-ssr-validationsbtn","DataValidation","DVContent")]}]};i.groups.push(n);this._tabCollection.push(i)},_pageTabObj:function(){var n,r=this.XLObj,u="imagetop",i={id:"pagelayout",text:r._getLocStr("PAGELAYOUT"),groups:[]};n={text:"Show",alignType:t.Ribbon.alignType.rows,width:105,content:[{groups:[{contentID:r._id+"_Ribbon_pagesetupleft",type:t.Ribbon.type.custom,height:80},]}]};i.groups.push(n);n={text:"Page Layout",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("PageLayout_PageLayout_PageSize","size","imageonly","e-icon e-ssr-pagesize",65,44,"size","PageSizeContent",!1,u,""),this._generateSplitBtn("PageLayout_PageLayout_PageSizeOptions","PageSize","textandimage",r._id+"_Ribbon_PageSize",{dataSource:this._pageSizes,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,65,this._mediumBtnHeight,"bottom","","dropdown","e-ssr-pagesizesbtn","PageSize","PageSizeContent")]}]};i.groups.push(n);n={text:"Print",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("PageLayout_Print_Print","Print","textandimage","e-icon e-ssr-print",50,this._bigBtnHeight,"Print","PrintContent",!1,u,"")]},{groups:[this._generateBtn("PageLayout_Print_PrintSelected","PrintSelected","textandimage","e-icon e-ssr-printselected",55,this._bigBtnHeight,"PrintSelected","PrintSelectedContent",!0,u,"")]}]};i.groups.push(n);this._tabCollection.push(i)},_reviewTabObj:function(){var n,u=this.XLObj,i="imagetop",r={id:"review",text:u._getLocStr("REVIEW"),groups:[]};n={text:"Comments",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Review_Comments_NewComment","New","textandimage","e-icon e-ssr-newcmnt",49,this._bigBtnHeight,"NewCommentTitle","NewCommentContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_DeleteComment","Delete","textandimage","e-icon e-ssr-deletecmnt",49,this._bigBtnHeight,"DeleteComment","DeleteCommentContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_PreviousComment","Previous","textandimage","e-icon e-ssr-previouscmnt",49,this._bigBtnHeight,"Previous","PreviousContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_NextComment","Next","textandimage","e-icon e-ssr-nextcmnt",49,this._bigBtnHeight,"Next","NextContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_ShowHideComment","ShowHide","textandimage","e-icon e-ssr-showhidecmnt",160,this._smallBtnHeight,"ShowHide","ShowHideContent",!1,"imageLeft","e-ssr-cmntcolbtn"),this._generateToggleBtn("Review_Comments_ShowAllComments","ShowAll","textandimage","e-icon e-ssr-showallcmnt","ShowAll",155,this._smallBtnHeight,"ShowAllContent",!1,"e-ssr-cmntcolbtn")]}]};r.groups.push(n);n={text:"Changes",alignType:t.Ribbon.alignType.row,content:[{groups:[this._generateToggleBtn("Review_Changes_ProtectSheet","Protectsheet","textandimage","e-icon e-ssr-protectsheet","Protectsheet",60,this._bigBtnHeight,"ProtectSheetToolTip",!1,"e-ssr-protectsheetbtn","imagetop","Unprotect"),this._generateToggleBtn("Review_Changes_ProtectWorkbook","ProtectWorkbook","textandimage","e-icon e-ssr-protect","ProtectWorkbook",60,this._bigBtnHeight,"ProtectWBContent",!1,"e-ssr-cmntcolbtn","imagetop"),this._generateToggleBtn("Review_Changes_LockCell","Lock","textandimage","e-icon e-ssr-protlockcell","lock",90,this._smallBtnHeight,"Lock",!1,"e-ssr-lockbtn","","Unlock","e-icon e-ssr-protunlockcell"),]},]};r.groups.push(n);this._tabCollection.push(r)},_otherTabObj:function(){var n,r=this.XLObj,u="imagetop",i={id:"others",text:r._getLocStr("OTHERS"),groups:[]},f=r._id,e=t.ContentType;n={text:"Window",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Others_Window_FreezePanes","FreezePanes","textandimage",r._id+"_Ribbon_FPane",{dataSource:this._viewMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-frzpane",!1,55,this._splitBtnHeight,"bottom",u,"dropdown","e-spreadsheet e-fpanebtn","FreezePanes","FreezePanesContent")]}]};i.groups.push(n);n={text:r._getLocStr("Formula"),alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Others_Formulas_NameManager","NameManager",e.TextAndImage,"e-icon e-ssr-namemngr",55,this._bigBtnHeight,"NameManager",["NameManagerContent","NameManagerFormulaContent"],!1,u,"")]},{groups:[this._generateBtn("Others_Formulas_DefineName","DefineName",e.TextAndImage,"e-icon e-ssr-definename",110,25,"DefineName","DefineNameContent"),this._generateSplitBtn("Others_Formulas_UseInFormula","UseInFormula","textandimage",r._id+"_nmuseinformula","","e-icon e-ssr-useformula",!1,125,25,t.ArrowPosition.Bottom,t.ImagePosition.ImageLeft,"dropdown","e-spreadsheet e-useinformulabtn","UseInFormula","UseInFormulaContent")]}]};i.groups.push(n);n={text:"Cells",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Others_Cells_InsertCell","Insert","imageonly","e-icon e-ssr-insert",54,40,"InsertTitle",["InsertContent","MultipleInsertContent"],!1,u),this._generateSplitBtn("Others_Cells_InsertCellOptions","Insert","textandimage",f+"_Ribbon_Ins",{dataSource:this._insertMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,54,this._mediumBtnHeight,"bottom","","dropdown","e-insertsbtn","InsertTitle","InsertSBContent")]},{groups:[this._generateBtn("Others_Cells_DeleteCell","Delete","imageonly","e-icon e-ssr-delete",54,40,"DeleteTitle",["DeleteContent","MultipleDeleteContent"],!1,u),this._generateSplitBtn("Others_Cells_DeleteCellOptions","Delete","textandimage",f+"_Ribbon_Del",{dataSource:this._deleteMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,54,this._mediumBtnHeight,"bottom","","dropdown","e-deletesbtn","DeleteTitle",["DeleteContent","MultipleDeleteContent"])]}]};i.groups.push(n);n={text:"Editing",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateSplitBtn("Others_Editing_FindSelect","FindSelect","textandimage",f+"_Ribbon_FindRep",{dataSource:this._findMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-findselect",!1,55,this._splitBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-findbtn","FindSelectTitle","FindSelectContent")]}]};i.groups.push(n);n={text:"Calculation",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Others_CalCulation_CalculationOptions","CalculationOptions","textandimage",f+"_Ribbon_CalcOpt",{dataSource:this._calcOptData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-calcopt",!1,67,this._splitBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-coptbtn","CalcOptTitle",["CalcOptContent","CalcOptRecalcContent"])]},{groups:[this._generateBtn("Others_CalCulation_CalculateNow","CalculateNow",e.TextAndImage,"e-icon e-ss-calcnow",110,30,"CalculateNow",["CalculateNowContent","CalculateNowTurnOffContent"]),this._generateBtn("Others_CalCulation_CalculateSheet","CalculateSheet",e.TextAndImage,"e-icon e-ss-calcsheet",110,30,"CalculateSheet",["CalculateSheetContent","CalculateSheetTurnOffContent"])]}]};i.groups.push(n);this._tabCollection.push(i)},_renderRibbon:function(i){var r=this.XLObj,e=r._id,o=r.element,h=r.model,u=t.buildTag("div","","",{id:e+"_Ribbon"}),c=[r._getLocStr("HOME"),r._getLocStr("INSERT"),r._getLocStr("DATATAB"),r._getLocStr("PAGELAYOUT"),r._getLocStr("REVIEW"),r._getLocStr("OTHERS")],s,f;if(i?o.prepend(u):o.append(u),h.ribbonSettings.applicationTab.type==="menu"&&o.append(t.buildTag("ul","","",{id:e+"_Menu"})),click=t.SplitButton.prototype._documentClick,t.SplitButton.prototype._documentClick=function(t){n(t.target).is(".e-formatastable")||n(t.target).is(".e-formatastable-adaptive")||click.call(this,t)},s=[r._getLocStr("HOME"),r._getLocStr("INSERT"),r._getLocStr("PAGELAYOUT"),r._getLocStr("DATATAB"),r._getLocStr("OTHERS"),r._getLocStr("FORMAT"),r._getLocStr("DESIGN"),r._getLocStr("CHARTDESIGN"),r._getLocStr("ANALYZE")],r.model.ribbonSettings.enableOnDemand&&!r._isRibbonDestroyed)this._createTrgtElement(r._getLocStr("HOME"));else for(f=0;f<s.length;f++)this._createTrgtElement(s[f],u);if(this._menuCustomize(),this._homeTabObj(),this._insertTabObj(),this._dataTabObj(),this._pageTabObj(),this._reviewTabObj(),this._otherTabObj(),this._contextualTabObj(),u.attr("style","overflow:hidden"),u.height(0),u.width(0),u.ejRibbon({width:"100%",allowResizing:!0,applicationTab:this._appTabCollection,tabs:this._tabCollection,contextualTabs:this._contextualTabCollection,tabClick:n.proxy(this._onTabClick,this),tabSelect:n.proxy(this._onTabSelect,this),create:n.proxy(this._onControlCreated,this),collapse:n.proxy(this._onCollapse,this),backstageItemClick:n.proxy(this._onBackStageItemClick,this),groupExpand:n.proxy(this._onGroupExpander,this),pinState:n.proxy(this._onRibbonPin,this),expand:n.proxy(this._onRibbonExpand,this),groupClick:n.proxy(this._onRibbonGroupClick,this),_destroyed:n.proxy(this._rbnDestroy,this),enableOnDemand:r.model.ribbonSettings.enableOnDemand,beforeTabClick:n.proxy(this._onBeforeTabClick,this)}),u.css("height","auto"),u.width("100%"),h.scrollSettings.isResponsive&&(u.ejRibbon("option",{allowResizing:!0}),(r._phoneMode||r._tabMode)&&r._orientation==="landscape"&&u.ejRibbon("collapse")),r.model.ribbonSettings.enableOnDemand&&!r._isRibbonDestroyed)this._homeTabControls(),this._updateRibCustomCss(r._getLocStr("HOME")),this._isHomeTabCreate=!0,this._hideRibbonElem(r._getLocStr("HOME"));else for(this._isHomeTabCreate=!0,this._isInsertTabCreate=!0,this._isDataTabCreate=!0,this._isPageLayoutTabCreate=!0,this._isReviewTabCreate=!0,this._isOthersTabCreate=!0,this._isDesignTabCreate=!0,this._isFormatTabCreate=!0,this._isChartTabCreate=!0,this._analyzeTabCreate=!0,this._isAppTabCreate=!0,n("#"+e+"_Ribbon_review_Comments_5").css("vertical-align","middle"),f=0;f<6;f++)f!==1&&f!==4&&this._updateRibCustomCss(c[f]),this._hideRibbonElem(c[f]);this._hideOtherControls()},_createTabControls:function(t){var i=this.XLObj;switch(t){case i._getLocStr("HOME"):this._isHomeTabCreate||(this._homeTabControls(),this._isHomeTabCreate=!0,i._on(n("#"+i._id+"_cellstyles"),"click",i._cellStyleClick),i._on(n("#"+i._id+"_formatastable"),"click",i._formatAsTableClick),this._updateRibCustomCss(t),this._hideRibbonElem(t));break;case i._getLocStr("INSERT"):this._isInsertTabCreate||(this._isInsertTabCreate=!0,i._on(n(".e-"+i._id+".e-chartcell"),"click",i._chartClickHandler),this._hideRibbonElem(t));break;case i._getLocStr("DATATAB"):this._isDataTabCreate||(this._isDataTabCreate=!0,this._updateRibCustomCss(t),this._hideRibbonElem(t));break;case i._getLocStr("PAGELAYOUT"):this._isPageLayoutTabCreate||(this._pageTabControls(),this._isPageLayoutTabCreate=!0,this._updateRibCustomCss(t),this._hideRibbonElem(t));break;case i._getLocStr("REVIEW"):this._isReviewTabCreate||(n("#"+i._id+"_Ribbon_review_Comments_5").css("vertical-align","middle"),this._isReviewTabCreate=!0,this._hideRibbonElem(t));break;case i._getLocStr("OTHERS"):this._isOthersTabCreate||(this._othersTabControls(),this._isOthersTabCreate=!0,this._updateRibCustomCss(t),i._on(n("#"+i._id+"_nmuseinformula"),"click",".e-nmuseinformularow",i._useInFormulaClick),this._hideRibbonElem(t));break;case i._getLocStr("FORMAT"):this._isFormatTabCreate||(this._isFormatTabCreate=!0);break;case i._getLocStr("DESIGN"):this._isDesignTabCreate||(this._isDesignTabCreate=!0);break;case i._getLocStr("CHARTDESIGN"):this._isChartTabCreate||(this._isChartTabCreate=!0);break;case i._getLocStr("ANALYZE"):this._analyzeTabCreate||(this._isFormatTabCreate=!0)}},_createTrgtElement:function(t,i){var r=this.XLObj,i=i?i:n("#"+r._id+"_Ribbon");switch(t){case r._getLocStr("HOME"):this._isHomeTabTrgt||this._homeTabTrgtElem();this._isHomeTabTrgt=!0;break;case r._getLocStr("INSERT"):this._isInsertTabTrgt||this._onTabCreate();this._isInsertTabTrgt=!0;break;case r._getLocStr("DATATAB"):this._isDataTabTrgt||this._dataTabTrgtElem();this._isDataTabTrgt=!0;break;case r._getLocStr("PAGELAYOUT"):this._isPageLayoutTabTrgt||this._pageTabTrgtElem(i);this._isPageLayoutTabTrgt=!0;break;case r._getLocStr("OTHERS"):this._isOthersTabTrgt||this._othersTabTrgtElem();this._isOthersTabTrgt=!0;break;case r._getLocStr("CHARTDESIGN"):this._isChartTabTrgt||this._renderChartDesignTab();this._isChartTabTrgt=!0;break;case r._getLocStr("ANALYZE"):this._analyzeTabTrgt||this._renderAnalyzeTab();this._analyzeTabTrgt=!0;break;case r._getLocStr("FORMAT"):this._isFormatTabTrgt||this._renderFormatTab();this._isFormatTabTrgt=!0;break;case r._getLocStr("DESIGN"):this._isDesignTabTrgt||this._renderDesignTab();this._isDesignTabTrgt=!0}},_onTabCreate:function(){var i=this.XLObj,u=i._id,t=i.element,r=n("#"+i._id+"_Ribbon");t.append(this._chartType("ColumnChart",6,2,2,["column","stackingcolumn","stackingcolumn100","column","stackingcolumn","stackingcolumn100"],["ClusteredColumn","StackedColumn","Stacked100Column","Cluster3DColumn","Stacked3DColumn","Stacked100Column3D"]));t.append(this._chartType("BarChart",6,2,2,["bar","stackingbar","stackingbar100","bar","stackingbar","stackingbar100"],["ClusteredBar","StackedBar","Stacked100Bar","Cluster3DBar","Stacked3DBar","Stacked100Bar3D"]));t.append(this._chartType("StockChart",2,2,2,["radar","radar"],["Radar","RadarMarkers"]));t.append(this._chartType("LineChart",2,2,3,["line","line"],["Line","LineMarkers"]));t.append(this._chartType("AreaChart",3,3,3,["Area","stackingarea","stackingarea100"],["Area","StackedArea","Stacked100Area"]));t.append(this._chartType("PieChart",3,3,4,["pie","pie","doughnut"],["Pie","Pie3D","Doughnut"]));t.append(this._chartType("ScatterChart",1,2,2,["scatter"],["Scatter"]));r.append("<div id='"+i._id+"_nmuseinformula' class='e-nmuseinformula' style='width:125px'><\/div>")},_rbnDestroy:function(i){var r=this.XLObj,u=r._id,s="#"+u+"_Ribbon_Home_Font_FillColor",h="#"+u+"_Ribbon_Home_Font_FontColor",c="#"+u+"_Ribbon_PictureColor",e="#"+u+"_Ribbon_Home_Font_BorderColor",l="#"+u+"_Ribbon_BorderCP",a=n("#"+u+"_Ribbon").ejRibbon("instance"),v=a.getTabText(a.model.selectedItemIndex),y=r.model.ribbonSettings.enableOnDemand;if(n(s).data("ejColorPicker")&&n(s).ejColorPicker("destroy"),n(h).data("ejColorPicker")&&n(h).ejColorPicker("destroy"),n(c).data("ejColorPicker")&&n(c).ejColorPicker("destroy"),n(e).data("ejColorPicker")&&n(e).ejColorPicker("destroy"),n("#"+u+"_Ribbon_Home_Font_BorderColor_Presets").parent().remove(),n(l).data("ejColorPicker")&&n(l).ejColorPicker("destroy"),i&&!i.destroy){if(r._off(n("#"+u+"_cellstyles"),"click",r._cellStyleClick),r._off(n("#"+u+"_formatastable"),"click",r._formatAsTableClick),n(e)[0].style.display="none",r._off(n(".e-"+u+".e-chartcell"),"click",r._chartClickHandler),!y||this._isHomeTabTrgt&&v===r._getLocStr("HOME")){var u=r._id,f=r.element,p=u+"_Ribbon_",o=p+"Home_Font_";f.append(t.buildTag("input","",{display:"none"},{id:o+"FillColor",type:"text"}));f.append(t.buildTag("input","",{display:"none"},{id:o+"FontColor",type:"text"}));f.append(t.buildTag("input","",{display:"none"},{id:o+"BorderColor",type:"text"}));f.append(t.buildTag("div.e-spreadsheet e-formatastable","",{display:"none"},{id:r._id+"_formatastable"}));r.element.append(this._renderCellStyles())}else this._isHomeTabTrgt=!1;!y||this._isInsertTabTrgt&&v===r._getLocStr("INSERT")?this._onTabCreate():this._isInsertTabTrgt=!1;this._isHomeTabCreate=this._isInsertTabCreate=this._isDataTabCreate=this._isPageLayoutTabCreate=this._isReviewTabCreate=!1;this._isOthersTabCreate=this._isDesignTabCreate=this._isFormatTabCreate=this._isChartTabCreate=this._analyzeTabCreate=this._isAppTabCreate=!1;r._isRibbonDestroyed=!0}else n(document.body).append(n("#"+u+" _formatastable").parent()),n(document.body).append(n("#"+u+" _cellstyles").parent())},_updateRibCustomCss:function(n){var r=this.XLObj,i=r._id,y,p,w,b,u,s,a,t=0,k,h="Options",e,o,c,f,v;switch(n){case r._getLocStr("HOME"):var d="e-ssr-colpickHprt",g="_Ribbon_Home_Font",nt="_Ribbon_home_Font_Home_Font_",tt="_Ribbon_home_Clipboard_Home_Clipboard_Paste",st=["e-mergebtn","e-borderbtn","e-autosumbtn"],it=[i+nt+"FontFamily",i+nt+"FontSize"],rt=["e-ssr-fontfamily","e-ssr-fontsize"];for(c=[i+tt+h],o=[i+tt],e=[i+"_Ribbon_home_Clipboard_1"],f=[" e-ssr-pastebtnHprt"],r.addClass(document.getElementById(i+g+"_FillColorWrapper").children[0],d),r.addClass(document.getElementById(i+g+"_FontColorWrapper").children[0],d),b=r.element[0].querySelectorAll(".e-ssr-colpickHprt .e-color-container,.e-ssr-colpickHprt .e-select");t<4;)r.addClass(b[t],"e-ssr-colorcontainer"),t++;for(t=0;t<3;)r.addClass(document.querySelectorAll("."+st[t])[0].parentNode,"e-ssr-horizontalprt"),t++;for(t=0;t<2;)r.addClass(document.getElementById(it[t]),rt[t]),t++;break;case r._getLocStr("DATATAB"):v="_Ribbon_data_DataTools_Data_DataTools_DataValidation";c=[i+v+h];o=[i+v];e=[i+"_Ribbon_data_DataTools_1"];f=[" e-ssr-dtvaldtnHprt"];break;case r._getLocStr("PAGELAYOUT"):var ut="_Ribbon_pagelayout_PageLayout_PageLayout_PageLayout_PageSize",ft="_Ribbon_PageLayout_Show_",it=["ej"+i+ft+"Headings","ej"+i+ft+"Gridlines"],rt=["e-vheading","e-vgridlines"];for(c=[i+ut+h],o=[i+ut],e=[i+"_Ribbon_pagelayout_PageLayout_1"],f=[" e-ssr-pagesizebtnHprt"," e-ssr-sizebtnHprt"],t=0;t<2;)r.addClass(document.getElementById(it[t]),rt[t]),t++;break;case r._getLocStr("OTHERS"):var et="InsertCell",l="_Ribbon_others_Cells_Others_Cells_",ot="DeleteCell";c=[i+l+et+h,i+l+ot+h];o=[i+l+et,i+l+ot];e=[i+"_Ribbon_others_Cells_1",i+"_Ribbon_others_Cells_2"];f=[" e-ssr-insertbtnHprt"," e-ssr-deletebtnHprt"]}for(t=0,k=e.length;t<k;)a=document.getElementById(e[t]),w=document.getElementById(o[t]),y=document.getElementById(o[t]),p=document.getElementById(c[t]),u=document.createElement("span"),u.className="e-ssr-verticalHparent"+f[t],u.style.display="inherit",a.insertBefore(u,w),u.appendChild(y),u.appendChild(p),f[0]===" e-ssr-pagesizebtnHprt"&&(s=document.createElement("span"),s.className="e-ssr-verticalHparent"+f[t+1],s.style.display="inherit",s.appendChild(u),a.appendChild(s)),t++},_hideOtherControls:function(){for(var t=0,i=["CElement","Paste","Border","Merge","SortFilter","Clear","ColumnChart","BarChart","Validation","PageSize","FPane","Ins","Del","FindRep","PastePic","PictureBorder","AutoSum","ResetPic","PictureBorder","StockChart","LineChart","AreaChart","PieChart","ScatterChart","color_Presets","PictureColor_Presets","Home_Font_BorderColor_Presets"],r=i.length;t--;)n("#"+this._id+"_Ribbon_"+i[t]).hide();for(t=0,i=["CFormat","formatastable","cellstyles","ctxtmenu"],r=i.length;t--;)n("#"+this._id+"_"+i[t]).hide()},_renderAppTab:function(){var i,n=this.XLObj,r=[];i="<div id='"+n._id+"_backstagetabnew' style='display:none' class='e-ssr-bstabnew'><div class='e-ssr-bscontent' title='"+n._getLocStr("BlankWorkbook")+"'><div class='e-ssr-bsnewtmpl' ><button id='"+n._id+"_bstab_new_blank' type='button' class = 'e-rbn-button' ><\/button><\/div><\/div><\/div>";i=i.concat("<div id='"+n._id+"_backstagetabsaveas' style='display:none' class='e-ssr-bstabsaveas'><div class='e-ssr-bscontent'><div class='e-ssr-bssaveasopt'><button id='"+n._id+"_bstab_saveas_excel' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("SaveAsExcel")+"<\/span><\/div><div class='e-ssr-bssaveasopt'><button id='"+n._id+"_bstab_saveas_csv' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("SaveAsCsv")+"<\/span><\/div><div class='e-ssr-bssaveasopt'><button id='"+n._id+"_bstab_saveas_pdf' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("SaveAsPdf")+"<\/span><\/div><\/div><\/div>");i=i.concat("<div id='"+n._id+"_backstagetabprint' style='display:none' class='e-ssr-bstabprint'><div class='e-ssr-bscontent'><div class='e-ssr-bsprintopt'><button id='"+n._id+"_bstab_print_sheet' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("PrintSheet")+"<\/span><\/div><div class='e-ssr-bsprintopt'><button id='"+n._id+"_bstab_print_selected' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("PrintSelected")+"<\/span><\/div><\/div><\/div>");n.element.append(i);r.push({id:"new",text:n._getLocStr("New"),itemType:t.Ribbon.itemType.tab,contentID:n._id+"_backstagetabnew"});r.push({id:"open",text:n._getLocStr("Open")+"...",itemType:t.Ribbon.itemType.tab});r.push({id:"saveas",text:n._getLocStr("SaveAs"),itemType:t.Ribbon.itemType.tab,contentID:n._id+"_backstagetabsaveas"});r.push({id:"print",text:n._getLocStr("Print"),itemType:t.Ribbon.itemType.tab,contentID:n._id+"_backstagetabprint"});this._appTabCollection={type:t.Ribbon.applicationTabType.backstage,backstageSettings:{text:n._getLocStr("File"),headerWidth:124,height:n._responsiveHeight-2,width:n._responsiveWidth-3,pages:r}}},_onBackStageItemClick:function(t){var i,e,r,f,u;if(this._isAppTabCreate||(this._appTabControls(),this._isAppTabCreate=!0),i=this.XLObj,f=i.model.ribbonSettings.applicationTab,i.XLEdit._isEdit&&i.XLEdit.saveCell(),i.XLComment&&i.XLComment._isCommentEdit&&i.XLComment._updateCurCmntVal(),i._isSheetRename&&!i._updateSheetNames(null,!1)){i.element.find("#"+i._id+"_Ribbon").ejRibbon("hideBackstage");return}if(f.type==="menu"){if(e={element:t.element},i._trigger("menuClick",e))return;t.ID==="Open"?(i.XLEdit._isEdit&&i.XLEdit.saveCell(),this._bSBtnClickHandler(t.ID.toLowerCase(),t)):this._bSBtnClickHandler(t.ID.toLowerCase(),t)}if(f.type==="backstage")if(t.type==="backstageItemClick"){if(r={id:t.id,text:t.text,type:t.type,target:t.target,prop:t.model},i._trigger("menuClick",r))return;t.id==="open_backStageTab"&&(i.XLEdit._isEdit&&i.XLEdit.saveCell(),this._bSBtnClickHandler("open",t))}else{if(r={e:t.e,type:t.type,status:t.status,target:t.target,id:t.target.id},i._trigger("menuClick",r))return;n("#"+i._id+"_Ribbon").ejRibbon("hideBackstage");i._phoneMode&&n("#"+i._id+"_Ribbon").ejRibbon("goToMainContent");u=t.model.prefixIcon;this._bSBtnClickHandler(u.indexOf("blank")>-1?u.split("-")[2]:u.split("-")[3],t)}},_bSBtnClickHandler:function(i,r){var u=this.XLObj,f=u.getActiveSheetIndex();if(arg={id:r.id||r.ID||r.target.id,status:r.status,prop:r.model,model:u.model},!u._trigger("ribbonClick",arg)){n("#"+u._id+"_Ribbon").ejRibbon("hideBackstage");switch(i){case"open":if(u.isDirty)u._showAlertDlg("confirm","ImportAlert","Open",470);else{if(u.model.importSettings.importMapper.length<1){u._showAlertDlg("Alert","ImportExportUrl");return}n("#"+u._id+"_file .e-uploadinput").click();u._browserDetails.name!="msie"&&u._browserDetails.name!="edge"&&n("#"+u._id+"_Ribbon_BackStage").show();n("#"+u._id+"_Ribbon").find(".e-backstagetitlecontent").text("").append("Open")}break;case"new":case"blank":u._isSheetsDirty()&&u._showAlertDlg("confirm","DestroyAlert","New",470);break;case"exportxl":u.XLExport["export"](t.Spreadsheet.exportType.Excel);break;case"exportcsv":u.XLExport["export"](t.Spreadsheet.exportType.Csv);break;case"exportpdf":u.XLExport["export"](t.Spreadsheet.exportType.Pdf);break;case"print":case"printsheet":u.XLPrint.printSheet(f);break;case"printselected":u.XLPrint.printSelection(f)}}},_contextualTabObj:function(){var r=this.XLObj,n=r._id,u="imagetop",i;i={backgroundColor:"#FCFBEB",borderColor:"#F2CC1C",tabs:[{id:"design",text:r._getLocStr("Design"),groups:[{text:"Properties",alignType:t.Ribbon.alignType.rows,type:"custom",contentID:n+"_Ribbon_Design_Properties_TableProperties"},{text:"Tools",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Design_Tools_ResizeTable","ResizeTable","textandimage","e-icon e-ssr-resizetable",101,this._smallBtnHeight,"ResizeTable","ResizeTableContent"),this._generateBtn("Design_Tools_ConvertToRange","ConvertToRange","textandimage","e-icon e-ssr-range",130,this._smallBtnHeight,"ConvertToRange","ConvertToRangeContent")]}]},{text:"Table Style Options",alignType:t.Ribbon.alignType.rows,type:"custom",contentID:n+"_Ribbon_Design_TableStyleOptions"}]}]};this._contextualTabCollection.push(i);i={backgroundColor:"#EAF6BD",borderColor:"#90AA3C",tabs:[{id:"chartdesign",text:r._getLocStr("CHARTDESIGN"),groups:[{text:"Chart Layouts",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("ChartDesign_ChartLayouts_AddChartElement","AddChartElement","textandimage",n+"_Ribbon_CElement","","e-icon e-ssr-celements",!0,65,this._bigBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-chartlayoutbtn","AddChartElement","AddChartElementContent")]}]},{text:"Data",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("ChartDesign_Data_SwitchRowColumn","SwitchRowColumn","textandimage","e-icon e-ssr-srcolumn",72,this._bigBtnHeight,"SwitchRowColumn","SwitchRowColumnContent","","imagetop"),this._generateBtn("ChartDesign_Data_SelectData","SelectData","textandimage","e-icon e-ssr-selectdata",50,this._bigBtnHeight,"SelectData","SelectDataContent",!1,u)]}]},{text:"Type",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("ChartDesign_Type_ChangeChartType","ChartType","textandimage","e-icon e-ssr-charttype",65,this._bigBtnHeight,"ChartType","ChartTypeContent",!1,u)]}]},{text:"Chart Themes",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateDD("ChartDesign_ChartThemes_ChartThemes","ChartThemes",this._chartThemes,"1",130,this._smallBtnHeight,"ChartThemes","ChartThemesContent")]}]},{text:"Size",alignType:t.Ribbon.alignType.columns,content:[{groups:[{contentID:n+"_Ribbon_ChartDesign_Size_ChartSize",enableSeparator:!0,type:t.Ribbon.type.custom,height:80}]}]}]}]};this._contextualTabCollection.push(i);i={backgroundColor:"#FCFBEB",borderColor:"#F2CC1C",tabs:[{id:"format",text:r._getLocStr("FORMAT"),groups:[{text:"Adjust",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Format_Adjust_ChangePicture","ChangePicture","textandimage","e-icon e-ssr-changepicture",120,this._mediumBtnHeight,"ChangePicture","ChangePictureContent"),this._generateSplitBtn("Format_Adjust_ResetPicture","ResetPicture","textandimage",n+"_Ribbon_ResetPic",{dataSource:this._resetPicture,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-resetpicture",!1,120,this._mediumBtnHeight,"left","","dropdown","e-ss-resetpictbtn","ResetPicture","ResetPictureContent")]}]},{text:"Border",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Format_Border_PictureBorder","PictureBorder","textandimage",n+"_Ribbon_PictureBorder","","e-icon e-ssr-pictureborder",!1,120,this._mediumBtnHeight,"left","","dropdown","e-ss-pictbrdrbtn","PictureBorder","PictureBorderContent")]}]},{text:"Size",alignType:t.Ribbon.alignType.columns,type:"custom",contentID:n+"_Ribbon_Format_Size_PictureSize"}]}]};this._contextualTabCollection.push(i);i={backgroundColor:"#FCF0F7",borderColor:"#C9599C",tabs:[{id:"analyze",text:r._getLocStr("ANALYZE"),groups:[{text:"PivotTable",alignType:t.Ribbon.alignType.rows,type:"custom",contentID:n+"_pvttableproperties"},{text:"DataSource",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Analyze_DataSource_Refresh","Refresh","textandimage","e-icon e-ssr-datarefresh",50,this._bigBtnHeight,"RefreshTitle","RefreshContent",!1,u),this._generateBtn("Analyze_DataSource_ChangeDataSource","ChangeDataSource","textandimage","e-icon e-ssr-changedatasource",50,this._bigBtnHeight,"ChangeDataSource","ChangeDataSourceContent",!1,u)]}]},{text:"Actions",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Analyze_Actions_ClearAll","ClearAll","textandimage","e-icon e-ssr-pivotclearall",70,this._smallBtnHeight,"ClearAll","ClearAllContent",!1,"","e-datapadding"),this._generateBtn("Analyze_Actions_MovePivotTable","MovePivotTable","textandimage","e-icon e-ssr-movepivottable",120,this._smallBtnHeight,"MovePivotTable","MovePivotTableContent",!1,"","e-datapadding")]}]},{text:"Show",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateToggleBtn("Analyze_Show_FieldList","FieldList","textandimage","e-icon e-ssr-fieldlist","FieldListTitle",50,this._bigBtnHeight,["FieldListContent","FieldListRemoveContent"],!1,"",u,null,null,!0)]}]}]}]};this._contextualTabCollection.push(i)},_onRibbonPin:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r;this._ribbonState=!0;t.action="toggleBtn";i.model._isActPanelVisible=this._isPanelVisible;i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t);i.model._isActPanelVisible&&i._refreshActivationPanel();i.getSheet(i.getActiveSheetIndex())._isRibCollapsed=!1},_onRibbonExpand:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r;t.action="toggleBtn";t.type==="expand"&&t.clickType==="dblclick"||i._phoneMode?(this._ribbonState=!0,i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t),this.XLObj.model._isActPanelVisible&&i._refreshActivationPanel(),i.getSheet(i.getActiveSheetIndex())._isRibCollapsed=!1):this.XLObj.model._isActPanelVisible&&(i.getActivationPanel().hide(),this._isPanelVisible=i.model._isActPanelVisible,i.model._isActPanelVisible=!1,i._heightWidthCalculation(i.getActiveSheetIndex(),u,t))},_onRibbonGroupClick:function(t){var i=this.XLObj,u,r;i._phoneMode&&(n(t.target).parents(".e-resizegroupdiv").length>0||t.target.className.indexOf("e-resizegroupdiv")>-1||t.target.className.indexOf("e-ribdownarrow")>-1||t.target.className.indexOf("e-ribuparrow")>-1||t.target.className.indexOf("e-ribleftarrow")>-1)&&(u=n.extend(!0,{},i.model.scrollSettings),this._ribbonState=!0,t.action="toggleBtn",i.model._isActPanelVisible=this._isPanelVisible,i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t),i.model._isActPanelVisible&&i._refreshActivationPanel())},_hideTabs:function(){for(var r=n("#"+this.XLObj._id+"_Ribbon").ejRibbon("instance"),i=["",this.XLObj._getLocStr("Design"),this.XLObj._getLocStr("CHARTDESIGN"),this.XLObj._getLocStr("FORMAT"),this.XLObj._getLocStr("ANALYZE")],t=i.length;t=t-1;)r.hideTab(i[t])},_renderDesignTab:function(){var i=this.XLObj,r="",u=i._getLocStr("TableStyleOptions").split("/"),t=i._id+"_Ribbon_Design_TableStyleOptions";i.element.append("<input id="+i._id+'_tableid type="text" style = "display:none"/>');r="<div id="+i._id+'_Ribbon_Design_Properties_TableProperties><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell">Table Name:<\/div><\/div><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell"><input type="text" id='+i._id+'_Ribbon_Design_Properties_TableName class="ejinputtext" style="width:86px;opacity:0.7;height: 18px;text-indent: 3px;padding-left: 0px;box-sizing: content-box;" /><\/div><\/div><\/div>';r=r+"<div id="+t+'><div class="e-tablestyleoptionsrow" ><div class="e-tablestyleoptionscell"><input id='+t+'_FirstColumn type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_FirstColumn">'+u[0]+'<\/label><\/div><div class="e-tablestyleoptionscell" ><input id='+t+'_LastColumn type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_LastColumn">'+u[1]+'<\/label><\/div><\/div><div class="e-tablestyleoptionsrow" ><div class="e-tablestyleoptionscell"><input id='+t+'_TotalRow type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_TotalRow">'+u[2]+'<\/label><\/div><div class="e-tablestyleoptionscell" ><input id='+t+'_FilterColumn type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_FilterColumn">'+u[3]+"<\/label><\/div><\/div><\/div>";i.element.append(r);n("#"+t+"_FirstColumn").ejCheckBox({change:this._ribbonClickHandler});n("#"+t+"_LastColumn").ejCheckBox({change:this._ribbonClickHandler});n("#"+t+"_TotalRow").ejCheckBox({change:this._ribbonClickHandler});n("#"+t+"_FilterColumn").ejCheckBox({change:this._ribbonClickHandler})},_renderFormatTab:function(){var u=this.XLObj,f=u._id,e=u.element,i=f+"_Ribbon",r=i+"_Format_Size_";e.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"_ResetPic"}));e.append(this._borderPicture());e.append("<div id="+r+"PictureSize class= e-ss-numeric style='display:none'><table><tr><td style='padding-right:4px;'>"+u._getLocStr("Height")+": <\/label><\/td><td style='padding-bottom:3px;'><input id='"+r+"PictureHeight' type='text' /><\/td><\/tr><tr><td><labe>"+u._getLocStr("Width")+": <\/label><\/td><td><input id='"+r+"PictureWidth' type='text' /><\/td><\/tr><\/table><\/div>");n("#"+r+"PictureHeight").ejNumericTextbox({name:"numeric",value:100,minValue:25,incrementStep:5,change:n.proxy(this._pictureSizeChange,this,"PictureWidth")});n("#"+r+"PictureWidth").ejNumericTextbox({name:"numeric",value:100,minValue:25,incrementStep:5,change:n.proxy(this._pictureSizeChange,this,"PictureHeight")});n("#"+i+"_PictureColor").ejColorPicker({modelType:"palette",presetType:"basic",cssClass:"e-ss-colorpicker e-ss-menuclrpkr",change:this._ribbonClickHandler});n("#"+i+"_PictureColorWrapper").hide();n("#"+i+"_PictureColor_popup").css({display:"block"});n("#"+f+"picturecolor ul li").find("a").remove();n("#"+f+"picturecolor ul li").append(n("#"+i+"_PictureColor_popup"))},_renderAnalyzeTab:function(){var n=this.XLObj;n.element.find("#"+n._id+"_Ribbon_analyze_PivotTable_content").width(132);n.element.find("#"+n._id+"_pvttableproperties").length||n.element.append("<div id="+n._id+'_pvttableproperties style="display:none" ><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell">PivotTable Name:<\/div><\/div><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell"><input type="text" id='+n._id+'_Ribbon_Analyze_PivotTable_PivotTableName class="ejinputtext" style="width:106px;opacity:0.7;height: 18px;text-indent: 3px;" /><\/div><\/div><\/div>')},_renderChartDesignTab:function(){var u=this.XLObj,r=u.element,i=u._id,t=i+"_Ribbon_ChartDesign_Size_";r.append("<input id="+i+'_chart type="text" style="display:none;"/>');r.append(this._chartElementTag());r.append("<div id="+t+"ChartSize class= e-ss-numeric style='width: 180;height: 80;'><table><tr><td><label class ='e-icon e-ssr-chartheight' style='width:25;height:25;display: visible' id = "+i+"_Ribbon_chartheightlbl /><\/td><td><input id='"+t+"ChartHeight' type='text' /><\/td><\/tr><tr><td><label class ='e-icon e-ssr-chartwidth' style='width: 180;height: 80;' id = "+i+"_Ribbon_chartwidthlbl /><\/td><td><input id='"+t+"ChartWidth' type='text' /><\/td><\/tr><\/table><\/div>");n("#"+t+"ChartWidth").ejNumericTextbox({name:"numeric",value:200,minValue:180,decimalPlaces:1,incrementStep:5,change:this._ribbonClickHandler});n("#"+t+"ChartHeight").ejNumericTextbox({name:"numeric",value:200,minValue:180,decimalPlaces:1,incrementStep:5,change:this._ribbonClickHandler})},_renderNameManagerDlg:function(){var i=this.XLObj,r="<div id = '"+i._id+"_nmdlg' style=display:'none'; ><div class='e-dlgctndiv' style='width: 100%;' ><div class='e-dlg-fields e-nmdlg-content' style='width: 100%;'><div class='e-ss-nm-dlg-grid'><div id='"+i._id+"_nmgrid' style=display:'none';><\/div><\/div><\/div><div class='e-dlg-fields'><label class='e-dlg-fields'>"+i._getLocStr("RefersTo")+":<\/label><input type='text' class='e-nmrange ejinputtext' id='"+i._id+"_nmrange' disabled='true' /><\/div><div class='e-dlg-btnfields' ><div class='e-dlg-btnctnr'><button id='"+i._id+"_nmclose' >"+i._getLocStr("Close")+"<\/button><\/div><\/div><\/div><\/div>";r=r+"<script id='"+i._id+"_nmeditortemplate' class='e-hide' type='text/template' ><div class='e-dlg-fields e-dlgctndiv'><table cellpadding='0' cellspacing='0'><tr><td>"+i._getLocStr("Name")+":<\/td><td><input id='"+i._id+"_nmgridname' type='text' class='ejinputtext' name='name' value='{{: name}}'/><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+i._getLocStr("Scope")+":<\/td><td><input class='e-nmscope ejinputtext' id='"+i._id+"_nmgridscope' type='text' disabled='disabled' name='scope' value='Workbook'/><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+i._getLocStr("Comment")+":<\/td><td><textarea id='"+i._id+"_nmgridcomment' class='e-ss-textarea' style=' resize: none; height: 44px; width: 100%;' name='comment' value='{{: comment}}'>{{: comment}}<\/textarea><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+i._getLocStr("RefersTo")+":<\/td><td><input type='text' class='ejinputtext' id='"+i._id+"_nmgridrefersto' name = 'refersto' value='{{: refersto}}' /><\/td><\/tr><\/table><\/div><\/script>";i.element.append(r);n("#"+i._id+"_nmclose").ejButton({showRoundedCorner:!0,width:68,click:n.proxy(this._nmdlgClose,i)});this._renderNMGrid();n("#"+i._id+"_nmdlg").ejDialog({enableResize:!1,showOnInit:!1,title:i._getLocStr("NameManager"),enableModal:!0,width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-nmdlg e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),beforeClose:t.proxy(this._beforeDlgClose,this),open:t.proxy(this._nmDlgOpen,this)})},_renderNMGrid:function(){var i=this.XLObj;n("#"+i._id+"_nmgrid").ejGrid({dataSource:i.model.nameManager.slice(0),pageSettings:{pageSize:6},allowScrolling:!0,allowSorting:!0,enableAltRow:!1,isResponsive:!0,cssClass:"e-ss-dialog ej-ssgrid e-"+i._id+"-dlg",selectionType:t.Grid.SelectionType.Single,editSettings:{allowAdding:!0,allowDeleting:!1,editMode:t.Grid.EditMode.DialogTemplate,dialogEditorTemplateID:"#"+i._id+"_nmeditortemplate"},toolbarSettings:{showToolbar:!0,toolbarItems:[t.Grid.ToolBarItems.Add]},actionBegin:n.proxy(this._nmActionBegin,i),actionComplete:n.proxy(this._nmActionComplete,i),rowSelected:n.proxy(this._nmRecordSelected,i),columns:[{field:"name",headerText:i._getLocStr("Name"),isPrimaryKey:!0,width:100},{field:"refersto",headerText:i._getLocStr("RefersTo"),width:120},{field:"scope",headerText:i._getLocStr("Scope"),width:80},{field:"comment",headerText:i._getLocStr("Comment"),width:100}]})},_updateNMRange:function(){var t=this.XLObj;n("#"+t._id+"_nmgridEditForm").find("#"+t._id+"_nmgridrefersto").val("="+t._getDollarAlphaRange(t.getSheet(t.getActiveSheetIndex()).selectedRange,!0))},_nmdlgClose:function(){n("#"+this._id+"_nmdlg").ejDialog("close")},_nmRecordSelected:function(t){n("#"+this._id+"_nmdlg").find(".e-nmrange").val(t.data.refersto)},_nmDlgOpen:function(){var t=this.XLObj,i,r;i=n("#"+t._id+"_nmgrid").ejGrid("instance");r=t._phoneMode?6:10;i.getPager()&&i.option({pageSettings:{pageSize:r}});this._isNmgrid==="DefineName"&&(n("#"+t._id+"_nmgrid").ejGrid("instance").addRecord(),n("#"+t._id+"_nmgridEditForm input")[0].focus());this._isNmgrid=""},_nmActionBegin:function(n){var t=0,u=!1,f,e,r,i=this.getSheet(this.getActiveSheetIndex());if(n.requestType==="save"&&n.data.refersto){if(r=n.data,r.sheetIndex=this._getSheetIndexByName(n.data.refersto.split("!")[0].replace(/[=\']/g,"")),n.cancel=!0,!r.sheetIndex){this._showAlertDlg("Alert","InvalidSheetIndex","NMRangeAlert",275);return}if(i._nmEdit)for(e in i._nmValue){for(f=this.model.nameManager.length;t<f;){if(this.model.nameManager[t].name===i._nmValue.name){this.model.nameManager.splice(t,1);this._calcEngine.removeNamedRange(i._nmValue.name);break}t++}for(t=this._formulaCollection.length;t--;)if(this._formulaCollection[t].display===i._nmValue.name){u=!0;this._formulaCollection.splice(t,1);break}if(u)break}this.XLRibbon._validateNamedRange(r.name,r.refersto)?n.cancel=!1:u&&this.model.nameManager.push(i._nmValue)}n.requestType==="beginedit"&&(i._nmEdit=!0,i._nmValue={name:n.model.dataSource[n.model.selectedRowIndex].name,refersto:n.model.dataSource[n.model.selectedRowIndex].refersto,comment:n.model.dataSource[n.model.selectedRowIndex].comment,sheetIndex:n.model.dataSource[n.model.selectedRowIndex].sheetIndex,scope:n.model.dataSource[n.model.selectedRowIndex].scope})},_nmActionComplete:function(t){var r=n("#"+this._id+"_nmgrid").data("ejGrid"),f=t.requestType,i,u;switch(f){case"add":i=n("#"+this._id+"_nmgrid_dialogEdit").data("ejDialog");i.model.open=n.proxy(this.XLRibbon._updateNMRange(),this);i.option("allowDraggable",!1);i.option("title",this._getLocStr("NewName"));u=n("#"+this._id+"_nmgridEditForm").find("input[type='button']:first");u.data("ejButton").option({text:"OK",cssClass:"e-ss-okbtn"});u.parent().addClass("e-dlg-btnfields").css("text-align","right");break;case"save":this.XLRibbon._addNamedRange(r,t.data.name,t.data.refersto,t.data.comment,t.data.sheetIndex);break;case"delete":this.XLRibbon._removeNamedRange(r,t.data.name);break;case"cancel":r.element.focus()}},_updateNamedRanges:function(n,t,i){var r=this.XLObj;t=r.XLEdit._parseSheetRef(t,!0);r._calcEngine.addNamedRange(n,t.replace("=",""));r._formulaCollection.push({text:"="+n,display:n});i||r.XLEdit._refreshAutoComplete()},_updateUseInFormulaTrgt:function(){for(var i=0,t=this.XLObj,r="",e=n("#"+t._id+"_nmuseinformula"),u=t.model.nameManager,f=u.length;i<f;)r=r+"<div class='e-nmuseinformularow' style = 'color:#333333'>"+u[i].name+"<\/div>",i++;f?n("#"+t._id+"_Ribbon_Others_Formulas_UseInFormula").ejSplitButton("enable"):n("#"+t._id+"_Ribbon_Others_Formulas_UseInFormula").ejSplitButton("disable");e.html("<div>"+r+"<\/div>")},addNamedRange:function(t,i,r,u){var f=this.XLObj,e;f._showDialog(f._id+"_Ribbon_Others_NameManager");e=n("#"+f._id+"_nmgrid").data("ejGrid");this._validateNamedRange(t,i)&&(e.addRecord({name:t,refersto:i,comment:r?r:"",scope:"WorkBook",sheetIndex:u}),e.refreshContent())},_addNamedRange:function(n,t,i,r,u){var f=this.XLObj;f.model.nameManager=n.model.dataSource.slice(0);this._updateNamedRanges(t,i);this._updateUseInFormulaTrgt();f._isSheetNavigate||f._trigActionComplete({sheetIndex:u,reqType:"named-range",name:t,refersTo:i,comment:r})},removeNamedRange:function(t){if(t){var i=n("#"+this.XLObj._id+"_nmgrid").data("ejGrid");i.option("editSettings",{allowDeleting:!0});i.deleteRecord("name",{name:t});i.option("editSettings",{allowDeleting:!1})}},_removeNamedRange:function(n,t){var r,u,i=this.XLObj,f=i.model.nameManager[i.model.nameManager.length-1];if(i.model.nameManager=n.model.dataSource.slice(0),u=i.model.nameManager,i._calcEngine.removeNamedRange(t),i._updateFormulaCollection(),r=u.length,r)while(r--)i._formulaCollection.push({text:"="+u[r].name,display:u[r].name});this._updateUseInFormulaTrgt()},_validateNamedRange:function(t,i){var e,o,s,a,u,r=this.XLObj,h="NMRangeAlert",c="NMNameAlert",l="NMUniqueNameAlert",f;if(e=this._validateDollarRange(i),t&&t.length>0&&(o=/^([a-zA-Z_0-9]){0,255}$/.test(t)&&this._validateLibraryFunctions(t)),s=this._validateNameManager(t),r._isUndoRedo||e&&o&&s)return!0;a=n("#"+r._id+"_alertdlg");e?o?(u=r._getLocStr(l),f=l):(u=r._getLocStr(c).split("/")[0],f=c):(u=r._getLocStr(h),f=h);r._showAlertDlg("Alert","T-"+u,f,370)},_validateLibraryFunctions:function(n){var i,r=[],u=this.XLObj.getCalcEngine().getLibraryFunctions();n=t.isNullOrUndefined(n)?"":n.toString().toUpperCase();for(i in u.items)r.push(i);for(i=r.length;i--;)if(r[i]===n)return!1;return!0},_validateNameManager:function(n){var i=0,r=this.XLObj.model.nameManager,u=r.length;for(n=t.isNullOrUndefined(n)?"":n.toString().toUpperCase();i<u;){if(r[i].name.toUpperCase()===n)return!1;i++}return!0},_validateDollarRange:function(n){try{if(n&&n.indexOf("!")>-1)return n=n.split("!")[1].replace(/\$/g,""),this.XLObj.getRangeIndices(n),!0}catch(t){return!1}},_renderFormatAsTable:function(){for(var f,a,it,e=this.XLObj,u=0,at=[11,19],rt=0,l="",ut="",i="w:bold",r="c:#FFFFFF",t="c:#000000",p="c:#2F75B5",w="c:#ED7D31",b="c:#FFC000",o="1px solid #000000",s="1px solid #2f75b5",h="1px solid #ED7D31",c="1px solid #FFC000",k="b:#D9D9D9",v="b:#DDEBF7",d="b:#FCE4D6",g="b:#FFF2CC",ft="b:#000000",et="b:#FFE2C6",ot="b:#FFF1BF",y="b:#000000",st="b:#D7D7D7",nt="b:#FFC000",tt="b:#5B9BD5",ht="b:#Ed7D31",ct="hl?"+i+";"+t+";bo:tb-"+o+"&cl?"+k+";"+t+","+t+"&cb?b-"+o+"/hl?"+i+";bo:tb-"+s+";"+p+"&cl?"+v+";"+p+","+p+"&cb?b-"+s+"/hl?"+i+";bo:tb-"+h+";"+w+"&cl?"+d+";"+w+","+w+"&cb?b-"+h+"/hl?"+i+";bo:tb-"+c+";"+b+"&cl?"+g+";"+b+","+b+"&cb?b-"+c+"/hl?"+i+";"+ft+";"+r+";bo:o-"+o+"&cl?bo:t-"+o+";"+t+"&cb?o-"+o+"/hl?bo:o-"+s+";"+i+";"+tt+";"+r+"&cl?bo:t-"+s+";"+t+"&cb?o-"+s+"/hl?"+i+";b:#EB7E2F;"+r+";bo:o-"+h+"&cl?bo:t-"+h+";"+t+"&cb?o-"+h+"/hl?"+i+";"+nt+";"+r+";bo:o-"+c+"&cl?bo:t-"+c+";"+t+"&cb?o-"+c+"/hl?"+i+";bo:gb-"+o+";"+t+"&cl?"+k+";"+t+","+t+"&cb?gb-"+o+"/hl?"+i+";bo:gb-"+s+";"+t+"&cl?"+v+";"+t+","+t+"&cb?gb-"+s+"/hl?"+i+";bo:gb-"+h+";"+t+"&cl?"+d+";"+t+","+t+"&cb?gb-"+h+"/hl?"+i+";bo:gb-"+c+";"+t+"&cl?"+g+";"+t+","+t+"&cb?gb-"+c+"/hl?"+i+";"+ft+";"+r+"&cl?b:#A6A6A6;"+t+","+k+";"+t+"/hl?"+i+";"+tt+";"+r+"&cl?b:#BDD7EE;"+t+","+v+";"+t+"/hl?"+i+";"+ht+";"+r+"&cl?b:#F8CBAD;"+t+","+d+";"+t+"/hl?"+i+";"+nt+";"+r+"&cl?b:#FFE699;"+t+","+g+";"+t+"/hl?"+i+";"+st+";"+t+";bo:gb-"+o+"&cl?b:#A7A7A7;"+t+","+st+";"+t+"&cb?gb-"+o+"/hl?"+i+";b:#DBECF6;"+t+";bo:gb-"+s+"&cl?b:#BED8F1;"+t+","+v+";"+t+"&cb?gb-"+s+"/hl?"+i+";"+et+";"+t+";bo:gb-"+h+"&cl?b:#F6CAAD;"+t+","+et+";"+t+"&cb?gb-"+h+"/hl?"+i+";"+ot+";"+t+";bo:gb-"+c+"&cl?b:#FDE18D;"+t+","+ot+";"+t+"&cb?gb-"+c+"/hl?"+i+";"+y+";"+r+"&cl?b:#404040;"+r+",b:#737373;"+r+"/hl?"+i+";"+y+";"+r+"&cl?b:#2F75B5;"+r+","+tt+";"+r+"/hl?"+i+";"+y+";"+r+"&cl?b:#C65911;"+r+","+ht+";"+r+"/hl?"+i+";"+y+";"+r+"&cl?b:#BF8F00;"+r+","+nt+";"+r,lt=e._getLocStr("FATHeaderText").split("/"),vt=e._getLocStr("FormatAsTableTitle").split("/"),yt=["Light1","Light2","Light3","Light5","Light8","Light9","Light10","Light12","Light15","Light16","Light17","Light19","Medium8","Medium9","Medium10","Medium12","Medium22","Medium23","Medium24","Medium26","Dark1","Dark2","Dark3","Dark5"],ct=ct.split("/");u<24;)l=l+e._renderDIV("e-formatastablecell",'<div class="e-ss-cellstyles-'+(u+1)+'" ><\/div>'),u===at[rt]&&(l+="<\/br>",rt++),u++;for(u=0,l=l.split("<\/br>");u<lt.length*2;)ut+=e._renderDIV(u%2==0?"e-formatastableheader":"e-formatastablecontent",u%2==0?lt[u/2]:l[0]),u%2!=0&&l.shift(),u++;for(f=document.getElementById(e._id+"_formatastable"),f.innerHTML=ut,f=n(f),a=f.find(".e-formatastablecell"),u=0,it=a.length;u<it;)n(a[u]).attr("id","Table Style "+yt[u]),n(a[u]).attr("title","Table Style "+vt[u]),u++;return e.XLFormat&&(e.XLFormat._formatAsTableStyle=e._FATStyles.TableStyleLight1),f.find(".e-formatastableheader:eq(0)").append("<span id ='"+e._id+"_formatastable_back' class = 'e-formatastable-back e-icon e-ss-leftarrow'/>"),f.data("ejMenu").model.open=function(){f.scrollTop(0)},f},_renderFATNameDlg:function(){var r,i=this.XLObj,u=i._getLocStr("FATNameDlgText").split("/"),f={showRoundedCorner:!0,width:"27%",click:n.proxy(this._fatNameDlgBtnClick,this)};r="<div id="+i._id+'_fatnamedlg><div class="e-dlg-fields e-dlgctndiv e-ss-nmdlg"><table cellspacing="0" cellpadding="0"><tr><td>'+u[0]+'<\/td><td><input id="'+i._id+'_fatname" class="ejinputtext" /><\/td><\/tr><tr class="e-dlgtd-fields"><td><\/td><td><input type="checkbox" id="'+i._id+'_fatheader" style="background-color:#ffffff"/> <label for="'+i._id+'_fatheader" class="e-ss-fathdr">'+u[1]+'<\/label><\/td><\/tr><\/table><\/div><div class="e-dlg-btnfields"><div class="e-dlg-btnctnr"><button id='+i._id+"_fatnamedlgok>"+i._getLocStr("Ok")+"<\/button><button id="+i._id+"_fatnamedlgcancel>"+i._getLocStr("Cancel")+"<\/button><\/div><\/div><\/div>";i.element.append(r);n("#"+i._id+"_fatheader").ejCheckBox();n("#"+i._id+"_fatnamedlgok").ejButton(f);n("#"+i._id+"_fatnamedlgok").ejButton("option","cssClass","e-ss-okbtn");n("#"+i._id+"_fatnamedlgcancel").ejButton(f);n("#"+i._id+"_fatnamedlg").ejDialog({showOnInit:!1,width:"auto",showRoundedCorner:!0,title:i._getLocStr("FormatAsTable"),enableModal:!0,enableResize:!1,cssClass:"e-ss-dialog e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this)})},_renderChartNameDlg:function(){var r,i=this.XLObj,f=i._getLocStr("ChartTitleDlgText"),u={showRoundedCorner:!0,width:"23%",click:n.proxy(this._chartNameDlgBtnClick,this)};r="<div id="+i._id+'_chartnamedlg ><div class="e-dlg-fields e-dlgctndiv"><table cellpadding="0" cellspacing="0"><tr><td>'+f+'<\/td><td><input id="'+i._id+'_chartname" class="ejinputtext" /><\/td><\/tr><\/table><\/div><div class="e-dlg-btnfields"><div class="e-dlg-btnctnr"><button id='+i._id+"_chartnamedlgok >"+i._getLocStr("Ok")+"<\/button><button id="+i._id+"_chartnamedlgcancel>"+i._getLocStr("Cancel")+"<\/button><\/div><\/div>";i.element.append(r);n("#"+i._id+"_chartnamedlgok").ejButton(u);n("#"+i._id+"_chartnamedlgok").ejButton("option","cssClass","e-ss-okbtn");n("#"+i._id+"_chartnamedlgcancel").ejButton(u);n("#"+i._id+"_chartnamedlg").ejDialog({showOnInit:!1,width:"334px",minHeight:"auto",showRoundedCorner:!0,title:i._getLocStr("ChartTitle"),enableModal:!0,enableResize:!1,cssClass:"e-ss-dialog e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this)})},_renderFATResizeTableDlg:function(){var i=this.XLObj,r={showRoundedCorner:!0,width:"15%",click:n.proxy(this._fatResizeTableBtnClick,this)},u="<div id="+i._id+'_fatresizetabledlg ><div class="e-dlgctndiv"><table><tr><td>'+i._getLocStr("FATResizeTableText")+'<\/td><td style="width: 50%;"><input id="'+i._id+'_fatresizetablerange" class="ejinputtext" style="margin-left: 2px;"><\/td><\/tr><\/table><div class="e-dlg-fields">'+i._getLocStr("FATReizeTableNote")+'<\/div><\/div><div class="e-dlg-btnfields"><div class="e-dlg-btnctnr"><button id='+i._id+"_fatresizetabledlgok >"+i._getLocStr("Ok")+"<\/button><button id="+i._id+"_fatresizetabledlgcancel >"+i._getLocStr("Cancel")+"<\/button><\/div><\/div><\/div>";i.element.append(u);n("#"+i._id+"_fatresizetabledlgok").ejButton(r);n("#"+i._id+"_fatresizetabledlgok").ejButton("option","cssClass","e-ss-okbtn");n("#"+i._id+"_fatresizetabledlgcancel").ejButton(r);n("#"+i._id+"_fatresizetabledlg").ejDialog({showOnInit:!1,width:"494px",showRoundedCorner:!0,title:i._getLocStr("ResizeTable"),enableModal:!0,enableResize:!1,cssClass:"e-ss-dialog e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this)})},_fatResizeTableBtnClick:function(t){var r=this.XLObj,h,f=document.getElementById(r._id+"_fatresizetablerange").value,o=r.getActiveSheetIndex(),e,i=document.getElementById(r._id+"_tableid").value,u=r.getSheet(o).tableManager,c,s;e={sheetIndex:o,reqType:"format-table",action:"Design_Tools_ResizeTable",tableId:i};canclose=!0;t.model.text===r._getLocStr("Ok")&&(r._isvalidRange(f)?(f=f.indexOf(":")!=-1?r.getRangeIndices(f):[],h=this._validateResizeRange(f,u[i].range),h?r._showAlertDlg("Alert",h,"",500):(e.beforeRange=n.extend(!0,[],u[i].range),u[i].totalRow?(c=n("#"+r._id+"_Ribbon_Design_TableStyleOptions_TotalRow").data("ejCheckBox"),r._dupDetails=!0,c.option("checked",!1),u[i].range=[f[0],f[1],f[2]-1,f[3]]):u[i].range=f,this._isFilterSelect.isFiltered&&r.XLFilter._clearFilterTable(o,parseInt(i),!0),r.XLFormat._createTable(i,{format:u[i].format}),r.XLFilter._extendFilterRange(i,u[i].range),u[i].range[2]==f[2]-1&&(r._dupDetails=!0,c.option("checked",!0)),u[i].firstColumn&&(r._dupDetails=!0,s=r._getProperAlphaRange(o,u[i].range[0]+1,u[i].range[1],u[i].range[2],u[i].range[1]),r.XLFormat.format({style:{"font-weight":"bold"}},s),r._dupDetails=!1),u[i].lastColumn&&(r._dupDetails=!0,s=r._getProperAlphaRange(o,u[i].range[0]+1,u[i].range[3],u[i].range[2],u[i].range[3]),r.XLFormat.format({style:{"font-weight":"bold"}},s),r._dupDetails=!1),e.afterRange=f,e.format=u[i].format,e.formatName=u[i].formatName,e.header=n.extend(!0,{},r.model.sheets[o]._header),e.isFilter=u[i].isFilter,e.firstColumn=u[i].firstColumn,e.lastColumn=u[i].lastColumn,e.totalRow=u[i].totalRow,r.XLSelection.selectRange(u[i].range),r._completeAction(e),r._trigActionComplete(e))):(canclose=!1,r._showAlertDlg("Alert","InvalidReference","",375)));canclose&&n("#"+r._id+"_fatresizetabledlg").ejDialog("close")},_fatNameDlgBtnClick:function(t){var r,i=this.XLObj,u=i._id;n("#"+u+"_fatnamedlg").ejDialog("close");t.model.text===i._getLocStr("Ok")&&(r={header:n("#"+u+"_fatheader").ejCheckBox("checked"),name:document.getElementById(u+"_fatname").value,format:i.XLFormat._formatAsTableStyle.format},i.XLFormat._formatAsTableStyle.formatName&&(r.formatName=i.XLFormat._formatAsTableStyle.formatName),i.XLFormat.createTable(r))},_validateResizeRange:function(n,t){var i=this.XLObj;if(n.length){if(n[0]!=t[0]||n[1]!=t[1])return"ResizeAlert";if(n[3]!=t[3]||n[2]<t[2])return"ResizeRestrictAlert";if(n[2]>i.getSheet(i.getActiveSheetIndex()).rowCount)return"RangeNotCreated"}else return"InvalidReference"},_chartNameDlgBtnClick:function(t,i){var e,u,r=this.XLObj,h=r.getActiveSheetIndex(),s=r.getSheet(h).shapeMngr.chart[r.XLEdit.getPropertyValue(r.XLShape._picCellIdx.rowIndex,r.XLShape._picCellIdx.colIndex,"chart")[0]],f,o=r._id,c=document.getElementById(o+"_chart").value;if(e=n("#"+c).data("ejChart"),u={sheetIndex:h,reqType:"shape",shapeType:"chart",cid:c,rowIndex:r.XLShape._picCellIdx.rowIndex,colIndex:r.XLShape._picCellIdx.colIndex,prev:{},cur:{}},f=i||document.getElementById(o+"_chartname").value,t.model.text===r._getLocStr("Ok")){if(!f.length){r._showAlertDlg("Alert","InvalidTitle","InvalidChartTitleActn",375);return}switch(r._hasTitle){case"PX":e.option("primaryXAxis",{title:{text:f}});s.xAxis.title.text=f;u.action="PX";break;case"PY":e.option("primaryYAxis",{title:{text:f}});s.yAxis.title.text=f;u.action="PY";break;case"CT":e.option("title",{text:f});s.title.text=f;u.action="CT"}}u.prev.text=r._cOpt.prevText;r._hasTitle=="CT"&&(u.prev.align=r._cOpt.prevAlign,u.cur.align=r._cOpt.curAlign);u.cur.text=f;r._completeAction(u);r._trigActionComplete(u);r._cOpt={};document.getElementById(o+"_chartname").value="";n("#"+o+"_chartnamedlg").ejDialog("close")},_designTabUpdate:function(t,i){var r=this.XLObj;if(r.model.showRibbon&&!r._phoneMode){var u=r._id,e,o=n("#"+r._id+"_Ribbon").ejRibbon("instance"),f=r.getSheet(r.getActiveSheetIndex()).tableManager;o.showTab(r._getLocStr("Design"));this._isDesignTab&&!o._isCollapsed&&o.option({selectedItemIndex:this._getTabIndex("design")});document.getElementById(r._id+"_Ribbon_Design_Properties_TableName")&&(document.getElementById(r._id+"_Ribbon_Design_Properties_TableName").value=f[t].name);document.getElementById(r._id+"_tableid")&&(document.getElementById(r._id+"_tableid").value=t);this._isSetModel=!0;n("#"+u+"_Ribbon_Design_TableStyleOptions_TotalRow").data("ejCheckBox").option({checked:f[t].totalRow?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_FirstColumn").data("ejCheckBox").option({checked:f[t].firstColumn?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_LastColumn").data("ejCheckBox").option({checked:f[t].lastColumn?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_FilterColumn").data("ejCheckBox").option({enabled:r.model.allowFiltering?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_FilterColumn").data("ejCheckBox").option({checked:f[t].isFilter?!0:!1});this._isSetModel=!1;e=n("#"+r._id+"_Ribbon_Data_SortFilter_ClearFilter").data("ejButton");e&&this._changeClrFltrStatus(e,"button",i)}},_formatTabUpdate:function(){var t=this.XLObj;if(t.model.showRibbon&&!t._phoneMode){var i=n("#"+t._id+"_Ribbon").ejRibbon("instance"),r=t.element.find("#"+t._id+"_Ribbon_Format_Size_PictureHeight"),u=t.element.find("#"+t._id+"_Ribbon_Format_Size_PictureWidth");i.showTab(t._getLocStr("FORMAT"));t._shapeChange=!0;r.length&&r.ejNumericTextbox("option","value",t.element.find(".e-ss-activeimg").height());u&&u.ejNumericTextbox("option","value",t.element.find(".e-ss-activeimg").width());t.model.showRibbon&&!i._isCollapsed&&i.option({selectedItemIndex:t.XLRibbon._getTabIndex("format")});t._shapeChange=!1}},_analyzeTabUpdate:function(){var t=this.XLObj,r,i;if(!t.model.enablePivotTable)return!1;r=t.element.find("#"+t._id+"_Ribbon_Analyze_PivotTable_PivotTableName");i=n("#"+t._id+"_Ribbon").data("ejRibbon");r.length&&r.val(t.XLPivot.names[t._getContent(t.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id]);i.showTab(t._getLocStr("ANALYZE"));i._isCollapsed||i.option({selectedItemIndex:t.XLRibbon._getTabIndex("analyze")})},_chartDesignTabUpdate:function(t){var i=this.XLObj,u;if(i.model.showRibbon&&!i._phoneMode){var r=n("#"+i._id+"_Ribbon").data("ejRibbon"),o=t.get(0).id,s=t.get(0).offsetLeft,h=t.get(0).offsetTop,f=t.ejChart("model"),e=r.element.find("#"+i._id+"_Ribbon_ChartDesign_ChartThemes_ChartThemes");u=i._getIdxWithOffset(h,s,!0);i.XLShape._picCellIdx={rowIndex:u.rowIdx,colIndex:u.colIdx};r.showTab(i._getLocStr("CHARTDESIGN"));r._isCollapsed||r.option({selectedItemIndex:i.XLRibbon._getTabIndex("chartdesign")});document.getElementById(i._id+"_chart").value=o;this._isSetModel=!0;this._setShapeWidthHeight({height:f.size.height,width:f.size.width,shapeType:"chart"});e.length&&e.ejDropDownList("setSelectedValue",t.ejChart("option","theme"));this._isSetModel=!1;i.model.allowFormulaBar&&i.updateFormulaBar()}},_setShapeWidthHeight:function(t){var i=this.XLObj,r,u;t.shapeType=="chart"?(r=n("#"+i._id+"_Ribbon_ChartDesign_Size_ChartWidth").data("ejNumericTextbox"),u=n("#"+i._id+"_Ribbon_ChartDesign_Size_ChartHeight").data("ejNumericTextbox")):(r=n("#"+i._id+"_Ribbon_Format_Size_PictureWidth").data("ejNumericTextbox"),u=n("#"+i._id+"_Ribbon_Format_Size_PictureHeight").data("ejNumericTextbox"));i._shapeChange=!0;i.model.showRibbon&&(u.option({value:t.height}),r.option({value:t.width}));i._shapeChange=!1},changeDimension:function(t){var u=this.XLObj,h=u.getActiveSheetIndex(),o,c,e,s,f,i={sheetIndex:h,reqType:"shape",rowIndex:u.XLShape._picCellIdx.rowIndex,colIndex:u.XLShape._picCellIdx.colIndex,actionType:"shapechange"},r;t.shapeType=="picture"?(o=u.getSheetElement(h).find(".e-ss-activeimg"),f=o.length?o[0]:n("#"+t.id),i.prev={width:f.width(),height:f.height()},c=n("#"+t.id),e={width:t.width,height:t.height},c.css(e),i.action="picturesize",i.shapeType="picture",i.cur={width:f.width(),height:f.height()}):(r=n("#"+t.id).data("ejChart"),i.prev={width:r.model.size.width,height:r.model.size.height},e={width:t.width.toString(),height:t.height.toString()},s=r.element,r.option("size",e),s[0].style.height=t.height+"px",s[0].style.width=t.width+"px",i.action="width",i.shapeType="chart",i.cid=t.id,i.cur={width:r.model.size.width,height:r.model.size.height});u._completeAction(i);u._trigActionComplete(i);this._setShapeWidthHeight(t)},_toggleDesignTab:function(i){var r=this.XLObj,f,u,e=r.getActiveSheetIndex();r.model.showRibbon&&(u=n("#"+r._id+"_Ribbon").data("ejRibbon"),(t.isNullOrUndefined(r.XLEdit.getPropertyValue(i.rowIndex,i.colIndex,"tableName"))||r.getSheetElement(e).find(".e-ss-activeimg").length)&&(u.hideTab(r._getLocStr("Design")),u._isCollapsed||u.option({selectedItemIndex:1})));f=n("#"+r._id+"_Ribbon_Data_SortFilter_ClearFilter").data("ejButton");this._changeClrFltrStatus(f,"button",i)},_toggleChartDesignTab:function(){this._toggleContextualTab(this.XLObj._getLocStr("CHARTDESIGN"))},_toggleFormatTab:function(){this._toggleContextualTab(this.XLObj._getLocStr("FORMAT"))},_toggleAnalyzeTab:function(){this._toggleContextualTab(this.XLObj._getLocStr("ANALYZE"))},_toggleContextualTab:function(t){var r=this.XLObj,i;r.model.showRibbon&&(i=n("#"+r._id+"_Ribbon").data("ejRibbon"),i.hideTab(t),i._isCollapsed||i.option({selectedItemIndex:1}))},_getTabIndex:function(t){if(this.XLObj.model.showRibbon){for(var u=n("#"+this.XLObj._id+"_Ribbon").ejRibbon("model"),r=u.tabs,f=u.contextualTabs,i=0;i<f.length;)r=r.concat(f[i].tabs),i++;for(i=r.length;i--;)if(r[i].id===t)return++i}},_getFormatAsTableInput:function(n){var h=this.XLObj,t,r,e,i,o=0,u=0,c=[],s={hl:"headerLayout",cl:"contentLayout",hb:"headerBorder",cb:"contentBorder"},f={};for(n=n.split("&");o<n.length;){if(e=n[o].split("?"),t=e[0],r=e[1],t==="hl")f[s[t]]=h._getStyleAsJSON(r,!0);else if(t==="cl"){for(i=r.split(",");u<i.length;)c.push(i[u].length?h._getStyleAsJSON(i[u],!0):{}),u++;f[s[t]]=c}else t==="cb"&&(i=r.split("-"),f[s[t]]={border:this._getBorderObj(i[0],i[1])});o++}return f},_getBorderObj:function(n,t){var r,i={t:{top:""},r:{right:""},b:{bottom:""},l:{left:""},o:{top:"",right:"",bottom:"",left:""},tb:{top:"",bottom:""},gb:{top:"",right:"",bottom:"",left:""}};for(r in i[n])i[n][r]=t;return n==="gb"&&(i[n].isGridBorder=!0),i[n]},_renderCellStyles:function(){for(var s,r,t=0,e=4,o=[],h="e-cellstylecell ",i="",u=this.XLObj,f=u._dataContainer.hashCode,l=u._getLocStr("CellStyleHeaderText").split("/"),v=u._getLocStr("CellStyleGBN").split("/"),y=[f[0],f[1],f[2],f[3]],p=u._getLocStr("CellStyleTH").split("/"),a=f.slice(4,6),w=u._getLocStr("CellsStyleTCS").split("/"),b=f.slice(6,18),c;t<e;)r=v[t],i=i+u._renderDIV(h+y[t],r,r),t++;for(o.push(i),i="",t=0,e=2;t<e;)r=p[t],i=t===1?i+'<div class="'+h+a[t]+'" style="font-size: 11pt;" title="'+r+'">'+r+"<\/div>":i+u._renderDIV(h+a[t],r,r),t++;for(o.push(i),i="",t=0,e=12;t<e;)r=w[t],i=i+u._renderDIV(h+b[t],r,r),t++;for(o.push(i),i="",t=0;t<l.length*2;)s=t%2,i=i+u._renderDIV(s===0?"e-cellstyleheader":"e-cellstylecontent",s===0?l[t/2]:o[0]),s!=0&&o.shift(),t++;return c=n("<div id="+u._id+'_cellstyles class="e-spreadsheet e-cellstyles" style="display:none;">'+i+"<\/div>"),c.find(".e-cellstyleheader:eq(0)").append("<span id ='"+u._id+"_cellstyles_back' class = 'e-cellstyles-back e-icon e-ss-leftarrow'/>"),c},_homeTabTrgtElem:function(){var r=this.XLObj,u=r._id,n=r.element,i=u+"_Ribbon_",f=i+"Home_Font_";n.append(t.buildTag("input","",{display:"none"},{id:f+"FillColor",type:"text"}));n.append(t.buildTag("input","",{display:"none"},{id:f+"FontColor",type:"text"}));n.append(t.buildTag("input","",{display:"none"},{id:f+"BorderColor",type:"text"}));n.append(t.buildTag("div.e-spreadsheet e-formatastable","",{display:"none"},{id:r._id+"_formatastable"}));n.append(this._renderCellStyles());n.append(t.buildTag("ul","",{display:"none"},{id:u+"_Ribbon_Merge"}));n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"Paste"}));n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"Border"}));n.append(t.buildTag("ul.e-spreadsheet","",{display:"none"},{id:u+"_CFormat"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"Clear"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"SortFilter"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"AutoSum"}))},_pageTabTrgtElem:function(i){var f=this.XLObj,a=f._id,p=f.element,e,o,s,h,c,l,v,y,r=a+"_Ribbon_",u=r+"PageLayout_Show_";i=f.isUndefined(i)?n("#"+a+"_Ribbon").data("ejRibbon").element:i;p.append(t.buildTag("ul","",{display:"none"},{id:r+"PageSize"}));e=t.buildTag("div","",{width:"140",height:"80",display:"none"},{id:r+"pagesetup"});o=t.buildTag("div","",{width:"70",height:"80",float:"left"},{id:r+"pagesetupleft"});s=t.buildTag("table");tr=t.buildTag("tr");tr1=t.buildTag("tr");h=t.buildTag("td","",{padding:"6px 0px 6px 6px"});c=t.buildTag("td","",{padding:"6px 0px 6px 6px"});l=t.buildTag("td","",{padding:"6px 0px 6px 6px"});td12=t.buildTag("td","",{padding:"6px 0px 6px 6px"});v=t.buildTag("label.e-viewlinlbl","",{width:"40"},{id:r+"pagesetup_viewgrdlnlbl","for":u+"Gridlines"});y=t.buildTag("label.e-viewhdrlbl","",{width:"40",display:"visible"},{id:r+"pagesetup_viewhdrlbl","for":u+"Headings"});headerVchk=t.buildTag("input","","",{id:u+"Headings"});gridVchk=t.buildTag("input","","",{id:u+"Gridlines"});h.append(gridVchk);c.append(v);tr.append(h).append(c);l.append(headerVchk);td12.append(y);tr1.append(l).append(td12);s.append(tr1).append(tr);o.append(s);e.append(o);i.append(e)},_othersTabTrgtElem:function(){var r=this.XLObj,u=r._id,n=r.element,i=u+"_Ribbon_";n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"FPane"}));n.append(t.buildTag("ul","",{width:"auto"},{id:i+"Ins"}));n.append(t.buildTag("ul","",{width:"auto"},{id:i+"Del"}));n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"FindRep"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"CalcOpt"}))},_dataTabTrgtElem:function(){var n=this.XLObj;n.element.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:n._id+"_Ribbon_Validation"}))},_formatTabTrgtElem:function(){var n=this.XLObj;n.element.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:n._id+"_Ribbon_ResetPic"}))},_onBeforeTabClick:function(n){this.XLObj.model.ribbonSettings.enableOnDemand&&this._createTrgtElement(n.activeHeader.innerText)},_onTabClick:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r=t.activeHeader.innerText;i._trigger("beforeTabClick",t);t.prevActiveIndex!==-1&&i.model.allowComments&&i.model.allowEditing&&(i.XLEdit._isEdit||i.XLComment._isCommentEdit||i._isSheetRename||!i.getSheet(i.getActiveSheetIndex()).isSheetProtected)&&!this._isDirtySelect&&this._enableRibbonIcons(t.activeIndex);i.model.ribbonSettings.enableOnDemand&&this._createTabControls(r);i._trigger("tabClick",t)},_onCollapse:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r;(this._ribbonState||t.isMobile)&&(i._phoneMode||(this._ribbonState=!1),t.action="toggleBtn",i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t),i.model._isActPanelVisible&&i._refreshActivationPanel(),i.getSheet(i.getActiveSheetIndex())._isRibCollapsed=!0)},_onTabSelect:function(t){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()),f,u;i.model.showRibbon&&(i.XLEdit._isEdit||i.model.allowComments&&i.XLComment._isCommentEdit||i._isSheetRename||r.isSheetProtected?this._disableRibbonIcons():this._enableRibbonIcons(),this._updateRibbonIcons(),i.model.isReadOnly&&i._readOnly(),i._phoneMode&&(f=n.extend(!0,{},i.model.scrollSettings),this._ribbonState=!0,t.action="toggleBtn",i.model._isActPanelVisible=this._isPanelVisible,i._isAutoWHMode?(this._refreshBackstageHeight(),u=i._getElementDimension(),i.element.css({height:u.height,width:u.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),f,t)));i.XLEdit.getPropertyValue(r._activeCell.rowIndex,r._activeCell.colIndex,"tableName")&&(this._isDesignTab=t.activeIndex==this._getTabIndex("design")||t.activeIndex==this._getTabIndex("format")||t.activeIndex==this._getTabIndex("chartdesign"));i._trigger("tabSelect",t)},_valDTypeOnChange:function(t){var i=this.XLObj;n.validator&&n("#"+i._id+"_Form_ValDialog").validate().resetForm();t.value==="Between"||t.value==="NotBetween"?(n("#"+i._id+"_Ribbon_lbMax").show(),n("#"+i._id+"_Ribbon_btnMax").show(),n("#"+i._id+"_Ribbon_lbMin").text(i._getLocStr("NumberStart"))):(n("#"+i._id+"_Ribbon_lbMax").hide(),n("#"+i._id+"_Ribbon_btnMax").hide(),n("#"+i._id+"_Ribbon_lbMin").text(i._getLocStr("DataValue")));this._dialogValidate("_ValDialog")},_valTypeOnChange:function(t){var i=this.XLObj,r=n("#"+i._id+"_Ribbon_ddAction").data("ejDropDownList");r.enable();t.value==="List"?(n("#"+i._id+"_Ribbon_lbMax").hide(),n("#"+i._id+"_Ribbon_btnMax").hide(),r.disable()):(r._selectedValue==="Between"||r._selectedValue==="NotBetween")&&(n("#"+i._id+"_Ribbon_lbMax").show(),n("#"+i._id+"_Ribbon_btnMax").show());n("#"+i._id+"_Ribbon_lbMin").text(i._getLocStr(t.selectedText+"Start"));n("#"+i._id+"_Ribbon_lbMax").text(i._getLocStr(t.selectedText+"End"));this._dialogValidate("_ValDialog")},_valDlgBtnClick:function(t){var i=this.XLObj,f,e;if(t==="ok"&&n.validator&&n("#"+i._id+"_Form_ValDialog").valid()){var s=n("#"+i._id+"_Ribbon_blank").data("ejCheckBox"),h=n("#"+i._id+"_Ribbon_freetext").data("ejCheckBox").isChecked(),o=n("#"+i._id+"_Ribbon_ddType").data("ejDropDownList"),v=n("#"+i._id+"_Ribbon_ddAction").data("ejDropDownList");if(o._selectedValue==="List"){var r=n("#"+i._id+"_Ribbon_btnMin").val(),a=r,c,u,f=n("#"+i._id+"_alertdlg"),l;if(r.indexOf("=")>-1){if(r=r.split("=")[1],r.indexOf("!")>-1&&(c=r.split("!"),e=i._getSheetIndexByName(c[0]),r=c[1]),e===!1){i._renderAlertDlgContent(f,"Alert",i._getLocStr("ListAlert"),"ListValidation");i._alertDialog.element.ejDialog("open")&&f.focus();return}if(r.indexOf("$")>-1&&(r=r.split("$").join("")),r.indexOf(":")<0&&(r=r+":"+r),e=i.isUndefined(e)?i.getActiveSheetIndex():e,l=i.getSheet(e),u=i.getRangeIndices(r),isNaN(u[0])||isNaN(u[1])||isNaN(u[2])||isNaN(u[3])||l.colCount<=u[3]||l.rowCount<=u[2]){i._renderAlertDlgContent(f,"Alert",i._getLocStr("ListAlert"),"ListValidation");i._alertDialog.element.ejDialog("open")&&f.focus();return}if(u[2]===u[0]||u[3]===u[1])i.XLValidate.applyDVRules(null,["list",a],this._types[o.selectedIndexValue].value,s.isChecked(),h);else{i._renderAlertDlgContent(f,"Alert",i._getLocStr("ListValAlert"),"ListValidation");i._alertDialog.element.ejDialog("open")&&f.focus();return}}else i.XLValidate.applyDVRules(null,["list",a],this._types[o.selectedIndexValue].value,s.isChecked(),h)}else i.XLValidate.applyDVRules(null,[this._actions[v.selectedIndexValue].value,n("#"+i._id+"_Ribbon_btnMin").val(),n("#"+i._id+"_Ribbon_btnMax").val()],this._types[o.selectedIndexValue].value,s.isChecked(),h);i._setddlCell()}else n.validator||(t="cancel");(t==="cancel"||t==="ok"&&n.validator&&n("#"+i._id+"_Form_ValDialog").valid())&&(n("#"+i._id+"_Ribbon_ddType").data("ejDropDownList").option({selectedItemIndex:0}),n("#"+i._id+"_Ribbon_ddAction").data("ejDropDownList").option({selectedItemIndex:6}),n("#"+i._id+"_Ribbon_blank").data("ejCheckBox").option({checked:!0}),n("#"+i._id+"_Ribbon_freetext").data("ejCheckBox").option({checked:!0}),n("#"+i._id+"_Ribbon_btnMin").val(""),n("#"+i._id+"_Ribbon_btnMax").val(""),n("#"+i._id+"_ValDialog").ejDialog("close"),i.setSheetFocus())},_renderValDialog:function(){var i=this.XLObj,h,e,v,o,c,u,a,y,p;if(n("#"+i._id+"_Ribbon_MainDiv").length<1){h=t.buildTag("div.e-dlgctndiv","",{},{height:"100%"});e=t.buildTag("div.e-dlg-fields","",{},{id:i._id+"_Ribbon_MainDiv"});n("#"+i._id+"_Validation").append(h);n("#"+i._id+"_Validation").append(e);o=t.buildTag("label.e-dlg-fields",i._getLocStr("Allow"));e.append(o);c=t.buildTag("input.e-"+i._id+"-ddl","","",{id:i._id+"_Ribbon_ddType",type:"text"});e.append(c);c.ejDropDownList({dataSource:this._types,fields:{id:"Types",text:"text",value:"text"},selectedItemIndex:1,cssClass:"e-"+i._id+"-ddl",width:"100%",change:n.proxy(this._valTypeOnChange,this)});var s=t.buildTag("input#"+i._id+"_Ribbon_blank"),l=t.buildTag("label",i._getLocStr("IgnoreBlank"),{},{"for":i._id+"_Ribbon_blank"}),f=t.buildTag("table"),u=t.buildTag("tr"),r=t.buildTag("td","",{},{width:30});r.append(s);u.append(r);r=t.buildTag("td");r.append(l);u.append(r);f.append(u);s.ejCheckBox();s=t.buildTag("input#"+i._id+"_Ribbon_freetext");l=t.buildTag("label#"+i._id+"_Ribbon_lblfreetext",i._getLocStr("FreeText"),{},{"for":i._id+"_Ribbon_lblfreetext"});u=t.buildTag("tr#"+i._id+"_val_freetext");r=t.buildTag("td","",{},{width:30});r.append(s);u.append(r);r=t.buildTag("td");r.append(l);u.append(r);f.append(u);e.append(f);s.ejCheckBox({checked:!0});o=t.buildTag("label.e-dlg-fields").text(i._getLocStr("Data"));e.append(o);a=t.buildTag("input.e-"+i._id+"-ddl","","",{id:i._id+"_Ribbon_ddAction",type:"text"});e.append(a);a.ejDropDownList({dataSource:this._actions,fields:{id:"Types",text:"text",value:"value"},selectedItemIndex:6,cssClass:"e-"+i._id+"-ddl",width:"100%",change:n.proxy(this._valDTypeOnChange,this)});v=t.buildTag("div.e-dlgctndiv e-dlg-fields","",{},{id:i._id+"_Ribbon_SubDiv"});f=t.buildTag("table");u=t.buildTag("tr");r=t.buildTag("td");o=t.buildTag("label.e-dlg-fields","","",{id:i._id+"_Ribbon_lbMin"}).text(i._getLocStr("NumberStart"));f.append(u.append(r.append(o)));u=t.buildTag("tr");r=t.buildTag("td");y=t.buildTag("input.ejinputtext","",{width:"100%"},{id:i._id+"_Ribbon_btnMin",type:"text",name:i._id+"_valMin"});f.append(u.append(r.append(y)));u=t.buildTag("tr");r=t.buildTag("td");o=t.buildTag("label.e-dlg-fields","","",{id:i._id+"_Ribbon_lbMax"}).text(i._getLocStr("NumberEnd"));f.append(u.append(r.append(o)));u=t.buildTag("tr");r=t.buildTag("td");p=t.buildTag("input.ejinputtext","",{width:"100%"},{id:i._id+"_Ribbon_btnMax",type:"text",name:i._id+"_valMax"});f.append(u.append(r.append(p)));h.append(e,v.append(f));n("#"+i._id+"_Ribbon_SubDiv").wrapInner('<form id="'+i._id+'_Form_ValDialog" onsubmit="return false"><\/form>')}},_dialogValidate:function(t,i){var f=this.XLObj,e=f._id,l,tt=n("#"+e+"_Form"+t),o,r,a,v,s,y,p,u,w,b,h,k=!0,c,d,g,nt;if(n.validator){tt.validate({errorElement:"div",wrapper:"div",errorPlacement:function(n,t){n.insertAfter(t.closest("input"));n.children().addClass("e-dlg-field-validation-error");n.css({position:"relative"});n.offset({left:t.offset().left,top:t.offset().top+19})},onfocusout:function(n){this.element(n)}});c=n("#"+e+"_Ribbon_ddAction").ejDropDownList("getValue");switch(t){case"_ValDialog":l=n("#"+e+"_Ribbon_ddType").data("ejDropDownList");o=l.getSelectedValue();break;case"_CFDialog":o=i===e+"_CreateRule"?"formulaRule":i.charAt(0).toUpperCase()+i.slice(1).toLowerCase();break;case"_GoToDiv":o="cellAddr";break;case"_Ribbon_PvtRange":case"_Ribbon_PvtLocation":case"_Ribbon_cellAddress":o="cellAddr";break;case"_Ribbon_webAddress":o="webAddr"}for(n("#"+e+"_Form"+t).validate().resetForm(),u=[],p=n("#"+e+"_Form"+t).find("input").length,y={required:!0,date:!0,messages:{date:f._getLocStr("DateValidationMsg"),required:f._getLocStr("RequiredField")}},v={required:!0,celladdr:!0},w={required:!0,numberVal:!0},g={required:!0,number:!0,messages:{required:f._getLocStr("RequiredField"),number:f._getLocStr("NumberValidationMsg")}},b={required:!0,time:!0},s={required:!0},d={required:!0,betweentype:!0},nt={required:!0,formularule:!0},n.validator.addMethod("time",function(n){return n===""||n.match(/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?(\s(AM|am|PM|pm))?$/)},f._getLocStr("TimeValidationMsg")),n.validator.addMethod("date",function(n,t){var i=n.split("/");return this.optional(t)||!/Invalid|NaN/.test(new Date(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())?n:i[1]+"/"+i[0]+"/"+i[2]))},f._getLocStr("DateValidationMsg")),n.validator.addMethod("celladdr",function(t,i){var f,o=n(i).data("parentID"),r=n("#"+o).data("ejSpreadsheet"),u,e;return n("#"+r._id+"_Ribbon_sheentName").length&&(u=n("#"+r._id+"_Ribbon_sheentName").ejTreeView("option","selectedNode")),(r.isUndefined(u)||u<0)&&(u=r.getActiveSheetIndex()),t.indexOf("=")>-1&&(t=t.split("=")[1]),t.indexOf("!")>-1&&(h=t.split("!"),u=r._getSheetIndexByName(h[0]),t=h[1]),u<1&&(k=!1),e=r.getSheet(u),t.indexOf("$")>-1&&(t=t.split("$").join("")),f=r.getRangeIndices(t),f=e.colCount<=f[3]||e.rowCount<=f[2]?null:t,(t.match(/^(?:\bxfXF[a-zA-D]|xX[a-eA-E][a-zA-Z]|[a-wA-W][a-zA-Z]{2}|[a-zA-Z]{2}|[a-zA-Z])\$?(?:104857[0-6]|10485[0-6]\d|1048[0-4]\d{2}|104[0-7]\d{3}|10[0-3]\d{4}|[1-9]\d{1,5}|[1-9]):(?:\bxfXF[a-zA-D]|xX[a-eA-E][a-zA-Z]|[a-wA-W][a-zA-Z]{2}|[a-zA-Z]{2}|[a-zA-Z])\$?(?:104857[0-6]|10485[0-6]\d|1048[0-4]\d{2}|104[0-7]\d{3}|10[0-3]\d{4}|[1-9]\d{1,5}|[1-9])$/)||t.match(/^(?:\bxfXF[a-zA-D]|xX[a-eA-E][a-zA-Z]|[a-wA-W][a-zA-Z]{2}|[a-zA-Z]{2}|[a-zA-Z])\$?(?:104857[0-6]|10485[0-6]\d|1048[0-4]\d{2}|104[0-7]\d{3}|10[0-3]\d{4}|[1-9]\d{1,5}|[1-9])$/)&&k)&&f},f._getLocStr("CellAddrsValidationMsg")),n.validator.addMethod("betweentype",function(t,i){var e=i.id.split("_")[0],f=n("#"+i.id.split("_")[0]+"_Ribbon_ddType").ejDropDownList("getSelectedValue"),r=n("#"+e+"_Ribbon_btnMin").val(),u=n("#"+i.id.split("_")[0]+"_Ribbon_btnMax").val();return(r===""||u===""||parseFloat(r)>parseFloat(u))&&(t=null),f==="Date"&&Date.parse(r)>Date.parse(u)&&(t=null),f==="Time"&&new Date("01/01/1990 "+r).getTime()>new Date("01/01/1990 "+u).getTime()&&(t=null),t},f._getLocStr("BetweenAlert")),n.validator.addMethod("numberVal",function(t){if(n.isNumeric(t))return parseFloat(t)%1!=0&&(t=null),n.validator.messages.numberVal=f._getLocStr("NumberValMsg"),t;n.validator.messages.numberVal=f._getLocStr("NumberAlertMsg")},n.validator.messages.numberVal),n.validator.addMethod("formularule",function(n){return n===""||n.startsWith("=")&&n.indexOf("!")<0},f._getLocStr("FormulaRuleMsg")),r=0,a=p;r<a;r++){u[r]=n("#"+e+"_Form"+t).find("input")[r].id;switch(o){case"Date":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",y);break;case"Time":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",b);break;case"Number":case"TextLength":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",w);break;case"Decimal":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",g);break;case"List":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",s);break;case"cellAddr":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",v);break;case"webAddr":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",s);break;case"formulaRule":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",nt)}o!=="List"&&(c==="Between"||c==="NotBetween")&&n("#"+e+"_Ribbon_btnMax").rules("add",d)}}},_renderCFDialog:function(i){var u,o,f,e,s,r=this.XLObj,h;s=n("#"+r._id+"_CFDialog").data("ejDialog");i.ID===r._id+"_CreateRule"?s.option({title:r._getLocStr("NewRule")}):s.option({title:r._getLocStr(this._cFormatData[i.ID][0])});n("#"+r._id+"_Ribbon_CFSubDiv").length<1&&(o=t.buildTag("div.e-dlg-fields","",{},{id:r._id+"_Ribbon_CFSubDiv"}),f=t.buildTag("label.e-dlg-fields").text(r._getLocStr("With")),o.append(f),h=t.buildTag("input.e-"+r._id+"-ddl","",{},{id:r._id+"_Ribbon_ddStyle",type:"text"}),o.append(h),h.ejDropDownList({dataSource:this._styles,fields:{id:"Types",text:"text",value:"value"},selectedItemIndex:0,cssClass:"e-"+r._id+"-ddl",width:"100%",change:n.proxy(this._ddOnChange,this)}),n("#"+r._id+"_CondFormat").append(o),n("#"+r._id+"_CondFormat").addClass("e-cfdiv"));n("#"+r._id+"_Ribbon_CFMainDiv").length>0&&n("#"+r._id+"_Ribbon_CFMainDiv").remove();u=t.buildTag("div.e-dlg-fields","","",{id:r._id+"_Ribbon_CFMainDiv"});n("#"+r._id+"_CondFormat").prepend(u);i.ID=="between"&&(e=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_input2",type:"text"}),u.prepend(e),f=t.buildTag("label.e-dlg-fields").text(r._getLocStr("And")).css("display","table"),u.prepend(f));e=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_input1",type:"text"});u.prepend(e);f=i.ID===r._id+"_CreateRule"?t.buildTag("label.e-dlg-fields").text(r._getLocStr("NewRuleLabelContent")):t.buildTag("label.e-dlg-fields").text(r._getLocStr(this._cFormatData[i.ID][1]));u.prepend(f);(i.ID==="aboveavg"||i.ID==="belowavg")&&e.hide();n("#"+r._id+"_Ribbon_CFMainDiv").wrapInner('<form id="'+r._id+'_Form_CFDialog" onsubmit="return false"><\/form>');this._dialogValidate("_CFDialog",i.ID)},_dlgCFOk:function(){var t=this.XLObj,i,r;n("#"+t._id+"_Form_CFDialog").valid()&&(i=n("#"+t._id+"_Ribbon_ddStyle").data("ejDropDownList"),r=t.XLRibbon._currentCFormat===t._id+"_CreateRule"?"formularule":t.XLRibbon._currentCFormat,t.XLCFormat._cFormat(r,n("#"+t._id+"_Ribbon_input1").val(),n("#"+t._id+"_Ribbon_input2").val(),i.getSelectedValue()),n("#"+t._id+"_CFDialog").ejDialog("close"),t.setSheetFocus())},_dlgCFCancel:function(){var t=this.XLObj;n("#"+t._id+"_Form_CFDialog").validate().resetForm();n("#"+t._id+"_CFDialog").ejDialog("close");t.setSheetFocus()},_sheetData:function(){var r=this.XLObj,u=[],t=[],n,f,i=r._getSheetNames();for(t[0]={id:1,name:r._getLocStr("SheetReference"),hasChild:!0,expanded:!0},n=1,f=i.length;n<=f;n++)i[n-1].isVisible&&(u[n]=i[n-1].text,t[n]={id:n+1,pid:1,name:u[n],hasChild:!0,expanded:!0});return t},_renderHLDialog:function(){var i=this.XLObj,c,u,f,s,h,o,e,r,l;n("#"+i._id+"_Ribbon_WebDiv").length<1&&(c=t.buildTag("div.e-dlgctndiv","",{},{id:i._id+"_Ribbon_WebDiv"}),e=t.buildTag("table","",{},{cellpadding:0,cellspacing:0}),r=t.buildTag("tr"),$td=t.buildTag("td","",{width:"32%"}),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("HyperlinkText")),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_findText",type:"text"}),r.append($td.append(f)),r=t.buildTag("tr.e-dlgtd-fields"),$td=t.buildTag("td"),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("WebAddress"),"",{id:i._id+"_Ribbon_address"}),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_webAddress",type:"text"}),r.append($td.append(f)),n("#"+i._id+"_Web").append(c.append(e)),s=t.buildTag("div.e-dlgctndiv","","",{id:i._id+"_Ribbon_DocDiv"}),l=t.buildTag("div.e-dlg-fields"),e=t.buildTag("table"),r=t.buildTag("tr"),$td=t.buildTag("td","",{width:"32%"}),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("HyperlinkText")),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_cellText",type:"text"}),r.append($td.append(f)),r=t.buildTag("tr.e-dlgtd-fields"),$td=t.buildTag("td"),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("CellAddress")),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_cellAddress",type:"text"}),f.data("parentID",i._id),r.append($td.append(f)),o=t.buildTag("div.e-dlg-fields","","",{id:i._id+"_Ribbon_Sheet"}),s.append(l.append(e),o),u=t.buildTag("label",i._getLocStr("SheetIndex")),o.append(u),h=t.buildTag("div","","",{id:i._id+"_Ribbon_sheentName"}),o.append(h),h.ejTreeView({fields:{id:"id",parentId:"pid",text:"name",hasChild:"hasChild",dataSource:this._sheetData(),expanded:"expanded"},nodeSelect:n.proxy(this._sheetSelect,i),height:90}),n("#"+i._id+"_Doc").append(s),n("#"+i._id+"_Ribbon_cellAddress").wrap("<form id='"+i._id+"_Form_Ribbon_cellAddress' onsubmit='return false'><\/form>"),this._dialogValidate("_Ribbon_cellAddress"),n("#"+i._id+"_Ribbon_webAddress").wrap("<form id='"+i._id+"_Form_Ribbon_webAddress' onsubmit='return false'><\/form>"),this._dialogValidate("_Ribbon_webAddress"))},_sheetSelect:function(t){var i,u,f=this._getSheetNames(),r=n("#"+this._id+"_Ribbon_cellAddress"),e=n("#"+this._id+"hlDialog_OkBtn").data("ejButton"),o=n("#"+this._id+"_Ribbon_cellText");if(t.model.selectedNode>0)for(r.attr("disabled",!1),e.enable(),r.focus().setInputPos(1),i=0,u=f.length;i<u;i++)f[i].text===o.val().split("!")[0]&&o.val(t.value+"!"+r.val());else r.attr("disabled",!0),e.disable()},_dlgHLOk:function(){var t=this.XLObj;n("#"+t._id+"_Form_Ribbon_cellAddress").valid()&&n("#"+t._id+"_Form_Ribbon_webAddress").valid()&&(this.XLObj._dlgHLClick=!0,t._setLink(),this._dlgHLCancel())},_dlgHLCancel:function(){n("#"+this.XLObj._id+"_HLDialog").ejDialog("close")},_renderFRDialog:function(){var h,f,c,l,s,e,a,r=this.XLObj,o,u,i;n("#"+r._id+"_Ribbon_FindDiv").length<1&&(h=t.buildTag("div.e-dlgctndiv e-ss-finddiv","",{height:"auto"},{id:r._id+"_Ribbon_FindDiv"}),n("#"+r._id+"_Find").append(h),o=t.buildTag("table"),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td","",{width:"30%"}),o.append(u.append(i)),f=t.buildTag("label",r._getLocStr("FindLabel"),"",{id:r._id+"_Ribbon_lbFind"}),i.append(f),i=t.buildTag("td"),c=t.buildTag("input.ejinputtext","","",{id:r._id+"_Ribbon_textFind",type:"text"}),i.append(c),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),f=t.buildTag("label",r._getLocStr("ReplaceLabel"),"",{id:r._id+"_Ribbon_lbReplace"}),i.append(f),i=t.buildTag("td"),l=t.buildTag("input.ejinputtext","","",{id:r._id+"_Ribbon_textReplace",type:"text"}),i.append(l),u.append(i),h.append(o),n("#"+r._id+"_Ribbon_lbReplace").hide(),n("#"+r._id+"_Ribbon_textReplace").hide(),a=t.buildTag("div.e-dlgctndiv e-ss-stgdiv","",{},{id:r._id+"_Ribbon_SettingsDiv"}),o=t.buildTag("table"),u=t.buildTag("tr"),i=t.buildTag("td","",{width:"50%"}),o.append(u.append(i)),s=t.buildTag("input#"+r._id+"_Ribbon_Case"),f=t.buildTag("label",r._getLocStr("MatchCase"),{},{"for":r._id+"_Ribbon_Case"}),i.append(s),i.append(f),s.ejCheckBox(),i=t.buildTag("td"),s=t.buildTag("input#"+r._id+"_Ribbon_AllContent"),f=t.buildTag("label",r._getLocStr("MatchAll"),{},{"for":r._id+"_Ribbon_AllContent"}),i.append(s),s.ejCheckBox(),i.append(f),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),f=t.buildTag("label").text(r._getLocStr("Within")),i.append(f),i=t.buildTag("td"),f=t.buildTag("label").text(r._getLocStr("Search")),i.append(f),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddWithin",type:"text"}),i.append(e),e.ejDropDownList(r._generateEJDD(this._within,{id:"Types",text:"text",value:"value"},0,110,25)),i=t.buildTag("td"),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddSearch",type:"text"}),i.append(e),e.ejDropDownList(r._generateEJDD(this._sType,{id:"Types",text:"text",value:"value"},0,120,25)),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),f=t.buildTag("label",r._getLocStr("Lookin")),i.append(f),i=t.buildTag("td"),f=t.buildTag("label",r._getLocStr("Replace")+" "+r._getLocStr("Direction")),u.append(i.append(f)),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddLookin",type:"text"}),i.append(e),e.ejDropDownList(r._generateEJDD(this._vType,{id:"Types",text:"text",value:"value"},0,110,25,"Type")),i=t.buildTag("td"),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddDirection",type:"text"}),u.append(i.append(e)),e.ejDropDownList(r._generateEJDD(this._direction,{id:"Types",text:"text",value:"value"},0,120,25)),n("#"+r._id+"_Settings").append(a.append(o)))},_frTypeChange:function(t,i){t==="Type"&&i.value==="comment"?(n("#"+this._id+"_Ribbon_textReplace").attr("disabled",!0),n("#"+this._id+"FR_ReplaceBtn").ejButton("disable"),n("#"+this._id+"FR_ReplaceAllBtn").ejButton("disable")):(n("#"+this._id+"_Ribbon_textReplace").prop("disabled",!1),n("#"+this._id+"FR_ReplaceBtn").ejButton("enable"),n("#"+this._id+"FR_ReplaceAllBtn").ejButton("enable"))},_hlTabChange:function(t){var i=this.XLObj,s=n("#"+i._id+"_Ribbon_sheentName").data("ejTreeView"),r=i.getActiveSheetIndex(),h=n("#"+i._id+"_Doc"),c=n("#"+i._id+"_Web"),l=n("#"+i._id+"_Ribbon_webAddress"),f=n("#"+i._id+"_Ribbon_findText"),u=n("#"+i._id+"_Ribbon_cellAddress"),e=n("#"+i._id+"_Ribbon_cellText"),a=i.getActiveCell(r),o=i.XLEdit.getPropertyValue(a.rowIndex,a.colIndex,"hyperlink",r);switch(t.activeIndex){case 0:l.focus().setInputPos(l.val().length);f.val(e.val());h.hide();c.show();n("#"+i._id+"hlDialog_OkBtn").ejButton("enable");break;case 1:u.val().length||u.val("A1");h.show();c.hide();o&&o.cellAddr&&(r=parseInt(o.cellAddr.split("_")[1]));s.selectNode(r+1);f.val().length?e.val(f.val()):e.val(s.getText(r+1)+"!A1");u.focus().setInputPos(u.val().length)}},_findTabChange:function(t){var r,i=this.XLObj;switch(t.activeIndex){case 0:r=n("#"+i._id+"_Ribbon_FindDiv");n("#"+i._id+"_Ribbon_lbReplace").hide();n("#"+i._id+"_Ribbon_textReplace").hide();n("#"+i._id+"FR_ReplaceBtn").css("visibility","hidden");n("#"+i._id+"FR_ReplaceAllBtn").css("visibility","hidden");n("#"+i._id+"_Find").append(r);n("#"+i._id+"FR_PrevBtn").show();n("#"+i._id+"FR_NextBtn").show();n("#"+i._id+"_Ribbon_textFind").focus().setInputPos(n("#"+i._id+"_Ribbon_textFind").val().length);i._phoneMode?(n("#"+i._id+"FR_ReplaceBtn").hide(),n("#"+i._id+"FR_ReplaceAllBtn").hide()):(n("#"+i._id+"FR_ReplaceBtn").show(),n("#"+i._id+"FR_ReplaceAllBtn").show());break;case 1:r=n("#"+i._id+"_Ribbon_FindDiv");n("#"+i._id+"_Ribbon_lbReplace").show();n("#"+i._id+"_Ribbon_textReplace").show();n("#"+i._id+"FR_ReplaceBtn").css("visibility","visible").show();n("#"+i._id+"FR_ReplaceAllBtn").css("visibility","visible").show();i._phoneMode?(n("#"+i._id+"FR_PrevBtn").hide(),n("#"+i._id+"FR_NextBtn").hide()):(n("#"+i._id+"FR_PrevBtn").show(),n("#"+i._id+"FR_NextBtn").show());n("#"+i._id+"_Replace").append(r);n("#"+i._id+"_Ribbon_textFind").focus().setInputPos(n("#"+i._id+"_Ribbon_textFind").val().length);break;case 2:n("#"+i._id+"FR_PrevBtn").hide();n("#"+i._id+"FR_NextBtn").hide();n("#"+i._id+"FR_ReplaceBtn").css("visibility","hidden");n("#"+i._id+"FR_ReplaceAllBtn").css("visibility","hidden");n("#"+i._id+"_Ribbon_ddWithin").focus();i._phoneMode?n("#"+i._id+"_Ribbon_SettingsDiv").find("td:eq(1)").hide():n("#"+i._id+"_Ribbon_SettingsDiv").find("td:eq(1)").show()}},_gotoTabChange:function(t){var i=this.XLObj;t.activeIndex==0&&n("#"+i._id+"_textRef").focus().setInputPos(n("#"+i._id+"_textRef").val().length)},_btnFROnClick:function(t){var i=this.XLObj;i.showWaitingPopUp();var r=i.getActiveSheetIndex(),c=i.getSheet(r)._startCell.rowIndex,l=i.getSheet(r)._startCell.colIndex,u=n("#"+i._id+"_Ribbon_Case").data("ejCheckBox").isChecked(),f=n("#"+i._id+"_Ribbon_AllContent").data("ejCheckBox").isChecked(),e=this._within[n("#"+i._id+"_Ribbon_ddWithin").data("ejDropDownList").selectedIndexValue].value,s=this._sType[n("#"+i._id+"_Ribbon_ddSearch").data("ejDropDownList").selectedIndexValue].value,o=this._vType[n("#"+i._id+"_Ribbon_ddLookin").data("ejDropDownList").selectedIndexValue].value,a=this._direction[n("#"+i._id+"_Ribbon_ddDirection").data("ejDropDownList").selectedIndexValue].value,h;switch(t){case"FR_NextBtn":case"FR_PrevBtn":i.XLSearch._findCount=0;h=t==="FR_NextBtn"?i.XLSearch._findNext(n("#"+i._id+"_Ribbon_textFind").val(),r,u,f,o,e,s):i.XLSearch._findPrev(n("#"+i._id+"_Ribbon_textFind").val(),r,u,f,o,e,s);h||(i.XLSearch._updateSelection(c,l,r),i.hideWaitingPopUp(),i._showAlertDlg("Alert","NotFound"));break;case"FR_ReplaceBtn":i.XLSearch._replaceData(n("#"+i._id+"_Ribbon_textFind").val(),n("#"+i._id+"_Ribbon_textReplace").val(),r,u,f,o,a,e,s);break;case"FR_ReplaceAllBtn":i.XLSearch._replaceAllData(n("#"+i._id+"_Ribbon_textFind").val(),n("#"+i._id+"_Ribbon_textReplace").val(),u,f,o,e);break;case"FR_CloseBtn":n("#"+i._id+"_FRDialog").ejDialog("close");i.setSheetFocus()}i.hideWaitingPopUp()},_renderGoToDialog:function(){var f,o,u,s,e,i=this.XLObj,r;n("#"+i._id+"_GoToDlgTab").ejTab({width:"100%",itemActive:t.proxy(this._gotoTabChange,this),cssClass:"e-ss-dlgtab"});n("#"+i._id+"_GoToDiv").length<1&&(f=t.buildTag("div.e-dlgctndiv","",{},{id:i._id+"_GoToDiv"}),n("#"+i._id+"_GoTo").append(f),r=t.buildTag("div.e-dlg-fields"),u=t.buildTag("label.e-dlg-fields",i._getLocStr("GoToName")),s=t.buildTag("ul#"+i._id+"_GotoAddr"),f.append(r.append(u,s)),n("#"+i._id+"_GotoAddr").ejListBox({dataSource:this._addrList,height:"120",width:"100%",selected:n.proxy(this._gotoValChange,this),fields:{id:"Types",text:"text",value:"value"}}),r=t.buildTag("div.e-dlg-fields"),u=t.buildTag("label.e-dlg-fields",i._getLocStr("Reference")),e=t.buildTag("input.ejinputtext","","",{id:i._id+"_textRef",type:"text"}),e.data("parentID",i._id),f.append(r.append(u,e)),o=t.buildTag("div#"+i._id+"_GoToSpDiv.e-dlgctndiv","",""),r=t.buildTag("div.e-dlg-fields e-dlgctndiv"),n("#"+i._id+"_GoToSp").append(o.append(r)),n("#"+i._id+"_GoToSp").css({overflow:"auto",height:"auto"}),u=t.buildTag("label.e-dlg-fields").text(i._getLocStr("Select")).css("display","table"),r.append(u),this._renderGotoSp(r,this._gotoRBtnSet1,this._gotoRBtnSet2,this._gotoChkBox),n("#"+i._id+"_GoDialog").ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,width:"auto",allowKeyboardNavigation:!1,title:i._getLocStr("GoTo"),cssClass:"e-ss-dialog e-ss-gotodlg e-ss-mattab e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),open:t.proxy(function(){var t=n("#"+i._id+"_textRef");t.focus().setInputPos(t.val().length)})}),n("#"+i._id+"_GoToDiv").wrapInner('<form id="'+i._id+'_Form_GoToDiv" onsubmit="return false"><\/form>'),this._dialogValidate("_GoToDiv"))},_renderGotoSp:function(i,r,u,f){for(var l,c,s,e,h=this.XLObj,v=h._id+"_gotoSpDiv",a,y=t.buildTag("table"),o=0;o<r.length;o++)s=t.buildTag("tr","",{height:35}),e=t.buildTag("td"),l=t.buildTag("input#"+v+"_"+r[o],"",{},{type:"radio",name:"gotospecial"}),e.append(l),s.append(e),l.ejRadioButton({size:"medium",change:n.proxy(this._rBtnOnClick,this,r[o])}),e=t.buildTag("td","",{width:100}),c=t.buildTag("label",h._getLocStr(r[o]),{},{"for":v+"_"+r[o]}),e.append(c),s.append(e),h.isUndefined(u[o])||(e=t.buildTag("td"),l=t.buildTag("input#"+v+"_"+u[o],"",{},{type:"radio",name:"gotospecial"}),e.append(l),s.append(e),l.ejRadioButton({size:"medium",change:n.proxy(this._rBtnOnClick,this,u[o])}),e=t.buildTag("td"),c=t.buildTag("label",h._getLocStr(u[o]),{},{"for":v+"_"+u[o]}),e.append(c),s.append(e)),y.append(s);for(o=0;o<f.length;o=o+2)s=t.buildTag("tr"),e=t.buildTag("td"),a=t.buildTag("input#"+h._id+"_"+f[o]),e.append(a),s.append(e),e=t.buildTag("td"),c=t.buildTag("label",h._getLocStr(f[o]),{},{"for":h._id+"_"+f[o]}),e.append(c),s.append(e),a.ejCheckBox({checked:!0,enabled:!1}),e=t.buildTag("td"),a=t.buildTag("input#"+h._id+"_"+f[o+1]),e.append(a),s.append(e),e=t.buildTag("td"),c=t.buildTag("label",h._getLocStr(f[o+1]),{},{"for":h._id+"_"+f[o+1]}),e.append(c),s.append(e),a.ejCheckBox({checked:!0,enabled:!1}),y.append(s);i.append(y);n("#"+v+"_Blanks").ejRadioButton("option",{checked:!0})},_renderPvtDialog:function(){var r=this.XLObj,s,e,o,u,i,f;n("#"+r._id+"_Ribbon_PvtDiv").length<1&&(s=t.buildTag("div.e-dlgctndiv","",{},{id:r._id+"_Ribbon_PvtDiv"}),o=t.buildTag("table","",{},{cellpadding:0,cellspacing:0}),u=t.buildTag("tr.e-ss-changerange"),i=t.buildTag("td",""),e=t.buildTag("label",r._getLocStr("Range")),i.append(e),u.append(i),i=t.buildTag("td",""),f=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_PvtRange",type:"text"}),f.data("parentID",r._id),u.append(i.append(f)),o.append(u),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),e=t.buildTag("label",r._getLocStr("ChoosePivotTable")),i.append(e),i.attr("colspan",2),o.append(u.append(i)),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),i.attr("colspan",2),f=t.buildTag("input#"+r._id+"_dlg_newsheet","",{},{type:"radio",name:"sheet"}),i.append(f),e=t.buildTag("label"," "+r._getLocStr("NewWorksheet")),i.append(e),o.append(u.append(i)),f.ejRadioButton({size:"medium",checked:!0,change:n.proxy(this._rBtnPvtOnClick,this,"new")}),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),i.attr("colspan",2),f=t.buildTag("input#"+r._id+"_dlg_existsheet","",{},{type:"radio",name:"sheet"}),i.append(f),e=t.buildTag("label"," "+r._getLocStr("ExistingWorksheet")),i.append(e),o.append(u.append(i)),f.ejRadioButton({size:"medium",change:n.proxy(this._rBtnPvtOnClick,this,"existing")}),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),e=t.buildTag("label",r._getLocStr("Location")),i.append(e),u.append(i),i=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_PvtLocation",type:"text"}),f.data("parentID",r._id),u.append(i.append(f)),o.append(u),n("#"+r._id+"_Pivot").append(s.append(o)),n("#"+r._id+"_Ribbon_PvtLocation").wrap("<form id='"+r._id+"_Form_Ribbon_PvtLocation' onsubmit='return false'><\/form>").prop("disabled",!0),this._dialogValidate("_Ribbon_PvtLocation"),n("#"+r._id+"_Ribbon_PvtRange").wrap("<form id='"+r._id+"_Form_Ribbon_PvtRange' onsubmit='return false'><\/form>"),this._dialogValidate("_Ribbon_PvtRange"))},_dlgPvtOk:function(){var t=this.XLObj,r=n("#"+t._id+"_PvtDialog"),i;n("#"+t._id+"_Form_Ribbon_PvtRange").valid()&&n("#"+t._id+"_Form_Ribbon_PvtLocation").valid()&&(i=t.XLPivot._checkRange(n("#"+t._id+"_Ribbon_PvtRange").val(),n("#"+t._id+"_Ribbon_PvtLocation").val()),i.isRows?t._showAlertDlg("Alert","PivotRowsAlert","",450):i.isHeader?t._showAlertDlg("Alert","PivotLabelsAlert","",550):i.isOverlap?t._showAlertDlg("Alert","PivotOverlapAlert","",450):(n("#"+t._id+"_PvtDialog").ejDialog("close"),r.find(".e-ss-changerange:visible").length&&r.find(".e-ss-movepvttbl:visible").length?t.XLPivot.createPivotTable(n("#"+t._id+"_Ribbon_PvtRange").val(),n("#"+t._id+"_Ribbon_PvtLocation").val(),null):r.find(".e-ss-changerange:visible").length?t.XLPivot._changeDataSource():t.XLPivot._movePivotTable()))},_dlgPvtCancel:function(){var t=this.XLObj;n("#"+t._id+"_PvtDialog").ejDialog("close");t.setSheetFocus()},_rBtnPvtOnClick:function(t){var r=this.XLObj,u=n("#"+r._id+"_Ribbon_PvtRange"),i=n("#"+r._id+"_Ribbon_PvtLocation");i.prop("disabled",t==="new");t==="new"?(u.focus().setInputPos(u.val().length),n("#"+this.XLObj._id+"_Form_Ribbon_PvtLocation").validate().resetForm()):i.setInputPos(i.val().length)},_rBtnOnClick:function(t){var r=this.XLObj,i;if(t==="Formulas"||t==="Constants")for(i=0;i<this._gotoChkBox.length;i++)n("#"+r._id+"_"+this._gotoChkBox[i]).data("ejCheckBox").option({enabled:!0});else for(i=0;i<this._gotoChkBox.length;i++)n("#"+r._id+"_"+this._gotoChkBox[i]).data("ejCheckBox").option({enabled:!1})},_gotoValChange:function(t){n("#"+this.XLObj._id+"_textRef").val(t.model.value)},_getAddrFromDollarAddr:function(n){var i,t;return n.indexOf("!")>-1&&(t=n.split("!"),i=this.XLObj._getSheetIndexByName(t[0]),n=t[1]),n.indexOf("$")>-1&&(n=n.split("$").join("")),n.indexOf(":")<0&&(n=n+":"+n),n=n.replace("=",""),[i,n]},_gotoBtnClick:function(t){var i=this.XLObj,r;switch(t){case"ok":n("#"+i._id+"_Form_GoToDiv").valid()&&(r=n("#"+i._id+"_GoToDlgTab").data("ejTab"),r.model.selectedItemIndex?i.XLSearch._applyGoToRule(n("#"+i._id+"_GoToSpDiv").find(".e-circle_01").parents("div")[0].id.split("ej"+i._id+"_gotoSpDiv_")[1].toLowerCase(),n("#"+i._id+"_"+this._gotoChkBox[0]).data("ejCheckBox").isChecked(),n("#"+i._id+"_"+this._gotoChkBox[1]).data("ejCheckBox").isChecked(),n("#"+i._id+"_"+this._gotoChkBox[2]).data("ejCheckBox").isChecked(),n("#"+i._id+"_"+this._gotoChkBox[3]).data("ejCheckBox").isChecked()):i.XLSearch.goTo(n.trim(n("#"+i._id+"_textRef").val().toString())),n("#"+i._id+"_GoDialog").ejDialog("close"));break;case"cancel":n.validator&&n("#"+i._id+"_Form_GoToDiv").validate().resetForm();n("#"+i._id+"_GoDialog").ejDialog("close")}i.setSheetFocus()},_borderPicture:function(){var n=this.XLObj;return"<ul id="+n._id+"_Ribbon_PictureBorder style='display:none' class='e-ss-pictureborder'><li id='"+n._id+"picturecolor'><a>"+n._getLocStr("ThemeColor")+"<\/a><ul><li><input id='"+n._id+"_Ribbon_PictureColor'><\/input><\/li><\/ul><\/li><li id='nooutline' class='picturecolor'><a>"+n._getLocStr("NoOutline")+"<\/a><\/li><li id='weight' class='picturecolor'><a>"+n._getLocStr("Weight")+"<\/a><ul><li id='1px'><a>1px<\/a><\/li><li id='2px'><a>2px<\/a><\/li><li id='3px'><a>3px<\/a><\/li><\/ul><\/li><li id='dashes' class='picturecolor'><a>"+n._getLocStr("Dashes")+"<\/a><ul><li id='solid'><a><div style='border:2px solid black'><\/div><\/a><\/li><li id='dotted'><a><div style='border:2px dotted black'><\/div><\/a><\/li><li id='dashed'><a><div style='border:2px dashed black'><\/div><\/a><\/li><\/ul><\/li><\/ul>"},_chartElementTag:function(){var n=this.XLObj,t="<ul id="+n._id+'_Ribbon_CElement class="e-spreadsheet" style="display:none">';return t+='<li class="axes" id="Axes"><a><span class="e-ss-chartimg e-icon e-ss-axes"><\/span>'+n._getLocStr("Axes")+'<\/a><ul><li class="phaxis e-ss-cmenuitem" id="PHAxis"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-phaxis"><\/span>'+n._getLocStr("PHAxis")+'<\/a><\/li><li class="pvaxis e-ss-cmenuitem" id="PVAxis"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pvaxis"><\/span>'+n._getLocStr("PVAxis")+"<\/a><\/li><\/ul><\/li>",t+='<li class="axistitle" id="AxisTitle"><a><span class="e-ss-chartimg e-icon e-ss-axistitle"><\/span>'+n._getLocStr("AxisTitle")+'<\/a><ul><li class="phaxistitle e-ss-cmenuitem" id="PHAxisTitle"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-phaxistitle"><\/span>'+n._getLocStr("PHAxis")+'<\/a><\/li><li class="pvaxistitle e-ss-cmenuitem" id="PVAxisTitle"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pvaxistitle"><\/span>'+n._getLocStr("PVAxis")+"<\/a><\/li><\/ul><\/li>",t+='<li class="charttitle" id="ChartTitle"><a><span class="e-ss-chartimg e-icon e-ss-charttitle"><\/span>'+n._getLocStr("ChartTitle")+'<\/a><ul><li class="ctnone e-ss-cmenuitem" id="CTNone"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctnone"><\/span>'+n._getLocStr("CTNone")+'<\/a><\/li><li class="ctcenter e-ss-cmenuitem" id="CTCenter"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctcenter"><\/span>'+n._getLocStr("CTCenter")+'<\/a><\/li><li class="ctfar e-ss-cmenuitem" id="CTFar"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctfar"><\/span>'+n._getLocStr("CTFar")+'<\/a><\/li><li class="ctnear e-ss-cmenuitem" id="CTNear"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctnear"><\/span>'+n._getLocStr("CTNear")+"<\/a><\/li><\/ul><\/li>",t+='<li class="datalabels" id="DataLabels"><a><span class="e-ss-chartimg e-icon e-ss-datalabels"><\/span>'+n._getLocStr("DataLabels")+'<\/a><ul><li class="dlnone e-ss-cmenuitem" id="DLNone"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dlnone"><\/span>'+n._getLocStr("DLNone")+'<\/a><\/li><li class="dlcenter e-ss-cmenuitem" id="DLCenter"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dlcenter"><\/span>'+n._getLocStr("DLCenter")+'<\/a><\/li><li class="dliend e-ss-cmenuitem" id="DLIEnd"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dliend"><\/span>'+n._getLocStr("DLIEnd")+'<\/a><\/li><li class="dlibase e-ss-cmenuitem" id="DLIBase"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dlibase"><\/span>'+n._getLocStr("DLIBase")+'<\/a><\/li><li class="dloend e-ss-cmenuitem" id="DLOEnd"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dloend"><\/span>'+n._getLocStr("DLOEnd")+"<\/a><\/li><\/ul><\/li>",t+='<li class="gridline" id="Gridline"><a><span class="e-ss-chartimg e-icon e-ss-gridline"><\/span>'+n._getLocStr("Gridline")+'<\/a><ul><li class="pmajorh e-ss-cmenuitem" id="PMajorH"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pmajorh"><\/span>'+n._getLocStr("PMajorH")+'<\/a><\/li><li class="pmajorv e-ss-cmenuitem" id="PMajorV"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pmajorv"><\/span>'+n._getLocStr("PMajorV")+'<\/a><\/li><li class="pminorh e-ss-cmenuitem" id="PMinorH"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pminorh"><\/span>'+n._getLocStr("PMinorH")+'<\/a><\/li><li class="pminorv e-ss-cmenuitem" id="PMinorV"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pminorv"><\/span>'+n._getLocStr("PMinorV")+"<\/a><\/li><\/ul><\/li>",t+('<li class="legend" id="Legend"><a><span class="e-ss-chartimg e-icon e-ss-legend"><\/span>'+n._getLocStr("Legend")+'<\/a><ul><li class="lnone e-ss-cmenuitem" id="LNone"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lnone"><\/span>'+n._getLocStr("LNone")+'<\/a><\/li><li class="lright e-ss-cmenuitem" id="LRight"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lright"><\/span>'+n._getLocStr("LRight")+'<\/a><\/li><li class="lleft e-ss-cmenuitem" id="LLeft"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lleft"><\/span>'+n._getLocStr("LLeft")+'<\/a><\/li><li class="lbottom e-ss-cmenuitem" id="LBottom"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lbottom"><\/span>'+n._getLocStr("LBottom")+'<\/a><\/li><li class="ltop e-ss-cmenuitem" id="LTop"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ltop"><\/span>'+n._getLocStr("LTop")+"<\/a><\/li><\/ul><\/li>")},_cpClickHandler:function(t){var i=this.XLObj;t==="Ribbon_Home_Font_FillColor"?i.XLFormat.format({style:{"background-color":n("#"+i._id+"_Ribbon_Home_Font_FillColor").ejColorPicker("option","value")}}):t==="Ribbon_Home_Font_FontColor"&&i.XLFormat.format({style:{color:n("#"+i._id+"_Ribbon_Home_Font_FontColor").ejColorPicker("option","value")}});i.setSheetFocus()},_ribbonClickHandler:function(i){var rt,ci,kt,nt,dt,c,l,li,et,ht,g,ot,st,at,ut,tt,gt={},r=n("#"+this._id.split("_Ribbon")[0]).data("ejSpreadsheet"),f=r.getActiveSheetIndex(),e=r.getSheet(f),a={},o={},h=this._id.split("_"),y=t.Spreadsheet.SupportedStyles,ai,ct,wi,p,v=e._selectedCells,d,b,k,yt,ni,vt,ti,pt,vi,yi,wt,ii,it,bt,ri,s,ui,fi,ei,w,ft,u,bi,lt,oi,hi;if(!r._shapeChange&&!r.XLRibbon._isSetModel){if(r._isRibbonClick=!0,ct=r._getJSSheetContent(f).find(".e-spreadsheetcontentcontainer > .e-content"),wi=r.getMainPanel(),rt=n("#"+r._id+"_Ribbon_Home_Number_NumberFormat").data("ejDropDownList"),ut=n("#"+r._id+"_Ribbon_Home_Font_FontSize").data("ejDropDownList"),at=n(r.getCell(e._activeCell.rowIndex,e._activeCell.colIndex)),r.model.allowSelection&&r.model.allowFormatAsTable&&r.model.allowCellFormatting&&(r.XLFormat._formatEnable||r.XLSelection._isOutsideBordering||r.XLSelection._isGridBordering)&&(r._id+"_Ribbon_Home_Font_BorderColor"===this._id||r._id+"_Ribbon_bordercolor"===i.ID||r._borderStyles.indexOf(i.ID)>-1||(r.XLSelection._isGridBordering=r.XLSelection._isOutsideBordering=r.XLFormat._formatEnable=!1,n("#"+r._id+"_Ribbon_Home_Clipboard_FormatPainter").ejToggleButton("option",{toggleState:!1}),(i.type==="itemSelected"||i.type==="click")&&!r.isUndefined(i.model.prefixIcon)&&(i.model.prefixIcon.split("e-ss-")[1]===i.ID||i.model.prefixIcon.indexOf("e-ss-drawborder")>-1||i.model.prefixIcon.indexOf("e-ss-drawbordergrid")>-1)&&(r.XLSelection._isGridBordering=r.XLSelection._isOutsideBordering=!0),ct.addClass("e-ss-cursor"),ct.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor e-ss-fpcursor"),r.XLSelection._cleanUp(!0))),ai={Id:this._id,isChecked:i.isChecked,status:i.status,prop:i.model,model:r.model},r._trigger("ribbonClick",ai)){r.model.showRibbon&&r.XLRibbon._updateRibbonIcons();return}!t.isNullOrUndefined(r._getAutoFillOptElem())&&r.model.autoFillSettings.showFillOptions&&(r._getAutoFillOptElem().addClass("e-hide"),n("#"+r._id+"_ctxtmenu").hide());switch(this._id){case r._id+"_Ribbon_Home_Clipboard_Cut":r.XLClipboard.cut();break;case r._id+"_Ribbon_Home_Clipboard_Copy":r.XLClipboard.copy();break;case r._id+"_Ribbon_Home_Clipboard_Paste":case r._id+"_Ribbon_Home_Clipboard_PasteOptions":r.XLClipboard._isSpecial=!(i.ID==="PasteValues");r.XLClipboard.paste();break;case r._id+"_Ribbon_Home_Actions_Undo":r.XLClipboard._triggerKeyDown(90,!0);break;case r._id+"_Ribbon_Home_Actions_Redo":r.XLClipboard._triggerKeyDown(89,!0);break;case r._id+"_Ribbon_Home_Alignment_WrapText":r._textFormatting("wrapText");break;case r._id+"_Ribbon_exportXL":r.XLExport["export"](t.Spreadsheet.exportType.Excel);break;case r._id+"_Ribbon_exportCsv":r.XLExport["export"](t.Spreadsheet.exportType.Csv);break;case r._id+"_Ribbon_exportPdf":r.XLExport["export"](t.Spreadsheet.exportType.Pdf);break;case r._id+"_Ribbon_PageLayout_Print_Print":r.XLPrint.printSheet(f);break;case r._id+"_Ribbon_PageLayout_Print_PrintSelected":r.XLPrint.printSelection(f);break;case r._id+"_Ribbon_new":r._cellFormatHandler(this._id.replace(r._id+"_Ribbon_",""),i.selectedText);break;case r._id+"_Ribbon_Home_Font_Bold":o[y.FontWeight]=i.model.toggleState?"bold":"normal";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_Italic":o[y.FontStyle]=i.model.toggleState?"italic":"normal";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_Underline":case r._id+"_Ribbon_Home_Font_StrikeThrough":d=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(at[0].className))["text-decoration"]||"";h.indexOf("StrikeThrough")>-1?h[h.indexOf("StrikeThrough")]="line-through":h.indexOf("Underline")>-1&&(h[h.indexOf("Underline")]="underline");i.model.toggleState?(d=d.replace("none",""),o[y.TextDecoration]=d?d.indexOf("underline")<0?d+" "+h[h.length-1]:h[h.length-1]+" "+d:h[h.length-1]):(d=n.trim(d.replace(h[h.length-1],"")),o[y.TextDecoration]=d.length?d:"none");a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_FontSize":o[y.FontSize]=i.value;a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_IncreaseFontSize":case r._id+"_Ribbon_Home_Font_DecreaseFontSize":this._id==r._id+"_Ribbon_Home_Font_IncreaseFontSize"?(st=t.isNullOrUndefined(ut.selectedIndexValue)?6:ut.selectedIndexValue+1,t.isNullOrUndefined(r.XLRibbon._fontSize[st])||ut.option({selectedItemIndex:st})):this._id==r._id+"_Ribbon_Home_Font_DecreaseFontSize"&&(st=t.isNullOrUndefined(ut.selectedIndexValue)?4:ut.selectedIndexValue-1,t.isNullOrUndefined(r.XLRibbon._fontSize[st])||ut.option({selectedItemIndex:st}));break;case r._id+"_Ribbon_Home_Alignment_AlignLeft":case r._id+"_Ribbon_Home_Alignment_AlignRight":case r._id+"_Ribbon_Home_Alignment_AlignCenter":g=n(this.element.parents("div").eq(1)).find(".e-text-align");t.isNullOrUndefined(g[0])?this.element.addClass("e-text-align"):(n("#"+g[0].id).ejToggleButton("option","toggleState",!1),g.removeClass("e-text-align"),g[0].id!=this.element[0].id&&this.element.addClass("e-text-align"));o[y.TextAlign]=i.model.toggleState?h[h.length-1].split("Align")[1]:"left";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Alignment_DecreaseIndent":case r._id+"_Ribbon_Home_Alignment_IncreaseIndent":if(ni=0,ti=!1,v.length<2)pt=r.getActiveCell(),b=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(r.getCell(pt.rowIndex,pt.colIndex)[0].className)),vt=y.TextIndent in b?this._id===r._id+"_Ribbon_Home_Alignment_IncreaseIndent"?Number(b[y.TextIndent].replace("pt",""))+6:Number(b[y.TextIndent].replace("pt",""))-6:this._id===r._id+"_Ribbon_Home_Alignment_DecreaseIndent"?-6:6,r.XLRibbon._applyTextIndent(pt,b,vt,this);else{for(k=0,yt=v.length;k<yt;k++)b=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(r.getCell(v[k].rowIndex,v[k].colIndex)[0].className)),b[y.TextAlign]=="right"&&ni++;for(ni===v.length&&(ti=!0),k=0,yt=v.length;k<yt;k++)b=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(r.getCell(v[k].rowIndex,v[k].colIndex)[0].className)),ti||(b[y.TextAlign]="left"),vt=y.TextIndent in b?this._id===r._id+"_Ribbon_Home_Alignment_IncreaseIndent"?Number(b[y.TextIndent].replace("pt",""))+6:Number(b[y.TextIndent].replace("pt",""))-6:this._id===r._id+"_Ribbon_Home_Alignment_DecreaseIndent"?-6:6,r.XLRibbon._applyTextIndent(v[k],b,vt,this)}r.XLSelection.refreshSelection();r.XLDragFill.positionAutoFillElement();break;case r._id+"_Ribbon_Home_Alignment_TopAlign":case r._id+"_Ribbon_Home_Alignment_MiddleAlign":case r._id+"_Ribbon_Home_Alignment_BottomAlign":g=n(this.element.parents("div").eq(1)).find(".e-vertical-align");t.isNullOrUndefined(g[0])?this.element.addClass("e-vertical-align"):(n("#"+g[0].id).ejToggleButton("option","toggleState",!1),g.removeClass("e-vertical-align"),g[0].id!=this.element[0].id&&this.element.addClass("e-vertical-align"));o[y.VerticalAlign]=i.model.toggleState?h[h.length-1].split("Align")[0]:"bottom";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_FontFamily":o[y.FontFamily]=i.text;a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_PageLayout_Show_Headings":r.showHeadings(i.isChecked);break;case r._id+"_Ribbon_PageLayout_Show_Gridlines":r.showGridlines(i.isChecked);break;case r._id+"_Ribbon_PageLayout_PageLayout_PageSize":case r._id+"_Ribbon_PageLayout_PageLayout_PageSizeOptions":vi=t.isNullOrUndefined(i.ID)?i.model.prefixIcon.substring(12):i.ID;r.XLPrint._printSetting(vi);break;case r._id+"_Ribbon_Home_Number_NumberFormat":a.type=i.text.toLowerCase();a.type!=="custom"?r.XLFormat.format(a):r._showDialog(r._id+"_FormatCells");break;case r._id+"_Ribbon_Home_Number_IncreaseDecimal":case r._id+"_Ribbon_Home_Number_DecreaseDecimal":at.data("type")!="number"&&n.isNumeric(r.XLEdit.getPropertyValueByElem(at))&&(r.XLRibbon._isSetModel=!0,rt.option({selectedItemIndex:1}),r.XLRibbon._isSetModel=!1);r.XLFormat.updateDecimalPlaces(h[h.length-1]);break;case r._id+"_Ribbon_Home_Number_Accounting":case r._id+"_Ribbon_Home_Number_Percentage":this._id===r._id+"_Ribbon_Home_Number_Accounting"?rt.option({selectedItemIndex:3}):rt.option({selectedItemIndex:4});a.type=rt.selectedTextValue.toLowerCase();break;case r._id+"_Ribbon_Home_Number_CommaStyle":rt.option({selectedItemIndex:1});a.type=rt.selectedTextValue.toLowerCase();break;case r._id+"_Ribbon_Data_SortFilter_SortAtoZ":r.XLSort._sortHandler("SortAtoZ");break;case r._id+"_Ribbon_Data_SortFilter_SortZtoA":r.XLSort._sortHandler("SortZtoA");break;case r._id+"_Ribbon_Data_SortFilter_Filter":r.XLFilter.filter();break;case r._id+"_Ribbon_Data_SortFilter_ClearFilter":ot=r.XLEdit.getPropertyValue(r.getActiveCell().rowIndex,r.getActiveCell().colIndex,"tableName");t.isNullOrUndefined(ot)?r.XLFilter.clearFilter():(s=r._getTableID(ot),r.XLFilter._clearFilterTable(r.getActiveSheetIndex(),s,!0));break;case r._id+"_Ribbon_Home_Font_BorderColor":gt=n("#"+r._id+"_Ribbon_BorderColor").data("ejColorPicker");t.isNullOrUndefined(gt)||gt.hide();t.isNullOrUndefined(i.value)||(r._borderColor=i.value);break;case r._id+"_Ribbon_Home_Font_Border":r._borderStyles.indexOf(i.ID)<0?t.isNullOrUndefined(i.ID)?i.ID=i.model.prefixIcon.substring(12):i.ID.indexOf("bordercolor")<0&&n(this.element).find(".e-icon ").removeClass().addClass("e-icon e-ss-"+i.ID)&&this.option({prefixIcon:"e-icon e-ss-"+i.ID}):r.XLRibbon._updateBordeStyle(i);ci=r._borderColor||"#000000";c=e._startCell;l=e._endCell;yi=r._getAlphaRange(f,c.rowIndex,c.colIndex,l.rowIndex,l.colIndex);r.model.allowSelection&&(r.XLSelection._isOutsideBordering||r.XLSelection._isGridBordering)?!(r._borderStyles.indexOf(i.ID)>-1)&&i.ID.indexOf("bordercolor")<0&&(r.XLSelection._isOutsideBordering=r.XLSelection._isGridBordering=!1):r.setBorder({type:i.ID,color:ci,style:r._borderStyle},yi);break;case r._id+"_Ribbon_Data_DataTools_DataValidation":case r._id+"_Ribbon_Data_DataTools_DataValidationOptions":r._showDialog(this._id);i.ID=="ClearVal"?r.XLValidate.clearDV():i.ID=="HighlightVal"?r.XLValidate.highlightInvalidData():i.ID=="ClearHLVal"?r.XLValidate.clearHighlightedValData():(n("#"+r._id+"_ValDialog").ejDialog("open"),n.validator&&n("#"+r._id+"_Form_ValDialog").validate().resetForm(),n("#"+r._id+"_Ribbon_ddType_wrapper").focus(),wt=r.XLEdit.getPropertyValueByElem(r.getActiveCellElem(f),"rule"),wt?(ii=wt.customVal,it=ii.split("_"),ii.indexOf("list")>-1?(n("#"+r._id+"_Ribbon_ddType").ejDropDownList("option","selectedItemIndex",5),n("#"+r._id+"_Ribbon_btnMin").val(it[0])):(r.XLRibbon._types.filter(function(n,t){if(it[4]===n.value)return bt=t,!0}),n("#"+r._id+"_Ribbon_ddType").ejDropDownList("option","selectedItemIndex",bt),r.XLRibbon._actions.filter(function(n,t){if(it[0]===n.value)return bt=t,!0}),n("#"+r._id+"_Ribbon_ddAction").ejDropDownList("option","selectedItemIndex",bt),n("#"+r._id+"_Ribbon_btnMin").val(it[1].replace("^","")),n("#"+r._id+"_Ribbon_btnMax").val(it[2].replace("^",""))),n("#"+r._id+"_Ribbon_blank").ejCheckBox("option","checked",!wt.required),n("#"+r._id+"_Ribbon_freetext").ejCheckBox("option","checked",JSON.parse(it[it.length-3]))):(n("#"+r._id+"_Ribbon_ddType").ejDropDownList("option","selectedItemIndex",1),n("#"+r._id+"_Ribbon_ddAction").ejDropDownList("option","selectedItemIndex",6),n("#"+r._id+"_Ribbon_btnMin").val(""),n("#"+r._id+"_Ribbon_btnMax").val(""),n("#"+r._id+"_Ribbon_blank").ejCheckBox("option","checked",!0),n("#"+r._id+"_Ribbon_freetext").ejCheckBox("option","checked",!0)));break;case r._id+"_Ribbon_Home_Styles_ConditionalFormatting":if(!i.ID.length)break;r.XLRibbon._currentCFormat=i.ID;i.ID.startsWith("clear")?i.ID==="clearselected"?r.XLCFormat.clearCF(r.getSheet(f).selectedRange):r.XLCFormat.clearCF():i.ID.indexOf("_HLCellRules")>0||i.ID.indexOf("_ClearRules")>0||i.ID.indexOf("_CreateRule")<-1||(r._showDialog(this._id),r.XLRibbon._renderCFDialog(i));break;case r._id+"_Ribbon_Others_Editing_FindSelect":r._showDialog(this._id);kt=n("#"+r._id+"_GoToDlgTab").data("ejTab");ri=n("#"+r._id+"_FRDialog_FPDlgTab").data("ejTab");switch(i.ID){case"Find":r._responsiveHeight<365&&n("#"+r._id+"_FRDialog_wrapper").css("top","0px");n("#"+r._id+"_FRDialog").ejDialog("open");r.XLRibbon._refreshFRDlg();ri.option({selectedItemIndex:0});n("#"+r._id+"_Ribbon_textFind").focus().setInputPos(n("#"+r._id+"_Ribbon_textFind").val().length);r.model.isReadOnly?n("#"+r._id+"_FRDialog_FPDlgTab").ejTab("option",{disabledItemIndex:[1,2]}):n("#"+r._id+"_FRDialog_FPDlgTab").ejTab("option",{enabledItemIndex:[1,2]});break;case"Replace":r._responsiveHeight<365&&n("#"+r._id+"_FRDialog_wrapper").css("top","0px");n("#"+r._id+"_FRDialog").ejDialog("open");r.XLRibbon._refreshFRDlg();ri.option({selectedItemIndex:1});n("#"+r._id+"_Ribbon_textFind").focus().setInputPos(n("#"+r._id+"_Ribbon_textFind").val().length);break;case"GoTo":n("#"+r._id+"_GoDialog").ejDialog("open");kt.option({selectedItemIndex:0});n("#"+r._id+"_textRef").focus().setInputPos(n("#"+r._id+"_Ribbon_textFind").val().length);n.validator&&n("#"+r._id+"_Form_GoToDiv").validate().resetForm();break;case"GoToSpecial":n("#"+r._id+"_GoDialog").ejDialog("open");kt.option({selectedItemIndex:1});n("#"+r._id+"_Blanks").focus();break;default:r.XLSearch._applyGoToRule(i.ID.toLowerCase(),!0,!0,!0,!0)}break;case r._id+"_Ribbon_Others_CalCulation_CalculationOptions":switch(i.ID){case r._id+"_CalcAuto":r.XLEdit.calcOption(!0);break;case r._id+"_CalcManual":r.XLEdit.calcOption(!1)}break;case r._id+"_Ribbon_Others_CalCulation_CalculateNow":r.XLEdit.calcNow();break;case r._id+"_Ribbon_Others_CalCulation_CalculateSheet":r.XLEdit.calcNow(r.getActiveSheetIndex());break;case r._id+"_Ribbon_Home_Clipboard_FormatPainter":if(!i.model.toggleState)return r.performSelection(r.getActiveCell(),r.getActiveCell()),!1;r.XLFormat._formatEnable=!0;ct.removeClass("e-ss-cursor");ct.addClass("e-ss-fpcursor");r.XLFormat._formatPainter();break;case r._id+"_Ribbon_Design_Tools_ConvertToRange":r.XLFormat.convertToRange({alert:!0});break;case r._id+"_Ribbon_Design_Tools_ResizeTable":s=parseInt(document.getElementById(r._id+"_tableid").value);u=e.tableManager[s].range;r._showDialog(r._id+"_Ribbon_Design_Tools_ResizeTable");n("#"+r._id+"_fatresizetablerange").val(r._getAlphaRange(f,u[0],u[1],u[2],u[3]));n("#"+r._id+"_fatresizetabledlg").ejDialog("open");break;case r._id+"_Ribbon_Design_TableStyleOptions_FirstColumn":case r._id+"_Ribbon_Design_TableStyleOptions_LastColumn":tt=e.tableManager;s=document.getElementById(r._id+"_tableid").value;s in tt&&(u=tt[s].range,u=this._id===r._id+"_Ribbon_Design_TableStyleOptions_FirstColumn"?r._getProperAlphaRange(f,u[0]+1,u[1],u[2],u[1]):r._getProperAlphaRange(f,u[0]+1,u[3],u[2],u[3]),this._id===r._id+"_Ribbon_Design_TableStyleOptions_FirstColumn"?(i.isChecked?tt[s].firstColumn=!0:delete tt[s].firstColumn,dt="firstColumn"):(i.isChecked?tt[s].lastColumn=!0:delete tt[s].lastColumn,dt="lastColumn"),r._dupDetails=!0,r.XLFormat.format({style:{"font-weight":i.isChecked?"bold":"normal"}},u),r._dupDetails=!1,et={sheetIndex:f,reqType:"format-table",action:"firstlastcolumn",range:u,check:i.isChecked,id:i.model.id,tableId:parseInt(s),prop:dt},r._completeAction(et),r._trigActionComplete(et));break;case r._id+"_Ribbon_Design_TableStyleOptions_TotalRow":s=document.getElementById(r._id+"_tableid").value;s in e.tableManager&&r.XLFormat._calculateTotalRow(f,s,i.isChecked,i.isChecked);break;case r._id+"_Ribbon_Design_TableStyleOptions_FilterColumn":if(!r.model.allowFiltering)return;tt=e.tableManager;s=document.getElementById(r._id+"_tableid").value;r.XLFilter._clearFilterTableIcon(f,parseInt(document.getElementById(r._id+"_tableid").value));tt[s].isFilter=i.isChecked;et={sheetIndex:f,reqType:"format-table",action:"filtericon",id:i.model.id,check:i.isChecked,tableId:parseInt(s)};r._completeAction(et);r._trigActionComplete(et);break;case r._id+"_Ribbon_Insert_Tables_Table":r._showDialog(this._id);r.XLRibbon._openFATDlg();break;case r._id+"_Ribbon_Review_Comments_NewComment":n("#"+r._id+"_Ribbon_Review_Comments_NewComment").text()===r._getLocStr("NewComment")?r.XLComment.setComment():r.XLComment.editComment();break;case r._id+"_Ribbon_Review_Comments_DeleteComment":r.XLComment.deleteComment();break;case r._id+"_Ribbon_Review_Comments_ShowAllComments":r.XLComment.showAllComments();break;case r._id+"_Ribbon_Review_Comments_ShowHideComment":r.XLComment.showHideComment();break;case r._id+"_Ribbon_Review_Comments_NextComment":r.XLComment.findNextComment();break;case r._id+"_Ribbon_Review_Comments_PreviousComment":r.XLComment.findPrevComment();break;case r._id+"_Ribbon_Insert_Links_Hyperlink":r._showDialog(this._id);break;case r._id+"_Ribbon_Home_Editing_SortFilter":switch(i.ID){case"Ribbon_SortAtoZ":case"Ribbon_SortZtoA":r.model.allowSorting&&r.XLSort._sortHandler(i.ID);break;case"Ribbon_Filter":r.model.allowFiltering&&r.XLFilter.filter();break;default:ot=r.getCell(r.getActiveCell().rowIndex,r.getActiveCell().colIndex)[0].className;ot.indexOf("e-table")<0?r.XLFilter.clearFilter():(s=r._getTableID(ot),r.XLFilter._clearFilterTable(r.getActiveSheetIndex(),parseInt(s),!0))}break;case r._id+"_Ribbon_Others_Cells_InsertCell":case r._id+"_Ribbon_Others_Cells_InsertCellOptions":if(v.length<1)return;c=v[0];l=v[v.length-1];switch(i.ID){case"InsertCells":r._getJSSheetRowHeaderContent(f).find(".e-rowselected").length?r.insertEntireRow(c.rowIndex,l.rowIndex):r._getJSSheetHeader(f).find(".e-colselected").length?(r._insDelStatus="insert",r.insertEntireColumn(c.colIndex,l.colIndex)):r._showDialog(this._id);break;case"InsertSheetRows":r.insertEntireRow(c.rowIndex,l.rowIndex);break;case"InsertSheetColumns":r._insDelStatus="insert";r.insertEntireColumn(c.colIndex,l.colIndex);break;case"InsertSheet":r.insertSheet();break;default:r.element.find(".e-rowselected").length>0?r.insertEntireRow(c.rowIndex,l.rowIndex):r.element.find(".e-colselected").length>0?(r._insDelStatus="insert",r.insertEntireColumn(c.colIndex,l.colIndex)):r.insertShiftBottom(c,l)}break;case r._id+"_Ribbon_Others_Cells_DeleteCell":case r._id+"_Ribbon_Others_Cells_DeleteCellOptions":if(v.length<1)return;c=v[0];l=v[v.length-1];switch(i.ID){case"DeleteCells":r._getJSSheetRowHeaderContent(f).find(".e-rowselected").length?r.deleteEntireRow(c.rowIndex,l.rowIndex,[]):r._getJSSheetHeader(f).find(".e-colselected").length?(r._insDelStatus="delete",r.deleteEntireColumn(c.colIndex,l.colIndex,[])):r._showDialog(this._id);break;case"DeleteSheetRows":r.deleteEntireRow(c.rowIndex,l.rowIndex,[]);break;case"DeleteSheetColumns":r._insDelStatus="delete";r.deleteEntireColumn(c.colIndex,l.colIndex,[]);break;case"DeleteSheet":r.deleteSheet(f);break;default:r.element.find(".e-rowselected").length>0?r.deleteEntireRow(c.rowIndex,l.rowIndex):r.element.find(".e-colselected").length>0?(r._insDelStatus="insert",r.deleteEntireColumn(c.colIndex,l.colIndex)):r.deleteShiftUp(c,l)}break;case r._id+"_Ribbon_Home_Editing_Clear":u=e.selectedRange;switch(i.ID){case"Clear_All":u=r._getAlphaRange(f,u[0],u[1],u[2],u[3]);r.clearAll(u);break;case"Clear_Formats":u=r._getAlphaRange(f,u[0],u[1],u[2],u[3]);r.clearAllFormat(u);break;case"Clear_Contents":u=r._getAlphaRange(f,u[0],u[1],u[2],u[3]);r.clearContents(u);break;case"Clear_Comments":r.clearComments(f);break;default:r.clearHyperlinks()}r.model.allowSelection&&r.XLSelection._clearBorder(r._arrayAsString(r._cutFocus),f);break;case r._id+"_Ribbon_Insert_Tables_PivotTable":if(r._showDialog(this._id),w=n("#"+r._id+"_PvtDialog"),e=r.getSheet(f),li={sheetIndex:f,model:r.model.sheets},r._trigger("_createPivotTable",li))return;n("#"+r._id+"_Ribbon_PvtRange").val("");n("#"+r._id+"_Ribbon_PvtLocation").val("");e._selectedCells.length>1?(u=e.selectedRange,n("#"+r._id+"_Ribbon_PvtRange").val(e.sheetInfo.text+"!$"+r._generateHeaderText(u[1]+1)+"$"+(u[0]+1)+":$"+r._generateHeaderText(u[3]+1)+"$"+(u[2]+1))):r.isUndefined(r.XLEdit.getPropertyValueByElem(r.getActiveCellElem()))||(r.selectAll(!1),n("#"+r._id+"_Ribbon_PvtRange").val(e.sheetInfo.text+"!$"+r._generateHeaderText(e._startCell.colIndex+1)+"$"+(e._startCell.rowIndex+1)+":$"+r._generateHeaderText(e._endCell.colIndex+1)+"$"+(e._endCell.rowIndex+1)));w.find(".e-ss-changerange").show();w.find(".e-ss-movepvttbl").show();w.data("ejDialog").option("title",r._getLocStr("CreatePivotTable"));n("#"+r._id+"_dlg_newsheet").click();w.ejDialog("open");break;case r._id+"_Ribbon_Analyze_Show_FieldList":i.model.toggleState?(r.XLPivot._displayActPanel=!0,r.getActivationPanel().find("#"+r._id+"_PivotTableSchema_"+r._getContent(f).find(".e-ss-activepivot")[0].id).show(),r.showActivationPanel()):(r.hideActivationPanel(),r.XLPivot._displayActPanel=!1);break;case r._id+"_Ribbon_Analyze_Actions_ClearAll":ui=r.element.find(".e-ss-activepivot")[0].id;fi=n("#"+ui).data("ejPivotGrid");ei=n("#"+r._id+"_PivotTableSchema_"+ui).data("ejPivotSchemaDesigner");r.XLPivot._clearFilters(fi,ei);ei.model.pivotControl=fi;break;case r._id+"_Ribbon_Analyze_Actions_MovePivotTable":w=n("#"+r._id+"_PvtDialog");f=r.getActiveSheetIndex();w.find(".e-ss-movepvttbl").show();w.find(".e-ss-changerange").hide();ft=r.getSheet(f).pivotMngr.pivot[r.element.find(".e-ss-activepivot")[0].id];n("#"+r._id+"_Ribbon_PvtLocation").val(r.getSheet(f).sheetInfo.text+"!$"+r._generateHeaderText(ft.colIndex+1)+"$"+(ft.rowIndex+1));w.data("ejDialog").option("title",r._getLocStr("MovePivotTable"));n("#"+r._id+"_dlg_existsheet").click();w.ejDialog("open");break;case r._id+"_Ribbon_Analyze_DataSource_Refresh":r.XLPivot.refreshDataSource();break;case r._id+"_Ribbon_Analyze_DataSource_ChangeDataSource":w=n("#"+r._id+"_PvtDialog");w.find(".e-ss-changerange").show();w.find(".e-ss-movepvttbl").hide();ft=r.getSheet(f).pivotMngr.pivot[r.element.find(".e-ss-activepivot")[0].id];u=ft.dataRange;bi=r.XLPivot._getSheetIdxFromName(ft.dataSheetName);n("#"+r._id+"_Ribbon_PvtRange").val(ft.dataSheetName+"!$"+r._generateHeaderText(u[1]+1)+"$"+(u[0]+1)+":$"+r._generateHeaderText(u[3]+1)+"$"+(u[2]+1));w.data("ejDialog").option("title",r._getLocStr("ChangePivotTableDataSource"));w.ejDialog("open");break;case r._id+"_Ribbon_ChartDesign_Type_ChangeChartType":r._showDialog(this._id);r.XLRibbon._refreshChartTypeDlg();break;case r._id+"_Ribbon_Insert_Illustrations_Pictures":if(r.model.importSettings.importMapper.length<1){r._showAlertDlg("Alert","ImportExportUrl","",266);return}r._uploadImage=!0;n("#"+r._id+"_file .e-uploadinput").click();r.XLRibbon._toggleFormatTab();break;case r._id+"_Ribbon_Others_Formulas_NameManager":r.XLRibbon._openNameManagerDlg();r.XLRibbon._isNmgrid="NameManager";break;case r._id+"_Ribbon_Others_Formulas_DefineName":r._showDialog(r._id+"_Ribbon_Others_NameManager");lt=n("#"+r._id+"_nmgrid").data("ejGrid");lt.getContentTable().find("td").addClass("e-ss-emptyrecord");lt.model.dataSource.length<1?lt.getContentTable().find("td").addClass("e-ss-emptyrecord"):lt.getContentTable().find(".e-ss-emptyrecord").removeClass("e-ss-emptyrecord");r.XLRibbon._refreshNMDlg();r.XLRibbon._isNmgrid="DefineName";break;case r._id+"_Ribbon_Others_Window_FreezePanes":switch(i.ID){case"freezePanes":r.XLFreeze.freezePanes();break;case"FreezeTopRow":r.XLFreeze.freezeTopRow();break;case"FreezeFirstColumn":r.XLFreeze.freezeLeftColumn();break;case"UnFreezePanes":r.XLFreeze.unfreezePanes()}break;case r._id+"_Ribbon_Home_Alignment_Merge":t.isNullOrUndefined(i.ID)&&(r.mergeCenter=!0,r.mergeCells());switch(i.ID){case"MergeCells":r.mergeCells();break;case"MergeAcross":r.mergeAcrossCells();break;case"MergeAndCenter":r.mergeCenter=!0;r.mergeCells();break;case"UnmergeCells":r.unmergeCells(e.selectedRange)}break;case r._id+"_Ribbon_Home_Editing_AutoSum":nt=e.selectedRange;i.type==="click"?r.XLRibbon.autoSum("SUM",r._getAlphaRange(f,nt[0],nt[1],nt[2],nt[3])):r.XLRibbon.autoSum(i.ID.toUpperCase(),r._getAlphaRange(f,nt[0],nt[1],nt[2],nt[3]));break;case r._id+"_Ribbon_ChartDesign_ChartLayouts_AddChartElement":r.XLChart.updateChartElement(null,i.ID);break;case r._id+"_Ribbon_ChartDesign_Size_ChartWidth":r.XLRibbon._changeChartSize("height",i.value);break;case r._id+"_Ribbon_ChartDesign_Size_ChartHeight":r.XLRibbon._changeChartSize("width",i.value);break;case r._id+"_Ribbon_ChartDesign_Data_SwitchRowColumn":r.XLChart.switchRowColumn();break;case r._id+"_Ribbon_PictureColor":case r._id+"_Ribbon_Format_Border_PictureBorder":if(["weight","dashes",r._id+"picturecolor",""].indexOf(i.ID)===-1){ht=r.getSheetElement(f).find(".e-ss-activeimg");oi=new RegExp("\\be-shapebdr.*?\\b","g");o=ht[0].className.match(oi)?r.XLShape._getImgStyleFromHashCode(ht[0].className.match(oi)[0]):{"border-color":"transparent","border-width":"1px","border-style":"solid"};var si=o["border-color"],pi=o["border-width"],o=o["border-style"];if(ht[0]){switch(!0){case this._id.indexOf("PictureColor")>-1:si=i.value;break;case i.ID.indexOf("px")>-1:pi=i.ID;break;case i.ID==="nooutline":si="transparent";break;default:o=i.ID}r.XLShape.changePictureBorder(ht[0].id,pi,o,si)}}break;case r._id+"_Ribbon_Format_Adjust_ResetPicture":r.XLShape.resetPicture(null,i.ID);break;case r._id+"_Ribbon_Format_Adjust_ChangePicture":r._uploadImage=!0;r.XLShape._changePicture=!0;r.element.find("#"+r._id+"_file .e-uploadinput").click();r.XLRibbon._toggleFormatTab();break;case r._id+"_Ribbon_ChartDesign_Data_SelectData":r._showDialog(this._id);cid=document.getElementById(r._id+"_chart").value;p=r.XLChart._getShapeObj(cid,"chart");n("#"+r._id+"_crxaxis").val(p.xRange?r._getAlphaRange(f,p.xRange[0],p.xRange[1],p.xRange[2],p.xRange[3]):"");n("#"+r._id+"_cryaxis").val(p.yRange?r._getAlphaRange(f,p.yRange[0],p.yRange[1],p.yRange[2],p.yRange[3]):"");n("#"+r._id+"_crlaxis").val(p.lRange?r._getAlphaRange(f,p.lRange[0],p.lRange[1],p.lRange[2],p.lRange[3]):"");r._selectDataval={xRange:n("#"+r._id+"_crxaxis").val(),yRange:n("#"+r._id+"_cryaxis").val(),lRange:n("#"+r._id+"_crlaxis").val()};n("#"+r._id+"_chartrangedlg").ejDialog("open");n("#"+r._id+"_crxaxis").focus().setInputPos(0);break;case r._id+"_Ribbon_ChartDesign_ChartThemes_ChartThemes":r.XLChart.changeTheme(r.element.find("#"+r._id+"_chart").val(),this._selectedValue);break;case r._id+"_Ribbon_Review_Changes_LockCell":r.lockCells(null,i.model.toggleState);break;case r._id+"_Ribbon_Review_Changes_ProtectSheet":r.protectSheet(i.model.toggleState);break;case r._id+"_Ribbon_Review_Changes_ProtectWorkbook":r._showDialog(this._id);hi=n("#"+r._id+"_PasswordDialog").data("ejDialog");r.model.exportSettings.password||(hi.option("title",r._getLocStr("ProtectWorkbook")),n("#"+r._id+"_confirm").show());hi.open()}(this._id.indexOf("Comment")<0&&this._id.indexOf("FindSelect")<0||r.XLSearch._isApplied)&&(r.setSheetFocus(),r.XLSearch._isApplied=!1);r._isRibbonClick=!1}},_applyTextIndent:function(n,i,r,u){var f=this.XLObj,v=f.getActiveSheetIndex(),y={},e=t.Spreadsheet.SupportedStyles,p,w,b,h,c,o,s,l=f.getCell(n.rowIndex,n.colIndex),a=f.getSheet(v);if(c=f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value2"),o=f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value"),!(u._id.indexOf("DecreaseIndent")<0)||!f._hasClass(l[0],"e-sswraptext")||!(Math.round(4/3*r)+f._detailsFromGlobalSpan(n.rowIndex,n.colIndex,"width","W")>a.columnsWidthCollection[n.colIndex])){if(f.isFormula(o)&&(o=c),!i[e.TextIndent]&&u._id===f._id+"_Ribbon_Home_Alignment_DecreaseIndent"||r<0)return!1;i[e.TextIndent]=r+"pt";(i[e.TextAlign]==="center"||f.isNumber(o)&&!i[e.TextAlign])&&(i[e.TextAlign]="left");y.style=i;f.XLFormat.format(y,[n.rowIndex,n.colIndex,n.rowIndex,n.colIndex]);!i[e.TextIndent]||f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge")||f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"mergeIdx")||(s=l.outerHeight(),s>=f.model.rowHeight&&(l.parent().outerHeight(s),a.rowsHeightCollection[n.rowIndex]=s,f._fRowHtColl[n.rowIndex]=s,f._setRowHdrHeight(v,n.rowIndex)),p=f._detailsFromGlobalSpan(n.rowIndex,n.colIndex,"width",c,null,!0),b=4/3*r,w=Math.round(b+p),h=a.columnsWidthCollection[n.colIndex],f.XLResize&&f.isNumber(o)&&u._id===f._id+"_Ribbon_Home_Alignment_IncreaseIndent"&&w>=h&&f.XLResize.setColWidth(n.colIndex,8+h))}},_changeChartSize:function(t,i){if(!this._ctrlCreated){var r=this.XLObj,c,s=r.XLEdit.getPropertyValue(r.XLShape._picCellIdx.rowIndex,r.XLShape._picCellIdx.colIndex,"chart")[0],f=document.getElementById(r._id+"_chart").value,u=n("#"+f).ejChart("instance"),o=n("#"+f),h=r.XLChart._getShapeObj(f,"chart"),e={sheetIndex:r.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:t,cid:f,rowIndex:r.XLShape._picCellIdx.rowIndex,colIndex:r.XLShape._picCellIdx.colIndex,prev:{width:u.model.size.width,height:u.model.size.height}};c=u.model.size;t==="height"?(u.option("size",{width:i.toString()}),s.width=i,h.width=i,o[0].style.width=i+"px",e.cur={width:i.toString(),height:u.model.size.height}):(u.option("size",{height:i.toString()}),s.height=i,h.height=i,o[0].style.height=i+"px",e.cur={width:u.model.size.width,height:i.toString()});r.XLChart._afterChartRefresh();r._completeAction(e);r._trigActionComplete(e);r.XLShape._shapeType="chart";r.XLShape._updateShapeObj(o[0]);r.XLShape._shapeType="img"}},_updateBordeStyle:function(n){var t=this.XLObj;t._borderStyle=n.ID&&n.ID.length>0&&n.ID},_colorPickerHandler:function(t,i){var u,r=this.XLObj,f;i.type==="open"?(n("#"+r._id+"_"+t+"_popup").find(".e-buttons, .e-button").hide(),n("#"+r._id+"_"+t+"_popup").focus()):i.type==="change"&&(u=r.XLFormat,f=n("#"+r._id+"_"+t).data("ejColorPicker"),t==="Ribbon_Home_Font_FontColor"?(u.format({style:{color:i.value}}),n("#"+r._id+"_Ribbon_home_Font_Color").find(".e-selected-color").css("background-color",i.value)):(u.format({style:{"background-color":i.value}}),n("#"+r._id+"_Ribbon_home_Font_Background").find(".e-selected-color").css("background-color",i.value)),f.hide(),r._dupDetails=!0,f.setValue(i.value),r._dupDetails=!1)},updateRibbonIcons:function(){this._updateRibbonIcons()},_updateRibbonIcons:function(){var i=this.XLObj,k=i.getActiveSheetIndex(),e=i.getSheet(k),r,a,b;if(this.XLObj.model.showRibbon&&(!e._isImported||e._isLoaded)){var y,p,d,w,v,u,o,s=n("#"+i._id+"_Ribbon_Home_Number_NumberFormat").data("ejDropDownList"),h,c=n("#"+i._id+"_Ribbon_Home_Font_FontSize").data("ejDropDownList"),g=!1;n("#"+i._id+"_Ribbon_Home_Font_FontSize").css("width","auto");var l=n("#"+i._id+"_Ribbon_Home_Font_FontFamily").data("ejDropDownList"),f=-1,nt=n("#"+i._id+"_Ribbon").data("ejRibbon"),tt=nt.getTabText(nt.model.selectedItemIndex);switch(tt){case i._getLocStr("HOME"):if(o=e._activeCell,w=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"wrap"),d=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"merge"),format=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"format"),v=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"type"),t.isNullOrUndefined(i.XLFormat)||(u=i.XLFormat.getFormatFromHashCode(format)),i.isUndefined(w)&&(w=!1),n("#"+i._id+"_Ribbon_Home_Alignment_WrapText").ejToggleButton("option",{toggleState:w}),i.isUndefined(d)?(n("#"+i._id+"_Ribbon_Home_Alignment_Merge").removeClass("e-ss-active"),n("#"+i._id+"_Ribbon_Home_Alignment_Mergedrpbtn").removeClass("e-ss-active")):(n("#"+i._id+"_Ribbon_Home_Alignment_Merge").addClass("e-ss-active"),n("#"+i._id+"_Ribbon_Home_Alignment_Mergedrpbtn").addClass("e-ss-active")),["date"].indexOf(v)>-1&&(v="custom"),v)for(f=-1,r=0,a=this._numberFormat.length;r<a;r++)if(v===this._numberFormat[r].text.toLowerCase()){f=r;break}if(t.isNullOrUndefined(s)||(s._initValue=!0,f>-1?s.option({selectedItemIndex:f}):!t.isNullOrUndefined(s.selectedIndexValue)&&s.selectedIndexValue!=0&&s.option({selectedItemIndex:0}),s._initValue=!1),u){if(f=-1,!t.isNullOrUndefined(u["font-size"]))for(r=0,a=this._fontSize.length;r<a;r++)if(u["font-size"]===this._fontSize[r].value){f=r;break}if(!t.isNullOrUndefined(c)&&(c._initValue=!0,f>-1?c.option({selectedItemIndex:f})||(f=-1):!t.isNullOrUndefined(c.selectedIndexValue)&&c.selectedIndexValue!=3&&c.option({selectedItemIndex:3}),c._initValue=!1,f=-1,!t.isNullOrUndefined(u["font-family"])))for(r=0,a=this._fontFamily.length;r<a;r++)if(u["font-family"]===this._fontFamily[r].text.toLowerCase()){f=r;break}t.isNullOrUndefined(l)||(l._initValue=!0,f>-1?l.option({selectedItemIndex:f}):!t.isNullOrUndefined(l.selectedIndexValue)&&l.selectedIndexValue!=6&&l.option({selectedItemIndex:6}),l._initValue=!1);n("#"+i._id+"_Ribbon_Home_Font_Bold").length&&(u["font-weight"]=="bold"?n("#"+i._id+"_Ribbon_Home_Font_Bold").data("ejToggleButton").option("toggleState",!0):n("#"+i._id+"_Ribbon_Home_Font_Bold").data("ejToggleButton").option("toggleState",!1));n("#"+i._id+"_Ribbon_Home_Font_Italic").length&&(u["font-style"]=="italic"?n("#"+i._id+"_Ribbon_Home_Font_Italic").data("ejToggleButton").option("toggleState",!0):n("#"+i._id+"_Ribbon_Home_Font_Italic").data("ejToggleButton").option("toggleState",!1));u["text-decoration"]=u["text-decoration"]||"";n("#"+i._id+"_Ribbon_Home_Font_Underline").length&&n("#"+i._id+"_Ribbon_Home_Font_Underline").data("ejToggleButton").option("toggleState",u["text-decoration"].indexOf("underline")!==-1);n("#"+i._id+"_Ribbon_Home_Font_StrikeThrough").length&&n("#"+i._id+"_Ribbon_Home_Font_StrikeThrough").data("ejToggleButton").option("toggleState",u["text-decoration"].indexOf("line-through")!==-1);this._tglAlignBtn(n(i.element).find(".e-text-align"),u,"text-align");g=this._tglAlignBtn(n(i.element).find(".e-vertical-align"),u,"vertical-align").isVertical;g||(h=i.element.find("#"+i._id+"_Ribbon_Home_Alignment_BottomAlign"),h.length&&(h.data("ejToggleButton").option("toggleState",!0),h.addClass("e-vertical-align")));i.getSheetElement(k).find(".e-ss-activeimg").length>0&&(h=i.element.find("#"+i._id+"_Ribbon_Home_Alignment_Merge"),h.length&&h.data("ejSplitButton").option("enabled",!1))}break;case i._getLocStr("REVIEW"):b=n("#"+i._id+"_Ribbon_Review_Changes_LockCell");!i.model.allowLockCell||i.XLComment&&i.XLComment._isCommentEdit||i.XLEdit._isEdit||i._isSheetRename||!b.length||(p=b.data("ejToggleButton"),y=i.XLEdit.getPropertyValue(e._activeCell.rowIndex,e._activeCell.colIndex,"isLocked"),i.isUndefined(y)&&(y=!1),p.option("toggleState",y),n("#"+i._id+"_Ribbon_Review_Changes_ProtectSheet").length&&n("#"+i._id+"_Ribbon_Review_Changes_ProtectSheet").data("ejToggleButton").option("toggleState",e.isSheetProtected),e.isSheetProtected?p.disable():p.enable());e.isSheetProtected&&i.model.allowLockCell||!i.model.allowComments||i.XLComment._isCommentEdit||i.XLEdit._isEdit||i._isSheetRename||i.XLComment._updateCmntRibIcons(i.getActiveCell())}!i.model.allowLockCell||e.isSheetProtected||!i.model.allowComments||i.XLComment._isCommentEdit||i._isSheetRename||this._refreshRibbonIcons(tt);i.model.isReadOnly&&i._readOnly()}},_tglAlignBtn:function(n,i,r){var e=!1,u,f=this.XLObj;return t.isNullOrUndefined(n[0])||(u=f.element.find("#"+n[0].id),u.length&&u.data("ejToggleButton").option("toggleState",!1),n.removeClass("e-"+r)),t.isNullOrUndefined(i[r])||(u=r==="vertical-align"?f.element.find("#"+f._id+"_Ribbon_Home_Alignment_"+i[r].charAt(0).toUpperCase()+i[r].slice(1)+"Align"):f.element.find("#"+f._id+"_Ribbon_Home_Alignment_Align"+i[r].charAt(0).toUpperCase()+i[r].slice(1)),u.length&&(u.data("ejToggleButton").option("toggleState",!0),u.addClass("e-"+r)),r==="vertical-align"&&(e=!0)),{isVertical:e}},_disableButtons:function(n,i){for(var e=-1,f,r=this.XLObj,u=0,o=n.length;u<o;u++)r.model.allowLockCell&&(r.XLEdit._isEdit||r._isSheetRename||!r.getSheet(r.getActiveSheetIndex()).isSheetProtected||(e=this._protectStateBtnIds.indexOf(n[u]))),e===-1&&(f=r.element.find("#"+r._id+"_Ribbon_"+n[u]),f.length&&!t.isNullOrUndefined(f.data(i))&&f.data(i).disable())},_enableButtons:function(n,i){for(var e=0,f,r=this.XLObj,u=0,o=n.length;u<o;u++)r.model.allowLockCell&&!r._isSheetRename&&r.getSheet(r.getActiveSheetIndex()).isSheetProtected&&(e=this._protectStateBtnIds.indexOf(n[u])),e>-1&&(f=r.element.find("#"+r._id+"_Ribbon_"+n[u]),f.length&&!t.isNullOrUndefined(f.data(i))&&f.data(i).enable())},_disableInputs:function(t,i){for(var r=0,u=t.length;r<u;r++)n("#"+this.XLObj._id+"_"+t[r]).attr("disabled",i)},_enableRibbonIcons:function(t){if(this.XLObj.model.showRibbon){var c,i=this.XLObj,r=n("#"+i._id+"_Ribbon").data("ejRibbon"),l=i.getActiveSheetIndex(),f=i.getSheet(l)._filterColl,h,u,e,o,s;c=t?t:r.model.selectedItemIndex;switch(r.getTabText(c)){case i._getLocStr("HOME"):this._enableButtons(this._homeBtnIds,"ejButton");this._enableButtons(this._homeSptBtnIds,"ejSplitButton");this._enableButtons(this._homeToggleBtnIds,"ejToggleButton");this._enableButtons(this._homeDdIds,"ejDropDownList");this._enableButtons(this._homeCpIds,"ejColorPicker");i._removeClass(r.element.find("#"+r._id+"_Number_e-groupexpander")[0],"e-disable");break;case i._getLocStr("INSERT"):this._enableButtons(this._insertBtnIds,"ejButton");this._enableButtons(this._insertSptBtnIds,"ejSplitButton");break;case i._getLocStr("DATATAB"):this._enableButtons(this._dataBtnIds,"ejButton");this._enableButtons(this._dataSptBtnIds,"ejSplitButton");break;case i._getLocStr("PAGELAYOUT"):this._enableButtons(this._pageLayBtnIds,"ejButton");this._enableButtons(this._pageLaySptBtnIds,"ejSplitButton");this._enableButtons(this._pageLayChckBxIds,"ejCheckBox");n("#"+r._id+"_pagesetup_viewhdrlbl").eq(0).removeClass("e-disable");n("#"+r._id+"_pagesetup_viewgrdlnlbl").eq(0).removeClass("e-disable");break;case i._getLocStr("REVIEW"):i.model.allowComments&&!i.XLComment._isCommentEdit&&i.XLComment._updateCmntRibIcons();this._enableButtons(this._reviewTglBtnIds,"ejToggleButton");break;case i._getLocStr("OTHERS"):this._enableButtons(this._othersBtnIds,"ejButton");this._enableButtons(this._othersSptBtnIds,"ejSplitButton");break;case i._getLocStr("Design"):this._enableButtons(this._contextualBtnIds,"ejButton");this._enableButtons(this._contextualCheckBoxIds,"ejCheckBox");this._disableInputs(this._contextualInputIds,!1)}for(i.XLClipboard._copyBackup.cells||i.XLClipboard._copyBackup.elem||(i.XLRibbon._disableButtons(["Home_Clipboard_Paste"],"ejButton")||i.XLRibbon._disableButtons(["Home_Clipboard_PasteOptions"],"ejSplitButton"),i.isPasteValuesOnly&&n("#"+i._id+"_Ribbon_Paste").data("ejMenu").disableItemByID("PasteSpecial")),n.isEmptyObject(f)&&this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton"),s=i.getObjectKeys(f),u=0,o=s.length;u<o;u++)for(h=i.getObjectKeys(f[s[u]]),e=0,o=h.length;e<o;e++)f[s[u]][h[e]].status.indexOf("e-ssfiltered")<0&&this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton");i._updateUndoRedoIcons()}},_disableRibbonIcons:function(){var t=this.XLObj,i;if(t.model.showRibbon){i=n("#"+t._id+"_Ribbon").data("ejRibbon");switch(i.getTabText(i.model.selectedItemIndex)){case t._getLocStr("HOME"):this._disableButtons(this._homeBtnIds,"ejButton");this._disableButtons(this._homeSptBtnIds,"ejSplitButton");this._disableButtons(this._homeToggleBtnIds,"ejToggleButton");this._disableButtons(this._homeDdIds,"ejDropDownList");this._disableButtons(this._homeCpIds,"ejColorPicker");t.addClass(i.element.find("#"+i._id+"_Number_e-groupexpander"),"e-disable");break;case t._getLocStr("INSERT"):this._disableButtons(this._insertBtnIds,"ejButton");this._disableButtons(this._insertSptBtnIds,"ejSplitButton");break;case t._getLocStr("DATATAB"):this._disableButtons(this._dataBtnIds,"ejButton");this._disableButtons(this._dataSptBtnIds,"ejSplitButton");break;case t._getLocStr("PAGELAYOUT"):this._disableButtons(this._pageLayBtnIds,"ejButton");this._disableButtons(this._pageLaySptBtnIds,"ejSplitButton");this._disableButtons(this._pageLayChckBxIds,"ejCheckBox");n("#"+i._id+"_pagesetup_viewhdrlbl:eq(0)").addClass("e-disable");n("#"+i._id+"_pagesetup_viewgrdlnlbl:eq(0)").addClass("e-disable");break;case t._getLocStr("REVIEW"):this._disableButtons(this._cmntBtnIds,"ejButton");this._disableButtons(this._cmntTglBtnIds,"ejToggleButton");this._disableButtons(this._reviewTglBtnIds,"ejToggleButton");break;case t._getLocStr("OTHERS"):this._disableButtons(this._othersBtnIds,"ejButton");this._disableButtons(this._othersSptBtnIds,"ejSplitButton");break;case this.XLObj._getLocStr("Design"):this._disableButtons(this._contextualBtnIds,"ejButton");this._disableButtons(this._contextualCheckBoxIds,"ejCheckBox");this._disableInputs(this._contextualInputIds,!0)}}},_capitalize:function(n){return n[0].toUpperCase()+n.slice(1)},_generateToggleBtn:function(n,i,r,u,f,e,o,s,h,c,l,a,v,y){var p=s instanceof Array?this.XLObj._getLocStr(s[0])+"<br /><br />"+this.XLObj._getLocStr(s[1]):this.XLObj._getLocStr(s);return{id:n,toolTip:this.XLObj._getLocStr(i),type:t.Ribbon.type.toggleButton,enableSeparator:h,toggleButtonSettings:{width:e,height:o,contentType:r,cssClass:c,toggleState:y,defaultPrefixIcon:u,activePrefixIcon:v?v:u,defaultText:this.XLObj._getLocStr(i),activeText:a?this.XLObj._getLocStr(a):this.XLObj._getLocStr(i),imagePosition:l=="imagetop"?t.ImagePosition.ImageTop:t.ImagePosition.ImageLeft,click:this._ribbonClickHandler},customToolTip:{title:this.XLObj._getLocStr(f),content:"<h6>"+p+"<\/h6>"}}},_generateBtn:function(n,i,r,u,f,e,o,s,h,c,l){var a=s instanceof Array?this.XLObj._getLocStr(s[0])+"<br /><br />"+this.XLObj._getLocStr(s[1]):this.XLObj._getLocStr(s);return{id:n,text:this.XLObj._getLocStr(i),toolTip:this.XLObj._getLocStr(i),cssClass:l,enableSeparator:h,buttonSettings:{type:t.Ribbon.type.button,contentType:r,width:f,height:e,imagePosition:c=="imagetop"?t.ImagePosition.ImageTop:t.ImagePosition.ImageLeft,prefixIcon:u,click:this._ribbonClickHandler},customToolTip:{title:this.XLObj._getLocStr(o),content:"<h6>"+a+"<\/h6>"}}},_generateDD:function(n,i,r,u,f,e,o,s){return{id:n,text:this.XLObj._getLocStr(i),toolTip:this.XLObj._getLocStr(i),type:t.Ribbon.type.dropDownList,dropdownSettings:{dataSource:r,value:u,change:this._ribbonClickHandler,width:f,height:e-1,cssClass:"e-"+this.XLObj._id+"-ddl"},customToolTip:{title:this.XLObj._getLocStr(o),content:"<h6>"+this.XLObj._getLocStr(s)+"<\/h6>"}}},_generateCustomControl:function(n,i,r,u){return{type:t.Ribbon.type.custom,contentID:n,toolTip:this.XLObj._getLocStr(i),click:this._ribbonClickHandler,change:this._ribbonClickHandler,customToolTip:{title:this.XLObj._getLocStr(r),content:"<h6>"+this.XLObj._getLocStr(u)+"<\/h6>"}}},_generateSplitBtn:function(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w){var b=w instanceof Array?this.XLObj._getLocStr(w[0])+"<br /><br />"+this.XLObj._getLocStr(w[1]):this.XLObj._getLocStr(w);return{id:i,toolTip:this.XLObj._getLocStr(r),text:this.XLObj._getLocStr(r),type:t.Ribbon.type.splitButton,cssClass:y+" e-"+this.XLObj._id+"-spltbtn",enableSeparator:s,splitButtonSettings:{contentType:u,targetID:f,arrowPosition:l=="bottom"?t.ArrowPosition.Bottom:t.ArrowPosition.Right,imagePosition:a=="imagetop"?t.ImagePosition.ImageTop:t.ImagePosition.ImageLeft,buttonMode:v=="dropdown"?t.ButtonMode.Dropdown:t.ButtonMode.Split,fields:e,prefixIcon:o,click:this._ribbonClickHandler,itemSelected:this._ribbonClickHandler,height:c,width:h,beforeOpen:n.proxy(this._splitBeforeOpen,this,i),close:i==="Others_Cells_InsertCellOptions"||i==="Others_Cells_DeleteCellOptions"||i==="Data_DataTools_DataValidationOptions"||i==="Home_Clipboard_PasteOptions"?n.proxy(this._splitbtnClose,this,i):null},customToolTip:{title:this.XLObj._getLocStr(p),content:"<h6>"+b+"<\/h6>"}}},_splitBeforeOpen:function(t,i){var r=this.XLObj,u;t==="Home_Editing_SortFilter"?this._sfbeforeOpen(i):t==="Others_Cells_InsertCellOptions"||t==="Others_Cells_DeleteCellOptions"?this._insdelbeforOpen(i):t==="Others_Window_FreezePanes"?this._fpbeforeOpen(i):t==="ChartDesign_ChartLayouts_AddChartElement"?this._celementpbeforeOpen(i):t==="Data_DataTools_DataValidationOptions"||t==="Home_Clipboard_PasteOptions"?this._validpasteOpen(i):t==="Home_Editing_Clear"?this._clearbeforeOpen(i):t==="Home_Styles_FormatAsTable"?(u=document.getElementById(r._id+"_formatastable"),u&&(!u||u.children.length)||this._renderFormatAsTable(),r.XLFormat._resizeFormatTableMenu()):t==="Home_Styles_CellStyles"?r.XLFormat._resizeStyleMenu():t==="Home_Font_Border"?r.XLFormat._resizeBorderMenu(i):t==="Home_Styles_ConditionalFormatting"&&(r._phoneMode?n("#"+r._id+"_CFormat").find("ul").addClass("e-adaptive"):n("#"+r._id+"_CFormat").find("ul").removeClass("e-adaptive"))},_splitbtnClose:function(n){this.XLObj.element.find("#"+this.XLObj._id+"_Ribbon_"+n).parents("div.e-controlpadding").siblings().children("button").removeClass("e-active")},_fpbeforeOpen:function(){var i=this.XLObj,r=n("#"+i._id+"_Ribbon_FPane").data("ejMenu"),t=r.model.fields.dataSource.slice(0);i.getSheet()._isFreezed?(t[0].id="UnFreezePanes",t[0].text=i._getLocStr("UnFreezePanes")):(t[0].id="freezePanes",t[0].text=i._getLocStr("FreezePanes"));r.option("fields",{id:"id",dataSource:t,parentId:"parentId"})},_sfbeforeOpen:function(){var t=this.XLObj,i=n("#"+t._id+"_Ribbon_SortFilter").data("ejMenu");t.model.allowFiltering||i.disableItemByID("Ribbon_Filter");t.model.allowSorting||(i.disableItemByID("Ribbon_SortAtoZ"),i.disableItemByID("Ribbon_SortZtoA"));this._refreshRibbonIcons()},_validpasteOpen:function(n){var t=this.XLObj;n.model.targetID===t._id+"_Ribbon_Validation"?t.element.find("#"+t._id+"_Ribbon_Data_DataTools_DataValidation").addClass("e-active"):t.element.find("#"+t._id+"_Ribbon_Home_Clipboard_Paste").addClass("e-active")},_insdelbeforOpen:function(t){var i=this.XLObj,r=n("#"+i._id+"_Ribbon_Ins").data("ejMenu"),u=n("#"+i._id+"_Ribbon_Del").data("ejMenu"),h=["DeleteCells","DeleteSheetRows","DeleteSheetColumns"],c=["InsertCells","InsertSheetRows","InsertSheetColumns"],e,o,s,f;if(t.model.targetID===i._id+"_Ribbon_Ins"?i.element.find("#"+i._id+"_Ribbon_Others_Cells_InsertCell").addClass("e-active"):i.element.find("#"+i._id+"_Ribbon_Others_Cells_DeleteCell").addClass("e-active"),e=i.element.find(".e-colselected").length?"disableItemByID":"enableItemByID",r&&r[e]("InsertSheetRows"),u&&u[e]("DeleteSheetRows"),o=i.element.find(".e-rowselected").length?"disableItemByID":"enableItemByID",r&&r[o]("InsertSheetColumns"),u&&u[o]("DeleteSheetColumns"),s=i.model.exportSettings.password?"disableItemByID":"enableItemByID",r&&r[s]("InsertSheet"),u&&u[s]("DeleteSheet"),i.getSheet(i.getActiveSheetIndex()).isSheetProtected)for(f=0;f<3;f++)u&&u.disableItemByID(h[f]),r&&r.disableItemByID(c[f]);else u&&u.enableItemByID("DeleteCells"),r&&r.enableItemByID("InsertCells")},_celementpbeforeOpen:function(){var t=this.XLObj;if(chartEle=n("#"+t._id+"_chart").val(),chType=t.XLChart._getShapeObj(chartEle,"chart").type,cEleMenuObj=n("#"+t._id+"_Ribbon_CElement").data("ejMenu"),pieChart=["Axes","AxisTitle","Gridline"],radarChart=["AxisTitle","PMinorH","PMinorV"],menuEle=["Axes","AxisTitle","Gridline","PMinorH","PMinorV"],i,len=0,cEleMenuObj)return!1;for(i=0,len=menuEle.length;i<len;i++)cEleMenuObj.enableItemByID(menuEle[i]);if(chType==="pie"||chType==="doughnut")for(i=0,len=pieChart.length;i<len;i++)cEleMenuObj.disableItemByID(pieChart[i]);else if(chType==="radar")for(i=0,len=radarChart.length;i<len;i++)cEleMenuObj.disableItemByID(radarChart[i])},_clearbeforeOpen:function(){var i=this.XLObj,t=0,u=n("#"+i._id+"_Ribbon_Clear").data("ejMenu"),r=["Clear_Hyperlinks","Clear_Comments"];if(i.model.allowLockCell)if(i.getSheet(i.getActiveSheetIndex()).isSheetProtected)while(t<r.length)u.disableItemByID(r[t]),t++;else while(t<r.length)u.enableItemByID(r[t]),t++},_changeClrFltrStatus:function(n,t){var i=this.XLObj,r=i.getActiveSheetIndex();i.isUndefined(n)||(this._isFilterSelect.isFiltered?t==="menu"?n._id.indexOf("Ribbon")>-1?n.enableItemByID("Ribbon_ClearFilter"):n.enableItemByID("ClearFilter"):n.enable():t==="menu"?n._id.indexOf("Ribbon")>-1?n.disableItemByID("Ribbon_ClearFilter"):n.disableItemByID("ClearFilter"):n.disable())},_onControlCreated:function(){this._ctrlCreated=!0;xlRbn=n("#"+this.XLObj._id+"_Ribbon").ejRibbon("instance");this.XLObj.model.ribbonSettings.enableOnDemand||(this._homeTabControls(),this._othersTabControls(),this._pageTabControls(),this._appTabControls());this._hideTabs();this._ctrlCreated=!1},_appTabControls:function(){var r=this.XLObj,u=r.element,i=r._id,t={height:158,width:163,text:r._getLocStr("BlankWorkbook"),contentType:"textandimage",imagePosition:"imagetop",prefixIcon:"e-ss-blank",click:n.proxy(this._onBackStageItemClick,this)};n("#"+i+"_bstab_new_blank").ejButton(t);delete t.text;t.height=t.width=72;t.prefixIcon="e-icon e-ss-exportxl";n("#"+i+"_bstab_saveas_excel").ejButton(t);t.prefixIcon="e-icon e-ss-exportcsv";n("#"+i+"_bstab_saveas_csv").ejButton(t);t.prefixIcon="e-icon e-ss-exportpdf";n("#"+i+"_bstab_saveas_pdf").ejButton(t);t.prefixIcon="e-icon e-ss-print";n("#"+i+"_bstab_print_sheet").ejButton(t);t.prefixIcon="e-icon e-ss-printselected";n("#"+i+"_bstab_print_selected").ejButton(t)},_othersTabControls:function(){var n=this.XLObj;!n.model.allowInsert&&n.model.scrollSettings.allowScrolling&&(this._disableButtons(["Others_Cells_InsertCellOptions"],"ejSplitButton"),this._disableButtons(["Others_Cells_InsertCell"],"ejButton"));!n.model.allowDelete&&n.model.scrollSettings.allowScrolling&&(this._disableButtons(["Others_Cells_DeleteCellOptions"],"ejSplitButton"),this._disableButtons(["Others_Cells_DeleteCell"],"ejButton"))},_pageTabControls:function(){var t=this.XLObj,r=t._id,i=r+"_Ribbon_pagesetup",u=r+"_Ribbon_PageLayout_Show_";n("#"+i+"left").show();n("#"+u+"Headings").ejCheckBox({change:this._ribbonClickHandler,checked:!0});n("#"+u+"Gridlines").ejCheckBox({change:this._ribbonClickHandler,checked:!0});n("#"+i+"_viewhdrlbl").text(t._getLocStr("Heading"));n("#"+i+"_viewgrdlnlbl").text(t._getLocStr("Gridlines"))},_homeTabControls:function(){var u=this.XLObj,i=u._id,f=u.element,r=i+"_Ribbon_",t=r+"Home_Font_";n("#"+t+"FillColor").ejColorPicker({value:"#FFFF00",modelType:"palette",showSwitcher:!1,cssClass:"e-ss-colorpicker",toolIcon:"e-ss-backgroundcolor",open:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FillColor"),change:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FillColor"),select:n.proxy(this._cpClickHandler,this,"Ribbon_Home_Font_FillColor")});n("#"+t+"FontColor").ejColorPicker({value:"#FF0000",modelType:"palette",showSwitcher:!1,cssClass:"e-ss-colorpicker",toolIcon:"e-ss-fontcolor",open:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FontColor"),change:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FontColor"),select:n.proxy(this._cpClickHandler,this,"Ribbon_Home_Font_FontColor")});n("#"+t+"BorderColor").ejColorPicker({modelType:"palette",presetType:"basic",cssClass:"e-ss-colorpicker e-ss-menuclrpkr",change:this._ribbonClickHandler});n("#"+t+"BorderColorWrapper").hide();n("#"+i+"_bordercolor ul li").find("a").remove();n("#"+i+"_bordercolor ul li").append(n("#"+t+"BorderColor_popup"));n("#"+t+"BorderColor_popup").css({display:"block"});n("#"+r+"BorderCP").ejColorPicker({value:"#278787",displayInline:!0,modelType:"picker"});n("#"+r+"BorderCP_Presets").hide();n("#"+i+"_CFormat").width(200);n("#"+r+"Border").addClass("e-spreadsheet e-border");n("#"+t+"FontColor_Presets").css({top:"40px"});n("#"+t+"FillColor_Presets").css({top:"40px"});this._disableButtons(["Home_Clipboard_Paste"],"ejButton");this._disableButtons(["Home_Clipboard_PasteOptions","Others_Formulas_UseInFormula"],"ejSplitButton");n("#"+t+"FillColor_popup").find(".e-buttons, .e-button").hide();n("#"+t+"FontColor_popup").find(".e-buttons, .e-button").hide()},_hideRibbonElem:function(t){var f=this.XLObj,o=f._id,s=n("#"+f._id+"_Ribbon").data("ejRibbon"),i=f.model,r=s.element,u=o+"_Ribbon",y=u+"_home_Clipboard_Home_Clipboard_",e=u+"_home_Alignment_Home_Alignment_",p=u+"_separator_Home_Alignment_",a=u+"_home_Styles_Home_Styles_",b=u+"_home_Font_Home_Font_",k=u+"_home_Number_Home_Number_",w=u+"_home_Editing_Home_Editing_",h=u+"_insert_",v=u+"_data_",d=u+"_pagelayout_PageLayout",g=u+"_review_Changes_Review_Changes_",c=u+"_others_",l;i.allowFormulaBar||f.hideFormulaBar();switch(t){case f._getLocStr("HOME"):i.allowAutoSum||i.allowFiltering||i.allowUndoRedo||i.allowSorting||i.allowClipboard||i.allowFormatPainter||i.allowCellFormatting||i.allowMerging||i.allowWrap||i.allowConditionalFormats||i.allowFormatAsTable||s.hideTab(f._getLocStr("HOME"));i.allowFormatPainter||r.find("#"+y+"FormatPainter").hide();i.allowClipboard||(r.find("#"+u+"_home_Clipboard_1").hide(),r.find("#"+y+"Cut").hide(),r.find("#"+y+"Copy").hide());i.allowClipboard||i.allowFormatPainter||r.find("#"+u+"_home_Clipboard").hide();i.allowCellFormatting||(r.find("#"+u+"_home_Font").hide(),r.find("#"+u+"_home_Number").hide(),r.find("#"+e+"TopAlign").hide(),r.find("#"+e+"MiddleAlign").hide(),r.find("#"+e+"BottomAlign").hide(),r.find("#"+p+"BottomAlign").hide(),r.find("#"+e+"AlignLeft").hide(),r.find("#"+e+"AlignCenter").hide(),r.find("#"+e+"AlignRight").hide(),r.find("#"+p+"AlignRight").hide(),r.find("#"+e+"DecreaseIndent").hide(),r.find("#"+e+"IncreaseIndent").hide(),r.find("#"+p+"IncreaseIndent").hide(),r.find("#"+a+"CellStyles").hide(),i.allowConditionalFormats||i.allowFormatAsTable||r.find("#"+u+"_home_Styles").hide());i.allowCellFormatting&&(i.formatSettings.allowFontFamily||r.find("#"+b+"FontFamily").hide(),i.formatSettings.allowDecimalPlaces||(r.find("#"+k+"IncreaseDecimal").hide(),r.find("#"+k+"DecreaseDecimal").hide(),r.find("#"+u+"_separator_Home_Number_CommaStyle").hide()),i.formatSettings.allowCellBorder||r.find("#"+b+"Border").hide());i.allowMerging||r.find("#"+e+"Merge").hide();i.allowWrap||r.find("#"+e+"WrapText").hide();i.allowUndoRedo||r.find("#"+u+"_home_Actions").hide();i.allowFormatAsTable||r.find("#"+a+"FormatAsTable").hide();i.allowConditionalFormats||i.allowFormatAsTable||i.allowCellFormatting||r.find("#"+u+"_home_Styles").hide();i.allowConditionalFormats||r.find("#"+a+"ConditionalFormatting").hide();i.allowEditing&&(i.allowAutoSum||r.find("#"+w+"AutoSum").hide(),i.allowSorting||i.allowFiltering||r.find("#"+f._id+"_Ribbon_home_Editing_1").hide());i.allowAutoSum||r.find("#"+w+"AutoSum").hide();i.allowClear||r.find("#"+w+"Clear").hide();break;case f._getLocStr("INSERT"):i.allowFormatAsTable||i.allowPictures||i.allowHyperlink||i.allowCharts||s.hideTab(f._getLocStr("INSERT"));i.enablePivotTable||i.allowFormatAsTable?i.enablePivotTable||r.find("#"+h+"Tables_Insert_Tables_PivotTable").hide():(r.find("#"+h+"Tables").hide(),r.find("#"+a+"FormatAsTable").hide(),r.find("#"+h+"Tables_Insert_Tables_PivotTable").hide());i.pictureSettings.allowPictures||r.find("#"+h+"Illustrations").hide();i.allowHyperlink||r.find("#"+h+"Links").hide();i.allowCharts||r.find("#"+h+"Charts").hide();i.allowFormatAsTable||i.enablePivotTable||r.find("#"+h+"Tables").hide();break;case f._getLocStr("DATATAB"):i.allowDataValidation||i.allowFiltering||i.allowSorting||s.hideTab(f._getLocStr("DATATAB"));i.allowFiltering||r.find("#"+v+"SortFilter_2").hide();i.allowSorting||r.find("#"+v+"SortFilter_1").hide();i.allowDataValidation||r.find("#"+v+"DataTools").hide();i.allowFiltering||i.allowSorting||r.find("#"+v+"Sort").hide();break;case f._getLocStr("PAGELAYOUT"):i.printSettings.allowPrinting||s.hideTab(f._getLocStr("PAGELAYOUT"));i.printSettings.allowPrinting||r.find("#"+d+"Print_Print").hide();i.printSettings.allowPageSize||r.find("#"+d).hide();i.allowComments||i.allowLockCell||s.hideTab(f._getLocStr("REVIEW"));i.allowLockCell||(r.find("#"+g+"ProtectSheet").hide(),r.find("#"+g+"LockCell").hide());i.allowComments||r.find("#"+u+"_review_Comments").hide();break;case f._getLocStr("OTHERS"):i.allowFreezing||i.allowInsert||i.allowDelete||i.allowSearching||s.hideTab(f._getLocStr("OTHERS"));i.allowInsert||i.allowDelete||r.find("#"+c+"Cells").hide();i.allowInsert||r.find("#"+c+"Cells_1").hide();i.allowDelete||r.find("#"+c+"Cells_2").hide();i.allowFreezing||(f._phoneMode?r.find("#"+c+"Window_1").hide():r.find("#"+c+"Window").hide());i.allowSearching||r.find("#"+c+"Editing").hide()}i.allowImport||r.find("#open_backStageTab").hide();i.serverEvents?(l=i.serverEvents,l.indexOf("excelExporting")<0&&!i.exportSettings.excelUrl&&r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").hide(),l.indexOf("csvExporting")<0&&!i.exportSettings.csvUrl&&r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").hide(),l.indexOf("pdfExporting")<0&&!i.exportSettings.pdfUrl&&r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").hide(),l.length||i.exportSettings.excelUrl||i.exportSettings.csvUrl||i.exportSettings.pdfUrl||r.find("#saveas_backStageTab").hide()):(i.exportSettings.excelUrl||r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").hide(),i.exportSettings.csvUrl||r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").hide(),i.exportSettings.pdfUrl||r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").hide(),i.exportSettings.allowExporting&&(i.exportSettings.excelUrl||i.exportSettings.csvUrl||i.exportSettings.pdfUrl)||r.find("#saveas_backStageTab").hide());i.printSettings.allowPrinting||r.find("#print_backStageTab").hide()},_pictureSizeChange:function(t,i){var u=this.XLObj,f,o=u.getActiveSheetIndex(),r=u.getSheetElement(o).find(".e-ss-activeimg"),e={sheetIndex:o,reqType:"shape",shapeType:"picture",action:"picturesize",name:t,id:n(r).attr("id"),prev:{},cur:{}};u._shapeChange||this._isSetModel||(e.prev={width:r.width(),height:r.height()},t==="PictureHeight"?(f=parseInt(r.height()*i.value/r.width()),r.css({width:i.value,height:f}),e.cur={width:i.value,height:f}):(f=parseInt(r.width()*i.value/r.height()),r.css({height:i.value,width:f}),e.cur={height:i.value,width:f}),this._isSetModel=!0,n("#"+u._id+"_Ribbon_Format_Size_"+t).ejNumericTextbox("option",{value:f}),this._isSetModel=!1,u._completeAction(e),u._trigActionComplete(e),u.XLShape._updateShapeObj(r[0]))},_chartTypeOk:function(){var i=this.XLObj,o=i.element.find("#"+i._id+"_chart").val(),u=n("#"+o).data("ejChart"),f,t,e,s,h,r;e=n("#"+i._id+"_allchart").find(".e-chartselect:eq(0)").attr("class").split(" ")[1];t=e.split("e-dlg")[1].split("chart");s=["e-dlgcolumnchart4","e-dlgcolumnchart5","e-dlgcolumnchart6","e-dlgbarchart4","e-dlgbarchart5","e-dlgbarchart6","e-dlgpiechart2"];h=["e-dlgstockchart2","e-dlglinechart2","dlgradarchart2"];r={type:t[0],enable3D:!1,marker:{visible:!1}};(t[0]==="column"||t[0]==="bar"||t[0]==="area")&&(t[1]==="1"||t[1]==="4"?r.type=t[0]:t[1]==="2"||t[1]==="5"?r.type="stacking"+t[0]:(t[1]==="3"||t[1]==="6")&&(r.type="stacking"+t[0]+"100"));s.indexOf(e)>-1&&(r.enable3D=!0);h.indexOf(e)>-1&&(r.marker={visible:!0});e==="e-dlgpiechart3"&&(r.type="doughnut");f={sheetIndex:i.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:"chartType",chartId:o};f.prev={chartType:u.model.series[0].type,enable3D:u.model.enable3D,marker:u.model.series[0].marker.visible};i.XLChart.refreshChart(o,r);f.cur={chartType:u.model.series[0].type,enable3D:u.model.enable3D,marker:u.model.series[0].marker.visible};n("#"+i._id+"_charttypedlg").ejDialog("close");i._completeAction(f);i._trigActionComplete(f)},_chartTypeCancel:function(){var t=this.XLObj;n("#"+t._id+"_charttypedlg").ejDialog("close");t.setSheetFocus()},_chartType:function(t,i,r,u,f,e){for(var v,y,l,c,a,p="<div class='e-chartheader'><span>",s="<div class='e-chartcontent'<\/div>",w=t.toLowerCase(),b={visible:!1},h=this.XLObj,k=h._getLocStr(t).split("/"),o=0;o<i;o++)v="<div class='e-"+h._id+" e-chartcell e-"+w+(o+1)+"' title="+h._getLocStr(e[o])+"><\/div>",s+=v,o===r&&(s+="<\/div>"+p+k[1]+"<\/span><\/div><div class='e-chartcontent'<\/div>");for(c=n("<div id="+h._id+"_Ribbon_"+t+" class='e-ss-dialog e-ss-chart e-ss-"+h._id+"' style='height:auto;'>"+p+k[0]+"<\/span><\/div>"+s+"<\/div>"),y=c.find(".e-chartcell"),o=0;o<i;o++)l=n(y[o]),a=f[o],l.data({type:a,enable3D:!1,marker:b}),o>u&&l.data({type:a,enable3D:!0,marker:b});s=n(c).find(".e-"+w+"2");(t==="StockChart"||t==="LineChart")&&s.data({marker:{visible:!0}});t==="PieChart"&&s.data({enable3D:!0});h.element[0].appendChild(c[0])},autoSum:function(i,r){var nt;if(this.XLObj.model.allowAutoSum){var f=this.XLObj,b=f.XLEdit,s=f.getActiveSheetIndex(),k=f.getActiveCell(s),tt=!1,a;if(!t.isNullOrUndefined(k)){var l,d,y=f.getActiveCell(s),p,g=f._getRangeArgs(r,"object"),o=f._getSelectedCells(s,g).selCells,c=o.length-1,it=o[c].rowIndex-o[0].rowIndex,rt=o[c].colIndex-o[0].colIndex,v={sheetIndex:s,range:r,reqType:"auto-sum",oprType:i,updCell:[]},u,e,w,ut=f.getRangeData({range:[o[0].rowIndex,o[0].colIndex,o[c].rowIndex,o[c].colIndex],valueOnly:!0}).length,h=f._dataContainer.sheets[s];if(c!==0&&ut)if(it===0&&rt>0){for(p=f._getAlphaRange(s,o[0].rowIndex,o[0].colIndex,o[c].rowIndex,o[c].colIndex),u=o[c].rowIndex,e=o[c].colIndex+1,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2");!t.isNullOrUndefined(a)&&a!="";)e++,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2");e===f.getSheet(s).colCount&&f.XLScroll._createNewColumn(s,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"insert");f._isUndoRedo||v.updCell.push({rowIndex:u,colIndex:e,pObj:{},pValue:t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,e,"value2"))?"":f.XLEdit.getPropertyValue(u,e,"value2")});t.isNullOrUndefined(h[u])&&(h[u]={});t.isNullOrUndefined(h[u][e])&&(h[u][e]={});f._isUndoRedo||n.extend(!0,v.updCell[0].pObj,h[u][e]);f._isRowViewable(s,u)&&(w=f.getCell(u,e,s),w.addClass("e-ralign"));b._updateCellValue({rowIndex:u,colIndex:e},"="+i+"("+p+")");"COUNT".indexOf(i)<0&&f._autosumFormatUpdate(f.getRangeData({range:[o[0].rowIndex,o[0].colIndex,o[0].rowIndex,o[0].colIndex]})[0],[u,e,u,e],!1,!1)}else{for(d=o[c].colIndex-o[0].colIndex,u=o[c].rowIndex+1,l=0;l<=d;l++)for(e=o[l].colIndex,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2"),nt=u;!t.isNullOrUndefined(a)&&a!="";)u++,nt=u,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2");for(l=0;l<=d;l++)e=o[l].colIndex,u=nt,p=f._getAlphaRange(s,o[0].rowIndex,e,o[c].rowIndex,e),o[c].rowIndex===f.getSheet(s).rowCount-1&&f.XLScroll._createNewRow(s,-1,-1,"insert"),f._isUndoRedo||v.updCell.push({rowIndex:u,colIndex:e,pObj:{},pValue:t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,e,"value2"))?"":f.XLEdit.getPropertyValue(u,e,"value2")}),t.isNullOrUndefined(h[u])&&(h[u]={}),t.isNullOrUndefined(h[u][e])&&(h[u][e]={}),f._isUndoRedo||n.extend(!0,v.updCell[l].pObj,h[u][e]),f._isRowViewable(s,u)&&(w=f.getCell(u,e,s),w.addClass("e-ralign")),b._updateCellValue({rowIndex:u,colIndex:e},"="+i+"("+p+")"),"COUNT".indexOf(i)<0&&f._autosumFormatUpdate(f.getRangeData({range:[o[0].rowIndex,o[l].colIndex,o[0].rowIndex,o[l].colIndex]})[0],[u,e,u,e],!1,!1)}else u=k.rowIndex,e=k.colIndex,v.updCell.push({rowIndex:u,colIndex:e,pObj:{},pValue:t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,e,"value2"))?"":f.XLEdit.getPropertyValue(u,e,"value2")}),t.isNullOrUndefined(h[u])&&(h[u]={}),t.isNullOrUndefined(h[u][e])&&(h[u][e]={}),n.extend(!0,v.updCell[0].pObj,h[u][e]),f._isRowViewable(s,y.rowIndex)||f.XLScroll._scrollSelectedPosition(s,y),b.editCell(y.rowIndex,y.colIndex,!0),f.model.allowFormulaBar&&f._getInputBox().val("="+i+"()"),f._isRowViewable(s,u)&&(f.XLEdit._editElem.text("="+i+"()"),f.XLEdit._editElem.focusEnd()),tt=!0;f.performSelection({rowIndex:g[0],colIndex:g[1]},{rowIndex:u,colIndex:e});f._isUndoRedo||tt||(f._completeAction(v),f._trigActionComplete(v))}}},_openNameManagerDlg:function(){var i=this.XLObj,t;i._showDialog(i._id+"_Ribbon_Others_NameManager");t=n("#"+i._id+"_nmgrid").data("ejGrid");t.getContentTable().find("td").addClass("e-ss-emptyrecord");t.model.dataSource.length<1?t.getContentTable().find("td").addClass("e-ss-emptyrecord"):t.getContentTable().find(".e-ss-emptyrecord").removeClass("e-ss-emptyrecord");this._refreshNMDlg();i._browserDetails.name=="msie"&&t.refreshContent();n("#"+i._id+"_nmgrid").focus()},_openFATDlg:function(){var t=this.XLObj;n("#"+t._id+"_fatnamedlg").ejDialog("open");n("#"+t._id+"_fatheader").ejCheckBox("option","checked",!1);n("#"+t._id+"_fatname").val("Table"+t._tableCnt).focus().setInputPos(n("#"+t._id+"_fatname").val().length)},_dirtySelect:function(){var e=this.XLObj,y=e.getActiveSheetIndex(),n,i=e.getSheet(y).filterSettings.tableRange,b=!1,r=!1,p=!1,h=!1,c=!1,l=!1,w=!1,o=!1,s=!1,u=!1,f=!1,k=-2,a=!1,v=!1,t,d;if(!e.model.allowLockCell||!e.getSheet(y).isSheetProtected){if(n=e.getSheet(y)._selectedCells,n.length>0)for(t=0,d=i.length;t<d;t++){if(f=o=h=c=a=!1,u=s=l=w=v=!1,i[t].startRow-1<=n[0].rowIndex&&i[t].endRow>=n[n.length-1].rowIndex?f=!0:i[t].startRow-1>n[0].rowIndex&&n[n.length-1].rowIndex>=i[t].startRow-1&&i[t].endRow>=n[n.length-1].rowIndex?o=!0:i[t].startRow-1<=n[0].rowIndex&&n[0].rowIndex<=i[t].endRow&&i[t].endRow<n[n.length-1].rowIndex?o=!0:i[t].startRow-1>n[n.length-1].rowIndex?h=!0:i[t].endRow<n[0].rowIndex?c=!0:i[t].endRow<n[n.length-1].rowIndex&&i[t].startRow>n[0].rowIndex?a=!0:f=!1,i[t].multifilterIdx[0]<=n[0].colIndex&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]>=n[n.length-1].colIndex?u=!0:i[t].multifilterIdx[0]>n[0].colIndex&&n[n.length-1].colIndex>=i[t].multifilterIdx[0]&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]>=n[n.length-1].colIndex?s=!0:i[t].multifilterIdx[0]<=n[0].colIndex&&n[0].colIndex<=i[t].multifilterIdx[i[t].multifilterIdx.length-1]&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]<n[n.length-1].colIndex?s=!0:i[t].multifilterIdx[0]>n[n.length-1].colIndex?l=!0:i[t].multifilterIdx[i[t].multifilterIdx.length-1]<n[0].colIndex?w=!0:i[t].multifilterIdx[0]>n[0].colIndex&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]<n[n.length-1].colIndex?v=!0:u=!1,(o&&s||o&&u||f&&s||o&&!w&&!l||s&&!h&&!c||a&&v||f&&v||u&&a)&&(r=!0,e.XLSelection._isRowSelected&&f&&(r=!1),e.XLSelection._isColSelected&&u&&(r=!1),r))break;if(!r){if(k=t,(h||c||l)&&(r=!1,b=!1),f&&u){p=!0;break}if(!f&&!u){b=!0;break}}}this._isDirtySelect=r;this._isMergeSelect=p||r;this._isFilterSelect={status:p,tableIdx:k,isFiltered:!1}}},_refreshRibbonIcons:function(){var t=this.XLObj,e=t.getActiveSheetIndex(),i=n("#"+t._id+"_contextMenuCell").data("ejMenu"),o=["Home_Editing_SortFilter","Home_Editing_Clear","Home_Styles_FormatAsTable"],s=["Insert_Tables_Table","Design_Tools_ConvertToRange","Data_SortFilter_Filter","Data_SortFilter_ClearFilter"],h=n("#"+t._id+"_Ribbon_Home_Alignment_Merge").data("ejSplitButton"),r,l,f,u,c;if(!t.XLEdit._isEdit&&t.getSheetElement(e).find(".e-ss-activeimg").length<1&&h&&h.option("enabled",!this._isMergeSelect),this._isDirtySelect?(this._disableButtons(o,"ejSplitButton"),this._disableButtons(s,"ejButton"),i&&i.disableItemByID("Sort")):t.XLEdit._isEdit||(this._enableButtons(o,"ejSplitButton"),this._enableButtons(s,"ejButton"),!t.model.isReadOnly&&i&&t.model.allowSorting&&i.enableItemByID("Sort")),r=t.getSheet(e).filterSettings.tableRange[this._isFilterSelect.tableIdx],this._isFilterSelect.status&&r){for(l=!1,f=r.multifilterIdx,u=0,c=f.length;u<c;u++)if(filterVal=t.XLEdit.getPropertyValue(r.startRow-1,f[u],"filterState"),filterVal&&filterVal.indexOf("filtered")>-1){this._isFilterSelect.isFiltered=!0;break}this._isFilterSelect.isFiltered?this._enableButtons(["Data_SortFilter_ClearFilter"],"ejButton"):this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton")}else this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton");this._isHomeTabCreate&&n("#"+t._id+"_Ribbon_SortFilter").ejMenu("disableItemByID","Ribbon_ClearFilter")},_onGroupExpander:function(n){var t=this.XLObj;if(!t.model.isReadOnly&&!t.XLEdit._isEdit)switch(n.target.id){case t._id+"_Ribbon_Number_e-groupexpander":t._showDialog(t._id+"_FormatCells")}},disableRibbonItems:function(n){var e=this.XLObj,i,u,r,f,t;if(!e.model.isReadOnly)for(r=0,f=n.length;r<f;r++){u=n[r].split("_")[2].toUpperCase();t=n[r].split("_Ribbon_")[1];do{switch(u){case"HOME":this._homeBtnIds.indexOf(t)>-1?(i="ejButton",this._homeBtnIds.splice(this._homeBtnIds.indexOf(t),1)):this._homeSptBtnIds.indexOf(t)>-1?(i="ejSplitButton",this._homeSptBtnIds.splice(this._homeSptBtnIds.indexOf(t),1)):this._homeToggleBtnIds.indexOf(t)>-1?(i="ejToggleButton",this._homeToggleBtnIds.splice(this._homeToggleBtnIds.indexOf(t),1)):this._homeDdIds.indexOf(t)>-1?(i="ejDropDownList",this._homeDdIds.splice(this._homeDdIds.indexOf(t),1)):this._homeCpIds.indexOf(t)>-1&&(i="ejColorPicker",this._homeCpIds.splice(this._homeCpIds.indexOf(t),1));break;case"INSERT":this._insertBtnIds.indexOf(t)>-1?(i="ejButton",this._insertBtnIds.splice(this._insertBtnIds.indexOf(t),1)):this._insertSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._insertSptBtnIds.splice(this._insertSptBtnIds.indexOf(t),1));break;case"DATA":this._dataBtnIds.indexOf(t)>-1?(i="ejButton",this._dataBtnIds.splice(this._dataBtnIds.indexOf(t),1)):this._dataSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._dataSptBtnIds.splice(this._dataSptBtnIds.indexOf(t),1));break;case"PAGELAYOUT":this._pageLayBtnIds.indexOf(t)>-1?(i="ejButton",this._pageLayBtnIds.splice(this._pageLayBtnIds.indexOf(t),1)):this._pageLaySptBtnIds.indexOf(t)>-1?(i="ejSplitButton",this._pageLaySptBtnIds.splice(this._pageLaySptBtnIds.indexOf(t),1)):this._pageLayChckBxIds.indexOf(t)>-1&&(i="ejCheckBox",this._pageLayChckBxIds.splice(this._pageLayChckBxIds.indexOf(t),1));break;case"REVIEW":this._cmntBtnIds.indexOf(t)>-1?(i="ejButton",this._cmntBtnIds.splice(this._cmntBtnIds.indexOf(t),1)):this._cmntTglBtnIds.indexOf(t)>-1?(i="ejToggleButton",this._cmntTglBtnIds.splice(this._cmntTglBtnIds.indexOf(t),1)):this._reviewTglBtnIds.indexOf(t)>-1&&(i="ejToggleButton",this._reviewTglBtnIds.splice(this._reviewTglBtnIds.indexOf(t),1));break;case"OTHERS":this._othersBtnIds.indexOf(t)>-1?(i="ejButton",this._othersBtnIds.splice(this._othersBtnIds.indexOf(t),1)):this._othersSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._othersSptBtnIds.splice(this._othersSptBtnIds.indexOf(t),1));break;case"FORMAT":this._formatBtnIds.indexOf(t)>-1?(i="ejButton",this._formatBtnIds.splice(this._formatBtnIds.indexOf(t),1)):this._formatSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._formatSptBtnIds.splice(this._formatSptBtnIds.indexOf(t),1));break;case"DESIGN":this._contextualBtnIds.indexOf(t)>-1?(i="ejButton",this._contextualBtnIds.splice(this._contextualBtnIds.indexOf(t),1)):this._contextualCheckBoxIds.indexOf(t)>-1?(i="ejCheckBox",this._contextualCheckBoxIds.splice(this._contextualCheckBoxIds.indexOf(t),1)):this._contextualInputIds.indexOf(t)>-1&&(i=!0);break;case"CHARTDESIGN":this._chartDesignBtnIds.indexOf(t)>-1?(i="ejButton",this._chartDesignBtnIds.splice(this._chartDesignBtnIds.indexOf(t),1)):this._chartDesignSptBtnIds.indexOf(t)>-1?(i="ejSplitButton",this._chartDesignSptBtnIds.splice(this._chartDesignSptBtnIds.indexOf(t),1)):this._chartDesignDdIds.indexOf(t)>-1&&(i="ejDropDownList",this._chartDesignDdIds.splice(this._chartDesignDdIds.indexOf(t),1))}this._disableButtons([t],i)}while((t==="PageLayout_PageLayout_PageSize"||t==="Home_Clipboard_Paste"||t==="Others_Cells_InsertCell"||t==="Others_Cells_DeleteCell"||t==="Data_DataTools_DataValidation")&&(t=t+"Options"))}},enableRibbonItems:function(n){for(var e=this.XLObj,i,u,t,r=0,f=n.length;r<f;r++){u=n[r].split("_")[2].toUpperCase();t=n[r].split("_Ribbon_")[1];do{switch(u){case"HOME":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._homeBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1?(i="ejSplitButton",this._homeSptBtnIds.push(t)):this.allToggleButtonIds.indexOf(t)>-1?(i="ejToggleButton",this._homeToggleBtnIds.push(t)):this.allDropDownIds.indexOf(t)>-1?(i="ejDropDownList",this._homeDdIds.push(t)):this.colorPickerIds.indexOf(t)>-1&&(i="ejColorPicker",this._homeCpIds.push(t));break;case"INSERT":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._insertBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._insertSptBtnIds.push(t));break;case"DATA":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._dataBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._dataSptBtnIds.push(t));break;case"PAGELAYOUT":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._pageLayBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1?(i="ejSplitButton",this._pageLaySptBtnIds.push(t)):this.checkBoxIds.indexOf(t)>-1&&(i="ejCheckBox",this._pageLayChckBxIds.push(t));break;case"REVIEW":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._cmntBtnIds.push(t)):this.allToggleButtonIds.indexOf(t)>-1&&n[r].split("_")[4]==="ShowAllComment"?(i="ejToggleButton",this._cmntTglBtnIds.push(t)):this.allToggleButtonIds.indexOf(t)>-1&&(i="ejToggleButton",this._reviewTglBtnIds.push(t));break;case"OTHERS":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._othersBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._othersSptBtnIds.push(t));break;case"FORMAT":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._formatBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._formatSptBtnIds.push(t));break;case"DESIGN":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._contextualBtnIds.push(t)):this.checkBoxIds.indexOf(t)>-1?(i="ejCheckBox",this._contextualCheckBoxIds.push(t)):this._contextualInputIds.indexOf(t)>-1&&(i=!0);break;case"CHARTDESIGN":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._chartDesignBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1?(i="ejSplitButton",this._chartDesignSptBtnIds.push(t)):this.allDropDownIds.indexOf(t)>-1&&(i="ejDropDownList",this._chartDesignDdIds.push(t))}this._enableButtons([t],i)}while((t==="PageLayout_PageLayout_PageSize"||t==="Home_Clipboard_Paste"||t==="Others_Cells_InsertCell"||t==="Others_Cells_DeleteCell"||t==="Data_DataTools_DataValidation")&&(t=t+"Options"))}},_refreshFRDlg:function(){var t=this.XLObj;t._dlgWidth<365?(n("#"+t._id+"_Ribbon_lbFind").text("Find"),n("#"+t._id+"_Ribbon_lbReplace").text("Replace")):(n("#"+t._id+"_Ribbon_lbFind").text("Find What"),n("#"+t._id+"_Ribbon_lbReplace").text("Replace With"))},_refreshChartTypeDlg:function(){var t=this.XLObj;n("#"+t._id+"_charttypedlg").ejDialog("open");n("#"+t._id+"_chartdlg_allcharttab_list").ejListBox("refresh")},_refreshNMDlg:function(){var t=this.XLObj,i;n("#"+t._id+"_nmdlg").ejDialog("open");i=n("#"+t._id+"_nmgrid").data("ejGrid");i._refreshScroller({requestType:"refresh"})},_menuCustomize:function(){var r=this.XLObj,f=r._id,u=r.model.ribbonSettings.applicationTab,i=u.menuSettings;u.type==="menu"?(i.isAppend?this._fileMenuData=this._fileMenuData.concat(i.dataSource):i.dataSource.length&&(this._fileMenuData=[{id:"File",text:r._getLocStr("File"),parentId:null},].concat(i.dataSource)),this._appTabCollection={type:t.Ribbon.ApplicationTabType.Menu,menuItemID:f+"_Menu",menuSettings:{click:n.proxy(this._onBackStageItemClick,this),openOnClick:!1,fields:{dataSource:this._fileMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"}}}):i.isAppend?(this._renderAppTab(),this._appTabCollection.backstageSettings.pages=this._appTabCollection.backstageSettings.pages.concat(i.dataSource)):i.dataSource.length?this._appTabCollection={type:t.Ribbon.applicationTabType.backstage,backstageSettings:{text:r._getLocStr("File"),headerWidth:124,height:r._responsiveHeight,width:r.model.scrollSettings.width,pages:i.dataSource}}:this._renderAppTab()},_refreshBackstageHeight:function(){var n=this.XLObj,i=n.element.find("#"+n._id+"_Ribbon").data("ejRibbon"),r=n._isAutoWHMode?n._responsiveHeight:n._responsiveHeight-2;i.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&(i.setModel({applicationTab:{backstageSettings:{height:r,width:n._isAutoWHMode?n._responsiveWidth:n._responsiveWidth-2}}}),i.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").css({height:r-(10+i.element.find(".e-backstagerestop").outerHeight())}))},hideMenu:function(){var t=this.XLObj;t.model.isReadOnly||(t.model.ribbonSettings.applicationTab.type==="menu"?n("#"+t._id+"_Menu").hide():t.element.find("#"+t._id+"_Ribbon").find(".e-backstagetab").hide())},showMenu:function(){var t=this.XLObj;t.model.isReadOnly||(t.model.ribbonSettings.applicationTab.type==="menu"?n("#"+t._id+"_Menu").show():t.element.find("#"+t._id+"_Ribbon").find(".e-backstagetab").show())},addTab:function(n,t,i){var r=this.XLObj;r.model.isReadOnly||r.element.find("#"+r._id+"_Ribbon").ejRibbon("addTab",n,t,i)},addTabGroup:function(n,t,i){var r=this.XLObj;r.model.isReadOnly||r.element.find("#"+r._id+"_Ribbon").ejRibbon("addTabGroup",n,t,i)},addContextualTabs:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+this.XLObj._id+"_Ribbon").ejRibbon("addContextualTabs",n,t)},removeTab:function(n,i){var r=this.XLObj,u;r.model.isReadOnly||(t.isNullOrUndefined(n)&&i?(u=r.element.find("#"+r._id+"_Ribbon .e-apptab"),u.length&&(u.find("a").empty(),u.find(".e-menu-wrap").remove(),u.hide(),r.element.find("#"+r._id+"_Ribbon_BackStage").remove())):r.element.find("#"+r._id+"_Ribbon").ejRibbon("removeTab",n))},removeTabGroup:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+i._id+"_Ribbon").ejRibbon("removeTabGroup",n,t)},addBackStageItem:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+i._id+"_Ribbon").ejRibbon("addBackStageItem",n,t)},removeBackStageItem:function(n){var t=this.XLObj;t.model.isReadOnly||t.element.find("#"+t._id+"_Ribbon").ejRibbon("removeBackStageItem",n)},updateBackStageItem:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+i._id+"_Ribbon").ejRibbon("updateBackStageItem",t,n)},removeMenuItem:function(t){var r=this.XLObj,i,u;r.model.isReadOnly||(i=n("#"+r._id+"_Menu"),u=i.data("ejMenu"),u.remove(["#"+i.find("li").eq(t).attr("id")]))},updateMenuItem:function(t,i){var f=this.XLObj,r,u;f.model.isReadOnly||(r=n("#"+f._id+"_Menu"),u=r.data("ejMenu"),u.insertBefore(t,"#"+r.find("li").eq(i).attr("id")),u.remove(["#"+r.find("li").eq(i+1).attr("id")]))},addMenuItem:function(t,i){var u=this.XLObj,r,f;u.model.isReadOnly||(r=n("#"+u._id+"_Menu"),f=r.data("ejMenu"),f.insertAfter(t,"#"+r.find("li").eq(i).attr("id")))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.freezepane=function(n){this.XLObj=n;this._hfreeze=null;this._vfreeze=null};t.spreadsheetFeatures.freezepane.prototype={_setHFreeze:function(n){this._hfreeze=n},_getHFreeze:function(){return this._hfreeze},_setVFreeze:function(n){this._vfreeze=n},_getVFreeze:function(){return this._vfreeze},_initFreeze:function(){var t,i,u="div",f="e-hide",r=this.XLObj,o=r.getSheet(),e=r.getMainPanel().find(".e-spreadsheet-list")[0];t=document.createElement(u);t.id=r._id+"_hfreeze";t.className="e-frow "+f;e.appendChild(t);this._setHFreeze(n(t));i=document.createElement(u);i.id=r._id+"_vfreeze";i.className="e-fcol "+f;e.appendChild(i);this._setVFreeze(n(i))},_refreshFreeze:function(){var u="px",r="e-hide",n=this.XLObj,i=n.getSheet(),t=this._getHFreeze()[0];t||this._initFreeze();n._isFrozen(n.getFrozenRows())?(n._removeClass(t,r),t.style.top=i._fDivTop,t.style.width=n.model._isActPanelVisible?n._getJSSheetContent(n.getActiveSheetIndex()).width()-(i.showHeadings?n._rowHeaderWidth:0)+10+u:i._vPortWth+(i.showHeadings?n._rowHeaderWidth:0)-4+u):n.addClass(t,r);t=this._getVFreeze()[0];n._isFrozen(n.getFrozenColumns())?(n._removeClass(t,r),t.style.left=i._fDivLeft,t.style.height=i._vPortHgt+(i.showHeadings?n._colHeaderHeight:0)-4+u):n.addClass(t,r)},freezeTopRow:function(){var n=this.XLObj.getSheet();(this.XLObj._isFrozen(n.frozenRows)||this.XLObj._isFrozen(n.frozenColumns))&&this.unfreezePanes();this._freeze(n._topRow.idx+1)},freezeLeftColumn:function(){var n=this.XLObj.getSheet();this.XLObj._isFrozen(n.frozenColumns)&&this.unfreezePanes();this._freeze(null,n._leftCol.idx+1)},freezeRows:function(n){var t=this.XLObj.getSheet();(this.XLObj._isFrozen(t.frozenRows)||this.XLObj._isFrozen(t.frozenColumns))&&this.unfreezePanes();this._freeze(n)},freezeColumns:function(n){var t=this.XLObj.getSheet();this.XLObj._isFrozen(t.frozenColumns)&&this.unfreezePanes();this._freeze(null,n)},freezePanes:function(n,t){var i,r=this.XLObj;r.isNumber(n)||(i=r._toIntrnlRange(n),n=i[0],t=i[1]);this._freeze(n,t)},unfreezePanes:function(){this._freeze();this._refreshSelection()},_freeze:function(n,i){var h,o,c,r,f,e,s=crefresh=!0,u=this.XLObj;u.model.allowFreezing&&(h="px",c="e-hide",r=u.getSheet(),e=this._getHFreeze()[0],t.isNullOrUndefined(n)?(o=u.getFrozenRows()+1,u._isFrozen(o-1)?(n=0,this._showFreezeRow(o-1,r._ftopRowIdx-1),u.model.scrollSettings.allowVirtualScrolling&&u.refreshContent(),u.addClass(e,c),r._isFreezed=!1):s=!1):((n===0||n<r._topRow.idx||n>r._bottomRow.idx)&&(n=u._getMidCell().rowIdx),f=u._getIdxWithOffset(n).yOffset,r._topRow.idx===n&&r._scrollTop!==f&&u.XLScroll._vScroller().scroll(f),u._removeClass(e,c),r._isFreezed=!0,e.style.top=r._fDivTop=f-r._scrollTop+(r.showHeadings?u._colHeaderHeight-2:0)+h,e.style.width=r._vPortWth+(r.showHeadings?u._rowHeaderWidth:0)-4+h,r._contScrollTop=r._scrollTop),s&&(r._ftopRowIdx=n,r._frozenHeight=u._getRowOffsetTop(r,n),r.paneTopLeftCell=u.getAlphaRange(n,r._fleftColIdx),u.setFrozenRows(n),r._frozenRows=n+1),e=this._getVFreeze()[0],t.isNullOrUndefined(i)?(o=u.getFrozenColumns()+1,u._isFrozen(o-1)?(i=0,this._showFreezeCol(o-1,r._fleftColIdx-1),u.addClass(e,c),r._isFreezed=!1):crefresh=!1):((i===0||i<r._leftCol.idx||i>r._rightCol.idx)&&(i=u._getMidCell().colIdx),f=u._getIdxWithOffset(null,i).xOffset,r._leftCol.idx===i&&r._scrollLeft!==f&&u.XLScroll._hScroller().scroll(f),f=f+(r.showHeadings?u._rowHeaderWidth:0)-1,u._removeClass(e,c),r._isFreezed=!0,e.style.left=r._fDivLeft=f-r._scrollLeft+h,e.style.height=r._vPortHgt+(r.showHeadings?u._colHeaderHeight:0)-4+h,r._contScrollLeft=r._scrollLeft),crefresh&&(r._fleftColIdx=i,r._frozenWidth=u._getColOffsetLeft(r,i),r.paneTopLeftCell=u.getAlphaRange(r._ftopRowIdx,i),u.setFrozenColumns(i),r._frozenColumns=i+1),(s||crefresh)&&(u.XLScroll._refreshScroller(null,null,s&&crefresh?"all":s?"vertical":"horizontal"),s&&u.XLScroll._vScroller().scroll(u._isFrozen(u.getFrozenRows())?0:r._contScrollTop),crefresh&&u.XLScroll._hScroller().scroll(u._isFrozen(u.getFrozenColumns())?0:r._contScrollLeft)))},_frozenScrollHandler:function(n){var o,f,h=0,r=this.XLObj,u=r.XLScroll,i=r.getSheet(),e=r.getActiveSheetIndex(),s=u._vScroller(e),c=u._hScroller(e);if(n.model.orientation===t.ScrollBar.Orientation.Vertical){if(n.reachedEnd=Math.ceil(parseFloat(s.element.find(".e-vhandle").css("top")))+Math.ceil(parseFloat(s.element.find(".e-vhandle").height()))>=s.element.find(".e-vhandlespace").height()-2,n.reachedEnd&&r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite){if(o=(n.scrollTop-i._scrollTop)/i.rowHeight,i._bottomRow.idx+o>=i.rowCount-1)if(r.model.scrollSettings.allowVirtualScrolling)for(i._virtualBlockCnt++,i.rowCount+=i._virtualBlockRowCnt;h<i._virtualBlockRowCnt;)i.rowsHeightCollection.push(i.rowHeight),h++;else r.XLScroll._scrollBottom(e);r.XLScroll._refreshScroller(e,"refresh","vertical")}u._isIntrnlScroll?(this._scrollFreeze(u._scrollIdx),u._scrollIdx=0,i._scrollTop=n.scrollTop):n.scrollTop==i._scrollTop||n.reachedEnd&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Infinite||(f=this._ensureFreezeScrollPos(n),r.isUndefined(f.resetTo)?(this._scrollFreeze(f.rowIdx),i._scrollTop=n.scrollTop):(u._isIntrnlScroll=!0,u._scrollIdx=f.rowIdx,u._vScroller().scroll(f.resetTo),u._isIntrnlScroll=!1))}else n.reachedEnd=Math.ceil(parseFloat(c.element.find(".e-hhandle").css("left")))+Math.ceil(parseFloat(c.element.find(".e-hhandle").width()))>=r.element.find(".e-hhandlespace").width()-2,o=(n.scrollLeft-i._scrollLeft)/i.columnWidth,(n.reachedEnd||r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&i._rightCol.idx+o>=i.colCount-1)&&(r.XLScroll._scrollRight(e),r.XLScroll._refreshScroller(e,"refresh","horizontal")),u._isIntrnlScroll?(this._scrollFreeze(null,u._scrollIdx),u._scrollIdx=0,i._scrollLeft=n.scrollLeft):n.scrollLeft==i._scrollLeft||n.reachedEnd&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Infinite||(f=this._ensureFreezeScrollPos(n),r.isUndefined(f.resetTo)?(this._scrollFreeze(null,f.colIdx),i._scrollLeft=n.scrollLeft):(u._isIntrnlScroll=!0,u._scrollIdx=f.colIdx,u._hScroller().scroll(f.resetTo),u._isIntrnlScroll=!1));r.model.allowComments&&r.XLComment._updateCmntArrowPos()},_ensureFreezeScrollPos:function(n){var i,r={},e=[t.Spreadsheet.HideTypes.Freeze],f=this.XLObj,u=f.getSheet();return n.model.orientation===t.ScrollBar.Orientation.Vertical?(i=n.scrollTop+u._frozenHeight,retVal=f._getIdxWithOffset(i,null,!0,e),r.rowIdx=retVal.rowIdx,i!==retVal.yOffset&&(r.resetTo=retVal.yOffset-u._frozenHeight)):(i=n.scrollLeft+u._frozenWidth,retVal=f._getIdxWithOffset(null,i,!0,e),r.colIdx=retVal.colIdx,i!==retVal.xOffset&&(r.resetTo=retVal.xOffset-u._frozenWidth)),r},_scrollFreeze:function(n,t){var r,u=this.XLObj,i=u.getSheet();n&&i._ftopRowIdx!==n?(i._ftopRowIdx<n?(r=n-i._ftopRowIdx==1?i._ftopRowIdx:n-1,this._hideFreezeRow(i._ftopRowIdx,r),this._refreshShape(i._ftopRowIdx,r,!0)):(r=i._ftopRowIdx-n==1?n:i._ftopRowIdx-1,this._showFreezeRow(n,r),this._refreshShape(n,r,!0)),u.model.scrollSettings.allowVirtualScrolling&&u.refreshContent(),i._ftopRowIdx=n,i.paneTopLeftCell=u.getAlphaRange(n,i._fleftColIdx)):t&&i._fleftColIdx!==t&&(i._fleftColIdx<t?(r=t-i._fleftColIdx==1?i._fleftColIdx:t-1,this._hideFreezeCol(i._fleftColIdx,r),this._refreshShape(i._fleftColIdx,r)):(r=i._fleftColIdx-t==1?t:i._fleftColIdx-1,this._showFreezeCol(t,r),this._refreshShape(t,r)),i._fleftColIdx=t,i.paneTopLeftCell=u.getAlphaRange(i._ftopRowIdx,t));this._refreshSelection()},_refreshShape:function(t,i,r){var u,f,h,o,c,l,v,s=this.XLObj,p=s.getActiveSheetIndex(),e=s.getSheet(p),a=e.shapeMngr,y=e.pivotMngr;for(v=r?[t,0,i,e.colCount]:[0,t,e.rowCount,i],f=s.getRangeData({range:v,property:["picture","chart"]}),u=0;u<f.length;u++)f[u].picture&&(c=f[u].picture[s.getObjectLength(f[u].picture)],o=r?a.picture[c].rowIndex:a.picture[c].colIndex,this._freezeShape(n("#"+c)[0],r?e._hiddenFreezeRows.indexOf(o)>-1:e._hiddenFreezeCols.indexOf(o)>-1)),f[u].chart&&(h=f[u].chart[s.getObjectLength(f[u].chart)],o=r?a.chart[h].rowIndex:a.chart[h].colIndex,this._freezeShape(n("#"+h)[0],r?e._hiddenFreezeRows.indexOf(o)>-1:e._hiddenFreezeCols.indexOf(o)>-1)),f[u].pivot&&(l=f[u].pivot[s.getObjectLength(f[u].pivot)],o=r?y.pivot[l].rowIndex:y.pivot[l].colIndex,this._freezeShape(n("#"+l)[0],r?e._hiddenFreezeRows.indexOf(o)>-1:e._hiddenFreezeCols.indexOf(o)>-1))},_freezeShape:function(n,t){var i=this.XLObj;t?i.addClass(n,"e-hide"):i._removeClass(n,"e-hide")},_hideFreezeRow:function(n,t){for(var r,i=this.XLObj,e=i.model.scrollSettings,h=e.allowScrolling&&e.allowVirtualScrolling,u=i.getActiveSheetIndex(),o=i.getRows(u),c=o[0],l=o[1],f=i.getSheet(u),s=f.usedRange;n<=t;){for(r=0,f._hiddenFreezeRows.indexOf(n)===-1&&f._hiddenFreezeRows.push(n),!h&&i._isRowViewable(u,n)&&(i.addClass(l[n],"e-r-hide"),i.addClass(c[n],"e-r-hide"));r<s.colIndex;)i.XLCellNav._isMergedCell({rowIndex:n,colIndex:r})&&(i._refreshSHMergeCells(u,[n],1,"row","hide"),r=s.colIndex),r++;n++}},_showFreezeRow:function(n,t){for(var u,r,i=this.XLObj,o=i.model.scrollSettings,c=o.allowScrolling&&o.allowVirtualScrolling,f=i.getActiveSheetIndex(),s=i.getRows(f),l=s[0],a=s[1],e=i.getSheet(),h=e.usedRange;n<=t;){if(r=0,u=e._hiddenFreezeRows.indexOf(n),i.model.allowFiltering&&(isFHide=this._refreshFiltering(n)),u>-1)for(e._hiddenFreezeRows.splice(u,1),c||!i._isRowViewable(f,n)||isFHide||(i._removeClass(a[n],"e-r-hide"),i._removeClass(l[n],"e-r-hide"));r<h.colIndex;)i.XLCellNav._isMergedCell({rowIndex:n,colIndex:r})&&(i._refreshSHMergeCells(f,[n],1,"row","show"),r=h.colIndex),r++;n++}},_refreshFiltering:function(n){var i=this.XLObj,u=i.getActiveSheetIndex(),r=i.getSheet();return t.isNullOrUndefined(i.XLEdit.getPropertyValue(n,0,"isFilterHide",u))?!1:(r._filterHRowsColl.indexOf(n)===-1&&r._filterHRowsColl.push(n),!0)},_hideFreezeCol:function(n,t){for(var s,f,o="e-fcol-hide",i=n,r=this.XLObj,h=r.getActiveSheetIndex(),e=r.getSheet(),a=e.usedRange,c=r.model.scrollSettings.allowVirtualScrolling?e._virtualRowIdx:e._rowIdxColl,l=r._getJSSheetHeader(h),v=r._getContent(h),p=l.find("th"),w=l.find("col"),b=v.find("col"),y=l.find("table"),u=r._getWidth(n,t);i<=t;){for(f=0,e._hiddenFreezeCols.indexOf(i)===-1&&e._hiddenFreezeCols.push(i),r.addClass(p[i],o),r.addClass(w[i],o),r.addClass(b[i],o);f<a.rowIndex;)r.XLCellNav._isMergedCell({rowIndex:f,colIndex:i})&&(r._refreshSHMergeCells(h,[i],1,"column","hide"),f=a.rowIndex),f++;i++}if(s=r.getRange([c[0],n,c[c.length-1],t]),i=s.length,i)while(i--)r.addClass(s[i],o);u=y.width()-u;y.width(u);v.find(".e-table").width(u)},_getWidth:function(n,t){for(var i=0,r=this.XLObj.getSheet();n<=t;n++)i+=r.columnsWidthCollection[n];return i},_showFreezeCol:function(n,t){for(var o,f,e="e-fcol-hide",r=n,i=this.XLObj,h=i.getActiveSheetIndex(),u=i.getSheet(),c=i._getJSSheetHeader(h),a=i._getContent(h),y=c.find("th"),v=u.usedRange,l=i.model.scrollSettings.allowVirtualScrolling?u._virtualRowIdx:u._rowIdxColl,p=c.find("col"),w=a.find("col"),b=c.find("table"),s=i._getWidth(0,u.colCount-1)-(u._frozenColumns-1<n?i._getWidth(u._frozenColumns-1,n):0);r<=t;){for(f=0,o=u._hiddenFreezeCols.indexOf(r),o>-1&&(u._hiddenFreezeCols.splice(o,1),i._removeClass(y[r],e),i._removeClass(p[r],e),i._removeClass(w[r],e));f<v.rowIndex;)i.XLCellNav._isMergedCell({rowIndex:f,colIndex:r})&&(i._refreshSHMergeCells(h,[r],1,"column","show"),f=v.rowIndex),f++;r++}if(cells=i.getRange([l[0],n,l[l.length-1],t]),r=cells.length,r)while(r--)i._removeClass(cells[r],e);b.width(s);a.find(".e-table").width(s)},_refreshSelection:function(){var i,f,r,e,o=!1,u=this.XLObj,n=u.getSheet(),t=n.selectedRange,s=t[2],h=t[3],c=t[0],l=t[1];if(n._endCell.rowIndex+1>=n._frozenRows&&n._endCell.rowIndex<n._ftopRowIdx&&n._startCell.rowIndex<n._frozenRows-1)s=n._frozenRows-2,o=!0;else if(i=t[0],f=t[2],n._frozenRows-1<=i)while(i<=f)if(i<n._ftopRowIdx)i++;else{c=i;break}if(t[3]+1>=n._frozenColumns&&t[3]<n._fleftColIdx&&t[1]<n._frozenColumns-1)h=n._frozenColumns-2,o=!0;else if(r=t[1],e=t[3],n._frozenColumns-1<=r)while(r<=e)if(r<n._fleftColIdx)r++;else{l=r;break}i==f+1||r==e+1?u.XLSelection._hideShowSelElem("hide"):(u.XLSelection._refreshBorder([c,l,s,h]),o?u.addClass(u.getAutoFillElem()[0],"e-hide"):u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement())},_selectionScroll:function(){var i,r,u,f=hiddenWth=0,t=this.XLObj,n=t.getSheet(),e=t.getActiveSheetIndex();if(t._isFrozen(n.frozenRows))if(n._startCell.rowIndex+1<n._frozenRows&&n._endCell.rowIndex+1>n._frozenRows&&n.selectedRange[2]<n._ftopRowIdx){if(n._ftopRowIdx+1-n._frozenRows>0){for(r=n._endCell.rowIndex-n._ftopRowIdx,n._endCell.rowIndex=n._frozenRows-1+r,i=n._frozenRows-1;i<n._ftopRowIdx;i++)f+=n.rowsHeightCollection[i];t._scrollContent({y:-f})}}else n.selectedRange[2]-n._endCell.rowIndex>0&&n._ftopRowIdx>n._frozenRows-1&&!n._isColSelected&&n._endCell.rowIndex<n._frozenRows-1&&n.selectedRange[2]-n.selectedRange[0]>0&&n.selectedRange[2]>=n._ftopRowIdx-1&&(n._endCell.rowIndex=n._ftopRowIdx-1,u=t.getCell(n._frozenRows-2,n._endCell.colIndex)[0],t.XLSelection._scrollCalculation(e,u,{position:"vertical",action:"Decrement"}));if(t._isFrozen(n.frozenColumns))if(n._startCell.colIndex+1<n._frozenColumns&&n._endCell.colIndex+1>n._frozenColumns&&n.selectedRange[3]<n._fleftColIdx){if(n._fleftColIdx+1-n._frozenColumns>0){for(r=n._endCell.colIndex-n._fleftColIdx,n._endCell.colIndex=n._frozenColumns-1+r,i=n._frozenColumns-1;i<n._fleftColIdx;i++)hiddenWth+=n.columnsWidthCollection[i];t._scrollContent({x:-hiddenWth})}}else n.selectedRange[3]-n._endCell.colIndex>0&&n._fleftColIdx>n._frozenColumns-1&&!n._isRowSelected&&n._endCell.colIndex<n._frozenColumns-1&&n.selectedRange[3]-n.selectedRange[1]>0&&n.selectedRange[3]>=n._fleftColIdx-1&&(n._endCell.colIndex=n._fleftColIdx-1,u=t.getCell(n._frozenColumns-2,n._endCell.colIndex)[0],t.XLSelection._scrollCalculation(e,u,{position:"horizontal",action:"Decrement"}))},_refreshFColResize:function(n){var u,f="px",i=this.XLObj,s=i.getActiveSheetIndex(),t=i.getSheet(),e=i.getFrozenColumns()+1,h=this._getVFreeze()[0],r=t._frozenWidth,o=parseInt(this._getVFreeze()[0].style.left);i.XLScroll._getColWidths(s,n);t._frozenWidth=i._getColOffsetLeft(t,e-1);u=r>t._frozenWidth?r-t._frozenWidth:t._frozenWidth-r;n<e-1&&(h.style.left=t._fDivLeft=r>=t._frozenWidth?o-u+f:o+u+f)},_refreshFRowResize:function(n){var u,f="px",i=this.XLObj,s=i.getActiveSheetIndex(),t=i.getSheet(),e=i.getFrozenRows()+1,h=this._getHFreeze()[0],r=t._frozenHeight,o=parseInt(this._getHFreeze()[0].style.top);i.XLScroll._getRowHeights(s,n);t._frozenHeight=i._getRowOffsetTop(t,e-1);u=r>t._frozenHeight?r-t._frozenHeight:t._frozenHeight-r;n<e-1&&(h.style.top=t._fDivTop=r>=t._frozenHeight?o-u+f:o+u+f)},_refreshFreezeRowDiv:function(){var n=this.XLObj;sheet=n.getSheet();sheet._fDivTop=n._getIdxWithOffset(sheet._frozenRows-1).yOffset-sheet._contScrollTop+(sheet.showHeadings?n._colHeaderHeight-2:0)+"px";sheet._frozenHeight=n._getRowOffsetTop(sheet,sheet._frozenRows-1);this._refreshFreeze()},_refreshFreezeColDiv:function(){var n=this.XLObj;sheet=n.getSheet();sheet._fDivLeft=n._getColOffsetLeft(sheet,sheet._frozenColumns-1)-sheet._contScrollLeft+(sheet.showHeadings?n._rowHeaderWidth:0)-1+"px";sheet._frozenWidth=n._getColOffsetLeft(sheet,sheet._frozenColumns-1);this._refreshFreeze()}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.math={toFraction:function(n){if(this.isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this.getPlaceValue(t,i),f=this.getGcd(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},toExponential:function(n,t){if(this.isNumber(n)){var i,r=Number(n);return t=t||2,t>20&&(t=20),i=r.toExponential(t).split("e+"),i[0]+"E+"+this.padZeros(i[1])}return null},toAccounting:function(i,r,u){if(this.isNumber(r)&&i){var e,o,s=t.widgetBase.formatting(i,r,u),f=this._currencySymbol,h=n.trim(s.replace(f,"")),c=s.indexOf(f);!c||r<0&&c===1?(e=f,o=Number(r)?h:"-"):(e=Number(r)?h:"-",o=f);r=e+" "+o}return r},intToDate:function(n){return new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime())},getGcd:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this.getGcd(t,n%t)},isNumber:function(n){return n-parseFloat(n)>=0},isTime:function(n){return n?n.toString().indexOf(":")!==-1:!1},isFormula:function(n){var t,i;return n&&!n.toString().indexOf("=")&&n.length>1?(t=n.split("(").length-1,i=n.split(")").length-1,t===i):!1},getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},padZeros:function(n,i,r){return this.isNumber(n)?(i=this.isNumber(i)?i:2,r=t.isNullOrUndefined(t.Spreadsheet.autoFillDirection[r])?t.Spreadsheet.autoFillDirection.Left:t.Spreadsheet.autoFillDirection[r],r===t.Spreadsheet.autoFillDirection.Left?n<=this.maxValue(i)?Array(i-this.getDigits(n)+1).join("0")+n.toString():n.toString():n<this.minValue(i)?n.toString()+Array(i-this.getDigits(n)+1).join("0"):n.toString()):null},maxValue:function(n){return this.isNumber(n)?Number(Array(n+1).join("9")):null},minValue:function(n){return this.isNumber(n)?Number("1"+Array(n).join("0")):null},getDigits:function(n){return this.isNumber(n)?n.toString().length:null},_round:function(n,t){return Number(Math.round(n+"e"+t)+"e-"+t)},_parseTime:function(n){var u,t,i=0,r=3,f={},e;if(this.isTime(n))for(n=n.toString(),t=n.split(" "),u=t.length;i<u;){if(this.isTime(t[i]))for(e=t[i].split(":");r<6;)f[this._datePattern[r]]=e[r-3]||"0",r++;i++}return f},_dateToInt:function(n,t){var r=new Date("01/01/1900"),u=this._isDateTime(n)?n:new Date(n),f=u.getTime()-r.getTime(),i=f/864e5+2;return t?i%1:i},_defTimeFormat:function(n){return[n.getHours(),n.getMinutes(),n.getSeconds()].join(":")},_isDate:function(n){var i={};return t.isNullOrUndefined(t.parseDate(n.toString()))||(n=this._dateToInt(n.toString())),/^((0?[1-9]|1[012])[-.](0?[1-9]|[12][0-9]|3[01])[-.](19|20)?[0-9]{2})*$/.test(n.toString())?(n=n.toString().replace("-","/","g"),n=this._dateToInt(n.toString()),i.text=n,i.isDate=!0):(i.text=n,i.isDate=!1),i},_defDateFormat:function(n){return[n.getMonth()+1,n.getDate(),n.getFullYear()].join("/")},_isCellReference:function(n){return/^[a-z]{1,3}\d{1,7}$/gi.test(n)?"relative":/^\$[a-z]{1,3}\$\d{1,7}$/gi.test(n)?"absolute":/^((\$[a-z]{1,3})\d{1,7}|[a-z]{1,3}(\$\d{1,7}))$/gi.test(n)?"mixed":!1},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_decimalCnt:function(n){var t;return this.isNumber(n)&&(n=Number(n),t=n.toString(),t.indexOf(this._decimalSeparator)>-1)?(fixVal=n.toFixed(),t.length-fixVal.length-1):0},_getPosDiff:function(n,t){return n>t?n-t:t-n}}}(jQuery,Syncfusion),function(n,t,r){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.resizing=function(t){this.XLObj=t;this._$visualElem=n();this._currentHCell=-1;this._colMinWidth=15;this._rowMinHeight=20;this._allowStart=!1;this._resizeStart=!1;this._resizeType="";this._tableY=null;this._oldWidth=null;this._orgX=null;this._orgY=null;this._extra=null;this._initialTableWidth=null;this._resizeElt=null;this._tableX=null;this._oldHeight=null;this._initialTableHeight=null;this._resizerowId=0};t.spreadsheetFeatures.resizing.prototype={getColWidth:function(n){return this.XLObj.getSheet(this.XLObj.getActiveSheetIndex()).columnsWidthCollection[n]},getRowHeight:function(n){return this.XLObj.getSheet(this.XLObj.getActiveSheetIndex()).rowsHeightCollection[n]},setColWidth:function(n,t){if(this.XLObj.model.allowResizing){var i=this.XLObj.getActiveSheetIndex();this._currentHCell=n;this._resizeColumnUsingDiff(t,this.XLObj.getSheet(i).columnsWidthCollection[n],[n]);this.XLObj.XLScroll._getColWidths(i,n);this.XLObj.XLSelection.refreshSelection()}},setRowHeight:function(n,t){var r=this.XLObj,i;this.XLObj.model.allowResizing&&(i=this.XLObj.getActiveSheetIndex(),this._currentHCell=n,this._resizeRowUsingDiff(t,this.XLObj.getSheet(i).rowsHeightCollection[n],[n]))},_headerMouseDown:function(n){n.preventDefault();this._colMouseDown(n)},_colMouseDown:function(t){var u,r=this.XLObj,i={};if(u=r._setXY(t,navigator.userAgent.indexOf("WebKit")>-1),this._orgX=u[0]+document.documentElement.scrollLeft,this._orgY=u[1],r._isTouchEvt&&this._mouseHover(t),this._allowStart&&(n(t.target).css("cursor")==="col-resize"||r._isTouchEvt)){if(i.event=t,i.target=t.target,i.colIndex=this._currentHCell,i.oldWidth=t.target.getBoundingClientRect().width,i.reqType="column-resize",r._trigger("resizeStart",i))return;t.button!==2&&this._start(this._orgX,this._orgY);this._resizeType="Col";t.preventDefault()}},_mouseHover:function(t){var s,i=this.XLObj,r=t.target,c=i.getActiveSheetIndex(),o=i._getJSSheetHeader(c);if(!this._$visualElem.is(":visible")&&(i._hasClass(r,"e-headercelldiv")&&(r=r.parentNode),i._hasClass(r,"e-headercell"))){var e=r,u=e.getBoundingClientRect(),h=i._setXY(t),f=h[0],l=h[1];if(s=n(o.find(".e-table")[0]).width()+n(o.find(".e-columnheader")[0]).offset().left,(f>=u.left+document.documentElement.scrollLeft+e.offsetWidth-(i._isTouchEvt?15:5)||f<=u.left+(i._isTouchEvt?13:3))&&f<s&&f>=u.left&&l<=u.top+document.documentElement.scrollTop+r.offsetHeight){if(this._currentHCell=o.find(".e-headercell").index(e),this._currentHCell<1&&f<u.left+e.offsetWidth-(i._isTouchEvt?15:5)||this._preventColResize(this._currentHCell,!1))return;i.addClass(r,"e-ss-colresize");this._allowStart=!0}else i._removeClass(n(".e-ss-colresize")[0],"e-ss-colresize"),this._allowStart=!1,this._currentHCell=-1}},_preventColResize:function(n,t){this._currentHCell=n;var r=this.XLObj,c=r.getActiveSheetIndex(),u=[],s=r.getSheet(c).pivotMngr.pivot,u=r.getObjectKeys(s),f,o,h,e,i,l=u.length;if(u.length)for(i=0;i<l;i++)return f=s[u[i]].colIndex,h=r.element.find("#"+u[i]).data("ejPivotGrid"),e=h.calculateCellWidths().columnWidths.length,e||(e=3),o=f+e,t?this._currentHCell>=f&&this._currentHCell<o:this._currentHCell>=f&&this._currentHCell<=o},_start:function(i){var r=this.XLObj,f,e=r.getActiveSheetIndex(),o=r._getJSSheetHeader(e),c=o.find(".e-columnheader"),s=c.find(".e-headercell"),u,h;(this._currentHCell>-1&&this._currentHCell<s.length&&(u=s[this._currentHCell]),t.isNullOrUndefined(u))||(h=u.getBoundingClientRect(),this._tableY=h.top+parseInt(navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollTop:document.documentElement.scrollTop),this._allowStart?(this._$visualElem=n(document.createElement("div")),f=r._getJSSheetContent(e).height()+o.height(),this._$visualElem.addClass("e-reSizeColbg").appendTo(r.element).css({height:f+"px"}).addClass("e-ss-colresize"),this._$visualElem.css({left:i-1,top:this._tableY}),this._oldWidth=u.offsetWidth,this._extra=i-this._orgX,this._resizeStart=!0):this._currentHCell=-1)},_cMouseMove:function(n){if(this._resizeStart){var t=this.XLObj._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0];t+=document.documentElement.scrollLeft;n.preventDefault();this._moveVisual(t);this.XLObj.addClass(n.target,"e-ss-colresize")}else this._mouseHover(n)},_reSize:function(t){var f,i=this.XLObj,s,r=i.getActiveSheetIndex(),e,l=i._getJSSheetHeader(r),h=l.find(".e-colselected"),c=h.length,u,o=[];if(this._initialTableWidth=i._getJSSheetHeader(r).find(".e-headercontent").width(),this._getResizableCell(),this._currentHCell>-1&&this._resizeStart){for(f=i.getSheet(r).columnsWidthCollection[this._currentHCell],c>0&&(u=h[0].cellIndex),e=0;e<c;e++)this._currentHCell===u&&(s=!0),o.push(u),u++;s||(o=[this._currentHCell]);this._resizeColumnUsingDiff(t-this._orgX+f,f,o);i._isAutoWHMode&&i._autoSSWidthHeight();i.model.allowAutoFill&&(i.XLDragFill.positionAutoFillElement(),i.XLDragFill.hideAutoFillOptions());n("#"+i._id+"ddlspan").length&&i._ddlPosition()}i.XLScroll._getRowHeights(r,this._currentHCell);i.model.allowFreezing&&i.XLFreeze._refreshFColResize(this._currentHCell);i.model.allowSelection&&i.XLSelection._refreshBorder();this._removeVisualElem()},_resizeColumnUsingDiff:function(t,i,r){var h,f,c,l,a,v,p,w,u=this.XLObj,y={},o=u.getActiveSheetIndex(),b=u._getJSSheetHeader(o),e,k,d,s,g;if(t>0){for(t=t>this._colMinWidth?t:this._colMinWidth,e=0,k=r.length;e<k;e++){if(u.XLEdit.getPropertyValue(0,r[e],"wrapCol")&&u.XLEdit.getPropertyValue(0,r[e],"wrapWidth")>t){u._dupDetails=!0;continue}if(p=b.find("col:eq("+r[e]+")"),w=u._getJSSheetContent(o).find(".e-spreadsheetcontentcontainer").find("col:eq("+r[e]+")"),p.outerWidth(t),w.width(t),u.getSheet(o).columnsWidthCollection[r[e]]=t,t<i)for(a=u._getContent(o).find(".e-rowcell:nth-child("+(r[e]+1)+")"),s=0,d=a.length;s<d;s++)f=u._getCellIdx(a[s]),c=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2"),c&&(u._refreshGlobalSpan(),h=n("#"+u._id+"_emptySpan"),u.addClass(h[0],"e-rowcell"),h.text(c),l=h.outerWidth(),u._refreshGlobalSpan(),t<l&&(u._textClip(f.rowIndex,f.colIndex,"delete"),u._textClip(f.rowIndex,f.colIndex,"add",l)));else for(v=u._getContent(o).find(".e-rowcell.e-ofbrdr:nth-child("+(r[e]+1)+")"),s=0,g=v.length;s<g;s++)f=u._getCellIdx(v[s]),u._textClip(f.rowIndex,f.colIndex,"delete","",!0),u._textClip(f.rowIndex,f.colIndex,"add","",!0)}b.find(".e-columnheader").css("cursor","default");u._dupDetails||(y={sheetIndex:o,cols:r,newWidth:t,oldWidth:i,reqType:"resize-column"},i!==t&&(u._completeAction(y),u._trigActionComplete(y)));u._dupDetails&&(u._dupDetails=!1);u.XLScroll._getColWidths(o,r[0]);u.model.scrollSettings.allowScrolling&&(u.XLScroll._refreshScroller(o,"refresh","all"),u.XLScroll._getFirstColumn(o))}},_calculateWidth:function(){for(var t=this.XLObj,i=t._getJSSheetHeader(t.getActiveSheetIndex()).find("col"),r=0,n=0;n<i.length;n++)r+=i.eq(n).width();return r},_cMouseUp:function(n){if(this._resizeStart){var r,i=this.XLObj,u=this._currentHCell,f=i.getSheet(i.getActiveSheetIndex()).columnsWidthCollection,t={};if(r=i._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0],r+=document.documentElement.scrollLeft,t.event=n,t.target=n.target,t.oldWidth=f[u],t.colIndex=this._currentHCell,this._reSize(r),t.newWidth=f[u],t.reqType="column-resize",this.XLObj._trigger("resizeEnd",t))return;i.element.find("#"+i._id+"ddl").ejDropDownList("hidePopup")}},_getResizableCell:function(n){for(var i=this.XLObj,r=i.getActiveSheetIndex(),o=i._getJSSheetHeader(r).find(".e-columnheader"),u=o.find(".e-headercell"),s=navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollLeft:document.documentElement.scrollLeft,f,e,t=0,h=u.length;t<h;t++)if(e=u[t].getBoundingClientRect(),f=e.left+s+5,f>this._orgX){i.isUndefined(n)?this._currentHCell=t-1:n.target=i._getJSSheetHeader(r).find("th:eq("+(t-1)+")")[0];return}},_moveVisual:function(n){var i=this.XLObj,t=i._getJSSheetHeader(i.getActiveSheetIndex()).find(".e-headercontent")[0].getBoundingClientRect();t.left+document.documentElement.scrollLeft+t.width<n||n<t.left+document.documentElement.scrollLeft?this._$visualElem.remove():this._currentHCell>-1&&this._$visualElem.css({left:n-1,top:this._tableY})},_rowMouseDown:function(t){var f,r,u,i={},e=this.XLObj;if(e._isTouchEvt&&this._rowMouseHover(t),this._allowStart&&n(t.target).css("cursor")==="row-resize"){if(u=e._setXY(t,navigator.userAgent.indexOf("WebKit")>-1),f=u[0],r=u[1],r+=document.documentElement.scrollTop,i.event=t,i.target=t.target,i.rowIndex=this._currentHCell,i.oldHeight=t.target.getBoundingClientRect().height,i.reqType="row-resize",this.XLObj._trigger("resizeStart",i))return;t.button!==2&&this._rowStart(f,r);this._resizeType="Row";t.preventDefault()}return!1},_rowMouseHover:function(t){var r;if(!this._$visualElem.is(":visible")&&(r=n(t.target),r.hasClass("e-rowheader"))){var i=this.XLObj,o=i.getActiveSheetIndex(),h=i._getJSSheetRowHeaderContent(o),e=r.get(0),u=e.getBoundingClientRect(),s=i._setXY(t),c=s[0],f=s[1],l=i._getJSSheetRowHeader(o).find(".e-table").height()+h.find("tbody").offset().top;if((f>=u.top+document.documentElement.scrollTop+e.offsetHeight-(i._isTouchEvt?8:5)||f<=u.top+(i._isTouchEvt?8:3))&&f<l&&f>=u.top&&c<=u.left+document.documentElement.scrollLeft+t.target.offsetWidth){if(this._resizeElt=r.parent(),this._currentHCell=i.model.scrollSettings.allowVirtualScrolling?parseInt(this._resizeElt.attr("idx")):this._resizeElt[0].rowIndex,this._currentHCell<1&&f<u.top+e.offsetHeight-(i._isTouchEvt?8:5)||this._preventRowResize(this._currentHCell,!1))return;r.addClass("e-ss-rowresize");this._allowStart=!0}else n(".e-ss-rowresize").removeClass("e-ss-rowresize"),this._allowStart=!1,this._currentHCell=-1;this._resizerowId=t.target.parentNode.getAttribute("idx")}},_preventRowResize:function(n,t){this._currentHCell=n;var r=this.XLObj,c=r.getActiveSheetIndex(),u=[],s=r.getSheet(c).pivotMngr.pivot,u=r.getObjectKeys(s),f,o,h,e,i,l=u.length;if(u.length)for(i=0;i<l;i++)return f=s[u[i]].rowIndex,h=r.element.find("#"+u[i]).data("ejPivotGrid"),e=h._rowCount,e||(e=4),o=f+e,t?this._currentHCell>=f&&this._currentHCell<o:this._currentHCell>=f-1&&this._currentHCell<=o},_rowStart:function(t,i){var r=this.XLObj,f=r.getActiveSheetIndex(),e=this._resizeElt[0].rowIndex,o=r._getJSSheetRowHeader(f).find(".e-rowheader"),u,s,h;(this._currentHCell>-1&&e<o.length&&(u=o[e]),u)&&(s=u.getBoundingClientRect(),this._tableX=s.left+parseInt(navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollLeft:document.documentElement.scrollLeft),this._allowStart?(this._$visualElem=n(document.createElement("div")),h=r._getJSSheetContent(f).width(),this._$visualElem.addClass("e-reSizeRowbg").appendTo(r.element).css({width:h+"px"}).addClass("e-ss-rowresize"),this._$visualElem.css({top:i-3,left:this._tableX}),this._oldHeight=u.offsetHeight,this._orgX=t,this._orgY=i,this._extra=i-this._orgY,this._resizeStart=!0):this._currentHCell=-1)},_rMouseMove:function(t){if(this._resizeStart){var i=this.XLObj._setXY(t,navigator.userAgent.indexOf("WebKit")>-1)[1];i+=document.documentElement.scrollTop;t.preventDefault();n(t.target).addClass("e-ss-rowresize");this._moveRowVisual(i)}else this._rowMouseHover(t)},_rowResize:function(t,i){var u,r=this.XLObj,f=r.getActiveSheetIndex(),p=r.getRows(f)[1],s=!1,h,w=r._getJSSheetRowHeaderContent(f),l=w.find(".e-rowselected"),a=l.length,e,v,c=[],y=0,o;if(this._initialTableHeight=r._getJSSheetRowHeader(f).find(".e-rowheadercontent").height(),this._getResizableRowCell(),s=n(p[this._currentHCell]).find(".e-sswraptext").length>0,this._currentHCell>-1&&this._resizeStart){for(o=0;o<=this._resizerowId;o++)r.XLEdit.getPropertyValue(o,0,"isRHide")&&y++;if(u=r.getSheet(f).rowsHeightCollection[this._currentHCell+y],!s||s&&i-this._orgY+u>u){for(a>0&&(e=l[0].parentNode.rowIndex),h=0;h<a;h++)this._currentHCell===e&&(v=!0),c.push(e),e++;v||(c=[this._currentHCell]);this._resizeRowUsingDiff(i-this._orgY+u,u,c)}r.model.allowAutoFill&&(r.XLDragFill.positionAutoFillElement(),r.XLDragFill.hideAutoFillOptions());r._isAutoWHMode&&r.model.showRibbon&&r._autoSSWidthHeight(f,!0)}r.model.allowSelection&&r.XLSelection._refreshBorder();this._removeVisualElem()},_resizeRowUsingDiff:function(n,t,r){var u=this.XLObj,f=u.getActiveSheetIndex(),o={},s=u._getJSSheetRowHeaderContent(f),l,a,v,e,h,c;if(n>0){for(n=n>this._rowMinHeight?n:this._rowMinHeight,i=0,l=r.length;i<l;i++)e=r[i],h=u.model.scrollSettings.allowVirtualScrolling?u.getSheet(f)._virtualRowIdx.indexOf(e):e,c=this._getContentHeight(e,f)<=n,u._isRowViewable(f,e)&&(u._isUndoRedo||c)&&(a=s.find("tr:eq("+h+")"),v=u._getJSSheetContent(f).find(".e-content").find("tr:eq("+h+")"),a.outerHeight(n),v.height(n)),(u._isUndoRedo||c)&&(u.getSheet(f).rowsHeightCollection[e]=n);u.XLScroll._getRowHeights(f,r[0]);s.find("tbody").css("cursor","default");s.find("tbody").children().css("cursor","default");u._dupDetails||(o={sheetIndex:f,rows:r,newHeight:n,oldHeight:t,reqType:"resize-row"},t!==n&&(u._completeAction(o),u._trigActionComplete(o)));u.model.allowFreezing&&u.XLFreeze._refreshFRowResize(e);u.model.scrollSettings.allowScrolling&&(u.XLScroll._refreshScroller(f,"refresh","all"),u.XLScroll._getFirstRow(f))}},_findRowsHeight:function(n){for(var t=this.XLObj,i=t.getActiveSheetIndex(),f=t.getSheet(i),e=t._getJSSheetContent(i).find("tbody").children(),r,u=0,o=n.length;u<o;u++)r=n[u],t._sheets[i]._Rows[0]&&(f.rowsHeightCollection[r]=e.eq(r).height())},_calculateHeight:function(){for(var t=this.XLObj,i=t.getRows(t.getActiveSheetIndex())[0],r=0,n=0,u=i.length;n<u;n++)r+=i.eq(n).height();return r},_rMouseUp:function(t){if(this._resizeStart){var r=this.XLObj,u=this._currentHCell,f=r.getSheet(r.getActiveSheetIndex()).rowsHeightCollection,i={},e=r._setXY(t,navigator.userAgent.indexOf("WebKit")>-1);if(x=e[0],y=e[1],y+=document.documentElement.scrollTop,i.event=t,i.target=t.target,i.oldHeight=f[u],i.rowIndex=this._currentHCell,this._rowResize(x,y),i.newHeight=f[u],i.reqType="row-resize",this.XLObj._trigger("resizeEnd",i))return;n("#"+this.XLObj._id+"ddlspan").length&&this.XLObj._ddlPosition()}},_getResizableRowCell:function(t){for(var r=this.XLObj,e=r.getActiveSheetIndex(),u=r._getJSSheetContent(e).find(".e-rowheader"),c=navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollTop:document.documentElement.scrollTop,o,f,s=1,h,i=0,l=u.length;i<l;i++)if(f=u[i].getBoundingClientRect(),f.top===0&&s++,o=f.top+c+5,o>this._orgY){r.isUndefined(t)?(h=n(u[i-1]).is(":visible")?i-1:i-s,this._currentHCell=r._getCellIdx(u[h]).rowIndex):t.target=r._getJSSheetRowHeader(e).find("tr:eq("+i+") td")[0];return}},_moveRowVisual:function(n){var i=this.XLObj,t=i._getJSSheetContent(i.getActiveSheetIndex()).find(".e-rowheadercontent")[0].getBoundingClientRect();t.top+document.documentElement.scrollTop+t.height<n||n<t.top+document.documentElement.scrollTop?this._$visualElem.remove():this._currentHCell>-1&&this._$visualElem.css({top:n-3,left:this._tableX})},_apMouseDown:function(t){var i,r=this.XLObj;return r._isTouchEvt&&this._apMouseHover(t),this._allowStart&&n(t.target).closest("div").css("cursor")==="col-resize"&&(i=r._setXY(t,navigator.userAgent.indexOf("WebKit")>-1)[0],i+=document.documentElement.scrollLeft,t.button!==2&&this._apStart(i),this._resizeType="AP",t.preventDefault()),!1},_apMouseHover:function(t){var i=this.XLObj;if(!this._$visualElem.is(":visible")){var r=n(t.target),e=r.get(0),u=i.getActivationPanel()[0].getBoundingClientRect(),f=i._setXY(t)[0];f<=u.left+(i._isTouchEvt?20:4)&&f>=u.left?(r.parent().addClass("e-ss-apresize"),this._allowStart=!0):(i.element.find(".e-ss-apresize").removeClass("e-ss-apresize"),this._allowStart=!1)}},_apStart:function(t){var i=this.XLObj,f=i.getActivationPanel()[0],e=f.getBoundingClientRect(),r=i.getActiveSheetIndex(),u;this._tableY=e.top+parseInt(navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollTop:document.documentElement.scrollTop);this._allowStart&&(this._$visualElem=n(document.createElement("div")),u=i._getJSSheetContent(r).height()+i._getJSSheetHeader(r).height(),this._$visualElem.addClass("e-reSizeAPbg").appendTo(i.element).css({height:u+"px"}).addClass("e-ss-apresize"),this._$visualElem.css({left:t,top:this._tableY}),this._resizeStart=!0)},_apMouseMove:function(n){if(this._resizeStart){var i=this.XLObj,t=i._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0];t+=document.documentElement.scrollLeft;n.preventDefault();this._apMoveVisual(t)}else this._apMouseHover(n)},_apMouseUp:function(n){if(this._resizeStart){var i=this.XLObj,t=i._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0];t+=document.documentElement.scrollLeft;this._apReSize(t)}},_apMoveVisual:function(n){this._$visualElem.css({left:n-5,top:this._tableY})},_apReSize:function(t){var i=this.XLObj,s=i.model.activationPanelWidth,f=0,r=n.extend(!0,{},i.model.scrollSettings),e=i.getActivationPanel(),o,u;r.width=i._responsiveWidth;r.height=i._responsiveHeight;i.model.activationPanelWidth=Math.abs(r.width-(t-i.element.offset().left));i.model.enablePivotTable&&(u=i.getActivationPanel().data("ejScroller"),f=i.getActivationPanel().find(".e-vscrollbar").length?20:2,e.find(".e-ss-pivotfield").width(i.model.activationPanelWidth-f),e.find("#"+i._id+"_PivotField").width(i.model.activationPanelWidth-f),s>i.model.activationPanelWidth?(u.option({width:i.model.activationPanelWidth-1}),i._setSheetWidthHeight(i.getActiveSheetIndex(),{width:r.width,height:r.height},null,"resize")):(i._setSheetWidthHeight(i.getActiveSheetIndex(),{width:r.width,height:r.height},null,"resize"),u.option({width:i.model.activationPanelWidth-1})),o=i.getActivationPanel().find("#"+i._id+"_PivotTableSchema_"+i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).data("ejPivotSchemaDesigner"),o._reSizeHandler(),u.refresh());this._removeVisualElem()},_removeVisualElem:function(){var n=this.XLObj;this._$visualElem.remove();n.element.find(".e-reSizeRowbg").remove();this._resizeStart=!1;this._currentHCell=-1;this._resizeType="";this._allowStart=!1;n.model.allowComments&&n.XLComment._updateCmntArrowPos()},fitWidth:function(n){var t=this.XLObj,r=t.getActiveSheetIndex(),i,u;if(t.model.allowResizing){for(i=0,u=n.length;i<u;i++)this._fitWidth(n[i],0,t.getSheet(r).usedRange.rowIndex);t.model.scrollSettings.allowScrolling&&(t.XLScroll._getColWidths(r,n[0]+1),t.XLScroll._refreshScroller(r,"refresh","horizontal"));t.model.allowSelection&&t.XLSelection._refreshBorder();t.model.allowComments&&t.XLComment._updateCmntArrowPos(null,r,{colIndex:n[i]})}},_resizeToFitWidth:function(t){var i=this.XLObj,f=n(t.target),r=i.getActiveSheetIndex(),u=i.getSheet(r).usedRange.rowIndex;this._getResizableCell(t);this._fitWidth(t.target.cellIndex,0,u);i.model.scrollSettings.allowScrolling&&(i.XLScroll._getColWidths(i.getActiveSheetIndex(),t.target.cellIndex+1),i.XLScroll._refreshScroller(r,"refresh","horizontal"));i.model.allowSelection&&i.XLSelection._refreshBorder();i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement();i.model.allowComments&&i.XLComment._updateCmntArrowPos(null,r,{colIndex:t.target.cellIndex})},_fitWidth:function(t,i,r){var u=this.XLObj,f=u.getActiveSheetIndex(),o=u._getJSSheetHeader(f).find(".e-headercell")[t],a=n(o).children(".e-headercelldiv"),e=0,h=0,s=0,c=u.getSheet(f),l;r=r?r:c.usedRange.rowIndex;s=this._getContentWidth(t,f,i,r);h=this._getHeaderContentWidth(a,f);s>1&&(e=h>s?h:s,l={target:o,sheetIndex:f,colIndex:t,newWidth:e,oldWidth:o.offsetWidth,reqType:"resize-fit-width"},e>0&&(e<20&&(e=30),this._applyWidth(o,f,t,e),u.model.allowFreezing&&u.XLFreeze._refreshFColResize(t),u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement(),c._isImported&&!c._isLoaded||u._isUndoRedo||u._dupDetails||u._isExport||(u._completeAction(l),u._trigActionComplete(l))));u.XLEdit._updateDataContainer({rowIndex:0,colIndex:t},{dataObj:{isFitWidth:!0}})},_applyWidth:function(n,t,i,r){var u=this.XLObj;u._getJSSheetHeader(t).find("col:eq("+i+")").width(r);u._getJSSheetContent(t).find("col:eq("+(i+1)+")").width(r);u.getSheet(t).columnsWidthCollection[i]=r;u.getSheet(t).columns[i].width=r},_getContentWidth:function(n,i,u,f){for(var c=0,s,h,l=this.XLObj,a=l._dataContainer.sheets[i],o,e=u;e<=f;e++)t.isNullOrUndefined(a[e])||(s=a[e][n]),t.isNullOrUndefined(s)?(s={},h={spanWidth:0,paddingWidth:0}):h=this._getCalculatedCellWidth(i,s),o=l._detailsFromGlobalSpan(e,n,"width",l.XLEdit.getPropertyValue(e,n,"value2"),r,!0),o=o+h.spanWidth+h.paddingWidth+4,o>c&&(c=o);return c},_getCalculatedCellWidth:function(n,t){var i=0,r=0;return"isFilterHeader"in t?"isFilterVisible"in t&&(i+=17):i+=0,r=3,{spanWidth:i,paddingWidth:r}},_getHeaderContentWidth:function(n){var i=0,r=t.buildTag("span",{},{}),u=n.html();return r.html(u),n.html(r),i=n.find("span:first").width(),i=i+10,n.html(u),i},fitHeight:function(n){var i=this.XLObj,u,r,f;if(i.model.allowResizing){for(u=i.getActiveSheetIndex(),r=0,f=n.length;r<f;r++)t.isNullOrUndefined(i.XLEdit.getPropertyValue(n[r],0,"wrapRow"))&&this._fitHeight(n[r],n[r]),i._setRowHdrHeight(u,n[r]);i.model.scrollSettings.allowScrolling&&(i.XLScroll._getRowHeights(u,n[0]),i.XLScroll._refreshScroller(u,"refresh","vertical"));i.model.allowSelection&&i.XLSelection._refreshBorder();i.model.allowComments&&i.XLComment._updateCmntArrowPos(null,u,{rowIndex:n[0]})}},_resizeToFitHeight:function(n){var t=this.XLObj,i=t.getActiveSheetIndex(),r=n.target.parentNode.rowIndex,u;u=t.model.scrollSettings.allowVirtualScrolling?t.getSheet(i)._virtualRowIdx[r]:r;this._getResizableRowCell(n);this._fitHeight(r,u);t._setRowHdrHeight(i,u);t.model.scrollSettings.allowScrolling&&(t.XLScroll._getRowHeights(t.getActiveSheetIndex(),u),t.XLScroll._refreshScroller(i,"refresh","vertical"));t.model.allowSelection&&t.XLSelection._refreshBorder();t.model.allowAutoFill&&t.XLDragFill.positionAutoFillElement();t.model.allowComments&&t.XLComment._updateCmntArrowPos(null,i,{rowIndex:r})},_fitHeight:function(i,r){var u=this.XLObj,f=u.getActiveSheetIndex(),s=u.getSheet(f),l=u._getJSSheetRowHeader(f).find(".e-rowheader")[i],e=0,h=0,o,a=t.buildTag("span",{},{height:20,width:30}),c;h=this._getContentHeight(r,f,u.XLEdit.getPropertyValue(r,0,"wrapRow"));a.html(r+1);u.element.append(a);o=u.element.find("span:last").outerHeight(!0);u.element.find("span:last").remove();o=o+4;e=h<o?o:h;c={target:l,sheetIndex:f,rowIndex:r,newHeight:e,oldHeight:s.rowsHeightCollection[i],reqType:"resize-fit-height"};u._isRowViewable(f,r)&&(n(l.parentElement).height(e),n(u._getContent(f).find("tr")[i]).height(e));u.getSheet(f).rowsHeightCollection[r]=e;u.model.allowFreezing&&u.XLFreeze._refreshFRowResize(i);u.model.scrollSettings.allowScrolling&&u.XLScroll._refreshScroller(f,"refresh","all");s._isImported&&!s._isLoaded||u._dupDetails||u._isExport||(u._completeAction(c),u._trigActionComplete(c));u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement();u.XLEdit._updateDataContainer({rowIndex:r,colIndex:0},{dataObj:{isFitHeight:!0}})},_getContentHeight:function(n,t,i){for(var u=this.XLObj,e=0,o,a=u._formatRegx,h=u.getSheet(t),s=u.getObjectKeys(u._dataContainer.sheets[t][n]),v=h.rowsHeightCollection[n],c=h.columnsWidthCollection,f=0,l=s.length;f<l;f++)o=u._detailsFromGlobalSpan(n,s[f],"height",u.XLEdit.getPropertyValue(n,s[f],"value2"),i?c[f]:r,!0),o>e&&(e=o);return e+3},_setRowHdrHeightResize:function(i,r){for(var f=this.XLObj,e=f.getRows(i),o=e[0],s=f.getSheet(i).usedRange.rowIndex,u=0;u<=s;u++)t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,r,"mergeIdx"))&&t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,r,"merge"))&&f._isRowViewable(i,u)&&(tdHeight=f._detailsFromGlobalSpan(u,r,"height",f.XLEdit.getPropertyValue(u,r,"value2")),n(o[u]).height(tdHeight))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.editing=function(n){this.XLObj=n;this._EditCellDetails={value:null,rowIndex:-1,columnIndex:-1,fieldName:null,cell:null};this._isEdit=!1;this._isFEdit=!1;this._isFormulaEdit=!1;this._isFBarFocused=!1;this._skipHTML=!1;this._editElem=null;this._filterIcon=null;this._isCellEdit=!0;this._validOperators=["+","-","*","/",","];this._invalidOperators=["%"];this._validCharacters=["+","-","*","/",",","(","="];this._textDecoration=!1;this._editCell=null;this._acPosition={left:0,top:0};this._isValidation=!1};t.spreadsheetFeatures.editing.prototype={getCurrentEditCellData:function(){var r,n,t=this.XLObj,i;return this._isEdit?(r=t.element.find("#"+t._id+"_Edit"),n=r.text(),i=t._getCellIdx(this._editCell[0]),this.getPropertyValue(i.rowIndex,i.colIndex,"type")!="text"&&t.isNumber(n)&&(n=parseFloat(n)),n):null},getColumnIndexByField:function(n){for(var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()),t=0,u=r.columns.length;t<u;t++)if(r.columns[t].field===n)break;return t},_processEditing:function(){this._editElem||(this._editElem=t.buildTag("div.e-field e-ss-input","",{},{id:this.XLObj._id+"_Edit",contenteditable:!0}),this._editElem.data("parentID",this.XLObj._id))},editCell:function(t,i,r){var u=this.XLObj,o,f,c,e,l,a,s,h,v;u.model.allowEditing&&u.model.allowSelection&&!u._isCellProtected(t,i,!0)&&!u.model.isReadOnly&&((u=this.XLObj,v=u.element.find("#"+u._id+"_ValElem"),h={rowIndex:t,colIndex:i},o=u.getActiveSheetIndex(),f=u.getSheet(o),l=u.getActiveCell(o),u._isRowViewable(o,t)&&(this._textDecoration=u.getCell(t,i).find("a").css("text-decoration")==="none"),s=u.getCell(t,i),column=f.columns[i],this._editCell=s,e={columnName:column.field,value:u.getRangeData({range:[t,i,t,i],valueOnly:!0,sheetIdx:o,skipDateTime:!0})[0],columnObject:column,cell:s,rowIndex:t,colIndex:i},u._trigger("cellEdit",e))||(u._cureditedCell=e.value,this._isValidation&&(v.rules("remove"),this._isValidation=!1),(l.rowIndex!==t||l.colIndex!==i)&&(f._activeCell=h,f._startCell.rowIndex<=t&&f._startCell.colIndex<=i&&f._endCell.rowIndex>=t&&f._endCell.colIndex>=i?u.XLSelection.selectRange(f._startCell,f._endCell):u.XLSelection.selectRange(h,h),u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement()),this._EditCellDetails={rowIndex:t,value:e.value,columnIndex:i,fieldName:column.field,cell:s},r||(e.value=""),a=e.value,this._renderBulkEditObject(e,s,a),this.getPropertyValue(f._activeCell.rowIndex,f._activeCell.colIndex,"rule",o)&&u.model.allowDataValidation&&u.XLValidate._setValidation(),c=n("#"+u._id+"_Edit"),this.getPropertyValue(t,i,"hyperlink",o)&&c.addClass("e-hyperlinks"),this._textDecoration&&c.css("text-decoration","none"),u.model.allowComments&&s.hasClass("e-commentcell")&&u.XLComment._visibleCmntCnt(s),e.cell.addClass(u._browserDetails.name==="msie"?"e-editedcell e-msie-edit":"e-editedcell"),u.isFormula(e.value)&&this._processFormulaEditRange(e.value),u.model.allowKeyboardNavigation&&(u.XLCellNav._isNavigate=!1),u.model.enableContextMenu&&n("#"+u._id+"_contextMenuCell").data("ejMenu")._contextMenuEvents("_off")))},_renderBulkEditObject:function(i,r,u){var s,a,f=this.XLObj,v=r.height(),o=f.getActiveSheetIndex(),h=r.find(".e-filterspan"),l=f._getJSSheetContent(o).find(".e-spreadsheetcontentcontainer > .e-content"),y=f.XLFormat.getFormatClass(r[0].className),c,e;({})[i.columnObject.field]=i.value;h.length&&(a={filterIcon:h,rowIndex:h.parentsUntil("table").eq(1).index(),colIndex:h.parent().index()},this._filterIcon=a);s=r.height();this._refreshTextNode(r[0]);r.hasClass("e-sswraptext")&&v!==s&&r.height(v);e=this._editElem;e.text("");t.isNullOrUndefined(u)||e.text(f.isNumber(u)?f._getlocaleNumVal(u,!0):u);l.append(e);c=f._isClassHasProperty(y,"text-align","right")?{right:l.width()-r[0].offsetLeft-r[0].offsetWidth+2,left:"",maxWidth:r[0].offsetLeft+r[0].offsetWidth+2}:{left:r[0].offsetLeft+2,right:"",maxWidth:l.width()-(r.offset().left-(f.element.offset().left+n(f.getRows(o)[0][0]).width()))-2};e.css({left:c.left,right:c.right,top:r[0].offsetTop+1,"-webkit-user-select":"text",cursor:"text","min-height":s-1,height:"auto",lineHeight:"normal",wordWrap:"break-word",position:"absolute",minWidth:r.width(),whiteSpace:"pre-wrap"});this._editCell.hasClass("e-sswraptext")?(e.css({width:r.width(),maxWidth:""}),n(f.getRows(o)[1][r.parent().attr("idx")]).height(f.model.sheets[o].rowsHeightCollection[r.parent().attr("idx")]),f.XLScroll._getRowHeights(o,r.parent().index())):e.css({width:"",maxWidth:c.maxWidth});e.show();this._refreshEditForm(r,e,i.value,u,s);this._isEdit=!0;f.model.showRibbon&&f.XLRibbon._disableRibbonIcons()},_refreshEditForm:function(t,i,r,u){var h,e,c={},f=this.XLObj,l=document.getElementById(f._id+"EditForm"),a=n(l).find("input,select"),o=f._dataContainer.sheets[f.getActiveSheetIndex()],s=t.parent().index();o&&o[s]&&o[s][t[0].cellIndex]&&(c=o[s][t[0].cellIndex]);i[0].className="";e=this.getPropertyValueByElem(t,"type")||"";!f.isNumber(u)||e.indexOf("text")>-1||i.addClass("e-ralign");(e.indexOf("date")>-1||e.indexOf("time")>-1)&&i.addClass("e-ralign");i.css({border:"none",outline:"none"});this.XLObj.model.allowCellFormatting&&(h=f.XLFormat.getFormatClass(t[0].className));i.addClass(h);f.model.allowCellFormatting&&(i.css({color:t.css("color")}),i.css({"background-color":t.css("background-color")}));i.on("keyup",{xlObj:f},function(t){var i=t.data.xlObj;i.XLEdit._isFormulaEdit=!n(t.target).text().indexOf("=");i.XLEdit._isFormulaEdit&&i.XLEdit._processFormulaEditRange(n(t.target).text());i.model.allowFormulaBar&&i._getInputBox().val(n(t.target).text());i.XLEdit._isCellEdit=!0});i.on("focus",{xlObj:f},function(n){var t=n.data.xlObj;t.XLEdit._isCellEdit=!0});f._setFormulaSuggElem(n("#"+f._id+"_AutoComplete_suggestion"));i.focusEnd()},_renderAutoComplete:function(t,i,r,u){var f=this.XLObj,e=u?" e-cell-ac e-ss-editinput":"";t.ejAutocomplete({dataSource:f._formulaCollection,value:i,cssClass:"e-ss-autocomplete"+e,width:"100%",height:r,htmlattributes:u?{display:"none"}:"",delaySuggestionTimeout:10,minCharacter:2,popupWidth:"170px",popupHeight:"150px",showEmptyResultText:!1,autoFocus:!0,template:"<span class='e-icon e-ss-function'> <\/span><div> ${display} <\/div>",select:n.proxy(this._formulaSelect,f),open:n.proxy(this._formulaSuggestionStatus,f),close:n.proxy(this._formulaSuggestionStatus,f)});t.data("ejAutocomplete")._bubbleEvent(!0)},_refreshAutoComplete:function(){var t=this.XLObj,i,r,u="ejAutocomplete",f="dataSource";r=n("#"+t._id+"_inputbox").data(u);i=n("#"+t._id+"_AutoComplete").data(u);t.model.allowFormulaBar&&r&&r.option(f,t._formulaCollection);i&&i.option(f,t._formulaCollection)},_captureEditing:function(){var t=this.XLObj,i,f,e,r,u=document.activeElement,o=t.getActiveCell();u&&u.tagName==="DIV"&&t._isRowViewable(null,o.rowIndex)&&(i=t.element.find("#"+t._id+"_AutoComplete"),i.val(n(u).text()),i.data("ejAutocomplete").search(),f=t.getActiveCellElem(),e=t.element.find("#"+t._id+"_Edit")[0],r=f[0].getBoundingClientRect(),this._acPosition.left=r.left+window.pageXOffset,this._acPosition.top=r.top+window.pageYOffset+n(e).height(),n("#"+t._id+"_AutoComplete_suggestion").css({left:this._acPosition.left,top:this._acPosition.top}))},saveCell:function(){var t=this.XLObj,p,a,v,b,o,s,h,it,k,c,d,g,nt,w,rt,r,u,ut,e,f,l,i,tt,ot,ft,et,y;if(t.model.allowEditing&&!t.model.isReadOnly&&(tt=!1,ft=["ABS","LEFT","RIGHT","TRIM","UPPER","VALUE"],this._isEdit)){if(f=t.getActiveSheetIndex(),l=t.getSheet(f),ot=t.getRows(f),v=n("#"+t._id+"EditForm"),d=this._editCell,k=l.columns[this._EditCellDetails.columnIndex],g=t.element.find("#"+t._id+"_ValElem"),et=t.element.find("#"+t._id+"_Edit")[0],y=n(et).html(),nt=t._getCellIdx(d[0]),i=nt.rowIndex,r=nt.colIndex,u={columnName:k.field,value:this.getCurrentEditCellData(),prevValue:this._EditCellDetails.value,columnObject:k,rowIndex:i,colIndex:r,cell:d,isRefCells:!1},t.model.allowDataValidation&&this._isValidation){if(g.val(u.value),v.css("display","block"),!v.validate().element(g[0]))return v.css("display","none"),!1;v.css("display","none");u.hasValidation=!0}if(u.value!==u.prevValue&&t._trigger("cellSave",u))return;if(h=t.getRangeData({range:[i,r,i,r],property:["type","formatStr","decimalPlaces"]})[0],t.isFormula(u.value)&&!this._formulaValidate(u.value))return;if(ut=this._EditCellDetails.value||"",e={sheetIndex:f,rowIndex:i,colIndex:r,cValue:u.value,reqType:"edit",iconName:"",pValue:ut},e.prevHeight=l.rowsHeightCollection[i],t._dupDetails=!0,this._updateCellValue({rowIndex:i,colIndex:r},u.value),t._dupDetails=!1,this.getPropertyValue(i,r,"wrap",f)&&(rHgt=t._getWrapCellHeight(f,i,r),t._wrapCollection(i,r,rHgt.cellHt,f),t._getRowHeight(i,f)<rHgt.rowHt&&(t.setHeightToRows([{rowIndex:i,height:rHgt.rowHt}]),t.model.allowAutoFill&&t.XLDragFill.positionAutoFillElement()),this._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{}})),t.XLEdit.getPropertyValue(i,r,"isFilterHeader")&&t._removeClass(u.cell[0],t._rAlign),this._textDecoration&&u.cell.find("a").css("text-decoration","none"),u.hasValidation&&(e.hasValidation=!0),t.isFormula(u.value)&&(!t.getObjectLength(h)||h.type==="general")&&(e.operation="formula",s=u.value,s=t.XLDragFill._parseFormula(s),ft.indexOf(s[0])===-1)){for(j=0,it=s.length;j<it;j++)if(o=s[j],o!="("&&s[j+1]!="(")break;o.indexOf(":")>-1&&(o=o.split(":")[0]);t._isCellReference(o)&&(o=o.replace(/\$/g,""),fRange=t.getRangeIndices(o),fObj=t.getRangeData({range:fRange,property:["type","formatStr","decimalPlaces"]})[0],t.getObjectLength(fObj)&&fObj.type!=h.type&&fObj.type!=="general"&&(t._dupDetails=!0,tt=!0,t.XLFormat.format(fObj,t._getAlphaRange(t.getActiveSheetIndex(),i,r,i,r)),t._dupDetails=!1,e.prevFrmtObj=t.getObjectLength(h)?h:{type:"general"},e.curFrmtObj=fObj))}if(t._setRowHdrHeight(f,i),t.model.allowFormulaBar&&t.updateFormulaBar(),t.model.scrollSettings.allowScrolling&&t.XLScroll._getRowHeights(f,i),this._isEdit=this._isFormulaEdit=!1,u.cell.removeClass("e-editedcell e-msie-edit"),t.model.allowKeyboardNavigation&&(t.XLCellNav._isNavigate=!0),t.model.showRibbon&&(t.XLRibbon._enableRibbonIcons(),t.XLRibbon._updateRibbonIcons()),t._updateUndoRedoIcons(),t.model.allowInsert||(t.XLRibbon._disableButtons(["Others_Cells_InsertCellOptions"],"ejSplitButton"),t.XLRibbon._disableButtons(["Others_Cells_InsertCell"],"ejButton")),t.model.allowDelete||(t.XLRibbon._disableButtons(["Others_Cells_DeleteCellOptions"],"ejSplitButton"),t.XLRibbon._disableButtons(["Others_Cells_DeleteCell"],"ejButton")),e.cFormatRule=w=this.getPropertyValue(i,r,"cFormatRule",f),t._dupDetails=!0,t.model.allowConditionalFormats&&w){for(p=0,rt=w.length;p<rt;p++)c=w[p].split("_"),c[0]!=="formularule"&&t.XLCFormat._cFormat(c[0],c[2],c[3],c[4],t._generateHeaderText(r+1)+(i+1));t.XLCFormat.refreshCFormat(t._getAlphaRange(f,i,r,i,r))}return t._dupDetails=!1,e.endCell=l._endCell,e.startCell=l._startCell,a=t.getActiveCellElem(),a&&(t.model.allowComments&&a.hasClass("e-commentcell")&&t.XLComment._visibleCmntCnt(a,!0),a.hasClass("e-hlcell")&&t.XLValidate.highlightInvalidData()),this._shiftKeyEnabled=this._isFBarFocused=!1,t._ctrlKeyCount=0,!this._isFormulaEdit&&t.model.allowSelection&&t.XLSelection._clearBorder(t._formulaBorder.join(" ").replace(/,/g," ")+" "+t._ctrlFormulaBorder.join(" ").replace(/,/g," ")),t.model.allowFormulaBar&&(b=n("#"+t._id+"_inputbox").data("ejAutocomplete"),b&&b.hide()),this._editElem.hide(),t.setSheetFocus(),t._browserDetails.name==="mozilla"&&(y=y.slice(0,-4)),y.indexOf("\n")>-1&&(e.altwrap=!0,this._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{altTxt:!0}})),this.getPropertyValue(i,r,"altTxt",f)&&(this.getPropertyValue(i,r,"wrap",f)||t.wrapText([i,r,i,r]),y.match(/\n/g)||this._clearDataContainer({cellIdx:{rowIndex:i,colIndex:r},property:["altTxt"]})),e.newHeight=l.rowsHeightCollection[i],t.XLScroll._getRowHeights(f,i),t.model.enableContextMenu&&n("#"+t._id+"_contextMenuCell").data("ejMenu")._contextMenuEvents("_on"),(u.value!==u.prevValue||tt)&&(t._completeAction(e),t._trigActionComplete(e)),!0}},_formulaValidate:function(n){var f,h,t,e,o,c,l,s,u,a,i=n,r=this.XLObj,v=["TODAY","NOW","TRUE","FALSE","ROW","COLUMN","SHEET","SHEETS"];if(!this._isNamedRange(n)&&(c=i.length,e=i.split("(").length,o=i.split(")").length,s=r.getCalcEngine().getLibraryFunctions(),i.startsWith("=")&&c>1)){if(t=i=i.substring(1),e!==o){r._showAlertDlg("Alert","MissingParenthesisAlert","FormulaAlert",440);return}if(e===1&&o===1&&r.isUndefined(s.getItem(t.toUpperCase()))&&!this._isValidCell(i)&&!(t.substring(0,u)=="TRUE"||t.substring(0,u)=="FALSE")){r._showAlertDlg("Alert","CorrectFormula","FormulaAlert",372);return}do{if(u=t.indexOf("("),a=t.indexOf(")"),v.indexOf(t.substring(0,u).toUpperCase())<0&&u+1===a){r._showAlertDlg("Alert","CorrectArgument","FormulaAlert",372);return}t=t.substring(u+1);t.indexOf(",")>-1&&(t=t.substring(t.indexOf(",")+1))}while(t.indexOf("(")>-1);for(splitStr=i.split(","),f=0,h=splitStr.length;f<h;f++)if(splitStr[f].indexOf("(")>-1&&(l=splitStr[f].split("("),r.isUndefined(s.getItem(l[0].toUpperCase())))){r._showAlertDlg("Alert","CorrectFormula","FormulaAlert",372);return}}return!0},_isValidCell:function(n){for(var u=this.XLObj,f,r,e,s=!0,h,t,o=["<=",">=","<",">","=","+","-","/","*","^","&"],i=0,c=o.length;i<c;i++){if(n.indexOf(o[i])>-1)for(r=n.split(o[i]),t=0,e=r.length;t<e;t++)if(r[t].length){if(e==t+1&&r[t].length)return!0}else return!1;if(n.indexOf("%")>-1&&n.split("%").length==2)return!0}return n=n.trim(),n=n.startsWith("=")?n.substring(1):n,n.indexOf("!")>-1&&(f=n.split("!"),n=f[1],u._getSheetIndexByName(f[0])<1&&(s=!1)),h=n.indexOf(":")>-1?u._isvalidRange(n):u._isvalidRange(n+":"+n),h&&s},updateValue:function(n,t,i,r){var u=this.XLObj,f,e;u.model.isReadOnly||(f=u.getRangeIndices(n),e={rowIndex:f[0],colIndex:f[1]},u._isPublic=!0,u.model.allowCellFormatting&&u.XLFormat._hasFormat(i)&&(u.XLFormat._createFormatClass(u.XLFormat.getFormatFromHashCode(i),i),u.XLFormat._updateFormatClass(e,i)),this._updateCellValue(e,t,i,r),u._isPublic=!1)},updateCellValue:function(n,t,i,r){var u=this.XLObj;u._isPublic=!0;u.model.allowCellFormatting&&u.XLFormat._hasFormat(i)&&(u.XLFormat._createFormatClass(u.XLFormat.getFormatFromHashCode(i),i),u.XLFormat._updateFormatClass(n,i));this._updateCellValue(n,t,i,r);u._isPublic=!1},_updateCellValue:function(n,t,i,r){var u=this.XLObj;if(n&&!u.model.isReadOnly){var f=n.colIndex,e=n.rowIndex,r=u._getSheetIndex(r),o=u.getActiveCell();u.isFormula(t)?(this._refreshCalcEngine(e,f,!0,t,r),this._updateDataContainer({rowIndex:e,colIndex:f},{dataObj:{value:t},sheetIdx:r}),u._isFormulaSuggestion=!1):(this._updateCell({rowIndex:e,colIndex:f},t,r),this._refreshCalcEngine(e,f,!1,null,r));u._isPublic&&(u.model.allowDataValidation&&this.getPropertyValue(e,f,"isHighlight",r)&&u.XLValidate.highlightInvalidData(),u.model.allowConditionalFormats&&u.XLCFormat.refreshCFormat([e,f,e,f]),u.model.allowComments&&u.XLComment._updateCmntArrowPos(),o.rowIndex===e&&o.colIndex===f&&(u.model.showRibbon&&u.XLRibbon._updateRibbonIcons(),u.model.allowFormulaBar&&u.updateFormulaBar()))}},updateCell:function(n,t,i){var r=this.XLObj;r._isPublic=!0;this._updateCell(n,t,i);r._isPublic=!1},_updateCell:function(n,i,r){var u=this.XLObj;if(n&&!u.model.isReadOnly){r=u._getSheetIndex(r);var h,c=u.getSheet(r),f=n.rowIndex,o=n.colIndex,l=t.Spreadsheet.CellType,a,v=this.getPropertyValue(f,o,"value2")||"",y=c.rowsHeightCollection[f],s=this._parseValue(i,n),e=u.getRangeData({range:[f,o,f,o],property:["formatStr","type","thousandSeparator","decimalPlaces"],sheetIdx:r})[0];u.model.isReadOnly||(e.type&&e.type!=l.General&&(s.type=e.type,delete s.formatStr),(e.formatStr||e.type===l.Scientific||e.type===l.Fraction)&&(s.value2=u.XLFormat._format(s.value,{formatStr:e.formatStr,type:e.type,thousandSeparator:e.thousandSeparator,decimalPlaces:e.decimalPlaces})),this._updateDataContainer(n,{dataObj:s,sheetIdx:r}),u._isPublic&&(h=u._getWrapCellHeight(r,f,o),(this.getPropertyValue(f,o,"wrap")||h.cellHt>c.rowsHeightCollection[f])&&(u._isRowViewable(r,f)?u.setHeightToRows([{rowIndex:f,height:h.rowHt}]):(c.rowsHeightCollection[f]=h.rowHt,u.XLScroll._getRowHeights(r,f)))),a={sheetIndex:r?r:u.getActiveSheetIndex(),rowIndex:f,colIndex:o,reqType:"edit",cValue:i,pValue:v?v:"",prevHeight:y,newHeight:c.rowsHeightCollection[f]},u._isPublic&&!u._dupDetails&&(u._completeAction(a),u._trigActionComplete(a)))}},_parseValue:function(i,r){var p;r&&this.getPropertyValue(r.rowIndex,r.colIndex,"type")=="text"||(p=this.XLObj._getlocaleNumVal(i),i=this.XLObj.isNumber(i)?Number(i):t.isNullOrUndefined(i)?"":typeof i=="object"&&!this.XLObj._isDateTime(i)?JSON.stringify(i):i);var h,f,w,l,b,a,y,k,o,e=this.XLObj,c=e.model.locale,s=t.Spreadsheet.CellType,d=t.Spreadsheet.Align.Right,u=typeof i=="object"&&!this.XLObj._isDateTime(i)?JSON.stringify(i):i+"",v=s.General,g=u.indexOf(e._currencySymbol);if(p&&(i=p),(g===0||g>-1&&g===u.length-1)&&(f=t.parseFloat(u,10,c),f))return o=u.indexOf(e._decimalSeparator)>-1?e._decimalCnt(f):0,{type:s.Currency,value:f,value2:u,formatStr:e._getFormatString(s.Currency,o),decimalPlaces:o,align:d};if(u.indexOf(e._percentSymbol)>-1&&(f=n.trim(u).replace(e._percentSymbol,""),e.isNumber(f)))return o=u.indexOf(e._decimalSeparator)>-1?e._decimalCnt(f):0,{type:s.Percentage,value:Number(f)/100,value2:u,formatStr:e._getFormatString(s.Percentage,o),decimalPlaces:o,align:d};if(y=t.preferredCulture(c),w=y.numberFormat[","]||",",a=new RegExp("\\"+w+"\\d{3}"),u.indexOf(e._decimalSeparator)>-1&&a.test(u)&&(f=t.parseFloat(u,10,c),f))return o=u.substr(u.indexOf(e._decimalSeparator)+1).length,o>2&&(o=2),u=t.format(f,"N"+o,c),{type:s.Number,value:f,value2:u,formatStr:e._getFormatString(s.Number,o),decimalPlaces:o,thousandSeparator:!0};if(u.indexOf(w)>-1)if(a.test(u)){if(f=t.parseInt(u,10,c),f)return o=0,u=t.format(f,"N"+o,c),{type:s.Number,value:f,value2:u,formatStr:e._getFormatString(s.Number,o),decimalPlaces:o,thousandSeparator:!0}}else i=u;l=y.calendar.patterns;b=!0;a=y.calendar._parseRegExp;for(h in l)if(a&&l[h]in a?f=new RegExp(a[l[h]].regExp).exec(u):(b=!1,f=t.parseDate(u,l[h],c)),f)break;return f&&(b&&(f=t.parseDate(u,l[h],c)),f)?(h==="T"||h==="t"||e.XLFormat._customFormatSpecifierType[h]===s.Time?(f.setYear(1990),f.setMonth(0),f.setDate(1),v=s.Time):v=h==="d"?s.ShortDate:h==="D"?s.LongDate:s.Date,k="{0:"+l[h]+"}",u=e.XLFormat._format(f,{type:v,formatStr:k}),{type:v,value:f,value2:u,formatStr:k,align:d}):((u.toLowerCase()==="true"||u.toLowerCase()==="false")&&(i=u=u.toUpperCase()),{type:v,value:i,value2:u})},updateCellWithContainer:function(n,i,r,u){var f=this.XLObj;if(!f.model.isReadOnly){for(var o,h,s,e,c,a=0,y=0,r=f._getSheetIndex(r),i=i?i:f.getSheet(r).selectedRange,l=f._getSelectedRange({rowIndex:i[0],colIndex:i[1]},{rowIndex:i[2],colIndex:i[3]}),v=l.length;a<v;)c=l[a],s=c.rowIndex,u&&f._isHiddenRow(s)||(h=c.colIndex,e=n[y],o=f.getCell(s,h,r),this._updateDataContainer(c,{dataObj:e}),this._refreshCalcEngine(s,h,f.isFormula(e.value),e.value),o&&e.format&&f.addClass(o[0],e.format),o&&e.hyperlink&&o.html(t.buildTag("a.e-hyperlinks",e.value2,"","cellAdr"in e.hyperlink?{href:"#"}:{href:e.hyperlink.webAdr,target:"_blank"})),e.comment&&f.XLComment.setComment([s,h,s,h],null,!1),e.border&&f.XLFormat.applyBorder(f.XLFormat.getBorderFromHashCode(e.border),f._getAlphaRange(r,s,h,s,h)),o&&(e.rule&&e.rule.isApply?f.addClass(o[0],"e-hlcell"):f._removeClass(o[0],"e-hlcell")),y++),a++;f.model.allowConditionalFormats&&f.XLCFormat.refreshCFormat(i)}},_refreshCellAlignment:function(n){n=n||{};var o,s,f=t.Spreadsheet.Align,i=this.XLObj,r=n.cellIdx.rowIndex,u=n.cellIdx.colIndex,e=this.getPropertyValue(r,u,"merge");f in n||(n.value=t.isNullOrUndefined(n.value)?this.getPropertyValue(r,u,"value"):n.value,i.isFormula(n.value)&&(n.value=i.XLEdit.getPropertyValue(r,u,"calcValue")),n.type=n.type?n.type:this.getPropertyValue(r,u,"type"),n.align=!i.isNumber(n.value)&&typeof n.value!="object"||n.type===t.Spreadsheet.CellType.Text||e&&e.isCenterAlign?i._isBool(n.value)||e&&e.isCenterAlign?f.Center:f.Left:f.Right);o=this.getPropertyValue(r,u,"align");i._isInitLoad&&!i.isImport&&(s=!0);(!n.align||o&&o!=n.align)&&i.clearRangeData([r,u,r,u],["align"],"","","",s);n.align&&this._updateDataContainer(n.cellIdx,{dataObj:{align:n.align},skipCell:s})},_editingHandler:function(i){var it,r,e,u,o,b,c,s,h,rt,l,k,p,d,ot,g,nt,a,st,lt,v,f,ut,ht,ft,w,tt,y,ct,et;if(!n(i.target).parents(".e-backstagecontent").length)if(r=this.XLObj,!(i.keyCode===61||!i.shiftKey&&i.keyCode===32||i.keyCode>=48&&i.keyCode<=59||i.keyCode>=65&&i.keyCode<=90||i.keyCode>=96&&i.keyCode<=111||i.keyCode===173||i.keyCode>=186&&i.keyCode<=192||i.keyCode>=219&&i.keyCode<=222)||i.ctrlKey||i.altKey)if(i.keyCode!==113||i.shiftKey||i.ctrlKey)if(i.keyCode===27&&this._isEdit)e=r.getActiveSheetIndex(),u=r.getSheet(e),s=u._activeCell.rowIndex,h=u._activeCell.colIndex,o=r.getCell(s,h),b=r._dataContainer.sheets[e],r.XLEdit.getPropertyValue(s,h,"wrap")&&r.XLEdit.getPropertyValue(s,h,"merge")&&(ht=r.getCell(s,h,e),ft=ht.find("#"+r._id+"_MergeWrap")[0]),c=s in b&&h in b[s]?b[s][h]:c,w=c?typeof c.value2=="string"?c.value2:r._dataContainer.sharedData[c.value]:"",r.isFormula(w)&&(w=this.getPropertyValue(s,h,"value2")),r.element.find("#"+r._id+"_Edit").hide(),it=r._isRowViewable(e,s),it?(ft?ft.innerHTML=w:this._refreshTextNode(o[0],w),r.setSheetFocus(),r._setRowHdrHeight(e,u._selectedCells[0].rowIndex)):r.model.allowFormulaBar&&r.updateFormulaBar(),this._isFormulaEdit&&n("#"+r._id+"_AutoComplete").data("ejAutocomplete").suggestionList.hide(),this._isEdit=this._isFormulaEdit=this._isFBarFocused=!1,r._getContent(e).find("td").removeClass(r._formulaBorder.join(" ").replace(/,/g," ")+" "+r._ctrlFormulaBorder.join(" ").replace(/,/g," ")),it&&(r.model.allowComments&&o.hasClass("e-commentcell")&&r.XLComment._visibleCmntCnt(o,!0),r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement(),o.removeClass("e-editedcell e-msie-edit")),r.model.showRibbon&&r.XLRibbon._enableRibbonIcons(),r._getContent(r.getActiveSheetIndex()).find(".e-error").remove(),t.isNullOrUndefined(r.XLCellNav)||(r.XLCellNav._isNavigate=!0);else if(i.keyCode===46)if(this._isEdit)r._ctrlKeyCount>0&&(r._ctrlKeyCount=0,r._formulaRange=[],r.XLSelection._clearBorder(r._formulaBorder.join(" ").replace(/,/g," ")+" "+r._ctrlFormulaBorder.join(" ").replace(/,/g," ")));else{if(r._preventctrlkey){r._showAlertDlg("Alert","CtrlKeyErrorAlert","CtrlKeyErrorAction",450);return}if(e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),lt=new RegExp("\\be-format.*?\\b","g"),v,f=u._selectedCells,text=r.getRangeData({range:[f[0].rowIndex,f[0].colIndex,f[f.length-1].rowIndex,f[f.length-1].colIndex]}),r.model.allowLockCell&&u.isSheetProtected&&r._isPropExists([u.selectedRange],"isLocked",e))return;if(r._isPropExists([u.selectedRange],"isReadOnly",e))return;if(!this._isEdit){for(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),tt=r.model.sheets[e].tableManager,ct=r.getObjectKeys(tt),g=0,nt=r.getObjectLength(tt);g<nt;g++)if(y=tt[ct[g]].range,r.XLClipboard._compareRange([f[0].rowIndex,f[0].colIndex,f[f.length-1].rowIndex,f[f.length-1].colIndex],y)){st=r._getAlphaRange(e,y[0],y[1],y[2],y[3]);r.clearAll(st);return}for(r._hasClass(o,"e-readonly")||r.clearRangeData(null,["value2","value","hyperlink"]),rt=f[0].rowIndex,p=0,ot=f.length;p<ot;p++)if(l=f[p].rowIndex,k=f[p].colIndex,r._textClip(l,k,"delete"),!this.getPropertyValue(l,k,"isReadOnly")){if(r.model.allowFormulaBar&&r._getInputBox().val(""),v=this.getPropertyValue(l,k,"cFormatRule"),r.model.allowConditionalFormats&&v&&v.length)for(d=0,nt=v.length;d<nt;d++)a=v[d].split("_"),r.XLCFormat._cFormat(a[0],a[2],a[3],a[4],a[5]);rt!==l&&(r._setRowHdrHeight(e,l),rt++)}r.XLSelection._refreshBorder()}ut={sheetIndex:e,range:[f[0].rowIndex,f[0].colIndex,f[f.length-1].rowIndex,f[f.length-1].colIndex],bData:text,reqType:"clear-content"};r._completeAction(ut);r._trigActionComplete(ut)}else i.ctrlKey||i.shiftKey||i.keyCode!==8?(i.keyCode!==13||i.altKey)&&i.keyCode!==9||!this._isEdit||!r.model.allowKeyboardNavigation||r.XLCellNav._isNavigate||this._isFormulaEdit?i.keyCode===13&&i.altKey&&this._isEdit&&(i.preventDefault(),et=r.element.find("#"+r._id+"_Edit"),et.focus(),et.altEnter()):(i.preventDefault(),t.isNullOrUndefined(r.XLCellNav)||(r.XLCellNav._isNavigate=!0)):(e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this._isEdit||r._hasClass(o,"e-readonly")||r._hasClass(o,"e-cellreadonly")||(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this.editCell(u._activeCell.rowIndex,u._activeCell.colIndex,!1),r._setRowHdrHeight(e,u._activeCell.rowIndex),r.model.allowFormulaBar&&r._getInputBox().val("")));else e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this._isFEdit=!0,this._isEdit||r._hasClass(o,"e-readonly")||r._hasClass(o,"e-cellreadonly")||(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),r.XLCellNav._navToCell(u._activeCell.rowIndex,u._activeCell.colIndex),this.editCell(u._activeCell.rowIndex,u._activeCell.colIndex,!0));else e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this._isEdit||r._hasClass(o,"e-readonly")||r._hasClass(o,"e-cellreadonly")||(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),r.XLCellNav._navToCell(u._activeCell.rowIndex,u._activeCell.colIndex),this.editCell(u._activeCell.rowIndex,u._activeCell.colIndex,!1))},_focusElements:function(t){n(t).not(":hidden").focus().setInputPos(n(t).text().length)},_updateUsedRange:function(n,t){var r=this.XLObj,i=r.getSheet(r.getActiveSheetIndex()).usedRange;i.rowIndex<n&&(i.rowIndex=n);i.colIndex<t&&(i.colIndex=t)},_updateDataContainer:function(i,r){var g,pt,k,l,w,nt,et,ot,st,o,f,c,h,tt,v,y,ht,ct,lt,at,wt,p,it,d,bt,kt,rt,b,vt,ut,yt=!1,s=r.dataObj,u=this.XLObj,a=u._getSheetIndex(r.sheetIdx),ft=u.getSheet(a),dt,gt,e;if(!r.skipCell&&u._isRowViewable(a,i.rowIndex)&&(k=u.getCell(i.rowIndex,i.colIndex,a),l=k[0]),s){ot=t.Spreadsheet.CellType;st=t.Spreadsheet.Align;p=u._dataContainer;v=i.colIndex;y=i.rowIndex;h=u._cellProp;it=p.sheets[a];y in it?(d=it[y],v in d?o=d[v]:d[v]=o={}):(d=it[y]={},d[v]=o={});l&&(u._hasClass(l,"e-sswraptext")&&(u._removeClass(l,"e-sswraptext"),u.addClass(l,"e-sswraptext")),this.getPropertyValue(i.rowIndex,i.colIndex,"wrap",a)&&this.getPropertyValue(i.rowIndex,i.colIndex,"merge",a)&&(w=k.find("#"+u._id+"_MergeWrap")[0],w&&(b=w.lastChild,b?b.nodeType===1?(u._hasClass(b,"e-hyperlinks")&&(b.textContent=""),u._hasClass(b,"e-comment")&&(b.lastChild.textContent="")):b.textContent="":w.textContent="",nt=w.innerHTML,w.remove())));for(e in s){c=s[e];switch(e){case h[0]:case h[4]:case h[5]:case h[11]:f=p.sharedData.indexOf(c);f===-1&&(f=p.sharedData.push(c),f--);o[e]=f;ft._isLoaded&&e===h[0]&&!u._intrnlUpdate&&(yt=!0);break;case h[1]:if(rt=this.getPropertyValue(y,v,"value2",a),s.type&&s.type!=ot.General&&s.type!=ot.Text?o[e]=s.value2:(f=p.sharedData.indexOf(s.value2),f===-1&&(f=p.sharedData.push(s.value2),f--),o[e]=f),l&&!("cellType"in s)){if(wt=l.getElementsByTagName("a"),wt.length)this._refreshTextNode(l,s.value2);else if(o[h[24]]>-1){if(lt=p.sheetCellType[o[h[24]]],at=lt.id,n("#"+at).length===0)return;if(s.value2)switch(lt.type){case"Button":n("#"+at).ejButton("instance").option("text",s.value2)}}else ht=s.value2.toString().length>7&&!isNaN(new Date(s.value2).valueOf()),ct=["true","yes","false","no"].indexOf(s.value2.toString().toLowerCase())>-1,u.model.allowCellType&&u.model.allowAutoCellType&&(ht||ct)?ht?(u.XLCellType._rangeCellTypes([{type:"DatePicker",range:u._getAlphaRange(a,y,v,y,v)}],a,!0),n("#"+u._dataContainer.sheetCellType[o[h[24]]].id).ejDatePicker("instance").option("value",s.value2)):ct&&(u.XLCellType._rangeCellTypes([{type:"CheckBox",range:u._getAlphaRange(a,y,v,y,v)}],a,!0),n("#"+u._dataContainer.sheetCellType[o[h[24]]].id).ejCheckBox("instance").option("checked",["true","yes"].indexOf(s.value2.toString().toLowerCase())>-1?!0:!1)):this._skipHTML?l.innerHTML.concat(s.value2):this._refreshTextNode(l,s.value2);this._refreshCellAlignment({cellIdx:i,value:s.value,type:s.type})}u.model.allowOverflow&&u._canOverflow?(rt||s.value2)&&(vt=t.isNullOrUndefined(rt)?!0:rt.length<=s.value2.length?!0:!1,u._textClip(y,v,vt?"add":"delete"),!vt&&s.value2.length>0&&u._textClip(y,v,"add")):u._canOverflow&&u.refreshOverflow([y,v,y,v],a);o.isDirty=!0;break;case h[2]:o[e]=p.cellType.indexOf(s.type);break;case h[3]:for(g=0,pt=c.length;g<pt;)f=p.cFormatData.indexOf(c[g]),f===-1&&(f=p.cFormatData.push(c[g]),f--),o[e]?o[e].indexOf(f)===-1&&o[e].push(f):o[e]=[f],g++;break;case h[6]:f=p.valData.indexOf(c.customVal);f===-1&&(f=p.valData.push(c.customVal),f--);o[e]=JSON.parse(JSON.stringify(c));o[e].customVal=f;break;case h[7]:case h[8]:l&&(bt=e===h[8]?"e-border":"e-format",kt=new RegExp("\\b"+bt+".*?\\b","g"),l.className=l.className.replace(kt,""),u.addClass(l,c));f=p.hashCode.indexOf(c);f===-1&&(f=p.hashCode.push(c),f--);o[e]=f;break;case h[9]:case h[10]:case h[26]:o[e]?o[e].indexOf(c)===-1&&o[e].push(c):o[e]=[c];break;case h[12]:o[e]=c;l&&(c===st.Center?u.addClass(l,u._cAlign):c===st.Right?u.addClass(l,u._rAlign):n(l).removeClass(u._rAlign+" "+u._cAlign));break;case h[14]:case h[16]:ut=u.XLFormat.getFormatHashCode(c);f=p.hashCode.indexOf(ut);f===-1&&(u.XLFormat._createFormatClass(c,ut),f=p.hashCode.push(ut),f--);o[e]=f;break;case h[15]:case h[17]:c=u.XLFormat._getBorderHashCode(c,!0);f=p.hashCode.indexOf(c);f===-1&&(f=p.hashCode.push(c),f--);o[e]=f;break;default:o[e]=c}}if(this._updateUsedRange(i.rowIndex,i.colIndex),yt&&(u.model.allowCharts&&u.XLChart._refreshChartElements(y,v,a),u.model.allowConditionalFormats&&u.XLCFormat._refreshCFormatFormula(y,v,a),u._updateBatchDetails(y,v,a),yt=!1),l&&this.getPropertyValue(i.rowIndex,i.colIndex,"wrap",a)&&this.getPropertyValue(i.rowIndex,i.colIndex,"merge",a)&&(dt=this.getPropertyValue(i.rowIndex,i.colIndex,"merge",a),gt=ft._rowHeightCollection[i.rowIndex+dt.mSpan.rowSpan]-ft._rowHeightCollection[i.rowIndex]||Math.floor(k.height()),u._isRowViewable(a,i.rowIndex)&&(et=this.getPropertyValue(i.rowIndex,i.colIndex,"value2",a),this._refreshTextNode(l),nt=nt?nt.concat(s.value2||et):s.value2||et,w=k.find("#"+u._id+"_MergeWrap")[0],w||(l.innerHTML="<div id ="+u._id+"_MergeWrap style = 'border :0px;overflow: hidden;max-height:"+(gt-1)+"px'>"+l.innerHTML.concat(nt||"")+"<\/div>",w=k.find("#"+u._id+"_MergeWrap")[0]),child=w.children,child.length)))for(e=0;e<child.length;e++)u._hasClass(w.children[e],"e-comment")&&(w.children[e].lastChild.textContent=this.getPropertyValue(i.rowIndex,i.colIndex,"comment",a).value),u._hasClass(w.children[e],"e-hyperlinks")&&(w.lastChild.textContent="",w.children[e].textContent=this.getPropertyValue(i.rowIndex,i.colIndex,"value2",a));(Object.keys?Object.keys(o).length:u.getObjectLength(o))===3&&(tt=u.getRangeData({range:[y,v,y,v],property:h.slice(0,3)})[0],tt.value===""&&tt.value2===""&&tt.type===t.Spreadsheet.CellType.General&&u.clearRangeData([y,v,y,v],h.slice(0,3)));!ft._isLoaded||u.isDirty||u._intrnlReq||u.isImport||(u.isDirty=!0)}else l&&this._refreshTextNode(l)},_clearDataContainer:function(i){var y,u,p,o,l,d,a,w,b,g=!1,e=this.XLObj,c=e._getSheetIndex(i.sheetIdx),s=e._cellProp,r=i.cellIdx.rowIndex,f=i.cellIdx.colIndex,k=i.property||[],nt=!1,tt,v,it=e._dataContainer,h=it.sheets[c];if(k.length&&r in h&&f in h[r]){for(a=h[r][f],y=k.length,!i.skipCell&&e._isRowViewable(c,r)&&(u=e.getCell(r,f,c));y--;){value=null;b=!1;o=k[y];switch(o){case s[0]:value=this.getPropertyValue(r,f,o,c);e._updateBatchDetails(r,f,c);b=!0;break;case s[1]:d=this.getPropertyValue(r,f,"value2");u&&this._refreshTextNode(u[0]);d&&(g=!0);break;case s[3]:value=this.getPropertyValue(r,f,o,c);value&&u&&n(u).removeClass("e-redft e-yellowft e-greenft e-redf e-redt");break;case s[7]:case s[8]:value=this.getPropertyValue(r,f,o,c);value&&u&&e._removeClass(u[0],value);break;case s[14]:value=this.getPropertyValue(r,f,o,c);value&&value["text-align"]&&value["text-align"]==="right"&&u&&e._removeClass(u[0],"e-rightalign");break;case s[12]:value=a[o];value&&u&&e._removeClass(u[0],value===t.Spreadsheet.Align.Center?e._cAlign:e._rAlign);break;case s[13]:if(value=a[o],value&&u){if(w=u[0].lastChild.textContent,i.status==="clear-content"){u[0].lastChild.textContent="";break}else if(i.status==="clear-format"){p=u.find("a");e._hasClass(p[0],"e-hyperlinks")&&p.css({color:"#444445","text-decoration":"none"}).removeClass("e-hyperlinks");break}u.find("a").remove();t.isNullOrUndefined(u[0].lastChild)?u[0].textContent=w:u[0].lastChild.textContent=w}break;case s[18]:value=a[o];value&&u&&(u.removeClass("e-filterhdr"),u.find(".e-filterspan").remove());break;case s[21]:e.XLComment&&e.XLComment.deleteComment([r,f,r,f]);break;case s[5]:case s[22]:case s[23]:nt||(value=this.getPropertyValue(r,f),v={decimalPlaces:0,thousandSeparator:!1,formatStr:"",type:"general",value:value},v.value2=tt=e.XLFormat._getFormattedValue(r,f,v,value),e.XLEdit._updateDataContainer({rowIndex:r,colIndex:f},{dataObj:v}),nt=!0);break;case s[25]:delete h[r][f][o]}i.status==="clear-content"&&o==="hyperlink"?this.getPropertyValue(r,f,o,c)&&(delete h[r][f][o].webAddr,delete h[r][f][o].cellAddr):delete h[r][f][o];o==="wrap"&&u&&(l=u.find("#"+e._id+"_MergeWrap"),l.length&&(u[0].innerHTML=l[0].innerHTML,l.remove()));b&&(this._refreshCalcEngine(r,f,!1,value),e.model.allowCharts&&(e.XLChart._refreshChartElements(r,f,c),e.XLChart._afterChartRefresh()))}g&&e._textClip(r,f,"delete");e.getObjectLength(h[r][f])||delete h[r][f];e.getObjectLength(h[r])||delete h[r]}},getPropertyValue:function(i,r,u,f){var e,o,s,l,y,p,h=this.XLObj,c=h._dataContainer,a=c.sheets,v=h._cellProp;if(f=h._getSheetIndex(f),h._intrnlUpdate||this._refreshContainer(i,f),a[f]&&a[f][i]&&a[f][i][r]&&(o=a[f][i][r],o)){u=u||"value";s=o[u];switch(u){case"value":case"range":case"thousandSeparator":case"calcValue":e=c.sharedData[s];break;case"format":case"border":e=c.hashCode[s];break;case"value2":p=t.Spreadsheet.CellType;e=!h.isUndefined(o.type)&&[p.General,p.Text].indexOf(c.cellType[o.type])===-1?o.value2:c.sharedData[o.value2];break;case"type":e=c.cellType[o.type];break;case"cFormatRule":for(l=y=0,e=[],h.isUndefined(s)||(y=s.length);l<y;)o[u][l]in c.cFormatData&&e.push(c.cFormatData[o[u][l]]),l++;break;case"rule":h.isUndefined(s)||(e={},n.extend(!0,e,s),e.customVal=c.valData[e.customVal]);break;case v[14]:case v[15]:case v[16]:case v[17]:h.isUndefined(s)||(e=c.hashCode[s],e=e.indexOf("e-format")===-1?h.XLFormat.getBorderFromHashCode(e,!0):h.XLFormat.getFormatFromHashCode(e));break;default:e=s}}return e},_refreshContainer:function(n,t){var r,i=this.XLObj,u=i.getSheet(t);!u._isImported&&u._hasDataSrc&&(i._intrnlUpdate=!0,i.model.scrollSettings.allowVirtualScrolling?(r=i._getBlockInfo(n,t,!0),u._virtualDataMngrLoadedBlks.indexOf(r.orgIdx)===-1&&(u._virtualDataMngrLoadedBlks.push(r.orgIdx),this._ensureDataMngr(r.orgRange,t)),u._virtualDataLoadedBlks.indexOf(r.orgIdx)===-1&&(u._virtualDataLoadedBlks.push(r.orgIdx),i._canOverflow=!1,i._refreshDataSrc(r.orgRange,t),i._refreshCellData(r.orgRange,t),i._canOverflow=!0,i._refreshOverflow(r.orgRange))):u._isLoaded||u._isDataMoved||(u._isDataMoved=!0,i._canOverflow=!1,i._refreshDataSrc(null,t),i._refreshCellData(null,t),i._canOverflow=!0,i._refreshOverflow()),i._intrnlUpdate=!1)},_ensureDataMngr:function(n,i){var e,u,r,o=0,h=this.XLObj,s=h.getDataSettings(i),c,f;if(s)for(c=s.length;o<c;)r=s[o],h._inRow(r.range,n[0])&&r._dataManager&&(u=this._getQueryPropWithValues(n.slice(0),r.range),f=t.pvt.filterQueries(r.query.queries,"onSkip"),e=u.skip||0,r._skip&&(e+=r._skip),e&&(f.length?f[0].e.nos=e:r.query.skip(e)),f=t.pvt.filterQueries(r.query.queries,"onTake"),u.take&&(f.length?f[0].e.nos=u.take:r.query.take(u.take)),r._dataManager.dataSource.async=!1,promise=r._dataManager.executeQuery(r.query),promise.done(function(n){if(len=n.result.length,len)for(k=0;k<len;)r._jsonData[u.skip+k]=n.result[k],k++}),r._dataManager.dataSource.async=!0),o++},_getQueryPropWithValues:function(n,t){var i,r={},u=this.XLObj;return i=n[0]-t[0],r.skip=i,t[2]<n[2]&&(n[2]=t[2]),u._inRow(t,n[2])&&(i=n[2]-n[0]+1,r.take=i),r},getPropertyValueByElem:function(n,i,r){if(!t.isNullOrUndefined(n[0])){var u;return u=n.hasClass("e-hyperlinks")?this.XLObj._getCellIdx(n.parent()[0]):this.XLObj._getCellIdx(n[0]),this.getPropertyValue(u.rowIndex,u.colIndex,i,r)}},_getPropWithCellIdx:function(n,t,i,r){for(var f,o=[],u=n[0],h=n[2],c=n[3],e=this.XLObj,i=e._getSheetIndex(i),s=e._dataContainer.sheets[i];u<=h;){if(s[u])for(minc=n[1];minc<=c;)s[u][minc]&&(f=this.getPropertyValue(u,minc,t,i),e.isUndefined(f)||(r?e.isFormula(f)&&o.push({rowIdx:u,colIdx:minc,value:f}):o.push({rowIdx:u,colIdx:minc,value:f}))),minc++;u++}return o},_refreshCalcEngine:function(n,i,r,u,f){var l,h,e,s=this.XLObj,f=s._getSheetIndex(f),c=s.getSheet(f),o=s._calcEngine;r?(u=this._parseSheetRef(u),l=new ValueChangedArgs(n+1,i+1,u),o.valueChanged(c.sheetInfo.value,l),s._applyFormula(f,n,i)):(h=CalcEngine.getSheetFamilyItem(c.sheetInfo.value),e=RangeInfo.getAlphaLabel(i+1)+(n+1),o.isSheetMember()&&!t.isNullOrUndefined(h.parentObjectToToken)&&(e=h.parentObjectToToken.getItem(c.sheetInfo.value)+e),o.getFormulaInfoTable().containsKey(e)&&(o.getFormulaInfoTable().remove(e),o.getDependentCells().contains(e)&&o.clearFormulaDependentCells(e)),o.refresh(e))},_parseSheetRef:function(n,t){for(var u,i=0,f=this.XLObj,h=f.model.sheetCount,e=[],s=[],r=f._getSheetNames(),o='(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)';i<r.length;)s.push(r[i].text),i++;for(i=0;i<h;i++)r[i].value!==r[i].text&&(u=new RegExp(r[i].text+o,"gi"),n.match(u)&&(n=n.replace(u,i+"/"),e.push(i)),s.indexOf(r[i].value)<0&&n.indexOf(r[i].value)>-1&&!t&&(u=new RegExp(r[i].value+o,"gi"),n.match(u)&&(n=n.replace(u,f._newSIndex+"/"),e.push(f._newSIndex))));for(i=0;i<e.length;)u=new RegExp(e[i]+"/"+o,"gi"),n=n.replace(u,e[i]===f._newSIndex?f._generateSheetName(f._newSIndex):r[e[i]].value),i++;return n},_refreshTextNode:function(n,i){var u=this.XLObj,r;i=t.isNullOrUndefined(i)?"":i;u.isUndefined(n)||(r=n.lastChild,r&&(r.nodeType===3||r.nodeType===1&&r.tagName==="A")?u._browserDetails.name==="msie"&&u._browserDetails.version==="8.0"?r.nodeValue=i:r.textContent=i:n.appendChild(document.createTextNode(i)))},_formulaSelect:function(n){var t=value=n.text;this.XLEdit._isNamedRange(value)||t.slice(1)=="TRUE"||t.slice(1)=="FALSE"||(t+="(");this.XLEdit._editElem.text(t);this.model.allowFormulaBar&&this._getInputBox().val(t);this.XLEdit._editElem.focusEnd();this._isFormulaSuggestion=!1;this.XLCellNav._canKeyBoardNavigate=!1},_isNamedRange:function(n){var i=this.XLObj.model.nameManager,t=i.length;if(n=n.slice(1),t)while(t--)if(i[t].name.toUpperCase()===n.toUpperCase())return!0;return!1},_formulaBoxInputChange:function(n){var r=this.getActiveSheetIndex(),t=this.getSheet(r)._activeCell,i=this.element.find("#"+this._id+"_Edit");this.XLEdit._isFormulaEdit=!n.target.value.indexOf("=");this.XLEdit._isFormulaEdit&&this.XLEdit._processFormulaEditRange(n.target.value,!0);this.XLEdit._isEdit||(this.XLCellNav._navToCell(t.rowIndex,t.colIndex),this.XLEdit.editCell(t.rowIndex,t.colIndex,!0),i=this.element.find("#"+this._id+"_Edit"));i.text(n.target.value);n.target.focus();this.XLEdit._isCellEdit=!1},_formulaSuggestionStatus:function(n){this._isFormulaSuggestion=n.type==="open"},_updateFormulaCellRange:function(n,t){var u,r=this.XLObj,f=r.element.find("#"+r._id+"_Edit").not(":hidden"),i=f.text(),e=i[i.length-1];t&&this._validCharacters.indexOf(e)===-1?i=i+",":(u=this._getCharPosition(i),u>-1&&(i=i.substr(0,[u+1])));n=i+n;f.text(n);this._editElem.focusEnd();r.model.allowFormulaBar&&r._getInputBox().val(n)},_getCharPosition:function(n){for(var t=n.length;t--;)if(this._validCharacters.indexOf(n[t])>-1)return t;return-1},_processFormulaEditRange:function(t,i){var u,e,f=0,r=this.XLObj,o=r.XLDragFill._parseFormula(t),s=o.length;for(r._ctrlKeyCount=0,r._formulaRange=[],r.XLSelection._clearBorder(r._arrayAsString(r._ctrlFormulaBorder.concat(r._formulaBorder)));f<s;){if(u=o[f],this._invalidOperators.indexOf(u)>-1)break;r._isCellReference(u)&&(u=u.replace(/\$/g,""),o[f+1]===":"&&(f++,r._isCellReference(o[f+1])&&(u=u+":"+o[f+1],f++)),this._updateFormulaEditRange(u,r._ctrlKeyCount),r._ctrlKeyCount++);f++}e=t.charAt(t.length-1);e==="("&&t.split("(").length===2?(r._isFormulaSuggestion=!1,r.model.allowFormulaBar&&r._getInputBox().val(t),i?n("#"+r._id+"_inputbox_suggestion").hide():r._getFormulaSuggElem().hide()):e===")"&&r.isFormula(t)&&(r.XLEdit._isFormulaEdit=!1,r._formulaRange=[],r._ctrlKeyCount=0);e===":"?(r._shiftKeyEnabled=!0,r._ctrlKeyCount--):this._validOperators.indexOf(e)>-1&&(r._dStartCell=r.getSheet(r.getActiveSheetIndex())._activeCell,r._shiftKeyEnabled=!1)},_updateFormulaEditRange:function(n,t){var i=this.XLObj,r=i.getRangeIndices(n);i._formulaRange[t]=n;i._dStartCell={rowIndex:r[0],colIndex:r[1]};i._dEndCell={rowIndex:r[2],colIndex:r[3]};i.XLSelection._focusBorder(i._dStartCell,i._dEndCell,i._formulaBorder[t%6])},calcOption:function(t){var i=this.XLObj,u,f,e,r,o;if(!i.model.isReadOnly){for(e=i.getActiveSheetIndex(),t?(n("#"+i._id+"_CalcAuto").find("span").addClass("e-ss-calcauto"),n("#"+i._id+"_CalcManual").find("span").removeClass("e-ss-calcauto")):(n("#"+i._id+"_CalcManual").find("span").addClass("e-ss-calcauto"),n("#"+i._id+"_CalcAuto").find("span").removeClass("e-ss-calcauto")),r=1,o=i._sheets.length;r<o;r++)u=i._calcEngine,t?(u.setCalculatingSuspended(!1),f=i.getSheet(r).usedRange,i.setActiveSheetIndex(r),u.grid=i.model.sheets[r].sheetInfo.value,u.refreshRange(RangeInfo.cells(1,1,f.rowIndex+1,f.colIndex+1))):u.setCalculatingSuspended(!0);i.setActiveSheetIndex(e)}},calcNow:function(n){var t=this.XLObj;if(!t.model.isReadOnly){var i=1,r,u,e=t._sheets.length,o=t.getActiveSheetIndex(),f;for(n&&(i=n,e=n+1);i<e;)r=t._calcEngine,r.setCalculatingSuspended(!1),u=t.getSheet(i).usedRange,t.setActiveSheetIndex(i),r.grid=t.model.sheets[i].sheetInfo.value,r.refreshRange(RangeInfo.cells(1,1,u.rowIndex+1,u.colIndex+1)),r.setCalculatingSuspended(!0),i++;t.setActiveSheetIndex(o);f={sheetIndex:o,reqType:"calc-now"};t._completeAction(f);t._trigActionComplete(f)}},_rangeHasProperty:function(n,t,i){n&&(i=this.XLObj.getRangeData({range:n,property:[t]}));for(var r=0,u=i.length;r<u;){if(!this.XLObj.isUndefined(i[r][t]))return!0;r++}},saveEditingValue:function(){var c=this.XLObj;if(!c.model.isReadOnly){var r,u,t,f,n,i,l,a,e,o={},s,v,y,p=c._dataContainer,h;for(f=Object.getOwnPropertyNames(p.sheets),o.EditedData=[],t=0,l=f.length;t<l;t++)for(conSheet=p.sheets[f[t]],e=Object.getOwnPropertyNames(conSheet),r=0,v=e.length;r<v;r++)for(n=parseInt(e[r]),s=Object.getOwnPropertyNames(conSheet[n]),u=0,y=s.length;u<y;u++)i=parseInt(s[u]),conSheet[n][i].isDirty&&(h=parseInt(f[t]),a={SheetIndex:h,Value:this.getPropertyValue(n,i,"value2",h),CellIndex:{RowIndex:n,ColIndex:i}},delete conSheet[n][i].isDirty,o.EditedData.push(a));return o}}};n.fn.focusEnd=function(){var r;n(this).focus();var u=n("<span />").appendTo(n(this)),f=u.get(0),t=null,i=null;return document.selection?(t=document.body.createTextRange(),t.moveToElementText(f),t.select()):window.getSelection&&(r=this[0],t=document.createRange(),i=window.getSelection(),t.setStart(r,1),t.collapse(!0),i.removeAllRanges(),i.addRange(t),r.focus()),u.remove(),this};n.fn.altEnter=function(){var n,t,i,u,f,e,r;n=window.getSelection();t=n.anchorNode;i=n.anchorOffset;u=t.textContent;f=u.slice(0,i);e=u.slice(i)||" ";t.textContent=f+"\n"+e;r=document.createRange();r.setStart(t,i+1);r.setEnd(t,i+1);n.removeAllRanges();n.addRange(r)};n.fn.setCursorPosition=function(n){var u=this,t,i,r;u.focus();t=u[0].firstChild;i=document.createRange();t&&(i.setStart(t,n),i.setEnd(t,n));r=window.getSelection();r.removeAllRanges();r.addRange(i)}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.validation=function(n){this.XLObj=n;this._ruleSymbols={Greater:">",GreaterOrEqual:">=",Less:"<",LessOrEqual:"<=",Equal:"==",NotEqual:"!=",Between:">=&&<=&&=",NotBetween:">=&&<=&&!"};this._isErrorVisible=!1};t.spreadsheetFeatures.validation.prototype={_setValidation:function(){this.XLObj.model.allowDataValidation&&n.validator&&(this._initValidator(),this._setValidationToField())},_initValidator:function(){var i=n("#"+this.XLObj._id+"EditForm");t.isOnWebForms&&n.data(i[0],"validator",null);i.validate({errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,r){var u=n("#"+n(r).data("id")).data("ejSpreadsheet"),o=u._getJSSheetContent(u.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content"),f=u.XLEdit._editCell,e=n(i).addClass("e-error");o.append(e);e.prepend(t.buildTag("div.e-errortail e-toparrow"));e.css({left:f[0].offsetLeft,top:f[0].offsetTop+f.height()});u.XLValidate._isErrorVisible=!0}})},_setValidationToField:function(){var n=this.XLObj,i=n.XLEdit.getPropertyValueByElem(n.getActiveCellElem(),"rule"),r;delete i.type;delete i.isApply;delete i.isHighlight;n.element.find("#"+n._id+"_ValElem").rules("add",i);r=n.element.find("#"+n._id+"EditForm").validate();t.isNullOrUndefined(i.required)||(r.settings.messages[name]={},r.settings.messages[name].required=n.XLEdit._EditCellDetails.fieldName+(n.XLEdit._EditCellDetails.rowIndex+1)+" is required");n.XLEdit._isValidation=!0},applyDVRules:function(n,r,u,f,e){var h,a,p,c={},o=this.XLObj,l=o.getActiveSheetIndex(),w=o.getSheet(l),b=!1,k,s,d,g,nt,tt,y,v;switch(u){case"decimal":if(parseFloat(r[1])>parseFloat(r[2])){o._showAlertDlg("Alert","NumberValidationAlert","",400);return}break;case"date":if(new Date(r[1])>new Date(r[2])){o._showAlertDlg("Alert","DateValidationAlert","",400);return}break;case"time":if(g=Date.parse("01/01/1990 "+r[1]),nt=Date.parse("01/01/1990 "+r[2]),r[2]&&r[2].length&&g>nt){o._showAlertDlg("Alert","TimeValidationAlert","",400);return}break;default:if(parseInt(r[1])>parseInt(r[2])){o._showAlertDlg("Alert","NumberValidationAlert","",400);return}}if(!o.model.isReadOnly&&o.model.allowDataValidation&&(o.model.allowSelection||!t.isNullOrUndefined(n))){k=o._getRangeArgs(n,"object");s=o._getSelectedCells(l,k).selCells;o._showDialog(o._id+"_Ribbon_Data_DataTools_DataValidation");c.required=!f;(r[0]!="Between"||r[0]!="NotBetween")&&r.length<3&&r.push("");switch(u){case"number":r.push("parseInt");c.digits=!0;r.push("number");break;case"decimal":r.push("parseFloat");c.number=!0;r.push("decimal");break;case"date":r.push("parseDate");c.date=!0;r.push("date");break;case"time":r.push("parseTime");r.push("time");break;case"text":r[1]="^"+r[1];r[2]="^"+r[2];r.push("length");r.push("text");break;case"list":tt=r[1];r=[];r.push(tt);r.push("list")}for(r.push(e),r.push(n?n:o._getSelectedItems(l,n)[1]),r.push(l),c.customVal=r.join("_"),c.isApply=!1,c.type=u,y=[],v={},i=0,len=s.length;i<len;i++)v={rowIndex:s[i].rowIndex,colIndex:s[i].colIndex,prevRule:o.XLEdit.getPropertyValue(s[i].rowIndex,s[i].colIndex,"rule")},o._isRowViewable(l,s[i].rowIndex)&&(a=o.getCell(s[i].rowIndex,s[i].colIndex),a.hasClass("e-hlcell")&&(b=!0),a.removeData("rule"),a.removeClass("e-hlcell")),o.XLEdit._updateDataContainer({rowIndex:s[i].rowIndex,colIndex:s[i].colIndex},{dataObj:{rule:c}}),o.model.actionComplete!==null&&(v.newRule=o.XLEdit.getPropertyValue(s[i].rowIndex,s[i].colIndex,"rule")),y.push(v);b===!0&&this.highlightInvalidData();w._isImported&&!w._isLoaded||o._isUndoRedo||o._isExport||(d=r[2]==""?[r[0],r[1]]:[r[0],r[1],r[2]],h={showErrorAlert:r[5],values:d,required:!c.required,rule:c,sheetIndex:l,reqType:"validation",operation:"apply-validation",selectedCell:y,range:o._getAlphaRange(l,s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex)},p={showErrorAlert:h.showErrorAlert,values:h.values,isRequired:h.required,rule:h.rule,sheetIndex:h.sheetIndex,reqType:h.reqType,operation:h.operation,selectedCell:h.selectedCell,range:h.range},o._completeAction(h),o._trigActionComplete(p))}},clearDV:function(n){var i=this.XLObj,o,r,s,e,f,u,h;if(i.model.allowDataValidation&&!i.model.isReadOnly&&i.model.allowSelection){for(e=i.getActiveSheetIndex(),f={sheetIndex:e,reqType:"validation",operation:"clear-validation",selectedCell:[]},s=i._getRangeArgs(n,"object"),r=i._getSelectedCells(e,s).selCells,u=0,h=r.length;u<h;u++)f.selectedCell.push({rowIndex:r[u].rowIndex,colIndex:r[u].colIndex,rules:i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"rule")}),i.clearRangeData([r[u].rowIndex,r[u].colIndex,r[u].rowIndex,r[u].colIndex],["rule"]),i._isRowViewable(e,r[u].rowIndex)&&(o=i.getCell(r[u].rowIndex,r[u].colIndex),t.isNullOrUndefined(i._ddlCell)||(i.element.find("#"+i._id+"ddl").ejDropDownList("hidePopup"),i.element.find("#"+i._id+"ddlspan").remove(),i._ddlCell=null),f.hlStatus=o.hasClass("e-hlcell"),o.removeClass("e-hlcell"));f.range=i._getAlphaRange(e,r[0].rowIndex,r[0].colIndex,r[r.length-1].rowIndex,r[r.length-1].colIndex);i._isUndoRedo||i._dupDetails||(i._completeAction(f),i._trigActionComplete(f))}},clearHighlightedValData:function(n){var r=this.XLObj,i,o,s,f,u,h,e;if(r.model.allowDataValidation&&!r.model.isReadOnly){for(f=r.getActiveSheetIndex(),o=r._getRangeArgs(n,"object"),i=r._getSelectedCells(f,o).selCells,u=0,h=i.length;u<h;u++)r._isRowViewable(f,i[u].rowIndex)&&(s=r.getCell(i[u].rowIndex,i[u].colIndex),s.removeClass("e-hlcell")),t.isNullOrUndefined(r.XLEdit.getPropertyValue(i[u].rowIndex,i[u].colIndex,"rule"))||(r._dataContainer.sheets[f][i[u].rowIndex][i[u].colIndex].rule.isApply=!1);r._isUndoRedo||(e={sheetIndex:f,reqType:"validation",operation:"cl-hl-data",range:t.isNullOrUndefined(n)?this.XLObj._getAlphaRange(1,i[0].rowIndex,i[0].colIndex,i[i.length-1].rowIndex,i[i.length-1].colIndex):n},r._completeAction(e),r._trigActionComplete(e))}},_checkValidation:function(n,i,r,u){var f=this.XLObj,v,c,e,l,a,o,s,h;if(u=f._getSheetIndex(u),!JSON.parse(i[i.length-3])&&!r)return!0;if(n=this._convertValueByType(n,i[4]),i[1]=this._convertValueByType(i[1],i[4]),i[2]=this._convertValueByType(i[2],i[4]),n.length){if(i[i.length-4]==="list"){for(a=!1,i[0].indexOf(",")>-1?c=i[0].split(","):i[0].indexOf("=")>-1?(e=i[0].split("=")[1],c=e.indexOf("!")>-1?e.split("!")[1].indexOf("$")>-1?f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e.split("!")[1].split("$").join("")),valueOnly:!0}):e.indexOf("$")>-1?f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e.split("$").join("")),valueOnly:!0}):f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e.split("!")[1]),valueOnly:!0}):f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e),valueOnly:!0})):c=n,l=0,v=c.length;l<v;l++)if(a=c[l].toString()===n,a)break;return t.Spreadsheet.msg=f._getLocStr("ListAlertMsg"),a}return i[0]=this._ruleSymbols[i[0]],i[1].indexOf("=")>-1&&(o=i[1].replace("=",""),s=this.getRangeIndices(o+":"+o),i[1]=f.XLEdit.getPropertyValue(s[0],s[1],null,u).toString()),i[2].indexOf("=")>-1&&(o=i[2].replace("=",""),s=this.getRangeIndices(o+":"+o),i[2]=f.XLEdit.getPropertyValue(s[0],s[1],null,u).toString()),i[0].length<=2?(t.Spreadsheet.msg="The "+i[4]+" should be "+t.Spreadsheet.ValidationText[i[0]]+" "+i[1].replace("^",""),f.operators[i[0]](f.parse[i[3]](n),f.parse[i[3]](i[1]))):(h=[],h=i[0].split("&&"),t.Spreadsheet.msg="The "+i[4]+" should"+t.Spreadsheet.ValidationText[h[2]]+" be between "+i[1].replace("^","")+" and "+i[2].replace("^",""),f.operators[h[2]](f.operators[h[0]](f.parse[i[3]](n),f.parse[i[3]](i[1]))&&f.operators[h[1]](f.parse[i[3]](n),f.parse[i[3]](i[2]))))}return!0},_convertValueByType:function(t,i){if(t.length){var r=this.XLObj;switch(i){case"number":case"decimal":r._isValidDate(t)&&(t=r._dateToInt(t));break;case"date":n.isNumeric(t)&&(t=r.intToDate(t).toString())}}return t},highlightInvalidData:function(n){var u=this.XLObj,l,a,r,h,s,i,o,f,e,c;if(u.model.allowDataValidation&&!u.model.isReadOnly){for(f=u.getActiveSheetIndex(),o=u._getRangeArgs(n,"object"),r=u._getSelectedCells(f,o).selCells,n=u._getAlphaRange(f,o[0],o[1],o[2],o[3]),i=0,l=r.length;i<l;i++)(e=u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"rule",f),e)&&(u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,null,f)&&!t.isNullOrUndefined(e)?(a=u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"type",f)==="datetime"||u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"type",f)==="time"?u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"value2",f).toString():u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,null,f).toString(),s=e?!this._checkValidation(a,e.customVal.split("_"),!0,f):!1,u._dataContainer.sheets[f][r[i].rowIndex][r[i].colIndex].rule.isApply=s):t.isNullOrUndefined(e)||(s=e.required),u._isRowViewable(f,r[i].rowIndex)&&(h=u.getCell(r[i].rowIndex,r[i].colIndex,f),s?h.addClass("e-hlcell"):h.removeClass("e-hlcell")),u.XLEdit._updateDataContainer({rowIndex:r[i].rowIndex,colIndex:r[i].colIndex},{dataObj:{isHighlight:!0},sheetIdx:f}));u._isUndoRedo||(c={sheetIndex:f,reqType:"validation",operation:"hl-data",range:n},u._completeAction(c),u._trigActionComplete(c))}},_replaceRule:function(n,t){this.XLObj._dataContainer.cFormatData[n]=t},_addDVMethod:function(){t.isNullOrUndefined(n.validator)||n.validator.addMethod("customVal",function(t,i,r){var u=n("#"+n(i).data("id")).data("ejSpreadsheet"),f=u._getJSSheetContent(u.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content");return(f.find(".e-error").remove(),u.model.showRibbon&&n("#"+u._id+"_Ribbon_freetext").length&&!n("#"+u._id+"_Ribbon_freetext").data("ejCheckBox").isChecked())?!0:u.XLValidate._checkValidation(t,r.split("_"))},t.Spreadsheet.getMsg)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.dragFill=function(n){this.XLObj=n;this._customList=[["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["January","February","March","April","May","June","July","August","September","October","November","December"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]];this._property=["value","value2","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","format","rule"];this._fillInfo=null;this._verticalFill=!1;this._uniqueOBracket=String.fromCharCode(129);this._uniqueCBracket=String.fromCharCode(130);this._uniqueCSeparator=String.fromCharCode(131);this._uniqueCOperator=String.fromCharCode(132);this._uniquePOperator=String.fromCharCode(133);this._uniqueSOperator=String.fromCharCode(134);this._uniqueMOperator=String.fromCharCode(135);this._uniqueDOperator=String.fromCharCode(136);this._uniqueModOperator=String.fromCharCode(137);this._uniqueConcateOperator=String.fromCharCode(138)};t.spreadsheetFeatures.dragFill.prototype={positionAutoFillElement:function(n){var l,r,u,f,s,t,e=0,o=0,a=0,h=0,v=0,c=0,i=this.XLObj,y="e-hide";if(i.model.allowAutoFill&&i.model.allowSelection){if(s=i.getActiveSheetIndex(),t=i.getSheet(s),t._isRowSelected)a=-3,h=-1,v=5,c=4,r=t.selectedRange[2],u=t.selectedRange[1],o=i._isFrozen(t.frozenColumns)?i._getContent(s).find(".e-content").scrollLeft():t._scrollLeft;else if(t._isColSelected)h=-3,c=5,r=t.selectedRange[0],u=t.selectedRange[3],e=i._isFrozen(t.frozenRows)?i._getContent(s).find(".e-content").scrollTop():t._scrollTop;else{if(t._isSheetSelected){this.hideAutoFillElement();return}a=-3;h=-3;v=1;c=3;r=t.selectedRange[2];u=t.selectedRange[3]}l=i._getMergedIdx(r,u);r=l.rowIndex;u=l.colIndex;f=i._getCellInfo({rowIndex:r,colIndex:u});t._isColSelected||(e+=f.height);t._isRowSelected||(o+=f.width);e+=f.top;o+=f.left;i.getAutoFillElem()&&i.getAutoFillElem().removeClass(y).css({top:Math.round(e)+a,left:Math.round(o)+h});i.model.autoFillSettings.showFillOptions&&n&&i.model.allowEditing&&!i.model.isReadOnly&&i._getAutoFillOptElem().removeClass(y).css({top:e+v,left:o+c});t._autoFillCell=i._dautoFillCell={rowIndex:r,colIndex:u}}},hideAutoFillElement:function(){var n=this.XLObj.getAutoFillElem();n&&n.addClass("e-hide")},hideAutoFillOptions:function(){var n=this.XLObj._getAutoFillOptElem();n&&(n.find("button").data("ejSplitButton")._hidePopup(),n.addClass("e-hide"))},autoFill:function(n){var i=this.XLObj;if(n=n||{},i.model.allowAutoFill&&n.dataRange&&n.fillRange&&n.direction&&i.model.allowEditing&&!i.model.isReadOnly){var r,f=i.getActiveSheetIndex(),e=i.getSheet(f),u=t.Spreadsheet.AutoFillOptions;if(this._fillInfo=this._getFillInfo(n),n.fillType=n.fillType||this._fillInfo.fillType,this._verticalFill=n.direction==="down"||n.direction==="up",n.sheetIdx=f,n.dataRange=i._toIntrnlRange(n.dataRange,f),n.fillRange=i._toIntrnlRange(n.fillRange,f),r={sheetIndex:n.sheetIdx,reqType:"auto-fill",direction:n.direction,range:n.fillRange,bRange:n.dataRange,bData:i.getRangeData({range:n.fillRange}),bFormat:i.model.allowCellFormatting&&i.XLFormat.getHashCodeClassAsArray(n.fillRange)},r.rowSel=e._isRowSelected,r.colSel=e._isColSelected,!i._trigger("autoFillBegin",n)){switch(n.fillType){case u.FillSeries:case u.FillWithoutFormatting:this._fillSeries(n);break;case u.CopyCells:case u.FillFormattingOnly:this._copyCells(n);break;case u.FlashFill:r.actionType="flash-fill";r.bdData=i.getRangeData({range:n.dataRange});this._flashFill(n);r.adData=i.getRangeData({range:n.dataRange})}r.aData=i.getRangeData({range:n.fillRange});i.model.allowCellFormatting&&(r.aFormat=i.XLFormat.getHashCodeClassAsArray(n.fillRange));n.isKeyFill||this.positionAutoFillElement(!0);i._completeAction(r);i._trigActionComplete(r);i._trigger("autoFillComplete",n)}}},_updateFillValues:function(n,t,i,r,u,f,e,o,s,h){var c,l,a,v;return n?(c={rowIndex:t,colIndex:i+h},l={rowIndex:r,colIndex:i+h},a={rowIndex:f,colIndex:e+h},v={rowIndex:o,colIndex:e+h}):(c={rowIndex:t+h,colIndex:i},l={rowIndex:t+h,colIndex:u},a={rowIndex:f+h,colIndex:e},v={rowIndex:f+h,colIndex:s}),patrnRange=[c.rowIndex,c.colIndex,l.rowIndex,l.colIndex],fillRange=[a.rowIndex,a.colIndex,v.rowIndex,v.colIndex],{patrnRange:patrnRange,fillRange:fillRange}},_fillSeries:function(n){for(var u,ot,o,i,rt,k,h,v,s,st,c,d,g,ht,l,ut,y,ft,p,ct,f,e,et=0,w={},r=this.XLObj,nt=t.Spreadsheet.autoFillDirection,tt=t.Spreadsheet.CellType,lt=n.dataRange[0],at=n.dataRange[1],vt=n.dataRange[2],yt=n.dataRange[3],pt=n.fillRange[0],wt=n.fillRange[1],bt=n.fillRange[2],kt=n.fillRange[3],it=[nt.Down,nt.Up].indexOf(n.direction)>-1,b=[nt.Up,nt.Left].indexOf(n.direction)>-1,dt=it?yt-at:vt-lt,a=n.fillType===t.Spreadsheet.AutoFillOptions.FillSeries;et<=dt;){if(rt=this._updateFillValues(it,lt,at,vt,yt,pt,wt,bt,kt,et),k=rt.patrnRange,h=rt.fillRange,o=this._getPattern(k,{isRFill:b,isVFill:it}),v=r.getRangeData({range:k,property:["hyperlink","rule","cFormatRule","type","formatStr","decimalPlaces","wrap"]}),st=v.length,!o)return;for(ot=o.length,r.clearRangeData(h,[a?"formatStr":null,"hyperlink",a?"cFormatRule":null,"rule"]),a&&(r.model.allowCellFormatting&&r.XLFormat.removeStyle(h),y=r.getRangeData({range:k,property:["format","formats"]})),p=r._getSelectedRange({rowIndex:h[0],colIndex:h[1]},{rowIndex:h[2],colIndex:h[3]}),ct=p.length,b&&(p=p.reverse(),o=o.reverse(),o=this._ensurePattern(o),v=v.reverse(),a&&(y=y.reverse())),c=0;c<ct;){w={};f=p[c];i=o[c%ot];r.isNumber(i)&&(i=o[i]);switch(i.type){case tt.Number:u=r._round(i.regVal.a+i.regVal.b*i.i,5);b?i.i--:i.i++;break;case tt.String:u=i.val[i.i%i.val.length];i.i++;break;case tt.Formula:for(ut=!1,u="=",d=0,ht=i.val.length;d<ht;)s=i.val[d],r._isObject(s)?(ut=!0,l=r._round(s.a+s.b*i.i,0),u+=l<1?"#REF!":it?s.c+(s.b?l:"$"+l):(s.b?r._generateHeaderText(l):"$"+r._generateHeaderText(l))+s.c):u+=s,d++;ut&&b?i.i--:i.i++;break;case tt.Custom:u=r._round(i.regVal.a+i.regVal.b*i.i,0);u<0&&(u=u%i.len+i.len);u>=i.len&&(u=u%i.len);u=i.val[u];b?i.i--:i.i++}g=c%st;e=v[g];r._dupDetails=!0;r.XLEdit.updateCellValue(f,u,a?y[g].format:null);r._dupDetails=!1;a&&(r.model.allowCellFormatting&&e.type&&e.type!="general"&&this._updateNFormat(e,f.rowIndex,f.colIndex),r.model.allowConditionalFormats&&e.cFormatRule&&this._updateCFormat(f,e.cFormatRule),ft=y[g].formats,ft&&(w.formats=ft));r.model.allowHyperlink&&e.hyperlink&&this._updateHyperlinkTag(e.hyperlink,f);r.model.allowDataValidation&&e.rule&&(w.rule=e.rule);r.getObjectLength(w)&&r.XLEdit._updateDataContainer(f,{dataObj:w});r.model.allowWrap&&e.wrap&&r.setWrapText("wrap",[f.rowIndex,f.colIndex,f.rowIndex,f.colIndex]);c++}et++}},_copyCells:function(n){for(var e,s,p,r,k,l,d,h,a,v,g,w,u,f,o={},i=this.XLObj,vt=i.getActiveSheetIndex(),nt=0,b=t.Spreadsheet.autoFillDirection,it=n.dataRange[0],rt=n.dataRange[1],ut=n.dataRange[2],ft=n.dataRange[3],ot=n.fillRange[0],st=n.fillRange[1],ht=n.fillRange[2],ct=n.fillRange[3],et=[b.Down,b.Up].indexOf(n.direction)>-1,lt=[b.Up,b.Left].indexOf(n.direction)>-1,at=et?ft-rt:ut-it,tt=n.fillType===t.Spreadsheet.AutoFillOptions.FillFormattingOnly,c,y;nt<=at;){if(k=this._updateFillValues(et,it,rt,ut,ft,ot,st,ht,ct,nt),p=k.patrnRange,r=k.fillRange,i.model.allowCellFormatting)if(r[0]==r[2])for(c=[1];c<=[3];c++)i.XLEdit.getPropertyValue(r[0],c,"tformats")||i.XLEdit.getPropertyValue(r[0],c,"formats")||i.XLFormat.removeStyle([r[0],c,r[2],c]);else for(y=r[0];y<=r[2];y++)i.XLEdit.getPropertyValue(y,r[1],"tformats")||i.XLEdit.getPropertyValue(r[0],c,"formats")||i.XLFormat.removeStyle([y,r[1],y,r[3]]);if(tt?l=i.getRangeData({range:p,property:["cFormatRule","type","decimalPlaces","formatStr"]}):(w=["value","value2","type","formatStr","decimalPlaces","thousandSeparator","hyperlink"],i.model.allowConditionalFormats&&w.push("cFormatRule"),i.model.allowDataValidation&&w.push("rule"),i.clearRangeData(r,w),l=i.getRangeData({range:p,property:["value","hyperlink","rule","cFormatRule","type","decimalPlaces","formatStr"]})),h=i.getRangeData({range:p,property:["format","formats"]}),d=h.length,v=i._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]}),g=v.length,e=0,lt&&(v=v.reverse(),h=h.reverse(),tt||(l=l.reverse())),tt)while(e<g)o={},s=e%d,f=v[e],u=l[s],i.model.allowCellFormatting&&(i.XLFormat._updateFormatClass(f,h[s].format),this._updateNFormat(u,f.rowIndex,f.colIndex)),a=h[s].formats,a&&(o.formats=a),i.getObjectLength(o)&&i.XLEdit._updateDataContainer(f,{dataObj:o}),i.model.allowConditionalFormats&&u.cFormatRule&&this._updateCFormat(f,u.cFormatRule),e++;else while(e<g)o={},s=e%d,f=v[e],u=l[s],i._dupDetails=!0,i.XLEdit.updateCellValue(f,u.value,h[s].format),i._dupDetails=!1,i.model.allowCellFormatting&&u.type&&u.type!="general"&&this._updateNFormat(u,f.rowIndex,f.colIndex),i.model.allowHyperlink&&u.hyperlink&&this._updateHyperlinkTag(u.hyperlink,f),a=h[s].formats,a&&(o.formats=a),i.model.allowDataValidation&&u.rule&&(o.rule=u.rule),i.getObjectLength(o)&&i.XLEdit._updateDataContainer(f,{dataObj:o}),i.model.allowConditionalFormats&&u.cFormatRule&&this._updateCFormat(f,u.cFormatRule),e++;nt++}},_flashFill:function(n){var o,f,e,t=this.XLObj,s=n.dataRange[0],h=n.dataRange[2],i=n.fillRange[0],c=n.fillRange[1],r=n.fillRange[2],l=n.fillRange[3],u=this._getFlashFillPattern(n.dataRange,"left");if(u)for(f=t.getRangeData({range:[i,u.colIndex,r,u.colIndex],valueOnly:!0,skipDateTime:!0}),u.subStr>-1&&(f=this._splitString(f," ",u.subStr)),o=t._getSelectedRange({rowIndex:i,colIndex:c},{rowIndex:r,colIndex:l}),e=o.length;e--;)t.XLEdit._updateCellValue(o[e],f[e]);else i>s&&(i=s),r<h&&(r=h),t._getAutoFillOptElem().addClass("e-hide"),t.updateUniqueData({value:"",value2:"",type:"general"},[i,c,r,l]),t._showAlertDlg("Alert","FlashFillAlert")},_getFlashFillPattern:function(n,i){var u,f,c,y,e,l,r=0,o=-1,a=this.XLObj,s=a.getRangeData({range:n,valueOnly:!0,skipDateTime:!0}),p=s.length,v=n[0],w=t.Spreadsheet.autoFillDirection.Right,h=i===w;if(s.join().replace(/,/g,"").length){for(l=s[0].toString(),r=n[1],r===0&&(h=!0),h?r++:r--;r>-1;)if(f=a.XLEdit.getPropertyValue(v,r),f=a.isUndefined(f)?"":f.toString(),f.length){if(f===l)if(p>1){if(u=this._matchData(v,r,s),u)return u}else return{colIndex:r,subStr:o};for(c=f.split(" "),y=c.length,e=0;e<y;){if(l===c[e])if(o=e,p>1){if(u=this._matchData(v,r,s),u)return o>u.subStr&&(u.subStr=o),u}else return{colIndex:r,subStr:o};e++}h?r++:r--}else break;if(!h)return this._getFlashFillPattern(n,w)}},_matchData:function(n,i,r){for(var u,o=!1,s,f,h,l,e=1,c=-1,a=r.length;e<a;){if(o=!1,s=r[e].toString(),f=this.XLObj.XLEdit.getPropertyValue(n+e,i),f=t.isNullOrUndefined(f)?"":f.toString(),s===f){o=!0;e++;continue}for(h=f.split(" "),l=h.length,u=0;u<l;){if(s===h[u]){c<u&&(c=u);o=!0;break}u++}e++}if(o&&e===a)return{colIndex:i,subStr:c}},_splitString:function(n,t,i){for(var e,u,f=n.length,r;f--;){for(r=i,e=n[f].split(t);r>-1;){if(u=e[r],u)break;r--}n[f]=u}return n},_getPattern:function(n,i){var u,o,s,a,l,v,w,b,h,e,y=0,f=[],k=this.XLObj,c=t.Spreadsheet.CellType,p=this._getDataPattern(n),d=p.length,r;if(p){while(y<d){r=p[y];switch(r.type){case c.Number:for(o=f.length,e=r.val.length,h=i.isRFill?-1:e,e===1&&r.val.push(r.val[0]+1),a=this._getPredictionValue(r.val),s={regVal:a,type:r.type,i:h},f.push(s),u=1;u<e;)f.push(o),u++;break;case c.String:for(o=f.length,s={val:r.val,type:r.type,i:0},f.push(s),u=1,e=r.val.length;u<e;)f.push(o),u++;break;case c.Formula:if(e=r.val.length,r=this._getFormulaPattern(r.val,i),h=i.isRFill?-1:e,r.isInPattern)for(o=f.length,s={val:r.val,type:c.Formula,i:h},f.push(s),u=1;u<e;)f.push(o),u++;else for(u=0,h=i.isRFill?-1:1;u<e;)f.push({val:r.val[u],type:c.Formula,i:h}),u++;break;default:if(r.type.indexOf(c.Custom)>-1)for(o=f.length,e=r.val.length,h=i.isRFill?-1:e,l=this._customList[Number(r.type.replace(c.Custom,""))],b=l.indexOf(r.val[0])===-1,v=k.toArrayLowerCase(l.slice(0)),w=k.toArrayLowerCase(r.val),a=this._getCustomPredictionValue(w,v),s={val:b?v:l,regVal:a,i:h,type:c.Custom,len:l.length},f.push(s),u=1;u<e;)f.push(o),u++}y++}return f}},_getCustomPredictionValue:function(n,t){for(var r=0,i=[],u=n.length;r<u;)i.push(t.indexOf(n[r])),r++;return i.length===1&&i.push(i[0]+1),this._getPredictionValue(i)},_getDataPattern:function(n){var i,r,u=0,t={},f=[],e=this.XLObj.getRangeData({range:n,valueOnly:!0,skipDateTime:!0}),o=e.length;if(o){while(u<o)i=e[u],r=this._getType(i),u===0?t={val:[i],type:r}:r===t.type?t.val.push(i):(f.push(t),t={val:[i],type:r}),u++;return f.push(t),f}},_getFormulaPattern:function(n,t){for(var r,o,f,s,c=this.XLObj,e=[],i=0,h=n.length,u;i<h;)e.push(this._parseFormula(n[i])),i++;if(s=this._isInPattern(e,t.isVFill),s){for(r=e[0],i=r.length;i--;)f=r[i],u=c._isCellReference(f),u&&u!=="absolute"&&(r[i]=this._getCellRefPrediction(f,t,null,u));return{isInPattern:s,val:r}}for(i=0;i<h;){for(r=e[i],o=r.length;o--;)f=r[o],u=c._isCellReference(f),u&&u!=="absolute"&&(e[i][o]=this._getCellRefPrediction(f,t,h,u));i++}return{isInPattern:s,val:e}},_getCellRefPrediction:function(n,t,i,r){n=n.toUpperCase();var f="",s=new RegExp("[a-z$]","gi"),h=new RegExp("[0-9$]","g"),e=t.isVFill?n.replace(h,f):n.replace(s,f),u=t.isVFill?Number(n.replace(s,f)):this.XLObj._generateColCount(n.replace(h,f)),o=[u],c=n[0]==="$";return i&&i!==1?o.push(u+i):o.push(u+1),u=this._getPredictionValue(o),r&&r==="mixed"&&(c===t.isVFill?e="$"+e:u.b=0),u.c=e,u},_isInPattern:function(n,t){var o,i,s,a,r,u,h,c,f=this.XLObj,e="",v=0,l=1,y=n.length,p=new RegExp("[0-9$]","g"),w=new RegExp("[a-z$]","gi");if(y===1)return!1;while(l<y){if(o=n[v],s=n[l],i=o.length,a=s.length,i!==a)return!1;while(i--)if(r=o[i],u=s[i],f._isCellReference(r)===f._isCellReference(u)){if(t?(h=Number(r.replace(w,e)),c=Number(u.replace(w,e))):(h=f._generateColCount(r.replace(p,e)),c=f._generateColCount(u.replace(p,e))),h!==c-1)return!1}else if(r!==u)return!1;v++;l++}return!0},_parseFormula:function(n){var t,i,f,u=0,r=[];for(n=this._markSpecialChar(n.replace("=","")),n=n.split(/\(|\)|,|:|\+|-|\*|\/|%|&/g),f=n.length;u<f;){if(t=n[u],!t){u++;continue}t.length===1?r.push(this._isUniqueChar(t)?this._getUniqueCharVal(t):t):(i=t[0],t.indexOf("!")>0?(this._isUniqueChar(i)&&(r.push(this._getUniqueCharVal(i)),t=t.substr(1)),i=t.indexOf("!")+1,r.push(t.substr(0,i)),r.push(t.substr(i))):this._isUniqueChar(i)?(r.push(this._getUniqueCharVal(i)),r.push(t.substr(1))):r.push(t));u++}return r},_getUniqueCharVal:function(n){switch(n){case this._uniqueOBracket:return"(";case this._uniqueCBracket:return")";case this._uniqueCSeparator:return",";case this._uniqueCOperator:return":";case this._uniquePOperator:return"+";case this._uniqueSOperator:return"-";case this._uniqueMOperator:return"*";case this._uniqueDOperator:return"/";case this._uniqueModOperator:return"%";case this._uniqueConcateOperator:return"&"}return""},_isUniqueChar:function(n){var t=n.charCodeAt(n);return t>=129&&t<=138},_markSpecialChar:function(n){return n=n.replace(/\(/g,"("+this._uniqueOBracket).replace(/\)/g,")"+this._uniqueCBracket),n=n.replace(/,/g,","+this._uniqueCSeparator).replace(/:/g,":"+this._uniqueCOperator),n=n.replace(/\+/g,"+"+this._uniquePOperator).replace(/-/g,"-"+this._uniqueSOperator),n=n.replace(/\*/g,"*"+this._uniqueMOperator).replace(/\//g,"/"+this._uniqueDOperator),n=n.replace(/&/g,"&"+this._uniqueConcateOperator),n.replace(/%/g,"%"+this._uniqueModOperator)},_getPredictionValue:function(n){for(var t=0,i=0,u=0,f=0,r=0,e=n.length,o,s;t<e;)i=i+t,u=u+Number(n[t]),f=f+t*Number(n[t]),r=r+t*t,t++;return o=this.XLObj._round((u*r-i*f)/(e*r-i*i),5),s=this.XLObj._round((e*f-i*u)/(e*r-i*i),5),{a:o,b:s}},_getType:function(n){var i=this._isCustomType(n),r=t.Spreadsheet.CellType,u=this.XLObj;return i?i=i:u.isFormula(n)?i=r.Formula:u.isNumber(n)&&(i=r.Number),i||r.String},_isCustomType:function(n){n=n+"";n=n.toLowerCase();for(var i=this._customList.length;i--;)if(this.XLObj.toArrayLowerCase(this._customList[i].slice(0)).indexOf(n)>-1)return t.Spreadsheet.CellType.Custom+i;return!1},_ensurePattern:function(n){for(var i,u=-1,r=n.length;r--;)i=n[r],this.XLObj._isObject(i)?(u=r,i.type===t.Spreadsheet.CellType.String&&(i.val=i.val.reverse())):n[r]=u;return n},_selectAutoFillRange:function(n,t){n&&(t=this.XLObj._getCellIdx(n));var u,f,r=this.XLObj,i=this._getAutoFillRange(t);if(i){for(this._autoFillCleanUp(),f=r.getRange([i.startCell.rowIndex,i.startCell.colIndex,i.endCell.rowIndex,i.endCell.colIndex]),u=f.length;u--;)r.addClass(f[u],"e-autofillcell");r.XLSelection._focusRange(i.startCell,i.endCell,r._autofillBorder);r._dautoFillCell=t}},_getAutoFillRange:function(n){var o=t.Spreadsheet.autoFillDirection,a=this.XLObj,r=a.getSheet(a.getActiveSheetIndex()),y=r._startCell,p=r._endCell,s=r._autoFillCell,c=r.selectedRange,f=c[0],e=c[1],u=c[2],i=c[3],v=a.inRange(c,n.rowIndex,n.colIndex),h={rowIndex:f,colIndex:e},l={rowIndex:u,colIndex:i};if(n.rowIndex<s.rowIndex){if(r._isFreezed&&n.rowIndex<=r.frozenRows&&r._hiddenFreezeRows.indexOf(r.frozenRows)>-1&&(n.rowIndex=r._ftopRowIdx),f-n.rowIndex>n.colIndex-i&&f-n.rowIndex>e-n.colIndex)return v?{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i}}:{startCell:l,endCell:{rowIndex:n.rowIndex,colIndex:e},fillRange:[n.rowIndex,e,f-1,i],direction:o.Up};if(n.colIndex>s.colIndex)return{startCell:h,endCell:{rowIndex:u,colIndex:n.colIndex},fillRange:[f,i+1,u,n.colIndex],direction:o.Right};if(n.colIndex<s.colIndex)return v?{startCell:h,endCell:l}:{startCell:l,endCell:{rowIndex:f,colIndex:n.colIndex},fillRange:[f,n.colIndex,u,e-1],direction:o.Left}}else{if(n.colIndex>s.colIndex)return n.rowIndex-u>n.colIndex-i?{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i},fillRange:[u+1,e,n.rowIndex,i],direction:o.Down}:{startCell:h,endCell:{rowIndex:u,colIndex:n.colIndex},fillRange:[f,i+1,u,n.colIndex],direction:o.Right};if(n.colIndex<s.colIndex)return r._isFreezed&&n.colIndex<=r.frozenColumns&&r._hiddenFreezeCols.indexOf(r.frozenColumns)>-1&&(n.colIndex=r._fleftColIdx),n.rowIndex-u>i-n.colIndex||n.rowIndex-f>i-n.colIndex&&n.rowIndex!==u?{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i},fillRange:[u+1,e,n.rowIndex,i],direction:o.Down}:v?{startCell:h,endCell:l}:{startCell:l,endCell:{rowIndex:f,colIndex:n.colIndex},fillRange:[f,n.colIndex,u,e-1],direction:o.Left};if(n.rowIndex>s.rowIndex)return{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i},fillRange:[u+1,e,n.rowIndex,i],direction:o.Down};if(n.rowIndex===s.rowIndex&&n.colIndex===s.colIndex)return{startCell:y,endCell:p}}},_getDirection:function(n,i,r){var u=t.Spreadsheet.autoFillDirection;if(r=this.XLObj.isUndefined(r)?this._verticalFill:r,r){if(i.rowIndex<n.rowIndex)return u.Up;if(i.rowIndex>n.rowIndex)return u.Down;if(i.colIndex>n.colIndex)return u.Right;if(i.colIndex<n.colIndex)return u.Left}else{if(i.colIndex>n.colIndex)return u.Right;if(i.colIndex<n.colIndex)return u.Left;if(i.rowIndex<n.rowIndex)return u.Up;if(i.rowIndex>n.rowIndex)return u.Down}return null},_getFillRange:function(n,i,r,u){var f=t.Spreadsheet.autoFillDirection;switch(u){case f.Up:return[r.rowIndex,n.colIndex,n.rowIndex-1,i.colIndex];case f.Right:return[n.rowIndex,i.colIndex+1,i.rowIndex,r.colIndex];case f.Down:return[i.rowIndex+1,n.colIndex,r.rowIndex,i.colIndex];case f.Left:return[n.rowIndex,r.colIndex,i.rowIndex,n.colIndex-1]}return null},_autoFillOptionClick:function(t){var r,i,u,f,e,o,s,h=n("#"+t.model.targetID).find("#"+t.ID).find(">>");this._hasClass(h[0],"e-ss-fillselect")||(r=this.XLDragFill,i=this.getSheet(this.getActiveSheetIndex()),u=r._getDirection(this._pEndCell,this._pFillCell),f=this.swapRange([this._pStartCell.rowIndex,this._pStartCell.colIndex,this._pEndCell.rowIndex,this._pEndCell.colIndex]),e=r._getFillRange(this._pStartCell,this._pEndCell,this._pFillCell,u),o=i._startCell,s=i._endCell,this._isUndo=!0,this._performUndoRedo(),i._isColSelected||i._isRowSelected||(i._startCell=o,i._endCell=s,this.XLSelection.selectRange(i._startCell,i._endCell)),r.positionAutoFillElement(!0),r.autoFill({dataRange:f,fillRange:e,direction:u,fillType:t.ID}),r._fillInfo.fillType=t.ID,this._isUndo=!1)},_autoFillCleanUp:function(){var i,n,r,u,f="e-hide",t=this.XLObj,e=t.getAutoFillElem(),o=t._getAutoFillOptElem();for(e&&t.addClass(e[0],f),o&&t.addClass(o[0],f),r=t._getContent(t.getActiveSheetIndex())[0].querySelectorAll("td.e-autofillcell"),i=r.length;i--;)u=r[i],n=u.className,n=n.replace(/e-autofillcell|e-blur/g,""),n=n.replace(/ +/g," "),u.className=n},_autoFillClick:function(){var f,r=0,u="e-ss-fillselect",i=n("#"+this._id+"_ctxtmenu").find("li"),t=i.find("."+u);for(t.length&&(t=t[0],this._removeClass(t,u),this.addClass(t,"e-ss-filloption")),i.show(),f=this.XLDragFill._fillInfo.disableItems.length;r<f;)n(i[this.XLDragFill._fillInfo.disableItems[r]]).hide(),r++;i.filter("#"+this.XLDragFill._fillInfo.fillType).find("span").addClass(u)},_fillRange:function(n,i){var c,v,l,r,u,o,s,f={isKeyFill:!0},e=this.XLObj,a=e.getActiveSheetIndex(),y=e.getSheet(a),h=t.Spreadsheet.autoFillDirection;if(i=i?i:y.selectedRange,r=i[0],u=i[1],o=i[2],s=i[3],c=this._getDirection({rowIndex:r,colIndex:u},{rowIndex:o,colIndex:s},n),v=n?c===h.Down:c===h.Right,e.isRange(i)&&v)n?(f.dataRange=[r,u,r,s],f.fillRange=[r+1,u,o,s]):(f.dataRange=[r,u,o,u],f.fillRange=[r,u+1,o,s]);else{if(n){if(!r)return;f.dataRange=[r-1,u,r-1,s]}else{if(!u)return;f.dataRange=[r,u-1,o,u-1]}f.fillRange=i}(f.direction=n?h.Down:h.Right,f.fillType=t.Spreadsheet.AutoFillOptions.CopyCells,l=e.swapRange(f.fillRange),e.model.allowLockCell&&y.isSheetProtected&&e._isPropExists([l],"isLocked",a))||e._isPropExists([l],"isReadOnly",a)||this.autoFill(f)},_getFillInfo:function(n){var e,i,o=!0,u=t.Spreadsheet.AutoFillOptions.CopyCells,s=[],r=this.XLObj,h=t.Spreadsheet.autoFillDirection,c=[h.Down,h.Up].indexOf(n.direction)>-1,f=r.getRangeData({range:n.dataRange,valueOnly:!0,skipDateTime:!0}),l=f.join().replace(/,/g,"").length;if(r.isRange(n.dataRange)&&l){for(e=f.length;e--;)if(i=f[e],r.isNumber(i)||r.isFormula(i)||this._isCustomType(i)){o=!1;u=r.model.autoFillSettings.fillType;break}}else i=f[0],(r.isNumber(i)||r.isFormula(i)||this._isCustomType(i))&&(o=!1,u=r.model.autoFillSettings.fillType);return(!l||o)&&(s.push(1),u=n.fillType=="fillseries"?u:n.fillType),(!c||c&&n.dataRange[1]!==n.dataRange[3])&&s.push(4),{fillType:u,disableItems:s}},_updateHyperlinkTag:function(i,r){var f,u=this.XLObj,e=u.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2");u._isRowViewable(u.getActiveSheetIndex(),r.rowIndex)&&(f=u.getCell(r.rowIndex,r.colIndex),f[0].lastChild.nodeType===3&&n(f[0].lastChild).remove(),f.append(t.buildTag("a.e-hyperlinks",e,"",i.webAddr?{href:i.webAddr,target:"_blank"}:{href:"#"})));u.XLEdit._updateDataContainer(r,{dataObj:{hyperlink:i}})},_updateCFormat:function(n,t){var i,r=0,u=this.XLObj,f=t.length;for(u._dupDetails=!0;r<f;)i=t[r].split("_"),u.XLCFormat._cFormat(i[0],i[2],i[3],i[4],null,null,[n.rowIndex,n.colIndex,n.rowIndex,n.colIndex]),r++;u._dupDetails=!1},_updateNFormat:function(n,t,i){var u={type:n.type},r=this.XLObj;n.type!="general"&&(n.formatStr&&(u.formatStr=n.formatStr),"decimalPlaces"in n&&(u.decimalPlaces=n.decimalPlaces));r._dupDetails=!0;r.XLFormat.format(u,r._getAlphaRange(r.getActiveSheetIndex(),t,i,t,i));r._dupDetails=!1}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cellNavigation=function(n){this.XLObj=n;this._canKeyBoardNavigate=!0;this._isNavigate=!0};t.spreadsheetFeatures.cellNavigation.prototype={_selectionKeyDownHandler:function(n){var v,w,o,b,y,nt,et,tt,ft,g=[],i=this.XLObj,k=i.getActiveSheetIndex(),r=i.getSheet(k),e=n.keyCode,d=n.shiftKey,it=n.ctrlKey,s={keyCode:e,shiftKey:d,ctrlKey:it,altKey:n.altKey},rt=!1,u=r._activeCell,a=r._endCell,h=r.rowCount,l=r.colCount,ut=i._dataContainer,p,f,c=r.usedRange;if((e===9&&this._canKeyBoardNavigate||e===13)&&!it){if(n.preventDefault(),v=i.XLEdit.getCurrentEditCellData(),i.isFormula(v)&&!i.XLEdit._formulaValidate(v))return;if(i.XLEdit._isFormulaEdit&&!i._isFormulaSuggestion)if(v.length>1)if(this._isValidParameter(v))i.isFormula(v)||(v=v+")",i.XLEdit._editElem.text(v),i.model.allowFormulaBar&&i._getInputBox().val(v)),i.XLEdit.saveCell(),i._getContent(k).find("td").removeClass(i._formulaBorder.join(" ").replace(/,/g," ")+" "+i._ctrlFormulaBorder.join(" ").replace(/,/g," ")),i.XLSelection._cleanUp(),i.XLSelection.selectRange(r._activeCell,r._activeCell),i.XLEdit._isFormulaEdit=!1,i._formulaRange=[],i._ctrlKeyCount=0;else{i._showAlertDlg("Alert","MissingParenthesisAlert","FormulaAlert",440);return}else i.XLEdit.saveCell(),i.XLEdit._isFormulaEdit=!1;else e===9&&i.XLEdit._isEdit&&i.XLEdit.saveCell();w=r.selectedRange;ft=r._isRowSelected||r._isColSelected;ft?w[0]===w[2]||w[1]===w[3]?g.push({rowIndex:w[0],colIndex:w[1]}):g=r._selectedCells:g=r._selectedCells;g.length&&(g.length===1||!ft&&this._isRangeMerged(g)?r._isRowSelected?d?u.colIndex>0&&this._navigateRow("Backward",s):u.colIndex<39&&this._navigateRow("Forward",s):r._isColSelected?d?u.rowIndex>0&&this._navigateCol("Backward",s):u.rowIndex<39&&this._navigateCol("Forward",s):d?e===9&&u.colIndex>0?this._navigateCell(u.rowIndex,u.colIndex-1,s):e===13&&u.rowIndex>0&&this._navigateCell(u.rowIndex-1,u.colIndex,s):e===9&&u.colIndex<l?this._navigateCell(u.rowIndex,u.colIndex+1,s):e===13&&u.rowIndex<h&&this._navigateCell(u.rowIndex+1,u.colIndex,s):d?e===9?this._navigateRange("ShiftTab",s):this._navigateRange("ShiftEnter",s):e===9?this._navigateRange("Tab",s):this._navigateRange("Enter",s))}else if((e===37||e===38&&!i._isFormulaSuggestion||e===39||e===40&&!i._isFormulaSuggestion)&&this._isNavigate)if(n.preventDefault(),i.XLEdit._isFormulaEdit)y=i.swapRange([i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex]),i.getRange([y[0]?y[0]-1:y[0],y[1]?y[1]-1:y[1],y[2],y[3]]).removeClass(i._formulaBorder[i._ctrlKeyCount%6].join(" ")+" "+i._ctrlFormulaBorder[i._ctrlKeyCount%6].join(" ")),it&&(o=i._dStartCell,e===37&&o.colIndex>0?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:0}:e===38&&o.rowIndex>0?i._dStartCell=i._dEndCell={rowIndex:0,colIndex:o.colIndex}:e===39&&o.colIndex<r.colCount?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:r.colCount}:e===40&&o.rowIndex<h&&(i._dStartCell=i._dEndCell={rowIndex:r.colCount,colIndex:o.colIndex})),d||i._shiftKeyEnabled?(b=i._dEndCell,o=i._dStartCell,e===37&&o.colIndex>0?i._dStartCell={rowIndex:o.rowIndex,colIndex:o.colIndex-1}:e===38&&o.rowIndex>0?i._dStartCell={rowIndex:o.rowIndex-1,colIndex:o.colIndex}:e===39&&b.colIndex<r.colCount?i._dEndCell={rowIndex:b.rowIndex,colIndex:b.colIndex+1}:e===40&&b.rowIndex<r.rowCount&&(i._dEndCell={rowIndex:b.rowIndex+1,colIndex:b.colIndex})):(o=i._dStartCell,e===37&&o.colIndex>0?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:o.colIndex-1}:e===38&&o.rowIndex>0?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex-1,colIndex:o.colIndex}:e===39&&o.colIndex<r.colCount?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:o.colIndex+1}:e===40&&o.rowIndex<r.rowCount&&(i._dStartCell=i._dEndCell={rowIndex:o.rowIndex+1,colIndex:o.colIndex})),i.XLSelection._processFormulaRange(i._ctrlFormulaBorder),i._formulaRange[i._ctrlKeyCount]=i._getProperAlphaRange(k,i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex);else if(it){if(e===37&&u.colIndex>0){if(p=ut.sheets[k][u.rowIndex],f=u.colIndex-1,p&&f<c.colIndex)if(i.XLEdit.getPropertyValue(u.rowIndex,f+1,"value2")&&i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")){while(i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<=c.colIndex)f--;l=f+1}else{while(!i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<c.colIndex&&f>0)f--;l=f}else if(i.XLEdit.getPropertyValue(u.rowIndex,c.colIndex,"value2"))l=c.colIndex;else{for(f=c.colIndex;f>0&&!i.XLEdit.getPropertyValue(u.rowIndex,f,"value2");)f--;l=f}this._navigateCell(u.rowIndex,l,s)}else if(e===38&&u.rowIndex>0){if(p=ut.sheets[k],f=u.rowIndex-1,f<=c.rowIndex)if(p[f]&&i.XLEdit.getPropertyValue(f+1,u.colIndex,"value2")&&i.XLEdit.getPropertyValue(f,u.colIndex,"value2")){while(i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f<=c.rowIndex)f--;h=f+1}else{while(!i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f>0)f--;h=f}else if(i.XLEdit.getPropertyValue(c.rowIndex,u.colIndex,"value2"))h=c.rowIndex;else{for(f=c.rowIndex;f>0&&!i.XLEdit.getPropertyValue(f,u.colIndex,"value2");)f--;h=f}this._navigateCell(h,u.colIndex,s)}else if(e===39&&u.colIndex<l-1){if(p=ut.sheets[k][u.rowIndex],f=u.colIndex+1,p&&f<=c.colIndex)if(i.XLEdit.getPropertyValue(u.rowIndex,f-1,"value2")&&i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")){while(i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<=c.colIndex)f++;l=f-1}else{while(!i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<c.colIndex)f++;l=i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")?f:r.colCount}else l=r.colCount;l===r.colCount&&--l;this._navigateCell(u.rowIndex,l,s)}else if(e===40&&u.rowIndex<h-1){if(p=ut.sheets[k],f=u.rowIndex+1,f<c.rowIndex)if(p[f]&&i.XLEdit.getPropertyValue(f-1,u.colIndex,"value2")&&i.XLEdit.getPropertyValue(f,u.colIndex,"value2")){while(i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f<=c.rowIndex)f++;h=f-1}else{while(!i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f<r.rowCount)f++;h=f}else h=r.rowCount-1;h===r.rowCount&&--h;this._navigateCell(h,u.colIndex,s)}}else if(d){if(e===37&&a.colIndex>0?r._endCell={rowIndex:a.rowIndex,colIndex:a.colIndex-1}:e===38&&a.rowIndex>0?(rt=!0,r._endCell={rowIndex:a.rowIndex-1,colIndex:a.colIndex},tt={rowIndex:a.rowIndex-1,colIndex:a.colIndex}):e===39&&a.colIndex<l?r._endCell={rowIndex:a.rowIndex,colIndex:a.colIndex+1}:e===40&&a.rowIndex<h&&(rt=!0,r._endCell={rowIndex:a.rowIndex+1,colIndex:a.colIndex}),(r.rowCount===r._endCell.rowIndex||r.colCount===r._endCell.colIndex)&&i.model.scrollSettings.scrollMode==="normal")return;if((r.rowCount===r._endCell.rowIndex||r.colCount===r._endCell.colIndex)&&!i.model.scrollSettings.allowScrolling)return;i.model.scrollSettings.allowScrolling&&(r.rowCount===r._endCell.rowIndex&&e===40?i._scrollContent({x:0,y:+i.model.rowHeight}):r.colCount-1===r._endCell.colIndex&&e===39&&i._scrollContent({x:+i.model.columnWidth,y:0}));this._isHiddenCell(r._endCell)&&(nt={rowIndex:r._endCell.rowIndex,colIndex:r._endCell.colIndex},this._skipHiddenRowsAndCols(nt,s),r._endCell.rowIndex=nt.rowIndex,r._endCell.colIndex=nt.colIndex);(i.XLEdit.getPropertyValue(r._endCell.rowIndex,r._endCell.colIndex,"isMHide")||i.XLEdit.getPropertyValue(r._endCell.rowIndex,r._endCell.colIndex,"merge")||rt&&i._isPropExists([[r._endCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex]],"merge")||i._isPropExists([[r._endCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex]],"isMHide"))&&(rt=!1,i.XLSelection._processBoundary());(r._endCell.colIndex<=r._leftCol.idx||r._endCell.colIndex>=r._rightCol.idx||r._endCell.rowIndex<=r._topRow.idx||r._endCell.rowIndex>=r._bottomRow.idx)&&this._scrollToCell(r._endCell,s);!t.isNullOrUndefined(tt)&&e==38&&i.XLEdit.getPropertyValue(tt.rowIndex,tt.colIndex,"mergeIdx")?(et=r._startCell,r._startCell=r._endCell,r._endCell=et,i.XLSelection.selectRange(r._startCell,r._endCell)):i.XLSelection.selectRange(r._startCell,r._endCell);i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement()}else if(s={keyCode:e,shiftKey:!1,ctrlKey:!1,altKey:!1},e===37&&u.colIndex>0)this._navigateCell(u.rowIndex,u.colIndex-1,s);else if(e===38&&u.rowIndex>0)this._navigateCell(u.rowIndex-1,u.colIndex,s);else if(e===39&&u.colIndex<l)this._navigateCell(u.rowIndex,u.colIndex+1,s);else if(e===40&&u.rowIndex<h)this._navigateCell(u.rowIndex+1,u.colIndex,s);else return!1},_navigateCell:function(r,u,f){var p,d,g,w,b,nt,tt=hiddenWth=0,s={rowIndex:r,colIndex:u},o=this.XLObj,c=o.getActiveSheetIndex(),e=o.getSheet(c),a=o._getContent(c),h=a.find("#hscrollBar").data("ejScrollBar"),l=a.find("#vscrollBar").data("ejScrollBar"),y=a.find(".e-content"),it=o.XLEdit,v=!1,k=y[0].offsetWidth;if((e.rowCount!==s.rowIndex&&e.colCount!==s.colIndex||o.model.scrollSettings.scrollMode!=="normal")&&(e.rowCount!==s.rowIndex||!o.model.scrollSettings.allowVirtualScrolling)&&(e.rowCount!==s.rowIndex&&e.colCount!==s.colIndex||o.model.scrollSettings.allowScrolling)){if(e.rowCount===s.rowIndex&&(o.XLScroll._scrollY(c),v=!0),o._isAutoWHMode||e.colCount!==s.colIndex||o.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Infinite||(o.XLScroll._scrollX(c),v=!0),e._isFreezed)if(e._frozenRows-1<=r&&r<e._ftopRowIdx){for(i=r;i<e._ftopRowIdx;i++)tt+=e.rowsHeightCollection[i];o._scrollContent({y:-tt})}else if(e._frozenColumns-1<=u&&u<e._fleftColIdx){for(i=u;i<e._fleftColIdx;i++)hiddenWth+=e.columnsWidthCollection[i];o._scrollContent({x:-hiddenWth})}for(g=o.getCell(s.rowIndex,s.colIndex),this._isHiddenCell(s)&&this._skipHiddenRowsAndCols(s,f),b=it.getPropertyValue(e._activeCell.rowIndex,e._activeCell.colIndex,"merge"),b&&it.getPropertyValue(s.rowIndex,s.colIndex,"mergeIdx")&&this._updateMergeRange(b,s,f),e._activeCell=e._endCell=e._startCell=s,(o.XLEdit.getPropertyValue(s.rowIndex,s.colIndex,"mergeIdx")||o.hasSpan(s))&&(o.XLSelection._processBoundary(),e._activeCell=e._startCell,g=o.getCell(e._activeCell.rowIndex,e._activeCell.colIndex),d=!0),cellInfo=o._getCellInfo(s,c),w=e._leftCol.idx>0?e._leftCol.idx-1:e._leftCol.idx,o.model.scrollSettings.allowScrolling&&e._bottomRow.idx<=s.rowIndex&&(f.keyCode===40||f.keyCode===13&&!f.shiftKey)&&!v?(l._scrollData.step=1,f.ctrlKey&&f.keyCode===40?o.XLScroll._scrollSelectedPosition(c,o.getActiveCell(c)):l.scroll(l.value()+(o._isFrozen(e.frozenRows)?o._getRowHeight(e._ftopRowIdx,c):cellInfo.height),!0)):o.model.scrollSettings.allowScrolling&&!o._isFrozen(e.frozenRows)&&e._topRow.idx>s.rowIndex&&(f.keyCode===38||f.keyCode===13&&f.shiftKey)&&!v&&!o._hasClass(a.find("tr").eq(s.rowIndex)[0],"e-fr-hide")&&(l._scrollData.step=-1,s.rowIndex>0?f.ctrlKey?l.scroll(cellInfo.top,!0):l.scroll(l.value()-cellInfo.height,!0):l.scroll(0)),o.model.scrollSettings.allowScrolling&&u>=e._rightCol.idx&&k<=e._colWidthCollection[e._activeCell.colIndex]-e._colWidthCollection[w]+cellInfo.width&&(f.keyCode===39||f.keyCode===9&&!f.shiftKey)&&!v?(h._scrollData.step=1,f.ctrlKey&&f.keyCode===39?h.scroll(cellInfo.left+cellInfo.width-h._scrollData.handleSpace,!0):h.scroll(h.value()+(o._isFrozen(e.frozenColumns)?o._getColWidth(e._fleftColIdx,c):cellInfo.width),!0)):o.model.scrollSettings.allowScrolling&&!o._isFrozen(e.frozenColumns)&&w>=s.colIndex&&(f.keyCode===37||f.keyCode===9&&f.shiftKey)&&!v?(h._scrollData.step=-1,s.colIndex>0?f.ctrlKey?h.scroll(cellInfo.left,!0):h.scroll(h.value()-cellInfo.width,!0):h.scroll(0)):o.model.scrollSettings.allowScrolling&&f.ctrlKey&&!v&&(f.keyCode===37?h.scroll(cellInfo.left,!0):f.keyCode===38?l.scroll(cellInfo.top,!0):f.keyCode===39?h.scroll(cellInfo.left-h._scrollData.handleSpace,!0):o.XLScroll._scrollSelectedPosition(c,o.getActiveCell(c))),p=a.find("col"),nt=n(o.getRows(c)[1]),rowIdx=e._startCell.rowIndex,colIdx=e._startCell.colIndex,(k>=cellInfo.left||y.offset().left+k>=cellInfo.left+cellInfo.width)&&(f.keyCode==39||f.keyCode==9&&!f.shiftKey)?o.XLSelection.selectRange(e._startCell,e._startCell):!p.eq(colIdx).hasClass("e-fc-hide")||f.keyCode==37||f.keyCode==9&&f.shiftKey?o.XLSelection.selectRange(e._startCell,e._endCell):!nt.eq(rowIdx).hasClass("e-fr-hide")&&(f.keyCode==38||f.keyCode==13&&f.shiftKey)?o.XLSelection.selectRange(e._startCell,e._endCell):(y.offset().top+y[0].offsetHeight>=cellInfo.top||y.offset().top+y[0].offsetHeight>=cellInfo.top+cellInfo.height)&&(f.keyCode==40||f.keyCode==13&&!f.shiftKey)&&o.XLSelection.selectRange(e._startCell,e._endCell),d&&(f.keyCode===37||f.shiftKey&&f.keyCode===9?s.colIndex=e._startCell.colIndex:f.keyCode===38||f.shiftKey&&f.keyCode===13?s.rowIndex=e._startCell.rowIndex:f.keyCode===39||f.keyCode===9?s.colIndex=e._endCell.colIndex:(f.keyCode===40||f.keyCode===13)&&(s.rowIndex=e._endCell.rowIndex),e._activeCell=s),e._startCell=s;(f.keyCode===37||f.shiftKey&&f.keyCode===9)&&o._hasClass(p[e._startCell.colIndex],"e-c-hide");)o._removeClass(p[e._startCell.colIndex],"e-fc-hide"),e._startCell.colIndex--;while((f.keyCode===38||f.shiftKey&&f.keyCode===13)&&o._hasClass(a.find("tr")[e._startCell.rowIndex],"e-r-hide"))o._removeClass(a.find("tr")[e._startCell.rowIndex],"e-fr-hide"),e._startCell.rowIndex--;while((f.keyCode===39||f.keyCode===9)&&o._hasClass(p[e._startCell.colIndex],"e-c-hide"))e._startCell.colIndex++;while((f.keyCode===40||f.keyCode===13)&&o._hasClass(a.find("tr")[e._startCell.rowIndex],"e-r-hide"))e._startCell.rowIndex++;rIdx=e._startCell.rowIndex;cIdx=e._startCell.colIndex;o.model.selectionSettings.selectionType==="row"?o.XLSelection.selectRows(rIdx,rIdx):o.model.selectionSettings.selectionType==="column"&&o.XLSelection.selectColumns(cIdx,cIdx);o.model.showRibbon&&o.XLRibbon._updateRibbonIcons();o.model.allowAutoFill&&o.XLDragFill.positionAutoFillElement();e._isFreezed&&(o.XLSelection.selectRange({rowIndex:rIdx,colIndex:cIdx},{rowIndex:rIdx,colIndex:cIdx}),o.model.allowAutoFill&&o.XLDragFill.positionAutoFillElement())}},_navToCell:function(n,t){var u=this.XLObj,e=u.getActiveSheetIndex(),r=u.getSheet(),f=hiddenWth=0;if(r._isFreezed)if(n<r._ftopRowIdx||t<r._fleftColIdx){if(r._frozenRows-1<=n&&n<r._ftopRowIdx){for(i=n;i<r._ftopRowIdx;i++)f+=r.rowsHeightCollection[i];u._scrollContent({y:-f})}if(r._frozenColumns-1<=t&&t<r._fleftColIdx){for(i=t;i<r._fleftColIdx;i++)hiddenWth+=r.columnsWidthCollection[i];u._scrollContent({x:-hiddenWth})}}else{if(r._frozenRows-1<=n&&n>r._bottomRow.idx){for(i=r._bottomRow.idx;i<n;i++)f+=r.rowsHeightCollection[i];u._scrollContent({y:+f})}if(r._frozenColumns-1<=t&&t>r._rightCol.idx){for(i=r._rightCol.idx;i<t;i++)hiddenWth+=r.columnsWidthCollection[i];u._scrollContent({x:+hiddenWth})}}},_navigateRange:function(n,t){var c=this.XLObj,h=c.getSheet(c.getActiveSheetIndex()),r=h._startCell,u=h._endCell,i=h._activeCell,f=r.rowIndex<u.rowIndex?r.rowIndex:u.rowIndex,e=r.rowIndex>u.rowIndex?r.rowIndex:u.rowIndex,o=r.colIndex<u.colIndex?r.colIndex:u.colIndex,s=r.colIndex>u.colIndex?r.colIndex:u.colIndex;if(n=="Tab")if(i.colIndex<s)this._navigateRow("Forward",t);else if(i.rowIndex<e)this._updateActiveCell(i.rowIndex+1,o,t,n);else if(i.rowIndex==e&&i.colIndex==s)this._updateActiveCell(f,o,t,n);else return!1;else if(n=="Enter")if(i.rowIndex<e)this._navigateCol("Forward",t);else if(i.colIndex<s)this._updateActiveCell(f,i.colIndex+1,t,n);else if(i.rowIndex==e&&i.colIndex==s)this._updateActiveCell(f,o,t,n);else return!1;else if(n=="ShiftTab")if(i.colIndex>o)this._navigateRow("Backward",t);else if(i.rowIndex>f)this._updateActiveCell(i.rowIndex-1,s,t,n);else if(i.rowIndex==f&&i.colIndex==o)this._updateActiveCell(e,s,t,n);else return!1;else if(i.rowIndex>f)this._navigateCol("Backward",t);else if(i.colIndex>o)this._updateActiveCell(e,i.colIndex-1,t,n);else if(i.rowIndex==f&&i.colIndex==o)this._updateActiveCell(e,s,t,n);else return!1},_navigateRow:function(n,t){var i,r,u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex())._activeCell;n==="Forward"?(i=1,r="Tab"):(i=-1,r="ShiftTab");this._updateActiveCell(f.rowIndex,f.colIndex+i,t,r)},_navigateCol:function(n,t){var i,r,u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex())._activeCell;n==="Forward"?(i=1,r="Enter"):(i=-1,r="ShiftEnter");this._updateActiveCell(f.rowIndex+i,f.colIndex,t,r)},_updateActiveCell:function(n,t,i,r){var u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex()),e=f._activeCell;u._removeClass(u.getCell(e.rowIndex,e.colIndex),"e-activecell");f._activeCell={rowIndex:n,colIndex:t};i&&this._isHiddenCell(f._activeCell)&&this._skipHiddenRowsAndCols(f._activeCell,i,!0,r);this._isMergedCell(f._activeCell)&&this._skipMergedCells(f._activeCell,i);this._scrollToCell(f._activeCell,i);u.addClass(u.getCell(f._activeCell.rowIndex,f._activeCell.colIndex),"e-activecell");u.model.allowFormulaBar&&u.updateFormulaBar();u.setSheetFocus()},_isValidParameter:function(n){var t=n.indexOf("(");return t>-1?(n=n.split("("),n[1].length>0):!0},_skipHiddenRowsAndCols:function(n,t,i,r){var e=this.XLObj,u=e.getSheet(e.getActiveSheetIndex()),f=!0;i?this._navigateRange(r,t):((t.keyCode===37||t.keyCode===9&&t.shiftKey||t.keyCode===39&&t.ctrlKey)&&n.colIndex?n.colIndex--:(t.keyCode===38||t.keyCode===13&&t.shiftKey||t.keyCode===40&&t.ctrlKey)&&n.rowIndex?n.rowIndex--:(t.keyCode===39||t.keyCode===9||t.keyCode===37&&t.ctrlKey)&&n.colIndex<u.colCount?n.colIndex++:(t.keyCode===40||t.keyCode===13||t.keyCode===38&&t.ctrlKey)&&n.rowIndex<u.rowCount?n.rowIndex++:f=!1,this._isHiddenCell(n)&&f?this._skipHiddenRowsAndCols(n,t):f||((t.keyCode===37||t.keyCode===9&&t.shiftKey)&&!n.colIndex?n.colIndex=t.keyCode===37&&t.shiftKey?u._endCell.colIndex+1:u._startCell.colIndex:(t.keyCode===38||t.keyCode===13&&t.shiftKey)&&!n.rowIndex&&(n.rowIndex=t.keyCode===38&&t.shiftKey?u._endCell.rowIndex+1:u._startCell.rowIndex)))},_isHiddenCell:function(n){return this.XLObj.XLEdit.getPropertyValue(0,n.colIndex,"isCHide")||this.XLObj.XLEdit.getPropertyValue(n.rowIndex,0,"isRHide")||!1},_isMergedCell:function(n){return this.XLObj.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"isMHide")||!1},_skipMergedCells:function(n,t){var u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex()),i=f._startCell,r=f._endCell,e=!0,o=u._rcRegx;minr=i.rowIndex<r.rowIndex?i.rowIndex:r.rowIndex;maxr=i.rowIndex>r.rowIndex?i.rowIndex:r.rowIndex;minc=i.colIndex<r.colIndex?i.colIndex:r.colIndex;maxc=i.colIndex>r.colIndex?i.colIndex:r.colIndex;t.shiftKey&&t.keyCode===9?n.colIndex--:t.keyCode===9?n.colIndex++:t.shiftKey&&t.keyCode===13?n.rowIndex--:t.keyCode===13?n.rowIndex++:e=!1;n.colIndex>maxc?(n.colIndex=minc,n.rowIndex=n.rowIndex===maxr?minr:n.rowIndex+1):n.colIndex<minc?(n.colIndex=maxc,n.rowIndex=n.rowIndex===minr?maxr:n.rowIndex-1):n.rowIndex>maxr?(n.rowIndex=minr,n.colIndex=n.colIndex===maxc?minc:n.colIndex+1):n.rowIndex<minr&&(n.rowIndex=maxr,n.colIndex=n.colIndex===minc?maxc:n.colIndex-1);this._isMergedCell(n)&&e&&this._skipMergedCells(n,t)},_updateMergeRange:function(n,t,i){var f=this.XLObj,r=n.mSpan.colSpan-1,u=n.mSpan.rowSpan-1;i.shiftKey||i.keyCode!==39&&i.keyCode!==9?i.shiftKey||i.keyCode!==40&&i.keyCode!==13||(t.rowIndex=t.rowIndex+u):t.colIndex=t.colIndex+r},_isRangeMerged:function(n){var i,r={},u=this.XLObj,f=n[0],t=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"merge");if(t&&(r={rowIndex:n[0].rowIndex+t.mSpan.rowSpan-1,colIndex:n[0].colIndex+t.mSpan.colSpan-1},i=u._getSelectedRange(n[0],r),i.length===n.length))return!0},_scrollToCell:function(n,t){var f=this.XLObj,o=f.getActiveSheetIndex(),i=f._getCellInfo(n,o),r=f.getSheet(o),s=f._getContent(o),h=s.find(".e-content"),u=s.find("#hscrollBar").data("ejScrollBar"),e=s.find("#vscrollBar").data("ejScrollBar");(f.model.scrollSettings.scrollMode!=="normal"||r.colCount-1!==n.colIndex)&&(r._bottomRow.idx>0&&n.rowIndex>r._bottomRow.idx-1&&r.rowCount-1>n.rowIndex&&t.keyCode===40?e.scroll(e.value()+i.height,!0):n.rowIndex-1<r._topRow.idx&&t.keyCode===38?(e._scrollData.step=-1,n.rowIndex>0?e.scroll(i.top,!0):e.scroll(0)):n.colIndex<r._leftCol.idx?n.colIndex>0?u.scroll(u.value()-i.width,!0):u.scroll(0):h[0].offsetWidth<=i.left+i.width&&(t.keyCode===39?r.colCount===n.colIndex+1?f.XLScroll._scrollX(o):u.scroll(u.value()+i.width,!0):t.keyCode===37&&(u._scrollData.step=-1,u.scroll(i.left,!0))))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cellType=function(n){this.XLObj=n;this._isIntrnlUpdate=!1};t.spreadsheetFeatures.cellType.prototype={_renderControls:function(i,r,u,f,e){var ft,ot,tt,s,k,p;if(f){var h,l,v,it,o=this.XLObj,et=o._browserDetails.name,a,c=o._getSheetIndex(u),rt=o.getCell(i,r,c),st=o.getSheet(c),nt=o.XLEdit.getPropertyValue(i,r,"value2",c),d=f.type,g=o._generateHeaderText(r+1),w=f.text||o.XLEdit.getPropertyValue(i,r,"value2",c)||f.type+g+(i+1),b=o._dataContainer.sheetCellType,ct=o._getColWidth(r,u),ht=o._getRowHeight(i,u),ut=o.XLEdit.getPropertyValue(i,r,"cellType"),y=ut>-1?ut:o.getObjectLength(b);o._textClip(i,r,"delete","",!0);o._textClip(i,r,"add","");rt&&(l=rt[0]);o.addClass(l,"e-cellreadonly");o._dupDetails||(ut?f.isChecked=b[y].isChecked:st.cellTypes.push({range:o._getAlphaRange(u,i,r,i,r),settings:f}));switch(d){case"Button":h=o._id+"_btn_"+c+g+(i+1);o.XLFormat._writeCssRules("e-btncls"+i+r,"border: 0px; vertical-align: middle;padding: 0px;color:"+f.color+";background:"+f["background-color"]+";",!0,!0);l&&(l.innerHTML="<button id ="+h+' class = "e-btncls'+i+r+'"><\/button>');l&&(et==="mozilla"||et==="msie")&&(o.addClass(l,"e-btnhgt"),o.addClass(rt.parents(".e-table")[0],"e-btnhgt"));e||(v={type:d,id:h,text:w,color:f.color||"","background-color":f["background-color"]||""},b[y]=v,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{cellType:y},sheetIdx:c}));n("#"+h).ejButton({type:"button",width:"100%",height:"100%",text:w,create:n.proxy(this._onButtonCreate),click:n.proxy(this.onButtonClick),cssClass:f["class"]||""});break;case"CheckBox":h=o._id+"_chk_"+c+g+(i+1);l&&(l.innerHTML="<input id ="+h+' style = "" />');e||(v={type:d,id:h,text:w,isChecked:f.isChecked||nt&&nt.toLowerCase()==="true"||!1},b[y]=v,it=o.XLEdit._parseValue(v.isChecked,{rowIndex:i,colIndex:r}),it.cellType=y,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:it,sheetIdx:c}),l&&(l.lastChild.textContent=""));n("#"+h).ejCheckBox({text:"",size:"small",change:n.proxy(this.onActiveStateChange),checked:v.isChecked,cssClass:f["class"]||""});break;case"DropDownList":if(a=f.dataSourceSheetIndex||c,h=o._id+"_drpdwn_"+c+g+(i+1),dataRange=f.dataSourceRange&&o.getRangeIndices(f.dataSourceRange),l&&(l.innerHTML="<input id ="+h+" />"),a===c||o.getSheet(a)._isLoaded||o._initSheet(a),o.isUndefined(f.selectedIndex)&&w)for(ft=f.dataSource=f.dataSource||o.getRangeData({range:dataRange,sheetIdx:a}),ot=f.field=f.field||"value2",tt=ft.length;--tt>=0;)if(ft[tt][ot]===w){f.selectedIndex=tt;break}if(e||(v={type:d,id:h,text:w,style:"",dataSource:f.dataSource||"",dataSourceRange:f.dataSourceRange||"",selectedIndex:f.selectedIndex>-1?f.selectedIndex:-1,dataSourceSheetIndex:a},b[y]=v,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{cellType:y},sheetIdx:c})),f.dataSourceRange)if(s=o._getSelectedRange({rowIndex:dataRange[0],colIndex:dataRange[1]},{rowIndex:dataRange[2],colIndex:dataRange[3]}),k=o.XLEdit._getPropWithCellIdx([s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex],"ddlRange",a),k.length===0)o.updateUniqueData({ddlRange:[{rowIndex:i,colIndex:r,sheetIndex:c}]},[s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex],"",a);else for(p=0;p<s.length;p++)k=o.XLEdit.getPropertyValue(s[p].rowIndex,s[p].colIndex,"ddlRange",a),k?(k.push({rowIndex:i,colIndex:r}),o.XLEdit._updateDataContainer({rowIndex:s[p].rowIndex,colIndex:s[p].colIndex},{dataObj:{ddlRange:k},sheetIdx:a})):o.XLEdit._updateDataContainer({rowIndex:s[p].rowIndex,colIndex:s[p].colIndex},{dataObj:{ddlRange:[{rowIndex:i,colIndex:r}]},sheetIdx:a});n("#"+h).ejDropDownList({width:"100%",height:o.model.rowHeight-1,change:n.proxy(this.onActiveValueChange),dataSource:f.dataSource||o.getRangeData({range:dataRange,sheetIdx:a}),fields:{text:f.field||"value2"},watermarkText:f.watermarkText||"Select an option",cssClass:f["class"]||"",selectedIndex:f.selectedIndex>-1?f.selectedIndex:-1,beforePopupShown:n.proxy(this._onBeforePopupOpen)});break;case"DatePicker":h=o._id+"_dp_"+c+g+(i+1);l&&(l.innerHTML="<input id ="+h+' style = "height:'+(ht-1)+'px" />');e||(v={type:d,id:h,text:w,style:""},b[y]=v,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{cellType:y},sheetIdx:c}));n("#"+h).ejDatePicker({width:"100%",height:o.model.rowHeight-1,value:f.value||nt&&t.parseDate(nt)||new Date,create:n.proxy(this._onDateCreate),change:n.proxy(this.onDateChange),cssClass:f["class"]||""})}}},addCellTypes:function(n,t,i){var r=this.XLObj;r.model.allowCellType&&(r.model.isReadOnly||(Array.isArray(n)&&(n=r._getAlphaRange(i,n[0],n[1],n[2],n[3])),this._rangeCellTypes([{range:n,settings:t}],i,!0)))},_rangeCellTypes:function(i,r,u){var y,at,b,vt,ut,st,ht,o,yt;if(i){var f=this.XLObj,it,ft,p,k=[],ct=f._browserDetails.name,s=f._getSheetIndex(r),nt,ot=f._dataContainer,v,e,l,w,tt,h,et,rt,d=f.getSheet(s),g,lt=0,c,a;for((u||!d._isLoaded)&&(lt=d.cellTypes.length,t.merge(d.cellTypes,i),i=d.cellTypes),y=lt,at=d.cellTypes.length;y<at;y++)if(et=f.getRangeIndices(i[y].range),e=i[y].settings,v=f._getSelectedRange({rowIndex:et[0],colIndex:et[1]},{rowIndex:et[2],colIndex:et[3]}),v.length===1)f._dupDetails=!0,this._renderControls(v[0].rowIndex,v[0].colIndex,s,e),f._dupDetails=!1;else{for(b=0,vt=v.length;b<vt;b++){p=e.dataSourceSheetIndex||s;c=v[b].rowIndex;a=v[b].colIndex;f._textClip(c,a,"delete","",!0);f._textClip(c,a,"add");rt=f.getObjectLength(ot.sheetCellType);f._isRowViewable(s,c)&&(l=f.getCell(c,a,s)[0]);text=e.text||f.XLEdit.getPropertyValue(c,a,"value2",s)||e.type+f._generateHeaderText(v[b].colIndex+1)+(v[b].rowIndex+1);l&&(l.innerHTML="");f._hasClass(l,"e-cellreadonly")||f.addClass(l,"e-cellreadonly");ft=f._generateHeaderText(a+1);switch(e.type){case"Button":w=f._id+"_btn"+y+"_"+s+ft+(c+1);f.XLFormat._writeCssRules("e-btncls"+c+a,"border: 0px; vertical-align: middle; padding: 0px;color:"+(e.color||"")+";background:"+(e["background-color"]||"")+";",!0,!0);l&&(l.innerHTML="<button id ="+w+' type="button" class = "e-btncls'+c+a+'"><\/button>');(l&&ct==="mozilla"||ct==="msie")&&(f.addClass(l,"e-btnhgt"),f.addClass($cell.parents(".e-table")[0],"e-btnhgt"));(u||!d._isLoaded)&&(nt={type:e.type,id:w,text:text,color:e.color||"","background-color":e["background-color"]||""},it={cellType:rt});break;case"CheckBox":w=f._id+"_chk"+y+"_"+s+ft+(c+1);l&&(l.innerHTML="<input id ="+w+" />");(u||!d._isLoaded)&&(nt={type:e.type,id:w,text:"",isChecked:e.isChecked||!1},it=f.XLEdit._parseValue(e.isChecked||f.XLEdit.getPropertyValue(c,a,"value2")||"false",{rowIndex:c,colIndex:a}),it.cellType=rt);l&&(l.lastChild.textContent="");break;case"DropDownList":if(w=f._id+"_drpdwn"+y+"_"+s+ft+(c+1),l&&(l.innerHTML="<input id ="+w+" value = "+text+" />"),nt={type:e.type,id:w,style:"",dataSource:e.dataSource||"",dataSourceRange:e.dataSourceRange||"",selectedIndex:e.selectedIndex>-1?e.selectedIndex:"",dataSourceSheetIndex:p},tt=f.getRangeIndices(e.dataSourceRange),h=f._getSelectedRange({rowIndex:tt[0],colIndex:tt[1]},{rowIndex:tt[2],colIndex:tt[3]}),u||!d._isLoaded){if(e.dataSourceRange)if(ut=f.XLEdit._getPropWithCellIdx([h[0].rowIndex,h[0].colIndex,h[h.length-1].rowIndex,h[h.length-1].colIndex],"ddlRange",p),ut.length===0)f.updateUniqueData({ddlRange:[{rowIndex:c,colIndex:a,sheetIndex:s}]},[h[0].rowIndex,h[0].colIndex,h[h.length-1].rowIndex,h[h.length-1].colIndex],"",p);else for(o=0;o<h.length;o++)ut=f.XLEdit.getPropertyValue(h[o].rowIndex,h[o].colIndex,"ddlRange",p),ut?(ut.push({rowIndex:c,colIndex:a,sheetIndex:s}),f.XLEdit._updateDataContainer({rowIndex:h[o].rowIndex,colIndex:h[o].colIndex},{dataObj:{ddlRange:ut},sheetIdx:p})):f.XLEdit._updateDataContainer({rowIndex:h[o].rowIndex,colIndex:h[o].colIndex},{dataObj:{ddlRange:[{rowIndex:c,colIndex:a,sheetIndex:s}]},sheetIdx:p});if(p===s||f.getSheet(p)._isLoaded||f._initSheet(p),f.isUndefined(e.selectedIndex)&&text)for(st=e.dataSource||f.getRangeData({range:tt,sheetIdx:p}),e.dataSource||(e.dataSource=st),ht=e.field||"value2",e.field||(e.field=ht),o=st.length;--o>=0;){if(st[o][ht]===text){nt.selectedIndex=o;break}o==0&&delete nt.selectedIndex}it={cellType:rt}}break;case"DatePicker":w=f._id+"_dp"+y+"_"+s+ft+(c+1);l&&(l.innerHTML="<input id ="+w+" value = "+text+' style = "height:'+(f._getRowHeight(c,s)-1)+'px" />');(u||!d._isLoaded)&&(nt={type:e.type,id:w,style:""},it={cellType:rt})}(u||!d._isLoaded)&&(ot.sheetCellType[rt]=nt,f.XLEdit._updateDataContainer({rowIndex:c,colIndex:a},{dataObj:it,sheetIdx:s}));f._checkIndicesInContainer(s,v[b].rowIndex,v[b].colIndex,"cellType")&&(g=ot.sheetCellType[ot.sheets[s][v[b].rowIndex][v[b].colIndex].cellType],g.type==="CheckBox"&&g.isChecked&&k.push({type:g.type,id:g.id}),g.type==="DropDownList"&&g.selectedIndex>-1&&k.push({type:g.type,id:g.id,selectedIndex:g.selectedIndex}))}switch(e.type){case"Button":n("[id^='"+f._id+"_btn"+y+"_"+s+"']").ejButton({type:"button",width:"100%",height:"100%",text:text,create:n.proxy(this._onButtonCreate),click:n.proxy(this.onButtonClick),cssClass:i["class"]||""});break;case"CheckBox":n("[id^='"+f._id+"_chk"+y+"_"+s+"']").ejCheckBox({change:n.proxy(this.onActiveStateChange),checked:!1,cssClass:i["class"]||""});break;case"DropDownList":n("[id^='"+f._id+"_drpdwn"+y+"_"+s+"']").ejDropDownList({width:"100%",height:f.model.rowHeight-1,change:n.proxy(this.onActiveValueChange),dataSource:e.dataSource||f.getRangeData({range:tt,sheetIdx:p}),fields:{text:e.field||"value2"},watermarkText:e.watermarkText||"Select an option",cssClass:e["class"]||"",selectedIndex:e.selectedIndex>-1?e.selectedIndex:"",beforePopupShown:n.proxy(this._onBeforePopupOpen)});break;case"DatePicker":n("[id^='"+f._id+"_dp"+y+"_"+s+"']").ejDatePicker({width:"100%",height:f.model.rowHeight-1,value:e.value||new Date,create:n.proxy(this._onDateCreate),change:n.proxy(this.onDateChange),cssClass:i["class"]||""})}for(o=0,yt=k.length;o<yt;o++)this._isIntrnlUpdate=!0,k[o].type==="CheckBox"?n("#"+k[o].id).length&&n("#"+k[o].id).ejCheckBox("instance").option("checked",!0):k[o].type==="DropDownList"&&n("#"+k[o].id).length&&n("#"+k[o].id).ejDropDownList("instance").option("selectedIndex",k[o].selectedIndex),this._isIntrnlUpdate=!1}}},removeCellTypes:function(n,t){var r=this.XLObj;if(!r.model.isReadOnly){var i,e=t||r.getActiveSheetIndex(),f=r._getRangeArgs(n,"object"),u=r.XLEdit._getPropWithCellIdx(f,"cellType",t);for(i=0,len=u.length;i<len;i++)this._removeControls(u[i].rowIdx,u[i].colIdx,t)}},_removeControls:function(n,t,i,r){var e,u=this.XLObj,f=i||u.getActiveSheetIndex(),o=u._dataContainer,f=u.getActiveSheetIndex();r||(delete o.sheetCellType[o.sheets[f][n][t].cellType],delete o.sheets[f][n][t].cellType);u._isRowViewable(f,n)&&(e=u.getCell(n,t,i)[0],e.innerHTML=u.XLEdit.getPropertyValue(n,t,"value2",f)||"",u._removeClass(e,"e-cellreadonly"))},onActiveValueChange:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");if(!t.model.isReadOnly){var f=t._dataContainer,o=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(o[0]),r=t._getRowIdx(i.rowIndex,e),u=i.colIndex;f.sheetCellType[f.sheets[e][r][u].cellType].selectedIndex=n.itemId;t.XLEdit._updateDataContainer({rowIndex:r,colIndex:u},{dataObj:t.XLEdit._parseValue(n.value,{rowIndex:r,colIndex:u})});n.cellIndex=i;n.cellType="dropdownlist";t._trigger("cellSave",n);t.model.allowFormulaBar&&t.updateFormulaBar()}},onActiveStateChange:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");if(!t.model.isReadOnly&&!t.XLCellType._isIntrnlUpdate){var u=t._dataContainer,f,o=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(o[0]),s=t._getRowIdx(i.rowIndex,e),r=i.colIndex;u.sheetCellType[u.sheets[e][i.rowIndex][r].cellType].isChecked=n.isChecked;f=["yes","no"].indexOf(t.XLEdit.getPropertyValue(i.rowIndex,r,"value2").toString().toLowerCase())>-1?n.isChecked?"YES":"NO":n.isChecked.toString().toUpperCase();t.XLEdit._updateDataContainer({rowIndex:i.rowIndex,colIndex:r},{dataObj:t.XLEdit._parseValue(f,{rowIndex:i.rowIndex,colIndex:r})});n.cellIndex=i;n.cellType="checkbox";t._trigger("cellSave",n);t.model.allowFormulaBar&&t.updateFormulaBar()}},_onDateCreate:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet"),o=t._dataContainer,f=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(f[0]),r=t._getRowIdx(i.rowIndex,e),u=i.colIndex;t.XLEdit._updateDataContainer({rowIndex:r,colIndex:u},{dataObj:t.XLEdit._parseValue(n.model.value.toLocaleString().split(", ")[0],{rowIndex:r,colIndex:u})})},onDateChange:function(n){var i=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");if(!i.model.isReadOnly){var s=i._dataContainer,e=this.element.closest("td"),o=i.getActiveSheetIndex(),r=i._getCellIdx(e[0]),u=i._getRowIdx(r.rowIndex,o),f=r.colIndex;i.XLEdit._updateDataContainer({rowIndex:u,colIndex:f},{dataObj:i.XLEdit._parseValue(n.model.value.toLocaleString().split(t.isNullOrUndefined(n.model.value.toLocaleString().match(/[,]/))?" ":", ")[0],{rowIndex:u,colIndex:f})});n.cellIndex=r;n.cellType="datepicker";i._trigger("cellSave",n)}},_onButtonCreate:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet"),o=t._dataContainer,f=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(f[0]),r=t._getRowIdx(i.rowIndex,e),u=i.colIndex;t.XLEdit._updateDataContainer({rowIndex:r,colIndex:u},{dataObj:t.XLEdit._parseValue(n.model.text,{rowIndex:r,colIndex:u})})},onButtonClick:function(t){var i=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");i.model.isReadOnly||(t.cellIndex=i._getCellIdx(n(t.target).closest("td")[0]),t.cellType="button",i._trigger("cellClick",t))},_onBeforePopupOpen:function(){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet"),r=t.getActiveSheetIndex(),f=t._dataContainer,s=this.element.closest("td"),e=t._getCellIdx(s[0]),h=t._getRowIdx(e.rowIndex,r),c=e.colIndex,i=f.sheetCellType[f.sheets[r][h][c].cellType],u=i.dataSourceSheetIndex||r,o;t.getSheet(u)._isLoaded||t._initSheet(u);o=i.dataSource||t.getRangeData({range:t.getRangeIndices(i.dataSourceRange),sheetIdx:u});n("#"+i.id).ejDropDownList("instance").option("dataSource",o);n("#"+i.id).ejDropDownList("instance").option("selectedItemIndex",i.selectedIndex)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cellFormatting=function(n){this.XLObj=n;this._formatEnable=!1;this._thousandSeparator=t.preferredCulture(this.XLObj.model.locale).numberFormat[","];this._formatAsTableStyle={};this._rowLength=null;this._colLength=null;this._getFormat=null;this._getEformatClass=null;this._borderPosition=["top","right","bottom","left"];this._cellObj=null;this._isFAT=!1;this._customFormatSpecifierType={};this._customFontFamily={}};t.spreadsheetFeatures.cellFormatting.prototype={format:function(i,r){var u=this.XLObj,yt,v;if(u.model.allowCellFormatting&&!u.model.isReadOnly){var f,e,y,b,rt,ct,ut,ft,h,g,a,k,c,et,nt,l,lt,ot=0,d={},at=[],tt="style",it="format",s=u.getActiveSheetIndex(),o=u.getSheet(s),wt=u._rAlign,p=u._dataContainer,w={sheetIndex:s,reqType:"cell-format"},pt=u._dupDetails,st=!1,vt=o.rowsHeightCollection,ht=0;if((y=u._getMultiRangeCells(r),g=y.length,!u._trigger("beforeCellFormat",{sheetIndex:s,format:i,cells:y}))&&g){if(i=this._getFormatObj(i),tt in i||it in i){for(w.oprType=(tt in i)?"style":"format",lt=y[g-1].colIndex;ot<g;){if(e=y[ot],k={sheetIndex:s,format:i,cell:e},this._cellObj={},f={rowIndex:e.rowIndex,colIndex:e.colIndex,beforeFormat:{},afterFormat:{},bRowHeight:u.model.allowResizing&&u.XLResize.getRowHeight(e.rowIndex)},d=t.isNullOrUndefined(p.sheets[s][f.rowIndex])?{}:t.isNullOrUndefined(p.sheets[s][f.rowIndex][f.colIndex])?{}:p.sheets[s][f.rowIndex][f.colIndex],u._isRowViewable(s,e.rowIndex)&&(ft=u.getCell(e.rowIndex,e.colIndex),h=ft[0]),tt in i&&(f.prevClass=u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,it),f.prevClass=f.prevClass?f.prevClass:"",l=this._getExtendedFormat(e,i.style),l.format["text-align"]&&l.format["text-align"].toLowerCase()==="right"&&!u._hasClass(h,"e-rightalign")?u.addClass(h,"e-rightalign"):(!l.format["text-align"]||l.format["text-align"].toLowerCase()!=="right")&&u._hasClass(h,"e-rightalign")&&u._removeClass(h,"e-rightalign"),this._cellObj.formats=n.extend(!0,{},l.format),rt=u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"tformats"),rt&&(l.format=n.extend(rt,l.format)),this._cellObj.format=f.className=this._createFormatClass(l.format),f.beforeFormat=n.extend(!0,{},d),("font-family"in i.style||"font-size"in i.style)&&!u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"isMHide")&&t.isNullOrUndefined(u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"merge"))&&(nt=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex),u.model.allowResizing&&(u.isNumber(nt)||u._isDateTime(nt)||u.isTime(nt))&&(et=u.XLResize._getContentWidth(f.colIndex,s,f.rowIndex,f.rowIndex)+2,et>o.columnsWidthCollection[f.colIndex]&&u.setWidthToColumns([{colIndex:f.colIndex,width:et}])),u.model.allowSelection&&u.XLSelection._refreshBorder(),st=!0),k.cssClass=l.className),it in i&&i.type&&(a=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex),a=t.isNullOrUndefined(a)?"":a,this._cellObj.value=a,this._cellObj.type=i.type,this._cellObj.formatStr=i.format.formatStr,this._cellObj.decimalPlaces=i.format.decimalPlaces,this._cellObj.thousandSeparator=i.format["thousandSeparator"]?!0:!1,this._cellObj.canUpdate=!0,f.beforeFormat=n.extend(!0,{},d),a=this._getFormattedValue(f.rowIndex,f.colIndex,this._cellObj,a),k.value=this._cellObj.value,k.value2=this._cellObj.value2=t.isNullOrUndefined(a)?"":a+"",delete this._cellObj.canUpdate,f.beforeFormat.Oprtype=this._cellObj.type),u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2")&&u._textClip(f.rowIndex,f.colIndex,"delete"),u.XLEdit._updateDataContainer(f,{dataObj:this._cellObj}),tt in i&&("font-family"in i.style||"font-size"in i.style)&&!u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"isMHide")){if(b=o.columnsWidthCollection[f.colIndex],u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"merge")&&u._isRowViewable(s,e.rowIndex)){if(h.colSpan>1)for(v=e.colIndex+1,yt=e.colIndex+h.colSpan;v<yt;v++)b=b+o.columnsWidthCollection[v];if(c=u._detailsFromGlobalSpan(f.rowIndex,f.colIndex,"height",u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2"),b),h.rowSpan>1)for(v=e.rowIndex;v<e.rowIndex+h.rowSpan;v++)ht=ht+vt[v];c=c-(ht-vt[e.rowIndex])}else c=u._detailsFromGlobalSpan(f.rowIndex,f.colIndex,"height",u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2"),b);(u.XLEdit.getPropertyValue(f.rowIndex,0,"wrapRow")?o.rowsHeightCollection[f.rowIndex]<c:!0)&&c>=u.model.rowHeight&&(h&&ft.parent().outerHeight(c),o.rowsHeightCollection[f.rowIndex]=c,u.XLEdit._updateDataContainer({rowIndex:f.rowIndex,colIndex:0},{dataObj:{pHeight:o.rowsHeightCollection[f.rowIndex],cHeight:c}}),u._fRowHtColl[f.rowIndex]=c,st=!0,u.model.allowFreezing&&(u.XLFreeze._refreshFRowResize(e.rowIndex),u.XLFreeze._refreshFColResize(e.colIndex)))}ct=u._getCellInfo(e);u._dupDetails=!0;it in i&&["text","general"].indexOf(this._cellObj.type)===-1&&(ut=u._detailsFromGlobalSpan(e.rowIndex,e.colIndex,"width",this._cellObj.value2),ut>ct.width&&u.XLResize.setColWidth(e.colIndex,ut),u.model.allowFreezing&&u.XLFreeze._refreshFColResize(e.colIndex));u._dupDetails=!1;u._dupDetails=pt;o._isColSelected&&o.selectedRange[1]<=f.colIndex&&f.colIndex<=o.selectedRange[3]&&(o._columnStyles[f.colIndex]=n.extend(!0,o._columnStyles[f.colIndex],this._cellObj));o._isRowSelected&&o.selectedRange[0]<=f.rowIndex&&f.rowIndex<=o.selectedRange[2]&&(o._rowStyles[f.rowIndex]=n.extend(!0,o._rowStyles[f.rowIndex],this._cellObj));this._cellObj=null;d=t.isNullOrUndefined(p.sheets[s][f.rowIndex])?{}:t.isNullOrUndefined(p.sheets[s][f.rowIndex][f.colIndex])?{}:p.sheets[s][f.rowIndex][f.colIndex];f.afterFormat=n.extend(!0,{},d);f.afterFormat.Oprtype=f.beforeFormat.Oprtype;f.aRowHeight=u.model.allowResizing&&u.XLResize.getRowHeight(e.rowIndex);at.push(f);u._trigger("cellFormatting",k);u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2")&&u._textClip(f.rowIndex,f.colIndex,"add");lt===f.colIndex&&u._setRowHdrHeight(s,f.rowIndex);ot++}w.selectedCell=at;w.range=o.selectedRange;u.XLScroll._getRowHeights(s,y[0].rowIndex);st&&(!o._isImported||o._isLoaded)&&u.model.allowComments&&!u._isExport&&u.XLComment._updateCmntArrowPos(null,s)}"border"in i&&!u._isMultiRange(r)?this.applyBorder(i.border,r,w):o._isImported&&!o._isLoaded||u._isUndoRedo||u._dupDetails||u._isSort||u._isExport||(u._completeAction(w),u._trigActionComplete(w))}}},_getFormattedValue:function(n,i,r,u){var o,f=this.XLObj,e={},u=t.isNullOrUndefined(u)?"":f.XLEdit.getPropertyValue(n,i);return t.isNullOrUndefined(u)&&(u=""),f.isFormula(u)&&(u=f.XLEdit.getPropertyValue(n,i,"calcValue"),r.canUpdate=!1),["text","general"].indexOf(r.type)!==-1?(f._isDateTime(u)&&(o=f.XLEdit.getPropertyValue(n,i,"type"),u=f._dateToInt(u,o===t.Spreadsheet.CellType.Time),r.value=u),r.type===t.Spreadsheet.CellType.Text?e.align="":f.isNumber(u)&&f.XLEdit.getPropertyValue(n,i,"align")!="right"&&(e.align=t.Spreadsheet.Align.Right),"align"in e&&(e.cellIdx={rowIndex:n,colIndex:i},f.XLEdit._refreshCellAlignment(e))):u=this._format(u,{formatStr:r.formatStr,type:r.type,thousandSeparator:r.thousandSeparator,decimalPlaces:r.decimalPlaces,cellObj:r}),u},_format:function(n,i){var u=this.XLObj,e=i.formatStr,r=u.isUndefined(n)?"":n,l=i.type||"",f=t.Spreadsheet.CellType,h=u.model.locale,a=["."].indexOf(this._thousandSeparator)>-1?"\\":"",v=new RegExp(a+this._thousandSeparator,"g");n=r.toString();switch(l){case f.Accounting:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.toAccounting(e,r,h));break;case f.Currency:case f.Number:case f.Percentage:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.formatting(e,r,h),!i.thousandSeparator&&[f.Number,f.Percentage].indexOf(l)>-1&&this._thousandSeparator&&(r=r.replace(v,"")));break;case f.Scientific:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.toExponential(r,i.decimalPlaces));break;case f.Fraction:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.toFraction(r),r="numerator"in r?r.integer+" "+r.numerator+"/"+r.denominator:r.integer);break;case f.LongDate:case f.ShortDate:case f.Date:case f.Time:case f.DateTime:u.isNumber(r)?(r=u.intToDate(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r)):u._isDateTime(r)||(r=t.parseDate(r));u._isDateTime(r)&&(r=u.formatting(e,r,h));break;case f.String:var c=e.indexOf("\\"),o=e.indexOf("#"),s=e.split("\\").join("");o<0&&(o=e.indexOf("0"));c<o?r=s.substr(c,s.length-1)+n:c>o&&(r=n+s.substr(o+1,s.length))}return t.isNullOrUndefined(r)?n:r},createTable:function(i,r){var u=this.XLObj;if(u.model.allowFormatAsTable&&(u.model.allowSelection||!t.isNullOrUndefined(r))&&!u.model.isReadOnly){t.isNullOrUndefined(i.format)&&(i.format=this._getTableLayoutFromName(i.formatName).format);t.isNullOrUndefined(i.showHeaderRow)&&(i.showHeaderRow=!0);var o,p,d,f,k,c,s,v=i.name||"",h=u.getActiveSheetIndex(),e=u.getSheet(h),w=e.tableManager,l=e._startCell,a=e._endCell,g="formatName",b={sheetIndex:h,tableStyle:i,reqType:"format-table"},nt=i.format||this._getTableLayoutFromName(i.formatName).format,y={format:nt},it=u._dupDetails,tt=u.element.find("#"+u._id+"_Ribbon_tsofiltercolumn");if(p={range:t.isNullOrUndefined(r)?[l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]:r,sheetIndex:b.sheetIndex,tableStyle:b.tableStyle,reqType:b.reqType},!u._trigActionBegin(p)&&nt)return(i=b.tableStyle,this._isFAT=!0,r=u._getRangeArgs(r,"object"),f=u._isUndoRedo?n.merge([],r):r?r:e.selectedRange,i.name&&!u.XLRibbon._validateNamedRange(i.name,u._getDollarAlphaRange(f,!0))&&!u.XLClipboard._isCut)?void 0:(k=u.XLEdit.getPropertyValue(f[0],f[1],"tableName")||"",(!e._isImported||e._isLoaded)&&(d=u.getRange(f),o={sheetIndex:h,reqType:"format-table",beforeFormat:this.getHashCodeClassAsArray(),beforeRange:n.extend(!0,[],f),pcells:d,beforeRangeHeader:u.getRangeData({range:[f[0],f[1],f[0],f[3]]})},c=i.header?[f[0],f[1],f[2],f[3]]:[f[0],f[1],f[2]+1,f[3]],o.beforeRangeData=u.getRangeData({range:c}),o.beforeMergeRange=u.XLEdit._getPropWithCellIdx(c,"merge",h),u._dupDetails=!0,o.beforeMergeRange.length&&u.unmergeCells(u._getAlphaRange(h,c[0],c[1],c[2],c[3])),u._dupDetails=!1),g in i&&(y[g]=i.formatName),"showHeaderRow"in i&&(y.showHeaderRow=i.showHeaderRow),k?(this._formatAsTableStyle=y,u._dupDetails=!0,this._createTable(u._getTableID(k),y),u._dupDetails=!1,u._undoCollection.pop(),u._undoCollection.pop()):(s=u.XLClipboard._isCut?parseInt(i.tblId):u.getObjectLength(w)+1,v=v.length?v:"Table"+s,u.model.sheets[h]._header[s]={header:i.header},e._isLoaded&&(i.header?(r?(e._startCell={rowIndex:r[0],colIndex:r[1]},e._endCell={rowIndex:r[2],colIndex:r[3]},u.XLSelection.selectRange(e._startCell,e._endCell),u.model.allowAutoFill&&(!e._isImported||e._isLoaded)&&u.XLDragFill.positionAutoFillElement()):r=u.swapRange([l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]),r[0]===r[2]&&(f=r,f[2]=f[2]+1)):(u._isUndoRedo?f=n.extend(!0,[],r):(f=r?r:u.swapRange([l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]),r=f),u.model.allowDragAndDrop&&u.XLDragDrop._moveRangeTo(f,[f[0]+1,f[1],f[2]+1,f[3]],["value","value2","type","formatStr","decimalPlaces","thousandSeparator","range","format","border","borders","comment","hyperlink","picture","cFormatRule","rule","chart","isLocked","wrap","formats","tformats","tborders","tableName"]),e._startCell={rowIndex:f[0],colIndex:f[1]},e._endCell={rowIndex:f[2]+1,colIndex:f[3]},u.XLSelection.selectRange(e._startCell,e._endCell),u.model.allowAutoFill&&(!e._isImported||e._isLoaded)&&u.XLDragFill.positionAutoFillElement(),f[2]=f[2]+1)),"dataSource"in i&&u.updateRange(h,{showHeader:"showHeader"in i?i.showHeader:!0,startCell:u._getAlphaRange(h,r[0],r[1],r[0],r[1]),dataSource:i.dataSource}),u.updateUniqueData({tableName:"e-table"+s},r),w[s]={name:v,range:f,showHeaderRow:i.showHeaderRow},i.fnNumber&&(w[s].fnNumber=i.fnNumber),w[s].isFilter=i.showHeaderRow,u.XLRibbon._isDesignTab=!0,u._dupDetails=!0,this._createTable(s,y),i.showHeaderRow&&u.model.allowFiltering&&u.XLFilter._filterTable(h,s,{startCell:{rowIndex:r[0],colIndex:r[1]},endCell:{rowIndex:r[2],colIndex:r[3]}}),u._dupDetails=!1,this._updateTblStyleOptns(s,i),e._isImported&&!e._isLoaded||i.hideTab||u.XLRibbon._designTabUpdate(s,{rowIndex:r[0],colIndex:r[1]}),u.model.allowComments&&u.XLComment._updateCmntArrowPos()),(!e._isImported||e._isLoaded)&&(u.XLRibbon._dirtySelect(u.getRange(r)),o.tableID=s,o.tableStyle=i,o.afterRange=f,u._dupDetails=it,p={pCells:o.pcells,reqType:o.reqType,sheetIndex:o.sheetIndex,tableID:o.tableID,tableStyle:o.tableStyle},u._isPaste||u._isUndoRedo||u._dupDetails||u._isExport||(u._completeAction(o),u._trigActionComplete(p))),tt.length&&tt.ejCheckBox("option",{checked:!0}),u.XLRibbon.addNamedRange(v,u._getDollarAlphaRange(r,!0),null,h),e._isLoaded&&u.XLSelection._refreshBorder(),this._isFAT=!1,i.name)}},_createTable:function(t,i){var f,s,h,u,c,tt,it,rt,k,d,e,g,a=1,ut="format",ht=ut+"s",lt="t"+ht,ft="border",et="tableName",nt="e-table"+t,ot=!1,r=this.XLObj,o=r.getActiveSheetIndex(),ct=r.getSheet(o),y=ct.tableManager[t],p=y.range,v=p[0],w=p[1],st=p[2],b=p[3],at=r.element.find("#"+r._id+"_Ribbon_tsofiltercolumn");if(y[ut]=i.format,i.formatName&&(y["formatName"]=i.formatName),y.showHeaderRow&&(i.showHeaderRow=y.showHeaderRow),this.removeStyle(p,{tableStyle:!0,border:!0,sheetIdx:o}),i.showHeaderRow&&"headerLayout"in i.format&&(u=n.extend(!0,{},i.format.headerLayout),ft in u&&(c=r._getProperAlphaRange(o,v,w,v,b),r._intrnlReq=!0,this.applyBorder(u.border,c),r._intrnlReq=!1,delete u.border)),ot=r.getObjectLength(u)>0,f=v,s=w,h=b,i.showHeaderRow)while(s<=h)d=!1,e={},cellIdx={rowIndex:f,colIndex:s},tt=r.XLEdit.getPropertyValue(f,s,"value2")||"",it="Column"+a,r.XLEdit.getPropertyValue(f,s,et,o)!==nt&&(e.tableName=nt,d=!0),tt.length?tt.toLowerCase()===it.toLowerCase()&&a++:(r.XLEdit._updateCell(cellIdx,it),a++),ot&&(k=this._getExtendedFormat(cellIdx,u,this._isFAT),e.format=this._createFormatClass(k.format),e.tformats=u,d=!0),d&&r.XLEdit._updateDataContainer(cellIdx,{dataObj:e,sheetIdx:o}),s++;if("contentLayout"in i.format)for(rt=i.format.contentLayout.length,a=0,f=i.showHeaderRow?v+1:v,s=st;f<=s;){if(u=n.extend(!0,{},i.format.contentLayout[a%rt]),ft in u&&(c=r._getProperAlphaRange(o,f,w,f,b),r._intrnlReq=!0,this.applyBorder(u.border,c),r._intrnlReq=!1,delete u.border),r.getObjectLength(u))for(h=w,l=b;h<=l;)e={},cellIdx={rowIndex:f,colIndex:h},g=n.extend({},u),r.XLEdit.getPropertyValue(f,h,et,o)!==nt&&(e.tableName=nt),g.color&&r.XLEdit.getPropertyValue(f,h,"hyperlink")&&delete g.color,k=this._getExtendedFormat(cellIdx,g,this._isFAT),e.format=this._createFormatClass(k.format),e.tformats=u,r.XLEdit._updateDataContainer(cellIdx,{dataObj:e,sheetIdx:o}),h++;f++;a++}"contentBorder"in i.format&&(c=r._getProperAlphaRange(o,v+1,w,st,b),r._intrnlReq=!0,this.applyBorder(n.extend({},i.format.contentBorder.border),c),r._intrnlReq=!1);r.XLClipboard._isCut||r._tableCnt++},_updateTblStyleOptns:function(n,t){var i,r,e="firstColumn",o="lastColumn",h="bold",c="normal",l="totalRow",s="isFilter",u=this.XLObj,f=u._getSheetIndex(),v=u.getSheet(f),a=v.tableManager;n in a&&(i=a[n],r=i.range,i[s]=s in t?t.isFilter:"showHeaderRow"in t?t.showHeaderRow:!0,u.model.allowFiltering&&!i[s]&&u.XLFilter._clearFilterTableIcon(f,n),u._dupDetails=!0,e in t&&(i[e]=t.firstColumn,this.format({style:{"font-weight":i[e]?h:c}},u._getProperAlphaRange(f,r[0]+1,r[1],r[2],r[1]))),o in t&&(i[o]=t.lastColumn,this.format({style:{"font-weight":i[o]?h:c}},u._getProperAlphaRange(f,r[0]+1,r[3],r[2],r[3]))),u._dupDetails=!1,l in t&&(i[l]=t.totalRow))},removeTable:function(t){var i=this.XLObj;if(i.model.allowFormatAsTable&&!i.model.isReadOnly){var r,c,l,e,a,o,u=0,s=i.getActiveSheetIndex(),h=i.getSheet(s).tableManager,f=h[t].range,y=h[t].name,v=i.element.find("#"+i._id+"_Ribbon_tsofiltercolumn");if(t in h){if(i.clearRangeData(f,["tableName"]),r=i._getSelectedRange({rowIndex:f[0],colIndex:f[1]},{rowIndex:f[2],colIndex:f[3]}),c=r.length,c)while(u<c)l=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"formats"),e=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"tformats"),a=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"borders"),o=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"tborders"),e&&(n.extend(e,l),i.XLEdit._updateDataContainer(r[u],{dataObj:{formats:e}})),o&&(n.extend(o,a),i.XLEdit._updateDataContainer(r[u],{dataObj:{borders:o}})),i.XLEdit._clearDataContainer({cellIdx:{rowIndex:r[u].rowIndex,colIndex:r[u].colIndex},property:["tformats","tborders"]}),u++;i.model.allowFiltering&&!i._isFATResize&&i.XLFilter._clearFilterTable(s,parseInt(t));delete h[t];delete i.model.sheets[s]._header[t];i.XLRibbon.removeNamedRange(y);v.length&&v.ejCheckBox("option",{checked:!1});i.XLRibbon._toggleDesignTab(i.getActiveCell(s))}}},_renameTable:function(t){var i=this.XLObj,h=i.getActiveSheetIndex(),u=i.getSheet(h).tableManager,r=i._getTableID(t),f,e,o,c=n("#"+i._id+"_Ribbon").data("ejRibbon"),s;r&&(s=document.getElementById(i._id+"_Ribbon_Design_Properties_TableName")&&document.getElementById(i._id+"_Ribbon_Design_Properties_TableName").value,f=u[r].name,f!=s&&(e=i._getDollarAlphaRange(u[r].range,!0),i.XLRibbon._validateNamedRange(s,e)&&(o={sheetIndex:h,reqType:"format-table",action:"renaming",range:e,tableId:parseInt(r),prevName:f},i.XLRibbon.removeNamedRange(f),u[r].name=s,i.XLRibbon.addNamedRange(u[r].name,e,null,h),o.newName=u[r].name,c.showTab(i._getLocStr("Design")),i._completeAction(o),i._trigActionComplete(o))))},_getTableLayoutFromName:function(n){if(n)return this.XLObj._FATStyles[n]},_getTableIdxFromName:function(n){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()).tableManager,t=i.getObjectLength(r);if(t)while(t--)if(r[t].name===n)return t;return-1},convertToRange:function(n){var t=this.XLObj;t.model.isReadOnly||(n.alert?t._showAlertDlg("","ConverToRangeAlert","ConvertToRange",498):this._convertToRange(n))},_convertToRange:function(t){var r=this.XLObj,e=t.sheetIdx||r.getActiveSheetIndex(),h=r.getSheet(e),u,o,f=r.getSheet(e).tableManager,s=h.filterSettings.tableRange;for(u=t.tableId||r._getTableID(null,document.getElementById(r._id+"_Ribbon_Design_Properties_TableName")&&document.getElementById(r._id+"_Ribbon_Design_Properties_TableName").value),i=0;i<s.length;i++)s[i].tableID==u&&(tableId=i);r.getObjectLength(f)&&(o={sheetIndex:e,reqType:"format-table",action:"Design_Tools_ConvertToRange",beforeFormat:r.XLFormat.getHashCodeClassAsArray(),tableID:u,name:f[u].name,format:f[u].format,formatName:f[u].formatName,tableRange:s[tableId],beforeRange:f[u].range,isFilter:f[u].isFilter,header:n.extend(!0,[],h._header[u]),firstColumn:f[u].firstColumn,lastColumn:f[u].lastColumn,totalRow:f[u].totalRow,fnNumber:f[u].fnNumber});r.isNumber(u)&&r.XLFormat.removeTable(u);r.model.showRibbon&&r.XLRibbon._toggleDesignTab(r.getActiveCell());r._completeAction(o);r._trigActionComplete(o)},_calculateTotalRow:function(r,u,f,e,o){var s=this.XLObj,v,d=[],g=[],w,y,h,b=!1,p,rt=s.getSheet(r),l=rt.tableManager,nt,k,tt=s._id+"_Ribbon_Design_TableStyleOptions_TotalRow",et=n("#"+tt).data("ejCheckBox"),c,a,it=s._isUndo,ut=s._isUndoRedo,ft=s._dupDetails;if(u=u||parseInt(document.getElementById(s._id+"_tableid").value),h=l[u].range,d.push(s.getRangeData({range:[h[2]+1,h[1],h[2]+1,h[3]]})),w=s._getProperAlphaRange(r,h[0]+1,h[3],h[2],h[3]),v=s._getSelectedRange({rowIndex:h[2]+1,colIndex:h[1]},{rowIndex:h[2]+1,colIndex:h[3]}),f){if(c={rowIndex:h[2]+1,colIndex:h[1]},a={rowIndex:h[2]+1,colIndex:h[3]},s._dupDetails=s._isTotalRow=!0,s._insRows={startRow:c.rowIndex,endRow:a.rowIndex},s._isUndo=!1,!o&&(s._isUndoRedo?s.insertEntireRow(c.rowIndex,a.rowIndex):nt=s.insertShiftBottom(c,a),nt))return;if(s._isUndo=it,s._isUndoRedo=ut,s._dupDetails=s._isTotalRow=!1,!s._isFilterApplied||s._insDelStatus=="insert"){if(v.length>1&&s.XLEdit._updateCellValue(v[0],f?"Total":""),!l[u].fnNumber&&f){if(p=t.distinct(s.getRangeData({range:s.getRangeIndices(w),valueOnly:!0})),p=p.filter(Boolean),i=p.length,i){while(i--)if(!s.isNumber(p[i])){b=!0;break}}else b=!0;l[u].fnNumber=b?103:109}s.XLEdit._updateCellValue(v[v.length-1],f?"=SUBTOTAL("+l[u].fnNumber+","+w+")":"");l[u].range[2]+=1;s._insDelStatus==""}}else c={rowIndex:h[2],colIndex:h[1]},a={rowIndex:h[2],colIndex:h[3]},s._dupDetails=s._isTotalRow=!0,s.model.allowFiltering&&s.XLFilter._checkFilterApplied(r,c.rowIndex,1,c.colIndex,1,"filter"),s._checkTableApplied(r,c.rowIndex,1,c.colIndex,1,"filter"),s._isFilterApplied||s._isTableApplied?(s._intrnlReq=!0,s._isUndo=!1,s.deleteEntireRow(c.rowIndex,a.rowIndex),s._isUndo=it,s._intrnlReq=!1,e=!1):s._deleteShiftUp(r,c,a,{startCol:c.colIndex,colCount:a.colIndex-c.colIndex+1,startRow:c.rowIndex,rowCount:a.rowIndex-c.rowIndex+1,status:"shiftUp"}),s._isTotalRow=!1,l[u].range[2]-=1;s._dupDetails=ft;f?l[u].totalRow=!0:"totalRow"in l[u]&&delete l[u].totalRow;y=l[u].range;s.XLFormat._createTable(u,{format:l[u].format});g.push(s.getRangeData({range:[y[2]+1,y[1],y[2]+1,y[3]]}));k={sheetIndex:r,reqType:"format-table",action:"totalrow",range:w,check:f,id:tt,cell:v,tmgr:l,tableId:u,pcells:d[0],curCells:g[0],fnNumber:l[u].fnNumber,isShift:e};o&&(s._dupDetails=s._isUndoRedo=!1);s._dupDetails||(s._completeAction(k),s._trigActionComplete(k));s._dupDetails=!1},_updateTotalRow:function(n,t,i,r,u){var f=this.XLObj,o=f.getSheet(n),e=o.tableManager;e[t].fnNumber=i;u&&f._clearFormula(r[2],r[3]);f.XLEdit._updateCellValue({rowIndex:r[2],colIndex:r[3]},"=SUBTOTAL("+e[t].fnNumber+","+f._getAlphaRange(val.sheetIndex,r[0]+1,r[3],r[2]-1,r[3])+")")},customFormatParser:function(n){if(this.XLObj.model.allowCellFormatting){var i,f,e,o={},h=t.Spreadsheet.CellType,r="{0:",u="}",c="N",a="P",s=".",l="0";return n=t.isNullOrUndefined(n)?"":n.toString(),Number(n)===0?(n.indexOf(s)>-1?(e=n.split(s),i=r+c+e[1].length+u):i=r+"D"+n.length+u,f=h.Number):!n.indexOf("#")&&n.indexOf(",")>-1&&n.lastIndexOf(l)===n.length-1?(n.indexOf(s)>-1?(e=n.split(s),i=r+c+e[1].length+u):i=r+c+l+u,o.thousandSeparator=!0,f=h.Number):n.lastIndexOf("%")===n.length-1&&Number(n.replace(/%/g,""))===0?(n.indexOf(s)>-1?(e=n.split(s),i=r+a+--e[1].length+u):i=r+a+l+u,f=h.Percentage):/^[dMy/\-\s,]+$/.test(n)?(i=r+n+u,f=h.Date):/^[hmst:\s]+$/.test(n)?(i=r+n+u,f=h.Time):n.indexOf("\\")>-1&&(o.formatStr=n,o.type="string"),i&&(o.formatStr=i,o.type=f),o}},addCustomFormatSpecifier:function(n,i,r){var e,u=t.Spreadsheet.CellType,f=t.cultures[this.XLObj.model.locale];if([u.Date,u.DateTime,u.LongDate,u.ShortDate,u.Time].indexOf(r)>-1){for(e in f.calendar.patterns)if(f.calendar.patterns[e]==i)return;n||(n="cDFrmt"+Object.keys(f.calendar.patterns).length);f.calendar.patterns[n]=i;this._customFormatSpecifierType[n]=r}},addFontFamily:function(i){var s,r,h=i,e=this._customFontFamily,f=this.XLObj,u=49,o;if(i=i.toLowerCase(),f.isUndefined(e[i])){for(s in e)o=parseInt(e[s]),o>u&&(u=o);u++;f.model.showRibbon&&(r=n("#"+f._id+"_Ribbon_Home_Font_FontFamily").data("ejDropDownList"),ddDataSrc=n.extend(!0,[],f.XLRibbon._fontFamily),ddDataSrc.push({text:h,value:u}),r&&(selectedIdx=r.model.selectedItemIndex,r.option({dataSource:ddDataSrc}),r._initValue=!0,r.selectItemByIndex(selectedIdx),r._initValue=!1,f.XLRibbon._fontFamily=ddDataSrc));e[i]=u+"";t.Spreadsheet.FontFamily[i]=u+""}},removeFontFamily:function(i){var e,r,o=this._customFontFamily,u=this.XLObj,f,s;if(u.model.showRibbon)for(r=n("#"+u._id+"_Ribbon_Home_Font_FontFamily").data("ejDropDownList"),f=n.extend(!0,[],u.XLRibbon._fontFamily),e=0;e<f.length;e++)if(f[e].text===i){f.splice(e,1);r&&(s=r.model.selectedItemIndex,r.option({dataSource:f}),r._initValue=!0,r.selectItemByIndex(s),r._initValue=!1);u.XLRibbon._fontFamily=f;break}i=i.toLowerCase();u.isUndefined(o[i])||(delete o[i],u.isUndefined(t.Spreadsheet.FontFamily[i])||delete t.Spreadsheet.FontFamily[i])},applyBorder:function(i,r,u){var f=this.XLObj,e,o;f.model.allowCellFormatting&&f.model.formatSettings.allowCellBorder&&!f.model.isReadOnly&&(e=f.getActiveSheetIndex(),o=f.getSheet(e),r=f._getRangeArgs(r,"object",e),(!o._isImported||o._isLoaded)&&(u||(u={sheetIndex:e,reqType:"cell-format",process:"border",options:n.extend(!0,{},i)}),u.range=r,u.beforeFormat=this.getHashCodeClassAsArray(r),u.property=i.property,delete i.property),f.getObjectLength(i)?i.isGridBorder?this._applyAllBorderCss(i,r,u):this._applyBorderCss(i,r,u):this.removeStyle(r,{cellStyle:!0,border:!0,sheetIdx:e}),o._isImported&&!o._isLoaded||f._isUndoRedo||(f._refreshRangeTRHght(e,r),t.isNullOrUndefined(i.tableID)&&!this._dupDetails&&(u.afterFormat=this.getHashCodeClassAsArray(r),f._intrnlReq||(f._completeAction(u),f._trigActionComplete(u)))))},updateDecimalPlaces:function(i,r){var u=this.XLObj;if(u.model.allowCellFormatting&&u.model.formatSettings.allowDecimalPlaces&&!u.model.isReadOnly){var p,h,w,l,s,e,f,a=0,o={},v,c=u.getActiveSheetIndex(),k=u.getSheet(c),d=u._dataContainer,y={action:"decimal",reqType:"cell-format",sheetIndex:c,oprType:"format"},b=[];for(r=u._getRangeArgs(r,"object"),l=u._getSelectedCells(c,r).selCells,p=l.length;a<p;)s=l[a].rowIndex,e=l[a].colIndex,f=u.getRangeData({range:[s,e,s,e]})[0],h={rowIndex:s,colIndex:e,afterFormat:{},beforeFormat:{}},v=u._dataContainer.sheets[c][s][e],n.extend(!0,h.beforeFormat,v),u.isNumber(f.value)&&(u.isUndefined(f.decimalPlaces)&&(f.decimalPlaces=u._decimalCnt(f.value)),o.type=f.type===t.Spreadsheet.CellType.General?t.Spreadsheet.CellType.Number:f.type,o.decimalPlaces=f.decimalPlaces=i==="DecreaseDecimal"?f.decimalPlaces>0?f.decimalPlaces-1:f.decimalPlaces:f.decimalPlaces+1,o.formatStr=u._getFormatString(o.type,o.decimalPlaces),w=this._format(f.value,{formatStr:o.formatStr,type:o.type,thousandSeparator:f.thousandSeparator,decimalPlaces:o.decimalPlaces}),o.value2=w,u.XLResize&&u.XLResize._getContentWidth(e,c,0,u.getSheet(c).usedRange.rowIndex)>=k.columnsWidthCollection[e]-5&&(u._dupDetails=!0,u.XLResize._fitWidth(e),u._dupDetails=!1,u.XLSelection.refreshSelection(),u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement()),u.XLEdit._updateDataContainer({rowIndex:s,colIndex:e},{dataObj:o}),h.beforeFormat.Oprtype=o.type),f=u.getRangeData({range:[s,e,s,e]})[0],v=u._dataContainer.sheets[c][s][e],n.extend(!0,h.afterFormat,v),h.afterFormat.Oprtype=h.beforeFormat.Oprtype,b.push(h),a++;y.selectedCell=b;u._isUndoRedo||(u._completeAction(y),u._trigActionComplete(y))}},getFormatClass:function(n,t){var i=t?"e-border":"e-format",r=new RegExp("\\b"+i+".*?\\b","g");return n.indexOf(i)!==-1?n.match(r)[0]:""},getHashCodeClassAsArray:function(n){var r,e,u,t=0,f={format:[]},i=this.XLObj,o=i.getActiveSheetIndex(),s=["topborder","leftborder"];for(n=i._toIntrnlRange(n,o),n=n?i.swapRange(n):i.getSheet(o).selectedRange,r=i.getRange(n),e=r.length;t<e;)u=r[t].className,f.format.push(this.getFormatClass(u)+" "+this.getFormatClass(u,!0)),t++;for(t=2;t--;)f[s[t]]=this._getBorderArray(n,s[t]);return f},_getBorderArray:function(n,t){var i,r=0,u=[],o=this.XLObj,f="topborder",s=t===f?n[0]-1:n[1]-1,e;if(s>=0)for(e=t===f?o.getRange([n[0]-1,n[1],n[0]-1,n[3]]):o.getRange([n[0],n[1]-1,n[2],n[1]-1]),i=e.length;r<i;)u.push(this.getFormatClass(e[r].className,!0)),r++;else for(i=t===f?n[3]-n[1]+1:n[2]-n[0]+1;i--;)u.push("");return u},removeStyle:function(t,i){var f=this.XLObj;if(!f.model.isReadOnly){i=i||{cellStyle:!0,tableStyle:!0,format:!0,border:!0};var w,g,e,r,o,b,l,h,u,c,s,k,a,y,d=0,v=this._borderPosition,nt=f._getSheetIndex(i.sheetIdx),p=f.getSheet(nt);for(t=f._getRangeArgs(t,"object"),w=f._getSelectedCells(nt,t).selCells,g=w.length;d<g;)a=!1,r=w[d],i.skipHiddenRow&&f._isHiddenRow(r.rowIndex,i.sheetIdx)||(i.format&&(i.cellStyle&&i.tableStyle?f.XLEdit._clearDataContainer({cellIdx:r,property:["format","formats","tformats"]}):(i.cellStyle&&f._hasCellStyle(r.rowIndex,r.colIndex,i.sheetIdx)||i.tableStyle&&f._isTableRange(r.rowIndex,r.colIndex,i.sheetIdx))&&(k=[i.cellStyle?"formats":"tformats"],b=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,i.cellStyle?"tformats":"formats",i.sheetIdx),b?(o=this.getFormatHashCode(b),this._updateFormatClass(r,o)):k.push("format"),f.XLEdit._clearDataContainer({cellIdx:r,property:k}))),i.border&&(i.cellStyle&&i.tableStyle?(l=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"borders",i.sheetIdx)||{},h=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(h,l),v[0]in h&&r.rowIndex&&(e=r.rowIndex-1,o=f.XLEdit.getPropertyValue(e,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(e,r.colIndex,s,u,"bottom","bottom",!0),a=!0),v[1]in h&&(y=!0,e=r.colIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.colCount&&(c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),v[3]in s&&(u.right!=s.left&&(u.right=s.left,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)),y=!1)),y&&(delete u.right,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),v[2]in h&&(y=!0,e=r.rowIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.rowCount&&(c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),v[0]in s&&(u.bottom!=s.top&&(u.bottom=s.top,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)),y=!1)),y&&(delete u.bottom,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),v[3]in h&&r.colIndex&&(e=r.colIndex-1,o=f.XLEdit.getPropertyValue(r.rowIndex,e,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,e,s,u,"right","right",!0),a=!0),a&&f.XLEdit._clearDataContainer({cellIdx:r,property:["borders","tborders"]})):i.cellStyle?(l=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"borders",i.sheetIdx)||{},h=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tborders",i.sheetIdx)||{},v[0]in l&&r.rowIndex&&(e=r.rowIndex-1,o=f.XLEdit.getPropertyValue(e,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),"bottom"in s?l.bottom===u.bottom&&("top"in h?(u.bottom=h.top,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:e,colIndex:r.colIndex},o,!0)):s.bottom!=u.bottom&&(u.bottom=s.bottom,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:e,colIndex:r.colIndex},o,!0))):this._remStyle(e,r.colIndex,s,u,"top","bottom"),a=!0),v[1]in l&&(e=r.colIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.colCount?(c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),"left"in s?l.right===u.right&&("right"in h?(u.right=h.right,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):s.left!=u.right&&(u.right=s.left,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0))):this._remStyle(r.rowIndex,r.colIndex,h,u,"right","right")):this._remStyle(r.rowIndex,r.colIndex,h,u,"right","right"),a=!0),v[2]in l&&(e=r.rowIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.rowCount?(c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),"top"in s?l.bottom===u.bottom&&("bottom"in h?(u.bottom=h.bottom,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):s.top!=u.bottom&&(u.bottom=s.top,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0))):this._remStyle(r.rowIndex,r.colIndex,h,u,"bottom","bottom")):this._remStyle(r.rowIndex,r.colIndex,h,u,"bottom","bottom"),a=!0),v[3]in l&&r.colIndex&&(e=r.colIndex-1,o=f.XLEdit.getPropertyValue(r.rowIndex,e,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),"right"in s?l.left===u.right&&("left"in h?(u.right=h.left,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:r.rowIndex,colIndex:e},o,!0)):s.right!=u.right&&(u.right=s.right,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:r.rowIndex,colIndex:e},o,!0))):this._remStyle(r.rowIndex,e,h,u,"left","right"),a=!0),a&&f.XLEdit._clearDataContainer({cellIdx:r,property:["borders"]})):i.tableStyle&&(l=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"borders",i.sheetIdx)||{},h=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tborders",i.sheetIdx)||{},"top"in h&&!("top"in l)&&r.rowIndex&&(e=r.rowIndex-1,o=f.XLEdit.getPropertyValue(e,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(e,r.colIndex,s,u,"bottom","bottom",!0),a=!0),"right"in h&&!("right"in l)&&(e=r.colIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.colCount?(c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,r.colIndex,s,u,"left","right",!0)):(delete u.right,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),"bottom"in h&&!("bottom"in l)&&(e=r.rowIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.rowCount?(c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,r.colIndex,s,u,"top","bottom",!0)):(delete u.bottom,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),"left"in h&&!("left"in l)&&r.colIndex&&(e=r.colIndex-1,o=f.XLEdit.getPropertyValue(r.rowIndex,e,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,e,s,u,"right","right",!0),a=!0),a&&f.XLEdit._clearDataContainer({cellIdx:r,property:["tborders"]})))),d++}},_remStyle:function(n,t,i,r,u,f,e){var o=this.XLObj;u in i?e&&i[u]==r[f]||(r[f]=i[u],this._updateFormatClass({rowIndex:n,colIndex:t},this._getBorderHashCode(r),!0)):(delete r[f],o.getObjectLength(r)?this._updateFormatClass({rowIndex:n,colIndex:t},this._getBorderHashCode(r),!0):o.XLEdit._clearDataContainer({cellIdx:{rowIndex:n,colIndex:t},property:["border"]}))},_refreshStyles:function(t,i,r){for(var e,f,o,h="format",s="border",a=!i||i===h,v=!i||i===s,u=this.XLObj,c=u._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]}),l=c.length;l--;)cellIdx=c[l],a&&(e=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"formats")||{},f=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"tformats")||{},n.extend(f,e),u.getObjectLength(f)?(o=this._createFormatClass(f),this._updateFormatClass(cellIdx,o,!1)):u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,h)&&u.XLEdit._clearDataContainer({cellIdx:cellIdx,property:[h]})),v&&(e=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"borders")||{},f=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"tborders")||{},n.extend(f,e),u.getObjectLength(f)?(o=this._getBorderHashCode(f),this._updateFormatClass(cellIdx,o,!0)):u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,s)&&(r,style=this.getBorderFromHashCode(hCode),"right"in style,u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,s)&&u.XLEdit._clearDataContainer({cellIdx:cellIdx,property:[s]})))},updateFormat:function(n,t){var r=this.XLObj,i,u,f,e;if(!r.model.isReadOnly){for(f=["topborder","leftborder"],e=n.format,t=r._getRangeArgs(t,"object"),u=r._getSelectedCells(r.getActiveSheetIndex(),t).selCells,i=u.length;i--;)this._updateHashCodeClass(u[i],e[i]);for(i=2;i--;)this._updateBorderClass(t,n[f[i]],f[i])}},_updateBorderClass:function(n,t,i){var r,u,f=this.XLObj,e="topborder",o=i===e?n[0]-1:n[1]-1;if(o>=0)for(u=i===e?f._getSelectedRange({rowIndex:n[0]-1,colIndex:n[1]},{rowIndex:n[0]-1,colIndex:n[3]}):f._getSelectedRange({rowIndex:n[0],colIndex:n[1]-1},{rowIndex:n[2],colIndex:n[1]-1}),r=u.length;r--;)this._updateFormatClass(u[r],t[r],!0)},updateUniqueFormat:function(n,i,r){var f=this.XLObj,o,s,i,e,c,u,h,l,a;if(!f.model.isReadOnly){for(o=f.getActiveSheetIndex(),s=f.getSheet(o),i=f._getRangeArgs(i,"object"),e=f._getSelectedCells(o,i).selCells,u=e.length;u--;)c=f._isUndoRedo?t.isNullOrUndefined(n[u].format)?"e-format":n[u].format:n,this._updateFormatClass(e[u],c),f.XLEdit._updateDataContainer(e[u],{dataObj:{formats:this.getFormatFromHashCode(c)},sheetIdx:o}),(r=="Title"||r=="Heading 4")&&(f._isRowViewable(o,e[u].rowIndex)&&(l=f.getCell(e[u].rowIndex,e[u].colIndex)),h=f._detailsFromGlobalSpan(e[u].rowIndex,e[u].colIndex,"height",f.XLEdit.getPropertyValue(e[u].rowIndex,e[u].colIndex,"value2"),s.columnsWidthCollection[e[u].colIndex]),a=f._isUndo?f.model.rowHeight:s.rowsHeightCollection[e[u].rowIndex],h>=a&&(l&&l.parent().outerHeight(h),f.XLEdit._updateDataContainer({rowIndex:e[u].rowIndex,colIndex:0},{dataObj:{pHeight:s.rowsHeightCollection[e[u].rowIndex],cHeight:h}}),s.rowsHeightCollection[e[u].rowIndex]=h),f.model.allowFreezing&&f.XLFreeze._refreshFRowResize(e[u].rowIndex));f._refreshRangeTRHght(o,f.swapRange(i))}},_hasFormat:function(n){return n?!t.isNullOrUndefined(n.match(/e-format|e-border/)):!1},getFormatHashCode:function(n){var i,u,t="",r=0,f="background-color",e="color",o="font-family",s="font-size",h=["font-style","text-decoration","vertical-align","text-align","font-weight"],l=h.length,a=["FontStyle","TextDecoration","VerticalAlign","TextAlign","FontWeight"],c="text-indent";for(t=(f in n)?n[f].replace("#",""):"6N",t+=(e in n)?n[e].replace("#",""):"6N",(o in n)?(i=this._getStyleCode("FontFamily",n[o]),t+=i||"2N"):t+="2N",t+=(s in n)?this._getFontCode(n[s]):"2N";r<l;)u=h[r],u in n?(i=this._getStyleCode(a[r],n[u]),t+=i||"1N"):t+="1N",r++;return t.endsWith("N")||(t=t+"N"),c in n&&(t+=n[c].replace(/pt|-|\+/g,"")),"e-format"+t},getFormatFromHashCode:function(n){var t,f,e,o,s,h,c,l,u,a,i,r={},v="e-format";if(n=n||"",!n.indexOf(v)){for(e="pt",t=f=0,a=["FontStyle","TextDecoration","VerticalAlign","TextAlign"],c=["font-style","text-decoration","vertical-align","text-align"],l=c.length,i=n.replace(v,"").split("N"),i[t].length===1?t++:(r["background-color"]="#"+i[t].slice(0,6),i[t]=i[t].substr(6)),i[t].length===1?t++:(r.color="#"+i[t].slice(0,6),i[t]=i[t].substr(6)),u=i[t].length,u===1?t++:(s="FontFamily",o="font-family",u===2?(r[o]=this._getCodeStyle(s,i[t].slice(0,1)+"1N"),t++):(r[o]=this._getCodeStyle(s,i[t].slice(0,2)),i[t]=i[t].substr(2))),u=i[t].length,u===1?t++:(h="font-size",u===2?(r[h]=i[t].slice(0,1)+e,t++):(r[h]=i[t].slice(0,2)+e,i[t]=i[t].substr(2)));f<l;)i[t].length===1?t++:(r[c[f]]=this._getCodeStyle(a[f],i[t].slice(0,1)),i[t]=i[t].substr(1)),f++;i[t]==="2"&&(r["font-weight"]="bold");t++;i[t]&&(r["text-indent"]=i[t]+e)}return r},getBorderFromHashCode:function(n,t){var r,i=0,u={},e="e-border",f=this._borderPosition;return n=n||"",n.indexOf(e)||(r=n.replace(e,"").split("N"),r[i].length>1?(u[f[1]]=this._concatBorderCode(r[i]),r[i]=r[i].substr(8)):i+=3,r[i].length>1?(u[f[2]]=this._concatBorderCode(r[i]),t&&(r[i]=r[i].substr(8))):i+=3,t&&(r[i].length>1?(u[f[0]]=this._concatBorderCode(r[i]),r[i]=r[i].substr(8)):i+=3,r[i].length>1&&(u[f[3]]=this._concatBorderCode(r[i])))),u},_formatPainter:function(){var n=this.XLObj,f,e,h;if(n.model.allowFormatPainter&&n.model.allowCellFormatting){var c=n.getActiveSheetIndex(),t,i,o=0,s=n.getSheet(c),r=s._startCell,u=s._endCell;for(this._rowLength=u.rowIndex-r.rowIndex+1,this._colLength=u.colIndex-r.colIndex+1,f=this._rowLength,e=this._colLength,h=n.getRangeData({range:[r.rowIndex,r.colIndex,u.rowIndex,u.colIndex],property:["value","value2","type","wrap","formatStr","thousandSeparator","decimalPlaces","cFormatRule","hyperlink","format","cellType"]}),this._getEformatClass=new Array(f),t=0;t<f;t++)for(this._getEformatClass[t]=new Array(e),i=0;i<e;i++)this._getEformatClass[t][i]={rangeData:h[o]},o++}},_fPMouseUp:function(){var s,b,d,n=this.XLObj,e=n.getActiveSheetIndex(),p=n.getSheet(e),g=n._getContent(e).find("div.e-content"),k=0,nt,u=p._selectedCells,tt=p._startCell,it=p._endCell,h,c,i=0,rt=0,l,a,ut,ft,w,et=it.rowIndex-tt.rowIndex,ot=it.colIndex-tt.colIndex,o,ht=n.XLEdit,r,v=p.selectedRange,y=n.getRangeData({range:v,property:["wrap","hyperlink","value","value2","cFormatRule","format","cellType","formats","formatStr","decimalPlaces","thousandSeparator","type"]}),f={sheetIndex:e,reqType:"format-painter",range:v,beforeData:y,bFormat:this.getHashCodeClassAsArray(v),unwrapCells:[],wrapCells:[]},st=n.element.find("#"+n._id+"_Ribbon_Home_Clipboard_FormatPainter");for(n._dupDetails=!0,h=0;h<=et;h++){for(rt++,c=0;c<=ot;c++){if(k++,o=n._getAlphaRange(e,u[i].rowIndex,u[i].colIndex,u[i].rowIndex,u[i].colIndex),cell=u[i],r=this._getEformatClass[h][c],this.removeStyle([u[i].rowIndex,u[i].colIndex,u[i].rowIndex,u[i].colIndex],{cellStyle:!0,tableStyle:!1,format:!0}),s={type:r.rangeData.type?r.rangeData.type:"general"},r.rangeData.format&&(s.style=this.getFormatFromHashCode(r.rangeData.format)),r.rangeData.formatStr&&(s.formatStr=r.rangeData.formatStr),r.rangeData.decimalPlaces&&(s.decimalPlaces=r.rangeData.decimalPlaces),r.rangeData.thousandSeparator&&(s.thousandSeparator=r.rangeData.thousandSeparator),this.format(s,o),r.rangeData.cellType&&(b=n._dataContainer.sheetCellType[r.rangeData.cellType],b.text="",n.XLCellType._renderControls(u[i].rowIndex,u[i].colIndex,e,b)),!t.isNullOrUndefined(r.rangeData.cFormatRule))for(w=0,ft=r.rangeData.cFormatRule.length;w<ft;w++)nt=r.rangeData.cFormatRule[w],a=nt.split("_"),ut=a[5],a[a.indexOf(ut)]=o,n._dataContainer.cFormatRule=a.join("_"),l=n._dataContainer.cFormatRule.split("_"),n.XLCFormat._cFormat(l[0],l[2],l[3],l[4],l[5]);if(y[i].wrap&&!r.rangeData.wrap?(n.setWrapText("unwrap",o),f.wrapCells.push({rowIndex:u[i].rowIndex,colIndex:u[i].colIndex})):!y[i].wrap&&r.rangeData.wrap&&(n.setWrapText("wrap",o),f.unwrapCells.push({rowIndex:u[i].rowIndex,colIndex:u[i].colIndex})),r.rangeData.hyperlink&&!y[i].hyperlink?this.format({style:{"text-decoration":"underline",color:n._hlColor}},o):!r.rangeData.hyperlink&&y[i].hyperlink&&(this.format({style:{"text-decoration":"none"}},o),n.addClass(n.getCell(cell.rowIndex,cell.colIndex,e).find("a"),ht.getPropertyValue(cell.rowIndex,cell.colIndex,"format",e))),i++,k===ot+1){k=0;break}this._colLength===c+1&&(c=-1)}if(rt===et+1)break;this._rowLength===h+1&&(h=-1)}this._formatEnable=!1;g.addClass("e-ss-cursor");g.removeClass("e-ss-fpcursor");st.length&&st.ejToggleButton("option",{toggleState:!1});n._dupDetails=!1;f.afterData=n.getRangeData({range:v,property:["wrap","hyperlink","value","value2","cFormatRule","format","cellType","formats","formatStr","decimalPlaces","thousandSeparator","type"]});f.aFormat=this.getHashCodeClassAsArray(v);n.XLSelection.refreshSelection();n.XLDragFill.positionAutoFillElement();d={sheetIndex:f.sheetIndex,currData:f.afterData,currFormat:f.aFormat,reqType:f.reqType,range:f.range,prevData:f.beforeData,prevFormat:f.bFormat,unwrapCells:f.unwrapCells,wrapCells:f.wrapCells};n._isUndoRedo||(n._completeAction(f),n._trigActionComplete(d))},_getFormatObj:function(n){if("type"in n||"formatStr"in n){var t={},i="thousandSeparator";t.formatStr="formatStr"in n?n.formatStr:this.XLObj._getFormatString(n.type,n.decimalPlaces);t.decimalPlaces="decimalPlaces"in n?n.decimalPlaces:["currency","accounting","number"].indexOf(n.type)!==-1?parseInt(t.formatStr.replace(/{0:|[A-Z]|}/g,"")):0;i in n?t[i]=n[i]:n.type==="number"&&(t[i]=!0);n.format=t}return"style"in n&&n.style.border&&(n.border=n.style.border,delete n.style.border,this.XLObj.getObjectLength(n.style)||delete n.style),n},_createFormatClass:function(n,t,i){var r,u=this.XLObj._dataContainer.hashCode;return(t=t||this.getFormatHashCode(n),u.indexOf(t)!==-1)?t:(r=this._getCssPropertyAsString(n),this._writeCssRules(t,r,i),u.push(t),t)},_writeCssRules:function(n,t,i,r){var u=document.getElementById(this.XLObj._id+"_sscustomformat"),f=".e-spreadsheet .e-spreadsheetmainpanel ."+n+" {"+t+"}";r||(u.styleSheet?u.styleSheet.cssText+=f:u.appendChild(document.createTextNode(f)));i&&(f=f.replace(".e-spreadsheetmainpanel ",""),u.styleSheet?u.styleSheet.cssText+=f:u.appendChild(document.createTextNode(f)))},_getCssPropertyAsString:function(n){var t="",i,r,u;if("border"in n){i=n.border;for(r in i)n["border-"+r]=i[r];delete n.border}for(u in n)t=t+(u+":"+n[u]+";");return t},_splitBorderCode:function(n){return n=n.split(" "),n[0].replace("px","")+this._getStyleCode("BorderStyle",n[1])+n[2].replace("#","")},_concatBorderCode:function(n){return n.substr(0,1)+"px "+this._getCodeStyle("BorderStyle",n.substr(1,1))+" #"+n.substr(2,6)},_getCodeStyle:function(n,i){n=t.Spreadsheet[n];for(var r in n)if(n.hasOwnProperty(r)&&n[r]===i)return r},_getStyleCode:function(n,i){return i=i||"",t.Spreadsheet[n][i.toLowerCase()]},_getFontCode:function(n){var t=n.replace(/pt|-|\+/g,"");return t.length===2?t:t.length===1?t+"1N":"2N"},_getExtendedFormat:function(t,i,r){var u=this.XLObj.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"formats")||{};return r?(n.extend(i,u),{format:i}):u["text-indent"]&&i["text-align"]?(delete u["text-indent"],delete u["text-align"],n.extend(i,u),{format:i}):(n.extend(u,i),{format:u})},_updateHashCodeClass:function(n,t){var i,r,u=this.XLObj,f={},e=u._formatRegx,o=u._borderRegx;t&&(i=t.indexOf("e-format")>-1,r=t.indexOf("e-border")>-1,i&&(f.format=t.match(e)[0]),r&&(f.border=t.match(o)[0]),(i||r)&&u.XLEdit._updateDataContainer({rowIndex:n.rowIndex,colIndex:n.colIndex},{dataObj:f}))},_updateFormatClass:function(n,t,i){t&&(t.indexOf("e-format")>-1||t.indexOf("e-border")>-1)&&this.XLObj.XLEdit._updateDataContainer(n,{dataObj:i?{border:t}:{format:t}})},_applyBorderCss:function(n,t){var e=this._borderPosition,h=e[0],o=e[1],s=e[2],c=e[3],i=t[0],r=t[1],u=t[2],f=t[3];h in n&&(i?this._updateBorder([i-1,r,i-1,f],n,s,!0):this._updateBorderObj([i,r,i,f],n,h));o in n&&this._updateBorder([i,f,u,f],n,o);s in n&&this._updateBorder([u,r,u,f],n,s);c in n&&(r?this._updateBorder([i,r-1,u,r-1],n,o,!0):this._updateBorderObj([i,r,u,r],n,c))},_applyAllBorderCss:function(n,t){var u=this._borderPosition[1],f=this._borderPosition[2],i=t[0],r=t[1],e=t[2],o=t[3];this._updateBorder(t,n,u+" "+f);i&&this._updateBorder([i-1,r,i-1,o],n,f,!0);r&&this._updateBorder([i,r-1,e,r-1],n,u,!0)},_updateBorderObj:function(n,t,i){for(var r,o,u,f,e=n[0],s=n[2];e<=s;){for(r=n[1],o=n[3];r<=o;)f={rowIndex:e,colIndex:r},u=this._extendBorderObj(f,this._parseBorder(t,i).border,this._isFAT),this.XLObj.XLEdit._updateDataContainer(f,{dataObj:this._isFAT?{tborders:u}:{borders:u}}),r++;e++}},_updateBorder:function(t,i,r,u){var v,tt,p,w,h,c,l,b,k,o,e,d,s,g=!1,nt=!1,f=this._borderPosition,y=t[0],it=t[2],rt=i.isGridBorder,a=this.XLObj;for(delete i.isGridBorder;y<=it;){for(v=t[1],tt=t[3];v<=tt;){if(l={rowIndex:y,colIndex:v},p=y,w=v,u?(nt=r===f[2],nt?p++:w++,o=this._parseBorder(i,nt?f[0]:f[3]).border):o=this._parseBorder(i,r).border,rt?u||(e=this._extendBorderObj(l,i,this._isFAT),g=!0):u?(b={rowIndex:p,colIndex:w},e=this._extendBorderObj(b,o,this._isFAT),a.XLEdit._updateDataContainer(b,{dataObj:this._isFAT?{tborders:e}:{borders:e},skipCell:i.skipCell})):(e=this._extendBorderObj(l,this._parseBorder(i,r).border,this._isFAT),g=!0),g&&a.XLEdit._updateDataContainer(l,{dataObj:this._isFAT?{tborders:e}:{borders:e},skipCell:i.skipCell}),!(u&&a.hasSpan(l))){if(h=l.colIndex,r===f[1]&&u&&h)while(h){if(!a.XLEdit.getPropertyValue(0,h,"isCHide"))break;h--}if(c=l.rowIndex,r===f[2]&&u&&c)while(c){if(!a.XLEdit.getPropertyValue(c,0,"isRHide"))break;c--}s=a.XLEdit.getPropertyValue(c,h,"border");s=s?this.getBorderFromHashCode(s):a.XLEdit.getPropertyValue(c,h,"borders")||{};u?(e={},f[1]in s&&(e[f[3]]=s[f[1]]),f[2]in s&&(e[f[0]]=s[f[2]]),o=this._isFAT?n.extend(o,e):n.extend(e,o)):o=this._isFAT?n.extend(o,s):n.extend(s,o);d=this._parseBorder(o,f[1]+" "+f[2],u);k=this._getBorderHashCode(d.border);this._createFormatClass(d,k);this._updateFormatClass({rowIndex:c,colIndex:h},k,!0)}v++}y++}},_extendBorderObj:function(t,i,r){var f=this.XLObj,u=f.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,r?"tborders":"borders")||{};return n.extend(u,i),u},_getBorderHashCode:function(n,t){var i="",r="1N1N6N",u=this._borderPosition,f=u[0],e=u[1],o=u[2],s=u[3];return i=e in n?this._splitBorderCode(n[e]):r,i+=o in n?this._splitBorderCode(n[o]):r,t&&(i+=f in n?this._splitBorderCode(n[f]):r,i+=s in n?this._splitBorderCode(n[s]):r),"e-border"+i},_parseBorder:function(n,t,i){var r,u,e={border:{}},f=this._borderPosition;for(t=t.split(" "),r=t.length;r--;)u=key=t[r],i&&(u=key===f[1]?f[3]:f[0]),value=n[u],value&&(e.border[key]=value);return e},_refreshTableRowCol:function(n){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()),u=r.tableManager,t=u[n.tid];t&&(n.isInsertBefore?n.pos==="row"?(t.range[0]+=n.cnt,t.range[2]+=n.cnt):(t.range[1]+=n.cnt,t.range[3]+=n.cnt):(n.pos==="row"?t.range[2]=t.range[2]+n.cnt:t.range[3]=t.range[3]+n.cnt,i._dupDetails=!0,i.XLFormat._createTable(n.tid,{format:t.format}),i._dupDetails=!1))},_refreshHiddenBorder:function(n,t,i,r){var c,u,s,e,o,b,k,p,g,nt,h,tt,l,v,d,a,w,y,f=this.XLObj.XLEdit,it=this.XLObj.getSheet().usedRange;if(i?(h="bottom",v="top",tt="isRHide",it=it.colIndex):(h="right",v="left",tt="isCHide",it=it.rowIndex),r){for(p=n,g=t;g++;)if(e=i?g:0,o=i?0:g,!f.getPropertyValue(e,o,tt))break;while(p){if(e=i?p:0,o=i?0:p,!f.getPropertyValue(e,o,tt))break;p--}for(c=0;c<=it;c++)i?(e=p,u=b=n,s=o=k=c):(o=p,u=e=b=c,s=k=n),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),d=f.getPropertyValue(e,o,"borders"),a=f.getPropertyValue(u,s,"borders"),w=f.getPropertyValue(e,o,"tborders"),y=f.getPropertyValue(b,k,"tborders"),(!d||d&&!d[h])&&(a&&a[v]||(!w||w&&!w[h])&&y&&y[v])&&(nt=f.getPropertyValue(e,o,"border"),l=this.getBorderFromHashCode(nt),delete l[h],w&&w[h]&&(l[h]=w[h]),l.bottom||l.right?(nt=this._getBorderHashCode(l),f._updateDataContainer({rowIndex:e,colIndex:o},{dataObj:{border:nt}})):f._clearDataContainer({cellIdx:{rowIndex:e,colIndex:o},property:["border"]})),i?(k=p,u=e=g,s=o=b=c):(b=p,s=o=g,u=e=k=c),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),eCelBrdr=f.getPropertyValue(u,s,"borders"),eTblBrdr=f.getPropertyValue(e,o,"tborders"),(!d||d&&!d[h])&&(eCelBrdr&&eCelBrdr[v]||(!w||w&&!w[h])&&eTblBrdr&&eTblBrdr[v])&&(l={},(d||f.getPropertyValue(k,b,"border"))&&(nt=f.getPropertyValue(k,b,"border"),l=this.getBorderFromHashCode(nt)),l[h]=eCelBrdr&&eCelBrdr[v]?eCelBrdr[v]:eTblBrdr[v],nt=this._getBorderHashCode(l),f._updateDataContainer({rowIndex:k,colIndex:b},{dataObj:{border:nt}}))}else{if(e=i?n-1:0,o=i?0:n-1,f.getPropertyValue(e,o,tt)){for(p=n-1;p;){if(e=i?p:0,o=i?0:p,!f.getPropertyValue(e,o,tt))break;p--}for(c=0;c<=it;c++)i?(e=p,s=o=k=c,u=b=n-1):(o=p,u=e=b=c,s=k=n-1),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),d=f.getPropertyValue(e,o,"borders"),a=f.getPropertyValue(u,s,"borders"),w=f.getPropertyValue(e,o,"tborders"),y=f.getPropertyValue(b,k,"tborders"),l=this.getBorderFromHashCode(f.getPropertyValue(e,o,"border")),(!d||d&&!d[h]||d&&d[h]!==(l&&l[h]))&&(!w||w&&!w[h]||w&&w[h]&&(f.getPropertyValue(e,o,"border")!==this._getBorderHashCode(w)||a&&a[v]))&&(a&&a[v]||l&&l[h]&&(!a||a&&!a[v])||y&&y[v])&&(e=i?u:s,o=i?s:u,this._showHiddenBorder(p,e,o,c,i));for(c=0;c<=it;c++)i?(e=u-1,u=b=n,s=k=o=c):(o=s-1,u=e=b=c,s=k=n),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),a=f.getPropertyValue(e,o,"borders"),eCelBrdr=f.getPropertyValue(u,s,"borders"),y=f.getPropertyValue(e,o,"tborders"),eTblBrdr=f.getPropertyValue(b,k,"tborders"),l=this.getBorderFromHashCode(f.getPropertyValue(e,o,"border")),(!a||a&&!a[h]||a&&a[h]!==(l&&l[h]))&&(!y||y&&!y[h]||y&&y[h]&&f.getPropertyValue(b,k,"border")!==this._getBorderHashCode(y))&&(eCelBrdr&&eCelBrdr[v]||l&&l[h]&&(!eCelBrdr||eCelBrdr&&!eCelBrdr[v])||eTblBrdr&&eTblBrdr[v])&&(e=i?u:s,o=i?s:u,this._showHiddenBorder(n-1,e,o,c,i))}for(n;n<t;n++)if(g=n+1,i?(e=g,o=s=0,u=n):(o=g,e=u=0,s=n),f.getPropertyValue(e,o,tt)||f.getPropertyValue(u,s,tt))for(c=0;c<=it;c++)i?(u=g,s=o=c,e=n):(u=e=c,s=g,o=n),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),a=f.getPropertyValue(e,o,"borders"),eCelBrdr=f.getPropertyValue(u,s,"borders"),y=f.getPropertyValue(e,o,"tborders"),eTblBrdr=f.getPropertyValue(u,s,"tborders"),l=this.getBorderFromHashCode(f.getPropertyValue(e,o,"border")),(!a||a&&!a[h]||a&&a[h]!==(l&&l[h]))&&(!y||y&&!y[h]||y&&y[h]&&(f.getPropertyValue(e,o,"border")!==this._getBorderHashCode(y)||eCelBrdr&&eCelBrdr[v]))&&(eCelBrdr&&eCelBrdr[v]||l&&l[h]&&(!eCelBrdr||eCelBrdr&&!eCelBrdr[v])||eTblBrdr&&eTblBrdr[v])&&(u=i?s:u,this._showHiddenBorder(n,g,u,c,i))}},_showHiddenBorder:function(n,t,i,r,u){var c,l,a,v,y,p,f,w,e,b,k,d,s,h,o=this.XLObj.XLEdit;u?(a=t,p=r,l=v=i,c=y=n,f="bottom",h="top"):(v=t,y=r,c=a=i,l=p=n,f="right",h="left");w=o.getPropertyValue(c,l,"border");e=this.getBorderFromHashCode(w);e[f]&&delete e[f];s=o.getPropertyValue(c,l,"tborders");k=o.getPropertyValue(a,v,"borders");d=o.getPropertyValue(a,v,"tborders");b=o.getPropertyValue(y,p,"borders");b&&b[f]?e[f]=b[f]:k&&k[h]?e[f]=k[h]:(s&&s[f]||d&&d[h])&&(e[f]=s&&s[f]?s[f]:d[h]);e.bottom||e.right?(w=this._getBorderHashCode(e),o._updateDataContainer({rowIndex:y,colIndex:p},{dataObj:{border:w}})):o._clearDataContainer({cellIdx:{rowIndex:c,colIndex:l},property:["border"]})},_resizeFormatTableMenu:function(){var t=this.XLObj,i=document.getElementById(t._id+"_formatastable");t._tabMode||t._phoneMode?(n("#"+t._id+"_Ribbon").append(n("#"+t._id+"_formatastable").parent()),t._removeClass(i,"e-formatastable"),t.addClass(i,"e-formatastable-adaptive"),i.style.height=t._dlgHeight+"px"):(t._removeClass(i,"e-formatastable-adaptive"),t.addClass(i,"e-formatastable"))},_resizeStyleMenu:function(){var t=this.XLObj,i=document.getElementById(t._id+"_cellstyles");t._tabMode||t._phoneMode?(n("#"+t._id+"_Ribbon").append(n("#"+t._id+"_cellstyles").parent()),t._removeClass(i,"e-cellstyles"),t.addClass(i,"e-cellstyles-adaptive"),i.style.height=t._dlgHeight+"px"):(t._removeClass(i,"e-cellstyles-adaptive"),t.addClass(i,"e-cellstyles"),i.style.height="auto")},_resizeBorderMenu:function(t){var i=this.XLObj,r=i.element.find(".e-bordercontainer"),u;i._phoneMode&&(n("#"+i._id+"_Ribbon").append(n("#"+i._id+"_Ribbon_Border").parent()),r.length?r.show():(this._createBorderDiv(),i.element.find(".e-bordercontainer").show()),i.addClass(r[0],"e-border e-adaptive"),t.cancel=!0,u=n("#"+i._id+"_Ribbon_Home_Font_Border").ejSplitButton("instance"),u.contstatus=!0)},_createBorderDiv:function(){for(var i=this.XLObj,f="<div class='e-ss-bdr-header'><span id ='"+i._id+"_border_back' class = 'e-border-back e-icon e-ss-leftarrow'/><\/div><div class='e-ss-border-content'>",e="",o=t.buildTag("div#"+i._id+"_bordercontainer.e-bordercontainer",{},{display:"none",height:i._responsiveHeight-2}),u=i.XLRibbon._borderMenuData,r=0;r<13;r++)e+="<div class = 'e-bordercell' id="+u[r].id+">"+i._renderDIV("e-ss-border "+u[r].sprite+" e-ss-menu","",u[r].text)+"<\/div>";f+=e+"<\/div>";o.append(n(f));n("#"+i._id+"_Ribbon").append(o);i._on(n("#"+i._id+"_bordercontainer"),"click",i._borderSelectionClick)}};t.Spreadsheet.FontFamily={"angsana new":"11N",arial:"21N","arial black":"31N",batang:"41N","book antiqua":"51N","browallia new":"61N",calibri:"71N",cambria:"81N",candara:"91N",century:"10","comic sans ms":"11",consolas:"12",constantia:"13",corbel:"14","cordia new":"15",courier:"16","courier new":"17",dilleniaupc:"18",dotum:"19",fangsong:"20",garamond:"21",georgia:"22",gulim:"23",gungsuh:"24",kaiti:"25",jasmineupc:"26","malgun gothic":"27",mangal:"28",meiryo:"29","microsoft jhenghei":"30","microsoft yahei":"31",mingliu:"32",mingliu_hkscs:"33","ms gothic":"34","ms mincho":"35","ms pgothic":"36","ms pmincho":"37",pmingliu:"38","pmingliu-extb":"39",simhei:"40",simsun:"41","simsun-extb":"42",tahoma:"43",times:"44","times new roman":"45","trebuchet ms":"46",verdana:"47","yu gothic":"48","yu mincho":"49"};t.Spreadsheet.FontStyle={normal:"1",italic:"2",oblique:"3"};t.Spreadsheet.TextAlign={left:"1",right:"2",center:"3",justify:"4"};t.Spreadsheet.VerticalAlign={top:"1",middle:"2",bottom:"3"};t.Spreadsheet.TextDecoration={none:"1",underline:"2",overline:"3","line-through":"4","line-through underline":"5"};t.Spreadsheet.FontWeight={normal:"1",bold:"2"};t.Spreadsheet.BorderStyle={solid:"1",dashed:"2",dotted:"3"};t.Spreadsheet.CellFormat={number:"{0:N2}",currency:"{0:C2}",accounting:"{0:C2}",percentage:"{0:P2}",shortdate:"{0:M/d/yyyy}",longdate:"{0:dddd, MMMM dd, yyyy}",time:"{0:h:mm:ss tt}",scientific:"{0:N2}"}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cFormat=function(n){this.XLObj=n};t.spreadsheetFeatures.cFormat.prototype={getCFRule:function(n,t){var u=this.XLObj,h=u.getActiveSheetIndex(),f=u.XLEdit.getPropertyValue(n,t,["cFormatRule"]),e=[],s=u._dataContainer.cFormatData,i,r,o;if(f)for(r=0,o=f.length;r<o;r++)i=s[f[r]].split("_"),e.push({action:i[0],inputs:[i[2],i[3]],color:i[4],range:i[5],isApplied:JSON.parse(i[7])});return e},setCFRule:function(n){var t=this.XLObj,i,r;t.model.isReadOnly||t.model.allowConditionalFormats&&(i=n.inputs[0],r=n.inputs[1],this._cFormat(n.action,i,r,n.color,n.range,t.getActiveSheetIndex()))},_updateCFormatRule:function(n,t){return n.indexOf("true")>-1?n.replace("true",t):n.replace("false",t)},_getRuleIndex:function(n,i){if(t.isNullOrUndefined(i))return-1;for(var r=0,u=i.length;r<u;r++)if(i[r]===n)return r;return-1},_refreshCFormatFormula:function(n,t,i){var u=this.XLObj,f=u.getSheet(i)._cFormatFormula,r,e;u.isUndefined(f[n])||u.isUndefined(f[n][t])||(r=f[n][t][0].Formula,this._applyFormulaValues(r.referCell,r.cFColor,"formularule",r.addr,i,e,r.applyCell))},_applyFormulaValues:function(n,i,r,u,f,e,o,s,h){var c=this.XLObj,v,l,b,y,st,ht,ut=c.getSheet(f),p,k,d,tt,g,ct=!0,lt=-1,ft,a=[],it,w,nt,et,ot,o,n,rt;if(v=t.isNullOrUndefined(e)&&t.isNullOrUndefined(u)?ut._selectedCells:t.isNullOrUndefined(u)?c._getMultiRangeCells(e):c._getMultiRangeCells(u),u=c._getAlphaRange(f,v[0].rowIndex,v[0].colIndex,v[v.length-1].rowIndex,v[v.length-1].colIndex),c.isUndefined(r))w=c._calcEngine,rt=new ValueChangedArgs(-1,-1,n),w.valueChanged(ut.sheetInfo.value,rt),n=w.getFormulaInfoTable().getItem("!"+(f-1)+"!-1").getFormulaValue()==="TRUE"?!0:!1,g=c._isBool(n)?n:!1,tt="formularule_"+r+"_"+n+"__"+i+"_"+u+"_"+c.getActiveSheetIndex(),this._applyCFormatRule({rowIndex:o.rowIndex,colIndex:o.colIndex},tt,lt,g,ct,i);else{if(d=["<=",">=","<",">","="],n.startsWith("=")&&(n=n.substr(1)),n.indexOf("==")>-1)return c._showAlertDlg("Alert","NewRuleAlert","",430),!0;for(l=0,y=d.length;l<y;l++)n.indexOf(d[l])>-1&&(a=n.split(d[l]),it=d[l]);if(a.length||(a[0]=n),st=a.slice(),s==="paste"){for(n="",l=0,y=a.length;l<y;l++)c._isvalidRange(a[l]+":"+a[l])&&(o=c._getMultiRangeCells(a[l]),et=e[0]-h.rowIndex,ot=e[1]-h.colIndex,a[l]=c._getAlphaRange(f,o[0].rowIndex+et,o[0].colIndex+ot,o[0].rowIndex+et,o[0].colIndex+ot));n=y===2?a[0]+it+a[1]:a[0]}for(ht=this._formulaCellRefer(a,v),l=0,y=v.length;l<y;l++){for(p=v[l].rowIndex,k=v[l].colIndex,nt=this._formulaCellRange({rowIndex:p,colIndex:k},ht,st,it,f),formula=nt.formula,w=c._calcEngine,rt=new ValueChangedArgs(-1,-1,formula),w.valueChanged(ut.sheetInfo.value,rt),ft=w.getFormulaInfoTable().getItem("!"+(f-1)+"!-1").getFormulaValue()==="TRUE"?!0:!1,g=c._isBool(ft)?ft:!1,tt="formularule_"+it+"_"+n+"/"+formula+"__"+i+"_"+u+"_"+c.getActiveSheetIndex(),b=0;b<c.getObjectLength(nt)-1;b++)this._formulaCellUpdate({rowIndex:nt["referCell"+b].rowIndex,colIndex:nt["referCell"+b].colIndex},{rowIndex:p,colIndex:k},n,formula,u,i,f);this._applyCFormatRule({rowIndex:p,colIndex:k},tt,lt,g,ct,i);!g&&c._isRowViewable(f,p)&&c.getCell(p,k,f).removeClass("e-redft e-yellowft e-greenft e-redf e-redt")}}},_formulaCellUpdate:function(n,t,i,r,u,f,e){var l=this.XLObj,h=l.getSheet(e)._cFormatFormula,o,c=n.rowIndex,s=n.colIndex;c in h?(o=h[c],s in o?o[s].push({Formula:{applyCell:t,formula:i,referCell:r,addr:u,cFColor:f}}):(o[s]=[],o[s].push({Formula:{applyCell:t,formula:i,referCell:r,addr:u,cFColor:f}}))):(o=h[c]={},o[s]=[],o[s].push({Formula:{applyCell:t,formula:i,referCell:r,addr:u,cFColor:f}}))},_formulaCellRange:function(n,t,i,r,u){for(var e=this.XLObj,y=0,c,l=[],p=0,w=e.getObjectLength(t),o,s,h,a={},v={},f=0;f<w;f++)e._isObject(t["range"+f])?(s=n.rowIndex+t["range"+f].rowIndex,h=n.colIndex+t["range"+f].colIndex,a["range"+f]=e._getAlphaRange(u,s,h,s,h)):(s=n.rowIndex,h=n.colIndex,a["range"+f]=t["range"+f]),v["referCell"+f]={rowIndex:s,colIndex:h};for(c=0;c<i.length;c++){for(o=e.XLDragFill._parseFormula("="+i[c]),f=0,len=o.length;f<len;f++)e._isvalidRange(o[f]+":"+o[f])&&(o[f]=a["range"+y],y++);l[p]=o.join("");p++}return formula=e.isUndefined(r)?"="+l[0]:"="+l[0]+r+l[1],v.formula=formula,v},_formulaCellRefer:function(n,t){for(var u=this.XLObj,i,c=0,e,l=[],r,a,o,s,v={},h,f=0;f<n.length;f++)if(u.isFormula("="+n[f]))for(e=u.XLDragFill._parseFormula(n[f]),i=0,len=e.length;i<len;i++)u._isvalidRange(e[i]+":"+e[i])&&(l[c]=e[i],c++);else l[c]=n[f],c++;for(n=l,i=0;i<n.length;i++){if(r=n[i].startsWith("=")?n[i].split("=")[1]:n[i],a=r.split("$").length,u._isvalidRange(n[i]+":"+n[i])){u._isvalidRange(r+":"+r)&&(r.indexOf("$")<0?h="RCRefer":r.startsWith("$")&&a===3?h="CellRefer":r.startsWith("$")&&a===2?h="RRefer":!r.startsWith("$")&&r.indexOf("$")>-1&&(h="CRefer"));n[i].indexOf("$")>-1&&(n[i]=n[i].split("$").join(""));formulaCell=u._getMultiRangeCells(n[i]);switch(h){case"RCRefer":o=formulaCell[0].rowIndex-t[0].rowIndex;s=formulaCell[0].colIndex-t[0].colIndex;break;case"RRefer":o=formulaCell[0].rowIndex-t[0].rowIndex;s=formulaCell[0].colIndex;break;case"CRefer":o=formulaCell[0].rowIndex;s=formulaCell[0].colIndex-t[0].colIndex;break;case"CellRefer":o=formulaCell[0].rowIndex;s=formulaCell[0].colIndex}n[i]={rowIndex:o,colIndex:s}}v["range"+i]=n[i]}return v},_clearCFormula:function(n,t,i){var u=this.XLObj,e=[],h=[],c=0,s,r,o,a=u.XLEdit.getPropertyValue(n,t,"cFormatRule"),f,l;if(sheetData=u.getSheet(i)._cFormatFormula,a&&a[0].split("_")[0]==="formularule"&&(input=a[0].split("_")[2].split("/")[1],input.startsWith("=")&&(input=input.substr(1)),u.isFormula("="+input))){for(l=["<=",">=","<",">","="],r=0,o=l.length;r<o;r++)input.indexOf(l[r])>-1&&(e=input.split(l[r]));for(e.length||(e[0]=input),r=0,o=e.length;r<o;r++)if(u.isFormula("="+e[r]))for(s=u.XLDragFill._parseFormula(e[r]),j=0;j<s.length;j++)u._isvalidRange(s[j]+":"+s[j])&&(h[c]=s[j],c++);else h[c]=e[r],c++;for(r=0,o=h.length;r<o;r++)f=u._getMultiRangeCells(h[r])[0],u.isUndefined(sheetData[f.rowIndex])||(u.isUndefined(sheetData[f.rowIndex][f.colIndex])||delete sheetData[f.rowIndex][f.colIndex],u.getObjectLength(sheetData[f.rowIndex])||delete sheetData[f.rowIndex])}},_cFormat:function(n,i,r,u,f,e,o,s,h){var c=this.XLObj,y,l;if(c.model.allowConditionalFormats){c.showWaitingPopUp();e=e?e:c.getActiveSheetIndex();t.isNullOrUndefined(n)&&(n="lessthan");var a=c.getSheet(e),p=o?c._getRangeArgs(o,"object"):c._getRangeArgs(f,"object"),v={cFAction:n,input1:i,input2:r,cFColor:u,sheetIndex:e,reqType:"cond-format",action:"add",range:f,data:p};switch(n){case"greaterthan":this._applyGLEValues(">",i,u,n,f,e,o);break;case"greaterequalto":this._applyGLEValues(">=",i,u,n,f,e,o);break;case"lessthan":this._applyGLEValues("<",i,u,n,f,e,o);break;case"lessequalto":this._applyGLEValues("<=",i,u,n,f,e,o);break;case"equalto":this._applyGLEValues("==",i,u,n,f,e,o);break;case"notequalto":this._applyGLEValues("!=",i,u,n,f,e,o);break;case"between":this._applyBetweenValues("=",i,r,u,n,f,e,o);break;case"notbetween":this._applyBetweenValues("!",i,r,u,n,f,e,o);break;case"textcontains":this._applyContainsValues(i,u,n,f,e,o);break;case"dateoccur":this._applyDateContainsValues(i,u,n,f,e,o);break;case"formularule":i.indexOf("/")>-1&&(i=i.split("/")[1]);l=this._applyFormulaValues(i,u,n,f,e,o,y,s,h)}a._isImported&&!a._isLoaded||c._isUndoRedo||s==="paste"||c._dupDetails||c._isExport||l||(c._completeAction(v),c._trigActionComplete(v));c.hideWaitingPopUp()}},clearCF:function(n){var i=this.XLObj,o,a,h,s,c;if(!i.model.isReadOnly){var r=i.getActiveSheetIndex(),u,f,e={sheetIndex:r,reqType:"cond-format",action:"clear",rule:[]},l=i.getSheet(r);if(i.model.allowConditionalFormats){for(h=i._dataContainer.cFormatData,e.selection=!i.isUndefined(n),n=n?i._getRangeArgs(n,"object"):[0,0,l.rowCount-1,l.colCount-1],s=i._getSelectedCells(r,n).selCells,o=0,a=s.length;o<a;o++)u=s[o].rowIndex,f=s[o].colIndex,t.isNullOrUndefined(i._dataContainer.sheets[r][u])||t.isNullOrUndefined(i._dataContainer.sheets[r][u][f])||t.isNullOrUndefined(i._dataContainer.sheets[r][u][f].cFormatRule)||(e.rule.push(this.getCFRule(u,f)),this._clearCFormula(u,f,r),i.clearRangeData([u,f,u,f],["cFormatRule"]));c=e.selection?"clear_"+r+"_"+i._getSelectedItems()[1]:"clear_"+r+"_entire";h.indexOf(c)===-1&&h.push(c);i._isUndoRedo||i._dupDetails||(i._completeAction(e),i._trigActionComplete(e))}}},_getValueForCFormat:function(n,t){var u=this.XLObj,i=n.rowIndex,r=n.colIndex,o=u.getRangeData({range:[i,r,i,r],sheetIdx:t}),f=u.XLEdit.getPropertyValue(i,r),e=u.XLEdit.getPropertyValue(i,r,"value2");return f=f?f.toString():"",(e&&typeof e=="string"&&!o.formatStr&&f[0]==="="||u.XLEdit.getPropertyValue(i,r,"type")==="datetime"||u.XLEdit.getPropertyValue(i,r,"type")==="shortdate"||u.XLEdit.getPropertyValue(i,r,"type")==="longdate"||u.XLEdit.getPropertyValue(i,r,"type")==="time")&&(f=e),f},_applyGLEValues:function(i,r,u,f,e,o,s){var h=this.XLObj,c,k,v,y,l,ft,rt,et,nt,tt=new RegExp(/[^.0-9]+/g),vt=new RegExp(/[^.-a-zA-Z 0-9]+/g),ot=h.getSheet(o),st=ot._startCell,ht=ot._endCell,d,p=r,w,ct,b=[],lt,g,a,it,ut,at;if(rangeData=s?h._getRangeArgs(s,"object"):h._getRangeArgs(e,"object"),k=h._getSelectedCells(o,rangeData).selCells,p.startsWith("=")){for(p=p.substr(1),g=["<=",">=","<",">","="],a=0,it=g.length;a<it;a++)p.indexOf(g[a])>-1&&(b=b.split(g[a]),lt=g[a]);b.length||(b[0]=p);ct=this._formulaCellRefer(b,k)}for(a=0,it=k.length;a<it;a++)if(v=k[a].rowIndex,y=k[a].colIndex,r.startsWith("=")&&(ut=h._calcEngine,w=this._formulaCellRange({rowIndex:v,colIndex:y},ct,b,lt,o),at=new ValueChangedArgs(-1,-1,w.formula),ut.valueChanged(h.getSheet(o).sheetInfo.value,at),r=ut.getFormulaInfoTable().getItem("!0!-1").getFormulaValue(),l=h._isBool(r)?r==="TRUE"?!0:!1:!1,t.isNullOrUndefined(r)&&(r="0")),!h.XLEdit.getPropertyValue(v,y,"isMHide")&&!h.XLEdit.getPropertyValue(v,y,"isFilterHide")){if(c=this._getValueForCFormat({rowIndex:v,colIndex:y},o),nt=h.XLEdit.getPropertyValue(v,y,"type")?h.XLEdit.getPropertyValue(v,y,"type"):"general",ft=!0,et=-1,t.isNullOrUndefined(c)||!c.length)n.isNumeric(r)&&(l=r>0?f==="lessthan"||f==="lessequalto"||f==="notequalto":r<0?f==="greaterthan"||f==="greaterequalto"||f==="notequalto":f==="equalto"||f==="lessequalto"||f==="greaterequalto");else if(n.isNumeric(r))if(n.isNumeric(c))c=parseFloat(c),l=h.operators[i](c,parseFloat(r.replace(vt,"")));else if(h._isValidDate(c))l=h.operators[i](h._dateToInt(c),parseFloat(r));else if(h._isValidTime(c))continue;else l=h.operators[i](c.toLowerCase(),r.toLowerCase());else r.lastIndexOf("%")===r.length-1&&n.isNumeric(r.replace(tt,""))?l=nt==="percentage"?h.operators[i](parseFloat(c),parseFloat(r.replace(tt,""))):n.isNumeric(c)?h.operators[i](parseFloat(c),0):h.operators[i](c.length,0):r.indexOf("$")===0&&n.isNumeric(r.replace(tt,""))?l=nt==="accounting"||nt!=="currency"||n.isNumeric(c)?h.operators[i](parseFloat(c),parseFloat(r.replace(tt,""))):(h.operators[i](c.length,0)||h._isValidDate(c))&&!h._isValidTime(c):h._isValidDate(r)?h._isValidDate(c)?l=h.operators[i](h._dateToInt(new Date(c)),h._dateToInt(new Date(r))):h._isValidTime(c)||(l=n.isNumeric(c)?h.operators[i](parseFloat(c),h._dateToInt(r)):h.operators[i](c.length,h._dateToInt(r))):l=h._isValidTime(r)?h._isValidTime(c)?h.operators[i](h.parse.parseTime(c),h.parse.parseTime(r)):n.isNumeric(c)?h.operators[i](parseFloat(c),0):h.operators[i](c.length,0):h.operators[i](c.toLowerCase(),r.toLowerCase());if(t.isNullOrUndefined(e)&&(e=h._generateHeaderText(st.colIndex+1)+(st.rowIndex+1)+":"+h._generateHeaderText(ht.colIndex+1)+(ht.rowIndex+1)),rt=f+"_"+i+"_"+r+"__"+u+"_"+e+"_"+h.getActiveSheetIndex(),p.startsWith("="))for(r=p.substr(1),rt=f+"_"+i+"_"+r+"__"+u+"_"+e+"_"+h.getActiveSheetIndex(),d=0;d<h.getObjectLength(w)-1;d++)this._formulaCellUpdate({rowIndex:w["referCell"+d].rowIndex,colIndex:w["referCell"+d].colIndex},{rowIndex:v,colIndex:y},r,w.formula,e,u,o);this._applyCFormatRule({rowIndex:v,colIndex:y},rt,et,l,ft,u)}},_applyBetweenValues:function(i,r,u,f,e,o,s,h){var c=this.XLObj,l,w,k,a,d,g,nt,y,v=new RegExp(/[^.0-9]+/g),b=new RegExp(/[^.-a-zA-Z 0-9]+/g),et,tt=c.getSheet(s),it=tt._startCell,rt=tt._endCell,p,ut;for(c.operators["<"](c.isNumber(r)?parseFloat(r):r,c.isNumber(u)?parseFloat(u):u)||(k=u,u=r,r=k),w=t.isNullOrUndefined(h)&&t.isNullOrUndefined(o)?c.getSheet(s)._selectedCells:c._getSelectedCells(s,o).selCells,p=0,ut=w.length;p<ut;p++)if(rowIdx=w[p].rowIndex,colIdx=w[p].colIndex,!c.XLEdit.getPropertyValue(rowIdx,colIdx,"isMHide")&&!c.XLEdit.getPropertyValue(rowIdx,colIdx,"isFilterHide")){if(l=this._getValueForCFormat({rowIndex:rowIdx,colIndex:colIdx},s),y=c.XLEdit.getPropertyValue(rowIdx,colIdx,"type")?c.XLEdit.getPropertyValue(rowIdx,colIdx,"type"):"general",d=!0,nt=-1,t.isNullOrUndefined(l)||!l.length)n.isNumeric(r)&&n.isNumeric(u)&&(a=r>0&&u>0||r<0&&u<0?e==="notbetween":e==="between");else if(n.isNumeric(r.replace(b,""))&&n.isNumeric(u.replace(b,""))&&y!=="percentage"&&y!=="currency"&&y!=="accounting")if(r=r.replace(b,""),u=u.replace(b,""),n.isNumeric(l))a=c.operators[i](parseFloat(l)>=parseFloat(r)&&parseFloat(l)<=parseFloat(u));else if(c._isValidDate(l))a=c.operators[i](c._dateToInt(l)>=parseFloat(r)&&et<=parseFloat(u));else if(c._isValidTime(l))continue;else a=c.operators[i](l.toLowerCase()>=r.toLowerCase()&&l.toLowerCase()<=u.toLowerCase());else if(r.lastIndexOf("%")===r.length-1&&n.isNumeric(r.replace(v,""))&&u.lastIndexOf("%")===u.length-1&&n.isNumeric(u.replace(v,""))&&y==="percentage")a=c.operators[i](parseFloat(l)>=parseFloat(r.replace(v,""))&&parseFloat(l)<=parseFloat(u.replace(v,"")));else if(r.indexOf("$")===0&&n.isNumeric(r.replace(v,""))&&u.indexOf("$")===0&&n.isNumeric(u.replace(v,""))&&(y==="accounting"||y!=="currency"))a=c.operators[i](parseFloat(l)>=parseFloat(r.replace(v,""))&&parseFloat(l)<=parseFloat(u.replace(v,"")));else if(c._isValidDate(r)&&c._isValidDate(u)){var ft=c._dateToInt(new Date(l)),ot=c._dateToInt(new Date(r)),st=c._dateToInt(new Date(u));a=c.operators[i](ft>=ot&&ft<=st)}else a=c._isValidTime(r)&&c._isValidTime(u)&&c._isValidTime(l)?c.operators[i](c.parse.parseTime(l)>=c.parse.parseTime(r)&&c.parse.parseTime(l)<=c.parse.parseTime(u)):n.isNumeric(l)?c.operators[i](parseFloat(l)>=parseFloat(r)&&parseFloat(l)<=parseFloat(u)):c.operators[i](l.toLowerCase()>=r.toLowerCase()&&l.toLowerCase()<=u.toLowerCase());t.isNullOrUndefined(o)&&(o=c._generateHeaderText(it.colIndex+1)+(it.rowIndex+1)+":"+c._generateHeaderText(rt.colIndex+1)+(rt.rowIndex+1));g=e+"_"+i+"_"+r+"_"+u+"_"+f+"_"+o+"_"+c.getActiveSheetIndex();this._applyCFormatRule({rowIndex:rowIdx,colIndex:colIdx},g,nt,a,d,f)}},_applyContainsValues:function(i,r,u,f,e,o){var s=this.XLObj,h,a,c,v,y,p,w=new RegExp(/[^.-a-zA-Z 0-9]+/g),b=s.getSheet(e),k=b._startCell,d=b._endCell,l,g;for(a=t.isNullOrUndefined(o)&&t.isNullOrUndefined(f)?s.getSheet(e)._selectedCells:s._getSelectedCells(e,f).selCells,l=0,g=a.length;l<g;l++)(rowIdx=a[l].rowIndex,colIdx=a[l].colIndex,s.XLEdit.getPropertyValue(rowIdx,colIdx,"isMHide")||s.XLEdit.getPropertyValue(rowIdx,colIdx,"isFilterHide"))||(h=this._getValueForCFormat({rowIndex:rowIdx,colIndex:colIdx},e),type=s.XLEdit.getPropertyValue(rowIdx,colIdx,"type")?s.XLEdit.getPropertyValue(rowIdx,colIdx,"type"):"general",v=!0,p=-1,t.isNullOrUndefined(h)||!h.length?c=!1:n.isNumeric(i.replace(w,""))?(i=i.replace(w,""),s._isValidDate(h)&&(h=s._dateToInt(h).toString()),c=h.indexOf(i)>-1):s._isValidDate(i)?(s._isValidDate(h)&&(h=s._dateToInt(h).toString()),c=h.indexOf(s._dateToInt(i))>-1):s._isValidTime(i)?(s._isValidTime(h)&&(h=s._dateToInt("01/01/1990 "+h).toString()),c=h.indexOf(s._dateToInt("01/01/1990 "+i))>-1):c=h.toLowerCase().indexOf(i.toLowerCase())>-1,t.isNullOrUndefined(f)&&(f=s._generateHeaderText(k.colIndex+1)+(k.rowIndex+1)+":"+s._generateHeaderText(d.colIndex+1)+(d.rowIndex+1)),y=u+"__"+i+"__"+r+"_"+f+"_"+s.getActiveSheetIndex(),this._applyCFormatRule({rowIndex:rowIdx,colIndex:colIdx},y,p,c,v,r))},_applyDateContainsValues:function(n,i,r,u,f,e){var o=this.XLObj,h,l=!1,a,v,y=o.getSheet(f),p=y._startCell,w=y._endCell,c,s,b,k,d;for(c=t.isNullOrUndefined(e)&&t.isNullOrUndefined(u)?o.getSheet(f)._selectedCells:o._getSelectedCells(f,u).selCells,s=0,b=c.length;s<b;s++)(rowIdx=c[s].rowIndex,colIdx=c[s].colIndex,o.XLEdit.getPropertyValue(rowIdx,colIdx,"isMHide")||o.XLEdit.getPropertyValue(rowIdx,colIdx,"isFilterHide"))||(h=this._getValueForCFormat({rowIndex:rowIdx,colIndex:colIdx},f),v=-1,t.isNullOrUndefined(h)||!h.length?l=!1:o._isValidDate(n)&&(k=new Date(h),d=new Date(n),l=k-d==0),t.isNullOrUndefined(u)&&(u=o._generateHeaderText(p.colIndex+1)+(p.rowIndex+1)+":"+o._generateHeaderText(w.colIndex+1)+(w.rowIndex+1)),a=r+"__"+n+"__"+i+"_"+u+"_"+o.getActiveSheetIndex(),this._applyCFormatRule({rowIndex:rowIdx,colIndex:colIdx},a,v,l,!0,i))},refreshCFormat:function(n){var t=this.XLObj,v=t._dupDetails,u,i,o,c,f,s,r,a,l,e,h;if(!t.model.isReadOnly&&(t._dupDetails=!0,t.model.allowConditionalFormats)){for(o=[],c=t.getActiveSheetIndex(),s=t._getSelectedCells(c,n).selCells,u=0,a=s.length;u<a;u++){if(e=s[u].rowIndex,h=s[u].colIndex,r=t.XLEdit.getPropertyValue(e,h,"cFormatRule"),!t.isUndefined(r)&&r.length)for(i=0,l=r.length;i<l;i++)r[i]=r[i].replace("_true","").replace("_false",""),o.indexOf(r[i])<0&&o.push(r[i]);t._isRowViewable(c,e)&&t.getCell(e,h,c).removeClass("e-redft e-yellowft e-greenft e-redf e-redt");t.clearRangeData([e,h,e,h],["cFormatRule"],s[u])}for(i=0,l=o.length;i<l;i++)f=o[i].split("_"),this._cFormat(f[0],f[2],f[3],f[4],f[5]);t._dupDetails=v}},_applyCFormatRule:function(n,t,i,r,u,f){var o=this.XLObj,a=o.getActiveSheetIndex(),s=n.rowIndex,h=n.colIndex,v,y,e=o.XLEdit.getPropertyValue(s,h,"cFormatRule"),c,p,b=!0,l,k;if(this._getRuleIndex(t+"_true",e)>-1&&(i=this._getRuleIndex(t+"_true",e)),this._getRuleIndex(t+"_false",e)>-1&&(i=this._getRuleIndex(t+"_false",e)),i>-1&&(c=e[i],p=o._dataContainer.cFormatData.indexOf(this._updateCFormatRule(c,r)),p>-1?o._dataContainer.sheets[a][s][h].cFormatRule[i]=p:(o._dataContainer.cFormatData.push(this._updateCFormatRule(c,r)),o._dataContainer.sheets[a][s][h].cFormatRule[i]=o._dataContainer.cFormatData.length-1)),e=o.XLEdit.getPropertyValue(s,h,"cFormatRule"),o._isRowViewable(a,s)&&(v=!0,y=o.getCell(s,h)),!o.isUndefined(e)&&e.length>0&&(!(t+"_true"===e[i]||t+"_false"===e[i])||e.length>1)){for(l=0,k=e.length;l<k;l++)c=e[l].split("_");v&&r&&y.removeClass("e-redft e-yellowft e-greenft e-redf e-redt").addClass("e-"+f)}else v&&r&&y.removeClass("e-redft e-yellowft e-greenft e-redf e-redt").addClass("e-"+f);if(e&&e.length){var d=o.getRangeIndices(t.split("_")[5]),g=o.getRangeIndices(e[0].split("_")[5]),w=t.split("_");w.splice(6,1);w.splice(5,1);e[0].indexOf(w.join("_"))>-1&&o.inRange(g,d[0],d[1])&&(b=!1)}b&&this._getRuleIndex(t+"_true",e)<0&&this._getRuleIndex(t+"_false",e)<0&&o.XLEdit._updateDataContainer(n,{dataObj:{cFormatRule:[t+"_"+r]},skipCell:!r})}}}(jQuery,Syncfusion),function(n,t,i){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.clipboard=function(n){this.XLObj=n;this._cutCells=[];this._copyCells=[];this._copyBackup={};this._cData="";this._isCut=!1;this._copyRange=[];this._isSpecial=!n.isPasteValuesOnly;this._isShape=!1};t.spreadsheetFeatures.clipboard.prototype={copy:function(){this._triggerKeyDown(67,!0)},cut:function(){this.XLObj.model.isReadOnly||this._triggerKeyDown(88,!0)},paste:function(){this.XLObj.model.isReadOnly||this._triggerKeyDown(86,!0)},_initCopyPaste:function(){var i=this.XLObj._id,r=t.buildTag("div",{},{position:"fixed",top:-1e3,left:-1e3},{id:i+"_copyPaste"});n("body").append(r);r.append(t.buildTag("textarea ."+i+"_copyTxt",{},{width:1,height:1,overflow:"hidden",opacity:0,resize:"none",cursor:"default"},{id:i+"_hiddenTxt"}))},_copyPasteHandler:function(t){var u,i=this.XLObj,f=i.getActiveSheetIndex(),r=i.getSheet(f);if(i._isUndoRedo=!1,!i.model.allowEditing&&(t.keyCode===88||t.keyCode===86))return!1;if((t.keyCode===67||t.keyCode===88||t.keyCode===86)&&i._preventctrlkey){i._showAlertDlg("Alert","CtrlKeyErrorAlert","CtrlKeyErrorAction",450);return}if(t.ctrlKey){if(t.keyCode===67)this._getClipboard(t),this._cutCells=[],n.extend(!0,this._copyCells,r._selectedCells),this._copyCells.length||(this._copyCells=[i.XLShape._picCellIdx]),setTimeout(function(){i.setSheetFocus()},0);else if(t.keyCode===88){if(u=r._selectedCells,i.model.allowLockCell&&r.isSheetProtected&&i._isPropExists([r.selectedRange],"isLocked",f))return;if(u.length&&i._isPropExists([r.selectedRange],"isReadOnly",f))return;this._copyCells=[];n.extend(!0,this._cutCells,u);this._cutCells.length||(this._cutCells=[i.XLShape._picCellIdx]);this._getClipboard(t);setTimeout(function(){i.setSheetFocus()},0)}else if(t.keyCode===86){if(i.isUndefined(t.bubbles)||(this._isSpecial=!i.isPasteValuesOnly),this._cData.length||this._copyBackup.elem)n("#"+i._id+"_hiddenTxt").val(this._cData);else if(t.originalEvent)n("#"+i._id+"_hiddenTxt").select();else{n("#"+i._id+"_hiddenTxt").val("");i._showAlertDlg("Alert",["ClipboardAccessError","ClipboardAccessCutError","ClipboardAccessCopyError","ClipboardAccessPasteError"],"ClipboardAccessError",450);return}setTimeout(function(){i.XLClipboard._setClipboard()},0)}}else t.keyCode===27&&i.element.find(".e-cdata").length&&(i.element.find("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),n("#"+i._id+"_hiddenTxt").val(""),this._cData="",this._copyCells=[])},_triggerKeyDown:function(t,i){var u=this.XLObj,r;u.setSheetFocus();r=n.Event("keydown");r.keyCode=t;r.ctrlKey=i;n("#"+u._id).trigger(r)},_getClipboard:function(t){var i=this.XLObj,r=i.getActiveSheetIndex(),e=i.getSheet(r),o=e._startCell,s=e._endCell,f=i._getContent(r).find(".e-selected"),h=i.getActiveCellElem(r)[0],u;i.model.allowClipboard&&(i.XLClipboard._copyBackup.cells||!i.model.showRibbon||i.model.isReadOnly||(i.XLRibbon._enableButtons(["Home_Clipboard_Paste"],"ejButton"),i.XLRibbon._enableButtons(["Home_Clipboard_PasteOptions"],"ejSplitButton"),i.isPasteValuesOnly&&n("#"+i._id+"_Ribbon_Paste").data("ejMenu").disableItemByID("PasteSpecial")),f.length?(this._copyBackup={cells:[],border:i.model.allowCellFormatting&&i.XLFormat.getHashCodeClassAsArray(),table:[],filterRange:[]},u=this._getSelectedData(o,s),i.element.find(".e-cdata").length&&i.element.find("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),n(f).addClass("e-cdata"),i.XLSelection._focusBorder(o,s,i._cutFocus),this._cData=f.length<2&&!u.length?u=" ":u,this._isCut=!1,n("#"+i._id+"_hiddenTxt").val(u).select(),navigator.platform.toLowerCase().indexOf("mac")>-1&&document.execCommand("copy"),this._copyBackup.actCellPos={top:h.offsetTop,left:h.offsetLeft},this._copyBackup.cells[0].cell.wrap&&(this._copyBackup.cells[0].cell.wrap=""),t.keyCode==67&&(this._copyBackup.copypaste=!0),this._isShape=!1):(this._isShape=!0,this._copyBackup={elem:i.getSheetElement(r).find(".e-ss-activeimg"),isCut:t.keyCode===88,sIdx:r}))},_getSelectedData:function(t,i){var u=this.XLObj,h="",f,r,e,c=u.getActiveSheetIndex(),v,s,b,a;for(t.rowIndex>=i.rowIndex&&(v=t,t=i,i=v),this._copyRange=[],this._copyRange.push(u.getActiveSheetIndex()),this._copyRange.push(u._getSelectedItems()[1]),f=t.rowIndex;f<=i.rowIndex;f++)if(f!==t.rowIndex&&(h+="\n"),t.colIndex<=i.colIndex)for(r=t.colIndex;r<=i.colIndex;r++)cData=u.getRangeData({range:[f,r,f,r],property:["type","value","value2"]})[0],e=u.getObjectLength(cData)?cData.type!=="general"?cData.value2:cData.value:"",this._updateCBackupData(f,r),h+=r!==i.colIndex?e+"\t":e;else for(r=i.colIndex;r<=t.colIndex;r++)cData=u.getRangeData({range:[f,r,f,r],property:["type","value","value2"]})[0],e=u.getObjectLength(cData)?cData.type!=="general"?cData.value2:cData.value:"",this._updateCBackupData(f,r),h+=r!==t.colIndex?e+"\t":e;var y=u.model.sheets[c].tableManager,o,l,p=[],w=u.model.sheets[c].selectedRange;for(s=1,b=u.getObjectLength(y);s<=b;s++)if(o=n.extend(!0,{},y[s]),l=o.range,this._compareRange(w,l)){p.push(o.name);o.header=!0;o.tblId=s;this._copyBackup.table.push({tblName:p,tblObj:o,range:l});break}return a=u.getRangeIndices(u.model.sheets[c].filterSettings.range),this._compareRange(w,a)&&(this._copyBackup.filterRange=a),h},_updateCBackupData:function(t,i){var e=this.XLObj,o=e.getActiveSheetIndex(),u,f=e._dataContainer.sheets[o],r,s=new RegExp("\\be-format.*?\\b","g");t in f&&i in f[t]?(r=n.extend(!0,{},f[t][i]),u=r.format?r.format:""):(r={},u="");this._copyBackup.cells.push({cell:r,format:u})},_setClipboard:function(){var r=this.XLObj,tr,ct,yt,yr,pu,ir,ci,wu,tf,bu,rr,li,bi,ku,s,f,ur,pr,wr,pt,uu,fr,at,ai,br,kr,gt,er,tu,or,iu,ru,ki;if(!r.model.isReadOnly){var ot,yi,rt,sr,uu,fu,gu,eu,e,lt,st=[],a=[],it,ou=new RegExp("\\be-format.*?\\b","g"),k,ni=!1,g,u=r.getActiveSheetIndex(),h={cSheetIndex:this._copyRange[0],pSheetIndex:u,sheetIndex:u},ri=[],ui=r.getSheet(u)._startCell,fi=r.getSheet(u)._endCell,p,nt,ut=0,c,ft,ei,hr,pi,v={},d,cr,ti,su=new RegExp("\\be-shapebdr.*?\\b","g"),hu=["solid","dashed","dotted"],nf,y=ui.rowIndex<fi.rowIndex?ui.rowIndex:fi.rowIndex,lr,wi,di=this._copyBackup.table,bt,gi,nr,b=ui.colIndex<fi.colIndex?ui.colIndex:fi.colIndex,l=r._dataContainer,o,kt,ar,oi,dt=this._copyCells.length,vt=this._cutCells.length;if(r.isPasteValuesOnly&&(this._isSpecial=!1),this._copyRange.length){if(lt=r.swapRange(r.getRangeIndices(this._copyRange[1])),oi=r._getSelectedRange({rowIndex:lt[0],colIndex:lt[1]},{rowIndex:lt[2],colIndex:lt[3]}),ot=[y,b,y+(lt[2]-lt[0]),b+(lt[3]-lt[1])],ar=r._getSelectedRange({rowIndex:ot[0],colIndex:ot[1]},{rowIndex:ot[2],colIndex:ot[3]}),r.model.allowLockCell&&r.getSheet(u).isSheetProtected&&r._isPropExists([ot],"isLocked",u))return;if(r._isPropExists([ot],"isReadOnly",u))return}if(y===0&&b===0&&dt===this.XLObj.model.rowCount*this.XLObj.model.columnCount||dt!==this.XLObj.model.rowCount*this.XLObj.model.columnCount){var cu=r.model.sheets[u],lu=r.model.sheets[this._copyBackup.sIdx],si=r.getSheetElement(u).find(".e-activecell"),ht=r.getSheet(this._copyBackup.sIdx||this._copyRange[0]||u).shapeMngr,hi,tt,au,vu,yu,vr,w=this._copyRange[0];if(this._isShape){if(!this._isSpecial)return!1;ct=r.XLShape._picCellIdx;yt=r.getActiveCell(u);d=this._copyBackup.elem;tr=d[0].id;it=tr.indexOf("picture")>-1?"picture":"chart";h={sheetIndex:u,cSheetIndex:this._copyBackup.sIdx,pSheetIndex:u,operation:"shape",cShapeId:tr,reqType:this._copyBackup.isCut?"cut-paste":"copy-paste"};e=n.extend(!0,{},l.sheets[this._copyBackup.sIdx][ct.rowIndex][ct.colIndex]);a=r.getCell(yt.rowIndex,yt.colIndex);n.extend(!0,v,ht[it][tr]);h.cutCell={rowIndex:ct.rowIndex,colIndex:ct.colIndex,obj:e,shapeObj:n.extend(!0,{},v)};d=r.element.find("#"+v.id);it==="picture"?(tt=d[0].className,tt.indexOf("e-shapebdr")>-1?(tt=d[0].className.match(su)[0],bt=tt.replace("e-shapebdr","").split("N"),gi=bt[2],r.XLShape._createPicture(u,yt,ht.sharedPics[v.data],a[0].offsetTop,a[0].offsetLeft,v.width,v.height,null,"#"+gi,hu[parseInt(bt[1])-1],bt[0]+"px"),r.model.showRibbon&&r.XLRibbon._formatTabUpdate()):(r.XLShape._createPicture(u,yt,ht.sharedPics[v.data],a[0].offsetTop,a[0].offsetLeft,v.width,v.height),r.model.showRibbon&&r.XLRibbon._formatTabUpdate())):(o=v.range,o=r._getAlphaRange(u,o[0],o[1],o[2],o[3]),o.indexOf(":")===-1&&(o=o+":"+o),v.top=a[0].offsetTop,v.left=a[0].offsetLeft,r.XLChart.createChart(o,n.extend(!0,{},v)));this._isShape=this._copyBackup.isCut?!1:!0;this._cutCells=[];r._isUndoRedo||(e=n.extend(!0,{},l.sheets[u][yt.rowIndex][yt.colIndex]),v=n.extend(!0,{},cu.shapeMngr[it][e[it][0]]),h.pShapeId=e[it][0],h.pasteCell={rowIndex:yt.rowIndex,colIndex:yt.colIndex,obj:e,shapeObj:v},rt={sheetIndex:h.sheetIndex,cutCell:h.cutCell,pasteSheetIndex:h.pSheetIndex,operation:h.operation,reqType:h.reqType,pasteShapeId:h.pShapeId,pasteCell:h.pasteCell},rt.reqType==="cut-paste"?(rt.cutSheetIndex=h.cSheetIndex,rt.cutShapeId=h.cShapeId):(rt.copySheetIndex=h.cSheetIndex,rt.copyshapeId=h.cShapeId),r._completeAction(h),r._trigActionComplete(rt),this._copyBackup.isCut&&(e=n.extend(!0,{},l.sheets[this._copyBackup.sIdx][ct.rowIndex][ct.colIndex]),e[it].some(function(n,t){return d[0].id===lu.shapeMngr[it][e[it][t]].id?(objIdx=t,!0):!1}),Object.keys(e).length<2&&e[it].length<2?(delete l.sheets[this._copyBackup.sIdx][ct.rowIndex][ct.colIndex],r.getObjectLength(l.sheets[this._copyBackup.sIdx][ct.rowIndex])<1&&delete l.sheets[this._copyBackup.sIdx][ct.rowIndex]):e[it].length<2?delete e[it]:e[it].splice(objIdx,1),delete lu.shapeMngr[it][h.cShapeId]));this._copyBackup.isCut&&d.remove()}else{if(ni=this._cData===n("#"+r._id+"_hiddenTxt").val()&&this._copyRange.length>0,ni){if(r.model.allowLockCell&&r.getSheet(u).isSheetProtected&&r._isPropExists([ot],"isLocked",u))return;if(r._isPropExists([ot],"isReadOnly",u))return}if(pu=[],h.reqType=vt>0?"cut-paste":"copy-paste",r.element.find(".e-selected").hasClass("e-readonly")){r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom");return}if(h.text=st=n("#"+r._id+"_hiddenTxt").val().length?n("#"+r._id+"_hiddenTxt").val().split("\n"):[],this._cData.length<1&&h.text.length<1)return;if(ni||st[st.length-1]!==""||st.splice(st.length-1,1),yr=[],pu=[],ni?(h.isSpecial=this._isSpecial,o=r.getRangeIndices(this._copyRange[1]),r.setActiveSheetIndex(this._copyRange[0]),h.cutBorder={range:o,prevBorder:r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(o)},r.setActiveSheetIndex(u)):h.isSpecial=!1,vt){for(vr=[],w=this._copyRange[0],di.length||this._cutPasteBorder(lt,ot),p=0;p<vt;p++)f=this._cutCells[p].rowIndex,s=this._cutCells[p].colIndex,k=r.getCell(f,s,w),nf=r.XLEdit.getPropertyValue(f,s,"tableName")||"",a={rowIndex:f,colIndex:s,prevObj:{},newObj:{},shapes:[]},t.isNullOrUndefined(l.sheets[w][f])?a.prevObj={}:n.extend(!0,a.prevObj,l.sheets[w][f][s]),e=t.isNullOrUndefined(l.sheets[w][f])?{}:n.extend(!0,{},l.sheets[w][f][s]),k&&k[0]?("merge"in a.prevObj||(r.XLEdit._updateCellValue({rowIndex:f,colIndex:s},"","",w),r._refreshRowHeight(w,f)),"wrap"in e&&(ei=r._generateHeaderText(s+1)+(f+1),r._dupDetails=!0,r.setActiveSheetIndex(w),r.setWrapText("unwrap",ei+":"+ei),r.setActiveSheetIndex(u),r._dupDetails=!1),"cellType"in e&&r.model.allowCellType&&r.XLCellType._removeControls(f,s,w,!0),k.removeClass("e-hyperlinks e-redft e-yellowft e-greenft e-redf e-redt"),k.find("a").remove(),k.hasClass("e-commentcell")&&r.XLComment.deleteComment([f,s,f,s],w),r.model.allowCellFormatting&&!r.XLRibbon._isDirtySelect&&(di.length?r.XLFormat.removeStyle(o):r.XLFormat.removeStyle(o,{cellStyle:!0,tableStyle:!0,format:!0})),f in l.sheets[w]&&s in l.sheets[w][f]&&(t.isNullOrUndefined(l.sheets[w][f][s])||(gu=l.sheets[w][f][s].overflow),delete l.sheets[w][f][s],r._textClip(f,s,"delete")),k[0].className.match(ou)&&(k[0].className=k[0].className.replace(ou,"")),t.isNullOrUndefined(l.sheets[w][f])?a.newObj={}:n.extend(!0,a.newObj,l.sheets[w][f][s]),r._setRowHdrHeight(w,r._getCellIdx(k[0]).rowIndex)):r.getObjectLength(e)&&(eu=r.getObjectKeys(e),r.clearRangeData([f,s,f,s],eu),r.model.allowCellType&&"cellType"in e&&delete l.sheetCellType[l.sheets[w][f][s].cellType]),vr.push(a);for(c=0,ft=di.length;c<ft;c++)bu=r.getActiveSheetIndex(),r.gotoPage(w,!1),lr=n.trim(di[c].tblName),r.XLFormat.removeTable(r._getTableID(null,lr,w)),r.gotoPage(bu,!1);r.model.allowCellFormatting&&r.XLFormat.removeStyle(o,{cellStyle:!0,tableStyle:!0,format:!0});r.setActiveSheetIndex(w);r.setActiveSheetIndex(u);h.cutCells=vr;h.cfat={table:lr,range:o};yu=!0;r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom")}else{if(rr=[],this._isSpecial)for(p=0;p<dt;p++)f=this._copyCells[p].rowIndex,s=this._copyCells[p].colIndex,a={rowIndex:f,colIndex:s,prevObj:{},newObj:{}},t.isNullOrUndefined(l.sheets[u][f])||n.extend(!0,a.prevObj,l.sheets[u][f][s]),rr.push(a);else rr=this._copyCells;h.cutCells=rr}if(st.length?hi=[y,b,y+st.length-1,b+st[0].split("\t").length-1]:(hi=[y,b,y,b],p=nt=1),h.pasteBorder={range:hi,prevBorder:r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(hi)},dt)for(ur=[],r.XLFormat.removeStyle(ot,{border:!0,cellStyle:!0,format:!0}),li=0,ku=ar.length;li<ku;li++)bi=ar[li],f=oi[li].rowIndex,s=oi[li].colIndex,ur=r.XLEdit.getPropertyValue(f,s,"borders",this._copyRange[0]),r.isUndefined(ur)||r.XLFormat.applyBorder(ur,[bi.rowIndex,bi.colIndex,bi.rowIndex,bi.colIndex]);for(uu=r._getContTBody(u).find("rows"),p=0,au=st.length;p<au;p++){for(a=st[p].split("\t"),nt=0,vu=a.length;nt<vu;nt++){if(k=uu[r._getRowIdx(y+p)]?r.getCell(y+p,b+nt)[0]:i,t.isNullOrUndefined(k)?(cu.colCount<=b+nt?r.XLScroll._createNewColumn(u,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"insert"):r.model.scrollSettings.allowScrolling&&!r.model.scrollSettings.allowVirtualScrolling&&r.XLScroll._createNewRow(u,-1,-1,"insert"),r.XLScroll._refreshScroller(u,"refresh","all"),k=r.getCell(y+p,b+nt)):k=n(k),g={rowIndex:y+p,colIndex:b+nt},g.prevObj=t.isNullOrUndefined(l.sheets[u][y+p])?{}:n.extend(!0,{},l.sheets[u][y+p][b+nt]),t.isNullOrUndefined(g.prevObj)||(delete g.prevObj.isMHide,delete g.prevObj.mergeIdx),this._isCut&&ni)return;if(currentCellIdx={rowIndex:y+p,colIndex:b+nt},this._isSpecial&&ni)if(f=currentCellIdx.rowIndex,s=currentCellIdx.colIndex,wu=oi[ut].rowIndex,tf=oi[ut].colIndex,tt=r._dataContainer.hashCode[this._copyBackup.cells[ut].format],"merge"in this._copyBackup.cells[ut].cell||t.isNullOrUndefined(tt)||r.addClass(k,tt),e=n.extend(!0,{},this._copyBackup.cells[ut].cell),f in l.sheets[u]||(l.sheets[u][f]={}),s in l.sheets[u][f]?"comment"in l.sheets[u][f][s]&&r.getCell(f,s).removeClass("e-commentcell"):l.sheets[u][f][s]={},e){if(gt=n.extend(!0,{},r.XLEdit.getPropertyValue(f,s,"merge")),pr=r.XLEdit.getPropertyValue(f,s,"isMHide"),wr=n.extend(!0,{},r.XLEdit.getPropertyValue(f,s,"mergeIdx")),delete e.overflow,delete e.isOverflow,delete e.tableName,n.extend(!0,l.sheets[u][f][s],e),pt=l.sheets[u][f][s],r.getObjectLength(gt)?pt.merge=gt:delete pt.merge,r.getObjectLength(wr)?pt.mergeIdx=wr:delete pt.mergeIdx,r.isUndefined(pr)?delete pt.isMHide:pt.isMHide=pr,r.XLEdit.getPropertyValue(f,s,"value2")&&(r._textClip(f,s,"delete"),r._textClip(f,s,"add")),ci=e.value2&&typeof e.value2=="string"&&!e.formatStr?l.sharedData[e.value][0]==="="?l.sharedData[e.value]:e.value2:l.sharedData[e.value],e.type===3&&(ci=this._getUpdatedCellFormula(ci,this._copyCells[ut],{rowIdx:f,colIdx:s})),"merge"in e||(r.XLEdit._updateCellValue(currentCellIdx,ci),cHeight=r.XLEdit.getPropertyValue(wu,0,h.reqType==="copy-paste"?"cHeight":"pHeight",this._copyRange[0]),r.isUndefined(cHeight)||(r.XLEdit._updateDataContainer({rowIndex:currentCellIdx.rowIndex,colIndex:0},{dataObj:{pHeight:r.getSheet(u).rowsHeightCollection[currentCellIdx.rowIndex],cHeight:cHeight}}),r.getSheet(u).rowsHeightCollection[currentCellIdx.rowIndex]=cHeight,r._isRowViewable(u,currentCellIdx.rowIndex)&&(r.getRows(u)[1][r._getRowIdx(currentCellIdx.rowIndex)].style.height=cHeight+"px"))),"merge"in e){fr=0;gt=e.merge;o=r.getRangeIndices(gt.mRange);var dr=o[2]-o[0],gr=o[3]-o[1],rf=r.getSheet(u)._selectedCells,nu=r._getAlphaRange(u,g.rowIndex,g.colIndex,g.rowIndex+dr,g.colIndex+gr),vi,uf=fi.rowIndex-ui.rowIndex,ff=fi.colIndex-ui.colIndex;if(at=r._getSelectedRange({rowIndex:g.rowIndex,colIndex:g.colIndex},{rowIndex:g.rowIndex+dr,colIndex:g.colIndex+gr}),oi.length>=rf.length||!((ff+1)%(gr+1)==0&&(uf+1)%(dr+1)==0)){for(c=0,ft=at.length;c<ft;c++)t.isNullOrUndefined(r.XLEdit.getPropertyValue(at[c].rowIndex,at[c].colIndex,"isMHide"))&&(ai=r.XLEdit.getPropertyValue(at[c].rowIndex,at[c].colIndex,"merge"),fr++,t.isNullOrUndefined(ai)||(ai&&(br=ai.mSpan.rowSpan,kr=ai.mSpan.colSpan),t.isNullOrUndefined(br)||t.isNullOrUndefined(kr)||(fr+=parseInt(br)*parseInt(kr)-1),ai.isCenterAlign&&r._isRowViewable(u,at[c].rowIndex)&&r.getCell(at[c].rowIndex,at[c].colIndex).addClass("e-calign").removeClass("e-ralign")));if(at.length===fr&&vt){for(var du=!1,vi=r._getSelectedCells(w,gt.mRange).range,wt,ii=r._dataContainer.sheets[w],et=vi[0];et<=vi[2];et++)for(wt=vi[1];wt<=vi[3];wt++)r._isRowViewable(w,et)&&r.getCell(et,wt,w).text(""),t.isNullOrUndefined(ii[et])&&(ii[et]={}),t.isNullOrUndefined(ii[et][wt])&&(ii[et][wt]={}),du?(ii[et][wt].isMHide=!0,ii[et][wt].mergeIdx={rowIndex:o[0],colIndex:o[1]}):(ii[et][wt].merge=gt,du=!0);r.setActiveSheetIndex(w);r._unMergeAllCells(this._copyRange[0],0,r._getSelectedRange({rowIndex:o[0],colIndex:o[1]},{rowIndex:o[2],colIndex:o[3]}),[],0,0);r.setActiveSheetIndex(u)}r._paste=!0;r._dupDetails=!0;r.isUndefined(g.prevObj.merge)||r.unmergeCells(g.prevObj.merge.mRange);r.unmergeCells(nu);r.mergeCenter=gt.isCenterAlign;r.isUndefined(vi)||vi!=="1"?r.mergeCells(nu,!0):r.mergeAcrossCells(nu,!0);r._dupDetails=!1;r.XLEdit._updateCellValue(currentCellIdx,ci);t.isNullOrUndefined(tt)||r.addClass(k,tt)}else{er=n.extend(!0,{},e);er.value=er.value2=ci;t.isNullOrUndefined(tt)||r.getCell(o[0],o[1],this._copyRange[0]).addClass(tt);r.XLEdit._updateDataContainer({rowIndex:o[0],colIndex:o[1]},{dataObj:er});r._showAlertDlg("Alert","MergeAlert","",250);return}}if("hyperlink"in e&&(ir=e.hyperlink,k&&(ir&&!ir.webAddr?k.html(t.buildTag("a.e-hyperlinks",r.XLEdit.getPropertyValue(f,s,"value2"),"",{href:"#"})):k.html(t.buildTag("a.e-hyperlinks",r.XLEdit.getPropertyValue(f,s,"value2"),"",{href:ir.webAddr,target:"_blank"})))),"comment"in e&&(r._removeClass(k,"e-commentcell"),r.XLComment.setComment([f,s,f,s],null,!1)),"cFormatRule"in e)for(hr=n.extend(!0,[],e.cFormatRule),e.cFormatRule=[],c=0,ft=hr.length;c<ft;c++)pi=r._dataContainer.cFormatData[hr[c]].split("_"),r.XLCFormat._cFormat(pi[0],pi[2],pi[3],pi[4],null,null,[f,s,f,s],"paste",this._copyCells[ut]);if(r._isPaste=!0,"wrap"in e&&(r._dupDetails=!0,ei=r._generateHeaderText(s+1)+(f+1),r.setWrapText("wrap",ei+":"+ei),r._dupDetails=!1),"cellType"in e&&(sr=r._dataContainer.sheetCellType[e.cellType],sr.text="",r.model.allowCellType&&r.XLCellType._renderControls(f,s,u,sr,!vt)),r._isPaste=!0,"picture"in e)for(delete pt.picture,c=0,ft=e.picture.length;c<ft;c++)a=dt?this._copyCells[ut]:this._cutCells[ut],kt=this._copyBackup.actCellPos,ti=r.getRangeData([a.rowIndex,a.colIndex,a.rowIndex,a.colIndex],"","",this._copyRange[0])[0],(!r.isUndefined(ti.picture)&&ti.picture.indexOf(e.picture[c])>-1||!dt)&&(n.extend(!0,v,ht.picture[e.picture[c]]),d=r.element.find("#"+v.id),v.rowIndex===a.rowIndex&&v.colIndex===a.colIndex&&(d=r.element.find("#"+v.id),tt=d[0].className,tt.indexOf("e-shapebdr")>-1?(tt=d[0].className.match(su)[0],bt=tt.replace("e-shapebdr","").split("N"),gi=bt[2],r.XLShape._createPicture(u,currentCellIdx,ht.sharedPics[v.data],parseInt(d.css("top"))-kt.top+si[0].offsetTop,parseInt(d.css("left"))-kt.left+si[0].offsetLeft,v.width,v.height,null,"#"+gi,hu[parseInt(bt[1])-1],bt[0]+"px")):r.XLShape._createPicture(u,currentCellIdx,ht.sharedPics[v.data],parseInt(d.css("top"))-kt.top+si[0].offsetTop,parseInt(d.css("left"))-kt.left+si[0].offsetLeft,v.width,v.height),this._copyRange[0]===u&&(l.sheets[u][y+p][b+nt].picture[c]=r.getObjectKeys(ht.picture)[r.getObjectLength(ht.picture)-1]),vt&&d.remove()));if("chart"in e)for(delete pt.chart,ti=r.getRangeData([f,s,f,s]),c=0,ft=e.chart.length;c<ft;c++)a=dt?this._copyCells[ut]:this._cutCells[ut],kt=this._copyBackup.actCellPos,ti=r.getRangeData([a.rowIndex,a.colIndex,a.rowIndex,a.colIndex])[0],(!r.isUndefined(ti.chart)&&ti.chart.indexOf(e.chart[c])>-1||!dt)&&(n.extend(!0,v,ht.chart[e.chart[c]]),d=r.element.find("#"+v.id),v.rowIndex===a.rowIndex&&v.colIndex===a.colIndex&&(o=v.range,o=r._getAlphaRange(u,o[0],o[1],o[2],o[3]),o.indexOf(":")<0&&(o=o+":"+o),v.top=parseInt(d.css("top"))-kt.top+si[0].offsetTop,v.left=parseInt(d.css("left"))-kt.left+si[0].offsetLeft,r.XLChart.createChart(o,v),l.sheets[u][y+p][b+nt].chart[c]=r.getObjectKeys(ht.chart)[r.getObjectLength(ht.chart)-1],vt&&d.remove()));"rule"in e&&e.rule.type==="list"&&r._setddlCell();r._isPaste=!1}else r.XLEdit._updateCellValue(currentCellIdx,""),t.isNullOrUndefined(l.sheets[u][f])||delete l.sheets[u][f][s];else yi=r.XLEdit._parseValue(a[nt],currentCellIdx),yi.type=="time"||yi.type=="datetime"?(fu=r._dateToInt(yi.value),r.XLEdit._updateCellValue(currentCellIdx,fu)):r.XLEdit._updateCellValue(currentCellIdx,yi.value),a[nt].indexOf("=")>-1&&r.XLEdit._updateCellValue(currentCellIdx,k.html());ut++;g.newObj=t.isNullOrUndefined(l.sheets[u][y+p])?{}:n.extend(!0,{},l.sheets[u][y+p][b+nt]);t.isNullOrUndefined(g.newObj)&&(g.newObj={});yr.push(g)}t.isNullOrUndefined(k)||(r._setRowHdrHeight(u,r._getCellIdx(k[0]).rowIndex),r.model.allowFreezing&&r.getSheet(u)._isFreezed&&r.XLFreeze._refreshFRowResize(r._getCellIdx(k[0]).rowIndex))}if(st.length<1&&(p=1),vt&&(this._isCut=yu,this._cutCells=[],this._cData=""),this._isSpecial&&ni){for(tu=this._copyBackup.table,iu=r.getSheet(u).tableManager,o=r.getRangeIndices(this._copyRange[1]),c=0,ft=tu.length;c<ft;c++)wi=this._copyBackup.table[c].range,or=n.extend(!0,{},this._copyBackup.table[c].tblObj),this._copyBackup.copypaste&&(or.name="Table"+r._tableCnt),r._dupDetails=!0,r.XLFormat.createTable(or,r._getAlphaRange(this._copyRange[0],wi[0]+y-o[0],wi[1]+b-o[1],y-o[0]+wi[2],b-o[1]+wi[3])),r._dupDetails=!1,ru=this._isCut?or.tblId:this.XLObj.getObjectLength(iu),ri.push(iu[ru]),ri[c].id=ru,ri[c].totalRow&&r.XLFormat._updateTotalRow(u,ri[c].id,tu[0].tblObj.fnNumber,ri[c].range,!0);hi=[y,b,p+y-1,nt+b-1];vt&&this._copyBackup.filterRange.length>0&&this._copyRange[0]===u&&(ki=this._copyBackup.filterRange,r.XLFilter.clearFilter(),cr=r._generateHeaderText(ki[1]+b-o[1]+1)+(ki[0]+y-o[0]+1)+":"+r._generateHeaderText(b-o[1]+ki[3]+1)+(y-o[0]+ki[2]+1),r.XLFilter.filter(cr));h.pasteBorder.newBorder=r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(hi);r.setActiveSheetIndex(this._copyRange[0]);h.cutBorder.newBorder=r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(o);r.setActiveSheetIndex(u)}h.pfat={table:this._copyBackup.table,range:o,minRowIdx:y,minColIdx:b,ptable:ri};h.pfilter=cr;h.pasteCells=yr;r.XLSelection.selectRange({rowIndex:y,colIndex:b},{rowIndex:p+y-1,colIndex:nt+b-1});r.getSheet(u)._startCell={rowIndex:y,colIndex:b};r.getSheet(u)._endCell={rowIndex:p+y-1,colIndex:nt+b-1};r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement();h.sheetIndex=u;r.setSheetFocus();r.model.showRibbon&&r.XLRibbon._updateRibbonIcons();rt={sheetIndex:h.sheetIndex,pasteCells:h.pasteCells,reqType:h.reqType,isSpecial:h.isSpecial,cutCells:h.cutCells,pasteSheetIndex:h.pSheetIndex};rt.reqType==="cut-paste"?rt.cutSheetIndex=h.cSheetIndex:rt.copySheetIndex=h.cSheetIndex;r._isUndoRedo||(r._completeAction(h),r._trigActionComplete(rt));nr=h.cutCells.length<1?y:h.cutCells[0].rowIndex;r.XLScroll._getRowHeights(u,y<nr?y>0?y-1:0:nr>0?nr-1:0)}r._isPaste=!1;this._isCut=!1;r.XLSelection._refreshBorder();r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement();r.getSheet(u)._isFreezed&&r.XLFreeze._refreshSelection()}else r._showAlertDlg("Alert","FullSheetCopyPasteAlert","",375)}},_getUpdatedCellFormula:function(n,t,i){for(var f=this.XLObj,c=/([A-Z].*?[0-9])/g,l=i.rowIdx-t.rowIndex,a=i.colIdx-t.colIndex,r=f.XLDragFill._parseFormula(n),e,o,s,u=0,h=r.length;u<h;u++)r[u].match(c)&&(e=r[u].trim().match(/(\d+|\D+)/g),o=f._generateColCount(e[0])+a,s=parseInt(e[1])+l,r[u]=s>0&&o>0?f._generateHeaderText(o)+s.toString():"#REF!");return r=r.join(""),"="+r},_compareRange:function(n,t){return n[0]<=t[0]&&n[1]<=t[1]&&n[2]>=t[2]&&n[3]>=t[3]},_cutPasteBorder:function(n,t){var r,u,s,h,c,i=this.XLObj,l=i.getActiveSheetIndex(),f=[],e=[],o=[];for(i.XLFormat.removeStyle(t,{cellStyle:!0,border:!0,format:!0,sheetIdx:l}),e=i._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]}),o=i._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]}),r=0,c=o.length;r<c;r++)u=o[r],h=e[r].rowIndex,s=e[r].colIndex,f=i.XLEdit.getPropertyValue(h,s,"borders",this._copyRange[0]),i.isUndefined(f)||i.XLFormat.applyBorder(f,[u.rowIndex,u.colIndex,u.rowIndex,u.colIndex]);i.setActiveSheetIndex(this._copyRange[0]);i.XLFormat.removeStyle(n,{cellStyle:!0,border:!0,format:!0});i.setActiveSheetIndex(l)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.comments=function(n){this.XLObj=n;this._isCommentEdit=!1;this._isShowAllComments=!1;this._curCommentHCell=null};t.spreadsheetFeatures.comments.prototype={setComment:function(n,i,r,u){var f=this.XLObj,a;if(f.model.allowComments&&f.model.allowEditing&&!f.model.isReadOnly){var g,p=!1,y,c,e,o,w,v,b,s,h,k,d=[],l={sheetIndex:f.getActiveSheetIndex(),reqType:"comment"};if(s=f.getActiveSheetIndex(),h=f.getSheet(s),f.model.allowLockCell&&h.isSheetProtected)return!1;if(n)rng=f._getRangeArgs(n,"object"),e=rng[0],o=rng[1],c={rowIndex:e,colIndex:o};else{if(!f.model.allowSelection)return;c=f.getActiveCell(s);e=c.rowIndex;o=c.colIndex}if(a={reqType:"beforeEditComment",cellIndex:c,value:i,sheetIdx:s,disable:!1},f._trigger("beforeEditComment",a)&&(a.disable=!0),i=a.value,!f._isCellProtected(e,o,!1)){if(!f.isUndefined(f.XLEdit.getPropertyValue(e,o,"cellType"))){f._showAlertDlg("Alert","CellTypeAlert","CellTypeAlert",372);return}f.model.showRibbon&&(f._isPaste?!f.XLClipboard._cutCells.length:!0)&&f._commentCount++;f._isRibbonClick||(l.action="add",d.push(c),l.selectedCell=d,l.selectedCell[0].prevComment=f.XLEdit.getPropertyValue(e,o,"comment"));f._isAutoWHMode||f.XLClipboard._copyCells.length||h._isFreezed||f.XLScroll._scrollSelectedPosition(s,c);e in h._commentColl||(h._commentColl[e]={});h._commentColl[e][o]={isComment:!0};r=t.isNullOrUndefined(r)?!0:r;u=t.isNullOrUndefined(u)?!0:u;b=(f.model.userName.length>0?f.model.userName:f._getLocStr("UserName"))+":\n";g=f.XLEdit.getPropertyValue(e,o,"comment",s);t.isNullOrUndefined(i)?a.disable&&f.XLEdit._updateDataContainer(c,{dataObj:{comment:{value:b,isVisible:t.isNullOrUndefined(f.XLEdit.getPropertyValue(e,o,"comment",s))?r:f.XLEdit.getPropertyValue(e,o,"comment",s).isVisible}}}):(u&&(i=b+i),f.XLEdit._updateDataContainer(c,{dataObj:{comment:{value:i,isVisible:t.isNullOrUndefined(f.XLEdit.getPropertyValue(e,o,"comment",s))?r:f.XLEdit.getPropertyValue(e,o,"comment",s).isVisible}}}));w=t.isNullOrUndefined(f.XLEdit.getPropertyValue(e,o,"comment",s))?(f.model.userName.length>0?f.model.userName:f._getLocStr("UserName"))+":\n":f.XLEdit.getPropertyValue(e,o,"comment",s).value;!f.model.allowComments||f.XLEdit._isEdit||f._isSheetRename||(f._isRowViewable(s,e)&&(y=f.getCell(e,o),y.prepend(t.buildTag("span.e-comment",t.buildTag("span.e-celltoparrow")).append(t.buildTag("textarea.e-comment-txtarea",w,{"z-index":10}))).addClass("e-commentcell"),this._updateCmntArrowPos(y),v=y.find(".e-comment-txtarea"),this._updateCmtAreaPos(y,v),v.focus().setInputPos(v.val().length),p=!0,a.disable&&(v[0].disabled=!0)),(!h._isImported||h._isLoaded)&&(k=f.XLEdit.getPropertyValue(e,o,"comment",s),t.isNullOrUndefined(k)||(k.value=w)),r&&p?(v.focus(),!this._curCommentHCell||t.isNullOrUndefined(f.XLEdit.getPropertyValueByElem(this._curCommentHCell,"comment"))||f.XLEdit.getPropertyValueByElem(this._curCommentHCell,"comment").isVisible||(this._curCommentHCell.find(".e-comment-txtarea").hide(),this._curCommentHCell=null),f.model.allowDragAndDrop&&!f.XLDragDrop._isDragAndDropped&&this._updateCurrentCell(e,o),a.disable?this._updateCmntRibIcons():(this._isCommentEdit=!0,f.model.showRibbon&&f.XLRibbon._disableRibbonIcons())):p&&(this._isShowAllComments||f.XLEdit.getPropertyValue(e,o,"comment",s).isVisible||v.hide(),f.model.showRibbon&&(!h._isImported||h._isLoaded)&&f.model.allowDragAndDrop&&!f.XLDragDrop._isDragAndDropped&&this._updateCmntRibIcons(f.XLClipboard._isSpecial?f.getActiveCell():{rowIndex:e,colIndex:o})),f._isRibbonClick||f._isUndoRedo||f._hasComment||f._isExport||f._dupDetails||(l.selectedCell[0].curComment=f.XLEdit.getPropertyValue(e,o,"comment"),l.showUserName=u,l.showEditPanel=r,f._completeAction(l),f._trigActionComplete(l)))}}},_updateCmtAreaPos:function(n,t){var r=this.XLObj,u=r.getActiveSheetIndex(),s=r._getContent(u).find("#hscrollBar").offset(),f=r._getContent(u).find("#vscrollBar").offset(),h=r._getJSSheetHeader(u).offset(),i=t.offset(),e=t.height(),o=t.width();r.model.scrollSettings.allowScrolling&&(i.top+e+5>s.top&&i.left+o<f.left?t.css({top:-77}):i.left+o>f.left&&i.top+e+5>s.top?t.css({left:-136,top:-81}):i.top+e>h.top&&i.left+o>f.left&&t.css({left:-137,top:n.height()+8}))},deleteComment:function(i,r,u,f){var e=this.XLObj,o;if(e.model.allowComments&&!e.model.isReadOnly){var v,l=[],a=[],h=r||e.getActiveSheetIndex(),s,c={sheetIndex:h,reqType:"comment",action:"delete",range:i};for(i=e._getRangeArgs(i,"object"),s=e._getSelectedCells(r,i).selCells,o=0;o<s.length;o++)e.XLEdit.getPropertyValue(s[o].rowIndex,s[o].colIndex,"comment",r)&&l.push(s[o]);if(e.model.allowComments){for(o=0;o<s.length;o++)if(rowIdx=s[o].rowIndex,colIdx=s[o].colIndex,cmnt=e.XLEdit.getPropertyValue(rowIdx,colIdx,"comment",r),!t.isNullOrUndefined(cmnt)){if(v=n(s[o]),u&&e._isHiddenRow(rowIdx)){s.splice(o,1);continue}e.model.showRibbon&&e._commentCount&&e._commentCount--;a.push({rowIndex:rowIdx,colIndex:colIdx,prevComment:cmnt,currComment:{}});e._isRowViewable(h,rowIdx)&&e.getCell(rowIdx,colIdx,h).removeClass("e-commentcell").find(".e-comment").remove();e.getSheet(h)._commentColl[rowIdx]&&delete e.getSheet(h)._commentColl[rowIdx][colIdx];delete e._dataContainer.sheets[h][rowIdx][colIdx].comment}c.selectedCell=a;e.model.showRibbon&&l.length&&e.model.allowDragAndDrop&&!e.XLDragDrop._isDragAndDropped&&e.XLComment._updateCmntRibIcons();c.reqType=t.isNullOrUndefined(f)?"comment":"clear-comment";e._isUndoRedo||e._dupDetails||(e._completeAction(c),e._trigActionComplete(c))}}},editComment:function(n){var i=this.XLObj,r,f,u,e;if(i.model.allowComments&&!i.model.isReadOnly){if(u=i.getActiveSheetIndex(),i.model.allowLockCell&&i.getSheet(u).isSheetProtected)return!1;t.isNullOrUndefined(n)&&(n=i.getActiveCell());f=i.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"comment",u);r={reqType:"beforeEditComment",cellIndex:n,value:f.value,sheetIndex:u,isDisable:!1};i._trigger("beforeEditComment",r)&&(r.disable=!0);f.value=r.value;i.XLEdit._updateDataContainer(n,{dataObj:{comment:{value:f.value,isVisible:f.isVisible}}});i.XLEdit._isEdit||i._isSheetRename||(i.model.allowComments&&(t.isNullOrUndefined(i.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"comment"))||(i._isAutoWHMode||i.XLScroll._scrollSelectedPosition(u,n),i._isRowViewable(u,n.rowIndex)&&(e=i.getCell(n.rowIndex,n.colIndex).find(".e-comment-txtarea"),e.text(r.data),e.css("display","inline-table").focus().setInputPos(e.text().length)),r.disable||(this._isCommentEdit=!0))),i.model.showRibbon&&!r.disable&&i.XLRibbon._disableRibbonIcons())}},showHideComment:function(n){var i=this.XLObj;if(i.model.allowComments&&!i.model.isReadOnly){var s=i.getActiveSheetIndex(),r,u,e,o=!1,f=!1;r=t.isNullOrUndefined(n)?i.getActiveCell():i._getCellIdx(n[0]);u=i.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"comment");t.isNullOrUndefined(u)||(i._isRowViewable(s,r.rowIndex)&&(e=i.getCell(r.rowIndex,r.colIndex).find(".e-comment-txtarea"),o=!0),u.isVisible?(o&&e.hide(),f=!1):(o&&e.css("display","inline-table"),this._curCommentHCell=null,f=!0));i.isUndefined(f)||(u.isVisible=f)}},showAllComments:function(){var t=this.XLObj,r;if(t.model.allowComments){for(var h=t.getActiveSheetIndex(),u,f,e,o=n("#"+t._id+"_Ribbon_Review_Comments_ShowAllComments").data("ejToggleButton"),s=["Review_Comments_PreviousComment","Review_Comments_NextComment"],c=this._isShowAllComments?!1:!0,i=1;i<=t.model.sheetCount;i++)for(u=t.getSheet(i)._commentColl,rowKeys=t.getObjectKeys(u),j=0;j<rowKeys.length;j++){for(colKeys=t.getObjectKeys(u[rowKeys[j]]),r=0;r<colKeys.length;r++)t._isRowViewable(h,parseInt(rowKeys[j]))&&(f=t.getCell(parseInt(rowKeys[j]),parseInt(colKeys[r]),i).find(".e-comment-txtarea"),this._isShowAllComments?f.hide():f.css("display","inline-table")),t.XLEdit.getPropertyValue(rowKeys[j],colKeys[r],"comment",i).isVisible=!this._isShowAllComments;j==0&&(e=!0)}this._isShowAllComments=!this._isShowAllComments;t.model.showRibbon&&o&&o.model.toggleState?t.XLRibbon._disableButtons(s,"ejButton"):t.model.showRibbon&&e&&t.XLRibbon._enableButtons(s,"ejButton")}},findPrevComment:function(){var i=this.XLObj,o,u,y,c,l,a,f,r,e,s,p,h,v;if(i.model.allowComments&&!i.model.isReadOnly){for(o=i.getActiveSheetIndex(),p=n("#"+i._id+"_Ribbon_Review_Comments_NewComment"),f=o;f>0;f--)if(u=i.getSheet(f),i.getObjectLength(u._commentColl))for(f!==o&&i.gotoPage(f,!1),i.model.showRibbon&&(v=i.XLRibbon._getTabIndex("review"),v&&n("#"+i._id+"_Ribbon").ejRibbon("option","selectedItemIndex",v)),y=u.rowCount-1,c=u.colCount-1,f!==o&&this._updateCurrentCell(y-1,c-1),l=u._activeCell.rowIndex,a=u._activeCell.colIndex,r=l;r>=0;r--)for(r!==l&&(a=c-1),e=a;e>=0;e--)if(i.XLEdit.getPropertyValue(r,e,"comment",o)&&(u._hiddenFreezeRows.indexOf(r)>-1&&u._isFreezed?i.XLSearch._freezeScroll(r,e,u):i._isRowViewable(o,r)||i._scrollContent({y:i._getRowOffsetTop(u,r)},!0)),i._isRowViewable(o,r)){if(s=n(i.getCell(r,e)),h=n(s.find(".e-comment-txtarea")),u._activeCell.rowIndex!==r&&u._activeCell.colIndex!==e&&!t.isNullOrUndefined(i.XLEdit.getPropertyValueByElem(s,"comment"))&&i.XLEdit.getPropertyValueByElem(s,"comment").isVisible&&h.hide(),s.hasClass("e-commentcell")&&!h.is(":visible"))return h.css("display","inline-table").focus()&&this._updateCurrentCell(r,e),this._updateCommentsBtns(p),i.setSheetFocus(),!0;this._isShowAllComments||this._isCommentEdit||!s.hasClass("e-commentcell")||i.XLEdit.getPropertyValueByElem(s,"comment").isVisible||h.hide()}f===0&&i._showAlertDlg("","CommentFindEndAlert","findPrevComment",630)}},_updateCommentsBtns:function(n){var t=this.XLObj;t.model.showRibbon&&(t.XLRibbon._enableButtons(["Review_Comments_DeleteComment","Review_Comments_ShowHideComment"],"ejButton"),n.find(".e-icon").removeClass("e-ssr-newcmnt").addClass("e-ssr-editcmnt"),n.find(".e-btntxt").text(t._getLocStr("EditComment")))},findNextComment:function(){var i=this.XLObj;if(i.model.allowComments&&!i.model.isReadOnly){for(var u,c,l,v,y,r,o,e,h,a,p=!1,s=i.getActiveSheetIndex(),w=n("#"+i._id+"_Ribbon_Review_Comments_NewComment"),f=s;f<=i.model.sheetCount;f++)if(u=i.getSheet(f),i.getObjectLength(u._commentColl))for(f!==s&&i.gotoPage(f,!1),i.model.showRibbon&&(a=i.XLRibbon._getTabIndex("review"),a&&n("#"+i._id+"_Ribbon").ejRibbon("option","selectedItemIndex",a)),f!==s&&this._updateCurrentCell(0,0),c=u._activeCell.rowIndex,l=u._activeCell.colIndex,v=u.rowCount-1,y=u.colCount-1,r=c;r<v;r++)for(r!==c&&(l=0),o=l;o<y;o++){if(i.XLEdit.getPropertyValue(r,o,"comment",s)&&(u._isFreezed?i.XLSearch._freezeScroll(r,o,u):i._isRowViewable(s,r)||i._scrollContent({y:i._getRowOffsetTop(u,r)},!0),p=!i.getActiveCellElem()),i._isRowViewable(s,r)&&(e=n(i.getCell(r,o)),h=n(e.find(".e-comment-txtarea")),p||i.getActiveCellElem()[0]===e[0]||t.isNullOrUndefined(i.XLEdit.getPropertyValueByElem(e,"comment"))||!i.XLEdit.getPropertyValueByElem(e,"comment").isVisible||h.hide(),e.hasClass("e-commentcell")&&!h.is(":visible")))return h.css("display","inline-table").focus(),this._updateCurrentCell(r,o),this._updateCommentsBtns(w),i.setSheetFocus(),!0;this._isShowAllComments||this._isCommentEdit||!e.hasClass("e-commentcell")||i.XLEdit.getPropertyValueByElem(e,"comment").isVisible||h.hide()}f===i.model.sheetCount+1&&i._showAlertDlg("","CommentFindEndAlert","findNextComment",630)}},_commentMouseMove:function(i){var e=this.XLObj,r,f,u;(r=i.target.tagName==="TD"?n(i.target):n(i.target).parent("td"),r.length)&&(f=r.find(".e-comment-txtarea"),this._isCommentEdit||(t.isNullOrUndefined(this._curCommentHCell)||r!==this._curCommentHCell&&(u=e.XLEdit.getPropertyValueByElem(this._curCommentHCell,"comment"),t.isNullOrUndefined(u)||u.isVisible||(this._curCommentHCell.find(".e-comment-txtarea").hide(),this._curCommentHCell=null)),r[0].tagName==="TD"&&r.hasClass("e-commentcell")&&(f.css("display","inline-table"),this._curCommentHCell=r)))},_commentMouseDownHandler:function(t){var i=this.XLObj,r=i.getActiveCell(),o=i.getActiveSheetIndex(),u,f,e;i._isRowViewable(o,r.rowIndex)&&(u=i.getCell(r.rowIndex,r.colIndex,o),e=n(u.find(".e-comment-txtarea")),u.hasClass("e-commentcell")&&e.get()[0]!==t.target&&(f=i.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"comment"),this._isCommentEdit&&this._updateCurCmntVal(r),this._isShowAllComments||i.isUndefined(f)||f.isVisible||e.hide()));i._hasClass(t.target,"e-comment-txtarea")&&!t.target.disabled&&(n(t.target).focus().css("z-index",10)&&(this._isCommentEdit=!0),this._updateCurrentCell(n(t.target).parents("td").parent().index(),n(t.target).parents("td").index()),i.model.showRibbon&&i.XLRibbon._disableRibbonIcons())},_updateCmntRibIcons:function(t){var f,i=this.XLObj,e=["Review_Comments_ShowHideComment","Review_Comments_DeleteComment"],u=i.getActiveSheetIndex(),l=i.getSheetElement(u),r=n("#"+i._id+"_Ribbon_Review_Comments_NewComment"),h=i.getActiveCell(),o=i.getSheet(u),c=o._selectedCells,s=o.selectedRange;t=i.model.allowDragAndDrop&&!i.XLDragDrop._isDragAndDropped?t?t:h:{rowIndex:i._dStartCell.rowIndex,colIndex:i._dStartCell.colIndex};i.XLRibbon._enableButtons(["Review_Comments_NewComment"],"ejButton");i.XLRibbon._enableButtons(i.XLRibbon._cmntTglBtnIds,"ejToggleButton");f=i.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"comment",u);f?(i.XLRibbon._enableButtons(e,"ejButton"),r.find(".e-icon").removeClass("e-ssr-newcmnt").addClass("e-ssr-editcmnt"),r.find(".e-btntxt").text(i._getLocStr("EditComment"))):(r.find(".e-icon").removeClass("e-ssr-editcmnt").addClass("e-ssr-newcmnt"),r.find(".e-btntxt").text(i._getLocStr("NewComment")),i.XLRibbon._disableButtons(e,"ejButton"));this._isShowAllComments||i._commentCount===0?i.XLRibbon._disableButtons(["Review_Comments_PreviousComment","Review_Comments_NextComment"],"ejButton"):i.XLRibbon._enableButtons(["Review_Comments_PreviousComment","Review_Comments_NextComment"],"ejButton");c.length&&i.inRange(s,t.rowIndex,t.colIndex)&&i.XLEdit._rangeHasProperty(s,"comment")&&i.XLRibbon._enableButtons(["Review_Comments_DeleteComment"],"ejButton")},_updateCurCmntVal:function(n,i){i=t.isNullOrUndefined(i)?"":i;var r=this.XLObj,h=t.isNullOrUndefined(n)?r.getActiveCell():n,o,c=[],l="User Name:",s=!1,e={sheetIndex:r.getActiveSheetIndex(),reqType:"comment"},u=h.rowIndex,f=h.colIndex;r._isRowViewable(e.sheetIndex,u)&&(o=r.getCell(u,f,r.getActiveSheetIndex()).find(".e-comment-txtarea"),s=!0,o.scrollTop(0));c.push({rowIndex:u,colIndex:f});e.action=t.isNullOrUndefined(r.XLEdit.getPropertyValue(u,f,"comment"))?"add":"edit";e.selectedCell=c;e.selectedCell[0].prevComment=r.XLEdit.getPropertyValue(u,f,"comment");s&&(l=o.css("z-index",9).val());r.XLEdit._updateDataContainer({rowIndex:u,colIndex:f},{dataObj:{comment:{value:l,isVisible:r.isUndefined(r.XLEdit.getPropertyValue(u,f,"comment"))?this._isShowAllComments:r.XLEdit.getPropertyValue(u,f,"comment").isVisible}}});!s||this._isShowAllComments||r.XLEdit.getPropertyValue(u,f,"comment").isVisible||o.hide();r.setSheetFocus();this._isCommentEdit=!1;r.XLCellNav._isNavigate=!0;r.model.showRibbon&&r.XLRibbon._enableRibbonIcons();r.XLEdit._updateUsedRange(u,f);e.selectedCell[0].curComment=r.XLEdit.getPropertyValue(u,f,"comment");r._isUndoRedo||i==="paste"||(r._completeAction(e),r._trigActionComplete(e))},_updateCurrentCell:function(n,t,i){var r=this.XLObj,u={rowIndex:n,colIndex:t},f;i=i?i:r.model.activeSheetIndex;f=r.getSheet(i);f._activeCell=u;r.model.allowSelection&&r.XLSelection.selectRange(u,u,i);f._startCell=f._endCell=u;r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement()},_visibleCmntCnt:function(n,t){n.find(".e-comment")[t?"show":"hide"]()},_updateCmntArrowPos:function(t,i,r){var o,l,u,c,e,s,f=this.XLObj,i=f._getSheetIndex(i),h=f.getSheet(i),a=t||f._getContent(i).find(".e-commentcell");if(r=r||{},f.model.allowComments)for(o=0,l=a.length;o<l;o++)if((s=n(a[o]),u=f._getCellIdx(s[0]),!(u.rowIndex<r.rowIndex)&&!(u.colIndex<r.colIndex))&&(e=s.find(".e-comment"),f._isInsdel&&(u.rowIndex in h._commentColl||(h._commentColl[u.rowIndex]={}),h._commentColl[u.rowIndex][u.colIndex]={isComment:!0}),e.length)){if(c=f._getCellInfo(u,i),h.columnsWidthCollection[u.colIndex]<5){e.hide();continue}e.is(":hidden")&&e.show();e.css({top:c.top+"px",left:c.left+s.width()+"px"})}},_updateCmntFrmCntnr:function(n,t){var i=this.XLObj;i.XLEdit.getPropertyValue(n,t,"comment")&&(i._isRowViewable(null,t)&&i.getCell(n,t).hasClass("e-commentcell")&&this.deleteComment([n,t,n,t]),this.setComment([n,t,n,t],null,!1))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.contextmenu=function(n){this.XLObj=n;this._clrFltrEnable=!1;this._isMenuOpened=!1;this._uniqueClass=n._id+"-cmenu";this._selColor="";this._changedDataSource=!1;this._rowCellMenuDataMobile=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"PasteSpecial",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"FormatCells",text:n._getLocStr("FormatCells")+"...",parentId:null,spriteCssClass:"e-icon e-ss-formatcells"},{id:"BackgroundColor",text:n._getLocStr("BackgroundColor"),parentId:null,spriteCssClass:"e-icon e-ss-backgroundcolor"},{id:"FontColor",text:n._getLocStr("FontColor"),parentId:null,spriteCssClass:"e-icon e-ss-fontcolor"},];this._headerMenuDataMobile=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"PasteSpecial",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"Insert",text:n._getLocStr("Insert"),parentId:null},{id:"Delete",text:n._getLocStr("Delete"),parentId:null},{id:"Hide",text:n._getLocStr("Hide"),parentId:null},{id:"Unhide",text:n._getLocStr("Unhide"),parentId:null},];this._rowCellMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"Paste",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"PasteSpecial",text:n._getLocStr("PasteSpecial"),parentId:"Paste"},{id:"PasteValues",text:n._getLocStr("PasteValues"),parentId:"Paste"},{id:"Insert",text:n._getLocStr("Insert")+"...",parentId:null},{id:"Delete",text:n._getLocStr("Delete")+"...",parentId:null},{id:"Filter",text:n._getLocStr("Filter"),parentId:null,spriteCssClass:"e-icon e-ss-filter"},{id:"ClearFilter",parentId:"Filter",text:n._getLocStr("ClearFilter"),spriteCssClass:"e-icon e-ss-filternone"},{id:"FilterSelected",parentId:"Filter",text:n._getLocStr("FilterSelected"),spriteCssClass:"e-icon e-ss-filter"},{id:"Sort",text:n._getLocStr("Sort"),parentId:null,spriteCssClass:"e-icon e-ss-sortatoz"},{id:"SortAtoZ",parentId:"Sort",text:n._getLocStr("SortAtoZ"),spriteCssClass:"e-icon e-ss-sortatoz"},{id:"SortZtoA",parentId:"Sort",text:n._getLocStr("SortZtoA"),spriteCssClass:"e-icon e-ss-sortztoa"},{id:"PutCellColor",parentId:"Sort",text:n._getLocStr("PutCellColor"),spriteCssClass:""},{id:"PutFontColor",parentId:"Sort",text:n._getLocStr("PutFontColor"),spriteCssClass:""},{id:"ctxComment",parentId:null,text:n._getLocStr("Comment")},{id:"ctxInsrtCmnt",text:n._getLocStr("InsertComment"),parentId:"ctxComment",spriteCssClass:"e-icon e-ss-newcmnt"},{id:"ctxEditCmnt",text:n._getLocStr("EditComment"),parentId:"ctxComment",spriteCssClass:"e-icon e-ss-editcmnt"},{id:"ctxDeleteCmnt",text:n._getLocStr("DeleteComment"),parentId:"ctxComment",spriteCssClass:"e-icon e-ss-deletecmnt"},{id:"ctxShwHdCmnt",text:n._getLocStr("ShowHide"),parentId:"ctxComment",spriteCssClass:"e-icon"},{id:"FormatCells",text:n._getLocStr("FormatCells")+"...",parentId:null,spriteCssClass:"e-icon e-ss-formatcells"},{id:"CmHyperLink",text:n._getLocStr("HyperLink"),parentId:null,spriteCssClass:"e-icon e-ss-hyperlink"},{id:"HyperLink",text:n._getLocStr("HyperLink")+"...",parentId:"CmHyperLink",spriteCssClass:"e-icon e-ss-hyperlink"},{id:"EditLink",text:n._getLocStr("EditLink")+"...",parentId:"CmHyperLink"},{id:"OpenLink",text:n._getLocStr("OpenLink"),parentId:"CmHyperLink"},{id:"RemoveLink",text:n._getLocStr("RemoveLink"),parentId:"CmHyperLink",spriteCssClass:"e-icon e-ss-removelink"},{id:"ClearContents",text:n._getLocStr("ClearContents"),parentId:null,spriteCssClass:"e-icon e-ss-clear"}];this._rowHeaderMenuData=this._columnHeaderMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"Paste",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"PasteSpecial",text:n._getLocStr("PasteSpecial"),parentId:"Paste"},{id:"PasteValues",text:n._getLocStr("PasteValues"),parentId:"Paste"},{id:"Insert",text:n._getLocStr("Insert"),parentId:null},{id:"Delete",text:n._getLocStr("Delete"),parentId:null},{id:"ClearContents",text:n._getLocStr("ClearContents"),parentId:null,spriteCssClass:"e-icon e-ss-clear"},{id:"Hide",text:n._getLocStr("Hide"),parentId:null},{id:"Unhide",text:n._getLocStr("Unhide"),parentId:null}];this._footerMenuData=[{id:"InsertSheet",text:n._getLocStr("InsertSheet"),parentId:null},{id:"DeleteSheet",text:n._getLocStr("DeleteSheet"),parentId:null,spriteCssClass:"e-icon e-ss-delete"},{id:"RenameSheet",text:n._getLocStr("RenameSheet"),parentId:null,spriteCssClass:"e-icon "},{id:"MoveorCopy",text:n._getLocStr("MoveorCopy")+"...",parentId:null,spriteCssClass:"e-icon "},{id:"HideSheet",text:n._getLocStr("HideSheet"),parentId:null,spriteCssClass:"e-icon "},{id:"UnhideSheet",text:n._getLocStr("UnhideSheet"),parentId:null,spriteCssClass:"e-icon "},{id:"ProtectSheet",text:n._getLocStr("Protectsheet"),parentId:null,spriteCssClass:"e-icon e-ss-cmenuprotect"}];this._chartMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"ChartType",text:n._getLocStr("ChangeChartType")+"...",parentId:null},{id:"SelectData",text:n._getLocStr("SelectData")+"...",parentId:null}];this._imgMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"ChangePicture",text:n._getLocStr("ChangePicture"),parentId:null}];this._pivotMenuData=[{id:"Refresh",text:n._getLocStr("Refresh"),parentId:null,spriteCssClass:"e-icon e-ss-pivotrefresh"}];this._protectRowMenuIds=["Insert","Delete","Filter","ctxComment","Sort","LockCells","CmHyperLink","FormatCells","ClearContents"];this._prtctHeaderIds=["Insert","Delete","Hide","Unhide","ClearContents"];this._footerIds=["InsertSheet","DeleteSheet","RenameSheet","MoveorCopy","HideSheet","UnhideSheet"]};t.Menu.prototype._calculateContextMenuPosition=function(t){var e=this.element.get(0).id,u=this.element.data("id"),f=n("#"+u).data("ejSpreadsheet"),i,r;return locationX=t.clientX+this.element.width()<n(window).width()?t.pageX:t.pageX-this.element.width(),i=f&&e.indexOf(u+"_contextMenuFooter")>-1?f.element.height():n(window).height(),locationY=t.clientY+this.element.height()<i?t.pageY:t.clientY>this.element.height()?t.pageY-this.element.height():i-this.element.outerHeight(),r=n("body").css("position")!="static"?n("body").offset():{left:0,top:0},locationX-=r.left,locationY-=r.top,{X:locationX,Y:locationY}};t.spreadsheetFeatures.contextmenu.prototype={_initContextMenu:function(){var n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none",width:"auto"},{id:this.XLObj._id+"_contextMenuCell"});this._createMenu(n,this.XLObj._phoneMode||this.XLObj._tabMode?this._rowCellMenuDataMobile:this._rowCellMenuData,"#"+this.XLObj._id+" .e-spreadsheetcontentcontainer");n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none"},{id:this.XLObj._id+"_contextMenuColumnHeader"});this._createMenu(n,this._columnHeaderMenuData,"#"+this.XLObj._id+" .e-spreadsheetheader .e-headercontent");n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none"},{id:this.XLObj._id+"_contextMenuRowHeader"});this._createMenu(n,this._rowHeaderMenuData,"#"+this.XLObj._id+" .e-rowheadercontent")},_initCMenuFooter:function(){var n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none"},{id:this.XLObj._id+"_contextMenuFooter"});n.data("id",this.XLObj._id);this._createMenu(n,this._footerMenuData,"#"+this.XLObj._id+" .e-pagercontainer")},_createMenu:function(i,r,u){i.ejMenu({fields:{dataSource:r,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.ContextMenu,openOnClick:!1,beforeOpen:n.proxy(this._beforeOpen,this),close:n.proxy(this._menuClose,this),click:n.proxy(this._menuClick,this),contextMenuTarget:u})},hideCMenu:function(){var t=this.XLObj;t.model.enableContextMenu&&(n("#"+t._id+"_contextMenuCell").data("ejMenu").element.hide(),n("#"+t._id+"_contextMenuColumnHeader").data("ejMenu").element.hide(),n("#"+t._id+"_contextMenuRowHeader").data("ejMenu").element.hide(),n("#"+t._id+"_contextMenuFooter").data("ejMenu").element.hide())},_getCMenuObj:function(i){var r=this.XLObj;switch(i){case t.Spreadsheet.ContextMenu.Cell:return n("#"+r._id+"_contextMenuCell").data("ejMenu");case t.Spreadsheet.ContextMenu.RowHeader:return n("#"+r._id+"_contextMenuRowHeader").data("ejMenu");case t.Spreadsheet.ContextMenu.ColumnHeader:return n("#"+r._id+"_contextMenuColumnHeader").data("ejMenu");case t.Spreadsheet.ContextMenu.Footer:return n("#"+r._id+"_contextMenuFooter").data("ejMenu")}},addItem:function(t,i,r,u){if(t&&!this.XLObj.model.isReadOnly){var c=this._getCMenuObj(t),s=!1,f,e,h,o;f=n.extend(!0,[],c.model.fields.dataSource);switch(r){case"insert":n.merge(f,i);s=!0;break;case"insertbefore":for(e=i.length,o=u-1||0;e>0;)f.splice(o,0,i[e-1]),e--;s=!0;break;case"insertafter":for(e=i.length,h=0,o=u||f.length;h<e;)f.splice(o,0,i[h]),h++,o++;s=!0}s&&this.changeDataSource(t,f)}},removeItem:function(t,i){if(t&&!this.XLObj.model.isReadOnly){var e=this._getCMenuObj(t),r,u,f=[];for(u=n.extend(!0,[],e.model.fields.dataSource),r=0,length=u.length;r<length;r++)i.indexOf(r+1)==-1&&f.push(u[r]);this.changeDataSource(t,f)}},enableItem:function(n,t){if(n&&!this.XLObj.model.isReadOnly){var r=this._getCMenuObj(n),i;if(t&&t.length>0)for(i=0,length=t.length;i<length;i++)r.enableItemByID(r.element.find("li:eq("+(t[i]-1)+")")[0].id);else r.enable()}},disableItem:function(n,t){if(n&&!this.XLObj.model.isReadOnly){var r=this._getCMenuObj(n),i;if(t&&t.length>0)for(i=0,length=t.length;i<length;i++)r.disableItemByID(r.element.find("li:eq("+(t[i]-1)+")")[0].id);else r.disable()}},changeDataSource:function(n,i){if(n&&!this.XLObj.model.isReadOnly&&i){var r=this._getCMenuObj(n);this._changedDataSource=!0;switch(n){case t.Spreadsheet.ContextMenu.Cell:this._rowCellMenuDataMobile=this._rowCellMenuData=i;break;case t.Spreadsheet.ContextMenu.RowHeader:this._headerMenuDataMobile=this._rowHeaderMenuData=i;break;case t.Spreadsheet.ContextMenu.ColumnHeader:this._headerMenuDataMobile=this._columnHeaderMenuData=i;break;case t.Spreadsheet.ContextMenu.Footer:this._footerMenuData=i}r&&r.option("fields",{dataSource:i})}},_updateContextMenuItems:function(i){var r=this.XLObj,d,g,ht=n("#"+r._id+"_contextMenuColumnHeader").data("ejMenu"),ct=n("#"+r._id+"_contextMenuRowHeader").data("ejMenu"),ut,nt=i[0],h=r.getActiveSheetIndex(),v=r.getSheet(h),st=!t.isNullOrUndefined(r.getActiveCellElem())&&r.getActiveCellElem().length>0?r.getActiveCellElem():i,f=r._phoneMode||r._tabMode?this._rowCellMenuDataMobile:this._rowCellMenuData,u=n("#"+r._id+"_contextMenuCell").data("ejMenu"),e=n("#"+r._id+"_contextMenuFooter").data("ejMenu"),a=r.getActiveCell(h),ft,c,s,et,it,b,p,ot,k,rt,o;if(i.hasClass("e-rowcell")||i.hasClass("e-hyperlinks")){var l,y=[],lt=r._getJSSheetHeader(h).find("th"),at=r._getJSSheetRowHeader(h).find("td"),tt=r.XLEdit.getPropertyValue(v._activeCell.rowIndex,v._activeCell.colIndex),w=r._getCellIdx(r._hasClass(i,"e-hyperlinks")?i.parents("td")[0]:nt);if(this._isMenuOpened=!0,r.model.allowLockCell&&v.isSheetProtected&&r.XLEdit.getPropertyValue(w.rowIndex,w.colIndex,"isLocked",h))this._disableMenuOpt(this._protectRowMenuIds);else{if(i.hasClass("e-hyperlinks")&&(i=i.parents("td"),nt=i[0]),r.model.allowHyperlink?(this._enableMenuOpt(["CmHyperLink"]),et=r.XLEdit.getPropertyValue(w.rowIndex,w.colIndex,"hyperlink",h),it=["EditLink","OpenLink","RemoveLink"],t.isNullOrUndefined(et)?(this._disableMenuOpt(it),this._enableMenuOpt(["HyperLink"])):(this._enableMenuOpt(it),this._disableMenuOpt(["HyperLink"]))):this._disableMenuOpt(["CmHyperLink"]),r.model.allowFiltering){if(u.enableItemByID("Filter"),s=r.model.sheets[h].filterSettings.tableRange,b=r.getCell(a.rowIndex,a.colIndex,h)[0],s.length>0){for(ft=b.className.indexOf("e-table")>-1?b.className[b.className.indexOf("e-table")+7]:-1,p=0,ot=s.length;p<ot;p++)if(s[p].tableID===parseInt(ft)){c=p;break}!t.isNullOrUndefined(c)&&a.rowIndex<s[c].selectedRange.endRow+1&&a.rowIndex>s[c].selectedRange.startRow-2&&a.colIndex<s[c].multifilterIdx[s[c].multifilterIdx.length-1]+1&&a.colIndex>s[c].multifilterIdx[0]-1&&(d=r.getCell(s[c].selectedRange.startRow-1,a.colIndex,h).find("span"),d.length&&d[0].className.indexOf("e-ssfiltered")>-1&&(u.enableItemByID("ClearFilter"),this._clrFltrEnable=!0))}this._clrFltrEnable||u.disableItemByID("ClearFilter")}else u.disableItemByID("Filter");r.model.allowInsert&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?u.enableItemByID("Insert"):u.disableItemByID("Insert");r.model.allowDelete&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?u.enableItemByID("Delete"):u.disableItemByID("Delete");(r.XLClipboard._copyBackup.cells||r.XLClipboard._copyBackup.elem)&&!r.model.isReadOnly?(this._enableMenuOpt(["Paste"]),r.isPasteValuesOnly&&u.disableItemByID("PasteSpecial")):this._disableMenuOpt(["Paste"]);r.model.allowSorting?this._enableMenuOpt(["Sort"]):this._disableMenuOpt(["Sort"]);r.model.allowClear?this._enableMenuOpt(["ClearContents"]):this._disableMenuOpt(["ClearContents"]);r.model.allowCellFormatting?this._enableMenuOpt(["FormatCells"]):this._disableMenuOpt(["FormatCells"]);r._phoneMode||r._tabMode||(y=!t.isNullOrUndefined(tt)&&n.isNumeric(tt)?[r._getLocStr("SortSmallesttoLargest"),r._getLocStr("SortLargesttoSmallest")]:t.isNullOrUndefined(t.parseDate(tt))?[r._getLocStr("SortAtoZ"),r._getLocStr("SortZtoA")]:[r._getLocStr("SortOldesttoNewest"),r._getLocStr("SortNewesttoOldest")],r.model.allowComments?(u.element.find("#ctxComment").hasClass("e-disable-item")&&this._enableMenuOpt(["ctxComment"]),k=r.getSheetElement(r.getActiveSheetIndex()).find(".e-selected"),rt=k.length>1?st:i,rt.hasClass("e-commentcell")?(this._disableMenuOpt(["ctxInsrtCmnt"]),r.XLEdit.getPropertyValueByElem(rt,"comment").isVisible?(l=n.extend(f[19],{text:r._getLocStr("HideComment")}),u.remove(["#"+f[19].id]),u.insert([l],"#"+f[15].id)):(l=n.extend(f[19],{text:r._getLocStr("ShowHide")}),u.remove(["#"+f[19].id]),u.insert([l],"#"+f[15].id)),this._enableMenuOpt(["ctxEditCmnt","ctxDeleteCmnt","ctxShwHdCmnt"])):(this._enableMenuOpt(["ctxInsrtCmnt"]),this._disableMenuOpt(["ctxEditCmnt","ctxDeleteCmnt","ctxShwHdCmnt"])),k.filter(nt).length>0&&k.filter(".e-commentcell").length>0&&this._enableMenuOpt(["ctxDeleteCmnt"])):this._disableMenuOpt(["ctxComment"]),f[11].text!==y[0]&&(l=n.extend(f[11],{text:y[0],spriteCssClass:f[11].sprite}),u.remove(["#"+f[11].id]),u.insertBefore([l],"#"+f[13].id)),f[12].text!==y[1]&&(l=n.extend(f[12],{text:y[1],spriteCssClass:f[12].sprite}),u.remove(["#"+f[12].id]),u.insertBefore([l],"#"+f[13].id)));r.model.showRibbon&&r.XLRibbon._dirtySelect(r._getContent(r.getActiveSheetIndex()).find(".e-selected"))}r.model.allowInsert?e.enableItemByID("InsertSheet"):e.disableItemByID("InsertSheet");r.model.allowDelete?e.enableItemByID("DeleteSheet"):e.disableItemByID("DeleteSheet");r.model.allowClipboard?this._enableMenuOpt(["Cut","Copy"]):this._disableMenuOpt(["Cut","Copy"]);(r.XLClipboard._copyBackup.cells||r.XLClipboard._copyBackup.elem)&&!r.model.isReadOnly?this._enableMenuOpt(["Paste"],o):this._disableMenuOpt(["Paste"],o)}else if(i.hasClass("e-link")){if(g=e.model.fields.dataSource.slice(0),r._isSheetRename&&!r._updateSheetNames()){args.cancel=!0;return}ut=r.model.allowLockCell&&v.isSheetProtected?r._getLocStr("Unprotect"):r._getLocStr("Protectsheet");g[6].text=ut;e.option("fields",{id:"id",dataSource:g,parentId:"parentId"});this._isMenuOpened=!0;r._isCommentEdit&&r.XLComment._updateCurCmntVal();i.not("a.e-currentitem, a.e-PP, a.e-NP").hasClass("e-numericitem")&&r.gotoPage(i.data("index"));r.model.exportSettings.password?this._disableMenuOpt(this._footerIds,"contextMenuFooter"):(r._getSheetNames(!1).length>0?e.enableItemByID("UnhideSheet"):e.disableItemByID("UnhideSheet"),r._getSheetNames(!0).length>1?(e.enableItemByID("DeleteSheet"),e.enableItemByID("HideSheet"),e.enableItemByID("MoveorCopy")):(e.disableItemByID("DeleteSheet"),e.disableItemByID("HideSheet"),e.disableItemByID("MoveorCopy")));r.model.allowLockCell?e.enableItemByID("ProtectSheet"):e.disableItemByID("ProtectSheet")}else(i.hasClass("e-headercelldiv")||i.hasClass("e-headercell")||i.hasClass("e-rowheader"))&&(o=i.hasClass("e-rowheader")?"contextMenuRowHeader":"contextMenuColumnHeader",r.model.allowClipboard?this._enableMenuOpt(["Cut","Copy"],o):this._disableMenuOpt(["Cut","Copy"],o),(r.XLClipboard._copyBackup.cells||r.XLClipboard._copyBackup.elem)&&!r.model.isReadOnly?this._enableMenuOpt(["Paste"],o):this._disableMenuOpt(["Paste"],o),r.model.allowLockCell&&v.isSheetProtected?this._disableMenuOpt(this._prtctHeaderIds,o):(r.model.allowClear?this._enableMenuOpt(["ClearContents"],o):this._disableMenuOpt(["ClearContents"],o),r.model.allowInsert&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?this._enableMenuOpt(["Insert"],o):this._disableMenuOpt(["Insert"],o),r.model.allowDelete&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?this._enableMenuOpt(["Delete"],o):this._disableMenuOpt(["Delete"],o),this._enableMenuOpt(["Hide","Unhide"],o)),r.model.showRibbon&&r.XLRibbon._dirtySelect(r._getContent(r.getActiveSheetIndex()).find(".e-selected")));r.model.allowInsert&&t.isNullOrUndefined(r.model.exportSettings.password)?this._enableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter"):this._disableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter");r.model.exportSettings.password?this._disableMenuOpt(["RenameSheet"]):this._enableMenuOpt(["RenameSheet"]);r.model.allowDelete&&r._getSheetNames(!0).length>1?this._enableMenuOpt(["DeleteSheet"],"contextMenuFooter"):this._disableMenuOpt(["DeleteSheet"],"contextMenuFooter");r.model.allowEditing?this._enableMenuOpt(["RenameSheet"],"contextMenuFooter"):this._disableMenuOpt(["RenameSheet"],"contextMenuFooter");r.model.isReadOnly&&(this._disableMenuOpt(["Cut","Insert","Delete","ClearContents"],"contextMenuColumnHeader"),this._disableMenuOpt(["Cut","Insert","Delete","ClearContents"],"contextMenuRowHeader"),this._disableMenuOpt(["Cut","Insert","Delete","Filter","Sort","ctxComment","FormatCells","CmHyperLink","ClearContents"],"contextMenuCell"))},_beforeOpen:function(i){var r=this.XLObj,s=r.XLResize,v,w,c,l;if(!r.model.enableContextMenu||i.events.type=="mousedown"&&i.target.id.indexOf("_picture")>-1||n(i.target).hasClass("e-numericitem")&&r.model.isReadOnly)return i.cancel=!0,!1;this._clrFltrEnable=!1;this.hideCMenu();var y=n("#"+r._id+"_contextMenuColumnHeader").data("ejMenu"),p=n("#"+r._id+"_contextMenuRowHeader").data("ejMenu"),a=i.target,b={target:a},u=n(a),o=r.getActiveSheetIndex(),h=r.getSheet(o),k=!t.isNullOrUndefined(r.getActiveCellElem())&&r.getActiveCellElem().length>0?r.getActiveCellElem():u,f=r._phoneMode||r._tabMode?this._rowCellMenuDataMobile:this._rowCellMenuData,e=n("#"+r._id+"_contextMenuCell").data("ejMenu"),d=n("#"+r._id+"_contextMenuFooter").data("ejMenu"),g=r.getActiveCell(o);r._trigger("beforeOpen",b)||((r.XLEdit._isEdit||r.model.allowComments&&r.XLComment._isCommentEdit||u.hasClass("e-filterspan")||i.events.which===1&&u.hasClass("e-hyperlinks")||u.parents("div").hasClass("e-vscroll")||u.parents("div").hasClass("e-hscroll")||n(a.parentNode).hasClass("e-pagercontainer")&&!u.hasClass("e-link")||!t.isNullOrUndefined(r.XLResize)&&r.XLResize._resizeStart||i.target.id.indexOf("Sheet_RenamePanel")>-1||u.parents().hasClass("e-grid")||u.hasClass("e-autofill"))&&(i.cancel=!0),s&&s._preventColResize(u.parent()[0].cellIndex,!0)&&u.hasClass("e-headercelldiv")&&(i.cancel=!0),s&&s._preventRowResize(parseInt(u.parent().attr("idx")),!0)&&u.hasClass("e-rowheader")&&(i.cancel=!0),u.hasClass("e-rowcell")||u.hasClass("e-hyperlinks")?(v=r._getJSSheetHeader(o).find("th"),w=r._getJSSheetRowHeader(o).find("td"),t.isNullOrUndefined(r.XLEdit.getPropertyValueByElem(r.getCell(h._activeCell.rowIndex,h._activeCell.colIndex),"range"))?n(v[u.index()]).hasClass("e-colselected")||n(w[u.parent().index()]).hasClass("e-rowselected")?(f=n(v[u.index()]).hasClass("e-colselected")?this._columnHeaderMenuData:this._rowHeaderMenuData,JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&this._changedDataSource&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"})):JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"}):(c=r.model.sheets[o].rangeSettings[r.XLEdit.getPropertyValueByElem(r.getCell(h._activeCell.rowIndex,h._activeCell.colIndex),"range")],e.option("fields",{dataSource:c.contextMenuSettings.dataSource,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"}),e.option("width",c.contextMenuSettings.width),e.option("height",c.contextMenuSettings.height))):u.hasClass("e-ss-imgvisual")||u.hasClass("e-ss-object")||u.closest("div").hasClass("e-ss-object")?(l=n.extend(!0,[],this._chartMenuData),this._isMenuOpened=!0,l=this.XLObj.model.showRibbon?this._chartMenuData:l.splice(0,2),f=r.XLShape._shapeType==="chart"?l:this._imgMenuData,JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"})):u.hasClass("e-ss-pivot")||u.closest("div").hasClass("e-ss-pivot")?(f=this._pivotMenuData,JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"})):(u.hasClass("e-headercelldiv")||u.hasClass("e-headercell")||u.hasClass("e-rowheader"))&&(r._phoneMode||r._tabMode?(y.option("fields",{dataSource:this._headerMenuDataMobile}),p.option("fields",{dataSource:this._headerMenuDataMobile})):this._changedDataSource&&(y.option("fields",{dataSource:this._columnHeaderMenuData}),p.option("fields",{dataSource:this._rowHeaderMenuData}))),this._changedDataSource||this._updateContextMenuItems(u),i.cancel&&(this._isMenuOpened=!1))},_menuClick:function(n){this.XLObj._trigger("contextMenuClick",n)||this._processCMenu(n.ID,n.events.element)},_menuClose:function(){this._isMenuOpened=!1},_processCMenu:function(i,r){var k,f,u=this.XLObj,e=u.getActiveSheetIndex(),a,v,s=u.getSheet(e),y,p,h,c,o=s._selectedCells,w,b,l;switch(i){case"Cut":u.XLClipboard.cut();break;case"Copy":u.XLClipboard.copy();break;case"PasteSpecial":case"PasteValues":u.XLClipboard._isSpecial=!(i==="PasteValues");u.XLClipboard.paste();break;case"Insert":u._insDelStatus="insert";s._isColSelected?(h=u._getJSSheetHeader(e).find(".e-colhighlight"),u.insertEntireColumn(h[0].cellIndex,h[h.length-1].cellIndex)):s._isRowSelected?(c=u._getJSSheetRowHeader(e).find(".e-rowhighlight"),a=u._getCellIdx(c[0]),v=u._getCellIdx(c[c.length-1]),u.insertEntireRow(a.rowIndex,v.rowIndex)):u._showDialog(u._id+"_Ribbon_Others_Cells_InsertCellOptions");break;case"Delete":h=n(u._getJSSheetHeader(e).find("tr")[0]).find(".e-colselected");c=n(u.getRows(e)[0]).find(".e-rowselected");r.parentElement.id.indexOf("ColumnHeader")>-1||s._isColSelected?(h=u._getJSSheetHeader(e).find(".e-colhighlight"),u.deleteEntireColumn(h[0].cellIndex,h[h.length-1].cellIndex,[])):r.parentElement.id.indexOf("RowHeader")>-1||s._isRowSelected?(c=u._getJSSheetRowHeader(e).find(".e-rowhighlight"),a=u._getCellIdx(c[0]),v=u._getCellIdx(c[c.length-1]),u.deleteEntireRow(a.rowIndex,v.rowIndex,[])):u._showDialog(u._id+"_Ribbon_Others_Cells_DeleteCellOptions");break;case"FilterSelected":u._showDialog(u._id+"_Ribbon_Data_SortFilter_Filter");u.XLFilter.filterByActiveCell();this._clrFltrEnable=!1;break;case"ClearFilter":y=u.getActiveCell(e);w=u.XLEdit.getPropertyValue(y.rowIndex,y.colIndex,"tableName");b=t.isNullOrUndefined(w)?-1:parseInt(w.replace("table",""));b>-1?(p=u.model.sheets[e].columns[y.colIndex].field,u.XLFilter._clearFilterColumn(p,"","","","","",b),delete u._excelFilter._predicates[e][p]):u.XLFilter.clearFilter("apply");this._clrFltrEnable=!1;break;case"SortAtoZ":case"SortZtoA":case"SortSmallesttoLargest":case"SortLargesttoSmallest":case"SortOldesttoNewest":case"SortNewesttoOldest":case"PutCellColor":case"PutFontColor":u.model.allowSorting&&u.XLSort._sortHandler(i);break;case"ClearContents":l=u.model.sheets[e].selectedRange;u.clearContents(u._getAlphaRange(e,l[0],l[1],l[2],l[3]));break;case"InsertSheet":u.insertSheet();break;case"DeleteSheet":u.deleteSheet(e);break;case"RenameSheet":u._renameSheet();break;case"MoveorCopy":u._showDialog(u._id+"_MoveorCopy");break;case"Hide":s._isColSelected&&u._hideColumn(o[0].colIndex,o[o.length-1].colIndex);s._isRowSelected&&u._hideRow(o[0].rowIndex,o[o.length-1].rowIndex,"isRHide");break;case"Unhide":s._isColSelected&&u._showColumn(o[0].colIndex,o[o.length-1].colIndex);s._isRowSelected&&u._showRow(o[0].rowIndex,o[o.length-1].rowIndex,"isRHide");break;case"HyperLink":case"EditLink":u._showDialog(u._id+"_Ribbon_Insert_Links_Hyperlink");break;case"RemoveLink":u._removeHyperlink();break;case"OpenLink":u._openLink();break;case"ctxInsrtCmnt":u._dupDetails=!0;u.XLComment.setComment();u._dupDetails=!1;break;case"ctxEditCmnt":u.XLComment.editComment();break;case"ctxDeleteCmnt":u.XLComment.deleteComment();break;case"ctxShwHdCmnt":u.XLComment.showHideComment();break;case"ChangePicture":u._uploadImage=!0;u.XLShape._changePicture=!0;u.element.find("#"+u._id+"_file .e-uploadinput").click();break;case"ChartType":u._showDialog(u._id+"_Ribbon_ChartDesign_Type_ChangeChartType");u.XLRibbon._refreshChartTypeDlg();break;case"SelectData":u._showDialog(u._id+"_Ribbon_ChartDesign_Data_SelectData");k=document.getElementById(u._id+"_chart").value;f=u.XLChart._getShapeObj(k,"chart");n("#"+u._id+"_crxaxis").val(f.xRange?u._getAlphaRange(e,f.xRange[0],f.xRange[1],f.xRange[2],f.xRange[3]):"");n("#"+u._id+"_cryaxis").val(f.yRange?u._getAlphaRange(e,f.yRange[0],f.yRange[1],f.yRange[2],f.yRange[3]):"");n("#"+u._id+"_crlaxis").val(f.lRange?u._getAlphaRange(e,f.lRange[0],f.lRange[1],f.lRange[2],f.lRange[3]):"");u._selectDataval={xRange:n("#"+u._id+"_crxaxis").val(),yRange:n("#"+u._id+"_cryaxis").val(),lRange:n("#"+u._id+"_crlaxis").val()};n("#"+u._id+"_chartrangedlg").ejDialog("open");break;case"HideSheet":u.hideSheet();break;case"UnhideSheet":u._showDialog(u._id+"_UnhideSheet");break;case"ProtectSheet":u.protectSheet(!s.isSheetProtected);break;case"FormatCells":u._showDialog(u._id+"_FormatCells");break;case"Refresh":u.XLPivot.refreshDataSource();break;case"BackgroundColor":n("#"+this.XLObj._id+"_colordlg").ejDialog("open");this._selColor={action:"bg-color",color:""};break;case"FontColor":n("#"+this.XLObj._id+"_colordlg").ejDialog("open");this._selColor={action:"color",color:""}}},_disableMenuOpt:function(t,i){var e=i||"contextMenuCell",u=n("#"+this.XLObj._id+"_"+e).data("ejMenu"),r,f;if(u)for(r=0,f=t.length;r<f;r++)u.disableItemByID(t[r])},_enableMenuOpt:function(t,i){var e=i||"contextMenuCell",u=n("#"+this.XLObj._id+"_"+e).data("ejMenu"),r,f;if(u)for(r=0,f=t.length;r<f;r++)u.enableItemByID(t[r])},_initColorDialog:function(){var r=this.XLObj,i=r._id+"_colordlg";if(!n("#"+i).length){var u=t.buildTag("div#"+i+".e-colordlg e-"+r._id+"-dlg ","",{display:"none"}),f=t.buildTag("div#"+i+"_dlgcontent .e-colordlgcontent"),h=t.buildTag("input#"+i+"_cpicker"),c=t.buildTag("div#"+i+"_condiv .e-dlg-btnctnr"),e=t.buildTag("input#"+this._id+"_dialog_Ok"),o=t.buildTag("input#"+this._id+"_dialog_Can","",{"margin-left":10}),s=t.buildTag("div#"+i+"_dlgbtncontent .e-dlg-btnfields");f.append(h);u.append(f);r.element.append(u);u.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,title:r._getLocStr("ColorPicker"),width:"240",height:"auto",minHeight:0,cssClass:"e-ss-dialog e-"+r._id+"-dlg"});n("#"+i+"_cpicker").ejColorPicker({value:"#278787",modelType:"palette",presetType:"basic",cssClass:"e-ss-colorpicker e-ss-menuclrpkr",select:n.proxy(this._cpClickHandler,this),showApplyCancel:!1});n("#"+i+"_cpickerWrapper").hide();f.append(n("#"+i+"_cpicker_popup").css("display","block"));e.ejButton({text:r._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._colorOkClick,this),enabled:!0});o.ejButton({text:r._getLocStr("Cancel"),showRoundedCorner:!0,width:60,click:t.proxy(this._colorCanClick,this)});s.append(c.append(e,o));u.append(s)}},_cpClickHandler:function(n){this._selColor.color=n.value},_colorOkClick:function(){var t=this.XLObj;t.XLFormat.format({style:this._selColor.action==="bg-color"?{"background-color":this._selColor.color}:{color:this._selColor.color}});t.setSheetFocus();n("#"+t._id+"_colordlg").ejDialog("close")},_colorCanClick:function(){n("#"+this.XLObj._id+"_colordlg").ejDialog("close")}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.sorting=function(n){this.XLObj=n;this._isSortByFilter=!1};t.spreadsheetFeatures.sorting.prototype={_sortHandler:function(n){var e,v,y,p,w,b,k,l,s,h,d,o,a={},g="",r={},i=this.XLObj,tt=i._formatRegx,c=i.getActiveSheetIndex(),u=i.getSheet(c),f=u._selectedCells,nt;if(g=u.columns[u._activeCell.colIndex].field,this._isSortByFilter=!1,n!="PutCellColor"&&n!="PutFontColor"){if(!i.model.allowSorting||!u._selectedCells.length)return;if(f.length===1&&i.selectAll(),b=n==="Ribbon_SortZtoA"||n==="SortZtoA"?t.sortOrder.Descending:t.sortOrder.Ascending,k=i.XLEdit.getPropertyValue(u._activeCell.rowIndex,u._activeCell.colIndex,"tableName",c)||"",l=i._getTableID(k),t.isNullOrUndefined(l)){if(r=u.selectedRange.slice(0),s=r[0],h=r[1],s===r[2])return;for(p=i.XLEdit.getPropertyValue(s,h),e=s+1;e<=r[2];e++)if(!i._isHiddenRow(e)){w=i.XLEdit.getPropertyValue(e,h);break}v=i.isNumber(p)?t.Spreadsheet.CellType.Number:t.Spreadsheet.CellType.String;y=i.isNumber(w)?t.Spreadsheet.CellType.Number:t.Spreadsheet.CellType.String;i.XLEdit.getPropertyValue(s,h,"merge")||i.XLEdit.getPropertyValue(e,h,"merge")||i.XLEdit.getPropertyValue(r[0],r[1],"calcValue")||(v!=y||i.XLEdit.getPropertyValue(r[0],r[1],"wrap")||i.XLEdit.getPropertyValue(r[0],r[1],"isFilterHeader"))&&r[0]++}else r=u.tableManager[l].range.slice(0),r[0]++;this.sortByRange(r,g,b)}else nt=f.length===1?this._selectSortRange(c,f[0]):u._startCell.rowIndex,d=i._getAlphaRange(c,nt,f[0].colIndex,f.length===1?f[0].rowIndex:u._endCell.rowIndex,f[0].colIndex),o=i.XLEdit.getPropertyValue(u._activeCell.rowIndex,u._activeCell.colIndex,"formats"),i.isUndefined(o)||(o["background-color"]&&(a["background-color"]=o["background-color"].toLowerCase()),o.color&&(a.color=o.color.toLowerCase()),this.sortByColor(n,a,d));f.length===1&&(i.XLSelection.selectRange(f[0],f[0],c),u._startCell=u._endCell=f[0],i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement())},_selectSortRange:function(n,t){for(var u=this.XLObj,r=u.getSheet(n).filterSettings.tableRange,i=0,f=r.length;i<f;i++)if(r[i].multifilterIdx.indexOf(t.colIndex)>-1&&t.rowIndex>r[i].startRow-1&&t.rowIndex<r[i].endRow+1)return r[i].startRow;return u.selectAll(),u.getSheet(n)._selectedCells[0].rowIndex},sortByColor:function(n,i,r){var f=this.XLObj;if(r=f._getRangeArgs(r,"object"),f.model.allowSorting&&!this._sortRangeAlert(r)&&!f.model.isReadOnly){var o=f.getActiveSheetIndex(),u={oprType:n},e,s,c=f.getSheet(o),h;h=c.columns[r[1]].field;t.isNullOrUndefined(i)||(n==="PutCellColor"?(i["background-color"]&&(i=i["background-color"]),u.operation="sortbgcolor",u.bgcolor=i):(i.color&&(i=i.color),u.operation="sortfgcolor",u.fgcolor=i),u.requestType=u.action="sortbycolor",u.sortColumn=h,u.selRange={startCell:{rowIndex:r[0],colIndex:r[1]},endCell:{rowIndex:r[2],colIndex:r[3]}},u.rangeData=f.getRangeDataAsObject(u.selRange.startCell,u.selRange.endCell,!0)[0],u.sortRange=r,e=r[0],t.isNullOrUndefined(e)||(s=f.XLFilter._createSelection(o,e,r[2],r[1],[]).endRowIndex,e=n==="PutCellColor"||n==="PutFontColor"?e:e,u.range=f.model.sheets[o]._selectedRange={startRow:e,endRow:s,dataSourceIndexes:[]},f._processBindings(u)))}},_getSortColorRange:function(n){var r=this.XLObj,i=r.getCell(n.rowIndex,n.colIndex),u=!1,s,t,e=0,h=!1,f=n.rowIndex,o=n.colIndex;if(i.text().length<1){for(t=f;t<f+2;t++)if(i=r.getCell(t,o),i.is(":visible")&&i.text().length>0){u=!0;e=t;break}if(!u){for(t=f;t>f-2;t--)t>-1&&(i=r.getCell(t,o),i.text().length===0&&t>0&&(i=r.getCell(t-1,o),i.text().length==0&&(h=!0)));if(!h)for(t=f-2;t>0;t--)if(i=r.getCell(t,o),i.is(":visible")&&i.text().length===0){s=t+1;u=!0;e=s;break}}}else for(t=f;t>=0;t--){if(i=r.getCell(t,o),i.is(":visible")&&i.text().length===0){s=t+1;u=!0;e=s;break}u||t!=0||(e=t,u=!0)}if(u)return e;r._showAlertDlg("Alert","Alert",null,630)},_sortRangeAlert:function(n){for(var u,s,t=this.XLObj,i=i?i:t.getActiveSheetIndex(),e,o=t.getSheet(i)._mergeColl,n=t._getRangeArgs(n,"object"),f=t.getObjectKeys(o),r=0,h=f.length;r<h;r++)for(cKeys=t.getObjectKeys(o[f[r]]),u=0,s=cKeys.length;u<s;u++)if(e=t._dataContainer.sheets[i][f[r]][cKeys[u]].merge,mRange=t.getRangeIndices(e.mRange),n[0]<=mRange[0]&&n[2]>=mRange[2]||n[0]>=mRange[0]&&n[2]<mRange[2])return t._showAlertDlg("Alert","MergeSortAlert","",380),!0;return t.XLEdit._rangeHasProperty(n,"calcValue")?(t._showAlertDlg("Alert","FormulaSortAlert","",315),!0):!1},sortByRange:function(n,i,r){var u=this.XLObj;if(u.model.allowSorting&&!u.model.isReadOnly){var c,l=u.getActiveSheetIndex(),o=0,a=[],f={},v=[],e,y,s,h=u._getJSSheetHeader(l).find(".e-colselected").length;if(u.model.allowSorting){if(n=u._getRangeArgs(n,"object"),this._sortRangeAlert(n))return!0;if(this._isSortByFilter&&h<1){for(s=this._isSortByFilter?n[0]-1:n[0],y=u._getAlphaRange(l,s,n[1],s+1,n[3]),e=u._getAlphaRangeCells(y).find(".e-filterspan"),c=e.length;o<c;)v.push({colIndex:e[o].parentNode.cellIndex,rowIndex:e.eq(o).parents("tr").index()}),o++;e.length&&(n[0]=this._isSortByFilter?n[0]:n[0]+1)}return a=u.getRangeDataAsObject({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]},!0)[0],f.requestType=t.Spreadsheet.Actions.Sorting,f.range=n,f.columnName=i,f.rangeData=a,f.action="sorting",f.sortDirection=r,f.filterIcon=v,f.isSortByFilter=this._isSortByFilter,f.colSelected=h,u._processBindings(f),h&&this._isSortByFilter&&u.XLFilter._changeSortIcon({rowIndex:n[0]-1,colIndex:n[1]},r),!1}}},_sortComplete:function(n){var t=this.XLObj,i=n.range,r=this._swapSortedDatas(n),u=r[1];t._dupDetails=!0;n.rangeData=r[0];t.model.allowComments&&t.XLComment.deleteComment(i,null,!0,"comment");t._removeHyperlink(null,null,!0,i);t.clearRangeData(i,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0);t.model.allowCellFormatting&&t.XLFormat.removeStyle(i,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0});t.XLEdit.updateCellWithContainer(u,i,null,!0);this._refreshRowHeight(i,u);t._dupDetails=!1},_refreshRowHeight:function(n,t){for(var i,u,f=0,s=0,r=this.XLObj,e=r._getSheetIndex(),o=r.getSheet(e),h=r._getJSSheetContent(e).find(".e-content"),c=r._getJSSheetRowHeaderContent(e);n[0]+f<=n[2];){for(i=n[0]+f,u=(f-s)*(n[3]-n[1]+1);o.hideRowsCollection.indexOf(i)>-1||o._hiddenFreezeRows.indexOf(i)>-1&&i<n[2];)i++&&f++&&s++;r.model.scrollSettings.allowVirtualScrolling||(h.find("tr:eq("+i+")").height(t[u].rheight),c.find("tr:eq("+i+")").height(t[u].rheight));t[u]&&(o.rowsHeightCollection[i]=t[u].rheight);f++}r.XLScroll._getRowHeights(e,i);r.model.scrollSettings.allowVirtualScrolling&&r.refreshContent(e);o._isFreezed&&r.XLFreeze._refreshFreezeRowDiv()},_swapSortedDatas:function(t){for(var a,u,f,o=0,e=0,v=0,y=[],s=[],h=[],c=this.XLObj.getSheet(),p=t.model.currentViewData,b=p.length,k=this.XLObj._generateColCount(t.columnName)-1,w,i=t.range,l=i[3]-i[1]+1,d=k-i[1],r=this.XLObj.getRangeData({range:i,property:["value","value2","type","formatStr","formats","decimalPlaces","thousandSeparator","range","format","comment","hyperlink","rule"],skipHiddenRow:!0});i[0]+e<=i[2];){for(rowIdx=i[0]+e,u=(e-v)*(i[3]-i[1]+1);(c.hideRowsCollection.indexOf(rowIdx)>-1||c._hiddenFreezeRows.indexOf(rowIdx)>-1)&&rowIdx<i[2];)rowIdx++&&e++&&v++;r[u]&&(r[u].rheight=c.rowsHeightCollection[rowIdx]);e++}for(n.extend(!0,y,r),s.push(y);o<b;){for(a=p[o][t.columnName],f=d,w=r.length;f<w;){if(r[f].value===a){u=this._getMinIdx(f,l);h=h.concat(r.splice(u,l));break}f+=l}o++}return s.push(h),s},_getMinIdx:function(n,t){var i,r;if(i=r=t,n<t)return 0;while(i<=n){if(r+=t,r>n)return i;i+=t}}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.dragAndDrop=function(n){this.XLObj=n;this._isDragAndDropStart=!1;this._dragAndDropCell={rowIndex:0,colIndex:0};this._isDragAndDropped=!1;this._allowDragAndDrop=!1;this._target=null;this._cellIdx={}};t.spreadsheetFeatures.dragAndDrop.prototype={moveRangeTo:function(n,t){this._moveRangeTo(n,t)},_moveRangeTo:function(i,r,u){var f=this.XLObj,g,e,o;if(f.model.allowDragAndDrop&&!f.model.isReadOnly&&f.model.allowEditing){var s,l,p,w,c,a,v,b,h,nt,k=[],d=[],tt=[],y;for(s=f.getActiveSheetIndex(),l=f.getSheet(s),i=f.swapRange(f._toIntrnlRange(i,s)),r=f.swapRange(f._toIntrnlRange(r,s)),r[2]=r[0]+(i[2]-i[0]),r[3]=r[1]+(i[3]-i[1]),c={rowIndex:r[0],colIndex:r[1]},a={rowIndex:r[2],colIndex:r[3]},p=f.getRangeData({range:i,property:u||["value","value2","type","formatStr","decimalPlaces","thousandSeparator","range","format","border","borders","comment","hyperlink","picture","cFormatRule","rule","chart","isLocked","wrap","formats","tformats","tborders","isFilterHeader","filterState","isFilterVisible","tableName"]}),f.model.allowCellFormatting&&(w=f.XLFormat.getHashCodeClassAsArray(i)),f.model.allowConditionalFormats&&(v=f.XLEdit.getPropertyValue(i[0],i[1],"cFormatRule")),!f.isUndefined(v)&&v.length>0&&(h=v[0].split("_"),v={action:h[0],inputs:[h[2],h[3]],color:h[4],range:h[5]}),e=i[0];e<=i[2];e++)for(k.push({rowIndex:e,height:l.rowsHeightCollection[e]}),o=i[1];o<=i[3];o++)f.XLEdit.getPropertyValue(e,o,"wrap")&&f.setWrapText("unwrap",f._getAlphaRange(s,e,o,e,o));if(details={sheetIndex:s,reqType:"reorder-cells",sourceData:n.extend(!0,[],p),sourceRange:i,destinationRange:r,sourceFormat:w,destinationFormat:f.model.allowCellFormatting&&f.XLFormat.getHashCodeClassAsArray(r),destinationData:f.getRangeData({range:r}),sourceCFormat:v,sourceHeight:k},f.XLRibbon._isDirtySelect){f._showAlertDlg("Alert","DragAlert",null,440);f.performSelection(i);return}if(isTable=f._checkTableRange(f._getAlphaRange(s,i[0],i[1],i[2],i[3])),y=f._checkFilterRange(f._getAlphaRange(s,i[0],i[1],i[2],i[3])),f._dupDetails=!0,isTable.status==="full")details.tblObj=isTable.tableObj,details.tblObj.tblId=isTable.tblId,details.tblObj.header=!0,f.XLFormat.removeTable(isTable.tblId),f.XLFormat.removeStyle(isTable.range);else if(y.status==="full")details.tRange=y.tRange,f.XLFilter.clearFilter("remove");else if(isTable.status==="partial"||y.status==="partial"||f.XLRibbon._isFilterSelect.isFiltered){f._showAlertDlg("Alert","DragAlert",null,440);f.performSelection(i);return}for(f.model.allowComments&&f.XLComment.deleteComment(),f.clearRangeData(i,u||["value2","value","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","isFilterHeader","filterState","isFilterVisible","tableName","rule","wrap","comment"]),f.clearRangeData(r,u||["value2","value","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","rule","wrap","comment"]),t.isNullOrUndefined(f._ddlCell)||(f.element.find("#"+f._id+"ddl").ejDropDownList("hidePopup"),f.element.find("#"+f._id+"ddlspan").remove(),f._ddlCell=null),f.model.allowCellFormatting&&!f.XLRibbon._isDirtySelect&&(f.XLFormat.removeStyle(i),f.XLFormat.removeStyle(r,{cellStyle:!0,format:!0,border:!0})),f.model.allowConditionalFormats&&f.XLCFormat.clearCF(i,!0),p[0].cFormatRule=[],details.tblObj&&(details.tblObj.destrange=f._getAlphaRange(s,r[0],r[1],r[2],r[3]),f.XLClipboard._isCut=!0,f.XLFormat.createTable(details.tblObj,details.tblObj.destrange),f.XLClipboard._isCut=!1),f.updateData(p,r),y.tRange&&(f.XLFilter.filter(f._getAlphaRange(s,r[0],r[1],r[2],r[3])),f._dupDetails=!1),details.tblObj&&details.tblObj.totalRow&&f.XLFormat._updateTotalRow(s,details.tblObj.tblId,details.tblObj.fnNumber,r,!1),f.model.allowCellFormatting&&f.XLFormat.updateFormat(w,r),f.model.allowConditionalFormats&&!f.isUndefined(h)&&(nt=f._getAlphaRange(1,r[0],r[1],r[2],r[3]),b={action:h[0],inputs:[h[2],h[3]],color:h[4],range:nt},details.destinationCFormat=b,f.XLCFormat.setCFRule(b)),g=0,e=r[0];e<=r[2];e++)for(tt.push({rowIndex:e,height:l.rowsHeightCollection[e]}),d.push({rowIndex:f._getRowIdx(e),height:k[g].height}),g++,o=r[1];o<=r[3];o++)f.XLEdit.getPropertyValue(e,o,"wrap")&&(f.XLEdit._clearDataContainer({cellIdx:{rowIndex:e,colIndex:o},property:["wrap"]}),f.setWrapText("wrap",f._getAlphaRange(s,e,o,e,o)));f.setHeightToRows(d);details.destHeight=d;details.prevDestRowHt=tt;f.setActiveCell(c.rowIndex,c.colIndex);f.model.allowSelection&&(c.rowIndex||a.rowIndex!==l.rowCount-1?c.colIndex||a.colIndex!==l.colCount-1?f.XLSelection.selectRange(c,a):f.XLSelection.selectRows(c.rowIndex,a.rowIndex):f.XLSelection.selectColumns(c.colIndex,a.colIndex),l._isFreezed&&f.XLFreeze._refreshSelection());f._dupDetails=!1;f._isUndoRedo||!f.XLFormat||f.XLFormat._isFAT||(f._completeAction(details),f._trigActionComplete(details))}},_dMouseHover:function(n){var r,e,o,s,h,i,l,u,f,a=n.target,t=this.XLObj,v=t.getActiveSheetIndex(),c=t.getSheet(v).selectedRange;if(t._hasClass(a,"e-rowcell")&&(r=t._getCellIdx(a)),r&&t.inRange(c,r.rowIndex,r.colIndex)&&(r.rowIndex===c[0]||r.rowIndex===c[2]||r.colIndex===c[1]||r.colIndex===c[3])&&!t._isTouchEvt&&(i=n.target.getBoundingClientRect(),l=t._setXY(n),u=l[0],f=l[1],e=u-t.getFocusLeftElem().offset().left,e=e>=0&&e<=5,o=f-t.getFocusTopElem()[0].getBoundingClientRect().top,o=o>=0&&o<=5,s=t.getFocusRightElem().offset().left-u,s=s>=0&&s<=5,h=t.getFocusBottomElem()[0].getBoundingClientRect().top-f,h=h>=0&&h<=5,e&&u<=i.left+5&&u>=i.left||o&&f<=i.top+5&&f>=i.top||s&&u>=i.right-5&&u<=i.right||h&&f>=i.bottom-5&&f<=i.bottom)){t.addClass(a,"e-cursormove");this._isDragAndDropStart=!0;return}this._isDragAndDropStart&&!t._isTouchEvt&&(t._getContent(v).find(".e-cursormove").removeClass("e-cursormove"),this._isDragAndDropStart=!1)},_dragtouch:function(n,t){var r,u,f,e,i=this.XLObj;r=n-i.getFocusLeftElem().offset().left;u=t-i.getFocusTopElem().offset().top;f=i.getFocusRightElem().offset().left-n;e=i.getFocusBottomElem().offset().top-t;this._isDragAndDropStart=r>=-10&&r<=10||u>=-5&&u<=0||f>=-10&&f<=10||e>=-5&&e<=0?!0:!1},_dMouseDown:function(n){var t=this.XLObj,r,u,i;!t.model.isReadOnly&&t.model.allowEditing&&((u=t.getActiveSheetIndex(),i=t.getSheet(u),n.preventDefault(),n.stopImmediatePropagation(),r=t.swapRange([i._startCell.rowIndex,i._startCell.colIndex,i._endCell.rowIndex,i._endCell.colIndex]),n.target.nodeName==="TD"&&(this._dragAndDropCell=t._getCellIdx(n.target)),t._dStartCell={rowIndex:r[0],colIndex:r[1]},t._dEndCell={rowIndex:r[2],colIndex:r[3]},t._trigger("dragStart",{sheetIndex:u,target:n.target,currentCell:this._dragAndDropCell,dragAndDropRange:{startCell:i._startCell,endCell:i._endCell}}))||(this._allowDragAndDrop=!0))},_dMouseMove:function(n){if(this._allowDragAndDrop){var i=this.XLObj,e=i.getActiveSheetIndex(),t=i.getSheet(e),u=n.target,r=i._getCellIdx(u),f;if(i._isTouchEvt&&(f=i._getOriginalEvt(n),u=document.elementFromPoint(f.clientX,f.clientY),u.parentNode&&u.parentNode.attributes.getNamedItem("idx")&&(r=i._getCellIdx(u))),i._trigger("drag",{sheetIndex:e,target:u,currentCell:r,dragAndDropRange:{startCell:t._startCell,endCell:t._endCell}}))return;i._isFrozen(t.frozenRows)&&this._isDragAndDropped&&t._frozenRows-1<t._ftopRowIdx&&t._startCell.rowIndex>t._frozenRows-1&&r.rowIndex<t._frozenRows-1&&(r.rowIndex=t._ftopRowIdx);i._isFrozen(t.frozenColumns)&&this._isDragAndDropped&&t._frozenColumns-1<t._fleftColIdx&&t._startCell.colIndex>t._frozenColumns-1&&r.colIndex<t._frozenColumns-1&&(r.colIndex=t._fleftColIdx);this._cellIdx=r;i.XLSelection._focusBorder(t._startCell,t._endCell,i._thinBorder);this._updateDCells(r);t._isFreezed?this._refreshFocusRange():i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder)}else this.XLObj._isTouchEvt||this._dMouseHover(n)},_refreshFocusRange:function(){var t=this.XLObj,n=t.getSheet(),u=t._dEndCell.colIndex,f=t._dEndCell.rowIndex,i=t._dStartCell.colIndex,r=t._dStartCell.rowIndex;n._frozenRows-1<n._ftopRowIdx&&(n._startCell.rowIndex<n._frozenRows-1?f>=n._frozenRows-1&&(f<n._ftopRowIdx?f=n._frozenRows-2:f>n._ftopRowIdx&&r<n._ftopRowIdx&&(r=n._ftopRowIdx)):r=r<n._ftopRowIdx&&r>n._frozenRows-1?n._ftopRowIdx:t._dStartCell.rowIndex);n._frozenColumns-1<n._fleftColIdx&&(n._startCell.colIndex<n._frozenColumns-1?u>=n._frozenColumns-1&&(u<n._fleftColIdx?u=n._frozenColumns-2:u>n._fleftColIdx&&i<n._fleftColIdx&&(i=n._fleftColIdx)):i=i<n._fleftColIdx&&i>n._frozenColumns-1?n._fleftColIdx:t._dStartCell.colIndex);t.XLSelection._focusRange({rowIndex:r,colIndex:i},{rowIndex:f,colIndex:u},t._autofillBorder)},_dMouseUp:function(t){var f,s;if(this._isDragAndDropped){var i=this.XLObj,o=!0,u=i.getActiveSheetIndex(),r=i.getSheet(u),h=n("#vscrollBar").data("ejScrollBar"),c=n("#hscrollBar").data("ejScrollBar"),l=!1,e=[i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex],a={rowIndex:-1,colIndex:-1},v={sheetIndex:u,isAlert:!1,target:t.target,currCell:this._dragAndDropCell,dragAndDropRange:{startCell:r._startCell,endCell:r._endCell}},y=i._arrayAsString(i._thinBorder);if(i.model.scrollSettings.allowScrolling&&i._dEndCell.rowIndex>r.rowCount){for(f=0,s=i._dEndCell.rowIndex-i._dStartCell.rowIndex;f<s;f++)i.XLScroll._createNewRow(u,-1,-1,"insert");h._scrollData.step=1;h.scroll(r._scrollTop+(i._dEndCell.rowIndex-i._dStartCell.rowIndex)*r.rowHeight)}if(i._dEndCell.colIndex>r.colCount){for(f=0,s=i._dEndCell.colIndex-i._dStartCell.colIndex;f<s;f++)i.XLScroll._createNewColumn(u,a,a,"insert");c._scrollData.step=1;c.scroll(r._scrollLeft+(i._dEndCell.colIndex-i._dStartCell.colIndex)*r.columnWidth)}if(this._target=t.target,i._isUniqueRange(r.selectedRange,i.swapRange(e)))this._preventDrop(r);else{if(i.model.allowLockCell&&r.isSheetProtected&&i._isPropExists([e,r.selectedRange],"isLocked",u)&&(o=!1),o&&i._isPropExists([e,r.selectedRange],"isReadOnly",u)&&(o=!1),!o){this._preventDrop(r);i.XLSelection._clearBorder(y);this._allowDragAndDrop=this._isDragAndDropStart=this._isDragAndDropped=!1;return}l=i._trigger("beforeDrop",v);v.isAlert||l||!i._rangeHasData(e)?i._rangeHasData(e)?this._preventDrop(r):(this.moveRangeTo([r._startCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex],[i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex]),r._startCell=i._dStartCell,r._endCell=i._dEndCell,r._isFreezed&&i.XLFreeze._refreshSelection()):i._showAlertDlg("","DropAlert","Drop",498)}i.XLSelection._clearBorder(y);i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement()}this._allowDragAndDrop=this._isDragAndDropStart=this._isDragAndDropped=!1},_scrollHover:function(t){var u,f,s,i=this.XLObj,h=i.getActiveSheetIndex(),r=i.getSheet(h),c=this._cellIdx.colIndex,l=this._cellIdx.rowIndex,a=i.XLScroll,e=a._vScroller(h),o=a._hScroller(h);n(t.target).parents(".e-vscrollbar").length>0?f=setInterval(function(){u=r._scrollLeft+(i._isFrozen(r.frozenColumns)?r.columnsWidthCollection[r._fleftColIdx]:r.columnWidth);o._scrollData.step=1;o.scroll(u);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:l,colIndex:r._rightCol.idx-1});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):t.target.className.indexOf("e-rowheader")>-1?f=setInterval(function(){u=r._scrollLeft-r.columnWidth;o._scrollData.step=-1;u>-1?o.scroll(u):o.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:l,colIndex:r._leftCol.idx});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):n(t.target).parents(".e-spreadsheetfooter").length>0||t.target.className.indexOf("e-spreadsheetfooter")>-1||n(t.target).parents(".e-hscrollbar").length>0?f=setInterval(function(){i.model.scrollSettings.allowVirtualScrolling?r._isVirtualEndReached?e.scroll(r._scrollTop):e.scroll(r._scrollTop+(i._isFrozen(r.frozenRows)?r.rowsHeightCollection[r._ftopRowIdx]:r.rowHeight)):(e._scrollData.step=1,e.scroll(r._scrollTop+(i._isFrozen(r.frozenRows)?r.rowsHeightCollection[r._ftopRowIdx]:r.rowHeight)));i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:r._bottomRow.idx-1,colIndex:c});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):t.target.className.indexOf("e-headercell")>-1?f=setInterval(function(){u=r._scrollTop-r.rowHeight;e._scrollData.step=-1;u>-1?e.scroll(u):e.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:r._topRow.idx,colIndex:c});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):t.target.className.indexOf("e-rowcell")>-1&&(s=i._getCellIdx(t.target),i._isFrozen(r.frozenRows)&&s.rowIndex<r._frozenRows-1&&r._startCell.rowIndex>=r._frozenRows-1&&(f=setInterval(function(){if(i._dStartCell.rowIndex>r._ftopRowIdx||!i.XLDragDrop._isDragAndDropped||r._frozenRows-1===r._ftopRowIdx){(i._dStartCell.colIndex>r._fleftColIdx||!i.XLDragDrop._isDragAndDropped||r._frozenColumns-1===r._fleftColIdx)&&clearInterval(f);return}u=r._scrollTop-r.rowHeight;e._scrollData.step=-1;u>-1?e.scroll(u):e.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:r._ftopRowIdx,colIndex:i.XLDragDrop._cellIdx.colIndex});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);i.XLDragDrop._refreshFocusRange();return},200)),i._isFrozen(r.frozenColumns)&&s.colIndex<r._frozenColumns-1&&r._startCell.colIndex>=r._frozenColumns-1&&(f=setInterval(function(){if(i._dStartCell.colIndex>r._fleftColIdx||!i.XLDragDrop._isDragAndDropped||r._frozenColumns-1===r._fleftColIdx){(i._dStartCell.rowIndex>r._ftopRowIdx||!i.XLDragDrop._isDragAndDropped||r._frozenRows-1===r._ftopRowIdx)&&clearInterval(f);return}u=r._scrollLeft-r.columnWidth;o._scrollData.step=-1;u>-1?o.scroll(u):o.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:i.XLDragDrop._cellIdx.rowIndex,colIndex:r._fleftColIdx});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);i.XLDragDrop._refreshFocusRange();return},200)));i._browserDetails.name==="msie"&&i._browserDetails.version==="8.0"?(t.target.attachEvent("onmouseleave",function(){clearInterval(f);return}),document.attachEvent("onmouseleave",function(){clearInterval(f);return}),t.target.attachEvent("onmouseup",function(){clearInterval(f);return})):(t.target.addEventListener("mouseleave",function(){clearInterval(f);return}),document.addEventListener("mouseleave",function(){clearInterval(f);return}),t.target.addEventListener("mouseup",function(){clearInterval(f);i.XLDragDrop._dMouseUp(t);return}))},_preventDrop:function(n){var t=this.XLObj;t.XLSelection._focusRange(n._startCell,n._endCell,t._selectionBorder);t._dStartCell=n._startCell;t._dEndCell=n._endCell},_updateDCells:function(n){var t=this.XLObj,u=t.getActiveSheetIndex(),i=t.getSheet(u),r=t.isRange(i.selectedRange);i._isColSelected&&t.inRange(i.selectedRange,0,i._startCell.colIndex)||(n.rowIndex<this._dragAndDropCell.rowIndex&&t._dStartCell.rowIndex?(t._dStartCell.rowIndex=t._dStartCell.rowIndex-(this._dragAndDropCell.rowIndex-n.rowIndex),t._dEndCell.rowIndex=r?t._dEndCell.rowIndex-(this._dragAndDropCell.rowIndex-n.rowIndex):t._dStartCell.rowIndex):n.rowIndex>this._dragAndDropCell.rowIndex&&(t._dStartCell.rowIndex=t._dStartCell.rowIndex+(n.rowIndex-this._dragAndDropCell.rowIndex),t._dEndCell.rowIndex=r?t._dEndCell.rowIndex+(n.rowIndex-this._dragAndDropCell.rowIndex):t._dStartCell.rowIndex));i._isRowSelected&&t.inRange(i.selectedRange,i._startCell.rowIndex,0)||(n.colIndex<this._dragAndDropCell.colIndex&&t._dStartCell.colIndex?(t._dStartCell.colIndex=t._dStartCell.colIndex-(this._dragAndDropCell.colIndex-n.colIndex),t._dEndCell.colIndex=r?t._dEndCell.colIndex-(this._dragAndDropCell.colIndex-n.colIndex):t._dStartCell.colIndex):n.colIndex>this._dragAndDropCell.colIndex&&(t._dStartCell.colIndex=t._dStartCell.colIndex+(n.colIndex-this._dragAndDropCell.colIndex),t._dEndCell.colIndex=r?t._dEndCell.colIndex+(n.colIndex-this._dragAndDropCell.colIndex):t._dStartCell.colIndex));this._dragAndDropCell=n;this._isDragAndDropped=!0}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.exporting=function(n){this.XLObj=n};t.spreadsheetFeatures.exporting.prototype={"export":function(i){var r=this.XLObj,u,y,s,f,e,h,c,l,p,a,o,v;if(r.model.exportSettings.allowExporting&&!r.model.isReadOnly)if(r._isExport=!0,this._renderAll(),r._isExport=!1,u=r.model.exportSettings,h=i===t.Spreadsheet.exportType.Excel?u.excelUrl:i===t.Spreadsheet.exportType.Csv?u.csvUrl:u.pdfUrl,c=this.getExportProps(),o={exportType:i,url:h,customParams:{}},l=t.raiseWebFormsServerEvents?i.toLowerCase()+"Exporting":"",t.raiseWebFormsServerEvents&&r.model.serverEvents&&r.model.serverEvents.indexOf(l)>-1){if(p={model:n.extend(!0,{},r.model),originalEventType:l},a={sheetModel:c.model,sheetData:c.data,password:u.password?r._encrypt(u.password):""},r._trigger("onExport",o))return;r.getObjectLength(o.customParams)&&n.extend(a,o.customParams);t.raiseWebFormsServerEvents(l,p,a);setTimeout(function(){t.isOnWebForms=!0},1e3)}else{if(t.isNullOrUndefined(h)){r._showAlertDlg("Alert","ImportExportUrl","",266);return}if(!u.allowExporting||r.isUndefined(h))return;if(r._trigger("onExport",o))return;h=o.url;y={action:h,method:"post"};s=t.buildTag("form","",null,y);f={name:"sheetData",type:"hidden",value:c.data};e=t.buildTag("input","",null,f);s.append(e);f={name:"sheetModel",type:"hidden",value:c.model};e=t.buildTag("input","",null,f);s.append(e);f={name:"Password",type:"hidden",value:r._encrypt(u.password)};e=t.buildTag("input","",null,f);s.append(e);for(v in o.customParams)f={name:v,type:"hidden",value:o.customParams[v]},e=t.buildTag("input","",null,f),s.append(e);n("body").append(s);s.submit()}},_dropElements:function(n){var r=n.sheets,f=["_spreadSheetPager","dataSource","rangeSettings"],u,t,i;n.undoCollection=[];for(u in r){i=r[u];for(t in i)f.indexOf(t)>-1&&(i[t]=null)}return n},_getRequriedProp:function(n){for(var f=this.XLObj,r={},u,i=["sheetCount","activeSheetIndex","nameManager"],s,o,h,t=0,e=i.length;t<e;t++)r[i[t]]=n[i[t]];f.model.allowCellFormatting&&f.getObjectLength(f.XLFormat._customFontFamily)>0&&(r.customFontFamily=f.XLFormat._customFontFamily);o=n.sheets;r.sheets=[];i=["_activeCell","_endCell","_startCell","colCount","columnsWidthCollection","rowsHeightCollection","rowCount","frozenColumns","frozenRows","usedRange","dataAttribute","filterSettings","tableManager","sheetInfo","hideColsCollection","hideRowsCollection","showGridlines","showHeadings","isSheetProtected","shapeMngr","chart","pivotMngr","topLeftCell","paneTopLeftCell"];for(t in o)for(r.sheets[t]={},h=r.sheets[t],s=o[t],u=0,e=i.length;u<e;u++)h[i[u]]=s[i[u]];return r},getExportProps:function(){var s=this.XLObj,r,e,u,l,y,a,v,o,p=n.extend(!0,{},s._dataContainer),i={},h=[],t,f={},c;for(s._refreshHashCode(p.hashCode),i=JSON.parse(JSON.stringify(s.model)),r=1;r<i.sheets.length;r++){for(f={},pivot={},n.extend(!0,f,i.sheets[r].shapeMngr.chart),h=s.getObjectKeys(f),i.sheets[r].shapeMngr.chart={},e=0,l=h.length;e<l;e++)if(t=f[h[e]].id,a=n("#"+t).data("ejChart"),a){for(a.model.event=null,v=JSON.parse(JSON.stringify(a.model)),o=v.series,u=0,y=o.length;u<y;u++)delete o[u].dataSource,delete o[u].query,o[u].fill=jQuery.type(o[u].fill)=="array"?o[u].fill[0].color:o[u].fill;i.sheets[r].shapeMngr.chart[t]=v;c=f[t].range;i.sheets[r].shapeMngr.chart[t].range=s._generateHeaderText(c[1]+1)+(c[0]+1)+":"+s._generateHeaderText(c[3]+1)+(c[2]+1);i.sheets[r].shapeMngr.chart[t].top=f[t].top;i.sheets[r].shapeMngr.chart[t].left=f[t].left;i.sheets[r].shapeMngr.chart[t].height=f[t].height;i.sheets[r].shapeMngr.chart[t].width=f[t].width}for(h=s.getObjectKeys(i.sheets[r].pivotMngr.pivot),e=0,l=h.length;e<l;e++)t=h[e],pivotObj=n("#"+t).data("ejPivotGrid"),pivotObj&&(i.sheets[r].pivotMngr.pivot[t].rows=pivotObj.getOlapReport().rows,i.sheets[r].pivotMngr.pivot[t].columns=pivotObj.getOlapReport().columns,i.sheets[r].pivotMngr.pivot[t].filters=pivotObj.getOlapReport().filters,i.sheets[r].pivotMngr.pivot[t].values=pivotObj.getOlapReport().values)}return i.sheets.shift(),{model:JSON.stringify(this._getRequriedProp(i)),data:JSON.stringify(p)}},_renderAll:function(){for(var r,i,u,n=this.XLObj,f=n.getSheets(),e=n.getActiveSheetIndex(),t=1;t<f.length;t++)if(i=f[t],n.model.importSettings.allowSheetOnDemand&&i._isImported&&!i._isRequested&&n._importSheet(t,!1),i._isLoaded||n.gotoPage(t),n.model.scrollSettings.allowVirtualScrolling&&!i._isImported&&i._hasDataSrc)for(r=1;r<=i._virtualBlockCnt;r++)i._virtualDataLoadedBlks.indexOf(r)===-1&&(i._virtualDataLoadedBlks.push(r),u=this._getRange(r,t),n._refreshDataSrc(u,t),n._refreshCellData(u,t));n.hideWaitingPopUp();n.gotoPage(e)},_getRange:function(n,t){var u=this.XLObj,i=u.getSheet(t),r=[0,0,0,i.colCount-1];return r[0]=i._virtualBlockRowCnt*(n-1),r[2]=i._virtualBlockRowCnt*n-1,r}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.findnreplace=function(n){this.XLObj=n;this._findCount=0;this._isApplied=!1;this.caseSen={"true":function(n){return n.toString()},"false":function(n){return n.toString().toLowerCase()}};this.isEMatch={"true":function(n,t){return n==t},"false":function(n,t){if(!n.length||t.length)return n.indexOf(t)>-1}}};t.spreadsheetFeatures.findnreplace.prototype={replaceAllBySheet:function(n,t,i,r){this.XLObj.model.allowSearching&&this.XLObj.model.allowEditing&&!this.XLObj.model.isReadOnly&&this._replaceAllData(n,t,i,r,"value","sheet")},replaceAllByBook:function(n,t,i,r){this.XLObj.model.allowSearching&&this.XLObj.model.allowEditing&&!this.XLObj.model.isReadOnly&&this._replaceAllData(n,t,i,r,"value","workbook")},findNext:function(n,i,r){t.isNullOrUndefined(r)&&(r=this.XLObj.getActiveSheetIndex());this._findNext(n,r,i.isCSen,i.isEMatch,i.type,i.mode,i.searchBy)},findPrevious:function(n,i,r){t.isNullOrUndefined(r)&&(r=this.XLObj.getActiveSheetIndex());this._findPrev(n,r,i.isCSen,i.isEMatch,i.type,i.mode,i.searchBy)},_findNext:function(n,t,i,r,u,f,e){var s,h,y,ct,tt,w,b,a,p,ot,it,rt,v,k,d,lt,ut,ft,g=[],l=e==="rows",c=this.XLObj,st=!1,nt=t?t:c.getActiveSheetIndex(),ht=c.getSheet(nt),et=ht._activeCell,o={sheetIndex:t,value:n,isCaseSensitive:i,isEntireMatch:r,searchBy:e,mode:f,findType:u,reqType:"findNext"};if(lt={sheetIndex:o.sheetIndex,value:o.value,isCaseSensitive:o.isCaseSensitive,isEntireMatch:o.isEntireMatch,searchBy:o.searchBy,mode:o.mode,findType:o.findType,reqType:o.reqType},!c._intrnlReq&&c._trigActionBegin(lt))return!0;if(c.model.allowEditing&&c.XLEdit._isEdit&&c.XLEdit.saveCell(),n=o.value,t=o.sheetIndex,i=o.isCaseSensitive,r=o.isEntireMatch,u=o.findType,f=o.mode,e=o.searchBy,w=ht._selectedCells,ot=w.length,p=ht.usedRange,ot===1||f==="workbook"?g=[et.rowIndex,et.colIndex,p.rowIndex+1,p.colIndex+1]:(st=!0,b=w[ot-1],g=[et.rowIndex,et.colIndex,b.rowIndex+1,b.colIndex+1]),a=g[0],v=g[1],k=g[2],d=g[3],l||(tt=a,a=v,v=tt,tt=k,k=d,d=tt),f==="sheet"){for(s=a;s<k;s++)for(s!==a&&(b=w[0],v=st?l?b.colIndex:b.rowIndex:0),h=v;h<d;h++)if(ut=this._compareValues(l?s:h,l?h:s,nt,n,i,r,u),ut&&!(s===a&&h===v))return(this._updateSelection(l?s:h,l?h:s),this._findCount++,o={reqType:"findNext",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0}else for(y=nt,ct=c.model.sheetCount;y<=ct;y++)for(p=c.model.sheets[y].usedRange,y!==nt&&(v=0,a=0,k=l?p.rowIndex:p.colIndex,d=l?p.colIndex:p.rowIndex),s=a;s<k+1;s++)for(s!==a&&(v=0),h=v;h<d+1;h++)if(ut=this._compareValues(l?s:h,l?h:s,y,n,i,r,u),ut&&!(y===nt&&s===a&&h===v))return(this._updateSelection(l?s:h,l?h:s,y),this._findCount++,c._intrnlReq=!1,o={reqType:"findNext",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0;return this._findCount?!1:(it=0,rt=0,ft=f==="sheet"?nt:1,st&&(b=w[0],rt=w[0].rowIndex,it=w[0].colIndex),this._updateSelection(rt,it,ft),this._findCount++,this._compareValues(rt,it,ft,n,i,r,u)?!0:(c._intrnlReq=!0,this._findNext(n,ft,i,r,u,f,e)))},_findPrev:function(n,t,i,r,u,f,e){var s,h,p,it,k,a,nt,rt,ut,ft,v,y,tt,ct,w,st=!1,d=[],lt=0,at=0,l=e==="rows",et,c=this.XLObj,g=t?t:c.getActiveSheetIndex(),ht=c.getSheet(g),b=ht.usedRange,ot=ht._activeCell,o={sheetIndex:t,value:n,isCaseSensitive:i,isEntireMatch:r,searchBy:e,mode:f,findType:u,reqType:"findPrevious"};if(ct={sheetIndex:o.sheetIndex,value:o.value,isCaseSensitive:o.isCaseSensitive,isEntireMatch:o.isEntireMatch,searchBy:o.searchBy,mode:o.mode,findType:o.findType,reqType:o.reqType},c._trigActionBegin(ct))return!0;if(c.model.allowEditing&&c.XLEdit._isEdit&&c.XLEdit.saveCell(),n=o.value,t=o.sheetIndex,i=o.isCaseSensitive,r=o.isEntireMatch,u=o.findType,f=o.mode,e=o.searchBy,nt=ht._selectedCells,rt=nt.length,rt===1||f==="workbook"?d=[ot.rowIndex,ot.colIndex,b.rowIndex+1,b.colIndex+1]:(a=nt[rt-1],d=[ot.rowIndex,ot.colIndex,a.rowIndex,a.colIndex],st=!0),v=d[0],y=d[1],tt=d[2],w=d[3],l||(et=v,v=y,y=et,et=tt,tt=w,w=et),f==="sheet"){for(st&&(a=nt[0],lt=l?a.rowIndex:a.colIndex,at=l?a.colIndex:a.rowIndex),s=v;s>=lt;s--)for(s!==v&&(y=w),h=y;h>=at;h--)if(it=this._compareValues(l?s:h,l?h:s,g,n,i,r,u),it&&!(s===v&&h===y))return(this._updateSelection(l?s:h,l?h:s),this._findCount++,o={reqType:"findPrevious",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0}else for(p=g;p>=1;p--)for(b=c.model.sheets[p].usedRange,p!==g&&(tt=l?b.rowIndex:b.colIndex,w=l?b.colIndex:b.rowIndex,y=w,v=tt),s=v;s>=0;s--)for(s!==v&&(y=w+1),h=y;h>=0;h--)if(it=this._compareValues(l?s:h,l?h:s,p,n,i,r,u),it&&!(p===g&&s===v&&h===y))return(this._updateSelection(l?s:h,l?h:s,p),this._findCount++,o={reqType:"findPrevious",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0;return this._findCount?!1:(k=f==="sheet"?g:c.model.sheetCount,ft=c.model.sheets[k].usedRange.rowIndex,ut=c.model.sheets[k].usedRange.colIndex,st&&(a=nt[rt-1],ft=a.rowIndex,ut=a.colIndex),this._updateSelection(ft,ut,k),this._findCount++,this._compareValues(ft,ut,k,n,i,r,u)?!0:this._findPrev(n,k,i,r,u,f,e))},_compareValues:function(n,t,i,r,u,f,e){var o=this.XLObj,s=o.XLEdit.getPropertyValue(n,t,null,i)?o.XLEdit.getPropertyValue(n,t,null,i).toString():"",h=o.isFormula(s)||e==="formula"&&s==="=",c=o._isDateTime(o.XLEdit.getPropertyValue(n,t,"value",i));return s=e==="value"?c?s?this.caseSen[u](o.XLEdit.getPropertyValue(n,t,"value2",i)):"":s&&!h?this.caseSen[u](s):"":e==="formula"?h?this.caseSen[u](s):"":o.XLEdit.getPropertyValue(n,t,"comment",i)?this.caseSen[u](o.XLEdit.getPropertyValue(n,t,"comment",i).value):"",r=this.caseSen[u](r),this.isEMatch[f](s,r)},_replace:function(n,t,i,r,u){var f=this.XLObj,o=f.getActiveSheetIndex();if(f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"isLocked",o))return!1;var e=f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,null,t)?f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,null,t).toString():"",s=new RegExp(i.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),h=e!==""&&i!==""?u?e.replace(i,r):e.replace(s,r):r;t===o||f.gotoPage(t);f.XLEdit._updateCellValue(n,h)},_replaceData:function(n,t,i,r,u,f,e,o,s){var v,y,h=this.XLObj,c=i?i:h.model.activeSheetIndex,p=h.getSheet(c),l=p._activeCell.rowIndex,a=p._activeCell.colIndex,w;if(!h.model.allowEditing)return!1;if(h.model.allowLockCell&&h.XLEdit.getPropertyValue(l,a,"isLocked",c)){h._popUplockCellAlert();return}h.model.allowEditing&&h.XLEdit._isEdit&&h.XLEdit.saveCell();this._compareValues(l,a,c,n,r,u,f)?(y=f==="formula"?"value":"value2",v={sheetIndex:c,reqType:"find-replace",operation:"replace",rowIndex:l,colIndex:a,sIndex:i},v.prevData={value:h.XLEdit.getPropertyValue(l,a,y)},this._replace({rowIndex:l,colIndex:a},i,n,t,r),v.newData={value:h.XLEdit.getPropertyValue(l,a,y)},this._findCount=0,w=e==="up"?this._findPrev(n,c,r,u,f,o,s):this._findNext(n,c,r,u,f,o,s),w||this._updateSelection(l,a,c),h._isUndoRedo||(h._completeAction(v),h._trigActionComplete(v))):h._showAlertDlg("Alert","ReplaceNotFound","")},_replaceAllData:function(t,i,r,u,f,e){var w,a,l,g=[],it=0,rt=!1,nt,o=this.XLObj,ut=o.model.sheetCount,v=o.model.activeSheetIndex,b=o.getSheet(v),y=b.usedRange,ft=b._activeCell.rowIndex,et=b._activeCell.colIndex,s,h,c,k,d,tt=0,p;if(w={sheetIndex:v,reqType:"find-replace",operation:"replaceAll",isCSen:r,isEMatch:u},a=f==="formula"?"value":"value2",!o.model.allowEditing)return!1;if(o._dupDetails=!0,o.model.allowEditing&&o.XLEdit._isEdit&&o.XLEdit.saveCell(),e==="sheet")if(o.model.allowLockCell&&b.isSheetProtected)rt=!0;else for(s=0,k=y.rowIndex+1;s<k;s++)for(h=0,d=y.colIndex+1;h<d;h++)this._compareValues(s,h,v,t,r,u,f)&&(l={rowIndex:s,colIndex:h,prevData:{value:o.XLEdit.getPropertyValue(s,h,a)},sheetIndex:v},this._replace({rowIndex:s,colIndex:h},v,t,i,r),tt++,l.newData={value:o.XLEdit.getPropertyValue(s,h,a)},g.push(l));else for(c=1;c<=ut;c++){if(nt=o.model.sheets[c],o.model.allowLockCell&&nt.isSheetProtected){it++;continue}for(y=nt.usedRange,s=0,k=y.rowIndex+1;s<k;s++)for(h=0,d=y.colIndex+1;h<d;h++)this._compareValues(s,h,c,t,r,u,f)&&(l={rowIndex:s,colIndex:h,prevData:{value:o.XLEdit.getPropertyValue(s,h,a,c)},sheetIndex:c},this._replace({rowIndex:s,colIndex:h},c,t,i,r),tt++,l.newData={value:o.XLEdit.getPropertyValue(s,h,a)},g.push(l))}if(rt||it===ut){o._popUplockCellAlert();return}o._dupDetails=!1;w.selectedCell=g;this._updateSelection(ft,et);o._isUndoRedo||(o._completeAction(w),o._trigActionComplete(w));o.hideWaitingPopUp();p=o._getLocStr("ReplaceData").split("/");p="T-"+p[0]+tt+" "+p[1];n("#"+o._id+"_FRDialog").ejDialog("close");o._showAlertDlg("Alert",p,"",325)},_updateSelection:function(n,t,i){var u={rowIndex:n,colIndex:t},r=this.XLObj,e=r.getActiveSheetIndex(),f=r.getSheet(e);i||(i=e);i&&i!==e&&r.gotoPage(i,!1);r.getSheetElement(e).find(".e-selected:visible").length<2||!r.inRange(f.selectedRange,n,t)?(r.setActiveCell(u.rowIndex,u.colIndex,i),r.XLSelection.selectRange(u,u),f._startCell=u,f._endCell=u):r.XLCellNav._updateActiveCell(n,t);r.model.scrollSettings.allowScrolling&&(r._isFrozen(f.frozenRows)||r._isFrozen(f.frozenColumns)?this._freezeScroll(u.rowIndex,u.colIndex,f):r.XLScroll._scrollSelectedPosition(i,r.getActiveCell(i)));r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement()},_getSelRangeDetails:function(n){var t=n[n.length-1].rowIndex-n[0].rowIndex,i=n[n.length-1].colIndex-n[0].colIndex,r=n[0].rowIndex,u=n[0].colIndex;return[t,i,r,u]},goTo:function(t){var i=this.XLObj;if(!i.model.isReadOnly){i._showDialog(i._id+"_Ribbon_Others_Editing_FindSelect");t.startsWith("=")&&(t=t.split("=")[1]);var h,f,c=i.getActiveSheetIndex(),u=i.getSheet(c),r,e,o=i._getDollarAlphaRange(u.selectedRange),s=i.XLRibbon._getAddrFromDollarAddr(t);t=s[1];s[0]&&i.gotoPage(s[0],!1);t=i.getRangeIndices(t);rangeCells=i._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]});r=rangeCells[0];e=rangeCells[rangeCells.length-1];i.setActiveCell(r.rowIndex,r.colIndex);i.model.allowSelection&&i.XLSelection.selectRange(r,e);i._isFrozen(u.frozenRows)||i._isFrozen(u.frozenColumns)?this._freezeScroll(r.rowIndex,r.colIndex,u):i.XLScroll._scrollSelectedPosition(i.getActiveSheetIndex(),r);i.XLDragFill.positionAutoFillElement();u._startCell=r;u._endCell=e;i.setSheetFocus();h=n.grep(i.XLRibbon._addrList,function(n){return n.value===o});h.length<1&&(i.XLRibbon._addrList.push({value:o,text:o}),f=n("#"+i._id+"_GotoAddr").data("ejListBox"),i.XLRibbon._addrList=JSON.parse(JSON.stringify(i.XLRibbon._addrList)),f.model.dataSource=i.XLRibbon._addrList,f.option("fields",{dataSource:i.XLRibbon._addrList}))}},goToSpecial:function(n,t){this._applyGoToRule(n,t.isNumber,t.isText,t.isLogical,t.isError)},_applyGoToRule:function(n,t,i,r,u){var e=this.XLObj,o,f;e.showWaitingPopUp();switch(n){case"blanks":this._applyGotoBlanks();break;case"formulas":this._applyGotoFormulas(t,i,r,u);break;case"comments":this._applyGotoComments();break;case"datavalidation":this._applyGotoValidation();break;case"cformat":this._applyGotoCFormat();break;case"lastcell":o=e.getActiveSheetIndex();f=e.model.sheets[o].usedRange;e.XLSelection.selectRange({rowIndex:f.rowIndex,colIndex:f.colIndex},{rowIndex:f.rowIndex,colIndex:f.colIndex});this._updateSelection(f.rowIndex,f.colIndex,o);break;case"constants":this._applyGotoConstants(t,i,r,u);break;case"rowdiff":this._applyGotoRowDiff();break;case"coldiff":this._applyGotoColDiff()}e.hideWaitingPopUp()},_applyGotoBlanks:function(){var f,e,s,i,h,o=!1,l=[],r,n=this.XLObj,u=n.getActiveSheetIndex(),a=n.model.sheets[u].usedRange,v,y=a.rowIndex,p=a.colIndex,t=n.getSheet(u),w=t._selectedCells,b=0,k=0,c={sheetIndex:u,reqType:"find-replace",operation:"blanks"};for(t._goToCollection={multiple:!1,selected:[]},w.length>1&&(r=this._getSelRangeDetails(w),y=r[0],p=r[1],b=r[2],k=r[3],t._goToCollection.multiple=!0),f=0;f<=y;f++){for(e=0;e<=p;e++)rIdx=f+b,cIdx=e+k,v=n.XLEdit.getPropertyValue(rIdx,cIdx)?n.XLEdit.getPropertyValue(rIdx,cIdx).toString():"",n._isRowViewable(u,rIdx)&&(s=n.getCell(rIdx,cIdx,u),o=!0),v.length?o&&s.removeClass("e-selected"):(l.push({rowIndex:rIdx,colIndex:cIdx,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&t._goToCollection.selected.push(rIdx+":"+cIdx),o&&(s.addClass("e-selected"),i=[rIdx,cIdx]));o=!1}h=t._goToCollection.selected.length;(n._isFrozen(t.frozenRows)||n._isFrozen(t.frozenColumns))&&(h&&(i=t._goToCollection.selected[h-1].split(":")),i.length&&this._freezeScroll(i[0],i[1],t));c.selectedCell=l;n._isUndoRedo||(n._completeAction(c),n._trigActionComplete(c))},_applyGotoComments:function(){var e,o,c,r,s,h=!1,a=[],u,n=this.XLObj,f=n.getActiveSheetIndex(),v=n.getSheet(f).usedRange,y,p=v.rowIndex,w=v.colIndex,i=n.getSheet(f),b=i._selectedCells,k=0,d=0,l={sheetIndex:f,reqType:"find-replace",operation:"comments"};for(i._goToCollection={multiple:!1,selected:[]},this._isApplied=!1,b.length>1&&(u=this._getSelRangeDetails(b),p=u[0],w=u[1],k=u[2],d=u[3],i._goToCollection.multiple=!0),e=0;e<=p;e++){for(o=0;o<=w;o++)rIdx=e+k,cIdx=o+d,y=n.XLEdit.getPropertyValue(rIdx,cIdx,"comment"),n._isRowViewable(f,rIdx)&&(c=n.getCell(rIdx,cIdx,f),h=!0),t.isNullOrUndefined(y)?h&&c.removeClass("e-selected"):(a.push({rowIndex:rIdx,colIndex:cIdx,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(rIdx+":"+cIdx),h&&(c.addClass("e-selected"),this._isApplied=!0,r=[rIdx,cIdx]));h=!1}s=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(s&&(r=i._goToCollection.selected[s-1].split(":")),r.length&&this._freezeScroll(r[0],r[1],i));this._isApplied||s||n._showAlertDlg("Alert","NoCellFound","",200);l.selectedCell=a;!n._isUndoRedo&&this._isApplied&&(n._completeAction(l),n._trigActionComplete(l))},_applyGotoFormulas:function(i,r,u,f){var p,l,k,s,c,a,w,b=!1,nt=[],v,e=this.XLObj,y=e.getActiveSheetIndex(),tt,o,it,rt=e.model.sheets[y].usedRange,ut=rt.rowIndex,ft=rt.colIndex,h=e.getSheet(y),et=h._selectedCells,ot=0,d=0,g={sheetIndex:y,reqType:"find-replace",operation:"formulas"};for(h._goToCollection={multiple:!1,selected:[]},this._isApplied=!1,et.length>1&&(v=this._getSelRangeDetails(et),ut=v[0],ft=v[1],ot=v[2],d=v[3],h._goToCollection.multiple=!0),p=0;p<=ut;p++){for(l=0;l<=ft;l++)s=p+ot,c=l+d,tt=t.isNullOrUndefined(e.XLEdit.getPropertyValue(s,c))?"":e.XLEdit.getPropertyValue(s,l+d).toString(),o=t.isNullOrUndefined(e.XLEdit.getPropertyValue(s,c,"value2"))?"":e.XLEdit.getPropertyValue(s,c,"value2").toString(),it=tt.charAt(0)==="="&&typeof o=="string",e._isRowViewable(y,s)&&(k=e.getCell(s,c,y),b=!0),it&&(i&&n.isNumeric(o)||r&&!(o.toLowerCase()==="true"||o.toLowerCase()==="false")&&!n.isNumeric(o)&&!(o.length!==0&&o.indexOf("#")===0&&o.lastIndexOf("?")===o.length-1&&o.length>0)||u&&(o.toLowerCase()==="true"||o.toLowerCase()==="false")||f&&o.length!==0&&e._calcEngine.getErrorStrings().indexOf(o)>-1)?(nt.push({rowIndex:s,colIndex:c,isApply:!0}),e.model.scrollSettings.allowVirtualScrolling&&h._goToCollection.selected.push(s+":"+c),b&&(k.addClass("e-selected"),this._isApplied=!0,a=[s,c])):b&&k.removeClass("e-selected");b=!1}w=h._goToCollection.selected.length;(e._isFrozen(h.frozenRows)||e._isFrozen(h.frozenColumns))&&(w&&(a=h._goToCollection.selected[w-1].split(":")),a.length&&this._freezeScroll(a[0],a[1],h));this._isApplied||w||e._showAlertDlg("Alert","NoCellFound","",200);g.selectedCell=nt;!e._isUndoRedo&&this._isApplied&&(e._completeAction(g),e._trigActionComplete(g))},_applyGotoValidation:function(){var s,h,a,r,u,f,c,l=!1,y=[],e,n=this.XLObj,o=n.getActiveSheetIndex(),p=n.model.sheets[o].usedRange,w,b=p.rowIndex,k=p.colIndex,i=n.getSheet(o),d=i._selectedCells,g=0,nt=0,v={sheetIndex:o,reqType:"find-replace",operation:"validations"};for(this._isApplied=!1,i._goToCollection={multiple:!1,selected:[]},d.length>1&&(e=this._getSelRangeDetails(d),b=e[0],k=e[1],g=e[2],nt=e[3],i._goToCollection.multiple=!0),s=0;s<=b;s++){for(h=0;h<=k;h++)r=s+g,u=h+nt,w=n.XLEdit.getPropertyValue(r,u,"rule"),n._isRowViewable(o,r)&&(a=n.getCell(r,u,o),l=!0),t.isNullOrUndefined(w)?l&&a.removeClass("e-selected"):(y.push({rowIndex:r,colIndex:u,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(r+":"+u),l&&(a.addClass("e-selected"),this._isApplied=!0,f=[r,u]));l=!1}c=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(c&&(f=i._goToCollection.selected[c-1].split(":")),f.length&&this._freezeScroll(f[0],f[1],i));this._isApplied||c||n._showAlertDlg("Alert","NoCellFound","",200);v.selectedCell=y;!n._isUndoRedo&&this._isApplied&&(n._completeAction(v),n._trigActionComplete(v))},_applyGotoCFormat:function(){var s,h,a,r,u,f,c,l=!1,p=[],e,n=this.XLObj,o=n.getActiveSheetIndex(),w=n.model.sheets[o].usedRange,v,b=w.rowIndex,k=w.colIndex,i=n.getSheet(o),d=i._selectedCells,g=0,nt=0,y={sheetIndex:o,reqType:"find-replace",operation:"conditions"};for(this._isApplied=!1,i._goToCollection={multiple:!1,selected:[]},d.length>1&&(e=this._getSelRangeDetails(d),b=e[0],k=e[1],g=e[2],nt=e[3],i._goToCollection.multiple=!0),s=0;s<=b;s++){for(h=0;h<=k;h++)r=s+g,u=h+nt,v=n.XLEdit.getPropertyValue(r,u,"cFormatRule"),n._isRowViewable(o,r)&&(a=n.getCell(r,u,o),l=!0),!t.isNullOrUndefined(v)&&v.length?(p.push({rowIndex:r,colIndex:u,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(r+":"+u),l&&(a.addClass("e-selected"),this._isApplied=!0,f=[r,u])):l&&a.removeClass("e-selected");l=!1}c=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(c&&(f=i._goToCollection.selected[c-1].split(":")),f.length&&this._freezeScroll(f[0],f[1],i));this._isApplied||c||n._showAlertDlg("Alert","NoCellFound","",200);y.selectedCell=p;!n._isUndoRedo&&this._isApplied&&(n._completeAction(y),n._trigActionComplete(y))},_applyGotoConstants:function(i,r,u,f){var v,y,d,o,s,l,p,w=!1,et=[],g,a,e=this.XLObj,b=e.getActiveSheetIndex(),h,k,nt=e.model.sheets[b].usedRange,tt=nt.rowIndex,it=nt.colIndex,c=e.getSheet(b),rt=c._selectedCells,ut=0,ft=0;for(this._isApplied=!1,c._goToCollection={multiple:!1,selected:[]},rt.length>1&&(a=this._getSelRangeDetails(rt),tt=a[0],it=a[1],ut=a[2],ft=a[3],c._goToCollection.multiple=!0),v=0;v<=tt;v++){for(y=0;y<=it;y++)o=v+ut,s=y+ft,h=t.isNullOrUndefined(e.XLEdit.getPropertyValue(o,s))?"":e.XLEdit.getPropertyValue(o,s).toString(),k=t.isNullOrUndefined(e.XLEdit.getPropertyValue(o,s,"value2"))?"":e.XLEdit.getPropertyValue(o,s,"value2").toString(),g=h.charAt(0)==="="&&typeof k=="string",e._isRowViewable(b,o)&&(d=e.getCell(o,s,b),w=!0),!g&&(i&&n.isNumeric(h)||r&&!(h.toLowerCase()==="true"||h.toLowerCase()==="false")&&!n.isNumeric(h)&&h.length>0||u&&(h.toLowerCase()==="true"||h.toLowerCase()==="false")||f&&k.length!==0&&k.indexOf("#")===0)?(et.push({rowIndex:o,colIndex:s,isApply:!0}),e.model.scrollSettings.allowVirtualScrolling&&c._goToCollection.selected.push(o+":"+s),w&&(d.addClass("e-selected"),this._isApplied=!0,l=[o,s])):w&&d.removeClass("e-selected");w=!1}p=c._goToCollection.selected.length;(e._isFrozen(c.frozenRows)||e._isFrozen(c.frozenColumns))&&(p&&(l=c._goToCollection.selected[p-1].split(":")),l.length&&this._freezeScroll(l[0],l[1],c));this._isApplied||p||e._showAlertDlg("Alert","NoCellFound","",200)},_applyGotoColDiff:function(){var o,s,a,t,r,u,h,c=!1,y=[],f,n=this.XLObj,e=n.getActiveSheetIndex(),p=n.model.sheets[e].usedRange,w,b=p.rowIndex,k=p.colIndex,i=n.getSheet(e),d=i._selectedCells,l=0,g=0,v={sheetIndex:e,reqType:"find-replace",operation:"coldiff"},nt;if(this._isApplied=!1,i._goToCollection={multiple:!1,selected:[]},d.length>1)for(f=this._getSelRangeDetails(d),b=f[0],k=f[1],l=f[2],g=f[3],i._goToCollection.multiple=!0,o=0;o<=k;o++){for(t=o+g,nt=n.XLEdit.getPropertyValue(l,t)?n.XLEdit.getPropertyValue(l,t).toString():"",s=0;s<=b;s++)r=s+l,w=n.XLEdit.getPropertyValue(r,t)?n.XLEdit.getPropertyValue(r,t).toString():"",n._isRowViewable(e,r)&&(a=n.getCell(r,t,e),c=!0),w===nt?c&&a.removeClass("e-selected"):(y.push({rowIndex:r,colIndex:t,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(r+":"+t),c&&(a.addClass("e-selected"),this._isApplied=!0,u=[r,t]));c=!1}h=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(h&&(u=i._goToCollection.selected[h-1].split(":")),u.length&&this._freezeScroll(u[0],u[1],i));this._isApplied||h||n._showAlertDlg("Alert","NoCellFound","",200);v.selectedCell=y;!n._isUndoRedo&&this._isApplied&&(n._completeAction(v),n._trigActionComplete(v))},_applyGotoRowDiff:function(){var f,e,c,i,o,s=!1,a=[],r,n=this.XLObj,u=n.getActiveSheetIndex(),v=n.model.sheets[u].usedRange,y,p=v.rowIndex,w=v.colIndex,t=n.getSheet(u),b=t._selectedCells,k=0,h=0,d,l={sheetIndex:u,reqType:"find-replace",operation:"rowdiff"};if(this._isApplied=!1,t._goToCollection={multiple:!1,selected:[]},b.length>1)for(r=this._getSelRangeDetails(b),p=r[0],w=r[1],k=r[2],h=r[3],t._goToCollection.multiple=!0,f=0;f<=p;f++){for(rIdx=f+k,d=n.XLEdit.getPropertyValue(rIdx,h)?n.XLEdit.getPropertyValue(rIdx,h).toString():"",e=0;e<=w;e++)cIdx=e+h,y=n.XLEdit.getPropertyValue(rIdx,cIdx)?n.XLEdit.getPropertyValue(rIdx,cIdx).toString():"",n._isRowViewable(u,rIdx)&&(c=n.getCell(rIdx,cIdx,u),s=!0),y===d?s&&c.removeClass("e-selected"):(a.push({rowIndex:rIdx,colIndex:cIdx,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&t._goToCollection.selected.push(rIdx+":"+cIdx),s&&(c.addClass("e-selected"),this._isApplied=!0,i=[rIdx,cIdx]));s=!1}o=t._goToCollection.selected.length;(n._isFrozen(t.frozenRows)||n._isFrozen(t.frozenColumns))&&(o&&(i=t._goToCollection.selected[o-1].split(":")),i.length&&this._freezeScroll(i[0],i[1],t));this._isApplied||o||n._showAlertDlg("Alert","NoCellFound","",200);l.selectedCell=a;!n._isUndoRedo&&this._isApplied&&(n._completeAction(l),n._trigActionComplete(l))},_freezeScroll:function(n,t,i){var r,u=this.XLObj;r=u._getIdxWithOffset(n,t,!1,["freeze"]);(i._ftopRowIdx>n||n>i._bottomRow.idx)&&u._scrollContent({y:r.yOffset-i._frozenHeight+1},!0);(i._fleftColIdx>t||t>i._rightCol.idx)&&u._scrollContent({x:r.xOffset-i._frozenWidth+1},!0)}}}(jQuery,Syncfusion);$.fn.setInputPos=function(n,t){return t||(t=n),$(this).is(":visible")?this.each(function(){if(this.setSelectionRange)this.focus(),this.setSelectionRange(n,t);else if(this.createTextRange){var i=this.createTextRange();i.collapse(!0);i.moveEnd("character",t);i.moveStart("character",n);i.select()}}):void 0},function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.shape=function(n){this.XLObj=n;this._imgX=0;this._imgY=0;this._imgOffsetleft=0;this._imgOffsetTop=0;this._shapeType="img";this._shapeROStart=!1;this._shapeRSStart=!1;this._imgRSWStart=!1;this._imgRSEStart=!1;this._imgRSNStart=!1;this._imgRSSStart=!1;this._changePicture=!1;this._picCellIdx={};this._insertShape=!1};t.spreadsheetFeatures.shape.prototype={_insertPicture:function(n){var i=this.XLObj,u=i._browserDetails.name==="msie"&&parseInt(i._browserDetails.version)<10?n.responseText:n.xhr.response,f,e,s,h,o,l;if(u.startsWith("Invalid"))i._showAlertDlg("Alert","ImageValAlert");else if(f=i.getActiveSheetIndex(),e=i.getSheet(f),this._changePicture)this.changePicture(null,u);else{var r=i.getActiveCell(),c=i.model.pictureSettings,a=c.height,v=c.width;t.isNullOrUndefined(r)&&(o=i.element.find(".e-ss-activeimg").get(0),l=this._getCellIndexFromOffset(o.offsetTop,o.offsetLeft));s=e._colWidthCollection[r.colIndex];h=e._rowHeightCollection[r.rowIndex];this._insertShape=!0;this._createPicture(f,r,u,h,s,v,a)}},changePicture:function(t,i){var u=this.XLObj,s=u.getActiveSheetIndex(),a=u.getSheet(s),r,h,c,l,f,e,o;r=t?n("#"+t).get(0):u.getSheetElement(s).find(".e-ss-activeimg").get(0);h=r.offsetLeft;c=r.offsetTop;l=this._getCellIndexFromOffset(c,h);f=a.shapeMngr;n(r).css("background-image","url('"+i+"')");e=f.picture[r.id];o={sheetIndex:s,reqType:"shape",shapeType:"picture",action:"changepicture",id:n(r).attr("id"),cell:l,prev:{img:f.sharedPics[e.data],data:e.data,pcIdx:r.id},cur:{img:i,pcIdx:r.id}};f.sharedPics.indexOf(i)===-1&&f.sharedPics.push(i);e.data=f.sharedPics.indexOf(i);o.cur.data=e.data;this._changePicture=!1;u.setSheetFocus();u._completeAction(o);u._trigActionComplete(o)},setPicture:function(n,t,i,r,u,f){var e=this.XLObj,o,s,h,c,l;if(e.model.pictureSettings.allowPictures&&!e.model.isReadOnly)return(n=e._getRangeArgs(n,"object"),o=n[0],s=n[1],e.model.allowLockCell&&e._isCellProtected(o,s,!1))?void 0:(h=e.getActiveSheetIndex(),l=e.model.pictureSettings,r=r?r:l.height,i=i?i:l.width,e._isRowViewable(h,o)?(c=e.getCell(o,s)[0],u=u?u:c.offsetTop,f=f?f:c.offsetLeft):(u=u?u:0,f=f?f:0),this._createPicture(h,{rowIndex:o,colIndex:s},t,u,f,i,r))},resetPicture:function(i,r){var f=this.XLObj,u,s,e,o;u=i?n("#"+i):f.element.find(".e-ss-activeimg");s=new RegExp("\\be-shapebdr.*?\\b","g");e={sheetIndex:f.getActiveSheetIndex(),reqType:"shape",shapeType:"picture",action:"resetpicture",id:n(u).attr("id"),actionType:r};f._dupDetails=!0;t.isNullOrUndefined(u[0].className.match(s))||(o=f.XLShape._getImgStyleFromHashCode(u[0].className.match(s)[0]));e.prev=o?{bcolor:o["border-color"],bstyle:o["border-style"],bwidth:o["border-width"]}:{};u[0].className=u[0].className.replace(s,"");e.cur={bcolor:u.css("border-color"),bstyle:u.css("border-style"),bwidth:u.css("border-width")};r!="resetpicture"&&(e.prev.width=u.css("width"),e.prev.height=u.css("height"),u.css({width:f.model.pictureSettings.width,height:f.model.pictureSettings.height}),e.cur.width=u.css("width"),e.cur.height=u.css("height"),f.XLShape._updateShapeObj(u[0]),f._hasClass(u[0],"e-ss-activeimg")&&f.XLRibbon._formatTabUpdate());f._dupDetails=!1;f._completeAction(e);f._trigActionComplete(e)},_createPicture:function(n,i,r,u,f,e,o,s,h,c,l,a){var w,d,g;h=h?h:"transparent";c=c?c:"solid";l=l?l:"1px";var v=this.XLObj,k,b=v.getSheet(n),y={sheetIndex:n,targetCell:i,top:u,left:f,width:e,height:o,bcolor:h,bstyle:c,bwidth:l,reqType:"picture",add:"add"},p;if(k={sheetIndex:y.sheetIndex,targetCell:y.targetCell,top:y.top,left:y.left,width:y.width,height:y.height,bcolor:y.bcolor,bstyle:y.bstyle,bwidth:y.bwidth,reqType:"picture",action:"add"},!v._trigActionBegin(k))return b._isImported||(this._insertShape=!0),u=y.top,f=y.left,e=y.width,o=y.height,s=t.isNullOrUndefined(s)?v.model.allowCharts&&v.XLChart._shapeCnt:s,v._isExport&&(a.cnt=s),p=v._id+"_picture"+s,i||(i=this._getCellIndexFromOffset(u,f,n)),d=i.rowIndex,g=i.colIndex,!v._isUndoRedo&&v.model.allowCharts&&v.XLChart._shapeCnt++,this._updateShapeMngr(i,{picture:{data:r,id:p,height:o,width:e,left:f,top:u,rowIndex:d,colIndex:g,bwidth:l,bcolor:h,bstyle:c}},"picture"),v._isExport||this._refreshPictureElement({top:u,left:f,width:e,height:o,bcolor:h,bstyle:c,bwidth:l,imgData:r,cnt:s,sheetIdx:n}),v.setSheetFocus(),b._isImported&&!b._isLoaded||v._isUndoRedo||v._isPaste||v.XLClipboard._isShape||v._isExport||(w={sheetIndex:n,reqType:"shape",shapeType:"picture",action:"remove",id:p,actCell:i,img:r,cnt:s},w.position={top:u,left:f,height:o,width:e},v._completeAction(w),v._trigActionComplete(w)),v.model.showRibbon&&v.XLRibbon._formatTabUpdate(),p},_refreshPictureElement:function(i){var r=this.XLObj,u,f,e;r._getJSSheetContent(i.sheetIdx).find(".e-spreadsheetcontentcontainer > .e-content").append(t.buildTag("div.e-ss-object","","",{id:r._id+"_picture"+i.cnt}));u=n("#"+r._id+"_picture"+i.cnt);u.data("parentID",r._id);u.css({"background-image":"url('"+i.imgData+"')",height:i.height,width:i.width,left:i.left,top:i.top});f=i.bwidth+" "+i.bstyle+" "+i.bcolor;e=this._getImgBorderHashCode({"border-color":i.bcolor,"border-style":i.bstyle,"border-width":i.bwidth});r.model.allowCellFormatting&&r.XLFormat._writeCssRules(e,r.XLFormat._getCssPropertyAsString({border:{left:f,right:f,top:f,bottom:f}}));u.addClass(e);this._selectImg(u)},_shapeMouseDown:function(t){var i,f;t.preventDefault();i=this.XLObj;f=document.activeElement.id;i._isTouchEvt&&this._imgMouseMove(t);(f.indexOf("PictureHeight")>-1||f.indexOf("PictureWidth")>-1)&&i.setSheetFocus();var u,s=t.target.id,r=n(t.target),h=r.get(0),e=h.offsetLeft,o=h.offsetTop,c=i._setXY(t);this._selectImg(r);this._picCellIdx=this._getCellIndexFromOffset(o,e);this._imgOffsetleft=e;this._imgOffsetTop=o;this._imgX=c[0];this._imgY=c[1];this._shapeType=s.indexOf("chart")>-1?"chart":"img";r.css("cursor")==="move"?this._shapeROStart=!0:(r.css("cursor")==="col-resize"||r.css("cursor")==="row-resize")&&(this._shapeRSStart=!0,i._getContent(i.getActiveSheetIndex()).find(".e-ss-imgvisual").css({left:e,top:o,height:r.height(),width:r.width()}));this._shapeType==="chart"&&(u=i.XLChart._getShapeObj(s,this._shapeType),i.getActiveSheetIndex()===u.dataSheetIdx&&i.XLChart._focusChartRange(u.xAxis.range,u.yAxis.range,u.legend.range));i.model.enableContextMenu&&i.XLCMenu._isMenuOpened&&i.XLCMenu.hideCMenu()},_imgKeyDown:function(n){var r=this.XLObj,s=r.getActiveSheetIndex(),t=r._getContent(s).find(".e-ss-activeimg"),i=t.get(0),e=i.offsetLeft,o=i.offsetTop,u,f,h;if(this._shapeType=t[0].id.indexOf("chart")>-1?"chart":"img",this._picCellIdx=this._getCellIndexFromOffset(o,e),n.shiftKey||n.ctrlKey)n.shiftKey&&!n.ctrlKey&&(n.keyCode===39||n.keyCode===38?(n.preventDefault(),u=t.height()+2,f=t.width()+2,u<400&&f<600&&t.css({width:f,height:u}),this._updateShapeObj(i),r.XLRibbon._formatTabUpdate()):(n.keyCode===37||n.keyCode===40)&&(n.preventDefault(),u=t.height()-2,f=t.width()-2,u>40&&f>60&&t.css({width:f,height:u}),this._updateShapeObj(i),r.XLRibbon._formatTabUpdate()));else{switch(n.keyCode){case 39:n.preventDefault();t.css({left:e+2});this._updateShapeObj(i);break;case 37:n.preventDefault();e>1&&t.css({left:e-2});this._updateShapeObj(i);break;case 38:n.preventDefault();o>1&&t.css({top:o-2});this._updateShapeObj(i);break;case 40:n.preventDefault();t.css({top:o+2});this._updateShapeObj(i)}this._onKeyscrollShape(s,t,n)}n.keyCode===46&&(n.preventDefault(),h=!1,r.XLClipboard._isShape&&(r.XLClipboard._isShape=!1,h=!0),this._deleteShape(s,t),h&&(r.XLClipboard._isShape=!0))},_shapeMouseUp:function(t){var r=this.XLObj,o={};if(!r._isExport){var l,a,c="chart",f,s=r.getActiveSheetIndex(),v=r.getSheet(s),y=r._getContent(s),u=y.find(".e-ss-activeimg"),h=y.find(".e-ss-imgvisual"),e=n(t.target),i=e.get(0);if((e.hasClass("e-ss-picture")||e[0].id.indexOf(r._id+"_picture")>-1)&&r.model.showRibbon&&r.XLRibbon._formatTabUpdate(),i.id.indexOf(c)>-1&&i.id.indexOf("Ribbon")<0&&(i=i.id.indexOf("_svg")>-1?n(i).parents(".e-ss-object").get(0):i),u.length<1&&(this._shapeROStart=!1),i.className.indexOf("e-ss-imgvisual")>-1||i.className.indexOf("e-ss-object")>-1||(this._shapeROStart&&(i=u[0]),this._shapeRSStart&&(i=h[0])),this._shapeROStart)r._isTouchEvt&&(a=r._getOriginalEvt(t),i=document.elementFromPoint(a.clientX,a.clientY)),r._isUndoRedo||(parseInt(u.css("top"))!==i.offsetTop||parseInt(u.css("left"))!==i.offsetLeft)&&(f={sheetIndex:s,reqType:"shape",shapeType:"chart",action:"edit",actionType:"reorder",id:n(u).attr("id"),visualImg:h,trgt:e},f.prev={top:parseInt(u.css("top")),left:parseInt(u.css("left")),height:parseInt(u.css("height")),width:parseInt(u.css("width"))},f.cur={top:i.offsetTop,left:i.offsetLeft,height:e.height(),width:e.width()},u[0].id.indexOf(c)>-1&&(l=r._getIdxWithOffset(f.cur.top,f.cur.left,!0),v.shapeMngr[c][u[0].id].rowIndex=l.rowIdx,v.shapeMngr[c][u[0].id].colIndex=l.colIdx),r._checkIndicesInContainer(s,this._picCellIdx.rowIndex,this._picCellIdx.colIndex)&&(f.obj=n.extend(!0,{},r._dataContainer.sheets[s][this._picCellIdx.rowIndex][this._picCellIdx.colIndex]),r._completeAction(f),r._trigActionComplete(f))),u.css({left:i.offsetLeft,top:i.offsetTop}),this._updateShapeObj(i),h.removeClass("e-ss-picture").hide();else if(this._shapeRSStart&&(r._isUndoRedo||(r._isTouchEvt&&(i=h[0]),i.className.indexOf("e-ss-imgvisual")<0&&h.length>0&&this._shapeROStart&&(i=h[0]),e=n(i),(parseInt(u.css("height"))!==e.height()||parseInt(u.css("width"))!==e.width())&&r._checkIndicesInContainer(s,this._picCellIdx.rowIndex,this._picCellIdx.colIndex)&&(f={sheetIndex:s,reqType:"shape",shapeType:"chart",action:"edit",actionType:"resize",id:n(u).attr("id"),visualImg:h,trgt:e},f.prev={top:parseInt(u.css("top")),left:parseInt(u.css("left")),height:parseInt(u.css("height")),width:parseInt(u.css("width"))},f.cur={top:i.offsetTop,left:i.offsetLeft,height:e.height(),width:e.width()},f.obj=n.extend(!0,{},r._dataContainer.sheets[s][this._picCellIdx.rowIndex][this._picCellIdx.colIndex]),r._completeAction(f),r._trigActionComplete(f))),f&&u.css({left:i.offsetLeft,top:i.offsetTop,height:e.height(),width:e.width()}),this._updateShapeObj(i),h.removeClass("e-ss-picture").hide(),this._shapeType==="img"&&r.model.showRibbon&&r.XLRibbon._formatTabUpdate(),this._shapeType===c&&(r.XLChart.resizeChart(u.attr("id"),e.height(),e.width()),r.model.showRibbon&&r.XLRibbon._chartDesignTabUpdate(n("#"+u.attr("id")))),o.event=t,o.target=t.target,f&&f.cur&&f.prev&&(o.newHeight=f.cur.height,o.newWidth=f.cur.width,o.oldHeight=f.prev.height,o.oldWidth=f.prev.width),o.reqType=i.id.indexOf(c)>-1?"chart-resize":"picture-resize",this.XLObj._trigger("resizeEnd",o))){this._refreshImgResizing();this._shapeRSStart=!1;return}this._refreshImgResizing();this._shapeROStart=this._shapeRSStart=!1}},_imgMouseMove:function(n){var i=this.XLObj,s={};if(i._getContent(i.getActiveSheetIndex()).find(".e-ss-activeimg").length){n.preventDefault();var p=i.getActiveSheetIndex(),h=i._getContent(p),u=h.find(".e-ss-activeimg"),t=h.find(".e-ss-imgvisual"),c=u.get(0),o=c.getBoundingClientRect(),w=i._setXY(n),f=w[0],e=w[1],r,l,a;if(this._shapeROStart){if(this.XLObj._trigger("dragShape",n))return;t.show();c.id.indexOf("picture")>-1&&t.addClass("e-ss-picture");l=f-(this._imgX-this._imgOffsetleft);a=e-(this._imgY-this._imgOffsetTop);l>-1&&a>-1&&t.css({left:l,top:a,height:u.height(),width:u.width()})}else{var v=t.width(),y=t.height(),b=c.offsetWidth,k=c.offsetHeight,d=i._getJSSheetContent(p).find(".e-spreadsheetcontentcontainer > .e-content"),g=h.find(".e-hscrollbar").data("ejScrollBar"),nt=h.find(".e-vscrollbar").data("ejScrollBar");if(this._shapeRSStart){if(s.event=n,s.target=n.target,s.height=u.height(),s.width=u.width(),s.reqType=c.id.indexOf("chart")>-1?"chart-resize":"picture-resize",this.XLObj._trigger("resizeStart",s)){this._shapeRSStart=!1;return}if(t.show(),c.id.indexOf("picture")>-1&&t.addClass("e-ss-picture"),u.css("cursor")==="col-resize"||u.css("cursor")==="row-resize")switch(!0){case this._imgRSWStart:r=this._imgX-f;l=t[0].offsetLeft-r;l>-1&&(t.css({width:v+r,left:l}),this._imgX=f);break;case this._imgRSEStart:r=this._imgX-f;i.model.scrollSettings.allowScrolling&&v-r+t[0].offsetLeft+5<d.width()+g.value()&&(t.css({width:v-r}),this._imgX=f);break;case this._imgRSNStart:r=this._imgY-e;a=t[0].offsetTop-r;a>-1&&(t.css({height:y+r,top:a}),this._imgY=e);break;case this._imgRSSStart:r=this._imgY-e;i.model.scrollSettings.allowScrolling&&y-r+t[0].offsetTop+5<d.height()+nt.value()&&(t.css({height:y-r}),this._imgY=e)}}else this._refreshImgResizing(),f<=o.left+(i._isTouchEvt?20:4)&&f>=o.left?(u.addClass("e-ss-imgcresize"),this._imgRSWStart=!0):f<=o.left+b&&f>=o.left+b-(i._isTouchEvt?20:4)?(u.addClass("e-ss-imgcresize"),this._imgRSEStart=!0):h.find(".e-ss-imgcresize").removeClass("e-ss-imgcresize"),e<=o.top+(i._isTouchEvt?20:4)&&e>=o.top?(u.addClass("e-ss-imgrresize"),this._imgRSNStart=!0):e<=o.top+k&&e>=o.top+k-(i._isTouchEvt?20:4)?(u.addClass("e-ss-imgrresize"),this._imgRSSStart=!0):h.find(".e-ss-imgrresize").removeClass("e-ss-imgrresize")}}},_deleteShape:function(n,t){var l,i=this.XLObj,r=this._picCellIdx,s=i._dataContainer,a=i.getSheet(n),h=a.shapeMngr,e=s.sheets[n][r.rowIndex][r.colIndex],o,p=t.data("parentID"),v=t.get(0).id.replace(p+"_",""),u=v.replace(/[0-9]/g,""),c=t.get(0),y,f=h[u][e[u][0]];i._isUndoRedo||i._isPaste||i.XLClipboard._isShape||(o={sheetIndex:n,id:c.id,picIndex:c.id,reqType:"shape",shapeType:u,action:"create",options:f,range:f.range,img:h.sharedPics[f.data],bcolor:f.bcolor,bstyle:f.bstyle,bwidth:f.bwidth},o.actCell={rowIndex:r.rowIndex,colIndex:r.colIndex},o.position={height:f.height,width:f.width,top:f.top,left:f.left},o.cnt=v.replace(/[a-z]/g,""),i._completeAction(o),i._trigActionComplete(o));e[u].some(function(n,t){return c.id===h[u][e[u][t]].id?(y=t,!0):!1});Object.keys(e).length<2&&e[u].length<2?(delete s.sheets[n][r.rowIndex][r.colIndex],i.getObjectLength(s.sheets[n][r.rowIndex])<1&&delete s.sheets[n][r.rowIndex]):e[u].length<2?delete e[u]:e[u].splice(y,1);delete h[u][c.id];l={rowIndex:r.rowIndex,colIndex:r.colIndex};n===i._getSheetIndex()&&(i.setActiveCell(r.rowIndex,r.colIndex),i.performSelection(l,l));t.remove();i.model.allowFormulaBar&&i.updateFormulaBar();i.model.showRibbon&&(u==="picture"?i.XLRibbon._toggleFormatTab():i.XLRibbon._toggleChartDesignTab());a._isChartBorderDrawn&&i.XLChart._clearChartRange(i._arrayAsString(i._chartBorder))},_selectImg:function(n){this.XLObj._getContent(this.XLObj.getActiveSheetIndex()).find(".e-ss-activeimg").removeClass("e-ss-activeimg");n.addClass("e-ss-activeimg");this.XLObj.XLSelection._cleanUp(!0);this.XLObj.model.allowFormulaBar&&this.XLObj.updateFormulaBar()},_refreshImgResizing:function(){this._imgRSEStart=!1;this._imgRSWStart=!1;this._imgRSNStart=!1;this._imgRSSStart=!1},_getShapePropeties:function(n,t,i){for(var r,u=this.XLObj.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,i);r in u;)return u[r].id===t?u[r]:void 0},_updateShapeMngr:function(t,i,r,u){var s,h={},f=this.XLObj,o=u||f.getActiveSheetIndex(),e=f.getSheet(o).shapeMngr,c=e[r];c[i[r].id]=n.extend(!0,{},i[r]);r==="picture"&&(e.sharedPics.indexOf(i[r].data)<0&&e.sharedPics.push(i[r].data),s=e.sharedPics.indexOf(i[r].data),c[i[r].id].data=s);(f._isPaste||this._insertShape||f.XLClipboard._isShape||f.isImport||!f.getSheet(o)._isUpdated)&&(h[r]=i[r].id,f.XLEdit._updateDataContainer(t,{dataObj:h,sheetIdx:o}),this._insertShape=!1)},_updateShapeObj:function(t){var f,e=this.XLObj,s=e.getActiveSheetIndex(),h=e._dataContainer,o,u,r=this._shapeType==="img"?"picture":"chart",i=this._picCellIdx,l=e.getSheet(s).shapeMngr,c,a={},v=e._getContent(s).find(".e-ss-activeimg");(e.getObjectLength(this._picCellIdx)||(i=this._picCellIdx=this._getCellIndexFromOffset(t.offsetTop,t.offsetLeft)),f=v.length?v:n("#"+t.id),u=h.sheets[s][i.rowIndex][i.colIndex],u&&u[r])&&(o=l[r][f[0].id],u[r].some(function(n,t){return f[0].id===l[r][u[r][t]].id?(c=t,!0):!1}),a[r]=u[r][c],e.getObjectLength(u)<2&&u[r].length<2?delete h.sheets[s][i.rowIndex][i.colIndex]:u[r].length<2?delete h.sheets[s][i.rowIndex][i.colIndex][r]:h.sheets[s][i.rowIndex][i.colIndex][r].splice(c,1),this._picCellIdx=i=this._getCellIndexFromOffset(t.offsetTop,t.offsetLeft),o.height=f.height(),o.width=f.width(),o.left=f[0].offsetLeft,o.top=f[0].offsetTop,o.rowIndex=i.rowIndex,o.colIndex=i.colIndex,e.XLEdit._updateDataContainer({rowIndex:i.rowIndex,colIndex:i.colIndex},{dataObj:a}))},changePictureBorder:function(i,r,u,f){var e=this.XLObj,v=e.getActiveSheetIndex(),o=n("#"+i)[0],y=o.offsetLeft,p=o.offsetTop,s,w=this._getCellIndexFromOffset(p,y),b=e.getSheet(v).shapeMngr,l,k,a=new RegExp("\\be-shapebdr.*?\\b","g"),h,c;l=b.picture[o.id];s={sheetIndex:v,reqType:"shape",shapeType:"picture",action:"border",id:n(e.getSheetElement(v).find(".e-ss-activeimg")).attr("id"),prevClass:t.isNullOrUndefined(o.className.match(a))?o.className:o.className.match(a)[0],picIdx:k,cellIdx:w};h=r+" "+u+" "+f;c=this._getImgBorderHashCode({"border-color":f,"border-style":u,"border-width":r});e.model.allowCellFormatting&&e.XLFormat._writeCssRules(c,e.XLFormat._getCssPropertyAsString({border:{left:h,right:h,top:h,bottom:h}}));l.bcolor=f;l.bstyle=u;l.bwidth=r;o.className.match(a)&&(o.className=o.className.replace(a,""));n(o).addClass(c);s.curClass=c;s.borderProp=this._getImgStyleFromHashCode(c);e._dupDetails||e._isUndoRedo||(e._completeAction(s),e._trigActionComplete(s))},_getCellIndexFromOffset:function(n,i,r,u){var f,h,o=0,s={},c=this.XLObj,e=c.getSheet(c._getSheetIndex(r));if(!t.isNullOrUndefined(n))for(s.rowIndex=c._getMinRowIdx(e),f=0,h=e._rowHeightCollection.length;f<h;f++)if(o=e._rowHeightCollection[f],o>n){s.rowIndex=f-1;break}if(!t.isNullOrUndefined(i))for(s.colIndex=0,f=0,o=0,h=e.columnsWidthCollection.length;f<h;f++)if(o+=e.columnsWidthCollection[f]===0&&u?e.hideColsCollection[f]:e.columnsWidthCollection[f],o>i){s.colIndex=f;break}return s},_getImgBorderHashCode:function(n){var i=this.XLObj,t="";return"border-width"in n&&(t=parseInt(n["border-width"])+"N"),i.model.allowCellFormatting&&"border-style"in n&&(t=t+i.XLFormat._getStyleCode("BorderStyle",n["border-style"])+"N"),"border-color"in n&&(t=t+n["border-color"].replace("#","")),"e-shapebdr"+t},_getImgStyleFromHashCode:function(n){var i=this.XLObj,t={};return n=n||"",n=n.replace("e-shapebdr","").split("N"),n.length>1&&(t["border-width"]=n[0]+"px",t["border-style"]=["","solid","dashed","dotted"][n[1]],t["border-color"]="#"+n[2]),t},_scrollShape:function(n,t,i,r){var f={position:"none",action:"none"},u=this.XLObj,e=u._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content");parseInt(t.css("width"))+(t.offset().left-u._getContent(n).find(".e-content").offset().left)>u._getContent(n).find(".e-content").width()&&this._imgX<=i?f={position:"horizontal",action:"Increment"}:t.offset().left-e.offset().left<=0?f={position:"horizontal",action:"Decrement"}:parseInt(t.css("height"))+(t.offset().top-u._getContent(n).find(".e-content").offset().top)>u._getContent(n).find(".e-content").height()&&this._imgY<=r?f={position:"vertical",action:"Increment"}:t.offset().top-e.offset().top<=0&&(f={position:"vertical",action:"Decrement"});u.XLSelection._scrollCalculation(n,t.get(0),f)},_onKeyscrollShape:function(n,t,i){var r=this.XLObj,u=r._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content"),f=r._getContent(n).find("#hscrollBar").ejScrollBar("instance"),e=r._getContent(n).find("#vscrollBar").ejScrollBar("instance");u.offset().top+u[0].offsetHeight<=t.offset().top+t[0].offsetHeight&&(i.keyCode===40||i.keyCode===13&&!i.shiftKey)?e.scroll(e.value()+2,!0):t.offset().top-r.model.sheets[n]._frozenHeight<=u.offset().top&&(i.keyCode===38||i.keyCode===13&&i.shiftKey)&&e.value()-2>=0&&e.scroll(e.value()-2,!0);u[0].offsetWidth<=t.offset().left+t[0].offsetWidth&&(i.keyCode===39||i.keyCode===9&&!i.shiftKey)?f.scroll(f.value()+2,!0):t.offset().left-r.model.sheets[n]._frozenWidth<=u.offset().left&&(i.keyCode===37||i.keyCode===9&&i.shiftKey)&&f.value()-2>=0&&f.scroll(f.value()-2,!0)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.chart=function(n){this.XLObj=n;this._shapeCnt=1};t.spreadsheetFeatures.chart.prototype={createChart:function(n,i){var r=this.XLObj;if(r.model.allowCharts&&!r.model.isReadOnly){i=i||{};var o,e,f,c,l,u,s,a="chart",v,y=r._getSheetIndex(i.sheetIdx),h=r.getSheet(y),p;if(r._isUndoRedo&&(p=i.id.split("_"),o=p[p.length-1].replace(/[a-z]/g,"")),n=r._getRangeArgs(n,"object"),t.isNullOrUndefined(i.top)||t.isNullOrUndefined(i.left)||(i.activeCell=r.XLShape._getCellIndexFromOffset(i.top,i.left)),i.activeCell||(i.activeCell=h._activeCell),r.isRange(n)&&i.activeCell)return l=r._getCellInfo(i.activeCell),i.id=o?r._id+"_"+a+o:r._id+"_"+a+this._shapeCnt,i.type=i.type?i.type:"column",i.animation=i.animation?i.animation:!1,i.range=n,i.dataSheetIdx=i.dataSheetIdx?i.dataSheetIdx:y,i.height=i.height?i.height:r.model.chartSettings.height,i.width=i.width?i.width:r.model.chartSettings.width,i.top=i.top?i.top:l.top+2,i.left=i.left?i.left:l.left+2,i.isRowColSwitched=i.isRowColSwitched?i.isRowColSwitched:!1,v=r._getIdxWithOffset(i.top,i.left,!0),i.rowIndex=v.rowIdx,i.colIndex=v.colIdx,i.isResponsive=!1,i.canResize=!1,r.isUndefined(i.xRange)&&(s=this._processChartRange(n,i.dataSheetIdx),i.xRange=s.xRange,i.yRange=s.yRange,i.lRange=s.lRange),f=this._processChartSeries(i),i.series&&(r.XLClipboard._copyCells.length||r.XLClipboard._copyCells.length)&&(f.series=i.series),i.xRange=f.xRange,i.yRange=f.yRange,i.lRange=f.lRange,r.getActiveSheetIndex()===i.dataSheetIdx&&this._focusChartRange(f.xRange,f.yRange,f.lRange),e=this._renderBaseElem(a,i.top,i.left,o),e.ejChart(this._processChartOptions(i,f.series)),this._afterChartRefresh(),u=e.ejChart("model"),i.theme=u.theme,i.title={text:u.title.text.length?u.title.text:"",align:u.title.textAlignment},i.xAxis={min:u.primaryXAxis.range.min,max:u.primaryXAxis.range.max,interval:u.primaryXAxis.range.interval,title:{text:u.primaryXAxis.title.text.length?u.primaryXAxis.title.text:""},range:f.xRange},i.yAxis={min:u.primaryYAxis.range.min,max:u.primaryYAxis.range.max,interval:u.primaryYAxis.range.interval,title:{text:u.primaryYAxis.title.text.length?u.primaryYAxis.title.text:""},range:f.yRange},i.legend={visible:u.legend.visible,range:f.lRange,position:u.legend.position},h._isImported||(r.XLShape._insertShape=!0),r.XLShape._updateShapeMngr(i.activeCell,{chart:i},"chart"),i.theme.indexOf("dark")>-1&&e.addClass("e-ss-charttheme"),r.model.showRibbon&&!i.hideTab&&r.XLRibbon._chartDesignTabUpdate(e),r._on(e,t.eventType.mouseDown,r._mouseDownHandler),r._on(e,t.eventType.mouseMove,r._mouseMove),r.setSheetFocus(),r._isSheetNavigate||h._isImported&&!h._isLoaded||r._isUndoRedo||r._isPaste||r.XLClipboard._isShape||(c={sheetIndex:y,reqType:"shape",shapeType:"chart",action:"remove",options:i,range:i.range,id:i.id,position:{top:i.top,left:i.left}},r._completeAction(c),r._trigActionComplete(c)),i.id}},resizeChart:function(i,r,u){var f={},e=n("#"+i),o=e.ejChart("model"),s=this.XLObj;s.model.isReadOnly||e.length&&(f.height=!t.isNullOrUndefined(r)&&r>180?r.toString():"180",f.width=!t.isNullOrUndefined(u)&&u>180?u.toString():"180",e.ejChart("option",{size:f}),this._afterChartRefresh(),s.XLRibbon._setShapeWidthHeight({height:o.size.height,width:o.size.width,shapeType:"chart"}))},refreshChart:function(t,i){var e=this.XLObj,r,u,f;if(e.model.allowCharts&&!e.model.isReadOnly&&(u="marker",f=this._getShapeObj(t,"chart"),f)){for(r in i)f[r]=i[r];i.type&&(i.commonSeriesOptions={type:i.type},delete i.type);u in i&&(i.commonSeriesOptions?i.commonSeriesOptions.marker={visible:i.marker.visible}:i.commonSeriesOptions={marker:i.marker},delete i[u]);n("#"+t).ejChart("option",i)}},_processChartOptions:function(n,t){var r=yVisiblity=!1,i={commonSeriesOptions:{type:n.type,enableAnimation:n.animation},series:t,canResize:n.canResize,size:{height:n.height.toString(),width:n.width.toString()},enableRotation:!1,depth:100,wallSize:2,tilt:0,rotation:34,perspectiveAngle:90,sideBySideSeriesPlacement:!0};return n.enable3D&&(i.enable3D=!0),n.marker&&(i.commonSeriesOptions.marker=n.marker),n.theme&&(i.theme=n.theme),i.title=n.title||{},this.XLObj.getObjectLength(i.title)>0&&(i.title.textAlignment=n.title.align,delete i.title.align),i.legend=n.legend||{},n.xAxis&&n.xAxis.minorGridLines&&(r=n.xAxis.minorGridLines.visible),n.yAxis&&n.yAxis.minorGridLines&&(yVisiblity=n.yAxis.minorGridLines.visible),i.primaryYAxis=n.primaryYAxis||{labelFormat:this._chartYAxisFormat(n.yRange),minorTicksPerInterval:5,minorGridLines:{visible:yVisiblity},minorTickLines:{visible:!1}},i.primaryXAxis=n.primaryXAxis||{labelFormat:this._chartYAxisFormat(n.xRange),minorTicksPerInterval:5,minorGridLines:{visible:r},minorTickLines:{visible:!1},valueType:"category"},i},_chartYAxisFormat:function(n){if(!t.isNullOrUndefined(n)){var u=this.XLObj,i,r=t.globalize.preferredCulture().numberFormat.currency.symbol;return i=u.XLEdit.getPropertyValue(n[0],n[1],"type"),i==="accounting"?r+" {value}":i==="currency"?r+"{value}":i==="percentage"?"{value}%":"{value}"}},_processChartRange:function(n,i){var s=this.XLObj,l,f,h,r=n[0],u=n[1],o=n[2],e=n[3],c=s.XLEdit.getPropertyValue(r,e,null,i),y=s.XLEdit.getPropertyValue(o,u,null,i),p=s.XLEdit.getPropertyValue(r,u,null,i),a=r===o,v=u===e;return!s.isUndefined(p)||a||v?t.isNullOrUndefined(y)||s.isNumber(y)||a||v?(f=[r,u,o,e],t.isNullOrUndefined(c)||s.isNumber(c)||s._isDateTime(c)?t.isNullOrUndefined(p)&&(a||v)&&(h=[r,u,r,e],a?(f[1]=f[1]+1,h[3]=h[1]):f[0]=f[0]+1):(h=[r,u,r,e],f[0]=f[0]+1)):t.isNullOrUndefined(c)||s.isNumber(c)?(l=[r,u,o,u],f=[r,u+1,o,e]):(l=[r+1,u,o,u],f=[r+1,u+1,o,e],h=[r,u+1,r,e]):(l=[r+1,u,o,u],f=[r+1,u+1,o,e],h=[r,u+1,r,e]),{xRange:l,yRange:f,lRange:h}},_processChartSeries:function(n){n=n||{};var t=this.XLObj,a,b,i=n.xRange,r=n.yRange,u=n.lRange,f,k,e,o,v,y,p,w,s,d,h=0,c=0,g=[],l=["value2"];for(k=t.getRangeData({range:r,valueOnly:!0,sheetIdx:n.dataSheetIdx,skipFormula:!0}),v=r[2]-r[0]+1,y=r[3]-r[1]+1,n.isRowColSwitched?(f=u?t._toArrayData(t.getRangeData({range:u,property:l,sheetIdx:n.dataSheetIdx})):this._getVirtualXValues(y+1),i&&(e=t._toArrayData(t.getRangeData({range:i,property:l,sheetIdx:n.dataSheetIdx}))),o=v):(f=i?t._toArrayData(t.getRangeData({range:i,property:l,sheetIdx:n.dataSheetIdx})):this._getVirtualXValues(v+1),u&&(e=t._toArrayData(t.getRangeData({range:u,property:l,sheetIdx:n.dataSheetIdx}))),o=y),b=f.length,d=n.isRowColSwitched?1:o;h<o;){for(s=0,p=[],c=n.isRowColSwitched?c:h;s<b;)a=k[c],p.push({x:f[s],y:t.isNumber(a)?Number(a):0}),c+=d,s++;w={points:p};e&&(w.name=e[h]);g.push(w);h++}return{series:g,xRange:n.isRowColSwitched?u:i,yRange:r,lRange:n.isRowColSwitched?i:u}},_getVirtualXValues:function(n){for(var t=1,i=[];t<n;)i.push(t.toString()),t++;return i},_focusChartRange:function(n,t,i){var r=this.XLObj,u=r._chartBorder;this._clearChartRange(r._arrayAsString(u));i&&r.XLSelection._focusBorder({rowIndex:i[0],colIndex:i[1]},{rowIndex:i[2],colIndex:i[3]},u[0]);n&&r.XLSelection._focusBorder({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]},u[1]);r.XLSelection._focusBorder({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]},u[2]);r.getSheet(r.getActiveSheetIndex())._isChartBorderDrawn=!0},_clearChartRange:function(n){var t=this.XLObj;t.XLSelection._clearBorder(n);t.getSheet(t.getActiveSheetIndex())._isChartBorderDrawn=!1},_renderBaseElem:function(i,r,u,f){f=t.isNullOrUndefined(f)?this._shapeCnt:f;var e=this.XLObj,o=n("<div id='"+e._id+"_"+i+f+"' class='e-ss-object' style='top:"+r+"px;left:"+u+"px; min-height:180px; min-width:180px' ><\/div>");return o.data("parentID",e._id),e._getContent(e.getActiveSheetIndex()).find(".e-content").first().append(o),e.XLShape._selectImg(o),e._isUndoRedo||this._shapeCnt++,o},_refreshChartElements:function(n,t,i){for(var u,f,r,e=this.XLObj,o=1,s=e.model.sheetCount+1;o<s;){if(u=e.getSheet(o).shapeMngr.chart,f=e.getObjectLength(u),f)while(f--)r=u[e.getObjectKeys(u)[f]],r.dataSheetIdx===i&&(this.XLObj.inRange(r.range,n,t)||this.XLObj._inRow(r.range,n)||this.XLObj._inColumn(r.range,t))&&this._refreshChart(r);o++}},_refreshChart:function(t){if(n("#"+t.id).length!==0){var i=n("#"+t.id).data("ejChart"),u={xRange:t.xRange,yRange:t.yRange,lRange:t.lRange,isRowColSwitched:t.isRowColSwitched,dataSheetIdx:t.dataSheetIdx},r;i.model.series.length=0;r=this._processChartSeries(u);i.option({series:r.series,primaryXAxis:{labelFormat:this._chartYAxisFormat(t.xRange)},primaryYAxis:{labelFormat:this._chartYAxisFormat(t.yRange)}})}},switchRowColumn:function(t){var i=this.XLObj;if(!i.model.isReadOnly){var u,f=t||document.getElementById(i._id+"_chart").value,e=n("#"+f).ejChart("instance"),r=i.XLChart._getShapeObj(f,"chart"),o={sheetIndex:i.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:"srcolumn",cid:f,rowIndex:i.XLShape._picCellIdx.rowIndex,colIndex:i.XLShape._picCellIdx.colIndex};e.model.series.length=0;r.isRowColSwitched=!r.isRowColSwitched;obj={xRange:r.xRange,yRange:r.yRange,lRange:r.lRange,isRowColSwitched:r.isRowColSwitched,dataSheetIdx:r.dataSheetIdx};u=i.XLChart._processChartSeries(obj);e.option({series:u.series});i.getActiveSheetIndex()===r.dataSheetIdx&&i.XLChart._focusChartRange(u.xRange,u.yRange,u.lRange);r.xAxis.range=u.xRange;r.yAxis.range=u.yRange;r.legend.range=u.lRange;i._completeAction(o);i._trigActionComplete(o)}},updateChartElement:function(r,u,f){var o=this.XLObj;if(!o.model.isReadOnly){o._showDialog(o._id+"_chartname");var a,c=r||document.getElementById(o._id+"_chart").value,h,s,e=n("#"+c).ejChart("instance"),l=o.getActiveSheetIndex();details={sheetIndex:l,reqType:"shape",shapeType:"chart",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex};dataVal=o.getSheet(l).shapeMngr.chart[o.XLEdit.getPropertyValue(o.XLShape._picCellIdx.rowIndex,o.XLShape._picCellIdx.colIndex,"chart")[0]];f?h={model:{text:o._getLocStr("Ok")}}:f="";switch(u){case"PHAxis":details.visibility=!e.model.primaryXAxis.visible;e.option("primaryXAxis",{visible:details.visibility});dataVal.xAxis.visible=details.visibility;details.action=u;break;case"PVAxis":details.visibility=!e.model.primaryYAxis.visible;e.option("primaryYAxis",{visible:details.visibility});dataVal.yAxis.visible=details.visibility;details.action=u;break;case"PHAxisTitle":o._cOpt.prev={text:dataVal.xAxis.title.text};e.model.primaryXAxis.title.text.length!=0?(e.option("primaryXAxis",{title:{text:""}}),dataVal.xAxis.title.text="",details={sheetIndex:l,reqType:"shape",shapeType:"chart",action:"PX",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex,prev:{text:o._cOpt.prev.text},cur:{text:""}},o._completeAction(details),o._trigActionComplete(details)):(o._hasTitle="PX",document.getElementById(o._id+"_chartname").value=dataVal.xAxis.title.text,f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.xAxis.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f),o._cOpt={prevText:dataVal.title.text,prevAlign:e.model.title.textAlignment,curAlign:e.model.title.textAlignment});break;case"PVAxisTitle":o._cOpt.prev={text:dataVal.yAxis.title.text};e.model.primaryYAxis.title.text.length!=0?(e.option("primaryYAxis",{title:{text:""}}),dataVal.yAxis.title.text="",details={sheetIndex:l,reqType:"shape",shapeType:"chart",action:"PY",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex,prev:{text:o._cOpt.prev.text},cur:{text:""}},o._completeAction(details),o._trigActionComplete(details)):(o._hasTitle="PY",document.getElementById(o._id+"_chartname").value=dataVal.yAxis.title.text,f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.yAxis.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f),o._cOpt={prevText:dataVal.title.text,prevAlign:e.model.title.textAlignment,curAlign:e.model.title.textAlignment});break;case"CTNone":o._cOpt.prev={text:dataVal.title.text};e.model.title.text.length&&(e.option("title",{text:""}),dataVal.title.text="",details={sheetIndex:l,reqType:"shape",shapeType:"chart",action:"CT",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex,prev:{text:o._cOpt.prev.text},cur:{text:""}},o._completeAction(details),o._trigActionComplete(details));break;case"CTCenter":o._hasTitle="CT";o._cOpt={prevText:e.model.title.text,prevAlign:e.model.title.textAlignment};document.getElementById(o._id+"_chartname").value=dataVal.title.text;f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f);e.option("title",{textAlignment:"center"});o._cOpt.curAlign=e.model.title.textAlignment;dataVal.title.align="center";break;case"CTFar":o._hasTitle="CT";o._cOpt={prevText:e.model.title.text,prevAlign:e.model.title.textAlignment};document.getElementById(o._id+"_chartname").value=dataVal.title.text;f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f);e.option("title",{textAlignment:"far"});o._cOpt.curAlign=e.model.title.textAlignment;dataVal.title.align="far";break;case"CTNear":o._hasTitle="CT";o._cOpt={prevText:e.model.title.text,prevAlign:e.model.title.textAlignment};document.getElementById(o._id+"_chartname").value=dataVal.title.text;f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f);e.option("title",{textAlignment:"near"});o._cOpt.curAlign=e.model.title.textAlignment;dataVal.title.align="near";break;case"DLNone":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},a=e.model.series[0].marker.dataLabel.visible,i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:a,verticalTextAlignment:"far",textPosition:"top"}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:a};dataVal.series=e.model.series;break;case"DLCenter":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"center",textPosition:"middle",offset:{y:0}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"center",tPosn:"middle"};dataVal.series=e.model.series;break;case"DLIBase":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"far",textPosition:"bottom",offset:{y:0}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"far",tPosn:"bottom"};dataVal.series=e.model.series;break;case"DLIEnd":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"near",textPosition:"top",offset:{y:-10}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"near",tPosn:"top"};dataVal.series=e.model.series;break;case"DLOEnd":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"near",textPosition:"top",offset:{y:0}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"near",tPosn:"top"};dataVal.series=e.model.series;break;case"PMajorH":details.visibility=!e.model.primaryYAxis.majorGridLines.visible;e.option("primaryYAxis",{majorGridLines:{visible:details.visibility}});dataVal.yAxis.majorGridLines={visible:details.visibility};details.action=u;break;case"PMajorV":details.visibility=!e.model.primaryXAxis.majorGridLines.visible;e.option("primaryXAxis",{majorGridLines:{visible:details.visibility}});dataVal.xAxis.majorGridLines={visible:details.visibility};details.action=u;break;case"PMinorH":details.visibility=!e.model.primaryYAxis.minorGridLines.visible;e.option("primaryYAxis",{minorGridLines:{visible:details.visibility},minorTicksPerInterval:5,minorTickLines:{visible:details.visibility}});dataVal.yAxis.minorGridLines={visible:details.visibility};details.action=u;break;case"PMinorV":details.visibility=!e.model.primaryXAxis.minorGridLines.visible;e.option("primaryXAxis",{minorGridLines:{visible:details.visibility},minorTicksPerInterval:5,minorTickLines:{visible:details.visibility}});dataVal.xAxis.minorGridLines={visible:details.visibility};details.action=u;break;case"LNone":details.visibility=!1;e.option("legend",{visible:details.visibility});dataVal.legend.visible=details.visibility;details.action=u;break;case"LLeft":details.prev={position:e.model.legend.position};e.option("legend",{position:"left",visible:!0});dataVal.legend.position="left";details.cur={position:e.model.legend.position};details.action="Legend";break;case"LRight":details.prev={position:e.model.legend.position};e.option("legend",{position:"right",visible:!0});dataVal.legend.position="right";details.cur={position:e.model.legend.position};details.action="Legend";break;case"LBottom":details.prev={position:e.model.legend.position};e.option("legend",{position:"bottom",visible:!0});dataVal.legend.position="bottom";details.cur={position:e.model.legend.position};details.action="Legend";break;case"LTop":details.prev={position:e.model.legend.position};e.option("legend",{position:"top"});dataVal.legend.position="top";details.cur={position:e.model.legend.position};details.action="Legend"}t.isNullOrUndefined(details.action)||(o._completeAction(details),o._trigActionComplete(details))}},changeTheme:function(t,i){var r=this.XLObj,t=t||r.element.find("#"+r._id+"_chart").val(),u;u={sheetIndex:r.getActiveSheetIndex(),reqType:"shape",action:"chartTheme",chartId:t};u.prev={theme:n("#"+t).data("ejChart").model.theme};i&&i.indexOf("dark")>-1?n("#"+t).addClass("e-ss-charttheme"):n("#"+t).removeClass("e-ss-charttheme");r.XLChart.refreshChart(t,{theme:i});u.cur={theme:i};r._completeAction(u);r._trigActionComplete(u)},changeType:function(t,i){var u=this.XLObj,r=n("#"+t).data("ejChart"),f={sheetIndex:u.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:"chartType",chartId:t};f.prev={chartType:r.model.series[0].type,enable3D:r.model.enable3D,marker:r.model.series[0].marker.visible};u.XLChart.refreshChart(t,i);f.cur={chartType:r.model.series[0].type,enable3D:r.model.enable3D,marker:r.model.series[0].marker.visible};n("#"+u._id+"_charttypedlg").ejDialog("close");u._completeAction(f);u._trigActionComplete(f)},_getShapeObj:function(n,t){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()).shapeMngr[t],u=i.getObjectLength(r);if(u)return r[n]},_validateChartRange:function(n,t,i,r){var u=this.XLObj;if(!i)return{msg:u._getLocStr("YAxisMissing")};if(!(u.inRange(n,i[0],i[1])||u.inRange(n,i[2],i[3])))return{msg:u._getLocStr("InvalidYAxis")};if(t)if(u.inRange(n,t[0],t[1])||u.inRange(n,n[2],n[3])){if(t[3]-t[1]!=0)return{msg:u._getLocStr("InvalidXAxisColumns")}}else return{msg:u._getLocStr("InvalidXAxis")};return r&&!(u.inRange(n,r[0],r[1])||u.inRange(n,r[2],r[3]))?{msg:u._getLocStr("InvalidLegend")}:{status:!0}},_renderChartRangeDialog:function(){var t=this.XLObj,i={width:"25%",showRoundedCorner:!0,click:n.proxy(this._chartRangeDlgBtnClick,this)},r=n("<div id='"+t._id+"_chartrangedlg'><div class='e-dlgctndiv e-dlg-fields'><table cellpadding='0' cellspacing='0'><tr class='e-dlgtd-fields'><td>"+t._getLocStr("XAxisRange")+"<\/td><td><input type='text' class='ejinputtext' id='"+t._id+"_crxaxis'/><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+t._getLocStr("YAxisRange")+"<\/td><td><input type='text' class='ejinputtext' id='"+t._id+"_cryaxis' /><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+t._getLocStr("LegendRange")+"<\/td><td><input type='text' class='ejinputtext' id='"+t._id+"_crlaxis'/><\/td><\/tr><\/table><\/div><div class='e-dlg-btnfields' ><div class='e-dlg-btnctnr'><button id='"+t._id+"_crok' >"+t._getLocStr("Ok")+"<\/button><button id='"+t._id+"_crcancel'>"+t._getLocStr("Cancel")+"<\/button><\/div><\/div><\/div>");t.element.append(r);r.ejDialog({width:310,height:"auto",enableResize:!1,showOnInit:!1,enableModal:!0,cssClass:"e-ss-dialog e-"+t._id+"-dlg e-ss-chartrange",title:t._getLocStr("ChartRange")});n("#"+t._id+"_crok").ejButton(i);n("#"+t._id+"_crok").ejButton("option","cssClass","e-ss-okbtn");n("#"+t._id+"_crcancel").ejButton(i)},_chartRangeDlgBtnClick:function(t){var r,u,f,e,i=this.XLObj;t.model.text===i._getLocStr("Ok")&&(r=document.getElementById(i._id+"_chart").value,u=n("#"+i._id+"_crxaxis").val(),f=n("#"+i._id+"_cryaxis").val(),e=n("#"+i._id+"_crlaxis").val(),this.changeDataRange(r,u,f,e));!0&&n("#"+i._id+"_chartrangedlg").ejDialog("close")},changeDataRange:function(t,i,r,u){var l,o,f=this.XLObj,w,s,h,c,v=f._getSheetIndex(f.getActiveSheetIndex()),y=f.getSheet(v),a,p,e;o=this._getShapeObj(t,"chart");i.length&&(s=f.getRangeIndices(i));r.length&&(h=f.getRangeIndices(r));u.length&&(c=f.getRangeIndices(u));p={xRange:i,yRange:r,lRange:u};l=this._validateChartRange(o.range,s,h,c);l.status?(o.xRange=s,o.yRange=h,o.lRange=c,this._refreshChart(o),e=n("#"+t).ejChart("model"),o.xAxis={min:e.primaryXAxis.range.min,max:e.primaryXAxis.range.max,interval:e.primaryXAxis.range.interval,title:{text:e.primaryXAxis.title.text.length?e.primaryXAxis.title.text:""},range:s},o.yAxis={min:e.primaryYAxis.range.min,max:e.primaryYAxis.range.max,interval:e.primaryYAxis.range.interval,title:{text:e.primaryYAxis.title.text.length?e.primaryYAxis.title.text:""},range:h},o.legend={visible:e.legend.visible,range:c},f.getActiveSheetIndex()===o.dataSheetIdx&&this._focusChartRange(s,h,c)):(w=!1,f._showAlertDlg("Alert","T-"+l.msg,"",400));y._isImported&&!y._isLoaded||f._isUndoRedo||f._isExport||(a={sheetIndex:v,reqType:"shape",shapeType:"chart",action:"selectData",id:t,prev:f._selectDataval,cur:p},f._completeAction(a),f._trigActionComplete(a))},_afterChartRefresh:function(){var t=this.XLObj,n,i;t.model.allowFormulaBar&&(n=t.element.find(".e-formulabar")[0],i=parseInt(n.style.width)-1,n.style.width="0px",n.style.width=i+"px")}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.print=function(n){this.XLObj=n;this._printHeight=950;this._pageHeight=970;this._pageWidth=750;this._marginTop=30;this._marginBottom=150;this._printRowLabels=!1;this._isPrintSelection=!1;this._stRow=0;this._stColumn=0};t.spreadsheetFeatures.print.prototype={_printSetting:function(n){this.XLObj.model.pageSize=n;switch(n){case t.Spreadsheet.pageSize.A4:this._printHeight=950;this._pageHeight=970;this._pageWidth=750;this._marginTop=30;this._marginBottom=150;break;case t.Spreadsheet.pageSize.A3:this._printHeight=1350;this._pageHeight=1330;this._pageWidth=860;this._marginTop=30;this._marginBottom=150;break;case t.Spreadsheet.pageSize.Letter:this._printHeight=1040;this._pageHeight=920;this._pageWidth=860;this._marginTop=30;this._marginBottom=60}},printSelection:function(){var i=this.XLObj;if(i.model.printSettings.allowPrinting&&!i.model.isReadOnly){var e,h,u=i.getActiveSheetIndex(),s=i.getSheet(u)._selectedCells,r=s[0],o=s[s.length-1],c=o.colIndex-r.colIndex,f=t.buildTag("table"),l=t.buildTag("colgroup"),v=i._getContent(u).find("col"),a=t.buildTag("div#printDiv");for(i._refreshTemplates(u,!0,r.colIndex,r.colIndex+c+1),i._isPrint=!0,e=r.colIndex;e<o.colIndex;e++)n(v[e].outerHTML).attr("id","cc").appendTo(l);h=i.getRangeData({range:[r.rowIndex,r.colIndex,o.rowIndex,o.colIndex],property:["value","value2","format","border","type","isFilterHide","isRHide","isFHide","isMHide","merge","hRow","wrap","overflow","align","hyperlink","cFormatRule","rule"],sheetIdx:u,withRowIdx:!0});f.html(i._renderData(h,u,r.colIndex,c+1,!0));l.insertBefore(f.find("tbody"));this._stRow=r.rowIndex;this._stCol=r.colIndex;this._isPrintSelection=!0;i._isPrint=!1;this._printRowLabels?this._calculateTabCount(a,u,f):this._constructSheet(a,u,f,f[0].rows);i._refreshTemplates(u,!0)}},printSheet:function(){var i=this.XLObj;if(i.model.printSettings.allowPrinting&&!i.model.isReadOnly){var e,o,s,h=t.buildTag("div#printDiv"),r=i.getActiveSheetIndex(),u=i.getSheet(r),l=u.columnsWidthCollection,a=i._getContent(r).find("col"),f=t.buildTag("table"),c=t.buildTag("colgroup");for(i._refreshTemplates(r,!0,0,u.usedRange.colIndex+1),i._isPrint=!0,e=0,o=l.length;e<o;e++)n(a[e].outerHTML).attr("id","cc").appendTo(c);s=i.getRangeData({range:[0,0,u.usedRange.rowIndex,u.usedRange.colIndex],property:["value","value2","format","border","type","isFilterHide","isRHide","isFHide","isMHide","merge","hRow","wrap","overflow","align","hyperlink","cFormatRule","rule"],sheetIdx:r,withRowIdx:!0});f.html(i._renderData(s,r,0,u.usedRange.colIndex+1,!0));c.insertBefore(f.find("tbody"));this._printRowLabels?this._calculateTabCount(h,r,f):this._constructSheet(h,r,f,f[0].rows);i._isPrint=!1;i._refreshTemplates(r,!0)}},_calculateTabCount:function(){for(var i=this.XLObj,u=[],t=0,r=i.getSheet(i.getActiveSheetIndex()).columnsWidthCollection,n=0,f=r.length;n<f;n++)t+=r[n],t>=this._pageWidth&&(u.push({tCount:1,cellCount:n}),t=0)},_calculateCellRowCount:function(n,t,i){for(var o=this.XLObj,b=o.getActiveSheetIndex(),s=o.getSheet(b),h=s.columnsWidthCollection,c=s.rowsHeightCollection,f,l=0,a=0,v=12,y=40,p=0,w=0,u,r=t,e=h.length;r<e;r++)if(l+=h[r],l>=this._pageWidth){w=v=r;break}else f=Math.floor((this._pageWidth-l)/s.columnWidth),w=v=h.length+f;for(u=i,e=c.length;u<e;u++)if(a+=c[u],a>=this._pageHeight){p=y=u;break}else f=Math.floor((this._pageHeight-a)/o.model.rowHeight),p=y=c.length+f;return{startCell:t,endCell:w,startRow:i,endRow:p,cellCount:v,rowCount:y}},_constructSheet:function(n,i,r,u){var o=t.buildTag("div .e-spreadsheet","",{}),c=t.buildTag("div .e-spreadsheetmainpanel","",{}),e=0,f=this._calculateCellRowCount(u,0,0),s=u[0].cells.length,h=u.length;e=Math.ceil(s/f.cellCount);e=e*Math.ceil(h/f.rowCount);e==1&&(f.rowCount=u.length);o.append(c);this._constructPrintableElement(i,n,o.find(".e-spreadsheetmainpanel"),r,u,h,s,e,f.cellCount,f.rowCount,f.startRow,f.startCell,f.endRow,f.endCell)},_constructPrintableElement:function(i,r,u,f,e,o,s,h,c,l,a,v,y,p){for(var ft,ct,d,lt,et=!1,ut,k=this.XLObj,g=k.getSheet(i),at=t.buildTag("div"),nt,kt,ot=!1,st,ht=!0,vt=!1,yt=!1,pt=0,tt,w,it,rt,wt,b,gt=k._getContent(i).find("col"),ni=g.columnsWidthCollection,dt=g.rowsHeightCollection,bt=h;bt>0;bt--){for(nt=this._calculateCellRowCount(e,v,a),v=nt.startCell,p=nt.endCell,a=nt.startRow,y=nt.endRow,c=nt.cellCount,l=nt.rowCount,ut=this._constructTable(i,v,p),g.showHeadings&&this._constructHeaders(v,p,y,ut),kt=this._isPrintSelection?a<this._stRow?this._stRow:a:a,w=a;w<y;w++){for(t.isNullOrUndefined(f[0].rows[w])?(ht=!1,d=t.buildTag("tr","",{height:k.model.rowHeight})):(st=dt[w],ht=!0,d=st>0?t.buildTag("tr","",{height:st}):t.buildTag("tr","",{height:k.model.rowHeight})),ht&&(vt=k.XLEdit.getPropertyValue(w,0,"isRHide"),t.isNullOrUndefined(vt)||k.addClass(d[0],"e-r-hide")),it=v;it<p;it++)g.showHeadings&&!et&&(lt='<td class="{0}">{1}<\/td>',n(String.format(lt,"e-rowcell e-header",w+1)).appendTo(d),et=!0),n(e[w]).length>0&&n(e[w].cells[it]).length>0?(rt=n(e[w].cells[it].outerHTML).attr("id","ss"),rt.appendTo(d)):(rt=t.buildTag("td.e-rowcell"),rt.appendTo(d)),yt=k.XLEdit.getPropertyValue(0,it,"isCHide"),t.isNullOrUndefined(yt)||k.addClass(rt[0],"e-col-hide");et=!1;ut.append(d)}if(r.append(ut),y<o)a=y,y=y+l;else if(y>=o){if(p>=s)break;a=0;y=l;v=p;p=p+c}}for(w=r.find("table").length-1;w>=0;--w)tt=n(r.find("table")[w]),ot||this._checkEmptyRow(i,tt,"first"),pt=g.showHeadings?tt.find("tr.empty").length+1:tt.find("tr.empty").length,(tt.find("tr").length!==pt||ot)&&(n(tt.get(0).outerHTML).attr("id","cc").appendTo(at),ot=!0);for(b=at.find("table"),w=b.length-1;w>=0;--w)b.length-1!==w?(k.model.pageSize===t.Spreadsheet.pageSize.A4&&b.eq(w).css({"margin-top":300,"margin-bottom":300}),k.model.pageSize===t.Spreadsheet.pageSize.A3&&b.eq(w).css({"margin-top":120,"margin-bottom":110}),k.model.pageSize===t.Spreadsheet.pageSize.Letter&&(g.showHeadings?b.eq(w).css({"margin-top":70,"margin-bottom":50}):b.eq(w).css({"margin-top":0,"margin-bottom":50}))):b.length-1===w&&b.eq(w).css({"margin-top":30,"margin-bottom":g.showHeadings?20:0}),w||(b.length>1&&b.eq(w).css({"margin-top":120,"margin-bottom":0}),this._checkEmptyRow(i,b.eq(w),"last")),n(b[w].outerHTML).attr("id","cc").appendTo(u);for(ft=n("head").find("link"),ct=[],w=0,wt=ft.length;w<wt;w++)if(ft[w].href.indexOf("ej.pivotintegration.css")>-1){ct.push(ft[w]);break}u=u.parent();k._trigger("_pivotPrint",{element:u});this._isPrintSelection=!1;this.print(u,ct,i)},_checkEmptyRow:function(t,i,r){for(var o,e,f=i.find("tr"),s,h,c,u=f.length-1;u>=0;--u)if(o=n(f[u]).find(".e-rowcell").length,e=n(f[u]).find(".e-rowcell:empty").length,e=this.XLObj.getSheet(t).showHeadings?e+1:e,s=n(f[u]).find('td[class *= "e-format"]').length,h=n(f[u]).find('td[class *= "e-border"]').length,c=n(f[u]).find('td[class *= "e-mc-hide"]').length,e===o&&s<1&&h<1&&c<1)n(f[u]).addClass("empty");else{n(f[u]).addClass("nonempty");break}r==="last"&&(i.find("tr.empty").find("td").removeClass("e-rowcell"),i.find("tr.empty").find("td.e-header").text(""))},_constructTable:function(i,r,u){var e=t.buildTag("colgroup"),s=this.XLObj,l=t.buildTag("div","",{height:this._printHeight,"margin-top":this._marginTop,"margin-bottom":this._marginBottom}),h=t.buildTag("table.e-table","",{height:this._printHeight,"margin-top":this._marginTop,"margin-bottom":this._marginBottom}),c=s._getContent(s.getActiveSheetIndex()).find("col"),o,f;for(s.getSheet(i).showHeadings&&(o='<col class="{0}" style= "width: 30px;" >{1}<\/col>',n(o).appendTo(e)),f=r;f<u;f++)n(c[f]).length>0?n(c[f].outerHTML).attr("id","cc").appendTo(e):(o='<col style= "width: 64px;" ><\/col>',n(o).appendTo(e));return h.append(e),l.append(h),h},_constructHeaders:function(i,r,u,f){var o=this.XLObj,w=o.getActiveSheetIndex(),h=t.buildTag("tr","",{height:30}),c,l,s,a,v,y=!1,b=o._getContent(w).find("col"),p="e-rowcell",e;for(this._isPrintSelection&&i<this._stCol&&(r=r+(this._stCol-i),i=this._stCol),c='<td class="{0}">{1}<\/td>',l='<div class = "{0}" > {1}<\/div>',e=i;e<=r;e++)y?(s=o._generateHeaderText(e),p=t.isNullOrUndefined(o.XLEdit.getPropertyValue(0,e-1,"isCHide"))?"e-rowcell e-headercell":"e-rowcell e-col-hide"):(s="",y=!0),a=String.format(l,"e-headercelldiv",s),v=String.format(c,p,a),n(h[0]).append(v);f.append(h)},print:function(i,r,u){var o=this.XLObj,f,e,c,s,h,l;o.model.printSettings.allowPrinting&&!o.model.isReadOnly&&((f=window.open("","print","'height=452,width=1024,tabbar=no"),o.isUndefined(f))||(h=t.buildTag("div"),l=i.clone(),h.append(l),f.document.write("<!DOCTYPE html>"),o._browserDetails.name==="msie"?(s="",r.length>0&&n(r).each(function(t,i){n(i).attr("href",i.href);s+=i.outerHTML}),f.document.write("<html><head><\/head><body>"+s+h[0].innerHTML+"<\/body><\/html>")):(s="",f.document.write("<html><head>"),r.length>0&&n(r).each(function(t,i){n(i).attr("href",i.href);s+=i.outerHTML}),f.document.writeln(s+"<\/head><body>"),f.document.writeln(h[0].innerHTML+"<\/body><\/html>")),n(f.document.head).append("<style><\/style>"),e=o.model.sheets[u].showGridlines?".e-spreadsheet .e-table{table-layout: fixed; width: 100%;}.e-spreadsheet .e-rowcell {border: 1px solid #000000;line-height: 14px;overflow: hidden;white-space: pre;vertical-align: bottom;}.e-spreadsheet .e-table{border-collapse: collapse}":".e-spreadsheet .e-table{table-layout: fixed; width: 100%;}.e-spreadsheet .e-rowcell {line-height: 14px;overflow: hidden;white-space: pre;vertical-align: bottom;}.e-spreadsheet .e-table{border-collapse: collapse}",e=e.concat(n(document).find("style#"+this.XLObj._id+"_sscustomformat").text()),c=n(f.document.head).find("style"),e=e.concat(".e-spreadsheet .e-fr-hide { display: none !important;}.e-spreadsheet .e-fc-hide { display: none !important;}.e-spreadsheet .e-sswraptext {word-break: break-all; white-space: normal;}.e-spreadsheet .e-headercell{text-align:center;}.e-spreadsheet .e-ralign{text-align:right;}.e-spreadsheet .e-calign{text-align:center;}"),e=e.concat(".e-spreadsheet .e-hyperlinks { text-decoration: underline;}"),c.append(e),f.focus(),n("#print").remove(),setTimeout(function(){(o._browserDetails.name==="msie"?!o.getObjectLength(f)||t.isNullOrUndefined(f.window)||t.isNullOrUndefined(f.location):t.isNullOrUndefined(f.window)||t.isNullOrUndefined(f.location))||(f.print(),f.location.reload());setTimeout(function(){f.close()},2e3)},2e3)))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.scroller=function(n){this.XLObj=n;this._isIntrnlScroll=!1};t.spreadsheetFeatures.scroller.prototype={_getColWidths:function(n,t){var i,s=this.XLObj,r=s.getSheet(n),u=r.columnsWidthCollection,f=r._colWidthCollection,e,o=r._ofColWidthColl;for(t||(t=1),i=t,len=u.length;i<len;i++)f[i]=f[i-1]+u[i-1],e=u[i-1]===0?r.hideColsCollection[i-1]:u[i-1],o[i]=o[i-1]+e},_getRowHeights:function(n,t,i){var r,e=this.XLObj,o=e.getSheet(n),f=o.rowsHeightCollection,u=o._rowHeightCollection,s=o.hideRowsCollection;for(t||(t=1),r=t,len=f.length;r<len;r++)u[r]=u[r-1]+(s.indexOf(r-1)>-1?0:f[r-1]);u[u.length-1]=u[u.length-2]+(s.indexOf(f.length-1)===-1?f[f.length-1]:0);!i&&e.model.scrollSettings.allowScrolling&&(e.model.scrollSettings.allowVirtualScrolling&&e._refreshVrtlBlocks(n),this._refreshScroller(n,"refresh","vertical"))},_createScroller:function(i,r,u){var f=this.XLObj,e=!0,l=f._getContent(i),h=t.buildTag("div#vscrollBar"),o=t.buildTag("div#hscrollBar"),s=f.getSheet(i),c=f.model.scrollSettings.isResponsive?r.width-2:r.width;s._contWidth=c-18;f.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal&&(s._contWidth>f._getEntireColWidth(i)&&(e=!1),o[0].style.display=e?"block":"none");l.append(h).append(o);f._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").width(s._contWidth).height(r.height-(e?18:0));h.ejScrollBar({orientation:"vertical",height:r.height-(e?18:0),minimum:0,viewportsize:r.height,infiniteScrolling:!0,scroll:n.proxy(this._scrollSpreadY,this)});o.ejScrollBar({orientation:"horizontal",width:c-17,minimum:0,infiniteScrolling:!0,viewportsize:r.width,scroll:n.proxy(this._scrollSpreadX,this)});u!="initial"&&this._refreshScroller(i,"initial","all")},_hScroller:function(n){return this.XLObj._getContent(this.XLObj._getSheetIndex(n)).find("#hscrollBar").data("ejScrollBar")},_vScroller:function(n){return this.XLObj._getContent(this.XLObj._getSheetIndex(n)).find("#vscrollBar").data("ejScrollBar")},_refreshScroller:function(n,i,r){var c,s,l,h,b,k,a=0,e=this.XLObj,n=e._getSheetIndex(n),o=e.getSheet(n),f=this._hScroller(n),y=o.columnWidth,p=o.rowHeight,u=this._vScroller(n),w=e.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal,d=e._getContent(n),g=d.find(".e-content")[0],v;if(w&&f&&u&&d.find("table").length&&(this._refreshContHgt(n),r=r==="horizontal"?"all":r),f&&(r==="all"||r==="horizontal")){if(c=g.offsetWidth,s=e._getWidth(0,o.colCount-1,n)-o._frozenWidth,s<c+2*y&&!w)for(b=Math.floor((c+y*5-s)/y),v=0;v<b;v++)this._createNewColumn(n,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"insert"),s=s+y;f._scrollData.handleSpace=c-2*f.model.buttonSize;a=e._isFrozen(e.getFrozenColumns())?e._getColOffsetLeft(o,e.getFrozenColumns())-o._contScrollLeft:0;f._scrollData.handle=Math.floor((c-a)/s*f._scrollData.handleSpace);f._scrollData.handle<15&&(f._scrollData.handle=15);f._scrollData.scrollable=f.model.maximum=s-(c-a);f._scrollData.onePx=f._scrollData.scrollable/(f._scrollData.handleSpace-f._scrollData.handle)||1;f["e-hhandle"].width(f._scrollData.handle);f.model.scrollLeft=f._scrollData.handleSpace-f._scrollData.handle}if(u&&(r==="all"||r==="vertical")){if(l=g.offsetHeight,h=e._getMaxHgt(n,!0,!0)-o._frozenHeight,!w&&h<l+2*p)for(k=Math.floor((l+p*5-h)/p),v=0;v<k;v++)this._createNewRow(n,-1,-1,"insert"),h=h+p;u._scrollData.handleSpace=l-2*u.model.buttonSize;a=e._isFrozen(e.getFrozenRows())?e._getRowOffsetTop(o,e.getFrozenRows())-o._contScrollTop:0;u._scrollData.handle=Math.floor((l-a)/h*u._scrollData.handleSpace);u._scrollData.handle<15&&(u._scrollData.handle=15);u._scrollData.handle>u._scrollData.handleSpace&&e.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal&&(u._scrollData.handle=u._scrollData.handleSpace);u._scrollData.scrollable=u.model.maximum=h-(l-a);u._scrollData.onePx=u._scrollData.scrollable/(u._scrollData.handleSpace-u._scrollData.handle);u["e-vhandle"].height(u._scrollData.handle);u.model.scrollTop=u._scrollData.handleSpace-u._scrollData.handle}},_refreshContHgt:function(n){var t,i,e,l,o="px",a="none",v="block",y="width",f="height",r=this.XLObj,p=r.getSheet(n),u=r._getEntireColWidth(n),s=r._getContent(n),h=s.find(".e-content"),c=s.find("#hscrollBar")[0].style;t=h[0].offsetHeight;i=c.display===a&&p._contWidth<u;(i||c.display===v&&p._contWidth>u)&&(c.display=i?v:a,t=i?t-18:t+19,i=!0);i&&(l=t-2*this._vScroller(n).model.buttonSize+o,t+=o,e=s.find("#vscrollBar"),h[0].style[f]=t,r._getJSSheetRowHeaderContent(n)[0].style[f]=t,e[0].style[f]=t,e.find(".e-vhandlespace")[0].style[f]=l);u+=o;h.find("table")[0].style[y]=u;r._getJSSheetHeader(n).find("table")[0].style[y]=u},_changeTopSpread:function(n,t,i,r){var f=n.value(),u=f+i;t.step=i;(t.enableRTL?u<t.scrollable:u>t.scrollable)&&(u=t.scrollable);(t.enableRTL?u>0:u<0)&&(u=0);n.scroll(u,r)},_spreadMouseWheel:function(i){var r=this.XLObj,e,f=this._vScroller(r.getActiveSheetIndex()),u,o;t.isNullOrUndefined(f)||(r._filterClose(i.target),i.stopImmediatePropagation(),i.preventDefault(),r.element.find(".e-excelfilter.e-dlgcontainer").is(":visible")||r._isSubMenuOpen()||r._isSheetRename)||(r.model.allowComments&&r.XLComment._isCommentEdit&&(e=r.getActiveCell(),t.isNullOrUndefined(e)||r.XLComment._updateCurCmntVal({rowIndex:e.rowIndex,colIndex:e.colIndex})),r.model.allowDataValidation&&n("#"+r._id+"ddl").ejDropDownList("hidePopup"),u=0,o=i,i=i.originalEvent,i.wheelDelta?(u=-i.wheelDelta/120,window.opera&&parseFloat(window.opera.version,10)<10&&(u=-u)):i.detail&&(u=i.detail/3),u)&&(this._changeTopSpread(f,f._scrollData,u*f._scrollData.scrollOneStepBy,"wheel")&&(i.preventDefault?i.preventDefault():o.preventDefault()),n.data(this,"timer",setTimeout(function(){r._trigger("scrollStop",{originalEvent:i,scrollData:f._scrollData,reqType:"vertical",position:f.model.value})},250)))},_scrollSpreadX:function(n){var t=this.XLObj;t.getSheet()._isFreezed&&t._isFrozen(t.getFrozenColumns())?(t.XLFreeze._frozenScrollHandler(n),this._getFirstColumn(t.getActiveSheetIndex())):this._spreadHS(n)},_scrollDirection:function(n,t){var i=this.XLObj,n=i._getContent(i.getActiveSheetIndex()).find("#"+n).ejScrollBar("instance");n.value()<t?n._scrollData.step=1:n.value()>t&&(n._scrollData.step=-1);n.scroll(t)},_spreadHS:function(n){var e,i=this.XLObj,u=i.getActiveSheetIndex(),r=i.getSheet(u),f=this._hScroller(u),o=i._getContent(u),s=o.find(".e-content"),c=o.find("col"),r=i.getSheet(u),h=(n.scrollLeft-r._scrollLeft)/r.columnWidth;if(n.reachedEnd=Math.ceil(parseFloat(f.element.find(".e-hhandle").css("left")))+Math.ceil(parseFloat(f.element.find(".e-hhandle").width()))>=i.element.find(".e-hhandlespace").width()-2,e=n.scrollLeft,i.model.enableContextMenu&&i.XLCMenu.hideCMenu(),i.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&n.scrollData.step>-1&&!i._scrollReverse)if(n.reachedEnd&&r._leftCol.idx+h<=r.colCount)n.cancel=!0,this._scrollRight(u),e=(f._scrollData.handleSpace-f._scrollData.handle)*f._scrollData.onePx,this._refreshScroller(u,"refresh","horizontal"),f.element.find(".e-hhandle").css("left",f._scrollData.handleSpace-(f._scrollData.handle+1)),f.value(e);else if(r._leftCol.idx+h>r.colCount&&n.scrollLeft>=r._scrollLeft&&n.scrollLeft>0&&r.colCount<i._maxColCnt){while(n.scrollLeft>r._colWidthCollection[r._colWidthCollection.length-1])this._scrollRight(u);this._refreshScroller(u,"refresh","horizontal")}r._scrollLeft=n.scrollLeft=e;i._scrollReverse=!1;s.scrollLeft(n.scrollLeft);r._scrollLeft=s.scrollLeft();f.value(n.scrollLeft);this._getFirstColumn(u);i._refreshViewVar(null,n.scrollLeft,u)},_scrollSpreadY:function(n){var u,f,h,c,e,s=0,i=this.XLObj,r=i.getActiveSheetIndex(),o=i.getSheet(r);o._isFreezed&&i._isFrozen(i.getFrozenRows())?(i.XLFreeze._frozenScrollHandler(n),this._getFirstRow(i.getActiveSheetIndex())):(c=i.getDigits(o._bottomRow.idx),this.XLObj.model.scrollSettings.allowVirtualScrolling?this._scrollHandler(n):this._spreadVS(n),this.XLObj.model.allowComments&&this.XLObj.XLComment._isCommentEdit&&(e=this.XLObj.getActiveCell(),t.isNullOrUndefined(e)||this.XLObj.XLComment._updateCurCmntVal({rowIndex:e.rowIndex,colIndex:e.colIndex})),u=i.getDigits(o._bottomRow.idx),h=u-c,h&&(u>3&&(s=(u-3)*10),f=i._rowHeaderWidth+s,i._getJSSheetRowHeaderContent(r).find("col").width(f),i._getJSSheetRowHeader(r).width(f),i._getJSSheetHeader(r).find(".e-spreadsheetcolumnheader").width(f-1),i._getJSSheetContent(r).find(".e-spreadsheetcontentcontainer > .e-content").width(o._contWidth-s)))},_scrollHandler:function(n){var y,c,s,h,p,f,l,k,w,b,d,a,e=hgt=height=0,o=isRefreshed=!1,r=this.XLObj,u=r.getActiveSheetIndex(),i=r.getSheet(u),tt=r.getActiveCell(u),g=n.scrollTop>=i._scrollTop,it=this._vScroller(u),nt=(n.scrollTop-i._scrollTop)/i.rowHeight+1,v=r._getContent(u).find(".e-content");if(n.scrollTop===i._scrollTop||i._bottomRow.idx+nt>i.rowCount){if(g&&n.scrollTop>0&&r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&i.rowCount<r._maxRowCnt){s=i.rowCount;do{i._virtualBlockCnt++;i.rowCount+=i._virtualBlockRowCnt;for(y in i._columnStyles)for(c=i._virtualBlockRowCnt;c<i.rowCount;)r.XLEdit._updateDataContainer({rowIndex:c,colIndex:parseInt(y)},{dataObj:i._columnStyles[y]}),c++;while(e<i._virtualBlockRowCnt)i.rowsHeightCollection.push(i.rowHeight),i.hideRowsCollection.indexOf(s)===-1&&i._hiddenFreezeRows.indexOf(s)===-1?(i._rowIdxColl.push(s),hgt=i._rowHeightCollection[i._rowHeightCollection.length-1]+i.rowHeight,i._virtualTBodyHgt+=i.rowHeight):hgt=i._rowHeightCollection[i._rowHeightCollection.length-1],i._rowHeightCollection.push(hgt),s++,e++;e=0}while(n.scrollTop+i._virtualBlockRowCnt*i.rowHeight>i._rowHeightCollection[i._rowHeightCollection.length-1]);this._refreshScroller(u,"refresh","vertical");i._scrollTop=n.scrollTop;r._refreshViewport(n.scrollTop,u);v.scrollTop(n.scrollTop);i._scrollTop=v.scrollTop();o=!0}}else prop=["value","value2","comment","hyperlink","format","border","type","isFilterHide","filterState","isMHide","isFHide","merge","isFilterHeader","isFilterVisible","text","general","cFormatRule","wrap","wrapRow","rule","align","isOverflow","isOfBrdr","altTxt"],p=r._getRowHdrTBody(u),h=r._getContTBody(u),g?(n.scrollTop>=i._virtualContTBodyOffset.bottom&&n.scrollTop<=i._virtualBottomTBodyOffset.bottom?(height=i._virtualTopTBodyOffset.bottom-i._virtualTopTBodyOffset.top,i._virtualTopTBodyOffset.top=i._virtualContTBodyOffset.top,i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.bottom,i._virtualContTBodyOffset.top=i._virtualBottomTBodyOffset.top,i._virtualContTBodyOffset.bottom=i._virtualBottomTBodyOffset.bottom,i._virtualContBlockIdx++,i._virtualContBlockIdx===i._virtualBlockCnt?(i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom=0,i._isVirtualEndReached=!0):(i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom,k=r._getRowIdx(i._virtualContBlockIdx*i._virtualBlockRowCnt,u,!0),w=r._getRowIdx(i._virtualContBlockIdx*i._virtualBlockRowCnt+(i._virtualBlockRowCnt-1),u,!0),i._virtualBottomTBodyOffset.bottom=r._getRowOffsetBottom(w,u),a=i._rowIdxColl.slice(i._rowIdxColl.indexOf(k),i._rowIdxColl.indexOf(w)+1),f=r.getRangeData({property:prop,sheetIdx:u,rowIdxs:a,withRowIdx:!0}),p.append(r._renderRowHdr(f.rowIdx,u)),h.append(r._renderData(f,u)),i._virtualRowIdx=i._virtualRowIdx.concat(f.rowIdx),o=!0),i._isVirtualTopReached||(r._removeRange(0,i._virtualBlockRowCnt),i._virtualRowIdx.splice(0,i._virtualBlockRowCnt),i._virtualTopTBodyHgt+=height),i._virtualBottomTBodyHgt=i._virtualTBodyHgt-(i._virtualTopTBodyHgt+Math.floor(parseFloat(window.getComputedStyle(h[0],null).height))),r._refreshTBodiesHgt(),i._isVirtualTopReached=!1):!i._isVirtualEndReached&&n.scrollTop>=i._virtualBottomTBodyOffset.bottom&&(r._refreshViewport(n.scrollTop,u),o=isRefreshed=!0),r.model.allowCellType&&r.XLCellType._rangeCellTypes(i.cellTypes,u)):n.scrollTop+n.model.viewportsize<i._virtualContTBodyOffset.top&&n.scrollTop+n.model.viewportsize>=i._virtualTopTBodyOffset.top?(height=i._virtualBottomTBodyOffset.bottom-i._virtualBottomTBodyOffset.top,i._virtualBottomTBodyOffset.top=i._virtualContTBodyOffset.top,i._virtualBottomTBodyOffset.bottom=i._virtualContTBodyOffset.bottom,i._virtualContTBodyOffset.top=i._virtualTopTBodyOffset.top,i._virtualContTBodyOffset.bottom=i._virtualTopTBodyOffset.bottom,i._virtualContBlockIdx--,i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.top,i._virtualContBlockIdx===1?(i._virtualTopTBodyOffset.top=0,i._isVirtualTopReached=!0):(b=r._getRowIdx((i._virtualContBlockIdx-2)*i._virtualBlockRowCnt,u,!0),d=r._getRowIdx((i._virtualContBlockIdx-2)*i._virtualBlockRowCnt+(i._virtualBlockRowCnt-1),u,!0),i._virtualTopTBodyOffset.top=r._getRowOffsetTop(i,b),a=i._rowIdxColl.slice(i._rowIdxColl.indexOf(b),i._rowIdxColl.indexOf(d)+1),f=r.getRangeData({property:prop,sheetIdx:u,rowIdxs:a,withRowIdx:!0}),p.prepend(r._renderRowHdr(f.rowIdx,u)),h.prepend(r._renderData(f,u)),i._virtualRowIdx=f.rowIdx.concat(i._virtualRowIdx),o=!0),i._isVirtualEndReached||(r._removeRange(i._virtualContBlockIdx===1?2*i._virtualBlockRowCnt:3*i._virtualBlockRowCnt,i._virtualBlockRowCnt),i._virtualRowIdx.splice(i._virtualContBlockIdx===1?2*i._virtualBlockRowCnt:3*i._virtualBlockRowCnt,i._virtualBlockRowCnt),i._virtualBottomTBodyHgt+=height),i._virtualTopTBodyHgt=i._virtualTBodyHgt-(i._virtualBottomTBodyHgt+Math.floor(parseFloat(window.getComputedStyle(h[0],null).height))),r._refreshTBodiesHgt(),i._isVirtualEndReached=!1,r.model.allowCellType&&r.XLCellType._rangeCellTypes(i.cellTypes,u)):!i._isVirtualTopReached&&n.scrollTop+n.model.viewportsize<=i._virtualTopTBodyOffset.top&&(r._refreshViewport(n.scrollTop,u),o=isRefreshed=!0),isRefreshed||r._refreshViewVar(n.scrollTop,null,u),i._scrollTop=n.scrollTop;if(v.scrollTop(n.scrollTop),i._scrollTop=v.scrollTop(),this._getFirstRow(u),r.model.allowSelection&&(i._isRowSelected||i._isColSelected||i._isSheetSelected)&&(r.XLSelection.refreshSelection(),r.XLDragFill.positionAutoFillElement()),o){for(r.XLComment&&r.XLComment._updateCmntArrowPos(r._getContent(u).find(".e-commentcell")),l=r.getObjectKeys(r._dataContainer.sheets[u][0]),r._dupDetails=!0,e=0,len=l.length;e<len;e++)fitWidth=r.XLEdit.getPropertyValue(0,l[e],"isFitWidth"),t.isNullOrUndefined(fitWidth)||r.XLResize._fitWidth(l[e]);r._dupDetails=!1}},_spreadVS:function(n){var e,r=this.XLObj,f=r.getActiveSheetIndex(),u=r.getSheet(f),i=this._vScroller(f),h=r._getJSSheetContent(f).find(".e-spreadsheetcontentcontainer > .e-content"),c=(n.scrollTop-u._scrollTop)/u.rowHeight;if(n.reachedEnd=Math.ceil(parseFloat(i.element.find(".e-vhandle").css("top")))+Math.ceil(parseFloat(i.element.find(".e-vhandle").height()))>=i.element.find(".e-vhandlespace").height()-2,e=n.scrollTop,r.model.enableContextMenu&&r.XLCMenu.hideCMenu(),r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&n.scrollData.step>-1&&!r._scrollReverse)if(n.reachedEnd&&u._bottomRow.idx+c<=u.rowCount){var l=!1,a=!1,s=this,o;!r.isUndefined(n.scrollData.target)&&r._hasClass(n.scrollData.target,"e-vdown")&&(o=setInterval(function(){l=!0;for(var n=0;n<20;n++)s._scrollBottom(f);e=(i._scrollData.handleSpace-i._scrollData.handle)*i._scrollData.onePx;s._refreshScroller(f,"refresh","vertical");i.element.find(".e-vhandle").css("top",i._scrollData.handleSpace-i._scrollData.handle);i.scroll(e);clearInterval(o);return},1e3),r._browserDetails.name==="msie"&&r._browserDetails.version==="8.0"?(i.element.find(".e-vdown")[0].attachEvent("onmouseup",function(){clearInterval(o);return}),document.attachEvent("onmouseup",function(){clearInterval(o);return})):(i.element.find(".e-vdown")[0].addEventListener("mouseup",function(){clearInterval(o);return}),document.addEventListener("mouseup",function(){clearInterval(o);return})),a=!0);n.cancel=!0;l&&a||(this._scrollBottom(f,(n.scrollTop-u._scrollTop)/20+1),e=(i._scrollData.handleSpace-i._scrollData.handle)*i._scrollData.onePx,s._refreshScroller(f,"refresh","vertical"),i.element.find(".e-vhandle").css("top",i._scrollData.handleSpace-i._scrollData.handle),i.value(e))}else u._bottomRow.idx+c>u.rowCount-1&&n.scrollTop>=u._scrollTop&&n.scrollTop>0&&u.rowCount<r._maxRowCnt&&(this._scrollBottom(f,(n.scrollTop-u._scrollTop)/20+1),this._refreshScroller(f,"refresh","vertical"));n.scrollTop=u._scrollTop=e;r._scrollReverse=!1;h.scrollTop(n.scrollTop);u._scrollTop=h.scrollTop();this._getFirstRow(f)},_scrollX:function(i){var e,u=this.XLObj,r=this._hScroller(i),o,s=[1],h=u._getContent(i).find("colgroup"),f=u.getSheet(i);for(u.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&this._scrollRight(i),r.model.maximum=r.model.maximum+f.columnWidth,r._scrollData.scrollable=r._scrollData.scrollable+f.columnWidth,this._refreshScroller(i,"refresh","horizontal"),r.element.find(".e-hhandle").css("left",r._scrollData.handleSpace-(r._scrollData.handle+1)),o=(r._scrollData.handleSpace-r._scrollData.handle)*r._scrollData.onePx,r.value(o),e=0,len=u.model.sheets[i]._fCol;e<len;e++)s.push(s[s.length-1]+n(h.find("col")[e]).width());f._isFreezed&&u._isFrozen(u.getFrozenColumns())?r.scroll(r.value()+u._getColWidth(f._fleftColIdx,i),!0):u._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").scrollLeft(o,r._scrollData.onePx);f._scrollLeft=o;this._getFirstColumn(i)},_scrollY:function(i){var f,u=this.XLObj,r=this._vScroller(i),e,o=[1],s=u.getRows(i)[1];for(u.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&this._scrollBottom(i),r.model.maximum=r.model.maximum+u.model.rowHeight,r._scrollData.scrollable=r._scrollData.scrollable+u.model.rowHeight,this._refreshScroller(i,"refresh","vertical"),r.element.find(".e-vhandle").css("top",r._scrollData.handleSpace-(r._scrollData.handle+1)),e=(r._scrollData.handleSpace-r._scrollData.handle)*r._scrollData.onePx,r.value(e),f=0,len=u.model.sheets[i]._fRow;f<len;f++)o.push(o[o.length-1]+n(s[f]).height());u._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").scrollTop(e,r._scrollData.onePx);this._getFirstRow(i)},_getFirstRow:function(n){var i=this.XLObj,t=i.getSheet(n),r,u,f,e=t._rowHeightCollection;r=i._getContent(n).find(".e-content").scrollTop();u=i._getIdxWithOffset(r,null,!0,null,n).rowIdx;t._topRow={idx:u,value:e[u]};f=i._getIdxWithOffset(r+t._vPortHgt,null,!0,null,n).rowIdx||t.rowCount-1;t._bottomRow={idx:f,value:e[f]};t.topLeftCell=i.getAlphaRange(t._topRow.idx,t._leftCol.idx)},_getFirstColumn:function(n){var i=this.XLObj,t=i.getSheet(n),r,u,f,e=t._colWidthCollection;r=i._getContent(n).find(".e-content").scrollLeft();u=i._getIdxWithOffset(null,r,!0,null,n).colIdx;t._leftCol={idx:u,value:e[u]};f=i._getIdxWithOffset(null,r+t._vPortWth,!0,null,n).colIdx||t.colCount-1;t._rightCol={idx:f,value:e[f]};t.topLeftCell=i.getAlphaRange(t._topRow.idx,t._leftCol.idx)},scrollToCell:function(n){var u,f,o=0,s=0,i=this.XLObj,r=i.getRangeIndices(n),e=i.getActiveSheetIndex(),t=i.getSheet(e);u=r[0]>t.rowCount?i._getRowOffsetBottom(t.rowCount-1,e)+(r[0]-t.rowCount)*t.rowHeight:i._getRowOffsetBottom(r[0]-1,e);f=r[1]>t.colCount?i._getWidth(0,t.colCount-1)+(r[1]-t.colCount)*t.columnWidth:i._getWidth(0,r[1]-1);i._isFrozen(t.frozenRows)&&(o=i._getRowOffsetTop(t,t._frozenRows-1));i._isFrozen(t.frozenColumns)&&(s=i._getColOffsetLeft(t,t._frozenColumns-1));i._scrollContent({x:(f?f:0)-t._scrollLeft-s,y:(u?u:0)-t._scrollTop-o})},_scrollSelectedPosition:function(n,t){if(!this.XLObj._isExport){var s,h,c=0,u=this.XLObj,r=this._hScroller(n),f=this._vScroller(n),i=u._getCellInfo(t),o=u.getSheet(n),e=u._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content"),l=u._dupDetails,a=Math.ceil(parseFloat(f.element.find(".e-vhandle").css("top")))+f._scrollData.handle>=f._scrollData.handleSpace,v=Math.ceil(parseFloat(r.element.find(".e-hhandle").css("left")))+r._scrollData.handle>=r._scrollData.handleSpace;u.isUndefined(r)||parseInt(i.width)+(i.left-e.offset().left)>e.width()&&(s=i.left-(r._scrollData.handleSpace+r.model.buttonSize),s<0?r.scroll(0):(v&&(u._scrollReverse=!0),(parseInt(i.width)+i.left>r._scrollData.handleSpace+r.model.buttonSize*2||i.left-e.offset().left<=0)&&s!=0&&r.scroll(i.left+i.width+1-(r._scrollData.handleSpace+r.model.buttonSize*2)),u._scrollReverse=!1));u.isUndefined(f)||(parseInt(i.height)+(i.top-e.offset().top)>e.height()||i.top-e.offset().top<=0)&&(t.rowIndex<o._topRow.idx||t.rowIndex>o._bottomRow.idx)&&(!t.rowIndex<o._bottomRow.idx&&t.rowIndex<o.rowCount-1&&(c=i.height),h=i.top+c-(f._scrollData.handleSpace+f.model.buttonSize),h<0?f.scroll(0):(a&&(u._scrollReverse=!0),f.scroll(i.top+i.height+1-(f._scrollData.handleSpace+f.model.buttonSize*2)),u._scrollReverse=!1));u._dupDetails=l}},_rowTemplate:function(n,t){for(var i,e="",u=this.XLObj,o=u.getSheet(n),r=0,f=u.model.sheets[n].colCount;r<f;r++)i="e-rowcell",o.showGridlines||(i=i.concat(" e-hborder")),o._hiddenFreezeCols.indexOf(r)>-1&&(i+=" e-fcol-hide"),e+=String.format('<td class="{0}" style="{2}" >{1}<\/td>',i,"");return String.format("<tr style='{0}' idx=\"{1}\">"+e+"<\/tr>","height:"+u.model.rowHeight+"px;",t-1)},_rowHeaderTemplate:function(n,t){var i,t=t?t:this.XLObj.model.rowHeight;return i=String.format('<td class="{0}" >{1}<\/td>',"e-rowheader",n),String.format("<tr style='{0}' idx=\"{1}\">"+i+"<\/tr>","height:"+t+"px;",n-1)},_columnTemplate:function(){var n="e-rowcell e-wrapword",t=this.XLObj,i=t.getActiveSheetIndex();return t.getSheet(i).showGridlines||(n=n.concat(" e-hborder")),String.format('<td class="{0}" style="{2}" >{1}<\/td>',n,"")},_colGroupTemplate:function(n,t){var t=t?t:this.XLObj.getSheet(n).columnWidth;return String.format("<col style = '{0}'><\/col>","width:"+t+"px;")},_columnHeaderTemplate:function(n){var t,i;return t=this.XLObj._generateHeaderText(n),i=String.format('<div class = "{0}" > {1}<\/div>',"e-headercelldiv",t),String.format('<th class="{0}" >{1}<\/th>',"e-headercell",i)},_createNewRow:function(t,i,r,u){var s,h,l,e,a,f=this.XLObj,y=f.model.scrollSettings.allowVirtualScrolling,p=f.XLSelection,o=f.getSheet(t),w,c,v;if(y?(s=f._getContent(t).find("tbody")[1],e=f._getJSSheetRowHeaderContent(t).find("tbody")[1]):(s=f._getContent(t).find("tbody")[0],e=f._getJSSheetRowHeaderContent(t).find("tbody")[0]),l=this._rowTemplate(t,parseInt(e.lastChild.textContent)+1),i===-1||r>-1&&i>-1&&u==="shift"?(n(e).append(this._rowHeaderTemplate(parseInt(e.lastChild.textContent)+1)),n(s).append(l),u=="shift"&&(n(s).find("tr:last td:last").remove(),w=f._getRowIdx(i),n(s).find("tr: eq(' + rowElemIdx + ') td:eq(' + (colIdx - 1) + ')").after(this._columnTemplate()))):(h=s.insertRow(i),n(h).height(f.model.rowHeight),n(h).append(n(l)[0].innerHTML),h=e.insertRow(i),n(h).height(f.model.rowHeight),n(h).append("<td class='e-rowheader'><\/td>")),o.rowCount=f.model.sheets[t].rowCount+1,o.rowsHeightCollection.push(f.model.rowHeight),i>-1){for(a=n(e).find("td"),c=0,v=a.length;c<v;c++)n(a[c]).text(c+1);f.XLScroll._getRowHeights(t,i+1)}o._rowHeightCollection.push(o._rowHeightCollection[o._rowHeightCollection.length-1]+f.model.rowHeight);f.model.allowSelection&&(o._isColSelected||o._isSheetSelected)&&p.refreshSelection();f._refreshRows(t)},_createNewColumn:function(i,r,u,f){var e,s,l,o=this.XLObj,h=o.getSheet(i),st=o.XLSelection,c,d,nt,tt,ft,v,a,p,it,et,ot,rt,w=!1,b,y,ht=h.columnsWidthCollection,ct=o.model.scrollSettings.allowVirtualScrolling,ut,k,g;for(c=o._getContTBody(i)[0],d=o._getJSSheetHeader(i).find("tr")[0],nt=o._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer colgroup"),tt=o._getJSSheetHeader(i).find("colgroup"),ft=h.colCount,y=h.filterSettings.tableRange,e=0,l=y.length;e<l;e++)if(rt=y[e].multifilterIdx,r.colIndex>rt[0]&&u.colIndex<rt[rt.length-1]){w=!0;b=y[e].startRow-1;y=y[e];break}if(r.colIndex===-1||r.colIndex>-1&&r.rowIndex>-1&&f==="shift"){if(r.colIndex===-1&&f==="insert"){for(p=this._columnHeaderTemplate(ft+1,i),n(d).append(p),v=this._colGroupTemplate(i),tt.append(v),e=0,l=c.rows.length;e<l;e++)a=this._columnTemplate(e),n(c.rows[o._getRowIdx(e,i,!1,!0)]).append(a);nt.append(v)}if(f==="shift"){for(ut=ft,e=r.colIndex;e<=u.colIndex;e++)p=this._columnHeaderTemplate(ut+1,i),n(d).append(p),v=this._colGroupTemplate(i),tt.append(v),nt.append(v),ut=ut+1;for(e=0,l=c.rows.length;e<l;e++)for(s=r.colIndex;s<=u.colIndex;s++)a=this._columnTemplate(e),n(c.rows[o._getRowIdx(e)]).append(a);if(o._insDelStatus.indexOf("insert")>-1)for(e=r.rowIndex;e<=u.rowIndex;e++)for(s=r.colIndex;s<=u.colIndex;s++)n(c).find("tr:eq("+o._getRowIdx(e)+") td:last").remove(),a=this._columnTemplate(e),n(c).find("tr").eq(o._getRowIdx(e)).find("td:eq("+s+")").before(a),w&&e===b&&o.model.allowFiltering&&o.XLFilter._insertFilterIcon(e,s,y,b,w);else for(e=r.rowIndex;e<=u.rowIndex;e++)for(s=u.colIndex;s>=r.colIndex;s--)n(c).find("tr:eq("+o._getRowIdx(e)+") td:eq("+s+")").remove(),a=this._columnTemplate(e),n(c).find("tr:eq("+o._getRowIdx(e)+")").append(a),w&&e===b&&o.model.allowFiltering&&o.XLFilter._insertFilterIcon(e,s,y,b,w)}h.colCount=h.colCount+1;h.columnsWidthCollection.push(h.columnWidth)}else{if(h._isTemplate&&(r.colIndex<h._templateColCount||u.colIndex<h._templateColCount))return;if(g=n.extend(!0,[],o.getSheet(i).columnsWidthCollection),o._insDelStatus.indexOf("insert")>-1){for(k=g.splice(0,r.colIndex),e=r.colIndex;e<=u.colIndex;e++)p=this._columnHeaderTemplate(e+1,i),n(d).find("th:eq("+e+")").before(p),v=this._colGroupTemplate(i),k.push(h.columnWidth),tt.find("col:eq("+e+")").before(v),nt.find("col:eq("+e+")").before(v);for(t.merge(k,g),h.columnsWidthCollection=k,e=0,l=c.rows.length;e<l;e++)for(s=r.colIndex;s<=u.colIndex;s++)a=this._columnTemplate(e),n(c.rows[o._getRowIdx(e)]).find("td:eq("+s+")").before(a),w&&e===b&&o.model.allowFiltering&&o.XLFilter._insertFilterIcon(e,s,y,b,w);h.colCount=h.colCount+1}else{for(k=g.splice(0,r.colIndex),e=u.colIndex;e>=r.colIndex;e--)n(d).find("th:eq("+e+")").remove(),tt.find("col:eq("+e+")").remove(),nt.find("col:eq("+e+")").remove();for(g.splice(0,u.colIndex-r.colIndex+1),t.merge(k,g),h.columnsWidthCollection=k,e=0,l=c.rows.length;e<l;e++)for(s=u.colIndex;s>=r.colIndex;s--)n(c.rows[o._getRowIdx(e)]).find("td:eq("+s+")").remove();h.colCount=h.colCount-1}for(et=n(d).find("th>.e-headercelldiv"),e=0,l=et.length;e<l;e++)n(et[e]).text(o._generateHeaderText(e+1))}ot=n.trim(n(p).text());it=n(a).text();h.columns.push({field:ot,type:it!=null?it.getDay?"date":typeof it:null,width:n(a).width()});o.XLScroll._getColWidths(i,r.colIndex>-1?r.colIndex:h.colCount-2);o.model.allowSelection&&(h._isRowSelected||h._isSheetSelected)&&st.refreshSelection();o._refreshTemplates(i,!0)},_insertColHeaders:function(t,i,r){var f=this._columnHeaderTemplate(i+1,t),u;n(r).append(f);u=this._colGroupTemplate(t);n(r.parentNode.previousSibling).append(u)},_scrollBottom:function(n,t){var i=this.XLObj.getSheet(n),r,u;if(t)this._createRows(i.rowCount-1,i.rowCount+t,n);else{this._createNewRow(n,-1,-1,"insert");for(r in i._columnStyles)u=parseInt(r),this.XLObj.XLEdit._updateDataContainer({rowIndex:i.rowCount-1,colIndex:u},{dataObj:i._columnStyles[r]})}},_createRows:function(n,t,i){for(var r=this.XLObj,i=i||r.getActiveSheetIndex(),e=r.getSheet(i),o=r.getSheetElement(i),u=n,f=t;u<f;u++)this._createNewRow(i,-1,-1,"insert")},_scrollRight:function(n){var r={rowIndex:-1,colIndex:-1},t,u,i;this._createNewColumn(n,r,r,"insert");t=this.XLObj.getSheet(n);for(i in t._rowStyles)u=parseInt(i),this.XLObj.XLEdit._updateDataContainer({rowIndex:u,colIndex:t.colCount-1},{dataObj:t._rowStyles[i]})},_refreshRowCol:function(n,t){t=this.XLObj._getSheetIndex(t);var i,r=this.XLObj.getSheet(t),u=!1;if(r.colCount<n[3]+1){for(i=n[3]-(r.colCount-1);i--;)this._scrollRight(t);u=!0}if(r.rowCount<n[2]+1){for(i=n[2]-(r.rowCount-1);i--;)this._scrollBottom(t);u=!0}u&&this._refreshScroller(t,"refresh","all")}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.formatCellDialog=function(n){this.XLObj=n;this._categories=[{value:"General",text:n._getLocStr("LGeneral")},{value:"Number",text:n._getLocStr("NumberTab")},{value:"Currency",text:n._getLocStr("LCurrency")},{value:"Accounting",text:n._getLocStr("LAccounting")},{value:"Date",text:n._getLocStr("LDate")},{value:"Time",text:n._getLocStr("LTime")},{value:"Percentage",text:n._getLocStr("LPercentage")},{value:"Fraction",text:n._getLocStr("LFraction")},{value:"Scientific",text:n._getLocStr("LScientific")},{value:"Text",text:n._getLocStr("LText")},{value:"Custom",text:n._getLocStr("LCustom")}];this._selValue="General"};t.spreadsheetFeatures.formatCellDialog.prototype={_renderCellFrmtDlg:function(){var i=this.XLObj,y=i._id,r=y+"_formatdlg",e,u,f,o,l,a,s,v,h,c;e=t.buildTag("div#"+r);u=t.buildTag("div#"+r+"_formattab");f=t.buildTag("div.e-dlg-fields e-dlgctndiv");o=t.buildTag("ul .e-ul");l=t.buildTag("a",i._getLocStr("NumberTab"),{},{href:"#"+r+"_number"});a=t.buildTag("li",l);o.append(a);u.append(o);f.append(u);s=t.buildTag("div.e-dlg-btnfields");v=t.buildTag("div.e-dlg-btnctnr");h=t.buildTag("input#"+r+"_okbtn");c=t.buildTag("input#"+r+"_cantn");h.ejButton({text:i._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgCFOk,this),cssClass:"e-ss-okbtn"});c.ejButton({text:i._getLocStr("Cancel"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgCFCancel,this)});s.append(v.append(h,c));f.append(t.buildTag("div#"+r+"_format_dataMnger","",{display:"none"}));i.element.append(e.append(f,s));u.ejTab({width:"100%",height:"auto",cssClass:"e-ss-dlgtab",allowKeyboardNavigation:!1});this._renderNumberTab();e.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("Formatcells"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-mattab e-ss-fcdlg e-"+i._id+"-dlg",open:function(){n("#"+i._id+"_formatdlg_okbtn").focus()}})},_renderNumberTab:function(){var f=this.XLObj,i=f._id+"_fdlg_nTab",it=this._categories,p,w,b,k,s,e,r,u,c,l,a,v,y,d,g;p=[{text:"Wednesday, March 14, 2012",value:"{0:dddd, MMMM dd, yyyy}"},{text:"3/14/2012",value:"{0:M/d/yyyy}"},{text:"March 03",value:"{0:MMMM dd}"},{text:"2012 March",value:"{0:yyyy MMMM}"},{text:"3/14/12 1:30 PM",value:"{0:dd/MM/yyyy h:mm tt}"}];w=[{text:"0",type:"default"},{text:"0.00",type:"default"},{text:"#,##0",type:"default"},{text:"#,##00.00",type:"default"},{text:"0%",type:"default"},{text:"0.00%",type:"default"},{text:"MM/dd/yyyy",type:"default"},{text:"d-MMM",type:"default"},{text:"h:mm",type:"default"},{text:"mm:ss",type:"default"}];b=[{text:"1:30:55 PM",value:"{0:h:mm:ss tt}"},{text:"1:30 PM",value:"{0:h:mm tt}"},{text:"13:30:55",value:"{0:h:mm:ss}"},{text:"1:30",value:"{0:hh:mm}"}];var rt=t.buildTag("div.e-ss-maindiv"),nt=t.buildTag("div.e-ss-topdiv","",{display:"inline-flex",width:"100%"}),tt=t.buildTag("div.e-ss-centerdiv","",{display:"inline-flex",width:"100%"}),h=t.buildTag("div.e-ss-lefttopdiv",""),o=t.buildTag("div.e-ss-righttopdiv","",{float:"right"});k=t.buildTag("label.e-dlg-fields",f._getLocStr("FormatSample"));o.append(k);nt.append(h,o);h=t.buildTag("div.e-ss-leftdiv","");o=t.buildTag("div.e-ss-rightdiv","",{float:"right"});s=t.buildTag("input#"+i+"_sinput.ejinputtext","",{},{disabled:"disabled"});o.append(s);$div=t.buildTag("div#div"+i,"");e=t.buildTag("table","",{"white-space":"normal"});r=t.buildTag("tr#"+i+"_decimal.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("DecimalPlacesTxt")),"",{width:"103px"});e.append(r.append(u));r=t.buildTag("tr#"+i+"_decimaldrop.e-fdlg-num-options");u=t.buildTag("td");s=t.buildTag("input#"+i+"_decimalplace","");o.append($div.append(e.append(r.append(u.append(s)))));r=t.buildTag("tr#"+i+"_tseparator.e-fdlg-num-options");u=t.buildTag("td","","",{colspan:"2"});$chkelem=t.buildTag("input#"+i+"_kseptr");e.append(r.append(u.append($chkelem)));r=t.buildTag("tr#"+i+"_dtypes.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("Type")));c=t.buildTag("ul#"+i+"_datetypes");e.append(r.append(u.append(c)));r=t.buildTag("tr#"+i+"_ttypes.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("Type")));l=t.buildTag("ul#"+i+"_timetypes");e.append(r.append(u.append(l)));r=t.buildTag("tr#"+i+"_custom.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("Type")));a=t.buildTag("input#"+i+"_custominput.ejinputtext");v=t.buildTag("ul#"+i+"_customtypes");y=t.buildTag("button#"+i+"_delBtn",f._getLocStr("Delete"),{},{type:"button"});d=t.buildTag("div",y);e.append(r.append(u.append(a,v,d)));f._on(a,"keydown",this._validateCustomFormat);g=t.buildTag("div#"+i+"_typeinfo.e-ss-fcgdiv","",{});o.append($div);tt.append(h,o);n("#"+f._id+"_formatdlg_number").append(rt.append(nt,tt,g));e.find(".e-fdlg-num-options").hide();this._createNumList(it,h);s.ejNumericTextbox({name:"numeric",value:2,height:27,width:"100%",minValue:0,maxValue:30,change:n.proxy(this._refreshFrmtPropChanges,this)});$chkelem.ejCheckBox({change:n.proxy(this._refreshFrmtPropChanges,this)});$chkelem.parent().append(t.buildTag("label.e-dlg-fields",f._getLocStr("ThousandSeparatorTxt"),{"margin-left":6}));c.ejListBox({selectedItemIndex:"0",dataSource:p,fields:{text:"text",value:"value"},width:"100%",height:"120",selected:n.proxy(this._refreshFrmtPropChanges,this)});l.ejListBox({selectedItemIndex:"0",dataSource:b,fields:{text:"text",value:"value"},width:"100%",height:"120",selected:n.proxy(this._refreshFrmtPropChanges,this)});v.ejListBox({selectedItemIndex:"0",dataSource:w,fields:{text:"text",value:"value"},width:"100%",height:"100",selected:n.proxy(this._refreshFrmtPropChanges,this)});n("#"+i+"_datetypes_container").addClass("e-ss-datetypes");n("#"+i+"_timetypes_container").addClass("e-ss-timetypes");n("#"+i+"_customtypes_container").addClass("e-ss-customtypes");y.ejButton({showRoundedCorner:!0,width:60,click:n.proxy(this._customFormatDelete,this)})},_initFormatCellDlg:function(){var t=this.XLObj;if(!t.model.allowCellFormatting)return!1;n("#"+t._id+"_formatdlg").ejDialog("open");this._updateFormtdata();n("#"+t._id+"_formatdlg_format_dataMnger").removeData()},_updateFormtdata:function(){var i=this.XLObj,s=i.getActiveCell(),r=n("#"+i._id+"_fdlg_nTab_list").data("ejListBox"),w=n("#"+i._id+"_fdlg_nTab_decimalplace").data("ejNumericTextbox"),a=n("#"+i._id+"_fdlg_nTab_datetypes").data("ejListBox"),v=n("#"+i._id+"_fdlg_nTab_timetypes").data("ejListBox"),b=n("#"+i._id+"_fdlg_nTab_input").data("ejDropDownList"),u=n("#"+i._id+"_fdlg_nTab_customtypes").data("ejListBox"),t,y,p,f,e,o,h,c,l;r&&r._refreshScroller();t=i.getRangeData({range:[s.rowIndex,s.colIndex,s.rowIndex,s.colIndex]})[0];y="decimalPlaces"in t?t.decimalPlaces:2;p="thousandSeparator"in t?t.thousandSeparator:!1;f="type"in t?t.type.indexOf("date")>-1?"date":t.type:"general";"formatStr"in t?(e=a.getIndexByValue(t.formatStr),o=v.getIndexByValue(t.formatStr),i.isUndefined(e)&&i.isUndefined(o)&&["date"].indexOf(f)>-1&&(h=u.model.dataSource,c=t.formatStr.replace(/^\{0\:|\}$/g,""),i._isValueAlreadyExist(h,"text",c)||(h.push({text:c,type:"custom"}),u._setModel({dataSource:h})),l=u.getIndexByText(c),f="custom")):e=o=0;r&&r.selectItemByValue(n.camelCase("-"+f));a.selectItemByIndex(e>-1?e:0);v.selectItemByIndex(o>-1?o:0);u.selectItemByIndex(l>-1?l:0);f==="string"&&(r.selectItemByIndex(10),u.selectItemByText(t.formatStr));w.option("value",y);n("#"+i._id+"_fdlg_nTab_kseptr").ejCheckBox({checked:p});this._onNumFormatSelect({value:r?r.model.value:b.model.value})},_onNumFormatSelect:function(t){var i=this.XLObj,r="#"+i._id+"_fdlg_nTab_",f=n("#"+i._id+"_fdlg_nTab_typeinfo"),u;n("#"+i._id+"_formatdlg_number").find(".e-fdlg-num-options").hide();value=t.value;switch(value){case"Number":i.model.formatSettings.allowDecimalPlaces&&n(r+"decimal, "+r+"tseparator, "+r+"decimaldrop").show();break;case"Currency":case"Accounting":case"Percentage":case"Scientific":n(r+"decimal").show();n(r+"decimaldrop").show();break;case"Date":n(r+"dtypes").show();n("#"+i._id+"_fdlg_nTab_datetypes").data("ejListBox")._refreshScroller();break;case"Time":n(r+"ttypes").show();n("#"+i._id+"_fdlg_nTab_timetypes").data("ejListBox")._refreshScroller();break;case"Custom":n(r+"custom").show();n("#"+i._id+"_fdlg_nTab_customtypes").data("ejListBox")._refreshScroller()}u=this._getFormattedText(value);n("#"+i._id+"_fdlg_nTab_decimalplace").data("ejNumericTextbox").option("maxValue",value==="Scientific"?20:30);n("#"+i._id+"_fdlg_nTab_sinput").val(u);f.text(i._getLocStr(value));this._selValue=value},_getFormattedText:function(i){var f,o,r,e=0,u=this.XLObj,c=u.getActiveCell(),v=n("#"+u._id+"_fdlg_nTab_decimalplace").data("ejNumericTextbox"),y=n("#"+u._id+"_fdlg_nTab_datetypes").data("ejListBox"),l={Number:"0:N",Currency:"0:C",Accounting:"0:C",Percentage:"0:P",Scientific:"0:N"},p=n("#"+u._id+"_fdlg_nTab_timetypes").data("ejListBox"),h=t.Spreadsheet.CellType,a=t.Spreadsheet.CellFormat,s=n("#"+u._id+"_fdlg_nTab_customtypes").data("ejListBox");u.model.formatSettings.allowDecimalPlaces&&(e=v.getValue());r=u.XLEdit.getPropertyValue(c.rowIndex,c.colIndex)||"";o=n("#"+u._id+"_fdlg_nTab_kseptr").ejCheckBox("checked");switch(i){case"Number":case"Currency":case"Accounting":case"Percentage":f="{"+l[i]+e+"}";u._isDateTime(r)&&(r=u._dateToInt(r));r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,thousandSeparator:o,type:h[i],decimalPlaces:e}));break;case"Date":f=y.getSelectedItems()[0].value;i=f===a.longdate?"longdate":f===a.shortdate?"shortdate":"date";r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,type:i}));break;case"Time":f=p.getSelectedItems()[0].value;r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,type:h[i]}));e=0;break;case"Scientific":f="{"+l[i]+e+"}";u._isDateTime(r)&&(r=u._dateToInt(r));r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,thousandSeparator:o,type:h[i],decimalPlaces:e}));break;case"Fraction":u._isDateTime(r)&&(r=u._dateToInt(r));r=u.toFraction(r);r&&(r=t.isNullOrUndefined(r.numerator)?r.integer:r.integer+" "+r.numerator+"/"+r.denominator);break;case"General":case"Text":u._isDateTime(r)&&(r=u._dateToInt(r));break;case"Custom":cValue=s.getSelectedItems()[0].text;formatObj=u.XLFormat.customFormatParser(cValue);n("#"+u._id+"_fdlg_nTab_custominput").val(cValue);r=u.XLFormat._format(r,formatObj);s.getSelectedItems()[0].index>-1&&n("#"+u._id+"_fdlg_nTab_delBtn").data("ejButton")._setModel({enabled:s.model.dataSource[s.getSelectedItems()[0].index].type==="custom"})}return n("#"+u._id+"_formatdlg_format_dataMnger").data("NumFormat",i==="Custom"?formatObj:{type:i.toLowerCase(),decimalPlaces:e,thousandSeparator:o,formatStr:f}),r},_refreshFrmtPropChanges:function(){var i=this.XLObj,t;t=this._getFormattedText(this._selValue);n("#"+i._id+"_fdlg_nTab_sinput").val(t)},_dlgCFCancel:function(){var t=this.XLObj;n("#"+t._id+"_formatdlg").ejDialog("close");t.model.showRibbon&&t.XLRibbon._updateRibbonIcons();t.setSheetFocus()},_dlgCFOk:function(t){var i=this.XLObj,r=n("#"+i._id+"_formatdlg_format_dataMnger").data();t&&this._selValue==="Custom"&&this._validateCustomFormat()||(i.getObjectLength(r.NumFormat)&&i.XLFormat.format(r.NumFormat),i.model.showRibbon&&i.XLRibbon._updateRibbonIcons(),n("#"+i._id+"_formatdlg").ejDialog("close"),i.setSheetFocus())},_customFormatDelete:function(){var t=n("#"+this.XLObj._id+"_fdlg_nTab_customtypes").data("ejListBox"),i=t.model.dataSource;i.splice(t.model.selectedItemIndex,1);t._setModel({dataSource:i});t.selectItemByIndex(0);this._refreshFrmtPropChanges()},_validateCustomFormat:function(t){var i=t?this:this.XLObj,u,r,f,e=n("#"+i._id+"_fdlg_nTab_custominput").val(),o=i.XLFormat.customFormatParser(e);if(!t||t.keyCode===13)if(i.getObjectLength(o))u=n("#"+i._id+"_fdlg_nTab_customtypes").data("ejListBox"),r=u.model.dataSource,i._isValueAlreadyExist(r,"text",e)||(r.push({text:e,type:"custom"}),u._setModel({dataSource:r})),n("#"+i._id+"_formatdlg_format_dataMnger").data("NumFormat",o),t&&i.XLCellFrmtDlg._dlgCFOk();else return f=n("#"+i._id+"_alertdlg"),i._renderAlertDlgContent(f,"Alert",i._getLocStr("CustomFormatAlert")),f.ejDialog("open"),!0},_createNumList:function(i,r){var u=this.XLObj,f=u._id+"_fdlg_nTab",s,e,o,h=t.buildTag("div.e-ss-drpdiv");e=t.buildTag("input#"+f+"_input");h.append(e);n("#"+u._id+"_formatdlg_number").prepend(h);e.ejDropDownList({dataSource:i,cssClass:"e-ss-num-format",width:"100%",fields:{id:"value",text:"text",value:"text"},select:n.proxy(this._onNumFormatSelect,this),selectedItemIndex:0});s=t.buildTag("label#"+f+"_clabel.e-dlg-fields",u._getLocStr("Category"));u.element.find(".e-ss-lefttopdiv").append(s);o=t.buildTag("ul#"+f+"_list");r.append(o);o.ejListBox({selectedItemIndex:"0",width:"120",height:"250",dataSource:i,fields:{text:"text",value:"value"},select:n.proxy(this._onNumFormatSelect,this),allowMultiSelection:!1})}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.pivot=function(n){this.XLObj=n;this._pivotCnt=1;this._hasPvtField=!1;this._displayActPanel=!0;this.names={}};t.spreadsheetFeatures.pivot.prototype={createPivotTable:function(t,i,r,u,f){var e=this.XLObj,c;if(e.model.enablePivotTable&&!e.model.isReadOnly){var l=e.XLRibbon,h=e.getActiveSheetIndex(),s=[],a,v,y,o,p=0,w=0,b;if(e._showDialog(e._id+"_Ribbon_Insert_Tables_PivotTable"),o=l._getAddrFromDollarAddr(t),a=e.model.sheets[o[0]].sheetInfo.text,t=e.getRangeIndices(o[1]),v=e.getRangeDataAsJSON({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]},!1,o[0]),n("#"+e._id+"_dlg_existsheet").data("ejRadioButton").model.checked||e.isImport||!e.getSheet(h)._isLoaded?(o=l._getAddrFromDollarAddr(i),s=e.getRangeIndices(o[1]),e._isExport||h===o[0]||(e.gotoPage(o[0],!1),h=o[0])):(e.insertSheet(),h=e.getActiveSheetIndex(),s=[2,0]),e.isUndefined(f)&&(f={}),w=e.model.sheets[o[0]]._rowHeightCollection[s[0]],p=e.model.sheets[o[0]]._colWidthCollection[s[1]],e.hideActivationPanel(),r&&r.length){if(e.getObjectKeys(this.names).indexOf(r)>-1)do r=r+this._pivotCnt,this._pivotCnt++;while(e.getObjectKeys(this.names).indexOf(r)>-1)}else do r="PivotTable"+this._pivotCnt,this._pivotCnt++;while(e.getObjectKeys(this.names).indexOf(r)>-1);return c=e._id+"_"+r,this.names[c]=r,f.pvtRange=s,f.sheetIdx=h,f.temp=o[0],f.datasource=v,e.getSheet(h)._isUpdated||this._updatePivotMngr({},{pivot:{id:c,top:w,left:p,rowIndex:s[0],colIndex:s[1],dataRange:t,dataSheetName:a,sheetIdx:h}}),this._refreshPivotElement(t,i,r,u,f),b=e.element.find("#"+c).data("ejPivotGrid"),this._refreshRowColumn(s,b),e.showActivationPanel(),y={sheetIndex:f.sheetIdx,reqType:"shape",shapeType:"pivot",range:f.pvtRange,ID:c,dataSource:f.datasource},e._trigActionComplete(y),c}},_refreshRowColumn:function(n,t){var r=this.XLObj,o=r.getActiveSheetIndex(),s=r.getSheet(o),f=[],u,t,i,e;for(u=t._rowCount,e=t.calculateCellWidths().rowHeight,f=t.calculateCellWidths().columnWidths,colCount=f.length,u||(u=4),i=n[0];i<u+n[0];i++)r.XLResize.setRowHeight(i,e);if(colCount>0)for(i=0;i<colCount+n[1];i++)r.XLResize.setColWidth(i+n[1],f[i]);else for(i=0;i<3+n[1];i++)r.XLResize.setColWidth(i+n[1],81);s._isFreezed&&(r.XLFreeze._refreshFreezeRowDiv(),r.XLFreeze._refreshFreezeColDiv())},_refreshPivotElement:function(i,r,u,f,e){var o=this.XLObj,s,h,c,l,a;l=o.model.sheets[e.sheetIdx]._rowHeightCollection[e.pvtRange[0]];a=o.model.sheets[e.sheetIdx]._colWidthCollection[e.pvtRange[1]];c={dataSource:{data:e.datasource},enableToolTipAnimation:!1,cellDoubleClick:n.proxy(this._cellDblClick,this),enableCellDoubleClick:!0,renderSuccess:n.proxy(this._renderSuccess,this),drillSuccess:n.proxy(this._renderSuccess,this)};t.isNullOrUndefined(f)||(c.dataSource={data:e.datasource,rows:f.rows,columns:f.columns,values:f.values,filters:f.filters});o.getSheetElement(o.getActiveSheetIndex()).find(".e-ss-activepivot").removeClass("e-ss-activepivot");s=t.buildTag("div.e-ss-pivot","","",{id:o._id+"_"+u});s.css({left:a-2,top:l-2}).addClass("e-ss-activepivot");o._getContent(e.sheetIdx).find(".e-content").append(s);this._hasPvtField||o.getActivationPanel().append(t.buildTag("div","",{overflow:"hidden"},{id:o._id+"_PivotField"}));o.element.find("#"+o._id+"_PivotField").append(t.buildTag("div.e-ss-pivotfield","","",{id:o._id+"_PivotTableSchema_"+o._id+"_"+u}));h=o.element.find("#"+o._id+"_PivotTableSchema_"+o._id+"_"+u);o.getActivationPanel().find("#"+h[0].id).show();s.ejPivotGrid(c);h.find("#"+o._id+"_PivotTableSchema_"+o._id+"_"+u+"_schemaFieldTree").data("ejTreeView").option("allowDragAndDrop",!1);h.css({float:"left",width:o.model.activationPanelWidth-20});h.find(".schemaFieldList").css({height:150});this._hasPvtField||(o.getActivationPanel().ejScroller({width:o.model.activationPanelWidth,height:o._getContent(e.sheetIdx).height(),scroll:n.proxy(this._pivotScroll,this)}),this._hasPvtField=!0);this._clearBackgroundData(s.data("ejPivotGrid"),o.getSheet(e.sheetIdx).pivotMngr.pivot[s[0].id],e.sheetIdx,"update");o.XLRibbon&&o.XLRibbon._analyzeTabUpdate();o.XLSelection._cleanUp(!0);o.getActivationPanel().data("ejScroller").refresh()},deletePivotTable:function(n){var u=this._getPivotIDFromName(n),t=this.XLObj,f,e=t._dataContainer,r,i;if(t.model.enablePivotTable&&!t.model.isReadOnly)for(i=1,len=t.model.sheetCount;i<=len;i++)t._getContent(i).find("#"+u).length&&(r=t.getSheet(i).pivotMngr.pivot[u],f=e.sheets[i][r.rowIndex][r.colIndex],t.getObjectLength(f)<2&&f.pivot.length<2?delete e.sheets[i][r.rowIndex][r.colIndex]:f.pivot.length<2&&delete e.sheets[i][r.rowIndex][r.colIndex].pivot,delete t.getSheet(i).pivotMngr.pivot[u],t._getContent(i).find("#"+u).remove(),t.hideActivationPanel(),t.getActivationPanel().find("#"+t._id+"_PivotTableSchema_"+u).remove(),t.XLRibbon._toggleAnalyzeTab(),t._trigActionComplete({ID:u,rowIndex:r.rowIndex,colIndex:r.colIndex,reqType:"shape",shapeType:"pivot",sheetIndex:i}))},refreshDataSource:function(n,t){var i=this.XLObj,r,f,e,u,o;i.model.enablePivotTable&&!i.model.isReadOnly&&(n&&t?(r=i.element.find("#"+i._id+"_"+n),r&&(f=r[0].id)):(t=i.getActiveSheetIndex(),r=i._getContent(t).find(".e-ss-activepivot"),f=r[0].id),e=r.data("ejPivotGrid"),e&&(u=i.getSheet(t).pivotMngr.pivot[f].dataRange,o=i.getRangeDataAsJSON({rowIndex:u[0],colIndex:u[1]},{rowIndex:u[2],colIndex:u[3]},!1,i._getSheetIndexByName(i.getSheet(t).pivotMngr.pivot[f].dataSheetName)),e.model.dataSource.data=o,e.refreshPivotGrid()))},clearPivotFieldList:function(n){var t=this.XLObj,i=this._getPivotIDFromName(n);t.model.enablePivotTable&&!t.model.isReadOnly&&this._clearFilters(t.element.find("#"+i).data("ejPivotGrid"),t.getActivationPanel().find("#"+t._id+"_PivotTableSchema_"+i).data("ejPivotSchemaDesigner"))},_cellDblClick:function(n){if(n.selectedData.length){var t=this.XLObj,i=t.XLFormat,r;t.insertSheet();r=t.getActiveSheetIndex();t.updateRange(r,{dataSource:n.selectedData,startCell:"A1",showHeader:!0});i.createTable({header:!0,name:"Table"+t._tableCnt,format:i._getTableLayoutFromName("TableStyleMedium9").format,formatName:"TableStyleMedium9"},"A1:"+t._generateHeaderText(t.getObjectLength(n.selectedData[0]))+(n.selectedData.length+1))}},_dragMove:function(){var i=this.XLObj,t,r=i.getActivationPanel().data("ejScroller"),f=i.element.find(".e-spreadsheetactpanel"),u=f.offset().top;f.height()+u-45<n(".e-dragedNode").offset().top?t=setInterval(function(){f.height()+u-45<n(".e-dragedNode").offset().top&&r.scrollY(r.model.scrollTop+25)},300):u+45>n(".e-dragedNode").offset().top&&(t=setInterval(function(){u+45>n(".e-dragedNode").offset().top&&r.scrollY(r.model.scrollTop-25)},300));i._browserDetails.name==="msie"&&i._browserDetails.version==="8.0"?(n(".e-dragedNode")[0].attachEvent("onmouseup",function(){clearInterval(t)}),document.attachEvent("onmouseup",function(){clearInterval(t)})):(n(".e-dragedNode")[0].addEventListener("mouseup",function(){clearInterval(t)}),document.addEventListener("mouseup",function(){clearInterval(t)}))},_renderSuccess:function(i){i.type==="drillSuccess"&&(i=i.gridObj);var r=this.XLObj,e=r.getActiveSheetIndex(),o,s,u,f=i,h=[];r._isExport||this._clearBackgroundData(i,r.getSheet(e).pivotMngr.pivot[i._id],e,"update");r.element.find("#"+r._id+"_PivotTableSchema_"+i._id).ejPivotSchemaDesigner({pivotControl:i,layout:t.PivotSchemaDesigner.Layouts.Excel,dragMove:n.proxy(this._dragMove,this),fieldItemDropped:n.proxy(this._fieldItemDropped,this)});u=r.getSheet(e).pivotMngr.pivot[i._id];s=f._rowCount;o=f.getJSONRecords().length/f._rowCount;h=[u.rowIndex,u.colIndex,u.rowIndex+s,u.colIndex+o];this._refreshRowColumn(h,f);n(".e-spreadsheet .e-pivotgrid th[role='columnheader'").addClass("e-ss-pivottableheader");n(".e-spreadsheet .e-pivotgrid tr:last th.rgtot").addClass("e-ss-pivottableheader");r.XLDragFill.hideAutoFillElement()},_clearBackgroundData:function(n,t,i,r){var u=this.XLObj,f,e,o,s;f=n.getJSONRecords().length/n._rowCount;e=n._rowCount;o=!e||isNaN(e)?t.rowIndex+17:t.rowIndex+e;s=!f||isNaN(f)?t.colIndex+2:t.colIndex+f-1;r&&r!=="update"?u.getRange([t.rowIndex,t.colIndex,o,s],i).removeClass("e-readOnly"):u.getRange([t.rowIndex,t.colIndex,o,s],i).removeClass("e-readOnly").addClass("e-readonly");u._dupDetails=!0;u.clearRangeData([t.rowIndex,t.colIndex,o,s],["value","value2","hyperlink","cFormatRule","comment","format","formats"],"",!1);u._dupDetails=!1},_fieldItemDropped:function(n){if(n.axis==="filter"){var t=this.XLObj,u=t.getActiveSheetIndex(),r,i;for(i=t._getContent(u).find(".e-ss-activepivot").data("ejPivotGrid"),pivot=t.getSheet(u).pivotMngr.pivot[i._id];pivot.rowIndex<=i.getOlapReport().filters.length;)pivot.rowIndex=pivot.rowIndex+1,r=t.getCell(pivot.rowIndex,pivot.colIndex)[0],i.element.css({left:r.offsetLeft-2,top:r.offsetTop-2})}},_updatePivotMngr:function(t,i){var r=this.XLObj,u=r.getSheet(r.getActiveSheetIndex()).pivotMngr,f=u.pivot;f[i.pivot.id]=n.extend(!0,{},i.pivot);r.XLEdit._updateDataContainer({rowIndex:i.pivot.rowIndex,colIndex:i.pivot.colIndex},{dataObj:{pivot:i.pivot.id}})},_pivotMouseDown:function(t){var i=this.XLObj;t.preventDefault();i.getActivationPanel().find("#"+i._id+"_PivotTableSchema_"+t.target.id).show();i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot").removeClass("e-ss-activepivot");n(t.target).hasClass("e-ss-pivot")?n(t.target).addClass("e-ss-activepivot"):n(t.target).parents("e-ss-object").addClass("e-ss-activepivot");i.XLSelection._cleanUp(!0);i.showActivationPanel()},_pivotScroll:function(t){var i=this.XLObj,r=i.getActivationPanel().find("#"+i._id+"_PivotTableSchema_"+i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).data("ejPivotSchemaDesigner");t.source==="thumb"&&(n(".e-dragedNode").length||r._isDragging||this.XLObj.XLResize._allowStart)&&(t.cancel=!0)},_pivotMouseUp:function(t){var i=this.XLObj,r=n(t.target),u=n("#"+i._id+"_Ribbon").data("ejRibbon");i.model.showRibbon&&(i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot").length&&(r.hasClass("e-ss-pivot")||r.parents(".e-ss-pivot").length)?i.XLRibbon._analyzeTabUpdate():!i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot").length&&(u.model.selectedItemIndex===i.XLRibbon._getTabIndex("analyze")||u.isVisible("Analyze"))&&i.XLRibbon._toggleAnalyzeTab())},_changePvtName:function(){var n=this.XLObj,t=n.element.find("#"+n._id+"_Ribbon_Analyze_PivotTable_PivotTableName").val();this.names[n._getContent(n.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id]=t;n._trigActionComplete({pvtName:t,reqType:"shape",shapeType:"pivot",sheetIndex:n.getActiveSheetIndex(),ID:n._getContent(n.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id})},_checkRange:function(n,t){var i=this.XLObj,d=i.getActiveCell(),v,y=d.rowIndex,p=d.colIndex,w,r=[],b=i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot"),e,u,h,c={isHeader:!1,isRows:!1},k,s,o,g,l,a,nt,tt,f;if(e=i.XLRibbon._getAddrFromDollarAddr(n),v=e[0],r=i.getRangeIndices(e[1]),y=r[0],p=r[1],n.length)for(u=0,h=r[3]-p+1;u<h;u++)w=i.XLEdit.getPropertyValue(y,p+u,"value",v),(i.isUndefined(w)||w=="")&&(c.isHeader=!0);if(y===r[2]&&(c.isRows=!0),t.length)for(e=i.XLRibbon._getAddrFromDollarAddr(t),v=e[0],r=i.getRangeIndices(e[1]),u=1,h=i.model.sheetCount;u<=h;u++)for(k=i.model.sheets[u].pivotMngr.pivot,s=i.getObjectKeys(k),o=0,g=s.length;o<g;o++)if((!b.length||b.length&&s[o]!==b[0].id)&&(l=i.element.find("#"+s[o]).data("ejPivotGrid"),f=k[s[o]],colCount=l.getJSONRecords().length/l.rowCount,a=l.rowCount,nt=!a||isNaN(a)?f.rowIndex+17:f.rowIndex+a-1,tt=!colCount||isNaN(colCount)?f.colIndex+2:f.colIndex+colCount-1,r[0]>=f.rowIndex&&r[0]<=nt&&r[1]>=f.colIndex&&r[1]<=tt)){c.isOverlap=!0;break}return c},_updateSheetName:function(n){for(var t=this.XLObj,r,u,e,o=t.getSheet(t.getActiveSheetIndex()).sheetInfo.text,i=1,f=t.model.sheetCount;i<=f;i++)for(r=t.getSheet(i).pivotMngr.pivot,u=t.getObjectKeys(r),j=0,e=u.length;j<e;j++)r[u[j]].dataSheetName===o&&(r[u[j]].dataSheetName=n)},_getSheetIdxFromName:function(n){for(var i=this.XLObj,t=1,r=i.model.sheetCount;t<=r;t++)if(i.model.sheets[t].sheetInfo.text==n)return t},_changeDataSource:function(){var t=this.XLObj,o=t.getActiveSheetIndex(),i=t._getContent(o).find(".e-ss-activepivot")[0].id,e=n("#"+i).data("ejPivotGrid"),s,r,h,u,f;r=t.XLRibbon._getAddrFromDollarAddr(n("#"+t._id+"_Ribbon_PvtRange").val());h=t.model.sheets[r[0]].sheetInfo.text;range=t.getRangeIndices(r[1]);f=t.getSheet(t.getActiveSheetIndex()).pivotMngr.pivot[i];f.dataRange=range;f.dataSheetName=h;u=t.getRangeDataAsJSON({rowIndex:range[0],colIndex:range[1]},{rowIndex:range[2],colIndex:range[3]},!1,r[0]);e.getOlapReport().data=u;s=n("#"+t._id+"_PivotTableSchema_"+i).data("ejPivotSchemaDesigner");e.model.dataSource.data=u;this._clearFilters(e,s);t._trigActionComplete({sheetIndex:o,dataRange:f.dataRange,ID:i,pvtData:u,reqType:"shape",shapeType:"pivot"})},_getPivotIDFromName:function(n){for(var t in this.names)if(n===this.names[t])return t},_clearFilters:function(t,i){var u=this.XLObj,r=t.getOlapReport();r.rows=[];r.columns=[];r.values=[];r.filters=[];t.refreshPivotGrid();i.model.pivotControl=t;n(i.element).html("");i._load();u._refreshActivationPanel()},_movePivotTable:function(){var t=this.XLObj,u=t.getActiveSheetIndex(),f=t._getContent(u).find(".e-ss-activepivot"),o=f[0].id,r,s=f.data("ejPivotGrid"),a,h,e,c,i,l,v=!0,y,w,b,p;if(r=t.getSheet(u).pivotMngr.pivot[o],n("#"+t._id+"_dlg_existsheet").data("ejRadioButton").model.checked?(v=!1,a=n("#"+t._id+"_Ribbon_PvtLocation").val().split("!"),h=this._getSheetIdxFromName(a[0]),i=t.getRangeIndices(t.XLRibbon._getAddrFromDollarAddr(a[1])[1]),u!==h&&(t._getContent(h).find(".e-content").append(f),t.gotoPage(h,!1),t.XLSelection._cleanUp(!0),v=!0),r.rowIndex=i[0],r.colIndex=i[1]):(t.insertSheet(),u=t.getActiveSheetIndex(),t._getContent(u).find(".e-content").append(f),i=[2,0]),v&&(l=t.getActiveSheetIndex(),t.getSheet(l).pivotMngr.pivot[o]={},n.extend(!0,t.getSheet(l).pivotMngr.pivot[o],r),l!==u&&delete t.getSheet(u).pivotMngr.pivot[o]),c=t.getCell(i[0],i[1]),!c&&t.model.scrollSettings.allowVirtualScrolling&&(p=t.getSheet(t.getActiveSheetIndex()),t._scrollContent({y:p._rowHeightCollection[i[0]+1]-p._scrollTop}),c=t.getCell(i[0],i[1])),e=c[0],f.css({left:e.offsetLeft-2,top:e.offsetTop-2}),s.getOlapReport().filters.length)while(r.rowIndex<=s.getOlapReport().filters.length)r.rowIndex=r.rowIndex+1,e=t.getCell(r.rowIndex,r.colIndex)[0],f.css({left:e.offsetLeft-2,top:e.offsetTop-2});b=s._rowCount;w=s.calculateCellWidths().columnWidths.length;y=[i[0],i[1],i[0]+b,i[1]+w];this._refreshRowColumn(y,s);t._trigActionComplete({sheetIndex:u,newRange:y,ID:o,reqType:"shape",shapeType:"pivot"})}}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejReportViewer","ej.ReportViewer",{_rootCSS:"e-reportviewer",element:null,model:null,validTags:["div"],defaults:{reportServiceUrl:"",reportServerId:"",reportPath:"",reportServerUrl:"",dataSources:[],parameters:[],exportSettings:{exportOptions:31,excelFormat:"excel97to2003",pptFormat:"powerpoint97to2003",wordFormat:"doc"},toolbarSettings:{items:1023,showToolbar:!0,templateId:"",click:"",showTooltip:!0},locale:"en-US",printMode:!1,renderMode:3,printOption:"Default",enablePageCache:!1,enablePageVirtualization:!1,pageSettings:{height:0,width:0,orientation:null,paperSize:null,margins:{top:0,right:0,bottom:0,left:0}},processingMode:"remote",zoomFactor:1,isResponsive:!0,reportLoaded:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,renderingBegin:null,renderingComplete:null,reportError:null,reportExport:null,drillThrough:null,reportPrint:null,viewReportClick:null,destroy:null,enableNotificationBar:!0,enableDropDownSearch:!1},dataTypes:{dataSources:"array",parameters:"array",toolbarSettings:{showToolbar:"boolean"}},_dataSources:null,_svg:!0,_authenticationToken:null,_dataRefresh:!1,_isForwardDirection:!1,_isSelectedPage:!1,_refresh:!1,_isToolbarClick:!1,_printMode:!1,_pageSetup:!1,_pageModel:null,_currentPage:1,_pageLayoutPage:1,_machineCulture:null,_reportParameters:null,_reportDataSources:null,_reporDataSets:null,_zoomLevel:2,_preZoomVal:1,_actionUrl:null,_isDocumentMap:!1,_isPageDocMap:!1,_pageDocMapFlag:!1,_childReportAuthentication:null,_parents:[],_parentPageXY:null,_browserInfo:null,_isDevice:!1,_zoomVal:1,_originX:0,_originY:0,_paperName:null,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_paperOrientation:null,_pageCache:[],_printPageCache:[],_paperSetup:{paperHeight:null,paperWidth:null,MarginTop:0,MarginRight:0,MarginBottom:0,MarginLeft:0},_reportAction:{reportLoad:"ReportLoad",getDataSourceCredential:"GetDataSourceCredential",validateDSCredential:"ValidateDSCredential",updateDSCredential:"UpdateDSCredential",getParameters:"GetParameters",setParameters:"SetParameters",updateParameters:"UpdateParameters",updateDataSource:"UpdateDataSource",getPageModel:"GetPageModel",getPrintModel:"GetPrintModel",drillDown:"DrillDown",clearCache:"ClearCache",documentMap:"DocumentMap",drillThrough:"DrillThrough",sorting:"Sorting"},_parameters:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")},_dataSources:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")},_tags:[{tag:"parameters",attr:["",[{tag:"parameter",attr:["name","labels","values","nullable"]}]]},{tag:"dataSources",attr:["",[{tag:"datasource",attr:["name","value"]}]]}],_setModel:function(n){var u=!1,f=!1,t,i,r;for(t in n)switch(t){case"reportPath":case"reportServerUrl":case"reportServiceUrl":u=!0;break;case"dataSources":this._refresh=!0;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:n[t],parameters:this.model.parameters}),"_getDataSourceCredential");break;case"parameters":this._refresh=!0;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:n.parameters}),"_setParameters");break;case"processingMode":f=!0;break;case"zoomFactor":this._zoomContainer(n[t],!1);break;case"printMode":this._updatePreviewLayout(n[t],!1);break;case"toolbarSettings":this._updateToolbarmodel();break;case"locale":this._setCultureInfo();break;case"renderMode":this._reInit();break;case"pageSettings":for(i in n[t])switch(i){case"height":this._paperSetup.paperHeight=n[t][i];this._paperName="Custom";break;case"width":this._paperSetup.paperWidth=n[t][i];this._paperName="Custom";break;case"orientation":this._paperOrientation=n[t][i];break;case"paperSize":this._paperName=n[t][i];break;case"margins":for(r in n[t][i])switch(r){case"top":this._paperSetup.MarginTop=n[t][i][r];break;case"bottom":this._paperSetup.MarginBottom=n[t][i][r];break;case"left":this._paperSetup.MarginLeft=n[t][i][r];break;case"right":this._paperSetup.MarginRight=n[t][i][r]}}this._printMode&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode,PageSetup:this._paperSetup}),this._printMode?"_getPreviewModel":"_getPageModel")}f&&!u&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential");u&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_reportReload")},_reInit:function(){this._destroy();this._init()},_destroyEJObjects:function(t){for(var f,e,u,i,r=0;r<t.length;r++)f=n(t[r]),e=f.data("ejWidgets"),e&&(u=f.data(e[0]),u&&(i=u.element.find(".e-js"),i&&i.length>0&&this._destroyEJObjects(i),i=null,u.destroy()))},_destroy:function(){var t=this.element.find(".e-js");t&&t.length>0&&this._destroyEJObjects(t);t=null;this._clearPageCache();n("#"+this._id+"_exportForm").remove();n("#"+this._id+"_toolbar_exportListTip").remove();n("#"+this._id+"_toolbar_fittoPagePopup").remove();n("#"+this._id+"_device_toolbarContainer").remove();n("#"+this._id+"_rptTooltip").remove();n(this.element).find(".e-reportviewer-viewer").remove();n("#"+this._id+"_pageInfoPopup").remove();n("#"+this._id+"_printPageIframe").remove();this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_clearCurrentServerCache")},_destroyExistingObj:function(){n("#"+this._id+"_printPageSetup").remove();this._parents.length>0&&this._parents.pop()},_init:function(){this._svg=window.SVGSVGElement?!0:!1;this._actionUrl=this.model.reportServiceUrl+"/PostReportAction";this._authenticationToken=this._getAuthenticationToken();this._browserInfo=t.browserInfo();this._destroyExistingObj();this._renderViewer();this._initViewer();this._on(n(window),"resize",this._viewerResize);this.model.reportServiceUrl&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.reportLoad,controlId:this._id,reportPath:this.model.reportPath,reportServerUrl:this.model.reportServerUrl,processingMode:this.model.processingMode}),"_reportLoaded")},_initViewer:function(){this._wireEvents();this._initToolbar();this._clearPageCache();this._currentPage=1;this._pageLayoutPage=this._currentPage;this._setPageSettings();this._refresh||(this._preZoomVal=1,this._zoomLevel=2);this._isDocumentMap=!1;this._printMode=this.model.printMode;this._isPageDocMap=!1;this._pageDocMapFlag=!1;var n=this.model.toolbarSettings;n.templateId||(this._showToolbar(n.showToolbar),this._showPrintButton(n.items&t.ReportViewer.ToolbarItems.Print),this._showRefreshButton(n.items&t.ReportViewer.ToolbarItems.Refresh),this._showZoomControl(n.items&t.ReportViewer.ToolbarItems.Zoom),this._showFittoPage(n.items&t.ReportViewer.ToolbarItems.FittoPage),this._showExportControls(n.items&t.ReportViewer.ToolbarItems.Export),this._showPrintPageSetupButton(n.items&t.ReportViewer.ToolbarItems.PageSetup),this._showExportList(),this._showPageNavigationControls(n.items&t.ReportViewer.ToolbarItems.PageNavigation),this._showParameterBlock(n.items&t.ReportViewer.ToolbarItems.Parameters),this._showPreviewButton(n.items&t.ReportViewer.ToolbarItems.PrintLayout),this._showDrillThrough(this._parents.length>0),this._showDocumentMap(!1));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0)},_setPageSettings:function(){var r=!1,t=0,i=0,n;this._paperName=null;this._paperOrientation=null;this._paperSetup.paperHeight=null;this._paperSetup.paperWidth=null;this._paperSetup.MarginBottom=0;this._paperSetup.MarginLeft=0;this._paperSetup.MarginRight=0;this._paperSetup.MarginTop=0;this.model.pageSettings&&this.model.pageSettings.height>0&&(i=this.model.pageSettings.height,r=!0);this.model.pageSettings&&this.model.pageSettings.width>0&&(t=this.model.pageSettings.width,r=!0);this.model.pageSettings.paperSize?(this._paperName=this.model.pageSettings.paperSize,n=this._getPaperSize(this.model.pageSettings.paperSize),r&&(t>0&&(n.width=t),i>0&&(n.height=i),this._paperName="Custom"),this._paperOrientation=this.model.pageSettings.orientation=="Landscape"?"Landscape":"Portrait",this.model.pageSettings.orientation=="Landscape"?(this._paperSetup.paperHeight=n.width,this._paperSetup.paperWidth=n.height):(this._paperSetup.paperHeight=n.height,this._paperSetup.paperWidth=n.width)):r&&(t>0&&(this._paperSetup.paperWidth=t),i>0&&(this._paperSetup.paperHeight=i),this._paperName="Custom");this.model.pageSettings&&this.model.pageSettings.margins&&(this.model.pageSettings.margins.left>0&&(this._paperSetup.MarginLeft=this.model.pageSettings.margins.left),this.model.pageSettings.margins.right>0&&(this._paperSetup.MarginRight=this.model.pageSettings.margins.right),this.model.pageSettings.margins.bottom>0&&(this._paperSetup.MarginBottom=this.model.pageSettings.margins.bottom),this.model.pageSettings.margins.top>0&&(this._paperSetup.MarginTop=this.model.pageSettings.margins.top))},_renderPageInfoPopup:function(){var i=n("#"+this._id+"_pageInfoPopup"),r,f;i.length>0||(i=t.buildTag("div.e-reportviewer-pagepopupinfo","",{"WHITE-SPACE":"nowrap"},{id:this._id+"_pageInfoPopup"}),r=t.buildTag("input.e-reportviewer-pagenumber e-reportviewer-elementalignments ejinputtext","",{},{type:"text",value:this._currentPage,id:this._id+"_popupPageNo"}),r.css("height","25.5px"),r.css("width","25px"),r.css("background-color","black"),r.css("color","white"),r.css("border-color","black"),f=t.buildTag("span.e-reportviewer-popuptotalpage","",{},{}),f.append(" / "+this._pageModel.TotalPages),i.append(r),i.append(f),n("body").append(i),this._on(n("#"+this._id+"_popupPageNo"),"click",this._popupClick),this._on(n("#"+this._id+"_popupPageNo"),"keypress",this._onkeyPress));i.css("display")=="block"?(i.stop().fadeIn(),i.stop().fadeOut(3e3),i.hide(3e3)):(i.show(),i.stop().fadeIn(),i.stop().fadeOut(3e3),i.hide(3e3));var u=n("#"+this._id+"_viewerContainer"),e=u.offset().left+u.width()/2-i.width()/2,o=u.offset().top+u.height()/2-i.height()/2;i.css({left:e,top:o});this._updatePageNo()},_renderToolTip:function(){var i=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),r=t.buildTag("span.e-reportviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),u=t.buildTag("span.e-reportviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});i.append(r);i.append(u);n("body").append(i)},_renderToolBar:function(i){var r,u,e,f,o,s,h;this.model.toolbarSettings.templateId?(h=n("#"+this.model.toolbarSettings.templateId),i.append(h),h.ejToolbar({enableSeparator:!0,height:h.height(),click:this.model.toolbarSettings.click}),h.css("display","block")):(r=t.buildTag("div.e-reportviewer-toolbarcontainer .e-reportviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(r),this._isDevice?(u=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(u,"export"),this._appendToolbarItems(u,"gotoparent"),this._appendToolbarItems(u,"zoomin"),this._appendToolbarItems(u,"zoomout"),this._appendToolbarItems(u,"pagefit"),this._appendToolbarItems(u,"refresh"),this._appendToolbarItems(u,"parameter"),this._renderNavigationItems(r),r.append(u)):(e=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(e,"print"),this._appendToolbarItems(e,"export"),this._appendToolbarItems(e,"preview"),this._appendToolbarItems(e,"pagesetup"),r.append(e),f=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(f,"gotofirst"),this._appendToolbarItems(f,"gotoprevious"),this._appendToolbarItems(f,"gotopage"),this._appendToolbarItems(f,"gotonext"),this._appendToolbarItems(f,"gotolast"),this._appendToolbarItems(f,"gotoparent"),r.append(f),o=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(o,"zoomin"),this._appendToolbarItems(o,"zoomout"),this._appendToolbarItems(o,"zoom"),this._appendToolbarItems(o,"pagefit"),r.append(o),s=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(s,"refresh"),this._appendToolbarItems(s,"documentmap"),this._appendToolbarItems(s,"parameter"),r.append(s),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"80px",change:this._zoomValChange,selectedItem:2})),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this)}))},_renderNavigationItems:function(i){var r=t.buildTag("div.e-device-reportviewer-toolbarcontainer .e-reportviewer-viewer","",{},{id:this._id+"_device_toolbarContainer"}),u=t.buildTag("ul.e-reportviewer-toolbarul","",{}),f;this._appendToolbarItems(u,"gotofirst");this._appendToolbarItems(u,"gotoprevious");this._appendToolbarItems(u,"gotopage");this._appendToolbarItems(u,"gotonext");this._appendToolbarItems(u,"gotolast");r.append(u);n("body").append(r);f=t.buildTag("span.e-device-reportviewer-toolbarspan","",{display:"block",float:"right"},{id:this._id+"_device_toolbarspan"});f.addClass("e-icon e-toolbar-res-arrow e-reportviewer-toolbarul e-ul e-horizontal");f.css("padding","3px");i.append(f);r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this)});r.removeClass("e-toolbarspan").addClass("e-abs-position");r.css("display","none");r.css("z-index","1001")},_appendToolbarItems:function(n,i){var r,f=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],o,s,h,c,l,a,v,y,p,w,b,u,e,k,d,g,nt,tt,it;switch(i){case"print":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});o=t.buildTag("span.e-reportviewer-icon e-reportviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(o);break;case"export":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});e=t.buildTag("span.e-reportviewer-icon e-reportviewer-export","",{},{id:this._id+"_ejtb_export"});r.append(e);break;case"pagesetup":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});s=t.buildTag("span.e-reportviewer-icon e-reportviewer-pagesetup","",{},{id:this._id+"_ejtb_PageSetup"});r.append(s);break;case"gotofirst":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});h=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotofirst","",{});r.append(h);break;case"gotolast":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});c=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotolast","",{});r.append(c);break;case"gotonext":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});l=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotonext","",{});r.append(l);break;case"gotoprevious":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});a=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotoprevious","",{});r.append(a);break;case"gotoparent":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});v=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotoparent","",{});r.append(v);break;case"gotopage":r=t.buildTag("div.e-reportviewer-tbpage","",{display:"block"},{});y=t.buildTag("input.e-reportviewer-pagenumber e-reportviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"});p=t.buildTag("span.e-reportviewer-labelpageno","",{},{});r.append(y);r.append(p);break;case"zoomin":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});w=t.buildTag("span.e-reportviewer-icon e-reportviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(w);break;case"zoomout":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});b=t.buildTag("span.e-reportviewer-icon e-reportviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(b);break;case"zoom":r=t.buildTag("div.e-reportviewer-ejdropdownlist","",{},{});u=t.buildTag("select.e-reportviewer-tbdiv e-reportviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"});u.append("<option>50%<\/option>");u.append("<option>75%<\/option>");u.append("<option Selected>100%<\/option>");u.append("<option>125%<\/option>");u.append("<option>150%<\/option>");u.append("<option>200%<\/option>");u.append("<option>400%<\/option>");r.append(u);break;case"pagefit":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});e=t.buildTag("span.e-reportviewer-icon e-reportviewer-pagefit","",{},{id:this._id+"_ejtb_fittopage"});r.append(e);break;case"preview":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_preview"});k=t.buildTag("span.e-reportviewer-icon e-reportviewer-preview","",{},{});r.append(k);break;case"refresh":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});d=t.buildTag("span.e-reportviewer-icon e-reportviewer-refresh","",{},{id:this._id+"_toolbar_refresh"});r.append(d);break;case"documentmap":r=t.buildTag("li.e-reportviewer-toolbarli","",{display:"none"},{id:this._id+"_ejtb_documentmap"});g=t.buildTag("span.e-reportviewer-icon e-reportviewer-documentmap","",{});r.append(g);break;case"parameter":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_parameter"});nt=t.buildTag("span.e-reportviewer-icon e-reportviewer-parameter","",{});r.append(nt);break;case"pdf":r=t.buildTag("li.e-reportviewer-popupli e-pdf","",{},{id:this._id+"_pdf"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-pdf","",{},{});$spanTag.append(f.toolbar.exportformat.Pdf);r.append($spanTag);break;case"xls":r=t.buildTag("li.e-reportviewer-popupli e-excel","",{},{id:this._id+"_xls"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-excel","",{},{});$spanTag.append(f.toolbar.exportformat.Excel);r.append($spanTag);break;case"word":r=t.buildTag("li.e-reportviewer-popupli e-word","",{},{id:this._id+"_word"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-word","",{},{});$spanTag.append(f.toolbar.exportformat.Word);r.append($spanTag);break;case"html":r=t.buildTag("li.e-reportviewer-popupli e-html","",{},{id:this._id+"_html"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-html","",{},{});$spanTag.append(f.toolbar.exportformat.Html);r.append($spanTag);break;case"ppt":r=t.buildTag("li.e-reportviewer-popupli e-ppt","",{},{id:this._id+"_ppt"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-ppt","",{},{});$spanTag.append(f.toolbar.exportformat.PPT);r.append($spanTag);break;case"fittopage":r=t.buildTag("li.e-reportviewer-popupli","",{},{id:this._id+"_fittoPage"});break;case"fittopagewidth":r=t.buildTag("li.e-reportviewer-popupli e-fitpagewidth","",{"padding-right":"5px",width:"auto"},{id:this._id+"_pageWidth",isSelect:"false"});tt=t.buildTag("span.e-reportviewer-icon e-reportviewer-emptyconetent","",{"padding-right":"4px",cursor:"pointer"},{id:this._id+"Pagewidthspan",fitType:"PAGEWIDTH"});r.append(tt);r.append(f.toolbar.fittopage.pageWidth);break;case"fittowholepage":r=t.buildTag("li.e-reportviewer-popupli e-fitpageheight","",{"padding-right":"5px",width:"auto"},{id:this._id+"_pageHeight",isSelect:"false"});it=t.buildTag("span.e-reportviewer-icon e-reportviewer-emptyconetent","",{"padding-right":"4px",cursor:"pointer"},{id:this._id+"pageheightSpan",fitType:"WHOLEPAGE"});r.append(it);r.append(f.toolbar.fittopage.pageHeight)}n.append(r)},_renderToolTipExport:function(){var n=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-icon e-reportviewer-exporttip","",{display:"none"},{id:this._id+"_toolbar_exportListTip"});return this._appendToolbarItems(n,"pdf"),this._appendToolbarItems(n,"xls"),this._appendToolbarItems(n,"word"),this._appendToolbarItems(n,"html"),this._appendToolbarItems(n,"ppt"),n},_renderPageFitPopup:function(){var n=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-icon e-reportviewer-fittopagetip","",{display:"none"},{id:this._id+"_toolbar_fittoPagePopup"});return this._appendToolbarItems(n,"fittopagewidth"),this._appendToolbarItems(n,"fittowholepage"),n},_renderFitopagePopup:function(){var r=n("#"+this._id+"_pageviewOuterline"),u=n("#"+this._id+"_viewerContainer"),t=n("#"+this._id+"_pageWidth"),i=n("#"+this._id+"_pageHeight"),f=u.width(),e=u.height(),o=r.width(),s=r.height();e>s&&i.attr("isSelect")=="false"?i.css("opacity","0.4"):i.css("opacity","1");f>o&&t.attr("isSelect")=="false"?t.css("opacity","0.4"):t.css("opacity","1")},_showPrintPageSetupButton:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-pagesetup").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-pagesetup").parent().css("display","none")},_renderPrintPageSetup:function(){var i=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],c=null,l=null,h=t.buildTag("div","",{display:"table"},{id:this._id+"_printPageSetup"}),gt=t.buildTag("div","",{display:"table-row"},{id:this._id+"_paperSetup"}),r=t.buildTag("table","",{},{"border-collapse":"collapse"}),ni=t.buildTag("div","",{},{id:this._id+"_defaultSetup",display:"table-row"}),o=n("#"+this._id+".e-reportviewer")[0].getBoundingClientRect(),ti=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),ii=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),u=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),ri=t.buildTag("td.e-reportviewer-pagesetupheader","",{"padding-top":"0px"},{colspan:"8"}),ui=t.buildTag("td.e-reportviewer-pagesetupcontent","",{},{colspan:"12"}),a,v,y,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,ct,lt,at,vt,yt,bt,kt,kr;gt.append(r);r.append(ti);r.append(ii);r.append(u);ti.append(ri);ii.append(ui);h.append(gt);h.append(ni);var fi=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),f=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),e=t.buildTag("tr.e-reportviewer-pagesetuptr","",{});r.append(fi);r.append(f);r.append(e);a=t.buildTag("td.e-reportviewer-pagesetupheader","",{},{colspan:"8"});fi.append(a);var ei=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),s=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),oi=t.buildTag("td.e-reportviewer-pagesetupheader","",{},{colspan:"8"});ei.append(oi);r.append(ei);r.append(s);this._browserInfo.name=="msie"&&this._browserInfo.version==8?(c=o.right,l=o.bottom):(c=o.width,l=o.height);h.ejDialog({width:400,position:{X:o.left+c/3+20,Y:(o.top+l/2)/2},enableModal:!1,title:i.toolbar.pagesetup.headerText,enableResize:!1,enablePersistance:!1,close:n.proxy(this._pageSettingClose,this)});v=t.buildTag("div","",{"font-weight":"bold",width:"100%"},{id:this._id+"_paperSizeLabel"});y=t.buildTag("div.e-reportviewer-ejdropdownlist","",{},{});v.append(i.pagesetupDialog.paperSize);ri.append(v);$paperSizeDDl=t.buildTag("select","",{},{id:this._id+"_PaperSize"});$paperSizeDDl.append('<option value="A3">A3<\/option>');$paperSizeDDl.append('<option value="A4">A4<\/option>');$paperSizeDDl.append('<option value="B4(JIS)">B4(JIS)<\/option>');$paperSizeDDl.append('<option value="B5(JIS)">B5(JIS)<\/option>');$paperSizeDDl.append('<option value="Envelope #10">Envelope #10<\/option>');$paperSizeDDl.append('<option value="Envelope Monarch">Envelope Monarch<\/option>');$paperSizeDDl.append('<option value="Executive">Executive<\/option>');$paperSizeDDl.append('<option value="Legal">Legal<\/option>');$paperSizeDDl.append('<option value="Letter">Letter<\/option>');$paperSizeDDl.append('<option value="Tabloid">Tabloid<\/option>');$paperSizeDDl.append('<option value="Custom">Custom<\/option>');y.append($paperSizeDDl);$paperSizeDDl.ejDropDownList({height:"32px",selectedIndex:10,watermarkText:"Select Option",change:n.proxy(this._setUpChange,this),enableIncrementalSearch:!0});ui.append(y);var si=t.buildTag("span","",{},{id:this._id+"_widthLabel"}),hi=t.buildTag("div","",{},{}),ci=t.buildTag("span","",{},{id:this._id+"_heightLabel"}),li=t.buildTag("div","",{},{}),p=t.buildTag("span","",{},{id:this._id+"_heightUnitLabel"}),w=t.buildTag("span","",{},{id:this._id+"_widthUnitLabel"}),ai=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperHeight"}),vi=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperWidth"});li.append(ai);hi.append(vi);ci.append(i.pagesetupDialog.height+" ");p.append(i.pagesetupDialog.unit+" ");si.append(i.pagesetupDialog.width+" ");w.append(i.pagesetupDialog.unit+" ");u.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));b=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});b.append(ci);u.append(b);k=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});k.append(li);u.append(k);d=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});d.append(p);u.append(d);u.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));g=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});g.append(si);u.append(g);nt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});nt.append(hi);u.append(nt);tt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});tt.append(w);u.append(tt);ai.ejNumericTextbox({decimalPlaces:2,enableStrictMode:!0,width:"75px",minValue:1,enable:!1});vi.ejNumericTextbox({decimalPlaces:2,enableStrictMode:!0,width:"75px",minValue:1,enable:!1});var yi=t.buildTag("div","",{"font-weight":"bold"},{id:this._id+"_marginheader"}),pi=t.buildTag("span","",{},{id:this._id+"_topLabel"}),wi=t.buildTag("div","",{},{}),bi=t.buildTag("span","",{},{id:this._id+"_topUnitLabel"}),ki=t.buildTag("span","",{},{id:this._id+"_rightLabel"}),di=t.buildTag("div","",{},{}),gi=t.buildTag("span","",{},{id:this._id+"_rightUnitLabel"}),nr=t.buildTag("div","",{},{id:this._id+"_bottomLabel"}),tr=t.buildTag("div","",{},{}),ir=t.buildTag("span","",{},{id:this._id+"_bottomUnitLabel"}),rr=t.buildTag("span","",{},{id:this._id+"_leftLabel"}),ur=t.buildTag("div","",{},{}),fr=t.buildTag("span","",{},{id:this._id+"_leftUnitLabel"});yi.append(i.pagesetupDialog.margins);a.append(yi);var er=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginTop"}),or=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginRight"}),sr=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginBottom"}),hr=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginLeft"});pi.append(i.pagesetupDialog.top+" ");bi.append(i.pagesetupDialog.unit+" ");wi.append(er);ki.append(i.pagesetupDialog.right+" ");gi.append(i.pagesetupDialog.unit+" ");di.append(or);nr.append(i.pagesetupDialog.bottom+" ");ir.append(i.pagesetupDialog.unit+" ");tr.append(sr);rr.append(i.pagesetupDialog.left+" ");fr.append(i.pagesetupDialog.unit+" ");ur.append(hr);f.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));it=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});it.append(pi);f.append(it);rt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});rt.append(wi);f.append(rt);ut=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"50px"});ut.append(bi);f.append(ut);f.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));ft=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});ft.append(ki);f.append(ft);et=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});et.append(di);f.append(et);ot=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});ot.append(gi);f.append(ot);e.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));st=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});st.append(nr);e.append(st);ht=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});ht.append(tr);e.append(ht);ct=t.buildTag("td .e-reportviewer-pagesetupcontent","",{width:"10px"});ct.append(ir);e.append(ct);e.append(t.buildTag("td .e-reportviewer-pagesetupcontent","",{width:"3px"}));lt=t.buildTag("td .e-reportviewer-pagesetupcontent","",{width:"15px"});lt.append(rr);e.append(lt);at=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});at.append(ur);e.append(at);vt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});vt.append(fr);e.append(vt);er.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});or.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});sr.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});hr.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});yt=t.buildTag("div","",{"font-weight":"bold"},{id:this._id+"_orientationLabel"});yt.append(i.pagesetupDialog.orientation);oi.append(yt);var pt=t.buildTag("div","",{float:"left"},{}),cr=t.buildTag("div","",{float:"left"},{}),lr=t.buildTag("div","",{float:"left"},{id:this._id+"_portraitLabel"}),ar=t.buildTag("input","",{},{type:"radio",id:this._id+"_portrait",value:"Portrait"});cr.append(ar);lr.append(" "+i.pagesetupDialog.portrait);pt.append(cr);pt.append(lr);ar.ejRadioButton({name:"orientation",checked:!0,size:"small"});var wt=t.buildTag("div","",{float:"left"},{}),vr=t.buildTag("div","",{float:"left"},{}),yr=t.buildTag("div","",{float:"left"},{id:this._id+"_landscapeLabel"}),pr=t.buildTag("input","",{},{type:"radio",id:this._id+"_landscape",value:"Landscape"});vr.append(pr);yr.append(" "+i.pagesetupDialog.landscape);wt.append(vr);wt.append(yr);s.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));bt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"90px"},{colspan:"3"});bt.append(pt);s.append(bt);s.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));kt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"90px"},{colspan:"3"});kt.append(wt);s.append(kt);pr.ejRadioButton({name:"orientation",size:"small"});var dt=t.buildTag("div","",{"padding-top":"10px",float:"right","padding-right":"13px","padding-bottom":"20px"},{}),wr=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"min-width":"65px"},{type:"button",value:i.pagesetupDialog.doneButton,id:this._id+"_Submit"}),br=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"margin-left":"6px","min-width":"65px"},{type:"button",value:i.pagesetupDialog.cancelButton,id:this._id+"_Cancel"});wr.ejButton({showRoundedCorner:!0,height:30,click:n.proxy(this._pageSetupSubmit,this)});br.ejButton({showRoundedCorner:!0,height:30,click:n.proxy(this._pageSetupCancel,this)});dt.append(wr);dt.append(br);ni.append(dt);$paperSizeDDl.data("ejDropDownList")&&(kr=h[0].clientWidth-n(p.parent())[0].clientWidth-n(w.parent())[0].clientWidth,$paperSizeDDl.data("ejDropDownList")._setModel({width:kr}));this._browserInfo.name=="msie"?n("#"+this._id+"_PaperSize_input").css("margin-top","-2px"):(this._browserInfo.name=="opera"||this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome"||this._browserInfo.name=="mozilla")&&n("#"+this._id+"_PaperSize_input").css("padding-bottom","3px")},_renderViewerBlockinDevice:function(n){var i=t.buildTag("div.e-reportviewer-viewer e-reportviewer-viewerblock e-reportviewer-blockstyle","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var r=t.buildTag("div.e-reportviewer-viewerblockcellcontent","",{margin:"1px",padding:"1px",width:"99%",height:"99%",display:"inline-table"}),e=t.buildTag("div.e-reportviewer-viewerblockcontent","",{width:"100%",height:"auto"}),u=t.buildTag("div.e-reportviewer-viewreport","",{width:"100%",height:"30px","border-left":"0px",padding:"10px 0"}),f=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{},{type:"button",value:t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale].viewButton:t.ReportViewer.Locale["en-us"].viewButton,id:this._id+"_viewReportClick","data-role":"none"});return u.append(f),r.append(e),r.append(u),f.ejButton({showRoundedCorner:!0}),i.append(r),i},_renderViewerBlockinWeb:function(n){var i=t.buildTag("div.e-reportviewer-viewer e-reportviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var f=t.buildTag("table.e-reportviewer-viewerblockcellcontent e-reportviewer-blockcontainer","",{margin:"1px",padding:"5px 5px 10px"}),r=t.buildTag("tr","",{width:"100%"}),o=t.buildTag("td.e-reportviewer-viewerblockcontent","",{}),e=t.buildTag("td.e-reportviewer-viewreport","",{}),u=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{},{type:"button",value:t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale].viewButton:t.ReportViewer.Locale["en-US"].viewButton,id:this._id+"_viewReportClick","data-role":"none"});return u.ejButton({height:32,cssClass:"e-accent"}),e.append(u),r.append(o),r.append(e),f.append(r),u.ejButton({showRoundedCorner:!0}),i.append(f),i},_renderViewerContainer:function(n){var i=t.buildTag("div","",{},{id:this._id+"_reportviewerContainer"}),v;n.append(i);var r=t.buildTag("div.e-reportviewer-viewer e-reportviewer-scrollcontainer e-reportviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),f=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),y=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),e=t.buildTag("div.e-reportviewer-pageviewcontainer","",{},{id:this._id+"_pageviewOuterContainer"}),o=t.buildTag("div.e-reportviewer-pageouterline","",{},{id:this._id+"_pageviewOuterline"}),u=t.buildTag("div.e-reportviewer-pageview","",{"background-color":"#FFFFFF"},{id:this._id+"_pageviewContainer"}),s=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewheaderContainer"}),p=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewbodyContainer"}),h=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewfooterContainer"}),c=t.buildTag("div.pageHeaderBorder","",{position:"relative","background-color":"#FFFFFF"}),l=t.buildTag("div.pageBodyBorder","",{position:"relative","background-color":"#FFFFFF"}),a=t.buildTag("div.pageFooterBorder","",{position:"relative","background-color":"#FFFFFF"});return this._printMode&&(s.css("overflow","hidden"),h.css("overflow","hidden")),c.append(s),l.append(p),a.append(h),u.append(c),u.append(l),u.append(a),f.append(y),r.append(f),o.append(u),e.append(o),r.append(e),this._isDevice?this._renderViewerBlockinDevice(r):(v=t.buildTag("div.e-reportviewer-documentmapcontainer","",{display:"none"},{id:this._id+"_documentmapContainer"}),i.append(v)),i.append(r),i},_renderViewer:function(){var e=this.element.height(),o=this.element.width(),n=t.buildTag("div.e-reportviewer-viewer","",{}),u,i,f,r;this.element[0].style.height||this.element[0].parentElement.clientHeight==0||(this._isHeight=!0);this.element[0].style.width||this.element[0].parentElement.clientWidth==0||(this._isWidth=!0);e===0&&this.element[0].parentElement.clientHeight!=0?this.element.height(this.element[0].parentElement.clientHeight):this._browserInfo.name=="msie"&&this._browserInfo.version==8&&this.element[0].style.height.indexOf("%")!=-1&&(u=parseInt(this.element[0].style.height),i=this.element[0].parentElement.clientHeight,i=i/100*u,this.element.height(i));o===0&&this.element[0].parentElement.clientWidth!=0?this.element.width(this.element[0].parentElement.clientWidth):this._browserInfo.name=="msie"&&this._browserInfo.version==8&&this.element[0].style.width.indexOf("%")!=-1&&(f=parseInt(this.element[0].style.width),r=this.element[0].parentElement.clientWidth,r=r/100*f,this.element.width(r));this.element.append(n);this._isDevice=this.model.renderMode&t.ReportViewer.RenderMode.Mobile&&this.model.renderMode&t.ReportViewer.RenderMode.Desktop?this._isMobileDevice():this.model.renderMode&t.ReportViewer.RenderMode.Mobile?!0:!1;this._renderToolBar(n);this._isDevice||(this._renderViewerBlockinWeb(n),this._renderToolTip());this._renderViewerContainer(n)},_renderCredentialBlock:function(i){for(var f,s,h,c,l,v,r=t.buildTag("table","",{},{}),e=0;e<i.length;e++){var u=i[e],o=t.buildTag("tr","",{},{}),a=t.buildTag("td","",{},{colspan:this._isDevice?"1":"5"});a.html(this._isDevice?"Specify the "+u.Name+":":u.Prompt);o.append(a);this._isDevice?(r.append(o),r.append('<tr height="4px"/>'),s=t.buildTag("tr","",{},{}),this._appendCredentialItems(s,"namelbl",u),h=t.buildTag("tr","",{},{}),this._appendCredentialItems(h,"nametxt",u),c=t.buildTag("tr","",{},{}),this._appendCredentialItems(c,"passwdlbl",u),l=t.buildTag("tr","",{},{}),this._appendCredentialItems(l,"passwdtxt",u),r.append(s),r.append(h),r.append(c),r.append(l),r.append('<tr height="6px"/>')):(f=t.buildTag("tr","",{},{}),this._appendCredentialItems(f,"namelbl",u),this._appendCredentialItems(f,"nametxt",u),f.append(t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{width:"7px"},{})),this._appendCredentialItems(f,"passwdlbl",u),this._appendCredentialItems(f,"passwdtxt",u),r.append(o),r.append('<tr height="6px"/>'),r.append(f),r.append('<tr height="6px"/>'))}this._wiredViewClickEvent(i);v=n("#"+this._id+"_viewBlockContainer").find(".e-reportviewer-viewerblockcontent");v.html(r)},_wiredViewClickEvent:function(t){this._on(n("#"+this._id+"_viewReportClick"),"click",{ds:t},this._viewReportCredentialClick)},_unwiredViewClickEvent:function(){this._off(n("#"+this._id+"_viewReportClick"),"click",this._viewReportCredentialClick)},_appendCredentialItems:function(n,i,r){var u,f,e;switch(i){case"namelbl":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});u.append("Login Name ");break;case"nametxt":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});f=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",autocomplete:"off",id:r.ControlId+"_loginName"});u.append(f);break;case"passwdlbl":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});u.append("Password ");break;case"passwdtxt":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});e=t.buildTag("input.e-reportviewer-textbox","",{},{type:"password",autocomplete:"off",id:r.ControlId+"_password"});u.append(e)}n.append(u)},_viewReportCredentialClick:function(t){for(var f=t.data.ds,i=[],r=0;r<f.length;r++){var u=f[r],e=n("#"+u.ControlId+"_loginName").val(),o=n("#"+u.ControlId+"_password").val();i.push({Name:u.Name,UserName:e,Password:o})}this._dataSources=i;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.validateDSCredential,datasoures:i}),"_validateDSCredential")},_renderParameterBlock:function(i){var u=t.buildTag("table","",{},{isViewClick:!1}),l,c,f,e,r,h,o,s,a;if(this._isDevice&&u.css("width","100%"),i!=null&&i.length>0){if(l=n("#"+this._id+"_viewBlockContainer").find(".e-reportviewer-viewerblockcontent"),c=this._onRenderingBegin({reportParameters:n.extend(!0,{},i),parameterBlock:n("#"+this._id+"_viewBlockContainer")}),!c)for(l.html(u),f=0;f<i.length;f++)e=i[f],this._isDevice?(u.append('<tr class="e-reportviewer-tr"/>'),r=t.buildTag("tr","",{},{}),u.append(r),o=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),o.append(e.Prompt+"  "),r.append(o),r=t.buildTag("tr","",{},{}),u.append(r),s=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{"min-width":"130px","max-width":"185px"},{}),r.append(s),h=t.buildTag("div","",{width:"100%",display:"flex","white-space":"nowrap"},{id:e.ControlId+"_div"}),s.append(h)):(f%2==0?(f!=0?u.append('<tr style="height: 15px;"/>'):u.append('<tr class="e-reportviewer-tr"/>'),r=t.buildTag("tr","",{},{}),u.append(r)):(a=t.buildTag("td","",{},{}),r.append(a)),o=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),o.append(e.Prompt+"  "),r.append(o),s=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{"min-width":"130px","max-width":"185px","padding-right":"20px"},{}),r.append(s),h=t.buildTag("div","",{width:"100%",display:"flex","white-space":"nowrap"},{id:e.ControlId+"_div"}),s.append(h)),this._renderParameterElements(e,h)}else this._showParameterBlock(!1);return u.append('<tr class="e-reportviewer-tr"/>'),this._onRenderingComplete({reportParameters:n.extend(!0,{},i)}),this._on(n("#"+this._id+"_viewReportClick"),"click",{params:i},this._viewReportParamsClick),c},_renderParameterElements:function(i,r){var e,f,o,h,s,ft,k,l,c,u,g,nt,tt,it,y,a,w,rt,b,ut,p;if(i.IsMultiValue){if(h=[],n("#"+i.ControlId+"_popup_wrapper").length>0&&n("#"+i.ControlId+"_popup_wrapper").remove(),s=t.buildTag("select","",{},{id:i.ControlId,name:i.Name,"sf-name":i.Name}),i.AvailableLabels){for(ft=n("<input id ="+i.ControlId+"_check type='checkbox'/>"),k=t.buildTag("div","",{"border-bottom":"1px solid #c8c8c8"}),k.append(ft),c=n.extend(i.DefaultValuesfields,!0),i.Values&&i.Values.length>0&&(c=i.Values),u=0;u<i.AvailableLabels.length;u++)o=n('<option value="'+i.AvailableValues[u]+'">'+i.AvailableLabels[u]+"<\/option>"),jQuery.inArray(i.AvailableValues[u],c)!=-1&&h.push(u),s.append(o);r.append(s);s.ejDropDownList({cssClass:"e-reportviewer-param",width:"100%",showCheckbox:!0,selectedIndices:h,watermarkText:"Select Option",change:i.IsDependent?this._paramsChangeEvent:"",popupHide:i.IsDependent?this._paramsChangeEvent:"",enableFilterSearch:this.model.enableDropDownSearch,headerTemplate:k[0].outerHTML});n("#"+i.ControlId+"_check").ejCheckBox({cssClass:"e-reportviewer-paramcheckbox",size:"small",text:"Select All",change:this._onCheckAll});l=n(n("#"+i.ControlId+"_check")).siblings(".e-text");l[0].className=l[0].className+" e-reportviewer-paramcheckbox";l.css("font-size","14px");l.css("width","69%");l.css("padding-left","15.5%")}else if(i.DefaultValues){for(o=n('<option value="parameter_SelectAll">Select All<\/option>"'),s.append(o),c=n.extend(i.DefaultValuesfields,!0),i.Values&&i.Values.length>0&&(c=i.Values),u=0;u<i.DefaultValues.length;u++)o=n('<option value="'+i.DefaultValues[u]+'">'+i.DefaultValues[u]+"<\/option>"),jQuery.inArray(i.DefaultValues[u],c)!=-1&&h.push(u+1),s.append(o);i.DefaultValues.length==h.length&&h.push(0);r.append(s);s.ejDropDownList({cssClass:"e-reportviewer-param",width:"100%",showCheckbox:!0,selectedIndices:h,watermarkText:"Select Option",change:i.IsDependent?this._paramsChangeEvent:"",popupHide:i.IsDependent?this._paramsChangeEvent:"",checkChange:this._selectionChanged,enableFilterSearch:this.model.enableDropDownSearch})}}else if(i.AvailableValues!=null){var d=t.buildTag("select","",{},{id:i.ControlId,name:i.Name,data:"select","sf-name":i.Name}),v=9999,et=!1;for(u=0;u<i.AvailableLabels.length;u++)i.AvailableLabels[u]!="Select a value"?(o=n('<option value="'+i.AvailableValues[u]+'">'+i.AvailableLabels[u]+"<\/option>"),i.AvailableLabels[u]==i.Label&&(v=u),d.append(o)):i.AvailableLabels[u]=="Select a value"&&(et=!0);et&&(v=v-1);r.append(d);g={cssClass:"e-reportviewer-param",width:"100%",watermarkText:"Select a Value",change:i.IsDependent?this._paramsChangeEvent:"",popupHide:i.IsDependent?this._paramsChangeEvent:"",enableIncrementalSearch:!0,enableFilterSearch:this.model.enableDropDownSearch};v!=9999&&(g.selectedIndex=v);d.ejDropDownList(g)}else i.DataType=="DateTime"?(nt=t.buildTag("input.e-reportviewer-textbox e-reportviewer-DateTime","",{},{type:"text",id:i.ControlId,maxlength:"256",name:i.Name}),r.append(nt),tt=i.Label.indexOf("-")?i.Label.replace(/\-/g,"/"):i.Label,nt.ejDatePicker({cssClass:"e-reportviewer-param",width:i.IsNullable?"75%":"100%",value:i.Label!=null&&i.Label.length>0?new Date(tt?tt:i.Label):null,change:i.IsDependent?this._paramsChangeEvent:"",locale:this.model.locale!=this._machineCulture?this._machineCulture:this.model.locale}),i.IsNullable&&(e=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),f=t.buildTag("input","",{},{type:"checkbox",name:"chkDateTime",id:i.ControlId+"~chk",value:this._id}),e.append(f),e.append(" <span class=e-reportviewer-label>Null<\/span>"),r.append(" "),r.append(e),i.Label!=null&&i.Label.length>0?f.ejCheckBox({change:this._paramNullChange}):(f.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkDateTime",!0)))):i.DataType=="Boolean"?(it=t.buildTag("table","",{},{}),y=t.buildTag("tr","",{},{}),it.append(y),a=!1,i.Label!=null&&i.Label.length>0&&i.Label.toLowerCase()=="true"&&(a=!0),w=t.buildTag("td","",{},{}),rt=t.buildTag("input","",{},{type:"radio",name:i.Name,id:i.ControlId+"_01"}),w.append(rt),w.append(" <span>True<\/span>"),rt.ejRadioButton({checked:a}),y.append(w),y.append("<td width=10px/>"),b=t.buildTag("td","",{},{}),ut=t.buildTag("input","",{},{type:"radio",name:i.Name,id:i.ControlId+"_02"}),b.append(ut),b.append(" <span>False<\/span>"),i.Label!=null&&i.Label.length>0&&(a=!a),ut.ejRadioButton({checked:a}),y.append(b),r.append(it),i.IsNullable&&(e=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),f=t.buildTag("input","",{},{type:"checkbox",name:"chkRadio",id:i.ControlId+"~chk",value:this._id}),e.append(f),e.append(" <span class=e-reportviewer-label>Null<\/span>"),r.append(" "),r.append(e),f.ejCheckBox({change:this._paramNullChange}),i.Label!=null&&i.Label.length>0?f.ejCheckBox({change:this._paramNullChange}):(f.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkRadio",!0)))):(p=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",autocomplete:"off",id:i.ControlId,maxlength:"256",name:i.Name,value:i.Label}),r.append(p),i.IsNullable?(p.css("width","75%"),e=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),f=t.buildTag("input","",{},{type:"checkbox",name:"chkTextbox",id:i.ControlId+"~chk",value:this._id}),e.append(f),e.append(" <span class=e-reportviewer-label>Null<\/span>"),r.append(" "),r.append(e),f.ejCheckBox({change:this._paramNullChange}),i.Label!=null&&i.Label.length>0?f.ejCheckBox({change:this._paramNullChange}):(f.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkTextbox",!0))):p.css("width","96%"),i.IsDependent&&this._on(p,"change",this._paramsChangeEvent))},_onCheckAll:function(t){var r=t.model.id.substring(0,t.model.id.indexOf("_check")),i=n("#"+r).ejDropDownList("instance");t.isChecked?i.checkAll():i.uncheckAll()},_selectionChanged:function(){var t=this._activeItem,n;if(this.selectedIndexValue==0&&this.selectedTextValue=="Select All")if(this.checkedStatus)for(n=1;n<this.listitems.length;n++)this._setModel({selectedIndex:n});else for(n=1;n<this.listitems.length;n++)this.unselectItemsByIndices(n);else this._selectedIndices.length==this.listitems.length-1&&(this.checkedStatus?this._setModel({selectedIndex:0}):this.unselectItemsByIndices(0));this._activeItem=t},_updateParamElements:function(t){var f=this._onRenderingBegin({reportParameters:n.extend(!0,{},t)}),r,i,u,e;if(!f)for(r=0;r<t.length;r++)i=t[r],u=n("#"+i.ControlId+"_div"),i.IsMultiValue||i.AvailableValues!=null||i.DataType=="Boolean"?(u.empty(),i.Labels=i.Values=null,this._renderParameterElements(i,u)):i.DataType=="DateTime"?(e=n("#"+i.ControlId).data("ejDatePicker"),e.setModel({value:i.Label})):n("#"+i.ControlId).val(i.Label);return this._onRenderingComplete({reportParameters:n.extend(!0,{},t)}),f},_paramsChangeEvent:function(t){var h=this._id.substr(0,this._id.lastIndexOf("Param")-1),e=n("#"+h).data("ejReportViewer"),r={Name:"",Labels:[],Values:[]},u=n("#"+this._id),f,o,s;if(r.Name=u.attr("name"),this.pluginName=="ejDropDownList"){if(r.Name==i&&(r.Name=u.attr("sf-name")),this.model.showCheckbox)for(f=0;f<this.model.selectedIndices.length;f++)r.Labels.push(this.selectOptionItems[this.model.selectedIndices[f]].text),r.Values.push(this.selectOptionItems[this.model.selectedIndices[f]].value);else r.Labels.push(this.selectOptionItems[this.model.selectedIndex].text),r.Values.push(this.selectOptionItems[this.model.selectedIndex].value);if(t.type!="popupHide")return}else this.pluginName=="ejDatePicker"?(o=u.data("ejDatePicker").getValue(),r.Labels.push(o),r.Values.push(o)):this.pluginName=="ejRadioButton"?(s=data("ejRadioButton").model.checked,r.Labels.push(s),r.Values.push(s)):(r.Labels.push(u.val()),r.Values.push(u.val()));e.doAjaxPost("POST",e._actionUrl,JSON.stringify({reportAction:e._reportAction.updateParameters,updateParam:r}),"_updateParameters")},_viewReportParamsClick:function(t){this._showloadingIndicator(!0);var r=t.data.params,i=this._getParameterJson(r,!0);i&&(this._viewReportEnableDisable(!0),this._refresh=!0,n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcontent table:first").attr("isviewclick","true"),this._onViewReportClick(i),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:i}),"_setParameters"))},_viewReportEnableDisable:function(t){n("#"+this._id+"_viewReportClick").attr("disabled",t)},_getDefaultParameters:function(n){for(var i,f,r=[],u=[],t=0;t<n.length;n++)if(n[t].DefaultValues){for(i=0;i<n[t].DefaultValues.length;i++)u.push(n[0].DefaultValues[i]),r.push(n[0].DefaultValues[i]);f=[{Name:n[t].Name,Values:r,Labels:u,Nullable:n[t].IsNullable}];this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:f}),"_setParameters")}},_getParameterJson:function(t,i){for(var a,v,h,c,o,w,y,k,l,d,b=[],p=0;p<t.length;p++){var r=t[p],u=[],f=[],s=!1,e;if(r.IsMultiValue)for(a=n("#"+r.ControlId).data("ejDropDownList"),v=a._selectedIndices,h=0;h<v.length;h++)f.push(a.selectOptionItems[v[h]].text),u.push(a.selectOptionItems[v[h]].value);else if(r.AvailableValues!=null)r.IsNullable&&(s=r.IsNullable),c=n("#"+r.ControlId).data("ejDropDownList").getSelectedValue(),o=n("#"+r.ControlId).data("ejDropDownList").getSelectedItem(),c=c==""?r.Value:c,o=o&&n(o).text()==""?r.Label:n(o).text(),f.push(o),u.push(c);else if(r.DataType=="DateTime")e=n("#"+r.ControlId+"_div").find(".e-chkbox-wrap").attr("aria-checked"),e=="true"?s=!0:(w=n("#"+r.ControlId).data("ejDatePicker").getValue(),f.push(w),u.push(w));else if(r.DataType=="Boolean")y=n("#"+r.ControlId+"_01").data("ejRadioButton"),k=n("#"+r.ControlId+"_02").data("ejRadioButton"),e=n("#"+r.ControlId+"_div").find(".e-chkbox-wrap").attr("aria-checked"),e=="true"?s=!0:(y.model.checked||k.model.checked)&&(f.push(y.model.checked),u.push(y.model.checked));else if(e=n("#"+r.ControlId+"_div").find(".e-chkbox-wrap").attr("aria-checked"),e=="true")s=!0;else{if(l=n("#"+r.ControlId).val(),i)if(r.DataType!="Float"||l.match("^[-+]?[0-9]+.[0-9]+$")){if(r.DataType=="Integer"&&!l.match("^[-+]?[0-9]+$"))return alert("Please give the integer data type input"),!1}else return alert("Please give the float data type input"),!1;f.push(l);u.push(l)}d={Name:r.Name,Values:u,Labels:f,Nullable:s};b.push(d)}return b},_paramNullChange:function(t){var i=t.model.id.split("~"),r=n("#"+t.model.value).data("ejReportViewer");r._paramElementDisable(i[0],t.model.name,t.isChecked)},_paramElementDisable:function(t,i,r){var u,f,e;i=="chkDateTime"?(u=n("#"+t).data("ejDatePicker"),r?u.disable():u.enable()):i=="chkTextbox"?r?(n("#"+t).attr("disabled","disabled"),n("#"+t).css("opacity","0.45")):(n("#"+t).removeAttr("disabled"),n("#"+t).css("opacity","1")):i=="chkRadio"&&(f=n("#"+t+"_01").data("ejRadioButton"),e=n("#"+t+"_02").data("ejRadioButton"),r?(f.disable(),e.disable()):(f.enable(),e.enable()))},_selectparamToolItem:function(t){if(!this.model.toolbarSettings.templateId){var i=n("#"+this._id+"_toolbarContainer").data("ejToolbar");t?i.selectItemByID(this._id+"_ejtb_parameter"):i.deselectItemByID(this._id+"_ejtb_parameter")}},_showParameterBlock:function(t){t?(n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display","block"),n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-parameter").parent().css("display","block")):(n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display","none"),n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-parameter").parent().css("display","none"));this._isDevice&&(this._showViewerBlock(t),this._showViewerPage(!t))},_toggleParameterBlock:function(){if(this._selectparamToolItem(!(n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display")=="block")),n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").toggle(),this._setContainerSize(),this._isDevice){var t=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display")=="block";this._showViewerBlock(t);this._showViewerPage(!t)}},_renderExceptionBlock:function(i){var r;this._resetExceptionBlock();n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display","none");r=t.buildTag("table.errmsg e-reportviewer-blockcontainer","",{});r[0].style.cssText="padding: 6px 0px 5px 20px !important";var u=t.buildTag("tr","",{},{}),f=t.buildTag("td","",{width:"100%"},{}),e=t.buildTag("td","",{width:"100%"},{}),o=t.buildTag("span.e-reportviewer-icon e-reportviewer-close","",{},{id:this._id+"_closebutton",title:"Close this message"});u.append(f);u.append(e);e.append(o);f.append("<span>Report Viewer encountered some issues loading this report. Please click <a id="+this._id+"_viewBlockContainer_errmsg href=javascript:void(0); >here<\/a> to see the error details<\/span>");r.append(u);n("#"+this._id+"_viewBlockContainer").append(r);this._on(n("#"+this._id+"_viewBlockContainer_errmsg"),"click",{err:i},this._errorPopupblock);this._on(n("#"+this._id+"_closebutton"),"click",this._closeException)},_closeException:function(){n("#"+this._id+"_viewBlockContainer table.errmsg").remove();this._setContainerSize()},_errorPopupblock:function(n){alert(n.data.err)},_resetExceptionBlock:function(){n("#"+this._id+"_viewBlockContainer table.errmsg").remove()},_renderExcpetion:function(n){this._showloadingIndicator(!1);this._renderExceptionBlock(n);this._showViewerBlock(!0)},_showExceptionResult:function(n,t){!n&&this.model.enableNotificationBar&&(this._isDevice?alert(t):(this._renderExceptionBlock(t),this._showViewerBlock(!0)))},_setContainerSize:function(){var f=n("#"+this._id).height(),i=0,t,r,u;this._isDevice||(t=n("#"+this._id+"_viewBlockContainer"),t.length>0&&t.css("display").toLowerCase()=="block"&&(i=n("#"+this._id+"_viewBlockContainer").height()));r=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();u=f-i-r-4;n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_setPageSize:function(t,i,r,u){var e=null,o=null,s=t+r+u+3,f;n("#"+this._id+"_pageviewContainer").css({width:i+"px",height:s+"px"});n("#"+this._id+"_pageviewheaderContainer").css({width:i+"px",height:r+"px"});n("#"+this._id+"_pageviewfooterContainer").css({width:i+"px",height:u+"px"});n("#"+this._id+"_pageviewbodyContainer").css({height:t+"px",width:i+"px"});f=n("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect();this._browserInfo.name=="msie"&&this._browserInfo.version==8?(e=f.right-f.left,o=f.bottom-f.top):(e=f.width,o=f.height);n("#"+this._id+"_pageviewOuterline").css({width:e+"px",height:o+"px"})},_renderPageModels:function(t){n("#"+this._id+"_pageviewheaderContainer").empty();n("#"+this._id+"_pageviewfooterContainer").empty();n("#"+this._id+"_pageviewbodyContainer").empty();t&&(t.ReportStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer"),t.ReportStyleModel,!1),t.HeaderStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer .pageHeaderBorder"),t.HeaderStyleModel,!1),t.FooterStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer .pageFooterBorder"),t.FooterStyleModel,!1),t.BodyStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer .pageBodyBorder"),t.BodyStyleModel,!1),t.HeaderModel&&t.HeaderModel.length>0&&(this._renderPageControls(t.HeaderModel,n("#"+this._id+"_pageviewheaderContainer"),!1,null),this._printMode&&n("#"+this._id+"_pageviewheaderContainer").css("overflow","hidden")),t.FooterModel&&t.FooterModel.length>0&&(this._renderPageControls(t.FooterModel,n("#"+this._id+"_pageviewfooterContainer"),!1,null),this._printMode&&n("#"+this._id+"_pageviewfooterContainer").css("overflow","hidden")),t.PageModel&&t.PageModel.length>0&&this._renderPageControls(t.PageModel,n("#"+this._id+"_pageviewbodyContainer"),!1,null));n(".txtToggle_"+this._id).length>0&&this._drillAction();n(".drillAction_"+this._id).length>0&&this._drillThroughAction();n(".txtSorting_"+this._id).length>0&&this._sortingAction();this._isDocumentMap&&!this._printMode&&(this._documentMapAction(),this._isDocumentMap=!1,this._pageDocMapFlag=!0);this._parentPageXY&&(n("#"+this._id+"_viewerContainer").animate({scrollTop:this._parentPageXY.y,scrollLeft:this._parentPageXY.x},1e3),this._parentPageXY=null);this.model.printMode?n("#"+this._id+"_pageviewContainer").css({"padding-left":this._pageModel.MarginLeft,"padding-top":this._pageModel.MarginTop,"padding-right":this._pageModel.MarginRight,"padding-bottom":this._pageModel.MarginBottom}):n("#"+this._id+"_pageviewContainer").css("padding","0px")},_applyPageStyle:function(n,t,i){var r=i?"PrintImage":"GetResource";t.BackgroundColor&&n.css("background-color",t.BackgroundColor);t.BackgroundSrc&&n.css("background-image","url("+this.model.reportServiceUrl+"/"+r+"/?key="+t.BackgroundSrc+"&resourcetype=sfimg&isPrint="+i+")");t.Border&&this._applyBorderStyle(t.Border,n)},_renderPageControls:function(n,i,r,u){var e=t.buildTag("div","",{},{}),o,f,s,h;for(i.html(e),o=0;o<n.length;o++)f=n[o],f.ItemType=="TextBoxModel"?(s=this._renderTextBoxControl(f,!1,null,r,u),e.append(s)):f.ItemType=="LineModel"?(h=this._renderLineControl(f,null,r,u),e.append(h)):f.ItemType=="ImageModel"?this._renderImageControl(f,!1,e,null,r,u):f.ItemType=="TablixModel"?this._renderTablixControl(f,!1,{},e,null,r,u):f.ItemType=="GaugeModel"?this._renderGaugeControl(f,!1,!1,{},e,null,r,u):f.ItemType=="RectangleModel"?this._renderRectangleControl(f,!1,e,null,r,u):f.ItemType=="ChartModel"?this._renderChartControl(f,!1,!1,{},e,null,r,u):f.ItemType=="MapModel"?this._renderMapControl(f,!1,e,null,r,u):f.ItemType=="SubReportModel"&&this._renderSubReportControl(f,!1,e,null,r,u)},_controlKeyGenerator:function(n,i,r,u){var f=t.isNullOrUndefined(i)?"":"^"+i;return r&&(f=f.length==0?"^"+u:f+"_"+u),n+f},_applyBorderStyle:function(n,t){n.Default&&(t.css("border-width",n.Default.Thickness+"px"),t.css("border-color",n.Default.BorderBrush),t.css("border-style",n.Default.BorderStyle));n.LeftBorder&&(t.css("border-left-width",n.LeftBorder.Thickness+"px"),t.css("border-left-color",n.LeftBorder.BorderBrush),t.css("border-left-style",n.LeftBorder.BorderStyle));n.RightBorder&&(t.css("border-right-width",n.RightBorder.Thickness+"px"),t.css("border-right-color",n.RightBorder.BorderBrush),t.css("border-right-style",n.RightBorder.BorderStyle));n.TopBorder&&(t.css("border-top-width",n.TopBorder.Thickness+"px"),t.css("border-top-color",n.TopBorder.BorderBrush),t.css("border-top-style",n.TopBorder.BorderStyle));n.BottomBorder&&(t.css("border-bottom-width",n.BottomBorder.Thickness+"px"),t.css("border-bottom-color",n.BottomBorder.BorderBrush),t.css("border-bottom-style",n.BottomBorder.BorderStyle))},_applyTextStyle:function(t,i,r,u,f){var v=0,y=0,p=0,w=0,o=0,s=0,h=0,c=0,b,l,e,a;if(t.Padding&&(t.Padding.Top&&(i.css("padding-top",t.Padding.Top),v=t.Padding.Top),t.Padding.Right&&(i.css("padding-right",t.Padding.Right),y=t.Padding.Right),t.Padding.Bottom&&(i.css("padding-bottom",t.Padding.Bottom),p=t.Padding.Bottom),t.Padding.Left&&(i.css("padding-left",t.Padding.Left),w=t.Padding.Left)),t.TextBoxBackgroundColor&&i.css("backgroundColor",t.TextBoxBackgroundColor),t.VerticalAlign&&t.VerticalAlign!="Default"&&i.css("vertical-align",t.VerticalAlign),t.Border&&(t.Border.Default&&(i.css({"border-width":t.Border.Default.Thickness+"px","border-color":t.Border.Default.BorderBrush,"border-style":t.Border.Default.BorderStyle}),o=s=h=c=t.Border.Default.Thickness),t.Border.LeftBorder&&(i.css({"border-left-width":t.Border.LeftBorder.Thickness+"px","border-left-color":t.Border.LeftBorder.BorderBrush,"border-left-style":t.Border.LeftBorder.BorderStyle}),c=t.Border.LeftBorder.Thickness),t.Border.RightBorder&&(i.css({"border-right-width":t.Border.RightBorder.Thickness+"px","border-right-color":t.Border.RightBorder.BorderBrush,"border-right-style":t.Border.RightBorder.BorderStyle}),s=t.Border.RightBorder.Thickness),t.Border.TopBorder&&(i.css({"border-top-width":t.Border.TopBorder.Thickness+"px","border-top-color":t.Border.TopBorder.BorderBrush,"border-top-style":t.Border.TopBorder.BorderStyle}),o=t.Border.TopBorder.Thickness),t.Border.BottomBorder&&(i.css({"border-bottom-width":t.Border.BottomBorder.Thickness+"px","border-bottom-color":t.Border.BottomBorder.BorderBrush,"border-bottom-style":t.Border.BottomBorder.BorderStyle}),h=t.Border.BottomBorder.Thickness)),b=i.get(0).tagName,b.toLowerCase()=="td"){var g=parseFloat(w,10)+parseFloat(y,10),nt=parseFloat(v,10)+parseFloat(p,10),tt=parseFloat(c,10)+parseFloat(s,10),it=parseFloat(o,10)+parseFloat(h,10),k=parseFloat(u,10)-(g+tt),d=parseFloat(t.CanGrow?t.Height:f,10)-(nt+it);if(i.css("width",k+"px"),i.css("height",d+"px"),!t.ToggleInfo){for(l=n(r).children(),e=0;e<l.length;e++)a=n(l[e]),a.hasClass("e-reportviewer-usersort")||a.width(k);n(r).height(d)}}},_renderTablixControl:function(i,r,u,f,e,o,s){var y=this,tt=i.Height,ot=i.Width,p=y._controlKeyGenerator(y._id+"_"+i.Name,e,o,s),b=t.buildTag("div","",{},{id:p,title:i.Tooltip}),w={},ct,lt,d,v,at,g,nt,c,it,rt,vt,l,ut,k,a,h,ft,st,ht,et;if(f.append(b),w.top=i.Top,w.left=i.Left,r?(tt=u.height,ct=parseFloat(b.css("border-left-width"),10)+parseFloat(b.css("border-right-width"),10),lt=parseFloat(b.css("border-top-width"),10)+parseFloat(b.css("border-bottom-width"),10),ot=ot-ct,tt=tt-lt,w.position="relative"):w.position="absolute",w.width=ot,w.height=tt,d=t.buildTag("table","",{"border-collapse":"collapse","font-size":"8pt"},{cellspacing:"0",cellpadding:"0"}),v={},b.append(d),i.BackgroundColor&&(v["background-color"]=i.BackgroundColor),i.StyleVal&&(i.StyleVal.Font&&(i.StyleVal.Font.FontFamily&&(v["font-family"]=i.StyleVal.Font.FontFamily),i.StyleVal.Font.FontSize&&(v["font-size"]=i.StyleVal.Font.FontSize),i.StyleVal.Font.FontStyle&&(v["font-style"]=i.StyleVal.Font.FontStyle),i.StyleVal.Font.FontWeight&&(v["font-weight"]=i.StyleVal.Font.FontWeight+" !important")),v.color=i.StyleVal.TextColor?i.StyleVal.TextColor:"black",i.StyleVal.TextDecoration&&(v["text-decoration"]=i.StyleVal.TextDecoration)),i.Padding&&(i.Padding.Left&&(v["padding-left"]=i.Padding.Left),i.Padding.Right&&(v["padding-right"]=i.Padding.Right),i.Padding.Top&&(v["padding-top"]=i.Padding.Top),i.Padding.Bottom&&(v["padding-bottom"]=i.Padding.Bottom)),i.TextAlign&&(v["text-align"]=i.TextAlign),i.VerticalAlign&&(v["vertical-align"]=i.VerticalAlign),at=o?"PrintImage":"GetResource",i.BackgroundImageSrc&&(v["background-image"]="url("+this.model.reportServiceUrl+"/"+at+"/?key="+i.BackgroundImageSrc+"&resourcetype=sfimg&isPrint="+o+")"),i.Border&&(g=i.Border.TopBorder,i.Border.TopBorder=null,this._applyBorderStyle(i.Border,d),g&&(w["border-top-width"]=g.Thickness+"px",w["border-top-color"]=g.BorderBrush,w["border-top-style"]=g.BorderStyle),i.Border.TopBorder=g),d.css(v),b.css(w),i.CellModels&&i.CellModels.length>0){for(nt=t.buildTag("tr","",{padding:"0px",margin:"0px",height:"0px",visibility:"collapse"},{}),i.Border&&(i.Border.TopBorder&&i.Border.TopBorder.BorderStyle!="None"||i.Border.Default&&i.Border.Default.BorderStyle!="None")&&nt.css("visibility","visible"),d.append(nt),it=null,rt=null,c=0;c<i.CellModels[0].length;c++)vt=t.buildTag("td","",{padding:"0px",margin:"0px",width:i.ColWidths[c]+"px"},{rowSpan:"1",colSpan:"1"}),nt.append(vt);for(l=0;l<i.CellModels.length;l++){for(ut=t.buildTag("tr","",{padding:"0px",margin:"0px","text-align":"left",height:i.RowHeights[l]+"px"},{vAlign:"top"}),d.append(ut),k=i.CellModels[l],c=0;c<k.length;c++)if(a=t.buildTag("td","",{padding:"0px",margin:"0px","text-align":"left",height:"100%"},{rowSpan:"1",colSpan:"1"}),ut.append(a),h=k[c].ItemModel,h){var yt=k[c].Border,pt=k[c].RowSpan,wt=k[c].ColSpan;h.Hidden||(yt&&y._applyBorderStyle(yt,a),h.ItemType=="TextBoxModel"?(ft=y._renderTextBoxControl(h,!0,p+"tablixRow"+l+"xCol"+c,o,s),ft.css("max-height","99.9% !important"),a.css("height",i.RowHeights[l]+"px"),y._applyTextStyle(h,a,ft,i.ColWidths[c],i.RowHeights[l]),a.append(ft)):h.ItemType=="LineModel"?(st=y._renderLineControl(h,p+"tablixRow"+l+"xCol"+c,o,s),st.css("position","relative"),a.append(st)):h.ItemType=="ImageModel"?y._renderImageControl(h,!0,a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="TablixModel"?y._renderTablixControl(h,!0,{height:i.RowHeights[l]},a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="GaugeModel"?y._renderGaugeControl(h,!1,!0,{height:i.RowHeights[l]},a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="RectangleModel"?y._renderRectangleControl(h,!0,a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="ChartModel"?this._renderChartControl(h,!1,!0,{height:i.RowHeights[l]},a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="MapModel"?this._renderMapControl(h,!1,a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="SubReportModel"&&y._renderSubReportControl(h,!0,a,p+"tablixRow"+l+"xCol"+c,o,s));pt>1&&a.attr("rowspan",pt);wt>1&&a.attr("colspan",wt)}else a.css("display","none");k[0].FixedData&&(it==null&&rt==null&&(ht=t.buildTag("div","",{top:i.Top,left:i.Left,position:"absolute"},{id:p+"_headertable"}),b.addClass("fixed-data"),f.append(ht),et=t.buildTag("table","",{"border-collapse":"collapse","font-size":"8pt"},{cellspacing:"0",cellpadding:"0"}),ht.append(et)),it=n(nt).clone(),rt=n(ut).clone(!0),et.append(it),et.append(rt))}}},_renderTextBoxControl:function(n,i,r,u,f){var nt=this._controlKeyGenerator(this._id+"_"+n.Name,r,u,f),l=t.buildTag("div","",{},{id:nt,title:n.ToolTip}),h={},g,y,p,k,d;if(i?i&&(h["word-wrap"]="break-word",h["white-space"]="pre-wrap"):(h.position="absolute",h.top=n.Top,h.left=n.Left,h.width=n.Width,h.height=n.Height,this._applyTextStyle(n,l,null,null,null)),n.CanGrow||(h.overflow="hidden"),g=u?"PrintImage":"GetResource",n.BackgroundSrc&&(h["background-image"]="url("+this.model.reportServiceUrl+"/"+g+"/?key="+n.BackgroundSrc+"&resourcetype=sfimg&isPrint="+u+")"),n.ToggleInfo&&!this._printMode){var tt=n.IsToggle?"e-reportviewer-collapsetoggle":"e-reportviewer-expandtoggle",w=t.buildTag("div."+tt+" txtToggle_"+this._id,"",{display:"block",width:"14px",height:"14px","margin-Top":"1px"},{}),v={};this._browserInfo.name=="msie"?(v["margin-right"]="1px",v.float="left"):(this._browserInfo.name=="opera"||this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome"||this._browserInfo.name=="mozilla"||this._browserInfo.name=="edge")&&(v.display="table",v["margin-right"]="2px",v.float="left");w.data("drillObj",n.ToggleInfo);w.css(v);l.append(w);h.display=this._browserInfo.name=="msie"?"inline-block":"flex";h["word-wrap"]="inherit";h["white-space"]="inherit"}if(n.WritingMode!="Default"&&n.WritingMode=="Vertical"&&(this._browserInfo.name=="msie"?h["writing-mode"]="tb-rl":h.transform="rotate(90deg)"),n.ActionInfo&&(l.data("actionObj",n.ActionInfo),l.addClass("drillAction_"+this._id+" e-reportviewer-drillhover")),n.Paragraphval)for(y=0;y<n.Paragraphval.length;y++){var b=t.buildTag("div.e-reportviewer-paragrap","",{}),o={},e=n.Paragraphval[y];for(p=0;p<e.Runs.length;p++){var s=e.Runs[p],a=t.buildTag("span","",{}),c={};c["white-space"]=n.ToggleInfo&&!u?"inherit":"pre-wrap";s.ActionInfo&&(a.data("actionObj",s.ActionInfo),a.addClass("drillAction_"+this._id+" e-reportviewer-drillhover"));s.Style.Font.FontFamily&&(c["font-family"]=s.Style.Font.FontFamily);s.Style.Font.FontSize&&(c["font-size"]=s.Style.Font.FontSize);s.Style.Font.FontStyle&&(c["font-style"]=s.Style.Font.FontStyle);s.Style.Font.FontWeight&&(c["font-weight"]=s.Style.Font.FontWeight);c.color=s.Style.TextColor?s.Style.TextColor:"black";s.Style.TextDecoration&&(c["text-decoration"]=s.Style.TextDecoration);s.RunText&&(s.IsHtmlText?a.append(s.RunText):a.text(s.RunText).text());s.IsHtmlText&&s.RunText!=null&&s.RunText.indexOf("<p>")>-1&&(a.find("p:first").css("padding-top","12px"),a.find("p").css({"padding-bottom":"12px",margin:"0px"}));this._browserInfo.name=="mozilla"&&s.Style!=null&&s.Style.Font!=null&&s.Style.Font.FontSize!=null&&(c["line-height"]=s.Style.Font.FontSize*1.17+"px");a.css(c);b.append(a)}i||(o["word-wrap"]="break-word");e.TextAlignment&&(o["text-align"]=e.TextAlignment);n.Direction!="Default"&&n.Direction!="LTR"&&(o["text-align"]="right");n.VerticalAlign!="Default"&&n.CanGrow&&(o["vertical-align"]=n.VerticalAlign);e.LeftIndent&&(o["padding-left"]=e.LeftIndent);e.RightIndent&&(e.TextAlignment=="Right"?(o["padding-right"]=e.RightIndent,o.float="right"):o["padding-right"]=e.RightIndent);e.SpaceBefore&&(o["padding-top"]=e.SpaceBefore);e.SpaceAfter&&(o["padding-bottom"]=e.SpaceAfter);e.LineHeight&&(o["line-height"]=e.LineHeight+"px");e.ListStyle&&(o["list-style-type"]=e.ListStyle);e.HangingIndent&&(o["text-indent"]=e.HangingIndent);i&&(o["min-width"]="99.9%");e.ListLevel&&e.ListLevel!=0&&n.Direction!="RTL"?o["margin-left"]=e.ListLevel*"30":e.ListLevel!=0&&n.Direction=="RTL"&&(o["margin-Right"]=e.ListLevel*"30",o.direction="rtl");e.ListStyle=="Numbered"&&e.ListLevel>=1?e.ListLevel==1||e.ListLevel==4||e.ListLevel==7?(o.display="list-item",o["list-style-type"]="decimal"):e.ListLevel==2||e.ListLevel==5||e.ListLevel==8?(o.display="list-item",o["list-style-type"]="lower-roman"):(e.ListLevel==3||e.ListLevel==6||e.ListLevel==9)&&(o.display="list-item",o["list-style-type"]="lower-alpha"):e.ListStyle=="Bulleted"&&e.ListLevel>=1&&(o.display="list-item",o["list-style-type"]=e.ListStyle);b.css(o);l.append(b)}return n.Sorting&&(k="sortingUpDown",k=n.Sorting.Sorting=="UpDown"?"sortingUpDown":n.Sorting.Sorting=="Up"?"sortingUp":"sortingDown",d=t.buildTag("div.e-reportviewer-"+k+" txtSorting_"+this._id+" e-reportviewer-usersort","",{display:"block",width:"14px",height:"14px","padding-right":"1px","margin-Top":"1px",float:"right","vertical-align":"middle",position:"absolute",left:n.Width-14<0?"80%":n.Width-14+"px",top:"10%"},{}),d.data("sortingObj",n.Sorting),l.append(d),h.position="relative"),l.css(h),l},_renderChartControl:function(i,r,u,f,e,o,s,h){var wt,d,bt,kt,dt,ut,v,tt,c,vt,st,g,it,ht,ft,k,p,et,y,b,w,ct,yt,lt,pt,nt;if(i.ChartAreas){var rt=i.Height,ot=i.Width,at="chartCtrl";for(r&&(this._id=o,i.Top=0,i.Left=0),wt=this._controlKeyGenerator(this._id+"_"+i.Name,o,s,h),d=t.buildTag("div","",{},{id:wt,title:i.ToolTip}),e.append(d),d.css("position","absolute"),i.ChartStyle&&(i.ChartStyle.Border&&this._applyBorderStyle(i.ChartStyle.Border,d),i.ChartStyle.FillStyle&&(d.css("background-color",i.ChartStyle.FillStyle.BackgroundColor),this._applyBackgroundGradientStyle(i.ChartStyle.FillStyle,d)),st=s?"PrintImage":"GetResource",i.BackgroundImge&&d.css({"background-image":"url("+this.model.reportServiceUrl+"/"+st+"/?key="+i.BackgroundImge+"&resourcetype=sfimg&isPrint="+s+")","background-size":"100% 100%"})),u&&(at=o,rt=f.height,bt=parseFloat(d.css("border-left-width"),10)+parseFloat(d.css("border-right-width"),10),kt=parseFloat(d.css("border-top-width"),10)+parseFloat(d.css("border-bottom-width"),10),ot=ot-bt,rt=rt-kt,d.css("position","relative")),dt=rt/i.ChartAreas.length,i.Top&&d.css("top",i.Top),i.Left&&d.css("left",i.Left),ot&&d.css("width",ot),rt&&d.css("height",rt),ut=0;ut<i.ChartAreas.length;ut++){for(v=i.ChartAreas[ut],tt=null,tt=s?t.buildTag("div","",{},{id:at+"_"+this._id+"_"+i.Name+"_"+v.Name+"_"+h,title:i.ToolTip}):t.buildTag("div","",{},{id:at+"_"+this._id+"_"+i.Name+"_"+v.Name,title:i.ToolTip}),d.append(tt),tt.css("height",dt),tt.ejChart(),c=tt.data("ejChart"),vt=c.model.series[0],c.model.series.pop(vt),c.model.chartClick=this._onReporClick,v.Style&&(v.Style.FillStyle&&v.Style.FillStyle.BackgroundColor!="#00ffffff"&&(c.model.chartArea.background=v.Style.FillStyle.BackgroundColor),st=s?"PrintImage":"GetResource",v.BackgroundImg&&(c.model.backGroundImageUrl=this.model.reportServiceUrl+"/"+st+"/?key="+v.BackgroundImg+"&resourcetype=sfimg&isPrint="+s),v.Style.Border&&v.Style.Border.Default?(v.Style.Border.Default.BorderBrush&&(c.model.chartArea.border.color=v.Style.Border.Default.BorderBrush),v.Style.Border.Default.BorderStyle=="Default"||v.Style.Border.Default.BorderStyle=="None"?(c.model.chartArea.border.width=0,c.model.chartArea.border.opacity=0):c.model.chartArea.border.width=v.Style.Border.Default.Thickness):(c.model.chartArea.border.opacity=1,c.model.chartArea.border.color="Transparent")),ut==0&&i.ChartTiles.length>0&&(g=i.ChartTiles[ut],g.Caption&&g.Visible&&(c.model.title.text=g.Caption,g.Style&&(g.Style.Color&&(c.model.title.font.color=g.Style.Color),g.Style.Font&&(g.Style.Font.FontFamily&&(c.model.title.font.fontFamily=g.Style.Font.FontFamily),g.Style.Font.FontStyle&&(c.model.title.font.fontStyle=g.Style.Font.FontStyle),g.Style.Font.FontWeight&&(c.model.title.font.fontWeight=g.Style.Font.FontWeight),g.Style.Font.FontSize!=0&&(c.model.title.font.size=g.Style.Font.FontSize+"px"))))),it=0;it<v.ChartSeries.length;it++){var a=v.ChartSeries[it],l=n.extend(!0,{},vt),gt=l.points[0];for(l.points=[],l.type=a.Type,l.name=a.Legend&&a.Legend.LegendText?a.Legend.LegendText:a.Label,l.name=l.name==""&&a.Name=="EmptySeriesName"?a.Name:l.name,a.Type=="explodedpie"?(l.type="pie",l.explodeAll=!0,l.explodeOffset=8):a.Type=="explodeddoughnut"&&(l.type="doughnut",l.explodeAll=!0,l.explodeOffset=10),l.isStacking=a.Type=="stackingcolumn"?!0:!1,l.isStacking&&(c.model.legendBoundsCalculate=this._legendOrder),ht=[],ft=0;ft<a.PointValues.length;ft++){if(k=n.extend(!0,{},gt),p=a.PointValues[ft],k.YValues=[],k.X=p.X?k.x=p.X:k.x=0,p.Y?(k.Y=k.y=p.Y,k.YValues.push(k.Y)):(k.Y=k.y=0,k.YValues.push(k.Y)),p.Low&&k.YValues.push(p.Low),p.High&&k.YValues.push(p.High),p.Start&&k.YValues.push(p.Start),p.End&&k.YValues.push(p.End),a.Type=="bubble"&&(k.size=.5),p.ChartDataLabel&&(k.text=p.ChartDataLabel.Label),p.ActionInfo&&ht.push(p.ActionInfo),i.ColorPalette=="Custom")for(c.model.colors=[],et=0;et<i.CustomPaletteColors.length;et++)c.model.colors[et]=i.CustomPaletteColors[et];else!a.Type=="doughnut"||!a.Type=="pie"?c.model.colors=[]:p.Style&&p.Style.Color&&(c.model.colors[ft]=p.Style.Color);p.Style&&p.Style.Color&&(k.fill=p.Style.Color,l.fill=p.Style.Color);i.CustomPaletteColors&&i.ColorPalette&&i.ColorPalette=="Custom"?l.fill=i.CustomPaletteColors[it]:p.Style!=null&&p.Style.Color==null&&(l.fill=c.model.colors[it]);l.points.push(k)}ht.length>0&&(c.model.pointRegionClick=this._drillThroughClick,c.ejreportid=this._id,tt.data(c._id+"actionObj_Series"+it,ht),c.model.pointRegionMouseMove=function(i){if(t.isNullOrUndefined(n("#"+this._id).data(this._id+"actionObj_Series"+i.data.region.SeriesIndex)))return!1;n("#"+this._id+"_svg_Series"+i.data.region.SeriesIndex+"_Point"+i.data.region.Region.PointIndex).css("cursor","pointer")});l.visibility=a.Visibility?"visible":"hide";l.tooltip.format=" x: #point.x#<br/>y: #point.y#";l.tooltip.visible=!0;l.enableAnimation=!1;a.Style&&a.Style.Border&&a.Style.Border.Default&&(a.Style.Border.Default.BorderBrush&&(l.border.color=a.Style.Border.Default.BorderBrush),a.Style.Border.Default.Thickness!=0&&(l.border.width=a.Style.Border.Default.Thickness),a.Style.Border.Default.BorderStyle=="Dashed"?l.border.dashArray="2,4":a.Style.Border.Default.BorderStyle=="Dotted"&&(l.border.dashArray="2,2"));a.DataPointsStyle&&a.DataPointsStyle.length>0&&(a.Type=="scatter"?(y=a.DataPointsStyle[0],l.marker.shape=y.ChartMarker&&y.ChartMarker.MarkerType?y.ChartMarker.MarkerType:"Circle",y.ChartMarker.Color&&(l.marker.fill=y.ChartMarker.Color),y.ChartMarker.BorderColor&&(l.marker.border.color=y.ChartMarker.BorderColor),y.ChartMarker.Borderwidth&&(l.marker.border.width=y.ChartMarker.Borderwidth==0?2:y.ChartMarker.Borderwidth),l.marker.size.height=y.ChartMarker.Size?l.marker.size.width=parseInt(y.ChartMarker.Size==0||y.ChartMarker.Size<6)?6:y.ChartMarker.Size:l.marker.size.width=10,l.marker.visible=!0):(y=a.DataPointsStyle[0],y.ChartMarker&&(y.ChartMarker.MarkerType&&(l.marker.shape=y.ChartMarker.MarkerType),y.ChartMarker.Color&&(l.marker.fill=y.ChartMarker.Color),y.ChartMarker.BorderColor&&(l.marker.border.color=y.ChartMarker.BorderColor),y.ChartMarker.Borderwidth&&(l.marker.border.width=y.ChartMarker.Borderwidth==0?2:y.ChartMarker.Borderwidth),y.ChartMarker.Size&&(l.marker.size.height=l.marker.size.width=parseInt(y.ChartMarker.Size==0||y.ChartMarker.Size<6)?6:y.ChartMarker.Size)),l.marker.visible=a.Visibility&&y.ChartMarker&&y.ChartMarker.MarkerType?!0:!1,a.PointValues.length>0&&a.PointValues[0].ChartDataLabel&&(l.marker.dataLabel.visible=!1,b=a.PointValues[0].ChartDataLabel,l.marker.dataLabel.visible=b.Visible,b.Visible&&(l.marker.dataLabel.connectorLine.type="line",l.marker.dataLabel.connectorLine.width=.5,l.marker.dataLabel.textPosition=l.isStacking?b.Position&&b.Position=="Default"?"middle":b.Position:b.Position&&b.Position=="Default"?"top":b.Position,l.marker.dataLabel.font.color=b.TextColor?b.TextColor:"Black",b.Font&&(l.marker.dataLabel.font.fontFamily=b.Font.FontFamily,l.marker.dataLabel.font.fontStyle=b.Font.FontStyle,l.marker.dataLabel.font.fontWeight=b.Font.FontWeight,l.marker.dataLabel.font.size=b.Font.FontSize+"px"),b.BorderStyle&&b.BorderStyle!="None"&&(l.marker.dataLabel.border.color=b.BorderColor,l.marker.dataLabel.border.width=b.BorderWidth,l.marker.dataLabel.shape="Rectangle"),b.BackGroundColor&&b.BackGroundColor!="Transparent"&&(l.marker.dataLabel.fill=b.BackGroundColor,l.marker.dataLabel.shape="Rectangle")))));c.model.series.push(l)}if(i.ChartLegends&&i.ChartLegends.length>0?(w=i.ChartLegends[0],c.model.legend.visible=w.Visibilty,w.Alignment&&(c.model.legend.alignment=w.Alignment),w.Position&&(c.model.legend.position=w.Position),w.Style&&(w.Style.Color&&(c.model.legend.font.color=w.Style.Color),w.Style.Font&&(w.Style.Font.FontFamily&&(c.model.legend.font.fontFamily=w.Style.Font.FontFamily),w.Style.Font.FontStyle&&(c.model.legend.font.fontStyle=w.Style.Font.FontStyle),w.Style.Font.FontWeight&&(c.model.legend.font.fontWeight=w.Style.Font.FontWeight),w.Style.Font.FontSize!=0&&(c.model.legend.font.size=w.Style.Font.FontSize+"px")),w.Style.Border&&w.Style.Border.Default&&(w.Style.Border.Default.BorderBrush&&(c.model.legend.border.color=w.Style.Border.Default.BorderStyle=="Default"?"transparent":w.Style.Border.Default.BorderBrush),w.Style.Border.Default.Thickness!=0&&(c.model.legend.border.width=w.Style.Border.Default.Thickness)))):c.model.legend.visible=!1,c.model.series.length>0&&c.model.series[0].type!="polar"&&c.model.series[0].type!="radar"){for(ct=0;ct<v.ChartAreaXAxis.length;ct++)yt=v.ChartAreaXAxis[ct],yt.Name.toString().toLowerCase()=="primary"&&this._applyAxis(yt,c.model.primaryXAxis,i.IsLabelIndex,"XAxis","primary",c.model.series[0].type,v.Chart3D?v.Chart3D.Enabled:null);for(lt=0;lt<v.ChartAreaYAxis.length;lt++)pt=v.ChartAreaYAxis[lt],pt.Name.toString().toLowerCase()=="primary"&&this._applyAxis(pt,c.model.primaryYAxis,i.IsLabelIndex,"YAxis","primary",c.model.series[0].type,v.Chart3D?v.Chart3D.Enabled:null)}v.Chart3D&&v.Chart3D.Enabled&&(c.model.enable3D=v.Chart3D.Enabled,c.model.depth=v.Chart3D.DepthRatio,c.model.wallSize=v.Chart3D.WallThickness,c.model.tilt=0,c.model.rotation=20,c.model.perspectiveAngle=v.Chart3D.Perspective==0?90:v.Chart3D.Perspective,c.model.crosshair.visible=!0);a&&a.PointValues.length<=0&&(c.model.legend.visible=!1,c.model.primaryXAxis.visible=!1,c.model.primaryYAxis.visible=!1,c.model.series=[],c.model.chartArea.visible=!1,nt=i.ChartNoDataMessage,c.model.title.text==""&&(c.model.title.text=" "),nt.Caption&&nt.Visible&&(c.model.title.subTitle.textAlignment="center",c.model.title.subTitle.text=nt.Caption,nt.Style&&(nt.Style.Color&&(c.model.title.subTitle.font.color=nt.Style.Color),nt.Style.Font&&(nt.Style.Font.FontFamily&&(c.model.title.subTitle.font.fontFamily=nt.Style.Font.FontFamily),nt.Style.Font.FontStyle&&(c.model.title.subTitle.font.fontStyle=nt.Style.Font.FontStyle),nt.Style.Font.FontWeight&&(c.model.title.subTitle.font.fontWeight=nt.Style.Font.FontWeight),nt.Style.Font.FontSize!=0&&(c.model.title.subTitle.font.size=nt.Style.Font.FontSize+"px")))));c.redraw()}}},_legendOrder:function(n){n.model.legendCollection.reverse()},_chartAreaDisplayText:function(n){n.data.text=="0"&&(n.data.text="")},_applyBackgroundGradientStyle:function(n,t){var i;switch(n.BackgroundGradientType){case"LeftRight":i="to right";t.css("background","linear-gradient("+i+","+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"TopBottom":t.css("background","linear-gradient("+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"Center":t.css("background","radial-gradient("+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"DiagonalLeft":i="to bottom right";t.css("background","linear-gradient("+i+","+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"DiagonalRight":i="to bottom left";t.css("background","linear-gradient("+i+","+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"HorizontalCenter":t.css("background","linear-gradient("+n.BackgroundColor+","+n.BackgroundGradientEndcolor+", "+n.BackgroundColor+")");break;case"VerticalCenter":t.css("background","linear-gradient(90deg,"+n.BackgroundColor+","+n.BackgroundGradientEndcolor+", "+n.BackgroundColor+")")}},_applyAxis:function(t,i,r,u,f,e,o){var l,s,c,h;if(e=="pie"||o||(i.labelPlacement="onticks"),u=="XAxis"&&t.Labels&&t.Labels.length>0)for(i.crosshairLabel.visible=!0,i.valueType="category",i.isIndexed=r,i.labelBorder.width=1,i.labelBorder.color="grey",l=i.multiLevelLabels[0],i.multiLevelLabels.pop(l),s=0;s<t.Labels.length;s++)for(c=0;c<t.Labels[s].Categories.length;c++)h=n.extend(!0,{},l),h.visible=!0,h.text=t.Labels[s].Categories[c].Text,h.start=t.Labels[s].Categories[c].Start,h.end=t.Labels[s].Categories[c].End,h.level=t.Labels[s].Index,i.multiLevelLabels.push(h);t.ChartAxisTitle&&(t.ChartAxisTitle.Caption&&(i.title.text=t.ChartAxisTitle.Caption),t.ChartAxisTitle.TextColor&&(i.title.font.color=t.ChartAxisTitle.TextColor),t.ChartAxisTitle.Font&&(t.ChartAxisTitle.Font.FontSize&&(i.title.font.size=t.ChartAxisTitle.Font.FontSize),t.ChartAxisTitle.Font.FontFamily&&(i.title.font.fontFamily=t.ChartAxisTitle.Font.FontFamily),t.ChartAxisTitle.Font.FontStyle&&(i.title.font.fontStyle=t.ChartAxisTitle.Font.FontStyle)));t.Maximum!=null&&t.Maximum!="NaN"&&t.Maximum!=0&&t.Minimum!=null&&t.Minimum!="NaN"&&(i.setRange=!0,i.range.min=t.Minimum,i.range.max=t.Maximum);t.Interval!="NaN";t.IntervalType;i.font.color=t.LabelColor?t.LabelColor:"Black";i.labelFormat=t.LabelFormat;t.LabelFont&&(i.font.fontFamily=t.LabelFont.FontFamily,i.font.size=t.LabelFont.FontSize,i.font.fontStyle=t.LabelFont.FontStyle=="Default"?"Normal":t.LabelFont.FontStyle,i.font.fontWeight=t.LabelFont.FontWeight);t.ChartMajorGridLines&&this._applyGridLines(t.ChartMajorGridLines,i.majorGridLines);t.ChartMinorGridLines&&this._applyGridLines(t.ChartMinorGridLines,i.minorGridLines);t.ChartMajorTickMarks&&this._applyTickMarks(t.ChartMajorTickMarks,i.majorTickLines);t.ChartMinorTickMarks&&this._applyTickMarks(t.ChartMinorTickMarks,i.minorTickLines);i.minorTicksPerInterval==null&&(i.minorTicksPerInterval=1);t.Labels!=null&&t.Labels.length>0?i.labelIntersectAction="trim":t.LabelsAutoFitEnabled?i.labelIntersectAction=t.PrExventWordWrap&&t.PrExventLabelOffset?t.AllowLabelRotation!="none"?t.AllowLabelRotation:"trim":t.PrExventLabelOffset?"wrapByWord":"multipleRows":t.Angle?i.labelRotation=t.Angle:i.labelIntersectAction="wrap";t.LineColor&&(i.axisLine.color=t.LineColor);t.LineWidth&&(i.axisLine.width=t.LineWidth);t.HideEndLabels&&(i.edgeLabelPlacement="hide");t.VisibleStatus=="True"||f=="primary"&&t.VisibleStatus=="Auto"?(i.visible=!0,i.axisLine.visible=!0):(i.visible=!1,i.axisLine.visible=!1);i.rangePadding="none"},_applyGridLines:function(n,t){t.visible=n.Enabled;n.Enabled&&n.Style&&n.Style.Default&&(n.Style.Default.BorderBrush&&(t.color=n.Style.Default.BorderBrush),t.width=n.Style.Default.BorderStyle=="None"?t.width:n.Style.Default.Thickness,n.Style.Default.BorderStyle=="Dashed"?t.dashArray="2,4":n.Style.Default.BorderStyle=="Dotted"&&(t.dashArray="2,2"))},_applyTickMarks:function(n,t){t.visible=n.Enabled;n.Style&&n.Style.Default&&(n.Style.Default.BorderBrush&&(t.color=n.Style.Default.BorderBrush),n.Style.Default.Thickness&&(t.width=n.Style.Default.Thickness));n.Length&&(t.size=n.Length)},_renderImageControl:function(n,i,r,u,f,e){var c=this._controlKeyGenerator(this._id+"_"+n.Name,u,f,e),s=t.buildTag("div","",{},{id:c,title:n.ToolTip}),o={},h;r.append(s);o.position=i&&n.IsTablixChild?"relative":"absolute";o.top=n.Top;o.left=n.Left;o.width=n.Width;o.height=n.Height;o.overflow="hidden";o["padding-left"]=n.PaddingLeft;o["padding-right"]=n.PaddingRight;o["padding-top"]=n.PaddingTop;o["padding-bottom"]=n.PaddingBottom;n.ActionInfo&&(s.data("actionObj",n.ActionInfo),s.addClass("drillAction_"+this._id+" e-reportviewer-drillhover"));n.Border&&!n.IsTablixChild&&this._applyBorderStyle(n.Border,s);h=t.buildTag("img","",{width:n.ImageWidth,height:n.ImageHeight},{src:f?"":this.model.reportServiceUrl+"/GetResource/?key="+n.ImageUrl+"&resourcetype=sfimg&isPrint="+f,imgUrl:this.model.reportServiceUrl+"/GetResource/?key="+n.ImageUrl+"&resourcetype=sfimg&isPrint="+f});s.append(h);s.css(o)},_renderRectangleControl:function(n,i,r,u,f,e){var h=this._controlKeyGenerator(this._id+"_"+n.Name,u,f,e),s=t.buildTag("div","",{},{id:h,title:n.ToolTip}),c={},a,l,o,v,y;if(r.append(s),c.position=i?"relative":"absolute",c.top=n.Top,c.left=n.Left,c.width=n.Width,c.height=n.Height,c["background-color"]=n.BackgroundColor,a=f?"PrintImage":"GetResource",n.BackgroundImageSrc&&(c["background-image"]="url("+this.model.reportServiceUrl+"/"+a+"/?key="+n.BackgroundImageSrc+"&resourcetype=sfimg&isPrint="+f+")"),n.Border&&!i&&this._applyBorderStyle(n.Border,s),n.IsTablixChild&&n.ReportModels&&n.ReportModels.length>0)for(l=0;l<n.ReportModels.length;l++)o=n.ReportModels[l],o&&(o.ItemType=="TextBoxModel"?(v=this._renderTextBoxControl(o,!1,h+"_"+o.Name,f,e),s.append(v)):o.ItemType=="LineModel"?(y=this._renderLineControl(o,h+"_"+o.Name,f,e),s.append(y)):o.ItemType=="ImageModel"?this._renderImageControl(o,!1,s,h+"_"+o.Name,f,e):o.ItemType=="TablixModel"?this._renderTablixControl(o,!1,{},s,h+"_"+o.Name,e):o.ItemType=="GaugeModel"?this._renderGaugeControl(o,!1,!1,{},s,h+"_"+o.Name,f,e):o.ItemType=="RectangleModel"?this._renderRectangleControl(o,!1,s,h+ + '_'+o.Name,f,e):o.ItemType=="ChartModel"?this._renderChartControl(o,!1,!1,{},s,h+"_"+o.Name,f,e):o.ItemType=="MapModel"?this._renderMapControl(o,!1,s,h+"_"+o.Name,f,e):o.ItemType=="SubReportModel"&&this._renderSubReportControl(o,!1,s,h+ + '_'+o.Name,f,e));s.css(c)},_renderMapControl:function(i,r,u,f,e,o){var a=i.MapProperties,h,l,p,k,b,v,rt,w,nt,s,c,d,g,tt,ft;r&&(this._id=f,i.Top=0,i.Left=0);var it=this._controlKeyGenerator(this._id+"_"+i.Name,f,e,o),y=t.buildTag("div","",{},{id:it}),ut=0;if(u.append(y),y.css("position","absolute"),y.css("top",i.Top),y.css("left",i.Left),y.css("height",i.Height),y.css("width",i.Width),a.Background&&a.Background.BackgroundColor&&y.css("background-color",a.Background.BackgroundColor),i.IsTablixChild&&y.css("position","relative"),a.ActionInfo&&(y.data("actionObj",a.ActionInfo),y.addClass("drillAction_"+this._id+" e-reportviewer-drillhover")),a.Border&&this._applyBorderStyle(a.Border,y),h=a.MapTitles,h&&h.length>0)for(l=0;l<h.length;l++)p=t.buildTag("div","",{},{id:it+"_"+h[l].Name}),p.css("position","relative"),p.css("left","1px"),p.css("height",h[l].Style.Font.FontSize-3*h[l].Border.Thickness),p.css("width",i.Width-3*h[l].Border.Thickness),p.css("text-align","center"),p.css("background-color",h[l].BackGround.BackgroundColor),p.css("border-color",h[l].Border.BorderBrush),p.css("border-width",h[l].Border.Thickness),p.css("border-style",h[l].Border.BorderStyle),k=t.buildTag("span","",{},{id:it+"_"+h[l].Name+"_"+l}),k.css("font-family",h[l].Style.Font.FontFamily),k.css("font-size",h[l].Style.Font.FontSize/1.33),k.css("font-style",h[l].Style.Font.FontStyle),k.css("font-weight",h[l].Style.Font.FontWeight),k.append(h[l].Text),p.append(k),y.append(p);if(a.MapViewport){if(b=a.MapViewport,v=t.buildTag("div","",{},{id:it+"_"+i.Name}),y.append(v),v.css("left","1px"),v.css("top","1px"),h&&h.length>0){for(rt=0;rt<h.length;rt++)ut=ut+h[rt].Style.Font.FontSize;v.css("height",i.Height-ut-3*b.Border.Thickness);v.css("top","10px")}else v.css("height",i.Height-3*b.Border.Thickness);if(v.css("width",i.Width-3*b.Border.Thickness),v.css("background-color",b.BackGround.BackgroundColor),v.css("border-color",b.Border.BorderBrush),v.css("border-width",b.Border.Thickness),v.css("border-style",b.Border.BorderStyle),v.ejMap({layers:[{layerType:"geometry"}]}),w=v.data("ejMap"),w.model.zoomSettings.minValue=1,w.model.zoomSettings.level=1,w.model.zoomSettings.enableZoom=!1,w.model.centerPosition=[b.MapView.CenterX,b.MapView.CenterY],a.MapPolygonLayers&&a.MapPolygonLayers.length>0)for(nt=0;nt<a.MapPolygonLayers.length;nt++)s=a.MapPolygonLayers[nt],c=n.extend(!0,{},w.model.layers[0]),c.layerType="geometry",c.enableSelection=!1,c.enableMouseHover=!1,c.shapeData=s.MapFields,s.MapBindingFieldPairs&&(c.shapePropertyPath=s.MapBindingFieldPairs.FieldName),c.shapeDataPath="Value",c.dataSource=i.MapModelData,i.MapModelData&&i.MapModelData.length>0&&i.MapModelData[0].ShapeActionInfo&&(w.ejreportid=this._id,w.model.shapeSelected=this._drillThroughClick,c.enableSelection=!0,c.enableMouseHover=!0,w.model.mouseover=function(t){t.originalEvent.data&&t.originalEvent.data.ShapeActionInfo&&n(t.originalEvent.shape).css("cursor","pointer")}),s.ShapeSettings&&(d=n.extend(!0,{},c.shapeSettings),d.colorValuePath=s.ShapeSettings.ShapeColorValuePath,d.valuePath=s.ShapeSettings.ShapeValuePath,s.ShapeColorMappings&&s.ShapeColorMappings.length>1?d.colorMappings={equalColorMapping:s.ShapeColorMappings}:(d.autoFill=!0,d.colorPalette="palette1"),c.shapeSettings=d),s.MapCenterPointRules&&s.MapCenterPointRules.length>0&&s.MapCenterPointRules.MapSizeRule&&(g=n.extend(!0,{},c.bubbleSettings),g.maxValue=s.BubbleSettings.MaxSize,g.minValue=s.BubbleSettings.MinSize,g.colorValuePath=s.BubbleSettings.ColorValuePath==null?"Value":s.BubbleSettings.ColorValuePath,g.valuePath=s.BubbleSettings.ValuePath,s.BubbleColorMappings&&s.BubbleColorMappings.length>1&&(g.colorMappings={equalColorMapping:s.BubbleColorMappings}),c.bubbleSettings=g),s.MapPolygonTemplate&&(tt=n.extend(!0,{},c.labelSettings),tt.showLabels=!0,s.ShapeSettings&&(tt.labelPath=s.ShapeSettings.LabelPath),tt.enableSmartLabel=!1,c.labelSettings=tt),a.MapLegends&&a.MapLegends.length>0&&(ft=n.extend(!0,{},c.legendSettings),ft.showLegend=!0,c.legendSettings=ft),w.model.layers[nt]=c;w.refresh();v.css("position","relative")}},_renderGaugeControl:function(n,i,r,u,f,e,o,s){var h=n.GaugePanel,p,c,l,a,y,v,w,b,k;i&&(this._id=e,n.Top=0,n.Left=0);p=this._controlKeyGenerator(this._id+"_"+n.Name,e,o,s);c=t.buildTag("div","",{},{id:p});f.append(c);c.css("position","absolute");l=n.Height;a=n.Width;n.Top&&c.css("top",n.Top);n.Left&&c.css("left",n.Left);y="Horizontal";v=0;h.RadialGauges&&h.RadialGauges.length>0&&(v=v+h.RadialGauges.length);h.LinearGauges&&h.LinearGauges.length>0&&(v=v+h.LinearGauges.length);h.Indicator&&h.Indicator.length>0&&(v=v+h.Indicator.length);w=o?"PrintImage":"GetResource";h.GaugeFrame&&h.GaugeFrame.FrameImage&&c.css("background-image","url("+this.model.reportServiceUrl+"/"+w+"/?key="+h.GaugeFrame.FrameImage+"&resourcetype=sfimg&isPrint="+o+")");h.Border&&this._applyBorderStyle(h.Border,c);r&&(_parentID=e,l=u.height,b=parseFloat(c.css("border-left-width"),10)+parseFloat(c.css("border-right-width"),10),k=parseFloat(c.css("border-top-width"),10)+parseFloat(c.css("border-bottom-width"),10),a=a-b,l=l-k);v!=0&&(l>a?(l=l/v,y="Vertical"):a=a/v);h.GaugeLabel&&this._renderGaugeLabels(h.GaugeLabel,c,n.Name,e,o,s);h.RadialGauges&&h.RadialGauges.length>0&&this._renderRadialGauge(h.RadialGauges,c,n.Name,y,a,l,e,o,s);h.LinearGauges&&h.LinearGauges.length>0&&this._renderLinearGauge(h.LinearGauges,c,n.Name,y,a,l,e,o,s);h.Indicator&&h.Indicator.length>0&&this._renderIndicator(h.Indicator,c,n.Name,a,l,e,o,s);r?c.css({position:"relative",width:a,height:l,"background-color":h.BackgroundColor}):c.css({width:n.Width,height:n.Height,"background-color":h.BackgroundColor})},_renderIndicator:function(n,i,r,u,f,e,o,s){function c(n,t,i){var u=document.createElementNS(rt,t);for(var r in i)i.hasOwnProperty(r)&&u.setAttribute(r,i[r]);n.appendChild(u)}for(var k,rt="http://www.w3.org/2000/svg",ut=0;ut<n.length;ut++){var nt=document.createElementNS(rt,"svg"),h=document.createElementNS(rt,"g"),w=u<f?u:f,b=n[ut],ft=t.buildTag("div","",{width:u,height:f,top:"0px",left:"0px"},{id:this._controlKeyGenerator(this._id+"_"+r+"_"+b.Name,e,o,s),title:b.ToolTip}),p=t.buildTag("div","",{width:"20px",height:"20px",position:"relative",display:"block"});for(nt.setAttributeNS(null,"style","display: block;margin:auto"),k=0;k<b.IndicatorState.length;k++){var et=b.IndicatorState[k].IndicatorStyle,tt=b.IndicatorState[k].StartValue.Value,it=b.IndicatorState[k].EndValue.Value,ot=tt,st=it;if(tt>=it&&(tt=st,it=ot),b.IndicatorData.Value>=tt&&b.IndicatorData.Value<=it){var a=b.IndicatorState[k].FillColor,l="display: block;",y=17,v=17;switch(et){case"ArrowDown":c(h,"path",{fill:a,stroke:"lightgray",d:"M7.60501098632813,16.3990020751953L14.06298828125,10.0289993286133 10.3890075683594,10.0289993286133 10.3890075683594,2.32599639892578 4.61099243164063,2.32599639892578 4.61099243164063,10.0289993286133 1.14801025390625,10.0289993286133 7.60501098632813,16.3990020751953z"});y=16;v=19;l=l+"margin-left:.5px;";break;case"ArrowDownIncline":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.5499877929688,13.8919982910156L13.6119995117188,4.822998046875 11.0130004882813,7.42100524902344 5.5670166015625,1.9739990234375 1.48101806640625,6.05900573730469 6.92901611328125,11.5059967041016 4.47900390625,13.9550018310547 13.5499877929688,13.8919982910156z"});y=v=16;l=l+"margin-left:.5px;";break;case"ArrowSide":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.1960144042969,8.43499755859375L8.8280029296875,1.97899627685547 8.8280029296875,5.65299987792969 1.125,5.65299987792969 1.125,11.4300003051758 8.8280029296875,11.4300003051758 8.8280029296875,14.8919982910156 15.1960144042969,8.43499755859375z"});l=l+"margin-left:.5px;";break;case"ArrowUp":c(h,"path",{fill:a,stroke:"lightgray",d:"M7.27099609375,1.47299957275391L0.81500244140625,7.84200286865234 4.48800659179688,7.84200286865234 4.48800659179688,15.5439987182617 10.2659912109375,15.5439987182617 10.2659912109375,7.84200286865234 13.7279968261719,7.84200286865234 7.27099609375,1.47299957275391z"});y=16;l=l+"margin-left:.5px;";break;case"ArrowUpIncline":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.0830078125,2.04299926757813L4.0159912109375,1.98199462890625 6.61300659179688,4.58000183105469 1.16598510742188,10.0269927978516 5.25100708007813,14.1119995117188 10.697998046875,8.66499328613281 13.14599609375,11.1130065917969 13.0830078125,2.04299926757813z"});y=15;v=16;l=l+"margin-left:.5px;";break;case"BoxesAllFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});l=l+"margin-top:2.5px;";break;case"BoxesNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"BoxesOneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"BoxesThreeFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"BoxesTwoFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"Circle":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});y=v=17;l=l+"margin-left:0.5px;";break;case"Flag":c(h,"path",{fill:a,stroke:"lightgray",d:"M1.53518676757813,1.97268676757813L1.71956861019135,1.87765264511108 2.22404956817627,1.65059661865234 3.90132141113281,1.14869689941406 5.98302745819092,1.16354370117188 6.99305105209351,1.58242082595825 7.88519287109375,2.39169311523438 9.55474090576172,4.09454298019409 11.1795692443848,5.14020156860352 12.5349636077881,5.63535928726196 13.3962097167969,5.68670654296875 13.5080919265747,5.78957939147949 13.3250951766968,6.16205215454102 12.1980743408203,7.28895568847656 10.2623682022095,8.2137336730957 9.06851482391357,8.33354949951172 7.76519775390625,8.08270263671875 5.64992141723633,7.59151554107666 4.50045776367188,7.73744964599609 4.02486801147461,8.11925792694092 3.93121337890625,8.335693359375 1.53518676757813,1.97268676757813z"});y=16;v=15;break;case"QuartersAllFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-left:0.5px;";break;case"QuartersNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-left:0.5px;";break;case"QuartersOneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M1.2958984375,8.71868896484375L1.864914894104,11.5364475250244 3.41652679443359,13.8374519348145 5.71757793426514,15.3888282775879 8.534912109375,15.9577026367188 11.353235244751,15.3888282775879 13.6545295715332,13.8374519348145 15.2060127258301,11.5364475250244 15.77490234375,8.71868896484375 15.2060127258301,5.90094757080078 13.6545295715332,3.59995269775391 11.353235244751,2.04858016967773 8.534912109375,1.47970581054688 5.71757793426514,2.04858016967773 3.41652679443359,3.59995269775391 1.864914894104,5.90094757080078 1.2958984375,8.71868896484375"});c(h,"path",{fill:a,d:"M8.57321166992188,1.86428833007813L11.3244533538818,2.38370847702026 13.4967041015625,3.80480575561523 14.9227085113525,5.96914529800415 15.4352111816406,8.71829223632813 15.5302124023438,8.7222900390625 8.57321166992188,8.7222900390625 8.57321166992188,1.86428833007813z"});l=l+"margin-top:0.5px;";break;case"QuartersThreeFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M16.033203125,9.3330078125L15.4643287658691,12.150749206543 13.9129524230957,14.4517440795898 11.6119480133057,16.003116607666 8.794189453125,16.5719909667969 5.97586584091187,16.003116607666 3.6745719909668,14.4517440795898 2.12308931350708,12.150749206543 1.55419921875,9.3330078125 2.12308931350708,6.51524877548218 3.6745719909668,4.2142448425293 5.97586584091187,2.66286897659302 8.794189453125,2.093994140625 11.6119480133057,2.66286897659302 13.9129524230957,4.2142448425293 15.4643287658691,6.51524877548218 16.033203125,9.3330078125"});c(h,"path",{fill:"white",d:"M8.75729370117188,2.4794921875L6.00546979904175,2.99834585189819 3.83292007446289,4.41925430297852 2.40680551528931,6.58378267288208 1.894287109375,9.33349609375 1.79928588867188,9.33648681640625 8.75729370117188,9.33648681640625 8.75729370117188,2.4794921875z"});l=l+"margin-top:0.5px;";break;case"QuartersTwoFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.1328125,8.3330078125L14.563796043396,11.150749206543 13.0121841430664,13.4517440795898 10.7111330032349,15.003116607666 7.893798828125,15.5719909667969 5.07547521591187,15.003116607666 2.7741813659668,13.4517440795898 1.22269868850708,11.150749206543 0.65380859375,8.3330078125 1.22269868850708,5.51524877548218 2.7741813659668,3.2142448425293 5.07547521591187,1.66286897659302 7.893798828125,1.093994140625 10.7111330032349,1.66286897659302 13.0121841430664,3.2142448425293 14.563796043396,5.51524877548218 15.1328125,8.3330078125"});c(h,"path",{fill:"white",d:"M7.81930541992188,1.45999145507813L5.0907883644104,1.99271726608276 2.95392227172852,3.42375564575195 1.56049299240112,5.59241724014282 1.06228637695313,8.3380126953125 1.57205629348755,11.0836029052734 2.99092483520508,13.252254486084 5.1532301902771,14.6832828521729 7.893310546875,15.2160034179688 7.81930541992188,1.45999145507813z"});l=l+"margin-top:0.5px;margin-left:0.5px;";break;case"SignalMeterFourFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterThreeFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterOneFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterTwoFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"StarQuartersAllFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M6.41500854492188,6.37100219726563L1.56698608398438,7.07400512695313 5.07501220703125,10.4939880371094 4.24700927734375,15.3210144042969 8.58200073242188,13.0409851074219 12.9169921875,15.3210144042969 12.0899963378906,10.4939880371094 15.5979919433594,7.07400512695313 10.75,6.37100219726563 8.58200073242188,1.97698974609375 6.41500854492188,6.37100219726563z"});break;case"StarQuartersNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M6.41500854492188,6.37100219726563L1.56698608398438,7.07400512695313 5.07501220703125,10.4939880371094 4.24700927734375,15.3210144042969 8.58200073242188,13.0409851074219 12.9169921875,15.3210144042969 12.0899963378906,10.4939880371094 15.5979919433594,7.07400512695313 10.75,6.37100219726563 8.58200073242188,1.97698974609375 6.41500854492188,6.37100219726563z"});break;case"StarQuartersOneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.64109802246094,1.97750854492188L10.80810546875,6.37149047851563 15.6560974121094,7.07449340820313 12.1490936279297,10.4945068359375 12.9761047363281,15.3204956054688 8.64109802246094,13.0404968261719 4.30610656738281,15.3204956054688 5.13409423828125,10.4945068359375 1.6260986328125,7.07449340820313 6.47309875488281,6.37149047851563 8.64109802246094,1.97750854492188z"});c(h,"path",{fill:a,stroke:"none",d:"M6.22300720214844,6.37100219726563L1.50100708007813,7.07400512695313 5.07099914550781,10.4939880371094 4.06300354003906,15.531005859375 7.08399963378906,13.864013671875 7.072998046875,4.968994140625 6.22300720214844,6.37100219726563z"});break;case"StarQuartersThreeFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.60209655761719,1.97750854492188L10.7691040039063,6.37149047851563 15.6170959472656,7.07449340820313 12.110107421875,10.4945068359375 12.9371032714844,15.3204956054688 8.60209655761719,13.0404968261719 4.26710510253906,15.3204956054688 5.0950927734375,10.4945068359375 1.58709716796875,7.07449340820313 6.43409729003906,6.37149047851563 8.60209655761719,1.97750854492188z"});c(h,"path",{fill:a,stroke:"none",d:"M6.40199279785156,6.37100219726563L1.58700561523438,7.07400512695313 5.11000061035156,10.4939880371094 4.28999328613281,15.3210144042969 8.49000549316406,13.0989990234375 10.6970062255859,14.27099609375 10.6970062255859,6.2239990234375 8.60200500488281,1.97698974609375 6.40199279785156,6.37100219726563z"});break;case"StarQuartersTwoFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.17819213867188,1.97750854492188L10.34521484375,6.37149047851563 15.1932067871094,7.07449340820313 11.6861877441406,10.4945068359375 12.5132141113281,15.3204956054688 8.17819213867188,13.0404968261719 3.84320068359375,15.3204956054688 4.67120361328125,10.4945068359375 1.1632080078125,7.07449340820313 6.01019287109375,6.37149047851563 8.17819213867188,1.97750854492188z"});c(h,"path",{fill:a,stroke:"none",d:"M6.010009765625,6.37100219726563L1.16299438476563,7.07400512695313 4.67098999023438,10.4939880371094 3.84298706054688,15.3210144042969 7.83499145507813,13.2219848632813 7.90399169921875,2.53201293945313 6.010009765625,6.37100219726563z"});break;case"ThreeSignsCircle":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-top:1px;margin-left:0.5px;";break;case"ThreeSignsDiamond":c(h,"path",{fill:a,stroke:"lightgray",d:"M1.08401489257813,8.01901245117188L8.10400390625,15.1589965820313 15.2929992675781,8.01901245117188 8.10400390625,0.878997802734375 1.08401489257813,8.01901245117188z"});y=16;l=l+"margin-top:3px;margin-left:1px;";break;case"ThreeSignsTriangle":c(h,"path",{fill:a,stroke:"lightgray",d:"M0.83099365234375,14.2340087890625L15.7950134277344,14.2340087890625 8.31298828125,1.27499389648438 0.83099365234375,14.2340087890625z"});l=l+"margin-top:1px;";break;case"ThreeSymbolCheck":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M12.15869140625,4.38958740234375L11.3836975097656,3.86260986328125 10.7337036132813,3.98660278320313 6.94171142578125,9.57958984375 5.19769287109375,7.83660888671875 4.53570556640625,7.83660888671875 3.87469482421875,8.49859619140625 3.87469482421875,9.16061401367188 6.5546875,11.8416137695313 7.1536865234375,12.1086120605469 7.71771240234375,11.7735900878906 12.28369140625,5.03860473632813 12.15869140625,4.38958740234375"});l=l+"margin-top:1px;margin-left:0.5px;";break;case"ThreeSymbolCross":c(h,"path",{fill:a,stroke:"lightgray",d:"M1.10299682617188,7.94601440429688L1.66799592971802,10.7435569763184 3.20874404907227,13.0283813476563 5.49386739730835,14.569019317627 8.2919921875,15.1340026855469 8.2919921875,15.1340026855469 11.0901165008545,14.569019317627 13.3752403259277,13.0283813476563 14.9159889221191,10.7435569763184 15.4809875488281,7.94601440429688 15.4809875488281,7.94601440429688 14.9159889221191,5.14773225784302 13.3752403259277,2.86226272583008 11.0901165008545,1.32116842269897 8.2919921875,0.756011962890625 8.2919921875,0.756011962890625 5.49386739730835,1.32116842269897 3.20874404907227,2.86226272583008 1.66799592971802,5.14773225784302 1.10299682617188,7.94601440429688"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M10.0479125976563,7.94430541992188L11.9789123535156,6.0133056640625 11.9789123535156,5.31130981445313 10.9259033203125,4.25729370117188 10.222900390625,4.25729370117188 8.2908935546875,6.18930053710938 6.35989379882813,4.25729370117188 5.65689086914063,4.25729370117188 4.60488891601563,5.31130981445313 4.60488891601563,6.0133056640625 6.534912109375,7.94430541992188 4.60488891601563,9.87728881835938 4.60488891601563,10.5783081054688 5.65689086914063,11.6322937011719 6.35989379882813,11.6322937011719 8.2908935546875,9.70028686523438 10.2239074707031,11.6322937011719 10.9259033203125,11.6322937011719 11.9789123535156,10.5783081054688 11.9789123535156,9.87728881835938 10.0479125976563,7.94430541992188z"});l=l+"margin-top:3px;margin-left:1px;";break;case"ThreeSymbolExclamation":c(h,"path",{fill:a,stroke:"lightgray",d:"M0.983001708984375,7.94601440429688L1.54785919189453,10.7435569763184 3.08837127685547,13.0283813476563 5.37344741821289,14.569019317627 8.1719970703125,15.1340026855469 8.1719970703125,15.1340026855469 10.9699649810791,14.569019317627 13.2547416687012,13.0283813476563 14.7951431274414,10.7435569763184 15.3599853515625,7.94601440429688 15.3599853515625,7.94601440429688 14.7951431274414,5.14773225784302 13.2547416687012,2.86226272583008 10.9699649810791,1.32116842269897 8.1719970703125,0.756011962890625 8.1719970703125,0.756011962890625 5.37344741821289,1.32116842269897 3.08837127685547,2.86226272583008 1.54785919189453,5.14773225784302 0.983001708984375,7.94601440429688"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M7.59280395507813,9.60159301757813L8.71978759765625,9.60159301757813 9.00180053710938,9.60159301757813 9.12579345703125,2.8916015625 7.143798828125,2.8916015625 7.31280517578125,9.60159301757813 7.59280395507813,9.60159301757813z"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M8.96728515625,10.69140625L8.17428588867188,10.3753967285156 7.37130737304688,10.6924133300781 7.03228759765625,11.4764099121094 7.37530517578125,12.244384765625 8.17428588867188,12.54541015625 8.96328735351563,12.244384765625 9.310302734375,11.4764099121094 8.96728515625,10.69140625"});l=l+"margin-top:3px;margin-left:1px;";break;case"ThreeSymbolUnCircledCheck":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.8515930175781,2.2255859375L12.6495971679688,1.402587890625 12.1062202453613,1.29134368896484 11.6416015625,1.59561157226563 5.755615234375,10.32958984375 3.04959106445313,7.60760498046875 2.53897094726563,7.39609527587891 2.02459716796875,7.60760498046875 0.997589111328125,8.64260864257813 0.785346984863281,9.15935516357422 0.997589111328125,9.6776123046875 5.1575927734375,13.8635864257813 6.0845947265625,14.2785949707031 6.96060180664063,13.755615234375 14.0445861816406,3.2406005859375 14.1565895080566,2.69297027587891 13.8515930175781,2.2255859375"});y=v=16;l=l+"margin-top:3px;margin-left:.5px;";break;case"ThreeSymbolUnCircledCross":c(h,"path",{fill:a,stroke:"lightgray",d:"M9.36907958984375,6.86331176757813L12.423095703125,3.71530151367188 12.6540832519531,3.14280700683594 12.423095703125,2.5703125 10.7581176757813,0.851287841796875 10.2026062011719,0.613548278808594 9.6470947265625,0.851287841796875 6.59613037109375,4.00131225585938 3.5421142578125,0.851287841796875 2.98759841918945,0.613548278808594 2.43310546875,0.851287841796875 0.768096923828125,2.5703125 0.537109375,3.14205169677734 0.768096923828125,3.71530151367188 3.82012939453125,6.86331176757813 0.768096923828125,10.0133056640625 0.537109375,10.5845413208008 0.768096923828125,11.1572875976563 2.43310546875,12.8763122558594 2.98723220825195,13.1140518188477 3.5421142578125,12.8763122558594 6.59613037109375,9.72628784179688 9.6480712890625,12.8763122558594 10.2027282714844,13.1140518188477 10.7581176757813,12.8763122558594 12.423095703125,11.1572875976563 12.6540832519531,10.5845413208008 12.423095703125,10.0133056640625 9.36907958984375,6.86331176757813z"});y=v=16;l=l+"margin-top:5px;margin-left:1.5px;";break;case"ThreeSymbolUnCircledExclamation":c(h,"path",{fill:"none",stroke:"none",d:"M0.983001708984375,7.94601440429688L1.54785919189453,10.7435569763184 3.08837127685547,13.0283813476563 5.37344741821289,14.569019317627 8.1719970703125,15.1340026855469 8.1719970703125,15.1340026855469 10.9699649810791,14.569019317627 13.2547416687012,13.0283813476563 14.7951431274414,10.7435569763184 15.3599853515625,7.94601440429688 15.3599853515625,7.94601440429688 14.7951431274414,5.14773225784302 13.2547416687012,2.86226272583008 10.9699649810791,1.32116842269897 8.1719970703125,0.756011962890625 8.1719970703125,0.756011962890625 5.37344741821289,1.32116842269897 3.08837127685547,2.86226272583008 1.54785919189453,5.14773225784302 0.983001708984375,7.94601440429688"});c(h,"path",{fill:a,stroke:"none",d:"M7.59280395507813,9.60159301757813L8.71978759765625,9.60159301757813 9.00180053710938,9.60159301757813 9.12579345703125,2.8916015625 7.143798828125,2.8916015625 7.31280517578125,9.60159301757813 7.59280395507813,9.60159301757813z"});c(h,"path",{fill:a,stroke:"none",d:"M8.96728515625,10.69140625L8.17428588867188,10.3753967285156 7.37130737304688,10.6924133300781 7.03228759765625,11.4764099121094 7.37530517578125,12.244384765625 8.17428588867188,12.54541015625 8.96328735351563,12.244384765625 9.310302734375,11.4764099121094 8.96728515625,10.69140625"});l=l+"margin-top:1px;margin-left:1px;";break;case"TrafficLight":c(h,"path",{fill:"black",stroke:"lightgray",d:"M3.83200073242188,1.46800231933594L2.76542282104492,1.68336224555969 1.89412689208984,2.27062797546387 1.3065185546875,3.14157843589783 1.09100341796875,4.20799255371094 1.09100341796875,4.20799255371094 1.09100341796875,13.3419952392578 1.3065185546875,14.4091548919678 1.89412689208984,15.2807502746582 2.76542282104492,15.8684692382813 3.83200073242188,16.0839996337891 3.83200073242188,16.0839996337891 12.9670104980469,16.0839996337891 14.0340003967285,15.8684692382813 14.9052505493164,15.2807502746582 15.4926300048828,14.4091548919678 15.7080078125,13.3419952392578 15.7080078125,13.3419952392578 15.7080078125,4.20799255371094 15.4926300048828,3.14157843589783 14.9052505493164,2.27062797546387 14.0340003967285,1.68336224555969 12.9670104980469,1.46800231933594 12.9670104980469,1.46800231933594 3.83200073242188,1.46800231933594z"});c(h,"path",{fill:a,d:"M3.78421020507813,8.77540588378906L4.14698934555054,6.97894716262817 5.13620376586914,5.51202392578125 6.60316896438599,4.52304029464722 8.39920043945313,4.160400390625 10.1958141326904,4.52304029464722 11.6630783081055,5.51202392578125 12.6524028778076,6.97894716262817 13.0151977539063,8.77540588378906 12.6524028778076,10.5718555450439 11.6630783081055,12.0387744903564 10.1958141326904,13.027756690979 8.39920043945313,13.3903961181641 6.60316896438599,13.027756690979 5.13620376586914,12.0387744903564 4.14698934555054,10.5718555450439 3.78421020507813,8.77540588378906"});y=v=18;l=l+"margin-top:3px;margin-left:.5px;";break;case"TrafficLightUnrimmed":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-top:3px;margin-left:.5px;";break;case"TriangleDash":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.9800109863281,7.56300354003906L0.501007080078125,7.56300354003906 0.501007080078125,4.67400360107422 13.9800109863281,4.67400360107422 13.9800109863281,7.56300354003906z"});y=15;v=9;break;case"TriangleDown":c(h,"path",{fill:a,stroke:"lightgray",d:"M14.06201171875,0.788002014160156L7.60501098632813,7.15699768066406 1.14801025390625,0.788002014160156 14.06201171875,0.788002014160156z"});y=15;v=9;l=l+"margin-top:3px;margin-left:.5px;";break;case"TriangleUp":c(h,"path",{fill:a,stroke:"lightgray",d:"M0.89599609375,7.30400085449219L7.35198974609375,0.93499755859375 13.8089904785156,7.30400085449219 0.89599609375,7.30400085449219z"});y=15;v=9;l=l+"margin-top:3px;margin-left:.5px;"}p.css({width:y+"px",height:v+"px"});nt.setAttributeNS(null,"style",l);nt.appendChild(h);break}}p.append(nt);ft.append(p);i.append(ft);var d=p.width(),g=p.height(),ht=d<g?d:g;w=w/ht;this._browserInfo.name=="msie"?p.css("transform","scale("+w+","+w+")"):this._browserInfo.name=="opera"?p.css("-o-transform","scale("+w+","+w+")"):this._browserInfo.name=="mozilla"?p.css("-ms-transform","scale("+w+","+w+")"):(this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome")&&p.css("-webkit-transform","scale("+w+","+w+")");d<g?p.css({left:"50%","margin-left":-(d/2),top:"50%","margin-top":-(d/2)}):p.css({left:"50%","margin-left":-(g/2),top:"50%","margin-top":-(g/2)})}},_renderGaugeLabels:function(n,i,r,u,f,e){for(var o,c,s,h=0;h<n.length;h++)o=n[h],c=t.buildTag("div","",{},{id:this._controlKeyGenerator(this._id+"_"+r+"_"+o.Name,u,f,e),title:o.ToolTip}),c.css({position:"absolute",top:o.Top,left:o.Left,width:o.length+10,height:o.Height+10,"background-color":o.BackgroundColor,"border-color":o.Style.BorderColor,"border-style":o.Style.BorderStyle,"border-width":o.Style.BorderWidth}),s=document.createElement("span"),s.innerHTML=o.Text,s.style.fontFamily=o.Font.FontFamily,s.style.fontSize=o.Font.FontSize,s.style.fontStyle=o.Font.FontStyle,s.style.fontWeight=o.Font.FontWeight,s.style.textAlign=o.TextAlign,s.style.color=o.TextColor,s.style.textDecoration=o.TextDecoration,c.append(s),i.append(c)},_renderRadialGauge:function(i,r,u,f,e,o,s,h,c){for(var lt,v,at,ot,ut,ft,a,l,vt,yt,ht,p,y,pt,wt,ct,w,k,et,it,st=0;st<i.length;st++){var d=i[st],g=d.GaugeFrame,rt=t.buildTag("div","",{},{id:this._controlKeyGenerator(this._id+"_"+u+"_"+d.Name,s,h,c),title:d.ToolTip});if(r.append(rt),rt.ejCircularGauge(),lt=h?"PrintImage":"GetResource",g.FrameImage&&rt.css("background-image","url("+this.model.reportServiceUrl+"/"+lt+"/?key="+g.FrameImage+"&resourcetype=sfimg&isPrint="+h+")"),v=rt.data("ejCircularGauge"),at=v.model.scales[0],v.model.scales.pop(v.model.scales[0]),ot=e<o?e/2-g.FrameWidth:o/2-g.FrameWidth,v.model.radius=ot,v.model.width=e,v.model.height=o,v.model.backgroundColor=d.BackgroundColor,v.model.enableAnimation=!1,d.ScaleProperties&&d.ScaleProperties.length>0)for(ut=d.ScaleProperties.length,ft=0;ft<ut;ft++){if(a=d.ScaleProperties[ft],l=n.extend(!0,{},at),l.radius=ot*((ut-ft)/ut)-g.FrameWidth,l.startAngle=a.StartAngle+90,l.sweepAngle=a.SweepAngle,l.showRanges=!0,l.showScaleBar=!0,l.maximum=a.Maximum,l.minimum=a.Minimum,l.border.color=a.BorderColor,l.border.width=a.BorderWidth,l.showPointers=!0,l.showTicks=!0,l.showLabels=!0,l.showIndicators=!0,l.backgroundColor=a.ScaleWidth==0?"Transparent":a.BackgroundColor,l.shadowOffset=a.ShadowOffset,a.ScaleInterval!=0?l.majorIntervalValue=a.ScaleInterval:(l.majorIntervalValue=Math.round((l.maximum-l.minimum)/10),l.minorIntervalValue=Math.round(l.majorIntervalValue/4)),a.RadialPointer&&a.RadialPointer.length>0)for(vt=l.pointers[0],l.pointers.pop(l.pointers[0]),yt=a.RadialPointer.length,ht=0;ht<yt;ht++){p=n.extend(!0,{},vt);y=a.RadialPointer[ht];p.value=y.Value;p.length=ot*((ut-ft)/ut)-30;p.backgroundColor=y.BackgroundColor;p.type=y.Type=="Needle"?"needle":"marker";p.showBackNeedle=!1;p.width=y.Width;p.border.width=y.BorderWidth;p.border.color=y.BorderColor;switch(y.NeedleStyle){case"Rectangular":p.needleType="rectangle";break;case"Arrow":p.needleType="arrow";break;default:p.needleType="triangle"}p.markerType=y.MarkerStyle=="wedge"||y.MarkerStyle=="triangle"||y.MarkerStyle=="circle"||y.MarkerStyle=="diamond"||y.MarkerStyle=="pentagon"||y.MarkerStyle=="trapezoid"?y.MarkerStyle.toLowerCase():"rectangle";p.distanceFromScale=y.distanceFromScale;l.pointerCap.backgroundColor=y.CapBackGroundColor;l.pointerCap.radius=y.CapRadius/3;l.pointers.push(p)}else l.pointers=[];if(a.Range&&a.Range.length>0)for(pt=l.ranges[0],l.ranges.pop(l.ranges[0]),wt=a.Range.length,ct=0;ct<wt;ct++)w=n.extend(!0,{},pt),k=a.Range[ct],w.distanceFromScale=k.DistanceFromScale,w.backgroundColor=k.BackgroundColor,k.EndValue==0&&k.StartValue==0?(w.startValue=70,w.endValue=100):(w.startValue=k.StartValue,w.endValue=k.EndValue),w.startWidth=k.StartWidth,w.endWidth=k.EndWidth,w.border.color=k.BorderColor,w.border.width=k.BorderWidth,l.ranges.push(w);else l.ranges=[];var b=a.TickMark,nt=l.ticks[0],tt=l.ticks[1];l.ticks.pop(l.ticks[0]);l.ticks.pop(l.ticks[1]);b.MajorTickHide||(nt.type="major",nt.width=b.MajorTickWidth+1,nt.distanceFromScale=b.MajorTickDistanceFromScale,nt.height=b.MajorTickLength-2,nt.color=b.MajorTickColor==null?"black":b.MajorTickColor,nt.placement="near",l.ticks.push(nt));b.MinorTickHide||(tt.type="minor",tt.width=b.MinorTickWidth,tt.distanceFromScale=b.MinorTickDistanceFromScale,tt.height=b.MinorTickLength-1,tt.color=b.MinorTickColor==null?"black":b.MinorTickColor,tt.placement="near",l.ticks.push(tt));et=a.Label;it=l.labels[0];l.labels.pop(l.labels[0]);it.font.fontFamily=et.FontFamily;it.font.size=et.FontSize;it.font.fontStyle=et.FontStyle;it.distanceFromScale=et.DistanceFromScale;it.color=et.Color;l.labels.push(it);l.indicators=null;v.model.scales.push(l)}v.refresh();v.contextEl.beginPath();v.contextEl.arc(e/2,o/2,ot,0,2*Math.PI,!1);v.contextEl.fillStyle="transparent";v.contextEl.fill();v.contextEl.lineWidth=g.FrameWidth;v.contextEl.strokeStyle=g.FrameColor!=null?g.FrameColor:"Transparent";v.contextEl.stroke();v.contextEl.closePath();h&&(rt.append("<img src="+v.contextEl.canvas.toDataURL("image/png")+" width=100% height=100%/>"),n(v.contextEl.canvas).remove());rt.css({width:e,height:o,float:f=="Horizontal"?"left":"top"})}},_renderLinearGauge:function(i,r,u,f,e,o,s,h,c){for(var y,ct,v,lt,at,ot,a,l,ht,vt,ut,w,k,yt,pt,st,b,d,it,nt,rt=0;rt<i.length;rt++){y=i[rt];rt%2!=0&&(ct=t.buildTag("div","",{width:f=="Horizontal"?"3px":e-p.FrameWidth*2,float:f=="Horizontal"?"left":"top",height:f=="Horizontal"?o-p.FrameWidth*2:"3px"},{}),r.append(ct));var p=y.GaugeFrame,tt=t.buildTag("div","",{},{id:this._controlKeyGenerator(this._id+"_"+u+"_"+y.Name,s,h,c),title:y.ToolTip}),wt=h?"PrintImage":"GetResource";if(p.FrameImage&&tt.css("background-image","url("+this.model.reportServiceUrl+"/"+wt+"/?key="+p.FrameImage+"&resourcetype=sfimg&isPrint="+h+")"),r.append(tt),tt.ejLinearGauge(),v=tt.data("ejLinearGauge"),lt=v.model.scales[0],v.model.scales.pop(v.model.scales[0]),v.model.width=e-p.FrameWidth*2,v.model.height=o-p.FrameWidth*2,v.model.enableAnimation=!1,v.model.backgroundColor=y.BackgroundColor,v.model.orientation=y.Orientation,v.model.orientation=y.Orientation=="Horizontal"?y.Orientation:y.Orientation=="Vertical"?y.Orientation:e>o?"Horizontal":"Vertical",y.ScaleProperties&&y.ScaleProperties.length>0){for(at=y.ScaleProperties.length,ot=0;ot<at;ot++){if(a=y.ScaleProperties[ot],l=n.extend(!0,{},lt),l.maximum=a.Maximum,l.minimum=a.Minimum,l.length=v.model.orientation=="Horizontal"?e/100*85:o/100*85,l.border.color=a.BorderColor,l.border.width=a.BorderWidth,l.backgroundColor=a.BackgroundColor,l.shadowOffset=a.ShadowOffset,l.width=v.model.orientation=="Vertical"?v.model.width/4:v.model.height/4,a.PointerType&&a.PointerType=="thermometer"&&(l.type=a.PointerType),a.LinearPointer&&a.LinearPointer.length>0)for(a.PointerType!="thermometer"?(ht=n.extend(!0,{},l.markerPointers[0]),l.markerPointers.pop(l.markerPointers[0])):(ht=n.extend(!0,{},l.barPointers[0]),l.barPointers.pop(l.barPointers[0])),vt=a.LinearPointer.length,ut=0;ut<vt;ut++)w=n.extend(!0,{},ht),k=a.LinearPointer[ut],w.value=k.MarkerValue,w.length=k.MarkerLength,w.backgroundColor=k.MarkerBackgroundColor,w.width=k.MarkerWidth,w.border.width=k.MarkerBorderWidth,w.border.color=k.MarkerBorderColor,w.type=k.MarkerStyle.toLowerCase(),w.distanceFromScale=k.MarkerDistanceFromScale,a.PointerType!="thermometer"?l.markerPointers.push(w):(l.showBarPointers=!0,l.barPointers.push(w),l.markerPointers[ut].opacity=0);else l.markerPointers=[],l.barPointers=[];if(a.Range&&a.Range.length>0)for(yt=n.extend(!0,{},l.ranges[0]),l.ranges.pop(l.ranges[0]),pt=a.Range.length,st=0;st<pt;st++)b=n.extend(!0,{},yt),d=a.Range[st],b.distanceFromScale=d.DistanceFromScale,b.backgroundColor=d.BackgroundColor,b.startValue=d.StartValue,b.startWidth=d.StartWidth,b.endValue=d.EndValue,b.endWidth=d.EndWidth,b.border.color=d.BorderColor,b.border.width=d.BorderWidth,l.ranges.push(b);else l.ranges=[];var g=a.TickMark,ft=l.ticks[0],et=l.ticks[1];l.ticks.pop(l.ticks[0]);l.ticks.pop(l.ticks[1]);ft.type="majorInterval";ft.width=g.MajorTickWidth;ft.height=g.MajorTickLength/2;ft.color=g.MajorTickColor==null?"black":g.MajorTickColor;l.ticks.push(ft);et.type="minorInterval";et.width=g.MinorTickWidth;et.height=g.MinorTickLength*2;et.color=g.MinorTickColor==null?"black":g.MinorTickColor;l.ticks.push(et);it=a.Label;nt=l.labels[0];l.labels.pop(l.labels[0]);nt.font.fontFamily=it.LinearLabelFontFamily;nt.font.size=it.LinearLabelFontSize;nt.font.fontStyle=it.LinearLabelFontStyle;nt.distanceFromScale=it.LinearLabelDistanceFromScale;nt.textColor=it.TextColor;l.labels.push(nt);l.indicators=null;l.customLabels=[];v.model.scales.push(l)}v.refresh();h&&(tt.append("<img src="+v.contextEl.canvas.toDataURL("image/png")+" width=100% height=100%/>"),n(v.contextEl.canvas).remove());tt.css({width:f=="Horizontal"?e-p.FrameWidth*2-3:e-p.FrameWidth*2,height:f=="Horizontal"?o-p.FrameWidth*2:o-p.FrameWidth*2-3,float:f=="Horizontal"?"left":"top","border-color":p.FrameColor!=null?p.FrameColor:"Transparent","border-width":p.FrameWidth,"border-style":"solid","background-color":y.BackgroundColor})}}},_renderLineControl:function(n,i,r,u){var l="http://www.w3.org/2000/svg",a=this._controlKeyGenerator(this._id+"_"+n.Name,i,r,u),c=t.buildTag("div","",{},{id:a}),s={},h,f,e,o;return s.position="absolute",s.top=n.Top,s.left=n.Left,s.width=n.Width==0?"11.00064":n.Width,s.height=n.Height==0?"16.00128":n.Height,c.css(s),this._svg?(h=document.createElementNS(l,"svg"),h.setAttributeNS(null,"width",n.Width==0?"11.00064":n.Width),h.setAttributeNS(null,"height",n.Height==0?"16.00128":n.Height),f=document.createElementNS(l,"line"),f.setAttributeNS(null,"x1",n.X1==0?n.LineWidth:n.X1-n.LineWidth),f.setAttributeNS(null,"y1",n.Y1==0?n.LineWidth:n.Y1-n.LineWidth),f.setAttributeNS(null,"x2",n.X2==0?n.LineWidth:n.X2-n.LineWidth),f.setAttributeNS(null,"y2",n.Y2==0?n.LineWidth:n.Y2-n.LineWidth),f.setAttributeNS(null,"stroke",n.LineColor),f.setAttributeNS(null,"stroke-width",n.LineWidth),f.setAttributeNS(null,"shape-rendering","crispEdges"),n.LineStyle=="Dashed"?f.setAttributeNS(null,"stroke-dasharray",""+n.LineWidth*2+","+n.LineWidth*2+""):n.LineStyle=="Dotted"&&f.setAttributeNS(null,"stroke-dasharray",n.LineWidth),h.appendChild(f),c.append(h)):(document.namespaces.add("v","urn:schemas-microsoft-com:vml"),document.createStyleSheet().cssText="v\\:fill, v\\:path, v\\:polyline, v\\:line, v\\:rect,v\\:shape,v\\:oval, v\\:stroke{ behavior:url(#default#VML); display: inline-block; } ",e=document.createElement("<v:line id='line' from='"+n.X1+","+n.Y1+"' to='"+n.X2+","+n.Y2+"' strokecolor='"+n.LineColor+"' strokeweight='"+n.LineWidth+"pt'><v:stroke dashstyle='dot'><\/v:stroke><\/v:line>"),o=document.createElement("v:stroke"),n.LineStyle=="Dotted"?o.setAttribute("dashstyle","dot"):n.LineStyle=="Dashed"?o.setAttribute("dashstyle","dash"):o.setAttribute("dashstyle","solid"),o.outerHTML=o.outerHTML,e.appendChild(o),e.style.position="absolute",e.style.width=n.Width,e.style.height=n.Height,e.style.visibility="visible",c.append(e)),c},_renderSubReportControl:function(n,i,r,u,f,e){var h=this._controlKeyGenerator(this._id+"_"+n.Name,u,f,e),o=t.buildTag("div","",{},{id:h,title:n.ToolTip}),c,s,l,a;if(r.append(o),o.css("position",i?"relative":"absolute"),o.css("top",n.Top),o.css("left",n.Left),o.css("width",n.Width),o.css("height",n.Height),o.css("background-color",n.BackgroundColor),n.Padding&&(n.Padding.Left&&o.css("padding-left",n.Padding.Left),n.Padding.Right&&o.css("padding-right",n.Padding.Right),n.Padding.Top&&o.css("padding-top",n.Padding.Top),n.Padding.Bottom&&o.css("padding-bottom",n.Padding.Bottom)),n.Style&&(n.Style.Font&&(n.Style.Font.FontFamily&&o.css("font-family",n.Style.Font.FontFamily),n.Style.Font.FontSize&&o.css("font-size",n.Style.Font.FontSize),n.Style.Font.FontStyle&&o.css("font-style",n.Style.Font.FontStyle),n.Style.Font.FontWeight&&o.css("font-weight",n.Style.Font.FontWeight)),o.css("color",n.Style.TextColor?n.Style.TextColor:"black"),n.Style.TextDecoration&&o.css("text-decoration",n.Style.TextDecoration)),n.LineHeight&&o.css("line-height",n.LineHeight),n.TextAlign&&o.css("text-align",n.TextAlign),n.VerticalAlign&&o.css("vertical-align",n.VerticalAlign),n.Border&&!i&&this._applyBorderStyle(n.Border,o),n.ReportItemModels&&n.ReportItemModels.length>0)for(c=0;c<n.ReportItemModels.length;c++)s=n.ReportItemModels[c],s&&(s.ItemType=="TextBoxModel"?(l=this._renderTextBoxControl(s,!1,h+"_"+s.Name,f,e),o.append(l)):s.ItemType=="LineModel"?(a=this._renderLineControl(s,h+"_"+s.Name,f,e),o.append(a)):s.ItemType=="ImageModel"?this._renderImageControl(s,!1,o,h+"_"+s.Name,f,e):s.ItemType=="TablixModel"?this._renderTablixControl(s,!1,{},o,h+"_"+s.Name,e):s.ItemType=="GaugeModel"?this._renderGaugeControl(s,!1,!1,{},o,h+"_"+s.Name,f,e):s.ItemType=="RectangleModel"?this._renderRectangleControl(s,!1,o,h+ +'_'+s.Name,f,e):s.ItemType=="ChartModel"?this._renderChartControl(s,!1,!1,{},o,h+"_"+s.Name,f,e):s.ItemType=="MapModel"?this._renderMapControl(s,!1,o,h+"_"+s.Name,f,e):s.ItemType=="SubReportModel"&&this._renderSubReportControl(s,!1,o,h+ +'_'+s.Name,f,e))},doAjaxPost:function(t,i,r,u){var f=this,e=u,o=[],s=[],c,h;if(f._onAjaxRequest({headerReq:o,jsonArray:s,inVokemethod:u}),s.length>0){for(c=jQuery.parseJSON(r),h=0;h<s.length;h++)c[s[h].Key]=s[h].Value;r=JSON.stringify(c)}n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,beforeSend:function(n){if((e=="_getPageModel"||e=="_getPreviewModel")&&(f._isToolbarClick?f._showNavigationIndicator(!0):f._showloadingIndicator(!0)),n.setRequestHeader("ejAuthenticationToken",f._authenticationToken),o.length>0)for(var t=0;t<o.length;t++)n.setRequestHeader(o[t].Key,o[t].Value);f.model.reportServerId&&n.setRequestHeader("ejServerInstance",f.model.reportServerId)},success:function(n){if(n&&typeof n.Data!="undefined"&&(n=n.Data),typeof n=="string"&&n.indexOf("Sf_Exception")!=-1){f._renderExcpetion(e+":"+n);return}typeof n=="object"&&f._onAjaxSuccess(n);f[e](n)},error:function(n){if(e!="_clearCurrentServerCache"){if(n.readyState==0)return;f._onAjaxFailure(n);alert("Exception"+n.responseText)}}})},_reportLoaded:function(n){var t;typeof n=="object"&&n.isReportLoad?n?(this._reportParameters=n.parameters,this._reportDataSources=n.dataSources,this._reporDataSets=n.dataSets,this._machineCulture=n.currentCulture,this._onReportLoaded(),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")):(this._renderExcpetion("Could not load the report"),t=this._onReportError({errmsg:"Could not load the report"}),this._showExceptionResult(t,"Could not load the report")):(this._renderExcpetion("Report Loaded:"+n),t=this._onReportError({errmsg:"Report Loaded:"+n,innerMessage:n}),this._showExceptionResult(t,"Report Loaded:"+n))},_getDataSourceCredential:function(n){t.isNullOrUndefined(n)||n=="Sf_legacy"?this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.updateDataSource}),"_updateDataSource"):(this._renderCredentialBlock(n),this._showViewerBlock(!0));this._showloadingIndicator(!1);this._setContainerSize();this._showloadingIndicator(!0)},_validateDSCredential:function(n){n=="Sf_legacy"?(this._showloadingIndicator(!1),this._showViewerBlock(!1),this._setContainerSize(),this._showloadingIndicator(!0),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.updateDSCredential,datasoures:this._dataSources}),"_updateDSCredential"),this._dataSources=null,this._unwiredViewClickEvent()):alert(n)},_updateDSCredential:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.updateDataSource}),"_updateDataSource")},_getParameters:function(n){var t,i;n!="Sf_legacy"?(t=this._renderParameterBlock(n),t?(this._setContainerSize(),this._getDefaultParameters(n)):(this._showViewerBlock(!0),this._showloadingIndicator(!1),this._setContainerSize(),this._showloadingIndicator(!0),i=this._getParameterJson(n,!1),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:i}),"_setParameters"))):(this._showParameterBlock(!1),this._isForwardDirection=!0,this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_setParameters:function(t){var i=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcontent table:first").attr("isviewclick");typeof t=="boolean"&&(t==!1?(this._showloadingIndicator(!0),this._setContainerSize(),this._isDevice&&(this._showViewerBlock(!1),this._showViewerPage(!0),this._selectparamToolItem(!1)),this._currentPage=1,this._clearPageCache(),this._isForwardDirection=!0,this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")):(this._showloadingIndicator(!1),i=="true"&&(this._viewReportEnableDisable(!1),alert("Please select the parameter values."))))},_updateParameters:function(n){n!="Sf_legacy"&&this._updateParamElements(n)},_updateDataSource:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getParameters}),"_getParameters")},_getPageModel:function(n){var t=n,i;if(this._showNavigationIndicator(!1),this._showloadingIndicator(!1),this._viewReportEnableDisable(!1),t){if(t==="IsDrillDown"||t==="IsSorting")return;t.isDocumentMap&&(this._isDocumentMap=this._isPageDocMap=t.isDocumentMap);t.errmsg&&t.errmsg.length>0?(i=this._onReportError({errmsg:t.errmsg}),this._showExceptionResult(i,t.errmsg)):this._resetExceptionBlock();t.pgmodel&&t.pgmodel.PageData&&(this._pageModel=t.pgmodel,this._isToolbarClick||this._enableToolbarItems(),this._onRenderingBegin(),this._gotoPage(this._currentPage),this._pageLayoutPage=this._currentPage,this._onRenderingComplete(),this._refresh=!1,this._dataRefresh=!1);t.pgsetting&&this._updatePageSetup(t.pgsetting);(this.model.enablePageVirtualization||this.model.enablePageCache)&&(this._storePageCache(this._currentPage),this._renderPages())}},_getPreviewModel:function(n){this._showNavigationIndicator(!1);this._showloadingIndicator(!1);n&&(n.isDocumentMap&&(this._isDocumentMap=n.isDocumentMap,this._isPageDocMap=this._isDocumentMap,this._pageDocMapFlag=!1),n.pgmodel&&n.pgmodel.PageData&&(this._pageModel=n.pgmodel,this._isToolbarClick||(this._selectPreviewToolItem(!0),this._enableToolbarItems()),this._gotoPage(this._currentPage),this._refresh=!1,this._initialPageSetup(n)),(this.model.enablePageVirtualization||this.model.enablePageCache)&&(this._storePageCache(this._currentPage),this._renderPages()))},_getPrintModel:function(n){n&&n.PageData&&n.PageData.length>0&&(this.model.printOption=="None"?this._renderSilentPrinting(n):this._printReport(n))},_documentMapModel:function(n){n&&n.indexOf("<ul id=treeViewID>")!=-1&&(this._showDocumentMap(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.DocumentMap),this._containerSplit(n))},_drillThroughModel:function(t){var r={x:n("#"+this._id+"_viewerContainer").scrollLeft(),y:n("#"+this._id+"_viewerContainer").scrollTop()},i=this._cloneReportViewerProperties();this._parents.push({pagePos:r,parentPro:i});this._setInitialization();this._authenticationToken=i._childReportAuthentication;this._unwireEvents();this._initViewer();this._reportLoaded(t)},_gotoParentReportModel:function(){this._setParentReportViewerProperties();var n=this._currentPage;this._unwireEvents();this._initViewer();this._currentPage=n;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getParameters}),"_getParameters")},_clearCurrentServerCache:function(){},_print:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPrintModel}),"_getPrintModel")},_printReport:function(i){var u=i,c=u.PaperHeight,e=u.PaperWidth,w=u.MarginTop,b=u.MarginLeft,k=n("head").find("link"),l=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version)<=9,r=this.model.printOption=="Default"?window.open("","pint","tabbar=no,scrollbars = yes,resizable = yes"):window.open("","_blank"),a="<style>h1 {display:block;height:0px;page-break-after:always;}@page { size:"+e+"px "+c+"px; margin:0px;}@media print{ div {-webkit-print-color-adjust: exact;} #header, #footer { display:none } }<\/style>",v=!0,o,s,f,h,y,p;if(r!=null){for(r.document.write("<!DOCTYPE html>"),r.printDelay=500,v=this._onReportPrint({printWind:r,isStyleLoad:!0}),o=this._browserInfo.name==="msie"?'<body style="width:'+e+'px">':"<body>",v?(s="",k.each(function(t,i){n(i).attr("href",i.href);s+=i.outerHTML}),r.document.write("<html><head>"+s+a+"<\/head>"+o)):r.document.write("<html><head>"+a+"<\/head>"+o),f=0;f<u.TotalPages;f++)h=u.PageData[f],t.isNullOrUndefined(h)||(r.document.write('<div style="position:relative;height:'+c+"px;width:"+e+"px;"+(this._browserInfo.name=="mozilla"?"page-break-inside:avoid":"")+';">'),y=this._renderPrintContainer(h,w,b,f),r.document.write(y),r.document.write("<\/div>"),l?l&&f<u.TotalPages&&r.document.write("<h1><\/h1>"):r.document.write("<h1><\/h1>"));p=r.printDelay&&r.printDelay===parseInt(r.printDelay,10)?r.printDelay:500;r.document.write("<\/body><\/html>");r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},300))},p)}},_renderSilentPrinting:function(i){var f=i,l=f.PaperHeight,o=f.PaperWidth,w=f.MarginTop,b=f.MarginLeft,k=n("head").find("link"),a=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version)<=9,v="<style>h1 {display:block;height:0px;page-break-after:always;}@page { size:"+o+"px "+l+"px; margin:0px;}@media print{ div {-webkit-print-color-adjust: exact;} #header, #footer { display:none } }<\/style>",u=n("#"+this._id+"_printPageIframe"),r,s,h,e,c,y,p;if(u.length>0||(u=n('<iframe id="'+(this._id+"_printPageIframe")+'"><\/iframe>'),u.css({height:".0001px",width:".0001px",backgroundColor:"Transparent",border:"none"}),n("body").append(u)),r=u[0].contentWindow?u[0].contentWindow:u[0].contentDocument.document?u[0].contentDocument.document:u[0].contentDocument,r!=null){for(r.document.open(),r.document.write("<!DOCTYPE html>"),r.printDelay=500,isCssLoad=this._onReportPrint({printFrame:r,isStyleLoad:!0}),s=this._browserInfo.name==="msie"?'<body style="width:'+o+'px">':"<body>",isCssLoad?(h="",k.each(function(t,i){n(i).attr("href",i.href);h+=i.outerHTML}),r.document.write("<html><head>"+h+v+"<\/head>"+s)):r.document.write("<html><head>"+v+"<\/head>"+s),e=0;e<f.TotalPages;e++)c=f.PageData[e],t.isNullOrUndefined(c)||(r.document.write('<div style="position:relative;height:'+l+"px;width:"+o+"px;"+(this._browserInfo.name=="mozilla"?"page-break-inside:avoid":"")+';">'),y=this._renderPrintContainer(c,w,b,e),r.document.write(y),r.document.write("<\/div>"),a?a&&e<f.TotalPages&&r.document.write("<h1><\/h1>"):r.document.write("<h1><\/h1>"));p=r.printDelay&&r.printDelay===parseInt(r.printDelay,10)?r.printDelay:500;r.document.write("<\/body><\/html>");r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.window.close()},300))},p)}},_renderPrintContainer:function(i,r,u,f){var e=document.createElement("div"),o,s,h,v,c,l,a,y,p;return document.body.appendChild(e),n(e).css({overflow:"auto",width:"1px",height:"1px"}),o=t.buildTag("div","",{position:"relative","background-color":"transparent"}),n(e).append(o),s=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.HeaderHeight+"px"},{}),h=t.buildTag("div.pageHeaderBorder","",{position:"relative","background-color":"#FFFFFF",left:u,top:r}),h.append(s),o.append(h),v=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.Height+"px"},{}),c=t.buildTag("div.pageBodyBorder","",{position:"relative","background-color":"#FFFFFF",left:u,top:r}),c.append(v),o.append(c),l=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.FooterHeight+"px"},{}),a=t.buildTag("div.pageFooterBorder","",{position:"relative","background-color":"#FFFFFF",left:u,top:r}),a.append(l),o.append(a),this._printMode&&(s.css("overflow","hidden"),l.css("overflow","hidden")),i.ReportStyleModel&&this._applyPageStyle(o,i.ReportStyleModel,!0),i.HeaderStyleModel&&this._applyPageStyle(h,i.HeaderStyleModel,!0),i.FooterStyleModel&&this._applyPageStyle(a,i.FooterStyleModel,!0),i.BodyStyleModel&&this._applyPageStyle(c,i.BodyStyleModel,!0),i.HeaderModel&&i.HeaderModel.length>0&&this._renderPageControls(i.HeaderModel,s,!0,"Print"+f),i.FooterModel&&i.FooterModel.length>0&&this._renderPageControls(i.FooterModel,l,!0,"Print"+f),i.PageModel&&i.PageModel.length>0&&this._renderPageControls(i.PageModel,v,!0,"Print"+f),y=n(e).find("img"),y.each(function(t,i){n(i).attr("src",i.attributes.imgUrl.value)}),p=e.innerHTML.replace(/PrintImage/g,"GetResource"),document.body.removeChild(e),p},_showPrintButton:function(t){t?n("#"+this._id+"_toolbar_Print").parent().css("display","block"):n("#"+this._id+"_toolbar_Print").parent().css("display","none")},_exportMenuClick:function(t){var i,r=n(t.target);r&&(r.hasClass("e-pdf")?i="PDF":r.hasClass("e-word")?i="Word_"+this.model.exportSettings.wordFormat:r.hasClass("e-excel")?i="Excel_"+this.model.exportSettings.excelFormat:r.hasClass("e-html")?i="Html":r.hasClass("e-ppt")&&(i="PPT_"+this.model.exportSettings.pptFormat),this._exportReport(i))},_exportReport:function(t){var r=null,f,u,i,e,o,s,h;t&&t.length>0&&(f=this.model.reportServiceUrl+"/PostReportAction",n("#"+this._id+"_exportForm").length>0?(u=n("#"+this._id+"_exportForm"),u.attr("action",f),n("#"+this._id+"_exportKey").val(this._authenticationToken),n("#"+this._id+"_exportRes").val(t),r={exportAction:u},this._onReportExport(r),u.submit()):(i=document.createElement("form"),n(i).attr({id:this._id+"_exportForm",method:"post",action:f,"data-ajax":"false"}),e=document.createElement("input"),n(e).attr({type:"hidden",id:this._id+"_exportKey",name:"controlID",value:this._authenticationToken}),o=document.createElement("input"),n(o).attr({type:"hidden",id:this._id+"_exportRes",name:"resourcetype",value:t}),s=document.createElement("input"),n(s).attr({type:"hidden",id:this._id+"_exportPrint",name:"isPrint",value:!1}),h=document.createElement("input"),n(h).attr({type:"hidden",id:this._id+"_exportfileName",name:"reportName",value:""}),n(i).append(e),n(i).append(o),n(i).append(s),n(i).append(h),n("body").append(i),n(i).hide(),r={exportAction:i},this._onReportExport(r),n(i).submit()));n("#"+this._id+"_toolbar_exportListTip").hide()},_showExportList:function(){this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Html?n("#"+this._id+"_html").css("display","block"):n("#"+this._id+"_html").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Word?n("#"+this._id+"_word").css("display","block"):n("#"+this._id+"_word").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Excel?n("#"+this._id+"_xls").css("display","block"):n("#"+this._id+"_xls").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Pdf?n("#"+this._id+"_pdf").css("display","block"):n("#"+this._id+"_pdf").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.PPT?n("#"+this._id+"_ppt").css("display","block"):n("#"+this._id+"_ppt").css("display","none")},_showExportControls:function(t){t?n("#"+this._id+"_toolbarContainer .e-reportviewer-export").parent().css("display","block"):n("#"+this._id+"_toolbarContainer .e-reportviewer-export").parent().css("display","none")},_showTooltip:function(){var t=n("#"+this._id+"_toolbar_exportListTip"),r,i;t.length>0||(t=this._renderToolTipExport(),n("body").append(t),this._showExportList(),this._on(n("#"+this._id+"_toolbar_exportListTip .e-reportviewer-popupli"),"click",this._exportMenuClick));t.css("display")=="block"?t.css("display","none"):t.css("display","block");r=n("#"+this._id+"_toolbarContainer .e-reportviewer-export").height();i=n(n("#"+this._id+"_toolbarContainer .e-reportviewer-export")[0]).offset();t.css({top:i.top+r-3,left:i.left-5})},_updatePageNavigation:function(t,i){var r=this._isDevice?"_device_toolbarContainer":"_toolbarContainer";t>1&&t<i?(n("#"+this._id+r+" .e-reportviewer-gotofirst").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").removeClass("e-reportviewer-disabled")):t==1&&t<i?(n("#"+this._id+r+" .e-reportviewer-gotofirst").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").removeClass("e-reportviewer-disabled")):t==i&&i!=1?(n("#"+this._id+r+" .e-reportviewer-gotofirst").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").addClass("e-reportviewer-disabled")):(n("#"+this._id+r+" .e-reportviewer-gotofirst").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").addClass("e-reportviewer-disabled"))},_gotoRenderPage:function(){this._onRenderingBegin();this._pageModel=this._retrievePageCache(this._currentPage);this._gotoPage(this._currentPage);this._onRenderingComplete();this._refresh=!1;(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._renderPages()},_gotoFirstPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._pageModel.TotalPages>0&&(this._currentPage=1,this._refresh=!1,this._isForwardDirection=!0,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoLastPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._pageModel.TotalPages>0&&(this._currentPage=this._pageModel.TotalPages,this._refresh=!1,this._isForwardDirection=!1,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoNextPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._currentPage<this._pageModel.TotalPages&&(this._currentPage=this._currentPage+1,this._refresh=!1,this._isForwardDirection=!0,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoPreviousPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._currentPage>1&&(this._currentPage=this._currentPage-1,this._refresh=!1,this._isForwardDirection=!1,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoPageNo:function(n){if(this._pageModel&&this._pageModel.TotalPages){var t=parseInt(n);t>=1&&t<=this._pageModel.TotalPages&&this._currentPage!=t&&(this._currentPage=t,this._refresh=!1,this._isForwardDirection=!1,this._isSelectedPage=!0,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))}},_gotoPage:function(t){var u,f,r,i;this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0&&(u=parseInt(t),this._updatePageNavigation(u,this._pageModel.TotalPages),this._pageModel.TotalPages>0&&this._pageModel.TotalPages&&(f=this._isDevice?"_device_toolbarContainer":"_toolbarContainer",n("#"+this._id+f+" span.e-reportviewer-labelpageno").html(" / "+this._pageModel.TotalPages),n("#"+this._id+"_txtpageNo").val(u)),r=n("#"+this._id+"_viewerContainer").find(".e-js"),r&&r.length>0&&this._destroyEJObjects(r),r=null,i=this._pageModel.PageData[0],this._renderPageModels(i),i&&this._setPageSize(i.Height,i.Width,i.HeaderHeight,i.FooterHeight))},_onkeyPress:function(t){if(t.keyCode==13)try{var i=parseInt(n(t.currentTarget).val());this._gotoPageNo(i)}catch(r){}if(t.keyCode>31&&(t.keyCode<48||t.keyCode>57))return!1},_showPageNavigationControls:function(t){t?n("#"+this._id+"_txtpageNo").parents(".e-reportviewer-toolbarul").css("display","block"):n("#"+this._id+"_txtpageNo").parents(".e-reportviewer-toolbarul").css("display","none")},_showPrintPageSetup:function(){var r=n("#"+this._id+"_printPageSetup"),t,i;r.length>0?t=n("#"+this._id+"_printPageSetup").data("ejDialog"):(this._renderPrintPageSetup(),this._bindPageSetupModel(),n("#"+this._id+"_landscape").data("ejRadioButton").model.change=n.proxy(this._orientationChanged,this),n("#"+this._id+"_portrait").data("ejRadioButton").model.change=n.proxy(this._orientationChanged,this));t&&t.model&&(i=t.isOpen(),i?n("#"+this._id+"_printPageSetup").ejDialog("close"):(n("#"+this._id+"_printPageSetup").ejDialog("open"),this._bindPageSetupModel()));this._enableToolbarContents(!1)},_pageSettingClose:function(){this._enableToolbarContents(!0)},_updatePageSetup:function(n){t.isNullOrUndefined(n)||(this._paperSetup.paperHeight=this._paperSetup.paperHeight?this._paperSetup.paperHeight:(n.PaperHeight/96).toFixed(2),this._paperSetup.paperWidth=this._paperSetup.paperWidth?this._paperSetup.paperWidth:(n.PaperWidth/96).toFixed(2),this._paperSetup.MarginTop=this._paperSetup.MarginTop&&this._paperSetup.MarginTop>0?this._paperSetup.MarginTop:(n.MarginTop/96).toFixed(2),this._paperSetup.MarginRight=this._paperSetup.MarginRight&&this._paperSetup.MarginRight>0?this._paperSetup.MarginRight:(n.MarginRight/96).toFixed(2),this._paperSetup.MarginBottom=this._paperSetup.MarginBottom&&this._paperSetup.MarginBottom>0?this._paperSetup.MarginBottom:(n.MarginBottom/96).toFixed(2),this._paperSetup.MarginLeft=this._paperSetup.MarginLeft&&this._paperSetup.MarginLeft>0?this._paperSetup.MarginLeft:(n.MarginLeft/96).toFixed(2),this._paperOrientation=parseFloat(this._paperSetup.paperHeight)<parseFloat(this._paperSetup.paperWidth)?"Landscape":"Portrait",this._paperName=this._paperName?this._paperName:this._paperOrientation=="Landscape"?this._getPaperName(this._paperSetup.paperHeight,this._paperSetup.paperWidth):this._getPaperName(this._paperSetup.paperWidth,this._paperSetup.paperHeight))},_initialPageSetup:function(n){t.isNullOrUndefined(n.pgmodel.PaperHeight)||(this._paperSetup.paperHeight=this._paperSetup.paperHeight?this._paperSetup.paperHeight:(n.pgmodel.PaperHeight/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.PaperWidth)||(this._paperSetup.paperWidth=this._paperSetup.paperWidth?this._paperSetup.paperWidth:(n.pgmodel.PaperWidth/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginTop)||(this._paperSetup.MarginTop=this._paperSetup.MarginTop&&this._paperSetup.MarginTop>0?this._paperSetup.MarginTop:(n.pgmodel.MarginTop/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginRight)||(this._paperSetup.MarginRight=this._paperSetup.MarginRight&&this._paperSetup.MarginRight>0?this._paperSetup.MarginRight:(n.pgmodel.MarginRight/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginBottom)||(this._paperSetup.MarginBottom=this._paperSetup.MarginBottom&&this._paperSetup.MarginBottom>0?this._paperSetup.MarginBottom:(n.pgmodel.MarginBottom/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginLeft)||(this._paperSetup.MarginLeft=this._paperSetup.MarginLeft&&this._paperSetup.MarginLeft>0?this._paperSetup.MarginLeft:(n.pgmodel.MarginLeft/96).toFixed(2))},_bindPageSetupModel:function(){var t=n("#"+this._id+"_paperHeight").data("ejNumericTextbox"),i=n("#"+this._id+"_paperWidth").data("ejNumericTextbox"),r=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox"),u=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox"),f=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox"),e=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox"),o=n("#"+this._id+"_PaperSize").data("ejDropDownList");o.selectItemByText(this._paperName);t.option("value",this._paperSetup.paperHeight?this._paperSetup.paperHeight:1);i.option("value",this._paperSetup.paperWidth?this._paperSetup.paperWidth:1);u.option("value",this._paperSetup.MarginTop);f.option("value",this._paperSetup.MarginRight);e.option("value",this._paperSetup.MarginBottom);r.option("value",this._paperSetup.MarginLeft);this._paperOrientation=="Landscape"?n("#"+this._id+"_landscape").data("ejRadioButton").option("checked",!0):n("#"+this._id+"_portrait").data("ejRadioButton").option("checked",!0)},_orientationChanged:function(i){var e=n("#"+this._id+"_paperHeight").data("ejNumericTextbox"),o=n("#"+this._id+"_paperWidth").data("ejNumericTextbox"),s=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox"),h=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox"),c=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox"),l=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox"),u,f,r,a;e&&o&&(u=e.getValue(),f=o.getValue(),this._paperName=="Custom"?i.model.id==this._id+"_portrait"&&u>f||i.model.id==this._id+"_landscape"&&u<f?(e.option("value",u),o.option("value",f)):(e.option("value",f),o.option("value",u)):(e.option("value",f),o.option("value",u)),i.model.id==this._id+"_landscape"&&i.model.checked==!0?(r=s.getValue(),s.option("value",h.getValue()),a=l.getValue(),l.option("value",r),r=c.getValue(),c.option("value",a),h.option("value",r),this._paperOrientation=t.ReportViewer.Orientation.Landscape):(r=c.getValue(),c.option("value",h.getValue()),a=l.getValue(),l.option("value",r),r=s.getValue(),s.option("value",a),h.option("value",r),this._paperOrientation=t.ReportViewer.Orientation.Portrait))},_setUpChange:function(t){var e=t.value,f=0,r=n("#"+this._id+"_paperHeight").data("ejNumericTextbox"),u=n("#"+this._id+"_paperWidth").data("ejNumericTextbox"),o=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox"),s=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox"),h=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox"),c=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox"),i=this._getPaperSize(e);e=="Custom"?this._paperOrientation=="Portrait"&&i.height>i.width||this._paperOrientation=="Landscape"&&i.height<i.width?(r.option("value",i.height),u.option("value",i.width)):(r.option("value",i.width),u.option("value",i.height)):this._paperOrientation=="Landscape"?(r.option("value",i.width),u.option("value",i.height)):(r.option("value",i.height),u.option("value",i.width));s.getValue()||s.option("value",f.toFixed(2));h.getValue()||h.option("value",f.toFixed(2));c.getValue()||c.option("value",f.toFixed(2));o.getValue()||o.option("value",f.toFixed(2));e=="Custom"?(r.enable(),u.enable()):(r.disable(),u.disable())},_getPaperName:function(n,t){return n==11.7&&t==16.5?"A3":n==8.27&&t==11.69?"A4":n==10.12&&t==14.33?"B4(JIS)":n==7.17&&t==10.12?"B5(JIS)":n==4.13&&t==9.5?"Envelope #10":n==3.88&&t==7.5?"Envelope Monarch":n==7.25&&t==10.5?"Executive":n==8.5&&t==14?"Legal":n==8.5&&t==11?"Letter":n==11&&t==17?"Tabloid":"Custom"},_getPaperSize:function(t){var u={},i,r;switch(t){case"A3":r=11.7;i=16.5;break;case"A4":r=8.27;i=11.69;break;case"B4(JIS)":r=10.12;i=14.33;break;case"B5(JIS)":r=7.17;i=10.12;break;case"Envelope #10":r=4.13;i=9.5;break;case"Envelope Monarch":r=3.88;i=7.5;break;case"Executive":r=7.25;i=10.5;break;case"Legal":r=8.5;i=14;break;case"Letter":r=8.5;i=11;break;case"Tabloid":r=11;i=17;break;case"Custom":i=n("#"+this._id+"_paperHeight").data("ejNumericTextbox").getValue();r=n("#"+this._id+"_paperWidth").data("ejNumericTextbox").getValue()}return u.height=i,u.width=r,u},_pageSetupSubmit:function(){var i=n("#"+this._id+"_paperHeight").data("ejNumericTextbox").getValue(),r=n("#"+this._id+"_paperWidth").data("ejNumericTextbox").getValue(),u=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox").getValue(),f=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox").getValue(),e=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox").getValue(),o=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox").getValue(),s;this._paperSetup.paperHeight=t.isNullOrUndefined(i)?null:i;this._paperSetup.paperWidth=t.isNullOrUndefined(r)?null:r;this._paperSetup.MarginTop=t.isNullOrUndefined(u)?null:u;this._paperSetup.MarginRight=t.isNullOrUndefined(f)?null:f;this._paperSetup.MarginBottom=t.isNullOrUndefined(e)?null:e;this._paperSetup.MarginLeft=t.isNullOrUndefined(o)?null:o;s=n("#"+this._id+"_PaperSize").data("ejDropDownList");this._paperName=s.model.value;this._paperOrientation=i<r?"Landscape":"Portrait";this._pageSetup=!0;this.model.pageSettings.height=this._paperSetup.paperHeight;this.model.pageSettings.width=this._paperSetup.paperWidth;this.model.pageSettings.orientation=this._paperOrientation;this.model.pageSettings.paperSize=this._paperName;this.model.pageSettings.margins.top=this._paperSetup.MarginTop;this.model.pageSettings.margins.right=this._paperSetup.MarginRight;this.model.pageSettings.margins.bottom=this._paperSetup.MarginBottom;this.model.pageSettings.margins.left=this._paperSetup.MarginLeft;t.isNullOrUndefined(i)||t.isNullOrUndefined(r)||t.isNullOrUndefined(u)||t.isNullOrUndefined(f)||t.isNullOrUndefined(e)||t.isNullOrUndefined(o)||(u+e>=i||o+f>=r?alert("The margins are overlapped or they are off the paper.Enter a different margin size."):n("#"+this._id+"_ejtb_preview").hasClass("e-active")?t.isNullOrUndefined(this._paperSetup.paperWidth)||t.isNullOrUndefined(this._paperSetup.paperHeight)||(this._updatePreviewLayout(!this._id._printMode,!0),n("#"+this._id+"_printPageSetup").ejDialog("close")):n("#"+this._id+"_printPageSetup").ejDialog("close"))},_pageSetupCancel:function(){var t=n("#"+this._id+"_printPageSetup").ejDialog("close")},_showFittoPage:function(t){t?n("#"+this._id+"_ejtb_fittopage").parents("li.e-reportviewer-toolbarli").css("display","block"):n("#"+this._id+"_ejtb_fittopage").parents("li.e-reportviewer-toolbarli").css("display","none")},_resetPage:function(){var i=null,r=null,t=n("#"+this._id+"_pageviewContainer"),u=n("#"+this._id+"_pageviewOuterline");u.css({width:t.width(),height:t.height()});this._applyPageTransform(t,this._preZoomVal,this._preZoomVal);this._browserInfo.name=="msie"&&this._browserInfo.version==8?(i=t[0].getBoundingClientRect().right,r=t[0].getBoundingClientRect().bottom):(i=t[0].getBoundingClientRect().width,r=t[0].getBoundingClientRect().height);u.css({width:i,height:r})},_fitToPage:function(t){var f=null,e=null;this._resetPage();var a=n("#"+this._id+"_viewerContainer"),i=n("#"+this._id+"_pageviewContainer"),o=n("#"+this._id+"_pageviewOuterline"),s=a.width(),h=a.height(),c=o.width(),l=o.height(),r=1,u=1;return this._browserInfo.name=="msie"&&this._browserInfo.version==8?(f=i[0].getBoundingClientRect().right,e=i[0].getBoundingClientRect().bottom):(f=i[0].getBoundingClientRect().width,e=i[0].getBoundingClientRect().height),t=="fitToPage"?(r=(s-40)/c*this._preZoomVal,u=(h-40)/l*this._preZoomVal,h>l&&(u=this._preZoomVal),s>c&&(r=this._preZoomVal),this._applyPageTransform(i,r,u,t),o.css({width:f,height:e})):t=="wholepage"?h<l&&(u=(h-40)/l*this._preZoomVal,this._applyPageTransform(i,this._preZoomVal,u,t),r=this._preZoomVal,o.css({width:f,height:e})):t=="fitToWidth"&&s<c&&(r=(s-40)/c*this._preZoomVal,this._applyPageTransform(i,r,this._preZoomVal,t),u=this._preZoomVal,o.css({width:f,height:e})),{scalX:r,scalY:u}},_selectDropDownIndex:function(t){var i=n(n("#"+this._id+"_toolbar_zoomSelection_popup li")[t]);i.addClass("e-active");n("#"+this._id+"_toolbar_zoomSelection_input").val(i.text())},_applyDropDownVal:function(t,i,r){if(r){var u=t.scalX>t.scalY?t.scalY:t.scalX;n("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(u*100)+"%");n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else i?(n("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(t.scalX*100)+"%"),n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(n("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(t.scalY*100)+"%"),n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_pageFitMenuClick:function(t){var o;if(o=n(t.target).hasClass("e-reportviewer-icon")?n(t.target).attr("fitType"):t.target.className,o){var f=n("#"+this._id+"_pageWidth"),r=f.find("span.e-reportviewer-icon"),u=n("#"+this._id+"_pageHeight"),e=u.find("span.e-reportviewer-icon"),s=n("#"+this._id+"_viewerContainer"),h=n("#"+this._id+"_pageviewOuterline"),l=n("#"+this._id+"_pageviewContainer"),a=s.width(),v=s.height(),c=h.width(),y=h.height(),p=l.width(),b=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i,w=o;switch(w){case"FITTOPAGE":i=this._fitToPage("fitToPage");this._applyDropDownVal(i,!1,!0);break;case"PAGEWIDTH":case"e-reportviewer-popupli e-fitpagewidth":if(f.attr("isSelect")=="true")u.attr("isSelect")=="true"?(i=this._fitToPage("fitToPage"),this._applyDropDownVal(i,!1,!0)):(this._resetPage(),this._selectDropDownIndex(this._zoomLevel)),r.removeClass("e-reportviewer-pagefittopage"),r.addClass("e-reportviewer-emptyconetent"),f.attr("isSelect","false");else{if(a>c){u.attr("isSelect")=="true"&&c!=p&&(i=this._fitToPage("fitToWidth"),this._applyDropDownVal(i,!0,!1),f.attr("isSelect","true"),r.addClass("e-reportviewer-pagefittopage"),r.removeClass("e-reportviewer-emptyconetent"),e.addClass("e-reportviewer-emptyconetent"),e.removeClass("e-reportviewer-pagefittopage"),u.attr("isSelect","false"));return}u.attr("isSelect")=="true"?(i=this._fitToPage("fitToPage"),this._applyDropDownVal(i,!1,!0)):(i=this._fitToPage("fitToWidth"),this._applyDropDownVal(i,!0,!1));f.attr("isSelect","true");r.addClass("e-reportviewer-pagefittopage");r.removeClass("e-reportviewer-emptyconetent")}break;case"WHOLEPAGE":case"e-reportviewer-popupli e-fitpageheight":if(u.attr("isSelect")=="true")f.attr("isSelect")=="true"?(i=this._fitToPage("fitToWidth"),this._applyDropDownVal(i,!0,!1)):(this._resetPage(),this._selectDropDownIndex(this._zoomLevel)),e.addClass("e-reportviewer-emptyconetent"),e.removeClass("e-reportviewer-pagefittopage"),u.attr("isSelect","false");else{if(v>y)return;i=this._fitToPage("fitToPage");this._applyDropDownVal(i,!1,!0);e.addClass("e-reportviewer-pagefittopage");e.removeClass("e-reportviewer-emptyconetent");u.attr("isSelect","true");r.removeClass("e-reportviewer-pagefittopage");r.addClass("e-reportviewer-emptyconetent");f.attr("isSelect","false")}}n("#"+this._id+"_toolbar_fittoPagePopup").hide()}},_showFitToPagetip:function(){var t=n("#"+this._id+"_toolbar_fittoPagePopup"),r,i;t.length>0||(t=this._renderPageFitPopup(),n("body").append(t),this._on(n("#"+this._id+"_toolbar_fittoPagePopup li.e-reportviewer-popupli"),"click",this._pageFitMenuClick));t.css("display")=="block"?t.css("display","none"):(t.css("display","block"),this._renderFitopagePopup());r=n("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit").height();i=n(n("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit")[0]).offset();t.css({top:i.top+r-3,left:i.left-5})},_zoomValChange:function(t){var r=n(this.element).closest(".e-reportviewer"),i=r.ejReportViewer("instance"),u=parseInt(t.value)/100;i._zoomLevel=t.itemId;i._zoomContainer(u,!1)},_zoomIn:function(){if(this._zoomLevel>=6?this._zoomLevel=6:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t.selectItemsByIndices(this._zoomLevel)}},_zoomOut:function(){if(this._zoomLevel<=0?this._zoomLevel=0:this._zoomLevel--,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t.selectItemsByIndices(this._zoomLevel)}},_mobileLayoutZoomChange:function(){this._zoomContainer([.5,.75,1,1.25,1.5,2,4][this._zoomLevel],!1)},_zoomInContainer:function(t,i){var e=i,s=n("#"+this._id+"_viewerContainer"),f=n("#"+this._id+"_pageviewContainer"),o=n("#"+this._id+"_pageviewOuterline"),r,u;t&&(this._zoomVal=this._zoomVal+e);r=f.width();u=f.height();this.model.printMode&&(r=r+(this._pageModel.MarginLeft+this._pageModel.MarginRight),u=u+(this._pageModel.MarginTop+this._pageModel.MarginBottom));this._applyPageTransform(f,this._zoomVal,this._zoomVal);o.css({width:r*this._zoomVal,height:u*this._zoomVal})},_zoomOutContainer:function(t,i){var e=i,s=n("#"+this._id+"_viewerContainer"),r=n("#"+this._id+"_pageviewContainer"),o=n("#"+this._id+"_pageviewOuterline"),u,f;t&&(this._zoomVal=this._zoomVal-e);u=r.width();f=r.height();this._applyPageTransform(r,this._zoomVal,this._zoomVal);o.css({width:u*this._zoomVal,height:f*this._zoomVal})},_applyPageTransform:function(t,i,r,u){var f="scale("+i+","+r+")",e;if(this._browserInfo.name=="msie"){this._browserInfo.version=="8.0"?t.css({zoom:i}):t.css({"-ms-transform":f,"-ms-transform-origin":"0 0"});this._setZoomScrollerIE();e=n("#"+this._id+"_viewerContainer");switch(u){case"fitToPage":e.css({"overflow-x":"hidden","overflow-y":"hidden"});break;case"wholepage":e.css({"overflow-y":"hidden"});break;case"fitToWidth":e.css({"overflow-x":"hidden"})}}else this._browserInfo.name=="opera"?t.css({"-o-transform":f,"-o-transform-origin":"0 0"}):this._browserInfo.name=="mozilla"?this._browserInfo.version=="11.0"?t.css({transform:f,"transform-origin":"0 0"}):t.css({"-moz-transform":f,"-moz-transform-origin":"0 0"}):(this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome")&&t.css({"-webkit-transform":f,"-webkit-transform-origin":"0 0"})},_zoomContainer:function(t,i){var r;this._zoomVal=t;var e=n("#"+this._id+"_pageWidth"),o=n("#"+this._id+"_pageHeight"),u=e.find("span.e-reportviewer-icon"),f=o.find("span.e-reportviewer-icon");if((e.attr("isSelect")=="true"||o.attr("isSelect")=="true")&&this._resetPage(),u&&(u.removeClass("e-reportviewer-pagefittopage"),u.addClass("e-reportviewer-emptyconetent")),f&&(f.addClass("e-reportviewer-emptyconetent"),f.removeClass("e-reportviewer-pagefittopage")),r=Math.abs(this._preZoomVal-t),r==0)return!1;this._preZoomVal>t?this._zoomOutContainer(i,r):this._zoomInContainer(i,r);this._preZoomVal=t},_setZoomScrollerIE:function(t){if(this._browserInfo.name=="msie"&&this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0){var i=n("#"+this._id+"_viewerContainer"),r=this._pageModel.PageData[0],s=r.Height,u=r.Width,h=r.HeaderHeight,c=r.FooterHeight,f=s+h+c,e=i.height(),o=i.width();f=f*t;u=u*t;i.css({overflow:"hidden"});i.css({"overflow-x":"Auto"});i.css({"overflow-y":"Auto"});f<e&&u<o?(i.css({"overflow-x":"hidden"}),i.css({"overflow-y":"hidden"})):u<o?i.css({"overflow-x":"hidden"}):f<e&&i.css({"overflow-y":"hidden"})}},_showZoomControl:function(t){t?(n("#"+this._id+"_toolbar_zoomin").parents("li.e-reportviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-reportviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-reportviewer-ejdropdownlist").css("display","block")):(n("#"+this._id+"_toolbar_zoomin").parents("li.e-reportviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-reportviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-reportviewer-ejdropdownlist").css("display","none"))},_refreshReport:function(){this._refresh=!0;this._dataRefresh=!0;this._unwireEvents();this._initViewer();this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSourceCredentials:this.model.dataSourceCredentials,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")},_showRefreshButton:function(t){t?n("#"+this._id+"_toolbar_refresh").parent().css("display","block"):n("#"+this._id+"_toolbar_refresh").parent().css("display","none")},_wireEvents:function(){this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._on(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._on(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick));this._on(n("#"+this._id+"_viewerContainer"),"scroll",this._scrollPage);this._on(n("#"+this._id+"_pageviewOuterContainer"),"click",this._viewerClick);this._on(n(document),"click",this._onReporClick);this._isDevice||(this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseover",this._showIconToolTip),this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseout",this._hideIconToolTip))},_unwireEvents:function(){this.model.toolbarSettings.templateId||(this._off(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._off(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._off(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick));this._off(n("#"+this._id+"_viewerContainer"),"scroll",this._scrollPage);this._off(n("#"+this._id+"_pageviewOuterContainer"),"click",this._viewerClick);this._off(n(document),"click",this._onReporClick);this._off(n("#"+this._id+"_viewReportClick"),"click",this._viewReportParamsClick);this._off(n(window),"resize",this._viewerResize);this._isDevice||(this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseover",this._showIconToolTip),this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseout",this._hideIconToolTip))},_onReporClick:function(t){var i,u,r,f;n(t.target).hasClass("e-reportviewer-export")||n(n(t.target).children()).hasClass("e-reportviewer-export")?n("#"+this._id+"_toolbar_exportListTip").css("display")!="block"&&n("#"+this._id+"_toolbar_exportListTip").css("display","none"):n("#"+this._id+"_toolbar_exportListTip").css("display","none");n(t.target).hasClass("e-reportviewer-pagefit")||n(n(t.target).children()).hasClass("e-reportviewer-pagefit")?n("#"+this._id+"_toolbar_fittoPagePopup").css("display")!="block"&&n("#"+this._id+"_toolbar_fittoPagePopup").css("display","none"):n("#"+this._id+"_toolbar_fittoPagePopup").css("display","none");this._isDevice&&(i=n("#"+this._id+"_device_toolbarContainer"),u=t.target,!i.is(":visible")&&n(u).hasClass("e-device-reportviewer-toolbarspan")||n(u).closest("#"+this._id+"_device_toolbarContainer").hasClass("e-device-reportviewer-toolbarcontainer")?(i.css("display","block"),r=n("#"+this._id+"_toolbarContainer")[0].getBoundingClientRect(),f=i[0].getBoundingClientRect(),i.css("left",r.left+r.width-f.width+"px"),i.css("top",+r.top+r.height+"px")):i.css("display","none"))},_onToolbarItemClick:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_toolbarClick:function(t){var i=t.target;if(this._isToolbarClick){if(this._isPageDialogOpened())return;n("#"+this._id+"_rptTooltip").css("display","none");n(i).hasClass("e-reportviewer-toolbarli")&&(i=n(i).find("span"));n(i).hasClass("e-reportviewer-print")?this._print():n(i).hasClass("e-reportviewer-export")?this._showTooltip():n(i).hasClass("e-reportviewer-pagesetup")?this._showPrintPageSetup():n(i).hasClass("e-reportviewer-gotofirst")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoFirstPage():n(i).hasClass("e-reportviewer-gotolast")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoLastPage():n(i).hasClass("e-reportviewer-gotonext")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoNextPage():n(i).hasClass("e-reportviewer-gotoprevious")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoPreviousPage():n(i).hasClass("e-reportviewer-gotoparent")?this._gotoParentReport():n(i).hasClass("e-reportviewer-documentmap")&&!this._printMode?this._documentMapClick():n(i).hasClass("e-reportviewer-zoomin")?this._zoomIn():n(i).hasClass("e-reportviewer-zoomout")?this._zoomOut():n(i).hasClass("e-reportviewer-pagefit")?this._showFitToPagetip():n(i).hasClass("e-reportviewer-preview")?this._printlayout():n(i).hasClass("e-reportviewer-refresh")?this._refreshReport():n(i).hasClass("e-reportviewer-parameter")&&this._toggleParameterBlock()}},_showToolbar:function(t){t?n("#"+this._id+"_toolbarContainer").css("display","block"):n("#"+this._id+"_toolbarContainer").css("display","none")},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");this._refresh?t.selectItemsByIndices(t.model.selectedIndex):t.selectItemsByIndices(2);t.disable();n("#"+this._id+"_txtpageNo").attr("disabled","disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotofirst").addClass("e-reportviewer-disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotoprevious").addClass("e-reportviewer-disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotonext").addClass("e-reportviewer-disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotolast").addClass("e-reportviewer-disabled")}},_enableToolbarItems:function(){this._isToolbarClick=!0;this.model.toolbarSettings.templateId||this._isDevice||(n("#"+this._id+"_txtpageNo").removeAttr("disabled"),n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable())},_enableToolbarContents:function(t){t?(n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable(),n("#"+this._id+"_txtpageNo").attr("readonly",!1)):(n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").disable(),n("#"+this._id+"_txtpageNo").attr("readonly",!0))},_showIconToolTip:function(t){n("#"+this._id+"_rptTooltip").css("display")=="none"&&this._showTooltipContent(t)},_hideIconToolTip:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_viewpopupBlockNone:function(n){return t.isNullOrUndefined(n)||n.length==0||n.css("display")!="block"?!1:!0},_isPageDialogOpened:function(){var i=n("#"+this._id+"_printPageSetup").data("ejDialog");return!t.isNullOrUndefined(i)&&i.isOpen()?!0:!1},_showTooltipContent:function(t){var r=t.target,i,u,f;this.model.toolbarSettings.showTooltip&&!this._isDevice&&(f=!0,n(r).hasClass("e-reportviewer-toolbarli")&&(r=n(r).find("span")),(this._viewpopupBlockNone(n("#"+this._id+"_toolbar_fittoPagePopup"))||this._viewpopupBlockNone(n("#"+this._id+"_toolbar_exportListTip"))||this._isPageDialogOpened())&&(f=!1),n(r).hasClass("e-reportviewer-print")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-print")[0].getBoundingClientRect(),u=this._getTootipText("print")):n(r).hasClass("e-reportviewer-export")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-export")[0].getBoundingClientRect(),u=this._getTootipText("export")):n(r).hasClass("e-reportviewer-gotofirst")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotofirst")[0].getBoundingClientRect(),u=this._getTootipText("first")):n(r).hasClass("e-reportviewer-gotolast")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotolast")[0].getBoundingClientRect(),u=this._getTootipText("last")):n(r).hasClass("e-reportviewer-gotonext")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotonext")[0].getBoundingClientRect(),u=this._getTootipText("next")):n(r).hasClass("e-reportviewer-gotoprevious")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotoprevious")[0].getBoundingClientRect(),u=this._getTootipText("previous")):n(r).hasClass("e-reportviewer-documentmap")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-documentmap")[0].getBoundingClientRect(),u=this._getTootipText("documentmap")):n(r).hasClass("e-reportviewer-zoomin")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-zoomin")[0].getBoundingClientRect(),u=this._getTootipText("zoomin")):n(r).hasClass("e-reportviewer-zoomout")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-zoomout")[0].getBoundingClientRect(),u=this._getTootipText("zoomout")):n(r).hasClass("e-reportviewer-preview")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-preview")[0].getBoundingClientRect(),u=this._getTootipText("preview")):n(r).hasClass("e-reportviewer-refresh")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-refresh")[0].getBoundingClientRect(),u=this._getTootipText("refresh")):n(r).hasClass("e-reportviewer-parameter")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-parameter")[0].getBoundingClientRect(),u=this._getTootipText("parameter")):n(r).hasClass("e-reportviewer-gotoparent")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotoparent")[0].getBoundingClientRect(),u=this._getTootipText("back")):n(r).hasClass("e-reportviewer-tbpage")||n(r).hasClass("e-reportviewer-pagenumber")||n(r).hasClass("e-reportviewer-labelpageno")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-tbpage")[0].getBoundingClientRect(),u=this._getTootipText("pageIndex")):n(r).hasClass("e-reportviewer-ejdropdownlist")||n(r).hasClass("e-dropdownlist")||n(r).hasClass("e-select")||n(r).hasClass("e-down-arrow")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist")[0].getBoundingClientRect(),u=this._getTootipText("zoom")):n(r).hasClass("e-reportviewer-pagefit")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit")[0].getBoundingClientRect(),u=this._getTootipText("fittopage")):n(r).hasClass("e-reportviewer-pagesetup")&&(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-pagesetup")[0].getBoundingClientRect(),u=this._getTootipText("pagesetup")),u&&f&&(n("#"+this._id+"_rptTooltip_Header").html(u.header),n("#"+this._id+"_rptTooltip_Content").html(u.content),this._browserInfo.name=="msie"&&this._browserInfo.version==8?n("#"+this._id+"_rptTooltip").css({top:i.top+(i.bottom-i.top)+5,left:i.left+(i.right-i.left)/2,display:"block",position:"fixed"}):n("#"+this._id+"_rptTooltip").css({top:i.top+i.height+5,left:i.left+i.width/2,display:"block",position:"fixed"})))},_getTootipText:function(n){var i=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],r="",u="";switch(n){case"print":r=i.toolbar.print.headerText;u=i.toolbar.print.contentText;break;case"export":r=i.toolbar.exportformat.headerText;u=i.toolbar.exportformat.contentText;break;case"first":r=i.toolbar.first.headerText;u=i.toolbar.first.contentText;break;case"previous":r=i.toolbar.previous.headerText;u=i.toolbar.previous.contentText;break;case"next":r=i.toolbar.next.headerText;u=i.toolbar.next.contentText;break;case"last":r=i.toolbar.last.headerText;u=i.toolbar.last.contentText;break;case"zoomin":r=i.toolbar.zoomIn.headerText;u=i.toolbar.zoomIn.contentText;break;case"zoomout":r=i.toolbar.zoomOut.headerText;u=i.toolbar.zoomOut.contentText;break;case"preview":r=i.toolbar.printLayout.headerText;u=i.toolbar.printLayout.contentText;break;case"documentmap":r=i.toolbar.documentMap.headerText;u=i.toolbar.documentMap.contentText;break;case"refresh":r=i.toolbar.refresh.headerText;u=i.toolbar.refresh.contentText;break;case"parameter":r=i.toolbar.parameter.headerText;u=i.toolbar.parameter.contentText;break;case"back":r=i.toolbar.back.headerText;u=i.toolbar.back.contentText;break;case"pageIndex":r=i.toolbar.pageIndex.headerText;u=i.toolbar.pageIndex.contentText;break;case"zoom":r=i.toolbar.zoom.headerText;u=i.toolbar.zoom.contentText;break;case"fittopage":r=i.toolbar.fittopage.headerText;u=i.toolbar.fittopage.contentText;break;case"pagesetup":r=i.toolbar.pagesetup.headerText;u=i.toolbar.pagesetup.contentText}return{header:r,content:u}},_drillAction:function(){n._data(n(".txtToggle_"+this._id).get(0),"events")==i&&this._on(n(".txtToggle_"+this._id),"click",this._drillClick)},_drillClick:function(t){var i=n(t.currentTarget).data("drillObj");i&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.drillDown,pageindex:this._currentPage,toggleInfo:i,refresh:!1,dataRefresh:!1,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")},_sortingAction:function(){n._data(n(".txtSorting_"+this._id).get(0),"events")==i&&this._on(n(".txtSorting_"+this._id),"click",this._sortingClick)},_sortingClick:function(t){var i=n(t.currentTarget).data("sortingObj");i&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.sorting,pageindex:this._currentPage,sortingInfo:i,refresh:!1,dataRefresh:!1,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")},_showDocumentMap:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-documentmap").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-documentmap").parent().css("display","none")},_appendDocumentMapDiv:function(){if(this._isDevice){var i=n("#"+this._id+"_documentmapContainer");i.length==0&&(i=t.buildTag("div.e-reportviewer-documentmappopup","",{display:"none"},{id:this._id+"_documentmapContainer"}),n("body").append(i))}},_selectDocMapToolItem:function(t){if(!this.model.toolbarSettings.templateId){var i=n("#"+this._id+"_toolbarContainer").data("ejToolbar");t?i.selectItemByID(this._id+"_ejtb_documentmap"):i.deselectItemByID(this._id+"_ejtb_documentmap")}},_documentMapClick:function(){var t,i;this._isDevice?(i=n("#"+this._id+"_documentmapContainer"),i.css("display")=="block"?(this._pageDocMapFlag=!0,i.css("display","none"),this._selectDocMapToolItem(!1)):(this._pageDocMapFlag=!1,i.css("display","block"),this._selectDocMapToolItem(!0))):(t=n("#"+this._id+"_reportviewerContainer").data("ejSplitter"),n(t.panes[0]).hasClass("collapsed")?(this._pageDocMapFlag=!0,t.expand(0),this._selectDocMapToolItem(!0)):(this._pageDocMapFlag=!1,t.collapse(0),this._selectDocMapToolItem(!1)))},_showDocumentMapContainer:function(t){if(this._isDevice)t?n("#"+this._id+"_documentmapContainer").css("display","block"):n("#"+this._id+"_documentmapContainer").css("display","none");else{var i=n("#"+this._id+"_reportviewerContainer").data("ejSplitter");t?i.expand(0):i.collapse(0)}},_documentMapAction:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.documentMap}),"_documentMapModel")},_containerSplit:function(i){var r=n("#"+this._id+"_viewerContainer");this._appendDocumentMapDiv();i=i.replace("treeViewID",this._id+"_ejtreeView");n("#"+this._id+"_documentmapContainer").css("height","100%");n("#"+this._id+"_documentmapContainer").html(i);n("#"+this._id+"_ejtreeView").css("display","none");n("#"+this._id+"_ejtreeView").ejTreeView({height:r.height(),nodeSelect:this._pageNavigate});this._isDevice?n("#"+this._id+"_documentmapContainer").css({position:"absolute",left:r.offset().left,top:r.offset().top,height:r.height(),width:r.width()/6}):n("#"+this._id+"_reportviewerContainer").ejSplitter({height:r.height()+1,orientation:t.Orientation.Horizontal,properties:[{paneSize:140},{}]});n("#"+this._id+"_ejtreeView").css("display","block");this._selectDocMapToolItem(!0)},_pageNavigate:function(t){try{var i=JSON.parse(n(t.currentElement).attr("id")),r=this._id.replace("_ejtreeView",""),u=n("#"+r).data("ejReportViewer");u._isDevice&&(n("#"+r+"_documentmapContainer").css("display","none"),this._selectDocMapToolItem(!1));u._gotoPageNo(i.PageNo);n("#"+r+"_viewerContainer").animate({scrollTop:i.TopPos-12,scrollLeft:i.LeftPos-12},"600")}catch(f){}},_showDrillThrough:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-gotoparent").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-gotoparent").parent().css("display","none")},_drillThroughAction:function(){n._data(n(".drillAction_"+this._id).get(0),"events")==i&&this._on(n(".drillAction_"+this._id),"click",this._drillThroughClick)},_drillThroughClick:function(i){var u=null,r=null,f,e,s,o;if(this.pluginName=="ejChart"){if(r=n("#"+this.ejreportid).data("ejReportViewer"),n("#"+this._id+"_svg_TrackToolTip").css("display","none"),f=n("#"+this._id).data(this._id+"actionObj_Series"+i.data.region.SeriesIndex),t.isNullOrUndefined(f))return!1;u=f[i.data.region.Region.PointIndex]}else if(this.pluginName=="ejMap"){if(r=n("#"+this.ejreportid).data("ejReportViewer"),i.originalEvent[0]==null||t.isNullOrUndefined(i.originalEvent[0].data))return;u=i.originalEvent[0].data.ShapeActionInfo}else r=this,u=n(i.currentTarget).data("actionObj");u&&(e={actionInfo:n.extend(!0,{},u)},s=r._onDrillThrough(e),s||(u.Hyperlink?window.open(u.Hyperlink):u.ReportName&&(o=e.actionInfo,r._childReportAuthentication=r._getAuthenticationToken(),r._showloadingIndicator(!0),r.doAjaxPost("POST",r._actionUrl,JSON.stringify({reportAction:r._reportAction.drillThrough,reportName:o.ReportName,parameters:o.Parameters,authKey:r._childReportAuthentication}),"_drillThroughModel"))))},_gotoParentReport:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_gotoParentReportModel")},_setInitialization:function(){this._dataSources=null;this._authenticationToken=null;this._childReportAuthentication=null;this._refresh=!1;this._isToolbarClick=!1;this._pageModel=null;this._currentPage=1;this._reportParameters=null;this._reportDataSources=null;this._reporDataSets=null;this._zoomLevel=2;this._isDocumentMap=!1},_cloneReportViewerProperties:function(){var t={};return t.model=n.extend(!0,{},this.model),t._dataSources=n.extend(!0,{},this._dataSources),t._authenticationToken=this._authenticationToken,t._childReportAuthentication=this._childReportAuthentication,t._refresh=this._refresh,t._isToolbarClick=this._isToolbarClick,t._pageModel=n.extend(!0,{},this._pageModel),t._currentPage=this._currentPage,t._reportParameters=n.extend(!0,{},this._reportParameters),t._reportDataSources=n.extend(!0,{},this._reportDataSources),t._reporDataSets=n.extend(!0,{},this._reporDataSets),t._zoomLevel=this._zoomLevel,t._preZoomVal=this._preZoomVal,t._isDevice=this._isDevice,t._originX=this._originX,t._originY=this._originY,t._printMode=this._printMode,t._pageSetup=this._pageSetup,t._isDocumentMap=this._isDocumentMap,t},_setParentReportViewerProperties:function(){var t=this._parents[this._parents.length-1],n=t.parentPro;this.model=n.model;this._dataSources=n._dataSources;this._authenticationToken=n._authenticationToken;this._childReportauthentication=n._childReportAuthentication;this._refresh=n._refresh;this._isToolbarClick=n._isToolbarClick;this._pageModel=n._pageModel;this._currentPage=n._currentPage;this._reportParameters=n._reportParameters;this._reportDataSources=n._reportDataSources;this._reporDataSets=n._reporDataSets;this._zoomLevel=n._zoomLevel;this._isDocumentMap=n._isDocumentMap;this._preZoomVal=n._preZoomVal;this._printMode=n._printMode;this._originX=n._originX;this._originY=n._originY;this._parentPageXY=t.pagePos;this._parents.pop()},_printlayout:function(){this._updatePreviewLayout(!this._printMode,this._pageSetup)},_selectPreviewToolItem:function(t){if(!this.model.toolbarSettings.templateId){var i=n("#"+this._id+"_toolbarContainer").data("ejToolbar");t?i.selectItemByID(this._id+"_ejtb_preview"):i.deselectItemByID(this._id+"_ejtb_preview")}},_updatePreviewLayout:function(t,i){if(this._printMode=t,this._isSelectedPage=!1,this._printMode?(this._currentPage=1,this._pageLayoutPage=this._currentPage):this._currentPage=this._pageLayoutPage,this._selectPreviewToolItem(this._printMode),this._isPageDocMap&&!this._isDocumentMap&&this._showDocumentMapContainer(this._printMode?!1:this._pageDocMapFlag),this.model.printMode=this._printMode,i){var u=n("#"+this._id+"_PaperSize").data("ejDropDownList"),r=this._getPaperSize(u.model.value),f=n("#"+this._id+"_landscape").data("ejRadioButton"),e=n("#"+this._id+"_portrait").data("ejRadioButton");u.model.value=="Custom"?this._paperOrientation=="Portrait"&&r.height>r.width||this._paperOrientation=="Landscape"&&r.height<r.width?(this._paperSetup.paperHeight=r.height,this._paperSetup.paperWidth=r.width):(this._paperSetup.paperHeight=r.width,this._paperSetup.paperWidth=r.height):this._paperOrientation=="Landscape"?(this._paperSetup.paperHeight=r.width,this._paperSetup.paperWidth=r.height):(this._paperSetup.paperHeight=r.height,this._paperSetup.paperWidth=r.width);this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode,PageSetup:this._paperSetup}),this._printMode?"_getPreviewModel":"_getPageModel")}else this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")},_showPreviewButton:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-preview").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-preview").parent().css("display","none")},_setCultureInfo:function(){var i=this.model.locale,s=n("#"+this._id+"Pagewidthspan"),h=n("#"+this._id+"pageheightSpan"),e=n("#"+this._id+"_pageWidth"),o=n("#"+this._id+"_pageHeight"),f,r,u;if(n("#"+this._id+"_viewReportClick").val(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].viewButton:t.ReportViewer.Locale["en-US"].viewButton),n("#"+this._id+"_pdf").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Pdf:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Pdf),n("#"+this._id+"_xls").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Excel:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Excel),n("#"+this._id+"_word").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Word:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Word),n("#"+this._id+"_html").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Html:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Html),n("#"+this._id+"_ppt").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.PPT:t.ReportViewer.Locale["en-US"].toolbar.exportformat.PPT),f=n("#"+this._id+"_printPageSetup").data("ejDialog"),f&&f.setTitle(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.pagesetup.headerText:t.ReportViewer.Locale["en-US"].toolbar.pagesetup.headerText),n("#"+this._id+"_Submit").val(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.doneButton:t.ReportViewer.Locale["en-US"].pagesetupDialog.doneButton),n("#"+this._id+"_Cancel").val(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.cancelButton:t.ReportViewer.Locale["en-US"].pagesetupDialog.cancelButton),n("#"+this._id+"_heightLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.height+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.height+" "),n("#"+this._id+"_widthLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.width+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.width+" "),n("#"+this._id+"_topLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.top+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.top+" "),n("#"+this._id+"_bottomLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.bottom+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.bottom+" "),n("#"+this._id+"_rightLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.right+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.right+" "),n("#"+this._id+"_leftLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.left+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.left+" "),n("#"+this._id+"_heightUnitLabel","#"+this._id+"_widthUnitLabel","#"+this._id+"_topUnitLabel","#"+this._id+"_rightUnitLabel","#"+this._id+"_bottomUnitLabel","#"+this._id+"_leftUnitLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.unit+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.unit+" "),n("#"+this._id+"_portraitLabel").html(t.ReportViewer.Locale[i]?" "+t.ReportViewer.Locale[i].pagesetupDialog.portrait:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.portrait),n("#"+this._id+"_landscapeLabel").html(t.ReportViewer.Locale[i]?" "+t.ReportViewer.Locale[i].pagesetupDialog.landscape:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.landscape),n("#"+this._id+"_paperSizeLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.paperSize:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.paperSize),n("#"+this._id+"_marginheader").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.margins:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.margins),n("#"+this._id+"_orientationLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.orientation:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.orientation),e.html(s),e.append(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.fittopage.pageWidth:t.ReportViewer.Locale["en-US"].toolbar.fittopage.pageWidth),o.html(h),o.append(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.fittopage.pageHeight:t.ReportViewer.Locale["en-US"].toolbar.fittopage.pageHeight),r=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").find(".e-reportviewer-DateTime"),r&&r.length>0)for(u=0;u<r.length;u++)n("#"+n(r[u]).attr("id")).data("ejDatePicker").setModel({locale:this.model.locale})},_renderPages:function(){var t,i,n;if(this.model.enablePageVirtualization||this.model.enablePageCache){if(t=this._printMode?this._printPageCache:this._pageCache,t.length-1<this._pageModel.TotalPages)for(n=this._currentPage+1;n<=this._pageModel.TotalPages;n++)t[n]=null;if(_pageNos=[],i=this._isForwardDirection?this._currentPage+1:this._currentPage-1,this._isSelectedPage)for(n=i;n<=this._pageModel.TotalPages;this._isForwardDirection?n++:n--)if(t[n]==null&&typeof t[n]!="undefined"){if(_pageNos.push(n),_pageNos.length==2&&(n=n>this._currentPage?n:this._currentPage,this._isForwardDirection=!0),_pageNos.length==4)break}else typeof t[n]=="undefined"&&(n=this._currentPage,this._isForwardDirection=!0);else for(n=i;n<=this._pageModel.TotalPages&&n>1;this._isForwardDirection?n++:n--)if(t[n]==null&&(typeof t[n]!="undefined"&&_pageNos.push(n),_pageNos.length==3))break;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,pageVirtualization:this.model.enablePageVirtualization,dataRefresh:this._dataRefresh,pageNumbers:_pageNos,pageInit:this._isToolbarClick,isPrint:this._printMode}),"_getRenderedPages")}},_getRenderedPages:function(n){if(n.pgmodel.length>0)for(var t=0;t<n.pgmodel.length;t++)n.pgmodel[t]&&n.pgmodel[t].Value.PageData&&(this._pageModel=n.pgmodel[t].Value,this._storePageCache(n.pgmodel[t].Key))},_storePageCache:function(n){this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0&&(this._pageContains(n)||(this.model.enablePageVirtualization||this.model.enablePageCache)&&(this._printMode?this._printPageCache[n]=this._pageModel:this._pageCache[n]=this._pageModel))},_retrievePageCache:function(n){return this._printMode?this._printPageCache[n]:this._pageCache[n]},_pageContains:function(n){var i=this._printMode?this._printPageCache[n]:this._pageCache[n];return!t.isNullOrUndefined(i)},_clearPageCache:function(){this._pageCache=[];this._printPageCache=[]},_itemfadeToggle:function(n){n.fadeToggle()},_popupClick:function(){var t=n("#"+this._id+"_pageInfoPopup");t.fadeIn();t.finish()},_containerScrollStop:function(){var t=n("#"+this._id+"_pageInfoPopup");t.finish().fadeIn();t.finish().fadeOut(3e3)},_viewerClick:function(){n("#"+this._id+"_toolbar_exportListTip").css("display","none")},_pinchAndSwipe:function(n){switch(n.type){case"pinchin":this._zoomOut();break;case"pinchout":this._zoomIn();break;case"swipeleft":this._gotoNextPage();this._isDevice&&this._updatePageNo();break;case"swiperight":this._gotoPreviousPage();this._isDevice&&this._updatePageNo()}},_scrollPage:function(t){var i=n(t.target),u=this._orginY=i.scrollTop(),r;if(this._orginX=i.scrollLeft(),r=n("#"+this._id+"_reportviewerContainer").offset().top,n(".fixed-data").each(function(){var f=n(this).height(),t=n(this).offset().top,e=n(this).position().top,o=f+t-r,i,u;t<=r&&!(o<=r)?(i=r-t,u=e+i,n(this).next("div").css({top:u,visibility:"visible"})):n(this).next("div").css("visibility","collapse")}),this._isDevice)if(u+i.innerHeight()>=i[0].scrollHeight){if(i.scrollTop(2),!this._pageModel||this._currentPage==this._pageModel.TotalPages)return;this._gotoNextPage();this._updatePageNo()}else if(u==0){if(i.scrollTop(2),!this._pageModel||this._currentPage==1)return;this._gotoPreviousPage();this._updatePageNo()}},_showViewerBlock:function(t){if(t){n("#"+this._id+"_viewBlockContainer").css("display","block");var i=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else n("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&n("#"+this._id+"_viewBlockContainer.e-reportviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){n("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t});n("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-reportviewer-waitingpopup")},_showloadingIndicator:function(t){t?(n("#"+this._id+"_loadingIndicator").css("display","block"),n("#"+this._id+"_pageviewOuterContainer").css("display","none")):(n("#"+this._id+"_loadingIndicator").css("display","none"),n("#"+this._id+"_pageviewOuterContainer").css("display","block"));n("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t});n("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-reportviewer-waitingpopup")},_isMobileDevice:function(){return/windows phone|android|iphone/i.test(navigator.userAgent.toLowerCase())},_getAuthenticationToken:function(){function n(){function n(){return((1+Math.random())*65536|0).toString(16).substring(1)}return(n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()).toUpperCase()}return n()+"^"+this._id},_updateToolbarmodel:function(){this._showToolbar(this.model.toolbarSettings.showToolbar);this._showPrintButton(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Print);this._showRefreshButton(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Refresh);this._showZoomControl(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Zoom);this._showFittoPage(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.FittoPage);this._showExportControls(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Export);this._showExportList();this._showPageNavigationControls(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.PageNavigation);this._showParameterBlock(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Parameters);this._showPreviewButton(model.toolbarSettings.items&t.ReportViewer.ToolbarItems.PrintLayout);this._showPrintPageSetupButton(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.PageSetup)},_viewerResize:function(){var t=this;this.model.isResponsive&&(this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){var e=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,o=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,i=n(t.element).height(),r=n(t.element).width(),u,f;o.indexOf("%")!=-1?(t._isPercentHeight=parseInt(o),u=t._isHeight?n(t.element).parent().height():i,i=t._isHeight?u:u/100*t._isPercentHeight):t.element[0].parentElement.clientHeight!=0&&t._isPercentHeight!=-1?i=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&t.element[0].parentElement.clientHeight!=0?i=t.element[0].parentElement.clientHeight:t._browserInfo.name=="msie"&&t._browserInfo.version==8&&t.element[0].parentElement.clientHeight!=0&&(i=t.element[0].parentElement.clientHeight);t.element.height(i);e.indexOf("%")!=-1?(t._isPercentWidth=parseInt(e),f=t._isWidth?n(t.element).parent().width():r,r=t._isWidth?f:f/100*t._isPercentWidth):t.element[0].parentElement.clientWidth!=0&&t._isPercentWidth!=-1?r=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&t.element[0].parentElement.clientWidth!=0?r=t.element[0].parentElement.clientWidth:t._browserInfo.name=="msie"&&t._browserInfo.version==8&&t.element[0].parentElement.clientWidth!=0&&(r=t.element[0].parentElement.clientWidth);t.element.width(r);t._setContainerSize()},200))},_showViewerPage:function(t){t?n("#"+this._id+"_pageviewOuterline").css("display","block"):n("#"+this._id+"_pageviewOuterline").css("display","none");this._isDevice&&n("#"+this._id+"_pageviewOuterline").css("z-index",t?"10":"0")},_updatePageNo:function(){n("#"+this._id+"_popupPageNo").val(this._currentPage);n("#"+this._id+"_pageInfoPopup .e-reportviewer-popuptotalpage").html(" / "+this._pageModel.TotalPages)},_reportReload:function(){this._refresh=!0;this._unwireEvents();this._initViewer();this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.reportLoad,controlId:this._id,reportPath:this.model.reportPath,reportServerUrl:this.model.reportServerUrl,processingMode:this.model.processingMode}),"_reportLoaded")},getDataSetNames:function(){return n.extend(!0,{},this._reporDataSets)},getParameters:function(){return n.extend(!0,{},this._reportParameters)},gotoPageIndex:function(n){this._gotoPageNo(n)},gotoLastPage:function(){this._gotoLastPage()},gotoFirstPage:function(){this._gotoFirstPage()},gotoNextPage:function(){this._gotoNextPage()},gotoPreviousPage:function(){this._gotoPreviousPage()},print:function(){this._print()},printLayout:function(){this._printlayout()},exportReport:function(n){this._exportReport(n)},refresh:function(){this._refreshReport()},fitToPage:function(){this._fitToPage("fitToPage")},fitToPageWidth:function(){this._fitToPage("fitToWidth")},fitToPageHeight:function(){this._fitToPage("wholepage")},_onReportLoaded:function(){this._trigger("reportLoaded")},_onRenderingBegin:function(n){return this._trigger("renderingBegin",n)},_onAjaxRequest:function(n){this._trigger("ajaxBeforeLoad",n)},_onAjaxSuccess:function(n){this._trigger("ajaxSuccess",n)},_onAjaxFailure:function(n){this._trigger("ajaxError",n)},_onRenderingComplete:function(n){this._trigger("renderingComplete",n)},_onReportError:function(n){return this._trigger("reportError",n)},_onViewReportClick:function(n){return this._trigger("viewReportClick",n)},_onDrillThrough:function(n){return this._trigger("drillThrough",n)},_onReportExport:function(n){this._trigger("reportExport",n)},_onReportPrint:function(n){return this._trigger("reportPrint",n),n.isStyleLoad}});t.ReportViewer.ExportOptions={Excel:1,Html:2,Pdf:4,Word:8,PPT:16,All:31};t.ReportViewer.ExcelFormats={Excel97to2003:"excel97to2003",Excel2007:"excel2007",Excel2010:"excel2010",Excel2013:"excel2013"};t.ReportViewer.PPTFormats={PowerPoint97to2003:"powerpoint97to2003",PowerPoint2007:"powerpoint2007",PowerPoint2010:"powerpoint2010",PowerPoint2013:"powerpoint2013"};t.ReportViewer.WordFormats={Doc:"doc",Dot:"dot",Docx:"docx",Word2007:"word2007",Word2010:"word2010",Word2013:"word2013",Word2007Dotx:"word2007dotx",Word2010Dotx:"word2010dotx",Word2013Dotx:"word2013dotx",Word2007Docm:"word2007docm",Word2010Docm:"word2010docm",Word2013Docm:"word2013docm",Word2007Dotm:"word2007dotm",Word2010Dotm:"word2010dotm",Word2013Dotm:"word2013dotm",Rtf:"rtf",Txt:"txt",EPub:"epub",Html:"html",Xml:"xml",Automatic:"automatic"};t.ReportViewer.ProcessingMode={Remote:"remote",Local:"local"};t.ReportViewer.Orientation={Portrait:"Portrait",Landscape:"Landscape"};t.ReportViewer.PaperSize={A3:"A3",A4:"A4",B4_JIS:"B4(JIS)",B5_JIS:"B5(JIS)",Envelope_10:"Envelope #10",Envelope_Monarch:"Envelope Monarch",Executive:"Executive",Legal:"Legal",Letter:"Letter",Tabloid:"Tabloid",Custom:"Custom"};t.ReportViewer.ToolbarItems={Export:1,Zoom:2,PageNavigation:4,Refresh:8,Print:16,DocumentMap:32,Parameters:64,PrintLayout:128,FittoPage:256,PageSetup:512,All:1023};t.ReportViewer.RenderMode={Default:3,Mobile:1,Desktop:2};t.ReportViewer.PrintOptions={Default:"Default",NewTab:"NewTab",None:"None"};t.ReportViewer.Locale={};t.ReportViewer.Locale["en-US"]={toolbar:{print:{headerText:"Print",contentText:"Print the report."},exportformat:{headerText:"Export",contentText:"Select the exported file format.",Pdf:"PDF",Excel:"Excel",Word:"Word",Html:"Html",PPT:"PPT"},first:{headerText:"First",contentText:"Go to the first page of the report."},previous:{headerText:"Previous",contentText:"Go to the previous page of the report."},next:{headerText:"Next",contentText:"Go to the next page of the report."},last:{headerText:"Last",contentText:"Go to the last page of the report."},documentMap:{headerText:"Document Map",contentText:"Show or hide the document map."},parameter:{headerText:"Parameter",contentText:"Show or hide the parameters pane."},zoomIn:{headerText:"Zoom-In",contentText:"Zoom in to the report."},zoomOut:{headerText:"Zoom-Out",contentText:"Zoom out of the report."},refresh:{headerText:"Refresh",contentText:"Refresh the report."},printLayout:{headerText:"Print Layout",contentText:"Change between print layout and normal modes."},pageIndex:{headerText:"Page Number",contentText:"Current page number to view."},zoom:{headerText:"Zoom",contentText:"Zoom in or out on the report."},back:{headerText:"Back",contentText:"Go back to the parent report."},fittopage:{headerText:"Fit to Page",contentText:"Fit the report page to the container.",pageWidth:"Page Width",pageHeight:"Whole Page"},pagesetup:{headerText:"Page Setup",contentText:"Choose page setup option to change paper size, orientation and margins."}},pagesetupDialog:{paperSize:"Paper Size",height:"Height",width:"Width",margins:"Margins",top:"Top",bottom:"Bottom",right:"Right",left:"Left",unit:"in",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",doneButton:"Done",cancelButton:"Cancel"},viewButton:"View Report"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPdfViewer","ej.PdfViewer",{_rootCSS:"e-pdfviewer",_requiresID:!0,element:null,model:null,validTags:["div"],defaults:{serviceUrl:"",hyperlinkOpenState:1,serverActionSettings:{load:"Load",fileUpload:"FileUpload",print:"Load",download:"Download"},documentPath:null,toolbarSettings:{toolbarItem:63,showTooltip:!0},enableHyperlink:!0,enableTextSelection:!0,pdfService:1,locale:"en-US",pageChange:"",documentLoad:"",hyperlinkClick:"",beforePrint:"",afterPrint:"",zoomchange:"",bufferStart:"",bufferEnd:"",annotationAdd:"",annotationRemove:"",annotationPropertiesChange:"",annotationResize:"",isResponsive:!0,pageClick:"",allowClientBuffering:!1,documentUnload:"",ajaxRequestFailure:"",annotationType:null,enableTextMarkupAnnotations:!0,enableHighlightAnnotation:!0,enableStrikethroughAnnotation:!0,enableUnderlineAnnotation:!0,strikethroughSettings:{color:"#ff0000",author:"Guest",opacity:1,subject:"Strikethrough",modifiedDate:null,isLocked:!1},underlineSettings:{color:"#00ff00",author:"Guest",opacity:1,subject:"Underline",modifiedDate:null,isLocked:!1},highlightSettings:{color:"#ffff00",author:"Guest",opacity:1,subject:"Highlight",modifiedDate:null,isLocked:!1}},_isToolbarClick:!1,_curYPos:0,_curXPos:0,_curDown:!1,_pageModel:null,_currentPage:1,_zoomLevel:2,_preZoomVal:1,_fitType:null,_higherZoomIndex:0,_lowerZoomIndex:0,_actionUrl:null,_isDevice:!1,_contextMenu:!1,_zoomVal:1,_currentPageBackup:0,_zoomValBackup:0,_zoomLevelBackup:0,_fitTypeBackup:null,_scrollTop:0,_bgRenderTimer:0,_renderCount:0,_prevDiff:-1,_pointerCount:0,_searchText:null,_selectedIndex:0,_searchPageIndex:0,_isRenderedByPinch:!1,_isPinchLimitReached:!1,_isRerenderCanvasCreated:!1,_isPrinting:!1,_isContainImage:!1,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_isFindboxPresent:!1,_isTextSearch:!1,_isTextHighlighted:!1,_isRequestFired:!1,_isPageScrollHighlight:!1,_isPageScrolledForSearch:!1,_searchAjaxRequestState:null,_isPrevSearch:!1,_isMatchCase:!1,_isPrintHidden:!1,_isNavigationHidden:!1,_isMagnificationHidden:!1,_isDownloadHidden:!1,_isTextSearchHidden:!1,_isZoomCntlHidden:!1,_isDownloadCntlHidden:!1,_isToolbarHidden:!1,_viewerAction:{getPageModel:"GetPageModel"},_scrollTimer:null,_isDestroyed:!1,_pdfService:null,_toolbar:null,_printIframe:null,_currentPrintPage:0,_abortPrinting:!1,_isWindowResizing:!1,_ejViewerInstance:null,_isAutoZoom:!1,_ejDropDownInstance:null,_clientx:null,_clienty:null,_curPosX:null,_curPosY:null,_previousBounds:null,_topValue:!1,_clearText:!1,_timers:null,_scrollMove:null,_rangePosition:null,_selectedRanges:null,_longTouch:!1,_ranges:!1,_touchcontextMenu:!1,_selectionNodes:null,_selectionRange:null,_touched:!1,_lockTimer:null,_timer:null,_displaySearch:!1,_isCopyRestrict:!1,_isPrintRestrict:!1,_isTargetPage:!1,_targetPage:0,_isBuffering:!1,_isBufferStart:!1,_pagesGot:null,_isPrintingProcess:!1,_isRequestSuccess:!1,_fileId:null,_isFormFields:!1,_imageObj:null,_isJsondataAvailable:!1,_highestWidth:0,_horizontalResolution:null,_isAsynchronousDownload:!0,_searchedText:null,_annotationActive:!1,_isHighlight:!1,_isUnderline:!1,_isStrikeout:!1,_drawColor:null,_selectedAnnotation:null,_selectedAnnotationObject:null,_isPopupNoteFocused:!1,_colorpickerObject:null,_toolbarColorpickerObject:null,_isBackwardSelection:!1,_isPropertiesWindowOpen:!1,_isAnnotationSelected:!1,_currentAnnotationRectangle:[],_currentAnnotationRectangleBackup:[],_annotationBackupNoteSave:[],_isPopupNoteVisible:!1,_isUnderlineEnabled:!1,_isHighlightEnabled:!1,_isStrikeOutEnabled:!1,_isContextMenuPresent:!1,_isDefaultColorSet:!1,_isTextSelection:!1,_colorPickerStatus:null,_annotationsDeletedNo:null,_selectedValue:null,pageCount:0,currentPageNumber:this._currentPage,zoomPercentage:100,fileName:this._pdfFileName,isDocumentEdited:!1,_init:function(){var i;if(this._actionUrl=this.model.serviceUrl+"/"+this.model.serverActionSettings.load,this._renderViewer(),this._initViewer(),this._createContextMenu(),this._createHighlightContextMenu(),this._createWaterDropDiv(),this._createTouchContextMenu(),this._createPopupMenu(),this._createNote(),this._createPropertiesMenu(),this._createColorPalette(),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._ejDropDownInstance=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),this._getPdfService(this.model.pdfService),this.model.serviceUrl){if(i={},i.viewerAction="GetPageModel",i.controlId=this._id,i.pageindex="1",i.isInitialLoading="true",this.model.documentPath){var r=this.model.documentPath,u=r.split("base64,")[1],f=!1,e=!1;u||(this.model.documentPath.indexOf("\\")!=-1||this.model.documentPath.indexOf("/")!=-1?(f=!0,e=!0,this.model.documentPath.toLowerCase().endsWith(".pdf")||(r=this.model.documentPath+".pdf")):(i.newFileName=r,this._fileName=i.newFileName));i.file=r}i.id=this._createGUID();this._fileId=i.id;this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(i),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}),"_getPageModel")}this._printIframe=document.createElement("iframe")},_getPdfService:function(n){this._pdfService=n==1?t.PdfViewer.PdfService.Local:t.PdfViewer.PdfService.Remote},_initViewer:function(){this._wireEvents();this._initToolbar();this._currentPage=1;this._textMarkupAnnotationList=[];this._newAnnotationList=[];this._colorModifiedAnnotationList=[];this._existingAnnotationsModified=[];this._deletedAnnotationList=[];this._undoAnnotationCollection=[];this._redoAnnotationCollection=[];this._deletedAnnotationCollection=[];this._recentOperation=[];this._annotationsDeletedNo=[];this._redoActions=[];this._totalAnnotations=[];var i=this.model.toolbarSettings;i.templateId||(this._showToolbar(!0),this._showPrintButton(i.toolbarItem&t.PdfViewer.ToolbarItems.PrintTools),this._showZoomControl(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showFittoPage(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showPageNavigationControls(i.toolbarItem&t.PdfViewer.ToolbarItems.PageNavigationTools),this._showDownloadButton(i.toolbarItem&t.PdfViewer.ToolbarItems.DownloadTool),this._showTextSearchButton(i.toolbarItem&t.PdfViewer.ToolbarItems.TextSearchTool),this._showTextMarkupButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.TextMarkupAnnotationTools));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0);this._on(n("#"+this._id+"e-pdf-viewer"),"keydown",this._keyboardShortcutFind)},_unLoad:function(){var i,t;for(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),n("#"+this._id+"_txtpageNo").val(0),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoom"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_search"),i=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i._selectItemByIndex(0),i.disable(),clearTimeout(this._scrollTimer),t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;this._renderedCanvasList&&(this._renderedCanvasList.length=0);this._showloadingIndicator(!1);this._showPageLoadingIndicator(!1);this._raiseClientEvent("documentUnload",null)},_destroy:function(){this._isDestroyed=!0;n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0");n("#"+this._id+"_txtpageNo").val(0);clearTimeout(this._scrollTimer);this._unwireEvents();for(var t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;n("#"+this._id+"_pageviewContainer").remove();n("#"+this._id+"_toolbarContainer").remove();n("#"+this._id+"_viewerContainer").remove();n("#"+this._id+"_viewBlockContainer").remove();n("#"+this._id+"_toolbar_zoomSelection_popup_wrapper").remove();n("#"+this._id+"_rptTooltip").remove();n("#"+this._id+"_loadingIndicator_WaitingPopup").remove();n("#"+this._id+"_viewerContainer_WaitingPopup").remove();n("#"+this._id+"_WaitingPopup").remove();n(this.element).find(".e-pdfviewer-viewer").remove();this._renderedCanvasList.length=0;this._raiseClientEvent("destroy",null)},_renderToolTip:function(){var n=t.buildTag("div.e-pdfviewer-tbdiv e-pdfviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),i=t.buildTag("span.e-pdfviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),r=t.buildTag("span.e-pdfviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});return n.append(i),n.append(r),n},_renderToolBar:function(i){var r,f,e,u,o,h,c,l,s;this.model.toolbarSettings.templateId?(s=document.getElementById(this.model.toolbarSettings.templateId),i.append(s),s.ejToolbar({enableSeparator:!0,height:s.height(),click:this.model.toolbarSettings.click,isResponsive:!0}),s.css("display","block")):(r=t.buildTag("div.e-pdfviewer-toolbarcontainer .e-pdfviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(r),this._isDevice?(f=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(f,"zoomin"),this._appendToolbarItems(f,"zoomout"),this._appendToolbarItems(f,"fitWidth"),this._appendToolbarItems(f,"fitPage"),r.append(f)):(e=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{}),this._appendToolbarItems(e,"gotoprevious"),this._appendToolbarItems(e,"gotonext"),this._appendToolbarItems(e,"gotopage"),r.append(e),u=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_zoomul"}),this._appendToolbarItems(u,"zoomin"),this._appendToolbarItems(u,"zoomout"),this._appendToolbarItems(u,"zoom"),this._appendToolbarItems(u,"fitWidth"),this._appendToolbarItems(u,"fitPage"),r.append(u),o=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_textmarkupul"}),this._appendToolbarItems(o,"underline"),this._appendToolbarItems(o,"strikeout"),this._appendToolbarItems(o,"highlight"),r.append(o),h=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_downloadul"}),this._appendToolbarItems(h,"download"),r.append(h),c=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_printul"}),this._appendToolbarItems(c,"print"),r.append(c),l=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_searchul"}),this._appendToolbarItems(l,"search"),r.append(l),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",cssClass:"e-pdfviewer-ddl",change:this._zoomValChange,selectedItem:0})),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this),isResponsive:!0,overflowClose:n.proxy(this._overflowToolbarClose,this)}),this._toolbar=n("#"+this._id+"_toolbarContainer").data("ejToolbar"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-responsive-toolbar").addClass("e-pdfviewer-responsivesecondarytoolbar"),n("#"+this._id+"_pdfviewer_searchul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_textmarkupul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_downloadul").removeClass("e-separator"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-toolbarspan"))},_appendToolbarItems:function(n,i){var r,g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o,s,h,c,l,a,v,y,p,w,b,k,d;switch(i){case"print":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_Print"});o=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(o);break;case"download":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_download"});s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-download","",{},{id:this._id+"_toolbar_download"});r.append(s);break;case"gotofirst":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotofirst"});h=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotofirst","",{});r.append(h);break;case"gotolast":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotolast"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotolast","",{});r.append(c);break;case"gotonext":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotonext"});l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotonext","",{});r.append(l);break;case"gotoprevious":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotoprevious"});a=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotoprevious","",{});r.append(a);break;case"gotopage":r=t.buildTag("div.e-pdfviewer-tbpage","",{display:"block"},{});v=t.buildTag("input.e-pdfviewer-pagenumber e-pdfviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"});y=t.buildTag("span.e-pdfviewer-labelpageno","",{},{});r.append(v);r.append(y);break;case"zoomin":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomin"});p=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(p);break;case"zoomout":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomout"});w=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(w);break;case"zoom":r=t.buildTag("div.e-pdfviewer-ejdropdownlist","",{},{id:this._id+"_pdfviewer_toolbar_zoom"});var u=t.buildTag("select.e-pdfviewer-tbdiv e-pdfviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"}),g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],nt=g.contextMenu.auto.contentText;u.append("<option Selected>"+nt+"<\/option>");u.append("<option>50%<\/option>");u.append("<option>75%<\/option>");u.append("<option>100%<\/option>");u.append("<option>125%<\/option>");u.append("<option>150%<\/option>");u.append("<option>200%<\/option>");u.append("<option>400%<\/option>");r.append(u);break;case"fitWidth":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitWidth"});b=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitwidth","",{},{id:this._id+"_fitWidth"});r.append(b);break;case"fitPage":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitPage"});k=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitpage","",{},{id:this._id+"_fitPage"});r.append(k);break;case"search":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_search"});d=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-find","",{},{id:this._id+"_find"});r.append(d);break;case"highlight":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-highlight","",{},{id:this._id+"_pdfviewer_toolbar_highlight"});var tt=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-highlight-markup","",{},{id:this._id+"_highlight_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_highlight_dropdown"}),e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_highlight_dropdown_arrow"});f.append(e);r.append(tt);r.append(f);break;case"underline":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-underline","",{},{id:this._id+"_pdfviewer_toolbar_underline"});var it=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-underline-markup","",{},{id:this._id+"_underline_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_underline_dropdown"}),e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_underline_dropdown_arrow"});f.append(e);r.append(it);r.append(f);break;case"strikeout":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-strikeout","",{},{id:this._id+"_pdfviewer_toolbar_strikeout"});var rt=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-strikeout-markup","",{},{id:this._id+"_strikeout_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_strikeout_dropdown"}),e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_strikeout_dropdown_arrow"});f.append(e);r.append(rt);r.append(f)}n.append(r)},_renderViewerBlockinWeb:function(n){var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var r=t.buildTag("table.e-pdfviewer-viewerblockcellcontent","",{margin:"1px",padding:"5px 5px 10px"}),u=t.buildTag("tr","",{width:"100%"}),f=t.buildTag("td.e-pdfviewer-viewerblockcontent","",{});return u.append(f),r.append(u),i.append(r),i},_renderViewerContainer:function(n){var r=t.buildTag("div","",{},{id:this._id+"_pdfviewerContainer"});n.append(r);var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-scrollcontainer e-pdfviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),u=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),f=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),e=t.buildTag("div","",{},{id:this._id+"_pageviewContainer"});return u.append(f),i.append(u),i.append(e),this._isDevice&&this._renderViewerBlockinDevice(i),r.append(i),r},_renderViewer:function(){var u=this.element.height(),f=this.element.width(),n=t.buildTag("div.e-pdfviewer-viewer","",{},{id:this._id+"e-pdf-viewer"}),i,r;this.element[0].style.height||this.element[0].parentElement.clientHeight==0||(this._isHeight=!0);this.element[0].style.width||this.element[0].parentElement.clientWidth==0||(this._isWidth=!0);u===0&&this.element[0].parentElement.clientHeight!=0&&this.element.height(this.element[0].parentElement.clientHeight);f===0&&this.element[0].parentElement.clientWidth!=0&&this.element.width(this.element[0].parentElement.clientWidth);this.element.append(n);this._renderToolBar(n);this._isDevice||(this._renderViewerBlockinWeb(n),i=this._renderToolTip());r=this._renderViewerContainer(n);r.append(i);this._renderSearchBox()},_renderSearchBox:function(){var r=t.buildTag("div.e-pdfviewer-searchbox e-pdfviewer-arrow","",{},{id:this._id+"_pdfviewer_searchbox"}),i=t.buildTag("ul.e-pdfviewer-toolbarul-search","",{}),c,l;r.append(i);var u=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-inputcontainer","",{},{}),a=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Find : ",{float:"left","padding-top":"1px","margin-right":"5px",width:"29px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{}),v=t.buildTag("input.e-pdfviewer-searchinput e-pdfviewer-elementalignments ejinputtext","",{width:"150px"},{id:this._id+"_pdfviewer_searchinput"});u.append(a);u.append(v);var f=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-previous","",{float:"left"},{id:this._id+"_pdfviewer_previous_search"}),e=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-next","",{float:"left"},{id:this._id+"_pdfviewer_next_search"}),h=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-close","",{float:"left","margin-left":"4px"},{id:this._id+"_pdfviewer_close_search"}),y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-prevfind","",{},{id:this._id+"_prevfind"});f.append(y);n(f).css({"pointer-events":"none",opacity:"0.6"});n(e).css({"pointer-events":"none",opacity:"0.6"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-nextfind","",{},{id:this._id+"_nextfind"});e.append(c);var o=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-checkboxcontainer","",{float:"left"},{}),s=t.buildTag("input","",{},{type:"checkbox"}),p=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Match case",{float:"left","padding-top":"3px","margin-left":"5px","margin-top":"4px",width:"67.5px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{});o.append(s);o.append(p);l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closefind","",{},{id:this._id+"_closefind"});h.append(l);i.append(u);i.append(f);i.append(e);i.append(o);i.append(h);r.ejToolbar({enableSeparator:!1,isResponsive:!1,width:"400px",hide:!0});s.ejCheckBox({cssClass:"e-pdfviewer-match-checkbox",id:this._id+"_search_matchcase",size:t.CheckboxSize.Medium,change:n.proxy(this._matchcase,this)});s.ejCheckBox("disable");n("#"+this._id+"_pdfviewerContainer").append(r)},_createColorPalette:function(){var i=t.buildTag("div.e-pdfviewer-colorpicker","",{},{id:this._id+"_pdfviewer_colorpicker"});n("#"+this._id+"_pdfviewerContainer").append(i);i.ejColorPicker({displayInline:!0,modelType:"palette",change:n.proxy(this._setDrawColor,this)});this._toolbarColorpickerObject=i.data("ejColorPicker")},_setContainerSize:function(){var f=document.getElementById(this._id).clientHeight,i=0,t,r,u;this._isDevice||(t=n("#"+this._id+"_viewBlockContainer"),t.css("display").toLowerCase()=="block"&&(i=t.height()));r=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();u=f-i-r-4;n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_setPageSize:function(t,i,r){r=0;var f=n("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect(),u=this;this._renderPreviousPage=!1;n("#"+this._id+"_viewerContainer").unbind("scroll").on("scroll",function(){u._computeCurrentPage(t)});n("#"+this._id+"_pageviewContainer").mouseup(function(n){u._raiseClientEvent("pageClick",n)});this._scrollTimer=setInterval(function(){u._pageviewscrollchanged(t)},500);u._backgroundPage=1;this._previousZoom=1;u._previousPage=u._currentPage;this._pageLocation=[];this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._textDivs=[];this._textContents=[];this._searchMatches=[];this._searchCollection=[];this._pageLocation[1]=0;this._searchedPages=[];this._canvascount=this._totalPages;this._pointers=[];this._imageObj=[];this._pagesGot=[];this._imageSrcCollection=[];this._selectionPages=[];this._designPageCanvas()},_designPageCanvas:function(){var o=5,l=n("#"+this._id+"_pageviewContainer"),c=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewOuterline"),a=c.width(),w=c.height(),v=this._pageWidth,b=this._pageHeight,s=1,i,h,e,y,r,f;for(s=(a-25)/v,s=Math.min(1,s),this._zoomVal=s,i=1;i<=this._totalPages;i++){h=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight)/2:(this.element.width()-this._pageSize[i-1].PageWidth)/2;h<0&&(h=5);e=t.buildTag("div","",{},{id:this._id+"pageDiv_"+i});l.append(e);e.css("position","absolute");e.css("top",this._zoomVal*o);e.css("left",h+"px");this._pageLocation[i]=o;var u=document.createElement("canvas");u.id=this._id+"_secondarycanvas_"+i;u.className="e-pdfviewer-secondarycanvas";u.style.position="absolute";u.style.left=0;u.style.top=0;u.style.backgroundColor="transparent";e.append(u);y=this;r=document.createElement("canvas");r.id=this._id+"pagecanvas_"+i;r.className="e-pdfviewer-pageCanvas";this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(r.width=this._zoomVal*this._pageSize[i-1].PageHeight,r.height=this._zoomVal*this._pageSize[i-1].PageWidth,r.style.height=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageHeight+"px"):(r.style.height=this._zoomVal*this._pageSize[i-1].PageHeight+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.height=this._zoomVal*this._pageSize[i-1].PageHeight,r.width=this._zoomVal*this._pageSize[i-1].PageWidth);r.style.backgroundColor="white";e.append(r);u.height=r.height;u.width=r.width;u.style.height=r.height+"px";u.style.width=r.width+"px";f=document.createElement("div");f.id=this._id+"selectioncanvas_"+i;f.className="e-pdfviewer-selectiondiv";f.style.height=r.height+"px";f.style.width=r.width+"px";f.style.position="absolute";f.style.left=0;f.style.top=0;f.style.backgroundColor="transparent";f.style.zIndex="2";e.append(f);n("#"+this._id+"pageDiv_"+i).ejWaitingPopup({showOnInit:!0,appendTo:"#"+this._id+"pageDiv_"+i,target:"#"+this._id+"pageDiv_"+i});n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").appendTo(n("#"+this._id+"pageDiv_"+i)).css({left:"0px",top:"0px","background-color":"#dbdbdb"});o=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?parseFloat(o)+parseFloat(this._pageSize[i-1].PageWidth)+8:parseFloat(o)+parseFloat(this._pageSize[i-1].PageHeight)+8}this._cummulativeHeight=o},_computeCurrentPage:function(){var u=0,i=0,h=document.getElementById(this._id+"_viewerContainer"),r=h.scrollTop,t;this._zoomVal!=1&&(r=r+this._currentPage*(8-this._zoomVal*8));var e=0,f=0,o={currentPageNumber:0};for(t=0;t<this._totalPages;t++){if(this._isDestroyed)return;if(u>r&&r>=0){i=t;var s=parseFloat(u)-parseFloat(r),c=this.element[0].parentElement.clientHeight-s,l=document.getElementById(this._id+"_viewerContainer");this.element[0].parentElement.clientHeight<this._pageSize[t-1].PageHeight*this._zoomVal+this._pageSize[t].PageHeight*this._zoomVal&&parseInt(this._pageLocation[t]*this._zoomVal)<l.scrollTop&&c>s&&(i=parseFloat(i)+1,this._renderPreviousPage=!0);this._renderPreviousPage=!1;break}else u=this._pageSize[t].PageRotation==90||this._pageSize[t].PageRotation==270?parseFloat(u)+parseFloat(this._pageSize[t].PageWidth*this._zoomVal)+8:parseFloat(u)+parseFloat(this._pageSize[t].PageHeight*this._zoomVal)+8;i=r>=0?t+1:1}n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages);e=document.getElementById(this._id+"_txtpageNo").value;n("#"+this._id+"_txtpageNo").val(i);this._updatePageNavigation(i,this._totalPages);f=document.getElementById(this._id+"_txtpageNo").value;o.currentPageNumber=f;this._currentPage=i;this.currentPageNumber=this._currentPage;e!=f&&this._raiseClientEvent("pageChange",o)},_pageviewscrollchanged:function(){var s=0,h=n("#"+this._id+"_viewerContainer").scrollTop(),c,o,f,l,r,e,u;this._isTargetPage&&this.model.allowClientBuffering&&(this._isTargetPage=!1,this._isBuffering=!0,this._targetPage<=this._totalPages&&(this._isBufferStart||(this._raiseClientEvent("bufferStart",this._isBuffering),this._isBufferStart=!0),c={viewerAction:this._viewerAction.getPageModel,pageindex:this._targetPage.toString(),enableOfflineMode:!0,isPageScrolled:"false"},u=this,this._ajaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(c),traditional:!0,success:function(n){var f,e,r,t;if(jsondata=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),jsondata=jsondata.pdf,f=0,e=!1,jsondata){for(t=u._targetPage;t<=u._totalPages;t++)if(r=jsondata[t],r)u._pageContents[parseInt(r.currentpage)]=JSON.stringify(r),u._pageText[parseInt(r.currentpage)]=r.pageContents,u._pagesGot.push(parseInt(r.currentpage)),f++;else{e=!0;break}if(r==i&&!e)for(t=u._targetPage;t<=u._totalPages;t++)u._pagesGot.indexOf(t)&&f++;u._targetPage=f?u._targetPage+f:u._targetPage;u._targetPage>=u._totalPages&&(u._raiseClientEvent("bufferEnd",this._isBuffering),u._isBufferStart=!1);u._isTargetPage=!0;u._isBuffering=!1}},error:function(){}})));h==this._previousPosition&&(s=this._currentPage,this._totalPages&&this._previousPage!=s&&(o=parseInt(s),this._previousPage=s,o>=1&&o<=this._totalPages&&(this._isJsondataAvailable?(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(o)):(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0")),this._currentPage=o,this._updatePageNavigation(this._currentPage,this._totalPages),this._renderedCanvasList.indexOf(parseInt(this._currentPage))!=-1||this._scrollTriggered&&!this.model.allowClientBuffering||this._pageContents[parseInt(this._currentPage)]||this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))))));this._renderedCanvasList.indexOf(parseInt(this._currentPage))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&this._currentPage<=this._totalPages&&(this._pageContents[parseInt(this._currentPage)]?(e=this._pageContents[parseInt(this._currentPage)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));f=parseInt(this._currentPage)+1;this.model.allowClientBuffering?this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(l=!0,this._isPrintingProcess||(r.isPageScrolled=!1)),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r),l):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages?this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0&&(this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));this._previousPosition=h;u=this;setTimeout(function(){var r;if(n(".e-pdfviewer-formFields").show(),u.model){var f=t.PdfViewer.Locale[u.model.locale]?t.PdfViewer.Locale[u.model.locale]:t.PdfViewer.Locale["default"],i=f.contextMenu.auto.contentText,e=n("#"+u._id+"_toolbar_zoomSelection").data("ejDropDownList"),o=n("#container_toolbar_zoomSelection_hidden").val();n("#"+u._id+"_toolbar_zoomSelection_popup li")[0].innerHTML=i;r=e.selectedIndex();r==0&&isNaN(parseFloat(o))&&(n("#"+u._id+"_toolbar_zoomSelection_hidden").val(i),u._ejDropDownInstance.model.value=i);u._searchBoxLocalization()}u._selectionRange==null||u._displaySearch||(u._selectionNodes.addRange(u._selectionRange),u._selectionRange=null,u._selectionNodes=null)},5e3)},_doAjaxPostscroll:function(t,i,r,u){var f=this;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,success:function(n){var t;typeof n=="object"?f._drawPdfPage(JSON.stringify(n)):f._drawPdfPage(n);f._scrollTriggered=!1;u&&f.model.allowClientBuffering&&(t=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),f._pagesGot.push(parseInt(t.currentpage)),parseInt(t.currentpage)<=f._totalPages&&(f._targetPage=t.currentpage+1,f._isTargetPage=!0))},error:function(n){n.readyState!=0&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_drawPdfPage:function(r){var ci=r,o,vt,p,u,g,ot,s,nt,st,a,h,rt,pt,ui,ut,k,f,ft,ii,at,c,e;if(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),o=parseInt(r.currentpage),this._isWindowResizing||this._showPageLoadingIndicator(o,!0),vt=r.imagestream,p=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage)),(this._pageSize[o-1].PageRotation==90||this._pageSize[o-1].PageRotation==270)&&(p.width=this._zoomVal*this._pageSize[o-1].PageWidth,p.height=this._zoomVal*this._pageSize[o-1].PageHeight,p.style.height=this._zoomVal*this._pageSize[o-1].PageHeight+"px",p.style.width=this._zoomVal*this._pageSize[o-1].PageWidth+"px"),p){if(u=p.getContext("2d"),this._pageContents[parseInt(r.currentpage)]=ci,this._pageText[parseInt(r.currentpage)]=r.pageContents,this._imageObj=[],n("#"+this._id+"selectioncanvas_"+o).hasClass("text_container")?this._resizeSelection(r,o,u):(this._textSelection(r,o,u),this._textMarkupAnnotationList[parseInt(r.currentpage)]=r.textMarkupAnnotation,this._textMarkupAnnotationList[parseInt(r.currentpage)]&&(this._totalAnnotations[o]=r.textMarkupAnnotation.slice())),n("#"+this._id+"selectioncanvas_"+o).hasClass("input_container")?this._generateFormFields(r,o):this._createFormFields(r,o),navigator.userAgent.indexOf("Firefox")!=-1)for(g=vt.textelements,ot=0;ot<g.length;ot++)if(s=g[ot],nt=s.textureBrushs,nt){var li=s.texturFields[0].Image,it="data:image/png;base64,"+li,ri=new Image;ri.src=it;this._imageSrcCollection.push(ri.src)}for(this._isTextSearch&&(e=this,setTimeout(function(){e._isPageScrollHighlight=!0;e._isPageScrolledForSearch=!0;e._highlightOtherOccurrences()},100)),st=n("#"+this._id+"selectioncanvas_"+o).children(),k=0;k<st.length;k++)st[k].hasAttribute("href")&&n(st[k]).remove();var w=r.linkannotation,yt=r.annotpagenum,ht=this;if(this.model.enableHyperlink)for(a=0;a<w.length;a++){if(h=document.createElement("a"),h.id="linkdiv_"+a,rt=w[a].AnnotRectangle,h.style.background="transparent",h.style.position="absolute",h.style.left=this._convertPointToPixel(rt.Left*this._zoomVal)+"px",h.style.top=this._convertPointToPixel(rt.Top*this._zoomVal)+"px",h.style.width=this._convertPointToPixel(rt.Width*this._zoomVal)+"px",h.style.height=this._convertPointToPixel(rt.Height*this._zoomVal)+"px",h.style.color="transparent",w[a].URI.indexOf("mailto:")!=-1?(pt=w[a].URI.substring(w[a].URI.indexOf("mailto:"),w[a].URI.length),h.title=pt,h.setAttribute("href",pt)):(h.title=w[a].URI,h.setAttribute("href",w[a].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(h.target="_self",h.onclick=function(){var n={hyperlink:this.href};ht._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(h.target="_blank",h.onclick=function(){var n={hyperlink:this.href};ht._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(h.onclick=function(){var n={hyperlink:this.href};return ht._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),yt[a]!=i){var ai=this._pageSize[o-1].PageHeight,vi=this._convertPointToPixel(w[a].AnnotLocation),yi=ai-vi,pi=parseFloat(this._pageLocation[yt[a]]*this._zoomVal)+parseFloat(yi*this._zoomVal);h.name=pi;h.onclick=function(){var n=document.getElementById(ht._id+"_viewerContainer");return n.scrollTop=this.name,!1}}yt[a]!=null&&(ui=document.getElementById(this._id+"selectioncanvas_"+o),ui.appendChild(h))}this._textMarkupAnnotationList[o]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[o],o);var v=parseInt(r.currentpage),wt=[],fi=[],wi=[],ei=[],oi=[],bi,b=navigator.userAgent,d,si=0,bt=[],g=vt.textelements;for(ut=0;ut<g.length;ut++){var s=g[ut],kt=s.color,l=s.matrix;l!=null&&(l=l.Elements);var dt=s.brush,y=s.pathValue,ki=s.iscliping,hi=s.restorecanvas,it=s.imagedata,tt=s.fillrule,di=s.isFillandStroke,gi=s.fillcolor,gt=s.strokecolor,ni=s.linewidth,ti=s.linecap,ct=s.linearGradientBrush,nt=s.textureBrushs,lt=s.charID,tr=s.rectvalue;if(y!=null?(y=y.split(";"),lt&&(bt[lt]=y)):y==null&<&&(y=bt[lt]),hi==!1&&u.save(),y!=i&&u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),y!=null){for(u.beginPath(),k=0;k<y.length;k++)f=y[k],ft=f[0],ft=="M"?(f=f.substring(1,f.length),f=f.split(" "),u.moveTo(f[0],f[1])):ft=="L"?(f=f.substring(1,f.length),f=f.split(" "),u.lineTo(f[0],f[1])):ft=="C"?(f=f.substring(1,f.length),f=f.split(" "),u.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5])):ft=="Z"&&u.closePath();ki==!0?(tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(tt)),u.clip()):di==i?dt=="Fill"?(u.fillStyle=ct!=i?this._getGradientBrush(ct,u):nt!=i?this._createTextureBrush(nt,u,s):kt,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill()):dt=="FillandStroke"?(u.fillStyle=kt,u.fill(),u.strokeStyle=gt,u.stroke()):dt=="Stroke"?(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=kt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke(),u.fillStyle=ct!=i?this._getGradientBrush(ct,u):nt!=i?this._createTextureBrush(nt,u,s):gi,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill())}if(hi&&u.restore(),it!=i)if((d=b.indexOf("Firefox"))!=-1||(d=b.indexOf("Chrome"))!=-1||(d=b.indexOf("Safari"))!=-1||(d=b.indexOf("AppleWebKit"))!=-1){wt.push(it);fi.push(l);oi.push(g);ei.push(ut);bi=this._zoomVal;this._isContainImage=!0;break}else ii=new Image,ii.src=it,u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),u.drawImage(ii,0,0,1,1)}if((d=b.indexOf("Firefox"))!=-1||(d=b.indexOf("Chrome"))!=-1||(d=b.indexOf("Safari"))!=-1||(d=b.indexOf("AppleWebKit"))!=-1)for(at=0;at<wt.length;at++)this._imageRendering(g,wi,wt,fi,u,at,oi,ei,bt,p,v,si),si++;if(c=p,e=this,this._pageSize[v-1].PageRotation!=0&&!(it!=i&&b.indexOf("Firefox")!=-1)){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var nr=c.toDataURL(),u=c.getContext("2d"),et=new Image;et.onload=function(){u.clearRect(0,0,c.width,c.height);e._pageSize[v-1].PageRotation==90||e._pageSize[v-1].PageRotation==270?(c.width=e._zoomVal*e._pageSize[v-1].PageHeight,c.height=e._zoomVal*e._pageSize[v-1].PageWidth,c.style.height=e._zoomVal*e._pageSize[v-1].PageWidth+"px",c.style.width=e._zoomVal*e._pageSize[v-1].PageHeight+"px"):(c.width=e._zoomVal*e._pageSize[v-1].PageWidth,c.height=e._zoomVal*e._pageSize[v-1].PageHeight,c.style.width=e._zoomVal*e._pageSize[v-1].PageWidth+"px",c.style.height=e._zoomVal*e._pageSize[v-1].PageHeight+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(e._pageSize[v-1].PageRotation/2*Math.PI/2);u.drawImage(et,-et.width/2,-et.height/2);u.restore()};et.src=nr}return this._showPageLoadingIndicator(o,!1),c}},_convertPointToPixel:function(n){return this._horizontalResolution?parseFloat(n)*(this._horizontalResolution/72):parseFloat(n)*(96/72)},_getRandomNum:function(){return((1+Math.random())*65536|0).toString(16).substring(1)},_createGUID:function(){return"Syncfusion_PDFviewer_"+(this._getRandomNum()+this._getRandomNum()+"-"+this._getRandomNum()+"-4"+this._getRandomNum().substr(0,3)+"-"+this._getRandomNum()+this._getRandomNum()+this._getRandomNum()).toLowerCase()},_createFormFields:function(t,i){var f=t.PdfRenderedFields,p=navigator.userAgent,h=this,u,r,l,c,v,s,o,y,e,w,b,k,a;if(f!=null)for(u=0;u<f.length;u++)if(f[u].PageIndex+1==i){if(l=f[u].LineBounds,f[u].Name=="Textbox")r=document.createElement("input"),r.type="text",e=f[u].BackColor,c=f[u].FontColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].FieldName),v=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",f[u].MaxLength>0&&n(r).attr("maxlength",f[u].MaxLength),f[u].InsertSpaces&&n(r).css("letter-spacing",v),f[u].Text!=""?n(r).val(f[u].Text):n(r).val("");else if(f[u].Name=="Password")r=document.createElement("input"),r.type="password",e=f[u].BackColor,c=f[u].FontColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].FieldName),v=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",f[u].MaxLength>0&&n(r).attr("maxlength",f[u].MaxLength),f[u].InsertSpaces&&n(r).css("letter-spacing",v),f[u].Text!=""?n(r).val(f[u].Text):n(r).val("");else if(f[u].Name=="RadioButton")r=document.createElement("input"),r.type="radio",n(r).css("border-width",f[u].BorderWidth),f[u].Selected==!0&&n(r).prop("checked",!0),n(r).val(f[u].Value),n(r).attr("name",f[u].GroupName),n(r).css("cursor","pointer"),p.indexOf("Chrome")!=-1&&n(r).css("-webkit-apperance","none");else if(f[u].Name=="CheckBox")r=document.createElement("input"),r.type="checkbox",n(r).css("border-width",f[u].BorderWidth),f[u].Selected==!0?n(r).prop("checked",!0):p.indexOf("Chrome")!=-1&&n(r).css("-webkit-appearance","none"),n(r).attr("name",f[u].GroupName),e=f[u].BackColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("cursor","pointer");else if(f[u].Name=="DropDown"){for(r=document.createElement("select"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].Text),f[u].SelectedValue==""&&(o=document.createElement("option"),o.id="dropdownhide",n(o).css("display","none"),o.selected="selected",o.innerHTML="",r.appendChild(o)),s=0;s<f[u].TextList.length;s++)o=document.createElement("option"),o.className="e-dropdownSelect",f[u].SelectedValue==f[u].TextList[s]?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[u].TextList[s],r.appendChild(o);e=f[u].BackColor;n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")")}else if(f[u].Name=="ListBox")for(r=document.createElement("select"),n(r).attr("multiple","multiple"),n(r).attr("name",f[u].Text),s=0;s<f[u].TextList.length;s++){for(o=document.createElement("option"),o.className="e-pdfviewer-ListBox",y=0;y<f[u].SelectedList.length;y++)f[u].SelectedList[y]==s&&n(o).prop("selected",!0);o.innerHTML=f[u].TextList[s];r.appendChild(o);e=f[u].BackColor;n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")")}f[u].Font!=null&&((f[u].Font.Bold||f[u].Font.Italic||f[u].Font.Strikeout||f[u].Font.Underline)&&(f[u].Font.Italic&&(r.style.fontStyle="italic"),f[u].Font.Bold&&(r.style.fontWeight="Bold")),n(r).css("font-family",f[u].Font.Name),w=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",n(r).css("font-size",w));r.id=this._id+"input_"+i+"_"+u;r.className="e-pdfviewer-formFields";r.style.margin="0px";r.style.zIndex=1e3;r.style.left=this._convertPointToPixel(l.X*this._zoomVal)+"px";r.style.top=this._convertPointToPixel(l.Y*this._zoomVal)+"px";r.style.width=this._convertPointToPixel(l.Width*this._zoomVal)+"px";r.style.height=this._convertPointToPixel(l.Height*this._zoomVal)+"px";r.style.position="absolute";b=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("input_container");b.appendChild(r);h=this;a=navigator.userAgent.indexOf("Chrome")!=-1;n(r).on("focus",function(t){var r=n(t.target).attr("type"),e=n(t.target)[0].type,i=n(t.target).css("background-color"),u=i.lastIndexOf(","),f=i.slice(0,u+1)+0+")";(r="checkbox"&&a)&&n(t.target).css("-webkit-appearance","");n(t.target).css("background-color",f);k=t.target.style.borderWidth;n(t.target).css("border-width","0");h._isFormFields=!0});n(r).on("blur",function(t){var e=n(t.target).attr("type"),o=n(t.target)[0].type,i,r,u,f;i=a?n(t.target).css("background-color"):t.target.style["background-color"];r=i.lastIndexOf(",");e=="checkbox"&&n(t.target).prop("selected")==!0?(u=i.slice(0,r+1)+0+")",n(t.target).css("background-color",u)):(f=i.slice(0,r+1)+.2+")",n(t.target).css("background-color",f));n(t.target).css("border-width",k);h._isFormFields=!1});n(r).on("change",function(){h.isDocumentEdited=!0});n(r).unbind("click").on("click touchstart",function(t){var u=n(t.target).attr("type"),o=n(t.target)[0].type,e,f,r,i;if(u=="password"||u=="text"){n(t.target).select();i=n(t.target)[0];n(i).on("keypress",function(t){var u=n(i).attr("maxlength"),r;n(i).val().length>u-2&&(r=n(i).val()+String.fromCharCode(t.keyCode),n(i).val(r),n(i).blur())});n(i).on("keyup",function(){var r=n(i).val(),u=h._pageContents[h._currentPage],f=JSON.parse(u),e=f.PdfRenderedFields,t=i.id.split("_"),o=t[t.length-1];h.isDocumentEdited=r!=e[o].Text?!0:!1});n(i).unbind("change").on("change",function(){var t=n(i).val();n(i).val(t)})}if(u=="radio"){for(e=n(t.target).attr("name"),f=n(".e-pdfviewer-formFields:radio"),r=0;r<f.length;r++)n(f[r]).attr("name")==e&&n(f[r]).prop("checked",!1);n(t.target).prop("checked",!0)}else if(u=="checkbox")n(t.target).prop("checked")==!0?(n(t.target).prop("checked",!0),a&&n(t.target).css("-webkit-appearance","")):(n(t.target).prop("checked",!1),a&&n(t.target).css("-webkit-appearance","none"));else if(o=="select-one"){h.isDocumentEdited=!0;i=n(t.target)[0];n(i).unbind("change").on("change",function(t){for(var u=n(t.target)[0],f=u.options[u.selectedIndex].text,r=u.children,i=0;i<r.length;i++)r[i].text==f?n(r[i]).prop("selected",!0):n(r[i]).prop("selected",!1)})}})}},_saveFormFieldsValue:function(){var s={},h={},r,c,l,p,a,y,i,o,f,t,e,u,v;if(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("visibility",""),r=n(".e-pdfviewer-formFields"),r!=null)for(i=0;i<r.length;i++)if(r[i].type=="text"||r[i].type=="password")s[r[i].name]=r[i].value;else if(r[i].type=="radio"&&n(r[i]).prop("checked")==!0)s[r[i].name]=r[i].value;else if(r[i].type=="checkbox")s[r[i].name]=n(r[i]).prop("checked")==!0?n(r[i]).prop("checked"):n(r[i]).prop("checked");else if(r[i].type=="select-one")s[r[i].name]=r[i].options[r[i].selectedIndex].text;else if(r[i].type=="select-multiple"){for(c=[],l=n(r[i]).children(),f=0;f<l.length;f++)n(l[f]).prop("selected")==!0&&c.push(l[f].text);c=JSON.stringify(c);s[r[i].name]=c}for(p=[],i=1;i<=this._totalPages;i++){if(o=[],a=this._textMarkupAnnotationList[i],a)for(f=0;f<a.length;f++)if(t=a[f],t)for(e=t.Opacity,t.TextMarkupAnnotationType=="Highlight"&&(e=e*.5),t.Author==null&&(t.Author=this.model.strikethroughSettings.author),u=0;u<t.Bounds.length;u++)v={index:t.index,colorA:t.Opacity*255,colorR:t.Color.R,colorG:t.Color.G,colorB:t.Color.B,opacity:e,type:t.TextMarkupAnnotationType,author:t.Author,subject:t.Subject,text:t.note,xPosition:t.Bounds[u].X,yPosition:t.Bounds[u].Y,height:t.Bounds[u].Height,width:t.Bounds[u].Width},o.push(v);p[i-1]=o}for(y=[],i=1;i<=this._totalPages;i++){for(o=[],y[i-1]=o,f=0;f<this._newAnnotationList[i-1].length;f++)for(t=this._newAnnotationList[i-1][f],e=t.opacity,t.type=="Highlight"&&(e=e*.5),u=0;u<t.bounds.length;u++)v={type:t.type,xPosition:t.bounds[u].xPosition,yPosition:t.bounds[u].yPosition,height:t.bounds[u].height,width:t.bounds[u].width,colorA:t.colorA,colorR:t.colorR,colorG:t.colorG,colorB:t.colorB,opacity:e,author:t.author,subject:t.subject,text:t.note},o.push(v);y[i-1]=o}h.savetextMarkupAnnotation=JSON.stringify(y);h.existingAnnotations=JSON.stringify(p);h.savedFields=JSON.stringify(s);h.id=this._fileId;this._saveAs("POST",this.model.serviceUrl,JSON.stringify(h))},_saveAs:function(t,i,r){var u=this;n.ajax({type:t,url:i+"/"+this.model.serverActionSettings.download,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,async:this._isAsynchronousDownload,success:function(n){n&&u._save(n)},error:function(n){u._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_generateFormFields:function(t,i){var f=t.PdfRenderedFields,r,h,u,c,l,a,s,o,e,v;if(f!=null)for(r=0;r<f.length;r++)if(h=f[r].LineBounds,u=document.getElementById(this._id+"input_"+i+"_"+r),f[r].PageIndex+1==i){if(f[r].Name=="Password"||f[r].Name=="Textbox")e=f[r].BackColor,c=f[r].FontColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(u).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(u).css("border-width",f[r].BorderWidth),l=this._convertPointToPixel(f[r].Font.Height*this._zoomVal)+"px",f[r].MaxLength>0&&n(u).attr("maxlength",f[r].MaxLength),f[r].InsertSpaces&&n(u).css("letter-spacing",l),a=n(u).val(),n(u).val(a);else if(f[r].Name=="RadioButton")n(u).css("border-width",f[r].BorderWidth),n(u).prop("checked")==!0&&n(u).prop("checked",!0),n(u).attr("name",f[r].GroupName),n(u).css("cursor","pointer");else if(f[r].Name=="CheckBox")n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(u).css("border-width",f[r].BorderWidth),n(u).prop("checked")==!0&&n(u).prop("checked",!0),n(u).css("cursor","pointer");else if(f[r].Name=="DropDown")for(n(u).css("border-width",f[r].BorderWidth),f[r].SelectedValue==""&&(o=n(u).children()[0],o.id="dropdownhide",n(o).css("display","none"),n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=""),s=0;s<f[r].TextList.length;s++)o=n(u).children()[0].id=="dropdownhide"?n(u).children()[s+1]:n(u).children()[s],n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=f[r].TextList[s],e=f[r].BackColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");else if(f[r].Name=="ListBox")for(n(u).attr("multiple","multiple"),s=0;s<f[r].TextList.length;s++)o=n(u).children()[s],n(o).prop("selected")==!0?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[r].TextList[s],e=f[r].BackColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");f[r].Font!=null&&((f[r].Font.Bold||f[r].Font.Italic||f[r].Font.Strikeout||f[r].Font.Underline)&&(f[r].Font.Italic&&(u.style.fontStyle="italic"),f[r].Font.Bold&&(u.style.fontWeight="Bold")),n(u).css("font-family",f[r].Font.Name),v=this._convertPointToPixel(f[r].Font.Height*this._zoomVal)+"px",n(u).css("font-size",v));u.style.margin="0px";u.style.zIndex=1e3;u.style.left=this._convertPointToPixel(h.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(h.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(h.Width*this._zoomVal)+"px";u.style.height=this._convertPointToPixel(h.Height*this._zoomVal)+"px";u.style.position="absolute"}},_textSelection:function(t,i,r){for(var f,p,w,b,k,v,c,l,d,ut=navigator.userAgent.indexOf("Edge")!=-1,g=document.documentMode||/Edge/.test(navigator.userAgent),nt=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,s=t.selection,y=[],a=[],e=0;e<s.length;e++){var h=" ",o=s[e].LineBounds,u=document.createElement("DIV");u.id=this._id+"text_"+i+"_"+e;u.className="e-pdfviewer-textLayer";f=s[e].Line;f=f.replace(/</g,"<");f=f.replace(/>/g,">");var tt=new RegExp("[\x00-€]+"),it=tt.test(f),rt=this._isRtl(f);!it&&rt?(p=new RegExp(String.fromCharCode(160),"g"),f=f.replace(p," "),f=f.split("").reverse().join(""),a.push(f)):a.push(s[e].Line.toString());g&&!nt?u.innerHTML=f:((this._previousBounds==parseInt(o.Y)||this._previousBounds==parseInt(o.Y+1)||this._previousBounds==parseInt(o.Y-1))&&(h=document.getElementById(this._id+"text_"+i+"_"+(e-1)),h.innerHTML!=" "&&(h.innerHTML=h.innerHTML.replace(/(\r\n|\n|\r)/gm,""))),this._previousBounds=parseInt(o.Y),u.innerHTML=f+"\r\n");w=f.replace(/ +/g," ");w!=" "&&(u.style.whiteSpace="pre");u.style.background="transparent";u.style.position="absolute";u.style.left=this._convertPointToPixel(o.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(o.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(o.Width*this._zoomVal)+"px";u.style.color="transparent";u.style.fontSize=this._convertPointToPixel(o.Height*this._zoomVal)+"px";u.style.fontFamily="sans-serif";u.style.opacity="0.2";u.style.transformOrigin="0%";r.fontFamily="sans-serif";r.fontSize=u.style.fontSize;r.font=u.style.fontSize+" "+u.style.fontFamily;b=r.measureText(s[e].Line).width;k=parseFloat(u.style.width)/b;u.style.transform="scaleX("+k+")";v=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("text_container");v.appendChild(u);c=v.getBoundingClientRect();l=u.getBoundingClientRect();(l.width+l.left>=c.width+c.left||l.width>c.width)&&(n(u).css("width","auto"),d=u.clientWidth,n(u).css("width",d+"px"));y.push(u)}this._previousBounds=null;this._textDivs[i]=y;this._textContents[i]=a},_resizeSelection:function(t,i,r){for(var e,u,c,l,a,v,y,o=t.selection,f=0;f<o.length;f++)if(e=o[f].LineBounds,u=document.getElementById(this._id+"text_"+i+"_"+f),u){c=o[f].Line;u.style.position="absolute";u.style.left=this._convertPointToPixel(e.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(e.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(e.Width*this._zoomVal)+"px";l=c.replace(/ +/g," ");l!=" "&&(u.style.whiteSpace="pre");u.style.transformOrigin="0%";u.style.opacity="0.2";u.style.fontSize=this._convertPointToPixel(e.Height*this._zoomVal)+"px";r.font=u.style.fontSize+" "+u.style.fontFamily;r.fontSize=u.style.fontSize;a=r.measureText(o[f].Line).width;v=parseFloat(u.style.width)/a;u.style.transform="scaleX("+v+")";var p=document.getElementById(this._id+"selectioncanvas_"+i),s=p.getBoundingClientRect(),h=u.getBoundingClientRect();(h.width+h.left>=s.width+s.left||h.width>s.width)&&(n(u).css("width","auto"),y=u.clientWidth,n(u).css("width",y+"px"))}},_maintainSelection:function(){var n=this._selectionNodes,t=document.createRange(),i,r;n.anchorNode!=null&&(i=n.anchorNode.compareDocumentPosition(n.focusNode),r=!1,(!i&&n.anchorOffset>n.focusOffset||i===Node.DOCUMENT_POSITION_PRECEDING)&&(r=!0),r?(t.setStart(n.focusNode,n.focusOffset),t.setEnd(n.anchorNode,n.anchorOffset)):(t.setStart(n.anchorNode,n.anchorOffset),t.setEnd(n.focusNode,n.focusOffset)),this._selectionRange=t);n.removeAllRanges()},_showPageLoadingIndicator:function(t,i){i?n("#"+this._id+"pageDiv_"+t+"_WaitingPopup").css("display","block"):n("#"+this._id+"pageDiv_"+t+"_WaitingPopup").css("display","none")},_imageRendering:function(n,t,r,u,f,e,o,s,h,c,l,a){var y=this._zoomVal,p=new Image,v=this,w=navigator.userAgent;p.onload=function(){for(var nt,d,ht,st,e,rt,pt=!1,g=0;g<u.length;g++)if(pt==!1)for(nt=u[g],f.setTransform(nt[0]*y,nt[1]*y,nt[2]*y,nt[3]*y,nt[4]*y,nt[5]*y),t[a]!=i&&f.drawImage(t[a],0,0,1,1),d=s[g],d=d+1,ht=o[g];d<ht.length;){var p=ht[d],ct=p.color,b=p.matrix;b!=null&&(b=b.Elements);var lt=p.brush,k=p.pathValue,kt=p.iscliping,wt=p.restorecanvas,bt=p.imagedata,tt=p.fillrule,dt=p.isFillandStroke,gt=p.fillcolor,at=p.strokecolor,vt=p.linewidth,yt=p.linecap,ft=p.linearGradientBrush,et=p.textureBrushs,ot=p.charID,ti=p.rectvalue;if(k!=null?(k=k.split(";"),ot&&(h[ot]=k)):k==null&&ot&&(k=h[ot]),wt==!1&&f.save(),k!=i&&f.setTransform(b[0]*y,b[1],b[2],b[3]*y,b[4]*y,b[5]*y),k!=null){for(f.beginPath(),st=0;st<k.length;st++)e=k[st],rt=e[0],rt=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):rt=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):rt=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):rt=="Z"&&f.closePath();kt==!0?(tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(tt)),f.clip()):dt==i?lt=="Fill"?(f.fillStyle=ft!=i?v._getGradientBrush(ft,f):et!=i?v._createTextureBrush(et,f,p):ct,tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(tt)),f.fill()):lt=="FillandStroke"?(f.fillStyle=ct,f.fill(),f.strokeStyle=at,f.stroke()):lt=="Stroke"?(f.strokeStyle=at,f.lineWidth=vt,f.lineCap=yt,f.stroke()):(f.strokeStyle=ct,f.lineWidth=vt,f.lineCap=yt,f.stroke()):(f.strokeStyle=at,f.lineWidth=vt,f.lineCap=yt,f.stroke(),f.fillStyle=ft!=i?v._getGradientBrush(ft,f):et!=i?v._createTextureBrush(et,f,p):gt,tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(tt)),f.fill())}if(wt&&f.restore(),bt!=i){pt=!0;r.pop();u.pop();o.pop();s.pop();r.push(bt);u.push(b);o.push(n);s.push(d);g=-1;a++;break}d++}else v._imageRendering(n,t,r,u,f,g,o,s,h,c,l,a),a++;if(d==n.length&&v._pageSize[l-1].PageRotation!=0){var w=document.getElementById(v._id+"pagecanvas_"+l),ni=w.toDataURL(),it=w.getContext("2d"),ut=new Image;ut.onload=function(){it.clearRect(0,0,w.width,w.height);v._pageSize[l-1].PageRotation==90||v._pageSize[l-1].PageRotation==270?(w.width=v._zoomVal*v._pageSize[l-1].PageHeight,w.height=v._zoomVal*v._pageSize[l-1].PageWidth,w.style.height=v._zoomVal*v._pageSize[l-1].PageWidth+"px",w.style.width=v._zoomVal*v._pageSize[l-1].PageHeight+"px"):(w.width=v._zoomVal*v._pageSize[l-1].PageWidth,w.height=v._zoomVal*v._pageSize[l-1].PageHeight,w.style.width=v._zoomVal*v._pageSize[l-1].PageWidth+"px",w.style.height=v._zoomVal*v._pageSize[l-1].PageHeight+"px");it.save();it.translate(w.width/2,w.height/2);it.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);it.drawImage(ut,-ut.width/2,-ut.height/2);it.restore()};ut.src=ni}};p.src=r[e];t.push(p);this._imageObj.push(p)},_createTextureBrush:function(n,t,i){var e=i.texturFields[0].Image,u=i.texturFields[0].Width,f=i.texturFields[0].Height,o="data:image/png;base64,"+e,r=new Image;navigator.userAgent.indexOf("Firefox")!=-1?(r.src=this._imageSrcCollection[0],this._loadimages(r,u,f,t),this._imageSrcCollection.shift()):(r.src=o,this._loadimages(r,u,f,t))},_loadimages:function(n,t,i,r){var u=document.createElement("canvas"),e=u.getContext("2d"),f;return u.width=t,u.height=i,e.drawImage(n,0,0,n.width,n.height,0,0,u.width,u.height),f=r.createPattern(u,"repeat"),r.fillStyle=f,r.fill(),f},_getGradientBrush:function(n,t){for(var i,s,r=n.Rectangle,f=n.InterpolationColors,h=f.Colors,e=f.Positions,o=t.createLinearGradient(r.X,r.Y,r.Width,r.Height),u=0;u<e.length;u++)i=h[u],i=i.split(","),s=this._rgb2Color(i[0],i[1],i[2]),o.addColorStop(e[u],s);return o},_rgb2Color:function(n,t,i){return"#"+this._byte2Hex(n)+this._byte2Hex(t)+this._byte2Hex(i)},_byte2Hex:function(n){var t="0123456789ABCDEF";return String(t.substr(n>>4&15,1))+t.substr(n&15,1)},_doAjaxPost:function(t,i,r,u){var f=this,e=u;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);this._ajaxRequestState=n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,success:function(n){var i,r,t,u,o,s;typeof n=="object"&&(n=JSON.stringify(n));i=JSON.parse(n);r=i.pagecount;r==0?f._unLoad():(typeof n=="object"?f[e](JSON.stringify(n)):f[e](n),t=i.filename.split("\\"),u=t.length>1?t[t.length-1]:f._fileName!=""&&f._fileName!=null?f._fileName:null,o={fileName:u},f._raiseClientEvent("documentLoad",o),f.model.allowClientBuffering&&(s=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),f._pagesGot.push(parseInt(s.currentpage))))},error:function(n){(e=="_clearCurrentServerCache"||n.readyState!=0)&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_raiseClientEvent:function(i,r){var f=this.model[i],e=[],u;e=r===null?"":r;f&&(typeof f=="string"&&(f=t.util.getObject(f,window)),n.isFunction(f)&&(i=="pageChange"?u={currentPageNumber:parseInt(r.currentPageNumber)}:i=="zoomChange"?u={previousZoomPercentage:r.previousZoomPercentage,currentZoomPercentage:r.currentZoomPercentage}:i=="hyperlinkClick"?u={hyperlink:r.hyperlink}:i=="pageClick"?u={XCoordinate:r.offsetX,YCoordinate:r.offsetY}:i=="bufferStart"?u={isBuffering:!0}:i=="bufferEnd"?u={isBuffering:!1}:i=="documentLoad"?u={fileName:r.fileName}:i=="ajaxRequestFailure"?u={message:r}:i=="annotationAdd"?u={annotationSettings:r.annotationSettings,annotationID:r.annotationId,pageID:r.pageId,annotationBound:r.annotationBound,annotationType:r.annotationType}:i=="annotationRemove"?u={annotationID:r.annotationId,pageID:r.pageId,annotationType:r.annotationType}:i=="annotationPropertiesChange"?u={annotationID:r.annotationId,pageID:r.pageId,annotationType:r.annotationType,isColorChanged:r.isColorChanged,isOpacityChanged:r.isOpacityChanged}:i=="annotationResize"&&(u={annotationSettings:r.annotationSettings,annotationID:r.annotationID,pageID:r.pageID,annotationBound:r.annotationBound,annotationType:r.annotationType}),this._trigger(i,u)))},_getPageModel:function(i){var r,u;if(this._on(n(window),"resize",this._viewerResize),i&&(this._isJsondataAvailable=!0),(i==""||i==null)&&(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0")),r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),r){for(this._pageWidth=r.pagewidth,this._pageHeight=r.pageheight,this._imageUrl=r.imageurl,this._pageSize=r.pagesize,this._totalPages=r.pagecount,this.pageCount=this._totalPages,this._pdfFileName=r.filename,this.fileName?this._pdfFileName=this.fileName:this._pdfFileName&&(this.fileName=this._pdfFileName),this._currentPage=r.currentpage,this._restrictionSummary=r.restrictionSummary,this._horizontalResolution=r.horizontalResolution,this._isRestrictionEnabled(),this._isPrintRestrict?this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"):this._isPrintRestrict||this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_Print"),this.currentPageNumber=this._currentPage,this._isToolbarClick||this._enableToolbarItems(),this._gotoPage(this._currentPage),this._toolbarResizeHandler(),this._setSearchToolbarTop(),this._resizeSearchToolbar(),this._drawPdfPage(i),u=0;u<this._totalPages;u++)this._newAnnotationList[u]=[],this._colorModifiedAnnotationList[u]=[],this._deletedAnnotationList[u]=[],this._existingAnnotationsModified[u]=[],this._redoAnnotationCollection[u]=[],this._annotationsDeletedNo[u]=0,this._totalAnnotations[u+1]=[];this._showNavigationIndicator(!1);this._showloadingIndicator(!1)}},_isRestrictionEnabled:function(){if(this._restrictionSummary)for(var n=0;n<this._restrictionSummary.length;n++)switch(this._restrictionSummary[n]){case"Print":this._isPrintRestrict=!0;break;case"CopyContent":this._isCopyRestrict=!0;break;default:this._isPrintRestrict=!1;this._isCopyRestrict=!1}},_print:function(){this._abortPrinting=!1;this._isPrintingProcess=!0;this._raiseClientEvent("beforePrint",null);this._showPrintLoadingIndicator(!0);this._setViewerForPrint();this._scrollPageByPage()},_setViewerForPrint:function(){this._isPrinting=!0;this._currentPageBackup=this._currentPage;this._scrollTop=n("#"+this._id+"_viewerContainer").scrollTop();this._zoomValBackup=this._zoomVal;this._zoomLevelBackup=this._zoomLevel;this._zoomVal!=1&&(this._zoomVal=1,this._zoomLevel=2,this._fitTypeBackup=this._fitType,this._zoomContainer(this._zoomVal,!1))},_scrollPageByPage:function(){for(var i,t,r,n=1;n<=this._totalPages;n++)if(this._scrollTriggered=!1,i=this._scrollToPageNo(n),i)break;this._isPrinting=!1;i||(t=navigator.userAgent,t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("Firefox")!=-1?(r=this,setTimeout(function(){r._printPages()},1e3)):this._printPages(),this._raiseClientEvent("afterPrint",null))},_scrollToPageNo:function(n){var r=this._currentPage,t,i;if(this._totalPages&&(t=parseInt(n),t>=1&&t<=this._totalPages))return this._currentPage=t,i=document.getElementById(this._id+"_viewerContainer"),i.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._scrollPage(this._pageHeight)},_scrollPage:function(){var n,i;return this._scrollTriggered=!0,n={},n.viewerAction=this._viewerAction.getPageModel,n.pageindex=this._currentPage.toString(),n.id=this._fileId,i=this.model.serviceUrl+"/"+this.model.serverActionSettings.print,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostPrint("POST",i,JSON.stringify(n)):this._doAjaxPostPrint("POST",this.model.serviceUrl,JSON.stringify({jsonResult:n})),!0},_printPages:function(){var o=navigator.userAgent,i=this,s=this._printIframe,u,t,p,d,g,nt,rt,w,it,v;for(s.name="printFrame",s.style.position="absolute",s.style.top="-100000000px",document.body.appendChild(s),u=s.contentWindow?s.contentWindow:s.contentDocument.document?s.contentDocument.document:s.contentDocument,u.document.open(),o.indexOf("Edge")==-1?o.indexOf("Chrome")!=-1||o.indexOf("Safari")!=-1||o.indexOf("Firefox")!=-1?(u.document.write("<!DOCTYPE html>"),u.document.write("<html moznomarginboxes mozdisallowselectionprint><head><style>html, body { height: 100%; } img { height: 100%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(u.document.write("<!DOCTYPE html>"),u.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(u.document.write("<!DOCTYPE html>"),u.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")),t=1;t<=i._totalPages;t++){var y="",c="",e=document.getElementById(this._id+"pagecanvas_"+t),k=document.getElementById(this._id+"selectioncanvas_"+t),f=document.getElementById(this._id+"_secondarycanvas_"+t);if(y=e.toDataURL(),p=f.toDataURL(),window.innerWidth<screen.width?(c=i._zoomVal,i._topValue=!0,d=i._pageContents[parseInt(t)],g=i._printPdfPages(d),y=g.toDataURL(),p=f.toDataURL()):c=1,o.indexOf("Firefox")==-1&&i._pageSize[t-1].PageWidth>i._pageSize[t-1].PageHeight){var l=e.getContext("2d"),a=f.getContext("2d"),h=new Image;l.clearRect(0,0,e.width,e.height);e.width=i._pageSize[t-1].PageHeight;e.height=i._pageSize[t-1].PageWidth;e.style.height=i._pageSize[t-1].PageWidth+"px";e.style.width=i._pageSize[t-1].PageHeight+"px";l.save();l.translate(e.width/2,e.height/2);l.rotate(-Math.PI/2);h.src=y;l.drawImage(h,-h.width/2,-h.height/2);l.restore();y=e.toDataURL();a.clearRect(0,0,f.width,f.height);f.width=i._pageSize[t-1].PageHeight;f.height=i._pageSize[t-1].PageWidth;f.style.height=i._pageSize[t-1].PageWidth+"px";f.style.width=i._pageSize[t-1].PageHeight+"px";a.save();a.translate(f.width/2,f.height/2);a.rotate(-Math.PI/2);h.src=p;a.drawImage(h,-h.width/2,-h.height/2);a.restore();p=f.toDataURL()}for(u.document.write('<div style="margin:0px;width:816px;height:1056px;position:relative"><img src="'+y+'" id="image_'+t+'" /><img src="'+p+'" id = "secimage_'+t+'" style="margin:0px;top:0px;left:0px;position:absolute;width:816px;height:1056px;z-index:2" /><div id="fields_'+t+'"><\/div><\/div><br/>'),nt=n(k).find(".e-pdfviewer-formFields").length,rt=2,w=0;w<nt;w++){var tt="",b=n(k).find(".e-pdfviewer-formFields")[w],r=b.cloneNode(!0);b.type=="select-one"&&(tt=b.selectedIndex,it=r.children,n(it[tt]).prop("selected",!0));var ut=i._pageSize[t-1].PageWidth,ft=i._pageSize[t-1].PageHeight,et=ft/1056,ot=ut/816,st=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0;(st||o.indexOf("Edge")!=-1)&&(n(r).css("left",parseFloat(n(r).css("left"))+"px"),n(r).css("top",parseFloat(n(r).css("top"))-6+"px"));window.innerWidth<screen.width&&(n(r).css("left",parseFloat(n(r).css("left"))/c+"px"),n(r).css("top",parseFloat(n(r).css("top"))/c+"px"));n(r).css("left",parseFloat(n(r).css("left"))/ot+"px");n(r).css("top",parseFloat(n(r).css("top"))/et+"px");n(r).css("width",parseFloat(n(r).css("width"))/c+"px");n(r).css("height",parseFloat(n(r).css("height"))/c+"px");n(u.document.getElementById("fields_"+t)).append(r)}}if(this._topValue=!1,u.document.write("<\/center><\/body><\/html>"),navigator.userAgent.match("Firefox")?window.frames.printFrame.close():u.document.close(),o.indexOf("Edge")==-1)if(o.indexOf("Chrome")!=-1||o.indexOf("Safari")!=-1||o.indexOf("Firefox")!=-1)i=this,setTimeout(function(){window.frames.printFrame.focus();window.frames.printFrame.print();document.body.removeChild(s)},500);else{v=n("iframe")[0];try{v.contentWindow.document.execCommand("print",!1,null)}catch(ht){v.contentWindow.print()}}else{v=n("iframe")[0];try{v.contentWindow.document.execCommand("print",!1,null)}catch(ht){v.contentWindow.print()}}this._restoreViewer()},_printCancel:function(){this._abortPrinting=!0;this._restoreViewer();this._raiseClientEvent("afterPrint",null)},_restoreViewer:function(){var n,t,i,r;for(this._isPrintingProcess=!1,this._currentPage=this._currentPageBackup,this._zoomVal=this._zoomValBackup,this._zoomLevel=this._zoomLevelBackup,n=1;n<=this._totalPages;n++)t=document.getElementById(this._id+"pagecanvas_"+n),this._pageSize[n-1].PageWidth>this._pageSize[n-1].PageHeight&&(t.style.height=this._pageSize[n-1].PageHeight+"px",t.style.width=this._pageSize[n-1].PageWidth+"px",t.width=this._pageSize[n-1].PageWidth,t.height=this._pageSize[n-1].PageHeight,this._renderedCanvasList.length=0);this._fitTypeBackup==null?this._zoomContainer(this._zoomVal,!1):(i=this._fitToPage(this._fitTypeBackup),this._applyDropDownVal(i,!0,!1),this._updatePageFitModel(this._fitType));r=document.getElementById(this._id+"_viewerContainer");r.scrollTop=this._scrollTop;this._showPrintLoadingIndicator(!1)},_doAjaxPostPrint:function(i,r,u){var e=JSON.parse(u),o,f;this._pdfService==t.PdfViewer.PdfService.Local?this._currentPrintPage=e.pageindex:(o=e.jsonResult,this._currentPrintPage=o.pageindex);this.model.allowClientBuffering&&this._isBuffering&&this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);f=this;n.ajax({type:i,url:r,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:u,traditional:!0,success:function(n){var i,u,r;(typeof n=="object"?f._printPdfPages(JSON.stringify(n)):f._printPdfPages(n),f._scrollTriggered=!1,f._abortPrinting)||(parseFloat(f._currentPrintPage)<f.pageCount?(i={},i.viewerAction=f._viewerAction.getPageModel,i.pageindex=(parseFloat(f._currentPrintPage)+1).toString(),i.id=f._fileId,u=f.model.serviceUrl+"/"+f.model.serverActionSettings.print,f._pdfService==t.PdfViewer.PdfService.Local?f._doAjaxPostPrint("POST",u,JSON.stringify(i)):f._doAjaxPostPrint("POST",f.model.serviceUrl,JSON.stringify({jsonResult:i}))):(r=navigator.userAgent,r.indexOf("Chrome")!=-1||r.indexOf("Safari")!=-1||r.indexOf("Firefox")!=-1?setTimeout(function(){f._printPages()},1e3):f._printPages(),f._raiseClientEvent("afterPrint",null)))},error:function(n){n.readyState!=0&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_printPdfPages:function(r){var ht=0,ti=r,a,ct,e,l,k,ft,nt,y,s,d,st,o,f;if(jsondata=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),a=parseInt(jsondata.currentpage),this._showPageLoadingIndicator(a,!0),ct=jsondata.imagestream,e=parseInt(jsondata.currentpage),this._renderedCanvasList.indexOf(e)==-1&&this._renderedCanvasList.push(parseInt(jsondata.currentpage)),this._pageContents[a]||(this._textMarkupAnnotationList[parseInt(jsondata.currentpage)]=jsondata.textMarkupAnnotation),this._pageContents[parseInt(jsondata.currentpage)]=ti,(this._textMarkupAnnotationList[a]||this._newAnnotationList[pageIndex-1])&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[a],a),this._topValue==!0){var lt=parseInt(jsondata.currentpage),l=document.createElement("canvas"),at=this._pageSize[lt-1].PageHeight,vt=this._pageSize[lt-1].PageWidth;l.style.visibility="hidden";l.style.width=vt+"px";l.style.height=at+"px";l.style.backgroundColor="white";l.className="e-pdfviewer-pageCanvas";l.height=at;l.width=vt}else l=document.getElementById(this._id+"pagecanvas_"+parseInt(jsondata.currentpage));(this._pageSize[e-1].PageRotation==90||this._pageSize[e-1].PageRotation==270)&&(l.height=this._zoomVal*this._pageSize[e-1].PageHeight,l.width=this._zoomVal*this._pageSize[e-1].PageWidth,l.style.width=this._zoomVal*this._pageSize[e-1].PageWidth+"px",l.style.height=this._zoomVal*this._pageSize[e-1].PageHeight+"px");var u=l.getContext("2d"),ut=[],yt=[],ii=[],w=navigator.userAgent,g,pt=[];for(this._regenerateFormFields(jsondata,a),k=n("#"+this._id+"selectioncanvas_"+a).children(),y=0;y<k.length;y++)(k[y].hasAttribute("href")||n(k[y]).hasClass("e-pdfviewer-formFields"))&&n(k[y]).remove();for(this._createFormFields(jsondata,a),ft=ct.textelements,nt=0;nt<ft.length;nt++){var h=ft[nt],et=h.color,c=h.matrix;c!=null&&(c=c.Elements);var wt=h.brush,v=h.pathValue,ri=h.iscliping,bt=h.restorecanvas,ot=h.imagedata,b=h.fillrule,ui=h.isFillandStroke,fi=h.fillcolor,kt=h.strokecolor,dt=h.linewidth,gt=h.linecap,tt=h.linearGradientBrush,it=h.textureBrushs,rt=h.charID;if(v!=null?(v=v.split(";"),rt&&(pt[rt]=v)):v==null&&rt&&(v=pt[rt]),bt==!1&&u.save(),v!=i&&u.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]),v!=null){for(u.beginPath(),y=0;y<v.length;y++)s=v[y],d=s[0],d=="M"?(s=s.substring(1,s.length),s=s.split(" "),u.moveTo(s[0],s[1])):d=="L"?(s=s.substring(1,s.length),s=s.split(" "),u.lineTo(s[0],s[1])):d=="C"?(s=s.substring(1,s.length),s=s.split(" "),u.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])):d=="Z"&&u.closePath();ri==!0?(b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(b)),u.clip()):ui==i?wt=="Fill"?(u.fillStyle=tt!=i?this._getGradientBrush(tt,u):it!=i?this._createTextureBrush(it,u,h):et,b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(b)),u.fill()):wt=="FillandStroke"?(u.fillStyle=et,u.fill(),u.strokeStyle=kt,u.stroke()):(u.strokeStyle=et,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke(),u.fillStyle=tt!=i?this._getGradientBrush(tt,u):it!=i?this._createTextureBrush(it,u,h):fi,b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(b)),u.fill())}bt&&u.restore();ot!=i&&((g=w.indexOf("Firefox"))==-1&&(g=w.indexOf("Chrome"))==-1&&(g=w.indexOf("Safari"))==-1&&(g=w.indexOf("AppleWebKit"))==-1||this._topValue?(st=new Image,st.src=ot,u.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]),u.drawImage(st,0,0,1,1)):(ut.push(ot),yt.push(c),this._printWinImageRendering(ut,yt,ii,u,l,ht,e),ht++))}if(o=l,f=this,this._pageSize[e-1].PageRotation!=0&&!(ut.length!=0&&(w.indexOf("Firefox")!=-1||w.indexOf("Chrome")!=-1))){o=document.getElementById(this._id+"pagecanvas_"+parseInt(jsondata.currentpage));var ni=o.toDataURL(),u=o.getContext("2d"),p=new Image;w.indexOf("Firefox")!=-1?(p.onload=function(){u.clearRect(0,0,o.width,o.height);f._pageSize[e-1].PageRotation==90||f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight,o.height=f._zoomVal*f._pageSize[e-1].PageWidth,o.style.height=f._zoomVal*f._pageSize[e-1].PageWidth+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageHeight+"px"):(o.width=f._zoomVal*f._pageSize[e-1].PageWidth,o.height=f._zoomVal*f._pageSize[e-1].PageHeight,o.style.height=f._zoomVal*f._pageSize[e-1].PageHeight+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageWidth+"px");u.save();u.translate(o.width/2,o.height/2);u.rotate(f._pageSize[e-1].PageRotation/2*Math.PI/2);u.drawImage(p,-p.width/2,-p.height/2);u.restore()},p.src=ni):(u.clearRect(0,0,o.width,o.height),f._pageSize[e-1].PageRotation==90||f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight,o.height=f._zoomVal*f._pageSize[e-1].PageWidth,o.style.height=f._zoomVal*f._pageSize[e-1].PageWidth+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageHeight+"px"):(o.width=f._zoomVal*f._pageSize[e-1].PageWidth,o.height=f._zoomVal*f._pageSize[e-1].PageHeight,o.style.height=f._zoomVal*f._pageSize[e-1].PageHeight+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageWidth+"px"),u.save(),u.translate(o.width/2,o.height/2),u.rotate(f._pageSize[e-1].PageRotation/2*Math.PI/2),p.src=ni,u.drawImage(p,-p.width/2,-p.height/2),u.restore())}return this._showPageLoadingIndicator(a,!1),o},_printWinImageRendering:function(n,t,r,u,f,e,o){var s=this,h=new Image;h.onload=function(){var f=t[e];if(u.setTransform(f[0],f[1],f[2],f[3],f[4],f[5]),r[e]!=i&&u.drawImage(r[e],0,0,1,1),r.length-1==e&&s._pageSize[o-1].PageRotation!=0){var n=document.getElementById(s._id+"pagecanvas_"+o),l=n.toDataURL(),h=n.getContext("2d"),c=new Image;c.onload=function(){h.clearRect(0,0,n.width,n.height);s._pageSize[o-1].PageRotation==90||s._pageSize[o-1].PageRotation==270?(n.width=s._zoomVal*s._pageSize[o-1].PageHeight,n.height=s._zoomVal*s._pageSize[o-1].PageWidth,n.style.height=s._zoomVal*s._pageSize[o-1].PageWidth+"px",n.style.width=s._zoomVal*s._pageSize[o-1].PageHeight+"px"):(n.width=s._zoomVal*s._pageSize[o-1].PageWidth,n.height=s._zoomVal*s._pageSize[o-1].PageHeight,n.style.width=s._zoomVal*s._pageSize[o-1].PageWidth+"px",n.style.height=s._zoomVal*s._pageSize[o-1].PageHeight+"px");h.save();h.translate(n.width/2,n.height/2);h.rotate(s._pageSize[o-1].PageRotation/2*Math.PI/2);h.drawImage(c,-c.width/2,-c.height/2);h.restore()};c.src=l}};h.src=n[e];r.push(h)},_showPrintButton:function(t){t?(n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isPrintHidden=!1):(n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isPrintHidden=!0)},_showDownloadButton:function(t){t?(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isDownloadHidden=!1):(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isDownloadHidden=!0)},_updatePageNavigation:function(n,t){n>1&&n<t?(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):n==1&&n<t?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):n==t&&t!=1?(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast"));this._isJsondataAvailable||(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast"));this.currentPageNumber=this._currentPage},_gotoFirstPage:function(){if(this._totalPages&&this._totalPages>0){this._currentPage=1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoLastPage:function(){if(this._totalPages&&this._totalPages>0){this._currentPage=this._totalPages;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoNextPage:function(){if(this._totalPages&&this._currentPage<this._totalPages){this._currentPage=this._currentPage+1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPreviousPage:function(){if(this._totalPages&&this._currentPage>1){this._currentPage=this._currentPage-1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPageNo:function(n){var i={currentPageNumber:0},r=n,f=this._currentPage,t,u;this._totalPages&&(t=parseInt(n),t>=1&&t<=this._totalPages&&this._currentPage!=t&&(this._currentPage=t,u=document.getElementById(this._id+"_viewerContainer"),u.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._pageviewscrollchanged(this._pageHeight),this._updatePageNavigation(this._currentPage,this._totalPages)));f!=r&&(i.currentPageNumber=r,this._raiseClientEvent("pageChange",i))},_gotoPage:function(t){this._setPageSize(this._pageHeight,this._pageWidth,null,null);var i=parseInt(t);this._updatePageNavigation(i,this._totalPages);this._totalPages>0&&this._totalPages&&(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(i))},_allowOnlyNumbers:function(n){return(n.which<48||n.which>57)&&n.which!=8&&n.which!=13?!1:!0},_onkeyPress:function(t){if(t.which==13){t.preventDefault();try{var i=parseInt(n(t.currentTarget).val());i>0&&i<=this.pageCount?this._gotoPageNo(i):n(t.currentTarget).val(this.currentPageNumber)}catch(r){}}},_showPageNavigationControls:function(t){t?(n("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","block"),n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","1px"),this._isNavigationHidden=!1):(n("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","none"),this._isNavigationHidden=!0,!this._isPrintHidden&&this._isNavigationHidden&&this._isMagnificationHidden&&n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","0px"))},_showFittoPage:function(t){t?(n("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_fitPage").parents("ul.e-pdfviewer-toolbarul").css("display","block")):(n("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_fitPage").parents("ul.e-pdfviewer-toolbarul").css("display","none"))},_resetPage:function(){var t=n("#"+this._id+"_pageviewContainer"),r=n("#"+this._id+"_pageviewOuterline");t[0]!=i&&(r.css({width:t.width(),height:t.height()}),r.css({width:t[0].getBoundingClientRect().width,height:t[0].getBoundingClientRect().height}))},_applyFitToWidth:function(){this._isAutoZoom=!1;_scaleXY=this._fitToPage("fitToWidth");this._applyDropDownVal(_scaleXY,!0,!1);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_applyFitToPage:function(){this._isAutoZoom=!1;_scaleXY=this._fitToPage("fitToPage");this._applyDropDownVal(_scaleXY,!1,!0);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_updatePageFitModel:function(n){n=="fitToWidth"?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage")):n=="fitToPage"&&(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"))},_applyFitToWidthAuto:function(){_scaleXY=this._fitToAuto("fitToWidth");this._applyDropDownValAuto(_scaleXY,!0,!1)},_fitToAuto:function(){this._resetPage();var r=n("#"+this._id+"_viewerContainer"),o=n("#"+this._id+"_pageviewContainer"),s=n("#"+this._id+"_pageviewOuterline");if(r[0]!=i){var f=r.width(),h=r.height(),e=this._pageWidth,c=this._pageHeight,t=1,u=1;return t=(f-25)/e,this._isAutoZoom&&(t=Math.min(1,t),t==1&&(this._zoomLevelBackup=this._zoomLevel=3)),window.innerWidth>=screen.width&&(this._isWindowResizing=!1),u=t,this._zoomVal=t,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),this._initRerendering(),this._updateZoomButtons(),{scalX:t,scalY:u}}},_fitToPage:function(t){var f,v,r,a;if(this._pageSize!=i){this._resetPage();var h=n("#"+this._id+"_viewerContainer"),y=n("#"+this._id+"_pageviewContainer"),p=n("#"+this._id+"_pageviewOuterline"),o=h.width(),c=h.height();if(t=="fitToWidth")for(f=0;f<this._pageSize.length;f++)v=0,pageWidth=this._pageSize[f].PageRotation==90||this._pageSize[f].PageRotation==270?this._pageSize[f].PageHeight:this._pageSize[f].PageWidth,pageWidth>this._highestWidth&&(this._highestWidth=pageWidth);else this._highestWidth=this._pageWidth;var s=this._highestWidth,l=this._pageHeight,u=1,e=1;if(this._fitType=t,t=="fitToPage"){u=(o-25)/s;e=c/l;c>l&&(e=this._preZoomVal);o>s&&(u=this._preZoomVal);u=e;this._zoomVal=u;this._zoomInContainer();this._calculateZoomLevel(this._zoomVal);r=this;a=document.getElementById(this._id+"_viewerContainer");n("#"+this._id+"_viewerContainer").on("mousewheel DOMMouseScroll",function(t){var i=document.getElementById(r._id+"_viewerContainer"),u=n("#"+r._id+"_pdfviewer_toolbar_fitPage").attr("aria-disabled");u=="true"&&(t.originalEvent.wheelDelta>0||t.originalEvent.detail<0?r._currentPage>1&&(i.scrollTop=parseFloat(r._pageLocation[r._currentPage-1]*r._zoomVal)):r._currentPage!=r._totalPages&&(i.scrollTop=parseFloat(r._pageLocation[r._currentPage+1]*r._zoomVal)),t.preventDefault())});n(window).on("keydown",function(t){var i=document.getElementById(r._id+"_viewerContainer"),u=n("#"+r._id+"_pdfviewer_toolbar_fitPage").attr("aria-disabled");u=="true"&&(r._currentPage>1&&t.keyCode=="38"?i.scrollTop=parseFloat(r._pageLocation[r._currentPage-1]*r._zoomVal):r._currentPage!=r._totalPages&&t.keyCode=="40"&&(i.scrollTop=parseFloat(r._pageLocation[r._currentPage+1]*r._zoomVal)))});a.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal)}else t=="fitToWidth"&&(u=(o-25)/s,e=u,this._zoomVal=u,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal));return this._updateZoomButtons(),{scalX:u,scalY:e}}},_selectDropDownIndex:function(t){var i=n(n("#"+this._id+"_toolbar_zoomSelection_popup li")[t]);i.addClass("e-active");n("#"+this._id+"_toolbar_zoomSelection_input").val(i.text())},_applyDropDownVal:function(t,r,u){if(t!=i)if(u){var f=t.scalX>t.scalY?t.scalY:t.scalX;n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(f*100)+"%");this._ejDropDownInstance.model.value=Math.round(f*100)+"%";this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else r?(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalX*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalX*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalY*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_applyDropDownValAuto:function(i){if(this._isAutoZoom){var u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],r=u.contextMenu.auto.contentText;n("#"+this._id+"_toolbar_zoomSelection_hidden").val(r);this._ejDropDownInstance.model.value=r}else n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(i.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(i.scalY*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")},_showFitToPagetip:function(){var t=n("#"+this._id+"_toolbar_fittoPagePopup"),r,i;t.length>0||(t=this._renderPageFitPopup(),n("body").append(t),this._on(n("#"+this._id+"_toolbar_fittoPagePopup li.e-pdfviewer-popupli"),"click",this._pageFitMenuClick));t.css("display")=="block"?t.css("display","none"):t.css("display","block");r=n("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0].getBoundingClientRect();i=n(n("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0]).offset();t.css({top:i.top+r.height-3,left:i.left-5})},_zoomValChange:function(r){var o,s,u,h,e,f;this._ejViewerInstance||(o=this._id.split("_toolbar")[0],s=n("#"+o),ejViewerInstance=s.ejPdfViewer("instance"));h=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"];e=h.contextMenu.auto.contentText;r.value!=i?(r.value==e?(ejViewerInstance.model.isResponsive=!0,u=1,ejViewerInstance._zoomLevel=3,ejViewerInstance._isAutoZoom=!0):(u=parseInt(r.value)/100,ejViewerInstance.model.isResponsive=!1,ejViewerInstance._zoomLevel=r.itemId,ejViewerInstance._isAutoZoom=!1),ejViewerInstance._zoomContainer(u,!1)):r.target.innerHTML!=i&&(f=r.target.innerHTML,r.target.innerHTML==e?(ejViewerInstance.model.isResponsive=!0,u=1,ejViewerInstance._isAutoZoom=!0):(f=f.substring(0,f.length-1),u=parseInt(f)/100,ejViewerInstance.model.isResponsive=!1,ejViewerInstance._isAutoZoom=!1),ejViewerInstance._zoomContainer(u,!1))},_zoomIn:function(){if(this._zoomLevel>=7?this._zoomLevel=7:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}this.model.isResponsive=!1},_zoomOut:function(){if(this._zoomLevel<=1?this._zoomLevel=1:this._zoomLevel--,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}this.model.isResponsive=!1},_zoomInContainer:function(t,i){var d=i,p=n("#"+this._id+"_viewerContainer"),w=n("#"+this._id+"_pageviewContainer"),h,l,f,e,c,s,k,v,r,y;this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+d);var it=w.width(),rt=w.height(),a={currentZoomPercentage:0,previousZoomPercentage:0},b=document.getElementById(this._id+"_viewerContainer"),g=b.scrollTop,nt=g/this._previousZoom*this._zoomVal,ut="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++){l=0;this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(h=(this.element.width()-this._pageSize[r-1].PageHeight*this._zoomVal)/2,l=this._pageSize[r-1].PageHeight):(h=(this.element.width()-this._pageSize[r-1].PageWidth*this._zoomVal)/2,l=this._pageSize[r-1].PageWidth);(h<0||this._fitType=="fitToWidth"&&l==this._highestWidth)&&(h=5);var u=document.getElementById(this._id+"pagecanvas_"+r),o=document.getElementById(this._id+"_secondarycanvas_"+r),tt=u.getContext("2d");this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(u.height=this._pageSize[r-1].PageWidth*this._zoomVal,u.width=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.height=this._pageSize[r-1].PageWidth*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageHeight*this._zoomVal+"px",f=this._pageSize[r-1].PageWidth*this._zoomVal,e=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px"):(u.height=this._pageSize[r-1].PageHeight*this._zoomVal,u.width=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.height=this._pageSize[r-1].PageHeight*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageWidth*this._zoomVal+"px",f=this._pageSize[r-1].PageHeight*this._zoomVal,e=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px");tt.clearRect(0,0,u.clientWidth,u.clientHeight);c=n("#"+this._id+"pageDiv_"+r);c[0].style.top=this._pageLocation[r]*this._zoomVal+"px";c[0].style.left=h+"px";c[0].style.width=e+"px";c[0].style.height=f+"px";s=document.getElementById(this._id+"selectioncanvas_"+r);s.style.height=u.height+"px";s.style.width=u.width+"px";s.style.position="absolute";s.style.left=0;s.style.top=0;s.style.backgroundColor="transparent";s.style.zIndex="2";this._isAutoZoom||(n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"}),k=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup"),v=k.childNodes[0],v.style.top=(u.height-v.clientHeight)/2+"px")}if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?p.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):p.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].onload=null;n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;b.scrollTop=nt;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._preZoomVal=this._zoomVal;this._previousZoom=this._zoomVal;a.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);a.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",a);this.zoomPercentage=Math.round(this._zoomVal*100);this._highestWidth=0;y=[];this._selectedAnnotationObject&&(y.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,y))},_zoomOutContainer:function(t,i){var k=i,y=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewContainer"),c,f,e,h,s,b,a,r,v;this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+k);var tt=p.width(),it=p.height(),l={currentZoomPercentage:0,previousZoomPercentage:0},w=document.getElementById(this._id+"_viewerContainer"),d=w.scrollTop,g=d/this._previousZoom*this._zoomVal,rt="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++){c=this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(this.element.width()-this._pageSize[r-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[r-1].PageWidth*this._zoomVal)/2;c<0&&(c=5);var u=document.getElementById(this._id+"pagecanvas_"+r),nt=u.getContext("2d"),o=document.getElementById(this._id+"_secondarycanvas_"+r);this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(u.height=this._pageSize[r-1].PageWidth*this._zoomVal,u.width=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.height=this._pageSize[r-1].PageWidth*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageHeight*this._zoomVal+"px",f=this._pageSize[r-1].PageWidth*this._zoomVal,e=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px"):(u.height=this._pageSize[r-1].PageHeight*this._zoomVal,u.width=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.height=this._pageSize[r-1].PageHeight*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageWidth*this._zoomVal+"px",f=this._pageSize[r-1].PageHeight*this._zoomVal,e=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px");nt.clearRect(0,0,u.clientWidth,u.clientHeight);h=n("#"+this._id+"pageDiv_"+r);h[0].style.top=this._pageLocation[r]*this._zoomVal+"px";h[0].style.left=c+"px";h[0].style.width=e+"px";h[0].style.height=f+"px";s=document.getElementById(this._id+"selectioncanvas_"+r);s.style.height=u.height+"px";s.style.width=u.width+"px";s.style.position="absolute";s.style.left=0;s.style.top=0;s.style.backgroundColor="transparent";s.style.zIndex="2";n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"});b=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup");a=b.childNodes[0];a.style.top=(u.height-a.clientHeight)/2+"px"}if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?y.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):y.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].onload=null;n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;w.scrollTop=g;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;l.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);l.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",l);this.zoomPercentage=Math.round(this._zoomVal*100);v=[];this._selectedAnnotationObject&&(v.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,v))},_zoomContainer:function(n,t){if(this._fitType=null,this._zoomVal=n,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isAutoZoom&&this._renderedCanvasList&&this._isWindowResizing)this._applyFitToWidthAuto(),n=this._zoomVal;else{var i=Math.abs(this._preZoomVal-n);if(i==0)return!1;this._preZoomVal>n?this._zoomOutContainer(t,i):this._zoomInContainer(t,i)}this._preZoomVal=n;this._updateZoomButtons()},_calculateZoomLevel:function(n){var r;this._calculateZoomArrayValues();for(var u=n,t=0,i=this._zoomArray.length-1;t<=i&&!(t==0&&i==0);)r=Math.round((t+i)/2),this._zoomArray[r]<=u?t=r+1:this._zoomArray[r]>=u&&(i=r-1);this._lowerZoomIndex=i;this._higherZoomIndex=t;this._zoomLevel=this._lowerZoomIndex},_applyLowerZoomIndex:function(){var t=0,n;for(this._calculateZoomArrayValues(),n=0;n<this._zoomArray.length;n++)this._preZoomVal!=this._zoomArray[n]&&t++;t==this._zoomArray.length&&(this._zoomLevel=this._lowerZoomIndex);this._fitType=null},_applyHigherZoomIndex:function(){var t=0,n;for(this._calculateZoomArrayValues(),n=0;n<this._zoomArray.length;n++)this._preZoomVal!=this._zoomArray[n]&&t++;t==this._zoomArray.length&&(this._zoomLevel=this._higherZoomIndex);this._fitType=null},_calculateZoomArrayValues:function(){var t,r,n;if(this._zoomArray==i)for(t=document.getElementById(this._id+"_toolbar_zoomSelection_popup").getElementsByTagName("li"),r=[],this._zoomArray=r,n=0;n<t.length;n++)r.push(parseInt(t[n].textContent)/100)},_updateZoomButtons:function(){this._zoomVal<=.5?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin")):this._zoomVal==4?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout")):(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin"))},_showZoomControl:function(t){t?(n("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","block"),this._isMagnificationHidden=!1):(n("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","none"),this._isMagnificationHidden=!0)},_fitToAutoSize:function(){for(var o,e,r,h,c,a,v,y,it=this._zoomVal,p=n("#"+this._id+"_viewerContainer"),w=n("#"+this._id+"_pageviewContainer"),rt=w.width(),ut=w.height(),l={currentZoomPercentage:0,previousZoomPercentage:0},b=document.getElementById(this._id+"_viewerContainer"),nt=b.scrollTop,tt=nt/this._previousZoom*this._zoomVal,ft="scale("+this._zoomVal+","+this._zoomVal+")",i=1;i<=this._totalPages;i++){o=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[i-1].PageWidth*this._zoomVal)/2;(this._isAutoZoom&&this._zoomVal<1||o<0)&&(o=5);var s=document.getElementById(this._id+"pagecanvas_"+i),d=document.getElementById(this._id+"_secondarycanvas_"+i),g=s.getContext("2d"),u,f;if(this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(u=this._pageSize[i-1].PageWidth*this._zoomVal,f=this._pageSize[i-1].PageHeight*this._zoomVal):(u=this._pageSize[i-1].PageHeight*this._zoomVal,f=this._pageSize[i-1].PageWidth*this._zoomVal),s.style.height=u+"px",s.style.width=f+"px",d.style.width=f+"px",d.style.height=u+"px",e=n("#"+this._id+"pageDiv_"+i),e[0].style.top=this._pageLocation[i]*this._zoomVal+"px",e[0].style.left=o+"px",e[0].style.width=f+"px",e[0].style.height=u+"px",r=document.getElementById(this._id+"selectioncanvas_"+i),r.style.height=u+"px",r.style.width=f+"px",r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.backgroundColor="transparent",r.style.zIndex="2",h=this._pageContents[parseInt(i)],h&&this._renderedCanvasList.indexOf(i)!=-1){for(jsondata=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(h):JSON.parse(h.d),c=n("#"+this._id+"selectioncanvas_"+i).children(),k=0;k<c.length;k++)n(c[k]).hasClass("e-pdfviewer-textLayer")&&(n(c[k]).remove(),n("#"+this._id+"selectioncanvas_"+i).removeClass("text_container"));n("#"+this._id+"selectioncanvas_"+i).hasClass("text_container")?this._resizeSelection(jsondata,i,g):this._textSelection(jsondata,i,g)}n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").css({display:"none",height:u+"px",width:f+"px",left:"0px",top:"0px"});a=document.getElementById(this._id+"pageDiv_"+i+"_WaitingPopup");a&&(v=a.childNodes[0],v.style.top=(s.height-v.clientHeight)/2+"px")}this._zoomVal<1?p.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):p.css({"-ms-scroll-limit-y-max":""});n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;b.scrollTop=tt;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;this._preZoomVal=this._zoomVal;l.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);l.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",l);this.zoomPercentage=Math.round(this._zoomVal*100);y=[];this._selectedAnnotationObject&&(y.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,y))},_initRerendering:function(){var n,u,t,i,r;this._isRerenderCanvasCreated||(this._designNewCanvas(),n=[],u=this._currentPage,n.push(parseInt(this._currentPage)),this._renderedCanvasList?(t=parseInt(this._currentPage)-1,this._renderedCanvasList.indexOf(t)!=-1&&n.push(t),i=parseInt(this._currentPage)+1,this._renderedCanvasList.indexOf(i)!=-1&&n.push(i)):(t=parseInt(this._currentPage)-1,n.push(t),i=parseInt(this._currentPage)+1,n.push(i)),this._rerenderCanvasList=n,!0&&(r=this,clearInterval(r._scrollTimer),r._bgRenderTimer=setInterval(function(){r._rerenderCanvas(u)},10)),this._renderedCanvasList.length=0)},_designNewCanvas:function(){for(var f,t=1;t<=this._totalPages;t++){var o=document.getElementById(this._id+"pageDiv_"+t),e=document.getElementById(this._id+"pagecanvas_"+t),i=document.createElement("canvas"),r,u;this._pageSize[t-1].PageRotation==90||this._pageSize[t-1].PageRotation==270?(r=this._pageSize[t-1].PageWidth*this._zoomVal,u=this._pageSize[t-1].pageHeight*this._zoomVal):(r=this._pageSize[t-1].PageHeight*this._zoomVal,u=this._pageSize[t-1].PageWidth*this._zoomVal);i.style.visibility="hidden";i.style.width=u+"px";i.style.height=r+"px";i.style.backgroundColor="white";i.height=r;i.width=u;i.id=e.id;i.className="e-pdfviewer-pageCanvas";e.id=this._id+"oldcanvas_"+t;o.appendChild(i);n(i).css({"user-select":"none"});f=document.getElementById(this._id+"_secondarycanvas_"+t);f.style.width=u+"px";f.style.height=r+"px";f.width=u;f.height=r}this._isRerenderCanvasCreated=!0},_replaceOldCanvas:function(){for(var t,n=1;n<=this._totalPages;n++){var i=document.getElementById(this._id+"pageDiv_"+n),r=document.getElementById(this._id+"pagecanvas_"+n),u=document.getElementById(this._id+"oldcanvas_"+n);r.style.visibility="visible";i.removeChild(u)}this._isRerenderCanvasCreated=!1;t=this;clearInterval(t._bgRenderTimer);t._scrollTimer=setInterval(function(){t._pageviewscrollchanged(t._pageHeight)},500)},_rerenderCanvas:function(t){var i,r;if(this._renderedCanvasList.indexOf(parseInt(t))==-1&&t<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t))!=-1?(i=this._pageContents[parseInt(t)],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1):this._renderedCanvasList.indexOf(parseInt(t)-1)==-1&&t-1<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t)-1)!=-1?(i=this._pageContents[parseInt(t)-1],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1):this._renderedCanvasList.indexOf(parseInt(t)+1)==-1&&t+1<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t)+1)!=-1&&(i=this._pageContents[parseInt(t)+1],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1),this._renderCount==this._rerenderCanvasList.length){for(this._replaceOldCanvas(),r=1;r<=this._totalPages;r++)this._renderedCanvasList.indexOf(r)==-1&&n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block"});this._renderCount=0;this._rerenderCanvasList.length=0}},_rerenderPdfPage:function(r){var si=r,v,ti,nt,a,e,tt,at,ii,o,b,it,p,f,rt,ni,ht,c,s;for(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),v=parseInt(r.currentpage),ti=r.imagestream,this._pageContents[parseInt(r.currentpage)]=si,this._regenerateFormFields(r,v),nt=n("#"+this._id+"selectioncanvas_"+v).children(),p=0;p<nt.length;p++)(nt[p].hasAttribute("href")||n(nt[p]).hasClass("e-pdfviewer-formFields"))&&n(nt[p]).remove();this._createFormFields(r,v);var w=r.linkannotation,ct=r.annotpagenum,lt=this;if(this.model.enableHyperlink)for(a=0;a<w.length;a++){if(e=document.createElement("a"),e.id="linkdiv_"+a,tt=w[a].AnnotRectangle,e.style.background="transparent",e.style.position="absolute",e.style.left=this._convertPointToPixel(tt.Left*this._zoomVal)+"px",e.style.top=this._convertPointToPixel(tt.Top*this._zoomVal)+"px",e.style.width=this._convertPointToPixel(tt.Width*this._zoomVal)+"px",e.style.height=this._convertPointToPixel(tt.Height*this._zoomVal)+"px",e.style.color="transparent",w[a].URI.indexOf("mailto:")!=-1?(at=w[a].URI.substring(w[a].URI.indexOf("mailto:"),w[a].URI.length),e.title=at,e.setAttribute("href",at)):(e.title=w[a].URI,e.setAttribute("href",w[a].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(e.target="_self",e.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(e.target="_blank",e.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(e.onclick=function(){var n={hyperlink:this.href};return lt._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),ct[a]!=i){var hi=this._pageSize[v-1].PageHeight,ci=this._convertPointToPixel(w[a].AnnotLocation),li=hi-ci,ai=parseFloat(this._pageLocation[ct[a]]*this._zoomVal)+parseFloat(li*this._zoomVal);e.name=ai;e.onclick=function(){var n=document.getElementById("container_viewerContainer");return n.scrollTop=this.name,!1}}ct[a]!=null&&(ii=document.getElementById(this._id+"selectioncanvas_"+v),ii.appendChild(e))}this._textMarkupAnnotationList[v]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[v],v);o=parseInt(r.currentpage);b=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));(this._pageSize[o-1].PageRotation==90||this._pageSize[o-1].PageRotation==270)&&(b.height=this._zoomVal*this._pageSize[o-1].PageHeight,b.width=this._zoomVal*this._pageSize[o-1].PageWidth,b.style.width=this._zoomVal*this._pageSize[o-1].PageWidth+"px",b.style.height=this._zoomVal*this._pageSize[o-1].PageHeight+"px");var u=b.getContext("2d"),vt=[],ri=[],vi=[],ui=[],fi=[],yi,k=navigator.userAgent,d,ei=0,yt=[],ft=ti.textelements;for(it=0;it<ft.length;it++){var h=ft[it],pt=h.color,l=h.matrix;l!=null&&(l=l.Elements);var wt=h.brush,y=h.pathValue,pi=h.iscliping,oi=h.restorecanvas,bt=h.imagedata,g=h.fillrule,wi=h.isFillandStroke,bi=h.fillcolor,kt=h.strokecolor,dt=h.linewidth,gt=h.linecap,et=h.linearGradientBrush,ot=h.textureBrushs,st=h.charID;if(y!=null?(y=y.split(";"),st&&(yt[st]=y)):y==null&&st&&(y=yt[st]),oi==!1&&u.save(),y!=i&&u.setTransform(l[0]*this._zoomVal,l[1],l[2],l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),y!=null){for(u.beginPath(),p=0;p<y.length;p++)f=y[p],rt=f[0],rt=="M"?(f=f.substring(1,f.length),f=f.split(" "),u.moveTo(f[0],f[1])):rt=="L"?(f=f.substring(1,f.length),f=f.split(" "),u.lineTo(f[0],f[1])):rt=="C"?(f=f.substring(1,f.length),f=f.split(" "),u.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5])):rt=="Z"&&u.closePath();pi==!0?(g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(g)),u.clip()):wi==i?wt=="Fill"?(u.fillStyle=et!=i?this._getGradientBrush(et,u):ot!=i?this._createTextureBrush(ot,u,h):pt,g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(g)),u.fill()):wt=="FillandStroke"?(u.fillStyle=pt,u.fill(),u.strokeStyle=kt,u.stroke()):wt=="Stroke"?(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=pt,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke(),u.fillStyle=et!=i?this._getGradientBrush(et,u):ot!=i?this._createTextureBrush(ot,u,h):bi,g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(g)),u.fill())}if(oi&&u.restore(),bt!=i)if((d=k.indexOf("Firefox"))!=-1||(d=k.indexOf("Chrome"))!=-1||(d=k.indexOf("Safari"))!=-1||(d=k.indexOf("AppleWebKit"))!=-1){vt.push(bt);ri.push(l);fi.push(ft);ui.push(it);yi=this._zoomVal;this._isContainImage=!0;break}else ni=new Image,ni.src=bt,u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),u.drawImage(ni,0,0,1,1)}if((d=k.indexOf("Firefox"))!=-1||(d=k.indexOf("Chrome"))!=-1||(d=k.indexOf("Safari"))!=-1||(d=k.indexOf("AppleWebKit"))!=-1)for(ht=0;ht<vt.length;ht++)this._imageRenderingPinch(ft,vi,vt,ri,u,ht,fi,ui,yt,b,o,ei),ei++;if(c=b,s=this,this._pageSize[o-1].PageRotation!=0){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var ki=c.toDataURL(),u=c.getContext("2d"),ut=new Image;ut.onload=function(){u.clearRect(0,0,c.width,c.height);s._pageSize[o-1].PageRotation==90||s._pageSize[o-1].PageRotation==270?(c.width=s._zoomVal*s._pageSize[o-1].PageHeight,c.height=s._zoomVal*s._pageSize[o-1].PageWidth,c.style.height=s._zoomVal*s._pageSize[o-1].PageWidth+"px",c.style.width=s._zoomVal*s._pageSize[o-1].PageHeight+"px"):(c.width=s._zoomVal*s._pageSize[o-1].PageWidth,c.height=s._zoomVal*s._pageSize[o-1].PageHeight,c.style.height=s._zoomVal*s._pageSize[o-1].PageHeight+"px",c.style.width=s._zoomVal*s._pageSize[o-1].PageWidth+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(s._pageSize[o-1].PageRotation/2*Math.PI/2);u.drawImage(ut,-ut.width/2,-ut.height/2);u.restore()};ut.src=ki}return this._showPageLoadingIndicator(v,!1),c},_regenerateFormFields:function(t,i){var u=t.PdfRenderedFields,r,c,f,o,h,e,s;if(u!=null)for(r=0;r<u.length;r++)if(u[r].PageIndex+1==i)if(c=u[r].LineBounds,f=document.getElementById(this._id+"input_"+i+"_"+r),u[r].Name=="Textbox")o=n(f).attr("name"),u[r].FieldName==o&&(u[r].Text=n(f).val());else if(u[r].Name=="Password")o=n(f).attr("name"),u[r].FieldName==o&&(u[r].Text=n(f).val());else if(u[r].Name=="RadioButton")o=n(f).attr("name"),u[r].GroupName==o&&(u[r].Selected=n(f).prop("checked")==!0?!0:!1);else if(u[r].Name=="CheckBox")o=n(f).attr("name"),u[r].GroupName==o&&(u[r].Selected=n(f).prop("checked")==!0?!0:!1);else if(u[r].Name=="DropDown"){if(o=n(f).attr("name"),u[r].Text==o)for(u[r].SelectedValue==""&&(s=n(f).children()[0],s.id="dropdownhide",n(s).prop("selected")==!0&&(u[r].SelectedValue="")),e=0;e<u[r].TextList.length;e++)s=n(f).children()[0].id=="dropdownhide"?n(f).children()[e+1]:n(f).children()[e],n(s).prop("selected")==!0&&(u[r].SelectedValue=u[r].TextList[e])}else if(u[r].Name=="ListBox")for(h=0,e=0;e<u[r].TextList.length;e++)s=n(f).children()[e],n(s).prop("selected")==!0&&(u[r].SelectedList[h]=e,h++)},_imageRenderingPinch:function(n,t,r,u,f,e,o,s,h,c,l,a){var y=this,v=y._zoomVal,p=new Image;p.onload=function(){for(var d,g,et,ft,e,tt,at=!1,k=0;k<u.length;k++)if(at==!1)for(d=u[k],f.setTransform(d[0]*v,d[1]*v,d[2]*v,d[3]*v,d[4]*v,d[5]*v),t[a]!=i&&f.drawImage(t[a],0,0,1,1),g=s[k],g=g+1,et=o[k];g<et.length;){var p=et[g],ot=p.color,w=p.matrix;w!=null&&(w=w.Elements);var st=p.brush,b=p.pathValue,pt=p.iscliping,vt=p.restorecanvas,yt=p.imagedata,nt=p.fillrule,wt=p.isFillandStroke,bt=p.fillcolor,ht=p.strokecolor,ct=p.linewidth,lt=p.linecap,it=p.linearGradientBrush,rt=p.textureBrushs,ut=p.charID;if(b!=null?(b=b.split(";"),ut&&(h[ut]=b)):b==null&&ut&&(b=h[ut]),vt==!1&&f.save(),b!=i&&f.setTransform(w[0]*v,w[1],w[2],w[3]*v,w[4]*v,w[5]*v),b!=null){for(f.beginPath(),ft=0;ft<b.length;ft++)e=b[ft],tt=e[0],tt=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):tt=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):tt=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):tt=="Z"&&f.closePath();pt==!0?(nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(nt)),f.clip()):wt==i?st=="Fill"?(f.fillStyle=it!=i?y._getGradientBrush(it,f):rt!=i?y._createTextureBrush(rt,f,p):ot,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill()):st=="FillandStroke"?(f.fillStyle=ot,f.fill(),f.strokeStyle=ht,f.stroke()):st=="Stroke"?(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ot,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke(),f.fillStyle=it!=i?y._getGradientBrush(it,f):rt!=i?y._createTextureBrush(rt,f,p):bt,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill())}if(vt&&f.restore(),yt!=i){at=!0;r.pop();u.pop();o.pop();s.pop();r.push(yt);u.push(w);o.push(n);s.push(g);k=-1;a++;break}g++}else y._imageRenderingPinch(n,t,r,u,f,k,o,s,h,c,l,a),a++};p.src=r[e];t.push(p)},_touchStart:function(t){var u=t.touches,i,r;u.length>1&&t.preventDefault();i=n(t.target).parents(".e-pdfviewer.e-js");r=i.ejPdfViewer("instance");r._touched=!1},_touchMove:function(t){var u=t.touches,f,i,r;u.length>1&&(f=n(t.target).parents(".e-pdfviewer.e-js"),i=f.ejPdfViewer("instance"),i._touched=!0,i._isRerenderCanvasCreated||(n(".e-pdfviewer-formFields").hide(),r=Math.sqrt(Math.pow(u[0].clientX-u[1].clientX,2)+Math.pow(u[0].clientY-u[1].clientY,2)),i._prevDiff>-1?r>i._prevDiff?i._pinchOut(t):r<i._prevDiff&&i._pinchIn(t):i._zoomVal<2?i._prevDiff!=-1&&r>i._prevDiff&&i._pinchIn(t):i._prevDiff==-1&&i._zoomVal>2&&r>i._prevDiff&&i._pinchIn(t),i._prevDiff=r))},_touchEnd:function(t){var s=n(t.target).parents(".e-pdfviewer.e-js"),i=s.ejPdfViewer("instance"),r,o,f,e,u;i._prevDiff=-1;i._isRenderedByPinch&&(i._renderedCanvasList.length!=0&&(i._isRerenderCanvasCreated||(i._designNewCanvas(),r=[],o=i._currentPage,r.push(parseInt(i._currentPage)),f=parseInt(i._currentPage)-1,i._renderedCanvasList.indexOf(f)!=-1&&r.push(f),e=parseInt(i._currentPage)+1,i._renderedCanvasList.indexOf(e)!=-1&&r.push(e),i._rerenderCanvasList=r,u=i,window.clearInterval(u._scrollTimer),u._bgRenderTimer=setInterval(function(){u._rerenderCanvas(o)},10),i._renderedCanvasList.length=0)),i._isRenderedByPinch=!1)},_pointerdown:function(n){n.originalEvent.pointerType=="touch"&&(this._pointerCount=this._pointerCount+1,this._pointerCount<=2&&(n.preventDefault(),this._pointers.push(n.originalEvent),this._pointerCount==2&&(this._pointerCount=0)))},_pointermove:function(n){var i,t,r,u;if(n.originalEvent.pointerType=="touch"&&this._pointers.length==2){for(n.preventDefault(),i=0;i<this._pointers.length;i++)if(n.originalEvent.pointerId==this._pointers[i].pointerId){this._pointers[i]=n.originalEvent;break}this._isRerenderCanvasCreated||(t=Math.sqrt(Math.pow(this._pointers[0].clientX-this._pointers[1].clientX,2)+Math.pow(this._pointers[0].clientY-this._pointers[1].clientY,2)),this._prevDiff>-1&&(t>this._prevDiff?this._pinchOut(n):t<this._prevDiff&&this._pinchIn(n)),r=document.getElementById(this._id+"_viewerContainer"),u=r.scrollTop,u==0||(t>this._prevDiff?this._pinchOut(n):t<this._prevDiff&&this._pinchIn(n)),this._prevDiff=t)}},_pointerup:function(n){var t,f,r,u,i;n.originalEvent.pointerType=="touch"&&(this._pointers=[],this._pointerCount=0,this._prevDiff=-1,this._isRenderedByPinch&&(n.preventDefault(),this._renderedCanvasList.length!=0&&(this._isRerenderCanvasCreated||(this._designNewCanvas(),t=[],f=this._currentPage,t.push(parseInt(this._currentPage)),r=parseInt(this._currentPage)-1,this._renderedCanvasList.indexOf(r)!=-1&&t.push(r),u=parseInt(this._currentPage)+1,this._renderedCanvasList.indexOf(u)!=-1&&t.push(u),this._rerenderCanvasList=t,i=this,window.clearInterval(i._scrollTimer),i._bgRenderTimer=setInterval(function(){i._rerenderCanvas(f)},10),this._renderedCanvasList.length=0)),this._isRenderedByPinch=!1))},_pinchOut:function(){this._isAutoZoom=!1;this._zoomVal=this._zoomVal+.01;this._zoomVal>2&&(this._zoomVal=this._zoomVal+.01);this._zoomVal>4&&(this._zoomVal=4,this._isPinchLimitReached=!0);this._zoomVal<=4?(this._isPinchLimitReached||(this._fitType=null,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(this._zoomVal*100)+"%"),this._ejDropDownInstance.model.value=this._zoomVal*100+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"),this._updateZoomButtons(),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=4},_pinchIn:function(){this._isAutoZoom=!1;this._zoomVal=this._zoomVal-.01;this._zoomVal<4&&this._zoomVal>2&&(this._zoomVal=this._zoomVal-.01);this._zoomVal<.5&&(this._zoomVal=.5,this._isPinchLimitReached=!0);this._zoomVal>=.5?(this._isPinchLimitReached||(this._fitType=null,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(this._zoomVal*100)+"%"),this._ejDropDownInstance.model.value=this._zoomVal*100+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"),this._updateZoomButtons(),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=.5},_textSearch:function(){this._clearAllOccurrences();this._selectedIndex=0;this._isTextSearch=!0;this._searchedPages=[];this._searchCollection=[];var t=n("#"+this._id+"_pdfviewer_searchinput").val();if(this._searchText=t,this._searchText&&this._searchText!=""?this._enableSearchIcons():this._disableSearchIcons(),t==""||t==" "||!t)return!0;this._searchPageIndex=parseInt(this._currentPage);this._initSearch(this._searchPageIndex);this._highlightOtherOccurrences()},_disableSearchIcons:function(){n("#"+this._id+"_pdfviewer_previous_search").css({"pointer-events":"none",opacity:"0.6"});n("#"+this._id+"_pdfviewer_next_search").css({"pointer-events":"none",opacity:"0.6"});var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");t.disable()},_enableSearchIcons:function(){n("#"+this._id+"_pdfviewer_previous_search").css({"pointer-events":"",opacity:""});n("#"+this._id+"_pdfviewer_next_search").css({"pointer-events":"",opacity:""});var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");t.enable()},_prevSearch:function(){this._searchText&&(this._clearAllOccurrences(),this._isPrevSearch=!0,this._isTextSearch=!0,this._selectedIndex=this._selectedIndex-1,this._selectedIndex<0?(this._searchPageIndex=this._searchPageIndex-1,this._searchPageIndex<1&&(this._searchPageIndex=parseInt(this._totalPages)),this._initSearch(this._searchPageIndex)):this._highlightText(this._searchPageIndex,this._selectedIndex),this._highlightOtherOccurrences())},_nextSearch:function(){this._searchText&&(this._clearAllOccurrences(),this._isPrevSearch=!1,this._isTextSearch=!0,this._selectedIndex=this._selectedIndex+1,this._searchCollection[this._searchPageIndex]?this._selectedIndex>=this._searchCollection[this._searchPageIndex].length?(this._selectedIndex=0,this._searchPageIndex=this._searchPageIndex<this._totalPages?this._searchPageIndex+1:1,this._initSearch(this._searchPageIndex)):this._highlightText(this._searchPageIndex,this._selectedIndex):(this._searchPageIndex=this._currentPage,this._selectedIndex=0,this._initSearch(this._searchPageIndex)),this._highlightOtherOccurrences())},_matchcase:function(){var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");this._isMatchCase=t.model.checkState=="check"?!0:!1;this._textSearch()},_searchKeypressHandler:function(t){t.which==13&&(t.preventDefault(),this._searchText=n("#"+this._id+"_pdfviewer_searchinput").val(),this._searchMatches[this._searchPageIndex]&&this._searchText!=""?this._searchMatches[this._searchPageIndex].length==0?this._initSearch(this._searchPageIndex):this._nextSearch():this._searchText!=""&&(this._searchPageIndex=this._currentPage,this._selectedIndex=0,this._initSearch(this._searchPageIndex)))},_initSearch:function(n){var t=this._searchText.length,i=this._searchText;this._getPossibleMatches(n,i,t)},_getPossibleMatches:function(t,i,r){var f,u,h,o;if(n("#"+this._id+"_pdfviewer_searchinput").hasClass("e-pdfviewer-nooccurrence")||n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader"),this._pageText[parseInt(t)]||t!=this._searchPageIndex||(this._isRequestFired=!0,f={},f.viewerAction=this._viewerAction.getPageModel,f.pageindex=t.toString(),f.id=this._fileId,n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader"),this._doAjaxPostSearch(JSON.stringify(f),t)),u=this._pageText[t],u){this._isMatchCase||(u=u.toLowerCase(),i=i.toLowerCase());var s=[],e=-r,c=new RegExp("[\x00-€]+"),l=c.test(u),a=this._isRtl(u);for(!l&&a&&(h=new RegExp(String.fromCharCode(160),"g"),u=u.replace(h," "),i=i.split("").reverse().join(""),i=i.replace(/\s/g," "));;){if(e=u.indexOf(i,e+r),e==-1)break;s.push(e)}this._searchMatches[t]=s;t==this._searchPageIndex?(this._selectedIndex<0&&this._isPrevSearch&&(this._selectedIndex=this._searchMatches[t].length-1),(this._isRequestFired&&this._searchMatches[t].length!=0||this._renderedCanvasList.indexOf(t)==-1&&this._searchMatches[t].length!=0)&&(this._gotoPageNo(t),this._isPageScrolledForSearch=!0),this._searchMatches[t].length==0?(t!=this._totalPages?(this._searchedPages.indexOf(parseInt(t))==-1&&this._searchedPages.push(t),this._isPrevSearch?(this._searchPageIndex=this._searchPageIndex-1,this._searchPageIndex<=0&&(this._searchPageIndex=this._totalPages)):this._searchPageIndex=this._searchPageIndex+1):(this._searchedPages.indexOf(parseInt(t))==-1&&this._searchedPages.push(t),this._searchPageIndex=this._isPrevSearch?this._searchPageIndex-1:1),this._searchedPages.length!=this._totalPages||this._searchMatches[t].length!=0?this._initSearch(this._searchPageIndex):(n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-nooccurrence"),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),this._isRequestFired=!1)):this._isRequestFired?(n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),o=this,setTimeout(function(){o._convertMatches(t,r);o._isRequestFired=!1;o._isPageScrolledForSearch=!1},100)):this._convertMatches(t,r)):this._searchMatches[t].length!=0&&this._convertMatches(t,r);this._isRequestFired||this._isPageScrollHighlight||(this._isPageScrolledForSearch=!1)}},_convertMatches:function(n,t){for(var f,s,i=0,h=this._searchMatches[n],u=this._textDivs[n],r=0,e=u.length-1,c=[],o=0,l=h.length;o<l;o++){if(f=h[o],this._isPageScrolledForSearch)while(i!=e&&f>=r+u[i].textContent.split("\n")[0].length)r+=u[i].textContent.split("\n")[0].length,i++;else while(i!=e&&f>=r+u[i].textContent.length)r+=u[i].textContent.length,i++;for(s={begin:{divId:i,offsetValue:f-r}},f+=t;i!=e&&f>r+u[i].textContent.length;)r+=u[i].textContent.length,i++;s.end={divId:i,offsetValue:f-r};c.push(s)}this._searchCollection[n]=c;this._highlightText(n,this._selectedIndex)},_highlightText:function(n){for(var s,a,h=this._searchCollection[n],u=this._textDivs[n],t=null,c,f,v=h.length,o=0;o<v;o++){var l=h[o],r=l.begin,e=l.end;if(o==this._selectedIndex&&n==this._searchPageIndex?(f="e-pdfviewer-texthighlight",c=r.divId):f="e-pdfviewer-text-highlightother",t&&r.divId===t.divId?this._addSpanForSearch(t.divId,t.offsetValue,r.offsetValue,n,u,null):(t!==null&&this._addSpanForSearch(t.divId,t.offsetValue,i,n,u,null),this._beginText(r,u,n,null)),r.divId==e.divId)this._addSpanForSearch(r.divId,r.offsetValue,e.offsetValue,n,u,f);else{for(this._addSpanForSearch(r.divId,r.offsetValue,i,n,u,f),s=r.divId+1,a=e.divId;s<a;s++)this._addSpanForSearch(s,0,i,n,u,f+" middle");this._beginText(e,u,n,f)}t=e}t&&this._addSpanForSearch(t.divId,t.offsetValue,i,n,u,null);n==this._searchPageIndex&&this._scrollToSearchStr(u[c],{y:-70,x:-400});this._isTextHighlighted=!0},_beginText:function(n,t,i,r){var u=n.divId;t[u].textContent="";this._addSpanForSearch(u,0,n.offsetValue,i,t,r)},_addSpanForSearch:function(t,i,r,u,f,e){var h,c=this._textContents[u],a=c[t].length,v=new RegExp("[\x00-€]+"),l=this._isRtl(c[t]),s,o;if(l){if(h=c[t].substring(i,r),s=document.createTextNode(h),e){this._isTextHighlighted=!0;o=document.createElement("span");o.className=e+" e-pdfviewer-textLayer";n(o).hasClass("middle")&&(f[t].textContent="");n(o).prepend(s);n(f[t]).prepend(o);return}n(f[t]).prepend(s)}else{if(h=c[t].substring(i,r),s=document.createTextNode(h),e){this._isTextHighlighted=!0;o=document.createElement("span");o.className=e+" e-pdfviewer-textLayer";n(o).hasClass("middle")&&(f[t].textContent="");o.appendChild(s);f[t].appendChild(o);return}f[t].appendChild(s)}},_isRtl:function(n){var t=new RegExp("^[^A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\\u2C00-\\uFB1C\\uFDFE-\\uFE6F\\uFEFD-\\uFFFF]*[\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC]");return t.test(n)},_scrollToSearchStr:function(n,t){for(var i=n.offsetParent,r=n.offsetTop+n.clientTop,u=n.offsetLeft+n.clientLeft;i.id!=this._id+"_viewerContainer";)r+=i.offsetTop,u+=i.offsetLeft,i=i.offsetParent;t&&(r+=t.y,u+=t.x,this._zoomVal>1.5&&(i.scrollLeft=u));i.scrollTop=r},_highlightOtherOccurrences:function(){for(var i,t=1;t<=this._totalPages;t++)this._renderedCanvasList.indexOf(t)!=-1&&t!=this._searchPageIndex&&this._initSearch(t);this._isPageScrollHighlight=!1;i=this;setTimeout(function(){n("#"+i._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader")},100)},_clearAllOccurrences:function(){var e,u,r,f,t;for(this._searchedText="",e=document.getElementById(this._id+"custom-menu"),n(e).hide(),this._isTextHighlighted=!1,this._isTextSearch=!1,this._searchAjaxRequestState!=null&&(this._searchAjaxRequestState.abort(),this._searchAjaxRequestState=null),this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-nooccurrence"),u=1;u<=this._totalPages;u++)if(this._renderedCanvasList.indexOf(parseInt(u))!==-1){if(r=this._textDivs[u],f=this._textContents[u],!r||r==i)break;for(t=0;t<r.length;t++)r[t].textContent=f[t],this._isFindboxPresent||(r[t].textContent="",r[t].textContent=f[t]+"\r\n")}},_doAjaxPostSearch:function(i,r){var u=this;this._searchAjaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:i,traditional:!0,success:function(n){var i;i=typeof n=="object"?JSON.stringify(n):n;jsondata=typeof n=="object"?u._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(JSON.stringify(n)):JSON.parse(JSON.stringify(n).d):u._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(n):JSON.parse(n.d);u._pageContents[parseInt(jsondata.currentpage)]=i;u._pageText[parseInt(jsondata.currentpage)]=jsondata.pageContents;u._initSearch(r)},error:function(n){u._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_keyboardShortcutFind:function(n){n.ctrlKey&&n.which==70&&(n.preventDefault(),this._isTextSearchHidden||this._displaySearchBox())},_setSearchToolbarTop:function(){var n=document.getElementById(this._id+"_pdfviewer_searchbox");n.style.top="0px"},_searchBoxLocalization:function(){var r=n("#"+this._id+"_pdfviewer_searchbox").find(".e-pdfviewer-label")[0],u=n("#"+this._id+"_pdfviewer_searchbox").find(".e-pdfviewer-label")[1],i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=i.contextMenu.Find.contentText,e=i.contextMenu.matchCase.contentText;n(r).text(f);n(u).text(e)},_displaySearchBox:function(){this._isToolbarHidden||(n("#"+this._id+"_pdfviewer_searchbox").css("display")=="none"?(this._searchBoxLocalization(),this._clearSelector(),this._displaySearch=!0,n("#"+this._id+"_pdfviewer_searchbox").css({position:"absolute",display:"block"}),this._resizeSearchToolbar(),n("#"+this._id+"_pdfviewer_searchinput").focus().select(),this._isFindboxPresent=!0):(this._displaySearch=!1,this._isFindboxPresent=!1,this._clearAllOccurrences(),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),n("#"+this._id+"_pdfviewer_searchbox").css({display:"none"})))},_showTextSearchButton:function(t){t?(n("#"+this._id+"_find").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isTextSearchHidden=!1):(n("#"+this._id+"_find").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isFindboxPresent&&this._displaySearchBox(),this._isTextSearchHidden=!0)},_renderTextMarkupAnnotation:function(n,t){var s=document.getElementById(this._id+"_secondarycanvas_"+t),i=s.getContext("2d"),o,r,f,e,u;if(i.setLineDash([]),n)for(o=0;o<n.length;o++)if(r=n[o],r.TextMarkupAnnotationType=="StrikeOut"){for(f=r.Color,r.isLocked=this.model.strikethroughSettings.isLocked,e=0;e<r.Bounds.length;e++)u=r.Bounds[e],i.globalAlpha=r.Opacity,i.beginPath(),i.moveTo(this._convertPointToPixel(u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height/2)*this._zoomVal),i.lineTo(this._convertPointToPixel(u.Width+u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height/2)*this._zoomVal),i.strokeStyle="rgb("+f.R+","+f.G+","+f.B+")",i.closePath(),i.msFillRule="nonzero",i.stroke();i.lineWidth=r.BorderWidth;i.save()}else if(r.TextMarkupAnnotationType=="Highlight"){for(r.isLocked=this.model.highlightSettings.isLocked,e=0;e<r.Bounds.length;e++)u=r.Bounds[e],i.beginPath(),i.rect(this._convertPointToPixel(u.X)*this._zoomVal,this._convertPointToPixel(u.Y)*this._zoomVal,this._convertPointToPixel(u.Width)*this._zoomVal,this._convertPointToPixel(u.Height)*this._zoomVal),i.lineWidth=r.BorderWidth,f=r.Color,i.globalAlpha=r.Opacity*.5,i.closePath(),i.fillStyle="rgb("+f.R+","+f.G+","+f.B+")",i.msFillRule="nonzero",i.fill();i.save()}else if(r.TextMarkupAnnotationType=="Underline"){for(r.isLocked=this.model.underlineSettings.isLocked,f=r.Color,e=0;e<r.Bounds.length;e++)u=r.Bounds[e],i.globalAlpha=r.Opacity,i.beginPath(),i.moveTo(this._convertPointToPixel(u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height)*this._zoomVal),i.lineTo(this._convertPointToPixel(u.Width+u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height)*this._zoomVal),i.lineWidth=r.BorderWidth,i.closePath(),i.strokeStyle="rgb("+f.R+","+f.G+","+f.B+")",i.msFillRule="nonzero",i.stroke();i.save()}this._newAnnotationList[t-1]&&this._newAnnotationList[t-1].length!=0&&this._renderNewAnnotations(this._newAnnotationList[t-1],i)},_renderNewAnnotations:function(n,t){for(var i,u,r,f=0;f<n.length;f++)if(i=n[f],i.type=="StrikeOut"){for(t.globalAlpha=i.opacity,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.moveTo(r.xPosition*this._zoomVal,(r.yPosition+r.height/2)*this._zoomVal),t.lineTo((r.xPosition+r.width)*this._zoomVal,(r.yPosition+r.height/2)*this._zoomVal),t.strokeStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.closePath(),t.msFillRule="nonzero",t.stroke();t.save()}else if(i.type=="Highlight"){for(t.globalAlpha=i.opacity*.5,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.rect(r.xPosition*this._zoomVal,r.yPosition*this._zoomVal,r.width*this._zoomVal,r.height*this._zoomVal),t.closePath(),t.fillStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.msFillRule="nonzero",t.fill();t.save()}else if(i.type=="Underline"){for(t.globalAlpha=i.opacity,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.moveTo(r.xPosition*this._zoomVal,(r.yPosition+r.height)*this._zoomVal),t.lineTo((r.xPosition+r.width)*this._zoomVal,(r.yPosition+r.height)*this._zoomVal),t.strokeStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.closePath(),t.msFillRule="nonzero",t.stroke();t.save()}},_addAnnotation:function(n){var t=document.getElementById(this._id+"_secondarycanvas_"+this._currentPage),r=t.getContext("2d"),i;t.style.zIndex="2";i=window.getSelection().toString();switch(n){case"StrikeOut":window.getSelection().toString()?(this._drawStrikeOutAnnotation(),this._isHighlight=!1,this._annotationActive=!0):(this._annotationActive=!0,this._isHighlight=!1,this._isStrikeout=!0,this._isUnderline=!1);break;case"Underline":window.getSelection().toString()?(this._drawUnderlineAnnotation(),this._annotationActive=!0,this._isHighlight=!1):(this._annotationActive=!0,this._isHighlight=!1,this._isUnderline=!0,this._isStrikeout=!1);break;case"Highlight":window.getSelection().toString()?(this._drawHighlightAnnotation(),this._annotationActive=!0,this._isHighlight=!0):(this._annotationActive=!0,this._isHighlight=!0,this._isUnderline=!1,this._isStrikeout=!1)}},_initHighlight:function(){this._isHighlightEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._addAnnotation("Highlight"),this._isHighlightEnabled=!0,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._isHighlight=!0)},_initStrikeOut:function(){this._isStrikeOutEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._addAnnotation("StrikeOut"),this._isStrikeOutEnabled=!0,this._isUnderlineEnabled=!1,this._isHighlightEnabled=!1,this._isStrikeout=!0)},_initUnderline:function(){this._isUnderlineEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._addAnnotation("Underline"),this._isUnderlineEnabled=!0,this._isHighlightEnabled=!1,this._isStrikeOutEnabled=!1,this._isUnderline=!0)},_getPagePosition:function(n){var t=document.getElementById(this._id+"selectioncanvas_"+n);return pagePosition=t.getBoundingClientRect()},_getTextNodes:function(n,t){var u=[],i=document.createRange(),f=n.getRangeAt(0),c=f.getBoundingClientRect(),s,y,h,e,r,o;if(n.anchorNode==n.focusNode)this._isBackwardSelection?(i.setStart(n.focusNode,n.focusOffset),i.setEnd(n.anchorNode,n.anchorOffset)):n.anchorOffset<n.focusOffset?(i.setStart(n.anchorNode,n.anchorOffset),i.setEnd(n.focusNode,n.focusOffset)):(i.setStart(n.focusNode,n.focusOffset),i.setEnd(n.anchorNode,n.anchorOffset)),s=i.getBoundingClientRect(),u.push(s);else if(this._isBackwardSelection)this._getAnnotationOffsets(f,n.focusNode,n.anchorNode,n.focusOffset,n.anchorOffset,u);else{var l=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,a=navigator.userAgent.indexOf("Edge")!=-1,v=document.documentMode||/Edge/.test(navigator.userAgent);if(l||a||v){for(y=!1,r=0;r<this._textDivs[t].length;r++)o=this._textDivs[t][r].textContent,o==n.anchorNode.data&&(h=r),o==n.focusNode.data&&(e=r),r!=this._textDivs[t].length-1||e||(e=this._textDivs[t].length-1);h<e?this._getAnnotationOffsets(f,n.anchorNode,n.focusNode,n.anchorOffset,n.focusOffset,u):this._getAnnotationOffsets(f,n.focusNode,n.anchorNode,n.focusOffset,n.anchorOffset,u)}else this._getAnnotationOffsets(f,n.anchorNode,n.focusNode,n.anchorOffset,n.focusOffset,u)}return{rectangleBound:c,bounds:u}},_getAnnotationOffsets:function(n,t,i,r,u,f){var c=parseInt(t.parentNode.id.split("text_")[1]),p=parseInt(t.parentNode.id.split("text_"+c+"_")[1]),s=parseInt(i.parentNode.id.split("text_")[1]),w=parseInt(i.parentNode.id.split("text_"+s+"_")[1]),b,k,v,d,e,g,o,l,h,a,y,nt;for(this._isFindboxPresent&&this._clearAllOccurrences(),d=c!=s&&this._isBackwardSelection?s:c,e=d;e<=s;e++){if(g=this._textDivs[e],e==c)v=p;else if(this._isBackwardSelection)v=0;else break;for(o=v;o<this._textDivs[e].length;o++){for(l=g[o],h=document.createRange(),b=o==p?r:0,k=o==w?u:l.textContent.length,a=0;a<l.childNodes.length;a++)y=l.childNodes[a],h.setStart(y,b),h.setEnd(y,k);if(nt=h.getBoundingClientRect(),h.detach(),f.push(nt),e==s&&o==w)break}}},_drawStrikeOutAnnotation:function(){var f,w,e,b,k,r,d;if(this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation){if(window.getSelection().toString()){var h=window.getSelection(),t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l,g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,nt=navigator.userAgent.indexOf("Edge")!=-1,tt=document.documentMode||/Edge/.test(navigator.userAgent);(g||nt||tt)&&(t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l=parseInt(h.focusNode.parentNode.id.split("text_")[1]),t<l?this._isBackwardSelection=!1:t>l&&(this._isBackwardSelection=!0));var v=[],y=this._getTextNodes(h,t),i=this._drawColor?this._drawColor:this.model.strikethroughSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var it=new Date,rt=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:it.toLocaleString(),c={type:"StrikeOut",bounds:[],author:this.model.strikethroughSettings.author,subject:this.model.strikethroughSettings.subject,modifiedDate:rt,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.strikethroughSettings.opacity,note:"",pageNumber:t,isLocked:this.model.strikethroughSettings.isLocked};for(r=0;r<y.bounds.length;r++){pagePosition=this._getPagePosition(t);var u=y.bounds[r],a=u.left-pagePosition.left,f=u.top-pagePosition.top;f>this._pageSize[t-1].PageHeight&&(t++,pagePosition=this._getPagePosition(t),f=u.top-pagePosition.top);var p=document.getElementById(this._id+"_secondarycanvas_"+t),ut=p.getBoundingClientRect(),o=p.getContext("2d");o.beginPath();f=f-1.2*this._zoomVal;o.moveTo(a,f+u.height/2);o.lineTo(a+u.width,f+u.height/2);o.closePath();o.strokeStyle=i;o.stroke();w={xPosition:a/this._zoomVal,yPosition:f/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};c.bounds.push(w)}for(this._newAnnotationList[t-1].push(c),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(c))),e={},e.annotationSettings=this.model.strikethroughSettings,e.annotationId=this._totalAnnotations[t].length-1,e.pageId=t,e.annotationBound=c.bounds,e.annotationType="StrikeOut",this._raiseClientEvent("annotationAdd",e),b=this._newAnnotationList[t-1].length-1,v.push(b),k={operation:"AddedStrikeOut",pageNumber:t,indexes:v},this._recentOperation.push(k),this._redoActions=[],r=0;r<this._totalPages;r++)d=[],this._redoAnnotationCollection[r]=d;window.getSelection().removeAllRanges();this.isDocumentEdited=!0}n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawUnderlineAnnotation:function(){var f,w,e,b,k,r,d;if(this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&window.getSelection().toString()){var h=window.getSelection(),t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l,g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,nt=navigator.userAgent.indexOf("Edge")!=-1,tt=document.documentMode||/Edge/.test(navigator.userAgent);(g||nt||tt)&&(t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l=parseInt(h.focusNode.parentNode.id.split("text_")[1]),t<l?this._isBackwardSelection=!1:t>l&&(this._isBackwardSelection=!0));var v=[],i=this._drawColor?this._drawColor:this.model.underlineSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var y=this._getTextNodes(h,t),it=new Date,rt=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:it.toLocaleString(),c={type:"Underline",bounds:[],author:this.model.underlineSettings.author,subject:this.model.underlineSettings.subject,modifiedDate:rt,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.underlineSettings.opacity,note:"",pageNumber:t,isLocked:this.model.underlineSettings.isLocked};for(r=0;r<y.bounds.length;r++){pagePosition=this._getPagePosition(t);var u=y.bounds[r],a=u.left-pagePosition.left,f=u.top-pagePosition.top;f>this._pageSize[t-1].PageHeight&&(t++,pagePosition=this._getPagePosition(t),f=u.top-pagePosition.top);var p=document.getElementById(this._id+"_secondarycanvas_"+t),ut=p.getBoundingClientRect(),o=p.getContext("2d");o.beginPath();f=f-1.2*this._zoomVal;o.moveTo(a,f+u.height);o.lineTo(a+u.width,f+u.height);o.closePath();o.strokeStyle=i;o.stroke();w={xPosition:a/this._zoomVal,yPosition:f/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};c.bounds.push(w)}for(this._newAnnotationList[t-1].push(c),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(c))),e={},e.annotationSettings=this.model.underlineSettings,e.annotationId=this._totalAnnotations[t].length-1,e.pageId=t,e.annotationBound=c.bounds,e.annotationType="Underline",this._raiseClientEvent("annotationAdd",e),b=this._newAnnotationList[t-1].length-1,v.push(b),k={operation:"AddedUnderline",pageNumber:t,indexes:v},this._recentOperation.push(k),this._redoActions=[],r=0;r<this._totalPages;r++)d=[],this._redoAnnotationCollection[r]=d;this.isDocumentEdited=!0;window.getSelection().removeAllRanges();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawHighlightAnnotation:function(){var e,w,f,b,k,r,d;if(this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation){if(window.getSelection().toString()){var h=window.getSelection(),t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l,g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,nt=navigator.userAgent.indexOf("Edge")!=-1,tt=document.documentMode||/Edge/.test(navigator.userAgent);(g||nt||tt)&&(t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l=parseInt(h.focusNode.parentNode.id.split("text_")[1]),t<l?this._isBackwardSelection=!1:t>l&&(this._isBackwardSelection=!0));var a=[],v=this._getTextNodes(h,t),i=this._drawColor?this._drawColor:this.model.highlightSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var it=new Date,rt=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:it.toLocaleString(),c={type:"Highlight",bounds:[],author:this.model.highlightSettings.author,subject:this.model.highlightSettings.subject,modifiedDate:rt,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.highlightSettings.opacity,note:"",pageNumber:t,isLocked:this.model.highlightSettings.isLocked};for(r=0;r<v.bounds.length;r++){pagePosition=this._getPagePosition(t);var u=v.bounds[r],y=u.left-pagePosition.left,e=u.top-pagePosition.top;e>this._pageSize[t-1].PageHeight&&(t++,pagePosition=this._getPagePosition(t),e=u.top-pagePosition.top);var p=document.getElementById(this._id+"_secondarycanvas_"+t),ut=p.getBoundingClientRect(),o=p.getContext("2d");o.beginPath();e=e-1.2*this._zoomVal;o.rect(y,e,u.width,u.height);o.closePath();o.globalAlpha=.5;o.fillStyle=i;o.fill();w={xPosition:y/this._zoomVal,yPosition:e/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};c.bounds.push(w)}for(this._newAnnotationList[t-1].push(c),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(c))),f={},f.annotationSettings=this.model.highlightSettings,f.annotationId=this._totalAnnotations[t].length-1,f.pageId=t,f.annotationBound=c.bounds,f.annotationType="Highlight",this._raiseClientEvent("annotationAdd",f),b=this._newAnnotationList[t-1].length-1,a.push(b),k={operation:"AddedHighlight",pageNumber:t,indexes:a},this._recentOperation.push(k),this._redoActions=[],r=0;r<this._totalPages;r++)d=[],this._redoAnnotationCollection[r]=d;this.isDocumentEdited=!0;window.getSelection().removeAllRanges()}n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawAnnotationRect:function(n,t,i,r,u){var e=document.getElementById(this._id+"_secondarycanvas_"+n),f;e&&(f=e.getContext("2d"),f.beginPath(),f.setLineDash([4]),f.globalAlpha=1,f.rect(t,i,r,u),f.closePath(),f.strokeStyle="blue",f.stroke(),f.save())},_drawAnnotSelectRect:function(n,t){var o=t[t.length-1],f,e,u,r,i;if(this._selectedAnnotation=o,this._selectedAnnotationObject={},this._selectedAnnotationObject.annotation=o,this._selectedAnnotationObject.pageIndex=n,f=this._getAnnotation(t,n),f.isExistingAnnotation)for(e=this._textMarkupAnnotationList[n][f.currentAnnotationIndex],r=0;r<e.Bounds.length;r++)i=e.Bounds[r],this._drawAnnotationRect(n,this._convertPointToPixel(i.X)*this._zoomVal,this._convertPointToPixel(i.Y)*this._zoomVal,this._convertPointToPixel(i.Width)*this._zoomVal,this._convertPointToPixel(i.Height)*this._zoomVal);else if(u=t[0],u.bounds)for(r=0;r<u.bounds.length;r++)i=u.bounds[r],this._drawAnnotationRect(n,(i.xPosition-.5)*this._zoomVal,(i.yPosition-.5)*this._zoomVal,(i.width+.5)*this._zoomVal,(i.height+.5)*this._zoomVal);this._isAnnotationSelected=!0},_clearRectOnClick:function(n){var t=document.getElementById(this._id+"_secondarycanvas_"+n),i=t.getContext("2d");i.setLineDash([]);i.clearRect(0,0,t.width,t.height);this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[n],n);this._isAnnotationSelected=!1;this._selectedAnnotationObject=null},_onCanvasMousedown:function(t,i,r){var f=t.getContext("2d"),e=parseInt(i-n(t.parentNode).offset().left),o=parseInt(r-n(t.parentNode).offset().top),u=f.getImageData(e,o,1,1).data;this._annotationColor=this._rgb2Color(u[0],u[1],u[2])},_showPopupNote:function(t){var o=document.getElementById(this._id+"_note_content"),i=this._currentAnnotationRectangle[0],e,r,u;if(i.note){o.textContent=i.note;var s=i.Color?i.Color.R:i.colorR,h=i.Color?i.Color.G:i.colorG,c=i.Color?i.Color.B:i.colorB,f=document.getElementById(this._id+"_author_content");f.style.borderBottom="1px solid black";f.style.fontWeight="bold";e=i.Author?i.Author:i.author;e;f.textContent=e;o.style.backgroundColor="rgb("+s+","+h+","+c+")";r=n("#"+this._id+"_popup_note");u=this._setPopupMenuPosition(t,r);r.css({display:"block","background-color":"rgb("+s+","+h+","+c+")",position:"absolute"});r.show();r.offset({top:u.y+5,left:u.x+5}).show();r.show();r.offset({top:u.y+5,left:u.x+5}).show();r.show()}},_showPopupMenu:function(t){var v,s,h,c,f,l,a,r,e,u;if(!this._isPropertiesWindowOpen){if(this._isPopupNoteVisible=!0,n("#"+this._id+"_popup_note").hide(),document.getElementById(this._id+"_popupinnercontent").innerText="",v=document.getElementById(this._id+"highlight-menu"),n(v).hide(),this._isContextMenuPresent=!1,s=document.getElementById(this._id+"_popupinnercontent"),n(s).focus(),s.contentEditable=!0,l=this._currentAnnotationRectangle.length>0?this._currentAnnotationRectangle:this._currentAnnotationRectangleBackup,this._annotationBackupNoteSave=l,a=this._getAnnotation(l,this._AnnotationPage),a.isExistingAnnotation)r=this._textMarkupAnnotationList[this._AnnotationPage][a.currentAnnotationIndex],h=r.Author,c=r.ModifiedDate,r.note&&(f=r.note);else for(e=0;e<this._currentAnnotations.length;e++){u=this._currentAnnotations[e];h=u.author;c=u.modifiedDate;u.note&&(f=u.note);break}document.getElementById(this._id+"_username").innerText=h;document.getElementById(this._id+"_currentTime").innerText=c;f&&(document.getElementById(this._id+"_popupinnercontent").innerText=f);var i=document.getElementById(this._id+"_popupmenu"),y=n(i),o=this._setPopupMenuPosition(t,y);n(i).show();n(i).offset({top:o.y,left:o.x}).show();n(i).show();n(i).offset({top:o.y,left:o.x}).show();n(i).show()}},_saveNote:function(){var e,t,f,i,n;e=this._annotationBackupNoteSave?this._annotationBackupNoteSave:this._currentAnnotationRectangle.length>0?this._currentAnnotationRectangle:this._currentAnnotationRectangleBackup;var r=new Date,o=this._getAnnotation(e,this._AnnotationPage),u=document.getElementById(this._id+"_popupinnercontent");if(o.isExistingAnnotation)t=this._textMarkupAnnotationList[this._AnnotationPage][o.currentAnnotationIndex],t.note!=u.textContent&&(n=t.TextMarkupAnnotationType,n=="Highlight"?t.ModifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:r.toLocaleString():n=="Underline"?t.ModifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:r.toLocaleString():n=="StrikeOut"&&(t.ModifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:r.toLocaleString()),t.note=u.textContent);else for(f=0;f<this._currentAnnotations.length;f++){i=this._currentAnnotations[f];i.note!=u.textContent&&(n=i.type,n=="Highlight"?i.modifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:r.toLocaleString():n=="Underline"?i.modifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:r.toLocaleString():n=="StrikeOut"&&(i.modifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:r.toLocaleString()),i.note=u.textContent);break}u.innerText=""},_setPropertiesWindowLocale:function(t){var i=t.propertyWindow.appearance.contentText,r=t.propertyWindow.general.contentText,u=t.propertyWindow.color.contentText,f=t.propertyWindow.opacity.contentText,e=t.propertyWindow.author.contentText,o=t.propertyWindow.subject.contentText,s=t.propertyWindow.modified.contentText,h=t.propertyWindow.ok.contentText,c=t.propertyWindow.cancel.contentText,l=t.propertyWindow.locked.contentText;this._replaceTextLocale(n("#"+this._id+"_appearanceli").children("a")[0],i);this._replaceTextLocale(n("#"+this._id+"_generalli").children("a")[0],r);this._replaceTextLocale(n("#"+this._id+"_colorspan")[0],u);this._replaceTextLocale(n("#"+this._id+"_opacityspan")[0],f);this._replaceTextLocale(n("#"+this._id+"_authorspan")[0],e);this._replaceTextLocale(n("#"+this._id+"_subjectspan")[0],o);this._replaceTextLocale(n("#"+this._id+"_modifiedspan")[0],s);this._replaceTextLocale(n("#"+this._id+"_ok")[0],h);this._replaceTextLocale(n("#"+this._id+"_cancel")[0],c);this._replaceTextLocale(n("#"+this._id+"_lockedprop")[0],l)},_showPropertiesMenu:function(){var e,k,d,o,l,a,v,y,p,w,u,i,s,r,b,g,h,f,c;if(this._isPropertiesWindowOpen=!0,e=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],this._setPropertiesWindowLocale(e),k=document.getElementById(this._id+"highlight-menu"),n(k).hide(),this._isContextMenuPresent=!1,d=n("#"+this._id+"_PropertiesDialogTab").data("ejTab"),d.showItem(0),w=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage),w.isExistingAnnotation)i=this._textMarkupAnnotationList[this._AnnotationPage][w.currentAnnotationIndex],o={r:i.Color.R,g:i.Color.G,b:i.Color.B},l=i.Opacity,a=i.Author,v=i.Subject,y=i.ModifiedDate,p=i.isLocked,u=i.TextMarkupAnnotationType;else for(s=0;s<this._currentAnnotations.length;s++){r=this._currentAnnotations[s];o={r:r.colorR,g:r.colorG,b:r.colorB};l=r.opacity;a=r.author;v=r.subject;y=r.modifiedDate;p=r.isLocked;u=r.type;break}this._colorpickerObject.option("value",this._rgb2Color(o.r,o.g,o.b));f=n("#"+this._id+"_slider").data("ejSlider");b=parseInt(l*100);f.option("value",b);n("#"+this._id+"_opacity").val(b+"%");n("#"+this._id+"_author_input").val(a);n("#"+this._id+"_subject_input").val(v);g=document.getElementById(this._id+"_modifieddate").childNodes[0];g.textContent=y;n("#"+this._id+"_containerDialogTab").ejDialog({title:u+" Properties"});h=n("#"+this._id+"_containerDialogTab_title").children("span")[0];u=="Highlight"?h.textContent=e.propertyWindow.highlightProperties.contentText:u=="StrikeOut"?h.textContent=e.propertyWindow.strikeOutProperties.contentText:u=="Underline"&&(h.textContent=e.propertyWindow.underlineProperties.contentText);n("#"+this._id+"_containerDialogTab").ejDialog("open");n("#"+this.id+"_colorpicker").ejColorPicker("show");p?(this._colorpickerObject.option("enabled",!1),document.getElementById(this._id+"_opacity").disabled=!0,n("#"+this._id+"_opacity").addClass("e-disable"),f=n("#"+this._id+"_slider").data("ejSlider"),f.disable(),document.getElementById(this._id+"_author_input").disabled=!0,n("#"+this._id+"_author_input").addClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!0,n("#"+this._id+"_subject_input").addClass("e-disable"),c=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),c.option("checked",!0)):(this._colorpickerObject.option("enabled",!0),document.getElementById(this._id+"_opacity").disabled=!1,n("#"+this._id+"_opacity").removeClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!1,n("#"+this._id+"_author_input").removeClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!1,n("#"+this._id+"_subject_input").removeClass("e-disable"),f=n("#"+this._id+"_slider").data("ejSlider"),f.enable(),c=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),c.option("checked",!1))},_lockProperties:function(){var i=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),t;i.model.checkState=="check"?(this._colorpickerObject.option("enabled",!1),document.getElementById(this._id+"_opacity").disabled=!0,n("#"+this._id+"_opacity").addClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!0,n("#"+this._id+"_author_input").addClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!0,n("#"+this._id+"_subject_input").addClass("e-disable"),t=n("#"+this._id+"_slider").data("ejSlider"),t.disable()):(this._colorpickerObject.option("enabled",!0),document.getElementById(this._id+"_opacity").disabled=!1,n("#"+this._id+"_opacity").removeClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!1,n("#"+this._id+"_author_input").removeClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!1,n("#"+this._id+"_subject_input").removeClass("e-disable"),t=n("#"+this._id+"_slider").data("ejSlider"),t.enable())},_setDrawColor:function(n){this._isDefaultColorSet&&(this._drawColor=this._toolbarColorpickerObject.hexCodeToRGB(n.value),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._isDefaultColorSet=!1)},_createNote:function(){var r=n("#"+this._id+"_viewerContainer"),i=t.buildTag("div.e-pdfviewer-annotation-note","",{display:"none"},{id:this._id+"_popup_note"}),u=t.buildTag("div.e-pdfviewer-annotation-authorcontent","",{},{id:this._id+"_author_content"}),f=t.buildTag("div.e-pdfviewer-annotation-notecontent","",{},{id:this._id+"_note_content"});i.append(u);i.append(f);r.append(i)},_createPopupMenu:function(){var p=n("#"+this._id+"_viewerContainer"),r=document.createElement("DIV"),u,f,c,v,l,o,s,y,e,i,h,a;r.id=this._id+"_popupmenu";r.className="e-pdfviewer-popupmenu";p.append(r);u=document.createElement("DIV");u.className="e-pdfviewer-header";u.id=this._id+"_popupheader";r.appendChild(u);f=document.createElement("DIV");f.className="e-pdfviewer-username";f.id=this._id+"_username";f.innerHTML="Guest";u.appendChild(f);c=t.buildTag("div.e-pdfviewer-closepopup","",{},{id:this._id+"_popup_close"});v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closeicon");c[0].appendChild(v[0]);u.appendChild(c[0]);l=this;n(".e-pdfviewer-closeicon").on("click touchend",function(){l._saveNote();n(".e-pdfviewer-popupmenu").hide();l._isPopupNoteVisible=!1});o=document.createElement("DIV");s=document.createElement("DIV");o.className="e-pdfviewer-currenttime";s.id=this._id+"_currentTime";y=new Date;s.innerHTML=y.toLocaleString();o.appendChild(s);r.appendChild(o);e=document.createElement("DIV");e.className="e-pdfviewer-content";e.id=this._id+"_popupcontent";i=document.createElement("DIV");i.className="e-pdfviewer-innercontent";i.id=this._id+"_popupinnercontent";i.innerText=" ";i.style.width="366.667px";i.style.height="132.073px";i.style.overflow="hidden";i.style.overflowY="auto";e.appendChild(i);r.appendChild(e);h=document.createElement("DIV");h.className="e-pdfviewer-footer";h.id=this._id+"_popupfooter";r.appendChild(h);a=document.getElementById(this._id+"_popupmenu");i.addEventListener("paste",function(n){n.preventDefault();var t=n.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,t)});this._on(n(a),"mousedown touchstart",this._popupNoteMousedown);this._on(n(a),"mouseup touchend",this._popupNoteMouseup);this._on(n(window),"touchmove mousemove",this._movePopupNote)},_popupNoteMousedown:function(n){if(n.type=="touchstart"&&(n=n.originalEvent.changedTouches[0]),n.which!=3||n.type=="touchstart"){this._isPopupNoteFocused=!0;var t=document.getElementById(this._id+"_popupmenu");this._xpos=n.clientX-t.offsetLeft;this._ypos=n.clientY-t.offsetTop}},_popupNoteMouseup:function(){this._enableSelection();this._isPopupNoteFocused=!1},_movePopupNote:function(t){var u,i;if(t.preventDefault(),t.type=="touchmove"&&(t=t.originalEvent.changedTouches[0]),this._isPopupNoteFocused||t.type=="touchmove"){u=document.getElementById(this._id+"_viewerContainer");i=document.getElementById(this._id+"_popupmenu");this._isContextMenuPresent=!0;var r=t.clientX-this._xpos,f=t.clientY-this._ypos,e=this._calulateCurrentPosition(f,i),o=parseFloat(n(i).css("width")),s=parseFloat(n(i).css("height"));r>0&&r+o<=u.clientWidth&&(i.style.left=r+"px");e&&(i.style.top=f+"px")}},_calulateCurrentPosition:function(t,i){for(var f,e,r=5,o=parseFloat(n(i).css("height")),u=1;u<=this._totalPages;u++)f=this._pageSize[u-1].PageHeight*this._zoomVal,u==this._AnnotationPage&&t>r&&t+o<f+r&&(e=r),r+=f;if(e)return!0},_createPropertiesMenu:function(){var ti=n("#"+this._id+"_pageviewContainer"),vt=document.createElement("div"),w,b,r,ni,k,c,d,g,nt,tt,u,it,rt,ut,i,l,pt,f,a,ft,et,ot,e,v,st,ht,ct,o,s,lt,at,y,wt;vt.id=this._id+"_containerDialogTab";var yt=document.createElement("div"),p=t.buildTag("div","",{height:"auto"},{id:this._id+"_PropertiesDialogTab"}),bt=document.createElement("ul");bt.innerHTML="<li id= '"+this._id+"_appearanceli'><a href=#"+this._id+"_apperanceProperties>Appearance<\/a><\/li><li id= '"+this._id+"_generalli'><a href=#"+this._id+"_generalProperties>General<\/a><\/li>";w=t.buildTag("div","",{},{id:this._id+"_apperanceProperties"});b=t.buildTag("div","",{},{id:this._id+"_generalProperties"});yt.appendChild(p[0]);p[0].appendChild(bt);p[0].appendChild(w[0]);p[0].appendChild(b[0]);r=document.createElement("div");r.style.paddingBottom="11px";var kt=t.buildTag("button.e-pdfviewer-properties-okbtn","OK",{float:"right","margin-right":"18px"},{id:this._id+"_ok"}),dt=t.buildTag("button.e-pdfviewer-properties-cancelbtn","Cancel",{float:"right"},{id:this._id+"_cancel"}),gt=t.buildTag("input","",{},{type:"checkbox"}),h=document.createElement("label");h.id=this._id+"_lockedprop";h.className="e-pdfviewer-properties-label";h.style.marginRight="18px";h.innerHTML="Locked";r.appendChild(gt[0]);r.appendChild(h);r.appendChild(dt[0]);r.appendChild(kt[0]);gt.ejCheckBox({cssClass:"e-pdfviewer-lockedcheckbox",id:this._id+"_lockedcheckbox",size:t.CheckboxSize.Small,change:n.proxy(this._lockProperties,this)});w[0].style.height="300px";b[0].style.height="300px";yt.appendChild(r);vt.appendChild(yt);ti.append(vt);kt.ejButton({showRoundedCorner:!0,size:"small"});dt.ejButton({showRoundedCorner:!0,size:"small"});n("#"+this._id+"_PropertiesDialogTab").ejTab({});ni=this.element.width();ni>=500?n("#"+this._id+"_containerDialogTab").ejDialog({showOnInit:!1,width:"500px",enableResize:!1,close:n.proxy(this._closePropertiesWindow,this)}):n("#"+this._id+"_containerDialogTab").ejDialog({showOnInit:!1,width:"auto",enableResize:!1,close:n.proxy(this._closePropertiesWindow,this)});k=document.createElement("div");c=document.createElement("div");c.className="e-pdfviewer-color-container";k.appendChild(c);d=document.createElement("div");d.className="e-pdfviewer-color-span";g=document.createElement("div");g.className="e-pdfviewer-color-picker";c.appendChild(d);c.appendChild(g);nt=document.createElement("SPAN");nt.id=this._id+"_colorspan";nt.innerHTML="Color:";d.appendChild(nt);tt=document.createElement("input");tt.type="text";tt.id=this._id+"_colorpicker";g.appendChild(tt);u=document.createElement("div");u.className="e-pdfviewer-opacity-container";k.appendChild(u);it=document.createElement("div");it.className="e-pdfviewer-opacity-span";rt=document.createElement("div");rt.className="e-pdfviewer-opacity-field";u.appendChild(it);u.appendChild(rt);ut=document.createElement("SPAN");ut.id=this._id+"_opacityspan";ut.innerHTML="Opacity:";it.appendChild(ut);i=document.createElement("input");i.type="text";i.id=this._id+"_opacity";i.className="e-inputchangeval";i.value="100%";i.style.width="50px";i.style.height="20px";rt.appendChild(i);l=document.createElement("div");l.className="e-pdfviewer-slider-control";l.style.width="100px";u.appendChild(l);pt=document.createElement("DIV");pt.id=this._id+"_slider";l.appendChild(pt);w.append(k);n("#"+this._id+"_colorpicker").ejColorPicker({modelType:"palette"});n("#"+this._id+"_colorpicker").ejColorPicker("hide");this._colorpickerObject=n("#"+this._id+"_colorpicker").data("ejColorPicker");n("#"+this._id+"_slider").ejSlider({cssClass:"e-pdfviewer-opacity-slider",value:100,minValue:0,maxValue:100,incrementStep:1,showRoundedCorner:!0,change:this._slidervaluechange,slide:this._slidervaluechange});f=document.createElement("div");f.style.border="0px";a=document.createElement("div");a.className="e-pdfviewer-author-container";f.appendChild(a);ft=document.createElement("div");ft.className="e-pdfviewer-author-span";a.appendChild(ft);et=document.createElement("SPAN");et.id=this._id+"_authorspan";et.innerHTML="Author:";ft.appendChild(et);ot=document.createElement("div");ot.className="e-pdfviewer-author-inputdiv";a.appendChild(ot);e=document.createElement("input");e.id=this._id+"_author_input";e.className="e-pdfviewer-author-input";ot.appendChild(e);v=document.createElement("div");v.className="e-pdfviewer-subject-container";f.appendChild(v);st=document.createElement("div");st.className="e-pdfviewer-subject-span";v.appendChild(st);ht=document.createElement("SPAN");ht.id=this._id+"_subjectspan";ht.innerHTML="Subject:";st.appendChild(ht);ct=document.createElement("div");ct.className="e-pdfviewer-subject-inputdiv";v.appendChild(ct);o=document.createElement("input");o.id=this._id+"_subject_input";o.className="e-pdfviewer-subject-input";ct.appendChild(o);s=document.createElement("div");s.className="e-pdfviewer-modifieddate-container";s.style.height="18.67px";f.appendChild(s);lt=document.createElement("div");lt.className="e-pdfviewer-modified-labeldiv";at=document.createElement("SPAN");at.id=this._id+"_modifiedspan";at.innerHTML="Modified:";lt.appendChild(at);s.appendChild(lt);y=document.createElement("div");y.className="e-pdfviewer-modifieddate-labeldiv";y.id=this._id+"_modifieddate";wt=document.createElement("SPAN");wt.innerHTML="";y.appendChild(wt);s.appendChild(y);b.append(f);n("#"+this._id+"_containerDialogTab_title").addClass("e-pdfviewer-propertiestitle");n("#"+this._id+"_containerDialogTab").addClass("e-pdfviewer-propertiestab");n("#"+this._id+"_PropertiesDialogTab").addClass("e-pdfviewer-innertab");n("#"+this._id+"_apperanceProperties").addClass("e-pdfviewer-appearanceprop");n("#"+this._id+"_generalProperties").addClass("e-pdfviewer-generalprop");n("#"+this._id+"_appearanceli").addClass("e-pdfviewer-tab-li");n("#"+this._id+"_generalli").addClass("e-pdfviewer-tab-li");n(i).addClass("e-pdfviewer-elementalignments");n(i).addClass("ejinputtext");n(e).addClass("e-pdfviewer-elementalignments");n(e).addClass("ejinputtext");n(o).addClass("e-pdfviewer-elementalignments");n(o).addClass("ejinputtext");this._tabObject=n("#"+this._id+"_PropertiesDialogTab").data("ejTab");this._on(n("#"+this._id+"_ok"),"click",this._applyAnnotationProperties);this._on(n("#"+this._id+"_cancel"),"click",this._cancelAnnotationProperties)},_applyAnnotationProperties:function(){var e=this._tabObject,i=this._colorpickerObject.rgb,r=parseInt(n("#"+this._id+"_opacity").val().split("%")[0])/100,u=n("#"+this._id+"_author_input").val(),f=n("#"+this._id+"_subject_input").val(),t=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage);this._changeAnnotationProperties(i,r,u,f,t.currentAnnotationIndex,this._AnnotationPage,t.isExistingAnnotation);n("#"+this._id+"_containerDialogTab").ejDialog("close")},_cancelAnnotationProperties:function(){n("#"+this._id+"_containerDialogTab").ejDialog("close")},_getAnnotation:function(n,t){for(var f,h,u,i=this._textMarkupAnnotationList[t],e=[],o=null,s=!1,r=0;r<n.length;r++)if(i)for(f=0;f<i.length;f++)n[r]==i[f]&&(e.push(i[f]),o=f,s=!0);for(i=this._newAnnotationList[t-1],r=0;r<n.length;r++){if(i)for(u=0;u<i.length;u++)n[r]==i[u]&&(e.push(i[u]),o=u,s=!1,h=i[u]);if(n[r]==h)break}return this._currentAnnotations=e,{currentAnnotationIndex:o,isExistingAnnotation:s}},_changeAnnotationProperties:function(t,i,r,u,f,e,o){var g=document.getElementById(this._id+"_secondarycanvas_"+e),tt=g.getContext("2d"),v,s,a,k,b,d,nt;tt.clearRect(0,0,g.width,g.height);this._selectedAnnotationObject=null;var y=!1,p=!1,h,w,c={},l=new Date;for(this._drawAnnotSelectRect(e,this._currentAnnotationRectangleBackup),o?(s=this._textMarkupAnnotationList[e][f],(s.Color.R!=t.r||s.Color.G!=t.g||s.Color.B!=t.b||s.Opacity!=i||s.Author!=r||s.Subject!=u)&&(a={},a=JSON.parse(JSON.stringify(s)),this._colorModifiedAnnotationList[e-1].push(a),s.Color.R!=t.r||s.Color.G!=t.g||s.Color.B!=t.b?y=!0:s.Opacity!=i&&(p=!0),s.Color.R=t.r,s.Color.G=t.g,s.Color.B=t.b,s.Color.A=t.a,s.Opacity=i,s.Author=r,s.Subject=u,h=s.TextMarkupAnnotationType,h=="Highlight"?s.ModifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:l.toLocaleString():h=="Underline"?s.ModifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:l.toLocaleString():h=="StrikeOut"&&(s.ModifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:l.toLocaleString()),w=f,this._totalAnnotations[e][f]=JSON.parse(JSON.stringify(s)),v={},v.index=f,v.annotation=s,v.action="propertyChanged",this._existingAnnotationsModified[e-1].push(v),b={operation:"propertiesModifiedForExistingAnnot",pageNumber:this._AnnotationPage,indexes:f},this._recentOperation.push(b)),k=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),s.isLocked=k.model.checkState=="check"?!0:!1):(s=this._newAnnotationList[e-1][f],(s.colorR!=t.r||s.colorG!=t.g||s.colorB!=t.b||s.opacity!=i||s.author!=r||s.subject!=u)&&(a={},a=JSON.parse(JSON.stringify(s)),this._colorModifiedAnnotationList[e-1].push(a),s.colorR!=t.r||s.colorG!=t.g||s.colorB!=t.b?y=!0:s.opacity!=i&&(p=!0),s.colorR=t.r,s.colorG=t.g,s.colorB=t.b,s.opacity=i,s.colorA=s.opacity*255,s.author=r,s.subject=u,h=s.type,h=="Highlight"?s.modifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:l.toLocaleString():h=="Underline"?s.modifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:l.toLocaleString():h=="StrikeOut"&&(s.modifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:l.toLocaleString()),w=this._textMarkupAnnotationList[e]?this._textMarkupAnnotationList[e].length+f:f,this._totalAnnotations[e][w]=JSON.parse(JSON.stringify(s)),k=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),s.isLocked=k.model.checkState=="check"?!0:!1,b={operation:"propertiesModifiedForNewAnnot",pageNumber:this._AnnotationPage,indexes:f},this._recentOperation.push(b))),(y||p)&&(c.isColorChanged=y,c.isOpacityChanged=p,c.annotationType=h,c.annotationId=w,c.pageId=e,this._raiseClientEvent("annotationPropertiesChange",c)),this._redoActions=[],d=0;d<this._totalPages;d++)nt=[],this._redoAnnotationCollection[d]=nt;this.isDocumentEdited=!0;this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[e],e)},_slidervaluechange:function(t){var i=t.value,r=this._id.split("_slider")[0];n("#"+r+"_opacity").val(i+"%")},_deleteAnnotation:function(){var u,f,o,s,e,t,c;if(this._isAnnotationSelected){var i,h=[],r={},n=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage);if(n.isExistingAnnotation){for(i=this._textMarkupAnnotationList[this._AnnotationPage],u=i[n.currentAnnotationIndex],r.annotationType=u.TextMarkupAnnotationType,this._deletedAnnotationList[this._AnnotationPage-1].push(u),f={},f.index=u.Index,r.annotationId=u.Index,r.pageId=this._AnnotationPage,f.annotation=u,f.action="deleted",this._existingAnnotationsModified[this._AnnotationPage-1].push(f),this._annotationsDeletedNo[this._AnnotationPage-1]=this._annotationsDeletedNo[this._AnnotationPage-1]+1,t=0;t<i.length;t++)i[t]!=u&&h.push(i[t]);e={operation:"existingAnnotationDeleted",pageNumber:this._AnnotationPage,indexes:n.currentAnnotationIndex};this._recentOperation.push(e);this._textMarkupAnnotationList[this._AnnotationPage]=h;this._totalAnnotations[this._AnnotationPage].splice(n.currentAnnotationIndex,1)}else i=this._newAnnotationList[this._AnnotationPage-1],o=i[n.currentAnnotationIndex],r.annotationType=o.type,this._deletedAnnotationList[this._AnnotationPage-1].push(o),this._newAnnotationList[this._AnnotationPage-1].splice(n.currentAnnotationIndex,1),s=this._textMarkupAnnotationList[this._AnnotationPage]?this._textMarkupAnnotationList[this._AnnotationPage].length+n.currentAnnotationIndex:n.currentAnnotationIndex,r.annotationId=s,r.pageId=this._AnnotationPage,this._totalAnnotations[this._AnnotationPage].splice(s,1),e={operation:"newAnnotationDeleted",pageNumber:this._AnnotationPage,indexes:n.currentAnnotationIndex},this._recentOperation.push(e);for(this._redoActions=[],t=0;t<this._totalPages;t++)c=[],this._redoAnnotationCollection[t]=c;this._raiseClientEvent("annotationRemove",r);this.isDocumentEdited=!0;this._clearRectOnClick(this._AnnotationPage);this._isAnnotationSelected=!1}},_createHighlightContextMenu:function(){var i=document.createElement("div"),r=n("#"+this._id+"_pageviewContainer"),t,u;i.id=this._id+"highlight-menu";i.className="e-pdfviewer-highlight-menu";r.append(i);t=document.createElement("ol");t.className="highlightorderedList";i.appendChild(t);u=window.getSelection().toString();n(t).append("<li class='popupnoteli'><a href='javascript:void(0);' class='popupnote' id = '"+this._id+"_openPopup'>Open Pop-Up Note<\/a><\/li>");n(t).append("<li class='deleteAnnotationli'><a href='javascript:void(0);' id='"+this._id+"_deleteannot' class='deleteAnnotation'>Delete <\/a><\/li>");n(t).append("<li class='Propertiesli'><a href='javascript:void(0);' class='Properties' id = '"+this._id+"_propAnnot'>Properties.... <\/a><\/li>")},_setPopupMenuPosition:function(t,i){var e;t.type=="touchstart"&&i[0].id==this._id+"_popupmenu"&&(t=t.originalEvent.changedTouches[0]);var r={},f={},u={};return u.x=i.outerWidth(),u.y=i.outerHeight(),r.x=t.pageX,r.y=t.pageY,f.x=r.x+u.x>n(window).width()+n(window).scrollLeft()?r.x-u.x:r.x,f.y=r.y+u.y>n(window).height()+n(window).scrollTop()?r.y-u.y:r.y,i[0].id==this._id+"_popupmenu"&&(e=document.getElementById(this._id+"_viewerContainer"),f.x+u.x>e.clientWidth&&(f.x=f.x-u.x/4)),f},_setHighLightContextMenuPostion:function(t){var f=n("#"+this._id+"custom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.pageX,i.y=t.pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x-r.x:i.x,u.y=i.y+r.y>n(window).height()+n(window).scrollTop()?i.y-r.y:i.y,u},_onViewerKeypress:function(n){n.ctrlKey&&n.which==26||n.ctrlKey&&n.keyCode==26?this._isPropertiesWindowOpen||this._undo():(n.ctrlKey&&n.which==25||n.ctrlKey&&n.keyCode==25)&&(this._isPropertiesWindowOpen||this._redo())},_undo:function(){var n=this._recentOperation.pop(),t,i;if(n){if(n.operation=="AddedHighlight"||n.operation=="AddedUnderline"||n.operation=="AddedStrikeOut"){for(t=0;t<n.indexes.length;t++)i=this._newAnnotationList[n.pageNumber-1].pop(),this._redoAnnotationCollection[n.pageNumber-1].push(i);this._redoActions.push(n)}else n.operation=="propertiesModifiedForExistingAnnot"||n.operation=="propertiesModifiedForNewAnnot"?(this._undoModifiedProperty(n),this._redoActions.push(n)):(n.operation=="existingAnnotationDeleted"||n.operation=="newAnnotationDeleted")&&(this._undoDeletedItem(n),this._redoActions.push(n));this._clearRectOnClick(n.pageNumber)}},_undoModifiedProperty:function(n){var t,r,i;n.operation=="propertiesModifiedForExistingAnnot"?(t=this._textMarkupAnnotationList[n.pageNumber][n.indexes],r=JSON.parse(JSON.stringify(t)),this._redoAnnotationCollection[n.pageNumber-1].push(r),i=this._colorModifiedAnnotationList[n.pageNumber-1].pop(),t.Color.R=i.Color.R,t.Color.G=i.Color.G,t.Color.B=i.Color.B,t.Opacity=i.Opacity,this._existingAnnotationsModified[n.pageNumber-1].pop()):(t=this._newAnnotationList[n.pageNumber-1][n.indexes],r=JSON.parse(JSON.stringify(t)),this._redoAnnotationCollection[n.pageNumber-1].push(r),i=this._colorModifiedAnnotationList[n.pageNumber-1].pop(),t.colorR=i.colorR,t.colorG=i.colorG,t.colorB=i.colorB,t.opacity=i.opacity,t.colorA=i.colorA)},_undoDeletedItem:function(n){var t,r,i;n.operation=="existingAnnotationDeleted"?(t=this._deletedAnnotationList[n.pageNumber-1].pop(),this._textMarkupAnnotationList[n.pageNumber].splice(n.indexes,0,t),this._totalAnnotations[n.pageNumber].splice(n.indexes,0,t),this._existingAnnotationsModified[n.pageNumber-1].pop()):(t=this._deletedAnnotationList[n.pageNumber-1].pop(),r=this._newAnnotationList[n.pageNumber-1].splice(n.indexes,0,t),i=this._textMarkupAnnotationList[n.pageNumber]?this._textMarkupAnnotationList[n.pageNumber].length+n.indexes:n.indexes,this._totalAnnotations[n.pageNumber].splice(i,0,t))},_redo:function(){var n=this._redoActions.pop(),t,i;if(n){if(this._recentOperation.push(n),n.operation=="AddedHighlight"||n.operation=="AddedUnderline"||n.operation=="AddedStrikeOut")for(t=0;t<n.indexes.length;t++)i=this._redoAnnotationCollection[n.pageNumber-1].pop(),this._newAnnotationList[n.pageNumber-1].push(i);else n.operation=="propertiesModifiedForExistingAnnot"||n.operation=="propertiesModifiedForNewAnnot"?this._redoModifiedProperty(n):(n.operation=="existingAnnotationDeleted"||n.operation=="newAnnotationDeleted")&&this._redoDeletedItem(n);this._clearRectOnClick(n.pageNumber)}},_redoModifiedProperty:function(n){var r;if(n.operation=="propertiesModifiedForExistingAnnot"){var t=this._textMarkupAnnotationList[n.pageNumber][n.indexes],u=JSON.parse(JSON.stringify(t)),i=this._redoAnnotationCollection[n.pageNumber-1].pop();this._colorModifiedAnnotationList[n.pageNumber-1].push(u);t.Color.R=i.Color.R;t.Color.G=i.Color.G;t.Color.B=i.Color.B;t.Opacity=i.Opacity;r={};r.index=n.indexes;r.annotation=t;r.action="propertyChanged";this._existingAnnotationsModified[n.pageNumber-1].push(r)}else{var t=this._newAnnotationList[n.pageNumber-1][n.indexes],u=JSON.parse(JSON.stringify(t)),i=this._redoAnnotationCollection[n.pageNumber-1].pop();this._colorModifiedAnnotationList[n.pageNumber-1].push(u);t.colorR=i.colorR;t.colorG=i.colorG;t.colorB=i.colorB;t.opacity=i.opacity;t.colorA=i.colorA}},_redoDeletedItem:function(n){var t,i,r;n.operation=="existingAnnotationDeleted"?(t=this._textMarkupAnnotationList[n.pageNumber],i=t[n.indexes],this._deletedAnnotationList[n.pageNumber-1].push(i),this._textMarkupAnnotationList[n.pageNumber].splice(n.indexes,1),this._totalAnnotations[n.pageNumber].splice(n.indexes,1)):(t=this._newAnnotationList[n.pageNumber-1],i=t[n.indexes],this._deletedAnnotationList[n.pageNumber-1].push(i),this._newAnnotationList[n.pageNumber-1].splice(n.indexes,1),r=this._textMarkupAnnotationList[n.pageNumber]?this._textMarkupAnnotationList[n.pageNumber].length+n.indexes:n.indexes,this._totalAnnotations[n.pageNumber].splice(r,1))},_displayColorPicker:function(t){var i=document.getElementById(this._id+"_pdfviewer_colorpicker");n(i).css("display")!="none"||this._isToolbarColorPicker?this._colorPickerStatus==t?(i.style.display="none",this._isToolbarColorPicker=!1):(t=="Highlight"?this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color):t=="Underline"?this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color):t=="StrikeOut"&&this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color),this._colorPickerStatus=t,this._isDefaultColorSet=!0):(i.style.display="block",this._isToolbarColorPicker=!0,this._colorPickerStatus!=t&&(this._drawColor=null,t=="Highlight"?this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color):t=="Underline"?this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color):t=="StrikeOut"&&this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color)),this._colorPickerStatus=t,this._isDefaultColorSet=!0)},_setPickerPosition:function(t){var r=n("#"+this._id+"_toolbarContainer"),i,u,f,e;this._toolbarColorpickerObject.refresh();i=document.getElementById(this._id+"_pdfviewer_colorpicker");u=i.getBoundingClientRect();n("#"+this._id+"_pdfviewer_textmarkupul").parent()[0]==r[0]?(i.style.top="0px",i.style.left=t.parentNode.offsetLeft+t.offsetLeft-r[0].offsetLeft-u.width+t.clientWidth+"px"):(f=document.getElementById(this._id+"_toolbarContainer_hiddenlist"),secondaryToolbarPosition=f.getBoundingClientRect(),e=document.getElementById(this._id+"_pdfviewer_textmarkupul").getBoundingClientRect(),i.style.top=secondaryToolbarPosition.bottom-e.bottom+"px",i.style.left=t.parentNode.parentNode.offsetLeft-r[0].offsetLeft+t.offsetLeft-u.width+t.clientWidth+"px")},_showTextMarkupButtons:function(t){t?(n("#"+this._id+"_pdfviewer_textmarkupul").css("display","block"),n("#"+this._id+"_pdfviewer_zoomul").addClass("e-separator")):(n("#"+this._id+"_pdfviewer_textmarkupul").css("display","none"),n("#"+this._id+"_pdfviewer_zoomul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_colorpicker").css("display","none"),this._isToolbarColorPicker=!1)},_wireEvents:function(){var r=navigator.userAgent.indexOf("Chrome")!=-1,u=navigator.userAgent.indexOf("Firefox")!=-1,o=navigator.userAgent.indexOf("Safari")!=-1,f=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,s=navigator.userAgent.indexOf("Edge")!=-1,e=document.documentMode||/Edge/.test(navigator.userAgent),t=this,i;this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._on(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._on(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_toolbarContainer"),"mousedown",this._onToolBarContainerMouseDown),this._on(n(".e-pdfviewer-ejdropdownlist"),"mousedown",this._onToolBarContainerMouseDown),this._on(n("#"+this._id+"_viewerContainer"),"mousewheel",this._onContainerScroll),this._on(n(window),"keypress",this._onViewerKeypress),document.documentMode||f?(this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._on(n("#"+this._id+"_viewerContainer"),"dblclick",this._selectingTextOnDblClick),this._on(n("#"+this._id+"_viewerContainer"),"click",this._selectingTextOnClick)):e||(u?this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy):r&&(this._on(n("#"+this._id+"_viewerContainer"),"touchstart",this._onTextContainerTouch),this._on(n("#"+this._id+"_viewerContainer"),"touchmove",this._onTextContainerTouchMove),this._on(n("#"+this._id+"_viewerContainer"),"touchend",this._onTextContainerTouchEnd)),this._on(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._on(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),this._on(n("#"+this._id+"_viewerContainer"),"mouseleave",this._onTextContainerMouseLeave),this._on(n("#"+this._id+"_viewerContainer"),"mouseenter",this._onTextContainerMouseEnter),this._on(n("#"+this._id+"_viewerContainer"),"mouseover",this._onTextContainerMouseIn),this._on(n("#"+this._id+"_viewerContainer"),"dragstart",this._onTextContainerDragStart)),r||u||f||s||e?(this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.copy",this._copySelectedText),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.googleSearch",this._openInNewTab),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.e-highlight-text",this._drawHighlightAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.e-strikeout-text",this._drawStrikeOutAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.deleteAnnotation",this._deleteAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.popupnote",this._showPopupMenu),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.Properties",this._showPropertiesMenu),this._on(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick)):o&&this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp));n(window).on("keydown",function(i){i.ctrlKey&&(i.keyCode==65||i.keyCode==97)?i.preventDefault():i.keyCode==46&&(t._currentAnnotationRectangleBackup.length==0||t._isPropertiesWindowOpen||t._isPopupNoteVisible||(t._deleteAnnotation(),n("#"+t._id+"_popupmenu").hide(),t._isPopupNoteVisible=!1))});i=document.getElementById(this._id+"_viewerContainer");n("#"+this._id+"_viewerContainer").css({"touch-action":"pan-x pan-y"});n("#"+this._id+"_pdfviewerContainer").css({"touch-action":"pan-x pan-y",position:"relative"});(navigator.userAgent.match("Firefox")||navigator.userAgent.match("Chrome"))&&(i.addEventListener("touchstart",this._touchStart),i.addEventListener("touchmove",this._touchMove),i.addEventListener("touchleave",this._touchEnd),i.addEventListener("touchend",this._touchEnd),i.addEventListener("touchcancel",this._touchEnd));this._on(n("#"+this._id+"_pdfviewer_searchinput"),"input",this._textSearch);this._on(n("#"+this._id+"_pdfviewer_searchinput"),"keypress",this._searchKeypressHandler);this._on(n("#"+this._id+"_pdfviewer_previous_search"),"click",this._prevSearch);this._on(n("#"+this._id+"_pdfviewer_next_search"),"click",this._nextSearch);this._on(n("#"+this._id+"_pdfviewer_close_search"),"click ",this._displaySearchBox);this._on(n("#"+this._id+"_viewerContainer"),"pointerdown",this._pointerdown);this._on(n("#"+this._id+"_viewerContainer"),"pointermove",this._pointermove);this._on(n("#"+this._id+"_viewerContainer"),"pointerup",this._pointerup);this._on(n("#"+this._id+"_viewerContainer"),"pointerleave",this._pointerup);this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip);this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip)},_unwireEvents:function(){var e=navigator.userAgent.indexOf("Chrome")!=-1,i=navigator.userAgent.indexOf("Firefox")!=-1,o=navigator.userAgent.indexOf("Safari")!=-1,r=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,u=navigator.userAgent.indexOf("Edge")!=-1,f=document.documentMode||/Edge/.test(navigator.userAgent),t;this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._off(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._off(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._off(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_viewerContainer"),"mousewheel",this._onContainerScroll),this._off(n(window),"keypress",this._onViewerKeypress));t=document.getElementById(this._id+"_viewerContainer");document.documentMode||u||r||f?(this._off(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._off(n("#"+this._id+"_viewerContainer"),"dblclick",this._selectingTextOnDblClick),this._off(n("#"+this._id+"_viewerContainer"),"click",this._selectingTextOnClick)):(i&&this._off(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._off(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._off(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),this._off(n("#"+this._id+"_viewerContainer"),"mouseleave",this._onTextContainerMouseLeave),this._off(n("#"+this._id+"_viewerContainer"),"mouseover",this._onTextContainerMouseIn),this._off(n("#"+this._id+"_viewerContainer"),"touchstart",this._onTextContainerTouch),this._off(n("#"+this._id+"_viewerContainer"),"touchend",this._onTextContainerTouchEnd),this._off(n("#"+this._id+"_viewerContainer"),"touchmove",this._onTextContainerTouchMove),this._off(n("#"+this._id+"_viewerContainer"),"dragstart",this._onTextContainerDragStart),this._off(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick));(e||i||r||f||u)&&(this._off(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._off(n("#"+this._id+"_pageviewContainer"),"click","a.copy",this._copySelectedText),this._off(n("#"+this._id+"_pageviewContainer"),"click","a.googleSearch",this._openInNewTab),this._off(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp));(navigator.userAgent.match("Firefox")||navigator.userAgent.match("Chrome"))&&(t.removeEventListener("touchstart",this._touchStart),t.removeEventListener("touchmove",this._touchMove),t.removeEventListener("touchleave",this._touchEnd),t.removeEventListener("touchend",this._touchEnd),t.removeEventListener("touchcancel",this._touchEnd));this._off(n("#"+this._id+"_viewerContainer"),"pointerdown",this._pointerdown);this._off(n("#"+this._id+"_viewerContainer"),"pointermove",this._pointermove);this._off(n("#"+this._id+"_viewerContainer"),"pointerup",this._pointerup);this._off(n("#"+this._id+"_viewerContainer"),"pointerleave",this._pointerup);this._off(n("#"+this._id+"_pdfviewer_searchinput"),"input",this._textSearch);this._off(n("#"+this._id+"_pdfviewer_searchinput"),"keypress",this._searchKeypressHandler);this._off(n("#"+this._id+"_pdfviewer_previous_search"),"click",this._prevSearch);this._off(n("#"+this._id+"_pdfviewer_next_search"),"click",this._nextSearch);this._off(n("#"+this._id+"_pdfviewer_close_search"),"click ",this._displaySearchBox);this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip);this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip);this._off(n(window),"resize",this._viewerResize)},_onContainerScroll:function(n){document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1;this._isPropertiesWindowOpen&&n.preventDefault()},_closePropertiesWindow:function(){this._isPropertiesWindowOpen=!1},_onToolBarContainerMouseDown:function(n){return n.preventDefault(),!1},_onToolbarItemClick:function(t){t.target.id==this._id+"_txtpageNo"&&n("#"+this._id+"_txtpageNo").select();n("#"+this._id+"_rptTooltip").css("display","none")},_selectingTextOnClick:function(n){this._timers&&this._clientx==n.clientX&&this._clienty==n.clientY&&(clearTimeout(this._timers),this._timers=null,this._selectingEntireLine(n))},_selectingEntireLine:function(t){var i,u=[],v=t.target,y=v.getBoundingClientRect(),p=n(".e-pdfviewer-textLayer").length,r,o,s,c;if(n(t.target).hasClass("e-pdfviewer-textLayer")){for(r=0;r<p;r++){var w=n(".e-pdfviewer-textLayer")[r].getBoundingClientRect(),f=parseInt(w.top),e=parseInt(y.top);(f==e||f+1==e||f-1==e)&&(o=n(".e-pdfviewer-textLayer")[r].id,o!=""&&u.push(o))}s=window.getSelection();s.removeAllRanges();var i=document.createRange(),b=u.length-1,l=document.getElementById(u[0]),h=document.getElementById(u[b]),a=h.childNodes.length;a>0?(c=h.childNodes[a-1],i.setStart(l,0),i.setEnd(c,c.length)):(i.setStart(l,0),i.setEnd(h,1));s.addRange(i)}},_selectingTextOnDblClick:function(n){this._clientx=n.clientX;this._clienty=n.clientY;this._isAnnotationSelected?(this._showPopupMenu(n),this._clearSelector(n)):this._getElementTouch(n.target,n.clientX,n.clientY);this._timers=setTimeout(function(){this._timers=null},200)},_onTextContainerMouseIn:function(n){if(this.Clicked)return n.preventDefault(),!1},_onTextContainerMouseUp:function(i){var y,c,p,u,s,r,l,f,ft,et,v,tt,b,rt,k,e,st,d,nt,o;if(document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._isDefaultColorSet=!1,s=i.target,p=n("#"+this._id+"_popupinnercontent"),s==p[0]?p.focus():p.blur(),this._isPopupNoteFocused=!1,this._isPropertiesWindowOpen||i.target.id==this._id+"_popupinnercontent"||i.target.id==this._id+"_popupcontent")i.preventDefault();else{if(this._curDown=!1,u=[],s=i.target,this._currentAnnotationRectangle=[],r=document.getElementById(this._id+"custom-menu"),l=document.getElementById(this._id+"highlight-menu"),i.target.className!="popupnoteli"&&i.target.className!="deleteAnnotationli"&&i.target.className!="Propertiesli"&&i.target.className!="e-pdfviewer-highlight-menu"&&n(l).hide(),this._isContextMenuPresent=!1,f=parseInt(i.target.id.split("text_")[1])||parseInt(i.target.id.split("selectioncanvas_")[1])||parseInt(i.target.id.split("_secondarycanvas_")[1]),f&&this.model.enableTextMarkupAnnotations){for(e=1;e<=this._totalPages;e++)(this._textMarkupAnnotationList[e]||this._newAnnotationList[e-1])&&this._clearRectOnClick(e);ft=document.getElementById(this._id+"_secondarycanvas_"+f);this._onCanvasMousedown(ft,i.pageX,i.pageY);this._contextClickPosition(i,f)}if(window.getSelection().toString()||this._currentAnnotationRectangle.length!=0&&(y=this._currentAnnotationRectangle[0],c=y.TextMarkupAnnotationType?y.TextMarkupAnnotationType:y.type,c=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle)):c=="Highlight"&&this.model.enableHighlightAnnotation?(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle)):c=="Underline"&&this.model.enableUnderlineAnnotation&&(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle))),et=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,v=window.getSelection().toString(),i.type=="contextmenu")if(tt=window.getSelection(),tt.anchorNode){var h=tt.getRangeAt(0),w=h.cloneContents(),a=w.childNodes,ot=h.startContainer.parentNode.className,it=n(w).find("span");if(it.length>0&&(it[0].className=="e-pdfviewer-texthighlight e-pdfviewer-textLayer"||it[0].className=="e-pdfviewer-text-highlightother e-pdfviewer-textLayer")&&h.startContainer.id&&u.push(h.startContainer.id),et&&n(w).children().length==0&&(ot=="e-pdfviewer-textLayer"?u.push(h.startContainer.parentElement.id):u.push(h.startContainer.id)),w.childElementCount==0)ot=="e-pdfviewer-textLayer"?u.push(h.startContainer.parentElement.id):u.push(h.startContainer.id);else if(a.length>0)if(a[0].className=="e-waitingpopup e-js")for(b=0;b<a.length;b++)for(rt=n(a[b]).find(".text_container").children(),k=0;k<rt.length;k++)u.push(rt[k].id);else for(e=0;e<a.length;e++)st=a[e].id,u.push(st);for(d=0;d<u.length;d++)if((n(s).hasClass("e-pdfviewer-text-highlightother")||n(s).hasClass("e-pdfviewer-texthighlight"))&&(s=s.parentElement),s.id==u[d]){this._contextMenu=!0;break}else this._contextMenu=!1}else this._contextMenu=!1;if(v!=""&&i.which==3&&this._contextMenu&&i.type=="contextmenu"&&!this._isCopyRestrict){i.preventDefault();this._searchedText="";var g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],ht=g.contextMenu.copy.contentText,ut=g.contextMenu.googleSearch.contentText,ct=g.toolbar.highlight.headerText,lt=g.toolbar.strikeout.headerText;n(r).find("li a.copy").text(ht);n(r).find("li a.googleSearch").text(ut);n(r).find("li a.e-highlight-text").text(ct);n(r).find("li a.e-strikeout-text").text(lt);v.length>20?(nt=v.substring(0,18),str=nt+"...",n(r).find("li a.googleSearch").text(ut+"'"+str+"'")):n(r).find("li a.googleSearch").text(ut+"'"+v+"'");o=this._setContextMenuPostion(i);this.model.enableTextMarkupAnnotations?(this.model.enableHighlightAnnotation?n("#"+this._id+"_highlight_contextmenu").removeClass("e-disable"):n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),this.model.enableStrikethroughAnnotation?n("#"+this._id+"_strikeout_contextmenu").removeClass("e-disable"):n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")):(n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable"));n(r).show();n(r).offset({top:o.y,left:o.x}).show();n(r).show();n(r).offset({top:o.y,left:o.x}).show();this._contextMenu=!1}else i.which==3&&i.type=="contextmenu"&&!this._isCopyRestrict&&(n(i.target).hasClass("e-pdfviewer-text-highlightother e-pdfviewer-textLayer")||n(i.target).hasClass("e-pdfviewer-texthighlight e-pdfviewer-textLayer"))?(i.preventDefault(),this._searchedText=i.target.innerHTML,this._searchedText.length>20?(nt=this._searchedText.substring(0,18),str=nt+"...",n(r).find("li a.googleSearch").text("Search Google For '"+str+"'")):n(r).find("li a.googleSearch").text("Search Google For '"+this._searchedText+"'"),o=this._setContextMenuPostion(i),this.model.enableTextMarkupAnnotations?(this.model.enableHighlightAnnotation?n("#"+this._id+"_highlight_contextmenu").removeClass("e-disable"):n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),this.model.enableStrikethroughAnnotation?n("#"+this._id+"_strikeout_contextmenu").removeClass("e-disable"):n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")):(n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")),n(r).show(),n(r).offset({top:o.y,left:o.x}).show(),n(r).show(),n(r).offset({top:o.y,left:o.x}).show(),this._contextMenu=!1):n(r).has(i.target).length==0&&(n(r).hide(),i.type!="contextmenu"||this._contextMenu?this._contextMenu&&i.preventDefault():this._clearSelector(),i.type=="contextmenu"&&(i.which!=3||this._contextMenu||i.type!="contextmenu"||this._currentAnnotationRectangle.length==0&&"#000000"==this._annotationColor?n(l).hide():(this.model.enableTextMarkupAnnotations&&(c=="StrikeOut"&&this.model.enableStrikethroughAnnotation?this._showAnnotationContextMenu(i,l):c=="Highlight"&&this.model.enableHighlightAnnotation?this._showAnnotationContextMenu(i,l):c=="Underline"&&this.model.enableUnderlineAnnotation&&this._showAnnotationContextMenu(i,l)),i.preventDefault())));this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation())}},_replaceTextLocale:function(n,t){n.textContent=t},_showAnnotationContextMenu:function(i,r){var u;n("#"+this._id+"_popup_note").hide();n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;var f=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],e=f.contextMenu.openPopup.contentText,o=f.contextMenu.Delete.contentText,s=f.contextMenu.properties.contentText;this._replaceTextLocale(n("#"+this._id+"_openPopup")[0],e);this._replaceTextLocale(n("#"+this._id+"_deleteannot")[0],o);this._replaceTextLocale(n("#"+this._id+"_propAnnot")[0],s);u=this._setHighLightContextMenuPostion(i);this._isContextMenuPresent=!0;n(r).show();n(r).offset({top:u.y,left:u.x}).show();n(r).show();n(r).offset({top:u.y,left:u.x}).show()},_contextClickPosition:function(n,t){var a,u,o,v,s,i,l,r,e;this._currentAnnotationRectangleBackup=[];u=[];o=!1;t&&(v=document.getElementById(this._id+"_secondarycanvas_"+t),a=v.getBoundingClientRect());var h=n.clientX-a.left,c=n.clientY-a.top,f=this._newAnnotationList[t-1];for(s=0;s<f.length;s++)for(r=f[s],e=0;e<r.bounds.length;e++)if(i=r.bounds[e],h>=i.xPosition*this._zoomVal&&h<=(i.xPosition+i.width)*this._zoomVal&&c>=i.yPosition*this._zoomVal&&c<=(i.yPosition+i.height)*this._zoomVal)this._currentAnnotationRectangle.push(f[s]),this._currentAnnotationRectangleBackup.push(f[s]),o=!0,u.push(r);else{if(o){o=!1;break}this._isPopupNoteVisible||(this._currentAnnotationRectangleBackup=[]);this._currentAnnotationRectangle=[]}if(f=this._textMarkupAnnotationList[t],f)for(l=0;l<f.length;l++)for(r=f[l],e=0;e<r.Bounds.length;e++){var i=r.Bounds[e],y=this._convertPointToPixel(i.X),p=this._convertPointToPixel(i.Y),w=this._convertPointToPixel(i.Width),b=this._convertPointToPixel(i.Height);if(h>=y*this._zoomVal&&h<=(y+w)*this._zoomVal&&c>=p*this._zoomVal&&c<=(p+b)*this._zoomVal)this._currentAnnotationRectangle.push(r),this._currentAnnotationRectangleBackup.push(r),o=!0,u.push(r);else{if(o){o=!1;break}this._isPopupNoteVisible||(this._currentAnnotationRectangleBackup=[]);this._currentAnnotationRectangle=[]}}u.length>1&&(u=this._compareAnnotations(u));this._currentAnnotationRectangle=u;this._currentAnnotationRectangleBackup=u},_compareAnnotations:function(n){for(var i,f,t=0;t<n.length;t++){if(t==n.length-1)break;var r=n[t].bounds?n[t].bounds:n[t].Bounds,o=r[0].X?r[0].X:r[0].xPosition,s=r[0].Y?r[0].Y:r[0].yPosition,u=n[t+1].bounds?n[t+1].bounds:n[t+1].Bounds,e=u[0].X?u[0].X:u[0].xPosition,h=u[0].Y?u[0].Y:u[0].yPosition;o<e||s<h?(i=e,f=n[t+1]):(i=o,f=n[t]);i&&t==n.length-2&&i==o&&i==e&&(i=e,f=n[t+1])}return n=[],n.push(f),n},_setContextMenuPostion:function(t){var f=n("#"+this._id+"custom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.pageX,i.y=t.pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x-r.x:i.x,u.y=i.y+r.y>n(window).height()+n(window).scrollTop()?i.y-r.y:i.y,u},_createWaterDropDiv:function(){var f=n("#"+this._id+"_pageviewContainer"),u=document.createElement("DIV"),r,i,t;u.id=this._id+"droplet1";u.className="e-pdfviewer-droplet1";r=document.createElement("DIV");r.id=this._id+"droplet2";r.className="e-pdfviewer-droplet2";f.append(u);f.append(r);i=n("#"+this._id+"_viewerContainer");t=this;n("#"+this._id+"droplet2").on("touchmove",function(r){var e,v,y,f,u,s,h,c;if(t.model.enableTextSelection){t._enableSelection();var o=window.getSelection(),l=parseInt(o.anchorNode.parentNode.id.split("text_")[1]),a=parseInt(o.focusNode.parentNode.id.split("text_")[1]);(l!=parseInt(t._selectionStartPage)||a!=parseInt(t._selectionStartPage))&&t._annotationActive||(t._longTouch=!0,e=n(i).scrollTop(),n("#"+t._id+"touchcustom-menu").hide(),r.preventDefault(),s=n("#"+t._id+"droplet1").offset(),r.type=="touchmove"&&(v=r.originalEvent.changedTouches[0].clientX,y=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",0),f=r.originalEvent.changedTouches[0].clientX,u=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",1e3)),u>=s.top?(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e+30):offset=range.startOffset):n(i).scrollTop(e+30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!0)):(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e-30):offset=range.startOffset):n(i).scrollTop(e-30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!1)),n(parent).hasClass("e-pdfviewer-textLayer")&&(c=n("#"+t._id+"droplet2").width(),n("#"+t._id+"droplet2").offset({top:u+window.scrollY,left:f-c})))}else t.model.enableTextSelection||t._disableSelection()});n("#"+this._id+"droplet1").on("touchmove",function(r){var e,v,y,f,u,s,h,c;if(t.model.enableTextSelection){t._enableSelection();var o=window.getSelection(),l=parseInt(o.anchorNode.parentNode.id.split("text_")[1]),a=parseInt(o.focusNode.parentNode.id.split("text_")[1]);(l!=parseInt(t._selectionStartPage)||a!=parseInt(t._selectionStartPage))&&t._annotationActive||(e=n(i).scrollTop(),n("#"+t._id+"touchcustom-menu").hide(),r.preventDefault(),s=n("#"+t._id+"droplet2").offset(),r.type=="touchmove"&&(t._longTouch=!0,v=r.originalEvent.changedTouches[0].clientX,y=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",0),f=r.originalEvent.changedTouches[0].clientX,u=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",1e3)),u<=s.top?(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e-30):offset=range.startOffset):n(i).scrollTop(e-30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!1)):(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e+30):offset=range.startOffset):n(i).scrollTop(e+30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!0)),n(r.target).css("z-index",1e3),n(parent).hasClass("e-pdfviewer-textLayer")&&(c=n("#"+t._id+"droplet1").width(),n("#"+t._id+"droplet1").offset({top:u+window.scrollY,left:f-c})))}else t.model.enableTextSelection||t._disableSelection()})},_disableSelection:function(){this.model.enableTextSelection||n("#"+this._id+"_viewerContainer").attr("unselectable","on").css({"-moz-user-select":"-moz-none","-moz-user-select":"none","-o-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none","user-select":"none"}).bind("selectstart",function(){return!1})},_enableSelection:function(){this.model.enableTextSelection&&n("#"+this._id+"_viewerContainer").removeAttr("unselectable").css({"-moz-user-select":"text","-moz-user-select":"text","-o-user-select":"text","-khtml-user-select":"text","-webkit-user-select":"text","-ms-user-select":"text","user-select":"text"}).bind("selectstart",function(){return!0})},_selectingTextByTouch:function(n,t,i,r){var f,e,s,h,c,o,u;if(n.nodeType==n.TEXT_NODE)for(u=n.ownerDocument.createRange(),f=window.getSelection(),u.selectNodeContents(n),e=0,s=u.endOffset;e<s;){if(u.setStart(n,e),u.setEnd(n,e+1),u.getBoundingClientRect().left<=t&&u.getBoundingClientRect().right>=t&&u.getBoundingClientRect().top<=i&&u.getBoundingClientRect().bottom>=i)return h=u.toString(),c=u.getBoundingClientRect(),f.anchorNode!=null&&f.anchorNode.parentNode.className=="e-pdfviewer-textLayer"&&r?(u.setStart(f.anchorNode,f.anchorOffset),f.removeAllRanges(),f.addRange(u),f.extend(n,e)):f.anchorNode==null||r||(u.setEnd(f.focusNode,f.focusOffset),f.removeAllRanges(),f.addRange(u)),u.detach(),h;e+=1}else for(o=0;o<n.childNodes.length;o++){if(u=n.childNodes[o].ownerDocument.createRange(),u.selectNodeContents(n.childNodes[o]),u.getBoundingClientRect().left<=t&&u.getBoundingClientRect().right>=t&&u.getBoundingClientRect().top<=i&&u.getBoundingClientRect().bottom>=i)return u.detach(),this._selectingTextByTouch(n.childNodes[o],t,i,r);u.detach()}return null},_onTextContainerTouchMove:function(t){if(n(t.target).hasClass("e-pdfviewer-textLayer")&&this._lockTimer){var i=t.originalEvent.changedTouches[0].clientX,r=t.originalEvent.changedTouches[0].clientY,u=document.getElementById(this._id+"touchcustom-menu");parseInt(i)!=parseInt(this._curPosX)&&parseInt(r)!=parseInt(this._curPosY)&&(n(".text_container").css("visibility","hidden"),n(".e-pdfviewer-formFields").css("visibility","visible"),n(u).hide(),t.preventDefault())}},_setTouchContextMenu:function(t){var f=n("#"+this._id+"touchcustom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.originalEvent.changedTouches[0].pageX,i.y=t.originalEvent.changedTouches[0].pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x:i.x-r.x/2,i.y&&(u.y=i.y-r.y),u},_onTextContainerTouch:function(t){var r=t.originalEvent.touches.length,i;if(this._curPosX=t.originalEvent.changedTouches[0].clientX,this._curPosY=t.originalEvent.changedTouches[0].clientY,!this._lockTimer)return i=this,this._timer=setTimeout(function(){i._onlongtouch(t)},1e3),this._lockTimer=!0,n(t.target).hasClass("e-pdfviewer-textLayer")?(t.preventDefault(),n(".text_container").css("visibility",""),!1):void 0},_onlongtouch:function(t){var i,r;t.type=="touchstart"&&t.target.id!=this._id+"droplet2"||t.target.id!=this._id+"droplet2"&&this.model.enableTextSelection?(this._enableSelection(),this._longTouch=!0,n(".text_container").css("visibility",""),this._curXPos=t.originalEvent.changedTouches[0].clientX,this._curYPos=t.originalEvent.changedTouches[0].clientY,i=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),this._selectionStartPage=i,this._isPropertiesWindowOpen||i&&this.model.enableTextMarkupAnnotations&&this._contextClickPosition(t.originalEvent.changedTouches[0],i),this._isAnnotationSelected&&this._selectedAnnotation==this._currentAnnotationRectangle[0]||(r=this._getElementTouch(t.target,this._curXPos,this._curYPos,!0),i&&this._clearRectOnClick(i)),t.preventDefault()):this.model.enableTextSelection||this._disableSelection()},_onTextContainerTouchEnd:function(t){var ut,p,w,f,e,i,r,ft,b,tt,k,d,ot,g,h,a,nt;t.preventDefault();var o=[],v=t.target,y,pt=t.originalEvent.touches.length;if(this._timer&&this.model.enableTextSelection){this._enableSelection();ut=n("a.popupnote");p=n("#"+this._id+"_popupinnercontent");document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1;v==p[0]?p.focus():p.blur();v.id!=this._id+"highlight-menu"&&v!=ut[0]&&v!=p[0]&&(this._isPropertiesWindowOpen||(w=document.getElementById(this._id+"highlight-menu"),n(w).hide(),this._isContextMenuPresent=!1,r=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),r&&this.model.enableTextMarkupAnnotations&&this._contextClickPosition(t.originalEvent.changedTouches[0],r),this._currentAnnotationRectangleBackup.length!=0&&this._isAnnotationSelected&&this._selectedAnnotation==this._currentAnnotationRectangleBackup[0]&&(window.getSelection().removeAllRanges(),i=document.getElementById(this._id+"touchcustom-menu"),n(i).hide(),this._waterDropletDivHide()),this._longTouch&&this._isAnnotationSelected&&this._currentAnnotationRectangleBackup.length!=0&&this._selectedAnnotation==this._currentAnnotationRectangleBackup[0]&&(this.model.enableTextMarkupAnnotations&&(f=this._currentAnnotationRectangleBackup[0],e=f.TextMarkupAnnotationType?f.TextMarkupAnnotationType:f.type,e=="StrikeOut"&&this.model.enableStrikethroughAnnotation?this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w):e=="Highlight"&&this.model.enableHighlightAnnotation?this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w):e=="Underline"&&this.model.enableUnderlineAnnotation&&this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w)),this._longTouch=!1),this._isContextMenuPresent||(r=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),r&&this.model.enableTextMarkupAnnotations&&(this._clearRectOnClick(r),ft=document.getElementById(this._id+"_secondarycanvas_"+r),this._onCanvasMousedown(ft,t.originalEvent.changedTouches[0].pageX,t.originalEvent.changedTouches[0].pageY),this._contextClickPosition(t.originalEvent.changedTouches[0],r)),window.getSelection().toString()||this._currentAnnotationRectangle.length!=0&&(f=this._currentAnnotationRectangle[0],e=f.TextMarkupAnnotationType?f.TextMarkupAnnotationType:f.type,e=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle)):e=="Highlight"&&this.model.enableHighlightAnnotation?(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle)):e=="Underline"&&this.model.enableUnderlineAnnotation&&(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle))))));clearTimeout(this._timer);this._lockTimer=!1;var i=document.getElementById(this._id+"touchcustom-menu"),wt=t.originalEvent.changedTouches[0].clientX,bt=t.originalEvent.changedTouches[0].clientY,u=window.getSelection();if(u.anchorNode){y=u.getRangeAt(0);var et=y.cloneContents(),s=et.childNodes,ct=y.startContainer.parentElement.className;if(et.childElementCount!=0||this._longTouch){if(s.length>0)if(s[0].className=="e-waitingpopup e-js")for(b=0;b<s.length;b++)for(tt=n(s[b]).find(".text_container").children(),k=0;k<tt.length;k++)o.push(tt[k].id);else for(d=0;d<s.length;d++)ot=s[d].id,o.push(ot)}else ct=="e-pdfviewer-textLayer"?o.push(y.startContainer.parentElement.id):o.push(y.startContainer.id);for(g=0;g<o.length;g++)if(v.id==o[g]){this._touchcontextMenu=!0;break}else this._touchcontextMenu=!1}else this._touchcontextMenu=!1;if(this._rangePosition&&this._longTouch){n(".text_container").css("visibility","");var lt=n(i).outerHeight(),at=n(i).outerWidth(),it=this._rangePosition.width/2,vt=window.getSelection().toString();this._ranges||this._touchcontextMenu||t.target.id==this._id+"droplet1"||t.target.id==this._id+"droplet2"?(t.target.id==this._id+"droplet1"||t.target.id==this._id+"droplet2"?(n(i).show(),h=this._setTouchContextMenu(t),n(i).show(),n(i).offset({top:h.y,left:h.x}).show(),this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation())):this._annotationActive||(n(i).show(),n(i).offset({top:this._rangePosition.top-lt+window.scrollY,left:this._rangePosition.left+it-at/2})),this._ranges=!1,n(".text_container").css("visibility","")):n(t.target).hasClass("copy")||n(t.target).hasClass("googleSearch")?n(i).hide():(n(i).hide(),this._waterDropletDivHide());this._longTouch=!1}else n(i).hide(),this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation());if(this._annotationActive){if(this._touchcontextMenu){var u=window.getSelection(),c=document.createRange(),st=u.anchorNode.compareDocumentPosition(u.focusNode),ht=!1;(!st&&u.anchorOffset>u.focusOffset||st===Node.DOCUMENT_POSITION_PRECEDING)&&(ht=!0);ht?(c.setStart(u.focusNode,u.focusOffset),c.setEnd(u.anchorNode,u.anchorOffset)):(c.setStart(u.anchorNode,u.anchorOffset),c.setEnd(u.focusNode,u.focusOffset));var lt=n(i).outerHeight(),at=n(i).outerWidth(),yt=c.getBoundingClientRect(),l=c.getClientRects(),rt=l.length-1,kt=yt.width/2,a=document.getElementById(this._id+"droplet1"),nt=document.getElementById(this._id+"droplet2"),it=n(a).outerWidth(),dt=n(a).outerHeight(),vt=window.getSelection().toString();vt!=""&&(h=this._setTouchContextMenu(t),n(a).show(),n(a).offset({top:l[0].top+window.scrollY,left:l[0].left-it}).show(),n(nt).show(),n(nt).offset({top:l[rt].top+window.scrollY,left:l[rt].left+l[rt].width-it}).show(),n(i).show(),n(i).offset({top:h.y,left:h.x}).show());t.preventDefault()}}else n(i).css("display")!="none"||t.target.id==this._id+"droplet2"||t.target.id==this._id+"droplet1"||t.target.className=="copy"||t.target.className=="googleSearch"||n("#"+this._id+"custom-menu").css("display")!="none"||this._touched||this._touchcontextMenu||(this._clearSelector(),this._clearText=!0);this._clearText&&(n(i).hide(),this._waterDropletDivHide(),this._clearText=!1)}else this.model.enableTextSelection||(a=document.getElementById(this._id+"droplet1"),nt=document.getElementById(this._id+"droplet2"),n(a).hide(),n(nt).hide(),this._disableSelection())},_onTextContainerMouseDown:function(t){var i,r;t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection?this.model.enableTextSelection||this._disableSelection():(this._enableSelection(),n(".text_container").css("visibility",""),i=t.target,this._waterDropletDivHide(),n("#"+this._id+"touchcustom-menu").hide(),this._curYPos=t.clientY,this._curXPos=t.clientX,n(t.target).hasClass("text_container")||n(t.target).hasClass("e-pdfviewer-viewercontainer")||t.which==3||(this._curDown=!0,r=t.target.id.split("text_")[1],r&&(this._selectedValue=r.split("_")[0]),this._selectionStartPage=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1])),n("#"+this._id+"custom-menu").css("display")!="none"||t.which==3||n(i).hasClass("e-pdfviewer-secondarycanvas")||this._clearSelector(),n("#"+this._id+"_viewerContainer").focus(),n(i).hasClass("e-pdfviewer-formFields")||n(i).hasClass("e-pdfviewer-ListBox")||this._isFormFields||n(i).hasClass("e-dropdownSelect")||t.preventDefault())},_onTextContainerclick:function(t){this._waterDropletDivHide();var i=t.target;t.originalEvent.detail==2&&n(i).hasClass("e-pdfviewer-textLayer")&&this.model.enableTextSelection&&(t.preventDefault(),this._enableSelection(),this._getElementTouch(i,t.clientX,t.clientY,!1),this._annotationActive&&!this._isAnnotationSelected&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation()),this._isAnnotationSelected&&(this._showPopupMenu(t),this._clearSelector(t)),t.preventDefault());t.originalEvent.detail==3&&n(i).hasClass("e-pdfviewer-textLayer")&&this.model.enableTextSelection?(this._enableSelection(),this._annotationActive||this._selectingEntireLine(t)):this.model.enableTextSelection||this._disableSelection()},_onTextContainerMouseMove:function(t){var i,e,r,u,o,s,h,f,c,l;t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection||(t.preventDefault(),this._enableSelection(),this._currentAnnotationRectangle=[],i=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1]),i&&!this._isPropertiesWindowOpen&&(e=document.getElementById(this._id+"_secondarycanvas_"+i),this._onCanvasMousedown(e,t.pageX,t.pageY),this.model.enableTextMarkupAnnotations&&(this._isPopupNoteVisible||this._isContextMenuPresent||(this._contextClickPosition(t,i),this._currentAnnotationRectangle.length!=0?(r=this._currentAnnotationRectangle[0],u=r.TextMarkupAnnotationType?r.TextMarkupAnnotationType:r.type,u=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):u=="Underline"&&this.model.enableUnderlineAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):u=="Highlight"&&this.model.enableHighlightAnnotation&&(this._showPopupNote(t),t.target.style.cursor="pointer")):(n("#"+this._id+"_popup_note").css({display:"none"}),t.target.style.cursor="auto")))),n(".text_container").css("visibility",""),h=t.target,f=t.target.id.split("text_")[1],f&&(c=f.split("_")[0],this._isTextSelection=c==this._selectedValue?!0:!1),window.getSelection().toString()?this._selectionPages.indexOf(i)==-1&&i&&i!=0&&this._selectionPages.push(i):this._selectionPages=[],this.pageY=t.pageY,this._curDown==!0&&n("#"+this._id+"custom-menu").css("display")=="none"&&(o=t.clientY,s=t.clientX,(this._currentAnnotationRectangle.length==0||this._annotationActive&&this._isTextSelection)&&(l=this._getWordAtPoint(h,s,o)),t.preventDefault()))},_onTextContainerMouseLeave:function(t){var r,i,u;if(t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection)this.model.enableTextSelection||this._disableSelection();else if(this._enableSelection(),this._curDown==!0){r=this;t.preventDefault();i=n("#"+this._id+"_viewerContainer");u=n(i).offset().top;this._scrollMove=t.clientY>u?setInterval(function(){n(i).animate({scrollTop:n(i).scrollTop()+200},"fast")},500):setInterval(function(){n(i).animate({scrollTop:n(i).scrollTop()-200},"fast")},500);n(window).on("mouseup",function(n){return this._curDown=!1,r._onMouseClickedOutside(n),n.preventDefault(),n.stopPropagation(),!1})}},_onTextContainerMouseEnter:function(n){n.target.id==this._id+"_popupinnercontent"||n.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection?this.model.enableTextSelection||this._disableSelection():(this._enableSelection(),this._scrollMove&&clearInterval(this._scrollMove))},_onMouseClickedOutside:function(n){this._curDown=!1;this._scrollMove&&clearInterval(this._scrollMove);n.preventDefault();n.stopPropagation()},_onTextContainerDragStart:function(n){n.preventDefault()},_clearSelector:function(){window.getSelection&&(window.getSelection().removeAllRanges?window.getSelection().removeAllRanges():document.selection&&document.selection.empty())},_createContextMenu:function(){var i=document.createElement("div"),r=n("#"+this._id+"_pageviewContainer"),t,u;i.id=this._id+"custom-menu";i.className="e-pdfviewer-custom-menu";r.append(i);t=document.createElement("ol");t.className="orderedList";i.appendChild(t);u=window.getSelection().toString();n(t).append("<li><a href='javascript:void(0);' class='copy'>Copy<\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' class='googleSearch'>Search Google For <\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' id = '"+this._id+"_highlight_contextmenu' class='e-highlight-text'>Highlight Text <\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' id = '"+this._id+"_strikeout_contextmenu' class='e-strikeout-text'>Strikethrough Text <\/a><\/li>")},_createTouchContextMenu:function(){var t=document.createElement("div"),i=n("#"+this._id+"_pageviewContainer"),r;t.id=this._id+"touchcustom-menu";t.className="e-pdfviewer-touchcustom-menu";i.append(t);r=window.getSelection().toString();n(t).append("<div class='e-pdfviewer-touchCopy'><a href='javascript:void(0);' class='copy'>Copy<\/a><\/div>");n(t).append("<div class='e-pdfviewer-touchDot'><a href='javascript:void(0);' class='googleSearch'>Search<\/a><\/div>")},_onTextKeyboardCopy:function(n){n.ctrlKey&&n.keyCode==67&&(n.preventDefault(),this._isCopyRestrict||this._copySelectedText(n))},_copySelectedText:function(t){var e,c,f,i;if(!this._isCopyRestrict&&this._searchedText&&this._searchedText.length>0&&this._searchedText!=""&&this.model.enableTextSelection){if(this._enableSelection(),window.clipboardData&&window.clipboardData.setData)return f=clipboardData.setData("Text",this._searchedText),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),f;i=document.createElement("textarea");n(i).css("contenteditable","true");i.textContent=this._searchedText;i.style.position="fixed";document.body.appendChild(i);i.select();try{return document.execCommand("copy")}catch(o){console.warn("Copy to clipboard failed.",o)}finally{i&&document.body.removeChild(i);n("#"+this._id+"custom-menu").hide()}t.preventDefault()}else if(!this._isCopyRestrict&&this.model.enableTextSelection){if(this._enableSelection(),e=window.getSelection().getRangeAt(0).toString(),c=navigator.userAgent.indexOf("Firefox")>-1,window.clipboardData&&window.clipboardData.setData)return f=clipboardData.setData("Text",e),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),f;if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var r=window.getSelection(),u=document.createRange(),s=r.anchorNode.compareDocumentPosition(r.focusNode),h=!1;(!s&&r.anchorOffset>r.focusOffset||s===Node.DOCUMENT_POSITION_PRECEDING)&&(h=!0);h?(u.setStart(r.focusNode,r.focusOffset),u.setEnd(r.anchorNode,r.anchorOffset)):(u.setStart(r.anchorNode,r.anchorOffset),u.setEnd(r.focusNode,r.focusOffset));i=document.createElement("textarea");n(i).css("contenteditable","true");i.textContent=e;i.style.position="fixed";document.body.appendChild(i);i.select();r.removeAllRanges();r.addRange(u)}try{return document.execCommand("copy")}catch(o){console.warn("Copy to clipboard failed.",o)}finally{document.body.removeChild(i);n("#"+this._id+"custom-menu").hide()}t.preventDefault()}},_openInNewTab:function(){var t,i,r;t=this._searchedText&&this._searchedText.length>0&&this._searchedText!=""?this._searchedText:window.getSelection().toString();i="http://www.google.com/search?q="+t;r=window.open(i,"_blank");r.focus();n("#"+this._id+"custom-menu").hide()},_waterDropletDivHide:function(){n(document.getElementById(this._id+"droplet1")).hide();n(document.getElementById(this._id+"droplet2")).hide()},_getWordAtPoint:function(n,t,i){var o,u,s,f,h,c,e,r;if(!this._isPopupNoteFocused){if(n.nodeType==n.TEXT_NODE)for(o=!1,this._isBackwardSelection=!1,r=n.ownerDocument.createRange(),u=window.getSelection(),u.anchorNode!=null&&(s=u.anchorNode.compareDocumentPosition(u.focusNode),(!s&&u.anchorOffset>u.focusOffset||s===Node.DOCUMENT_POSITION_PRECEDING)&&(o=!0,this._isBackwardSelection=!0)),r.selectNodeContents(n),f=0,h=r.endOffset;f<h;){if(r.setStart(n,f),r.setEnd(n,f+1),r.getBoundingClientRect().left<=t&&r.getBoundingClientRect().right>=t&&r.getBoundingClientRect().top<=i&&r.getBoundingClientRect().bottom>=i)return c=r.toString(),u.anchorNode!=null&&u.anchorNode.parentNode.className=="e-pdfviewer-textLayer"&&r.setStart(u.anchorNode,u.anchorOffset),u.removeAllRanges(),u.addRange(r),o?u.extend(n,f):u.extend(n,f+1),r.detach(),this._isTextSelection=!0,c;f+=1}else for(e=0;e<n.childNodes.length;e++){if(r=n.childNodes[e].ownerDocument.createRange(),r.selectNodeContents(n.childNodes[e]),r.getBoundingClientRect().left<=t&&r.getBoundingClientRect().right>=t&&r.getBoundingClientRect().top<=i&&r.getBoundingClientRect().bottom>=i)return r.detach(),this._isTextSelection=!0,this._getWordAtPoint(n.childNodes[e],t,i);r.detach()}return this._isTextSelection=!1,null}},_getElementTouch:function(t,i,r,u){var y,h,l,o,a,s,f;if(t.nodeType==t.TEXT_NODE)for(y=window.getSelection(),f=t.ownerDocument.createRange(),f.selectNodeContents(t),h=0,l=f.endOffset;h<l;){if(f.setStart(t,h),f.setEnd(t,h+1),f.getBoundingClientRect().left<=i&&f.getBoundingClientRect().right>=i&&f.getBoundingClientRect().top<=r&&f.getBoundingClientRect().bottom>=r){var d=f.toString(),p=t.textContent,e=[],c,l;for(s=0;s<p.length;s++)p[s]==" "&&e.push(s);for(o=0;o<e.length;o++){if(h==e[o]&&(c=e[o],l=e[o]),e[0]>h){c=0;l=e[o];break}h>e[o]&&h<e[o+1]?(c=e[o],l=e[o+1]):h>e[o]&&(e[o+1]||(c=e[o]))}if(this.startelem=c,this.endelem=l,c==0?f.setStart(t,c):f.setStart(t,c+1),f.setEnd(t,l),y.removeAllRanges(),y.addRange(f),u){a=f.getBoundingClientRect();this._rangePosition=a;this._ranges=!0;this._selectedRanges=f;var v=document.getElementById(this._id+"droplet1"),w=document.getElementById(this._id+"droplet2"),b=n(v).width(),k=n(v).height();n(v).show();n(v).offset({top:a.top+window.scrollY+k/2,left:a.left-b}).show();n(w).show();n(w).offset({top:a.top+window.scrollY+k/2,left:a.left+a.width-b}).show()}return f.detach(),d}h+=1}else for(s=0;s<t.childNodes.length;s++){if(f=t.childNodes[s].ownerDocument.createRange(),f.selectNodeContents(t.childNodes[s]),f.getBoundingClientRect().left<=i&&f.getBoundingClientRect().right>=i&&f.getBoundingClientRect().top<=r&&f.getBoundingClientRect().bottom>=r)return f.detach(),this._getElementTouch(t.childNodes[s],i,r,u);f.detach()}return null},_toolbarClick:function(t){var e=t.target,i=t.target,u,f,r;if(this._isToolbarClick)if(n("#"+this._id+"_rptTooltip").css("display","none"),n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")||n(i).hasClass("e-pdfviewer-toolbar-underline")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")||n(i).hasClass("e-pdfviewer-dropdown-wrapper")||n(i).hasClass("e-pdfviewer-dropdown-arrow")||(this._selectionNodes=window.getSelection(),this._maintainSelection(),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1),(n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")||n(i).hasClass("e-pdfviewer-toolbar-underline")||n(i).hasClass("e-pdfviewer-toolbar-strikeout"))&&(document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1),this._displaySearch=!1,this._isDefaultColorSet=!1,n(i).hasClass("e-pdfviewer-toolbarli")&&(i=n(i).find("span")),n(i).hasClass("e-pdfviewer-print"))this._isPrintRestrict||this._print();else if(n(i).hasClass("e-pdfviewer-download"))this._isAsynchronousDownload=!0,this._saveFormFieldsValue();else if(n(i).hasClass("e-pdfviewer-gotofirst")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoFirstPage();else if(n(i).hasClass("e-pdfviewer-gotolast")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoLastPage();else if(n(i).hasClass("e-pdfviewer-gotonext")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoNextPage();else if(n(i).hasClass("e-pdfviewer-gotoprevious")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoPreviousPage();else if(n(i).hasClass("e-pdfviewer-zoomin"))this._applyLowerZoomIndex(),this._zoomIn();else if(n(i).hasClass("e-pdfviewer-zoomout"))this._applyHigherZoomIndex(),this._zoomOut();else if(n(i).hasClass("e-pdfviewer-fitpage")||n(i).hasClass("e-pdfviewer-fitwidth")){u=i;f=n(u).attr("id");switch(f){case this._id+"_fitWidth":this._applyFitToWidth();break;case this._id+"_fitPage":this._applyFitToPage()}}else n(i).hasClass("e-pdfviewer-find")?this._displaySearchBox():n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")?this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color),this._isDefaultColorSet=!0,this._initHighlight()):n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-underline")?this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color),this._isDefaultColorSet=!0,this._initUnderline()):n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")?this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color),this._isDefaultColorSet=!0,this._initStrikeOut()):(n(i).hasClass("e-pdfviewer-dropdown-wrapper")||n(i).hasClass("e-pdfviewer-dropdown-arrow"))&&(r=n(i).parents(".e-pdfviewer-toolbarli"),r.hasClass("e-pdfviewer-toolbar-underline")?this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&(this._displayColorPicker("Underline"),this._setPickerPosition(r[0]),this._isUnderlineEnabled=!1,this._initUnderline()):r.hasClass("e-pdfviewer-toolbar-highlight")?this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation&&(this._displayColorPicker("Highlight"),this._setPickerPosition(r[0]),this._isHighlightEnabled=!1,this._initHighlight()):r.hasClass("e-pdfviewer-toolbar-strikeout")&&this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation&&(this._displayColorPicker("StrikeOut"),this._setPickerPosition(r[0]),this._isStrikeOutEnabled=!1,this._initStrikeOut()))},_save:function(n){var i=this.fileName.indexOf("\\")==-1?this.fileName:this.fileName.replace(/^.*[\\\/]/,"");var t=navigator.userAgent,r=this._base64toBlob(n.DocumentStream,"application/pdf",512);t.indexOf("Edge")==-1?t.indexOf("Firefox")!=-1||t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("AppleWebKit")!=-1?this._download(r,"",i):window.navigator.msSaveOrOpenBlob(r,i):window.navigator.msSaveOrOpenBlob(r,i)},_base64toBlob:function(n,t,i){var e,o,r,f,s,u,h;for(t=t||"",i=i||512,e=atob(n),o=[],r=0;r<e.length;r+=i){for(f=e.slice(r,r+i),s=new Array(f.length),u=0;u<f.length;u++)s[u]=f.charCodeAt(u);h=new Uint8Array(s);o.push(h)}return new Blob(o,{type:t})},_createBlob:function(n,t){if(typeof Blob!="undefined")return new Blob([n],{type:t});warn('The "Blob" constructor is not supported.')},_download:function(n,t,i){var u=URL.createObjectURL(n),r=document.createElement("a"),f;r.click?(r.href=u,r.target="_parent","download"in r&&(r.download=i),(document.body||document.documentElement).appendChild(r),r.click(),r.parentNode.removeChild(r)):(window.top===window&&u.split("#")[0]===window.location.href.split("#")[0]&&(f=u.indexOf("?")===-1?"?":"&",u=u.replace(/#|$/,f+"$&")),window.open(u,"_parent"))},_showToolbar:function(t){t?(n("#"+this._id+"_toolbarContainer").css("display","block"),this._setSearchToolbarTop(),this._isToolbarHidden=!1):(n("#"+this._id+"_toolbarContainer").css("display","none"),this._isFindboxPresent&&this._displaySearchBox(),this._isToolbarHidden=!0)},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(0);t.disable();n("#"+this._id+"_txtpageNo").attr("disabled","disabled");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast")}},_enableToolbarItems:function(){this._isToolbarClick=!0;this.model.toolbarSettings.templateId||this._isDevice||(n("#"+this._id+"_txtpageNo").removeAttr("disabled"),n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable())},_showIconToolTip:function(t){n("#"+this._id+"_rptTooltip").css("display")=="none"&&this._showTooltipContent(t)},_hideIconToolTip:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_viewpopupBlockNone:function(n){return n.css("display")=="block"?!1:!0},_showTooltipContent:function(t){var i=t.target,r,u,l,f,o,a,v,y,p,w,b,k,d,g,ft,s,h,nt,tt,it,rt,ut,c,e,et;if(this.model.toolbarSettings.showTooltip&&!this._isDevice){if(l=!0,n(i).hasClass("e-pdfviewer-toolbarli")&&(i=n(i).find("span")),f=n(i).prev(),n(i).hasClass("e-pdfviewer-print")&&(o=n("#"+this._id+"_toolbarContainer .e-pdfviewer-print")[0],r=o?o.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-print")[0].getBoundingClientRect(),u=this._getTootipText("print")),n(i).hasClass("e-pdfviewer-download"))o=n("#"+this._id+"_toolbarContainer .e-pdfviewer-download")[0],r=o?o.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-download")[0].getBoundingClientRect(),u=this._getTootipText("download");else if(n(i).hasClass("e-pdfviewer-gotofirst")||n(f).hasClass("e-pdfviewer-gotofirst"))a=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotofirst")[0],r=a?a.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotofirst")[0].getBoundingClientRect(),u=this._getTootipText("first");else if(n(i).hasClass("e-pdfviewer-gotolast")||n(f).hasClass("e-pdfviewer-gotolast"))v=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotolast")[0],r=v?v.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotolast")[0].getBoundingClientRect(),u=this._getTootipText("last");else if(n(i).hasClass("e-pdfviewer-gotonext")||n(f).hasClass("e-pdfviewer-gotonext"))y=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotonext")[0],r=y?y.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotonext")[0].getBoundingClientRect(),u=this._getTootipText("next");else if(n(i).hasClass("e-pdfviewer-gotoprevious")||n(f).hasClass("e-pdfviewer-gotoprevious"))p=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotoprevious")[0],r=p?p.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotoprevious")[0].getBoundingClientRect(),u=this._getTootipText("previous");else if(n(i).hasClass("e-pdfviewer-zoomin")||n(f).hasClass("e-pdfviewer-zoomin"))w=n("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomin")[0],r=w?w.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-zoomin")[0].getBoundingClientRect(),u=this._getTootipText("zoomin");else if(n(i).hasClass("e-pdfviewer-zoomout")||n(f).hasClass("e-pdfviewer-zoomout"))b=n("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomout")[0],r=b?b.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-zoomout")[0].getBoundingClientRect(),u=this._getTootipText("zoomout");else if(n(i).hasClass("e-pdfviewer-tbpage")||n(i).hasClass("e-pdfviewer-pagenumber")||n(i).hasClass("e-pdfviewer-labelpageno"))k=n("#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage")[0],r=k?k.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-tbpage")[0].getBoundingClientRect(),u=this._getTootipText("pageIndex");else if(n(i).hasClass("e-pdfviewer-ejdropdownlist")||n(i).hasClass("e-dropdownlist")||n(i).hasClass("e-select")||n(i).hasClass("e-down-arrow"))d=n("#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist")[0],r=d?d.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-ejdropdownlist")[0].getBoundingClientRect(),u=this._getTootipText("zoom"),l=this._viewpopupBlockNone(n("#"+this._id+"_toolbar_zoomSelection_popup_list_wrapper"));else if(n(i).hasClass("e-pdfviewer-fitwidth")||n(i).hasClass("e-pdfviewer-fitpage")||n(f).hasClass("e-pdfviewer-fitwidth")||n(f).hasClass("e-pdfviewer-fitpage")){g=i;ft=n(g).attr("id");switch(ft){case this._id+"_fitWidth":s=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0];r=s?s.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitwidth")[0].getBoundingClientRect();u=this._getTootipText("fittoWidth");break;case this._id+"_fitPage":h=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0];r=h?h.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitpage")[0].getBoundingClientRect();u=this._getTootipText("fittopage");break;default:nt=n(g).prev();n(nt).hasClass("e-pdfviewer-fitwidth")?(s=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0],r=s?s.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitwidth")[0].getBoundingClientRect(),u=this._getTootipText("fittoWidth")):n(nt).hasClass("e-pdfviewer-fitpage")&&(h=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0],r=h?h.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitpage")[0].getBoundingClientRect(),u=this._getTootipText("fittopage"))}}else n(i).hasClass("e-pdfviewer-find")?this._isFindboxPresent||(tt=n("#"+this._id+"_toolbarContainer .e-pdfviewer-find")[0],r=tt?tt.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-find")[0].getBoundingClientRect(),u=this._getTootipText("search")):n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")?(it=n("#"+this._id+"_toolbarContainer .e-pdfviewer-highlight-markup")[0],r=it?it.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-highlight-markup")[0].getBoundingClientRect(),u=this._getTootipText("highlight")):n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")?(rt=n("#"+this._id+"_toolbarContainer .e-pdfviewer-strikeout-markup")[0],r=rt?rt.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-strikeout-markup")[0].getBoundingClientRect(),u=this._getTootipText("strikeout")):(n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-underline"))&&(ut=n("#"+this._id+"_toolbarContainer .e-pdfviewer-underline-markup")[0],r=ut?ut.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-underline-markup")[0].getBoundingClientRect(),u=this._getTootipText("underline"));u&&l&&(c=this._viewerMaxZindex(),n("#"+this._id+"_rptTooltip_Header").html(u.header),n("#"+this._id+"_rptTooltip_Content").html(u.content),e=document.getElementById(this._id+"_toolbarContainer").getBoundingClientRect(),et=this.element[0].clientWidth,et<r.left+2*r.width?u.header=="Zoom"?n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:r.top-e.top-21,left:r.left-e.left-2*r.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:r.top-e.top-21,left:r.left-e.left-3*r.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:r.top-e.top-21,left:r.left-e.left+r.width/2,display:"block",position:"absolute"}))}},_viewerMaxZindex:function(){var u=this.element.parents(),i,r,t;return i=n("body").children(),index=i.index(this.popup),i.splice(index,1),n(i).each(function(n,t){u.push(t)}),r=n(this.model.target).children(),cindex=r.index(this.popup),r.splice(cindex,1),n(r).each(function(n,t){u.push(t)}),t=Math.max.apply(t,n.map(u,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_getTootipText:function(n){var i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],r="",u="";switch(n){case"print":r=i.toolbar.print.headerText;u=i.toolbar.print.contentText;break;case"download":r=i.toolbar.download.headerText;u=i.toolbar.download.contentText;break;case"first":r=i.toolbar.first.headerText;u=i.toolbar.first.contentText;break;case"previous":r=i.toolbar.previous.headerText;u=i.toolbar.previous.contentText;break;case"next":r=i.toolbar.next.headerText;u=i.toolbar.next.contentText;break;case"last":r=i.toolbar.last.headerText;u=i.toolbar.last.contentText;break;case"zoomin":r=i.toolbar.zoomIn.headerText;u=i.toolbar.zoomIn.contentText;break;case"zoomout":r=i.toolbar.zoomOut.headerText;u=i.toolbar.zoomOut.contentText;break;case"pageIndex":r=i.toolbar.pageIndex.headerText;u=i.toolbar.pageIndex.contentText;break;case"zoom":r=i.toolbar.zoom.headerText;u=i.toolbar.zoom.contentText;break;case"fittoWidth":r=i.toolbar.fitToWidth.headerText;u=i.toolbar.fitToWidth.contentText;break;case"fittopage":r=i.toolbar.fitToPage.headerText;u=i.toolbar.fitToPage.contentText;break;case"search":r=i.toolbar.search.headerText;u=i.toolbar.search.contentText;break;case"highlight":r=i.toolbar.highlight.headerText;u=i.toolbar.highlight.contentText;break;case"strikeout":r=i.toolbar.strikeout.headerText;u=i.toolbar.strikeout.contentText;break;case"underline":r=i.toolbar.underline.headerText;u=i.toolbar.underline.contentText}return{header:r,content:u}},_setInitialization:function(){this._canvascount=0;this._fileName="";this._isToolbarClick=!1;this._pageModel=null;this._currentPage=1;this._zoomLevel=2;this._pageImageStream=null;this._pageWidth;this._pageHeight;this._pageLocation=[];this._scrollTriggered=!1;this._previousPage=1;this._totalPages;this._previousPosition;this._cummulativeHeight;this._backgroundPage=1;this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._searchMatches=[];this._pagePrinted=!1;this._printingPage=1;this._printingTimer;this._previousZoom=1;this._renderPreviousPage=!1;this._pageSize;this._eventpreviouszoomvalue;this._eventzoomvalue;this._pdfFileName;this._zoomArray=[];this._rerenderCanvasList=[];this._ajaxRequestState=null},_showViewerBlock:function(t){if(t){n("#"+this._id+"_viewBlockContainer").css("display","block");var i=n("#"+this._id+"_viewBlockContainer .e-pdfviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else n("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&n("#"+this._id+"_viewBlockContainer.e-pdfviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){n("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t,appendTo:"#"+this._id+"_viewerContainer"});n("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showloadingIndicator:function(t){t?(n("#"+this._id+"_loadingIndicator").css("display","block"),n("#"+this._id+"_pageviewOuterContainer").css("display","none")):(n("#"+this._id+"_loadingIndicator").css("display","none"),n("#"+this._id+"_pageviewOuterContainer").css("display","block"));n("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t,appendTo:"#"+this._id+"_loadingIndicator"});n("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showPrintLoadingIndicator:function(t){n("#"+this._id+"e-pdf-viewer").css({position:"relative"});n("#"+this._id+"e-pdf-viewer").ejWaitingPopup({showOnInit:t,text:"Preparing document for printing...",cssClass:"e-pdfviewer-waitingpopup-print",appendTo:"#"+this._id+"e-pdf-viewer"})},_viewerResize:function(){var t=this,s=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,h=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,u=n(t.element).height(),r=n(t.element).width(),e,o,f;h.indexOf("%")!=-1?(t._isPercentHeight=parseInt(h),e=t._isHeight?n(t.element).parent().height():u,u=t._isHeight?e:e/100*t._isPercentHeight):t.element[0].parentElement.clientHeight!=0&&t._isPercentHeight!=-1?u=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&t.element[0].parentElement.clientHeight!=0&&(u=t.element[0].parentElement.clientHeight);t.element.height(u);s.indexOf("%")!=-1?(t._isPercentWidth=parseInt(s),o=t._isWidth?n(t.element).parent().width():r,r=t._isWidth?o:o/100*t._isPercentWidth):t.element[0].parentElement.clientWidth!=0&&t._isPercentWidth!=-1?r=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&t.element[0].parentElement.clientWidth!=0&&(r=t.element[0].parentElement.clientWidth);t.element.width(r);t._toolbar._activeItem=i;t._toolbar._reSizeHandler();r<=500?n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:r/2-307/2+"px",Y:u/2+"px"},width:"auto"}):n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:r/2-250+"px",Y:u/2+"px"},width:"500px"});n("#"+t._id+"_pdfviewer_searchul").removeClass("e-separator");n("#"+t._id+"_pdfviewer_downloadul").removeClass("e-separator");document.getElementById(t._id+"_pdfviewer_colorpicker").style.display="none";t._isToolbarColorPicker=!1;f=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_printul").parent()[0]!=f[0]&&(this._isDownloadCntlHidden||(f.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),this._isDownloadCntlHidden=!0));n("#"+this._id+"_pdfviewer_downloadul").parent()[0]!=f[0]&&this._isDownloadCntlHidden&&(this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._isDownloadCntlHidden=!1);t._toolbarResizeHandler();t._resizeSearchToolbar();t.model.isResponsive&&t._renderedCanvasList.length>0&&t._isAutoZoom&&t._applyFitToWidthAuto();t._fitType!="fitToWidth"||t.model.isResponsive||t._applyFitToWidth();t._isWindowResizing=!0;t._applyLeftPosition()},_applyLeftPosition:function(){for(var t,i,n=1;n<=this._totalPages;n++)t=this._fitType=="fitToWidth"||this._isAutoZoom&&this._zoomVal<1?5:this._pageSize[n-1].PageRotation==90||this._pageSize[n-1].PageRotation==270?(this.element.width()-this._pageSize[n-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[n-1].PageWidth*this._zoomVal)/2,t<0&&(t=5),i=document.getElementById(this._id+"pageDiv_"+n),i&&(i.style.left=t+"px")},_toolbarResizeHandler:function(){var t=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_searchul").parent()[0]!=t[0]&&(this._isZoomCntlHidden=!0,t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_searchul").css({float:"left"}),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_textmarkupul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_zoomul")[0]));n("#"+this._id+"_pdfviewer_zoomul").parent()[0]==t[0]&&this._isZoomCntlHidden&&(t.append(n("#"+this._id+"_pdfviewer_zoomul")[0]),t.append(n("#"+this._id+"_pdfviewer_textmarkupul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_searchul").css({float:"right"}),n("#"+this._id+"_pdfviewer_textmarkupul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),this._isZoomCntlHidden=!1)},_overflowToolbarClose:function(){document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1},_resizeSearchToolbar:function(){var t=document.getElementById(this._id+"_pdfviewer_searchbox"),r,e,f,o,u,i;t&&(r=n("#"+this._id+"_toolbarContainer .e-pdfviewer-find")[0],r||(r=n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-find")[0]),e=r.getBoundingClientRect(),f=document.getElementById("e-pdfviewer-arrow-responsive"),f&&document.head.removeChild(f),n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")?(o=document.getElementById(this._id+"_toolbarContainer"),t.style.left="0px",i=n("#"+this._id+"_pdfviewer_searchinput")[0],i.style.width="150px",t.style.width="400px"):(t.style.left=r.parentNode.parentNode.offsetLeft-r.parentNode.parentNode.parentNode.offsetLeft-2+"px",i=n("#"+this._id+"_pdfviewer_searchinput")[0],i.style.width="150px",t.style.width="400px"),u=document.getElementById(this._id+"e-pdf-viewer"),u.clientWidth<t.offsetLeft+t.clientWidth?(i=n("#"+this._id+"_pdfviewer_searchinput")[0],this._isZoomCntlHidden?(i.style.width=parseInt(i.style.width)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px",t.style.width=parseInt(t.style.width)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"):t.style.left=parseInt(t.style.left)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"):n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")&&(t.style.left=parseInt(t.style.left)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"),this._responsiveArrow(e,t))},_responsiveArrow:function(t,i){var r=document.createElement("Style"),f,u;r.id="e-pdfviewer-arrow-responsive";document.head.appendChild(r);style=r.sheet;!navigator.userAgent.match("Firefox")&&style?(f=i.getBoundingClientRect(),u=t.left-f.left,style.addRule(".e-pdfviewer-arrow::before","left:"+u+"px"),style.addRule(".e-pdfviewer-arrow::after","left:"+u+"px")):n("#"+this._id+"_pdfviewer_searchbox").removeClass("e-pdfviewer-arrow")},goToPage:function(n){this._gotoPageNo(n)},goToLastPage:function(){this._gotoLastPage()},goToFirstPage:function(){this._gotoFirstPage()},goToNextPage:function(){this._gotoNextPage()},goToPreviousPage:function(){this._gotoPreviousPage()},print:function(){this._print()},abortPrint:function(){this._printCancel()},showPrintTools:function(n){this._showPrintButton(n)},showDownloadTool:function(n){this._showDownloadButton(n)},showTextSearchTool:function(n){this._showTextSearchButton(n)},showPageNavigationTools:function(n){this._showPageNavigationControls(n)},showMagnificationTools:function(n){this._showZoomControl(n);this._showFittoPage(n)},showTextMarkupAnnotationTools:function(n){this._showTextMarkupButtons(n)},showToolbar:function(n){this._showToolbar(n)},unload:function(){this._unLoad()},load:function(r){var h,o,e,u,s,f;if(n("#"+this._id+"_viewerContainer").scrollTop(0),this._showloadingIndicator(!0),this.isDocumentEdited=!1,this._fitType=null,this.model.isResponsive=!0,this._isAutoZoom=!0,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_search"),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._isHighlightEnabled=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._annotationActive=!1,this._zoomVal=1,this._zoomLevel=3,this.fileName=null,this._fileName="",h=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o=h.contextMenu.auto.contentText,n("#"+this._id+"_toolbar_zoomSelection_hidden").val(o),this._ejDropDownInstance.model.value=o,this._initToolbar(),r)for(e=this._canvascount;e>=1;)n("#"+this._id+"pageDiv_"+e).remove(),e--;window.clearInterval(this._scrollTimer);u={};u.viewerAction="GetPageModel";u.controlId=this._id;u.pageindex="1";u.isInitialLoading="true";s=r.split("base64,")[1];s==i?(this._fileName=r,u.newFileName=this._fileName,this._fileId=this._createGUID(),u.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(u),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:u}),"_getPageModel")):(f=this.model.serviceUrl,u.uploadedFile=s,this._fileId=this._createGUID(),u.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?(f=this.model.serviceUrl+"/"+this.model.serverActionSettings.fileUpload,this._doAjaxPost("POST",f,JSON.stringify(u),"_getPageModel")):(f=f.replace(this.model.serverActionSettings.load,this.model.serverActionSettings.fileUpload),this._doAjaxPost("POST",f,JSON.stringify({jsonResult:u}),"_getPageModel")))},fitToPage:function(){this._applyFitToPage()},fitToWidth:function(){this._applyFitToWidth()},download:function(n){this._isAsynchronousDownload=typeof n=="boolean"?n:!0;this._saveFormFieldsValue()},zoomIn:function(){this._applyLowerZoomIndex();this._zoomIn()},zoomOut:function(){this._applyHigherZoomIndex();this._zoomOut()},zoomTo:function(i){i<50?i=50:i>400&&(i=400);var r=parseInt(i)/100,u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=u.contextMenu.auto.contentText;i==f?(r=1,this.model.isResponsive=!0):(i=i+"%",this.model.isResponsive=!1);this._calculateZoomLevel(r);this._zoomContainer(r,!1);n("#"+this._id+"_toolbar_zoomSelection_hidden").val(i);this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active");this._ejDropDownInstance.model.value=i},undo:function(){this._isPropertiesWindowOpen||this._undo()},redo:function(){this._isPropertiesWindowOpen||this._redo()},addAnnotation:function(n){n==t.PdfViewer.AnnotationType.Highlight?this._addAnnotation("Highlight"):n==t.PdfViewer.AnnotationType.Underline?this._addAnnotation("Underline"):n==t.PdfViewer.AnnotationType.Strikethrough&&this._addAnnotation("StrikeOut")}});t.PdfViewer.ToolbarItems={MagnificationTools:1,PageNavigationTools:2,PrintTools:4,DownloadTool:8,TextSearchTool:16,TextMarkupAnnotationTools:32,All:63};t.PdfViewer.PdfService={Local:1,Remote:2};t.PdfViewer.LinkTarget={Default:1,NewTab:2,NewWindow:4};t.PdfViewer.AnnotationType={Underline:1,Strikethrough:2,Highlight:4};t.PdfViewer.Locale=t.PdfViewer.Locale||{};t.PdfViewer.Locale["default"]=t.PdfViewer.Locale["en-US"]={toolbar:{print:{headerText:"Print",contentText:"Print the PDF document."},download:{headerText:"Download",contentText:"Download the PDF document."},first:{headerText:"First",contentText:"Go to the first page of the PDF document."},previous:{headerText:"Previous",contentText:"Go to the previous page of the PDF document."},next:{headerText:"Next",contentText:"Go to the next page of the PDF document."},last:{headerText:"Last",contentText:"Go to the last page of the PDF document."},zoomIn:{headerText:"Zoom-In",contentText:"Zoom in to the PDF document."},zoomOut:{headerText:"Zoom-Out",contentText:"Zoom out of the PDF document."},pageIndex:{headerText:"Page Number",contentText:"Current page number to view."},zoom:{headerText:"Zoom",contentText:"Zoom in or out on the PDF document."},fitToWidth:{headerText:"Fit to Width",contentText:"Fit the PDF page to the width of the container."},fitToPage:{headerText:"Fit to Page",contentText:"Fit the PDF page to the container."},search:{headerText:"Search Text",contentText:"Search text in the PDF pages."},highlight:{headerText:"Highlight Text",contentText:"Highlight text in the PDF pages."},strikeout:{headerText:"Strikethrough Text",contentText:"Strikethrough text in the PDF pages."},underline:{headerText:"Underline Text",contentText:"Underline text in the PDF pages."}},contextMenu:{copy:{contentText:"Copy"},googleSearch:{contentText:"Search google"},openPopup:{contentText:"Open Pop-Up Note"},Delete:{contentText:"Delete"},properties:{contentText:"Properties...."},Find:{contentText:"Find:"},matchCase:{contentText:"matchCase"},auto:{contentText:"Auto"}},propertyWindow:{underlineProperties:{contentText:"Underline Properties"},strikeOutProperties:{contentText:"StrikeOut Properties"},highlightProperties:{contentText:"Highlight Properties"},appearance:{contentText:"Appearance"},general:{contentText:"General"},color:{contentText:"Color:"},opacity:{contentText:"Opacity:"},author:{contentText:"Author:"},subject:{contentText:"Subject:"},modified:{contentText:"Modified:"},ok:{contentText:"OK"},cancel:{contentText:"Cancel"},locked:{contentText:"Locked"}}}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejGanttChart","ej.GanttChart",{element:null,model:null,_rootCSS:"e-ganttchart",keyConfigs:{focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",firstRowSelection:"36",lastRowSelection:"35",leftArrow:"37",rightArrow:"39",upArrow:"38",downArrow:"40",moveCellRight:"9",moveCellLeft:"shift+9",selectedRowExpand:"alt+40",totalRowExpand:"ctrl+40",selectedRowCollapse:"alt+38",totalRowCollapse:"ctrl+38"},defaults:{childPropertyName:"",taskIdMapping:"",taskNameMapping:"",startDateMapping:"",endDateMapping:"",childMapping:"",finishDateMapping:"",durationMapping:"",milestoneMapping:"",progressMapping:"",predecessorMapping:"",resourceInfoMapping:"",resourceNameMapping:"",resourceCollection:[],holidays:[{day:null,label:null,background:null}],stripLines:[{day:null,label:null,lineStyle:"dotted",lineColor:"#169dd7",lineWidth:2}],enableTaskbarTooltip:!0,enableTaskbarDragTooltip:!0,highlightWeekends:!0,scheduleStartDate:null,scheduleEndDate:null,enableProgressBarResizing:!0,rowHeight:30,progressbarHeight:100,connectorlineWidth:1,dateFormat:"MM/dd/yyyy",locale:"en-US",taskbarBackground:"#DE8080",progressbarBackground:"#C44647",weekendBackground:"#F2F2F2",connectorLineBackground:"#383838",parentTaskbarBackground:"#383838",parentProgressbarBackground:"#1C1C1C",selectedItem:null,selectedRowIndex:-1,perDayWidth:null,perMonthWidth:null,perWeekWidth:null,perHourWidth:null,queryTaskbarInfo:null,taskbarTemplate:"",progressbarTemplate:null,parenttaskbarTemplate:"",parentprogressbarTemplate:null,milestoneTemplate:"",flatRecords:[],updatedRecords:[],ids:[],currentViewData:[],scheduleWeeks:[],scheduleYears:[],scheduleMonths:[],scheduleDays:[],scheduleHours:[],projectStartDate:null,projectEndDate:null,tooltipTemplate:"",tooltipTemplateId:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",progressbarTooltipTemplate:"",showTaskNames:!0,leftTaskLabelMapping:"",rightTaskLabelMapping:"",LeftTaskLabelTemplate:"",rightTaskLabelTemplate:"",showProgressStatus:!0,showResourceNames:!0,enableRowHover:!1,includeWeekend:!1,allowZooming:!1,readOnly:!1,allowGanttChartEditing:!0,allowKeyboardNavigation:!0,renderBaseline:!1,baselineColor:"#fba41c ",editSettings:{allowEditing:!1,allowAdding:!1,allowDeleting:!1,editMode:"normal",dialogEditorTemplateId:null},scheduleHeaderSettings:{weekHeaderFormat:"MMM dd , yyyy",dayHeaderFormat:"",weekendBackground:"#F2F2F2",yearHeaderFormat:"yyyy",monthHeaderFormat:"MMM",hourHeaderFormat:"HH",minuteHeaderFormat:"mm",scheduleHeaderType:"week",weekStartDay:0},workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",localizedDays:null,localizedMonths:null,columnHeaderTexts:null,predecessorEditingTexts:null,enablePredecessorEditing:!0,taskbarClick:null},updateHighlightWeekends:function(n){var t=this;t.model.highlightWeekends=n;t.model.highlightWeekends==!0?t._renderWeekends():t._$weekendsContainer.remove()},updateWeekendBackground:function(n){var t=this;t.model.weekendBackground=n;t._$weekendsContainer.remove();t._renderWeekends()},showTooltip:function(n){var t=this;t.model.enableTaskbarTooltip=n;t._createTaskbarTemplate();t._refresh()},showEditingTooltip:function(n){var t=this;t.model.enableTaskbarDragTooltip=n;t._createTaskbarTemplate();t._refresh()},updateConnectorLineBackground:function(n){var t=this;t.model.connectorLineBackground=n;t._createConnectorLineTemplate()},updateConnectorlineWidth:function(n){var t=this;t.model.connectorlineWidth=parseInt(n);t._createConnectorLineTemplate()},updateEditedRecordEndDate:function(n){var t=this;t._currentEditedRecord.endDate=n},updateEditedRecordDuration:function(n){var t=this;t._currentEditedRecord.duration=n},updateTaskbarBackground:function(n){var t=this;t.model.taskbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateProgressbarBackground:function(n){this.model.progressbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateParentTaskbarBackground:function(n){this.model.parentTaskbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateParentProgressbarBackground:function(n){this.model.parentProgressbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateRenderTaskNames:function(n){var t=this;t.model.showTaskNames=n;t._createTaskbarTemplate();t._refresh()},refreshLeftTaskLabelMapping:function(n){var t=this;t.model.leftTaskLabelMapping=n;t._createTaskbarTemplate();t._refresh()},refreshRightTaskLabelMapping:function(n){var t=this;t.model.rightTaskLabelMapping=n;t._createTaskbarTemplate();t._refresh()},refreshLeftTaskLabelTemplate:function(n){var t=this;t.model.leftTaskLabelTemplate=n;t._createTaskbarTemplate();t._refresh()},refreshRightTaskLabelTemplate:function(n){var t=this;t.model.rightTaskLabelTemplate=n;t._createTaskbarTemplate();t._refresh()},updateRendeProgressStatus:function(n){var t=this;t.model.showProgressStatus=n;t._createTaskbarTemplate();t._refresh()},updateRenderResourceNames:function(n){var t=this;t.model.showResourceNames=n;t._createTaskbarTemplate();t._refresh()},changeMilestoneTemplate:function(n){var t=this;t.model.milestoneTemplate=n;t._createTaskbarTemplate();t._refresh()},changeTaskbarTemplate:function(n){var t=this;t.model.taskbarTemplate=n;t._createTaskbarTemplate();t._refresh()},changeParentTaskbarTemplate:function(n){var t=this;t.model.parentTaskbarTemplate=n;t._createTaskbarTemplate();t._refresh()},ganttChartEditing:function(n){var t=this;t.model.allowGanttChartEditing=n},updateReadOnly:function(n){var t=this;t.model.readOnly=n},resizeProgressbar:function(n){var t=this;t.model.enableProgressBarResizing=n},updateAllowKeyboardNavigation:function(n){this.model.allowKeyboardNavigation=n},updateProgressbarHeight:function(n){var t=this;this.model.progressbarHeight=n;t._createTaskbarTemplate();t._refresh()},updateBaselineColor:function(n){var t=this;this.model.baselineColor=n;t._createTaskbarTemplate();t._refresh()},updateRenderBaseline:function(n){var t=this;this.model.renderBaseline=n;t._createTaskbarTemplate();t._refresh();t._createConnectorLineTemplate()},focusGanttElement:function(){if(t.browserInfo().name=="msie")try{this.element[0].setActive()}catch(n){}else this.element[0].focus()},_getYearWidth:function(){for(var i=this,n=0,t=0,n=0;n<this.model.scheduleYears.length;n++)t+=this._getTemplateYearWidth(this.model.scheduleYears[n]);return t},_getMonthWidth:function(){for(var r,e,u,h,o=this,c=o.model,n,s=c.scheduleMonths,i=0,f=0;f<s.length;f++)r=s[f],n=typeof r=="object"?new Date(r):t.parseDate(r,this.model.dateFormat,this.model.locale),e=new Date(n.getFullYear(),n.getMonth()+1,0),u=e.getDate(),n.getTime()===o.model.scheduleMonths[0].getTime()?(h=e.getDate()-n.getDate(),i+=this.model.perDayWidth*(h+1)):u==31?i+=this.model.perDayWidth*31:u==30?i+=this.model.perDayWidth*30:u==28&&(i+=this.model.perDayWidth*28);return i},_getWeekWidth:function(){return this.model.perDayWidth*7},_getNumberOftWeeks:function(n,t){var i=new Date(n),u=new Date(t),r=[];do r.push(new Date(i)),i.setDate(i.getDate()+7);while(!(i>u));return r},_getHeight:function(){return this._containerHeight},_setHeight:function(n){this._containerHeight=n},getGanttChartRows:function(){return this._ganttChartRows},getUpdatedRecords:function(){return this.model.flatRecords},setUpdatedRecords:function(n,t,i,r){var u=this;u.model.currentViewData=n;u.model.updatedRecords=t;u.model.flatRecords=i;u.model.ids=r},_getFormatedDate:function(n,i,r){return t.format(n,i,r)},_getViewportHeight:function(){var n=this,t=n._$headerContainer;return n.element.height()-t.height()-parseFloat(t.css("border-bottom-width"))},updateViewPortHeight:function(){var n=this;n._viewportHeight=n._getViewportHeight()},_init:function(){var r=this,u=r.model,f=u.scheduleHeaderSettings.scheduleHeaderType,e,o;r.element.addClass("e-ganttchart-core");r.element.attr("tabindex","0");r._initPrivateProperties();r._initialize();r._renderGanttChart();r._$bodyContainerParent.append(r._$bodyContainer);r._$bodyContainer.append(r._$bodyContent);r._$ganttChartContainer.append(r._$bodyContainerParent);n(r._$bodyContainer).css({height:r._viewportHeight+"px"});r.model.enableVirtualization&&n(r._$bodyContent).css({height:u.rowHeight*u.updatedRecords.length+"px"});f=="week"?n(r._$bodyContent).css({width:u.scheduleWeeks.length*r._scheduleWeekWidth+"px"}):f=="year"?n(r._$bodyContent).css({width:r._scheduleYearWidth+"px"}):f=="month"?n(r._$bodyContent).css({width:r._scheduleMonthWidth+"px"}):f=="day"?n(r._$bodyContent).css({width:u.scheduleDays.length*u.perHourWidth*24+"px"}):f=="hour"&&n(r._$bodyContent).css({width:u.scheduleHours.length*u.perMinuteWidth*r._totalInterval+"px"});r.createGridLinesTable();r.renderGanttRecords();e=t.buildTag("div");e.append(r._$bodyContent);r._$bodyContainer.append(e);r._$bodyContainer.ejScroller({width:r.element.width()-1,enableTouchScroll:!1,height:r._getViewportHeight(),scroll:function(n){var t=n.scrollTop;n.requestType="scroll";n.delta=t;t!=i?r.onScrollHelper(t,!0)===!1&&(n.cancel=!0):r._handleScroll(n)}});r._$bodyContainer.ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""});r._$bodyContainer.ejScroller("refresh");o=r._$bodyContainer.ejScroller("isHScroll");o?r._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):r._$bodyContainer.find("div.e-content").addClass("e-borderbox");r._wireEvents()},reRenderGanttChart:function(t,i){var r=this,u=r.model,f=u.scheduleHeaderSettings.scheduleHeaderType;r._wireEvents();u.perDayWidth=t;u.flatRecords=i;r._scheduleWeekWidth=r._getWeekWidth();r._scheduleYearWidth=r._getYearWidth();r._scheduleMonthWidth=r._getMonthWidth();n(r._$headerContainer).empty();n(r._$scheduleDiv).empty();r._renderGanttChart();r._$bodyContainerParent.append(r._$bodyContainer);r._$bodyContainer.append(r._$bodyContent);r._$ganttChartContainer.append(r._$bodyContainerParent);f=="week"?n(r._$bodyContent).css({width:u.scheduleWeeks.length*r._scheduleWeekWidth+"px"}):f=="year"?n(r._$bodyContent).css({width:r._scheduleYearWidth+"px"}):f=="month"?n(r._$bodyContent).css({width:r._scheduleMonthWidth+"px"}):f=="day"?n(r._$bodyContent).css({width:u.scheduleDays.length*u.perHourWidth*24+"px"}):f=="hour"&&n(r._$bodyContent).css({width:u.scheduleHours.length*u.perMinuteWidth*r._totalInterval+"px"})},_initPrivateProperties:function(){var t=this;t._viewportHeight=0;t._prevScrollTop=0;t._scrollTop=0;t._vScrollDir=1;t._$ganttChartContainer=null;t._$headerContainer=null;t._$bodyContainer=null;t._$bodyContent=null;t._$dependencyViewContainer=null;t._$secondaryCanvas=null;t._$ganttViewTable=null;t._$ganttViewTablebody=null;t._weekdays=[];t._rowMargin=0;t._renderedRange=null;t._visibleRange=null;t._vTop=null;t._vBottom=null;t._rTop=null;t._rBottom=null;t._vscrollDist=0;t._containerHeight=0;t._id=this.element.attr("id");t._ganttChartRows=null;t._filteredRecords=[];t._sortedRecords=[];t._tempSortedRecords=[];t._scheduleHours=[];t._scheduleMinutes=[];t._updateScheduleWidth();t._totalMonthWidth=0;t._tempFilteredRecords=[];t._prevLeft=0;t._allowDragging=!1;t._leftResizing=!1;t._rightResizing=!1;t._progressResizing=!1;t._editingContainer=null;t._allowExpandCollapse=!0;t._leftResizer=null;t._taskbarItem=null;t._progressbarItem=null;t._progressResizer=null;t._rightResizer=null;t._manualRightResizer=null;t._tasknameContainer=null;t._mousePosX=0;t._currMousePosX=0;t._currMousePosY=0;t._prevItem={};t._parentCollectionPreviousValues=[];t._mouseTarget=null;t._mouseDown=!1;t._$scheduleDiv=null;t._leftResizerGripper=null;t._rightResizerGripper=null;t._progressHandle=null;t._progressHandleChild=null;t._currentEditedRecord={taskId:null,taskName:null,startDate:null,endDate:null,duration:null,isMilestone:!1,status:null,predecessor:null,resourceInfo:null,parentItem:null,isSelected:!1,childRecords:null,hasChildRecords:!1,expanded:!1,level:0,left:0,width:0,progressWidth:0,item:null,baselineLeft:0,baselineWidth:0,baselineStartDate:null,baselineEndDate:null,isReadOnly:!1,hasFilteredChildRecords:!0,serialNumber:null,taskbarBackground:null,progressbarBackground:null,parentProgressbarBackground:null,parentTaskbarBackground:null,cellBackgroundColor:null,rowBackgroundColor:null,treeMappingName:[],dragState:!0,isSelected:!1,durationUnit:""};t._mouseHoverTooltip=document.getElementById(this.model.tooltipTemplate);t._progressBarTooltipID=document.getElementById(this.model.progressbarTooltipTemplateId);t._taskbarEditingTooltipID=document.getElementById(this.model.taskbarEditingTooltipTemplateId);t._scrollBarHeight=18;t._windowWidth=n(window).width();t._windowHeight=n(window).height();t._editingItem=null;t._editingTarget=null;t.tooltipState=null;t._visibleRecordsCount=0;t._tooltipTimer;t._$gridLinesTablebody=null;t._leftConnectorPoint=null;t._rightConnectorPoint=null;t._childLeftConnectorPoint=null;t._childRightConnectorPoint=null;t._editPredecessor=!1;t._connectorPointX=null;t._connectorPointY=null;t._predecessorTooltip=null;t._totalCollapsedRecordCount=0;t._milesStoneWidth=0;t._connectorPointWidth=0;t._newXYPos=!0;t._posX1=null;t._posY1=null},_updateScheduleWidth:function(){var n=this;n._scheduleWeekWidth=n._getWeekWidth();n._numOfWeeks=n._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate);n._scheduleYearWidth=n._getYearWidth();n._scheduleMonthWidth=n._getMonthWidth();n._totalWeekWidth=n._scheduleWeekWidth*n._numOfWeeks.length;n._balanceWidth=n._totalWeekWidth-n._scheduleMonthWidth;n._scheduleMonthWidth+=n._balanceWidth},_initialize:function(){var n=this;n._$ganttChartContainer=t.buildTag("div.e-ganttviewercontainer#ganttviewercontainer"+n._id,"",{width:"100%"},{});n._$headerContainer=t.buildTag("div.e-ganttviewerheaderContainer#ganttviewerheaderContainer"+n._id,"",{"border-right-style":"solid","border-right-width":"1px"},{});n._$bodyContainer=t.buildTag("div.e-ganttviewerbodyContianer#ganttviewerbodyContianer"+n._id,"",{"-ms-touch-action":"none"},{});n._$bodyContainerParent=t.buildTag("div.e-ganttviewerbodyContianerparent#ganttviewerbodyContianerParent"+n._id,"",{"-ms-touch-action":"none","border-right-style":"solid","border-right-width":"1px","box-sizing":"border-box",width:"auto",height:"auto"},{});n._$bodyContent=t.buildTag("div.e-ganttviewerbodyContent#ganttviewerbodyContent"+n._id,"",{},{});n._$dependencyViewContainer=t.buildTag("div.e-ganttviewerbodyContianer-dependencyViewContainer#dependencyViewContainer"+n._id,"",{"z-index":"4",position:"absolute"},{});n._$secondaryCanvas=t.buildTag("div.e-ganttviewerbodyContianer-secondaryCanvas","",{"z-index":"3",position:"absolute"},{});n._$stripLineContainer=t.buildTag("div.e-ganttviewerbodyContianer-stripLines","",{"z-index":"6",position:"absolute"},{});n._$weekendsContainer=t.buildTag("div.e-ganttviewerbodyContianer-weekendsContainer","",{"z-index":"1",position:"absolute"},{});n._$ganttViewTable=t.buildTag("table.e-ganttviewerbodyContianer-ganttViewTable#ganttViewTable"+n._id,"",{"z-index":"5",position:"absolute"},{cellspacing:"0px"});n._$scheduleDiv=t.buildTag("div.e-gantt-schedule-container#gantt-schedule"+n._id+"","",{},{})},_getScheduleLength:function(n){var t=this,i=t.model;switch(n){case"week":return i.scheduleWeeks.length*t._scheduleWeekWidth;case"year":return t._scheduleYearWidth;case"month":return t._scheduleMonthWidth;case"day":return i.scheduleDays.length*t.model.perHourWidth*24;case"hour":return i.scheduleHours.length*i.perMinuteWidth*t._totalInterval;default:return i.scheduleWeeks.length*t._scheduleWeekWidth}},_renderGanttChart:function(){var i=this,r=i.model,f,e,o=r.scheduleHeaderSettings.scheduleHeaderType,s,u;if(i._createSchedule(i._getDateType(r.scheduleStartDate),i._getDateType(r.scheduleEndDate)),i._viewportHeight=i._getViewportHeight(),i._$ganttViewTable.css("width",i._getScheduleLength(o)+"px"),f=t.buildTag("colgroup","",{},{}),e=n(document.createElement("col")),e.css("width",i._getScheduleLength(o)+"px"),f.append(e),i._$ganttViewTable.append(f),i._createTooltipTemplate(),i._createEditingTooltipTemplate(),i._createProgressbarTooltipTemplate(),i._createTaskbarTemplate(),i._createConnectorLineTemplate(),i._updateCurrentViewData(),i.model.highlightWeekends==!0&&r.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Week&&i._renderWeekends(),i._$stripLineContainer.empty(),i.model.stripLines!=null&&this._renderStripLines(i.model.stripLines),i._$secondaryCanvas.empty(),i.model.holidays!=null)for(s=i.model.holidays.length,u=0;u<s;u++)i._renderHoliday(i.model.holidays[u])},renderConnectorLines:function(t){var i=this,r=n.render[i._id+"ConnectorLineTemplate"](t);n(i._$dependencyViewContainer).empty();i._$dependencyViewContainer.append(r);i._$bodyContent.append(i._$dependencyViewContainer)},clearConnectorLines:function(){n(this._$dependencyViewContainer).empty()},clearSelection:function(n){var t=this,r=t.model,i;(r.selectedRowIndex!=-1||n==-1)&&(i=t.getGanttChartRows(),i.removeClass("e-gantt-mouseclick"))},appendConnectorLine:function(t){var i=this,r=n.render[i._id+"ConnectorLineTemplate"](t);i._$dependencyViewContainer.append(r)},setCollapsedRecordCount:function(n){this._totalCollapsedRecordCount=n},getCollapsedRecordCount:function(){return this._totalCollapsedRecordCount},removeConnectorline:function(n){this.element.find("#ConnectorLine"+n).remove()},_wireEvents:function(){var i=this,r=jQuery.uaMatch(navigator.userAgent);t.isTouchDevice()?(i._on(i.element,"touchstart",".e-gantt-milestone-container,.e-childContainer",this._mouseHover),i._on(i.element,"touchstart",".e-childContainer,.e-gantt-milestone-container,.e-parentContainer",i._mousedown),n(document.body).bind("touchmove",n.proxy(i.handleMouseMove,i)),i._on(i.element,"touchleave",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseLeave),n(i._$bodyContainer).bind("touchend",n.proxy(i._handleMouseUp,i)),i._on(i.element,"tap",i._cellClickHandler)):(i._on(i.element,"mouseenter",".e-gantt-milestone-container,.e-childContainer,.e-parentContainer",this._mouseHover),i._on(i.element,"mouseleave",".e-gantt-milestone-container,.e-childContainer,.e-parentContainer",this._mouseLeave),i._on(i.element,"click",i._cellClickHandler),i._on(i.element,"mouseenter",".taskbarresizer-left",i._resizerleftOver),i._on(i.element,"mouseenter",".taskbarresizer-right",i._resizerrightOver),i._on(i.element,"mouseenter",".progressbarresizer-right",i._progressresizerOver),i._on(i.element,"mouseenter",".e-connectorpoint-left",i._dragLeftOver),i._on(i.element,"mouseenter",".e-connectorpoint-right",i._dragRightOver),t.browserInfo().name!="msie"?i._on(i.element,"mousedown",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._mousedown):i._on(i.element,"mousedown",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._mousedown),n(i._$bodyContainer).bind("mouseup",n.proxy(i._handleMouseUp,i)),n(document).bind("mouseup",n.proxy(i._tooltipMouseup,i)),i._on(i.element,"mouseenter",".e-stripline",i._stripLineMouseOver),i._on(i.element,"mouseleave",".e-stripline",i._stripLineMouseLeave),r.browser.toLowerCase()=="chrome"&&(i._on(i.element,"touchstart",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseHover),i._on(i.element,"touchstart",".e-childContainer,.e-gantt-milestone-container",i._mousedown),i._on(i.element,"touchleave",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseLeave),n(document.body).bind("touchmove",n.proxy(i.handleMouseMove,i)),i._on(i.element,"touchleave",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._handleMouseUp),n(i._$bodyContainer).bind("touchend",n.proxy(i._handleMouseUp,i)),n(i._$bodyContainer).bind("touchleave",n.proxy(i._handleMouseUp,i))));i._enableEditingEvents()},_enableEditingEvents:function(){var n=this,i=n.model;i.editSettings.allowEditing&&i.editSettings.editMode==="normal"?t.isTouchDevice?n._on(this.element,"doubletap",".e-ganttviewerbodyContent",n._editdblClickHandler):n._on(this.element,"dblclick",".e-ganttviewerbodyContent",n._editdblClickHandler):t.isTouchDevice?n._off(this.element,"doubletap",".e-ganttviewerbodyContent",n._editdblClickHandler):n._off(this.element,"dblclick",".e-ganttviewerbodyContent",n._editdblClickHandler)},updateEditSettings:function(n){var i=this;n&&(n.editMode&&(i.model.editSettings.editMode=n.editMode),t.isNullOrUndefined(n.allowAdding)||(i.model.editSettings.allowAdding=n.allowAdding),t.isNullOrUndefined(n.allowEditing)||(i.model.editSettings.allowEditing=n.allowEditing),t.isNullOrUndefined(n.allowDeleting)||(i.model.editSettings.allowDeleting=n.allowDeleting),t.isNullOrUndefined(n.beginEditAction)||(i.model.editSettings.beginEditAction=n.beginEditAction),i._enableEditingEvents())},_editdblClickHandler:function(){var n=this,i={};n.model.editSettings.editMode==="normal"&&!model.readOnly&&n.model.editSettings.allowEditing&&(i.requestType=t.TreeGrid.Actions.BeginEdit,n._trigger("actionBegin",i))},_enableRowHover:function(){var n=this;n.model.enableRowHover?n._on(n.element,"mouseleave mouseenter","#ganttviewerbodyContent,.e-ganttviewerbodyContent tr,.e-ganttviewerbodyContent"+n._id,n._rowHover):n._on(n.element,"mouseleave mouseenter","#ganttviewerbodyContent,.e-ganttviewerbodyContent tr,.e-ganttviewerbodyContent"+n._id)},_stripLineMouseLeave:function(){window.clearTimeout(this._tooltipTimer);this._clearTooltip()},_stripLineMouseOver:function(i){i.target.style.cursor="pointer";var r=this,h=r.model,u=n(i.target),c,f,e,l,o=0,s=0;r._clearTooltip();c=u.hasClass("e-striplinespan")?u[0].parentNode:u[0];f=c.id.match(/(\d+|[A-z]+)/g);(i.type=="mouseenter"||i.type=="mousemove")&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?(o=i.originalEvent.pageX,s=i.originalEvent.pageY):(i.originalEvent.clientX||i.originalEvent.clientY)&&(o=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop),e=t.buildTag("table.e-tooltiptable","",{width:"auto"},{cellspacing:"2px",cellpadding:"2px"}),l=t.buildTag("tbody","<tr><td>"+h.stripLines[f[1]].day+"<\/td><\/tr><tr><td>"+h.stripLines[f[1]].label+"<\/td><\/tr>",{},{}),e.append(l),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",e,{position:"absolute","z-index":r._getMaxZIndex()+1},{}),setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700))},_tooltipMouseup:function(){var n=this;n._mouseTarget==null||t.isTouchDevice()||n._handleMouseUp(n._mouseTarget)},_clearTooltip:function(){var t=this;t._mouseHoverTooltip&&n(t._mouseHoverTooltip).remove();n(".e-editingtooltip").remove();n("#tooltipgantt").remove();n(".e-progressbartooltip").remove();t._mouseHoverTooltip=null},_mouseWheel:function(n){if(this.model.allowZooming){var r=this,i={},t=null;if(n=n.originalEvent,n.preventDefault(),n.wheelDelta?t=-n.wheelDelta/120:n.detail&&(t=n.detail/3),!t)return;i.requestType="scroll";i.delta=t;r._enbleZooming(i)}},_resizerrightOver:function(n){var t=this,i=n.target,r=i.parentNode;t.model.allowGanttChartEditing==!0&&t.model.readOnly==!1&&(this._mouseDown==!1&&(n.target.style.cursor="w-resize"),t._setEditingElements(r))},_resizerrightLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_resizerleftOver:function(n){var t=this,i=n.target,r=i.parentNode;t.model.allowGanttChartEditing==!0&&t.model.readOnly==!1&&(this._mouseDown==!1&&(n.target.style.cursor="e-resize"),t._setEditingElements(r))},_resizerleftLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_progressresizerOver:function(t){var i=this,r=t.target,u=r.parentNode;i.model.allowGanttChartEditing==!0&&i.model.readOnly==!1&&(i.model.enableProgressBarResizing?(i._mouseDown==!1&&n(r).prev(".e-gantt-childtaskbar").has(".e-gantt-childtaskbar-progress").length>0&&(r.style.cursor="col-resize"),i._setEditingElements(u)):r.style.cursor="move")},_progressresizerLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_secondMouseOverConnectorPoint:function(t,i){var r=this,v,y,p,u,a;if(r._mouseDown&&r._falseLine||i&&r._falseLine){var e=n(t.target),w=r.getGanttChartRows(),v=e.closest("tr.e-ganttrowcell"),y=w.index(v),p=r.model.currentViewData[y],h=r._editingItem,c=p,f,l,o,s=r.model.predecessorText;if(r._prevItem.predecessorTarget==="Start"?f=h.taskId+"S":r._prevItem.predecessorTarget==="Finish"&&(f=h.taskId+"F"),e.hasClass("e-connectortouchpoint")?e.parent().hasClass("e-connectorpoint-left")?(f+="S",o=s.Start):e.parent().hasClass("e-connectorpoint-right")&&(f+="F",o=s.Finish):e.hasClass("e-connectorpoint-left")?(f+="S",o=s.Start):e.hasClass("e-connectorpoint-right")&&(f+="F",o=s.Finish),r._predecessorTooltip&&($table=r._predecessorTooltip.find("table"),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(c.taskName),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(o)),u={},u.requestType="validatePredecessor",u.fromItem=h,u.toItem=c,l=u.toItem.item[r.model.predecessorMapping]?u.toItem.item[r.model.predecessorMapping]+","+f:f,u.predecessor=f,u.currentRecord=c,u.predecessorString=[],u.predecessorString.push(l),a=r._completeAction(u),r._predecessorTooltip&&($td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)"),a?($td.removeClass(),$td.addClass("e-predecessor-true")):($td.removeClass(),$td.addClass("e-predecessor-false"))),i)return u}},_dragLeftOver:function(t){var i=this,r=t.target,u=r.parentNode;t.type=="touchmove"&&n(t.target).hasClass("e-connectortouchpoint")&&(u=r.parentNode.parentNode);i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&i.model.readOnly==!1&&(this._mouseDown==!1&&(r.style.cursor="pointer"),i._setEditingElements(u));n(u).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragLeftLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.enablePredecessorEditing&&n.model.readOnly==!1&&n._removeEditingElements()},_dragRightOver:function(t){var i=this,r=t.target,u=r.parentNode;t.type=="touchmove"&&n(t.target).hasClass("e-connectortouchpoint")&&(u=r.parentNode.parentNode);i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&i.model.readOnly==!1&&(this._mouseDown==!1&&(r.style.cursor="pointer"),i._setEditingElements(u));n(u).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragRightLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.enablePredecessorEditing&&n.model.readOnly==!1&&n._removeEditingElements()},_setEditingElements:function(t){var i=this,r;if(i._editingTarget&&!i._editPredecessor&&n(t).find(i._editingTarget).length==0)return!0;n(t).hasClass("e-childContainer")&&(i._leftResizerGripper=t.querySelector(".taskbarresizer-left"),i._rightResizerGripper=t.querySelector(".taskbarresizer-right"),r=t.querySelector(".progressbarresizer-right"),i._progressHandle=r&&r.firstChild,i._progressHandleChild=r&&r.childNodes[1],n(i._leftResizerGripper).addClass("gripper"),n(i._rightResizerGripper).addClass("gripper"),i.model.progressMapping&&i.model.enableProgressBarResizing&&(n(i._progressHandle).addClass("e-progresshandle"),n(i._progressHandleChild).addClass("e-progresshandleafter")));i.model.enablePredecessorEditing&&(n(t).hasClass("e-childContainer")&&i.model.predecessorMapping&&!i._falseLine?(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-gantt-milestone-container")&&i.model.predecessorMapping&&!i._falseLine?(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-childContainer")&&i.model.predecessorMapping&&i._falseLine?(i._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._childRightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-gantt-milestone-container")&&i.model.predecessorMapping&&i._falseLine?(i._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._childRightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-parentContainer")&&i.model.predecessorMapping&&!i._falseLine&&(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover"),n(t).hasClass("e-manualparenttaskbar")&&(n(i._leftConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"))))},_removeEditingElements:function(){var t=this;n(t._leftResizerGripper).removeClass("gripper");n(t._rightResizerGripper).removeClass("gripper");t.model.progressMapping&&(n(t._progressHandle).removeClass("e-progresshandle"),n(t._progressHandleChild).removeClass("e-progresshandleafter"));t.model.enablePredecessorEditing&&(t.model.predecessorMapping&&t._mouseDown==!1&&(n(t._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(t._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null),(t.model.predecessorMapping&&t._leftConnectorPoint!==null&&t._mouseDown==!0||t._childLeftConnectorPoint)&&(n(t._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),n(t._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),t._predecessorTooltip&&($table=t._predecessorTooltip.find("table"),$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(""),$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(""),$td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)").removeClass(),$td.addClass("e-predecessor-false"))))},refreshHeight:function(){var n=this;n._$bodyContainer.ejScroller("refresh")},_mousedown:function(i){var r,s,o;if(i.which==2||i.which==3)return!1;r=this;r._clearTooltip();r._mouseDown=!0;args={};var f=n(i.target),l=r.getGanttChartRows(),h=f.closest("tr.e-ganttrowcell"),c=l.index(h),e=r.model.currentViewData[c],a=e.parentItem,u=f[0].parentNode,v=jQuery.uaMatch(navigator.userAgent),y=this.model;t.isNullOrUndefined(e)||(i.type=="touchstart"&&(i.preventDefault(),n(".e-connectortouchpoint").addClass("e-enableconnectortouchpoint")),r._editingItem=e,r._editingTarget=f,r._allowExpandCollapse=!0,u=n(u).hasClass("progressbarresizer-right")?u.parentNode:n(u).hasClass("e-gantt-childtaskbar-progress")?n(u).closest("div.e-childContainer"):n(u).hasClass("progressbarhandler")?f.closest(".e-childContainer")[0]:n(u).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container"),(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-parentContainer")||n(u).hasClass("e-gantt-milestone-container"))&&(n(h).addClass("e-editmode"),r._mouseTarget=i),r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container")||n(u).hasClass("e-parentContainer"))&&((i.target.style.cursor=="e-resize"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone"))||i.type=="touchstart"&&i.target.className=="taskbarresizer-left")&&(r._updateEditingType(),r._leftResizing=!0),(i.target.style.cursor=="w-resize"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-parentContainer"))||i.type=="touchstart"&&i.target.className=="taskbarresizer-right")&&(r._updateEditingType(),r._rightResizing=!0),s=n(i.target).closest(".progressbarresizer-right"),((i.target.style.cursor=="col-resize"||s.length&&s[0].style.cursor=="col-resize")&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone"))||i.type=="touchstart"&&i.target.className=="progressbarresizer-right")&&(r._updateEditingType(),r._progressResizing=!0),o=n(i.target).closest("[style*='cursor: move']"),((i.target.style.cursor=="move"||o.length&&o[0].style.cursor=="move")&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container"))||n(f[0]).hasClass("e-gantt-manualparenttaskbar"))&&(r._updateEditingType(),r._allowDragging=!0),(i.target.style.cursor==""&&(o.length&&o[0].style.cursor==""||o.length==0)&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container"))||e.isAutoSchedule&&n(f).hasClass("e-gantt-manualparenttaskbar"))&&(r._updateEditingType(),i.target.className=="taskbarresizer-left e-icon"||i.target.className=="taskbarresizer-left e-icon gripper"?r._leftResizing=!0:i.target.className=="taskbarresizer-right e-icon"||i.target.className=="taskbarresizer-right e-icon gripper"?r._rightResizing=!0:i.target.className=="progressbarhandler e-progresshandle"||i.target.className=="e-progresshandler-element"||i.target.className=="e-progresshandlerafter-element"||i.target.className=="progressbarresizer-right"?r._progressResizing=!0:(i.target.className=="e-gantt-childtaskbar-progress progressbar"||i.target.className=="e-tasklabel"||i.target.className=="e-gantt-childtaskbar"||i.target.className=="e-gantt-milestone milestone-top"||i.target.className=="e-gantt-milestone milestone-bottom"||n(i.target).hasClass("e-gantt-milestone")||n(i.target).closest(".e-gantt-milestone").length>0||n(i.target).closest(".e-gantt-childtaskbar").length>0)&&(r._allowDragging=!0)),r.model.enablePredecessorEditing&&(i.target.style.cursor=="pointer"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container")||n(u).hasClass("e-parentContainer"))||i.type=="touchstart"&&(i.target.className=="e-connectorpoint-right"||i.target.className=="e-connectorpoint-left"||i.target.className=="e-connectorpoint-right e-connectorpoint-hover"||i.target.className=="e-connectorpoint-left e-connectorpoint-hover"))&&(r._updateEditingType(),r._editPredecessor=!0,f.hasClass("e-connectorpoint-left")||f.hasClass("e-connectorpoint-left e-connectorpoint-hover")?r._prevItem.predecessorTarget="Start":(f.hasClass("e-connectorpoint-right")||f.hasClass("e-connectorpoint-right e-connectorpoint-hover"))&&(r._prevItem.predecessorTarget="Finish")),i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(r._posX1=r._currMousePosX=i.originalEvent.pageX,r._posY1=r._currMousePosY=i.originalEvent.pageY,r.dragPosX=i.originalEvent.pageX):i.originalEvent.clientX||i.originalEvent.clientY?(r._posX1=r.dragPosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,r._posY1=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(r._posX1=r._currMousePosX=i.originalEvent.changedTouches[0].pageX,r._posY1=r._currMousePosY=i.originalEvent.changedTouches[0].pageY,r.dragPosX=i.originalEvent.changedTouches[0].pageX),r._prevItem.left=e.left,r._prevItem.status=e.status,r._prevItem.duration=e.duration,r._prevItem.startDate=e.startDate,r._prevItem.endDate=e.endDate,r._prevItem.width=e.width,r._parentCollectionPreviousValues=r._getParentCollectionPreviousValues(e),r.model.enablePredecessorEditing&&(r._connectorPointX=r._currMousePosX-r._$bodyContent.offset().left,r._connectorPointY=r._currMousePosY-r._$bodyContent.offset().top),n(r._$bodyContainer).bind("mousemove",n.proxy(r.handleMouseMove,r))),r._appendTooltip(f,c),r._trigger("clearColumnMenu"))},_getParentCollectionPreviousValues:function(n){var r=n,i={},u=[];do parentItem=r.parentItem,t.isNullOrUndefined(parentItem)||(i.left=parentItem.left,i.status=parentItem.status,i.duration=parentItem.duration,i.startDate=parentItem.startDate,i.endDate=parentItem.endDate,i.width=parentItem.width,i.index=parentItem.index,i.isAutoSchedule||(i.manualLeft=parentItem.manualLeft,i.manualStartDate=parentItem.manualStartDate,i.manualEndDate=parentItem.manualEndDate,i.manualDuration=parentItem.manualDuration),u.push(i),r=parentItem,i={});while(r.parentItem);return u},handleMouseMove:function(n){this._updateOnmouseMove(n)},_handleMouseUp:function(i){var r=this,u={},p=r.getGanttChartRows(),a,c,v=0,f,w=r._posX1,b=r._posY1,o,s,y,l,e,h;t.isNullOrUndefined(i.pageX)?(o=i.originalEvent.changedTouches[0].pageX,s=i.originalEvent.changedTouches[0].pageY,t.isNullOrUndefined(r._predecessorTooltip)||(i.target=document.elementFromPoint(o,s))):(o=i.pageX,s=i.pageY);(n(i.target).hasClass("e-connectorpoint-left")||n(i.target).hasClass("e-connectorpoint-right")||n(i.target).hasClass("e-connectortouchpoint"))&&r._falseLine&&!n(i.target).parent().hasClass("e-parentContainer")&&(r._trigger("cancelEditCell"),n(i.target).hasClass("e-connectortouchpoint")&&(i.target=n(i.target).parent()),e=r._secondMouseOverConnectorPoint(i,!0),u.currentRecord=e.currentRecord,u.fromItem=e.fromItem,u.toItem=e.toItem,u.predecessor=e.predecessor,u.predecessorString=e.predecessorString,u.requestType="validatePredecessor",r._trigger("actionBegin",u)||e.predecessorValidation&&(e.requestType="drawConnectorLine",r._completeAction(e)));r._editingTarget!=null&&r._editingItem!=null&&(a=r._editingTarget,c=a.closest("tr.e-ganttrowcell"),v=p.index(c),f=r._editingItem,n(c).hasClass("e-editmode")&&(n(c).removeClass("e-editmode"),r._mouseTarget=null));n("#ganttviewerbodyContianer"+r._id).unbind("mousemove");r._mouseDown=!1;r._clearTooltip();w!=o||b!=s?(r._editingTarget=null,r._editingItem=null,r._$ganttChartContainer[0].style.cursor="auto",f!=null&&(r._allowDragging||r._leftResizing||r._rightResizing||r._progressResizing)&&(u.editingFields={startdate:f.startDate,enddate:f.endDate,progress:f.status,duration:f.duration,durationunit:f.durationUnit},u.data=f,u.previousData=r._prevItem,u.dragging=r._allowDragging,u.leftResizing=r._leftResizing,u.rightResizing=r._rightResizing,u.progressResizing=r._progressResizing,r._taskbarEdited(u)),u.cancel&&(r._getPrevItem(f,v),f.parentItem&&r._getParentPreviousValue(),r.model.predecessorMapping&&(u.dragging||u.rightResizing||u.leftResizing)&&(u.requestType="updateConnectors",u.ganttRecord=f,r._trigger("actionComplete",u))),r._updateEditingType(),r._falseLine&&r._falseLine.remove(),r._falseLine=null,r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,n(r._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),n(r._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),r._leftConnectorPoint=null,r._rightConnectorPoint=null,r._childRightConnectorPoint=null,r._childLeftConnectorPoint=null,r._trigger("clearColumnMenu")):(r._newXYPos=!1,r._$ganttChartContainer[0].style.cursor="auto",r._allowDragging=!1,r._falseLine&&r._falseLine.remove(),r._falseLine=null,f&&r.model.enableTaskbarTooltip&&(r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,y={ttipstartDate:this._getFormatedDate(f.startDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(f.endDate,this.model.dateFormat,this.model.locale),ttipduration:f.duration,ttipprogress:f.status.toString(),ttiptaskname:f.taskName,ttipdurationunit:f.durationUnit},l=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),r.model.tooltipTemplate||r.model.tooltipTemplateId?r.model.tooltipTemplate?(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="Template",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](f),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)):r.model.tooltipTemplateId&&(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="TemplateID",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](f),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)):(r.tooltipState="",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](y),{},{}),l.append(h),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",l,{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r._mouseHoverTooltip.innerHTML="<table>"+l[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)),n(r._mouseHoverTooltip).addClass("customTooltip"),r._trigger("clearColumnMenu")));i.type=="touchend"&&n(".e-connectortouchpoint").removeClass("e-enableconnectortouchpoint")},getChildCount:function(n,t){var r,u=this,i;if(!n.hasChildRecords)return 0;for(i=0;i<n.childRecords.length;i++)r=n.childRecords[i],t++,r.hasChildRecords&&(t=u.getChildCount(r,t));return t},criticalDataMapping:function(n,i,r,u){i==!0&&(this.model.isCriticalPathEnable=!0,t.isNullOrUndefined(n)||(this.model.criticalPathCollection=n,this.model.detailPredecessorCollection=r,this.collectionTaskId=u));i==!1&&(this.model.isCriticalPathEnable=!1)},criticalPathColor:function(n,i,r,u){i==!0&&(t.isNullOrUndefined(n)||(this._refresh(),t.isNullOrUndefined(r)||this.criticalConnectorLine(n,r,!0,u)));i==!1&&(this.criticalConnectorLine(n,r,!1,u),this._refresh())},criticalConnectorLine:function(n,t,i,r){var e,u,o,f,s,h;if(i==!1)this.element.find(".e-line").removeClass("e-criticalconnectorline"),this.element.find(".connectorline-rightarrow").removeClass("e-criticalconnectorlinerightarrow"),this.element.find(".connectorline-leftarrow").removeClass("e-criticalconnectorlineleftarrow");else if(t.length!=0)for(e=0,o=[],s=0;s<this.model.criticalPathCollection.length;s++)if(e=r.indexOf(this.model.criticalPathCollection[s]),u=t[e],e!=-1&&u.to)for(o=u.to.split(","),h=0;h<o.length;h++)f=parseInt(o[h]),n.indexOf(f)!=-1&&(this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".e-line").addClass("e-criticalconnectorline"),this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".connectorline-rightarrow").addClass("e-criticalconnectorlinerightarrow"),this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".connectorline-leftarrow").addClass("e-criticalconnectorlineleftarrow"))},_getCollapsedParentItem:function(n){var t=n.parentItem;return t?this._getExpandStatus(t)===!0?t:this._getCollapsedParentItem(t):null},updateScrollBar:function(){var n=this,t=n.model,u,r,f,s,e;if(r=n.getExpandedRecords(t.updatedRecords),f=r.indexOf(t.selectedItem),t.selectedItem&&f!=-1){var i=f*t.rowHeight,h=i+t.rowHeight,o,c=n._$bodyContainer.children(".e-content").length;o=c?n._$bodyContainer.children(".e-content").scrollTop():n._$bodyContainer.scrollTop();(n._$bodyContainer.ejScroller("isHScroll")||n.element.find(".e-borderbox").length>0)&&(u=18);s=i<o;e=o+n._viewportHeight-u<h;(s||e)&&(i+n._viewportHeight>r.length*t.rowHeight&&(i=r.length*t.rowHeight-n._viewportHeight,e&&(i+=u)),n._$bodyContainer.ejScroller("scrollY",i,!0),t.enableVirtualization&&n.focusGanttElement())}},getExpandedRecords:function(n){var t=this;return n.filter(function(n){return t._getExpandStatus(n)==!0})},_keyPressed:function(n,t,i,r){var u=this,f=this.model,e,s=f.updatedRecords,l=u.getExpandedRecords(s),c;if(r.stopImmediatePropagation(),r.preventDefault(),!f.allowKeyboardNavigation)return!0;switch(n){case"downArrow":s.length>0&&f.selectedItem&&(lastRowIndex=s.length-1,f.selectedRowIndex!=lastRowIndex&&(e=l.indexOf(f.selectedItem),c=l[e+1],e=s.indexOf(c),c&&e<=lastRowIndex&&!u._rowSelectingEventTrigger(f.selectedRowIndex,e)&&(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(f.selectedRowIndex))));break;case"upArrow":f.selectedRowIndex!==0&&s.length>0&&f.selectedItem&&(e=l.indexOf(f.selectedItem),c=l[e-1],e=s.indexOf(c),u._rowSelectingEventTrigger(f.selectedRowIndex,e)||(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(f.selectedRowIndex)));break;case"firstRowSelection":s.length>0&&(u._rowSelectingEventTrigger(f.selectedRowIndex,0)||(u.selectRows(0),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(0)));break;case"lastRowSelection":s.length>0&&(lastRowIndex=l.length-1,c=l[lastRowIndex],e=s.indexOf(c),u._rowSelectingEventTrigger(f.selectedRowIndex,e)||(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(e)));break;case"rightArrow":var a=u.model.selectedRowIndex,h=u.model.updatedRecords[a],o={},v;o.data=h;o.recordIndex=a;o.expanded=!0;h&&(u._rowSelectingEventTrigger()||!h.hasChildRecords||h.expanded||(a>=0&&(v=u._trigger("expanding",o)),f.enableVirtualization&&u.focusGanttElement()));break;case"leftArrow":var a=u.model.selectedRowIndex,h=u.model.updatedRecords[a],o={},v;o.data=h;o.recordIndex=a;o.expanded=!1;h&&!u._rowSelectingEventTrigger()&&h.hasChildRecords&&h.expanded&&(a>=0&&u._trigger("collapsing",o),f.enableVirtualization&&u.focusGanttElement());break;case"deleteRecord":f.editSettings.allowDeleting&&f.selectedRowIndex>=0&&(u._trigger("deleteRow"),u.focusGanttElement());break;case"totalRowCollapse":o={};o.requestType="collapseAll";u._trigger("expandAllCollapseAllRequest",o);break;case"totalRowExpand":o={};o.requestType="expandAll";u._trigger("expandAllCollapseAllRequest",o)}return!0},_rowSelectingEventTrigger:function(n,t){var r=this,u=r.model,i={};if(u.selectionMode=="row")return i.previousIndex=n,i.recordIndex=t,r._trigger("rowSelecting",i)},_rowSelectedEventTrigger:function(n){var t=this,i;t.model.selectionMode=="row"&&(i={data:t.model.selectedItem,target:"ejGanttChart",recordIndex:n},t._trigger("rowSelected",i))},_updateEditingType:function(){var n=this;n._leftResizing=!1;n._allowDragging=!1;n._rightResizing=!1;n._progressResizing=!1;n._editPredecessor=!1},_getHolidaysCount:function(n,t){for(var u=this,r=this.model.holidays,f=0,i=0;i<r.length;i++)u._getDateFromFormat(r[i].day)>=n&&u._getDateFromFormat(r[i].day)<=t&&(f+=1);return f},updateConnectorLineOffset:function(n){var u,a=this.model,i=n.predecessor,v=[],o,s,h,c,l=a.includeWeekend,r,f,t,e;if(i){for(t=0;t<i.length;t++)i[t].to===n.taskId.toString()&&(u=a.flatRecords[a.ids.indexOf(i[t].from)],r=a.flatRecords[a.ids.indexOf(i[t].to)],o=new Date(u.startDate),s=new Date(u.endDate),h=new Date(r.startDate),c=new Date(r.endDate),i[t].predecessorsType=="FS"&&(r.left<u.left+u.width?(f=(u.left+u.width-r.left)/this.model.perDayWidth,f=r.isMilestone==!0?f-1:f,i[t].offset=Math.round(-f)):r.left>u.left+u.width?(f=(r.left-(u.left+u.width))/this.model.perDayWidth,f>=0&&(i[t].offset=Math.round(f))):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(s,new Date(h)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(s,h)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(h),s),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(h,s))),i[t].predecessorsType=="SS"&&(r.left<u.left?(f=(u.left-r.left)/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left>u.left?(f=(r.left-u.left)/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(o,new Date(h)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(o,h)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(h),o),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(h,o))),i[t].predecessorsType=="SF"&&(r.left+r.width<u.left?(f=(u.left-(r.left+r.width))/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left+r.width>u.left?(f=(r.left+r.width-u.left)/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(o,new Date(c)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(o,c)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(c),o),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(c,o))),i[t].predecessorsType=="FF"&&(r.left+r.width<u.left+u.width?(f=(u.left+u.width-(r.left+r.width))/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left+r.width>u.left+u.width?(f=(r.left+r.width-(u.left+u.width))/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(s,new Date(c)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(s,c)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(c),s),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(c,s))),i[t].offset<0?v.push(i[t].from+""+i[t].predecessorsType+""+i[t].offset+"d"):i[t].offset>=1?v.push(i[t].from+""+i[t].predecessorsType+"+"+i[t].offset+"d"):v.push(i[t].from+""+i[t].predecessorsType));v.length>0&&(n.item[a.predecessorMapping]=v.join(","))}},_calculateWeekendDays:function(n,t){var i=0;for(n=new Date(n);n<t;)n.setDate(n.getDate()+1),(n.getDay()===0||n.getDay()==6)&&++i;return i},_getPrevItem:function(n,t){var i=this,r;n.left=i._prevItem.left;n.width=i._prevItem.width;n.startDate=i._prevItem.startDate;n.endDate=i._prevItem.endDate;n.duration=i._prevItem.duration;n.status=i._prevItem.status;n.progressWidth=this._getProgressWidth(n.width,n.status);this.refreshRow(t);r={};r.index=t;this._refreshRow(r)},_getParentPreviousValue:function(){for(var u,i=this,n,t,f=i.model,e=i._parentCollectionPreviousValues.length,r=0;r<e;r++)n=i._parentCollectionPreviousValues[r],t=n.index,parentItem=f.updatedRecords[t],parentItem.left=n.left,parentItem.width=n.width,parentItem.startDate=n.startDate,parentItem.endDate=n.endDate,parentItem.duration=n.duration,parentItem.status=n.status,parentItem.progressWidth=this._getProgressWidth(parentItem.width,parentItem.status),this.refreshRow(t),u={},u.index=t,this._refreshRow(u)},_enableLeftResizing:function(i,r){var u=this,o=this.model,f=o.scheduleHeaderSettings.scheduleHeaderType,e=t.Gantt.ScheduleHeaderType;i.target.style.cursor="e-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.left-=u._mousePosX,r.width+=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.left+30<r.left+r.width&&r.left+u._mousePosX<=this._prevItem.left+this._prevItem.width&&(r.left+=u._mousePosX,r.width-=u._mousePosX));this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.width=f==e.Day?r.width<u.model.perHourWidth?u.model.perHourWidth:r.width:f==e.Hour?r.width<u.model.perMinuteWidth?u.model.perMinuteWidth:r.width:r.width<u.model.perDayWidth?u.model.perDayWidth:r.width;r.progressWidth=u._getProgressWidth(r.width,r.status);r.left=this._prevItem.left+this._prevItem.width-r.width;u._setItemPosition(r)},_enableProgressResizing:function(i,r){var u=this,f,e;i.target.style.cursor="col-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u._progressResizer&&(u._progressHandle=u._progressResizer&&u._progressResizer.firstChild,u._progressHandleChild=u._progressResizer&&u._progressResizer.childNodes[1]);u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.progressWidth-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.progressWidth+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.progressWidth=r.progressWidth>r.width?r.width:r.progressWidth;r.progressWidth=r.progressWidth<0?0:r.progressWidth;f=r.width-r.progressWidth;e=f<=4?4-f:0;n(u._progressbarItem).css({width:r.progressWidth+"px","border-top-right-radius":e+"px","border-bottom-right-radius":e+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._progressHandle).addClass("e-progresshandle");n(u._progressHandleChild).addClass("e-progresshandleafter")},_enableRightResizing:function(i,r){var u=this,f=this.model;i.target.style.cursor="w-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.width-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.width+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.width=f.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Day?r.width<u.model.perHourWidth?u.model.perHourWidth:r.width:f.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Hour?r.width<u.model.perMinuteWidth?u.model.perMinuteWidth:r.width:r.width<u.model.perDayWidth?u.model.perDayWidth:r.width;r.hasChildRecords?n(u._manualRightResizer).css({left:r.width-parseInt(u._manualRightResizer.style.borderRightWidth.replace("px",""))+"px"}):(r.progressWidth=u._getProgressWidth(r.width,r.status),n(u._tasknameContainer).css({left:r.left+"px",width:r.width+"px"}));n(u._taskbarItem).css({left:r.left+"px",width:r.width+"px"});n(u._progressbarItem).css({width:r.progressWidth+"px"});n(u._rightResizer).css({left:r.left+r.width-u._resizerRightAdjust+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._leftConnectorPoint).css({left:r.left-u._connectorPointWidth+"px"});n(u._rightConnectorPoint).css({left:r.left+r.width+"px"})},_enableDragging:function(i,r){var u=this;i.target.style.cursor="move";n(i.target.parentNode).hasClass("e-parentContainer")&&(u._allowExpandCollapse=!1);this.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.left-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.left+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.left=r.left<0?0:r.left;n(u._taskbarItem).css({left:r.left+"px"});n(u._rightResizer).css({left:r.left+r.width-u._resizerRightAdjust+"px"});n(u._leftResizer).css({left:r.left+2+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._tasknameContainer).css({left:r.left+"px",width:r.width+"px"});n(u._leftConnectorPoint).css({left:r.left-u._connectorPointWidth+"px"});n(u._rightConnectorPoint).css({left:r.left+r.width+"px"})},_appendTooltip:function(i,r){var u=this,h,o,l=n(i),s=this.model,e=u.model.currentViewData[r],p=u.model.columnHeaderTexts,a=u.model.predecessorEditingTexts,c,v,y,f;e!=null&&(c=l[0],n(l[0]).hasClass("progressbarresizer-right")&&(c=l.closest(".e-childContainer")[0]),(n(c).hasClass("e-parentContainer")||n(c).hasClass("e-childContainer"))&&(u._editingContainer=c,u._leftResizer=u._editingContainer.querySelector(".e-connectorpoint-left"),u._taskbarItem=u._editingContainer.querySelector(".taskbarresizer-left"),u._progressbarItem=u._editingContainer.querySelector(".e-gantt-childtaskbar"),u._progressResizer=u._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),u._rightResizer=u._editingContainer.querySelector(".progressbarresizer-right")),this.model.enableTaskbarDragTooltip&&!l.hasClass("e-parentContainer")&&(this._progressResizing==!0?(u._$ganttChartContainer[0].style.cursor="col-resize",o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),f=t.buildTag("tbody","",{},{}),f[0].innerHTML="<tr><td>"+p.status+" : "+e.status+"%<\/td><\/tr>",o.append(f),u.model.progressbarTooltipTemplate?(u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),f=t.buildTag("tbody",n.render[u._id+"progressbarTooltipTemplate"](e),{},{}),u._progressBarTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u.model.progressbarTooltipTemplateId?(u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),f=t.buildTag("tbody",n.render[u._id+"progressbarTooltipTemplate"](e),{},{}),u._progressBarTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"",o,{position:"absolute","z-index":u._getMaxZIndex()+1},{onselectstart:"return false"}),u._progressBarTooltipID&&(n(document.body).append(u._progressBarTooltipID),u._updateTooltipPosition(u._progressBarTooltipID,u._currMousePosX,u._currMousePosY,!0))):this._editPredecessor===!0&&u.model.enablePredecessorEditing?(v=s.predecessorText,u._predecessorTooltip===null&&(u._predecessorTooltip=t.buildTag("div.e-tooltipganttpredecessor#predecessortooltip"+u._id+"","",{top:u._currMousePosY+10+"px",left:u._currMousePosX+10+"px",position:"absolute","z-index":u._getMaxZIndex()+1},{onselectstart:"return false"}),o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),f=t.buildTag("tbody","",{},{}),y="<tr><td class='e-predecessor-false'><\/td><td >"+a.fromText+":<\/td><td class='e-tooltiptaskname'>"+e.taskName+"<\/td><td>"+v[u._prevItem.predecessorTarget]+"<\/td> <\/tr><tr><td><\/td><td>"+a.toText+":<\/td><td class='e-tooltiptaskname'><\/td><td><\/td><\/tr>",n(f).html(y),o.append(f),u._predecessorTooltip.append(o),n(document.body).append(u._predecessorTooltip),u._updateTooltipPosition(u._predecessorTooltip,u._currMousePosX,u._currMousePosY))):(u._leftResizing==!0||u._rightResizing==!0||u._allowDragging==!0)&&(u._leftResizing==!0?(u._$ganttChartContainer[0].style.cursor="e-resize",h={ttipstartDate:this._getFormatedDate(e.startDate,s.dateFormat,s.locale),ttipduration:e.duration,ttipdurationunit:e.durationUnit}):u._rightResizing==!0?(u._$ganttChartContainer[0].style.cursor="w-resize",h={ttipendDate:this._getFormatedDate(e.endDate,s.dateFormat,s.locale),ttipduration:e.duration,ttipdurationunit:e.durationUnit}):u._allowDragging==!0&&(u._$ganttChartContainer[0].style.cursor="move",h={ttipstartDate:this._getFormatedDate(e.startDate,s.dateFormat,s.locale),ttipendDate:this._getFormatedDate(e.endDate,s.dateFormat,s.locale)}),o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),u.model.taskbarEditingTooltipTemplate?(u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),u.tooltipState="editingTemplateID",f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](e),{},{}),u._taskbarEditingTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u.model.taskbarEditingTooltipTemplateId?(u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),u.tooltipState="editingTemplate",f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](e),{},{}),u._taskbarEditingTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):(u.tooltipState="",h&&(f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](h),{},{}),o.append(f)),u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"",o,{position:"absolute","z-index":u._getMaxZIndex()+1},{})),u._taskbarEditingTooltipID&&(n(document.body).append(u._taskbarEditingTooltipID),u._updateTooltipPosition(u._taskbarEditingTooltipID,u._currMousePosX,u._currMousePosY,!0)))))},_setItemPosition:function(t){var i=this;n(i._leftResizer).css({left:t.left+2+"px"});n(i._rightResizer).css({left:t.left+t.width-i._resizerRightAdjust+"px"});n(i._taskbarItem).css({left:t.left+"px",width:t.width+"px"});n(i._progressbarItem).css({width:t.progressWidth+"px"});n(i._progressResizer).css({left:t.left+t.progressWidth-10+"px"});n(i._tasknameContainer).css({left:t.left+"px",width:t.width+"px"});n(i._leftConnectorPoint).css({left:t.left-i._connectorPointWidth+"px"});n(i._rightConnectorPoint).css({left:t.left+t.width+"px"})},_getTemplate:function(t){var i,r;return typeof t!="object"?(i=n.parseHTML(this.model.tooltipTemplate),i[0]):(r=n(t)[0].innerHTML,i=n.parseHTML(r),i[1])},_updateOnmouseMove:function(i){var r=this,o={},s,e=r._editingTarget?r._editingTarget:null,c=r.getGanttChartRows(),h=e?e.closest("tr.e-ganttrowcell"):null,l=c.index(h),u=r._editingItem,f=e?e[0].parentNode:null;r._newXYPos=!0;f=n(f).hasClass("progressbarresizer-right")?f.parentNode:n(f).hasClass("e-gantt-childtaskbar-progress")?n(f).closest("div.e-childContainer")[0]:n(f).hasClass("progressbarhandler")?e.closest(".e-childContainer")[0]:n(f).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0];u!=null&&(r._trigger("cancelEditCell"),o.editingFields={startdate:u.startDate,enddate:u.endDate,progress:u.status,duration:u.duration,durationunit:u.durationUnit},o.rowData={rowData:u},r._taskbarEditing(o),o.cancel||(i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(r._mousePosX=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(r._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(r._mousePosX=i.originalEvent.targetTouches[0].pageX,s=i.originalEvent.targetTouches[0].pageY),e.hasClass("e-gantt-milestone")||n(f).hasClass("e-gantt-milestone")?n(h).hasClass("e-editmode")&&this._editMilestone(i):(n(f).hasClass("e-childContainer")?(r._editingContainer=f,r._leftResizer=r._editingContainer.querySelector(".taskbarresizer-left"),r._taskbarItem=r._editingContainer.querySelector(".e-gantt-childtaskbar"),r._progressbarItem=r._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),r._progressResizer=r._editingContainer.querySelector(".progressbarresizer-right"),r._rightResizer=r._editingContainer.querySelector(".taskbarresizer-right"),r.model.predecessorMapping&&r.model.enablePredecessorEditing&&(r._leftConnectorPoint=f.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=f.querySelector(".e-connectorpoint-right"),r.model.allowGanttChartEditing&&(n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")))):n(f).hasClass("e-parentContainer")&&!u.isAutoSchedule&&(r._editingContainer=f,r._taskbarItem=r._editingContainer.querySelector(".e-gantt-manualparenttaskbar"),r._rightResizer=r._editingContainer.querySelector(".taskbarresizer-right"),r._manualRightResizer=r._editingContainer.querySelector(".e-gantt-manualparenttaskbar-right")),n(h).hasClass("e-editmode")&&(n(e[0]).closest("e-gantt-manualparenttaskbar")||n(f).hasClass("e-gantt-milestone-container")||n(f).hasClass("e-childContainer"))&&(r._leftResizing==!0?(r._enableLeftResizing(i,u),r._updateEditedItem(u,"leftResizing")):r._progressResizing==!0&&r.model.enableProgressBarResizing&&r.model.progressMapping?((r._editingTarget.hasClass("e-progresshandlerafter-element")||r._editingTarget.hasClass("progressbarhandler e-progresshandle")||r._editingTarget.hasClass("e-progresshandler-element")||r._editingTarget.hasClass("progressbarresizer-right"))&&r._editingTarget.prev(".e-gantt-childtaskbar").find(".e-tasklabel").text(""),r._enableProgressResizing(i,u),r._updateEditedItem(u,"progressResizing")):r._rightResizing==!0?(r._enableRightResizing(i,u),r._updateEditedItem(u,"rightResizing")):r._allowDragging==!0?(r._enableDragging(i,u),r._updateEditedItem(u,"dragging")):r._editPredecessor==!0&&r._drawFalseLine(i,u))),r._clearTooltip(),r._appendTooltip(e,l)));t.isNullOrUndefined(i.pageX)&&i.type=="touchmove"&&r._predecessorTooltip&&(t.isNullOrUndefined(i.pageX)?(x2=i.originalEvent.changedTouches[0].pageX,y2=i.originalEvent.changedTouches[0].pageY,i.target=document.elementFromPoint(x2,y2)):(x2=i.pageX,y2=i.pageY),n(i.target).hasClass("e-connectorpoint-left")||n(i.target).hasClass("e-connectortouchpoint")?r._dragLeftOver(i):n(i.target).hasClass("e-connectorpoint-right")?r._dragRightOver(i):(r._mouseLeave(),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")))},_editMilestone:function(i){var r=this,f=r._editingTarget,e=f.hasClass("milestone-top")||f.hasClass("milestone-bottom")?f[0].parentNode:f.closest(".e-gantt-milestone"),o=r.getGanttChartRows(),s=f.closest("tr.e-ganttrowcell"),h=o.index(s),u=r._editingItem;u!=null&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?r._mousePosX=i.originalEvent.pageX:i.originalEvent.clientX||i.originalEvent.clientY?r._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft:(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(r._mousePosX=i.originalEvent.targetTouches[0].pageX,posy=i.originalEvent.targetTouches[0].pageY),i.target.style.cursor="move",r.dragPosX>r._mousePosX?(r._mousePosX=r.dragPosX-r._mousePosX,u.left>0&&(u.left-=r._mousePosX)):(r._mousePosX-=r.dragPosX,u.left+=r._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,u.left=u.left<0?0:u.left,n(e).css({left:u.left+"px"}),n(r._leftConnectorPoint).css({left:u.left-r._connectorPointWidth+"px"}),n(r._rightConnectorPoint).css({left:u.left+r._milesStoneWidth+"px"}),r._updateEditedItem(u,"dragging"),r._appendTooltip(f,h))},_updateEditedItem:function(n,i){var l=this,r=l.model,f=r.scheduleHeaderSettings.scheduleHeaderType,o=t.Gantt.ScheduleHeaderType,it=t.Gantt.DurationUnit,a=n._getFormatedDate(r.projectStartDate,r.dateFormat,r.locale),a=n._getDateFromFormat(a,r.dateFormat,r.locale),rt=n.startDate.getHours(),ut=n.startDate.getMinutes(),s,h,u,c,v,y,nt,tt,k,d,g,e;switch(i){case"dragging":if(s=n.left%r.perDayWidth,h=(n.left-s)/r.perDayWidth,u=s/r.perDayWidth,(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c=f==o.Day||f==o.Hour?24:r.secondsPerDay/3600,c&&u!=1)var p=1/c,w=u/p,b=Math.round(w*60);a=n._startDateUpdate(a,h,b,r.workingTimeRanges,f);n.startDate=new Date(a);e={};e.startDate=n.startDate;e.duration=n.duration;e.durationUnit=n.durationUnit;e.record=n;l._calculateEndDate(e);n.endDate=l._currentEditedRecord.endDate;r.startDateMapping&&(n.item[r.startDateMapping]=n.startDate);r.endDateMapping&&(n.item[r.endDateMapping]=n.endDate);break;case"leftResizing":if(nt="Resizing",s=n.left%r.perDayWidth,h=(n.left-s)/r.perDayWidth,u=s/r.perDayWidth,(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c=f==o.Day||f==o.Hour?24:r.secondsPerDay/3600,c&&u>0)var p=1/c,w=u/p,b=Math.round(w*60);a=n._startDateUpdate(a,h,b,r.workingTimeRanges,f);n.startDate=new Date(a);n.startDate.getTime()==n.endDate.getTime()&&t.isNullOrUndefined(n.isMilestone)&&n.isMilestone==!1&&n.duration==0&&(n.duration=1);e={};e.startDate=n.startDate;e.endDate=n.endDate;e.durationUnit=n.durationUnit;e.record=n;l._calculateDuration(e);n.duration=l._currentEditedRecord.duration;r.startDateMapping&&(n.item[r.startDateMapping]=n.startDate);r.durationMapping&&(n.item[r.durationMapping]=n.duration);break;case"rightResizing":if(nt="Resizing",f==o.Day||f==o.Hour?(tt=new Date(n.startDate),k=new Date(n.startDate),k.setHours(0,0,0,0),d=tt.getTime()-k.getTime(),g=d>0?n.width+d/864e5*r.perDayWidth:n.width,s=g%r.perDayWidth,h=(g-s)/r.perDayWidth,c=24):(s=n.width%r.perDayWidth,h=(n.width-s)/r.perDayWidth,c=r.secondsPerDay/3600),u=s/r.perDayWidth,v=new Date(n.startDate),(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c&&u>0)var p=1/c,w=u/p,b=Math.round(w*60);y=n._endDateUpdate(v,h-1,b,r.workingTimeRanges,f);n.endDate=new Date(y);e={};e.startDate=v;e.endDate=y;e.durationUnit=n.durationUnit;e.record=n;l._calculateDuration(e);n.duration=l._currentEditedRecord.duration;r.endDateMapping&&(n.item[r.endDateMapping]=n.endDate);r.durationMapping&&(n.item[r.durationMapping]=n.duration);break;case"progressResizing":n.status=l._getProgressPercent(n.width,n.progressWidth);r.progressMapping&&(n.item[r.progressMapping]=n.status)}},_calculateEndDate:function(n){var t=this;return t._trigger("calculateEndDate",n)},_calculateDuration:function(n){var t=this;return t._trigger("calculateDuration",n)},_drawFalseLine:function(n){var i=this,f=n.pageX,e=n.pageY,u=i._connectorPointX;y1=i._connectorPointY;t.isNullOrUndefined(n.pageX)?(x2=n.originalEvent.changedTouches[0].pageX-i._$bodyContent.offset().left,y2=n.originalEvent.changedTouches[0].pageY-i._$bodyContent.offset().top,f=Math.round(n.originalEvent.changedTouches[0].pageX),e=Math.round(n.originalEvent.changedTouches[0].pageY)):(x2=n.pageX-i._$bodyContent.offset().left,y2=n.pageY-i._$bodyContent.offset().top);var o=Math.sqrt((u-x2)*(u-x2)+(y1-y2)*(y1-y2)),s=Math.atan2(y2-y1,x2-u)*180/Math.PI,r="rotate("+s+"deg)";i._falseLine&&i._falseLine.remove();i._falseLine=t.buildTag("div.e-gantt-falseLine#ganttfalseline"+i._id,"",{},{});i._falseLine.css({"transform-origin":"0% 100%",right:"auto",position:"absolute",transform:r,"-ms-transform":r,"-moz-transform":r,"-webkit-transform":r,"-o-transform":r,"border-top-width":"2px","border-top-style":"dashed","z-index":"5"}).width(o-3).offset({left:u,top:y1});t.browserInfo().name=="msie"&&t.browserInfo().version<9||i._$bodyContent.append(i._falseLine);i._updateTooltipPosition(i._predecessorTooltip,f,e)},_mouseLeave:function(){var t=this;n(".progressbarresizer-right").css({"background-image":"none"});window.clearTimeout(t._tooltipTimer);t._clearTooltip();this._mouseDown==!1&&t._newXYPos?(n(t._leftResizerGripper).removeClass("gripper"),n(t._rightResizerGripper).removeClass("gripper"),t.model.progressMapping&&(n(t._progressHandle).removeClass("e-progresshandle"),n(t._progressHandleChild).removeClass("e-progresshandleafter")),t.model.predecessorMapping&&t.model.enablePredecessorEditing&&(n(t._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(t._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null)):t._mouseDown&&t._falseLine&&t.model.allowGanttChartEditing==!0&&t.model.enablePredecessorEditing&&t.model.readOnly==!1&&t._removeEditingElements()},_getMaxZIndex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==i||t==null)&&(t=1),t},_getOffsetRect:function(n){var r=n.getBoundingClientRect(),t=document.body,i=document.documentElement,u=window.pageYOffset||i.scrollTop||t.scrollTop,f=window.pageXOffset||i.scrollLeft||t.scrollLeft,e=i.clientTop||t.clientTop||0,o=i.clientLeft||t.clientLeft||0,s=r.top+u-e,h=r.left+f-o;return{top:Math.round(s),left:Math.round(h)}},_updateTooltipPosition:function(n,t,i,r){if(n&&n.length>0){var u=this,e=u._getOffsetRect(u._$bodyContainer[0]),o=e.top+u._$bodyContainer.height(),s=e.left+u._$bodyContainer.width(),h=u.model.rowHeight,f=0;t+n.width()+30>s?(f=t-n.width()-30,n.css("left",f+"px")):r?n.css("left",t+"px"):n.css("left",t+15+"px");r||i+n.height()+30>o?(f=r?i-n.height()-h:i-n.height()-30,n.css("top",f+"px")):n.css("top",i+10+"px")}},_mouseHover:function(i){var e=n(i.target),r=this,o=0,s=0,y=r.getGanttChartRows(),p=e.closest("tr.e-ganttrowcell"),f=e[0].parentNode,c,w=y.index(p),u=r.model.currentViewData[w],v,l,a,h;if(i.target.className=="e-parentContainer"||i.target.className=="e-gantt-milestone-container"||i.target.className=="e-childContainer")return!0;f=n(f).hasClass("e-gantt-childtaskbar-progress")?n(f).closest("div.e-childContainer")[0]:e.hasClass("e-tasklabel")?e.closest(".e-childContainer")[0]:n(f).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0];r._clearTooltip();r._newXYPos||(r._newXYPos=!0,r._mouseLeave());r._rightResizing==!1&&r._leftResizing==!1&&r._progressResizing==!1&&r._mouseDown==!1&&(r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(e.is(".e-gantt-childtaskbar,.e-tasklabel, .e-gantt-manualparenttaskbar")||e.closest(".e-gantt-childtaskbar").length)&&(i.target.style.cursor="move"),(i.type=="mouseenter"||i.type=="mousemove"||i.type=="touchstart")&&(i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(o=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(o=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(o=i.originalEvent.changedTouches[0].pageX,s=i.originalEvent.changedTouches[0].pageY),r._posX1=o,r._posY1=s,n(f).hasClass("e-childContainer")&&r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(r._leftResizerGripper=f.querySelector(".taskbarresizer-left"),r._rightResizerGripper=f.querySelector(".taskbarresizer-right"),c=f.querySelector(".progressbarresizer-right"),r._progressHandle=c&&c.firstChild,r._progressHandleChild=c&&c.childNodes[1],n(r._leftResizerGripper).addClass("gripper"),n(r._rightResizerGripper).addClass("gripper"),r.model.progressMapping&&r.model.enableProgressBarResizing&&(n(r._progressHandle).addClass("e-progresshandle"),n(r._progressHandleChild).addClass("e-progresshandleafter"))),(n(f).hasClass("e-childContainer")||n(f).hasClass("e-parentContainer"))&&r.model.predecessorMapping&&r.model.allowGanttChartEditing&&r.model.enablePredecessorEditing&&r.model.readOnly==!1?(r._leftConnectorPoint=f.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=f.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover"),n(f).hasClass("e-parentContainer")&&!u.isAutoSchedule&&(n(r._leftConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"))):(n(f).hasClass("e-gantt-milestone")||n(f).hasClass("e-gantt-milestone-container"))&&r.model.predecessorMapping&&r.model.allowGanttChartEditing&&r.model.enablePredecessorEditing&&r.model.readOnly==!1&&(a=f.parentNode,r._leftConnectorPoint=a.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=a.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")),u&&r.model.enableTaskbarTooltip&&!t.isTouchDevice()&&!n(e).hasClass("e-connectorpoint-hover")&&(r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,v=(n(e).hasClass("e-gantt-parenttaskbar-innerdiv")||n(e[0].parentNode).hasClass("e-gantt-parenttaskbar-innerdiv"))&&!u.isAutoSchedule?{ttipscheduleStartDate:this._getFormatedDate(u.manualStartDate,this.model.dateFormat,this.model.locale),ttipscheduleEndDate:this._getFormatedDate(u.manualEndDate,this.model.dateFormat,this.model.locale),ttipduration:u.manualDuration,ttipprogress:u.status.toString(),ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit}:n(e).hasClass("e-gantt-manualparenttaskbar")||n(e).hasClass("e-gantt-manualparenttaskbar-left")||n(e).hasClass("e-gantt-manualparenttaskbar-right")&&!u.isAutoSchedule?{ttipstartDate:this._getFormatedDate(u.startDate,this.model.dateFormat,this.model.locale),ttipsubtaskStartDate:this._getFormatedDate(u.manualStartDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(u.endDate,this.model.dateFormat,this.model.locale),ttipsubtaskEndDate:this._getFormatedDate(u.manualEndDate,this.model.dateFormat,this.model.locale),ttipduration:u.duration,ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit}:{ttipstartDate:this._getFormatedDate(u.startDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(u.endDate,this.model.dateFormat,this.model.locale),ttipduration:u.duration,ttipprogress:u.status.toString(),ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit},l=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),r.model.tooltipTemplate||r.model.tooltipTemplateId?r.model.tooltipTemplate?(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="Template",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](u),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)):r.model.tooltipTemplateId&&(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="TemplateID",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](u),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)):(r.tooltipState="",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](v),{},{}),l.append(h),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",l,{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r._mouseHoverTooltip.innerHTML="<table>"+l[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)),n(r._mouseHoverTooltip).addClass("customTooltip"))))},_createEditingTooltipTemplate:function(){var t=this,f,r=t.model.columnHeaderTexts,h=t.model.durationUnitTexts,e={_getStartDate:t._tooltipStartDate,_getEndDate:t._tooltipEndDate,_getTaskName:t._tooltipTaskName,_getProgress:t._tooltipProgress,_checkDuration:t._checkDuration},o=t.model.taskbarEditingTooltipTemplateId,s=t.model.taskbarEditingTooltipTemplate,i,u;e["_"+t._id+"getDuration"]=n.proxy(t._tooltipDuration,t);n.views.helpers(e);o?i=n("#"+o)[0].innerHTML:s?i=s:(i="<tr class='e-tooltip_rowcell'>",f="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='width:40px;text-align:left;' colspan='3';>{{:ttiptaskname}}<\/td>{{/if}}<\/tr><tr>{{if ~_getStartDate()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.startDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipstartDate}}<\/td> {{/if}}<\/tr><tr>{{if ~_getEndDate()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.endDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipendDate}}<\/td>{{/if}}<\/tr><tr>{{if ~_checkDuration()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.duration+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:~_"+t._id+"getDuration(#data)}}<\/td>{{/if}}<\/tr><tr>{{if ~_getProgress()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.status+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipprogress}}%<\/td>{{/if}}",i+=f,i+="<\/tr>");u={};u[t._id+"editingTooltipTemplate"]=i;n.templates(u)},_createProgressbarTooltipTemplate:function(){var t=this,u=t.model.progressbarTooltipTemplateId,f=t.model.progressbarTooltipTemplate,i,r;u?i=n("#"+t.model.progressbarTooltipTemplateId)[0].innerHTML:t.model.progressbarTooltipTemplate&&(i=t.model.progressbarTooltipTemplate);r={};r[t._id+"progressbarTooltipTemplate"]=i;n.templates(r)},_createTooltipTemplate:function(){var t=this,f,i=t.model.columnHeaderTexts,s=t.model.durationUnitTexts,e={_getStartDate:t._tooltipStartDate,_getSubtaskStartDate:t._tooltipSubtaskStartDate,_getScheduleStartDate:t._tooltipScheduleStartDate,_getEndDate:t._tooltipEndDate,_getSubtaskEndDate:t._tooltipSubtaskEndDate,_getScheduleEndDate:t._tooltipScheduleEndDate,_getTaskName:t._tooltipTaskName,_getProgress:t._tooltipProgress,_checkDuration:t._checkDuration},o=t.model.tooltipTemplateId,h=t.model.tooltipTemplate,r,u;e["_"+t._id+"getDuration"]=n.proxy(t._tooltipDuration,t);n.views.helpers(e);o?r=n("#"+t.model.tooltipTemplateId)[0].innerHTML:t.model.tooltipTemplate?r=t.model.tooltipTemplate:(r="<tr class='e-tooltip_rowcell'>",f="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='width:40px;text-align:left;' colspan='3';>{{:ttiptaskname}}<\/td>{{/if}}<\/tr>{{if ~_getStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.startDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipstartDate}}<\/td> {{/if}}<\/tr>{{if ~_getSubtaskStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.subTasksStartDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipsubtaskStartDate}}<\/td><\/tr>{{/if}}{{if ~_getScheduleStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.scheduleStartDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipscheduleStartDate}}<\/td><\/tr>{{/if}}{{if ~_getEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.endDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipendDate}}<\/td>{{/if}}<\/tr>{{if ~_getSubtaskEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.subTasksEndDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipsubtaskEndDate}}<\/td><\/tr>{{/if}}{{if ~_getScheduleEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.scheduleEndDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipscheduleEndDate}}<\/td><\/tr>{{/if}}{{if ~_checkDuration()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.duration+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:~_"+t._id+"getDuration(#data)}}<\/td>{{/if}}<\/tr>{{if ~_getProgress()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.status+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipprogress}}%<\/td>{{/if}}",r+=f,r+="<\/tr>");u={};u[t._id+"tooltipTemplate"]=r;n.templates(u)},_checkDuration:function(){return this.data.ttipduration},_tooltipTaskName:function(){return this.data.ttiptaskname},_tooltipProgress:function(){return this.data.ttipprogress},_tooltipStartDate:function(){return this.data.ttipstartDate},_tooltipSubtaskStartDate:function(){return this.data.ttipsubtaskStartDate},_tooltipScheduleStartDate:function(){return this.data.ttipscheduleStartDate},_tooltipEndDate:function(){return this.data.ttipendDate},_tooltipSubtaskEndDate:function(){return this.data.ttipsubtaskEndDate},_tooltipScheduleEndDate:function(){return this.data.ttipscheduleEndDate},_tooltipDuration:function(n){var r="",t;return n.ttipduration!=null&&n.ttipduration!=i&&(r+=n.ttipduration+" "),n.ttipdurationunit!=null&&n.ttipdurationunit!=i&&(t=n.ttipduration!=1,r+=n.ttipdurationunit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.ttipdurationunit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r},_getDurationUnits:function(){var n=this;return n.model.durationUnit==t.Gantt.DurationUnit.Hour?"hours":n.model.durationUnit==t.Gantt.DurationUnit.Minute?"minutes":"days"},_cellClickHandler:function(t){var f=n(t.target),v=f.closest("tr.e-ganttrowcell"),r=this,i=this.model,o={},u,s,y=f[0],h=r.getGanttChartRows(),c,e,l,a;if(s=u=h.index(f.parent()),u==-1&&(s=u=h.index(v)),!(n(y).hasClass("e-parentTask")||n(y).closest(".e-parentTask").length>0)||f.hasClass("e-connectorpoint-left")||f.hasClass("e-connectorpoint-right")){if(u!=-1&&i.allowSelection){if(e=i.currentViewData[u],u=i.updatedRecords.indexOf(e),i.selectionMode=="row"){if(r._rowSelectingEventTrigger(i.selectedRowIndex,u))return;r.selectRows(u);r.focusGanttElement();r._rowSelectedEventTrigger(u)}i.selectionMode=="cell"&&(r.model.selectedItem=e)}}else c=h.index(v),e=i.currentViewData[c],recordIndex=i.updatedRecords.indexOf(e),r._allowExpandCollapse&&e&&e.hasChildRecords&&(r._trigger("cancelEditCell"),i.selectedRowIndex!==recordIndex&&i.allowSelection&&recordIndex!==-1&&(r._rowSelectingEventTrigger(i.selectedRowIndex,recordIndex)||(r.selectRows(recordIndex),r._rowSelectedEventTrigger(recordIndex))),r._expandCollapse(c));i.taskbarClick&&(f.is(".e-childContainer,.e-gantt-milestone-container,.e-parentContainer")||(l=f.closest(".e-childContainer,.e-gantt-milestone-container,.e-parentContainer"),l.length&&(o={},a=i.currentViewData[s],s=i.updatedRecords.indexOf(a),o.data=a,o.index=s,o.taskbarElement=l[0],o.target=f[0],this._trigger("taskbarClick",o))))},getRowByIndex:function(i,r){var e,o;try{var u=this,f=u.getGanttChartRows(),s=n(f),h=n();return u.model.enableVirtualization&&(e=u.model.updatedRecords[i],i=u.model.currentViewData.indexOf(e)),t.isNullOrUndefined(r)?(u.model.enableVirtualization&&(o=u.model.updatedRecords[r],r=u.model.currentViewData.indexOf(o)),n(f[i])):n(s.slice(i,r))}catch(c){return n()}},selectRows:function(n){var t=this,r=this.model,f=t.getGanttChartRows(),i,u;r.allowSelection&&r.selectionMode!="cell"&&(t.prevSelectedItem&&(t.prevSelectedItem.isSelected=!1),f.removeClass("e-gantt-mouseclick"),u=t.getRowByIndex(n),t.model.allowSelection&&u.addClass("e-gantt-mouseclick"),t.model.selectedRowIndex=n,i=t.model.updatedRecords[n],i&&(i.isSelected=!0),t.model.selectedItem=i,t.prevSelectedItem=i)},updateSelectedItem:function(t){var i=this,r=n(i.getGanttChartRows());r.removeClass("e-gantt-mouseclick");i.model.updatedRecords[t].isSelected=!0;i.model.selectedItem=i.model.updatedRecords[t];this._refresh();i._rowSelectedEventTrigger(t)},ganttrowHover:function(t){var r=this,i;r.model.enableRowHover&&(i=r.getGanttChartRows(),i.removeClass("e-gantt_mousehover").addClass("e-gantt_mouseleave"),n(i[t]).addClass("e-gantt_mousehover").removeClass("e-gantt_mouseleave"))},_rowHover:function(t){var i=this,e=n(t.target),f,u={},r,o;return i.model.enableRowHover?(f=n(i.getGanttChartRows()),r=f.index(e.parent()),r==-1&&(o=e.closest("tr.e-ganttrowcell"),r=f.index(o)),u.index=r,t.type=="mouseenter"?(u.reason="mouseenter",i.addRowHover(r)):(u.reason="mouseleave",i.removeRowHover()),i._trigger("rowHover",u),!1):!1},addRowHover:function(t){var i=this.getGanttChartRows();t!=null&&t!=-1&&n(i[t]).addClass("e-enablerowhover")},removeRowHover:function(){var n=this.getGanttChartRows();n.removeClass("e-enablerowhover")},updateHeight:function(i){var r=this,f=r.model,u;r._setScrollTop();r._containerHeight=i;n("#ganttviewerbodyContent"+r._id+"").css({height:r._containerHeight+"px"});f.stripLines&&n(r.element).find(".e-stripline,.e-stripLines").css({height:i+"px"});f.holidays&&n(r.element).find(".e-holidays,.e-holiday").css({height:i+"px"});n(".e-secondary_canvas").css({height:i+"px"});n(r.element).find(".e-weekends").css({height:i+"px"});u=".e-holiday-label";t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(u=".e-holiday-label-ie8");i<r._viewportHeight?i<=f.rowHeight?n(r.element).find(u).css({top:-i-30}):n(r.element).find(u).css({top:i/2}):n(r.element).find(u).css({top:r._viewportHeight/2});i==0&&r._$bodyContent.css({height:"1px"});r._$bodyContainer.ejScroller("refresh");parseInt(r._$bodyContainer.css("height"))!=r._viewportHeight&&r._$bodyContainer.css("height",r._viewportHeight)},_completeAction:function(n){var t=this;return n.vscrollExsist=t._$bodyContainer.ejScroller("isVScroll"),t._trigger("actionComplete",n),n.requestType==="validatePredecessor"?n.predecessorValidation:void 0},_taskbarEditing:function(n){var t=this;t._trigger("taskbarEditing",n)},_taskbarEdited:function(n){var t=this;t._trigger("taskbarEdited",n)},_queryTaskbarinfo:function(n){this._trigger("queryTaskbarInfo",n);this._updateTaskbarItems(n)},_refreshRow:function(n){var t=this;t._trigger("refreshRow",n)},_enbleZooming:function(n){var t=this;t._trigger("zooming",n)},_updateManualTaskbarItem:function(n,i){var y=i.querySelector(".e-gantt-parenttaskbar-innerdiv"),o=i.querySelector(".e-gantt-parenttaskbar-progress"),s=i.querySelector(".e-gantt-manualparenttaskbar"),h=i.querySelector(".e-gantt-manualparenttaskbar-left"),c=i.querySelector(".e-gantt-manualparenttaskbar-right"),l=i.querySelector(".taskbarresizer-right"),u=y.style,e=o&&o.style,f=s&&s.style,p=h&&h.style,a=c&&c.style,w=l&&l.style,v,r;v=n.model.renderBaseline?model.taskbarHeight-9:model.taskbarHeight-10;r=v/5;t.isNullOrUndefined(n.manualParentTaskbarBackground)||f.backgroundColor==n.manualParentTaskbarBackground||(f.backgroundColor=n.manualParentTaskbarBackground,p.borderColor=n.manualParentTaskbarBackground,a.borderColor=n.manualParentTaskbarBackground);f.width=n.data.width+"px";f.left=n.data.left+"px";a.left=n.data.width-parseInt(r)+"px";w.left=n.data.width-parseInt(r)+"px";n.data.width==n.data.manualWidth&&n.data.left==n.data.manualLeft?(e.width=n.data.progressWidth-r*2+"px",u.width=n.data.manualWidth-r*2+"px",u.left=n.data.manualLeft+r+"px"):n.data.left==n.data.manualLeft?(u.left=n.data.manualLeft+r+"px",e.width=n.data.progressWidth-r+"px",u.width=n.data.manualWidth-r+"px"):(e.width=n.data.progressWidth+"px",u.width=n.data.manualWidth+"px",u.left=n.data.manualLeft+"px")},_updateTaskbarItems:function(t){var g=this.getGanttChartRows(),nt=this.model.currentViewData.indexOf(t.data),i=g[nt],f,e,c,a,v,y,p,w,b;if(i){if(n(i).find(".e-gantt-milestone-container").closest("div").length>0&&(e=n(i).find(".e-gantt-milestone-container").closest("div")[0]),n(i).find(".e-baselinebar").closest("div").length>0&&(c=n(i).find(".e-baselinebar").closest("div")[0]),n(i).find(".e-parentContainer").closest("div").length>0){var f=n(i).find(".e-parentContainer").closest("div")[0],tt=f.querySelector(".e-gantt-parenttaskbar-innerdiv"),k=f.querySelector(".e-gantt-parenttaskbar-progress"),o=tt.style,r=k&&k.style;o.backgroundColor!=t.parentTaskbarBackground&&(o.backgroundColor=t.parentTaskbarBackground);r&&r.backgroundColor!=t.parentProgressbarBackground&&(r.backgroundColor=t.parentProgressbarBackground);o.borderColor!=t.parentTaskbarBorder&&(o.borderColor=t.parentTaskbarBorder);r&&r.borderColor!=t.parentProgressbarBorder&&(r.borderColor=t.parentProgressbarBorder);!t.data.isAutoSchedule&&t.data.hasChildRecords&&this._updateManualTaskbarItem(t,f);r&&r.borderColor!=t.parentProgressbarBorder&&(r.borderColor=t.parentProgressbarBorder)}else if(n(i).find(".e-childContainer").closest("div").length>0){var f=n(i).find(".e-childContainer").closest("div")[0],it=f.querySelector(".e-gantt-childtaskbar"),u=f.querySelector(".e-gantt-childtaskbar-progress"),s=it.style,h=u&&u.style,d=u&&u.querySelector(".e-tasklabel"),l=d&&d.style;s.backgroundColor!=t.taskbarBackground&&(s.backgroundColor=t.taskbarBackground);u&&h.backgroundColor!=t.progressbarBackground&&(h.backgroundColor=t.progressbarBackground);s.borderColor!=t.taskbarBorder&&(s.borderColor=t.taskbarBorder);u&&h.borderColor!=t.progressbarBorder&&(h.borderColor=t.progressbarBorder);l&&l.color!=t.taskbarTextColor&&(l.color=t.taskbarTextColor)}n(e).length>0&&(a=e.querySelector(".e-gantt-milestone.milestone-top"),v=e.querySelector(".e-gantt-milestone.milestone-bottom"),a&&v?(y=a.style,p=v.style,p.borderBottomColor!=t.milestoneBackground&&y.borderTopColor!=t.milestoneBackground&&(p.borderTopColor=t.milestoneBackground,y.borderBottomColor=t.milestoneBackground)):this.model.milestoneTemplate&&(w=e.querySelector(".e-gantt-milestone"),w.style.backgroundColor!=t.milestoneBackground&&(w.style.backgroundColor=t.milestoneBackground)));n(c).hasClass("e-baselinebar")&&(b=c.style,b.backgroundColor!=t.baselineBackground&&(b.backgroundColor=t.baselineBackground))}},_expandCollapse:function(n){var i=this,t={},r=i.model.currentViewData[n];t.data=r;t.recordIndex=i.model.updatedRecords&&i.model.updatedRecords.indexOf(r);t.source="ganttChart";t.expanded=!r.expanded;r&&(t.expanded?i._trigger("expanding",t):i._trigger("collapsing",t))},_getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this._getExpandStatus(t.parentItem):!0:!0},onScrollHelper:function(t,i){var r=this,u,f,e;if(!r._$bodyContainer.ejScroller("isVScroll"))return!1;r._mouseLeave();i||r._$bodyContainer.ejScroller("option","scrollTop",t);u=model.rowHeight;n("#"+this._$ganttViewTablebody[0].id).find("tr:first")[0]&&(u=n("#"+this._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height);f=parseInt(r.model.updatedRecords.length*u)-(r._viewportHeight-18);t>f&&(t=f);t<0&&(t=0);e={scrollTop:t};r._handleScroll(e);this.model.isCriticalPathEnable==!0&&this.model.enableVirtualization==!0&&this.criticalConnectorLine(this.model.criticalPathCollection,this.model.detailPredecessorCollection,!0,this.collectionTaskId)},_handleScroll:function(n){var t=this,n=n||{},f=t._$headerContainer,o=t._$bodyContainer,r=t._prevLeft,u,e;n.scrollTop!==i&&(t._scrollTop=n.scrollTop);n.scrollLeft!==i&&(r=n.scrollLeft);u=r-t._prevLeft;e=t._scrollTop-t._prevScrollTop;u?f.scrollLeft(r):f.scrollLeft(t._prevLeft);t.model.enableVirtualization&&(t._vscrollDist=Math.abs(t._scrollTop-t._prevScrollTop),t._vscrollDist&&(t._vScrollDir=t._prevScrollTop<=t._scrollTop?1:-1,t._updateCurrentViewData(),t.renderGanttRecords(),t._prevScrollTop=t._scrollTop));n.requestType="scroll";n.delta=t._scrollTop;t._prevLeft=r;t._prevScrollTop=t._scrollTop;u===0&&e!==0&&t._completeAction(n)},refreshHelper:function(n,t,r){var u=this;u.model.currentViewData=n;u.model.updatedRecords=t;u._totalCollapsedRecordCount=r!=i?r:0;t&&(u._refresh(),u._setHeight(t.length*u.model.rowHeight),u.updateHeight((t.length-u._totalCollapsedRecordCount)*u.model.rowHeight))},_setScrollTop:function(){var n=this,r=this.model,i=n._scrollTop,t;r.enableVirtualization&&i!==0&&n.model.currentViewData.length*n.model.rowHeight<n._viewportHeight&&(t=i-(n._viewportHeight-n.model.currentViewData.length*n.model.rowHeight),t<0&&(t=0),n._$bodyContainer.ejScroller("scrollY",t,!0))},refreshGridLinesTable:function(n){var t=this;t._$gridLinesTablebody.empty().append(t._createGridLinesTableRow(n));t._$bodyContainer.ejScroller("refresh");parseInt(t._$bodyContainer.css("height"))!=t._viewportHeight&&t._$bodyContainer.css("height",t._viewportHeight)},_refresh:function(){var i=this,r=i.model,u=n.render[i._id+"_CustomTemplate2"](i.model.currentViewData);i._$ganttViewTablebody=n("#ganttViewTablebody"+i._id+"");i._$ganttViewTablebody.empty().append(u);r.enableVirtualization?i._$gridLinesTablebody.empty().append(i._createGridLinesTableRow(i.model.currentViewData.length)):i._$gridLinesTablebody.empty().append(i._createGridLinesTableRow(i.model.currentViewData.length-i._totalCollapsedRecordCount));i._$ganttViewTablebody[0]!=null?this._ganttChartRows=n(i._$ganttViewTablebody[0].childNodes):(i._$ganttViewTablebody=t.buildTag("tbody.e-gantt-viewer-ganttViewTablebody#ganttViewTablebody"+i._id+"",u,{},{}),i._ganttChartRows=n(i._$ganttViewTablebody[0].childNodes));r.queryTaskbarInfo&&i._eventBindings()},refreshRow:function(t){var i=this,u=this.model,f=n(i.getGanttChartRows()[t]),r=i.model.currentViewData[t];!u.allowSelection&&r&&(r.isSelected=!1);t!=-1&&r&&(f.replaceWith(n.render[i._id+"_CustomTemplate2"](r)),i._setGanttChartRows(n(i._$ganttViewTablebody[0].childNodes)));u.queryTaskbarInfo&&i._refreshedRowEventBinding(t)},_refreshedRowEventBinding:function(t){var a=n(this.getGanttChartRows()),r,i={},u,e,o,s,f,h,c,l;r=a[t];n(r).hasClass("e-ganttrowcell")&&(f=n(r).find("td.e-chartcell").has("div.e-childContainer,div.e-parentContainer,div.e-gantt-milestone")[0].firstChild,n(r).find(".e-gantt-milestone-container").closest("div").length>0&&(h=n(r).find(".e-gantt-milestone-container").closest("div")[0]),n(r).find(".e-baselinebar").closest("div").length>0&&(l=n(r).find(".e-baselinebar").closest("div")[0]),n(f).hasClass("e-parentContainer")?(s=f.querySelector(".e-gantt-parenttaskbar-innerdiv"),o=f.querySelector(".e-gantt-parenttaskbar-progress")):n(f).hasClass("e-childContainer")&&(e=f.querySelector(".e-gantt-childtaskbar"),u=f.querySelector(".e-gantt-childtaskbar-progress"),c=u&&u.querySelector(".e-tasklabel")),i.data=this.model.currentViewData[t],i.taskbar=r,i.taskbarBackground=e!=null?e.style.backgroundColor:null,i.progressbarBackground=u!=null?u.style.backgroundColor:null,i.parentTaskbarBackground=s!=null?s.style.backgroundColor:null,i.parentProgressbarBackground=o!=null?o.style.backgroundColor:null,i.parentProgressbarBorder=o!=null?o.style.border:null,i.progressbarBorder=u!=null?u.style.border:null,i.taskbarBorder=e!=null?e.style.border:null,i.parentTaskbarBorder=s!=null?s.style.border:null,i.taskbarTextColor=c!=null?c.style.color:null,i.baselineBackground=l!=null?l.style.backgroundColor:null,i.milestoneBackground=h!=null?h.style.backgroundColor:null,this._queryTaskbarinfo(i))},refreshScroller:function(n){var t=this,r,u,i,f,e;t._$bodyContainer.find("div.e-content").removeClass("e-borderbox");u=t._$bodyContainer.ejScroller("option","scrollTop");i=t._$bodyContainer.ejScroller("option","scrollLeft");t._$bodyContainer.ejScroller("option",{width:n});t._$bodyContainer.ejScroller("refresh");r=t.getMaxScrollWidth();i>r&&(i=r>0?r:0);f=t._$bodyContainer.ejScroller("isHScroll");f?t._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):t._$bodyContainer.find("div.e-content").addClass("e-borderbox");e=t._$bodyContainer.ejScroller("isVScroll");e&&t._$bodyContainer.ejScroller("scrollY",u,!0);t._$bodyContainer.ejScroller("option","scrollLeft",i);t._$headerContainer.scrollLeft(i)},getMaxScrollWidth:function(){var n=this;return n._$bodyContainer.children(".e-content").children().width()-n._$bodyContainer.children(".e-content").width()},refreshStripLines:function(n){var t=this;n&&(this.model.stripLines=n);t._$stripLineContainer.empty();this._renderStripLines(this.model.stripLines)},refreshHolidays:function(n){var t=this,r,i;if(n&&(t.model.holidays=n),t._$secondaryCanvas.empty(),t.model.holidays!=null)for(r=t.model.holidays.length,i=0;i<r;i++)t._renderHoliday(t.model.holidays[i])},renderNewAddedRow:function(t,i){var r=this,f=r.model,u=n.render[this._id+"_CustomTemplate2"](i);r._ganttChartRows.length!=0?r._ganttChartRows.length==t?r.getGanttChartRows().eq(t-1).after(u):r.getGanttChartRows().eq(t).before(u):r._refresh();r._setGanttChartRows(n(r._$ganttViewTablebody[0].childNodes));r._$gridLinesTablebody.empty().append(r._createGridLinesTableRow(r.model.updatedRecords.length-r._totalCollapsedRecordCount));f.enableVirtualization===!1?r._setHeight((r.model.updatedRecords.length-r._totalCollapsedRecordCount)*r.model.rowHeight):r._setHeight(r.model.updatedRecords.length*r.model.rowHeight);r.updateHeight(r._containerHeight)},_setGanttChartRows:function(n){this._ganttChartRows=n},refreshChartHeader:function(i,r){var u=this,s=u.model,f=s.scheduleHeaderSettings.scheduleHeaderType,l,v,h,e,c,a,o,y;u._updateScheduleWidth();f=="hour"?u._createScheduleTopHourTemplate():f=="day"?u._createScheduleTopDayTemplate():f=="week"?u._createScheduleWeekTemplate():f=="month"?u._createScheduleTopMonthTemplate():f=="year"&&u._createScheduleYearTemplate();i=i==null?new Date:i;r=r==null?new Date(null):r;u._$scheduleDiv.empty();o=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"});l=t.buildTag("colgroup","",{},{});v=n(document.createElement("col"));v.css("width",u._getScheduleLength(f)+"px");l.append(v);h=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});f=="week"?e=t.buildTag("tr",n.render[this._id+"ScheduleWeekTemplate"](s.scheduleWeeks),{},{}):f=="year"?e=t.buildTag("tr",n.render[this._id+"ScheduleYearTemplate"](s.scheduleYears),{},{}):f=="month"?e=t.buildTag("tr",n.render[this._id+"ScheduleTopMonthTemplate"](s.scheduleMonths),{},{}):f=="day"?e=t.buildTag("tr",n.render[this._id+"ScheduleTopDayTemplate"](s.scheduleDays),{},{}):f=="hour"&&(e=t.buildTag("tr",n.render[this._id+"ScheduleTopHourTemplate"](s.scheduleHours),{},{}));c=t.buildTag("th.schedule","",{},{});a=t.buildTag("div.schedule","",{width:"20px"},{});c.append(a);e.append(c);h.append(e);o.append(l);o.append(h);u._$scheduleDiv.append(o);e=null;f=="hour"?u._createMinuteTemplate():f=="day"?u._createScheduleHourTemplate():f=="week"?u._createScheduleDayTemplate():f=="month"?u._createScheduleBottomWeekTemplate():f=="year"&&u._createScheduleMonthTemplate();o=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"});h=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});y=u._getScheduleMonth(new Date(s.scheduleYears[0]),r);f=="week"&&(e=t.buildTag("tr",n.render[this._id+"_CustomTemplate1"](u.model.scheduleWeeks),{},{}));f=="year"&&(e=t.buildTag("tr",n.render[this._id+"ScheduleMonthTemplate"](y),{},{}));f=="month"&&(u._numOfWeeks=u._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate),e=t.buildTag("tr",n.render[this._id+"ScheduleBottomWeekTemplate"](u._numOfWeeks),{},{}));f=="day"&&(e=t.buildTag("tr",n.render[this._id+"scheduleHourTemplate"](u._getScheduleHours()),{},{}));f=="hour"&&(e=t.buildTag("tr",n.render[this._id+"scheduleMinuteTemplate"](u._getScheduleMinutes()),{},{}));c=t.buildTag("th.schedule","",{},{});a=t.buildTag("div.schedule","",{width:"20px"},{});c.append(a);e.append(c);h.append(e);o.append(l);o.append(h);u._$scheduleDiv.append(o)},refreshContainersWidth:function(){var t=this,i,f=this.model,e=f.scheduleHeaderSettings.scheduleHeaderType,u,r;if(i=t._getScheduleLength(e),$gridLineContainerTable=n("#ganttgridLinesTable"+t._id),t._$bodyContent.width(i),t.refreshWeekEndContainer(),$gridLineContainerTable.width(i),$gridLineContainerTable.children("col").width(i),t._$ganttViewTable.width(i),t._$ganttViewTable.children("col").width(i),t._createTaskbarTemplate(),t._updateCurrentViewData(),t._$secondaryCanvas.empty(),t._$stripLineContainer.empty(),t.model.stripLines!=null&&this._renderStripLines(t.model.stripLines),t.model.holidays!=null)for(u=t.model.holidays.length,r=0;r<u;r++)t._renderHoliday(t.model.holidays[r])},refreshWeekEndContainer:function(){var n=this,l=n.model,i=0,o=n.model.perDayWidth+1,s=n.model.updatedRecords.length*this.model.rowHeight,a=n.model.scheduleWeeks.length,h,c,u=l.scheduleHeaderSettings.weekStartDay,v=u>=0&&u<7?u:0,f=6-v,y=f+1==7?0:f+1,r=n._$weekendsContainer.children(".e-secondary_canvas"),e;for(r.empty(),e=0;e<a;e++)h=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*y+"px",width:o+"px",height:s+"px","background-color":this.model.weekendBackground},{}),c=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*f+"px",width:o+"px",height:s+"px","background-color":this.model.weekendBackground},{}),r.append(h),r.append(c),i=i+this._scheduleWeekWidth;n._$weekendsContainer.append(r)},deleteChartRows:function(n,t){for(var r=this,u=r.getGanttChartRows(),i=n;i<n+t;i++)u.splice(i,1)},_eventBindings:function(){var v=n(this.getGanttChartRows()),y=v.length,i,t={},u,f,e,h,o,r,c,l,a,s;if(y!=0)for(s=0;s<y;s++)i=v[s],n(i).hasClass("e-ganttrowcell")&&(r=n(i).find("td.e-chartcell").has("div.e-childContainer,div.e-parentContainer,div.e-gantt-milestone")[0].firstChild,n(i).find(".e-gantt-milestone-container").closest("div").length>0&&(c=n(i).find(".e-gantt-milestone-container").closest("div")[0]),n(i).find(".e-baselinebar").closest("div").length>0&&(a=n(i).find(".e-baselinebar").closest("div")[0]),n(r).hasClass("e-parentContainer")?(o=r.querySelector(".e-gantt-parenttaskbar-innerdiv"),e=r.querySelector(".e-gantt-parenttaskbar-progress"),h=r.querySelector(".e-gantt-manualparenttaskbar")):n(r).hasClass("e-childContainer")&&(f=r.querySelector(".e-gantt-childtaskbar"),u=r.querySelector(".e-gantt-childtaskbar-progress"),l=u&&u.querySelector(".e-tasklabel")),t.data=this.model.currentViewData[s],t.taskbar=i,t.taskbarBackground=f!=null?f.style.backgroundColor:null,t.progressbarBackground=u!=null?u.style.backgroundColor:null,t.parentTaskbarBackground=o!=null?o.style.backgroundColor:null,t.parentProgressbarBackground=e!=null?e.style.backgroundColor:null,t.parentProgressbarBorder=e!=null?e.style.border:null,t.progressbarBorder=u!=null?u.style.border:null,t.taskbarBorder=f!=null?f.style.border:null,t.parentTaskbarBorder=o!=null?o.style.border:null,t.taskbarTextColor=l!=null?l.style.color:null,t.baselineBackground=a!=null?a.style.backgroundColor:null,t.milestoneBackground=c!=null?c.style.backgroundColor:null,t.data.hasChildRecords&&!t.data.isAutoSchedule&&(t.manualParentTaskbarBackground=h!=null?h.style.backgroundColor:null),this._queryTaskbarinfo(t))},_updateCurrentViewData:function(){var t=this,i=0;this.model.enableVirtualization?(this._getRenderedRowRange(),this.model.currentViewData=this.model.updatedRecords.slice(t._renderedRange.top,t._renderedRange.bottom),t._vscrollDist!==0&&(i=t._scrollTop,i-=t._rowMargin,n("#ganttViewTable"+t._id+"").css({top:i+"px"}),n("#ganttgridLinesTable"+t._id+"").css({top:i+"px"})),t._vTop=t._visibleRange.top,t._vBottom=t._visibleRange.bottom,t._rTop=t._renderedRange.top,t._rBottom=t._renderedRange.bottom):this.model.currentViewData=this.model.updatedRecords},renderGanttRecords:function(){var n=this;n._refresh();n._$ganttViewTable.append(n._$ganttViewTablebody);n._$bodyContent.append(n._$ganttViewTable)},_getRenderedRowRange:function(){var n=this,t,i;return n._getVisibleRowRange(),t=n._visibleRange.top,i=n._visibleRange.bottom,n._renderedRange={top:t,bottom:i},n._renderedRange},_getVisibleRowRange:function(){var n=this,r=n._scrollTop/n.model.rowHeight,f=r-Math.floor(r),t,i,u;n._rowMargin=f*n.model.rowHeight;t=Math.floor(r);u=n.model.updatedRecords.length;i=n._getrowposition(n._scrollTop+n._viewportHeight);t=Math.max(0,t);i=Math.min(u,i);n._visibleRange={top:t,bottom:i}},_getrowposition:function(n){return Math.ceil(n/this.model.rowHeight)},_getDateType:function(n){return n instanceof Date?n:n!=null?t.parseDate(n,this.model.dateFormat,this.model.locale):null},_getDateFromFormat:function(n){return typeof n=="object"?new Date(n):n?t.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):t.parseDate(n,this.model.dateFormat,this.model.locale):void 0},_createScheduleTopDayTemplate:function(){var t=this,r=t.model,f=r.scheduleHeaderSettings.dayHeaderFormat==""&&r.scheduleHeaderSettings.scheduleHeaderType=="day"?"ddd":r.scheduleHeaderSettings.dayHeaderFormat,e={renderDayTop:n.proxy(t._getDaySplit,t)},i,u;n.views.helpers(e);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:"+t.model.perHourWidth*24+"px;'>";td="<div class='e-schedule-week-headercell-content' style='width:"+(t.model.perHourWidth*24-1)+"px;box-sizing:border-box;margin:auto;white-space:nowrap;'>{{:~renderDayTop('"+f+"',#data)}}<\/div><\/div>";i+=td;i+="<\/th>";u={};u[t._id+"ScheduleTopDayTemplate"]=i;n.templates(u)},_getDaySplit:function(n,i){var r=new Date(i),f=this,u=f.model;switch(n){case"D":case"d":return r.getDate();case"DD":case"dd":return("0"+r.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(r,n,u.locale)}return t.format(r,n,u.locale)},_createScheduleTopMonthTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.monthHeaderFormat,o={renderMonthTop:n.proxy(t._getMonthsplit,t),setMonthWidth:n.proxy(t._setMonthWidth,t),isLastMonth:n.proxy(t._checkLastMonthWidth,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:{{:~setMonthWidth(#data)}}px;'>";u="<div class='e-schedule-week-headercell-content' style='box-sizing:border-box;-moz-box-sizing:border-box;margin:auto;white-space:nowrap;width:{{:~setMonthWidth(#data)-1}}px;'>{{:~renderMonthTop('"+e+"',#data)}}<\/div>{{if ~isLastMonth(#data)}}<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;'><div class='e-schedule-week-headercell-content' style='box-sizing:border-box;-moz-box-sizing:border-box;margin:auto;white-space:nowrap;width:"+(t._balanceWidth-1)+"px;'><\/div><\/th>{{/if}}";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleTopMonthTemplate"]=i;n.templates(r)},_setMonthWidth:function(n){var e=this,i,u,r,f;return(i=typeof n=="object"?new Date(n):t.parseDate(n,this.model.dateFormat,this.model.locale),u=new Date(i.getFullYear(),i.getMonth()+1,0),r=u.getDate(),i.getTime()===e.model.scheduleMonths[0].getTime())?(f=u.getDate()-i.getDate(),this.model.perDayWidth*(f+1)):r==31?this.model.perDayWidth*31:r==30?this.model.perDayWidth*30:r==28?this.model.perDayWidth*28:r==29?this.model.perDayWidth*29:void 0},_checkLastMonthWidth:function(n){var t=this;return n==t.model.scheduleMonths[t.model.scheduleMonths.length-1]&&t._balanceWidth>0?!0:!1},_getMonthsplit:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_createScheduleYearTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.yearHeaderFormat,o={renderYear:n.proxy(t._getYearsplit,t),getYearWidth:n.proxy(t._getTemplateYearWidth,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:{{:~getYearWidth(#data)}}px;'>";u="<div class='e-schedule-week-headercell-content' style='margin:auto;white-space:nowrap;width:{{:~getYearWidth(#data)-1}}px;box-sizing:border-box;-moz-box-sizing:border-box;'>{{:~renderYear('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleYearTemplate"]=i;n.templates(r)},_getYearsplit:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_getMonthWidthForYearMode:function(n){for(var u,o=this,e=o.model,n,i=0,f=n.getMonth();f<12;f++){u=n;n=typeof u=="object"?new Date(u):t.parseDate(u,e.dateFormat,e.locale);var s=new Date(n.getFullYear(),n.getMonth()+1,0),h=n.getDate(),r=s.getDate();h!=1?i+=r-n.getDate():r==31?i+=31:r==30?i+=30:r==28?i+=28:r==29&&(i+=29);n=new Date(n.getFullYear(),f+1,1)}return i},_getTemplateYearWidth:function(n){var i=n.getFullYear(),t=this._getMonthWidthForYearMode(n);return t*this.model.perDayWidth},_createScheduleWeekTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.weekHeaderFormat,o={renderWeek:n.proxy(t._getWeeksplit,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:"+t._scheduleWeekWidth+"px;'>";u="<div class='e-schedule-week-headercell-content' style='width:"+(t._scheduleWeekWidth-1)+"px;box-sizing:border-box;margin:auto;white-space:nowrap;'>{{:~renderWeek('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleWeekTemplate"]=i;n.templates(r)},_getWeeksplit:function(n,i){var u=new Date(i),f=this,e=f.model,r;return r=t.format(u,n,e.locale),r.toLowerCase().replace(/(-(\w)|(^| )(\w)|:(\w)|,(\w)|\/(\w)|\.(\w))/g,function(n){return n.toUpperCase()})},_createScheduleHourTemplate:function(){var t=this,f=t.model,u,e=f.scheduleHeaderSettings.hourHeaderFormat,o={renderHour:n.proxy(t._getHourTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perHourWidth+"px;'>";u="<div class='e-schedule-day-headercell-content' style='width:"+(t.model.perHourWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"scheduleHourTemplate"]=i;n.templates(r)},_createScheduleTopHourTemplate:function(){var t=this,e=t.model,r=e.minuteInterval,o,i,s=e.scheduleHeaderSettings.hourHeaderFormat,h={renderHour:n.proxy(t._getHourTemplate,t)},u,f;r==30&&(i=2);r==15&&(i=4);r==5&&(i=12);r==1&&(i=60);t._totalInterval=i;n.views.helpers(h);u="<th class='e-schedule-hour-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perMinuteWidth*i+"px;'>";o="<div class='e-schedule-hour-headercell-content' style='width:"+(t.model.perMinuteWidth*i-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+s+"',#data)}}<\/div>";u+=o;u+="<\/th>";f={};f[t._id+"ScheduleTopHourTemplate"]=u;n.templates(f)},_createMinuteTemplate:function(){var t=this,f=t.model,u,e=f.scheduleHeaderSettings.minuteHeaderFormat,o={renderHour:n.proxy(t._getHourTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-hour-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perMinuteWidth+"px;'>";u="<div class='e-schedule-hour-headercell-content' style='width:"+(t.model.perMinuteWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"scheduleMinuteTemplate"]=i;n.templates(r)},_getHourTemplate:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_createScheduleBottomWeekTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.weekHeaderFormat,o={renderWeek:n.proxy(t._getMonthWeekTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perWeekWidth+"px;'>";u="<div class='e-schedule-day-headercell-content' style='position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;padding-left:2px;width:"+(t.model.perWeekWidth-1)+"px;'>{{:~renderWeek('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleBottomWeekTemplate"]=i;n.templates(r)},_getMonthWeekTemplate:function(n,i){var r=new Date(i),u=this,f=u.model;switch(n){case"d":case"dd":case"ddd":default:return t.format(r,n,f.locale)}},_createScheduleMonthTemplate:function(){var t=this,u=t.model,f=u.scheduleHeaderSettings.monthHeaderFormat,e={renderMonth:n.proxy(t._getMonthTemplate,t),getMonthWidth:n.proxy(t._setMonthWidthYearMode,t)},r,i;n.views.helpers(e);r="<th class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:{{:~getMonthWidth(#data)}}px;'><div class='e-schedule-day-headercell-content' style='position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;width:{{:~getMonthWidth(#data)-1}}px;'>{{:~renderMonth('"+f+"',#data)}}<\/div><\/th>";i={};i[t._id+"ScheduleMonthTemplate"]=r;n.templates(i)},_getMonthTemplate:function(n,i){var r=new Date(i),f=this,u=f.model;switch(n){case"M":case"m":return("0"+r.getDate()).slice(-2);case"MM":case"mm":return r.getDate();case"MMM":case"mmm":case"MMMM":case"mmmm":return t.format(r,n,u.locale);default:return t.format(r,n,u.locale)}},_setMonthWidthYearMode:function(n){var f=this,i=new Date(n),r=new Date(i.getFullYear(),i.getMonth()+1,0),u=i.getDate(),t=r.getDate();return u!=1?this.model.perDayWidth*(t-i.getDate()):t==31?this.model.perDayWidth*31:t==30?this.model.perDayWidth*30:t==28?this.model.perDayWidth*28:t==29?this.model.perDayWidth*29:void 0},_getHeaderWeek:function(n,t){var i=new Date(t),r;return i.setDate(i.getDate()+n),r=i.getDay(),r==0||r==6?!0:void 0},_createScheduleDayTemplate:function(){var t=this,e,u=t.model,i=u.scheduleHeaderSettings.dayHeaderFormat==""&&u.scheduleHeaderSettings.scheduleHeaderType=="day"?"ddd":u.scheduleHeaderSettings.dayHeaderFormat,o={renderDay:n.proxy(t._getDayTemplate,t),_getHeader:n.proxy(t._getHeaderWeek,t)},r,f;n.views.helpers(o);r="<th class='e-schedule-day-headercell {{if ~_getHeader(0,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(0,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>";e="<div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(0,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',0,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(1,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(1,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(1,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',1,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(2,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(2,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(2,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',2,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(3,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(3,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(3,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',3,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(4,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(4,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(4,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',4,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(5,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(5,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(5,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',5,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(6,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(6,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(6,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',6,#data)}}<\/div>";r+=e;r+="<\/th>";f={};f[t._id+"_CustomTemplate1"]=r;n.templates(f)},_getDayTemplate:function(n,i,r){var u=new Date(r),e=this,f=e.model;u.setDate(u.getDate()+i);switch(n){case"D":case"d":return u.getDate();case"DD":case"dd":return("0"+u.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(u,n,f.locale);case"":return n="ddd",t.format(u,n,f.locale)[0].toUpperCase();default:return t.format(u,n,f.locale).toUpperCase()}},_getScheduleMonth:function(n,t){var f=this,i=f.model,r=[],u;for(t=t.getMonth()<11?new Date(t.getFullYear(),11,31):t,endMonth=new Date(n.getFullYear(),11,31)<new Date(i.scheduleEndDate)?12:new Date(i.scheduleEndDate).getMonth()+1,u=n.getMonth();n<t;u++)r.push(n),n=new Date(n.getFullYear(),n.getMonth()+1,1);return r},_createSchedule:function(i,r){var u=this,a=u.model,e=a.scheduleHeaderSettings.scheduleHeaderType,c,v,s,f,h,l,o,y;i=i==null?new Date:i;r=r==null?new Date(null):r;u._createScheduleWeekTemplate();u._createScheduleYearTemplate();u._createScheduleTopMonthTemplate();u._createScheduleTopDayTemplate();u._createScheduleTopHourTemplate();o=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"});c=t.buildTag("colgroup","",{},{});v=n(document.createElement("col"));v.css("width",u._getScheduleLength(e)+"px");c.append(v);s=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});e=="week"?f=t.buildTag("tr",n.render[this._id+"ScheduleWeekTemplate"](u.model.scheduleWeeks),{},{}):e=="year"?f=t.buildTag("tr",n.render[this._id+"ScheduleYearTemplate"](u.model.scheduleYears),{},{}):e=="month"?f=t.buildTag("tr",n.render[this._id+"ScheduleTopMonthTemplate"](u.model.scheduleMonths),{},{}):e=="day"?f=t.buildTag("tr",n.render[this._id+"ScheduleTopDayTemplate"](u.model.scheduleDays),{},{}):e=="hour"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleTopHourTemplate"](u.model.scheduleHours),{},{}));h=t.buildTag("th.schedule","",{},{});l=t.buildTag("div.schedule","",{width:"20px"},{});h.append(l);f.append(h);s.append(f);o.append(c);o.append(s);u._$scheduleDiv.append(o);f=null;u._createScheduleDayTemplate();u._createScheduleMonthTemplate();u._createScheduleBottomWeekTemplate();u._createMinuteTemplate();u._createScheduleHourTemplate();o=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"});s=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});y=u._getScheduleMonth(new Date(a.scheduleYears[0]),r);e=="week"&&(f=t.buildTag("tr",n.render[this._id+"_CustomTemplate1"](a.scheduleWeeks),{},{}));e=="year"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleMonthTemplate"](y),{},{}));e=="month"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleBottomWeekTemplate"](u._numOfWeeks),{},{}));e=="day"&&(f=t.buildTag("tr",n.render[this._id+"scheduleHourTemplate"](u._getScheduleHours()),{},{}));e=="hour"&&(f=t.buildTag("tr",n.render[this._id+"scheduleMinuteTemplate"](u._getScheduleMinutes()),{},{}));h=t.buildTag("th.schedule","",{},{});l=t.buildTag("div.schedule","",{width:"20px"},{});h.append(l);f.append(h);s.append(f);o.append(c);o.append(s);u._$scheduleDiv.append(o);u._$headerContainer.append(u._$scheduleDiv);u._$ganttChartContainer.append(u._$headerContainer);n("#"+u._id).append(u._$ganttChartContainer)},_getScheduleHours:function(){var n=this,r=n.model,t=new Date(n.model.projectStartDate),i=new Date(r.projectEndDate);n._scheduleHours=[];i.setHours(24);do n._scheduleHours.push(new Date(t)),t.setHours(t.getHours()+1);while(!(t.getTime()>=i.getTime()));return n._scheduleHours},_getScheduleMinutes:function(){var n=this,i=n.model,t=new Date(n.model.projectStartDate),r=new Date(i.projectEndDate);r.setMinutes(60);t.setMinutes(00);n._scheduleMinutes=[];do n._scheduleMinutes.push(new Date(t)),t.setMinutes(t.getMinutes()+i.minuteInterval);while(!(t.getTime()>=r.getTime()));return n._scheduleMinutes},createGridLinesTable:function(){var i=this,f=i.model,u,c=f.scheduleHeaderSettings.scheduleHeaderType,r,s,o,e,h;u=t.buildTag("table.e-ganttgridLinesTable#ganttgridLinesTable"+i._id,"",{"z-index":"2",position:"absolute"},{cellspacing:"0px"});o=t.buildTag("colgroup","",{},{});e=n(document.createElement("col"));switch(c){case"week":r=f.scheduleWeeks.length;u.css("width",r*i._scheduleWeekWidth+"px");e.css("width",r*this._scheduleWeekWidth+"px");break;case"year":r=f.scheduleYears.length;u.css("width",i._scheduleYearWidth+"px");e.css("width",this._scheduleYearWidth+"px");break;case"month":r=f.scheduleMonths.length;u.css("width",i._scheduleMonthWidth+"px");e.css("width",this._scheduleMonthWidth+"px");break;case"day":r=f.scheduleDays.length;u.css("width",r*i.model.perHourWidth*24+"px");e.css("width",r*i.model.perHourWidth*24+"px");break;case"hour":r=f.scheduleHours.length;u.css("width",r*i.model.perMinuteWidth*i._totalInterval+"px");e.css("width",r*i.model.perMinuteWidth*i._totalInterval+"px")}o.append(e);u.append(o);s=i._createGridLinesTableRow(f.updatedRecords.length);h=t.buildTag("tbody.e-gantt-viewer-gridLinesTablebody#gridLinesTablebody"+i._id+"",s,{},{});i._$gridLinesTablebody=h;u.append(i._$gridLinesTablebody);i._$bodyContent.append(u)},_createGridLinesTableRow:function(n){for(var r=this,t="",i=0;i<n;i++)t+="<tr style='display:table-row;height:"+this.model.rowHeight+"px'><td class='e-ganttgridlines'><\/td><\/tr>";return t},_SelectState:function(){var t=this,n=this.model;return n.allowSelection?!0:!1},_getFontSize:function(){var i=this,r=i.model,u=r.taskbarHeight,n,t;return n=70*u/100,t=n%1,t==.5?n:t<.5?Math.floor(n):Math.ceil(n)},_getLeftTaskLabel:function(){var r=this,i=r.model,n="",u=i._columns.length,t;if(this.model.leftTaskLabelMapping==this.model.resourceNameMapping)n="{{:~_resources(#data)}}";else if(this.model.leftTaskLabelMapping==this.model.predecessorMapping)n="{{:predecessorsName}}";else for(t=0;t<u;t++)if(this.model.leftTaskLabelMapping==i._columns[t].mappingName){n="{{:"+i._columns[t].field+"}}";break}return n==""&&(n="{{:"+this.model.leftTaskLabelMapping+"}}"),n},_getRightTaskLabel:function(){var r=this,i=r.model,n="",u=i._columns.length,t;if(this.model.rightTaskLabelMapping==this.model.resourceNameMapping)n="{{:~_resources(#data)}}";else if(this.model.rightTaskLabelMapping==this.model.predecessorMapping)n="{{:predecessorsName}}";else for(t=0;t<u;t++)if(this.model.rightTaskLabelMapping==i._columns[t].mappingName){n="{{:"+i._columns[t].field+"}}";break}return n==""&&(n="{{:"+this.model.rightTaskLabelMapping+"}}"),n},_getMargin:function(){var t=this,i=this.model.taskbarHeight,n;return n=(i-t._fontSize-3)/2,Math.floor(n)},_getResizerLeftAdjust:function(){var t=this,r=this.model.taskbarHeight,u=t._fontSize,f=t._resizerMargin,n,i;return n=r/50,i=n%1,n=i<.5?Math.floor(n):Math.ceil(n),n<0?0:n},_createTaskbarTemplate:function(){var i=this,r=i.model,l,d=r.scheduleHeaderSettings.scheduleHeaderType,ii,g=4,u,ot,oi=0,f,o=0,s=0,nt=0,tt=0,e=0,a=!1,v=!1,st="",wt="",bt="",ht="",ct=r.baselineColor,h=r.taskbarTemplate,lt,kt=!1,ri=!1,at=r.parentTaskbarTemplate,vt,ui=!1,yt=r.milestoneTemplate,fi=!1,it="",y=r.leftTaskLabelTemplate,rt=!1,ut="",p=r.rightTaskLabelTemplate,ft=!1,et="",si={_SelectState:n.proxy(i._SelectState,i),_getType:i._getTypedata,_expander:i._addRecordExpandCollapse,_milestoneMapping:i._isMilestone,_resources:n.proxy(i._getResourceInfo,i),_rowClassName:t.TreeGrid._getrowClassName,_expandStatus:n.proxy(i._getExpandStatusRecord,i),_borderRadius:i._getBorderRadius},dt,b,ei,k,c,w,ti;i._fontSize=i._getFontSize();i._resizerRightAdjust=i._fontSize*.8;i._resizerMargin=i._getMargin();i._resizerLeftAdjust=i._getResizerLeftAdjust();d=="week"?l=r.scheduleWeeks.length*i._scheduleWeekWidth:d=="year"?l=i._scheduleYearWidth:d=="month"?l=i._scheduleMonthWidth:d=="day"?l=r.scheduleDays.length*r.perHourWidth*24:d=="hour"&&(l=r.scheduleHours.length*r.perMinuteWidth*i._totalInterval);r.renderBaseline?(r.taskbarHeight+g<=r.rowHeight?(dt=r.taskbarHeight,ot=0):(dt=r.taskbarHeight-g,ot=-4),u=dt,oi=0,f=r.rowHeight-g-5):(u=r.taskbarHeight,f=r.rowHeight-10);e=u/5;o=Math.floor(r.taskbarHeight/2);i._milesStoneWidth=o*2;i._connectorPointWidth=s=u/2;nt=s/2;tt=s-s/2;n.views.helpers(si);r.progressMapping||(this.model.showProgressStatus=!1);r.resourceInfoMapping||(r.showResourceNames=!1);h&&(c=t.buildTag("div","",{},{}),w=h.charAt(0),kt=!0,b="",lt=h.charAt(0)=="#"?n(h)[0].innerHTML:h,lt=lt.replace(/src/gi,i._id+"src"),n(c[0]).html(lt),n(c[0].childNodes).each(function(){var s,f,i,e,o;n(this).hasClass("e-gantt-template-taskbar")?(s="e-gantt-childtaskbar "+n(this).attr("class"),n(this).css({height:u+"px"}).attr("class",s),f="",n(this.childNodes).each(function(){var e,t,i;n(this).hasClass("e-gantt-template-progressbar")?(ri=!0,e="e-gantt-childtaskbar-progress "+n(this).attr("class"),n(this).css({height:r.progressbarHeight*(u/100)+"px",position:"absolute",top:"-1px",left:"-1px"}).attr("class",e),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+t.substr(i+7),f+=t):f+=this.nodeName=="#comment"?"":this.nodeName=="#text"?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),i=n(this).clone().empty()[0].outerHTML,e=i.indexOf("style"),i=i.substr(0,e+7)+"left:{{:left}}px;width:{{:width}}px;"+i.substr(e+7),o=t.browserInfo().name=="msie"&&t.browserInfo().version<9?i.indexOf("<\/"+this.tagName+">"):i.indexOf("<\/"+this.tagName.toLowerCase()+">"),i=i.substr(0,o)+f+i.substr(o),b+=i):b+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),b=b.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));at&&(c=t.buildTag("div","",{},{}),ei=at.charAt(0),ui=!0,k="",vt=ei=="#"?n(at)[0].innerHTML:at,vt=vt.replace(/src/gi,i._id+"src"),n(c[0]).html(vt),n(c[0].childNodes).each(function(){var s,f,i,e,o;n(this).hasClass("e-gantt-template-taskbar")?(n(this).addClass("e-parentTask"),s="e-gantt-parenttaskbar-innerdiv e-parentTask"+n(this).attr("class"),n(this).css({height:u+"px"}).attr("class",s),f="",n(this.childNodes).each(function(){var e,t,i;n(this).hasClass("e-gantt-template-progressbar")?(e="e-gantt-parenttaskbar-progress e-parentTask "+n(this).attr("class"),n(this).css({height:r.progressbarHeight*(u/100)+"px",top:"-1px",left:"-1px",position:"absolute","z-index":"3"}).attr("class",e),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+t.substr(i+7),f+=t):f+=this.nodeName=="#comment"?"":this.nodeName=="#text"?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),i=n(this).clone().empty()[0].outerHTML,e=i.indexOf("style"),i=i.substr(0,e+7)+"left:{{:left}}px;width:{{:width}}px;"+i.substr(e+7),o=t.browserInfo().name=="msie"&&t.browserInfo().version<9?i.indexOf("<\/"+this.tagName+">"):i.indexOf("<\/"+this.tagName.toLowerCase()+">"),i=i.substr(0,o)+f+i.substr(o),k+=i):k+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),k=k.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));yt&&(c=t.buildTag("div","",{},{}),w=yt.charAt(0),fi=!0,h=w=="#"?n(yt)[0].innerHTML:yt,h=h.replace(/src/gi,i._id+"src"),n(c[0]).html(h),n(c[0].childNodes).each(function(){var u,t,i;n(this).hasClass("e-gantt-template-milestone")?(u="e-gantt-milestone "+n(this).attr("class"),n(this).css({width:r.taskbarHeight-3+"px",position:"absolute","z-index":"3"}).attr("class",u),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"left:{{:left}}px;"+t.substr(i+7),it+=t):it+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),it=it.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));y&&(w=y.charAt(0),w=="#"?n(y)[0]&&(ut=n(y)[0].innerHTML):ut=document.getElementById(y)?n("#"+y)[0].innerHTML:y,rt=!0);p&&(w=p.charAt(0),w=="#"?n(p)[0]&&(et=n(p)[0].innerHTML):et=document.getElementById(p)?n("#"+p)[0].innerHTML:p,ft=!0);this.model.leftTaskLabelMapping&&rt==!1&&(a=!0,st=i._getLeftTaskLabel());this.model.rightTaskLabelMapping&&ft==!1&&(v=!0,ht=i._getRightTaskLabel());this.model.taskbarHeight<45&&(wt="<div class='e-connectortouchpoint' style='right:0px;width:20px;margin-top:"+(s-20)/2+"px;height:20px;border-radius:10px'><\/div>",bt="<div class='e-connectortouchpoint' style='left:0px;width:20px;margin-top:"+(s-20)/2+"px;height:20px;border-radius:10px'><\/div>");var gt=Math.round(-((this.model.rowHeight-1)/2)),ni="<tr class='{{:~_rowClassName()}} {{if isSelected && ~_SelectState()}}e-ganttrowcell {{:~_expander()}} e-gantt-mouseclick{{else}}e-ganttrowcell {{:~_expander()}}{{/if}}' id='chartrowcell"+i._id+"' style='display:{{:~_expandStatus(#data)}};background-color:{{if rowBGColor }}{{:rowBGColor}}{{else}} none{{/if}};height:"+r.rowHeight+"px;'>",pt="{{:~_borderRadius()}}";ii="{{if ~_getType()}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{if !isAutoSchedule}}{{if left<manualLeft}}{{:left-10}}{{else}}{{:manualLeft-10}}{{/if}}{{else}}{{:left-10}}{{/if}}px;overflow:hidden;text-overflow: ellipsis;'><div class='e-taskbarname' style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;margin-right:30px;height:"+f+"px;font-weight:bold'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' vertical-align='middle' style='width:"+l+"px;'><div class='e-parentContainer{{if !isAutoSchedule}} e-manualParenttaskbar{{/if}}' style='height:"+(this.model.taskbarHeight-1)+"px;z-index:3;'>{{if !isAutoSchedule}}<div class='e-gantt-manualparenttaskbar {{:~_expander()}}' style='left: {{:left}}px;height:"+e+"px; width: {{:width}}px;'><div class='e-gantt-manualparenttaskbar-left' style='height:"+u+"px;border-left-width:"+e+"px;border-bottom:"+e+"px solid transparent;'><\/div><div class='e-gantt-manualparenttaskbar-right' style='left:{{:width - "+parseInt(e)+"}}px;height:"+u+"px;border-right-width:"+e+"px;border-bottom:"+e+"px solid transparent;'><\/div><div class='taskbarresizer-right' style='left:{{:width -"+e+"}}px;width:"+e+"px;height:"+u+"px;font-size:"+i._fontSize+"px;position:absolute;z-index:10;'><\/div><\/div>{{/if}}{{if "+ui+"}}"+k+"{{else}}<div class='e-gantt-parenttaskbar-innerdiv {{:~_expander()}} e-parentTask' style='margin-top:{{if !isAutoSchedule}}"+e*2+"{{/if}}px;background-color:{{if parentTaskbarBackground }}{{:parentTaskbarBackground}}{{else}} "+this.model.parentTaskbarBackground+"{{/if}}; left:{{if isAutoSchedule}}{{:left}}{{else}}{{:manualLeft}}{{/if}}px;width:{{if isAutoSchedule}}{{:width}}{{else}}{{:manualWidth}}{{/if}}px;height:{{if isAutoSchedule}}"+u+"{{else}}"+e*3+"{{/if}}px;'><div class='e-gantt-parenttaskbar-progress {{:~_expander()}} e-parentTask progressbar' id='progressbar' style='top:-1px;border-style:{{if progressWidth}}solid{{else}}none{{/if}}; left:-1px;width:{{:progressWidth}}px;position:absolute;background-color:{{if parentProgressbarBackground }}{{:parentProgressbarBackground}}{{else}} "+this.model.parentProgressbarBackground+"{{/if}};z-index:3;border-top-right-radius:{{if isAutoSchedule}}"+pt+"{{else}}"+e+"{{/if}}px;border-bottom-right-radius:{{if isAutoSchedule}}"+pt+"{{else}}"+e+"{{/if}}px;height:{{if isAutoSchedule}}"+u+"{{else}}"+e*3+"{{/if}}px;'><\/div><\/div>{{/if}}<\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}<div class='e-baselinebar' style='margin-top:"+ot+"px;left:{{:baselineLeft}}px;width:{{:baselineWidth}}px;height:"+g+"px;background-color: "+ct+";position:absolute;z-index:3;box-sizing:border-box;-moz-box-sizing:border-box;'><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='left:{{if (left+width)>(manualLeft+manualWidth)}}{{:left+width+30}}{{else}}{{:manualLeft+manualWidth+30}}{{/if}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;position:absolute;background-color:transparent;font-weight:bold;height:"+(this.model.rowHeight-1)+"px;'><div class='e-resourcename' style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;outline:none;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{else ~_milestoneMapping()}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{:left-10}}px;overflow:hidden;text-overflow:ellipsis;'><div class='e-taskbarname' style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' style='width:"+l+"px;'><div class='e-gantt-milestone-container' style=height:"+(this.model.taskbarHeight-1)+"px;><div class='e-connectorpoint-left' style='left:{{:left-"+s+"}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px;'>"+wt+"<\/div>{{if "+fi+"}}"+it+"{{else}}<div class='e-gantt-milestone' style='position:absolute;left:{{:left}}px;'><div class='e-gantt-milestone milestone-top' style='border-right-width:"+o+"px;border-left-width:"+o+"px;border-bottom-width:"+o+"px; border-right-color:transparent;border-left-color:transparent;border-style:none solid solid;border-top: none;'><\/div><div class='e-gantt-milestone milestone-bottom' style='top:"+o+"px;border-right-width:"+o+"px; border-left-width:"+o+"px; border-top-width:"+o+"px; border-right-color:transparent;border-left-color:transparent;border-style:solid solid none; border-bottom: none;'><\/div><\/div>{{/if}}<div class='e-connectorpoint-right' style='left:{{:(left+"+o*2+")}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px;'>"+bt+"<\/div><\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate}}<div class='e-baseline-gantt-milestone-container' ><div class='e-baseline-gantt-milestone' style='position:absolute;left:{{:baselineRight}}px;z-index:2;'><div class='e-baseline-gantt-milestone baseline-milestone-top' style='z-index:2;top:"+-this.model.taskbarHeight+"px;border:"+o+"px solid transparent;border-top: none;border-bottom-color: "+ct+";'><\/div><div class='e-baseline-gantt-milestone baseline-milestone-bottom' style='z-index:2;top:"+(o-this.model.taskbarHeight)+"px;border:"+o+"px solid transparent;border-bottom: none;border-top-color: "+ct+";'><\/div><\/div><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='margin-top:5px;left:{{:left+56}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;height:"+(this.model.rowHeight-1)+"px;position:absolute;background-color:transparent;'><div class='e-resourcename' style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{else}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{:left-10}}px;overflow:hidden;text-overflow: ellipsis;'><div class='e-taskbarname' style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' style='width:"+l+"px;'><div class='e-childContainer' style='height:"+(this.model.taskbarHeight-1)+"px;'><div class='e-connectorpoint-left' style='left:{{:left-"+s+"}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px'>"+wt+"<\/div><div class='taskbarresizer-left e-icon' style='left:{{:left+2-"+i._resizerLeftAdjust+"}}px;width:10px;margin-top:"+i._resizerMargin+"px;height:"+u+"px;font-size:"+i._fontSize+"px;'><\/div>{{if "+kt+"}}"+b+"{{else}}<div class='e-gantt-childtaskbar {{if isCritical}} e-criticaltaskbar{{/if}} {{if !isAutoSchedule}} manualchildtaskbar{{/if}}' style='left:{{:left}}px;width:{{:width}}px;height:"+u+"px;background-color:{{if taskbarBackground }}{{:taskbarBackground}}{{else}} "+this.model.taskbarBackground+"{{/if}};'><div class='e-gantt-childtaskbar-progress {{if isAutoSchedule}} progressbar{{else}} manualprogressbar{{/if}} {{if isCritical}} e-criticalprogressbar{{/if}}' id='progressbar' style='border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;text-align:right;line-height:"+(u-1)+"px;height:"+this.model.progressbarHeight*(u/100)+"px; top:-1px;left:-1px;position:absolute;background-color:{{if progressbarBackground }}{{:progressbarBackground}}{{else}} "+this.model.progressbarBackground+"{{/if}};border-top-right-radius:"+pt+"px;border-bottom-right-radius:"+pt+"px;'>{{if "+this.model.showProgressStatus+"}}<span class='e-tasklabel' style='line-height:"+(u-1)+"px'>{{:status}}%<\/span>{{/if}}<\/div><\/div>{{/if}}{{if "+(!kt||ri)+"}}<div class='progressbarresizer-right' style='left:{{:left+progressWidth-10}}px;width:20px;margin-top:"+(u-5)+"px;height:15px;position:absolute;z-index:5;'><div class='progressbarhandler' style='top:10px;position:absolute;z-index:-1;'><div class='e-progresshandler-element'><\/div><\/div><div class='progressbarhandler' style='top:5px;position:absolute;z-index:-1;'><div class='e-progresshandlerafter-element'><\/div><\/div><\/div>{{/if}}<div class='taskbarresizer-right e-icon' style='left:{{:left+width-"+i._resizerRightAdjust+"}}px;width:10px;height:"+u+"px;font-size:"+i._fontSize+"px;position:absolute;z-index:2;margin-top:"+i._resizerMargin+"px;'><\/div><div class='e-connectorpoint-right' style='left:{{:left+width}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px'>"+bt+"<\/div><\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}<div class='e-baselinebar' style='margin-top:"+ot+"px;left:{{:baselineLeft}}px;width:{{:baselineWidth}}px;height:"+g+"px;background-color: "+ct+";position:absolute;z-index:3;box-sizing:border-box;-moz-box-sizing:border-box;'><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='left:{{:left+width+30}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;height:"+(this.model.rowHeight-1)+"px;position:absolute;text-align:left;background-color:transparent;'><div class='e-resourcename' style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{/if}}";ni+=ii;ni+="<\/tr>";ti={};ti[this._id+"_CustomTemplate2"]=ni;n.templates(ti)},_getResourceInfo:function(n){var t=null,u,i,r;if(n.resourceInfo!=null){if(u=n.resourceInfo.length,u>0){for(i=0;i<u;i++)r=n.resourceInfo[i][this.model.resourceUnitMapping],t==null?(t=n.resourceInfo[i][this.model.resourceNameMapping],r!=100&&(t+="["+r+"%]")):(t+=" , "+n.resourceInfo[i][this.model.resourceNameMapping],r!=100&&(t+="["+r+"%]"));return t}return String.empty}return String.empty},_getrowClassName:function(){var n="gridrowtaskId",t=this;return t.data.parentItem&&(n+=t.data.parentItem.taskId.toString()),n+="level",n+t.data.level.toString()},_getExpandStatusRecord:function(n){var t=this;return t._getExpandStatus(n)?"table-row":"none"},_isMilestone:function(){return this.data.isMilestone?!0:!1},_addRecordExpandCollapse:function(){return this.data.expanded?"e-chartexpand":!this.data.expanded&&this.data.hasChildRecords?"e-chartcollapse":!1},_getTypedata:function(){return this.data.hasChildRecords},_getBorderRadius:function(){var n=this,t=n.data.width-n.data.progressWidth;return t<=4?4-t:0},_getHeightValue:function(){return this.data.ParentIndex*this.data.RowHeight>this.data.ChildIndex*this.data.RowHeight?this.data.ParentIndex*this.data.RowHeight-this.data.ChildIndex*this.data.RowHeight:this.data.ChildIndex*this.data.RowHeight-this.data.ParentIndex*this.data.RowHeight},_createConnectorLineTemplate:function(){var u=this,t=u.model.connectorlineWidth>4?4:u.model.connectorlineWidth,o,r,i=u.model.connectorLineBackground,h={_getWidthVal:u._getWidth,_getTop:u._getPredecessorTop,_getPosition:u._getParentPosition,_setContainerWidthSSType2:u._getContainerWidthSSType2,_setInnerChildWidthSSType2:u._getInnerChildWidthSSType2,_setInnerElementLeftSSType2:u._getInnerElementLeftSSType2,_setInnerElementWidthSSType2:u._getInnerElementWidthSSType2,_isMilestone:u._isTaskMilestone,_isMilestoneParent:u._isMilestoneParent,_getHeightValue:u._getHeightValue},f,s,e;u.model.renderBaseline?(o=0,r=u.model.rowHeight/2-o):r=u.model.rowHeight/2;n.views.helpers(h);f="<div id='ConnectorLine{{:ConnectorLineId}}' style='background-color=black'>";s="{{if ~_getPosition()=='FSType1'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:(ChildLeft - (ParentLeft + ParentWidth + 20))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType1'><div class='e-line' style='left:{{if milestoneParent}}-7px{{else}}0px{{/if}};width:{{if milestoneParent}}{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-2}}px{{else}}{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px{{/if}};border-top:"+t+"px solid "+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px;width:0px;border-right:"+t+"px solid "+i+";border-top:{{:~_getHeightValue()-"+t+"}}px solid "+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px;width:10px;border-top:"+t+"px solid "+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth + 10))}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FSType2'}}<div style='left:{{:ParentLeft}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:~_getWidthVal()}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType2'><div class='e-line' style='left:{{if milestoneParent}}{{:ParentWidth-7}}px{{else}}{{:ParentWidth}}px{{/if}};width:{{if milestoneParent}}17px{{else}}10px{{/if}};border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:ParentWidth+10-"+t+"}}px;border-left:"+t+"px solid;width:0px;border-top:{{:~_getHeightValue()-14-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30 )}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:0px;border-top:{{:14-"+t+"}}px solid;border-left:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 10))}}px;border-left: 10px solid "+i+";border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;top:{{:-6-"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FSType3'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ParentWidth+ChildWidth}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType3'><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;top:{{:-5-"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='width:"+t+"px;border-top:{{:~_getHeightValue()-14-"+t+"}}px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='width:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30)}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30)}}px;width:0px;border-left:"+t+"px solid;height:{{:14-"+t+"}}px;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 14)}}px;width:16px;{{else}}left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 20)}}px;width:10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><\/div>{{else ~_getPosition()=='FSType4'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:(ChildLeft - (ParentLeft + ParentWidth + 20))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType4'><div class='connectorline-rightarrow' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth + 10))}}px;border-left: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth) - 20)}}px;top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;left:{{:(ChildLeft - (ParentLeft + ParentWidth) - 20)}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;{{/if}}top:-13px;width:{{if ~_isMilestoneParent()}}{{:(ChildLeft-(ParentLeft + ParentWidth+20 )+ 6)+"+t+"}}px;{{else}}{{:(ChildLeft-(ParentLeft + ParentWidth + 20))+"+t+"}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType4'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ChildLeft-ParentLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType4'><div class='connectorline-rightarrow' style='left:{{:ChildLeft-ParentLeft}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:ChildLeft-ParentLeft}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType3'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ParentLeft-ChildLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType3'><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:ParentLeft-ChildLeft+20}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType2'}}<div style='left:{{:~_setInnerElementLeftSSType2()}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:~_setContainerWidthSSType2()}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType2'><div class='e-line' style='width:{{:~_setInnerChildWidthSSType2()}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:{{:~_setInnerElementWidthSSType2()}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:~_setInnerElementWidthSSType2()}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType1'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:ParentLeft-ChildLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType1'><div class='e-line' style='width:{{:ParentLeft-ChildLeft+20}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType1'}}<div class='FFtype1' style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft + ChildWidth)-(ParentLeft + ParentWidth))+30}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType1'><div class='e-line' style='left:{{if ~_isMilestoneParent()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))-10}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))}}px;{{/if}}width:{{if ~_isMilestoneParent()}}30px;{{else}}20px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestoneParent()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;{{/if}}width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}4px;{{else}}10px;{{/if}}width:{{if ~_isMilestone()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+16}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+10}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType2'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType2'><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;{{/if}}width:{{if ~_isMilestoneParent()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+26}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+4}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+10}}px;{{/if}}width:{{if ~_isMilestone()}}16px;{{else}}10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))-6}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType3'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType3'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:4px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+16}}px;{{else}}left:10px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+10}}px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))-6}}px;width:26px;{{else}}left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))}}px;width:20px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType4'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType4'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))-6}}px;{{else}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+4}}px;width:16px;{{else}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+10}}px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+26}}px;{{else}}width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType4'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType4'><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+4}}px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+10}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+14}}px;width:16px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType3'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft)-(ChildLeft + ChildWidth))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType3'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:4px;width:16px;{{else}}left:10px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:20px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:20px;top:-13px;width:{{:(ChildLeft-(ParentLeft + ParentWidth + 20))+"+t+"}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType1'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:ChildLeft+ChildWidth+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType1'><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;width:0px;border-left:"+t+"px solid;border-top:{{:15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+(15-"+t+")}}px;width:16px;{{else}}left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;width:10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+4}}px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+10}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType2'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType2'><div class='e-line' style='left:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:0px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;{{else}}left:10px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))-20}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}-6px;{{else}}0px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{/if}}";f+=s;f+="<\/div>";e={};e[this._id+"ConnectorLineTemplate"]=f;n.templates(e)},_isTaskMilestone:function(){return this.data.milestoneChild?!0:!1},_isMilestoneParent:function(){return this.data.milestoneParent?!0:!1},_getInnerChildWidthSSType2:function(){return this.data.ParentLeft+this.data.ParentWidth<this.data.ChildLeft?10:this.data.ParentLeft==this.data.ChildLeft?20:this.data.ParentLeft+this.data.ParentWidth>=this.data.ChildLeft?10:this.data.ChildLeft-this.data.ParentLeft},_getInnerElementLeftSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?this.data.ParentLeft-20:this.data.ParentLeft-10},_getInnerElementWidthSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?10:this.data.ChildLeft-this.data.ParentLeft},_getContainerWidthSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?20:this.data.ChildLeft-this.data.ParentLeft},_getPredecessorTop:function(){return this.data.ParentIndex>this.data.ChildIndex?!0:!1},_getParentPosition:function(){if(this.data.ParentIndex<this.data.ChildIndex){if(this.data.Type=="FF")return this.data.ChildLeft+this.data.ChildWidth>=this.data.ParentLeft+this.data.ParentWidth?"FFType2":"FFType1";if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft>this.data.ParentLeft+this.data.ParentWidth+25){if(this.data.Type=="FS")return"FSType1";if(this.data.Type=="SF")return"SFType1";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="FF")return"FFType2"}else if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft<this.data.ParentLeft+this.data.ParentWidth||this.data.ParentLeft==this.data.ChildLeft||this.data.ParentLeft>this.data.ChildLeft){if(this.data.ParentLeft>this.data.ChildLeft+this.data.ChildWidth+25&&this.data.Type=="SF")return"SFType2";if(this.data.ParentLeft>this.data.ChildLeft){if(this.data.Type=="SS")return"SSType1";if(this.data.Type=="SF")return"SFType1";if(this.data.Type=="FF")return"FFType1"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&this.data.Type=="FF")return"FFType2";if(this.data.Type=="FS")return"FSType2";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="FF")return"FFType1";if(this.data.Type=="SF")return"SFType1"}else if(this.data.ParentLeft<this.data.ChildLeft){if(this.data.Type=="FS")return"FSType2";if(this.data.Type=="FF")return"FFType2";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="SF")return"SFType1"}}else if(this.data.ParentIndex>this.data.ChildIndex)if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FS")return 30>=this.data.ChildLeft-(this.data.milestoneParent?this.data.ParentLeft+this.data.ParentWidth+4:this.data.ParentLeft+this.data.ParentWidth)?"FSType3":"FSType4";if(this.data.ParentLeft<this.data.ChildLeft||this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="SS")return"SSType4";if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&this.data.Type=="FF")return"FFType4"}else if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft<this.data.ParentLeft+this.data.ParentWidth||this.data.ParentLeft==this.data.ChildLeft||this.data.ParentLeft>this.data.ChildLeft){if(this.data.ChildLeft+this.data.ChildWidth<=this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FF")return"FFType3";if(this.data.Type=="SF")return this.data.ChildLeft+this.data.ChildWidth+25<this.data.ParentLeft?"SFType3":"SFType4";if(this.data.Type=="SS")return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4";if(this.data.Type=="SS")return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}if(this.data.Type=="FS")return"FSType3"}else if(this.data.ParentLeft<this.data.ChildLeft){if(this.data.Type=="FS")return"FSType3";if(this.data.Type=="SS")return"SSType4";if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4"}return!1},_getWidth:function(){return this.data.ChildLeft+this.data.ChildWidth<this.data.ParentLeft+this.data.ParentWidth?this.data.ParentWidth:this.data.ChildWidth+this.data.ParentWidth},_renderWeekends:function(){for(var n=this,l=n.model,i=0,o=n.model.perDayWidth+1,r=n.model.updatedRecords.length*this.model.rowHeight,a=n.model.scheduleWeeks.length,s,h,u=t.buildTag("div.e-secondary_canvas","",{height:r+"px"},{}),f=l.scheduleHeaderSettings.weekStartDay,v=f>=0&&f<7?f:0,e=6-v,y=e+1==7?0:e+1,c=0;c<a;c++)s=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*y+"px",width:o+"px",height:r+"px","background-color":this.model.weekendBackground},{}),h=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*e+"px",width:o+"px",height:r+"px","background-color":this.model.weekendBackground},{}),u.append(s),u.append(h),i=i+this._scheduleWeekWidth;n._$weekendsContainer.html(u);n._$bodyContent.append(n._$weekendsContainer)},_renderStripLines:function(n){for(var u,h,r=this,f=r.model.updatedRecords.length*this.model.rowHeight,c=n.length,e,o,l=r.model.projectStartDate,a=this.model.perDayWidth,s=t.buildTag("div.e-stripLines","",{height:f+"px"},{}),i=0;i<c;i++)e=this._getDateFromFormat(n[i].day),o=(e-this._getDateFromFormat(l))/864e5*a,n[i].lineWidth=n[i].lineWidth>30?30:n[i].lineWidth,u=t.buildTag("div.e-stripline#stripline"+[i]+"","",{left:o+"px",width:"1px",height:f+"px","border-left-width":n[i].lineWidth+"px","border-left-color":n[i].lineColor,"border-left-style":n[i].lineStyle},{}),h=t.buildTag("span.e-striplinespan",n[i].label,{"background-color":n[i].lineColor},{}),n[i].day&&n[i].day.length>0&&(n[i].label&&n[i].label.length>0&&u.append(h),s.append(u));r._$stripLineContainer.append(s);r._$bodyContent.append(r._$stripLineContainer)},_getProgressWidth:function(n,t){return n*t/100},_getProgressPercent:function(n,t){return Math.ceil((t/n*100).toFixed(2))},_renderHoliday:function(n){var i=this,a=i.model.scheduleHeaderSettings.scheduleHeaderType,c=this._getDateFromFormat(n.day),v=i.model.scheduleWeeks.length,y=i.model.scheduleMonths.length,p=i.model.scheduleYears.length,w=i.model.scheduleDays.length,o=0,u,s,f,e,l=i.model.updatedRecords.length,h,r;o=(c-this._getDateFromFormat(i.model.projectStartDate))/864e5*this.model.perDayWidth;h=l*this.model.rowHeight;u=n.label!=null?n.label.length:0;n.background==null&&(n.background="white");r=".e-holiday-label";t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(r=".e-holiday-label-ie8");s=i.model.scheduleHeaderSettings.scheduleHeaderType!="day"?t.buildTag("div"+r,n.label,{top:i._getHolidayLabelHeight(u)+"px"},{}):t.buildTag("div"+r,n.label,{bottom:i._getHolidayLabelHeight(u)+"px"},{});f=t.buildTag("div.e-secondary-canvas-holiday");e=t.buildTag("div.e-holidays","",{left:o+"px",width:i.model.perDayWidth+"px",height:h+"px","background-color":n.background},{});n.label!=null&&e.append(s);f.append(e);i._$secondaryCanvas.append(f);i._$bodyContent.append(i._$secondaryCanvas)},_getHolidayLabelHeight:function(){var n=this,r=n.model,t=n._getHeight(),i=r.updatedRecords.length*n.model.rowHeight;return t>0?t/2:n._viewportHeight<i?n._viewportHeight/2:i/2},_destroy:function(){var t=this;t.element.off();n(document.body).unbind("touchmove",n.proxy(t.handleMouseMove,t));n(document).unbind("mouseup",n.proxy(t._tooltipMouseup,t));n(document.body).bind("touchmove",n.proxy(t.handleMouseMove,t));t.element.empty().removeClass("e-ganttchart-core e-ganttchart"+t.model.cssClass)}});t.GanttChart.contextMenuItem={taskDetails:"Task Details....",add:"Add new task",indent:"Indent",outdent:"Outdent",Delete:"Delete"};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}}}(jQuery,Syncfusion),function(n,t){t.widget("ejRadialMenuBase","ej.RadialMenuBase",{_tags:[{tag:"items",attr:["imageName","imagePath","imageUrl","windows.text","flat.text","text","click","touch","enabled","badge.enabled","badge.value","type","sliderSettings.ticks","sliderSettings.strokeWidth","sliderSettings.labelSpace",[{tag:"items",attr:["imageName","imagePath","imageUrl","windows.text","flat.text","text","click","touch","enabled"]}]]}],defaults:{radius:150,cssClass:"",enableAnimation:!0,open:null,close:null,items:[]},dataTypes:{radius:"number",enableAnimation:"boolean",items:"array"},_initialization:function(){var t,i;if(this.element.addClass(this.model.cssClass),this._svgLink="http://www.w3.org/2000/svg",this.model.items.length<1)for(this._radialItems=n(this.element.find(">ul").children()),t=0;t<this._radialItems.length;t++)if(this.model.items.push(this._itemsObjectCollection(n(this._radialItems[t]))),n(this._radialItems[t]).find("ul").children().length>0)for(this._nestedRadialItems=n(this._radialItems[t]).find("ul").children(),this.model.items[t].items=[],i=0;i<this._nestedRadialItems.length;i++)this.model.items[t].items.push(this._itemsObjectCollection(n(this._nestedRadialItems[i])));this._itemCount=this.model.items.length;n(this.element.children()).remove();this._startXY=this.model.radius;this._diameter=2*this.model.radius},_itemsObjectCollection:function(t){var i={},r={};return n(this._tags[0].attr).each(function(n,u){var f,e,o;typeof u=="string"&&(f=u.split("."),f.length==1?i[u]=t.attr("data-ej-"+u):(e=f[0],o=f[1],i[e]||(r={}),r[o]=t.attr("data-ej-"+u.replace(".","-")),i[e]=r))}),i},_createSVGElement:function(){var t=document.createElementNS(this._svgLink,"svg");return this.model.radius!=null&&(t.setAttribute("width",this._diameter),t.setAttribute("height",this._diameter)),n(t)},_createGroupElement:function(t){var i=document.createElementNS(this._svgLink,"g");return t&&i.setAttribute("id",t),n(i)},_createImageElement:function(n,i,r,u,f){if(!t.isNullOrUndefined(r.imageUrl)||!t.isNullOrUndefined(r.imagePath))return imgLoc=r.imageUrl?r.imageUrl:this.model.renderMode.toLowerCase()!="flat"?r.imagePath+"/"+this.model.renderMode.toLowerCase()+"/"+r.imageName:r.imagePath+"/"+this.model.renderMode.toLowerCase()+"/"+r.imageName,image=document.createElementNS(this._svgLink,"image"),image.setAttribute("width",n),image.setAttribute("height",i),image.setAttributeNS("http://www.w3.org/1999/xlink","href",imgLoc),image.setAttribute("x",u),image.setAttribute("y",f),image},_createTextElement:function(n,t,i,r){var u=document.createElementNS(this._svgLink,"text");return u.setAttribute("x",n),u.setAttribute("y",t),u.setAttribute("class",i),u.textContent=r,u},_createPathElement:function(n,t,i){var r=document.createElementNS(this._svgLink,"path");return r.setAttribute("index",n),r.setAttribute("d",t),r.setAttribute("class",i),r},_createPolygonElement:function(n,t){var i=document.createElementNS(this._svgLink,"polygon");return i.setAttribute("points","10,10 0,10 5,5"),i.setAttribute("index",n),i.setAttribute("fill","#FFFFFF"),i.setAttribute("transform",t),i},_createCircleElement:function(n,t,i,r){var u=document.createElementNS(this._svgLink,"circle");return u.setAttribute("cx",n),u.setAttribute("cy",t),u.setAttribute("r",i),u.setAttribute("class",r),u},_calculateRadialArc:function(n,t,i,r,u){for(var a,l,h=0,e=2*Math.PI*h,o=2*Math.PI*(h+1/n),s=.5*t*Math.min(this._diameter,this._diameter),v=i*t*Math.min(this._diameter,this._diameter),c=r*s,y=u*s,p=360/n,w=p/2,b=[],k=[],d=[],g=[],nt=[],tt=[],it=[],rt=[],ut=[],ft=[],et=[],ot=[],st=[],ht=[],f=0;f<n;f++)a=-.5*Math.PI,e=e+a,o=o+a-1e-6,ht[f]=o-e<Math.PI?0:1,l=(e+o)/2,b[f]=this._startXY+s*Math.cos(e),k[f]=this._startXY+s*Math.sin(e),d[f]=this._startXY+s*Math.cos(o),g[f]=this._startXY+s*Math.sin(o),nt[f]=this._startXY+v*Math.cos(l),tt[f]=this._startXY+v*Math.sin(l),it[f]=this._startXY+c*Math.cos(e),rt[f]=this._startXY+c*Math.sin(e),ut[f]=this._startXY+c*Math.cos(o),ft[f]=this._startXY+c*Math.sin(o),et[f]=this._startXY+y*Math.cos(l),ot[f]=this._startXY+y*Math.sin(l),st[f]=w,h+=1/n,e=2*Math.PI*h,o=2*Math.PI*(h+1/n),w+=p;return{x1:b,y1:k,x2:d,y2:g,midx:nt,midy:tt,dStartX:it,dStartY:rt,dEndX:ut,dEndY:ft,dmidx:et,dmidy:ot,deg:st,longArc:ht,radius:s,dradius:c}},_renderRadialMenu:function(){var n,l,a;this._radialSVG=this._createSVGElement();this._radialChildSVG=this._createSVGElement();this._childArcGroup=this._createGroupElement("childarcgroup");this._polygonGroup=this._createGroupElement("polygongroup");this._polygonGroup.attr("transform","translate(-10,-10)");this._radialArcGroup=this._createGroupElement("outerarcpathgroup");this._menuItemsArcGroup=this._createGroupElement("arcpathgroup");this._menuItemsGroup=this._createGroupElement("menuitemsgroup");this._menuItemsGroup.attr("transform","translate(-10,-5)");this._menuItemsArcPaths=this._createGroupElement("menuitemsarcpaths");this._menuItemsPaths=this._createGroupElement("itemspathgroup");this._radialSVGDiv=t.buildTag("div#"+this._id+"_svgdiv."+this._prefix+"abs").css("height",this._diameter);this._radialCircleSVGDiv=t.buildTag("div#"+this._id+"_circlesvgdiv."+this._prefix+"abs "+this._prefix+"displaynone");this._radialChildSVGDiv=t.buildTag("div#"+this._id+"_childsvgdiv."+this._prefix+"abs "+this._prefix+"displaynone");var i=this._calculateRadialArc(this._itemCount,1,.28,.8,.95),r=this._calculateRadialArc(this._itemCount,.79,null,.97,null),u=this._calculateRadialArc(this._itemCount,.8,null,.3,null),f=this._calculateRadialArc(1,1,.28,.8,null),v=this._pathDirection(f.x1[0],f.y1[0],f.radius,f.longArc[0],f.x2[0],f.y2[0],f.dEndX[0],f.dEndY[0],f.dradius,f.dStartX[0],f.dStartY[0]),h=20;for(n=0;n<this._itemCount;n++){var c=this._pathDirection(i.x1[n],i.y1[n],i.radius,i.longArc[n],i.x2[n],i.y2[n],i.dEndX[n],i.dEndY[n],i.dradius,i.dStartX[n],i.dStartY[n]),y=this._pathDirection(r.x1[n],r.y1[n],r.radius,r.longArc[n],r.x2[n],r.y2[n],r.dEndX[n],r.dEndY[n],r.dradius,r.dStartX[n],r.dStartY[n]),p=this._pathDirection(u.x1[n],u.y1[n],u.radius,u.longArc[n],u.x2[n],u.y2[n],u.dEndX[n],u.dEndY[n],u.dradius,u.dStartX[n],u.dStartY[n]),e=this.model.items[n],o=this._createGroupElement(),s=this._enableItem(e,o);this._menuItemsArcPaths.append(this._createPathElement(n,y,""+this._prefix+"arcbgcolor"));this._menuItemsPaths.append(this._createPathElement(n,p,s.itemPathClass));this._menuItemsArcGroup.append(this._createPathElement(n,c,s.arcPathClass));o.attr({cursor:"context-menu",index:n});o.append(this._createImageElement(h,h,e,i.midx[n],i.midy[n]-h/2));o.append(this._createTextElement(i.midx[n]+10,i.midy[n]+25,s.textClass,s.dataText));e.badge&&(e.badge.enabled=="true"||e.badge.enabled==!0)&&o.append(this._createCircleElement(i.midx[n]+25,i.midy[n]-10,10,""+this._prefix+"badgecircle")).append(this._createTextElement(i.midx[n]+25,i.midy[n]-7,""+this._prefix+"badgetext",e.badge.value));this._menuItemsGroup.append(o);(e.items||e.type&&e.type.toLowerCase()==(this.model.renderMode?t.mobile:t).RadialMenu.ItemType.Slider)&&(l=i.deg[n]>270?"translate("+(i.dmidx[n]+5)+","+(i.dmidy[n]+15)+")rotate("+i.deg[n]+")":"translate("+(i.dmidx[n]+10)+","+(i.dmidy[n]+10)+")rotate("+i.deg[n]+")",this._childArcGroup.append(this._createPathElement(n,c,""+this._prefix+"childdefault")),this._polygonGroup.append(this._createPolygonElement(n,l)))}a=this._createCircleElement(this._startXY,this._startXY,this._startXY/3.5,""+this._prefix+"circlebgcolor");this._radialArcGroup.append(this._createPathElement(1,v,""+this._prefix+"outerdefault"));this._radialChildSVG.append(this._menuItemsPaths).append(this._menuItemsArcGroup).append(this._childArcGroup).append(this._polygonGroup).append(this._menuItemsArcPaths).append(this._menuItemsGroup).append(a);this._radialContainer.append(this._radialSVGDiv.append(this._radialCircleSVGDiv.append(this._radialSVG.append(this._radialArcGroup))).append(this._radialChildSVGDiv.append(this._radialChildSVG)))},_ejMenuBaseItemsRemove:function(){this._menuChildSVGDiv=t.buildTag("div#"+this._id+"_menuchildsvgdiv."+this._prefix+"abs");this.model.enableAnimation?(this._radialChildSVGDiv.removeClass(""+this._prefix+"radialshow").addClass(""+this._prefix+"scalehide"),this._radialChildAnimate(),this._menuChildSVGDiv.addClass(""+this._prefix+"scaleshow")):this._radialChildSVGDiv.addClass(""+this._prefix+"displaynone");this._radial.removeClass(this.model.imageClass).addClass(""+this._prefix+"backarrow "+this.model.backImageClass+"")},_renderRadialChildMenu:function(n){var t,c;this._menuChildSVG=this._createSVGElement();this._childItemsGroup=this._createGroupElement("childitemsgroup");this._childItemsGroup.attr("transform","translate(-10,-10)");this._childItemArcGroup=this._createGroupElement();this._childItemsArcPaths=this._createGroupElement("childitemsarcpaths");this._childItemsPaths=this._createGroupElement();var e=n.items.length,i=this._calculateRadialArc(e,1,.28,.8,null),r=this._calculateRadialArc(e,.79,null,.97,null),u=this._calculateRadialArc(e,.8,null,.3,null),s=20;for(t=0;t<e;t++){var l=this._pathDirection(i.x1[t],i.y1[t],i.radius,i.longArc[t],i.x2[t],i.y2[t],i.dEndX[t],i.dEndY[t],i.dradius,i.dStartX[t],i.dStartY[t]),a=this._pathDirection(r.x1[t],r.y1[t],r.radius,r.longArc[t],r.x2[t],r.y2[t],r.dEndX[t],r.dEndY[t],r.dradius,r.dStartX[t],r.dStartY[t]),v=this._pathDirection(u.x1[t],u.y1[t],u.radius,u.longArc[t],u.x2[t],u.y2[t],u.dEndX[t],u.dEndY[t],u.dradius,u.dStartX[t],u.dStartY[t]),f=this._createGroupElement(),h=n.items[t],o=this._enableItem(h,f);this._childItemArcGroup.append(this._createPathElement(t,l,o.arcPathClass));this._childItemsArcPaths.append(this._createPathElement(t,a,""+this._prefix+"arcbgcolor"));this._childItemsPaths.append(this._createPathElement(t,v,o.itemPathClass));f.attr({cursor:"context-menu",index:t});f.append(this._createImageElement(s,s,h,i.midx[t],i.midy[t]-s/2));f.append(this._createTextElement(i.midx[t]+10,i.midy[t]+25,o.textClass,o.dataText));this._childItemsGroup.append(f)}c=this._createCircleElement(this._startXY,this._startXY,this._startXY/3.5,""+this._prefix+"circlebgcolor");this._radialSVGDiv.append(this._menuChildSVGDiv.append(this._menuChildSVG.append(this._childItemsPaths).append(this._childItemArcGroup).append(this._childItemsArcPaths).append(this._childItemsGroup).append(c)))},_radialSliderHandler:function(n){this.updateBadgeValue(this._index,n.value);this._data={value:n.value,oldValue:n.oldValue,index:this._index};this._eventsTrigger(this._data,this.model.renderMode?"touch":"click")},_isRSText:function(n){return n==this._prefix+"ticks-text"||n==this._prefix+"dynamic-text"?!0:!1},_pathDirection:function(n,t,i,r,u,f,e,o,s,h,c){return"M "+n+" "+t+" A "+i+" "+i+" 0 "+r+" 1 "+u+" "+f+" L "+e+" "+o+" A "+s+" "+s+" 1 "+r+" 0 "+h+" "+c+" z"},_enableItem:function(n,t){var u=this._prefix+"itembgcolor",f=this._prefix+"default",i=""+this._prefix+"textcolor",r=this.model.renderMode?n[this.model.renderMode].text:n.text;return n.enabled=="false"||n.enabled==!1?(t.attr("class",this._prefix+"itemdisabled"),{itemPathClass:this._prefix+"itembgcolor "+this._prefix+"pathdisabled",arcPathClass:this._prefix+"default "+this._prefix+"pathdisabled",dataText:r,textClass:i}):{itemPathClass:u,arcPathClass:f,dataText:r,textClass:i}},_windowsMenuShow:function(){this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"displaynone "+this._prefix+"radialhide").addClass(this._prefix+"radialshow"),this._radialChildSVGDiv.removeClass(this._prefix+"displaynone "+this._prefix+"radialhide").addClass(this._prefix+"radialshow")):(this._radialCircleSVGDiv.removeClass(this._prefix+"displaynone"),this._radialChildSVGDiv.removeClass(this._prefix+"displaynone"));this._openCloseTrigger("open")},_windowsMenuHide:function(n){this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"radialshow").addClass(this._prefix+"radialhide"),this._radialChildSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"scaleshow").addClass(this._prefix+"radialhide"),setTimeout(function(){n._radialCircleSVGDiv.addClass(n._prefix+"displaynone");n._radialChildSVGDiv.addClass(n._prefix+"displaynone")},160)):(this._radialCircleSVGDiv.addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.addClass(this._prefix+"displaynone"));this._openCloseTrigger("close")},_windowsInnerMenuHide:function(n){this._radial.removeClass(this._prefix+"backarrow "+this.model.backImageClass+"").addClass(this.model.imageClass);this.model.enableAnimation?(this._menuChildSVGDiv.removeClass(this._prefix+"scaleshow").addClass(this._prefix+"scalehide"),setTimeout(function(){n._menuChildSVGDiv.remove()},150),setTimeout(function(){n._radialChildSVGDiv.removeClass(n._prefix+"scalehide "+n._prefix+"displaynone").addClass(n._prefix+"scaleshow")},200)):(this._menuChildSVGDiv.remove(),this._radialChildSVGDiv.removeClass(this._prefix+"displaynone"))},_eventsTrigger:function(n,t){var i=this.model[t];this.model[t]=this._childTarget&&this.model.items[n.index].items[n.childIndex][t]?this.model.items[n.index].items[n.childIndex][t]:!this._childTarget&&this.model.items[n.index][t]?this.model.items[n.index][t]:this.model[t];this.model[t]&&this._trigger(t,n);this.model[t]=i},_openCloseTrigger:function(n){this.model[n]&&this._trigger(n)},_menuEnabledDisabled:function(t,i){var r=this;n.isArray(t)&&n.each(t,function(t,u){n.isArray(u)?n.each(u,function(t,f){n.isArray(f)?n.each(f,function(n,t){r.model.items[u].items[t].enabled=i=="disabled"?!1:!0}):((!r.model.renderMode||r.model.renderMode&&(r.model.renderMode=="windows"||r.model.renderMode=="flat"))&&r._menuItems(r,f,i),u=f)}):r._menuItems(r,u,i)})},_ejMenuItem:function(i,r,u){var f=n(this._menuItemsGroup.find("g")[r]),e=n(this._menuItemsPaths.find("path")[r]),o=n(this._radialChildSVGDiv.find("#arcpathgroup path")[r]);u=="disabled"?(e.attr("class",""+this._prefix+"itembgcolor "+this._prefix+"pathdisabled"),o.attr("class",""+this._prefix+"default "+this._prefix+"pathdisabled"),f.attr("class",""+this._prefix+"itemdisabled"),!t.isNullOrUndefined(this._radialChildSVGDiv)&&n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).length>0&&(n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).attr("class",this._prefix+"itemdisabled"),n(this._radialChildSVGDiv.find("#childarcgroup path[index='"+r+"']")).attr("class",this._prefix+"itemdisabled"))):(e.attr("class",""+this._prefix+"itembgcolor"),o.attr("class",""+this._prefix+"default"),f.removeAttr("class"),!t.isNullOrUndefined(this._radialChildSVGDiv)&&n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).length>0&&n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).removeAttr("class"),n(this._radialChildSVGDiv.find("#childarcgroup path[index='"+r+"']")).attr("class",this._prefix+"childdefault"))},_ejMenuHide:function(n){this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"radialshow").addClass(this._prefix+"radialhide"),this._radialChildSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"scaleshow").addClass(this._prefix+"radialhide"),setTimeout(function(){n._radialCircleSVGDiv.addClass(n._prefix+"displaynone").removeClass(n._prefix+"radialshow "+n._prefix+"radialhide "+n._prefix+"scaleshow "+n._prefix+"scalehide");n._radialChildSVGDiv.addClass(n._prefix+"displaynone").removeClass(n._prefix+"radialshow "+n._prefix+"radialhide "+n._prefix+"scaleshow "+n._prefix+"scalehide")},160)):(this._radialCircleSVGDiv.addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.addClass(this._prefix+"displaynone"));this._openCloseTrigger("close")},_ejInnerMenuHide:function(n){this._radial.removeClass(this._prefix+"backarrow "+this.model.backImageClass+"").addClass(this.model.imageClass);this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"radialhide "+this._prefix+"scaleshow "+this._prefix+"scalehide").addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"radialhide "+this._prefix+"scaleshow "+this._prefix+"scalehide").addClass(this._prefix+"displaynone"),this._menuChildSVGDiv.removeClass(this._prefix+"scaleshow").addClass(this._prefix+"radialhide"),setTimeout(function(){n._menuChildSVGDiv.removeClass(n._prefix+"radialhide").remove()},150)):(this._radialCircleSVGDiv.addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.addClass(this._prefix+"displaynone"),this._menuChildSVGDiv.remove());this._openCloseTrigger("close")},_currentBadgeEle:function(t){return this.model.renderMode=="android"?n(this._imageBadgeGroup.find("g")[t]):n(this._menuItemsGroup.find("g")[t])},_badge:function(n){return this._currentBadgeEle(n).find("."+this._prefix+"badgetext,."+this._prefix+"badgecircle")},show:function(){this.element.removeClass(this._prefix+"displaynone")},hide:function(){this.element.addClass(this._prefix+"displaynone")},showMenu:function(){this._showMenu()},hideMenu:function(){this._hideMenu()},enableItemByIndex:function(n){this._menuItems(this,n,"enabled")},enableItemsByIndices:function(n){this._menuEnabledDisabled(n,"enabled")},disableItemByIndex:function(n){this._menuItems(this,n,"disabled")},disableItemsByIndices:function(n){this._menuEnabledDisabled(n,"disabled")},updateBadgeValue:function(n,t){this.model.items[n].badge.value=t;this._currentBadgeEle(n).children("text."+this._prefix+"badgetext").html(t)},showBadge:function(n){this._badge(n).show()},hideBadge:function(n){this._badge(n).hide()},_setModel:function(n){n.items&&(this.model.items=n.items);this._refresh()},_refresh:function(){this._destroy();this._init()},_destroy:function(){t.listenEvents([document,document],[t.endEvent(),t.startEvent()],[this._targetClick,this._targetDown],!0);this.element.removeAttr("class style").children().remove()}})}(jQuery,Syncfusion),function($,ej){ej.widget("ejRadialMenu","ej.RadialMenu",{_rootCSS:"e-radialmenu",element:null,model:null,validTags:["div"],_setFirst:!0,defaults:{imageClass:"e-radialimage",backImageClass:"e-backimage",targetElementId:null,click:null,select:null,autoOpen:!1,position:{x:null,y:null}},dataTypes:{autoOpen:"boolean"},_init:function(){this._id=this.element[0].id;ej.browserInfo().name=="msie"&&ej.browserInfo().version<9||(this._initialization(),this._prefix="e-",this._renderRadial(),this._wireEvents())},_renderRadial:function(){this._radial=ej.buildTag("div.e-radial e-abs "+this.model.imageClass+"").css({left:this._startXY-22+"px",top:this._startXY-22+"px"});this._radialContainer=ej.buildTag("div.e-rel").css({height:this._diameter,width:this._diameter});this.element.append(this._radialContainer.append(this._radial)).addClass("e-radialmenu e-overlow e-user-select e-abs");this._radialInitialPosition();this._renderRadialMenu();var n=this._childArcGroup.children(),t=this._polygonGroup.children();this._on(n,"mouseenter",this._arcOverHandler);this._on(n,"mouseleave",this._arcOverHandler);this._on(t,"mouseenter",this._arcOverHandler);this._on(t,"mouseleave",this._arcOverHandler);this._itemsEvents(this._menuItemsGroup.children(),this._menuItemsPaths.children(),this._menuItemsArcGroup.children())},_wireEvents:function(){var n=$(document);this._radialClick=$.proxy(this._showMenu,this);this._targetDown=$.proxy(this._targetDownHandler,this);this._targetClick=$.proxy(this._targetClickHandler,this);this._itemClick=$.proxy(this._itemClickHandler,this);ej.listenEvents([this._radial,this._radialSVGDiv,n,n],[ej.endEvent(),ej.endEvent(),ej.endEvent(),ej.startEvent()],[this._radialClick,this._itemClick,this._targetClick,this._targetDown],!1)},_itemsEvents:function(n,t,i){this._on(n,"mouseenter",this._itemOverHandler);this._on(n,"touchstart",this._itemOverHandler);this._on(n,"mouseleave",this._itemOverHandler);this._on(n,"touchend",this._itemOverHandler);this._on(t,"mouseenter",this._itemOverHandler);this._on(t,"touchstart",this._itemOverHandler);this._on(t,"mouseleave",this._itemOverHandler);this._on(t,"touchend",this._itemOverHandler);this._on(i,"mouseenter",this._itemOverHandler);this._on(i,"touchstart",this._itemOverHandler);this._on(i,"mouseleave",this._itemOverHandler);this._on(i,"touchend",this._itemOverHandler)},_showMenu:function(){this._radial.hasClass("e-backarrow")?this._windowsInnerMenuHide(this):this._radialCircleSVGDiv.hasClass("e-displaynone")?this._windowsMenuShow():this._windowsMenuHide(this);this._childTarget=!1},_itemClickHandler:function(e){var targetEle=$(e.target),currentItem;if(targetEle.attr("class")=="e-active"||e.target.tagName=="polygon"||!ej.isNullOrUndefined(e.type)&&e.type=="touchend"&&targetEle.attr("class")=="e-childdefault")if(this._index=parseInt(targetEle.attr("index")),this._ejMenuBaseItemsRemove(),currentItem=this.model.items[this._index],currentItem.type&¤tItem.type.toLowerCase()==ej.RadialMenu.ItemType.Slider){var ticks=currentItem.sliderSettings.ticks?eval(currentItem.sliderSettings.ticks):[8,9,11,13,16,20,26,36,72],value=currentItem.badge.value?parseInt(currentItem.badge.value):10,stroke=currentItem.sliderSettings.strokeWidth?parseInt(currentItem.sliderSettings.strokeWidth):1,labelSpace=currentItem.sliderSettings.labelSpace?parseInt(currentItem.sliderSettings.labelSpace):22;this._menuChildSVGDiv.ejRadialSlider({showInnerCircle:!1,enableAnimation:!1,radius:this.model.radius-29,inline:!0,strokeWidth:stroke,labelSpace:labelSpace,value:value,ticks:ticks,change:$.proxy(this._radialSliderHandler,this)});this._radialSVGDiv.append(this._menuChildSVGDiv)}else this._renderRadialChildMenu(currentItem),this._childTarget=!0,this._itemsEvents(this._childItemsGroup.children(),this._childItemsPaths.children(),this._childItemArcGroup.children());this._eventAction(e);this._event&&(this._eventsTrigger(this._data,"click"),this._eventsTrigger(this._data,"select"));this._event=!1},_eventAction:function(n){var t=$(n.target),u=t.attr("class"),f=n.target.tagName,i,r;u=="e-itembgcolor"||u=="e-default"?(i=t.index(),r=this._childTarget?$(this._childItemsGroup.children()[t.index()]).text():$(this._menuItemsGroup.children()[t.index()]).text(),this._event=!0,this._data=this._childTarget?{index:this._index,childIndex:i,text:r}:{index:i,text:r,childIndex:null}):(f!="text"||this._isRSText(u))&&f!="image"||(i=t.parent().index(),r=t.parent().text(),this._event=!0,this._data=this._childTarget?{index:this._index,childIndex:i,text:r}:{index:i,text:r,childIndex:null})},_radialInitialPosition:function(){this._targetElement=$("#"+this.model.targetElementId+"");this.model.autoOpen?(this.model.position.x!=null&&this.model.position.y!=null?this.element.css({top:this.model.position.y,left:this.model.position.x}):this.model.targetElementId&&this.element.css({top:this._targetElement.height()/2-this.model.radius+"px",left:this._targetElement.width()/2-this.model.radius+"px"}),this.show()):this.hide()},_radialChildAnimate:function(){var n=this;setTimeout(function(){n._radialChildSVGDiv.removeClass("e-scalehide e-scaleshow").addClass("e-displaynone")},150)},_arcOverHandler:function(n){var t=$(n.target),i=parseInt(t.attr("index")),r=$(this._childArcGroup.find("path[index="+i+"]")),u=$(this._polygonGroup.find("polygon[index="+i+"]"));n.type=="mouseenter"?(u.attr("fill","#808080"),t.attr("class")=="e-childdefault"?t.attr("class","e-active"):r.attr("class","e-active")):(u.attr("fill","#FFFFFF"),t.attr("class")=="e-active"?t.attr("class","e-childdefault"):r.attr("class","e-childdefault"))},_itemOverHandler:function(n){var t=$(n.currentTarget).index(),i=this._childTarget?$(this._childItemsArcPaths.children()[t]):$(this._menuItemsArcPaths.children()[t]);n.type=="mouseenter"||n.type=="touchstart"?i.attr("class","e-childdefault"):i.attr("class","e-arcbgcolor")},_targetDownHandler:function(n){var t=$(n.target);!t.hasClass("e-rel")&&$(t.closest(".e-radialmenu")).length&&n.preventDefault()},_targetClickHandler:function(n){var r=$(n.target),u=n.clientX,f=n.clientY,t,i,e=$(r.closest(".e-radialmenu")).length,o=this._radialCircleSVGDiv.hasClass("e-displaynone"),s,h;this.model.targetElementId?(t=this._targetElement.width(),i=this._targetElement.height()):(t=window.innerWidth,i=window.innerHeight);e==0&&$(r.closest(this._targetElement)).length==0&&this.model.targetElementId?o?this.hide():this.hideMenu():this.model.position.x&&this.model.position.y?this.element.css({top:this.model.position.y,left:this.model.position.x}):$(r.closest("div.e-radial")).length==0&&o?(s=u>t-this.model.radius?t-this._diameter:u>this.model.radius?u-this.model.radius:0,h=f>i-this.model.radius?i-this._diameter:f>this.model.radius?f-this.model.radius:0,this.element.css({top:h+"px",left:s+"px"})):e==0&&this.hideMenu()},_menuItems:function(n,t,i){this._ejMenuItem(n,t,i)},_hideMenu:function(){this._radial.hasClass("e-backarrow")?this._ejInnerMenuHide(this):this._ejMenuHide(this)},setPosition:function(n,t){this.element.css({top:t+"px",left:n+"px"});this.show()},menuHide:function(){this._hideMenu()},enableItem:function(n){this._ejMenuEnabledDisabled(n,"enabled")},disableItem:function(n){this._ejMenuEnabledDisabled(n,"disabled")},enableItems:function(n){this._ejMenuEnabledDisabled(n,"enabled")},disableItems:function(n){this._ejMenuEnabledDisabled(n,"disabled")},_ejMenuEnabledDisabled:function(n,t){var i=this,r=$.isArray(n)?n:$.makeArray(n);$.each(r,function(n,r){$.each(i.model.items,function(n,u){u.text.toLowerCase()==r.toLowerCase()&&i._menuItems(this,n,t);u.items&&$.each(u.items,function(n,i){i.text.toLowerCase()==r.toLowerCase()&&(i.enabled=t=="disabled"?!1:!0)})})})}});ej.RadialMenu.ItemType={Default:"default",Slider:"slider"};$.extend(!0,ej.RadialMenu.prototype,ej.RadialMenuBase.prototype)}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};ejSignature=function(n){function t(t,i){return n.call(this),this._rootCSS="e-signature",this.PluginName="ejSignature",this.id="null",this.validTags=["div"],this.model=null,this.defaults={strokeColor:"#000000",height:"100%",width:"100%",enabled:!0,strokeWidth:2,backgroundColor:"#ffffff",showRoundedCorner:!0,saveImageFormat:"png",isResponsive:!1,saveWithBackground:!1,backgroundImage:null,change:null,mouseDown:null,mouseMove:null,mouseUp:null},t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejSignature(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype.clear=function(){this.model.saveWithBackground?this._setBackgroundImage(this.model.backgroundImage):this._canvasContext.clearRect(0,0,this._canvasContext.canvas.width,this._canvasContext.canvas.height);this._refresh()},t.prototype.save=function(n){var i,t=navigator.userAgent,u=this._canvas[0].toDataURL("image/"+this.model.saveImageFormat+""),r;i=ej.isNullOrUndefined(n)?Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,6)+"."+this.model.saveImageFormat:n+"."+this.model.saveImageFormat;r=this._dataURLtoBlob(u);t.indexOf("Edge")==-1?t.indexOf("Firefox")!=-1||t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("AppleWebKit")!=-1?this._download(r,i):window.navigator.msSaveOrOpenBlob(r,i):window.navigator.msSaveOrOpenBlob(r,i)},t.prototype._dataURLtoBlob=function(n){for(var i=n.split(","),f=i[0].match(/:(.*?);/)[1],r=atob(i[1]),t=r.length,u=new Uint8Array(t);t--;)u[t]=r.charCodeAt(t);return new Blob([u],{type:f})},t.prototype._download=function(n,t){var r=URL.createObjectURL(n),i=document.createElement("a");i.href=r;i.target="_parent";i.download=t;(document.body||document.documentElement).appendChild(i);i.click();i.parentNode.removeChild(i)},t.prototype.undo=function(){var t=this,n;this.incStep>0&&(this.incStep--,n=new Image,n.src=this.storeSnap[this.incStep],n.onload=function(){var i=document.getElementById(t.element[0].id).children[0],r=i.getContext("2d");r.clearRect(0,0,i.width,i.height);r.drawImage(n,0,0)})},t.prototype.redo=function(){var t=this,n;this.incStep<this.storeSnap.length-1&&(this.incStep++,n=new Image,n.src=this.storeSnap[this.incStep],n.onload=function(){var i=document.getElementById(t.element[0].id).children[0],r=i.getContext("2d");r.clearRect(0,0,i.width,i.height);r.drawImage(n,0,0)})},t.prototype.show=function(){this.element.css("display","block")},t.prototype.hide=function(){this.element.css("display","none")},t.prototype.enable=function(){this.element.removeClass("e-disable").attr({"aria-disabled":!1})},t.prototype.disable=function(){this.element.addClass("e-disable").attr({"aria-disabled":!0})},t.prototype._init=function(){this._initialize();this._render();this._wireEvents(!1)},t.prototype._initialize=function(){this._canvas=ej.buildTag("canvas","",{},{});this.element.append(this._canvas);this._canvas[0].getContext&&(this._canvasContext=this._canvas[0].getContext("2d"));this._setProperties(this.model.backgroundColor);this.model.backgroundImage&&this._setBackgroundImage(this.model.backgroundImage);this.model.saveWithBackground||this._toSaveData();this._resizeCanvas();this._setRoundedCorner(this.model.showRoundedCorner);this.model.enabled||this.disable();this.strokeMinimumWidth=1},t.prototype._setBackgroundImage=function(n){if(this.model.saveWithBackground){var i=this,t=new Image;t.src=n;t.onload=function(){var n=document.getElementById(i.element[0].id).children[0],r=n.getContext("2d");r.globalCompositeOperation="source-over";r.drawImage(t,0,0,n.width,n.height);i._toSaveData()}}else this._canvasContext.canvas.style.backgroundImage="url("+n+")"},t.prototype._setProperties=function(n){ej.isNullOrUndefined(this.model.height&&this.model.width)||this.element.css({height:this.model.height,width:this.model.width});this._canvasContext.canvas.style.backgroundColor=n;this._canvasContext.canvas.style.backgroundSize="100% 100%";this._canvasContext.canvas.style.msTouchAction="none";this._canvasContext.canvas.style.touchAction="none"},t.prototype._resizeCanvas=function(){this._canvasContext.canvas.width=this.element.innerWidth();this._canvasContext.canvas.height=this.element.innerHeight();this._canvasContext.scale(1,1);this.model.isResponsive&&this._restore()},t.prototype._restore=function(){var t=this,n=new Image;ej.isNullOrUndefined(this.incStep)||(n.src=this.storeSnap[this.incStep],n.onload=function(){var i=document.getElementById(t.element[0].id).children[0],r=i.getContext("2d");r.clearRect(0,0,i.width,i.height);r.drawImage(n,0,0,i.width,i.height)})},t.prototype._refresh=function(){this._canvasContext.fillStyle=this.model.strokeColor;this.points=[];this._lastVelocity=0;this._lastWidth=(this.strokeMinimumWidth+this.model.strokeWidth)/2},t.prototype._setModel=function(n){for(var t in n)switch(t){case"height":this._changeHeight(n[t]);break;case"width":this._changeWidth(n[t]);break;case"showRoundedCorner":this._setRoundedCorner(n[t]);break;case"backgroundColor":this._setProperties(n[t]);break;case"backgroundImage":this._setBackgroundImage(n[t]);break;case"enabled":this._disabled(!n[t]);break;case"isResponsive":this._resizeCanvas()}},t.prototype._changeHeight=function(n){this.element.css("height",n.toString());this._changeHeightWidth()},t.prototype._changeWidth=function(n){this.element.css("width",n.toString());this._changeHeightWidth()},t.prototype._changeHeightWidth=function(){this._resizeCanvas();this.model.isResponsive||this._restore()},t.prototype._setRoundedCorner=function(n){n==!0?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},t.prototype._disabled=function(n){n==!0?this.disable():this.enable()},t.prototype._render=function(){this.element.addClass(" e-signature e-select e-widget").attr("role","signature")},t.prototype._drawStartHandler=function(n){if(n.which===1||n.which===0){if(ej.blockDefaultActions(n),this._mouseButtonDown=!0,(ej.browserInfo().name=="chrome"||"webkit")&&n.type=="touchstart"){var t=n.originalEvent.targetTouches[0];this._beginStroke(t)}else this._beginStroke(n);this._on(this._canvas,ej.eventType.mouseMove,this._drawMove);this._on($(document),ej.eventType.mouseUp,this._drawEnd);this._trigger("mouseDown",{value:n})}},t.prototype._drawMoveHandler=function(n){if(ej.blockDefaultActions(n),this._mouseButtonDown)if((ej.browserInfo().name=="chrome"||"webkit")&&n.type=="touchmove"){var t=n.originalEvent.targetTouches[0];this._updateStroke(t)}else this._updateStroke(n);this._trigger("mouseMove",{value:n})},t.prototype._drawEndHandler=function(n){ej.blockDefaultActions(n);this._mouseButtonDown&&(this._mouseButtonDown=!1,this._endStroke());this._off(this._canvas,ej.eventType.mouseMove,this._drawMove);this._toSaveData();this._off($(document),ej.eventType.mouseUp,this._drawEnd);this._trigger("mouseUp",{value:n});this._trigger("change",{isInteraction:!0,lastImage:this.storeSnap[this.incStep]})},t.prototype._toSaveData=function(){if(ej.isNullOrUndefined(this.incStep)?(this.incStep=-1,this.incStep++,this.storeSnap=[]):this.incStep++,this.incStep<this.storeSnap.length&&(this.storeSnap.length=this.incStep),this.incStep>0){var n=ej.buildTag("canvas","",{},{}),t=n[0].getContext("2d");n[0].height=this._canvas.height();n[0].width=this._canvas.width();t.drawImage(this._canvas[0],0,0,n[0].width,n[0].height);this.storeSnap.push(n[0].toDataURL())}else this.storeSnap.push(this._canvas[0].toDataURL())},t.prototype._beginStroke=function(n){this._refresh();this._updateStroke(n)},t.prototype._updateStroke=function(n){var t=this._createPoint(n);this._addPoint(t)},t.prototype._drawStroke=function(n){var t=this._canvasContext,i=(this.strokeMinimumWidth+this.model.strokeWidth)/2;t.beginPath();this._pointDraw(n.x,n.y,i);t.closePath();t.fill()},t.prototype._endStroke=function(){var t=this.points.length>2,n=this.points[0];!t&&n&&this._drawStroke(n)},t.prototype._createDelegates=function(){this._drawStart=$.proxy(this._drawStartHandler,this);this._drawMove=$.proxy(this._drawMoveHandler,this);this._drawEnd=$.proxy(this._drawEndHandler,this)},t.prototype._wireEvents=function(n){var t=n?"off":"on";this._createDelegates();this._on(this._canvas,ej.eventType.mouseDown,this._drawStart);this._wireResizeEvents()},t.prototype._wireResizeEvents=function(){$(window).bind("resize",$.proxy(this._resizeCanvas,this))},t.prototype._destroy=function(){this.element.removeClass("e-signature e-js e-select e-widget").removeAttr("role style signature");this.model.showRoundedCorner&&this.element.removeClass("e-corner");this._off(this._canvas,(ej.eventType.mouseDown,ej.eventType.mouseMove,ej.eventType.mouseUp));$(window).unbind("resize",$.proxy(this._resizeCanvas,this));this.element.empty()},t.prototype._createPoint=function(n){var t=this._canvas[0].getBoundingClientRect();return this._point(n.clientX-t.left,n.clientY-t.top,undefined)},t.prototype._addPoint=function(n){var t=this.points,i,r,u;t.push(n);t.length>2&&(t.length===3&&t.unshift(t[0]),i=this._calculateCurveControlPoints(t[0],t[1],t[2]).cp2,r=this._calculateCurveControlPoints(t[1],t[2],t[3]).cp1,u=this._bezierCurve(t[1],i,r,t[2]),this._addCurve(u),t.shift())},t.prototype._calculateCurveControlPoints=function(n,t,i){var f=n.x-t.x,e=n.y-t.y,o=t.x-i.x,s=t.y-i.y,u={x:(n.x+t.x)/2,y:(n.y+t.y)/2},r={x:(t.x+i.x)/2,y:(t.y+i.y)/2},y=Math.sqrt(f*f+e*e),h=Math.sqrt(o*o+s*s),p=u.x-r.x,w=u.y-r.y,c=h/(y+h),l={x:r.x+p*c,y:r.y+w*c},a=t.x-l.x,v=t.y-l.y;return{cp1:this._point(u.x+a,u.y+v,0),cp2:this._point(r.x+a,r.y+v,0)}},t.prototype._addCurve=function(n){var r=this.startPoint,t,i;t=this._pointVelocityCalc(r);t=.7*t+(.7-1)*this._lastVelocity;i=Math.max(this.model.strokeWidth/(t+1),this.strokeMinimumWidth);this._curveDraw(n,this._lastWidth,i);this._lastVelocity=t;this._lastWidth=i},t.prototype._pointDraw=function(n,t,i){var r=this._canvasContext;r.moveTo(n,t);r.arc(n,t,i,0,2*Math.PI,!1)},t.prototype._curveDraw=function(n,t,i){var l=this._canvasContext,a,y,o,r,s,h,u,c,v,f,e,p=i-t;for(a=Math.floor(this._bezierLengthCalc()),l.beginPath(),o=0;o<a;o++)r=o/a,s=r*r,h=s*r,u=1-r,c=u*u,v=c*u,f=v*this.startPoint.x,f+=3*c*r*this.control1.x,f+=3*u*s*this.control2.x,f+=h*this.endPoint.x,e=v*this.startPoint.y,e+=3*c*r*this.control1.y,e+=3*u*s*this.control2.y,e+=h*this.endPoint.y,y=t+h*p,this._pointDraw(f,e,y);l.closePath();l.fill()},t.prototype._point=function(n,t,i){return this.x=n,this.y=t,this.time=i||(new Date).getTime(),{x:this.x,y:this.y,time:this.time}},t.prototype._pointVelocityCalc=function(n){return this.time!==n.time?Math.sqrt(Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2))/(this.time-n.time):1},t.prototype._bezierCurve=function(n,t,i,r){this.startPoint=n;this.control1=t;this.control2=i;this.endPoint=r},t.prototype._bezierLengthCalc=function(){for(var e=10,o=0,t,i,r,s,h,u,f,n=0;n<=e;n++)t=n/e,i=this._bezierPoint(t,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),r=this._bezierPoint(t,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y),n>0&&(u=i-s,f=r-h,o+=Math.sqrt(u*u+f*f)),s=i,h=r;return o},t.prototype._bezierPoint=function(n,t,i,r,u){return t*(1-n)*(1-n)*(1-n)+3*i*(1-n)*(1-n)*n+3*r*(1-n)*n*n+u*n*n*n},t}(ej.WidgetBase);ej.widget("ejSignature","ej.Signature",new ejSignature);window.ejSignature=null;ej.Signature.SaveImageFormat={PNG:"png",JPG:"jpg",BMP:"bmp",TIFF:"tiff"};__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};SpellCheck=function(n){function t(){n.apply(this,arguments);this.rootCSS="e-spellcheck";this.PluginName="ejSpellCheck";this._id="null";this.defaults={locale:"en-US",misspellWordCss:"e-errorword",ignoreSettings:{ignoreAlphaNumericWords:!0,ignoreHtmlTags:!0,ignoreEmailAddress:!0,ignoreMixedCaseWords:!0,ignoreUpperCase:!0,ignoreUrl:!0,ignoreFileNames:!0},dictionarySettings:{dictionaryUrl:"",customDictionaryUrl:""},maxSuggestionCount:6,ajaxDataType:"jsonp",ignoreWords:[],contextMenuSettings:{enable:!0,menuItems:[{id:"IgnoreAll",text:"Ignore All"},{id:"AddToDictionary",text:"Add to Dictionary"}]},isResponsive:!0,enableValidateOnType:!1,controlsToValidate:null,actionSuccess:null,actionBegin:null,actionFailure:null,start:null,complete:null,contextOpen:null,contextClick:null,dialogBeforeOpen:null,dialogOpen:null,dialogClose:null,validating:null,targetUpdating:null};this.dataTypes={locale:"string",misspellWordCss:"string",ignoreSettings:{ignoreAlphaNumericWords:"boolean",ignoreHtmlTags:"boolean",ignoreEmailAddress:"boolean",ignoreMixedCaseWords:"boolean",ignoreUpperCase:"boolean",ignoreUrl:"boolean",ignoreFileNames:"boolean"},dictionarySettings:{dictionaryUrl:"string",customDictionaryUrl:"string",customDictionaryPath:"string"},maxSuggestionCount:"number",ajaxDataType:"string",ignoreWords:"array",contextMenuSettings:{enable:"boolean",menuItems:"array"}};this._localizedLabels=null;this._statusFlag=!0;this._words=[];this._inputWords=[];this._controlIds=[];this._control=[];this._targetStatus=!0;this._statusMultiTarget=!1;this._changeAllWords=[];this._subElements=[];this._iframeStatus=!1;this._elementStatus=!0;this._suggestedWordCollection=[];this._ignoreStatus=!0;this.model=this.defaults}return __extends(t,n),t.prototype._init=function(){ej.isNullOrUndefined(this.element)||this._renderSpellCheck()},t.prototype._renderSpellCheck=function(){this._initLocalize();this._renderControls()},t.prototype._initLocalize=function(){this._localizedLabels=this._getLocalizedLabels()},t.prototype._renderControls=function(){var r,t,n,i,u;if(ej.isNullOrUndefined(this.model.controlsToValidate))this._addAttributes(this,this.element);else{for($(this.element).attr("style","display:none"),this._controlIds=this.model.controlsToValidate.split(","),r=!1,t=0;t<this._controlIds.length;t++)if(n=$(this._controlIds[t]),n.length>0)if(r=!0,n.length>1)for(i=0;i<n.length;i++)u=$(n[i]),this._addAttributes(this,u);else this._addAttributes(this,n);this._elementStatus=this._statusFlag=r}this.model.isResponsive&&this._on($(window),"resize",$.proxy(this._resizeSpellCheck,this))},t.prototype._addAttributes=function(n,t){$(t).addClass("e-spellcheck");t[0].spellcheck=!1;n._addEventListeners(n,t)},t.prototype._addEventListeners=function(n,t){n._isIframe(t)?($(t)[0].contentWindow.document.addEventListener("input",function(){n._changeStatus(n)},!1),n.model.contextMenuSettings.enable&&($(t)[0].contentWindow.document.addEventListener("mousedown",function(){n._elementRightClick(n)},!1),$(document)[0].addEventListener("mousedown",function(){n._elementRightClick(n)},!1),$(t)[0].contentWindow.document.addEventListener("keydown",function(t){n._spellValidateOnType(t)},!1))):(t[0].addEventListener("input",function(){n._changeStatus(n)},!1),n.model.contextMenuSettings.enable&&n._on($(document),"mousedown",$.proxy(n._elementRightClick,n)),n._on($(t[0]),"keydown","",this._spellValidateOnType))},t.prototype._changeStatus=function(n){n._statusFlag=!0;ej.isNullOrUndefined(n.model.controlsToValidate)||(n._controlIds=n.model.controlsToValidate.split(","),n._targetStatus=!0)},t.prototype._isIframe=function(n){return $(n)[0].tagName==="IFRAME"},t.prototype._resizeSpellCheck=function(){var n=!ej.isNullOrUndefined(this._spellCheckWindow)&&this._spellCheckWindow.parents().find(".e-spellcheck.e-dialog-wrap"),t=!ej.isNullOrUndefined(this._spellCheckWindow)&&n.length>0&&this._spellCheckWindow.data("ejDialog"),i,r,u;this.model.isResponsive?!ej.isNullOrUndefined(this._spellCheckWindow)&&n.length>0&&this._spellCheckWindow.ejDialog("isOpen")&&(t._dialogPosition(),i=this._spellCheckWindow.find(".e-suggesteditems").data("ejListBox"),i.refresh(!0),r=this._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller"),setTimeout(function(){n.find(".e-dialog-scroller").width(n.width()-2);n.find(".e-suggestionlist .e-content").width(n.find(".e-suggestionlist .e-content").width()-2);r.refresh()},4)):t._dialogPosition();!ej.isNullOrUndefined(this._alertWindow)&&this._alertWindow.data("ejDialog")&&(u=!ej.isNullOrUndefined(this._alertWindow)&&this._alertWindow.data("ejDialog"),u._dialogPosition())},t.prototype.showInDialog=function(){this._statusFlag?this._renderDialogWindow():this._alertWindowRender("show")},t.prototype.validate=function(){var t,n,i,r,u,e,f,o,s;if(this._statusFlag){if(t=[],this.model.contextMenuSettings.enable&&!ej.isNullOrUndefined(this.model.dictionarySettings.dictionaryUrl)){if(n="",this._controlIds.length>0&&!this._currentActiveElement&&this.model.enableValidateOnType||this._controlIds.length>0&&(!this.model.enableValidateOnType||!this._statusMultiTarget)){for(i=0;i<this._controlIds.length;i++)if(r=$(this._controlIds[i]),r.length>0)for(u=0;u<r.length;u++)e=$(r[u]),f="",f=this._elementTextProcess(this,e),n=n===""?n.concat(f):n.concat(" "+f)}else this.model.enableValidateOnType&&this._currentActiveElement?n=this._elementTextProcess(this,$(this._currentActiveElement)):(this._isIframe(this.element)&&$(this.element).contents().find("body").addClass("e-spellcheck"),n=this._elementTextProcess(this,this.element));if(t=this._filteringDiffWords(this,n),this._splitWords(n,this),o={targetSentence:n,requestType:"validate"},this._trigger("actionBegin",o))return!1;t.length>0?this._ajaxRequest(this,t.join(" "),"validateOnType"):t.length!==0||this._ignoreStatus?ej.isNullOrUndefined(this._errorWordDetails)?this.model.enableValidateOnType||this._alertWindowRender("show"):(s=this._filterErrorData(this,this._errorWordDetails),this._validateOnTypeOperations(this,s,n,"validateOnType")):(this._splitInputWords(n,this),t=ej.dataUtil.distinct(this._inputWords),this._ajaxRequest(this,t.join(" "),"validateOnType"))}}else this._alertWindowRender("show")},t.prototype._filteringDiffWords=function(n,t){var f=n._inputWords,r=[],i,e,u;for(n._splitInputWords(t,n),i=n._inputWords,u=0;u<i.length;u++)e=f.indexOf(i[u]),e===-1&&r.push(i[u]);return i.length!==f.length&&r.length!==0&&i.length===r.length&&(r=i),r},t.prototype._elementTextProcess=function(n,t){return this.model.contextMenuSettings.enable&&this.model.enableValidateOnType&&(this._controlIds.length>0?t[0].nodeType==9&&t[0].nodeName=="#document"&&(t=$(this._controlIds[0])):t=$(this.element[0])),n._isIframe(t)?$(t).contents().find("body").text():ej.isNullOrUndefined($(t)[0].value)?($(t)[0].innerText||$(t)[0].textContent).trim():$(t)[0].value.trim()},t.prototype._splitWords=function(n,t){var i=n.split(/[^0-9a-zA-Z\'_]/);i=i.filter(function(n){return/\S/.test(n)});t._words=i},t.prototype._splitInputWords=function(n,t){var i=n.split(" ");t._inputWords=i},t.prototype.spellCheck=function(n,t){var i={targetSentence:n,misspelledWordCss:t,requestType:"spellCheck"};if(this._trigger("actionBegin",i))return!1;this._misspelledWordCss=t;this._ajaxRequest(this,n,"spellCheck")},t.prototype.ignoreAll=function(n,t){var i;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""?!1:(i={ignoreWord:n,targetContent:t,requestType:"ignoreAll"},this._trigger("validating",i))?!1:(this.model.ignoreWords.push(n),this._updateErrorContent(n,t,null,"ignoreAll",null))},t.prototype.ignore=function(n,t,i){var r;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""?!1:(r={ignoreWord:n,targetContent:t,requestType:"ignore"},this._trigger("validating",r))?!1:this._updateErrorContent(n,t,null,"ignore",i)},t.prototype.change=function(n,t,i,r){var u;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""||ej.isNullOrUndefined(i)||i===""?!1:(u={changableWord:n,targetContent:t,changeWord:i,requestType:"changeWord"},this._trigger("validating",u))?!1:this._updateErrorContent(n,t,i,"changeWord",r)},t.prototype.changeAll=function(n,t,i){var u,r;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""||ej.isNullOrUndefined(i)||i===""?!1:(u={changableWord:n,targetContent:t,changeWord:i,requestType:"changeAll"},this._trigger("validating",u))?!1:(r={},r.ErrorWord=n,r.ReplaceWord=i,this._changeAllWords.push(r),this._updateErrorContent(n,t,i,"changeAll",null))},t.prototype.addToDictionary=function(n){if(ej.isNullOrUndefined(n)||n==="")return!1;var t={customWord:n,requestType:"addToDictionary"};if(this._trigger("validating",t))return!1;this._customWord=JSON.stringify({customWord:n});this._ajaxRequest(this,null,"addToDictionary")},t.prototype._updateErrorContent=function(n,t,i,r,u){var s,f,o,h,e,c;if(t.indexOf(n)!==-1){if(f='<span class="errorspan '+this.model.misspellWordCss+'">'+n+"<\/span>",o=r==="ignoreAll"||r==="addToDictionary"||r==="ignore"?n:i,r==="ignoreAll"||r==="addToDictionary"||r==="changeAll")t=t.replace(new RegExp(f,"g"),o);else if(r==="ignore"||r==="changeWord")if(ej.isNullOrUndefined(u))t=t.replace(f,o);else{for(h=[],e=t.indexOf(f);e!==-1;)h.push(e),e=t.indexOf(f,++e);c=h[u];t=t.substr(0,c)+o+t.substr(c+f.length)}s={resultHTML:t}}else s=!1;return s},t.prototype._renderDialogWindow=function(){this._dialogWindowRendering();this._showDialog()},t.prototype._dialogWindowRendering=function(){var n=this,u,t;this._spellCheckWindow=ej.buildTag("div.e-spellcheckdialog#"+this._id+"ErrorCorrectionWindow");var f=ej.buildTag("div.e-dialogdiv"),e=ej.buildTag("div.e-row e-labelrow").append(ej.buildTag("div.e-labelcell").append(ej.buildTag("label.e-dictionarylabel",this._localizedLabels.NotInDictionary+":"))),i=ej.buildTag("div.e-row e-sentencerow"),o=ej.buildTag("div.e-cell e-sentencecell").append(ej.buildTag("div.e-sentence","",{},{id:this._id+"_Sentences",name:"sentences",contenteditable:"false"}));i.append(o);var s=ej.buildTag("div.e-buttoncell"),h=ej.buildTag("button.e-btnignoreonce",this._localizedLabels.IgnoreOnceButtonText,{},{id:this._id+"_IgnoreOnce"}).attr("type","button"),c=ej.buildTag("button.e-btnignoreall",this._localizedLabels.IgnoreAllButtonText,{},{id:this._id+"_IgnoreAll"}).attr("type","button"),l=ej.buildTag("button.e-btnaddtodictionary",this._localizedLabels.AddToDictionary,{},{id:this._id+"_AddToDictionary"}).attr("type","button");i.append(s.append(h).append(c).append(l));var a=ej.buildTag("div.e-row e-labelrow").append(ej.buildTag("div.e-labelcell").append(ej.buildTag("label.e-lablesuggestions",this._localizedLabels.SuggestionLabel+":"))),r=ej.buildTag("div.e-row e-suggestionsrow"),v=ej.buildTag("div.e-cell e-suggestioncell").append(ej.buildTag("ul.e-suggesteditems","",{},{id:this._id+"_Suggestions"}));r.append(v);var y=ej.buildTag("div.e-buttoncell"),p=ej.buildTag("button.e-btnchange",this._localizedLabels.ChangeButtonText,{},{id:this._id+"_Change"}).attr("type","button"),w=ej.buildTag("button.e-btnchangeall",this._localizedLabels.ChangeAllButtonText,{},{id:this._id+"_ChangeAll"}).attr("type","button"),b=ej.buildTag("button.e-btnclose",this._localizedLabels.CloseButtonText,{},{id:this._id+"_Close"}).attr("type","button");for(r.append(y.append(p).append(w).append(b)),f.append(e).append(i).append(a).append(r),this._spellCheckWindow.append(f),this._spellCheckWindow.ejDialog({width:462,minHeight:305,enableModal:!0,enableResize:!1,showOnInit:!1,allowKeyboardNavigation:!1,target:$("body"),title:this._localizedLabels.SpellCheckButtonText+":",close:function(){n._close()},cssClass:"e-spellcheck",isResponsive:this.model.isResponsive}),u=[".e-btnignoreonce",".e-btnignoreall",".e-btnaddtodictionary",".e-btnchange",".e-btnchangeall",".e-btnclose"],t=0;t<u.length;t++)this._spellCheckWindow.find(u[t]).ejButton({width:this.model.isResponsive?"100%":140,click:function(t){t.model.text===n._localizedLabels.CloseButtonText?n._close():n._changeErrorWord(t)},cssClass:"e-spellbuttons"});this._spellCheckWindow.find(".e-sentence").append(ej.buildTag("div.e-sentencescroller").append(ej.buildTag("div").append(ej.buildTag("div.e-sentencecontent","",{},{id:this._id+"_SentenceContent"}))));this._spellCheckWindow.find(".e-sentence .e-sentencescroller").ejScroller({height:"100%",scrollerSize:20});this._spellCheckWindow.find(".e-suggesteditems").ejListBox({width:"100%",height:"100%",dataSource:null,selectedIndex:0,cssClass:"e-suggestionlist"})},t.prototype._alertWindowRender=function(n){this._renderAlertWindow(n);this._elementStatus||this._alertWindow.find(".e-alerttext").html(this._localizedLabels.NotValidElement);this._alertWindow.ejDialog("open")},t.prototype._renderAlertWindow=function(n){var t=this;this._alertWindow=ej.buildTag("div.e-alertdialog#"+this._id+"alertWindow");this._elementStatus||this._alertWindow.addClass("e-missingalert");var r=ej.buildTag("div.e-alertbtn","",{"text-align":"center"}).append(ej.buildTag("button.e-alertbutton e-alertspellok",this._localizedLabels.Ok,{},{id:this._id+"alertok"}).attr("type","button")),i=ej.buildTag("div.e-alerttextdiv"),u=ej.buildTag("div.e-alertnotifydiv").append(ej.buildTag("div.e-alertnotification e-icon e-notification")),f=ej.buildTag("div.e-alerttext",this._localizedLabels.CompletionPopupMessage,{"text-align":"left",padding:"5px"});i.append(u).append(f);this._alertWindow.append(i).append(r);this.element.append(this._alertWindow);this._alertWindow.find(".e-alertbutton").ejButton({showRoundedCorner:!0,width:this._elementStatus?"70px":"100px",click:function(){t._alertClose()},cssClass:"e-flat"});this._alertWindow.ejDialog({width:this._elementStatus?240:420,minHeight:140,showOnInit:!1,enableModal:!0,title:this._localizedLabels.CompletionPopupTitle,enableResize:!1,allowKeyboardNavigation:!1,target:n==="validating"?".e-spellcheckdialog":$("body"),cssClass:this._elementStatus?"e-spellalert":"e-spellalert e-elementmissing",close:function(){t._alertClose()},isResponsive:this.model.isResponsive})},t.prototype._renderContextMenu=function(){var n=this,r,i,t,u;if(this._contextMenu=ej.buildTag("ul#"+n._id+"contextMenu"),ej.isNullOrUndefined(n.model.controlsToValidate))r=n._isIframe(this.element)?n.element.contents()[0]:"."+n.model.misspellWordCss;else{for(i=!1,t=0;t<n._controlIds.length;t++)u=n._isIframe($(n._controlIds[t])),u&&(i=!0);r=i?$(n._controlIds[0]).contents()[0]:"."+n.model.misspellWordCss}this._contextMenu.ejMenu({fields:{id:"id",text:"text",parentId:"parentId"},menuType:ej.MenuType.ContextMenu,openOnClick:!1,width:"auto",cssClass:"e-spellmenu",click:function(t){n._onMenuSelect(t)}})},t.prototype._contextMenuPosition=function(n,t){var r,i,f,u,e,o;return!ej.isNullOrUndefined(t._activeElement)&&t._isIframe($(t.element))?(f=ej.isNullOrUndefined(t.model.controlsToValidate)?$(t.element):$(t._control[0].controlId),r=(n.clientX==undefined?0:n.clientX)+f.offset().left,i=(n.clientY==undefined?0:n.clientY)+f.offset().top,u=$(t._contextMenu).attr("style","visibility: visible;display:block;").height(),e=$(t._contextMenu).width(),i=i+u<$(document).scrollTop()+$(window).height()?i:i-u<0?i:i-u,r=r+e<$(document).scrollLeft()+$(window).width()?r:r-e):(r=n.clientX+t._contextMenu.width()<$(window).width()?n.pageX:n.pageX-t._contextMenu.width(),i=n.clientY+t._contextMenu.height()<$(window).height()?n.pageY:n.clientY>t._contextMenu.height()?n.pageY-t._contextMenu.height():$(window).height()-t._contextMenu.outerHeight(),o=$("body").css("position")!=="static"?$("body").offset():{left:0,top:0},r-=o.left,i-=o.top),{X:r,Y:i}},t.prototype._showDialog=function(){var a={spellCheckDialog:this._spellCheckWindow,requestType:"dialogBeforeOpen"},t,n,u,f,e,r,o,i,s,h,c,l;if(this._trigger("dialogBeforeOpen",a))return!1;if(this._spellCheckWindow.ejDialog("open"),t="",this._controlIds.length>0){for(u=0;u<this._controlIds.length;u++)if(f=$(this._controlIds[u]),f.length>0)for(e=0;e<f.length;e++)r=$(f[e]),this._activeElement=this._isIframe(r)?$(r).contents().find("body")[0]:$(r)[0],this._removeSpan(this),this._subElements.push(r[0]);t=this._inputTextProcess(this,$(this._subElements[0]),t);this._proElements=this._subElements.length>0&&$(this._subElements[0]);this._currentTargetElement=n=$(this._subElements[0]);this._subElements=this._subElements.slice(1)}else n=this.element,this._activeElement=this._isIframe(n)?this._getIframeElement(n):$(n)[0],this._removeSpan(this),t=this._inputTextProcess(this,n,t);if(o="",this.element=ej.isNullOrUndefined(this.model.controlsToValidate)?this.element:n,this.element.length>0&&(o=this._isIframe(this.element)?$(this.element).contents().find("body").html():$(n)[0].tagName==="TEXTAREA"||$(n)[0].tagName==="INPUT"?$(n)[0].value:$(n)[0].innerHTML),i=this._filteringDiffWords(this,t),this._splitWords(t,this),!ej.isNullOrUndefined(this.model.controlsToValidate)&&(s={previousElement:null,currentElement:n,targetHtml:o},this._trigger("targetUpdating",s)))return this._close(),!1;if((this._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML=o,h={targetText:t,requestType:"dialogOpen"},this._trigger("dialogOpen",h))||(c={targetSentence:t,requestType:"spellCheck"},this._trigger("actionBegin",c)))return!1;i.length>0?this._ajaxRequest(this,i.join(" "),"spellCheckDialog"):i.length!==0||this._ignoreStatus?ej.isNullOrUndefined(this._errorWordDetails)?this._alertWindowRender("show"):(l=this._filterErrorData(this,this._errorWordDetails),this._dialogModeOperations(this,l,t,"spellCheckDialog")):(this._splitInputWords(t,this),i=ej.dataUtil.distinct(this._inputWords),this._ajaxRequest(this,i.join(" "),"spellCheckDialog"))},t.prototype._getIframeElement=function(n){return $(n).contents().find("body")[0]},t.prototype._inputTextProcess=function(n,t,i){var r,u;return n._isIframe(t)?(r=$(t).contents().find("body").text(),i=i===""?r:i+r):(u=ej.isNullOrUndefined($(t)[0].value)?($(t)[0].innerText||$(t)[0].textContent).trim():$(t)[0].value.trim(),i=i===""?u:i+" "+u),i},t.prototype._ajaxRequest=function(n,t,i){var r=i==="addToDictionary"?n._customWord:this._getModelValues(this,t);$.ajax({url:i==="addToDictionary"?this.model.dictionarySettings.customDictionaryUrl:this.model.dictionarySettings.dictionaryUrl,data:{data:r},contentType:"application/json; charset=utf-8",dataType:this.model.ajaxDataType,crossDomain:!0,success:function(r){var u,p,e,o,f,w,s,b,nt,k,v,h,d,y,l,a,c,g;if(i==="addToDictionary"?ej.isNullOrUndefined(n._errorWordDetails)||ej.isNullOrUndefined(n._currentElement)?u=[]:(u=n._errorWordDetails,n._filterData(r.toString(),n),n._errorWordDetails=n._errorWordsData):u=n._updateErrorDetails(n,r),e=t,u.length>0){if(i==="spellCheckDialog"||i==="validateOnType"||i==="validateOnRender")f=n._filterErrorData(n,u),f.length>0?i==="spellCheckDialog"?n._dialogModeOperations(n,f,e,i):(i==="validateOnType"||i==="validateOnRender")&&n._validateOnTypeOperations(n,f,e,i):(i==="spellCheckDialog"&&n._spellCheckWindow.ejDialog("isOpen")&&n._spellCheckWindow.ejDialog("close"),n._alertWindowRender("validating"));else if(i==="spellCheck"){if(u.length>0){for(w=n._getFilterData(u,n),f=ej.dataUtil.distinct(w),s=0;s<f.length;s++)b=(new ej.Query).where("ErrorWord",ej.FilterOperators.equal,f[s]),nt=new ej.DataManager(u).executeLocal(b),f.length>0&&(p='<span class="errorspan '+(!ej.isNullOrUndefined(n._misspelledWordCss)&&n._misspelledWordCss!==""?n._misspelledWordCss:n.model.misspellWordCss)+'">'+f[s]+"<\/span>",k=new RegExp(f[s],"gi"),e=e.replace(k,p));o={resultHTML:e,errorWordDetails:u,requestType:"spellCheck"};n._misspelledWordCss=null}else o={resultHTML:e,errorWordDetails:u,requestType:"spellCheck"};n._trigger("actionSuccess",o)}else if(i==="addToDictionary"&&(ej.isNullOrUndefined(n._currentElement)||(v=$(n._currentElement)[0].tagName==="IFRAME"?$(n._currentElement).contents().find("body").html():$(n._currentElement).html().trim()),h=n._updateErrorContent(r,v,null,"addToDictionary",null),!ej.isNullOrUndefined(v))){if(!ej.isNullOrUndefined(n._spellCheckWindow)&&n._spellCheckWindow.find(".e-btnaddtodictionary").hasClass("e-select"))d=n._spellCheckWindow.find(".e-suggesteditems"),y=n._spellCheckWindow.find(".e-sentence .e-sentencecontent"),n._errorWordsData.length>0?(y[0].innerHTML=h.resultHTML,n._replaceErrorText(y,r.toString()),n._listBoxDataUpdate(n)):(d.ejListBox({dataSource:null}),n._statusFlag=!1,n._alertWindowRender("validating"));else if(!ej.isNullOrUndefined(n._contextMenu)){if(n._isIframe(n.element)?$(n.element).contents().find("body").html(h.resultHTML):$(n._currentElement)[0].innerHTML=h.resultHTML,n._controlIds.length>0)for(l=0;l<n._controlIds.length;l++)for(a=$(n._controlIds[l]),c=0;c<a.length;c++)$(n._currentElement)[0]!==$(a[c])[0]&&(g=$(a[c]),n._replaceErrorText(g,r.toString()));n._renderMenu(n)}o={resultHTML:h.resultHTML,errorWordDetails:r,requestType:"addToDictionary"};n._trigger("actionSuccess",o)}}else n._subElements.length>0?n._updateTargetText(n):(i==="spellCheckDialog"&&n._spellCheckWindow.ejDialog("isOpen")&&n._spellCheckWindow.ejDialog("close"),i==="spellCheck"&&(o={resultHTML:t,errorWordDetails:u,requestType:"spellCheck"},n._trigger("actionSuccess",o)),i==="validateOnType"&&n._removeSpan(n),i!=="spellCheck"&&i!=="addToDictionary"&&n._alertWindowRender("load"))},error:function(t,r,u){var f={errorMessage:u,requestType:i};n._trigger("actionFailure",f)}})},t.prototype._suggestionsRequest=function(n,t,i,r){var u;u=r==="validateByMenu"||r==="suggestionsUpdate"?JSON.stringify({requestType:"getSuggestions",errorWord:i}):n._getModelValues(n,i);$.ajax({url:n.model.dictionarySettings.dictionaryUrl,data:{data:u},contentType:"application/json; charset=utf-8",dataType:n.model.ajaxDataType,crossDomain:!0,success:function(u){var f={},o,s,e,h,c;if(f.ErrorWord=i,f.SuggestedWords=u[i],n._suggestedWordCollection.push(f),r==="validateByMenu"){if(o=u[i],s={selectedErrorWord:i,requestType:"contextOpen"},n._trigger("contextOpen",s))return!1;n._contextMenuDisplay(n,o)}else r==="validateByDialog"?(e=n._updateErrorDetails(n,u),e.length>0?(h=n._filterErrorData(n,e),n._splitWords(t[0].innerText,n),n._processNode(n,t[0],h,"spellCheckDialog"),n._activeElement=t[0],n._changeAllErrors(n),n._listBoxDataUpdate(n)):n._subElements.length>0?n._updateTargetText(n):n._completionCheck(n)):r==="suggestionsUpdate"&&(c=u[t[0].innerText],n._dialogSuggestionsUpdate(n,c))}})},t.prototype._filterErrorData=function(n,t){var i=n._getFilterData(t,n);return ej.dataUtil.distinct(i)},t.prototype._updateErrorDetails=function(n,t){var i=[],r;if(ej.isNullOrUndefined(n._errorWordDetails))i=n._errorWordDetails=ej.isNullOrUndefined(n.model)?t:n.model.ajaxDataType==="json"?t.Data:t;else if(t.length>0)if(n._ignoreStatus)for(r=0;r<t.length;r++)n._errorWordDetails.push(t[r]),i=n._errorWordDetails;else i=n._errorWordDetails=t,n._ignoreStatus=!0;else i=n._errorWordDetails;return i},t.prototype._contextMenuDisplay=function(n,t){var i,e,r,h,l,a,o,u,s,f,c;if(ej.isNullOrUndefined(n._contextMenu)&&n._renderContextMenu(),i=n._contextMenu.data("ejMenu"),e=n.model.contextMenuSettings.menuItems,t.length>0){for(r=[],h=n.model.maxSuggestionCount<t.length?n.model.maxSuggestionCount:t.length,r=n._convertData(t.slice(0,h),"menuData"),l=r.length,a=r[h-1].id,o=0;o<e.length;o++)r.push(e[o]);for(i.option("fields.dataSource",r),u=i.element.find(".e-list"),s=0;s<l;s++)$(u[s]).addClass("e-errorsuggestions");for(f=0;f<u.length;f++)u[f].attributes.id.value===a&&$(u[f]).addClass("e-separator")}else i.option("fields.dataSource",e);c=n._contextMenuPosition(n._menuEvents,n);$(i.element).css({left:c.X,top:c.Y});$(i.element).css("display","block")},t.prototype._dialogSuggestionsUpdate=function(n,t){var u=n._spellCheckWindow.find(".e-suggesteditems"),f=$("#"+n._id+"_Suggestions").data("ejListBox"),i,e,r;t.length>0?(n._spellCheckWindow.find(".e-btnchange").hasClass("e-disable")&&n._spellCheckWindow.find(".e-btnchangeall").hasClass("e-disable")&&(n._spellCheckWindow.find(".e-btnchange").removeClass("e-disable"),n._spellCheckWindow.find(".e-btnchangeall").removeClass("e-disable")),e=n.model.maxSuggestionCount<t.length?n.model.maxSuggestionCount:t.length,i=t.slice(0,e)):(n._spellCheckWindow.find(".e-btnchange").addClass("e-disable"),n._spellCheckWindow.find(".e-btnchangeall").addClass("e-disable"),i=[n._localizedLabels.NoSuggestionMessage]);u.ejListBox({selectedIndex:null});u.ejListBox({dataSource:n._convertData(i,"dictionaryData"),selectedIndex:0});ej.isNullOrUndefined(f)||f.refresh();r=n._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller");!ej.isNullOrUndefined(r)&&r.isVScroll()&&$(n._spellCheckWindow.find("."+n.model.misspellWordCss)).get(0).scrollIntoView(!1)},t.prototype._replaceErrorText=function(n,t){for(var u,r=$(n).find(".errorspan"),i=0;i<r.length;i++)u=r[i].innerText||r[i].textContent,u===t&&$(r[i]).replaceWith(u)},t.prototype._dialogModeOperations=function(n,t,i,r){var o={errorWords:n._errorWordDetails,targetText:i,requestType:r},u=n._spellCheckWindow.find(".e-sentence .e-sentencecontent"),f,e;if(t.length>0){if(n._removeSpan(n),n._processNode(n,u[0],t,r),this._trigger("start",o))return!1;f=n._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller");f.refresh();n._listBoxDataUpdate(n)}else e=n._spellCheckWindow.find(".e-suggesteditems"),r==="spellCheckDialog"&&(u[0].innerHTML=i),e.ejListBox({dataSource:null}),n._statusFlag=!1,this._alertWindowRender("load")},t.prototype._validateOnTypeOperations=function(n,t,i,r){var e,f,o,s,h,c,u;if(t.length>0){if(this._controlIds.length>0&&!this._currentActiveElement&&this.model.enableValidateOnType||this._controlIds.length>0&&(!this.model.enableValidateOnType||!this._statusMultiTarget))for(u=0;u<n._controlIds.length;u++)for(e=$(this._controlIds[u]),f=0;f<e.length;f++)o=n._isIframe($(e[f]))?n._getIframeElement($(e[f])):$(e[f])[0],n._activeElement=n._currentActiveElement=o,n._removeSpan(n),n._processNode(n,o,t,r),s={},s.controlId=n._controlIds[u],s.errorHtml=o.innerHTML,n._control.push(s);else this.model.enableValidateOnType&&this._currentActiveElement?(n._removeSpan(n),n._processNode(n,this._currentActiveElement,t,r),this._statusMultiTarget=!1):n._isIframe(n.element)?(h=n._getIframeElement(n.element),n._activeElement=h,n._removeSpan(n),n._processNode(n,h,t,r)):(n._removeSpan(n),n._processNode(n,$(n.element)[0],t,r));if(n._statusFlag=!0,c=this._controlIds.length>0?{errorWords:n._errorWordDetails,targetControls:this._control,requestType:r}:{errorWords:n._errorWordDetails,targetText:$(n.element)[0].innerText,requestType:r},this._trigger("start",c))return!1;if(n._isIframe(this.element))n._bindBeforeOpen(n,$(this.element).contents().find("body"));else if(n._controlIds.length>0)for(u=0;u<n._controlIds.length;u++)n._bindBeforeOpen(n,$(n._controlIds[u]));else n._bindBeforeOpen(n,$(this.element))}else n._removeSpan(n),n._statusFlag=!1;this.model.enableValidateOnType&&n.setCursorPosition(n._currentCursorTarget)},t.prototype._bindBeforeOpen=function(n,t){n._on($(t).find("."+this.model.misspellWordCss),"contextmenu",$.proxy(n._contextOpen,n))},t.prototype._contextOpen=function(n){var i=$(n.target),t,r,u;i.hasClass("errorspan")?(n.preventDefault(),t=this,r=t._selectedValue=i[0].innerText,t._selectedTarget=i[0],t._menuEvents=n,u=t._filterSuggestions(t,r),u.length>0?t._contextMenuDisplay(t,u[0].SuggestedWords):t._suggestionsRequest(t,null,r,"validateByMenu")):this._elementRightClick(n)},t.prototype._processNode=function(n,t,i,r){for(var b,k,c,u,p,s=n._filterTextNodes(n,t),e=0;e<s.length;e++){var o=s[e],w=[s[e]],h=s[e].data,l=!1,a=!1,v=!1;if(n.model.ignoreSettings.ignoreUrl&&(b=/^((http|ftp|https)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/,l=b.test(o.wholeText),l&&(v=l)),n.model.ignoreSettings.ignoreEmailAddress&&(k=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i,a=k.test(o.wholeText),a&&(v=a)),!v)for(c=0;c<n._words.length;c++)for(u=0;u<i.length;u++)if(n._words[c]===i[u]&&!ej.isNullOrUndefined(h.match(new RegExp("\\b"+i[u]+"\\b","gi")))&&h.indexOf(i[u])!==-1){var d=h.indexOf(i[u]),g=i[u].length,f=o.splitText(d),y=document.createElement("span");y.className=r==="validateOnType"?"errorspan "+this.model.misspellWordCss:"errorspan";p=document.createTextNode(i[u]);y.appendChild(p);o.parentNode.insertBefore(y,f);f.data=f.data.substr(g);o=f;w.push(p);w.push(f);h=f.data}}},t.prototype._spellValidateOnType=function(n){var i,t;if(this.model.enableValidateOnType&&this.model.contextMenuSettings.enable&&(i={events:n,requestType:"validate"},this._trigger("validating",i),this._statusMultiTarget=!1,this._currentActiveElement=i.events.currentTarget,i.events.cancelable===!0)){if(t=n.keyCode,t>=16&&t<=31)return;if(t>=37&&t<=40)return;(t===32||t===13)&&(this._statusMultiTarget=!0,this._triggerSpelling())}},t.prototype._triggerSpelling=function(){var n=this;setTimeout(function(){n.getCursorPosition();n.validate()},2)},t.prototype.getCursorPosition=function(){var n,o,r,i,t,f,u,e;if(this.model.enableValidateOnType&&this.model.contextMenuSettings.enable){if(n=this,o=String.fromCharCode(7),this._controlIds.length>0)for(f=0;f<this._controlIds.length;f++)u=$(this._controlIds[f]),this._isIframe(u)?(r=u[0].contentDocument.getSelection(),i=u[0].contentDocument.getSelection(),t=u[0].contentDocument.createRange()):(r=document.getSelection(),i=document.getSelection(),t=document.createRange());else this._isIframe(this.element)?(r=this.element[0].contentDocument.getSelection(),i=this.element[0].contentDocument.getSelection(),t=this.element[0].contentDocument.createRange()):(r=document.getSelection(),i=document.getSelection(),t=document.createRange());return e=r.getRangeAt(0),e.deleteContents(),e.insertNode(document.createTextNode(o)),$(e.startContainer.parentElement).hasClass("errorspan")&&(this.model.controlsToValidate?n._normalizeTextNodes(this._currentActiveElement):n._normalizeTextNodes($(n.element)[0])),n._currentCursorTarget=n._getActiveTarget(n,o),t.collapse(!0),t.setStart(n._currentCursorTarget.node,n._currentCursorTarget.offset),t.setEnd(n._currentCursorTarget.node,n._currentCursorTarget.offset),i.removeAllRanges(),i.addRange(t),n._currentCursorTarget}},t.prototype._getActiveTarget=function(n,t){var r,u,f,i;for(r=this.model.enableValidateOnType?n._filterTextNodes(n,this._currentActiveElement):n._filterTextNodes(n,$(n.element)[0]),u=null,f=null,i=0;i<r.length;i++)if(r[i].data.indexOf(t)>-1)return f=r[i],u=r[i].data.indexOf(t),r[i].data=r[i].data.replace(t,""),{node:f,offset:u}},t.prototype.setCursorPosition=function(n){var o,s,a,i,b,e,c,r,u,v,f,p,t,w;if(this._controlIds.length>0)for(t=0;t<this._controlIds.length;t++)a=$(this._controlIds[t]),this._isIframe(a)?(o=a[0].contentDocument.getSelection(),s=a[0].contentDocument.createRange()):(o=document.getSelection(),s=document.createRange());else this._isIframe(this.element)?(o=this.element[0].contentDocument.getSelection(),s=this.element[0].contentDocument.createRange()):(o=document.getSelection(),s=document.createRange());if(o.getRangeAt&&o.rangeCount&&(b=String.fromCharCode(7),n)){for(i=this.model.controlsToValidate?this._filterTextNodes(this,this._currentActiveElement):this._filterTextNodes(this,$(this.element)[0]),e=n.node,c=n.offset,t=0;t<i.length;t++)i[t]===e&&(r=t);if(u="",r===undefined){var l="",h="",y="",u="",k="",d=!1,g=!1;for(v=0;v<e.length;v++)f=e.data.charAt(v),f.charCodeAt(0)!=160?f.charCodeAt(0)!=32?l===""?u=u+f:f!=b&&(h=h+f):(l=u+f,h=f):(l=u+f,y=" "+y+f);for(u=u+h,k=l.trim(),t=0;t<i.length;t++){if(i[t].data===u&&(r=t),i[t].data===l&&(r=t),i[t].data===h&&h!=""&&(r=t,d=!0),i[t].data===u&&(r=t,g=!0),i[t].data===k&&(r=t),i[t].data===u&&i[t+1]!==undefined&&i[t+1].data.charCodeAt(0)===160){r=t;break}if(i[t].data===u&&i[t+1]!==undefined&&i[t+1].data.charCodeAt(1)===160&&y.length>=1){r=t;break}if((i[t].data===l||i[t].data===u)&&i[t+1]==undefined){p=document.createTextNode("");i.push(p);this._currentActiveElement.appendChild(p);r=t+1;c=i[r].data.length;e=i[r];break}}}for(t=r;t<i.length-1;t++){if(c<=i[t].data.length){e=i[t];break}if(d===!1||h===undefined||h==="")c-=i[t].data.length,e=i[t+1];else{c=1;e=i[t];break}}w=e;s.collapse(!0);s.setStart(w,c);s.setEnd(w,c);o.removeAllRanges();o.addRange(s)}},t.prototype._normalizeTextNodes=function(n){n.normalize();return},t.prototype._filterTextNodes=function(n,t){function r(n){for(var t,u=0;u<n.childNodes.length;u++)t=n.childNodes[u],t.nodeType===3?i.push(t):t.childNodes&&r(t)}var i=[];return r(t),i},t.prototype._removeSpan=function(n){var r,i,t,u;for(n.model.enableValidateOnType?n._currentActiveElement&&(r=n._currentActiveElement):r=!ej.isNullOrUndefined(n.model.controlsToValidate)||n._isIframe(n.element)?n._activeElement:n.element[0],i=$(r).find("span.errorspan"),t=0;t<i.length;t++)u=i[t].innerText||i[t].textContent,$(i[t]).replaceWith(u)},t.prototype._getFilterData=function(n,t){var u=[],i,r;for(t._errorWordsData=t._errorWordDetails=n,i=0;i<t.model.ignoreWords.length;i++)t._filterData(t.model.ignoreWords[i],t);for(r=0;r<t._errorWordsData.length;r++)u.push(t._errorWordsData[r].ErrorWord);return u},t.prototype._filterData=function(n,t){var i=(new ej.Query).where("ErrorWord",ej.FilterOperators.notEqual,n);t._errorWordsData=new ej.DataManager(t._errorWordsData).executeLocal(i)},t.prototype._formHtml=function(n,t){for(var r,u,i=0;i<n.length;i++)r='<span class="errorspan">'+n[i]+"<\/span>",u=new RegExp("\\b"+n[i]+"\\b","gi"),t=t.replace(u,r);return t},t.prototype._listBoxDataUpdate=function(n){var t=n._spellCheckWindow.find(".e-sentence .e-sentencecontent").find(".errorspan"),i,r;$(t[0]).addClass(this.model.misspellWordCss);t.length>0?(i=n._filterSuggestions(n,t[0].innerText),i.length>0?n._dialogSuggestionsUpdate(n,i[0].SuggestedWords):n._suggestionsRequest(n,t,t[0].innerText,"suggestionsUpdate")):!ej.isNullOrUndefined(this.model.controlsToValidate)&&n._targetStatus?n._updateTargetText(n):(r=n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML,n._validationComplete(n,r))},t.prototype._filterSuggestions=function(n,t){var i=[],r,u;return n._suggestedWordCollection.length>0&&(r=(new ej.Query).where("ErrorWord",ej.FilterOperators.equal,t),u=new ej.DataManager(n._suggestedWordCollection).executeLocal(r),i=u),i},t.prototype._validationComplete=function(n,t){n._updateTargetString(n);var i={targetElement:n._currentTargetElement,targetText:t,requestType:"changeErrorWord"};if(this._trigger("complete",i))return!1;n._statusFlag=!1;n._alertWindowRender("validating")},t.prototype._onMenuSelect=function(n){var o=n.events.ID.split("_"),f=!1,c,t,r,l,a,s,h,i,e,u,v,y,p,w;if(ej.isNullOrUndefined(this.model.controlsToValidate))f=this._isIframe(this.element);else for(i=0;i<this._controlIds.length;i++)c=this._isIframe($(this._controlIds[i])),c&&(f=!0),f&&(this.element=$(this._controlIds[0]));if(t=f?this.element:this._selectedTarget.parentElement,this._activeElement=t,r="",r=this._isIframe($(t))?$(t).contents().find("body").html():$(t).html().trim(),l={selectedOption:o[0],requestType:"menuSelect",targetContent:r,selectedValue:this._selectedValue},this._trigger("contextClick",l))return!1;switch(o[0]){case"AddToDictionary":a=(this._selectedTarget.innerText||this._selectedTarget.textContent).trim();this._currentElement=$(t);this.addToDictionary(a);break;case"IgnoreAll":if(s=(this._selectedTarget.innerText||this._selectedTarget.textContent).trim(),h=this.ignoreAll(s,r),r=h.resultHTML,$(t).html(h.resultHTML),this._controlIds.length>0)for(i=0;i<this._controlIds.length;i++)for(e=$(this._controlIds[i]),u=0;u<e.length;u++)$(t)[0]!==$(e[u])[0]&&(v=$(e[u]),this._replaceErrorText(v,s));this._renderMenu(this);break;default:y=o[0];p=$(n.element).hasClass("e-errorsuggestions");p&&(this._selectedTarget.innerHTML=y,w=document.createTextNode(this._selectedTarget.innerText||this._selectedTarget.textContent),this._selectedTarget.parentNode.insertBefore(w,this._selectedTarget),$(this._selectedTarget).remove(),r=$(t).html());this._renderMenu(this)}},t.prototype._renderMenu=function(n){var t,i,f,u,r;if(n._controlIds.length>0){for(i=0;i<n._controlIds.length;i++)if(t=n._getErrorLength(n,$(n._controlIds[i])),t>0)break}else t=n._getErrorLength(n,$(n.element));if(t===0&&(f={targetElement:n._currentTargetElement,requestType:"validate"},n._trigger("complete",f)))return!1;n._statusFlag=t>0?!0:!1;u=n._contextMenu.data("ejMenu");$(u.element).is(":visible")&&u.hide();r=ej.isNullOrUndefined(n._activeElement)?n.element:n._activeElement;n._isIframe($(r))?n._bindBeforeOpen(n,$(r).contents().find("body")):n._bindBeforeOpen(n,$(r))},t.prototype._getErrorLength=function(n,t){var i=n._isIframe(t)?$(t).contents().find("body")[0]:$(t);return $(i).find(".errorspan").length},t.prototype._getElement=function(){for(var t=document.getElementsByTagName("span"),r=this._selectedValue,i=[],n=0;n<t.length;n++)t[n].textContent===r&&i.push(t[n]);return i},t.prototype._alertClose=function(){!ej.isNullOrUndefined(this._alertWindow)&&this._alertWindow.parents().find(".e-alertdialog").length>0&&(this._alertWindow.ejDialog("close"),this._alertWindow.parents().find(".e-alertdialog").remove(),this._close())},t.prototype._close=function(){var t,i,n,u,r,f;if(!ej.isNullOrUndefined(this._spellCheckWindow)&&this._spellCheckWindow.parents().find(".e-spellcheck.e-dialog-wrap").length>0){for(t=this._spellCheckWindow.find(".e-sentence .e-sentencecontent"),i=$(t[0]).find("span.errorspan"),n=0;n<i.length;n++)u=i[n].innerText||i[n].textContent,$(i[n]).replaceWith(u);if(this._updateTargetString(this),r=t.html(),f=ej.isNullOrUndefined(this.model.controlsToValidate)?{updatedText:t.text(),updatedHtml:r,requestType:"dialogClose"}:{updatedText:t.text(),targetElement:this._currentTargetElement,updatedHtml:r,requestType:"dialogClose"},this._trigger("dialogClose",f))return!1;this._spellCheckWindow.ejDialog("isOpen")&&this._spellCheckWindow.ejDialog("close");this._spellCheckWindow.parents().find(".e-spellcheck.e-dialog-wrap").remove();this._changeAllWords=[];ej.isNullOrUndefined(this.model.controlsToValidate)||(this._controlIds=this.model.controlsToValidate.split(","),this._subElements=[])}},t.prototype._changeErrorWord=function(n){var r=$("#"+this._id+"_Suggestions").ejListBox("option","value"),f=this._spellCheckWindow.find(".e-sentence .e-sentencecontent"),u=this._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML,i=$(this._spellCheckWindow.find(".e-sentence .e-sentencecontent").find("."+this.model.misspellWordCss)[0]).text().trim(),t;r=r===this._localizedLabels.NoSuggestionMessage?i:r;n.model.text===this._localizedLabels.AddToDictionary?(this._currentElement=$(f),this.addToDictionary(i)):n.model.text===this._localizedLabels.IgnoreOnceButtonText?(t=this.ignore(i,u,null),t!==!1&&this._updateErrorWord(this,t,n,i,null,"ignore")):n.model.text===this._localizedLabels.IgnoreAllButtonText?(t=this.ignoreAll(i,u),t!==!1&&this._updateErrorWord(this,t,n,i,null,"ignoreAll")):n.model.text===this._localizedLabels.ChangeButtonText?(t=this.change(i,u,r,null),t!==!1&&this._updateErrorWord(this,t,n,i,r,"change")):n.model.text===this._localizedLabels.ChangeAllButtonText&&(t=this.changeAll(i,u,r),t!==!1&&this._updateErrorWord(this,t,n,i,r,"changeAll"))},t.prototype._convertData=function(n,t){for(var r=[],i=0;i<n.length;i++)t==="dictionaryData"?r.push({field:n[i]}):t==="menuData"&&r.push({id:n[i],text:n[i]});return r},t.prototype._updateErrorWord=function(n,t,i,r,u,f){var o=this._spellCheckWindow.find(".e-suggesteditems"),e,s,h;n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML=t.resultHTML;e=this._spellCheckWindow.find(".e-sentence .e-sentencecontent").find(".errorspan");e.length>0?n._targetUpdate(n,e,r,f,u):!ej.isNullOrUndefined(this.model.controlsToValidate)&&n._targetStatus?n._updateTargetText(n):(ej.isNullOrUndefined(this.model.controlsToValidate)||$(this._proElements).html(n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML),h=[this._localizedLabels.NoSuggestionMessage],o.ejListBox({selectedItemIndex:null}),o.ejListBox({dataSource:this._convertData(h,"dictionaryData"),selectedItemIndex:0}),s=$("#"+this._id+"_Suggestions").data("ejListBox"),s.refresh(),n._validationComplete(n,t.resultHTML))},t.prototype._targetUpdate=function(n,t,i,r,u){var f,h,o,e,s;if(r==="changeAll")for(f=0;f<t.length;f++)h=t[f].innerText||t[f].textContent,h===i&&$(t[f]).replaceWith(u);for(o=0;o<this.model.ignoreWords.length;o++)for(e=0;e<t.length;e++)s=t[e].innerText||t[e].textContent,s===n.model.ignoreWords[o]&&$(t[e]).replaceWith(s);n._listBoxDataUpdate(n)},t.prototype._updateTargetText=function(n){var f,t,i,e,r,o,u,s;if(n._updateTargetString(n),f=ej.isNullOrUndefined(n.model.controlsToValidate)?$("#"+n._id):$(n._proElements),n._proElements=$(n._subElements[0]),n._proElements.length>0||n._subElements.length>0){if(t=$(n._subElements[0]),n._currentTargetElement=t,i=$(t)[0].tagName==="TEXTAREA"||$(t)[0].tagName==="INPUT"?$(t)[0].value:$(t)[0].innerHTML,e={previousElement:f,currentElement:t,targetHtml:i,requestType:"updateText"},n._trigger("targetUpdating",e))return n._close(),!1;n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML=i;n._subElements=n._subElements.slice(1);r=n._spellCheckWindow.find(".e-sentence .e-sentencecontent");o=n._filteringDiffWords(n,r[0].innerText);n._suggestionsRequest(n,r,o.toString(),"validateByDialog")}else u=n._spellCheckWindow.find(".e-sentence .e-sentencecontent").find(".errorspan"),u.length===0&&n._subElements.length>0?n._updateTargetText(n):u.length>0?(s=n._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller"),s.refresh(),n._listBoxDataUpdate(n)):n._completionCheck(n)},t.prototype._updateTargetString=function(n){var t=ej.isNullOrUndefined(n.model.controlsToValidate)?$("#"+n._id):$(n._proElements),i;t.length>0&&(i=n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML,n._isIframe(t)?t.contents().find("body").html(i):$(t)[0].tagName==="INPUT"?t.val(i):t.html(i))},t.prototype._completionCheck=function(n){n._subElements=n._subElements.slice(1);n._subElements.length===0&&(n._targetStatus=!1);n._validationComplete(n,"")},t.prototype._changeAllErrors=function(n){for(var u,t,i=$(n._activeElement).find(".errorspan"),r=0;r<i.length;r++)for(u=i[r].innerText||i[r].textContent,t=0;t<n._changeAllWords.length;t++)u===n._changeAllWords[t].ErrorWord&&$(i[t]).replaceWith(n._changeAllWords[t].ReplaceWord)},t.prototype._setModel=function(n){var f=this,t,u,i,r;for(t in n)if(n.hasOwnProperty(t))switch(t){case"locale":this.model.locale=n[t];this._localizedLabels=ej.getLocalizedConstants("ej.SpellCheck",this.model.locale);break;case"misspellWordCss":this.model.misspellWordCss=n[t];this.model.contextMenuSettings.enable&&(u=$(this.element[0]).find("span.errorspan").attr("class").toString().split(" ")[1],$(this.element[0]).find("span.errorspan").removeClass(u).addClass(this.model.misspellWordCss));break;case"contextMenuSettings":$.extend(this.model.contextMenuSettings,n[t]);this.model.contextMenuSettings.enable?(this.validate(),this._renderControls()):(ej.isNullOrUndefined(this._contextMenu)||this._contextMenu.parent().remove(),this._removeSpan(this));break;case"ignoreSettings":$.extend(this.model.ignoreSettings,n[t]);this._ignoreStatus=!1;this._statusFlag=!0;this.model.contextMenuSettings.enable&&(this.validate(),this._renderControls());break;case"dictionarySettings":$.extend(this.model.dictionarySettings,n[t]);break;case"maxSuggestionCount":this.model.maxSuggestionCount=n[t];break;case"ignoreWords":this.model.ignoreWords=n[t];this.model.contextMenuSettings.enable&&this.validate();break;case"controlsToValidate":if(this.model.controlsToValidate=n[t],ej.isNullOrUndefined(this.model.controlsToValidate))for($(this.element).attr("style","display:block"),i=0;i<this._controlIds.length;i++)r=$(this._controlIds[i]),r.removeClass("e-spellcheck"),r[0].spellcheck=!0,r[0].addEventListener("input",function(){f._statusFlag=!1},!1);this._renderControls();break;case"isResponsive":this.model.isResponsive=n[t];this._renderControls();break;case"enableValidateOnType":this.model.enableValidateOnType=n[t];this._renderControls()}},t.prototype._getModelValues=function(n,t){var i={ignoreAlphaNumericWords:n.model.ignoreSettings.ignoreAlphaNumericWords,ignoreEmailAddress:n.model.ignoreSettings.ignoreEmailAddress,ignoreHtmlTags:n.model.ignoreSettings.ignoreHtmlTags,ignoreMixedCaseWords:n.model.ignoreSettings.ignoreMixedCaseWords,ignoreUpperCase:n.model.ignoreSettings.ignoreUpperCase,ignoreUrl:n.model.ignoreSettings.ignoreUrl,ignoreFileNames:n.model.ignoreSettings.ignoreFileNames};return JSON.stringify({requestType:"checkWords",model:i,text:t})},t.prototype._getLocalizedLabels=function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)},t.prototype._elementRightClick=function(n){if(!ej.isNullOrUndefined(this._contextMenu)&&!$(n.target).hasClass("e-menulink")){var t=this._contextMenu.data("ejMenu");ej.isNullOrUndefined(t)||$(t.element).is(":visible")&&t.hide()}},t}(ej.WidgetBase);ej.widget("ejSpellCheck","ej.SpellCheck",new SpellCheck);ej.SpellCheck.Locale=ej.SpellCheck.Locale||{};ej.SpellCheck.Locale["default"]=ej.SpellCheck.Locale["en-US"]={SpellCheckButtonText:"Spelling",NotInDictionary:"Not in Dictionary",SuggestionLabel:"Suggestions",IgnoreOnceButtonText:"Ignore Once",IgnoreAllButtonText:"Ignore All",AddToDictionary:"Add to Dictionary",ChangeButtonText:"Change",ChangeAllButtonText:"Change All",CloseButtonText:"Close",CompletionPopupMessage:"Spell check is complete",CompletionPopupTitle:"Spell check",Ok:"OK",NoSuggestionMessage:"No suggestions available",NotValidElement:"Specify the valid control id or class name to spell check"};ej.Ej3DRender=function(){},function(n){var r;ej.Ej3DRender.Polygons=[];ej.Ej3DRender.prototype={matrix3D:function(){},vector3D:function(){},BSPTreeBuilder:function(){},Graphics3D:function(){},polygon3D:function(){}};r=new ej.Ej3DRender;r.vector3D.prototype={x:"",y:"",z:"",Epsilon:1e-5,isValid:function(n){return!isNaN(n.x)&&!isNaN(n.y)&&!isNaN(n.z)},vector3D:function(n,t){this.x=n.x;this.y=n.y;this.z=t},vector3D:function(n,t,i){return this.x=n,this.y=t,this.z=i,{x:n,y:t,z:i}},vector3DMinus:function(n,t){return this.vector3D(n.x-t.x,n.y-t.y,n.z-t.z)},vector3DPlus:function(n,t){return this.vector3D(n.x+t.x,n.y+t.y,n.z+t.z)},vector3DMultiply:function(n,t){var i=n.y*t.z-t.y*n.z,r=n.z*t.x-t.z*n.x,u=n.x*t.y-t.x*n.y;return this.vector3D(i,r,u)},vector3dAND:function(n,t){return n.x*t.x+n.y*t.y+n.z*t.z},vector3DStarMultiply:function(n,t){var i=n.x*t,r=n.y*t,u=n.z*t;return this.vector3D(i,r,u)},getLength:function(n){var t=this.vector3dAND(n,n);return Math.sqrt(t)},normalize:function(){var n=this.getLength();x/=n;y/=n;z/=n},getNormal:function(n,t,i){var f=this.vector3DMinus(n,t),e=this.vector3DMinus(i,t),u=this.vector3DMultiply(f,e),r=this.getLength(u);return r<this.Epsilon&&(r=0),{x:u.x/r,y:u.y/r,z:u.z/r}}};r.matrix3D.prototype={MATRIX_SIZE:4,matrix3D:function(n){for(var i=[],t=0;t<n;t++)i[t]=this.createArray(n);return i},isAffine:function(n){return n[0][3]==0&&n[1][3]==0&&n[2][3]==0&&n[3][3]==1},createArray:function(n){var t=[];for(index=0;index<n;++index)t[index]=0;return t},getIdentity:function(){for(var t=this.matrix3D(this.MATRIX_SIZE),n=0;n<this.MATRIX_SIZE;n++)t[n][n]=1;return t},getInvertal:function(n){for(var t,i=this.getIdentity(),r=0;r<this.MATRIX_SIZE;r++)for(t=0;t<this.MATRIX_SIZE;t++)i[r][t]=this.getMinor(n,r,t);return i=this.transposed(i),this.getMatrixMultiple(1/this.getDeterminant(n),i)},getMatrixMultiple:function(n,t){for(var r,i=0;i<t.length;i++)for(r=0;r<t[i].length;r++)t[i][r]=t[i][r]*n;return t},getMatrixVectorMutiple:function(n,t){var r=n[0][0]*t.x+n[1][0]*t.y+n[2][0]*t.z+n[3][0],u=n[0][1]*t.x+n[1][1]*t.y+n[2][1]*t.z+n[3][1],f=n[0][2]*t.x+n[1][2]*t.y+n[2][2]*t.z+n[3][2],i;return this.isAffine(n)||(i=1/(n[0][3]*t.x+n[1][3]*t.y+n[2][3]*t.z+n[3][3]),r*=i,u*=i,f*=i),{x:r,y:u,z:f}},getMatrixVectorAnd:function(n,t){var i=n[0][0]*t.x+n[1][0]*t.y+n[2][0]*t.z,u=n[0][1]*t.x+n[1][1]*t.y+n[2][1]*t.z,f=n[0][2]*t.x+n[1][2]*t.y+n[2][2]*t.z;return r.vector3D.prototype.vector3D(i,u,f)},getMatrixAdd:function(n,t){for(var i,u=this.matrix3D(4),r=0;r<4;r++)for(i=0;i<4;i++)u[r][i]=n[r][i]+t[r][i];return u},getMatrixMultiplication:function(n,t){for(var i,f,r,o,e=this.getIdentity(),u=0;u<this.MATRIX_SIZE;u++)for(i=0;i<this.MATRIX_SIZE;i++){for(f=0,r=0;r<this.MATRIX_SIZE;r++)f+=n[r][i]*t[u][r],o=f;e[u][i]=f}return e},getMatrixEqual:function(n,t){for(var i,u=!0,r=0;r<n.length;r++)for(i=0;i<n.length;i++)n[r][i]!=t[r][i]&&(u=!1);return u},getMatrixNotEqual:function(n,t){for(var i,u=!0,r=0;r<n.length;r++)for(i=0;i<n.length;i++)n[r][i]!=t[r][i]&&(u=!1);return!u},getMinor:function(n,t,i){return((t+i)%2==0?1:-1)*this.getDeterminant(this.getMMtr(n,t,i))},getMMtr:function(n,t,i){for(var o,u,s,f=n.length-1,e=this.createArray(f),r=0;r<f;r++)for(o=r>=t?r+1:r,e[r]=this.createArray(f),u=0;u<f;u++)s=u>=i?u+1:u,e[r][u]=n[o][s];return e},getDeterminant:function(n){var u=n.length,r=0,i,t,f;if(u<2)r=n[0][0];else for(i=1,t=0;t<u;t++)f=this.getMMtr(n,t,0),r+=i*n[t][0]*this.getDeterminant(f),i=i>0?-1:1;return r},transform:function(n,t,i){var r=this.getIdentity();return r[3][0]=n,r[3][1]=t,r[3][2]=i,r},turn:function(n){var t=this.getIdentity();return t[0][0]=Math.cos(n),t[2][0]=-Math.sin(n),t[0][2]=Math.sin(n),t[2][2]=Math.cos(n),t},tilt:function(n){var t=this.getIdentity();return t[1][1]=Math.cos(n),t[2][1]=Math.sin(n),t[1][2]=-Math.sin(n),t[2][2]=Math.cos(n),t},transposed:function(n){for(var t,r=this.getIdentity(),i=0;i<this.MATRIX_SIZE;i++)for(t=0;t<this.MATRIX_SIZE;t++)r[i][t]=n[t][i];return r},shear:function(n,t,i,r,u,f){var e=this.getIdentity();return e[0]=n,e[0]=t,e[1]=i,e[1]=r,e[2]=u,e[2]=f,e}};r.Graphics3D.prototype={addVisual:function(n){return n==null||f.test(n)?-1:(n.Graphics3D=this,e.add(n))},getVisualCount:function(){return ej.Ej3DRender.Polygons.length()},remove:function(n){ej.Ej3DRender.Polygons.Remove(n)},clearVisual:function(){ej.Ej3DRender.Polygons=null},getVisual:function(){return ej.Ej3DRender.Polygons},prepareView:function(n,t,i,r,u,f){arguments.length==0?e.build():(ej.Ej3DRender.transform==null?ej.Ej3DRender.transform=ej.EjSvgRender.chartTransform3D.transform3D(u):ej.Ej3DRender.transform.mViewport=u,ej.Ej3DRender.tree||(ej.Ej3DRender.tree=[]),ej.Ej3DRender.transform.Rotation=i,ej.Ej3DRender.transform.Tilt=r,ej.Ej3DRender.transform.Depth=t,ej.Ej3DRender.transform.PerspectiveAngle=n,ej.EjSvgRender.chartTransform3D.transform(ej.Ej3DRender.transform),ej.Ej3DRender.tree[f._id]=e.build())},view:function(n,i,r,u,f,e,o){var h=32767,s;if(arguments.length==2){if(n==null)return;s=t.vector3D(0,0,h);this.drawBspNode3D(ej.Ej3DRender.tree[i._id],s,n,i)}else{if(n==null)return;ej.Ej3DRender.transform==null?ej.Ej3DRender.transform=ej.EjSvgRender.chartTransform3D.transform3D(f):ej.Ej3DRender.transform.mViewport=f;ej.Ej3DRender.transform.Rotation=r;ej.Ej3DRender.transform.Tilt=u;ej.Ej3DRender.transform.Depth=o;ej.Ej3DRender.transform.PerspectiveAngle=e;ej.EjSvgRender.chartTransform3D.transform(ej.Ej3DRender.transform);s=t.vector3D(0,0,h);this.drawBspNode3D(ej.Ej3DRender.tree[i._id],s,n,i)}},draw3DElement:function(n,t){n.Plane.element?n.Plane.element.tag=="text"||n.Plane.element.tag=="dataLabel"?f.drawText(n.Plane,t):n.Plane.element.tag=="polyline"?f.drawPolyLine(n.Plane,t):n.Plane.element.tag=="template"?f.drawTemplate(n.Plane,t):f.drawLine(n.Plane,t):f.draw(n.Plane,t)},drawBspNode3D:function(n,i,r,u){if(n!=null&&ej.Ej3DRender.transform!=null)for(;;){var e=t.vector3dAND(f.getNormal(ej.EjSvgRender.chartTransform3D.result(ej.Ej3DRender.transform),n.Plane.VectorPoints),i);if(e>n.Plane.D){if(n.Front!=null&&this.drawBspNode3D(n.Front,i,r,u),this.draw3DElement(n,u),n.Back!=null){n=n.Back;continue}}else if(n.Back!=null&&this.drawBspNode3D(n.Back,i,r,u),this.draw3DElement(n,u),n.Front!=null){n=n.Front;continue}break}}};r.BSPTreeBuilder.prototype={EPSILON:.0005,Polygon:[],add:function(n){return ej.Ej3DRender.Polygons.push(n),ej.Ej3DRender.Polygons.length-1},remove:function(n){ej.Ej3DRender.Polygons.splice(n,1)},clear:function(){ej.Ej3DRender.Polygons=[]},count:function(){return ej.Ej3DRender.Polygons.length},getNext:function(n,t){return n>=t?n-t:n<0?n+t:n},getNodeCount:function(n){return n==null?0:1+this.getNodeCount(n.Back)+this.getNodeCount(n.Front)},vector3DIndexClassification:function(n,t,i){return{index:t,result:i,vector:n,isCuttingBackPoint:!1,cuttingBackPairIndex:null,alreadyCuttedBack:!1,isCuttingFrontPoint:!1,cuttingFrontPairIndex:null,alreadyCuttedFront:!1}},classifyPoint:function(n,t){var i="OnPlane",u=-t.D-r.vector3D.prototype.vector3dAND(n,t.normal);return u>this.EPSILON?i="OnBack":u<-this.EPSILON&&(i="OnFront"),i},classifyPolygon:function(n,t){var i=t.Points,f,h,s;if(i==null)return"Unknown";var e=0,o=0,u=0,c=n.normal,l=n.D;for(f=0,h=i.length;f<h;f++)if(s=-l-r.vector3D.prototype.vector3dAND(i[f],c),s>this.EPSILON?e++:s<-this.EPSILON?o++:u++,e>0&&o>0)break;return u==i.length?"OnPlane":o+u==i.length?"ToRight":e+u==i.length?"ToLeft":"Unknown"},splitPolygon:function(i,r){var w=[],b=[],rt,v,e,k,ut,u,o,ft;if(i.Points!=null){var l=[],s=[],h=[],k,d,g=i.Points.length;for(u=0;u<g;u++){var nt=i.Points[u],y=i.Points[this.getNext(u+1,g)],p=this.classifyPoint(nt,r),a=this.classifyPoint(y,r),c=this.vector3DIndexClassification(nt,l.length,p);if(l.push(c),p!=a&&p!="OnPlane"&&a!="OnPlane"){var it=t.vector3DMinus(nt,y),et=t.vector3DMinus(t.vector3DStarMultiply(r.normal,-r.D),y),ot=t.vector3dAND(et,r.normal),st=ot/t.vector3dAND(r.normal,it),ht=t.vector3DPlus(y,t.vector3DStarMultiply(it,st)),tt=this.vector3DIndexClassification(ht,l.length,"OnPlane");l.push(tt);s.push(tt);h.push(tt)}else if(p=="OnPlane"){if(rt=i.Points[this.getNext(u-1,g)],v=this.classifyPoint(rt,r),v==a)continue;if(v!="OnPlane"&&a!="OnPlane")s.push(c),h.push(c);else if(v=="OnPlane")switch(a){case"OnBack":s.push(c);break;case"OnFront":h.push(c)}else if(a=="OnPlane")switch(v){case"OnBack":s.push(c);break;case"OnFront":h.push(c)}}}if(h.length!=0||s.length!=0){for(u=0;u<s.length-1;u+=2)e=s[u],o=s[u+1],e.CuttingBackPoint=!0,o.CuttingBackPoint=!0,e.CuttingBackPairIndex=o.index,o.CuttingBackPairIndex=e.index;for(u=0;u<h.length-1;u+=2)e=h[u],o=h[u+1],e.CuttingFrontPoint=!0,o.CuttingFrontPoint=!0,e.CuttingFrontPairIndex=o.index,o.CuttingFrontPairIndex=e.index;for(u=0;u<s.length-1;u++)(e=s[u],e.alreadyCuttedBack)||(k=this.cutOutBackPolygon(l,e),k.length>2&&(ut=f.polygon3D(k,i),w.push(n.extend({},ut))));for(u=0;u<h.length-1;u++)(o=h[u],o.alreadyCuttedFront)||(d=this.cutOutFrontPolygon(l,o),d.length>2&&(ft=f.polygon3D(d,i),b.push(n.extend({},ft))))}}else w.push(i),b.push(i);return{BackP:w,FrontP:b}},cutOutFrontPolygon:function(n,t){var i,o,r,u,f,e;for(points=[],i=t;;)if(i.alreadyCuttedFront=!0,points.push(i.vector),o=n[i.CuttingFrontPairIndex],i.CuttingFrontPoint)if(o.alreadyCuttedFront)if(r=n[this.getNext(i.index-1,n.length)],u=n[this.getNext(i.index+1,n.length)],r.result!="OnFront"||r.alreadyCuttedFront){if(u.result!="OnFront"||u.alreadyCuttedFront)return points;i=u}else i=r;else i=o;else if(f=n[this.getNext(i.index-1,n.length)],e=n[this.getNext(i.index+1,n.length)],f.result=="OnBack"||f.alreadyCuttedFront){if(e.result=="OnBack"||e.alreadyCuttedFront)return points;i=e}else i=f;return points},cutOutBackPolygon:function(n,t){for(var f=[],i=t,e,r,u;;)if(i.alreadyCuttedBack=!0,f.push(i.vector),e=n[i.CuttingBackPairIndex],i.CuttingBackPoint)if(e.alreadyCuttedBack)if(r=n[this.getNext(i.index-1,n.length)],u=n[this.getNext(i.index+1,n.length)],r.result!="OnBack"||r.alreadyCuttedBack){if(u.result!="OnBack"||u.alreadyCuttedBack)return f;i=u}else i=r;else i=e;else if(r=n[this.getNext(i.index-1,n.length)],u=n[this.getNext(i.index+1,n.length)],r.result=="OnFront"||r.alreadyCuttedBack){if(u.result=="OnFront"||u.alreadyCuttedBack)return f;i=u}else i=r;return f},build:function(){var f,e,o,i,s,h,c,n,l,t,r,u;if(arguments[0]){if(f=arguments[0],f.length<1)return null;for(e={Back:null,Front:null,Plane:null},o=f[0],e.Plane=o,i=[],s=[],h=1,c=f.length;h<c;h++)if(n=f[h],n!=o){l=this.classifyPolygon(o,n);switch(l){case"OnPlane":case"ToRight":s.push(n);break;case"ToLeft":i.push(n);break;case"Unknown":if(n.element&&(n.element.tag=="line"||n.element.tag=="text"))i.push(n);else{for(t=this.splitPolygon(n,o),r=0;r<t.BackP.length;r++)t.BackP[r].Name=t.BackP[r].Name+"back",i.push(t.BackP[r]);for(u=0;u<t.FrontP.length;u++)t.FrontP[u].Name=t.FrontP[u].Name+"front",s.push(t.FrontP[u])}}}return i.length>0&&(e.Back=this.build(i)),s.length>0&&(e.Front=this.build(s)),e}return this.build(ej.Ej3DRender.Polygons)}};r.polygon3D.prototype={epsilon:1e-5,normal:{x:0,y:0,z:0},a:this.normal?this.normal.x:0,b:this.normal?this.normal.y:0,c:this.normal?this.normal.z:0,vector:new(new ej.Ej3DRender).vector3D,polygon3D:function(n,t,i,r,u,f,e,o){var h,s;if(arguments.length==3)this.calcNormal(arguments[0],arguments[1],arguments[2]);else return arguments.length==2?(n=arguments[0],this.calcNormal(n[0],n[1],n[2]),this.vectorPoints=n,this.calcNormal(this.vectorPoints),s=arguments[1],s.Normal=this.normal,s.normal=this.normal,s.Points=n,s.VectorPoints=this.vectorPoints,s.IsSplitted=!0,s.d=this.d,s.D=this.d,s):(this.calcNormal(n[0],n[1],n[2]),this.vectorPoints=n,this.calcNormal(this.vectorPoints),h={Tag:"path",Parent:arguments[arguments.length-1]},s={Normal:this.normal,normal:this.normal,Points:n,VectorPoints:this.vectorPoints,Index:i,Tag:t,Name:o?o:null,StrokeThickness:u,Opacity:f,Fill:e,d:this.d,D:this.d},arguments.length!=1&&(s.Element=h),s)},createLine:function(n,i,r,u,f,e){var s=n.width,o=[];return o[0]=t.vector3D(i,r,e),o[1]=t.vector3D(i+s,f+s,e),o[2]=t.vector3D(u,f,e),this.line3D(n,o)},createPolyline:function(n,i){if(n.length==2){var r=n[1];n.push(t.vector3D(r.x,r.y,r.z))}return this.polyLine3D(i,n)},polyLine3D:function(n,t){var i=this.polygon3D(t);return i.element=n,i},line3D:function(n,t){var i=this.polygon3D(t);return i.element=n,i},text3D:function(n,t){var i=this.polygon3D(t);return i.element=n,i},createCylinder:function(n,r,u,f,e,o,s,h,c,l,a,v){var y=0,it,rt,k,b=24,d=360/b,g=Math.PI/180,ut=parseFloat((n.z+r.z)/2),w=[],p=[],nt=[],tt=[],ft=r.y-n.y<r.z-n.z?parseFloat((r.y-n.y)/2):parseFloat((r.z-n.z)/2),et=r.x-n.x<r.z-n.z?parseFloat((r.x-n.x)/2):parseFloat((r.z-n.z)/2),ot=parseFloat((n.x+r.x)/2),st=parseFloat((n.y+r.y)/2);switch(e){case"bar":case"stackingbar":case"stackingbar100":for(b++;b--;)rt=parseFloat(st+ft*Math.cos(y*d*g)),k=parseFloat(ut+ft*Math.sin(y*d*g)),p[y]={Y:rt,Z:k},nt.push(t.vector3D(n.x,p[y].Y,p[y].Z)),tt.push(t.vector3D(r.x,p[y].Y,p[y].Z)),y>0&&(vts=[t.vector3D(n.x,p[y-1].Y,p[y-1].Z),t.vector3D(r.x,p[y-1].Y,p[y-1].Z),t.vector3D(r.x,p[y].Y,p[y].Z),t.vector3D(n.x,p[y].Y,p[y].Z)],w[y+1]=this.polygon3D(vts,u,f,s,0,c,s,"_"+(y+1).toString()+"_"+a,v),i.addVisual(w[y+1])),y++;break;case"column":case"stackingcolumn":case"stackingcolumn100":for(b++;b--;)it=parseFloat(ot+et*Math.cos(y*d*g)),k=parseFloat(ut+et*Math.sin(y*d*g)),p[y]={X:it,Z:k},nt.push(t.vector3D(p[y].X,n.y,p[y].Z)),tt.push(t.vector3D(p[y].X,r.y,p[y].Z)),y>0&&(vts=[t.vector3D(p[y-1].X,n.y,p[y-1].Z),t.vector3D(p[y-1].X,r.y,p[y-1].Z),t.vector3D(p[y].X,r.y,p[y].Z),t.vector3D(p[y].X,n.y,p[y].Z)],w[y+1]=this.polygon3D(vts,u,f,s,0,c,s,"_"+(y+1).toString()+"_"+a,v),i.addVisual(w[y+1])),y++}return w[0]=this.polygon3D(tt,u,f,o,0,c,s,"_0_"+a,v),w[1]=this.polygon3D(nt,u,f,o,h,c,s,"_1_"+a,v),i.addVisual(w[0]),i.addVisual(w[1]),w},createBox:function(n,r,u,f,e,o,s,h,c,l,a,v){var y=[],p=[t.vector3D(n.x,n.y,n.z),t.vector3D(r.x,n.y,n.z),t.vector3D(r.x,r.y,n.z),t.vector3D(n.x,r.y,n.z)],w=[t.vector3D(n.x,n.y,r.z),t.vector3D(r.x,n.y,r.z),t.vector3D(r.x,r.y,r.z),t.vector3D(n.x,r.y,r.z)],b=[t.vector3D(n.x,n.y,r.z),t.vector3D(r.x,n.y,r.z),t.vector3D(r.x,n.y,n.z),t.vector3D(n.x,n.y,n.z)],k=[t.vector3D(n.x,r.y,r.z),t.vector3D(r.x,r.y,r.z),t.vector3D(r.x,r.y,n.z),t.vector3D(n.x,r.y,n.z)],d=[t.vector3D(n.x,n.y,n.z),t.vector3D(n.x,n.y,r.z),t.vector3D(n.x,r.y,r.z),t.vector3D(n.x,r.y,n.z)],g=[t.vector3D(r.x,n.y,n.z),t.vector3D(r.x,n.y,r.z),t.vector3D(r.x,r.y,r.z),t.vector3D(r.x,r.y,n.z)],v;return arguments[10]?(y[0]=this.polygon3D(p,u,f,o,h,c,s,"_0_"+a,v),y[1]=this.polygon3D(w,u,f,o,h,c,s,"_1_"+a,v),y[2]=this.polygon3D(b,u,f,o,h,c,s,"_2_"+a,v),y[3]=this.polygon3D(k,u,f,o,h,c,s,"_3_"+a,v),y[4]=this.polygon3D(d,u,f,o,h,c,s,"_4_"+a,v),y[5]=this.polygon3D(g,u,f,o,h,c,s,"_5_"+a,v)):(v=arguments[arguments.length-1],y[0]=this.polygon3D(p,u,f,o,h,c,s,"_0_"+f,v),y[1]=this.polygon3D(w,u,f,o,h,c,s,"_1_"+f,v),y[2]=this.polygon3D(b,u,f,o,h,c,s,"_2_"+f,v),y[3]=this.polygon3D(k,u,f,o,h,c,s,"_3_"+f,v),y[4]=this.polygon3D(d,u,f,o,h,c,s,"_4_"+f,v),y[5]=this.polygon3D(g,u,f,o,h,c,s,"_5_"+f,v)),l?(i.addVisual(y[0]),i.addVisual(y[1]),i.addVisual(y[2]),i.addVisual(y[3]),i.addVisual(y[4]),i.addVisual(y[5])):(i.addVisual(y[5]),i.addVisual(y[4]),i.addVisual(y[0]),i.addVisual(y[1]),i.addVisual(y[2]),i.addVisual(y[3])),y},calcNormal:function(){var n,r;if(arguments.length>=3){var u=arguments[0],e=arguments[1],o=arguments[2],s=t.vector3DMinus(u,e),h=t.vector3DMinus(o,e),f=t.vector3DMultiply(s,h),i=t.getLength(f);i<this.epsilon&&(i=1);this.normal=t.vector3D(f.x/i,f.y/i,f.z/i);this.d=-(this.normal.x*u.x+this.normal.y*u.y+this.normal.z*u.z);arguments[3]&&(arguments[3].normal=this.normal,arguments.d=this.d)}else for(n=arguments[0],this.calcNormal(n[0],n[1],n[2],arguments[1]),r=3;r<n.length&&this.test();r++)this.calcNormal(n[r],n[0],n[r/2])},test:function(){return!t.isValid(this.normal)},transform:function(n,i){var r,f;if(i.Points!=null){for(r=0;r<i.Points.length;r++)i.VectorPoints[r]=i.Points[r]=u.getMatrixVectorMutiple(n,i.Points[r]);this.calcNormal(i.VectorPoints,i)}else f=n*i.normal*-i.d,i.normal=u.getMatrixVectorAnd(n,i.normal),t.normalize(normal),i.d=-(i.normal&f)},getPoint:function(n,i,r,u){var f;if(typeof n==double)return f=-(r.x*n+r.y*i+u)/r.z,t.vector3D(n,i,f);var e=n,o=i,s=t.vector3DMinus(t.vector3DStarMultiply(r,-u),e),h=t.vector3dAND(s,r),c=h/t.vector3dAND(r,o);return t.vector3DPlus(e,t.vector3DStarMultiply(o*c))},getNormal:function(n,i){var f,r;if(i!=null)for(f=t.getNormal(u.getMatrixVectorMutiple(n,i[0]),u.getMatrixVectorMutiple(n,i[1]),u.getMatrixVectorMutiple(n,i[2])),r=3;r<i.length&&!t.isValid(f)&&i[r/2];r++){var e=u.getMatrixVectorMutiple(n,i[r]),o=u.getMatrixVectorMutiple(n,i[0]),s=u.getMatrixVectorMutiple(n,i[r/2]);f=t.getNormal(e,o,s)}else f=u.getMatrixVectorAnd(n,normal),t.normalize();return f},createTextElement:function(n,t,i,r){var u=[],f=n.x,e=n.y,o=t.Width,s=t.Height;return u[0]=this.vector.vector3D(f,e,n.z),u[1]=this.vector.vector3D(f+o,e+s+r,n.z),u[2]=this.vector.vector3D(f+o+i,e+s+r,n.z),this.text3D(t,u)},redraw:function(){},drawPolyLine:function(n,t){var u=ej.Ej3DRender.transform,r=ej.EjSvgRender.utils._getStringBuilder(),f=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[0],u),i,e;for(r.append("M "+f.x+" "+f.y+" "),i=0;i<n.VectorPoints.length;i++)lineSegment=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[i],u),r.append("L "+lineSegment.x+" "+lineSegment.y+" ");direction=r.toString();e={id:n.element.id,"stroke-dasharray":n.element.dashArray,"stroke-width":n.element.width,stroke:n.element.stroke,d:direction};t.svgRenderer.drawPath(e,n.element.child)},drawLine:function(n,t){var i=ej.Ej3DRender.transform;if(i!=null){var r=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[0],i),u=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[2],i),f={id:n.element.id,x1:r.x,y1:r.y,x2:u.x,y2:u.y,"stroke-dasharray":n.element.dashArray,"stroke-width":n.element.width,stroke:n.element.stroke,opacity:n.element.opacity};t.svgRenderer.drawLine(f,n.element.child)}},drawTemplate:function(n,t){var i=n.element,u=ej.Ej3DRender.transform,r;u!=null&&(r=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[0],u),ej.EjSeriesRender.prototype.drawLabelTemplate(i.Label.series,i.Label.series.points[i.Label.pointIndex],i.Label.pointIndex,{X:r.x,Y:r.y},t))},drawText:function(t,i){var r=t.element,o=ej.Ej3DRender.transform,c,p;if(o!=null){var e=ej.EjSvgRender.chartTransform3D.toScreen(t.VectorPoints[0],o),s=e.x,h=e.y;if(r.tag=="text")c={id:r.id,x:s,y:h,fill:r.font.color,"font-size":r.font.size,"font-family":r.font.fontFamily,"font-style":r.font.fontStyle,"font-weight":r.font.fontWeight,opacity:r.font.opacity,"text-anchor":r.TextAnchor,cursor:"default",transform:r.Angle?"rotate("+r.Angle+","+s+","+h+")":null},i.svgRenderer.drawText(c,t.element.Label.Text,t.element.child,t.element.Label);else{var u=r.series,l=u.yAxis&&u.yAxis.labelFormat?u.yAxis.labelFormat:"",w=r.point.text?r.point.text:r.point.y+l.substring(l.indexOf("}")+1),a=ej.EjSvgRender.utils._measureText(w,null,u.marker.dataLabel.font),f=u.marker.dataLabel.margin,b=a.width+f.left+f.right,v=a.height+f.top+f.bottom,y={X:e.x,Y:e.y};p=u.marker.dataLabel.shape?u.marker.dataLabel.shape:u.marker.dataLabel.shape?marker.dataLabel.shape:"None";n.each(i.model.symbolShape,function(n){p.toLowerCase()==n.toLowerCase()&&(symbolName=n)});var k=y.X-f.left/2+f.right/2,d=y.Y-f.top/2-v/f.top+f.bottom/2,g=n.inArray(u,i.model.series);ej.EjSeriesRender.prototype.dataLabelSymbol(g,u,r.pointIndex,k,d,b,v,symbolName,i)}}},draw:function(i,r){var o,s,h;if(i.VectorPoints!=null&&!(i.VectorPoints.length<=0)){var c=ej.Ej3DRender.transform,l=ej.EjSvgRender.utils._getStringBuilder(),u=i.Fill,v=r.svgRenderer.checkColorFormat(u);if(v||(u=r.colorNameToHex(u)),o={Segments:null,StartPoint:null},c!=null)for(o.StartPoint=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[0],c),l.append("M "+o.StartPoint.x+" "+o.StartPoint.y+" "),s=0;s<i.VectorPoints.length;s++)lineSegment=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[s],c),l.append("L "+lineSegment.x+" "+lineSegment.y+" ");direction=l.toString();var f="Light",e=2*(Math.abs(t.vector3dAND(i.normal,t.vector3D(0,0,1)))-1),a=2*(Math.abs(t.vector3dAND(i.normal,t.vector3D(0,1,0)))-1),y=2*(Math.abs(t.vector3dAND(i.normal,t.vector3D(1,0,0)))-1);e==y?(f="ZLight",u=this.applyZLight(u,r)):a==e||e!=0&&a<e?(f="XLight",u=this.applyXLight(u,r)):e<0?(f="ZLight",u=this.applyZLight(u,r)):(f="Light",u=u);r.model.AreaType=="none"&&(i.StrokeThickness=0);h={id:r.svgObject.id+"_"+i.Name,name:f,fill:u,stroke:i.Stroke,"stroke-width":i.StrokeThickness,opacity:i.Opacity,d:direction};r.svgRenderer.drawPath(h,i.Element.Parent);r.model.previousID&&r.model.touchCross&&n("#"+h.id).insertAfter(n("#"+r.model.previousID));r.model.previousID=h.id}},applyXLight:function(n,t){var i=t.svgRenderer.hexToRGB(n);return i.R=parseInt(i.R*.7),i.G=parseInt(i.G*.7),i.B=parseInt(i.B*.7),t.svgRenderer.hexFromRGB(i)},applyZLight:function(n,t){var i=t.svgRenderer.hexToRGB(n);return i.R=parseInt(i.R*.9),i.G=parseInt(i.G*.9),i.B=parseInt(i.B*.9),t.svgRenderer.hexFromRGB(i)},update:function(t,i,r){var u,s;if(i.VectorPoints!=null&&!(i.VectorPoints.length<=0)){i.VectorPoints=t;var f=ej.Ej3DRender.transform,e=ej.EjSvgRender.utils._getStringBuilder(),h=i.Fill,o={Segments:null,StartPoint:null};if(f!=null)for(o.StartPoint=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[0],f),e.append("M "+o.StartPoint.x+" "+o.StartPoint.y+" "),u=0;u<i.VectorPoints.length;u++)lineSegment=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[u],f),e.append("L "+lineSegment.x+" "+lineSegment.y+" ");direction=e.toString();n(r.chartObj.chart3D).find("#"+r.chartObj.svgObject.id+"_"+i.Name).length>0&&(s=n(r.chartObj.chart3D).find("#"+r.chartObj.svgObject.id+"_"+i.Name)[0],r.chartObj.svgRenderer._setAttr(n(s),{d:direction}))}}};var r=new ej.Ej3DRender,t=new r.vector3D,u=new r.matrix3D,e=new r.BSPTreeBuilder,f=new r.polygon3D,i=new r.Graphics3D}(jQuery);ej.Ej3DAxisRenderer=function(){};ej.Ej3DSeriesRender=function(){};ej.Ej3DChart=function(){};ej.series3DTypes={},function(n){ej.Ej3DAxisRenderer.prototype={_drawAxes:function(n,t,i){t.majorGridLines.visible&&this._drawGridLines3D(t,i);t.visible&&t.majorTickLines.visible&&this._renderTicks3D(t,t.majorTickLines.size,t.majorTickLines.width,i);t.visible&&(this._drawAxisLabel(t,i),this._drawMultiLevelLabel(n,t,i),this._drawAxisTitle(t))},_drawAxisTitle:function(t){var i,c,l,e,u,o,s;if(t.title.visible){i=t.title.font;this.gAxisTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"axisTitle_"+t.name});var h=t._opposed,p={Width:n(this.svgObject).width(),Height:n(this.svgObject).height()},w=10,f=ej.EjSvgRender.chartTransform3D.transform3D(p);f.mViewport=p;f.Rotation=0;f.Tilt=0;f.Depth=100;f.PerspectiveAngle=90;ej.EjSvgRender.chartTransform3D.transform(f);var b=ej.EjSvgRender.chartTransform3D.result,k=ej.Ej3DRender.prototype.matrix3D.prototype,d=t.orientation.toLowerCase(),a=!1;for(c=0;c<this.model._axes.length;c++)if(currentAxis=this.model._axes[c],currentAxis.orientation.toLowerCase()==d)for(l=0;l<currentAxis.multiLevelLabels.length;l++)if(currentAxis.multiLevelLabels[l].visible){a=!0;break}if(d=="horizontal"){var g=this.model.elementSpacing+t._LableMaxWidth.height,v=ej.EjSvgRender.utils._measureText(t.title.text,t.width,t.title.font).height/2,r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={Text:t.title.text,location:{x:t.width/2,y:g+v+t.majorTickLines.size+t.axisLine.width+this.model.wallSize+t._multiLevelLabelHeight},axes:t};this._trigger("axesTitleRendering",r);i=t.title.font;e=r.data.location.x+t.x;u=h?t.y-r.data.location.y:r.data.location.y+t.y;element={Width:v.width,Height:v.height,Label:r.data,TextAnchor:"middle",tag:"text",font:i,id:this.svgObject.id+"axisTitle",child:this.chart3D};a?(o={id:this.svgObject.id+"axisTitle",x:e,y:u,fill:i.color,"font-size":i.size,"font-family":i.fontFamily,"font-style":i.fontStyle,"font-weight":i.fontWeight,opacity:i.opacity,"text-anchor":"middle"},s=ej.EjSvgRender.chartTransform3D.toScreen({x:e,y:u,z:0},f,b,k),o.x=s.x,o.y=s.y,this.svgRenderer.drawText(o,r.data.Text,this.gAxisTitleEle),this.svgRenderer.append(this.gAxisTitleEle,this.svgObject)):this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(e,u,0),element,10,10))}else{var y=ej.EjSvgRender.utils._measureText(t.title.text,t.height,t.title.font),e=h?t.x+(4*this.model.elementSpacing+t._LableMaxWidth.width+t.majorTickLines.size+t.axisLine.width+this.model.wallSize+t._multiLevelLabelHeight):t.x-(3*this.model.elementSpacing+t._LableMaxWidth.width+t.majorTickLines.size+t.axisLine.width+this.model.wallSize+t._multiLevelLabelHeight),r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={Text:t.title.text,location:{x:y.width/2,y:0},axes:t};this._trigger("axesTitleRendering",r);i=t.title.font;var u=r.data.location.y+(t.y+t.height)+t.height/-2,tt=h?90:-90,nt=h?25:-25;element={Width:y.width,Height:y.height,Angle:-90,Label:r.data,TextAnchor:"middle",tag:"text",font:i,id:this.svgObject.id+"_YAxisTitle",child:this.chart3D};a?(o={id:id,x:e,y:u,fill:i.color,"font-size":i.size,"font-family":i.fontFamily,"font-style":i.fontStyle,"font-weight":i.fontWeight,opacity:i.opacity,"text-anchor":"middle",transform:"rotate(-90,"+e+","+(h?u+w:u-w)+")"},s=ej.EjSvgRender.chartTransform3D.toScreen({x:e,y:u,z:0},f,b,k),o.x=s.x+nt,o.y=s.y,this.svgRenderer.drawText(o,r.data.Text,this.gAxisTitleEle),this.svgRenderer.append(this.gAxisTitleEle,this.svgObject)):this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(e,u,0),element,10,10))}}},_drawMultiLevelLabel:function(t,i,r){var ft,et,d,w,rt,oi,ot,si;this.gMultiLevelEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_axisMultiLevelLabels_"+t});var d,v,g,e,c,ni,nt,o,s,y,ti=0,hi,ii,ci=i.multiLevelLabels.length,st=this.model,ht=st.elementSpacing,f=10,u=0,h=0,ri,tt,yt,pt,wt,bt,b=st.m_AreaBounds,p,it=i.visibleRange,kt,ct=st.wallSize,k=i._opposed,ui=r.axes[i.name]._validCross,dt,lt=i.orientation.toLowerCase(),fi=ui?i.y:b.Y+(!k&&b.Height),gt,li=ui?i.x:b.X+(k&&b.Width),l,rt,at=[],vt,ut,ei={Width:n(this.svgObject).width(),Height:n(this.svgObject).height()},a=ej.EjSvgRender.chartTransform3D.transform3D(ei);for(a.mViewport=ei,a.Rotation=0,a.Tilt=0,a.Depth=100,a.PerspectiveAngle=st.perspectiveAngle,ej.EjSvgRender.chartTransform3D.transform(a),ft=ej.EjSvgRender.chartTransform3D.result,et=ej.Ej3DRender.prototype.matrix3D.prototype,d=0;d<ci;d++)if(e=i.multiLevelLabels[d],id=this.svgObject.id+"_"+i.name+"MultiLevelLabels_"+t+"_"+d,e.text!=""&&e.visible){if(level=e._level,tt="middle",c=e.font,ut=e.border.width,maximumTextWidth=e.maximumTextWidth,gt=e.textAlignment.toLowerCase(),actualText=text=e.text,y=e.textOverflow.toLowerCase(),p=ej.EjSvgRender.utils._measureText(e.text,b.Width,e.font),ni=(e.end-e.start)/2,nt=(e.start+ni-it.min)/it.delta,o=(e.start-it.min)/it.delta,s=(e.end-it.min)/it.delta,i.isInversed&&(nt=isNaN(nt)?0:1-nt,o=isNaN(o)?0:1-o,s=isNaN(s)?0:1-s),lt=="horizontal"?(u=Math.round(i.width*nt)+b.X+i.plotOffset,h=k?fi-ct-i.majorTickLines.size-ht-f/2-i._LableMaxWidth.height:fi+ct+i.majorTickLines.size+ht+i._LableMaxWidth.height,o=Math.round(i.width*o)+b.X+i.plotOffset,s=Math.round(i.width*s)+b.X+i.plotOffset,g=maximumTextWidth?maximumTextWidth:s-o-f):(h=Math.round(i.plotOffset+i.y+i.height*(1-nt)),u=k?i.x+ct+i.majorTickLines.size+i.axisLine.width+ht/2+i._LableMaxWidth.width+i.multiLevelLabelHeight[level]/2:li-ct-i.majorTickLines.size-ht/2-i._LableMaxWidth.width-i.multiLevelLabelHeight[level]/2,o=Math.round(i.plotOffset+i.y+i.height*(1-o)),s=Math.round(i.plotOffset+i.y+i.height*(1-s)),g=maximumTextWidth?maximumTextWidth:i.multiLevelLabelHeight[level]+f),h=k?h-i.prevHeight[level]:h+i.prevHeight[level],gt=="far"?(u=u+g/2-ut/2,tt="end"):gt=="near"&&(tt="start",u=u-g/2+ut/2),w=ej.EjAxisRenderer.prototype._triggerMultiLevelLabelsRendering(actualText,u,h,y,c,e.border,this),text=actualText=w.text,u=w.location.x,h=w.location.y,y=w.textOverflow.toLowerCase(),c=w.font,c.color=c.color?c.color:i.multiLevelLabelsFontColor,hi=w.border,ii=w.border.type.toLowerCase(),ut=w.border.width,l={id:id,x:u,y:h,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,"text-anchor":tt},y!="none"&&(text=ej.EjAxisRenderer.prototype.textOverflowMultiLevelLabels(i,g,text,y,c,p,{x:u,y:h},null,this)),y=="wrap"||y=="wrapandtrim")for(newY=h,v=0;v<text.length;v++)p=ej.EjSvgRender.utils._measureText(text[v],null,c),v!=0&&(newY=k?newY-p.height:newY+p.height),ri={Width:p.width,Height:p.height,Label:{Text:text[v]},TextAnchor:tt,tag:"text",font:c,id:id+"_"+v,child:this.chart3D},l.id=l.id+"_"+v,rt=ej.EjSvgRender.chartTransform3D.toScreen({x:u,y:newY+f/2,z:0},a,ft,et),l.x=rt.x,l.y=rt.y,this.svgRenderer.drawText(l,text[v],this.gMultiLevelEle);if(u=lt=="horizontal"?u:k?u+f:u-f,y!="wrap"&&y!="wrapandtrim"&&(ri={Width:p.width,Height:p.height,Label:{Text:text},TextAnchor:tt,tag:"text",font:c,id:id,child:this.chart3D},rt=ej.EjSvgRender.chartTransform3D.toScreen({x:u,y:h+f/2,z:0},a,ft,et),l.x=rt.x,l.y=rt.y,this.svgRenderer.drawText(l,text,this.gMultiLevelEle)),oi=lt=="horizontal"?{bounds:{x:o,y:h-f,height:i.multiLevelLabelHeight[level],width:g},axisIndex:t,multiLevelLabel:e}:{bounds:{x:u-width/2-f/2,y:s,height:o-s,width:width},axisIndex:t,multiLevelLabel:e},this.model.multiLevelLabelRegions.push(oi),ii!="none"&&ut>0){for(id=this.svgObject.id+"_"+i.name+"MultiLevelLabelsBorder_"+t+"_"+d,ot=h-f+i.multiLevelLabelHeight[level]+f/2,si=e.border.color?e.border.color:i.multiLevelLabelsColor,lt=="horizontal"?(yt={x1:o,y1:h-f,x2:s,y2:h-f},pt={x1:o,y1:ot,x2:s,y2:ot},wt={x1:o,y1:h-f,x2:o,y2:ot},bt={x1:s,y1:h-f,x2:s,y2:ot}):(width=i.multiLevelLabelHeight[level],yt={x1:u-width/2-f/2,y1:s,x2:u+width/2+f/2,y2:s},pt={x1:u-width/2-f/2,y1:o,x2:u+width/2+f/2,y2:o},wt={x1:u-width/2-f/2,y1:s,x2:u-width/2-f/2,y2:o},bt={x1:u+width/2+f/2,y1:s,x2:u+width/2+f/2,y2:o}),vt=0;vt<4;vt++){switch(vt){case 0:newId=id+"_top";value=yt;break;case 1:newId=id+"_bottom";value=pt;break;case 2:newId=id+"_left";value=wt;break;case 3:newId=id+"_right";value=bt}at[0]=ej.Ej3DRender.prototype.vector3D.prototype.vector3D(value.x1,value.y1,ti);at[1]=ej.Ej3DRender.prototype.vector3D.prototype.vector3D(value.x2,value.y2,ti);kt=ej.EjSvgRender.chartTransform3D.toScreen(at[0],a,ft,et);dt=ej.EjSvgRender.chartTransform3D.toScreen(at[1],a,ft,et);l={id:newId,x1:kt.x,y1:kt.y,x2:dt.x,y2:dt.y,stroke:si,"stroke-width":ut};this.svgRenderer.drawLine(l,this.gMultiLevelEle)}this.svgRenderer.append(this.gMultiLevelEle,this.svgObject)}}},_drawAxisLabel:function(n,t){for(var a=n.visibleLabels.length,f=this.model.m_AreaBounds,u=n._opposed,c=t.axes[n.name]._validCross,l=c?n.y:f.Y+(!u&&f.Height),v=c?n.x:f.X+(u&&f.Width),r=0;r<a;r++)if(!ej.util.isNullOrUndefined(n.visibleLabels[r].Text)){var e=0,o=0,y=0,p=0,s,h=ej.EjSvgRender.utils._measureText(n.visibleLabels[r].Text,this.model.m_AreaBounds.Width,n.font),i=(n.visibleLabels[r].Value-n.visibleRange.min)/n.visibleRange.delta;i=n.isInversed?1-i:i;i=isNaN(i)?0:i;n.orientation.toLowerCase()=="horizontal"?(y=e=Math.round(n.width*i)+this.model.m_AreaBounds.X+n.plotOffset,o=u?l-this.model.wallSize-n.majorTickLines.size-this.model.elementSpacing/2:l+this.model.wallSize+n.majorTickLines.size+this.model.elementSpacing,s="middle"):(o=p=Math.round(n.plotOffset+n.y+h.height/4+n.height*(1-i)),e=u?n.x+n.majorTickLines.size+n.axisLine.width+this.model.elementSpacing/2:v-this.model.wallSize-n.majorTickLines.size-this.model.elementSpacing/2,s=u?"start":"end");element={Width:h.width,Height:h.height,Label:n.visibleLabels[r],TextAnchor:s,tag:"text",font:n.font,id:this.svgObject.id+n.orientation+r,child:this.chart3D};this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(e,o,0),element,10,10))}},_renderTicks3D:function(n,t,i,r){for(var s,f,o,y=n.visibleLabels.length,h=this.model.m_AreaBounds,p=n.y,e=0;e<y;e++){var c=0,l=0,a=0,v=0,u=(n.visibleLabels[e].Value-n.visibleRange.min)/n.visibleRange.delta;if(u=n.isInversed?1-u:u,u=isNaN(u)?0:u,n.orientation.toLowerCase()=="horizontal"?l=c=Math.round(n.width*u)+h.X+n.plotOffset:a=v=Math.round(n.plotOffset+n.height*(1-u)+n.y),f=this._calculatePosition3D(n,n.tickLinesPosition,t,i,c,a,l,v,r),o={width:n.majorTickLines.width,stroke:n.majorTickLines.color,child:this.chart3D,tag:"line"},o.id=this.svgObject.id+n.name+"_majorTickLines_"+e,this.graphics.addVisual(this.polygon.createLine(o,f.X1,f.Y1,f.X2,f.Y2,0)),n.minorGridLines.visible&&n.minorTicksPerInterval>0&&e<y-1)for(minorTicks=n.visibleRange.interval/(n.minorTicksPerInterval+1),s=0;s<n.minorTicksPerInterval;s++)u=ej.EjSvgRender.utils._valueToCoefficient(n,n.visibleLabels[e].Value+minorTicks*(s+1)),u=isNaN(u)?0:u,n.orientation.toLowerCase()=="horizontal"?c=l=Math.round(n.plotOffset+h.Width*u+h.X):a=v=Math.round(n.plotOffset+h.Height*(1-u))+n.y,f=this._calculatePosition3D(n,n.tickLinesPosition,t,i,c,a,l,v,r),o={width:n.minorTickLines.width,stroke:n.minorTickLines.color,child:this.chart3D,tag:"line"},o.id=this.svgObject.id+n.name+"_minorTickLines_"+e+s,this.graphics.addVisual(this.polygon.createLine(o,f.X1,f.Y1,f.X2,f.Y2,0))}},_calculatePosition3D:function(n,t,i,r,u,f,e,o,s){var w=n.orientation,h=n._opposed,t="outside",c=this.model.m_AreaBounds,v=s.axes[n.name]._validCross,y=v?n.y:c.Y+(!h&&c.Height),p=v?n.x:c.X+(h&&c.Width),a,l;if(n.orientation.toLowerCase()=="horizontal"){switch(t){case"inside":f=h?r:0;o=h?f+i:i;break;case"outside":f=0;o=h?i:f+i}l=h?y-this.model.wallSize-i:y+this.model.wallSize-i/2;a=n.x;f+=l;o+=l;u=e=u}else{switch(t){case"inside":u=0;e=h?i:u+i;break;case"outside":u=0;e=h?u+i:i}a=h?p+this.model.wallSize:p-this.model.wallSize-i;l=this.model.m_AreaBounds.Y;u+=a;e+=a;f=o=f}return{X1:u,Y1:f,X2:e,Y2:o}},_drawGridLines3D:function(t,i){var v,u,a,b,c,r,f,y,h;if(t!=null){var p=t.visibleLabels.length,w,k=t._opposed,nt=t.orientation,d=i.axes[t.name]._validCross,l,e,o,s;if(nt.toLowerCase()=="horizontal")for(u=0;u<p;u++){r=ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[u].Value);r=isNaN(r)?0:r;e=l=Math.round(t.width*r)+this.model.m_AreaBounds.X+t.plotOffset;o=this.model.m_AreaBounds.Y;s=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height;var a=this.model.depth>2?this.model.depth-2:1,g=d?t.y:this.model.m_AreaBounds.Y+(!k&&this.model.m_AreaBounds.Height),f={opacity:t.majorGridLines.opacity,width:t.majorGridLines.width,stroke:t.majorGridLines.color,child:this.chart3D,tag:"line"};if(f.id=this.svgObject.id+t.name+"_gridlines_"+u,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),v=n.extend({},f),v.id=this.svgObject.id+t.name+"_parallelGridlines_"+u,h=this.polygon.createLine(v,e,0,e,-a,g),this.polygon.transform(this.matrixobj.tilt(parseFloat(Math.PI/2)),h),this.graphics.addVisual(h),t.minorGridLines.visible&&t.minorTicksPerInterval>0&&u<p-1)for(w=t.visibleRange.interval/(t.minorTicksPerInterval+1),c=0;c<t.minorTicksPerInterval;c++)r=ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[u].Value+w*(c+1)),r=isNaN(r)?0:r,e=l=Math.round(this.model.m_AreaBounds.Width*r)+this.model.m_AreaBounds.X,o=this.model.m_AreaBounds.Y,s=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height,f={opacity:t.minorGridLines.opacity,width:t.minorGridLines.width,stroke:t.minorGridLines.color,child:this.chart3D,tag:"line"},f.id=this.svgObject.id+t.name+"_minorgridlines_"+u+c,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),v=n.extend({},f),v.id=this.svgObject.id+t.name+"_parallelMinorGridlines_"+u+c,h=this.polygon.createLine(v,e,0,e,-a,g),this.polygon.transform(this.matrixobj.tilt(parseFloat(Math.PI/2)),h),this.graphics.addVisual(h);index++}else for(u=0;u<p;u++){if(r=(t.visibleLabels[u].Value-t.visibleRange.min)/t.visibleRange.delta,r=t.isInversed?1-r:r,r=isNaN(r)?0:r,l=this.model.m_AreaBounds.X,o=Math.round(t.height*(1-r))+.5,o+=t.y,e=l+this.model.m_AreaBounds.Width,s=o,a=this.model.depth>2?this.model.depth-2:1,f={opacity:t.majorGridLines.opacity,width:t.majorGridLines.width,stroke:t.majorGridLines.color,axisName:t.name,child:this.chart3D,tag:"line"},f.id=this.svgObject.id+t.name+"_gridlines_"+u,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),b=d?t.x:this.model.m_AreaBounds.X+(k&&this.model.m_AreaBounds.Width+1),y=n.extend({},f),y.id=this.svgObject.id+t.name+"_parallelGridlines_"+u,h=this.polygon.createLine(y,-a,s,0,s,b),this.polygon.transform(this.matrixobj.turn(parseFloat(-Math.PI/2)),h),this.graphics.addVisual(h),t.minorGridLines.visible&&t.minorTicksPerInterval>0&&u<p-1)for(w=t.visibleRange.interval/(t.minorTicksPerInterval+1),c=0;c<t.minorTicksPerInterval;c++)r=ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[u].Value+w*(c+1)),r=isNaN(r)?0:r,l=this.model.m_AreaBounds.X,o=Math.round(t.height*(1-r))+.5,o+=t.y,e=l+this.model.m_AreaBounds.Width,s=o,f={opacity:t.minorGridLines.opacity,width:t.minorGridLines.width,stroke:t.minorGridLines.color,axisName:t.name,child:this.chart3D,tag:"line"},f.id=this.svgObject.id+t.name+"_minorgridlines_"+u+c,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),y=n.extend({},f),y.id=this.svgObject.id+t.name+"_parallelMinorGridlines_"+u+c,h=this.polygon.createLine(y,-a,s,0,s,b),this.polygon.transform(this.matrixobj.turn(parseFloat(-Math.PI/2)),h),this.graphics.addVisual(h);index++}}}};ej.Ej3DSeriesRender.prototype={_getSegmentDepth:function(n){var u=this.chartObj.model.depth,i,r,t;if(this.chartObj.model._sideBySideSeriesPlacement)t=u/4,i=t,r=t*3;else{var e=n.position-1,f=n.all,t=u/(f*2+f+1);i=t+t*e*3;r=i+t*2}return{Start:i,End:r,Delta:r-i}},createSegment:function(n,t,i,r,u,f,e,o,s){return{StartValue:t,EndValue:i,depth:r,radius:u,index:f,YData:e,Center:n,inSideRadius:o,ActualEndValue:i,ActualStartValue:t,pointIndex:s}},calculateSize:function(t,i){var r=t.chartObj.model.legend,o=0,s=0,u=t.chartObj.model.title,h=t.chartObj.model.title.subTitle,e=t.chartObj.model._titleLocation,l=t.chartObj.model._subTitleLocation,a=t.chartObj.model.title.textOverflow,v=t.chartObj.model.title.subTitle.textOverflow,p=u.text&&u.visible&&u.enableTrim&&(a=="wrap"||a=="wrapandtrim")?!0:!1,y,f,c;return subTitleEnable=h.text&&h.visible&&h.enableTrim&&(v=="wrap"||v=="wrapandtrim")?!0:!1,r.visible&&r.position.toLowerCase()!="custom"&&(r.position.toLowerCase()=="right"||r.position.toLowerCase()=="left"?o=(r.position.toLowerCase()=="right"?t.chartObj.model.margin.right:t.chartObj.model.margin.left)+t.chartObj.model.LegendViewerBounds.Width:s=(r.position.toLowerCase()=="top"?t.chartObj.model.margin.top:t.chartObj.model.margin.bottom)+t.chartObj.model.LegendViewerBounds.Height),i.actualWidth=n(t.chartObj.svgObject).width()-o,y=i.actualWidth*.5+(r.position.toLowerCase()==="left"?o:0),p||subTitleEnable?(f=e.size.height+(subTitleEnable?l.size.height:0)+s,i.actualHeight=n(t.chartObj.svgObject).height()-f,c=i.actualHeight*.5+(r.position.toLowerCase()==="top"?f:e.size.height+(subTitleEnable?l.size.height:0))):(f=(u.text&&u.visible?e.Y:0)+s,i.actualHeight=n(t.chartObj.svgObject).height()-f,c=i.actualHeight*.5+(r.position.toLowerCase()==="top"?f:u.text&&u.visible?e.Y:0)),{centerX:y,centerY:c}},createPoints:function(t,i){var r;t.segments=[];var y=this.calculateSize(i,t),e=0,nt=this._calculateVisiblePoints(t).visiblePoints,p=t._visiblePoints.length;for(j=0;j<p;j++)e+=nt[j].YValues[0];var w=360/e,b=n.inArray(t,i.chartObj.model._visibleSeries),rt=this.chartObj.model._visibleSeries.length,tt=i.chartObj.model.innerRadius[b],k=i.chartObj._getYValues(t._visiblePoints),it=i.chartObj.model.depth,c,l=0,a=0,s=0,d,u,f,o,v,g=0,h=i.chartObj.model.circularRadius[b];for(r=0;r<p;r++)(t._visiblePoints[r].visible||t._visiblePoints[r].gapMode)&&(d=n.inArray(t._visiblePoints[r],t._visiblePoints),u=Math.abs(k[r]),a=Math.abs(u)*(Math.PI*2/e),f={},f.x=0,f.y=0,u!=0&&((t.explodeIndex==t._visiblePoints[r].actualIndex||t.explodeAll)&&(o={X:0,Y:0},o.X=Math.cos(2*Math.PI*(s+u/2)/e),o.Y=Math.sin(2*Math.PI*(s+u/2)/e),f.x=.01*h*o.X*t.explodeOffset,f.y=.01*h*o.Y*t.explodeOffset),c=i.chartObj.vector.vector3D(f.x+y.centerX,f.y+y.centerY,0),v=this.createSegment(c,parseFloat(w*s),parseFloat(w*u),it,h,r,u,tt,d,t),v.visible=t._visiblePoints[r].gapMode?!1:!0,t.segments.push(v)),t.marker.dataLabel.visible&&this._addPieDataLabel(g,k[r],l,l+a,r,h,this._isChartRotated(i)?i.chartObj.model.depth+5:0,c,t._visiblePoints[r]),g++,l+=a,s+=u);return t.segments},_addPieDataLabel:function(n,t,i,r,u,f,e,o,s){var h=(i+r)/2;s.symbolLocation={x:0,y:0,radius:0,angle:0,StartDepth:0};s.symbolLocation.x=n;s.symbolLocation.y=t;s.symbolLocation.radius=f;s.symbolLocation.angle=h;s.symbolLocation.center=o;s.startDepth=e},_isChartRotated:function(n){var t=Math.abs(n.chartObj.model.tilt%360),i=Math.abs(n.chartObj.model.rotattion%360);return(t>90&&t<270)^(i>90&&i<270)?!0:!1},createSector:function(n,t,i,r){var o=parseInt(Math.ceil(n.ActualEndValue/6)),v=Math.PI/180,s=0,it=[],h=t.chartObj.model.depth,b,k,nt,tt,d,g,l,a,u,p,w;if(o<1)return null;var c=[],y=n.ActualEndValue/o,f=[],e=[];for(u=0;u<o+1;u++)b=parseFloat(n.Center.x+n.radius*Math.cos((n.ActualStartValue+u*y)*v)),k=parseFloat(n.Center.y+n.radius*Math.sin((n.ActualStartValue+u*y)*v)),f[u]={X:b,Y:k},nt=parseFloat(n.Center.x+n.inSideRadius*Math.cos((n.ActualStartValue+u*y)*v)),tt=parseFloat(n.Center.y+n.inSideRadius*Math.sin((n.ActualStartValue+u*y)*v)),e[u]={X:nt,Y:tt},it.push({X:b,Y:k});for(d=[],u=0;u<o;u++)vts=[t.chartObj.vector.vector3D(f[u].X,f[u].Y,0),t.chartObj.vector.vector3D(f[u].X,f[u].Y,h),t.chartObj.vector.vector3D(f[u+1].X,f[u+1].Y,h),t.chartObj.vector.vector3D(f[u+1].X,f[u+1].Y,0)],d[u]=t.chartObj.polygon.polygon3D(vts,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D),s++;if(c[1]=d,n.inSideRadius>0){for(g=[],u=0;u<o;u++)vts=[t.chartObj.vector.vector3D(e[u].X,e[u].Y,0),t.chartObj.vector.vector3D(e[u].X,e[u].Y,h),t.chartObj.vector.vector3D(e[u+1].X,e[u+1].Y,h),t.chartObj.vector.vector3D(e[u+1].X,e[u+1].Y,0)],g[u]=t.chartObj.polygon.polygon3D(vts,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D),s++;c[3]=g}for(l=[],a=[],u=0;u<o+1;u++)l.push(t.chartObj.vector.vector3D(f[u].X,f[u].Y,0)),a.push(t.chartObj.vector.vector3D(f[u].X,f[u].Y,h));if(n.inSideRadius>0)for(u=o;u>-1;u--)l.push(t.chartObj.vector.vector3D(e[u].X,e[u].Y,0)),a.push(t.chartObj.vector.vector3D(e[u].X,e[u].Y,h));else l.push(n.Center),a.push(t.chartObj.vector.vector3D(n.Center.x,n.Center.y,h));return c[0]=[],c[0].push(t.chartObj.polygon.polygon3D(l,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,c[0].push(t.chartObj.polygon.polygon3D(a,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,n.inSideRadius>0?(p=[t.chartObj.vector.vector3D(f[0].X,f[0].Y,0),t.chartObj.vector.vector3D(f[0].X,f[0].Y,h),t.chartObj.vector.vector3D(e[0].X,e[0].Y,h),t.chartObj.vector.vector3D(e[0].X,e[0].Y,0)],w=[t.chartObj.vector.vector3D(f[o].X,f[o].Y,0),t.chartObj.vector.vector3D(f[o].X,f[o].Y,h),t.chartObj.vector.vector3D(e[o].X,e[o].Y,h),t.chartObj.vector.vector3D(e[o].X,e[o].Y,0)],c[2]=[],c[2].push(t.chartObj.polygon.polygon3D(p,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,c[2].push(t.chartObj.polygon.polygon3D(w,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++):(p=[t.chartObj.vector.vector3D(f[0].X,f[0].Y,0),t.chartObj.vector.vector3D(f[0].X,f[0].Y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,0)],w=[t.chartObj.vector.vector3D(f[o].X,f[o].Y,0),t.chartObj.vector.vector3D(f[o].X,f[o].Y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,0)],c[2]=[],c[2].push(t.chartObj.polygon.polygon3D(p,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,c[2].push(t.chartObj.polygon.polygon3D(w,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++),c},createPolygons:function(t,i,r){var s,f=[],a,v,h,y,e,p=n.inArray(t,i.chartObj.model._visibleSeries),o,c,u,l;for(s=t.segments&&r?t.segments:this.createPoints(t,i),y=s.length,o=0;o<y;o++)if(a=s[o],a.visible&&(h=s[o].pointIndex,v=i.chartObj.setStyle(i,t,p,h),typeof i.chartObj.model.pointColors[h]=="object"&&(v.interior=i.chartObj.model.pointColors[h][0].color),e=this.createSector(a,i,v,p),e!=null))for(u=0;u<e.length;u++)if(f[u]||(f[u]=[]),e[u]!=null)for(c=0;c<e[u].length;c++)f[u].push(e[u][c]);if(r)return f;for(u=0;u<f.length;u++)for(l=0;l<f[u].length;l++)i.chartObj.graphics.addVisual(f[u][l])},draw3DDataLabel:function(t,i,r){var e=t.marker.dataLabel.connectorLine.height,w,o,g,c,v,nt;if(this.chartObj.model.AreaType=="none"){u={x:0,y:0};var l=r.text?r.text:r.y,y=n.inArray(t,this.chartObj.model.series),f=n.extend({},ej.EjSvgRender.commonChartEventArgs);if(f.data={text:l,location:{x:h,y:s},series:t,pointIndex:i,seriesIndex:y},this.chartObj._trigger("displayTextRendering",f),f.data.Text=f.data.text,o=ej.EjSvgRender.utils._measureText(l,null,t.marker.dataLabel.font),t.type.toLowerCase()=="doughnut"||t.type.toLowerCase()=="pie"){var tt=Math.min(t.actualWidth,t.actualHeight)/2,b=r.symbolLocation.center,k=r.symbolLocation.radius*t._coefficient;ej.util.isNullOrUndefined(e)&&(e=ej.EjSvgRender.utils._measureText(f.data.text,null,t.marker.dataLabel.font).height);t!=null&&t.labelPosition!="inside"?radius=r.symbolLocation.radius+e:t!=null&&(radius=k+(r.symbolLocation.radius-k)/2);h=u.X=b.x+radius*Math.cos(r.symbolLocation.angle);s=u.Y=b.y+radius*Math.sin(r.symbolLocation.angle)}}else{var d=t.yAxis.labelFormat?t.yAxis.labelFormat:"",y=n.inArray(t,this.chartObj.model.series),l=r.text?r.text:r.y+d.substring(d.indexOf("}")+1),p=0,f=n.extend({},ej.EjSvgRender.commonChartEventArgs);f.data={text:l,location:{x:h,y:s},series:t,pointIndex:i};this.chartObj._trigger("displayTextRendering",f);f.data.Text=f.data.text;var o=ej.EjSvgRender.utils._measureText(l,null,t.marker.dataLabel.font),u=ej.EjSvgRender.utils.Transform3DToVisible(t,r.symbolLocation.x,r.symbolLocation.y,this.chartObj),e=t.marker.dataLabel.connectorLine.height?t.marker.dataLabel.connectorLine.height:0,a=6.28*(1-90/360),s=u.Y,h=u.X;this.chartObj.model.requireInvertedAxes?(h=r.x>0?u.X-Math.sin(a)*e:u.X+Math.sin(a)*e,p=-o.height/3):s=r.y>0?u.Y+Math.sin(a)*e:u.Y+Math.sin(-a)*e}g=this._getSegmentDepth(t);t.marker.dataLabel.shape.toLowerCase()=="none"||r.marker.dataLabel.template||f.data.Text==""||(c={tag:"dataLabel",series:t,point:r,pointIndex:i,id:this.chartObj.svgObject.id+y+"_DataLabel"+i,child:this.chartObj.chart3D},this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(h,s,r.symbolLocation.z?r.symbolLocation.z:0),c,0,-o.height)));w=r.marker.dataLabel.template?"template":"text";c={Width:o.width,Height:o.height,Label:f.data,TextAnchor:"middle",tag:w,font:t.marker.dataLabel.font,Angle:t.marker.dataLabel.angle,id:this.chartObj.svgObject.id+"_SeriesText"+i+y,child:this.chartObj.chart3D};this.chartObj.model.AreaType!="none"?(t.marker.dataLabel.connectorLine.height&&t.marker.dataLabel.connectorLine.height>0&&(v=[],v.push({x:u.X,y:u.Y+p,z:r.symbolLocation.z}),v.push({x:h,y:s+p,z:r.symbolLocation.z}),this.drawLineSegment(v,i,t)),this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(h,s,r.symbolLocation.z),c,0,-o.height))):(t.labelPosition.toLowerCase()!="inside"&&this.updateConnectorLine(r,i,t,u,e),nt={x:t.actualWidth,y:t.actualHeight},this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(u.X,u.Y,-1),c,0,-o.height)))},updateConnectorLine:function(n,t,i,r,u){var e=[],f=n.symbolLocation,o=f.center.x+Math.cos(f.angle)*f.radius,s=f.center.y+Math.sin(f.angle)*f.radius,h;e.push({x:o,y:s});h=f.radius+u;o=f.center.x+Math.cos(f.angle)*h;s=f.center.y+Math.sin(f.angle)*h;e.push({x:o,y:s});i.marker.dataLabel.connectorLine.type=="bezier"&&(e=this.getBezierApproximation(e,256,i));this.drawLineSegment(e,t,i)},getBezierApproximation:function(n,t,i){for(var f,u=[],r=0;r<=t;r++)f=r/t,u.push(this.GetBezierPoint(f,n,0,n.length,i));return u},drawLineSegment:function(t,i,r){for(var f=[],u=0;u<t.length;u++)f.push(this.chartObj.vector.vector3D(t[u].x,t[u].y,t[u].z?t[u].z:0));var e=n.inArray(r,this.chartObj.model._visibleSeries),o=this.chartObj.model.AreaType=="none"?this.chartObj.model.pointColors[i]:this.chartObj.model.seriesColors[e],s=r.marker.dataLabel.connectorLine.stroke?r.marker.dataLabel.connectorLine.stroke:o,h={width:r.marker.dataLabel.connectorLine.width,stroke:s,child:this.chartObj.chart3D,tag:"polyline",id:this.chartObj.svgObject.id+"_"+e+"_"+i};this.chartObj.graphics.addVisual(this.chartObj.polygon.createPolyline(f,h))}};ej.ejCircularSeries={draw:function(t,r,u){if(seriesLength=r.chartObj.model._visibleSeries.length,seriesIndex=n.inArray(t,r.chartObj.model._visibleSeries),r._calculateVisiblePoints(t),r.calculateSize(r,t),u=="pie"?(t._size=t.pieCoefficient,t._coefficient=seriesIndex==0?0:t._size):(t._size=t.doughnutSize,t._coefficient=t.doughnutCoefficient),r.chartObj.model.circularRadius.length>1){for(i=seriesIndex;i<r.chartObj.model.circularRadius.length;i++)if(!ej.util.isNullOrUndefined(r.chartObj.model.circularRadius[i])){r.chartObj.model.circularRadius[seriesIndex]=r.chartObj.model.circularRadius[i]*t._size;break}}else r.chartObj.model.circularRadius[seriesIndex]=(1-.03)*Math.min(t.actualWidth/2,t.actualHeight/2)*t._size;r.chartObj.model.innerRadius[seriesIndex]=t._coefficient*r.chartObj.model.circularRadius[seriesIndex];r.createPolygons(t,r)},doAnimation:function(t,i){var r=this;t.count=0;n.each(t.segments,function(r,u){var f=u.radius,e=u.inSideRadius;t.animate=!0;n(i.chartObj.element).each(function(){u.radius=0;u.inSideRadius=0}).animate({Radius:f,InsideRadius:e},{duration:1e3,queue:!1,step:function(n,r){var e,f,o;for(r.prop.toString()==="Radius"?u.radius=n:u.inSideRadius=n,e=i.createPolygons(t,i,!0),f=0;f<e.length;f++)for(o=0;o<e[f].length;o++)i.chartObj.polygon.update(e[f][o].VectorPoints,e[f][o],i)},complete:function(){i.chartObj.model.AnimationComplete=!0;var r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={series:t};i.chartObj._trigger("animationComplete",r)}})})}};ej.series3DTypes.doughnut=ej.ejCircularSeries;ej.series3DTypes.pie=ej.ejCircularSeries;ej.ej3DStackingColumn={draw:function(n,t,i,r){var f=t._isVisiblePoints(n),u;for(this.createSegments(n,t,r),u=0;u<f.length;u++)f[u].visible&&(n._visiblePoints[u].plans=null,ej.ej3DColumnSeries.update(n,n._visiblePoints[u],u,t))},createSegments:function(n,t,i){var c=t.chartObj._getXValues(n._visiblePoints),e,o,f,u,r;if(c!=null)for(o=t.getSideBySideInfo(n,i),f=t._getSegmentDepth(n),e=o.Delta/2,u=t._isVisiblePoints(n),r=0;r<u.length;r++){var s=c[r]+o.Start,a=c[r]+o.End,l=n.stackedValue.StartValues[r],h=n.stackedValue.EndValues[r];if(ej.ej3DColumnSeries._setData(s,h,a,l,f.Start,f.End,t,u[r]),n.marker.dataLabel.visible){u[r].symbolLocation={x:0,y:0,z:0};switch(n.marker.dataLabel.textPosition){case"top":u[r].symbolLocation.x=s+e;u[r].symbolLocation.y=h;u[r].symbolLocation.z=f.Start+f.Delta/2;break;case"bottom":u[r].symbolLocation.x=s+e;u[r].symbolLocation.y=l-.2;u[r].symbolLocation.z=f.Start+(f.End-f.Start)/2;break;default:u[r].symbolLocation.x=s+e;u[r].symbolLocation.y=h+(l-h)/2;u[r].symbolLocation.z=f.Start}}}},doAnimation:function(t,i){var r=this;n.each(t._visiblePoints,function(r,u){var f=u.Top,e=u.Bottom;n(u).each(function(){u.Top=0;u.Bottom=0}).animate({Top:f,Bottom:e},{duration:1200,queue:!1,step:function(n,f){f.prop.toString()==="Top"&&(u.Top=n);f.prop.toString()==="Bottom"&&(u.Bottom=n);ej.ej3DColumnSeries.update(t,u,r,i)},complete:function(){i.chartObj.model.AnimationComplete=!0;var r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={series:t};i.chartObj._trigger("animationComplete",r)}})})}};ej.series3DTypes.stackingcolumn=ej.ej3DStackingColumn;ej.series3DTypes.stackingbar=ej.ej3DStackingColumn;ej.series3DTypes.stackingbar100=ej.ej3DStackingColumn;ej.series3DTypes.stackingcolumn100=ej.ej3DStackingColumn;ej.ej3DColumnSeries={draw:function(n,t,i,r){var f=t._isVisiblePoints(n),u;for(this.createSegments(n,t,r),u=0;u<f.length;u++)f[u].visible&&(n._visiblePoints[u].plans=null,this.update(n,n._visiblePoints[u],u,t))},update:function(t,i,r,u){var v=t.xAxis._valueType.toLowerCase(),l=n.inArray(t,u.chartObj.model._visibleSeries),y=v=="logarithmic"?null:1,p=v=="logarithmic"?!0:!1,w=p?Math.log(i.Left,y):i.Left,b=p?Math.log(i.Right,y):i.Right,e=t.yAxis.visibleRange.min,k=t.yAxis.visibleRange.max,o=t.xAxis.visibleRange.min,s=t.xAxis.visibleRange.max,d,a;if(w>=o&&w<=s||b>=o&&b<=s){d=i.Top<0?i.Top>e?i.Top:e:t.yAxis.valueType&&t.yAxis.valueType.toLowerCase()=="logarithmic"?i.Top:i.Top<k?i.Top:k;var h=ej.EjSvgRender.utils.Transform3DToVisible(t,i.Left>o?i.Left:o,d,u.chartObj),c=ej.EjSvgRender.utils.Transform3DToVisible(t,s>i.Right?i.Right:s,e>i.Bottom?e:i.Bottom,u.chartObj),g=u.chartObj.vector.vector3D(Math.min(h.X,c.X),Math.min(h.Y,c.Y),i.StartDepth),nt=u.chartObj.vector.vector3D(Math.max(h.X,c.X),Math.max(h.Y,c.Y),i.EndDepth),f=u.chartObj.setStyle(u,t,l,r);f.interior.indexOf("url")>=0&&(f.interior=u.chartObj.model.seriesColors[l][0].color);a="Region_Series_"+l+"_Point_"+r;t.columnFacet=="cylinder"?u.chartObj.polygon.createCylinder(g,nt,this,r,t.type,f.borderColor,f.interior,f.borderWidth,f.opacity,u.chartObj.model.requireInvertedAxes,a,u.chartObj.chart3D):t.columnFacet=="rectangle"&&u.chartObj.polygon.createBox(g,nt,this,r,t.type,f.borderColor,f.interior,f.borderWidth,f.opacity,u.chartObj.model.requireInvertedAxes,a,u.chartObj.chart3D)}},_setData:function(){var n=arguments;point=arguments[arguments.length-1];sender=arguments[arguments.length-2];point.Left=n[0];point.Bottom=n[3];point.Top=n[1];point.Right=n[2];point.StartDepth=n[4];point.EndDepth=n[5];point.XRange=sender.getDoubleRange(point.Left,point.Right);isNaN(point.Top)||isNaN(point.Bottom)||(point.YRange=sender.getDoubleRange(point.Top,point.Bottom))},createSegments:function(n,t,i){var f=t.chartObj._getXValues(n._visiblePoints),c=t.chartObj._getYValues(n._visiblePoints),e,u,r;if(f!=null)for(e=t.getSideBySideInfo(n,i),u=t._getSegmentDepth(n),crossValue=t.chartObj._getXCrossValue(n,n.xAxis,i),median=e.Delta/2,visiblePoints=n._visiblePoints,cons=.2,r=0;r<visiblePoints.length;r++){var o=f[r]+e.Start,l=f[r]+e.End,s=c[r],h=crossValue;if(this._setData(o,s,l,h,u.Start,u.End,t,visiblePoints[r]),XData=f[r],YData=c[r],n.marker.dataLabel.visible){visiblePoints[r].symbolLocation={x:0,y:0,z:0};switch(n.marker.dataLabel.textPosition){case"top":visiblePoints[r].symbolLocation.x=o+median;visiblePoints[r].symbolLocation.y=s;visiblePoints[r].symbolLocation.z=u.Start+u.Delta/2;break;case"bottom":visiblePoints[r].symbolLocation.x=o+median;visiblePoints[r].symbolLocation.y=h-cons;visiblePoints[r].symbolLocation.z=u.Start+(u.End-u.Start)/2;break;default:visiblePoints[r].symbolLocation.x=o+median;visiblePoints[r].symbolLocation.y=Math.abs(h-s)/2;visiblePoints[r].symbolLocation.z=u.Start}}}},doAnimation:function(t,i){var r=this;n.each(t._visiblePoints,function(u,f){var e=f.Top;n(f).each(function(){f.Top=0}).animate({Top:e},{duration:1200,queue:!1,step:function(n,e){e.prop.toString()==="Top"&&(f.Top=n);r.update(t,f,u,i)},complete:function(){i.chartObj.model.AnimationComplete=!0;var r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={series:t};i.chartObj._trigger("animationComplete",r)}})})}};ej.series3DTypes.column=ej.ej3DColumnSeries;ej.series3DTypes.bar=ej.ej3DColumnSeries;ej.Ej3DChart.prototype={renderSeries:function(t,i,r){var i,u,f,e,o;(ej.Ej3DSeriesRender.prototype.chartObj=t,n.extend(ej.Ej3DSeriesRender.prototype,ej.EjSeriesRender.prototype),u=new ej.Ej3DSeriesRender,f=n.extend({},ej.EjSvgRender.commonChartEventArgs),f.data={series:i},u.chartObj._trigger("seriesRendering",f),e=i.type.toLowerCase(),o=ej.series3DTypes[e],ej.util.isNullOrUndefined(o))||(o.draw(i,u,e,r),i.marker.dataLabel.visible&&n.each(i._visiblePoints,function(r,f){f.marker=n.extend(!0,{},i.marker,f.marker);f.visible&&(ej.util.isNullOrUndefined(f.marker)||f.marker.dataLabel&&f.marker.dataLabel.visible)&&u.draw3DDataLabel(i,r,f,t)}))},update3DWall:function(t,i){var u,r,f;if(t.model.AreaType=="cartesianaxes")for(n.extend(ej.Ej3DRender.prototype,this),this.updateBackWall(t),u=0;u<t.model._axes.length;u++)r=t.model._axes[u],f=r._opposed,r.orientation.toLowerCase()=="vertical"?f?this.updateRightWall(t,r,i):this.updateLeftWall(t,r,i):f?this.updateTopWall(t,r,i):this.updateBottomWall(t,r,i)},updateTopWall:function(n,t,i){var e=0,r=n.model.m_AreaBounds,u=i.axes[t.name]._validCross?t.y:r.Y,o,s,f;for(e=n.model.wallSize<u?u-n.model.wallSize:-(n.model.wallSize-u),o=n.vector.vector3D(r.X+r.Width,-n.model.depth,u-.1),s=n.vector.vector3D(r.X,-.1,e),topSideWallPlans=n.polygon.createBox(o,s,this,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"TopWallBrush",n.chart3D),f=0;f<topSideWallPlans.length;f++)n.polygon.transform(n.matrixobj.tilt(parseFloat(Math.PI/2)),topSideWallPlans[f])},updateRightWall:function(n,t,i){var f=i.axes[t.name]._validCross?t.x:n.model.m_AreaBounds.X+n.model.m_AreaBounds.Width,r={left:-n.model.depth,top:n.model.m_AreaBounds.Y,bottom:n.model.m_AreaBounds.Height+n.model.m_AreaBounds.Y,right:0},e=n.vector.vector3D(r.left,r.top,f+1.5),o=n.vector.vector3D(r.right,r.bottom,f+n.model.wallSize),u;for(rightSideWallPlans=n.polygon.createBox(e,o,n,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"RightWallBrush",n.chart3D),u=0;u<rightSideWallPlans.length;u++)n.polygon.transform(n.matrixobj.turn(parseFloat(-Math.PI/2)),rightSideWallPlans[u])},updateBackWall:function(n){var t=n.model.m_AreaBounds,i=n.vector.vector3D(t.X,t.Y,n.model.depth==0?1.5:n.model.depth+n.model.wallSize),r=n.vector.vector3D(t.X+t.Width,t.Y+t.Height,n.model.depth==0?1.5:n.model.depth);n.polygon.createBox(i,r,n,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"BackWallBrush",n.chart3D)},updateLeftWall:function(n,t,i){var r={left:-n.model.depth,top:n.model.m_AreaBounds.Y,bottom:n.model.m_AreaBounds.Height+n.model.m_AreaBounds.Y,right:0},f=i.axes[t.name]._validCross?t.x:n.model.m_AreaBounds.X,e=n.vector.vector3D(r.left,r.top,f-.1),o=n.vector.vector3D(r.right,r.bottom,f-n.model.wallSize),u;for(leftSideWallPlans=n.polygon.createBox(e,o,this,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"LeftWallBrush",n.chart3D),u=0;u<leftSideWallPlans.length;u++)n.polygon.transform(n.matrixobj.turn(parseFloat(-Math.PI/2)),leftSideWallPlans[u])},updateBottomWall:function(n,t,i){var r=n.model.m_AreaBounds,f=i.axes[t.name]._validCross?t.y:r.Y+r.Height,e=n.vector.vector3D(r.X+r.Width,-n.model.depth,n.model.wallSize+f),o=n.vector.vector3D(r.X,-.1,f+1),u;for(bottomSideWallPlans=n.polygon.createBox(o,e,this,0,"Graphics3D","#D3D3D3","#D3D3D3",0,.15,!1,"BottomWallBrush",n.chart3D),u=0;u<bottomSideWallPlans.length;u++)n.polygon.transform(n.matrixobj.tilt(parseFloat(Math.PI/2)),bottomSideWallPlans[u])}}}(jQuery);ej.EjVmlRender=function(n){var t=document,r,i;this.vmlNamespace="urn:schemas-microsoft-com:vml";this.vmStyle="#default#VML";t.namespaces.add("v","urn:schemas-microsoft-com:vml");this.isdocmode8=t.documentMode===8;t.getElementById("vml_chart")||(r=this.isdocmode8?"v\\:fill, v\\:path, v\\:polyline, v\\:line, v\\:rect,v\\:shape,v\\:oval, v\\:stroke{ behavior:url(#default#VML); display: inline-block; } ":"v\\:*{ behavior:url(#default#VML); display: inline-block; } ",i=t.createStyleSheet(),i.owningElement.id="vml_chart",i.cssText=r);this._rootId=jQuery(n).attr("id");this.svgObj=t.createElement("div");this.svgObj.style.position="relative";this.svgObj.setAttribute("id",this._rootId+"_vml");this.changeOptions={id:"id",fill:"fillcolor",stroke:"strokecolor","stroke-width":"strokeweight",d:"path","font-size":"font-size","font-family":"font-family","font-style":"font-style","font-weight":"font-weight",points:"points"}},function(n){ej.EjVmlRender.prototype={drawPath:function(t,i){var r=t.d.split(" "),f,e,o,u;n.inArray("A",r)!=-1&&(f=parseFloat(r[4]),e=parseFloat(r[5]),t.d=this.drawArc(f,e,t));n("#"+t.id).length>0?(t.d=this.changePathValue(t.d),this.applyVMLStyle(n("#"+t.id),t)):(t.d=this.changePathValue(t.d),o=document.createElement("v:shape"),u=n(o),this.applyVMLStyle(u,t),u.appendTo(i))},createLegendSvg:function(n){var t=document;return this._rootId=jQuery(n).attr("id"),this.legendsvgObj=t.createElement("div"),this.legendsvgObj.style.position="relative",this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_vml"),this.legendsvgObj},drawPolyline:function(t,i){var f=t.points.split(" "),u,r;n("#"+t.id).length>0?(t.points=this.changePathValue(t.points),this.applyVMLStyle(n("#"+t.id),t)):(t.points=this.changePathValue(t.points),u=document.createElement("v:polyline"),r=n(u),this.applyVMLStyle(r,t),r.appendTo(i))},setFillAttribute:function(t,i){var r=document.createElement("v:fill"),f=i["fill-opacity"]?i["fill-opacity"]:i.opacity,u,e;f=ej.util.isNullOrUndefined(f)?i.opacity?i.opacity:1:f;u=i.fill;u=="none"||ej.util.isNullOrUndefined(u)?u=="none"?(r.setAttribute("type","gradient"),r.setAttribute("color",i.color),r.setAttribute("color2",i.color2),r.setAttribute("colors",i.colors),r.setAttribute("angle",i.angle),f=i.fill_opacity):f=.1:u.match("gradient")?(e=u.replace("gradient",""),r.setAttribute("type","gradient"),r.setAttribute("colors",e)):n(t).attr("fillcolor",u);r.setAttribute("opacity",f);n(r).appendTo(t)},setStrokeAttribute:function(t,i){var f=i.stroke,r,u;f=="transparent"&&(i.opacity=.1);i.name&&n(t).attr("name",i.name);r=i.opacity;r&&(u=document.createElement("v:stroke"),u.setAttribute("opacity",r),n(u).appendTo(t))},changePathValue:function(n){var t,i,r;if(!n.d){for(t=n.split(" "),i=0;i<t.length;i++)r=t[i].match(/\d+/g),r!=null&&(t[i]=Math.round(parseFloat(t[i])));return t.join(" ")}},drawArc:function(n,t,i){var u=0,f=0,s=i.start,o=i.end,o=Number(Math.PI.toFixed(2))==Number((o+s).toFixed(2))?o-.01:o,e=i.r||n||t,l=Math.cos(s),a=Math.sin(s),h=Math.cos(o),v=Math.sin(o),r=i.innerR,y=.08/e,p=r&&.1/r||0,c;return o-s==0?"":(2*Math.PI-o+s<y?h=-y:o-s<p&&(h=Math.cos(s+p)),c=["wa",u-e,f-e,u+e,f+e,u+e*l,f+e*a,u+e*h,f+e*v],i.open&&!r&&c.push("e",M,u,f),c.push("at",u-r,f-r,u+r,f+r,u+r*h,f+r*v,u+r*l,f+r*a,"x","e"),c.join(" "))},changeVMLStyle:function(t,i){var r=this,u=i.stroke;t.css("width",i.width).css("visibility",i.visibility).css("height",i.height).css("position","absolute").css("left",i.x).css("top",i.y);n.each(i,function(n,u){(r.changeOptions[n]!=null||r.changeOptions[n]!=undefined)&&((n=="d"||n=="points")&&(u=r.changePathValue(i[n]).toLowerCase()),u!="transparent"||i.fill_opacity||(i[n]=u="white",n!="fill"||i.hasOwnProperty("opacity")&&i.opacity||(i.opacity=.1)),i.fill_opacity&&(i.opacity=i.fill_opacity),t[0].tagName==="SPAN"?n=="fill"?t.css("color",u):n=="id"?t.attr(r.changeOptions[n],u):t.css(r.changeOptions[n],u):r.isdocmode8?t.get(0)[r.changeOptions[n]]=u:t.get(0).setAttribute(r.changeOptions[n],u))});(i.hasOwnProperty("fill-opacity")||i.hasOwnProperty("opacity")||i.hasOwnProperty("fill"))&&(t[0].tagName==="SPAN"||(r.setFillAttribute(t,i),i.hasOwnProperty("stroke")&&(i.stroke=u,i.fill_opacity&&(i.opacity=i.fill_opacity),r.setStrokeAttribute(t,i))))},applyVMLStyle:function(n,t){n[0].tagName!=="SPAN"&&(ej.util.isNullOrUndefined(t.width)&&(t.width="1000px"),ej.util.isNullOrUndefined(t.height)&&(t.height="1000px"));ej.util.isNullOrUndefined(t.x)&&(t.x="0px");ej.util.isNullOrUndefined(t.y)&&(t.y="0px");this.changeVMLStyle(n,t)},drawLine:function(t,i){var r,u;if(n("#"+t.id).length>0)r=t.x1+","+t.y1,u=t.x2+","+t.y2,n(t).attr("from",r).attr("to",u),this.applyVMLStyle(n("#"+t.id),t);else{var e=document.createElement("v:line"),f=n(e),r=t.x1+","+t.y1,u=t.x2+","+t.y2;f.attr("from",r).attr("to",u);this.applyVMLStyle(f,t);f.appendTo(i)}},drawCircle:function(t,i){if(n("#"+t.id).length>0)t.x=t.cx-t.r,t.y=t.cy-t.r,t.width=t.height=2*t.r,this.applyVMLStyle(n("#"+t.id),t);else{var u=document.createElement("v:oval"),r=n(u);t.x=t.cx-t.r;t.y=t.cy-t.r;t.width=t.height=2*t.r;this.applyVMLStyle(r,t);n("#"+t.id).length==0&&r.appendTo(i)}},drawEllipse:function(t,i){if(n("#"+t.id).length>0)t.x=t.cx-t.rx,t.y=t.cy-t.ry,t.width=2*t.rx,t.height=2*t.ry,this.applyVMLStyle(n("#"+t.id),t);else{var u=document.createElement("v:oval"),r=n(u);t.x=t.cx-t.rx;t.y=t.cy-t.ry;t.width=2*t.rx;t.height=2*t.ry;this.applyVMLStyle(r,t);r.appendTo(i)}},drawRect:function(t,i){if(n("#"+t.id).length>0)this.applyVMLStyle(n("#"+t.id),t);else{var u=document.createElement("v:rect"),r=n(u);this.applyVMLStyle(r,t);r.appendTo(i)}},drawCylinder:function(t,r,u){var a=t.x,v=t.y,d=t.width,vt=t.height,yt=t.id,s,f,e,h,g,c,nt,tt,it,rt,ut,ft,y,p,w,et,ot,b,k,st,ht,ct,lt,l=t.fill,dt=ej.EjSvgRender.prototype.checkColorFormat(l),kt,at;dt||(l=ej.datavisualization.Chart.prototype.colorNameToHex(t.fill));var gt=t.opacity,pt={svgRenderer:ej.EjSvgRender.prototype},wt=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(l,pt),bt=ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(l,pt),o=65535;for(u.isColumn==!0?(t.rx=f=d/2,t.ry=e=f/4,h=g=a+f,tt=c=v-e,ft=k=y=v+vt-e,it=h+f,nt=ut=b=h-f,sa1=-Math.round(o*180),ea1=Math.round(o*180),et=Math.round(o*360),ot=-Math.round(o*180),gradientAngle="90",u.stacking==!0&&(u.isLastSeries||(c=v+e)),rt=c):(t.ry=e=vt/2,t.rx=f=e/4,it=nt=g=a+f,b=h=a+d+f,sa1=Math.round(o*90),ea1=Math.round(o*180),et=Math.round(o*270),ot=-Math.round(o*180),y=c=v+e,k=rt=c+e,tt=ft=y-e,gradientAngle="0",u.stacking==!0&&(u.isLastSeries||(h=a+d-f)),ut=h),delete t.x,delete t.y,t.width=1e3,t.x=0,t.y=0,delete t.stacking,t.height=1e3,delete t.isColumn,t.fill=wt,t.fill_opacity=gt,t.stroke=wt,t["stroke-width"]=0,i=1;i<=4;i++)i%2==0?(st=g,ht=c,ct=ut,lt=ft,p=et,w=ot):(st=h,ht=y,ct=it,lt=rt,p=sa1,w=ea1),i<3&&(p=o,w=23592600),i<4&&(s=["M",Math.round(b),Math.round(k)]),s.push("ae",Math.round(st),Math.round(ht),Math.round(f),Math.round(e),p,w),i>2&&(s.push("l",Math.round(ct),Math.round(lt)),t.fill="none",t.color=l,t.color2=l,t.colors="30% "+bt+",70% "+bt,t.angle=gradientAngle),i!=3&&(s.push("e"),s=s.join(" "),t.d=s,t.id=yt+"_Region_"+(i-1).toString(),i==4&&(t.id=yt+"_Region_"+(i-2).toString()),kt=document.createElement("v:shape"),at=n(kt),this.applyVMLStyle(at,t),at.appendTo(r)),b=nt,k=tt},_getAttrVal:function(t,i,r){i=i=="x"?"left":i;i=i=="y"?"top":i;var u=n(t).attr(i),f=u?u:n(t).css(i);return f!=null?f:r},_setAttr:function(t,i){var r,u,f;i.transform&&(r=i.transform,u=r.slice(r.indexOf("(")+1,r.indexOf(")")).split(","),i.x=u[0],i.y=u[1]);f=n(t);f.length>0&&this.changeVMLStyle(f,i)},createGradientElement:function(n,t){var i,f,r,u;if(Object.prototype.toString.call(t)=="[object Array]")for(i="gradient ",f="",r=0,u=t.length-1;u>=0,r<t.length;r++,u--)i+=f+t[r].colorStop+" "+t[u].color,f=",";else i=t;return i},setSpanAttr:function(t,i,r){var e=t["font-size"]>0?t["font-size"]+"px":t["font-size"],u={size:e,fontStyle:t["font-style"],fontFamily:t["font-family"]},f=ej.EjSvgRender.utils._measureText(i,null,u);n(r).css("white-space","nowrap");t["text-anchor"]==="middle"?t.x=Math.round(t.x-f.width/2):t["text-anchor"]==="end"&&(t.x=Math.round(t.x-f.width));t.y=Math.round(t.y-u.size.replace("px",""));this.applyVMLStyle(r,t)},drawText:function(t,i,r,u){var c=document,v=n("#"+t.id),f,y,l,e,s,o,h,a,p;if(v.length>0)this._textAttrReplace(t,i,u,v);else if(t.id.indexOf("YAxisTitle")>0&&!this.isdocmode8)t.on=!0,f=document.createElement("v:line"),f.style.behavior="url(#default#VML)",f.style.display="inline-block",y=ej.EjSvgRender.utils._measureText(i,null,null),f.setAttribute("to",(t.x-1).toString()+","+(t.y-y.width/2).toString()),f.setAttribute("from",t.x.toString()+","+t.y.toString()),l=document.createElement("v:path"),l.setAttribute("textpathok",!0),e=document.createElement("v:textpath"),e.setAttribute("on",!0),e.setAttribute("string",i),e.style["font-style"]=t["font-style"],e.style["font-size"]=t["font-size"],e.style["font-family"]=t["font-family"],f.appendChild(l),f.appendChild(e),n(f).appendTo(r);else{if(s=c.createElement("span"),o=n(s),jQuery.type(i)=="array")for(this.setSpanAttr(t,i,o),h=0;h<i.length;h++)a=c.createElement("span"),n(a).html(i[h]),n(a).appendTo(s),p=c.createElement("br"),n(p).appendTo(s);else this.setSpanAttr(t,i,o),o.html(i);o.appendTo(r)}},_textAttrReplace:function(t,i,r,u){var f,e,o;if(jQuery.type(i)=="array")if(f=n("#"+t.id).children("span"),this.setSpanAttr(t,i,u),f.length>0&&f.length==i.length)for(e=0;e<f.length;e++)o=f[e],n(o).text(i[e]);else n("#"+t.id).remove(),this.drawText(t,i,this.gTransToolEle,r);else this.setSpanAttr(t,i,u),u.text(i)},drawImage:function(t,i){var u=document.createElement("img"),r=n(u);r.css({position:"absolute"});n.each(t,function(n,t){n=="href"&&(n="src");r.attr(n,t)});r.appendTo(i)},createDefs:function(){},createGroup:function(t){var i=document.createElement("div"),r;return ej.util.isNullOrUndefined(t.transform)||(r=t.transform.slice(t.transform.indexOf("(")+1,t.transform.indexOf(")")).split(","),n(i).css({position:"absolute",left:r[0]+"px",top:r[1]+"px"})),t.cursor&&n(i).css({cursor:t.cursor}),n.each(t,function(t,r){t!=="transform"&&t!="clip-path"&&n(i).attr(t,r)}),i},createText:function(t,i){var r=document.createElement("span");return n(r).attr(t),ej.util.isNullOrUndefined(i)||(r.textContent=i),r},drawAxesBoundsClipPath:function(t,i,r){var u,e=n(t),f;e.removeAttr("clip-path");f=this._getTransform(i.xAxis,i.yAxis,r);u={id:t.id+"_ClipRect",x:0,y:0,width:f.width,height:f.height,fill:"white","stroke-width":1,stroke:"transparent"};this.drawClipPath(u,t);e.attr("clip-path","url(#"+u.id+")")},getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},round:function(n,t,i){return t*(i?Math.ceil(n/t):Math.floor(n/t))},hexFromRGB:function(t){var r=t.R,u=t.G,f=t.B;if(t.A)return"rgba("+r.toString()+","+u.toString()+","+f.toString()+","+t.A+")";var r=t.R,u=t.G,f=t.B,i=[r.toString(16),u.toString(16),f.toString(16)];return n.each(i,function(n,t){t.length===1&&(i[n]="0"+t)}),"#"+i.join("").toUpperCase()},hexToRGB:function(n){var i=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.test(n),t;return i==!0?(t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(n),t?{R:parseInt(t[1]),G:parseInt(t[2]),B:parseInt(t[3]),A:t[4]}:null):(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),t?{R:parseInt(t[1],16),G:parseInt(t[2],16),B:parseInt(t[3],16)}:null)},checkColorFormat:function(n){return/(rgba?\((?:\d{1,3}[,\)]){3}(?:\d+\.\d+\))?)|(^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$)/gmi.test(n)},createDelegate:function(n,t){return function(i){t.apply(n,[i,this])}},drawClipPath:function(t,i){if(t.id.indexOf("ChartAreaClipRect")==-1){var r=Math.round(t.x)+"px",u=Math.round(t.y)+"px",f=Math.round(t.width)+Math.round(t.x)+"px",e=Math.round(t.y)+Math.round(t.height)+"px",o="rect("+u+" "+f+" "+e+" "+r+")";n(i).css("position","absolute").css("clip",o)}},drawCircularClipPath:function(t,i){var r=Math.round(t.r),u=Math.round(t.cx),f=Math.round(t.cy);if(t.id.indexOf("_ClipRect")==-1){var e=u-r+"px",o=f-r+"px",s=u+r+"px",h=f+r+"px",c="rect("+o+" "+s+" "+h+" "+e+")";n(i).css("position","absolute").css("clip",c)}},append:function(t,i){n(t).appendTo(i)}}}(jQuery);ej.EjCanvasRender=function(n){this.svgObj=document.createElement("canvas");this._rootId=jQuery(n).attr("id");this.svgObj.setAttribute("id",this._rootId+"_canvas");this.ctx=this.svgObj.getContext("2d")},function(n){ej.EjCanvasRender.prototype={drawPath:function(n,t,i){var h=n.hasStackingInnerRadius?n.hasStackingInnerRadius:!1,p=n.d,u=p.split(" "),c=n["stroke-width"],l,o,s,a,r,f,e,v,y;if(n.lgndCtx){for(a=this.lgndCtx,this.lgndCtx=t!=undefined?t:this.lgndCtx,this.lgndCtx.save(),this.lgndCtx.beginPath(),i&&this.lgndCtx.translate(i[0],i[1]),this.lgndCtx.globalAlpha=n.opacity?n.opacity:n["fill-opacity"],this.lgndCtx.lineWidth=n["stroke-width"],this.lgndCtx.strokeStyle=n.stroke,r=0;r<u.length;r=r+3){f=parseFloat(u[r+1]);e=parseFloat(u[r+2]);switch(u[r]){case"M":this.lgndCtx.moveTo(f,e);break;case"L":this.lgndCtx.lineTo(f,e);break;case"C":this.lgndCtx.bezierCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]),parseFloat(u[r+5]),parseFloat(u[r+6]));r=r+4;break;case"A":this.lgndCtx.arc(parseFloat(u[r-5]),parseFloat(u[r-4]),f,0,2*Math.PI,!1);r=r+5;break;case"a":this.lgndCtx.beginPath();v=parseFloat(u[r-2])+f;y=u[r-1];this.lgndCtx.arc(v,y,f,0,2*Math.PI,!1);r=r+5;break;case"Z":this.lgndCtx.fillStyle=n.fill;this.lgndCtx.fill();r=r-2;break;case"Q":this.lgndCtx.quadraticCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]));r=r+2}}n.fill!="none"&&n.fill!=undefined&&(this.lgndCtx.fillStyle=n.fill,this.lgndCtx.fill());this.lgndCtx.stroke();this.lgndCtx.restore();this.lgndCtx=a}else{for(l=this.ctx,this.ctx=t!=undefined?t:this.ctx,this.ctx.save(),this.ctx.beginPath(),i&&this.ctx.translate(i[0],i[1]),this.ctx.globalAlpha=n.opacity?n.opacity:n["fill-opacity"],o=!0,this.ctx.lineWidth=c,s=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1,s&&this.ctx.setLineDash(s),this.ctx.strokeStyle=n.stroke,r=0;r<u.length;r=r+3){f=parseFloat(u[r+1]);e=parseFloat(u[r+2]);switch(u[r]){case"M":n.innerR&&!h||n.cx||this.ctx.moveTo(f,e);break;case"L":(!n.innerR||h)&&this.ctx.lineTo(f,e);break;case"C":this.ctx.bezierCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]),parseFloat(u[r+5]),parseFloat(u[r+6]));r=r+4;break;case"A":n.innerR?o&&(this.ctx.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),this.ctx.arc(n.x,n.y,n.innerR,n.end,n.start,!n.counterClockWise),o=!1):n.cx?this.ctx.arc(n.cx,n.cy,n.radius,0,2*Math.PI,n.counterClockWise):(this.ctx.moveTo(n.x,n.y),this.ctx.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),this.ctx.lineTo(n.x,n.y));r=r+5;break;case"Q":this.ctx.bezierCurveTo(f,e,parseFloat(u[r+1]),parseFloat(u[r+2]),parseFloat(u[r+3]),parseFloat(u[r+4]));r=r+2;break;case"z":this.ctx.closePath()}}n.fill!="none"&&n.fill!=undefined&&(this.ctx.fillStyle=n.fill,this.ctx.fill());c>0&&this.ctx.stroke();this.ctx.restore();this.ctx=l}},drawRect:function(n,t){var r=this.ctx,i=n.rx;this.ctx=t?t.canvas?t:this.ctx:this.ctx;this.ctx.save();this.ctx.beginPath();this.ctx.globalAlpha=n.opacity;this.ctx.lineWidth=n["stroke-width"];dashArray=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1;dashArray&&this.ctx.setLineDash(dashArray);this.ctx.strokeStyle=n.stroke;this.ctx.rect(n.x,n.y,n.width,n.height);i!=null&&i>=0?this.drawCornerRadius(n):(n.fill=="none"&&(n.fill="transparent"),this.ctx.fillStyle=n.fill,this.ctx.fillRect(n.x,n.y,n.width,n.height),this.ctx.stroke());n.id.indexOf("Series")>=0&&this.ctx.clip();this.ctx.restore();this.ctx=r},drawCylinder:function(n,t,i){var bt=this.ctx,s,l,pt,h,o;this.ctx=t?t.canvas?t:this.ctx:this.ctx;this.ctx.save();s=ej.datavisualization.Chart.prototype.colorNameToHex(n.fill);l={svgRenderer:ej.EjSvgRender.prototype};"use strict";var o,k,d,a=Math.PI,kt=2*a+.1,r,u,g,v,y,nt,p,tt,it,w,rt,ut,ft,et,ot,st,ht,ct,lt,at,vt,yt,f=n.x,e=n.y,c=n.width,b=n.height,wt=kt;for(this.ctx.fillStyle=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(s,l),this.ctx.lineWidth=0,this.ctx.strokeStyle=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(s,l),this.ctx.globalAlpha=n.opacity,i.isColumn==!0?(ht=f,lt=c+f,at=ct=0,r=c/2,u=r/4,v=g=f+r,w=y=e-u,tt=f,p=f+c,nt=it=e+b-u,st=0,ot=a,vt=-r,yt=u,(i.stacking=!0)&&(i.isLastSeries||(w=y=e+u))):(ht=lt=0,ct=b+e,at=e,u=b/2,r=u/4,tt=g=f+r,p=v=f+c+r,it=e+b,w=e,nt=y=e+u,st=a/2,ot=a*1.5,(i.stacking=!0)&&(i.isLastSeries||(p=v=f+c-r)),u=-u,r=-r,vt=r,yt=-u),pt=ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(s,l),h=this.ctx.createLinearGradient(ht,at,lt,ct),h.addColorStop(0,s),h.addColorStop(.3,pt),h.addColorStop(.7,pt),h.addColorStop(1,s),j=1;j<=4;j++){for(o=0,j<4?this.ctx.beginPath():"",j%2==0?(rt=v,ut=nt,ft=tt,et=w):(rt=g,ut=y,ft=p,et=it),j==4&&(r=vt,u=yt,this.ctx.fillStyle=h),j>2&&(o=st,wt=ot);o<=wt;o+=.1)k=rt-r*Math.cos(o),d=ut+u*Math.sin(o),o===0?this.ctx.moveTo(k,d):this.ctx.lineTo(k,d);j>2&&this.ctx.lineTo(ft,et);j!=3&&(this.ctx.stroke(),this.ctx.fill())}n.id.indexOf("Series")>=0&&this.ctx.clip();this.ctx.restore();this.ctx=bt},drawCornerRadius:function(n){var t=n.rx,i=n.x,r=n.y,u=n.width,f=n.height;n.fill=="none"&&(n.fill="transparent");this.ctx.fillStyle=n.fill;u<2*t&&(t=u/2);f<2*t&&(t=f/2);this.ctx.beginPath();this.ctx.moveTo(i+u-t,r);this.ctx.arcTo(i+u,r,i+u,r+f,t);this.ctx.arcTo(i+u,r+f,i,r+f,t);this.ctx.arcTo(i,r+f,i,r,t);this.ctx.arcTo(i,r,i+u,r,t);this.ctx.closePath();this.ctx.fill();this.ctx.stroke()},createGradientElement:function(n,t){var u,o=this.ctx,f,i,e,r;if(Object.prototype.toString.call(t)=="[object Array]"){for(f=o.createLinearGradient(0,0,0,this.svgObj.height),i=0;i<=t.length-1;i++)e=t[i].color,r=t[i].colorStop.slice(0,-1),r=parseInt(r)/100,f.addColorStop(r,e);u=f}else u=t;return u},drawLine:function(n){this.ctx.save();this.ctx.beginPath();this.ctx.lineWidth=n["stroke-width"];this.ctx.strokeStyle=n.stroke;this.ctx.moveTo(n.x1,n.y1);this.ctx.lineTo(n.x2,n.y2);this.ctx.stroke();this.ctx.restore()},drawText:function(t,i){var l,u,o,r,a,s,v,f;ej.util.isNullOrUndefined(t["font-weight"])||t["font-weight"].toLowerCase()!="regular"||(t["font-weight"]="normal");var h=t["font-style"].toLowerCase()+" "+t["font-weight"]+" "+t["font-size"]+" "+t["font-family"],e=t["text-anchor"],c=t.opacity!==undefined?t.opacity:1;if(e=="middle"&&(e="center"),t.lgndCtx)this.lgndCtx.save(),this.lgndCtx.fillStyle=t.fill,this.lgndCtx.font=h,this.lgndCtx.textAlign=e,this.lgndCtx.globalAlpha=c,t["dominant-baseline"]=="middle"&&(this.lgndCtx.textBaseline="center"),t.labelRotation?(this.lgndCtx.translate(t.x,t.y),this.lgndCtx.rotate(t.labelRotation*Math.PI/180),this.lgndCtx.fillText(i,0,0)):this.lgndCtx.fillText(i,t.x,t.y),this.lgndCtx.restore();else{if(this.ctx.save(),this.ctx.fillStyle=t.fill,this.ctx.font=h,this.ctx.textAlign=e,this.ctx.globalAlpha=c,t.baseline&&(this.ctx.textBaseline=t.baseline),t.labelRotation)o=0,r=t.labelRotation,r&&t.id.indexOf("XLabel")!=-1?(a="rotate("+t.labelRotation.toString()+"deg)",n(t).attr("rotateAngle",a),s=this.createText(t,i),n(document.body).append(s),v=s.getBoundingClientRect(),n(s).remove(),o=v.height,r<0&&(r=360+r),f=t.transform.split(","),t.labelPosition=="outside"?this.ctx.translate(parseFloat(f[1]),parseFloat(f[2])+o/2):this.ctx.translate(parseFloat(f[1]),parseFloat(f[2])-o/2),this.ctx.textAlign="center",this.ctx.rotate(r*(Math.PI/180)),this.ctx.fillText(i,0,0)):(this.ctx.translate(t.x,t.y),this.ctx.rotate(t.labelRotation*Math.PI/180),this.ctx.fillText(i,0,0));else if(typeof i=="object"&&t.isTrackball)for(l=i.length,u=0;u<l;u++)this.ctx.fillText(i[u],t.x,t.y+(Number(parseInt(t["font-size"]))+t.padding)*u);else this.ctx.fillText(i,t.x,t.y);this.ctx.restore()}},drawZoomRect:function(t,i){var r={left:0,top:0},f=n("<div id="+t.id+"><\/div>"),u=i.model.m_AreaBounds;t.x<u.X||t.x+r.left+t.width>r.left+n(this.svgObj).width()-20?(width=this.prevWidth,x=this.prevX):(width=this.prevWidth=t.width,x=this.prevX=t.x+r.left);t.y<u.Y||t.y+r.top+t.height>r.top+u.Y+u.Height?(height=this.prevHeight,y=this.prevY):(height=this.prevHeight=t.height,y=this.prevY=t.y+r.top);n(f).css({width:width,height:height,top:y,left:x,"background-color":t.fill,"border-style":"solid",position:"absolute","border-color":t.stroke,"border-width":t["stroke-width"]});document.getElementById("chartContainer_"+this._rootId).appendChild(f[0])},zoomButton:function(t,i,r){var l=r.svgObj?r.svgObj:r.svgObject,y=r._rootId?r._rootId:r._id,o,e,c,f,s,h,a,v,u;o=i=="zoom"?"_Zoom":i=="zoomIn"?"_ZoomIn":"_ZoomOut";e={left:0,top:0};n("#"+t.zoomId).length<=0?(u=n("<div id="+l.id+o+"Btn><\/div>"),n(u).css({width:t.width,height:t.height,top:t.top+e.top,left:t.left+e.left,"background-color":t.fill,"border-style":"solid",position:"absolute","border-radius":"0.4em","border-color":t.fill,"box-sizing":"content-box","z-index":2e3}),c="http://www.w3.org/2000/svg",f=document.createElementNS(c,"svg"),f.setAttribute("id",t.zoomId),f.setAttribute("width",25),f.setAttribute("height",25),i=="zoom"?(s="M26.101,22.893l-6.605-6.174c1.414-2.781,0.897-6.267-1.496-8.504c-2.901-2.711-7.448-2.56-10.161,0.341 c-2.712,2.9-2.56,7.45,0.341,10.163c2.426,2.266,6,2.523,8.694,0.853l6.579,6.151L26.101,22.893z M10.186,16.571 c-1.715-1.604-1.805-4.293-0.203-6.009c1.605-1.715,4.295-1.805,6.009-0.201c1.715,1.603,1.805,4.293,0.202,6.007 C14.59,18.084,11.901,18.175,10.186,16.571",h="translate(-3,-3)"):i=="zoomIn"?(s="M9.0983096,4.2999878L9.0983096,9.3999634 3.9983783,9.3999634 3.9983783,12.699951 9.0983096,12.699951 9.0983096,17.799988 12.398249,17.799988 12.398249,12.699951 17.49818,12.699951 17.49818,9.5 12.398249,9.5 12.398249,4.2999878z M10.998276,0C14.298215,0 17.49818,1.3999634 19.69813,4.1999512 22.79809,8.0999756 22.79809,13.5 19.998144,17.399963L28.597992,28.299988 23.898081,32 15.398205,21.199951C10.898271,23.099976 5.5983606,21.899963 2.3983956,17.899963 -1.4015366,13.099976 -0.60156059,6.0999756 4.1983567,2.3999634 6.1983276,0.79998779 8.5983163,0 10.998276,0z",h="translate(4,4) scale(0.6)"):(s="M3.9983433,9.5L3.9983433,12.799988 17.598165,12.799988 17.598165,9.5z M10.998234,0C14.298169,0 17.498131,1.3999634 19.698108,4.1999512 22.798034,8.0999756 22.798034,13.5 19.998092,17.399963L28.597994,28.299988 23.898054,32 15.398188,21.199951C10.898259,23.099976 5.5983546,21.899963 2.398393,17.899963 -1.4015351,13.099976 -0.60155994,6.0999756 4.1983522,2.3999634 6.1983207,0.79998779 8.5983074,0 10.998234,0z",h="translate(4,4) scale(0.6)"),a={id:o+"Path",fill:t.iconColor,transform:h,d:s},v=document.createElementNS(c,"path"),n(v).attr(a).appendTo(f),u[0].appendChild(f),document.getElementById("chartContainer_"+y).appendChild(u[0])):(u=document.getElementById(l.id+o+"Btn"),n(u).css({top:t.top+e.top,left:t.left+e.left}))},panButton:function(t,i){var s=i.svgObj?i.svgObj:i.svgObject,c=i._rootId?i._rootId:i._id,f={left:0,top:0},e,u,o,h,r;n("#"+t.panId).length<=0?(r=n("<div id="+s.id+"_PanBtn><\/div>"),n(r).css({width:t.width,height:t.height,top:t.top+f.top,left:t.left+f.left,"background-color":t.fill,"border-style":"solid",position:"absolute","border-radius":"0.4em","border-color":t.fill,"box-sizing":"content-box","z-index":2e3}),e="http://www.w3.org/2000/svg",u=document.createElementNS(e,"svg"),u.setAttribute("id",t.panId),u.setAttribute("width",25),u.setAttribute("height",25),o={id:"panPath",fill:t.iconColor,transform:"translate(-3,-3)"},o.points="26.105,16 21.053,12.211 21.053,14.737 17.263,14.737 17.263,10.947 19.834,10.947 16.044,5.895 12.255,10.947 14.737,10.947 14.737,14.737 10.947,14.737 10.947,12.211 5.895,16 10.947,19.789 10.947,17.263 14.737,17.263 14.737,21.053 12.255,21.053 16.044,26.105 19.834,21.053 17.263,21.053 17.263,17.263 21.053,17.263 21.053,19.789",h=document.createElementNS(e,"polygon"),n(h).attr(o).appendTo(u),r[0].appendChild(u),document.getElementById("chartContainer_"+c).appendChild(r[0])):(r=document.getElementById(s.id+"_PanBtn"),n(r).css({top:t.top+f.top,left:t.left+f.left}))},resetZoom:function(t,i){var l=i.svgObj?i.svgObj:i.svgObject,w=i._rootId?i._rootId:i._id,e={left:0,top:0},f,r,o,a,s,v,h,y,c,p,u;n("#"+t.resetZoomId).length<=0?(u=n("<div id="+l.id+"_ResetZoom><\/div>"),n(u).css({width:t.width,height:t.height,top:t.top+e.top,left:t.left+e.left,"background-color":t.fill,"border-style":"solid","border-radius":"0.4em",position:"absolute","border-color":t.fill,"box-sizing":"content-box","z-index":2e3}),f="http://www.w3.org/2000/svg",r=document.createElementNS(f,"svg"),r.setAttribute("id",t.resetZoomId),r.setAttribute("width",25),r.setAttribute("height",25),o={id:"p1",fill:t.iconColor,transform:"translate(-3,-3)"},o.points="11.895,18.398 8.061,22.23 5.796,19.967 5.796,26.283 12.112,26.283 9.848,24.018 13.682,20.186",a=document.createElementNS(f,"polygon"),n(a).attr(o).appendTo(r),s={id:"p2",fill:t.iconColor,transform:"translate(-3,-3)"},s.points="19.691,6.072 21.955,8.337 18.121,12.172 19.908,13.959 23.742,10.123 26.007,12.389 26.007,6.072",v=document.createElementNS(f,"polygon"),n(v).attr(s).appendTo(r),h={id:"p3",fill:t.iconColor,transform:"translate(-3,-3)"},h.points="11.895,13.958 13.682,12.172 9.848,8.337 12.112,6.072 5.796,6.072 5.796,12.389 8.061,10.123",y=document.createElementNS(f,"polygon"),n(y).attr(h).appendTo(r),c={id:"p4",fill:t.iconColor,transform:"translate(-3,-3)"},c.points="19.908,18.396 18.121,20.186 21.955,24.018 19.691,26.283 26.007,26.283 26.007,19.967 23.741,22.23",p=document.createElementNS(f,"polygon"),n(p).attr(c).appendTo(r),u[0].appendChild(r),document.getElementById("chartContainer_"+w).appendChild(u[0])):(u=document.getElementById(l.id+"_ResetZoom"),n(u).css({top:t.top+e.top,left:t.left+e.left}))},drawCrosshairLine:function(t,i){var r=n("<div id="+t.id+"><\/div>");n(r).css({width:t.width,height:t.height,left:t.left,top:t.top,"border-style":t.style,opacity:t.opacity,visibility:"visible","border-color":t.stroke,"border-width":t["stroke-width"],position:t.position});n(i).append(r[0])},drawCrosshairlabel:function(t,i,r){var e=n("#"+this._rootId).offset(),f={left:0,top:0},u;n("#"+t.id).length>0?(u=document.getElementById(t.id),n(u).css({width:t.width-5,height:t.height-5,left:i.x+f.left-5,top:i.y+f.top-15,visibility:"visible",display:t.display}),document.getElementById(t.id).textContent=r):(u=n("<div id="+t.id+" style='position: absolute; z-index: 13000;'><\/div>"),n(u).css({color:i.fill,"font-family":i["font-family"],"font-size":i["font-size"],"font-weight":i["font-weight"],"font-style":i["font-style"],"background-color":t.fill,"border-style":"solid","border-color":t.stroke,"border-width":t["stroke-width"],opacity:t["fill-opacity"],"text-align":"center"}),document.getElementById(this._rootId).appendChild(u[0]))},createCrosshairCanvas:function(){var i=document.getElementById(this._rootId+"_canvas"),u=n("#"+this._rootId).offset(),t,r={left:0,top:0};return n("#secondCanvas").length?t=document.getElementById("secondCanvas"):(t=document.createElement("canvas"),n(document).find("#"+this.svgObj.id+"_CrosshairGroup").append(t),n(t).attr({id:"secondCanvas",width:i.width,height:i.height,top:r.top,left:r.left}),n(t).css({width:i.width,height:i.height,top:r.top,left:r.left})),t},drawTrackToolTip:function(t,i,r,u){var s={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop},h,e,o,f;if(n("#"+t.id).length>0)if(f=document.getElementById(t.id),n(f).css({left:t.x+s.left,top:t.y+s.top,visibility:"visible","border-box":"content-box","background-color":t.fill,color:i.fill,"border-color":t.stroke,"border-width":t["stroke-width"]}),jQuery.type(r)=="array"){for(h=0,e="",o=0;o<r.length;o++)e=e+r[o]+"<\/br>";n("#"+t.id).html(e)}else n("#"+t.id).html(r);else f=n("<div id="+t.id+" style='position: absolute; z-index: 13000;'><\/div>"),n(f).css({color:i.fill,"font-family":i["font-family"],"font-size":i["font-size"],"font-weight":i["font-weight"],"font-style":i["font-style"],width:t.width,height:t.height-u-2*t["stroke-width"],"background-color":t.fill,"border-style":"solid","text-align":"center",padding:"0px","padding-top":u/2+"px","padding-bottom":u/2+"px","border-color":t.stroke,"border-width":t["stroke-width"],opacity:t["fill-opacity"]}),document.getElementById(this._rootId).appendChild(f[0])},trackSymbol:function(t,i,r,u,f){var l=f.model.m_AreaBounds,ht=n("#"+this._rootId).offset(),d,b,h,g,nt,tt,v,e,o,w,s;if(i.startX>=l.X&&i.startX<=l.X+l.Width&&i.startY>=l.Y&&i.startY<=l.Y+l.Height)if(b=t.SeriesIndex,g=t.PointIndex,f.model.series[b].type.toLowerCase()=="bubble"&&(nt=f.model.series[b]._visiblePoints[g],h=nt.radius*2+5,t.Style.BorderColor=t.Style.Color),f.model.series[b].type.toLowerCase()=="scatter"&&ej.util.isNullOrUndefined(u))tt={cx:i.startX-2,cy:i.startY-2,r:t.ShapeSize.width/2,fill:t.Style.Color,opacity:t.Style.Opacity,stroke:t.Style.BorderColor},this.drawCircle(tt,null);else{n("#canvas_trackSymbol").length>0?(v=n("#canvas_trackSymbol"),n(v).css({visibility:"visible",display:"block"})):v=n("<div id=canvas_trackSymbol><\/div>");var y={left:i.startX,top:i.startY},c=n("<div id="+t.ID+"><\/div>"),a=y.left-(h||t.ShapeSize.width),p=y.top-(h||t.ShapeSize.height);n(c).css({left:a,top:p,"box-sizing":"content-box",position:"absolute",visibility:"visible",opacity:t.Style.Opacity,"z-index":200});e=t.ShapeSize;t.symbol=c;o={};switch(r.toLowerCase()){case"circle":n(c).css({width:h||t.ShapeSize.width+"px",height:h||t.ShapeSize.height+"px",left:h?a+h/2:a+t.ShapeSize.width/2-t.Style.BorderWidth+"px",top:h?p+h/2:p+t.ShapeSize.height/2-t.Style.BorderWidth+"px","border-style":"solid","background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth,"border-radius":"100%"});break;case"rectangle":n(c).css({width:t.ShapeSize.width,height:t.ShapeSize.height,left:a+t.ShapeSize.width/2-t.Style.BorderWidth/2,top:p+t.Style.BorderWidth/2,"border-style":"solid","background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth});break;case"diamond":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+i.startX+" "+(i.startY+-t.ShapeSize.height/2)+" L "+(i.startX+t.ShapeSize.width/2)+" "+i.startY+" L "+i.startX+" "+(i.startY+t.ShapeSize.height/2)+" L "+(i.startX+-t.ShapeSize.width/2)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"triangle":s="M "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+" L "+i.startX+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"invertedtriangle":var s="M "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+" L "+i.startX+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+"z",ft=i.startX,et=i.startY,ot="rotate(180,"+ft+","+et+")";o.direction=s;o.rotate=ot;this.drawSvgShape(t,o);break;case"cross":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+(i.startX+e.width/2)+" "+i.startY+" M "+i.startX+" "+(i.startY+e.height/2)+" L "+i.startX+" "+(i.startY+-e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"star":s="M "+(i.startX+e.width/3)+" "+(i.startY+-e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/6)+" L "+(i.startX+e.width/2)+" "+(i.startY+e.height/6)+" L "+(i.startX+-e.width/3)+" "+(i.startY+-e.height/2)+" L "+i.startX+" "+(i.startY+e.height/2)+" L "+(i.startX+e.width/3)+" "+(i.startY+-e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"hexagon":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+(i.startX+-e.width/4)+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/4)+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/2)+" "+i.startY+" L "+(i.startX+e.width/4)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/4)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"wedge":s="M "+(i.startX-e.width)+" "+i.startY+" L "+(i.startX+e.width)+" "+(i.startY+-e.height/2)+" L "+(i.startX+3*(e.width/4))+" "+i.startY+" L "+(i.startX+e.width)+" "+(i.startY+e.height/2)+" L "+(i.startX-e.width)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"trapezoid":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+(i.startX+-e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX+-e.width/2+e.width)+" "+(i.startY+-e.height/2)+" L "+(i.startX+-e.width/2+e.width)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX+-e.width/2)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"uparrow":s="M "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX-e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+i.startX+" "+(i.startY-e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2+e.height)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"downarrow":s="M "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+i.startX+" "+(i.startY-e.height/2+e.height)+" L "+(i.startX-e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"leftarrow":s="M "+(i.startX-e.width/2+e.width)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2+e.width)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/2)+" L "+(i.startX-e.width/2)+" "+i.startY+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2+e.width)+" "+(i.startY+e.height/4)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"rightarrow":s="M "+(i.startX-e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/2)+" L "+(i.startX-e.width/2+e.width)+" "+i.startY+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2)+" "+(i.startY+e.height/4)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"pentagon":var h=Math.sqrt(e.height*e.height+e.width*e.width)/2,k=ej.EjSvgRender.utils._getStringBuilder();for(w=0;w<=5;w++){var st=w*72,it=Math.PI/180*st,rt=h*Math.cos(it),ut=h*Math.sin(it);w==0?k.append("M "+(i.startX+rt)+" "+(i.startY+ut)+" "):k.append("L "+(i.startX+rt)+" "+(i.startY+ut)+" ")}k.append("z");s=k.toString();o.direction=s;this.drawSvgShape(t,o);break;case"ellipse":n(c).css({width:t.ShapeSize.width,height:t.ShapeSize.height/2,"border-style":"solid",left:a+t.ShapeSize.height/2-t.Style.BorderWidth/2,top:i.startY+y.top-t.ShapeSize.height+4,"background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth,"-moz-border-radius":"50%","-webkit-border-radius":"50%","border-radius":"50%","border-box":"content-box"});break;case"horizline":n(c).css({width:t.ShapeSize.width,height:0,"border-style":"solid",left:a+t.ShapeSize.width/2,top:i.startY+y.top-1,"border-color":t.Style.BorderColor,"border-width":"2px","border-box":"content-box"});break;case"vertline":n(c).css({width:0,height:t.ShapeSize.height,"border-style":"solid",left:i.startX+y.left-1,top:p+t.ShapeSize.height/2-2,"border-color":t.Style.BorderColor,"border-width":"2px","border-box":"content-box"});break;default:n(c).css({width:t.ShapeSize.width,height:t.ShapeSize.height,"border-style":"solid","background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth,"border-radius":"50px"})}v[0].appendChild(c[0]);d=document.getElementById(this.svgObj.id+"_CrosshairGroup")||document.getElementById("chartContainer_"+this._rootId);d.appendChild(v[0])}},drawSvgShape:function(t,i){var f=document.getElementById(this._rootId+"_canvas"),e={left:0,top:0},o="http://www.w3.org/2000/svg",r=document.createElementNS(o,"svg"),u,s;r.setAttribute("id","mySVG");r.setAttribute("width",n(f).width());r.setAttribute("height",n(f).height());n(t.symbol).css({left:e.left+"px",top:e.top+"px"});u={id:"svgPath","fill-opacity":t.Style.Opacity,"stroke-width":t.Style.BorderWidth,fill:t.Style.Color,transform:i.rotate,stroke:t.Style.BorderColor};u.d=i.direction;s=document.createElementNS(o,"path");n(s).attr(u).appendTo(r);t.symbol[0].appendChild(r)},drawCircle:function(n,t){var r,i,u;n.lgndCtx?(u=this.lgndCtx,this.lgndCtx=t!=undefined?t:this.lgndCtx,this.lgndCtx.save(),this.lgndCtx.beginPath(),this.lgndCtx.arc(n.cx,n.cy,n.r,0,2*Math.PI),this.lgndCtx.fillStyle=n.fill,this.lgndCtx.globalAlpha=n.opacity,this.lgndCtx.fill(),this.lgndCtx.lineWidth=n["stroke-width"],this.lgndCtx.strokeStyle=n.stroke,this.lgndCtx.stroke(),this.lgndCtx.restore(),this.lgndCtx=u):(r=this.ctx,this.ctx=t!=undefined?t:this.ctx,this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.cx,n.cy,n.r,0,2*Math.PI),this.ctx.fillStyle=n.fill,this.ctx.globalAlpha=n.opacity,this.ctx.fill(),this.ctx.lineWidth=n["stroke-width"],i=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1,i&&this.ctx.setLineDash(i),this.ctx.strokeStyle=n.stroke,this.ctx.stroke(),this.ctx.restore(),this.ctx=r)},drawPolyline:function(n){var i,t;for(this.ctx.save(),this.ctx.beginPath(),i=n.points.split(" "),t=0;t<i.length-1;t++){var r=i[t].split(","),u=r[0],f=r[1];t==0?this.ctx.moveTo(u,f):this.ctx.lineTo(u,f)}this.ctx.lineWidth=n["stroke-width"];this.ctx.strokeStyle=n.stroke;this.ctx.stroke();this.ctx.restore()},drawPolygon:function(){},setFillAttribute:function(){},setStrokeAttribute:function(){},changePathValue:function(){},drawArc:function(){},changeVMLStyle:function(){},applyVMLStyle:function(){},drawEllipse:function(n,t){var f=this.ctx;this.ctx=t!=undefined?t:this.ctx;var i=Math.max(n.rx,n.ry),r=n.rx/i,u=n.ry/i;n.lgndCtx?(this.lgndCtx.save(),this.lgndCtx.beginPath(),this.lgndCtx.translate(n.rx,n.ry),this.lgndCtx.scale(r,u),this.lgndCtx.arc(n.cx-n.rx,n.cy*2-n.rx,n.rx,0,2*Math.PI,!1),this.lgndCtx.fillStyle=n.fill,this.lgndCtx.fill(),this.lgndCtx.restore(),this.lgndCtx.lineWidth=n["stroke-width"],this.lgndCtx.strokeStyle=n.stroke,this.lgndCtx.stroke(),this.lgndCtx.restore()):(this.ctx.save(),this.ctx.beginPath(),this.ctx.translate(n.cx,n.cy),this.ctx.save(),this.ctx.scale(r,u),this.ctx.arc(0,0,i,0,2*Math.PI,!1),this.ctx.fillStyle=n.fill,this.ctx.fill(),this.ctx.restore(),this.ctx.lineWidth=n["stroke-width"],this.ctx.strokeStyle=n.stroke,this.ctx.stroke(),this.ctx.restore(),this.ctx=f)},_getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},_setAttr:function(){},setSpanAttr:function(){},_textAttrReplace:function(){},drawImage:function(n){this.ctx.save();var t=new Image;t.src=n.href;this.ctx.drawImage(t,n.x,n.y,n.width,n.height);this.ctx.restore()},createDefs:function(){},createGroup:function(){},createText:function(t,i){var r=document.createElement("div");return n(r).css({transform:t.rotateAngle,"font-family":parseFloat(t["font-family"]),"font-size":parseFloat(t["font-size"])*1.1,position:"absolute"}),ej.util.isNullOrUndefined(i)||(r.textContent=i),r},drawAxesBoundsClipPath:function(n,t){var i=t},getAttrVal:function(){},hexFromRGB:function(){},createDelegate:function(){},drawClipPath:function(){},drawCircularClipPath:function(){},append:function(t,i){n(t).appendTo(i)},createLegendCanvas:function(n){return this.legendsvgObj=document.createElement("canvas"),this._rootId=jQuery(n).attr("id"),this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_canvas"),this.lgndCtx=this.legendsvgObj.getContext("2d"),this.legendsvgObj}}}(jQuery);ej.EjSvgRender=function(n){var t,i;if(this.svgLink="http://www.w3.org/2000/svg",this.svgObj=document.createElementNS(this.svgLink,"svg"),this._rootId=jQuery(n).attr("id"),t=this._rootId+"_svg",$(document).find("#"+t).length>0){i=0;do i++;while($(document).find("#"+this._rootId+"_svg"+i).length>0);t=this._rootId+"_svg"+i}this.svgObj.setAttribute("id",t)},function(n){function t(n,t,i,r){var u=r*Math.PI/180,f=n+i*Math.cos(u),e=t+i*Math.sin(u);return[f,e]}ej.EjSvgRender.prototype={drawPath:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"path");n(r).attr(t).appendTo(i)}},createLegendSvg:function(n){return this.svgLink="http://www.w3.org/2000/svg",this.legendsvgObj=document.createElementNS(this.svgLink,"svg"),this._rootId=jQuery(n).attr("id"),this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_svg"),this.legendsvgObj},drawPolyline:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"polyline");n(r).attr(t).appendTo(i)}},drawLine:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"line");n(r).attr(t);n(r).appendTo(i)}},drawPolygon:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"polygon");n(r).attr(t);n(r).appendTo(i)}},drawCircle:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"circle");n(r).attr(t).appendTo(i)}},drawEllipse:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"ellipse");n(r).attr(t).appendTo(i)}},drawRect:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"rect");n(r).attr(t).appendTo(i)}},drawCylinder:function(t,i,r){var k,et,a;if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var it=t.x,d=t.y,v=t.id,f=t.fill,ot=f,st=this.checkColorFormat(f);st||(f=ej.datavisualization.Chart.prototype.colorNameToHex(f));var c,l,y,p,s,e,w,g,rt=2,nt,b,ut=0,ft=0,tt={svgRenderer:this};if(r.isColumn==!0){var u=t.width/2,h=t.height,o=u/4;s=nt=it;e=d-o;b=e;c=2*u;l=0;y=0;p=h;w=s;g=e+h;ut=100;(r.stacking=!0)&&(r.isLastSeries||(e=b=d+o,p=h-u/2))}else{var o=t.height/2,h=t.width,u=o/4;e=b=d;s=nt=it+u;c=0;l=2*o;y=h;p=0;w=s+h;g=e;ft=100;(r.stacking=!0)&&(r.isLastSeries||(w=s+h-u*2,y=h-u*2))}for(delete t.x,delete t.y,delete t.width,delete t.height,delete t.isColumn;rt--;)direction="M"+s.toString()+","+e.toString(),direction+="a"+u.toString()+","+o.toString()+" 0 1,0 "+c.toString()+","+l.toString(),direction+="a"+u.toString()+","+o.toString()+" 0 1,0 "+(-1*c).toString()+","+(-1*l).toString(),t.d=direction,t.id=v+"_Region_"+rt,t.fill=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(f,tt),this.drawPath(t,i),s=w,e=g;direction="M"+nt.toString()+","+b.toString();direction+="a"+u.toString()+","+o.toString()+" 0 1,0 "+c.toString()+","+l.toString();direction+="l"+y.toString()+" "+p.toString();direction+="a"+u.toString()+","+o.toString()+" 0 1,1 "+(-1*c).toString()+","+(-1*l).toString()+" z";t.d=direction;t.id=v+"_Region_2";ot.indexOf("url")==-1&&(k=v.substring(0,v.indexOf("P")),n("#"+k).length==0&&(et={id:k,x1:"0%",y1:"0%",x2:ut.toString()+"%",y2:ft.toString()+"%"},a=[],a[0]={colorStop:"0%",color:f},a[1]={colorStop:"30%",color:ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(f,tt)},a[2]={colorStop:"70%",color:ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(f,tt)},a[3]={colorStop:"100%",color:f},this.drawGradient(et,a,i)),t.fill="url(#"+k+")");this.drawPath(t,i)}},createGradientElement:function(n,t,i,r,u,f,e){var o,s,h;return Object.prototype.toString.call(t)=="[object Array]"?(s={id:this.svgObj.id+"_"+n+"Gradient",x1:i+"%",y1:r+"%",x2:u+"%",y2:f+"%"},h="#"+this.svgObj.id+"_"+n+"Gradient",this.drawGradient(s,t,e),o="url(#"+this.svgObj.id+"_"+n+"Gradient)"):o=t,o},drawGradient:function(t,i,r){var o=this.createDefs(),f=document.createElementNS(this.svgLink,"linearGradient"),u,e;for(n(f).attr(t),u=0;u<i.length;u++)e=document.createElementNS(this.svgLink,"stop"),n(e).attr({offset:i[u].colorStop,"stop-color":i[u].color,"stop-opacity":1}),n(e).appendTo(f);n(f).appendTo(o);n(o).appendTo(r)},drawText:function(t,i,r,u){var e,o,h,f,s,c;if(n("#"+t.id).length>0)this._textAttrReplace(t,i,u);else{if(e=document.createElementNS(this.svgLink,"text"),o=n(e),jQuery.type(i)=="array")for(h=0,o.attr(t),f=0;f<i.length;f++)s=document.createElementNS(this.svgLink,"tspan"),s.textContent=i[f],n(s).attr({x:t.x,dy:h}),n(s).appendTo(e),c=ej.EjSvgRender.utils._measureText(i[f],null,u),h=c.height+2;else e.textContent=i,o.attr(t);o.appendTo(r)}},_textAttrReplace:function(t,i,r){var f,e,u,o,s;if(n("#"+t.id).attr(t),jQuery.type(i)=="array")if(f=n("#"+t.id).children("tspan"),e=0,f.length>0&&f.length==i.length)for(u=0;u<f.length;u++)o=f[u],n(o).attr({x:t.x,dy:e}),o.textContent=i[u],s=ej.EjSvgRender.utils._measureText(i[u],null,r),e=s.height+2;else n("#"+t.id).remove(),this.drawText(t,i,this.gTransToolEle,r);else n("#"+t.id).text(i)},drawImage:function(t,i){var r=document.createElementNS(this.svgLink,"image");r.setAttributeNS(null,"height",t.height);r.setAttributeNS(null,"width",t.width);r.setAttributeNS("http://www.w3.org/1999/xlink","href",t.href);r.setAttributeNS(null,"x",t.x);r.setAttributeNS(null,"y",t.y);r.setAttributeNS(null,"id",t.id);r.setAttributeNS(null,"visibility",t.visibility);ej.util.isNullOrUndefined(t.clippath)&&ej.util.isNullOrUndefined(t.preserveAspectRatio)||(r.setAttributeNS(null,"clip-path",t.clippath),r.setAttributeNS(null,"preserveAspectRatio",t.preserveAspectRatio));n(r).appendTo(i)},createDefs:function(){return document.createElementNS(this.svgLink,"defs")},createClipPath:function(t){var i=document.createElementNS(this.svgLink,"clipPath");return n(i).attr(t),i},createForeignObject:function(t){var i=document.createElementNS(this.svgLink,"foreignObject");return n(i).attr(t),i},createGroup:function(t){var i=document.createElementNS(this.svgLink,"g");return n(i).attr(t),i},createPattern:function(n,t){var r=document.createElementNS(this.svgLink,t);for(var i in n)n.hasOwnProperty(i)&&r.setAttribute(i,n[i]);return r},createText:function(t,i){var r=document.createElementNS(this.svgLink,"text");return n(r).attr(t),ej.util.isNullOrUndefined(i)||(r.textContent=i),r},createPath:function(t){var i=document.createElementNS(this.svgLink,"path");return n(i).attr(t),i},createCircle:function(t){var i=document.createElementNS(this.svgLink,"circle");return n(i).attr(t),i},createLine:function(t){var i=document.createElementNS(this.svgLink,"line");return n(i).attr(t),i},_getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},hexFromRGB:function(t){var r=t.R,u=t.G,f=t.B,i;return t.A?"rgba("+r.toString()+","+u.toString()+","+f.toString()+","+t.A+")":(i=[r.toString(16),u.toString(16),f.toString(16)],n.each(i,function(n,t){t.length===1&&(i[n]="0"+t)}),"#"+i.join("").toUpperCase())},checkColorFormat:function(n){return/(rgba?\((?:\d{1,3}[,\)]){3}(?:\d+\.\d+\))?)|(^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$)/gmi.test(n)},hexToRGB:function(n){var i=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.test(n),t;return i==!0?(t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(n),t?{R:parseInt(t[1]),G:parseInt(t[2]),B:parseInt(t[3]),A:t[4]}:null):(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),t?{R:parseInt(t[1],16),G:parseInt(t[2],16),B:parseInt(t[3],16)}:null)},createDelegate:function(n,t){return function(i){t.apply(n,[i,this])}},drawClipPath:function(t,i){if(n(i).find("#"+t.id).length>0)n(i).find("#"+t.id).attr(t);else{var r=this.createDefs(),u=this.createClipPath({id:t.id});this.drawRect(t,u);this.append(u,r);this.append(r,i)}},drawCircularClipPath:function(n,t){var i=this.createDefs(),r=this.createClipPath({id:n.id});this.drawCircle(n,r);this.append(r,i);this.append(i,t)},append:function(t,i){n(t).appendTo(i)},_setAttr:function(t,i){n(t).attr(i)}};ej.EjSvgRender.commonChartEventArgs={cancel:!1,data:null};ej.EjSvgRender.utils={_decimalPlaces:function(n){var t=(""+n).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},_getLabelContent:function(n,t,i){switch(t._categoryValueType){case"number":var r=ej.util.isNullOrUndefined(t.labelFormat)?null:t.labelFormat.match("{value}");return ej.util.isNullOrUndefined(t.labelFormat)?t.labels[Math.floor(n)]:r!=null?t.labelFormat.replace("{value}",t.labels[Math.floor(n)]):ej.format(t.labels[Math.floor(n)],t.labelFormat,i);case"date":return ej.format(new Date(t.labels[Math.floor(n)]),ej.util.isNullOrUndefined(t.labelFormat)?"dd/MM/yyyy":t.labelFormat,i);case"string":return t.labels[Math.floor(n)];default:return""}},_getSeriesTemplateSize:function(t,i,r,u,f){var t,i,a=f.model.AreaType,o=f._id,v=n.inArray(r,f.model._visibleSeries),s,h,e,c,l;s=n("#template_group_"+o).length!=0?n("#template_group_"+o):n("<div><\/div>").attr("id","template_group_"+o);s.css("position","relative").css("z-index",1e3);h=n("#"+r.marker.dataLabel.template).clone();n(h).attr("id",r.marker.dataLabel.template+"_"+v+"_"+i+"_"+o);e=n(h);e.css("position","absolute");t.count=1;c={series:r,point:t};e.html(e.html().parseTemplate(c));l=a=="cartesianaxes"||!r.enableAnimation||r.type.toLowerCase()=="pyramid"||r.type.toLowerCase()=="funnel"?"block":"none";e.css("display",l).appendTo(n(s));n(s).appendTo("#"+o);t.size={height:e.height(),width:e.width()};u?((ej.util.isNullOrUndefined(r.LeftLabelMaxHeight)||r.LeftLabelMaxHeight<t.size.height)&&(r.LeftLabelMaxHeight=t.size.height),(ej.util.isNullOrUndefined(r.LeftLabelMaxWidth)||r.LeftLabelMaxWidth<t.size.width)&&(r.LeftLabelMaxWidth=t.size.width)):((ej.util.isNullOrUndefined(r.RightLabelMaxHeight)||r.RightLabelMaxHeight<t.size.height)&&(r.RightLabelMaxHeight=t.size.height),(ej.util.isNullOrUndefined(r.RightLabelMaxWidth)||r.RightLabelMaxWidth<t.size.width)&&(r.RightLabelMaxWidth=t.size.width))},getMinPointsDelta:function(t,i,r){var f=i,u=Number.MAX_VALUE;return n.each(f.model._visibleSeries,function(i,e){var o,h,s;e.visibility.toLowerCase()=="visible"&&t.name==e._xAxisName&&(o=ej.DataManager(e.points,ej.Query().sortBy("xValue")).executeLocal(),o.length!=1||f.currentSeries&&f.currentSeries._yAxisName.toLowerCase()!=e._yAxisName.toLowerCase()?n.each(o,function(n,t){if(n>0&&t.xValue){var i=t.xValue-o[n-1].xValue;i!=0&&(u=Math.min(u,i))}}):(h=ej.util.isNullOrUndefined(r)?e.xAxis.visibleRange.min:r,s=o[0].xValue-h,s!=0&&(u=Math.min(u,s))))}),u==Number.MAX_VALUE&&(u=1),u},_getSeriesMaxLabel:function(t){var i={width:0,height:0},o=n(this.svgObject).width(),e=[],f,r,s,u;if(t.labels.length>0){for(r=0;r<t.labels.length;r++)u=this._measureText(t.visibleLabels[r],o,t.marker.dataLabel.font),i.width<u.width&&(i.width=u.width),i.height<u.height&&(i.height=u.height);t.LabelMaxHeight=i.height;t.LabelMaxWidth=i.width}else for(e.push(t.rightsidePoints),e.push(t.leftsidePoints),f=0;f<e.length;f++){for(r=0;r<e[f].length;r++)s=e[f][r].text?e[f][r].text:e[f][r].y,u=this._measureText(s,o,t.marker.dataLabel.font),i.width<u.width&&(i.width=u.width),i.height<u.height&&(i.height=u.height);f==0?(t.RightLabelMaxHeight=i.height,t.RightLabelMaxWidth=i.width):(t.LeftLabelMaxHeight=i.height,t.LeftLabelMaxWidth=i.width)}},_getMaxLabelWidth:function(t,r){var f,b,d,et,g,nt,o,ht,tt,y,k,p,it,ot,gt,ni;this.chartObj=r;var u={width:0,height:0,maxHeight:0,maxWidth:0},h="",yt=1,ti=r.svgRenderer.vmlNamespace,c=t.visibleRange,w=t.labelIntersectAction&&!r.model.enable3D?t.labelIntersectAction.toLowerCase():"",ut=t.labelPlacement,ii=t.opposedPosition,st=t.orientation.toLowerCase(),pt=r.model.requireInvertedAxes?st=="vertical":st=="horizontal",wt=t.roundingPlaces,l=t.labelRotation,st=t.orientation,v=0,s=[],ft=t.visibleLabels,ri=ft.length;if(t.visible){for(f=0;f<ri;f++)t.visibleLabels[f].y=0,b=this._measureText(t.visibleLabels[f].Text,n(this.svgObject).width(),t.font,t.labelRotation),u.width<b.width&&(u.width=b.width,h=t.visibleLabels[f].Text),u.height<b.height&&(u.height=b.height);if(t.enableTrim&&(d=t.maximumLabelWidth,u.width=u.width>d?d:u.width),u.rows=1,u.maxWidth=u.width,u.maxHeight=u.height,!ti&&(l||w)&&(et=0,w=="rotate45"?et=45:w=="rotate90"&&(et=90),l=l!=null||st=="vertical"?l:et,t.rotationValue=l,l)){if(h=ej.isNullOrUndefined(h)?"":h,labeltextWidth=this._measureText(h,n(this.svgObject).width(),t.font,t.labelRotation),t.enableTrim&&labeltextWidth.width>d&&h!="")for(o=h,g=1;g<o.toString().length;g++)if(o=o.toString().substring(0,g)+"... ",nt=this._measureText(o,n(r.svgObject).width(),t.font),nt.width>=d){o=o.toString().substring(0,g-1)+"... ";h=o;break}maxSize=this.rotatedLabel(t,r,l,h);t.labelIntersectAction&&t.labelIntersectAction.toLowerCase()=="multiplerows"&&(v=u.height+maxSize.height);u.height=maxSize.height;u.width=maxSize.width}if(t.labelIntersectAction)if(w=="wrap"||w=="wrapbyword")ut=ut?ut:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,ut.toLowerCase()=="betweenticks"?(tt=1+(t.labels.length>1?-.5:0),tt=wt?parseFloat(tt.toFixed(wt)):parseFloat(tt.toFixed(ej.EjSvgRender.utils._decimalPlaces(c.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(c.interval))),ht=Math.ceil((tt-c.min)/(c.max-c.min)*t.length)):ht=Math.ceil(t.length/ft.length),y=Math.round(u.width/ht),u.rows=l?y-yt:y+yt,u.height=u.height+y*u.height;else if(w=="multiplerows"){var ui=r._getLegendSpace(),fi=r.model.border.width,vi=r.model._axes[1],ei=n(r.svgObject).width()-r.model.margin.left-r.model.margin.right,oi=t.title.text==""||!t.visible?0:this._measureText(t.title.text,ei,t.title.font).height+2*r.model.elementSpacing,si=r.model.elementSpacing+oi+t.majorTickLines.size+t.axisLine.width,hi=r._getYValues(r.model._visibleSeries[0].points),ci=Math.max.apply(Math,hi),bt=r.model._axes[1],b=this._measureText(ci,n(this.svgObject).width(),bt.font,bt.labelRotation),li=ui.rightLegendWidth+si+b.width+r.model.margin.right+r.model.margin.left+2*fi,kt=n(r.svgObject).width()-li;if(pt){for(k=0,f=0;f<ft.length;f++){var e=ft[f],ct=!1,dt=!1;v=Math.max(v,k);k=e.y=u.height;var o=this._measureText(e.Text,n(this.svgObject).width(),t.font),nt=o.width,a=o.height,lt=Math.abs(Math.floor((e.Value-c.min)/c.delta*kt));for(p=0;p<s.length&&!ct;p++)for(it=0;s[p]&&it<s[p].length;it++){var rt=s[p][it],at=Math.abs(Math.floor((rt.Value-c.min)/c.delta*kt)),ai=this._measureText(rt.Text,n(this.svgObject).width(),t.font).width,vt=at+ai/2;if(vt>lt-nt/2&&!ej.util.isNullOrUndefined(e.y))k=e.y+a,e.y+=a,p+1==s.length&&(ct=!0);else if(it+1==s[p].length){ct=!0;break}}e.y=k;y=k/a-1;s[y]==undefined&&(s[y]=[]);s[y].push(e)}v=s.length*a;u.height=u.height>v?u.height:v;u.rows=ii?Math.round((v+a)/a):Math.round(v/a);u.rows=l?u.rows-1:u.rows;u.rows<1&&(u.rows=1)}if(!pt){for(ot=0,f=0;f<t.visibleLabels.length;f++){for(e=t.visibleLabels[f],o=this._measureText(e.Text,n(this.svgObject).width(),t.font),nt=o.width,a=o.height,lt=Math.abs(Math.floor((e.Value-t.visibleRange.min)/t.visibleRange.delta*t.length)),i=0;i<f;i++)rt=t.visibleLabels[i],at=Math.abs(Math.floor((rt.Value-t.visibleRange.min)/t.visibleRange.delta*t.length)),gt=this._measureText(rt.Text,n(this.svgObject).width(),t.font).height,vt=at+gt/2,vt>lt-a/2&&t.visibleLabels[i].y==e.y&&(ot=e.y+nt,e.y=ot,dt=!0);ni=ot}u.width=u.width+ni+(dt?5:0)}}}return u},rotatedLabel:function(n,t,i,r){var f={"font-size":n.font.size,transform:"rotate("+i+",0,0)","font-family":n.font.fontFamily,"font-style":n.font.fontStyle,rotateAngle:"rotate("+i+"deg)","text-anchor":"middle"},u=t.svgRenderer.createText(f,r),e=Math.ceil(this._measureBounds(u,t).height),o=Math.ceil(this._measureBounds(u,t).width);return{height:e,width:o}},_getTransform:function(n,t,i){var r,u,f,e;return i?(r=t.x,u=n.y,f=t.width,e=n.height):(r=n.x,u=t.y,f=n.width,e=t.height),{x:r,y:u,width:f,height:e}},_calculateroundedCorner:function(n,t,i,r,u){var f=n.x,e=n.y,h=5,c=this.chartObj.model.enableCanvasRendering&&!u?h/4:0,o=n.width,s=n.height,v=n.cornerRadius,a,y,p,w,l;return typeof v!="object"?a=y=p=w=v:(a=v.topLeft,y=v.bottomLeft,p=v.topRight,w=v.bottomRight),a=ej.util.isNullOrUndefined(n.rx)?a:n.rx,y=ej.util.isNullOrUndefined(n.rx)?y:n.rx,p=ej.util.isNullOrUndefined(n.ry)?p:n.ry,w=ej.util.isNullOrUndefined(n.ry)?w:n.ry,l="M "+f+" "+(a+e)+" Q "+f+" "+e+" "+(f+a)+" "+e+" ",t&&i=="top"&&(l+="L "+(f+o/2-h/2+c)+" "+e+" L "+(f+o/2+c-r)+" "+(e-h)+" L "+(f+o/2+h/2+c)+" "+e+" "),l+="L "+(f+o-p)+" "+e+" Q "+(f+o)+" "+e+" "+(f+o)+" "+(e+p)+" ",t&&i=="right"&&(l+="L "+(f+o)+" "+(e+s/2-h/2+c)+" L "+(f+o+h)+" "+(e+s/2+c-r)+" L "+(f+o)+" "+(e+s/2+h/2+c)+" "),l+="L "+(f+o)+" "+(e+s-w)+" Q "+(f+o)+" "+(e+s)+" "+(f+o-w)+" "+(e+s)+" ",t&&i=="bottom"&&(l+="L "+(f+o/2-h/2+c)+" "+(e+s)+" L "+(f+o/2+c-r)+" "+(e+s+h)+" L "+(f+o/2+h/2+c)+" "+(e+s)+" "),l+="L "+(f+y)+" "+(e+s)+" Q "+f+" "+(e+s)+" "+f+" "+(e+s-y)+" ",t&&i=="left"&&(l+="L "+f+" "+(e+s/2-h/2+c)+" L "+(f-h)+" "+(e+s/2+c-r)+" L "+f+" "+(e+s/2+h/2+c)+" "),l+("L "+f+" "+(a+e)+" z")},browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},_measureText:function(t,i,r){var s=n(document).find("#measureTex"),u,e,o,f,v;n("#measureTex").css("display","block");s.length==0?(u=document.createElement("text"),n(u).attr({id:"measureTex"}),document.body.appendChild(u)):u=s[0];var h=null,c=null,l=null,a=null;if(typeof t=="string"&&(t.indexOf("<")>-1||t.indexOf(">")>-1)){for(e=t.split(" "),o=0;o<e.length;o++)e[o].indexOf("<br/>")==-1&&(e[o]=e[o].replace(/[<>]/g,"&"));t=e.join(" ")}return u.innerHTML=t,r!=undefined&&r.size==undefined&&(f=r,f=f.split(" "),h=f[0],c=f[1],l=f[2],a=f[3]),r!=null&&(u.style.fontSize=r.size>0?r.size+"px":r.size?r.size:c,u.style.fontStyle&&(u.style.fontStyle=r.fontStyle?r.fontStyle:h),u.style.fontFamily=r.fontFamily?r.fontFamily:l,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(u.style.fontWeight=r.fontWeight?r.fontWeight:a)),u.style.backgroundColor="white",u.style.position="absolute",u.style.top=-100,u.style.left=0,u.style.visibility="hidden",u.style.whiteSpace="nowrap",i&&(u.style.maxwidth=i+"px"),v={width:u.offsetWidth,height:u.offsetHeight},n("#measureTex").css("display","none"),v},_trimText:function(n,t,i){var f,r,e,u;for(r=n.toString(),e=r.length,u=1;u<e;u++)if(r=n.substring(0,u)+"...",f=ej.EjSvgRender.utils._measureText(r,null,i).width,f>=t)return r.substring(0,u-1)+"... ";return n},_measureBounds:function(t,i){i.model.enableCanvasRendering?n(document.body).append(t):(i.svgRenderer.append(t,i.svgObject),i.svgRenderer.append(i.svgObject,i.element));var r=t.getBoundingClientRect(),u={left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.right-r.left,height:r.bottom-r.top};return n(t).remove(),u},_drawAxesBoundsClipPath:function(t,i,r){var u,s=n(t),f=this._getTransform(i.xAxis,i.yAxis,r.model.requireInvertedAxes),h=r.model.AreaType=="polaraxes"?n(r.svgObject).width():f.width,c=r.model.AreaType=="polaraxes"?n(r.svgObject).height():f.height,e=r.model.requireInvertedAxes?i.yAxis.plotOffset:i.xAxis.plotOffset,o=r.model.requireInvertedAxes?i.xAxis.plotOffset:i.yAxis.plotOffset;r.model.AreaType=="polaraxes"?(u={id:t?t.id+"_ClipRect":"",cx:r.model.centerX,cy:r.model.centerY,r:r.model.Radius,fill:"white","stroke-width":1,stroke:"transparent"},r.svgRenderer.drawCircularClipPath(u,t)):(u={id:t?t.id+"_ClipRect":"",x:0-e,y:0-o,width:h+2*e,height:c+2*o,fill:"white","stroke-width":1,stroke:"transparent"},r.svgRenderer.drawClipPath(u,t));s.attr("clip-path","url(#"+u.id+")")},_getStringBuilder:function(){var n=[],t=0;return{append:function(i){return n[t++]=i,this},remove:function(t,i){return n.splice(t,i||1),this},insert:function(t,i){return n.splice(t,0,i),this},toString:function(t){return n.join(t||"")}}},_addRegion:function(t,i,r,u,f){var s=r.type,e=n.inArray(r,t.model._visibleSeries),o;e>=0&&(o={SeriesIndex:e,Region:{PointIndex:f,Bounds:i},type:s},t.model.chartRegions.push(o))},AddRegion:function(n,t,i){if(i){var r={isStripLine:i,Region:{Bounds:t}};n.model.chartRegions.push(r)}},_getSvgXY:function(n,t,i,r){var u,f;return r.model.requireInvertedAxes?(u=n+i.yAxis.x,f=t+i.xAxis.y):(u=n+i.xAxis.x,f=t+i.yAxis.y),{X:u,Y:f}},_getPoint:function(n,t){var f=n.xValue,e=t.type=="boxandwhisker"?n.YValues:n.YValues[0],o=t._isTransposed?t.xAxis.height:t.xAxis.width,i,r,u;return yLength=t._isTransposed?t.yAxis.width:t.yAxis.height,n.location={},t._hiloTypes&&(i=n.YValues[1],i=t.yAxis._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(i==0?1:i,t.xAxis.logBase):i,i=this._getPointXY(i,t.yAxis.visibleRange,t.yAxis.isInversed),n.location.low=(t._isTransposed?i:1-i)*yLength),r=t.xAxis._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(f==0?1:f,t.xAxis.logBase):f,u=t.yAxis._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(e==0?1:e,t.xAxis.logBase):e,r=this._getPointXY(r,t.xAxis.visibleRange,t.xAxis.isInversed),u=this._getPointXY(u,t.yAxis.visibleRange,t.yAxis.isInversed),n.location.X=t._isTransposed?u*yLength:r*o,n.location.Y=t._isTransposed?(1-r)*o:(1-u)*yLength,n.location},_getPointXY:function(n,t,i){var r=0;return r=(n-t.min)/t.delta,i?1-r:r},_dateTimeLabelFormat:function(n){var t="d";return n.toLowerCase()=="years"?t="MMM, yyyy":n.toLowerCase()=="months"?t="dd, MMM":n.toLowerCase()=="days"?t="MM/dd/yyyy":n.toLowerCase()=="hours"?t="dd, hh:mm":n.toLowerCase()=="seconds"||n.toLowerCase()=="minutes"?t="hh:mm:ss":n.toLowerCase()=="milliseconds"&&(t="hh:mm:ss:tt"),t},_getFontString:function(n){return n==null&&(n={}),n.FontFamily||(n.FontFamily="Arial"),n.FontStyle||(n.FontStyle="Normal"),n.Size||(n.Size="12px"),n.FontStyle+" "+n.Size+" "+n.FontFamily},_valueToVector:function(n,t){return this._coefficientToVector(this._valueToPolarCoefficient(n,t))},TransformToVisible:function(n,t,i,r){t=n.xAxis._valueType=="logarithmic"&&t>0?Math.log(t,n.xAxis.logBase):t;i=n.xAxis._valueType=="logarithmic"&&i>0?Math.log(i,n.yAxis.logBase):i;var u=r.model.Radius*this._valueToCoefficient(n.yAxis,i),f=this._valueToVector(n.xAxis,t);return{X:r.model.centerX+u*f.X,Y:r.model.centerY+u*f.Y}},Transform3DToVisible:function(n,t,i,r){var u,f;if(n.xAxis!=null&&n.yAxis!=null){if(u=n.xAxis._valueType.toLowerCase(),f=u=="logarithmic"?!0:!1,t=t=f&&t>0?math.log(t,xlogarithmicBase):t,i=i,r.model.requireInvertedAxes){var e=r.model.m_AreaBounds.X,o=r.model.m_AreaBounds.Y,s=e+n.yAxis.width*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,i,r),h=o+n.xAxis.height*(1-ej.EjSvgRender.utils._valueToCoefficient(n.xAxis,t,r));return{X:s,Y:h}}var e=n.xAxis.x,o=n.yAxis.y,t=e+Math.round(n.xAxis.width*ej.EjSvgRender.utils._valueToCoefficient(n.xAxis,t,r)),i=o+Math.round(n.yAxis.height*(1-ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,i,r)));return{X:t,Y:i}}return new Point(0,0)},_valueToPolarCoefficient:function(n,t){var u=n.visibleRange.min,i,r;return n._valueType!="category"?(i=n.visibleRange.max-n.visibleRange.interval-n.visibleRange.min,r=n.visibleLabels.length-1):(i=n.visibleRange.delta,r=n.visibleLabels.length),result=(t-u)/i,result*=1-1/r,n.isInversed?result:1-result},_coefficientToVector:function(n){var t=Math.PI*(1.5-2*n);return{X:Math.cos(t),Y:Math.sin(t)}},_valueToCoefficient:function(n,t,i){var r;return r=i&&i.model.AreaType=="polaraxes"?t:n._valueType&&n._valueType.toLowerCase()=="logarithmic"?ej.EjSvgRender.utils._logBase(t==0?1:t,n.logBase):t,r=(r-n.visibleRange.min)/n.visibleRange.delta,n.isInversed?1-r:r},_getBoundingClientRect:function(t,i,r,u){var f=t.getBoundingClientRect(),s=n("#"+i.svgObject.id)[0].getBoundingClientRect(),e,o,h,c;return u?(e=this._getTransform(r.xAxis,r.yAxis,!0).x,o=this._getTransform(r.xAxis,r.yAxis,!0).y):(e=this._getTransform(r.xAxis,r.yAxis,!1).x,o=this._getTransform(r.xAxis,r.yAxis,!1).y),h=f.left-(e+s.left),c=f.top-(o+s.top),{x:h,y:c,width:f.right-f.left,height:f.bottom-f.top}},_minMax:function(n,t,i){return n>i?i:n<t?t:n},_inside:function(n,t){return n===""?!1:n<=t.max&&n>=t.min},_logBase:function(n,t){return Math.log(n)/Math.log(t)},_correctRect:function(n,t,i,r){return{X:Math.min(n,i),Y:Math.min(t,r),Width:Math.abs(i-n),Height:Math.abs(r-t)}},_getValuebyPoint:function(n,t,i){var f=this.chartObj.model.requireInvertedAxes?i.xAxis.height:i.xAxis.width,e=this.chartObj.model.requireInvertedAxes?i.yAxis.width:i.yAxis.height,r=i.xAxis.isInversed?1-n/f:n/f,u=i.yAxis.isInversed?1-t/e:t/e;return r=r*i.xAxis.visibleRange.delta+i.xAxis.visibleRange.min,u=u*i.yAxis.visibleRange.delta+i.yAxis.visibleRange.min,r=i.xAxis._valueType=="logarithmic"?Math.pow(i.xAxis.logBase,r):r,u=i.yAxis._valueType=="logarithmic"?Math.pow(i.yAxis.logBase,u):u,{PointX:r,PointY:u}}};ej.EjSvgRender.chartTransform3D={ToRadial:Math.PI/180,transform3D:function(n){return this.vector||(this.vector=new(new ej.Ej3DRender).vector3D,this.matrixobj=new(new ej.Ej3DRender).matrix3D,this.bsptreeobj=new(new ej.Ej3DRender).BSPTreeBuilder,this.polygon=new(new ej.Ej3DRender).polygon3D),{mViewport:n,Rotation:0,Tilt:0,Depth:0,PerspectiveAngle:0,needUpdate:!0,centeredMatrix:this.matrixobj.getIdentity(),Perspective:this.matrixobj.getIdentity(),resultMatrix:this.matrixobj.getIdentity(),viewMatrix:this.matrixobj.getIdentity(),Depth:0}},transform:function(n){this.setCenter(this.vector.vector3D(n.mViewport.Width/2,n.mViewport.Height/2,n.Depth/2),n);this.setViewMatrix(this.matrixobj.transform(0,0,n.Depth),n);this.setViewMatrix(this.matrixobj.getMatrixMultiplication(n.viewMatrix,this.matrixobj.turn(-this.ToRadial*n.Rotation)),n);this.setViewMatrix(this.matrixobj.getMatrixMultiplication(n.viewMatrix,this.matrixobj.tilt(-this.ToRadial*n.Tilt)),n);this.updatePerspective(n.PerspectiveAngle,n);n.needUpdate=!0},updatePerspective:function(n,t){var i=(t.mViewport.Width+t.mViewport.Height)*Math.tan(this.degreeToRadianConverter((180-Math.abs(n%181))/2))+t.Depth/1;t.Perspective[0][0]=i;t.Perspective[1][1]=i;t.Perspective[2][3]=1;t.Perspective[3][3]=i},degreeToRadianConverter:function(n){return n*Math.PI/180},toScreen:function(n,t,i,r){var i=i?i:this.result;return r?(this.matrixobj=r,n=r.getMatrixVectorMutiple(i(t,r),n)):n=this.matrixobj.getMatrixVectorMutiple(i(t),n),{x:n.x,y:n.y}},setViewMatrix:function(n,t){t.viewMatrix!=n&&(t.viewMatrix=n,t.needUpdate=!0)},setCenteredMatrix:function(n,t){t.viewMatrix!=n&&(t.centeredMatrix=n,t.needUpdate=!0)},result:function(n,t){return(this.matrixobj||(this.matrixobj=t),!n.needUpdate)?n.resultMatrix:(n.resultMatrix=this.matrixobj.getMatrixMultiplication(this.matrixobj.getInvertal(n.centeredMatrix),n.Perspective),n.resultMatrix=this.matrixobj.getMatrixMultiplication(n.resultMatrix,n.viewMatrix),n.resultMatrix=this.matrixobj.getMatrixMultiplication(n.resultMatrix,n.centeredMatrix),n.needUpdate=!1,n.resultMatrix)},setCenter:function(n,t){t.centeredMatrix=this.matrixobj.transform(-n.x,-n.y,-n.z);t.needUpdate=!0},toPlane:function(n,t,i){var r=this.vector.vector3D(n.x,n.y,0),u=this.vector.vector3DPlus(r,vector.vector3D(0,0,1));return r=this.vector.vector3DMultiply(i.centeredMatrix,r),u=this.vector.vector3DMultiply(i.centeredMatrix,u),r=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.Perspective),r),u=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.Perspective),u),r=this.polygon.getPoint(r,this.vector.vector3DMinus(u-r)),r=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.viewMatrix),r),this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.centeredMatrix),r)}};ej.EjSvgRender.chartSymbol={_drawSeriesType:function(n,t,i){var r=i.model.series[t.SeriesIndex].type.toLowerCase(),u=i.legendItem.drawType;r=ej.util.isNullOrUndefined(u)?r:u;switch(r){case ej.datavisualization.Chart.Type.Line:return ej.util.isNullOrUndefined(u)?this._drawLine(n,t,i,i.gLegendItemEle):this._drawStraightLine(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StepLine:return this._drawStepLine(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StackingArea:case ej.datavisualization.Chart.Type.StackingArea100:case ej.datavisualization.Chart.Type.Area:case ej.datavisualization.Chart.Type.RangeArea:return this._drawArea(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StepArea:return this._drawStepArea(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Bar:case ej.datavisualization.Chart.Type.StackingBar100:case ej.datavisualization.Chart.Type.StackingBar:return this._drawBar(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Pie:return this._drawPie(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Doughnut:return this._drawDoughnut(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Hilo:return this._drawHilo(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.HiloOpenClose:return this._drawHiloOpenClose(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Candle:return this._drawCandle(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Pyramid:return this._drawPyramid(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Funnel:return this._drawFunnel(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Spline:return this._drawSpline(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.SplineArea:return this._drawSplineArea(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.RangeColumn:return this._drawRangeColumn(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Bubble:case ej.datavisualization.Chart.Type.Scatter:return this._drawCircle(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Column:case ej.datavisualization.Chart.Type.StackingColumn:case ej.datavisualization.Chart.Type.StackingColumn100:case ej.datavisualization.Chart.Type.Waterfall:return this._drawColumn(n,t,i,i.gLegendItemEle);default:return this._drawRectangle(n,t,i,i.gLegendItemEle)}},_drawCircle:function(n,t,i,r){var o=i.svgRenderer,h=i.svgObject,f=t.ShapeSize,e=Math.sqrt(f.height*f.height+f.width*f.width)/2,u=t.Style,s={id:t.ID,cx:n.startX,cy:n.startY,r:e,fill:u.Color,"stroke-width":u.BorderWidth,stroke:u.BorderColor,opacity:u.Opacity,visibility:u.Visibility,lgndCtx:t.context};return o.drawCircle(s,r),n.startX-e},_drawLeftArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2+u.width)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2+u.width)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX-u.width/2)+" "+n.startY+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2+u.width)+" "+(n.startY+u.height/4)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawRightArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX-u.width/2+u.width)+" "+n.startY+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2)+" "+(n.startY+u.height/4)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawUpArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX-u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+n.startX+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2+u.height)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawDownArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+n.startX+" "+(n.startY-u.height/2+u.height)+" L "+(n.startX-u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawCross:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+u.width/2)+" "+n.startY+" M "+n.startX+" "+(n.startY+u.height/2)+" L "+n.startX+" "+(n.startY+-u.height/2);e={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawHorizLine:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+u.width/2)+" "+n.startY;e={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawVertLine:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+n.startX+" "+(n.startY+u.height/2)+" L "+n.startX+" "+(n.startY+-u.height/2);e={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawTriangle:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+(n.startY+u.height/2)+" L "+n.startX+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawInvertedTriangle:function(n,t,i,r){var f=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,e="M "+(n.startX+u.width/2)+" "+(n.startY-u.height/2)+" L "+n.startX+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width/2)+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY-u.height/2)+" z";var h=n.startX,c=n.startY,o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:e};f.drawPath(o,r)},_drawHexagon:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+-u.width/4)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/4)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+n.startY+" L "+(n.startX+u.width/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+n.startY+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawWedge:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width)+" "+n.startY+" L "+(n.startX+u.width)+" "+(n.startY+-u.height/2)+" L "+(n.startX+3*(u.width/4))+" "+n.startY+" L "+(n.startX+u.width)+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width)+" "+n.startY+" z";e={"stroke-linecap":"miter","stroke-miterlimit":u.width/4,id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawPentagon:function(n,t,i,r){for(var l,a,v=i.svgRenderer,p=i.svgObject,u=t.ShapeSize,o=Math.sqrt(u.height*u.height+u.width*u.width)/2,f=ej.EjSvgRender.utils._getStringBuilder(),e=0;e<=5;e++){var y=e*72,s=Math.PI/180*y,h=o*Math.cos(s),c=o*Math.sin(s);e==0?f.append("M "+(n.startX+h)+" "+(n.startY+c)+" "):f.append("L "+(n.startX+h)+" "+(n.startY+c)+" ")}f.append("z");l=f.toString();a={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:l};v.drawPath(a,r)},_drawStar:function(n,t,i,r){var o=i.svgRenderer,u=t.ShapeSize,s=i.svgObject,f,e;f="M "+(n.startX+u.width/3)+" "+(n.startY+-u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/6)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/6)+" L "+(n.startX+-u.width/3)+" "+(n.startY+-u.height/2)+" L "+n.startX+" "+(n.startY+u.height/2)+" L "+(n.startX+u.width/3)+" "+(n.startY+-u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawRectangle:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawTrapezoid:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX+-u.width/2+u.width)+" "+(n.startY+-u.height/2)+" L "+(n.startX+-u.width/2+u.width)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX+-u.width/2)+" "+n.startY+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawDiamond:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+n.startX+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+n.startY+" L "+n.startX+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+n.startY+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawEllipse:function(n,t,i,r){var f=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,e=n.startX,o=n.startY,s={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,cx:e,cy:o,rx:u.width,ry:u.height/2};f.drawEllipse(s,r)},_drawImage:function(n,t,i,r){var f=i.svgRenderer,e=i.svgObject,u=t.ShapeSize,o=n.startX+-u.width/2,s=n.startY+-u.width/2,h=u.width,c=u.height,l={id:e.id+"_image"+t.PointIndex,height:c,width:h,href:t.Imageurl,x:o,y:s,visibility:"visible",lgndCtx:t.context};f.drawImage(l,r)},_drawStraightLine:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/10)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10),o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawLine:function(n,t,i,r){var o=i.svgRenderer,l=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,s;if(i.model.enableCanvasRendering===!0){e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/10)+" L "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" M "+(n.startX+Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10);var s={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},h="M "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" a "+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+2*Math.floor(u.width/3)+" 0 a"+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+-2*Math.floor(u.width/3)+" 0",c={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:h,lgndCtx:!0};o.drawPath(s,r);o.drawPath(c,r)}else e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/10)+" L "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" M "+(n.startX+Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10)+" M "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" a "+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+2*Math.floor(u.width/3)+" 0 a"+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+-2*Math.floor(u.width/3)+" 0",s={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},o.drawPath(s,r);return n.startX+-u.width/2+-f/4},_drawColumn:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX-3*(u.width/5))+" "+(n.startY-u.height/5)+" L "+(n.startX+3*(-u.width/10))+" "+(n.startY-u.height/5)+" L "+(n.startX+3*(-u.width/10))+" "+(n.startY+u.height/2)+" L "+(n.startX-3*(u.height/5))+" "+(n.startY+u.height/2)+" Z M "+(n.startX+-u.width/10-u.width/20)+" "+(n.startY-u.height/4-f/2)+" L "+(n.startX+u.width/10+u.width/20)+" "+(n.startY-u.height/4-f/2)+" L "+(n.startX+u.width/10+u.width/20)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/10-u.width/20)+" "+(n.startY+u.height/2)+" Z M "+(n.startX+3*(u.width/10))+" "+n.startY+" L "+(n.startX+3*(u.width/5))+" "+n.startY+" L "+(n.startX+3*(u.width/5))+" "+(n.startY+u.height/2)+" L "+(n.startX+3*(u.width/10))+" "+(n.startY+u.height/2)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX-3*(u.width/5)},_drawRangeColumn:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/5)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+-u.width/5)+" "+(n.startY-u.height/2-f/4)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2+-f/4)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2+f/4)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/5},_drawBar:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY-3*(u.height/5))+" L "+(n.startX+3*(u.width/10))+" "+(n.startY-3*(u.height/5))+" L "+(n.startX+3*(u.width/10))+" "+(n.startY-3*(u.height/10))+" L "+(n.startX-u.width/2+-f/4)+" "+(n.startY-3*(u.height/10))+" Z M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY-u.height/5+f/20)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY-u.height/5+f/20)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10+f/20)+" L "+(n.startX-u.width/2+-f/4)+" "+(n.startY+u.height/10+f/20)+" Z M "+(n.startX-u.width/2+-f/4)+" "+(n.startY+u.height/5+f/10)+" L "+(n.startX+-u.width/4)+" "+(n.startY+u.height/5+f/10)+" L "+(n.startX+-u.width/4)+" "+(n.startY+u.height/2+f/10)+" L "+(n.startX-u.width/2+-f/4)+" "+(n.startY+u.height/2+f/10)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawStepLine:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2-f/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2+u.width/10)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2+u.width/10)+" "+n.startY+" L "+(n.startX+-u.width/10)+" "+n.startY+" L "+(n.startX+-u.width/10)+" "+(n.startY+u.height/2)+" L "+(n.startX+u.width/5)+" "+(n.startY+u.height/2)+" L "+(n.startX+u.width/5)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2)+"L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" L"+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/2),o={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2-f/4},_drawSpline:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;return f="M "+(n.startX-u.width/2)+" "+(n.startY+u.height/5)+" Q "+n.startX+" "+(n.startY-u.height)+" "+n.startX+" "+(n.startY+u.height/5)+" M "+n.startX+" "+(n.startY+u.height/5)+" Q "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" "+(n.startX+u.width/2)+" "+(n.startY-u.height/2),e={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:f,lgndCtx:!0},o.drawPath(e,r),n.startX-u.width/2},_drawSplineArea:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;return f="M "+(n.startX-u.width/2)+" "+(n.startY+u.height/5)+" Q "+n.startX+" "+(n.startY-u.height)+" "+n.startX+" "+(n.startY+u.height/5)+" Z M "+n.startX+" "+(n.startY+u.height/5)+" Q "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" "+(n.startX+u.width/2)+" "+(n.startY-u.height/2)+" Z",e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:f,lgndCtx:!0},o.drawPath(e,r),n.startX-u.width/2},_drawArea:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX-u.width/2-f/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/4+-f/8)+" "+(n.startY-u.height/2)+" L "+n.startX+" "+(n.startY+u.height/4)+" L "+(n.startX+u.width/4+f/8)+" "+(n.startY+-u.height/2+u.height/4)+" L "+(n.startX+u.height/2+f/4)+" "+(n.startY+u.height/2)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX-u.width/2-f/4},_drawStepArea:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+-u.height/2)+" L "+(n.startX-u.width/4)+" "+(n.startY-u.height/2)+" L "+(n.startX-u.width/4)+" "+(n.startY-u.height/4)+" L "+(n.startX+u.width/4)+" "+(n.startY-u.height/4)+" L "+(n.startX+u.width/4)+" "+n.startX+" L "+(n.startX+u.width/2+f/4)+" "+n.startY+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/2)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawPyramid:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/2+f/8)+" L "+n.startX+" "+(n.startY+-u.height/2+-f/8)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/2+f/8)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawFunnel:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/5)+" "+(n.startY+-u.height/2+-f/4)+" L "+(n.startX+-u.width/5)+" "+(n.startY+u.height/4)+" L "+(n.startX+-u.width/5)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+u.width/5)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+u.width/5)+" "+(n.startY+u.height/4)+" L "+(n.startX+u.width/2+f/5)+" "+(n.startY+-u.height/2+-f/4)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/5},_drawCandle:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2)+" "+(n.startY+u.height/4+f/8)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/4+f/8)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2+f/8)+" L "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/2+f/8)+" Z M "+n.startX+" "+(n.startY+-u.height/2+f/8)+" L "+n.startX+" "+(n.startY+-u.height/2+-f/4)+" M "+n.startX+" "+(n.startY+u.height/4+f/8)+" L "+n.startX+" "+(n.startY+u.height/4+f/2),o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2},_drawHilo:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+u.width/2)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2+-f/4),o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+u.width/2},_drawHiloOpenClose:function(n,i,r,u){var h=r.svgRenderer,c=r.svgObject,f=i.ShapeSize,l=t(18,12,4.0710678118654755,270),e=i.ElementSpace,o,s;return o="M "+n.startX+" "+(n.startY-3*(f.height/10))+" L "+(n.startX-f.width/2-e/4)+" "+(n.startY-3*(f.height/10))+" M "+n.startX+" "+(n.startY-f.height/2-e/4)+" L "+n.startX+" "+(n.startY+f.height/2+e/4)+" M "+n.startX+" "+(n.startY+3*(f.height/10))+" L "+(n.startX+f.width/2+e/4)+" "+(n.startY+3*(f.height/10)),s={id:i.ID,fill:"transparent","stroke-width":i.Style.BorderWidth,stroke:i.Style.Color,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:o,lgndCtx:!0},h.drawPath(s,u),n.startX-f.width/2},_drawDoughnut:function(n,i,r,u){var o=r.svgRenderer,v=r.svgObject,e=i.ShapeSize,a=i.ElementSpace,f=Math.sqrt(e.height*e.width)/2,c,l;f=f+a/5;var s=t(n.startX,n.startY,f,270),h=t(n.startX+e.width/10,n.startY,f,270),a=i.ElementSpace;return path="M "+n.startX+" "+n.startY+" L "+(n.startX+f)+" "+n.startY+" A "+f+" "+f+" 0 1 1 "+s[0]+" "+s[1]+" Z M "+(n.startX+e.width/10)+" "+(n.startY-e.height/10)+" L"+(n.startX+f)+" "+(n.startY-e.height/10)+" A "+f+" "+f+" 0 0 0 "+h[0]+" "+h[1]+" Z",c={id:i.ID,fill:i.Style.Color,"stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:path,lgndCtx:!0},l={id:i.ID,cx:n.startX,cy:n.startY,r:f/2,lgndCtx:!0,fill:"white","stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility},o.drawPath(c,u),o.drawCircle(l,u),n.startX-f},_drawPie:function(n,i,r,u){var c=r.svgRenderer,a=r.svgObject,e=i.ShapeSize,l=i.ElementSpace,f=Math.sqrt(e.height*e.width)/2,h;f=f+l/5;var o=t(n.startX,n.startY,f,270),s=t(n.startX+e.width/10,n.startY,f,270),l=i.ElementSpace;return path="M "+n.startX+" "+n.startY+" L "+(n.startX+f)+" "+n.startY+" A "+f+" "+f+" 0 1 1 "+o[0]+" "+o[1]+" Z M "+(n.startX+e.width/10)+" "+(n.startY-e.height/10)+" L"+(n.startX+f)+" "+(n.startY-e.height/10)+" A "+f+" "+f+" 0 0 0 "+s[0]+" "+s[1]+" Z",h={id:i.ID,fill:i.Style.Color,"stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:path,lgndCtx:!0},c.drawPath(h,u),n.startX-f}};ej.EjSvgRender.seriesPalette={defaultMetro:["#E94649","#F6B53F","#6FAAB0","#C4C24A","#FB954F","#005277","#8BC652","#69D2E7","#E27F2D","#6A4B82"],defaultHighContrast:["#F93A00","#44E2D6","#DDD10D","#0AA368","#0556CB","#AB40B2","#5F930A","#D12E41","#E0670E","#008FFF"],defaultOffice:["#005277","#8BC652","#6A4B82","#E94649","#6FAAB0","#F7B74F","#C4C24A","#EF863F","#69D2E7","#FFD13E"],defaultMaterial:["#663AB6","#EB3F79","#F8AB1D","#B82E3D","#049CB1","#F2424F","#C2C924","#3DA046","#074D67","#02A8F4"],defaultGradient:{borderColors:["#F34649","#F6D321","#6EB9B0","#CBC26A","#FBAF4F","#E2CDB1","#FFC0B7","#68E1E6","#E1A62D","#9C6EBF"],seriesColors:[[{color:"#F34649",colorStop:"0%"},{color:"#B74143",colorStop:"100%"}],[{color:"#F6D321",colorStop:"0%"},{color:"#F6AE26",colorStop:"100%"}],[{color:"#6EB9B0",colorStop:"0%"},{color:"#3F77BD",colorStop:"100%"}],[{color:"#CBC26A",colorStop:"0%"},{color:"#9AAD21",colorStop:"100%"}],[{color:"#FBAF4F",colorStop:"0%"},{color:"#F07542",colorStop:"100%"}],[{color:"#E2CDB1",colorStop:"0%"},{color:"#AAA089",colorStop:"100%"}],[{color:"#8BC652",colorStop:"0%"},{color:"#6F9E41",colorStop:"100%"}],[{color:"#68E1E6",colorStop:"0%"},{color:"#3D9CBE",colorStop:"100%"}],[{color:"#E1A62D",colorStop:"0%"},{color:"#B66824",colorStop:"100%"}],[{color:"#9C6EBF",colorStop:"0%"}],[{color:"#593F6D",colorStop:"100%"}]]},blueMetro:["#005378","#006691","#007EB5","#0D97D4","#00AEFF","#14B9FF","#54CCFF","#87DBFF","#ADE5FF","#C5EDFF"],blueGradient:{seriesColors:[[{color:"#005277",colorStop:"0%"},{color:"#00304F",colorStop:"100%"}],[{color:"#006590",colorStop:"0%"},{color:"#004068",colorStop:"100%"}],[{color:"#007DB4",colorStop:"0%"},{color:"#00558B",colorStop:"100%"}],[{color:"#0D97D4",colorStop:"0%"},{color:"#057FC7",colorStop:"100%"}],[{color:"#00ADFE",colorStop:"0%"},{color:"#008BE9",colorStop:"100%"}],[{color:"#14B8FE",colorStop:"0%"},{color:"#0798EB",colorStop:"100%"}],[{color:"#53CBFF",colorStop:"0%"},{color:"#35AFEB",colorStop:"100%"}],[{color:"#86DAFF",colorStop:"0%"},{color:"#64C0EC",colorStop:"100%"}],[{color:"#ACE5FF",colorStop:"0%"},{color:"#8DCEED",colorStop:"100%"}],[{color:"#C4ECFF",colorStop:"0%"}],[{color:"#A3D1E6",colorStop:"100%"}]],borderColors:["#005277","#006590","#007DB4","#0D97D4","#00ADFE","#14B8FE","#53CBFF","#86DAFF","#ACE5FF","#C4ECFF"]},greenMetro:["#496612","#597B15","#709A1B","#87B62A","#9AD926","#A6DC37","#BCE654","#C8E780","#D5EFA5","#E2F3BE"],greenGradient:{seriesColors:[[{color:"#5C7F16",colorStop:"0%"},{color:"#384C08",colorStop:"100%"}],[{color:"#6A9319",colorStop:"0%"},{color:"#486009",colorStop:"100%"}],[{color:"#739D1C",colorStop:"0%"},{color:"#57760B",colorStop:"100%"}],[{color:"#90B546",colorStop:"0%"},{color:"#6E9215",colorStop:"100%"}],[{color:"#9AD826",colorStop:"0%"},{color:"#75A010",colorStop:"100%"}],[{color:"#A5DB36",colorStop:"0%"},{color:"#8EB91D",colorStop:"100%"}],[{color:"#BBE554",colorStop:"0%"},{color:"#A4C849",colorStop:"100%"}],[{color:"#C8E780",colorStop:"0%"},{color:"#B4D072",colorStop:"100%"}],[{color:"#D4EEA5",colorStop:"0%"},{color:"#BFD593",colorStop:"100%"}],[{color:"#E1F2BD",colorStop:"0%"}],[{color:"#C8D7A8",colorStop:"100%"}]],borderColors:["#5C7F16","#6A9319","#739D1C","#90B546","#9AD826","#A5DB36","#BBE554","#C8E780","#D4EEA5","#E1F2BD"]},sandleMetro:["#6C450C","#82520D","#A36812","#C07F1F","#E69719","#E89A2B","#EEB564","#F3CB93","#F7DEB4","#F9E6CA"],sandleGradient:{seriesColors:[[{color:"#7F602F",colorStop:"0%"},{color:"#512D04",colorStop:"100%"}],[{color:"#986827",colorStop:"0%"},{color:"#673803",colorStop:"100%"}],[{color:"#A16C1F",colorStop:"0%"},{color:"#8A4B05",colorStop:"100%"}],[{color:"#BF812A",colorStop:"0%"},{color:"#AD630D",colorStop:"100%"}],[{color:"#E49519",colorStop:"0%"},{color:"#B86607",colorStop:"100%"}],[{color:"#E7992A",colorStop:"0%"},{color:"#D7780D",colorStop:"100%"}],[{color:"#EDB463",colorStop:"0%"},{color:"#D98F31",colorStop:"100%"}],[{color:"#F2CA92",colorStop:"0%"},{color:"#DAAC6F",colorStop:"100%"}],[{color:"#F6DDB3",colorStop:"0%"},{color:"#DABE8F",colorStop:"100%"}],[{color:"#F8E5C9",colorStop:"0%"}],[{color:"#DDBE92",colorStop:"100%"}]],borderColors:["#7F602F","#986827","#A16C1F","#BF812A","#E49519","#E7992A","#EDB463","#F2CA92","#F6DDB3","#F8E5C9"]}};ej.EjSvgRender.themes={flatlight:{highlightColor:"black",background:"transparent",legend:{font:{color:"#282828"},title:{font:{color:"#282828"}}},title:{font:{color:"#565656"},subTitle:{font:{color:"#565656"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",borderWidth:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#565656"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultMetro,colors:ej.EjSvgRender.seriesPalette.defaultMetro},flatdark:{highlightColor:"white",background:"#111111",legend:{font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}}},title:{font:{color:"#C9C9C9"},subTitle:{font:{color:"#C9C9C9"}}},primaryXAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryX:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},primaryYAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryY:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#C9C9C9"}}},errorBar:{fill:"#ffffff",cap:{fill:"#ffffff"}},connectorLine:{color:"#C9C9C9"}},crosshair:{line:{width:1,color:"White"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultMetro,colors:ej.EjSvgRender.seriesPalette.defaultMetro},gradientlight:{highlightColor:"black",background:"transparent",legend:{font:{color:"#282828"},title:{font:{color:"#282828"}}},title:{font:{color:"#565656"},subTitle:{font:{color:"#565656"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#565656"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.defaultGradient.seriesColors},gradientdark:{highlightColor:"white",background:"#111111",legend:{font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}}},title:{font:{color:"#C9C9C9"},subTitle:{font:{color:"#C9C9C9"}}},primaryXAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryX:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},primaryYAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryY:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#C9C9C9"}}},errorBar:{fill:"#ffffff",cap:{fill:"#ffffff"}},connectorLine:{color:"#C9C9C9"}},crosshair:{line:{width:1,color:"White"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.defaultGradient.seriesColors},highcontrast01:{highlightColor:"white",background:"#111111",legend:{font:{color:"#ffffff"},title:{font:{color:"#ffffff"}}},title:{font:{color:"#ffffff"},subTitle:{font:{color:"#ffffff"}}},primaryXAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#ffffff",axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryX:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},primaryYAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#ffffff",axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryY:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#ffffff"}}},errorBar:{fill:"#ffffff",cap:{fill:"#ffffff"}},connectorLine:{color:"#C9C9C9"}},crosshair:{line:{width:1,color:"White"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultHighContrast,colors:ej.EjSvgRender.seriesPalette.defaultHighContrast},material:{highlightColor:"black",background:"transparent",legend:{font:{color:"#333333"},title:{font:{color:"#333333"}}},title:{font:{color:"#333333"},subTitle:{font:{color:"#333333"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",borderWidth:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#333333"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultMaterial,colors:ej.EjSvgRender.seriesPalette.defaultMaterial},office365:{highlightColor:"black",background:"transparent",legend:{font:{color:"#333333"},title:{font:{color:"#333333"}}},title:{font:{color:"#333333"},subTitle:{font:{color:"#333333"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",borderWidth:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#333333"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultOffice,colors:ej.EjSvgRender.seriesPalette.defaultOffice}};n.extend(ej.EjSvgRender.themes,{azure:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueMetro,colors:ej.EjSvgRender.seriesPalette.blueMetro},azuredark:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueMetro,colors:ej.EjSvgRender.seriesPalette.blueMetro},"gradient-azure":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.blueGradient.seriesColors},"gradient-azuredark":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.blueGradient.seriesColors},lime:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenMetro,colors:ej.EjSvgRender.seriesPalette.greenMetro},limedark:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenMetro,colors:ej.EjSvgRender.seriesPalette.greenMetro},"gradient-lime":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.greenGradient.seriesColors},"gradient-limedark":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.greenGradient.seriesColors},saffron:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleMetro,colors:ej.EjSvgRender.seriesPalette.sandleMetro},saffrondark:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleMetro,colors:ej.EjSvgRender.seriesPalette.sandleMetro},"gradient-saffron":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.sandleGradient.seriesColors},"gradient-saffrondark":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.sandleGradient.seriesColors}})}(jQuery);ej.axisTypes={};ej.EjAxisRenderer=function(){};_sideBySeriesPadding=function(n,t,i,r){for(var u,f,o=ej.DataManager(n.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),s=!1,h=o.length,c=r.orientation.toLowerCase(),e=0;e<h;e++)if(u=o[e].type.toLowerCase(),u.indexOf("column")!=-1||u.indexOf("bar")!=-1||u.indexOf("waterfall")!=-1||u=="candle"||u.indexOf("hilo")!=-1||u.indexOf("box")!=-1){s=!0;break}return n.model.AreaType!="polaraxes"&&s?(r.m_minPointsDelta=undefined,f=ej.EjSvgRender.utils.getMinPointsDelta(r,n,t)*.5,t=t-f,i=i+f>Number.MAX_VALUE?Number.MAX_VALUE:i+f,r.padding=f):r.padding=0,{startPadding:t,endPadding:i}};ej.EjStripline=function(n){this.chart=n},function(n){function t(t,i){var r=function(){};return r.prototype=new t,n.extend(r.prototype,i),r}var i,r,u,f,e;ej.EjAxisRenderer.prototype={_seriesMinMax:function(t,i,r,u,f){var st=i.orientation.toLowerCase(),pt=r.length,ht,w,e,g,nt,et,ot,c,s,k,d,bt,kt,l,dt,vt,gt,yt,tt;if(f.seriesCollection=ej.util.isNullOrUndefined(f.seriesCollection)?{}:f.seriesCollection,pt>0&&t.model._hasSeriesPoints&&r[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){var ct,a,lt,v,ni={maxX:null,minX:null},ti={maxY:null,minY:null},p=ni.maxX,y=ni.minX,h=ti.maxY,o=ti.minY,at,it,rt,ut;for(e=0;e<pt;e++){if(at=r[e].visibility.toLowerCase(),it=r[e].points.length,ht=0,at==="visible")for(r[e]._visiblePoints=[],c=0;c<it;c++)w=r[e].points[c],w.x!=null&&w.x!=undefined&&(w.y!=null&&w.y!=undefined||w.showIntermediateSum||w.showTotalSum||w.isEmpty==!1)&&(r[e]._visiblePoints[ht]=w,r[e]._visiblePoints[ht].actualIndex=c,ht++);i.maxPointLength=it}for(e=0;e<pt;e++)if(rt=r[e]._visiblePoints.length,g=r[e],rt>0&&(at=r[e].visibility.toLowerCase(),it=r[e].points.length,at==="visible"&&it>0))if(st=="horizontal"&&!t.model.requireInvertedAxes||st=="vertical"&&t.model.requireInvertedAxes){for(lt=ct=r[e]._visiblePoints[0].xValue,c=0;c<rt;c++)s=r[e]._visiblePoints[c].xValue,lt>s&&(lt=s),ct<s&&(ct=s);r[e].minX=lt;r[e].maxX=ct;(y===null||y===undefined)&&rt>0&&(p=r[e].maxX,y=r[e].minX);y>r[e].minX&&(y=r[e].minX);p<r[e].maxX&&(p=r[e].maxX)}else{var ii=g.type.toLowerCase().indexOf("spline")!=-1,ft,wt,ri,ui=0,b=r[e]._visiblePoints;for(ii&&(nt=g._name=g.name||"series"+e,f.seriesCollection[nt]={},b=ej.ejSplineSeries.prototype._isVisiblePoints(g),wt=f.seriesCollection[nt].naturalSpline=ej.ejSplineSeries.prototype.naturalSpline(b),f.seriesCollection[nt].controlPoints=[],ri=ej.ejSplineSeries.prototype.getBezierControlPoints),v=a=b[0].YValues[0],c=0;c<b.length;c++)if(s=b[c],r[e]._hiloTypes)for(k=0;k<2;k++)a>s.YValues[k]&&(a=s.YValues[k]),v<s.YValues[k]&&(v=s.YValues[k]);else if(g.type.toLowerCase()=="boxandwhisker"){for(et=b[c].YValues[0][0],ot=b[c].YValues[0][0],d=0;d<s.YValues[0].length;d++)et>s.YValues[0][d]&&(et=s.YValues[0][d]),ot<s.YValues[0][d]&&(ot=s.YValues[0][d]);a=et>a?a:et;v=ot<v?v:ot}else ii?c!=0&&s.visible&&b[c-1].visible?(f.seriesCollection[nt].controlPoints.push(ri(b[c-1],s,wt[c-1],wt[c],0)),ft=f.seriesCollection[nt].controlPoints[ui++],a=Math.min(a,s.YValues[0],ft.controlPoint1.YValues[0],ft.controlPoint2.YValues[0]),v=Math.max(v,s.YValues[0],ft.controlPoint1.YValues[0],ft.controlPoint2.YValues[0])):(a=Math.min(a,s.YValues[0]||null),v=Math.max(v,s.YValues[0]||null)):(a>s.YValues[0]&&(a=s.YValues[0]),v<s.YValues[0]&&(v=s.YValues[0]));r[e].minY=a;r[e].maxY=v;(o===null||o===undefined)&&rt>0&&(h=r[e].maxY,o=r[e].minY);o>r[e].minY&&(o=r[e].minY);h<r[e].maxY&&(h=r[e].maxY);ut=r[e].type;(ut=="column"||ut=="bar")&&i.startFromZero&&(o=o<0?o:0)}st=="horizontal"&&!t.model.requireInvertedAxes||st=="vertical"&&t.model.requireInvertedAxes?(this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[i.name]&&(l=this.chartObj.model.indicatorRange[i.name],(o>l.min||o==null)&&(o=l.min),(h<l.max||h==null)&&(h=l.max)),p==y&&(p+=1),u=="double"?(bt=_sideBySeriesPadding(t,y,p,i),y=bt.startPadding,p=bt.endPadding,deltaX=p-y,i.range=this._getDoubleAutoRange(i,y,p,deltaX)):i.range=this._getLogAutoRange(i,y,p,p-y)):(this.chartObj.model.stackedValue[i.name]&&(l=this.chartObj.model.stackedValue[i.name],kt=!0,o>l.min&&(o=l.min),h<l.max&&(h=l.max)),this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[i.name]&&(l=this.chartObj.model.indicatorRange[i.name],(o>l.min||o==null)&&(o=l.min),(h<l.max||h==null)&&(h=l.max)),h==o&&(h<0?h=0:h<=1&&h>0?o=0:(o=0,h+=1)),ut!="column"&&ut!="bar"||i.startFromZero||(dt=i.range&&i.range.max||h,vt=i.range&&i.range.interval||this.calculateNumericNiceInterval(dt-o,i,null,dt),h+=vt,o-vt<0&&o>0||kt?o=0:o-=vt),gt=h-o,kt=!1,i.range=u=="double"?this._getDoubleAutoRange(i,o,h,gt):this._getLogAutoRange(i,o,h,gt))}else i.setRange?(min=i.range.min==null||i.range.min==undefined?0:i.range.min,max=i.range.max==null||i.range.max==undefined?5:i.range.max,delta=max-min,i.range=this._getDoubleAutoRange(i,min,max,delta)):i.range={min:0,max:5,interval:1,Delta:4};yt=n.extend({},ej.EjSvgRender.commonChartEventArgs);yt.data={range:i.range,axis:i};this.chartObj._trigger("axesRangeCalculate",yt);tt=yt.data.range;i.range={min:tt.min,max:tt.max,interval:tt.interval,delta:tt.max-tt.min}},_calculateTrendLineRange:function(n,t,i){for(var f,u,e,r,c,s,h,l=i.length,o=0;o<l;o++)if(u=i[o],e=u.trendlines,n.model.AreaType=="cartesianaxes"&&(t.name==u._xAxisName||t.name==u._yAxisName))for(s=e.length,f=0;f<s;f++)r=e[f],r.visibility.toLowerCase()==="visible"&&(t.name==u._xAxisName?(h=r.type.toLowerCase(),options=new ej.trendlineTypes[h],options.calculateTrendLineSegment(u,r,t,n)):t.name==u._yAxisName&&!t.setRange&&r.points&&r.points.length>1&&(c=r.points.length-1,t.range.min=t.range.min>r.minY?r.minY:t.range.min,t.range.max=t.range.max<r.maxY?r.maxY:t.range.max));return!1},AlignRangeStart:function(n,t,i){var r=new Date(n),u,f,e,o,s,h,c;return i.toLowerCase()=="days"?(u=Math.floor(Math.floor(n.getDate()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),u,0,0,0)):i.toLowerCase()=="hours"?(f=Math.floor(Math.floor(n.getHours()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),f,0,0)):i.toLowerCase()=="milliseconds"?(e=Math.floor(Math.floor(n.getMilliseconds()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),e)):i.toLowerCase()=="seconds"?(o=Math.floor(Math.floor(n.getSeconds()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),o,0)):i.toLowerCase()=="minutes"?(s=Math.floor(Math.floor(n.getMinutes()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),s,0,0)):i.toLowerCase()=="months"?(h=Math.floor(Math.floor(n.getMonth()/t)*t),r=new Date(n.getFullYear(),h,n.getDate(),0,0,0)):i.toLowerCase()=="years"&&(c=Math.floor(Math.floor(n.getFullYear()/t)*t),r=new Date(c,n.getMonth(),n.getDate(),0,0,0)),r},_increaseDateTimeInterval:function(n,t,i){var r=new Date(n);return i.toLowerCase()=="days"?r.setDate(n.getDate()+t):i.toLowerCase()=="hours"?r.setHours(n.getHours()+t):i.toLowerCase()=="milliseconds"?r.setMilliseconds(n.getMilliseconds()+t):i.toLowerCase()=="seconds"?r.setSeconds(n.getSeconds()+t):i.toLowerCase()=="minutes"?r.setMinutes(n.getMinutes()+t):i.toLowerCase()=="months"?r.setMonth(n.getMonth()+t):i.toLowerCase()=="years"&&r.setYear(n.getFullYear()+t),r},_calculatePadding:function(n){var t=typeof n.range.min=="string"&&!isNaN(Date.parse(n.range.min))?Date.parse(n.range.min):n.range.min.getTime(),i=typeof n.range.max=="string"&&!isNaN(Date.parse(n.range.max))?Date.parse(n.range.max):n.range.max.getTime(),d=this._increaseDateTimeInterval(new Date(t),n.range.interval,n._intervalType).getTime()-t,r=n.rangePadding.toLowerCase(),b,h,c,l,f,a,v,e,y,u,k,o,p,s,w;if(!this.chartObj.zoomed&&!n.setRange)if(t=new Date(t),i=new Date(i),b=n._intervalType.toLowerCase(),n.rangePadding.toLowerCase()=="none")t=t.getTime(),i=i.getTime();else if(r=="additional"||r=="round")switch(b){case"years":h=t.getFullYear();c=i.getFullYear();n.rangePadding.toLowerCase()=="additional"?(t=new Date(h-n.range.interval,1,1,0,0,0).getTime(),i=new Date(c+n.range.interval,1,1,0,0,0).getTime()):(t=new Date(h,0,0,0,0,0).getTime(),i=new Date(c,11,30,23,59,59).getTime());break;case"months":l=t.getMonth();f=i.getMonth();r=="round"?(t=new Date(t.getFullYear(),l,0,0,0,0).getTime(),i=new Date(i.getFullYear(),f,new Date(i.getFullYear(),i.getMonth(),0).getDate(),23,59,59).getTime()):(t=new Date(t.getFullYear(),l+-n.range.interval,1,0,0,0).getTime(),i=new Date(i.getFullYear(),f+n.range.interval,f==2?28:30,0,0,0).getTime());break;case"days":a=t.getDate();v=i.getDate();r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),a,0,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),v,23,59,59).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),a+-n.range.interval,0,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),v+n.range.interval,0,0,0).getTime());break;case"hours":e=t.getHours()/n.range.interval*n.range.interval;y=i.getHours()+(t.getHours()-e);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),e,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),y,59,59).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),e+-n.range.interval,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),y+n.range.interval,0,0).getTime());break;case"minutes":u=t.getMinutes()/n.range.interval*n.range.interval;k=i.getMinutes()+(t.getMinutes()-u);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHour(),u,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHour(),k,59).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),u+-n.range.interval,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),u+n.range.interval,0).getTime());break;case"seconds":o=t.getSeconds()/n.range.interval*n.range.interval;p=i.getSeconds()+(t.getSeconds()-o);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),o,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHour(),i.getMinutes(),p,0).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),o+-n.range.interval,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),i.getMinutes(),p+n.range.interval,0).getTime());break;case"milliseconds":s=t.getMilliseconds()/n.range.interval*n.range.interval;w=i.getMilliseconds()+(t.getMilliseconds()-s);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),s).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),i.getMinutes(),i.getSeconds(),w).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),s+-n.range.interval).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),i.getMinutes(),i.getSeconds(),w+n.range.interval).getTime())}n.actualRange.interval=d;n.actualRange.min=t;n.actualRange.max=i;n._interval=n.range.interval;n.actualRange.delta=n.actualRange.max-n.actualRange.min;n.range.min=new Date(t);n.range.max=new Date(i);this._calculateVisibleRange(n)},_calculateVisibleRange:function(t,i,r){var e,u,f,o,s;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);o=new Date(u);s=new Date(f);u==f&&(o=new Date(Date.parse(o)-2592e6),s=new Date(Date.parse(s)+2592e6));var c=Math.min(o.getTime(),s.getTime()),l=Math.max(o.getTime(),s.getTime()),h=t.enableAutoIntervalOnZooming?this.calculateDateTimeNiceInterval(t,o,s):{interval:t._interval,intervalType:t._intervalType},a=this._increaseDateTimeInterval(o,h.interval,h.intervalType).getTime()-c;if(r)return{min:c,max:l,interval:a};t._intervalType=h.intervalType;t.visibleRange.min=c;t.visibleRange.max=l;t.visibleRange.interval=a;t.visibleRange.delta=Math.abs(t.visibleRange.max-t.visibleRange.min);t._interval=h.interval}},_calculateAxisLabels:function(t){for(var u,f=t.enableAutoIntervalOnZooming?t.visibleRange.min:t.actualRange.min,r,i=this.chartObj.zoomed||t.zoomed||!t.setRange?this.AlignRangeStart(new Date(f),t._interval,t._intervalType).getTime():t.visibleRange.min;i<=t.visibleRange.max;)i>=t.visibleRange.min&&i<=t.visibleRange.max&&(u=ej.format(new Date(i),t.labelFormat?t.labelFormat:ej.EjSvgRender.utils._dateTimeLabelFormat(t._intervalType),this.chartObj.model.locale),r=n.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={label:{Text:u,Value:i},axis:t},this.chartObj._trigger("axesLabelRendering",r),t.visibleLabels.push({Value:i,Text:r.data.label.Text})),i=this._increaseDateTimeInterval(new Date(i),t._interval,t._intervalType).getTime(),t.visibleLabels[t.visibleLabels.length-1]=t.visibleLabels[t.visibleLabels.length-1];t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},calculateDateTimeNiceInterval:function(n,t,i){var u=Math.abs((t.getTime()-i.getTime())/864e5),r=this.calculateNumericNiceInterval(u/365,n,"years"),f,e,o,s;return r>=1?{interval:r,intervalType:"Years"}:(r=this.calculateNumericNiceInterval(u/30,n,"months"),r>=1)?{interval:r,intervalType:"Months"}:(r=this.calculateNumericNiceInterval(u,n,"days"),r>=1)?{interval:r,intervalType:"Days"}:(f=u*24,r=this.calculateNumericNiceInterval(f,n,"hours"),r>=1)?{interval:r,intervalType:"Hours"}:(e=u*1440,r=this.calculateNumericNiceInterval(e,n,"minutes"),r>=1)?{interval:r,intervalType:"Minutes"}:(o=u*86400,r=this.calculateNumericNiceInterval(o,n,"seconds"),r>=1)?{interval:r,intervalType:"Seconds"}:(s=u*864e5,r=this.calculateNumericNiceInterval(s,n,"milliseconds"),r>=1?{interval:r,intervalType:"Milliseconds"}:void 0)},calculateNumericNiceInterval:function(n,t,i,r){var o=this.GetActualDesiredIntervalsCount(t,t.length),u=n/o,f,e;if(t._valueType=="double"&&t.desiredIntervals!=null)return u;var h=Math.pow(10,Math.floor(ej.EjSvgRender.utils._logBase(u,10))),s=[10,5,2,1],c=r||t.range&&t.range.max;for(f=0;f<s.length;f++){if(e=h*s[f],o<n/e)return t._valueType=="datetime"?!ej.util.isNullOrUndefined(t.intervalType)&&t.intervalType.toLowerCase()==i?Math.ceil(u):u:ej.util.isNullOrUndefined(t.range)||ej.util.isNullOrUndefined(t.range.max)?u:u>c?e:u;u=e}return u},GetActualDesiredIntervalsCount:function(n,t){if(ej.util.isNullOrUndefined(n.desiredIntervals)){var i=(n.orientation.toLowerCase()=="horizontal"?.533:1)*n.maximumLabels;return Math.max(t*(i/100),1)}return n.desiredIntervals},_calculateRange:function(t,i){var o,c,y,p,s,r,l,a,u,f,v,b,e,k,w,h;if(!this.chartObj.zoomed){if(o=new Date,i.length>0&&this.chartObj.model._hasSeriesPoints&&i[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){for(r={maxX:null,minX:null},l={maxY:null,minY:null},u=0;u<i.length;u++){if(a=i[u].points.length,a>0&&i[u].visibility.toLowerCase()==="visible"&&i[u].points.length>0){for(s=c=i[u].points[0].xValue,p=y=i[u].points[0].YValues[0],f=0;f<a;f++)s!=null&&s!=undefined?(s>i[u].points[f].xValue&&(s=i[u].points[f].xValue),c<i[u].points[f].xValue&&(c=i[u].points[f].xValue)):s=c=i[u].points[f+1].xValue,y>i[u].points[f].YValues[0]&&(y=i[u].points[f].YValues[0]),p<i[u].points[f].YValues[0]&&(p=i[u].points[f].YValues[0]);i[u].minX=s;i[u].maxX=c;i[u].minY=y;i[u].maxY=p;(!t.maxPointLength||t.maxPointLength<a)&&(t.maxPointLength=a)}(r.minX=r.minX==null&&typeof i[u].minX!="number"?i[u].minX:r.minX)>i[u].minX&&(r.minX=typeof i[u].minX!="number"?i[u].minX:r.minX);(r.maxX=r.maxX==null&&typeof i[u].maxX!="number"?i[u].maxX:r.maxX)<i[u].maxX&&(r.maxX=typeof i[u].maxX!="number"?i[u].maxX:r.maxX);l.minY>i[u].minY&&(l.minY=i[u].minY);l.maxY<i[u].maxY&&(l.maxY=i[u].maxY)}this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[t.name]&&(v=this.chartObj.model.indicatorRange[t.name],(r.minX>new Date(v.min)||r.minX==null)&&(r.minX=new Date(v.min)),(r.maxX<new Date(v.max)||r.maxX==null)&&(r.maxX=new Date(v.max)));r.minX=r.minX==null?o:r.minX;r.maxX=r.maxX==null?new Date((new Date).setMonth(o.getMonth()+5)):r.maxX;r.minX==r.maxX&&(r.minX=new Date(Date.parse(r.minX)-2592e6),r.maxX=new Date(Date.parse(r.maxX)+2592e6));b=_sideBySeriesPadding(this.chartObj,Date.parse(r.minX),Date.parse(r.maxX),t);r.minX=new Date(b.startPadding);r.maxX=new Date(b.endPadding);e=this.calculateDateTimeNiceInterval(t,r.minX,r.maxX);t._intervalType=t.intervalType?t.intervalType:e.intervalType;t.intervalType=="auto"&&(t._intervalType=t.intervalType=e.intervalType);(t.setAxisInterval==null||t.setAxisInterval==undefined)&&(t.setAxisInterval=t.range&&t.range.interval?!0:!1);t._setInterval&&!this.chartObj._chartResize&&t.range&&t._setInterval!=t.range.interval&&(t._setInterval=null);t.setRange?((t.actual_Range==null||t.actual_Range==undefined)&&(t.range.max||(t.range.max=r.maxX),t.range.min||(t.range.min=r.minX),typeof t.range.min=="string"&&t.range.min.indexOf("/Date(")!=-1&&(t.range.min=new Date(parseInt(t.range.min.substr(6)))),typeof t.range.max=="string"&&t.range.max.indexOf("/Date(")!=-1&&(t.range.max=new Date(parseInt(t.range.max.substr(6)))),new Date(t.range.min).getTime()==new Date(t.range.max).getTime()&&(t.range.max=new Date(Date.parse(t.range.max)+864e5)),e=this.calculateDateTimeNiceInterval(t,new Date(t.range.min),new Date(t.range.max)),t._intervalType=t.intervalType?t.intervalType:e.intervalType,t.setAxisInterval||(t.range.interval=e.interval,t._setInterval=e.interval),t.actual_Range=n.extend(!0,{},t.range),t.setRange=!0),k=t._setInterval?e.interval:t.range.interval||t.actual_Range.interval,t.range={min:t.actual_Range.min,max:t.actual_Range.max,interval:k}):t.range={min:r.minX,max:r.maxX,interval:e.interval}}else t.setRange?(t.range.min=t.range.min===null||t.range.min===undefined?o:t.range.min,t.range.max=t.range.max===null||t.range.max===undefined?new Date((new Date).setMonth(o.getMonth()+5)):t.range.max,t.range.interval=t.range.interval===null||t.range.interval===undefined?1:t.range.interval,t._intervalType="Months"):(t.range={min:o,max:new Date((new Date).setMonth(o.getMonth()+5)),interval:1},t._intervalType="Months");w=n.extend({},ej.EjSvgRender.commonChartEventArgs);w.data={range:t.range,axis:t};this.chartObj._trigger("axesRangeCalculate",w);h=w.data.range;t.range={min:h.min,max:h.max,interval:h.interval,delta:h.max-h.min}}},_calculateRanges:function(n,t,i){this.chartObj=n;this._calculateRange(t,i);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._calculatePadding(t);this._calculateAxisLabels(t)}};i=t(ej.EjAxisRenderer);ej.axisTypes.datetime=i;r=t(ej.EjAxisRenderer,{_calculateRange:function(n,t,i,r){n.zoomed||this._seriesMinMax(n,t,i,"double",r)},_getDoubleAutoRange:function(t,i,r){var e,u,f;return t.setRange?(ej.util.isNullOrUndefined(t.range.max)&&(t.range.max=r),ej.util.isNullOrUndefined(t.range.min)&&(t.range.min=i),t.actual_Range=n.extend(!0,{},t.range),t.setRange=!0):t.range={min:i,max:r},e=t.range.max-t.range.min,u=this.calculateNumericNiceInterval(e,t),ej.EjSvgRender.utils._decimalPlaces(u)>20&&(f=u.toString(),u=parseFloat(f.substring(0,f.indexOf("."))+f.substring(f.indexOf("."),22))),(ej.util.isNullOrUndefined(t.range.interval)||t.range.interval<0)&&(t.range.interval=u),t.range.delta=e,t.range},_calculatePadding:function(n,t,i){var e=i.min,u=i.max,s=t.rangePadding.toLowerCase(),r=i.interval,o,h,f;t.setRange||n.zoomed||(s=="normal"?(o=0,e<0?(e=0,o=i.min+i.min/20,h=r+o%r,.365*r>=h&&(o-=r),o%r<0&&(o=o-r-o%r)):(o=e<5/6*u?0:e-(u-e)/2,o%r>0&&(o-=o%r)),f=u>0?u+(u-e)/20>Number.MAX_VALUE?Number.MAX_VALUE:u+(u-e)/20:u-(u-e)/20,h=r-f%r,.365*r>=h&&(f=f+r>Number.MAX_VALUE?Number.MAX_VALUE:f+r),f%r>0&&(f=f+r-f%r>Number.MAX_VALUE?Number.MAX_VALUE:f+r-f%r),o<=0&&(r=this.calculateNumericNiceInterval(f-o,t),f=Math.ceil(f/r)*r>Number.MAX_VALUE?Number.MAX_VALUE:Math.ceil(f/r)*r),e=t.roundingPlaces?parseFloat(o.toFixed(t.roundingPlaces)):parseFloat(o.toFixed(ej.EjSvgRender.utils._decimalPlaces(r)==0?1:ej.EjSvgRender.utils._decimalPlaces(r))),u=t.roundingPlaces?parseFloat(f.toFixed(t.roundingPlaces)):parseFloat(f.toFixed(ej.EjSvgRender.utils._decimalPlaces(r)==0?1:ej.EjSvgRender.utils._decimalPlaces(r)))):(s=="additional"||s=="round")&&(e=Math.floor(e/r)*r,u=Math.ceil(u/r)*r>Number.MAX_VALUE?Number.MAX_VALUE:Math.ceil(u/r)*r,s=="additional"&&(e-=r,u=u+r>=Number.MAX_VALUE?Number.MAX_VALUE:u+r)));t.actualRange.min=e;t.actualRange.max=u;t.actualRange.interval=r;t.range.min=e;t.range.max=u;t.range.interval=r;t.actualRange.delta=u-e>=Number.MAX_VALUE?u:u-e;this._calculateVisibleRange(t)},_calculateVisibleRange:function(t,i,r){var e,u,f,o,s;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){if(e=t.actualRange,t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor,t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition,t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta),u<e.min&&(f=f+(e.min-u),u=e.min),f>e.max&&(u=u-(f-e.max),f=e.max),o=Math.abs(f-u),s=t.enableAutoIntervalOnZooming?this.calculateNumericNiceInterval(o,t):t.actualRange.interval,r)return{min:Math.min(u,f),max:Math.max(u,f),delta:o,interval:s};t.visibleRange.min=Math.min(u,f);t.visibleRange.max=Math.max(u,f);t.visibleRange.delta=o;t.visibleRange.interval=s;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateAxisLabels:function(t,i){for(var r,e=i.roundingPlaces,h,l,s,f,c=this.chartObj.model.locale,v=i.labelFormat,o,a=20,u=t.zoomed||i.zoomed||i.padding?i.visibleRange.min-i.visibleRange.min%i.visibleRange.interval:i.visibleRange.min;u<=i.visibleRange.max;u+=i.visibleRange.interval)ej.EjSvgRender.utils._inside(u,i.visibleRange)&&(h=u.toString().split(0).length-1>10?10:20,u=parseFloat(u.toFixed(!e&&e>h?e:h)),l=e?u:parseFloat(u.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),f=e?parseFloat(u.toFixed(e)):parseFloat(u.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),r=i.labelFormat,r?r.match("{value}")!=null?f=r.replace("{value}",f):(r.indexOf("e")==0||r.indexOf("E")==0)&&r.indexOf("ej.format")==-1?(o=r.match(/(\d+)/g),o=o==null?6:o>a?a:o,f=f.toExponential(o)):(r.indexOf("ej.format")!=-1&&(r=r.substring(r.indexOf("(")+1,r.indexOf(")"))),f=ej.format(f,r,c)):f=i.isStacked100?f+"%":c?f.toLocaleString(c):f,s=n.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={label:{Text:f,Value:u},axis:i},t._trigger("axesLabelRendering",s),i.visibleLabels.push({Value:l,Text:s.data.label.Text}));i._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(i,this.chartObj)},_calculateRanges:function(n,t,i,r){this.chartObj=n;this._calculateRange(n,t,i,r);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._calculatePadding(n,t,t.range);t.maximumLabels>0&&this._calculateAxisLabels(n,t)}});ej.axisTypes.double=r;u=t(ej.EjAxisRenderer,{_getRoundValue:function(n,t,i){return(i?Math.ceil(n/t):Math.floor(n/t))*t},calculateLogNiceInterval:function(n,t){for(var u,e=this.GetActualDesiredIntervalsCount(t,t.length),i=n,o=Math.pow(10,Math.floor(ej.EjSvgRender.utils._logBase(i,10))),f=[10,5,2,1],r=0;r<f.length;r++){if(u=o*f[r],e<n/u)return i;i=u}return i},_getLogAutoRange:function(t,i,r,u){var s=ej.EjSvgRender.utils._logBase(i,t.logBase),o,f,e,h;return s=n.isNumeric(s)?s:i,o=ej.EjSvgRender.utils._logBase(r,t.logBase),o=n.isNumeric(o)?o:r,f=this._getRoundValue(s,1,!1),e=this._getRoundValue(o,1,!0),f==0&&e==0&&(f=ej.EjSvgRender.utils._logBase(r-r/2,t.logBase),e=ej.EjSvgRender.utils._logBase(r+r/2,t.logBase)),u=e-f,h=this.calculateLogNiceInterval(u,t),t.actual_Range={min:f,max:e,interval:h,Delta:u},f=Math.pow(t.logBase,Math.floor(s)),e=Math.pow(t.logBase,Math.ceil(o)),u=e-f,t.setRange?(ej.util.isNullOrUndefined(t.range.interval)&&(t.range.interval=h),ej.util.isNullOrUndefined(t.range.max)&&(t.range.max=e),ej.util.isNullOrUndefined(t.range.min)&&(t.range.min=f),t.actual_Range=n.extend(!0,{},t.range),ej.util.isNullOrUndefined(t.actual_Range.max)||(t.actual_Range.max=ej.EjSvgRender.utils._logBase(t.actual_Range.max,t.logBase),t.actual_Range.max=this._getRoundValue(t.actual_Range.max,1,!0)),ej.util.isNullOrUndefined(t.range.min)||(t.actual_Range.min=ej.EjSvgRender.utils._logBase(t.actual_Range.min,t.logBase),t.actual_Range.min=this._getRoundValue(t.actual_Range.min,1,!1)),t.setRange=!0,t.range):t.range={min:f,max:e,interval:h,Delta:u}},_calculateLogRange:function(n,t,i,r){n.zoomed||this._seriesMinMax(n,t,i,"logarithmic",r)},_calculateLogPadding:function(n,t,i){var r=i.min,u=i.max,f=i.interval;t.actualRange.min=r;t.actualRange.max=u;t.actualRange.interval=f;t.actualRange.delta=u-r;this._calculateVisibleRange(t)},_calculateVisibleRange:function(t,i,r){var e,u,f;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);var s=Math.abs(f-u),o=t.enableAutoIntervalOnZooming?this.calculateLogNiceInterval(s,t):t.visibleRange.interval,h=ej.util.isNullOrUndefined(t.roundingPlaces)?ej.EjSvgRender.utils._decimalPlaces(t.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(t.visibleRange.interval):t.roundingPlaces;if(o=parseFloat(t.visibleRange.interval.toFixed(h)),r)return{min:Math.min(u,f),max:Math.max(u,f),interval:o};t.visibleRange.interval=o;t.visibleRange.min=Math.min(u,f);t.visibleRange.max=Math.max(u,f);t.visibleRange.delta=s;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateAxisLabels:function(t,i){for(var e=i.roundingPlaces,o,u,s,f,r=t.zoomed||i.zoomed?i.visibleRange.min-i.visibleRange.min%i.visibleRange.interval:i.visibleRange.min;r<=i.visibleRange.max;r+=i.visibleRange.interval)ej.EjSvgRender.utils._inside(r,i.visibleRange)&&(o=i.labelFormat?i.labelFormat.match("{value}"):null,u=Math.pow(i.logBase,r),tempPlace=u.toString().split(0).length-1>10?10:20,u=parseFloat(u.toFixed(!e&&e>tempPlace?e:tempPlace)),s=i.labelFormat?o!=null?i.labelFormat.replace("{value}",u):ej.format(u,i.labelFormat,t.model.locale):u,f=n.extend({},ej.EjSvgRender.commonChartEventArgs),f.data={label:{Text:s,Value:r},axis:i},t._trigger("axesLabelRendering",f),i.visibleLabels.push({Value:r,Text:f.data.label.Text}));i._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(i,this.chartObj)},_calculateRanges:function(n,t,i,r){this.chartObj=n;this._calculateLogRange(n,t,i,r);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._calculateLogPadding(n,t,t.actual_Range);this._calculateAxisLabels(n,t)}});ej.axisTypes.logarithmic=u;f=t(ej.EjAxisRenderer,{_calculateCategoryRange:function(t,i){var b=this.chartObj.model.legendCollapsed==undefined?!this.chartObj.zoomed:this.chartObj.model.legendCollapsed,e,h,r,o,l,v;if(!this.chartObj.model.excludeDataUpdate||b){var u={maxX:null,minX:0},f=[],s,a,c,y,p=t.isIndexed,w=this.chartObj.model.locale;if(i.length>0&&this.chartObj.model._hasSeriesPoints&&i[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){for(e=0;e<i.length;e++){for(pointsLength=i[e].points.length,h=0;h<pointsLength;h++)s=i[e]._xAxisValueType=="date"?ej.format(new Date(i[e].points[h].x),ej.util.isNullOrUndefined(t.labelFormat)?"dd/MM/yyyy":t.labelFormat,w):i[e].points[h].x,p?f[h]=e==0?s:f[h]+", "+s:(y=n.inArray(s,f),y<0&&f.push(s));(!t.maxPointLength||t.maxPointLength<pointsLength)&&(t.maxPointLength=pointsLength)}for(r=0;r<i.length;r++){for(i[r]._pointCollection=[],o=0;o<i[r].points.length;o++)i[r]._pointCollection.push(i[r].points[o].x),s=i[r]._xAxisValueType=="date"?ej.format(new Date(i[r].points[o].x),ej.util.isNullOrUndefined(t.labelFormat)?"dd/MM/yyyy":t.labelFormat,w):i[r].points[o].x,i[r].points[o].xValue=p?o:n.inArray(s,f);i[r].minX=0;i[r].maxX=i[r]._xAxisValueType=="date"?i[r]._pointCollection.length-1:f.length-1;r==0&&(u.maxX=i[r].maxX,t.labels=i[r]._xAxisValueType=="date"?i[r]._pointCollection:f,t._categoryValueType=i[r]._xAxisValueType);u.maxX<i[r].maxX&&(u.maxX=i[r].maxX,t.labels=[],t.labels=f)}this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[t.name]&&(l=this.chartObj.model.indicatorRange[t.name],(u.minX>l.min||u.minX==null)&&(u.minX=l.min),(u.maxX<l.max||u.maxX==null)&&(u.maxX=l.max));u.minX==u.maxX&&t.labelPlacement&&t.labelPlacement.toLowerCase()=="onticks"&&(u.maxX+=1);c=u.maxX-u.minX;a=t.setRange&&t.range.interval?Math.ceil(t.range.interval):this._calculateActualInterval(c,t);t.range={min:u.minX,max:u.maxX,interval:a,Delta:c}}else v=t.labels.length,v>0?(c=v-1,a=this._calculateActualInterval(c,t),t.range={min:0,max:v-1,interval:a,Delta:c}):t.range||(t.range={min:0,max:6,interval:1,Delta:6})}},_calculateActualInterval:function(n,t){return t.categoryInterval==null?Math.max(1,Math.floor(n/this.GetActualDesiredIntervalsCount(t,t.length))):t.categoryInterval},_applyRangePadding:function(n){var t,i;this.chartObj.zoomed||this.chartObj._scrollBarEnabled||(t=0,this.chartObj.model.AreaType!=="polaraxes"&&(t=n.labelPlacement===null||n.labelPlacement===undefined||n.labelPlacement===""?-.5:n.labelPlacement.toLowerCase()=="betweenticks"?-.5:0),t<0?(n.range.min=n.range.min+t,n.range.max=n.range.max-t,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range):(i=_sideBySeriesPadding(this.chartObj,n.range.min,n.range.max,n),n.range.min=i.startPadding,n.range.max=i.endPadding,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range));this._calculateVisibleRange(n)},_calculateVisibleRange:function(t,i,r){var e,u,f,o;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);var o=Math.abs(f-u),s=this._calculateActualInterval(o,t),h=Math.min(u,f),c=Math.max(u,f);if(r)return{min:h,max:c,interval:s};o=Math.abs(f-u);t.visibleRange.interval=s;t.visibleRange.min=h;t.visibleRange.max=c;t.visibleRange.delta=o;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateAxisLabels:function(t){for(var f=t.visibleRange.interval,i=t.visibleRange.min-t.visibleRange.min%t.range.interval,u,r;i<=t.visibleRange.max;i+=f)ej.EjSvgRender.utils._inside(i,t.visibleRange)&&(u=Math.round(i),t.visibleLabels.push({Value:u,Text:ej.EjSvgRender.utils._getLabelContent(u,t,this.chartObj.model.locale)}),r=n.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={label:t.visibleLabels[t.visibleLabels.length-1],axis:t},this.chartObj._trigger("axesLabelRendering",r),t.visibleLabels[t.visibleLabels.length-1]=r.data.label);t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},_calculateRanges:function(n,t,i){this.chartObj=n;this._calculateCategoryRange(t,i);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._applyRangePadding(t);this._calculateAxisLabels(t)}});ej.axisTypes.category=f;e=t(ej.EjAxisRenderer,{_calculateDateTimeCategoryRange:function(t,i){for(var v={minX:0,MaxX:null},w=[],a=[],f,tt,nt,it,d,c,s,rt=[],e,o,h,l,g,r,p,b,ut,k,ft,y,u=0;u<i.length;u++){for(i[u]._pointCollection=[],s=[],i[u]._points=[],i[u]._xPoints=[],i[u]._yPoints=[],g=i[u].points.length,b=0;b<g;b++)s.push(new Date(i[u].points[b].x).getTime()),i[u]._xPoints.push(new Date(i[u].points[b].x).getTime()),i[u]._yPoints.push(i[u].points[b].y);for(s.sort(function(n,t){return n-t}),ej.isNullOrUndefined(t.intervalType)&&(d=this.calculateDateTimeNiceInterval(t,new Date(Math.min.apply(null,s)),new Date(Math.max.apply(null,s))),t.intervalType=d.intervalType.toLowerCase()),r=0;r<s.length;r++){if(f=new Date(s[r]),i[u]._points.push(f.getTime()),ut=n.inArray(s[r],i[u]._xPoints),i[u].points[r].y=i[u].points[r].YValues[0]=i[u]._yPoints[ut],i[u]._pointCollection.push(new Date(i[u].points[r].x)),u==0)i[u].points[r].xValue=r;else for(k=0;k<=u-1;k++)if(nt=n.inArray(new Date(i[u].points[r].x).getTime(),i[k]._points),nt>=0)i[u].points[r].xValue=nt;else if(k=u){i[u].points[r].xValue=t.maxPointLength-1+(r+1);break}if(tt=u==0?-1:n.inArray(f.getTime(),rt),tt<0){switch(t.intervalType){case"auto":w.push(f.getTime());break;case"years":o=f.getFullYear();break;case"months":l=f.getFullYear();e=f.getMonth();r<=0?o=r+1:(h=new Date(s[r-1]).getFullYear(),o+=l!=h?12-c+e:e-c);c=e;break;case"days":l=f.getMonth();e=f.getDate();r<=0?o=r+1:(h=new Date(s[r-1]).getMonth(),o+=l!=h?new Date(f.getFullYear(),h,0).getDate()-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),1),ft=new Date(f.getFullYear(),h,0).getDate(),o=y>ft?a[a.length-1]+1:o));c=e;break;case"hours":l=f.getDate();e=f.getHours();r<=0?o=r+1:(h=new Date(s[r-1]).getDate(),o+=l!=h?24-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),24),o=y>24?a[a.length-1]+1:o));c=e;break;case"minutes":l=f.getHours();e=f.getMinutes();r<=0?o=r+1:(h=new Date(s[r-1]).getHours(),o+=l!=h?60-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),1440),o=y>60?a[a.length-1]+1:o));c=e;break;case"seconds":l=f.getMinutes();e=f.getSeconds();r<=0?o=r+1:(h=new Date(s[r-1]).getMinutes(),o+=l!=h?60-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),86400),o=y>60?a[a.length-1]+1:o));c=e;break;case"milliseconds":l=f.getSeconds();e=f.getMilliseconds();r<=0?o=r+1:(h=new Date(s[r-1]).getSeconds(),o+=l!=h?1e3-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),864e5),o=y>1e3?a[a.length-1]+1:o));c=e}t.intervalType!="auto"&&w.push(f.getTime());a.push(o);rt.push(new Date(s[r]).getTime())}}(!t.maxPointLength||t.maxPointLength<g)&&(t.maxPointLength=g)}for(p=0;p<i.length;p++)t.setRange||(t.range={min:null,max:null,interval:null}),ej.isNullOrUndefined(t.m_minPointsDelta)||(t.m_minPointsDelta=undefined),i[p].minX=ej.isNullOrUndefined(t.range.min)?0:t.range.min<v.minX?0:t.range.min,i[p].maxX=ej.isNullOrUndefined(t.range.max)?w.length-1:t.range.max>w.length-1?w.length-1:t.range.max,p==0&&(v.MaxX=i[p].maxX,v.minX=i[p].minX,t.labels=w,t.dateLabels=a,t._categoryValueType="date");v.minX==v.MaxX&&t.labelPlacement.toLowerCase()=="onticks"&&(v.MaxX+=1);it=v.MaxX-v.minX;d=t.range.interval==null||t.range.interval==undefined?1:t.range.interval<1?1:Math.ceil(t.range.interval);t.range={min:v.minX,max:v.MaxX,interval:d,Delta:it}},_diffDate:function(n,t,i){var r,u;return r=864e5,u=Math.abs(n.getTime()-t.getTime())/r,Math.round(u*i)},_calculateAxisLabels:function(t){for(var u=t.visibleRange.interval,y=[],a=0,f,r,i,s,h,p,e,v,c,l,o=t.visibleRange.min-t.visibleRange.min%t.range.interval;o<=t.visibleRange.max;o+=u)if(ej.EjSvgRender.utils._inside(o,t.visibleRange)){if(r=Math.round(o),i=t.dateLabels,t.intervalType!="auto"&&a>0&&u>1)if(r>i.length-1&&(r=i.length-1),s=i[a],h=f+u,v=n.inArray(s,i),c=n.inArray(h,i),v>0&&Math.abs(s-f)==u&&s>f)r=v,f=i[r];else for(e=0;e<e+1;e++)if(h+=e==0?e:1,c=n.inArray(h,i),c>0){r=c;f=i[r];break}a++;ej.util.isNullOrUndefined(i)||(i[i.length-1]-i[r]>=u&&t.visibleRange.max<o+u&&(t.visibleRange.max+=o+u-t.visibleRange.max),p=n.inArray(i[r],y));(p<0||t.intervalType=="auto")&&r<t.labels.length&&(t.intervalType!="auto"&&(f=i[r],y.push(f)),t.visibleLabels.push({Value:r,Text:ej.EjSvgRender.utils._getLabelContent(r,t,this.chartObj.model.locale)}),l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={label:t.visibleLabels[t.visibleLabels.length-1],axis:t},this.chartObj._trigger("axesLabelRendering",l),t.visibleLabels[t.visibleLabels.length-1]=l.data.label)}t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},_calculateActualInterval:function(n,t){return t.categoryInterval==null?Math.max(1,Math.floor(n/this.GetActualDesiredIntervalsCount(t,t.length))):t.categoryInterval},_applyRangePadding:function(n){var t,i;this.chartObj.zoomed||this.chartObj._scrollBarEnabled||(t=0,this.chartObj.model.AreaType!=="polaraxes"&&(t=n.labelPlacement===null||n.labelPlacement===undefined?-.5:n.labelPlacement.toLowerCase()=="betweenticks"?-.5:0),t<0?(n.range.min=n.range.min+t,n.range.max=n.range.max-t,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range):(i=_sideBySeriesPadding(this.chartObj,n.range.min,n.range.max,n),n.range.min=i.startPadding,n.range.max=i.endPadding,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range));this._calculateVisibleRange(n)},_calculateVisibleRange:function(t,i,r){var e,u,f,o;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);var o=Math.abs(f-u),s=this._calculateActualInterval(o,t),h=Math.min(u,f),c=Math.max(u,f);if(r)return{min:h,max:c,interval:s};o=Math.abs(f-u);t.visibleRange.interval=s;t.visibleRange.min=h;t.visibleRange.max=c;t.visibleRange.delta=o;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateRanges:function(n,t,i){this.chartObj=n;this._calculateDateTimeCategoryRange(t,i);this._applyRangePadding(t);this._calculateAxisLabels(t)}});ej.axisTypes.datetimecategory=e;ej.EjAxisRenderer.prototype={_drawGridLines:function(n,t,i){this.model.AreaType=="cartesianaxes"?t.orientation.toLowerCase()=="horizontal"?this._drawXAxisGridLine(n,t,i):this._drawYAxisGridLine(n,t,i):t.orientation.toLowerCase()=="horizontal"&&n==0?(this._drawPolarGridLine(t),this._drawPolarLabels(t)):n==1&&this._drawPolarCircle(t)},_drawAxes:function(n,t){this.model.AreaType=="cartesianaxes"&&(t.visible&&t.orientation.toLowerCase()=="horizontal"&&(this._drawXAxisLabels(n,t),this._drawXTitle(n,t)),t.visible&&t.orientation.toLowerCase()=="vertical"&&(this._drawYAxisLabels(n,t),this._drawYTitle(n,t)))},_getSharpPath:function(n){return n%2==0?0:.5},_drawAxisLine:function(t){var u=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLine"}),h=ej.EjSvgRender.utils._getStringBuilder(),v=this.model.centerX,y=this.model.centerY,p=this.model.centerX,w=this.model.centerY-this.model.Radius,b="M "+v+" "+y+" L "+p+" "+w,f,i;if(t.visible&&t.axisLine.visible&&(f={id:this.svgObject.id+"_YAxisLines",fill:"none","stroke-width":t.axisLine.width,stroke:t.axisLine.color,opacity:t.axisLine.opacity,"stroke-dasharray":t.axisLine.dashArray,d:b},this.svgRenderer.drawPath(f,u),n(u).appendTo(this.gPolarAxisEle)),t.visible&&t.majorTickLines.visible){for(u=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisMajorTicks"}),i=0;i<t.visibleLabels.length;i++){var k=t.visibleLabels[i],c=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,k.Value,this),r={};r.X1=this.model.centerX;r.Y1=this.model.centerY-c;r.X2=r.X1-t.majorTickLines.size;r.Y2=r.Y1;h.append("M "+r.X1+" "+r.Y1+" L "+r.X2+" "+r.Y2+" ")}yMajorTickDir=h.toString();f={id:this.svgObject.id+"_YAxisMajorTicks",fill:"none","stroke-width":t.majorTickLines.width,stroke:t.majorTickLines.color,d:yMajorTickDir};this.svgRenderer.drawPath(f,u);n(u).appendTo(this.gPolarAxisEle)}if(t.visible){var u=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLabels"}),e=t.font,l,a,d=t.visibleLabels.length;for(i=0;i<d;i++){var c=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[i].Value,this),s=t.visibleLabels[i].Text,o=ej.EjSvgRender.utils._measureText(s,null,t.font),g=this.model.centerX-t.majorTickLines.size-this.model.elementSpacing/3,nt=this.model.centerY-c+o.height/5,f={id:this.svgObject.id+"_"+t.name+"_YLabel_"+i,x:g,y:nt,fill:e.color,"font-size":e.size,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,opacity:e.opacity,"text-anchor":"end"};this.svgRenderer.drawText(f,s,u);a=f.x-o.width;l={x:a,y:f.y,width:o.width,height:o.height};t.visibleLabels[i].region={bounds:l,labelText:s}}n(u).appendTo(this.gPolarAxisEle)}},_drawPolarLabels:function(t){var u,i,h,s;if(!t.visible)return 0;var v=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels"}),y=this.model.Radius+t.majorTickLines.size,e=t.font,p=t.visibleLabels.length,w,b,k,l;for(u=0;u<p;u++)if(i=ej.EjSvgRender.utils._valueToPolarCoefficient(t,t.visibleLabels[u].Value),h=ej.EjSvgRender.utils._valueToVector(t,t.visibleLabels[u].Value),!isNaN(h.X)&&!isNaN(h.Y)){var c=t.visibleLabels[u].Text,r=this.model.centerX+y*h.X,o=this.model.centerY+y*h.Y,a=r<this.model.centerX?"end":r>this.model.centerX?"start":"middle",f=ej.EjSvgRender.utils._measureText(c,this.model.m_AreaBounds.Height,t.font);i==.25?(r-=this.model.elementSpacing/2,o+=f.height/4):i==.5?o+=f.height:i==.75?(r+=this.model.elementSpacing/2,o+=f.height/4):i==1||i==0?o-=f.height/2:.25<i&&i<.5?(r-=this.model.elementSpacing/2,o+=f.height/2):.5<i&&i<=.75?(r+=this.model.elementSpacing/2,o+=f.height/2):0<i&&i<.25?r-=this.model.elementSpacing/2:r+=this.model.elementSpacing/2;u==0&&(w=r);u==p-1&&t._valueType!="category"&&(l=ej.EjSvgRender.utils._measureText(c,null,e).width,l+=r,l>w&&(c=""));s={id:this.svgObject.id+"_"+t.name+"_XLabel_"+u,x:r,y:o,fill:e.color,"font-size":e.size,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,opacity:e.opacity,"text-anchor":a};this.svgRenderer.drawText(s,c,v);k=a=="middle"?s.x-f.width/2:a=="end"?s.x-f.width:s.x;b={x:k,y:s.y,width:f.width,height:f.height};t.visibleLabels[u].region={bounds:b,labelText:c}}n(v).appendTo(this.gXaxisEle)},_drawPolarCircle:function(t){var s,o,i,h,u,f,r,e,l,a,v,c;if(t.majorGridLines.visible)if(s=ej.EjSvgRender.utils._getStringBuilder(),o=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisGrid"}),this.model.isPolar)for(i=0;i<t.visibleLabels.length;i++){var h=t.visibleLabels[i],u=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,h.Value,this),c={id:this.svgObject.id+"_YAxisGridLines_"+i,cx:this.model.centerX,cy:this.model.centerY,r:u,fill:"transparent","stroke-width":t.majorGridLines.width,stroke:t.majorGridLines.color,opacity:this.vmlRendering?.3:t.majorGridLines.opacity};this.svgRenderer.drawCircle(c,o)}else{for(i=0;i<t.visibleLabels.length;i++)for(h=t.visibleLabels[i],u=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,h.Value,this),f=0;f<this.model._axes[0].visibleLabels.length;f++)r=this.model._axes[0],e=ej.EjSvgRender.utils._valueToVector(r,r.visibleLabels[f].Value),isNaN(e.X)||isNaN(e.Y)||(l=f+1<r.visibleLabels.length?ej.EjSvgRender.utils._valueToVector(r,r.visibleLabels[f+1].Value):ej.EjSvgRender.utils._valueToVector(r,r.visibleLabels[0].Value),a={X:this.model.centerX+u*e.X,Y:this.model.centerY+u*e.Y},v={X:this.model.centerX+u*l.X,Y:this.model.centerY+u*l.Y},s.append("M "+a.X+" "+a.Y+" L "+v.X+" "+v.Y+" "));t.majorGridLines.visible&&(yMajorGridDir=s.toString(),c={id:this.svgObject.id+"_YAxisGridLines",fill:"none","stroke-width":t.majorGridLines.width,stroke:t.majorGridLines.color,opacity:t.majorGridLines.opacity,"stroke-dasharray":t.majorGridLines.dashArray,d:yMajorGridDir},this.svgRenderer.drawPath(c,o))}n(o).appendTo(this.gYaxisEle)},_drawPolarGridLine:function(t){var i=this.model,o=i.legend,ft=ej.EjSvgRender.utils._measureText(o.title.text,null,o.title.font).height,e=o.position.toLowerCase(),a=0,k=0,d=ej.EjSvgRender.utils._getStringBuilder(),g=ej.EjSvgRender.utils._getStringBuilder(),nt=o.border.width,v,y,p,u,r,tt=t.visibleLabels.length,it=i.border.width,s=i.title,h=i.title.subTitle,rt=s.enableTrim&&(s.textOverflow=="wrap"||s.textOverflow=="wrapandtrim")?!0:!1,ut=h.text!=""&&h.visible&&h.enableTrim&&(h.textOverflow=="wrap"||h.textOverflow=="wrapandtrim")?!0:!1,c,et,w,f,b,l;if(o.visible&&e!="custom"&&(e=="right"||e=="left"?a=(e=="right"?i.margin.right:i.margin.left)+i.LegendActualBounds.Width+(nt+it)*2:k=(e=="top"?i.margin.top:i.margin.bottom)+i.LegendActualBounds.Height+ft+(nt+it)*2),v=(i.title.text&&i.title.visible?i._titleLocation.Y+(rt?i._titleLocation.size.height:0)+(ut?i._subTitleLocation.size.height:0):0)+k,y=i.svgWidth-a,p=i.svgHeight-v,i.centerX=y*.5+(e==="left"?a:0),i.centerY=p*.5+(e==="top"?v:s.text&&s.visible?i._titleLocation.Y+(rt?i._titleLocation.size.height:0)+(ut?i._subTitleLocation.size.height:0):0),c=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisGrid"}),i.finalSize={width:y,height:p},i.Radius=Math.min(i.finalSize.width,i.finalSize.height)/2-2*i.elementSpacing-t.majorTickLines.size-t._LableMaxWidth.maxHeight,et=0,t.majorGridLines.visible)for(f=0;f<tt;f++)u=ej.EjSvgRender.utils._valueToVector(t,t.visibleLabels[f].Value),r={},r.X1=i.centerX,r.Y1=i.centerY,r.X2=i.centerX+i.Radius*u.X,r.Y2=i.centerY+i.Radius*u.Y,d.append("M "+r.X1+" "+r.Y1+" L "+r.X2+" "+r.Y2+" ");if(t.visible&&t.majorTickLines.visible)for(w=i.Radius,f=0;f<tt;f++)u=ej.EjSvgRender.utils._valueToVector(t,t.visibleLabels[f].Value),r={},r.X1=i.centerX+w*u.X,r.Y1=i.centerY+w*u.Y,r.X2=r.X1+t.majorTickLines.size*u.X,r.Y2=r.Y1+t.majorTickLines.size*u.Y,b="M "+r.X1+" "+r.Y1+" L "+r.X2+" "+r.Y2+" ",b.indexOf("NaN")==-1&&g.append(b);t.majorGridLines.visible&&(xMajorGridDir=d.toString(),l={id:this.svgObject.id+"_XAxisGridLines",fill:"none","stroke-width":t.majorGridLines.width,stroke:t.majorGridLines.color,opacity:t.majorGridLines.opacity,"stroke-dasharray":t.majorGridLines.dashArray,d:xMajorGridDir},xMajorGridDir.indexOf("NaN")==-1&&(this.svgRenderer.drawPath(l,c),n(c).appendTo(this.gXaxisEle)));t.visible&&t.majorTickLines.visible&&(xMajorTickDir=g.toString(),l={id:this.svgObject.id+"_XAxisMajorTicks",fill:"none","stroke-width":t.majorTickLines.width,stroke:t.majorTickLines.color,d:xMajorTickDir},this.svgRenderer.drawPath(l,c),n(c).appendTo(this.gXaxisEle))},_drawXAxisTickLine:function(t,i,r,u){var vt,yt,ft=ej.EjSvgRender.utils._getStringBuilder(),pt=ej.EjSvgRender.utils._getStringBuilder(),nt,h=Math.floor(i.x),oi=Math.floor(i.x+i.width),o=i._opposed,et,c=[],wt=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),k=i.labelBorder,ot,f,tt,it,y,e,p,a,ii,rt,ht,b,s,ct,v,l,ti,lt,at;for(isCrossesAt=u.axes[i.name]._validCross,t==0||isCrossesAt||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?t==0||isCrossesAt||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?f=ot=i._y?i.showNextToAxisLine?i.y:i._y:Math.floor(i.y+i.majorTickLines.size-5):(f=o?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size),ot=o?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size)):(f=o?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),ot=o?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height)),r||(tt=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisTicklines_"+t})),i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,it=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,y=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&it<0&&(y=y>0?i.visibleLabels.length+1:y),e=0;e<y;e++)if(et=i.visibleLabels[e]?i.visibleLabels[e].Value:i.visibleLabels[e-1].Value+i.range.interval,p=i.labels.length>0&&it<0?et+it:et,p=i.roundingPlaces?p:parseFloat(p.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(p,i.visibleRange)){if(i.hidePartialLabels&&(e==0||e==y-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(a=this._getSharpPath(i.minorTickLines.width),ii=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){s=p;var bt=i.visibleRange.max,st=i.visibleRange.min,kt=Math.pow(i.logBase,s-i.visibleRange.interval),ri=Math.pow(i.logBase,s),ui=(ri-kt)/(i.minorTicksPerInterval+1),fi=kt+ui;for(s=ej.EjSvgRender.utils._logBase(fi,i.logBase),b=0;b<i.minorTicksPerInterval;b++)s<bt&&s>st&&(nt=Math.ceil((s-st)/(bt-st)*i.width),i.minorTickLines&&i.minorTickLines.visible&&(ht=Math.floor(nt+h),rt=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?Math.floor(f-i.minorTickLines.size):Math.floor(i.minorTickLines.size+f):o?Math.floor(f+i.minorTickLines.size):f-Math.floor(i.minorTickLines.size),ft.append("M "+(ht+a)+" "+(rt+a)+" L "+(ht+a)+" "+(f+a)+" ")))}else for(b=0,s=p;b<i.minorTicksPerInterval;b++)s+=i.visibleRange.interval/(i.minorTicksPerInterval+1),s<i.visibleRange.max&&s>i.visibleRange.min&&(nt=Math.ceil((s-i.visibleRange.min)/(i.visibleRange.max-i.visibleRange.min)*i.width),i.minorTickLines&&i.minorTickLines.visible&&(rt=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?Math.floor(f-i.minorTickLines.size):Math.floor(i.minorTickLines.size+f):o?Math.floor(f+i.minorTickLines.size):Math.floor(f-i.minorTickLines.size),ct=Math.floor(nt+h),ft.append("M "+(ct+a)+" "+(rt+a)+" L "+(ct+a)+" "+(f+a)+" ")));if(i.majorTickLines.visible||i.majorGridLines.visible||k.width>0){var ut=this._getSharpPath(i.majorTickLines.width),si=this._getSharpPath(i.majorGridLines.width),dt=c[e]=this.pointX=Math.ceil(ej.EjSvgRender.utils._getPointXY(p,i.visibleRange,i.isInversed)*i.width);i.majorTickLines.visible&&(v=i.majorTickLines.size+i.axisLine.width/2,l=i.tickLinesPosition=="inside"&&i.labelPosition=="inside"||i.tickLinesPosition=="inside"&&i.labelPosition!="inside"?o?f+v:f-v:(o?f-v:v+f)-(wt?o?this.model.scrollerSize:-this.model.scrollerSize:0),pt.append("M "+(Math.floor(dt+h)+ut)+" "+(Math.floor(l)+ut)+" L "+(Math.floor(dt+h)+ut)+" "+(Math.floor(f+(o?-i.axisLine.width/2:i.axisLine.width/2))+ut)+" "))}}if(k.width>0){var w=ej.EjSvgRender.utils._getStringBuilder(),gt=wt?this.model.scrollerSize:0,v=i.axisLine.width,l,e,d,ni=i.labelPosition.toLowerCase(),hi=this.model.m_AreaBounds.X,ci=this.model.m_AreaBounds.Width,ei=k.width,g=i._LableMaxWidth.height+i.axisLine.width/2+2,y=i.visibleLabels.length;for(i.tickLinesPosition==ni&&(g+=i.majorTickLines.size),ni=="inside"?(l=o?f+v:f+v,endY=o?f+g:f-g):(l=o?f-v:v+f+(i.zoomFactor<1&&this.model.zooming.enableScrollbar&&t==0?this.model.scrollerSize:0),endY=o?f-g-gt:f+g+gt),e=0;e<y;e++)d=(c[c.length-1]-c[c.length-2])/2,!ej.util.isNullOrUndefined(c[e])&&c.length>=1&&!isNaN(d)&&(i._valueType=="category"&&i.labelPlacement.toLowerCase()=="betweenticks"?(startX=c[e]+h,endX=c[e]+d*2+h):(startX=c[e]-d+h,endX=c[e]+d+h),endX=Math.floor(endX),endY=Math.floor(endY),startX=Math.floor(startX),l=Math.floor(l),startX<i.x?w.append("M "+Math.floor(h)+" "+endY+" L "+endX+" "+endY+" "):endX>i.width+i.x?(w.append("M "+startX+" "+l+" L "+startX+" "+endY+" L "+Math.floor(i.width+h)+" "+endY+" "),endX-ei<=i.width+i.x&&w.append("M "+Math.floor(i.width+h)+" "+endY+" L "+(i.x+i.width)+" "+l)):(e==0&&w.append("M "+i.x+" "+endY+" L "+startX+" "+endY+" "),w.append("M "+startX+" "+l+" L "+startX+" "+endY+" L "+endX+" "+endY+" "),e==y-1&&w.append("M "+endX+" "+l+" L "+endX+" "+endY+" M "+endX+" "+endY+" L "+(i.x+i.width)+" "+endY)));ti={id:this.svgObject.id+"_XAxisLabelBorder_"+t,fill:"transparent","stroke-width":k.width,stroke:k.color,d:w.toString()};this.svgRenderer.drawPath(ti,r);n(r).appendTo(this.gXaxisEle)}i.minorTickLines.visible&&i.visible&&i.minorTicksPerInterval>0&&(yt=ft.toString(),lt={id:this.svgObject.id+"_XAxisMinorTicks_"+t,fill:"none","stroke-width":i.minorTickLines.width,stroke:i.minorTickLines.color,d:yt},r?this.svgRenderer.drawPath(lt,r):this.svgRenderer.drawPath(lt,tt));i.majorTickLines.visible&&i.visible&&(vt=pt.toString(),at={id:this.svgObject.id+"_XAxisMajorTicks_"+t,fill:"none","stroke-width":i.majorTickLines.width,stroke:i.majorTickLines.color,d:vt},r?this.svgRenderer.drawPath(at,r):this.svgRenderer.drawPath(at,tt));i.tickLinesPosition=="inside"&&n(tt).appendTo(this.gXaxisEle)},_drawXAxisGridLine:function(t,i,r){var ct,lt,ut=ej.EjSvgRender.utils._getStringBuilder(),at=ej.EjSvgRender.utils._getStringBuilder(),w,f=[],vt=this.model.elementSpacing+5,ft,l=i._opposed,b=Math.floor(i.x),ni=Math.floor(i.x+i.width),d=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisGrid_"+t}),g=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisAlternateGridBand_"+t}),yt=r.axes[i.name]._validCross,a,k,tt,s,c,ii,h,st,p,o,it,rt,dt,u,e,gt,ht;if(t==0||yt||i.labelPosition!="inside"||i.tickLinesPosition!="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?i.labelPosition!="inside"||i.tickLinesPosition=="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?t==0||yt||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?(a=Math.floor(i.y),k=Math.floor(i.y)):(a=l?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size),k=l?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size)):a=k=l?Math.floor(i.y-i._LableMaxWidth.height)+vt:i.showNextToAxisLine?Math.floor(i.y+i._LableMaxWidth.height)-vt:Math.floor(i.y+i._LableMaxWidth.height):(a=l?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),k=l?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height)),i.visible&&i.axisLine.visible){var pt=i.axisLine.offset>0?i.axisLine.offset:0,nt=this._getSharpPath(i.axisLine.width),ti={id:this.svgObject.id+"_XAxisLine_"+t,x1:b-i.plotOffset+nt+pt,y1:a+nt,x2:ni+i.plotOffset-pt+nt,y2:k+nt,"stroke-dasharray":i.axisLine.dashArray,"stroke-width":i.axisLine.width,stroke:i.axisLine.color,opacity:i.axisLine.opacity||1};r.axes[i.name]._lineOption=[ti,this.gXaxisEle]}else r.axes[i.name]._lineOption=[null,this.gXaxisEle];for(i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,tt=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,s=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&tt<0&&(s=s>0?i.visibleLabels.length+1:s),u=0;u<s;u++)if(ft=i.visibleLabels[u]?i.visibleLabels[u].Value:i.visibleLabels[u-1].Value+i.range.interval,c=i.labels.length>0&&tt<0?ft+tt:ft,c=i.roundingPlaces?c:parseFloat(c.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(c,i.visibleRange)){if(i.hidePartialLabels&&(u==0||u==s-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(ii=this._getSharpPath(i.minorTickLines.width),h=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){o=c;var wt=i.visibleRange.max,et=i.visibleRange.min,bt=Math.pow(i.logBase,o-i.visibleRange.interval),ri=Math.pow(i.logBase,o),kt=(ri-bt)/(i.minorTicksPerInterval+1),ot=bt+kt;for(o=ej.EjSvgRender.utils._logBase(ot,i.logBase),p=0;p<i.minorTicksPerInterval;p++)o<wt&&o>et&&(w=Math.ceil((o-et)/(wt-et)*i.width),i.minorGridLines&&i.minorGridLines.visible&&(st=Math.floor(w+b),ut.append("M "+(st+h)+" "+(a+h)+" L "+(st+h)+" "+(Math.floor(l?this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height:this.model.m_AreaBounds.Y)+h)+" "))),ot+=kt,o=ej.EjSvgRender.utils._logBase(ot,i.logBase)}else for(p=0,o=c;p<i.minorTicksPerInterval;p++)o+=i.visibleRange.interval/(i.minorTicksPerInterval+1),o<i.visibleRange.max&&o>i.visibleRange.min&&(w=Math.ceil((o-i.visibleRange.min)/(i.visibleRange.max-i.visibleRange.min)*i.width),i.minorGridLines&&i.minorGridLines.visible&&ut.append("M "+(Math.floor(w+b)+h)+" "+(a+h)+" L "+(Math.floor(w+b)+h)+" "+(Math.floor(l?this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height:this.model.m_AreaBounds.Y)+h)+" "));if(i.majorTickLines.visible||i.majorGridLines.visible){var fi=this._getSharpPath(i.majorTickLines.width),v=this._getSharpPath(i.majorGridLines.width),ui=this.pointX=Math.ceil(ej.EjSvgRender.utils._getPointXY(c,i.visibleRange,i.isInversed)*i.width),y=Math.floor(ui+b);if(i.zoomed&&(f[0]=i.x),u==0&&y==Math.floor(this.model.m_AreaBounds.X)){f.push(y+v);continue}if(u==s-1&&this.model.chartArea.border.color!="transparent"&&this.model.chartArea.border.width>0){if(y==Math.floor(this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width))continue;i.zoomed&&(f[s]=y+v)}if(i.majorGridLines.visible&&at.append("M "+(y+v)+" "+(Math.floor(this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height)+v)+" L "+(y+v)+" "+(Math.floor(this.model.m_AreaBounds.Y)+v)+" "),i._valueType.toLowerCase()!="category"&&u==s-1)continue;f.push(y+v)}}if(i.alternateGridBand.odd.fill!="transparent"||i.alternateGridBand.even.fill!="transparent"){for(it=this.model.m_AreaBounds.Height,f.length===0&&(rt={id:this.svgObject.id+"_XAxis"+t+"_Alternateeven0",x:i.x,y:Math.floor(this.model.m_AreaBounds.Y),width:i.width,height:it,fill:i.alternateGridBand.even.fill,opacity:i.alternateGridBand.even.opacity,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",stroke:"transparent"},this.svgRenderer.drawRect(rt,g)),u=1;u<f.length;u+=2)e=f[u+1]-f[u],e=e||i.labelPlacement.toLowerCase()=="onticks"?e:i.width+i.x-f[u],u==f.length-1&&i.zoomed&&(e=this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width-f[f.length-1]-i.plotOffset),dt={id:this.svgObject.id+"_XAxis"+t+"_Alternateodd"+[u],x:f[u],y:Math.floor(this.model.m_AreaBounds.Y),width:e,height:it,fill:i.alternateGridBand.odd.fill,opacity:i.alternateGridBand.odd.opacity,stroke:"transparent","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},e>0&&this.svgRenderer.drawRect(dt,g);for(u=0;u<f.length;u+=2)e=f[u+1]-f[u],e=e||i.labelPlacement.toLowerCase()=="onticks"?e:i.width+i.x-f[u],u==0&&i.zoomed&&(e=f[1]-i.x),u==f.length-1&&i.zoomed&&(e=this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width-f[f.length-1]-i.plotOffset),rt={id:this.svgObject.id+"_XAxis"+t+"_Alternateeven"+[u],x:f[u],y:Math.floor(this.model.m_AreaBounds.Y),width:e,height:it,fill:i.alternateGridBand.even.fill,opacity:i.alternateGridBand.even.opacity,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",stroke:"transparent"},e>0&&this.svgRenderer.drawRect(rt,g);n(g).appendTo(d)}i.minorGridLines.visible&&i.minorTicksPerInterval>0&&(lt=ut.toString(),gt={id:this.svgObject.id+"_XAxisMinorGridLines_"+t,fill:"none","stroke-width":i.minorGridLines.width,stroke:i.minorGridLines.color,"stroke-dasharray":i.minorGridLines.dashArray,d:lt},this.svgRenderer.drawPath(gt,d));ct=at.toString();i.majorGridLines.visible&&(ht={id:this.svgObject.id+"_XAxisMajorGridLines_"+t,fill:"none","stroke-width":i.majorGridLines.width,stroke:i.majorGridLines.color,opacity:i.majorGridLines.opacity,"stroke-dasharray":i.majorGridLines.dashArray,d:ct},ht.d!=""&&this.svgRenderer.drawPath(ht,d));n(d).appendTo(this.svgObject)},_drawYAxisTickLine:function(t,i,r,u){var at="",vt="",et=0,yt=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),o=i._opposed,ot,c=[],rt=i.labelBorder,st,e,ut,y,v,b,l,ii,k,s,ft,nt,ui,d,f,gt,ni,ti;t==1||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?t==1||u||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?e=st=i.showNextToAxisLine?!i.showNextToAxisLine&&i.tickLinesPosition=="inside"?i.x+i.majorTickLines.size:i.x:i._x:(e=Math.floor(i.x+i.majorTickLines.size),st=Math.floor(i.x+i.majorTickLines.size)):(e=!o&&!u?Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing):i.showNextToAxisLine?i.x:Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing),st=!o&&!u?Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing):i.showNextToAxisLine?i.x:Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing));var h=Math.floor(i.y+i.height),fi=Math.floor(i.y),ht=ej.EjSvgRender.utils._getStringBuilder(),pt=ej.EjSvgRender.utils._getStringBuilder(),ei=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTicklines_"+t});for(i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,ut=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,y=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&ut<0&&(y=y>0?i.visibleLabels.length+1:y),f=0;f<y;f++)if(ot=i.visibleLabels[f]?i.visibleLabels[f].Value:i.visibleLabels[f-1].Value+i.range.interval,v=i.labels.length>0&&ut<0?ot+ut:ot,v=i.roundingPlaces?v:parseFloat(v.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(v,i.visibleRange)){if(i.hidePartialLabels&&(f==0||f==i.visibleLabels.length-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(l=this._getSharpPath(i.minorTickLines.width),ii=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){s=v;var wt=i.visibleRange.max,ct=i.visibleRange.min,bt=Math.pow(i.logBase,s-i.visibleRange.interval),ri=Math.pow(i.logBase,s),kt=(ri-bt)/(i.minorTicksPerInterval+1),lt=bt+kt;for(s=ej.EjSvgRender.utils._logBase(lt,i.logBase),k=0;k<i.minorTicksPerInterval;k++)s<wt&&s>ct&&(b=Math.ceil((s-ct)/(wt-ct)*i.height),i.minorTickLines&&i.minorTickLines.visible&&i.minorTickLines.visible&&(ft=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?i.minorTickLines.size:-i.minorTickLines.size:o?-i.minorTickLines.size:i.minorTickLines.size,ht.append("M "+(Math.floor(ft+e)+l)+" "+(Math.floor(b*-1+h)+l)+" L "+(e+l)+" "+(Math.floor(b*-1+h)+l)+" "))),lt+=kt,s=ej.EjSvgRender.utils._logBase(lt,i.logBase)}else for(k=0,s=v;k<i.minorTicksPerInterval;k++)s+=i.visibleRange.interval/(i.minorTicksPerInterval+1),s<i.visibleRange.max&&s>i.visibleRange.min&&(b=(s-i.visibleRange.min)/i.visibleRange.delta*i.height,i.minorTickLines.visible&&(ft=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?i.minorTickLines.size:-i.minorTickLines.size:o?-i.minorTickLines.size:i.minorTickLines.size,ht.append("M "+(Math.floor(ft+e)+l)+" "+(Math.floor(b*-1+h)+l)+" L "+(e+l)+" "+(Math.floor(b*-1+h)+l)+" ")));(i.majorTickLines.visible||i.majorGridLines.visible||rt.width>0)&&(nt=this._getSharpPath(i.minorTickLines.width),ui=this._getSharpPath(i.majorGridLines.width),et=c[f]=ej.EjSvgRender.utils._getPointXY(v,i.visibleRange,i.isInversed)*i.height,i.majorTickLines.visible&&(i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?d=(o?i.majorTickLines.size+i.axisLine.width/2:-(i.majorTickLines.size+i.axisLine.width/2))+(yt?o?this.model.scrollerSize:o-this.model.scrollerSize:0):(i.tickLinesPosition=="inside"&&i.labelPosition!="inside"||i.tickLinesPosition=="inside"&&i.labelPosition=="inside")&&(d=o?-(i.majorTickLines.size+i.axisLine.width/2):i.majorTickLines.size+i.axisLine.width/2),pt.append("M "+(Math.floor(d+e)+nt)+" "+(Math.floor(et*-1+h)+nt)+" L "+(Math.floor(e+(o?i.axisLine.width/2:i.axisLine.width/2))+nt)+" "+(Math.floor(et*-1+h)+nt)+" ")))}if(rt.width>0){var tt=ej.EjSvgRender.utils._getStringBuilder(),d=i.axisLine.width/2,f,p,w,a,it,dt=yt?this.model.scrollerSize:0,g=i._LableMaxWidth.maxWidth+10;for(i.tickLinesPosition==i.labelPosition&&(g+=i.majorTickLines.size),a=Math.floor(e-g),a=i.labelPosition=="outside"?o?Math.floor(e+g)+dt:Math.floor(e-g)-dt:o?Math.floor(e-g):Math.floor(e+g),f=0;f<y;f++)it=(c[c.length-1]-c[c.length-2])/2,!ej.util.isNullOrUndefined(c[f])&&c.length>1&&!isNaN(it)&&(i._valueType=="category"&&i.labelPlacement.toLowerCase()=="betweenticks"?(p=Math.floor(c[f]*-1+h),w=Math.floor(c[f]*-1-it*2+h)):(p=Math.floor(c[f]*-1+it+h),w=Math.floor(c[f]*-1-it+h)),p>h?tt.append("M "+a+" "+h+" L "+a+" "+w+" "):w<this.model.m_AreaBounds.Y?tt.append("M "+Math.floor(d+e)+" "+p+" L "+a+" "+p+" L "+a+" "+this.model.m_AreaBounds.Y+" "):(tt.append("M "+Math.floor(d+e)+" "+p+" L "+a+" "+p+" L "+a+" "+w+" "),f==y-1&&tt.append("M "+Math.floor(d+e)+" "+w+" L "+a+" "+w+" ")));gt={id:this.svgObject.id+"_YAxisLabelBorder_"+t,fill:"none","stroke-width":rt.width,stroke:rt.color,d:tt.toString()};this.svgRenderer.drawPath(gt,r);n(r).appendTo(this.gYaxisEle)}i.minorTickLines.visible&&i.visible&&i.minorTicksPerInterval>0&&(vt=ht.toString(),ni={id:this.svgObject.id+"_YAxisMinorTicks_"+t,fill:"none","stroke-width":i.minorTickLines.width,stroke:i.minorTickLines.color,d:vt},this.svgRenderer.drawPath(ni,r));i.majorTickLines.visible&&i.visible&&(at=pt.toString(),ti={id:this.svgObject.id+"_YAxisMajorTicks_"+t,fill:"none","stroke-width":i.majorTickLines.width,stroke:i.majorTickLines.color,d:at},this.svgRenderer.drawPath(ti,r))},_drawYAxisGridLine:function(t,i,r){var ht="",ct="",lt=0,nt,s=Math.floor(i.y+i.height),ii=Math.floor(i.y),b=i._opposed,f=[],tt=i.name.replace(/[^a-zA-Z0-9]/g,""),at=r.axes[tt]._validCross,k,d,pt,ut,wt,h,v,ui,o,y,e,ei,c,ot,gt,u,a,p,ni,ti,st;t==1||at||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?t==1||at||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?(k=Math.floor(i.x),d=Math.floor(i.x)):(k=b?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size),d=b?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size)):(k=b?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing),d=b?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing));var it=ej.EjSvgRender.utils._getStringBuilder(),vt=ej.EjSvgRender.utils._getStringBuilder(),w=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisGrid_"+t}),rt=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisAlternateGridBand_"+t});if(i.visible&&i.axisLine.visible){var yt=i.axisLine.offset>0?i.axisLine.offset:0,g=this._getSharpPath(i.axisLine.width),ri={id:this.svgObject.id+tt+"_YAxisLine_"+t,x1:k+g,y1:ii-i.plotOffset+yt+g,x2:d+g,y2:s+i.plotOffset-yt+g,"stroke-width":i.axisLine.width,"stroke-dasharray":i.axisLine.dashArray,stroke:i.axisLine.color,opacity:i.axisLine.opacity||1};r.axes[i.name]._lineOption=[ri,this.gYaxisEle]}else r.axes[i.name]._lineOption=[null,this.gYaxisEle];for(i.axisBottomLine&&i.axisBottomLine.visible&&(pt={id:this.svgObject.id+tt+"_YAxisBottomLine_"+t,x1:this.model.m_AreaBounds.X,y1:s,x2:this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width,y2:s,"stroke-width":i.axisBottomLine.width,stroke:i.axisBottomLine.color},this.svgRenderer.drawLine(pt,w)),i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,ut=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,wt=i.visibleLabels.length,u=0;u<wt;u++)if(nt=i.visibleLabels[u].Value,h=i.labels.length>0&&ut<0?nt+ut:nt,h=i.roundingPlaces?h:parseFloat(h.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(h,i.visibleRange)){if(i.hidePartialLabels&&(u==0||u==i.visibleLabels.length-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(ui=this._getSharpPath(i.minorTickLines.width),o=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){e=h;var bt=i.visibleRange.max,ft=i.visibleRange.min,kt=Math.pow(i.logBase,e-i.visibleRange.interval),fi=Math.pow(i.logBase,e),dt=(fi-kt)/(i.minorTicksPerInterval+1),et=kt+dt;for(e=ej.EjSvgRender.utils._logBase(et,i.logBase),y=0;y<i.minorTicksPerInterval;y++)e<bt&&e>ft&&(v=Math.ceil((e-ft)/(bt-ft)*i.height),i.minorGridLines.visible&&it.append("M "+(Math.floor(this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" L "+(Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" ")),et+=dt,e=ej.EjSvgRender.utils._logBase(et,i.logBase)}else for(y=0,e=h;y<i.minorTicksPerInterval;y++)e+=i.visibleRange.interval/(i.minorTicksPerInterval+1),e<i.visibleRange.max&&e>i.visibleRange.min&&(v=(e-i.visibleRange.min)/i.visibleRange.delta*i.height,i.minorGridLines.visible&&it.append("M "+(Math.floor(this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" L "+(Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" "));if((i.majorTickLines.visible||i.majorGridLines.visible)&&(ei=this._getSharpPath(i.minorTickLines.width),c=this._getSharpPath(i.majorGridLines.width),i.majorGridLines.visible)){lt=ej.EjSvgRender.utils._getPointXY(h,i.visibleRange,i.isInversed)*i.height;var oi=Math.floor(this.model.m_AreaBounds.X)+c,l=Math.floor(lt*-1+s),si=Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+c;if(u==0){if(l==Math.floor(this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height))continue;i.zoomed&&(f[0]=l+c)}if(u==i.visibleLabels.length-1&&this.model.chartArea.border.color!="transparent"&&this.model.chartArea.border.width>0&&l==Math.floor(this.model.m_AreaBounds.Y)){f.push(l+c);continue}if(vt.append("M "+oi+" "+(l+c)+" L "+si+" "+(l+c)+" "),u==0)continue;f.push(l+c)}}if(i.alternateGridBand.odd.fill!="transparent"||i.alternateGridBand.even.fill!="transparent"){for(ot=this.model.m_AreaBounds.Width,i.zoomed&&(f[f.length]=i.y),u=1;u<f.length;u+=2)a=f[0]-f[1],u==f.length-1&&i.zoomed&&(p=f[f.length-2]-i.y,a=p),gt={id:this.svgObject.id+"_YAxisAlternateodd"+[u],x:Math.floor(this.model.m_AreaBounds.X),y:f[u],width:ot,height:a,fill:i.alternateGridBand.odd.fill,opacity:i.alternateGridBand.odd.opacity,stroke:"transparent","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.svgRenderer.drawRect(gt,rt);for(u=0;u<f.length;u+=2)a=f[0]-f[1],u==f.length-1&&i.zoomed&&(p=f[f.length-2]-i.y,a=p),u==0&&i.zoomed&&(p=i.y+i.height-f[0]-i.plotOffset,a=p),ni={id:this.svgObject.id+"_YAxisAlternateeven"+[u],x:Math.floor(this.model.m_AreaBounds.X),y:f[u],width:ot,height:a,fill:i.alternateGridBand.even.fill,opacity:i.alternateGridBand.even.opacity,stroke:"transparent","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.svgRenderer.drawRect(ni,rt);n(rt).appendTo(w)}i.minorGridLines.visible&&i.minorTicksPerInterval>0&&(ct=it.toString(),ti={id:this.svgObject.id+"_YAxisMinorGridLines_"+t,fill:"none","stroke-width":i.minorGridLines.width,stroke:i.minorGridLines.color,"stroke-dasharray":i.minorGridLines.dashArray,d:ct},this.svgRenderer.drawPath(ti,w));ht=vt.toString();i.majorGridLines.visible&&(st={id:this.svgObject.id+"_YAxisMajorGridLines_"+t,fill:"none","stroke-width":i.majorGridLines.width,opacity:i.majorGridLines.opacity,"stroke-dasharray":i.majorGridLines.dashArray,stroke:i.majorGridLines.color,d:ht},st.d!=""&&this.svgRenderer.drawPath(st,w));n(w).appendTo(this.svgObject)},textOverflowMultiLevelLabels:function(n,t,i,r,u,f,e,o,s){var h=e.y,c=0;if(r=="wrap"||r=="wrapandtrim"){for(collection=s._wrap(n,t,i,r,u,f),textCollection=collection.text,rows=textCollection.length,j=0;j<rows;j++)e.y+=f.height,s.model.enable3D||(e.id+="_"+j,s.svgRenderer.drawText(e,textCollection[j],o)),r=="wrapandtrim"&&textCollection[j].indexOf("...")>-1&&(s.model.enable3D&&c==0&&(e.y-=f.height),unTrimmedText=collection.unTrimmedText,f=ej.EjSvgRender.utils._measureText(textCollection[j],null,u),bounds={X:e.x-f.width/2,Y:e.y,Width:f.width,Height:f.height},s.model.axisMultiLevelLabelRegions.push({trimText:textCollection[j],labelText:unTrimmedText[c],Bounds:bounds}),c++);return textCollection}return i=r=="trim"?ej.EjSvgRender.utils._trimText(actualText,t,u):actualText,s.model.enable3D||(h=e.y+f.height),n.orientation.toLowerCase()=="vertical"&&(h=e.y-f.height/4),f=ej.EjSvgRender.utils._measureText(i,null,u),bounds={X:e.x-f.width/2,Y:h,Width:f.width,Height:f.height},s.model.axisMultiLevelLabelRegions.push({trimText:i,labelText:actualText,Bounds:bounds}),i},_triggerMultiLevelLabelsRendering:function(t,i,r,u,f,e,o){var s=n.extend({},ej.EjSvgRender.commonChartEventArgs);return s.data={text:t,location:{x:i,y:r},textOverflow:u,font:f,border:e},o._trigger("multiLevelLabelRendering",s),s.data},_drawXAxisMultiLevelLabels:function(t,i){var d,u,r,at,ut,h,f,c,l,e,w,o,g,st,v,ft,nt,ht=this.svgObject.id,b=i.visibleRange,tt=this.svgRenderer.createGroup({id:ht+"_XAxisMultiLevelLabels_"+t,"clip-path":"url(#"+this.svgObject.id+"_XAxis_Clippath_"+t+")"}),it=this.model.m_AreaBounds,k=i.opposedPosition,y,a=i.labelPosition.toLowerCase(),vt=i.labelBorder,s=10,rt=i._isScroll?this.model.scrollerSize:0,ct,p,lt,ot,et;for(e=i.majorTickLines.size+i._LableMaxWidth.height+vt.width,clipX=it.X,clipY=i.y+e+rt,clipWidth=it.Width,clipHeight=i._multiLevelLabelHeight+s-2,k?clipY=a=="outside"?i.y-e-i._multiLevelLabelHeight-s/2-rt:i.y+e-s/2:a=="inside"&&(clipY=i.y-e-i._multiLevelLabelHeight),ct={id:this.svgObject.id+"_XAxis_Clippath_"+t,x:clipX,y:clipY,width:clipWidth,height:clipHeight,fill:"white","stroke-width":1,stroke:"Gray"},this.svgRenderer.drawClipPath(ct,tt),d=0;d<i.multiLevelLabels.length;d++)if(f=i.multiLevelLabels[d],f.visible&&(f.start>=b.min&&f.start<=b.max||f.end>=b.min&&f.end<=b.max||f.start<b.min&&f.end>b.max)){if(c=f.font,v=f.border,y=v.width,level=f._level,g=f.textOverflow.toLowerCase(),ft=v.type.toLowerCase(),nt=f.textAlignment.toLowerCase(),l=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.start,b,i.isInversed)*i.width),w=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.end,b,i.isInversed)*i.width),i.isInversed&&(l=l-w,w=l+w,l=w-l),actualText=f.text,h=ej.EjSvgRender.utils._measureText(actualText,null,c),ut=ej.util.isNullOrUndefined(f.maximumTextWidth)?w-l-y-s:f.maximumTextWidth-s,at=1,count=0,u=l+i.x+s/2,r=e+i.y,r=k?a=="outside"?i.y-e-i.multiLevelLabelHeight[level]-s-i.prevHeight[level]-rt:i.y+e-s/2+i.prevHeight[level]:a=="inside"?i.y-e-i.multiLevelLabelHeight[level]-i.prevHeight[level]:e+i.y+i.prevHeight[level]+rt,this.model.enableCanvasRendering&&(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(clipX,clipY,clipWidth,clipHeight),this.svgRenderer.ctx.clip()),nt=="center"?(u+=ut/2,anchor="middle"):nt=="far"?(u=u+ut-y/2,anchor="end"):(anchor="start",u+=y/2),p=this._triggerMultiLevelLabelsRendering(actualText,u,r,g,c,f.border,this),actualText=p.text,u=p.location.x,r=p.location.y,g=p.textOverflow.toLowerCase(),c=p.font,v=p.border,ft=p.border.type.toLowerCase(),y=p.border.width,o={id:ht+"_XAxisMultiLevelLabels_Text_"+t+"_"+d,x:u,y:ft=="curlybrace"?r+10:r,fill:c.color?c.color:i.multiLevelLabelsFontColor,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,"text-anchor":anchor},text=actualText,g!="none"&&(text=this.textOverflowMultiLevelLabels(i,ut,text,g,c,h,o,tt,this)),g!="wrap"&&g!="wrapandtrim"&&(o.y+=h.height,h.height<i.multiLevelLabelHeight[level]&&(o.y=o.y+i.multiLevelLabelHeight[level]/2-h.height/2),this.svgRenderer.drawText(o,text,tt)),r=k?a=="inside"?e+i.y+i.prevHeight[level]-s/2:i.y-e-i.multiLevelLabelHeight[level]-s+2-i.prevHeight[level]-rt:a=="inside"?i.y-e-i.multiLevelLabelHeight[level]-3-i.prevHeight[level]:e+i.y+i.prevHeight[level]+rt,u=l+i.x,r+=y,height=i.multiLevelLabelHeight[level]+s/2,width=ut+s+y,lt={bounds:{x:u,y:r,height:height,width:width},axisIndex:t,multiLevelLabel:f},this.model.multiLevelLabelRegions.push(lt),path="",braceGap=(width+y-h.width)/2-2,ft=="rectangle")st={id:ht+"_XAxisMultiLevelLabels_Rect_"+t+"_"+d,x:u,y:r,width:width,height:height,fill:"transparent",stroke:v.color?v.color:i.multiLevelLabelsColor,"stroke-width":y},this.svgRenderer.drawRect(st,tt);else{switch(ft){case"withouttopandbottomborder":path="M "+u+" "+r+" L "+u+" "+(r+height)+" M "+(u+width)+" "+r+" L "+(u+width)+" "+(r+height);break;case"withouttopborder":labelHeight=!k&&a=="outside"||k&&a=="inside"?height:0;path="M "+u+" "+(r+labelHeight)+" L "+(u+width)+" "+(r+labelHeight)+" M "+u+" "+r+" L "+u+" "+(r+height)+" M "+(u+width)+" "+r+" L "+(u+width)+" "+(r+height);break;case"brace":nt=="near"?(et=o.x,ot=o.x+h.width+2):nt=="center"?(et=o.x-h.width/2-2<=it.X+l?it.X+l+s:o.x-h.width/2-2,ot=o.x+h.width/2+2>it.X+w?it.X+w-s:o.x+h.width/2+2):(et=o.x-h.width-2,ot=o.x);path=!k&&a=="outside"||k&&a=="inside"?"M "+u+" "+r+" L "+u+" "+(r+height/2)+" M "+u+" "+(r+height/2)+" L "+(et-2)+" "+(r+height/2)+" M "+ot+" "+(r+height/2)+" L "+(u+width)+" "+(r+height/2)+" M "+(u+width)+" "+(r+height/2)+" L "+(u+width)+" "+r:"M "+u+" "+(r+height)+" L "+u+" "+(r+height/2)+" M "+u+" "+(r+height/2)+" L "+et+" "+(r+height/2)+" M "+ot+" "+(r+height/2)+" L "+(u+width)+" "+(r+height/2)+" M "+(u+width)+" "+(r+height)+" L "+(u+width)+" "+(r+height/2);break;case"curlybrace":r=i.y+e+i.prevHeight[level];path=width<30?"M "+(u+width/2-5)+" "+(r+10)+" L "+(u+width/2)+" "+(r+15)+" L "+(u+width/2+5)+" "+(r+10):k?"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+width/2-5)+" "+(r+10)+" L "+(u+width/2)+" "+(r+15)+" L "+(u+width/2+5)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r:nt=="center"?"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+width/2-5)+" "+(r+10)+" L "+(u+width/2)+" "+(r+15)+" L "+(u+width/2+5)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r:nt=="near"?"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+15)+" "+(r+15)+" L "+(u+15+5)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r:"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+width-20)+" "+(r+10)+" L "+(u+width-15)+" "+(r+15)+" L "+(u+width-10)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r}path&&(st={id:ht+"_XAxisMultiLevelLabels_Rect_"+t+"_"+d,d:path,stroke:v.color?v.color:i.multiLevelLabelsColor,"stroke-width":v.width,fill:"none"},this.svgRenderer.drawPath(st,tt))}this.model.enableCanvasRendering&&this.svgRenderer.ctx.restore();n(tt).appendTo(this.gXaxisEle)}},_drawYAxisMultiLevelLabels:function(t,i){var y,r,u,ot,nt,p,f,s,c,k,w,o=5,tt,e,d,g,it=this.svgObject.id,a=i.visibleRange,b=this.svgRenderer.createGroup({id:it+"_YAxisMultiLevelLabels_"+t,"clip-path":"url(#"+this.svgObject.id+"_YAxis_Clippath_"+t+")"}),ht=this.model.m_AreaBounds,l=i.opposedPosition,v=i.labelPosition.toLowerCase(),st=i.labelBorder,rt=i._multiLevelLabelHeight,h=i.majorTickLines.size+i._LableMaxWidth.width+st.width+2*o,ut=i._isScroll?this.model.scrollerSize:0,ft,et;for(clipY=i.y,clipWidth=rt+o,clipHeight=i.height+o,clipX=l?v=="outside"?i.x+h-o+ut:i.x-rt-h+o:v=="outside"?i.x-rt-h-ut:i.x+h-o,ft={id:this.svgObject.id+"_YAxis_Clippath_"+t,x:clipX,y:i.y,width:clipWidth,height:clipHeight,fill:"white","stroke-width":1,stroke:"Gray"},this.svgRenderer.drawClipPath(ft,b),y=0;y<i.multiLevelLabels.length;y++)if(f=n.extend(!0,{},this.model.multiLevelLabelsDefault,i.multiLevelLabels[y]),f.visible&&(f.start>=a.min&&f.start<=a.max||f.end>=a.min&&f.end<=a.max||f.start<a.min&&f.end>a.max)){if(s=f.font,e=f.border,level=f._level,maximumTextWidth=f.maximumTextWidth,w=f.textOverflow.toLowerCase(),d=e.type.toLowerCase(),g=f.textAlignment.toLowerCase(),c=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.start,a,i.isInversed)*i.height),endY=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.end,a,i.isInversed)*i.height),i.isInversed&&(c=c-endY,endY=c+endY,c=endY-c),actualText=f.text,p=ej.EjSvgRender.utils._measureText(actualText,null,s),nt=endY-c-e.width,space=ej.util.isNullOrUndefined(maximumTextWidth)?i.multiLevelLabelHeight[level]+o:maximumTextWidth-o,ot=1,count=0,textX=0,r=i.x-h-i.prevHeight[level]-i.multiLevelLabelHeight[level]/2+e.width-o/2,u=i.height+i.y-c-nt/2,r=l?v=="outside"?i.x+h+i.multiLevelLabelHeight[level]/2+i.prevHeight[level]+e.width+ut:i.x-h-i.multiLevelLabelHeight[level]/2-i.prevHeight[level]+e.width+o/2:v=="inside"?i.x+h+i.multiLevelLabelHeight[level]/2+i.prevHeight[level]-o/2:r+textX-ut,this.model.enableCanvasRendering&&(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(clipX,clipY,clipWidth,clipHeight),this.svgRenderer.ctx.clip()),u=g=="far"?u+nt/2-p.height/2:g=="near"?u-nt/2+p.height:u+p.height/4,data=this._triggerMultiLevelLabelsRendering(actualText,r,u,w,s,f.border,this),actualText=data.text,r=data.location.x,u=data.location.y,w=data.textOverflow,s=data.font,e=data.border,d=e.type.toLowerCase(),borderWidth=e.width,k={id:it+"_YAxisMultiLevelLabels_Text_"+t+"_"+y,x:d=="curlybrace"?l?r+textX+10:r+textX-10:r+textX,y:u,fill:s.color?s.color:i.multiLevelLabelsFontColor,"font-size":s.size,"font-family":s.fontFamily,"font-style":s.fontStyle,"font-weight":s.fontWeight,opacity:s.opacity,"text-anchor":"middle"},text=actualText,w!="none"&&(text=this.textOverflowMultiLevelLabels(i,space,text,w,s,p,k,b,this)),w!="wrap"&&w!="wrapandtrim"&&this.svgRenderer.drawText(k,text,b),r=r-o/2-i.multiLevelLabelHeight[level]/2,u=i.y+i.height-endY+e.width,height=endY-c,width=i.multiLevelLabelHeight[level]+o,path="",braceGap=(width+e.width-rt)/2-2,et={bounds:{x:r,y:u,height:height,width:width},axisIndex:t,multiLevelLabel:f},this.model.multiLevelLabelRegions.push(et),d=="rectangle")tt={id:it+"_YAxisMultiLevelLabels_Rect_"+t+"_"+y,x:r,y:u,width:width,height:height,fill:"transparent",stroke:e.color?e.color:i.multiLevelLabelsColor,"stroke-width":e.width},this.svgRenderer.drawRect(tt,b);else{switch(d){case"withouttopandbottomborder":path="M "+r+" "+(u+height)+" L "+(r+width)+" "+(u+height)+" M "+r+" "+u+" L "+(r+width)+" "+u;break;case"withouttopborder":labelWidth=!l&&v=="outside"||l&&v=="inside"?0:width;path="M "+r+" "+(u+height)+" L "+(r+width)+" "+(u+height)+" M "+r+" "+u+" L "+(r+width)+" "+u+" M "+(r+labelWidth)+" "+(u+height)+" L "+(r+labelWidth)+" "+u;break;case"brace":value1=k.y-p.height/2-4;value2=k.y+p.height/4+2;path=!l&&v=="outside"||l&&v=="inside"?"M "+(r+width)+" "+u+" L "+(r+width/2)+" "+u+" M "+(r+width/2)+" "+u+" L "+(r+width/2)+" "+value1+" M "+(r+width/2)+" "+value2+" L "+(r+width/2)+" "+(u+height)+" M "+(r+width/2)+" "+(u+height)+" L "+(r+width)+" "+(u+height):"M "+r+" "+u+" L "+(r+width/2)+" "+u+" M "+(r+width/2)+" "+u+" L "+(r+width/2)+" "+value1+" M "+(r+width/2)+" "+value2+" L "+(r+width/2)+" "+(u+height)+" M "+(r+width/2)+" "+(u+height)+" L "+r+" "+(u+height);break;case"curlybrace":r=i.x-h-i.prevHeight[level];newHeight=height-10;height<30?l?(r=i.x+h+i.prevHeight[level],newHeight=height-10,path=" M "+(r+10)+" "+(u+newHeight/2)+" L "+(r+15)+" "+(u+newHeight/2+5)+" L "+(r+10)+" "+(u+newHeight/2+10)):path="M "+(r-10)+" "+(u+height/2-5)+" L "+(r-15)+" "+(u+height/2)+" L "+(r-10)+" "+(u+height/2+5):l?(r=i.x+h+i.prevHeight[level],newHeight=height-10,path="M "+r+" "+u+" C "+r+" "+u+" "+(r+10)+" "+u+" "+(r+10)+" "+(u+10)+" L "+(r+10)+" "+(u+newHeight/2)+" L "+(r+15)+" "+(u+newHeight/2+5)+" L "+(r+10)+" "+(u+newHeight/2+10)+" L "+(r+10)+" "+(u+newHeight)+" C"+(r+10)+" "+(u+newHeight)+" "+(r+5)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10)):path=g=="center"?"M "+r+" "+u+" C "+r+" "+u+" "+(r-10)+" "+u+" "+(r-10)+" "+(u+10)+" L "+(r-10)+" "+(u+newHeight/2)+" L "+(r-15)+" "+(u+newHeight/2+5)+" L "+(r-10)+" "+(u+newHeight/2+10)+" L "+(r-10)+" "+(u+newHeight)+" C "+(r-10)+" "+(u+newHeight)+" "+(r-5)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10):g=="far"?"M "+r+" "+u+" C "+r+" "+u+" "+(r-10)+" "+u+" "+(r-10)+" "+(u+10)+" L "+(r-10)+" "+(u+newHeight-10)+" L "+(r-15)+" "+(u+newHeight-5)+" L "+(r-10)+" "+(u+newHeight)+" L "+(r-10)+" "+(u+newHeight)+" C"+(r-10)+" "+(u+newHeight)+" "+(r-10)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10):"M "+r+" "+u+" C "+r+" "+u+" "+(r-10)+" "+u+" "+(r-10)+" "+(u+10)+" L "+(r-15)+" "+(u+10+5)+" L "+(r-10)+" "+(u+10+10)+" L "+(r-10)+" "+(u+newHeight)+" C"+(r-10)+" "+(u+newHeight)+" "+(r-5)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10)}path&&(tt={id:it+"_YAxisMultiLevelLabels_Rect_"+t+"_"+y,d:path,stroke:e.color?e.color:i.multiLevelLabelsColor,"stroke-width":e.width,fill:"none"},this.svgRenderer.drawPath(tt,b))}this.model.enableCanvasRendering&&this.svgRenderer.ctx.restore();n(b).appendTo(this.gYaxisEle)}},_drawXAxisLabels:function(t,i){var ft=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels_"+t,cursor:"default"}),hr=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels_"+t,cursor:"default"}),v=[],vi,y=this.model.m_AreaBounds,fi,rr=i.name.replace(/[^a-zA-Z0-9]/g,""),yi=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),h=i._opposed,pi=i._valueType,ei=3,wi=i.alignment.toLowerCase(),lt,u,f,e,l,g,yt,w,nt,li,o,r,nr,ai,ht,ut,tr,bt,kt,a,wt,dt,ct,et;for(t==0||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.y==y.Height+y.Y||i.y==y.Y?t==0||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.y==y.Height+y.Y||i.y==y.Y?(i._y=Math.floor(i.y),i.y=i.showNextToAxisLine?Math.floor(i.y):h?Math.floor(y.Y):Math.floor(y.Height+y.Y)):i.y=h?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size):i.y=h?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),u=0;u<i.visibleLabels.length;u++)if(f=i.visibleLabels[u],e=f.displayText=ej.util.isNullOrUndefined(f.displayText)?f.Text:f.displayText,ej.EjSvgRender.utils._inside(f.Value,i.visibleRange)){var gt,ni,bi,at,ki,st=i.width/i.visibleLabels.length,ur=i.maximumLabelWidth,vt=i.visibleRange,d=y.Width;ej.isNullOrUndefined(i.valueType)||u<i.visibleLabels.length-1&&i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="betweenticks"&&(at=i.visibleLabels[u+1],f.Value-=.5,ki=at.Value-.5);l=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(f.Value,vt,i.isInversed)*i.width));ej.isNullOrUndefined(i.valueType)||(u<i.visibleLabels.length-1&&i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="betweenticks"?(bi=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(ki,vt,i.isInversed)*i.width)),gt=u==0?i.x+l+(i.majorTickLines.width-.5):i.x+l+(i.majorTickLines.width+.5),ni=i.x+bi+(i.majorTickLines.width+.5),st=ni-gt):i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="betweenticks"?(st=i.width+i.x-ni,gt=ni):i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="onticks"&&(st=i.width/i.labels.length));i._gap=gt;var nt=ej.EjSvgRender.utils._measureText(e,d,i.font),s=nt.width,c=nt.height,di=i._LableMaxWidth,tt=di.height,it=di.rows,fr=this.svgRenderer.vmlNamespace,rt=i.axisLine.width,b=i.font,gi=i.labelIntersectAction,ti=i.labelPlacement.toLowerCase(),oi=i.rotationValue,k=0,ii=!1;this.edgeLabel=!1;var er=y.Width,or=y.X,ut=i.labelIntersectAction.toLowerCase(),sr=n(this.svgObject).width(),si;if(ut=="trim"||i.enableTrim)if(ti=="onticks"&&u!=i.visibleLabels.length-1){for(var at=i.visibleLabels[u+1],hi=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(at.Value,vt,i.isInversed)*i.width)),ri=ej.EjSvgRender.utils._measureText(at.Text,d,i.font).width,p=hi-ri/2,k=0,ci=!1;p<l+s/2&&k<2;)for(k++,ri>s?(otherLabel=trimLabel=at,ci=!1):(trimLabel=f,ci=!0),g=trimLabel.displayText=trimLabel.Text.toString(),w=1;w<g.length;w++)if(g=trimLabel.displayText.substring(0,w)+"... ",newTextWidth=ej.EjSvgRender.utils._measureText(g,d,b).width,ci){if(p=hi-ri/2,p<l+newTextWidth/2){w-1!=0&&(g=g.toString().substring(0,w-1)+"... ");s=newTextWidth;e=trimLabel.displayText=g;break}}else if(p=hi-newTextWidth/2,p<l+s/2){w-1!=0&&(g=g.toString().substring(0,w-1)+"... ");ri=newTextWidth;trimLabel.displayText=g;break}}else if(ti=="betweenticks"&&(yt=i.enableTrim?ur:st,s>yt&&e!="")){for(w=1;w<e.toString().length;w++)if(e=f.displayText.toString().substring(0,w)+"... ",s=ej.EjSvgRender.utils._measureText(e,d,b).width,s>=yt){if(e=e.toString().substring(0,w-1)+"... ",f.displayText=e,u==i.visibleLabels.length-1&&l+i.x+s/2>sr&&yt==st){yt-=s/2;w=1;continue}break}f.displayText=e}if(nt=ej.EjSvgRender.utils._measureText(f.displayText,d,b),li=nt.width/2,si=i.majorGridLines.width>i.majorTickLines.width?i.majorGridLines.width:i.majorTickLines.width,!ej.util.isNullOrUndefined(f.Text)){if(lt=wi=="near"?l+i.x+si+(pi=="category"&&ti!="onticks"?-(i.width/i.actualRange.delta)/2+ei:-nt.width-ei):wi=="far"?l+i.x+(pi=="category"&&ti!="onticks"?+(i.width/i.actualRange.delta/2)-nt.width:+si+ei):l+i.x-li,i.labelPosition=="inside"&&i.tickLinesPosition=="inside"||i.labelPosition=="inside"&&i.tickLinesPosition!="inside"&&i.labelIntersectAction=="multiplerows"?o=h?i.y+i.majorTickLines.size+c/2+rt/2+tt/(2*it)-5:i.y-i.majorTickLines.size-rt/2-tt/(2*it)+5:i.labelPosition=="inside"&&i.tickLinesPosition!="inside"?o=h?i.y+c/2+rt/2+tt/(2*it)-5:i.y-rt/2-tt/(2*it)+5:i.labelPosition!="inside"&&i.tickLinesPosition!="inside"||i.labelPosition!="inside"&&i.tickLinesPosition=="inside"&&i.labelIntersectAction=="multiplerows"?(o=h?i.y-i.majorTickLines.size+c/2-rt/2-tt/(2*it)-5:i.y+i.majorTickLines.size+rt/2+tt/(2*it)+5,o=o+(yi?h?-this.model.scrollerSize:this.model.scrollerSize:0)):i.labelPosition!="inside"&&i.tickLinesPosition=="inside"&&(o=h?i.y+c/2-rt/2-tt/(2*it)-5:i.y+rt/2+tt/(2*it)+5,o=o+(yi?h?-this.model.scrollerSize:this.model.scrollerSize:0)),i.labelPosition=="inside"&&i.tickLinesPosition!="inside"?(i.labelRotation==90||i.labelIntersectAction=="rotate90")&&(o=h?o:o-i.majorTickLines.size):i.labelPosition!="inside"&&i.tickLinesPosition=="inside"?(i.labelRotation==90||i.labelIntersectAction=="rotate90")&&(o=h?o-i.majorTickLines.size:o-i.majorTickLines.size):i.labelPosition=="inside"&&i.tickLinesPosition=="inside"&&(i.labelRotation==90||i.labelIntersectAction=="rotate90")&&(o=h?o:o-i.majorTickLines.size),r={id:this.svgObject.id+"_"+rr+"_XLabel_"+u,x:lt,y:o,fill:b.color,"font-size":b.size,"font-family":b.fontFamily,"font-style":b.fontStyle,"font-weight":b.fontWeight,opacity:b.opacity},i.edgeLabelPlacement){nr=i.edgeLabelPlacement.toLowerCase();ai=i.visibleLabels.length-1;switch(nr){case"shift":u==0?r.x<i.x&&(ht=i.x-r.x,r.x=lt=r.x+ht,this.diff=ht,this.edgeLabel=!0):u==ai&&r.x+nt.width>i.x+i.width&&(ht=r.x+nt.width-(i.x+i.width),r.x=lt=r.x-ht,this.diff=ht,this.edgeLabel=!0);break;case"hide":(u==0&&r.x<i.x||u==ai&&r.x+s>er+or)&&(e="")}}if(oi==0||fr||this.labelRotation(i,lt+li,o,r,f,oi),i.labelIntersectAction||i.enableTrim)if(this.diff=ej.util.isNullOrUndefined(this.diff)?0:this.diff,ut=i.labelIntersectAction.toLowerCase(),ut!="none"||i.enableTrim){if(ut=="wrap"||ut=="wrapbyword"){var pt=this.rowscalculation(e.toString(),d,i,st,r),k=pt.length,ui="";for(r.y=i.labelPosition!="inside"?h?r.y+c:r.y-c:h?r.y-c:r.y-c*k,a=0;a<pt.length;a++)i.labelPosition!="inside"?(r.y=h?r.y-c:r.y+c,this.svgRenderer.drawText(r,pt[a],ft)):(r.y=h?r.y+c:r.y+c,this.svgRenderer.drawText(r,pt[a],ft),k-=1),ui=ui+pt[a];fi=ej.EjSvgRender.utils._measureText(e,null,b);tr=fi.height*k;vi={x:r.x,y:r.y,width:fi.width,height:k*tr};i.visibleLabels[u].region={bounds:vi,labelText:f.Text,displayText:ui};i.visibleLabels[u].displayText=ui;this.model.xAxisLabelRegions.push(i.visibleLabels[u].region);continue}else if(ut=="hide")for(wt=i.visibleLabels.length-1,bt=0;bt<u;bt++){ct=i.visibleLabels[bt];et=0;d=y.Width;var ir=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(ct.Value,vt,i.isInversed)*i.width)),ot=ej.EjSvgRender.utils._measureText(ct.displayText,d,i.font).width,p=ir+(i.isInversed?-ot/2:ot/2);p=bt==0?p+this.diff:p;kt=ot==0?ot:s;(u!=wt||u==wt&&s<=ot)&&(kt=kt/2);ut=="hide"&&(i.isInversed?p<l+kt:p>l-kt)&&(f.displayText=e="")}else if(ut=="multiplerows"){for(a=0;a<v.length&&!ii;a++)for(wt=i.visibleLabels.length-1,u!=wt&&(s=s/2),dt=0;v[a]&&dt<v[a].length;dt++){ct=v[a][dt];et=0;d=y.Width;var ir=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(ct.Value,vt,i.isInversed)*i.width)),ot=ej.EjSvgRender.utils._measureText(ct.displayText,d,i.font).width,p=ir+(i.isInversed?-ot/2:ot/2);if((this.edgeLabel||v.length==1)&&(p=p+this.diff),i.isInversed?p<l+s:p>l-s)if(h){et=i.labelPosition!="inside"?r.y-c:r.y+c;r.y=et;a+1==v.length&&(ii=!0);k++;break}else{et=i.labelPosition!="inside"?r.y+c:r.y-c;r.y=et;a+1==v.length&&(ii=!0);k++;break}else if(dt+1==v[a].length){ii=!0;break}}et==undefined?(v[0]==undefined&&(v[0]=[]),v[0].push(f)):(v[k]==undefined&&(v[k]=[]),v[k].push(f))}}else{this.svgRenderer.drawText(r,e,ft);i.visibleLabels[u].region=this.calculateRegion(e,b,r,f);this.model.xAxisLabelRegions.push(i.visibleLabels[u].region);i.labelPosition=="inside"?n(ft).appendTo(this.gXaxisTickEle):n(ft).appendTo(this.gXaxisEle);continue}this.edgeLabel||this.zoomed||i.zoomed||oi||gi=="rotate90"||gi=="rotate45"||!(l+i.x+s/2>n(this.svgObject).width())||(n(r).attr("x",n(this.svgObject).width()-2),n(r).attr("text-anchor","end"));i.visibleLabels[u].y=r.y;this.model.enableCanvasRendering&&i.labelPosition=="inside"&&(i.labelIntersectAction=="rotate45"||i.labelIntersectAction=="rotate90")&&(r.y=r.y-s);this.svgRenderer.drawText(r,e,ft);i.visibleLabels[u].region=this.calculateRegion(e,b,r,f);this.model.xAxisLabelRegions.push(i.visibleLabels[u].region)}}n(ft).appendTo(this.gXaxisEle)},calculateRegion:function(n,t,i,r){var u=ej.EjSvgRender.utils._measureText(n,null,t),f={x:i.x,y:i.y,width:u.width,height:u.height};return{bounds:f,trimText:n,labelText:r.Text}},rowscalculation:function(n,t,i,r,u){var h=ej.EjSvgRender.utils._measureText,s=i.font,d=h(n,t,s),c=d.width,g=c/2,e=n.toString(),nt=e.length,a=[],f=0,tt=i.labelIntersectAction,v=n.split(" "),k=v.length,l,w,y,o,p,b;if(this.edgeLabel&&(r=f==0?r-this.diff:r),c>r&&(u.x=u.x+g,line=0,this.edgeLabel&&(u.x=f==0?u.x-this.diff:u.x+this.diff)),tt=="wrap"){if(c>r)for(l=1;l<=e.length;l++)n=e.substring(0,l),c=h(n,t,s).width,c>r&&(line=line+1,n=e.substring(0,l-1),a[f]=n,e=e.slice(l-1,nt),currentTextCollextion=e.split(" "),e=v.indexOf(currentTextCollextion[0])>-1?e:"-"+e,w=h(n,t,s).width,line==1&&(u.x=u.x-w/2),f++,l=0);u.x=i.valueType=="datetimeCategory"&&i.labelPlacement.toLowerCase()=="betweenticks"?i._gap:u.x;a[f]=n}else{for(y=0,f=0;f<k;f++)if(o=v[f],p=h(o,t,s).width,p<r&&c>r){while(f<k)if(p=h(o,t,s).width,b=v[f+1]?h(v[f+1],t,s).width:0,p+b<=r&&b>0)o=o.concat(" "+v[f+1]),f++;else{y=Math.max(y,p);break}a.push(o)}else if(c>r)o=ej.EjSvgRender.utils._trimText(o,r,s),w=h(o,t,s).width,y=Math.max(y,w),a.push(o);else{a.push(n);break}u.x=u.x-y/2}return a},labelRotation:function(t,i,r,u,f,e,o){var v=t._opposed,h=f.displayText?f.displayText:f.Text,c=e>360?e-360:e<-360?e+360:e,l="rotate("+c+","+i+","+r+")",y,s,a;n(u).attr("transform",l);n(u).attr("labelRotation",c);n(u).attr("labelPosition",t.labelPosition);y=this.svgRenderer.createText(u,h);s=Math.ceil(ej.EjSvgRender.utils._measureBounds(y,this).height-ej.EjSvgRender.utils._measureText(h,null,t.font).height);s=t._LableMaxWidth.height-s-ej.EjSvgRender.utils._measureText(h,null,t.font).height;a=t.labelPosition!="inside"?v?s/2:-s/2:v?-s/2:s/2;l="rotate("+c+","+i+","+(r+a)+")";this.edgeLabel&&e==90&&(r=o==0?u.y+this.diff:u.y-this.diff);n(u).attr({transform:l,y:r+a})},_drawYAxisLabels:function(t,i){var ui=i.name.replace(/[^a-zA-Z0-9]/g,""),ht=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLabels_"+t,cursor:"default"}),y,ut,u=i._opposed,k,ft,s=this.model.m_AreaBounds,hi=this.model.requireInvertedAxes,bt=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),kt=i.alignment.toLowerCase(),dt=3,d,h,e,ct,o,nt,r,ii,vt,g,ri,tt,wt,it,et,rt;for(t==1||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.x==s.Width+s.X||i.x==s.X?t==1||i.x==s.Width+s.X&&i.x!=s.X||i.labelPosition=="inside"||i.tickLinesPosition!="inside"?(i._x=Math.floor(i.x),i.x=i.showNextToAxisLine?Math.floor(i.x):u?Math.floor(s.X+s.Width):Math.floor(s.X)):(i._x=Math.floor(i.x),i.x=u?Math.floor(i.x+i.majorTickLines.size):i.showNextToAxisLine?Math.floor(i.x-i.majorTickLines.size):Math.floor(s.X)):i.x=u?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):i.showNextToAxisLine?Math.floor(i.x):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing),h=0;h<i.visibleLabels.length;h++)if(e=i.visibleLabels[h],ct=i.visibleRange,ej.EjSvgRender.utils._inside(e.Value,ct)){var lt=Math.abs(ej.EjSvgRender.utils._getPointXY(e.Value,ct,i.isInversed)*i.height),fi=ej.EjSvgRender.utils._measureText(e.Text,s.Height,i.font),l=fi.height,c=i.font,ei=i.visibleRange,p=i.axisLine.width,gt=i._LableMaxWidth,ci=gt.height,li=gt.rows,ni=s.Width,ti=i.maximumLabelWidth,f=e.displayText=e.Text,oi=ej.EjSvgRender.utils._measureText(f,ni,i.font),b=oi.width,c=i.font,a=i.labelRotation,at;if(i.labelPosition=="inside"&&i.tickLinesPosition=="inside"?(o=u?i.x-i.majorTickLines.size-p/2-5:i.x+p/2+5+i.majorTickLines.size,nt=u?"end":"start"):i.labelPosition=="inside"&&i.tickLinesPosition!="inside"?(o=u?i.x-p/2-5:i.x+p/2+5,nt=u?"end":"start"):i.tickLinesPosition=="inside"&&i.labelPosition!="inside"?(o=u?p/2+i.x+5:i.x-p/2-5,nt=u?"start":"end",o=o-(bt?u?-this.model.scrollerSize:this.model.scrollerSize:0)):(o=u?i.majorTickLines.size+p/2+i.x+5:i.x-p/2-5-i.majorTickLines.size,nt=u?"start":"end",o=o-(bt?u?-this.model.scrollerSize:this.model.scrollerSize:0)),at=i.majorGridLines.width>i.majorTickLines.width?i.majorGridLines.width:i.majorTickLines.width,d=kt=="far"?-lt+(i.y+i.height)-at-dt:kt=="near"?-lt+(i.y+i.height)+l/2+at+dt:-lt+(i.y+i.height)+l/4,r={id:this.svgObject.id+"_"+ui+"_YLabel_"+h,x:o,y:d,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,"text-anchor":!ej.util.isNullOrUndefined(a)&&a!=0?"middle":nt},i.edgeLabelPlacement){ii=i.edgeLabelPlacement.toLowerCase();vt=i.visibleLabels.length-1;switch(ii){case"shift":h==0?r.y>i.y+i.height&&(g=r.y-(i.y+i.height),r.y=d=r.y-g,this.diff=g,this.edgeLabel=!0):h==vt&&r.y-l/2<i.y&&(g=i.y-(r.y-l/2),r.y=d=r.y+g,this.diff=g,this.edgeLabel=!0);break;case"hide":(h==0&&r.y>i.y+i.height||h==vt&&r.y-l/2<s.Y)&&(f=e.Text="")}}if(!ej.util.isNullOrUndefined(a)&&a!=0&&!this.svgRenderer.vmlNamespace){o=i.labelPosition!="inside"?u?o+b/2:o-b/2:u?o-b/2:o+b/2;var f=e.displayText?e.displayText:e.Text,yt=a>360?a-360:a<-360?a+360:a,pt="rotate("+yt+","+o+","+d+")";n(r).attr("transform",pt);n(r).attr("labelRotation",yt);ri=this.svgRenderer.createText(r,f);tt=Math.ceil(ej.EjSvgRender.utils._measureBounds(ri,this).width-ej.EjSvgRender.utils._measureText(f,null,i.font).width);wt=i.labelPosition!="inside"?u?tt/2:-tt/2:u?-tt/2:tt/2;pt="rotate("+yt+","+(o+wt)+","+d+")";n(r).attr({transform:pt,x:o+wt})}if(i.labelIntersectAction||i.enableTrim){if(et!="none"||i.enableTrim){if(i.enableTrim&&b>ti&&f!=""){for(it=1;it<f.toString().length;it++)if(f=e.displayText.toString().substring(0,it-1)+"...",b=ej.EjSvgRender.utils._measureText(f,ni,c).width,b>=ti){f=f.toString().substring(0,it-1)+"...";break}e.displayText=f}}else{this.svgRenderer.drawText(r,e.Text,ht);y=ej.EjSvgRender.utils._measureText(f,null,c);ft=i.opposedPosition?r.x:r.x-y.width;k={x:ft,y:r.y,width:y.width,height:y.height};ut={bounds:k,trimText:f,labelText:e.Text};i.visibleLabels[h].region={bounds:k,trimText:f,labelText:e.Text};this.model.yAxisLabelRegions.push(ut);continue}for(et=i.labelIntersectAction.toLowerCase(),rt=0;rt<h;rt++){var w=i.visibleLabels[rt],ot=0,si=Math.abs(ej.EjSvgRender.utils._getPointXY(w.Value,ei,i.isInversed)*i.height),st=ej.EjSvgRender.utils._measureText(w.Text,s.Height,c).height,v=si*-1+(i.y+i.height)+st/4;v=v+(i.isInversed?st/2:-st/2);this.edgeLabel&&(v=rt==0?v-st/4:v);et=="hide"&&w.Text.toString()!=""&&(i.isInversed?v>r.y-l/4:v<r.y+l/4)?f=e.Text="":et=="multiplerows"&&(i.isInversed?v>r.y-l/4:v<r.y+l/4)&&w.x==r.x&&(u?(ot=i.labelPosition!="inside"?w.x+i._LableMaxWidth.maxWidth+5:w.x-i._LableMaxWidth.maxWidth-5,r.x=ot):(ot=i.labelPosition!="inside"?w.x-i._LableMaxWidth.maxWidth-5:w.x+i._LableMaxWidth.maxWidth+5,r.x=ot))}}i.visibleLabels[h].x=r.x;this.svgRenderer.drawText(r,f,ht);y=ej.EjSvgRender.utils._measureText(f,null,c);ft=u?r.x:r.x-y.width;k={x:ft,y:r.y,width:y.width,height:y.height};ut={bounds:k,trimText:f,labelText:e.Text};i.visibleLabels[h].region={bounds:k,trimText:f,labelText:e.Text};this.model.yAxisLabelRegions.push(ut)}n(ht).appendTo(this.gYaxisEle)},trimText:function(n,t,i){return t--,n=n.substring(0,t-i.length),n+i},_drawXTitle:function(t,i){var ft,f,w,o,ot,st;if(i.title.text!=""&&i.title.text&&i.title.visible){var d=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisTitle_"+t,cursor:"default"}),yt=this.model.elementSpacing+i._LableMaxWidth.height,u=ej.EjSvgRender.utils._measureText(i.title.text,i.width,i.title.font),e=u.height/2,nt=i._opposed,l=i.title.text,b=i._LableMaxWidth,p="middle",r=this.model.elementSpacing,tt=i.title.enableTrim,a=i._isScroll||this.model.zooming.enableScrollbar&&i.scrollbarSettings.visible&&(i.zoomFactor<1||i.zoomPosition>0),v=i.title.maximumTitleWidth,k=i.title.position.toLowerCase(),ut=i.title.alignment.toLowerCase(),w,s=i.tickLinesPosition.toLowerCase(),h=i.labelPosition.toLowerCase(),c=this.model.m_AreaBounds,it=i.title.offset,g,rt,y=this.model.scrollerSize;if(tt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v)))for(ft=v?v:i.width-r*2;u.width>ft;)if(l=this.trimText(l,l.length,"..."),u=ej.EjSvgRender.utils._measureText(l,i.width,i.title.font),l=="..."){l="";break}if(f=n.extend({},ej.EjSvgRender.commonChartEventArgs),w=r+b.height+e+i._multiLevelLabelHeight+i.majorTickLines.size+i.axisLine.width,s=="inside"&&h=="inside"&&(t==0||i.y==c.Height+c.Y||i.y==c.Y)?w=k=="inside"?r+b.height+e+i._multiLevelLabelHeight+i.majorTickLines.size+i.axisLine.width:r+e+i.axisLine.width:(t==0||i.y==c.Width+c.X||i.y==c.X)&&s!="inside"&&h=="inside"?w=k=="inside"?r+b.height+e+i._multiLevelLabelHeight+i.axisLine.width:r+i.majorTickLines.size+i.axisLine.width:(t==0||i.y==c.Width+c.X||i.y==c.X)&&s=="inside"&&h!="inside"?w=k=="inside"?r+e+i.majorTickLines.size+i.axisLine.width:r+b.height+e+i._multiLevelLabelHeight+i.axisLine.width:s!="inside"&&h!="inside"||t!=1?w=k=="inside"?r:r+b.height+e+i.majorTickLines.size+i.axisLine.width+i._multiLevelLabelHeight:s=="inside"||h!="inside"||i.showNextToAxisLine||(w=k=="inside"?r+b.height+e+i._multiLevelLabelHeight+i.axisLine.width:r+e+i.majorTickLines.size+i.axisLine.width+r+r),ut=="far"?(g=i.x+i.width+it,p="end"):ut=="near"?(g=i.x+it,p="start"):g=i.x+i.width/2+it,f.data={title:i.title.text,location:{x:g,y:w},axes:i},this._trigger("axesTitleRendering",f),rt=k=="inside"?(nt?s=="inside"&&h=="outside"?i.y+f.data.location.y-(a?y:0)-i.majorTickLines.size:i.y+f.data.location.y-(a?y:0):s=="outside"&&h=="inside"?(a?y:0)+(i.y-f.data.location.y)+i.majorTickLines.size:(a?y:0)+(i.y-f.data.location.y))+u.height/3.5:(nt?s=="inside"&&h=="outside"?i.y-f.data.location.y-(a?y:0)-i.majorTickLines.size:i.y-f.data.location.y-(a?y:0):s=="outside"&&h=="inside"?(a?y:0)+(f.data.location.y+i.y)-i.majorTickLines.size:(a?y:0)+(f.data.location.y+i.y))+u.height/3.5,o={id:this.svgObject.id+"_XAxisTitle_"+t,x:f.data.location.x,y:rt,fill:i.title.font.color,"font-size":i.title.font.size,"font-family":i.title.font.fontFamily,"font-style":i.title.font.fontStyle,"font-weight":i.title.font.fontWeight,opacity:i.title.font.opacity,"text-anchor":p},this.model.enableCanvasRendering){var ht=jQuery.uaMatch(navigator.userAgent),ct=!!navigator.userAgent.match(/Trident\/7\./),et=ht.browser.toLowerCase();et=="msie"||ct||(o.y=nt?o.y+e/2+1:o.y+e/2+(et=="mozilla"?1:-2))}if(n(this.svgObject).find("#"+this.svgObject.id+"_XAxisTitle_"+t).length>0)n(this.svgObject).find("#"+this.svgObject.id+"_XAxisTitle_"+t).attr(o);else if(tt){if(tt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v))){var lt=p=="middle"?o.x-u.width/2:p=="end"?o.x-u.width:o.x,at={X:lt,Y:o.y,Width:u.width,Height:u.height},vt={Bounds:at,trimText:l,labelText:i.title.text};this.model.xAxisTitleRegion.push(vt);this.svgRenderer.drawText(o,l,d)}}else this.svgRenderer.drawText(o,f.data.title,d);this.model.enableCanvasRendering||(ot=p=="start"?0:p=="end"?u.width:u.width/2,st={id:this.svgObject.id+"_XAxisTitleBorder_"+t,x:f.data.location.x-ot-r,y:rt-u.height+u.height/4,width:u.width+2*r,height:u.height,fill:"transparent","class":"e-xaxistitleborder"},this.svgRenderer.drawRect(st,d));n(d).appendTo(this.gXaxisEle)}},_drawYTitle:function(t,i){var u,et,w,ut,o,st,ht,ct,lt;if(i.title.text!=""&&i.title.text&&i.title.visible){var e=i._opposed,r=this.model.elementSpacing,p="middle",ft=this.model.series.isTransposed,h=i.majorTickLines.size,b=i.title.position.toLowerCase(),c=i._LableMaxWidth,l=this.model.m_AreaBounds,s,f=i.axisLine,g=i.tickLinesPosition.toLowerCase(),k=i.labelPosition.toLowerCase(),a=i.title.text,nt=i.title.enableTrim,pt=this.model.requireInvertedAxes,y,at=i._isScroll,v=i.title.maximumTitleWidth,tt=i.title.offset,it=i.title.alignment.toLowerCase(),d=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTitleGroup_"+t,cursor:"default"}),rt=ej.EjSvgRender.utils._measureText(i.title.text,i.height,i.title.font);if(g=="inside"&&k=="inside"&&(t==1||i.x==l.Width+l.X||i.x==l.X)?s=b=="inside"?e?i.x-(3*r+c.width+i._multiLevelLabelHeight+h+f.width):i.x+(3*r+c.width+i._multiLevelLabelHeight+h+f.width):e?i.x+(3*r+f.width-5):i.x-(3*r+f.width):(t==1||i.x==l.Width+l.X||i.x==l.X)&&g!="inside"&&k=="inside"?s=b=="inside"?e?i.x-(3*r+c.width+axis._multiLevelLabelHeight+f.width):i.x+(3*r+c.width+i._multiLevelLabelHeight+f.width):e?i.x+(3*r+h+f.width):i.x-(3*r+h+f.width):(t==1||i.x==l.Width+l.X||i.x==l.X)&&g=="inside"&&k!="inside"?s=b=="inside"?e?i.x-(3*r+h+f.width):i.x+(3*r+h+f.width)+(i.showNextToAxisLine?k=="inside"?-i._multiLevelLabelHeight:i._multiLevelLabelHeight:-r):e?i.x+(3*r+i._multiLevelLabelHeight+c.width+f.width):i.x-(3*r+c.width+f.width+i._multiLevelLabelHeight):(i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||t!=1)&&(s=b=="inside"?e?i.x-(r+f.width+h):i.x+(r+(i.showNextToAxisLine?0:c.width)+f.width+h):e?i.x+(3*r+i._multiLevelLabelHeight+c.width+h+f.width):i.x-(3*r+c.width+i._multiLevelLabelHeight+h+f.width)),u=ej.EjSvgRender.utils._measureText(a,i.height,i.title.font),nt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v)))for(et=v?v:i.height-r*2;u.width>et;)if(a=this.trimText(a,a.length,"..."),u=ej.EjSvgRender.utils._measureText(a,i.height,i.title.font),a=="..."){a="";break}if(s=i.opposedPosition?s:s-(at?this.model.scrollerSize:0),document.documentMode===8&&(s=e?s+u.width/2-r:s-u.width/2+r),w=n.extend({},ej.EjSvgRender.commonChartEventArgs),w.data={title:i.title.text,location:{x:rt.width/2,y:0},axes:i},this._trigger("axesTitleRendering",w),y=w.data.location.y+(i.y+i.height)+i.height/-2,it=="near"?(y=i.y+i.height-tt,p=e||ft?"end":"start"):it=="far"?(y=i.y-tt,p=e||ft?"start":"end"):it=="center"&&(y=i.y+i.height/2-tt),ut=e?90:-90,o={id:this.svgObject.id+"_YAxisTitle_"+t,x:s,y:y,fill:i.title.font.color,labelRotation:ut,transform:"rotate("+ut+","+s+","+y+")","font-size":i.title.font.size,"font-family":i.title.font.fontFamily,"font-style":i.title.font.fontStyle,"font-weight":i.title.font.fontWeight,opacity:i.title.font.opacity,"text-anchor":p,"dominant-baseline":"middle"},this.model.enableCanvasRendering){var vt=jQuery.uaMatch(navigator.userAgent),yt=!!navigator.userAgent.match(/Trident\/7\./),ot=vt.browser.toLowerCase();ot=="msie"||yt||(o.x=e?o.x-rt.height/4+1:o.x+rt.height/4+(ot=="mozilla"?1:-2))}n(this.svgObject).find("#"+this.svgObject.id+"_YAxisTitle_"+t).length>0?n(this.svgObject).find("#"+this.svgObject.id+"_YAxisTitle_"+t).attr(o):nt?nt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v))&&(st=this.svgRenderer.vmlNamespace?{X:o.x-u.width/2,Y:o.y+u.height/2,Width:u.width,Height:u.height}:{X:o.x-u.height/2,Y:o.y+u.width/2,Width:u.height/2,Height:u.width},ht={Bounds:st,trimText:a,labelText:i.title.text},this.model.yAxisTitleRegion.push(ht),this.svgRenderer.drawText(o,a,d)):this.svgRenderer.drawText(o,w.data.title,d);this.model.enableCanvasRendering||(ct=p=="start"?u.width:p=="end"?0:u.width/2,lt={id:this.svgObject.id+"_YAxisTitleBorder_"+t,x:o.x-u.height+u.height/2,y:o.y-ct-r,width:u.height,height:u.width+2*r,fill:"transparent","class":"e-yaxistitleborder"},this.svgRenderer.drawRect(lt,d));n(d).appendTo(this.gYaxisEle)}}};ej.EjStripline.prototype={_drawStripline:function(n,t,i,r){var u=t.start<n.range.min?n.range.min:t.start,f=t.end>n.range.max?n.range.max:t.end,e=0,c=0,ft=0,o=0,w=0,k=0,h=0,p=0,l=0,a=0,s,d,v,et,g,nt,tt,ot,it,rt,ut,st,y,b;if(t.visible&&(this.model._stripeline=!0,s=t.zIndex=="over"?this.gStriplineOver:this.gStriplineBehind,s=ej.util.isNullOrUndefined(s)?"":s,d=!0,n.orientation.toLowerCase()=="horizontal"?(v=0,t.startFromAxis?(et=ej.util.isNullOrUndefined(t.offset)?n.visibleRange.min:n.visibleRange.min+t.offset,v=(et-n.visibleRange.min)/n.visibleRange.delta*n.width+n.x,p=(et+(ej.util.isNullOrUndefined(t.width)?0:t.width)-n.visibleRange.min)/n.visibleRange.delta*n.width):ej.util.isNullOrUndefined(u)&&(ej.util.isNullOrUndefined(f)||ej.util.isNullOrUndefined(t.width))?d=!1:(u=jQuery.type(u)=="date"?u.getTime():u,ej.util.isNullOrUndefined(f)||jQuery.type(f)!="date"||(f=f.getTime()),v=ej.EjSvgRender.utils._getPointXY(u,n.visibleRange,n.isInversed)*n.width+n.x,g=ej.EjSvgRender.utils._getPointXY(f,n.visibleRange,n.isInversed)*n.width+n.x,nt=ej.EjSvgRender.utils._getPointXY(u+(ej.util.isNullOrUndefined(t.width)?0:t.width),n.visibleRange,n.isInversed)*n.width+n.x,p=(n.isInversed?g<nt:g>nt)?Math.abs(v-g):Math.abs(v-nt)),h=p,c=this.chart.model.m_AreaBounds.Height,e=n.isInversed?v-p:v,o=this.chart.model.m_AreaBounds.Y,ft=-90,tt=ej.EjSvgRender.utils._measureText(t.text,null,t.font).height,t.textAlignment=="middletop"?(l=e+tt,a=Math.abs(o+c/2)):t.textAlignment=="middlecenter"?(l=Math.floor(e+h/2)+tt/3,a=Math.abs(o+c/2)):t.textAlignment=="middlebottom"&&(l=e+h-tt,a=Math.abs(o+c/2))):(t.startFromAxis?(ot=ej.util.isNullOrUndefined(t.offset)?n.visibleRange.min:n.visibleRange.min+t.offset,w=n.y+n.height-(ot-n.visibleRange.min)/n.visibleRange.delta*n.height,p=(ot+(ej.util.isNullOrUndefined(t.width)?0:t.width)-n.visibleRange.min)/n.visibleRange.delta*n.height,k=p):ej.util.isNullOrUndefined(u)&&(ej.util.isNullOrUndefined(f)||ej.util.isNullOrUndefined(t.width))?d=!1:(u=jQuery.type(u)=="date"?u.getTime():u,ej.util.isNullOrUndefined(f)||jQuery.type(f)!="date"||(f=f.getTime()),w=n.y+n.height-ej.EjSvgRender.utils._getPointXY(u,n.visibleRange,n.isInversed)*n.height,it=n.y+n.height-ej.EjSvgRender.utils._getPointXY(ej.util.isNullOrUndefined(f)?0:f,n.visibleRange,n.isInversed)*n.height,rt=n.y+n.height-ej.EjSvgRender.utils._getPointXY(u+(ej.util.isNullOrUndefined(t.width)?0:t.width),n.visibleRange,n.isInversed)*n.height,k=(n.isInversed?it>rt:it<rt)?Math.abs(w-it):Math.abs(w-rt)),c=k,e=this.chart.model.m_AreaBounds.X,h=this.chart.model.m_AreaBounds.Width,o=w+(n.isInversed?0:-k),ut=ej.EjSvgRender.utils._measureText(t.text,h,t.font).height,t.textAlignment=="middletop"?(l=e+h/2,a=o+ut):t.textAlignment=="middlecenter"?(l=e+h/2,a=Math.abs(o+c/2)+ut/3):t.textAlignment=="middlebottom"&&(l=e+h/2,a=o+c-ut)),d))if(ej.util.isNullOrUndefined(t.imageUrl)){var ht={id:s.id+"_striplineRect_"+i+"_"+r,x:e,y:o,width:h,height:c,fill:t.color,opacity:t.opacity,"stroke-width":t.borderWidth,stroke:t.borderWidth==0?"transparent":t.borderColor},ct={id:s.id+"_striplineRectText_"+i+"_"+r,x:l,y:a,fill:t.font.color,transform:"rotate("+ft+","+l+","+a+")",labelRotation:ft,"font-size":t.font.size,"font-family":t.font.fontFamily,"font-style":t.font.fontStyle,"font-weight":t.font.fontWeight,opacity:t.font.opacity,"text-anchor":"middle"},lt={X:e,Y:o,Width:h,Height:c},at=t.zIndex=="over"?!0:!1;ej.EjSvgRender.utils.AddRegion(this.chart,lt,at);this.chart.model.enableCanvasRendering?(y=this.chart.svgObject.getContext("2d"),b=n.orientation.toLowerCase()=="horizontal"?{X:n.x,Y:o,Width:n.width,Height:this.chart.model.m_AreaBounds.Height}:{X:e,Y:n.y,Width:this.chart.model.m_AreaBounds.Width,Height:n.height},y.save(),y.beginPath(),y.rect(b.X,b.Y,b.Width,b.Height),y.clip(),this.svgRenderer.drawRect(ht,s),this.svgRenderer.drawText(ct,t.text,s),y.closePath(),y.restore()):(this.svgRenderer.drawRect(ht,s),this.svgRenderer.drawText(ct,t.text,s))}else st={height:c,width:h,href:t.imageUrl,x:e,y:o,id:s.id+"_backImage",visibility:"visible",preserveAspectRatio:"none"},this.svgRenderer.drawImage(st,s)}}}(jQuery);ej.EjLegendRender=function(n){this.chartObj=n},function(n){ej.EjLegendRender.prototype={sumofArray:function(n){for(var i=0,r=n.length,t=0;t<r;t++)i+=n[t];return i},legendRectSpace:function(n,t){var r=n.Width-10,u=n.Height-10,i=!1;return Math.ceil(t.Width)>=r&&Math.ceil(t.Height)>=u&&(i=!0),i},drawLegendTitle:function(){var f=this.chartObj,e=f.model,h=e.legend,c=e.LegendBounds,l=e.elementSpacing,u=h.title,a=ej.EjSvgRender.utils._measureText,t=u.font,i=c.Width,o=a(u.text,null,t),r=o.width,v=o.height,y=u.textAlignment.toLowerCase(),n=0,p=l+v/2,s;switch(y){case"far":n=i-r-n;break;case"center":n=i/2-r/2}n<0&&(n=0,i=r);i<r+n&&(i=r+n);s={id:f.svgObject.id+"_LegendTitleText",x:n,y:p,fill:t.color,"font-size":t.size,"font-style":t.fontStyle,"font-family":t.fontFamily,"font-weight":t.fontWeight,"text-anchor":"start",lgndCtx:!0};f.svgRenderer.drawText(s,u.text,this.chartObj.gLegendEle)},drawLegendItem:function(t,i,r){var u=this.chartObj,o=u.model,v=o.legend,y=v.textOverflow.toLowerCase(),ht=v.textWidth,c=o.LegendBounds,ut=o.elementSpacing,ct=v.border.width,vt=ej.EjSvgRender.utils._measureText,yt=ej.EjSvgRender,p=u.svgRenderer,l=t.Font,pt=o.symbolShape,wt=o.enableCanvasRendering,w=v.itemStyle,a=vt(t.Text,c.Width,l).height,b={startX:i+w.width/2,startY:r+(a>w.height?a:w.height)/2},d=t.PointIndex,ft=t.SeriesIndex,et=d?d:ft,ot=o.series[ft],bt=u.svgObject,g=t.LegendStyle,ni=jQuery.uaMatch(navigator.userAgent),ti=!!navigator.userAgent.match(/Trident\/7\./),lt,h,nt,at,s=ot.type.toLowerCase(),e,tt,it,rt,st,f;for(name in pt)if(t.Shape.toLowerCase()==name.toLowerCase()){e=name.toLowerCase()=="seriestype"?"SeriesType":name;break}if(e=="SeriesType"&&((s=="radar"||s=="polar")&&(tt=ot.drawType,e=tt.capitalizeFirstString()),s=="scatter"&&(tt=ot.marker.shape,e=tt.capitalizeFirstString()),t.drawType&&(e="SeriesType"),u.vmlRendering&&(s=="pie"||s=="doughnut"||s=="pieofpie")&&(e="Circle")),e=="None"&&(e=s=="pie"||s=="doughnut"||s=="pieofpie"?"Circle":"Rectangle"),et=ej.util.isNullOrUndefined(d)?ft:d,u.gLegendItemEle=p.createGroup({id:bt.id+"_Legend"+et,cursor:"pointer"}),t.CommonEventArgs.data.gLegendItemEle=u.gLegendItemEle,nt=n.extend(!0,{},t.CommonEventArgs.data),nt.model=u.model,at=nt.style,!t.CommonEventArgs.cancel){if(startLocation=yt.chartSymbol["_draw"+e](b,at,nt,u.gLegendItemEle),lt=g.Color&&g.Color.toString().toLowerCase()!=="gray"&&wt?l.color:g.Color&&g.Color.toLowerCase()!=="gray"?l.color:"gray",h=t,st=h.Text.length,(v.shape=="seriestype"||v.shape=="seriesType")&&(i+=ut/2),f={id:this.chartObj.svgObject.id+"_LegendItemText"+et,x:w.width+i+ut/2,y:b.startY,fill:lt,"font-size":l.size,"font-style":l.fontStyle,"font-family":l.fontFamily,"font-weight":l.fontWeight,"text-anchor":"start",lgndCtx:!0},f.y=b.startY+a/4,y=="wrap"||y=="wrapandtrim")for(f.y=f.y-a,k=0;k<st;k++)f.y=f.y+a,p.drawText(f,h.Text[k],u.gLegendItemEle),y=="wrapandtrim"&&(it={x:f.x+c.X,y:f.y+c.Y,height:a*st,width:ht},rt={bounds:it,trimText:h.Text,labelText:h.displayText},o.legendTextRegion.push(rt));else y=="trim"&&(it={x:f.x+c.X,y:f.y+c.Y,height:a+ut,width:ht},rt={bounds:it,trimText:h.Text,labelText:h.displayText},o.legendTextRegion.push(rt)),p.drawText(f,h.Text,u.gLegendItemEle);p.append(u.gLegendItemEle,u.gLegendEle);legendbound={X:c.X+ct,Y:c.Y+ct};i=startLocation?startLocation:i;var kt={X:i,Y:r,_Width:t.Bounds._Width,Width:t.Bounds.Width,Height:t.Bounds.Height},dt={LegendBound:legendbound,ItemBound:kt},gt={LegendItem:t,Location:b,SymbolShape:e,Style:t.CommonEventArgs.data.style,Bounds:dt};o.legendRegion.push(gt)}},drawLegend:function(t){var o=this.chartObj,u=o.model,e=u.legend,ai=u.LegendViewerBounds,i=u.LegendBounds,r=u.LegendActualBounds,gt=u.AreaType,l=e.position.toLowerCase(),lt=e.alignment.toLowerCase(),h=u.elementSpacing,vi=u.svgWidth,yi=u.svgHeight,nt=u.title,pi=nt.font.size,d=nt.subTitle,wi=nt.subTitle.font.size,rt=e.title,c=e.border.width,ni=ej.EjSvgRender.utils._measureText,ti=u.margin,p=u.border.width,y=u.legendCollection,at=y.length,w=vi-p*2,g=yi-p*2,k=e.itemPadding>0?e.itemPadding:0,vt=10,ut=10,bi=d.text==""||!d.visible||!nt.visible?0:ni(d.text,w-ti.left-ti.right,d.font).height+h,ii=u._titleLocation?u._titleLocation.Y:0+bi,ri=ni(rt.text,null,rt.font),ft=ri.height,ki=ri.width,ui=u._rowDefinitions,yt=0,fi,et,ei=u._columnDefinitions,di=this.sumofArray(ui.farSizes),gi=this.sumofArray(ui.nearSizes),fr=this.sumofArray(ei.farSizes),nr=this.sumofArray(ei.nearSizes),tt=!1,a=u.m_AreaBounds,ot=e.enableScrollbar,f=n(o.legendContainer),tr=n("#ScrollerParent_vertical_"+o._id).length>0?18:0,ir=n("#ScrollerParent_horizontal_"+o._id).length>0?18:0,rr=n(o.legendSvgContainer),oi=1.2,si=10,pt=10,nt=u.title,d=u.title.subTitle,wt=nt.visible?parseInt(pi)*oi:0,st=d.visible?parseInt(wi)*oi:0,wt=u.titleWrapTextCollection&&u.titleWrapTextCollection.length>1?u._titleLocation._height*u.titleWrapTextCollection.length-1:wt,st=u.subTitleWrapTextCollection&&u.subTitleWrapTextCollection.length>1?u._subTitleLocation.size.height:st,ht,hi,bt,kt,s,it;if(u.legend.border&&!d.text&&(st=0,pt=5),l=="right"||l=="left"?vt=10:ut=ot?g>200?10:g>100?5:0:10,ai.Height+=ft,i.Height+=ft,e.visible){if(l!="custom"){if(gt=="cartesianaxes")switch(l){case"bottom":i.Y=a.Y+a.Height+nr-h/2+ir;break;case"top":i.Y=ii==0?p+h:wt+si+st+pt+h;break;case"right":i.X=a.X+a.Width+di+h*2;break;case"left":i.X=a.X-gi-r.Width-h/2-c*2-tr}else switch(l){case"bottom":i.Y=g-(r.Height+c)-h*2;break;case"top":i.Y=ii==0?p+h:wt+si+st+pt+h;break;case"right":i.X=w-r.Width-h*2;break;case"left":i.X=p+h*2}if(!u.enable3D&>=="cartesianaxes"&&t._crossAxisOverlap!=null)for(ht=0,hi=u._axes.length;ht<hi;ht++){var v=u._axes[ht],b=t.axes[v.name]._bounds,ct=v.orientation.toLowerCase()==="horizontal";l=="top"&&ct&&v._opposed&&v.y-b<i.Y+i.Height?i.Y-=i.Y+i.Height-v.y+b:l=="bottom"&&ct&&!v._opposed&&v.y+b>i.Y?i.Y+=v.y+b-i.Y:l=="left"&&!ct&&v._opposed&&v.x-b<i.X+i.Width?i.X+=v.x+b-i.X:l=="right"&&!ct&&!v._opposed&&v.x+b>i.X&&(i.X-=i.X+i.Width-v.x+b)}if(l=="left"||l=="right")if(ot)switch(lt){case"center":i.Y=a.Height/2-r.Height/2+a.Y-c;break;case"near":i.Y=a.Y;break;case"far":i.Y=a.Y+a.Height-r.Height-c*2}else switch(lt){case"center":i.Y=g/2-(r.Height+c*2)/2+h/2;break;case"near":i.Y=p+h*2;break;case"far":i.Y=g-(r.Height+c)-h*2}else switch(lt){case"center":i.X=w/2-(r.Width+c*2)/2+h/2;break;case"near":i.X=p+h*2;break;case"far":i.X=w-(r.Width+c)-h*2}}else i.Y=e.location.y<g?e.location.y:0,i.X=e.location.x<w?e.location.x:0;if(ot)if(l=="right"||l=="left"){if(i.Y<a.Y||r.Height+c*2>=a.Height)for(bt=c*2,s=0;s<at;s++)if(bt+=y[s].Bounds.Height+k,bt>a.Height){r.Height=a.Height-c*2;i.Y=a.Y;break}}else if(c*2+r.Width>=w)for(kt=c*2,s=0;s<at;s++)if(kt+=y[s].Bounds.Width+k,kt>w){r.Width=w-c*2-r.vScrollSize-p*2;i.X=w/2-(r.Width+c*2)/2+h/2;break}for(o.legendSvgContainer.height=i.Height,o.legendSvgContainer.width=Math.max(ki,i.Width),currentX=fi=vt,currentY=et=ut,rt.text!=""&&rt.text&&(this.drawLegendTitle(),currentY=et=ut+ft),s=0;s<at;s++)(e.rowCount<e.columnCount||e.rowCount==e.columnCount)&&(l=="top"||l=="bottom"||l=="custom")?(currentX+y[s].Bounds.Width>i.Width+fi&&(currentX=vt,currentY+=y[s].Bounds.Height+k),this.drawLegendItem(y[s],currentX,currentY),currentX+=y[s].Bounds.Width+k):(currentY+y[s].Bounds.Height+k+ft+p>i.Height+et&&(currentY=et,currentX+=yt+k),this.drawLegendItem(y[s],currentX,currentY),currentY+=y[s].Bounds.Height+k,yt=Math.max(yt,y[s].Bounds.Width));var ci=o.legendContainer[0].offsetLeft,li=n("#"+o._id).offset(),dt=o.vmlRendering?ci<=0?i.X:ci-li.left:n(o.svgObject).offset().left-li.left,ur=o.vmlRendering?dt:i.X+(dt<=0?0:dt);f.attr("style","");e._ejScroller&&n("#"+f[0].id).ejScroller("instance").destroy();f.show();f.css({position:"absolute",background:e.background,left:ur,top:i.Y,width:r.Width,height:r.Height,"border-width":e.border.width,"border-color":e.border.color,"border-style":"solid"});f.addClass("e-legendborder");rr.css({height:i.Height,width:i.Width});i.Height=i.Height-(20-ut*2);it=this.legendRectSpace(i,r);ot&&(e._ejScroller?!it&&(i.Width>Math.ceil(r.Width)||i.Height>Math.ceil(r.Height))?(n("#"+f[0].id).ejScroller({scrollTop:o.scrolltop,scrollLeft:o.scrollleft,height:r.Height,width:r.Width}),tt=!0,i.Height>Math.ceil(r.Height)&&r.vScrollSize==0&&(vScrollSize=f[0].offsetWidth+c*5-f[0].clientWidth,f.css({width:r.Width+vScrollSize}))):e._ejScroller=!1:!it&&i.Width>Math.ceil(r.Width)&&i.Height>Math.ceil(r.Height)?(f.css({overflow:"scroll"}),tt=!0):(!it&&i.Height>Math.ceil(r.Height)&&r.vScrollSize>=0&&(f[0].style.overflowY="scroll",f[0].style.overflowX="hidden",r.vScrollSize==0&&(vScrollSize=f[0].offsetWidth-c*2-f[0].clientWidth,f.css({width:r.Width+vScrollSize})),tt=!0),!it&&i.Width>Math.ceil(r.Width)&&r.hScrollSize>=0&&(f[0].style.overflowX="scroll",f[0].style.overflowY="hidden",r.hScrollSize==0&&(hScrollSize=f[0].offsetHeight-c*2-f[0].clientHeight,f.css({height:r.Height+hScrollSize})),tt=!0)));o.svgRenderer.append(o.gLegendEle,o.legendSvgContainer);tt||f.css({width:r.Width-r.vScrollSize,height:r.Height-r.hScrollSize});e._ejScroller||(o.scrolltop!=undefined&&f.scrollTop(o.scrolltop),o.scrollleft!=undefined&&f.scrollLeft(o.scrollleft))}else f.hide()}}}(jQuery);ej.seriesTypes={};ej.EjSeriesRender=function(){};ej.indicatorTypes={};ej.EjIndicatorRender=function(){};ej.trendlineTypes={};ej.EjTrendLineRenderer=function(){},function(t){function r(n,i){var r=function(){};return r.prototype=new n,t.extend(r.prototype,i),r}ej.EjTrendLineRenderer.prototype={draw:function(n,i,r){var u,f;return this.chartObj=r,u=t.inArray(n,i.trendlines),n._isTransposed=r.model.requireInvertedAxes,n.xAxis=i.xAxis,n.yAxis=i.yAxis,f=n.type.toLowerCase(),f=="linear"||f=="movingaverage"?this.calculateLineDirection(n,i,u):this.calculateSplineDirection(n,i,u),!1},calculateSplineDirection:function(n,t,i){for(var a="",h=ej.EjSvgRender.utils._getStringBuilder(),v=!0,c=n.points,y=ej.EjSeriesRender.prototype.naturalSpline(c),r=null,u=null,p=-1,l,g=c.length,f=0;f<g;f++){if(l=f,u=c[f],r!=null){var w=null,b=null,k=ej.EjSeriesRender.prototype.getBezierControlPoints(r,u,y[p],y[l],0);w=k.controlPoint1;b=k.controlPoint2;var d=ej.EjSvgRender.utils._getPoint(r,n),e=ej.EjSvgRender.utils._getPoint(u,n),o=ej.EjSvgRender.utils._getPoint(w,n),s=ej.EjSvgRender.utils._getPoint(b,n),nt=this.chartObj;v?(h.append("M "+d.X+" "+d.Y+" C "+o.X+" "+o.Y+" "+s.X+" "+s.Y+" "+e.X+" "+e.Y+" "),v=!1):h.append("C "+o.X+" "+o.Y+" "+s.X+" "+s.Y+" "+e.X+" "+e.Y+" ")}r=u;p=l}return a=h.toString(),this._drawLinePath(n,t,a,i),!1},calculateLineDirection:function(n,t,i){for(var r,e,u=ej.EjSvgRender.utils._getStringBuilder(),o=!1,s,h=n.points.length,f=0;f<h;f++)s=n.points[f],r=ej.EjSvgRender.utils._getPoint(s,n),o?u.append("L "+r.X+" "+r.Y+" "):(u.append("M "+r.X+" "+r.Y+" "),u.append("L "+r.X+" "+r.Y+" "),o=!0);return e=u.toString(),this._drawLinePath(n,t,e,i),!1},_drawLinePath:function(n,t,i,r){var u=[],f;return u[0]=n.xAxis.x,u[1]=n.yAxis.y,i!=""&&(f={id:this.chartObj.svgObject.id+"_"+n.seriesIndex+"_"+r+"_"+n.name.replace(/[^a-zA-Z ]/g,""),fill:"none","stroke-dasharray":n.dashArray,"stroke-width":n.width,stroke:n.fill,opacity:n.opacity,d:i},n.id=f.id,this.chartObj.svgRenderer.drawPath(f,t.gTrendGroupEle,u)),this.chartObj.svgRenderer.append(t.gTrendGroupEle,this.chartObj.gTrendlinesGroupEle[n.seriesIndex]),!1},calculateTrendLineSegment:function(n,i,r,u){var s=u.model,r,f=t.extend([],n.points),o=i.type.toLowerCase(),e;i.backwardForecast=i.backwardForecast<0?0:i.backwardForecast;i.forwardForecast=i.forwardForecast<0?0:i.forwardForecast;f=f.sort(function(n,t){return n.xValue>t.xValue?1:t.xValue>n.xValue?-1:0});switch(o){case"linear":this.updateTrendSource(f,i);this.calculateLinearTrendline(n,i,r);break;case"exponential":this.updateExponentialTrendSource(f,i);this.calculateExponentialTrendline(n,i,r);break;case"logarithmic":this.updateLogarithmicTrendSource(f,i);this.calculateLogarithmicTrendline(n,i,r);break;case"power":this.updatePowerTrendSource(f,i);this.calculatePowerTrendline(n,i,r);break;case"polynomial":e=n.points.length;i.polynomialOrder=e<=i.polynomialOrder?e:i.polynomialOrder;i.polynomialOrder=i.polynomialOrder<2?2:i.polynomialOrder;i.polynomialOrder=i.polynomialOrder>6?6:i.polynomialOrder;e>1&&(this.updateTrendSource(f,i),this.calculatePolynomialTrendline(n,i,r));break;case"movingaverage":this.updateMovingAverageTrendSource(f,i);this.calculateMovingAverageTrendline(n,i,r)}return n.points.length>1&&this.calculateTrendLineRange(i,r),!1},updateTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(u),t.yValues.push(i.y));return this.calculateSumXAndYValue(t),!1},calculateLinearTrendline:function(n,t,i){var f=t.xValues.length,r,u,e,o;return t.points=[],f>1&&(i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),u=this._increaseDateTimeInterval(t.xPoints[f-1],t.forwardForecast,i._intervalType)):(r=t.xPoints[0]-t.backwardForecast,u=t.xPoints[f-1]+t.forwardForecast),e=t.slope*r+t._intercept,o=t.slope*u+t._intercept,t.points.push({x:r,xValue:r,y:e,YValues:[],visible:!0}),t.points.push({x:u,xValue:u,y:o,YValues:[],visible:!0}),t.points[0].YValues[0]=t.points[0].y,t.points[1].YValues[0]=t.points[1].y),!1},calculateTrendLineRange:function(n,t){var i=n.points.length,u,r;for(n.minY=n.points[0].y,n.maxY=n.points[i-1].y,t.setRange||(n.backwardForecast>0&&t._valueType!="category"&&i>1&&(t.range.min=t.range.min>n.points[0].x?n.points[0].x:t.range.min,t.visibleRange.min=t.range.min),n.forwardForecast>0&&i>1&&(t.range.max=t.range.max<n.points[i-1].x?n.points[i-1].x:t.range.max,t.visibleRange.max=t.range.max)),r=0;r<i;r++)u=n.points[r].y,n.minY=Math.min(n.minY,u),n.maxY=Math.max(n.maxY,u);return!1},calculateSumXAndYValue:function(n){for(var y=n.points,e=n.xPoints.length,u=n.type.toLowerCase(),r,a,i=0,o=0,f=0,l=0,v=0,s=0,h=n.xValues,c=n.yValues,t=0;t<e;t++)i=i+h[t],o=o+c[t],s=s+h[t]*c[t],l=l+h[t]*c[t],f=f+h[t]*h[t],v=v+c[t]*c[t];if(ej.util.isNullOrUndefined(n.intercept)||u!="linear"&&u!="exponential"&&u!="polynomial")r=(e*l-i*o)/(e*f-i*i),a=u=="exponential"||u=="power"?Math.exp((o-r*i)/e):(o-r*i)/e,n._intercept=a;else{switch(u){case"polynomial":r=(s-Math.log(n.intercept)*i)/f*3;break;case"linear":r=(s-n.intercept*i)/f;break;case"exponential":r=(s-Math.log(n.intercept)*i)/f}n._intercept=n.intercept}return n.slope=r,!1},_increaseDateTimeInterval:function(n,t,i){var r=new Date(n);return i.toLowerCase()=="days"?r.setDate(n.getDate()+t):i.toLowerCase()=="hours"?r.setHours(n.getHours()+t):i.toLowerCase()=="milliseconds"?r.setMilliseconds(n.getMilliseconds()+t):i.toLowerCase()=="seconds"?r.setSeconds(n.getSeconds()+t):i.toLowerCase()=="minutes"?r.setMinutes(n.getMinutes()+t):i.toLowerCase()=="months"?r.setMonth(n.getMonth()+t):i.toLowerCase()=="years"&&r.setYear(n.getFullYear()+t),r}};ej.ejLinear=r(ej.EjTrendLineRenderer);ej.trendlineTypes.linear=ej.ejLinear;ej.Exponential=r(ej.EjTrendLineRenderer,{updateExponentialTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(u),t.yValues.push(Math.log(i.y)));return this.calculateSumXAndYValue(t),!1},calculateExponentialTrendline:function(n,t,i){var e=t.xValues.length,r,u,f,o,s,h,c=Math.round(e/2);if(t.points=[],e>1){i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=r.getTime(),u=t.xPoints[c-1],s=u.getTime(),f=this._increaseDateTimeInterval(t.xPoints[e-1],t.forwardForecast,i._intervalType),h=f.getTime()):(r=o=t.xPoints[0]-t.backwardForecast,u=s=t.xPoints[c-1],f=h=t.xPoints[e-1]+t.forwardForecast);var l=t._intercept*Math.exp(t.slope*r),a=t._intercept*Math.exp(t.slope*u),v=t._intercept*Math.exp(t.slope*f);t.points.push({x:r,xValue:o,y:l,YValues:[],visible:!0});t.points.push({x:u,xValue:s,y:a,YValues:[],visible:!0});t.points.push({x:f,xValue:h,y:v,YValues:[],visible:!0});t.points[0].YValues[0]=t.points[0].y;t.points[1].YValues[0]=t.points[1].y;t.points[2].YValues[0]=t.points[2].y}return!1}});ej.trendlineTypes.exponential=ej.Exponential;ej.Logarithmic=r(ej.EjTrendLineRenderer,{updateLogarithmicTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(Math.log(u)),t.yValues.push(i.y));return this.calculateSumXAndYValue(t),!1},calculateLogarithmicTrendline:function(n,t,i){var e=t.xValues.length,r,u,f,o,s,h,c=Math.round(e/2);if(t.points=[],e>1){i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=r.getTime(),u=t.xPoints[c-1],s=u.getTime(),f=this._increaseDateTimeInterval(t.xPoints[e-1],t.forwardForecast,i._intervalType),h=f.getTime()):(r=o=t.xPoints[0]-t.backwardForecast,u=s=t.xPoints[c-1],f=h=t.xPoints[e-1]+t.forwardForecast);var l=t._intercept+t.slope*Math.log(r),a=t._intercept+t.slope*Math.log(u),v=t._intercept+t.slope*Math.log(f);t.points.push({x:r,xValue:o,y:l,YValues:[],visible:!0});t.points.push({x:u,xValue:s,y:a,YValues:[],visible:!0});t.points.push({x:f,xValue:h,y:v,YValues:[],visible:!0});t.points[0].YValues[0]=t.points[0].y;t.points[1].YValues[0]=t.points[1].y;t.points[2].YValues[0]=t.points[2].y}return!1}});ej.trendlineTypes.logarithmic=ej.Logarithmic;ej.Power=r(ej.EjTrendLineRenderer,{updatePowerTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(Math.log(u)),t.yValues.push(Math.log(i.y)));return this.calculateSumXAndYValue(t),!1},calculatePowerTrendline:function(n,t,i){var e=t.xValues.length,r,u,f,o,s,h,l=Math.round(e/2),c;if(t.points=[],e>1){i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=r.getTime(),u=t.xPoints[l-1],s=u.getTime(),f=this._increaseDateTimeInterval(t.xPoints[e-1],t.forwardForecast,i._intervalType),h=f.getTime()):(c=t.xPoints[0]-t.backwardForecast,r=o=c>-1?c:0,u=s=t.xPoints[l-1],f=h=t.xPoints[e-1]+t.forwardForecast);var a=t._intercept*Math.pow(r,t.slope),v=t._intercept*Math.pow(u,t.slope),y=t._intercept*Math.pow(f,t.slope);t.points.push({x:r,xValue:o,y:a,YValues:[],visible:!0});t.points.push({x:u,xValue:s,y:v,YValues:[],visible:!0});t.points.push({x:f,xValue:h,y:y,YValues:[],visible:!0});t.points[0].YValues[0]=t.points[0].y;t.points[1].YValues[0]=t.points[1].y;t.points[2].YValues[0]=t.points[2].y}return!1}});ej.trendlineTypes.power=ej.Power;ej.Polynomial=r(ej.EjTrendLineRenderer,{calculatePolynomialTrendline:function(n,t,i){var f=t.polynomialOrder,c,l,e,s,h,a,o,v,u,r;for(t.polynomialSlopes=new Array(f+1),c=t.xValues.length,u=0;u<c;u++)for(o=t.xValues[u],l=t.yValues[u],r=0;r<=f;++r)t.polynomialSlopes[r]||(t.polynomialSlopes[r]=0),t.polynomialSlopes[r]+=Math.pow(o,r)*l;for(e=new Array(1+2*f),s=new Array(f+1),h=0;h<f+1;h++)s[h]=new Array(3);for(a=0,u=0;u<c;++u)for(o=1,v=t.xValues[u],r=0;r<e.length;++r)e[r]||(e[r]=0),e[r]+=o,o*=v,++a;for(u=0;u<=f;++u)for(r=0;r<=f;++r)s[u][r]=e[u+r];return this.gaussJordanEliminiation(s,t.polynomialSlopes)||(t.polynomialSlopes=null),this.createPolynomialSegments(n,i,t),!1},createPolynomialSegments:function(n,t,i){var f=i.polynomialSlopes,e,u,c;if(f!=null){var o=i.xValues.length,a=Math.round(o/2),s=1,r,l=f.length,h=t._valueType.toLowerCase();for(i.points=[],e=1;e<=l;e++)e==1?(h=="datetime"?(u=this._increaseDateTimeInterval(i.xPoints[0],-i.backwardForecast,t._intervalType),r=u.getTime()):u=r=i.xPoints[0]-i.backwardForecast,c=this.getPolynomialYValue(f,r)):e==f.length?(h=="datetime"?(u=this._increaseDateTimeInterval(i.xPoints[o-1],i.forwardForecast,t._intervalType),r=u.getTime()):u=r=i.xPoints[o-1]+i.forwardForecast,c=this.getPolynomialYValue(f,r)):(s+=(o+i.forwardForecast)/f.length,h=="category"?u=r=i.xPoints[0]+(s-1):(u=r=i.xPoints[parseInt(s)-1],h=="datetime"&&o>s&&(r=u.getTime())),c=this.getPolynomialYValue(f,r)),(e==1||e==f.length||h=="category"||o>s)&&(i.points.push({x:u,xValue:r,y:c,YValues:[],visible:!0}),i.points[i.points.length-1].YValues[0]=i.points[i.points.length-1].y)}return!1},getPolynomialYValue:function(n,t){for(var r=0,i=0;i<n.length;i++)r+=n[i]*Math.pow(t,i);return r},gaussJordanEliminiation:function(n,t){for(var p,v,i,s,o,u,f,w,e=n.length,h=new Array(e),c=new Array(e),l=new Array(e),a=0;a<e;++a)l[a]=0;for(u=0;u<e;++u){var y=0,f=0,r=0;for(i=0;i<e;++i)if(l[i]!=1)for(o=0;o<e;++o)l[o]==0&&Math.abs(n[i][o])>=y&&(y=Math.abs(n[i][o]),f=i,r=o);if(++l[r],f!=r){for(i=0;i<e;++i)s=n[(f,i)],n[f][i]=n[r][i],n[r][i]=s;p=t[f];t[f]=t[r];t[r]=p}if(c[u]=f,h[u]=r,n[r][r]==0)return!1;for(v=1/n[r][r],n[r][r]=1,i=0;i<e;++i)n[r][i]*=v;for(t[r]*=v,i=0;i<e;++i)if(i!=r){for(s=n[i][r],n[i][r]=0,o=0;o<e;++o)n[i][o]-=n[r][o]*s;t[i]-=t[r]*s}}for(u=e-1;u>=0;--u)if(c[u]!=h[u])for(f=0;f<e;++f)w=n[(f,c[u])],n[f][c[u]]=n[f][h[u]],n[f][h[u]]=w;return!0}});ej.trendlineTypes.polynomial=ej.Polynomial;ej.MovingAverage=r(ej.EjTrendLineRenderer,{updateMovingAverageTrendSource:function(n,t){var u=n.length,i,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],i=0;i<u;i++)t.xPoints.push(n[i].xValue),t.xValues.push(i+1),r=n[i].isEmpty?null:n[i].y,t.yValues.push(r);return!1},calculateMovingAverageTrendline:function(n,t){var o=t.xPoints.length,i=t.period>=o?o-1:t.period,u,f,r,s,e,h,c;for(i=i<2?2:i,t.points=[],u=0;u<o-1;u++){for(r=s=e=0,f=u;s<i;f++)s++,ej.util.isNullOrUndefined(t.yValues[f])&&e++,r+=t.yValues[f];r=i-e<=0?null:r/(i-e);ej.util.isNullOrUndefined(r)||isNaN(r)||(h=t.xPoints[i-1+u],t.points.push({x:h,xValue:h,y:r,YValues:[],visible:!0}),c=t.points.length,t.points[c-1].YValues[0]=t.points[c-1].y)}}});ej.trendlineTypes.movingaverage=ej.MovingAverage;ej.EjIndicatorRender.prototype={draw:function(n,i){var f,s,h,e,c,u,r,o;if(this.chartObj=i,f=null,this.chartObj.model.AreaType=="cartesianaxes"&&(s=n.xAxis.x,h=n.yAxis.y,f="translate("+s+","+h+")"),e=t.inArray(n,this.chartObj.model.indicators),c={id:this.chartObj.svgObject.id+"_indicatorGroup_"+e,transform:f},this.gIndicatorGroupEle=this.chartObj.svgRenderer.createGroup(c),n._points.length>0)for(u=0;u<n.segment.length;u++)r=n.segment[u],o={fill:r.fill,width:r.width,opacity:n.opacity},r.isIndicator=!0,r.xAxis=n.xAxis,r.yAxis=n.yAxis,r.type=="line"?this.calculateDirection(r,o,e):this.drawColumn(r,o,n)},_drawLinePath:function(n,t,i,r){if(i!=""){var u={name:"line",id:this.chartObj.svgObject.id+"_"+r+"_"+n.name,fill:"none","stroke-dasharray":n.dashArray,"stroke-width":t.width,stroke:t.fill,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,opacity:t.opacity,d:i};this.chartObj.svgRenderer.drawPath(u,this.gIndicatorGroupEle)}this.chartObj.svgRenderer.append(this.gIndicatorGroupEle,this.chartObj.gIndicatorEle)},calculateDirection:function(n,t,i){var f=0,e=0,r,u;this.chartObj.model.enableCanvasRendering&&(f=n.xAxis.x,e=n.yAxis.y);n.points=ej.DataManager(n.points,ej.Query().sortBy("xValue")).executeLocal();var c=ej.EjSeriesRender.prototype._isVisiblePoints(n),l,o=ej.EjSvgRender.utils._getStringBuilder(),s=!1,h;for(u=0;u<c.length;u++)h=c[u],h.visible?(r=ej.EjSvgRender.utils._getPoint(h,n),s?o.append("L "+(r.X+f)+" "+(r.Y+e)+" "):(o.append("M "+(r.X+f)+" "+(r.Y+e)+" "),s=!0)):s=!1;l=o.toString();this._drawLinePath(n,t,l,i)},drawColumn:function(n,i,r){var f=n,l=t.inArray(r,this.chartObj.model.indicators),e,y,c;f.index=l;var p=Math.max(n.yAxis.visibleRange.min,0),w={Start:-.35,End:.35},o=ej.EjSeriesRender.prototype._isVisiblePoints(f),s=this,b=s.chartObj;for(e=0;e<o.length;e++){var k=e,h=o[e],a=h.YValues[0],d=p;if(h.visible){var v=ej.EjSeriesRender.prototype.calculateSides(h,w),g=v.x1,nt=v.x2,u=ej.EjSeriesRender.prototype.getRectangle(g,a,nt,d,f,b),tt=Math.min(0,u.Width),it=Math.min(0,u.Height);u.Width<.0001&&(u.Width=.0001);(tt==0||it==0)&&u.Width>0&&(options={id:this.chartObj.svgObject.id+"_"+l+"_"+f.name,x:u.X+s.chartObj.canvasX,y:u.Y+s.chartObj.canvasY,width:u.Width,height:u.Height,fill:o[e].fill?o[e].fill:i.fill,"stroke-width":f.border.width,plot:a<0?"negative":"positive",opacity:f.histogram.opacity,stroke:o[e].fill?o[e].fill:f.border.color},this.chartObj.svgRenderer.drawRect(options,this.gIndicatorGroupEle),c=ej.EjSvgRender.utils._getSvgXY(u.X,u.Y,f,s.chartObj),y={X:c.X,Y:c.Y,Width:u.Width,Height:u.Height},this._addRegion(s.chartObj,y,f,h,k))}}this.chartObj.svgRenderer.append(this.gIndicatorGroupEle,this.chartObj.gIndicatorEle)},_addRegion:function(n,t,i,r,u){var e=i.type,f;i.index>=0&&(f={SeriesIndex:i.index,Region:{PointIndex:u,Bounds:t},type:e,isIndicator:!0},n.model.chartRegions.push(f))},calculateSegment:function(n,i){var o,v,b,y,a,p,s,w,e,l;if(this.chartObj=i,n.segment=[],n.xRange={},n.yRange={},n.period=parseInt(n.period),n.period<n._points.length&&n.period>0){for(o=t.extend(!0,{},n),o.name="upperseries",o.fill=n.upperLine.fill,o.width=n.upperLine.width,o.type="line",v=0;v<n._points.length;v++)n._points[v].YValues.length=1,n._points[v].YValues[0]=n._points[v].y=70;for(o.points=t.extend(!0,[],n._points),b=i._getXValues(o.points),y=i._getYValues(o.points),n.xRange.min=Math.min.apply(Math,b),n.xRange.max=Math.max.apply(Math,b),n.yRange.min=Math.min.apply(Math,y),n.yRange.max=Math.max.apply(Math,y),n.segment.push(o),a=t.extend(!0,{},n),a.name="lowerSeries",a.width=n.lowerLine.width,a.fill=n.lowerLine.fill,a.type="line",p=0;p<n._points.length;p++)n._points[p].YValues[0]=n._points[p].y=30;a.points=t.extend(!0,[],n._points);y=i._getYValues(a.points);n.yRange.min=Math.min(Math.min.apply(Math,y),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,y),n.yRange.max);n.segment.push(a);s=t.extend(!0,{},n);s.name="signalSeries";s.width=n.width;s.fill=n.fill;s.type="line";var u=0,f=0,h=0,c=0,r=n.period;for(f=n._points[0].close,e=1;e<=r;++e)u=n._points[e].close,u>f?h+=u-f:u<f&&(c+=f-u),f=u,n._points[e-1].YValues[0]=n._points[e-1].y=null;for(h=h/r,c=c/r,n._points[r].YValues[0]=n._points[r].y=100-100/(1+h/c),l=r+1;l<n._points.length;l++)u=n._points[l].close,u>f?(h=(h*(r-1)+(u-f))/r,c=c*(r-1)/r):u<f&&(c=(c*(r-1)+(f-u))/r,h=h*(r-1)/r),f=u,n._points[l].YValues[0]=n._points[l].y=100-100/(1+h/c);for(s.points=t.extend(!0,[],n._points),w=[],e=r,l=0;e<s.points.length;e++,l++)w[l]=s.points[e].y;n.yRange.min=Math.min(Math.min.apply(Math,w),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,w),n.yRange.max);n.segment.push(s);this.calculateIndicatorRange(i,n)}},calculateIndicatorRange:function(n,t){n.model.indicatorRange[t.xAxisName]==undefined?(n.model.indicatorRange[t.xAxisName]={},n.model.indicatorRange[t.xAxisName]={min:t.xRange.min,max:t.xRange.max}):(n.model.indicatorRange[t.xAxisName].min>t.xRange.min&&(n.model.indicatorRange[t.xAxisName].min=t.xRange.min),n.model.indicatorRange[t.xAxisName].max<t.xRange.max&&(n.model.indicatorRange[t.xAxisName].max=t.xRange.max));n.model.indicatorRange[t.yAxisName]===undefined?(n.model.indicatorRange[t.yAxisName]={},n.model.indicatorRange[t.yAxisName]={min:t.yRange.min,max:t.yRange.max}):(n.model.indicatorRange[t.yAxisName].min>t.yRange.min&&(n.model.indicatorRange[t.yAxisName].min=t.yRange.min),n.model.indicatorRange[t.yAxisName].max<t.yRange.max&&(n.model.indicatorRange[t.yAxisName].max=t.yRange.max))}};ej.ejRSI=r(ej.EjIndicatorRender);ej.indicatorTypes.rsi=ej.ejRSI;ej.ejMACD=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var f,o,y,r,e,u,l,h,b,k,p,w;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};var d=n._points.length,a=n.longPeriod,g=n.shortPeriod,nt=n.trigger,ut=a-g,it=[],tt=[],s=[],c=[],v=[],rt=a+nt;if(rt<=n._points.length&&rt-2>=0&&g<=a&&g>0){for(it=this.calculateEMA(n._points,g,!0),tt=this.calculateEMA(n._points,a,!0),e=0;e<tt.length;e++)s.push(it[e+ut]-tt[e]);for(f=t.extend(!0,{},n),f.name="macdSeries",f.fill=n.macdLine.fill,f.width=n.macdLine.width,f.type="line",f.xAxis=n.xAxis,f.yAxis=n.yAxis,y=a-1,r=0,e=0;r<d;r++)r<y?n._points[r].YValues[0]=n._points[r].y=null:(n._points[r].YValues[0]=n._points[r].y=s[e],e+=1);for(f.points=t.extend(!0,[],n._points),c=this.calculateEMA(s,nt,!1),o=t.extend(!0,{},n),o.name="signalSeries",o.fill=n.fill,o.width=n.width,o.type="line",o.xAxis=n.xAxis,o.yAxis=n.yAxis,y=a+nt-2,r=0,e=0;r<d;r++)r<y?n._points[r].YValues[0]=n._points[r].y=null:(n._points[r].YValues[0]=n._points[r].y=c[e],e+=1);for(o.points=t.extend(!0,[],n._points),u=t.extend(!0,{},n),u.border={},u.name="histogramSeries",u.fill=n.histogram.fill,u.opacity=n.histogram.opacity,u.fill=n.histogram.fill,u.border=n.histogram.border,u.type="column",u.xAxis=n.xAxis,u.yAxis=n.yAxis,l=0,h=y;h<d;l++,h++)v.push(s[l+(nt-1)]-c[l]);for(l=0,h=y;h<d;l++,h++)n._points[h].YValues[0]=n._points[h].y=v[l];u.points=t.extend(!0,[],n._points);xValues=i._getXValues(f.points);n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);switch(n.macdType){case"line":n.yRange.min=Math.min.apply(Math,s);n.yRange.max=Math.max.apply(Math,s);n.segment.push(f);p=Math.min.apply(Math,c);w=Math.max.apply(Math,c);n.yRange.min=n.yRange.min<p?n.yRange.min:p;n.yRange.max=n.yRange.max>w?n.yRange.max:w;n.segment.push(o);break;case"histogram":b=Math.min.apply(Math,v);k=Math.max.apply(Math,v);n.yRange.min=n.yRange.min<b?n.yRange.min:b;n.yRange.max=n.yRange.max>k?n.yRange.max:k;n.segment.push(u);break;case"both":b=Math.min.apply(Math,v);k=Math.max.apply(Math,v);n.yRange.min=n.yRange.min<b?n.yRange.min:b;n.yRange.max=n.yRange.max>k?n.yRange.max:k;n.segment.push(u);n.yRange.min=Math.min.apply(Math,s);n.yRange.max=Math.max.apply(Math,s);n.segment.push(f);p=Math.min.apply(Math,c);w=Math.max.apply(Math,c);n.yRange.min=n.yRange.min<p?n.yRange.min:p;n.yRange.max=n.yRange.max>w?n.yRange.max:w;n.segment.push(o)}this.calculateIndicatorRange(i,n)}},calculateEMA:function(n,t,i){var f=0,e=0,h=n.length,s=[],o=[],c=2/(t+1),r,u;if(i){for(r=0;r<t;r++)s.push(n[r].close),f=f+s[r];for(e=f/t,o.push(e),u=e,j=t;j<h;j++)u=(n[j].close-u)*c+u,o.push(u)}else{for(r=0;r<t;r++)s.push(n[r]),f=f+s[r];for(e=f/t,o.push(e),u=e,j=t;j<h;j++)u=(n[j]-u)*c+u,o.push(u)}return o}});ej.indicatorTypes.macd=ej.ejMACD;ej.ejSMA=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var r,a,e,f,o;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};r=t.extend(!0,{},n);r.name="trendSeries";r.width=n.width;r.fill=n.fill;r.type="line";var h=[],v=[],c=[],s,l=n._points.length,u=n.period;if(!(u<=0)&&!(l<u)){for(f=0;f<l;f++)h.push(n._points[f].close);for(a=h.length;a>=u;){for(s=0,o=0;o<u;o++)s=s+h[o];s=s/u;v.push(s);h.splice(0,1);a=h.length}for(e=0;e<l;e++)n._points[e].YValues[0]=e<u-1?n._points[e].y=null:n._points[e].y=v[e-(u-1)];for(r.points=t.extend(!0,[],n._points),xValues=i._getXValues(r.points),f=u-1,o=0;f<r.points.length;f++,o++)c[o]=r.points[f].y;n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);n.yRange.min=Math.min.apply(Math,c);n.yRange.max=Math.max.apply(Math,c);n.segment.push(r);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.sma=ej.ejSMA;ej.ejEMA=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var a,u,s,f,e;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};trendSeries=t.extend(!0,{},n);trendSeries.name="trendSeries";trendSeries.type="line";trendSeries.xAxis=n.xAxis;trendSeries.yAxis=n.yAxis;var l=[],o=[],h=n._points.length,r=n.period,c=0;if(!(h<r)&&!(r<=0)){for(a=2/(r+1),f=0;f<r;f++)l.push(n._points[f].close),c=c+l[f];for(o.push(c/r),e=r;e<h;e++)o.push((n._points[e].close-o[e-r])*a+o[e-r]);for(u=0;u<h;u++)u<r-1?n._points[u].YValues[0]=n._points[u].y=null:u>=r-1&&(n._points[u].YValues[0]=n._points[u].y=o[u-(r-1)]);for(trendSeries.points=t.extend(!0,[],n._points),xValues=i._getXValues(trendSeries.points),s=[],f=r,e=0;f<trendSeries.points.length;f++,e++)s[e]=trendSeries.points[f].y;n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);n.yRange.min=Math.min.apply(Math,s);n.yRange.max=Math.max.apply(Math,s);n.segment.push(trendSeries);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.ema=ej.ejEMA;ej.ejSTOCHASTIC=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){function d(t,i,r){n._points.length>=t+i&&g(t,i,r)}function g(t,i,r){for(var v,h,o,c,u,l=t+(i-1),e=[],a=[],f,s=0;s<n._points.length;s++)v=p[s].y,e.push(v);for(h=e.length;h>=l;){for(f=0,o=t-1;o<t+i-1;o++)f=f+e[o];f=f/i;a.push(f.toFixed(2));e.splice(0,1);h=e.length}for(c=l-1,u=0;u<n._points.length;u++)r[u].YValues[0]=u<c?r[u].y=null:r[u].y=Number(a[u-c])}function nt(t,i,r){n._points.length>t&&tt(t,i,r)}function tt(t,i,r){for(var f,a=t+i,e=[],h=[],o,s,c=0,l=0,u=0;u<t-1;++u)h.push(0),e.push(0);for(u=t-1;u<n._points.length;++u){for(s=Number.MAX_VALUE,o=Number.MIN_VALUE,f=0;f<t;++f)s=Math.min(s,b[u-f]),o=Math.max(o,w[u-f]);h.push(o);e.push(s)}for(u=0;u<a-1;++u)r[u].YValues.length=1,r[u].YValues[0]=r[u].y=null;for(u=t-1;u<n._points.length;++u)c=0,l=0,c+=k[u]-e[u],l+=h[u]-e[u],r[u].YValues.length=1,r[u].YValues[0]=r[u].y=c/l*100}var r,c,u,f,e,v,o,s,h;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};var l=n.kPeriod,y=n.dPeriod,a=n.period;if(!(a<1)&&!(y<1)&&!(l<1)&&!(a>n._points.length)&&!(y>n._points.length)&&!(l>n._points.length)){for(r=t.extend(!0,{},n),r.name="upperseries",r.type="line",r.fill=n.upperLine.fill,r.width=n.upperLine.width,c=0;c<n._points.length;c++)n._points[c].YValues.length=1,n._points[c].YValues[0]=n._points[c].y=80;for(r.points=t.extend(!0,[],n._points),u=i._getXValues(r.points),f=i._getYValues(r.points),n.xRange.min=Math.min.apply(Math,u),n.xRange.max=Math.max.apply(Math,u),n.yRange.min=Math.min.apply(Math,f),n.yRange.max=Math.max.apply(Math,f),n.segment.push(r),e=t.extend(!0,{},n),e.name="lowerSeries",e.width=n.lowerLine.width,e.fill=n.lowerLine.fill,e.type="line",v=0;v<n._points.length;v++)n._points[v].YValues[0]=n._points[v].y=20;e.points=t.extend(!0,[],n._points);u=i._getXValues(e.points);f=i._getYValues(e.points);n.xRange.min=Math.min(Math.min.apply(Math,u),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,u),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,f),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,f),n.yRange.max);n.segment.push(e);o=t.extend(!0,{},n);o.name="periodSeries";o.width=n.periodLine.width;o.fill=n.periodLine.fill;o.type="line";var w=[],b=[],k=[],p=[];for(s=0;s<n._points.length;s++)b[s]=n._points[s].low,w[s]=n._points[s].high,k[s]=n._points[s].close;nt(a,l,n._points);p=n._points;d(a,l,n._points);p=n._points;o.points=t.extend(!0,[],n._points);u=i._getXValues(o.points);f=i._getYValues(o.points);n.xRange.min=Math.min(Math.min.apply(Math,u),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,u),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,f),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,f),n.yRange.max);n.segment.push(o);h=t.extend(!0,{},n);h.name="trendSeries";h.width=n.width;h.fill=n.fill;h.type="line";d(a+l-1,y,n._points);h.points=t.extend(!0,[],n._points);n.segment.push(h);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.stochastic=ej.ejSTOCHASTIC;ej.ejbollingerBand=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var v,ft,d,f,e,l,tt,o,s,it,h,c,rt,r,a;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};var b=0,g=0,nt=n._points.length,ut=n.standardDeviations,w=n.period,u=Math.round(w),y=[],p=[],k=[];if(u<nt&&u>0){for(r=0;r<u;r++)b+=n._points[r].close;for(v=b/w,r=0;r<nt;++r)if(r>=u-1&&r<nt){r-w>=0?(ft=n._points[r].close-n._points[r-u].close,b=b+ft,v=b/w,y[r]=v,p[r]=Math.pow(n._points[r].close-v,2),g+=p[r]-p[r-u]):(y[r]=v,p[r]=Math.pow(n._points[r].close-v,2),g+=p[r]);var et=Math.sqrt(g/w),ot=y[r]-ut*et,st=y[r]+ut*et;if(r+1==u)for(d=0;d<u-1;d++)k[d]={X:n._points[d].X,mb:y[r],lb:ot,ub:st,visible:!0};k[r]={X:n._points[r].X,mb:y[r],lb:ot,ub:st,visible:!0}}else r<w-1&&(y[r]=v,p[r]=Math.pow(n._points[r].close-v,2),g+=p[r]);for(f=t.extend(!0,{},n),f.name="upperseries",f.fill=n.upperLine.fill,f.width=n.upperLine.width,f.type="line",e=0;e<n._points.length;e++)e>=u-1?(n._points[e].YValues.length=1,n._points[e].YValues[0]=n._points[e].y=k[e].ub):n._points[e].YValues[0]=n._points[e].y=null;for(f.points=t.extend(!0,[],n._points),l=i._getXValues(f.points),tt=[],r=u;r<f.points.length;r++)tt.push(f.points[r].y);for(a=tt,n.xRange.min=Math.min.apply(Math,l),n.xRange.max=Math.max.apply(Math,l),n.yRange.min=Math.min.apply(Math,a),n.yRange.max=Math.max.apply(Math,a),n.segment.push(f),o=t.extend(!0,{},n),o.name="lowerSeries",o.width=n.lowerLine.width,o.fill=n.lowerLine.fill,o.type="line",s=0;s<n._points.length;s++)s>=u-1?(n._points[s].YValues.length=1,n._points[s].YValues[0]=n._points[s].y=k[s].lb):n._points[s].YValues[0]=n._points[s].y=null;for(o.points=t.extend(!0,[],n._points),l=i._getXValues(o.points),it=[],r=u;r<o.points.length;r++)it.push(o.points[r].y);for(a=it,n.xRange.min=Math.min(Math.min.apply(Math,l),n.xRange.min),n.xRange.max=Math.max(Math.max.apply(Math,l),n.xRange.max),n.yRange.min=Math.min(Math.min.apply(Math,a),n.yRange.min),n.yRange.max=Math.max(Math.max.apply(Math,a),n.yRange.max),n.segment.push(o),h=t.extend(!0,{},n),h.name="trendSeries",h.width=n.width,h.fill=n.fill,h.type="line",c=0;c<n._points.length;c++)c>=u-1?(n._points[c].YValues.length=1,n._points[c].YValues[0]=n._points[c].y=k[c].mb):n._points[c].YValues[0]=n._points[c].y=null;for(h.points=t.extend(!0,[],n._points),l=i._getXValues(h.points),rt=[],r=u;r<h.points.length;r++)rt.push(h.points[r].y);a=rt;n.xRange.min=Math.min(Math.min.apply(Math,l),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,l),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,a),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,a),n.yRange.max);n.segment.push(h);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.bollingerband=ej.ejbollingerBand;ej.ejATR=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var o,s,h,c,u,f,y,v,r;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};o=[];s=h=c=0;var l,p=0,a,e=n.period;if(!(e<=0)&&!(e>n._points.length)){for(r=0;r<e;r++)s=n._points[r].high-n._points[r].low,r>0&&(h=Math.abs(n._points[r].high-n._points[r-1].close),c=Math.abs(n._points[r].low-n._points[r-1].close)),l=Math.max(s,h,c),p+=l,a=p/e,o[r]={X:n._points[r].X,YValues:a};for(r=e;r<n._points.length;++r)s=n._points[r].high-n._points[r].low,h=Math.abs(n._points[r].high-n._points[r-1].close),c=Math.abs(n._points[r].low-n._points[r-1].close),l=Math.max(s,h,c),a=(o[r-1].YValues*(e-1)+l)/e,o[r]={X:n._points[r].X,YValues:a};for(u=t.extend(!0,{},n),u.name="trendSeries",u.width=n.width,u.fill=n.fill,u.type="line",f=0;f<n._points.length;f++)f>=e-1?(n._points[f].YValues.length=1,n._points[f].YValues[0]=n._points[f].y=o[f].YValues):n._points[f].YValues[0]=n._points[f].y=null;for(u.points=t.extend(!0,[],n._points),y=i._getXValues(u.points),v=[],r=e;r<u.points.length;r++)v.push(u.points[r].y);n.xRange.min=Math.min.apply(Math,y);n.xRange.max=Math.max.apply(Math,y);n.yRange.min=Math.min.apply(Math,v);n.yRange.max=Math.max.apply(Math,v);n.segment.push(u);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.atr=ej.ejATR;ej.ejaccumulationDistribution=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var e,o,r,s,h,u,f,c,l;for(this.chartObj=i,n.segment=[],n.xRange={},n.yRange={},e=[],o=0,r=0;r<n._points.length;r++)s=n._points[r].close,h=(s-n._points[r].low-(n._points[r].high-s))/(n._points[r].high-n._points[r].low),o+=(isNaN(h)?0:h)*n._points[r].volume,e[r]=o;for(u=t.extend(!0,{},n),u.name="trendseries",u.fill=n.fill,u.width=n.width,u.type="line",f=0;f<n._points.length;f++)n._points[f].YValues[0]=n._points[f].y=e[f];u.points=t.extend(!0,[],n._points);c=i._getXValues(u.points);l=i._getYValues(u.points);n.xRange.min=Math.min.apply(Math,c);n.xRange.max=Math.max.apply(Math,c);n.yRange.min=Math.min.apply(Math,l);n.yRange.max=Math.max.apply(Math,l);n.segment.push(u);this.calculateIndicatorRange(i,n)}});ej.indicatorTypes.accumulationdistribution=ej.ejaccumulationDistribution;ej.ejTMA=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var o,y,p,r,s,u;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};o=t.extend(!0,{},n);o.name="trendSeries";o.width=n.width;o.fill=n.fill;o.type="line";var l=[],w=[],b=[],h=[],v=[],e=0,c,a=n._points.length,f=n.period;if(!(f<1)&&f<a){for(s=0;s<a;s++)l.push(n._points[s].close);for(y=l.length;y>=f;){for(e=0,u=0;u<f;u++)e=e+l[u];e=e/f;w.push(parseFloat(e.toFixed(2)));l.splice(0,1);y=l.length}for(r=0;r<a;r++)if(r<f-1){for(e=0,u=0;u<r+1;u++)e=e+n._points[u].close;e=e/(r+1);h[r]=parseFloat(e.toFixed(2))}else h[r]=w[r-(f-1)];for(p=h.length;p>=f;){for(c=0,u=0;u<f;u++)c=c+h[u];c=c/f;b.push(c);h.splice(0,1);p=h.length}for(r=0;r<a;r++)n._points[r].YValues[0]=r<f-1?n._points[r].y=null:n._points[r].y=b[r-(f-1)];for(o.points=t.extend(!0,[],n._points),xValues=i._getXValues(o.points),s=f-1,u=0;s<o.points.length;s++,u++)v[u]=o.points[s].y;n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);n.yRange.min=Math.min.apply(Math,v);n.yRange.max=Math.max.apply(Math,v);n.segment.push(o);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.tma=ej.ejTMA;ej.ejMomentum=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var e,c,l,o,a,f,p,s,v,r,h,u,y;if(this.chartObj=i,n.segment=[],n.xRange={},n.yRange={},e=t.extend(!0,{},n),e.name="upperseries",e.fill=n.upperLine.fill,e.width=n.upperLine.width,e.type="line",c=n.period,l=n._points.length,c>0&&c<l-1){for(r=0;r<l;r++)n._points[r].YValues.length=1,n._points[r].YValues[0]=n._points[r].y=100;for(e.points=t.extend(!0,[],n._points),o=i._getXValues(e.points),a=i._getYValues(e.points),n.xRange.min=Math.min.apply(Math,o),n.xRange.max=Math.max.apply(Math,o),n.yRange.min=Math.min.apply(Math,a),n.yRange.max=Math.max.apply(Math,a),n.segment.push(e),f=t.extend(!0,{},n),f.name="trendSeries",f.width=n.width,f.fill=n.fill,f.type="line",p=[],s=n.period,u=0;u<n._points.length;++u)v=n._points,u<s||(n._points[u].YValues[0]=n._points[u].y=v[u].close/v[u-s].close*100);for(r=0;r<s&&r<n._points.length;r++)n._points[r].YValues[0]=n._points[r].y=null;for(f.points=t.extend(!0,[],n._points),o=i._getXValues(f.points),h=[],u=s,y=0;u<f.points.length;u++,y++)h[y]=f.points[u].y;n.xRange.min=Math.min(Math.min.apply(Math,o),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,o),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,h),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,h),n.yRange.max);n.segment.push(f);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.momentum=ej.ejMomentum;ej.EjSeriesRender.prototype={getOrigin:function(n,t,i){if(i.axes[t.xAxis.name]._validCross){var r=n.chartObj._getCrossAxis(n.chartObj.model._axes,!0,t.xAxis.crossesInAxis);if(n.chartObj.model.requireInvertedAxes?t.xAxis.name:t.yAxis.name===r.name)return t.xAxis._crossValue}return Math.max(t.yAxis.visibleRange.min,0)},setLineSeriesStyle:function(n){var i=t.inArray(n,this.chartObj.model._visibleSeries),r=this.chartObj.model.seriesColors[i],u=this.chartObj.svgRenderer.createGradientElement(this.getSeriesName(n)+i,r,0,0,0,t(this.chartObj.svgObject).height(),this.chartObj.gSeriesEle),f=this.chartObj.model.seriesBorderColors[i];return{SeriesInterior:u,SeriesBorder:f}},getSeriesName:function(n){return n.name?n.name.replace(/\s/g,""):"series"},drawAreaPath:function(n,i,r,u){var l=this.chartObj.model.requireInvertedAxes,e=t.inArray(n,this.chartObj.model._visibleSeries),h=null,a=this.chartObj.model.AreaType,o=n.border,s,c,f;a=="cartesianaxes"&&(s=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,l),h="translate("+s.x+","+s.y+")");c={id:this.chartObj.svgObject.id+"_SeriesGroup_"+e,transform:h};this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(c);r!=""&&(f={id:this.chartObj.svgObject.id+"_Series"+e,fill:i.SeriesInterior,"fill-opacity":n.opacity,"stroke-width":o.width,stroke:o.color,"stroke-dasharray":o.dashArray,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,d:r},this.chartObj.dragPoint?(f.id=this.chartObj.svgObject.id+"_PreviewSeries"+e,f["fill-opacity"]=.6,this.chartObj.model.enableCanvasRendering?this.chartObj.svgRenderer.drawPath(f,this.chartObj.canvasElement,u):this.chartObj.svgRenderer.drawPath(f,this.chartObj.gPreviewSeriesGroupEle,u)):this.chartObj.svgRenderer.drawPath(f,this.gSeriesGroupEle,u))},setAreaSeriesStyle:function(n){var r=t.inArray(n,this.chartObj.model._visibleSeries),s=Math.max.apply(0,t.map(n.points,function(n){return n.YValues[0]})),h=Math.min.apply(0,t.map(n.points,function(n){return n.YValues[0]})),u=Math.min.apply(0,t.map(n.points,function(n){return n.xValue})),f={xValue:u,YValues:[]},i;f.YValues[0]=h;i={xValue:u,YValues:[]};i.YValues[0]=s;var e=ej.EjSvgRender.utils._getPoint(f,n),o=ej.EjSvgRender.utils._getPoint(i,n),c=this.chartObj.model.seriesColors[r],l=this.chartObj.svgRenderer.createGradientElement(this.getSeriesName(n)+r,c,e.X,e.Y,o.X,o.Y,this.chartObj.gSeriesEle);return{SeriesInterior:l}},naturalSpline:function(n){var h=n.length,f=0,i=[],u=[],t,s,r;for(i[0]=u[0]=0,i[n.length-1]=0,t=1;t<h-1;t++){var e=n[t].xValue-n[t-1].xValue,c=n[t+1].xValue-n[t-1].xValue,o=n[t+1].xValue-n[t].xValue,l=n[t+1].YValues[f]-n[t].YValues[f]||null,a=n[t].YValues[f]-n[t-1].YValues[f];e==0||c==0||o==0?(i[t]=0,u[t]=0):(s=1/(e*i[t-1]+2*c),i[t]=-s*o,u[t]=s*(6*(l/o-a/e)-e*u[t-1]))}for(r=h-2;r>=0;r--)i[r]=i[r]*i[r+1]+u[r];return i},getBezierControlPoints:function(n,t,i,r,u){var o,s,f=1/3,e=t.xValue-n.xValue;e=e*e;var h=2*parseFloat(n.xValue)+parseFloat(t.xValue),c=parseFloat(n.xValue)+2*parseFloat(t.xValue),l=2*n.YValues[u]+t.YValues[u],a=n.YValues[u]+2*t.YValues[u],v=f*(l-f*e*(i+.5*r)),y=f*(a-f*e*(.5*i+r));return o={xValue:h*f,YValues:[v]},s={xValue:c*f,YValues:[y]},{controlPoint1:o,controlPoint2:s}},improveChartPerformance:function(n){for(var l=[],r=n.xAxis.visibleRange,u=n.yAxis.visibleRange,i=n.pointCollection&&n.dragPoint?n.pointCollection:n.points,a=this.chartObj.model.m_AreaBounds,f,b=r.max-r.min,k=u.max-u.min,e=Math.abs(b*1/a.Width),o=Math.abs(k*1/a.Height),v=i[0]&&i[0].X>e?0:e,y=i[0]&&i[0].y>o?0:o,s=0,h=0,p,t,d=i.length,w=0,c=0;c<d;c++)t=i[c],t.fill&&(n.pointFill=!0),p=t.isEmpty===null||t.isEmpty===undefined?!1:t.isEmpty,t.visible=t.visible===null||t.visible===undefined?!0:t.visible,t.xValue===null||t.xValue===undefined?(t.isEmpty=!0,t.visible=!1,t.xValue=r.min):(t.isEmpty=p,jQuery.type(t.xValue)=="date"&&(t.xValue=t.xValue.getTime())),t.YValues[0]==null||t.YValues[0]=="undefined"||t.YValues[0]===""?(t.isEmpty=!0,t.visible=!1,t.YValues[0]=u.min):(t.isEmpty=t.isEmpty,t.visible=t.isEmpty?!t.isEmpty:t.visible),s=t.xValue,h=t.YValues[0],(Math.abs(v-s)>=e||Math.abs(y-h)>=o||n.enableSmartLabels)&&(l[w]=t,v=s,y=h,w++);return f=this._calculateEmptyPoints(n,l),n._visiblePoints=f,f},_isVisiblePoints:function(n){for(var t=n.pointCollection&&n.dragPoint?n.pointCollection:n.points,r,f,u=ej.util.isNullOrUndefined,e=t.length,i=0;i<e;i++)f=u(t[i].isEmpty)?!1:t[i].isEmpty,t[i].visible=u(t[i].visible)?!0:t[i].visible,u(t[i].xValue)?(t[i].isEmpty=!0,t[i].visible=!1,t[i].xValue=n.xAxis?n.xAxis.visibleRange.min:null):t[i].isEmpty=f,t[i].YValues[0]==null||t[i].YValues[0]=="undefined"||!n.isIndicator&&n._hiloTypes&&(t[i].YValues[1]==undefined||t[i].YValues[1]==null)?(t[i].isEmpty=!0,t[i].visible=!1):(t[i].isEmpty=t[i].isEmpty,t[i].visible=t[i].isEmpty?!t[i].isEmpty:t[i].visible),u(t[i].x)||jQuery.type(t[i].xValue)=="date"&&(t[i].xValue=t[i].xValue.getTime());return r=n.emptyPointSettings?this._calculateEmptyPoints(n,t):t,n.type.toLowerCase()=="waterfall"&&this.chartObj.calculateWaterfallSeriesPoints(r),n._visiblePoints=r,r},_calculateEmptyPoints:function(n,i,r){var e,c=n.emptyPointSettings,l=c.style,v=l.color,s=ej.util.isNullOrUndefined,y=l.border.color,p=l.border.width,h=c.displayMode.toLowerCase(),w=c.visible,a=i.length,f,o=[],u;if(e=t.extend(!0,{},i,e),seriesType=n.type.toLowerCase(),e.length=i.length,h=seriesType=="boxandwhisker"?"gap":h,w)if(h!="gap")for(u=0;u<a;u++)if(e[u].actualIndex=s(r)?u:r.model._isPieOfPie?e[u].actualIndex:u,f=e[u],f.isEmpty&&(!s(f.x)||n._xAxisValueType=="string")){v!=""&&(f.fill=v);y!=""&&(f.border=f.border?f.border:{},f.border.color=y,f.border.width=p);switch(h){case"average":n._hiloTypes?t.each(f.YValues,function(n,t){t=((e[u-1]?e[u-1].YValues[n]:0)+(e[u+1]?e[u+1].isEmpty?0:e[u+1].YValues[n]:0))/2;f.YValues[n]=t;ej.EjSeriesRender.prototype._sethlocPoint(n,f,t)}):(value=((e[u-1]?e[u-1].y:0)+(e[u+1]?e[u+1].isEmpty?0:e[u+1].y:0))/2,f.YValues[0]=value,f.y=value);break;case"zero":n._hiloTypes?t.each(f.YValues,function(n){f.y=0;f.YValues[n]=0;ej.EjSeriesRender.prototype._sethlocPoint(n,f,0)}):(f.YValues[0]=0,f.y=0)}f.isEmpty=!1;f.visible=!0;o.push(f)}else s(e[u].x)&&n._xAxisValueType!="string"||o.push(f);else for(u=0;u<a;u++)e[u].actualIndex=s(r)?u:r.model._isPieOfPie?e[u].actualIndex:u,o[u]=e[u];else for(u=0;u<a;u++)e[u].actualIndex=u,e[u].visible&&o.push(e[u]);return o},_sethlocPoint:function(n,t,i){switch(n){case 0:t.high=i;break;case 1:t.low=i;break;case 2:t.open=i;break;case 3:t.close=i}},_calculatePolarAxesSegment:function(n){var r=n._visiblePoints,l=ej.EjSvgRender.utils._getStringBuilder(),nt=t.inArray(n,this.chartObj.model._visibleSeries),c,e=this.chartObj.model.centerX,o=this.chartObj.model.centerY,rt=this._getSeriesPosition(n),h,ct,w,et,ot,tt,it,lt,st,i,u,b,ut,ht,bt,ft,kt,g;if(c=t.extend(!0,{},n.marker.size,c),c.width<=10&&(c.width=c.height=1.5*this.chartObj.model.elementSpacing),n.drawType.toLowerCase()=="column"){h=0;ct={id:this.chartObj.svgObject.id+"_SeriesGroup_"+nt};this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(ct);w=n.xAxis.visibleRange.interval;n.xAxis.labelPlacement=n.xAxis.labelPlacement?n.xAxis.labelPlacement:"betweenticks";et=0;(n.xAxis._valueType!="category"||n.xAxis._valueType=="category"&&n.xAxis.labelPlacement=="onticks")&&(et=w/2);ot=n.xAxis.isInversed?0:1;w=w/rt.all;var lt=w,s=n._visiblePoints,dt=n.xAxis._valueType!="category"?s.length-1:s.length;for(tt=0;tt<dt;tt++)it=temp=s[tt].xValue-n.xAxis.visibleRange.min+(w*rt.pos-et),it=it/this.chartObj.model.sumofYValues,point=s[tt],lt=n.xAxis.visibleRange.interval/rt.all,point.startAngle=2*Math.PI*it,point.endAngle=2*Math.PI*(it+lt/this.chartObj.model.sumofYValues);s[s.length-1].startAngle||(s[s.length-1].startAngle=s[0].startAngle,s[s.length-1].endAngle=s[0].endAngle)}for(st=!1,i=0;i<r.length;i++)if(r[i].visible){if(n.drawType.toLowerCase()=="line")u=ej.EjSvgRender.utils.TransformToVisible(n,r[i].xValue,r[i].y,this.chartObj),i<r.length-1&&r[i+1].visible?(b=ej.EjSvgRender.utils.TransformToVisible(n,r[i+1].xValue,r[i+1].y,this.chartObj),l.append("M "+u.X+" "+u.Y+" L "+b.X+" "+b.Y+" ")):i==r.length-1&&n.isClosed&&(b=ej.EjSvgRender.utils.TransformToVisible(n,r[0].xValue,r[0].y,this.chartObj),l.append("M "+u.X+" "+u.Y+" L "+b.X+" "+b.Y+" "));else if(n.drawType.toLowerCase()=="column"){var w=n.xAxis.visibleRange.interval,ot=n.xAxis.isInversed?0:1,w=w/rt.all,f=this.chartObj.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,r[i].y),at=-.5*Math.PI,k=r[i].startAngle+at,d=r[i].endAngle+at-1e-6,a,v,y,p;if(n.isStacking){ut=n.stackedValue.StartValues[i];ht=n.stackedValue.EndValues[i];f=ut==ht?0:this.chartObj.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,ht);a=e+f*Math.cos(k);v=o+f*Math.sin(k);y=e+f*Math.cos(d);p=o+f*Math.sin(d);h=this.chartObj.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,ut==0&&n.yAxis.visibleRange.min!=0?n.yAxis.visibleRange.min:ut);var vt=e+h*Math.cos(k),yt=o+h*Math.sin(k),pt=e+h*Math.cos(d),wt=o+h*Math.sin(d);direction=this.chartObj.model.isPolar?"M "+a+" "+v+" A "+f+" "+f+" 0 0 "+ot+" "+y+" "+p+" L "+pt+" "+wt+" A "+h+" "+h+" 1 0 0 "+vt+" "+yt+" z":"M "+a+" "+v+" L "+y+" "+p+" L "+pt+" "+wt+" L "+vt+" "+yt+" z"}else a=e+f*Math.cos(k),v=o+f*Math.sin(k),y=e+f*Math.cos(d),p=o+f*Math.sin(d),direction=this.chartObj.model.isPolar?"M "+a+" "+v+" A "+f+" "+f+" 0 0 "+ot+" "+y+" "+p+" L "+e+" "+o+" z":"M "+a+" "+v+" L "+y+" "+p+" L "+e+" "+o+" z";if(bt=this.chartObj.svgRenderer.createGradientElement(this.getSeriesName(n)+"_"+nt+i,this.chartObj.model.seriesColors[nt],0,0,0,100,this.chartObj.gSeriesEle),ft=n.border,options={id:this.chartObj.svgObject.id+"_Series"+nt+"_Point"+i,fill:bt,stroke:ft.color,"stroke-dasharray":ft.dashArray,"stroke-width":ft.width,seriesIndex:nt,opacity:n.opacity,pointIndex:i,d:direction,start:r[i].startAngle-1.57,end:r[i].endAngle-1.57,radius:f,innerR:h},this.chartObj.model.isPolar&&(options.x=e,options.y=o,g={PointIndex:i,StartAngle:r[i].startAngle,EndAngle:r[i].endAngle,CenterX:e,CenterY:o,Radius:f,DRadius:h}),n.type=="radar"){var gt={x:e,y:o},ni={x:a,y:v},ti={x:y,y:p};g={PointIndex:i,Line1:gt,Line2:ni,Line3:ti};kt=h?!0:!1;options.hasStackingInnerRadius=kt}point=n._visiblePoints[i];(!ej.util.isNullOrUndefined(n.marker)&&n.marker.visible||!ej.util.isNullOrUndefined(n.marker)&&n.marker.dataLabel.visible)&&(point.symbolLocation={X:(a+y)/2,Y:(v+p)/2});this.chartObj.svgRenderer.drawPath(options,this.gSeriesGroupEle)}else u=ej.EjSvgRender.utils.TransformToVisible(n,r[i].xValue,r[i].y,this.chartObj),i==0||st?l.append("M "+u.X+" "+u.Y+" "):i==r.length-1?n.isClosed?(b=ej.EjSvgRender.utils.TransformToVisible(n,r[0].xValue,r[0].y,this.chartObj),l.append("L "+u.X+" "+u.Y+" z")):l.append("L "+u.X+" "+u.Y+" L "+e+" "+o):r[i+1].visible?l.append("L "+u.X+" "+u.Y+" "):l.append("L "+u.X+" "+u.Y+" L "+e+" "+o+" z"),st=r[i+1]&&r[i+1].visible?!1:!0;n.regionAdded||n.drawType.toLowerCase()=="column"||(g={X:u.X-c.width/2,Y:u.Y-c.height/2,Width:c.width,Height:c.height},ej.EjSvgRender.utils._addRegion(this.chartObj,g,n,r[i],i));!n.regionAdded&&n.drawType.toLowerCase()=="column"&&this.chartObj.model.enableCanvasRendering&&ej.EjSvgRender.utils._addRegion(this.chartObj,g,n,null,null)}return n.regionAdded||n.drawType.toLowerCase()!="column"||this.chartObj.model.enableCanvasRendering||ej.EjSvgRender.utils._addRegion(this.chartObj,g,n,null,null),l.toString()},_calculateVisiblePoints:function(n,i){for(var r,h=[],s=[],a,o=ej.util.isNullOrUndefined,c=o(i)?n.points:i.model._isPieOfPie?n.pieCollections[n.collectionIndex]:n.points,f,l=c.length,u,e=0;e<l;e++)u=c[e],o(u._visibility)&&(u._visibility="visible"),u.actualIndex=o(i)?e:i.model._isPieOfPie?u.actualIndex:e,u.visible=u.isEmpty?!1:u.visible,o(u.visible)&&(u.visible=!0),u.y<0&&(u.YValues[0]=Math.abs(u.YValues[0])),o(u.x)&&n._xAxisValueType!="string"&&(u.visible=!1,u.isEmpty=!0),o(u.y)&&(u.visible=!1,u.isEmpty=!0);if(f=t.extend(!0,{},c,f),f.length=l,n.emptyPointSettings.visible)for(emptyPoints=this._calculateEmptyPoints(n,f,i),a=emptyPoints.length,r=0;r<a;r++)emptyPoints[r].visible?(emptyPoints[r].visible=emptyPoints[r]._visibility=="hidden"?!1:!0,s.push(emptyPoints[r]),emptyPoints[r].visible&&h.push(emptyPoints[r])):(emptyPoints[r].y=((emptyPoints[r-1]?emptyPoints[r-1].y:0)+(emptyPoints[r+1]?emptyPoints[r+1].y:0))/2,isNaN(emptyPoints[r].y)&&(emptyPoints[r].y=((emptyPoints[r-2]?emptyPoints[r-2].y:0)+(emptyPoints[r+2]?emptyPoints[r+2].y:0))/2),emptyPoints[r].YValues[0]=emptyPoints[r].y,o(emptyPoints[r].x)&&n._xAxisValueType!="string"||(emptyPoints[r].gapMode=!0,h.push(emptyPoints[r])));else for(r=0;r<l;r++)s.push(f[r]),f[r].visible&&(f[r].visible=f[r]._visibility=="hidden"?!1:!0,f[r].visible&&h.push(f[r]));if(n.visibility=="hidden")for(e=0;e<s.length;e++)s[e].visible=!1;return n._visiblePoints=h,n.visiblePoints=s,{visiblePoints:h,legendPoints:s}},getMinMaxValue:function(n,t,i){var u=Math.min(n.x,t.x),f=Math.min(n.y,t.y),e=Math.max(n.x,t.x),o=Math.max(n.y,t.y),r;switch(i){case 0:case 360:r=o;break;case 90:r=u;break;case 180:r=f;break;case 270:r=e}return r},pieDoughnutCenter:function(n){var p=n.startAngle,w=n.endAngle,y,v,e,r;this.chartObj.model.centerCount++;var i=t.inArray(n,this.chartObj.model._visibleSeries),o=[-630,-540,-450,-360,-270,-180,-90,0,90,180,270,360,450,540,630],u=[],nt=this.chartObj.model.circleCenterX[i],tt=this.chartObj.model.circleCenterY[i];if(n.startAngle<n.endAngle)for(r=0;r<o.length;r++)o[r]>p&&o[r]<w&&(u[u.length]=o[r]%360<0?o[r]%360+360:o[r]%360);else for(r=0;r<o.length;r++)o[r]<p&&o[r]>w&&(u[u.length]=o[r]%360<0?o[r]%360+360:o[r]%360);if(this.chartObj.model.centerCount==1){var f=this.chartObj.model.circularRadius[i],b=2*Math.PI*(p-90)/360,k=2*Math.PI*(w-90)/360,a={x:this.chartObj.model.circleCenterX[i],y:this.chartObj.model.circleCenterY[i]},s={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(b),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(b)},h={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(k),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(k)};switch(u.length){case 0:var it=Math.abs(a.x-s.x)>Math.abs(a.x-h.x)?s.x:h.x,rt=Math.abs(a.y-s.y)>Math.abs(a.y-h.y)?s.y:h.y,e={x:(a.x+it)/2,y:(a.y+rt)/2};this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i]+(this.chartObj.model.circleCenterX[i]-e.x);this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i]+(this.chartObj.model.circleCenterY[i]-e.y);break;case 1:y=2*Math.PI*(u[0]-90)/360;v={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(y),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(y)};switch(u[0]){case 0:case 360:c={x:s.x,y:v.y};l={x:h.x,y:a.y};break;case 90:c={x:a.x,y:h.y};l={x:v.x,y:s.y};break;case 180:c={x:h.x,y:a.y};l={x:s.x,y:v.y};break;case 270:c={x:v.x,y:s.y};l={x:a.x,y:h.y}}e={x:(c.x+l.x)/2,y:(c.y+l.y)/2};this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i]+(this.chartObj.model.circleCenterX[i]-e.x>=f?0:this.chartObj.model.circleCenterX[i]-e.x);this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i]+(this.chartObj.model.circleCenterY[i]-e.y>=f?0:this.chartObj.model.circleCenterY[i]-e.y);break;case 2:var d=2*Math.PI*(u[0]-90)/360,y=2*Math.PI*(u[1]-90)/360,v={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(y),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(y)},g={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(d),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(d)},c,l;c=u[0]==90&&u[1]==180||u[0]==270&&u[1]==0?{x:g.x,y:v.y}:{x:v.x,y:g.y};l=u[0]==90||u[0]==270?{x:this.getMinMaxValue(s,h,u[0]),y:this.getMinMaxValue(s,h,u[1])}:{x:this.getMinMaxValue(s,h,u[1]),y:this.getMinMaxValue(s,h,u[0])};e={x:Math.abs(c.x-l.x)/2>=f?0:(c.x+l.x)/2,y:Math.abs(c.y-l.y)/2>=f?0:(c.y+l.y)/2};this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i]+(e.x==0?0:this.chartObj.model.circleCenterX[i]-e.x>=f?0:this.chartObj.model.circleCenterX[i]-e.x);this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i]+(e.y==0?0:this.chartObj.model.circleCenterY[i]-e.y>=f?0:this.chartObj.model.circleCenterY[i]-e.y)}}for(r=0;r<n.points.length;r++)i<this.chartObj.model._visibleSeries.length&&this.chartObj.model.centerCount>1&&this.chartObj.model._visibleSeries[i+1].startAngle==p&&this.chartObj.model._visibleSeries[i+1].endAngle==w&&(this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i+1],this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i+1]),this.chartObj.model.startX[r]=this.chartObj.model.startX[r]-(nt-this.chartObj.model.circleCenterX[i]),this.chartObj.model.startY[r]=this.chartObj.model.startY[r]-(tt-this.chartObj.model.circleCenterY[i])},_drawEmptyPieOfPie:function(n){var u=-.5*Math.PI,f=2*Math.PI+-.5*Math.PI-1e-6,i=n.model.circleCenterX[1],r=n.model.circleCenterY[1],t=n.model.circularRadius[1],o="M "+(i+t*Math.cos(u))+" "+(r+t*Math.sin(u))+" A "+t+" "+t+" 0 1 1 "+(i+t*Math.cos(f))+" "+(r+t*Math.sin(f))+" z",e=n.model.theme.toLowerCase();return{id:n.svgObject.id+"_Series0_EmptyCircle",fill:"none","stroke-width":1.5,stroke:e.indexOf("dark")>=0||e.indexOf("contrast")>=0?" #FFFFFF":"#000000","stroke-dasharray":"",d:o,opacity:1,radius:t,start:0-1.57,end:2*Math.PI-1.57,cx:i,cy:r}},calculatingSliceAngle:function(n,i){var e=this.chartObj?this.chartObj:i,r=e.model,w=r.legend,f=t.inArray(n,r._visibleSeries),b=w.position.toLowerCase(),st=r.LegendActualBounds,it=n._visiblePoints,wt=it.length,rt=0,o,ut=0,ht=w.border.width,ct=r.border.width,u,a=r.margin,lt=r.elementSpacing,l=0,v=r.title.subTitle.text?r.title.subTitle:"",et,yt,ot,nt,c,y,tt,s,pt,p,d,g,h;for(r.arcData=[],n.rightsidePoints=[],n.leftsidePoints=[],n.labels=[],r.sumofYValues=0,r.midPoint=0,type=n.type.toLowerCase(),gapWidthValue=n.gapWidth,h=0;h<it.length;h++)r.sumofYValues+=it[h].YValues[0];o=n.endAngle!=null&&type!="pieofpie"?n.endAngle-n.startAngle:360;o=o!=360&&o!=-360?o%360:o;n.startAngle&&type!="pieofpie"?(n.startAngle=n.startAngle%360,n.endAngle=n.startAngle+o,l=n.startAngle?r.sumofYValues/360*n.startAngle:0,l=l/r.sumofYValues,r.itemCurrentXPos=l):n.endAngle=o;w.visible&&b!="custom"&&(b=="right"||b=="left"?rt+=st.Width+ht*2+lt:ut+=st.Height+ht*2+lt);var at=r.title.text&&r.title.visible?r._titleLocation.size.height+r.elementSpacing+(v==""?0:v.text&&v.visible&&v.enableTrim&&(v.textOverflow=="wrap"||v.textOverflow=="wrapandtrim")?r._subTitleLocation.size.height:0):0,ft=.1*Math.min(t(e.svgObject).width(),t(e.svgObject).height()),k=t(e.svgObject).width()-(rt+a.left+a.right+ct*2)-(type=="pieofpie"?gapWidthValue:0),vt=t(e.svgObject).height()-(ut+at+a.top+a.bottom+ct*2);for(f=e.model._isPieOfPie?n.collectionIndex:f,type=="pieofpie"&&(k<ft&&(et=ft-k,k=ft),gapWidthValue=et?gapWidthValue-et:t(e.svgObject).width()>=gapWidthValue?gapWidthValue:0),yt=type=="pieofpie"?f==0?.25:.25*3:.5,r.circleCenterX[f]=k*yt+(f==1&&type=="pieofpie"?gapWidthValue:0)+a.left+(w.visible&&b==="left"?rt:0),r.circleCenterY[f]=vt*.5+a.top+at+(w.visible&&b==="top"?ut:0),ej.util.isNullOrUndefined(e.model.pieGapWidth)||e.model.pieGapWidth==0||(r.circleCenterX[f]=f==0?r.circleCenterX[f]+e.model.pieGapWidth/2:r.circleCenterX[f]-e.model.pieGapWidth/2),n.startAngle=type=="pieofpie"?0:n.startAngle,o=n.endAngle-n.startAngle,ot=o/180,nt=o/4*(Math.PI/180),c=0;c<wt;c++)u=n._visiblePoints[c],(u.visible||u.gapMode)&&(y=type=="pieofpie"?u.actualIndex:c,c==0&&f==0&&type=="pieofpie"?(tt=2*Math.PI*l,s=ot*Math.PI*(u.YValues[0]/r.sumofYValues)+tt,s=isNaN(s)?tt:s,p=(s+tt)/2,u.start=u.startAngle=nt-p,u.end=u.endAngle=nt+p,u.midAngle=nt):(u.startAngle=c==0?2*Math.PI*l:type=="pieofpie"?n.pieCollections[f][c-1].endAngle:s,s=u.endAngle=ot*Math.PI*(u.YValues[0]/r.sumofYValues)+u.startAngle,s=u.endAngle=isNaN(s)?u.startAngle:s,u.start=u.startAngle,u.end=u.endAngle,u.midAngle=(u.endAngle+u.startAngle)/2),u.pointIndex=y,pt=-.5*Math.PI,u.radian=u.midAngle%(2*Math.PI),n.labelPosition.toLowerCase()=="outsideextended"&&type!="pieofpie"&&(u.radian<Math.PI?n.rightsidePoints.push(u):n.leftsidePoints.push(u)),l+=u.YValues[0]/r.sumofYValues,p=u.midAngle+pt,(u.actualIndex==n.explodeIndex||n.explodeAll)&&!e.vmlRendering?(r.startX[y]=r.circleCenterX[f]+Math.cos(p)*n.explodeOffset,r.startY[y]=r.circleCenterY[f]+Math.sin(p)*n.explodeOffset):(r.startX[y]=r.circleCenterX[f],r.startY[y]=r.circleCenterY[f]));if(n.labelPosition.toLowerCase()=="outsideextended"&&(n.rightsidePoints=ej.DataManager(n.rightsidePoints,ej.Query().sortBy("radian")).executeLocal(),n.leftsidePoints=ej.DataManager(n.leftsidePoints,ej.Query().sortBy("radian")).executeLocal()),n.marker.dataLabel.template)if(n.labelPosition.toLowerCase()=="outsideextended"){for(d=0;d<n.rightsidePoints.length;d++)ej.EjSvgRender.utils._getSeriesTemplateSize(n.rightsidePoints[d],n.rightsidePoints[d].pointIndex,n,!1,e);for(g=0;g<n.leftsidePoints.length;g++)ej.EjSvgRender.utils._getSeriesTemplateSize(n.leftsidePoints[g],n.leftsidePoints[g].pointIndex,n,!0,e)}else for(h=0;h<n._visiblePoints.length;h++)ej.EjSvgRender.utils._getSeriesTemplateSize(n._visiblePoints[h],n._visiblePoints[h].actualIndex,n,!0,e);else ej.EjSvgRender.utils._getSeriesMaxLabel(n);return n.finalSize={width:k,height:vt},n.finalSize},_drawHiloPath:function(n,i,r,u,f,e){var l=t.inArray(n,this.chartObj.model._visibleSeries),a={name:n.type,id:this.chartObj.svgObject.id+"_Series"+l+"_Point"+f,fill:"none","stroke-dasharray":n.dashArray,"stroke-width":i.borderWidth,stroke:r,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,opacity:n.opacity,d:u},o,s,h,c;this.chartObj.svgRenderer.drawPath(a,this.gSeriesGroupEle);h=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.chartObj.model.requireInvertedAxes);x=Math.min(e.point2.X,e.point1.X)+h.x-i.borderWidth;y=Math.min(e.point2.Y,e.point1.Y)+h.y;e.point1.Y!=e.point2.Y?(o=i.borderWidth+i.borderWidth/2,s=Math.abs(e.point1.Y-e.point2.Y)):(o=Math.abs(e.point2.X-e.point1.X),s=i.borderWidth+i.borderWidth/2);c={X:x,Y:y,Width:o,Height:s};ej.EjSvgRender.utils._addRegion(this.chartObj,c,n,null,f)},isIntersec:function(n,t){return t.Bottom<n.Top||t.Right<n.Left||t.Top>n.Bottom||t.Left>n.Right?!1:!0},IntersectWith:function(n,r,u,f,e){var c=this,h,o,s;if((ej.util.isNullOrUndefined(n.model.rightsidebounds[e])||ej.util.isNullOrUndefined(n.model.leftsidebounds[e]))&&(n.model.leftsidebounds[e]=[],n.model.rightsidebounds[e]=[],n.model.leftsidebounds[e].points=[],n.model.rightsidebounds[e].points=[]),f=="outsideExtended"){for(i=e;i<n.model.bounds.length;i++)if(n.model._visibleSeries[i].labelPosition.toLowerCase()=="outsideextended"){if(!ej.util.isNullOrUndefined(n.model.bounds[i].points.left)&&n.model.bounds[i].points.left.length>0)for(h=n.model.bounds[i].points.left.length,o=h-1;o>=0&&!ej.util.isNullOrUndefined(n.model.bounds[i].points.left[o]);o--)n.model.leftsidebounds[i].points[o]=n.model.bounds[i].points.left[o];if(!ej.util.isNullOrUndefined(n.model.bounds[i].points.right)&&n.model.bounds[i].points.right.length>0)for(h=n.model.bounds[i].points.right.length,k=0;k<h&&!ej.util.isNullOrUndefined(n.model.bounds[i].points.right[k]);k++)n.model.rightsidebounds[i].points[k]=n.model.bounds[i].points.right[k]}}else if(n.model.bounds[e].points.length>0||e>=0)for(i=e;i<n.model.bounds.length&&!ej.util.isNullOrUndefined(n.model.bounds[i]);i++)if(n.model._visibleSeries[i].labelPosition.toLowerCase()!="outsideextended")for(h=n.model.bounds[i].points.length,o=0;o<h&&!ej.util.isNullOrUndefined(n.model.bounds[i].points[o]);o++)n.model.bounds[i].points[o].X<n.model.circleCenterX[e]?t.inArray(n.model.bounds[i].points[o],n.model.leftsidebounds[i].points)==-1&&(n.model.leftsidebounds[i].points[o]=n.model.bounds[i].points[o]):t.inArray(n.model.bounds[i].points[o],n.model.rightsidebounds[i].points)==-1&&(n.model.rightsidebounds[i].points[o]=n.model.bounds[i].points[o]);for(i=e;i<n.model.bounds.length&&!ej.util.isNullOrUndefined(n.model.bounds[i]);i++)if(n.model.leftsidebounds[i].points.length>0&&(bounds=n.model.leftsidebounds[i].points,bounds.length>0))for(o=bounds.length-1;o>=0;o--)if(s=bounds[o],!(ej.util.isNullOrUndefined(s)&&s!=u))if(s.SeriesIndex==u.SeriesIndex&&s.PointIndex==u.PointIndex)if(r.smartLabelPosition=="outside")continue;else break;else if(this.isIntersec(s,u))return!0;for(i=e;i<n.model.bounds.length&&!ej.util.isNullOrUndefined(n.model.bounds[i]);i++)if(bounds=n.model.rightsidebounds[i].points,bounds.length>0)for(o=bounds.length-1;o>=0;o--)if(s=bounds[o],!(ej.util.isNullOrUndefined(s)&&s!=u))if(s.SeriesIndex==u.SeriesIndex&&s.PointIndex==u.PointIndex)if(r.smartLabelPosition=="outside")continue;else break;else if(this.isIntersec(s,u))return!0;return!1},_calculateArcData:function(n,t,i,r,u,f){var u=n.model._isPieOfPie?f:u,ct=r._visiblePoints,ut=i.actualIndex,l=n,p=-.5*Math.PI,e,o,it,rt;r.type.toLowerCase()=="doughnut"&&r._visiblePoints.length==1&&Math.abs(r.endAngle-r.startAngle)==360&&r.startAngle%90!=0?(e=parseFloat((i.startAngle+p).toFixed(3)),o=parseFloat((i.endAngle+p).toFixed(3))-1e-6):(e=i.startAngle+p,o=i.endAngle+p-1e-6);var ft=r.endAngle-r.startAngle,w=o-e<Math.PI?0:1,tt=(e+o)/2;ej.util.isNullOrUndefined(i.currentMidAngle)&&(i.currentMidAngle=(e+o)/2);var b,h,c,v=ft>0?1:0,w=v?o-e<Math.PI?0:1:o-e>-1*Math.PI?0:1,s=l.model.circularRadius[u],a=l.model.innerRadius[u];(ut==r.explodeIndex||r.explodeAll)&&!l.vmlRendering?(h=l.model.circleCenterX[u]+Math.cos(tt)*r.explodeOffset,c=l.model.circleCenterY[u]+Math.sin(tt)*r.explodeOffset):(h=l.model.circleCenterX[u],c=l.model.circleCenterY[u]);var k=h+s*Math.cos(e),d=c+s*Math.sin(e),y=h+s*Math.cos(o),g=c+s*Math.sin(o);if(r.type.toLowerCase()=="doughnut"){var et=h+a*Math.cos(e),ot=c+a*Math.sin(e),nt=h+a*Math.cos(o),st=c+a*Math.sin(o),ht=v?0:1;e<0&&Math.round(i.endAngle-i.startAngle)==6&&(nt=nt-.01,y=y-.01);b="M "+k+" "+d+" A "+s+" "+s+" 0 "+w+" "+v+" "+y+" "+g+" L "+nt+" "+st+" A "+a+" "+a+" 1 "+w+" "+ht+" "+et+" "+ot+" z"}else(i.endAngle-i.startAngle).toFixed(4)==(2*Math.PI).toFixed(4)?(it=h,rt=c,b="M "+k+" "+d+" A "+s+" "+s+" 0 "+w+" "+v+" "+y+" "+g):b="M "+k+" "+d+" A "+s+" "+s+" 0 "+w+" "+v+" "+y+" "+g+" L "+h+" "+c+" z";return{Direction:b,centerX:it,centerY:rt}},getXCordinate:function(n,t,i){return n+t*Math.cos(i)},getYCordinate:function(n,t,i){return n+t*Math.sin(i)},getDoubleRange:function(n,t){var i,r;n>t?(i=t,r=n):(i=n,r=t);var u=r-i,f=(i+r)/2,e=isNaN(i)||isNaN(r);return{Start:i,End:r,Delta:u,Median:f,IsEmpty:e}},isDependentSeries:function(n){var t=n.type.toLowerCase(),i=this.chartObj.model.requireInvertedAxes;return!i||i&&n.isTransposed?t.indexOf("bar")!=-1&&!n._isTransposed||t.indexOf("column")!=-1||t.indexOf("waterfall")!=-1||t.indexOf("hilo")!=-1||t.indexOf("candle")!=-1||t.indexOf("boxandwhisker")!=-1?!0:!1:t.indexOf("bar")!=-1?!0:!1},getPointXYOrgin:function(n,t,i,r){var e=r.model.requireInvertedAxes,u,f;return i.isTransposed&&e||i._isTransposed?(u=(1-ej.EjSvgRender.utils._valueToCoefficient(i.xAxis,n))*i.xAxis.height,f=ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,t)*i.yAxis.width,{X:f,Y:u}):(u=ej.EjSvgRender.utils._valueToCoefficient(i.xAxis,n)*i.xAxis.width,f=(1-ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,t))*i.yAxis.height,{X:u,Y:f})},getRectangle:function(n,t,i,r,u,f){var e=this.getPointXYOrgin(n,t,u,f),o=this.getPointXYOrgin(i,r,u,f);return ej.EjSvgRender.utils._correctRect(e.X,e.Y,o.X,o.Y)},calculateMean:function(n,t,i){var u,f,l,a,v,y,e,o,tt,p,it,rt,w,ut,ft,et,ot=0,c=0,s=[],r=0,b,h,ct;for(n.length>1&&n.sort(function(n,t){return n-t}),b=0;b<n.length;b++)ot=ot+n[b];c=ot/n.length;c=parseInt(c.toFixed(2));s[r]=c;r++;t.boxPlotMode.toLowerCase()=="normal"?(u=n.length%2==0?n.slice(0,n.length/2):n.slice(0,Math.floor(n.length/2)),a=Math.floor(u.length/2),e=u.length%2==0?(u[a-1]+u[a])/2:u[a],e=n.length<=3?n[0]:e,s[r]=e,r++,f=n.length%2==0?n.slice(n.length/2,n.length):n.slice(Math.ceil(n.length/2),n.length),v=Math.floor(f.length/2),o=f.length%2==0?(f[v-1]+f[v])/2:f[v],o=n.length<=3?n[n.length-1]:o,s[r]=o,r++):(t.boxPlotMode.toLowerCase()=="exclusive"||t.boxPlotMode.toLowerCase()=="inclusive")&&(tt=t.boxPlotMode.toLowerCase()=="exclusive"?(n.length+1)/4:(n.length-1)/4,p=Math.floor(tt),it=tt-p,ft=t.boxPlotMode.toLowerCase()=="exclusive"?p-1:p,u=(1-it)*n[ft]+it*n[ft+1],u=n.length<=3?n[0]:u,e=u,s[r]=e,r++,rt=t.boxPlotMode.toLowerCase()=="exclusive"?3*(n.length+1)/4:3*(n.length-1)/4,w=Math.floor(rt),ut=rt-w,et=t.boxPlotMode.toLowerCase()=="exclusive"?w-1:w,f=(1-ut)*n[et]+ut*n[et+1],f=n.length<=3?n[n.length-1]:f,o=f,s[r]=o,r++);y=Math.floor(n.length/2);l=n.length%2==0?(n[y-1]+n[y])/2:n[y];s[r]=l;r++;var st=o-e,lt=o+1.5*st,at=e-1.5*st,k=n[n.length-1],d=n[0],g=[],ht=0,nt=0;for(h=0;h<n.length;h++)lt<n[h]&&(ht++,g[nt]=n[h],nt++,k=n[h-ht]),at>n[h]&&(g[nt]=n[h],nt++,d=n[h+1]);return s[r]=d,r++,s[r]=k,r++,ct={Minimum:d,LowerQuartile:e,midvalue:l,UpperQuartile:o,Maximum:k,boxAverage:c,outliers:g},t._visiblePoints[i].boxPlotValues=ct,t._visiblePoints[i].boxPlotValues.quartileValues=s,{Minimum:d,LowerQuartile:e,midvalue:l,UpperQuartile:o,Maximum:k,boxAverage:c,outliers:g}},calculateBoxAndWhiskerPath:function(n,t,i,r,u,f,e){var y,p,b,k,d;u._visiblePoints[e].boxPlotLocation=[];u._visiblePoints[e].dataLabelLocation=[];var h=0,o=this,w=u._isTransposed,g=this.chartObj.model.requireInvertedAxes,s,l,a,v,c;for(y=0;y<u._visiblePoints[e].boxPlotValues.quartileValues.length;y++)l={xValue:f.xValue,YValues:u._visiblePoints[e].boxPlotValues.quartileValues[y]},a=ej.EjSvgRender.utils._getPoint(l,u),u._visiblePoints[e].boxPlotLocation[h]=a,u._visiblePoints[e].boxPlotLocation[h].xValue=l.xValue,u._visiblePoints[e].boxPlotLocation[h].YValues=l.YValues,u._visiblePoints[e].dataLabelLocation[h]=w?{X:a.X,Y:t.Y+t.Height/2+5}:{X:t.X+t.Width/2,Y:a.Y},h++;for(p=0;p<r.outliers.length;p++)v={xValue:f.xValue,YValues:r.outliers[p]},c=ej.EjSvgRender.utils._getPoint(v,u),u._visiblePoints[e].boxPlotLocation[h]=c,u._visiblePoints[e].boxPlotLocation[h].xValue=v.xValue,u._visiblePoints[e].boxPlotLocation[h].YValues=v.YValues,u._visiblePoints[e].boxPlotLocation[h].outlier=!0,w?c.Y=t.Y+t.Height/2:c.X=t.X+t.Width/2,u._visiblePoints[e].dataLabelLocation[h]=w?{X:c.X-u.outlierSettings.size.height,Y:t.Y+t.Height/2+u.outlierSettings.size.width,outlier:!0}:{X:t.X+t.Width/2,Y:c.Y,outlier:!0},h++;return s=u._visiblePoints[e].boxPlotLocation,u._isTransposed?(b="M "+(o.chartObj.canvasX+s[4].X)+" "+(o.chartObj.canvasY+t.Y)+" L "+(s[4].X+o.chartObj.canvasX)+" "+(t.Height+t.Y+o.chartObj.canvasY)+" M "+(o.chartObj.canvasX+s[4].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" L "+(o.chartObj.canvasX+s[1].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" z",k="M "+(o.chartObj.canvasX+s[5].X)+" "+(o.chartObj.canvasY+t.Y)+" L "+(o.chartObj.canvasX+s[5].X)+" "+(t.Height+t.Y+o.chartObj.canvasY)+" M "+(o.chartObj.canvasX+s[5].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" L "+(o.chartObj.canvasX+s[2].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" z"):(b="M "+(o.chartObj.canvasX+t.X)+" "+(o.chartObj.canvasY+s[4].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width)+" "+(o.chartObj.canvasY+s[4].Y)+" M "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[4].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[1].Y)+" z",k="M "+(o.chartObj.canvasX+t.X)+" "+(o.chartObj.canvasY+s[5].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width)+" "+(o.chartObj.canvasY+s[5].Y)+" M "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[5].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[2].Y)+" z"),d=u._isTransposed?"M "+(o.chartObj.canvasX+s[0].X-5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2-5)+" L "+(o.chartObj.canvasX+s[0].X+5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2+5)+" M "+(o.chartObj.canvasX+s[0].X+5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2-5)+" L "+(o.chartObj.canvasX+s[0].X-5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2+5)+" z":"M "+(o.chartObj.canvasX+t.X+t.Width/2-5)+" "+(o.chartObj.canvasY+s[0].Y-5)+" L "+(o.chartObj.canvasX+t.X+t.Width/2+5)+" "+(o.chartObj.canvasY+s[0].Y+5)+" M "+(o.chartObj.canvasX+t.X+t.Width/2-5)+" "+(o.chartObj.canvasY+s[0].Y+5)+" L "+(o.chartObj.canvasX+t.X+t.Width/2+5)+" "+(o.chartObj.canvasY+s[0].Y-5)+" z",{upperWhisker:k,lowerWhisker:b,mean:d}},calculateSides:function(n,t){var i=n.xValue+t.Start,r=n.xValue+t.End;return{x1:i,x2:r}},_getSeriesPosition:function(n){var o,s,i,r,u,f,t,e;if(ej.util.isNullOrUndefined(n.position)||this.chartObj.model.legendCollapsed){for(i=0,r=[],u=0;u<this.chartObj.model._visibleSeries.length;u++)t=this.chartObj.model._visibleSeries[u],t.visibility.toLowerCase()==="visible"&&t.drawType.toLowerCase()=="column"&&r.push(t);for(f=0;f<r.length;f++)t=r[f],t._xAxisName==this.chartObj.model._axes[0].name&&t._yAxisName==this.chartObj.model._axes[1].name&&(t.isStacking?(o||(s=i,i++,o=!0),t.position=s):(t.position=i,i++));for(e=0;e<r.length;e++)r[e].all=i}return{all:n.all,pos:n.position}},getSideBySidePositions:function(n,i){var o=this,e=[],f=o.chartObj.model,r,u=j=k=0,h=f._visibleSeries.length,s,c;return(ej.util.isNullOrUndefined(n.position)||f.legendCollapsed||!i.spacingCalculated)&&(s=f.requireInvertedAxes?f.vAxes:f.hAxes,c=f.requireInvertedAxes?f.hAxes:f.vAxes,t.each(s,function(n,t){var c=[],s,l,a,n;for(r=[],j=0;j<h;j++)s=f._visibleSeries[j],s.visibility.toLowerCase()==="visible"&&o.isDependentSeries(s)&&t.name==s._xAxisName&&c.push(s);for(l=c.length,j=0;j<l;j++)n=f.requireInvertedAxes?c[j].yAxis.columnIndex:c[j].yAxis.rowIndex,r[n]||(r[n]=[],c[j].yAxis.position=null),r[n].push(c[j]);for(u=0;u<r.length;u++)if(!ej.util.isNullOrUndefined(r[u]))for(r[u].all=0,j=0;j<r[u].length;j++)s=r[u][j],s.type.toLowerCase().indexOf("stacking")!=-1?s.stackingGroup?ej.util.isNullOrUndefined(e[s.stackingGroup])?(r[u].all++,s.position=r[u].all,e[s.stackingGroup]=r[u].all):s.position=e[s.stackingGroup]:ej.util.isNullOrUndefined(s.yAxis.position)||f.legendCollapsed?(r[u].all++,s.position=r[u].all,s.yAxis.position=r[u].all,f.legendCollapsed=!1):s.position=s.yAxis.position:(r[u].all++,s.position=r[u].all);for(a=l>0&&c[0].columnWidth,k=0;k<l;k++)n=f.requireInvertedAxes?c[k].yAxis.columnIndex:c[k].yAxis.rowIndex,c[k].all=r[n].all,i.needSpace=i.needSpace||a!=c[k].columnWidth}),i.needSpace&&this.chartObj.model._sideBySideSeriesPlacement&&this._getColumnSpacing(r,i),i.spacingCalculated=!0),{all:n.all,pos:n.position}},getSideBySideInfo:function(n,t){var f;ej.util.isNullOrUndefined(n.xAxis.m_minPointsDelta)&&(this.chartObj.currentSeries=n,n.xAxis.m_minPointsDelta=ej.EjSvgRender.utils.getMinPointsDelta(n.xAxis,this.chartObj));var c=n.columnSpacing,e=n.columnWidth,o=this.getSideBySidePositions(n,t),l=o.pos,s=o.all,u=t.needSpace&&this.chartObj.model._sideBySideSeriesPlacement,r=n.xAxis.m_minPointsDelta*(u?1:e),h=u?t[n.name||n._name].loc:(l-1)/s-.5,i=this.getDoubleRange(h,h+(u?e:1)/s);return this.chartObj.model._sideBySideSeriesPlacement?(i.IsEmpty||(i=this.getDoubleRange(i.Start*r,i.End*r),f=c*i.Delta,i=this.getDoubleRange(i.Start+f/2,i.End-f/2)),i):this.getDoubleRange(-r/2,r/2)},_getColumnSpacing:function(n,t){for(var u=j=0,o,i,f,h,e,c=n.length;u<c;u++){var s=0,r={};for(o=n[u].length;j<o;j++)(i=n[u][j]).type.toLowerCase().indexOf("stacking")==-1?s+=i.columnWidth/i.all:r[f=i.stackingGroup]={width:Math.max(i.columnWidth,r[f]?r[f].width:0),all:i.all};for(h in r)s+=r[h].width/r[h].all;for(e=(1-s)/2-.5,j=0,o=n[u].length;j<o;j++)(i=n[u][j]).type.toLowerCase().indexOf("stacking")==-1?(t[i.name||(i._name="series"+u+j)]={loc:e},e+=i.columnWidth/i.all):r[f=i.stackingGroup].loc==null?(t[i.name||(i._name="series"+u+j)]={loc:e+(r[f].width-i.columnWidth)/2/i.all},r[f].loc=t[i.name||i._name].loc+i.columnWidth/2/i.all,e+=r[f].width/i.all):t[i.name||i._name]={loc:r[f].loc-i.columnWidth/2/i.all}}},draw:function(n,i){var k,s,r,d,o,h,p,v,u,i;if(this.chartObj=n,s=ej.EjSvgRender.utils._getStringBuilder(),i.animationType="path",r=i,d=this.setLineSeriesStyle(r),r.sorting&&(r.points=ej.DataManager(r.points,ej.Query().sortBy("xValue")).executeLocal()),o=this.improveChartPerformance(r),r.pointFill){var y=t.inArray(r,this.chartObj.model._visibleSeries),e,w,b,l,a,it=this.chartObj.model.requireInvertedAxes,g=0,f=this.chartObj,o=r._visiblePoints,nt=r._visiblePoints.length-1,tt=ej.EjSvgRender.utils._getTransform(r.xAxis,r.yAxis,it),rt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+y,transform:"translate("+tt.x+","+tt.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(rt),u=0;u<nt;u++)(b=o[u],c=o[u+1],e||(e=this.chartObj.setStyle(this,r,y,u)),c.visible&&b.visible&&(l=ej.EjSvgRender.utils._getPoint(b,r),a=ej.EjSvgRender.utils._getPoint(c,r),s.append("M "+(l.X+f.canvasX)+" "+(l.Y+f.canvasY)+" L "+(a.X+f.canvasX)+" "+(a.Y+f.canvasY)+" ")),w=this.chartObj.setStyle(this,r,y,u+1),w.interior==e.interior&&u!=nt-1&&c.visible)||(i={name:r.type,id:this.chartObj.svgObject.id+"_Series"+y+"_Point"+g,"stroke-dasharray":e.dashArray,fill:"none","stroke-width":e.width,"stroke-linecap":r.lineCap,"stroke-linejoin":r.lineJoin,stroke:e.interior,opacity:e.opacity,d:s.toString()},this.chartObj.svgRenderer.drawPath(i,this.gSeriesGroupEle),g++,s=ej.EjSvgRender.utils._getStringBuilder(),e=w)}else{for(h=null,v=-1,u=0;u<o.length;u++)if(p=o[u],p.visible){if(h!=null&&o.length>v+1){var c=o[v+1],l=ej.EjSvgRender.utils._getPoint(h,r),a=ej.EjSvgRender.utils._getPoint(c,r),f=this.chartObj;s.append("M "+(l.X+f.canvasX)+" "+(l.Y+f.canvasY)+" L "+(a.X+f.canvasX)+" "+(a.Y+f.canvasY)+" ")}h=p;v=u}else h=null;k=s.toString();this._drawLinePath(r,d,k)}this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},doCircularAnimation:function(n,i,r,u){var f=i.type.toLowerCase();if(f=="pie"||f=="doughnut"||f=="pieofpie"){var e=this,s,h,o=i.points[0]?i.points[0].startAngle:0,c=n.model._isPieOfPie?i.collectionIndex:0;visiblePoints=i.emptyPointSettings.visible?i.visiblePoints:i._visiblePoints;t.each(visiblePoints,function(r,l){s=l.startAngle;h=l.endAngle;n.model._radius=n.model._isPieOfPie?n.model.circularRadius[c]:n.model.circularRadius[u];l.startAngle=0;l.endAngle=l.startAngle;n.model.Radius=0;var a=t(n.gSeriesEle).find("#"+n.svgObject.id+"_SeriesGroup_"+u)[c].childNodes[r];f=="pie"||f=="pieofpie"?t(a).each(function(){this.StartAngle=o;this.EndAngle=o}).animate({StartAngle:s,EndAngle:h,pieRadius:n.model._radius},{duration:1200,queue:!1,step:function(f,o){if(o.prop.toString()==="StartAngle"?(l.startAngle=f,l.endAngle=l.startAngle):o.prop.toString()=="pieRadius"&&n.model?n.model.Radius=f:l.endAngle=f,n.model){var s=e._calculateArcData(n,r,l,i,u,c);n.svgRenderer._setAttr(t(a),{d:s.Direction});n.model.Radius=n.model._radius}},complete:function(){e.circularAnimationComplete(r,n,i)}}):t(a).each(function(){this.StartAngle=o;this.EndAngle=o}).animate({StartAngle:s,EndAngle:h},{duration:1200,queue:!1,step:function(f,o){if(o.prop.toString()==="StartAngle"?(l.startAngle=f,l.endAngle=l.startAngle):l.endAngle=f,n.model){var s=e._calculateArcData(n,r,l,i,u);n.svgRenderer._setAttr(t(a),{d:s.Direction});n.model.Radius=n.model._radius}},complete:function(){e.circularAnimationComplete(r,n,i)}})})}},circularAnimationComplete:function(n,i,r){if(!ej.util.isNullOrUndefined(i.model)){var e,f,u=t.inArray(r,i.model._visibleSeries),o;if(i.gSeriesTextEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gSeriesTextEle[u].id),{visibility:"visible"}),i.gSymbolGroupEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gSymbolGroupEle[u].id),{visibility:"visible"}),i.gDataLabelEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gDataLabelEle[u].id),{visibility:"visible"}),r.marker.dataLabel.template)for(o=t(i.element[0].childNodes[0].childNodes),f=0;f<o.length;f++)t(o[f]).css("display","block");i.gConnectorEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gConnectorEle[u].id),{visibility:"visible"});i.gConnectorLinesGroup&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gConnectorLinesGroup.id),{visibility:"visible"});i.model.AnimationComplete=!0;r.AnimationComplete=!0;e=t.extend({},ej.EjSvgRender.commonChartEventArgs);e.data={series:r};i._trigger("animationComplete",e)}},_doLineSymbol:function(n,i,r,u,f,e){if(n.tagName!="defs"){var y=parseInt(r*i),o=this.chartObj==undefined?e:this.chartObj,s=ej.EjSvgRender.utils._getBoundingClientRect(n,o,u,f),l=s.x+s.width/2,a=s.y+s.height/2,v,h=t(n),c=o.svgRenderer._getAttrVal(h,"transform");c=ej.util.isNullOrUndefined(c)?" ":c;o.svgRenderer._setAttr(h,{transform:"scale(0)"});h.delay(y).animate({scales:1},{duration:200,step:function(n){v=n;o.svgRenderer._setAttr(h,{transform:"translate("+l+" "+a+") scale("+v+") translate("+-l+" "+-a+")"+c})}})}},animateSymbol:function(n,i,r,u,f){if(n.tagName!="defs"){var s=this.chartObj==undefined?f:this.chartObj,e=ej.EjSvgRender.utils._getBoundingClientRect(n,s,r,u),c=e.x+e.width/2,l=e.y+e.height/2,a,h=t(n),o=s.svgRenderer._getAttrVal(h,"transform");o=ej.util.isNullOrUndefined(o)?" ":o;h.delay(i).each(function(){this.scale=.5}).animate({scales:1},{duration:500,step:function(n){a=n;s.svgRenderer._setAttr(h,{transform:"translate("+c+" "+l+") scale("+a+") translate("+-c+" "+-l+")"+o})}})}},animateCylinder:function(n,i,r,u){var e,f;i.isTransposed&&r?(e=u[0].width.animVal.value,n.model.series[0].type.indexOf("bar")>-1?(n.svgRenderer._setAttr(t(u),{x:e}),t(u).animate({x:0},2e3,function(){})):(f=u[0].height.animVal.value,n.svgRenderer._setAttr(t(u),{y:0}),t(u).animate({y:parseFloat(n.svgRenderer._getAttrVal(u,"y")),height:parseFloat(n.svgRenderer._getAttrVal(u,"height"))},{duration:2e3,step:function(i){n.svgRenderer._setAttr(t(u),{y:f-i});n.svgRenderer._setAttr(t(u),{height:i})}}))):n.model.series[0].type.indexOf("bar")>-1?t(u).animate({width:parseFloat(n.svgRenderer._getAttrVal(u,"width"))},{duration:2e3,step:function(i){n.svgRenderer._setAttr(t(u),{width:i})}}):(f=u[0].height.animVal.value,n.svgRenderer._setAttr(t(u),{y:f}),t(u).animate({y:0},2e3,function(){}))},animateRect:function(n,i,r,u){var f=ej.EjSvgRender.utils._getBoundingClientRect(n,u,i,r),e,o,h,c,l,s=t(n);i.isTransposed&&r||r?(u.svgRenderer._getAttrVal(s,"plot")==="negative"?(e=f.x+f.width,o=f.y+f.height):(e=f.x,o=f.y),h=") scale(",c=",1) translate("):(u.svgRenderer._getAttrVal(s,"plot")==="negative"?(e=f.x,o=f.y):(e=f.x+f.width,o=f.y+f.height),h=") scale(1,",c=") translate(");s.animate({scales:1},{duration:1e3,complete:function(){i.type.toLowerCase()=="waterfall"&&t("#"+u.svgObject.id+"_SeriesGroup_waterfallLine_"+i.index).attr("visibility","visible")},step:function(n){l=n;u.svgRenderer._setAttr(s,{transform:"translate("+e+" "+o+h+l+c+-e+" "+-o+")"})}})},animateStackingRect:function(n,i,r,u){var f,e,o,s,h=t(n),c,l,a,v=ej.EjSvgRender.utils._getBoundingClientRect(n,u,i,r);i.isTransposed&&r||r?(c=ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,0)*i.yAxis.width,f=c,e=v.y,o=") scale(",s=",1) translate("):(l=(1-ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,0))*i.yAxis.height,f=v.x,e=l,o=") scale(1,",s=") translate(");h.animate({scales:1},{duration:1e3,step:function(n){a=n;u.svgRenderer._setAttr(h,{transform:"translate("+f+" "+e+o+a+s+-f+" "+-e+")"})}})},_doLineAnimation:function(n,i){if(n.model.requireInvertedAxes){var r=parseFloat(n.svgRenderer._getAttrVal(i,"height"));t(i).animate({clipRectHeight:parseFloat(n.svgRenderer._getAttrVal(i,"height"))},{duration:2e3,step:function(u){n.svgRenderer._setAttr(t(i),{y:r-u});n.svgRenderer._setAttr(t(i),{height:u})}})}else t(i).animate({clipRectWidth:parseFloat(n.svgRenderer._getAttrVal(i,"width"))},{duration:2e3,step:function(r){n.svgRenderer._setAttr(t(i),{width:r})}})},_drawLinePath:function(n,i,r){var h=this.chartObj.model.requireInvertedAxes,f,e=t.inArray(n,this.chartObj.model._visibleSeries),o=null,s,u;this.chartObj.model.AreaType=="cartesianaxes"&&(f=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,h),o="translate("+f.x+","+f.y+")");s={id:this.chartObj.svgObject.id+"_SeriesGroup_"+e,transform:o};this.chartObj.gSeriesGroupEle=this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(s);r!=""&&r.indexOf("NaN")==-1&&(u={name:n.type,id:this.chartObj.svgObject.id+"_Series"+e,fill:"none","stroke-dasharray":n.dashArray,"stroke-width":n.width,stroke:i.SeriesInterior,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,opacity:n.opacity,d:r},this.chartObj.dragPoint?(u.id=this.chartObj.svgObject.id+"_PreviewSeries"+e,u.opacity=.6,this.chartObj.model.enableCanvasRendering?this.chartObj.svgRenderer.drawPath(u,this.chartObj.canvasElement,o):this.chartObj.svgRenderer.drawPath(u,this.chartObj.gPreviewSeriesGroupEle)):this.chartObj.svgRenderer.drawPath(u,this.gSeriesGroupEle))},drawDataLabel:function(n,i,r,u,f,e,o,s){var bt,a;r.marker=r.marker?r.marker:{};var w=n.yAxis.labelFormat,d,ct=20,ii=n.yAxis.valueType,b,kt=n._visiblePoints[i].boxPlotValues;value=n.type.toLowerCase()=="waterfall"&&(r.showIntermediateSum||r.showTotalSum)?r.waterfallSum:r.y;r.text?b=r.text:w?w.indexOf("{value}")>-1?b=w.replace("{value}",value):w.indexOf("e")==0||w.indexOf("E")==0?(d=w.match(/(\d+)/g),d=d==null?6:d>ct?ct:d,b=value.toExponential(d)):b=ej.format(value,w,this.chartObj.model.locale):b=value;var y=this.chartObj,ot=y.model,g=t.inArray(n,ot._visibleSeries),lt,p,ft=t.extend(!0,{},n.marker,r.marker),k=ft.dataLabel,c=k.font,dt=k.textPosition.toLowerCase(),at=n.type.toLowerCase(),gt=ej.util.isNullOrUndefined(c.size)?"11px":c.size,ni=ej.util.isNullOrUndefined(c.fontStyle)?"Normal":c.fontStyle,ti=ej.util.isNullOrUndefined(c.fontFamily)?"Segoe UI":c.fontFamily,vt={size:gt,fontStyle:ni,fontFamily:ti},v=ej.EjSvgRender.utils._measureText(b,null,vt),yt=this.textPosition(n,g,r,v,at,u,f,e,i,o),h=t.extend({},ej.EjSvgRender.commonChartEventArgs);h.data={text:b,location:{x:yt.x+y.canvasX,y:yt.y+y.canvasY},seriesIndex:g,pointIndex:i};y._trigger("displayTextRendering",h);var pt=ft.dataLabel.offset.y==undefined?ft.dataLabel.offset:ft.dataLabel.offset.y,wt=ft.dataLabel.offset.x,v=ej.EjSvgRender.utils._measureText(h.data.text,null,vt);if(h.data.location.y=dt=="bottom"?h.data.location.y+pt:h.data.location.y-pt,wt&&(h.data.location.x=h.data.location.x+wt),!h.cancel){var nt={id:y.svgObject.id+"_SeriesText"+i+g,x:h.data.location.x,y:h.data.location.y,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,type:n.type,"text-anchor":"middle"},l=k.margin,et=v.width+l.left+l.right,tt=v.height+l.top+l.bottom,st={X:h.data.location.x,Y:h.data.location.y};if(ej.util.isNullOrUndefined(k.template)){lt=k.shape?k.shape:"None";t.each(ot.symbolShape,function(n){lt.toLowerCase()==n.toLowerCase()&&(p=n)});var it=h.data.location.x-l.left/2+l.right/2,rt=h.data.location.y-l.top/2-tt/l.top+l.bottom/2,ut=k.angle,ht=ut>360?ut-360:ut<-360?ut+360:ut;ot.enableCanvasRendering&&ut%360!=0&&(nt.y-=v.height/4,nt.baseline="middle");n._enableSmartLabels&&(r.dataLabel={textX:nt.x,textY:nt.y,x:it,y:rt,width:et,height:tt},r.margin={top:l.top,bottom:l.bottom});r.y!=r.low||r.y===undefined&&r.low===undefined?at.toLowerCase()=="boxandwhisker"&&kt.midvalue!=r.y?(bt={id:y.svgObject.id+"_SeriesText"+i+g,x:ej.util.isNullOrUndefined(s)?h.data.location.x:it,y:ej.util.isNullOrUndefined(s)?h.data.location.y:rt,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,type:n.type,"text-anchor":"middle"},a=r.textOptionsBoxValues.length,r.textOptionsBoxValues[a]=bt,r.textOptionsBoxValues[a].angle=ht,r.textOptionsBoxValues[a].drawText=h.data.text,r.textOptionsBoxValues[a].index=i,r.textOptionsBoxValues[a].xPos=ej.util.isNullOrUndefined(s)?it:it-l.left/2+l.right/2,r.textOptionsBoxValues[a].yPos=ej.util.isNullOrUndefined(s)?rt:rt-l.top/2-tt/l.top+l.bottom/2,r.textOptionsBoxValues[a].seriesIndex=g,r.textOptionsBoxValues[a].width=p=="None"?v.width:et,r.textOptionsBoxValues[a].height=p=="None"?v.height:tt,r.textOptionsBoxValues[a].symbolName=p):(r.textOptions=nt,r.textOptions.angle=ht,r.drawText=h.data.text,r.index=i,r.xPos=it,r.yPos=rt,r.seriesIndex=g,r.width=p=="None"?v.width:et,r.height=p=="None"?v.height:tt,r.symbolName=p):(r.xPosLow=it,r.yPosLow=rt,r.widthLow=p=="None"?v.width:et,r.heightLow=p=="None"?v.height:tt,r.textOptionsLow=nt,r.textOptionsLow.angle=ht,r.drawTextLow=h.data.text)}else st.X-=y.canvasX,st.Y-=y.canvasY,this.drawLabelTemplate(n,r,i,st,y)}},updateSmartLabelPosition:function(n,i,r,u,f,e,o,s,h,c){var a=[],d=h,y=d.model,dt=y.legend,ri=y.LegendActualBounds,ui=dt.position.toLowerCase(),g=new ej.seriesTypes[n.type.toLowerCase()],rt="",pt="",et=u.connector.connectorX,ot=u.connector.connectorY,v=u.midPoint.midX,p=u.midPoint.midY,li=u.doughnutMidPoint.dMidX,ai=u.doughnutMidPoint.dMidY,b=e.startX,st=e.startY,fi=t.extend(!0,{},n.marker,i.marker),wt=fi.dataLabel.template?0:4,ht,ct,it=f,ei=n.startAngle>n.endAngle?-.01:.01,gt=fi.dataLabel.connectorLine.type.toLowerCase(),lt,hi=n.type.toLowerCase(),w=y._isPieOfPie?y.circularRadius[n.collectionIndex]:y.circularRadius[c],ni=hi=="pieofpie"?"inside":n.labelPosition.toLowerCase(),oi,ut,ft,at,si,nt,bt,tt,vt,ti,kt,ii,yt;if(ej.util.isNullOrUndefined(y.bounds[c])&&(y.bounds[c]=[],y.bounds[c].points=[],ni=="outsideextended"&&(y.bounds[c].points.left=[],y.bounds[c].points.right=[])),ni=="inside"&&ej.util.isNullOrUndefined(i.smartLabelPosition)){positionX=(v+b)/2;positionY=(p+st)/2;positionX=(v+positionX)/2;positionY=(p+positionY)/2;l=i.isIntersected&&y.bounds[c].points[r]?y.bounds[c].points[r]:v>b?{X:positionX,Y:positionY,Left:positionX,Top:positionY,Right:positionX+s.width,Bottom:positionY+s.height,SeriesIndex:c,PointIndex:r}:{X:positionX,Y:positionY,Left:positionX-s.width,Top:positionY,Right:positionX,Bottom:positionY+s.height,SeriesIndex:c,PointIndex:r};do(ct=!1,this.IntersectWith(d,i,l,"inside",c))&&((lt=l.Left,oi=it*180/Math.PI,oi>=270)||(it+=ei,i.isIntersected=!0,l.Angle=it,v>b?(l.X=l.Left=g.getXCordinate(b,w+o,it),l.Right=l.X+s.width):(l.X=l.Right=g.getXCordinate(b,w+o,it),l.Left=l.Right-s.width),l.Y=l.Top=g.getYCordinate(st,w+o,it),l.Bottom=l.Y+s.height,ct=!0));while(ct);v>b&&l.X<b&&(l.Right=lt,l.Left=lt-s.width);y.bounds[c].points[r]=l;i.isIntersected&&y.bounds[c].points[r].Angle&&(positionX=g.getXCordinate(b,w+o,y.bounds[c].points[r].Angle),positionY=g.getYCordinate(st,w+o,y.bounds[c].points[r].Angle),ut=g.getXCordinate(b,w+o/3,f),ft=g.getYCordinate(st,w+o/3,f),a.push({X:v,Y:p}),a.push({X:ut,Y:ft}),a.push({X:positionX,Y:positionY}),i.isIntersected&>=="bezier"&&!d.vmlRendering&&(pt=g.drawBezierSegment(a,n,r,d,c)),rt="M "+v+" "+p+" L "+ut+" "+ft+" M "+ut+" "+ft+" L "+positionX+" "+positionY)}else if(ni=="outside"||i.smartLabelPosition=="outside"){l=v>=b?{X:et,Y:ot,Left:et,Top:ot,Right:et+s.width,Bottom:ot+s.height,SeriesIndex:c,PointIndex:r}:{X:et,Y:ot,Left:et-s.width,Top:ot,Right:et,Bottom:ot+s.height,SeriesIndex:c,PointIndex:r};do(ct=!1,this.IntersectWith(d,i,l,"outside",c))&&(lt=l.Left,it+=ei,i.isIntersected=!0,v>b?(l.X=l.Left=g.getXCordinate(b,w+o,it),l.Right=l.X+s.width):(l.X=l.Right=g.getXCordinate(b,w+o,it),l.Left=l.Right-s.width),l.Y=l.Top=g.getYCordinate(st,w+o,it),l.Bottom=l.Y+s.height,ct=!0);while(ct);v>b&&l.X<b&&(l.Right=lt,l.Left=lt-s.width);y.bounds[c].points[r]=l;ut=g.getXCordinate(b,w+o/3,f);ft=g.getYCordinate(st,w+o/3,f);a.push({X:v,Y:p});a.push({X:ut,Y:ft});a.push({X:l.X,Y:l.Y});positionX=l.X;positionY=l.Y;o>0&&(v<b?(ht=l.X-y.elementSpacing,positionX=ht-wt):(ht=l.X+y.elementSpacing,positionX=ht+wt),a.push({X:ht,Y:l.Y}));gt!="bezier"||d.vmlRendering?rt="M "+v+" "+p+" L "+ut+" "+ft+" M "+ut+" "+ft+" L "+l.X+" "+l.Y+" M "+l.X+" "+l.Y+" L "+ht+" "+l.Y:pt=g.drawBezierSegment(a,n,r,d,c)}else{at=v;si=p;v=v+Math.cos(f)*-(w/10);p=p+Math.sin(f)*-(w/10);nt=w/4;a.push({X:v,Y:p});v=v+Math.cos(f)*nt;p=p+Math.sin(f)*nt;a.push({X:v,Y:p});bt=dt.visible&&ui=="left"?y.margin.left+ri.Width:0;tt=y.circleCenterX[c];v<b?(v=(tt-w-nt*2-n.LeftLabelMaxWidth>0?tt-w-nt*2+bt:n.LeftLabelMaxWidth>at?at:n.LeftLabelMaxWidth+bt)-s.width/2,vt=a[1].X-n.LeftLabelMaxWidth,kt=tt-w-nt*2-n.LeftLabelMaxWidth>0?nt:n.LeftLabelMaxWidth>at?0:vt>3*(nt/2)?nt:vt/2,connectorLineEdge=+s.width/2):(ti=dt.visible&&ui=="right"?y.margin.right+ri.Width:0,v=(tt+w+nt*2+n.RightLabelMaxWidth<t(d.svgObject).width()-ti?tt+w+nt*2-bt:tt+w+n.RightLabelMaxWidth>t(d.svgObject).width()?at:t(d.svgObject).width()-n.RightLabelMaxWidth-ti)+s.width/2,vt=t(d.svgObject).width()-n.RightLabelMaxWidth-a[1].X,kt=tt+w+nt*2+n.RightLabelMaxWidth<t(d.svgObject).width()?nt:tt+w+n.RightLabelMaxWidth>t(d.svgObject).width()?0:vt>3*(nt/2)?nt:vt/2,connectorLineEdge=-s.width/2);ii=Math.sqrt(Math.pow(at-v,2)+Math.pow(si-p,2))/10;yt=v<b?!0:!1;v=yt?v+ii:v-ii;var vi=yt?1:-1,u=yt?y.bounds[c].points.left:y.bounds[c].points.right,l={X:v,Y:p,Left:v,Top:p,Right:v+s.width,Bottom:p+s.height,index:r,SeriesIndex:c,PointIndex:r},ci=n.endAngle>n.startAngle?!0:!1;if(this.IntersectWith(d,i,l,"outsideExtended",c)&&(a.push(v<b?{X:v+kt+connectorLineEdge,Y:p}:{X:v-kt+connectorLineEdge,Y:p}),p=ci||n.startAngle==null?u[u.length-1].Y+s.height+2:yt?u[u.length-1].Y-s.height-2:u[u.length-1].Y+s.height+2,l.Y=p,l.Top=p,l.Bottom=p+s.height),a.push({X:v+connectorLineEdge,Y:p}),tt<a[0].X&&a[1].X>a[2].X&&(a[2].X=a[1].X),tt>a[0].X&&a[1].X<a[2].X&&(a[2].X=a[1].X),yt?(y.bounds[c].points.left.push(l),a[a.length-1].X>a[a.length-2].X&&(a[a.length-2].X=a[a.length-1].X)):(y.bounds[c].points.right.push(l),a[a.length-1].X<a[a.length-2].X&&(a[a.length-2].X=a[a.length-1].X)),rt=ej.EjSvgRender.utils._getStringBuilder(),gt!="bezier"||d.vmlRendering){for(k=0;k<a.length;k++)k==a.length-1?rt.append(" "):rt.append("M "+a[k].X+" "+a[k].Y+" L "+a[k+1].X+" "+a[k+1].Y+" ");rt=rt.toString()}else pt=g.drawBezierSegment(a,n,r,d,c);positionX=a[a.length-1].X+(v<b?-wt:wt);positionY=a[a.length-1].Y}return{positionX:positionX,positionY:positionY,connectorDirection:rt,isInterSected:i.isIntersected,bezierPath:pt}},updateLabelPosition:function(n,i,r,u,f,e,o,s,h,c){var l=[],a=h,ft=new ej.seriesTypes[n.type.toLowerCase()],d="",y=u.connector.connectorX,w=u.connector.connectorY,v=u.midPoint.midX,p=u.midPoint.midY,ot=u.doughnutMidPoint.dMidX,st=u.doughnutMidPoint.dMidY,tt=e.startX,ht=e.startY,rt=t.extend(!0,{},n.marker,i.marker),it=rt.dataLabel.template?0:4,nt,b=a.model.circularRadius[c],et=type=="pieofpie"?"inside":n.labelPosition.toLowerCase(),g,ut;if(l.push({X:v,Y:p}),l.push({X:y,Y:w}),positionX=y,positionY=w,et=="outside")o>0&&(y<tt?(nt=y-a.model.elementSpacing,positionX=nt-it):(nt=y+a.model.elementSpacing,positionX=nt+it),l.push({X:nt,Y:w})),rt.dataLabel.connectorLine.type.toLowerCase()!="bezier"||a.vmlRendering?d="M "+v+" "+p+" L "+y+" "+w+" M "+y+" "+w+" L "+nt+" "+w:ft.drawBezierSegment(l,n,r,a,c);else if(et=="outsideextended"){if(labelX=v,labelY=p,v=v+Math.cos(f)*-(b/10),p=p+Math.sin(f)*-(b/10),l=[],g=b/4,l.push({X:v,Y:p}),y=v+Math.cos(f)*g,w=p+Math.sin(f)*g,l.push({X:y,Y:w}),ut=a.model.legend.visible&&(a.model.legend.position.toLowerCase()=="left"||a.model.legend.position.toLowerCase()=="right")?a.model.elementSpacing:0,y=v<tt?a.model.centerX-b-g*2-n.LeftLabelMaxWidth>0?a.model.centerX-b-g*2+ut:n.LeftLabelMaxWidth>labelX?labelX:n.LeftLabelMaxWidth:a.model.centerX+b+g*2+n.RightLabelMaxWidth<t(a.svgObject).width()?a.model.centerX+b+g*2-ut:a.model.centerX+b+n.RightLabelMaxWidth>t(a.svgObject).width()?labelX:t(a.svgObject).width()-n.RightLabelMaxWidth,l.push({X:y,Y:w}),d=ej.EjSvgRender.utils._getStringBuilder(),rt.dataLabel.connectorLine.type.toLowerCase()!="bezier"||a.vmlRendering){for(k=0;k<l.length;k++)k==l.length-1?d.append(" "):d.append("M "+l[k].X+" "+l[k].Y+" L "+l[k+1].X+" "+l[k+1].Y+" ");d=d.toString()}else ft.drawBezierSegment(l,n,r,a,c);positionX=l[l.length-1].X+(v<tt?-it:it);positionY=l[l.length-1].Y}else n.type.toLowerCase()=="doughnut"?(positionX=(v+ot)/2,positionY=(p+st)/2):(positionX=(v+tt)/2,positionY=(p+ht)/2,positionX=(v+positionX)/2,positionY=(p+positionY)/2);return{positionX:positionX,positionY:positionY,connectorDirection:d,points:l[l.length-1]}},updateSmartLabel:function(n,i,r,u){var e=!0,h="",c=i.labelPosition.toLowerCase(),p=t.extend(!0,{},i.marker,u.marker),f=p.dataLabel,o=n.model.m_AreaBounds,b=n.model.svgHeight,w=i.type.toLowerCase(),l,a,s,v,y;return u._labelPlacement="",c=="inside"||c=="outsideextended"?this.calculateInsideConnectorLines(r,u,i,n):this.compareDataLabels(u,r,n.model.outsideDataRegionPoints,i,n),l=n.model.enableCanvasRendering&&!f.template?n.pyrX:0,a=n.model.enableCanvasRendering&&!f.template?n.pyrY:0,w=="pyramid"?(n.model.actualHeight<u.yPos-a||u.xPos-l>o.Width&&u._labelPlacement=="insideoverlap"||n.model.legend.position=="right"&&f.template&&u.xPos+u.width>o.Width+n.model.LegendActualBounds.Width)&&(e=!1,u.drawTextacc=""):(u.yPos-a<0||u.xPos-l>o.Width&&u._labelPlacement=="insideoverlap"||n.model.legend.position=="right"&&f.template&&u.xPos+u.width>o.Width+n.model.LegendActualBounds.Width)&&(e=!1,u.drawTextacc=""),(c=="outside"||u._labelPlacement=="insideoverlap")&&e&&(h=this.drawConnectorLines(r,u,i,n)),f.template&&(s=t("#"+u.id),e?(v=u._labelPlacement=="insidenooverlap"?u.textOptionsacc.x+n.pyrX-u.width/2:u.textOptionsacc.x+n.pyrX,y=u._labelPlacement=="insidenooverlap"?u.textOptionsacc.y+n.pyrY:u.textOptionsacc.y+n.pyrY-n.model.elementSpacing,s.css("left",v).css("top",y),s.css("height",u.height).css("overflow","hidden")):s.css("display","none")),{xPos:u.xPos,yPos:u.yPos,textOptionsacc:u.textOptionsacc,connectorDirection:h.connectorDirection,bezierPath:h.bezierdir,drawTextacc:u.drawTextacc}},compareDataLabels:function(n,i,r,u,f){for(var l,nt,p=t.extend(!0,{},u.marker,n.marker),a=p.dataLabel,w,o,b,e,k,v,s=f.model.elementSpacing,h=p.dataLabel.margin,tt=u._visiblePoints.length,c=u.labelPosition.toLowerCase(),d=f.model.enableCanvasRendering?f.pyrX:0,g=f.model.enableCanvasRendering?f.pyrY:0,y=0,it=r.length;y<it;y++)if(w=r[y],o=this.isCollide(w,n,u),o.state)if(c=="inside"||c=="outsideextended")for(n.textOptionsacc.y=n.yPos=n.textOptionsacc.y+o.height,positionPoint=a.template?{x:n.xPos,y:n.yPos}:{x:n.xPos-d,y:n.yPos-g},l=0,nt=tt;l<nt;l++)b=f.isPointInPolygon(f.model.chartRegions[0].Region[l].Polygon,positionPoint),b&&(n.textOptionsacc.x=n.xPos=n.textOptionsacc.x+n.width,positionPoint=a.template?{x:n.xPos,y:n.yPos}:{x:n.xPos-d,y:n.yPos-g});else n._labelPlacement="outside",n.textOptionsacc.y=n.yPos=u.type.toLowerCase()=="pyramid"?n.yPos+o.height+s/2:n.yPos+o.height-s/2,n.textOptionsacc.y=n.textOptionsacc.y+n.height/4-s/2+h.top/2-h.bottom/2;e=a.angle;k=e>360?e-360:e<-360?e+360:e;v="rotate("+k+","+n.textOptionsacc.x+","+n.textOptionsacc.y+")";t(n.textOptionsacc).attr("transform",v);t(n.textOptionsacc).attr("labelRotation",e);t(n.textOptionsacc).attr({transform:v});(c=="inside"||c=="outsideextended")&&(n.yPos=n.yPos+s/4,n.textOptionsacc.y=n.textOptionsacc.y+n.height/4+h.top/2-h.bottom/2);r[r.length]=n},calculateInsideConnectorLines:function(n,i,r,u){var s=i.Polygon,h=t.extend(!0,{},r.marker,i.marker),f=h.dataLabel,c=f.font,e,l=u.model.enableCanvasRendering?u.pyrX:0,a=u.model.enableCanvasRendering?u.pyrY:0,o=70,v=ej.EjSvgRender.utils._measureText(i.drawTextacc,null,c),y=f.template?{x:i.xPos,y:i.yPos}:{x:i.xPos+v.width/2-l,y:i.yPos-i.height/2-a},p=u.isPointInPolygon(s,y);p?i._labelPlacement="insidenooverlap":(i._labelPlacement="insideoverlap",i.textOptionsacc["text-anchor"]="start",e=i.startX+o<u.model.m_AreaBounds.Width?o:u.model.m_AreaBounds.Width-i.startX,i.textOptionsacc.x=i.xPos=i.startX+e,i.textOptionsacc.y=i.yPos=i.yLocation,u.model.enableCanvasRendering&&!f.template&&(i.textOptionsacc.x+=u.pyrX,i.textOptionsacc.y+=u.pyrY,i.xPos+=u.pyrX,i.yPos+=u.pyrY),this.compareDataLabels(i,n,u.model.outsideDataRegionPoints,r,u))},drawConnectorLines:function(n,i,r,u){var h="",v=new ej.seriesTypes[r.type.toLowerCase()],f=r._visiblePoints[n].startX,e=r._visiblePoints[n].startY,o="",y=t.inArray(r,u.model._visibleSeries),p=t.extend(!0,{},r.marker,i.marker),c=p.dataLabel,s=i.textOptionsacc.y-u.model.elementSpacing/2,l=u.model.enableCanvasRendering?u.pyrX:0,a=u.model.enableCanvasRendering?u.pyrY:0,w=[{X:f+l,Y:e+a},{X:i.textOptionsacc.x,Y:s}];return c.connectorLine.type.toLowerCase()!="bezier"||u.vmlRendering?(o="M "+f+" "+e+" L "+i.textOptionsacc.x+" "+s,u.model.enableCanvasRendering&&!c.template&&(o="M "+f+" "+e+" L "+(i.textOptionsacc.x-l)+" "+(s-a))):h=v.drawBezierSegment(w,r,n,u,y),{connectorDirection:o,bezierdir:h}},isCollide:function(n,t,i){var u=0,f=0,e=i.type.toLowerCase(),r;return r=!(n.yPos+n.height<t.yPos||n.yPos>t.yPos+t.height||n.xPos+n.width/2<t.xPos-t.width/2||n.xPos-n.width>t.xPos+t.width),r&&e=="pyramid"?(f=n.yPos+n.height-t.yPos,u=n.xPos+n.width-t.xPos):r&&e=="funnel"&&(f=n.yPos-(t.yPos+t.height),u=n.xPos+n.width-t.xPos),{state:r,height:f,width:u}},trimText:function(n,t,i){t--;var r=t-i.length;return trimmedText=n.substr(0,r),trimmedText+i},trimfunction:function(n,t,i,r,u,f){for(var n,i;t<i;)if(n=this.trimText(n,n.length,r),i=ej.EjSvgRender.utils._measureText(n,u,f).width,n==r){n="";break}return n},calculatePosition:function(n,t,i,r,u){var f,e,o,s;return f=t.x+i/2-r,e=t.y-u,o=t.x-i/2-r,s=t.y-u,{rightEndX:f,rightEndY:e,leftEndX:o,leftEndY:s}},textOption:function(n,i,r,u,f,e,o,s,h,c,l){var a;if(a=i.model._isPieOfPie?t.extend(!0,{},n.marker,l.marker):t.extend(!0,{},n.marker,n._visiblePoints[e].marker),!a.dataLabel.template){t("#"+i.svgObject.id+"series"+c+"_PointText"+e).remove();var y={id:i.svgObject.id+"series"+c+"_PointText"+e,x:s+u,y:h+r.height/4+f,fill:a.dataLabel.font.color,"font-size":a.dataLabel.font.size,"font-family":a.dataLabel.font.fontFamily,"font-style":a.dataLabel.font.fontStyle,"font-weight":a.dataLabel.font.fontWeight,opacity:a.dataLabel.font.opacity,"text-anchor":o,cursor:"default",degree:a.dataLabel.angle},v=a.dataLabel.angle,w=v>360?v-360:v<-360?v+360:v,p="rotate("+w+","+s+","+h+")";t(y).attr("transform",p);t(y).attr("labelRotation",v);t(y).attr({transform:p})}return y},labelTrim:function(n,t,i,r,u,f,e,o,s,h){var k=-.5*Math.PI,rt=.5*Math.PI,p=this.calculatePosition(n,t,i,u,f),v=n.model.series[s].startAngle,a=n.model.series[s].endAngle,ut=n.model.chartRegions.length<n.model._visibleSeries.length?n.model.chartRegions[0].Region:n.model.chartRegions[s].Region,c,l,b,d,y,tt="...",nt=a-v,s=n.model._isPieOfPie?h:s,w,it,g;if(nt<0?(a=a/360,w=a?2*Math.PI*(a<0?1+a:a):0):w=v?2*Math.PI*(n.model.itemCurrentXPos<0?1+n.model.itemCurrentXPos:n.model.itemCurrentXPos):0,v=(Math.atan2(p.rightEndY,p.rightEndX)-k-w)%(2*Math.PI),v<0&&(v=2*Math.PI+v),a=(Math.atan2(p.leftEndY,p.leftEndX)-k-w)%(2*Math.PI),a<0&&(a=2*Math.PI+a),c=parseFloat(e.start.toFixed(14)),l=parseFloat(e.end.toFixed(14)),nt>0?(ej.util.isNullOrUndefined(n.firstStartAngle[0])&&n.firstStartAngle.push(c),c=n.firstStartAngle[0]<0?n.model._isPieOfPie?c:2*Math.PI+c:c,l=n.firstStartAngle[0]<0?n.model._isPieOfPie?l:2*Math.PI+l:l):(c=c<0?n.model._isPieOfPie?c:2*Math.PI+c:c,l=l<0?n.model._isPieOfPie?l:2*Math.PI+l:l),c-=w,l-=w,c>2*Math.PI&&l>2*Math.PI?(v=v+2*Math.PI,a=a+2*Math.PI):c<2*Math.PI&&l>2*Math.PI&&(v<Math.PI/2&&(v=v+2*Math.PI),a<Math.PI/2&&(a=a+2*Math.PI)),v<0&&(a>0||a==null)&&(c=c<0?2*Math.PI+c:c,l=l<=0?2*Math.PI+l:l),b=n.model.circleCenterX[s]<t.x?Math.sqrt(Math.pow(Math.abs(p.rightEndX),2)+Math.pow(Math.abs(p.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(p.leftEndX),2)+Math.pow(Math.abs(p.leftEndY),2)),nt<0&&(l=[c,c=l][0]),a>=c&&a<=l&&v>=c&&v<=l&&b<=n.model.circularRadius[s]&&b>0)d=!0;else for(d=!1;!d;){if(r=this.trimText(r,r.length,tt),r==tt){r="";break}datalabeltWidth=ej.EjSvgRender.utils._measureText(r,null,o);y=this.calculatePosition(n,t,datalabeltWidth.width,u,f);startangle=(Math.atan2(y.rightEndY,y.rightEndX)-k-w)%(2*Math.PI);startangle<0&&(startangle=2*Math.PI+startangle);a=(Math.atan2(y.leftEndY,y.leftEndX)-k-w)%(2*Math.PI);a<0&&(a=2*Math.PI+a);b=n.model.circleCenterX[s]<t.x?Math.sqrt(Math.pow(Math.abs(y.rightEndX),2)+Math.pow(Math.abs(y.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(y.leftEndX),2)+Math.pow(Math.abs(y.leftEndY),2));c>2*Math.PI&&l>2*Math.PI&&n.model._isPieOfPie?(g=c-2*Math.PI,c=g,it=l-2*Math.PI,l=it):c!=0&&c<2*Math.PI&&l>=2*Math.PI&&n.model._isPieOfPie&&(g=c-2*Math.PI,c=g);a>=c&&a<=l&&startangle>=c&&startangle<=l&&b<=n.model.circularRadius[s]&&b>0&&(d=!0)}return r},drawDataLabelAcc:function(n,i,r,u,f,e){var hi=u.marker,li,ru,ut,cr,uu,tt,wi,lr,ar,dt,cu,wt,gt,ei,ni,oi,di,ur,et,fu,eu,ht,ct,si,vr,er,ou;if(u.visible&&(hi&&hi.dataLabel&&hi.dataLabel.visible||(!hi||!hi.dataLabel)&&i.marker.dataLabel.visible)){var o=n,c=i.type.toLowerCase(),it=new ej.seriesTypes[c],yt=ej.util.isNullOrUndefined,k=c=="pieofpie"?"inside":i.labelPosition.toLowerCase(),h=o.model,su=h.title,ot=ej.EjSvgRender.utils._measureText,gi=h.elementSpacing,pt=i.marker,st=pt.dataLabel,v=st.margin,d=st.font,ti=st.connectorLine,ii=ti.type.toLowerCase(),or=h.legend,b=or.position.toLowerCase(),ci=h.LegendActualBounds,yr=yt(u.text)?u.y:u.text,nr=st.enableWrap,pr=yr,y=h._isPieOfPie?e:f,a,sr,g,rt,p=0,ri,tr,w=0,ir;if((c=="pyramid"||c=="funnel")&&k=="outsideextended"&&(k="inside"),g=t.extend({},ej.EjSvgRender.commonChartEventArgs),g.data={text:yr,series:i,pointIndex:r},o._trigger("displayTextRendering",g),sr={size:d.size,fontStyle:d.fontStyle,fontFamily:d.fontFamily},rt=ot(g.data.text,null,sr),ri=rt.width+v.left+v.right,tr=rt.height+v.top+v.bottom,c=="pyramid"||c=="funnel"){var wr=h.title.text?ot(h.title.text,t(this.svgObject).width()-h.margin.left-h.margin.right,h.title.font):0,hr=o.model.title.subTitle.text?ej.EjSvgRender.utils._measureText(o.model.title.subTitle.text,t(this.svgObject).width()-o.model.margin.left-o.model.margin.right,o.model.title.subTitle.font):0,cr=o.model.title.subTitle.text===""?0:hr.height,ht=gi+h.margin.left+(b==="left")?ci.Width:0,ct=(b==="top"?ci.Height:0)+(h.title.text&&h.title.visible?h._titleLocation.Y+wr.height+cr:h.margin.top+gi);ri=ri+10;li={X:u.xLocation+o.pyrX,Y:u.yLocation+o.pyrY};p=u.xLocation;w=u.yLocation;ut=u.marker?u.marker:pt;ut=t.extend(!0,{},pt,ut);a=u.connectorLine;symbolPos={positionX:p,positionY:w}}if(c!="pyramid"&&c!="funnel"){var hu=-.5*Math.PI,ft=u.midAngle+hu,br,kr,dr,wt,rr,wr=h.title.text?ot(h.title.text,t(this.svgObject).width()-h.margin.left-h.margin.right,h.title.font):0,hr=o.model.title.subTitle.text?ej.EjSvgRender.utils._measureText(o.model.title.subTitle.text,t(this.svgObject).width()-o.model.margin.left-o.model.margin.right,o.model.title.subTitle.font):0,cr=o.model.title.subTitle.text===""?0:hr.height,ui,lt,at,ai,gr,nu,tu,vi,iu,yi=h.circularRadius[y];ui=yt(ti.height)?ot(g.data.text,null,d).height:ti.height;ru=o.model._isPieOfPie?u.actualIndex:i._visiblePoints[r].actualIndex;(ru==i.explodeIndex||i.explodeAll)&&!o.vmlRendering?(lt=h.circleCenterX[y]+Math.cos(ft)*i.explodeOffset,at=h.circleCenterY[y]+Math.sin(ft)*i.explodeOffset):(lt=h.circleCenterX[y],at=h.circleCenterY[y]);ai=it.getXCordinate(lt,yi,ft);ai=u.y!=0?ai:parseFloat(ai.toFixed(12));gr=it.getYCordinate(at,yi,ft);nu=it.getXCordinate(lt,h.innerRadius[f],ft);tu=it.getYCordinate(at,h.innerRadius[f],ft);vi=this.getXCordinate(lt,yi+ui,ft);vi=u.y!=0?vi:vi.toFixed(12);iu=this.getYCordinate(at,yi+ui,ft);st.template?size=u.size:(ut=u.marker?u.marker:pt,ut=t.extend(!0,{},pt,ut),shape=ut.dataLabel.shape,size=ot(g.data.text,t(o.svgObject).width(),d),shape.toLowerCase()!="none"&&(size.height=size.height+v.top+v.bottom,size.width=size.width+v.left+v.right));br={midX:ai,midY:gr};kr={dMidX:nu,dMidY:tu};dr={connectorX:vi,connectorY:iu};wt={midPoint:br,doughnutMidPoint:kr,connector:dr};rr={startX:lt,startY:at};i._enableSmartLabels?(position=it.updateSmartLabelPosition(i,u,r,wt,ft,rr,ui,size,n,f),p=position.positionX,w=position.positionY,symbolPos={positionX:p,positionY:w,isInterSected:position.isInterSected},a=o.model._isPieOfPie?"":position.connectorDirection):(position=it.updateLabelPosition(i,u,r,wt,ft,rr,ui,size,n,f),p=position.positionX,w=position.positionY,a=position.connectorDirection)}var pi=k!="inside"&&k!="insidenooverlap"||(c=="pyramid"||c=="funnel")&&k=="outside"?p<h.circleCenterX[y]?"end":"start":"middle",wi=k=="inside"||k=="insidenooverlap"?0:p<h.circleCenterX[y]?-rt.width:rt.width,ht=0,ct=0,s;if((c=="pie"||c=="doughnut"||c=="pieofpie")&&k=="inside"&&(pi=a!=""?p<h.circleCenterX[y]?"end":"start":"middle"),(c=="pyramid"||c=="funnel")&&k=="outside"&&(pi="start"),cr=o.model.title.subTitle.text===""?0:hr.height,this.chartObj&&h.enableCanvasRendering&&(c=="pyramid"||c=="funnel")&&(ht=(b==="left"?ci.Width:0)+gi+h.margin.left,ct=(b==="top"?ci.Height:0)+(su.text?h._titleLocation.Y+wr.height+cr:h.margin.top+gi)),r=o.model._isPieOfPie?u.actualIndex:r,s=this.textOption(i,o,rt,ht,ct,r,pi,p,w,f,u),st.template)li=yt(li)?{X:p,Y:w}:li,uu=u.actualIndex,it.drawLabelTemplate(i,u,uu,li,n),ii=="bezier"&&position.bezierPath!=""&&n.svgRenderer.drawPolyline(position.bezierPath,n.gConnectorEle[f]);else{if(t.each(h.symbolShape,function(n){ut=u.marker?u.marker:pt;ut=t.extend(!0,{},pt,ut);shape=ut.dataLabel.shape;shape.toLowerCase()==n.toLowerCase()&&(symbolName=n)}),p=ht+p-v.left/2+v.right/2+wi/2,w=ct+w-v.top/2+v.bottom/2,(c=="pyramid"||c=="funnel")&&(u.xPos=symbolPos.positionX+ht,u.yPos=symbolPos.positionY+ct,u.width=symbolName=="None"?rt.width:ri,u.height=symbolName=="None"?rt.height:tr,u.symbolName=st.template?"none":symbolName,u.textOptionsacc=s,u.drawTextacc=g.data.text),h.enableCanvasRendering&&s.degree%360!=0&&(s.y-=rt.height/4,s.baseline="middle"),i._enableSmartLabels){var nt=h.m_AreaBounds.Width+h.m_AreaBounds.X+h.margin.left,bt=k,fi=h.enableCanvasRendering,l=typeof g.data.text=="string"?g.data.text:g.data.text.toString(),bi=ot(l,l.length,d).width,ki,kt,vt=0,di=0;or.visible?(b=="left"||b=="right")&&(ki=ci):ki={Width:0};c=="pie"||c=="doughnut"||c=="pieofpie"?((bt=="outside"||bt=="outsideextended"||a!="")&&(kt=h.circleCenterX[y]<s.x?nt-s.x:b=="left"?s.x-h.margin.left-h.elementSpacing*2-ki.Width:s.x-h.margin.left,l=this.trimfunction(l,kt,bi,"...",nt,d),or.visible&&(b=="top"||b=="bottom")&&(l=this._overlapLegend(s,l,n,f))),bt=="inside"&&a==""&&(l=this.labelTrim(o,s,bi,l,lt,at,u,d,f,e),l!=""||o.model._isPieOfPie||(u.smartLabelPosition="outside",position=it.updateSmartLabelPosition(i,u,r,wt,ft,rr,ui,size,n,f),symbolPos={positionX:position.positionX,positionY:position.positionY,isInterSected:position.isInterSected},l=g.data.text,a=position.connectorDirection,pi=h.circleCenterX[y]<position.positionX?"start":"end",s=this.textOption(i,o,rt,ht,ct,r,pi,position.positionX,position.positionY,f,u),kt=h.circleCenterX[y]<position.positionX?b=="right"?nt-s.x-ki:nt-s.x:b=="left"?s.x-ki:s.x,l=this.trimfunction(l,kt,bi,"...",nt,d),delete u.smartLabelPosition))):(c=="pyramid"||c=="funnel")&&(position=it.updateSmartLabel(n,i,r,u),p=position.xPos,w=position.yPos,a=position.connectorDirection,s=position.textOptionsacc,l=u.drawTextacc,(a!=""||ii=="bezier")&&l!=""&&(l=l.toString(),kt=b=="right"?fi?nt-s.x:nt-s.x-o.pyrX:b=="left"?fi?nt-s.x:nt-s.x-o.pyrX:b=="top"?fi?nt-s.x:nt-s.x-o.pyrX:fi?nt-s.x:nt-s.x-o.pyrX,kt<bi&&(l=this.trimfunction(l,kt,bi,"...",nt,d))));tt=ot(l,null,d);c=="pie"||c=="doughnut"||c=="pieofpie"?wi=(k=="inside"||k=="insidenooverlap")&&!symbolPos.isInterSected&&a==""?0:p<h.circleCenterX[y]?-tt.width:tt.width:(c=="pyramid"||c=="funnel")&&(wi=u._labelPlacement=="insidenooverlap"?0:tt.width);c=="pie"||c=="doughnut"||c=="pieofpie"?(p=ht+symbolPos.positionX-v.left/2+v.right/2+wi/2,w=ct+symbolPos.positionY-v.top/2+v.bottom/2):(p=p-v.left/2+v.right/2+wi/2,w=w-v.top/2+v.bottom/2);lr=t("#"+o.svgObject.id+"_dataLabel_series"+f+"_point_"+r);ar=t("#"+o.svgObject.id+"_connectorLine_series"+f+"_point_"+r);l!=""?(lr.show(),ar.show(),nr||it.dataLabelSymbol(f,i,r,p,w,ri,tr,symbolName,o),ii!="bezier"||position.bezierPath==""||ej.util.isNullOrUndefined(position.bezierPath)||n.svgRenderer.drawPolyline(position.bezierPath,n.gConnectorEle[f])):(lr.hide(),ar.hide(),a="");nr||o.svgRenderer.drawText(s,l,o.gSeriesTextEle[f]);dt=ot(l,l.length,d);cu=ot(g.data.text,null,d);(c=="pie"||c=="doughnut"||c=="pieofpie")&&(bt=="inside"&&position.connectorDirection==""?(gt=s.x-tt.width/2,ni=s.x+tt.width/2,ei=s.y-tt.height/2,oi=s.y+tt.height/2):(h.circleCenterX[y]<s.x?(gt=s.x,ni=s.x+tt.width):(gt=s.x-tt.width,ni=s.x),ei=s.y-tt.height/2,oi=s.y+tt.height/3),wt={centerX:h.circleCenterX[y],minX:gt,minY:ei,maxX:ni,maxY:oi,width:dt.width,height:dt.height,labelPosition:bt});(c=="funnel"||c=="pyramid")&&(vt=b=="left"?vt:0,di=0,(a!=""||ii=="bezier")&&(gt=s.x-vt,ni=s.x+tt.width-vt,ei=s.y-tt.height,oi=s.y),wt=fi?{minX:gt+vt,maxX:ni+vt,minY:ei+di,maxY:oi+di,width:dt.width,height:dt.height,labelPosition:bt}:{minX:gt+o.pyrX+vt,maxX:ni+o.pyrX+vt,minY:ei+o.pyrY+di,maxY:oi+o.pyrY+di,width:dt.width,height:dt.height,labelPosition:bt});accDataLabelRegion={bounds:wt,trimmedText:l,text:g.data.text,type:c,font:d};o.accDataLabelRegion.type=c;o.accDataLabelRegion.connectorDirection=a;ej.util.isNullOrUndefined(o.accDataLabelRegion[y])&&(o.accDataLabelRegion[y]=[]);o.accDataLabelRegion[y].length<i._visiblePoints.length&&o.accDataLabelRegion[y].push(accDataLabelRegion);yt(r)||!i.explode||fi||o.accDataLabelRegion[y].splice(r,1,accDataLabelRegion);e==1&&o.accDataLabelRegion[y].length==i._visiblePoints.length&&(o.accDataLabelRegion[f]=t.merge(t.merge([],o.accDataLabelRegion[0]),o.accDataLabelRegion[1]))}else nr||(it.dataLabelSymbol(f,i,r,p,w,ri,tr,symbolName,o),o.svgRenderer.drawText(s,g.data.text,o.gSeriesTextEle[f]));if(nr)if(ur=ot(pr,null,sr),fu=5,et=this.updateWrappedText(s,pr,ur,u,c,lt,at,yi,h.innerRadius[f],k,st,ii=="bezier"?i._enableSmartLabels?yt(position.bezierPath)?"":position.bezierPath.points:position.points:a),l=et.text,s.x=parseFloat(et.x),s.y=parseFloat(et.y),l!=""&&(eu=s["text-anchor"]=="start"?parseFloat(s.x+et.width/2):yt(a)||a==""?parseFloat(s.x):parseFloat(s.x-et.width/2),it.dataLabelSymbol(f,i,r,eu,s.y+et.height/2-ur.height/2-fu,et.width,et.height,symbolName,o)),yt(a)||a==""||((c=="funnel"||c=="pyramid")&&(ht=h.enableCanvasRendering?this.chartObj.pyrX:0,ct=h.enableCanvasRendering?this.chartObj.pyrY:0),si=a.split(" "),vr=k=="outsideextended"&&(c=="pie"||c=="doughnut")?si.length-2:si.length,si[vr-1]=s.y-ct+(et.height/2-ur.height),si[vr-2]=s.x-ht,a=si.toString().replace(/,/g," ")),a=et.exceed==!1?"":a,(h.enableCanvasRendering||this.chartObj.vmlRendering)&&typeof l=="object")for(var fr=0,lu=s.y,au=s.x;fr<l.length;fr++)s.y=parseFloat(lu)+fr*rt.height,s.x=au,o.svgRenderer.drawText(s,l[fr],o.gSeriesTextEle[f]);else o.svgRenderer.drawText(s,l,o.gSeriesTextEle[f])}(c=="pyramid"||c=="funnel")&&st.template&&i._enableSmartLabels&&(position=it.updateSmartLabel(n,i,r,u),p=position.xPos,w=position.yPos,a=position.connectorDirection);ir=jQuery.type(h.pointColors[u.actualIndex])=="array"?h.pointColors[u.actualIndex][0].color:h.pointColors[u.actualIndex];ir=u.fill?jQuery.type(u.fill)=="array"?u.fill[0].color:u.fill:ir;er=[];er[0]=ht;er[1]=ct;(ii!="bezier"||o.vmlRendering||c=="pyramid"||c=="funnel")&&a!=""&&a&&(ou={id:o.svgObject.id+"_connectorLine_series"+f+"_point_"+r,stroke:ti.color?ti.color:ir,"stroke-width":ti.width,d:a},o.svgRenderer.drawPath(ou,o.gConnectorEle[f],er))}},_overlapLegend:function(n,t,i,r){var h=i.svgHeight,v=i.svgWidth,y=i.model.LegendActualBounds,f=i.model.elementSpacing,e=i.model.series[r].marker.dataLabel.margin,c=i.model.series[r].marker.dataLabel.shape,p=c!="none"?e.top:0,w=c!="none"?e.bottom:0,b=ej.EjSvgRender.utils._measureText((t,n)).height,l=n.y+b+w,k=n.y-p,d=i.model.legend.position.toLowerCase(),g=i.model.title,s=g.subTitle,e=i.model.margin,nt=i.model.border.width,tt=s.text==""?0:ej.EjSvgRender.utils._measureText(s.text,v-e.left-e.right,s.font).height+f,a=i.model._titleLocation?i.model._titleLocation.Y:0+tt,u=t,o;return d=="bottom"?(o=h-i.model.LegendActualBounds.Height-f,u=l>o?"":u):(o=a==0?nt+f:a+f,u=k<o+y.Height?"":u),l>h&&(u=""),u},updateWrappedText:function(n,i,r,u,f,e,o,s,h,c,l,a){var w=this.chartObj,v=u,g={},wt=r.width,lt=r.height,ni,y,k,ti=n.x,ii=n.y,bt,b,nt=ti,ot=!0,at=w.model.m_AreaBounds.X,d=ii,tt,et,it,st,vt,pt,dt,ft,p,rt;if(ej.util.isNullOrUndefined(a)||a==""||(typeof a=="object"?(it=a.X,st=a.Y):(tt=a.split(" "),et=c=="outsideextended"?tt.length-2:l.connectorLine.type.toLowerCase()=="bezier"?tt.length-2:tt.length,tt[et-1].indexOf(",")>-1?(vt=tt[et].split(","),it=vt[0],st=vt[1]):(it=tt[et-2],st=tt[et-1]))),f=="pie"||f=="doughnut"){if(c=="inside"){var h=ej.util.isNullOrUndefined(h)?0:h,yt=-.5*Math.PI,ht=v.startAngle+yt,ct=v.endAngle+yt,ut=v.midAngle+yt,ri=180/Math.PI*ut%360,ei=180/Math.PI*ht%360,oi=180/Math.PI*ct%360,kt=f=="doughnut"?.75:.5;nt=this.getXCordinate(e,s*kt,ut);d=this.getYCordinate(o,s*kt,ut);startPointX=this.getXCordinate(e,s,ht);startPointY=this.getYCordinate(o,s,ht);endPointX=this.getXCordinate(e,s,ct);endPointY=this.getYCordinate(o,s,ct);midPointX=this.getXCordinate(e,s,ut);midPointY=this.getYCordinate(o,s,ut);innerCenterX=this.getXCordinate(e,h,ut);innerCenterY=this.getYCordinate(o,h,ut);segmentBounds=this.getSegementMinMax([startPointX,endPointX,f=="doughnut"?innerCenterX:e,midPointX],[startPointY,endPointY,f=="doughnut"?innerCenterY:o,midPointY]);segmentBounds.width=segmentBounds.height>s?segmentBounds.height:segmentBounds.width;b=segmentBounds.width*.75}else if((c=="outside"||c=="outsideextended")&&(f=="pie"||f=="doughnut")&&a!=""){var si=w.model.m_AreaBounds,ui=at,fi=w.svgWidth-at;b=it<=e?it-ui:fi-it;nt=it;d=st}}else if(pt=w.svgWidth,c=="outside")b=pt-it;else if(b=v.width,dt=w.isPointInPolygon(v.Polygon,{x:nt+wt,y:d}),!dt){b=f=="funnel"?v.Polygon[3].x-v.Polygon[4].x:v.Polygon[1].x-v.Polygon[0].x;bt=v.Polygon[3].y-v.Polygon[0].y;var gt=Math.round(wt/b)*lt,ot=gt>=bt-10||b<=50?!0:!1;ot?b=pt-nt-at:(n["text-anchor"]="middle",nt=(f=="funnel"?v.Polygon[4].x:v.Polygon[0].x)+b/2+(w.model.enableCanvasRendering?w.pyrX:0),d=(v.Polygon[0].y+v.Polygon[3].y)/2-gt/2+(w.model.enableCanvasRendering?w.pyrY:0),v._labelPlacement="insidenooverlap")}if(c!="inside"&&a==""&&ej.util.isNullOrUndefined(a))y="";else{for(maxWidth=l.maximumLabelWidth!=null?l.maximumLabelWidth:parseFloat(b),y=i,wrapText=w._rowsCalculation({text:y.toString(),font:l.font},maxWidth,ni),y=wrapText.textCollection,k=t.extend([],y),ft=0;ft<k.length-1;ft++)k[ft+1]=k[ft].concat("<br/>",k[ft+1]);k=k[k.length-1]}return p=ej.EjSvgRender.utils._measureText(k,b,l.font),p.height+=lt/2,(f=="pie"||f=="doughnut")&&c=="inside"&&(d=d-p.height/2+lt/2,y=p.height>segmentBounds.height?"":y,y=p.width>segmentBounds.width?"":y,y==""&&(p.width=0,p.height=0)),g=this.currentBoundary=="undefined"?"undefined":this.currentBoundary,this.currentBoundary={X:nt-p.width/2,Y:parseFloat(d),Height:p.height,Width:p.width},!g||v._labelPlacement=="insidenooverlap"?firstSegment=this.currentBoundary:(rt=this.checkOverlapping(w,this.currentBoundary,g,f,y,firstSegment,ri,c,{startAngle:ht,endAngle:ct,radius:s,centerX:e,centerY:o}),rt[1]&&rt[2]!=""?(g=rt[0],nt=g.X+g.Width/2,d=g.Y,y=rt[2],p.height=rt[0].Height,p.width=rt[0].Width):y=rt[2]),ot=y==""?!1:ot,this.currentBoundary=y==""?g:this.currentBoundary,{text:y,x:nt,y:d,exceed:ot,height:p.height,width:p.width}},checkOverlapping:function(n,t,i,r,u,f,e,o,s){var c=10,l=!1,h,y,a,p,v,w,b;return h=this.getOverlapArea(t,i),l=h.overlap,y=h.xOverlap,a=h.yOverlap,l&&(r=="pie"||r=="doughnut"?o.toLowerCase()=="inside"?(p=y>=a?"Y":"X",p=="X"?(v=e>0&&e<180?-1:1,t.X+=v*(y+c)):(v=e>90&&e<270?-1:1,t.Y+=v*(a+c))):t.Y-=a+c:t.Y=r=="funnel"?i.Y-t.Height-c:i.Y+i.Height+c),(r=="pie"||r=="doughnut"||r=="pieofpie")&&o.toLowerCase()=="inside"?(h=this.getOverlapArea(t,f),u=h.overlap==!0?"":u,l=h.overlap==!0?!0:l,w=this.checkSegmentExceeding(t,s),u=w?u:""):r=="funnel"?t.Y+t.Height>=i.Y&&(u=""):r=="pyramid"&&t.Y+t.Height<=i.Y+i.Height&&(u=""),b=n.model.m_AreaBounds,[{X:t.X,Y:t.Y,Height:t.Height,Width:t.Width},l,u]},getOverlapArea:function(n,t){var i=Math.max(0,Math.min(n.X+n.Width,t.X+t.Width)-Math.max(n.X,t.X)),r=Math.max(0,Math.min(n.Y+n.Height,t.Y+t.Height)-Math.max(n.Y,t.Y)),u=i*r;return overlap=u>0?!0:!1,{overlap:overlap,xOverlap:i,yOverlap:r}},getSegementMinMax:function(n,t){var i,r,u,f,e,o;return n.sort(function(n,t){return n-t}),t.sort(function(n,t){return n-t}),i=n[0],r=n[3],u=t[0],f=t[3],e=r-i,o=f-u,{minX:i,maxX:r,minY:u,maxY:f,width:e,height:o}},checkSegmentExceeding:function(n,t){var u=!1,o=n.X+n.Width/2,s=n.Y+n.Height/2,f=o-t.centerX,e=s-t.centerY,i=Math.atan2(e,f),h=Math.abs(Math.sqrt(f*f+e*e)),r;return h<=t.radius&&(r=2*Math.PI,i=i<0?r+i:i,t.startAngle=t.startAngle<0?r+t.startAngle:t.startAngle,t.endAngle=t.endAngle<0?r+t.endAngle:t.endAngle,i<=t.endAngle&&i>=t.startAngle?u=!0:(i<=r&&i>=t.startAngle&&t.endAngle<t.startAngle||i>0&&i<=t.endAngle&&t.startAngle>t.endAngle)&&(u=!0)),u},drawBezierSegment:function(n,t,i,r,u){for(var h,e,o,s=ej.EjSvgRender.utils._getStringBuilder(),c=new ej.seriesTypes[t.type.toLowerCase()],f=0;f<=16;f++)h=f/16,e=c.GetBezierPoint(h,n,0,n.length,t),s.append(e.X+","+e.Y+" ");if(o={id:r.svgObject.id+"_bezierLine_series"+u+"_point"+i,stroke:t.marker.dataLabel.connectorLine.color?t.marker.dataLabel.connectorLine.color:r.model.pointColors[i],"stroke-width":t.marker.dataLabel.connectorLine.width,fill:"none",points:s.toString()},t._enableSmartLabels)return o;r.svgRenderer.drawPolyline(o,r.gConnectorEle)},GetBezierPoint:function(n,t,i,r,u){var o=new ej.seriesTypes[u.type.toLowerCase()];if(r==1)return t[i];var f=o.GetBezierPoint(n,t,i,r-1,u),e=o.GetBezierPoint(n,t,i+1,r-1,u),c=f.X?f.X:f.x,l=f.Y?f.Y:f.y,a=e.X?e.X:e.x,v=e.Y?e.Y:e.y,s=(1-n)*c+n*a,h=(1-n)*l+n*v;return f.x?{x:s,y:h}:{X:s,Y:h}},drawLabelTemplate:function(n,i,r,u,f){var rt,ut,s,ht,ct,lt,l,ft,et,d,at,vt;f&&(this.chartObj=f);var nt=this.chartObj.model.m_AreaBounds.X,tt=this.chartObj.model.m_AreaBounds.Y,ot=this.chartObj.model.m_AreaBounds.Width,st=this.chartObj.model.m_AreaBounds.Height,p=t.inArray(n,this.chartObj.model._visibleSeries),g=this.chartObj.model.AreaType,a=this.chartObj.model.series[p],w=0,it=0,v=this.chartObj._id,c=t.extend(!0,{},n.marker,i.marker),k={interior:c.dataLabel.fill,opacity:c.dataLabel.opacity,borderColor:c.dataLabel.border.color,borderWidth:c.dataLabel.border.width},b,h,y,pt=this.chartObj.model.chartRegions[r]?this.chartObj.model.chartRegions[r].type:"";if(g!="none"||this.chartObj.model.enable3D){if(rt=t("#template_group_"+v).length!=0?t("#template_group_"+v):t("<div><\/div>").attr("id","template_group_"+v),rt.css("position","relative").css("z-index",1e3),t("#"+c.dataLabel.template).length==0)return;ut=t("#"+c.dataLabel.template).clone();t(ut).attr("id",c.dataLabel.template+"_"+p+"_"+r+"_"+v);s=t(ut);s.css("position","absolute");ht=i.x;i.dataLabeltemplate=!0;i.id=c.dataLabel.template+"_"+p+"_"+r+"_"+v;n.xAxis._valueType.toLowerCase()=="datetime"&&(i.x=ej.format(new Date(i.xValue),ej.util.isNullOrUndefined(n.xAxis.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(n.xAxis._intervalType):n.xAxis.labelFormat,this.chartObj.model.locale));n.xAxis._valueType.toLowerCase()=="category"&&(i.x=ej.EjSvgRender.utils._getLabelContent(r,n.xAxis,this.chartObj.model.locale));i.count=1;ct={series:n,point:i};s.html(s.html().parseTemplate(ct));i.x=ht;lt=g=="cartesianaxes"||!n.enableAnimation||n.type.toLowerCase()=="pyramid"||n.type.toLowerCase()=="funnel"?"block":"none";s.css("display",lt).appendTo(t(rt));t(rt).appendTo("#chartContainer_"+v);l=this.chartObj.model.m_AreaBounds;g!="cartesianaxes"||this.chartObj.model.enable3D||(w=l.X+(this.chartObj.model.requireInvertedAxes?a.yAxis.plotOffset:a.xAxis.plotOffset),it=a.yAxis.y);h=s.width()/2;y=s.height();b=ej.util.isNullOrUndefined(k)&&k.interior?k.interior:g=="none"?this.chartObj.model.pointColors[r]:this.chartObj.model.seriesColors[p]}else b=ej.util.isNullOrUndefined(k)&&k.interior?k.interior:this.chartObj.model.pointColors[r],h=this.chartObj.model.circleCenterX[p]>u.X?i.size.width:0,s=t("#template_group_"+v).find("#"+c.dataLabel.template+"_"+p+"_"+r+"_"+v),i.id=c.dataLabel.template+"_"+p+"_"+r+"_"+v,y=this.chartObj.model.enable3D?0:i.size.height/2;if((a.type=="hilo"||a.type=="hiloopenclose"||a.type=="candle")&&(b=a._visiblePoints[r]._hiloFill),b=jQuery.type(b)=="array"?b[0].color:b,a.type.indexOf("bar")!=-1)var e=u.X+w-h,o=u.Y+(this.chartObj.model.enable3D?0:l.Y)-y+a.xAxis.plotOffset,yt=u.X+w+h;else var e=u.X+w-h,o=it+u.Y-y,yt=u.X+w+h;ft=s[0].style.backgroundColor;s.css("left",e).css("top",o).css("background-color",ft!=""?ft:b).css("display","block").css("cursor","default");this.chartObj.model.AreaType!="cartesianaxes"?(i.xPos=e-this.chartObj.pyrX,i.yPos=o-this.chartObj.pyrY,i.textOptionsacc={x:e-this.chartObj.pyrX,y:o-this.chartObj.pyrY}):i.y==i.low?(i.xPosLow=e,i.yPosLow=o,i.textOptionsLow={x:e,y:o},i.dataLabelLow={textX:e,textY:o,x:e,y:o}):(i.xPos=e,i.yPos=o,i.seriesIndex=p,i.textOptions={x:e,y:o},i.dataLabel={textX:e,textY:o,x:e,y:o},i.margin={top:0,bottom:0,left:0,right:0});i.height=s.outerHeight();i.width=s.outerWidth();et=leftWidth=rightWidth=0;d=0;g=="cartesianaxes"&&(e>w+l.Width||o+y>l.Y+l.Height||e<w||o<it||e>w+l.Width||o>it+l.Height||yt>l.Width+l.X)&&(h=s.outerWidth(),e<nt&&(leftWidth=nt-e),st+tt<o+y&&(at=o+y-(st+tt),d=y-at),o<tt&&(et=tt-o),ot+nt<e+h&&(vt=e+h-(ot+nt),rightWidth=h-vt),rightWidth=rightWidth==0?h:rightWidth,d=d==0?y:d,document.getElementById(s[0].id).style.clip="rect("+et+"px,"+rightWidth+"px,"+d+"px,"+leftWidth+"px)")},animateLabelTemplate:function(n){for(var i,u=t.inArray(n,this.chartObj.model._visibleSeries),f=n._visiblePoints.length,r=0;r<f;r++)i=n.marker.dataLabel.template+"_"+u+"_"+r+"_"+this.chartObj._id,i=t("#"+i),i.css("display","none"),i.delay(1e3).fadeIn(300)},textPosition:function(n,i,r,u,f,e,o,s,h,c){var yt=t.extend(!0,{},n.marker,r.marker),ct=yt.dataLabel,v=ct.horizontalTextAlignment.toLowerCase(),y=ct.verticalTextAlignment.toLowerCase(),a=ct.textPosition.toLowerCase(),pt=n._visiblePoints.length,ot=s,l=10,st=3,nt=ct.margin,g=n.yAxis.isInversed,tt=this.chartObj._getXCrossValue(n,n.xAxis,c),it=f.indexOf("bar")!=-1||f.indexOf("column")!=-1&&f!="rangecolumn"?this.chartObj.model.requireInvertedAxes?"bar":"column":f,d,lt,at,b,ft,ht,vt,et;if(it=="column"||it=="stackingcolumn"||it=="stackingcolumn100")d=this.chartObj.model.chartRegions[ot].Region.Bounds,lt=c.axes[n.xAxis.name]._validCross||!1,w=d.Height,p=d.Width,lt?(b=Math.abs((g?n.yAxis.visibleRange.min:n.yAxis.visibleRange.max)-tt)/n.yAxis.visibleRange.delta*n.yAxis.height,a=="bottom"?o=o<=b?o+w-nt.bottom:o-w+u.height-nt.bottom:a=="middle"?o<b?o+=w/2+u.height/4:o-=w/2:o<b&&g||o<b&&!g?o-=l+u.height/1:o+=l+u.height/1):a=="bottom"?o=r.y>tt&&!n.yAxis.isInversed||r.y<tt&&n.yAxis.isInversed?o+w-nt.bottom:u.height+nt.bottom:a=="middle"?r.y>tt&&!n.yAxis.isInversed||r.y<tt&&n.yAxis.isInversed?o+=w/2+u.height/4:o-=w/2:r.y>tt&&n.yAxis.isInversed||r.y<tt&&!n.yAxis.isInversed?o+=l:o-=l,v&&v=="far"?e+=p/2:v&&v=="near"&&(e-=p/2),y&&y=="near"?o+=a=="bottom"?l:l-st:y&&y=="far"&&(o-=a=="bottom"?l:l);else if(it.indexOf("bar")!=-1){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,p=d.Width,lt=c.axes[n.xAxis.name]._validCross||!1,w=d.Height;o=o+u.height/4;lt?(at=n.xAxis._crossValue||0,b=Math.abs(g?n.yAxis.visibleRange.max:n.yAxis.visibleRange.min-at)/n.yAxis.visibleRange.delta*n.yAxis.width,a=="bottom"?e=e<b&&!g||e>=b&&g?e+p-u.width:e-p+nt.left:a=="middle"?e=e<b&&!g||e>=b&&g?e+p/2-u.width/2:e-p/2-u.width/2:e<b&&!g||e>=b&&g?e-=l+u.width/1:e+=l+u.width/1):a=="bottom"?r.y>0&&!n.yAxis.isInversed||r.y<0&&n.yAxis.isInversed?e=nt.left+u.width/4:e+=p-u.height-nt.right:a=="middle"?r.y>0&&!n.yAxis.isInversed||r.y<0&&n.yAxis.isInversed?e-=p/2+u.width/2:e+=p/2:r.y>=0&&!n.yAxis.isInversed||r.y<0&&n.yAxis.isInversed?e+=u.width/4+l:e-=u.width/4+l;v&&v=="far"?e+=a=="bottom"?u.width-u.width/4:u.width/4+l:v&&v=="near"?e-=a=="bottom"?u.width/4:l-u.width/4-st:e+=u.width/4;y&&y=="near"?o+=w/2:y&&y=="far"&&(o-=w/2)}else if(it=="rangecolumn"){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,rt=0,ut=0;r.high!=r.y&&(rt=d.Height,ut=d.Width);this.chartObj.model.requireInvertedAxes?a=="top"?e=e-ut+(l+u.width/1):a=="bottom"?e=e-ut-(2*u.width+l):a=="middle"&&(e=e-ut):a=="top"?o+=rt-l:a=="bottom"?o=o+rt+(2*u.height+l):a=="middle"&&(o=o+rt);v&&v.toLowerCase()=="far"?e+=d.Width/2:v&&v.toLowerCase()=="near"&&(e-=d.Width/2);y&&y.toLowerCase()=="near"?o+=l-st:y&&y.toLowerCase()=="far"&&(o-=l)}else if(it=="boxandwhisker"){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,rt=0,ut=0;this.chartObj.model.requireInvertedAxes?a=="top"?e=e-ut+(l+u.width/1):a=="bottom"?e=e-ut-(2*u.width+l):a=="middle"&&(e=e-ut):a=="top"?o+=rt-st:a=="bottom"?o+=rt+l+u.width/2:a=="middle"&&(o+=rt+l);v&&v.toLowerCase()=="far"?e+=2*u.width:v&&v.toLowerCase()=="near"&&(e-=2*u.width);y&&y.toLowerCase()=="near"?o=a=="top"?o+l:o-l:y&&y.toLowerCase()=="far"&&(o=a=="top"?o-l:o+l)}else if(f=="waterfall"){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,w=d.Height,p=d.Width,k=r.waterfallSum<0||!r.showIntermediateSum&&!r.showTotalSum&&r.y<0;switch(a){case"bottom":n.isTransposed?e=n.yAxis.isInversed?e+p-(l+u.height/1)-(k?p:0):e-p+(l+u.height/1)+(k?p:0):o=n.yAxis.isInversed?o-u.height+nt.bottom+(k?w:0):o+w-nt.bottom-(k?w:0);break;case"middle":n.isTransposed?e=n.yAxis.isInversed?e+p/2-(k?p:0):e-(p/2+u.width/4)+(k?p:0):o=n.yAxis.isInversed?o-w/2+(k?w:0):o+(w/2+u.height/4)-(k?w:0);break;default:n.isTransposed?e=n.yAxis.isInversed?e-(l+u.height/1)-(k?p:0):e+(l+u.height/1)+(k?p:0):o=n.yAxis.isInversed?o+(l+u.height/1)+(k?w:0):o-(l+u.height/1)-(k?w:0)}v&&v=="far"?e+=p/2:v&&v=="near"&&(e-=p/2);y&&y=="near"?o+=a=="bottom"?u.height/3:u.height+l:y&&y=="far"&&(o-=a=="bottom"?u.height/3:l+u.height/2)}else if(f=="polar"||f=="radar")o+=u.height/4,a=="bottom"?o+=u.height:a=="top"&&(o-=u.height),v&&v=="far"?e+=u.width:v&&v=="near"&&(e-=u.width),y&&y=="near"?o+=u.height/2:y&&y=="far"&&(o-=u.height/2);else{if(it=="rangearea"&&r.high!=r.y)if(this.chartObj.model.series.length==1)et=this.chartObj.model.chartRegions[i][h].region.length,o=this.chartObj.model.chartRegions[i][h].region[et-1].Y,e=this.chartObj.model.chartRegions[i][h].region[et-1].X;else{for(ft=0,ht=0;ht<i;ht++)vt=this.chartObj.model.series[ht].type,ft=vt!="rangearea"?ft+this.chartObj.model.series[ht].points.length:ft+1;et=this.chartObj.model.chartRegions[ft][h].region.length;o=this.chartObj.model.chartRegions[ft][h].region[et-1].Y;e=this.chartObj.model.chartRegions[ft][h].region[et-1].X}this.chartObj.model.requireInvertedAxes?a=="top"?e+=l:a=="bottom"&&(e-=l+u.width/1):a=="bottom"?o+=2*u.height+l:a=="top"&&(o-=l);v&&v=="far"?e+=u.width+l:v&&v=="near"&&(e-=u.width+l);y&&y=="near"?o+=l-st:y&&y=="far"&&(o-=l)}return{x:e,y:o}},changeCrossHairSymbol:function(n,i,r,u,f){var e,o,h,s;return ej.util.isNullOrUndefined(i)||(e={},n=t.extend(!0,{},f.marker,n),e=t.extend(!0,{},this.chartObj.model.crosshair.marker,e),o=f.points[r],h=f.type.toLowerCase(),ej.util.isNullOrUndefined(e.shape)&&(e.shape=n.shape,h=="bubble"&&(e.border.color=o.border&&o.border.color?o.border.color:f.border.color,e.border.width=o.border&&o.border.width?o.border.width:f.border.width)),(!this.chartObj.model.crosshair.visible||ej.util.isNullOrUndefined(e.fill))&&f.type.toLowerCase()!="bubble"&&f.type.toLowerCase()!="scatter"&&(e.fill=e.shape.toLowerCase()=="cross"||e.shape.toLowerCase()=="horizline"||e.shape.toLowerCase()=="vertline"?jQuery.type(this.chartObj.model.seriesColors[u])=="array"?this.chartObj.model.seriesColors[u][0].color:this.chartObj.model.seriesColors[u]:n.border.color),f.type.toLowerCase()!="bubble"||this.chartObj.model.enableCanvasRendering?(e.size.width<=n.size.width&&(e.size.width=n.size.width+2),e.size.height<=n.size.height&&(e.size.height=n.size.height+2),(ej.util.isNullOrUndefined(e.border.color)||!this.chartObj.model.crosshair.visible)&&(ej.util.isNullOrUndefined(n.fill)?h=="scatter"?(e.border.color=o.border&&o.border.color?o.border.color:f.border.color,e.border.width=o.border&&o.border.width?o.border.width:f.border.width):e.border.color=o.fill?o.fill:jQuery.type(this.chartObj.model.seriesColors[u])=="array"?this.chartObj.model.seriesColors[u][0].color:this.chartObj.model.seriesColors[u]:e.border.color=jQuery.type(n.fill)=="array"?n.fill._gradientStop[0].color:n.fill)):(s=t(this.chartObj.gSeriesEle).find("#"+this.chartObj.svgObject.id+"_Series"+u+"_Point"+r)[0].getBoundingClientRect(),e.size.width=(s.right-s.left)/2+15,e.size.height=(s.bottom-s.top)/2+15)),f._trackMarker=e,e},dataLabelSymbol:function(n,i,r,u,f,e,o,s,h,c){var l=h,y,p,v;if(s!="None"){y=l.model._isPieOfPie?ej.ejChart._getPieOfPiePoint(r,i):i._visiblePoints[r];p={startX:u,startY:f};h.model.enable3D||(v=c?c:l.gDataLabelEle[n]);v=l.model.enableCanvasRendering?null:v;var a=t.extend(!0,{},i.marker,y.marker),w={interior:a.dataLabel.fill,opacity:a.dataLabel.opacity,borderColor:a.dataLabel.border.color,borderWidth:a.dataLabel.border.width},b={style:w,gradientName:"symbol",symbolEle:v,width:e,height:o,point:y,location:p,seriesIndex:n,pointIndex:r,element:a,symbolName:s,id:l.svgObject.id+"_dataLabel_series"+n+"_"+r};this.drawSymbolStyle(b,l)}},drawSymbolStyle:function(n,i){var r=i,tt,it,rt,f=n.style,ot=n.gradientName,o=n.symbolEle,st=n.width,lt=n.dashArray,ht=n.height,l=n.point,c=n.location,v=n.seriesIndex,ct=n.visibility,w=n.pointIndex,ut=n.element,y=n.symbolName,d=n.trackSymbol,g=r.model.enableCanvasRendering,ft=r.model.AreaType=="polaraxes",e=r.model.series[v],p,b,et,u,a,s,h;if(f!=null&&(f.borderColor!=""&&(tt=f.borderColor?f.borderColor:"transparent"),rt=f.opacity,it=f.borderWidth<0?0:f.borderWidth),p=null,f.interior?p=ej.util.isNullOrUndefined(f.interior._gradientStop)?f.interior:f.interior._gradientStop:l.fill?p=jQuery.type(l.fill)=="array"?l.fill[0].color:l.fill:(b=r.model.pointColors,p=r.model.AreaType!="none"?e.type.toLowerCase()=="waterfall"&&e.positiveFill&&(l.y>0||l.waterfallSum>0)?e.positiveFill:r.model.seriesColors[v]:jQuery.type(b[w])=="array"?b[w][0].color:b[w]),r.symbolColorName=r.svgRenderer.createGradientElement(ot+v,p,0,0,0,t(r.svgObject).height(),o),et={dashArray:n.dashArray,ShapeSize:{width:st,height:ht},Style:{BorderColor:tt,BorderWidth:it,Opacity:rt,Visibility:ct,Color:r.symbolColorName},PointIndex:w,SeriesIndex:v,Imageurl:ut.imageUrl,Image:ut.image,ID:n.id},u=t.extend({},ej.EjSvgRender.commonChartEventArgs),u.data={location:c,style:et},r._trigger("symbolRendering",u),!u.cancel)if(g)c.startY=r.model.requireInvertedAxes?c.startY:c.startY+(e.yAxis.y?e.yAxis.y-r.canvasY:0),c.startX=r.model.requireInvertedAxes?c.startX:c.startX+(e.xAxis.x?e.xAxis.x-r.canvasX:0),u.data.location.startY=c.startY,ej.util.isNullOrUndefined(d)?r.model.AreaType=="cartesianaxes"?(o=r.svgRenderer.ctx,r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.model.requireInvertedAxes?r.svgRenderer.ctx.rect(e.yAxis.x,e.xAxis.y,e.yAxis.width,e.xAxis.height):r.svgRenderer.ctx.rect(e.xAxis.x,e.yAxis.y,e.xAxis.width,e.yAxis.height),r.svgRenderer.ctx.clip(),ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,u.data.style,r,o),r.svgRenderer.ctx.restore()):(g&&ft&&(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.svgRenderer.ctx.arc(r.model.centerX,r.model.centerY,r.model.Radius,0,2*Math.PI,!1),r.svgRenderer.ctx.clip()),ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,u.data.style,r,o),g&&ft&&r.svgRenderer.ctx.restore()):(a=u.data.style.PointIndex,s=u.data.style.SeriesIndex,r.model.series[s].highlightSettings.enable||t("#"+r._id+"_selection_"+s+"_"+a+"_canvas").length==0&&r.svgRenderer.trackSymbol(u.data.style,u.data.location,y,d,r));else{var a=u.data.style.PointIndex,s=u.data.style.SeriesIndex,nt=e.type,k;e.highlightSettings.enable&&d&&!r.model.crosshair.visible?(f=t.extend(!0,u.data.style),h=e.highlightSettings,f.Style.Color=h.pattern.toLowerCase()=="none"||h.pattern==""?h.color!=""?h.color:f.Style.Color:"url(#"+h.pattern.toLowerCase()+"_Highlight_2D_"+s+")",f.Style.Opacity=h.opacity,f.Style.BorderColor=h.border.color,f.Style.BorderWidth=h.border.width,k=nt=="bubble"?t("#"+this.chartObj.svgObject.id+"_Series"+s+"_Point"+a).attr("class"):t("#"+this.chartObj.svgObject.id+"_Series"+s+"_Point"+a+"_symbol").attr("class"),k!="SelectionStyleseries"+s&&ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,f,r,r.model.enable3D?i.chart3D:o)):(k=nt=="scatter"?t("#"+r.svgObject.id+"_Series"+s+"_Point"+a+"_symbol").attr("class"):t("#"+r.svgObject.id+"_Series"+s+"_Point"+a).attr("class"),k!="SelectionStyleseries"+s&&ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,u.data.style,r,r.model.enable3D?i.chart3D:o))}!i.chart3D&&nt!="pieofpie"&&r.model.AreaType=="none"&&t(o).children().not("defs").length>r.model._visibleSeries[v]._visiblePoints.length&&t(o.childNodes[n.pointIndex]).replaceWith(t(o.childNodes[t(o.childNodes).length-1]))},drawSymbol:function(n,i,r,u,f,e,o,s){var c,v,y,p,w,g,nt,it;ej.util.isNullOrUndefined(this.chartObj)&&(this.chartObj=e);var h=i._visiblePoints[r],l=i.type.toLowerCase(),tt=l=="boxandwhisker"?s:r,rt=l=="bubble"||l=="scatter"?i.border.dashArray:"",b="None",a=this.changeCrossHairSymbol(h.marker?h.marker:i.marker,o,r,n,i);if(c=l.toLowerCase()=="boxandwhisker"?a?a:t.extend(!0,{},i.outlierSettings,h.outlierSettings,i.border,h.border):a?a:t.extend(!0,{},i.marker,h.marker),t.each(this.chartObj.model.symbolShape,function(n){c.shape.toLowerCase()==n.toLowerCase()&&(b=n)}),b!="None"){v=this.chartObj.model.AreaType=="cartesianaxes"?{startX:u+this.chartObj.canvasX,startY:f+this.chartObj.canvasY}:{startX:u,startY:f};l=="scatter"?(y=h.border&&h.border.color?h.border.color:i.border.color,p=h.border&&h.border.width?h.border.width:i.border.width,w={interior:c.fill,opacity:c.opacity,borderColor:y,borderWidth:p}):l=="boxandwhisker"?(y=h.border&&h.border.color?h.border.color=="transparent"?this.chartObj._saturationColor(i.fill,-.6):h.border.color:i.border.color=="transparent"?this.chartObj._saturationColor(i.fill,-.6):i.border.color,p=h.border&&h.border.width?h.border.width:i.border.width,w={interior:i.fill,opacity:i.opacity,borderColor:y,borderWidth:p}):w={interior:c.fill,opacity:c.opacity,borderColor:c.border.color,borderWidth:c.border.width};var ut=o?this.chartObj.gTrackerEle:this.chartObj.gSymbolGroupEle[n],ft=o?this.chartObj.svgObject.id+"_trackSymbol_"+n+"_"+tt:this.chartObj.svgObject.id+"_Series"+n+"_Point"+tt+"_symbol",et=o?"TrackSymbol":"symbol",k=c.size.width,d=c.size.height,ot={style:w,gradientName:et,symbolEle:ut,width:k,height:d,point:h,location:v,seriesIndex:n,pointIndex:r,element:c,visibility:h.visible?"visible":"hidden",symbolName:b,trackSymbol:o,id:ft,dashArray:rt};this.drawSymbolStyle(ot,this.chartObj,o);i.type.toLowerCase()=="scatter"&&(g=i.xAxis.x,nt=i.yAxis.y,this.chartObj.model.enableCanvasRendering&&(g=0,nt=0),it={X:g+v.startX-d/2,Y:nt+v.startY-k/2,Height:d,Width:k},ej.EjSvgRender.utils._addRegion(this.chartObj,it,i,null,r))}},chartAreaType:"cartesianAxes",requireInvertedAxes:!1,stackingSeries:!1,hiloTypes:!1};ej.ejLineSeries=r(ej.EjSeriesRender);ej.seriesTypes.line=ej.ejLineSeries;ej.ejStepLineSeries=r(ej.EjSeriesRender,{draw:function(n,t){var r=this.chartObj=n,v,e;t.animationType="path";var y=ej.EjSvgRender.utils._getStringBuilder(),i=t,w=this.setLineSeriesStyle(i);i.sorting&&(i.points=ej.DataManager(i.points,ej.Query().sortBy("xValue")).executeLocal());var u=this.improveChartPerformance(i),f=null,s="M",h,p,c,l,a,o=-1;for(e=0;e<u.length;e++)h=u[e],h.visible?(f!=null&&(u.length>o+1&&(p={xValue:u[o+1].xValue,YValues:[f.YValues[0]]},c=ej.EjSvgRender.utils._getPoint(f,i),l=ej.EjSvgRender.utils._getPoint(p,i),a=ej.EjSvgRender.utils._getPoint(u[o+1],i),r=this.chartObj,y.append(s+" "+(c.X+r.canvasX)+" "+(c.Y+r.canvasY)+" L "+(l.X+r.canvasX)+" "+(l.Y+r.canvasY)+" L "+(a.X+r.canvasX)+" "+(a.Y+r.canvasY)+" ")),s="L"),f=h,o=e):(f=null,s="M");v=y.toString();this._drawLinePath(i,w,v);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.ejStepAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var f,h,k,w,u;this.chartObj=n;t.animationType="path";var p=this.chartObj.model.requireInvertedAxes,b,s=ej.EjSvgRender.utils._getStringBuilder(),e=t,d=this.setAreaSeriesStyle(e);e.sorting&&(e.points=ej.DataManager(e.points,ej.Query().sortBy("xValue")).executeLocal());var o=this.improveChartPerformance(e),c=0,v=null,l;e.xAxis._valueType.toLowerCase()=="category"&&e.xAxis.labelPlacement.toLowerCase()!="onticks"&&(c=.5);var g=ej.EjSeriesRender.prototype.getOrigin(this,e,i),a=null,y=!0,r=this.chartObj;for(f=0;f<=o.length;f++)f<o.length?o[f].visible?(l={xValue:o[f].xValue-c,YValues:[o[f].y]},u=ej.EjSvgRender.utils._getPoint(l,e),a||(a={xValue:o[f].xValue-c,YValues:[g]},h=ej.EjSvgRender.utils._getPoint(a,e),s.append("M "+(h.X+r.canvasX)+" "+(h.Y+r.canvasY)+" ")),v!=null&&(k={xValue:l.xValue,YValues:[v.YValues[0]]},w=ej.EjSvgRender.utils._getPoint(k,e),y&&(s.append("L "+(point2.X+r.canvasX)+" "+(point2.Y+r.canvasY)+" "),y=!1),s.append("L "+(w.X+r.canvasX)+" "+(w.Y+r.canvasY)+" L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" "),(c==0&&f==o.length-1||f<o.length-1&&!o[f+1].visible)&&(c>0?(l={xValue:o[f].xValue+c,YValues:[o[f].y]},u=ej.EjSvgRender.utils._getPoint(l,e),p?s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.Y+r.canvasX)+" "+(h.X+r.canvasY)+" "):s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.X+r.canvasX)+" "+(h.Y+r.canvasY)+" ")):p?s.append("L "+(h.X+r.canvasY)+" "+(u.Y+r.canvasX)+" "):s.append("L "+(u.X+r.canvasX)+" "+(h.Y+r.canvasY)+" "),a=null,v=null,y=!0)),a&&(point2=u,v=l)):(a=null,v=null,y=!0):o[f-1].visible&&c>0&&(l={xValue:o[f-1].xValue+c,YValues:[o[f-1].y]},u=ej.EjSvgRender.utils._getPoint(l,e),p?s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.Y+r.canvasX)+" "+(h.X+r.canvasY)+" "):s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.X+r.canvasX)+" "+(h.Y+r.canvasY)+" "));b=s.toString();this.drawAreaPath(e,d,b);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.steparea=ej.ejStepAreaSeries;ej.seriesTypes.stepline=ej.ejStepLineSeries;ej.ejColumnSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var v,e,h,a,c,s,d,tt,it,w;this.chartObj=n;v=this.chartObj.model.requireInvertedAxes;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var u=i,o=u.cornerRadius,y=t.inArray(u,this.chartObj.model._visibleSeries),rt=ej.EjSeriesRender.prototype.getOrigin(this,u,r),b=this.getSideBySideInfo(u,r);u.dragSettings.enable&&(u.sidebysideInfo=b);var p=this._isVisiblePoints(u),k=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,v),ut,ft={id:this.chartObj.svgObject.id+"_SeriesGroup_"+y,transform:"translate("+k.x+","+k.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(ft),e=this,h=0;h<p.length;h++)if(a=h,c=p[h],ut=p[h].marker,s=c.YValues[0],d=rt,c.visible){var g=e.calculateSides(c,b),et=g.x1,ot=g.x2,l=this.chartObj.setStyle(e,u,y,a),f=e.getRectangle(et,s,ot,d,u,n),st=Math.min(0,f.Width),ht=Math.min(0,f.Height),nt;(st==0||ht==0)&&f.Width>0&&(i={id:e.chartObj.svgObject.id+"_Series"+y+"_Point"+a,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,cornerRadius:o,fill:l.interior,"stroke-width":l.borderWidth,plot:s<0?"negative":"positive",opacity:l.opacity,stroke:l.borderColor,"stroke-dasharray":l.dashArray},tt={isColumn:!0,stacking:!1,isLastSeries:!0},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,tt):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(it=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=it,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),w=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),nt={X:w.X,Y:w.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,nt,u,c,a));c.symbolLocation=v?{X:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.Y+f.Height:f.Y}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},isRegion:!0});ej.seriesTypes.column=ej.ejColumnSeries;ej.ejStackingColumnSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,s,d,g,y;this.chartObj=n;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var p=this.chartObj.model.requireInvertedAxes,u=i,o=u.cornerRadius,a=t.inArray(u,this.chartObj.model._visibleSeries),nt=this.getSideBySideInfo(u,r),tt=this._isVisiblePoints(u),w=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,p),it={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+w.x+","+w.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(it),e=this,s=0;s<tt.length;s++){var v=s,l=u._visiblePoints[s],rt=u.stackedValue.StartValues[s],h=u.stackedValue.EndValues[s];if(l.visible){var b=e.calculateSides(l,nt),ut=b.x1,ft=b.x2,c=this.chartObj.setStyle(e,u,a,v),f=e.getRectangle(ut,h,ft,rt,u,n),et=Math.min(0,f.Width),ot=Math.min(0,f.Height),k,st=u.type=="stackingcolumn100"?!0:!1;(et==0||ot==0)&&f.Width>0&&(i={id:e.chartObj.svgObject.id+"_Series"+a+"_Point"+v,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,fill:c.interior,cornerRadius:o,"stroke-width":c.borderWidth,plot:h<0?"negative":"positive",opacity:c.opacity,stroke:c.borderColor,"stroke-dasharray":c.dashArray},d={isColumn:!0,stacking:st,isLastSeries:u.stackedValue.stackedSeries},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,d):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(g=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=g,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),y=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),k={X:y.X,Y:y.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,k,u,l,v));l.symbolLocation=p?{X:h<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.xAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:h<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.xAxis._crossValue||0)?f.Y+f.Height:f.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0,isRegion:!0});ej.seriesTypes.stackingcolumn=ej.ejStackingColumnSeries;ej.seriesTypes.stackingcolumn100=ej.ejStackingColumnSeries;ej.seriesTypes.rangecolumn=ej.ejRangeColumnSeries;ej.ejRangeColumnSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,c,g,p;this.chartObj=n;i.animationType="rect";var w=this.chartObj.model.requireInvertedAxes,f=i,s=f.cornerRadius,v=t.inArray(f,this.chartObj.model._visibleSeries),nt=this.getSideBySideInfo(f,r),b=this._isVisiblePoints(f),a=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,w),tt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+v,transform:"translate("+a.x+","+a.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(tt),e=this,c=0;c<b.length;c++){var y=c,o=b[c],h=o.YValues[0],it=o.YValues[1];if(o.visible){var k=e.calculateSides(o,nt),rt=k.x1,ut=k.x2,l=this.chartObj.setStyle(e,f,v,y),u=e.getRectangle(rt,h,ut,it,f,n),ot=e.chartObj.model.m_AreaBounds.Width,ft=Math.min(0,u.Width),et=Math.min(0,u.Height),d;(ft==0||et==0)&&(i={id:e.chartObj.svgObject.id+"_Series"+v+"_Point"+y,x:u.X+e.chartObj.canvasX,y:u.Y+e.chartObj.canvasY,width:u.Width,height:u.Height,cornerRadius:s,fill:l.interior,"stroke-width":l.borderWidth,opacity:l.opacity,stroke:l.borderColor,"stroke-dasharray":l.dashArray},typeof s!="object"&&s>0||s.topLeft>0||s.bottomLeft>0||s.topRight>0||s.bottomRight>0?(g=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=g,f.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle,a.y),e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle,a.y),p=ej.EjSvgRender.utils._getSvgXY(u.X,u.Y,f,e.chartObj),d={X:p.X,Y:p.Y,Width:u.Width,Height:u.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,d,f,o,y));f.type.toLowerCase()=="waterfall"&&(h=o.waterfallSum?o.waterfallSum:o.y);o.symbolLocation=w?{X:h<0&&!f.yAxis.isInversed||f.yAxis.isInversed&&h>0?u.X:u.X+u.Width,Y:u.Y+u.Height/2}:{X:u.X+u.Width/2,Y:h<0&&!f.yAxis.isInversed||f.yAxis.isInversed&&h>0?u.Y+u.Height:u.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0,isRegion:!0});ej.seriesTypes.rangecolumn=ej.ejRangeColumnSeries;ej.ejBoxandwhiskerSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var ut,wt,u,a,rt,w;this.chartObj=n;ut=this.chartObj.model.requireInvertedAxes;i.animationType="rect";var f=i,l=t.inArray(f,this.chartObj.model._visibleSeries),ni=ej.EjSeriesRender.prototype.getOrigin(this,f,r),bt=this.getSideBySideInfo(f,r),b=this._isVisiblePoints(f),ft=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,ut),kt,et=0,dt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+l,transform:"translate("+ft.x+","+ft.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(dt),u=this,a=0;a<b.length;a++){var h=a,ot,v,k,st,d,ht,ct,o,e,lt,at,l,gt,vt,y,g,nt,p,yt,s,tt,pt,it,c=b[a];if(kt=b[a].marker,ot=c.YValues[0],v=u.calculateMean(ot,f,h),k=v.UpperQuartile,st=v.LowerQuartile,c.visible&&(d=u.calculateSides(c,bt),ht=d.x1,ct=d.x2,o=this.chartObj.setStyle(u,f,l,h),e=u.getRectangle(ht,k,ct,st,f,n),lt=Math.min(0,e.Width),at=Math.min(0,e.Height),l=t.inArray(f,this.chartObj.model._visibleSeries),wt=this.chartObj.setStyle(this,f,l,a),gt=ej.EjSvgRender.utils._getStringBuilder(),vt={xValue:c.xValue,YValues:v.midvalue},y=ej.EjSvgRender.utils._getPoint(vt,f),rt=o.borderColor=="transparent"?this.chartObj._saturationColor(o.interior,-.6):o.borderColor,g,(lt==0||at==0)&&e.Width>0)){for(i={id:u.chartObj.svgObject.id+"_Series"+l+"_Point"+h,x:e.X+u.chartObj.canvasX,y:e.Y+u.chartObj.canvasY,width:e.Width,height:e.Height,fill:o.interior,"stroke-width":o.borderWidth,plot:k<0?"negative":"positive",opacity:o.opacity,stroke:rt,"stroke-dasharray":o.dashArray},nt={id:this.chartObj.svgObject.id+"_Series"+l+"_Point"+h+"_median",x1:f._isTransposed?y.X+u.chartObj.canvasX:e.X+u.chartObj.canvasX,y1:f._isTransposed?e.Y+u.chartObj.canvasY:y.Y+u.chartObj.canvasY,x2:f._isTransposed?y.X+u.chartObj.canvasX:e.X+e.Width+u.chartObj.canvasX,y2:f._isTransposed?e.Y+e.Height+u.chartObj.canvasY:y.Y+u.chartObj.canvasY,"stroke-width":o.borderWidth,stroke:rt},u.chartObj.svgRenderer.drawRect(i,u.gSeriesGroupEle),u.chartObj.svgRenderer.drawLine(nt,u.gSeriesGroupEle),p=u.calculateBoxAndWhiskerPath(i,e,nt,v,f,c,h),i.d=p.lowerWhisker,i.id=i.id+"_whisker",u.chartObj.svgRenderer.drawPath(i,u.gSeriesGroupEle),i.d=p.upperWhisker,u.chartObj.svgRenderer.drawPath(i,u.gSeriesGroupEle),f.showMedian==!0&&(i.d=p.mean,u.chartObj.svgRenderer.drawPath(i,u.gSeriesGroupEle)),w=0;w<v.outliers.length;w++)yt={xValue:c.xValue,YValues:v.outliers[w]},s=ej.EjSvgRender.utils._getPoint(yt,f),s.X=f._isTransposed?s.X:e.X+e.Width/2,s.Y=f._isTransposed?e.Y+e.Height/2:s.Y,this.drawSymbol(l,f,h,s.X,s.Y,null,null,et),et++,tt=ej.EjSvgRender.utils._getSvgXY(s.X,s.Y,f,u.chartObj),pt={X:tt.X-f.outlierSettings.size.width/2,Y:tt.Y-f.outlierSettings.size.height/2,Width:f.outlierSettings.size.width,Height:f.outlierSettings.size.height},ej.EjSvgRender.utils._addRegion(u.chartObj,pt,f,c,h);it=ej.EjSvgRender.utils._getSvgXY(e.X,e.Y,f,u.chartObj);g={X:it.X,Y:it.Y,Width:e.Width,Height:e.Height};ej.EjSvgRender.utils._addRegion(u.chartObj,g,f,c,h)}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},isRegion:!0});ej.seriesTypes.boxandwhisker=ej.ejBoxandwhiskerSeries;ej.ejWaterfallSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var o,v,w,c,u,f,y,b,l,p,k,e;ej.ejRangeColumnSeries.prototype.draw.call(this,n,i,r);i.animationType="rect";var a=this.chartObj.model.chartRegions,s=[],d=this.chartObj.model.m_AreaBounds,h=t.inArray(i,this.chartObj.model._visibleSeries);for(i.index=h,o=0,v=0;o<a.length;o++)h==a[o].SeriesIndex&&(s[v]=a[o],v+=1);for(w={id:this.chartObj.svgObject.id+"_SeriesGroup_waterfallLine_"+h},this.connectorLineGroup=this.chartObj.svgRenderer.createGroup(w),e=0;e<s.length-1;e++)c=ej.EjSvgRender.utils._getStringBuilder(),u=s[e].Region.Bounds,f=s[e+1].Region.Bounds,i.isTransposed?(x1=Math.ceil(u.X),w1=Math.ceil(u.Width),x2=Math.ceil(f.X),w2=Math.ceil(f.Width),l=Math.ceil(u.X+u.Width),p=Math.ceil(f.X+f.Width),x=l==p?u.X+u.Width:x1==x2?u.X:x1==p?u.X:u.X+u.Width,c.append("M "+x+" "+(u.Y+u.Height)+" L "+x+" "+f.Y)):(b=Math.ceil(u.Y),h1=Math.ceil(u.Height),y2=Math.ceil(f.Y),h2=Math.ceil(f.Height),l=Math.ceil(u.Y+u.Height),y=b==y2?u.Y:l==y2?f.Y:f.Y+f.Height,c.append("M "+u.X+" "+y+" L "+(f.X+f.Width)+" "+y)),lDirection=c.toString(),lDirection!=""&&u.Height>=0&&(k={id:this.chartObj.svgObject.id+"_waterFall_"+h+"_connectorLine_"+e,fill:"none","stroke-dasharray":i.connectorLine.dashArray,"stroke-width":i.connectorLine.width,stroke:i.connectorLine.color,opacity:i.connectorLine.opacity,d:lDirection},this.chartObj.svgRenderer.drawPath(k,this.connectorLineGroup));this.chartObj.svgRenderer.append(this.connectorLineGroup,this.chartObj.gSeriesEle);i.enableAnimation&&!i._animatedSeries&&this.chartObj.svgRenderer._setAttr(this.connectorLineGroup,{visibility:"hidden"})},hiloTypes:!1,isRegion:!0});ej.seriesTypes.waterfall=ej.ejWaterfallSeries;ej.ejStackingBarSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,s,d,g,nt,y;this.chartObj=n;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var p=this.chartObj.model.requireInvertedAxes,u=i,o=u.cornerRadius,a=t.inArray(u,this.chartObj.model._visibleSeries),tt=this.getSideBySideInfo(u,r),w=this._isVisiblePoints(u),b=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,p),it={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+b.x+","+b.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(it),e=this,s=0;s<w.length;s++){var v=s,l=w[s],h=u.stackedValue.EndValues[s],rt=u.stackedValue.StartValues[s];if(l.visible){var k=e.calculateSides(l,tt),ut=k.x1,ft=k.x2,c=this.chartObj.setStyle(e,u,a,v),f=e.getRectangle(ut,h,ft,rt,u,n),et=Math.min(0,f.Width),ot=Math.min(0,f.Height),st=u.type=="stackingbar100"?!0:!1;(et==0||ot==0)&&(i={id:e.chartObj.svgObject.id+"_Series"+a+"_Point"+v,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,cornerRadius:o,fill:c.interior,"stroke-width":c.borderWidth,opacity:c.opacity,stroke:c.borderColor,"stroke-dasharray":c.dashArray},g={isColumn:!1,stacking:st,isLastSeries:u.stackedValue.stackedSeries},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,g):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(nt=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=nt,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),y=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),d={X:y.X,Y:y.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,d,u,l,v));l.symbolLocation=p?{X:h<(u.yAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.yAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:h<(u.yAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.yAxis._crossValue||0)?f.Y+f.Height:f.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0,requireInvertedAxes:!0,isRegion:!0});ej.seriesTypes.stackingbar=ej.ejStackingBarSeries;ej.seriesTypes.stackingbar100=ej.ejStackingBarSeries;ej.ejBarSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,h,g,nt,tt,y;this.chartObj=n;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var p=this.chartObj.model.requireInvertedAxes,u=i,o=u.cornerRadius,a=t.inArray(u,this.chartObj.model._visibleSeries),it=ej.EjSeriesRender.prototype.getOrigin(this,u,r),ht=t.extend(!0,{},this.chartObj.model.seriesStyle,u.style),w=this.getSideBySideInfo(u,r);u.dragSettings.enable&&(u.sidebysideInfo=w);var b=this._isVisiblePoints(u),k=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,p),rt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+k.x+","+k.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(rt),e=this,h=0;h<b.length;h++){var v=h,c=b[h],s=c.YValues[0],ut=it;if(c.visible){var d=e.calculateSides(c,w),ft=d.x1,et=d.x2,l=this.chartObj.setStyle(e,u,a,v),f=e.getRectangle(ft,s,et,ut,u,n),ot=Math.min(0,f.Width),st=Math.min(0,f.Height);(ot==0||st==0)&&(i={id:e.chartObj.svgObject.id+"_Series"+a+"_Point"+v,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,cornerRadius:o,fill:l.interior,"stroke-width":l.borderWidth,plot:s<0?"negative":"positive",opacity:l.opacity,stroke:l.borderColor,"stroke-dasharray":l.dashArray},nt={isColumn:!1,stacking:!1,isLastSeries:!0},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,nt):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(tt=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=tt,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),y=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),g={X:y.X,Y:y.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,g,u,c,v));c.symbolLocation=p?{X:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.Y+f.Height:f.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},requireInvertedAxes:!0,isRegion:!0});ej.seriesTypes.bar=ej.ejBarSeries;ej.ejStackingAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t){var e,h,f;this.chartObj=n;t.animationType="path";var c,u=ej.EjSvgRender.utils._getStringBuilder(),i=t,y=this.setAreaSeriesStyle(i),r=this._isVisiblePoints(i),l=Math.max(t.yAxis.visibleRange.min,i.stackedValue.StartValues[0]),o=this.chartObj.canvasX,s=this.chartObj.canvasY,h={xValue:r[0].xValue,YValues:[l]},f=ej.EjSvgRender.utils._getPoint(h,i),a=0,v=i.stackedValue.EndValues.length;for(u.append("M "+(f.X+o)+" "+(f.Y+s)+" "),j=0;j<=v;j++)if(j!=v&&r[j].visible)currentPoint={xValue:r[j].xValue,YValues:[i.stackedValue.EndValues[j]]},r[j].visible&&(point1=r[j].location=ej.EjSvgRender.utils._getPoint(currentPoint,i),u.append("L "+(point1.X+o)+" "+(point1.Y+s)+" "),r[j].YValues[0]=currentPoint.YValues[0]);else{for(l=i.stackedValue.StartValues[j+1],e=j-1;e>=a;e--)currentPoint={xValue:r[e].xValue,YValues:[i.stackedValue.StartValues[e]]},point1=ej.EjSvgRender.utils._getPoint(currentPoint,i),u.append("L "+(point1.X+o)+" "+(point1.Y+s)+" ");r[j+1]&&r[j+1].visible&&(h={xValue:r[j+1].xValue,YValues:[i.stackedValue.StartValues[j+1]]},f=ej.EjSvgRender.utils._getPoint(h,i),u.append("M "+(f.X+o)+" "+(f.Y+s)+" "));a=j+1}c=u.toString();this.drawAreaPath(i,y,c);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0});ej.seriesTypes.stackingarea=ej.ejStackingAreaSeries;ej.seriesTypes.stackingarea100=ej.ejStackingAreaSeries;ej.ejAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var y,f,l,a,e,w,v;this.chartObj=n;t.animationType="path";var o=ej.EjSvgRender.utils._getStringBuilder(),r=t,b=this.setAreaSeriesStyle(r),p=this.chartObj;r.sorting&&(r.points=ej.DataManager(r.points,ej.Query().sortBy("xValue")).executeLocal());var u=this.chartObj.dragPoint?r.pointCollection:this._isVisiblePoints(r),h=ej.EjSeriesRender.prototype.getOrigin(this,r,i),s,c=[];if(c[0]=p.canvasX,c[1]=p.canvasY,u.length>0){for(f=0;f<u.length;f++)u[f].visible&&(u.length>f+1?(s||(s={xValue:u[f].xValue,YValues:[h]},e=ej.EjSvgRender.utils._getPoint(s,r),o.append("M "+e.X+" "+e.Y+" ")),e=ej.EjSvgRender.utils._getPoint(u[f],r),o.append("L "+e.X+" "+e.Y+" "),u[f+1].visible||(point={xValue:u[f].xValue,YValues:[h]},l=ej.EjSvgRender.utils._getPoint(point,r),a=ej.EjSvgRender.utils._getPoint(s,r),o.append("L "+l.X+" "+l.Y+" L "+a.X+" "+a.Y+" "),s=null)):u[f-1]&&u[f-1].visible&&(e=ej.EjSvgRender.utils._getPoint(u[f],r),o.append("L "+e.X+" "+e.Y+" ")));w={xValue:u[u.length-1].xValue,YValues:[h]};v=ej.EjSvgRender.utils._getPoint(w,r);u.length>1&&o.append("L "+v.X+" "+v.Y+" ");y=o.toString();this.drawAreaPath(r,b,y,c)}this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.area=ej.ejAreaSeries;ej.ejRangeAreaSeries=r(ej.EjSeriesRender,{draw:function(n,i){var w,u,a,v,s,l,o,h,r,y,f,p;this.chartObj=n;i.animationType="path";var c=ej.EjSvgRender.utils._getStringBuilder(),e=i,b=this.setAreaSeriesStyle(e),d=t.inArray(e,this.chartObj.model._visibleSeries);for(e.points=ej.DataManager(e.points,ej.Query().sortBy("xValue")).executeLocal(),u=this._isVisiblePoints(e),a=[],a[0]=this.chartObj.canvasX,a[1]=this.chartObj.canvasY,s=[],r=0;r<u.length;r++)if(s[r]={Region:{PointIndex:r},SeriesIndex:d,region:[]},u[r].visible&&(v||(l=u[r].low,v={xValue:u[r].xValue,YValues:[l]},o=ej.EjSvgRender.utils._getPoint(v,e),c.append("M "+o.X+" "+o.Y+" ")),o=ej.EjSvgRender.utils._getPoint(u[r],e),c.append("L "+o.X+" "+o.Y+" "),s[r].region.push({X:o.X,Y:o.Y}),r!=0&&s[r-1].region.push({X:o.X,Y:o.Y}),r+1<u.length&&!u[r+1].visible)){for(h=r;h>=0;h--)if(u[h].visible)l=u[h].low,y={xValue:u[h].xValue,YValues:[l]},f=ej.EjSvgRender.utils._getPoint(y,e),c.append("L "+f.X+" "+f.Y+" "),s[h].region.push({X:f.X,Y:f.Y}),h!=0&&s[h-1].region.push({X:f.X,Y:f.Y});else break;v=null}for(r=u.length-1;r>=0;r--)if(u[r].visible)l=u[r].low,y={xValue:u[r].xValue,YValues:[l]},f=ej.EjSvgRender.utils._getPoint(y,e),c.append("L "+f.X+" "+f.Y+" "),s[r].region.push({X:f.X,Y:f.Y}),r!=0&&s[r-1].region.push({X:f.X,Y:f.Y});else if(u.length>r&&u[r].visible){f=ej.EjSvgRender.utils._getPoint(u[r],e);c.append("L "+f.X+" "+f.Y+" ");break}else if(r!=u.length-1){for(p=0,k=r-1;k>=0;k--)if(u[k].visible)p++;else if(!u[k].visible)break;r=r-p}w=c.toString();this.chartObj.model.chartRegions.push(s);this.drawAreaPath(e,b,w,a);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.rangearea=ej.ejRangeAreaSeries;ej.ejSplineSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var o,h;i.seriesCollection||(i.seriesCollection={},t._name=ej.util.isNullOrUndefined(t.name)?"":t.name.replace(/ /g,""));i.seriesCollection[t._name]||(i.seriesCollection[t._name]={});this.chartObj=n;t.animationType="path";var r=t,c="",l=ej.EjSvgRender.utils._getStringBuilder(),nt=this.setLineSeriesStyle(r),s=this.chartObj.dragPoint?r.pointCollection:this._isVisiblePoints(r),a=i.seriesCollection[r._name].naturalSpline||this.naturalSpline(s),f=null,e=null,v=-1,tt=0,it=i.seriesCollection[r._name].controlPoints||[];for(o=0;o<s.length;o++)if(h=o,e=s[o],e.visible){if(f!=null){var y=null,p=null,w=it[tt++]||this.getBezierControlPoints(f,e,a[v],a[h],0);y=w.controlPoint1;p=w.controlPoint2;var b=ej.EjSvgRender.utils._getPoint(f,r),k=ej.EjSvgRender.utils._getPoint(e,r),d=ej.EjSvgRender.utils._getPoint(y,r),g=ej.EjSvgRender.utils._getPoint(p,r),u=this.chartObj;l.append("M "+(b.X+u.canvasX)+" "+(b.Y+u.canvasY)+" C "+(d.X+u.canvasX)+" "+(d.Y+u.canvasY)+" "+(g.X+u.canvasX)+" "+(g.Y+u.canvasY)+" "+(k.X+u.canvasX)+" "+(k.Y+u.canvasY)+" ")}f=e;v=h}else f=null;c=l.toString();this._drawLinePath(r,nt,c);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.spline=ej.ejSplineSeries;ej.ejSplineAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var ht,f,c,l;i.seriesCollection||(i.seriesCollection={},t._name=ej.util.isNullOrUndefined(t.name)?"":t.name.replace(/ /g,""));i.seriesCollection[t._name]||(i.seriesCollection[t._name]={});this.chartObj=n;t.animationType="path";var w=this.chartObj.model.requireInvertedAxes,r=t,b="",e=ej.EjSvgRender.utils._getStringBuilder(),ft=this.setAreaSeriesStyle(r);r.sorting&&(r.points=ej.DataManager(r.points,ej.Query().sortBy("xValue")).executeLocal());var u=this.chartObj.dragPoint?r.pointCollection:this._isVisiblePoints(r),k=i.seriesCollection[r._name].naturalSpline||this.naturalSpline(u),s=null,h=null,d=-1,et=ej.EjSeriesRender.prototype.getOrigin(this,r,i),a=null,y=!0,g=this.chartObj,p=[],ot=0,st=i.seriesCollection[r._name].controlPoints||[];for(p[0]=g.canvasX,p[1]=g.canvasY,ht=0,f=0;f<u.length;f++)if(c=f,h=u[f],h.visible){if(a||(a={xValue:u[f].xValue,YValues:[et]},l=ej.EjSvgRender.utils._getPoint(a,r)),s!=null){var nt=null,tt=null,it=st[ot++]||this.getBezierControlPoints(s,h,k[d],k[c],0);nt=it.controlPoint1;tt=it.controlPoint2;var o=ej.EjSvgRender.utils._getPoint(s,r),v=ej.EjSvgRender.utils._getPoint(h,r),rt=ej.EjSvgRender.utils._getPoint(nt,r),ut=ej.EjSvgRender.utils._getPoint(tt,r);y&&(w?e.append("M "+l.X+" "+o.Y+" L "+o.X+" "+o.Y+" "):e.append("M "+o.X+" "+l.Y+" L "+o.X+" "+o.Y+" "),y=!1);e.append("C "+rt.X+" "+rt.Y+" "+ut.X+" "+ut.Y+" "+v.X+" "+v.Y+" ");(c==u.length-1||c<u.length-1&&!u[f+1].visible)&&(w?e.append("L "+l.X+" "+v.Y+" "):e.append("L "+v.X+" "+l.Y+" "),a=null,y=!0)}s=h;d=c}else s=null;b=e.toString();this.drawAreaPath(r,ft,b,p);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.splinearea=ej.ejSplineAreaSeries;ej.ejScatterSeries=r(ej.EjSeriesRender,{draw:function(n,i){var f,r,s;this.chartObj=n;f=i;i.animationType="scatter";var h=t.inArray(i,this.chartObj.model._visibleSeries),e=this._isVisiblePoints(f),c=e.length,o,u;for(r=0;r<c;r++)o=e[r],s=r,u=ej.EjSvgRender.utils._getPoint(o,i),this.drawSymbol(h,i,s,u.X,u.Y)}});ej.seriesTypes.scatter=ej.ejScatterSeries;ej.ejBubbleSeries=r(ej.EjSeriesRender,{createBubbleGroup:function(n){var r=t.inArray(n,this.chartObj.model.series),u=this.chartObj.model.m_AreaBounds.X,f=this.chartObj.model.m_AreaBounds.Y,i=n._isTransposed,e=i?u:n.xAxis.x,o=i?f:n.yAxis.y,s={id:this.chartObj.svgObject.id+"_SeriesGroup_"+r,transform:"translate("+e+","+o+")"};this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(s)},draw:function(i,r){var u,f,o,s,nt,ut,ht;this.chartObj=i;r.animationType="bubble";u=r;f=u.cornerRadius;u.points=ej.DataManager(u.points,ej.Query().sortBy("xValue")).executeLocal();var tt=t.inArray(u,this.chartObj.model._visibleSeries),k=this._isVisiblePoints(u),h=1,d=r.bubbleOptions,ct=d.radiusMode.toLowerCase(),a,v,it=i.model.m_AreaBounds,c=i.model._visibleSeries,e=0,rt=Math.max(it.Height,it.Width),y,p,g;if(ct=="minmax")g=rt/100,a=d.minRadius*g,v=d.maxRadius*g,p=v-a,e=Math.max.apply(0,t.map(k,function(n){return n.YValues[h]}));else for(maxValue=rt/10,a=v=1,p=maxValue*v,m=0;m<c.length;m++)if(c[m].type.toLowerCase()=="bubble"&&c[m].visibility=="visible"&&c[m].bubbleOptions.radiusMode.toLowerCase()=="auto")for(points=c[m]._visiblePoints,n=0;n<points.length;n++)e=e<points[n].YValues[h]?points[n].YValues[h]:e;for(this.createBubbleGroup(u),o=0;o<k.length;o++)if(s=k[o],nt=o,s.visible){y=u.bubbleOptions.radiusMode.toLowerCase()=="minmax"?a+p*Math.abs(s.YValues[h]/e):p*Math.abs(s.YValues[h]/e);var w=ej.EjSvgRender.utils._getPoint(s,u),l=this.chartObj.setStyle(this,u,tt,nt),r={id:this.chartObj.svgObject.id+"_Series"+tt+"_Point"+nt,cx:w.X+this.chartObj.canvasX,cy:w.Y+this.chartObj.canvasY,r:y,fill:l.interior,cornerRadius:f,"stroke-width":l.borderWidth,"stroke-dasharray":l.dashArray,opacity:l.opacity,stroke:l.borderColor};typeof f!="object"&&f>0||f.topLeft>0||f.bottomLeft>0||f.topRight>0||f.bottomRight>0?(ut=ej.EjSvgRender.utils.calculateroundedCorner(r),r.d=ut,cSer.chartObj.svgRenderer.drawPath(r,cSer.gSeriesGroupEle)):s.radius=y;this.chartObj.svgRenderer.drawCircle(r,this.gSeriesGroupEle);var lt=w.X,at=w.Y,b=y,ft,et,ot,st;et=lt-b+(u.isTransposed?this.chartObj.model.m_AreaBounds.X:u.xAxis.x);ot=at-b+(u.isTransposed?this.chartObj.model.m_AreaBounds.Y:u.yAxis.y);st=2*b;ft=2*b;ht={X:et,Y:ot,Width:ft,Height:st};ej.EjSvgRender.utils._addRegion(this.chartObj,ht,u,null,o)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.bubble=ej.ejBubbleSeries;ej.ejhiloSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var p,f,e,l,a,s,h,k;this.chartObj=n;i.animationType="hilo";p=this.chartObj.model.requireInvertedAxes;f=i;f.points=ej.DataManager(f.points,ej.Query().sortBy("xValue")).executeLocal();var w=this._isVisiblePoints(f),o=this.getSideBySideInfo(f,r),u=null,c=t.inArray(f,this.chartObj.model._visibleSeries),b=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,p),d={id:this.chartObj.svgObject.id+"_SeriesGroup_"+c,transform:"translate("+b.x+","+b.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(d),e=0;e<w.length;e++)if(u=w[e],l=e,u.visible){if(a="",ej.util.isNullOrUndefined(u.YValues[0])||ej.util.isNullOrUndefined(u.YValues[1]))continue;var g=this.chartObj.setStyle(this,f,c,l),nt=this.chartObj.setHiloStyle(f,l,c),v={},y={};u.YValues[0]<u.YValues[1]?(v={xValue:u.xValue+o.Median,YValues:[u.YValues[0]]},y={xValue:u.xValue+o.Median,YValues:[u.YValues[1]]}):(v={xValue:u.xValue+o.Median,YValues:[u.YValues[1]]},y={xValue:u.xValue+o.Median,YValues:[u.YValues[0]]});s=ej.EjSvgRender.utils._getPoint(v,f);h=ej.EjSvgRender.utils._getPoint(y,f);a="M "+(s.X+this.chartObj.canvasX)+" "+(s.Y+this.chartObj.canvasY)+" L "+(h.X+this.chartObj.canvasX)+" "+(h.Y+this.chartObj.canvasY)+" ";k={point1:s,point2:h};this._drawHiloPath(f,g,nt,a,e,k)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.hilo=ej.ejhiloSeries;ej.ejhiloopencloseSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var et,u,a,o,g,w,b,h,c,ht,ct,k,d,lt;this.chartObj=n;et=this.chartObj.model.requireInvertedAxes;i.animationType="hilo";u=i;u.points=ej.DataManager(u.points,ej.Query().sortBy("xValue")).executeLocal();var ot=this._isVisiblePoints(u),e=this.getSideBySideInfo(u,r),f=null,l=this.chartObj.model.palette,p=t.inArray(u,this.chartObj.model._visibleSeries),st=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,et),at={id:this.chartObj.svgObject.id+"_SeriesGroup_"+p,transform:"translate("+st.x+","+st.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(at),o=0;o<ot.length;o++)if(g=o,f=ot[o],f.visible){var s="",vt=ej.util.isNullOrUndefined(u.drawMode)?!0:u.drawMode.toLowerCase()=="both"||u.drawMode.toLowerCase()=="open"?!0:!1,yt=ej.util.isNullOrUndefined(u.drawMode)?!0:u.drawMode.toLowerCase()=="both"||u.drawMode.toLowerCase()=="close"?!0:!1,nt={},tt={},v={},y={};if(f.YValues[0]<f.YValues[1]?(nt={xValue:f.xValue+e.Median,YValues:[f.YValues[0]]},tt={xValue:f.xValue+e.Median,YValues:[f.YValues[1]]},v={xValue:f.xValue,YValues:[f.YValues[2]]},y={xValue:f.xValue,YValues:[f.YValues[3]]}):(nt={xValue:f.xValue+e.Median,YValues:[f.YValues[1]]},tt={xValue:f.xValue+e.Median,YValues:[f.YValues[0]]},v={xValue:f.xValue,YValues:[f.YValues[2]]},y={xValue:f.xValue,YValues:[f.YValues[3]]}),u.fill=u.isFill?u.fill:null,f.YValues[2]<f.YValues[3]?u.bearFillColor=a=ej.util.isNullOrUndefined(u.bearFillColor)?u.fill?u.fill:l&&l.length>0?l[p]:"#339933":u.bearFillColor:u.bullFillColor=a=ej.util.isNullOrUndefined(u.bullFillColor)?u.fill?u.fill:l&&l.length>0?l[p]:"#E51400":u.bullFillColor,w=this.chartObj.setStyle(this,u,p,g,a),b=this.chartObj.setHiloStyle(u,g,p,a),f.fill?a=jQuery.type(f.interior)=="array"?f.fill[0]:f.fill:f._hiloFill=a,h=this.chartObj.canvasX,c=this.chartObj.canvasY,vt){var pt={xValue:v.xValue+e.Median,YValues:v.YValues},it=ej.EjSvgRender.utils._getPoint(pt,u),wt={xValue:v.xValue+e.Start,YValues:v.YValues},rt=ej.EjSvgRender.utils._getPoint(wt,u);s="M "+(it.X+h)+" "+(it.Y+c)+" L "+(rt.X+h)+" "+(rt.Y+c)+" ";ht={point1:it,point2:rt};this._drawHiloPath(u,w,b,s,o,ht);s=""}if(yt){var bt={xValue:y.xValue+e.Median,YValues:y.YValues},ut=ej.EjSvgRender.utils._getPoint(bt,u),kt={xValue:y.xValue+e.End,YValues:y.YValues},ft=ej.EjSvgRender.utils._getPoint(kt,u);s="M "+(ut.X+h)+" "+(ut.Y+c)+" L "+(ft.X+h)+" "+(ft.Y+c)+" ";ct={point1:ut,point2:ft};this._drawHiloPath(u,w,b,s,o,ct);s=""}k=ej.EjSvgRender.utils._getPoint(nt,u);d=ej.EjSvgRender.utils._getPoint(tt,u);s="M "+(k.X+h)+" "+(k.Y+c)+" L "+(d.X+h)+" "+(d.Y+c)+" ";lt={point1:k,point2:d};this._drawHiloPath(u,w,b,s,o,lt)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.hiloopenclose=ej.ejhiloopencloseSeries;ej.ejCandleSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var rt,f,y,o,b,v,g,ht,it,at;this.chartObj=n;i.animationType="hilo";rt=this.chartObj.model.requireInvertedAxes;f=i;f.points=ej.DataManager(f.points,ej.Query().sortBy("xValue")).executeLocal();var ut=this._isVisiblePoints(f),e=this.getSideBySideInfo(f,r),u=null,l=this.chartObj.model.palette,a=t.inArray(f,this.chartObj.model._visibleSeries),ft=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,rt),vt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+ft.x+","+ft.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(vt),o=0;o<ut.length;o++)if(u=ut[o],b=o,u.visible){var et="",k={},d={},s={},h={};u.YValues[0]<u.YValues[1]?(k={xValue:u.xValue+e.Median,YValues:[u.YValues[0]]},d={xValue:u.xValue+e.Median,YValues:[u.YValues[1]]},s={xValue:u.xValue,YValues:[u.YValues[2]]},h={xValue:u.xValue,YValues:[u.YValues[3]]}):(k={xValue:u.xValue+e.Median,YValues:[u.YValues[1]]},d={xValue:u.xValue+e.Median,YValues:[u.YValues[0]]},s={xValue:u.xValue,YValues:[u.YValues[2]]},h={xValue:u.xValue,YValues:[u.YValues[3]]});u.YValues[2]<u.YValues[3]?(s={xValue:u.xValue,YValues:[u.YValues[2]]},h={xValue:u.xValue,YValues:[u.YValues[3]]},f.bearFillColor=y=ej.util.isNullOrUndefined(f.bearFillColor)?l&&l.length>0?l[a]:"#339933":f.bearFillColor):(s={xValue:u.xValue,YValues:[u.YValues[3]]},h={xValue:u.xValue,YValues:[u.YValues[2]]},f.bullFillColor=y=ej.util.isNullOrUndefined(f.bullFillColor)?l&&l.length>0?l[a]:"#E51400":f.bullFillColor);v=this.chartObj.setStyle(this,f,a,b,y);g=this.chartObj.setHiloStyle(f,b,a,y);u.style&&u.style.interior?y=jQuery.type(u.style.interior)=="array"?u.style.interior[0]:u.style.interior:u._hiloFill=g;var nt=ej.EjSvgRender.utils._getPoint(k,f),tt=ej.EjSvgRender.utils._getPoint({xValue:s.xValue+e.Median,YValues:[s.YValues[0]]},f),ot=ej.EjSvgRender.utils._getPoint({xValue:h.xValue+e.Median,YValues:[h.YValues[0]]},f),st=ej.EjSvgRender.utils._getPoint(d,f),p=this.chartObj.canvasX,w=this.chartObj.canvasY;et="M "+(nt.X+p)+" "+(nt.Y+w)+" L "+(tt.X+p)+" "+(tt.Y+w)+" M "+(ot.X+p)+" "+(ot.Y+w)+" L "+(st.X+p)+" "+(st.Y+w)+" ";ht={point1:nt,point2:tt};this._drawHiloPath(f,v,g,et,o,ht);var yt={xValue:h.xValue+e.Start,YValues:h.YValues},ct=ej.EjSvgRender.utils._getPoint(yt,f),pt={xValue:s.xValue+e.End,YValues:s.YValues},lt=ej.EjSvgRender.utils._getPoint(pt,f),c=ej.EjSvgRender.utils._correctRect(ct.X,ct.Y,lt.X,lt.Y),wt={id:this.chartObj.svgObject.id+"_Series"+a+"_Point"+o,x:c.X+this.chartObj.canvasX,y:c.Y+this.chartObj.canvasY,width:c.Width,height:c.Height,fill:v.interior,"stroke-width":v.borderWidth,"stroke-dasharray":v.dashArray,stroke:v.borderColor};this.chartObj.svgRenderer.drawRect(wt,this.gSeriesGroupEle);it=ej.EjSvgRender.utils._getSvgXY(c.X,c.Y,f,this.chartObj);at={X:it.X,Y:it.Y,Width:c.Width,Height:c.Height};ej.EjSvgRender.utils._addRegion(this.chartObj,at,f,u,o)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.candle=ej.ejCandleSeries;ej.ejPieOfPieSeries=r(ej.EjSeriesRender,{draw:function(n,t){this.chartObj=n;var i=new ej.seriesTypes.pie;i.draw(n,t)},chartAreaType:"None"});ej.seriesTypes.pieofpie=ej.ejPieOfPieSeries;ej.ejPieSeries=r(ej.EjSeriesRender,{draw:function(n,r){var p,d,g,l,nt,tt,it,rt,s,h,ft,u,et,ot,y;this.chartObj=n;var f=r,w=[],b=r.type.toLowerCase(),e=r.collectionIndex,st=e==0?f.pieCoefficient:f.pieOfPieCoefficient,k=this._calculateVisiblePoints(r,this.chartObj).visiblePoints,c=this.calculatingSliceAngle(f),u=t.inArray(f,this.chartObj.model._visibleSeries),ht=this.chartObj.model._visibleSeries.length,o=this.chartObj.model._visibleSeries[u];if(o._pieCoefficient=o.pieCoefficient,this.chartObj.model.circularRadius.length>1){for(i=u;ej.util.isNullOrUndefined(o.zOrder)?i<this.chartObj.model.circularRadius.length:i>=0;ej.util.isNullOrUndefined(o.zOrder)?i++:i--)if(!ej.util.isNullOrUndefined(this.chartObj.model.circularRadius[i])){this.chartObj.model.circularRadius[u]=this.chartObj.model.circularRadius[i]*o._pieCoefficient;break}}else b=="pieofpie"&&o.splitMode!=""?this.chartObj.model.circularRadius[e]=.25*st*Math.min(c.width,c.height):this.chartObj.model.circularRadius[u]=.5*o._pieCoefficient*Math.min(c.width,c.height);if(p=Math.min(c.width,c.height),p<0)return p;for(d=Math.abs(f.endAngle-f.startAngle),d<270&&this.pieDoughnutCenter(f),g={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u},this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(g),l=f.enableAnimation&&!f._animatedSeries?"hidden":"visible",nt={id:this.chartObj.svgObject.id+"_TextGroup_"+u,visibility:l},this.chartObj.gSeriesTextEle||(this.chartObj.gSeriesTextEle=[]),this.chartObj.gSeriesTextEle[u]=e==1?this.chartObj.gSeriesTextEle[0]:this.chartObj.svgRenderer.createGroup(nt),tt={id:this.chartObj.svgObject.id+"_symbolGroup_"+u,visibility:l},this.chartObj.gSymbolGroupEle||(this.chartObj.gSymbolGroupEle=[]),this.chartObj.gSymbolGroupEle[u]=this.chartObj.svgRenderer.createGroup(tt),it={id:this.chartObj.svgObject.id+"_connectorGroup_"+u,visibility:l},this.chartObj.gConnectorEle||(this.chartObj.gConnectorEle=[]),this.chartObj.gConnectorEle[u]=this.chartObj.svgRenderer.createGroup(it),rt={id:this.chartObj.svgObject.id+"_DataLabel_"+u,visibility:l},this.chartObj.gDataLabelEle||(this.chartObj.gDataLabelEle=[]),this.chartObj.gDataLabelEle[u]=e==1?this.chartObj.gDataLabelEle[0]:this.chartObj.svgRenderer.createGroup(rt),s=0;s<k.length;s++)if((pointIndex=this.chartObj.model._isPieOfPie?k[s].actualIndex:s,!isNaN(f._visiblePoints[s].startAngle))&&(h=f._visiblePoints[s],h.visible)){var v=this._calculateArcData(this.chartObj,pointIndex,h,f,u,e),ut=v.Direction.split(" "),a=this.chartObj.setStyle(this,f,u,s);ft=f.startAngle<f.endAngle?!1:!0;r={id:this.chartObj.svgObject.id+"_Series"+u+"_Point"+pointIndex,fill:a.interior,"stroke-width":a.borderWidth,stroke:a.borderColor,"stroke-dasharray":a.dashArray,"stroke-linecap":f.lineCap,"stroke-linejoin":f.lineJoin,d:v.Direction,opacity:a.opacity,radius:b=="pieofpie"?this.chartObj.model.circularRadius[e]:this.chartObj.model.circularRadius[u],start:h.startAngle-1.57,end:h.endAngle-1.57,pointIndex:pointIndex,counterClockWise:ft,innerR:0,cx:v.centerX,cy:v.centerY,x:ut[12],y:ut[13]};this.chartObj.svgRenderer.drawPath(r,this.gSeriesGroupEle);y={PointIndex:pointIndex,StartAngle:h.startAngle,EndAngle:h.endAngle,StartX:this.chartObj.model.startX[pointIndex],StartY:this.chartObj.model.startY[pointIndex],PieSeriesIndex:e,SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};w.push(y)}u=this.chartObj.model._isPieOfPie?e:u;this.chartObj.model._isPieOfPie&&e==1&&o.pieCollections[0].length>0&&o.pieCollections[1].length==0&&(et=this._drawEmptyPieOfPie(this.chartObj),this.chartObj.svgRenderer.drawPath(et,this.gSeriesGroupEle));ot={Radius:this.chartObj.model.circularRadius[u],CenterX:this.chartObj.model.circleCenterX[u],CenterY:this.chartObj.model.circleCenterY[u]};y={Series:f,SeriesData:ot,Region:w,SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};this.chartObj.model.chartRegions.push(y);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"None"});ej.seriesTypes.pie=ej.ejPieSeries;ej.ejDoughnutSeries=r(ej.EjSeriesRender,{draw:function(n,r){var y,k,l,d,g,nt,tt,h,o,s,c,ut,ft,v;this.chartObj=n;var f=r,b=[],et=this._calculateVisiblePoints(r).visiblePoints,a=this.calculatingSliceAngle(f),ot=et.length,u=t.inArray(f,this.chartObj.model._visibleSeries),at=this.chartObj.model._visibleSeries.length,at=this.chartObj.model._visibleSeries.length,e=this.chartObj.model._visibleSeries[u];if(e._doughnutSize=e.doughnutSize,e._doughnutCoefficient=e.doughnutCoefficient,this.chartObj.model.circularRadius.length>1){for(i=u;ej.util.isNullOrUndefined(e.zOrder)?i<this.chartObj.model.circularRadius.length:i>=0;ej.util.isNullOrUndefined(e.zOrder)?i++:i--)if(!ej.util.isNullOrUndefined(this.chartObj.model.circularRadius[i])){this.chartObj.model.circularRadius[u]=this.chartObj.model.circularRadius[i]*e._doughnutSize;break}}else this.chartObj.model.circularRadius[u]=.5*e._doughnutSize*Math.min(a.width,a.height);if(y=Math.min(a.width,a.height),y<0)return y;k=Math.abs(f.endAngle-f.startAngle);k<270&&this.pieDoughnutCenter(f);this.chartObj.model.innerRadius[u]=e._doughnutCoefficient*this.chartObj.model.circularRadius[u];var vt=ej.util.isNullOrUndefined(this.chartObj.model.roundingPlaces)?2:this.chartObj.model.roundingPlaces,u=t.inArray(f,this.chartObj.model._visibleSeries),st={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u};if(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(st),l=f.enableAnimation&&!f._animatedSeries?"hidden":"visible",d={id:this.chartObj.svgObject.id+"_TextGroup_"+u,visibility:l},this.chartObj.gSeriesTextEle||(this.chartObj.gSeriesTextEle=[]),this.chartObj.gSeriesTextEle[u]=this.chartObj.svgRenderer.createGroup(d),g={id:this.chartObj.svgObject.id+"_symbolGroup_"+u,visibility:l},this.chartObj.gSymbolGroupEle||(this.chartObj.gSymbolGroupEle=[]),this.chartObj.gSymbolGroupEle[u]=this.chartObj.svgRenderer.createGroup(g),nt={id:this.chartObj.svgObject.id+"_connectorGroup_"+u,visibility:l},this.chartObj.gConnectorEle||(this.chartObj.gConnectorEle=[]),this.chartObj.gConnectorEle[u]=this.chartObj.svgRenderer.createGroup(nt),tt={id:this.chartObj.svgObject.id+"_DataLabel_"+u,visibility:l},this.chartObj.gDataLabelEle||(this.chartObj.gDataLabelEle=[]),this.chartObj.gDataLabelEle[u]=this.chartObj.svgRenderer.createGroup(tt),f._doughnutSize>0&&e._doughnutCoefficient>=0&&f._doughnutSize<=1&&e._doughnutCoefficient<=1)for(h=0;h<ot;h++)if(o=f._visiblePoints[h],s=h,o.visible){var p=0,w=0,ht=this._calculateArcData(this.chartObj,s,o,f,u);if((o.actualIndex==f.explodeIndex||f.explodeAll)&&!this.chartObj.vmlRendering){var it=-.5*Math.PI,ct=o.startAngle+it,lt=o.endAngle+it-1e-6,rt=(ct+lt)/2;p=this.chartObj.model.circleCenterX[u]+Math.cos(rt)*f.explodeOffset;w=this.chartObj.model.circleCenterY[u]+Math.sin(rt)*f.explodeOffset}c=this.chartObj.setStyle(this,f,u,s);ut=f.startAngle<f.endAngle?!1:!0;r={id:this.chartObj.svgObject.id+"_Series"+u+"_Point"+s,fill:c.interior,"stroke-width":c.borderWidth,stroke:c.borderColor,"stroke-dasharray":c.dashArray,"stroke-linecap":f.lineCap,opacity:c.opacity,"stroke-linejoin":f.lineJoin,d:ht.Direction,start:o.startAngle-1.57,end:o.endAngle-1.57,pointIndex:s,radius:this.chartObj.model.circularRadius[u],innerR:this.chartObj.model.innerRadius[u],counterClockWise:ut,x:p!=0?p:this.chartObj.model.circleCenterX[u],y:w!=0?w:this.chartObj.model.circleCenterY[u]};this.chartObj.svgRenderer.drawPath(r,this.gSeriesGroupEle);v={PointIndex:h,StartAngle:o.startAngle,EndAngle:o.endAngle,StartX:this.chartObj.model.startX[s],StartY:this.chartObj.model.startY[s],SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};b.push(v)}ft={Radius:this.chartObj.model.circularRadius[u],DRadius:this.chartObj.model.innerRadius[u],CenterX:this.chartObj.model.circleCenterX[u],CenterY:this.chartObj.model.circleCenterY[u]};v={Series:f,SeriesData:ft,Region:b,SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};this.chartObj.model.chartRegions.push(v);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"None"});ej.seriesTypes.doughnut=ej.ejDoughnutSeries;ej.ejPyramidSeries=r(ej.EjSeriesRender,{draw:function(n,i){var a,ot,e,s,wt,ii,bt,kt,dt,gt,h,f,p,it;this.chartObj=n;var r=n.model,o,st=this,d=r.LegendActualBounds,u=i,w=this._calculateVisiblePoints(u).visiblePoints,rt=w.length,ht=[],ut=[],ct=r.legend,g=u.marker.dataLabel,l=ct.position.toLowerCase(),nt=ct.border.width,tt=0,c=r.title,b=r.title.subTitle,lt=r.border.width,at=c.text!=""&&c.visible&&c.enableTrim?!0:!1,vt=b.text!=""&&b.visible&&b.enableTrim?!0:!1,ft=r.title.text&&r.title.visible?ej.EjSvgRender.utils._measureText(r.title.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.font):0,et=r.title.subTitle.text&&r.title.subTitle.visible?ej.EjSvgRender.utils._measureText(r.title.subTitle.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.subTitle.font):0,yt=n.model.title.text==""||!n.model.title.visible?0:at&&c.textOverflow=="wrap"?ft.height*n.model.titleWrapTextCollection.length:at&&c.textOverflow=="wrapandtrim"?ft.height*n.model.titleWrapTextCollection.length:ft.height,pt=n.model.title.subTitle.text==""||!n.model.title.subTitle.visible?0:vt&&b.textOverflow=="wrap"?et.height*n.model.subTitleWrapTextCollection.length:vt&&b.textOverflow=="wrapandtrim"?et.height*n.model.subTitleWrapTextCollection.length:et.height,k=r.margin.left+r.elementSpacing+lt*2+r.elementSpacing+r.margin.right+(l==="right"||l==="left"?d.Width+2*nt:0),ni=(r.title.text&&r.title.visible?r._titleLocation.Y+yt+pt:r.elementSpacing)+lt*2+r.margin.top+r.elementSpacing+r.elementSpacing+(l==="top"||l==="bottom"?d.Height+2*nt+r.elementSpacing:0);if(g.visible&&g.shape!="none"&&u.labelPosition=="outside"&&(k=k+(g.margin.left+g.margin.right)),r.chartRegions=[],r.sumofYValues=0,u.labelPosition.toLowerCase()==="outside"){for(a=0;a<rt;a++)ot=ej.EjSvgRender.utils._measureText(ej.util.isNullOrUndefined(w[a].text)?w[a].y:w[a].text,null,u.marker.dataLabel.font).width,tt<ot&&(tt=ot);r.textSize=tt}u._enableSmartLabels?(r.actualWidth=(t(n.svgObject).width()-k)*.8,r.resWidth=(t(n.svgObject).width()-k-r.actualWidth)/2):(r.actualWidth=t(n.svgObject).width()-k-tt,r.resWidth=0);e=t.inArray(u,r._visibleSeries);r.actualHeight=t(n.svgObject).height()-ni;var ti=n.model.title.subTitle.text==""?0:pt,v=n.pyrX=(l==="left"?d.Width+2*nt:0)+r.elementSpacing+r.margin.left,y=n.pyrY=(l==="top"?d.Height+2*nt:0)+(c.text&&c.visible?r._titleLocation.Y+yt+ti:r.margin.top+r.elementSpacing);for(ut[0]=v,ut[1]=y,s=0;s<rt;s++)r.sumofYValues+=w[s].YValues[0];for(wt={id:n.svgObject.id+"_DataLabel_"+e,transform:"translate("+v+","+y+")"},n.gDataLabelEle=[],n.gDataLabelEle[e]=n.svgRenderer.createGroup(wt),ii=ej.util.isNullOrUndefined(r.roundingPlaces)?2:r.roundingPlaces,bt={id:n.svgObject.id+"_SeriesGroup_"+e,transform:"translate("+v+","+y+")"},this.gSeriesGroupEle=n.svgRenderer.createGroup(bt),kt={id:n.svgObject.id+"_textGroup_"+e,transform:"translate("+v+","+y+")"},n.gSeriesTextEle=[],n.gSeriesTextEle[e]=n.svgRenderer.createGroup(kt),dt={id:n.svgObject.id+"_symbolGroup_"+e,transform:"translate("+v+","+y+")"},n.gSymbolGroupEle=[],n.gSymbolGroupEle[e]=n.svgRenderer.createGroup(dt),gt={id:n.svgObject.id+"_connectorGroup_"+e,transform:"translate("+v+","+y+")"},n.gConnectorEle=[],n.gConnectorEle[e]=n.svgRenderer.createGroup(gt),u.pyramidMode.toLowerCase()=="linear"?this.calculateLinearSegments(u):this.calculateSurfaceSegments(u),s=0;s<rt;s++)h=s,o=u._visiblePoints[s],o.visible&&(f=this._getPyramidData(u,h),p=n.setStyle(this,u,0,h),i={id:n.svgObject.id+"_Series"+e+"_Point"+h,fill:p.interior,"stroke-width":p.borderWidth,stroke:p.borderColor,"stroke-dasharray":p.dashArray,"stroke-linecap":u.lineCap,"stroke-linejoin":u.lineJoin,opacity:p.opacity,pointIndex:h,d:f.Direction},n.svgRenderer.drawPath(i,this.gSeriesGroupEle,ut),u.marker.dataLabel.template&&ej.EjSvgRender.utils._getSeriesTemplateSize(o,h,u,!0,n),o.xLocation=f.PositionX,o.yLocation=f.PositionY,o.connectorLine=f.Connector,o.startX=f.startX,o.startY=f.startY,o.Polygon=f.Polygon,it={PointIndex:h,Line1:f.Line1,Line2:f.Line2,Line3:f.Line3,Line4:f.Line4,Polygon:f.Polygon},ht.push(it));it={Series:u,Region:ht,SeriesIndex:t.inArray(u,r._visibleSeries)};r.chartRegions.push(it);this.gSeriesGroupEle&&(t(this.gSeriesGroupEle.childNodes[h]).bind("mousemove",function(n){n.target=st.gSeriesGroupEle.childNodes[h];st.chartObj.chartInteractiveBehavior(n)}),n.svgRenderer.append(this.gSeriesGroupEle,n.gSeriesEle))},_getPyramidData:function(n,i){var r=this.chartObj.model,h=n._visiblePoints[i].marker,it=n._visiblePoints[i].actualIndex,a=n.explodeIndex==it||n.explodeAll?n.explodeOffset:0,c=r.resWidth,w=r.pyramidData[i].CurrY,v=r.pyramidData[i].CurrY+r.pyramidData[i].Height,b=.5*(1-r.pyramidData[i].CurrY),k=.5*(1-v),et=n.points[i],o={x:c+a+b*r.actualWidth,y:w*r.actualHeight},u={x:c+a+(1-b)*r.actualWidth,y:w*r.actualHeight},f={x:c+a+(1-k)*r.actualWidth,y:v*r.actualHeight},l={x:c+a+k*r.actualWidth,y:v*r.actualHeight},rt="M "+o.x+" "+o.y+" L "+u.x+" "+u.y+" L "+f.x+" "+f.y+" L "+l.x+" "+l.y+" z",ut=[{x:o.x,y:o.y},{x:u.x,y:u.y},{x:f.x,y:f.y},{x:l.x,y:l.y}],e,s,d,g,y,p;if(h&&h.dataLabel&&h.dataLabel.visible||(!h||!h.dataLabel)&&n.marker.dataLabel.visible)if(d=(u.x+f.x)/2,g=(u.y+f.y)/2,n.labelPosition.toLowerCase()==="outside"){e=(u.x+f.x)/2;s=(u.y+f.y)/2;y=(this.chartObj.model.legend.position.toLowerCase()=="left"||this.chartObj.model.legend.position.toLowerCase()=="right"?this.chartObj.model.LegendActualBounds.Width:0)+this.chartObj.model.elementSpacing+this.chartObj.model.margin.left;p=ej.util.isNullOrUndefined(n.marker.dataLabel.connectorLine.height)?n._enableSmartLabels?t(this.chartObj.svgObject).width()-(y+e+c+2*this.chartObj.model.elementSpacing):t(this.chartObj.svgObject).width()-(y+e+this.chartObj.model.textSize+this.chartObj.model.elementSpacing):n.marker.dataLabel.connectorLine.height;var nt=this.getXCordinate(e,p,0),tt=this.getYCordinate(s,p,0),ft="M "+e+" "+s+" L "+nt+" "+tt;e=nt;s=tt}else e=(o.x+u.x)/2,s=(f.y+o.y)/2;return{Direction:rt,PositionX:e,PositionY:s,Connector:ft,Line1:o,Line2:u,Line3:f,Line4:l,startX:d,startY:g,Polygon:ut}},calculateLinearSegments:function(n){var f=0,i=this.chartObj.model,t,u;i.pyramidData=[];var r=n.gapRatio>=0?n.gapRatio<=1?n.gapRatio:1:0,o=1/(i.sumofYValues*(1+r/(1-r))),e=n._visiblePoints.length;for(t=0;t<e;t++)(n._visiblePoints[t].visible||n._visiblePoints[t].gapMode)&&(u=o*n._visiblePoints[t].YValues[0],i.pyramidData[t]={CurrY:f,Height:u},f+=r/(e-1)+u)},calculateSurfaceSegments:function(n){var r=n._visiblePoints.length,u=this.chartObj.model,e,t,c;u.pyramidData=[];var i=0,o=[],f=[],l=n.gapRatio>=0?n.gapRatio<=1?n.gapRatio:1:0,s=l/(r-1),h=this.getSurfaceHeight(0,u.sumofYValues);for(t=0;t<r;t++)(n._visiblePoints[t].visible||n._visiblePoints[t].gapMode)&&(o[t]=i,f[t]=this.getSurfaceHeight(i,Math.abs(n._visiblePoints[t].YValues[0])),i+=f[t]+s*h);for(e=1/(i-s*h),t=0;t<r;t++)(n._visiblePoints[t].visible||n._visiblePoints[t].gapMode)&&(c=e*o[t],u.pyramidData[t]={CurrY:c,Height:e*f[t]})},getSurfaceHeight:function(n,t){var i=this.solveQuadraticEquation(1,2*n,-t);return i?i:0},solveQuadraticEquation:function(n,t,i){var r,u,f,e;if(n!=0){if(f=t*t-4*n*i,f>=0)return e=Math.sqrt(f),r=(-t-e)/(2*n),u=(-t+e)/(2*n),Math.max(r,u)}else if(t!=0)return r=-i/t,u=-i/t,Math.max(r,u);return!1},chartAreaType:"None"});ej.seriesTypes.pyramid=ej.ejPyramidSeries;ej.ejFunnelSeries=r(ej.EjSeriesRender,{draw:function(n,i){var st,gt,l,a,h,ni,ti,ii,ri,ht,rt,e,lt,c,f,y,ut;this.chartObj=n;var r=n.model,at=r.legend,v=at.position.toLowerCase(),g=r.LegendActualBounds,s,vt=this,u=i,p=this._calculateVisiblePoints(u).visiblePoints,w=p.length,yt=[],nt=u.marker,tt=at.border.width,ft=[],it=0,b=n.model.title.text==""?"":r.title,k=n.model.title.subTitle.text==""?"":r.title.subTitle,pt=r.border.width,wt=b.text!=""&&b.visible&&b.enableTrim?!0:!1,bt=k.text!=""&&k.visible&&k.enableTrim?!0:!1,et=r.title.text&&r.title.visible?ej.EjSvgRender.utils._measureText(r.title.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.font):0,ot=r.title.subTitle.text&&r.title.subTitle.visible?ej.EjSvgRender.utils._measureText(r.title.subTitle.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.subTitle.font):0,kt=n.model.title.text==""||!n.model.title.visible?0:wt&&b.textOverflow=="wrap"?et.height*n.model.titleWrapTextCollection.length:wt&&b.textOverflow=="wrapandtrim"?et.height*n.model.titleWrapTextCollection.length:et.height,dt=n.model.title.subTitle.text==""||!n.model.title.subTitle.visible?0:bt&&k.textOverflow=="wrap"?ot.height*n.model.subTitleWrapTextCollection.length:bt&&k.textOverflow=="wrapandtrim"?ot.height*n.model.subTitleWrapTextCollection.length:ot.height,d=r.margin.left+r.elementSpacing+r.elementSpacing+r.margin.right+pt*2+(v==="right"||v==="left"?g.Width+2*tt:0),ui=(r.title.text&&r.title.visible?r._titleLocation.Y+kt+dt:r.elementSpacing)+r.margin.top+pt*2+r.elementSpacing+r.elementSpacing+(v==="top"||v==="bottom"?g.Height+2*tt+r.elementSpacing:0);if(nt.visible&&nt.shape!="none"&&u.labelPosition=="outside"&&(d=d+(nt.margin.left+nt.margin.right)),r.chartRegions=[],r.sumofYValues=0,u.labelPosition.toLowerCase()==="outside"){for(e=0;e<w;e++)st=ej.EjSvgRender.utils._measureText(ej.util.isNullOrUndefined(p[e].text)?p[e].y:p[e].text,null,u.marker.dataLabel.font).width,it<st&&(it=st);r.textSize=it}for(u._enableSmartLabels?(r.actualWidth=(t(n.svgObject).width()-d)*.8,r.resWidth=(t(n.svgObject).width()-d-r.actualWidth)/2):(r.actualWidth=t(n.svgObject).width()-d-it,r.resWidth=0),gt=n.model.title.subTitle.text==""?0:dt,r.actualHeight=t(n.svgObject).height()-ui,l=n.pyrX=(v==="left"?g.Width+2*tt:0)+r.elementSpacing+r.margin.left,a=n.pyrY=(v==="top"?g.Height+2*tt:0)+(r.title.text&&r.title.visible?r._titleLocation.Y+kt+gt:r.margin.top+r.elementSpacing),ft[0]=l,ft[1]=a,h=0;h<w;h++)r.sumofYValues+=p[h].YValues[0];var si=ej.util.isNullOrUndefined(r.roundingPlaces)?2:r.roundingPlaces,o=t.inArray(u,r._visibleSeries),fi={id:n.svgObject.id+"_SeriesGroup_"+o,transform:"translate("+l+","+a+")"};this.gSeriesGroupEle=n.svgRenderer.createGroup(fi);ni={id:n.svgObject.id+"_DataLabel_"+o,transform:"translate("+l+","+a+")"};n.gDataLabelEle=[];n.gDataLabelEle[o]=n.svgRenderer.createGroup(ni);ti={id:n.svgObject.id+"_textGroup_"+o,transform:"translate("+l+","+a+")"};n.gSeriesTextEle=[];n.gSeriesTextEle[o]=n.svgRenderer.createGroup(ti);ii={id:n.svgObject.id+"_symbolGroup_"+o,transform:"translate("+l+","+a+")"};n.gSymbolGroupEle=[];n.gSymbolGroupEle[o]=n.svgRenderer.createGroup(ii);ri={id:n.svgObject.id+"_connectorGroup_"+o,transform:"translate("+l+","+a+")"};n.gConnectorEle=[];n.gConnectorEle[o]=n.svgRenderer.createGroup(ri);ht=0;rt=r;rt.funnelData=[];var ct=u.gapRatio>=0?u.gapRatio<=1?u.gapRatio:1:0,ei=1/(rt.sumofYValues*(1+ct/(1-ct))),oi=ct/w;for(e=w-1;e>=0;e--)(u._visiblePoints[e].visible||u._visiblePoints[e].gapMode)&&(lt=ei*u._visiblePoints[e].YValues[0],rt.funnelData[e]={CurrY:ht,Height:lt},ht+=lt+oi);for(h=0;h<w;h++)c=h,s=u._visiblePoints[h],s.visible&&(f=this._getFunnelData(u,c,n),y=n.setStyle(this,u,0,c),i={id:n.svgObject.id+"_Series"+o+"_Point"+c,fill:y.interior,"stroke-width":y.borderWidth,stroke:y.borderColor,"stroke-dasharray":y.dashArray,"stroke-linecap":u.lineCap,"stroke-linejoin":u.lineJoin,opacity:y.opacity,pointIndex:c,d:f.Direction},n.svgRenderer.drawPath(i,this.gSeriesGroupEle,ft),u.marker.dataLabel.template&&ej.EjSvgRender.utils._getSeriesTemplateSize(s,c,u,!0,n),s.xLocation=f.PositionX,s.yLocation=f.PositionY,s.connectorLine=f.Connector,s.startX=f.startX,s.startY=f.startY,s.Polygon=f.Polygon,ut={PointIndex:c,Line1:f.Line1,Line2:f.Line2,Line3:f.Line3,Line4:f.Line4,Line5:f.Line5,Line6:f.Line6,Polygon:f.Polygon},yt.push(ut));ut={Series:u,Region:yt,SeriesIndex:t.inArray(u,r._visibleSeries)};r.chartRegions.push(ut);this.gSeriesGroupEle&&t(this.gSeriesGroupEle.childNodes[c]).bind("mousemove",function(n){n.target=vt.gSeriesGroupEle.childNodes[c];vt.chartObj.chartInteractiveBehavior(n)});n.svgRenderer.append(this.gSeriesGroupEle,n.gSeriesEle)},_getFunnelData:function(n,i){var e=this.chartObj.model,pt=n._visiblePoints[i],tt=pt.marker,et=n.marker,ot=n.funnelWidth,st=n.funnelHeight,r=e.actualHeight,c=e.actualWidth,ht=e.elementSpacing,wt,bt=e.legend.position.toLowerCase(),ii=pt.actualIndex,kt,s=e.resWidth,dt,ct,gt,l=n.explodeIndex==ii||n.explodeAll?n.explodeOffset:0,rt,ut,d,lt,at,it,g,ft,a,vt,yt,h,w,ni,ti,v,u,f,b,nt,k,y,o,p;return o=st.indexOf("%")!=-1?r*(parseInt(st)/100):parseInt(st),p=ot.indexOf("%")!=-1?c*(parseInt(ot)/100):parseInt(ot),g=e.funnelData[i].CurrY*r,a=g+e.funnelData[i].Height*r,y=p+(c-p)*((r-o-g)/(r-o)),rt=c/2-y/2,lt=rt+y,y=a>r-o||r==o?p:p+(c-p)*((r-o-a)/(r-o)),d=c/2-y/2,it=d+y,g>=r-o?(rt=d=ut=c/2-p/2,lt=it=at=c/2+p/2):a>r-o&&(ut=d=c/2-y/2,at=it=ut+y,ft=r-o),v={x:s+l+rt,y:g},u={x:s+l+lt,y:g},b={x:s+l+it,y:a},nt={x:s+l+d,y:a},f={x:s+l+it,y:a},k={x:s+l+d,y:a},ft&&(f={x:s+l+at,y:ft},k={x:s+l+ut,y:ft}),kt="M "+v.x+" "+v.y+" L "+u.x+" "+u.y+" L "+f.x+" "+f.y+" L "+b.x+" "+b.y+" L "+nt.x+" "+nt.y+" L "+k.x+" "+k.y+" z",dt=[{x:v.x,y:v.y},{x:u.x,y:u.y},{x:f.x,y:f.y},{x:b.x,y:b.y},{x:nt.x,y:nt.y},{x:k.x,y:k.y}],(tt&&tt.dataLabel&&tt.dataLabel.visible||(!tt||!tt.dataLabel)&&et.dataLabel.visible)&&(h,w,ni=(u.x+f.x)/2,ti=(u.y+f.y)/2,n.labelPosition.toLowerCase()==="outside"?(h=(u.x+f.x)/2,w=(u.y+f.y)/2,wt=(bt=="left"||bt=="right"?e.LegendActualBounds.Width:0)+ht+e.margin.left,ct=ej.util.isNullOrUndefined(et.dataLabel.connectorLine.height)?n._enableSmartLabels?t(this.chartObj.svgObject).width()-(wt+h+s+2*ht):t(this.chartObj.svgObject).width()-(h+e.textSize+ht):et.dataLabel.connectorLine.height,vt=this.getXCordinate(h,ct,0),yt=this.getYCordinate(w,ct,0),gt="M "+h+" "+w+" L "+vt+" "+yt,h=vt,w=yt):(h=(v.x+u.x)/2,w=(v.y+b.y)/2)),{Direction:kt,PositionX:h,PositionY:w,Connector:gt,Line1:v,Line2:u,Line3:f,Line4:b,Line5:nt,Line6:k,startX:ni,startY:ti,Polygon:dt}},chartAreaType:"None"});ej.seriesTypes.funnel=ej.ejFunnelSeries;ej.ejPolarSeries=r(ej.EjSeriesRender,{draw:function(n,t){var r,o,s,u,f;this.chartObj=n;var h=this,i=t,c=this._isVisiblePoints(i),e=this.setLineSeriesStyle(i);if(i.drawType.toLowerCase()=="column"){r=i.xAxis.visibleRange;r.interval=1;o=i.xAxis._valueType=="category"?r.max:r.max-1;this.chartObj.model.sumofYValues=0;s=r.interval;u=r.min;do this.chartObj.model.sumofYValues+=r.interval,u+=r.interval;while(u<=o)}f=this._calculatePolarAxesSegment(i);i.drawType.toLowerCase()=="area"?this.drawAreaPath(i,e,f):i.drawType.toLowerCase()=="line"&&this._drawLinePath(i,e,f);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"PolarAxes"});ej.seriesTypes.polar=ej.ejPolarSeries;ej.ejRadarSeries=r(ej.EjSeriesRender,{draw:function(n,t){var r,o,s,u,f;this.chartObj=n;var h=this,i=t,c=this._isVisiblePoints(i),e=this.setLineSeriesStyle(i);if(i.drawType.toLowerCase()=="column"){r=i.xAxis.visibleRange;r.interval=1;o=i.xAxis._valueType=="category"?r.max:r.max-1;this.chartObj.model.sumofYValues=0;s=r.interval;u=r.min;do this.chartObj.model.sumofYValues+=r.interval,u+=r.interval;while(u<=o)}f=this._calculatePolarAxesSegment(i);i.drawType.toLowerCase()=="area"?this.drawAreaPath(i,e,f):i.drawType.toLowerCase()=="line"&&this._drawLinePath(i,e,f);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},doAnimation:function(n,i){var r=i.chartObj;n.regionAdded=!0;r.model._radius=r.model.Radius;r.model.Radius=0;var e=i,u=t.inArray(n,r.model._visibleSeries),f=t(r.gSeriesEle).find("#"+e.gSeriesGroupEle.id)[0].childNodes[0];t(f).animate({Radius:r.model._radius},{duration:1200,queue:!1,step:function(i){if(ej.util.isNullOrUndefined(r.model))t(f).stop(!0,!0);else{r.model.Radius=i;var u=e._calculatePolarAxesSegment(n);n.drawType.toLowerCase()!="column"&&r.svgRenderer._setAttr(t(f),{d:u});r.model.Radius=r.model._radius}},complete:function(){if(!ej.util.isNullOrUndefined(r.model)){n.regionAdded=!1;r.svgRenderer._setAttr(t(r.gSeriesEle).find("#"+r.svgObject.id+"_TextGroup_"+u),{visibility:"visible"});r.svgRenderer._setAttr(t(r.gSeriesEle).find("#"+r.svgObject.id+"_symbolGroup_"+u),{visibility:"visible"});r.svgRenderer._setAttr(t(r.gSeriesEle).find("#"+r.svgObject.id+"_DataLabel_"+u),{visibility:"visible"});r.model.AnimationComplete=!0;var i=t.extend({},ej.EjSvgRender.commonChartEventArgs);i.data={series:n};r._trigger("animationComplete",i)}}})},chartAreaType:"PolarAxes"});ej.seriesTypes.radar=ej.ejRadarSeries}(jQuery);ej.ejChart={},function($){String.prototype.parseTemplate=function(){var str=this;for($.each(arguments[0],function(n,t){t.count>0?$.each(t,function(t,i){var r=new RegExp("#"+n+"."+t+"#","gm");str=str.replace(r.source,i)}):str=str.replace(new RegExp("\\#"+n+"\\#","gm"),t)});str.indexOf("ej.")>=0;)substr=str.substring(str.indexOf("ej."),str.indexOf(")")+1),str=str.replace(substr,eval(substr));return str};String.prototype.capitalizeFirstString=function(){return this.charAt(0).toUpperCase()+this.slice(1)};var Gradient=function(n){this._gradientStop=[];for(var t=0;t<n.length;t++)this._gradientStop.push(n[t])};ej.ejChart={_renderSfChart:function(){var t=window.SVGSVGElement?!0:!1,n=this.model.enableCanvasRendering;return $("#chartContainer_"+this._id).remove(),t?(this.renderer=new ej.EjSvgRender(this.element),n?(this.svgRenderer=new ej.EjCanvasRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element)):(this.svgRenderer=new ej.EjSvgRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element)),this._appendChartElements(),n||this.legendContainer.find("svg").attr("class","e-designerhide"),this._createChart(),$(this.svgObject).appendTo(this.element)):(n=!1,this.svgRenderer=new ej.EjVmlRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.renderer=new ej.EjVmlRender(this.element),this._appendChartElements(),this._createChart(),$(this.svgObject).appendTo(this.chartContainer)),!0},_appendChartElements:function(){this.legendContainer=$("<div><\/div>").attr("id","legend_"+this._id).css("height","0px");this.scrollerContainer=$("<div><\/div>").attr("id","legend_Scroller"+this._id).css("height","0px");this.chartContainer=$("<div><\/div>").css("position","relative").attr("id","chartContainer_"+this._id);this.axisScroll=$("<div><\/div>").attr("id","axisScrollbar_"+this._id).css("height","0px");this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer);$(this.scrollerContainer).appendTo(this.legendContainer);$(this.axisScroll).appendTo(this.chartContainer);$(this.legendContainer).appendTo(this.chartContainer);$(this.chartContainer).appendTo(this.element)},setSvgSize:function(n){var t=n,e=$(t.element).height(),i=450,f=ej.isTouchDevice()?250:600,o=$(t.element).width(),s=$(t.chartContainer).height(),r,u;t.model.size.width?(r=t.model.size.width,f=typeof r=="string"&&r.indexOf("%")!=-1?o/100*parseInt(r):parseInt(r)):o>0&&(f=o);$(t.svgObject).width(f);t.model.size.height?(u=t.model.size.height,i=typeof u=="string"&&u.indexOf("%")!=-1?this.vmlRendering?i:e/100*parseInt(u):parseInt(u)):e>0?i=e:$(t.svgObject).css("display","block");$(t.svgObject).height(i);$("#"+t._id).css("overflow","hidden");t.svgObject.width=f;t.svgObject.height=i},setModelProperties:function(n){var i,c,o,r,s,h,u,t,e,f;if(n||this.setSvgSize(this),this.svgWidth=$(this.svgObject).width(),this.svgHeight=$(this.svgObject).height(),this.chartCross={visible:n?this.chartCross.visible:this.model.crosshair.visible,mArea:this.model.crosshair.type},this.serAnimation=[],this.model.series&&!n)for(s=!1,this.model._drawTrendline=!1,u=0;u<this.model.series.length;u++)for(this.model.series[u]=ej.copyObject({},this.model.commonSeriesOptions,this.model.series[u]),r=this.model.series[u],this.serAnimation.push(r.enableAnimation===null||r.enableAnimation===undefined?this.model.commonSeriesOptions.enableAnimation:r.enableAnimation),i=r.trendlines,c=i.length,t=0;t<c;t++)if(i[t]=ej.copyObject({},this.model.trendlineDefaults,i[t]),i[t]._visibility=i[t].visibility,i[t].visibility.toLowerCase()=="visible"){if(this.model._drawTrendline=!0,h=i[t].type.toLowerCase(),!ej.util.isNullOrUndefined(r.points))for(e=0;e<r.points.length;e++)if(o=r.points[e],ej.util.isNullOrUndefined(o.y)||o.y==0){s=!0;break}i[t].isNull=s&&(h=="power"||h=="exponential")?!0:!1}if(this.model.indicators)for(f=0;f<this.model.indicators.length;f++)this.model.indicators[f]=ej.copyObject({},this.model.indicatorDefaults,this.model.indicators[f])},_createChart:function(){var r,n,i,t;if(this.svgObject=this.svgRenderer.svgObj,r=$.extend({},ej.EjSvgRender.commonChartEventArgs),this._trigger("load",r),this.setTheme(ej.EjSvgRender.themes,this.model.theme),n=this.model,n.series[0]&&n.series[0]._isdesigntime){for(n.series[0]={},n.series[0].points=[],i=[],t=1;t<=10;t++)i.push({x:t,y:Math.floor(Math.random()*-30)+40});n.series[0].points=i}this.vmlRendering=this.svgRenderer.vmlNamespace?!0:!1;($(this.element).is(":visible")||$(this.element).css("visibility")!="hidden"||$(this.element).css("display")!="none")&&(this.bindEvents(),this.bindTo())},setTheme:function(n,t){var i=t.toLowerCase();(i.indexOf("azure")>=0||i.indexOf("lime")>=0||i.indexOf("saffron")>=0)&&i.indexOf("gradient")==-1&&i.indexOf("dark")==-1?n[i]=$.extend(!0,{},n.flatlight,n[i]):(i.indexOf("azuredark")>=0||i.indexOf("limedark")>=0||i.indexOf("saffrondark"))>=0&&i.indexOf("gradient")==-1?n[i]=$.extend(!0,{},n.flatdark,n[i]):(i.indexOf("azure")>=0||i.indexOf("lime")>=0||i.indexOf("saffron")>=0)&&i.indexOf("gradient")>=0&&i.indexOf("dark")==-1?n[i]=$.extend(!0,{},n.gradientlight,n[i]):(i.indexOf("azuredark")>=0||i.indexOf("limedark")>=0||i.indexOf("saffrondark")>=0)&&i.indexOf("gradient")>=0?n[i]=$.extend(!0,{},n.gradientdark,n[i]):i.indexOf("high")>=0?n[i]=$.extend(!0,{},n.highcontrast01,n[i]):i.indexOf("material")>=0||i.indexOf("office")>=0?n[i]=$.extend(!0,{},n.material,n[i]):n[i]||(i="flatlight");this.model=this.model._themeChanged?ej.copyObject({},this.model,n[i]):ej.copyObject({},n[i],this.model)},_drawBackInterior:function(){if(this.model.backInterior&&this.model.backInterior._gradientStop){var n={id:this.svgObject.id+"_backGradient",x1:"0%",y1:"0%",x2:"0%",y2:$(this.svgObject).height()+"%"};this.svgRenderer.drawGradient(n,this.model.backInterior._gradientStop)}},_drawBackImage:function(){var n={height:$(this.svgObject).height(),width:$(this.svgObject).width(),href:this.model.backGroundImageUrl,x:0,y:0,id:this.svgObject.id+"_backImage",visibility:"visible",preserveAspectRatio:"none"};this.svgRenderer.drawImage(n,this.svgObject)},_getDataType:function(n){var t=typeof n;return t==="number"||t==="string"?t:jQuery.type(n)=="date"?"date":n==null?null:!1},addedXYValues:function(n){var f,e,r,s,h,u,t,c,o,i;if(n=n?n:!1,f=this.model.series[0].type.toLowerCase(),ej.seriesTypes[f].prototype.chartAreaType=="cartesianAxes"?this.model.AreaType="cartesianaxes":ej.seriesTypes[f].prototype.chartAreaType=="None"?this.model.AreaType="none":(this.model.isPolar=f=="polar"?!0:!1,this.model.AreaType="polaraxes"),!n){for(r=0;r<this.model.series.length;r++)if(this.model.series[r].visibility=="visible"){if(s=!1,h=!1,this.model.series[r].dataSource&&this.model.series[r].dataSource.length!=0)for(t=this.model.series[r],t._xAxisValueType=null,e=t.points.length,i=0,c=e;i<c;i++)u=t.points[i].x,u!=null&&u!=undefined&&(t._xAxisValueType===null||t._xAxisValueType===undefined)&&(t._xAxisValueType=this._getDataType(u)),t._xAxisValueType!="string"&&(t.points[i].xValue=t.points[i].x);else for(this.model.series[r]=$.extend(!0,{},this.model.commonSeriesOptions,this.model.series[r]),t=this.model.series[r],this.model.primaryXAxis.valueType=="datetime"&&(h=!0),e=t.points.length,k=0;k<e;k++)t.points[k].YValues=[],isNaN(parseFloat(t.points[k].x))||/^-?[0-9]*\.?[0-9]+$/.test(t.points[k].x)!=!0||this.model.primaryXAxis.valueType=="category"||this.model.AreaType=="none"?t.points[k].xValue=t.points[k].x:h?(t.points[k].xValue=new Date(t.points[k].x),t.points[k].x=new Date(t.points[k].x)):(t.points[k].xValue=parseFloat(t.points[k].x),t.points[k].x=parseFloat(t.points[k].x)),s||(u=t.points[k].x,ej.util.isNullOrUndefined(u)||(t._xAxisValueType=this._getDataType(u),s=!0)),t._hiloTypes?(ej.util.isNullOrUndefined(t.points[k].high)||(t.points[k].YValues[0]=t.points[k].high,t.points[k].y=t.points[k].high),ej.util.isNullOrUndefined(t.points[k].low)||(t.points[k].YValues[1]=t.points[k].low),ej.util.isNullOrUndefined(t.points[k].open)||(t.points[k].YValues[2]=t.points[k].open),ej.util.isNullOrUndefined(t.points[k].close)||(t.points[k].YValues[3]=t.points[k].close)):(t.points[k].YValues[0]=t.points[k].y,ej.util.isNullOrUndefined(t.points[k].size)||(t.points[k].YValues[1]=t.points[k].size));if(t.type.toLowerCase()=="waterfall")this.calculateWaterfallSeriesPoints(t.points);else if(t._previousType&&t._previousType.toLowerCase()=="waterfall")for(o=t.points,i=0;i<o.length;i++)o[i].waterfallSum=undefined,o[i].textOptions=null}this._setInternalValues()}},calculateWaterfallSeriesPoints:function(n){for(var r=0,i=0,u=0,t=0;t<n.length;t++)n[t].isEmpty?(n[t].YValues[1]=0,n[t].YValues[0]=0):(i+=n[t].showIntermediateSum||n[t].showTotalSum?0:n[t].y,n[t].showIntermediateSum?(n[t].YValues[1]=r,n[t].YValues[0]=i,n[t].waterfallSum=i-r,r=i):n[t].showTotalSum?(n[t].YValues[1]=0,n[t].YValues[0]=i,n[t].waterfallSum=i):(n[t].YValues[1]=u,n[t].YValues[0]=u+n[t].y,u=i))},_setInternalValues:function(){for(var n,t,i=0;i<this.model.series.length;i++)if(n=this.model.series[i],this.model.AreaType=="cartesianaxes"&&ej.seriesTypes[n.type.toLowerCase()].prototype.chartAreaType=="cartesianAxes"?(n._zOrder=n.zOrder?n.zOrder:0,this.model._visibleSeries.push(n)):this.model.AreaType=="none"&&ej.seriesTypes[n.type.toLowerCase()].prototype.chartAreaType=="None"?(n._zOrder=n.zOrder?n.zOrder:0,this.model._visibleSeries.push(n)):this.model.AreaType=="polaraxes"&&ej.seriesTypes[n.type.toLowerCase()].prototype.chartAreaType=="PolarAxes"&&(n._zOrder=n.zOrder?n.zOrder:0,this.model._visibleSeries.push(n)),(n._yAxisName||n._xAxisName)&&this.model._axes)for(t=0;t<this.model._axes.length;t++)n._yAxisName&&n._yAxisName==this.model._axes[t].name&&(this.model._axes[t].orientation=this.model._axes[t].orientation?this.model._axes[t].orientation:this.model.requireInvertedAxes?"horizontal":"vertical"),n._xAxisName&&n._xAxisName==this.model._axes[t].name&&(this.model._axes[t].orientation=this.model._axes[t].orientation?this.model._axes[t].orientation:this.model.requireInvertedAxes?"vertical":"horizontal")},setHiloStyle:function(n,t,i,r){var f=n.points[t],u;return interior=f.fill?f.fill:n.fill?n.fill:r,u=interior?interior:this.model.seriesColors[i],seriesInterior=jQuery.type(u)=="array"?u[0].color:u},setStyle:function(n,t,i,r,u){var f=t._visiblePoints[r],o,v,y,p,w,h,e=f.border,c=t.border,l,a,s,b;return t._hiloTypes&&(h=t.isFill?t.fill:null),n.chartObj.model.AreaType=="cartesianaxes"?(f.fill?o=f.fill:t.type.toLowerCase()=="waterfall"?((f.showIntermediateSum||f.showTotalSum)&&f.waterfallSum>0||f.y>0&&!f.showIntermediateSum&&!f.showTotalSum)&&(o=t.positiveFill?t.positiveFill:u):o=h?h:u,l=o?o:this.model.seriesColors[i],a=n.chartObj.model.requireInvertedAxes?this.svgRenderer.createGradientElement(n.getSeriesName(t)+"_"+i+r,l,0,0,100,0,n.gSeriesGroupEle):this.svgRenderer.createGradientElement(n.getSeriesName(t)+"_"+i+r,l,0,0,0,100,n.gSeriesGroupEle)):(s=this.model.pointColors,o=f.fill?f.fill:jQuery.type(s[r])=="array"?s[r][0].color:s[r],b=this.svgRenderer.createGradientElement(n.getSeriesName(t)+r,o,0,0,0,$(n.svgObject).height()||parseFloat(this.model.size.height),n.chartObj.gSeriesEle)),v=e&&e.color?e.color:c.color,y=e&&e.width?e.width:c.width,w=f.opacity?f.opacity:t.opacity,width=f.width?f.width:t.width,p=e&&e.dashArray?e.dashArray:c.dashArray,{interior:a?a:b,borderColor:v,borderWidth:y,width:width,opacity:w,dashArray:p}},colorNameToHex:function(n){var t=n,i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",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",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:"#ff00ff",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",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#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:"#6b8e23",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return Object.prototype.toString.call(t)=="[object Array]"?t:typeof i[t.toLowerCase()]!="undefined"?i[t.toLowerCase()]:t},_getLocalizedLabels:function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)},_setCulture:function(n){this.culture=ej.preferredCulture(n)},draw:function(n){var f,tt,kt,ot,st,u,v,y,it,c,i,e,d,b,ti,r,l,p,oi,rt,ft,ht,ct,lt,g,at,si,ut,yt,a,o,nt,s,h,hi,pt,w,wt,ci,t,bt;for(this.removeMultiRect(),f={},f.axes={},this._drawBackInterior(),this.model.chartRegions=[],this.model.outsideDataRegionPoints=[],this.model.regionCount=null,this.model.circularRadius=[],this.model.innerRadius=[],this.model.bounds=[],this.accDataLabelRegion=[],this.model.rightsidebounds=[],this.model.leftsidebounds=[],this.model.excludeDataUpdate=n,this.model.yAxisLabelRegions=[],this.model.xAxisLabelRegions=[],this.model.axisMultiLevelLabelRegions=[],this.model.multiLevelLabelRegions=[],this.model.minhightwidth=!1,this.model._isPieOfPie=!1,n||(this.model._visibleSeries=[]),this.model.stackedValue={},this.model._locale=this.model.locale||"en-US",this._setCulture(this.model._locale),this._localizedLabels=this._getLocalizedLabels(),tt=this.model.series.length,this.model._sideBySideSeriesPlacement=ej.util.isNullOrUndefined(this.model.sideBySideSeriesPlacement)?this.model.enable3D?!1:!0:this.model.sideBySideSeriesPlacement,t=0;t<tt;t++)r=this.model.series[t],kt=r.type.toLowerCase(),r._isTransposed=kt.indexOf("bar")==-1?r.isTransposed:!r.isTransposed;for(tt>0&&this.addedXYValues(n),this.model.AreaType=this.model.AreaType||"cartesianaxes",this._isEjScroller(),ot=$.extend({},ej.EjSvgRender.commonChartEventArgs),ot.data={},this._trigger("preRender",ot),this.gLegendEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_Legend"}),this.gTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_ChartTitle",cursor:"default"}),this.gSubTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_ChartsubTitle",cursor:"default"}),this._createAxisLabelAndRange(),t=0;t<this.model._axes.length;t++)f.axes[this.model._axes[t].name]={};for(this._initializeSeriesColors(),this._calculateLegendBounds(),this.legendRender=new ej.EjLegendRender(this),st=$.extend({},ej.EjSvgRender.commonChartEventArgs),st.data={legendBounds:this.model.LegendBounds},this._trigger("legendBoundsCalculate",st),e=0;e<this.model.indicators.length;e++)if(u=this.model.indicators[e],u._points=[],u.xAxisName=u.xAxisName?u.xAxisName:this.model._axes[0].name,u.yAxisName=u.yAxisName?u.yAxisName:this.model._axes[1].name,u.isIndicator=!0,u.dataSource)u._hiloTypes=!0,this._processJsonData(u.dataSource,u),u._points=u.points;else if(u.points.length>0)for(t=0;t<u.points.length;t++)u._points=u.points,u._points[t].xValue=u.points[t].x,u._points[t].YValues=[],u._points[t].YValues[0]=u.points[t].close;else if(u.seriesName!="")for(v=0;v<this.model._visibleSeries.length;v++)r=this.model._visibleSeries[v],u.seriesName==r.name&&(u._points=$.extend(!0,[],r.points));for(c=0;c<this.model._axes.length;c++)if(this.model._axes[c].valueType&&this.model._axes[c].valueType.toLowerCase()=="category")for(t=0;t<this.model.indicators.length;t++)if(u=this.model.indicators[t],this.model._axes[c].name==u.xAxisName)for(e=0;e<u._points.length;e++)u._points[e].xValue=e;for(this.model.indicatorRange=[],v=0;v<this.model.indicators.length;v++)u=this.model.indicators[v],u._points.length>0&&(p=u.type.toLowerCase(),y=new ej.indicatorTypes[p],y.calculateSegment(u,this));for(l=0;l<this.model._visibleSeries.length;l++)for(y=this.model._visibleSeries[l],t=0;t<y.points.length;t++)typeof y.points[t].xValue=="string"&&y.points[t].xValue.indexOf("/Date(")!=-1&&(y.points[t].xValue=new Date(parseInt(y.points[t].xValue.substr(6))));this.model.hAxes=[];this.model.vAxes=[];var k=this,dt=!1,gt=!1;for(this._arrangeAxis(),this.model.crosshairLabelVisibility=!1,c=0;c<this.model._axes.length;c++){i=this.model._axes[c];this.model.crosshairLabelVisibility=i.crosshairLabel.visible||this.model.crosshairLabelVisibility;var h=[],tt=this.model.series.length,ni=this.model._axes[c].orientation.toLowerCase(),li=this.model._axes[c].rangePadding.toLowerCase();if(li=="auto")for(ni=="vertical"&&(i.rangePadding=this.model.requireInvertedAxes?"none":"normal"),ni=="horizontal"&&(i.rangePadding=this.model.requireInvertedAxes?"normal":"none"),e=0;e<tt;e++)if(p=this.model.series[e].type.toLowerCase(),p.indexOf("100")!=-1&&i.name==this.model.series[e]._yAxisName){i.rangePadding="round";break}for(d=0;d<i.stripLine.length;d++)i.stripLine[d]=$.extend(!0,{},this.model.stripLineDefault,i.stripLine[d]),i.stripLine[d].zIndex.toLowerCase()=="over"?dt=!0:gt=!0;for(b=i.orientation.toLowerCase(),ti=this.model._visibleSeries.length-1,e=0;e<this.model._visibleSeries.length;++e){ti-=1;r=this.model._visibleSeries[e];this.model._hasSeriesPoints=r.points.length>0||this.model._hasSeriesPoints;r.xAxisName||(r._xAxisName=k.model._axes[0].name);r.yAxisName||(r._yAxisName=k.model._axes[1].name);r._xAxisName=r._xAxisName?r._xAxisName:r.xAxisName?r.xAxisName:k.model._axes[0].name;r._yAxisName=r._yAxisName?r._yAxisName:r.yAxisName?r.yAxisName:k.model._axes[1].name;var ii=r._xAxisName.toLowerCase(),ri=r._yAxisName.toLowerCase(),ui=i.name.toLowerCase();if((ii||ri)&&(ii==ui||ri==ui)){if(b=="horizontal"&&i.valueType&&i.valueType.toString()=="datetime")for(l=0;l<r.points.length;l++)typeof r.points[l].xValue!="string"||isNaN(Date.parse(r.points[l].xValue))||(r.points[l].xValue=new Date(Date.parse(r.points[l].xValue)));else r._xAxisValueType!="string"||i.valueType||(i._valueType=b=="horizontal"&&!this.model.requireInvertedAxes?"category":b=="vertical"&&this.model.requireInvertedAxes?"category":"double"),r._xAxisValueType!="date"||i.valueType||(i._valueType=b=="horizontal"&&!this.model.requireInvertedAxes?"datetime":b=="vertical"&&this.model.requireInvertedAxes?"datetime":"double");this.model._visibleSeries[e].visibility.toLowerCase()=="visible"&&h.push(r)}}if(b==(this.model.requireInvertedAxes?"horizontal":"vertical")){var fi=!1,ei=!1,tt=h.length;for(i.isStacked100=h.length>0?!0:!1,t=0;t<tt;t++)p=h[t].type.toLowerCase(),ej.seriesTypes[p].prototype.stackingSeries||this.model.AreaType=="polaraxes"&&h[t].drawType.toLowerCase()=="column"&&h[t].isStacking?p.indexOf("100")==-1||fi?p.indexOf("100")!=-1||ei||(this._calculateStackingValues(h,i,f),ei=!0,i.isStacked100=!1):(this._calculateStackingCumulativeValues(h,i,f),fi=!0):i.isStacked100=!1}for(it=i.scrollbarSettings,it.visible&&(it.pointsLength!=null||it.range.min!=null||it.range.max!=null)&&(this.model.isLazyZooming=!0),i._valueType=i._valueType?i._valueType:i.valueType?i.valueType:"double",oi=new ej.axisTypes[i._valueType.toLowerCase()],rt=0;rt<h.length;rt++)for(ft=0;ft<h[rt].trendlines.length;ft++)if(h[rt].trendlines[ft].visibility=="visible"){this.model._drawTrendline=!0;break}oi._calculateRanges(k,i,h,f)}if(k._chartResize=!1,ht=$.extend({},ej.EjSvgRender.commonChartEventArgs),ht.data={axes:this.model._axes},this._trigger("axesLabelsInitialize",ht),this.model.isLazyZooming?0:this._updateScroll(),(this.svgHeight!=this.model.svgHeight||this.svgWidth!=this.model.svgWidth)&&(ct=ej.util.isNullOrUndefined(this.prevHeight)?this.svgHeight:this.prevHeight,lt=ej.util.isNullOrUndefined(this.prevWidth)?this.svgWidth:this.prevWidth,s=$.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={currentHeight:ct,currentWidth:lt,newHeight:this.model.svgHeight,newWidth:this.model.svgWidth},this._trigger("beforeResize",s),s.cancel?(this.model.enableCanvasRendering&&(this.svgRenderer.svgObj.width=s.data.currentWidth,this.svgRenderer.svgObj.height=s.data.currentHeight),this.model.svgWidth=s.data.currentWidth,this.model.svgHeight=s.data.currentHeight,$(this.svgObject).width(s.data.currentWidth),$(this.svgObject).height(s.data.currentHeight)):(this.model.enableCanvasRendering&&(this.svgRenderer.svgObj.width=s.data.newWidth,this.svgRenderer.svgObj.height=s.data.newHeight),this.model.svgWidth=s.data.newWidth,this.model.svgHeight=s.data.newHeight,$(this.svgObject).width(s.data.newWidth),$(this.svgObject).height(s.data.newHeight))),this._calculateAreaBounds(f),this.model.enable3D&&(g=new ej.Ej3DRender,this.vector=new g.vector3D,this.matrixobj=new g.matrix3D,this.bsptreeobj=new g.BSPTreeBuilder,this.polygon=new g.polygon3D,this.graphics=new g.Graphics3D,this.chart3D=this.svgRenderer.createGroup({id:this.svgObject.id+"_Chart3D"}),ej.Ej3DRender.Polygons=[]),this.model.AreaType!="none"){for(this._calculateAxisSize(f),t=0,nt=this.model._axes.length;t<nt;t++)this._validateCrossing(this.model._axes[t])&&this._axisCrossing(this.model._axes[t],!1,f);if(f._crossAxisOverlap){for(t=0,nt=this.model._axes.length;t<nt;t++)f.axes[this.model._axes[t].name]._validCross&&this._axisCrossing(this.model._axes[t],!0,f);f._crossAxisOverlap=!1}if(at=$.extend({},ej.EjSvgRender.commonChartEventArgs),at.data={areaBounds:this.model.m_AreaBounds},this._trigger("chartAreaBoundsCalculate",at),this._drawChartAreaRect(),this.model.title.text!=""&&this.model.title.text&&this.model.title.visible&&this._drawTitle(),this.gXaxisEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxis"}),this.gYaxisEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxis"}),this.gPolarAxisEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_AxisLine"}),this.model.enable3D?($.extend(ej.Ej3DAxisRenderer.prototype,this),this.chartaxis=new ej.Ej3DAxisRenderer(this)):($.extend(ej.EjAxisRenderer.prototype,this),this.chartaxis=new ej.EjAxisRenderer(this)),a=this.chartaxis,this.model.xAxisTitleRegion=[],this.model.yAxisTitleRegion=[],this.model.enable3D){for(o=0;o<this.model._axes.length;o++)a._drawAxes(o,this.model._axes[o],f);ej.Ej3DChart.prototype.update3DWall(this,f)}else for(o=0;o<this.model._axes.length;o++)a._drawGridLines(o,this.model._axes[o],f);this.model.requireInvertedAxes?(this.svgRenderer.append(this.gYaxisEle,this.svgObject),this.svgRenderer.append(this.gXaxisEle,this.svgObject)):(this.svgRenderer.append(this.gXaxisEle,this.svgObject),this.svgRenderer.append(this.gYaxisEle,this.svgObject));var ai=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.X,vi=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.Y,yi=this.model.AreaType=="polaraxes"?$(this.svgObject).width():this.model.m_AreaBounds.Width,pi=this.model.AreaType=="polaraxes"?$(this.svgObject).height():this.model.m_AreaBounds.Height,vt={id:this.svgObject.id+"_ChartAreaClipRect",x:ai,y:vi,width:yi,height:pi,fill:"white","stroke-width":1,stroke:"Gray"};this.svgRenderer.drawClipPath(vt,this.svgObject);this._setZoomProperties()}else this._drawChartAreaRect(),vt={id:this.svgObject.id+"_ChartAreaClipRect",x:0,y:0,width:$(this.svgObject).width(),height:$(this.svgObject).height(),fill:"white","stroke-width":1,stroke:"Gray"},this.svgRenderer.drawClipPath(vt,this.svgObject),this.model.title.text!=""&&this.model.title.text&&this.model.title.visible&&this._drawTitle();for(gt&&this.model.AreaType=="cartesianaxes"&&!this.model.enable3D&&(this.gStriplineBehind=this.svgRenderer.createGroup({id:this.svgObject.id+"_StriplineBehind","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"}),this._renderStripline("behind")),this.model.initSeriesRender&&(this.seriesRender(f),this.indicatorRender()),si=this.model.annotations.length,$("#annotation_group_"+this._id).empty(),ut=0;ut<si;ut++)yt=this.model.annotations[ut],yt.visible&&this.annotationRender(yt,ut);if(this.model.AreaType=="polaraxes"&&this.model._axes[1].visible&&!this.model.enable3D&&this.chartaxis._drawAxisLine(this.model._axes[1]),this.model.AreaType==="cartesianaxes"&&(this.model.requireInvertedAxes?(this.svgRenderer.append(this.gYaxisEle,this.svgObject),this.svgRenderer.append(this.gXaxisEle,this.svgObject)):(this.svgRenderer.append(this.gXaxisEle,this.svgObject),this.svgRenderer.append(this.gYaxisEle,this.svgObject)),this.gXaxisTickEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisTick"}),this.gYaxisTickEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTick"})),$.extend(ej.EjAxisRenderer.prototype,this),this.chartaxis=new ej.EjAxisRenderer(this),a=this.chartaxis,dt&&this.model.AreaType=="cartesianaxes"&&!this.model.enable3D&&(this.gStriplineOver=this.svgRenderer.createGroup({id:this.svgObject.id+"_StriplineOver","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"}),this._renderStripline("over")),!this.model.enable3D)for(o=0,nt=this.model._axes.length;o<nt;o++){var i=this.model._axes[o],et=f.axes[i.name]._lineOption,wi=f.axes[i.name]._validCross;this.model.AreaType.toLowerCase()=="cartesianaxes"&&(a._drawAxes(o,i),et[0]&&this.svgRenderer.drawLine(et[0],et[1]),i.orientation.toLowerCase()==="horizontal"?(a._drawXAxisTickLine(o,i,this.model.enableCanvasRendering?null:f.axes[i.name]._lineOption[1],f),a._drawXAxisMultiLevelLabels(o,i)):(a._drawYAxisTickLine(o,i,this.model.enableCanvasRendering?null:et[1],wi),a._drawYAxisMultiLevelLabels(o,i)),i._crossValue=null)}if(!this.resetZooming&&(this.model._chartAreaZoom||this.panning)&&this._enableZoomingButtons(),this.resetZooming=!1,(this.svgHeight!=this.model.svgHeight||this.svgWidth!=this.model.svgWidth)&&(this.prevHeight=this.model.svgHeight,this.prevWidth=this.model.svgWidth,s=$.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={height:this.prevHeight,width:this.prevWidth,prevHeight:ct,prevWidth:lt,originalHeight:this.svgHeight,originalWidth:this.svgWidth},this._trigger("afterResize",s)),h=this.model._visibleSeries,hi=$.grep(h,function(n){return n.selectionSettings.enable==!0}),hi.length==0?(this.model.selectionEnable=!1,this._removeSelection()):this.model.selectionEnable=!0,pt=this.remove_duplicates(this.model.selectedDataPointIndexes),this.model.selectionEnable)for(this._removeSelection(),this.model._isStateChaged=!0,ci=pt.length,t=0;t<ci;t++)w=pt[t],r=this.model._visibleSeries[w.seriesIndex],r&&(wt=r.selectionSettings.mode,(wt!="series"&&r.points[w.pointIndex]||wt=="series")&&this.segmentSelection(w.event,w.legendData,w.seriesIndex,w.pointIndex,w.data));this.chartUpdating=!1;bt=$.extend({},ej.EjSvgRender.commonChartEventArgs);bt.data={model:this.model};this._trigger("loaded",bt)},remove_duplicates:function(n){for(var i=[],r=[],e=n.length,u,f,o=this.model._visibleSeries,t=0;t<e;t++)f=o[n[t].seriesIndex],u=f?f.selectionSettings.mode:"",u=="series"?(i.indexOf(n[t].seriesIndex)>-1||r.push(n[t]),i.push(n[t].seriesIndex)):u=="cluster"?(i.indexOf(n[t].pointIndex)>-1||r.push(n[t]),i.push(n[t].pointIndex)):(n[t]in i||r.push(n[t]),i.push(n[t]));return r},_setZoomProperties:function(){for(var n,t,i,r,u=0;u<this.model._axes.length;u++)n=this.model._axes[u],r=n.orientation.toLowerCase(),t=n.zoomFactor.toFixed(3),i=n.zoomPosition.toFixed(3),r=="horizontal"&&(t!=this._xZoomFactor()||i!=this._xZoomPosition())&&(this._xZoomFactor(n.zoomFactor.toFixed(3)),this._xZoomPosition(n.zoomPosition.toFixed(3))),r=="vertical"&&(t!=this._yZoomFactor()||i!=this._yZoomPosition())&&(this._yZoomFactor(n.zoomFactor.toFixed(3)),this._yZoomPosition(n.zoomPosition.toFixed(3)))},annotationRender:function(n,t){var ft=this._id,p=!1,d=this.model.series[0],l=d.type.toLowerCase(),o=this.model.m_AreaBounds.X,h=this.model.m_AreaBounds.Y,tt=this.model.m_AreaBounds.Width,it=this.model.m_AreaBounds.Height,oi=this.model.margin.left,li=this.model.margin.top,ri=$.inArray(d,this.model._visibleSeries),et=this.model.circularRadius[ri],ot=this.model.circleCenterX[ri],st=this.model.circleCenterY[ri],si=$(document),ht,pt,wt,ui,hi,f,i,r,k,ct,fi,ei,ut,w,b,yt,v,nt,e,s,c,u,at;n=$.extend(!0,{},this.model.annotationsDefault,n);ht=$("#annotation_group_"+ft).length!=0?$("#annotation_group_"+ft):$("<div><\/div>").attr("id","annotation_group_"+ft);ht.css({position:"absolute",left:"0px",top:"0px"});pt=n.content;wt=$("#"+pt);wt.get(0).tagName=="SCRIPT"&&(wt=$($("#"+pt)[0].innerHTML));ui=wt.clone();hi="annotation_"+ft+"_"+pt+"_"+t;$(ui).attr("id",hi);f=$(ui);f.css({position:"absolute","z-index":2e3});var rt=n.region.toLowerCase(),vt=n.coordinateUnit.toLowerCase(),a=typeof n.x=="string"||typeof n.x=="object"?Date.parse(n.x):n.x,g=n.y,bt=n.horizontalAlignment.toLowerCase(),kt=n.verticalAlignment.toLowerCase();if(vt=="pixels")rt=="series"?tt+o+oi>a+o&&it+h+li>g+h&&(i=a+o,r=g+h):rt=="chart"&&$(this.svgObject).width()>a&&$(this.svgObject).height()>g&&(i=a,r=g),f.css({left:i,top:r}),p=!0;else if(vt=="points")if(point={x:a,y:g},this.model.AreaType=="polaraxes")w=this.model._axes[0],b=this.model._axes[1],a>=w.visibleRange.min&&a<=w.visibleRange.max&&g>=b.visibleRange.min&&g<=b.visibleRange.max&&(k=this.TransformToVisibleAnnotation(w,b,a,g,this),f.css({left:k.X,top:k.Y}),p=!0);else if(l=="pyramid"||l=="funnel")ct=d.points[a],f.css({left:ct.xLocation+this.pyrX,top:ct.yLocation+this.pyrY}),p=!0;else if(l=="pie"||l=="doughnut"||l=="pieofpie"){ct=d._visiblePoints[a];var ai=a,dt,gt,ci=new ej.seriesTypes[l],ni=ct?ct.currentMidAngle:0;(ai==d.explodeIndex||d.explodeAll)&&!chartObj.vmlRendering?(dt=ot+Math.cos(ni)*d.explodeOffset,gt=st+Math.sin(ni)*d.explodeOffset):(dt=ot,gt=st);fi=ci.getXCordinate(dt,et,ni);ei=ci.getYCordinate(gt,et,ni);positionX=(fi+dt)/2;positionY=(ei+gt)/2;positionX=(fi+positionX)/2;positionY=(ei+positionY)/2;f.css({left:positionX,top:positionY});p=!0}else{var vi=n.xAxisName,yi=n.yAxisName,pi=this.model._axes.length;for(ut=0;ut<pi;ut++)this.model._axes[ut].name==vi&&(w=this.model._axes[ut]),this.model._axes[ut].name==yi&&(b=this.model._axes[ut]);w||(w=this.model._axes[0]);b||(b=this.model._axes[1]);this.model.requireInvertedAxes?(point.x=point.y+(point.y=point.x,0),k=this._getAnnotationPoint(point,b,w),f.css({left:k.X+o,top:k.Y+w.y})):(k=this._getAnnotationPoint(point,w,b),f.css({left:k.X+o,top:k.Y+b.y}));p=!0}else{if(f.css("display","block").appendTo($(ht)),$(ht).appendTo("#chartContainer_"+ft),width=f.outerWidth(),height=f.outerHeight(),rt=="chart"){switch(bt){case"middle":i=$(this.svgObject).width()/2-width/2;break;case"left":i=0;break;case"right":i=$(this.svgObject).width()-width}switch(kt){case"middle":r=$(this.svgObject).height()/2-height/2;break;case"top":r=0;break;case"bottom":r=$(this.svgObject).height()-height}}else if(l=="pie"||l=="doughnut"||l=="pieofpie"){i=ot;r=st;switch(bt){case"middle":i=ot-width/2;break;case"left":i=ot-et;break;case"right":i=ot+et-width}switch(kt){case"middle":r=st-height/2;break;case"top":r=st-et;break;case"bottom":r=st+et}}else{switch(bt){case"middle":i=o+tt/2-width/2;break;case"left":i=o;break;case"right":i=o+tt-width}switch(kt){case"middle":r=h+it/2-height/2;break;case"top":r=h;break;case"bottom":r=h+it-height}}(l=="pyramid"||l=="funnel")&&(i-=oi);f.css({left:i,top:r})}if(i=parseFloat(f.css("left")),r=parseFloat(f.css("top")),vt!="none"&&p){f.css("display","block").appendTo($(ht));$(ht).appendTo("#chartContainer_"+ft);width=f.outerWidth();height=f.outerHeight();switch(bt){case"middle":i-=width/2;break;case"left":i-=width}switch(kt){case"middle":r-=height/2;break;case"top":r-=height}}yt=n.margin;i=i+yt.left-yt.right;r=r+yt.top-yt.bottom;commonEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs);commonEventArgs.data={content:f.html(),location:{x:i,y:r},opacity:n.opacity,angle:n.angle};this._trigger("annotationRendering",commonEventArgs);f.html(commonEventArgs.data.content);f.css({left:commonEventArgs.data.location.x,top:commonEventArgs.data.location.y,opacity:commonEventArgs.data.opacity});v=commonEventArgs.data.angle;v&&f.css({"-ms-transform":"rotate("+v+"deg)","-webkit-transform":"rotate("+v+"deg)","-moz-transform":"rotate("+v+"deg)","-o-transform":"rotate("+v+"deg)","-transform":"rotate("+v+"deg)"});var lt=f.attr("id"),y=u=s=e=0,ti=$("#"+this._id).width(),ii=$("#"+this._id).height();p&&v==0&&(rt=="series"||vt=="points")?(tt+o<i+width&&(nt=i+width-(tt+o),e=width-nt),i<o&&(s=o-i),it+h<r+height&&(c=r+height-(it+h),u=height-c),r<h&&(y=h-r),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)"):p&&v==0&&rt=="chart"?(ti<i+width&&(nt=i+width-ti,e=width-nt),i<0&&(s=width+i,s=s==0?width:s),ii<r+height&&(c=r+height-ii,u=height-c),r<0&&(y=height+r,y=y==0?height:y),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)"):p&&v==90&&(rt=="series"||vt=="points")?(at=document.getElementById(lt).getBoundingClientRect(),i=at.left-$(this.svgObject).offset().left+si.scrollLeft(),r=at.top-$(this.svgObject).offset().top+si.scrollTop(),it+h<r+width&&(nt=r+width-(it+h),e=width-nt),i<o&&(c=o-i,u=height-c),r<h&&(s=h-r),tt+o<i+height&&(c=i+height-(tt+o),y=c),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)"):p&&v==90&&rt=="chart"&&(at=document.getElementById(lt).getBoundingClientRect(),i=at.left-$(this.svgObject).offset().left,r=at.top-$(this.svgObject).offset().top,ii<r+width&&(nt=r+width-ii,e=width-nt),i<0&&(c=0-i,u=height-c,u=u==0?height:u),r<0&&(s=0-r,s=s==0?width:s),ti<i+height&&(c=i+height-ti,y=c),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)")},TransformToVisibleAnnotation:function(n,t,i,r,u){i=n._valueType=="logarithmic"&&i>0?Math.log(i,n.logBase):i;r=n._valueType=="logarithmic"&&r>0?Math.log(r,t.logBase):r;var f=u.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,r,this),e=ej.EjSvgRender.utils._valueToVector(n,i);return{X:u.model.centerX+f*e.X,Y:u.model.centerY+f*e.Y}},_getAnnotationPoint:function(n,t,i){var o=this.model.requireInvertedAxes,r=n.x,u=n.y,f=t._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(r==0?1:r,t.logBase):r,e=i._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(u==0?1:u,t.logBase):u;return f=ej.EjSvgRender.utils._getPointXY(f,t.visibleRange,t.isInversed)*t.width,e=(1-ej.EjSvgRender.utils._getPointXY(e,i.visibleRange,i.isInversed))*i.height,n.location={X:f,Y:e},n.location},indicatorRender:function(){var e,i,n,r,u,t,o,f,s;for($(this.svgObject).find("#"+this.svgObject.id+"_IndicatorCollection").length>0&&$(this.svgObject).find("#"+this.svgObject.id+"_IndicatorCollection").remove(),e={id:this.svgObject.id+"_IndicatorCollection","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.gIndicatorEle=this.svgRenderer.createGroup(e),i=0;i<this.model.indicators.length&&this.model.indicators[i].visible&&this.model.indicators[i]._points.length>0;i++){for(n=this.model.indicators[i],u=0;u<this.model._axes.length;u++)t=this.model._axes[u],t.name&&t.orientation.toLowerCase()=="horizontal"&&t.name.toLowerCase()==n.xAxisName.toLowerCase()?n.xAxis=t:t.name&&t.orientation.toLowerCase()=="vertical"&&t.name.toLowerCase()==n.yAxisName.toLowerCase()&&(n.yAxis=t);o=n.type.toLowerCase();r=new ej.indicatorTypes[o];this.model.enableCanvasRendering?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(this.model.m_AreaBounds.X,n.yAxis.y,n.xAxis.width,n.yAxis.height),this.svgRenderer.ctx.clip(),r.draw(n,this),this.svgRenderer.ctx.restore()):r.draw(n,this);f=r.gIndicatorGroupEle;f&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(f,n,this);this.vmlRendering||this.model.enableCanvasRendering||n.enableAnimation&&(!n._animatedSeries||n.type!=n._previousType)&&(this.svgRenderer.append(this.gIndicatorEle,this.svgObject),s=$(this.gIndicatorEle).find("#"+this.svgObject.id+"_indicatorGroup_"+i+"_ClipRect").children(),ej.EjSeriesRender.prototype._doLineAnimation(this,s),this.model.AnimationComplete=!0,n._animatedSeries=!0,n._previousType=n.type);this.svgRenderer.append(this.gIndicatorEle,this.svgObject)}},doAnimation:function(n){var i=this,ot=i.model,f=ot.requireInvertedAxes,st=n.type.toLowerCase(),l=$.inArray(n,ot._visibleSeries),a=this.svgObject.id+"_SeriesGroup_"+l,p=$(i.gSymbolGroupEle)[l].childNodes,w=p.length,it=$(i.gDataLabelEle)[l].childNodes,b=it.length,rt=$(i.gConnectorEle)[l].childNodes,ut=rt.length,ft=$(i.gErrorBarGroupEle)[l]==undefined?undefined:$(i.gErrorBarGroupEle)[l].childNodes,ht=ej.util.isNullOrUndefined(ft)?0:ft.length,o=n.animationType,k,d,et,g,nt,v,s,e,y,tt,ct=0,lt,h,u=ej.EjSeriesRender.prototype,c,r,t;i.gSeriesGroupEle=$("#"+a)[0];switch(o){case"rect":if(e=$(this.gSeriesEle).find("#"+a).children("rect"),y=e.length,st=="boxandwhisker"){for(et=$(this.gSeriesEle).find("#"+a).children("line"),g=$(this.gSeriesEle).find("#"+a).children("path"),d=2e3/g.length,c=0;c<et.length;c++)u._doLineSymbol(et[c],d,c,n,f,i),u._doLineSymbol(e[c],d,c,n,f,i);for(r=0;r<g.length;r++)u._doLineSymbol(g[r],d,r,n,f,i)}else for(t=0;t<y;t++)st.indexOf("stacking")>-1?u.animateStackingRect(e[t],n,f,i):u.animateRect(e[t],n,f,i);nt=v=k=500;break;case"path":tt=$(i.gSeriesEle).find("#"+a+"_ClipRect").children();u._doLineAnimation(i,tt);nt=2e3/w;v=2e3/b;k=2e3/ht;break;case"scatter":for(t=0;t<w;t++)lt=Math.floor(Math.random()*(20-ct)+ct),h=parseInt(lt*50),u.animateSymbol(p[t],h,n,f,i);break;case"bubble":for(e=$(this.gSeriesGroupEle).children().not("defs"),h=0,t=0;t<e.length;t++)u.animateSymbol(e[t],h,n,f,i);for(t=0;t<w;t++)u.animateSymbol(p[t],h,n,f,i);for(t=0;t<b;t++)u.animateSymbol(it[t],h,n,f,i);for(t=0;t<ut;t++)u.animateSymbol(rt[t],h,n,f,i);break;case"hilo":for(e=$(this.gSeriesGroupEle).children().not("defs"),y=e.length,time=2e3/y,t=0;t<y;t++)u._doLineSymbol(e[t],time,t,n,f,i);v=2e3/b;break;case"cylinder":tt=$(i.gSeriesEle).find("#"+a+"_ClipRect").children();u.animateCylinder(i,n,f,tt);nt=v=k=500}if(o!="bubble"){for(r=0;r<w;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(p[r],nt,s,n,f,i);for(r=0;r<b;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(it[r],v,s,n,f,i);for(time=2e3/ut,r=0;r<ut;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(rt[r],time,s,n,f,i)}if(n.errorBar.visibility=="visible")for(r=0;r<ht;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(ft[r],k,s,n,f,i)},_animationElements:function(n,t,i){var r=this,f,u;if(n._previousType=ej.util.isNullOrUndefined(n._previousType)?n.type:n._previousType,!n.enableAnimation||this.vmlRendering||this.model.enableCanvasRendering||n._animatedSeries&&n.type==n._previousType||(ej.EjSeriesRender.prototype.doCircularAnimation(this,n,t,i),n._previousType=n.type,n._animatedSeries=r.isSplitted?!1:!0),r.isSplitted=!1,this.drawAccDisplayText(t,n,i),n.enableAnimation&&n._visiblePoints.length>0&&n.AnimationComplete&&!this.vmlRendering&&!this.model.enableCanvasRendering){if(r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gSeriesTextEle[i].id),{visibility:"visible"}),r.gSymbolGroupEle&&r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gSymbolGroupEle[i].id),{visibility:"visible"}),n.marker.dataLabel.template)for(f=$(r.element[0].childNodes[0].childNodes),u=0;u<f.length;u++)$(f[u]).css("display","block");r.gConnectorEle&&r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gConnectorEle[i].id),{visibility:"visible"});r.gDataLabelEle&&r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gDataLabelEle[i].id),{visibility:"visible"})}},_appendConnectorElements:function(n){var i=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),t=i[n],r=t.type.toLowerCase();t.visibility=="visible"&&!this.model.enable3D&&t.connectorLine&&(t.connectorLines||this.model.AreaType=="none")&&(this.svgRenderer.append(this.gConnectorEle[n],this.gSeriesEle),t.connectorLines=!1)},_appendDataLabelElement:function(n){var t,i;t=this.model._visibleSeries[n];i=ej.util.isNullOrUndefined(t.zOrder)?i:t.zOrder;t.visibility!="visible"||this.model.enable3D||(this.svgRenderer.append(this.gSymbolGroupEle[n],this.gSeriesEle),this.model.enable3D||this.model.enableCanvasRendering||(this.gDataLabelEle[n].childNodes.length>0&&this.svgRenderer.append(this.gDataLabelEle[n],this.gSeriesEle),this.gSeriesTextEle[n].childNodes.length>0&&this.svgRenderer.append(this.gSeriesTextEle[n],this.gSeriesEle)));this.vmlRendering||t.visibility!="visible"||this.model.enableCanvasRendering||this.model.enable3D||(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element))},_accSeriesDraw:function(n,t,i){var e=this,r=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),o=$.inArray(r[n],this.model._visibleSeries),u,f,s;this.model._visibleSeries[o]=r[n]=$.extend(!0,t,r[n]);u=$.extend({},ej.EjSvgRender.commonChartEventArgs);u.data={series:t};this._trigger("seriesRendering",u);f=new ej.seriesTypes[i.toLowerCase()];s=f.draw(e,t);s||(this.model.minhightwidth=!0,e._animationElements(t,f,o))},_splitSeries:function(n){var t=[],e,i,h,r,p;t[0]=$.extend(!0,[],n._visiblePoints);t[1]=[];for(var f=n,c=parseInt(f.splitValue),s=f.splitMode.toLowerCase(),l=t[0].length,u=0,o=0,a=[],r=0,v=0,y;r!=l;)v+=t[0][r].y,r++;if(s=="position"){for(r=l-1;r>=0&&o!=c;r--)u=u+t[0][r].y,t[1][o]=t[0][r],o++,t[0].splice(r,1);t[1].reverse()}else if(s=="value"||s=="percentage")for(i=0;i<t[0].length;i++)y=s=="value"?t[0][i].y:Math.round(t[0][i].y/v*100),y<c&&(u=u+t[0][i].y,t[1][o]=t[0][i],o++,t[0].splice(i,1),i=-1);else if(s=="indexes"){for(e=JSON.parse("["+f.splitValue+"]"),e=e.filter(function(n,t,i){return i.indexOf(n)==t}),e.sort(),i=0;i<t[0].length;i++)for(h=0;h<e.length;h++)i==e[h]&&(u=u+t[0][i].y,t[1][o]=t[0][i],o++);for(r=0;r<e.length;r++)p=e[r]-r,t[0].splice(p,1)}t[1].length>0&&(a[0]=u,valueType=f._xAxisValueType,t[0].unshift({_visibility:"visible",visible:!0,text:"Others",x:valueType=="string"?"Others":u,xValue:valueType=="string"?f.points.length:u,y:u,YValues:a,fill:this.model.colors[(f.points.length+1)%this.model.colors.length],isFill:!1,actualIndex:f.points.length}));this.isSplitted=!0;f.pieCollections=t},_calculateGapWidth:function(n){var o=0,s=0,r,u,h,c=.1*Math.min($(this.svgObject).width(),$(this.svgObject).width()),t,i,f,e;for(ej.EjSeriesRender.prototype._calculateVisiblePoints(n).visiblePoints,this._splitSeries(n),this.chartObj=this,t=0;t<2;t++)r=t==0?n.pieCoefficient:n.pieOfPieCoefficient,n._visiblePoints=n.pieCollections[t],n.collectionIndex=t,h=n.gapWidth,i=ej.EjSeriesRender.prototype.calculatingSliceAngle(n,this.chartObj),f=i.width<c?.25*r*c:.25*r*Math.min(i.width,i.height),u=this.model.circleCenterX[t],t==0?o=u+f:s=u-f;return e=s-o-h,this.model.pieGapWidth=e>0?e:0,n.pieCollections[0].length>0&&n.pieCollections[1].length>0&&n.connectorLine.width>0&&this.drawPieofPieConnectors(i,n),n},seriesRender:function(n){var u,v,y,tt,gt,rt,it,ut,w,yt,pt,wt,bt,h,t,ni,ct,ti,g,e,s,b,r,st,ft,et,ii,kt,f,a,ri,k,ui,o,c,dt,fi,lt,ei,p,at,i,vt,si,hi;if(this.model.allPoints=[],this.model.markerRegion=[],this.model.circleCenterX=[],this.model.circleCenterY=[],this.model.startX=[],this.model.startY=[],this.model.centerCount=0,this.gTrendlinesGroupEle=null,!n)for(n={_crossAxisOverlap:!1,axes:{}},i=0;i<this.model._axes.length;i++)n.axes[this.model._axes[i].name]={};u=this;$(this.svgObject).find("#"+this.svgObject.id+"_SeriesCollection").length>0&&$(this.svgObject).find("#"+this.svgObject.id+"_SeriesCollection").remove();var ci={id:this.svgObject.id+"_SeriesCollection","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},nt=this.model.enable3D,d=this.model.AreaType,ot=this.model.enableCanvasRendering,li=this.model._axes.length;for(this.gSeriesEle=this.svgRenderer.createGroup(ci),f=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),v=f.length,i=0;i<v;i++)if(f[i].visibility=="visible")for(this.model.series[i]._enableSmartLabels=ej.util.isNullOrUndefined(this.model.series[i].enableSmartLabels)?this.model.AreaType=="none"?!0:!1:this.model.series[i].enableSmartLabels,ej.util.isNullOrUndefined(f[i].xAxis)||(f[i].xAxis=null,f[i].yAxis=null),c=0;c<li;c++){var l=this.model._axes[c],st=i,ht=l.orientation.toLowerCase();l.name&&ht=="horizontal"&&l.name.toLowerCase()==f[i]._xAxisName.toLowerCase()?f[i].xAxis=l:l.name&&ht=="vertical"&&l.name.toLowerCase()==f[i]._yAxisName.toLowerCase()&&(f[i].yAxis=l);this.model.requireInvertedAxes&&(l.name&&ht=="vertical"&&l.name.toLowerCase()==f[i]._xAxisName.toLowerCase()?f[i].xAxis=l:l.name&&ht=="horizontal"&&l.name.toLowerCase()==f[i]._yAxisName.toLowerCase()&&(f[i].yAxis=l))}if(v>0){var r=f[0],gt=r.type.toLowerCase(),ai=r.visibility.toLowerCase();if(gt!="pieofpie"||ai!="visible"||nt)for(rt=v;rt>0&&d=="none";rt--)st=rt-1,y=f[rt-1],tt=y.visibility.toLowerCase(),e=y.type.toLowerCase(),tt!=="visible"||nt||e!="pie"&&e!="doughnut"?d!="none"||tt!=="visible"||ot||ej.Ej3DChart.prototype.renderSeries(this,y):this._accSeriesDraw(st,y,e);else{for(this.model._isPieOfPie=!0,r=this._calculateGapWidth(r),a=0;a<2;a++)r.collectionIndex=a,r._visiblePoints=r.pieCollections[a],this._accSeriesDraw(0,r,gt);r._visiblePoints=$.merge(r.pieCollections[0],r.pieCollections[1]);this.model.pieGapWidth=null;r.collectionIndex=0}}for(it=0;it<v;it++){var st=it,y=f[it],tt=y.visibility.toLowerCase(),e=y.type.toLowerCase();d!="none"||tt!=="visible"||nt||st!==0||e!="pyramid"&&e!="funnel"?tt!=="visible"||nt||d=="none"?nt||d=="none"?d!="cartesianaxes"||tt!=="visible"||ot||ej.Ej3DChart.prototype.renderSeries(this,y,n):this.svgRenderer.append(this.svgObject,this.element):(this.renderSeries(y,n),d=="cartesianaxes"&&this.model.series[it].type!="boxandwhisker"&&this._renderTrendline(u,y)):this._accSeriesDraw(st,y,e)}if(this.model.AreaType!="none"){for(yt=this.model.enableCanvasRendering,pt=this.model.m_AreaBounds,i=0;i<v;i++)if(r=this.model.series[i],ut=r._visiblePoints,r._enableSmartLabels&&this.model.AreaType=="cartesianaxes")for(w=r.type.toLowerCase(),w=="column"||w=="stackingcolumn"||w=="bar"||w=="stackingbar"||w=="waterfall"||w=="stackingbar100"||w=="stackingcolumn100"||w=="rangecolumn"?this.cartesianColumnSmartLabels(r,ut,i):w!="boxandwhisker"&&this.cartesianSmartLabels(r,ut,i),c=0;c<ut.length;c++)t=ut[c],t.hide=!1,wt=yt?t.xPos-this.canvasX:t.xPos,bt=yt?t.yPos-this.canvasY:t.yPos,(wt-t.width/2<0||wt+t.width/2>pt.Width||bt+t.height/2>pt.Height||bt-t.height/2<0)&&(t.hide=!0);for(g=u.model.m_AreaBounds.X,i=0;i<v;i++)if(r=f[i],r.visibility=="visible")for(ct=r._visiblePoints.length,h=0;h<ct;h++)t=r._visiblePoints[h],ni=t.marker&&t.marker.dataLabel&&t.marker.dataLabel.visible,(r.marker.dataLabel.visible||ni)&&(!(t.connectorFlag||t.newConnectorFlag)||t.hide||t.drawText==""||r.visibility!="visible"||ej.util.isNullOrUndefined(t.textOptions)||(r.connectorLine=!0,u.model.enableCanvasRendering?(u.svgRenderer.ctx.save(),u.model.requireInvertedAxes?u.svgRenderer.ctx.rect(g+r.yAxis.plotOffset,r.xAxis.y,r.yAxis.width,r.xAxis.height):u.svgRenderer.ctx.rect(g,r.yAxis.y,r.xAxis.width,r.yAxis.height),u.svgRenderer.ctx.clip(),this.drawConnectorLines(i,h,t),u.svgRenderer.ctx.restore()):r._enableSmartLabels&&this.drawConnectorLines(i,h,t)));for(g=u.model.m_AreaBounds.X,i=0;i<v;i++)if(r=f[i],e=r.type.toLowerCase(),r.visibility=="visible"&&!this.model.enable3D)for(ct=r._visiblePoints.length,h=0;h<ct;h++)if(t=r._visiblePoints[h],ti=t.marker&&t.marker.dataLabel&&t.marker.dataLabel.visible,(r.marker.dataLabel.visible||ti)&&!t.hide&&!t.dataLabeltemplate&&r.visibility=="visible"&&!ej.util.isNullOrUndefined(t.textOptions)&&!t.hide){if(t.textOptions.transform="rotate("+t.textOptions.angle+","+t.xPos+","+t.yPos+")",t.textOptions.labelRotation=t.textOptions.angle,u.model.enableCanvasRendering){if(u.svgRenderer.ctx.save(),u.model.requireInvertedAxes?u.svgRenderer.ctx.rect(g+r.yAxis.plotOffset,r.xAxis.y,r.yAxis.width,r.xAxis.height):u.svgRenderer.ctx.rect(g,r.yAxis.y,r.xAxis.width,r.yAxis.height),u.svgRenderer.ctx.save(),u.svgRenderer.ctx.clip(),e.toLowerCase()=="boxandwhisker")for(r.showMedian==!0&&t.textOptionsBoxValues!=""&&(ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[0].xPos,t.textOptionsBoxValues[0].yPos,t.textOptionsBoxValues[0].width,t.textOptionsBoxValues[0].height,t.textOptionsBoxValues[0].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[0],t.textOptionsBoxValues[0].drawText,this.gSeriesTextEle[i])),s=1;s<t.textOptionsBoxValues.length;s++)ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[s].xPos,t.textOptionsBoxValues[s].yPos,t.textOptionsBoxValues[s].width,t.textOptionsBoxValues[s].height,t.textOptionsBoxValues[s].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[s],t.textOptionsBoxValues[s].drawText,this.gSeriesTextEle[i]);else ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPos,t.yPos,t.width,t.height,t.symbolName,this),this.svgRenderer.drawText(t.textOptions,t.drawText,this.gSeriesTextEle);u.svgRenderer.ctx.restore()}else ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPos,t.yPos,t.width,t.height,t.symbolName,this,this.gDataLabelEle[i]),this.svgRenderer.drawText(t.textOptions,t.drawText,this.gSeriesTextEle[i]);if(e=="rangecolumn"||e=="rangearea")t.textOptionsLow.transform="rotate("+t.textOptionsLow.angle+","+t.xPosLow+","+t.yPosLow+")",t.textOptionsLow.labelRotation=t.textOptionsLow.angle,u.model.enableCanvasRendering?(u.svgRenderer.ctx.save(),u.model.requireInvertedAxes?u.svgRenderer.ctx.rect(g+r.yAxis.plotOffset,r.xAxis.y,r.yAxis.width,r.xAxis.height):u.svgRenderer.ctx.rect(g,r.yAxis.y,r.xAxis.width,r.yAxis.height),u.svgRenderer.ctx.clip(),ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPosLow,t.yPosLow,t.widthLow,t.heightLow,t.symbolName,this),this.svgRenderer.drawText(t.textOptionsLow,t.drawTextLow,this.gSeriesTextEle),u.svgRenderer.ctx.restore()):(ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPosLow,t.yPosLow,t.widthLow,t.heightLow,t.symbolName,this,this.gDataLabelEle[i]),this.svgRenderer.drawText(t.textOptionsLow,t.drawTextLow,this.gSeriesTextEle[i]));else if(e.toLowerCase()=="boxandwhisker")for(r.showMedian==!0&&t.textOptionsBoxValues!=""&&(ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[0].xPos,t.textOptionsBoxValues[0].yPos,t.textOptionsBoxValues[0].width,t.textOptionsBoxValues[0].height,t.textOptionsBoxValues[0].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[0],t.textOptionsBoxValues[0].drawText,this.gSeriesTextEle[i])),s=1;s<t.textOptionsBoxValues.length;s++)ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[s].xPos,t.textOptionsBoxValues[s].yPos,t.textOptionsBoxValues[s].width,t.textOptionsBoxValues[s].height,t.textOptionsBoxValues[s].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[s],t.textOptionsBoxValues[s].drawText,this.gSeriesTextEle[i])}if(this.model.AreaType!="none"){for(i=0;i<v;i++)this._appendConnectorElements(i);for(p=this.model._visibleSeries.length,i=0;i<p;i++)this._appendDataLabelElement(i)}}else{for(b=v-1;b>=0;b--)r=this.model._visibleSeries[b],e=r.type.toLowerCase(),(e=="pie"||e=="doughnut")&&this.model.minhightwidth&&this._appendConnectorElements(b);if(p=this.model._visibleSeries.length,p>0&&e=="pieofpie")this._appendDataLabelElement(0);else for(b=v-1;b>=0;b--)r=this.model._visibleSeries[b],e=r.type.toLowerCase(),(e=="pie"||e=="doughnut")&&this.model.minhightwidth&&this._appendDataLabelElement(b)}for(p=this.model._visibleSeries.length,ft=0;ft<p;ft++)o=this.model._visibleSeries[ft],e=o.type.toLowerCase(),o._previousType=ej.util.isNullOrUndefined(o._previousType)?o.type:o._previousType,this.vmlRendering||o.visibility!="visible"||this.model.enableCanvasRendering||this.model.enable3D||this.model.AreaType=="none"||(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element),et=new ej.seriesTypes[o.type.toLowerCase()],et.chartObj=u,et.gSeriesGroupEle=$("#"+this.svgObject.id+"_SeriesGroup_"+ft)[0],o.enableAnimation&&(!o._animatedSeries||o._previousType!=o.type)&&this.model.AreaType!="none"&&(o._animatedSeries=!0,o._previousType=o.type,ii=$("#template_group_"+this._id),kt=o.marker.dataLabel,ii.children().length!=0&&kt.visible&&kt.template&&et.animateLabelTemplate(o),e=="polar"||e=="radar"?ej.ejRadarSeries.prototype.doAnimation(o,et):this.doAnimation(o)));if(f=this.model._visibleSeries,p=f.length,!this.model.enableCanvasRendering&&!this.model.enable3D)for(a=0;a<p;a++)f[a].visibility.toLowerCase()=="visible"&&this.gTrendlinesGroupEle&&this.gTrendlinesGroupEle[a]&&this.gTrendlinesGroupEle[a].childElementCount!=0&&this.svgRenderer.append(this.gTrendlinesGroupEle[a],this.svgObject);for(i=0;i<p;i++)for(r=this.model._visibleSeries[i],ri=r.trendlines,dt=r.trendlines.length,c=0;c<dt;c++)k=ri[c],k.visibility&&(ui=k.type.toLowerCase(),o=new ej.trendlineTypes[ui],k.visibility.toLowerCase()==="visible"&&k.points&&k.points.length>1&&r.enableAnimation&&!this.vmlRendering&&(!r._animatedTrendline||k._previousType!=k.type)&&(k._previousType=k.type,fi=$(this.svgObject).find("#"+this.svgObject.id+"_TrendGroup_"+i+"_"+c+"_ClipRect").children(),ej.EjSeriesRender.prototype._doLineAnimation(this,fi),r._animatedTrendline=dt-1==i?!0:!1));for(p=this.model._visibleSeries.length,at=this.svgObject.id,i=0;i<p;i++){var lt=$("#"+at+"_SeriesGroup_"+i),oi=$("#"+at+"_SeriesGroup_waterfallLine_"+i),ei=$("#"+at+"_symbolGroup_"+i);lt.length>0&&ei.length>0&&ei.insertAfter(lt);lt.length>0&&oi.length>0&&oi.insertAfter(lt)}this.model.AnimationComplete=!0;vt=$.extend({},ej.EjSvgRender.commonChartEventArgs);vt.data={series:o};this._trigger("animationComplete",vt);ot&&(this.svgRenderer.append(this.svgObject,this.element),this.panning&&$("#"+this._id+"_canvas").css({cursor:"pointer"}));nt&&!ot&&(this.svgRenderer.append(this.chart3D,this.svgObject),si={Width:$(this.svgObject).width(),Height:$(this.svgObject).height()},this.graphics.prepareView(this.model.perspectiveAngle,this.model.depth,this.model.rotation,this.model.tilt,si,this),this.graphics.view(this.svgObject,this),this.svgRenderer.append(this.svgObject,this.element));this.svgRenderer.vmlNamespace&&this.svgRenderer.append(this.gSeriesEle,this.svgObject);d=="polaraxes"&&this.svgRenderer.append(this.gPolarAxisEle,this.svgObject);$(this.svgObject).find("#"+this.svgObject.id+"_StriplineOver").length>0&&(hi=$(this.svgObject).find("#"+this.svgObject.id+"_StriplineOver").detach(),hi.appendTo(this.svgObject));this._renderScrollbar();this.legendRender.drawLegend(n);u.model.initSeriesRender=!0},_calculateZoomValue:function(n,t,i,r){var l=this.model,o,s,h,u,f,e=i.scrollbarSettings.range,c=i._valueType.toLowerCase();c=="datetime"?(u=Date.parse(ej.util.isNullOrUndefined(e.min)?n:new Date(e.min)),f=Date.parse(ej.util.isNullOrUndefined(e.max)?t:new Date(e.max))):(u=parseFloat(ej.util.isNullOrUndefined(e.min)?n:e.min),f=parseFloat(ej.util.isNullOrUndefined(e.max)?t:e.max));u=Math.min(u,n);f=Math.max(f,t);o=f-u;r.isRTL?(s=(f-t)/o,h=(t-n)/o):(s=(n-u)/o,h=(t-n)/o);r.scrollRange={min:u,max:f,delta:f-u};r._previousStart=n;r._previousEnd=t;r.zoomPosition=s;r.zoomFactor=h},_renderScrollbar:function(){var r=this.model,y=r.scrollerSize,g=$("#"+this._id).offset(),b=$(this.svgObject).offset().left-g.left,p,e,i,o,s,l,k=r._axes,nt=k.length,w,tt=r.zooming.enableScrollbar,f,it=r.AreaType,u,h,a,d,t,c,n,v;for(r.scrollObj=r.scrollObj?r.scrollObj:[],n=0;n<nt;n++)i=k[n],valueType=i._valueType,u=i.scrollbarSettings,f=u.range,w=i.isInversed,isZoomAble=it=="cartesianaxes"&&!r.enable3D,l=i._opposed,h=u.pointsLength,c=i.orientation.toLowerCase(),o=i.zoomFactor,a=$("#scrollbar_"+this.axisScroll[0].id+n).length,s=i.zoomPosition,isZoomAble&&(i._isScroll&&r.isLazyZooming||(o<1||s>0)&&tt)?(e=i.x+(c=="vertical"?-y+(l?y:0):0)+(b<=0?0:b),p=i.y+(c=="horizontal"?i.height+(l?-y:0):0),posY=p-(c=="horizontal"?0:i.plotOffset),width=i.plotOffset+(c=="horizontal"?i.width:i.height),t=r.scrollObj,isRedraw=f.min!=null||f.max!=null?t[n]?t[n].actualRange.min!=f.min||t[n].actualRange.max!=f.max:!1:t[n]?t[n].actualRange!=u.pointsLength:!1,this.scrollDraw=t[n]?t[n].x!=e||t[n].y!=p||t[n].width!=width:this.scrollDraw,v={orientation:i.orientation,index:n,width:width,x:e,y:posY,opposed:l,isRTL:w,parent:this.axisScroll,enableResize:u.canResize},r.isLazyZooming?(a==0||this.scrollDraw||isRedraw)&&($("#scrollbar_"+this.axisScroll[0].id+n).remove(),f.min!=null||f.max!=null?(d=t[n]&&t[n].scrollRange?t[n].scrollRange:i.visibleRange,!this.scrollDraw||isRedraw?(t[n]={isVirtual:!0,valueType:valueType,scrollRange:d},t[n].actualRange=$.extend(t[n].actualRange,u.range),$.extend(t[n],v),valueType=="datetime"?(t[n].startDateTime=new Date(i.visibleRange.min),t[n].endDateTime=new Date(i.visibleRange.max)):(t[n].startValue=i.visibleRange.min,t[n].endValue=i.visibleRange.max),this._calculateZoomValue(i.visibleRange.min,i.visibleRange.max,i,this.model.scrollObj[n])):(t[n].width=width,t[n].x=e,t[n].y=posY)):h>=i.maxPointLength&&(o=i.maxPointLength/h,s=w?1-i.zoomPosition:i.zoomPosition,!this.scrollDraw||isRedraw?(t[n]={isVirtual:!0,zoomPosition:s,zoomFactor:o,scrollRange:{min:0,max:h-1,delta:h-1},valueType:"double"},t[n].actualRange=u.pointsLength,$.extend(t[n],v),t[n].startValue=0,t[n].endValue=i.maxPointLength):(t[n].width=width,t[n].x=e,t[n].y=posY)),this.model.scrollObj[n]&&(this.scrollbarContainer=new ej.EjSvgScrollbarRender(this.axisScroll,this.model.scrollObj[n]),this.scrollbarContainer._initializeScrollbarVariables(this.model.scrollObj[n]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[n]))):u.visible&&(t=r.scrollObj,(a==0||this.scrollDraw)&&($("#scrollbar_"+this.axisScroll[0].id+n).remove(),t[n]={zoomPosition:s,zoomFactor:o,valueType:valueType,scrollRange:i.actualRange,isZooming:!0},$.extend(t[n],v),t[n].valueType=="datetime"?(t[n].startDateTime=new Date(t[n].scrollRange.min),t[n].endDateTime=new Date(t[n].scrollRange.max)):(t[n].startValue=t[n].scrollRange.min,t[n].endValue=t[n].scrollRange.max),this.scrollbarContainer=new ej.EjSvgScrollbarRender(this.axisScroll,this.model.scrollObj[n]),this.scrollbarContainer._initializeScrollbarVariables(this.model.scrollObj[n]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[n])))):a>0&&$("#scrollbar_"+this.axisScroll[0].id+n).remove();this.scrollDraw=!1},_renderTrendline:function(n,t){var f=$.inArray(t,n.model.series),g=n.model.requireInvertedAxes?t.yAxis.x:t.xAxis.x,nt=n.model.requireInvertedAxes?t.xAxis.y:t.yAxis.y,tt="translate("+g+","+nt+")",it={id:n.svgObject.id+"_TrendlinesGroup_"+f,"clip-path":"url(#"+n.svgObject.id+"_TrendlinesGroup_"+f+"_ClipRect)"},p=t.trendlines,e,c,l,w,a,i,u,o,s,h,r="",rt=p.length,b,v,y,k,d;for(n.gTrendlinesGroupEle||(n.gTrendlinesGroupEle=[]),n.gTrendlinesGroupEle[f]=n.svgRenderer.createGroup(it),u=0;u<rt;u++)if(i=p[u],i.seriesIndex=f,i.isTrendLine=!0,i.trendlineIndex=u,i.visibility.toLowerCase()==="visible"&&!i.isNull&&i.points&&i.points.length>1){b={id:n.svgObject.id+"_TrendGroup_"+f+"_"+u,transform:tt,"clip-path":"url(#"+n.svgObject.id+"_TrendGroup_"+f+"_"+u+"_ClipRect)"};t.gTrendGroupEle=null;t.gTrendGroupEle=n.svgRenderer.createGroup(b);v=i.type.toLowerCase();a=new ej.trendlineTypes[v];o=i.slope;s=i._intercept;switch(v){case"linear":r="y = "+o.toFixed(4)+"x + "+s.toFixed(4);break;case"exponential":r="y = "+s.toFixed(3)+"e^"+o.toFixed(4)+"x";break;case"logarithmic":r="y = "+o.toFixed(3)+"ln(x) + "+s.toFixed(4);break;case"power":r="y = "+s.toFixed(3)+"x^"+o.toFixed(4);break;case"polynomial":for(l=i.polynomialSlopes,w=l.length,r="y = ",e=w-1;e>=0;e--)h=l[e],r+=h>0?"+"+h:"-"+Math.abs(h),e!=0&&(r+="x^"+e+" ")}i.equation=r;y=$.extend({},ej.EjSvgRender.commonChartEventArgs);k=i.points[0];d=i.points[i.points.length-1];y.data={series:t,trendline:i,forwardForecastPoints:d,backwardForecastPoints:k};this._trigger("trendlineRendering",y);n.model.enableCanvasRendering?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(n.model.m_AreaBounds.X,t.yAxis.y,t.xAxis.width,t.yAxis.height),this.svgRenderer.ctx.clip(),this.svgRenderer.ctx.beginPath(),a.draw(i,t,n),this.svgRenderer.ctx.restore()):(a.draw(i,t,n),c=t.gTrendGroupEle,c&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(c,t,this))}},_renderStripline:function(n){var u,i,r,t;for($.extend(ej.EjStripline.prototype,this),this.chartstripline=new ej.EjStripline(this),u=this.chartstripline,this.model._stripeline=!1,i=0;i<this.model._axes.length;i++)for(r=this.model._axes[i],t=0;t<r.stripLine.length;t++)r.stripLine[t].zIndex.toLowerCase()==n&&u._drawStripline(r,r.stripLine[t],i,t);n=="over"&&this.model._stripeline?this.svgRenderer.append(this.gStriplineOver,this.svgObject):this.model._stripeline&&this.svgRenderer.append(this.gStriplineBehind,this.svgObject)},renderSeries:function(n,t){for(var a,w,b,k,v,e,f,y,d,r,tt,it=this,i=$.inArray(n,this.model._visibleSeries),o=0;o<n.points.length;o++)typeof n.points[o].x=="string"&&n.points[o].x.indexOf("/Date(")!=-1&&(n.points[o].x=new Date(parseInt(n.points[o].x.substr(6))));n.xAxis=n.xAxis===null||n.xAxis===undefined?this.model._axes[0]:n.xAxis;n.yAxis=n.yAxis===null||n.yAxis===undefined?this.model._axes[1]:n.yAxis;var u=n.type.toLowerCase(),g=n.drawType.toLowerCase(),p,f=null,s;if(this.model.AreaType=="cartesianaxes"?(a=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),f="translate("+a.x+","+a.y+")",s="visible"):s=n.enableAnimation&&!n._animatedSeries?"hidden":"visible",w={id:this.svgObject.id+"_TextGroup_"+i,transform:f,visibility:s},b={id:this.svgObject.id+"_DataLabel_"+i,transform:f,visibility:s},p=u!="scatter"?{id:this.svgObject.id+"_symbolGroup_"+i,transform:f,visibility:s}:{id:this.svgObject.id+"_SeriesGroup_"+i,transform:f},k={id:this.svgObject.id+"_ConnectorGroup_"+i,transform:f,visibility:s},this.gSymbolGroupEle||(this.gSymbolGroupEle=[]),this.gSymbolGroupEle[i]=this.svgRenderer.createGroup(p),this.gSeriesTextEle||(this.gSeriesTextEle=[]),this.gSeriesTextEle[i]=this.svgRenderer.createGroup(w),this.gConnectorEle||(this.gConnectorEle=[]),this.gConnectorEle[i]=this.svgRenderer.createGroup(k),this.gDataLabelEle||(this.gDataLabelEle=[]),this.gDataLabelEle[i]=this.svgRenderer.createGroup(b),v=$.extend({},ej.EjSvgRender.commonChartEventArgs),v.data={series:n},this._trigger("seriesRendering",v),e=new ej.seriesTypes[u],this.model.enableCanvasRendering&&this.model.AreaType!="none"?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.model.requireInvertedAxes?(f=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),this.canvasX=f.x,this.canvasY=f.y,this.svgRenderer.ctx.rect(n.yAxis.x,n.xAxis.y,n.yAxis.width,n.xAxis.height)):(this.canvasX=n.xAxis.x,this.canvasY=n.yAxis.y,this.svgRenderer.ctx.rect(n.xAxis.x,n.yAxis.y,n.xAxis.width,n.yAxis.height)),this.svgRenderer.ctx.clip(),e.draw(this,n,t),this.svgRenderer.ctx.restore()):this.model.enableCanvasRendering&&this.model.AreaType=="polaraxes"?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.arc(this.model.centerX,this.model.centerY,this.model.Radius,0,2*Math.PI,!1),this.svgRenderer.ctx.clip(),this.canvasX=this.canvasY=0,e.draw(this,n),this.svgRenderer.ctx.restore()):(this.canvasX=this.canvasY=0,this.model.AreaType=="cartesianaxes"?e.draw(this,n,t):this.model.AreaType=="polaraxes"&&n._xAxisName==this.model._axes[0].name&&n._yAxisName==this.model._axes[1].name&&e.draw(this,n)),y=this.model.series[i].errorBar,d=this.model.AreaType,y.visibility=="visible"&&d=="cartesianaxes"&&this.model.series[i].type!="boxandwhisker"&&this.renderErrorBar(y,n),r=e.gSeriesGroupEle,r&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this),!(u=="candle"||u=="hilo"||u=="hiloopenclose"||u=="boxandwhisker")){var c=this,l,h=c.model.AreaType.toLowerCase(),nt=ej.seriesTypes[u].prototype.isRegion;u=="scatter"||$.each(n._visiblePoints,function(t,r){if(r.visible&&r.x!==""&&(r.marker&&r.marker.visible||n.marker.visible)){if(l=h=="polaraxes"&&g=="column"||nt?r.symbolLocation:h!="polaraxes"?ej.EjSvgRender.utils._getPoint(r,n):ej.EjSvgRender.utils.TransformToVisible(n,r.xValue,r.y,c),h=="polaraxes")var u=n.yAxis.labelFormat?n.yAxis.labelFormat:"",f=r.text?r.text:r.y+u.substring(u.indexOf("}")+1),o=ej.EjSvgRender.utils._measureText(f,null,n.marker.dataLabel.font);(h=="polaraxes"&&n._xAxisName==c.model._axes[0].name&&n._yAxisName==c.model._axes[1].name||h=="cartesianaxes")&&e.drawSymbol(i,n,t,l.X,l.Y)}});u!="scatter"?(n.marker.visible&&(r=this.gSymbolGroupEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this)),n.marker.dataLabel.visible&&(r=this.gSeriesTextEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this),r=this.gDataLabelEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this)),!ej.util.isNullOrUndefined(this.gConnectorEle)&&this.gConnectorEle.length>0&&(r=this.gConnectorEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this))):(r=this.gSymbolGroupEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this),this.svgRenderer.append(r,this.gSeriesEle),(n.tooltip.visible||u=="scatter")&&(tt=this.model.enableCanvasRendering?this.model.series[i].points:$(this.gSymbolGroupEle).children().not("defs"),this.vmlRendering?(this.cloneSeriesEle=$(this.gSeriesEle).clone(),this.cloneobj=$(this.element).clone(),this.svgclone=$(this.svgObject).clone(),$(document.body).append(this.cloneobj),this.svgRenderer.append(this.cloneSeriesEle,this.svgclone),this.svgRenderer.append(this.svgclone,this.cloneobj)):(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element)),this.vmlRendering&&($(this.cloneobj).remove(),$(this.svgclone).remove())))}this.drawDisplayText(e,n,t)},renderErrorBar:function(n,t){var s=this,yi=s.model,o=t,v,u,pi,rr,y,ur,fr,dr,vt=o._visiblePoints,wi=vt.length,pt=s.canvasX,wt=s.canvasY,dt=$.inArray(o,yi._visibleSeries),gr=null,ft,er=ej.EjSvgRender.utils._getTransform(o.xAxis,o.yAxis,yi.requireInvertedAxes),bt,kt,d=yi.requireInvertedAxes,or,sr,hr,cr,lr=s.svgObject.id,hi=s.model.m_AreaBounds,gr="translate("+er.x+","+er.y+")",ci,ar,p,vr,li,et,h,c,bi,yr,a,i,r,f,e,yt,pr,wr,ai,vi,ot,st,gt,ni,w,b,ki,di,br,kr,ti,ii,ri,ui,fi,ei,oi,si,rt,lt,k,ut,g,nt,gi,nr,l,tt,it,at,ht,ct,tr,ir;for(ar={id:lr+"_ErrorBarGroup_"+dt,transform:gr,"clip-path":"url(#"+lr+"_ChartAreaClipRect)"},ej.util.isNullOrUndefined(s.gErrorBarGroupEle)&&(s.gErrorBarGroupEle=[]),ci=s.gErrorBarGroupEle[dt]=s.svgRenderer.createGroup(ar),commonEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs),commonEventArgs.data={errorBar:n},this._trigger("errorBarRendering",commonEventArgs),p=commonEventArgs.data.errorBar,v=p.type,u=p.mode,pi=p.direction,rr=p.fill,y=p.cap,ur=p.cap.fill,fr=p.cap.width,dr=p.cap.length,bt=p.verticalErrorValue,kt=p.horizontalErrorValue,or=p.verticalPositiveErrorValue,sr=p.verticalNegativeErrorValue,hr=p.horizontalPositiveErrorValue,cr=p.horizontalNegativeErrorValue,ft=0;ft<wi;ft++)if(vt[ft].isEmpty==!1&&vt[ft].visible==!0){vr={id:s.svgObject.id+"_ErrorBarGroup_"+dt+"_Point"+ft};errorBarPointGroup=s.svgRenderer.createGroup(vr);li=ft;et=vt[ft];h=et.YValues[0];c=et.xValue;bi=vt[ft].YValues[0];yr=vt[ft].xValue;a=v.indexOf("column")||v.indexOf("bar")>-1?et.symbolLocation:et.location;ej.util.isNullOrUndefined(a)&&(a=ej.EjSvgRender.utils._getPoint(et,o));ot=a.X;st=a.Y;switch(v){case"fixedValue":g=et;(u=="vertical"||u=="both")&&(g.YValues[0]=h+bt,i=ej.EjSvgRender.utils._getPoint(g,o),g.YValues[0]=h-bt,r=ej.EjSvgRender.utils._getPoint(g,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(g.YValues[0]=h,g.xValue=c,g.xValue=c+kt,f=ej.EjSvgRender.utils._getPoint(g,o),g.xValue=c-kt,e=ej.EjSvgRender.utils._getPoint(g,o));g.YValues[0]=h;g.xValue=c;break;case"percentage":nt=et;gi=bt/100*h;nr=kt/100*c;(u=="vertical"||u=="both")&&(nt.YValues[0]=h+gi,i=ej.EjSvgRender.utils._getPoint(nt,o),nt.YValues[0]=h-gi,r=ej.EjSvgRender.utils._getPoint(nt,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(nt.YValues[0]=h,nt.xValue=c,nt.xValue=c+nr,f=ej.EjSvgRender.utils._getPoint(nt,o),nt.xValue=c-nr,e=ej.EjSvgRender.utils._getPoint(nt,o));nt.YValues[0]=h;nt.xValue=c;break;case"standardDeviation":l=et;yt=s.meanCalculation(u,vt);pr=yt.verMean;wr=yt.horMean;ai=yt.verStandSquareRoot;vi=yt.horStandSquareRoot;(u=="vertical"||u=="both")&&(gt=bt*ai,l.YValues[0]=pr,w=ej.EjSvgRender.utils._getPoint(l,o),h=l.YValues[0],l.YValues[0]=h+gt,i=ej.EjSvgRender.utils._getPoint(l,o),l.YValues[0]=h-gt,r=ej.EjSvgRender.utils._getPoint(l,o),d?w.Y=i.Y=r.Y=a.Y:w.X=i.X=r.X=a.X,w.X=w.X+pt,w.Y=w.Y+wt);(u=="horizontal"||u=="both")&&(ni=kt*vi,l.xValue=wr,b=ej.EjSvgRender.utils._getPoint(l,o),d?b.X=a.X:b.Y=a.Y,l.YValues[0]=bi,c=l.xValue,l.xValue=c+ni,f=ej.EjSvgRender.utils._getPoint(l,o),l.xValue=c-ni,e=ej.EjSvgRender.utils._getPoint(l,o),b.X=b.X+pt,b.Y=b.Y+wt);l.YValues[0]=bi;l.xValue=yr;break;case"standardError":tt=et;yt=s.meanCalculation(u,vt);ai=yt.verStandSquareRoot;vi=yt.horStandSquareRoot;(u=="vertical"||u=="both")&&(gt=bt*ai,ki=gt/Math.sqrt(wi),tt.YValues[0]=h+ki,i=ej.EjSvgRender.utils._getPoint(tt,o),tt.YValues[0]=h-ki,r=ej.EjSvgRender.utils._getPoint(tt,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(ni=kt*vi,di=ni/Math.sqrt(wi),tt.YValues[0]=h,tt.xValue=c,tt.xValue=c+di,f=ej.EjSvgRender.utils._getPoint(tt,o),tt.xValue=c-di,e=ej.EjSvgRender.utils._getPoint(tt,o));tt.YValues[0]=h;tt.xValue=c;ft=li;break;case"custom":it=et;(u=="vertical"||u=="both")&&(it.YValues[0]=h+or,i=ej.EjSvgRender.utils._getPoint(it,o),it.YValues[0]=h-sr,r=ej.EjSvgRender.utils._getPoint(it,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(it.YValues[0]=h,it.xValue=c,it.xValue=c+hr,f=ej.EjSvgRender.utils._getPoint(it,o),it.xValue=c-cr,e=ej.EjSvgRender.utils._getPoint(it,o));it.YValues[0]=h;it.xValue=c}y.visible==!0&&((u=="vertical"||u=="both")&&(br={verHighvalue:i,verLowvalue:r}),(u=="horizontal"||u=="both")&&(kr={horHighvalue:f,horLowvalue:e}),at=s.renderCap(y,u,br,kr,d),ti=at.verHighCapX1,ii=at.verHighCapX2,ri=at.verLowCapX1,ui=at.verLowCapX2,fi=at.horHighCapY1,ei=at.horHighCapY2,oi=at.horLowCapY1,si=at.horLowCapY2);ot=ot+pt;st=st+wt;(u=="vertical"||u=="both")&&(i.X=i.X+pt,i.Y=i.Y+wt,r.X=r.X+pt,r.Y=r.Y+wt);(u=="horizontal"||u=="both")&&(f.X=f.X+pt,f.Y=f.Y+wt,e.X=e.X+pt,e.Y=e.Y+wt);pi=="both"?((u=="vertical"||u=="both")&&(v!="standardDeviation"?rt="M "+ot+" "+st+" L "+i.X+" "+i.Y+" M "+ot+" "+st+" L "+r.X+" "+r.Y+" ":v=="standardDeviation"&&(rt="M "+w.X+" "+w.Y+" L "+i.X+" "+i.Y+" M "+w.X+" "+w.Y+" L "+r.X+" "+r.Y+" "),lt=d?y.visible?"M "+i.X+" "+i.Y+" L "+i.X+" "+ti+" M "+i.X+" "+i.Y+" L "+i.X+" "+ii+" M "+r.X+" "+r.Y+" L "+r.X+" "+ri+" M "+r.X+" "+r.Y+" L "+r.X+" "+ui+" ":"":y.visible?"M "+i.X+" "+i.Y+" L "+ti+" "+i.Y+" M "+i.X+" "+i.Y+" L "+ii+" "+i.Y+" M "+r.X+" "+r.Y+" L "+ri+" "+r.Y+" M "+r.X+" "+r.Y+" L "+ui+" "+r.Y+" ":"",ht=rt,ct=lt),(u=="horizontal"||u=="both")&&(v!="standardDeviation"?k="M "+ot+" "+st+" L "+f.X+" "+f.Y+" M "+ot+" "+st+" L "+e.X+" "+e.Y+" ":v=="standardDeviation"&&(k="M "+b.X+" "+b.Y+" L "+f.X+" "+f.Y+" M "+b.X+" "+b.Y+" L "+e.X+" "+e.Y+" "),ut=d?y.visible?"M "+f.X+" "+f.Y+" L "+fi+" "+f.Y+" M "+f.X+" "+f.Y+" L "+ei+" "+f.Y+" M "+e.X+" "+e.Y+" L "+oi+" "+e.Y+" M "+e.X+" "+e.Y+" L "+si+" "+e.Y+" ":"":y.visible?"M "+f.X+" "+f.Y+" L "+f.X+" "+fi+" M "+f.X+" "+f.Y+" L "+f.X+" "+ei+" M "+e.X+" "+e.Y+" L "+e.X+" "+oi+" M "+e.X+" "+e.Y+" L "+e.X+" "+si+" ":"",ht=k,ct=ut),u=="both"&&(k+=rt,ut+=lt,ht=k,ct=ut)):pi=="plus"?((u=="vertical"||u=="both")&&(v!="standardDeviation"?rt="M "+ot+" "+st+" L "+i.X+" "+i.Y+" ":v=="standardDeviation"&&(rt="M "+w.X+" "+w.Y+" L "+i.X+" "+i.Y+" "),lt=d?y.visible?"M "+i.X+" "+i.Y+" L "+i.X+" "+ti+" M "+i.X+" "+i.Y+" L "+i.X+" "+ii+" ":"":y.visible?"M "+i.X+" "+i.Y+" L "+ti+" "+i.Y+" M "+i.X+" "+i.Y+" L "+ii+" "+i.Y+" ":"",ht=rt,ct=lt),(u=="horizontal"||u=="both")&&(v!="standardDeviation"?k="M "+ot+" "+st+" L "+f.X+" "+f.Y+" ":v=="standardDeviation"&&(k="M "+b.X+" "+b.Y+" L "+f.X+" "+f.Y+" "),ut=d?y.visible?"M "+f.X+" "+f.Y+" L "+fi+" "+f.Y+" M "+f.X+" "+f.Y+" L "+ei+" "+f.Y+" ":"":y.visible?"M "+f.X+" "+f.Y+" L "+f.X+" "+fi+" M "+f.X+" "+f.Y+" L "+f.X+" "+ei+" ":"",ht=k,ct=ut),u=="both"&&(k+=rt,ut+=lt,ht=k,ct=ut)):((u=="vertical"||u=="both")&&(v!="standardDeviation"?rt="M "+ot+" "+st+" L "+r.X+" "+r.Y+" ":v=="standardDeviation"&&(rt="M "+w.X+" "+w.Y+" L "+r.X+" "+r.Y+" "),lt=d?y.visible?"M "+r.X+" "+r.Y+" L "+r.X+" "+ri+" M "+r.X+" "+r.Y+" L "+r.X+" "+ui+" ":"":y.visible?"M "+r.X+" "+r.Y+" L "+ri+" "+r.Y+" M "+r.X+" "+r.Y+" L "+ui+" "+r.Y+" ":"",ht=rt,ct=lt),(u=="horizontal"||u=="both")&&(v!="standardDeviation"?k="M "+ot+" "+st+" L "+e.X+" "+e.Y+" ":v=="standardDeviation"&&(k="M "+b.X+" "+b.Y+" L "+e.X+" "+e.Y+" "),ut=d?y.visible?"M "+e.X+" "+e.Y+" L "+oi+" "+e.Y+" M "+e.X+" "+e.Y+" L "+si+" "+e.Y+" ":"":y.visible?"M "+e.X+" "+e.Y+" L "+e.X+" "+oi+" M "+e.X+" "+e.Y+" L "+e.X+" "+si+" ":"",ht=k,ct=ut),u=="both"&&(k+=rt,ut+=lt,ht=k,ct=ut));tr={id:s.svgObject.id+"_ErrorBar_"+dt+"_Point"+li,d:ht,stroke:rr,"stroke-width":n.width,opacity:n.opacity};ir={id:s.svgObject.id+"_ErrorBarCap_"+dt+"_Point"+li,d:ct,stroke:ur,"stroke-width":fr};s.model.enableCanvasRendering?(this.svgRenderer.ctx.rect(hi.X,hi.Y,hi.Width,hi.Height),this.svgRenderer.ctx.clip(),s.svgRenderer.drawPath(tr,null),s.svgRenderer.drawPath(ir,null)):(s.svgRenderer.drawPath(tr,errorBarPointGroup),s.svgRenderer.drawPath(ir,errorBarPointGroup),s.svgRenderer.append(errorBarPointGroup,ci))}s.svgRenderer.append(ci,s.gSeriesEle);ej.EjSvgRender.utils._drawAxesBoundsClipPath(ci,o,s)},meanCalculation:function(n,t){for(var r=temp1=0,f,a,v,e,o,l,s,h,c,y,p,w,b,k,d,g,nt,tt,u=t.length,i=0;i<u;i++)n=="vertical"?(f=r+t[i].y,r=f):n=="horizontal"?(f=temp1+t[i].xValue,temp1=f):(a=r+t[i].y,r=a,v=temp1+t[i].xValue,temp1=v);for(e=r/u,o=temp1/u,l=u-1,i=0;i<u;i++)n=="vertical"?(s=t[i].y-e,h=Math.pow(s,2),c=r+h,r=c):n=="horizontal"?(s=t[i].xValue-o,h=Math.pow(s,2),c=temp1+h,temp1=c):(y=t[i].y-e,w=Math.pow(y,2),b=r+w,r=b,p=t[i].xValue-o,horSquareEachDiv=Math.pow(p,2),k=temp1+horSquareEachDiv,temp1=k);return d=r/l,nt=Math.sqrt(d),g=temp1/l,tt=Math.sqrt(g),{verStandSquareRoot:nt,horStandSquareRoot:tt,verMean:e,horMean:o}},renderCap:function(n,t,i,r,u){var e,o,f,s,h,c,l,a,v,y,p,w,b,k,d;return e=this.canvasX,o=this.canvasY,f=n.length/2,(t=="vertical"||t=="both")&&(s=i.verHighvalue,h=i.verLowvalue),(t=="horizontal"||t=="both")&&(c=r.horHighvalue,l=r.horLowvalue),(t=="vertical"||t=="both")&&(u?(a=s.Y+o+f,v=s.Y+o-f,y=h.Y+o+f,p=h.Y+o-f):(a=s.X+e-f,v=s.X+e+f,y=h.X+e-f,p=h.X+e+f)),(t=="horizontal"||t=="both")&&(u?(w=c.X+e+f,b=c.X+e-f,k=l.X+e+f,d=l.X+e-f):(w=c.Y+o-f,b=c.Y+o+f,k=l.Y+o-f,d=l.Y+o+f)),{verHighCapX1:a,verHighCapX2:v,verLowCapX1:y,verLowCapX2:p,horHighCapY1:w,horHighCapY2:b,horLowCapY1:k,horLowCapY2:d}},drawDisplayText:function(n,t,i){var r=this,u,a=t.type.toLowerCase(),h=r.model.AreaType.toLowerCase(),c=ej.seriesTypes[a].prototype.isRegion,v=t.drawType.toLowerCase(),f,l=!1,o=$.inArray(t,r.model._visibleSeries),e,s;ej.util.isNullOrUndefined(r.model.regionCount)&&(r.model.regionCount=-1);e=r.model.enableCanvasRendering;s=r.model.AreaType.toLowerCase()=="polaraxes";$.each(t._visiblePoints,function(a,y){var p=r.model.series[o].type.toLowerCase(),b,w;if(t._visiblePoints[a].textOptionsBoxValues=[],f=y.marker,u=h=="polaraxes"&&v=="column"||c?p.toLowerCase()=="boxandwhisker"?y.dataLabelLocation:y.symbolLocation:h!="polaraxes"?ej.EjSvgRender.utils._getPoint(y,t):ej.EjSvgRender.utils.TransformToVisible(t,y.xValue,y.y,r),y.visible&&(f&&f.dataLabel&&f.dataLabel.visible||(!f||!f.dataLabel)&&t.marker.dataLabel.visible)){for(c&&r.model.regionCount++,p=r.model.series[o].type.toLowerCase(),b=0;b<r.model._axes.length;b++)if(r.model._axes[b].zoomFactor<1||r.model._axes[b].zoomPosition>0){l=!0;break}if((r.zoomed||t.xAxis._isScroll||l)&&(p=="column"||p=="stackingcolumn"||p=="stackingcolumn100"))for(b=0;b<r.model.chartRegions.length;b++)o==r.model.chartRegions[b].SeriesIndex&&a==r.model.chartRegions[b].Region.PointIndex&&(e&&r.model.AreaType=="cartesianaxes"?(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.model.requireInvertedAxes?r.svgRenderer.ctx.rect(t.yAxis.x,t.xAxis.y,t.yAxis.width,t.xAxis.height):r.svgRenderer.ctx.rect(t.xAxis.x,t.yAxis.y,t.xAxis.width,t.yAxis.height),r.svgRenderer.ctx.clip(),n.drawDataLabel(t,a,y,u.X,u.Y,b,i),r.svgRenderer.ctx.restore()):n.drawDataLabel(t,a,y,u.X,u.Y,b,i));else if(e&&r.model.AreaType=="cartesianaxes"){if(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.model.requireInvertedAxes?r.svgRenderer.ctx.rect(t.yAxis.x,t.xAxis.y,t.yAxis.width,t.xAxis.height):r.svgRenderer.ctx.rect(t.xAxis.x,t.yAxis.y,t.xAxis.width,t.yAxis.height),r.svgRenderer.ctx.clip(),r.model.chartRegions[r.model.regionCount]||p.indexOf("column")==-1&&p.indexOf("bar")==-1&&p.indexOf("waterfall")==-1){if(p.toLowerCase()=="boxandwhisker")for(w=0;w<u.length;w++)y.y=y.boxPlotLocation[w].YValues,n.drawDataLabel(t,a,y,u[w].X,u[w].Y,r.model.regionCount,i,u[w].outlier);else n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i);(p=="rangecolumn"||p=="rangearea")&&(y.y=y.low,n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i),y.y=y.high)}r.svgRenderer.ctx.restore()}else{if(e&&s&&(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.svgRenderer.ctx.arc(r.model.centerX,r.model.centerY,r.model.Radius,0,2*Math.PI,!1),r.svgRenderer.ctx.clip(),u.X-=r.canvasX,u.Y-=r.canvasY),p=="column"||p=="stackingcolumn"||p=="stackingcolumn100")r.model.chartRegions[r.model.regionCount]&&n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i);else if(p.toLowerCase()=="boxandwhisker")for(w=0;w<u.length;w++)y.y=y.boxPlotLocation[w].YValues,n.drawDataLabel(t,a,y,u[w].X,u[w].Y,r.model.regionCount,i,u[w].outlier);else n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i);(p=="rangecolumn"||p=="rangearea")&&(y.y=y.low,n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i),y.y=y.high);e&&s&&r.svgRenderer.ctx.restore()}}})},cartesianSmartLabels:function(n,t){var b=t.length,k,d,r,o,v,p,w,l,a,i,y,g,c,u,f,e,s,h;for(connectorFlag=!1,this.processCount=1,this.posObj={top:[],rightTop:[],left:[],leftTop:[],right:[],rightTop:[],rightBottom:[],leftBottom:[],bottom:[]},o=0;o<this.model.series.length;o++)if(k=this.model.series[o].marker.size.width,d=this.model.series[o].marker.size.height,this.model.series[o].marker.visible)for(v=0;v<this.model.series[o]._visiblePoints.length;v++)i=this.model.series[o]._visiblePoints[v],p=i.location,this.model.markerRegion[this.model.markerRegion.length]={seriesIndex:o,xPos:p.X+this.canvasX,yPos:p.Y+this.canvasY,width:k,height:d};for(g=10,u=this.model.m_AreaBounds,y=0;y<b;y++)i=t[y],i.hide=!1,s=i.xPos,h=i.yPos,f=i.width,e=i.height,s-f/2<0&&s>-f/2&&(c=s-f/2,i.textOptions.x=i.xPos=s+Math.abs(c)+10,i.newConnectorFlag=!0),s+f/2>u.Width&&s+f/2<u.Width+f/2&&(c=s-f/2,i.textOptions.x=i.xPos=u.Width-f/2-10,i.newConnectorFlag=!0),h+f/2>u.Height&&h+e/2<u.Height+e/2&&(c=h+e/2-u.Height,i.yPos=h-c-10,i.textOptions.y=i.yPos+5,i.newConnectorFlag=!0),h-e/2<0&&h>-e/2&&(c=h-e/2,i.yPos=i.yPos+Math.abs(c)+10,i.textOptions.y=i.yPos+5,i.newConnectorFlag=!0);for(r=0;r<b;r++){if(ej.util.isNullOrUndefined(t[r].yPos))continue;else this.model.allPoints[this.model.allPoints.length]=t[r];connectorFlag=!1;this.compareDataLabels(r,t,0,this.processCount);i=t[r];i.connectorFlag=connectorFlag;t[r].dataLabeltemplate?(w=$("#"+t[r].id),l=t[r].xPos,a=this.model.enableCanvasRendering?t[r].yPos+this.model.m_AreaBounds.Y:t[r].yPos,w.css("left",l).css("top",a),this.model.AreaType=="cartesianaxes"&&(u=this.model.m_AreaBounds,xPosition=u.X+(this.model.requireInvertedAxes?n.yAxis.plotOffset:n.xAxis.plotOffset),yPosition=n.yAxis.y,f=t[r].width,e=t[r].height,(l>xPosition+u.Width||l+f<xPosition||a+e<yPosition||a+e>u.Y+u.Height||this.zoomed&&(l<xPosition||a<yPosition||l>xPosition+u.Width||a>yPosition+u.Height))&&w.remove())):this.storeDataLabelPositions(i)}},storeDataLabelPositions:function(n){var i=n.position,t=this.posObj;switch(i){case"top":t.top[this.processCount-1]=n;this.processCount=1;break;case"rightTop":t.rightTop[this.processCount-1]=n;this.processCount=1;break;case"right":t.right[this.processCount-1]=n;this.processCount=1;break;case"rightBottom":t.rightBottom[this.processCount-1]=n;this.processCount=1;break;case"bottom":t.bottom[this.processCount-1]=n;this.processCount=1;break;case"left":t.left[this.processCount-1]=n;this.processCount=1;break;case"leftBottom":t.leftBottom[this.processCount-1]=n;this.processCount=1;break;case"leftTop":t.leftTop[this.processCount-1]=n}},cartesianColumnSmartLabels:function(n,t){var u=t.length,i,f,r;for(connectorFlag=!1,this.processCount=1,i=0;i<u;i++){if(ej.util.isNullOrUndefined(t[i].yPos))continue;else this.model.allPoints[this.model.allPoints.length]=t[i];n._enableSmartLabels&&(connectorFlag=!1,this.compareColumnDataLabels(n,i,t,0,this.processCount));f=n._visiblePoints[i];t[i].dataLabeltemplate&&(r=$("#"+t[i].id),r.css("left",t[i].xPos).css("top",t[i].yPos))}},compareColumnDataLabels:function(n,t,i,r){for(var h=this.model.allPoints.length-1,f,u,e,o=n.type.toLowerCase(),s=0;s<h;s++)f=this.model.allPoints[s],u=this.model.allPoints[this.model.allPoints.length-1],this.currentCollideLabel=f,e=5,collide=this.isCollide(f,u),textPosition=n.marker.dataLabel.textPosition,collide.state&&(o=="column"||o=="stackingcolumn"||o=="rangecolumn"||o=="waterfall"?(u.textOptions.y=textPosition=="top"||textPosition=="middle"?u.yPos=u.yPos+collide.height+e:u.yPos=u.yPos-collide.height-e,u.textOptions.y=u.textOptions.y+e+u.margin.top/2-u.margin.bottom/2):u.textOptions.x=textPosition=="top"||textPosition=="middle"?u.xPos=f.xPos-f.width/2-u.width/2-e:u.xPos=f.xPos+f.width/2+u.width/2+e,this.compareColumnDataLabels(n,t,i,r,this.processCount))},compareDataLabels:function(n,t,i,r){for(var h=this.model.allPoints.length,f,e,u,o=this.posObj,s=0;s<h;s++)if(e=this.model.allPoints[s],u=this.model.allPoints[h-1],this.currentCollideLabel=e,f=10,collide=this.isCollide(e,u,s),collide.state||collide.marker){connectorFlag=!0;switch(i){case 0:this.processCount>1&&this.resetValues(u);collide.marker?(this.prevLabel=collide.markerRegion,this.processCount=1):ej.util.isNullOrUndefined(this.prevLabel)?(this.prevLabel=e,this.processCount=1):(checkCollide=this.isCollide(this.prevLabel,u),checkCollide.state||(this.prevLabel=e,this.processCount=1));this.resetValues(u);r>1&&o.right[this.processCount-2]?(e=o.right[this.processCount-2],u.textOptions.x=u.xPos=e.xPos+(e.width/2+u.width/2+f)):u.textOptions.x=u.xPos=this.prevLabel.xPos+(this.prevLabel.width/2+u.width/2+f);i+=1;u.position="right";this.compareDataLabels(n,t,i,this.processCount);break;case 1:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos+this.prevLabel.width/2+u.width/2+f;r>1&&o.rightBottom[this.processCount-2]?(e=o.rightBottom[this.processCount-2],u.textOptions.y=u.yPos=e.yPos+this.canvasY+e.height+f):u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="rightBottom";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 2:this.resetValues(u);u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;r>1&&o.bottom[this.processCount-2]?(e=o.bottom[this.processCount-2],u.textOptions.y=u.yPos=e.yPos+u.height+f):u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="bottom";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 3:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos-this.prevLabel.width/2-u.width/2-f;r>1&&o.leftBottom[this.processCount-2]?(e=o.leftBottom[this.processCount-2],u.textOptions.y=u.yPos=e.yPos+this.canvasY+e.height+f):u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="leftBottom";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 4:this.resetValues(u);r>1&&o.left[this.processCount-2]?(e=o.left[this.processCount-2],u.textOptions.x=u.xPos=e.xPos-e.width/2-u.width/2-f):u.textOptions.x=u.xPos=this.prevLabel.xPos-this.prevLabel.width/2-u.width/2-f;u.position="left";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 5:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos-this.prevLabel.width/2-u.width/2-f;r>1&&o.leftTop[this.processCount-2]?(e=o.leftTop[this.processCount-2],u.textOptions.y=u.yPos=e.yPos-(u.height+f)):u.textOptions.y=u.yPos=this.prevLabel.yPos-u.height-f;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="leftTop";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 6:this.resetValues(u);r>1&&o.top[r-2]?(e=o.top[r-2],u.textOptions.y=u.yPos=e.yPos-(u.height+f)):u.textOptions.y=u.yPos=this.prevLabel.yPos-this.processCount*(u.height+f);u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;i+=1;u.position="top";this.compareDataLabels(n,t,i,this.processCount);break;case 7:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos+this.prevLabel.width/2+u.width/2+f;r>1&&o.rightTop[this.processCount-2]?(e=o.rightTop[this.processCount-2],u.textOptions.y=u.yPos=e.yPos-u.height-f):u.textOptions.y=u.yPos=this.prevLabel.yPos-u.height-f;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="rightTop";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 8:i=0;this.processCount+=1;this.compareDataLabels(n,t,i,this.processCount)}}},drawPieofPieConnectors:function(n,t){var d=t.enableAnimation&&!t._animatedSeries?"hidden":"visible",i,s,r,k;this.model.enableCanvasRendering||(this.gConnectorLinesGroup?this.gConnectorLinesGroup.childNodes.length>0:this.gConnectorLinesGroup=this.svgRenderer.createGroup({id:this.svgObject.id+"_connectorLineGroup",visibility:d}),$(this.gConnectorLinesGroup.childNodes).remove());var f=[],e=[],h=[],u=[],c=-.5*Math.PI,v,o;for(i=0;i<2;i++){if(o=t.pieCollections[i],v=i==0?t.pieCoefficient:t.pieOfPieCoefficient,f[i]=.25*v*Math.min(n.width,n.height),e[i]=this.model.circleCenterX[i],e[i]=i==0?e[i]+this.model.pieGapWidth/2:e[i]-this.model.pieGapWidth/2,h[i]=this.model.circleCenterY[i],o[0].start>0&&o[0].end<Math.PI&&i==0)var y=o[0].start+c,p=o[0].end+c-1e-6,l=e[i]+f[i]*Math.cos(y),a=h[i]+f[i]*Math.sin(y),w=e[i]+f[i]*Math.cos(p),b=h[i]+f[i]*Math.sin(p);else l=e[i]+f[i]*Math.cos(c),a=h[i]+f[i]*Math.sin(c),w=l,b=a+f[i]*2;u.push({X1:l,Y1:a,X2:w,Y2:b})}for(s=t.connectorLine,r=0;r<2;r++)k={id:this.svgObject.id+"_connectorLine"+r,x1:r==0?u[r].X1:u[r-1].X2,y1:r==0?u[r].Y1:u[r-1].Y2,x2:r==0?u[r+1].X1:u[r].X2,y2:r==0?u[r+1].Y1:u[r].Y2,stroke:s.color,"stroke-width":s.width,opacity:s.opacity,"stroke-dasharray":s.dashArray},this.svgRenderer.drawLine(k,this.gConnectorLinesGroup);this.svgRenderer.append(this.gConnectorLinesGroup,this.gSeriesEle)},drawConnectorLines:function(n,t,i){var c=!1,e=!0,o=i.xPos,s=i.yPos,h=this.model.m_AreaBounds,u=i.location?i.location:i.symbolLocation,r;if(u.Y>i.textOptions.y?r=i.textOptions.y:(c=!0,r=i.textOptions.y-i.height/2),i.dataLabeltemplate?(r=i.yPos-this.model.m_AreaBounds.Y+i.height,i.textOptions.x=i.textOptions.x-this.model.m_AreaBounds.X+i.width/4+this.canvasX):(o>h.Width||o+i.width<0||s-i.height>h.Height||s+i.height<0)&&(e=!1),e){var l="M "+(u.X+this.canvasX)+" "+(u.Y+this.canvasY)+" L "+i.textOptions.x+" "+r,f=this.model.series[n].marker.dataLabel.connectorLine,a=ej.util.isNullOrUndefined(f.color)?this.model.series[n].fill:f.color,v={id:this.svgObject.id+"_dataLabelConnectorLine_series"+n+"_"+t,stroke:a,"stroke-width":f.width,d:l};this.model.series[n].connectorLines=!0;this.svgRenderer.drawPath(v,this.gConnectorEle[n])}},resetValues:function(n){n.textOptions.y=n.dataLabel.textY;n.yPos=n.dataLabel.y;n.textOptions.x=n.dataLabel.textX;n.xPos=n.dataLabel.x},isCollide:function(n,t){var h=0,c=0,r=!1,f=!1,l=n.seriesIndex?this.model.series[n.seriesIndex].marker.dataLabel.border.width:0,u;l+=t.seriesIndex?this.model.series[t.seriesIndex].marker.dataLabel.border.width:0;var e=this.model.series,i=e[n.seriesIndex],a=e[t.seriesIndex],o=n.xPos,s=n.yPos,v=t.xPos,y=t.yPos;if(n.xPos+=i.xAxis.x,n.yPos+=i.yAxis.y,t.xPos+=a.xAxis.x,t.yPos+=a.yAxis.y,n!=t&&(r=!(n.yPos+n.height<t.yPos||n.yPos>t.yPos+t.height||n.xPos+n.width/2+l<t.xPos-t.width/2||n.xPos-n.width/2>t.xPos+t.width/2),r&&(c=n.yPos+n.height-t.yPos,h=n.xPos+n.width-t.xPos),n.xPos=o,n.yPos=s),!r)for(u=0;u<this.model.markerRegion.length;u++)if(n=this.model.markerRegion[u],i=e[n.seriesIndex],o=n.xPos,s=n.yPos,n.xPos+=i.xAxis.x,t.yPos+=i.yAxis.y,f=!(n.yPos+n.height<t.yPos-t.height/2||n.yPos>t.yPos+t.height||n.xPos+n.width<t.xPos||n.xPos>t.xPos+t.width),f)break;return n.xPos=o,n.yPos=s,t.xPos=v,t.yPos=y,{state:r,marker:f,markerRegion:n,width:h,height:c}},drawAccDisplayText:function(n,t,i){var f=this,h=t._visiblePoints.length,e,o,u,r,s;if(f.firstStartAngle=[],type=t.type.toLowerCase(),type!="pyramid"&&type!="funnel"&&type!="pieofpie"&&(t.leftsidePoints.length>0||t.rightsidePoints.length>0)){for(e=t.rightsidePoints.length,o=t.leftsidePoints.length,r=0;r<e;r++)t.rightsidePoints[r].index=r,n.drawDataLabelAcc(f,t,t.rightsidePoints[r].pointIndex,t.rightsidePoints[r],i);for(u=o-1;u>=0;u--)t.leftsidePoints[u].index=u,n.drawDataLabelAcc(f,t,t.leftsidePoints[u].pointIndex,t.leftsidePoints[u],i)}else for(r=0;r<h;r++)(t._visiblePoints[r].index=r,s=type=="pieofpie"?t._visiblePoints[r].actualIndex:r,isNaN(t._visiblePoints[r].startAngle)&&t.type.toLowerCase()=="pie"&&t.type.toLowerCase=="pieofpie")||n.drawDataLabelAcc(f,t,s,t._visiblePoints[r],i,t.collectionIndex);(t.type.toLowerCase()=="pyramid"||t.type.toLowerCase()=="funnel")&&(this.svgRenderer.append(this.gConnectorEle,this.gSeriesEle),this.svgRenderer.append(this.gSymbolGroupEle,this.gSeriesEle),this.svgRenderer.append(this.gDataLabelEle,this.gSeriesEle),this.svgRenderer.append(this.gSeriesTextEle,this.gSeriesEle),this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.vmlRendering||this.svgRenderer.append(this.svgObject,this.element))},_processOData:function(n){var t=this,i=n.type.toLowerCase(),r=n.dataSource.executeQuery(n.query);r.done(function(r){var f,e,u,o;for(t._processJsonData(r.result,n),n.visibility="visible",$(t.svgObject).empty(),$(t.legendSvgContainer).empty(),t.model.enableCanvasRendering&&(t.svgRenderer.ctx.clearRect(0,0,t.svgObject.width,t.svgObject.height),$("#canvas_trackSymbol").remove()),f=!0,e=i!="pie"||i!="doughnut"?0:t.model.series.length-1,u=e;o=i!="pie"||i!="doughnut"?u<t.model.series.length:u>=0;i!="pie"||i!="doughnut"?u++:u--)if(t.model.series[u].dataSource&&t.model.series[u].visibility=="hidden"){f=!1;break}f&&t.draw()});r.fail(function(){var r,i;for(n.visibility="visible",$(t.svgObject).empty(),$(t.legendSvgContainer).empty(),r=!0,i=0;i<t.model.series.length;i++)if(t.model.series[i].dataSource&&t.model.series[i].visibility=="hidden"){r=!1;break}r&&t.draw()})},_processJsonData:function(n,t){var r,u,f,e,d,l,g,a,nt,v,tt,y,it,p,rt,b,o,ut,w,i;t.points.length>0&&(t.points.length=0);var k=[],at=t.dataSource,s=t.xName,c=t.yName,et=t.pointColorMappingName,ot=t.marker&&t.marker.dataLabel.textMappingName,ht=[],ct=[],ft=t.type.toLowerCase(),h=n.length,lt,st;for(r=0;r<h;r++)typeof n[r][s]=="string"&&n[r][s].indexOf("/Date(")!=-1?(n[r][s]=new Date(parseInt(n[r][s].substr(6))),k[r]=n[r][s]?n[r][s]:r):k[r]=n[r][s]!=null&&n[r][s]!=undefined?n[r][s]:null,ht[r]=n[r][et]!=null&&n[r][et]!=undefined?n[r][et]:null,ct[r]=n[r][ot]!=null&&n[r][ot]!=undefined?n[r][ot]:null;if(u=[],f=0,t._hiloTypes){for(e=[],d=t.high,l=0;l<h;l++)e[l]=n[l][d]===null||n[l][d]===undefined?n[l][d]:parseFloat(n[l][d]);for(u[f]=e,f=f+1,e=[],g=t.low,a=0;a<h;a++)e[a]=n[a][g]===null||n[a][g]===undefined?n[a][g]:parseFloat(n[a][g]);if(u[f]=e,f=f+1,t.type.toLowerCase()!=="hilo"){for(e=[],nt=t.open,v=0;v<h;v++)e[v]=n[v][nt]===null||n[v][nt]===undefined?n[v][nt]:parseFloat(n[v][nt]);for(u[f]=e,f=f+1,e=[],tt=t.close,y=0;y<h;y++)e[y]=n[y][tt]===null||n[y][tt]===undefined?n[y][tt]:parseFloat(n[y][tt]);if(u[f]=e,f=f+1,t.volume){for(e=[],it=t.volume,p=0;p<h;p++)e[p]=n[p][it]===null||n[p][it]===undefined?n[p][it]:parseFloat(n[p][it]);u[f]=e}}}if(c){if(rt=[],t.type=="boxandwhisker")for(o=0;o<h;o++)for(rt[o]=[],b=0;b<n[o][c].length;b++)rt[o][b]=n[o][c][b]?parseFloat(n[o][c][b]):n[o][c][b];else for(o=0;o<h;o++)rt[o]=n[o][c]?parseFloat(n[o][c]):n[o][c];if(u[f]=rt,f=f+1,t.type.toLowerCase()=="bubble"){for(e=[],ut=t.size,w=0;w<h;w++)e[w]=n[w][ut]===null||n[w][ut]===undefined?n[w][ut]:parseFloat(n[w][ut]);u[f]=e}}for(lt=k.length,st=u.length,i=0;i<lt;i++)t.points[i]={x:k[i],xValue:k[i],y:u[0][i],YValues:[],_visibility:i==this.model._hiddenPointIndex[i]?"hidden":null,visible:!0,fill:ht[i],text:ct[i]},ft=="bubble"?(t.points[i].YValues[0]=u[0][i],t.points[i].size=t.points[i].YValues[1]=u[1][i]):t._hiloTypes&&st>1?(t.points[i].high=t.points[i].YValues[0]=u[0][i],t.points[i].low=t.points[i].YValues[1]=u[1][i],ft!="hilo"&&ft!="rangecolumn"&&ft!="waterfall"&&st>3&&(t.points[i].open=t.points[i].YValues[2]=u[2][i],t.points[i].close=t.points[i].YValues[3]=u[3][i],t.volume&&(t.points[i].volume=t.points[i].YValues[4]=u[4][i]))):t.points[i].YValues[0]=u[0][i]},bindTo:function(n){var o,f,r,e,u,i,t;for($("#"+this.svgObject.id+"_CrosshairVertical").remove(),$("#"+this.svgObject.id+"_CrosshairHorizontal").remove(),$.finish?($(".ejTooltip"+this._id).finish(),$(".tooltipDiv"+this._id).finish()):($(".ejTooltip"+this._id).stop(!0,!0),$(".tooltipDiv"+this._id).stop(!0,!0)),$(document).find('[id*="_TrackToolTip"]').remove(),$("#template_group_"+this._id).remove(),this.element[0].id||this._createChartId(),this.model.primaryXAxis._valueType=null,this.model.primaryXAxis.position=null,this.model.primaryYAxis._valueType=null,this.model.primaryYAxis.position=null,this.model.requireInvertedAxes=!1,this.model._hiddenPointIndex=[],o=this.model.series.length,f=this.model.axes.length,t=0;t<f;t++)r=this.model.axes[t],r._valueType=null,r.position=null;if(this.model._axes)for(f=this.model._axes.length,e=0;e<f;e++)r=this.model._axes[e],r._valueType=null,r.position=null,r.zoomFactor=r._pointsLength&&r._pointsLength!=r.scrollbarSettings.pointsLength?1:r.zoomFactor;for(t=0;t<o;t++)i=this.model.series[t],i.position=null,i.fill&&this.model.seriesColors&&i.fill!=this.model.seriesColors[t]&&(this.model.series[t].isFill=!0);if(this.model.AreaType&&this.model.AreaType=="none")for(i=this.model.series[0],t=0;i.points&&t<i.points.length;t++)u=i.points[t],u._visibility=u._visibility?u._visibility:null,u._visibility=="hidden"&&this.model.AreaType=="none"&&this.model.series.length==1&&(this.model._hiddenPointIndex[t]=t),u.fill&&this.model.pointColors&&u.fill!=this.model.pointColors[t]&&(u.isFill=!0),u.isFill||(u.fill=null);if(this.model.enable3D&&(ej.Ej3DRender.transform=null),this.model.series){if(i=this.model.series,this.setModelProperties(n),!n)for(t=0;t<i.length;t++)(i[t].visibility==null||i[t].visibility==undefined)&&(i[t].visibility="visible"),i[t].type&&(i[t]._hiloTypes=ej.seriesTypes[i[t].type.toLowerCase()].prototype.hiloTypes),i[t].points||(i[t].points=[]),i[t].dataSource&&(i[t].dataSource instanceof ej.DataManager?(i[t].visibility="hidden",!ej.isNullOrUndefined(i[t].query)&&i[t].query instanceof ej.Query||(i[t].query=ej.Query()),this._processOData(i[t])):i[t].dataSource.length>0&&this._processJsonData(i[t].dataSource,i[t]));$(this.svgObject).width()>0&&this.draw(n)}},_createChartId:function(){var i=!1,n=0,t=$(this.element)[0].className.split(" ")[0];do $("#"+t+"_"+n).length||($(this).attr("_id",t+"_"+n),$(this.element).attr("id",t+"_"+n),i=!0),n++;while(!i)},calculateHeight:function(n){var i=$(n.svgObject),r=n.model.size.height,u=$(n.element).height(),t=u/100*parseInt(r);return i.height(t),t},calculateWidth:function(n){var i=$(n.svgObject),r=n.model.size.width,u=$(n.element).width(),t=u/100*parseInt(r);return i.width(t),t},selectedStyle:function(n){for(var r=$("#"+n._id).find('[class*="Selection"]'),i=[],t=0;t<r.length;t++)i[t]=[],i[t].id=r[t].id,i[t].className=$("#"+i[t].id).attr("class");return $("[id $= Def ]").length>0&&(i.pattern=$("[id $= Def ]")),i},chartResize:function(){var n=this,i=$(n.svgObject),t=this.selectedStyle(n),r,u,f;this.removeMultiRect();this._chartResize=!0;this.model.enableCanvasRendering&&($("[id*="+this._id+"_Selection_]").remove(),$("#canvas_trackSymbol").remove(),r=n.svgObject.getContext("2d"),r.clearRect(0,0,this.svgRenderer.svgObj.width,this.svgRenderer.svgObj.height),typeof n.model.size.width=="string"&&n.model.size.width.indexOf("%")!=-1?(u=n.calculateWidth(n),this.svgRenderer.svgObj.width=u):this.svgRenderer.svgObj.width=$("#"+this._id).width(),typeof n.model.size.height=="string"&&n.model.size.height.indexOf("%")!=-1?(f=n.calculateHeight(n),this.svgRenderer.svgObj.height=f):this.svgRenderer.svgObj.height=ej.util.isNullOrUndefined(this.model.size.height)?"450":parseInt($(n.element).height()));this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){var u,r;if(!ej.util.isNullOrUndefined(n.model)&&(typeof n.model.size.width=="string"&&n.model.size.width.indexOf("%")!=-1?n.calculateWidth(n):i.width($(n.element).width()),typeof n.model.size.height=="string"&&n.model.size.height.indexOf("%")!=-1?n.calculateHeight(n):i.height($(n.element).height()),$(n.svgObject).width()>0)){for($(n.svgObject).empty(),$(n.legendSvgContainer).empty(),$("#template_group_"+n._id).remove(),$("#annotation_group_"+n._id).remove(),n.disableAnimation(),u=0;u<n.model.series.length;u++)n.model.series[u].regionAdded=!1;for(n.draw(),r=0;r<t.length;r++)$("#"+t[r].id).attr("class",t[r].className);t.pattern&&n.svgRenderer.append(t.pattern,n.svgObject);n.zoomed&&!n.vmlRendering&&n._enableZoomingButtons();n.enableAnimation()}},500)},isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},isWindows:function(){if(!ej.getBooleanVal($("head"),"data-ej-android")&&!ej.getBooleanVal($("head"),"data-ej-ios")&&!ej.getBooleanVal($("head"),"data-ej-ios7")&&!ej.getBooleanVal($("head"),"data-ej-flat"))return this._windows()},_windows:function(){return/trident|windows phone/i.test(navigator.userAgent.toLowerCase())||ej.getBooleanVal($("head"),"data-ej-windows",!1)===!0},bindResizeEvents:function(){if(this.model._resizeEventRegistered)return 0;ej.isTouchDevice()&&this._isOrientationSupported()?this._on($(window),"orientationchange",this.chartResize):this._on($(window),"resize",this.chartResize);this.model._resizeEventRegistered=!0},removeResizeEvents:function(){this.model._resizeEventRegistered&&(ej.isTouchDevice()&&this._isOrientationSupported()?this._off($(window),"orientationchange",this.chartResize):this._off($(window),"resize",this.chartResize),this.model._resizeEventRegistered=!1)},_isOrientationSupported:function(){return"orientation"in window&&"onorientationchange"in window},_calculatePinchZoomPosition:function(n){var i=this.model.m_AreaBounds,f,l=this.model._axes,t,a=n.originalEvent.touches?n.originalEvent.touches[0]:n.originalEvent,r=a.pageX,u=a.pageY,e=this.previousPanTouch,o,s,h,c=0,v=l.length;if(r>i.X&&r<i.X+i.Width&&u>i.Y&&u<i.Y+i.Height){if(e||(e=this.previousPanTouch={pageX:r,pageY:u}),ej.isTouchDevice()||this.model.zooming.enableDeferredZoom)return this.oPreviousCoords={x:this.previousPanTouch.pageX,y:this.previousPanTouch.pageY},this.chartMouseMove(n);for(;c<v;c++)t=l[c],s=t.orientation.toLowerCase()=="horizontal",h=s?(e.pageX-r)/t.width*t.zoomFactor:(e.pageY-u)/t.height*t.zoomFactor,f=t.zoomPosition,t.zoomPosition=this._ensureValueInMinMax(s?f+h:f-h,0,1-t.zoomFactor),o=o||f!=t.zoomPosition;this.previousPanTouch={pageX:r,pageY:u};o&&!this.chartUpdating&&(this.redraw(!0,o,n.target),this._enableZoomingButtons())}},_calculateTouchDistance:function(n,t){for(var r=[],i=0,u=t.length;i<u;i++)n[i]==null&&(n[i]=t[i]),r[i]={},i>0&&(r[i].scaleX=n[0].pageX!=n[1].pageX&&(t[0].pageX-t[1].pageX)/(n[0].pageX-n[1].pageX),r[i].scaleY=n[0].pageY!=n[1].pageY&&(t[0].pageY-t[1].pageY)/(n[0].pageY-n[1].pageY),r[i].center={x:(n[0].pageX+t[0].pageX)/2,y:(n[1].pageY+t[1].pageY)/2});return r},_ensureValueInMinMax:function(n,t,i){return n<t?t:n>i?i:n},_calculatePinchZoomFactor:function(n,t,i){var v=this.model,e=v._axes,u=!0,o,s,y,p,h,r,c,w,b=v.m_AreaBounds,l,a=1e4,f=0,k=e.length;if(t=t=="x"?"horizontal":t=="y"?"vertical":null,this.previousScale!=null){for(;f<k;f++)if(!t||e[f].orientation===t){if(r=e[f],s=r.orientation=="horizontal"?n[1].scaleX:n[1].scaleY,!s)break;l=r.orientation=="horizontal"?this.previousScale[1].scaleX:this.previousScale[1].scaleY;c=r.zoomFactor;w=r.zoomPosition;h=this._ensureValueInMinMax(1/r.zoomFactor,1,a);p=this._ensureValueInMinMax(h+h*(s-l)/l,1,a);y=r.orientation=="horizontal"?n[1].center.x/b.Width:1-n[1].center.y/b.Height;r.zoomFactor=this._ensureValueInMinMax(1/p,1/a,1);r.zoomPosition=this._ensureValueInMinMax(w+(c-r.zoomFactor)*y,0,1-r.zoomFactor);o=o||c!=r.zoomFactor;u=u&&r.zoomFactor==1}!o||u||this.chartUpdating?u&&this.zoomed&&!this.chartUpdating&&(this.redraw(!0,!0,i),this.zoomed=!1,this._removeZoomkit()):(this.zoomed=!0,this.redraw(!0,!0,i),this._enableZoomingButtons())}this.previousScale=n},_addTouchPointer:function(n,t,i,r){for(r=n.length;r--;)if(t.pointerId==n[r].pointerId)return i&&(n[r]=t),0;n.push(t)},_removeTouchPointer:function(n,t,i){for(i=n&&n.length;i--;)if(t.pointerId==n[i].pointerId)return n.splice(i,1),0},_copyTouches:function(n){for(var i=[],t=0,r=n.length;t<r;t++)i[t]={pageX:n[t].pageX,pageY:n[t].pageY};return i},_initEventParams:function(){return{touches:[],movements:[]}},_pointerPinchStart:function(n){var t=n.originalEvent,i,u=this.model,r=u.m_AreaBounds,s=$(this.element).offset(),f=this.eventParams||(this.eventParams=this._initEventParams()),e=(t.pageX||t.changedTouches[0].pageX)-s.left,o=(t.pageY||t.changedTouches[0].pageY)-s.top;this.model.selectionEnable&&(this.cancelEvent(n),t.preventDefault());!u.enable3D&&u.AreaType=="cartesianaxes"&&t.pointerType!="mouse"&&t.pointerType!=4&&u.zooming.enable&&u.zooming.enablePinching&&(t.touches||t.pointerId)?(i=n.target.id,i.indexOf("ResetZoom")!=-1?this.resetZoom(n):i.indexOf("panIcon")!=-1?this.startPan(n):i.indexOf("ZoomIcon")!=-1?this.startZoom(n):i.indexOf("ZoomOut")!=-1||i.indexOf("ZoomIn")!=-1?this.startZoomInOut(n):e>r.X&&e<r.X+r.Width&&o>r.Y&&o<r.Y+r.Height?(t.touches?f.touches=this._copyTouches(t.touches):this._addTouchPointer(f.touches,{pageX:e,pageY:o,pointerId:t.pointerId}),f.touches.length<2&&this.chartMouseDown(n)):this.chartMouseDown(n)):this.chartMouseDown(n)},_removeInteractions:function(){$("[id*=_TrackSymbol]").remove();this._removeTrackBall();this._removeHighlight();$("#"+this.svgObject.id+"_TrackToolTip").hide();$("#"+this._id+"_tooltip").remove()},_pinchGestureMove:function(n){var r=n.originalEvent.changedTouches[0],u=n.originalEvent.touches,t=this.model,f=$(this.element).offset(),i=t.m_AreaBounds,e=r.pageX-f.left,o=r.pageY-f.top;this.eventParams=this.eventParams||this._initEventParams(t,r);!t.enable3D&&t.AreaType=="cartesianaxes"&&r.pointerType!="mouse"&&r.pointerType!=4&&t.zooming.enable&&t.zooming.enablePinching&&u?e>i.X&&e<i.X+i.Width&&o>i.Y&&o<i.Y+i.Height?(this._removeInteractions(),u.length>1?this._calculatePinchZoomFactor(this._calculateTouchDistance(this.eventParams.touches,u),t.zooming.type,n.target):this.doPan||this.panning?this._calculatePinchZoomPosition(n):this.chartMouseMove(n)):this.chartMouseMove(n):this.chartMouseMove(n)},_pointerPinchMove:function(n){var u,h=0,i=n.originalEvent,c=$(this.element).offset(),e=i.pageX-c.left,o=i.pageY-c.top,f=this.model,l=this.eventParams||this._initEventParams(f,i),t=l.touches,s=this.previousPointerMove,a=t.length,r=l.movements;if(s!=null&&s.pageX==i.pagex&&s.pageY==i.pageY&&s.pointerId==n.pointerId)return!1;if(!f.enable3D&&f.AreaType=="cartesianaxes"&&i.pointerType!="mouse"&&i.pointerType!=4&&f.zooming.enable&&f.zooming.enablePinching){if(u=f.m_AreaBounds,e>u.X&&e<u.X+u.Width&&o>u.Y&&o<u.Y+u.Height)if(this._addTouchPointer(t,{pageX:e,pageY:o,pointerId:i.pointerId}),t&&t.length>1){for(;h<a;h++)this._addTouchPointer(r,t[h],!1);this._addTouchPointer(r,{pageX:e,pageY:o,pointerId:i.pointerId},!0);r[0].pageX==t[0].pageX&&r[1].pageX==t[1].pageX&&r[0].pageY==t[0].pageY&&r[1].pageY==r[1].pageY||this._calculatePinchZoomFactor(this._calculateTouchDistance(t,r),this.model.zooming.type,n.target)}else this.doPan||this.panning?this._calculatePinchZoomPosition(n):this.chartMouseMove(n);else t.length>0&&this._removeTouchPointer(t,n),r.length>0&&this._removeTouchPointer(r,n),this.chartMouseMove(n);this.previousPointerMove={pageX:e,pageY:o,pointerId:i.pointerId}}else this.chartMouseMove(n)},_pointerPinchEnd:function(n){var i=this.model,t=n.originalEvent,r=this.eventParams||(this.eventParams=this._initEventParams(i,t)),u=t.type.indexOf("leave")!=-1||t.type.indexOf("out")!=-1||t.type.indexOf("Out")!=-1;!i.enable3D&&i.AreaType=="cartesianaxes"&&t.pointerType!="mouse"&&t.pointerType!=4&&i.zooming.enable&&i.zooming.enablePinching&&(t.touches||t.pointerId)?(this.continuePinching!=null&&this.svgObject.removeChild(this.svgObject.firstChild),this.continuePinching=this.previousPanTouch=this.previousScale=null,t.touches?(this.eventParams=null,this.chartMouseUp(n),u&&this.chartMouseLeave(n)):(this._removeTouchPointer(r.touches,{pointerId:t.pointerId}),r.movements.length>0&&this._removeTouchPointer(r.movements,{pointerId:t.pointerId}),r.touches.length==0&&(this.chartMouseUp(n),u&&this.chartMouseLeave(n),this.eventParams=null))):(this.chartMouseUp(n),u&&this.chartMouseLeave(n))},_appendStyle:function(n){var i="#"+n+".e-canvas * {touch-action:none; -ms-touch-action:none}",r=document.head||document.body,t=document.createElement("style");t.type="text/css";t.appendChild(document.createTextNode(i));r.appendChild(t)},bindEvents:function(){var f=jQuery.uaMatch(navigator.userAgent),i=ej.EjSvgRender.utils.browserInfo(),t=i.isMSPointerEnabled,n=i.pointerEnabled,e=t?n?"pointerdown":"MSPointerDown":"touchstart mousedown",o=t?n?"pointerup":"MSPointerUp":"touchend mouseup",s=t?n?"pointermove":"MSPointerMove":"touchmove mousemove",h=t?n?"pointerleave":"MSPointerOut":"touchleave mouseleave",r,u;this.model.browserInfo=i;window.navigator.maxTouchPoints>1&&window.PointerEvent||window.PointerEventsPolyfill?(this._on(this.element,"pointerup pointerleave",this._pointerPinchEnd),this._on(this.element,"pointerdown",this._pointerPinchStart),this._on(this.element,"pointermove",this._pointerPinchMove),this._appendStyle(this.element[0].id)):window.TouchEvent?(this._on(this.element,"touchstart",this._pointerPinchStart),this._on(this.element,"touchmove",this._pinchGestureMove),this._on(this.element,"touchend",this._pointerPinchEnd),this._on($(this.element),"mousedown",this.chartMouseDown),this._on($(this.element),"mousemove",this.chartMouseMove),this._on(this.element,"mouseleave",this.chartMouseLeave),this._on($(document),"mouseup",this.chartMouseUp),this._appendStyle(this.element[0].id)):window.navigator.msMaxTouchPoints&&window.navigator.msPointerEnabled?(this._on(this.element,"MSPointerUp",this._pointerPinchEnd),this._on(this.element,"mouseleave",this.chartMouseLeave),this._on(this.element,"MSPointerDown",this._pointerPinchStart),this._on(this.element,"MSPointerMove",this._pointerPinchMove),this._appendStyle(this.element[0].id)):(this._on(this.element,s,this.chartMouseMove),this._on(this.element,h,this.chartMouseLeave),this._on($(document),o,this.chartMouseUp),this._on($(this.element),e,this.chartMouseDown));this._on($(this.element),"click",this.chartMouseClick);this._on($(this.element),"contextmenu",this.chartRightClick);this._on($(this.element),"dblclick",this.chartMouseDoubleClick);(this.model.canResize||this.model.isResponsive)&&this.bindResizeEvents();r=this.model.zooming.enable||this.model.commonSeriesOptions.dragSettings.enable?"none":"pan-y";$(this.element).css({"ms-touch-action":r,"touch-action":r,"content-zooming":"none"});$(this.element).css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"});u=f.browser.toLowerCase()=="mozilla"?n?"mousewheel":"DOMMouseScroll":"mousewheel";this._on(this.element,u,this.chartMouseWheel)},calZoomFactors:function(n,t,i,r){var u,f;return n==1?(u=1,f=0):(u=ej.EjSvgRender.utils._minMax(1/n,0,1),f=r+(i-u)*t),{zoomMFactor:u,zoomMPosition:f}},doMouseWheelZoom:function(n,t,i){if(n>=1){var r=this.calZoomFactors(n,t,i.zoomFactor,i.zoomPosition);if(i.zoomPosition!=r.zoomMPosition||i.zoomFactor!=r.zoomMFactor)return this.zoomed=!0,i.zoomPosition=r.zoomMPosition,i.zoomFactor=r.zoomMPosition+r.zoomMFactor>1?1-r.zoomMPosition:r.zoomMFactor,!0}return!1},enableAnimation:function(){for(var t,n=0;n<this.model.series.length;n++)t=this.model.series[n],t.enableAnimation=this.serAnimation[n]},disableAnimation:function(){for(var t,n=this,i=0;i<n.model.series.length;i++)n.model.series[i].enableAnimation=!1;for(t=0;t<n.model.indicators.length;t++)n.model.indicators[t].enableAnimation=!1},_removeTrackBall:function(){var t="#"+this.svgObject.id,n;$("#"+this.svgObject.id+"_trackSymbol").remove();$(document).find("#measureTex").remove();this.chartCross.visible&&(n=$(this.svgObject).find(t+"_AxisCrossToolTip"),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),n=$(this.svgObject).find(t+"_CrosshairVertical"),this.svgRenderer._setAttr($(n),{d:"M 0 0"}),n=$(this.svgObject).find(t+"_CrosshairHorizontal"),this.svgRenderer._setAttr($(n),{d:"M 0 0"}),n=$(this.svgObject).find(t+"_TrackAxisToolTip"),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),n=$(this.svgObject).find(t+"_Tracker"),this.svgRenderer._setAttr($(n),{d:"M 0 0"}),n=$(this.svgObject).find('[id*="_TrackToolTip"]'),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),n=$(this.svgObject).find('[id*="_TrackToolTip"]').children(),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),$(n).css("visibility","hidden"),n=$(this.svgObject).find('[id*="_trackSymbol_"]'),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),$(document).find('[id*="_TrackToolTipTemplate_"]').attr("visibility","hidden"),$(document).find('[id*="_TrackToolTipTemplate_"]').css("display","none"),$(t+"_CrosshairVertical").css("display","none"),$(t+"_CrosshairHorizontal").css("display","none"),$("#"+this._id).find('[id*="canvas_AxisToolTipRect"]').css("visibility","hidden"),$("#"+this._id).find('[id*="canvas_Tracker"]').remove(),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden"),$("#"+this._id).find('[id*="_gTooltip_"]').remove(),$("#secondCanvas").remove(),$("#"+this._id).find('[id*="_trackball_grouping_tooltip"]').remove())},enableTrackBall:function(){this.model.crosshair.visible=this.chartCross.visible;this.model.crosshair.type=this.chartCross.mArea},disableTrackBall:function(){this.model.crosshair.visible=!1;this._removeTrackBall()},_enableZoomingButtons:function(){var n=this.svgObject.id,u,t,f,r,i;if(this.model.AreaType!="cartesianaxes"&&($("#"+n+"_ResetZoom").remove(),$("#"+n+"_PanBtn").remove(),$("#"+n+"_ZoomBtn").remove(),$("#"+n+"_ZoomInBtn").remove(),$("#"+n+"_ZoomOutBtn").remove()),this.model.AreaType=="cartesianaxes")for(this._removeZoomkit(),u=this.model.zooming.toolbarItems,t=u.length,i=t-1;i>=0;i--){f=u[i];r=t-i;switch(f){case"reset":this.resetZoomButton(r);break;case"pan":this.panButton(r);break;case"zoom":case"zoomIn":case"zoomOut":this.zoomButton(r,f);break;default:t=t-1}}},chartMouseWheel:function(n){var t,o,u,i,h,c,e;if($("#"+this.svgObject.id+"_TrackToolTip").hide(),this.model.zooming.enableMouseWheel&&this.model.AreaType=="cartesianaxes"&&!this.model.enable3D&&!this.vmlRendering&&ej.util.isNullOrUndefined(this.model.isLazyZooming)){t=this;this.zoomed=!1;var f=!1,r="#"+t.svgObject.id,e=jQuery.uaMatch(navigator.userAgent),l=!!navigator.userAgent.match(/Trident\/7\./),s=n.originalEvent.wheelDelta,a=e.browser.toLowerCase()=="mozilla"?l?s/120>0?1:-1:-n.originalEvent.detail/3>0?1:-1:s/120>0?1:-1;for(u=0;u<this.model._axes.length;u++)i=this.model._axes[u],(i.orientation.toLowerCase()=="vertical"&&(t.model.zooming.type.toLowerCase()=="y"||t.model.zooming.type.trim().toLowerCase()=="x,y")||i.orientation.toLowerCase()=="horizontal"&&(t.model.zooming.type.toLowerCase()=="x"||t.model.zooming.type.trim().toLowerCase()=="x,y"))&&(h=Math.max(1/ej.EjSvgRender.utils._minMax(i.zoomFactor,0,1),1),c=Math.max(h+.25*a,1),f=f|t.doMouseWheelZoom(c,.5,i)),i.zoomFactor!=1&&i.zoomPosition!=0&&(o=!0);this._updateScroll();this.disableAnimation();this.disableTrackBall();f&&(this.model.legendCollapsed=!1,this.zoomed=!0,t.redraw(!0));this.model._chartAreaZoom=!0;this._enableZoomingButtons();this.mouseWheelCoords={x:n.originalEvent.pageX,y:n.originalEvent.pageY};o||($(r+"_ResetZoom").remove(),$(r+"_PanBtn").remove(),$(r+"_ZoomBtn").remove(),$(r+"_ZoomInBtn").remove(),$(r+"_ZoomOutBtn").remove(),this.enableAnimation(),this.panning=!1);e=jQuery.uaMatch(navigator.userAgent);n.preventDefault&&e.browser=="chrome"&&this.model.zooming.enable&&n.preventDefault();n.returnValue=!1}$(".tooltipDiv"+this._id).remove()},getAxisMultiLevelLabelsData:function(n){var f=this.calMousePosition(n),s=this.model.multiLevelLabelRegions.length,t,r,u,e,o,i;for(this.mousemoveX=f.X,this.mousemoveY=f.Y,i=0;i<s;i++)if(t=this.model.multiLevelLabelRegions[i],r=t.bounds.x,u=t.bounds.y,e=t.bounds.height,o=t.bounds.width,this.mousemoveX>=r&&this.mousemoveX<=r+o&&this.mousemoveY<=u+e&&this.mousemoveY>=u)return data={location:{x:this.mousemoveX,y:this.mousemoveY},axis:this.model._axes[t.axisIndex],multiLevelLabel:t.multiLevelLabel}},getAxisLabelData:function(n){var c=this.calMousePosition(n),e=n.target.id,r,u,f,s,h,o,l,a=this.model._axes.length,t,i;if(this.mousemoveX=c.X,this.mousemoveY=c.Y,this.model.AreaType=="cartesianaxes"||this.model.AreaType=="polaraxes")if(this.model.enable3D){if(e.indexOf("horizontal")>=0||e.indexOf("vertical")>=0)for(t=0;t<a;t++)for(o=this.model._axes[t].visibleLabels.length,i=0;i<o;i++)if(e==this.svgObject.id+this.model._axes[t].orientation+i)return{location:{x:this.mousemoveX,y:this.mousemoveY},index:i,axis:this.model._axes[t],text:this.model._axes[t].visibleLabels[i].Text}}else for(t=0;t<a;t++)if(o=this.model._axes[t].visibleLabels.length,l=this.model._axes[t].visible,l)for(i=0;i<o;i++)if(r=this.model._axes[t].visibleLabels[i].region,!ej.util.isNullOrUndefined(r)&&(u=r.bounds.x,f=r.bounds.y,s=r.bounds.width,h=r.bounds.height,u=this.vmlRendering&&e.indexOf("_YLabel_")>=0?this.model._axes[t].opposedPosition?u:u+s:u,this.mousemoveX>=u&&this.mousemoveX<=u+s&&(this.vmlRendering?this.mousemoveY<=f+h&&this.mousemoveY>=f:this.mousemoveY>=f-h&&this.mousemoveY<=f)))return{location:{x:this.mousemoveX,y:this.mousemoveY},index:i,axis:this.model._axes[t],text:r.labelText}},getLegendData:function(n){var t=this.calMousePosition(n);t.X-=parseFloat($(this.element).css("padding-left"));t.Y-=parseFloat($(this.element).css("padding-top"));var u=this.model.legend._ejScroller,f=u?$("#legend_"+this._id).ejScroller("instance").model.scrollTop:$("#legend_"+this._id).scrollTop(),e=u?$("#legend_"+this._id).ejScroller("instance").model.scrollLeft:$("#legend_"+this._id).scrollLeft();this.scrolltop=f;this.scrollleft=e;this.mousemoveX=t.X+e;this.mousemoveY=t.Y+f;var o=n.target.id,s=this.mousemoveX,h=this.mousemoveY,r=this._id,i;return(!ej.util.isNullOrUndefined(o)&&this.svgRenderer._getAttrVal($(n.target).parents(":eq(1)"),"id")==this.svgObject.id+"_Legend"||this.model.enableCanvasRendering&&o=="legend_"+r+"_canvas"||this.vmlRendering)&&($.each(this.model.legendRegion,function(n,t){s>=t.Bounds.LegendBound.X+t.Bounds.ItemBound.X&&s<=t.Bounds.LegendBound.X+t.Bounds.ItemBound.X+t.Bounds.ItemBound._Width&&(h>=t.Bounds.LegendBound.Y+t.Bounds.ItemBound.Y-t.Bounds.ItemBound.Height/4&&h<=t.Bounds.LegendBound.Y+t.Bounds.ItemBound.Y+t.Bounds.ItemBound.Height?(i=t,$("#legend_"+r+"_canvas").css("cursor","pointer")):$("#legend_"+r+"_canvas").css("cursor","default"))}),!ej.util.isNullOrUndefined(i))?{legendItem:i,series:this.model._visibleSeries[i.LegendItem.SeriesIndex]}:!1},get3DSeriesPoint:function(n){var i=this.mousemoveX,r=this.mousemoveY,e=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.X,o=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.Y,s=this.model.AreaType=="polaraxes"?$(this.svgObject).width():this.model.m_AreaBounds.Width,h=this.model.AreaType=="polaraxes"?$(this.svgObject).height():this.model.m_AreaBounds.Height,u,t,f;if(i>e&&i<e+s&&r>o&&r<o+h&&(u=$(n.target)[0].nodeName,(u=="path"||u=="shape")&&$(n.target)[0].id.indexOf("Region")>1))return index=$(n.target)[0].id.match(/(\d+)/g),pointIndex=parseInt(index[index.length-1]),seriesIndex=parseInt(index[index.length-2]),t={},t.Region={},t.Region.PointIndex=pointIndex,t.SeriesIndex=seriesIndex,f={},f.pointIndex=pointIndex,region={region:t,pointData:f,location:{x:i,y:r}}},GetSeriesPoint:function(n){for(var c,r,l,y,i,k,d,u=this.mousemoveX,f=this.mousemoveY,o,t=this,a=t.model.indicators,v=t.model._visibleSeries,e=0;e<a.length&&a[e].segment;e++)v=v.concat(a[e].segment);if(t.model.enable3D)return this.get3DSeriesPoint(n);var w=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.X,b=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.Y,g=this.model.AreaType=="polaraxes"?$(this.svgObject).width():this.model.m_AreaBounds.Width,nt=this.model.AreaType=="polaraxes"?$(this.svgObject).height():this.model.m_AreaBounds.Height;if(this.model.AreaType=="cartesianaxes"||this.model.AreaType=="polaraxes"){if(u>w&&u<w+g&&f>b&&f<b+nt&&$.each(this.model.chartRegions,function(i,e){var k,rt,ut,h,d,et,vt,y,b,l,a,s,p,g;if(ej.util.isNullOrUndefined(e.SeriesIndex)){if(r=t.model.chartRegions,vt={},!e.isStripLine){var ht=e.length,yt=t.model.requireInvertedAxes,pt=yt?t.model.series[e[ht-1].SeriesIndex]._xAxisName:t.model.series[e[ht-1].SeriesIndex]._yAxisName;for(b=0;b<t.model._axes.length;b++)if(pt==t.model._axes[b].name){y=t.model._axes[b];break}for(l=0;l<r.length;l++)for(a=0;a<r[l].length;a++)s=[],line1=r[l][a].region,line1[0]&&s.push({x:line1[0].X+y.x,y:line1[0].Y+y.y}),line1[1]&&s.push({x:line1[1].X+y.x,y:line1[1].Y+y.y}),line1[2]&&s.push({x:line1[2].X+y.x,y:line1[2].Y+y.y}),line1[3]&&s.push({x:line1[3].X+y.x,y:line1[3].Y+y.y}),p={x:u,y:f},g=t.isPointInPolygon(s,p),g&&(o=r[l][a])}}else if(k=v[e.SeriesIndex],t.model.AreaType=="polaraxes"&&k.drawType.toLowerCase()=="column"&&n.target){if(t.model.enableCanvasRendering){if(k.type.toLowerCase()=="polar"){var h=e.Region.Bounds,ct=-.5*Math.PI,lt=h.innerRadius,nt,tt;nt=u-h.CenterX;tt=f-h.CenterY;var ot=t.model._visibleSeries[e.SeriesIndex],at=ot.startAngle,wt=ot.endAngle,it=at?2*Math.PI*(t.model.itemCurrentXPos<0?1+t.model.itemCurrentXPos:t.model.itemCurrentXPos):0,w=(Math.atan2(tt,nt)-ct-it)%(2*Math.PI);w<0&&h.PointIndex!=0&&(w=2*Math.PI+w);rt=parseFloat(h.StartAngle.toFixed(14));ut=parseFloat(h.EndAngle.toFixed(14));rt-=it;ut-=it;w>=rt&&w<=ut&&(i=h.PointIndex,c=Math.sqrt(Math.pow(Math.abs(nt),2)+Math.pow(Math.abs(tt),2)),c<=h.Radius&&c>lt&&(d={Region:{PointIndex:i},SeriesIndex:e.SeriesIndex,type:e.type},o=d))}else if(k.type.toLowerCase()=="radar"&&(h=e.Region.Bounds,h.Line1)){line1=h.Line1;line2=h.Line2;line3=h.Line3;for(var s=[{x:line1.x,y:line1.y},{x:line2.x,y:line2.y},{x:line3.x,y:line3.y},],p={x:u,y:f},g=!1,ft=!1,l=-1,st=s.length,a=st-1;++l<st;a=l)(s[l].y<=p.y&&p.y<s[a].y||s[a].y<=p.y&&p.y<s[l].y)&&p.x<(s[a].x-s[l].x)*(p.y-s[l].y)/(s[a].y-s[l].y)+s[l].x&&(ft=!ft);g=ft;g&&(i=h.PointIndex,d={Region:{PointIndex:i},SeriesIndex:e.SeriesIndex,type:e.type},o=d)}}else if(et=$(n.target)[0].nodeName,(et=="path"||et=="shape")&&$($(n.target).parent())[0].id==t.svgObject.id+"_SeriesGroup_"+e.SeriesIndex)return i=$(n.target)[0].id.match(/(\d+)/g),pointIndex=parseInt(i[i.length-1]),e={Region:{PointIndex:pointIndex},SeriesIndex:e.SeriesIndex,type:e.type},o=e,!1}else u>=e.Region.Bounds.X&&u<=e.Region.Bounds.X+e.Region.Bounds.Width&&f>e.Region.Bounds.Y&&f<e.Region.Bounds.Y+e.Region.Bounds.Height&&(o=e)}),o)return{region:o,location:{x:u,y:f}}}else if(t=this,l=t.model.chartRegions,l.length>0&&(l[0].Series.type.toLowerCase()=="pyramid"||l[0].Series.type.toLowerCase()=="funnel")){if(y=$(n.target)[0].nodeName,(y=="path"||y=="shape")&&$($(n.target).parent())[0].id==t.svgObject.id+"_SeriesGroup_"+l[0].SeriesIndex)return r=t.model.chartRegions[0],index=$(n.target)[0].id.match(/(\d+)/g),index=parseInt(index[index.length-1]),r.Region.PointIndex=index,i={},i.pointIndex=index,o={region:r,pointData:i,location:{x:u,y:f}};r=l[0];var s=this.pyrX,h=this.pyrY,i={},p;for(e=0;e<r.Region.length;e++)if(line1=r.Region[e].Line1,line2=r.Region[e].Line2,line3=r.Region[e].Line3,line4=r.Region[e].Line4,l[0].Series.type.toLowerCase()=="pyramid"?p=[{x:line1.x+s,y:line1.y+h},{x:line2.x+s,y:line2.y+h},{x:line3.x+s,y:line3.y+h},{x:line4.x+s,y:line4.y+h}]:(line5=r.Region[e].Line5,line6=r.Region[e].Line6,p=[{x:line1.x+s,y:line1.y+h},{x:line2.x+s,y:line2.y+h},{x:line3.x+s,y:line3.y+h},{x:line4.x+s,y:line4.y+h},{x:line5.x+s,y:line5.y+h},{x:line6.x+s,y:line6.y+h}]),k={x:u,y:f},d=this.isPointInPolygon(p,k),d)return i.pointIndex=r.Region[e].PointIndex,r.Region.PointIndex=i.pointIndex,o={region:r,pointData:i,location:{x:u,y:f}}}else return $.each(t.model.chartRegions,function(n,r){var g=-.5*Math.PI,w=r.SeriesData,l=r.Region,nt=t.model._visibleSeries[r.SeriesIndex].type.toLowerCase()=="doughnut"?w.DRadius:0,k,d,tt,p,h,v,e,s,it,rt,ut;k=u-w.CenterX;d=f-w.CenterY;var a=t.model._visibleSeries[r.SeriesIndex],b=a.startAngle,y=a.endAngle;if(b=b<0?b+360:b,y=y<0?y+360:y,tt=a.endAngle-a.startAngle,tt<0){for(y=y/360,p=y?2*Math.PI*(y<0?1+y:y):0,h=(Math.atan2(d,k)-g-p)%(2*Math.PI),h<0&&(h=2*Math.PI+h),i=[],v=0;v<l.length;v++)if(e=parseFloat(l[v].StartAngle.toFixed(14)),s=parseFloat(l[v].EndAngle.toFixed(14)),e=e<0?2*Math.PI+e:e,s=s<0?2*Math.PI+s:s,e-=p,s-=p,e=parseFloat(e.toFixed(14)),s=parseFloat(s.toFixed(14)),a.startAngle>=0&&a.endAngle<=0&&(e=e<=0?2*Math.PI+e:e,s=s<0?2*Math.PI+s:s),h<=e&&h>=s){i.push(l[v]);break}}else for(p=b?2*Math.PI*(t.model.itemCurrentXPos<0?1+t.model.itemCurrentXPos:t.model.itemCurrentXPos):0,h=(Math.atan2(d,k)-g-p)%(2*Math.PI),h<0&&(h=t.model._isPieOfPie?h:2*Math.PI+h),i=[],v=0;v<l.length;v++)if(e=parseFloat(l[v].StartAngle.toFixed(14)),s=parseFloat(l[v].EndAngle.toFixed(14)),e=e<0?t.model._isPieOfPie?e:2*Math.PI+e:e,s=s<0?2*Math.PI+s:s,e-=p,s-=p,e=parseFloat(e.toFixed(14)),s=parseFloat(s.toFixed(14)),a.startAngle<0&&(a.endAngle>-1||a.endAngle==null)&&(e=e<0?2*Math.PI+e:e,s=s<=0?2*Math.PI+s:s),h+2*Math.PI<s&&a.type=="pieofpie"&&(h=h+2*Math.PI),h>=e&&h<=s){i.push(l[v]);break}i.length>0&&(it=a.explodeAll||a.explodeIndex==i[0].PointIndex,it?(rt=u-i[0].StartX,ut=f-i[0].StartY,i.length>0&&(c=Math.sqrt(Math.pow(Math.abs(rt),2)+Math.pow(Math.abs(ut),2)),c<=w.Radius&&c>nt&&(l.PointIndex=i[0].PointIndex,l.SeriesIndex=i[0].SeriesIndex,o={region:r,pointData:i,location:{x:u,y:f}}))):(c=Math.sqrt(Math.pow(Math.abs(k),2)+Math.pow(Math.abs(d),2)),c<=w.Radius&&c>nt&&(l.PointIndex=i[0].PointIndex,l.SeriesIndex=i[0].SeriesIndex,o={region:r,pointData:i,location:{x:u,y:f}})))}),o},isPointInPolygon:function(n,t){for(var u=!1,i=-1,f=n.length,r=f-1;++i<f;r=i)(n[i].y<=t.y&&t.y<n[r].y||n[r].y<=t.y&&t.y<n[i].y)&&t.x<(n[r].x-n[i].x)*(t.y-n[i].y)/(n[r].y-n[i].y)+n[i].x&&(u=!u);return u},mousePosition:function(n){if(!ej.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!ej.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=undefined){if(!ej.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},calMousePosition:function(n){var u=jQuery.uaMatch(navigator.userAgent),t=this.mousePosition(n),i,r,f;return n.pageX=t.x,n.pageY=t.y,f=u.browser.toLowerCase(),i=n.pageX-$(this.svgObject).offset().left,r=n.pageY-$(this.svgObject).offset().top,{X:i,Y:r}},calTouchPosition:function(n){var u=jQuery.uaMatch(navigator.userAgent),i,r,t;return u.browser.toLowerCase()=="mozilla"||u.browser.toLowerCase()=="webkit"?(t=n.originalEvent.touches[0],i=t.pageX-$(this.svgObject).parent().offset().left,r=t.pageY-$(this.svgObject).parent().offset().top,this.leftPadding=$(this.svgObject).offset().left,this.grabPadding=0):u.browser.toLowerCase()=="msie"?(i=n.originalEvent.pageX-$(this.svgObject).offset().left,r=n.originalEvent.pageY-$(this.svgObject).offset().top,this.leftPadding=$(this.svgObject).offset().left):(t=n.originalEvent.touches[0],i=t.pageX-$(this.svgObject).offset().left,r=t.pageY-$(this.svgObject).offset().top,this.leftPadding=$(this.svgObject).offset().left),{X:i,Y:r}},cancelEvent:function(n){n.stopPropagation();var t=jQuery.uaMatch(navigator.userAgent);return t.browser=="chrome"&&(this.model.zooming.enable||this.model.crosshair.visible)&&n.preventDefault(),this.model.enable3D&&(n.preventDefault(),n.stopPropagation()),n.returnValue=!1,n.cancelBubble=!0,!1},resetZoom:function(){var n=this,t="#"+this.svgObject.id;$(".tooltipDiv"+this._id).remove();$(".zoom"+this._id).remove();n.zoomed&&($.each(this.model._axes,function(n,t){t.zoomed=!1;t.zoomFactor=1;t.zoomPosition=0}),n.model.primaryXAxis.zoomFactor=1,n.model.primaryYAxis.zoomFactor=1,n.model.primaryXAxis.zoomPosition=0,n.model.primaryYAxis.zoomPosition=0,$("#"+n._id+"_canvas").css({cursor:"default"}),$(t+"_ResetZoom").remove(),$(t+"_PanBtn").remove(),$(t+"_ZoomBtn").remove(),$(t+"_ZoomInBtn").remove(),$(t+"_ZoomOutBtn").remove(),n.zoomed=!1,n.zooming=!1,n.panning=!1,n.model._chartAreaZoom=!1,n.resetZooming=!0,n.enableTrackBall(),n.redraw(),n.enableAnimation(),n.svgRenderer._setAttr($(n.svgObject).find(t+"_XAxis,"+t+"_ChartArea,"+t+"_YAxis,"+t+"_SeriesCollection"),{cursor:"default"}))},startZoomInOut:function(n){var s=n.target.id.indexOf("ZoomIn")>-1?"zoomIn":"zoomOut",e;this.drag=!1;this.zoomed=!0;var i=this.model.zooming.type.toLowerCase(),r=s=="zoomIn"?.2:-.2,o=!0,t,u,f;for(e=0;e<this.model._axes.length;e++)t=this.model._axes[e],u=t.zoomFactor,f=t.zoomPosition,t.orientation.toLowerCase()=="horizontal"?(t.zoomFactor=i!="y"?u-r:t.zoomFactor,t.zoomPosition=i!="y"?f+r:t.zoomPosition):(t.zoomFactor=i!="x"?u-r:t.zoomFactor,t.zoomPosition=i!="x"?f+r:t.zoomPosition),parseFloat(t.zoomFactor.toFixed(3))<=.001&&(t.zoomFactor=u,t.zoomPosition=f),parseFloat(t.zoomFactor.toFixed(3))>=1&&(t.zoomFactor=1,t.zoomPosition=0),o=o&&t.zoomFactor==1;this._updateScroll();this.redraw(!0);o?(this._removeZoomkit(),this.resetZooming=!0,this.zoomed=this.panning=!1,this.model._chartAreaZoom=!1):this._enableZoomingButtons()},startZoom:function(){var n=this,t="#"+this.svgObject.id,i;$(".tooltipDiv"+this._id).remove();i=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF";n.svgRenderer._setAttr($(t+"_ZoomBtn"),{selected:"true"});n.svgRenderer._setAttr($(t+"_ZoomPath"),{fill:"#14B9FF"});n.svgRenderer._setAttr($(t+"_ZoomIcon"),{fill:"#FFFFFF"});n.svgRenderer._setAttr($(t+"_PanPath"),{fill:"#B7B7B7"});n.svgRenderer._setAttr($(t+"_panIcon"),{fill:i});$(t+"_ZoomBtn").css({"border-color":"#14B9FF","background-color":"#14B9FF"});$(t+"_PanBtn").css({"border-color":"#B7B7B7","background-color":"#B7B7B7"});$("#"+n._id+"_canvas").css({cursor:"default"});this._cursorToDefault();n.panning=!1;n.enableTrackBall()},startPan:function(){var n=this,t="#"+this.svgObject.id,i;$(".tooltipDiv"+this._id).remove();i=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF";n.svgRenderer._setAttr($(t+"_ZoomBtn"),{selected:"false"});n.svgRenderer._setAttr($(t+"_PanBtn"),{selected:"true"});n.svgRenderer._setAttr($(t+"_ZoomPath"),{fill:"#B7B7B7"});n.svgRenderer._setAttr($(t+"_ZoomIcon"),{fill:i});n.svgRenderer._setAttr($(t+"_PanPath"),{fill:"#14B9FF"});n.svgRenderer._setAttr($(t+"_panIcon"),{fill:"#FFFFFF"});$(t+"_ZoomBtn").css({"border-color":"#B7B7B7","background-color":"#B7B7B7"});$(t+"_PanBtn").css({"border-color":"#14B9FF","background-color":"#14B9FF"});$("#"+n._id+"_canvas").css({cursor:"pointer"});this._cursorToPointer();n.panning=!0;n.disableTrackBall()},zoomButton:function(n,t){var i=t=="zoom"?"_Zoom":t=="zoomIn"?"_ZoomIn":"_ZoomOut";var u=n*5+5,r={left:0,top:0},f=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-n*32-u),e=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),o=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",s={id:this.svgObject.id+i+"Path",d:"M32,27c0,2.75-2.25,5-5,5H5c-2.75,0-5-2.25-5-5V5c0-2.75,2.25-5,5-5h22c2.75,0,5,2.25,5,5V27z",fill:this.panning||t=="zoomIn"||t=="zoomOut"?"#b7b7b7":"#14B9FF",zoomId:this._id+i+"Btn",width:26,height:26,left:f+r.left,top:e+r.top,iconColor:o};ej.EjCanvasRender.prototype.zoomButton(s,t,this);t=="zoom"?this._on($("#"+this.svgObject.id+i+"Btn"),"touchstart click",this.startZoom):this._on($("#"+this.svgObject.id+i+"Btn"),"touchstart click",this.startZoomInOut)},panButton:function(n){var i=n*5+5,t={left:0,top:0},r=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-n*32-i),u=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),f=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",e={id:this.svgObject.id+"_PanPath",d:"M 32 27 c 0 2.75 -2.25 5 -5 5 H 5 c -2.75 0 -5 -2.25 -5 -5 V 5 c 0 -2.75 2.25 -5 5 -5 h 22 c 2.75 0 5 2.25 5 5 V 27 Z",fill:this.panning?"#14B9FF":"#b7b7b7",panId:this._id+"_PanBtn",width:26,height:26,left:r+t.left,top:u+t.top,iconColor:f};ej.EjCanvasRender.prototype.panButton(e,this);this._on($("#"+this.svgObject.id+"_PanBtn"),"touchstart click",this.startPan)},resetZoomButton:function(n){var r=n*5+5,t={left:0,top:0},u=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-(n*32+r)),f=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),e=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",o={id:this.svgObject.id+"_ResetZoomPath",d:"M 32 27 c 0 2.75 -2.25 5 -5 5 H 5 c -2.75 0 -5 -2.25 -5 -5 V 5 c 0 -2.75 2.25 -5 5 -5 h 22 c 2.75 0 5 2.25 5 5 V 27 Z",fill:"#b7b7b7",resetZoomId:this._id+"_ResetZoom",width:26,height:26,left:u+t.left,top:f+t.top,iconColor:e},i;ej.EjCanvasRender.prototype.resetZoom(o,this);i=(window.TouchEvent?"touchstart":window.PointerEvent?"pointerdown":window.MSPointerEvent?"MSPointerDown":"click")+" click";this._on($("#"+this.svgObject.id+"_ResetZoom"),i,this.resetZoom)},doZoom:function(n,t,i){var e=this,d,g,o,r,y;if(this.model._chartAreaZoom=!0,this.scrollDraw=!0,$(".tooltipDiv"+this._id).remove(),e.model.enableCanvasRendering)var b=$("#"+this.svgObject.id+"_ZoomArea")[0].getClientRects()[0],k=$("#"+this.svgObject.id)[0].getClientRects()[0],d=b.left-k.left-$(document).scrollLeft(),g=b.top-k.top-$(document).scrollTop();else d=parseFloat(e.svgRenderer._getAttrVal($(n),"x")),g=parseFloat(e.svgRenderer._getAttrVal($(n),"y"));for($("#"+this.svgObject.id+"_ZoomArea").remove(),this.drag=!1,this.zoomed=!0,r=0;r<this.model._axes.length;r++){var u=this.model._axes[r],h=u.zoomFactor,a=u.zoomPosition;u.orientation.toLowerCase()=="horizontal"?(u.zoomFactor=e.model.zooming.type.toLowerCase()!="y"?h*(t/e.model.m_AreaBounds.Width):u.zoomFactor,u.zoomPosition=e.model.zooming.type.toLowerCase()!="y"?a+Math.abs((d-e.model.m_AreaBounds.X)/e.model.m_AreaBounds.Width)*h:u.zoomPosition,parseFloat(u.zoomFactor.toFixed(3))<=.001&&(u.zoomFactor=h,u.zoomPosition=a)):(u.zoomFactor=e.model.zooming.type.toLowerCase()!="x"?h*i/e.model.m_AreaBounds.Height:u.zoomFactor,u.zoomPosition=e.model.zooming.type.toLowerCase()!="x"?a+(1-Math.abs((i+(g-e.model.m_AreaBounds.Y))/e.model.m_AreaBounds.Height))*h:u.zoomPosition,parseFloat(u.zoomFactor.toFixed(3))<=.001&&(u.zoomFactor=h,u.zoomPosition=a))}var s=this.model._visibleSeries,it=s.length,c=[],nt=[],f=[],l,v,p,w,tt;for(o=0;o<it;o++){if(s[o].visibility=="visible")for(f=s[o].points,tt=f.length,l=s[o].type.toLowerCase(),v=new ej.axisTypes[s[o].xAxis._valueType.toLowerCase()],v._calculateVisibleRange(s[o].xAxis,e),v=new ej.axisTypes[s[o].yAxis._valueType.toLowerCase()],v._calculateVisibleRange(s[o].yAxis,e),p=s[o].xAxis.visibleRange,w=s[o].yAxis.visibleRange,r=0;r<tt;r++)p.min<=f[r].xValue&&p.max>=f[r].xValue&&w.min<=f[r].y&&w.max>=f[r].y&&(s[o]._hiloTypes?l=="rangearea"||l=="rangecolumn"||l=="waterfall"||l=="hilo"?c.push({XValue:f[r].x,High:f[r].high,Low:f[r].low}):c.push({XValue:f[r].x,High:f[r].high,Low:f[r].low,Open:f[r].open,Close:f[r].close}):c.push({XValue:f[r].x,YValue:f[r].y}));c.length!=0&&nt.push({selectedData:c});c=[]}y=$.extend({},ej.EjSvgRender.commonChartEventArgs);y.data={};y.data.series=nt;this._trigger("zoomed",y);this.disableAnimation();this.model.legendCollapsed=!1;this.redraw(!0);this._enableZoomingButtons()},_cursorToDefault:function(){var n="#"+this.svgObject.id;this.svgRenderer._setAttr($(this.svgObject).find(n+"_XAxis,"+n+"_ChartArea,"+n+"_YAxis,"+n+"_SeriesCollection,"+n+"_StriplineBehind,"+n+"_StriplineOver"),{cursor:"default"})},_cursorToPointer:function(){var n="#"+this.svgObject.id;this.svgRenderer._setAttr($(this.svgObject).find(n+"_XAxis,"+n+"_ChartArea,"+n+"_YAxis,"+n+"_SeriesCollection,"+n+"_StriplineBehind,"+n+"_StriplineOver"),{cursor:"pointer"})},removeMultiRect:function(){$(this.parentgEle).empty();this.model.selectedDataCollection=[]},multiSelectDataCalculation:function(){for(var lt,at,n,ut,tt,gt=this,i=[],it=this.selectedRectIndex,vt=this.oldRectX[it],yt=this.oldRectY[it],pt=this.oldRectWidth[it],ot=this.oldRectHeight[it],d=1,ft=0,st=this.model.series,wt=st.length,rt=this.multiAxis,bt=rt.length,kt=this.multiSelectType,c,w,g,y,p,e,o,t,f,b,a,v,u,ht,ct,ni=this.model.AreaType.toLowerCase(),s,l,dt,h,et,nt,r,k=0;k<wt;k++){if(r=st[k],ht=r.xAxis.visibleRange,ct=r.yAxis.visibleRange,lt=rt.some(function(n){return n.name.toLowerCase()==r._xAxisName.toLowerCase()}),at=rt.some(function(n){return n.name.toLowerCase()==r._yAxisName.toLowerCase()}),nt=r.selectionSettings,lt&&at&&r.visibility.toLowerCase()=="visible"){for(n=0;n<bt;n++)c=rt[n],w=d,g=ft,c.orientation.toLowerCase()=="horizontal"?(this.selectFactor=nt.rangeType.toLowerCase()!="y"?w*(pt/this.multiAxis[n].width):d,this.selectPosition=nt.rangeType.toLowerCase()!="y"?g+Math.abs((vt-this.multiAxis[n].x)/this.multiAxis[n].width)*w:ft,parseFloat(d.toFixed(3))<=.001&&(this.selectFactor=w,this.selectPosition=g)):(this.selectFactor=nt.rangeType.toLowerCase()!="x"?w*ot/this.multiAxis[n].height:d,this.selectPosition=nt.rangeType.toLowerCase()!="x"?g+(1-Math.abs((ot+(yt-this.multiAxis[n].y))/this.multiAxis[n].height))*w:ft,parseFloat(d.toFixed(3))<=.001&&(this.selectFactor=w,this.selectPosition=g)),c.visibleRange=$.extend(!0,{},c.actualRange),(this.selectFactor<1||this.selectPosition>0)&&(b=c.valueType=="logarithmic"?c.visibleRange:c.actualRange,this.selectFactor=this.selectFactor>1?1:this.selectFactor<0?0:this.selectFactor,this.selectPosition=this.selectPosition<0?0:this.selectPosition>1?1:this.selectPosition,c.isInversed?(a=c.actualRange.max-this.selectPosition*c.actualRange.delta,v=a-this.selectFactor*c.actualRange.delta,dt=!0):(a=Math.abs(c.actualRange.min+this.selectPosition*c.actualRange.delta),v=a+this.selectFactor*c.actualRange.delta),a<b.min&&(v=v+(b.min-a),a=b.min),v>b.max&&(a=a-(v-b.max),v=b.max),c.valueType=="logarithmic"&&(a=Math.pow(10,a),v=Math.pow(10,v)),c.visibleRange.min=Math.min(a,v),c.visibleRange.max=Math.max(a,v));t=r._visiblePoints;f=r.type.toLowerCase();et=r.isTransposed;y=r.xAxis.visibleRange.min;p=r.xAxis.visibleRange.max;e=r.yAxis.visibleRange.min;o=r.yAxis.visibleRange.max;ej.util.isNullOrUndefined(i)&&(i=[]);switch(kt){case"x":for(n=0;n<t.length;n++)t[n].seriesIndex=k,u=t[n].isEmpty,s=t[n].xValue,l=t[n].y,r.xAxis.isInversed||r.yAxis.isInversed?f.indexOf("bar")>=0?f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&o>=h&&e<=h&&i.push(t[n])):f=="waterfall"&&!u&&o>=t[n].YValues[0]&&e<=t[n].YValues[0]?i.push(t[n]):!u&&o>=l&&e<=l&&i.push(t[n]):!u&&p>=s&&y<=s&&i.push(t[n]):et&&f.indexOf("bar")>=0?!u&&y<=s&&p>=s&&i.push(t[n]):f.indexOf("bar")>=0||r.isTransposed&&!(f.indexOf("bar")>=0)?f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&e<=l&&o>=l&&i.push(t[n]):!u&&y<=s&&p>=s&&i.push(t[n]);break;case"y":for(n=0;n<t.length;n++)t[n].seriesIndex=k,u=t[n].isEmpty,s=t[n].xValue,l=t[n].y,r.xAxis.isInversed||r.yAxis.isInversed?f.indexOf("bar")>=0?!u&&p>=s&&y<=s&&i.push(t[n]):f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&o>=t[n].YValues[0]&&e<=t[n].YValues[0]?i.push(t[n]):!u&&o>=l&&e<=l&&i.push(t[n]):et&&f.indexOf("bar")>=0?f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&e<=l&&o>=l&&i.push(t[n]):f.indexOf("bar")>=0||r.isTransposed&&!(f.indexOf("bar")>=0)?!u&&y<=s&&p>=s&&i.push(t[n]):f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&e<=l&&o>=l&&i.push(t[n]);break;case"xy":for(n=0;n<t.length;n++)t[n].seriesIndex=k,u=t[n].isEmpty,s=t[n].xValue,l=t[n].y,f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&p>=s&&y<=s&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&p>=s&&y<=s&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&p>=s&&y<=s&&e<=l&&o>=l&&i.push(t[n])}}r.xAxis.visibleRange=ht;r.yAxis.visibleRange=ct}ut=this.currentIndex;ej.util.isNullOrUndefined(this.model.selectedDataCollection)&&(this.model.selectedDataCollection=[]);this.removeRect?this.model.selectedDataCollection.splice(ut,1):this.rectPan||this.resize?(this.model.selectedDataCollection[ut]=0,this.model.selectedDataCollection[ut]=i):this.model.selectedDataCollection[this.model.selectedDataCollection.length]=i;tt=$.extend({},ej.EjSvgRender.commonChartEventArgs);tt.data={};tt.data.selectedData=i;tt.data.selectedDataCollection=this.model.selectedDataCollection;this._trigger("rangeSelected",tt)},multiSelectMouseUp:function(n){var a,v,y,p,w,b,k,d,s,g;if(this._isMultiSelect&&this.multiSelectMode=="range"){var h,c,l,i=this.svgObject.id,t=this.selectedRectIndex,e="#"+i+"_selectRect",r=parseInt($(e+t).attr("width")),o=parseInt($(e+t).attr("height")),u=parseInt($(e+t).attr("x")),f=parseInt($(e+t).attr("y"));if((this.multiSelectDraw||!this.removeRect||!this.resize||!this.rectPan)&&r>0&&o>0){for(a={id:i+"_resize_rightRect"+t,x:u+r-5,y:f+10,width:10,height:o-20>0?o-20:0,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"e-resize"},this.svgRenderer.drawRect(a,this.gEle),v={id:i+"_resize_bottomRect"+t,x:u,y:f+o-5,width:r-10>0?r-10:0,height:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"s-resize"},this.svgRenderer.drawRect(v,this.gEle),y={id:i+"_resize_leftRect"+t,x:u-5,y:f,width:10,height:o,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"w-resize"},this.svgRenderer.drawRect(y,this.gEle),p={id:i+"_resize_topRect"+t,x:u,y:f-5,width:r-10>0?r-10:0,height:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"n-resize"},this.svgRenderer.drawRect(p,this.gEle),w={id:i+"_resize_bottomRightCornerCircle"+t,cx:u+r,cy:f+o,r:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"se-resize"},this.svgRenderer.drawCircle(w,this.gEle),b={id:i+"_closeTopRightCornerCircle"+t,cx:u+r,cy:f,r:10,fill:"white",stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawCircle(b,this.gEle),k={id:i+"_closePath"+t,x1:u+r-4,y1:f-4,x2:u+r+4,y2:f+4,stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawLine(k,this.gEle),d={id:i+"_closePathOpposite"+t,x1:u+r+4,y1:f-4,x2:u+r-4,y2:f+4,stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawLine(d,this.gEle),h=[16,10,4,10,4,4],c=[4,4,4,10,10,16],l=["a","b","c","d","e","f"],s=0;s<6;s++)g={id:i+"_gripCircle_"+l[s]+t,cx:u+r-h[s],cy:f+o-c[s],r:.4,stroke:"#5B5B5B","stroke-width":2},this.svgRenderer.drawCircle(g,this.gripCollection);this.gripCollection!=null&&$(this.gripCollection).appendTo(this.gEle);$("#"+i+"_gripCollection"+t).css({visibility:"hidden"})}ej.util.isNullOrUndefined(this.oldRectX)&&(this.oldRectX=[],this.oldRectY=[],this.oldRectWidth=[],this.oldRectHeight=[],this.oldReRightRectX=[],this.oldReTopRectY=[],this.oldReBottomRectY=[]);this.oldRectX[t]=parseInt($(e+t).attr("x"));this.oldRectY[t]=parseInt($(e+t).attr("y"));this.oldRectWidth[t]=parseInt($(e+t).attr("width"));this.oldRectHeight[t]=parseInt($(e+t).attr("height"));this.oldReRightRectX[t]=parseInt($("#"+i+"_resize_rightRect"+t).attr("x"));this.oldReTopRectY[t]=parseInt($("#"+i+"_resize_topRect"+t).attr("y"));this.oldReBottomRectY[t]=parseInt($("#"+i+"_resize_bottomRect"+t).attr("y"));this.oldMultiSelectType=this.multiSelectType;(this.resize||this.rectPan)&&(this.resize&&$("#"+this.svgObject.id+"_gripCollection"+t).attr({transform:""}),$("#"+i+"_closeTopRightCornerCircle"+t).css({display:"inline"}),$("#"+i+"_closePath"+t).css({display:"inline"}),$("#"+i+"_closePathOpposite"+t).css({display:"inline"}),$("#"+i+"_resize_rightRect"+t).css({cursor:"e-resize"}),$("#"+i+"_resize_leftRect"+t).css({cursor:"w-resize"}),$("#"+i+"_resize_bottomRect"+t).css({cursor:"s-resize"}),$("#"+i+"_resize_topRect"+t).css({cursor:"n-resize"}));this.drag=!1;this.removeRect&&($("#"+i+"_selectedRectGroup"+t).remove(),this.parentgEle.childNodes.length<=0&&$(this.parentgEle).remove());(this.multiSelectDraw||this.removeRect||this.resize||this.rectPan)&&r>0&&o>0&&(this.multiSelectDraw=!1,this.multiSelectDataCalculation(n));this.resize&&(this.resize=!1);this.rectPan&&(this.rectPan=!1);this.removeRect=!1;this.enableTrackBall()}},chartMouseUp:function(n){var o,t,s,r,u,a,h,y,p,i,f,e,c,l;if(this.isTouch(n)&&(this.model.touchCross=!1,this.chartMouseUpTouch(n)),!this.currentPageX&&this.panning&&(o=this.calMousePosition(n),this.currentPageX=o.X,this.currentPageY=o.Y),i=this,t=this.model,this.mousedownPointX=this.mousedownPointY=null,$("[id*=_PreviewSeries]").remove(),$("[id*=_Marker]").remove(),i.dragPoint){s=this.dragIndex.seriesIndex;r=t._visibleSeries[s];this.model.enableCanvasRendering||this.gPreviewSeriesGroupEle&&($(this.svgObject).find("#"+this.svgObject.id+"_PreviewSeriesGroup_"+s).remove(),this.gPreviewSeriesGroupEle.childNodes.length>0&&this.gPreviewSeriesGroupEle.removeChild(this.gPreviewSeriesGroupEle.childNodes[0]));this.dragPoint=r.dragPoint=!1;var v=this._getDraggedPoint(r,this.mousemoveX,this.mousemoveY),g=v.X,nt=v.Y;a=r.data.seriesIndex;h=r.data.pointIndex;y={X:this.commonDragEventArgs.data.oldValue.X,Y:this.commonDragEventArgs.data.oldValue.Y};p={X:g,Y:nt};u=$.extend({},this.commonDragEventArgs);u.data={series:r,seriesIndex:a,pointIndex:h,oldValue:y,newValue:p};this._trigger("dragEnd",u);i.commonDragEventArgs=u;i._changeDraggingPoints(r,h,u.data.newValue.X,u.data.newValue.Y);r.region=null;this.redraw()}if(this.multiSelectAreaType!="cartesianaxes"||t.zooming.enable||t.enableCanvasRendering||this.multiSelectMouseUp(n),i=this,t.zooming.enable&&t.AreaType=="cartesianaxes"){if(f=$("#"+this.svgObject.id+"_ZoomArea"),f[0])if(t.enableCanvasRendering)var w=f[0].getClientRects()[0],b=w.width,k=w.height;else var d=$(f),b=parseFloat(this.svgRenderer._getAttrVal(d,"width")),k=parseFloat(this.svgRenderer._getAttrVal(d,"height"));b>0&&k>0?i.doZoom(f,b,k):this.drag=!1;i.panning||this.enableTrackBall()}e=this.svgObject.id;c=ej.util.isNullOrUndefined(n.target.parentNode)?"":n.target.parentNode.id;(c==e+"_ResetZoom"||c==e+"_ZoomBtn"||n.target.id==e+"_ResetZoom"||n.target.id==e+"_ZoomBtn")&&(this.panning=!1,this.model._chartAreaZoom=!1);(ej.isTouchDevice()||t.zooming.enableDeferredZoom)&&this.panning&&this.doPan&&t.AreaType=="cartesianaxes"&&(l={x:this.oPreviousCoords.x-this.currentPageX,y:this.oPreviousCoords.y-this.currentPageY},this.oPreviousCoords={x:this.currentPageX,y:this.currentPageY},$.each(t._axes,function(n,t){var r=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1);i.translate(t,l.x,l.y,r)}),this.model.legendCollapsed=!1,this.redraw(!0,!0,n.target),this._cursorToPointer(),this._enableZoomingButtons());this.doPan&&(this.doPan=!1);this.rotateActivate=!1},multiSelectMouseDown:function(evt){var i,k;this.multiSelectAreaType=this.model.AreaType.toLowerCase();var model=this.model,chartX=model.m_AreaBounds.X,chartWidth=model.m_AreaBounds.Width,chartY=model.m_AreaBounds.Y,chartHeight=model.m_AreaBounds.Height,mouseDownCords=this.calMousePosition(evt);if(this.multiSelectAreaType=="cartesianaxes"&&!model.zooming.enable&&!model.enableCanvasRendering&&mouseDownCords.X>=chartX&&mouseDownCords.X<chartX+chartWidth&&mouseDownCords.Y<chartY+chartHeight&&mouseDownCords.Y>=chartY){var seriesCollection=this.model.series,seriesCollectionLength=seriesCollection.length,id,mouseDownCords,containerSvg=this.svgObject.id,selectMode=seriesCollection.some(function(n){return n.selectionSettings.mode.toLowerCase()=="range"});for(this._isMultiSelect=seriesCollection.some(function(n){return n.selectionSettings.enable==!0&&n.selectionSettings.mode.toLowerCase()=="range"}),selectMode&&(this.multiSelectMode="range"),i=0;i<seriesCollectionLength;i++)seriesCollection[i].selectionSettings.enable==!0&&seriesCollection[i].selectionSettings.mode.toLowerCase()=="range"&&(this.multiSelectType=seriesCollection[i].selectionSettings.rangeType.toLowerCase());if(this._isMultiSelect&&this.multiSelectMode=="range"){this.disableTrackBall();mouseDownCords=this.calMousePosition(evt);this.mouseDownX=mouseDownCords.X;this.mouseDownY=mouseDownCords.Y;this.drag=!0;$(this.parentgEle).find("g").length<1?this.selectedRectIndex=0:(id=$(this.parentgEle).find("g").last().attr("id"),matchStr=containerSvg+"_gripCollection",id=parseInt(id.substr(matchStr.length)),this.selectedRectIndex=id+1);$(this.parentgEle).find("g").length==0&&(this.parentgEle=this.svgRenderer.createGroup({id:containerSvg+"_rectSelectionGroup"}));this.gEle=this.svgRenderer.createGroup({id:containerSvg+"_selectedRectGroup"+this.selectedRectIndex});$(this.gripCollection).find("g").length==0&&(this.gripCollection=this.svgRenderer.createGroup({id:containerSvg+"_gripCollection"+this.selectedRectIndex}));evt.target.id.indexOf("resize")>=0&&(id=evt.target.id.split("resize")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id));evt.target.id.indexOf("close")>=0&&(id=evt.target.id.split("close")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id));evt.target.id.indexOf(this.svgObject.id+"_selectRect")>=0&&(matchStr=this.svgObject.id+"_selectRect",this.selectedRectIndex=parseInt(evt.target.id.substr(matchStr.length)));this.currentIndex=$(evt.target.parentNode).index();var axes=this.model._axes,axesLength=axes.length,axis,mouseMoveCords=this.calMousePosition(evt),mouseMoveX=mouseMoveCords.X,mouseMoveY=mouseMoveCords.Y;for(this.multiAxis=[],k=0;k<axesLength;k++)axis=axes[k],mouseMoveX>axis.Location.X1&&mouseMoveX<axis.Location.X2&&this.multiAxis.push(axis),mouseMoveY<axis.Location.Y1&&mouseMoveY>axis.Location.Y2&&this.multiAxis.push(axis)}}},_grab:function(n,t,i,r,u){commonDragEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs);commonDragEventArgs.data={seriesIndex:i,pointIndex:r,currentPoint:u};t._trigger("dragStart",commonDragEventArgs);n.data=commonDragEventArgs.data;this.commonDragEventArgs=commonDragEventArgs;this.mousedownPointX=this.mousedownPointY=null},_enableDragging:function(n,t,i){var e=this,u,o,r=n.type.toLowerCase(),l=e.model.AreaType,a=n.visibility.toLowerCase(),h,c,s,f;if(this.mousedownPointX&&this.mousedownPointY&&l=="cartesianaxes"&&!this.model.enable3D&&a=="visible"&&(r=="line"||r=="spline"||r=="area"||r=="stepline"||r=="steparea"||r=="splinearea"||r=="column"||r=="bar"||r=="bubble"||r=="scatter")&&(h=[],c=[],u=this.getClosesPointXY(c,h,n,this.mousedownPointX,this.mousedownPointY,i),this.mousemoveX=this.mousedownPointX,this.mousemoveY=this.mousedownPointY,o=this.GetSeriesPoint(i),ej.util.isNullOrUndefined(u.point)||(this.dragPoint=n.dragPoint=!0,u.seriesIndex=t,n.pointData=u,s={xValue:u.point.xValue,yValue:u.point.YValues},e._grab(n,e,t,u.index,s),this.dragIndex={pointIndex:u.index,seriesIndex:t}),!ej.util.isNullOrUndefined(o)&&(f=o.region,t==f.SeriesIndex))){n.region=o.region;this.dragPoint=n.dragPoint=!0;var v=n._visiblePoints[f.Region.PointIndex].xValue,y=n._visiblePoints[f.Region.PointIndex].YValues,s={xValue:v,yValue:y};e._grab(n,e,f.SeriesIndex,f.Region.PointIndex,s);this.dragIndex={pointIndex:f.Region.PointIndex,seriesIndex:f.SeriesIndex}}},chartMouseDown:function(e){var model=this.model,matchStr=this._id+"_scrollbar_",parentNodeId=e.target.parentNode&&e.target.parentNode.id?e.target.parentNode.id:"",selectionIndex=parentNodeId.indexOf(matchStr)>-1?parseInt(parentNodeId.substr(matchStr.length)):NaN,isZoom=this.isZoomButtonHovered(e.target),timer,parent,isZoomToolkit,mousePanCords;axes=model._axes;chart=this;mouseDownCords=this.calMousePosition(e);browserInfo=this.model.browserInfo;this.mousedownPointX=mouseDownCords.X;this.mousedownPointY=mouseDownCords.Y;"which"in e?this.chartRightClick=e.which==3:"button"in e&&(this.chartRightClick=e.button==2);isNaN(selectionIndex)||ej.util.isNullOrUndefined(selectionIndex)||(axes[selectionIndex].previousRange=$.extend(!0,{},model._axes[selectionIndex].visibleRange));this.mousemoveX=this.mouseDownX=mouseDownCords.X;this.mousemoveY=this.mouseDownY=mouseDownCords.Y;this.isTouch(e)&&(this.model.event=e,this.model.touchCross=!0,$.finish?$(this.model.trackerElement).finish():$(this.model.trackerElement).stop(!0,!0),this.model.tapNum=this.model.tapNum||0,isZoom||this.doubleTap(e),chart.model.crosshair.visible&&!isZoom&&(timer=setTimeout(function(){var n=$("#"+chart.svgObject.id).find("#"+chart.svgObject.id+"_ZoomArea"),t=chart.model.elementSpacing/2,i=chart.getEvent(chart.model.event),r=i.pageX,u=i.pageY;chart.model.touchCross&&!chart.panning&&Math.abs(r-chart.model.cachedX)<t&&Math.abs(u-chart.model.cachedY)<t&&(n.length==0||parseFloat($(n).attr("width"))==0||parseFloat($(n).attr("height"))==0)&&(chart.chartInteractiveBehavior(e),chart.model.crosshairMoved=!0,chart.drag=!1)},500)));this.model.enable3D&&this.model.enableRotation&&(this.rotateActivate=!0);this.svgRenderer.vmlNamespace||(this.oPreviousCoords={},e.target.id.indexOf("resize")>=0&&(id=e.target.id.split("resize")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id),this.multiSelectMouseDownId=e.target.id,this.resize=!0),e.target.id.indexOf("close")>=0&&(id=e.target.id.split("close")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id),this.removeRect=!0),e.target.id.indexOf(this.svgObject.id+"_selectRect")>=0&&(matchStr=this.svgObject.id+"_selectRect",this.selectedRectIndex=parseInt(e.target.id.substr(matchStr.length))),e.target.id==this.svgObject.id+"_selectRect"+this.selectedRectIndex&&(this.rectPan=!0,this.PreviousCoords={X:e.pageX,Y:e.pageY}),this.isTouch(e)||this.multiSelectMouseDown(e),parent=this.svgRenderer._getAttrVal($(e.target).parent(),"id"),isZoomToolkit=parent!=this.svgObject.id+"_ZoomBtn"&&parent!=this.svgObject.id+"_ZoomInBtn"&&parent!=this.svgObject.id+"_ZoomOutBtn"&&parent!=this.svgObject.id+"_ResetZoom"&&parent!=this.svgObject.id+"_PanBtn",isZoomToolkit&&this.model.zooming.enable&&!this.model.isLazyZooming&&!this.panning&&this.model.AreaType=="cartesianaxes"?this.mouseDownX>=this.model.m_AreaBounds.X&&this.mouseDownX<model.m_AreaBounds.X+model.m_AreaBounds.Width&&this.mouseDownY<model.m_AreaBounds.Y+model.m_AreaBounds.Height&&this.mouseDownY>=model.m_AreaBounds.Y&&!this.isTouch(e)&&((isNaN(selectionIndex)||ej.util.isNullOrUndefined(selectionIndex))&&(this.drag=!0),this.disableTrackBall()):(isZoomToolkit&&this.panning||$(e.target)[0].className=="e-hhandle e-box")&&(mousePanCords=this.calMousePosition(e),this.mousePanX=mousePanCords.X,this.mousePanY=mousePanCords.Y,this.mousePanX>=model.m_AreaBounds.X&&this.mousePanX<model.m_AreaBounds.X+model.m_AreaBounds.Width&&this.mousePanY<model.m_AreaBounds.Y+model.m_AreaBounds.Height+18&&this.mousePanY>=model.m_AreaBounds.Y&&(this.doPan=!0)),(this.rotateActivate||this.doPan)&&(this.oPreviousCoords={x:e.pageX,y:e.pageY}))},chartMouseLeave:function(n){this.cancelEvent(n);this.isTouch(n)||($("[id*=_TrackSymbol]").remove(),this._removeHighlight(),this._removeTrackBall(),$("#"+this.svgObject.id+"_TrackToolTip").hide(),$("#"+this._id+"_tooltip").remove(),$(".tooltipDiv"+this._id).hasClass(this.svgObject.id)&&$(".tooltipDiv"+this._id).remove());var t=$.extend({},ej.EjSvgRender.commonChartEventArgs);t.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:n.target.id,pageX:n.pageX,pageY:n.pageY};this._trigger("chartMouseLeave",t)},_doClick:function(n){var bt,vt,h,e,o,d,tt,pt,it,c,y,f,t,wt,i,p,w,ft,u,et,nt,ot,st,r;this.drag=!1;this.model.crosshairMoved||this._removeHighlight();this.model.selectedDataPointIndexes||(this.model.selectedDataPointIndexes=[]);this.model.clusterPoints=[];this.model._isStateChaged=!1;var i,u,a,s,ht=this.getEvent(n),ct=ht.pageX,lt=ht.pageY,b=10,ni=n.target.id,ti=this.svgObject.id,k=this.model._visibleSeries,at=this.isZoomButtonHovered(n.target),v=n.target.id;if(seriesLength=k.length,s=this.GetSeriesPoint(n),s?(i=s.region.SeriesIndex,u=s.region.Region.PointIndex):this.model.selectionEnable&&(this.model.enable3D||n.target.id.indexOf("LegendItem")!=-1||this.model.AreaType=="none"||(h=n.target.id,e=h.match(/(\d+)/g),!e||h.indexOf("symbol")==-1&&h.indexOf("Series")==-1||h.indexOf("Text")!=-1?e&&(h.indexOf("Text")!=-1||h.indexOf("dataLabel")!=-1)&&(i=parseInt(e[0].charAt(0)),u=isNaN(parseInt(e[0].charAt(1)))?parseInt(e[1].charAt(0)):parseInt(e[0].charAt(1))):(i=parseInt(e[0]),u=isNaN(parseInt(e[1]))?0:parseInt(e[1])))),!at||this.model.enableCanvasRendering){for(f=0;f<this.model._visibleSeries.length;f++)if(a=this.model._visibleSeries[f],o=a.type.toLowerCase(),this.model.AreaType=="cartesianaxes"&&a.visibility.toLowerCase()=="visible"&&o!=="scatter"&&o!=="bubble"&&o!=="column"&&o.indexOf("bar")==-1&&o!=="stackingcolumn"&&o!=="stackingcolumn100"&&!a._hiloTypes){var yt=this.calMousePosition(n);this.mousemoveX=yt.X;this.mousemoveY=yt.Y;d=this.getClosesPointXY([],[],a,this.mousemoveX,this.mousemoveY,n);ej.util.isNullOrUndefined(d.point)||(i=f,u=d.index,tt=$.extend({},ej.EjSvgRender.commonChartEventArgs),tt.data={location:{x:this.mousemoveX,y:this.mousemoveY},region:{SeriesIndex:f,Region:{PointIndex:d.index}}},this._trigger("pointRegionClick",tt))}s&&!at&&(r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=s,this._trigger("pointRegionClick",r))}if(this.model.AreaType=="none"&&this.model.enable3D&&$(n.target)[0].nodeName=="path"&&(!this.isTouch(n)||Math.abs(ct-this.model.cachedX)<b&&Math.abs(lt-this.model.cachedY)<b))if(l=$(n.target)[0].id.match(/(\d+)/g),i=parseInt(l[l.length-2]),u=parseInt(l[l.length-1]),pt=this.model._visibleSeries[i].explodeIndex,it=this.model._visibleSeries[i]._visiblePoints[u].actualIndex,this.model._visibleSeries[i].explodeIndex=pt==it?null:it,this.vmlRendering||this.model.enableCanvasRendering||(c=this.selectedStyle(this)),$(this.svgObject).empty(),$(this.legendSvgContainer).empty(),this.draw(),this.model.AreaType=="none"){this.model._isStateChaged=!1;var g,kt=c.length,rt="_Region_Series_"+i+"_Point_"+u,ut=$(this.svgObject).find("[id$="+rt+"],[id*="+rt+"back],[id*="+rt+"front]");for(elementsLength=ut.length,y=0;y<kt;y++)for(f=0;f<elementsLength;f++)c[y].id==ut[f].id&&(g=c[y].className,g.indexOf("SelectionStyle")<0&&g.indexOf("Selection"+name+"Style")<0&&$("[id="+ut[f].id+"]").attr("class",g));c.pattern&&this.svgRenderer.append(c.pattern,this.svgObject)}else $("[id*="+this.svgObject.id+"_LegendItemShape],[id*=_Region_Series_]").each(function(){$(this).attr("class","")});if(t=this.getLegendData(n),t&&($("#template_group_"+this._id).remove(),r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=t,this._trigger("legendItemClick",r),i=t.legendItem.LegendItem.SeriesIndex,!this.model.legend.toggleSeriesVisibility&&t.series.selectionSettings.enable&&(this.model._isStateChaged=!1,this.legendSelection(this,t,n,s)),!r.cancel&&this.model.legend.toggleSeriesVisibility)){for($("[id*="+this._id+"_Selection_]").remove(),wt=this.model._visibleSeries.length,this.model.AreaType!="none"||this.model.AreaType=="none"&&o!="pieofpie"&&o!="pyramid"&&o!="funnel"&&wt>1?(i=t.legendItem.LegendItem.SeriesIndex,p=t.legendItem.LegendItem.TrendLineIndex,ej.util.isNullOrUndefined(p)?(t.series.visibility=t.series.visibility.toLowerCase()==="visible"?"hidden":"visible",this.model.series[i].visibility=t.series.visibility,this._notifyArrayChange&&this._notifyArrayChange("series["+i+"]visibility",t.series.visibility)):(w=t.series.trendlines[p].visibility.toLowerCase(),w=w==="visible"?"hidden":"visible",this.model.series[i].trendlines[p].visibility=w,this._notifyArrayChange&&this._notifyArrayChange("series["+i+"].trendlines["+p+"].visibility",w))):(this.model._isPieOfPie?(ft=this._getPieOfPiePoint(t.legendItem.LegendItem.ActualIndex,t.series,t)._visibility,u=t.legendItem.LegendItem.ActualIndex):(ft=t.series.visiblePoints[t.legendItem.LegendItem.PointIndex]._visibility,u=t.series.visiblePoints[t.legendItem.LegendItem.PointIndex].actualIndex),t.series.points[u]._visibility=ft==="visible"?"hidden":"visible"),this.model.enableCanvasRendering&&(et=document.getElementById(this._id).getClientRects()[0],this.svgRenderer.ctx.clearRect(0,0,et.width,et.height),$("#"+this._id).find('[id*="canvas_symbol"]').remove()),$(this.svgObject).empty(),$(this.legendSvgContainer).empty(),nt=0;nt<this.model.series.length;nt++)this.model.series[nt].regionAdded=!1;this.model.legendCollapsed=!0;this.disableAnimation();this.draw();this.enableAnimation();this.model.AreaType!="none"&&this.zoomed&&this._enableZoomingButtons()}if(ot=this.getAxisLabelData(n),ot&&(r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=ot,this._trigger("axisLabelClick",r)),st=this.getAxisMultiLevelLabelsData(n),st&&(r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=st,this._trigger("multiLevelLabelClick",r)),v.indexOf("annotation_")>=0){var dt=v.lastIndexOf("_"),gt=v.substr(dt+1,v.length),l=parseInt(gt),r=$.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={location:{x:this.mousemoveX,y:this.mousemoveY},contentData:this.model.annotations[l],pageX:n.pageX,pageY:n.pageY};this._trigger("annotationClick",r)}isSelectionSetting=ej.isNullOrUndefined(i)?!1:this.model._visibleSeries[i].selectionSettings.enable;!ej.isNullOrUndefined(i)&&!t&&isSelectionSetting&&(!this.isTouch(n)||!this.model.crosshairMoved&&Math.abs(ct-this.model.cachedX)<b&&Math.abs(lt-this.model.cachedY)<b)&&(bt=k[i].selectionSettings.type.toLowerCase()=="multiple"?!0:!1,vt=k[i].selectionSettings.mode,vt.toLowerCase()!="range"&&this.segmentSelection(n,t,i,u,s,k));this.model.crosshairMoved=!1;r=$.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:v,pageX:n.pageX,pageY:n.pageY};this._trigger("chartClick",r)},getTargetId:function(n,t,i){var r,u=this.model._visibleSeries[n].type.toLowerCase(),f=(u.indexOf("area")!=-1||u.indexOf("line")!=-1||u.indexOf("scatter")!=-1?!0:!1)?!0:!1;return this.model.enable3D?$("[id*=_Region_Series_"+n+"_Point_"+t+"]").each(function(){r=this.id}):i!="series"||this.model.AreaType=="none"?f?$("[id*="+this.svgObject.id+"_Series"+n+"_Point"+t+"_symbol]").each(function(){r=this.id}):$("[id$="+this.svgObject.id+"_Series"+n+"_Point"+t).each(function(){r=this.id}):$("[id*="+this.svgObject.id+"_Series"+n+"]").each(function(){r=this.id}),r},findCanvasSelection:function(n,t,i){var r;return r=i=="point"?$("#"+this._id+"_Selection_series"+n+"_point_"+t+"_canvas").length:i=="series"?$("#"+this._id+"_Selection_series"+n+"_canvas").length:$("#"+this._id+"_Selection_Cluster_point_"+t+"_canvas").length,r==1?!0:!1},segmentSelection:function(n,t,i,r,u){var v=this.model._visibleSeries,b=v[i],it,rt,ot,st,p,ht,w,ct,f,lt;if(ej.isNullOrUndefined(b))return 0;var k=b.selectionSettings,vt=k.enable,y=k.type.toLowerCase()=="multiple"?!0:!1,e=k.mode,ut=!1,at=this,a,c,l,ft,h,s,u,o,d,g,nt,et,tt;if(this.model.isSelected=!0,!ej.isNullOrUndefined(r)&&e=="cluster"){for(it=[],st=v[i]._visiblePoints[r].xValue,p=0,ht=v.length;p<ht;p++)for(rt=v[p].points,ot=rt.length,w=0;w<ot;w++)st==rt[w].xValue&&(it[it.length]={seriesIndex:p,pointIndex:w});this.model.clusterPoints=it}if(this.model.enableCanvasRendering||(a=this.getTargetId(i,r,e),a&&(c=$("#"+a)[0].parentNode.id,ct=$("#"+c)[0],ct!=null&&c&&(ft=c.indexOf(this.svgObject.id+"_TextGroup_")>=0||c.indexOf(this.svgObject.id+"_symbolGroup")>=0?!0:!1,c.indexOf(this.svgObject.id+"_TrackSymbol_")>=0&&(ft=!0,ut=!0)))),this.model.enableCanvasRendering?l=this.findCanvasSelection(i,r,e):(tt=$("#"+a).attr("class")?$("#"+a).attr("class"):"",l=tt.indexOf("Selection")!=-1?!0:!1,this.model.enable3D&&(tt=$("[id*=_Region_Series_"+i+"_Point_"+r+"]").attr("class")?$("[id*=_Region_Series_"+i+"_Point_"+r+"]").attr("class"):"",l=tt.indexOf("Selection")!=-1?!0:!1)),(l||!y||y)&&(this.removeSelection(i,r,v,e,y,t,l),u=this.model.selectedDataPointIndexes,o=u.length,o>0&&!this.model._isStateChaged))if(y){if(l)for(f=0;f<o;f++)h=u[f].seriesIndex,s=u[f].pointIndex,d=e=="series"&&h==i,g=(e=="point"||this.model.AreaType=="none")&&h==i&&s==r,nt=e=="cluster"&&s==r,((d||nt)&&this.model.AreaType!="none"||g)&&(u.splice(f,1),o=u.length,f=-1)}else for(f=0;f<o;f++)h=u[f].seriesIndex,s=u[f].pointIndex,d=e=="series"&&(h==i&&s==r||h!=i||s!=r),g=(e=="point"||this.model.AreaType=="none")&&h==i&&s==r,nt=e=="cluster"&&s==r,(d||g||nt)&&(u.splice(f,1),o=u.length,f=-1);if(!l&&(this.model.enableCanvasRendering?this.canvasSelection(this,n,b,t,i,r,u,k):this.selection(at,n,b,ut,t,i,r,c,a,u),u=this.model.selectedDataPointIndexes,o=u.length,!this.model._isStateChaged))if(o>0)if(y)u.push({event:n,legendData:t,seriesIndex:i,pointIndex:r,data:u});else{for(f=0;f<o;f++)h=u[f].seriesIndex,s=u[f].pointIndex,et=(e=="series"||e=="cluster"||this.model.AreaType=="none")&&(u[f].SeriesIndex!=i||u[f].PointIndex!=r),pointFlag=e=="point"&&u[f].SeriesIndex==i,(et||pointFlag)&&(u.splice(f,1),o=this.model.selectedDataPointIndexes.length,f=-1);u.push({event:n,legendData:t,seriesIndex:i,pointIndex:r,data:u})}else u.push({event:n,legendData:t,seriesIndex:i,pointIndex:r,data:u});lt={selectedData:this.model.selectedDataPointIndexes};this._trigger("seriesRegionClick",lt)},legendSelection:function(n,t,i,r){var e=this.model.selectedDataPointIndexes?this.model.selectedDataPointIndexes:[],o=this.model._visibleSeries.length,u=n.model.AreaType=="none"&&o==1?t.legendItem.LegendItem.PointIndex:t.legendItem.LegendItem.SeriesIndex,f;if(seriesIndex=t.legendItem.LegendItem.SeriesIndex,pointIndex=u,legendItem=n.svgObject.id+"_LegendItemShape"+u,legendClass=$("#"+legendItem).attr("class")?$("#"+legendItem).attr("class"):"",$("#"+n._id+"_Selection_Legend"+u+"_canvas").length==1||legendClass.indexOf("Selection")!=-1){for($("#"+n._id+"_Selection_Legend"+u+"_canvas").remove(),$("[id*="+n._id+"_Selection_series"+u+"]").remove(),$("#"+this._id+"_Selection_series"+seriesIndex+"_point_"+pointIndex+"_canvas").remove(),$("#"+legendItem).attr("class",""),$("[id*="+n.svgObject.id+"_Series"+seriesIndex+"]").attr("class",""),$("[id*=_Region_Series_"+seriesIndex+"]").attr("class",""),f=0;f<e.length;f++)if(e[f].seriesIndex==u||this.model.AreaType=="none"&&e[f].pointIndex==u){e.splice(f,1);break}}else n.segmentSelection(i,t,seriesIndex,pointIndex,r)},chartMouseClick:function(n){this.cancelEvent(n);window.navigator.msPointerEnabled&&(n=n.originalEvent);this._doClick(n)},chartMouseDoubleClick:function(n){window.navigator.msPointerEnabled&&(n=n.originalEvent);var t=$.extend({},ej.EjSvgRender.commonChartEventArgs);t.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:n.target.id,pageX:n.pageX,pageY:n.pageY};this._trigger("chartDoubleClick",t)},drawTrackerSymbol:function(n,t,i,r,u,f,e){var h=n.type.toLowerCase(),a,v,y=new ej.seriesTypes[h],c=n.type.toLowerCase()=="boxandwhisker"?e:i,o=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),p,s,l,w;a=n.isTransposed?n.yAxis.plotOffset:n.xAxis.plotOffset;v=n.isTransposed?n.xAxis.plotOffset:n.yAxis.plotOffset;p={id:this.svgObject.id+"_ClipRectTrack_"+t,x:-a,y:-v,width:o.width+a*2,height:o.height+v*2,fill:"white","stroke-width":1,stroke:"Gray"};this.model.AreaType!="none"&&(this.model.AreaType=="cartesianaxes"&&u.X+o.x<=o.x+o.width&&(u.X+o.x>=o.x||u.X==0)&&(u.Y+o.y>=o.y||u.Y==0)?this.model.crosshair.visible||h=="bubble"||h=="scatter"?(n.trackerRemoved||(s=this.svgObject.id+"_TrackSymbol_"+t,s=h=="boxandwhisker"?s+c:s,$("#"+this._id).find("[id*="+s+"]").remove(),s="canvas_trackSymbol_"+t,s=h=="boxandwhisker"?s+c:s,$("#"+this._id).find("[id*="+s+"]").remove()),l={"clip-path":"url(#"+this.svgObject.id+"_ClipRectTrack_"+t+")","class":"Tracker",id:this.svgObject.id+"_TrackSymbol_"+t+"_"+c,transform:"translate("+o.x+","+o.y+")"},this.gTrackerEle=this.svgRenderer.createGroup(l)):this.gTrackerEle=null:($("#"+this.svgObject.id+"_TrackSymbol_"+t+"_"+c).remove(),l={id:this.svgObject.id+"_TrackSymbol_"+t+"_"+c},this.gTrackerEle=this.svgRenderer.createGroup(l),this.model.enableCanvasRendering||(this.model.AreaType=="polaraxes"?this.gTrackerEle.setAttribute("clip-path","url(#"+this.svgObject.id+"_SeriesGroup_"+t+"_ClipRect)"):(this.gTrackerEle.setAttribute("clip-path","url(#"+this.svgObject.id+"_ClipRectTrack_"+t+")"),this.gTrackerEle.setAttribute("transform","translate("+o.x+","+o.y+")")))),$("#"+this.svgObject.id+"_CrosshairGroup").length==0&&(w={id:this.svgObject.id+"_CrosshairGroup",visibility:"visible"},this.gTrackball=this.svgRenderer.createGroup(w),this.svgRenderer.append(this.gTrackball,this.svgObject)),this.model.crosshair.marker.visible&&!n.isIndicator&&n._visiblePoints[i].visible&&(y.drawSymbol(t,n,i,u.X,u.Y,this,r,e),u.low&&y.drawSymbol(t,n,i,this.model.requireInvertedAxes?u.low:u.X,this.model.requireInvertedAxes?u.Y:u.low,this,r)),this.gTrackerEle&&$("#"+this.gTrackerEle.id).length<1&&this.svgRenderer.append(this.gTrackerEle,this.gTrackball));$(this.svgObject).find("#"+this.svgObject.id+"_ClipRectTrack_"+t).length!=0||this.vmlRendering||this.svgRenderer.drawClipPath(p,$("#"+this.svgObject.id+"_CrosshairGroup"))},getClosesPointXY:function(n,t,i,r,u,f){var b,s=ej.EjSvgRender.utils._getTransform(i.xAxis,i.yAxis,this.model.requireInvertedAxes),k,d,o,a,nt,p,v,y=10,g=this.isTouch(f),tt=i._visiblePoints?i._visiblePoints.length:0,w,e=i.marker?$.extend(!0,{},i.marker.size):{height:6,width:6},h,c,l;if(e.height=g&&e.height<y*2?e.height+y:e.height,e.width=g&&e.width<y*2?e.width+y:e.width,u<=s.y+s.height&&s.y<=u&&s.x<=r&&r<=s.x+s.width)for(h=0;h<tt;h++){if(o=i._visiblePoints[h],a=o.location,p=!1,nt=h,v=null,w=null,i.type=="boxandwhisker"&&!this.model.enable3D&&!ej.util.isNullOrUndefined(o.boxPlotLocation))for(c=0;c<o.boxPlotLocation.length;c++)l={X:o.boxPlotLocation[c].X,Y:o.boxPlotLocation[c].Y},o.boxPlotLocation[c].outlier==!0&&r>l.X+s.x-e.width&&r<l.X+s.x+e.width&&(v=o.x,ej.util.isNullOrUndefined(v)&&(p=o.visible),u>l.Y+s.y-e.height&&u<l.Y+s.y+e.height+y&&(w=o.boxPlotValues.outliers[c],k={X:l.X,Y:l.Y}),ej.util.isNullOrUndefined(k)||(b=o,d=h));a&&(r>a.X+s.x-e.width/2&&r<a.X+s.x+e.width/2&&(v=o.x,ej.util.isNullOrUndefined(v)&&(p=o.visible)),u>a.Y+s.y-e.height/2&&u<a.Y+s.y+e.height/2&&(w=o.YValues[0]),ej.util.isNullOrUndefined(v)&&!p||ej.util.isNullOrUndefined(w)||(b=o,d=h))}return{point:b,index:d,outlierPosition:k}},getClosestPointX:function(n,t,i,r){var e=[],f=ej.EjSvgRender.utils._getTransform(t.xAxis,t.yAxis,this.model.requireInvertedAxes),u;this.model.requireInvertedAxes?(i=Math.abs(r-(f.y+f.height)),r=Math.abs(i-f.x)):(i=Math.abs(i-f.x),r=Math.abs(r-(f.y+f.height)));var s=ej.EjSvgRender.utils._getValuebyPoint(i,r,t),h=this.model.requireInvertedAxes?s.PointX:s.PointX,o=[];return $.each(t.points,function(t,i){n.push(i.xValue)}),u=this.getClosest(n,h),ej.util.isNullOrUndefined(u)||(typeof u=="number"?$.each(t._visiblePoints,function(n,t){t.xValue==u&&(e.push(t),o.push(n))}):(u=u.getTime(),$.each(t._visiblePoints,function(n,t){t.xValue.getTime()==u&&(e.push(t),o.push(n))}))),{point:e,index:o}},getClosest:function(n,t){var i=null,f,u,r;if(this._beforeMin=!1,this._afterMax=!1,f=Math.min.apply(null,n),u=Math.max.apply(null,n),t>=f-.5&&t<=u+.5){for(r=0;r<n.length;r++)(i==null||Math.abs(n[r]-t)<Math.abs(i-t))&&(i=n[r]);this._closest=null}else t>u?(i=n[n.length-1],this._closest=ej.util.isNullOrUndefined(this._closest)?i:i>this._closest?i:this._closest,this._afterMax=!0):(i=n[0],this._closest=ej.util.isNullOrUndefined(this._closest)?i:i<this._closest?i:this._closest,this._beforeMin=!0);return i},createTooltip:function(n,t,i){var y,w,nt,f,e,tt,h,u,b,v,it,d,g,p,l;i||(i=this.model._visibleSeries[n.SeriesIndex]);var ft=i.type=="pieofpie"?this._getPieOfPiePoint(n.Region.PointIndex,i):i._visiblePoints[n.Region.PointIndex],r=this.dragPoint?i.pointCollection[n.Region.PointIndex]:$.extend(!0,{},ft),a=10;if(r.visible){if(y=i.tooltip.format,i.type=="boxandwhisker"){if(w=this.calMousePosition(t),this.mousemoveX=w.X,this.mousemoveY=w.Y,nt=n.Region.Bounds?!0:!1,nt)if(n.Region.Bounds.Width==i.outlierSettings.size.width)for(f=0;f<r.boxPlotLocation.length;f++)r.boxPlotLocation[f].outlier==!0&&r.boxPlotLocation[f].X+i.outlierSettings.size.width/2>this.mousemoveX-i.xAxis.x&&r.boxPlotLocation[f].X-i.outlierSettings.size.width/2<this.mousemoveX-i.xAxis.x&&r.boxPlotLocation[f].Y+i.outlierSettings.size.height/2>this.mousemoveY-i.yAxis.y&&r.boxPlotLocation[f].Y-i.outlierSettings.size.height/2<this.mousemoveY-i.yAxis.y&&(e=this.getTooltipFormat(r,i,n.SeriesIndex,n.Region.PointIndex,y,r.boxPlotLocation[f]),r.x=e.data.x,r.y=e.text);else e=this.getTooltipFormat(r,i,n.SeriesIndex,n.Region.PointIndex,y,r.boxPlotLocation[0]),r.x=e.data.x,r.y=e.text}else e=this.getTooltipFormat(r,i,n.SeriesIndex,n.Region.PointIndex,y),r.x=e.data.x,r.y=e.data.y;tt=null;h=$.extend({},ej.EjSvgRender.commonChartEventArgs);h.data={currentText:tt,seriesIndex:n.SeriesIndex,pointIndex:n.Region.PointIndex,series:i};this._trigger("toolTipInitialize",h);u=$(".tooltipDiv"+this._id);$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden");$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden").hide();$(".tooltipDiv"+this._id).length==0?(this.tooltipFirst=!0,u=$("<div><\/div>").attr("class","tooltipDiv"+this._id).css({position:"absolute","z-index":"13000",display:"block"}),$(document.body).append(u),$(".tooltipDiv"+this._id).addClass(this.svgObject.id)):($(".tooltipDiv"+this._id).css("display","block"),this.tooltipFirst=!1);i.tooltip.template!=null?(b=$("#"+i.tooltip.template).clone(),$(".tooltipDiv"+this._id)[0].innerHTML="",$(b).css("display","block").appendTo(u),i.count=1,r.count=1,v=this.getSeriesColor(r,n.SeriesIndex,i),v?$(u).css("background-color",jQuery.type(v)=="array"?v[0].color:v):$(u).css("background-color",this.model.pointColors[n.Region.PointIndex]),it={series:i,point:r},ej.util.isNullOrUndefined(h.data.currentText)?$(u).html($(u).html().parseTemplate(it)):$(u).html($(b).html(h.data.currentText))):$(u).html(h.data.ToolTip);var o=this.model.m_AreaBounds,c=t.pageX+a,s=t.pageY+a,rt=$(u).width(),ut=$(u).height(),k=document.getElementById(this.svgObject.id).getClientRects()[0];(c===undefined||c===null)&&(c=t.pageX+a);(s===undefined||s===null)&&(s=t.pageY+a);d=c;g=s;c-$(this.svgObject).offset().left+rt>o.X+o.Width&&(p=c-(rt+2*a),d=p+$(document).scrollLeft());s-$(this.svgObject).offset().top+ut>o.Y+o.Height&&(p=s+ut-(o.Y+o.Height+k.top),g=s-p+$(document).scrollTop());$(u).css("left",d);$(u).css("top",g);l=i.tooltip;l.enableAnimation&&$(u).css({"transition-property":"left,top","-moz-transition-property":"left,top","-webkit-transition-property":"left,top","-o-transition-property":"left,top","transition-duration":l.duration,"-moz-transition-duration":l.duration,"-webkit-transition-duration":this.tooltipFirst?"0s":l.duration,"-o-transition-duration":l.duration});templateRect=$(u)[0].getBoundingClientRect();templateRect.top<o.Y+k.top&&$(u).css("top",o.Y+k.top+$(document).scrollTop())}},translate:function(n,t,i,r){var u=n.orientation.toLowerCase()=="horizontal"?t/n.width/r:i/n.height/r;n.zoomPosition=n.orientation.toLowerCase()=="horizontal"?ej.EjSvgRender.utils._minMax(n.zoomPosition+u,0,1-n.zoomFactor):ej.EjSvgRender.utils._minMax(n.zoomPosition-u,0,1-n.zoomFactor)},highlightFill:function(n,t,i,r,u){var e=t.model.seriesColors,h=t.model.pointColors,s=n.color,c=this.model._visibleSeries.length,o,f;return u&&t.model.AreaType=="none"&&(c==1?r=u.legendItem.LegendItem.PointIndex:i=u.legendItem.LegendItem.SeriesIndex),o=u?e[i]:r?t.model.series[i].points[r]?t.model.series[i].points[r].fill:null:null,f=s!=""?s:t.model.AreaType=="none"?h[r]:u?e[i]:o?o:e[i],Object.prototype.toString.call(f)==="[object Array]"&&(f=f[1].color),f},canvasHighlight:function(n,t,i,r){var o=i.highlightSettings,ut=i.data,h=o.color,l=o.opacity,a=o.border.color,v=o.border.width,b=o.pattern.toLowerCase(),vt=n.model.legend.visible,p=o.mode,c=i.seriesIndex,s=i.pointIndex,f=i.type.toLowerCase(),tt=document.getElementById(n._id+"_canvas").getBoundingClientRect(),e=[],ft=[],k=[],ct=this.model._visibleSeries.length,d=this.highlightFill(o,n,c,s,r),at,it,rt,g,et,i,nt,st,ot,w,ht,lt,u,y;if(n.model.AreaType!="none"||n.model.AreaType=="none"&&ct>1&&(p=="series"||r))for(u=0,y=n.model.chartRegions.length;u<y;u++)(p=="series"||r)&&c==n.model.chartRegions[u].SeriesIndex&&e.push(n.model.chartRegions[u].Region);else for(u=0,y=n.model.chartRegions.length;u<y;u++)c==n.model.chartRegions[u].SeriesIndex&&s==n.model.chartRegions[u].Region.PointIndex&&e.push(n.model._isPieOfPie?n._getPieOfPiePoint(n.model.chartRegions[u].Region.PointIndex,i):n.model.chartRegions[u].Region[s]);if(p=="cluster"&&n.model.Areatype!="none"&&typeof s!="undefined")for(at=n.model._visibleSeries[c]._visiblePoints[s].xValue,u=0,y=n.model._visibleSeries.length;u<y;u++)for(it=0;it<n.model._visibleSeries[u]._visiblePoints.length;it++)at==n.model._visibleSeries[u]._visiblePoints[it].xValue&&(k[k.length]={seriesIndex:u,pointIndex:it});for(rt=0;rt<k.length;rt++)for(clusterseriesIndex=k[rt].seriesIndex,clusterpointIndex=k[rt].pointIndex,g=0;g<n.model.chartRegions.length;g++)clusterseriesIndex==n.model.chartRegions[g].SeriesIndex&&clusterpointIndex==n.model.chartRegions[g].Region.PointIndex&&(p!="cluster"?e.push(n.model.chartRegions[g].Region):e.push(n.model.chartRegions[g]));if(et=n.model.AreaType=="none"&&ct==1?s:c,(p=="series"||r)&&$("#"+n._id+"_Selection_series"+et+"_canvas").length==0&&$("#"+n._id+"_Selection_Cluster_point_"+s+"_canvas").length==0&&$("#"+n._id+"_Selection_"+c+"_point_"+s+"_canvas").length==0)if(ft=i._visiblePoints,ctx=this.createCanvasElement(n._id+"_Highlight_series"+c+"_canvas",n.svgWidth,n.svgHeight,tt),h=b=="none"||b==""?d:this.canvasPattern(ctx,n,t,d,o),this.createRect(n,ctx),f.indexOf("column")!=-1||f.indexOf("waterfall")!=-1||f.indexOf("bar")!=-1)for(u=0;u<e.length;u++)ot=$("#"+n._id+"_Selection_"+c+"_point_"+u+"_canvas").length==0?!0:!1,this.canvasSeriesRect(e[u],l,a,v,h,ot,i);else f=="pie"||f=="doughnut"||f=="pieofpie"?(e=ct==1?e:e[0],this.canvasHighlightCircle(n,o,s,l,a,v,h,e,f,ctx)):f=="pyramid"||f=="funnel"?this.canvasHighlightPyramid(n,e[0],o,ctx,l,a,v,h,f):f=="bubble"?this.canvasBubbleHighlight(o,e,n,c,h,v,l,a):f=="scatter"&&this.canvasScatterHighlight(e,h,v,l,a);else if(p=="cluster"&&$("#"+n._id+"_Selection_Cluster_point_"+s+"_canvas").length==0&&this.model.AreaType!="none"&&$("#"+n._id+"_Selection_"+c+"_point_"+s+"_canvas").length==0&&$("#"+n._id+"_Selection_series"+c+"_canvas").length==0){for(u=0,y=this.model._visibleSeries.length;u<y;u++)i=this.model._visibleSeries[u],i.seriesIndex=u,ft.push(i._visiblePoints[s]);for(nt=[],st=[],ctx=this.createCanvasElement(n._id+"_Highlight__Cluster_point_"+s+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),u=0,y=this.model._visibleSeries.length;u<y;u++){for(nt=[],o=n.model._visibleSeries[u].highlightSettings,h=o.color,l=o.opacity,a=o.border.color,v=o.border.width,b=o.pattern.toLowerCase(),d=this.highlightFill(o,n,u,s,et,r),h=b=="none"||b==""?d:this.canvasPattern(ctx,n,t,d,o),st.push(h),w=0,ht=e.length;w<ht;w++)e[w].SeriesIndex==u&&nt.push(e[w].Region);if(f.indexOf("column")!=-1||f.indexOf("waterfall")!=-1||f.indexOf("bar")!=-1)for(ot=$("#"+n._id+"_Selection_"+u+"_point_"+s+"_canvas").length==0?!0:!1,w=0,ht=nt.length;w<ht;w++)this.canvasSeriesRect(nt[w],l,a,v,h,ot,i);else f=="bubble"?this.canvasBubbleHighlight(o,nt,n,u,h,v,l,a):f=="scatter"&&this.canvasScatterHighlight(nt,h,v,l,a)}}else(p=="cluster"&&this.model.AreaType=="none"||p=="point"&&$("#"+n._id+"_Selection_"+c+"_point_"+s+"_canvas").length==0&&$("#"+n._id+"_Selection_series"+c+"_canvas").length==0&&$("#"+n._id+"_Selection_Cluster_point_"+s+"_canvas").length==0)&&(ft[0]=this.model._isPieOfPie?this._getPieOfPiePoint(s,i):i._visiblePoints[s],ctx=this.createCanvasElement(n._id+"_Highlight_"+c+"_point_"+s+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),h=b=="none"||b==""?d:this.canvasPattern(ctx,n,t,d,o),f.indexOf("column")!=-1||f.indexOf("waterfall")!=-1||f.indexOf("bar")!=-1?(e=[],e[0]=ut.region.Region,this.canvasSeriesRect(e[0],l,a,v,h,!0,i)):f=="pie"||f=="doughnut"||f=="pieofpie"?(e=[],e[0]=ut.pointData[0],this.canvasHighlightCircle(n,o,s,l,a,v,h,e,f,ctx)):f=="pyramid"||f=="funnel"?this.canvasHighlightPyramid(n,e[0],o,ctx,l,a,v,h,f):f=="bubble"?(e=[],e[0]=ut.region.Region,this.canvasBubbleHighlight(o,e,n,c,h,v,l,a)):f=="scatter"&&(e=[],e[0]=ut.region.Region,this.canvasScatterHighlight(e,h,v,l,a)));if(vt&&$("#"+n._id+"_Selection_Legend"+et+"_canvas").length==0)if(p!="cluster"||r||this.model.AreaType=="none")this.canvasHighlightLegend(n,i,o,"Highlight",tt,h);else for(u=0,y=k.length;u<y;u++)lt=k[u].seriesIndex,chartSeries=this.model._visibleSeries[lt],this.canvasHighlightLegend(n,chartSeries,o,"Highlight",tt,st[lt]);i.visibility==="visible"&&i.marker.visible==!0&&this.model.AreaType!="none"&&this.canvasHighlightMarker(n,i,ft,o,ctx,t,st)},canvasSeriesRect:function(n,t,i,r,u,f,e){var o={opacity:t,stroke:i,"stroke-width":r,fill:u},s=e.cornerRadius,h;n&&(o.x=n.Bounds.X,o.y=n.Bounds.Y,o.width=n.Bounds.Width,o.height=n.Bounds.Height,f&&(typeof s!="object"&&s>0||s.topLeft>0||s.bottomLeft>0||s.topRight>0||s.bottomRight>0?(o.cornerRadius=e.cornerRadius,h=ej.EjSvgRender.utils._calculateroundedCorner(o),o.d=h,ej.EjCanvasRender.prototype.drawPath(o,ctx)):this.drawRect(o,ctx)))},canvasSelection:function(n,t,i,r,u,f,e,o){var rt,at,et,wt,bt,ut,h,kt,dt,gt,ot,ni,g,d,vt,ft,ti,st,ii;i.seriesIndex=u;i.pointIndex=f;var nt=this.model._visibleSeries,c=o.color,a=o.opacity,v=o.border.color,y=o.border.width,w=o.pattern.toLowerCase(),yt=n.model.legend.visible,b=o.mode,s=i.type.toLowerCase(),tt=document.getElementById(n._id+"_canvas").getBoundingClientRect(),l=[],it=[],ht=this.model._visibleSeries.length,p=n.model.chartRegions,ct=this.model.clusterPoints,ui={seriesIndex:u,series:i},ri=n.model.AreaType=="none"&&ht==1?f:u,k=this.highlightFill(o,n,u,f,r,e),lt,pt;if(lt=p.length,n.model.AreaType!="none"||n.model.AreaType=="none"&&ht>1)for(h=0;h<lt;h++)((b=="series"||r)&&u==p[h].SeriesIndex||(b=="point"||r)&&u==p[h].SeriesIndex&&f==p[h].Region.PointIndex)&&(n.model.AreaType!="none"||b!="point"||r?l.push(p[h].Region):l.push(p[h].Region[f]));else if(lt>0){if(this.model._isPieOfPie){if(r)for(rt=0;rt<i.pieCollections.length;rt++)for(at=i.pieCollections[rt],et=0;et<at.length;et++)if(at[et].actualIndex==r.legendItem.LegendItem.PointIndex){wt=rt;break}bt=i.data?i.data.pointData[0].PieSeriesIndex:wt;ut=p[bt]}else ut=p[0];for(pt=ut.Region.length,h=0;h<pt;h++)f==ut.Region[h].PointIndex&&l.push(ut.Region[h])}if((b=="series"||r)&&(this.model.AreaType!="none"||this.model.AreaType=="none"&&ht>1))if(it=i._visiblePoints,ctx=this.createCanvasElement(n._id+"_Selection_series"+ri+"_canvas",n.svgWidth,n.svgHeight,tt),c=w=="none"||w==""?k:this.canvasPattern(ctx,n,t,k,o),this.createRect(n,ctx),s.indexOf("column")!=-1||s.indexOf("waterfall")!=-1||s.indexOf("bar")!=-1)for(h=0;h<l.length;h++)this.canvasSeriesRect(l[h],a,v,y,c,!0,i);else s=="pie"||s=="doughnut"||s=="pieofpie"?this.canvasHighlightCircle(n,o,f,a,v,y,c,l[0],s,ctx):s=="bubble"?this.canvasBubbleHighlight(o,l,n,u,c,y,a,v):s=="scatter"&&this.canvasScatterHighlight(l,c,y,a,v);else if(b=="cluster"&&this.model.AreaType!="none"&&$("#"+n._id+"_Selection_Cluster_point_"+f+"_canvas").length==0){for(kt=ct.length,g=0;g<kt;g++)dt=ct[g].seriesIndex,gt=ct[g].pointIndex,ot=$.grep(p,function(n){return n.SeriesIndex==dt&&n.Region.PointIndex==gt}),ni=ot.length,ni>0?(l.push(ot[0]),it.push(nt[ot[0].SeriesIndex]._visiblePoints[f])):it.push(nt[g]._visiblePoints[f]);for(this.selectedPoint=f,d=[],vt=[],ctx=this.createCanvasElement(n._id+"_Selection_Cluster_point_"+f+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),h=0,len=nt.length;h<len;h++){for(d=[],highlight=nt[h].selectionSettings,c=highlight.color,a=highlight.opacity,v=highlight.border.color,y=highlight.border.width,w=highlight.pattern.toLowerCase(),k=this.highlightFill(highlight,n,h,f,r),c=w=="none"||w==""?k:this.canvasPattern(ctx,n,t,k,highlight),vt.push(c),ft=0,ti=l.length;ft<ti;ft++)l[ft].SeriesIndex==h&&d.push(l[ft].Region);if(s.indexOf("column")!=-1||s.indexOf("waterfall")!=-1||s.indexOf("bar")!=-1)for(st=0,ii=d.length;st<ii;st++)this.canvasSeriesRect(d[st],a,v,y,c,!0,i);else s=="bubble"?this.canvasBubbleHighlight(highlight,d,n,h,c,y,a,v):s=="scatter"&&this.canvasScatterHighlight(d,c,y,a,v);!r&&this.model.AreaType!="none"&&yt&&(i=nt[h],i.seriesIndex=h,this.canvasHighlightLegend(n,i,o,"SelectionCluster",tt,c))}}else(b=="point"&&$("#"+n._id+"_Selection_"+u+"_point_"+f+"_canvas").length==0||this.model.AreaType=="none")&&(this.selectedPoint=f,it[0]=this.model._isPieOfPie?this._getPieOfPiePoint(f,i):i._visiblePoints[f],ctx=this.createCanvasElement(n._id+"_Selection_series"+u+"_point_"+f+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),c=w=="none"||w==""?k:this.canvasPattern(ctx,n,t,k,o),s.indexOf("column")!=-1||s.indexOf("waterfall")!=-1||s.indexOf("bar")!=-1?this.canvasSeriesRect(l[0],a,v,y,c,!0,i):s=="pie"||s=="doughnut"||s=="pieofpie"?this.canvasHighlightCircle(n,o,f,a,v,y,c,l,s,ctx):s=="pyramid"||s=="funnel"?this.canvasHighlightPyramid(n,l[0],o,ctx,a,v,y,c,s):s=="bubble"?this.canvasBubbleHighlight(o,l,n,u,c,y,a,v):s=="scatter"&&this.canvasScatterHighlight(l,c,y,a,v));yt&&(b!="cluster"||r)&&this.canvasHighlightLegend(n,i,o,"Selection",tt,c);i.marker.visible==!0&&this.model.AreaType!="none"&&this.canvasHighlightMarker(n,i,it,o,ctx,t,vt)},createRect:function(n,t){n.model.AreaType!="none"&&(t.lineWidth=0,t.strokeStyle="transparent",t.rect(n.model.m_AreaBounds.X,n.model.m_AreaBounds.Y,n.model.m_AreaBounds.Width,n.model.m_AreaBounds.Height),t.clip(),t.stroke(),t.save())},canvasHighlightPyramid:function(n,t,i,r,u,f,e,o,s){var v=i.color!=""?i.color:n.model.pointColors[t.PointIndex],a=n.model.title.text?ej.EjSvgRender.utils._measureText(n.model.title.text,$(this.svgObject).width()-n.model.margin.left-n.model.margin.right,n.model.title.font):0,h=n.pyrX=(n.model.legend.position.toLowerCase()==="left"?n.model.LegendViewerBounds.Width:0)+n.model.elementSpacing+n.model.margin.left,c=n.pyrY=(n.model.legend.position.toLowerCase()==="top"?n.model.LegendViewerBounds.Height:0)+(n.model.title.text?n.model._titleLocation.Y+a.height:n.model.margin.top+n.model.elementSpacing),l={opacity:u,stroke:f,"stroke-width":e,fill:o,type:s,d:"M "+(h+t.Line1.x)+" "+(c+t.Line1.y)+" L "+(h+t.Line2.x)+" "+(c+t.Line2.y)+" L "+(h+t.Line3.x)+" "+(c+t.Line3.y)+" L "+(h+t.Line4.x)+" "+(c+t.Line4.y)+" z"};s=="funnel"&&(l.d="M "+(h+t.Line1.x)+" "+(c+t.Line1.y)+" L "+(h+t.Line2.x)+" "+(c+t.Line2.y)+" L "+(h+t.Line3.x)+" "+(c+t.Line3.y)+" L "+(h+t.Line4.x)+" "+(c+t.Line4.y)+" L "+(h+t.Line5.x)+" "+(c+t.Line5.y)+" L "+(h+t.Line6.x)+" "+(c+t.Line6.y)+" z");ej.EjCanvasRender.prototype.drawPath(l,r)},canvasScatterHighlight:function(n,t,i,r,u){for(var o,f={},s={},e=0;e<n.length;e++)o={startX:n[e].Bounds.X+n[e].Bounds.Height/2,startY:n[e].Bounds.Y+n[e].Bounds.Width/2},s.height=n[e].Bounds.Height,s.width=n[e].Bounds.Width,f={},f.ShapeSize=s,f.cx=o.startX,f.cy=o.startY,f.Style={},f.Style.BorderColor=u,f.Style.Color=t,f.Style.Opacity=r,f.Style.BorderWidth=i,ej.EjSvgRender.chartSymbol._drawCircle(o,f,this,ctx)},canvasBubbleHighlight:function(n,t,i,r,u,f,e,o){for(var h,l,c={},s=0;s<t.length;s++)h=t[s].Bounds.Height/2,l=n.color!=""?n.color:i.model.seriesColors[r],c={cx:t[s].Bounds.X-this.model.series[r].xAxis.x+h+this.canvasX,cy:t[s].Bounds.Y-this.model.series[r].yAxis.y+h+this.canvasY,r:h,fill:u,"stroke-width":f,opacity:e,stroke:o},ej.EjCanvasRender.prototype.drawCircle(c,ctx)},canvasHighlightCircle:function(n,t,i,r,u,f,e,o,s,h){for(var a,l,c=0;c<o.length;c++)a=t.color!=""?t.color:t.mode=="series"&&n.model._visibleSeries.length>1?n.model.pointColors[c]:n.model.pointColors[i],l={opacity:r,stroke:u,lineWidth:f,color:e,x:o[c].StartX,y:o[c].StartY,radius:n.model._isPieOfPie?n.model.circularRadius[o[c].PieSeriesIndex]:n.model.circularRadius[o[c].SeriesIndex],innerRadius:n.model.innerRadius[o[c].SeriesIndex],startAngle:o[c].StartAngle,endAngle:o[c].EndAngle,type:s},this.highlightSegment(h,l)},canvasHighlightMarker:function(n,t,i,r,u,f,e){var s=r,y=s.pattern.toLowerCase(),p=t.type.toLowerCase(),o={},w=s.color!=""?s.color:n.model.seriesColors[t.seriesIndex],h,a,c,v,l;for(color=y=="none"||y==""?w:this.canvasPattern(u,n,f,w,s),o.Style={},o.Style.BorderColor=s.border.color,o.Style.Opacity=s.opacity,o.Style.BorderWidth=s.border.width,l=0;l<i.length;l++)h=i[l].symbolLocation,h=p.indexOf("line")!=-1||p.indexOf("area")!=-1?i[l].location:i[l].symbolLocation,h&&(a=this.model.AreaType=="cartesianaxes"?{startX:h.X+this.canvasX,startY:h.Y+this.canvasY}:{startX:h.X,startY:h.Y},c=t.marker,v,$.each(n.model.symbolShape,function(n){c.shape.toLowerCase()==n.toLowerCase()&&(v=n)}),o.ShapeSize=c.size,o.r=Math.sqrt(c.size.height*c.size.height+c.size.width*c.size.width)/2,o.cx=a.startX,o.cy=a.startY,o.Style.Color=e?e[l]:color,ej.EjSvgRender.chartSymbol["_draw"+v](a,o,n,u))},canvasHighlightLegend:function(n,t,i,r,u,f){var o=this.model._visibleSeries.length,e=n.model.AreaType=="none"&&o==1?t.pointIndex:t.seriesIndex,c=n._id+"_"+r+"_Legend"+e+"_canvas";if($("#"+c).length==0&&e<t.points.length){legendCtx=this.createCanvasElement(n._id+"_"+r+"_Legend"+e+"_canvas",n.svgWidth,n.svgHeight,u);legendRegion=n.model.AreaType!="none"||n.model.AreaType=="none"&&o>1?n.model.legendRegion[t.seriesIndex]:n.model.legendRegion[t.pointIndex];var s={startX:legendRegion.Bounds.LegendBound.X+legendRegion.Location.startX,startY:legendRegion.Bounds.LegendBound.Y+legendRegion.Location.startY},l={svgRenderer:n.svgRenderer,svgObject:n.svgObject},h={SeriesIndex:e,Style:{Color:f,Opacity:i.opacity,Visibility:!0,BorderWidth:0,BorderColor:f},context:!0,ShapeSize:legendRegion.Style.ShapeSize};legendRegion.SymbolShape.toLowerCase()=="seriestype"?(n.legendItem=legendRegion.LegendItem,ej.EjSvgRender.chartSymbol["_draw"+legendRegion.SymbolShape](s,h,n)):ej.EjSvgRender.chartSymbol["_draw"+legendRegion.SymbolShape](s,h,l,legendCtx)}},createCanvasElement:function(n,t,i,r){svgObj=document.createElement("canvas");_rootId=jQuery(this.element).attr("id");svgObj.setAttribute("id",n);svgObj.height=i;svgObj.width=t;svgObj.style["touch-action"]&&(svgObj.style["touch-action"]="none");svgObj.style["-ms-touch-action"]&&(svgObj.style["-ms-touch-action"]="none");this.svgRenderer.append(svgObj,this.element);var u=document.getElementById(n);return u.style.left=r.left+$(document).scrollLeft()+"px",u.style.top=r.top+$(document).scrollTop()+"px",u.style.position="absolute",svgObj.getContext("2d")},highlightSegment:function(n,t){n.save();n.beginPath();t.type=="pie"||t.type=="pieofpie"?(n.moveTo(t.x,t.y),n.arc(t.x,t.y,t.radius,t.startAngle-1.57,t.endAngle-1.57,!1)):(n.arc(t.x,t.y,t.radius,t.startAngle-1.57,t.endAngle-1.57,!1),n.arc(t.x,t.y,t.innerRadius,t.endAngle-1.57,t.startAngle-1.57,!0));n.fillStyle=t.color;n.globalAlpha=t.opacity;n.fill();n.lineWidth=t.lineWidth;n.strokeStyle=t.stroke;n.clip();n.stroke();n.closePath();n.restore()},canvasPattern:function(n,t,i,r,u){var c=u,a=c.name,l=c.pattern.toLowerCase(),e=r,s=c.opacity,v=c.border.color,y=c.border.width,o=document.createElement("canvas"),h=o.getContext("2d"),f=[];switch(l){case"chessboard":f[0]={x:0,y:0,width:10,height:10,fill:"white",stroke:"white",opacity:s,name:"rect"};f[1]={x:0,y:0,width:5,height:5,fill:e,opacity:s,name:"rect"};f[2]={x:5,y:5,width:5,height:5,fill:e,opacity:s,name:"rect"};o.width=10;o.height=10;this.loadPattern(t,f,"",h);break;case"pacman":f[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 9.081 9.194 L 14.887 6.114 C 14.075000000000001 4.618 12.484 3.0620000000000007 10.596 3.0620000000000007 L 8.835 3.0620000000000007 C 6.138 3.063 3 6.151 3 8.723 L 3 10.402000000000001 C 3 12.974 6.138 16.063000000000002 8.835 16.063000000000002 L 10.596 16.063000000000002 C 12.681000000000001 16.063000000000002 14.431000000000001 14.303000000000003 15.131 12.549000000000003 L 9.081 9.194 z","stroke-width":1,stroke:e,fill:e};o.width=18;o.height=18;this.loadPattern(t,f,"",h);break;case"crosshatch":f[0]={x:0,y:0,width:8,height:8,fill:"white",stroke:r,opacity:s,name:"rect"};f[1]={d:"M 0 0 L 8 8 Z","stroke-width":1,stroke:e,name:"path"};f[2]={d:"M 8 0 L 0 8 Z","stroke-width":1,stroke:e,name:"path"};o.width=8;o.height=8;this.loadPattern(t,f,"",h);break;case"dots":f[0]={x:0,y:0,width:7,height:7,transform:"translate(0,0)",fill:"white",opacity:s,name:"rect"};f[1]={cx:3,cy:3,r:2,"stroke-width":1,fill:e,name:"circle"};o.width=7;o.height=7;this.loadPattern(t,f,"",h);break;case"diagonalforward":f[0]={x:0,y:0,width:6,height:6,fill:"white",stroke:r,opacity:s,name:"rect"};f[1]={d:"M 3 -3 L 9 3 M 6 6 L 0 0 M 3 9 L -3 3","stroke-width":2,stroke:e,name:"path"};o.width=6;o.height=6;this.loadPattern(t,f,"",h);break;case"diagonalbackward":f[0]={x:0,y:0,width:6,height:6,"stroke-width":2,fill:"white",stroke:r,opacity:s,name:"rect"};f[1]={d:"M 3 -3 L -3 3 M 0 6 L 6 0 M 9 3 L 3 9","stroke-width":2,stroke:e,name:"path"};o.width=6;o.height=6;this.loadPattern(t,f,"",h);break;case"grid":f[0]={name:"rect",x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 1 3.5 L 11 3.5 M 0 3.5 L 11 3.5 M 0 7.5 L 11 7.5 M 0 11.5 L 11 11.5 M 5.5 0 L 5.5 12 M 11.5 0 L 11.5 12 Z","stroke-width":1,stroke:e};o.width=6;o.height=6;this.loadPattern(t,f,"",h);break;case"turquoise":f[0]={name:"rect",x:0,y:0,width:17,height:17,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 2.697 0.5319999999999996 C 3.8695005238907747 0.5319999999999996 4.82 1.4771268931071944 4.82 2.643 C 4.82 3.808873106892805 3.8695005238907747 4.754 2.697 4.754 C 1.5244994761092252 4.754 0.5739999999999998 3.808873106892805 0.5739999999999998 2.643 C 0.5739999999999998 1.4771268931071944 1.5244994761092252 0.5319999999999996 2.697 0.5319999999999996 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[2]={name:"path",d:"M 13.928 0.5319999999999996 C 15.100500523890776 0.5319999999999996 16.051000000000002 1.4771268931071944 16.051000000000002 2.643 C 16.051000000000002 3.808873106892805 15.100500523890776 4.754 13.928 4.754 C 12.755499476109225 4.754 11.805 3.808873106892805 11.805 2.643 C 11.805 1.4771268931071944 12.755499476109225 0.5319999999999996 13.928 0.5319999999999996 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[3]={name:"path",d:"M 8.313 0.5319999999999996 C 9.485500523890776 0.5319999999999996 10.436 1.4771268931071944 10.436 2.643 C 10.436 3.808873106892805 9.485500523890776 4.754 8.313 4.754 C 7.140499476109226 4.754 6.19 3.808873106892805 6.19 2.643 C 6.19 1.4771268931071944 7.140499476109226 0.5319999999999996 8.313 0.5319999999999996 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[4]={name:"path",d:"M 13.928 6.16 C 15.100500523890776 6.16 16.051000000000002 7.105126893107196 16.051000000000002 8.271 C 16.051000000000002 9.436873106892806 15.100500523890776 10.382000000000001 13.928 10.382000000000001 C 12.755499476109225 10.382000000000001 11.805 9.436873106892806 11.805 8.271 C 11.805 7.105126893107196 12.755499476109225 6.16 13.928 6.16 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[5]={name:"path",d:"M 8.313 6.16 C 9.485500523890776 6.16 10.436 7.105126893107196 10.436 8.271 C 10.436 9.436873106892806 9.485500523890776 10.382000000000001 8.313 10.382000000000001 C 7.140499476109226 10.382000000000001 6.19 9.436873106892806 6.19 8.271 C 6.19 7.105126893107196 7.140499476109226 6.16 8.313 6.16 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[6]={name:"path",d:"M 13.928 11.787999999999998 C 15.100500523890776 11.787999999999998 16.051000000000002 12.733126893107194 16.051000000000002 13.899 C 16.051000000000002 15.064873106892804 15.100500523890776 16.009999999999998 13.928 16.009999999999998 C 12.755499476109225 16.009999999999998 11.805 15.064873106892804 11.805 13.899 C 11.805 12.733126893107194 12.755499476109225 11.787999999999998 13.928 11.787999999999998 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[7]={name:"path",d:"M 8.313 11.787999999999998 C 9.485500523890776 11.787999999999998 10.436 12.733126893107194 10.436 13.899 C 10.436 15.064873106892804 9.485500523890776 16.009999999999998 8.313 16.009999999999998 C 7.140499476109226 16.009999999999998 6.19 15.064873106892804 6.19 13.899 C 6.19 12.733126893107194 7.140499476109226 11.787999999999998 8.313 11.787999999999998 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};o.width=17;o.height=17;this.loadPattern(t,f,"",h);break;case"star":f[0]={name:"rect",x:0,y:0,width:21,height:21,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 15.913 18.59 L 10.762 12.842 L 5.613 18.75 L 8.291 11.422 L 0.325 9.91 L 8.154 8.33 L 5.337 0.91 L 10.488 6.658 L 15.637 0.75 L 12.959 8.078 L 20.925 9.59 L 13.096 11.17 z","stroke-width":1,stroke:e,fill:e};o.width=21;o.height=21;this.loadPattern(t,f,"",h);break;case"triangle":f[0]={name:"rect",x:0,y:0,width:10,height:10,fill:"white",opacity:s};f[1]={name:"path",d:"M 4.987 0 L 7.48 4.847 L 9.974 9.694 L 4.987 9.694 L 0 9.694 L 2.493 4.847 z","stroke-width":1,stroke:e,fill:e};o.width=10;o.height=10;this.loadPattern(t,f,"",h);break;case"circle":f[0]={name:"rect",x:0,y:0,width:9,height:9,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"circle",cx:5.125,cy:3.875,r:3.625,"stroke-width":1,fill:e};o.width=9;o.height=9;this.loadPattern(t,f,"",h);break;case"tile":f[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0 9 L 0 0 L 9 0 z","stroke-width":1,stroke:e,fill:e};f[2]={name:"path",d:"M 9 9 L 9 0 L 18 0 z","stroke-width":1,stroke:e,fill:e};f[3]={name:"path",d:"M 0 18 L 0 9 L 9 9 z","stroke-width":1,stroke:e,fill:e};f[4]={name:"path",d:"M 9 18 L 9 9 L 18 9 z","stroke-width":1,stroke:e,fill:e};o.width=18;o.height=18;this.loadPattern(t,f,"",h);break;case"horizontaldash":f[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0 1.5 L 10 1.5 M 0 5.5 L 10 5.5 M 0 9.5 L 10 9.5 z","stroke-width":1,stroke:e,fill:e};o.width=12;o.height=12;this.loadPattern(t,f,"",h);break;case"verticaldash":f[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 1.5 0 L 1.5 10 M 5.5 0 L 5.5 10 M 9.5 0 L 9.5 10 z","stroke-width":1,stroke:e,fill:e};o.width=12;o.height=12;this.loadPattern(t,f,"",h);break;case"rectangle":f[0]={x:0,y:0,name:"rect",width:12,height:12,fill:"white",opacity:s};f[1]={name:"rect",x:1,y:2,width:4,height:9,fill:e,opacity:s};f[2]={name:"rect",x:7,y:2,width:4,height:9,fill:e,opacity:s};o.width=12;o.height=12;this.loadPattern(t,f,"",h);break;case"box":f[0]={x:0,y:0,name:"rect",width:13,height:13,fill:"white",opacity:s};f[1]={name:"rect",x:1.5,y:1.5,width:10,height:9,fill:e,opacity:s};o.width=10;o.height=10;this.loadPattern(t,f,"",h);break;case"horizontalstripe":f[0]={name:"rect",x:0,y:0,width:10,height:12,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0 0.5 L 10 0.5 M 0 4.5 L 10 4.5 M 0 8.5 L 10 8.5 z","stroke-width":1,stroke:e,fill:e};o.width=10;o.height=12;this.loadPattern(t,f,"",h);break;case"verticalstripe":f[0]={name:"rect",x:0,y:0,width:12,height:10,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0.5 0 L 0.5 10 M 4.5 0 L 4.5 10 M 8.5 0 L 8.5 10 z","stroke-width":1,stroke:e,fill:e};o.width=12;o.height=10;this.loadPattern(t,f,"",h);break;case"bubble":f[0]={name:"rect",x:0,y:0,width:20,height:20,transform:"translate(0,0)",fill:"#ffffff",opacity:s};f[1]={name:"circle",cx:5.217,cy:11.325,r:3.429,"stroke-width":1,fill:"#D0A6D1"};f[2]={name:"circle",cx:13.328,cy:6.24,r:4.884,"stroke-width":1,fill:e};f[3]={name:"circle",cx:13.277,cy:14.66,r:3.018,"stroke-width":1,fill:"#D0A6D1"};o.width=20;o.height=20;this.loadPattern(t,f,"",h);break;case"custom":o=document.getElementById(c.customPattern)}return n.createPattern(o,"repeat")},foundClasses:function(n){var t=[];return $("[id*="+n+"]").each(function(){var n=$(this).attr("class")?$(this).attr("class"):"";n.indexOf("Selection")>=0&&t.push(n)}),t},selection:function(n,t,i,r,u,f,e,o,s,h){var y=this.model.clusterPoints,vt=y?y.length:0,ht=this.model._visibleSeries,g=ht.length,l=this.model.AreaType=="none"&&g==1?e:f,a=i.selectionSettings,yt=this.model._visibleSeries[f].selectionSettings.type.toLowerCase()=="multiple"?!0:!1,c="series"+f,it=!1,pt=$("#"+s).attr("name"),rt=a.pattern.toLowerCase(),p=a.mode,ct,ot,w,tt,v,d,ft,nt,et,lt,at,ut,st,b;if(o&&(ct=o.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||o.indexOf(this.svgObject.id+"_Chart3D")>=0?!0:!1),(this.model.AreaType!="none"||this.model.AreaType=="none"&&p=="series"&&g>1)&&$("style").each(function(){$(this).html().indexOf("."+n._id+"SelectionStyle"+c)>-1&&(it=!0)}),!n.vmlRendering&&this.model.enable3D)(p=="series"||u)&&(this.model.AreaType!="none"||this.model.AreaType=="none"&&g!=1)?(this.highlightSeries(n,f,e,"Selection",c,a,t,u,h),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class","Selection"+c+"Style"+c+"1")):p=="cluster"&&n.model.AreaType!="none"?this.highlightCluster(n,f,e,"Selection",c,a,t,h):this.model.AreaType=="none"?(this.highlightPoint(n,f,e,"Selection",c+l,a,t,h),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class","Selection"+c+l+"Style"+c+l+"1")):(this.highlightPoint(n,f,e,"Selection",c,a,t,h),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class","Selection"+c+"Style"+c+"1"));else{if(p!="cluster"||u||n.model.AreaType=="none"){v={};v.name="2D";v.index=this.model.AreaType=="none"?l:f;v.api="Selection";v.color=a.color!=""?a.color:u?this.model.AreaType=="none"?this.model.pointColors[l]:this.model.seriesColors[l]:$("#"+s).attr("fill")!="none"?$("#"+s).attr("fill"):$("#"+s).attr("stroke");Object.prototype.toString.call(v.color)==="[object Array]"&&(v.color=v.color[1].color);var nt=rt=="none"||n.vmlRendering||rt==""?a.color:this.pattern(n,t,v,a),d=a.opacity,ft=a.border.color,et=a.border.width;it||(this.model.AreaType=="none"&&((p=="series"||u)&&g==1||p!="series"&&!u)?($("style").each(function(){$(this).html().indexOf(".SelectionStyle"+c+"Point"+l)>-1&&(it=!0)}),it||(this.createStyle(n,n._id+"Selection",c+"Point"+l,d,nt,ft,et),this.createStyle(n,n._id+"SelectionLegend",c+"Point"+l,d,nt,"transparent",0))):(this.model.AreaType=="none"&&g>1||this.model.AreaType!="none")&&(this.createStyle(n,n._id+"Selection",c,d,nt,ft,et),this.createStyle(n,n._id+"SelectionLegend",c,d,nt,"transparent",0)))}if((p=="series"||u)&&(n.model.AreaType=="none"&&g>1||n.model.AreaType!="none")){if(!ct)for(ot=$("#"+o).childNodes?$("#"+o).childNodes:[],w=0;w<ot.length;w++)$("#"+ot[w].id).attr("class",n._id+"SelectionStyle");$("[id*="+this.svgObject.id+"_Series"+l+"]").each(function(){if(this.parentNode.id==n.svgObject.id+"_SeriesGroup_"+l||this.parentNode.id==n.svgObject.id+"_symbolGroup_"+l){var t=$(this).attr("name")?n._id+"SelectionPathStyle"+c:n._id+"SelectionStyle"+c;$(this).attr("class",t)}});$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c);r&&$("#"+o).remove()}else if(p!="cluster"||n.model.AreaType=="none"||ej.util.isNullOrUndefined(s)){if($("#"+s).attr("name")||s==n.svgObject.id+"_Series"+l||n.model.AreaType=="none")$("#"+s).attr("class",n._id+"SelectionStyle"+c+"Point"+l),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c+"Point"+l),r&&$("#"+o).remove();else{if($("#"+s).attr("class",n._id+"SelectionStyle"+c),this.model.commonSeriesOptions.columnFacet=="cylinder"||i.columnFacet=="cylinder")for(w=0;w<2;w++)$("#"+s.replace(/2$/,w)).attr("class",n._id+"SelectionStyle"+c);$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c);$("#"+s+"_symbol").attr("class",n._id+"SelectionStyle"+c);r&&($("#"+s+"_symbol").attr("class",n._id+"SelectionStyle"+c),$("#"+o).remove())}b=$("#"+s).attr("name");b!=undefined&&(b=="candle"||b.indexOf("hilo")>=0)&&($("[id$="+s+"]").attr("class",n._id+"SelectionStyle"+c),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c))}else{for(tt=this.svgObject.id+"_Series",y=n.model.clusterPoints,l=s.match(/(\d+)/g),e=parseInt(l[l.length-1]),s.indexOf("SeriesText")>=0&&(lt=this.GetSeriesPoint(t),e=lt.region.Region.PointIndex),k=0;k<y.length;k++){ut=y[k].seriesIndex;c="ClusterSeries"+k;v={};v.index=k;v.name="2D";v.api="Selection"+c;a=ht[ut].selectionSettings;v.color=a.color!=""?a.color:this.model.seriesColors[ut];Object.prototype.toString.call(v.color)==="[object Array]"&&(v.color=v.color[1].color);d=a.opacity;var ft=a.border.color,et=a.border.width,nt=rt=="none"||n.vmlRendering||rt==""?v.color:this.pattern(n,t,v,a);$("style").each(function(){$(this).html().indexOf("."+n._id+"SelectionStyle"+c)>-1&&(at=!0)});at||(this.createStyle(n,n._id+"Selection",c,d,nt,ft,et),this.createStyle(n,n._id+"SelectionLegend",c,d,nt,"transparent",0));st=$("#"+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex).attr("name")?n._id+"SelectionPathStyle"+c:n._id+"SelectionStyle"+c;$("#"+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex).attr("class",st);$("#"+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex+"_symbol").attr("class",st);n.model._visibleSeries[ut].visibility!="hidden"&&$("#"+this.svgObject.id+"_LegendItemShape"+k).not("[class*='Highlight']").attr("class",n._id+"SelectionLegendStyle"+c);b=$("#"+s).attr("name");b!=undefined&&(b=="candle"||b.indexOf("hilo")>=0)&&$("[id$="+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex+"]").attr("class","HighlightStyle"+c)}r&&($("#"+this.svgObject.id+"_Series"+k+"_Point"+e).attr("class",n._id+"SelectionStyle"+c),$("#"+this.svgObject.id+"_Series"+k+"_Point"+e+"_symbol").attr("class",n._id+"SelectionStyle"+c),$("#"+o).remove())}}},removeSelection:function(n,t,r,u,f,e,o){var c=r.length,h=this.model.clusterPoints,l=h?h.length:0,s;if((u=="series"||e)&&(this.model.AreaType!="none"||this.model.AreaType=="none"&&c>1))for(i=0;i<c;i++)selectionSettings=r[i].selectionSettings,selectionSettings.mode!="point"&&selectionSettings.type.toLowerCase()=="single"||e&&selectionSettings.type.toLowerCase()=="single"?($(this.svgObject).find("[id*="+this.svgObject.id+"_SeriesGroup_"+i+"],[id*="+this.svgObject.id+"_symbolGroup_"+i+"],[id*=_Region_Series_"+i+"_]").each(function(){$(this).find("*").attr("class","");$(this).attr("class","")}),$("#"+this._id+"_Selection_Legend"+i+"_canvas").remove(),$("#"+this._id+"_Selection_series"+i+"_canvas").remove(),$("[id*=_Region_Series_"+i+"]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+i).attr("class","")):o&&selectionSettings.type.toLowerCase()=="multiple"&&($("#"+this._id+"_Selection_series"+n+"_canvas").remove(),$("#"+this._id+"_Selection_Legend"+n+"_canvas").remove(),$("[id*=_Region_Series_"+n+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class",""));if(u=="cluster"&&this.model.AreaType!="none"&&!e)if(f)if(this.model.enableCanvasRendering)$("[id*="+this._id+"_Selection_Cluster_point_"+t+"]").remove(),$("[id*="+this._id+"_Selection_Cluster]").length==0?$("[id*="+this._id+"_SelectionCluster_Legend]").remove():0;else{for(s=0;s<l;s++)$("[id*=_Region_Series_"+h[s].seriesIndex+"_Point_"+h[s].pointIndex+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+h[s].seriesIndex+"_Point"+h[s].pointIndex+"]").attr("class","");pointClasses=this.model.enable3D?this.foundClasses("_Region_Series_"+n):this.foundClasses(this.svgObject.id+"_Series"+n);pointClasses.length==0?$("[id*="+this.svgObject.id+"_LegendItemShape]").attr("class",""):0}else if(this.model.enableCanvasRendering)$("[id*="+this._id+"_Selection_Cluster]").remove(),$("[id*="+this._id+"_SelectionCluster_Legend]").remove(),this.selectedPoint=null;else for(s=0;s<l;s++)$("[id*=_Region_Series_"+h[s].seriesIndex+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+h[s].seriesIndex+"_Point]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+h[s].seriesIndex).attr("class","");u!="point"||this.model.AreaType=="none"||e||(f?($("#"+this._id+"_Selection_series"+n+"_point_"+t+"_canvas").remove(),$("[id*=_Region_Series_"+n+"_Point_"+t+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point"+t+"]").attr("class",""),$("[id*="+this._id+"_Selection_series"+n+"]").length==0?$("#"+this._id+"_Selection_Legend"+n+"_canvas").remove():0,pointClasses=this.model.enable3D?this.foundClasses("_Region_Series_"+n):this.foundClasses(this.svgObject.id+"_Series"+n),pointClasses.length==0?$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class",""):0):($("[id*="+this._id+"_Selection_series"+n+"_point_]").remove(),$("[id*="+this._id+"_Selection_Legend"+n+"]").remove(),$("[id*=_Region_Series_"+n+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class","")));u!="point"&&u!="cluster"&&(u!="series"||this.model._visibleSeries.length!=1||this.model.AreaType!="none"||e)||(f?($("#"+this._id+"_Selection_series"+n+"_point_"+t+"_canvas").remove(),$("[id*=_Region_Series_"+n+"_Point_"+t+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point"+t+"]").attr("class",""),this.model._visibleSeries.length>1?$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class",""):$("#"+this.svgObject.id+"_LegendItemShape"+t).attr("class",""),this.model._visibleSeries.length>1?$("#"+this._id+"_Selection_Legend"+n+"_canvas").remove():$("#"+this._id+"_Selection_Legend"+t+"_canvas").remove()):($("[id*="+this._id+"_Selection_series]").remove(),$("[id*="+this._id+"_Selection_Legend]").remove(),$("[id*=_Region_Series_"+n+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point]").attr("class",""),this.model._visibleSeries.length>1?$("[id*="+this.svgObject.id+"_LegendItemShape"+n+"]").attr("class",""):$("[id*="+this.svgObject.id+"_LegendItemShape]").attr("class","")))},createStyle:function(n,t,i,r,u,f,e,o){var s,h,c,l;n.vmlRendering?(s=document.createElement("style"),s.id=t+"Segment",r=r*100,h="."+t+"Style"+i+" {filter: alpha(opacity="+r+");}."+t+"PathStyle"+i+" {filter: alpha(opacity="+r+");}",s.setAttribute("type","text/css"),s.styleSheet?s.styleSheet.cssText=h:(c=document.createTextNode(h),s.appendChild(c)),l=document.getElementsByTagName("head")[0],l.appendChild(s)):($("<style id="+t+"Segment"+i+" type='text/css'> ."+t+"Style"+i+"{ fill:"+u+";opacity:"+r+";stroke:"+f+";stroke-width:"+e+";stroke-opacity:"+o+"}<\/style>").appendTo("body"),$("<style id="+t+"Path"+i+" type='text/css'> ."+t+"PathStyle"+i+"{ opacity:"+r+";stroke:"+f+";stroke-width:"+e+";stroke-opacity:"+o+"}<\/style>").appendTo("body"))},highlightPoint:function(n,t,i,r,u,f,e){for(var s,a,h,l="_Region_Series_"+t+"_Point_"+i,c=$(this.svgObject).find("[id$="+l+"],[id*="+l+"back],[id*="+l+"front]"),o=0;o<c.length;o++)s=[],s.api=r+u,s.seriesName=u,s.name=$("[id="+c[o].id+"]").attr("name"),s.index=o,a=this.highlightFill(f,n,t,i),h=$("#"+c[o].id).attr("class"),h=h?h:"",h.indexOf("Selection")<0&&$("[id="+c[o].id+"]").attr("class",this.dStyle(s,a,n,e,f))},highlightCluster:function(n,t,i,r,u,f,e){var u,a,l,s,v,h,y,c,p,o;if(n.model.AreaType!="none"){for(h=[],y=n.model._visibleSeries[t]._visiblePoints[i].x,c=0,p=n.model._visibleSeries.length;c<p;c++)for(o=0;o<n.model._visibleSeries[c]._visiblePoints.length;o++)y==n.model._visibleSeries[c]._visiblePoints[o].x&&(h[h.length]={seriesIndex:c,pointIndex:o});for(k=0;k<h.length;k++){for(u="series"+k,a="_Region_Series_"+h[k].seriesIndex+"_Point_"+h[k].pointIndex,l=$(this.svgObject).find("[id$="+a+"],[id*="+a+"back],[id*="+a+"front]"),o=0;o<l.length;o++)s=[],s.api=r+u,s.seriesName="series"+k,s.name=$("[id="+l[o].id+"]").attr("name"),s.index=o,t=k,f=r=="Highlight"?n.model._visibleSeries[k].highlightSettings:n.model._visibleSeries[k].selectionSettings,v=this.highlightFill(f,n,t,i),className=$("#"+l[o].id).attr("class"),className=className?className:"",className.indexOf("Selection"+u+"Style")<0&&className.indexOf("SelectionStyle")<0&&$("[id="+l[o].id+"]").attr("class",this.dStyle(s,v,n,e,f));r=="Highlight"?$("#"+this.svgObject.id+"_LegendItemShape"+k).not("[class*='Selection']").attr("class","Highlight"+u+"Style"+u+"1"):$("#"+this.svgObject.id+"_LegendItemShape"+k).attr("class","Selection"+u+"Style"+u+"1")}}},highlightSeries:function(n,t,i,r,u,f,e,o){var t=t,v=i,y=n.model._visibleSeries.length,p=n.model.AreaType=="none"&&y==1?"_Region_Series_"+t+"_Point_"+i:"_Region_Series_"+t+"_Point_",l=$(this.svgObject).find("[id*="+p+"]"),c,a,s=o?$("#"+this.svgObject.id+"_LegendItemShape"+i).attr("class"):e?$("#"+e.target.id).attr("class"):"",h;if(s=s?s:"",s.indexOf("SelectionStyle")<0||o)for(h=0;h<l.length;h++)c=[],c.api=r+u,c.seriesName=u,c.name=$("[id="+l[h].id+"]").attr("name"),c.index=h,a=this.highlightFill(f,n,t,v,o),s=$("#"+l[h].id).attr("class"),s=s?s:"",s.indexOf("SelectionStyle")<0&&s.indexOf("Selection"+u+"Style")<0&&$("[id="+l[h].id+"]").attr("class",this.dStyle(c,a,n,e,f))},highlight:function(n,t,i,r,u,f,e,o){var h=i.highlightSettings,y=$.inArray(i,n.model._visibleSeries),s="series"+y,ft=!1,c=y,l=e||t.target.id,yt=jQuery.uaMatch(navigator.userAgent),ht,ct,a,b,d,v,nt,at,p,vt,it,w;!o&&this.isTouch(t)&&yt.browser=="chrome"&&(myLocation=t.originalEvent.changedTouches[0],l=document.elementFromPoint(myLocation.clientX,myLocation.clientY).id);f=f||t.target.parentNode.id;var pt=f.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||f.indexOf(this.svgObject.id+"_Chart3D")>=0?!0:!1,wt=$("#"+l).attr("name"),rt=h.pattern.toLowerCase(),et=n.model._visibleSeries.length;if(n.model.AreaType=="none"&&et==1&&(n.model.enable3D?c=r?r.legendItem.LegendItem.PointIndex:u.region.Region.PointIndex:(ht=r?this.svgObject.id+"_LegendItemShape":this.svgObject.id+"_Series"+y+"_Point",ct=r?this.svgObject.id+"_LegendItemShape"+r.legendItem.LegendItem.PointIndex:l,pointIndex=ct.substr(ht.length),c=pointIndex)),$("style").each(function(){$(this).html().indexOf(".HighlightStyle"+s)>-1&&(ft=!0)}),n.model.enable3D&&!n.vmlRendering)(h.mode=="series"||r)&&(n.model.AreaType=="none"&&et!=1||n.model.AreaType!="none")?(this.highlightSeries(n,y,c,"Highlight",s,h,t,r),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","Highlight"+s+"Style"+s+"1")):h.mode=="cluster"&&n.model.AreaType!="none"?this.highlightCluster(n,y,u.pointData.pointIndex,"Highlight",s,h,t):(pointIndex=u?u.pointData.pointIndex:c,this.highlightPoint(n,y,pointIndex,"Highlight",s+pointIndex,h,t),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","Highlight"+s+pointIndex+"Style"+s+pointIndex+"1"));else{if(h.mode||this.model.AreaType=="none"){a={};a.name="2D";a.index=y;a.api="Highlight";a.color=h.color!=""?h.color:r?this.model.AreaType=="none"?this.model.pointColors[c]:this.model.seriesColors[c]:$("#"+l).attr("fill");Object.prototype.toString.call(a.color)==="[object Array]"&&(a.color=a.color[1].color);var g=rt=="none"||n.vmlRendering||rt==""?h.color:this.pattern(n,t,a,h),tt=o?1:h.opacity,ot=o?i.type.toLowerCase().indexOf("hilo")==-1?n.model.highlightColor:g:h.border.color,st=o?3.5:h.border.width,lt=o&&i.type.toLowerCase().indexOf("hilo")==-1?.5:1;ft||(this.createStyle(n,"Highlight",s,tt,g,ot,st,lt),this.createStyle(n,"HighlightLegend",s,tt,g,"transparent",0,lt))}if(b=r?$("#"+this.svgObject.id+"_LegendItemShape"+c).attr("class"):$("#"+l).attr("class"),b=b?b:"",b.indexOf("Selection")==-1)if((h.mode=="series"&&!o||r)&&(n.model.AreaType=="none"&&et!=1||n.model.AreaType!="none"))$("[id*="+this.svgObject.id+"_Series"+c+"]").each(function(){if(this.parentNode.id==n.svgObject.id+"_SeriesGroup_"+c||this.parentNode.id==n.svgObject.id+"_symbolGroup_"+c){var t=$(this).attr("class"),i=$(this).attr("name")?"HighlightPathStyle"+s:"HighlightStyle"+s;t!="SelectionStyle"+s&&t!="SelectionStyleClusterSeries"+y&&t!="SelectionPathStyle"+s&&f.indexOf(n.svgObject.id+"_symbolGroup_"+c)<=0&&$(this).attr("class",i)}}),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s);else if(h.mode!="cluster"||n.model.AreaType=="none"||o){if(!$("#"+l).attr("name")&&l!=n.svgObject.id+"_Series"+c){if(ut=$("#"+l).attr("class")?$("#"+l).attr("class"):"",ut.indexOf("Selection")!=0&&f.indexOf(n.svgObject.id+"_symbolGroup_"+c)<=0&&(u||r)){if(pt&&($("#"+l).attr("class","HighlightStyle"+s),this.model.commonSeriesOptions.columnFacet=="cylinder"||i.columnFacet=="cylinder"))for(p=0;p<2;p++)$("#"+l.replace(/2$/,p)).attr("class","HighlightStyle"+s);pointIndex=u?u.region.Region.PointIndex:r.legendItem.LegendItem.PointIndex;$("#"+l+"_symbol").attr("class","HighlightStyle"+s);$("#"+this.svgObject.id+"_Series"+y+"_Point"+pointIndex).not("[class*='Selection']").attr("class","HighlightStyle"+s);$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s)}l.indexOf("symbol")>-1&&$("#"+l).attr("class","HighlightStyle"+s)}w=$("#"+l).attr("name");w!=undefined&&(w=="candle"||w.indexOf("hilo")>=0)&&($("[id$="+l+"]").attr("class","HighlightStyle"+s),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s))}else{if(d=this.svgObject.id+"_Series",v=[],c=l.match(/(\d+)/g),c&&l.toLowerCase().indexOf("point")>0)for(pointIndex=parseInt(c[c.length-1]),at=n.model._visibleSeries[y]._visiblePoints[pointIndex].xValue,p=0,vt=n.model._visibleSeries.length;p<vt;p++)for(it=0;it<n.model._visibleSeries[p]._visiblePoints.length;it++)at==n.model._visibleSeries[p]._visiblePoints[it].xValue&&(v[v.length]={seriesIndex:p,pointIndex:it});for(k=0;k<v.length;k++){nt=v[k].seriesIndex;s="series"+nt;a={};a.name="2D";a.api="Highlight"+s;h=n.model._visibleSeries[nt].highlightSettings;a.color=h.color!=""?h.color:this.model.seriesColors[nt];Object.prototype.toString.call(a.color)==="[object Array]"&&(a.color=a.color[1].color);tt=h.opacity;ot=h.border.color;st=h.border.width;g=rt=="none"||n.vmlRendering||rt==""?a.color:this.pattern(n,t,a,h);ft||(this.createStyle(n,"Highlight",s,tt,g,ot,st),this.createStyle(n,"HighlightLegend",s,tt,g,"transparent",0));var ut=$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex).attr("class"),bt=$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex+"_symbol").attr("class"),b=$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex).attr("name")?"HighlightPathStyle"+s:"HighlightStyle"+s;ut!="SelectionStyleseries"+k&&ut!="SelectionPathStyle"+s&&f.indexOf(n.svgObject.id+"_symbolGroup_"+k)<=0&&($("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex).attr("class",b),$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex+"_symbol").attr("class",b));n.model._visibleSeries[nt].visibility!="hidden"&&$("#"+this.svgObject.id+"_LegendItemShape"+nt).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s);w=$("#"+l).attr("name");w!=undefined&&(w=="candle"||w.indexOf("hilo")>=0)&&$("[id$="+d+v[k].seriesIndex+"_Point"+v[k].pointIndex+"]").attr("class","HighlightStyle"+s)}}}},dStyle:function(n,t,i,r,u){var c=ej.Ej3DRender.prototype.polygon3D.prototype,h=u,e=n.api,o=n.seriesName,l=h.opacity,s,f;return t=i.colorNameToHex(t),t=n.name=="XLight"?c.applyXLight(t,i):n.name=="ZLight"?c.applyZLight(t,i):t,s={},s.name=n.name,s.color=t,s.api=e,t=h.pattern=="none"?t:this.pattern(i,r,s,h),document.getElementById(e+"Segment"+o)?(f=document.getElementById(e+"Segment"+o),f.innerHTML=f.innerHTML+"."+e+"Style"+o+n.index+" { fill:"+t+";opacity:"+l+" }"):(f=document.createElement("style"),f.id=e+"Segment"+o,f.type="text/css",f.innerHTML="."+e+"Style"+o+n.index+" { fill:"+t+";opacity:"+l+" }",document.getElementsByTagName("head")[0].appendChild(f)),e+"Style"+o+n.index},pattern:function(n,t,i,r){var v=r,o=i.api,s=v.pattern.toLowerCase(),e=i.color,c=v.opacity!=""?v.opacity:$("#"+t.target.id).attr("opacity"),a="#ffffff",y,l,u,h,f;document.getElementById(o+"Def")?l=$("#"+o+"Def")[0]:(y={id:o+"Def"},l=n.svgRenderer.createPattern(y,"svg"),n.svgRenderer.append(l,n.svgObject));n.model.enable3D&&(a=i.name=="XLight"?"#595959":i.name=="ZLight"?"#737373":"#808080");"#"+s+"_"+o+"_"+i.name+"_"+i.index&&$("#"+s+"_"+o+"_"+i.name+"_"+i.index).remove();u=[];switch(s){case"chessboard":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:10,height:10},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:10,height:10,fill:a,opacity:c,name:"rect"},u[1]={x:0,y:0,width:5,height:5,fill:e,opacity:c,name:"rect"},u[2]={x:5,y:5,width:5,height:5,fill:e,opacity:c,name:"rect"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"pacman":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"17.917",height:"18.384"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:17.917,height:18.384,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M9.081,9.194l5.806-3.08c-0.812-1.496-2.403-3.052-4.291-3.052H8.835C6.138,3.063,3,6.151,3,8.723v1.679 c0,2.572,3.138,5.661,5.835,5.661h1.761c2.085,0,3.835-1.76,4.535-3.514L9.081,9.194z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"crosshatch":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"8",height:"8"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:8,height:8,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={d:"M0 0L8 8ZM8 0L0 8Z","stroke-width":1,stroke:e,name:"path"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"dots":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:7,height:7,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={cx:3,cy:3,r:2,"stroke-width":1,fill:e,name:"circle"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"diagonalforward":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={d:"M 3 -3 L 9 3 M 6 6 L 0 0 M 3 9 L -3 3","stroke-width":2,stroke:e,name:"path"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"diagonalbackward":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={d:"M 3 -3 L -3 3 M 0 6 L 6 0 M 9 3 L 3 9","stroke-width":2,stroke:e,name:"path"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"grid":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M1 3.5L11 3.5 M0 3.5L11 3.5 M0 7.5L11 7.5 M0 11.5L11 11.5 M5.5 0L5.5 12 M11.5 0L11.5 12Z","stroke-width":1,stroke:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"turquoise":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"17",height:"17"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:17,height:17,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0.5739999999999998,2.643a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[2]={name:"path",d:"M11.805,2.643a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[3]={name:"path",d:"M6.19,2.643a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[4]={name:"path",d:"M11.805,8.217a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[5]={name:"path",d:"M6.19,8.217a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[6]={name:"path",d:"M11.805,13.899a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[7]={name:"path",d:"M6.19,13.899a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"star":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"21",height:"21"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:21,height:21,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M15.913,18.59L10.762 12.842 5.613 18.75 8.291 11.422 0.325 9.91 8.154 8.33 5.337 0.91 10.488 6.658 15.637 0.75 12.959 8.078 20.925 9.59 13.096 11.17 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"triangle":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"10",height:"10"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:10,height:10,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M4.987,0L7.48 4.847 9.974 9.694 4.987 9.694 0 9.694 2.493 4.847 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"circle":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"9",height:"9"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:9,height:9,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"circle",cx:5.125,cy:3.875,r:3.625,"stroke-width":1,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"tile":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"18",height:"18"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0,9L0 0 9 0 z","stroke-width":1,stroke:e,fill:e},u[2]={name:"path",d:"M9,9L9 0 18 0 z","stroke-width":1,stroke:e,fill:e},u[3]={name:"path",d:"M0,18L0 9 9 9 z","stroke-width":1,stroke:e,fill:e},u[4]={name:"path",d:"M9,18L9 9 18 9 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"horizontaldash":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"12"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0,1.5 L10 1.5 M0,5.5 L10 5.5 M0,9.5 L10 9.5 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"verticaldash":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"12"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M1.5,0 L1.5 10 M5.5,0 L5.5 10 M9.5,0 L9.5 10 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"rectangle":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:12,height:12},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",width:12,height:12,fill:a,opacity:c},u[1]={name:"rect",x:1,y:2,width:4,height:9,fill:e,opacity:c},u[2]={name:"rect",x:7,y:2,width:4,height:9,fill:e,opacity:c},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"box":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:10,height:10},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",width:13,height:13,fill:a,opacity:c},u[1]={name:"rect",x:1.5,y:1.5,width:10,height:9,fill:e,opacity:c},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"horizontalstripe":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"10",height:"12"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:10,height:12,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0,0.5 L10 0.5 M0,4.5 L10 4.5 M0,8.5 L10 8.5 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"verticalstripe":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"10"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:12,height:10,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0.5,0 L0.5 10 M4.5,0 L4.5 10 M8.5,0 L8.5 10 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"bubble":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"20",height:"20"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:20,height:20,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"circle",cx:5.217,cy:11.325,r:3.429,"stroke-width":1,fill:"#D0A6D1"},u[2]={name:"circle",cx:13.328,cy:6.24,r:4.884,"stroke-width":1,fill:e},u[3]={name:"circle",cx:13.277,cy:14.66,r:3.018,"stroke-width":1,fill:"#D0A6D1"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"custom":return"url(#"+v.customPattern+")"}},loadPattern:function(n,t,i,r){for(var f,u=0;u<t.length;u++)r?t[u].name=="rect"?(t[u].stroke="transparent",this.drawRect(t[u],r)):t[u].name=="path"?ej.EjCanvasRender.prototype.drawPath(t[u],r):t[u].name=="circle"&&(t[u].stroke="transparent",ej.EjCanvasRender.prototype.drawCircle(t[u],r)):(f=n.svgRenderer.createPattern(t[u],t[u].name),i.appendChild(f))},drawRect:function(n,t){t.save();t.beginPath();t.globalAlpha=n.opacity;t.lineWidth=n["stroke-width"];t.strokeStyle=n.stroke;t.rect(n.x,n.y,n.width,n.height);n.fill=="none"&&(n.fill="transparent");t.fillStyle=n.fill;n.transform&&t.translate(n.transform[0],n.transform[1]);t.rotate(n.rotate*Math.PI/180);t.fillRect(n.x,n.y,n.width,n.height);t.clip();t.stroke();t.restore()},chartRightClick:function(n){return this.chartRightClick=!0,this.isTouch(n)&&this.model.crosshair.visible?(event.preventDefault(),event.stopPropagation(),!1):void 0},chartMouseUpTouch:function(n){var t=this,r=jQuery.uaMatch(navigator.userAgent),i=this.calMousePosition(n),u=this.model.browserInfo;return this.mousemoveX=i.X,this.mousemoveY=i.Y,this.enableTrackBall(),clearTimeout(this.model.doubleTapTimer),this.drag||(this.model.doubleTapTimer=setTimeout(function(){(t.model.tapNum<2||t.model.crosshair.visible)&&t.singleTap(n);t.model.tapNum=0;t.model.cachedX=0;t.model.cachedY=0},200)),t.model.tapNum==2&&(t.model.doubleTapped=!1),!0},getEvent:function(n){return n.targetTouches&&n.targetTouches[0]?n.targetTouches[0]:n},doubleTap:function(n){var r=this.getEvent(n),u=r.pageX,f=r.pageY,o=this.model,e=200,i,t=o.m_AreaBounds;this.model.cachedX=this.model.cachedX||u;this.model.cachedY=this.model.cachedY||f;timestamp=(new Date).getTime();this.mouseDownX>=t.X&&this.mouseDownX<t.X+t.Width&&this.mouseDownY<t.Y+t.Height&&this.mouseDownY>=t.Y&&Math.abs(u-this.model.cachedX)<e&&Math.abs(f-this.model.cachedY)<e&&this.model.tapNum++;this.model.tapNum==2&&(this.model.doubleTapped=!0,this.multiSelectMouseDown(n),this.drag=this.model.zooming.enable||this._isMultiSelect,i=this.model.trackerElement,i&&($(i).finish(),i=null))},singleTap:function(n){var t=this,o=n.target.id,p=this.model._visibleSeries,f,s=this.getEvent(n),v=s.pageX,y=s.pageY,h=10,r,i,c,e,u,l,a;if(!this.panning&&!this.isZoomButtonHovered(n.target)){for(this.cancelEvent(n),t.model.trackerElement&&($.finish?$(t.model.trackerElement).finish():$(t.model.trackerElement).stop(!0,!0),t.model.trackerElement=null),$(".ejTooltip"+this._id).remove(),(!t.model.crosshair.visible||t.model.AreaType!="cartesianaxes")&&Math.abs(v-t.model.cachedX)<h&&Math.abs(y-t.model.cachedY)<h?this.chartInteractiveBehavior(n):(t.model.element=$(document).find("#"+this.svgObject.id+"_CrosshairGroup"),t.model.trackerElement=$(t.model.element).children().not(".Tracker").not("defs"),$(t.model.trackerElement).length>0&&$(t.model.trackerElement).fadeOut(1e3,function(){$(t.model.element).find('[id*="trackSymbol"]').attr("visibility","hidden");t.model.trackerElement=null;t._removeHighlight()}),r=$(document).find('[id*="_trackball_grouping_tooltip"]'),$(r).length>0&&$(r).fadeOut(1e3,function(){$(r).remove()})),this.axisTooltip(n,o),this.showTitleTooltip(n,o),this.model.enableCanvasRendering&&(this._textTooltip(n,this.model.xAxisLabelRegions),this._textTooltip(n,this.model.yAxisLabelRegions)),i=0,c=this.model.series.length;i<c;i++)e=this.model.series[i],u=e.marker.dataLabel,!e._enableSmartLabels||this.model.enable3D||u.enableWrap||(l=u.template,a=u.font,this.model.AreaType=="none"&&ej.util.isNullOrUndefined(l)&&this.datalabelTooltip(n,i,a));$(".ejTooltip"+this._id).length>0&&(f=$(".ejTooltip"+this._id));$(".tooltipDiv"+this._id).length>0&&(f=$(".tooltipDiv"+this._id));window.clearTimeout(t.model.timer);t.model.trackerElement=f;t.model.timer=setTimeout(function(){if(pointData=t.model.prevPoint,t.model.trackerElement)t.model.trackerElement.fadeOut(500,function(){if(pointData){if(t.model.AreaType!="polaraxes"){var n=ej.EjSvgRender.utils._getPoint(pointData.point,pointData.series);t.drawTrackerSymbol(pointData.series,pointData.seriesIndex,pointData.pointIndex,null,n)}$("#canvas_trackSymbol").remove()}$("[id*=_TrackSymbol]").remove()});else{if(pointData&&t.model.AreaType!="polaraxes"){var n=ej.EjSvgRender.utils._getPoint(pointData.point,pointData.series);t.drawTrackerSymbol(pointData.series,pointData.seriesIndex,pointData.pointIndex,null,n)}t.model.crosshair.visible||($("#canvas_trackSymbol").remove(),$("[id*=_TrackSymbol]").remove())}},1200)}n.originalEvent.pointerType||this.panning||!this.model.selectionEnable||this._doClick(n)},_getPieOfPiePoint:function(n,t,i){for(var f,u=i?t.points:t._visiblePoints,e=u.length,r=0;r<e;r++)n==u[r].actualIndex&&(f=u[r]);return f},tooltip:function(n,t){var rt=!1,f,l,i=this.GetSeriesPoint(t),b,lt,p,at,vt,u,k,o,et,ot,yt,pt,a,wt,tt,h,e,kt,dt,st,c,d,ht,s,ct,ii;if($("#canvas_trackSymbol").remove(),ej.util.isNullOrUndefined(i)&&!this.dragPoint&&$("#"+n.svgObject.id+"_TrackToolTip").remove(),this.model.crosshair.visible||this.model.AreaType!="cartesianaxes")$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").hide(),ej.util.isNullOrUndefined(i)&&(clearTimeout(this.removeTooltip),n.removeTooltip=setTimeout(function(){$(".tooltipDiv"+n._id).remove()},1e3));else{for(var ut=this.model.indicators,v=this.model._visibleSeries,ft,y,w,ri=v.length,nt=0,g=0;g<ri;g++)for(w=v[g].trendlines,y=0;y<w.length;y++)w[y].visibility.toLowerCase()!="visible"||w[y].isNull||this.model.series[0].type=="boxandwhisker"||(w[y]._visiblePoints=w[y].points,v=v.concat(w[y]));for(b=0;b<ut.length&&ut[b].segment;b++)ft=ut[b],ft.visible&&(v=v.concat(ft.segment));for(lt=v.length,s=0;s<lt;s++)f=v[s],l=s,p=f.type.toLowerCase(),f.visibility.toLowerCase()!="visible"||p==="scatter"||p==="bubble"||p==="column"||p.indexOf("bar")!=-1||p==="stackingcolumn"||p==="stackingcolumn100"||f._hiloTypes?ej.util.isNullOrUndefined(i)&&!this.dragPoint&&$(".tooltipDiv"+this._id).hasClass(this.svgObject.id)&&(clearTimeout(this.removeTooltip),n.removeTooltip=setTimeout(function(){$(".tooltipDiv"+n._id).remove()},1e3)):($("#"+n.svgObject.id+"_TrackToolTipTemplate_"+l).remove(),$(".tooltipDiv"+this._id).hasClass(n.svgObject.id)||$(".tooltipDiv"+this._id).remove(),$("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackSymbol_"+l).remove(),$("#"+n.svgObject.id+"_TrackSymbol_"+l).remove(),at=[],vt=[],h=null,u=n.getClosesPointXY(vt,at,f,n.mousemoveX,n.mousemoveY,t),ej.util.isNullOrUndefined(u.point)&&(!this.model.prevPoint||this.model.prevPoint.seriesIndex&&!this.model.series[this.model.prevPoint.seriesIndex].tooltip.visible)&&!this.dragPoint&&$(".tooltipDiv"+this._id).hasClass(this.svgObject.id)&&(clearTimeout(this.removeTooltip),n.removeTooltip=setTimeout(function(){$(".tooltipDiv"+n._id).remove()},1e3)),u.point&&(f.type.toLowerCase()=="boxandwhisker"?(nt++,h=u.outlierPosition):h=ej.EjSvgRender.utils._getPoint(u.point,f),k=$.extend({},ej.EjSvgRender.commonChartEventArgs),k.data={location:{x:this.mousemoveX,y:this.mousemoveX},region:{SeriesIndex:s,Region:{PointIndex:u.index}}},n._trigger("pointRegionMouseMove",k)),o=this.model.prevPoint,o&&o.seriesIndex==s&&!u.point&&(f.type.toLowerCase()=="boxandwhisker"?(nt++,et=o.outlierPosition):et=ej.EjSvgRender.utils._getPoint(o.point,o.series),n.model.enableCanvasRendering||n.drawTrackerSymbol(o.series,o.seriesIndex,o.pointIndex,null,et),this.model.prevPoint=null),f.isIndicator||f.isTrendLine||f.selectionSettings.enable||f.highlightSettings.enable||!f.marker.visible&&f.type.toLowerCase()!="boxandwhisker"||!u.point||k.cancel||(ej.util.isNullOrUndefined(u.point.marker)||ej.util.isNullOrUndefined(u.point.marker.visible)||u.point.marker&&u.point.marker.visible?n.drawTrackerSymbol(f,l,u.index,!1,h):f.type!="boxandwhisker"||u.point.marker||n.drawTrackerSymbol(f,l,u.index,!1,h),o&&u.point!=o.point&&(f.type.toLowerCase()=="boxandwhisker"?(nt++,ot=o.outlierPosition):ot=ej.EjSvgRender.utils._getPoint(o.point,o.series),n.drawTrackerSymbol(o.series,o.seriesIndex,o.pointIndex,null,ot,it,nt)),(ej.util.isNullOrUndefined(u.point.marker)||ej.util.isNullOrUndefined(u.point.marker.visible)||u.point.marker&&u.point.marker.visible)&&(this.model.prevPoint={point:u.point,pointIndex:u.index,series:f,seriesIndex:l,outlierPosition:u.outlierPosition})),f.tooltip.visible&&u.point&&(!i||s>i.region.SeriesIndex&&!(f._zOrder<this.model._visibleSeries[i.region.SeriesIndex]._zOrder))&&(e=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,n.model.requireInvertedAxes),h.X+e.x<=e.x+e.width&&(h.X+e.x>=e.x||h.X==0)&&Math.abs(h.Y-(e.y+e.height))<=e.y+e.height&&(Math.abs(h.Y-(e.y+e.height))>=e.y||h.Y==0)&&(k.cancel||($(n.svgObject).find("#"+n.svgObject.id+"_TrackToolTip").length==0&&(yt={id:n.svgObject.id+"_TrackToolTip",transform:"translate("+e.x+","+e.y+")"},n.gTransToolEle=n.svgRenderer.createGroup(yt)),n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_TrackToolTip"),{transform:"translate("+e.x+","+e.y+")",visibility:"visible"}),ej.util.isNullOrUndefined(f.tooltip.template)?(rt=!0,$(".tooltipDiv"+this._id).remove(),n.displayShowTooltip(h,u.point,f,u.index)):(rt=!0,$("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),pt={SeriesIndex:l,Region:{PointIndex:u.index}},n.createTooltip(pt,t,f))))))}if($(".tooltipDiv"+this._id).hasClass(this.svgObject.id)||$(".tooltipDiv"+this._id).remove(),i&&ej.util.isNullOrUndefined(i.region.isStripLine)){if(this.model.AreaType=="none"&&this.model._visibleSeries[i.region.SeriesIndex].explode&&(this.model._visibleSeries[i.region.SeriesIndex].enableAnimation?(this.model.AnimationComplete||this.model.enableCanvasRendering)&&this.pieExplosion(i,t):this.model.enable3D||this.pieExplosion(i,t)),i.region.isIndicator?(r=this.model.indicators[i.region.SeriesIndex],a=r.segment[0]._visiblePoints[i.region.Region.PointIndex],r.fill=r.segment[0].fill):(r=this.model._visibleSeries[i.region.SeriesIndex],a=r.type=="pieofpie"?this._getPieOfPiePoint(i.region.Region.PointIndex,r):this.model._visibleSeries[i.region.SeriesIndex]._visiblePoints[i.region.Region.PointIndex]),a&&this.model.AreaType=="polaraxes"){for(s=0;s<this.model._visibleSeries.length;s++)$("[id*=_TrackSymbol]").remove(),wt="canvas_trackSymbol_"+s,$("#"+this._id).find("[id*="+wt+"]").remove();if(tt=this.model.AreaType!="polaraxes"?ej.EjSvgRender.utils._getPoint(a,r):ej.EjSvgRender.utils.TransformToVisible(r,a.xValue,a.y,this),c=this.model.prevPoint,!ej.util.isNullOrUndefined(c)&&c!=i&&r.marker.visible){var r=this.model._visibleSeries[c.region.SeriesIndex],bt=this.model._visibleSeries[c.region.SeriesIndex]._visiblePoints[c.region.Region.PointIndex],ui=ej.EjSvgRender.utils.TransformToVisible(r,bt.xValue,bt.y,this);this.drawTrackerSymbol(r,c.region.SeriesIndex,c.region.Region.PointIndex,null,ui);this.model.prevPoint=null}r.marker.visible&&r.drawType!="column"&&(this.drawTrackerSymbol(r,i.region.SeriesIndex,i.region.Region.PointIndex,!0,tt),this.model.prevPoint=i)}r.tooltip.visible&&!rt&&r.visibility.toLowerCase()=="visible"&&(ej.util.isNullOrUndefined(r.tooltip.template)?(this.model.AreaType=="cartesianaxes"?(e=ej.EjSvgRender.utils._getTransform(r.xAxis,r.yAxis,this.model.requireInvertedAxes),$(this.svgObject).find("#"+this.svgObject.id+"_TrackToolTip").length==0&&(kt={id:this.svgObject.id+"_TrackToolTip",transform:"translate("+e.x+","+e.y+")"},this.gTransToolEle=this.svgRenderer.createGroup(kt)),this.svgRenderer._setAttr($(this.svgObject).find("#"+this.svgObject.id+"_TrackToolTip"),{transform:"translate("+e.x+","+e.y+")"}),$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","visible"),h={X:i.location.x-this.model.m_AreaBounds.X,Y:Math.abs(i.location.y-this.model.m_AreaBounds.Y)}):($(this.svgObject).find("#"+this.svgObject.id+"_TrackToolTip").length==0&&(dt={id:this.svgObject.id+"_TrackToolTip"},this.gTransToolEle=this.svgRenderer.createGroup(dt)),h={X:i.location.x,Y:Math.abs(i.location.y)}),$(".tooltipDiv"+this._id).remove(),this.displayShowTooltip(h,a,r,i.region.Region.PointIndex)):($("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),this.createTooltip(i.region,t)));st=$.extend({},ej.EjSvgRender.commonChartEventArgs);st.data=i;this._trigger("pointRegionMouseMove",st)}else if(ej.util.isNullOrUndefined(this.model.prevPoint)||this.model.AreaType!="polaraxes"){if(!ej.util.isNullOrUndefined(this.model.explodeValue)){var p=this.model.series[this.model.explodeValue.SeriesIndex].type.toLowerCase(),r=this.model._visibleSeries[this.model.explodeValue.SeriesIndex],gt=new ej.seriesTypes[p],ni,it,ei=r.labelPosition.toLowerCase(),l=this.model.explodeValue.SeriesIndex,ti=this.model._isPieOfPie?this._getPieOfPiePoint(this.model.explodeValue.PointIndex,r):r._visiblePoints[this.model.explodeValue.PointIndex],fi=gt._calculateArcData(this,this.model.explodeValue.PointIndex,ti,r,l,this.model.explodeValue.PieSeriesIndex);for(this.model.enableCanvasRendering&&(this.model.series[l].explodeIndex=null,d=document.getElementById(this.svgObject.id).getClientRects()[0],this.svgRenderer.ctx.clearRect(d.left,d.top,d.width,d.height),$("#"+this._id).ejChart("redraw")),it=this.svgObject.id+"_SeriesGroup_"+l,ni=this.model.explodeValue.PieSeriesIndex==1?$(this.gSeriesEle).children("#"+it)[1]:$(this.gSeriesEle).children("#"+it)[0],ht=$(ni).children(),s=0;s<ht.length;s++)if(ct=ht[s],ii=this.svgRenderer._getAttrVal($(ct)[0],"pointIndex"),parseInt(ii)==this.model.explodeValue.PointIndex){this.svgRenderer._setAttr($(ct),{d:fi.Direction});break}gt.drawDataLabelAcc(this,r,this.model.explodeValue.PointIndex,ti,l,this.model.explodeValue.PieSeriesIndex);this.model.explodeValue=null;this.model.explode=!1}}else c=this.model.prevPoint,r=this.model._visibleSeries[c.region.SeriesIndex],a=this.model._visibleSeries[c.region.SeriesIndex]._visiblePoints[c.region.Region.PointIndex],tt=ej.EjSvgRender.utils.TransformToVisible(r,a.xValue,a.y,this),this.drawTrackerSymbol(r,c.region.SeriesIndex,c.region.Region.PointIndex,null,tt),this.model.prevPoint=null},chartTrackball:function(n,t,i){var y=n.model.requireInvertedAxes,o,r,g,oi=this.model.indicators,h=this.model._visibleSeries,si=!1,yt,pt,u,ft,pr,hi,ci,gi,li,nr,tr,p,ai=0,ir,rr,ur,nt,v=[],et=[],l=[],rt=this.model.enableCanvasRendering,st=0,ot=0,fr=0,er=$("#"+this._id).offset(),ht=[],wt=[],bt=[],ct=this.model.crosshair.trackballTooltipSettings.mode.toLowerCase(),wr=n._id+"_trackball_grouping_tooltip",kt=this.model.locale,vi=0,yi=0,dt,or,lt,a,sr,gt,pi,e,wi,tt,ni,ti,hr,k,it,bi,ii,b,ri,ut,w,c,fi,f,s,br,vr,yr,ei;if(!this.model.enable3D&&this.model.crosshair.visible&&this.model.crosshair.type.toLowerCase()=="trackball"){for($("#"+this.svgObject.id+"_CrosshairGroup").length==0?(dt={id:n.svgObject.id+"_CrosshairGroup",visibility:"visible"},rt?(dt.position="absolute",n.svgRenderer.drawCrosshairLine(dt,"#chartContainer_"+this._id)):(n.gTrackball=n.svgRenderer.createGroup(dt),n.svgRenderer.append(n.gTrackball,n.svgObject))):n.model.trackerElement&&($.finish?$(n.model.trackerElement).finish():$(n.model.trackerElement).stop(!0,!0),n.model.trackerElement=null),this.model.enableCanvasRendering||($("[class*=HighlightStyle]").attr("class",""),$("[class*=HighlightLegendStyle]").attr("class",""),$("[class*=HighlightLegendPathStyle]").attr("class",""),$("[class*=HighlightPathStyle]").attr("class",""),$("[class*=Highlightseries]").attr("class",""),$("[id*="+this._id+"_Highlight_]").remove()),$("#secondCanvas").remove(),$("#"+this._id).find('[id*="_gTooltip_"]').remove(),$("#"+wr).children().remove(),rt&&$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden"),or=h.length,lt=0;lt<oi.length&&oi[lt].segment;lt++)h=h.concat(oi[lt].segment);for(seriesLength=h.length,f=0;f<seriesLength;f++)if(h[f].visibility=="visible"&&(s=f,yt=[],pt=y?n.mousemoveY+h[f].xAxis.plotOffset>h[f].xAxis.y&&n.mousemoveY<h[f].xAxis.y+h[f].xAxis.height+h[f].xAxis.plotOffset:n.mousemoveX+h[f].xAxis.plotOffset>h[f].xAxis.x&&n.mousemoveX<h[f].xAxis.x+h[f].xAxis.width+h[f].xAxis.plotOffset,rt&&(this.canvasX=h[f].xAxis.x),u=n.getClosestPointX(yt,h[f],n.mousemoveX,n.mousemoveY),ft=h[f].xAxis.visibleRange,u.point!=""&&(gt=h[f].type.toLowerCase()=="boxandwhisker"?u.point[0].boxPlotLocation[0].YValues:u.point[0].YValues[0],u.point!=""&&(gt>=h[f].yAxis.visibleRange.min||ct=="grouping")&&u.point[0].xValue>=ft.min&&u.point[0].xValue<=ft.max&&pt)))for(e=0;e<u.point.length;e++)u.point[e].visible&&(h[f].isIndicator||st++);for(f=0;f<seriesLength;f++){if(s=f,r=h[f],a=[],r.visibility.toLowerCase()=="visible")if(yt=[],pt=y?n.mousemoveY+h[f].xAxis.plotOffset>r.xAxis.y&&n.mousemoveY<r.xAxis.y+r.xAxis.height+h[f].xAxis.plotOffset:n.mousemoveX+h[f].xAxis.plotOffset>r.xAxis.x&&n.mousemoveX<r.xAxis.x+r.xAxis.width+h[f].xAxis.plotOffset,rt&&(this.canvasX=r.xAxis.x),u=n.getClosestPointX(yt,r,n.mousemoveX,n.mousemoveY),ft=r.xAxis.visibleRange,u.point!=""){if(gt=h[f].type.toLowerCase()=="boxandwhisker"?u.point[0].boxPlotValues.midvalue:u.point[0].YValues[0],(gt>=h[f].yAxis.visibleRange.min||ct=="grouping")&&u.point[0].xValue>=ft.min&&u.point[0].xValue<=ft.max)if(pt)for(pi=u.point.length,e=0;e<pi;e++)if(u.point[e].visible){if(!r.isIndicator){if(r.type=="boxandwhisker")for(vi++,wi={xValue:u.point[e].xValue,YValues:u.point[e].boxPlotLocation[0].YValues},o=ej.EjSvgRender.utils._getPoint(wi,r),o.YValues=wi.YValues,a.push(o),tt=0;tt<u.point[e].boxPlotLocation.length;tt++)u.point[e].boxPlotLocation[tt].outlier==!0&&(sr={X:u.point[e].boxPlotLocation[tt].X,Y:u.point[e].boxPlotLocation[tt].Y,YValues:u.point[e].boxPlotLocation[tt].YValues,outlier:u.point[e].boxPlotLocation[tt].outlier},a.push(sr));else o=ej.EjSvgRender.utils._getPoint(u.point[e],r);if(this.model.financial=or==1&&pi==1&&r._hiloTypes||!1,y)if(this.model.financial?(ni=o.X>o.low?o.X:o.low,ti=o.X<o.low?o.X:o.low,g="M "+r.yAxis.x+" "+(o.Y+r.xAxis.y)+" L "+(ti+r.yAxis.x)+" "+(o.Y+r.xAxis.y)+" M "+(r.yAxis.x+ni)+" "+(o.Y+r.xAxis.y)+" L "+(r.yAxis.x+r.yAxis.width)+" "+(o.Y+r.xAxis.y)):g="M "+r.yAxis.x+" "+(o.Y+r.xAxis.y)+" L "+(r.yAxis.x+r.yAxis.width)+" "+(o.Y+r.xAxis.y),r.type=="boxandwhisker")for(c=0;c<a.length;c++)v.push({X:a[c].X,Y:a[c].Y,YValues:a[c].YValues,outlier:a[c].outlier});else v.push({X:u.point[e].location.X+r.yAxis.x,Y:u.point[e].location.Y+r.xAxis.y});else if(this.model.financial?(ni=o.Y<o.low?o.Y:o.low,ti=o.Y>o.low?o.Y:o.low,g="M "+(o.X+r.xAxis.x)+" "+n.model.m_AreaBounds.Y+" L "+(o.X+r.xAxis.x)+" "+(ni+r.yAxis.y)+" M "+(o.X+r.xAxis.x)+" "+(ti+r.yAxis.y)+" L "+(o.X+r.xAxis.x)+" "+(n.model.m_AreaBounds.Y+n.model.m_AreaBounds.Height)):g="M "+(o.X+r.xAxis.x)+" "+n.model.m_AreaBounds.Y+" L "+(o.X+r.xAxis.x)+" "+(n.model.m_AreaBounds.Y+n.model.m_AreaBounds.Height),r.type=="boxandwhisker")for(c=0;c<a.length;c++)v.push({X:a[c].X,Y:a[c].Y,YValues:a[c].YValues,outlier:a[c].outlier});else v.push({X:u.point[e].location.X+r.xAxis.x,Y:u.point[e].location.Y+r.yAxis.y});if(pr={left:er.left,top:er.top},hi={id:n.svgObject.id+"_Tracker",fill:"none","stroke-width":n.model.crosshair.line.width,"clip-path":"url(#"+n.svgObject.id+"_ChartAreaClipRect)",stroke:n.model.crosshair.line.color,d:g},$("#"+n.svgObject.id+"_Tracker").length==0?(rt?(k=this.svgRenderer.createCrosshairCanvas(),k.ctx=k.getContext("2d")):(k=this.svgRenderer,hr=n.gTrackball),n.svgRenderer.drawPath.call(k,hi,hr),si=!0):(si=!0,ej.util.isNullOrUndefined(this._closest)?n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_Tracker"),{d:g,visibility:"visible"}):this._beforeMin?this._closest>=u.point[e].xValue&&n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_Tracker"),{d:g,visibility:"visible"}):this._afterMax&&this._closest<=u.point[e].xValue&&n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_Tracker"),{d:g,visibility:"visible"}),$("#"+n.svgObject.id+"_Tracker").css({display:"block"}),rt&&(k=this.svgRenderer.createCrosshairCanvas(),k.ctx=k.getContext("2d"),n.svgRenderer.drawPath.call(k,hi,n.gTrackball)),$("#"+this._id).find('[id*="canvas_Tracker"]').css("visibility","visible")),ci=ej.EjSvgRender.utils._getTransform(r.xAxis,r.yAxis,y),gi={transform:"translate("+ci.x+","+ci.y+")",id:n.svgObject.id+"_TrackToolTip_"+s},n.gTransToolEle=n.svgRenderer.createGroup(gi),li=this.model.prePoint,ej.util.isNullOrUndefined(li)||li.pointIndex[0]!=u.index[0]||!$("#"+n.svgObject.id+"_trackSymbol_"+s+"_"+u.index)){if(ej.util.isNullOrUndefined(nr)&&(this.model.crosshair.tooltipTemplate!=null&&$(document).find('[id*="_TrackToolTipTemplate_"]').attr("visibility","hidden"),n.gTransToolEle&&n.gTrackerEle&&($(this.svgObject).find('[id*="_TrackSymbol_"],[id*="_TrackToolTip"]').attr("visibility","hidden"),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden")),nr=u),it=r.type.toLowerCase(),bi=0,(!r._hiloTypes||it.indexOf("rangearea")>-1)&&(ct!="grouping"||ct=="grouping"&&it.indexOf("column")<0&&it.indexOf("bar")<0))if(r.type=="boxandwhisker")for(ii=0;ii<a.length;ii++)n.drawTrackerSymbol(r,s,u.index[e],!0,a[ii],null,bi),bi++;else n.drawTrackerSymbol(r,s,u.index[e],!0,o);if(r.trackerRemoved=!0,n.model.crosshair.tooltipTemplate)ir,rr,ur=document.getElementById(this.svgRenderer.svgObj.id).getClientRects()[0],n.displayTemplateTooltip(ir,rr,o,u.point[e],r,s,u.index[e],ur);else if(b=v.length-1,yi=a.length,ct=="grouping"||!this.model.financial&&r._hiloTypes&&it!="rangearea"){var ki=this.getSeriesColor(u.point[e],s,r),di,cr=r.tooltip.format,at,lr,vt=[];if(r.type=="boxandwhisker")for(c=0;c<yi;c++)lr=this.getTooltipFormat(u.point[e],r,s,u.index[e],cr,a[c]),vt.push(lr),at=null;else at=this.getTooltipFormat(u.point[e],r,s,u.index[e],cr);if(ri=r.tooltip.font?r.tooltip.font.color?r.tooltip.font.color:ki:ki,ut=r.tooltip.font?$.extend(!1,r.font,{},r.tooltip.font):r.font,typeof ri=="object"&&(ri=ki[1].color),r.type=="boxandwhisker")for(w=0;w<vt.length;w++)ht.push({text:vt[w].text,seriesIndex:s,pointIndex:u.index[e]});else at.text=" "+at.text+" ",ht.push({text:at.text,seriesIndex:s,pointIndex:u.index[e]});if((r._hiloTypes&&it!="rangearea"||it.indexOf("column")>-1||it.indexOf("bar")>-1)&&(data={region:{Region:{PointIndex:u.index[e]},SeriesIndex:s}},this.highlightStart(i,data,this._id+"_svg_SeriesGroup_"+s,this._id+"_svg_Series"+s+"_Point"+u.index[e],!0)),r.type=="boxandwhisker")for(w=0;w<vt.length;w++)bt.push(n._id+"_grouping_text_"+s+"_"+u.index[e]+w);else bt.push(n._id+"_grouping_text_"+s+"_"+u.index[e]);if(di={color:ri,"font-size":ut.size,"font-family":ut.fontFamily,"font-style":ut.fontStyle,"font-weight":ut.fontWeight},r.type=="boxandwhisker")for(w=0;w<vt.length;w++)wt.push(di);else wt.push(di);vi==st&&r.type=="boxandwhisker"?n.displayTooltip(!0,{point:u.point[e],series:r,textCollection:ht,textOptionsCollection:wt,groupingTextId:bt}):st==ht.length&&r.type!="boxandwhisker"&&n.displayTooltip(!0,{point:u.point[e],series:r,textCollection:ht,textOptionsCollection:wt,groupingTextId:bt})}else{var tr=this.getTooltipFormat(u.point[e],r,s,f,r.tooltip.format,f),ar=r.tooltip,ut=ar.font?$.extend(!1,r.font,{},ar.font):r.font,p=ej.EjSvgRender.utils._measureText(tr.text,null,ut),d,fr=y?p.height:p.width,ot=ot>fr?ot:fr,ui=Math.ceil(tr.text.toString().split("<br/>").length/2);if(this.model.tooltipPadding=Number(ut.size.toString().replace(/px/i,""))/3,d=this.model.tooltipPadding+r.tooltip.border.width*2,y)et.push({Start:v[b].X-d-p.width/2,End:v[b].X+d+p.width/2}),l.push({Point:v[b],ClosestPoint:u.point[e],Series:r,ClosestPointIndex:u.index[e],Tgap:ai,StEnd:et[b],TextArea:p,ReqInvertAxis:y});else if(r.type=="boxandwhisker")for(c=0;c<yi;c++)et.push({Start:a[c].Y-d*ui-p.height/2,End:a[c].Y+d*ui+p.height/2}),l.push({Point:a[c],ClosestPoint:u.point[e],Series:r,ClosestPointIndex:u.index[e],Tgap:ai,StEnd:et[c],TextArea:p,ReqInvertAxis:y});else et.push({Start:v[b].Y-d*ui-p.height/2,End:v[b].Y+d*ui+p.height/2}),l.push({Point:v[b],ClosestPoint:u.point[e],Series:r,ClosestPointIndex:u.index[e],Tgap:ai,StEnd:et[b],TextArea:p,ReqInvertAxis:y});if(r.type=="boxandwhisker"&&vi==st)for(ot+=2*d,l=y?l.sort(function(n,t){return n.Point.X-t.Point.X}):l.sort(function(n,t){return n.Point.Y-t.Point.Y}),this.SmartTooltipPosition(l),fi=l.length,n.displayTooltip(!1,l,ot),f=0;f<fi;f++)s=$.inArray(l[f].Series,this.model._visibleSeries),l[f].Series._hiloTypes&&(data={region:{Region:{PointIndex:l[f].ClosestPointIndex},SeriesIndex:s}},this.highlightStart(i,data,this._id+"_svg_SeriesGroup_"+s,this._id+"_svg_Series"+s+"_Point"+l[f].ClosestPointIndex,!0));else if(l.length==st&&r.type!="boxandwhisker")for(ot+=2*d,l=y?l.sort(function(n,t){return n.Point.X-t.Point.X}):l.sort(function(n,t){return n.Point.Y-t.Point.Y}),this.SmartTooltipPosition(l),fi=l.length,n.displayTooltip(!1,l,ot),f=0;f<fi;f++)s=$.inArray(l[f].Series,this.model._visibleSeries),l[f].Series._hiloTypes&&(data={region:{Region:{PointIndex:l[f].ClosestPointIndex},SeriesIndex:s}},this.highlightStart(i,data,this._id+"_svg_SeriesGroup_"+s,this._id+"_svg_Series"+s+"_Point"+l[f].ClosestPointIndex,!0))}}else nt=$(this.svgObject).find('[id*="_TrackSymbol_"],[id*="_TrackToolTip"]'),this.svgRenderer._setAttr($(nt),{visibility:"visible"}),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","visible"),nt=$(this.svgObject).find('[id*="_TrackToolTip"]').children(),this.svgRenderer._setAttr($(nt),{visibility:"visible"}),nt=$(this.svgObject).find('[id*="_trackSymbol_"]'),this.svgRenderer._setAttr($(nt),{visibility:"visible"}),$(n.svgObject).find('[id*="_TrackAxisToolTip"]').attr("visibility","visible"),this.model.crosshair.tooltipTemplate!=null&&(nt=$(document).find('[id*="_TrackToolTipTemplate_"]'),this.svgRenderer._setAttr($(nt),{visibility:"visible"}))}}else $("#"+this.svgObject.id+"_TrackSymbol_"+s).remove();else this._removeTrackBall()}else si||$(n.svgObject).find('[id*="_Tracker"]').remove(),br=$("#"+n.svgObject.id+"_TrackSymbol_"+f),vr=this.svgObject.id+"_TrackSymbol_"+s,$("#"+this._id).find("[id*="+vr+"]").remove(),$("#"+n._id).find("[id*=_canvas_trackSymbol_"+f+"]").css("visibility","hidden"),this.model.enableCanvasRendering||($("[class*=HighlightStyle]").attr("class",""),$("[class*=HighlightLegendStyle]").attr("class",""),$("[class*=HighlightLegendPathStyle]").attr("class",""),$("[class*=HighlightPathStyle]").attr("class",""),$("[class*=Highlightseries]").attr("class",""),$("[id*="+this._id+"_Highlight_]").remove());r.trackerRemoved=!1}this.model.closestPoint!=null&&(this.model.prePoint={point:u.point,pointIndex:u.index,series:r,seriesIndex:s});$("#"+this.svgObject.id+"_TrackAxisToolTip").length==0&&this.model.crosshairLabelVisibility?(yr={id:n.svgObject.id+"_TrackAxisToolTip",visibility:"visible"},n.gTrackAxisEle=n.svgRenderer.createGroup(yr),n.svgRenderer.append(n.gTrackAxisEle,n.gTrackball)):$("#"+this.svgObject.id+"_TrackAxisToolTip").css("display","block");o&&(ei=u.point[0],rt?$(n.svgObject.parentElement).find('[id*="AxisToolTipRect"]').css({visibility:"hidden",display:"none"}):$(n.svgObject).find('[id*="_TrackAxisToolTip"]').attr("visibility","visible").children().attr({display:"none"}),$.each(n.model._axes,function(i,r){var c=r.x,l=r._opposed,f,u,s;if(y){if(r.orientation.toLowerCase()=="vertical"&&r.crosshairLabel.visible&&n.mousemoveY<=r.y+r.height&&r.y<=n.mousemoveY){var f=r._valueType.toLowerCase(),e=ei.xValue,h=[];f=="logarithmic"&&(e=Math.pow(r.logBase,e).toFixed(2).replace(new RegExp("\\.0{2}"),""));f=="datetime"&&(e=ej.format(new Date(Math.floor(e)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,kt));f=="category"&&(e=ej.EjSvgRender.utils._getLabelContent(e,r,kt));h={X:r.x,Y:o.Y+r.y};n.displayAxisTooltip(h,e,r,i,t)}}else r.orientation.toLowerCase()=="horizontal"&&r.crosshairLabel.visible&&o.X+c<=r.x+r.width&&r.x<=v[v.length-1].X&&(f=r._valueType.toLowerCase(),u=(o.X/r.width*r.visibleRange.delta+r.visibleRange.min).toFixed(2).replace(new RegExp("\\.0{2}"),""),f=="logarithmic"&&(u=Math.pow(r.logBase,u)),f=="datetime"&&(u=ej.format(new Date(Math.floor(u)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,kt)),(f=="category"||f=="datetimecategory")&&(typeof ei.x!="object"&&(u=ei.xValue),u=ej.EjSvgRender.utils._getLabelContent(Math.floor(u),r,kt),u=u?u:"undefined"),s={X:v[v.length-1].X,Y:l?r.y+r.height-r.majorTickLines.size:r.y+r.height+r.majorTickLines.size+10},n.displayAxisTooltip(s,u,r,i,t,!0))}))}},chartCrossHair:function(n,t){var d=ej.util.isNullOrUndefined(this.model.primaryYAxis.roundingPlaces)?2:this.model.primaryYAxis.roundingPlaces,o=n.model.enableCanvasRendering,s=this.model.locale,h,p,c,w,l,a,i,it;if(!this.model.enable3D&&this.model.crosshair.visible&&this.model.crosshair.type.toLowerCase()=="crosshair"){for($("#"+this.svgObject.id+"_CrosshairGroup").length==0?(h={id:this.svgObject.id+"_CrosshairGroup",visibility:"visible"},o?(h.position="absolute",n.svgRenderer.drawCrosshairLine(h,"#chartContainer_"+this._id)):(this.gCrosshair=this.svgRenderer.createGroup(h),this.svgRenderer.append(this.gCrosshair,this.svgObject))):$("#"+this.svgObject.id+"_CrosshairGroup").css("display","block"),n.model.trackerElement&&($.finish?$(this.model.trackerElement).finish():$(this.model.trackerElement).stop(!0,!0),this.model.trackerElement=null),a=0;a<this.model._axes.length;a++)i=this.model._axes[a],i.orientation.toLowerCase()=="vertical"?t.y>=i.y&&t.y<=i.y+i.height&&(i.x<t.x?p=Math.min(p||i.x,i.x):c=Math.max(c||i.x,i.x)):t.x>=i.x&&t.x<=i.x+i.width&&(i.y<t.y?w=Math.min(w||i.y,i.y):l=Math.max(l||i.y,i.y));var f=p||this.model.m_AreaBounds.X,b=c?c-f:this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width-f,e=w||this.model.m_AreaBounds.Y,k=l?l-e:this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height-e,g="M "+this.mousemoveX+" "+e+" L "+this.mousemoveX+" "+(e+k),nt="M "+f+" "+this.mousemoveY+" L "+(f+b)+" "+this.mousemoveY,v=$("#"+this._id).offset(),y=n.svgObject,r,u,tt={left:y.offsetLeft>v.left?y.offsetLeft:v.left,top:y.offsetTop>v.top?y.offsetTop:v.top};$("#"+n.svgObject.id+"_CrosshairVertical").length==0?(r={id:n.svgObject.id+"_CrosshairVertical",fill:"none","stroke-width":n.model.crosshair.line.width,stroke:n.model.crosshair.line.color,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",d:g},o?(r.width=0,r.height=k,r.top=e,r.left=f,r.position="absolute",r.style="solid",r.opacity=.5,n.svgRenderer.drawCrosshairLine(r,"#"+this.svgObject.id+"_CrosshairGroup")):n.svgRenderer.drawPath(r,n.gCrosshair)):(n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_CrosshairVertical"),{d:g}),o&&($("#secondCanvas").remove(),$("#"+n.svgObject.id+"_CrosshairVertical").css("left",this.mousemoveX).css({top:e,height:k,display:"block"})),$("#"+n.svgObject.id+"_CrosshairVertical").attr("visibility","visible").css("display","block"));$("#"+n.svgObject.id+"_CrosshairHorizontal").length==0?(u={id:n.svgObject.id+"_CrosshairHorizontal",fill:"none","stroke-width":n.model.crosshair.line.width,stroke:n.model.crosshair.line.color,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",d:nt},o?(u.top=e+tt.top,u.left=f+tt.left,u.width=b,u.height=0,u.position="absolute",u.style="solid",u.opacity=.5,n.svgRenderer.drawCrosshairLine(u,"#"+this.svgObject.id+"_CrosshairGroup")):n.svgRenderer.drawPath(u,n.gCrosshair)):(n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_CrosshairHorizontal"),{d:nt}),$("#"+n.svgObject.id+"_CrosshairHorizontal").attr("visibility","visible").css("display","block"),o&&$("#"+n.svgObject.id+"_CrosshairHorizontal").css("top",this.mousemoveY).css({left:f,width:b,display:"block"}));$("#"+n.svgObject.id+"_AxisCrossToolTip").length==0?(it={id:n.svgObject.id+"_AxisCrossToolTip",visibility:"visible"},n.gTrackAxisEle=n.svgRenderer.createGroup(it),n.svgRenderer.append(n.gTrackAxisEle,n.gCrosshair)):(this.svgRenderer._setAttr($(n.gTrackAxisEle),{visibility:"visible"}),$(n.gTrackAxisEle).css("display","block"));$.each(n.model._axes,function(i,r){var u=r._valueType.toLowerCase(),o,f,h,e,c;r.orientation.toLowerCase()=="horizontal"&&r.crosshairLabel.visible?n.mousemoveX<=r.x+r.width&&r.x<=n.mousemoveX?(o=r._valueType=="category"&&r.labelPlacement.toLowerCase()=="betweenticks"?.5:0,f=(Math.abs(n.mousemoveX-(r.isInversed?r.x+r.width:r.x))/r.width*r.visibleRange.delta+r.visibleRange.min+o).toFixed(2).replace(new RegExp("\\.0{2}"),""),u=="logarithmic"&&(f=Math.pow(r.logBase,f).toFixed(2).replace(new RegExp("\\.0{2}"),"")),u=="datetime"&&(f=ej.format(new Date(Math.floor(f)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,s)),(u=="category"||u=="datetimecategory")&&(f=ej.EjSvgRender.utils._getLabelContent(f,r,s)),h={X:n.mousemoveX,Y:r.y},n.displayAxisTooltip(h,f,r,i,t),$("#"+n.svgObject.id+"_AxisToolTipText_"+i).show(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).show()):($("#"+n.svgObject.id+"_AxisToolTipText_"+i).hide(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).hide()):r.orientation.toLowerCase()=="vertical"&&r.crosshairLabel.visible&&(n.mousemoveY<=r.y+r.height&&r.y<=n.mousemoveY?(e=(Math.abs(1-Math.abs(n.mousemoveY-(r.isInversed?r.y+r.height:r.y))/r.width/r.height)*r.visibleRange.delta+r.visibleRange.min).toFixed(d).replace(new RegExp("\\.0{"+d+"}"),""),u=="logarithmic"&&(e=Math.pow(r.logBase,e).toFixed(2).replace(new RegExp("\\.0{2}"),"")),u=="datetime"&&(e=ej.format(new Date(Math.floor(e)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,s)),(u=="category"||u=="datetimecategory")&&(e=ej.EjSvgRender.utils._getLabelContent(e,r,s)),c={X:r.x,Y:n.mousemoveY},n.displayAxisTooltip(c,e,r,i,t),$("#"+n.svgObject.id+"_AxisToolTipText_"+i).show(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).show()):($("#"+n.svgObject.id+"_AxisToolTipText_"+i).hide(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).hide()))})}},chartTouchMove:function(n){this.cancelEvent(n);n=n.originalEvent.touches[0];this.chartInteractiveBehavior(n)},isZoomButtonHovered:function(n){if(n.parentNode!=null){var t=n.parentNode.id,i=n.id;if(i.indexOf("_ZoomInBtn ")==-1&&i.indexOf("ZoomOutBtn")==-1&&i.indexOf("_ZoomBtn")==-1&&i.indexOf("_ResetZoom")==-1&&i.indexOf("_PanBtn")==-1&&t&&t.indexOf("_ZoomInBtn")==-1&&t.indexOf("_ZoomOutBtn")==-1&&t.indexOf("_ZoomBtn")==-1&&t.indexOf("_ResetZoom")==-1&&t.indexOf("_PanBtn")==-1)return!1}return!0},showTooltipOnDrag:function(n){$("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackToolTip").attr("visibility","visible");$("#"+n.svgObject.id+"_TrackToolTip").show();$(".tooltipDiv").css("display","block")},chartInteractiveBehavior:function(n){var e=this.calMousePosition(n),u,o,s,t,f,r,i,h;this.mousemoveX=e.X;this.mousemoveY=e.Y;u="#"+this.svgObject.id;this.mouseWheelCoords&&(o=Math.abs(this.mouseWheelCoords.x-n.pageX),s=Math.abs(this.mouseWheelCoords.y-n.pageY),(o>0||s>0)&&!this.panning?this.enableTrackBall():this.disableTrackBall());t=this;r=n.target.id;t.model.AreaType=="cartesianaxes"&&this.mousemoveX>=this.model.m_AreaBounds.X&&this.mousemoveX<this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width&&this.mousemoveY<this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height&&this.mousemoveY>=this.model.m_AreaBounds.Y&&this.model.initSeriesRender?(f={x:t.mousemoveX,y:t.mousemoveY},r=t.svgRenderer._getAttrVal($(n.target).parent(),"id"),r!=undefined&&(r==t.svgRenderer._getAttrVal($(this.svgObject).find(u+"_ZoomBtn"),"id")||r==t.svgRenderer._getAttrVal($(this.svgObject).find(u+"_ResetZoom"),"id")||r==t.svgRenderer._getAttrVal($(this.svgObject).find(u+"_PanBtn"),"id"))?this.disableTrackBall():this.enableTrackBall(),this.model.crosshair.visible||this.isZoomButtonHovered(n.target)?this.dragPoint?this.showTooltipOnDrag(t,n):this.closestXyPoint||($("#"+t.svgObject.id).find("#"+t.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+t.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv"+this._id).css("display","none")):this.tooltip(t,n),this.model.enable3D||(this.chartTrackball(t,f,n),this.chartCrossHair(t,f))):(t.model.AreaType!="none"&&t.model.AreaType!="polaraxes"||this.isZoomButtonHovered(n.target)?this.dragPoint?this.showTooltipOnDrag(t,n):this.closestXyPoint||($("#"+t.svgObject.id).find("#"+t.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+t.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv"+this._id).css("display","none"),this._removeTrackBall(),this._removeHighlight()):this.tooltip(t,n),i=this.model.prevPoint,i&&i.point&&(this.model.enableCanvasRendering?$("#canvas_trackSymbol").remove():(h=i.series.type=="boxandwhisker"?i.outlierPosition:ej.EjSvgRender.utils._getPoint(i.point,i.series),t.drawTrackerSymbol(i.series,i.seriesIndex,i.pointIndex,null,h)),this.model.prevPoint=null))},highlightSvg:function(n,t,i,r,u,f,e){var s,o,h;t!=undefined&&(s=this.svgObject.id+"_SeriesGroup_",o=t.substr(s.length),t.indexOf(this.svgObject.id+"_symbolGroup_")>=0&&(s=this.svgObject.id+"_symbolGroup_",o=t.substr(s.length)));o=u!=undefined?u.region.SeriesIndex:o;h=this.model.series[o];i&&h&&(h.highlightSettings.enable||e)&&this.highlight(n,r,h,null,u,t,f,e)},highlightCanvas:function(n,t,i){for(var c,e,u,s,o,i,r,f=0;f<this.model._visibleSeries.length;f++)if(c=f,e=this.model._visibleSeries[f],u=e.type.toLowerCase(),this.model.AreaType=="cartesianaxes"&&e.visibility.toLowerCase()=="visible"&&u!=="scatter"&&u!=="bubble"&&u!=="column"&&u.indexOf("bar")==-1&&u!=="stackingcolumn"&&u!=="stackingcolumn100"&&!e._hiloTypes){var h=this.calMousePosition(t);this.mousemoveX=h.X;this.mousemoveY=h.Y;s=this.getClosesPointXY([],[],e,this.mousemoveX,this.mousemoveY,t);ej.util.isNullOrUndefined(s.point)||(o=$.extend({},ej.EjSvgRender.commonChartEventArgs),o.data={location:{x:this.mousemoveX,y:this.mousemoveY},region:{SeriesIndex:f,Region:{PointIndex:s.index}}})}i=o?o.data:i;i&&this.model.series[i.region.SeriesIndex].highlightSettings.enable&&(r=$.extend({},this.model.series[i.region.SeriesIndex]),r.pointIndex=i.region.Region.PointIndex,r.seriesIndex=i.region.SeriesIndex,r.data=i,$("#"+this._id+"_Selection_series"+r.seriesIndex+"_canvas").length==0&&($("[id*="+this._id+"_Highlight_]").remove(),this.findCanvasSelection(r.seriesIndex,r.pointIndex,r.selectionSettings.mode.toLowerCase())||this.canvasHighlight(this,t,r)))},resizeCursor:function(n,t,i,r,u,f,e){var o=this.selectedRectIndex;t<=r||i<=u||t>=f+r||i>=e+u?($("#"+n+"_resize_rightRect"+o).css({cursor:"default"}),$("#"+n+"_resize_leftRect"+o).css({cursor:"default"}),$("#"+n+"_resize_bottomRect"+o).css({cursor:"default"}),$("#"+n+"_resize_topRect"+o).css({cursor:"default"}),$("#"+n+"_resize_bottomRightCornerCircle"+o).css({cursor:"default"})):(t>=r||i>=u||t<=f+r||i<=e+u)&&($("#"+n+"_resize_rightRect"+o).css({cursor:"e-resize"}),$("#"+n+"_resize_leftRect"+o).css({cursor:"w-resize"}),$("#"+n+"_resize_bottomRect"+o).css({cursor:"s-resize"}),$("#"+n+"_resize_topRect"+o).css({cursor:"n-resize"}),$("#"+n+"_resize_bottomRightCornerCircle"+o).css({cursor:"se-resize"}))},multiSelectMouseMove:function(evt){var q,rectOptions,translate;if(this._isMultiSelect&&this.multiSelectMode=="range"&&!this.dragPoint){var mouseMoveCords=this.calMousePosition(evt),mouseMoveX=mouseMoveCords.X,mouseMoveY=mouseMoveCords.Y,gripMouseMoveX,gripMouseMoveY,translate,selectionSettingsType=this.multiSelectType,width,height,x,y,rectX,rectY,rectWidth,rectHeight,x1,x2,y1,y2,xPlotOffset,yPlotOffset,modifiedX,modifiedY,mouseDownX=this.mouseDownX,mouseDownY=this.mouseDownY,selectedRectIndex=this.selectedRectIndex,containerSvg=this.svgObject.id,chartArea="#"+containerSvg+"_ChartArea";for(chartAreaX=parseInt($(chartArea).attr("x")),chartAreaY=parseInt($(chartArea).attr("y")),chartAreaWidth=parseInt($(chartArea).attr("width")),chartAreaHeight=parseInt($(chartArea).attr("height")),multiSelectMouseDownId=this.multiSelectMouseDownId,selctRectId="#"+containerSvg+"_selectRect",multiAxis=this.multiAxis,q=0;q<multiAxis.length;q++)multiAxis[q].orientation.toLowerCase()=="horizontal"?(x1=multiAxis[q].Location.X1,x2=multiAxis[q].Location.X2,xPlotOffset=multiAxis[q].plotOffset):(y1=multiAxis[q].Location.Y1,y2=multiAxis[q].Location.Y2,yPlotOffset=multiAxis[q].plotOffset);if(this.drag&&!this.resize&&!this.rectPan&&!this.removeRect){var currentX=mouseMoveX,currentY=mouseMoveY,areaBounds=this.model.m_AreaBounds;this.multiSelectDraw=!0;mouseMoveX<areaBounds.X?currentX=areaBounds.X:mouseMoveX>areaBounds.X+areaBounds.Width&&(currentX=areaBounds.X+areaBounds.Width);currentY=mouseMoveY<areaBounds.Y?areaBounds.Y:mouseMoveY>areaBounds.Y+areaBounds.Height?areaBounds.Y+areaBounds.Height:mouseMoveY;switch(selectionSettingsType){case"x":width=Math.abs(currentX-mouseDownX);height=y1-y2+yPlotOffset+yPlotOffset;x=currentX>mouseDownX?mouseDownX:currentX;y=y2-yPlotOffset;break;case"y":width=x2-x1+xPlotOffset+xPlotOffset;height=Math.abs(currentY-mouseDownY);x=x1-xPlotOffset;y=currentY>mouseDownY?mouseDownY:currentY;break;case"xy":width=Math.abs(currentX-mouseDownX);height=Math.abs(currentY-mouseDownY);x=currentX>mouseDownX?mouseDownX:currentX;y=currentY>mouseDownY?mouseDownY:currentY}width>0&&height>0&&(rectOptions={id:this.svgObject.id+"_selectRect"+this.selectedRectIndex,x:x,y:y,width:width,height:height,fill:"rgba(41,136,214,0.2)","stroke-width":2,stroke:"rgba(41,136,214,0.5)",cursor:"pointer","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},x>=x1+xPlotOffset&&mouseMoveX<=x2-xPlotOffset&&mouseMoveY<=y1+yPlotOffset&&y>=y2-yPlotOffset&&this.svgRenderer.drawRect(rectOptions,this.gEle),this.gEle!=null&&($(this.gEle).appendTo(this.parentgEle),this.selectedRectIndex==0&&(this.model.gCurrentEle=this.gEle),$(this.parentgEle).appendTo(this.svgObject)))}if(rectX=parseInt($(selctRectId+selectedRectIndex).attr("x")),rectY=parseInt($(selctRectId+selectedRectIndex).attr("y")),rectWidth=parseInt($(selctRectId+selectedRectIndex).attr("width")),rectHeight=parseInt($(selctRectId+selectedRectIndex).attr("height")),!this.drag&&(evt.target.id.indexOf("selectRect")>=0||evt.target.id.indexOf("resize")>=0)){evt.target.parentNode.id.indexOf("selectedRect")>=0&&(id=evt.target.parentNode.id.split("selectedRect")[1].match(/\d+/)[0],this.gripIndex=eval(id));var selectRectId="#"+containerSvg+"_selectRect",selectRectWidth=parseInt($(selectRectId+this.gripIndex).attr("width")),selectRectHeight=parseInt($(selectRectId+this.gripIndex).attr("height")),selectRectX=parseInt($(selectRectId+this.gripIndex).attr("x")),selectRectY=parseInt($(selectRectId+this.gripIndex).attr("y"));$("#"+containerSvg+"_gripCollection"+selectedRectIndex).css({visibility:"hidden"});(selectRectX+selectRectWidth-16>=selectRectX||selectRectY+selectRectHeight-16>=selectRectY)&&$("#"+this.svgObject.id+"_gripCollection"+this.gripIndex).attr({transform:""});(selectRectX+selectRectWidth-16<selectRectX||selectRectY+selectRectHeight-16<selectRectY)&&(translate="translate(15,15)",$("#"+this.svgObject.id+"_gripCollection"+this.gripIndex).attr({transform:translate}));this.oldId!=evt.target.id&&$("#"+containerSvg+"_gripCollection"+this.oldGripIndex).css({visibility:"hidden"});$("#"+containerSvg+"_gripCollection"+this.gripIndex).css({visibility:"visible"});this.oldId=evt.target.id;this.oldGripIndex=this.gripIndex}if(evt.target.id.indexOf("selectRect")<0&&evt.target.id.indexOf("resize")<0&&$("#"+containerSvg+"_gripCollection"+this.gripIndex).css({visibility:"hidden"}),this.resize){$("#"+containerSvg+"_closeTopRightCornerCircle"+selectedRectIndex).hide();$("#"+containerSvg+"_closePath"+selectedRectIndex).hide();$("#"+containerSvg+"_closePathOpposite"+selectedRectIndex).hide();$("#"+containerSvg+"_gripCollection"+selectedRectIndex).css({visibility:"hidden"});var oldRectX=this.oldRectX[selectedRectIndex],oldRectY=this.oldRectY[selectedRectIndex],oldRectHeight=this.oldRectHeight[selectedRectIndex],oldRectWidth=this.oldRectWidth[selectedRectIndex],oldReBottomRectY=this.oldReBottomRectY[selectedRectIndex],oldReRightRectX=this.oldReRightRectX[selectedRectIndex];switch(selectionSettingsType){case"x":multiSelectMouseDownId==containerSvg+"_resize_rightRect"+selectedRectIndex?(rectWidth=mouseMoveX-oldRectX,$("#"+containerSvg+"_resize_rightRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX<oldRectX?(rectX=mouseMoveX,rectWidth=oldRectX-mouseMoveX):mouseMoveX>=oldRectX&&(rectX=oldRectX)):multiSelectMouseDownId==containerSvg+"_resize_leftRect"+selectedRectIndex&&(rectX=mouseMoveX,rectWidth=oldRectWidth+oldRectX-mouseMoveX,$("#"+containerSvg+"_resize_leftRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX>oldReRightRectX+5&&(rectX=oldReRightRectX+5,rectWidth=mouseMoveX-oldRectX-oldRectWidth));this.resizeCursor(containerSvg,mouseMoveX,mouseMoveY,chartAreaX,chartAreaY,chartAreaWidth,chartAreaHeight);break;case"y":multiSelectMouseDownId==containerSvg+"_resize_topRect"+selectedRectIndex?(rectHeight=oldRectHeight+oldRectY-mouseMoveY,rectY=mouseMoveY,$("#"+containerSvg+"_resize_topRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY>oldReBottomRectY+5&&(rectY=oldReBottomRectY+5,rectHeight=mouseMoveY-oldRectY-oldRectHeight)):multiSelectMouseDownId==containerSvg+"_resize_bottomRect"+selectedRectIndex&&(rectHeight=mouseMoveY-oldRectY,$("#"+containerSvg+"_resize_bottomRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY<oldRectY?(rectY=mouseMoveY,rectHeight=oldRectY-mouseMoveY):mouseMoveY>=oldRectY&&(rectY=oldRectY));this.resizeCursor(containerSvg,mouseMoveX,mouseMoveY,chartAreaX,chartAreaY,chartAreaWidth,chartAreaHeight);break;case"xy":multiSelectMouseDownId==containerSvg+"_resize_rightRect"+selectedRectIndex?(rectWidth=mouseMoveX-oldRectX,$("#"+containerSvg+"_resize_rightRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX<oldRectX?(rectX=mouseMoveX,rectWidth=oldRectX-mouseMoveX):mouseMoveX>=oldRectX&&(rectX=oldRectX)):multiSelectMouseDownId==containerSvg+"_resize_leftRect"+selectedRectIndex?(rectX=mouseMoveX,rectWidth=oldRectWidth+oldRectX-mouseMoveX,$("#"+containerSvg+"_resize_leftRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX>oldReRightRectX+5&&(rectX=oldReRightRectX+5,rectWidth=mouseMoveX-oldRectX-oldRectWidth)):multiSelectMouseDownId==containerSvg+"_resize_topRect"+selectedRectIndex?(rectHeight=oldRectHeight+oldRectY-mouseMoveY,rectY=mouseMoveY,$("#"+containerSvg+"_resize_topRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY>oldReBottomRectY+5&&(rectY=oldReBottomRectY+5,rectHeight=mouseMoveY-oldRectY-oldRectHeight)):multiSelectMouseDownId==containerSvg+"_resize_bottomRect"+selectedRectIndex?(rectHeight=mouseMoveY-oldRectY,$("#"+containerSvg+"_resize_bottomRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY<oldRectY?(rectY=mouseMoveY,rectHeight=oldRectY-mouseMoveY):mouseMoveY>=oldRectY&&(rectY=oldRectY)):multiSelectMouseDownId==containerSvg+"_resize_bottomRightCornerCircle"+selectedRectIndex&&(rectWidth=mouseMoveX-oldRectX,rectHeight=mouseMoveY-oldRectY,$("#"+containerSvg+"_resize_bottomRightCornerCircle"+selectedRectIndex).attr({cx:mouseMoveX,cy:mouseMoveY}),mouseMoveX<oldRectX&&mouseMoveY<oldRectY?(rectX=mouseMoveX,rectY=mouseMoveY,rectWidth=oldRectX-mouseMoveX,rectHeight=oldRectY-mouseMoveY):mouseMoveX<oldRectX?(rectX=mouseMoveX,rectWidth=oldRectX-mouseMoveX):mouseMoveY<oldRectY?(rectY=mouseMoveY,rectHeight=oldRectY-mouseMoveY):mouseMoveX>=oldRectX&&mouseMoveY>=oldRectY&&(rectX=oldRectX,rectY=oldRectY));this.resizeCursor(containerSvg,mouseMoveX,mouseMoveY,chartAreaX,chartAreaY,chartAreaWidth,chartAreaHeight)}switch(selectionSettingsType){case"x":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX,width:rectWidth});break;case"y":rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({y:rectY,height:rectHeight});break;case"xy":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX,y:rectY,width:rectWidth,height:rectHeight})}}if(this.rectPan){$("#"+containerSvg+"_closeTopRightCornerCircle"+selectedRectIndex).hide();$("#"+containerSvg+"_closePath"+selectedRectIndex).hide();$("#"+containerSvg+"_closePathOpposite"+selectedRectIndex).hide();$("#"+containerSvg+"_gripCollection"+selectedRectIndex).css({visibility:"hidden"});(mouseMoveX<=chartAreaX||mouseMoveY<=chartAreaY||mouseMoveX>=chartAreaX+chartAreaWidth||mouseMoveY>=chartAreaY+chartAreaHeight)&&this.multiSelectMouseUp(evt);modifiedX=this.PreviousCoords.X-evt.pageX;modifiedY=this.PreviousCoords.Y-evt.pageY;rectX=rectX-modifiedX;rectY=rectY-modifiedY;this.PreviousCoords.X=evt.pageX;this.PreviousCoords.Y=evt.pageY;switch(selectionSettingsType){case"x":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX});break;case"y":rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({y:rectY});break;case"xy":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX,y:rectY})}}}},isTouch:function(n){var i=this.model.browserInfo,t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},highlightStart:function(n,t,i,r,u){if(n.target.parentNode!=null)var i=i||n.target.parentNode.id,f=i.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||i.indexOf(this.svgObject.id+"_symbolGroup_")>=0||i.indexOf(this.svgObject.id+"_TrackSymbol_")>=0||i.indexOf(this.svgObject.id+"_Chart3D")>=0?!0:!1;this.model.enableCanvasRendering?this.highlightCanvas(this,n,t):this.highlightSvg(this,i,f,n,t,r,u)},_changeDraggingPoints:function(n,t,i,r){i=n.xAxis._valueType=="datetime"?new Date(i):i;r=n.yAxis._valueType=="datetime"?new Date(r):r;dragType=n.dragSettings.type.toLowerCase();(dragType=="x"||dragType=="xy")&&n.xAxis._valueType!="category"&&(this.dragPoint?(n.pointCollection[t].x=i,n.pointCollection[t].xValue=n.xAxis._valueType=="datetime"&&typeof i!="object"?new Date(i):i):(n._visiblePoints[t].x=n.points[t].x=i,n._visiblePoints[t].xValue=n.points[t].xValue=n.xAxis._valueType=="datetime"&&typeof i=="object"?Date.parse(i):i),ej.util.isNullOrUndefined(n.dataSource)||(n.dataSource[t][n.xName]=i));(dragType=="y"||dragType=="xy")&&(this.dragPoint?(n.pointCollection[t].y=r,n.pointCollection[t].YValues[0]=n.yAxis._valueType=="datetime"&&typeof r!="object"?new Date(r):r):(n._visiblePoints[t].y=n.points[t].y=r,n._visiblePoints[t].YValues[0]=n.points[t].YValues[0]=n.yAxis._valueType=="datetime"&&typeof r=="object"?Date.parse(r):r),ej.util.isNullOrUndefined(n.dataSource)||(n.dataSource[t][n.yName]=r))},_dragDelta:function(n,t,i,r,u,f){var h=this,o={X:i,Y:r},s={X:n,Y:t},e=$.extend({},this.commonDragEventArgs);e.data={seriesIndex:u,pointIndex:f,oldValue:o,newValue:s};this._trigger("dragging",e);this.commonDragEventArgs=e},_getDraggedPoint:function(n,t,i){var u,o,s,f,e,r=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes);return this.model.requireInvertedAxes?(f=r.y+r.height-i,e=t-r.x):(f=t-r.x,e=r.y+r.height-i),u=ej.EjSvgRender.utils._getValuebyPoint(f,e,n),o=parseFloat(u.PointX.toFixed(2)),s=parseFloat(u.PointY.toFixed(2)),{X:o,Y:s}},_pointDragandDrop:function(n,t,i){var w=n.data.seriesIndex,y=[],b=null,f=n.type.toLowerCase(),h={},c,p,it,ut,r,e,u,o;for(h.axes={},c=0;c<this.model._axes.length;c++)h.axes[this.model._axes[c].name]={};$("[id*=_Marker]").remove();var k=this._getDraggedPoint(n,this.mousemoveX,this.mousemoveY),d=k.X,g=k.Y,nt=this.commonDragEventArgs.data.currentPoint?this.commonDragEventArgs.data.currentPoint.xValue:this.commonDragEventArgs.data.oldValue.X,tt=this.commonDragEventArgs.data.currentPoint?this.commonDragEventArgs.data.currentPoint.yValue[0]:this.commonDragEventArgs.data.oldValue.Y;if(n.region?(o=n.region,i._dragDelta(d,g,nt,tt,o.SeriesIndex,o.Region.PointIndex)):(p=n.pointData,i._dragDelta(d,g,nt,tt,p.seriesIndex,p.index)),this.model.enableCanvasRendering)this.canvasElement&&this.canvasElement.clearRect(0,0,i.svgWidth,i.svgHeight),$("#"+i._id+"_PreviewSeries"+w+"_canvas").length==0&&(it=document.getElementById(i._id+"_canvas").getBoundingClientRect(),canvasElement=this.createCanvasElement(i._id+"_PreviewSeries"+w+"_canvas",i.svgWidth,i.svgHeight,it),this.createRect(i,canvasElement),this.canvasElement=canvasElement);else{n.xAxis=n.xAxis===null||n.xAxis===undefined?this.model._axes[0]:n.xAxis;n.yAxis=n.yAxis===null||n.yAxis===undefined?this.model._axes[1]:n.yAxis;var rt=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),b="translate("+rt.x+","+rt.y+")",ht={id:this.svgObject.id+"_PreviewSeriesGroup",transform:b,cursor:"default",visibility:"visible"};$("#"+this.svgObject.id+"_PreviewSeriesGroup").attr("transform",b);this.gPreviewSeriesGroupEle||(this.chartObj=i,this.chartObj.gPreviewSeriesGroupEle=this.gPreviewSeriesGroupEle=this.svgRenderer.createGroup(ht));this.gPreviewSeriesGroupEle.childNodes.length>0&&this.gPreviewSeriesGroupEle.removeChild(this.gPreviewSeriesGroupEle.childNodes[0])}y=$.extend(!0,{},n._visiblePoints);n.pointCollection=y;y.length=n._visiblePoints.length;var l=i.commonDragEventArgs.data,s=l.pointIndex,a=l.seriesIndex;if(i._changeDraggingPoints(n,s,l.newValue.X,l.newValue.Y),ut=new ej.seriesTypes[f],r=n.pointCollection[s],f=="bubble")u=ej.EjSvgRender.utils._getPoint(r,n),e={id:this.svgObject.id+"_PreviewSeries"+a+"_Point"+s,cx:u.X+this.canvasX,cy:u.Y+this.canvasY,r:r.radius,fill:n.fill,"stroke-width":2,visibility:"visible","stroke-dasharray":"",opacity:.6,stroke:"transparent"},this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawCircle(e,canvasElement):this.svgRenderer.drawCircle(e,this.gPreviewSeriesGroupEle),this.svgRenderer.append(this.gPreviewSeriesGroupEle,this.gSeriesEle);else if(f=="scatter"){var u=ej.EjSvgRender.utils._getPoint(r,n),ft=n.marker.shape.capitalizeFirstString(),u={startX:u.X+this.canvasX,startY:u.Y+this.canvasY},et={ShapeSize:{width:n.marker.size.width,height:n.marker.size.height},ID:this.svgObject.id+"_PreviewSeries"+a+"_Point"+s,Style:{Color:n.fill,BorderWidth:n.marker.border.width,BorderColor:"transparent",Opacity:.6,Visibility:"visible"}};this.model.enableCanvasRendering?ej.EjSvgRender.chartSymbol["_draw"+ft](u,et,this,canvasElement):ej.EjSvgRender.chartSymbol["_draw"+ft](u,et,this,this.gPreviewSeriesGroupEle);this.svgRenderer.append(this.gPreviewSeriesGroupEle,this.gSeriesEle)}else if(f=="column"||f=="bar"){r.xValue=typeof r.xValue=="object"?Date.parse(r.xValue):r.xValue;var ct=ej.EjSeriesRender.prototype.getOrigin(i,n,h),lt=n.sidebysideInfo,ot=r.YValues[0],at=ct,st=ej.EjSeriesRender.prototype.calculateSides(r,lt),vt=st.x1,yt=st.x2,v=ej.EjSeriesRender.prototype.getRectangle(vt,ot,yt,at,n,i);e={id:this.svgObject.id+"_PreviewSeries"+a+"_Point"+s,x:v.X+this.canvasX,y:v.Y+this.canvasY,width:v.Width,height:v.Height,cornerRadius:n.cornerRadius,fill:n.fill,"stroke-width":2,plot:ot<0?"negative":"positive",opacity:.6,stroke:"transparent","stroke-dasharray":""};this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawRect(e,canvasElement):(this.svgRenderer.drawRect(e,this.gPreviewSeriesGroupEle),this.svgRenderer.append(this.gPreviewSeriesGroupEle,this.gSeriesEle))}else(f=="spline"||f=="splinearea")&&(r.xValue=typeof r.xValue=="object"?Date.parse(r.xValue):r.xValue),ut.draw(this,n,h);u=ej.EjSvgRender.utils._getPoint(r,n);n.tooltip.visible&&(ej.util.isNullOrUndefined(n.tooltip.template)?($(".tooltipDiv"+this._id).remove(),i.displayShowTooltip(u,r,n,r.actualIndex)):($("#"+i.svgObject.id).find("#"+i.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),o={SeriesIndex:a,Region:{PointIndex:r.actualIndex}},i.createTooltip(o,t,n)))},_dragPointMarker:function(n,t,i,r,u){var f=null,o=n.seriesIndex,s,h,e;f=ej.EjSvgRender.utils._getPoint(u.point,n);this.model.enableCanvasRendering?$("#"+this.svgObject.id+"_Marker").length==0&&(s=document.getElementById(this.svgObject.id).getBoundingClientRect(),ctx=this.createCanvasElement(this.svgObject.id+"_Marker",this.svgWidth,this.svgHeight,s)):(h={id:this.svgObject.id+"_markerGroup_"+o},this.gMarkerGroupEle||(this.gMarkerGroupEle=this.svgRenderer.createGroup(h)));e={id:this.svgObject.id+"_Series"+o+"_Point"+u.index+"_Marker",cx:f.X+this.model.m_AreaBounds.X,cy:f.Y+this.model.m_AreaBounds.Y,r:7,fill:n.fill,"stroke-width":3,opacity:1,stroke:"white",visibility:"visible"};this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawCircle(e,ctx):(this.svgRenderer.drawCircle(e,this.gMarkerGroupEle),this.svgRenderer.append(this.gMarkerGroupEle,this.gSeriesEle))},_dragPointGripper:function(n){var i=n.region.type.toLowerCase(),f=this.model._visibleSeries[n.region.SeriesIndex],h=f._visiblePoints[n.region.Region.PointIndex],e,o,s,t,u,r;if(transposed=f.isTransposed,inversed=f.yAxis.isInversed,i=="column"||i=="bar"){for(this.model.enableCanvasRendering?(e=document.getElementById(this.svgObject.id).getBoundingClientRect(),canvasGripper=this.createCanvasElement(this.svgObject.id+"_Marker",this.svgWidth,this.svgHeight,e),document.getElementById(canvasGripper.canvas.id).style.zIndex=1):(o={id:this.svgObject.id+"_markerGroup_"+n.region.SeriesIndex},this.gMarkerGroupEle||(this.gMarkerGroupEle=this.svgRenderer.createGroup(o))),s=3,t=n.region.Region.Bounds,(transposed&&i=="bar"||i=="column"&&!transposed)&&(value=t.Width,boundValue=t.X),(!transposed&&i=="bar"||i=="column"&&transposed)&&(value=t.Height,boundValue=t.Y),loc=value<75?value-value/3:50,diff=value>75?value-75:0,radius=(loc-6)/6,cxy=diff/2+boundValue+loc/6+radius/2,u=1;u<=s;u++)r={id:this.svgObject.id+"_Series"+n.region.SeriesIndex+"_Point"+n.region.Region.PointIndex+"_Marker"+u,fill:"white",opacity:1,stroke:"white",visibility:"visible"},cxy+=u==1?radius:2*radius+3,r.r=Math.abs(radius),(transposed&&i=="bar"||i=="column"&&!transposed)&&(r.cx=cxy,r.cy=inversed?t.Y+t.Height-radius-5:t.Y+radius+5),(!transposed&&i=="bar"||i=="column"&&transposed)&&(r.cx=inversed?t.X+radius+5:t.X+t.Width-radius-5,r.cy=cxy),this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawCircle(r,canvasGripper):this.svgRenderer.drawCircle(r,this.gMarkerGroupEle);this.svgRenderer.append(this.gMarkerGroupEle,this.gSeriesEle)}},chartMouseMove:function(n){function a(t){var i=o._id,r;$("#"+i+"_tooltip").length<=0?(r=$("<div><\/div>").attr({id:i+"_tooltip","class":"zoom"+i}),$(r).html(" "+t+" "),$(document.body).append(r),$(r).css({left:n.pageX+10,top:n.pageY+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"})):$("#"+i+"_tooltip").css({left:n.pageX+10,top:n.pageY+10})}var ui=this.GetSeriesPoint(n),h=this.svgObject,t=this.model,at=t.zooming.enable,y=t.enableCanvasRendering,ai,vt,yt,pt,tt,fi,vi,it,rt,o,ei,oi,k,e,wt,bt,kt,dt,p,ti,ii,i,st,ht,si,hi,v,ri,s,c,lt,r,u,b;if(t.event=n,clearTimeout(this.removeTooltip),this.doPan&&n.target.id.indexOf(this._id+"_scrollbar")>-1&&(this.doPan=!1),ai=n.target.classList,vt={left:0,top:0},this.multiSelectAreaType!="cartesianaxes"||at||y||this.multiSelectMouseMove(n),this.rotateActivate&&this.oPreviousCoords){if(yt=this.oPreviousCoords.Y-this.mousemoveY,pt=this.oPreviousCoords.X-this.mousemoveX,(pt||yt)&&(t.tilt-=yt,t.rotation+=pt,this.model.isSelected&&(tt=this.selectedStyle(this)),this.isTouch(n)||$(this.chart3D).empty(),$("#template_group_"+this._id).empty(),fi={Width:$(h).width(),Height:$(h).height()},this.graphics.view(h,this,t.rotation,t.tilt,fi,t.perspectiveAngle,t.depth),this.svgRenderer.append(this.chart3D,h),this.model.isSelected))for(i=0;i<tt.length;i++)$("#"+tt[i].id).attr("class",tt[i].className);this.oPreviousCoords.Y=this.mousemoveY;this.oPreviousCoords.X=this.mousemoveX}for(vi=n.target.id,svgObjectId=h.id,isZoom=this.isZoomButtonHovered(n.target),visibleSeries=t._visibleSeries,st=visibleSeries.length,$("[id*=_Marker]").remove(),i=st-1;i>=0;i--)if(chartSeries=visibleSeries[i],k=chartSeries.type.toLowerCase(),chartSeries.dragSettings.enable&&!t.enable3D){if(this._enableDragging(chartSeries,i,n),this.dragPoint)break;if(nt=this.calMousePosition(n),this.mousemoveX=nt.X,this.mousemoveY=nt.Y,it=this.GetSeriesPoint(n),!chartSeries.marker.visible&&k!="bubble"&&k!="scatter"&&k!="column"&&k!="bar"&&(rt=this.getClosesPointXY(ei,oi,chartSeries,this.mousemoveX,this.mousemoveY,n),rt.point)){chartSeries.seriesIndex=i;this._dragPointMarker(chartSeries,this.mousemoveX,this.mousemoveY,n,rt);this.closestXyPoint=rt;break}if(it&&it.region.SeriesIndex==i){this._dragPointGripper(it);break}}if(o=this,this.dragPoint&&(ei=[],oi=[],$(document).keyup(function(n){n.keyCode==27&&($(".tooltipDiv"+this._id).remove(),$("#"+svgObjectId+"_TrackToolTip").remove(),o.dragPoint=!1,visibleSeries[o.commonDragEventArgs.data.seriesIndex].pointCollection=null,o.chartMouseUp(n))}),c=this.dragIndex.seriesIndex,o._pointDragandDrop(visibleSeries[c],n,o)),this.calMousePosition(n),$("#"+this._id+"_tooltip").remove(),!this.dragPoint&&(this.drag||isZoom||(this.isTouch(n)||t.doubleTapped)&&!t.crosshairMoved)||this.chartInteractiveBehavior(n),t.crosshair.visible&&t.AreaType=="cartesianaxes"||(y&&ui||($("[class*=HighlightStyle]").attr("class",""),$("[class*=HighlightLegendStyle]").attr("class",""),$("[class*=HighlightLegendPathStyle]").attr("class",""),$("[class*=HighlightPathStyle]").attr("class",""),$("[class*=Highlightseries]").attr("class",""),$("[id*="+this._id+"_Highlight_]").remove()),this.highlightStart(n,ui)),!this.panning&&(e="#"+svgObjectId,at&&t.AreaType=="cartesianaxes"&&!t.enable3D&&this.drag&&!this.dragPoint&&!this.chartRightClick)){this.disableTrackBall();$("#"+svgObjectId+"_ZoomArea").remove();var ut,ft,et,ot,r=this.mousemoveX,u=this.mousemoveY,f=t.m_AreaBounds;this.mousemoveX<f.X?r=f.X:this.mousemoveX>f.X+f.Width&&(r=f.X+f.Width);u=this.mousemoveY<f.Y?f.Y:this.mousemoveY>f.Y+f.Height?f.Y+f.Height:this.mousemoveY;wt=t.zooming.type.toLowerCase();wt=="x"?(ut=Math.abs(r-this.mouseDownX),ft=f.Height,et=r>this.mouseDownX?this.mouseDownX:r,ot=f.Y):wt=="y"?(ut=f.Width,ft=Math.abs(u-this.mouseDownY),et=f.X,ot=u>this.mouseDownY?this.mouseDownY:u):(ut=Math.abs(r-this.mouseDownX),ft=Math.abs(u-this.mouseDownY),et=r>this.mouseDownX?this.mouseDownX:r,ot=u>this.mouseDownY?this.mouseDownY:u);$(h).css({"-moz-user-select":"-moz-none","-khtml-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none","user-select":"none"});this.zooming=!0;bt={id:svgObjectId+"_ZoomArea",x:et+vt.left,y:ot+vt.top,width:ut,height:ft,fill:"rgba(69,114,167,0.25)","stroke-width":1,stroke:"rgba(69,114,167,0.25)","clip-path":"url(#"+svgObjectId+"_ChartAreaClipRect)"};y?this.svgRenderer.drawZoomRect(bt,this):this.svgRenderer.drawRect(bt,h)}if(kt=t.zooming.enableDeferredZoom,this.panning&&this.doPan&&t.AreaType=="cartesianaxes"&&!this.dragPoint)if(this.currentPageX=n.pageX,this.currentPageY=n.pageY,$("#"+this._id+"_canvas").css({cursor:"pointer"}),ej.isTouchDevice()||kt){if(ej.isTouchDevice()||kt){for(p=0;p<visibleSeries.length;p++){var s=t.series[p],d=ej.EjSvgRender.utils._getTransform(s.xAxis,s.yAxis,t.requireInvertedAxes),gt=n.pageX-this.oPreviousCoords.x+d.x,ni=n.pageY-this.oPreviousCoords.y+d.y,g="translate("+gt+","+ni+")";$("#"+svgObjectId+"_SeriesGroup_"+p).attr("transform",g);$("#"+svgObjectId+"_symbolGroup_"+p).attr("transform",g);$("#"+svgObjectId+"_TextGroup_"+p).attr("transform",g)}for(c=0;c<t.indicators.length&&t.indicators[c]._points.length>0;c++)ti=t.indicators[c],d=ej.EjSvgRender.utils._getTransform(ti.xAxis,ti.yAxis,t.requireInvertedAxes),gt=n.pageX-this.oPreviousCoords.x+d.x,ni=n.pageY-this.oPreviousCoords.y+d.y,g="translate("+gt+","+ni+")",$("#"+svgObjectId+"_indicatorGroup_"+c).attr("transform",g)}}else dt={x:this.oPreviousCoords.x-n.pageX,y:this.oPreviousCoords.y-n.pageY},this.oPreviousCoords={x:n.pageX,y:n.pageY},$.each(t._axes,function(n,t){var i=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1);o.translate(t,dt.x,dt.y,i)}),this._updateScroll(),this.redraw(!0,null,n.target,this.isTouch(n)),this._cursorToPointer(),this._enableZoomingButtons();var w=n.target.id,e=this._id,l=ej.util.isNullOrUndefined(n.target.parentNode)?"":n.target.parentNode.id;if(at&&(l==e+"_svg_ResetZoom"?a(this._localizedLabels.reset):l==e+"_svg_PanBtn"?a(this._localizedLabels.pan):l==e+"_svg_ZoomBtn"?a(this._localizedLabels.zoom):l==e+"_svg_ZoomInBtn"?a(this._localizedLabels.zoomIn):l==e+"_svg_ZoomOutBtn"&&a(this._localizedLabels.zoomOut)),ii=this.getAxisLabelData(n),ii&&(b=$.extend({},ej.EjSvgRender.commonChartEventArgs),b.data=ii,this._trigger("axisLabelMouseMove",b)),!this.isTouch(n))for(this.axisTooltip(n,w),t.title.enableTrim&&this.showTitleTooltip(n,w),i=0,st=t.series.length;i<st;i++)s=t.series[i],ht=s.marker.dataLabel,!s._enableSmartLabels||this.model.enable3D||ht.enableWrap||(si=ht.template,hi=ht.font,t.AreaType=="none"&&ej.util.isNullOrUndefined(si)&&this.datalabelTooltip(n,i,hi));if($(h).find(e+"_ResetZoom,"+e+"_PanBtn,"+e+"_ZoomBtn").length>0&&$(h).find(e+"_ResetZoom,"+e+"_PanBtn,"+e+"_ZoomBtn").appendTo(h),v=this.getLegendData(n),v)if(ri=$.extend({},ej.EjSvgRender.commonChartEventArgs),ri.data=v,v.series.highlightSettings.enable&&(y?(s=$.extend({},v.series),s.seriesIndex=v.legendItem.LegendItem.SeriesIndex,s.pointIndex=v.legendItem.LegendItem.PointIndex,c=this.model.AreaType=="none"?s.pointIndex:s.seriesIndex,$("#"+o._id+"_Selection_Legend"+c+"_canvas").length==0&&($("[id*="+this._id+"_Highlight_]").remove(),this.canvasHighlight(o,n,s,v))):this.highlight(o,n,v.series,v)),this._trigger("legendItemMouseMove",ri),y){var nt=this.calMousePosition(n),ci=nt.X,li=nt.Y,ct=t.LegendBounds;$(this.legendContainer).children().css({cursor:"pointer"});ci>=ct.X&&ci<=ct.X+t.LegendViewerBounds.Width&&li<=ct.Y+t.LegendViewerBounds.Height&&li>=ct.Y&&this._textTooltip(n,t.legendTextRegion)}else this._textTooltip(n,t.legendTextRegion);else y&&$(this.legendContainer).children().css("cursor","default");y&&(w.indexOf("_ResetZoom")!=-1||l.indexOf("_ResetZoom")!=-1?a(this._localizedLabels.reset):w.indexOf("_PanBtn")!=-1||l.indexOf("_PanBtn")!=-1?a(this._localizedLabels.pan):w.indexOf("_ZoomBtn")!=-1||l.indexOf("_ZoomBtn")!=-1?a(this._localizedLabels.zoom):w.indexOf("_ZoomInBtn")!=-1||l.indexOf("_ZoomInBtn")!=-1?a(this._localizedLabels.zoomIn):(w.indexOf("_ZoomOutBtn")!=-1||l.indexOf("_ZoomOutBtn")!=-1)&&a(this._localizedLabels.zoomOut),this.isTouch(n)||(this._textTooltip(n,t.xAxisLabelRegions),this._textTooltip(n,t.yAxisLabelRegions)));lt=this;t.xAxisTitleRegion&&(r=this.mousemoveX,u=this.mousemoveY,$.each(t.xAxisTitleRegion,function(t,i){r>=i.Bounds.X&&r<=i.Bounds.X+i.Bounds.Width&&u>=i.Bounds.Y-i.Bounds.Height&&u<=i.Bounds.Y&&i.trimText!=i.labelText&<.showAxisTooltip(n.pageX,n.pageY,i.labelText)}));t.yAxisTitleRegion&&(r=this.mousemoveX,u=this.mousemoveY,$.each(t.yAxisTitleRegion,function(t,i){r>=i.Bounds.X&&r<=i.Bounds.X+i.Bounds.Width&&u>=i.Bounds.Y-i.Bounds.Height&&u<=i.Bounds.Y&&i.trimText!=i.labelText&<.showAxisTooltip(n.pageX,n.pageY,i.labelText)}));t.axisMultiLevelLabelRegions&&(r=this.mousemoveX,u=this.mousemoveY,$.each(t.axisMultiLevelLabelRegions,function(t,i){r>=i.Bounds.X&&r<=i.Bounds.X+i.Bounds.Width&&u>=i.Bounds.Y-i.Bounds.Height&&u<=i.Bounds.Y&&i.trimText!=i.labelText&<.showAxisTooltip(n.pageX,n.pageY,i.labelText)}));b=$.extend({},ej.EjSvgRender.commonChartEventArgs);b.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:t.svgHeight,width:t.svgWidth},id:n.target.id,pageX:n.pageX,pageY:n.pageY};this._trigger("chartMouseMove",b)},axisTooltip:function(n,t){var o=this.svgObject.id,s=this.model.hAxes,h=this.model.vAxes,i,r,u,f,e;if(t.indexOf("_YLabel_")>=0){for(r=0;r<h.length;r++)if(t.indexOf(o+"_"+h[r].name+"_YLabel_")>=0){i=h[r];break}if(i&&i.enableTrim)for(visibleLabelsLength=i.visibleLabels.length,u=0;u<visibleLabelsLength&&this.model.AreaType=="cartesianaxes";u++)if(t==o+"_"+h[r].name+"_YLabel_"+u){if(f=i.visibleLabels[u],e=f.Text==f.displayText?"":i.labelFormat?i.labelFormat.replace("{value}",f.Text):f.Text,e=="")break;i.labelPosition.toLowerCase()=="inside"&&(this._hideTooltip(),this._removeTrackBall());this.showAxisTooltip(n.pageX,n.pageY,e)}}if(t.indexOf("_XLabel_")>=0){for(r=0;r<s.length;r++)if(t.indexOf(o+"_"+s[r].name+"_XLabel_")>=0){i=s[r];break}if(i&&(i.enableTrim||i.labelIntersectAction.toLowerCase()=="trim"||i.labelIntersectAction.toLowerCase()=="wrap"||i.labelIntersectAction.toLowerCase()=="wrapbyword"))for(visibleLabelsLength=i.visibleLabels.length,u=0;u<visibleLabelsLength&&this.model.AreaType=="cartesianaxes";u++)if(t==o+"_"+s[r].name+"_XLabel_"+u){if(f=i.visibleLabels[u],e=f.Text==f.displayText?"":f.Text,e=="")break;i.labelPosition.toLowerCase()=="inside"&&(this._hideTooltip(),this._removeTrackBall());this.showAxisTooltip(n.pageX,n.pageY,e)}}},showTitleTooltip:function(n,t){var a=ej.EjSvgRender.utils._measureText(this.model.title.text,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,this.model.title.font),i=this.model,r=i._titleLocation,u=i._subTitleLocation,c=i.title.enableTrim,o=i.elementSpacing,f=this.mousemoveX,e=this.mousemoveY,v=i.title.textOverflow.toLowerCase(),l=i.title.subTitle.enableTrim,y=i.title.subTitle.textOverflow.toLowerCase(),s=i.title.text,h=i.title.subTitle.text;c&&this.model.trimTooltip&&(t.indexOf("ChartTitleText")>=0?this.showAxisTooltip(n.pageX,n.pageY,s):this.model.enableCanvasRendering&&f>=r.X-o&&f<=r.X-o+r.size.width&&e>=r.Y-r._height&&e<=r.Y+r.size.height&&this.showAxisTooltip(n.pageX,n.pageY,s));l&&i.subTitleTooltip&&(t.indexOf("ChartSubTitleText")>=0?this.showAxisTooltip(n.pageX,n.pageY,h):i.enableCanvasRendering&&f>=u.X&&f<=u.X+u.size.width&&e>=u.Y&&e<=u.Y+u.size.height&&this.showAxisTooltip(n.pageX,n.pageY,h))},_updateScroll:function(){for(var i=this.model.scrollObj,f=i?i.length:0,r=this.model._axes,u=this.scrollbarContainer,n,t=0;t<f;t++)i[t]&&(n=i[t],(n.zoomPosition!=r[t].zoomPosition||n.zoomFactor!=r[t].zoomFactor)&&(n.zoomPosition=r[t].zoomPosition,n.zoomFactor=r[t].zoomFactor,u._initializeScrollbarVariables(n),u._scrollbarUpdate.call(this,n),u._setScrollPosition.call(this,n.startX,n.startX+n.rectWidth,n)))},_hideTooltip:function(){$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden");$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden").hide();$(".tooltipDiv"+this._id).css("display","none")},_removeHighlight:function(){var n,t;if($("[id*=HighlightSegment]").remove(),$("[id*=HighlightPath]").remove(),$("[id*=HighlightLegendSegment]").remove(),$("[id*=HighlightLegendPath]").remove(),$("[id*=HighlightDef]").remove(),$("[id*=Highlightseries]").remove(),$("[id*="+this._id+"_Highlight_]").remove(),!this.model.enableCanvasRendering&&!this.vmlRendering)if(n=this.svgObject.querySelector("[class^='Highlight']"),n!==null&&n.length==null)n.removeAttribute("class");else for(t=n&&n.length;t--;)n.removeAttribute("class")},_removeSelection:function(){$("[id*="+this._id+"_SelectionCluster_Legend]").remove();$("[id*="+this._id+"_Selection_series]").remove();$("[id*="+this._id+"_Selection_Cluster]").remove();$("[id*="+this._id+"SelectionSegment]").remove();$("[id*="+this._id+"SelectionPath]").remove();$("[id*="+this._id+"SelectionLegend]").remove();$("[id*="+this._id+"SelectionDef]").remove();$("[id*="+this._id+"Selectionseries]").remove();$("[id*="+this._id+"_Selection_]").remove()},datalabelTooltip:function(n,t,i){var y=this.calMousePosition(n);this.mousemoveX=y.X;this.mousemoveY=y.Y;var c=this._id,s=this.mousemoveX,p=this.mousemoveY,w=this.vmlRendering,u=this.model.elementSpacing,e=this,h,l,a,v,r,f,o;ej.util.isNullOrUndefined(this.accDataLabelRegion[t])||$.each(this.accDataLabelRegion[t],function(t,y){h=y.bounds.minX;l=y.bounds.minY;a=y.bounds.maxX;v=y.bounds.maxY;w&&(h=y.bounds.minX+y.bounds.width/2,a=y.bounds.maxX+y.bounds.width/2,l=y.bounds.minY,v=y.bounds.maxY);s>=h&&s<=a&&p>=l&&p<=v&&($("#"+c+"_tooltip").remove(),r=$("<div><\/div>").attr({id:c+"_tooltip","class":"ejTooltip"+c}),y.trimmedText!=y.text&&($("#"+e.svgObject.id+"_TrackToolTip").hide(),$(r).html(y.text),$(document.body).append(r),f=ej.EjSvgRender.utils._measureText(y.text,y.text.length,y.font).width,$(r).css({top:n.pageY+u,display:"block",position:"absolute","z-index":"13000",cursor:"default",color:"#000000","font-size":i.size,"background-color":"#FFFFFF",border:"1px solid #707070","white-space":"nowrap",padding:"5px"}),(y.type=="pyramid"||y.type=="funnel")&&(o=e.model.m_AreaBounds.Width+e.model.m_AreaBounds.X-n.pageX,o>f?$(r).css({left:n.pageX+u}):(left=n.pageX-f+2*u,$(r).css({left:left}))),(y.type=="pie"||y.type=="doughnut"||y.type=="pieofpie")&&(h>y.bounds.centerX?(o=e.svgWidth-e.model.margin.left-e.model.margin.right-s,o<f?(left=n.pageX-f,$(r).css({left:left+u})):$(r).css({left:n.pageX+u})):(o=s,o<f?$(r).css({left:n.pageX+u}):(left=n.pageX-f,$(r).css({left:left-2*u}))))))})},showAxisTooltip:function(n,t,i){var u=this._id,r=$("<div><\/div>").attr({id:u+"_tooltip","class":"ejTooltip"+u});$(r).html(" "+i+" ");$(document.body).append(r);$(r).css({left:n+10,top:t+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"})},_textTooltip:function(n,t){var a=this,o=this.calMousePosition(n),r=this.model.legend._ejScroller,v=r?$("#legend_"+this._id).ejScroller("instance").model.scrollTop:$("#legend_"+this._id).scrollTop(),y=r?$("#legend_"+this._id).ejScroller("instance").model.scrollLeft:$("#legend_"+this._id).scrollLeft(),s=o.X,h=o.Y,u=s,f=h,e=this._id,p=a.model,c=p.legend,w=c.enableScrollbar,b=c.textOverflow.toLowerCase(),l,i;(w||r)&&(u=s+y,f=h+v);$.each(t,function(t,r){u>=r.bounds.x&&u<=r.bounds.x+r.bounds.width&&f>=r.bounds.y-r.bounds.height/3&&f<=r.bounds.y&&($("#"+e+"_tooltip").remove(),i=$("<div><\/div>").attr({id:e+"_tooltip","class":"ejTooltip"+e}),l=jQuery.type(r.trimText)=="array"?r.trimText.join(" "):r.trimText,l!=r.labelText&&($(i).html(" "+r.labelText+" "),$(document.body).append(i),$(i).css({left:n.pageX+10,top:n.pageY+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"})))})},pieExplosion:function(n){var a,v,c,y,f,r,e,l,o;this.model.explode=!0;var t=n,u,s,i=t.region.Series,p=t.region.SeriesIndex,h=new ej.seriesTypes[i.type.toLowerCase()],w=i.explodeIndex,b=i.labelPosition.toLowerCase();if(currentExplodePoint={SeriesIndex:t.pointData[0].SeriesIndex,PointIndex:t.pointData[0].PointIndex},a=this.model._isPieOfPie?t.pointData[0].PointIndex:t.region.Series._visiblePoints[t.pointData[0].PointIndex].actualIndex,w!=a&&!t.region.Series.explodeAll){if(i.explodeIndex=a,pieSeriesIndex=t.pointData[0].PieSeriesIndex,!ej.util.isNullOrUndefined(this.model.explodeValue)&&this.model.explodeValue!=currentExplodePoint){for(this.model.explodeValue.SeriesIndex!=t.region.SeriesIndex&&(i=this.model._visibleSeries[this.model.explodeValue.SeriesIndex]),v=this.model._isPieOfPie?this._getPieOfPiePoint(this.model.explodeValue.PointIndex,i):i._visiblePoints[this.model.explodeValue.PointIndex],c=h._calculateArcData(this,this.model.explodeValue.PointIndex,v,i,this.model.explodeValue.SeriesIndex,this.model.explodeValue.PieSeriesIndex),u=this.svgObject.id+"_SeriesGroup_"+this.model.explodeValue.SeriesIndex,s=this.model.explodeValue.PieSeriesIndex==1?$(this.gSeriesEle).children("#"+u)[1]:$(this.gSeriesEle).children("#"+u)[0],f=$(s).children(),r=0;r<f.length;r++)if(e=f[r],l=this.svgRenderer._getAttrVal($(e)[0],"pointIndex"),parseInt(l)==this.model.explodeValue.PointIndex){this.svgRenderer._setAttr($(e),{d:c.Direction});break}h.drawDataLabelAcc(this,i,this.model.explodeValue.PointIndex,v,this.model.explodeValue.SeriesIndex,this.model.explodeValue.PieSeriesIndex)}for(y=this.model._isPieOfPie?this._getPieOfPiePoint(n.region.Region.PointIndex,i):i._visiblePoints[t.pointData[0].PointIndex],c=h._calculateArcData(this,t.pointData[0].PointIndex,y,t.region.Series,p,pieSeriesIndex),u=this.svgObject.id+"_SeriesGroup_"+t.region.SeriesIndex,s=pieSeriesIndex==1?$(this.gSeriesEle).children("#"+u)[1]:$(this.gSeriesEle).children("#"+u)[0],f=$(s).children(),r=0;r<f.length;r++)if(e=f[r],l=this.svgRenderer._getAttrVal($(e)[0],"pointIndex"),parseInt(l)==t.pointData[0].PointIndex){this.svgRenderer._setAttr($(e),{d:c.Direction});break}this.model.enableCanvasRendering&&(o=document.getElementById(this.svgObject.id).getClientRects()[0],this.svgRenderer.ctx.clearRect(o.left,o.top,o.width,o.height),$("#"+this._id).ejChart("redraw"));h.drawDataLabelAcc(this,i,t.pointData[0].PointIndex,y,p,pieSeriesIndex);this.model.explodeValue={SeriesIndex:t.pointData[0].SeriesIndex,PointIndex:t.pointData[0].PointIndex,PieSeriesIndex:t.pointData[0].PieSeriesIndex}}t.region.Series.explodeIndex=w},displayTemplateTooltip:function(n,t,i,r,u,f,e,o){var h=$.extend(!0,{},r),y=5,p=this.model.locale,b,c,k,v;h.x=h.X;u.xAxis._valueType.toLowerCase()=="datetime"&&(h.x=ej.format(new Date(h.X),ej.util.isNullOrUndefined(u.xAxis.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(u.xAxis.intervalType):u.xAxis.labelFormat,p));u.xAxis._valueType.toLowerCase()=="category"&&(h.x=ej.EjSvgRender.utils._getLabelContent(e,u.xAxis,p));n=ej.util.isNullOrUndefined(n)?0:n;t=ej.util.isNullOrUndefined(t)?0:t;var l=this.model.m_AreaBounds.X+o.left,a=i.X+n+l+this.model.crosshair.marker.size.width+y,w=i.Y+t+this.model.m_AreaBounds.Y+o.top,s;$("#"+this.svgObject.id+"_TrackToolTipTemplate_"+f).length==0?(s=$("<div class='TrackToolTipTemplate' style='position: absolute; z-index: 13000; display: block;'><\/div>"),$(document.body).append(s)):($(document).find('[id*="_TrackToolTipTemplate_"]').css("display","block"),s=$("#"+this.svgObject.id+"_TrackToolTipTemplate_"+f),s.empty());this.svgRenderer._setAttr($(s),{id:this.svgObject.id+"_TrackToolTipTemplate_"+f});this.model.crosshair.tooltipTemplate!=null&&(b=$("#"+this.model.crosshair.tooltipTemplate).clone(),$(b).css("display","block").appendTo(s),u.count=1,h.count=1,c=this.getSeriesColor(h,f,u),$(s).css("background-color",jQuery.type(c)=="array"?c[0].color:c),k={series:u,point:h},$(s).html($(s).html().parseTemplate(k)));w-=parseFloat($(s).css("height"))/2;v=parseFloat($(s).css("width"));a+v>l+this.model.m_AreaBounds.Width&&(a=i.X+n+l-this.model.crosshair.marker.size.width-y-v);$(s).css("left",a);$(s).css("top",w)},displayAxisTooltip:function(n,t,i,r,u,f){var it,p,ut,h,v,y;i._valueType.toLowerCase()=="double"&&(it=i.labelFormat?i.labelFormat.match("{value}"):null,t=i.labelFormat?it!=null?i.labelFormat=="${value}"?i.labelFormat.replace("{value}","$"+Number(t)):i.labelFormat.replace("{value}",Number(t)):ej.format(Number(t),i.labelFormat,this.model.locale):t);var l=0,rt=i.orientation.toLowerCase(),a,g=0,nt=0,o=i._opposed,d=this.model.enableCanvasRendering,ft=o?l+10+(i.x+i.width):i.x+i.width;for(p=0;p<this.model._axes.length;p++)this.model._axes[p].majorTickLines.size>l&&(l=this.model._axes[p].majorTickLines.size);if(n.X>=0&&n.X<=ft){var e=n.X,c=n.Y,s=5,w=$.extend({},ej.EjSvgRender.commonChartEventArgs);w.data={axisIndex:r,chartAxis:i,currentTrackText:t,location:u};this._trigger("trackAxisToolTip",w);ut=w.data.currentTrackText;h=ej.EjSvgRender.utils._measureText(ut,null,i.crosshairLabel.font);rt=="horizontal"&&(e=e-h.width/2,i.labelPosition=="inside"||(o?u.y<i.y:u.y>i.y)?(o==!1&&(c=i.y-h.height+l-(i._isScroll?this.model.scrollerSize:0),a="top"),o==!0&&(c=i.y+h.height-l,a="bottom")):(o==!0&&(c=i.y-h.height/2-s-l,a="bottom"),o==!1&&(c=i.y+h.height-s+l,a="top")),g=s,c=c+(i._isScroll?i.opposedPosition?-this.model.scrollerSize:this.model.scrollerSize:0));!o&&e+h.width>this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&(e=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X-h.width+s+this.model.elementSpacing);rt=="vertical"&&(c=n.Y+h.height/4,i.labelPosition=="inside"||!o&&u.x<i.x?(o==!0&&(e=i.x-h.width+s-l,a="left"),o==!1&&(e=i.x+2*s+(i._isScroll?this.model.scrollerSize:0),a="right")):(o==!0&&(e=i.x+3*s,a="left"),o==!1&&(e=i.x-h.width-l,a="right")),e=e+(i._isScroll?i.opposedPosition?this.model.scrollerSize:-this.model.scrollerSize:0),nt=s);var et={id:this.svgObject.id+"_AxisToolTipText_"+r,x:e-nt,y:c+g,fill:i.crosshairLabel.font.color,"font-size":i.crosshairLabel.font.size,"font-family":i.crosshairLabel.font.fontFamily,"font-style":i.crosshairLabel.font.fontStyle,"font-weight":i.crosshairLabel.font.fontWeight,"text-anchor":"start",opacity:i.crosshairLabel.font.opacity},ct=d?s/4:0,tt=ej.EjSvgRender.utils._measureText(w.data.currentTrackText,this.model.m_AreaBounds.Width,i.crosshairLabel.font),b=i.crosshairLabel,e=e-s,c=c-tt.height,ot=tt.width+2*s,st=2*tt.height-2*s,k={x:e-nt,y:c+g,width:ot,height:st,rx:b.rx*(d?2:1),ry:b.ry*(d?2:1)},ht=ej.EjSvgRender.utils._calculateroundedCorner(k,!0,a,0,f);k={id:this.svgObject.id+"_AxisToolTipRect_"+r,d:ht,fill:b.fill,"stroke-width":b.border.width,stroke:b.border.color};v=this.model._axes[r];u.y<v.y+v.height&&u.y>v.y||u.x<v.x+v.width&&u.x>v.x?(this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipRect_"+r),{display:"block"}),this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipText_"+r),{display:"block"}),k.display="block"):(this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipRect_"+r),{display:"none"}),this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipText_"+r),{display:"none"}),k.display="none");d?(y=this.svgRenderer.createCrosshairCanvas(),y.ctx=y.getContext("2d")):y=this.svgRenderer;this.svgRenderer.drawPath.call(y,k,this.gTrackAxisEle);this.svgRenderer.drawText.call(y,et,w.data.currentTrackText,this.gTrackAxisEle)}},maxWdithArrayCollection:function(n,t){for(var i=0,u,r=0,e=0,o=ej.EjSvgRender.utils._measureText,f=0,s=n.length;f<s;f++)u=o(n[f],0,t),r=u.width,e+=u.height,i=i==0?r:i<r?r:i;return{maxTextWidth:i,totalHeight:e}},displayTooltip:function(n,t,i){var ii=this.model.crosshair,b=ii.trackballTooltipSettings,kt=b.rx,dt=b.ry,yt=b.border,o=this.model.m_AreaBounds,e,pi,nt,wi,k,ut,ki,sr,it,et,di,fi,vt,ei,tr,ir,bt,oi;if(n){var u=t.series,si,gt,rr=document.getElementById(this._id),pr=$(rr).offset(),at=u.tooltip,ht=at.font?$.extend(!1,u.font,{},at.font):u.font,ni=u.type=="boxandwhisker"?t.point.boxPlotLocation[3]:t.point.location,ri=u.marker.size.width/2+u.marker.border.width+yt.width+5,ai=u._isTransposed?u.xAxis.y+ri:u.yAxis.y,ur=u._isTransposed?u.yAxis.x:u.xAxis.x+ri,r={X:ur+ni.X,Y:ai+ni.Y},ct=t.textCollection,vi=t.textOptionsCollection,yi=t.groupingTextId,h,rt={X:r.X,Y:r.Y},pt=document.getElementById(this._id+"_trackball_grouping_tooltip");if(this._trigger("trackToolTip",{data:{currentText:ct,location:rt}}),!ej.util.isNullOrUndefined(this.model.trackToolTip)&&this.model.trackToolTip!="")for(e=0,ut=ct.length;e<ut-1;e++)ct[e].text==""&&(ct.splice(e,1),vi.splice(e,1),yi.splice(e,1));for(ej.util.isNullOrUndefined(pt)?(pt=document.createElement("div"),h={left:rt.X,top:rt.Y,border:parseInt(yt.width?yt.width:1)+"px solid "+(yt.color?yt.color:"#000000"),background:b.fill?b.fill:"#ffffff",opacity:b.opacity,position:"absolute",height:"auto",width:"auto","border-radius":kt+"px "+dt+"px","pointer-events":"none"},pt.setAttribute("id",this._id+"_trackball_grouping_tooltip")):h={left:rt.X,top:rt.Y},e=0,ut=ct.length;e<ut;e++)span=document.createElement("span"),span.setAttribute("id",yi[e]),span.innerHTML=ct[e].text+"<\/br>",$(span).css(vi[e]),pt.appendChild(span);pi=ct.map(function(n){return n.text});si=this.maxWdithArrayCollection(pi,ht);i=si.maxTextWidth;gt=si.totalHeight;h.top=u._isTransposed?h.top:h.top-gt*.5;h.left=u._isTransposed?h.left-i*.5:h.left;ct.length>1&&(h.top=u._isTransposed?h.top:ai+(o.Height*.5-.5*gt),h.left=u._isTransposed?o.Width/2+o.X-i*.5:h.left);u._isTransposed?gt+h.top>o.Y+o.Height&&(h.top-=gt+ri*2):h.left+i>=o.X+o.Width&&(h.left-=i+(ri+yt.width)*2);h.left=rt.X==r.X?h.left:rt.X;h.top=rt.Y==r.Y?h.top:rt.Y;$(pt).css(h);$(pt).appendTo(this.chartContainer)}else for(nt=0,wi=t.length;nt<wi;nt++){var r=t[nt].Point,ni=t[nt].ClosestPoint,u=t[nt].Series,ui=t[nt].ClosestPointIndex,ti=t[nt].Tgap,ft=$.inArray(u,this.model._visibleSeries),y={X1:o.X,Y1:o.Y+o.Height,X2:o.X+o.Width,Y2:o.Y},d=this.model._axes,fr=u._xAxisName,er=u._yAxisName;for(k=0,ut=d.length;k<ut;k++)fr==d[k].name?u._isTransposed?(y.Y1=d[k].Location.Y1,y.Y2=d[k].Location.Y2):(y.X1=d[k].Location.X1,y.X2=d[k].Location.X2):er==d[k].name&&(u._isTransposed?(y.X1=d[k].Location.X1,y.X2=d[k].Location.X2):(y.Y1=d[k].Location.Y1,y.Y2=d[k].Location.Y2));if(r.X=u.type=="boxandwhisker"?r.X+y.X1:r.X,r.Y=u.type=="boxandwhisker"?r.Y+y.Y2:r.Y,r.X>=y.X1&&r.X<=y.X2&&r.Y>=y.Y2&&r.Y<=y.Y1||n){var tt=this.model.requireInvertedAxes,e,a,v=r.X+(u.isIndicator?0:ej.util.isNullOrUndefined(u._trackMarker)?u.marker.size.width:u._trackMarker.size.width)+f+1,p=r.Y,bi=u.tooltip.format,or=ej.util.isNullOrUndefined(u.yAxis.roundingPlaces)?2:u.yAxis.roundingPlaces;if(ki=t[nt].Series.type=="boxandwhisker"&&r.outlier?this.getTooltipFormat(ni,u,ft,ui,bi,r):this.getTooltipFormat(ni,u,ft,ui,bi,or),sr=u.name?u.name.replace(" ",""):"series"+ft,it=$.extend({},ej.EjSvgRender.commonChartEventArgs),it.data={Location:{X:v,Y:p},Series:u,serIndex:ft,pointIndex:ui,currentText:ki.text},this._trigger("trackToolTip",it),!it.cancel){v=it.data.Location.X;p=it.data.Location.Y;var f=this.model.tooltipPadding,l=ti,at=u.tooltip,ht=at.font?$.extend(!1,u.font,{},at.font):u.font,gi=ej.EjSvgRender.utils._measureText(it.data.currentText,u.xAxis.width,ht),hi=this.getSeriesColor(ni,ft,u),ci=this.getTooltipOptions(hi,u),wr=ci.rectBColor,br=ci.rectFColor,kr=ci.rectTextColor,c=gi.width+2*f,s=gi.height+2*f,dr=tt?c/10:s*30/100,nr=tt?u.yAxis.width:u.xAxis.width,hr=tt?ti+r.X-c/2:ti+r.Y-s/2,cr=tt?ti+r.X+c/2:ti+r.Y+s/2,lr=tt?o.X:o.Y,ar=tt?o.X+o.Width:o.Y+o.Height,g=[],vr=3+ii.marker.border.width+(tt?ii.marker.size.height:ii.marker.size.width)/2,w=this.model.financial?0:vr+5,li=u.type.toLowerCase(),lt,wt=li.indexOf("rangearea")==0?this.model.crosshair.marker.size.height/2:0;if(hr>=lr&&cr<=ar||this.model.financial){tt?r.Y-w-i<o.Y?(et={x:r.X-c/2+l,y:r.Y+w,width:c,height:s,rx:kt,ry:dt},g.push({X:r.X-c/2+f+l,Y:r.Y+w+s/2-f}),lt="top"):(this.model.financial?(v=r.X-c/2+l,p=r.Y+f+wt,e=v+f,a=p+2*f,lt="top"):(v=r.X-c/2+l,p=r.Y-w-s,e=r.X-c/2+f+l,a=r.Y-w-s/2-f,lt="bottom"),et={x:v,y:p,width:c,height:s,rx:kt,ry:dt},g.push({X:e,Y:a})):r.X+w+i-o.X>=nr?(this.model.financial?(v=r.X-c/2,p=r.Y-s-f-wt,e=v+f,a=p+l+s,lt="bottom"):(v=r.X-w-c,p=r.Y-s/2+l,e=v+f,a=r.Y+l+s/2,lt="right"),et={x:v,y:p,width:c,height:s,rx:kt,ry:dt},g.push({X:e,Y:a})):(this.model.financial?(v=r.X-c/2,p=r.Y-wt-s-2*f,e=v+f,a=p+l+s,lt="bottom"):(v=r.X+w,p=r.Y-s/2+l,e=v+f,a=r.Y+l+s/2,lt="left"),et={x:v,y:p,width:c,height:s,rx:kt,ry:dt},g.push({X:e,Y:a}));fi=hi;typeof fi=="object"&&(fi=hi[1].color);var ot=it.data.currentText,yr=ot,st=ej.EjSvgRender.utils._measureText(ot,u.xAxis.width,ht).height,ut;it.data.currentText.indexOf("<br/>")>=0&&(ot=it.data.currentText.split("<br/>"),yr=ot[0],tt?r.Y-w-i<o.Y?g.push({X:r.X-c/2+f+l,Y:r.Y+w+st/ot.length}):(this.model.financial?(e=r.X-c/2+f+l,a=r.Y+4*f+wt):(e=r.X-c/2+f+l,a=r.Y-w-s+st/ot.length),g.push({X:e,Y:a})):(vt=li.indexOf("candle")>=0||li.indexOf("hiloopenclose")>=0||!1,r.X+w+i-o.X>=nr?(this.model.financial?(e=r.X-c/2+f,a=r.Y+l-s-wt+(vt?0:2*f),et.y-=vt?f*3:f,et.height+=vt?f*2:f):(e=r.X-c-w+f,a=r.Y+l-s/2+st/ot.length),g.push({X:e,Y:a})):(this.model.financial?(e=r.X-c/2+f,a=r.Y+l-s-wt+(vt?0:f),et.y-=vt?f*2:f,et.height+=vt?f*2:f):(e=r.X+w+f,a=r.Y+l-s/2+st/ot.length),g.push({X:e,Y:a}))),st=0);ut=g.length-1;st=tt?st:-st;ei=u.type=="boxandwhisker"?nt:ui;tr={id:this.svgObject.id+"_ToolTipText_"+ft+"_"+ei,x:g[ut].X,y:g[ut].Y+st/2,fill:at.font?at.font.color?at.font.color:"#ffffff":"#ffffff","font-size":ht.size,"font-family":ht.fontFamily,"font-style":ht.fontStyle,"font-weight":ht.fontWeight,"text-anchor":"start",isTrackball:!0,padding:this.model.tooltipPadding};di=ej.EjSvgRender.utils._calculateroundedCorner(et,!0,lt,l);ir={id:this.svgObject.id+"_gTooltip_"+ft+"_"+ei,d:di,fill:b.fill?b.fill:fi,"stroke-width":parseInt(b.border.width?b.border.width:0)+"px",stroke:b.border.color?b.border.color:"transparent","fill-opacity":b.opacity};this.model.enableCanvasRendering?(bt=this.svgRenderer.createCrosshairCanvas(),bt.ctx=bt.getContext("2d")):bt=this.svgRenderer;oi=this.svgRenderer.createGroup({id:this.svgObject.id+"_gTooltip_"+ft+"_"+ei});this.svgRenderer.drawPath.call(bt,ir,oi);this.svgRenderer.drawText.call(bt,tr,ot,oi,ht)}}$("#"+this.svgObject.id+"_TrackToolTip_"+ft).length==0&&this.svgRenderer.append($(oi),this.gTrackball)}}},SmartTooltipPosition:function(n){for(var i=[[],[]],r=n.length,u=[],o=n[0].Series._isTransposed?this.model.m_AreaBounds.Width:this.model.m_AreaBounds.Height,f=this.model.tooltipPadding,e=-f,t=0;t<r;t++)i[0][t]=$.extend({},n[t].StEnd),i[1][t]={yAxis:n[t].Series._yAxisName,xAxis:n[t].Series._xAxisName,isTransposed:n[t].Series._isTransposed},u[t]=n[t].ReqInvertAxis?n[t].Point.X:n[t].Point.Y,e+=n[t].StEnd.End-n[t].StEnd.Start+f;for(this.ContinousOverlappingPoints(i[0],u),e<o&&this.verticalArrangeMents(i),t=0;t<r;t++)n[t].Tgap=this.model.financial?0:i[0][t].Start-n[t].StEnd.Start},verticalArrangeMents:function(n){for(var f=n[0],c=n[1],k=this.model.m_AreaBounds,w=this.model.tooltipPadding,l,s,h,a,o=this.model._axes,r,u,v,y,p=f.length,e=p-1,t=0,i=0,b=o.length;e>=0;e--){for(l=c[e].isTransposed,a=c[e].yAxis,i=0;i<b;i++)a==o[i].name&&(l?(s=o[i].Location.X2,h=o[i].Location.X1):(s=o[i].Location.Y1,h=o[i].Location.Y2));if(r=f[e],y=r.End-r.Start,s<r.End)for(r.End=s-2,r.Start=r.End-y,t=e-1;t>=0;t--)u=f[t],v=u.End-u.Start,u.End>f[t+1].Start&&f[t+1].Start>h&&f[t+1].End<s&&(u.End=f[t+1].Start-w,u.Start=u.End-v)}for(e=0;e<p;e++){for(l=c[e].isTransposed,a=c[e].yAxis,i=0;i<b;i++)a==o[i].name&&(l?(s=o[i].Location.X2,h=o[i].Location.X1):(s=o[i].Location.Y1,h=o[i].Location.Y2));if(r=f[e],y=r.End-r.Start,r.Start<h)for(r.Start=h+1,r.End=r.Start+y,t=e+1;t<=p-1;t++)u=f[t],v=u.End-u.Start,u.Start<f[t-1].End&&f[t-1].Start>h&&f[t-1].End<s&&(u.Start=f[t-1].End+w,u.End=u.Start+v)}},ContinousOverlappingPoints:function(n,t){var e=this.model.tooltipPadding,h=0,o=0,a=0,r=0,p=n.length-1,l=n[0].End-n[0].Start+e,v,y,s,c,f,i,u;for(h=n[0].Start+l,a=n[0].Start,f=0;f<p;f++)if(h>=n[f+1].Start){if(l=n[f+1].End-n[f+1].Start+e,h+=l,o++,o-1==p-1||f==p-1){for(v=(h-a)/2,y=(t[r]+t[f+1])/2,s=n[r].End-n[r].Start,n[r].Start=y-v,n[r].End=n[r].Start+s,i=r;i>0;i--)if(n[i].Start<=n[i-1].End+e)c=n[i-1].End-n[i-1].Start,n[i-1].Start=n[i].Start-c-e,n[i-1].End=n[i-1].Start+c;else break;for(u=r+1;u<=r+o;u++)s=n[u].End-n[u].Start,n[u].Start=n[u-1].End+e,n[u].End=n[u].Start+s}}else{if(o=f>0?o:0,o>0){for(v=(h-a)/2,y=(t[r]+t[f])/2,s=n[r].End-n[r].Start,n[r].Start=y-v,n[r].End=n[r].Start+s,i=r;i>0;i--)if(n[i].Start<=n[i-1].End+e)c=n[i-1].End-n[i-1].Start,n[i-1].Start=n[i].Start-c-e,n[i-1].End=n[i-1].Start+c;else break;for(u=r+1;u<=r+o;u++)s=n[u].End-n[u].Start,n[u].Start=n[u-1].End+e,n[u].End=n[u].Start+s;o=0}l=n[f+1].End-n[f+1].Start+e;h=n[f+1].Start+l;a=n[f+1].Start;r=f+1}},getTooltipOptions:function(n,t){var r,u,e,o,f,i;return this.model.theme.indexOf("gradient")>=0?(r=jQuery.type(n)=="array"?n[0].color:n,u="white",f="#333333",e=5,o=5):(i=t.type.toLowerCase(),i.indexOf("column")==-1&&i.indexOf("waterfall")==-1&&i.indexOf("bar")==-1&&i.indexOf("box")==-1&&i!="rangearea"&&this.model.AreaType!="none"?(u=jQuery.type(n)=="array"?n[0].color:n,r="transparent",f="white"):(r="#333333",u="white",f="#333333"),e=0,o=0),{rectBColor:r,rectFColor:u,rectTextColor:f,rectX:e,rectY:o}},getSeriesColor:function(n,t,i){return!i||i.isIndicator||i.isTrendLine?i.fill:n._hiloFill?n._hiloFill._gradientStop?n._hiloFill._gradientStop[0].color:n._hiloFill:n.fill?n.fill._gradientStop?n.fill._gradientStop[0].color:n.fill:i.type.toLowerCase()=="waterfall"&&i.positiveFill&&(n.y>0&&!n.showIntermediateSum&&!n.showTotalSum||n.waterfallSum>0)?i.positiveFill:this.model.seriesColors[t]},getFormat:function(n,t){if(!n.tooltip.format){var i=n.type.toLowerCase(),r=n.type!="boxandwhisker"?"null":t.outlier;return i.indexOf("range")>-1||i.indexOf("hilo")>-1&&i.indexOf("open")==-1?"#point.x# <br/> High : #point.high# <br/> Low : #point.low#":i.indexOf("candle")>-1||i.indexOf("open")>-1?"#point.x# <br/> High : #point.high# <br/> Low : #point.low# <br/> Open : #point.open# <br/> Close : #point.close#":i.indexOf("bubble")>-1?"#point.x# : #point.y# : #point.size#":i.indexOf("box")>-1&&r?"X : #boxPlotPoints.xValue# Y : #boxPlotPoints.YValues#":i.indexOf("box")>-1?"Minimum : #boxPlotPoints.Minimum# <br/> Upper Quartile : #boxPlotPoints.UpperQuartile# <br/> Median : #boxPlotPoints.midvalue# <br/> Lower Quartile : #boxPlotPoints.LowerQuartile# <br/> Maximum : #boxPlotPoints.Maximum# ":"#point.x# : #point.y#"}return n.tooltip.format},getTooltipFormat:function(n,t,i,r,u,f){var e=$.extend(!0,{},n),d=this.model.AreaType,h=this.model.locale,rt=t.xAxis,et=t.yAxis,b=rt._valueType.toLowerCase(),ut=ej.util.isNullOrUndefined,c=rt.labelFormat,o=et.labelFormat,g=ej.EjSvgRender.utils._dateTimeLabelFormat,st=ej.EjSvgRender.utils._decimalPlaces,y=!1,a=!1,l,w,v,nt,ft,ot,tt=6,it=20,p,s,k;for(t.count=1,e.count=1,u=this.getFormat(t,f);u.indexOf("ej.format(")>=0;)substr=u.substring(u.indexOf("ej.format("),u.indexOf(")")+1),p=substr.substring(substr.indexOf("(")+1,substr.indexOf(",")),p=="#point.x#"?(y=!0,l=substr.substring(substr.indexOf(",")+1,substr.indexOf(")"))):p=="#point.y#"?(a=!0,w=substr.substring(substr.indexOf(",")+1,substr.indexOf(")"))):(globalizeformat=substr.substring(substr.indexOf(",")+1,substr.indexOf(")")),subStr1=p.substring(p.indexOf("#")+1),val=subStr1.substring(subStr1.indexOf(".")+1,subStr1.indexOf("#")),e.hasOwnProperty(val)&&e[val]&&(e[val]=ej.format(e[val],globalizeformat,h))),u=u.replace(substr,p);if(d=="cartesianaxes"?b.toLowerCase()=="datetime"?(e.x=ej.format(new Date(e.xValue),ut(c)?g(t.xAxis._intervalType):t.xAxis.labelFormat,h),e.x=y?ej.format(new Date(e.xValue),l,h):e.x):b.toLowerCase()=="datetimecategory"?(t.xAxis.intervalType=ej.util.isNullOrUndefined(t.xAxis.intervalType)||t.xAxis.intervalType=="auto"?"years":t.xAxis.intervalType,e.x=ej.format(new Date(e.x),ut(c)?g(t.xAxis.intervalType):t.xAxis.labelFormat,h),e.x=y?ej.format(new Date(e.x),l,h):e.x):b.toLowerCase()=="category"?e.x=this.model.primaryXAxis.isIndexed?e.x?e.x:"undefined":ej.EjSvgRender.utils._getLabelContent(e.xValue,t.xAxis,h):(e.x=y&&(l.indexOf("e")==0||l.indexOf("E")==0)?this.convertExponential(ft,tt,it,e.x,l):y?ej.format(e.x,l,h):e.x,v=c?c.match("{value}"):null,e.x=c?v!=null?c=="${value}"?c.replace("{value}","$"+e.x):c.replace("{value}",e.x):y||c.indexOf("e")==0||c.indexOf("E")==0?e.x:ej.format(Number(e.x),c,h):e.x):b=="date"&&(e.x=ej.format(new Date(e.xValue),g("days"),h),e.x=y?ej.format(new Date(e.xValue),l,h):e.x),a&&(w.indexOf("e")==0||w.indexOf("E")==0)?e.y=this.convertExponential(ot,tt,it,e.y,w):(e.y=e.waterfallSum?e.waterfallSum:e.y,e.y=a?ej.format(e.y,w,h):e.y),v=o?o.match("{value}"):null,e.y=o?v!=null?o=="${value}"?o.replace("{value}","$"+e.y):o.replace("{value}",e.y):a||o.indexOf("e")==0||o.indexOf("E")==0?e.y:ej.format(Number(e.y),o,h):e.y,(d=="none"||d=="polaraxes")&&y&&(l.indexOf("e")==0||l.indexOf("E")==0)&&(e.x=this.convertExponential(ft,tt,it,e.x,l)),t.type.toLowerCase()=="boxandwhisker"){if(s=t._visiblePoints[r].boxPlotValues,f.outlier==!0)for(k=0;k<s.outliers.length;k++)f.YValues==s.outliers[k]&&(f.YValues=o?v!=null?o=="${value}"?o.replace("{value}","$"+f.YValues):o.replace("{value}",f.YValues):a||o.indexOf("e")==0||o.indexOf("E")==0?f.YValues:ej.format(Number(f.YValues),o,h):f.YValues);else f.YValues==s.Minimum?s.Minimum=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.Minimum):o.replace("{value}",s.Minimum):a||o.indexOf("e")==0||o.indexOf("E")==0?s.Minimum:ej.format(Number(s.Minimum),o,h):s.Minimum:f.YValues==s.Maximum?s.Maximum=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.Maximum):o.replace("{value}",s.Maximum):a||o.indexOf("e")==0||o.indexOf("E")==0?s.Maximum:ej.format(Number(s.Maximum),o,h):s.Maximum:f.YValues==s.UpperQuartile?s.UpperQuartile=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.UpperQuartile):o.replace("{value}",s.UpperQuartile):a||o.indexOf("e")==0||o.indexOf("E")==0?s.UpperQuartile:ej.format(Number(s.UpperQuartile),o,h):s.UpperQuartile:f.YValues==s.LowerQuartile?s.LowerQuartile=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.LowerQuartile):o.replace("{value}",s.LowerQuartile):a||o.indexOf("e")==0||o.indexOf("E")==0?s.LowerQuartile:ej.format(Number(s.LowerQuartile),o,h):s.LowerQuartile:f.YValues==s.midvalue&&(s.midvalue=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.midvalue):o.replace("{value}",s.midvalue):a||o.indexOf("e")==0||o.indexOf("E")==0?s.midvalue:ej.format(Number(s.midvalue),o,h):s.midvalue);s.count=t.count;s.xValue=e.x;s.YValues=f.YValues;nt={boxPlotPoints:s}}else nt={series:t,point:e};return u=u.parseTemplate(nt),{data:e,text:u}},convertExponential:function(n,t,i,r,u){return n=u.match(/(\d+)/g),n=n==null?t:n>i?i:n,r.toExponential(n)},displayShowTooltip:function(n,t,i,r){var rt=this.model.requireInvertedAxes,tt,a,at,vt,f,d,o,ot,g,w,st,pt,wt,bt;if(t.visible){$(".ejTooltip"+this._id).not("#"+this.svgObject.id+"_TrackToolTip").remove();$.finish?$(".ejTooltip"+this._id).finish():$(".ejTooltip"+this._id).stop(!0,!0);var ht,ut,b=!i.isIndicator&&!i.isTrendLine?$.inArray(i,this.model._visibleSeries):0,nt,ft,v=7,ct=15,e,h,y,et=i.tooltip.format,l=document.getElementById(this.svgObject.id).getClientRects()[0],lt=this.model.m_AreaBounds,u=i.type.toLowerCase();switch(this.model.AreaType){case"cartesianaxes":e=n.X+(!i.isIndicator&&!i.isTrendLine?ej.util.isNullOrUndefined(i._trackMarker)?u=="bubble"?t.radius+ct:i.marker.size.width:i._trackMarker.size.width:0)+(u=="column"||u=="bar"||u=="stackingbar"||u=="stackingcolumn"||u=="waterfall"||u=="rangecolumn"?lt.X:rt?i.yAxis.x:i.xAxis.x);h=n.Y+(u.indexOf("column")!=-1||u.indexOf("waterfall")!=-1||u.indexOf("bar")!=-1||u.indexOf("rangearea")!=-1||u=="scatter"||u=="bubble"?this.dragPoint?rt?i.xAxis.y:i.yAxis.y:lt.Y:rt?i.xAxis.y:i.yAxis.y);this.dragPoint&&(e=e>i.xAxis.x?e:i.xAxis.x,h=h<i.yAxis.height+i.yAxis.y?h:i.yAxis.height+i.yAxis.y);nt=this.getSeriesColor(t,b,i);break;case"polaraxes":e=n.X+v+(ej.util.isNullOrUndefined(i._trackMarker)?i.marker.size.width:i._trackMarker.size.width);h=n.Y;nt=this.getSeriesColor(t,b,i);break;case"none":e=n.X+i.marker.size.width+v;h=n.Y;nt=this.model.pointColors[r]}if(i.type.toLowerCase()=="boxandwhisker")for(tt=0;tt<i._visiblePoints[r].boxPlotLocation.length;tt++)a=i._visiblePoints[r].boxPlotLocation[tt],at=a.outlier,at?a.X+i.outlierSettings.size.width/2>n.X&&a.X-i.outlierSettings.size.width/2<n.X&&a.Y+i.outlierSettings.size.height/2>n.Y&&a.Y-i.outlierSettings.size.height/2<n.Y&&(y=this.getTooltipFormat(t,i,b,r,et,a),ft=ej.EjSvgRender.utils._measureText(y.text)):(y=this.getTooltipFormat(t,i,b,r,et,a),ft=ej.EjSvgRender.utils._measureText(y.text));else y=this.getTooltipFormat(t,i,b,r,et),ft=ej.EjSvgRender.utils._measureText(y.text);var k=this.getTooltipOptions(nt,i),kt=k.rectBColor,dt=k.rectFColor,gt=k.rectTextColor,ni=k.rectX,ti=k.rectY,f=i.tooltip,p,v=5;if(p=document.getElementById(this.svgObject.id+"_TrackToolTip")==null?$("<div><\/div>").attr({id:this.svgObject.id+"_TrackToolTip","class":"ejTooltip"+this._id}):$("#"+this.svgObject.id+"_TrackToolTip"),vt=!!navigator.userAgent.match(/Trident\/7\./),!ej.isTouchDevice()||vt||this.vmlRendering?this._on(p,"mousemove",this.chartTooltipHover):window.navigator.msPointerEnabled?this._on(p,"MSPointerMove",this.chartTooltipHover):this._on(p,"touchmove",this.chartTooltipHover),$("#"+this.svgObject.id+"_TrackToolTip").show(),ut||(ut=$("#"+this._id)[0].offsetParent.style.zIndex),f={top:h+$(document).scrollTop(),left:e+$(document).scrollLeft(),"background-color":f.fill?f.fill:dt,"border-style":"solid",position:"absolute","border-color":f.border.color?f.border.color:kt,"border-width":f.border.width||f.border.width==0?f.border.width:1,opacity:f.opacity,"z-index":ut+1e6,"border-radius":(f.rx?f.rx:ni).toString()+"px "+(f.ry?f.ry:ti).toString()+"px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"},$(p).css(f),d=$.extend({},ej.EjSvgRender.commonChartEventArgs),d.data={seriesIndex:b,pointIndex:r,currentText:y.text,isTrendLine:i.isTrendLine,trendlineIndex:i.trendlineIndex},this._trigger("toolTipInitialize",d),!d.cancel){var ii=0,it=i.tooltip,c=it.font?$.extend(!1,i.font,{},it.font):i.font,ri={top:h+$(document).scrollTop(),left:e+$(document).scrollLeft(),color:it.font&&it.font.color?c.color:gt,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,"align-self":"baseline"};for($(p).css(ri),document.getElementById(this.svgObject.id+"_TrackToolTip")==null&&$(document.body).append(p[0]),o=ht=d.data.currentText,$("#"+this.svgObject.id+"_TrackToolTip").html(o),ot=0,g=0,o=o.replace(/<br >/g,"<br/>").replace(/<br \/>/g,"<br/>").replace(/<br>/g,"<br/>"),o=o.split("<br/>"),w=0;w<o.length;w++)o[w]=o[w],ot+=ej.EjSvgRender.utils._measureText(o[w],null,c).height,st=ej.EjSvgRender.utils._measureText(o[w],null,c).width,g<st&&(g=st);ii=this.model.AreaType=="cartesianaxes"?ej.EjSvgRender.utils._measureText(ht,i.xAxis.width,c).height:ej.EjSvgRender.utils._measureText(o,null,c).height;var ui=this.model.AreaType=="cartesianaxes"?this.model.requireInvertedAxes?i.yAxis.width:i.xAxis.width:$(this.svgObject).width()-(this.model.legend.position.toLowerCase()=="right"?this.model.LegendViewerBounds.Width+2*this.model.elementSpacing:0),yt=this.model.AreaType=="cartesianaxes"?this.model.requireInvertedAxes?i.xAxis.height:i.yAxis.height:$(this.svgObject).height()-(this.model.legend.position.toLowerCase()=="bottom"?this.model.LegendViewerBounds.Height+this.model.elementSpacing:0),s=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect();$("#"+this.svgObject.id+"_TrackToolTip").css("top",$(document).scrollTop()+s.top+l.top-(ot+4)/2);$("#"+this.svgObject.id+"_TrackToolTip").css("left",$(document).scrollLeft()+s.left+l.left+(s.left-e));e+(g+v)>=ui+i.xAxis.x&&(pt=document.getElementById(this.svgObject.id).getClientRects()[0],wt=e-(g+v*2+(!i.isIndicator&&!i.isTrendLine?ej.util.isNullOrUndefined(i._trackMarker)?i.marker.visible?i.marker.size.width:u=="bubble"?t.radius+ct:0:i._trackMarker.size.width:0)+2*v),$("#"+this.svgObject.id+"_TrackToolTip").css("left",wt+pt.left-v+$(document).scrollLeft()));s=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect();(s.bottom>=i.yAxis.y+yt+l.top||s.bottom>=i.xAxis.y+yt+l.top)&&(bt=h-(s.bottom-s.top+(!i.isIndicator&&!i.isTrendLine?ej.util.isNullOrUndefined(i._trackMarker)?i.marker.visible?i.marker.size.height:0:i._trackMarker.size.height:0))+v+l.top,$("#"+this.svgObject.id+"_TrackToolTip").css("top",bt+$(document).scrollTop()));s=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect();s.left<0&&$("#"+this.svgObject.id+"_TrackToolTip").css("left",e);(s.top<l.top||s.top<0)&&$("#"+this.svgObject.id+"_TrackToolTip").css("top",(l.top<0?$(document).scrollTop():l.top)+"px");$("#"+this.svgObject.id+"_TrackToolTip").show()}}},chartTooltipHover:function(n){var t=$("#"+n.target.id)[0].getBoundingClientRect(),u=n.clientX-t.left,i=5,r;$("#"+n.target.id).css("left",t.left+u+i);t=$("#"+n.target.id)[0].getBoundingClientRect();r=document.getElementById(this.svgObject.id).getClientRects()[0];t.right>r.right+i&&$("#"+n.target.id).css("left",n.clientX-(t.right-t.left)-i)},_initializeSeriesColors:function(){var n=this,l=n.model.palette?n.model.palette:n.model.colors,y=l.length,e=n.model.AreaType,o,r,u,i,a,s,p,v,c,h,f,t;if(n.model.seriesColors=[],n.model.seriesBorderColors=[],n.model.pointColors=[],n.model.pointBorderColors=[],s=n.model._visibleSeries.length,p=n.model._visibleSeries,e!="none")o=n.model._visibleSeries,r=n.model.seriesColors,u=n.model.seriesBorderColors;else{for(h=0,t=0;t<s;t++)c=n.model._visibleSeries[t].type.toLowerCase(),n.model._visibleSeries[t].points.length>h?(h=n.model._visibleSeries[t].points.length,v=n.model._visibleSeries[t].points):n.model._visibleSeries[t].points.length==h&&c!="funnel"&&c!="pieofpie"&&c!="pyramid"&&(v=n.model._visibleSeries[t].points);o=v;r=n.model.pointColors;u=n.model.pointBorderColors}if(e=="none"&&s>1)for(f=0;f<s;f++)n.model.seriesColors[f]=l[f%y];for(t=0;t<o.length;t++)i=o[t],a=i.trendlines,i.isFill=i.isFill==undefined?i.fill&&i.fill!=""?!0:!1:i.isFill,i.isFill?r[t]=i.fill:(r[t]=l[t%y],i._hiloTypes||(i.fill=r[t])),e!="none"&&a.length>0&&this._initializeTrendlinesColors(a,r[t]),ej.util.isNullOrUndefined(i.border)||ej.util.isNullOrUndefined(i.border.color)||i.border.color==""?(u[t]=n.model.seriesBorderDefaultColors[t%10],e!="none"&&(i.border.color=u[t])):u[t]=i.border.color,i.dataPoint=i.points},_initializeTrendlinesColors:function(n,t){for(var i in n)(ej.util.isNullOrUndefined(n[i].fill)||n[i].fill=="")&&(n[i].fill=t)},_createAxisLabelAndRange:function(){for(var u,v,f,y=0,t=this.model,i=t.series,c=i.length,l,a,r,n,s=t.primaryXAxis,e=t.primaryYAxis,p,o=0;o<c;o++)a=i[o],a._isTransposed&&y++;for(c&&(y==c?t.requireInvertedAxes=!0:(a=i[0],a._isTransposed&&(t.requireInvertedAxes=!0))),t.requireInvertedAxes?(e.orientation="horizontal",s.orientation="vertical",e.labelPlacement=e.labelPlacement?e.labelPlacement:ej.datavisualization.Chart.LabelPlacement.OnTicks):(e.orientation="vertical",s.orientation="horizontal"),e.name=ej.util.isNullOrUndefined(e.name)?"SecondaryAxis":e.name,s.name=ej.util.isNullOrUndefined(s.name)?"PrimaryAxis":s.name,t._axes=[],t._axes[0]=s,t._axes[1]=e,p=t.axes.length,l=t.indicators,o=0;o<p;o++)if(n=t.axes[o],n.name){for(u=0;u<c;u++)if(v=i[u].type.toLowerCase(),i[u].xAxisName==n.name){n.orientation=v.indexOf("bar")!=-1?i[u].isTransposed?"horizontal":"vertical":i[u].isTransposed?"vertical":"horizontal";break}else if(i[u].yAxisName==n.name){n.orientation=v.indexOf("bar")!=-1?i[u].isTransposed?"vertical":"horizontal":i[u].isTransposed?"horizontal":"vertical";break}for(f=0;f<l.length;f++)if(l[f].xAxisName==n.name){n.orientation="horizontal";break}else if(l[f].yAxisName==n.name){n.orientation="vertical";break}if(!n.orientation)continue;t.axes[o]=n.orientation.toLowerCase()=="horizontal"?$.extend(!0,{},t.secondaryX,n):$.extend(!0,{},t.secondaryY,n);t._axes.push(t.axes[o])}for(f=0;f<t._axes.length;f++){var n=this.model._axes[f],h=n.scrollbarSettings,r=h.range,w=n.orientation.toLowerCase();n.visibleLabels=[];n.range=n.range.min==null&&n.range.max==null&&n.range.interval==null?null:n.range;n.setRange=n.range?ej.util.isNullOrUndefined(n.setRange)?!0:n.setRange:!1;n.setRange=n.actual_Range||n.setRange!=!1?!0:!1;n.actualRange=n.actualRange?n.actualRange:n.range==null?{}:$.extend(!0,{},n.range);n.visibleRange=n.visibleRange?n.visibleRange:n.range==null?{}:n.range;n.name=n.name?n.name:f.toString();n._isScroll=h.visible&&(h.pointsLength!=null||r.min!=null||r.max!=null)||t.zooming.enableScrollbar&&h.visible&&(n.zoomFactor<1||n.zoomPosition>0);n._pointsLength=h.pointsLength;typeof r.min=="string"&&r.min.indexOf("/Date(")!=-1&&(r.min=new Date(parseInt(r.min.substr(6))));typeof r.max=="string"&&r.max.indexOf("/Date(")!=-1&&(r.max=new Date(parseInt(r.max.substr(6))))}},_drawTitle:function(){var n=this.model.title,t=this.model.margin,h=$(this.svgObject).width(),i=ej.EjSvgRender.utils._measureText(n.text,h-t.left-t.right,n.font),u=this.model.elementSpacing,tt=n.text==""||!n.visible?0:i.height+u,t=t,it=this.model.m_AreaBounds,rt=this.model.AreaType,ut=this.model.legend.position.toLowerCase()=="left"?this.model.LegendViewerBounds.Width/2:this.model.legend.position.toLowerCase()=="right"?-this.model.LegendViewerBounds.Width/2:0,b=t.left+u+this.model.border.width,k=t.right+u+this.model.border.width,e=this.model.titleWrapTextCollection,d,ft=parseInt(n.font.size),l=parseInt(n.font.size)*1.2,g=n.enableTrim,f=n.maximumWidth,et=n.textAlignment.toLowerCase(),a=n.textOverflow.toLowerCase(),v=n.text,y=g&&(a=="wrap"||a=="wrapandtrim")&&e.length>1?!0:!1,c,p,w,r,o,nt,s;if(f.toString()=="auto"||f.toString()==""?(f=it.Width*.75,this.model.titleMaxWidth=f):f=parseInt(f),c=i.width>f?!0:!1,g&&c&&a=="trim"&&(v=ej.EjSvgRender.utils._trimText(v,f,n.font),this.model.titleTrim=i=ej.EjSvgRender.utils._measureText(v,h-t.left-t.right,n.font),this.model.trimTooltip=!0),this.model.trimTooltip&&a=="wrap"&&(this.model.trimTooltip=!1),p={width:this.model.trimTooltip&&y||e.length>1?this.model.titleMaxWidth:i.width,height:i.height*(e.length>0?e.length-1:1)},n.text!=""&&n.text!=null){if(d=n.border.color=="transparent"&&n.background=="transparent"?t.top+tt/2+u:t.top+l/2+u+ft/4,w=(rt!="cartesianaxes"?(h-t.left-t.right)/2+(t.left+ut):b+(h-k)/2)-p.width/2,this.model.title.textAlignment.toLowerCase()=="near"?w=b:this.model.title.textAlignment.toLowerCase()=="far"&&(w=h-k-p.width),r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={title:v,location:{x:w,y:d},size:i},this._trigger("titleRendering",r),o={id:this.svgObject.id+"_ChartTitleText",x:r.data.location.x,y:r.data.location.y,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,"text-anchor":"start"},nt={id:this.svgObject.id+"_ChartTitleBorder",x:r.data.location.x-u,y:r.data.location.y-l+l/4,rx:n.border.cornerRadius,ry:n.border.cornerRadius,width:y&&c?this.model.titleMaxWidth+2*u:i.width+2*u,height:y&&c?i.height*e.length:l,fill:n.background,"stroke-width":n.border.width,stroke:n.border.color,opacity:n.border.opacity,"class":"e-titleborder"},this.svgRenderer.drawRect(nt,this.gTitleEle),y&&c)for(s=0;s<e.length;s++)o.id=this.svgObject.id+"_ChartTitleText_"+s,s!=0&&(o.y=o.y+i.height),this.svgRenderer.drawText(o,e[s],this.gTitleEle);else this.svgRenderer.drawText(o,r.data.title,this.gTitleEle);this.model._titleLocation={X:r.data.location.x,Y:r.data.location.y,size:p,_height:i.height};this.svgRenderer.append(this.gTitleEle,this.svgObject);n.subTitle.text!=""&&n.subTitle.text&&n.subTitle.visible&&this._drawSubTitle()}},_getLegendSize:function(n){var r=this.model.legend,t=r.itemStyle,i=ej.EjSvgRender.utils._measureText(n.Text,null,n.Font),u=t.width+10+i.width,f=Math.max(t.height,i.height);return{Width:u,Height:f}},_getYValues:function(n){for(var i=[],r=n.length,t=0;t<r;t++)i.push(n[t].y);return i},_getXValues:function(n){for(var i=[],r=n.length,t=0;t<r;t++)i.push(n[t].xValue);return i},_drawSubTitle:function(){var t=this.model.title,n=t.subTitle,d=$(this.svgObject).width(),a=ej.EjSvgRender.utils._measureText(t.text,d-this.model.margin.left-this.model.margin.right,t.font),i=ej.EjSvgRender.utils._measureText(n.text,d-this.model.margin.left-this.model.margin.right,n.font),e="middle",tt,it=1.2,r=this.model.elementSpacing,lt=parseInt(n.font.size),rt=this.model.m_AreaBounds.Width,at=parseInt(t.font.size)*it,s=parseInt(n.font.size)*it,vt=n.text==""||!n.visible?0:i.height+r,ut=n.enableTrim,f=n.maximumWidth,o=t.maximumWidth,g=n.textOverflow.toLowerCase(),bt=t.textAlignment.toLowerCase(),ft=n.textAlignment.toLowerCase(),w=t.text,et=t.enableTrim,nt=t.textOverflow.toLowerCase(),h=n.text,b,yt=et&&(nt=="wrap"||nt=="wrapandtrim")?!0:!1,ot,v=ut&&(g=="wrap"||g=="wrapandtrim")?!0:!1,pt,c,u,ct,l,k;if(o=o.toString()=="auto"||o.toString()==""?rt*.75:parseInt(o),f=f.toString()=="auto"||f.toString()==""?rt*.75:parseInt(f),a=ej.EjSvgRender.utils._measureText(t.text,d-this.model.margin.left-this.model.margin.right,t.font),pt=a.width>o?!0:!1,ut&&i.width>f&&g=="trim"&&(w=et&&nt=="trim"?ej.EjSvgRender.utils._trimText(w,o,t.font):w,h=ej.EjSvgRender.utils._trimText(h,f,n.font),a=ej.EjSvgRender.utils._measureText(w,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,t.font),i=ej.EjSvgRender.utils._measureText(h,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,n.font),this.model.subTitleTooltip=!0),ot=a.width>o,h!=""&&h!=null){tt=this.model.title.border.color=="transparent"&&this.model.title.background=="transparent"||this.model.title.subTitle.border.color=="transparent"&&this.model.title.subTitle.background=="transparent"?vt/2+r+this.model._titleLocation.Y+this.model._titleLocation._height*(this.model.titleWrapTextCollection?this.model.titleWrapTextCollection.length-1:0):s/2+10+r+(yt&&ot?a.height*this.model.titleWrapTextCollection.length:at)+10+lt/3;c=this.model._titleLocation.X+this.model._titleLocation.size.width/2;ft=="near"?(c=b=this.model._titleLocation.X,e="start"):ft=="far"&&(c=this.model._titleLocation.X+this.model._titleLocation.size.width,e="end");u=$.extend({},ej.EjSvgRender.commonChartEventArgs);u.data={subTitle:h,location:{x:c,y:tt},size:i};this._trigger("subTitleRendering",u);var wt=t.border.color=="transparent"&&t.background=="transparent"||t.subTitle.border.color=="transparent"&&t.subTitle.background=="transparent"?u.data.location.y:u.data.location.y-r/2,y={id:this.svgObject.id+"_ChartSubTitleText",x:u.data.location.x,y:wt,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,"text-anchor":e},st,ht,p=u.data.location.x;if(st=e=="start"?p-r:e=="end"?v?p-r-this.model.subTitleMaxWidth:p-r-i.width:v?p-r-this.model.subTitleMaxWidth/2:p-r-i.width/2,ht=t.border.color=="transparent"&&t.background=="transparent"||n.border.color=="transparent"&&n.background=="transparent"?u.data.location.y-s+s/4:u.data.location.y-s+s/4-r/2,ct={id:this.svgObject.id+"_ChartSubTitleBorder",x:st,y:ht,rx:n.border.cornerRadius,ry:n.border.cornerRadius,width:v?this.model.subTitleMaxWidth+2*r:i.width+2*r,height:v?i.height*this.model.subTitleWrapTextCollection.length:s,fill:n.background,"stroke-width":n.border.width,stroke:n.border.color,opacity:n.border.opacity,"class":"e-subtitleborder"},this.svgRenderer.drawRect(ct,this.gSubTitleEle),v&&i.width>f)for(l=0;l<this.model.subTitleWrapTextCollection.length;l++)y.id=this.svgObject.id+"_ChartSubTitleText_"+l,l!=0&&(y.y=y.y+i.height),this.svgRenderer.drawText(y,this.model.subTitleWrapTextCollection[l],this.gSubTitleEle);else this.svgRenderer.drawText(y,u.data.subTitle,this.gSubTitleEle);k={width:this.model.subTitleTooltip?f:i.width,height:i.height*this.model.subTitleWrapTextCollection.length};e=="middle"?b=c-k.width/2:e=="end"&&(b=c-k.width);this.model._subTitleLocation={X:b,Y:u.data.location.y-i.height/2,size:k};this.svgRenderer.append(this.gSubTitleEle,this.gTitleEle)}},_calculateStackingValues:function(n,t,i){var y=this.model,h,p,s,r;y.stackedValue[t.name]=[];h=y.stackedValue[t.name];h.min=0;h.max=0;var k=y.requireInvertedAxes?y.vAxes:y.hAxes,it=k.length,g,nt,u,rt=n.length,d,o,l,f,c,a,b=ej.util.isNullOrUndefined;for(p=0;p<it;p++){r=0;var o=[],l=[],v=[],w=[],e=0;for(s=0;s<n.length;s++)if(n[s]._xAxisName==k[p].name&&(n[s].type.toLowerCase().indexOf("stacking")!=-1||n[s].isStacking)){for(f={},f.StartValues=[],f.EndValues=[],u=n[s].stackingGroup,u&&n[s].type.toLowerCase()!="stackingarea"?b(o[u])&&(o[u]=[],l[u]=[],v[u]=[],w[u]=[]):(u="",b(o[u])&&(o[u]=[],l[u]=[],v[u]=[],w[u]=[])),series=n[s],e=this._getXCrossValue(series,k[p],i),typeof e!="number"&&(e=0),d=ej.EjSeriesRender.prototype._isVisiblePoints(series),nt=this._getYValues(series._visiblePoints),g=d.length,r=0;r<g;r++){var c=0,tt=0,a=nt[r];b(o[u][series._visiblePoints[r].xValue])&&(o[u][series._visiblePoints[r].xValue]=e);b(l[u][series._visiblePoints[r].xValue])&&(l[u][series._visiblePoints[r].xValue]=e);f.StartValues.length<=r&&(f.StartValues.push(0),f.EndValues.push(0));a>=0?(v[u][r]=v[u][r]==null,a-=v[u][r]&&e,c=o[u][series._visiblePoints[r].xValue],o[u][series._visiblePoints[r].xValue]+=a,tt=c<e?e-c:0,f.StartValues[r]=c+tt,f.EndValues[r]=a+c):(w[u][r]=w[u][r]==null,a-=w[u][r]&&e,c=l[u][series._visiblePoints[r].xValue],l[u][series._visiblePoints[r].xValue]+=a,f.StartValues[r]=c,f.EndValues[r]=a+c,e<f.EndValues[r]&&(l[u][series._visiblePoints[r].xValue]=f.StartValues[r],o[u][series._visiblePoints[r].xValue]=f.EndValues[r],v[u][r]=v[u][r]==null));visiblePointIndex=d[r].actualIndex;series.points[visiblePointIndex].YValues=[f.EndValues[r]]}f.stackedSeries=!0;h.push(f);h.min>Math.min.apply(0,f.StartValues)&&(h.min=Math.min.apply(0,f.StartValues));h.max<Math.max.apply(0,f.EndValues)&&(h.max=Math.max.apply(0,f.EndValues));series.stackedValue=f}}},_calculateStackingCumulativeValues:function(n,t,i){var c,ot,ft,f,k,e,v,b,u,d,g,s,nt,tt;this.model.stackedValue[t.name]=[];this.model.stackedValue[t.name].min=0;this.model.stackedValue[t.name].max=0;var w=this.model.requireInvertedAxes?this.model.vAxes:this.model.hAxes,rt=n.length,et=w.length,it;for(c=0;c<et;c++){var h=[],l=[],a=[],r=" ",y=[],p=[],o=0,ut=[];for(f=0;f<rt;f++)if(ot=ej.EjSeriesRender.prototype._isVisiblePoints(n[f]),r=n[f].stackingGroup,n[f].type.toLowerCase().indexOf("100")!=-1&&n[f]._xAxisName==w[c].name)for(n[f].stackingGroup&&n[f].type.toLowerCase()!=" stackingarea100 "?h[r]||(a[r]=[],h[r]=[],l[r]=[],y[r]=[],p[r]=[]):(n[f].stackingGroup="",r=n[f].stackingGroup,h[r]||(a[r]=[],h[r]=[],l[r]=[],y[r]=[],p[r]=[])),ut[r]=f,v=this._getYValues(n[f]._visiblePoints),b=v.length,u=0;u<b;u++)ft=v[u],a[r][n[f].points[u].xValue]||(a[r][n[f].points[u].xValue]=0),a[r][n[f].points[u].xValue]+=Math.abs(ft);for(f=0;f<rt;f++)if(r=n[f].stackingGroup,n[f].type.toLowerCase().indexOf("100")!=-1&&(k=!1,n[f]._xAxisName==w[c].name)){for(e={},e.StartValues=[],e.EndValues=[],series=n[f],o=this._getXCrossValue(series,w[c],i),typeof o!="number"&&(o=0),v=this._getYValues(series._visiblePoints),b=v.length,u=0;u<b;u++)g=0,s=v[u],it=s/a[r][series.points[u].xValue]*100,s=isNaN(it)?0:it,series.points[u].percentage=s.toFixed(2),h[r][series.points[u].xValue]||(h[r][series.points[u].xValue]=o),l[r][series.points[u].xValue]||(l[r][series.points[u].xValue]=o),e.StartValues.length<=u&&(e.StartValues.push(0),e.EndValues.push(0)),s>=0?(nt=h[r][series.points[u].xValue],y[r][u]=y[r][u]==null,s-=y[r][u]&&o,g=nt<o?o-nt:0,d=nt,h[r][series.points[u].xValue]+=s):(tt=l[r][series.points[u].xValue],p[r][u]=p[r][u]==null,s-=p[r][u]&&o,g=tt>o?o-tt:0,d=tt,l[r][series.points[u].xValue]+=s),e.StartValues[u]=d+g,e.EndValues[u]=d+s,e.EndValues[u]>100&&(e.EndValues[u]=100),series.points[u].YValues=[e.EndValues[u]],k=ut[r]==f?!1||k:!0;e.stackedSeries=k;this.model.stackedValue[t.name].push(e);this.model.stackedValue[t.name].min>Math.min.apply(0,e.StartValues)&&(this.model.stackedValue[t.name].min=Math.min.apply(0,e.StartValues));this.model.stackedValue[t.name].max<Math.max.apply(0,e.EndValues)&&(this.model.stackedValue[t.name].max=Math.max.apply(0,e.EndValues));this.model.stackedValue[t.name].min>Math.min.apply(0,e.EndValues)&&(this.model.stackedValue[t.name].min=-100);series.stackedValue=e}}},_legendItemBounds:function(n,t,i){var r=this.model.legend,s,h=r.position.toLowerCase(),c=r.itemPadding,u,e,o=0,f=0;return ej.util.isNullOrUndefined(r.columnCount)&&r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):ej.util.isNullOrUndefined(r.rowCount)&&r.columnCount?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):r.rowCount&&r.columnCount&&(r.columnCount<r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):r.columnCount>r.rowCount?h==="top"||h==="bottom"||h==="custom"?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):(u=Math.ceil(n/r.columnCount),e=Math.ceil(n/u),o=t*e,f=i*u):h==="top"||h==="bottom"||h==="custom"?(u=Math.ceil(n/r.columnCount),s=Math.ceil(n/r.rowCount),o=t*r.columnCount,f=i*s):(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u)),f+=this.model.elementSpacing,{LegendWidth:o,LegendHeight:f}},_isEjScroller:function(){var n=this,i=n.model,r=$(n.legendContainer),t=i.legend;t._ejScroller=ej.util.isNullOrUndefined($("#"+r[0].id).ejScroller)?!1:t.enableScrollbar},_rowsCalculation:function(n,t,i){for(var v=this,y=v.model,w=y.legend,r,o=[],f,l,p=n.legendItem?n.legendItem.Text.toString():n.text,s=p.split(" "),h=t,c=n.legendItem?n.legendItem.LegendStyle.Font:n.font,a=s.length,e=0,u=0;u<a;u++)if(r=s[u],f=ej.EjSvgRender.utils._measureText(r,null,c).width,f<=h){while(u<a)if(f=ej.EjSvgRender.utils._measureText(r,null,c).width,l=s[u+1]?ej.EjSvgRender.utils._measureText(s[u+1],null,c).width:0,f+l<=h&&l>0)r=r.concat(" "+s[u+1]),u++;else{e=Math.max(e,f);break}o.push(r)}else i=="wrapandtrim"?(r=ej.EjSvgRender.utils._trimText(r,h,c),o.push(r),this.model._legendMaxWidth=h,e=Math.max(e,h),n.legendItem||(this.model.trimTooltip=!0)):(o.push(r),n.legendItem?this.model._legendMaxWidth=Math.max(this.model._legendMaxWidth,f):e=Math.max(e,f));return this.model._legendMaxHeight=Math.max(this.model._legendMaxHeight,o.length),{textCollection:o,wordMax:e}},_triggerLegendEvent:function(n,t,i){var u=this,e=u.model,r=e.legend,c=e.AreaType,l=r.itemStyle,a=l.border,w=e.elementSpacing,o=r.textWidth,b=ej.EjSvgRender,k=u.svgRenderer,v=e._visibleSeries.length,d=u.svgObject,w=e.elementSpacing,s=r.textOverflow.toLowerCase(),f,h,y,p={BorderColor:a.color,BorderWidth:a.width,Opacity:r.opacity,Color:t,Font:r.font};return commonEventArgs=$.extend({},b.commonChartEventArgs),commonEventArgs.data={svgRenderer:k,svgObject:d,symbolShape:r.shape,legendItem:{Text:n,Shape:r.shape,LegendStyle:p,SeriesIndex:c=="none"&&v==1?0:i},style:{ShapeSize:l,ElementSpace:w,Style:p,ID:u.svgObject.id+"_LegendItemShape"+i,SeriesIndex:c=="none"&&v==1?0:i,context:!0},gLegendItemEle:u.gLegendItemEle},u._trigger("legendItemRendering",commonEventArgs),f=commonEventArgs.data.legendItem.Text,h=commonEventArgs.data.legendItem.LegendStyle.Font,y=ej.EjSvgRender.utils._measureText(f,null,h).width,s=="trim"?y>o&&(f=ej.EjSvgRender.utils._trimText(f,o,h),this.model._legendMaxWidth=o):(s=="wrap"||s=="wrapandtrim")&&(f=this._rowsCalculation(commonEventArgs.data,o,this.model.legend.textOverflow.toLowerCase()).textCollection),{commonEventArgs:commonEventArgs,legendItem:f}},_calculateLegendBounds:function(){var at,i,ut;this.model.legendCollection=[];this.model.legendTextRegion=[];this.model.legendRegion=[];this.model.svgHeight=$(this.svgObject).height();this.model.svgWidth=$(this.svgObject).width();this.model._legendMaxWidth=0;this.model._legendMaxHeight=0;var b=this,n=b.model,ni=Math,h=ni.max,oi=ni.min,ot=ni.abs,t=n.legend,p=10,k=t.size.height,d=t.size.width,u=t.itemPadding>0?t.itemPadding:0,e=t.position.toLowerCase(),c=0,l=0,vt=n.svgHeight,yt=n.svgWidth,g=0,nt=0,f=0,y=0,ti=1,o,si,ii,hi,ci,st={},w=[],li,ri,ft,ui,wi=n.AreaType,et=n._visibleSeries,fi=t.rowCount,tt,ei=t.columnCount,pt=n.elementSpacing,wt,a,bt,ht,ct,kt=ej.EjSvgRender.utils._measureText(t.title.text,null,t.title.font),s,ai,it=0,rt=0,vi=n.border.width,lt=t.border.width,dt,r,v,yi,gt=t.textOverflow.toLowerCase(),pi=vt-(pt*4+vi*2+t.border.width*2),bi=yt-(pt*4+vi*2+lt*2);if(et&&t.visible&&et.length!=0){if(dt=et[0].type.toLowerCase(),wi=="none"&&et.length==1||dt=="pieofpie"||dt=="pyramid"||dt=="funnel")for(a=et[0],wt=ej.EjSeriesRender.prototype._calculateVisiblePoints(a).legendPoints,bt=wt.length,i=0;i<bt;i++)ht=t.fill?t.fill._gradientStop?t.fill._gradientStop:t.fill:n.pointColors[wt[i].actualIndex],tt=wt[i],ct=ej.util.isNullOrUndefined(tt.x)?"series"+i:tt.x,visibleOnLegend=tt.visibleOnLegend?tt.visibleOnLegend:"visible",tt.isEmpty||visibleOnLegend.toLowerCase()!="visible"||a.visibleOnLegend.toLowerCase()!="visible"||(r=this._triggerLegendEvent(ct,ht,i),v=r.commonEventArgs.data.legendItem.LegendStyle,st={Text:r.legendItem,displayText:r.commonEventArgs.data.legendItem.Text,Font:v.Font,SeriesIndex:0,PointIndex:i,ActualIndex:tt.actualIndex,fill:v.Color,visibility:tt.visible?"visible":"hidden",Shape:r.commonEventArgs.data.legendItem.Shape,LegendStyle:v,CommonEventArgs:{cancel:r.commonEventArgs.cancel,data:r.commonEventArgs.data}},w.push(st));else for(bt=et.length,i=0;i<bt;i++)for(ht=t.fill?t.fill._gradientStop?t.fill._gradientStop:t.fill:ej.util.isNullOrUndefined(n.seriesColors[i])?n.pointColors[i]:n.seriesColors[i],a=et[i],ct=a.name?a.name:"series"+i,a.visibleOnLegend.toLowerCase()=="visible"&&(r=this._triggerLegendEvent(ct,ht,i),v=r.commonEventArgs.data.legendItem.LegendStyle,st={Text:r.legendItem,displayText:r.commonEventArgs.data.legendItem.Text,Font:v.Font,SeriesIndex:i,fill:v.Color,visibility:a.visibility,Shape:r.commonEventArgs.data.legendItem.Shape,LegendStyle:v,CommonEventArgs:{cancel:r.commonEventArgs.cancel,data:r.commonEventArgs.data}},w.push(st)),ri=a.trendlines,li=ri.length,at=0;at<li;at++)ft=ri[at],ht=t.fill?t.fill._gradientStop?t.fill._gradientStop:t.fill:ft.fill,ct=ft.name?ft.name:"series"+i,ft.visibility!=""&&ft.visibleOnLegend.toLowerCase()=="visible"&&(r=this._triggerLegendEvent(ct,ht,i),v=r.commonEventArgs.data.legendItem.LegendStyle,st={Text:r.legendItem,displayText:r.commonEventArgs.data.legendItem.Text,Font:v.Font,SeriesIndex:i,trendLineIndex:at,fill:v.Color,isTrendLine:!0,visibility:a.visibility.toLowerCase()=="visible"?ft.visibility:"hidden",Shape:r.commonEventArgs.data.legendItem.Shape,LegendStyle:v,CommonEventArgs:{cancel:r.commonEventArgs.cancel,data:r.commonEventArgs.data}},w.push(st));for(legendSeriesLength=w.length,i=0;i<legendSeriesLength;i++)o=w[i],yi=o.CommonEventArgs.data.style.ShapeSize.width,s=b._getLegendSize(o),g=h(this.model._legendMaxWidth>0?this.model._legendMaxWidth+u+yi:s.Width,g),nt=h(gt=="wrap"||gt=="wrapandtrim"?s.Height*this.model._legendMaxHeight:s.Height,nt);for(y=nt+pt*2,f=g,(ei||fi)&&(legendBounds=b._legendItemBounds(w.length,g+u,nt+u),f=legendBounds.LegendWidth,y=legendBounds.LegendHeight,e==="top"||e==="bottom"||e==="custom"?y=y-u+pt:f=f-u),ut=0;ut<legendSeriesLength;ut++)o=w[ut],si=o.SeriesIndex,a=n.series[si],s=b._getLegendSize(o),(gt=="wrap"||gt=="wrapandtrim")&&(s.Width=g,s.Height=nt),fi||ei||(e=="top"||e=="bottom"||e=="custom"?(c+=s.Width+u,c>bi&&ut!=0?(c-=s.Width+u,f=h(f,c),c=s.Width+u,ti++,y+=nt+u):f=h(f,c),l=h(l,nt)):(l+=s.Height+u,l>pi?(l-=s.Height+u,y=h(y,l),l=s.Height+u,f+=g+u):y=h(y,l),c=h(c,g))),ai=o.visibility.toLowerCase()=="visible"?b.svgRenderer.createGradientElement("legend"+ut,w[ut].fill,0,0,0,pi,b.gLegendEle):"gray",o.CommonEventArgs.data.legendItem.LegendStyle.Color=ai,ii=fi||ei?{Width:g,Height:nt}:s,ii._Width=s.Width,o.isTrendLine&&(o.TrendLineIndex=o.trendLineIndex,ui=a.trendlines[o.trendLineIndex].type.toLowerCase(),o.CommonEventArgs.data.legendItem.drawType=o.drawType=ui=="linear"||ui=="movingaverage"?"line":"spline"),w[ut].Bounds=ii,n.legendCollection.push(o);e==="top"||e==="bottom"||e==="custom"?(f=kt.width>f-u?kt.width+p*2+u:f+p*2,c+=p,l+=p*2,n.LegendBounds={Width:h(f,c)-u,Height:h(y,l),Rows:ti}):(f=kt.width>f?kt.width+p*2:f+p*2,c+=p,l+=p,n.LegendBounds={Width:h(f,c),Height:h(y,l)+p-u,Columns:ti});n.LegendViewerBounds={Width:"0",Height:"0"};k==""||k==null?(hi=e=="left"||e=="right"||e=="custom"?ot(vt):ot(vt/100*parseInt("20%")),n.LegendViewerBounds.Height=oi(hi,n.LegendBounds.Height)):n.LegendViewerBounds.Height=k.indexOf("%")!=-1?ot(vt/100*parseInt(k)):parseInt(k);d==""||d==null?(ci=e=="top"||e=="bottom"||e=="custom"?ot(yt):ot(yt/100*parseInt("20%")),n.LegendViewerBounds.Width=oi(ci,n.LegendBounds.Width)):n.LegendViewerBounds.Width=d.indexOf("%")!=-1?ot(yt/100*parseInt(d)):parseInt(d)}else n.LegendBounds={Width:0,Height:0},n.LegendViewerBounds={Width:0,Height:0};legendContainer=$(b.legendContainer);legendSvgContainer=$(b.legendSvgContainer);t.enableScrollbar?(n.LegendActualBounds=n.LegendViewerBounds,legendContainer.removeAttr("style"),legendContainer.css({visibility:"hidden",width:n.LegendViewerBounds.Width,height:n.LegendViewerBounds.Height}),legendSvgContainer.css({height:n.LegendBounds.Height,width:n.LegendBounds.Width}),t._ejScroller?$("#"+legendContainer[0].id).ejScroller({width:n.LegendViewerBounds.Width,height:n.LegendViewerBounds.Height}):legendContainer.css({overflow:"scroll"}),n.LegendBounds.Width>n.LegendViewerBounds.Width&&n.LegendBounds.Height>n.LegendViewerBounds.Height?t._ejScroller?(rt=$(".e-hscrollbar").height()||0,it=$(".e-vscrollbar").width()||0):(legendContainer.css({overflow:"scroll"}),rt=legendContainer[0].offsetHeight-lt*2-legendContainer[0].clientHeight,it=legendContainer[0].offsetWidth-lt*2-legendContainer[0].clientWidth):n.LegendBounds.Width>n.LegendViewerBounds.Width?t._ejScroller?(rt=$(".e-hscrollbar").height()||0,it=0):(legendContainer[0].style.overflowX="scroll",legendContainer[0].style.overflowY="hidden",rt=legendContainer[0].offsetHeight-lt*2-legendContainer[0].clientHeight,it=0):n.LegendBounds.Height>n.LegendViewerBounds.Height&&(t._ejScroller?(rt=0,it=$(".e-vscrollbar").width()):(legendContainer[0].style.overflowY="scroll",legendContainer[0].style.overflowX="hidden",rt=0,it=legendContainer[0].offsetWidth-lt*2-legendContainer[0].clientWidth))):(n.LegendActualBounds=n.LegendBounds,d!=""&&d!=null&&(n.LegendActualBounds.Width=parseInt(d)),k!=""&&k!=null&&(n.LegendActualBounds.Height=parseInt(k)));n.LegendActualBounds.Height+=Math.abs(rt);n.LegendActualBounds.Width+=Math.abs(it);n.LegendActualBounds.hScrollSize=rt;n.LegendActualBounds.vScrollSize=it},GetPointXYOrgin:function(n,t,i,r){var u=(n-i)/(this.model.axes.PrimaryXaxis.visibleRange.max-i)*this.model.m_AreaBounds.Width,f=(t-r)/(this.model.axes.PrimaryYaxis.visibleRange.max-r)*(this.model.m_AreaBounds.Height-this.GetPointXY(this.model.axes.PrimaryXaxis.visibleRange.min,Math.max(this.model.axes.PrimaryYaxis.visibleRange.min,0)).Y);return{X:u,Y:f}},_wrap:function(n,t,i,r,u,f){var s=i,a=f.width,c=[],b=[],g=s.length,k=0,e=0,l=i.split(" "),d=l.length,h,p,v,o,y,w;if(r=="wrap"){if(a>t)for(h=1;h<=s.length;h++)i=s.substring(0,h),a=ej.EjSvgRender.utils._measureText(i,null,u).width,a>t&&(k=k+1,i=s.substring(0,h-1),c[e]=i,s=s.slice(h-1,g),currentTextCollextion=s.split(" "),s=l.indexOf(currentTextCollextion[0])>-1?s:"-"+s,p=ej.EjSvgRender.utils._measureText(i,null,u).width,e++,h=0);c[e]=i}else if(r=="wrapandtrim")for(v=0,e=0;e<d;e++)if(o=l[e],y=ej.EjSvgRender.utils._measureText(o,null,u).width,y<t&&a>t){while(e<d)if(y=ej.EjSvgRender.utils._measureText(o,null,u).width,w=l[e+1]?ej.EjSvgRender.utils._measureText(l[e+1],null,u).width:0,y+w<=t&&w>0)o=o.concat(" "+l[e+1]),e++;else{v=Math.max(v,y);break}c.push(o)}else if(a>t)b.push(o),o=ej.EjSvgRender.utils._trimText(o,t,u),p=ej.EjSvgRender.utils._measureText(o,null,u).width,v=Math.max(v,p),c.push(o);else{c.push(i);break}return{text:c,unTrimmedText:b}},getMultiLevelLabelSize:function(n){var e=0,r,i;n._multiLevelLabelHeight=0;var u=[],f=[],y=[],d=n.multiLevelLabels.length,p=n.visibleRange,t,h,i,w,b,c,l,o,s=10,a,v=n.orientation.toLowerCase(),k=[];for(axisValue=v=="vertical"?n.length:n.width?n.width:this.model.primaryYAxis.AxisMaxWidth?n.length-this.model.primaryYAxis.AxisMaxWidth:n.length,i=0;i<d;i++)t=n.multiLevelLabels[i]=u[i]=$.extend(!0,{},this.model.multiLevelLabelsDefault,n.multiLevelLabels[i]),borderStyle=t.border.type.toLowerCase(),h=t.level,!t.visible||t.text==""||ej.util.isNullOrUndefined(t.start)||ej.util.isNullOrUndefined(t.end)||(w=Math.ceil(ej.EjSvgRender.utils._getPointXY(t.start,p,n.isInversed)*axisValue),b=Math.ceil(ej.EjSvgRender.utils._getPointXY(t.end,p,n.isInversed)*axisValue),c=ej.EjSvgRender.utils._measureText(t.text,null,t.font),textOverflow=t.textOverflow.toLowerCase(),l=ej.util.isNullOrUndefined(t.maximumTextWidth)?b-w:t.maximumTextWidth,o=v=="vertical"?t.maximumTextWidth?t.maximumTextWidth:c.width:c.height,o+=2*t.border.width,c.width>l-s&&(textOverflow=="wrap"||textOverflow=="wrapandtrim")&&(a=this._wrap(n,l-s,t.text,textOverflow,t.font,c),a=a.text,o=v=="vertical"?l-s:o*a.length),f[h]=ej.util.isNullOrUndefined(f[h])?o:f[h]<o?o:f[h]);for(u.sort(function(n,t){return parseFloat(n.level)-parseFloat(t.level)}),n.multiLevelLabels.sort(function(n,t){return parseFloat(n.level)-parseFloat(t.level)}),r=0;r<u.length;r++)r==0?(n.multiLevelLabels[r]._level=u[r]._level=0,greaterIndex=0):u[r].level>greaterIndex+1?(n.multiLevelLabels[r]._level=u[r]._level=greaterIndex+1,greaterIndex=u[r]._level):(n.multiLevelLabels[r]._level=u[r]._level=u[r].level,greaterIndex=u[r].level>greaterIndex?u[r].level:greaterIndex),borderStyle=="curlybrace"&&(k[n.multiLevelLabels[r]._level]=!0);for(i=0;i<f.length;i++)y[i]=e,ej.util.isNullOrUndefined(f[i])?(f.splice(i,1),i--):(e=borderStyle=="brace"?e+f[i]:e+f[i]+s/2,k[i]&&(e+=s,f[i]+=s));return n._multiLevelLabelHeight=e,n.multiLevelLabelHeight=f,n.prevHeight=y,e},_saturationColor:function(n,t){n=this.colorNameToHex(n);n=String(n).replace(/[^0-9a-f]/gi,"");n.length<6&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]);t=t||0;for(var u="#",i,r=0;r<3;r++)i=parseInt(n.substr(r*2,2),16),i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),u+=("00"+i).substr(i.length);return u},_drawChartAreaRect:function(){var t=(this.model.background&&this.model.background._gradientStop)?"url(#"+this.svgObject.id+"_backGradient)":this.model.background,n,i,r;this.model.backGroundImageUrl&&(t="transparent");n=this.model.border;i={id:this.svgObject.id+"_SvgRect",x:n.width/2,y:n.width/2,width:$(this.svgObject).width()-2*n.width,height:$(this.svgObject).height()-2*n.width,fill:t,opacity:n.opacity,"stroke-width":n.width,stroke:n.color,"class":"e-chartborder"};this.svgRenderer.drawRect(i,this.svgObject);this.model.backGroundImageUrl&&this._drawBackImage();this.model.AreaType!="cartesianaxes"||this.model.enable3D||(r={id:this.svgObject.id+"_ChartArea",x:this.model.m_AreaBounds.X,y:this.model.m_AreaBounds.Y,width:this.model.m_AreaBounds.Width,height:this.model.m_AreaBounds.Height,fill:this.model.chartArea.background,"stroke-width":this.model.chartArea.border.width,opacity:this.model.chartArea.border.opacity,stroke:this.model.chartArea.border.color,"class":"e-chartareaborder"},this.svgRenderer.drawRect(r,this.svgObject))},axesIndexCount:function(n,t){for(var i,r=[],u=0;u<n.length;u++)i=n[u],i.orientation.toLowerCase()=="vertical"?i.rowIndex==t&&r.push(i):i.columnIndex==t&&r.push(i);return r},axesCount:function(n){var t=[],o=[],i=0,u=this.model,r,f,e;if($.each(n,function(n,r){r.orientation.toLowerCase()=="vertical"?(i=u.rowDefinitions?u.rowDefinitions.length:0,n==0?t.push({axis:r,index:r.rowIndex}):r.rowIndex!=t[t.length-1].axis.rowIndex&&t.push({axis:r,index:r.rowIndex})):(i=u.columnDefinitions?u.columnDefinitions.length:0,n==0?t.push({axis:r,index:r.columnIndex}):r.columnIndex!=t[t.length-1].axis.columnIndex&&t.push({axis:r,index:r.columnIndex}))}),r=t.length,i>r)for(r=i,f=0;f<i;f++)o.push(f);else for(e=0;e<r;e++)o.push(t[e].index);return{length:r,indexValue:o}},_calRowSize:function(){var t=0,u=[],e=0,f=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height,i,o,n,r,s,h;if(this.model._rowDefinitions[0].rowDefinitions!=null)for(i=0,o=this.model._rowDefinitions.length;i<o;i++)n=this.model._rowDefinitions[i].rowDefinitions,n.rowHeight=Math.abs(n.rowHeight),r=0,n.unit.toLowerCase()=="percentage"?(s=this._axisRowDefinitionSize(this.model.rowDefinitions),r=Math.floor(this.model.m_AreaBounds.Height*(n.rowHeight/s))):r=n.rowHeight,i==0&&u.push(f),u.push(f-r-e),e+=r;else for(h=Math.floor(this.model.m_AreaBounds.Height/this.model._rowDefinitions.length),t=f;t>=this.model.m_AreaBounds.Y;t=t-h)u.push(t);return u},_calColumnSize:function(){var r=[],u=this.model.m_AreaBounds.X,o=this.model.m_AreaBounds.Width,s=0,f=this.model._columnDefinitions,t,h,n,e,c,l,i,a;if(f[0].columnDefinitions!=null)for(t=0,h=f.length;t<h;t++)n=f[t].columnDefinitions,n.columnWidth=Math.abs(n.columnWidth),n.unit.toLowerCase()=="percentage"?(c=this._axisColumnDefinitionSize(this.model.columnDefinitions),e=Math.floor(o*(n.columnWidth/c))):e=n.columnWidth,t==0&&r.push(u),r.push(u+e+s),s+=e;else for(l=Math.floor(o/f.length),i=u,a=u+o;i<=a;i=i+l)r.push(i);return r},_calculateAxisSize:function(n){for(var lt,at,a,o,rt,f,yt,pt,e=!0,u=!0,v=this._calColumnSize(),s=this.model._columnDefinitions,t=0,ct=s.length;t<ct;t++){var wt=v[t],g=v[t+1],y=0,p=0,nt=!0,tt=!0,w=this.model.m_AreaBounds.Y,it=w+this.model.m_AreaBounds.Height;for(f=0,lt=s[t].axis.length;f<lt;f++){var i=s[t].axis[f],h=0,b=0,c=i._opposed;if(n.axes[i.name]._validCross||(c?tt&&(u||p==0)?(h=w,tt=!1):(b=s.farSizes[p],h=w=w-b,p++):nt&&(e||y==0)?(h=it,nt=!1):(b=s.nearSizes[y],h=it=it+b,y++)),i.columnSpan){if(!(s[t].index==i.columnIndex))continue;at=ct>=t+i.columnSpan?t+i.columnSpan:t+1;g=v[at];c||y!=0||(e=nt);c&&p==0&&(u=tt)}else g=v[t+1],e=!0,u=!0;i.Location={};i.Location.X1=wt+i.plotOffset;i.Location.Y1=h;i.Location.X2=g-i.plotOffset;i.Location.Y2=h;i.x=i.Location.X1;i.y=i.Location.Y1;i.width=i.Location.X2-i.Location.X1;i.height=i.Location.Y2-i.Location.Y1}}for(e=!0,u=!0,a=this._calRowSize(),o=this.model._rowDefinitions,t=0,rt=o.length;t<rt;t++){var bt=a[t],ut=a[t+1],k=0,ft=0,et=!0,ot=!0,st=this.model.m_AreaBounds.X,vt=st,ht=st+this.model.m_AreaBounds.Width;for(f=0,yt=o[t].axis.length;f<yt;f++){var d=0,l=0,r=o[t].axis[f],c=r._opposed;if(n.axes[r.name]._validCross||(c?ot&&(u||u==0)?(l=ht,ot=!1):(d=o.farSizes[ft],l=ht=ht+d,ft++):et&&(e||k==0)?(l=st,et=!1):(d=o.nearSizes[k],l=vt=vt-d,k++)),r.rowSpan){if(!(o[t].index==r.rowIndex))continue;pt=rt>=t+r.rowSpan?t+r.rowSpan:t+1;ut=a[pt];c||k!=0||(e=et);c&&ft==0&&(u=ot)}else ut=a[t+1],e=!0,u=!0;r.Location={};r.Location.X1=l;r.Location.Y1=bt-r.plotOffset;r.Location.X2=l;r.Location.Y2=ut+r.plotOffset;r.x=r.Location.X1;r.y=r.Location.Y2;r.height=r.Location.Y1-r.Location.Y2;r.width=r.axisLine.width}}},_validateCrossing:function(n){if(n._opposedPosition=!1,n.crossesAt!=null){var t=this._getCrossAxis(this.model._axes,n.orientation.toLowerCase()=="horizontal",n.crossesInAxis);return n._crossValue=this._getCrossValue(n,t,t._valueType),((t.isInversed?!n.opposedPosition:n.opposedPosition)?n._crossValue<=t.visibleRange.min:n._crossValue>=t.visibleRange.max)&&(n._opposedPosition=!0),t.visibleRange.min<n._crossValue&&t.visibleRange.max>n._crossValue}return!1},_axisCrossing:function(n,t,i){var u=n.orientation.toLowerCase()=="horizontal",r=this._getCrossAxis(this.model._axes,u,n.crossesInAxis),f=n._crossValue,e=Math.abs((r.isInversed?r.visibleRange.max:r.visibleRange.min)-f);this._locateAxis(n,r,u,e);t||(i._crossAxisOverlap=this._avoidOverlapping(n,this.model.m_AreaBounds,u,n.opposedPosition,i)||i._crossAxisOverlap)},_locateAxis:function(n,t,i,r){var u=(i?t.height:t.width)*r/t.visibleRange.delta;i?n.y=t.y+t.height-u:n.x=t.x+u},_avoidOverlapping:function(n,t,i,r,u){var f=0,e=n.showNextToAxisLine?u.axes[n.name]._bounds:0;if(i){if(!r&&n.y+e>t.Y+t.Height)return t.Height-=f=n.y+e-t.Y-t.Height,this._recalculateSpace(n,i,r,f),!0;if(r&&n.y-e<t.Y)return t.Y+=f=e-(n.y-t.Y),t.Height-=f,this._recalculateSpace(n,i,r,f),!0}else{if(!r&&n.x-e<t.X)return t.X+=f=e-(n.x-t.X),t.Width-=f,this._recalculateSpace(n,i,r,f),!0;if(r&&n.x+e>t.X+t.Width)return t.Width-=f=n.x+e-t.X-t.Width,this._recalculateSpace(n,i,r,f),!0;if(n.labelPosition=="inside"&&n.x+e>t.X+t.Width)return t.Width-=f=n.x+e-t.X-t.Width,this._recalculateSpace(n,i,r,f,n.showNextToAxisLine),!0}},_recalculateSpace:function(n,t,i,r,u){var l,e,s,a,f,h,o,c;if(t){for(e=this.model._rowDefinitions,s=i?e.length-1:0,f=0,h=e[s].axis.length;f<h;f++)e[s].axis[f].height-=r,e[s].axis[f].Location.Y2-=r,i&&(e[s].axis[f].Location.Y1=e[s].axis[f].y+=r);for(l=n.columnIndex,e=this.model._columnDefinitions,f=0,h=e.length;f<h;f++)if(f!==l)for(o=0,c=e[f].axis.length;o<c;o++)e[f].axis[o]._opposed===i&&(e[f].axis[o].Location.Y1=e[f].axis[o].Location.Y2=e[f].axis[o].y+=(i?1:-1)*r)}else{for(e=this.model._columnDefinitions,s=i?e.length-1:0,f=0,h=e[s].axis.length;f<h;f++)e[s].axis[f].width-=r,u||(i?e[s].axis[f].Location.X2-=r:e[s].axis[f].Location.X1=e[s].axis[f].x+=r);for(a=n.rowIndex,e=this.model._rowDefinitions,f=0,h=e.length;f<h;f++)if(f!==a)for(o=0,c=e[f].axis.length;o<c;o++)e[f].axis[o]._opposed===i&&(e[f].axis[o].Location.X1=e[f].axis[o].Location.X2=e[f].axis[o].x+=(i?-1:1)*r)}},_getCrossValue:function(n,t,i){switch(i.toLowerCase()){case"category":return t.labels.indexOf(n.crossesAt)!=-1?t.labels.indexOf(n.crossesAt):n.crossesAt;case"datetime":return isNaN(Date.parse(n.crossesAt))?null:Date.parse(n.crossesAt);case"logarithmic":return Math.log(n.crossesAt)/Math.log(t.logBase)}return n.crossesAt},_getXCrossValue:function(n,t,i){var r=t.crossesInAxis,u=n._yAxisName,f=i.axes[t.name]._validCross||i.axes[t.name]._validCross==null;return f&&t.crossesAt&&(!r&&u===this.model.primaryYAxis.name||r&&this._getCrossAxis(this.model._axes,!0,r).name===u)?t.crossesAt:0},_getAxisByName:function(n,t,i){if(i)for(var r=0,u=n.length;r<u;r++)if(n[r].name===i&&(t?n[r].orientation=="vertical":n[r].orientation=="horizontal"))return n[r]},_getCrossAxis:function(n,t,i){return this._getAxisByName(n,t,i)||(this.model.requireInvertedAxes?t?this.model.primaryXAxis:this.model.primaryYAxis:t?this.model.primaryYAxis:this.model.primaryXAxis)},_arrangeAxis:function(){for(var o,i,u,a,c,v,s,r,f,y,l,p,n=this,t,e,h=0;h<this.model._axes.length;h++)t=this.model._axes[h],t.orientation.toLowerCase()=="horizontal"?(n.model.hAxes.push(t),t.columnIndex=ej.util.isNullOrUndefined(t.columnIndex)?0:t.columnIndex,n.model.hAxes[n.model.hAxes.length-1].columnIndex=t.columnIndex):t.orientation.toLowerCase()=="vertical"&&(n.model.vAxes.push(t),t.rowIndex=ej.util.isNullOrUndefined(t.rowIndex)?0:t.rowIndex,n.model.vAxes[n.model.vAxes.length-1].rowIndex=t.rowIndex,e=ej.util.isNullOrUndefined(n.model.rowDefinitions)?null:n.model.rowDefinitions[t.rowIndex],e&&(t.axisBottomLine={},t.axisBottomLine.visible=!0,t.axisBottomLine.lineWidth=e.lineWidth,t.axisBottomLine.color=e.lineColor));if(this.model.hAxes=ej.DataManager(this.model.hAxes,ej.Query().sortBy("columnIndex")).executeLocal(),this.model.vAxes=ej.DataManager(this.model.vAxes,ej.Query().sortBy("rowIndex")).executeLocal(),o=this.axesCount(n.model.vAxes),n.model._rowDefinitions=[],n.model.vAxes.length>0)for(i=0;i<o.length;i++)u=n.model.rowDefinitions,a=u?u[i]?u[i]:u[0]:null,n.model._rowDefinitions.push({axis:this.axesIndexCount(n.model.vAxes,o.indexValue[i]),index:o.indexValue[i],rowDefinitions:a});if(c=n.model._rowDefinitions,v=this._axisFilter(c,"rowSpan"),this._SpanningAxes(c,v,!0),s=this.axesCount(n.model.hAxes),n.model._columnDefinitions=[],n.model.hAxes.length>0)for(r=0;r<s.length;r++)f=n.model.columnDefinitions,y=f?f[r]?f[r]:f[0]:null,n.model._columnDefinitions.push({axis:this.axesIndexCount(n.model.hAxes,s.indexValue[r]),index:s.indexValue[r],columnDefinitions:y});l=n.model._columnDefinitions;p=this._axisFilter(l,"columnSpan");this._SpanningAxes(l,p,!1);this._axisSize()},_SpanningAxes:function(n,t,i){for(var r,c,e,o,s,u,f=0,h=t.length;f<h;f++){if(r=t[f],r==null)break;if(c=i?r.rowSpan:r.columnSpan,e=i?r.rowIndex:r.columnIndex,n[e]!=undefined)for(o=n[e].axis.indexOf(r),s=1,u=e+1;s<c&&u<n.length;s++,u++)n[u].axis.length>=o&&n[u].axis.splice(o,0,r)}},_axisFilter:function(n,t){var i=[];return n.filter(function(n){for(var u=ej.DataManager(n.axis,ej.Query().where(t,">",1)).executeLocal(),r=0,f=u.length;r<f;r++)i.push(u[r])}),i},_axisSize:function(){for(var n,r,t,u,o,i=this._getLegendSpace(),f=$(this.svgObject).width()-this.model.margin.left-this.model.margin.right-this.model.elementSpacing*2-i.leftLegendWidth-i.rightLegendWidth,h=Math.floor(f/this.axesCount(this.model.hAxes).length),e=$(this.svgObject).height()-this.model.margin.top-this.model.margin.bottom-this.model.elementSpacing*2-i.topLegendHeight-i.bottomLegendHeight-i.modelTitleHeight-i.modelsubTitleHeight,c=Math.floor(e/this.axesCount(this.model.vAxes).length),s=0;s<this.model._axes.length;s++)axis=this.model._axes[s],axis.orientation.toLowerCase()=="horizontal"?this.model.AreaType!="polaraxes"?(n=ej.util.isNullOrUndefined(this.model.columnDefinitions)?[]:this.model.columnDefinitions[axis.columnIndex],r=h,n&&(n.unit=n.unit==undefined?"percentage":n.unit,n.columnWidth=n.columnWidth==undefined?100:n.columnWidth,n.unit.toLowerCase()=="percentage"?(o=this._axisColumnDefinitionSize(this.model.columnDefinitions),r=Math.floor(h*(n.columnWidth/o))):r=n.columnWidth),axis.length=axis.columnSpan?axis.columnSpan*r:r):axis.length=f>e*2?f-e:f:axis.orientation.toLowerCase()=="vertical"&&(this.model.AreaType!="polaraxes"?(t=ej.util.isNullOrUndefined(this.model.rowDefinitions)?[]:this.model.rowDefinitions[axis.rowIndex],u=c,t&&(t.unit=t.unit==undefined?"percentage":t.unit,t.rowHeight=t.rowHeight==undefined?100:t.rowHeight,t.unit.toLowerCase()=="percentage"?(o=this._axisRowDefinitionSize(this.model.rowDefinitions),u=Math.floor(c*(t.rowHeight/o))):u=t.rowHeight),axis.length=axis.rowSpan?axis.rowSpan*u:u):axis.length=e/2)},_axisRowDefinitionSize:function(n){var t=0,i;if(n)for(i=0;i<n.length;i++)t=t+n[i].rowHeight;return t>100?t:100},_axisColumnDefinitionSize:function(n){var t=0,i;if(n)for(i=0;i<n.length;i++)t=t+n[i].columnWidth;return t>100?t:100},_axisMeasure:function(n,t,i,r){var u=0,o=0,f=0,e,s;return n.axisLine.width=n.axisLine.width<0?0:n.axisLine.width,n.majorTickLines.size=n.majorTickLines.size<0?0:n.majorTickLines.size,e=!this.model.enable3D&&n.axisLine.visible&&n.axisLine.width,s=ej.EjSvgRender.utils._measureText(n.title.text,t,n.title.font),i=="vertical"?(o=n._LableMaxWidth.width,u=n.title.text==""||!n.title.visible||!n.visible?0:document.documentMode===8?s.width:s.height+2*this.model.elementSpacing):(o=n._LableMaxWidth.height,u=n.title.text==""||!n.title.visible||!n.visible?0:s.height+this.model.elementSpacing),u=n.title.position.toLowerCase()=="inside"?0:u,f=this.getMultiLevelLabelSize(n),n.AxisMaxWidth=r==0&&n.tickLinesPosition=="inside"&&n.labelPosition=="inside"?u+f+e+this.model.elementSpacing:r==0&&n.tickLinesPosition=="inside"&&n.labelPosition!="inside"?u+f+e+this.model.elementSpacing+o:r==0&&n.tickLinesPosition!="inside"&&n.labelPosition=="inside"?u+f+e+this.model.elementSpacing+n.majorTickLines.size:u+f+e+this.model.elementSpacing+n.majorTickLines.size+o,n.AxisMaxWidth+=n._isScroll?18:0,n.AxisMaxWidth},_arraySum:function(n){for(var i=0,t=0;t<n.length;t++)i+=parseFloat(n[t])||0;return i},_calSpace:function(n,t,i,r){for(var h,c,f,u,e=[],o=[],s=0;s<t.length;s++)for(h=0,c=0,f=0;f<t[s].axis.length;f++)(u=t[s].axis[f],bounds=r.axes[u.name]._bounds=this._axisMeasure(u,n,i,f),validCross=r.axes[u.name]._validCross=this._validateCrossing(u),measureValue=validCross?0:bounds,u._opposed=u.opposedPosition?!u._opposedPosition:u._opposedPosition||u.opposedPosiiton||!1,validCross&&t[s].axis[f].showNextToAxisLine)||(u.showNextToAxisLine||(measureValue=u.labelPosition=="inside"?bounds-u._multiLevelLabelHeight:bounds),u._opposed?(o.length<=c?o.push(measureValue):o[c]<measureValue&&(o[c]=measureValue),c++):(e.length<=h?e.push(measureValue):e[h]<measureValue&&(e[h]=measureValue),h++));return{nearSizes:e,farSizes:o}},_getLegendSpace:function(){var h=this.model,c=h.legend,a=c.position.toLowerCase(),w=h.LegendActualBounds,b=ej.EjSvgRender.utils._measureText,n=h.title,t=n.subTitle,l=h.elementSpacing,v=h.margin,y=h.svgWidth,k=c.border.width,d=0,g=0,rt=0,ut=0,ft=0,et=0,bt=n.text.split(" "),ot=n.enableTrim,e=n.maximumWidth,e=e.toString()=="auto"||e.toString()==""?y*.75:parseInt(e),r=n.textOverflow.toLowerCase(),p=n.text,vt=n.visible,o,s,i,st=ej.EjSvgRender.utils._measureText(n.text,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,n.font),kt=t.text.split(" "),ht=t.enableTrim,u=t.maximumWidth,u=u.toString()=="auto"||u.toString()==""?y*.75:parseInt(u),f=t.textOverflow.toLowerCase(),nt=t.text,yt=t.visible,ct=ej.EjSvgRender.utils._measureText(t.text,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,t.font),lt=vt&&ot&&st.width>e?!0:!1,at=yt&&ht&&ct.width>u?!0:!1,pt=r=="wrap"||r=="wrapandtrim"?!0:!1,wt=f=="wrap"||f=="wrapandtrim"?!0:!1,tt,it;return this.model.titleWrapTextCollection=[],this.model.subTitleWrapTextCollection=[],this.model.trimTooltip=!1,this.model.subTitleTooltip=!1,c.visible&&(g=w.Width+5+l+2*k,rt=a=="left"?g:0,ut=a=="right"?g:0,c.title.text&&(d=b(c.title,null,c.title.font).height),ft=a=="top"?w.Height+d+2*k:0,et=a=="bottom"?w.Height+d+2*k:0),lt&&r=="wrap"?(i={text:p,font:n.font},o=this._rowsCalculation(i,e,r)):lt&&r=="wrapandtrim"?(i={text:p,font:n.font},o=this._rowsCalculation(i,e,r)):(r=="wrapandtrim"||r=="wrap")&&(i={text:p,font:n.font},o=this._rowsCalculation(i,ej.EjSvgRender.utils._measureText(p,null,n.font).width,r)),this.model.titleWrapTextCollection=o?o.textCollection:"",this.model.titleMaxWidth=o?o.wordMax:e,at&&f=="wrap"?(i={text:nt,font:t.font},s=this._rowsCalculation(i,u,f)):at&&f=="wrapandtrim"?(i={text:nt,font:t.font},s=this._rowsCalculation(i,u,f),this.model.subTitleTooltip=this.model.trimTooltip):(f=="wrapandtrim"||f=="wrap")&&(i={text:nt,font:t.font},s=this._rowsCalculation(i,u,f)),this.model.subTitleWrapTextCollection=s?s.textCollection:"",this.model.subTitleMaxWidth=s?s.wordMax:u,tt=b(n.text,y-v.left-v.right,n.font).height,it=b(t.text,y-v.left-v.right,t.font).height,modelTitleHeight=n.text==""||!n.visible?0:ot&&pt&&st.width>e?tt*this.model.titleWrapTextCollection.length+l:tt+l,modelsubTitleHeight=t.text==""||!t.visible||!n.visible?0:ht&&wt&&ct.width>u?it*this.model.subTitleWrapTextCollection.length+l:it+l,{leftLegendWidth:rt,rightLegendWidth:ut,topLegendHeight:ft,bottomLegendHeight:et,modelTitleHeight:modelTitleHeight,modelsubTitleHeight:modelsubTitleHeight}},_arraySome:function(n,t){for(var r=!1,e=this.model.zooming.enableScrollbar,o=n.length,u,f,i=0;i<o;i++)u=n[i].scrollbarSettings.enableScrollbar,f=n[i].scrollbarSettings.pointsLength,r=r||(n[i]._isScroll&&n[i].maxPointLength<f||n[i].zoomFactor<1&&u&&e)&&n[i].orientation.toLowerCase()==t;return r},_calculateAreaBounds:function(n){var t=this,h=$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,f=t.model.border.width,k=this.model._axes[0],d=this.model.zooming.enableScrollbar,g=this.model.zooming.type.toLowerCase(),r,u;t.model.scrollerSize=18;this.model._yScroll=this._arraySome(this.model._axes,"vertical");this.model._xScroll=this._arraySome(this.model._axes,"horizontal");r=this._calSpace(h,t.model._rowDefinitions,"vertical",n);t.model._rowDefinitions.nearSizes=r.nearSizes;t.model._rowDefinitions.farSizes=r.farSizes;var y=this._arraySum(r.nearSizes),p=this._arraySum(r.farSizes),i=this._getLegendSpace(),e=y+i.leftLegendWidth+t.model.margin.left+f,c=p+i.rightLegendWidth+t.model.margin.right+t.model.margin.left+2*f,l=$(this.svgObject).width(),o=l-(e+c);if(o<0&&this.model.AreaType=="cartesianaxes")$(this.svgObject).width(l-o+1),this._calculateAreaBounds(n);else{u=this._calSpace(h,t.model._columnDefinitions,"horizontal",n);t.model._columnDefinitions.nearSizes=u.nearSizes;t.model._columnDefinitions.farSizes=u.farSizes;var w=this._arraySum(u.nearSizes),b=this._arraySum(u.farSizes),s=b+this.model.margin.top+this.model.elementSpacing+i.modelTitleHeight+i.modelsubTitleHeight+i.topLegendHeight+f,a=w+this.model.margin.bottom+i.bottomLegendHeight+2*f,v=Math.abs($(this.svgObject).height()-(s+a));this.model.m_AreaBounds={X:e,Y:s,Width:o,Height:v};this.model.m_Spacing={Left:e,Top:s,Right:c,Bottom:a};this.model.enableCanvasRendering?(this.canvasX=e,this.canvasY=s,this.canvasWidth=o,this.canvasHeight=v):this.canvasX=this.canvasY=this.canvasHeight=this.canvasWidth=0}}};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}}}(jQuery),function(n,t){t.widget("ejChart","ej.datavisualization.Chart",{element:null,model:null,validTags:["div"],defaults:{border:{color:"transparent",width:0,opacity:.3},chartArea:{border:{color:"Gray",width:.5,opacity:.3},background:"transparent"},primaryXAxis:{crossesAt:null,crossesInAxis:null,isIndexed:!1,alignment:"center",labelPlacement:"",scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},range:{min:null,max:null,interval:null},labelPosition:"outside",tickLinesPosition:"outside",alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorGridLines:{width:1,dashArray:"",visible:!0,opacity:1},majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,columnIndex:null,columnSpan:null,labelRotation:null,valueType:null,name:null,labelFormat:null,desiredIntervals:null,intervalType:null,roundingPlaces:null,logBase:10,plotOffset:0,labels:[],stripLine:[{visible:!1,startFromAxis:!1,text:"",width:0,textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"14px",opacity:1,fontWeight:"regular"}},rangePadding:"Auto",additionalPadding:[1,1],orientation:"Horizontal",maximumLabels:3,opposedPosition:!1,showNextToAxisLine:!0,axisLine:{visible:!0,width:1,dashArray:"",offset:0},labelIntersectAction:"none",maximumLabelWidth:34,enableTrim:!1,edgeLabelPlacement:"none",isInversed:!1,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",fontWeight:"regular",opacity:1},visible:!0,crosshairLabel:{visible:!1},zoomFactor:1,zoomPosition:0},primaryYAxis:{crossesAt:null,crossesInAxis:null,showNextToAxisLine:!0,alignment:"center",startFromZero:!0,range:{min:null,max:null,interval:null},scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},labelPlacement:"",labelPosition:"outside",tickLinesPosition:"outside",alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorGridLines:{width:1,dashArray:"",visible:!0,opacity:1},majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,rowIndex:null,rowSpan:null,valueType:null,name:null,labelFormat:null,desiredIntervals:null,intervalType:null,roundingPlaces:null,labels:[],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",opacity:1,size:"14px",fontWeight:"regular"}},rangePadding:"Auto",stripLine:[{visible:!1,startFromAxis:!1,width:0,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],logBase:10,plotOffset:0,orientation:"Vertical",maximumLabels:3,labelIntersectAction:"none",maximumLabelWidth:34,enableTrim:!1,edgeLabelPlacement:"none",isInversed:!1,crosshairLabel:{visible:!1},visible:!0,opposedPosition:!1,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",opacity:1,fontWeight:"regular"},axisLine:{visible:!0,width:1,dashArray:"",offset:0},zoomFactor:1,zoomPosition:0},axes:[],secondaryX:{crossesAt:null,crossesInAxis:null,showNextToAxisLine:!0,alignment:"center",range:{min:null,max:null,interval:null},scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},tickLinesPosition:"outside",labelPosition:"outside",majorGridLines:{width:1,dashArray:"",visible:!0},alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,columnIndex:null,columnSpan:null,labelRotation:null,valueType:null,name:null,labelFormat:null,labelPlacement:"",desiredIntervals:null,intervalType:null,roundingPlaces:null,logBase:10,plotOffset:0,labels:[],stripLine:[{visible:!1,startFromAxis:!1,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"regular",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"14px",opacity:1,fontWeight:"regular"}},rangePadding:"Auto",additionalPadding:[1,1],orientation:"Horizontal",maximumLabels:3,opposedPosition:!1,axisLine:{visible:!0,width:1,dashArray:"",offset:0},labelIntersectAction:"none",edgeLabelPlacement:"none",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",fontWeight:"regular",opacity:1},visible:!0,crosshairLabel:{visible:!1},zoomFactor:1,zoomPosition:0},secondaryY:{crossesAt:null,crossesInAxis:null,showNextToAxisLine:!0,alignment:"center",startFromZero:!0,range:{min:null,max:null,interval:null},scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},tickLinesPosition:"outside",labelPosition:"outside",majorGridLines:{width:1,dashArray:"",visible:!0},alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,rowIndex:null,rowSpan:null,valueType:null,name:null,labelFormat:null,desiredIntervals:null,intervalType:null,roundingPlaces:null,labels:[],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",opacity:1,size:"14px",fontWeight:"regular"}},rangePadding:"Auto",stripLine:[{visible:!1,startFromAxis:!1,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"regular",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],logBase:10,plotOffset:0,orientation:"Vertical",maximumLabels:3,labelIntersectAction:"none",labelPlacement:"",edgeLabelPlacement:"none",crosshairLabel:{visible:!1},visible:!0,opposedPosition:!1,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",opacity:1,fontWeight:"regular"},axisLine:{visible:!0,width:1,dashArray:"",offset:0},zoomFactor:1,zoomPosition:0},trendlineDefaults:{type:"linear",visibility:"",visibleOnLegend:"visible",name:"Trendline",fill:"",width:1,opacity:1,dashArray:"",forwardForecast:0,backwardForecast:0,polynomialOrder:2,period:2,intercept:null,tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",opacity:1}}},indicatorDefaults:{visible:!0,points:[],tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95},seriesName:"",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1},type:"SMA",period:14,standardDeviations:2,kPeriod:3,dPeriod:3,periodLine:{fill:"blue",width:2},lowerLine:{fill:"#008000",width:2},upperLine:{fill:"#ff0000",width:2},macdLine:{fill:"#ff9933",width:2},histogram:{fill:"#ccccff",opacity:1,border:{color:"#9999ff",width:1}},fill:"#00008B",width:2,xAxisName:"",yAxisName:"",visibility:"visible",macdType:"line",shortPeriod:12,longPeriod:26,trigger:9,enableAnimation:!1},annotationsDefault:{visible:!1,content:"",coordinateUnit:"none",verticalAlignment:"middle",horizontalAlignment:"middle",region:"chart",x:0,y:0,opacity:1,angle:0,xAxisName:"",yAxisName:"",margin:{left:0,right:0,bottom:0,top:0}},multiLevelLabelsDefault:{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}},stripLineDefault:{visible:!1,startFromAxis:!1,width:0,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over",borderWidth:1},rowDefinitions:null,columnDefinitions:null,title:{text:"",enableTrim:!1,visible:!0,maximumWidth:"auto",textOverflow:"trim",textAlignment:"center",background:"transparent",border:{color:"transparent",width:1,opacity:.8,cornerRadius:.8},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"16px",opacity:1,fontWeight:"regular"},subTitle:{text:"",enableTrim:!1,visible:!0,maximumWidth:"auto",textOverflow:"trim",textAlignment:"far",background:"transparent",border:{color:"transparent",width:1,opacity:.8,cornerRadius:.8},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",opacity:1,fontWeight:"regular"}}},lineCap:{butt:"butt",round:"round",square:"square"},lineJoin:{round:"round",bevel:"bevel",miter:"miter"},legendAlignment:{near:"near",center:"center",far:"far"},legendPosition:{top:"top",bottom:"bottom",right:"right",left:"left",custom:"custom"},enableAnimation:!0,legend:{title:{text:"",textAlignment:"center",font:{size:"12px",fontFamily:"Segoe UI",fontStyle:"normal",fontWeight:"regular"}},border:{color:"transparent",width:1},visible:!0,textOverflow:"none",textWidth:34,toggleSeriesVisibility:!0,enableScrollbar:!0,itemPadding:10,shape:"None",alignment:"Center",position:"Bottom",location:{x:0,y:0},itemStyle:{height:9,width:9,border:{color:"transparent",width:1}},rowCount:null,columnCount:null,opacity:1,fill:null,background:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px"},size:{height:null,width:null}},indicators:[{points:[],tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95},seriesName:"",type:"SMA",period:14,standardDeviations:2,kPeriod:3,dPeriod:3,periodLine:{fill:"blue",width:2},lowerLine:{fill:"#008000",width:2},upperLine:{fill:"#ff0000",width:2},macdLine:{fill:"#ff9933",width:2},histogram:{fill:"#ccccff",opacity:1,border:{color:"#9999ff",width:1}},fill:"#00008B",visible:!0,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1},width:2,xAxisName:"",yAxisName:"",macdType:"line",shortPeriod:12,longPeriod:26,trigger:9,visibility:"visible",enableAnimation:!1}],backGroundImageUrl:null,annotations:[{visible:!1,content:"",coordinateUnit:"none",verticalAlignment:"middle",horizontalAlignment:"middle",region:"chart",x:0,y:0,opacity:1,angle:0,xAxisName:"",yAxisName:"",margin:{left:0,right:0,bottom:0,top:0}}],series:[{dragSettings:{enable:!1,type:"xy"},type:"column",splitMode:"value",splitValue:null,gapWidth:50,pieOfPieCoefficient:.6,visibleOnLegend:"visible",enableAnimation:!1,isClosed:!0,isTransposed:!1,isStacking:!0,columnSpacing:0,columnWidth:.7,columnFacet:"rectangle",drawType:"line",doughnutCoefficient:.4,explodeOffset:25,pyramidMode:"linear",boxPlotMode:"exclusive",funnelWidth:"11.6%",funnelHeight:"32.7%",positiveFill:null,showMedian:!0,outlierSettings:{shape:"circle",size:{width:6,height:6}},cornerRadius:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},connectorLine:{width:1,opacity:1,dashArray:null},errorBar:{visibility:"hidden",mode:"vertical",type:"fixedValue",horizontalErrorValue:1,verticalErrorValue:3,horizontalPositiveErrorValue:1,horizontalNegativeErrorValue:1,verticalPositiveErrorValue:5,verticalNegativeErrorValue:5,direction:"both",cap:{visible:!0,width:1,length:20},width:1,opacity:1},highlightSettings:{enable:!1,mode:"series",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},selectionSettings:{type:"Single",enable:!1,mode:"series",rangeType:"xy",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},emptyPointSettings:{visible:!0,style:{color:"",border:{color:"",width:1}},displayMode:"gap"},labelPosition:"inside",gapRatio:0,points:null,pieCoefficient:.8,doughnutSize:.8,dataSource:null,high:"",low:"",open:"",close:"",bullFillColor:null,bearFillColor:null,query:null,xName:"",yName:"",pointColorMappingName:"",visibility:"visible",startAngle:null,endAngle:null,xAxisName:null,yAxisName:null,explodeAll:null,explode:!1,explodeIndex:null,enableSmartLabels:null,tooltip:{visible:!1,format:null,template:null,fill:null,border:{width:1,color:null},enableAnimation:!0,duration:"500ms",opacity:.95},fill:null,opacity:1,lineCap:"butt",lineJoin:"round",dashArray:"",border:{width:1,color:"transparent",dashArray:""},width:2,marker:{shape:"circle",imageUrl:"",size:{width:6,height:6},visible:!1,opacity:1,fill:null,border:{color:"white",width:3},dataLabel:{visible:!1,angle:0,textMappingName:"",verticalTextAlignment:"center",horizontalTextAlignment:"center",textPosition:"top",shape:"none",opacity:1,fill:null,border:{color:"white",width:.1},maximumLabelWidth:null,enableWrap:!1,connectorLine:{width:.5,type:"line",color:null},offset:{x:0,y:0},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"11px",opacity:1},margin:{left:5,top:5,bottom:5,right:5}}},bubbleOptions:{radiusMode:"minmax",minRadius:1,maxRadius:3},trendlines:[{visibility:"",visibleOnLegend:"visible",type:"linear",name:"Trendline",fill:"",width:1,opacity:1,dashArray:"",forwardForecast:0,backwardForecast:0,polynomialOrder:2,period:2,intercept:null,tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",opacity:1}}}],font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1},_isdesigntime:!0}],commonSeriesOptions:{dragSettings:{enable:!1,type:"xy"},type:"column",splitMode:"value",splitValue:null,gapWidth:50,pieOfPieCoefficient:.6,visibleOnLegend:"visible",enableAnimation:!1,isClosed:!0,isTransposed:!1,isStacking:!1,columnWidth:.7,columnSpacing:0,columnFacet:"rectangle",drawType:"line",doughnutCoefficient:.4,explodeOffset:25,pyramidMode:"linear",boxPlotMode:"exclusive",funnelWidth:"11.6%",funnelHeight:"32.7%",positiveFill:null,showMedian:!0,outlierSettings:{shape:"circle",size:{width:6,height:6}},cornerRadius:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},connectorLine:{width:1,opacity:1,dashArray:null},errorBar:{visibility:"hidden",mode:"vertical",type:"fixedValue",horizontalErrorValue:1,verticalErrorValue:3,horizontalPositiveErrorValue:1,horizontalNegativeErrorValue:1,verticalPositiveErrorValue:5,verticalNegativeErrorValue:5,direction:"both",cap:{visible:!0,width:1,length:20},width:1,opacity:1},highlightSettings:{enable:!1,mode:"series",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},selectionSettings:{type:"Single",enable:!1,mode:"series",rangeType:"xy",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},emptyPointSettings:{visible:!0,style:{color:"",border:{color:"",width:1}},displayMode:"gap"},labelPosition:"inside",gapRatio:0,pieCoefficient:.8,doughnutSize:.8,dataSource:null,xName:"",yName:"",pointColorMappingName:"",high:"",low:"",open:"",close:"",startAngle:null,endAngle:null,xAxisName:null,yAxisName:null,explodeAll:!1,explode:!1,explodeIndex:null,enableSmartLabels:null,tooltip:{visible:!1,format:null,template:null,fill:null,border:{color:null,width:1},enableAnimation:!0,duration:"500ms",opacity:.95},fill:null,opacity:1,lineCap:"butt",lineJoin:"round",dashArray:"",border:{color:"transparent",width:1,dashArray:""},width:2,marker:{shape:"circle",imageUrl:"",size:{width:6,height:6},visible:!1,opacity:1,fill:null,border:{color:"white",width:3},dataLabel:{visible:!1,angle:0,textMappingName:"",verticalTextAlignment:"center",horizontalTextAlignment:"center",textPosition:"top",shape:"none",maximumLabelWidth:null,enableWrap:!1,opacity:1,fill:null,border:{color:"white",width:.1},offset:{x:0,y:0},connectorLine:{width:.5,type:"line"},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"11px",opacity:1},margin:{left:5,top:5,bottom:5,right:5}}},bubbleOptions:{radiusMode:"minmax",minRadius:1,maxRadius:3},trendlines:[{visibility:"",visibleOnLegend:"visible",type:"linear",name:"Trendline",fill:"",width:1,opacity:1,dashArray:"",forwardForecast:0,backwardForecast:0,polynomialOrder:2,period:2,intercept:null,tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",opacity:1}}}],font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1}},crosshair:{line:{color:"black",width:1},marker:{visible:!0,size:{width:10,height:10},opacity:1,border:{width:3}},visible:!1,type:"crosshair",trackballTooltipSettings:{fill:null,mode:"float",border:{width:null,color:null},rx:3,ry:3,opacity:1}},pointStyle:{lineCap:"butt",lineJoin:"round",opacity:1,interior:null,borderColor:null,borderWidth:1},textStyle:{marker:{textAlignment:"center",textPosition:"top"},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1}},symbolShape:{None:0,LeftArrow:1,RightArrow:2,Circle:3,Cross:4,HorizLine:5,VertLine:6,Diamond:7,Rectangle:8,Triangle:9,InvertedTriangle:10,Hexagon:11,Pentagon:12,Star:13,Ellipse:14,Wedge:15,Trapezoid:16,UpArrow:17,DownArrow:18,Image:19,SeriesType:20},initSeriesRender:!0,theme:"flatlight",canResize:!1,isResponsive:!1,enable3D:!1,enableRotation:!1,sideBySideSeriesPlacement:null,perspectiveAngle:90,rotation:0,tilt:0,wallSize:2,depth:100,enableCanvasRendering:!1,selectedDataPointIndexes:[],exportSettings:{type:"png",fileName:"Chart",orientation:"portrait",angle:0,mode:"client",action:"",multipleExport:!1},zooming:{enable:!1,enableScrollbar:!1,type:"x,y",enablePinching:!0,enableMouseWheel:!1,enableDeferredZoom:!1,toolbarItems:["zoomIn","zoomOut","zoom","pan","reset"]},type:"x,y",locale:null,xZoomFactor:1,yZoomFactor:1,xZoomPosition:0,yZoomPosition:0,load:"",axesLabelRendering:"",axesRangeCalculate:"",axesTitleRendering:"",dragStart:"",dragging:"",dragEnd:"",chartAreaBoundsCalculate:"",legendItemRendering:"",legendBoundsCalculate:"",preRender:"",seriesRendering:"",trendlineRendering:"",symbolRendering:"",titleRendering:"",subtitleRendering:"",axesLabelsInitialize:"",pointRegionClick:"",seriesRegionClick:"",annotationClick:"",axisLabelClick:"",chartClick:"",scrollStart:"",scrollEnd:"",scrollChanged:"",chartDoubleClick:"",pointRegionMouseMove:"",legendItemClick:"",axisLabelMouseMove:"",chartMouseMove:"",legendItemMouseMove:"",chartMouseLeave:"",displayTextRendering:"",toolTipInitialize:"",trackAxisToolTip:"",trackToolTip:"",animationComplete:"",zoomed:"",destroy:"",create:"",beforeResize:"",afterResize:"",rangeSelected:"",multiLevelLabelClick:"",multiLevelLabelRendering:"",margin:{left:10,right:10,top:10,bottom:10},size:{width:null,height:null},elementSpacing:10,dateStart:25568.791666666668},dataTypes:{commonSeriesOptions:{dataSource:"data"},axes:"array",series:"array",annotations:"array",indicators:"array",seriesColors:"array",palette:"array",rowDefinitions:"array",columnDefinitions:"array",seriesBorderColors:"array",pointColors:"array",pointBorderColors:"array",initSeriesRender:"boolean",theme:"enum",canResize:"boolean",isResponsive:"boolean",elementSpacing:"number",primaryXAxis:{labels:"array",multiLevelLabels:"array",stripLine:"array",orientation:"enum",rangePadding:"enum",labelPlacement:"enum",tickLinesPosition:"enum",labelPosition:"enum",opposedPosition:"boolean",zoomFactor:"number",zoomPosition:"number",showNextToAxisLine:"boolean"},primaryYAxis:{labels:"array",multiLevelLabels:"array",stripLine:"array",orientation:"enum",rangePadding:"enum",labelPlacement:"enum",opposedPosition:"boolean",zoomFactor:"number",zoomPosition:"number"},legend:{textOverflow:"enum",shape:"enum",alignment:"enum",position:"enum",itemPadding:"number"},exportSettings:{type:"string",fileName:"string",orientation:"enum",angle:"number",mode:"enum",action:"string",multipleExport:"boolean"},zooming:{enable:"boolean",type:"string",enableMouseWheel:"boolean",toolbarItems:"array",enableScrollbar:"boolean"},size:{width:"string",height:"string"}},observables:["xZoomFactor","yZoomFactor","xZoomPosition","yZoomPosition"],_tags:[{tag:"series",attr:["xAxisName","yAxisName","zOrder","endAngle","startAngle","explodeIndex","labelPosition","xName","yName","pointColorMappingName","pyramidMode","boxPlotMode","showMedian","pieCoefficient","explodeAll","explodeOffset","funnelWidth","columnFacet","funnelHeight","gapRatio","isClosed","isTransposed","isStacking","bearFillColor","bullFillColor","dataSource","enableAnimation","doughnutCoefficient","doughnutSize","enableSmartLabels","drawType","dashArray","visibleOnLegend","columnSpacing","columnWidth","drawType","positiveFill","explodeIndex","cornerRadius","lineCap","lineJoin","highlightSettings.enable","highlightSettings.mode","highlightSettings.pattern","highlightSettings.color","highlightSettings.opacity","highlightSettings.customPattern","highlightSettings.border.color","highlightSettings.border.width","selectionSettings.enable","selectionSettings.mode","selectionSettings.pattern","selectionSettings.color","selectionSettings.opacity","selectionSettings.customPattern","selectionSettings.type","selectionSettings.rangeType","selectionSettings.border.width","selectionSettings.border.color","dragSettings.enable","dragSettings.type","connectorLine.width","connectorLine.opacity","connectorLine.dashArray","cornerRadius.topLeft","cornerRadius.topRight","cornerRadius.bottomLeft","cornerRadius.bottomRight","errorBar.visibility","errorBar.mode","errorBar.type","errorBar.horizontalErrorValue","errorBar.verticalErrorValue","errorBar.horizontalPositiveErrorValue","errorBar.horizontalNegativeErrorValue","errorBar.verticalPositiveErrorValue","errorBar.verticalNegativeErrorValue","errorBar.direction","errorBar.cap.visible","errorBar.cap.width","errorBar.cap.length","errorBar.width","errorBar.opacity","emptyPointSettings.visible","emptyPointSettings.style.color","emptyPointSettings.style.border.color","emptyPointSettings.style.border.width","emptyPointSettings.displayMode","bubbleOptions.minRadius","bubbleOptions.maxRadius","bubbleOptions.radiusMode","tooltip.visible","tooltip.format","tooltip.template","tooltip.fill","tooltip.border.width","tooltip.border.color","tooltip.enableAnimation","tooltip.duration","tooltip.opacity","tooltip.font.size","tooltip.font.opacity","tooltip.font.fontFamily","tooltip.font.fontStyle","tooltip.font.fontWeight","tooltip.font.color","border.width","border.color","border.dashArray","marker.shape","marker.imageUrl","marker.size.width","marker.size.height","marker.visible","marker.opacity","marker.fill","marker.border.color","marker.border.width","marker.dataLabel.visible","marker.dataLabel.angle","marker.dataLabel.template","marker.dataLabel.textMappingName","marker.dataLabel.verticalTextAlignment","marker.dataLabel.horizontalTextAlignment","marker.dataLabel.textPosition","marker.dataLabel.shape","marker.dataLabel.opacity","marker.dataLabel.fill","marker.dataLabel.border.color","marker.dataLabel.border.width","marker.dataLabel.maximumLabelWidth","marker.dataLabel.enableWrap","marker.dataLabel.connectorLine.width","marker.dataLabel.connectorLine.type","marker.dataLabel.connectorLine.color","marker.dataLabel.offset","marker.dataLabel.offset.x","marker.dataLabel.offset.y","marker.dataLabel.font.size","marker.dataLabel.font.color","marker.dataLabel.font.opacity","marker.dataLabel.font.fontFamily","marker.dataLabel.font.fontStyle","marker.dataLabel.font.fontWeight","marker.dataLabel.margin","marker.dataLabel.margin.left","marker.dataLabel.margin.top","marker.dataLabel.margin.bottom","marker.dataLabel.margin.right","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color",[{tag:"trendlines",attr:["visibility","visibilityOnLegend","dashArray","forewardForecast","backwardForecast","polynomialOrder","tooltip.visible","tooltip.format","tooltip.fill","tooltip.border.width","tooltip.border.color","tooltip.enableAnimation","tooltip.duration","tooltip.opacity","tooltip.font.size","tooltip.font.opacity","tooltip.font.fontFamily","tooltip.font.fontStyle","tooltip.font.fontWeight","tooltip.font.color",],singular:"trendline"}],[{tag:"points",attr:["x","y","text","textMappingName","isEmpty","fill","visible"],singular:"points"}]],singular:"series"},{tag:"axes",attr:["columnIndex","rowIndex","desiredIntervals","isIndexed","labelPlacement","edgeLabelPlacement","intervalType","labelFormat","labelPosition","labelRotation","logBase","labelIntersectAction","opposedPosition","plotOffset","rangePadding","roundingPlaces","valueType","zoomFactor","zoomPosition","orientation","crossesAt","crossesInAxis","scrollbarSettings.visible","scrollbarSettings.canResize","scrollbarSettings.range.min","scrollbarSettings.range.max","scrollbarSettings.pointsLength","range.min","range.max","range.interval","tickLinesPosition","alternateGridBand.odd.fill","alternateGridBand.odd.opacity","alternateGridBand.even.fill","alternateGridBand.even.opacity","enableAutoIntervalOnZooming","majorGridLines.width","majorGridLines.dashArray","majorGridLines.visible","majorGridLines.opacity","majorTickLines.width","majorTickLines.size","majorTickLines.visible","minorGridLines.width","minorGridLines.dashArray","minorGridLines.visible","minorTickLines.width","minorTickLines.size","minorTickLines.visible","labelBorder.width","minorTicksPerInterval","columnSpan","crosshairLabel.visible","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","isInversed","enableTrim","maximumLabelWidth","axisLine.visible","axisLine.width","axisLine.dashArray","axisLine.offset","maximumLabels","title.text","title.visible","title.enableTrim","title.offset","title.alignment","title.position","title.maximumTitleWidth","title.font.size","title.font.opacity","title.font.fontFamily","title.font.fontStyle","title.font.fontWeight","additionalPadding","showNextToAxisLine",[{tag:"stripLine",attr:["borderColor","startFromAxis","zIndex","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color"],singular:"stripLine"}],[{tag:"multiLevelLabels",attr:["textOverflow","maximumTextWidth","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","border.type","border.width"],singular:"multiLevelLabel"}],],singular:"axis"},{tag:"primaryXAxis.stripLine",attr:["borderColor","startFromAxis","zIndex","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color"],singular:"primaryXAxis.stripLine"},{tag:"primaryYAxis.stripLine",attr:["borderColor","startFromAxis","zIndex","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color"],singular:"primaryYAxis.stripLine"},{tag:"primaryXAxis.multiLevelLabels",attr:["textOverflow","maximumTextWidth","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","border.type","border.width"],singular:"primaryXAxis.multiLevelLabel"},{tag:"primaryYAxis.multiLevelLabels",attr:["textOverflow","maximumTextWidth","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","border.type","border.width"],singular:"primaryYAxis.multiLevelLabel"},{tag:"indicators",attr:["seriesName","xName","xAxisName","macdType","shortPeriod","longPeriod","enableAnimation","yAxisName","standardDeviations","kPeriod","dPeriod","periodLine.fill","periodLine.width","lowerLine.fill","lowerLine.width","upperLine.fill","upperLine.width","macdLine.fill","macdLine.width","histogram.fill","histogram.opacity","histogram.border.color","histogram.border.width","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color","tooltip.visible","tooltip.format","tooltip.fill","tooltip.border.width","tooltip.border.color","tooltip.enableAnimation","tooltip.duration","tooltip.opacity",[{tag:"points",attr:[]}]],singular:"indicator"},{tag:"annotations",attr:["coordinateUnit","verticalAlignment","horizontalAlignment","xAxisName","yAxisName","margin.left","margin.right","margin.top","margin.bottom"],singular:"annotation"},{tag:"rowDefinitions",attr:["rowHeight","lineColor","lineWidth"],singular:"rowDefinition"},{tag:"columnDefinitions",attr:["columnWidth","lineColor","lineWidth"],singular:"columnDefinition"},],_xZoomFactor:t.util.valueFunction("xZoomFactor"),_yZoomFactor:t.util.valueFunction("yZoomFactor"),_xZoomPosition:t.util.valueFunction("xZoomPosition"),_yZoomPosition:t.util.valueFunction("yZoomPosition"),_init:function(){this._renderSfChart()},_destroy:function(){n("#template_group_"+this._id).remove();n("#annotation_group_"+this._id).remove();n(this.element).removeClass("e-chart e-js").find("#"+this.svgObject.id).remove();n(this.element).removeClass("e-chart e-js").find("#legend_"+this.svgObject.id).remove()},_series:function(){this.redraw();this._trigger("refresh")},_series_points:function(){this.redraw();this._trigger("refresh")},_primaryXAxis_stripLine:function(){this.redraw();this._trigger("refresh")},_primaryYAxis_stripLine:function(){this.redraw();this._trigger("refresh")},_axes:function(){this.redraw();this._trigger("refresh")},_axes_stripLine:function(){this.redraw();this._trigger("refresh")},_ignoreOnExport:["dataSource"],_removeZoomkit:function(){this.model.zooming.enable&&(n("[id^="+this._id+"_][id$=_ResetZoom]").remove(),n("[id^="+this._id+"_][id$=_PanBtn]").remove(),n("[id^="+this._id+"_][id$=_ZoomBtn]").remove(),n("[id^="+this._id+"_][id$=_ZoomInBtn]").remove(),n("[id^="+this._id+"_][id$=_ZoomOutBtn]").remove())},getCanvasElement:function(t){var f,o=n("#"+t),i=document.createElement("canvas"),e=i.getContext("2d"),r=n("#"+t+"_canvas").width(),u=n("#"+t+"_canvas").height();return i.setAttribute("width",r),i.setAttribute("height",u),f=n("#"+t+"_canvas")[0],e.drawImage(f,0,0,r,u),{canvasContainer:i,canvasArea:e,width:r,height:u}},getSVGElement:function(t){var r=n("#"+t+"_svg").width(),u=n("#"+t+"_svg").height(),f=document.getElementById(t+"_svg"),e=n("<div>").append(n(f).clone()).html(),o=document.getElementById("legend_"+t+"_svg"),i=n("#legend_"+t).position(),h=n("#"+t+"_svg_Legend").attr("transform","translate("+i.left+","+i.top+")"),s=n("<div>").append(n(o).clone()).html();return{chartSVG:e,legendChartSVG:s,width:r,height:u}},print:function(){for(var v,tt,u,t,it,at,r,s,et,k,rt,f,i,ot,e,o,c,l,a,y,p,d=[],g=[],w,b,vt,st=this.model.series.length,ut,ht="",h="",lt=0,nt=0;nt<arguments.length;nt++)if(c=n("#"+arguments[nt]),i=arguments[nt],c.hasClass("e-datavisualization-chart")){o=c.ejChart("instance");f="<html> <div style='position:relative; left:0px; top:"+lt+"px'>";ut="";ot=o.svgObject.id;lt=n("#"+ot).height()+50;n("#axisScrollbar_"+i)[0]&&(ut=n("#axisScrollbar_"+i)[0].innerHTML);var yt=["ResetZoom","PanBtn","ZoomBtn","ZoomOutBtn","ZoomInBtn"],ct=[],ft;for(r=0;r<5;r++)ft="#"+ot+"_"+yt[r],n(ft)[0]&&(ct.push(n(ft)),n(ft).remove());if(o.model.enableCanvasRendering==!0){for(e=this.getCanvasElement(i),vt=o.model.LegendBounds,h=document.createElement("img"),h.setAttribute("src",n("#legend_"+i+"_canvas")[0].toDataURL()),n("#legend_Scroller"+i).prepend(h),f+=document.getElementById("chartContainer_"+i).outerHTML,n(h).remove(),h="",t=0;t<st;t++)if(tt=o.model.series[t].selectionSettings.mode.toLowerCase(),o.model.AreaType!="none")if(tt=="series")n(c).find("#"+i+"_Selection_series"+t+"_canvas").length>0&&(l=n("#"+i+"_Selection_series"+t+"_canvas")[0],e.canvasArea.drawImage(l,0,0,e.width,e.height)),n(c).find("#"+i+"_Selection_Legend"+t+"_canvas").length>0&&(a=n("#"+i+"_Selection_Legend"+t+"_canvas")[0],h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>");else if(tt=="point"){for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n(c).find("#"+i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas").length>0&&(l=n("#"+i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas")[0],e.canvasArea.drawImage(l,0,0,e.width,e.height));n(c).find("#"+i+"_Selection_Legend"+t+"_canvas").length>0&&(a=n("#"+i+"_Selection_Legend"+t+"_canvas")[0],h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>")}else{for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n(c).find("#"+i+"_Selection_Cluster_point_"+u[r].pointIndex+"_canvas").length>0&&(l=n("#"+i+"_Selection_Cluster_point_"+u[r].pointIndex+"_canvas")[0],e.canvasArea.drawImage(l,0,0,e.width,e.height));n(c).find("#"+i+"_SelectionCluster_Legend"+t+"_canvas").length>0&&(a=n("#"+i+"_SelectionCluster_Legend"+t+"_canvas")[0],h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>")}else for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n("#"+i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas").length>0&&(l=document.getElementById(i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas"),e.canvasArea.drawImage(l,0,0,e.width,e.height),n("#"+i+"_Selection_Legend"+u[r].pointIndex+"_canvas").length>0&&(a=document.getElementById(i+"_Selection_Legend"+u[r].pointIndex+"_canvas"),h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>"));e.canvasArea.save();d.push(e.canvasContainer)}else{if(v=this.getSVGElement(i),n("#"+i+"_svg_Legend").removeAttr("transform"),f+=n("#chartContainer_"+i)[0].outerHTML,o.model.enable3D){for(ht="",t=0;t<st;t++)n("#Selectionseries"+t+"Segmentseries"+t).length>0&&(ht+=n("#Selectionseries"+t+"Segmentseries"+t)[0].outerHTML);f+=ht}else for(t=0;t<st;t++)if(tt=o.model.series[t].selectionSettings.mode.toLowerCase(),o.model.AreaType!="none")tt!="cluster"?n("#"+i+"SelectionSegmentseries"+t).length>0&&(y=document.getElementById(i+"SelectionSegmentseries"+t),w=n("<div>").append(n(y).clone()).html(),p=document.getElementById(i+"SelectionLegendSegmentseries"+t),b=n("<div>").append(n(p).clone()).html(),f+=w.toString()+b.toString()):n("#"+i+"SelectionSegmentClusterSeries"+t).length>0&&(y=document.getElementById(i+"SelectionSegmentClusterSeries"+t),w=n("<div>").append(n(y).clone()).html(),p=document.getElementById(i+"SelectionLegendSegmentClusterSeries"+t),b=n("<div>").append(n(p).clone()).html(),f+=w.toString()+b.toString());else for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n("#"+i+"SelectionSegmentseries"+t+"Point"+u[r].pointIndex).length>0&&(y=document.getElementById(i+"SelectionSegmentseries"+t+"Point"+u[r].pointIndex),w=n("<div>").append(n(y).clone()).html(),p=document.getElementById(i+"SelectionLegendSegmentseries"+t+"Point"+u[r].pointIndex),b=n("<div>").append(n(p).clone()).html(),f+=w.toString()+b.toString());o.model.backGroundImageUrl!=null&&(k=new Image,k.src=o.model.backGroundImageUrl,it=document.createElement("canvas"),at=it.getContext("2d"),it.setAttribute("width",v.width),it.setAttribute("height",v.height),at.drawImage(k,0,0,v.width,v.height),f+="<img src='"+it.toDataURL()+"'/>");f+='<svg xmlns="http://www.w3.org/2000/svg" style="left:0px; top:0px; position:absolute;" width="'+v.width+'" height="'+v.height+'" >';f+=v.chartSVG.toString()+" <\/svg>";f+=ut+"<\/div><\/html>";g.push(f)}for(r=0;r<ct.length;r++)n("#chartContainer_"+i).append(ct[r])}else f="<html>",f+=document.getElementById(arguments[nt]).innerHTML,f+="<\/html>",g.push(f);for(s=window.open(),et=0;et<g.length;et++)s.document.write(g[et]);if(d.length>0){for(k=new Image,rt=0;rt<d.length;rt++)f+="<img src='"+d[rt].toDataURL()+"'/>",k.src=d[rt].toDataURL();f+=h;f+=ut+"<\/div><\/html>";k.onload=function(){s.document.write(f);f="";s.document.close();s.focus();s.print();s.close()}}else g.length>0&&(f="",s.document.close(),s.focus(),s.print(),s.close())},redraw:function(i,r,u,f){var o,s,e;if(this.model.enableCanvasRendering)this.model.zooming.enable&&this.svgRenderer.ctx?this.svgRenderer.ctx.clearRect(0,0,n("#"+this._id).width(),n("#"+this._id).height()):(n(this.svgObject).remove(),o=this.svgWidth,n("#canvas_trackSymbol").remove(),n("#"+this._id+"_canvas_Tracker").remove(),n("#secondCanvas").remove(),this.svgRenderer=new t.EjCanvasRender(this.element),this.svgRenderer.svgObj.height=t.util.isNullOrUndefined(this.model.size.height)?"450":this.model.size.height,this.svgRenderer.svgObj.width=t.util.isNullOrUndefined(this.model.size.width)?o:this.model.size.width,this.svgObject=this.svgRenderer.svgObj,s=this.svgRenderer.svgObj.getContext("2d"),n(this.scrollerContainer).remove(),n(this.legendSvgContainer).remove(),n(this.legendContainer).remove(),this.legendContainer=n("<div><\/div>").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=n("<div><\/div>").attr("id","legend_Scroller"+this._id).css("height","0px"),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),n(this.scrollerContainer).appendTo(this.legendContainer),n(this.legendContainer).appendTo(this.chartContainer));else if(this.svgObject.id.indexOf("_canvas")!=-1)this._removeZoomkit(),n(this.svgObject).remove(),this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this.canvasX=this.canvasY=0,n(this.scrollerContainer).remove(),n(this.legendSvgContainer).remove(),n(this.legendContainer).remove(),this.legendContainer=n("<div><\/div>").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=n("<div><\/div>").attr("id","legend_Scroller"+this._id).css("height","0px"),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),n(this.scrollerContainer).appendTo(this.legendContainer),n(this.legendContainer).appendTo(this.chartContainer);else if(!this.dragPoint||!r&&(!this.panning||!u||this.scrollbarUpdate||f||this.panning&&this.model.browserInfo.name!="chrome")||this.model.enable3D)n(this.svgObject).empty(),n(this.legendSvgContainer).empty();else{for(e=this.svgObject,this.chartUpdating=!0,!this.continuePinching&&u&&(u.id="",u.setAttribute("opacity",0),e.appendChild(u),this.continuePinching=!1);e.childNodes.length>1;)e.removeChild(e.firstChild);n(this.legendSvgContainer).empty()}n("#annotation_group_"+this._id).remove();i||(this.model.canResize||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents());this.bindTo(i)},"export":function(n,i,r){var u,f=this.model.exportSettings,n=t.util.isNullOrUndefined(n)?f.type:n.toLowerCase(),i=t.util.isNullOrUndefined(i)?f.action:i.toLowerCase();return n=="xlsx"?this.excelExport(n,i,r):u=n!="svg"&&this.model.enableCanvasRendering?this.imageExport():this.svgExport(),u},excelExport:function(i,r,u){var o=n.extend(!0,{},this.model),a=this.model.exportSettings,u=t.util.isNullOrUndefined(i)?a.multipleExport:u,v={action:r,method:"post"},s=t.buildTag("form","",null,v),f,y=this,e,h,c,l;if(o.event=null,this._ignoreOnExport)for(f=o.series,e=0;e<f.length;e++)delete f[e].dataSource,delete f[e].query,f[e].fill=jQuery.type(f[e].fill)=="array"?f[e].fill[0].color:f[e].fill;return t.raiseWebFormsServerEvents?(this.raiseWebServerEvents(JSON.stringify(o),"excelExporting"),this.raiseWebServerEvents(JSON.stringify(o))):(u?(h={},n("body").find(".e-datavisualization-chart").each(function(i,r){var o=n(r).data("ejChart"),e,u,c,l;if(!t.isNullOrUndefined(o)&&(o.model.event=null,e=JSON.parse(JSON.stringify(o.model)),y._ignoreOnExport)){for(f=e.series,u=0;u<f.length;u++)delete f[u].dataSource,delete f[u].query,f[u].fill=jQuery.type(f[u].fill)=="array"?f[u].fill[0].color:f[u].fill;h[i]=JSON.stringify(e);c={name:"ChartModel",type:"hidden",value:JSON.stringify(e)};l=t.buildTag("input","",null,c);s.append(l)}})):(c={name:"ChartModel",type:"hidden",value:JSON.stringify(o)},l=t.buildTag("input","",null,c),s.append(l),s.append(this)),n("body").append(s),s.submit()),!0},imageExport:function(){var b=n.extend(!0,{},this.model),k,a,d,g,nt,tt;b.event=null;var s=this._id,v=n("[id*="+s+"_Selection_]"),y=n("#legend_"+s+"_canvas")[0],h=this.model.exportSettings,e=h.angle,u,i,o,f,p,r=this.model.LegendBounds,it,c,w,l=this.getCanvasElement(s);for(u=l.canvasContainer,i=l.canvasArea,o=l.width,f=l.height,p=n("#"+s+"_canvas")[0],u.setAttribute("id","Export_"+s),e==0?(r=this.model.LegendBounds,r.X&&r.Width!=0&&r.Height!=0&&i.drawImage(y,r.X,r.Y)):e==90||e==-90?(u.setAttribute("width",f),u.setAttribute("height",o),i.save(),i.translate(f/2,o/2),i.rotate(e*Math.PI/180),i.drawImage(p,-o/2,-f/2),i.restore(),r.X&&(i.save(),e==90?i.translate(f-r.Y-r.Height/2,o-r.X-r.Width/2):i.translate(r.Y+r.Height/2,r.X+r.Width/2),i.rotate(e*Math.PI/180),i.drawImage(y,-r.Width/2,-r.Height/2),i.restore())):(u.setAttribute("width",o),u.setAttribute("height",f),i.save(),i.translate(o,f),i.rotate(Math.PI/1),i.drawImage(p,0,0),i.restore(),r.X&&(i.save(),i.translate(r.X+r.Width/2,f-r.Y-r.Height/2),i.rotate(e*Math.PI/180),i.drawImage(y,-r.Width/2,-r.Height/2),i.restore())),c=0;c<v.length;c++)it=document.getElementById(v[c].id).getBoundingClientRect(),i.drawImage(v[c],0,0);if(w=h.type=="jpg"?u.toDataURL("image/jpeg"):u.toDataURL(),h.mode=="client")return u;t.raiseWebFormsServerEvents?this.raiseWebServerEvents(w):h.mode=="server"&&(k={action:h.action,method:"post"},a=t.buildTag("form","",null,k),d={name:"ChartModel",type:"hidden",value:JSON.stringify(b)},g=t.buildTag("input","",null,d),nt={name:"Data",type:"hidden",value:w},tt=t.buildTag("input","",null,nt),a.append(g).append(tt).append(this),n("body").append(a),a.submit())},svgExport:function(){var p=this.svgObject.id,h=n.extend(!0,{},this.model),a,o,v,y;h.event=null;var w=this._id,r=this.getSVGElement(w),u=this.model.exportSettings,s=u.angle,c=r.height,f=r.chartSVG,e=r.legendChartSVG,l=r.width,i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">';if(i=s==0?i+f.toString()+e.toString()+"<\/svg>":s==90?i+'<g transform="translate('+c+',0) rotate(90 0 0)">'+f.toString()+e.toString()+"<\/g><\/svg>":s==-90?i+'<g transform="translate(0,'+l+') rotate(-90 0 0)">'+f.toString()+e.toString()+"<\/g><\/svg>":i+'<g transform="translate('+l+","+c+') rotate(180 0 0)">'+f.toString()+e.toString()+"<\/g><\/svg>",i=encodeURIComponent(i),n("#"+p+"_Legend").removeAttr("transform"),u.mode=="client")return i;t.raiseWebFormsServerEvents?this.raiseWebServerEvents(i):u.mode=="server"&&(a={action:u.action,method:"post"},o=t.buildTag("form","",null,a),chartModel={name:"ChartModel",type:"hidden",value:JSON.stringify(h)},input1=t.buildTag("input","",null,chartModel),v={name:"Data",type:"hidden",value:i},y=t.buildTag("input","",null,v),o.append(y).append(input1).append(this),n("body").append(o),o.submit())},raiseWebServerEvents:function(i,r){var f=n.extend(!0,{},this.model),u=this.model.exportSettings,r=t.util.isNullOrUndefined(r)?"exporting":r;args={model:f,originalEventType:r};clientArgs={Data:i,Format:u.type,Orientation:u.orientation,FileName:u.fileName};t.raiseWebFormsServerEvents(r,args,clientArgs)},animate:function(n){var i,u,r,t;if(n)if(n.constructor===Array)for(t=0;t<n.length;t++)n[t]._animatedSeries=!1,n[t]._animatedTrendline=!1,n[t].AnimationComplete=!1;else n._animatedSeries=!1,n._animatedTrendline=!1,n.AnimationComplete=!1;else{for(i=this.model.series,t=0;t<i.length;t++)i[t]._animatedSeries=!1,i[t]._animatedTrendline=!1,i[t].AnimationComplete=!1;for(u=this.model.indicators,r=0;r<u.length;r++)u[r]._animatedSeries=!1,u[r]._animatedTrendline=!1}this.redraw()},_setModel:function(i){var e,f,u,o,s,r,h;for(u in i){this.disableAnimation();switch(u){case"theme":for(this.model._themeChanged=!0,this.model.theme=i[u],this.setTheme(t.EjSvgRender.themes,this.model.theme),n.extend(!0,this.model.primaryXAxis,t.EjSvgRender.themes[this.model.theme].primaryXAxis),n.extend(!0,this.model.primaryYAxis,t.EjSvgRender.themes[this.model.theme].primaryYAxis),o=0;o<this.model.axes.length;o++)this.model.axes[o].orientation&&this.model.axes[o].orientation.toLowerCase()=="horizontal"?n.extend(!0,this.model.axes[o],t.EjSvgRender.themes[this.model.theme].secondaryX):n.extend(!0,this.model.axes[o],t.EjSvgRender.themes[this.model.theme].secondaryY);for(s=0;s<this.model.series.length;s++)n.extend(!0,this.model.series[s],t.EjSvgRender.themes[this.model.theme].commonSeriesOptions);break;case"commonSeriesOptions":for(r=0;r<this.model.series.length;r++)i[u].dataSource&&(this.model.series[r].dataSource=null),n.extend(!0,this.model.series[r],{},i[u]);break;case"series":for(e=this.model.series,r=0;r<e.length;r++)i[u][r].dataSource&&(e[r].dataSource=null);for(n.extend(!0,e,{},i[u]),r=0,h=e.length;r<h;r++)e[r].enableAnimation&&(e[r]._animatedSeries=!1),i[u][r]&&i[u][r].dataSource instanceof t.DataManager&&(e[r].dataSource=i[u][r].dataSource),i[u][r]&&i[u][r].query instanceof t.Query&&(e[r].query=i[u][r].query);break;case"legend":n.extend(!0,this.model.legend,{},i[u]);break;case"axes":n.extend(!0,this.model.axes,{},i[u]);break;case"primaryXAxis":this.model.primaryXAxis.setRange=i[u].range?!0:!1;this.model.primaryXAxis.setAxisInterval=i[u].range&&i[u].range.interval?!0:this.model.primaryXAxis.setAxisInterval;this.model.primaryXAxis.actual_Range=this.model._axes[0].setRange?null:this.model._axes[0].actual_Range;n.extend(!0,this.model.primaryXAxis,{},i[u]);break;case"primaryYAxis":this.model.primaryYAxis.setRange=i[u].range?!0:!1;this.model.primaryYAxis.log_Range=i[u].range?i[u].range:this.model.primaryYAxis.log_Range;this.model.primaryYAxis.actual_Range=this.model._axes[1].setRange?null:this.model._axes[1].actual_Range;n.extend(!0,this.model.primaryYAxis,{},i[u]);break;case"xZoomFactor":for(this.model.primaryXAxis.zoomFactor=this._xZoomFactor(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="horizontal"&&(f[r].zoomFactor=this._xZoomFactor());break;case"yZoomFactor":for(this.model.primaryYAxis.zoomFactor=this._yZoomFactor(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="vertical"&&(f[r].zoomFactor=this._yZoomFactor());break;case"xZoomPosition":for(this.model.primaryXAxis.zoomPosition=this._xZoomPosition(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="horizontal"&&(f[r].zoomPosition=this._xZoomPosition());break;case"yZoomPosition":for(this.model.primaryYAxis.zoomPosition=this._yZoomPosition(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="vertical"&&(f[r].zoomPosition=this._yZoomPosition());break;case"drilldown":this.model.series=[];this.model.explodeValue=null;n.extend(!0,this.model,{},i[u]);break;case"datasource":for(r=0;r<this.model.series.length;r++)this.model.series[r].dataSource=null,this.model.series[r].points=null;n.extend(!0,this.model,{},i[u]);break;case"chartArea":n.extend(!0,this.model.chartArea,{},i[u]);break;default:for(n.extend(!0,this.model,{},i[u]),e=this.model.series,r=0,h=e.length;r<h;r++)e[r].enableAnimation&&(e[r]._animatedSeries=!1)}}this.model.canResize||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents();n("#annotation_group_"+this._id).remove();this.model.enableCanvasRendering?(n(this.svgObject).remove(),n("#canvas_trackSymbol").remove(),n("#"+this._id+"_canvas_Tracker").remove(),n("#secondCanvas").remove(),this.svgRenderer=new t.EjCanvasRender(this.element),this.svgRenderer.svgObj.height=t.util.isNullOrUndefined(this.model.size.height)?"450":this.model.size.height,this.svgRenderer.svgObj.width=t.util.isNullOrUndefined(this.model.size.width)?n("#"+this._id).width():this.model.size.width,this.svgObject=this.svgRenderer.svgObj,n(this.legendSvgContainer).remove(),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element),this.svgRenderer.append(this.legendSvgContainer,this.legendContainer)):this.svgObject.id.indexOf("_canvas")!=-1?(this._removeZoomkit(),n(this.svgObject).remove(),this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this.canvasX=this.canvasY=0,n(this.legendSvgContainer).remove(),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.svgRenderer.append(this.legendSvgContainer,this.legendContainer)):this.chartUpdating||(n(this.svgObject).empty(),n(this.legendSvgContainer).empty());this.bindTo()}});t.datavisualization.Chart.Locale=t.datavisualization.Chart.Locale||{};t.datavisualization.Chart.Locale["default"]=t.datavisualization.Chart.Locale["en-US"]={zoomIn:"Zoom In",zoomOut:"Zoom Out",zoom:"Zoom",pan:"Pan",reset:"Reset"};t.datavisualization.Chart.CrosshairType={Crosshair:"crosshair",TrackBall:"trackBall"};t.datavisualization.Chart.TrackballDisplayMode={Float:"float",Grouping:"grouping"};t.datavisualization.Chart.VisibleOnLegend={Visible:"visible",Hidden:"hidden"};t.datavisualization.Chart.ExportingType={PNG:"png",JPG:"jpg",PDF:"pdf",SVG:"svg",DOCX:"docx",XLSX:"xlsx"};t.datavisualization.Chart.ExportingMode={Client:"client",Server:"server"};t.datavisualization.Chart.ExportingOrientation={Portrait:"portrait",Landscape:"landscape"};t.datavisualization.Chart.ValueType={Double:"double",DateTime:"datetime",Category:"category",Logarithmic:"logarithmic",DateTimeCategory:"datetimecategory"};t.datavisualization.Chart.TextOverflow={None:"none",Wrap:"wrap",Trim:"trim",WrapAndTrim:"wrapandtrim"};t.datavisualization.Chart.Type={Line:"line",Spline:"spline",Column:"column",Doughnut:"doughnut",Area:"area",SplineArea:"splinearea",StepLine:"stepline",StepArea:"steparea",Pie:"pie",PieOfPie:"pieofpie",Hilo:"hilo",HiloOpenClose:"hiloopenclose",Candle:"candle",Bubble:"bubble",Scatter:"scatter",Bar:"bar",StackingArea:"stackingarea",StackingArea100:"stackingarea100",RangeColumn:"rangecolumn",StackingColumn:"stackingcolumn",StackingColumn100:"stackingcolumn100",StackingBar:"stackingbar",StackingBar100:"stackingbar100",Pyramid:"pyramid",Funnel:"funnel",Polar:"polar",Radar:"radar",RangeArea:"rangearea",Waterfall:"waterfall",BoxAndWhishker:"boxandwhisker"};t.datavisualization.Chart.SplitMode={Position:"position",Value:"value",Percentage:"percentage",Indexes:"indexes"};t.datavisualization.Chart.DragType={XY:"xy",X:"x",Y:"y"};t.datavisualization.Chart.LabelPlacement={BetweenTicks:"betweenTicks",OnTicks:"onTicks"};t.datavisualization.Chart.TrendlinesType={Linear:"linear",Exponential:"exponential",Logarithmic:"logarithmic",Power:"power",Polynomial:"polynomial"};t.datavisualization.Chart.ErrorBarType={FixedValue:"fixedValue",Percentage:"percentage",StandardDeviation:"standardDeviation",StandardError:"standardError",Custom:"custom"};t.datavisualization.Chart.ErrorBarMode={Both:"both",Vertical:"vertical",Horizontal:"horizontal"};t.datavisualization.Chart.ErrorBarDirection={Both:"both",Plus:"plus",Minus:"minus"};t.datavisualization.Chart.LabelIntersectAction={None:"none",Rotate90:"rotate90",Rotate45:"rotate45",Wrap:"wrap",WrapByword:"wrapByWord",Trim:"trim",Hide:"hide",MultipleRows:"multipleRows"};t.datavisualization.Chart.EdgeLabelPlacement={None:"none",Shift:"shift",Hide:"hide"};t.datavisualization.Chart.roundedCorner={Both:"both",Start:"start",End:"end"};t.datavisualization.Chart.Theme={Azure:"azure",FlatLight:"flatlight",Azuredark:"azuredark",Lime:"lime",LimeDark:"limedark",Saffron:"saffron",SaffronDark:"saffrondark",GradientLight:"gradientlight",GradientDark:"gradientdark",HighContrast01:"highcontrast01",HighContrast02:"highcontrast02",Material:"material",Office365:"office365",Bootstrap:"bootstrap"};t.datavisualization.Chart.FontStyle={Normal:"normal",Italic:"italic"};t.datavisualization.Chart.FontWeight={Regular:"regular",Bold:"bold",Lighter:"lighter"};t.datavisualization.Chart.IntervalType={Auto:"auto",Days:"days",Hours:"hours",Seconds:"seconds",Milliseconds:"milliseconds",Minutes:"minutes",Months:"months",Years:"years"};t.datavisualization.Chart.RangePadding={Additional:"additional",Normal:"normal",None:"none",Round:"round",Auto:"auto"};t.datavisualization.Chart.TextAlignment={MiddleTop:"middletop",MiddleCenter:"middlecenter",MiddleBottom:"middlebottom"};t.datavisualization.Chart.LabelPosition={Inside:"inside",Outside:"outside"};t.datavisualization.Chart.ZIndex={Over:"over",Behind:"behind"};t.datavisualization.Chart.Unit={percentage:"percentage",pixel:"pixel"};t.datavisualization.Chart.PyramidMode={Linear:"linear",Surface:"Surface"};t.datavisualization.Chart.DrawType={Line:"line",Column:"column",Area:"area"};t.datavisualization.Chart.columnFacet={Rectangle:"rectangle",Cylinder:"cylinder"};t.datavisualization.Chart.EmptyPointMode={Gap:"gap",Zero:"zero",Average:"average"};t.datavisualization.Chart.Pattern={None:"none",Chessboard:"chessboard",Crosshatch:"crosshatch",Dots:"dots",Pacman:"pacman",DiagonalBackward:"diagonalBackward",DiagonalForward:"diagonalForward",Grid:"grid",Turquoise:"turquoise",Star:"star",Triangle:"triangle",Circle:"circle",Tile:"tile",HorizontalDash:"horizontalDash",VerticalDash:"verticalDash",Rectangle:"rectangle",Box:"box",VerticalStripe:"verticalStripe",HorizontalStripe:"horizontalStripe",Bubble:"bubble",Custom:"custom"};t.datavisualization.Chart.Mode={Series:"series",Point:"point",Cluster:"cluster",Range:"range"};t.datavisualization.Chart.SelectionType={Single:"single",Multiple:"multiple"};t.datavisualization.Chart.Shape={None:"none",LeftArrow:"leftarrow",RightArrow:"rightarrow",Circle:"circle",Cross:"cross",HorizLine:"horizline",VertLine:"vertLine",Diamond:"diamond",Rectangle:"rectangle",Triangle:"triangle",InvertedTriangle:"invertedtriangle",Hexagon:"hexagon",Pentagon:"pentagon",Star:"star",Ellipse:"ellipse",Wedge:"wedge",Trapezoid:"trapezoid",UpArrow:"uparrow",DownArrow:"downarrow",Image:"image"};t.datavisualization.Chart.DrawMode={Both:"both",Open:"open",Close:"close"};t.datavisualization.Chart.LineCap={Butt:"butt",Round:"round",Square:"square"};t.datavisualization.Chart.LineJoin={Round:"round",Bevel:"bevel",Miter:"miter"};t.datavisualization.Chart.Position={Top:"top",Middle:"middle",Bottom:"bottom"};t.datavisualization.Chart.Alignment={Center:"center",Near:"near",Far:"far"};t.datavisualization.Chart.TickLinesPosition={Inside:"inside",Outside:"outside"};t.datavisualization.Chart.CoordinateUnit={None:"none",Pixels:"pixels",Points:"points"};t.datavisualization.Chart.HorizontalAlignment={Left:"left",Right:"right",Middle:"middle"};t.datavisualization.Chart.VerticalAlignment={Top:"top",Bottom:"bottom",Middle:"middle"};t.datavisualization.Chart.Region={Chart:"chart",Series:"series"};t.datavisualization.Chart.ConnectorLineType={Line:"line",Bezier:"bezier"};t.datavisualization.Chart.HorizontalTextAlignment={Near:"near",Far:"far",Center:"center"};t.datavisualization.Chart.VerticalTextAlignment={Near:"near",Far:"far",Center:"center"};t.datavisualization.Chart.multiLevelLabelsBorderType={None:"none",Rectangle:"rectangle",WithoutTopAndBottom:"withouttopandbottom",Brace:"brace",CurlyBrace:"curlybrace"};t.datavisualization.Chart.MACDType={Line:"line",Histogram:"histogram",Both:"both"};t.datavisualization.Chart.IndicatorsType={RSI:"rsi",Momentum:"momentum",Bollingerband:"bollingerband",Accumulationdistribution:"accumulationdistribution",EMA:"ema",SMA:"sma",Stochastic:"stochastic",ATR:"atr",MACD:"macd",TMA:"tma"};t.datavisualization.Chart.BoxPlotMode={Normal:"normal",Exclusive:"exclusive",Inclusive:"inclusive"};t.datavisualization.Chart.BubbleRadiusMode={MinMax:"minmax",Auto:"auto"};n.extend(t.datavisualization.Chart.prototype,t.ejChart)}(jQuery,Syncfusion);ej.EjSvgScrollbarRender=function(n,t){var i,r;this.svgSupport=window.SVGSVGElement?!0:!1;i=jQuery(n).attr("id");this.scrollsvgObj=this.scrollsvgObj?this.scrollsvgObj:[];this.svgSupport?(this.svgLink="http://www.w3.org/2000/svg",this.scrollsvgObj[t.index]=document.createElementNS(this.svgLink,"svg"),this.scrollsvgObj[t.index].setAttribute("id","scrollbar_"+i+t.index)):(r=document,this.scrollsvgObj[t.index]=r.createElement("div"),this.scrollsvgObj[t.index].style.position="relative",this.scrollsvgObj[t.index].setAttribute("id","scrollbar_"+i+t.index))},function(n){ej.EjSvgScrollbarRender.prototype={_initializeScrollbarVariables:function(n){n.offsetLeftX=0;n.rectWidth=n.offsetRightX=n.oldWidth=n.width;n.startX=0;n.endX=0;n.scrollbarLoaded=!1;(n.zoomPosition||n.zoomFactor)&&(n.offsetLeftX=n.zoomPosition*n.width,n.rectWidth=n.zoomFactor*n.width)},_scrollbarUpdate:function(n){var o=parseFloat(n.width),t=15,u=44,e=o-30,r,i,f;n.offsetLeftX=n.scrollbarLoaded?n.offsetLeftX-t:n.offsetLeftX;n.offsetLeftX=n.offsetLeftX<t?0:n.offsetLeftX;r=n.offsetLeftX/n.oldWidth*e+t;i=n.rectWidth/n.oldWidth*e;isMinWidth=i<u;n._diff=isMinWidth?u-i:0;i=i>u?i:u;n.oldWidth=e;f=r+i;n.rectWidth=i;n.offsetLeftX=n.startX=r;n.offsetRightX=f-t<=r?f+t:f;n.endX=n.width-n.offsetRightX;n.startX=r<t?t:r;r+i>n.width-t&&(n.offsetLeftX=n.startX=n.width-t-i,n.offsetRightX=n.width-t,n.endX=n.width-n.offsetRightX);n.scrollbarLoaded=!0},_renderScrollbar:function(t){var u,r,o,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,v;this.scrollsvgObj=this.scrollsvgObj?this.scrollsvgObj:[];n(this.scrollsvgObj[t.index]).empty();this.scrollsvgObj[t.index]&&n(document).find("[id*= "+this.scrollsvgObj[t.index].id+"]").attr("height","0px");var i=this._id,e=15,s=18,c=44;this.scrollsvgObj[t.index]=this.scrollbarContainer.scrollsvgObj[t.index];var l=17,f=parseFloat(t.width),y=8,p=l/2,h=f-e*2;t.offsetLeftX=t.scrollbarLoaded?t.offsetLeftX-e:t.offsetLeftX;t.offsetLeftX=t.offsetLeftX<e?0:t.offsetLeftX;u=t.offsetLeftX/t.oldWidth*h+e;r=t.rectWidth/t.oldWidth*h;isMinWidth=r<c;t._diff=isMinWidth?c-r:0;r=r>c?r:c;t.oldWidth=h;u=u+r>h?h-(r-e):u;o=u+r;t.rectWidth=r;t.offsetLeftX=t.startX=u;t.offsetRightX=u+r;t.endX=t.width-t.offsetRightX;t.scrollbarLoaded=!0;o=o-e<=u?o+e:o;w=this.padding||0;b=this.vmlRendering?-5:0;this.scrollbar=t.orientation=="horizontal"?this.renderer.createGroup({id:i+"_scrollbar_"+t.index,transform:"translate("+w+","+b+")"}):this.renderer.createGroup({id:i+"_scrollbar_"+t.index,transform:"translate(0,"+t.width+") rotate(270)"});var ot=function(n,t,i,r,u,f){var e=" ",c="M",h="h",o="v",s="a",l="z",a=f.orientation,v=f.opposed;return a=="vertical"&&!v||v&&a!="vertical"?c+e+n+e+u+e+o+e+(r-u)+e+h+e+i+e+o+e+(u-r)+e+s+e+u+e+u+e+0+e+0+e+0+e+-u+e+-u+e+h+e+-(i-2*u)+e+s+e+u+e+u+e+0+e+0+e+0+e+-4+e+u+e+l:c+e+n+e+t+e+o+e+(r-u)+e+s+e+u+e+u+e+0+e+0+e+0+e+u+e+u+e+h+e+(i-2*u)+e+s+e+u+e+u+e+0+e+0+e+0+e+u+e+-u+e+o+e+(u-r)+e+l},st=ot(0,0,f,s,4,t),a={id:i+"_scrollbarBackRect_"+t.index,"stroke-width":1,height:s,width:f,"stroke-linejoin":"round",stroke:"#B4B4B4",fill:"#F7F7F7","class":"e-rangeScroll-backRect"};this.vmlRendering?this.renderer.drawRect(a,this.scrollbar):(a.d=st,this.renderer.drawPath(a,this.scrollbar));k={id:i+"_scrollbarRightRect_"+t.index,"stroke-width":1,x:f-5,height:s,width:5,"stroke-linejoin":"round",stroke:"transparent",fill:"transparent"};this.renderer.drawRect(k,this.scrollbar);d={id:i+"_scrollbarLeftRect_"+t.index,"stroke-width":1,x:0,height:s,width:5,"stroke-linejoin":"round",stroke:"transparent",fill:"transparent"};this.renderer.drawRect(d,this.scrollbar);g={id:i+"_scrollbarLeftArrow_"+t.index,"stroke-width":1,stroke:"#999999",d:"M 5 9 L 10 14 L 10 "+3.5+" Z",fill:"#999999","class":"e-rangeScroll-arrow"};this.renderer.drawPath(g,this.scrollbar);nt={id:i+"_scrollbarRightArrow_"+t.index,"stroke-width":1,stroke:"#999999",d:"M "+(f-5)+" 9 L "+(f-10)+" 14 L "+(f-10)+" "+3.5+" Z",fill:"#999999","class":"e-rangeScroll-arrow"};this.renderer.drawPath(nt,this.scrollbar);tt={id:i+"_scrollbarSelect_"+t.index,x:u,y:0,width:r,rx:4,ry:4,height:l,stroke:"#999999","stroke-width":1,fill:"#CECECE","class":"e-rangeScroll-select"};this.renderer.drawRect(tt,this.scrollbar);this.centerLine=this.renderer.createGroup({id:i+"_scrollbarCenterLine_"+t.index,transform:"translate("+(u+r/2-7.5)+")"});it={id:i+"_scrollbarCenterShape_"+t.index,"stroke-width":1,stroke:"#999999",d:"M 0 "+3.5+" L 0 "+13.5+" ZM 5 "+3.5+" L 5 "+13.5+" ZM 10 "+3.5+" L 10 "+13.5+" ZM 15 "+3.5+" L 15 "+13.5+" Z",fill:"#999999","class":"e-rangeScroll-centerShape"};this.renderer.drawPath(it,this.centerLine);this.renderer.append(this.centerLine,this.scrollbar);rt={id:i+"_leftHeaderHideRect_"+t.index,x:u,y:0,width:11,height:17,fill:"transparent",opacity:0,"stroke-width":1,"class":"e-rangeScroll-leftRect"};this.renderer.drawRect(rt,this.scrollbar);ut={id:i+"_scrollbarLeftHeader_"+t.index,cx:u+y,cy:p,r:3,fill:"#999999",stroke:"#999999","stroke-width":1,"class":"e-rangeScroll-leftCircle"};this.renderer.drawCircle(ut,this.scrollbar);ft={id:i+"_rightHeaderHideRect_"+t.index,x:o-11,y:0,width:11,height:l,fill:"transparent",opacity:0,"stroke-width":1,"class":"e-rangeScroll-rightRect"};this.renderer.drawRect(ft,this.scrollbar);et={id:i+"_scrollbarRightHeader_"+t.index,fill:"#999999",cx:o-y,cy:p,r:3,stroke:"#999999","stroke-width":1,"class":"e-rangeScroll-rightCircle"};this.renderer.drawCircle(et,this.scrollbar);this.renderer.append(this.scrollbar,this.scrollsvgObj[t.index]);t.orientation=="horizontal"?(this.scrollsvgObj[t.index].setAttribute("height",s),this.scrollsvgObj[t.index].setAttribute("width",f)):(this.scrollsvgObj[t.index].setAttribute("height",f),this.scrollsvgObj[t.index].setAttribute("width",s));this.renderer.append(this.scrollsvgObj[t.index],t.parent);v=this.vmlRendering?t.y+5:t.y;this.pluginName=="ejRangeNavigator"?this.scrollsvgObj[t.index].setAttribute("style","overflow:visible;position:relative;display:block; top:"+(v-t.y)+"px;left:"+t.x+"px"):this.scrollsvgObj[t.index].setAttribute("style","overflow:visible;position:absolute;display:block; top:"+v+"px;left:"+t.x+"px");n("#"+i+"_scrollbarSelect_"+t.index).css({cursor:"pointer"});t.enableResize?(n("#"+i+"_leftHeaderHideRect_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"}),n("#"+i+"_rightHeaderHideRect_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"}),n("#"+i+"_scrollbarRightHeader_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"}),n("#"+i+"_scrollbarLeftHeader_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"})):(n("#"+i+"_leftHeaderHideRect_"+t.index).hide(),n("#"+i+"_rightHeaderHideRect_"+t.index).hide(),n("#"+i+"_scrollbarLeftHeader_"+t.index).hide(),n("#"+i+"_scrollbarRightHeader_"+t.index).hide());this.vmlRendering&&(n("#"+i+"_leftHeaderHideRect_"+t.index).css("visibility","hidden"),n("#"+i+"_rightHeaderHideRect_"+t.index).css("visibility","hidden"));this.scrollbarContainer._bindScrollEvents.call(this,t)},_bindScrollEvents:function(t){function e(t){this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"mousedown",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"mousedown",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"mousedown",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"mousedown",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"mousedown",this.scrollbarContainer._leftArrowDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"mouseup",this.scrollbarContainer._leftArrowUp);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"mousedown",this.scrollbarContainer._rightArrowDown);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"mouseup",this.scrollbarContainer._rightArrowUp);this._on(n("#"+i+"_scrollbarSelect_"+t.index),"mousedown",this.scrollbarContainer._scrollSelectRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"mousedown",this.scrollbarContainer._scrollBackRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"mouseup",this.scrollbarContainer._scrollBackRectUp);this._on(n(window),"mousemove",this.scrollbarContainer._scrollbarMove);this._on(n(window),"mouseup",this.scrollbarContainer._scrollbarUp);this._on(n(this.svgObject),"mousemove",this.scrollbarContainer._scrollbarMove);this._on(n(this.scrollsvgObj[t.index]),"mousemove",this.scrollbarContainer._scrollbarMove);this._on(n(this.scrollsvgObj[t.index]),"mouseup",this.scrollbarContainer._scrollbarUp)}function o(t){this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"touchstart",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"touchstart",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"touchstart",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"touchstart",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"touchstart",this.scrollbarContainer._leftArrowDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"touchend",this.scrollbarContainer._leftArrowUp);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"touchstart",this.scrollbarContainer._rightArrowDown);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"touchend",this.scrollbarContainer._rightArrowUp);this._on(n("#"+i+"_scrollbarSelect_"+t.index),"touchstart",this.scrollbarContainer._scrollSelectRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"touchstart",this.scrollbarContainer._scrollBackRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"touchend",this.scrollbarContainer._scrollBackRectUp);this._on(n(window),"touchmove",this.scrollbarContainer._scrollbarMove);this._on(n(window),"touchend",this.scrollbarContainer._scrollbarUp);this._on(n(this.scrollsvgObj[t.index]),"touchmove",this.scrollbarContainer._scrollbarMove);this._on(n(this.scrollsvgObj[t.index]),"touchend",this.scrollbarContainer._scrollbarUp)}var i=this._id,u=jQuery.uaMatch(navigator.userAgent),r=!!navigator.userAgent.match(/Trident\/7\./),f;if(e.call(this,t),window.PointerEvent)this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"pointerdown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"pointerdown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"pointerdown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"pointerdown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"pointerdown",this.scrollbarContainer._leftArrowDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"pointerup",this.scrollbarContainer._leftArrowUp),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"pointerdown",this.scrollbarContainer._rightArrowDown),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"pointerup",this.scrollbarContainer._rightArrowUp),this._on(n("#"+i+"_scrollbarSelect_"+t.index),"pointerdown",this.scrollbarContainer._scrollSelectRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"pointerdown",this.scrollbarContainer._scrollBackRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"pointerup",this.scrollbarContainer._scrollBackRectUp),this._on(n(window),"pointermove",this.scrollbarContainer._scrollbarMove),this._on(n(window),"pointerup",this.scrollbarContainer._scrollbarUp),this._on(n(this.scrollsvgObj[t.index]),"pointermove",this.scrollbarContainer._scrollbarMove),this._on(n(this.scrollsvgObj[t.index]),"pointerup",this.scrollbarContainer._scrollbarUp),n(this.scrollsvgObj[t.index]).css("touch-action","none");else if(window.navigator.msPointerEnabled&&!r)this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"MSPointerDown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"MSPointerDown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"MSPointerDown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"MSPointerDown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"MSPointerDown",this.scrollbarContainer._leftArrowDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"MSPointerUp",this.scrollbarContainer._leftArrowUp),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"MSPointerDown",this.scrollbarContainer._rightArrowDown),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"MSPointerUp",this.scrollbarContainer._rightArrowUp),this._on(n("#"+i+"_scrollbarSelect_"+t.index),"MSPointerDown",this.scrollbarContainer._scrollSelectRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"MSPointerDown",this.scrollbarContainer._scrollBackRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"MSPointerUp",this.scrollbarContainer._scrollBackRectUp),this._on(n(window),"MSPointerMove",this.scrollbarContainer._scrollbarMove),this._on(n(window),"MSPointerUp",this.scrollbarContainer._scrollbarUp),this._on(n(this.scrollsvgObj[t.index]),"MSPointerMove",this.scrollbarContainer._scrollbarMove),this._on(n(this.scrollsvgObj[t.index]),"MSPointerUp",this.scrollbarContainer._scrollbarUp),n(this.scrollsvgObj[t.index]).css("-ms-touch-action","none");else if(u.browser.toLowerCase()=="chrome")o.call(this,t);else if(this.isDevice()){var s=navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1,h=window.location!=window.parent.location?!0:!1,c=h?window.parent.navigator.userAgent.toLowerCase():window.navigator.userAgent.toLowerCase(),l=/mobile|tablet|android|kindle/i.test(c);ej.isMobile()&&this.isWindows()||!l&&ej.isMobile()&&s?(e.call(this),n(this.scrollsvgObj[t.index]).css("-ms-touch-action","none")):o.call(this,t)}f=u.browser.toLowerCase()=="mozilla"?r?"mousewheel":"DOMMouseScroll":"mousewheel";this._on(n(this.scrollsvgObj[t.index]),f,this.scrollbarContainer._scrollMouseWheel);r&&n(this.scrollsvgObj[t.index]).css("touch-action","none")},_setScrollPosition:function(t,i,r){var f=8,u=this._id,e=t+r.rectWidth/2-7.5;n("#"+u+"_scrollbarLeftHeader_"+r.index).attr("cx",t+f);n("#"+u+"_leftHeaderHideRect_"+r.index).attr("x",t);n("#"+u+"_scrollbarRightHeader_"+r.index).attr("cx",i-f);n("#"+u+"_rightHeaderHideRect_"+r.index).attr("x",i-5);n("#"+u+"_scrollbarSelect_"+r.index).attr("x",t);n("#"+u+"_scrollbarSelect_"+r.index).attr("width",r.rectWidth);n("#"+u+"_scrollbarCenterLine_"+r.index).attr("transform","translate("+e+")");this.pluginName=="ejRangeNavigator"&&(n("#"+u+"_scrollbarLeftHeader_"+r.index).css("left",t),n("#"+u+"_leftHeaderHideRect_"+r.index).css("left",t),n("#"+u+"_scrollbarRightHeader_"+r.index).css("left",i-f),n("#"+u+"_rightHeaderHideRect_"+r.index).css("left",i-5),n("#"+u+"_scrollbarSelect_"+r.index).css("left",t),n("#"+u+"_scrollbarCenterLine_"+r.index).css("left",e))},_calculateScrollLeftMove:function(n,t){t._startX-n>15?(t.startX=t._startX-n,t.offsetLeftX=t.startX,t._offsetRightX=t.startX+t.rectWidth,t.offsetRightX=t._offsetRightX,t.endX=t.width-t.offsetRightX):(t.startX=15,t._offsetLeftX=t.offsetLeftX,t.offsetLeftX=t.startX,t._offsetRightX=t.startX+t.rectWidth,t.offsetRightX=t._offsetRightX,t.endX=t.width-t.offsetRightX)},_calculateScrollRightMove:function(n,t){t&&t._offsetRightX+Math.abs(n)<t.width-15?(t._startX=t.startX+Math.abs(n),t.offsetLeftX=t._startX,t.offsetRightX=t._offsetRightX+Math.abs(n),t.endX=t.width-t.offsetRightX):(t._ofsetRightX=t.offsetRightX,t.offsetRightX=t.width-15,t._startX=t.offsetRightX-t.rectWidth,t.offsetLeftX=t._startX,t.endX=t.width-t.offsetRightX)},_calculateRange:function(t,i,r){var o,s,e,u,f,a=30,h,c,l;return o=(t-15)/(r.width-a-r._diff),e=r.scrollRange,s=(r.rectWidth-r._diff)/(r.width-a-r._diff),r.isRTL?(f=e.max-o*e.delta,u=f-s*e.delta):(u=e.min+o*e.delta,f=u+s*e.delta),r.valueType=="datetime"?(h=r.startDateTime,c=r.endDateTime,r.startDateTime=this.startDateTime=u=new Date(u),r.endDateTime=this.endDateTime=f=new Date(f)):(h=parseInt(r.startValue),c=parseInt(r.endValue),r.startValue=this.startValue=u=Math.ceil(u),r.endValue=this.endValue=f=Math.ceil(f)),r._scrollChanged=!0,l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={zoomPosition:o,zoomFactor:s,oldRange:{start:h,end:c},newRange:{start:u,end:f}},r.zoomPosition=o,r.zoomFactor=s,l},_calculateScrollPosition:function(t,i){var s,h,f,r,u,e,o,y=30,a=15,c,p,w=36,l,v;if(this.leftScrollbarClicked&&i.enableResize)return t=t>=a?t:a,t=t>=a&&t<i.offsetRightX-a?t:i.offsetRightX-a,s=(t-w)/(i.width-y),h=i.rectWidth/(i.width-y),c=i.valueType.toLowerCase(),f=i.scrollRange,i.isRTL?(u=f.max-s*f.delta,u=u<f.max?u:f.max,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.endDateTime=this.endDateTime=u=new Date(u),r=i.startDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.endValue=this.endValue=u=Math.ceil(u),r=Math.ceil(i.startValue))):(r=f.min+s*f.delta,r=r>f.min?r:f.min,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.startDateTime=this.startDateTime=r=new Date(r),u=i.endDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.startValue=this.startValue=r=Math.ceil(r),u=Math.ceil(i.endValue))),l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={zoomPosition:s,zoomFactor:h,oldRange:{start:e,end:o},newRange:{start:r,end:u}},i._scrollChanged=!0,i.zoomPosition=s,i.zoomFactor=h,l;if(this.rightScrollbarClicked&&i.enableResize)return f=i.scrollRange,h=i.rectWidth/(i.width-y),s=i.zoomPosition,c=i.valueType.toLowerCase(),i.isRTL?(s=(t-w)/(i.width-y),r=f.max-s*f.delta,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.startDateTime=this.startDateTime=r=new Date(r),u=i.endDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.startValue=this.startValue=r=Math.floor(r),u=Math.ceil(i.endValue))):(p=f.min+s*f.delta,u=p+h*f.delta,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.endDateTime=this.endDateTime=u=new Date(u),r=i.startDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.endValue=this.endValue=u=Math.floor(u),r=Math.ceil(i.startValue))),l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={zoomPosition:i.zoomPosition?i.zoomPosition:0,zoomFactor:h,oldRange:{start:e,end:o},newRange:{start:r,end:u}},i._scrollChanged=!0,i.zoomFactor=h,l;if(i&&this.scrollRectClicked){if(v=this.mouseDownPos-t,v>0&&i.offsetLeftX>=0)return this.scrollbarContainer._calculateScrollLeftMove.call(this,v,i),this.scrollbarContainer._calculateRange.call(this,i.startX,i.offsetRightX,i);if(v<0)return this.scrollbarContainer._calculateScrollRightMove.call(this,v,i),this.scrollbarContainer._calculateRange.call(this,i._startX,i.offsetRightX,i)}},_scrollbarMove:function(t){var u,s;if(this.moveClientX=ej.isNullOrUndefined(t.clientX)?t.originalEvent.clientX==null?t.originalEvent.touches[0].clientX:t.originalEvent.clientX:t.clientX,this.moveClientX!=this.downClientX){var f=8,o=34,r,e,w=this.model.padding||0,b=jQuery.uaMatch(navigator.userAgent),i=this.scrollbarContainer._doScrollIndex.call(this,t);if(!i)return 0;if(this.lastIndex=i.index,r=!this.vmlRendering&&t.originalEvent.toString()!=="[object TouchEvent]"&&b.browser.toLowerCase()!="msie"||this.vmlRendering?(i.orientation=="horizontal"?this.calMousePosition(t).X-i.x:i.width-(this.calMousePosition(t).Y-i.y))-w:(i.orientation=="horizontal"?this.calTouchPosition(t).X-i.x:i.width-(this.calTouchPosition(t).Y-i.y))-w,this.mouseX=r,u=this._id,this.leftScrollbarClicked&&i.enableResize&&(i&&(r>o||r>23)&&r<i.offsetRightX-o?(i.rectWidth=i.width-(i.endX+r-f),e=r-f+i.rectWidth/2-7.5,n("#"+u+"_scrollbarLeftHeader_"+i.index).attr("cx",r),n("#"+u+"_leftHeaderHideRect_"+i.index).attr("x",r-7.5),n("#"+u+"_scrollbarSelect_"+i.index).attr("x",r-f),n("#"+u+"_scrollbarSelect_"+i.index).attr("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).attr("transform","translate("+e+")"),this.pluginName=="ejRangeNavigator"&&(n("#"+u+"_scrollbarLeftHeader_"+i.index).css("left",r),n("#"+u+"_leftHeaderHideRect_"+i.index).css("left",r-7.5),n("#"+u+"_scrollbarSelect_"+i.index).css("left",r),n("#"+u+"_scrollbarSelect_"+i.index).css("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).css("left",e)),i.offsetLeftX=i.startX=r-8,this.scrollbarContainer._scrollStartArgs.call(this,i),this.scrollbarContainer._scrollChangeArgs.call(this,i),i._diff=0):r>i.offsetRightX-o&&(this.rectWidth=42.899841017488143)),this.rightScrollbarClicked&&i.enableResize&&i&&(r<=i.width-o||r<=i.width-23)&&r>i.offsetLeftX+o&&(i.rectWidth=r-i.offsetLeftX+f,e=i.offsetLeftX+i.rectWidth/2-7.5,n("#"+u+"_scrollbarRightHeader_"+i.index).attr("cx",r),n("#"+u+"_rightHeaderHideRect_"+i.index).attr("x",r-2.5),n("#"+u+"_scrollbarSelect_"+i.index).attr("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).attr("transform","translate("+e+")"),this.pluginName=="ejRangeNavigator"&&(n("#"+u+"_scrollbarRightHeader_"+i.index).css("left",r),n("#"+u+"_rightHeaderHideRect_"+i.index).css("left",r-2.5),n("#"+u+"_scrollbarSelect_"+i.index).css("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).css("left",e)),i.offsetRightX=r+f,i.endX=i.width-r-f,this.scrollbarContainer._scrollStartArgs.call(this,i),this.scrollbarContainer._scrollChangeArgs.call(this,i),i._diff=0),this.scrollRectClicked&&(s=this.mouseDownPos-r,i._startX=ej.isNullOrUndefined(i._startX)?i.startX:i._startX,i&&s>0&&i.offsetLeftX>=0&&(this.scrollbarContainer._calculateScrollLeftMove.call(this,s,i),this.scrollbarContainer._setScrollPosition.call(this,i.startX,i.offsetRightX,i),(i.offsetLeftX>15||i.offsetLeftX!=i._offsetLeftX)&&(this.scrollbarContainer._scrollStartArgs.call(this,i),this.scrollbarContainer._scrollChangeArgs.call(this,i))),i&&s<0&&(ej.isNullOrUndefined(i._offsetRightX)&&(this.scrollbarContainer._scrollSelectRectDown.call(this,t),this.scrollbarContainer._scrollbarMove.call(this,t)),this.scrollbarContainer._calculateScrollRightMove.call(this,s,i),this.scrollbarContainer._setScrollPosition.call(this,i._startX,i._startX+i.rectWidth,i),(i.offsetRightX<i.width-15||i.offsetRightX!=i._ofsetRightX)&&(this.scrollbarContainer._scrollStartArgs.call(this,i),this.model.enableDeferredUpdate===!1||i.isZooming||this.model.scrollChanged!="")))){var h=this.scrollbarContainer._calculateRange.call(this,i._startX,i._startX+i.rectWidth,i),c=h.data.oldRange,l=h.data.newRange,a,v,y,p;i.valueType.toLowerCase()=="datetime"?(a=Date.parse(c.start),y=Date.parse(l.start),v=Date.parse(c.end),p=Date.parse(l.end)):(a=c.start,y=l.start,v=c.end,p=l.end);this.model.scrollChanged!=""&&(a!=y||v!=p)&&(h=this.scrollbarContainer._args.call(this,i,h),this._trigger("scrollChanged",h));this.model.enableDeferredUpdate||(this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,i))}}this.offsetX=r},_scrollbarUp:function(t){var i=this.scrollbarContainer._doScrollIndex.call(this,t),r,s,u,f,h,c,e,o,l;n("[id^="+this._id+"_scrollbarSelect_]").attr("class","e-rangeScroll-select");this.lastIndex=null;r=this.scrollbarContainer._calculateScrollPosition.call(this,this.mouseX,i);s=this.model.enableDeferredUpdate;r&&(u=r.data.oldRange,f=r.data.newRange,i.valueType.toLowerCase()=="datetime"?(h=Date.parse(u.start),e=Date.parse(f.start),c=Date.parse(u.end),o=Date.parse(f.end)):(h=u.start,e=f.start,c=u.end,o=f.end),(h!=e||c!=o||this.scrollRectClicked&&!s||s||this.leftScrollbarClicked||this.rightScrollbarClicked)&&(l=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&navigator.vendor.toLowerCase().indexOf("google")>-1,(!l||l&&(this.leftScrollbarClicked||this.rightScrollbarClicked)&&this.downClientX!=this.moveClientX||this.scrollRectClicked||this.leftArrowClicked||this.rightArrowClicked)&&(!this.leftScrollbarClicked&&!this.rightScrollbarClicked||(this.leftScrollbarClicked||this.rightScrollbarClicked)&&Math.ceil(i.rectWidth)!=Math.ceil(this.rectOldWidth)&&(Math.abs(i.rectWidth-i.rectOldWidth)>4||!i.rectOldWidth))&&(ej.isNullOrUndefined(i._previousStart)||i._previousStart!=e||i._previousEnd!=o)&&(r=this.scrollbarContainer._args.call(this,i,r),this._trigger("scrollEnd",r),i._scrollStarted=!1,i._previousStart=e,i._previousEnd=o,i.rectOldWidth=i.rectWidth,this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,i))),i.release=!0,i.clicked=!1);this._scrollEnd=!1;this.leftScrollbarClicked=!1;this.rightScrollbarClicked=!1;this.scrollRectClicked=!1;this.leftArrowClicked=!1;this.rightArrowClicked=!1;this.scrollbarBackRectClicked=!1},_leftScrollbarDown:function(n){n.preventDefault();this.leftScrollbarClicked=!0;this.downClientX=ej.isNullOrUndefined(n.clientX)?n.originalEvent.touches[0].clientX:n.clientX},_rightScrollbarDown:function(n){n.preventDefault();this.rightScrollbarClicked=!0;this.downClientX=ej.isNullOrUndefined(n.clientX)?n.originalEvent.touches[0].clientX:n.clientX},_scrollSelectRectDown:function(t){var i=this.scrollbarContainer._doScrollIndex.call(this,t),u;n("#"+this._id+"_scrollbarSelect_"+i.index).attr("class","e-rangeScroll-select e-rangeScroll-select-hover");t.preventDefault();var f=jQuery.uaMatch(navigator.userAgent),r=this.model.padding||0,i=this.scrollbarContainer._doScrollIndex.call(this,t);u=!this.vmlRendering&&t.originalEvent.toString()!=="[object TouchEvent]"&&f.browser.toLowerCase()!="msie"||this.vmlRendering?(i.orientation=="horizontal"?this.calMousePosition(t).X-i.x:i.width-(this.calMousePosition(t).Y-i.y))-r:(i.orientation=="horizontal"?this.calTouchPosition(t).X-i.x:i.width-(this.calTouchPosition(t).Y-i.y))-r;this.mouseDownPos=u;i._startX=i.startX=i.offsetLeftX;i._offsetRightX=i.offsetRightX;i.clicked=!0;i.release=!1;this.scrollRectClicked=!0},_scrollMouseWheel:function(n){n.preventDefault();var t=this.scrollbarContainer._doScrollIndex.call(this,n),r=!!navigator.userAgent.match(/Trident\/7\./),i=n.originalEvent.wheelDelta,u=jQuery.uaMatch(navigator.userAgent),f=u.browser.toLowerCase()=="mozilla"?r?i/120>0?1:-1:-n.originalEvent.detail/3>0?1:-1:i/120>0?1:-1,e=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1),o=Math.max(e+.25*f,1);this.scrollbarContainer.doMouseWheelZoom.call(this,o,.5,t)},_scrollStartArgs:function(t){if(t._scrollStarted=!0,this.model.scrollStart!=""&&!this._scrollEnd){var i=n.extend({},ej.EjSvgRender.commonChartEventArgs);i.data=t.isZooming?{axis:this.model._axes[t.index],currentRange:this.model._axes[t.index].visibleRange}:{startRange:t.valueType=="datetime"?t.startDateTime:t.startValue,endRange:t.valueType=="datetime"?t.endDateTime:t.endValue};this._trigger("scrollStart",i);this._scrollEnd=!0}},_scrollChangeArgs:function(n){if(this.model.enableDeferredUpdate===!1||n.isZooming||this.model.scrollChanged!=""){var t=this.scrollbarContainer._calculateRange.call(this,n.offsetLeftX,n.offsetRightX,n),i=t.data.oldRange,r=t.data.newRange,u,f,e,o;n.valueType.toLowerCase()=="datetime"?(u=Date.parse(i.start),e=Date.parse(r.start),f=Date.parse(i.end),o=Date.parse(r.end)):(u=i.start,e=r.start,f=i.end,o=r.end);this.model.scrollChanged!=""&&(u!=e||f!=o)&&(t=this.scrollbarContainer._args.call(this,n,t),this._trigger("scrollChanged",t));this.model.enableDeferredUpdate||(this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,n))}},_scrollEndArgs:function(n,t){var i=this.scrollbarContainer._calculateRange.call(this,n,t.offsetRightX,t),r,u,f,e,o,s;i&&t._scrollStarted&&(r=i.data.oldRange,u=i.data.newRange,t.valueType.toLowerCase()=="datetime"?(f=Date.parse(r.start),o=Date.parse(u.start),e=Date.parse(r.end),s=Date.parse(u.end)):(f=r.start,o=u.start,e=r.end,s=u.end),(f!=o||e!=s||this.leftScrollbarClicked||this.rightScrollbarClicked)&&(i=this.scrollbarContainer._args.call(this,t,i),this._trigger("scrollEnd",i)),t._scrollStarted=!1,this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,t))},_args:function(n,t){if(n.isZooming){var i=this.model._axes[n.index],r=t.data;r.axis=i;r.newRange=i.visibleRange;r.oldRange=i.previousRange}return n.isVirtual&&(t.data.axis=this.model._axes[n.index],delete t.data.zoomFactor,delete t.data.zoomPosition),t},doMouseWheelZoom:function(n,t,i){if(n>=1){var r=this.scrollbarContainer.calZoomFactors(n,t,i.zoomFactor,i.zoomPosition);i.zoomPosition!=r.zoomMPosition&&r.zoomMPosition+i.zoomFactor<=1&&i.zoomPosition>=0&&(r.zoomMPosition+i.zoomFactor>=1&&(r.zoomMPosition=1-i.zoomFactor),r.zoomMPosition<0&&(r.zoomMPosition=0),i.zoomPosition=r.zoomMPosition,i.startX=i.zoomPosition*(i.width-30-i._diff)+15,i.startX=i.startX+i.rectWidth+5>i.width?i.width-i.rectWidth-15:i.startX,i.offsetLeftX=i.startX,i._offsetRightX=i.startX+i.rectWidth,i._offsetRightX>i.width-15?(i.offsetRightX=i.width-15,i.startX=i.offsetRightX-i.rectWidth,i.offsetLeftX=i.startX):i.offsetRightX=i._offsetRightX,i.endX=i.width-i.offsetRightX,this.scrollbarContainer._setScrollPosition.call(this,i.startX,i.offsetRightX,i),this.scrollbarContainer._calculateMouseWheelRange.call(this,i.startX,i.offsetRightX,i))}return!1},_calculateMouseWheelRange:function(t,i,r){var e,u,f,w=30,c,l,o,s,h,a,v,y,p;r.zoomFactor=r.rectWidth/(r.width-w);r.zoomPosition=(t-15)/(r.width-w-r._diff);e=r.scrollRange;r.isRTL?(f=e.max-r.zoomPosition*e.delta,u=f-r.zoomFactor*e.delta):(u=e.min+r.zoomPosition*e.delta,f=u+r.zoomFactor*e.delta);r.valueType=="datetime"?(c=r.startDateTime,l=r.endDateTime,r.startDateTime=this.startDateTime=u=new Date(u),r.endDateTime=this.endDateTime=f=new Date(f)):(c=parseInt(r.startValue),l=parseInt(r.endValue),r.startValue=this.startValue=u=Math.ceil(u),r.endValue=this.endValue=f=Math.ceil(f));o=n.extend({},ej.EjSvgRender.commonChartEventArgs);o.data={zoomPosition:r.zoomPosition,zoomFactor:r.zoomFactor,oldRange:{start:c,end:l},newRange:{start:u,end:f}};r._scrollChanged=!0;r._scrollStarted=!1;s=o.data.oldRange;h=o.data.newRange;r.valueType.toLowerCase()=="datetime"?(a=Date.parse(s.start),y=Date.parse(h.start),v=Date.parse(s.end),p=Date.parse(h.end)):(a=s.start,y=h.start,v=s.end,p=h.end);(a!=y||v!=p||r.isZooming)&&(this.scrollbarContainer._scrollStartArgs.call(this,r),o=this.scrollbarContainer._args.call(this,r,o),this._trigger("scrollEnd",o),this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,r),this._scrollEnd=!1)},calZoomFactors:function(n,t,i,r){var u,f;return n==1?(u=1,f=0):(u=ej.EjSvgRender.utils._minMax(1/n,0,1),f=r+(i-u)*t),{zoomMFactor:u,zoomMPosition:f}},_leftArrowDown:function(n){var t,i;this.leftArrowClicked=!0;t=this.scrollbarContainer._doScrollIndex.call(this,n);t._startX=t.startX=t.offsetLeftX;t._offsetRightX=t.offsetRightX;t.leftIncrement=5;i=this;t.interval=setInterval(function(){i.scrollbarContainer.leftArrowRecursive.call(i,t)},50)},_leftArrowUp:function(n){this.leftArrowClicked=!1;var t=this.scrollbarContainer._doScrollIndex.call(this,n);this.scrollbarContainer.leftArrowRecursive.call(this,t)},leftArrowRecursive:function(n){if(this.leftArrowClicked){var t=this._id;this.scrollbarContainer._calculateScrollLeftMove.call(this,n.leftIncrement,n);n._scrollStarted=!0;n.startX>15&&this.scrollbarContainer._scrollEndArgs.call(this,n.startX,n);this.scrollbarContainer._setScrollPosition.call(this,n.startX,n.offsetRightX,n);n.leftIncrement+=5}else clearInterval(n.interval),n.leftIncrement=0},_rightArrowDown:function(n){var t,i;this.rightArrowClicked=!0;t=this.scrollbarContainer._doScrollIndex.call(this,n);t._startX=t.startX=t.offsetLeftX;t._offsetRightX=t.offsetRightX;t.rightIncrement=-5;i=this;t.interval=setInterval(function(){i.scrollbarContainer.rightArrowRecursive.call(i,t)},50)},_rightArrowUp:function(n){this.rightArrowClicked=!1;var t=this.scrollbarContainer._doScrollIndex.call(this,n);this.scrollbarContainer.rightArrowRecursive.call(this,t)},rightArrowRecursive:function(n){if(this.rightArrowClicked){var t=this._id;this.scrollbarContainer._calculateScrollRightMove.call(this,n.rightIncrement,n);n._scrollStarted=!0;n.offsetRightX<n.width-15&&this.scrollbarContainer._scrollEndArgs.call(this,n._startX,n);this.scrollbarContainer._setScrollPosition.call(this,n._startX,n.offsetRightX,n);n.rightIncrement-=5}else clearInterval(n.interval),n.rightIncrement=0},_scrollBackRectDown:function(n){var e=jQuery.uaMatch(navigator.userAgent),r=this.model.padding||0,t=this.scrollbarContainer._doScrollIndex.call(this,n),u,i,f;u=!this.vmlRendering&&n.originalEvent.toString()!=="[object TouchEvent]"&&e.browser.toLowerCase()!="msie"||this.vmlRendering?(t.orientation=="horizontal"?this.calMousePosition(n).X-t.x:t.width-(this.calMousePosition(n).Y-t.y))-r:(t.orientation=="horizontal"?this.calTouchPosition(n).X-t.x:t.width-(this.calTouchPosition(n).Y-t.y))-r;this.mouseDownPos=u;this.scrollbarBackRectClicked=!0;i=this;this.scrollbarContainer._scrollStartArgs.call(this,t);f=setInterval(function(){i.scrollbarContainer.scrollBackRectRecursive.call(i,t);this.scrollbarBackRectClicked||clearInterval(f)},50)},_scrollBackRectUp:function(n){this.scrollbarBackRectClicked=!1;var t=this.scrollbarContainer._doScrollIndex.call(this,n);this.scrollbarContainer.scrollBackRectRecursive.call(this,t)},_doScrollIndex:function(n){var i=this._id+"_scrollbar_",r=n.target.parentNode&&n.target.parentNode.id?n.target.parentNode.id:"",t=r.indexOf(i)>-1?parseInt(r.substr(i.length)):NaN;return ej.isNullOrUndefined(this.lastIndex)||isNaN(this.lastIndex)||!this.model.scrollObj[this.lastIndex].release&&this.model.scrollObj[this.lastIndex].clicked&&(t=this.lastIndex),this.lastIndex=ej.isNullOrUndefined(this.lastIndex)?t:this.lastIndex,ej.isNullOrUndefined(this.model.scrollObj[t])?this.model.scrollObj[this.lastIndex]:this.model.scrollObj[t]},scrollBackRectRecursive:function(n){if(this.scrollbarBackRectClicked){var t=10/100*(n.width-30);n._startX=n.startX=n.offsetLeftX;n._offsetRightX=n.offsetRightX;this.mouseDownPos<n.startX?(t=t<n.startX?t:n.startX-16,this.scrollbarContainer._calculateScrollLeftMove.call(this,t,n),n._scrollStarted=!0,this.scrollbarContainer._scrollEndArgs.call(this,n.startX,n),this.scrollbarContainer._setScrollPosition.call(this,n.startX,n.offsetRightX,n)):this.mouseDownPos>n.offsetRightX?(t=(t<n.endX?t:n.endX-16)*-1,this.scrollbarContainer._calculateScrollRightMove.call(this,t,n),n._scrollStarted=!0,this.scrollbarContainer._scrollEndArgs.call(this,n._startX,n),this.scrollbarContainer._setScrollPosition.call(this,n._startX,n.offsetRightX,n)):n._scrollStarted=!1}else n._scrollStarted=!1},_appendScrollRange:function(n){if(this.scrollbarUpdate=!0,this.pluginName=="ejRangeNavigator")this.renderNavigator();else{var i=n.index,t=this.model._axes[i];n.isZooming&&(t.zoomFactor!=n.zoomFactor||t.zoomPosition!=n.zoomPosition)&&(t.zoomFactor=n.zoomFactor,t.zoomPosition=n.zoomPosition,this.redraw(!0))}this.scrollbarUpdate=!1}}}(jQuery),function(n,t,i){t.widget({ejCircularGauge:"ej.datavisualization.CircularGauge"},{_rootCSS:"e-circulargauge",validTags:["div","span"],_savedPoints:[],_labelRadius:0,_customLblMaxSize:0,defaults:{locale:null,enableGroupSeparator:!1,value:0,minimum:0,maximum:100,radius:180,width:360,height:360,frame:{frameType:"fullcircle",backgroundImageUrl:null,halfCircleFrameStartAngle:180,halfCircleFrameEndAngle:360},backgroundColor:null,interiorGradient:null,readOnly:!0,enableAnimation:!0,animationSpeed:500,theme:"flatlight",isRadialGradient:!1,enableResize:!1,isResponsive:!1,tooltip:{showLabelTooltip:!1,showCustomLabelTooltip:!1,templateID:null},outerCustomLabelPosition:"bottom",gaugePosition:"center",distanceFromCorner:20,rangeZOrder:"rear",drawTicks:null,drawLabels:null,drawPointers:null,drawRange:null,drawCustomLabel:null,drawIndicators:null,drawPointerCap:null,load:null,renderComplete:null,mouseClick:null,mouseClickMove:null,mouseClickUp:null,legendItemRender:null,legendItemClick:null,rangeMouseMove:null,scales:null,legend:{visible:!1,toggleVisibility:!0,border:{color:"transparent",width:1},itemPadding:20,shape:"circle",alignment:"center",position:"bottom",itemStyle:{height:9,width:9,border:{color:"transparent",width:1}},opacity:1,fill:null,font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px"},size:{height:null,width:null}},themeProperties:{flatlight:{backgroundColor:"#FFFFFF",scales:{pointerCap:{borderColor:"#424242",backgroundColor:"#424242"},backgroundColor:"#777777",border:{color:"#777777"},pointers:{backgroundColor:"#424242",border:{color:"#424242"}},ticks:{color:"#777777"},labels:{color:"#282828"}}},flatdark:{backgroundColor:"#1F1F1F",scales:{pointerCap:{borderColor:"#686868",backgroundColor:"#686868"},backgroundColor:"#7a7a7a",border:{color:"#7a7a7a"},pointers:{backgroundColor:"#686868",border:{color:"#686868"}},ticks:{color:"#7a7a7a"},labels:{color:"#d3d3d3"}}}}},_defaultScaleValues:function(){return{size:6,pointerCap:{radius:7,borderWidth:3,interiorGradient:null,borderColor:null,backgroundColor:null},showScaleBar:!1,sweepAngle:310,radius:170,startAngle:115,majorIntervalValue:10,minorIntervalValue:2,maximum:null,minimum:null,border:{color:null,width:1.5},backgroundColor:null,direction:"clockwise",showPointers:!0,showRanges:!1,showTicks:!0,showLabels:!0,showIndicators:!1,opacity:1,shadowOffset:0,customLabels:[{value:null,color:null,textAngle:0,positionType:"inner",position:{x:0,y:0},font:{size:"11px",fontFamily:"arial",fontStyle:"bold"}}],pointers:[{distanceFromScale:0,showBackNeedle:!1,backNeedleLength:10,length:150,placement:"near",width:7,opacity:1,value:null,border:{color:null,width:1.5},backgroundColor:null,gradients:null,type:"needle",needleType:"triangle",markerType:"rectangle",imageUrl:"",pointerValueText:{showValue:!1,distance:20,font:{size:"11px",fontFamily:"Arial",fontStyle:"Bold"},color:"#8c8c8c",opacity:1,autoAngle:!1,angle:0}}],ranges:[{legendText:null,distanceFromScale:25,size:5,placement:"near",startValue:null,endValue:null,startWidth:null,endWidth:null,gradients:null,opacity:null,backgroundColor:"#32b3c6",border:{color:"#32b3c6",width:1.5}}],ticks:[{angle:0,distanceFromScale:0,color:null,type:"major",placement:"near",height:16,width:3},{angle:0,distanceFromScale:0,color:null,type:"minor",placement:"near",height:7,width:1}],labels:[{angle:0,autoAngle:!1,opacity:null,font:{size:"11px",fontFamily:"Arial",fontStyle:"Bold"},color:null,distanceFromScale:0,includeFirstValue:!0,placement:"near",type:"major",unitText:"",unitTextPosition:"back"}],indicators:[{height:15,width:15,type:"circle",imageUrl:null,position:{x:0,y:0},stateRanges:[{endValue:0,startValue:0,backgroundColor:null,borderColor:null,text:"",textColor:null,font:null}]}],subGauges:[{height:150,width:150,position:{x:0,y:0}}]}},dataTypes:{scales:"data",isResponsive:"boolean"},observables:["value","minimum","maximum"],_tags:[{tag:"scales",attr:["showScaleBar","pointerCap.radius","pointerCap.borderWidth","pointerCap.interiorGradient","pointerCap.borderColor","pointerCap.backgroundColor","sweepAngle","startAngle","showPointers","showTicks","backgroundColor","scaleRadius","majorIntervalValue","minorIntervalValue","shadowOffset","showRanges","showLabels","showCustomLabels","showIndicators","border.width","border.color",[{tag:"pointers",attr:["distanceFromScale","showBackNeedle","backNeedleLength","backgroundColor","needleType","markerType","border.width","border.color","imageUrl","pointerValueText.showValue","pointerValueText.distance","pointerValueText.font.size","pointerValueText.font.fontFamily","pointerValueText.font.fontStyle","pointerValueText.angle","pointerValueText.autoAngle","pointerValueText.color","pointerValueText.opacity"]},{tag:"labels",attr:["autoAngle","distanceFromScale","includeFirstValue","unitText","unitTextPosition","font.size","font.fontFamily","font.fontStyle"]},{tag:"ticks",attr:["distanceFromScale"]},{tag:"ranges",attr:["legendText","distanceFromScale","startValue","endValue","startWidth","endWidth","backgroundColor","border.color","border.width"]},{tag:"indicators",attr:["imageUrl","position.x","position.y",[{tag:"stateRanges",attr:["endValue","startValue","backgroundColor","borderColor","textColor"]}]]},{tag:"subGauges",attr:["controlID","position.x","position.y"]},{tag:"customLabels",attr:["positionType","textAngle","position.x","position.y","font.size","font.fontFamily","font.fontStyle"]}]]}],value:t.util.valueFunction("value"),minimum:t.util.valueFunction("minimum"),maximum:t.util.valueFunction("maximum"),_setModel:function(t){var i,r,u,f,e;for(i in t)switch(i){case"height":this.model.height=t[i];break;case"width":this.model.width=t[i];break;case"radius":this.model.radius=t[i];break;case"frame":n.extend(this.model.frame,t[i]);break;case"tooltip":n.extend(this.model.tooltip,t[i]);break;case"backgroundColor":this.model.backgroundColor=t[i];break;case"interiorGradient":this.model.interiorGradient=t[i];break;case"readOnly":this.model.readOnly=t[i];break;case"theme":this.model.theme=t[i];break;case"isRadialGradient":this.model.isRadialGradient=t[i];break;case"outerCustomLabelPosition":this.model.outerCustomLabelPosition=t[i];break;case"gaugePosition":this.model.gaugePosition=t[i];break;case"distanceFromCorner":this.model.distanceFromCorner=t[i];break;case"rangeZOrder ":this.model.rangeZOrder=t[i];break;case"value":for(this.value()==""&&this.value(0),r=0;this.model.scales[r]!=null;r++)for(u=0;this.model.scales[r].pointers[u]!=null;u++)this.model.scales[r].pointers[u].value=parseFloat(this.value());break;case"minimum":for(this.minimum()==""&&this.minimum(0),f=0;this.model.scales[f]!=null;f++)this.model.scales[f].minimum=parseInt(this.minimum());break;case"maximum":for(this.maximum()==""&&this.maximum(100),e=0;this.model.scales[e]!=null;e++)this.model.scales[e].maximum=parseInt(this.maximum());break;case"scales":n.extend(!0,this.model.scales,t[i])}this._init()},_destroy:function(){this._unWireEvents();this.element.empty().removeClass("e-widget")},_init:function(){_gaugeCount=n(".e-circulargauge").length;initialGaugeCount=_gaugeCount;this._scaleRedrawn=!1;this._scalesInitialize();this._trigger("load");this._setTheme();this._initialize();this._wireEvents();this._onWindowResize()},_onWindowResize:function(){(this.model.enableResize||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this.resizeCanvas):this._on(n(window),"resize",this.resizeCanvas))},_initialize:function(){this._androidAnimation=this.isAndroid()&&t.datavisualization.CircularGauge.animationPolyfill;this._initObject(this);this._drawOuterLayer();this.model.legend.visible&&this.model.legend._legendItemHeight>0&&this.model.legend._legendItemWidth>0&&(this._drawLegend(),this._legendDrawn=!0);this._drawScales();this.model.renderComplete&&this._onRenderComplete()},_drawLegend:function(){var u=this.model.legend,n,p=this.GaugeEl,i=20,c=this.model.legend.position.toLowerCase(),l=this.model.legend.alignment.toLowerCase(),y,f=this.model.legend.border.width,e=this.model.width,o=this.model.height,s,a,h;for(n=this.model.legendActualBounds,c=="top"||c=="bottom"?(n.y=c=="top"?f+i:o-n.Height-i,n.x=l=="center"?e/2-n.Width/2:l=="near"?f+i:e-n.Width-i,n.x=n.x+n.Width>e?n.x-Math.abs(n.x+n.Width-e):n.x):(n.x=c=="left"?f+i:e-n.Width-i,n.y=l=="center"?o/2-n.Height/2:l=="near"?f+i:o-n.Height-i,n.y=n.y+n.Height>o?n.y-Math.abs(n.y+n.Height-o):n.y),this._legendBounds=n,this.contextEl.lineWidth=f,this.contextEl.save(),this.contextEl.strokeStyle=this.model.legend.border.color,this.contextEl.strokeRect(n.x,n.y,n.Width,n.Height),this.contextEl.restore(),this.model._legendCollection=[],s=0;s<this.model.scales.length;s++)for(a=this.model.scales[s],h=0;h<a.ranges.length;h++){var r=a.ranges[h],v;r._visible=t.util.isNullOrUndefined(r._visible)?!0:r._visible;t.util.isNullOrUndefined(r.legendText)||(v=this._getLegendSize(r,10),y={Bounds:{Height:v.Height,Width:v.Width},legendStyle:{font:u.font,opacity:u.opacity,BorderColor:u.itemStyle.border.color,BorderWidth:u.itemStyle.border.width},displayText:r.legendText,fill:t.util.isNullOrUndefined(u.fill)?r.backgroundColor:u.fill,ScaleIndex:s,RangeIndex:h,visible:r._visible},this.model._legendCollection.push(y))}this._drawLegendItem(n)},legendMouseClick:function(n){var i,t,u,f,e,o,s,h,r=this.calMousePosition(n);if(this.model.legend.toggleVisibility)for(i=0;i<this.legendRegion.length;i++)t=this.legendRegion[i],u=t.X,f=t.X+t.Width,e=t.Y,o=t.Y+t.Height,r.X>=u&&r.X<=f&&r.Y>=e&&r.Y<=o&&(s={type:"legendItemClick",cancel:!1,data:t,model:this.model},this._trigger("legendItemClick",s),h=this.model.scales[t.item.ScaleIndex].ranges[t.item.RangeIndex]._visible?!1:!0,this.setRangeVisible(t.item.ScaleIndex,t.item.RangeIndex,h))},calMousePosition:function(t){var e=jQuery.uaMatch(navigator.userAgent),r,u,f,o,i;return r=this.GaugeEl[0],i=r.querySelector("canvas"),o=e.browser.toLowerCase(),u=t.pageX-n(i).offset().left,f=t.pageY-n(i).offset().top,{X:u,Y:f}},rangesMouseMove:function(t){var ot=this,a,v,p,w,b,k,d,g,ft,f,r,nt,y,s,tt,h=this.calMousePosition(t),i,e,o,et,it,rt,ut,u,c,l;if(this.model.legend.toggleVisibility&&this._legendDrawn)for(v=0;v<this.legendRegion.length;v++)if(i=this.legendRegion[v],p=i.X,w=i.X+i.Width,b=i.Y,k=i.Y+i.Height,h.X>=p&&h.X<=w&&h.Y>=b&&h.Y<=k){n(this.GaugeEl[0]).css("cursor","pointer");break}else n(this.GaugeEl[0]).css("cursor","default");for(d=h.X,g=h.Y,ft=[],f=this.model.scales[0].startAngle,r=this.model.scales[0].sweepAngle,nt=f*(Math.PI/180),y=0;y<this._rangeCollectionRegions.length;y++)if(i=this._rangeCollectionRegions[y],e=d-i.centerRadius.centerX,o=g-i.centerRadius.centerY,et=i.Radius.endRadius?i.Radius.endRadius:0,f=f<0?f+360:f,r=r<0?r+360:r,it=r-f,rt=-.5*Math.PI+nt,it<0){if(r=r/360,ut=r?2*Math.PI*(r<0?1+r:r):0,u=(Math.atan2(o,e)-rt-ut)%(2*Math.PI),u<0&&(u=2*Math.PI+u),c=Math.PI*(i.Region.startAngle/180),l=Math.PI*(i.Region.endAngle/180),u<=c&&u>=l&&(s=Math.sqrt(Math.pow(Math.abs(e),2)+Math.pow(Math.abs(o),2)),s<=i.Radius.startRadius&&s>i.Radius.endRadius)){a={type:"rangeMouseMove",cancel:!1,data:i,model:this.model};this._trigger("rangeMouseMove",a);break}}else if(u=Math.atan2(o,e)%(2*Math.PI),u<0&&(u=2*Math.PI+u),i.Region.endAngle<i.Region.startAngle?(c=e>0&&o>0?0:Math.PI*(i.Region.startAngle/180),l=e>0&&o>0?Math.PI*(i.Region.endAngle/180):Math.PI*((360+i.Region.endAngle)/180)):(c=Math.PI*(i.Region.startAngle/180),l=Math.PI*(i.Region.endAngle/180)),u>=c&&u<=l&&(s=Math.sqrt(Math.pow(Math.abs(e),2)+Math.pow(Math.abs(o),2)),s<=i.Radius.startRadius&&s>i.Radius.endRadius)){tt=i;a={type:"rangeMouseMove",cancel:!1,data:i,model:this.model};this._trigger("rangeMouseMove",a);break}return tt},_drawLegendItem:function(i){var s=[],e=[],et,nt,r,g,vt;for(this.legendRegion=[],this.model.legend._legendTextMaxHeight=0,this.model.legend._legendTextMaxWidth=0,nt=this.model.legend.position.toLowerCase(),r=0;r<this.model._legendCollection.length;r++){var c=this.model.legend.shape.toLowerCase(),y=10,p=10,w=3,a,v,tt,it,u,b,ot,k,rt,st,ut,ht,ct,o,lt,ft,f,d,h,l,at=10;u=this.model._legendCollection[r];t.util.isNullOrUndefined(u.displayText)||(et={type:"legendItemRender",cancel:!1,data:u,model:this.model},this._trigger("legendItemRender",et),this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible=t.util.isNullOrUndefined(this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible)?!0:this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible,ot=this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible?u.fill:"#808080",ht=this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible?u.legendStyle.font.color:"#808080",ct=this._getFontString(this,u.legendStyle.font),o=this.calcText(u.displayText,i.Width,u.legendStyle.font),this.model.legend._legendTextMaxHeight=Math.max(o.height,this.model.legend._legendTextMaxHeight),this.model.legend._legendTextMaxWidth=Math.max(o.width,this.model.legend._legendTextMaxWidth),lt=this.model.legend.itemStyle.height,ft=this.model.legend.itemStyle.width,f=(lt+ft)/2,d={angle:0,width:f,isFill:!0,isStroke:!0,height:f,lineWidth:this.model.legend.itemStyle.border.width,opacity:u.legendStyle.opacity,strokeStyle:u.legendStyle.BorderColor,fillStyle:ot},y=f>o.height/2?y+f/2:y+o.height/4,p=c=="circle"?p+f/2:p,r==0?(a=p+i.x,v=i.y+y):nt=="top"||nt=="bottom"?(g=e[r-1].x+e[r-1].width+this.model.legend.itemPadding,g+f+w+o.width>=i.x+i.Width?(a=p+i.x,v=this.model.legend._legendTextMaxHeight/2>f?e[r-1].y+s[r-1].actualBounds.height/2+f/2+at:at+s[r-1].actualBounds.y+s[r-1].actualBounds.height/2+f/2):(a=c.toLowerCase()=="circle"?g+f/2:g,v=s[r-1].actualBounds.y)):(yPos=e[r-1].height>f?e[r-1].y+this.model.legend.itemPadding:s[r-1].actualBounds.y+f+this.model.legend.itemPadding,vt=e[r-1].height>f?o.height:f,yPos+vt-2>i.y+i.Height+2?(v=i.y+y,a=s[r-1].actualBounds.x+s[r-1].actualBounds.width+(this.model.legend._legendTextMaxWidth+w)+10):(a=s[r-1].actualBounds.x,v=yPos)),h={startX:a,startY:v},c=c.charAt(0).toUpperCase()+c.slice(1),l=n.extend({},h,!0),l.startX=c.toLowerCase()=="circle"?l.startX-f/2:l.startX,l.startY=l.startY-f/2,s.push({actualBounds:{x:h.startX,y:h.startY,height:f,width:f},item:u}),b={angle:0,width:o.width,isFill:!0,isStroke:!0,height:o.height,textValue:u.displayText,font:ct,fillStyle:ht,opacity:u.legendStyle.opacity,strokeStyle:u.legendStyle.BorderColor},tt=c.toLowerCase()=="circle"?h.startX+ft/2+w:h.startX+d.width+w,it=h.startY+o.height/4,e.push({x:tt,y:it,height:o.height/2,width:o.width}),k=l.startX,st=Math.abs(k+s[r].actualBounds.width-k)+w+Math.abs(e[r].x+e[r].width-e[r].x),f>e[r].height?(rt=l.startY,ut=f):(rt=e[r].y-e[r].height,ut=e[r].height),c.toLowerCase()=="circle"?(style=this._setPointerDimension(d,this),this._contextOpenPath(style,this),this._setContextRotation(style,this),this.contextEl.arc(h.startX,h.startY,f/2,0,2*Math.PI),this._contextClosePath(style,this)):this["_draw"+c](h,d,this),this._contextOpenPath(b,this),this.contextEl.font=b.font,this.contextEl.translate(tt,it),this.contextEl.fillText(b.textValue,0,0),this._contextClosePath(b,this),this.legendRegion.push({X:k,Y:rt,Width:st,Height:ut,item:u}))}},calcText:function(t,r,u){var h=n(document).find("#measureTex"),f,c=null,l=null,a=null,v=null,o,s,e,y;if(n("#measureTex").css("display","block"),h.length==0?(f=document.createElement("text"),n(f).attr({id:"measureTex"}),document.body.appendChild(f)):f=h[0],typeof t=="string"&&(t.indexOf("<")>-1||t.indexOf(">")>-1)){for(o=t.split(" "),s=0;s<o.length;s++)o[s].indexOf("<br/>")==-1&&(o[s]=o[s].replace(/[<>]/g,"&"));t=o.join(" ")}return f.innerHTML=t,u!=i&&u.size==i&&(e=u,e=e.split(" "),c=e[0],l=e[1],a=e[2],v=e[3]),u!=null&&(f.style.fontSize=u.size>0?u.size+"px":u.size?u.size:l,f.style.fontStyle&&(f.style.fontStyle=u.fontStyle?u.fontStyle:c),f.style.fontFamily=u.fontFamily?u.fontFamily:a,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(f.style.fontWeight=u.fontWeight?u.fontWeight:v)),f.style.backgroundColor="white",f.style.position="absolute",f.style.top=-100,f.style.left=0,f.style.visibility="hidden",f.style.whiteSpace="nowrap",r&&(f.style.maxwidth=r+"px"),y={width:f.offsetWidth,height:f.offsetHeight},n("#measureTex").css("display","none"),y},_calculateLegendBounds:function(){var i=this,r=i.model.legend,f=0,a,e=i.model.legend.position.toLowerCase(),o,v,c,u=10,y=i.model.legend.border.width,p=i.model.legend.itemPadding,s,l,h;return s=i.findMaxHeightWidth(),this._gaugeResizeState||t.util.isNullOrUndefined(i.model.legend.size.height)&&t.util.isNullOrUndefined(i.model.legend.size.width)?(h=i.findLegendMax(),l={Height:h.Height,Width:h.Width},i.model.legend.size._height=i.model.legend.size._width=null):parseInt(i.model.legend.size.width)<s.width&&!t.util.isNullOrUndefined(i.model.legend.size.width)||parseInt(i.model.legend.size.height)<s.height&&!t.util.isNullOrUndefined(i.model.legend.size.height)?(h=i.findLegendMax(),l={Height:h.Height,Width:h.Width},i.model.legend.size._height=i.model.legend.size._width=null):(i.model.legend._legendItemHeight=0,i.model.legend._columnWidth=0,i.model.legend._legendItemWidth=0,i.model.legend._rowCount=1,i.model.legend._columnCount=1,i.model.legend._maxWidth=0,i.model.legend._maxHeight=0,i._columnIncreasing=0,i._columnDecreasing=0,n.each(i.model.scales,function(w,b){if(b.showRanges&&(i.scaleIndex=w,b.ranges!=null)){for(i.rangeEl=b.ranges,i.index=0,a=0;a<i.model.scales[i.scaleIndex].ranges.length;a++)t.util.isNullOrUndefined(i.model.scales[i.scaleIndex].ranges[a].legendText)||f++;n.each(b.ranges,function(n,a){i.rangeIndex=n;!t.util.isNullOrUndefined(a.legendText)&&a.legendText.replace(/\s/g,"").length>0&&i.index<f&&(o=i._getLegendSize(a),parseInt(i.model.legend.size.width)?(c=i.index==0?u+y:e=="top"||e=="bottom"?p:u,v=i.index==0?u+y:0,r._legendItemWidth=e=="top"||e=="bottom"?c+o.Width+r._legendItemWidth:c+s.width+r._legendItemWidth,r._legendItemHeight=v+Math.max(o.Height,r._legendItemHeight),i._columnIncreasing++,i._columnDecreasing=Math.max(i._columnDecreasing,i._columnIncreasing),parseInt(i.model.legend.size.width)<=r._legendItemWidth?(i.model.legend._rowCount++,i._columnIncreasing=0,r._legendItemHeight+=e=="top"||e=="bottom"?i.index==f-1?o.Height+u*2:o.Height+u:i.index==f-1?o.Height+u+p:o.Height+p,r._legendItemWidth=e=="top"||e=="bottom"?i.index==f-1?parseInt(i.model.legend.size.width):o.Width+u:s.width+u):i.index==f-1&&i.model.legend._rowCount>1&&(r._legendItemHeight+=u,i.model.legend.size._width=i.model.legend.size.width,parseInt(i.model.legend.size.width)>s.width*(i._columnDecreasing-1)+(i._columnDecreasing-1)*u+u&&(r._legendItemWidth=s.width*(i._columnDecreasing-1)+(i._columnDecreasing-1)*u+u,i.model.legend.size._width=null))):e=="left"||e=="right"?(c=i.index==0?u+y:i.index==f-1?u:0,v=i.index==0?u+y:p,r._legendItemWidth=c+Math.max(s.width,r._legendItemWidth),r._legendItemHeight=v+o.Height+r._legendItemHeight,i.model.legend.size._height=parseInt(i.model.legend.size.height),parseInt(i.model.legend.size.height)<r._legendItemHeight?(i.model.legend._rowCount++,r._legendItemWidth+=i.index==f-1?s.width+u*2:s.width+u,r._legendItemHeight=o.Height+u):f==1&&parseInt(i.model.legend.size.height)>r._legendItemHeight&&(i.model.legend.size._height=null,r._legendItemWidth+=u,r._legendItemHeight+=u)):(h=i.findLegendMax(),l={Height:h.Height,Width:h.Width},i.index=f-1));i.index++})}}),l={Height:r._legendItemHeight,Width:r._legendItemWidth}),l},findLegendMax:function(){var i=this,r;i.model.legend._legendItemHeight=0;i.model.legend._rowWidth=0;i.model.legend._legendItemWidth=0;i.model.legend._rowCount=1;i.model.legend._columnCount=1;i.model.legend._maxWidth=0;i.model.legend._maxHeight=0;var r=i.model.legend,f=0,a,v,y=i.model.legend.position.toLowerCase(),o,h,c,e=20,u=10,p,s=i.model.legend.border.width,l=i.model.legend.itemPadding;return i.model.legend.size._height=i.model.legend.size._width=null,n.each(i.model.scales,function(w,b){if(b.showRanges&&(i.scaleIndex=w,b.ranges!=null)){for(i.rangeEl=b.ranges,i.index=0,a=0;a<i.model.scales[i.scaleIndex].ranges.length;a++)t.util.isNullOrUndefined(i.model.scales[i.scaleIndex].ranges[a].legendText)||f++;n.each(b.ranges,function(n,a){i.rangeIndex=n;t.util.isNullOrUndefined(a.legendText)||(o=i._getLegendSize(a),y=="top"||y=="bottom"?(f!=1?(c=i.index==0?u*2+s:i.index==f-1?u+l:l,h=i.index==0?u:i.index==f-1?u:0):h=c=u*2,r._legendItemHeight=h+Math.max(o.Height,r._legendItemHeight),r._maxHeight=Math.max(o.Height,r._maxHeight),r._legendItemWidth=c+o.Width+r._legendItemWidth,p=i.model.legend._rowCount>1&&i.index==f-1?u:0,i.model.width-(e-s)<=r._legendItemWidth-p?(i.model.legend._rowCount++,r._rowWidth=Math.max(r._rowWidth,r._legendItemWidth-l-o.Width),r._legendItemWidth=i.index==f-1?r._rowWidth<i.model.width-e*2?r._rowWidth:i.model.width-e*2:i.index==0?e+u+s:o.Width+e+u+s,r._legendItemHeight+=r._maxHeight+(u+s)):i.index==f-1&&i.model.legend._rowCount>1&&(r._legendItemWidth=r._rowWidth<i.model.width-e*2?r._rowWidth:i.model.width-e*2)):(f!=1?(h=i.index==0?u+s:i.index==f-1?u+l:l,c=i.index==0?u:i.index==f-1?u*2:0):h=c=u*2,r._legendItemHeight=o.Height+h+r._legendItemHeight,r._legendItemWidth=c+Math.max(o.Width,r._legendItemWidth),r._maxWidth=Math.max(o.Width,r._maxWidth),i.model.height-e<r._legendItemHeight?(i.model.legend._columnCount++,v=i.model.legend._columnCount==2?e:0,r._legendItemHeight=i.index==f-1?i.model.height-e*2:o.Height+e+u+s+v,r._legendItemWidth+=r._maxWidth+u):i.index==f-1&&i.model.legend._columnCount>1&&(r._legendItemHeight=i.model.height-e*2)),i.index++)})}}),{Height:r._legendItemHeight,Width:r._legendItemWidth}},findMaxHeightWidth:function(){var u=this,t=0,i=0,r;return n.each(u.model.scales,function(f,e){n.each(e.ranges,function(n,f){r=u._getLegendSize(f);t=Math.max(r.Height,t);i=Math.max(r.Width,i)})}),{height:t,width:i}},_getLegendSize:function(n){var t,i,r,u,f=this.model.legend.font;return t=(this.model.legend.itemStyle.width+this.model.legend.itemStyle.height)/2,i=this.calcText(n.legendText,null,f),r=Math.max(t,i.height/2),u=t+3+i.width,{Height:r,Width:u}},_scalesInitialize:function(){var t=this;this.model.scales!=null?n.each(this.model.scales,function(i,r){r=t._checkArrayObject(r,i);var u=t._defaultScaleValues();n.extend(u,r);n.extend(r,u)}):this.model.scales=[this._defaultScaleValues()]},_checkArrayObject:function(t,i){var r=this,u;return n.each(t,function(n,t){if(u=typeof n,(u!="string"||u=="string"&&n.indexOf("_")==-1&&n.indexOf("__")==-1)&&typeof t!="function")if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"&&!t.setter&&!t.factory&&!t.key){var f=r._defaultScaleValues();r._LoadIndividualDefaultValues(t,f,typeof n=="number"?i:n)}}),t},_LoadIndividualDefaultValues:function(t,i,r){var u=null,e=this,f;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),f=typeof r,n.each(t,function(n,t){t instanceof Array?e._checkArrayObject(t,r):t!=null&&typeof t=="object"&&(f!="string"||f=="string"&&r.indexOf("_")==-1&&r.indexOf("__")==-1)&&e._LoadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},_initObject:function(i){var a,h,s,l,f,e,u,d,w,b,r,o,k,g,c;for(this._savedPoints=[],this.element.addClass("e-widget"),i.GaugeEl=this.element,i.canvasEl?(i.canvasEl.remove(),i.GaugeEl.empty()):i.canvasEl=n("<canvas><\/canvas>"),a=0,r=0;this.model.scales[r]!=null;r++){for(this.model.scales[r].minimum==null&&(this.model.scales[r].minimum=this.minimum()),this.model.scales[r].maximum==null&&(this.model.scales[r].maximum=this.maximum()),h=0;this.model.scales[r].pointers[h]!=null;h++)this.model.scales[r].pointers[h].value==null&&(this.model.scales[r].pointers[h].value=this.value());for(s=0;this.model.scales[r].customLabels[s]!=null;s++)if(this.model.scales[r].customLabels[s].value!=null&&(a++,i.GaugeEl.find("div").length==0))if(this.model.scales[r].customLabels[s]!=null&&this.model.scales[r].customLabels[s].positionType!=null&&this.model.scales[r].customLabels[s].positionType=="outer")if(i.outerDiv=t.buildTag("div"),i.model.outerCustomLabelPosition=="bottom")i.GaugeEl.append(i.canvasEl),i.GaugeEl.append(i.outerDiv),i.outerDiv.css("text-align","center");else if(i.model.outerCustomLabelPosition!="top"){l=t.buildTag("TABLE");l.css("width","100%");var v=t.buildTag("TR"),y=t.buildTag("TD"),p=t.buildTag("td");i.model.outerCustomLabelPosition=="left"?(y.append(i.outerDiv),p.append(i.canvasEl)):(y.append(i.canvasEl),p.append(i.outerDiv));v.append(y);v.append(p);l.append(v);i.GaugeEl.append(l);i.outerDiv.css({width:this.element.width()-i.model.width})}else i.GaugeEl.append(i.outerDiv),i.GaugeEl.append(i.canvasEl),i.outerDiv.css("text-align","center");else i.GaugeEl.append(i.canvasEl);a==0&&i.GaugeEl.append(i.canvasEl)}if(i.canvasEl.attr("role","presentation"),_gaugeCount==initialGaugeCount&&(initialDivWidth=window.innerWidth),i.canvasEl[0].setAttribute("width",i.model.width),i.canvasEl[0].setAttribute("height",i.model.height),i.centerX=i.canvasEl[0].width/2,i.centerY=i.canvasEl[0].height/2,f=20,this.model.legend.visible){if(this.model.legend.font.color=this.model.theme=="flatdark"?t.util.isNullOrUndefined(this.model.legend.font.color)?"#8c8c8c":this.model.legend.font.color:t.util.isNullOrUndefined(this.model.legend.font.color)?"#282828":this.model.legend.font.color,d=this.model.legend.position.toLowerCase(),u=this._calculateLegendBounds(),u.Height=t.util.isNullOrUndefined(this.model.legend.size._height)?u.Height:parseInt(this.model.legend.size.height),u.Width=t.util.isNullOrUndefined(this.model.legend.size._width)?u.Width:parseInt(this.model.legend.size.width),this.model.legendActualBounds=u,u.Height>0&&u.Width>0){switch(d){case"top":w=i.model.height-(u.Height+f);i.centerY=u.Height+f+w/2;e=w/2-f;break;case"bottom":i.centerY=(i.model.height-(u.Height+f))/2;e=i.centerY-f;break;case"left":b=i.model.width-(u.Width+f);i.centerX=u.Width+f+b/2;e=b/2-f*2;break;case"right":i.centerX=(i.model.width-(u.Width+f))/2;e=i.centerX-f*2}for(r=0;r<this.model.scales.length;r++)o=this.model.scales[r],k=0,this._scaleRedrawn||(o._radius=o.radius),n.each(o.ranges,function(n,t){k+=t.size}),g=k/o.ranges.length,e=Math.abs((e-g)/(r+1)),e=o.radius=o._radius<e?o._radius:e}}else n.each(this.model.scales,function(n,i){i.radius=t.util.isNullOrUndefined(i._radius)?i.radius:i._radius});if(this._isHalfCircle&&this._isHalfCircle())if(i.model.frame.halfCircleFrameEndAngle-i.model.frame.halfCircleFrameStartAngle>=180){if(i.model.frame.halfCircleFrameStartAngle==0)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width/2;break;case"topleft":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"topcenter":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width/2;break;case"middleleft":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomleft":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomcenter":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width/2}else if(i.model.frame.halfCircleFrameStartAngle==90)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2;i.centerX=i.model.width/2+i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2+i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"middleright":i.centerY=i.model.height/2;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomleft":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"bottomright":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomcenter":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width/2+i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==180)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2;break;case"middleleft":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"middleright":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomleft":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"bottomright":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomcenter":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width/2}}else if(i.model.frame.halfCircleFrameStartAngle==270&&i.model.frame.halfCircleFrameEndAngle==90)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2;i.centerX=i.model.width/2-i.model.radius/2;break;case"topleft":i.centerY=i.model.radius+i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.radius+i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"topcenter":i.centerY=i.model.radius+i.model.distanceFromCorner;i.centerX=i.model.width/2-i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2;i.centerX=i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomleft":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomcenter":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width/2-i.model.radius/2}else if(i.model.frame.halfCircleFrameEndAngle-i.model.frame.halfCircleFrameStartAngle<=90)if(i.model.frame.halfCircleFrameStartAngle==0)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width/2-i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"topcenter":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width/2-i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomleft":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomcenter":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width/2-i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==90)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width/2+i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"topcenter":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width/2+i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomleft":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomcenter":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width/2+i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==180)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width/2+i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2+i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomleft":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomcenter":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width/2+i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==270)switch(i.model.gaugePosition){case"center":i.centerY=i.model.radius/2+i.model.height/2;i.centerX=i.model.width/2-i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2-i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.radius/2+i.model.height/2;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomleft":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomcenter":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width/2-i.model.radius/2}(c=i.canvasEl[0],typeof G_vmlCanvasManager!="undefined"&&(c=window.G_vmlCanvasManager.initElement(c)),c&&c.getContext)&&(i.contextEl=i.canvasEl[0].getContext("2d"))},_browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},_wireEvents:function(){var f=jQuery.uaMatch(navigator.userAgent),r=this._browserInfo(),i=r.isMSPointerEnabled,t=r.pointerEnabled,u;this.startEv=i?t?"pointerdown":"MSPointerDown":"touchstart mousedown";this.endEv=i?t?"pointerup":"MSPointerUp":"touchend mouseup";this.moveEv=i?t?"pointermove":"MSPointerMove":"touchmove mousemove";this.leaveEv=i?t?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.scrollEv=f.browser.toLowerCase()=="mozilla"?t?"mousewheel":"DOMMouseScroll":"mousewheel";this.model.browserInfo=r;u=this.model.readOnly?"pan-y pan-x":"none";n(this.element).css("touch-action",u);this.onMouseMoveHandler=n.proxy(this._onMouseMove,this);this.onMouseUpHandler=n.proxy(this._onMouseUp,this);this.onMouseDownHandler=n.proxy(this._onMouseDown,this);this.onHoverOCustomLabel=n.proxy(this._onHoverOCustomLabel,this);this.onLeaveOCustomLabel=n.proxy(this._onLeaveOCustomLabel,this);this.model.legend.visible&&this._on(n(this.canvasEl),"click",this.legendMouseClick);this._on(n(this.canvasEl),"mousemove",this.rangesMouseMove);(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&(n(this.canvasEl).bind(this.moveEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.scrollEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.startEv,this.onMouseDownHandler),n(this.canvasEl).bind(this.endEv,this.onLeaveOCustomLabel),n(this.canvasEl).bind(this.leaveEv,this.onLeaveOCustomLabel));this.model.readOnly||n(this.canvasEl).bind(this.startEv,this.onMouseDownHandler);this.model.tooltip.showCustomLabelTooltip&&(n("."+this._id+"outercustomlbl").bind("mouseenter",this.onHoverOCustomLabel),n("."+this._id+"outercustomlbl").bind("this.leaveEv",this.onLeaveOCustomLabel))},_unWireEvents:function(){n(this.canvasEl).unbind(this.startEv,this.onMouseDownHandler)},_onHoverOCustomLabel:function(n){(n.currentTarget.innerHTML!=null||n.currentTarget.innerHTML!="")&&this._showTooltip(n,n.currentTarget.innerHTML)},_onLeaveOCustomLabel:function(t){this.isTouch(t)?(this._performTooltip(t),window.clearTimeout(this.model.timer),this.model.timer=setTimeout(function(){n(".tooltipDiv").fadeOut(500)},1200)):this._hideTooltip()},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_showTooltip:function(t,i){var e=this.model.locale,o=e&&this.model.enableGroupSeparator?i.toLocaleString(e):i.toString(),r=n(".tooltipDiv"),s;r.length==0&&(r=n("<div class='tooltipDiv' style='pointer-events:none; position: absolute; z-index: 105; display: block;'><\/div>"),n(document.body).append(r));this.model.tooltip.templateID!=""&&this.model.tooltip.templateID!=null?(s=n("#"+this.model.tooltip.templateID).clone(),n(".tooltipDiv")[0].innerHTML="",n(s).css("display","block").appendTo(r),n(r).css({"pointer-events":"none","background-color":this.model.backgroundColor,border:"1px solid #bbbcbb","border-radius":"3px",color:"#565656"}),r.html(r.html().replace("#label#",o))):(n(r).html(o),n(r).css({"pointer-events":"none","background-color":"white",border:"2px solid #bbbcbb",position:"absolute",padding:"10px 20px","margin-top":"5px","text-align":"left",font:"12px Segoe UI","font-stretch":"condensed",display:"inline-block","border-radius":"3px",color:"#565656",width:"auto"}));var h=10,u=t.pageX+h,f=t.pageY+h;u=u+n(r).width()<this.model.width?u:u-n(r).width();f=f+n(r).height()<this.model.height?f:f-n(r).height();n(r).css("left",u);n(r).css("top",f);n(".tooltipDiv").show()},_hideTooltip:function(){n(".tooltipDiv").remove()},_onMouseDown:function(t){this._blockDefaultActions(t);this._mouseDown=!0;var s=this.isTouch(t)?10:0,o=t.originalEvent.touches?t.originalEvent.touches[0]:t,u={x:this.centerX,y:this.centerY},f={x:o.pageX-n(this.canvasEl).offset().left,y:o.pageY-n(this.canvasEl).offset().top},h=180*this._getCirucumferenceAngle(u,f)/Math.PI,r,e,i=this;this.model.readOnly||n.each(this.model.scales,function(t,o){i.scaleIndex=t;o.pointers!=null&&(i.pointerEl=o.pointers,r=o.radius,e=o.ticks[0].height,n.each(o.pointers,function(t,c){var l;i._isHalfCircle()&&(o.showBackNeedle=!1);l=i._getAngle(c.value);l>360&&(l=l-360);var v=l+c.width,y=l-c.width,a=Math.sqrt((f.x-u.x)*(f.x-u.x)+(f.y-u.y)*(f.y-u.y)),p=a<(c.placement=="far"?r+c.width+c.distanceFromScale:c.placement=="center"?r-c.distanceFromScale:r-15-e-c.distanceFromScale)&&a>(c.placement=="far"?r+c.distanceFromScale:c.placement=="center"?r-c.width-c.distanceFromScale:r-c.width-15-e-c.distanceFromScale),w=c.type=="needle"?a<=c.length:p;i._isBetween(y,v,h,s)&&w&&(i._onMouseClick(l,o.value),i.activeElement=c,n(document).bind(i.moveEv,i.onMouseMoveHandler),n(document).bind(i.endEv,i.onMouseUpHandler))}))})},_onMouseUp:function(){this._mouseDown=!1;n(document).unbind(self.moveEv,self.onMouseMoveHandler);n(document).unbind(self.endEv,self.onMouseUpHandler);this.activeElement&&this._onMouseClickUp(this._getAngle(this.activeElement.value),this.activeElement.value);this.activeElement=null},_mousePosition:function(n){if(!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=i){if(!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},_calTouchPosition:function(n){var i=jQuery.uaMatch(navigator.userAgent),t=this._mousePosition(n);n.pageX=t.x;n.pageY=t.y},getEvent:function(n){return n.targetTouches&&n.targetTouches[0]?n.targetTouches[0]:n},_onMouseMove:function(i){if(this._mouseDown&&!t.isNullOrUndefined(this.activeElement)){this._blockDefaultActions(i);var f={x:this.centerX,y:this.centerY},u=i.originalEvent.touches?i.originalEvent.touches[0]:i,e={x:u.pageX-n(this.canvasEl).offset().left,y:u.pageY-n(this.canvasEl).offset().top},r=180*this._getCirucumferenceAngle(f,e)/Math.PI;r<this.scaleEl[this.scaleIndex].startAngle&&!this._isHalfCircle()&&(r=r+360);this._onMouseClickMove(this._getAngle(this.activeElement.value),this.activeElement.value);this._getValue(r)<=this.scaleEl[this.scaleIndex].maximum&&(this.activeElement.value=this.scaleEl[this.scaleIndex].direction=="clockwise"?this._getValue(r):this.scaleEl[this.scaleIndex].maximum-this._getValue(r));this.contextEl.putImageData?this._reDrawPointer():this._init()}else(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&!this.isTouch(i)&&this._performTooltip(i)},_performTooltip:function(t){for(var r,u=!1,f=10,o=this.isTouch(t),i=0;this._savedPoints[i]!=null;i++)if(o){var c=this._calTouchPosition(t),e=this.getEvent(t),s=e.pageX,h=e.pageY,r={X:s-n(this.canvasEl).offset().left,Y:h-n(this.canvasEl).offset().top};r.X>this._savedPoints[i].startX-f&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width+f&&r.Y>this._savedPoints[i].startY-f&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height+f?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()}else r={X:t.pageX-n(this.canvasEl).offset().left,Y:t.pageY-n(this.canvasEl).offset().top},r.X>this._savedPoints[i].startX&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width&&r.Y>this._savedPoints[i].startY&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()},_isHalfCircle:function(){return this.model.frame.frameType=="halfcircle"?!0:!1},_calFontLength:function(t){var i=this.model.scales[0].minimum+this.model.scales[0].labels[0].unitText,r=this.model.scales[0].maximum+this.model.scales[0].labels[0].unitText,u=r.length>i.length?r:i,f=n('<span id="test"><\/span>').css({font:t,display:"none",whiteSpace:"nowrap"}).appendTo(n("body")).text(u).width();return n("#test").remove(),f/2},_getHalfCircleYPosition:function(){return this._getYCordinate(this.centerY,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2)},_getHalfCircleXPosition:function(){return this._getXCordinate(this.centerX,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2)},_getXCordinate:function(n,t,i){return n+t*Math.cos(Math.PI*(i/180))},_getYCordinate:function(n,t,i){return n+t*Math.sin(Math.PI*(i/180))},_getAngle:function(n){var t;return t=n>=this.scaleEl[this.scaleIndex].minimum&&n<=this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].direction=="clockwise"?n-this.scaleEl[this.scaleIndex].minimum:this.scaleEl[this.scaleIndex].maximum-n:this.scaleEl[this.scaleIndex].direction=="clockwise"?n<=this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:this.scaleEl[this.scaleIndex].maximum:n<=this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].maximum:this.scaleEl[this.scaleIndex].minimum,t*(this.scaleEl[this.scaleIndex].sweepAngle/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum))+this.scaleEl[this.scaleIndex].startAngle},_subtractDecimal:function(n,t){var r=n.toString(),u=t.toString(),f,e,i,o;return f=r.indexOf(".")>-1?r.length-r.indexOf(".")-1:0,e=u.indexOf(".")>-1?u.length-u.indexOf(".")-1:0,i=f>e?f:e,o=(n*Math.pow(10,i)-t*Math.pow(10,i))/Math.pow(10,i),o},_getCirucumferenceAngle:function(n,t){return t.x>n.x?t.y>n.y?this._tangent(n,t):t.y==n.y?0:2*Math.PI+this._tangent(n,t):t.x==n.x?t.y==n.y?0:t.y>n.y?Math.PI/2:1.5*Math.PI:t.y==n.y?Math.PI:t.y>n.y?Math.PI+this._tangent(n,t):Math.PI+this._tangent(n,t)},_calcDistanceFactor:function(n,t,i){var r;return r=n>240&&n<=300||n>60&&n<=120?0:n>330&&n<=360||n>=0&&n<=30?-i*.5:n>30&&n<=60||n>300&&n<=330?-i/2:n>150&&n<=210?i*.5:i/2,t=="far"?-r:r},_tangent:function(n,t){var i=(t.y-n.y)/(t.x-n.x);return Math.atan(i)},_getValue:function(n){return this.scaleEl[this.scaleIndex].direction=="counterclockwise"?(n-this.scaleEl[this.scaleIndex].startAngle)/this.scaleEl[this.scaleIndex].sweepAngle*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum):(n-this.scaleEl[this.scaleIndex].startAngle)/this.scaleEl[this.scaleIndex].sweepAngle*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)+this.scaleEl[this.scaleIndex].minimum},_drawScales:function(){var r=this,u,i,f,t;if(this.scaleEl=this.model.scales,n.each(this.model.scales,function(n,t){r.scaleIndex=n;t.showScaleBar&&r._setScaleCordinates(t)}),this.model.rangeZOrder=="rear"?(this._setRanges(),this._setTicks()):(this._setTicks(),this._setRanges()),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this.contextEl.putImageData||(this.model.enableAnimation=!1),this.model.animationSpeed!=null&&this.model.animationSpeed>0&&(u=this.model.animationSpeed/25,u>=0&&(i=navigator.userAgent.toLowerCase(),f=i.indexOf("msie")!=-1?parseInt(i.split("msie")[1]):0,this.model.enableAnimation&&f!=9))){for(t=0;t<this.model.scales[0].pointers.length;t++)this.pointerValue=[],this.currentValue=[],this.pointerValue[t]=null,this.currentValue[t]=null,this.updatePointerOnAnimation=!1;this.dt=(new Date).getTime();this._onAnimate(this)}this._setIndicators()},_setTicks:function(){var t=this;n.each(this.model.scales,function(i,r){r.showTicks&&(t.scaleIndex=i,r.ticks!=null&&(t.tickEl=r.ticks,n.each(r.ticks,function(n,i){t.tickIndex=n;t._setTicksCordinates(n,i)})))})},_setLabels:function(){var t=this;n.each(this.model.scales,function(i,r){r.showLabels&&(t.scaleIndex=i,r.labels!=null&&(t.labelEl=r.labels,n.each(r.labels,function(n,i){t.labelIndex=n;t._setLabelCoridnates(n,i)})))})},_setIndicators:function(){var t=this;n.each(this.model.scales,function(i,r){r.showIndicators&&(t.scaleIndex=i,r.indicators!=null&&(t.indicatorEl=r.indicators,n.each(r.indicators,function(n,i){t.indicatorIndex=n;t._drawIndicator(n,i)})))})},_setPointers:function(){var t=this;n.each(this.model.scales,function(i,r){r.showPointers&&(t.scaleIndex=i,r.pointers!=null&&(t.pointerEl=r.pointers,n.each(r.pointers,function(n,i){t._isHalfCircle()&&(r.showBackNeedle=!1);t.pointerIndex=n;t._drawPointers(n,i)})))})},_onAnimate:function(n){if(!this._androidAnimation){for(var o=n,i=o,s=i.model.animationSpeed/25,u,f,h=n.model.scales[0].pointers.length,e=[],r=0;r<h;r++)e[r]=!0,i.model.scales[0].pointers[r]._value||(i.model.scales[0].pointers[r]._value=i.model.scales[0].pointers[r].value),i.pointerValue[r]=t.util.isNullOrUndefined(i.pointerValue[r])?i.model.scales[0].pointers[r]._value:i.pointerValue[r],i.currentValue[r]=i.currentValue[r]?i.currentValue[r]:i.model.scales[0].minimum,u=i.pointerValue[r],now=(new Date).getTime(),delta=now-i.dt,delta>s&&u>i.currentValue[r]?(i.currentValue[r]=i.currentValue[r]+(i.model.scales[0].maximum-i.model.scales[0].minimum)/100,i.updatePointerOnAnimation=!0,u>i.currentValue[r]?i.setPointerValue(0,r,i.currentValue[r]):i.setPointerValue(0,r,u),i.dt=now-delta%s):i.currentValue>=u&&(e[r]=!1);for(f=0;f<e.length;f++)if(animationFlag=e[f],animationFlag)break;animationFlag&&requestAnimationFrame(function(){o._onAnimate(o)})}},_pointInterval:function(n,t,i,r){this.timer=setTimeout(function(){t>n?(n=n+(r.model.scales[0].maximum-r.model.scales[0].minimum)/100,t>n?r.setPointerValue(0,0,n):r.setPointerValue(0,0,t)):n>=t&&window.clearInterval(r.timer);r._pointInterval(n,t,i,r)},i)},_setRanges:function(){var t=this;this._rangeCollectionRegions=[];n.each(this.model.scales,function(i,r){r.showRanges&&(t.scaleIndex=i,r.ranges!=null&&(t.rangeEl=r.ranges,n.each(r.ranges,function(n,i){t.rangeIndex=n;(i._visible||!t.model.legend.visible)&&t._setRangeCordinates(n,i)})))})},_setCustomLabel:function(){var t=this,i;n.each(this.model.scales,function(r,u){t.scaleIndex=r;u.customLabels!=null&&(t.customLabelEl=u.customLabels,n.each(u.customLabels,function(n,r){t.customLabelIndex=n;i=t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex];i.value!=null&&(i.positionType=="outer"?t._setOuterCustomLabels(n,r):t._setCustomLabelCordinates(n,r))}))})},_subGauge:function(){var t=this;n.each(this.model.scales,function(i,r){t.scaleIndex=i;r.subGauges!=null&&(t.subGaugeEl=r.subGauges,n.each(r.subGauges,function(n,r){t.subGaugeIndex=i;t._setSubGauge(n,r)}))})},_setOuterCustomLabels:function(n,i){var r,u;this._customLblMaxSize=this._customLblMaxSize<parseFloat(i.font.size.match(/\d+/)[0])?parseFloat(i.font.size.match(/\d+/)[0]):this._customLblMaxSize;r=t.buildTag("div."+this._id+"outercustomlbl");r.text(this.model.scales[this.scaleIndex].customLabels[n].value);u=this.model.outerCustomLabelPosition=="right"||this.model.outerCustomLabelPosition=="left"?"left":"center";this.outerDiv.append(r);this.outerDiv.append("<\/br>");u=="center"?r.css({display:"inline-block",margin:"0 auto","max-width":this.model.width}):r.css({display:"inline-block","max-width":this.element.width()-this.model.width>10?this.element.width()-this.model.width:10});r.css({color:i.color,overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":i.font!=null&&i.font.size!=null?i.font.size:"12px","font-family":i.font!=null&&i.font.fontFamily!=null?i.font.fontFamily:"Arial","font-weight":i.font!=null&&i.font.fontStyle!=null?i.font.fontStyle:"Normal","text-align":u})},_setScaleCordinates:function(n){if(this.region={centerX:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,centerY:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,startAngle:n.startAngle,endAngle:n.startAngle+n.sweepAngle,startRadius:this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2,endRadius:this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2},this.style={radius:n.radius-n.size/2,strokeStyle:n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color),lineWidth:n.border.width,size:n.size,isFill:!0,opacity:isNaN(n.opacity)?1:n.opacity,isStroke:!0,shadowOffset:n.shadowOffset,fillStyle:n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor),counterClockwise:n.direction=="clockwise"?!1:!0},n.maximum<n.minimum){var t=n.maximum;n.maximum=n.minimum;n.minimum=t}n.maximum==n.minimum&&(n.maximum=n.maximum+1);this.maximum(n.maximum);this.minimum(n.minimum);this._notifyArrayChange&&(this._notifyArrayChange("scales["+this.scaleIndex+"]maximum",n.maximum),this._notifyArrayChange("scales["+this.scaleIndex+"]minimum",n.minimum));this._drawScaleBar(this.region,this.style);this.contextEl.getImageData&&(this.scaleImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawOuterLayer:function(){var n,i,r;this._isHalfCircle()&&(i={x:this.centerX,y:this.centerY},r={x:this.centerX+this.model.radius,y:this.centerY/2});n=this.model.isRadialGradient?this.contextEl.createRadialGradient(this.canvasEl[0].width/2,this.canvasEl[0].height/2,0,this.canvasEl[0].width/2,this.canvasEl[0].height/2,this.model.radius):this.contextEl.createLinearGradient(0,0,0,this.canvasEl[0].height);t.isNullOrUndefined(this.model.interiorGradient)||this._setGradientColor(this,n,this.model.interiorGradient.colorInfo);this.frameOuterLocation={centerX:this.centerX,hcCenterX:this.centerX,hcCenterY:this.centerY,centerY:this.centerY,startAngle:this._isHalfCircle()?Math.PI*(this.model.frame.halfCircleFrameStartAngle/180):0,endAngle:this._isHalfCircle()?Math.PI*(this.model.frame.halfCircleFrameEndAngle/180):2*Math.PI};this._isHalfCircle()&&(this.frameInnerLocation={centerX:this.centerX,hcCenterX:this._getXCordinate(this.centerX,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2),hcCenterY:this._getYCordinate(this.centerX,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2),centerY:this.centerY,startAngle:Math.PI*(this.model.frame.halfCircleFrameStartAngle/180),endAngle:Math.PI*(this.model.frame.halfCircleFrameEndAngle/180)});this.frameInnerStyle={radius:this.model.radius,isStroke:!1,isFill:!0,fillStyle:this.model.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(null,this.model.backgroundColor),counterClockwise:!1};this.model.frame.frameType=="fullcircle"?this._drawCircleFrame(this.frameOuterLocation,this.frameInnerStyle):this.model.frame.frameType=="halfcircle"&&this._drawHalfCircle(this.frameInnerLocation,this.frameInnerStyle);this.contextEl.getImageData&&(this.outerImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setTicksCordinates:function(n,t){var e,o,s,h,f,r,i,u;for(t.type=="major"?(f=this.scaleEl[this.scaleIndex].majorIntervalValue,this.majorTickHeight=t.height):f=this.scaleEl[this.scaleIndex].minorIntervalValue,t.placement=="far"&&(r=this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+this.scaleEl[this.scaleIndex].border.width/2+t.distanceFromScale),t.placement=="center"&&(r=this.scaleEl[this.scaleIndex].radius-t.height/2-this.scaleEl[this.scaleIndex].border.width/2-t.distanceFromScale),t.placement=="near"&&(r=this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-this.scaleEl[this.scaleIndex].border.width/2-t.distanceFromScale),s=t.placement=="near"?-t.height:t.height,u=this.scaleEl[this.scaleIndex].maximum;u>=this.scaleEl[this.scaleIndex].minimum;u-=f)(f==this.scaleEl[this.scaleIndex].minorIntervalValue&&u%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||f==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(u==this.scaleEl[this.scaleIndex].minimum&&(h=!0),i=this._getAngle(u),i=i>360?i-360:i,e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,r,i),o=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,r,i),this.region={startX:e,startY:o},this.style={angle:t.angle+i,isStroke:!0,isFill:!1,lineHeight:s,lineWidth:t.width,strokeStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawTicks&&this._onDrawTicks(i,u),this._drawTickMark(this.region,this.style));h||(i=this._getAngle(this.scaleEl[this.scaleIndex].minimum),i=i>360?i-360:i,e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,r,i),o=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,r,i),this.region={startX:e,startY:o},this.style={angle:t.angle+i,isStroke:!0,isFill:!1,lineHeight:s,lineWidth:t.width,strokeStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)});this.contextEl.getImageData&&(this.tickImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setLabelCoridnates:function(n,t){var s,f,e,h,c,o,u,r,i;for(o=t.type=="major"?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,c=t.type=="major"?this.majorIntervalAngle=this.scaleEl[this.scaleIndex].sweepAngle/((this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)/o):this.scaleEl[this.scaleIndex].sweepAngle/((this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)/o),t.placement=="far"&&(u=this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+this.majorTickHeight+t.distanceFromScale),t.placement=="center"&&(u=this.scaleEl[this.scaleIndex].radius-10-t.distanceFromScale),t.placement=="near"&&(u=this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-10-this.majorTickHeight-t.distanceFromScale),this._labelRadius=u,r=this.scaleEl[this.scaleIndex].maximum;r>=this.scaleEl[this.scaleIndex].minimum;r=this._subtractDecimal(r,o))if(r==this.scaleEl[this.scaleIndex].minimum&&(s=!0),o==this.scaleEl[this.scaleIndex].minorIntervalValue&&r%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||o==this.scaleEl[this.scaleIndex].majorIntervalValue){if(r==this.scaleEl[this.scaleIndex].minimum&&!t.includeFirstValue)continue;i=this._getAngle(r);i=i>360?i-360:i;f=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,i);e=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,i);this.region={startX:f,startY:e};this.style={placement:t.placement,textPositionAngle:i,angle:this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?i+t.angle:t.angle,isStroke:!1,isFill:!0,textValue:r,opacity:t.opacity?t.opacity:1,font:this._getFontString(t,t.font),fillStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)};this.model.drawLabels&&this._onDrawLabels(this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?i+t.angle:t.angle,r);this._drawLabel(this.region,this.style,!1);this.model.tooltip.showLabelTooltip&&this._savedPoints.push({startX:f-10,startY:e-5,width:20,height:parseInt(t.font.size.replace(/\D/g,"")),value:r})}s||(i=this._getAngle(this.scaleEl[this.scaleIndex].minimum),i=i>360?i-360:i,f=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,i),e=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,i),this.region={startX:f,startY:e},this.style={angle:this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?i+t.angle:t.angle,isStroke:!1,isFill:!0,textValue:this.scaleEl[this.scaleIndex].minimum,opacity:t.opacity?t.opacity:1,font:this._getFontString(t,t.font),lineHeight:h,lineWidth:t.width,fillStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawLabels&&this._onDrawLabels(i,r),this._drawLabel(this.region,this.style,!1),this.model.tooltip.showLabelTooltip&&this._savedPoints.push({startX:f-10,startY:e-5,width:20,height:parseInt(t.font.size.replace(/\D/g,"")),value:r}),i=this._getAngle(r),i=i>360?i-360:i);this.contextEl.getImageData&&(this.labelImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setRangeCordinates:function(n,i){if(i.startValue<this.scaleEl[this.scaleIndex].maximum&&i.endValue<=this.scaleEl[this.scaleIndex].maximum){var o=i.startValue>=this.scaleEl[this.scaleIndex].minimum?i.startValue:this.scaleEl[this.scaleIndex].minimum,s=i.endValue>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:i.endValue,h,c,l,a,r,u,f,v,y,e,p;p=this._getAngle((o+s)/2);r=this._getAngle(o);f=this._getAngle(s);u=this.scaleEl[this.scaleIndex].radius-i.distanceFromScale-this.scaleEl[this.scaleIndex].size/2-i.size-(t.isNullOrUndefined(this.scaleEl[this.scaleIndex].ticks[0])?16:this.scaleEl[this.scaleIndex].ticks[0].height);v=this.scaleEl[this.scaleIndex].radius-i.distanceFromScale-this.scaleEl[this.scaleIndex].size/2-(t.isNullOrUndefined(this.scaleEl[this.scaleIndex].ticks[0])?16:this.scaleEl[this.scaleIndex].ticks[0].height);y=this.scaleEl[this.scaleIndex].radius-i.distanceFromScale-i.size-this.scaleEl[this.scaleIndex].size/2-(t.isNullOrUndefined(this.scaleEl[this.scaleIndex].ticks[0])?16:this.scaleEl[this.scaleIndex].ticks[0].height);h=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,r);c=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,r);l=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,f);a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,f);r=180*this._getCirucumferenceAngle({x:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,y:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY},{x:h,y:c})/Math.PI;f=180*this._getCirucumferenceAngle({x:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,y:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY},{x:l,y:a})/Math.PI;!t.isNullOrUndefined(i.gradients)&&i.gradients.colorInfo.length>0?(e=this.contextEl.createRadialGradient(this.centerX,this.centerY,y,this.centerX,this.centerY,v),this._setGradientColor(this,e,i.gradients.colorInfo)):e=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.backgroundColor);this.region={startX:h,startY:c,endX:l,endY:a,startAngle:r,endAngle:f};this.style={placement:i.placement,radius:i.placement=="near"?this.scaleEl[this.scaleIndex].radius-i.distanceFromScale:this.scaleEl[this.scaleIndex].radius+i.distanceFromScale,rangeStart:o,rangeEnd:s,startWidth:i.startWidth,isFill:!0,fillStyle:e,strokeStyle:i.border.color=="transparent"?"rgba(0,0,0,0)":i.border.color,opacity:isNaN(i.opacity)?1:i.opacity,counterClockwise:this.scaleEl[this.scaleIndex].direction=="clockwise"?!1:!0,startRadius:v,endRadius:y,endWidth:i.endWidth,lineWidth:i.border.width,isStroke:!0};this.model.drawRange&&this._onDrawRange(this.region,this.style);this._rangeCollectionRegions.push({Range:i,Region:this.region,scaleIndex:this.scaleIndex,rangeIndex:this.rangeIndex,Radius:{startRadius:this.style.startRadius,endRadius:this.style.endRadius},centerRadius:{centerX:this.centerX,centerY:this.centerY,radius:this.style.radius}});this._drawRange(this.region,this.style);this.contextEl.getImageData&&(this.rangeImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))}},_setSubGauge:function(t,i){var r=n("div[id="+i.controlID+"]"),u;r.length>0&&r.find("canvas").length&&(u=r.find("canvas")[0].getContext("2d"),this.contextEl.drawImage(u.canvas,i.position.x,i.position.y,i.width,i.height),r.css("display","none"),this.contextEl.getImageData&&(this.subGaugeImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height)))},_setCustomLabelCordinates:function(n,i){this._customLblMaxSize=this._customLblMaxSize<parseFloat(i.font.size.match(/\d+/)[0])?parseFloat(i.font.size.match(/\d+/)[0]):this._customLblMaxSize;i.color=i.color?i.color:"#282828";this.region=i.position?{startX:i.position.x,startY:i.position.y}:{startX:0,startY:0};this.style={angle:i.textAngle,textValue:i.value,fillStyle:i.color=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.color),font:this._getFontString(i,i.font)};this.model.drawCustomLabel&&this._onDrawCustomLabel(this.region,this.style);this._drawLabel(this.region,this.style,!0);this.model.tooltip.showCustomLabelTooltip&&this._savedPoints.push({startX:this.region.startX-30,startY:this.region.startY-5,width:60,height:t.isNullOrUndefined(i.font)?10:parseInt(i.font.size.replace(/\D/g,"")),value:this.style.textValue});this.contextEl.getImageData&&(this.customLabelImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawIndicator:function(i,r){var u=this,e=!1,f;this.region={centerX:r.position.x-r.width/2,textLocation:r.position,centerY:r.position.y-r.height/2,startAngle:0,endAngle:2*Math.PI};this.style={radius:(r.height+r.width)/2,strokeStyle:"#2BA104",cornerRadius:r.type=="roundedrectangle"?2:0,height:r.height,width:r.width,lineWidth:r.indicatorBorderWidth,fillStyle:"#2BA104",isStroke:!0,isFill:!0,indicatorText:r.indicatorText,textColor:null,font:null,counterClockwise:!1};this.model.drawIndicators&&this._onDrawIndicators(this.style,this.region);r.type==t.datavisualization.CircularGauge.IndicatorType.Image?(f=new Image,f.onload=function(){u.contextEl.drawImage(this,r.position.x,r.position.y)},f.src=r.imageUrl):r.stateRanges!=null&&n.each(r.stateRanges,function(n,i){u.pointerEl[u.pointerIndex].value>=i.startValue&&u.pointerEl[u.pointerIndex].value<=i.endValue&&(e=!0,!t.isNullOrUndefined(i.text)&&i.text.length>0&&(u.style.indicatorText=i.text,u.style.textColor=i.textColor=="transparent"?"rgba(0,0,0,0)":i.textColor,u.style.font=r.font),u.style.strokeStyle=i.borderColor=="transparent"?"rgba(0,0,0,0)":i.borderColor,u.style.fillStyle=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":i.backgroundColor,u._drawIndicatorFrame(r.type,u.region,u.style))});e||r.type==t.datavisualization.CircularGauge.IndicatorType.Image||u._drawIndicatorFrame(r.type,u.region,u.style);this.contextEl.getImageData&&r.type!=t.datavisualization.CircularGauge.IndicatorType.Image&&(this.indicatorImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawIndicatorFrame:function(n,t,i){switch(n){case"circle":this._drawCircleFrame(t,i);break;case"roundedrectangle":case"rectangle":this._drawRectangleFrame(t,i);break;case"text":this._drawText(t,i)}},_drawScaleBar:function(n,t){this.contextEl.shadowColor=t.strokeStyle=="transparent"?"rgba(0,0,0,0)":t.strokeStyle;t.shadowOffset&&(this.contextEl.shadowBlur=t.shadowOffset);this._contextOpenPath(t,this);n.endAngle-n.startAngle==0?this.contextEl.arc(n.centerX,n.centerY,n.startRadius,Math.PI*0,Math.PI*0,!1):(n.endAngle-n.startAngle)%360==0?(this.contextEl.arc(n.centerX,n.centerY,n.startRadius,Math.PI*0,Math.PI*2,!1),this.contextEl.arc(n.centerX,n.centerY,n.endRadius,Math.PI*2,Math.PI*0,!0)):(this.contextEl.arc(n.centerX,n.centerY,n.startRadius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),!1),this.contextEl.arc(n.centerX,n.centerY,n.endRadius,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!0));this._contextClosePath(t,this)},_drawTickMark:function(n,t){this._contextOpenPath(t,this);this.contextEl.translate(n.startX,n.startY);this.contextEl.lineTo(0,0);this.contextEl.rotate(Math.PI*(t.angle/180));this.contextEl.lineTo(t.lineHeight,0);this._contextClosePath(t,this)},_drawLabel:function(n,i,r){var f=0,e=this.model.locale,u;t.isNullOrUndefined(r)||r||(u=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitTextPosition,i.textValue=i.textValue%1!=0?+parseFloat(i.textValue.toFixed(3)):i.textValue,i.textValue=e&&this.model.enableGroupSeparator?i.textValue.toLocaleString(e):i.textValue,t.isNullOrUndefined(u)||u.toString()!="back"?t.isNullOrUndefined(u)||u.toString()!="front"||(i.textValue=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText+i.textValue):i.textValue+=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText,f=this._calcDistanceFactor(i.textPositionAngle,i.placement,this._calFontLength(i.font)));this._contextOpenPath(i,this);this.contextEl.textAlign="center";this.contextEl.textBaseline="middle";this.contextEl.font=i.font;this.contextEl.translate(n.startX+f,n.startY);this.contextEl.lineTo(0,0);r?r&&i.angle!=0&&this.contextEl.rotate(Math.PI*(i.angle/180)):this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?this.contextEl.rotate(Math.PI*((i.angle-270)/180)):this.contextEl.rotate(Math.PI*(i.angle/180));this.contextEl.fillText(i.textValue,0,0);this._contextClosePath(i,this)},_drawCircleFrame:function(n,t){this._contextOpenPath(t,this);this.contextEl.arc(n.centerX,n.centerY,t.radius,n.startAngle,n.endAngle,t.counterClockwise);this._contextClosePath(t,this);t.indicatorText&&this._drawText(n,t)},_drawHalfCircle:function(n,t){this._contextOpenPath(t,this);this.contextEl.lineJoin="round";this.contextEl.arc(n.centerX,n.centerY,t.radius,n.startAngle,n.endAngle,!1);this.contextEl.lineTo(n.centerX,n.centerY);this._contextClosePath(t,this)},_drawRectangleFrame:function(n,t){this._contextOpenPath(t,this);this.contextEl.translate(n.centerX,n.centerY-t.height/2);this.contextEl.lineTo(t.cornerRadius,0);this.contextEl.lineTo(t.width-t.cornerRadius,0);this.contextEl.quadraticCurveTo(t.width,0,t.width,t.cornerRadius);this.contextEl.lineTo(t.width,t.height-t.cornerRadius);this.contextEl.quadraticCurveTo(t.width,t.height,t.width-t.cornerRadius,t.height);this.contextEl.lineTo(t.cornerRadius,t.height);this.contextEl.quadraticCurveTo(0,t.height,0,t.height-t.cornerRadius);this.contextEl.lineTo(0,t.cornerRadius);this.contextEl.quadraticCurveTo(0,0,t.cornerRadius,0);this._contextClosePath(t,this);t.indicatorText&&this._drawText(n,t)},_drawText:function(n,t){this.contextEl.beginPath();this.contextEl.textAlign="center";this.contextEl.fillStyle=t.textColor=="transparent"?"rgba(0,0,0,0)":t.textColor;this.contextEl.font=t.font;this.contextEl.fillText(t.indicatorText,n.textLocation.x,n.textLocation.y);this.contextEl.closePath()},_drawRange:function(n,t){var i;if(t.startWidth==null&&t.endWidth==null)this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.startRadius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.endRadius,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this);else{var u=t.startWidth>t.endWidth?t.startWidth-t.endWidth:t.endWidth-t.startWidth,f=this.scaleEl[this.scaleIndex].direction=="clockwise"?n.startAngle<n.endAngle?n.endAngle-n.startAngle:360-(n.startAngle-n.endAngle):n.endAngle<n.startAngle?n.startAngle-n.endAngle:n.startAngle+(360-n.endAngle),r=f/(u*2);if(t.startWidth<t.endWidth)for(t.startWidth!=0&&(this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.placement=="near"?t.radius-t.startWidth:t.radius+t.startWidth,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this)),t.radius=t.placement=="near"?t.radius-t.startWidth:t.radius+t.startWidth,t.endWidth-=t.startWidth,t.startWidth=0,i=t.startWidth;i<t.endWidth;i+=.5)this.contextEl.beginPath(),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this.contextEl.lineWidth=2,this.contextEl.strokeStyle=t.fillStyle,this.contextEl.stroke(),this.contextEl.restore(),n.startAngle=this.scaleEl[this.scaleIndex].direction=="clockwise"?n.startAngle+r:n.startAngle-r,t.radius=t.placement=="near"?t.radius-.5:t.radius+.5;else for(t.endWidth!=0&&(this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.placement=="near"?t.radius-t.endWidth:t.radius+t.endWidth,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this)),t.radius=t.placement=="near"?t.radius-t.endWidth:t.radius+t.endWidth,t.startWidth-=t.endWidth,t.endWidth=0,i=t.endWidth;i<t.startWidth;i+=.5)this.contextEl.beginPath(),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.lineWidth=2,this.contextEl.strokeStyle=t.fillStyle,this.contextEl.stroke(),this.contextEl.restore(),n.endAngle=this.scaleEl[this.scaleIndex].direction=="clockwise"?n.endAngle-r:n.endAngle+r,t.radius=t.placement=="near"?t.radius-.5:t.radius+.5}},_drawPointers:function(n,i){i.value=i.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:i.value;i.value=i.value<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:i.value;var e,u,r,f,o,s=this.model.locale;r=this._getAngle(i.value);r=r>360?r-360:r;i.type=="needle"?(i.placement=="far"&&(f=i.length+this.scaleEl[this.scaleIndex].size/2),i.placement=="center"&&(f=i.length),i.placement=="near"&&(f=i.length-this.scaleEl[this.scaleIndex].size/2)):(f=i.length,i.placement=="far"&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+i.distanceFromScale,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+i.distanceFromScale,r)),i.placement=="center"&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale,r)),i.placement=="near"&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale-this.majorTickHeight-15,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale-this.majorTickHeight-15,r)),this._isHalfCircle&&this._isHalfCircle()||(this.model.height>this.model.width?u+=(this.model.height-this.model.width)/2:this.model.height<this.model.width&&(u-=(this.model.width-this.model.height)/2)));f>this.model.radius&&(f=this.model.radius);this.region={startX:i.type=="needle"?this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX:e,startY:i.type=="needle"?this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY:u};!t.isNullOrUndefined(i.gradients)&&i.gradients.colorInfo.length>0?(o=this.contextEl.createLinearGradient(0,0,0,i.width),this._setGradientColor(this,o,i.gradients.colorInfo)):o=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.backgroundColor);this.style={width:i.width,isFill:!0,isStroke:!0,radius:0,showBackNeedle:i.showBackNeedle,backNeedleLength:i.backNeedleLength,angle:i.type=="needle"?r:i.placement=="far"?r:r+180,height:f,lineWidth:i.border.width,opacity:isNaN(i.opacity)?1:i.opacity,strokeStyle:i.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.border.color),fillStyle:o,imageUrl:i.imageUrl,type:i.type};this.model.drawPointers&&this._onDrawPointers(r,i.value);i.type=="needle"?(this._drawNeedlePointer(this.region,this.style,i),this._setPointerCap(i)):(i.markerType=="roundedrectangle"&&(this.style.radius=5),this._drawMarkerType(i.markerType,this.region,this.style));i.pointerValueText.showValue&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._labelRadius+i.pointerValueText.distance,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,this._labelRadius+i.pointerValueText.distance,r),this.region={startX:e,startY:u},this.style={angle:i.pointerValueText.autoAngle?i.pointerValueText.angle+r:i.pointerValueText.angle,textValue:s&&this.model.enableGroupSeparator?i.value.toLocaleString(s):i.value,fillStyle:i.pointerValueText.color=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.pointerValueText.color),font:this._getFontString(i,i.pointerValueText.font),opacity:i.pointerValueText.opacity},this._drawPointerValueText(this.region,this.style));this.contextEl.getImageData&&(this.pointerImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height));this._notifyArrayChange&&this._notifyArrayChange("scales["+this.scaleIndex+"]pointers["+n+"]value",i.value);this.value(i.value)},_drawPointerValueText:function(n,t){this._contextOpenPath(t,this);this.contextEl.textAlign="center";this.contextEl.textBaseline="middle";this.contextEl.font=t.font;this.contextEl.translate(n.startX,n.startY);this.contextEl.lineTo(0,0);this.scaleEl[this.scaleIndex].pointers[this.pointerIndex].pointerValueText.autoAngle?this.contextEl.rotate(Math.PI*((t.angle-270)/180)):this.contextEl.rotate(Math.PI*(t.angle/180));this.contextEl.fillText(t.textValue,0,0);this._contextClosePath(t,this)},_drawMarkerType:function(n,i,r){switch(n){case"rectangle":this._drawRectangle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"triangle":this._drawTriangle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"ellipse":this._drawEllipse(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"diamond":this._drawDiamond(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"pentagon":this._drawPentagon(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"circle":this._drawCircle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"slider":this._drawSlider(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"pointer":this._drawPointer(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"wedge":this._drawWedge(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"trapezoid":this._drawTrapezoid(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"roundedrectangle":this._drawRoundedRectangle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"image":this._drawImagePointer(i,r,this)}},_drawNeedlePointer:function(n,t,i){this.pointerEl[this.pointerIndex].needleType=="image"?this._drawImagePointer(n,t,i):(this._contextOpenPath(t,this),this.contextEl.translate(n.startX,n.startY),this.contextEl.rotate(Math.PI*(t.angle/180)),this.contextEl.lineTo(0,-t.width/2),this.pointerEl[this.pointerIndex].needleType=="triangle"?this.contextEl.lineTo(t.height,0):this.pointerEl[this.pointerIndex].needleType=="rectangle"?(this.contextEl.lineTo(t.height,-t.width/2),this.contextEl.lineTo(t.height,t.width/2)):this.pointerEl[this.pointerIndex].needleType=="trapezoid"?(this.contextEl.lineTo(t.height,-t.width/4),this.contextEl.lineTo(t.height,t.width/4)):this.pointerEl[this.pointerIndex].needleType=="arrow"&&(this.contextEl.lineTo(t.height-t.height/4,-t.width/6),this.contextEl.lineTo(t.height-t.height/4,-t.width/2),this.contextEl.lineTo(t.height,0),this.contextEl.lineTo(t.height-t.height/4,t.width/2),this.contextEl.lineTo(t.height-t.height/4,t.width/6)),this.contextEl.lineTo(0,t.width/2),t.showBackNeedle&&(this.contextEl.lineTo(-(t.backNeedleLength+this.scaleEl[this.scaleIndex].pointerCap.radius/2),t.width/2),this.contextEl.lineTo(-(t.backNeedleLength+this.scaleEl[this.scaleIndex].pointerCap.radius/2),-t.width/2)),this._contextClosePath(t,this));this.canvasEl.attr("aria-label",this.model.scales[this.scaleIndex].pointers[this.pointerIndex].value)},_drawImagePointer:function(n,t){var i=this,r=new Image,f=t.angle,e=n.startX,o=n.startY,s=t.width,u=t.height,h=t.type;r.onload=function(){i.contextEl.save();i.contextEl.translate(e,o);i.contextEl.rotate(Math.PI*(f/180));i.contextEl.drawImage(this,0,-u/2,s,u);i.contextEl.restore()};r.src=t.imageUrl},_setPointerCap:function(n){var i;i=this.contextEl.createRadialGradient(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.canvasEl[0].height/2,0,this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.canvasEl[0].height/2,this.scaleEl[this.scaleIndex].pointerCap.radius);t.isNullOrUndefined(this.scaleEl[this.scaleIndex].pointerCap.interiorGradient)?i=this.scaleEl[this.scaleIndex].pointerCap.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,this._getColor(n,this.scaleEl[this.scaleIndex].pointerCap.backgroundColor)):this._setGradientColor(this,i,this.scaleEl[this.scaleIndex].pointerCap.interiorGradient.colorInfo);this.region={centerX:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,centerY:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,startAngle:0,endAngle:2*Math.PI};this.style={isStroke:!0,isFill:!0,strokeStyle:this.scaleEl[this.scaleIndex].pointerCap.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,this._getColor(n,this.scaleEl[this.scaleIndex].pointerCap.borderColor)),radius:this.scaleEl[this.scaleIndex].pointerCap.radius,lineWidth:this.scaleEl[this.scaleIndex].pointerCap.borderWidth,fillStyle:i};this.model.drawPointerCap&&this._onDrawPointerCap();this._drawCircleFrame(this.region,this.style)},isAndroid:function(){return/android/i.test(navigator.userAgent.toLowerCase())},redraw:function(n){switch(n){case"scale":this._reDrawScale();break;case"pointer":this._reDrawPointer();break;case"range":this._reDrawRange();break;case"label":this._reDrawLabel();break;case"tickMark":this._reDrawTickMark();break;case"subGauges":this._reDrawSubGauge();break;case"CustomLabel":this._reDrawCustomLabel();break;default:this._init()}},_getIndicatorImage:function(){return this.pointerImage?this.pointerImage:this._getPointerImage()},_getPointerImage:function(){return this.customLabelImage?this.customLabelImage:this._getCustomLabelImage()},_getSubGaugeImage:function(){return this.labelImage?this.labelImage:this._getLabelImage()},_getCustomLabelImage:function(){return this.subGaugeImage?this.subGaugeImage:this._getSubGaugeImage()},_getRangeImage:function(){return this.model.rangeZOrder=="rear"?this.scaleImage?this.scaleImage:this.outerImage:this.tickImage?this.tickImage:this._getTickImage()},_getLabelImage:function(){return this.model.rangeZOrder=="rear"?this.tickImage?this.tickImage:this._getTickImage():this.tickImage?this.rangeImage:this._getRangeImage()},_getTickImage:function(){return this.model.rangeZOrder=="rear"?this.rangeImage?this.rangeImage:this._getRangeImage():this.scaleImage?this.scaleImage:this.outerImage},getPointerValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].value:null},setMarkerDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getMarkerDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].distanceFromScale:null},setPointerLength:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].length=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getPointerLength:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].length:null},setPointerWidth:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].width=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getPointerWidth:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].width:null},setBackNeedleLength:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].backNeedleLength=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getBackNeedleLength:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].backNeedleLength:null},setNeedleStyle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].needleType=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getNeedleStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].needleType:null},setPointerPlacement:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getPointerPlacement:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].placement:null},setPointerNeedleType:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].type=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize())},getPointerNeedleType:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].type:null},setMarkerStyle:function(n,i,r){n<this.model.scales.length&&i<this.model.scales[n].pointers.length&&r!=null&&(r!="roundedrectangle"&&t.isNullOrUndefined(t.datavisualization.CircularGauge.MarkerType[r.replace(/\w\S*/g,function(n){return n.charAt(0).toUpperCase()+n.substr(1).toLowerCase()})])||(this.scaleEl[n].pointers[i].markerType=r,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize()))},getMarkerStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].markerType:null},setCustomLabelValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].value=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize())},getCustomLabelValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].value:null},setSubGaugeLocation:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].subGauges.length&&i!=null&&(this.scaleEl[n].subGauges[t].position.x=i.x,this.scaleEl[n].subGauges[t].position.y=i.y,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawSubGauge():this._initialize())},getSubGaugeLocation:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].subGauges.length?this.scaleEl[n].subGauges[t].position:null},setCustomLabelAngle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].textAngle=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize())},getCustomLabelAngle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].textAngle:null},setRangeStartValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].startValue=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeStartValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].startValue:null},setRangeEndValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].endValue=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeEndValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].endValue:null},setRangeSize:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].size=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},setRangeVisible:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t]._visible=i,this.contextEl.putImageData&&!this.isAndroid()?(this._initialize(),this._wireEvents()):this._initialize())},getRangeSize:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].size:null},setRangeDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].distanceFromScale:null},setRangePosition:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangePosition:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].placement:null},setRangeBorderWidth:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].border.width=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeBorderWidth:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].border.width:null},setPointerValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(i>=this.scaleEl[n].minimum&&i<=this.scaleEl[n].maximum&&(this.scaleEl[n].pointers[t].value=i),!this.updatePointerOnAnimation&&this.model.enableAnimation&&(this.pointerValue[t]=i),this.contextEl.putImageData&&!this._androidAnimation?(this._reDrawPointer(),this.updatePointerOnAnimation=!1):this._initialize())},setLabelAngle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].angle=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelAngle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].angle:null},setLabelDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].distanceFromScale:null},setLabelStyle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].type=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].type:null},setLabelPlacement:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelPlacement:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].placement:null},setTickAngle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].angle=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickAngle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].angle:null},setTickStyle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].type=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].type:null},setTickPlacement:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickPlacement:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].placement:null},setTickWidth:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].width=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickWidth:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].width:null},setTickHeight:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].height=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickHeight:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].height:null},setTickDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].distanceFromScale:null},setStartAngle:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].startAngle=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getStartAngle:function(n){return n<this.model.scales.length?this.scaleEl[n].startAngle:null},setSweepAngle:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].sweepAngle=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getSweepAngle:function(n){return n<this.model.scales.length?this.scaleEl[n].sweepAngle:null},setMinimumValue:function(n,t){n<this.model.scales.length&&t!=null&&(t<this.scaleEl[n].maximum&&(this.scaleEl[n].minimum=t),this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMinimumValue:function(n){return n<this.model.scales.length?this.scaleEl[n].minimum:null},setMaximumValue:function(n,t){n<this.model.scales.length&&t!=null&&(t>this.scaleEl[n].minimum&&(this.scaleEl[n].maximum=t),this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMaximumValue:function(n){return n<this.model.scales.length?this.scaleEl[n].maximum:null},setScaleBarSize:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].size=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleBarSize:function(n){return n<this.model.scales.length?this.scaleEl[n].size:null},setScaleRadius:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].radius=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleRadius:function(n){return n<this.model.scales.length?this.scaleEl[n].radius:null},setMajorIntervalValue:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].majorIntervalValue=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMajorIntervalValue:function(n){return n<this.model.scales.length?this.scaleEl[n].majorIntervalValue:null},setMinorIntervalValue:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].minorIntervalValue=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMinorIntervalValue:function(n){return n<this.model.scales.length?this.scaleEl[n].minorIntervalValue:null},setPointerCapRadius:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].pointerCap.radius=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getPointerCapRadius:function(n){return n<this.model.scales.length?this.scaleEl[n].pointerCap.radius:null},setScaleBorderWidth:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].border.width=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleBorderWidth:function(n){return n<this.model.scales.length?this.scaleEl[n].border.width:null},setPointerCapBorderWidth:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].pointerCap.borderWidth=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getPointerCapBorderWidth:function(n){return n<this.model.scales.length?this.scaleEl[n].pointerCap.borderWidth:null},setScaleDirection:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].direction=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleDirection:function(n){return n<this.model.scales.length?this.scaleEl[n].direction:null},includeFirstValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].includeFirstValue=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},_reDrawScale:function(){this.model.frame.backgroundImageUrl?this.initialize():(this.contextEl.putImageData(this.outerImage,0,0),this._drawScales())},_reDrawPointer:function(){this.model.frame.backgroundImageUrl?this.initialize():(this.contextEl.putImageData(this._getPointerImage(),0,0),this._setPointers(),this._setIndicators())},_reDrawCustomLabel:function(){this.model.frame.backgroundImageUrl?this.initialize():(this.contextEl.putImageData(this._getCustomLabelImage(),0,0),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawRange:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getRangeImage(),0,0),this.model.rangeZOrder=="rear"?(this._setRanges(),this._setTicks()):this._setRanges(),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawLabel:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getLabelImage(),0,0),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawTickMark:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getTickImage(),0,0),this.model.rangeZOrder=="rear"?this._setTicks():(this._setTicks(),this._setRanges()),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawSubGauge:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getSubGaugeImage(),0,0),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},refreshSubGauge:function(){this.contextEl.putImageData?this._reDrawSubGauge():this._initialize()},refresh:function(){this._scaleRedrawn=!0;this._initialize();this._wireEvents()},exportImage:function(n,i){var f,u,o,r,c,s;if(t.browserInfo().name==="msie"&&parseFloat(t.browserInfo().version)<10)return!1;f=this.canvasEl[0].toDataURL();f=f.replace(/^data:[a-z]*;,/,"");var l=f.split(","),e=atob(l[1]),h=new ArrayBuffer(e.length),a=new Uint8Array(h);for(u=0;u<e.length;u++)a[u]=e.charCodeAt(u);return o=new Blob([h],{type:"image/png"}),t.browserInfo().name==="msie"?window.navigator.msSaveOrOpenBlob(o,n+"."+i):(r=document.createElement("a"),c=URL.createObjectURL(o),r.href=c,r.setAttribute("download",n+"."+i),document.createEvent?(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(s)):r.fireEvent&&r.fireEvent("onclick")),!0},resizeCanvas:function(){var e,o,i,f,r;if(_gaugeCount=_gaugeCount!=0?_gaugeCount-1:n(".e-circulargauge").length-1,o=!0,t.isNullOrUndefined(this.GaugeEl.parent().attr("style"))||(e=this.GaugeEl.parent().attr("style").split(";")),t.isNullOrUndefined(e)||n.each(e,function(n,t){while(t.indexOf("width")!=-1){o=t.indexOf("px")==-1?!0:!1;break}}),o){var u=window.innerWidth/initialDivWidth,s=this.model.width,h=this.model.height;for((s*u>window.innerWidth||h*u>window.innerHeight)&&(u=1),this.model.width*=u,this.model.height*=u,this.model.radius*=u,this._gaugeResizeState=!0,i=0;this.model.scales[i]!=null;i++){for(this.model.scales[i].radius*=u,this.model.scales[i].pointerCap.radius*=u,f=0;f<this.model.scales[i].customLabels.length;f++)t.isNullOrUndefined(this.model.scales[i].customLabels[f])||(this.model.scales[i].customLabels[f].positionType!="outer"&&(this.model.scales[i].customLabels[f].position.x*=u),this.model.scales[i].customLabels[f].position.y*=u,this.model.scales[i].customLabels[f].font.size=parseFloat(this.model.scales[i].customLabels[f].font.size.match(/\d+/)[0])*u<10?"10px":parseFloat(this.model.scales[i].customLabels[f].font.size.match(/\d+/)[0])*u>this._customLblMaxSize?this._customLblMaxSize.toString()+"px":(parseFloat(this.model.scales[i].customLabels[f].font.size.match(/\d+/)[0])*u).toString()+"px");for(r=0;this.model.scales[i].labels[r]!=null||this.model.scales[i].pointers[r]!=null||this.model.scales[i].ranges[r]!=null||this.model.scales[i].indicators[r]!=null||this.model.scales[i].subGauges[r]!=null||this.model.scales[i].ticks[r]!=null;r++)t.isNullOrUndefined(this.model.scales[i].ticks[r])||(this.model.scales[i].ticks[r].height*=u),t.isNullOrUndefined(this.model.scales[i].pointers[r])||(this.model.scales[i].pointers[r].length*=u,this.model.scales[i].pointers[r].width*=u,this.model.scales[i].pointers[r].backNeedleLength*=u),t.isNullOrUndefined(this.model.scales[i].ranges[r])||(this.model.scales[i].ranges[r].distanceFromScale*=u,this.model.scales[i].ranges[r].size*=u),!t.isNullOrUndefined(this.model.scales[i].indicators[r])&&this.model.scales[i].showIndicators&&(this.model.scales[i].indicators[r].height*=u,this.model.scales[i].indicators[r].width*=u,this.model.scales[i].indicators[r].position.x*=u,this.model.scales[i].indicators[r].position.y*=u),!t.isNullOrUndefined(this.model.scales[i].subGauges[r])&&t.isNullOrUndefined(this.model.scales[i].subGauges[r].controlID)&&(this.model.scales[i].subGauges[r].height*=u,this.model.scales[i].subGauges[r].width*=u,this.model.scales[i].subGauges[r].position.x*=u)}this.refresh();_gaugeCount==0&&(initialDivWidth=window.innerWidth)}},_onDrawTicks:function(n,t){var i={index:this.tickIndex,element:this.tickEl[this.tickIndex],angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,pointerValue:t,style:this.style,position:this.region,tick:i};this._trigger("drawTicks",r)},_onDrawLabels:function(n,t){var i={index:this.labelIndex,element:this.labelEl[this.labelIndex],angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,pointerValue:t,style:this.style,position:this.region,label:i};this._trigger("drawLabels",r)},_onDrawPointers:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],angle:parseInt(n),pointerValue:t},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,pointer:i};this._trigger("drawPointers",r)},_onDrawRange:function(){var n={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,rangeIndex:this.rangeIndex,rangeElement:this.rangeEl[this.rangeEl],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawRange",n)},_onDrawCustomLabel:function(){var n={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,customLabelIndex:this.customLabelIndex,customLabelElement:this.customLabelEl[this.customLabelIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawCustomLabel",n)},_onDrawIndicators:function(){var n={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,indicatorIndex:this.indicatorIndex,indicatorEl:this.indicatorEl[this.indicatorIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawIndicators",n)},_onDrawPointerCap:function(){var n={object:this,scaleElement:this.model.scales,position:this.region,style:this.style,context:this.contextEl};this._trigger("drawPointerCap",n)},_onRenderComplete:function(){var n={object:this,scaleElement:this.model.scales,context:this.contextEl};this._trigger("renderComplete",n)},_onMouseClick:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.position,pointers:i};this._trigger("mouseClick",r)},_onMouseClickMove:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,pointers:i};this._trigger("mouseClickMove",r)},_onMouseClickUp:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,pointers:i};this._trigger("mouseClickUp",r)},_setTheme:function(){var n=this.model.themeProperties[this.model.theme];this._setThemeColors(n)},_setThemeColors:function(n){var r=[],f=this.model.themeProperties,s,i,t,u,e,o;for(s in f)r.push(s);for(i=0;i<r.length;i++)for(this.model.backgroundColor=!this.model.backgroundColor||this.model.backgroundColor==f[r[i]].backgroundColor?n.backgroundColor:this.model.backgroundColor,t=0;t<this.model.scales.length;t++){for(this.model.scales[t].backgroundColor=!this.model.scales[t].backgroundColor||this.model.scales[t].backgroundColor==f[r[i]].scales.backgroundColor?n.scales.backgroundColor:this.model.scales[t].backgroundColor,this.model.scales[t].border.color=!this.model.scales[t].border.color||this.model.scales[t].border.color==f[r[i]].scales.border.color?n.scales.border.color:this.model.scales[t].border.color,u=0;u<this.model.scales[t].pointers.length;u++)this.model.scales[t].pointers[u].backgroundColor=!this.model.scales[t].pointers[u].backgroundColor||this.model.scales[t].pointers[u].backgroundColor==f[r[i]].scales.pointers.backgroundColor?n.scales.pointers.backgroundColor:this.model.scales[t].pointers[u].backgroundColor,this.model.scales[t].pointers[u].border.color=!this.model.scales[t].pointers[u].border.color||this.model.scales[t].pointers[u].border.color==f[r[i]].scales.pointers.border.color?n.scales.pointers.border.color:this.model.scales[t].pointers[u].border.color,this.model.scales[t].pointerCap.backgroundColor=!this.model.scales[t].pointerCap.backgroundColor||this.model.scales[t].pointerCap.backgroundColor==f[r[i]].scales.pointerCap.backgroundColor?n.scales.pointerCap.backgroundColor:this.model.scales[t].pointerCap.backgroundColor,this.model.scales[t].pointerCap.borderColor=!this.model.scales[t].pointerCap.borderColor||this.model.scales[t].pointerCap.borderColor==f[r[i]].scales.pointerCap.borderColor?n.scales.pointerCap.borderColor:this.model.scales[t].pointerCap.borderColor;for(e=0;e<this.model.scales[t].ticks.length;e++)this.model.scales[t].ticks[e].color=!this.model.scales[t].ticks[e].color||this.model.scales[t].ticks[e].color==f[r[i]].scales.ticks.color?n.scales.ticks.color:this.model.scales[t].ticks[e].color;for(o=0;o<this.model.scales[t].labels.length;o++)this.model.scales[t].labels[o].color=!this.model.scales[t].labels[o].color||this.model.scales[t].labels[o].color==f[r[i]].scales.labels.color?n.scales.labels.color:this.model.scales[t].labels[o].color}},_getFontString:function(n,t){return t?(t.fontStyle?t.fontStyle:"")+" "+(t.size==null?"11px":t.size)+" "+t.fontFamily:""},_drawTriangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawPointer:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(t.width/2,t.height/4);this._contextClosePath(t,i)},_drawWedge:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(3*t.width/4,0);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawSlider:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/4,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(t.width/4,t.height/2);this._contextClosePath(t,i)},_drawStar:function(n,t,i){this._contextOpenPath(t,i);i.model.Orientation=="Horizontal"&&i.markerPlacement=="near"?(i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY),i.contextEl.lineTo(n.startX,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width/6,n.startY),i.contextEl.lineTo(n.startX+t.width/2,n.startY+t.height)):(i.contextEl.lineTo(n.startX+t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height/3),i.contextEl.lineTo(n.startX,n.startY+t.height/3),i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width/2,n.startY));this._contextClosePath(t,i)},_drawPentagon:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/3,-t.height/2);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width/3,t.height/2);this._contextClosePath(t,i)},_drawDiamond:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(t.width,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(0,0);this._contextClosePath(t,i)},_drawCircle:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_drawLine:function(n,t,i){i.contextEl.beginPath();i.contextEl.strokeStyle=t.fillStyle;i.contextEl.globalAlpha=t.opacity;i.contextEl.lineWidth=t.lineWidth;i.contextEl.moveTo(n.startX,n.startY);i.contextEl.lineTo(n.startX+t.width,n.startY);i.contextEl.closePath();i.contextEl.stroke()},_drawTrapezoid:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/4);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/4);this._contextClosePath(t,i)},_drawRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/2);this._contextClosePath(t,i)},_drawRoundedRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(t.radius,-t.height/2);i.contextEl.lineTo(t.width-t.radius,-t.height/2);i.contextEl.quadraticCurveTo(t.width,-t.height/2,t.width,-t.height/2+t.radius);i.contextEl.lineTo(t.width,t.height/2-t.radius);i.contextEl.quadraticCurveTo(t.width,t.height/2,t.width-t.radius,t.height/2);i.contextEl.lineTo(t.radius,t.height/2);i.contextEl.quadraticCurveTo(0,t.height/2,0,t.height/2-t.radius);i.contextEl.lineTo(0,-t.height/2+t.radius);i.contextEl.quadraticCurveTo(0,-t.height/2,t.radius,-t.height/2);this._contextClosePath(t,i)},_drawCustomImage:function(t,i){var r=new Image;n(r).on("load",function(){t.contextEl.drawImage(this,0,0,t.model.Width,t.model.Height);t.model.scales!=null&&t._drawScales();t.model.items!=null&&t._renderItems()}).attr("src",i)},_drawEllipse:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.scale(2,1);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_setPointerDimension:function(n,i){if(!t.isNullOrUndefined(i.model.Orientation)&&i.model.Orientation=="Horizontal"){var r=n.width,u=n.height;n.height=r;n.width=u}return n},_setContextRotation:function(n,t){t.contextEl.rotate(Math.PI*(n.angle/180))},_contextOpenPath:function(n,t){t.contextEl.save();t.contextEl.beginPath();n.strokeStyle&&(t.contextEl.strokeStyle=n.strokeStyle);n.opacity!=i&&(t.contextEl.globalAlpha=n.opacity);n.lineWidth&&(t.contextEl.lineWidth=n.lineWidth);n.fillStyle&&(t.contextEl.fillStyle=n.fillStyle)},_contextClosePath:function(n,t){t.contextEl.closePath();n.isFill&&t.contextEl.fill();n.isStroke&&t.contextEl.stroke();t.contextEl.restore()},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_isBetween:function(n,t,i,r){return n<t?i>=n-r&&i<=t+r:i>=t-r&&i<=n+r},_getColor:function(n,t){return typeof t=="string"?t:"rgba("+t.r+", "+t.g+","+t.b+", "+t.a/255+")"},_setGradientColor:function(t,i,r){var u=t;r.Name||typeof r=="string"?(i.addColorStop(0,this._getColor(t,r)),i.addColorStop(1,this._getColor(t,r))):n.each(r,function(n,r){i.addColorStop(r.colorStop!=NaN?r.colorStop:0,typeof r.color=="string"?r.color:u._getColor(t,r.color))})}}),function(){for(var u=0,f=["ms","moz","webkit","o"],i,r,n=0;n<f.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[f[n]+"RequestAnimationFrame"];window.requestAnimationFrame||(t.datavisualization.CircularGauge.animationPolyfill=!0,window.requestAnimationFrame=function(n,t){return i=(new Date).getTime(),r=Math.max(0,16-(i-u)),t=window.setTimeout(function(){n(i+r)},r),u=i+r,t})}();t.datavisualization.CircularGauge.Frame={FullCircle:"fullcircle",HalfCircle:"halfcircle"};t.datavisualization.CircularGauge.Directions={Clockwise:"clockwise",CounterClockwise:"counterclockwise"};t.datavisualization.CircularGauge.PointerPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.PointerType={Needle:"needle",Marker:"marker"};t.datavisualization.CircularGauge.NeedleType={Triangle:"triangle",Rectangle:"rectangle",Trapezoid:"trapezoid",Arrow:"arrow",Image:"image"};t.datavisualization.CircularGauge.MarkerType={Rectangle:"rectangle",Triangle:"triangle",Ellipse:"ellipse",Diamond:"diamond",Pentagon:"pentagon",Circle:"circle",Slider:"slider",Pointer:"pointer",Wedge:"wedge",Trapezoid:"trapezoid",RoundedRectangle:"roundedrectangle",Image:"image"};t.datavisualization.CircularGauge.RangePlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.TickType={Major:"major",Minor:"minor"};t.datavisualization.CircularGauge.gaugePosition={TopLeft:"topleft",TopRight:"topright",TopCenter:"topcenter",MiddleLeft:"middleleft",MiddleRight:"middleright",Center:"center",BottomLeft:"bottomleft",BottomRight:"bottomright",BottomCenter:"bottomcenter"};t.datavisualization.CircularGauge.TickPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.CustomLabelPositionType={Inner:"inner",Outer:"outer"};t.datavisualization.CircularGauge.OuterCustomLabelPosition={Left:"left",Right:"right",Top:"top",Bottom:"bottom"};t.datavisualization.CircularGauge.LabelPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.LabelType={Major:"major",Minor:"minor"};t.datavisualization.CircularGauge.UnitTextPlacement={Back:"back",Front:"front"};t.datavisualization.CircularGauge.RangeZOrderPosition={Rear:"rear",Front:"front"};t.datavisualization.CircularGauge.IndicatorType={Rectangle:"rectangle",Circle:"circle",RoundedRectangle:"roundedrectangle",Text:"text",Image:"image"};t.datavisualization.CircularGauge.Themes={FlatLight:"flatlight",FlatDark:"flatdark"};t.datavisualization.CircularGauge.LegendPosition={Top:"top",Bottom:"bottom",Left:"left",Right:"right"};t.datavisualization.CircularGauge.LegendAlignment={Near:"near",Center:"center",Far:"far"};t.datavisualization.CircularGauge.LegendShape={Rectangle:"rectangle",Triangle:"triangle",Diamond:"diamond",Pentagon:"pentagon",Circle:"circle",Slider:"slider",Wedge:"wedge",Trapezoid:"trapezoid",Line:"line"}}(jQuery,Syncfusion),function(n,t,i){t.widget({ejLinearGauge:"ej.datavisualization.LinearGauge"},{element:null,_rootCSS:"e-lineargauge",_animationFlag:!0,model:null,_customLblMaxSize:0,_savedPoints:[],validTags:["div","span"],defaults:{locale:null,enableGroupSeparator:!1,value:0,minimum:0,maximum:100,width:150,height:400,theme:"flatlight",orientation:"Vertical",pointerGradient1:null,pointerGradient2:null,backgroundColor:null,borderColor:null,labelColor:null,tickColor:null,readOnly:!0,enableResize:!1,isResponsive:!1,tooltip:{showLabelTooltip:!1,showCustomLabelTooltip:!1,templateID:null},outerCustomLabelPosition:"bottom",frame:{backgroundImageUrl:null,outerWidth:12,innerWidth:8},scales:null,enableAnimation:!0,enableMarkerPointerAnimation:!0,animationSpeed:500,drawTicks:null,drawLabels:null,drawBarPointers:null,drawMarkerPointers:null,drawRange:null,drawCustomLabel:null,drawIndicators:null,load:null,init:null,renderComplete:null,mouseClick:null,mouseClickMove:null,mouseClickUp:null,themeProperties:{flatlight:{scales:{backgroundColor:"#FFFFFF",border:{color:"#1d1e1e"},barPointers:{backgroundColor:"#8abc3b",border:{color:"#8abc3b"}},markerPointers:{backgroundColor:"#212121",border:{color:"#212121"}},ticks:{color:"#1d1e1e"},labels:{labelColor:"#222222"}}},flatdark:{scales:{backgroundColor:"#808080",border:{color:"#808080"},barPointers:{backgroundColor:"#8abc3b",border:{color:"#8abc3b"}},markerPointers:{backgroundColor:"#CCCCCC",border:{color:"#CCCCCC"}},ticks:{color:"#808080"},labels:{labelColor:"#CCCCCC"}}}}},_defaultScaleValues:function(){return{minimum:null,maximum:null,majorIntervalValue:10,minorIntervalValue:2,direction:"counterclockwise",backgroundColor:null,border:{color:null,width:1.5},opacity:NaN,width:30,shadowOffset:0,length:290,type:"rectangle",position:{x:50,y:50},showRanges:!1,showIndicators:!1,showCustomLabels:!1,showLabels:!0,showTicks:!0,showBarPointers:!0,showMarkerPointers:!0,ticks:[{distanceFromScale:{x:0,y:0},angle:0,color:null,type:"majorinterval",placement:"near",opacity:0,height:10,width:3},{distanceFromScale:{x:0,y:0},angle:0,color:null,type:"minorinterval",placement:"near",opacity:0,height:5,width:2}],ranges:[{endWidth:10,placement:"center",startWidth:10,distanceFromScale:0,endValue:60,startValue:20,gradients:null,backgroundColor:null,border:{color:null,width:1.5},opacity:null}],labels:[{distanceFromScale:{x:-10,y:0},angle:0,font:{size:"11px",fontFamily:"Arial",fontStyle:"bold"},textColor:null,opacity:0,type:"major",placement:"near",includeFirstValue:!0,unitText:"",unitTextPlacement:"back"}],markerPointers:[{type:"triangle",length:30,placement:"far",gradients:null,distanceFromScale:0,width:30,value:null,backgroundColor:null,border:{color:null,width:1.5},opacity:1}],barPointers:[{gradients:null,distanceFromScale:0,width:30,value:null,backgroundColor:null,border:{color:null,width:1.5},opacity:1}],indicators:[{font:{size:"11px",fontFamily:"Arial",fontStyle:"bold"},height:30,type:"rectangle",width:30,position:{x:0,y:0},textLocation:{x:0,y:0},stateRanges:[{endValue:60,startValue:50,backgroundColor:null,borderColor:null,text:"",textColor:null}],backgroundColor:null,border:{color:null,width:1.5},opacity:NaN}],customLabels:[{font:{size:"11px",fontFamily:"Arial",fontStyle:"bold"},color:null,opacity:0,value:"",textAngle:0,position:{x:0,y:0},positionType:"inner"}]}},dataTypes:{scales:"data",isResponsive:"boolean"},observables:["value","minimum","maximum"],_tags:[{tag:"scales",attr:["majorIntervalValue","minorIntervalValue","backgroundColor","shadowOffset","showRanges","showIndicators","showCustomLabels","showLabels","showTicks","showBarPointers","showMarkerPointers","border.color","border.width","position.x","position.y",[{tag:"markerPointers",attr:["distanceFromScale","backgroundColor","border.width","border.color"]},{tag:"barPointers",attr:["distanceFromScale","backgroundColor","border.width","border.color"]},{tag:"ranges",attr:["distanceFromScale","startValue","endValue","startWidth","endWidth","backgroundColor","border.color","border.width"]},{tag:"ticks",attr:["distanceFromScale.x","distanceFromScale.y"]},{tag:"indicators",attr:["backgroundColor","textLocation","font.size","font.fontFamily","font.fontStyle","position.x","position.y","textLocation.x","textLocation.y","borderColor","textColor",[{tag:"stateRanges",attr:["endValue","startValue","backgroundColor","borderColor","textColor"]}]]},{tag:"labels",attr:["distanceFromScale.x","distanceFromScale.y","textColor","includeFirstValue","unitText","unitTextPlacement","font.size","font.fontFamily","font.fontStyle"]},{tag:"customLabels",attr:["textAngle","font.size","font.fontFamily","font.fontStyle","position.x","position.y"]}]]}],value:t.util.valueFunction("value"),minimum:t.util.valueFunction("minimum"),maximum:t.util.valueFunction("maximum"),_init:function(){_linearGaugeCount=n(".e-lineargauge").length;initialGaugeCount=_linearGaugeCount;this._initialize();this._trigger("load");this._setTheme();this._render();this.wireEvents();this._onWindowResize()},_onWindowResize:function(){(this.model.enableResize||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this.resizeCanvas):this._on(n(window),"resize",this.resizeCanvas))},_setModel:function(t){var i,r,f,u,e,o,s;for(i in t)switch(i){case"theme":this.model.theme=t[i];this._init();break;case"height":this.model.height=t[i];break;case"width":this.model.width=t[i];break;case"orientation":this.model.orientation=t[i];break;case"pointerGradient1":this.model.pointerGradient1=t[i];break;case"pointerGradient2":this.model.pointerGradient2=t[i];break;case"labelColor":this.model.labelColor=t[i];break;case"tick":n.extend(this.model.tick,t[i]);break;case"backgroundColor":this.model.backgroundColor=t[i];break;case"borderColor":this.model.borderColor=t[i];break;case"frame":n.extend(this.model.frame,t[i]);case"outerCustomLabelPosition":this.model.outerCustomLabelPosition=t[i];break;case"tooltip":n.extend(this.model.tooltip,t[i]);break;case"readOnly":this.model.readOnly=t[i];break;case"value":for(this.value()==""&&this.value(0),r=0;this.model.scales[r]!=null;r++)for(f=0;this.model.scales[r].markerPointers[f]!=null;f++)this.model.scales[r].markerPointers[f].value=parseFloat(this.value());for(u=0;this.model.scales[u]!=null;u++)for(e=0;this.model.scales[u].barPointers[e]!=null;e++)this.model.scales[u].barPointers[e].value=parseFloat(this.value());break;case"minimum":for(this.minimum()==""&&this.minimum(0),o=0;this.model.scales[o]!=null;o++)this.model.scales[o].minimum=parseInt(this.minimum());break;case"maximum":for(this.maximum()==""&&this.maximum(0),s=0;this.model.scales[s]!=null;s++)this.model.scales[s].maximum=parseInt(this.maximum());break;case"scales":this.model.scales=t[i];this._itemInitialize()}this._render();this.wireEvents()},_destroy:function(){this.activeElement=null;this.canvasEl=null;this.contextEl=null;this.unWireEvents();this.element.empty().removeClass("e-widget")},_initialize:function(){this.GaugeEl=this.element;this.scaleStartX=[];this.scaleStartY=[];this.isScaleModified=!1;this.target=this.element[0];this._itemInitialize();this.Model=this.model},_render:function(){this.initialize();this.wireEvents()},_itemInitialize:function(){var t=this;this.model.scales!=null?n.each(this.model.scales,function(i,r){r=t._checkArrayObject(r,i);var u=t._defaultScaleValues();n.extend(u,r);n.extend(r,u)}):this.model.scales=[this._defaultScaleValues()]},_checkArrayObject:function(t,i){var r=this,u;return n.each(t,function(n,t){if(u=typeof n,(u!="string"||u=="string"&&n.indexOf("_")==-1&&n.indexOf("__")==-1)&&typeof t!="function")if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"&&!t.setter&&!t.factory&&!t.key){var f=r._defaultScaleValues();r._LoadIndividualDefaultValues(t,f,typeof n=="number"?i:n)}}),t},_LoadIndividualDefaultValues:function(t,i,r){var u=null,e=this,f;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),f=typeof r,n.each(t,function(n,t){t instanceof Array?e._checkArrayObject(t,r):t!=null&&typeof t=="object"&&(f!="string"||f=="string"&&r.indexOf("_")==-1&&r.indexOf("__")==-1)&&e._LoadIndividualDefaultValues(t,u,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},initialize:function(){this._initObject(this);this.Model.frame.backgroundImageUrl?this._drawCustomImage(this,this.Model.frame.backgroundImageUrl):this.Model.scales!=null&&this._drawScales()},_initObject:function(i){var h,r,f,e,u,s,o;for(this._savedPoints=[],this.element.addClass("e-widget"),i.GaugeEl=i.element,i.canvasEl&&(i.canvasEl.parent().empty(),i.GaugeEl.empty()),i.canvasEl=n("<canvas><\/canvas>"),h=0,r=0;this.model.scales[r]!=null;r++){for(this.model.scales[r].minimum==null&&(this.model.scales[r].minimum=this.minimum()),this.model.scales[r].maximum==null&&(this.model.scales[r].maximum=this.maximum()),f=0;this.model.scales[r].markerPointers[f]!=null;f++)this.model.scales[r].markerPointers[f].value==null&&(this.model.scales[r].markerPointers[f].value=this.value());for(e=0;this.model.scales[r].barPointers[e]!=null;e++)this.model.scales[r].barPointers[e].value==null&&(this.model.scales[r].barPointers[e].value=this.value());for(u=0;this.model.scales[r].customLabels[u]!=null&&this.model.scales[r].showCustomLabels==!0;u++)if(h++,this.model.scales[r].customLabels[u].value!=null&&i.GaugeEl.find("div").length==0)if(this.model.scales[r].customLabels[u]!=null&&this.model.scales[r].customLabels[u].positionType!=null&&this.model.scales[r].customLabels[u].positionType=="outer")if(i.outerDiv=t.buildTag("div"),i.model.outerCustomLabelPosition=="bottom")i.GaugeEl.append(i.canvasEl),i.GaugeEl.append(i.outerDiv),i.outerDiv.css("text-align","center"),i.GaugeEl.css({width:i.model.width});else if(i.model.outerCustomLabelPosition!="top"){s=t.buildTag("TABLE");s.css("width","100%");var c=t.buildTag("TR"),l=t.buildTag("TD"),a=t.buildTag("td");i.model.outerCustomLabelPosition=="left"?(l.append(i.outerDiv),a.append(i.canvasEl)):(l.append(i.canvasEl),a.append(i.outerDiv));c.append(l);c.append(a);s.append(c);i.GaugeEl.append(s);i.outerDiv.css({width:this.element.width()-i.model.width})}else i.GaugeEl.append(i.outerDiv),i.GaugeEl.append(i.canvasEl),i.GaugeEl.css({width:i.model.width}),i.outerDiv.css("text-align","center");else i.GaugeEl.append(i.canvasEl);h==0&&i.GaugeEl.append(i.canvasEl)}(i.canvasEl.attr("role","presentation"),_linearGaugeCount==initialGaugeCount&&(initialLinearDivWidth=window.innerWidth),i.canvasEl[0].setAttribute("width",i.model.width),i.canvasEl[0].setAttribute("height",i.model.height),i.centerX=i.canvasEl[0].width/2,i.centerY=i.canvasEl[0].height/2,o=i.canvasEl[0],typeof G_vmlCanvasManager!="undefined"&&(o=window.G_vmlCanvasManager.initElement(o)),o&&o.getContext)&&(i.contextEl=i.canvasEl[0].getContext("2d"))},_drawFrameCircle:function(n,t,i){this._contextOpenPath(t,i);i.contextEl.arc(n.startX,n.startY,t.circleRadius,0,2*Math.PI,!0);this._contextClosePath(t,i);t.indicatorText&&i._drawText(n,t)},_drawFrameRectangle:function(n,t,i){this._contextOpenPath(t,i);i.contextEl.lineTo(n.startX+t.radius,n.startY);i.contextEl.lineTo(n.startX+t.width-t.radius,n.startY);i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.radius);i.contextEl.lineTo(n.startX+t.radius,n.startY+t.height);this._contextClosePath(t,i);t.indicatorText&&i._drawText(n,t)},_drawFrameThermometer:function(n,t,i){var r=i.Model.orientation=="Vertical"?Math.sqrt(t.width*t.width+t.width*t.width)/2:Math.sqrt(t.height*t.height+t.height*t.height)/2;this._contextOpenPath(t,i);i.Model.orientation=="Vertical"?i.scaleEl[i.scaleIndex].direction=="counterclockwise"?(i.contextEl.arc(n.startX+Math.cos(Math.PI*(45/180))*r,n.startY+t.height-Math.sin(Math.PI*(45/180))*r,r,Math.PI*(-45/180),Math.PI*(225/180),!1),i.contextEl.lineTo(n.startX,n.startY+t.calDistance+t.width/2),t.topRounded?i.contextEl.arc(n.startX+t.width/2,n.startY+t.width/2,t.width/2,-Math.PI,0,!1):i.contextEl.lineTo(n.startX+t.width,n.startY+t.calDistance+t.width/2)):(i.contextEl.arc(n.startX+Math.cos(Math.PI*(45/180))*r,n.startY+Math.sin(Math.PI*(45/180))*r,r,Math.PI*(45/180),Math.PI*(-225/180),!0),i.contextEl.lineTo(n.startX,n.startY+t.height-t.width/2),t.topRounded?i.contextEl.arc(n.startX+t.width/2,n.startY+t.height-t.width/2,t.width/2,-Math.PI,0,!0):i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.width/2)):i.scaleEl[i.scaleIndex].direction=="counterclockwise"?(i.contextEl.arc(n.startX+t.width-r/4-Math.cos(Math.PI*(45/180))*r,n.startY+Math.sin(Math.PI*(45/180))*r,r,Math.PI*(135/180),Math.PI*(225/180),!0),i.contextEl.lineTo(n.startX+t.height/2,n.startY),t.topRounded?i.contextEl.arc(n.startX+t.height/2,n.startY+t.height/2,t.height/2,Math.PI*(270/180),Math.PI*(90/180),!0):i.contextEl.lineTo(n.startX+t.height/2,n.startY+t.height)):(i.contextEl.arc(n.startX+r/4+Math.cos(Math.PI*(45/180))*r,n.startY+Math.sin(Math.PI*(45/180))*r,r,Math.PI*(45/180),Math.PI*(315/180),!1),i.contextEl.lineTo(n.startX+t.width-t.height/2,n.startY),t.topRounded?i.contextEl.arc(n.startX+t.width-t.height/2,n.startY+t.height/2,t.height/2,Math.PI*(270/180),Math.PI*(90/180),!1):i.contextEl.lineTo(n.startX+t.width-t.height/2,n.startY+t.height));this._contextClosePath(t,i)},_drawFrameRoundedRectangle:function(n,t,i){this._contextOpenPath(t,i);i.contextEl.lineTo(n.startX+t.radius,n.startY);i.contextEl.lineTo(n.startX+t.width-t.radius,n.startY);i.contextEl.quadraticCurveTo(n.startX+t.width,n.startY,n.startX+t.width,n.startY+t.radius);i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.radius);i.contextEl.quadraticCurveTo(n.startX+t.width,n.startY+t.height,n.startX+t.width-t.radius,n.startY+t.height);i.contextEl.lineTo(n.startX+t.radius,n.startY+t.height);i.contextEl.quadraticCurveTo(n.startX,n.startY+t.height,n.startX,n.startY+t.height-t.radius);i.contextEl.lineTo(n.startX,n.startY+t.radius);i.contextEl.quadraticCurveTo(n.startX,n.startY,n.startX+t.radius,n.startY);this._contextClosePath(t,i);t.indicatorText&&this._drawText(n,t)},_contextOpenPath:function(n,t){t.contextEl.save();t.contextEl.beginPath();n.strokeStyle&&(t.contextEl.strokeStyle=n.strokeStyle);n.opacity!=i&&(t.contextEl.globalAlpha=n.opacity);n.lineWidth&&(t.contextEl.lineWidth=n.lineWidth);n.fillStyle&&(t.contextEl.fillStyle=n.fillStyle)},_contextClosePath:function(n,t){t.contextEl.closePath();n.isFill&&t.contextEl.fill();n.isStroke&&t.contextEl.stroke();t.contextEl.restore()},_drawScales:function(){var t=this,i;this.scaleEl=this.Model.scales;this.contextEl.save();this.contextEl.translate(this.Model.frame.outerWidth+this.Model.frame.innerWidth,this.Model.frame.outerWidth+this.Model.frame.innerWidth);n.each(this.Model.scales,function(n,i){t.scaleIndex=n;t._setScaleCordinates(i,i.type)});this._setTicks();this._setLabels();this._setRange();this._setCustomLabel();this._flagPointer=!1;this._tempOpacity=this.model.scales[0].barPointers[0].opacity;this._setBarPointers();this._setMarkerPointers();this._setIndicators();n.each(this.Model.scales,function(n,i){i.showBarPointers&&i.barPointers.length>1&&(t.model.enableAnimation=!1);i.showMarkerPointers&&i.markerPointers.length>1&&(t.model.enableAnimation=!1)});this.contextEl.putImageData||(this.model.enableAnimation=!1);this.model.animationSpeed!=null&&this.model.animationSpeed>0&&(i=this.model.animationSpeed/25,i>=0&&this.model.enableAnimation&&this._animationFlag&&this._onAnimate(i))},_setTicks:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showTicks&&(t.scaleIndex=i,r.ticks!=null&&(t.tickEl=r.ticks,n.each(r.ticks,function(n,i){t.tickIndex=n;t._setTicksCordinates(i,n)})))})},_setLabels:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showLabels&&(t.scaleIndex=i,r.labels!=null&&(t.labelEl=r.labels,n.each(r.labels,function(n,i){t.labelIndex=n;t._setLabelCordinates(i,n)})))})},_setIndicators:function(){var t=this;n.each(this.Model.scales,function(i,r){t.scaleIndex=i;r.indicators!=null&&r.showIndicators&&(t.indicatorEl=r.indicators,n.each(r.indicators,function(n,i){t.indicatorIndex=n;t._drawIndicator(n,i)}))})},_setBarPointers:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showBarPointers&&(t.scaleIndex=i,r.barPointers!=null&&(t.barPointerEl=r.barPointers,n.each(r.barPointers,function(n,i){t.barPointerIndex=n;r.opacity=t.scaleIndex==0&&t.barPointerIndex==0&&t.model.enableAnimation==!0&&t._flagPointer==!1&&t._animationFlag==!0&&t.model.scales[0].type=="thermometer"?0:t._tempOpacity;t._drawScaleBarPointer(i,n);t._flagPointer=!0})))})},_setMarkerPointers:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showMarkerPointers&&(t.scaleIndex=i,r.markerPointers!=null&&(t.markerPointerEl=r.markerPointers,n.each(r.markerPointers,function(n,i){t.markerPointerIndex=n;t._drawMarkerPointer(i,n);t.canvasEl.attr("aria-label",t.model.scales[t.scaleIndex].markerPointers[t.markerPointerIndex].value)})))})},_onAnimate:function(n){var t=this,f,e,i=t.model.scales[0].minimum,r=t.model.scales[0].barPointers[0].value,u=t.model.scales[0].markerPointers[0].value;f=setInterval(function(){r>i||i==t.model.scales[0].minimum?(i=i+(t.model.scales[0].maximum-t.model.scales[0].minimum)/100,t.scaleEl[0].type=="thermometer"?(t.model.scales[0].barPointers[0].value=r>i?i:r,t.contextEl.putImageData!="undefined"?t._setBarPointers():r>i?t.setBarPointerValue(0,0,i):t.setBarPointerValue(0,0,r)):r>i?t.setBarPointerValue(0,0,i):t.setBarPointerValue(0,0,r)):(t._animationFlag=!1,t.setBarPointerValue(0,0,r),window.clearInterval(f))},n);e=setInterval(function(){t.model.enableMarkerPointerAnimation&&(u>i||i==t.model.scales[0].minimum?(i=i+(t.model.scales[0].maximum-t.model.scales[0].minimum)/100,t.scaleEl[0].type=="thermometer"?(t.model.scales[0].markerPointers[0].value=u>i?i:u,t.contextEl.putImageData!="undefined"?t._setMarkerPointers():u>i?t.setPointerValue(0,0,i):t.setPointerValue(0,0,u)):u>i?t.setPointerValue(0,0,i):t.setPointerValue(0,0,u)):(t._animationFlag=!1,t.setPointerValue(0,0,u),window.clearInterval(e)))},n)},_setRange:function(){var t=this;n.each(this.Model.scales,function(i,r){t.scaleIndex=i;r.ranges!=null&&r.showRanges&&(t.rangeEl=r.ranges,n.each(r.ranges,function(n,i){t.rangeIndex=n;t._drawRange(i)}))})},_setCustomLabel:function(){var t=this;n.each(this.Model.scales,function(i,r){t.scaleIndex=i;r.customLabels!=null&&r.showCustomLabels&&(t.customLabelEl=r.customLabels,n.each(r.customLabels,function(n,i){t.customLabelIndex=n;t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex]!=null&&t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType!=null&&t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType=="outer"?t._setOuterCustomLabelCordinates(n,i):t._setCustomLabelCordinates(n,i)}))})},_setOuterCustomLabelCordinates:function(n,i){var r,u;this._customLblMaxSize=this._customLblMaxSize<parseFloat(i.font.size.match(/\d+/)[0])?parseFloat(i.font.size.match(/\d+/)[0]):this._customLblMaxSize;r=t.buildTag("div."+this._id+"outercustomlbl");r.text(this.model.scales[this.scaleIndex].customLabels[n].value);u=this.model.outerCustomLabelPosition=="right"||this.model.outerCustomLabelPosition=="left"?"left":"center";this.outerDiv.append(r);this.outerDiv.append("<\/br>");u=="center"?r.css({display:"inline-block",margin:"0 auto","max-width":this.model.width}):r.css({display:"inline-block","max-width":this.element.width()-this.model.width>10?this.element.width()-this.model.width:10});r.css({color:i.color,overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":i.font!=null&&i.font.size!=null?i.font.size:"12px","font-family":i.font!=null&&i.font.fontFamily!=null?i.font.fontFamily:"Arial","font-weight":i.font!=null&&i.font.fontStyle!=null?i.font.fontStyle:"Normal","text-align":u})},_setScaleCordinates:function(n,t){var r,i,u,f;this.opacity=1;this.bottomRadius=Math.sqrt(n.width*n.width+n.width*n.width)/2;this.bounds={height:this.canvasEl[0].height-2*(this.Model.frame.outerWidth+this.Model.frame.innerWidth),width:this.canvasEl[0].width-2*(this.Model.frame.outerWidth+this.Model.frame.innerWidth)};this.Model.orientation=="Vertical"?(this.scaleStartX[this.scaleIndex]=(this.bounds.width-n.width)*(n.position.x/100),this.scaleStartY[this.scaleIndex]=(this.bounds.height-n.length)*(n.position.y/100)):(this.scaleStartX[this.scaleIndex]=(this.bounds.width-n.length)*(n.position.x/100),this.scaleStartY[this.scaleIndex]=(this.bounds.height-n.width)*(n.position.y/100));u=t=="roundedrectangle"?5:0;r={startX:this.scaleStartX[this.scaleIndex],startY:this.scaleStartY[this.scaleIndex]};i={width:this.Model.orientation=="Vertical"?n.width:n.length,isStroke:!0,topRounded:!0,fillStyle:n.backgroundColor?n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):this.Model.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.backgroundColor),lineWidth:n.border.width,radius:u,height:this.Model.orientation=="Vertical"?n.length:n.width,isFill:!0,strokeStyle:n.border.color?n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color):this.Model.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.borderColor)};n.maximum<n.minimum&&(f=n.maximum,n.maximum=n.minimum,n.minimum=f);n.maximum==n.minimum&&(n.maximum=n.maximum+1);this.minimum(n.minimum);this.maximum(n.maximum);this._notifyArrayChange&&(this._notifyArrayChange("scales["+this.scaleIndex+"]maximum",n.maximum),this._notifyArrayChange("scales["+this.scaleIndex+"]minimum",n.minimum));n.shadowOffset&&(this.contextEl.shadowBlur=n.shadowOffset,this.contextEl.shadowColor=i.fillStyle=="transparent"?"rgba(0,0,0,0)":i.fillStyle);this._drawFrame(t,r,i);this.scaleEl[this.scaleIndex].type!="thermometer"||this.isScaleModified||(this._modifyWidth(),this.isScaleModified=!0);this.contextEl.getImageData&&(this.scaleImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_setTicksCordinates:function(n){var i,u,f,r,t;if(this.scaleEl[this.scaleIndex].majorIntervalValue>this.scaleEl[this.scaleIndex].minorIntervalValue){for(r=n.type=="majorinterval"?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,n.placement=="near"?i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]:this.scaleStartY[this.scaleIndex]:n.placement=="far"?i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width:n.placement=="center"&&(i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2),u=n.placement=="near"?-n.height:n.height,t=this.scaleEl[this.scaleIndex].maximum;t>=this.scaleEl[this.scaleIndex].minimum;t-=r)(r==this.scaleEl[this.scaleIndex].minorIntervalValue&&t%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||r==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(f=this._getClockwiseLinePosition(t),this.region={lineChangePosition:f+(this.Model.orientation=="horizontal"?n.distanceFromScale.x:n.distanceFromScale.y),lineStaticPosition:i+(this.Model.orientation=="horizontal"?n.distanceFromScale.y:n.distanceFromScale.x)},this.style={lineHeight:u,angle:this.Model.orientation=="Vertical"?n.angle:n.angle+270,tickShape:n.TickShape,strokeStyle:n.color?n.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.color):this.Model.tickColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.tickColor),lineWidth:n.width},this.Model.drawTicks&&this._onDrawTicks(this.Model.orientation=="Vertical"?n.angle:n.angle+270,t),this._drawTickMark(this.region,this.style));this.contextEl.getImageData&&(this.tickImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))}},_drawTickMark:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.lineWidth=t.lineWidth;this.contextEl.strokeStyle=t.strokeStyle;this.Model.orientation=="Vertical"?this.contextEl.translate(n.lineStaticPosition,n.lineChangePosition):this.contextEl.translate(n.lineChangePosition,n.lineStaticPosition);this.contextEl.lineTo(0,0);this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.contextEl.rotate(Math.PI*(t.angle/180)):this.contextEl.rotate(-(Math.PI*(t.angle/180)));this.contextEl.lineTo(t.lineHeight,0);this.contextEl.stroke();this.contextEl.restore();this.contextEl.closePath()},_addDecimal:function(n,t){var r=n.toString(),u=t.toString(),f,e,i,o;return f=r.indexOf(".")>-1?r.length-r.indexOf(".")-1:0,e=u.indexOf(".")>-1?u.length-u.indexOf(".")-1:0,i=f>e?f:e,o=(n*Math.pow(10,i)+t*Math.pow(10,i))/Math.pow(10,i),o},_setLabelCordinates:function(n){var u,f,i,e,r,o=this.model.locale,t;if(this.scaleEl[this.scaleIndex].majorIntervalValue>this.scaleEl[this.scaleIndex].minorIntervalValue)for(this.Model.orientation=="Vertical"?(u=n.distanceFromScale.x,f=n.distanceFromScale.y):(u=n.distanceFromScale.y,f=n.distanceFromScale.x),r=n.type=="major"?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,n.placement=="near"?(i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2:this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width-5,this.contextEl.textAlign=this.Model.orientation=="Vertical"?"right":"center"):n.placement=="far"?(i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width+5,this.contextEl.textAlign=this.Model.orientation=="Vertical"?"left":"center"):(this.contextEl.textAlign="center",i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+this.scaleEl[this.scaleIndex].border.width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+this.scaleEl[this.scaleIndex].border.width/2),t=this.scaleEl[this.scaleIndex].minimum;t<=this.scaleEl[this.scaleIndex].maximum;t=this._addDecimal(t,r))(r==this.scaleEl[this.scaleIndex].minorIntervalValue&&t%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||r==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(e=this.scaleEl[this.scaleIndex].direction=="counterclockwise"?this._getCounterClockwiseLinePosition(t):this._getClockwiseLinePosition(t),this.labelValue=t,this.region={lineChangePosition:e+f,lineStaticPosition:i+u},this.style={angle:this.Model.orientation=="Vertical"?n.angle:n.angle+270,fillStyle:n.textColor?n.textColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.textColor):this.Model.labelColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.labelColor),opacity:isNaN(n.opacity)?1:n.opacity,font:this._getFontString(this,n.font),textValue:this.labelValue},this.style.textValue=this.labelValue=o&&this.model.enableGroupSeparator?this.labelValue.toLocaleString(o):this.labelValue,this.Model.drawLabels&&this._onDrawLabels(this.Model.orientation=="Vertical"?n.angle:n.angle+270),this._drawLabel(this.region,this.style,!1));this.contextEl.getImageData&&(this.labelImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawLabel:function(n,i,r){if(this.contextEl.beginPath(),this.contextEl.save(),this.contextEl.textBaseline="middle",this.contextEl.fillStyle=i.fillStyle,this.contextEl.font=i.font,i.opacity&&(this.contextEl.globalAlpha=i.opacity),this.Model.orientation=="Vertical"?(this.contextEl.translate(n.lineStaticPosition,n.lineChangePosition),this.model.tooltip.showLabelTooltip&&!r&&this._savedPoints.push({startX:n.lineStaticPosition+5,startY:n.lineChangePosition+10,width:15,height:15,value:i.textValue}),this.model.tooltip.showCustomLabelTooltip&&r&&this._savedPoints.push({startX:n.lineStaticPosition-35,startY:n.lineChangePosition+10,width:110,height:15,value:i.textValue})):(this.contextEl.translate(n.lineChangePosition,n.lineStaticPosition),this.model.tooltip.showLabelTooltip&&!r&&this._savedPoints.push({startX:n.lineChangePosition+10,startY:n.lineStaticPosition+10,width:15,height:15,value:i.textValue}),this.model.tooltip.showCustomLabelTooltip&&r&&this._savedPoints.push({startX:n.lineChangePosition-35,startY:n.lineStaticPosition+10,width:110,height:15,value:i.textValue})),this.contextEl.lineTo(0,0),this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.contextEl.rotate(Math.PI*(i.angle/180)):this.contextEl.rotate(-(Math.PI*(i.angle/180))),!t.isNullOrUndefined(r)&&!r){var u=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitTextPlacement;t.isNullOrUndefined(u)||u.toString()!="back"?t.isNullOrUndefined(u)||u.toString()!="front"||(i.textValue=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText+i.textValue):i.textValue=i.textValue+this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText}this.contextEl.fillText(i.textValue,0,0);this.contextEl.fill();this.contextEl.restore()},_drawScaleBarPointer:function(n,t){n.value=n.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:n.value;n.value=n.value<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:n.value;var u,r,s,f,e,o,c,i,h;h=[{ColorStop:0,Color:this.Model.pointerGradient1=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:this.Model.pointerGradient2=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient2}];s=this.scaleEl[this.scaleIndex].type=="roundedrectangle"?5:0;this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?(r=this._getClockwiseLinePosition(n.value),this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isScaleModified&&(this._restoreWidth(),this.isModify=!0),this.Model.orientation=="Vertical"?(i=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex],i+n.width,this.scaleStartY[this.scaleIndex])):(i=this.scaleStartX[this.scaleIndex],u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2,i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+n.width/2))):(r=this._getCounterClockwiseLinePosition(n.value),this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isScaleModified&&(this._restoreWidth(),this.isModify=!0),this.Model.orientation=="Vertical"?(i=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r,i+n.width,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r)):(i=this.scaleEl[this.scaleIndex].type=="thermometer"?r-this.scaleEl[this.scaleIndex].width/2-this.scaleEl[this.scaleIndex].border.width/2:r-this.scaleEl[this.scaleIndex].border.width/2,u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2,i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+n.width/2)));n.backgroundColor?c=n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):n.gradients?this._setGradientColor(this,u,n.gradients.colorInfo):this.Model.ScaleInterior?this._setGradientColor(this,u,this.Model.ScaleInterior.colorInfo):this._setGradientColor(this,u,h);this.Model.orientation=="Vertical"?(o=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].border.width/2:r,this.scaleEl[this.scaleIndex].direction=="counterclockwise"&&this.scaleEl[this.scaleIndex].type=="thermometer"&&(o=o-this.scaleEl[this.scaleIndex].width/2),f=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?r-this.scaleStartY[this.scaleIndex]:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r-this.scaleEl[this.scaleIndex].border.width/2,e=n.width):(o=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,f=n.width,e=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?r-this.scaleStartX:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r);this.region={startX:i+this.scaleEl[this.scaleIndex].border.width/2,startY:o};this.style={width:this.scaleEl[this.scaleIndex].type=="thermometer"&&this.Model.orientation=="horizontal"?e+f/2-this.scaleEl[this.scaleIndex].border.width/2:e,lineWidth:n.border.width,radius:s,topRounded:!1,isStroke:!1,isFill:!0,height:this.scaleEl[this.scaleIndex].type=="thermometer"&&this.Model.orientation=="Vertical"?f+e/2:f,strokeStyle:n.border.color==null?this.Model.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.borderColor):n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color),fillStyle:n.backgroundColor?n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):u=="transparent"?"rgba(0,0,0,0)":this._getColor(n,u),opacity:isNaN(n.opacity)?.4:n.opacity,calDistance:this.scaleEl[this.scaleIndex].type=="thermometer"&&this.Model.orientation=="Vertical"?(this.scaleEl[this.scaleIndex].width-this.barPointerEl[this.barPointerIndex].width)/2:0};this.value(n.value);this._notifyArrayChange&&this._notifyArrayChange("scales["+this.scaleIndex+"]barpointers["+t+"]value",n.value);this.Model.drawBarPointers&&this._onDrawBarPointers(n.value);this._drawFrame(this.scaleEl[this.scaleIndex].type,this.region,this.style);this.contextEl.getImageData&&(this.barPointerImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawMarkerPointer:function(n,t){n.value=n.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:n.value;n.value=n.value<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:n.value;var i,f,o,e,r,u,s,h=[{ColorStop:0,Color:this.Model.pointerGradient1=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:this.Model.pointerGradient2=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient2}];this.markerPlacement=n.placement;o=Math.sqrt(n.width*n.width+n.length*n.length)/2;this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isModify&&this._modifyWidth();this.Model.orientation=="Vertical"?(this.markerPlacement=="far"&&(i=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,r=0),this.markerPlacement=="near"&&(i=n.type=="star"?this.scaleStartX[this.scaleIndex]+n.distanceFromScale-n.width:this.scaleStartX[this.scaleIndex]+n.distanceFromScale,r=180),this.markerPlacement=="center"&&(i=n.type=="circle"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale+n.border.width:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,r=0)):(this.markerPlacement=="far"&&(i=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,r=90),this.markerPlacement=="near"&&(i=n.type=="star"?this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale-n.length:this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,r=270),this.markerPlacement=="center"&&(i=n.type=="circle"?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.length/2+n.distanceFromScale+n.border.width:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.length/2+n.distanceFromScale,r=90));e=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this._getClockwiseLinePosition(n.value):this._getCounterClockwiseLinePosition(n.value);n.type=="star"?this.Model.orientation=="Vertical"?(u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex],i+n.width,this.scaleStartY[this.scaleIndex]),f=e-n.length/3):(u=this.contextEl.createLinearGradient(e,i,e,i+n.length),f=e-n.width/2):(u=this.contextEl.createLinearGradient(0,0,n.width,0),f=e);n.type=="roundedrectangle"&&(this.Model.orientation=="Vertical"&&this.markerPlacement=="near"?f+=n.length:this.Model.orientation=="horizontal"&&(this.markerPlacement=="near"&&(f-=n.width),i+=n.width/2));n.backgroundColor?s=n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):n.gradients?this._setGradientColor(this,u,n.gradients.colorInfo):this.Model.PointerInterior?this._setGradientColor(this,u,this.Model.PointerInterior.colorInfo):this._setGradientColor(this,u,h);this.region={startX:this.Model.orientation=="Vertical"?i:f,startY:this.Model.orientation=="Vertical"?f:i};this.style={width:n.width,radius:n.type=="rectangle"?0:o,height:n.length,lineWidth:n.border.width,isFill:!0,isStroke:!0,angle:r,strokeStyle:n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color),markerPlacement:this.markerPlacement,opacity:isNaN(n.opacity)?.4:n.opacity,fillStyle:n.backgroundColor?n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):u=="transparent"?"rgba(0,0,0,0)":this._getColor(n,u)};this.value(n.value);this._notifyArrayChange&&this._notifyArrayChange("scales["+this.scaleIndex+"]markerpointers["+t+"]value",n.value);this.Model.drawMarkerPointers&&this._onDrawMarkerPointers(r,n.value);n.type=="roundedrectangle"&&(this.style.radius=5);this._drawMarkerType(n.type,this.region,this.style);this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isModify&&(this._restoreWidth(),this.isScaleModified=!1);this.contextEl.getImageData&&(this.markerPointerImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawMarkerType:function(n,t,i){switch(n){case"rectangle":this._drawRectangle(t,i,this);break;case"triangle":this._drawTriangle(t,i,this);break;case"ellipse":this._drawEllipse(t,i,this);break;case"diamond":this._drawDiamond(t,i,this);break;case"pentagon":this._drawPentagon(t,i,this);break;case"circle":this._drawCircle(t,i,this);break;case"slider":this._drawSlider(t,i,this);break;case"star":this._drawStar(t,i,this);break;case"pointer":this._drawPointer(t,i,this);break;case"wedge":this._drawWedge(t,i,this);break;case"trapezoid":this._drawTrapezoid(t,i,this);break;case"roundedrectangle":this._drawRoundedRectangle(t,i,this)}},_drawRange:function(n){var e,o,u,t,f,r,i,s,h;n.startValue<this.scaleEl[this.scaleIndex].maximum&&n.endValue>this.scaleEl[this.scaleIndex].minimum&&this.scaleEl[this.scaleIndex].minimum<this.scaleEl[this.scaleIndex].maximum&&n.endValue<=this.scaleEl[this.scaleIndex].maximum&&(e=n.startValue<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:n.startValue,o=n.endValue>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:n.endValue,this.rangePosition=n.placement,h=[{ColorStop:0,Color:this.Model.pointerGradient1=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:this.Model.pointerGradient2=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient2}],u=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this._getClockwiseLinePosition(e):this._getCounterClockwiseLinePosition(e),t=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this._getClockwiseLinePosition(o):this._getCounterClockwiseLinePosition(o),this.Model.orientation=="Vertical"?(n.placement=="far"&&(f=this.scaleStartX[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width),n.placement=="near"&&(f=this.scaleStartX[this.scaleIndex]+n.distanceFromScale),n.placement=="center"&&(f=n.startWidth>n.endWidth?this.scaleStartX[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.startWidth/2:this.scaleStartX[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.endWidth/2),i=this.contextEl.createLinearGradient(t,t,t,u),this.region={startX:f,startY:u,endY:t}):(n.placement=="far"&&(r=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+n.distanceFromScale+this.scaleEl[this.scaleIndex].border.width),n.placement=="near"&&(r=this.scaleStartY[this.scaleIndex]+n.distanceFromScale),n.placement=="center"&&(r=n.startWidth>n.endWidth?this.scaleStartY[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.startWidth/2:this.scaleStartY[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.endWidth/2),i=this.contextEl.createLinearGradient(t,r,u,r),this.region={startX:u,startY:r,endX:t}),n.backgroundColor?s=n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):n.gradients?this._setGradientColor(this,i,n.gradients.colorInfo):this.Model.RangeInterior?this._setGradientColor(this,i,this.Model.RangeInterior.colorInfo):this._setGradientColor(this,i,h),this.style={startWidth:n.startWidth,lineWidth:n.border.width,isStroke:!0,isFill:!0,opacity:isNaN(n.opacity)?.4:n.opacity,endWidth:n.endWidth,fillStyle:n.backgroundColor?s=="transparent"?"rgba(0,0,0,0)":this._getColor(n,s):i=="transparent"?"rgba(0,0,0,0)":this._getColor(n,i),strokeStyle:n.border.color?n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color):this.Model.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.borderColor)},this.Model.drawRange&&this._onDrawRange(),this._drawRangeBar(this.region,this.style),this.contextEl.getImageData&&(this.rangeImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height)))},_drawRangeBar:function(n,t){this._contextOpenPath(t,this);this.Model.orientation=="Vertical"?(this.contextEl.lineTo(n.startX,n.startY),this.contextEl.lineTo(n.startX,n.endY),this.rangePosition=="near"?(this.contextEl.lineTo(n.startX-t.endWidth,n.endY),this.contextEl.lineTo(n.startX-t.startWidth,n.startY)):(this.contextEl.lineTo(n.startX+t.endWidth,n.endY),this.contextEl.lineTo(n.startX+t.startWidth,n.startY))):(this.contextEl.lineTo(n.startX,n.startY),this.contextEl.lineTo(n.endX,n.startY),this.rangePosition=="near"?(this.contextEl.lineTo(n.endX,n.startY-t.endWidth),this.contextEl.lineTo(n.startX,n.startY-t.startWidth)):(this.contextEl.lineTo(n.endX,n.startY+t.endWidth),this.contextEl.lineTo(n.startX,n.startY+t.startWidth)));this._contextClosePath(t,this)},_setCustomLabelCordinates:function(n,t){this._customLblMaxSize=this._customLblMaxSize<parseFloat(t.font.size.match(/\d+/)[0])?parseFloat(t.font.size.match(/\d+/)[0]):this._customLblMaxSize;var i,r;this.contextEl.textAlign="center";this.Model.orientation=="Vertical"?(i=this.bounds.width*(t.position.x/100),r=this.bounds.height*(t.position.y/100)):(i=this.bounds.width*(t.position.x/100),r=this.bounds.height*(t.position.y/100));this.region={lineStaticPosition:this.Model.orientation=="Vertical"?i:r,lineChangePosition:this.Model.orientation=="Vertical"?r:i};this.style={angle:t.textAngle,textValue:t.value,fillStyle:t.color?t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color):this.Model.labelColor=="transparent"?"rgba(0,0,0,0)":this._getColor(t,this.Model.labelColor),font:this._getFontString(this,t.font)};this.Model.drawCustomLabel&&this._onDrawCustomLabel();this._drawLabel(this.region,this.style,!0);this.contextEl.getImageData&&(this.customLabelImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawIndicator:function(i,r){var u=this,f,e,o,s=!1;f=(this.bounds.width-2*r.width)*(r.position.x/100);e=(this.bounds.height-2*r.height)*(r.position.y/100);o={x:this.bounds.width*(r.textLocation.x/100),y:this.bounds.height*(r.textLocation.y/100)};u.region={startX:r.type=="circle"?f+r.width:f,textLocation:o,startY:r.type=="circle"?e+r.height:e,startAngle:0,endAngle:2*Math.PI};u.style={radius:r.type=="roundedrectangle"?2:0,strokeStyle:r.border.color?r.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(r,r.border.color):this._getColor(r,"#FFFFFF"),angle:0,circleRadius:(r.height+r.width)/2,height:r.height,width:r.width,lineWidth:r.border.width,fillStyle:r.backgroundColor?r.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(r,r.backgroundColor):this._getColor(r,"#FFFFFF"),isStroke:!0,isFill:!0,indicatorText:null,textColor:null,font:null,counterClockwise:!1};this.Model.drawIndicators&&this._onDrawIndicators(u.style,u.region);r.stateRanges!=null&&n.each(r.stateRanges,function(n,i){u.markerPointerEl[u.markerPointerIndex].value>=i.startValue&&u.markerPointerEl[u.markerPointerIndex].value<=i.endValue&&(s=!0,!t.isNullOrUndefined(i.text)&&i.text.length>0&&(u.style.indicatorText=i.text,u.style.textColor=i.textColor=="transparent"?"rgba(0,0,0,0)":u._getColor(r,i.textColor),u.style.font=u._getFontString(u,r.font)),r.type!="text"?(u.style.strokeStyle=i.borderColor=="transparent"?"rgba(0,0,0,0)":u._getColor(r,i.borderColor),u.style.fillStyle=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":u._getColor(r,i.backgroundColor),u._drawFrame(r.type,u.region,u.style,u)):r.type=="text"&&u._drawText(u.region,u.style))});s||r.type=="text"||this._drawFrame(r.type,u.region,u.style,u);this.contextEl.getImageData&&(this.indicatorImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawFrame:function(n,t,i){switch(n){case"circle":this._drawFrameCircle(t,i,this);break;case"rectangle":this._drawFrameRectangle(t,i,this);break;case"roundedrectangle":this._drawFrameRoundedRectangle(t,i,this);break;case"thermometer":this._drawFrameThermometer(t,i,this)}},_drawText:function(n,t){this.contextEl.beginPath();this.contextEl.textAlign="center";this.contextEl.fillStyle=t.textColor=="transparent"?"rgba(0,0,0,0)":t.textColor;this.contextEl.font=t.font;this.contextEl.fillText(t.indicatorText,n.textLocation.x,n.textLocation.y);this.contextEl.closePath()},_drawTriangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawPointer:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(t.width/2,t.height/4);this._contextClosePath(t,i)},_drawWedge:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(3*t.width/4,0);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawSlider:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/4,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(t.width/4,t.height/2);this._contextClosePath(t,i)},_drawStar:function(n,t,i){this._contextOpenPath(t,i);i.Model.orientation=="horizontal"&&i.markerPlacement=="near"?(i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY),i.contextEl.lineTo(n.startX,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width/6,n.startY),i.contextEl.lineTo(n.startX+t.width/2,n.startY+t.height)):(i.contextEl.lineTo(n.startX+t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height/3),i.contextEl.lineTo(n.startX,n.startY+t.height/3),i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width/2,n.startY));this._contextClosePath(t,i)},_drawPentagon:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/3,-t.height/2);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width/3,t.height/2);this._contextClosePath(t,i)},_drawDiamond:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(t.width,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(0,0);this._contextClosePath(t,i)},_drawCircle:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_drawTrapezoid:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/4);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/4);this._contextClosePath(t,i)},_drawRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/2);this._contextClosePath(t,i)},_drawRoundedRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY-t.height/2);this._setContextRotation(t,i);i.contextEl.lineTo(t.radius,0);i.contextEl.lineTo(t.width-t.radius,0);i.contextEl.quadraticCurveTo(t.width,0,t.width,t.radius);i.contextEl.lineTo(t.width,t.height-t.radius);i.contextEl.quadraticCurveTo(t.width,t.height,t.width-t.radius,t.height);i.contextEl.lineTo(t.radius,t.height);i.contextEl.quadraticCurveTo(0,t.height,0,t.height-t.radius);i.contextEl.lineTo(0,t.radius);i.contextEl.quadraticCurveTo(0,0,t.radius,0);this._contextClosePath(t,i)},_drawCustomImage:function(t,i){var r=new Image;n(r).on("load",function(){t.contextEl.drawImage(this,0,0,t.Model.width,t.Model.height);t.Model.scales!=null&&t._drawScales();t.Model.Items!=null&&t._renderItems()}).attr("src",i)},_drawEllipse:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.scale(2,1);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_getIndicatorImage:function(){return this.pointerImage?this.pointerImage:this._getMarkerPointerImage()},_getBarPointerImage:function(){return this.customLabelImage?this.customLabelImage:this._getCustomLabelImage()},_getMarkerPointerImage:function(){return this.barPointerImage?this.barPointerImage:this._getCustomLabelImage()},_getCustomLabelImage:function(){return this.rangeImage?this.rangeImage:this._getRangeImage()},_getRangeImage:function(){return this.labelImage?this.labelImage:this._getLabelImage()},_getLabelImage:function(){return this.tickImage?this.tickImage:this._getTickImage()},_getTickImage:function(){return this.scaleImage?this.scaleImage:this.outerImage},setPointerValue:function(n,i,r){n<this.Model.scales.length&&i<this.Model.scales[n].markerPointers.length&&r!=null&&(r<=this.scaleEl[n].maximum&&r>=this.scaleEl[n].minimum&&(this.scaleEl[n].markerPointers[i].value=r),this.contextEl.putImageData?(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),!t.isNullOrUndefined(this.outerDiv)&&this.model.scale[n].showCustomLabels&&this.outerDiv.empty(),this._setCustomLabel(),this._setMarkerPointers(),this._setIndicators()):this.initialize())},getPointerValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].value:null},setPointerWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].width=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].width:null},setPointerHeight:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].length=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerHeight:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].length:null},_getColor:function(n,t){return typeof t=="string"?t:"rgba("+t.r+", "+t.g+","+t.b+", "+t.a/255+")"},setPointerDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].distanceFromScale=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].distanceFromScale:null},setPointerPlacement:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].placement=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerPlacement:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].placement:null},setMarkerStyle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].type=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getMarkerStyle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].type:null},setBarPointerValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length&&i!=null&&(i<=this.scaleEl[n].maximum&&i>=this.scaleEl[n].minimum&&(this.scaleEl[n].barPointers[t].value=i),this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():this._reDrawBarPointer():this.initialize())},getBarPointerValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length?this.scaleEl[n].barPointers[t].value:null},setBarWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length&&i!=null&&(this.scaleEl[n].barPointers[t].width=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():this._reDrawBarPointer():this.initialize())},getBarWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length?this.scaleEl[n].barPointers[t].width:null},setBarDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length&&i!=null&&(this.scaleEl[n].barPointers[t].distanceFromScale=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():this._reDrawBarPointer():this.initialize())},getBarDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length?this.scaleEl[n].barPointers[t].distanceFromScale:null},setCustomLabelValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].value=i,this.contextEl.putImageData?this._reDrawCustomLabel():this.initialize())},getCustomLabelValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].value:null},setCustomLabelAngle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].textAngle=i,this.contextEl.putImageData?this._reDrawCustomLabel():this.initialize())},getCustomLabelAngle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].textAngle:null},setRangeStartValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].startValue=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeStartValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].startValue:null},setRangeEndValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].endValue=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeEndValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].endValue:null},setRangeStartWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].startWidth=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeStartWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].startWidth:null},setRangeEndWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].endWidth=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeEndWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].endWidth:null},setRangeDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].distanceFromScale=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].distanceFromScale:null},setRangePosition:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].placement=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangePosition:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].placement:null},setRangeBorderWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].border.width=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeBorderWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].border.width:null},setLabelAngle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].angle=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelAngle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].angle:null},setLabelStyle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].type=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelStyle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].type:null},setLabelPlacement:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].placement=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelPlacement:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].placement:null},setLabelXDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].distanceFromScale.x=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelXDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].distanceFromScale.x:null},setLabelYDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].distanceFromScale.y=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelYDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].distanceFromScale.y:null},setTickAngle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].angle=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickAngle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].angle:null},setTickWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].width=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].width:null},setTickHeight:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].height=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickHeight:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].height:null},setTickStyle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].type=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickStyle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].type:null},setTickPlacement:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].placement=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickPlacement:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].placement:null},setTickXDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].distanceFromScale.x=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickXDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].distanceFromScale.x:null},setTickYDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].distanceFromScale.y=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickYDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].distanceFromScale.y:null},setScaleLocation:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].position.x=t.x,this.scaleEl[n].position.y=t.y,this.initialize())},getScaleLocation:function(n){return n<this.Model.scales.length?{x:this.scaleEl[n].position.x,y:this.scaleEl[n].position.y}:null},setMaximumValue:function(n,t){n<this.Model.scales.length&&t!=null&&(t>this.scaleEl[n].minimum&&(this.scaleEl[n].maximum=t),this.initialize())},getMaximumValue:function(n){return n<this.Model.scales.length?this.scaleEl[this.scaleIndex].maximum:null},setMinimumValue:function(n,t){n<this.Model.scales.length&&t!=null&&(t<this.scaleEl[n].maximum&&(this.scaleEl[n].minimum=t),this.initialize())},getMinimumValue:function(n){return n<this.Model.scales.length?this.scaleEl[this.scaleIndex].minimum:null},setScaleBarSize:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].width=t,this.initialize())},getScaleBarSize:function(n){return n<this.Model.scales.length?this.scaleEl[n].width:null},setScaleBarLength:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].length=t,this.initialize())},setScaleStyle:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].type=t,this.initialize())},getScaleStyle:function(n){return n<this.Model.scales.length?this.scaleEl[n].type:null},getScaleBarLength:function(n){return n<this.Model.scales.length?this.scaleEl[n].length:null},setScaleBorderWidth:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].border.width=t,this.initialize())},setScaleDirection:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].direction=t,this.initialize())},getScaleDirection:function(n){return n<this.Model.scales.length?this.scaleEl[n].direction:null},getScaleBorderWidth:function(n){return n<this.Model.scales.length?this.scaleEl[n].border.width:null},setMajorIntervalValue:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].majorIntervalValue=t,this.initialize())},getMajorIntervalValue:function(n){return n<this.Model.scales.length?this.scaleEl[n].majorIntervalValue:null},setMinorIntervalValue:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].minorIntervalValue=t,this.initialize())},getMinorIntervalValue:function(n){return n<this.Model.scales.length?this.scaleEl[n].minorIntervalValue:null},_reDrawBarPointer:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.customLabelImage)?t.isNullOrUndefined(this.rangeImage)?t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage:this.rangeImage:this.customLabelImage();this.contextEl.putImageData(n,0,0);this._setBarPointers();this._setMarkerPointers();this._setIndicators()}else this.contextEl.putImageData!="undefined"&&(this.contextEl.putImageData(this._getBarPointerImage(),0,0),this._setBarPointers(),this._setMarkerPointers(),this._setIndicators())},_reDrawMarkerPointer:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.customLabelImage)?t.isNullOrUndefined(this.rangeImage)?t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage:this.rangeImage:this.customLabelImage();this.contextEl.putImageData(n,0,0);this._setMarkerPointers()}else this.contextEl.putImageData!="undefined"&&(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers())},_reDrawCustomLabel:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.rangeImage)?t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage:this.rangeImage;this.contextEl.putImageData(n,0,0);this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getCustomLabelImage(),0,0),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},_reDrawRange:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage;this.contextEl.putImageData(n,0,0);this._setRange();this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getRangeImage(),0,0),this._setRange(),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},_reDrawLabel:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage;this.contextEl.putImageData(n,0,0);this._setLabels();this._setRange();this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getLabelImage(),0,0),this._setLabels(),this._setRange(),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},_reDrawTickMark:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage;this.contextEl.putImageData(n,0,0);this._setTicks();this._setLabels();this._setRange();this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getTickImage(),0,0),this._setTicks(),this._setLabels(),this._setRange(),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},refresh:function(){this._init()},exportImage:function(n,i){var f,u,o,r,c,s;if(t.browserInfo().name==="msie"&&parseFloat(t.browserInfo().version)<10)return!1;f=this.canvasEl[0].toDataURL();f=f.replace(/^data:[a-z]*;,/,"");var l=f.split(","),e=atob(l[1]),h=new ArrayBuffer(e.length),a=new Uint8Array(h);for(u=0;u<e.length;u++)a[u]=e.charCodeAt(u);return o=new Blob([h],{type:"image/png"}),t.browserInfo().name==="msie"?window.navigator.msSaveOrOpenBlob(o,n+"."+i):(r=document.createElement("a"),c=URL.createObjectURL(o),r.href=c,r.setAttribute("download",n+"."+i),document.createEvent?(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(s)):r.fireEvent&&r.fireEvent("onclick")),!0},resizeCanvas:function(){var f,e,u,i,r;if(_linearGaugeCount=_linearGaugeCount!=0?_linearGaugeCount-1:n(".e-lineargauge").length-1,e=!0,t.isNullOrUndefined(this.GaugeEl.parent().attr("style"))||(f=this.GaugeEl.parent().attr("style").split(";")),t.isNullOrUndefined(f)||n.each(f,function(n,t){while(t.indexOf("width")!=-1){e=t.indexOf("px")==-1?!0:!1;break}}),e){for(u=window.innerWidth/initialLinearDivWidth,this.model.width*=u,i=0;this.model.scales[i]!=null;i++)for(this.model.scales[i].length*=u,r=0;this.model.scales[i].markerPointers[r]!=null||this.model.scales[i].barPointers[r]!=null||this.model.scales[i].indicators[r]!=null||this.model.scales[i].customLabels[r]!=null||this.model.scales[i].ranges[r]!=null||this.model.scales[i].labels[r]!=null||this.model.scales[i].ticks[r]!=null;r++)t.isNullOrUndefined(this.model.scales[i].markerPointers[r])||(this.model.scales[i].markerPointers[r].length*=u,this.model.scales[i].markerPointers[r].width*=u),t.isNullOrUndefined(this.model.scales[i].barPointers[r])||(this.model.scales[i].barPointers[r].distanceFromScale*=u,this.model.scales[i].barPointers[r].width*=u),!t.isNullOrUndefined(this.model.scales[i].indicators[r])&&this.model.scales[i].showIndicators&&(this.model.scales[i].indicators[r].height*=u,this.model.scales[i].indicators[r].width*=u,this.model.scales[i].indicators[r].position.x*=u,this.model.scales[i].indicators[r].textLocation.x*=u),t.isNullOrUndefined(this.model.scales[i].ticks[r])||(this.model.scales[i].ticks[r].length*=u,this.model.scales[i].ticks[r].width*=u),t.isNullOrUndefined(this.model.scales[i].ranges[r])||(this.model.scales[i].ranges[r].startWidth*=u,this.model.scales[i].ranges[r].endWidth*=u),t.isNullOrUndefined(this.model.scales[i].customLabels[r])||(this.model.scales[i].customLabels[r].positionType!="outer"&&(this.model.scales[i].customLabels[r].position.x*=u),this.model.scales[i].customLabels[r].font.size=parseFloat(this.model.scales[i].customLabels[r].font.size.match(/\d+/)[0])*u<10?"10px":parseFloat(this.model.scales[i].customLabels[r].font.size.match(/\d+/)[0])*u>this._customLblMaxSize?this._customLblMaxSize.toString()+"px":(parseFloat(this.model.scales[i].customLabels[r].font.size.match(/\d+/)[0])*u).toString()+"px");this._render();_linearGaugeCount==0&&(initialLinearDivWidth=window.innerWidth)}},_onDrawTicks:function(n,t){var r={index:this.tickIndex,element:this.tickEl[this.tickIndex],angle:parseInt(n),value:t},i={Object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region};this._trigger("drawTicks",i)},_onDrawLabels:function(n){var t={index:this.labelIndex,element:this.labelEl[this.labelIndex],angle:parseInt(n),value:this.labelValue},i={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,label:t};this._trigger("drawLabels",i)},_onDrawBarPointers:function(n){var t={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,barPointerIndex:this.barPointerIndex,barElement:this.barPointerEl[this.barPointerIndex],context:this.contextEl,style:this.style,position:this.region,pointerValue:n};this._trigger("drawBarPointers",t)},_onDrawMarkerPointers:function(n,t){var i={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,markerPointerIndex:this.markerPointerIndex,markerElement:this.markerPointerEl[this.markerPointerIndex],context:this.contextEl,style:this.style,position:this.region,pointerValue:t,pointerAngle:parseInt(n)};this._trigger("drawMarkerPointers",i)},_onDrawRange:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,rangeIndex:this.rangeIndex,rangeElement:this.rangeEl[this.rangeIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawRange",n)},_onDrawCustomLabel:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,customLabelIndex:this.customLabelIndex,customLabelElement:this.customLabelEl[this.customLabelIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawCustomLabel",n)},_onDrawIndicators:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,indicatorIndex:this.indicatorIndex,indicatorEl:this.indicatorEl[this.indicatorIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawIndicators",n)},onLoad:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("load",n)},_onInit:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("init",n)},_onRenderComplete:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("renderComplete",n)},_onMouseClick:function(n){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:n},i={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,markerPointer:t};this._trigger("mouseClick",i)},_onMouseClickMove:function(n){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:n},i={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,markerPointer:t};this._trigger("mouseClickMove",i)},_onMouseClickUp:function(n){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:n},i={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,markerPointer:t};this._trigger("mouseClickUp",i)},_restoreWidth:function(){this.scaleEl[this.scaleIndex].length=this.scaleEl[this.scaleIndex].length+this.bottomRadius+this.scaleEl[this.scaleIndex].width;this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartY[this.scaleIndex]-this.bottomRadius-this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartX[this.scaleIndex]-this.bottomRadius-this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]-this.scaleEl[this.scaleIndex].width/2},_modifyWidth:function(){this.scaleEl[this.scaleIndex].length=this.scaleEl[this.scaleIndex].length-this.bottomRadius-this.scaleEl[this.scaleIndex].width;this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartY[this.scaleIndex]+this.bottomRadius+this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartX[this.scaleIndex]+this.bottomRadius+this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2},_getClockwiseLinePosition:function(n){var t;return t=(n-this.scaleEl[this.scaleIndex].minimum)/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)*100,this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100):this.scaleStartX[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100)},_getCounterClockwiseLinePosition:function(n){var t;return t=this.scaleEl[this.scaleIndex].maximum-n+this.scaleEl[this.scaleIndex].minimum,t=(t-this.scaleEl[this.scaleIndex].minimum)/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)*100,this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100):this.scaleStartX[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100)},_getValue:function(n){var i,t;return i=this.Model.orientation=="Vertical"?(n.y-this.scaleStartY[this.scaleIndex])/this.scaleEl[this.scaleIndex].length*100:(n.x-this.scaleStartX[this.scaleIndex])/this.scaleEl[this.scaleIndex].length*100,t=(i*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)+this.scaleEl[this.scaleIndex].minimum)/100,this.scaleEl[this.scaleIndex].direction=="counterclockwise"?this.scaleEl[this.scaleIndex].maximum-t:this.scaleEl[this.scaleIndex].minimum+t},_getPointerXPosition:function(n){var t,i;return this.Model.orientation=="Vertical"?(this.markerPlacement=="far"&&(t=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,i=0),this.markerPlacement=="near"&&(t=this.scaleStartX[this.scaleIndex]+n.distanceFromScale,i=180),this.markerPlacement=="center"&&(t=n.type=="circle"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-Math.sqrt(n.length*n.length+n.width*n.width)/2+n.distanceFromScale:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,i=0)):(this.markerPlacement=="far"&&(t=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,i=90),this.markerPlacement=="near"&&(t=this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,i=270),this.markerPlacement=="center"&&(t=n.type=="circle"?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-Math.sqrt(n.length*n.length+n.width*n.width)/2+n.distanceFromScale:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.length/2+n.distanceFromScale,i=90)),{startx:t,angle:i}},_hexFromRGB:function(t,i,r){var u=[t.toString(16),i.toString(16),r.toString(16)];return n.each(u,function(n,t){t.length===1&&(u[n]="0"+t)}),u.join("").toUpperCase()},_setGradientColor:function(t,i,r){r.Name||typeof r=="string"?(i.addColorStop(0,r),i.addColorStop(1,r)):n.each(r,function(n,t){i.addColorStop(t.colorStop!=NaN?t.colorStop:0,typeof t.color=="string"?t.color:t.color)})},_getFontString:function(n,t){return t.fontStyle+" "+(t.size==null?"11px":t.size)+" "+t.fontFamily},_setPointerDimension:function(n,t){if(t.Model.orientation&&t.Model.orientation=="horizontal"){var i=n.width,r=n.height;n.height=i;n.width=r}return n},_setContextRotation:function(n,t){t.contextEl.rotate(Math.PI*(n.angle/180))},_browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},wireEvents:function(){var f=jQuery.uaMatch(navigator.userAgent),r=this._browserInfo(),i=r.isMSPointerEnabled,t=r.pointerEnabled,u;this.startEv=i?t?"pointerdown":"MSPointerDown":"touchstart mousedown";this.endEv=i?t?"pointerup":"MSPointerUp":"touchend mouseup";this.moveEv=i?t?"pointermove":"MSPointerMove":"touchmove mousemove";this.leaveEv=i?t?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.scrollEv=f.browser.toLowerCase()=="mozilla"?t?"mousewheel":"DOMMouseScroll":"mousewheel";this.model.browserInfo=r;u=this.model.readOnly?"pan-y pan-x":"none";n(this.element).css("touch-action",u);this.onMouseMoveHandler=n.proxy(this._onMouseMove,this);this.onMouseUpHandler=n.proxy(this._onMouseUp,this);this.onHoverOCustomLabel=n.proxy(this._onHoverOCustomLabel,this);this.onLeaveOCustomLabel=n.proxy(this._onLeaveOCustomLabel,this);this.model.readOnly||(this.onMouseDownHandler=n.proxy(this._onMouseDown,this),this._on(n(this.element),this.startEv,this._onMouseDown));(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&(n(this.canvasEl).bind(this.moveEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.scrollEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.startEv,this.onMouseDownHandler),n(this.canvasEl).bind(this.endEv,this.onLeaveOCustomLabel),n(this.canvasEl).bind(this.leaveEv,this.onLeaveOCustomLabel));this.element.bind(this.startEv,this.onMouseDownHandler);this.model.tooltip.showCustomLabelTooltip&&(n("."+this._id+"outercustomlbl").bind("mouseenter",this.onHoverOCustomLabel),n("."+this._id+"outercustomlbl").bind(this.leaveEv,this.onLeaveOCustomLabel))},unWireEvents:function(){this.element.unbind(this.startEv,this.onMouseDownHandler)},_onHoverOCustomLabel:function(n){(n.currentTarget.innerHTML!=null||n.currentTarget.innerHTML!="")&&this._showTooltip(n,n.currentTarget.innerHTML)},_onLeaveOCustomLabel:function(t){this.isTouch(t)?(this._performTooltip(t),window.clearTimeout(this.model.timer),this.model.timer=setTimeout(function(){n(".tooltipDiv").fadeOut(500)},1200)):this._hideTooltip()},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_onMouseDown:function(t){var r,u,e,o,h,f,s,i;this._blockDefaultActions(t);this._mouseDown=!0;f=this.isTouch(t)?10:0;s=t.originalEvent.touches?t.originalEvent.touches[0]:t;r={x:s.pageX-n(this.canvasEl).offset().left-(this.Model.frame.outerWidth+this.Model.frame.innerWidth),y:s.pageY-n(this.canvasEl).offset().top-(this.Model.frame.outerWidth+this.Model.frame.innerWidth)};i=this;this.model.readOnly||n.each(this.Model.scales,function(t,s){i.scaleIndex=t;s.markerPointers!=null&&(i.markerPointerEl=s.markerPointers,n.each(s.markerPointers,function(t,s){u=i.scaleEl[i.scaleIndex].direction.toLowerCase()=="clockwise"?i._getClockwiseLinePosition(s.value):i._getCounterClockwiseLinePosition(s.value);e=u+s.width;o=u-s.width;h=i._getPointerXPosition(s).startx;var c=i._isBetween((i.Model.orientation=="horizontal"?r.y:r.x)-s.width,(i.Model.orientation=="horizontal"?r.y:r.x)+s.width,h,f);(i.Model.orientation=="horizontal"?i._isBetween(o,e,r.x,f):i._isBetween(o,e,r.y,f))&&c&&(i.activeElement=s);i.Model.scales[i.scaleIndex].barPointers[t]!=null&&(i.activeBarElement=i.Model.scales[i.scaleIndex].barPointers[t]);i.model.mouseClick&&i._onMouseClick(s.value);i.onMouseMoveHandler=n.proxy(i._onMouseMove,i);i.onMouseUpHandler=n.proxy(i._onMouseUp,i);n(document).bind(i.moveEv,i.onMouseMoveHandler);n(document).bind(i.endEv,i.onMouseUpHandler)}))})},_isBetween:function(n,t,i,r){return n<t?i>=n-r&&i<=t+r:i>=t-r&&i<=n+r},_onMouseUp:function(){this._mouseDown=!1;this.mouseMove=!1;n(document).unbind(self.moveEv,self.onMouseMoveHandler);n(document).unbind(self.endEv,self.onMouseUpHandler);this.model.mouseClickUp&&this.activeElement&&this._onMouseClickUp(this.activeElement.value);this.activeElement=null},_mousePosition:function(n){if(!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=i){if(!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},_calTouchPosition:function(n){var i=jQuery.uaMatch(navigator.userAgent),t=this._mousePosition(n);n.pageX=t.x;n.pageY=t.y},getEvent:function(n){return n.targetTouches&&n.targetTouches[0]?n.targetTouches[0]:n},_onMouseMove:function(i){if(this._mouseDown&&!t.isNullOrUndefined(this.activeElement)){this._blockDefaultActions(i);var r=i.originalEvent.touches?i.originalEvent.touches[0]:i,u={x:r.pageX-n(this.canvasEl).offset().left-(this.Model.frame.outerWidth+this.Model.frame.innerWidth),y:r.pageY-n(this.canvasEl).offset().top-(this.Model.frame.outerWidth+this.Model.frame.innerWidth)};this.activeElement.value=this._getValue(u);this.value(this.activeElement.value);this.model.mouseClickMove&&this._onMouseClickMove(this.activeElement.value);this.activeBarElement&&(this.activeBarElement.value=this._getValue(u));this.contextEl.putImageData?this._reDrawBarPointer():this._init()}else(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&!this.isTouch(i)&&this._performTooltip(i)},_performTooltip:function(t){for(var r,u=!1,f=10,o=this.isTouch(t),i=0;this._savedPoints[i]!=null;i++)if(o){var c=this._calTouchPosition(t),e=this.getEvent(t),s=e.pageX,h=e.pageY,r={X:s-n(this.canvasEl).offset().left,Y:h-n(this.canvasEl).offset().top};r.X>this._savedPoints[i].startX-f&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width+f&&r.Y>this._savedPoints[i].startY-f&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height+f?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()}else r={X:t.pageX-n(this.canvasEl).offset().left,Y:t.pageY-n(this.canvasEl).offset().top},r.X>this._savedPoints[i].startX&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width&&r.Y>this._savedPoints[i].startY&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()},_showTooltip:function(t,i){var e=i+"",r=n(".tooltipDiv"),o;r.length==0&&(r=n("<div class='tooltipDiv' style='position: absolute; z-index: 105; display: block;'><\/div>"),n(document.body).append(r));this.model.tooltip.templateID!=""&&this.model.tooltip.templateID!=null?(o=n("#"+this.model.tooltip.templateID).clone(),n(".tooltipDiv")[0].innerHTML="",n(o).css("display","block").appendTo(r),n(r).css({"background-color":this.model.backgroundColor,border:"1px solid #bbbcbb","border-radius":"3px",color:"#565656"}),r.html(r.html().replace("#label#",e))):(n(r).html(e),n(r).css({"background-color":"white",border:"2px solid #bbbcbb",position:"absolute",padding:"10px 20px","margin-top":"5px","text-align":"left",font:"12px Segoe UI","font-stretch":"condensed",display:"inline-block","border-radius":"3px",color:"#565656",width:"auto"}));var s=10,u=t.pageX+s,f=t.pageY+s;u=u+n(r).width()<n(window).width()?u:u-n(r).width();f=f+n(r).height()<n(window).height()?f:f-n(r).height();n(r).css("left",u);n(r).css("top",f);n(".tooltipDiv").show()},_hideTooltip:function(){n(".tooltipDiv").remove()},_setTheme:function(){var n=this.model.themeProperties[this.model.theme];this._setThemeColors(n)},_setThemeColors:function(n){var f=[],e=this.model.themeProperties,o,i,t,r,u;for(o in e)f.push(o);for(i=0;i<f.length;i++)for(this.model.backgroundColor=!this.model.backgroundColor||this.model.backgroundColor==e[f[i]].scales.backgroundColor?n.scales.backgroundColor:this.model.backgroundColor,this.model.borderColor=!this.model.borderColor||this.model.borderColor==e[f[i]].scales.border.color?n.scales.border.color:this.model.borderColor,this.model.labelColor=!this.model.labelColor||this.model.labelColor==e[f[i]].scales.labels.labelColor?n.scales.labels.labelColor:this.model.labelColor,this.model.tickColor=!this.model.tickColor||this.model.tickColor==e[f[i]].scales.ticks.color?n.scales.ticks.color:this.model.tickColor,t=0;t<this.model.scales.length;t++){for(r=0;r<this.model.scales[t].markerPointers.length;r++)this.model.scales[t].markerPointers[r].backgroundColor=!this.model.scales[t].markerPointers[r].backgroundColor||this.model.scales[t].markerPointers[r].backgroundColor==e[f[i]].scales.markerPointers.backgroundColor?n.scales.markerPointers.backgroundColor:this.model.scales[t].markerPointers[r].backgroundColor,this.model.scales[t].markerPointers[r].border.color=!this.model.scales[t].markerPointers[r].border.color||this.model.scales[t].markerPointers[r].border.color==e[f[i]].scales.markerPointers.border.color?n.scales.markerPointers.border.color:this.model.scales[t].markerPointers[r].border.color;for(u=0;u<this.model.scales[t].barPointers.length;u++)this.model.scales[t].barPointers[u].backgroundColor=!this.model.scales[t].barPointers[u].backgroundColor||this.model.scales[t].barPointers[u].backgroundColor==e[f[i]].scales.barPointers.backgroundColor?n.scales.barPointers.backgroundColor:this.model.scales[t].barPointers[u].backgroundColor,this.model.scales[t].barPointers[u].border.color=!this.model.scales[t].barPointers[u].border.color||this.model.scales[t].barPointers[u].border.color==e[f[i]].scales.barPointers.border.color?n.scales.barPointers.border.color:this.model.scales[t].barPointers[u].border.color}}});t.datavisualization.LinearGauge.TickType={MajorInterval:"majorinterval",MinorInterval:"minorinterval"};t.datavisualization.LinearGauge.LabelType={Major:"major",Minor:"minor"};t.datavisualization.LinearGauge.FontStyle={Bold:"bold",Italic:"italic",Regular:"regular",Strikeout:"strikeout",Underline:"underline"};t.datavisualization.LinearGauge.PointerPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.TickPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.LabelPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.RangePlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.UnitTextPlacement={Front:"front",Back:"back"};t.datavisualization.LinearGauge.Directions={Clockwise:"clockwise",CounterClockwise:"counterclockwise"};t.datavisualization.LinearGauge.ScaleType={Rectangle:"rectangle",RoundedRectangle:"roundedrectangle",Thermometer:"thermometer"};t.datavisualization.LinearGauge.IndicatorType={Rectangle:"rectangle",Circle:"circle",RoundedRectangle:"roundedrectangle",Text:"text"};t.datavisualization.LinearGauge.MarkerType={Rectangle:"rectangle",Triangle:"triangle",Ellipse:"ellipse",Diamond:"diamond",Pentagon:"pentagon",Circle:"circle",Star:"star",Slider:"slider",Pointer:"pointer",Wedge:"wedge",Trapezoid:"trapezoid",RoundedRectangle:"roundedrectangle"};t.datavisualization.LinearGauge.CustomLabelPositionType={Inner:"inner",Outer:"outer"};t.datavisualization.LinearGauge.OuterCustomLabelPosition={Left:"left",Right:"right",Top:"top",Bottom:"bottom"};t.datavisualization.LinearGauge.Themes={FlatLight:"flatlight",FlatDark:"flatdark"}}(jQuery,Syncfusion),function(n,t,i){t.widget({ejDigitalGauge:"ej.datavisualization.DigitalGauge"},{element:null,model:null,validTags:["div","span"],_rootCSS:"e-digitalgauge",defaults:{segmentData:{"0":[0,1,2,3,4,5,14,15],"1":[1,2],"2":[0,14,1,6,8,4,3,15],"3":[0,1,2,3,6,8,14,15],"4":[1,2,5,6,8],"5":[0,2,3,5,6,8,14,15],"6":[0,2,3,4,5,6,8,14,15],"7":[0,1,2,14],"8":[0,1,2,3,4,5,6,8,14,15],"9":[0,1,2,3,5,6,8,14,15],A:[0,1,2,4,5,6,8,14],B:[0,1,2,3,7,9,8,14,15],C:[0,3,4,5,14,15],D:[0,1,2,3,7,9,14,15],E:[0,3,4,5,6,8,14,15],F:[0,4,5,6,8,14],G:[0,2,3,4,5,8,14,15],H:[1,2,4,5,6,8],I:[0,3,7,9,14,15],J:[1,2,3,4,15],K:[4,5,6,10,11],L:[3,4,5,15],M:[1,2,4,5,10,13],N:[1,2,4,5,11,13],O:[0,1,2,3,4,5,14,15],P:[0,1,4,5,6,8,14],Q:[0,1,2,3,4,5,11,14,15],R:[0,1,4,5,6,8,11,14],S:[0,2,3,5,6,8,14,15],T:[0,7,9,14],U:[1,2,3,4,5,15],V:[4,5,10,12],W:[1,2,4,5,11,12],X:[10,11,12,13],Y:[1,5,6,7,8],Z:[0,3,10,12,14,15]},matrixSegmentData:{"1":[0,3,0,4,1,1,1,2,1,3,1,4,2,3,2,4,3,3,3,4,4,3,4,4,5,3,5,4,6,1,6,2,6,3,6,4,6,5,6,6],"2":[0,1,0,2,0,3,0,4,0,5,1,5,1,6,2,5,2,6,3,4,3,5,4,3,4,2,5,2,5,1,6,1,6,2,6,3,6,4,6,5,6,6],"3":[0,1,0,2,0,3,0,4,0,5,1,5,1,6,2,5,2,6,3,2,3,3,3,4,3,5,3,6,4,5,4,6,5,5,5,6,6,1,6,2,6,3,6,4,6,5],"4":[0,3,0,4,0,5,1,2,1,3,1,4,1,5,2,1,2,2,2,4,2,5,3,0,3,1,3,4,3,5,4,0,4,1,4,2,4,3,4,4,4,5,4,6,5,4,5,5,6,4,6,5],"5":[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,5,4,6,5,5,5,6,6,1,6,2,6,3,6,4,6,5,6,6],"6":[0,3,0,4,0,5,0,6,1,2,1,3,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,2,5,3,5,6,5,7,6,3,6,4,6,5,6,6],"7":[0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,6,1,7,2,5,2,6,3,4,3,5,4,3,4,4,5,2,5,3,6,1,6,2],"8":[0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6],"9":[0,2,0,3,0,4,0,5,1,1,1,2,1,5,1,6,2,1,2,2,2,4,2,5,2,6,3,2,3,3,3,4,3,5,3,6,4,5,4,6,5,5,5,6,6,2,6,3,6,4,6,4,6,5],"0":[0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6],a:[0,2,0,3,0,4,0,5,0,6,1,6,1,7,2,6,2,7,3,2,3,3,3,4,3,5,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6,6,7],b:[0,1,0,2,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],c:[1,3,1,4,1,5,1,6,2,2,2,3,3,1,3,2,4,1,4,2,5,2,5,3,6,3,6,4,6,5,6,6],d:[0,6,0,7,1,6,1,7,2,6,2,7,3,2,3,3,3,4,3,5,3,6,3,7,4,1,4,2,4,5,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6,6,7],e:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,2,6,3,6,4,6,5,6,6,6,7],f:[0,4,0,5,0,6,0,7,1,3,1,4,2,3,2,4,3,1,3,2,3,3,3,4,3,5,3,6,3,7,4,3,4,4,5,3,5,4,6,3,6,4],g:[0,2,0,3,0,4,0,5,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,2,3,3,3,4,3,5,3,6,3,7,4,6,4,7,5,6,5,7,6,2,6,3,6,4,6,5,6,6],h:[0,1,0,2,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],i:[0,3,0,4,2,1,2,2,2,3,2,4,3,3,3,4,4,3,4,4,5,3,5,4,6,3,6,4],j:[1,5,1,6,2,5,2,6,3,5,3,6,4,1,4,2,4,5,4,6,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],k:[0,1,0,2,1,1,1,2,1,4,1,5,2,1,2,2,2,3,2,4,3,1,3,2,3,3,4,1,4,2,4,3,4,4,4,5,5,1,5,2,5,5,5,6,6,1,6,2,6,6,6,7],l:[0,2,0,3,0,4,0,5,0,6,1,5,1,6,2,5,2,6,3,5,3,6,4,5,4,6,5,5,5,6,6,5,6,6],m:[0,1,0,2,0,3,0,4,0,5,0,6,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,2,0,2,1,2,3,2,4,2,6,2,7,3,0,3,1,3,3,3,4,3,6,3,7,4,0,4,1,4,3,4,4,4,6,4,7,5,0,5,1,5,3,5,4,5,6,5,7,6,0,6,1,6,3,6,4,6,6,6,7],n:[1,1,1,2,1,3,1,4,1,5,1,6,2,0,2,1,2,2,2,6,2,7,3,0,3,1,3,6,3,7,4,0,4,1,4,6,4,7,5,0,5,1,5,6,5,7,6,0,6,1,6,6,6,7],o:[1,2,1,3,1,4,1,5,2,1,2,2,2,5,2,6,3,1,3,2,3,5,3,6,4,1,4,2,4,5,4,6,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],p:[1,1,1,2,1,3,1,4,1,5,1,6,2,1,2,2,2,3,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,3,4,4,4,5,4,6,5,1,5,2,6,1,6,2],q:[0,2,0,3,0,4,0,5,0,6,0,7,1,1,1,2,1,5,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,5,3,6,3,7,4,2,4,3,4,4,4,5,4,6,4,7,5,6,5,7,6,6,6,7],r:[0,1,0,3,0,4,0,5,1,1,1,2,1,3,1,4,1,5,1,6,2,1,2,2,2,6,3,1,3,2,4,1,4,2,5,1,5,2,6,1,6,2],s:[1,2,1,3,1,4,1,5,2,1,2,2,3,1,3,2,4,3,4,4,5,4,5,5,6,1,6,2,6,3,6,4],t:[0,3,0,4,1,3,1,4,2,1,2,2,2,3,2,4,2,5,2,6,3,3,3,4,4,3,4,4,5,3,5,4,6,4,6,5,6,6,6,7],u:[1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,5,5,6,5,7,6,2,6,3,6,4,6,5,6,6,6,7],v:[1,1,1,2,1,6,1,7,2,2,2,3,2,5,2,6,3,2,3,3,3,5,3,6,4,3,4,4,4,5,5,4,5,5,6,4],w:[0,0,0,1,0,6,0,7,1,0,1,1,1,6,1,7,2,0,2,1,2,3,2,4,2,6,2,7,3,0,3,1,3,3,3,4,3,6,3,7,4,0,4,1,4,3,4,4,4,6,4,7,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],x:[1,1,1,2,1,6,1,7,2,2,2,3,2,5,2,6,3,3,3,4,3,5,4,3,4,4,4,5,5,2,5,3,5,5,5,6,6,1,6,2,6,6,6,7],y:[1,1,1,2,1,5,1,6,2,1,2,2,2,5,2,6,3,2,3,3,3,4,3,5,4,3,4,4,5,2,5,3,6,1,6,2],z:[1,2,1,3,1,4,1,5,1,6,1,7,2,6,2,7,3,5,3,6,4,4,4,5,5,3,5,4,6,2,6,3,6,4,6,5,6,6,6,7],A:[0,3,0,4,1,2,1,3,1,4,1,5,2,2,2,3,2,4,2,5,3,1,3,2,3,5,3,6,4,1,4,2,4,3,4,4,4,5,4,6,5,1,5,2,5,5,5,6,6,0,6,1,6,6,6,7],B:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],C:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,0,2,1,3,0,3,1,4,0,4,1,5,1,5,2,6,2,6,3,6,4,6,5,6,6],D:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],E:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,1,6,2,6,3,6,4,6,5,6,6],F:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,1,6,2],G:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,0,2,1,3,0,3,1,3,4,3,5,3,6,4,0,4,1,4,6,5,1,5,2,5,6,6,2,6,3,6,4,6,5,6,6],H:[0,1,0,2,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],I:[0,2,0,3,0,4,0,5,0,6,1,4,2,4,3,4,4,4,5,4,6,1,6,2,6,3,6,4,6,5,6,6,6,7],J:[0,2,0,3,0,4,0,5,0,6,1,5,1,6,2,5,2,6,3,5,3,6,4,1,4,2,4,5,4,6,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],K:[0,1,0,2,0,5,0,6,1,1,1,2,1,4,1,5,2,1,2,2,2,3,2,4,3,1,3,2,3,3,4,1,4,2,4,3,4,4,5,1,5,2,5,4,5,5,6,1,6,2,6,5,6,6],L:[0,1,0,2,1,1,1,2,2,1,2,2,3,1,3,2,4,1,4,2,5,1,5,2,6,1,6,2,6,3,6,4,6,5,6,6],M:[0,1,0,2,0,6,0,7,1,1,1,2,1,3,1,5,1,6,1,7,2,1,2,2,2,4,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],N:[0,1,0,2,0,6,0,7,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,4,2,6,2,7,3,1,3,2,3,5,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],O:[0,2,0,3,0,4,0,5,1,1,1,2,1,5,1,6,2,0,2,1,2,6,2,7,3,0,3,1,3,6,3,7,4,0,4,1,4,6,4,7,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],P:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,1,6,2],Q:[0,2,0,3,0,4,0,5,1,1,1,2,1,5,1,6,2,0,2,1,2,6,2,7,3,0,3,1,3,6,3,7,4,0,4,1,4,4,4,6,4,7,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5,6,6,6,7],R:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,5,5,1,5,5,6,2,6,1,6,2,6,6],S:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,2,3,3,3,4,3,5,4,5,4,6,5,5,5,6,6,1,6,2,6,3,6,4,6,5,6,6],T:[0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,4,2,4,3,4,4,4,5,4],U:[0,1,0,2,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6],V:[0,0,0,1,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,2,3,3,3,5,3,6,4,3,4,4,4,5,4,6,5,4,5,5,6,4],W:[0,1,0,2,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,4,4,6,4,7,5,1,5,2,5,3,5,5,5,6,5,7,6,1,6,2,6,6,6,7],X:[0,0,0,1,0,6,0,7,1,1,1,2,1,5,1,6,2,1,2,2,2,5,2,6,3,2,3,3,3,4,3,5,4,2,4,3,4,4,4,5,5,1,5,2,5,5,5,6,6,0,6,1,6,6,6,7],Y:[0,0,0,1,0,6,0,7,1,0,1,1,1,6,1,7,2,1,2,2,2,5,2,6,3,2,3,3,3,4,3,5,4,3,4,4,5,3,5,4,6,3,6,4],Z:[0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,6,1,7,2,5,2,6,3,4,3,5,4,2,4,3,5,1,5,2,6,1,6,2,6,3,6,4,6,5,6,6,6,7],",":[5,3,5,4,5,5,6,4,6,5,7,3,7,4],":":[1,3,1,4,1,5,2,3,2,4,2,5,4,3,4,4,4,5,5,3,5,4,5,5],"%":[0,6,0,7,1,1,1,2,1,5,1,6,2,1,2,2,2,4,2,5,3,3,3,4,4,2,4,3,5,1,5,2,5,4,5,5,6,0,6,1,6,4,6,5],"!":[0,3,0,4,0,5,1,3,1,4,1,5,2,3,2,4,2,5,3,3,3,4,3,5,4,3,4,4,4,5,5,3,5,4,5,5,7,4],"(":[0,2,0,3,1,1,1,2,2,1,2,2,3,1,3,2,4,1,4,2,5,1,5,2,6,1,6,2,7,2,7,3],")":[0,5,0,6,1,6,1,7,2,6,2,7,3,6,3,7,4,6,4,7,5,6,5,7,6,6,6,7,7,5,7,6],".":[5,3,5,4,5,5,6,3,6,4,6,5,7,3,7,4,7,5]},frame:{backgroundImageUrl:null,innerWidth:6,outerWidth:10},height:150,width:400,enableResize:!1,isResponsive:!1,themes:"flatlight",items:null,init:null,load:null,renderComplete:null,itemRendering:null,value:"text",themeProperties:{flatlight:{items:{segmentSettings:{color:"#232323"},shadowColor:"#232323",textColor:"#232323"}},flatdark:{items:{segmentSettings:{color:"#b1b0b0"},shadowColor:"#b1b0b0",textColor:"#b1b0b0"}}}},dataTypes:{segmentData:"data",matrixSegmentData:"data",items:"array",isResponsive:"boolean"},_setValues:function(){this.gaugeEl=this.element;this.segmentCount=null;this.contextEl=null;this.style=null;this._value=null;this.region=null;this.canvasEl=null;this.segement16X=null;this.segment16Y=null;this.segmentHeight=null;this.segmentAngle=null;this.startX=5;this.startY=5;this.gradient=null;this.itemIndex=null;this.characterSpace=null;this.outerImage=null;this.radius=null;this.frameOuterLocation=null;this.frameInnerLocation=null;this.glassFrameLocation=null;this.glassFrameStyle=null;this.frameOuterStyle=null;this.character=null;this.frameInnerStyle=null;this._itemInitialize()},observables:["value"],_tags:[{tag:"items",attr:["characterSettings.count","characterSettings.opacity","characterSettings.spacing","characterSettings.type","enableCustomFont","segmentSettings.color","segmentSettings.gradient","segmentSettings.length","segmentSettings.opacity","segmentSettings.spacing","segmentSettings.width","shadowBlur","shadowOffsetX","shadowOffsetY","textAlign","shadowColor","textColor","font.size","font.fontFamily","font.fontStyle","position.x","position.y"]}],value:t.util.valueFunction("value"),_destroy:function(){this.element.empty().removeClass("e-widget")},_setModel:function(t){var i,r;for(i in t)switch(i){case"height":this.model.height=t[i];break;case"width":this.model.width=t[i];break;case"items":this.model.items=t[i];this._itemInitialize();break;case"frame":n.extend(this.model.frame,t[i]);break;case"themes":this.model.themes=t[i];break;case"value":for(r=0;this.model.items[r]!=null;r++)this.model.items[r].value=this.value()}this.refresh()},_init:function(){_digitalGaugeCount=n(".e-digitalgauge").length;initialGaugeCount=_digitalGaugeCount;this._setValues();this._trigger("load");this._setTheme();this._initialize();this._onWindowResize()},_onWindowResize:function(){(this.model.enableResize||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this.resizeCanvas):this._on(n(window),"resize",this.resizeCanvas))},_setTheme:function(){var n=this.model.themeProperties[this.model.themes];this._setThemeColors(n)},_setThemeColors:function(n){var u=[],f=this.model.themeProperties,e,r,i;for(e in f)u.push(e);for(r=0;r<u.length;r++)for(i=0;i<this.model.items.length;i++)this.model.items[i].segmentSettings.color=t.isNullOrUndefined(this.model.items[i].segmentSettings.color)||this.model.items[i].segmentSettings.color==f[u[r]].items.segmentSettings.color?n.items.segmentSettings.color:this.model.items[i].segmentSettings.color,this.model.items[i].shadowColor=!this.model.items[i].shadowColor||this.model.items[i].shadowColor==f[u[r]].items.shadowColor?n.items.shadowColor:this.model.items[i].shadowColor,this.model.items[i].textColor=!this.model.items[i].textColor||this.model.items[i].textColor==f[u[r]].items.textColor?n.items.textColor:this.model.items[i].textColor},_initialize:function(){this.model.init&&this._clientSideOnInit();this._initObject(this);this.model.load&&this._clientSideOnLoad();this.model.frame.backgroundImageUrl!=null?this._drawCustomImage(this,this.model.frame.backgroundImageUrl):this._renderItems();this.model.renderComplete&&this._clientSideOnRenderComplete()},_itemInitialize:function(){var t=this;this.model.items!=null?n.each(this.model.items,function(i,r){var u=t._sendDefaultItem();n.extend(!0,u,r);n.extend(!0,r,u)}):this.model.items=[this._sendDefaultItem()]},_sendDefaultItem:function(){return{characterSettings:{count:4,opacity:1,spacing:2,type:t.datavisualization.DigitalGauge.CharacterType.EightCrossEightDotMatrix},enableCustomFont:!1,segmentSettings:{color:null,gradient:null,length:2,opacity:0,spacing:1,width:1},shadowBlur:0,shadowOffsetX:1,shadowOffsetY:1,textAlign:"left",font:{size:"11px",fontFamily:"Arial",fontStyle:"italic"},position:{x:0,y:0},shadowColor:null,textColor:null,value:null}},_initObject:function(t){var i,r;for(this.element.addClass("e-widget"),t.gaugeEl=this.element,i=0;this.model.items[i]!=null;i++)this.model.items[i].value==null&&(this.model.items[i].value=this.value());(t.canvasEl&&t.canvasEl.parent().empty(),t.canvasEl=n("<canvas><\/canvas>"),t.gaugeEl.append(t.canvasEl),t.canvasEl.attr("role","presentation"),_digitalGaugeCount==initialGaugeCount&&(initialDigitalDivWidth=window.innerWidth),t.canvasEl[0].setAttribute("width",t.model.width),t.canvasEl[0].setAttribute("height",t.model.height),t.centerX=t.canvasEl[0].width/2,t.centerY=t.canvasEl[0].height/2,r=t.canvasEl[0],typeof G_vmlCanvasManager!="undefined"&&(r=window.G_vmlCanvasManager.initElement(r)),r&&r.getContext)&&(t.contextEl=t.canvasEl[0].getContext("2d"))},_drawCustomImage:function(t,i){var r=new Image;n(r).on("load",function(){t.contextEl.drawImage(this,0,0,t.model.width,t.model.height);t.model.Scales!=null&&t._drawScales();t.model.items!=null&&t._renderItems()}).attr("src",i)},_setSegmentCount:function(n){switch(n){case"sevensegment":this._SegmentCount=7;break;case"fourteensegment":this._SegmentCount=14;break;case"sixteensegment":this._SegmentCount=16;break;case"eightcrosseightdotmatrix":this._SegmentCount=[8,8];break;case"eightcrosseightsquarematrix":this._SegmentCount=[8,8];break;default:this._SegmentCount=7}},_setInnerPosition:function(){this.contextEl.save();this.contextEl.translate(this.model.frame.outerWidth+this.model.frame.innerWidth,this.model.frame.outerWidth+this.model.frame.innerWidth);this.bounds={height:this.canvasEl[0].height-2*(this.model.frame.outerWidth+this.model.frame.innerWidth),width:this.canvasEl[0].width-2*(this.model.frame.outerWidth+this.model.frame.innerWidth)}},_setWidth:function(){var t=[];this.model.items!=null&&n.each(this.model.items,function(n,i){t.push(i.characterSettings.count)})},_renderItems:function(){if(this.model.items!=null){this._setInnerPosition();var t=this;n.each(this.model.items,function(n,i){t._setSegmentCount(i.characterSettings.type);t.itemIndex=n;t.canvasEl.attr("aria-label",i.value);t._setShadow(n,i);i.enableCustomFont?t._setCustomFont(n,i):i.characterSettings.type.indexOf("matrix")!=-1?t._drawMatrixSegments(n,i):t._drawSegments(n,i)})}},_setGradientColor:function(t,i,r){r.Name||typeof r=="string"?(i.addColorStop(0,this._getColor(t,r)),i.addColorStop(1,this._getColor(t,r))):n.each(r,function(n,r){i.addColorStop(r.colorStop!=NaN?r.colorStop:0,typeof r.color=="string"?r.color:this._getColor(t,r.color))})},_getColor:function(n,t){return typeof t=="string"?t:"rgba("+t.R+", "+t.G+","+t.B+", "+t.A/255+")"},_drawMatrixSegments:function(t,i){var o=[],u=[],s,h,f,r,e;for(i.value?(this._value=i.value.toString().split(""),i.characterSettings.count=this._value.length>4?this._value.length:4):this._value="",this.radius=i.characterSettings.type.indexOf("dot")!=-1?(i.segmentSettings.length+i.segmentSettings.width)/2:i.segmentSettings.width/2,s=this.startX=(this.bounds.width-i.characterSettings.count*(this._SegmentCount[0]*2*this.radius+i.characterSettings.spacing+this._SegmentCount[0]*i.segmentSettings.spacing))*(i.position.x/100),h=this.startY=(this.bounds.height-(this._SegmentCount[1]*(i.characterSettings.type.indexOf("dot")!=-1?2*this.radius:i.segmentSettings.length)+this._SegmentCount[1]*i.segmentSettings.spacing))*(i.position.y/100),f=0;f<i.characterSettings.count;f++)for(this._value&&(this.character=i.textAlign=="right"?this._value[this._value.length-i.characterSettings.count+f]:this._value[f],u=this.model.matrixSegmentData[this.character]),f!=0&&(s=this.startX=this.startX+i.characterSettings.spacing+i.segmentSettings.spacing+2*this.radius,this.startY=h),r=0;r<this._SegmentCount[1];r++){for(r!=0&&(this.startY=(i.characterSettings.type.indexOf("dot")!=-1?2*this.radius:i.segmentSettings.length)+this.startY+i.segmentSettings.spacing,this.startX=s),u&&n.each(u,function(n){if(n%2==0){if(u[n]>r)return!1;u[n]==r&&o.push(parseInt(u[n+1]))}}),e=0;e<this._SegmentCount[0];e++)e!=0&&(this.startX=this.startX+2*this.radius+i.segmentSettings.spacing),this.gradient=i.characterSettings.type.indexOf("dot")!=-1?this.contextEl.createRadialGradient(0,0,0,0,0,this.radius):this.contextEl.createLinearGradient(0,0,i.segmentSettings.width,0),i.segmentSettings.gradient&&this._setGradientColor(this,this.gradient,i.segmentSettings.gradient.colorInfo),this.region={startX:this.startX,startY:this.startY},this.style={opacity:o&&n.inArray(e,o)!=-1?i.characterSettings.opacity:i.segmentSettings.opacity,height:i.segmentSettings.length,width:i.segmentSettings.width,fillStyle:i.segmentSettings.color=="transparent"?"rgba(0,0,0,0)":this._getColor(this,i.segmentSettings.color),skewX:i.SkewAngleX,skewY:i.SkewAngleX},this.model.itemRendering&&this._clientSideOnItemRendering(!0,e,r),i.characterSettings.type.indexOf("dot")!=-1?this._drawDot(this.region,this.style):this._drawSquare(this.region,this.style);o=[]}},_drawSegments:function(t,i){var f=[],u,r;for(i.value&&(this._value=i.value.toUpperCase().toString().split(""),i.characterSettings.count=this._value.length>4?this._value.length:4),this.characterSpace=i.characterSettings.type=="sevensegment"?2*i.segmentSettings.width:4*i.segmentSettings.width,this._renderSegmentCalculation(i),this.gradient=this.contextEl.createLinearGradient(0,0,0,i.segmentSettings.width),i.segmentSettings.color?this._setGradientColor(this,this.gradient,i.segmentSettings.color):i.segmentSettings.gradient&&this._setGradientColor(this,this.gradient,i.segmentSettings.gradient.colorInfo),u=0;u<i.characterSettings.count;u++){for(i.value&&(f=this.model.segmentData[i.textAlign=="right"?this._value[this._value.length-i.characterSettings.count+u]:this._value[u]]),r=0;r<this._SegmentCount;r++)u!=0&&(this.segment16X[r]=this.segment16X[r]+i.segmentSettings.length+this.characterSpace+i.characterSettings.spacing),this._value&&(this.character=i.textAlign=="right"?this._value[this._value.length-i.characterSettings.count+u]:this._value[u]),this.region={startX:this.segment16X[r],startY:this.segment16Y[r]},this.style={angle:this.angle[r],fillStyle:this.gradient,isStroke:!1,isFill:!0,characterHeight:i.characterSettings.type=="sevensegment"?i.segmentSettings.length:this.segmentHeight[r],segmentWidth:i.segmentSettings.width,opacity:f&&n.inArray(r,f)!=-1?i.characterSettings.opacity:i.segmentSettings.opacity},this.model.itemRendering&&this._clientSideOnItemRendering(!1,r),this._drawSegmentLayers(this.region,this.style);this._notifyArrayChange&&this._notifyArrayChange("items["+t+"]value",i.value);this.value(i.value);f=[]}},_setCustomFont:function(n,t){this.startX=(this.bounds.width-this._measureText(t.value,0,this._getFontString(this,t.font)).width)*(t.position.x/100);this.startY=(this.bounds.height-this._measureText(t.value,0,this._getFontString(this,t.font)).height)*(t.position.y/100);this.region={startX:this.startX,startY:this.startY};this.style={font:this._getFontString(this,t.font),text:t.value,textColor:t.textColor?t.textColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,t.textColor):t.segmentSettings.color=="transparent"?"rgba(0,0,0,0)":this._getColor(this,t.segmentSettings.color)};this.model.itemRendering&&this._clientSideOnItemRendering(!1,segment);this._drawText(this.region,this.style)},_getFontString:function(n,t){return(t.size==null?"11px":t.size)+" "+t.fontFamily+" "+(t.fontStyle?t.fontStyle:"")},_renderSegmentCalculation:function(n){var t=n.segmentSettings.length,i=n.segmentSettings.width,r;this.startX=(this.bounds.width-n.characterSettings.count*(t+this.characterSpace+n.characterSettings.spacing))*(n.position.x/100);this.startY=(this.bounds.height-2*t-i)*(n.position.y/100);r=n.characterSettings.type=="sevensegment"?t:t/2;this.segment16X=[this.startX+i/2,this.startX+t+4*i,this.startX+t+4*i,this.startX+i/2,this.startX,this.startX,this.startX+i/2,this.startX+r+2*i,this.startX+2.5*i+r,this.startX+r+2*i,this.startX+t+2.5*i,this.startX+r+2.5*i,this.startX+r+1.5*i,this.startX+1.5*i,this.startX+5*i/2+r,this.startX+2.5*i+r];this.segment16Y=[this.startY,this.startY,this.startY+t+i,this.startY+2*t+2*i,this.startY+t+i,this.startY,this.startY+t+i,this.startY+t+i,this.startY+t+i,this.startY,this.startY+i,this.startY+t+i,this.startY+t+i,this.startY+i,this.startY,this.startY+2*t+2*i];this.segmentHeight=[t/2,t,t,t/2,t,t,t/2,t,t/2,t,t,t,t,t,t/2,t/2];this.angle=[-90,0,0,-90,0,0,-90,0,-90,0,27,-27,27,-27,-90,-90];n.characterSettings.type=="sevensegment"&&(this.segment16X[2]=this.segment16X[1]=this.startX+t+2*i);n.characterSettings.type=="fourteensegment"&&(this.segmentHeight[3]=this.segmentHeight[0]=t+2*i)},_drawSegmentLayers:function(n,t){this._contextOpenPath(t,this);this.contextEl.translate(n.startX,n.startY);this.contextEl.rotate(Math.PI*(t.angle/180));this.contextEl.lineTo(0,0);this.contextEl.lineTo(-t.segmentWidth,t.segmentWidth);this.contextEl.lineTo(-t.segmentWidth,t.characterHeight);this.contextEl.lineTo(0,t.characterHeight+t.segmentWidth);this.contextEl.lineTo(t.segmentWidth,t.characterHeight);this.contextEl.lineTo(t.segmentWidth,t.segmentWidth);this._contextClosePath(t,this)},_drawDot:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.translate(n.startX,n.startY);this.contextEl.fillStyle=t.fillStyle;this.contextEl.globalAlpha=t.opacity;this.contextEl.arc(0,0,this.radius,0,2*Math.PI,!0);this.contextEl.fill();this.contextEl.closePath();this.contextEl.restore()},_setShadow:function(n,t){this.contextEl.save();this.contextEl.shadowColor=t.shadowColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,t.shadowColor);this.contextEl.shadowOffsetY=t.shadowOffsetY;this.contextEl.shadowOffsetX=t.shadowOffsetX;this.contextEl.shadowBlur=t.shadowBlur},_drawSquare:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.translate(n.startX,n.startY);this.contextEl.fillStyle=t.fillStyle;this.contextEl.globalAlpha=t.opacity;this.contextEl.rect(0,0,t.width,t.height);this.contextEl.fill();this.contextEl.closePath();this.contextEl.restore()},_drawText:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.font=t.font;this.contextEl.textBaseline="hanging";this.contextEl.fillStyle=t.textColor=="transparent"?"rgba(0,0,0,0)":t.textColor;this.contextEl.fillText(t.text,n.startX,n.startY);this.contextEl.closePath();this.contextEl.restore()},setValue:function(n,t){n<this.model.items.length&&t!=null&&(this.model.items[n].value=t,this._initialize())},getValue:function(n){return this.model.items[n].value},setPosition:function(n,t){n<this.model.items.length&&t!=null&&(this.model.items[n].position.x=t.x,this.model.items[n].position.y=t.y,this._initialize())},getPosition:function(n){return n<this.model.items.length?{x:this.model.items[n].position.x,y:this.model.items[n].position.y}:null},refresh:function(){this._setTheme();this._initialize()},exportImage:function(n,i){var f,u,o,r,c,s;if(t.browserInfo().name==="msie"&&parseFloat(t.browserInfo().version)<10)return!1;f=this.canvasEl[0].toDataURL();f=f.replace(/^data:[a-z]*;,/,"");var l=f.split(","),e=atob(l[1]),h=new ArrayBuffer(e.length),a=new Uint8Array(h);for(u=0;u<e.length;u++)a[u]=e.charCodeAt(u);return o=new Blob([h],{type:"image/png"}),t.browserInfo().name==="msie"?window.navigator.msSaveOrOpenBlob(o,n+"."+i):(r=document.createElement("a"),c=URL.createObjectURL(o),r.href=c,r.setAttribute("download",n+"."+i),document.createEvent?(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(s)):r.fireEvent&&r.fireEvent("onclick")),!0},resizeCanvas:function(){var u,f,r,i;if(_digitalGaugeCount=_digitalGaugeCount!=0?_digitalGaugeCount-1:n(".e-digitalgauge").length-1,f=!0,t.isNullOrUndefined(this.canvasEl.parent().attr("style"))||(u=this.GaugeEl.parent().attr("style").split(";")),t.isNullOrUndefined(u)||n.each(u,function(n,t){while(t.indexOf("width")!=-1){f=t.indexOf("px")==-1?!0:!1;break}}),f){for(r=window.innerWidth/initialDigitalDivWidth,this.model.width*=r,i=0;this.model.items[i]!=null;i++)this.model.items[i].segmentSettings.width*=r,this.model.items[i].segmentSettings.length*=r,this.model.items[i].segmentSettings.spacing*=r,this.model.items[i].characterSettings.spacing*=r;this.refresh();_digitalGaugeCount==0&&(initialDigitalDivWidth=window.innerWidth)}},_clientSideOnLoad:function(){var n={object:this,items:this.model.items,context:this.contextEl};this._trigger("load",n)},_clientSideOnItemRendering:function(n,t,i){var r;r=n?{object:this,items:this.model.items,character:this.character,context:this.contextEl,position:this.region,style:this.style,row:t,column:i}:{object:this,model:this.model,id:this.model.ClientId,items:this.model.items,character:this.character,context:this.contextEl,position:this.region,style:this.style,segment:t};this._trigger("itemRendering",r)},_clientSideOnInit:function(){var n={object:this,items:this.model.items,context:this.contextEl};this._trigger("init",n)},_clientSideOnRenderComplete:function(){var n={object:this,items:this.model.items,context:this.contextEl};this._trigger("renderComplete",n)},_contextOpenPath:function(n,t){t.contextEl.save();t.contextEl.beginPath();n.strokeStyle&&(t.contextEl.strokeStyle=n.strokeStyle);n.opacity!=i&&(t.contextEl.globalAlpha=n.opacity);n.lineWidth&&(t.contextEl.lineWidth=n.lineWidth);n.fillStyle&&(t.contextEl.fillStyle=n.fillStyle)},_contextClosePath:function(n,t){t.contextEl.closePath();n.isFill&&t.contextEl.fill();n.isStroke&&t.contextEl.stroke();t.contextEl.restore()},_measureText:function(t,i,r){var u=document.createElement("DIV"),f;return u.innerHTML=t,r!=null&&(u.style.font=r),u.style.backgroundColor="white",u.style.position="absolute",u.style.top=-100,u.style.left=0,i&&(u.style.maxwidth=i+"px"),document.body.appendChild(u),f={width:u.offsetWidth,height:u.offsetHeight},n(u).remove(),f}});t.datavisualization.DigitalGauge.CharacterType={SevenSegment:"sevensegment",FourteenSegment:"fourteensegment",SixteenSegment:"sixteensegment",EightCrossEightDotMatrix:"eightcrosseightdotmatrix",EightCrossEightSquareMatrix:"eightcrosseightsquarematrix"};t.datavisualization.DigitalGauge.TextAlign={Left:"left",Right:"right"};t.datavisualization.DigitalGauge.FontStyle={Normal:"normal",Bold:"bold",Italic:"italic",Underline:"underline",Strikeout:"strikeout"};t.datavisualization.DigitalGauge.Themes={FlatLight:"flatlight",FlatDark:"flatdark"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejBulletGraph","ej.datavisualization.BulletGraph",{element:null,model:null,validTags:["div"],_tags:[{tag:"qualitativeRanges",attr:["rangeEnd","rangeStroke","rangeOpacity"]},{tag:"quantitativeScaleSettings.featureMeasures",attr:["value","comparativeMeasureValue"]}],defaults:{locale:null,enableGroupSeparator:!1,value:0,comparativeMeasureValue:0,width:null,height:null,theme:"flatlight",orientation:"horizontal",flowDirection:"forward",qualitativeRangeSize:32,quantitativeScaleLength:475,tooltipSettings:{enableCaptionTooltip:!1,captionTemplate:null,visible:!0,template:null},quantitativeScaleSettings:{location:{x:10,y:10},minimum:0,maximum:10,interval:1,minorTicksPerInterval:4,majorTickSettings:{size:13,stroke:null,width:2},minorTickSettings:{size:7,stroke:null,width:2},tickPosition:"far",tickPlacement:"outside",labelSettings:{labelPlacement:"outside",labelPrefix:"",labelSuffix:"",stroke:null,size:12,offset:15,font:{fontFamily:"Segoe UI",fontStyle:"Normal ",fontWeight:"regular",opacity:1},position:"below"},featuredMeasureSettings:{stroke:null,width:6},comparativeMeasureSettings:{stroke:null,width:5},featureMeasures:[{value:null,comparativeMeasureValue:null,category:null}]},fields:{dataSource:null,query:null,tableName:null,category:null,featureMeasures:null,comparativeMeasure:null},enableAnimation:!0,enableResizing:!0,isResponsive:!0,applyRangeStrokeToTicks:!1,applyRangeStrokeToLabels:!1,qualitativeRanges:[{rangeEnd:4.3,rangeStroke:null,rangeOpacity:1},{rangeEnd:7.3,rangeStroke:null,rangeOpacity:1},{rangeEnd:10,rangeStroke:null,rangeOpacity:1}],captionSettings:{enableTrim:!0,textPosition:"float",textAlignment:"Near",textAnchor:"start",padding:5,textAngle:0,location:{x:17,y:30},text:"",font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"regular",opacity:1},subTitle:{textPosition:"float",textAlignment:"Near",textAnchor:"start",padding:5,textAngle:0,text:"",location:{x:10,y:45},font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal ",size:"12px",fontWeight:"regular",opacity:1}},indicator:{textPosition:"float",textAlignment:"Near",textAnchor:"start",padding:5,visible:!1,textAngle:0,textSpacing:3,text:"",symbol:{border:{color:null,width:1},color:null,shape:"",imageURL:"",size:{width:10,height:10},opacity:1},location:{x:10,y:60},font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal ",size:"12px",fontWeight:"regular",opacity:1}}},load:"",drawTicks:null,drawLabels:null,drawCaption:null,drawIndicator:null,drawQualitativeRanges:null,drawFeatureMeasureBar:null,drawCategory:null,drawComparativeMeasureSymbol:null},observables:["value","comparativeMeasureValue"],value:t.util.valueFunction("value"),comparativeMeasureValue:t.util.valueFunction("comparativeMeasureValue"),dataTypes:{quantitativeScaleSettings:{labelSettings:"data",featureMeasures:"array"},fields:{dataSource:"data",query:"data"},qualitativeRanges:"array",captionSettings:"data",isResponsive:"boolean"},_init:function(){this._renderBulletGraph()},_isSVG:function(){return window.SVGSVGElement?!0:!1},_value:t.util.valueFunction("value"),_comparativeMeasureValue:t.util.valueFunction("comparativeMeasureValue"),_qualitativeRanges:function(){this.redraw();this._trigger("refresh")},_quantitativeScaleSettings_featureMeasures:function(){this.redraw();this._trigger("refresh")},_renderBulletGraph:function(){this._isSVG()&&(this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this._trigger("load"),this._setSvgSize(this),this._setTheme(t.datavisualization.BulletGraph.Themes,this.model.theme),this.bindEvents(),this._renderBulletElements(),this.model.enableAnimation&&this._animateMeasures())},_animateMeasures:function(){this._doAnimation();this._doLineAnimation()},_setSvgSize:function(i){var r=i,o=n(r.element).height(),f=90,u=t.isTouchDevice()?250:595,e=n(r.element).width();r.model.width?u=parseInt(r.model.width):e>0&&e<595?u=e:e>595&&(u=595);n(r.svgObject).width(u);r.model.height?f=parseInt(r.model.height):o>0?f=o:n(r.svgObject).css("display","block");n(r.svgObject).height(f);r.svgObject.width=u;r.svgObject.height=f},_renderBulletElements:function(){var f=this.model.width?this.model.width:595,e=this.model.height?this.model.height:90,i;this.svgObject.setAttribute("viewBox","0 0 "+f+" "+e);this.svgObject.setAttribute("preserveAspectRatio","xMinYMin");this.svgWidth=n(this.svgObject).width();this.svgHeight=n(this.svgObject).height();var r=this.svgRenderer.createGroup({id:this.svgObject.id+"_captionGroup"}),t=this.svgRenderer.createGroup({id:this.svgObject.id+"_scaleGroup"}),u=this.svgRenderer.createGroup({id:this.svgObject.id+"_outerWrap"});this._initializeValues();i=this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/this._scale.interval);this._drawCaption();this._drawIndicator();this._drawCaptionGroup(r);this._scaleGroup=t;this._drawScale(r,t);this._drawQualitativeRanges(t);this._drawMajorTicks(i,t);this._drawMinorTicks(i,t);this._drawLabels(i,t);this._bindData();n(t).appendTo(u);n(r).appendTo(u);this._changeOrientation(t);n(u).appendTo(this.svgObject);n(this.svgObject).appendTo(this.element);this._bindHighlightRemoving()},_bindHighlightRemoving:function(){var t=this.model.browserInfo.isMSPointerEnabled,i=this.model.browserInfo.pointerEnabled;touchStartOut=t?i?"pointerout":"MSPointerOut":"touchout mouseout";this._on(n("[id*="+this.svgObject.id+"_FeatureMeasure_]"),touchStartOut,function(t){this.isTouch(t)||n(t.target).attr("opacity",1)})},_drawCaptionGroup:function(n){var u=this.model.captionSettings,f=u.subTitle,r=this._indicator?this._indicator.settings:u.indicator,c,b,k,l,a,v;u._location=f._location=r._location=c;var y=u.textPosition.toLowerCase()!="float"&&u.text!="",p=f.textPosition.toLowerCase()!="float"&&f.text!="",w=r.visible&&r.textPosition.toLowerCase()!="float";if(y||p||w){b=t.EjSvgRender.utils._measureText(u.text,null,u.font);k=t.EjSvgRender.utils._measureText(f.text,null,f.font);r.visible&&(l=this._indicator.bounds,v={width:r.symbol.size.width+l.width+r.textSpacing,height:Math.max(r.symbol.size.height,l.height)},a={x:0,y:0,width:v.width,height:v.height,padding:r.padding,anchor:r.textAnchor.toLowerCase(),alignment:r.textAlignment.toLowerCase()});var d={x:0,y:0,width:b.width,height:parseFloat(u.font.size),padding:u.padding,anchor:u.textAnchor.toLowerCase(),alignment:u.textAlignment.toLowerCase()},g={x:0,y:0,width:k.width,height:parseFloat(f.font.size),padding:f.padding,anchor:f.textAnchor.toLowerCase(),alignment:f.textAlignment.toLowerCase()},tt={x:this._scale.location.x,y:this._scale.location.y,width:this.model.quantitativeScaleLength,height:this.model.qualitativeRangeSize},nt=[y?u:null,p?f:null,w?r:null];this._positionTextGroup(nt,[d,g,a],tt);this._locateTextGroup(nt,[d,g,a])}var e=u._location==i?u.location:u._location,o=f._location==i?f.location:f._location,s=r._location==i?r.location:r._location;if(u.displayText=u.text,u.enableTrim==!0&&(e.x=e.x<0?0:e.x,e.y=e.y<0?0:e.y,u.displayText=this._displayText(u,e)),f.text!=""&&(f.displayText=f.text,u.enableTrim==!0&&(o.x=o.x<0?0:o.x,o.y=o.y<0?0:o.y,f.displayText=this._displayText(f,o))),r.visible){r.displayText=r.text;this.model.captionSettings.enableTrim==!0&&(s.x=s.x<0?0:s.x,s.y=s.y<0?0:s.y);var c=r._location?r._location:r.location,h={x:c.x+r.symbol.size.width/2,y:c.y-r.symbol.size.height/2,width:r.symbol.size.width,height:r.symbol.size.height},it=this._indicatorTextOptions(r,h,this._indicator.bounds,this.svgObject.id+"_Indicator"),rt=this._indicatorSymbolOptions(n,r);this._drawBulletSymbol(this._indicator.settings.symbol.shape,h,rt,n);this.model.captionSettings.enableTrim==!0&&(r.displayText=this._displayText(r,h))}u.displayText=u.textPosition.toLowerCase()!="float"?this._captionOverlap(this.model.captionSettings):u.displayText;this.svgRenderer.drawText(this._textOptions(u,this.svgObject.id+"_Caption"),u.displayText,n);f.text!=""&&(f.displayText=f.textPosition.toLowerCase()!="float"?this._subOverlap(this.model.captionSettings.subTitle):f.displayText,this.svgRenderer.drawText(this._textOptions(f,this.svgObject.id+"_SubTitle"),f.displayText,n));r.visible&&(r.displayText=r.textPosition.toLowerCase()!="float"?this._indOverlap(r,h):r.displayText,this.svgRenderer.drawText(it,r.displayText,n))},_captionOverlap:function(n){var t;return n.textPosition==n.subTitle.textPosition&&n.textAlignment==n.subTitle.textAlignment&&n.textAngle>0&&n.textAngle<120?t=n.subTitle._location.y-n._location.y:n.textPosition==n.indicator.textPosition&&n.textAlignment==n.indicator.textAlignment&&n.textAngle>0&&n.textAngle<120?t=n.indicator._location.y-n._location.y:n.textPosition==n.subTitle.textPosition&&n._location.y<n.subTitle._location.y&&n.textAngle>0&&n.textAngle<180?t=n.subTitle._location.y-n._location.y:n.textPosition==n.subTitle.textPosition&&n._location.y>n.subTitle._location.y&&n.textAngle>190&&n.textAngle<360?t=n._location.y-n.subTitle._location.y:n.textPosition==n.indicator.textPosition&&n._location.y<n.indicator._location.y&&n.textAngle>0&&n.textAngle<180?t=n.indicator._location.y-n._location.y:n.textPosition==n.indicator.textPosition&&n._location.y>n.indicator._location.y&&n.textAngle>190&&n.textAngle<360&&(t=n._location.y-n.indicator._location.y),this._trim(n.displayText,n,t,isRotate=!0)},_indOverlap:function(n,t){var u,i=this.model.captionSettings.subTitle,r=this.model.captionSettings;return n.textPosition==i.textPosition&&n.textAlignment==i.textAlignment&&n.textAngle>190&&n.textAngle<360?u=t.y-i._location.y:n.textPosition==r.textPosition&&n.textAlignment==r.textAlignment&&n.textAngle>190&&n.textAngle<360?u=t.y-r._location.y:n.textPosition==i.textPosition&&n._location.y<i._location.y&&n.textAngle>0&&n.textAngle<180?u=i._location.y-n._location.y:n.textPosition==i.textPosition&&n._location.y>i._location.y&&n.textAngle>190&&n.textAngle<360?u=n._location.y-i._location.y:n.textPosition==r.textPosition&&n._location.y<r._location.y&&n.textAngle>0&&n.textAngle<180?u=r._location.y-n._location.y:n.textPosition==r.textPosition&&n._location.y>r._location.y&&n.textAngle>190&&n.textAngle<360&&(u=n._location.y-r._location.y),this._trim(n.displayText,n,u,isRotate=!0)},_subOverlap:function(n){var r,t=this.model.captionSettings.indicator,i=this.model.captionSettings;return n.textPosition==t.textPosition&&n.textAlignment==t.textAlignment&&n.textAngle>0&&n.textAngle<180?r=t._location.y-n._location.y:n.textPosition==i.textPosition&&n.textAlignment==i.textAlignment&&n.textAngle>190&&n.textAngle<360?r=n._location.y-i._location.y:n.textPosition==t.textPosition&&n._location.y<t._location.y&&n.textAngle>0&&n.textAngle<180?r=t._location.y-n._location.y:n.textPosition==t.textPosition&&n._location.y>t._location.y&&n.textAngle>190&&n.textAngle<360?r=n._location.y-t._location.y:n.textPosition==i.textPosition&&n._location.y<i._location.y&&n.textAngle>0&&n.textAngle<180?r=i._location.y-n._location.y:n.textPosition==i.textPosition&&n._location.y>i._location.y&&n.textAngle>190&&n.textAngle<360&&(r=n._location.y-i._location.y),this._trim(n.displayText,n,r,isRotate=!0)},rotatedLabel:function(n,i,r,u){var f={"font-size":n.size,transform:"rotate("+r+",0,0)","font-family":n.fontFamily,"font-style":n.fontStyle,rotateAngle:"rotate("+r+"deg)","text-anchor":"middle"},e=i.svgRenderer.createText(f,u);return Math.ceil(t.EjSvgRender.utils._measureBounds(e,i).width)},calcGap:function(n,t,i,r,u,f,e){var o;return n>=0&&n<=90?r+t.y>=e&&n>0?(o=e-t.y,u=!0):r+t.y<=e&&i+t.x>=f&&n>0?o=f-t.x:r+t.y<=e&&n>0?(o=e-t.y,u=!0):o=f-t.x:n>90&&n<180?r+t.y>=e?(o=e-t.y,u=!0):r+t.y<=e&&i+t.x>=f?o=t.x:i+t.x<=f?o=t.x:(o=e-t.y,u=!0):n>=180&&n<270?t.x-i>=0?(o=t.y,u=!0):t.y-r<=0&&t.x-i<=0?o=t.x:t.y-r<=0?(o=e-t.y,u=!0):o=t.x:i+t.x<=f?(o=t.y,u=!0):t.y-r>=0&&i+t.x>=f?o=f-t.x:i+t.x>=f?o=f-t.x:(o=t.y,u=!0),{trimSize:o,rotate:u}},_scaleLoc:function(){var o=this._scale,u=o.labelSettings.offset,i=o.majorTickSettings.size,n,e,s=this._scale.labelSettings,h=t.EjSvgRender.utils._measureText(s.labelPrefix+o.maximum+s.labelSuffix,null,s),f=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?h.height:h.width,r,c;n=o.location.y;r=this.model.qualitativeRangeSize;c=this._tickPosition+this._tickPlacement+this._labelPosition+this._labelPlacement;this._tickPosition=="center"&&(i=i>r&&(i-r)/2);switch(c){case"faroutsidebelowoutside":e=n+f+r+u+(i>u&&i-u);break;case"faroutsidebelowinside":e=n+i+r;n=n-(u+f>r&&u+f-r);break;case"faroutsideaboveoutside":e=n+i+r;n=n-(u+f);break;case"faroutsideaboveinside":e=n+i+r+(u+f>r+i?u+f-(r+i):0);break;case"farinsidebelowoutside":e=n+f+r+u;n=n-(i>r&&i-r);break;case"farinsidebelowinside":e=n+r;n=n-(i>r&&i-r)-(u+f>r+i&&u+f-i);break;case"farinsideaboveoutside":e=n+r;n=n-(u+f)-(i>u+f+r&&i-(u+f+r));break;case"farinsideaboveinside":e=n+r+(u+f>r&&f+u-r);n=n-(i>r&&i-r);break;case"nearoutsidebelowoutside":e=n+r+u+f;n=n-i;break;case"nearoutsidebelowinside":e=n+r;n=n-i-(u+f>r+i&&u+f-(r+i));break;case"nearoutsideaboveoutside":e=n+r;n=n-i-(i<u+f&&u+f-i);break;case"nearoutsideaboveinside":e=n+r+(u+f>r&&u+f-r);n=n-i;break;case"nearinsidebelowoutside":e=n+r+(i>u+f+r?i-r:u+f);break;case"nearinsidebelowinside":e=n+r+(i>r&&i-r);n=n-(u+f>r&&u+f-r);break;case"nearinsideaboveoutside":e=n+(i>r?i:r);n=n-u-f;break;case"nearinsideaboveinside":e=n+r+(i>f+u?i-r:f+u-r);break;case"centeroutsidebelowoutside":e=n+r+(i>u+f?i:u+f);n=n-i;break;case"centeroutsidebelowinside":e=n+r+i;n=n-i-(u+f>r+i&&u+f-(r+i));break;case"centeroutsideaboveoutside":e=n+r+i;n=n-i-(i<u+f&&u+f-i);break;case"centeroutsideaboveinside":e=n+r+(u+f>r+i?u+f-r-i:i);n=n-i;break;case"centerinsidebelowoutside":e=n+r+(i>u+f?i:u+f);n=n-i;break;case"centerinsidebelowinside":e=n+r+i;n=n-(u+f-r>i?u+f-r:i);break;case"centerinsideaboveoutside":e=n+r+i;n=n-i-(i<u+f&&u+f-i);break;case"centerinsideaboveinside":e=n+r+(i>f+u?i:f+u-r);n=n-i}return{x:o.location.x,y:n,height:e}},_displayText:function(i,r){var f=n.extend(!0,r),e=i.textAngle%360,y=i.text,w=i.font,a=this._scale,p=this._scale.labelSettings,b=t.EjSvgRender.utils._measureText(p.labelPrefix+a.minimum+p.labelSuffix,null,p).width,k=t.EjSvgRender.utils._measureText(y,null,w).width,d=t.EjSvgRender.utils.rotatedLabel(i,this,e,i.text),v=this.rotatedLabel(w,this,e,i.text),o,s=this.svgHeight,h=this.svgWidth,l=!1,u=this._scaleLoc(),c,g;return i.textSpacing&&(k=k+i.textSpacing,v=v+i.textSpacing),this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?(f.x<=u.x&&u.y<=f.y&&f.y<=u.height?h=a.location.x-b/2:f.x<=u.x&&f.y<=u.y&&e<90?s=u.y:f.x>=u.x&&f.x<=u.x+this.model.quantitativeScaleLength&&f.y<=u.y?s=u.y:f.y<=u.y&&f.x>=u.x+this.model.quantitativeScaleLength&&e>=90?s=u.y:f.x>=u.x+this.model.quantitativeScaleLength&&u.y<=f.y&&f.y<=u.height&&e<270?(h=h-(u.x+this.model.quantitativeScaleLength),f.x=f.x-(u.x+this.model.quantitativeScaleLength)):f.x<=u.x&&f.y>=u.height&&e>270?f.y=f.y-u.height:f.x>=u.x&&f.x<=u.x+this.model.quantitativeScaleLength&&f.y>=u.height?f.y=f.y-u.height:f.x>=u.x+this.model.quantitativeScaleLength&&f.y>=u.height&&e>=180&&e<270&&(f.y=f.y-u.height),o=this.calcGap(e,f,v,d,l,h,s),l=o.rotate,o=o.trimSize):(c=u.height-u.y,u.y=this.svgHeight-a.location.y-this.model.quantitativeScaleLength,u.height=u.y+this.model.quantitativeScaleLength,f.x<=u.x&&u.y<=f.y&&f.y<=u.height?h=a.location.x-b/2:f.x<=u.x&&f.y<=u.y&&e<90?s=u.y:f.x>=u.x&&f.x<=u.x+c&&f.y<=u.y?s=u.y:f.y<=u.y&&f.x>=u.x+c&&e>=90?s=u.y:f.x>=u.x+c&&u.y<=f.y&&f.y<=u.height&&e<=260?(h=h-(u.x+c),f.x=f.x-(u.x+c)):f.x<=u.x&&f.y>=u.height&&e>=280?f.y=f.y-u.height:f.x>=u.x&&f.x<=u.x+c&&f.y>=u.height?f.y=f.y-u.height:f.x>=u.x+c&&f.y>=u.height&&e>=180&&e<=260&&(f.y=f.y-u.height),o=this.calcGap(e,f,v,d,l,h,s),l=o.rotate,o=o.trimSize),g=y,this._trim(y,i,o,l)},_trim:function(n,i,r,u){var f=n,h=this.rotatedLabel(i.font,this,i.textAngle,n),s=t.EjSvgRender.utils._measureText(n,null,i.font).width,o,e,c;if(i.textSpacing&&(s=s+i.textSpacing,h=h+i.textSpacing),s>r&&n!=""){for(e=1;e<=n.toString().length;e++)if(n=f.toString().substring(0,e)+"... ",o=u==!0?t.EjSvgRender.utils.rotatedLabel(i,this,i.textAngle,n):t.EjSvgRender.utils._measureText(n,null,i.font).width,i.textSpacing&&(o=o+i.textSpacing),o>=r){n=n.toString().substring(0,e-1)+"... ";f=n;break}c=f.toString(0,n.toString.lenght-4);c!=f&&(f=n)}return f},_getVerticalScaleLocation:function(n){return{x:this._scale.location.y,y:this.svgHeight-this._scale.location.x-n}},_horizontalTextPositioning:function(n,i,r,u,f){var h=n.textPosition.toLowerCase(),e=i.alignment,r=this._scaleLoc(),o=this._scale.labelSettings,s=t.EjSvgRender.utils._measureText(o.labelPrefix+this._scale.maximum+o.labelSuffix,null,o).width;switch(h){case"left":i.x=r.x-i.width-i.padding-s/2;i.y=r.y+(e=="center"?u.height/2+i.height/3:e=="far"?u.height:i.height);f[0].push(i);break;case"right":i.x=r.x+u.width+i.padding+s/2;i.y=r.y+(e=="center"?u.height/2+i.height/3:e=="far"?u.height:i.height);f[1].push(i);break;case"top":i.x=e=="center"?u.x+u.width/2-i.width/2:e=="near"?u.x:u.x+u.width-i.width;i.y=r.y-i.padding;f[2].push(i);break;case"bottom":i.x=e=="center"?u.x+u.width/2-i.width/2:e=="near"?u.x:u.x+u.width-i.width;i.y=r.height+i.height/2+i.padding;f[3].push(i)}},_VerticalTextPositioning:function(n,t,i,r,u){var o=n.textPosition.toLowerCase(),f=t.alignment,e=this._scaleLoc();switch(o){case"left":t.x=e.y-t.width-t.padding;t.y=i.y+(f=="center"?r.height/2+t.height/3:f=="far"?r.height:t.height);this._tickPosition=="near"&&this._tickPlacement=="inside"&&this._labelPosition=="above"&&this._labelPlacement=="inside"&&(t.x+=this._scale.majorTickSettings.size);u[0].push(t);break;case"right":t.x=e.height+t.padding;t.y=i.y+(f=="center"?r.height/2+t.height/3:f=="far"?r.height:t.height);u[1].push(t);break;case"top":t.x=r.x-t.width/2+(f=="center"?r.width/2:f=="far"&&r.width);t.y=r.y-t.padding;u[2].push(t);break;case"bottom":t.x=r.x-t.width/2+(f=="center"?r.width/2:f=="far"&&r.width);t.y=r.y+r.height+t.height+t.padding-t.height/3+this._scale.labelSettings.size/2;u[3].push(t)}},_positionTextGroup:function(n,t,i){for(var f=[[],[],[],[]],e=this._orientation=="horizontal",u=e?this._scaleLocation:this._getVerticalScaleLocation(i.width),o=e?i:{x:u.x,y:u.y,width:i.height,height:i.width},r=0;r<n.length;r++)n[r]&&(e?this._horizontalTextPositioning(n[r],t[r],u,o,f):this._VerticalTextPositioning(n[r],t[r],u,o,f));this._avoidElementsOverlapping(f)},_avoidElementsOverlapping:function(n){for(var t,f,r,i,u=0;u<n.length;u++){t=n[u];f=!1;do for(r=0;r<t.length;r++)for(i=r-1;i>=0;i--)if(this._isOverlapping(t[r],t[i])){switch(u){case 0:case 1:t[i].y>t[r].y?t[i].y=t[r].y+t[i].height+(t[i].padding>1?t[i].padding:1):t[r].y=t[i].y+t[r].height+(t[r].padding>1?t[r].padding:1);break;case 2:t[i].y=t[r].y-t[r].height-(t[i].padding>1?t[i].padding:1);break;default:t[r].y=t[i].y+t[i].height+(t[i].padding>1?t[i].padding:1)}f=!0;break}else f=!1;while(f)}this._applyLeftRightAnchor([n[0],n[1]]);this._applyTopBottomAnchor([n[2],n[3]])},_locateTextGroup:function(n,t){for(var i=0;i<n.length;i++)n[i]&&(n[i]._location={x:0,y:0},n[i]._location.x=t[i].x,n[i]._location.y=t[i].y)},_applyLeftRightAnchor:function(n){for(var i,r,t,f,u=0;u<n.length;u++){for(i=n[u],r=0,t=0;t<i.length;t++)r=Math.max(r,i[t].width);for(t=0;t<i.length;t++)f=i[t].anchor,i[t].x+=f=="start"?u==0&&i[t].width-r:f=="middle"?u==0?(i[t].width-r)/2:(r-i[t].width)/2:u!=0&&r-i[t].width}},_applyTopBottomAnchor:function(n){for(var t,r=0;r<n.length;r++){var u=[],f=[],e=[],i=n[r];for(t=0;t<i.length;t++)i[t].alignment=="near"?u.push(i[t]):i[t].alignment=="far"?f.push(i[t]):e.push(i[t]);this._applyNearAnchor(u);this._applyCenterAnchor(e);this._applyFarAnchor(f)}},_applyNearAnchor:function(n){var i,t;if(n.length>1){for(i=0,t=0;t<n.length;t++)i=Math.max(i,n[t].width);for(t=0;t<n.length;t++)n[t].x+=n[t].anchor=="start"?this._orientation=="vertical"&&(n[t].width-i)/2:n[t].anchor=="middle"?this._orientation=="horizontal"&&(i-n[t].width)/2:this._orientation=="horizontal"?i-n[t].width:(i-n[t].width)/2}},_applyCenterAnchor:function(n){var i,t;if(n.length>1){for(i=0,t=0;t<n.length;t++)i=Math.max(i,n[t].width);for(t=0;t<n.length;t++)n[t].anchor=="start"?n[t].x+=(n[t].width-i)/2:n[t].anchor=="end"&&(n[t].x+=(i-n[t].width)/2)}},_applyFarAnchor:function(n){var i,t;if(n.length>1){for(i=0,t=0;t<n.length;t++)i=Math.max(i,n[t].width);for(t=0;t<n.length;t++)n[t].anchor=="start"?n[t].x+=this._orientation=="horizontal"?n[t].width-i:(n[t].width-i)/2:n[t].anchor=="middle"?n[t].x+=this._orientation=="horizontal"&&(n[t].width-i)/2:n[t].anchor=="end"&&(n[t].x+=this._orientation=="vertical"&&(i-n[t].width)/2)}},_isOverlapping:function(n,t){return!(n.x+n.width<t.x||n.x>t.x+t.width||n.y-n.height>t.y||n.y<t.y-t.height)},_initializeValues:function(){this._scale=this.model.quantitativeScaleSettings;this._labelPosition=this._scale.labelSettings.position.toLowerCase();this._tickPosition=this._scale.tickPosition.toLowerCase();this._flowDirection=this.model.flowDirection.toLowerCase();this._orientation=this.model.orientation.toLowerCase();this._tickPlacement=this._scale.tickPlacement.toLowerCase();this._labelPlacement=this._scale.labelSettings.labelPlacement.toLowerCase()},_changeOrientation:function(n){this._orientation==t.datavisualization.BulletGraph.Orientation.Vertical&&n.setAttribute("transform","translate(0,"+this.svgHeight+")rotate(-90)")},_setModel:function(i){var f=!0,r,u;for(r in i){this.model.enableAnimation=!1;switch(r){case"height":this.model.height=i[r];break;case"width":this.model.width=i[r];break;case"theme":this.model.theme=i[r];this._setTheme(t.datavisualization.BulletGraph.Themes,this.model.theme);break;case"orientation":this.model.orientation=i[r];break;case"flowDirection":this.model.flowDirection=i[r];break;case"qualitativeRangeSize":this.model.qualitativeRangeSize=i[r];break;case"quantitativeScaleLength":this.model.quantitativeScaleLength=i[r];break;case"quantitativeScaleSettings":n.extend(!0,this.model.quantitativeScaleSettings,{},i[r]);break;case"applyRangeStrokeToTicks":this.model.applyRangeStrokeToTicks=i[r];break;case"applyRangeStrokeToLabels":this.model.applyRangeStrokeToLabels=i[r];break;case"qualitativeRanges":n.extend(!0,this.model.qualitativeRanges,{},i[r]);break;case"captionSettings":n.extend(!0,this.model.captionSettings,{},i[r]);break;case"dataSource":n.extend(!0,this.model.fields,{},i[r]);break;case"value":for(u=0;this.model.quantitativeScaleSettings.featureMeasures[u]!=null;u++)this.model.quantitativeScaleSettings.featureMeasures[u].value=parseFloat(this.value());break;case"comparativeMeasureValue":for(u=0;this.model.quantitativeScaleSettings.featureMeasures[u]!=null;u++)this.model.quantitativeScaleSettings.featureMeasures[u].comparativeMeasureValue=parseFloat(this.comparativeMeasureValue());break;case"enableAnimation":this.model.enableAnimation=i[r];this.model.enableAnimation&&(n(this.svgObject).empty(),this._renderBulletElements(),this._animateMeasures());f=!1}}f&&(n(this.svgObject).empty(),this._renderBulletElements())},_bindData:function(){t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?(this._dataCount=this._scale.featureMeasures.length,this._drawMeasures()):this.model.fields.dataSource instanceof t.DataManager?this._initDataSource():(this._dataCount=this.model.fields.dataSource.length,this._drawMeasures())},_drawMeasures:function(){this._drawFeatureMeasureBar();this._drawComparativeMeasureSymbol()},_initDataSource:function(){var t=this._columnToSelect(this.model.fields),n=this,i=this.model.fields.dataSource.executeQuery(t);i.done(function(t){n.model.fields.dataSource=t.result;n._dataCount=t.result.length;n._drawFeatureMeasureBar();n._drawComparativeMeasureSymbol();n._bindHighlightRemoving()})},_columnToSelect:function(n){var u=[],r=t.Query(),i;if(t.isNullOrUndefined(n.query)){for(i in n)i!=="tableName"&&i!=="query"&&i!=="dataSource"&&u.push(n[i]);u.length>0&&r.select(u);this.model.fields.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||r.from(n.tableName)}else r=n.query;return r},_drawCaption:function(){if(this.model.drawCaption){var t={font:this.model.captionSettings.font,location:this.model.captionSettings.location,subTitle:this.model.captionSettings.subTitle,text:this.model.captionSettings.text,textAngle:this.model.captionSettings.textAngle};this._trigger("drawCaption",t);this.model.captionSettings=n.extend(this.model.captionSettings,t)}},_drawBulletSymbol:function(n,i,r,u){var e="M "+(i.x-i.width/2+i.width)+" "+(i.y+i.height/4)+" L "+(i.x-i.width/2+i.width)+" "+(i.y+-i.height/4)+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+-i.height/4)+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x-i.width/2)+" "+i.y+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+i.height/4)+" L "+(i.x-i.width/2+i.width)+" "+(i.y+i.height/4),o,l,a,v,s,y,p,f,d,g,h;switch(n.toLowerCase()){case"circle":o=Math.min(i.height,i.width)/2;r.cx=i.x;r.cy=i.y;r.r=o;this.svgRenderer.drawCircle(r,u);break;case"leftarrow":r.d=e;this.svgRenderer.drawPath(r,u);break;case"rightarrow":r.d=e;r.transform="rotate(180,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"uparrow":r.d=e;r.transform="rotate(90,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"downarrow":r.d=e;r.transform="rotate(-90,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"cross":l="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+i.y+" M "+i.x+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2);r.d=l;r.stroke=r.stroke?r.stroke:r.fill;this.svgRenderer.drawPath(r,u);break;case"horizontalline":a="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+i.y;r.d=a;r.stroke=r.stroke?r.stroke:r.fill;this.svgRenderer.drawPath(r,u);break;case"verticalline":v="M "+i.x+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2);r.d=v;r.stroke=r.stroke?r.stroke:r.fill;this.svgRenderer.drawPath(r,u);break;case"triangle":s="M "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" Z";r.d=s;this.svgRenderer.drawPath(r,u);break;case"invertedtriangle":s="M "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" Z";r.d=s;r.transform="rotate(180,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"hexagon":y="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+-i.width/4)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/4)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+i.y+" L "+(i.x+i.width/4)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/4)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=y;this.svgRenderer.drawPath(r,u);break;case"wedge":p="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/4)+" "+i.y+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=p;this.svgRenderer.drawPath(r,u);break;case"pentagon":var o=Math.sqrt(i.height*i.height+i.width*i.width)/2,c=t.EjSvgRender.utils._getStringBuilder();for(f=0;f<=5;f++){var nt=f*72,w=Math.PI/180*nt,b=o*Math.cos(w),k=o*Math.sin(w);f==0?c.append("M "+(i.x+b)+" "+(i.y+k)+" "):c.append("L "+(i.x+b)+" "+(i.y+k)+" ")}r.d=c.toString();this.svgRenderer.drawPath(r,u);break;case"star":d="M "+(i.x+i.width/3)+" "+(i.y+-i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/6)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/6)+" L "+(i.x+-i.width/3)+" "+(i.y+-i.height/2)+" L "+i.x+" "+(i.y+i.height/2)+" L "+(i.x+i.width/3)+" "+(i.y+-i.height/2);r.d=d;this.svgRenderer.drawPath(r,u);break;case"rectangle":g="M "+(i.x+-i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+-i.height/2);r.d=g;this.svgRenderer.drawPath(r,u);break;case"trapezoid":h="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+-i.width/2)+" "+(i.y+-i.height/4)+" L "+(i.x+-i.width/2+i.width)+" "+(i.y+-i.height/2)+" L "+(i.x+-i.width/2+i.width)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/4)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=h;this.svgRenderer.drawPath(r,u);break;case"diamond":h="M "+(i.x+-i.width/2)+" "+i.y+" L "+i.x+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+i.y+" L "+i.x+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=h;this.svgRenderer.drawPath(r,u);break;case"ellipse":r.cx=i.x;r.cy=i.y;r.rx=i.width/2;r.ry=i.height/2;this.svgRenderer.drawEllipse(r,u);break;case"image":r.x=i.x-i.width/2;r.y=i.y-i.height/2;r.width=i.width;r.height=i.height;r.href=this.model.captionSettings.indicator.symbol.imageURL;r.visibility="visible";this.svgRenderer.drawImage(r,u)}},_drawIndicator:function(){var i,r,u;this.model.captionSettings.indicator.visible&&(i=this.model.captionSettings.indicator,r=n.extend({},{indicatorSettings:this.model.captionSettings.indicator}),this.model.drawIndicator&&(this._trigger("drawIndicator",r),r.cancel==!1&&(i=r.indicatorSettings,this.model.captionSettings.indicator=i)),u=t.EjSvgRender.utils._measureText(i.text,null,i.font),this._indicator={bounds:u,settings:i})},_indicatorTextOptions:function(n,t,i,r){var u=n._location?n._location:n.location;return{"class":r,x:u.x+t.width+n.textSpacing,y:u.y-t.height/2+parseFloat(n.font.size)/3,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,"text-anchor":"start",opacity:n.font.opacity,transform:"rotate("+n.textAngle+","+t.x+","+t.y+")"}},_indicatorSymbolOptions:function(n,t){return{id:n.id+"_indicatorSymbol",stroke:t.symbol.border.color,fill:t.symbol.color,"stroke-width":t.symbol.border.width,opacity:t.symbol.opacity}},_textOptions:function(n,t){var i=n._location?n._location:n.location;return{"class":t,x:i.x,y:i.y,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,"text-anchor":"start",opacity:n.font.opacity,cursor:"default",transform:"rotate("+n.textAngle+","+i.x+","+i.y+")"}},_drawScale:function(n,i){var r=this._scale._location?this._scale._location:this._scale.location,u,f,e;u=this._tickPosition==t.datavisualization.BulletGraph.TickPosition.Far||this._tickPosition==t.datavisualization.BulletGraph.TickPosition.Center?this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below?r.y:r.y+this._scale.labelSettings.offset+this._scale.labelSettings.size:this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below?r.y+this._scale.majorTickSettings.size:r.y+this._scale.labelSettings.offset+this._scale.labelSettings.size+this._scale.majorTickSettings.size;f=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward?r.x:this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?r.x-this._scale.labelSettings.offset:r.x;e={id:this.svgObject.id+"_SvgScale",x:f,y:u,width:this.model.quantitativeScaleLength,height:this.model.qualitativeRangeSize,fill:"transparent","stroke-width":0};this.svgRenderer.drawRect(e,i)},_drawMajorTicks:function(n,i){var r,l,g=0,a=this._scale.location,p=this._tickPlacement=="inside",s=this._scale.location.x,w=this.model.quantitativeScaleLength,nt=this._scale.labelSettings.offset,b=this.model.qualitativeRangeSize,u=this._scale.majorTickSettings.width,v=this._scale.majorTickSettings.size,f=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,o=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,tt=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,e,y,d;r=o?f?s+u/2:s+w+u/2:f?s+w-u/2:s+u/2;l=this._tickPosition=="far"?a.y+b+(p?-v:0):this._tickPosition=="near"?a.y+(p?0:-v):a.y+b/2-v/2;var h=this._scale.minimum,c=this._scale.maximum,k=this._scale.interval;for(e=h;e<=c;e+=k)g++,e>=c&&(f&&!o?r+=u:r-=u),!f&&o&&(r=e>=c?r+u:e==h?r-u:r),this.model.applyRangeStrokeToTicks&&(strokeColor=this._bindingRangeStrokes(r-u/2)),y=this._majorTickLines(this._scale,r,l),!f&&o&&e==h&&(r=r+u),this.model.drawTicks&&(data={majorTickSettings:this._scale.majorTickSettings,minorTickSettings:this._scale.minorTickSettings,minorTicksPerInterval:this._scale.minorTicksPerInterval,maximum:c,minimum:h,interval:k},this._trigger("drawTicks",data),y=this._majorTickLines(data,r,l)),d=this.svgRenderer.createLine(y),r=!o&&f||o&&!f?r-n:r+n,i.appendChild(d)},_majorTickLines:function(n,t,i){return{x1:t,y1:i,x2:t,y2:i+n.majorTickSettings.size,"stroke-width":n.majorTickSettings.width,stroke:this.model.applyRangeStrokeToTicks&&strokeColor?strokeColor:n.majorTickSettings.stroke}},_forwardStrokeBinding:function(n){if(n>=this._scale.location.x&&n<=this._rangeCollection[0]+this._scale.location.x)return this.model.qualitativeRanges[0].rangeStroke;for(var t=0;t<=this._rangeCollection.length-1;t++)if(n>=this._rangeCollection[t]+this._scale.location.x&&n<=this._rangeCollection[t+1]+this._scale.location.x)return this.model.qualitativeRanges[t+1].rangeStroke},_backwardStrokeBinding:function(t){if(t>=this._rangeCollection[this._rangeCollection.length-1])return this.model.qualitativeRanges[0].rangeStroke;for(k=0;k<=this._rangeCollection.length-1;k++)if(t>=this._rangeCollection[k]&&t<this._rangeCollection[k+1]){var i=n.inArray(this._rangeCollection[k],this._rangeCollection);return this.model.qualitativeRanges[this._rangeCollection.length-1-i].rangeStroke}},_bindingRangeStrokes:function(n){if(this._rangeCollection.length==1){if(n>=this._scale.location.x&&n<=this._rangeCollection[0]+this._scale.location.x)return this.model.qualitativeRanges[0].rangeStroke}else return this.model.orientation==t.datavisualization.BulletGraph.Orientation.Horizontal&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward||this.model.orientation==t.datavisualization.BulletGraph.Orientation.Vertical&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Backward?this._forwardStrokeBinding(n):this._backwardStrokeBinding(n)},_drawMinorTicks:function(i,r){var h,c,s,p,u,g=0,e=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,f=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,nt=this._tickPlacement=="inside",o=this._scale.location.x,tt=this.model.qualitativeRangeSize,et=this._scale.labelSettings.offset,ot=this._scale.majorTickSettings.size,l=this._scale.minorTickSettings.size,it=this._scale.minorTickSettings.width,b=this.model.quantitativeScaleLength,d,k,w,v,y;h=e?f?o:o+b:f?o+b-it/2:o;switch(this._tickPosition){case"far":s=this._scale.location.y+tt;p=s+(nt?-l:l);break;case"near":s=this._scale.location.y+(nt?l:-l);p=this._scale.location.y;break;default:s=this._scale.location.y+tt/2-l/2;p=s+l}var rt=this._scale.maximum,ut=this._scale.minimum,ft=this._scale.interval,a=this._scale.minorTicksPerInterval;for(d=ut;d<=rt;d+=ft){for(c=i/a,k=1;k<=a;k++)g++,u=!f&&e||f&&!e?h-c+c/(a+1):h+c-c/(a+1),!e&&f&&g>=(rt-ut)*a&&(u+=it/2),this.model.applyRangeStrokeToTicks&&(strokeColor=this._bindingRangeStrokes(u)),w=this._minorTickLines(this._scale,u,s,p),this.model.drawTicks&&(data={majorTickSettings:this._scale.majorTickSettings,minorTickSettings:this._scale.minorTickSettings,minorTicksPerInterval:this._scale.minorTicksPerInterval,maximum:this._scale.maximum,minimum:this._scale.minimum,interval:this._scale.interval},this._trigger("drawTicks",data),this._scale=n.extend(this._scale,data),w=this._minorTickLines(data,u,s,p)),!e&&f?(v=b+o+1,u<=v&&u>=o+1&&(y=this.svgRenderer.createLine(w),r.appendChild(y))):e&&!f?(v=o+1,u>=v&&(y=this.svgRenderer.createLine(w),r.appendChild(y))):(v=b+o+1,u<=v&&(y=this.svgRenderer.createLine(w),r.appendChild(y))),c=i/a*(k+1);h=!e&&f||e&&!f?h-i:h+i}},_minorTickLines:function(n,t,i,r){return{x1:t,y1:i,x2:t,y2:r,"stroke-width":n.minorTickSettings.width,stroke:this.model.applyRangeStrokeToTicks&&strokeColor?strokeColor:n.minorTickSettings.stroke}},_drawLabels:function(n,i){var o,l,d=this.model.locale,rt=d&&this.model.enableGroupSeparator,g,nt=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,w=this._scale.location.x,f=this._scale.labelSettings.offset,tt=this.model.quantitativeScaleLength,ot=this._scale.majorTickSettings.width,c,e,y,p,k;o=nt?h?w:w+tt:h?w+tt:w;var it=this._tickPosition+this._labelPlacement,s=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,st=this._scale.location.y,b=this.model.qualitativeRangeSize,u=this._scale.labelSettings.size,ht=this._scale.majorTickSettings.size;switch(it){case"faroutside":case"centeroutside":l=s?this._scale.location.y+b+f+u:this._scale.location.y-f;break;case"farinside":case"centerinside":l=s?this._scale.location.y+b-f:this._scale.location.y+f+(h?u:0);break;case"nearoutside":l=s?this._scale.location.y+b+f+u:this._scale.location.y-f;break;case"nearinside":l=s?this._scale.location.y+b-f:this._scale.location.y+f+u}var ut=this._scale.minimum,ft=this._scale.maximum,et=this._scale.interval,ct=this._labelPlacement=="inside";for(c=ut;c<=ft;c+=et){var r=l,a=o,v=this._scale.labelSettings.font;if(v.size=u,e={width:0,height:0},h)transformText="rotate(0,"+a+","+r+")";else{y=this._scale.labelSettings.labelPrefix+c+this._scale.labelSettings.labelSuffix;switch(it){case"faroutside":case"centeroutside":s?r-=u:(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width);break;case"farinside":case"centerinside":s&&(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width);break;case"nearoutside":s?r-=u:(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width);break;case"nearinside":s?(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width):r-=u}a-=u/3;transformText="rotate(90,"+a+","+r+")"}this.model.applyRangeStrokeToLabels&&(strokeColor=this._bindingRangeStrokes(o));p=this._labelOptions(this.model.quantitativeScaleSettings.labelSettings,a,r);this.model.drawLabels&&(k={font:this._scale.labelSettings.font,labelPrefix:this._scale.labelSettings.labelPrefix,labelSuffix:this._scale.labelSettings.labelSuffix,offset:f,size:u,stroke:this._scale.labelSettings.stroke},this._trigger("drawLabels",k),p=this._labelOptions(k,a,r));o=nt?h?o+n:o-n:h?o-n:o+n;g=rt?c.toLocaleString(d):c;this.svgRenderer.drawText(p,p.labelPrefix+g+p.labelSuffix,i)}},_labelOptions:function(n,i,r){return{x:i,y:r,"text-anchor":this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?"middle":"start",fill:this.model.applyRangeStrokeToLabels&&strokeColor?strokeColor:n.stroke,"font-size":n.size+"px","font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,transform:transformText,labelPrefix:n.labelPrefix,labelSuffix:n.labelSuffix}},_drawQualitativeRanges:function(n){var c=this._scale.location.x,y=this._scale.location.y,e,a=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,o=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,p=this._scale.labelSettings.offset,s,h,f,v;this._rangeCollection=[];var w=this._tickPosition+this._labelPlacement,b=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,k=this.model.qualitativeRangeSize,l=this._scale.location.x,r=this._scale.minimum,i=this._scale.maximum,u=this.model.quantitativeScaleLength;for(s=this.model.qualitativeRanges.length-1;s>=0;s--)h={object:this,rangeIndex:s,rangeOptions:this.model.qualitativeRanges[s],rangeEndValue:this.model.qualitativeRanges[s].rangeEnd},this.model.drawQualitativeRanges&&this._trigger("drawQualitativeRanges",h),f=h.rangeEndValue,f=f>i?i:f,a?(c=o?l:l+(u-u/((i-r)/(i-r-(i-f)))),e=o?u/((i-r)/(i-r-(i-f))):u/((i-r)/(i-r-(i-f)))):(c=o?l+(u-u/((i-r)/(i-r-(i-f)))):l,e=o?u/((i-r)/(i-r-(i-f))):u/((i-r)/(i-r-(i-f)))),v={x:c,y:y,height:this.model.qualitativeRangeSize,width:e>0?e<u?e:u:0,fill:h.rangeOptions.rangeStroke,opacity:h.rangeOptions.rangeOpacity},o&&a||!o&&!a?this._rangeCollection.push(e):this._rangeCollection.push(c),this.svgRenderer.drawRect(v,n);this._rangeCollection.sort(this._sortRangeCollection)},_sortRangeCollection:function(n,t){return n-t},_calculateFeatureMeasureBounds:function(n,i){var o=this._scale.minimum,a,v;if(n=n<o&&o<0?o:n,n>=o){var u,h,r,f=this._scale.location.x,e=this.model.quantitativeScaleLength,s=this._scale.maximum-this._scale.minimum,c=this._scale.maximum-n,l=this._flowDirection.toLowerCase()+this._orientation.toLowerCase();i=i==null?"":i;a=this._scale.labelSettings.font;a.size=this._scale.labelSettings.size;v=t.EjSvgRender.utils._measureText(i.toString(),null,a).width;switch(l){case"forwardhorizontal":case"backwardvertical":u=f+(o>0?0:e/s*Math.abs(o));r=e/(s/(o>0?s-c:n));n<0&&(r=Math.abs(r),u-=r);r=u+r<f+e?r:f+e-u;h=f-(l=="forwardhorizontal"?v/2+this._scale.labelSettings.offset:this._scale.labelSettings.offset);break;default:u=f+(e-e/(s/(s-c)));r=o>0?e/(s/(s-c)):e/(s/n);n<0&&(r=Math.abs(r),u-=r);u<f&&(r=u+r-f,u=f);h=f+e+(l=="backwardhorizontal"?v/2+this._scale.labelSettings.offset:this._scale.labelSettings.offset)}return{pointX:u,Width:r,lPointX:h}}return!1},_drawFeatureMeasureBar:function(){var e=1,o,r,s,f,l=this.model.locale,v=l&&this.model.enableGroupSeparator,a=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null,y=this._orientation==t.datavisualization.BulletGraph.Orientation.Vertical,p=typeof this.model.value=="function"?this._value():this.model.value,n,i,h,c,u;if(this._dataCount>0)for(n=this._dataCount-1;n>=0;n--)o=a?this.model.fields.dataSource[n][this.model.fields.featureMeasures]:t.isNullOrUndefined(this._scale.featureMeasures[n].value)?p:this._scale.featureMeasures[n].value,r=a?this.model.fields.dataSource[n][this.model.fields.category]:this._scale.featureMeasures[n].category,s=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*e/2-this._scale.featuredMeasureSettings.width/2,f=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*e/2+this._scale.featuredMeasureSettings.width/2-1,i=this._calculateFeatureMeasureBounds(o,r),i&&(h=this._featureBar(this._scale,i.pointX,s,i.Width,n),this.model.drawFeatureMeasureBar&&(u={featuredMeasureSettings:this._scale.featuredMeasureSettings},this._trigger("drawFeatureMeasureBar",u),h=this._featureBar(u,i.pointX,s,i.Width,n)),this.svgRenderer.drawRect(h,this._scaleGroup),transformText=y?"rotate(90,"+i.lPointX+","+(f-4)+")":"rotate(0,"+i.lPointX+","+f+")",c=this._drawcategory(this.model.quantitativeScaleSettings.labelSettings,i.lPointX,f),this.model.drawCategory&&(u={size:this.model.quantitativeScaleSettings.labelSettings.size,stroke:this.model.quantitativeScaleSettings.labelSettings.stroke,font:this.model.quantitativeScaleSettings.labelSettings.font,categoryValue:r},this._trigger("drawCategory",u),c=this._drawcategory(u,i.lPointX,f),r=u.categoryValue),t.isNullOrUndefined(r)||this.svgRenderer.drawText(c,v?r.toLocaleString(l):r,this._scaleGroup),e+=2,this.value(o))},_drawcategory:function(n,t,i){return{x:t,y:i+this._scale.featuredMeasureSettings.width/2,"text-anchor":"middle",fill:n.stroke,"font-size":n.size+"px","font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,transform:transformText}},_featureBar:function(n,t,i,r,u){return{"class":this.svgObject.id+"_FeatureMeasure",id:this.svgObject.id+"_FeatureMeasure_"+u,x:t,y:i,height:n.featuredMeasureSettings.width,width:r,fill:n.featuredMeasureSettings.stroke}},_drawComparativeMeasureSymbol:function(){var r=1,n,u,f,e,c=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,l=typeof this.model.comparativeMeasureValue=="function"?this._comparativeMeasureValue():this.model.comparativeMeasureValue,i,o,s;if(this._dataCount>0)for(i=this._dataCount-1;i>=0;i--)n=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource[i][this.model.fields.comparativeMeasure]:t.isNullOrUndefined(this._scale.featureMeasures[i].comparativeMeasureValue)?l:this._scale.featureMeasures[i].comparativeMeasureValue,n>=this._scale.minimum&&n<=this._scale.maximum&&(u=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*r/2-this._scale.featuredMeasureSettings.width/2-this._scale.featuredMeasureSettings.width,f=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*r/2-this._scale.featuredMeasureSettings.width/2+2*this._scale.featuredMeasureSettings.width,e=c?h?this._scale.location.x+this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n))):this._scale.location.x+(this.model.quantitativeScaleLength-this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n)))):h?this._scale.location.x+(this.model.quantitativeScaleLength-this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n)))):this._scale.location.x+this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n))),o=this._compareMeasure(this._scale,e,u,f,i,n),this.model.drawComparativeMeasureSymbol&&(s={comparativeMeasureSettings:this._scale.comparativeMeasureSettings},this._trigger("drawComparativeMeasureSymbol",s),o=this._compareMeasure(s,e,u,f,i,n)),this.svgRenderer.drawLine(o,this._scaleGroup),r+=2,this.comparativeMeasureValue(n))},_compareMeasure:function(n,t,i,r,u,f){return{"class":this.svgObject.id+"_ComparativeMeasure",id:this.svgObject.id+"_ComparativeMeasure_"+u,x1:f==this._scale.maximum?t-n.comparativeMeasureSettings.width/2:f==this._scale.minimum?t+n.comparativeMeasureSettings.width/2:t,y1:i,x2:f==this._scale.maximum?t-n.comparativeMeasureSettings.width/2:f==this._scale.minimum?t+n.comparativeMeasureSettings.width/2:t,y2:r,"stroke-width":n.comparativeMeasureSettings.width,stroke:n.comparativeMeasureSettings.stroke}},_setTheme:function(n,i){var u=[],e,r,f;this._scale=this.model.quantitativeScaleSettings;for(e in n)u.push(e);for(r=0;r<u.length;r++)for(this._scale.majorTickSettings.stroke=!this._scale.majorTickSettings.stroke||this._scale.majorTickSettings.stroke==n[u[r]].quantitativeScaleSettings.majorTickSettings.stroke?n[i].quantitativeScaleSettings.majorTickSettings.stroke:this._scale.majorTickSettings.stroke,this._scale.minorTickSettings.stroke=!this._scale.minorTickSettings.stroke||this._scale.minorTickSettings.stroke==n[u[r]].quantitativeScaleSettings.minorTickSettings.stroke?n[i].quantitativeScaleSettings.minorTickSettings.stroke:this._scale.minorTickSettings.stroke,this._scale.labelSettings.stroke=!this._scale.labelSettings.stroke||this._scale.labelSettings.stroke==n[u[r]].quantitativeScaleSettings.labelSettings.stroke?n[i].quantitativeScaleSettings.labelSettings.stroke:this._scale.labelSettings.stroke,this._scale.featuredMeasureSettings.stroke=!this._scale.featuredMeasureSettings.stroke||this._scale.featuredMeasureSettings.stroke==n[u[r]].quantitativeScaleSettings.featuredMeasureSettings.stroke?n[i].quantitativeScaleSettings.featuredMeasureSettings.stroke:this._scale.featuredMeasureSettings.stroke,this._scale.comparativeMeasureSettings.stroke=!this._scale.comparativeMeasureSettings.stroke||this._scale.comparativeMeasureSettings.stroke==n[u[r]].quantitativeScaleSettings.comparativeMeasureSettings.stroke?n[i].quantitativeScaleSettings.comparativeMeasureSettings.stroke:this._scale.comparativeMeasureSettings.stroke,this.model.captionSettings.font.color=!this.model.captionSettings.font.color||this.model.captionSettings.font.color==n[u[r]].captionSettings.font.color?n[i].captionSettings.font.color:this.model.captionSettings.font.color,this.model.captionSettings.subTitle.font.color=!this.model.captionSettings.subTitle.font.color||this.model.captionSettings.subTitle.font.color==n[u[r]].captionSettings.subTitle.font.color?n[i].captionSettings.subTitle.font.color:this.model.captionSettings.subTitle.font.color,this.model.captionSettings.indicator.font.color=!this.model.captionSettings.indicator.font.color||this.model.captionSettings.indicator.font.color==n[u[r]].captionSettings.indicator.font.color?n[i].captionSettings.indicator.font.color:this.model.captionSettings.indicator.font.color,this.model.captionSettings.indicator.symbol.color=!this.model.captionSettings.indicator.symbol.color||this.model.captionSettings.indicator.symbol.color==n[u[r]].captionSettings.indicator.symbol.color?n[i].captionSettings.indicator.symbol.color:this.model.captionSettings.indicator.symbol.color,f=0;f<this.model.qualitativeRanges.length;f++)this.model.qualitativeRanges[f].rangeStroke=this.model.qualitativeRanges[f].rangeStroke?this.model.qualitativeRanges[f].rangeStroke:t.isNullOrUndefined(n[i].qualitativeRanges[f])?n[i].qualitativeRanges[0].rangeStroke:n[i].qualitativeRanges[f].rangeStroke},_onDrawQualitativeRanges:function(n,t,i){var r={object:this,scaleElement:this.model.quantitativeScaleSettings,rangeIndex:i,rangeElement:n,rangeEndValue:t};this._trigger("drawQualitativeRanges",r)},_doAnimation:function(){for(var r,i=n("."+this.svgObject.id+"_FeatureMeasure"),t=i.length-1;t>=0;t--)r=i[t],this._animateFeatureBar(r)},_doLineAnimation:function(){for(var r,i=n("."+this.svgObject.id+"_ComparativeMeasure"),u=2e3/i.length,t=i.length-1;t>=0;t--)r=i[t],n(r).attr("transform","scale(0)"),this._doLineSymbol(r,u,t)},_animateFeatureBar:function(i){var r=i.getBBox(),u,f;this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Backward||this._orientation==t.datavisualization.BulletGraph.Orientation.Vertical&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward?(u=r.x+r.width,f=r.y+r.height):(u=r.x,f=r.y);n(i).animate({scale:1},{duration:1e3,step:function(t){scaleVal=t;n(i).attr("transform","translate("+u+" "+f+") scale("+t+",1) translate("+-u+" "+-f+")")}})},_doLineSymbol:function(t,i,r){var o=parseInt(r*i),u=t.getBBox(),f=u.x+u.width/2,e=u.y+u.height/2;n(t).delay(o).animate({scale:1},{duration:200,step:function(i){n(t).attr("transform","translate("+f+" "+e+") scale("+i+") translate("+-f+" "+-e+")")}})},bindEvents:function(){var u=t.EjSvgRender.utils.browserInfo(),i=u.isMSPointerEnabled,r=u.pointerEnabled,f=i?r?"pointerdown":"MSPointerDown":"touchstart mousedown",e=i?r?"pointerup":"MSPointerUp":"touchend mouseup",o=i?r?"pointermove":"MSPointerMove":"touchmove mousemove",s=i?r?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.model.browserInfo=u;this._on(n(this.svgObject),o,this._bulletMouseMove);this._on(n(this.svgObject),s,this._bulletMouseLeave);this._on(n(this.svgObject),f,this._bulletMouseDown);this._on(n(this.svgObject),e,this._bulletMouseUp);(this.model.enableResizing||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this._bulletResize):this._on(n(window),"resize",this._bulletResize))},isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_bulletResize:function(){var i=this,f=this.model.height,r=this.model.width,e=n(i.svgObject),f=90,r=t.isTouchDevice()?250:595,u=n(i.element).width(),o;i.model.width?r=parseInt(i.model.width):u>0&&u<595?r=u:u>595&&(r=595);i.model.height&&(f=parseInt(i.model.height));o=n(i.element).height()>f?f:n(i.element).height();this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){r<n(i.element).width()?e.width(r):e.width(n(i.element).width());e.height(o);i.redraw()},500)},_bulletMouseLeave:function(t){this.isTouch(t)||(n("#tooltip").remove(),n(".tooltipDiv"+this._id).remove())},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_bulletMouseMove:function(t){var i,r;i=n(t.target).attr("id");r=n(t.target).attr("class");this.isTouch(t)||(n("#tooltip").remove(),n(".tooltipDiv"+this._id).remove(),this._elementTooltip(t,r,i),this._displayTooltip(t,r,i))},_bulletMouseDown:function(t){if(this.isTouch(t)){t.preventDefault();n("#tooltip").remove();n(".tooltipDiv"+this._id).remove();var i=n(t.target).attr("id"),r=n(t.target).attr("class");this._elementTooltip(t,r,i);this._displayTooltip(t,r,i)}},_bulletMouseUp:function(t){if(this.isTouch(t)){var i=this,r;window.clearTimeout(i.model.timer);n(".tooltipDiv"+this._id).length==1&&(r=n(".tooltipDiv"+this._id));r&&(i.model.trackerElement=r,i.model.timer=setTimeout(function(){i.model.trackerElement&&n(".tooltipDiv"+i._id).fadeOut(500,function(){n(".tooltipDiv"+i._id).remove();n("[id*="+i.svgObject.id+"_FeatureMeasure_]").attr("opacity","1")})},1200))}},_elementTooltip:function(t,r){var o=this.model.captionSettings,u=n("<div><\/div>").attr({id:"tooltip","class":"tooltipDiv"+this._id}),s=this.mousePosition(t),h,f,e;if(str="",n(u).css({left:s.pageX+10,top:s.pageY+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"}),r==this.svgObject.id+"_Caption"?str=t.target.textContent==o.text?"":o.text:r==this.svgObject.id+"_SubTitle"?str=t.target.textContent==o.subTitle.text?"":o.subTitle.text:r==this.svgObject.id+"_Indicator"&&(str=t.target.textContent==o.indicator.text?"":o.indicator.text),str!="")n(u).html(" "+str+" "),n(document.body).append(u);else if(this.model.tooltipSettings.enableCaptionTooltip&&(r==this.svgObject.id+"_Caption"||r==this.svgObject.id+"_SubTitle"||r==this.svgObject.id+"_Indicator")){var l=n("."+r).text(),a={Text:l},c=this.model.tooltipSettings.captionTemplate;n(".tooltipDiv"+this._id).length==0&&(u=n("<div><\/div>").attr("class","tooltipDiv"+this._id).css({position:"absolute","z-index":"13000",display:"block"}),n(document.body).append(u));c!=""&&c!=null?(h=document.getElementById(c),h=h?n(h).clone():n(c),n(h).css("display","block").appendTo(u),n(u).html(n(h).render(a))):n(u).html(l);n(u).css("font-size","12px");f=s.clientX+n(document).scrollLeft()+10;e=s.clientY+n(document).scrollTop()+10;f=f+n(u).width()<n(window).width()?f:f-n(u).width();e=e+n(u).height()<n(window).height()?e:e-n(u).height();(f===i||f===null)&&(f=s.clientX+n(document).scrollLeft()+10);(e===i||e===null)&&(e=s.clientY+n(document).scrollTop()+10);n(u).css({left:f,top:e,"-webkit-border-radius":"5px 5px 5px 5px","-moz-border-radius":"5px 5px 5px 5px","-o-border-radius":"5px 5px 5px 5px","border-radius":"5px 5px 5px 5px","background-color":"White",border:"1px Solid Black","padding-bottom":"5px","padding-left":"5px","padding-right":"5px","padding-top":"5px"})}},mousePosition:function(n){return!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0?n:n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0?n.originalEvent:n.originalEvent&&n.originalEvent.changedTouches!=i&&!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0?n.originalEvent.changedTouches[0]:n},_displayTooltip:function(r,u,f){var l,a,e,o;if(u!="undefined"&&(u==this.svgObject.id+"_FeatureMeasure"||u==this.svgObject.id+"_ComparativeMeasure")){var h=this.model.locale,v=h&&this.model.enableGroupSeparator,s,y=typeof this.model.value=="function"?this._value():this.model.value,p=typeof this.model.comparativeMeasureValue=="function"?this._comparativeMeasureValue():this.model.comparativeMeasureValue,c=this.mousePosition(r);measureId=f.substring(f.lastIndexOf("_")+1);currentVal=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource[measureId][this.model.fields.featureMeasures]:t.isNullOrUndefined(this._scale.featureMeasures[measureId].value)?y:this._scale.featureMeasures[measureId].value;targetVal=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource[measureId][this.model.fields.comparativeMeasure]:t.isNullOrUndefined(this._scale.featureMeasures[measureId].comparativeMeasureValue)?p:this._scale.featureMeasures[measureId].comparativeMeasureValue;categoryVal=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?t.isNullOrUndefined(this.model.fields.dataSource[measureId][this.model.fields.category])?null:this.model.fields.dataSource[measureId][this.model.fields.category]:t.isNullOrUndefined(this._scale.featureMeasures[measureId].category)?null:this._scale.featureMeasures[measureId].category;s=v?{currentValue:currentVal.toLocaleString(h),targetValue:targetVal.toLocaleString(h),category:t.util.isNullOrUndefined(categoryVal)?categoryVal:categoryVal.toLocaleString(h)}:{currentValue:currentVal,targetValue:targetVal,category:categoryVal};n(".tooltipDiv"+this._id).length==0&&(tooltipdiv=n("<div><\/div>").attr("class","tooltipDiv"+this._id).css({position:"absolute","z-index":"13000",display:"block"}),n(document.body).append(tooltipdiv));this.model.tooltipSettings.template!=""&&this.model.tooltipSettings.template!=null?(l=n("#"+this.model.tooltipSettings.template).clone(),n(l).css("display","block").appendTo(tooltipdiv),n(tooltipdiv).html(n(l).render(s))):(a=t.isNullOrUndefined(s.category)?"":"<br/> Category : "+s.category,n(tooltipdiv).html("Current : "+s.currentValue+"<br/> Target : "+s.targetValue+a));n(tooltipdiv).css("font-size","12px");e=c.clientX+n(document).scrollLeft()+10;o=c.clientY+n(document).scrollTop()+10;e=e+n(tooltipdiv).width()<n(window).width()?e:e-n(tooltipdiv).width();o=o+n(tooltipdiv).height()<n(window).height()?o:o-n(tooltipdiv).height();(e===i||e===null)&&(e=c.clientX+n(document).scrollLeft()+10);(o===i||o===null)&&(o=c.clientY+n(document).scrollTop()+10);n(tooltipdiv).css({left:e,top:o,"-webkit-border-radius":"5px 5px 5px 5px","-moz-border-radius":"5px 5px 5px 5px","-o-border-radius":"5px 5px 5px 5px","border-radius":"5px 5px 5px 5px","background-color":"White",color:"black",border:"1px Solid Black","padding-bottom":"5px","padding-left":"5px","padding-right":"5px","padding-top":"5px"});u==this.svgObject.id+"_FeatureMeasure"&&n("#"+f).attr("opacity","0.7")}},redraw:function(){n(this.svgObject).empty();this._renderBulletElements()},destroy:function(){n(this.element).removeClass("e-bulletgraph e-js").find("#"+this.svgObject.id).remove()},setFeatureMeasureBarValue:function(n,i){this._scale=this.model.quantitativeScaleSettings;var r=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource.length:this._scale.featureMeasures.length;n<r&&i!=null&&(t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?this._scale.featureMeasures[n].value=i:this.model.fields.dataSource[n][this.model.fields.featureMeasures]=i,this.redraw(),this.model.enableAnimation&&this._doAnimation())},setComparativeMeasureSymbol:function(n,i){this._scale=this.model.quantitativeScaleSettings;var r=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource.length:this._scale.featureMeasures.length;n<r&&i!=null&&(t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?this._scale.featureMeasures[n].comparativeMeasureValue=i:this.model.fields.dataSource[n][this.model.fields.comparativeMeasure]=i,this.redraw(),this.model.enableAnimation&&this._doLineAnimation())}});t.datavisualization.BulletGraph.Orientation={Horizontal:"horizontal",Vertical:"vertical"};t.datavisualization.BulletGraph.TickPlacement={Inside:"inside",Outside:"outside"};t.datavisualization.BulletGraph.LabelPlacement={Inside:"inside",Outside:"outside"};t.datavisualization.BulletGraph.Shape={Circle:"circle",Cross:"cross",Diamond:"diamond",DownArrow:"downarrow",Ellipse:"ellipse",HorizontalLine:"horizontalLine",Image:"image",InvertedTriangle:"invertedtriangle",LeftArrow:"leftarrow",Pentagon:"pentagon",Rectangle:"Rectangle",RightArrow:"rightarrow",Star:"star",Trapezoid:"trapezoid",Triangle:"triangle",UpArrow:"uparrow",VerticalLine:"verticalline",Wedge:"wedge"};t.datavisualization.BulletGraph.TickPosition={Far:"far",Near:"near",Center:"center"};t.datavisualization.BulletGraph.LabelPosition={Below:"below",Above:"above"};t.datavisualization.BulletGraph.FlowDirection={Forward:"forward",Backward:"backward"};t.datavisualization.BulletGraph.FontStyle={Normal:"Normal",Italic:"Italic",Oblique:"Oblique"};t.datavisualization.BulletGraph.FontWeight={Normal:"Normal",Bold:"Bold",Bolder:"Bolder",Lighter:"Lighter"};t.datavisualization.BulletGraph.Themes={flatlight:{quantitativeScaleSettings:{majorTickSettings:{stroke:"#191919"},minorTickSettings:{stroke:"#191919"},labelSettings:{stroke:"#191919"},featuredMeasureSettings:{stroke:"#191919"},comparativeMeasureSettings:{stroke:"#191919"}},qualitativeRanges:[{rangeStroke:"#ebebeb"},{rangeStroke:"#d8d8d8"},{rangeStroke:"#7f7f7f"}],captionSettings:{font:{color:"#191919"},subTitle:{font:{color:"#191919"}},indicator:{font:{color:"#191919"},symbol:{color:"#191919"}}}},material:{quantitativeScaleSettings:{majorTickSettings:{stroke:"#333333"},minorTickSettings:{stroke:"#191919"},labelSettings:{stroke:"#333333"},featuredMeasureSettings:{stroke:"#333333"},comparativeMeasureSettings:{stroke:"#333333"}},qualitativeRanges:[{rangeStroke:"#ebebeb"},{rangeStroke:"#d8d8d8"},{rangeStroke:"#7f7f7f"}],captionSettings:{font:{color:"#333333"},subTitle:{font:{color:"#333333"}},indicator:{font:{color:"#333333"},symbol:{color:"#333333"}}}},flatdark:{quantitativeScaleSettings:{majorTickSettings:{stroke:"#ffffff"},minorTickSettings:{stroke:"#ffffff"},labelSettings:{stroke:"#ffffff"},featuredMeasureSettings:{stroke:"#ffffff"},comparativeMeasureSettings:{stroke:"#ffffff"}},qualitativeRanges:[{rangeStroke:"#b3b3b3"},{rangeStroke:"#999999"},{rangeStroke:"#4d4d4d"}],captionSettings:{font:{color:"#ffffff"},subTitle:{font:{color:"#ffffff"}},indicator:{font:{color:"#ffffff"},symbol:{color:"#ffffff"}}}}}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejRangeNavigator","ej.datavisualization.RangeNavigator",{ejChart:"",validTags:["div"],defaults:{theme:"",padding:"0",enableAutoResizing:!1,isResponsive:!1,allowSnapping:!1,sizeSettings:{width:"",height:""},_size:{},locale:"en-US",valueType:"datetime",valueAxisSettings:{rangePadding:"none",range:{min:null,max:null,interval:null},axisLine:{visible:!1},font:{size:"0px"},majorTickLines:{width:0,size:0,visible:!0},majorGridLines:{visible:!1},visible:!1},rangePadding:"none",enableRTL:!1,enableScrollbar:!1,dataSource:"",xName:"x",yName:"y",tooltipSettings:{visible:!0,labelFormat:"MM/dd/yyyy",tooltipDisplayMode:"always",backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",fontStyle:"Normal",size:"10px",opacity:1,weight:"regular"}},zoomPosition:"0",zoomFactor:"1",selectedRangeSettings:{start:"",end:""},selectedData:"",rangeSettings:{start:"",end:""},border:{width:1,color:null,opacity:1},scrollRangeSettings:{start:"",end:""},enableDeferredUpdate:!0,series:"",seriesSettings:"",labelSettings:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"},horizontalAlignment:"middle"},higherLevel:{intervalType:null,style:{font:{color:"black",fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",opacity:1,fontWeight:"regular"},horizontalAlignment:"middle"},gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"20 5 0"},border:{color:"transparent",width:.5},fill:"transparent",position:"top",visible:!0,labelPlacement:"outside"},lowerLevel:{intervalType:null,style:{font:{color:"black",fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",opacity:1,fontWeight:"regular"},horizontalAlignment:"middle"},gridLineStyle:{color:"#B5B5B5",width:1,dashArray:""},border:{color:"transparent",width:.5},fill:"transparent",position:"bottom",visible:!0,labelPlacement:"outside"}},navigatorStyleSettings:{selectedRegionColor:"#EFEFEF",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,leftThumbTemplate:null,rightThumbTemplate:null,thumbStroke:"#303030",background:"#dddddd",border:{color:"transparent",width:.5,dashArray:""},opacity:1,selectedRegionOpacity:0,unselectedRegionOpacity:.3,highlightSettings:{enable:!1,opacity:.5,color:"#006fa0",border:{color:"",width:1}},selectionSettings:{enable:!1,opacity:.5,color:"#0e4a7c",border:{color:"",width:1}},majorGridLineStyle:{color:"#B5B5B5",visible:!0},minorGridLineStyle:{color:"#B5B5B5",visible:!0}},loaded:"",load:"",rangeChanged:"",scrollEnd:"",scrollStart:"",scrollChanged:"",selectedRangeStart:"",selectedRangeEnd:""},dataTypes:{enableAutoResizing:"boolean",isResponsive:"boolean",allowSnapping:"boolean",dataSource:"data",tooltipSettings:{visible:"boolean",labelFormat:"string",tooltipDisplayMode:"string"},zoomPosition:"string",zoomFactor:"string",selectedData:"string",enableDeferredUpdate:"boolean",series:"array",labelSettings:{higherLevel:{intervalType:"string",position:"string",visible:"boolean",labelPlacement:"string"},lowerLevel:{intervalType:"string",position:"string",visible:"boolean",labelPlacement:"string"}},navigatorStyleSettings:{thumbRadius:"number"}},observables:["selectedRangeStart","selectedRangeEnd"],_tags:[{tag:"series",attr:["xName","yName","dataSource","enableAnimation",[{tag:"points",attr:["x","y","text","isEmpty","fill","visible"]}]],singular:"series"}],_selectedRangeStart:t.util.valueFunction("selectedRangeStart"),_selectedRangeEnd:t.util.valueFunction("selectedRangeEnd"),_series:function(){this.renderNavigator();this._trigger("refresh")},_series_points:function(){this.renderNavigator();this._trigger("refresh")},_themes:{flatlight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},azurelight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},limelight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#A9CA44 ",thumbColor:"#AECF49",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},saffronlight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#FAA113",thumbColor:"#F9920B",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientlight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientazure:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientlime:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientsaffron:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},flatdark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},material:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1}},lowerLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#f5f5f5",unselectedRegionColor:"#8d8afd",thumbColor:"#8d8afd",thumbRadius:10,thumbStroke:"#000000",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},office:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#eaeaea",unselectedRegionColor:"#0078d7",thumbColor:"#0078d7",thumbRadius:10,thumbStroke:"#000000",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.6,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},highcontrast01:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#008000",thumbColor:"#008000",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.6,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},highcontrast02:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#0000ff",thumbColor:"#0000ff",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.6,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},azuredark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},limedark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#A9CA44",thumbColor:"#AECF49",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},saffrondark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#FAA113",thumbColor:"#F9920B",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientdark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientazuredark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientlimedark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",fontStyle:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientsaffrondark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}}},_setModel:function(t){for(var i in t)switch(i){case"theme":this.model._themeChanged=!0;this.model.theme=t[i];this._setTheme(this._themes,this.model.theme);break;case"selectedRangeStart":this.model.selectedRangeSettings.start=this._selectedRangeStart();break;case"selectedRangeEnd":this.model.selectedRangeSettings.end=this._selectedRangeEnd();break;default:n.extend(!0,this.model,{},t[i])}this.bindTo();this.renderNavigator(this);this._bindevents()},_destroy:function(){this.element.empty().removeClass(this.model.cssClass)},_createSvg:function(){this.svgSupport=window.SVGSVGElement?!0:!1;this.vmlRendering=!this.svgSupport;var n=jQuery.uaMatch(navigator.userAgent);this.brow=n.browser.toLowerCase();this.svgSupport?(this.renderer=new t.EjSvgRender(this.element),this.svgns=this.renderer.svgLink,this.svgDocument=this.renderer.svgObj):(this.renderer=new t.EjVmlRender(this.element),this.svgDocument=this.renderer.svgObj)},_setSVGSize:function(){var o=this.model.valueType,t,f=this.model,u=f.sizeSettings,r=parseFloat(f.labelSettings.higherLevel.style.font.size),e;o=="datetime"?(this.minHighHeight=r<20?20:r+2,r=parseFloat(this.model.labelSettings.lowerLevel.style.font.size)):this.minHighHeight=0;this.minLowHeight=r<20?20:r+2;this.scrollbarLoaded=this.model.scrollObj&&this.model.scrollObj[0].scrollbarLoaded?!0:!1;e=this.model.enableScrollbar&&this.scrollbarLoaded&&this.svgSupport?18:0;t=n(this.element).height()?n(this.element).height()>this.newHeight?n(this.element).height()-e:n(this.element).height():this.newHeight==i?o=="datetime"?120:100:this.newHeight;this.minCenterHeight=parseFloat(t)-parseFloat(this.minLowHeight)-parseFloat(this.minHighHeight);t=t<=0?120:t;this.minHeight=t;this.padding=parseFloat(f.padding);this.newWidth=u.width?u.width:n(this.element).width();this.newHeight=u.height?u.height:(n(this.element).height()&&this.newHeight==i)>this.minHeight?n(this.element).height()-e:this.minHeight;this.scrollWidth=this.newWidth-this.padding*2},_setTheme:function(i,r){var u=r.toLowerCase();u.indexOf("high")>=0&&u.indexOf("01")>=0?i[u]=n.extend(!0,{},i.highcontrast01,i[u]):u.indexOf("high")>=0&&u.indexOf("02")>=0?i[u]=n.extend(!0,{},i.highcontrast02,i[u]):u.indexOf("material")>=0?i[u]=n.extend(!0,{},i.material,i[u]):u.indexOf("office")>=0&&(i[u]=n.extend(!0,{},i.office,i[u]));this.model=t.copyObject({},this.model,i[u])},_setPositions:function(){var i=this.model.labelSettings.higherLevel,r=this.model.labelSettings.lowerLevel,n=i.position,t=r.position,u=i.visible,f=r.visible,e=i.labelPlacement,o=r.labelPlacement;n==="top"&&t==="bottom"?(this.centerPosition=this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minHighHeight+this.centerHeight+1):n==="bottom"&&t==="bottom"?(this.centerPosition=0,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minLowHeight+this.centerHeight+1):n==="bottom"&&t==="top"?(this.centerPosition=this.minLowHeight+1,topPosition=0,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minLowHeight+this.centerHeight+1):n==="top"&&t==="top"&&(this.centerPosition=this.minLowHeight+this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.newHeight);u===!1&&f===!1?(this.centerPosition=0,this.centerHeight=this.newHeight,this.bottomPostion=this.newHeight):u===!1?(this.centerPosition=0,this.centerHeight=this.newHeight-this.minLowHeight,this.bottomPosition=this.newHeight):f===!1&&(this.centerPosition=this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight,this.bottomPosition=this.minHighHeight+this.centerHeight+1);e==="outside"&&o==="outside"?(this.sliderPosition=this.centerPosition,this.sliderHeight=this.centerHeight):e==="outside"?(this.sliderPosition=this.centerPosition,this.sliderHeight=this.newHeight):o==="outside"?(this.sliderPosition=0,this.sliderHeight=this.centerHeight+this.minHighHeight):(this.sliderPosition=0,this.sliderHeight=this.newHeight)},redraw:function(){var r=this.model.scrollRangeSettings,u=this.model.rangeSettings,i,f=r.start,e=r.end;this.loadScrollbar=!1;this.model.enableScrollbar&&(this.scrollUpdate=!0,i=this._scrollRange,this.model.valueType.toLowerCase()=="datetime"&&(f=Date.parse(r.start),e=Date.parse(r.end),rangeStart=Date.parse(u.start),rangeEnd=Date.parse(u.end)),(!i||rangeStart<i.min||i.max<rangeEnd||i.min!=f||i.max!=e||t.isNullOrUndefined(this.scrollsvgObj))&&(this.loadScrollbar=!0,this.scrollbarLoaded=!1,n(this.scrollsvgObj).remove()));this.renderNavigator(this)},renderNavigator:function(r){var l,k,w,u,g,nt,tt,it,pt,rt,ut,s,b,ft,et,ot,st,ht,c,ct,lt,at,v,f,e,o,y,h,p;n(this.svgDocument).empty();l=this.model.locale;this.culture=t.preferredCulture(l);this._localizedLabels=this._getLocalizedLabels();this._initializeVariables.call(this,this.model,this.model.series,this.model.seriesSettings);this._rootId=n(this.element).attr("id");this.leftPadding=parseFloat(n("#"+this._rootId).css("padding-left"));this._setSVGSize.call(this);k=this.model.valueType;this._higherTextNode=[];this._higherTotalValues=[];this._higherLineLeft=[];this._higherTextLeft=[];this._lowerTextNode=[];this._lowerTotalValues=[];this._lowerLineLeft=[];this._lowerTextLeft=[];this.labelRegions=[];var d=this.model.labelSettings,wt=d.higherLevel,bt=d.lowerLevel,kt=this.model.valueType;this.centerPosition=0;this.bottomPosition=0;this.centerHeight=0;this.sliderPosition=0;this.sliderHeight=0;this._setPositions();this.svgDocument.setAttribute("style","overflow:visible;position:relative;display:block");this.svgSupport?(this.svgDocument.setAttribute("height",this.newHeight),this.svgDocument.setAttribute("width",this.newWidth)):(n(this.svgDocument).width(this.newWidth),n(this.svgDocument).height(this.newHeight));this.model._size.width=this.newWidth;this.model._size.height=this.newHeight;w=n.extend({},t.EjSvgRender.commonChartEventArgs);w.data={model:this.model};this._trigger("loaded",w);this.model.theme!=""&&this._setTheme(this._themes,this.model.theme);u=this.model.navigatorStyleSettings;g=u.unselectedRegionColor;this.unselectgrad=this.renderer.createGradientElement("unselected",g,150,0,150,100,this.svgDocument);nt=u.background;this.naviback=this.renderer.createGradientElement("naviback",nt,150,0,150,100,this.svgDocument);tt=u.selectedRegionColor;this.selectedgrad=this.renderer.createGradientElement("selected",tt,150,0,150,100,this.svgDocument);it=u.thumbColor;this.tbClr=this.renderer.createGradientElement("thumbClr",it,150,0,150,100,this.svgDocument);var a=this.model.border,vt=a.color?a.color:this.model.enableScrollbar?"#B4B4B4":"transparent",yt={id:this._rootId+"_Layout",x:this.padding,width:this.newWidth>0?this.newWidth-this.padding*2:0,height:this.newHeight,fill:"transparent","stroke-width":a.width,stroke:vt,opacity:a.opacity};this.renderer.drawRect(yt,this.svgDocument);pt=k=="numeric"?this.newHeight-u.border.width-this.minLowHeight:this.newHeight-u.border.width-this.minLowHeight-this.minHighHeight;rt={id:this._rootId+"_Border",x:this.padding,y:this.sliderPosition,width:this.newWidth>0?this.newWidth-this.padding*2:0,height:this.sliderHeight,fill:this.naviback,"stroke-width":u.border.width,stroke:u.border.color,opacity:u.opacity,"stroke-dasharray":u.border.dashArray};this.renderer.drawRect(rt,this.svgDocument);n("#"+this._rootId+"higherLevel").length==0&&(this.higherLevel=this.renderer.createGroup({id:this._rootId+"higherLevel"}));n("#"+this._rootId+"lowerLevel").length==0&&(this.lowerLevel=this.renderer.createGroup({id:this._rootId+"lowerLevel"}));this.centerLevel=this.renderer.createGroup({id:this._rootId+"centerLelvel"});this.higherLevel.height=this.minHighHeight;this.lowerLevel.height=this.minLowHeight;this.model.tooltipSettings.visible&&this.svgSupport&&(this.leftTooltip=this.renderer.createGroup({id:this._rootId+"leftTooltip"}),this.rightTooltip=this.renderer.createGroup({id:this._rootId+"rightTooltip"}),ut={fill:this.model.tooltipSettings.backgroundColor,d:"M 0 0 L 0 21 L 64 21 L 64 6 L 70 0 Z"},this.renderer.drawPath(ut,this.leftTooltip),s=this.model.tooltipSettings.font,b={id:this._rootId+"_LeftToolText",x:5,fill:s.color,"font-size":s.size,"font-family":s.family,"font-style":s.style,"font-weight":s.weight,"text-anchor":"start",opacity:s.opacity,"dominant-baseline":"middle"},this.renderer.drawText(b,t.format(new Date(1/2e3),"MMMM, yyyy",l),this.leftTooltip),this.leftTxt=this.leftTooltip.childNodes[1],ft={fill:this.model.tooltipSettings.backgroundColor,d:"M 0 0 L 70 0 L 70 21 L 6 21 L 6 6 Z","horizontal-alignment":"stretch"},this.renderer.drawPath(ft,this.rightTooltip),this.renderer.drawText(b,t.format(new Date(1/2e3),"MMMM, yyyy",l),this.rightTooltip),this.rightTxt=this.rightTooltip.childNodes[1]);this.chartGView=this.renderer.createGroup({id:this._rootId+"charView"});this.renderer.append(this.chartGView,this.svgDocument);(this.model.navigatorStyleSettings.highlightSettings.enable||this.model.navigatorStyleSettings.selectionSettings.enable)&&(this.styleRect=this.renderer.createGroup({id:this._rootId+"highlightRect"}),this.renderer.append(this.styleRect,this.svgDocument));this.model.valueType=="datetime"&&this.renderer.append(this.higherLevel,this.svgDocument);this.renderer.append(this.lowerLevel,this.svgDocument);this.renderer.append(this.centerLevel,this.svgDocument);this.leftUnSelected=this.renderer.createGroup({id:"unselectleft"});this.gLeftSlider=this.renderer.createGroup({id:"leftslider"});this.gRightSlider=this.renderer.createGroup({id:"rightslider"});this.gCenterSlider=this.renderer.createGroup({id:"centerslider"});this.rightUnSelected=this.renderer.createGroup({id:"unselectright"});et={width:this.newWidth>0?this.newWidth-this.padding*2:0,height:this.sliderHeight,fill:this.unselectgrad,opacity:u.unselectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"};this.renderer.drawRect(et,this.leftUnSelected);this.leftUnArea=this.leftUnSelected.firstChild;this.renderer.append(this.leftUnSelected,this.svgDocument);ot={width:this.newWidth>0?this.newWidth-4-this.padding*2:0,height:this.sliderHeight,fill:this.selectedgrad,opacity:u.selectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"};this.renderer.drawRect(ot,this.gCenterSlider);this.centerSlider=this.gCenterSlider.firstChild;n(this.centerSlider).css("cursor","pointer");this.renderer.append(this.gCenterSlider,this.svgDocument);st={width:"2",height:this.sliderHeight,fill:u.thumbStroke,opacity:"1",y:this.sliderPosition,transform:"translate("+this.padding+")"};ht={id:"leftCircle"+this._id,cx:this.padding,cy:this.sliderPosition+this.sliderHeight/2,r:u.thumbRadius,"stroke-width":2,stroke:u.thumbStroke,fill:this.tbClr};this.renderer.drawRect(st,this.gLeftSlider);this.model.navigatorStyleSettings.leftThumbTemplate==null?(this.renderer.drawCircle(ht,this.gLeftSlider),this.leftCircle=this.gLeftSlider.lastChild,n(this.leftCircle).css("cursor","pointer")):(v=document.getElementById(this.model.navigatorStyleSettings.leftThumbTemplate)?!0:!1,n("#"+this._id+"thumbleft").length>0&&n("#"+this._id+"thumbleft").remove(),f=this._id,n("#"+f).css("transform")=="none"&&n("#"+f).css("transform","translate(0, 0)"),n("#"+f+"template_group_").length!=0?e=n("#"+f+"template_group_"):(e=n("<div><\/div>").attr("id",f+"template_group_"),n(e).css("position","relative")),o=n("<div><\/div>").attr("id",this._id+"thumbleft"),y=v==!0?n("#"+this.model.navigatorStyleSettings.leftThumbTemplate)[0].innerHTML:this.model.navigatorStyleSettings.leftThumbTemplate,h=n(y),n(o).css("position","absolute"),h.appendTo(n(o)),n(o).appendTo(e),this.svgSupport?n(e).appendTo("#"+f):n(e).appendTo(this.svgDocument),p=this.sliderPosition+this.sliderHeight/2-h.height()/2,n(o).css("top",p).css("cursor","pointer").css("z-index","1"));this.leftSlider=this.gLeftSlider.firstChild;n(this.leftSlider).css("cursor","w-resize");this.renderer.append(this.gLeftSlider,this.svgDocument);c=parseFloat(this.newWidth-this.padding*2);c=c<0?0:c;ct={width:c,height:this.sliderHeight,fill:this.unselectgrad,opacity:u.unselectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"};this.renderer.drawRect(ct,this.rightUnSelected);this.rightUnArea=this.rightUnSelected.firstChild;this.renderer.append(this.rightUnSelected,this.svgDocument);lt={width:"2",height:this.sliderHeight,fill:this.model.navigatorStyleSettings.thumbStroke,opacity:"1",transform:"translate("+parseFloat(this.newWidth-4-this.padding)+", "+this.sliderPosition+" )"};at={id:"rightCircle"+this._id,cx:this.newWidth-4-this.padding,cy:this.sliderPosition+this.sliderHeight/2,r:this.model.navigatorStyleSettings.thumbRadius,"stroke-width":2,stroke:this.model.navigatorStyleSettings.thumbStroke,fill:this.tbClr};this.renderer.drawRect(lt,this.gRightSlider);this.model.navigatorStyleSettings.rightThumbTemplate==null?(this.renderer.drawCircle(at,this.gRightSlider),this.rightCircle=this.gRightSlider.lastChild,n(this.rightCircle).css("cursor","pointer")):(v=document.getElementById(this.model.navigatorStyleSettings.rightThumbTemplate)?!0:!1,n("#"+this._id+"thumbright").length>0&&n("#"+this._id+"thumbright").remove(),f=this._id,n("#"+f+"template_group_").length!=0?e=n("#"+f+"template_group_"):(e=n("<div><\/div>").attr("id",f+"template_group_"),n(e).css("position","absolute")),o=n("<div><\/div>").attr("id",this._id+"thumbright"),y=v==!0?n("#"+this.model.navigatorStyleSettings.rightThumbTemplate)[0].innerHTML:this.model.navigatorStyleSettings.rightThumbTemplate,h=n(y),n(o).css("position","absolute"),h.appendTo(n(o)),n(o).appendTo(e),this.svgSupport?n(e).appendTo("#"+f):n(e).appendTo(this.svgDocument),p=this.sliderPosition+this.sliderHeight/2-h.height()/2,n(o).css("top",p).css("cursor","pointer").css("z-index","1"));this.rightSlider=this.gRightSlider.firstChild;n(this.rightSlider).css("cursor","w-resize");this.renderer.append(this.gRightSlider,this.svgDocument);this.model.tooltipSettings.visible&&this.svgSupport&&(this.renderer.append(this.leftTooltip,this.svgDocument),this.renderer.append(this.rightTooltip,this.svgDocument));this.element.append(this.svgDocument);this.svgSupport&&(this.trueCoords=this.svgDocument.createSVGPoint(),this.grabPoint=this.svgDocument.createSVGPoint());this.backDrop=this.element;this.dragTarget=null;this.sliderHeight>0&&this._renderChart.call(this,this.model);r!=i&&r.target!=i&&(this.resize=!0);this.startDateTime!=i&&this.endDateTime!=i||this.startValue!=i&&this.endValue!=i?(this.calculateInterval.call(this,this.model.labelSettings.higherLevel,this.model.labelSettings.lowerLevel),this.setSliders()):(this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+this.padding+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.leftTooltip.setAttribute("opacity",0),this.rightTooltip.setAttribute("opacity",0));this.model.tooltipSettings.visible&&this.svgSupport&&this.model.tooltipSettings.tooltipDisplayMode=="ondemand"&&(this.rightTooltip.setAttribute("opacity",0),this.leftTooltip.setAttribute("opacity",0));this._scrollChanged=this._scrollChanged?!1:this._scrollChanged;this.model.enableScrollbar?(this.loadScrollbar&&!this.scrollbarUpdate||this.model.scrollObj&&this.model.scrollObj[0].width!=this.scrollWidth?(this.model.scrollObj[0].width=this.scrollWidth,this.scrollbarContainer=new t.EjSvgScrollbarRender(this.element,this.model.scrollObj[0]),this.scrollbarContainer._initializeScrollbarVariables.call(this,this.model.scrollObj[0]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[0])):this.renderer.append(this.scrollsvgObj,this.element),this._bindevents()):(n(this.scrollsvgObj).remove(),this.scrollsvgObj=null,this.scrollZoomPos=null,this.scrollZoomFact=null)},eachInterval:"",_renderChart:function(t){var e=t.valueType.toLowerCase(),u,f=t.rangeSettings,r,o;(t.enableScrollbar||f.start!=""&&f.end!="")&&(u=e=="datetime"?{min:this.startDateTime,max:this.endDateTime}:{min:this.startValue,max:this.endValue});t.dataSource!=""&&t.series==""&&t.seriesSettings==""?n(this.chartGView).ejChart({locale:this.model.locale,border:{width:0,color:"transparent"},margin:{left:0,right:0,top:0,bottom:0},elementSpacing:0,chartArea:{background:"transparent",border:{width:0}},primaryXAxis:{axisLine:{visible:!1},font:{size:"0px"},range:u,majorTickLines:{lineWidth:0,size:0,visible:!0},majorGridLines:{visible:!1},rangePadding:this.model.rangePadding,visible:!1,isInversed:this.model.enableRTL},primaryYAxis:this.model.valueAxisSettings,series:[{dataSource:t.dataSource,xName:t.xName,yName:t.yName,type:"line",width:1.5,enableAnimation:!1},],size:{height:parseFloat(this.sliderHeight).toString(),width:parseFloat(this.newWidth-2*this.padding).toString(),padding:-10},legend:{visible:!1,itemSize:{height:0,width:0,borderColor:"transparent",borderWidth:0}}}):t.dataSource!=""&&t.series!=""&&t.series[0].dataSource==i||t.seriesSettings!=""&&t.seriesSettings.dataSource==i&&t.dataSource!=""?(t.seriesSettings.dataSource=t.dataSource,t.seriesSettings.xName=t.seriesSettings.xName?t.seriesSettings.xName:t.xName,t.seriesSettings.yName=t.seriesSettings.yName?t.seriesSettings.yName:t.yName,r=t.series,r==""&&(r=[{dataSource:t.dataSource,xName:t.seriesSettings.xName,yName:t.seriesSettings.yName,type:"line",width:1.5,enableAnimation:!1}]),n(this.chartGView).ejChart({locale:this.model.locale,border:{width:0,color:"transparent"},margin:{left:0,right:0,top:0,bottom:0},elementSpacing:0,chartArea:{background:"transparent",border:{width:0}},primaryXAxis:{axisLine:{visible:!1},font:{size:"0px"},range:u,majorTickLines:{lineWidth:0,size:0,visible:!0},majorGridLines:{visible:!1},rangePadding:this.model.rangePadding,visible:!1,isInversed:this.model.enableRTL},primaryYAxis:this.model.valueAxisSettings,series:r,commonSeriesOptions:t.seriesSettings,size:{height:parseFloat(this.sliderHeight).toString(),width:parseFloat(this.newWidth-2*this.padding).toString(),padding:-10},legend:{visible:!1,itemSize:{height:0,width:0,borderColor:"transparent",borderWidth:0}}})):(t.series!=""&&t.series[0].dataSource!=i||t.seriesSettings!=""&&t.seriesSettings.dataSource!=i)&&(t.seriesSettings==""&&(t.seriesSettings={type:"line"}),r=t.series,o=r.length,r==""&&(r=[{dataSource:t.seriesSettings.dataSource,xName:t.seriesSettings.xName,yName:t.seriesSettings.yName,type:"line",width:1.5,enableAnimation:!1}]),n(this.chartGView).ejChart({locale:this.model.locale,border:{width:0,color:"transparent"},margin:{left:0,right:0,top:0,bottom:0},elementSpacing:0,chartArea:{background:"transparent",border:{width:0}},primaryXAxis:{axisLine:{visible:!1},range:u,font:{size:"0px"},majorTickLines:{lineWidth:0,size:0,visible:!0},majorGridLines:{visible:!1},rangePadding:this.model.rangePadding,visible:!1,isInversed:this.model.enableRTL},primaryYAxis:this.model.valueAxisSettings,series:r,commonSeriesOptions:t.seriesSettings,size:{height:parseFloat(this.sliderHeight).toString(),width:parseFloat(this.newWidth-2*this.padding).toString(),padding:-10},legend:{visible:!1,itemSize:{height:0,width:0,borderColor:"transparent",borderWidth:0}}}));this.ejChart=n(this.chartGView).data("ejChart");this.renderer._setAttr(n(this.chartGView),{transform:"translate("+this.padding+","+this.sliderPosition+")",height:this.sliderHeight})},_init:function(){var r,u,i;this._createSvg(this);r=n.extend({},t.EjSvgRender.commonChartEventArgs);r.data={model:this.model};this._trigger("load",r);u=this.model.scrollRangeSettings;this.renderNavigator(this);this.model.enableScrollbar&&(this.model.scrollObj=[],i=this.model.scrollObj,i[0]={orientation:"horizontal",index:0,width:this.scrollWidth,x:0,y:this.newHeight,isRTL:this.model.enableRTL,zoomPosition:this.scrollZoomPos,zoomFactor:this.scrollZoomFact,scrollRange:this._scrollRange,valueType:this.model.valueType,parent:this.element,enableResize:!0},i[0].valueType=="datetime"?(i[0].startDateTime=this.startDateTime,i[0].endDateTime=this.endDateTime):(i[0].startValue=this.startValue,i[0].endValue=this.endValue),this.scrollbarContainer=new t.EjSvgScrollbarRender(this.element,this.model.scrollObj[0]),this.scrollbarContainer._initializeScrollbarVariables.call(this,this.model.scrollObj[0]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[0]));this.model.enableAutoResizing||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents();this._bindevents()},bindResizeEvents:function(){if(this.model._rangeResizeEventRegistered)return 0;(!this.model.enableScrollbar||this.model.enableScrollbar&&this.svgSupport)&&this._on(n(window),"resize",this.rangeChange);this.model._rangeResizeEventRegistered=!0},removeResizeEvents:function(){this.model._rangeResizeEventRegistered&&(this._off(n(window),"resize",this.rangeChange),this.model._rangeResizeEventRegistered=!1)},rangeChange:function(){var n,i=this;this.rangeResize=!0;clearTimeout(n);t.isNullOrUndefined(window.orientation)?this.renderNavigator():n=setTimeout(function(){i.renderNavigator()},500);this.model.enableScrollbar&&(this.model.scrollObj[0].width=this.scrollWidth,this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[0]))},isDevice:function(){return/mobile|android|kindle/i.test(navigator.userAgent.toLowerCase())},isWindows:function(){if(!t.getBooleanVal(n("head"),"data-ej-android")&&!t.getBooleanVal(n("head"),"data-ej-ios")&&!t.getBooleanVal(n("head"),"data-ej-ios7")&&!t.getBooleanVal(n("head"),"data-ej-flat"))return this._windows()},_windows:function(){return/trident|windows phone/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-windows",!1)===!0},_bindevents:function(){var h=jQuery.uaMatch(navigator.userAgent),u=t.EjSvgRender.utils.browserInfo(),i=u.isMSPointerEnabled,r=u.pointerEnabled,e=i?r?"pointerdown":"MSPointerDown":"touchstart mousedown",f=i?r?"pointerup":"MSPointerUp":"touchend mouseup",o=i?r?"pointermove":"MSPointerMove":"touchmove mousemove",s=i?r?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.model.browserInfo=u;this._on(this.element,o,this._drag);this._on(this.element,s,this._leave);this._on(n(document),f,this._drop);this._on(n(this.element),e,this._grab);this._on(n(this.element),"contextmenu",this._rightClick);this._on(n("#"+this._id+"template_group_"),e,this._grab);this._on(n("#"+this._id+"template_group_"),o,this._drag);this._on(n("#"+this._id+"template_group_"),f,this._drop);this._on(n(window),f,this.mouseup);n(this.element).css("touch-action","none")},_initializeVariables:function(n,t,r){var f,u,o,s,v,h,c;this.ismouseup=!1;var e=this.model.rangeSettings,a=this.model.labelSettings.style,l=this.model.labelSettings.lowerLevel.style,y=this.model.labelSettings.higherLevel.style,p=this.model.scrollRangeSettings;if(y==""&&(this.model.labelSettings.higherLevel.style=a),l==""?this.model.labelSettings.lowerLevel.style=a:l!=i&&l.horizontalAlignment==i&&(this.model.labelSettings.lowerLevel.style.horizontalAlignment="middle"),this.model.valueType=="numeric"&&this.model.tooltipSettings.labelFormat=="MM/dd/yyyy"&&(this.model.tooltipSettings.labelFormat="d"),n.dataSource!=""&&n.xName!=""&&n.yName!="")if(f=t.length,f>0)for(u=0;u<f;u++)t[u].dataSource=n.dataSource,t[u].type=t[u].type?t[u].type:r.type?n.type:"line",t[u].xName=t[u].xName?t[u].xName:n.xName,t[u].yName=t[u].yName?t[u].yName:n.yName,this._processJsonData(t[u].dataSource,t[u]);else this._processJsonData(n.dataSource,this.model);else if(t!=""&&t!=i&&t[0].dataSource!=i&&t[0].xName!=i&&t[0].yName!=i)this._processJsonData(t[0].dataSource,t[0]);else if(r.dataSource!=i)if(f=t.length,f>0)for(u=0;u<f;u++)t[u].dataSource=r.dataSource,t[u].type=t[u].type?t[u].type:r.type?r.type:"line",t[u].xName=t[u].xName?t[u].xName:r.xName,t[u].yName=t[u].yName?t[u].yName:r.yName,this._processJsonData(t[u].dataSource,t[u]);else this._processJsonData(r.dataSource,r);else e.start!=""&&e.end!=""&&(o=startDateTime=e.start,s=endDateTime=e.end,this.model.enableScrollbar?(v=[o,s,new Date(o),new Date(s)],this.calculateZoomingRange.apply(this,v)):this.setRange.call(this,o,s,startDateTime,endDateTime));this.startDateTime!=i&&this.endDateTime!=i&&(this.model.valueType=="datetime"&&this.model.rangePadding=="round"&&(h=new Date(this.startValue),c=new Date(this.endValue),this.startDateTime=new Date(h.getFullYear(),h.getMonth(),h.getDate(),0,0,0),this.endDateTime=new Date(c.getFullYear(),c.getMonth(),c.getDate(),23,59,59)),this.startYear=this.startDateTime.getFullYear(),this.startMonth=this.startDateTime.getMonth(),this.endYear=this.endDateTime.getFullYear(),this.endMonth=this.endDateTime.getMonth())},setSliders:function(){var c=this.newWidth-this.padding*2,f=this.model.valueType,i=this.model.selectedRangeSettings.start,t=this.model.selectedRangeSettings.end,r=this.padding,e=this.startDateTime.getTime(),h=this.endDateTime.getTime(),u,o=this.startValue,s=this.endValue;this.eachInterval=f=="datetime"?c/parseFloat(h-e):c/parseFloat(s-o);u=this.eachInterval;this.model.enableScrollbar||(f=="datetime"?((i==""||new Date(i).getTime()<e)&&(i=this.startDateTime),(t==""||new Date(t).getTime()>h||new Date(t).getTime()<e)&&(t=this.endDateTime)):((i==""||i<o)&&(i=o),(t==""||t>s)&&(t=s)));this.model.enableRTL?f=="datetime"?(this.leftSliderPosition=(h-new Date(t).getTime())*u+r,this.rightSliderPosition=(h-new Date(i).getTime())*u+r,i=new Date(i),t=new Date(t)):(this.leftSliderPosition=(s-t)*u+r,this.rightSliderPosition=(s-i)*u+r):f=="datetime"?(this.leftSliderPosition=(new Date(i).getTime()-e)*u+r,this.rightSliderPosition=(new Date(t).getTime()-e)*u+r,i=new Date(i),t=new Date(t)):(this.leftSliderPosition=(i-o)*u+r,this.rightSliderPosition=(t-o)*u+r);this.setopacity=this.model.tooltipSettings.tooltipDisplayMode=="always"?1:0;this.model.enableScrollbar?this.leftSliderPosition>=r&&this.leftSliderPosition<this.newWidth-r?this.setSliderPositions(this.leftSliderPosition,null,null):this.leftSliderPosition>this.newWidth?(n(this.leftTooltip).hide(),n(this.gLeftSlider).hide()):(n(this.leftTooltip).hide(),n(this.gLeftSlider).hide(),n(this.leftUnSelected).hide()):this.setSliderPositions(this.leftSliderPosition,null,null);this.model.enableScrollbar?this.rightSliderPosition<=this.newWidth-r&&this.rightSliderPosition>r?this.setSliderPositions(null,null,this.rightSliderPosition):this.rightSliderPosition<0?(n(this.rightTooltip).hide(),n(this.gRightSlider).hide()):(n(this.rightTooltip).hide(),n(this.gRightSlider).hide(),n(this.rightUnSelected).hide()):this.setSliderPositions(null,null,this.rightSliderPosition);this.setopacity=1;this.model.enableDeferredUpdate&&(this._calculateSelectedData(),this._calculateSliderZoomFactPosition(),this._scrollChanged||(f=="datetime"?this.startDateTime.getTime()===i.getTime()&&(this.endDateTime.getTime()===t.getTime()||this.rangeResize)||this._trigger("rangeChanged",this.model):this.startValue===i&&(this.endValue===t||this.rangeResize)||this._trigger("rangeChanged",this.model)),this.rangeResize=!1)},centerSliderWidth:"",zoomp:0,zoomf:1,setSliderPositions:function(r,u,f){var w=this.model.locale,a=this.model.valueType,c,rt=this.model.labelSettings.higherLevel.labelPlacement,b,k,it,o,h,e,s;c=rt=="inside"?0:this.centerPosition;var v,p,tt=20,y=this.model.tooltipSettings.labelFormat;if(a=="numeric"&&(y.indexOf("e")==0||y.indexOf("E")==0)&&(p=y.match(/(\d+)/g),p=p==null?6:p>tt?tt:p),r!=null&&r>=this.padding&&r<this.newWidth-this.padding){if(this.leftSliderPosition=r,v=this.model.enableRTL?this.newWidth-r:r,o=a=="datetime"?v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval:v/this.eachInterval+this.startValue-this.padding/this.eachInterval,this.model.tooltipSettings.visible&&this.svgSupport&&this.leftTxt){this.leftTooltip.setAttribute("opacity",this.setopacity);this.leftTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w);var d=t.EjSvgRender.utils._measureText(this.leftTxt.textContent,null,this.model.tooltipSettings.font),e=d.width+15,s=d.height,g=this.brow!="msie"?(s+6)/2:s/2+6;this.leftTxt.setAttribute("y",g);this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z";this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z";r-e>=0?(this.leftTooltip.firstChild.setAttribute("d",this.leftd),this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+(r-e)+","+c+")"}),this.leftTxt.setAttribute("x",5)):r+e<this.rightTooltip.getCTM().e?(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+r+","+c+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd),this.leftTxt.setAttribute("x",10)):this.rightTooltip.getCTM().f<30?(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+r+","+(c+30)+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd)):(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+r+","+c+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd));r>this.newWidth-this.rightTooltip.lastChild.getBBox().width-15&&this.rightTooltip.getCTM().f<30&&this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+(r-e)+","+(c+30)+")"});this.rightTooltip.getCTM().f>=30&&r<this.rightTooltip.getCTM().e&&this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+this.rightTooltip.getCTM().e+","+c+")"})}this.ismouseup==!1?(this.renderer._setAttr(n(this.leftUnArea),{width:r-this.padding,transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+","+this.sliderPosition+")"}),this.leftCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.leftCircle),{cx:r}):this.renderer._setAttr(n(this.leftCircle),{transform:"translate("+parseFloat(r-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._leftValue={left:r-this.model.navigatorStyleSettings.thumbRadius,right:r+this.model.navigatorStyleSettings.thumbRadius}):(h=r-n("#"+this._id+"thumbleft").width()/2,n("#"+this._id+"thumbleft").css("left",h),this._leftValue={left:h,right:h+n("#"+this._id+"thumbleft").width()}),this.renderer._setAttr(n(this.centerSlider),{transform:"translate("+parseFloat(r)+","+this.sliderPosition+")"}),b=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left),b>0&&this.renderer._setAttr(n(this.centerSlider),{width:b})):(this.ismouseup=!1,this.renderer._setAttr(n(this.leftUnArea),{width:r-this.padding,transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+","+this.sliderPosition+")"}),this.leftCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.leftCircle),{cx:r}):this.renderer._setAttr(n(this.leftCircle),{transform:"translate("+parseFloat(r-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._leftValue={left:r-this.model.navigatorStyleSettings.thumbRadius,right:r+this.model.navigatorStyleSettings.thumbRadius}):(h=r-n("#"+this._id+"thumbleft").width()/2,n("#"+this._id+"thumbleft").css("left",h),this._leftValue={left:h,right:h+n("#"+this._id+"thumbleft").width()}),this.renderer._setAttr(n(this.centerSlider),{transform:"translate("+parseFloat(r)+","+this.sliderPosition+")"}),b=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left),b>0&&this.renderer._setAttr(n(this.centerSlider),{width:b}));this.model.zoomPosition=(r-this.padding)/(this.newWidth-this.padding*2);this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(n(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-this.padding*2);this.model.enableRTL?this.model.selectedRangeSettings.end=a=="datetime"?new Date(o):o:this.model.selectedRangeSettings.start=a=="datetime"?new Date(o):o;n(this.leftTooltip).show();n(this.gLeftSlider).show();n(this.leftUnSelected).show()}else if(f!=null&&f>this.padding){if(f>this.newWidth-this.padding+1&&(f=this.newWidth-this.padding),this.rightSliderPosition=f,it=new Date(this.model.rangeSettings.start),v=this.model.enableRTL?this.newWidth-f:f,o=v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,o=a=="datetime"?new Date(o):v/this.eachInterval+this.startValue-this.padding/this.eachInterval,this.model.enableRTL?this.model.selectedRangeSettings.start=o:this.model.selectedRangeSettings.end=o,this.model.tooltipSettings.visible&&this.svgSupport&&this.rightTxt){this.rightTooltip.setAttribute("opacity",this.setopacity);this.rightTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w);var d=t.EjSvgRender.utils._measureText(this.rightTxt.textContent,null,this.model.tooltipSettings.font),e=d.width+15,s=d.height,g=this.brow!="msie"?(s+6)/2:s/2+6;this.rightTxt.setAttribute("y",g);this.rightTxt.setAttribute("x",10);this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z";this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z";f+e<=this.newWidth?(this.rightTooltip.firstChild.setAttribute("d",this.rightd),this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+f+","+c+")"})):f+e>=this.newWidth&&f-e>this.centerSlider.getCTM().e?(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(f-e)+","+c+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd),this.rightTxt.setAttribute("x",5)):this.leftTooltip.getCTM().f<30?(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(f-e)+","+(c+30)+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd)):(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(f-e)+","+c+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd));f<this.leftTooltip.getCTM().e+e&&this.leftTooltip.getCTM().f<30&&this.leftSliderPosition>=this.padding&&this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+f+","+(c+30)+")"});this.leftTooltip.getCTM().f>=30&&f>this.leftTooltip.getCTM().e+e&&this.rightTooltip.getCTM().e>this.leftTooltip.getCTM().e+e&&(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+this.leftTooltip.getCTM().e+","+c+")"}),this.rightTxt.setAttribute("x",5))}k=this.newWidth-f-this.padding-2;k=k<0?0:k;this.renderer._setAttr(n(this.rightUnArea),{width:k,transform:"translate("+parseFloat(f+2)+","+this.sliderPosition+")"});this.renderer._setAttr(n(this.rightSlider),{transform:"translate("+f+","+this.sliderPosition+")"});this.rightCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.rightCircle),{cx:f}):this.renderer._setAttr(n(this.rightCircle),{transform:"translate("+parseFloat(f-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._rightValue={left:f-this.model.navigatorStyleSettings.thumbRadius,right:f+this.model.navigatorStyleSettings.thumbRadius}):(h=f-n("#"+this._id+"thumbright").width()/2,n("#"+this._id+"thumbright").css("left",h),this._rightValue={left:h,right:h+n("#"+this._id+"thumbright").width()});this.centerSliderWidth=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left);this.renderer._setAttr(n(this.centerSlider),{width:Math.abs(this.centerSliderWidth)});this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(n(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-this.padding*2);n(this.rightTooltip).show();n(this.gRightSlider).show();n(this.rightUnSelected).show()}else if(u!=null){var ut=this.renderer._getAttrVal(n(this.leftSlider),"width"),nt=this.newWidth-this.padding-2,l=u+parseFloat(this.renderer._getAttrVal(n(this.centerSlider),"width"));if(l>nt?(leftPosX=u=nt-parseFloat(this.renderer._getAttrVal(n(this.centerSlider),"width")),l=nt):leftPosX=u,it=new Date(this.model.rangeSettings.start),v=this.model.enableRTL?this.newWidth-leftPosX:leftPosX,leftPosX>=this.padding&&l<=this.newWidth-this.padding-2){if(o=v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,a=="datetime"&&(o=new Date(o)),this.model.enableRTL?this.model.selectedRangeSettings.end=o:this.model.selectedRangeSettings.start=o,this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+leftPosX+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+leftPosX+","+parseFloat(this.sliderPosition)+")"}),this.leftSliderPosition=leftPosX,this.leftCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.leftCircle),{cx:leftPosX}):this.renderer._setAttr(n(this.leftCircle),{transform:"translate("+parseFloat(leftPosX-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._leftValue={left:leftPosX-this.model.navigatorStyleSettings.thumbRadius,right:leftPosX+this.model.navigatorStyleSettings.thumbRadius}):(h=leftPosX-n("#"+this._id+"thumbleft").width()/2,n("#"+this._id+"thumbleft").css("left",h),this._leftValue={left:h,right:h+n("#"+this._id+"thumbleft").width()}),this.model.tooltipSettings.visible&&this.svgSupport&&this.leftTxt){this.leftTooltip.setAttribute("opacity",this.setopacity);this.leftTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w);var e=this.leftTooltip.lastChild.getBBox().width+15,s=this.leftTooltip.lastChild.getBBox().height,g=this.brow!="msie"?(s+6)/2:s/2+6;this.leftTxt.setAttribute("y",g);this.rightTxt.setAttribute("y",g);this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z";this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z";leftPosX-e>=0?(this.leftTooltip.firstChild.setAttribute("d",this.leftd),this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+(leftPosX-e)+","+c+")"}),this.leftTxt.setAttribute("x",5)):(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+leftPosX+","+c+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd),this.leftTxt.setAttribute("x",10),this.leftSliderPosition+e>this.rightSlider.getCTM().e&&this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+leftPosX+","+(c+30)+")"}))}v=this.model.enableRTL?this.newWidth-l:l;o=v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval;o=a=="datetime"?new Date(o):v/this.eachInterval+this.startValue-this.padding/this.eachInterval;this.model.enableRTL?this.model.selectedRangeSettings.start=o:this.model.selectedRangeSettings.end=o;this.renderer._setAttr(n(this.rightSlider),{transform:"translate("+l+","+this.sliderPosition+")"});this.rightSliderPosition=l;this.rightCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.rightCircle),{cx:l}):this.renderer._setAttr(n(this.rightCircle),{transform:"translate("+parseFloat(l-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._rightValue={left:l-this.model.navigatorStyleSettings.thumbRadius,right:l+this.model.navigatorStyleSettings.thumbRadius}):(h=l-n("#"+this._id+"thumbright").width()/2,n("#"+this._id+"thumbright").css("left",h),this._rightValue={left:h,right:h+n("#"+this._id+"thumbright").width()});this.model.tooltipSettings.visible&&this.svgSupport&&(this.rightTooltip.setAttribute("opacity",this.setopacity),this.rightTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w),e=this.rightTooltip.lastChild.getBBox().width+15,s=this.rightTooltip.lastChild.getBBox().height,this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z",this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z",l+e<=this.newWidth?(this.rightTooltip.firstChild.setAttribute("d",this.rightd),this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+l+","+c+")"}),this.rightTxt.setAttribute("x",10)):(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(l-e)+","+c+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd),this.rightTxt.setAttribute("x",5),this.rightTooltip.getBoundingClientRect().left<this.leftSlider.getBoundingClientRect().left&&this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(l-e)+","+(c+30)+")"})));this.renderer._setAttr(n(this.leftUnArea),{width:leftPosX-this.padding,transform:"translate("+this.padding+","+this.sliderPosition+")"});this.renderer._setAttr(n(this.rightUnArea),{transform:"translate("+parseFloat(l+2)+","+this.sliderPosition+")",width:this.newWidth-l-this.padding-2});this.model.zoomPosition=(this.leftSlider.getBoundingClientRect().left-this.padding)/(this.newWidth-this.padding*2);this.renderer._setAttr(n(this.centerSlider),{transform:"translate("+u+","+this.sliderPosition+")"});this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(n(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-this.padding*2);n(this.leftTooltip).show();n(this.rightTooltip).show()}}this._scrollChanged||this.isSelection||!this.model.enableDeferredUpdate&&this.leftSlider.getBoundingClientRect().left<this.rightSlider.getBoundingClientRect().left&&(this._calculateSelectedData(),(this.zoomp!=this.model.zoomPosition||this.zoomf!=this.model.zoomFactor)&&(this._calculateSliderZoomFactPosition(),this._trigger("rangeChanged",this.model),this.zoomp=this.model.zoomPosition,this.zoomf=this.model.zoomFactor))},_calculateSliderZoomFactPosition:function(){var f=this.model,r,e,o,n,t,u=f.selectedRangeSettings,i=f.scrollRangeSettings;f.valueType.toLowerCase()=="datetime"?(n=i.start?new Date(i.start):this.startDateTime,n=n<this.startDateTime?n:this.startDateTime,t=i.end?new Date(i.end):this.endDateTime,t=t>this.endDateTime?t:this.endDateTime,r=t-n,e=(new Date(u.start)-n)/r,o=(new Date(u.end)-new Date(u.start))/r):(n=i.start!=""?parseFloat(i.start):this.startValue,n=n<this.startValue?n:this.startValue,t=i.end!=""?parseFloat(i.end):this.endValue,t=t>this.endValue?t:this.endValue,r=t-n,e=(parseFloat(u.start)-n)/r,o=(parseFloat(u.end)-parseFloat(u.start))/r);f.zoomPosition=e;f.zoomFactor=o},_calculateSelectedData:function(){var u=[],f=0,e=this.model.valueType=="datetime",i=this.model.selectedRangeSettings.start,r=this.model.selectedRangeSettings.end,n,t;if(e&&(i=Date.parse(i),r=Date.parse(r)),n=this.model.dataSource!=""?this.model.dataSource:this.model.series!=""&&this.model.series[0].dataSource!=""?this.model.series[0].dataSource:null,n!=null)for(t=0;t<n.length-1;t++)currentValue=e?Date.parse(n[t][Object.keys(n[t])[0]]):n[t][Object.keys(n[t])[0]],i<=currentValue&¤tValue<=r&&(u[f]=n[t],f++);this.model.selectedData=u},calculateInterval:function(n,t){if(t._intervalType=t.intervalType?t.intervalType:"auto",t.visible===!0&&this.model.valueType=="datetime"&&this.calculateVisibleLabels(t,"lower",0),n.visible===!0&&this.model.valueType=="datetime"){if(n.intervalType&&n.intervalType.toLowerCase()!="auto")n._intervalType=n.intervalType;else switch(t._intervalType){case"years":n._intervalType="years";break;case"quarters":n._intervalType="years";break;case"months":n._intervalType="quarters";break;case"weeks":n._intervalType="months";break;case"days":n._intervalType="weeks";break;case"hours":n._intervalType="days";break;case"minutes":n._intervalType="hours"}n.autoInterval==!1?this.calculateVisibleLabels(n,"higher",0):this.calculateVisibleLabels(n,"higher",0)}t.visible===!0&&this.model.valueType=="numeric"&&this.setInterval(this)},calculateVisibleLabels:function(n,t,i){var f=n._intervalType,r,u;switch(f){case"auto":r=this.calculateDateTimeNiceInterval(this,this.startDateTime,this.endDateTime);u=r.intervalType.toLowerCase();n._intervalType=u;n._interval=r.interval;this.calculateVisibleLabels(n,t,i);break;case"years":this.setYearInterval(this,t);break;case"quarters":this.setQuarterInterval(this,t,i);break;case"months":this.setMonthInterval(this,t,i);break;case"weeks":this.setWeekInterval(this,t,i);break;case"days":this.setDayInterval(this,t,i);break;case"hours":this.setHourInterval(this,t,i);break;case"minutes":this.setMinuteInterval(this,t,i)}},setInterval:function(n){var f,s=this.endValue-this.startValue,o=n.model.rangePadding,u=this.startValue,t=this.calculateNumericInterval(n,s),i,e,r;for(o=="additional"?(this.endValue=this.endValue+t,this.startValue=this.startValue-t,s=this.endValue-this.startValue):o=="normal"?(i=0,u<0?(u=0,i=this.startValue+this.startValue/20,e=t+i%t,.365*t>=e&&(i-=t),i%t<0&&(i=i-t-i%t)):(i=u<5/6*this.endValue?0:u-(this.endValue-u)/2,i%t>0&&(i-=i%t)),r=this.endValue+(this.endValue-u)/20,e=t-r%t,.365*t>=e&&(r+=t),r%t>0&&(r=r+t-r%t),t=this.calculateNumericInterval(n,r-i),this.startValue=i,this.endValue=r):o=="round"&&(this.startValue=Math.floor(this.startValue/t*t),this.endValue=Math.ceil(this.endValue/t*t)),f=n.startValue,count=0;f<=n.endValue;)this._insertNumericText(n,f),count++,f=f+t;this.insertLabels(n,"lower")},calculateDateTimeNiceInterval:function(n,t,i){var u=Math.abs((t.getTime()-i.getTime())/864e5),r=this.calculateNumericInterval(n,u/365),f,e;return r>=1?{interval:r,intervalType:"Years"}:(r=this.calculateNumericInterval(n,u/90),r>=1)?{interval:r,intervalType:"Quarters"}:(r=this.calculateNumericInterval(n,u/30),r>=1)?{interval:r,interval1:r,intervalType:"Months"}:(r=this.calculateNumericInterval(n,u/7),r>=1)?{interval:r,intervalType:"Weeks",intervalType1:"Weeks"}:(r=this.calculateNumericInterval(n,u),r>=1)?{interval:r,intervalType:"Days"}:(f=u*24,r=this.calculateNumericInterval(n,f),r>=1)?{interval:r,intervalType:"Hours"}:(e=u*1440,r=this.calculateNumericInterval(n,e),{interval:r,intervalType:"Minutes"})},calculateNumericInterval:function(n,i){for(var f,e=this.GetDesiredIntervalsCount(n.newWidth),r=i/e,s=Math.pow(10,Math.floor(t.EjSvgRender.utils._logBase(r,10))),o=[10,5,2,1],u=0;u<o.length;u++){if(f=s*o[u],e<i/f)return r;r=f}return r},GetDesiredIntervalsCount:function(n){return Math.max(n*(.8/50),1)},setHourInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();Date.prototype.addHours=function(n){var t=new Date(this.valueOf());return t.getMilliseconds()!==0&&t.setMilliseconds(t.getMilliseconds()+(1e3-t.getMilliseconds())),t.getSeconds()!==0&&t.setSeconds(t.getSeconds()+(60-t.getSeconds())),t.getMinutes()!==0?t.setMinutes(t.getMinutes()+(60-t.getMinutes())):t.setHours(t.getHours()+n),t};var u=t.startDateTime,e=0,o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"hhtt",u,e,f,!1),o+=f,e++,u=u.addHours(1);o>=t.newWidth?t.setHourInterval(t,i,1):this.insertLabels(t,i);break;case 1:while(u<=t.endDateTime)f=this._insertText(t,i,"hht",u,e,f,!1),o+=f,e++,u=u.addHours(1);o>=t.newWidth?t.setHourInterval(t,i,2):this.insertLabels(t,i);break;case 2:while(u<=t.endDateTime)f=this._insertText(t,i,"hh",u,e,f,!1),o+=f,e++,u=u.addHours(1);o>=t.newWidth?(n(t.lowerLevel).empty(),t.model.labelSettings.lowerLevel._intervalType="days",t.setDayInterval(t,i,0)):this.insertLabels(t,i)}},setMinuteInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();Date.prototype.addMinutes=function(n){var t=new Date(this.valueOf());return t.getMilliseconds()!==0&&t.setMilliseconds(t.getMilliseconds()+(1e3-t.getMilliseconds())),t.getSeconds()!==0?t.setSeconds(t.getSeconds()+(60-t.getSeconds())):t.setMinutes(t.getMinutes()+n),t};var u=t.startDateTime,e=0,o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"mm",u,e,f,!1),o+=f,e++,u=u.addMinutes(1);o>=t.newWidth?(n(t.lowerLevel).empty(),t.model.labelSettings.lowerLevel._intervalType="hours",t.setHourInterval(t,i,0)):this.insertLabels(t,i)}},_emptyLabelBars:function(t,i){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty()},_insertWeekText:function(n,i,r,u,f,e){var s=n.model.labelSettings.higherLevel.style.font,h=n.model.labelSettings.lowerLevel.style.font,c,o,l;return i==="higher"?(n._higherTotalValues[f]=f==0?0:u.getTime()-n.startDateTime.getTime(),c={id:this._rootId+"_higLabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":s.size,"font-family":s.family,"font-style":s.style,"font-weight":s.weight,fill:s.color},n.renderer.drawText(c,r,n.higherLevel),n._higherTextNode[f]=n.higherLevel.childNodes[f],o={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].textContent,null,o):t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].innerHTML,null,o),e=Math.max(e,l.width)):(n._lowerTotalValues[f]=f==0?0:u.getTime()-n.startDateTime.getTime(),c={id:this._rootId+"_LabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":h.size,"font-family":h.family,"font-style":h.style,"font-weight":h.weight,fill:h.color},n.renderer.drawText(c,r,n.lowerLevel),n._lowerTextNode[f]=n.lowerLevel.childNodes[f],o={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].textContent,null,o):t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].innerHTML,null,o),e=Math.max(e,l.width)),e},setWeekInterval:function(n,i,r){this._emptyLabelBars(n,i);Date.prototype.getWeek=function(){var n=new Date(this.getTime()),t;return n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7),t=new Date(n.getFullYear(),0,4),1+Math.round(((n.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)};Date.prototype.dayOfWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][this.getDay()]};Date.prototype.addDays=function(n){var t=new Date(this.valueOf());return new Date(t.getFullYear(),t.getMonth(),t.getDate()+n)};Date.prototype.subDays=function(n){var t=new Date(this.valueOf());return new Date(t.getFullYear(),t.getMonth(),t.getDate()-n)};for(var u=n.startDateTime,e=0,o=0,f=0,s=this.model.locale,h=t.datavisualization.RangeNavigator.Locale[s]?t.datavisualization.RangeNavigator.Locale[s]:t.datavisualization.RangeNavigator.Locale["en-US"];u.dayOfWeek()!="Monday";)u=u.subDays(1);switch(r){case 0:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.longWeeks+u.getWeek()+t.format(u," MMMM, yyyy",s),u,e,f),o+=f,e++,u=u.addDays(7);o>=n.newWidth?n.setWeekInterval(n,i,1):this.insertLabels(n,i);break;case 1:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.longWeeks+u.getWeek()+t.format(u," MMM, yy",s),u,e,f),o+=f,e++,u=u.addDays(7);o>=n.newWidth?n.setWeekInterval(n,i,2):this.insertLabels(n,i);break;case 2:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.longWeeks+u.getWeek(),u,e,f),o+=f,e++,u=u.addDays(7);o>=n.newWidth?n.setWeekInterval(n,i,3):this.insertLabels(n,i);break;case 3:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.shortWeeks+u.getWeek(),u,e,f),o+=f,e++,u=u.addDays(7);this.insertLabels(n,i)}},setDayInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();Date.prototype.addDays=function(){var n=new Date(this.valueOf());return new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)};var u=t.startDateTime,e=0,o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"dddd, MMMM d, yyyy",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,1):this.insertLabels(t,i);break;case 1:while(u<=t.endDateTime)f=this._insertText(t,i,"ddd, MMM d, yy",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,2):this.insertLabels(t,i);break;case 2:while(u<=t.endDateTime)f=this._insertText(t,i,"dddd, d",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,3):this.insertLabels(t,i);break;case 3:while(u<=t.endDateTime)f=this._insertText(t,i,"MMM, d",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,4):this.insertLabels(t,i);break;case 4:while(u<=t.endDateTime)f=this._insertText(t,i,"dd",u,e,f,!1),o+=f,e++,u=u.addDays();this.insertLabels(t,i)}},setMonthInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();var u=t.startDateTime,s=5,e=0,h=new Date(t.startDateTime),o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"MMMM, yyyy",u,e,f,!1),o+=f,e++,u=u.addMonths();o+s>=t.newWidth?t.setMonthInterval(t,i,1):this.insertLabels(t,i);break;case 1:while(u<=t.endDateTime)f=this._insertText(t,i,"MMMM",u,e,f,!1),o+=f,e++,u=u.addMonths();o+s>=t.newWidth?t.setMonthInterval(t,i,2):this.insertLabels(t,i);break;case 2:while(u<=t.endDateTime)f=this._insertText(t,i,"MMM",u,e,f,!1),o+=f,e++,u=u.addMonths();o+s>=t.newWidth?t.setMonthInterval(t,i,3):this.insertLabels(t,i);break;case 3:while(u<=t.endDateTime)f=this._insertText(t,i,"MMM",u,e,f,!0),o+=f,e++,u=u.addMonths();this.insertLabels(t,i)}},_quarter:function(n,i,r,u,f,e,o){for(var c,s,h,l,a,v=n.startYear;v<=n.endYear;v++)if(c=u!=null?t.format(f,u,n.model.locale):"",v===n.startYear)for(s=n.startMonth;s<=11&&f<=this.endDateTime;s++)h=i=="higher"?{id:this._rootId+"_higLabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight,fill:n.model.labelSettings.higherLevel.style.font.color}:{id:this._rootId+"_LabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight,fill:n.model.labelSettings.lowerLevel.style.font.color},s>=0&&s<=2?(i=="higher"?n.renderer.drawText(h,r+"1 "+c,n.higherLevel):n.renderer.drawText(h,r+"1 "+c,n.lowerLevel),f=new Date(f.setMonth(3)),k=2):s>=3&&s<=5?(i=="higher"?n.renderer.drawText(h,r+"2 "+c,n.higherLevel):n.renderer.drawText(h,r+"2 "+c,n.lowerLevel),f=new Date(f.setMonth(6)),k=5):s>=6&&s<=8?(i=="higher"?n.renderer.drawText(h,r+"3 "+c,n.higherLevel):n.renderer.drawText(h,r+"3 "+c,n.lowerLevel),f=new Date(f.setMonth(9)),k=8):s>=9&&s<=11&&(i=="higher"?n.renderer.drawText(h,r+"4 "+c,n.higherLevel):n.renderer.drawText(h,r+"4 "+c,n.lowerLevel),f=new Date(f.setMonth(12)),k=11),i==="lower"?(n._lowerTotalValues[o]=s===n.startMonth?n.startDateTime.getTime()-n.startDateTime.getTime():new Date(n.startYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._lowerTextNode[o]=n.lowerLevel.childNodes[o],l={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[o].textContent,null,l),e+=a.width):(n._higherTotalValues[o]=s===n.startMonth?n.startDateTime.getTime()-n.startDateTime.getTime():new Date(n.startYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._higherTextNode[o]=n.higherLevel.childNodes[o],l={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[o].textContent,null,l),e+=a.width),o++;else if(v===n.endYear)for(s=0;s<=n.endMonth;s++)h=i=="higher"?{id:this._rootId+"_higLabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight}:{id:this._rootId+"_LabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight},s>=0&&s<=2?(i=="higher"?n.renderer.drawText(h,r+"1 "+c,n.higherLevel):n.renderer.drawText(h,r+"1 "+c,n.lowerLevel),f=new Date(f.setMonth(3)),k=2):s>=3&&s<=5?(i=="higher"?n.renderer.drawText(h,r+"2 "+c,n.higherLevel):n.renderer.drawText(h,r+"2 "+c,n.lowerLevel),f=new Date(f.setMonth(6)),k=5):s>=6&&s<=8?(i=="higher"?n.renderer.drawText(h,r+"3 "+c,n.higherLevel):n.renderer.drawText(h,r+"3 "+c,n.lowerLevel),f=new Date(f.setMonth(9)),k=8):s>=9&&s<=11&&(i=="higher"?n.renderer.drawText(h,r+"4 "+c,n.higherLevel):n.renderer.drawText(h,r+"4 "+c,n.lowerLevel),f=new Date(f.setMonth(12)),k=11),i==="lower"?(n._lowerTotalValues[o]=new Date(n.endYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._lowerTextNode[o]=n.lowerLevel.childNodes[o],l={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[o].textContent,null,l),e+=a.width):(n._higherTotalValues[o]=new Date(n.endYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._higherTextNode[o]=n.higherLevel.childNodes[o],l={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[o].textContent,null,l),e+=a.width),o++;else for(s=0;s<=11;s++)h=i=="higher"?{id:this._rootId+"_higLabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight}:{id:this._rootId+"_LabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight},s>=0&&s<=2?(i=="higher"?n.renderer.drawText(h,r+"1 "+c,n.higherLevel):n.renderer.drawText(h,r+"1 "+c,n.lowerLevel),f=new Date(f.setMonth(3)),k=2):s>=3&&s<=5?(i=="higher"?n.renderer.drawText(h,r+"2 "+c,n.higherLevel):n.renderer.drawText(h,r+"2 "+c,n.lowerLevel),f=new Date(f.setMonth(6)),k=5):s>=6&&s<=8?(i=="higher"?n.renderer.drawText(h,r+"3 "+c,n.higherLevel):n.renderer.drawText(h,r+"3 "+c,n.lowerLevel),f=new Date(f.setMonth(9)),k=8):s>=9&&s<=11&&(i=="higher"?n.renderer.drawText(h,r+"4 "+c,n.higherLevel):n.renderer.drawText(h,r+"4 "+c,n.lowerLevel),f=new Date(f.setMonth(12)),k=11),i==="lower"?(n._lowerTotalValues[o]=new Date(v+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._lowerTextNode[o]=n.lowerLevel.childNodes[o],l={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[o].textContent,null,l),e+=a.width):(n._higherTotalValues[o]=new Date(v+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._higherTextNode[o]=n.higherLevel.childNodes[o],l={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[o].textContent,null,l),e+=a.width),o++;return e},setQuarterInterval:function(i,r,u){i._higherTextNode=[];i._higherTotalValues=[];i._lowerTextNode=[];i._lowerTotalValues=[];r==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();var e=new Date(i.startDateTime),o=0,f=0,s=this.model.locale,h=t.datavisualization.RangeNavigator.Locale[s]?t.datavisualization.RangeNavigator.Locale[s]:t.datavisualization.RangeNavigator.Locale["en-US"];switch(u){case 0:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.longQuarters,"yyyy",e,f,o);f>=i.newWidth-this.padding?i.setQuarterInterval(i,r,1):this.insertLabels(i,r);break;case 1:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.longQuarters,"yy",e,f,o);f>=i.newWidth-this.padding?i.setQuarterInterval(i,r,2):this.insertLabels(i,r);break;case 2:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.shortQuarters,"yyyy",e,f,o);f>=i.newWidth-this.padding?i.setQuarterInterval(i,r,3):this.insertLabels(i,r);break;case 3:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.shortQuarters,null,e,f,o);this.insertLabels(i,r)}},_insertText:function(n,i,r,u,f,e,o){var c=n.model.locale,s,h,l;return Date.prototype.addYears=function(n){var t=new Date(this.valueOf());return t.getMilliseconds()!==0||t.getSeconds()!==0||t.getMinutes()!==0||t.getHours()!==0||t.getDate()!==0||t.getMonth()!==0?t=new Date(t.getFullYear()+1,0,1):t.setYear(t.getFullYear()+n),t},Date.prototype.addMonths=function(){var n=new Date(this.valueOf());return new Date(n.getFullYear(),n.getMonth()+1,1)},i==="higher"?(n._higherTotalValues[f]=u.getTime()-n.startDateTime.getTime(),s={id:this._rootId+"_higLabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight,fill:n.model.labelSettings.higherLevel.style.font.color},o==!1?n.renderer.drawText(s,t.format(u,r,c),n.higherLevel):n.renderer.drawText(s,t.format(u,r,c).toString().substring(0,1),n.higherLevel),n._higherTextNode[f]=n.higherLevel.childNodes[f],h={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].textContent,null,h):t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].innerHTML,null,h),e=Math.max(e,l.width)):(n._lowerTotalValues[f]=u.getTime()-n.startDateTime.getTime(),s={id:this._rootId+"_LabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight,fill:n.model.labelSettings.lowerLevel.style.font.color},o==!1?n.renderer.drawText(s,t.format(u,r,c),n.lowerLevel):n.renderer.drawText(s,t.format(u,r,c).substring(0,1),n.lowerLevel),n._lowerTextNode[f]=n.lowerLevel.childNodes[f],h={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].textContent,null,h):t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].innerHTML,null,h),e=Math.max(e,l.width)),e},_insertNumericText:function(n,i){var r,f,u,e;n._lowerTotalValues[count]=i-n.startValue;r=n.model.labelSettings.style.font;f={id:this._rootId+"_LabelBarText_"+count,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":r.size,"font-family":r.family,"font-style":r.style,"font-weight":r.weight,fill:r.color};n.renderer.drawText(f,i,n.lowerLevel);n._lowerTextNode[count]=n.lowerLevel.childNodes[count];u={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily};e=this.svgSupport?t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[count].textContent,null,u):t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[count].innerHTML,null,u)},setYearInterval:function(n,t){var i=n.startDateTime;for(count=0;i<=n.endDateTime;)this._insertText(n,t,"yyyy",i,count,0,!1),count++,i=i.addYears(1);this.insertLabels(n,t)},_applyPadding:function(){for(var n=0;n<this._higherTotalValues.length;n++)this._higherTotalValues[n]+=this.padding;for(n=0;n<this._lowerTotalValues.length;n++)this._lowerTotalValues[n]+=this.padding},insertLabels:function(r,u){var g=jQuery.uaMatch(navigator.userAgent),rt=this.model.labelSettings.lowerLevel.gridLineStyle.color,y,d,b,h,ut,tt,l,it,a,k;this.lgClr=this.renderer.createGradientElement("lgColor",rt,150,0,150,100,this.svgDocument);y=this.model.valueType;d=parseFloat(this.renderer._getAttrVal(n(r.svgDocument),"width"));this.eachInterval=y=="datetime"?(d-this.padding*2)/parseFloat(this.endDateTime.getTime()-this.startDateTime.getTime()):(d-this.padding*2)/parseFloat(this.endValue-this.startValue);var p=0,o=0,s,e,c,v,w,f,nt=r._higherTextNode.length;if(lowerLevelLabels=[],higherLevelLabels=[],b=0,u==="higher"&&r.model.labelSettings.higherLevel.visible===!0){for(r.model.labelSettings.higherLevel.position=="top"&&r.model.labelSettings.lowerLevel.position=="top"?(s={x:this.padding,y:1,width:r.newWidth>0?r.newWidth-r.padding*2:0,height:r.minHighHeight,stroke:r.model.labelSettings.higherLevel.border.color,"stroke-width":r.model.labelSettings.higherLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.higherLevel)):r.model.labelSettings.higherLevel.position=="top"?(s={x:this.padding,y:1,width:r.newWidth-r.padding*2,height:r.minHighHeight,stroke:r.model.labelSettings.higherLevel.border.color,"stroke-width":r.model.labelSettings.higherLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.higherLevel)):(s={x:this.padding,y:r.bottomPosition,width:r.newWidth>0?r.newWidth-r.padding*2:0,height:r.minHighHeight,stroke:r.model.labelSettings.higherLevel.border.color,"stroke-width":r.model.labelSettings.higherLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.higherLevel)),r._higherLineLeft=[],e=r.model.enableRTL?r.newWidth-(r._higherTotalValues[r._higherTextNode.length-1]*this.eachInterval+this.padding):r._higherTotalValues[p]*this.eachInterval+this.padding,r.model.enableRTL?(f=r._higherTextNode.length-1,h=!0):(f=0,h=!1),ut=0;h?f>=0:f<r._higherTextNode.length;h?f--:f++){if(r._higherLineLeft[f]=e,w={size:r.model.labelSettings.higherLevel.style.font.size,fontStyle:r.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:r.model.labelSettings.higherLevel.style.font.fontFamily},v=t.EjSvgRender.utils._measureText(r.higherLevel.childNodes[p].textContent,null,w),o=v.width,c=r._higherTotalValues[f+1]===i?h?0:r.newWidth:h?r.newWidth-(r._higherTotalValues[f+1]*this.eachInterval+this.padding):r._higherTotalValues[f+1]*this.eachInterval+this.padding,l=r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?h?c-(c-e)/2-o/2:(c-e)/2+e-o/2:r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?h?c+10:e+10:h?e-o-2:c-o-2,this.model.enableScrollbar&&((!h&&f==0||h&&nt==f)&&(this.firstLabelPosition=l+o),(!h&&f==1||h&&nt-1==f)&&this.firstLabelPosition>e&&(r._higherTextNode[h?f+1:f-1].textContent="")),r.renderer._setAttr(n(r._higherTextNode[f]),{x:l}),r.renderer._setAttr(n(r._higherTextNode[f]),{fill:r.model.labelSettings.higherLevel.style.font.color}),r._higherTextLeft[f]=l,r.model.labelSettings.higherLevel.position=="top"&&r.model.labelSettings.lowerLevel.position=="top"?(r._higherTextNode[f].setAttribute("y",r.minHighHeight-5),s={x1:e,y1:"0",x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.higherLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.higherLevel)):r.model.labelSettings.higherLevel.position=="top"?(this.svgSupport?g.browser.toLowerCase()=="msie"?r._higherTextNode[f].setAttribute("y",r.centerPosition-5):r._higherTextNode[f].setAttribute("y",r.centerPosition-9):r.renderer._setAttr(n(r._higherTextNode[f]),{y:r.centerPosition/2-5}),s={x1:e,y1:"0",x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.higherLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.higherLevel)):(r._higherTextNode[f].setAttribute("y",r.newHeight-5),s={x1:e,y1:this.bottomPosition,x2:e,y2:r.newHeight,stroke:r.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.higherLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.higherLevel)),(l<this.padding||r.newWidth-e-this.padding<o)&&y=="datetime")if(h)l<this.padding&&e-this.padding>o?r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?r._higherTextNode[f].setAttribute("x",this.padding+(e-this.padding)/2-o/2):r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?r._higherTextNode[f].setAttribute("x",this.padding+10):r._higherTextNode[f].setAttribute("x",e-o-2):r.newWidth-e<o&&r.newWidth-c-this.padding>o?r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?r._higherTextNode[f].setAttribute("x",c+(r.newWidth-c-this.padding)/2-o/2):r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?r._higherTextNode[f].setAttribute("x",c+10):r._higherTextNode[f].setAttribute("x",r.newWidth-o-2-this.padding):r.higherLevel.removeChild(r._higherTextNode[f]);else{r.higherLevel.removeChild(r._higherTextNode[f]);continue}else if(l+o>r.newWidth-this.padding&&y=="datetime"){l=r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?e+(r.newWidth-e-this.padding)/2-o/2:r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?e:r.newWidth-o*3/2;r._higherTextNode[f].setAttribute("x",l);continue}e=this.model.enableRTL?r.newWidth-(r._higherTotalValues[f-1]*this.eachInterval+this.padding):r._higherTotalValues[f+1]*this.eachInterval+this.padding;p++}for(a=0,k=r._higherLineLeft.length;a<k;a++)v=t.EjSvgRender.utils._measureText(r.higherLevel.childNodes[a].textContent,null,w),this.svgSupport?higherLevelLabels.push({size:v,x:r._higherLineLeft[a],y:r._higherTextNode[a].getAttribute("y")-v.height/2+b,lableType:"higherLevel"}):higherLevelLabels.push({size:v,x:r._higherLineLeft[a],y:r._higherTextNode[a].offsetTop-v.height/2+b,lableType:"higherLevel"});this._addLabelsRegion(r,higherLevelLabels)}else if(r.model.labelSettings.lowerLevel.visible===!0){for(r._lowerLineLeft=[],e=r.model.enableRTL?r.newWidth-(r._lowerTotalValues[r._lowerTextNode.length-1]*this.eachInterval+this.padding):r._lowerTotalValues[p]*this.eachInterval+this.padding,tt=r.model.labelSettings.higherLevel.visible?r.bottomPosition:r.centerHeight,r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="top"?(s={x:this.padding,y:tt,width:this.newWidth-r.padding*2,height:r.minLowHeight-1,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},y!="numeric"&&r.renderer.drawRect(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="bottom"?(s={x:this.padding,y:r.centerHeight,width:this.newWidth>0?this.newWidth-r.padding*2:0,height:r.minLowHeight-1,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="top"&&r.model.labelSettings.higherLevel.position==="bottom"?(s={x:this.padding,y:0,width:this.newWidth>0?this.newWidth-r.padding*2:0,height:r.minLowHeight-1,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.lowerLevel)):r.model.labelSettings.higherLevel.position==="top"&&r.model.labelSettings.lowerLevel.position==="top"&&(s={x:this.padding,y:r.minHighHeight-1,width:this.newWidth>0?this.newWidth-r.padding*2:0,height:r.minLowHeight,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.lowerLevel)),r.model.enableRTL?(f=r._lowerTextNode.length-1,h=!0):(f=0,h=!1);h?f>=0:f<r._lowerTextNode.length;h?f--:f++)r._lowerLineLeft[f]=e,w={size:r.model.labelSettings.lowerLevel.style.font.size,fontStyle:r.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:r.model.labelSettings.lowerLevel.style.font.fontFamily},v=t.EjSvgRender.utils._measureText(r.lowerLevel.childNodes[p].textContent,null,w),o=v.width,l=0,c=r._lowerTotalValues[f+1]===i?h?0:r.newWidth:h?r.newWidth-(r._lowerTotalValues[f+1]*this.eachInterval+this.padding):r._lowerTotalValues[f+1]*this.eachInterval+this.padding,l=r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?h?(e-c)/2+c-o/2:(c-e)/2+e-o/2:r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?h?c+2:e+2:h?e-o-2:c-o-2,y=="numeric"&&(l=e-o/2),r.renderer._setAttr(n(r._lowerTextNode[f]),{x:l}),r.renderer._setAttr(n(r._lowerTextNode[f]),{fill:r.model.labelSettings.lowerLevel.style.font.color}),r._lowerTextLeft[f]=l,r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="top"?(this.svgSupport?g.browser.toLowerCase()=="msie"?r._lowerTextNode[f].setAttribute("y",r.newHeight-5):r._lowerTextNode[f].setAttribute("y",r.newHeight-9):r.renderer._setAttr(n(r._lowerTextNode[f]),{y:r.newHeight-v.height}),it=r.model.labelSettings.higherLevel.visible?parseFloat(r.minHighHeight+r.centerHeight):r.minHighHeight,s={x1:e,y1:it,x2:e,y2:r.newHeight,stroke:this.lgClr,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&y!="numeric"&&r.renderer.drawLine(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="bottom"?(r._lowerTextNode[f].setAttribute("y",r.bottomPosition-5),s={x1:e,y1:r.centerHeight,x2:e,y2:r.bottomPosition,stroke:r.model.labelSettings.lowerLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="top"&&r.model.labelSettings.higherLevel.position==="bottom"?(r._lowerTextNode[f].setAttribute("y",r.centerPosition-5),s={x1:e,y1:0,x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.lowerLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.lowerLevel)):r.model.labelSettings.higherLevel.position==="top"&&r.model.labelSettings.lowerLevel.position==="top"&&(r._lowerTextNode[f].setAttribute("y",r.centerPosition-5),s={x1:e,y1:r.minHighHeight,x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.lowerLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.lowerLevel)),(l<this.padding||r.newWidth-e-this.padding<o)&&y=="datetime"?h?(l<this.padding&&e-this.padding>o?r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?r._lowerTextNode[f].setAttribute("x",this.padding+(e-this.padding)/2-o/2):r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?r._lowerTextNode[f].setAttribute("x",this.padding+10):r._lowerTextNode[f].setAttribute("x",e-o-2):r.newWidth-e<o&&r.newWidth-this.padding-c>o?r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?r._lowerTextNode[f].setAttribute("x",c+(r.newWidth-c-this.padding)/2-o/2):r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?r._lowerTextNode[f].setAttribute("x",c+10):r._lowerTextNode[f].setAttribute("x",r.newWidth-o-2-this.padding):r.lowerLevel.removeChild(r._lowerTextNode[f]),p--):(r.lowerLevel.removeChild(r._lowerTextNode[f]),p--):l+o>r.newWidth-this.padding&&y=="datetime"&&(l=r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?e+(r.newWidth-e-this.padding)/2-o/2:r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?e:r.newWidth-o*3/2,r._lowerTextNode[f].setAttribute("x",l)),e=this.model.enableRTL?r.newWidth-(r._lowerTotalValues[f-1]*this.eachInterval+this.padding):r._lowerTotalValues[f+1]*this.eachInterval+this.padding,p++;for(a=0,k=r._lowerLineLeft.length;a<k;a++)v=t.EjSvgRender.utils._measureText(r.lowerLevel.childNodes[a].textContent,null,w),this.svgSupport?lowerLevelLabels.push({size:v,x:r._lowerLineLeft[a],y:r._lowerTextNode[a].getAttribute("y")-v.height/2+b,lableType:"lowerLevel"}):lowerLevelLabels.push({size:v,x:r._lowerLineLeft[a],y:r._lowerTextNode[a].offsetTop+b,lableType:"lowerLevel"});this._addLabelsRegion(r,lowerLevelLabels)}r.model.enableRTL?r._lowerLineLeft.push(this.padding):r._lowerLineLeft.push(this.newWidth-this.padding);r._setGridlines(r);n(this.higherLevel).css("cursor","pointer");n(this.lowerLevel).css("cursor","pointer")},_addLabelsRegion:function(n,t){var r,f,u,e=t.length,i;if(e==1)n.labelRegions.push({X:t[0].x,Y:t[0].y,Height:t[0].size.height,Width:n.newWidth-t[0].x,LabelType:t[0].lableType});else for(i=0;i<e;i++)n.model.enableRTL?(r=t[i+1]?t[i].x-t[i+1].x:t[i].x-parseInt(n.model.padding),u=t[i+1]?t[i+1].x:parseInt(n.model.padding)):(r=t[i+1]?t[i+1].x-t[i].x:n.newWidth-t[i].x-parseInt(n.model.padding),u=t[i].x),f=t[i+1]?t[i].size.height:t[i-1].size.height,n.labelRegions.push({X:u,Y:t[i].y,Height:f,Width:r,LabelType:t[i].lableType})},_setGridlines:function(n){var t,i;if(n.model.navigatorStyleSettings.minorGridLineStyle.visible===!0)for(t=1;t<n._lowerTextNode.length;t++)n.model.labelSettings.higherLevel.position=="top"&&n.model.labelSettings.lowerLevel.position=="top"?(i={x1:n._lowerLineLeft[t],y1:n.centerHeight+n.minLowHeight+n.minHighHeight,x2:n._lowerLineLeft[t],y2:n.centerPosition,stroke:n.model.navigatorStyleSettings.minorGridLineStyle.color,"stroke-width":"1"},n.renderer.drawLine(i,n.centerLevel)):(i={x1:n._lowerLineLeft[t],y1:n.centerPosition,x2:n._lowerLineLeft[t],y2:n.centerPosition+n.centerHeight,stroke:n.model.navigatorStyleSettings.minorGridLineStyle.color,"stroke-width":"1"},n.renderer.drawLine(i,n.centerLevel));else for(t=0;t<n._higherTextNode.length;t++)i={x1:n._higherLineLeft[t],y1:n.centerHeight+n.minLowHeight,x2:n._higherLineLeft[t],y2:n.centerPosition,stroke:n.model.navigatorStyleSettings.majorGridLineStyle.color,"stroke-width":"1"},n.renderer.drawLine(i,n.centerLevel)},bindTo:function(){t.util.isNullOrUndefined(this.model.dataSource)||this.model.dataSource!=null&&this.model.dataSource.length>0&&this._processJsonData(this.model.dataSource,this.model)},_processJsonData:function(n,r){for(var f,a,e,o,s,v,h=[],y=[],p=0,u=0;u<n.length;u++)typeof n[u][r.xName]=="string"&&n[u][r.xName].indexOf("/Date(")!=-1&&(n[u][r.xName]=new Date(parseInt(n[u][r.xName].substr(6)))),jQuery.type(n[u][r.xName])!="string"&&jQuery.type(n[u][r.xName])!="date"?h.push(parseFloat(t.util.isNullOrUndefined(n[u][r.xName])?u:n[u][r.xName])):h.push(t.util.isNullOrUndefined(n[u][r.xName])?u:n[u][r.xName]);if(!t.util.isNullOrUndefined(r.yName))for(f=0;f<r.yName.length;f++){for(a=[],e=0;e<n.length;e++)a.push(n[e][r.yName[f]]===null||n[e][r.yName[f]]===i?n[e][r.yName[f]]:parseFloat(n[e][r.yName[f]]));y[f]=a;p=f+1}o=new Date(Math.max.apply(null,h));s=new Date(Math.min.apply(null,h));o.getTime()==s.getTime()&&(s.setHours(0),o.setHours(23));var c=s.getTime(),l=o.getTime(),w=this.model.scrollRangeSettings;this.model.enableScrollbar?(this._scrollRange||this.scrollbarUpdate)&&this.scrollbarUpdate?this._scrollRange={min:Math.min(this._scrollRange.min,c),max:Math.max(this._scrollRange.max,l),delta:l-c}:(v=[c,l,s,o],this.calculateZoomingRange.apply(this,v)):this.setRange.call(this,c,l,s,o)},calculateZoomingRange:function(n,t,i,r){return this.calculateZoomFactorPosition.call(this,n,t,i,r),this.setRange.call(this,n,t,i,r),0},setRange:function(n,t,i,r){var u=this.model.rangeSettings;return u.start!=""&&u.end!=""?(this.startDateTime=new Date(u.start),this.endDateTime=new Date(u.end),this.startValue=u.start,this.endValue=u.end):(this.startDateTime=new Date(i),this.startValue=n,this.endDateTime=new Date(r),this.endValue=t),0},calculateZoomFactorPosition:function(n,t,i,r){var l=this.model,h=l.rangeSettings,u,a,v,f=i,e=r,o=n,s=t,c=l.scrollRangeSettings;return l.valueType.toLowerCase()=="datetime"?(f=Date.parse(c.start?new Date(c.start):i),f=Math.min(f,Date.parse(i)),f=h.start!=""?Math.min(f,Date.parse(new Date(h.start))):f,e=Date.parse(c.end?new Date(c.end):r),e=Math.max(e,Date.parse(r)),e=h.end!=""?Math.max(e,Date.parse(new Date(h.end))):e,u=e-f,l.enableRTL?(a=(e-r)/u,v=(r-i)/u):(a=(i-f)/u,v=(r-i)/u),this._scrollRange={min:f,max:e,delta:e-f}):(o=c.start!=""?parseFloat(c.start):n,o=Math.min(o,n),o=h.start!=""?Math.min(o,parseFloat(h.start)):o,s=c.end!=""?parseFloat(c.end):t,s=Math.max(s,t),s=h.end!=""?Math.max(s,parseFloat(h.end)):s,u=s-o,l.enableRTL?(a=(s-t)/u,v=(t-n)/u):(a=(n-o)/u,v=(t-n)/u),this._scrollRange={min:o,max:s,delta:s-o}),this.scrollZoomPos=a,this.scrollZoomFact=v,0},mousePosition:function(n){if(!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=i){if(!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},calTouchPosition:function(t){var f=jQuery.uaMatch(navigator.userAgent),i=this.mousePosition(t),r,u,e;return t.pageX=i.x,t.pageY=i.y,e=f.browser.toLowerCase(),r=t.pageX-n(this.svgDocument).offset().left,u=t.pageY-n(this.svgDocument).offset().top,this.leftPadding=n(this.svgDocument).offset().left,{X:r,Y:u}},calMousePosition:function(t){var u=jQuery.uaMatch(navigator.userAgent),i,r;return u.browser.toLowerCase()=="mozilla"||u.browser.toLowerCase()=="webkit"?(i=t.pageX-n(this.svgDocument).parent().offset().left,r=t.pageY-n(this.svgDocument).parent().offset().top,this.leftPadding=0,this.grabPadding=0):(i=(t.originalEvent?t.originalEvent.pageX:t.pageX)-n(this.svgDocument).offset().left,r=(t.originalEvent?t.originalEvent.pageY:t.pageY)-n(this.svgDocument).offset().top,this.leftPadding=n(this.svgDocument).offset().left),{X:i,Y:r}},_performSelection:function(t){var i=this,s=i.model,r=s.navigatorStyleSettings.selectionSettings,h=r.color,u=t.target.parentNode.id,f=u=="leftslider"||u=="rightslider"||u==i._id+"thumbleft"||u==i._id+"thumbright",e=i.model.valueType,o;i._sliderHover=f||i.switched;i.selectionGrad=i.renderer.createGradientElement("selectionGrad",h,150,0,150,100,i.svgDocument);i.isNumericType=u!=i._id;(!i.isNumericType||e!="numeric")&&e=="numeric"||f||i.switched||(n("#highlightRect"+i._id).hide(),n("#selectionRect"+i._id).length==0&&(i.gselection=i.renderer.createGroup({id:"selectionRect"+i._id}),o={height:i.sliderHeight,opacity:r.opacity,stroke:r.border.color,"stroke-width":r.border.width},i.renderer.drawRect(o,i.gselection),i.selectionRect=i.gselection.firstChild,i.renderer.append(i.gselection,i.styleRect)),i.rect=i.selectionRect,i.startX=i.mouseDownX,i.renderer._setAttr(n(i.selectionRect),{fill:i.selectionGrad}),i.renderer._setAttr(n(i.selectionRect),{stroke:r.border.color}),i._highlight.call(i,i,t))},_performHighlight:function(t){var i=this,e=i.model,r=t.target.parentNode.id,u=e.navigatorStyleSettings.highlightSettings,o=u.color,s=r=="leftslider"||r=="rightslider"||r==this._id+"thumbleft"||r==this._id+"thumbright",f;this.highlightGrad=this.renderer.createGradientElement("highlightGrad",o,150,0,150,100,this.svgDocument);n("#highlightRect"+this._id).hide();s||this.isSelection||this._sliderHover||i.switched||(n("#highlightRect"+this._id).length==0&&(this.gHighlight=this.renderer.createGroup({id:"highlightRect"+this._id}),f={height:this.sliderHeight,fill:this.highlightGrad,opacity:u.opacity,stroke:u.border.color,"stroke-width":u.border.width},this.renderer.drawRect(f,this.gHighlight),this.highlightRect=this.gHighlight.firstChild,this.renderer.append(this.gHighlight,this.styleRect)),this.rect=this.highlightRect,i.startX=i.mouseDownX,this._highlight.call(this,i,t))},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_rightClick:function(n){var t=this.model.browserInfo;if(this.isTouch(n)&&this.model.navigatorStyleSettings.selectionSettings.enable)return event.preventDefault(),event.stopPropagation(),!1},_grab:function(t){var u,s,f,a,g,nt,tt,l,it,o,r,e,y;t.preventDefault();var i=this,rt=i.model,vt=rt.browserInfo,ut=this.isTouch(t),ft=rt.navigatorStyleSettings.selectionSettings,et=ut?i.calTouchPosition(t):i.calMousePosition(t);for(i.mouseDownX=et.X,i.mouseDownY=et.Y,ft.enable&&this._performSelection(t),u=i.edge==!0?i.target:t.target,s=u;s.parentNode;)s=s.parentNode,s.id==this._id+"thumbleft"?f=this._id+"thumbleft":s.id==this._id+"thumbright"&&(f=this._id+"thumbright");var p,w,h,b,k,d,ct=i.labelRegions.length,c=i.mouseDownX,ot=i.mouseDownY;for(a=0;a<ct;a++)if(h=i.labelRegions[a],b=h.X,k=h.Y,d=h.LabelType,b<=c&&b+h.Width>=c&&k<=ot&&k+h.Height>=ot){p=d=="lowerLevel"?!0:!1;w=d=="higherLevel"?!0:!1;break}if(g=!1,i.isSelection=!1,i.highlightRect&&(nt=i.highlightRect.getBoundingClientRect(),tt=i.centerSlider.getBoundingClientRect(),nt.left>=tt.left&&nt.right<=tt.right&&(g=!0)),!ft.enable||!i.selectionRect||u.parentNode.id==="leftslider"||u.parentNode.id==="rightslider"||f==this._id+"thumbleft"||f==this._id+"thumbright"||(i.isSelection=!0,i.startX=i.mouseDownX),ut&&!i.switched){var st=this._leftValue,ht=this._rightValue,v=10,lt=n("#"+this._id+"thumbleft"),at=n("#"+this._id+"thumbright");c>=st.left-v&&c<=st.right+v&&(u=this.leftCircle?this.leftCircle:lt[0].firstChild,f=this.leftCircle?f:this._id+"thumbleft",this._sliderMove=!0);c>=ht.left-v&&c<=ht.right+v&&(u=this.rightCircle?this.rightCircle:at[0].firstChild,f=this.rightCircle?f:this._id+"thumbright",this._sliderMove=!0)}if(u.parentNode.id==="leftslider"||u.parentNode.id==="rightslider"||f==this._id+"thumbleft"||f==this._id+"thumbright"||u.parentNode.id==="highlightRect"+this._id&&g||u.parentNode.id==="centerslider"||p||w||i.isSelection)if(i.dragTarget=u.parentNode.id==="highlightRect"+this._id?n("#centerslider").children()[0]:u,i.grabbed=!0,i.edge=!1,l=i.dragTarget.parentNode.id,this.svgSupport&&(it=f==this._id+"thumbleft"||f==this._id+"thumbright"?{e:t.clientX,f:t.clientY}:i.dragTarget.getCTM(),i.grabPoint.x=i.mouseDownX+this.leftPadding-Number(it.e),i.grabPoint.y=i.trueCoords.y-Number(it.f)),e=!1,y=i.model.enableRTL,y&&(i._higherLineLeft.sort(function(n,t){return n-t}),i._lowerLineLeft.sort(function(n,t){return n-t})),l!="leftslider"&&l!="rightslider"&&i.model.valueType=="datetime"&&w){for(i.grabbed=i.dragTarget.parentNode.id=="centerslider"?!0:!1,o=i.mouseDownX,r=0;r<i._higherLineLeft.length;r++)r+1<i._higherLineLeft.length&&o>i._higherLineLeft[r]&&o<i._higherLineLeft[r+1]?(i.setSliderPositions(i._higherLineLeft[r],null,null),i.setSliderPositions(null,null,i._higherLineLeft[r+1]),e=!0):r+1===i._higherLineLeft.length&&o>i._higherLineLeft[r]&&(i.setSliderPositions(i._higherLineLeft[r],null,null),i.setSliderPositions(null,null,i.newWidth-i.padding),e=!0);y&&!e&&(i.setSliderPositions(0+i.padding,null,null),i.setSliderPositions(null,null,i._higherLineLeft[0]),e=!1)}else if(l!="leftslider"&&l!="rightslider"&&i.model.valueType=="datetime"&&p){for(i.center=i.mouseDownX,i.grabbed=i.dragTarget.parentNode.id=="centerslider"?!0:!1,o=i.mouseDownX,r=0;r<i._lowerLineLeft.length;r++)r+1<i._lowerLineLeft.length&&o>i._lowerLineLeft[r]&&o<i._lowerLineLeft[r+1]?(i.setSliderPositions(i._lowerLineLeft[r],null,null),i.setSliderPositions(null,null,i._lowerLineLeft[r+1]),e=!0):r+1===i._lowerLineLeft.length&&o>i._lowerLineLeft[r]&&(i.setSliderPositions(i._lowerLineLeft[r],null,null),i.setSliderPositions(null,null,i.newWidth-i.padding),e=!0);y&&!e&&(i.setSliderPositions(0+i.padding,null,null),i.setSliderPositions(null,null,i._lowerLineLeft[0]),e=!1)}else i.isSelection&&(i.grabbed=!0)},_leave:function(){n("#highlightRect"+this._id).hide()},_drag:function(t){var e,i,c,u,l,y,a,v,o,r,s,f,h;if(t.preventDefault(),e=jQuery.uaMatch(navigator.userAgent),i=this,c=this.svgSupport&&t.originalEvent.toString()!=="[object TouchEvent]"&&e.browser.toLowerCase()!="msie"?i.calMousePosition(t):this.svgSupport?i.calTouchPosition(t):i.calMousePosition(t),mouseX=i.mouseDownX=c.X,mouseY=i.mouseDownY=c.Y,a=i.model.navigatorStyleSettings.highlightSettings,!a.enable||this._sliderMove||this.isTouch(t)||this._performHighlight(t),this.svgSupport&&i.GetTrueCoords(t),i.model.labelSettings.higherLevel.visible||i.model.labelSettings.lowerLevel.visible)for(v=i.labelRegions.length,o=0;o<v;o++)if(u=i.labelRegions[o],l=u.X,y=u.Y,l<=mouseX&&l+u.Width>=mouseX&&u.Y<=mouseY&&u.Y+u.Height>=mouseY){n(i.rightUnSelected).css("cursor","pointer");n(i.leftUnSelected).css("cursor","pointer");break}else n(i.rightUnSelected).css("cursor","default"),n(i.leftUnSelected).css("cursor","default");if(i.dragTarget){for((i.edge||i.dragTarget!==i.leftSlider)&&i.dragTarget!==i.rightSlider&&i.dragTarget!==i.highlightRect&&i.dragTarget!==i.centerSlider?(r=i.mouseDownX,s=i.mouseDownY):this.svgSupport?e.browser.toLowerCase()=="webkit"||e.browser.toLowerCase()=="mozilla"?(r=i.mouseDownX-i.grabPoint.x,r<this.padding&&(r=this.padding),s=i.mouseDownY-i.grabPoint.y):(r=i.trueCoords.x-i.grabPoint.x,r<this.padding&&(r=this.padding),s=i.trueCoords.y-i.grabPoint.y):(r=i.mouseDownX,s=i.mouseDownY),f=i.dragTarget;f.parentNode;)f=f.parentNode,f.id==this._id+"thumbleft"?h=this._id+"thumbleft":f.id==this._id+"thumbright"&&(h=this._id+"thumbright");i.diff=i.leftSlider.getBoundingClientRect().left-i.rightSlider.getBoundingClientRect().left;i.leftdiff=i.rightSlider.getBoundingClientRect().left-this.padding-n(this.svgDocument).offset().left;i.rightdiff=i.leftSlider.getBoundingClientRect().left-this.padding-n(this.svgDocument).offset().left;i.dragTarget.parentNode.id==="leftslider"||h==this._id+"thumbleft"?(i.grabbed=!1,i.diff>=-1&&i.diff<=1&&i.switched==!1&&i.rightdiff<i.newWidth-2*this.padding?(i.target=i.rightSlider,i.switched=!0,i.edge=!0,i._grab(t),i._drag(t)):(r<=this.rightSliderPosition?(i.setSliderPositions(r,null,null),this.leftSliderPosition=r,this.leftset=!1):(i.setSliderPositions(this.rightSliderPosition,null,null),this.leftset=!0,this.leftSliderPosition=this.rightSliderPosition),(i.diff>=1||i.diff<=-1)&&(i.switched=!1)),i.left=r,i.isSelection&&(i.isSelection=!1,this.renderer._setAttr(n(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(n(this.selectionRect),{stroke:"transparent"}))):i.dragTarget.parentNode.id==="rightslider"||h==this._id+"thumbright"?(i.grabbed=!1,i.diff>=0&&i.diff<=1&&i.switched==!1&&i.leftdiff>0?(i.target=i.leftSlider,i.switched=!0,i.edge=!0,i._grab(t),i._drag(t)):(r>=this.leftSliderPosition?(i.setSliderPositions(null,null,r),this.rightSliderPosition=r):(i.setSliderPositions(null,null,this.leftSliderPosition),this.rightSliderPosition=this.leftSliderPosition),(i.diff>=1||i.diff<=-1)&&(i.switched=!1)),i.right=r,i.isSelection&&(i.isSelection=!1,this.renderer._setAttr(n(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(n(this.selectionRect),{stroke:"transparent"}))):i.dragTarget.parentNode.id!=="centerslider"&&i.dragTarget.parentNode.id!=="highlightRect"+this._id||i.isSelection?i.isSelection&&(this.rect=this.selectionRect,this._highlight.call(this,i,t),i.grabbed=!1):(n("#highlightRect"+this._id).hide(),r<this.padding&&(r=parseFloat(this.padding)),i.grabbed?i.grabbed=!1:(i.setSliderPositions(null,r,null),i.center=r),r>r+this.renderer._getAttrVal(n(i.dragTarget),"width")&&i.setSliderPositions(null,r,null))}},_highlight:function(i,r){var e=[],f=[],y=this.sliderHeight,l=i.startX>i.mouseDownX?i.mouseDownX:i.startX,p=i.startX==l?i.mouseDownX:i.startX,w=i.mouseDownY,o,a,v,s,h,k=this.model.labelSettings.higherLevel.labelPlacement,b=this.model.labelSettings.lowerLevel.visible,u,c;targetId=r.target.parentNode.id;n.each(i.labelRegions,function(n,t){o=t.X;a=t.Y;v=t.Width;s=t.LabelType=="higherLevel";h=s?targetId.indexOf("higherLevel")<0&&b?t.Height:y:t.Height;l<=o+v&&o<=p&&a+h>=w&&(s?f.indexOf(t)>-1||f.push(t):e.indexOf(t)>-1||e.push(t))});c=function(n){if(n.length>0){min=n[0].X;max=n[0].X;u=n[0];maximumRegion=n[0];for(var t=0;t<n.length;t++)n[t].X<min?(min=n[t].X,u=n[t]):n[t].X>max&&(max=n[t].X,maximumRegion=n[t])}};f.length>0?c(f):c(e);t.isNullOrUndefined(u)||(n("#"+this.rect.parentNode.id).show(),this.renderer._setAttr(n(this.rect),{transform:"translate("+u.X+","+this.sliderPosition+")",width:maximumRegion.Width+maximumRegion.X-u.X}))},_drop:function(t){var p,r,l,s,f,o,u,e,y;if(n("#highlightRect"+this._id).hide(),this._sliderMove=!1,this.dragTarget){if(p=t.target,this._sliderHover=!1,r=this,r.model.allowSnapping&&parseInt(r.leftSlider.getBoundingClientRect().left+2)<parseInt(r.rightSlider.getBoundingClientRect().left)||r.isSelection){l=parseInt(r.model.padding);s=r.isSelection?r.rect.getBoundingClientRect():0;r.ismouseup=!0;r.dragTarget.parentNode.id==="leftslider"?f=r.left:r.dragTarget.parentNode.id==="rightslider"?f=r.right:r.isSelection?f=Math.abs(parseFloat(s.left-n("#"+this._id)[0].getBoundingClientRect().left+l)):r.dragTarget.parentNode.id==="centerslider"&&(f=r.leftSliderPosition,o=r.rightSliderPosition);var a=0,v=0,w=r._lowerLineLeft.length,h,c;for(u=0;u<r._lowerLineLeft.length;u++)if(u+1<r._lowerLineLeft.length&&f>=r._lowerLineLeft[u]&&f<r._lowerLineLeft[u+1]){if(r.snapValue=r._lowerLineLeft[u],a=r._lowerLineLeft[u+1]-r.snapValue,r.dragTarget.parentNode.id==="centerslider"){for(e=u+1;e<r._lowerLineLeft.length;e++)e+1<r._lowerLineLeft.length&&o>=r._lowerLineLeft[e]&&o<r._lowerLineLeft[e+1]&&(h=r._lowerLineLeft[e],c=r._lowerLineLeft[e+1],v=c-h);o=o>=h+v/2?c:h}f>=r.snapValue+a/2?(r.snapValue=r._lowerLineLeft[u+1],r.dragTarget.parentNode.id==="leftslider"?r.setSliderPositions(r._lowerLineLeft[u+1],null,null):r.dragTarget.parentNode.id==="rightslider"?r.setSliderPositions(null,null,r._lowerLineLeft[u+1]):r.isSelection?(r.setSliderPositions(null,null,r._lowerLineLeft[u+1]+parseFloat(s.right-s.left)),r.setSliderPositions(r._lowerLineLeft[u+1],null,null)):r.dragTarget.parentNode.id!=="centerslider"||r.grabbed||(r.setSliderPositions(null,null,o),r.setSliderPositions(r._lowerLineLeft[u+1],null,null))):(r.snapValue=r._lowerLineLeft[u],r.dragTarget.parentNode.id==="leftslider"?r.setSliderPositions(r._lowerLineLeft[u],null,null):r.dragTarget.parentNode.id==="rightslider"?r.setSliderPositions(null,null,r._lowerLineLeft[u]):r.isSelection?(r.setSliderPositions(null,null,r._lowerLineLeft[u]+parseFloat(s.right-s.left)),r.setSliderPositions(r._lowerLineLeft[u],null,null)):r.dragTarget.parentNode.id!=="centerslider"||r.grabbed||(r.setSliderPositions(null,null,o),r.setSliderPositions(r._lowerLineLeft[u],null,null)))}else u+1===r._lowerLineLeft.length&&f>=r._lowerLineLeft[u]&&(r.isSelection?(r.setSliderPositions(null,null,r._lowerLineLeft[u]+parseFloat(r.rect.getBoundingClientRect().width)),r.setSliderPositions(r._lowerLineLeft[u],null,null)):r.setSliderPositions(null,null,r.newWidth-r.padding))}this.dragTarget=null;this.leftTooltip!=i&&this.model.tooltipSettings.tooltipDisplayMode=="always"?(this.leftTooltip.setAttribute("opacity",1),this.rightTooltip.setAttribute("opacity",1)):this.leftTooltip!=i&&this.model.tooltipSettings.tooltipDisplayMode=="ondemand"&&(this.isTouch(t)?(y=[this.leftTooltip,this.rightTooltip],window.clearTimeout(this.model.timer),this.model.timer=setTimeout(function(){n(y).fadeOut(500)},1200)):(this.leftTooltip.setAttribute("opacity",0),this.rightTooltip.setAttribute("opacity",0)));this.model.enableDeferredUpdate&&(this._calculateSelectedData(),(!r.grabbed||r.isSelection)&&(this._calculateSliderZoomFactPosition(),this.model.valueType=="datetime"?(this.startDateTime.getTime()!==new Date(this.model.selectedRangeSettings.start).getTime()||this.endDateTime.getTime()!==new Date(this.model.selectedRangeSettings.end).getTime())&&this._trigger("rangeChanged",this.model):(this.startValue!==this.model.selectedRangeSettings.start||this.endValue!==this.model.selectedRangeSettings.end)&&this._trigger("rangeChanged",this.model)));r.isSelection&&(r.isSelection=!1,this.renderer._setAttr(n(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(n(this.selectionRect),{stroke:"transparent"}))}this._setSelectedRange()},mouseup:function(n){this.dragTarget!=null&&(this._drop(n),this.dragTarget!=null&&(this.dragTarget.setAttributeNS(null,"pointer-events","all"),this.dragTarget=null),this.model.enableDeferredUpdate&&(this._calculateSelectedData(),this._calculateSliderZoomFactPosition(),this._trigger("rangeChanged",this.model)))},_setSelectedRange:function(){this._selectedRangeStart(this.model.selectedRangeSettings.start);this._selectedRangeEnd(this.model.selectedRangeSettings.end)},GetTrueCoords:function(n){var t=this.svgDocument.currentScale,i=this.svgDocument.currentTranslate,r=jQuery.uaMatch(navigator.userAgent);n.originalEvent.toString()!=="[object TouchEvent]"&&r.browser.toLowerCase()!="msie"?(this.trueCoords.x=(n.clientX-i.x)/t,this.trueCoords.y=(n.clientY-i.y)/t):r.browser.toLowerCase()=="msie"?(this.trueCoords.x=(n.originalEvent.clientX-i.x)/t,this.trueCoords.y=(n.originalEvent.clientY-i.y)/t):(this.trueCoords.x=(n.originalEvent.touches[0].clientX-i.x)/t,this.trueCoords.y=(n.originalEvent.touches[0].clientY-i.y)/t)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.datavisualization.RangeNavigator.Locale=t.datavisualization.RangeNavigator.Locale||{};t.datavisualization.RangeNavigator.Locale["default"]=t.datavisualization.RangeNavigator.Locale["en-US"]={intervals:{quarter:{longQuarters:"Quarter",shortQuarters:"Q"},week:{longWeeks:"Week",shortWeeks:"W"}}};t.datavisualization.RangeNavigator.Locale["fr-FR"]={intervals:{quarter:{longQuarters:"Trimestre",shortQuarters:"T"},week:{longWeeks:"Semaine",shortWeeks:"S"}}};t.datavisualization.RangeNavigator.IntervalType={Auto:"auto",Years:"years",Quarters:"quarters",Months:"months",Weeks:"weeks",Days:"days",Hours:"hours",Minutes:"minutes"};t.datavisualization.RangeNavigator.Position={Top:"top",Bottom:"bottom"};t.datavisualization.RangeNavigator.FontStyle={Normal:"normal",Italic:"italic",Bold:"bold"};t.datavisualization.RangeNavigator.FontWeight={Regular:"regular",Bold:"bold",Lighter:"lighter"};t.datavisualization.RangeNavigator.HorizontalAlignment={Left:"left",Right:"right",Middle:"middle"};t.datavisualization.RangeNavigator.LabelPlacement={Inside:"inside",Outside:"outside"};t.datavisualization.RangeNavigator.ValueType={Numeric:"numeric",Datetime:"datetime"};t.datavisualization.RangeNavigator.RangePadding={Additional:"additional",Normal:"normal",None:"none",Round:"round"};t.datavisualization.RangeNavigator.Theme={Azure:"azure",FlatLight:"flatlight",Azuredark:"azuredark",Lime:"lime",LimeDark:"limedark",Saffron:"saffron",SaffronDark:"saffrondark",GradientLight:"gradientlight",GradientDark:"gradientdark"}}(jQuery,Syncfusion);jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}},function(t,r,u){r.widget({ejMap:"ej.datavisualization.Map"},{validTags:["div"],_initPrivateProperties:function(){this._rootgroup=null;this._bubblegroup=null;this._scale=1;this._prevDistance=0;this._tileTranslatePoint={x:0,y:0};this._translatePoint={x:0,y:0};this._prevPoint=null;this._Tiles=[];this._prevScale=0;this._tileDiv=null;this._containerWidth=500;this._containerHeight=400;this._baseTranslatePoint={x:0,y:0};this._isDragging=!1;this._prevLevel=1;this._startPoint={x:0,y:0};this._stopPoint={x:0,y:0};this.mouseClickable=!1;this._browser=null;this._baseScale=0;this._mapBounds=null;this._svgns="http://www.w3.org/2000/svg";this._ispanning=!1;this._dragStartX=0;this._isNavigationPressed=!1;this._iskeyboardKeysPressed=!1;this._isPolygonSelected=!1;this._dragStartY=0;this._width=350;this._height=350;this._isMapCoordinates=!0;this._margintop=0;this._marginleft=0;this._svgDocument=null;this._tooltipElement=null;this._templateDiv=null;this._scrollLegendDiv=null;this._legendContainer=null;this._legendDiv=null;this._legendDivHeight=0;this._legendDivWidth=0;this._mapContainer=null;this._isSVG=!0;this._VMLPathFractionCount=0;this._sliderControl=null;this._isTileMap=!1;this._isRendered=!1;this._urlTemplate=null;this._polylineCount=0;this._pointscount=0;this._isPinching=!1;this._groupSize=null;this._groupBorder={x:0,y:0}},defaults:{locale:null,enableGroupSeparator:!1,background:"transparent",zoomSettings:{minValue:1,maxValue:100,factor:1,level:1,enableZoomOnSelection:!1,enableZoom:!0},centerPosition:null,enableResize:!0,isResponsive:!0,enableAnimation:!1,draggingOnSelection:!1,navigationControl:{enableNavigation:!1,content:null,orientation:"vertical",absolutePosition:{x:0,y:0},dockPosition:"centerleft"},enableLayerChangeAnimation:!1,enablePan:!0,zoomLevel:1,minZoom:1,maxZoom:100,zoomFactor:1,baseMapIndex:0,shapeSelected:"",markerSelected:"",zoomedIn:"",onRenderComplete:"",refreshed:"",panned:"",zoomedOut:"",mouseover:"",mouseleave:"",layers:[]},observables:["baseMapIndex","enablePan","enableResize","enableAnimation","zoomLevel","minZoom","maxZoom","zoomFactor",],_zoomLevel:r.util.valueFunction("zoomLevel"),_minZoom:r.util.valueFunction("minZoom"),_maxZoom:r.util.valueFunction("maxZoom"),_zoomFactor:r.util.valueFunction("zoomFactor"),baseMapIndex:r.util.valueFunction("baseMapIndex"),enablePan:r.util.valueFunction("enablePan"),enableResize:r.util.valueFunction("enableResize"),enableAnimation:r.util.valueFunction("enableAnimation"),_tags:[{tag:"layers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","labelSettings.showLabels","labelSettings.labelPath","labelSettings.enableSmartLabel","legendSettings.leftLabel","legendSettings.rightLabel","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.maxValue","bubbleSettings.color","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient","shapeSettings.colorPalette","shapeSettings.customPalette",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","gradientColors"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"},{tag:"subLayers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","legendSettings.leftLabel","legendSettings.rightLabel","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.maxValue","bubbleSettings.color","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","key","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","highlightcolor"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"}],],singular:"subLayer"}]],singular:"layer"}],dataTypes:{layers:"array"},_destroy:function(){this._unWireEvents();_isSVG?t(this.element).removeClass("e-datavisualization-map e-js").find("#svgDocument").remove():t(this.element).removeClass("e-datavisualization-map e-js").find("#rootGroup").remove()},_setModel:function(n){var i,r;for(i in n)switch(i){case"zoomSettings":this.model.zoomSettings.enableZoom&&(this._zoomLevel(this.model.zoomSettings.level),this._zoomFactor(this.model.zoomSettings.factor),this._maxZoom(this.model.zoomSettings.maxValue),this._minZoom(this.model.zoomSettings.minValue),this.zoom(this._zoomLevel()));break;case"zoomLevel":this.model.zoomSettings.level=this._zoomLevel();this.zoom(this._zoomLevel());break;case"zoomFactor":this.model.zoomSettings.factor=this._zoomFactor();this.zoom(this._zoomLevel());break;case"minZoom":this.model.zoomSettings.minValue=this._minZoom();this.zoom(this._zoomLevel());break;case"maxZoom":this.model.zoomSettings.maxValue=this._maxZoom();this.zoom(this._zoomLevel());break;case"baseMapIndex":this.baseMapIndex(n[i]);r=this;this._groupSize=null;this.enableAnimation()?(this.model.enableLayerChangeAnimation=!0,t(this._mapContainer).animate({opacity:0},500,function(){r.refresh(!0)})):this.refresh(!0);break;case"background":baseLayer.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background)}},_layers:function(n,t){t=="shapeSettings.fill"||t=="shapeSettings.strokeThickness"||t=="shapeSettings.selectionColor"||t=="shapeSettings.highlightColor"?this.clearShapeSelection():t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh(!0)},_layers_markers:function(){this.refreshMarkers()},_layers_subLayers:function(n,t){t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh(!0)},_init:function(){var n=this;this._navigationStyle=null;this.navigationControlData=null;this._initPrivateProperties();this._setZoomProperties();this._localizedLabels=this._getLocalizedLabels();t.each(this.model.layers,function(t){n._layerInitialize(t)});this._mapContainer=this.element;t(this._mapContainer).css({overflow:"hidden"});document.documentMode==8&&t(this._mapContainer).css({overflow:"hidden",position:"relative"});this._wireEvents();this.refresh();this._trigger("onRenderComplete");this._isRendered=!0;_isSVG&&this.model.enablePan&&t(this._svgDocument).pinchZoom(this._rootgroup,this)},_setZoomProperties:function(){typeof this.model.zoomSettings.factor!="function"&&(this._zoomFactor(this.model.zoomSettings.factor),this._zoomLevel(this.model.zoomSettings.level),this._minZoom(this.model.zoomSettings.minValue),this._maxZoom(this.model.zoomSettings.maxValue))},_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},_layerInitialize:function(n){var i=this;this.model.layers[n]!=null?t.each(this.model.layers,function(n,r){r=i._checkArrayObject(r,n);var u=new f;t.extend(u,r);t.extend(r,u);t.each(r.subLayers,function(n,r){r=i._checkArrayObject(r,n);var u=new f;t.extend(u,r);t.extend(r,u)})}):this.layers[0]=new f},_checkArrayObject:function(n,i){var u=["background","zoomSettings","bubbleSettings","minValue","maxValue","factor","level","enableZoomOnSelection","enableZoom","centerPosition","enableResize","isResponsive","enableAnimation","draggingOnSelection","navigationControl","enableNavigation","orientation","absolutePosition","dockPosition","enablePan","baseMapIndex","enableSelection","selectionMode","enableMouseHover","shapeData","dataSource","showTooltip","legendSettings","showLegend","showLabels","position","height","width","type","mode","dockOnMap","dockPosition","labelSettings","labelPath","enableSmartLabel","smartLabelSize","layerType","showMapItems","shapeSettings","highlightColor","highlightBorderWidth","selectionColor","fill","strokeThickness","stroke","highlightStroke","selectionStroke","selectionStrokeWidth","colorValuePath","valuePath","enableGradient","autoFill",""],r=this;return t.each(n,function(n,t){if(u.indexOf(n)>-1)if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new f;r._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),n},_loadIndividualDefaultValues:function(n,i,r){var u=null,f=this;return t.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),t.each(n,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),t.extend(u,n),t.extend(n,u),n},_refreshWithAnimation:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPositionWithAnimation(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPositionWithAnimation(this)},_resizeShape:function(){this.model.layers[this.baseMapIndex()]._resizeShapes(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._resizeShapes(this)},_refrshLayers:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPosition(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPosition(this)},_panTileMap:function(n,t,i){var u=Math.pow(2,this._zoomLevel())*256,r;this._tileTranslatePoint.x=n/2-u/2;this._tileTranslatePoint.y=t/2-u/2;r=this._convertTileLatLongtoPoint(i[0],i[1]);this._tileTranslatePoint.x-=r.x-n/2;this._tileTranslatePoint.y-=r.y-t/2},_generateTiles:function(n){var w=navigator.language||navigator.userLanguage,b,k,f,o,s,h,i,p,c,u,l,a,v;this.Tiles=[];b=k=Math.pow(2,n);var y=this.model.layers[this.baseMapIndex()],d=Math.min(k,(-this._tileTranslatePoint.y+this._height)/256+1),g=Math.min(b,(-this._tileTranslatePoint.x+this._width)/256+1),nt=-(this._tileTranslatePoint.x+256)/256,tt=-(this._tileTranslatePoint.y+256)/256;for(f=Math.round(nt);f<Math.round(g);f++)for(o=Math.round(tt);o<Math.round(d);o++)s=256*f+this._tileTranslatePoint.x,h=256*o+this._tileTranslatePoint.y,s>-256&&s<=this._width&&h>-256&&h<this._height&&f>=0&&o>=0&&(i=new e(f,o),i.left=s,i.top=h,i.src=y.layerType==r.datavisualization.Map.LayerType.Bing?this._getBingMap(i,y.key,y.bingMapType,w):this._urlTemplate.replace("level",this._zoomLevel()).replace("tileX",i.X).replace("tileY",i.Y),this.Tiles.push(i));for(p=t.extend(!0,[],this.Tiles),c=0;c<this.model.layers[this.baseMapIndex()].subLayers.length;c++)if(u=this.model.layers[this.baseMapIndex()].subLayers[c],u.layerType==r.datavisualization.Map.LayerType.OSM||u.layerType==r.datavisualization.Map.LayerType.Bing)for(l=0;l<p.length;l++)a=p[l],v=t.extend(!0,{},a),v.src=u.layerType==r.datavisualization.Map.LayerType.Bing?this._getBingMap(v,u.key,u.bingMapType,w):u.urlTemplate.replace("level",this._zoomLevel()).replace("tileX",a.X).replace("tileY",a.Y),this.Tiles.push(v);this._arrangeTiles()},_getBingMap:function(n,t,i,u){for(var f,s,h,e="",o=this._zoomLevel();o>0;o--)f=0,s=1<<o-1,(n.X&s)!=0&&f++,(n.Y&s)!=0&&(f+=2),e=e+""+f;return h=i==r.datavisualization.Map.BingMapType.Aerial?"A,G":i==r.datavisualization.Map.BingMapType.AerialWithLabel?"A,G,L":"G,VE,BX,L,LA","http://ak.dynamic.t2.tiles.virtualearth.net/comp/ch/"+e+"?mkt="+u+"&ur=IN&it="+h+"&shading=hill&og=45&n=z&Key="+t},_arrangeTiles:function(){var n=t.templates("<div><div style='position:absolute;left:{{:left}}px;top:{{:top}}px;height:{{:height}}px;width:{{:width}}px;'><img src={{:src}}><\/img><\/div><\/div>"),i=n.render(this.Tiles),r=this._mapContainer[0].children[0];this._tileDiv.html(i)},_generatePath:function(){var n=this.model.layers[this.baseMapIndex()],f="",i,e,o;for(this._polylineCount=0,this._pointscount=0,_isSVG=window.SVGSVGElement?!0:!1,n.layerType==r.datavisualization.Map.LayerType.Geometry?n!=u&&n.shapeData!=null&&(n._isBaseLayer=!0,this._isTileMap=!1,this._scale=this._zoomLevel(),f=this._readShapeData(n)):(this._isTileMap=!0,this._scale=Math.pow(2,this._zoomLevel()-this._zoomFactor())),i=0;i<n.subLayers.length;i++)n.subLayers[i].layerType==r.datavisualization.Map.LayerType.Geometry&&n.subLayers[i].shapeData!=null&&(n.subLayers[i]._isBaseLayer=!1,f+=this._readShapeData(n.subLayers[i]));_isSVG?(e='<div style="position:relative;" id="tileDiv"/><svg xmlns="http://www.w3.org/2000/svg" style= "overflow:hidden;z-index:0;float:left;left:0,top:0"id="svgDocument"> <g id="rootGroup">'+f+"<\/g><\/svg>",this._mapContainer.html(e),this._svgDocument=this.element.find("#svgDocument")[0],this._tileDiv=this.element.find("#tileDiv")):(document.createStyleSheet().addRule(".vml","behavior:url(#default#VML);display:inline-block"),document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),o='<div id="tileDiv"/><v:group id = "rootGroup" style="position:absolute; width:'+this._width+"px;height:"+this._height+'px;" coordorigin = "0 0" coordsize="'+this._width+" "+this._height+'">'+f+"<\/v:group>",this._mapContainer.html(o),this._tileDiv=this.element.find("#tileDiv"),this._bubblegroup=this._createGroup(!1,"bubbleGroup"),this._bubblegroup.style.position="absolute",this.element.append(this._bubblegroup));(n.layerType==r.datavisualization.Map.LayerType.OSM||n.layerType==r.datavisualization.Map.LayerType.Bing)&&(this._urlTemplate=n.urlTemplate,this.model.centerPosition!=null?this._panTileMap(this._width,this._height,this.model.centerPosition):this._panTileMap(this._width,this._height,[0,0]),this._generateTiles(this._zoomLevel()),_isSVG&&t(this._svgDocument).css("position","relative"));_isSVG&&t(this._mapContainer).css("position","relative");this._rootgroup=this.element.find("#rootGroup")[0];this._on(t(this.element),r.eventType.mouseDown,{map:this},this.dragDown);this._on(t(this.element),r.eventType.mouseMove,{map:this},this.dragMove);this._on(t(this.element),r.eventType.mouseUp,{map:this},this.dragUp)},_calculateBBox:function(n,t,i){var f=maxLatitude=minLongitude=maxLongitude=0,o=!1,l,c,r,h,e,s,u;if(n!=null&&n.length>0)for(e=0;e<n.length;e++)for(h=n[e],coords=h.geometry!=null?h.geometry.coordinates:h.coordinates,l=coords.length,c=0;c<l;c++)if(r="",l>1?(r=coords[c][0],r.length<=2&&(r=coords[c])):r=coords[c],r.length>2)for(u=0;u<r.length;u++)r[u][1]!=null&&r[u][0]!=null&&(o?(f=Math.min(f,r[u][1]),maxLatitude=Math.max(maxLatitude,r[u][1]),minLongitude=Math.min(minLongitude,r[u][0]),maxLongitude=Math.max(maxLongitude,r[u][0])):(f=maxLatitude=r[u][1],minLongitude=maxLongitude=r[u][0],o=!0));else r[u][1]!=null&&r[u][0]!=null&&(o?(f=Math.min(f,r[1]),maxLatitude=Math.max(maxLatitude,r[1]),minLongitude=Math.min(minLongitude,r[0]),maxLongitude=Math.max(maxLongitude,r[0])):(f=maxLatitude=r[1],minLongitude=maxLongitude=r[0],o=!0));if(i!=null&&i.length>0)for(e=0;e<i.length;e++)h=i[e],r=h.geometry.coordinates,o?(f=Math.min(f,r[1]),maxLatitude=Math.max(maxLatitude,r[1]),minLongitude=Math.min(minLongitude,r[0]),maxLongitude=Math.max(maxLongitude,r[0])):(f=maxLatitude=r[1],minLongitude=maxLongitude=r[0],o=!0);if(t!=null&&t.length>0)for(e=0;e<t.length;e++)for(s=t[e].geometry==null?t[e].coordinates:t[e].geometry.coordinates,u=0;u<s.length;u++)o?(f=Math.min(f,s[u][1]),maxLatitude=Math.max(maxLatitude,s[u][1]),minLongitude=Math.min(minLongitude,s[u][0]),maxLongitude=Math.max(maxLongitude,s[u][0])):(f=maxLatitude=s[u][1],minLongitude=maxLongitude=s[u][0],o=!0);return this._groupSize!=null||this._isMapCoordinates||(this._groupSize={minX:minLongitude,maxX:maxLongitude,minY:f,maxY:maxLatitude}),[[minLongitude,f],[maxLongitude,maxLatitude]]},_readShapeData:function(n){var u=this,t,i;if(n.shapeData!=null)if(typeof n.shapeData=="string")t=new r.DataManager(n.shapeData),i=r.Query().from(n),t.executeQuery(i).done(function(t){if(t.result!=null)return u._getPathCollection(t.result,n)});else return this._getPathCollection(n.shapeData,n)},_getFactor:function(){var n,t,i,r;if(this._mapBounds!=null){var u=this._convertTileLatLongtoPointForShapes(this._mapBounds[0][1],this._mapBounds[0][0],this._mapBounds),f=this._convertTileLatLongtoPointForShapes(this._mapBounds[1][1],this._mapBounds[1][0],this._mapBounds),r=i=1;n=f.y-u.y;t=f.x-u.x}else n=500,t=500;return i=n<this._height?parseFloat(Math.abs(this._height/n+"e+1").toString().split(".")[0]/10):this._height/n,r=t<this._width?parseFloat(Math.abs(this._width/t+"e+1").toString().split(".")[0]/10):this._width/t,Math.min(r,i)},_getPathCollection:function(n,i){var vt="",it="",rt="",ct,h,c,l,a,g,ii,wt,ut,yt,pt,nt,lt,at,et,y,tt,s,n,u,ft,o,v,f,e,st,ht,p,ot,w,bt;if(n.features!=null?(rt=new r.DataManager(n.features),it="geometry.type",i._isBaseLayer&&(this._mapBounds=n.bbox)):n.geometries!=null&&(rt=new r.DataManager(n.geometries),it="type",i._isBaseLayer&&n.bbox!=null&&(this._mapBounds=[[n.bbox[0],n.bbox[1]],[n.bbox[2],n.bbox[3]]])),n.geometries!=null||n.features!=null){var kt=r.Query().from(i).where(it,r.FilterOperators.equal,"LineString"),dt=r.Query().from(i).where(it,r.FilterOperators.equal,"Polygon"),gt=r.Query().from(i).where(it,r.FilterOperators.equal,"MultiPolygon"),b=rt.executeLocal(kt),k=rt.executeLocal(dt),ni=r.Query().from(i).where(it,r.FilterOperators.equal,"Point"),d=rt.executeLocal(ni),ti=rt.executeLocal(gt);if(this._polylineCount=this._polylineCount+b.length,this._pointscount=this._pointscount+d.length,t.merge(k,ti),i._isBaseLayer&&i.geometryType==r.datavisualization.Map.GeometryType.Normal&&(this._isMapCoordinates=!1),this._mapBounds==null&&i._isBaseLayer?this._mapBounds=this._calculateBBox(k,b,d):this._mapBounds==null&&(this._mapBounds=[[-180,-85],[180,85]]),ot=this._getFactor(),i._newBounds=[],ct="",this._groupSize!=null&&(h=this._groupSize.minX,c=this._groupSize.maxX,l=this._groupSize.minY,a=this._groupSize.maxY),g=!0,d.length>0)for(e=0;e<d.length;e++)ut=d[e],ii="",s=ut.geometry.coordinates,n=[],u=[],n.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])}),ft=0,o=n[0],latitude=o.lat,longitude=o.lng,f=this._convertTileLatLongtoPointForShapes(latitude,longitude,this._mapBounds,ot),v=this._mapBounds,longitude>=v[0][0]&&longitude<=v[1][0]&&latitude>=v[0][1]&&latitude<=v[1][1]?(g&&this._groupSize==null?(h=c=f.x,l=a=f.y,g=!1):(h=Math.min(h,f.x),c=Math.max(c,f.x),l=Math.min(l,f.y),a=Math.max(a,f.y)),_isSVG?u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}):u.push({x:f.x-5/this._scale,y:f.y-5/this._scale,lat:o.lat,lng:o.lng}),_isSVG?ct+='<circle cx="'+u[0].x+'" cy="'+u[0].y+'" r="'+i.shapeSettings.radius/this._scale+'" stroke="'+i.shapeSettings.stroke+'" stroke-width="'+i.shapeSettings.strokeThickness+'" fill="'+i.shapeSettings.fill+'" />':(wt='<v:oval display="block" fill="'+i.shapeSettings.fill+'" style="position:absolute;top: '+u[0].y+"px;left:"+u[0].x+"px;width:"+10/this._scale+"px;height:"+10/this._scale+"px;stroke-width:"+i.shapeSettings.strokeThickness+'px;"><\/v:oval>',ct+=wt)):(d.splice(e,1),e--);if(k.length>0)for(e=0;e<k.length;e++){if(ut=k[e],yt=0,nt=ut.geometry!=null?ut.geometry.coordinates:ut.coordinates,pt=nt[0][0].length,lt=nt.length,lt>1)for(at=nt,et=0;et<at.length;et++)pt<at[et][0].length&&(pt=at[et][0].length,yt=et);for(y="",tt=0;tt<lt;tt++){if(s="",lt>1?(s=nt[tt][0],s.length<=2&&(s=nt[tt])):s=nt[tt],n=[],u=[],s.length>2)for(p=0;p<s.length;p++)n.push({lat:parseFloat(s[p][1]),lng:parseFloat(s[p][0])});else n.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])});for(ft=0;ft<n.length-1||n.length==1&&ft==0;ft++)o=n[ft],latitude=o.lat,longitude=o.lng,v=this._mapBounds,(this._isTileMap||longitude>=v[0][0]&&longitude<=v[1][0]&&latitude>=v[0][1]&&latitude<=v[1][1])&&(f=this._convertTileLatLongtoPointForShapes(latitude,longitude,v,ot),g&&this._groupSize==null?(h=c=f.x,l=a=f.y,g=!1):(h=Math.min(h,f.x),c=Math.max(c,f.x),l=Math.min(l,f.y),a=Math.max(a,f.y)),_isSVG?u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}):u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}));if(tt==yt&&i._newBounds.push(this._findMidPointofPoylgon(u)),u.length>0)if(_isSVG){for(y+="M"+u[0].x+","+u[0].y,m=1;m<u.length;m++)y+=","+u[m].x+","+u[m].y;y+="Z"}else{for(y+="m"+parseInt(u[0].x)+","+parseInt(u[0].y),y+=" l"+parseInt(u[0].x)+","+parseInt(u[0].y),m=1;m<u.length;m++)y+=","+parseInt(u[m].x)+","+parseInt(u[m].y);y+=" e"}}y!=""?vt+=_isSVG?'<path class="mapShape" stroke='+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+" fill= "+i.shapeSettings.fill+' d="'+y+'" stroke-linejoin= round stroke-linecap= square><\/path>':'<v:shape style="width:'+this._width+"px;height:"+this._height+'px;" coordsize="'+this._width+" "+this._height+'" coordorigin="0 0" strokecolor='+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+'px" fillcolor= '+i.shapeSettings.fill+' path="'+y+'"><\/v:shape>':(k.splice(e,1),e--)}if(b.length>0)for(e=0;e<b.length;e++){for(st=b[e].geometry==null?b[e].coordinates:b[e].geometry.coordinates,ht="",p=0;p<st.length;p++)ot=this._getFactor(),w=this._convertTileLatLongtoPointForShapes(st[p][1],st[p][0],this._mapBounds,ot),g&&this._groupSize==null?(h=c=w.x,l=a=w.y,g=!1):(h=Math.min(h,w.x),c=Math.max(c,w.x),l=Math.min(l,w.y),a=Math.max(a,w.y)),ht+=w.x+","+w.y,p!=st.length-1&&(ht+=",");vt+=_isSVG?"<polyline stroke="+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+' fill="transparent" stroke-width="1" points="'+ht+'" ><\/polyline>':'<v:polyline coordsize="'+this._width+","+this._height+'" coordorigin="0 0" strokecolor='+i.shapeSettings.stroke+" strokeweight="+i.shapeSettings.strokeThickness/this._scale+'px" fillcolor='+i.shapeSettings.fill+' points="'+ht+'"/>'}return this._isMapCoordinates&&(this._groupSize={minX:h,maxX:c,minY:l,maxY:a}),bt=[].concat(k,b),i._polygonData=t.merge(bt,d),vt+ct}return i._polygonData=[],null},_createGroup:function(n,t){var i;return i=document.createElement("<v:group class="+t+">"),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,n&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_generatePaletteColorsForShape:function(n,t,i,r){r!=null&&(t.shapeSettings.highlightColor=r.highlightColor,t.shapeSettings.highlightStroke=r.highlightStroke,t.shapeSettings.selectionColor=r.SelectionColor,t.shapeSettings.selectionStroke=r.SelectionStroke);_isSVG?n.setAttribute("fill",i[t._prevPaletteIndex]):n.fillcolor=i[t._prevPaletteIndex];t._prevPaletteIndex=t._prevPaletteIndex+1;t._prevPaletteIndex>i.length-1&&(t._prevPaletteIndex=0)},_renderLayers:function(n,i){var k,w,rt,kt,d,y,lt,g,at,e,l,p,vt,yt,b,ii,pt,s,a,ot,st,ri,ui,h,wt,fi,ht,nt,bt,c,ct,v;n._prevPaletteIndex=0;n._initializeLocalValues();n.selectedItems==null&&(n.selectedItems=[]);var oi=this._rootgroup,ei=this._svgDocument,o=this,f=n;f.legendSettings!=null&&f.shapeSettings.colorMappings!=null&&(f.legendSettings.type==u||f.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&f._generateLegends(this);f.legendSettings!=null&&f.bubbleSettings.colorMappings!=null&&f.legendSettings.type==r.datavisualization.Map.LegendType.Bubbles&&f._generateBubbleLegends(this);f.shapeSettings.colorMappings!=null&&f.shapeSettings.colorMappings.rangeColorMapping!=null&&f.shapeSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);f.bubbleSettings.colorMappings!=null&&f.bubbleSettings.colorMappings.rangeColorMapping!=null&&f.bubbleSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);var tt=0,it=0;if(f.dataSource!=null&&f.bubbleSettings!=null)for(f.bubbleSettings.colorValuePath==null&&(f.bubbleSettings.colorValuePath=f.bubbleSettings.valuePath),k=0;k<f.dataSource.length;k++)w=parseFloat(this._reflection(f.dataSource[k],f.bubbleSettings.valuePath)),k!=0?w>it?it=w:w<tt&&(tt=w):tt=it=w;if(this._generateTooltipForLayers(f),f.shapeData!=null){if(rt=[],f.dataSource!=null)for(a=0;a<f.dataSource.length;a++)kt=f.dataSource[a],d=o._reflection(kt,f.shapeDataPath),d!=null&&(d=d.toLowerCase()),rt.push(d);var dt=r.browserInfo(),si=this.model,ut=dt.isMSPointerEnabled,ft=dt.pointerEnabled,et=ut?ft?"pointerup":"MSPointerUp":"touchend mouseup",gt=ut?ft?"pointermove":"MSPointerMove":"touchmove mousemove",ni=ut?ft?"pointerdown":"MSPointerDown":"touchstart mousedown",ti=ut?ft?"pointerleave":"MSPointerOut":"touchend mouseleave";for(y=0;y<f._polygonData.length;y++){if(lt=f._polygonData[y].properties,g=o._reflection(lt,f.shapePropertyPath),g!=null&&typeof g=="string"&&(at=g.toLowerCase()),e=this._rootgroup.childNodes[y+i],_isSVG?e.setAttribute("fill",f.shapeSettings.fill):(e.fillcolor=f.shapeSettings.fill,e.strokecolor=f.shapeSettings.stroke),s={},l=f._newBounds[y],f.shapeSettings.autoFill)switch(f.shapeSettings.colorPalette){case r.datavisualization.Map.ColorPalette.Palette1:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette1,f._colorPaletteSettings.Palette1);break;case r.datavisualization.Map.ColorPalette.Palette2:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette2,f._colorPaletteSettings.Palette2);break;case r.datavisualization.Map.ColorPalette.Palette3:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette3,f._colorPaletteSettings.Palette3);break;case r.datavisualization.Map.ColorPalette.CustomPalette:this._generatePaletteColorsForShape(e,f,f.shapeSettings.customPalette,null)}if(rt.indexOf(at)!=-1&&(p=f.dataSource[rt.indexOf(at)],vt=g,p!=null)){if(e!=null&&(yt=vt),n._bounds.push(l),f.showMapItems){if(b=t("<div class='mapItems' style='display:block;position:absolute;pointer-events: none;'><\/div>"),b[0].className=vt,o._templateDiv.append(b),t(b).css({left:l.x,top:l.y}),pt=this.model.locale,s=t.extend({},p),pt&&this.model.enableGroupSeparator)for(a in s)s[a]=isNaN(parseFloat(s[a]))?s[a]:parseFloat(s[a]).toLocaleString(pt);ii=f.mapItemsTemplate==null?t(" <div><label>{{:"+f.shapeSettings.valuePath+"}}<\/label><\/div>").render(s):t("#"+f.mapItemsTemplate).render(s);t(b).html(ii);n._mapItems.push(b)}f.shapeSettings.colorMappings!=null?(f.shapeSettings.colorValuePath==null&&(f.shapeSettings.colorValuePath=f.shapeSettings.valuePath),ot=o._reflection(p,f.shapeSettings.colorValuePath),ot==null||f.shapeSettings.autoFill||((f.legendSettings!=null&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive||f.shapeSettings.enableGradient)&&f.shapeSettings.colorMappings.rangeColorMapping!=null?(s.legendrect=f._updateLegendRange(ot,f,e),st=f.shapeSettings.fill,s.legendrect!=u&&(st=s.legendrect.color),_isSVG?e.setAttribute("fill",st):e.fillcolor=st):f._fillColors(ot,f.shapeSettings.colorMappings,e))):f.shapeSettings.autoFill||(_isSVG?e.setAttribute("fill",f.shapeSettings.fill):(e.fillcolor=f.shapeSettings.fill,e.strokecolor=f.shapeSettings.stroke));f.bubbleSettings.showBubble&&f.bubbleSettings!=null&&f.bubbleSettings.valuePath!=null&&(_isSVG?h=document.createElementNS(o._svgns,"circle"):(ri="bubble_"+yt,ui='<v:oval class="mapBubble" id='+ri+' display="block" style="position:absolute;top: 0px;left:0px;width:100px;height:100px;stroke-width:0px;"><v:fill opacity="0.9"/><\/v:oval>',this._bubblegroup.innerHTML=this._bubblegroup.innerHTML+ui,h=document.getElementById("bubble_"+yt)),wt=o._reflection(p,f.bubbleSettings.valuePath),fi=o._reflection(p,f.bubbleSettings.colorValuePath),f.bubbleSettings.colorMappings!=null?f._fillColors(fi,f.bubbleSettings.colorMappings,h):_isSVG?h.setAttribute("fill",f.bubbleSettings.color):(h.strokecolor=f.bubbleSettings.color,h.fillcolor=f.bubbleSettings.color),ht=o._getRatioOfBubble(f.bubbleSettings.minValue,f.bubbleSettings.maxValue,wt,tt,it),_isSVG?(t(h).attr({cx:l.x,cy:l.y,"fill-opacity":f.bubbleSettings.bubbleOpacity,r:ht,"class":"mapBubble"}),o.enableAnimation()&&!this._isTileMap&&t(h).css("display","none")):t(h).css({height:2*ht+"px",width:2*ht+"px"}),f.bubbleSettings.showTooltip==!0?(nt=t("<div class='bubbleToolTip' style='position:absolute;display:none;z-index:9999'/>"),bt=null,f.bubbleSettings.tooltipTemplate!=null?bt=f.bubbleSettings.tooltipTemplate:t(nt).append('<div class="bubbleToolTip" style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">'+wt+"<\/label><\/p><\/div><\/div>"),t(h).mouseenter({htmlobj:nt,templateID:bt,itemsrc:p},o._bubbleEnterFunction),t(h).mousemove({htmlobj:nt},o._bubbleOverFunction),t(h).mouseleave({htmlobj:nt},o._bubbleleaveFunction)):t(h).css("pointer-events","none"),_isSVG?(ei.appendChild(h),n._bubbles.push(h)):n._bubbles.push(h));s.data=p}n.labelSettings!=null&&n.labelSettings.showLabels&&n.labelSettings.labelPath!=null&&f.geometryType!=r.datavisualization.Map.GeometryType.Normal&&(ct=o._reflection(lt,n.labelSettings.labelPath),ct!=null&&(l==null,c=t("<div class='labelStyle'><\/div>"),t(c).css({"pointer-events":"none",position:"absolute"}),c[0].innerHTML=ct,this._templateDiv.append(c),n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="top"?t(this._templateDiv).css({"margin-top":n.legendSettings.height}):n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="left"&&t(this._templateDiv).css({"margin-left":n.legendSettings.width}),t(c).css({left:l.x,top:l.y}),o._off(t(c),r.eventType.mouseUp,o._polyClickFunction),o._on(t(c),r.eventType.mouseUp,{Param1:null,Param2:n,Param3:e},o._polyClickFunction),o._off(t(c),r.eventType.mouseLeave,o._polyLeaveFunction),o._on(t(c),r.eventType.mouseLeave,{Param1:n,Param2:s,map:this},o._polyLeaveFunction),c[0].setAttribute("nodeValue",e.getAttribute("fill")),n._labelCollection.push(c),n._labelBounds.push(l),n._labelData.push(ct)));s.shapeIndex=y;s.shape=e;s.shapeData=n._polygonData[y];o._off(t(c),r.eventType.mouseMove,o._polyMoveFunction);o._on(t(c),r.eventType.mouseMove,{Param1:f,Param2:s},o._polyMoveFunction);e!=null&&(v=null,_isSVG?(v=e.getAttribute("fill"),v=="undefined"&&(v=n.shapeSettings.fill),e.setAttribute("nodeValue",v)):(v=e.fillcolor.value,v=="undefined"&&(v=n.shapeSettings.fill),e.style.behavior=v));o.model.zoomSettings.enableZoomOnSelection&&t(e).hover(function(){t(this).css("cursor","pointer")},function(){t(this).css("cursor","auto")});n._mapShapes.push(s);this._off(t(e),"mouseenter touchmove",o._polyEnterFunction);this._on(t(e),"mouseenter touchmove",{Param1:f,Param2:s,map:o},o._polyEnterFunction);this._off(t(e),ni,o._polyMouseDown);this._on(t(e),ni,{Param1:s,Param2:f},o._polyMouseDown);this._off(t(e),et,o._polyClickFunction);this._on(t(e),et,{Param1:s,Param2:f,Param3:e},o._polyClickFunction);this._off(t(e),gt,o._polyMoveFunction);this._on(t(e),gt,{Param1:f,Param2:s,Param3:e},o._polyMoveFunction);this._off(t(e),ti,o._polyLeaveFunction);this._on(t(e),ti,{Param1:f,Param2:s,map:this},o._polyLeaveFunction);this._off(t(e),et,o._polyUpFunction);this._on(t(e),et,{Param1:s,Param2:f,Param3:e},o._polyUpFunction)}}f._isBaseLayer&&f.geometryType==r.datavisualization.Map.GeometryType.Normal&&f.labelSettings.showLabels&&(f._generateLabels(this),f._labelSizeCalculation(this),this._applyTransform(this._scale,this._translatePoint))},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},validateBubblePosition:function(n,t,i){var e=[],o=[],f,u,r;if(n==null&&(n=[],n.push(t)),!this.isPointInPolygon(n,t,!0)){for(f=0,r=0;r<n.length;r++)u={x:(n[r].x+this._translatePoint.x)*this._scale,y:(n[r].y+this._translatePoint.y)*this._scale},(u.y<t.y&&f.y>=t.y||f.y<t.y&&u.y>=t.y)&&(u.x<t.x?e.push(u.x):o.push(u.x)),f=u;if(!e.length>0||!o.length>0){if(e.length>0){for(r=t.x+i;!this.isPointInPolygon(n,{x:r-2,y:t.y},!0);)r=r-2;t.x=parseFloat(r-2-i)}if(o.length>0){for(r=t.x-i;!this.isPointInPolygon(n,{x:r+2,y:t.y},!0);)r=r+2;t.x=parseFloat(r+2+i)}}}return t},isPointInPolygon:function(n,t,i){for(var r,f,o=!1,e=0,u=0;u<n.length;u++){r={x:n[u].x,y:n[u].y};f={x:n[e].x,y:n[e].y};i&&(r={x:(n[u].x+this._translatePoint.x)*this._scale,y:(n[u].y+this._translatePoint.y)*this._scale},f={x:(n[e].x+this._translatePoint.x)*this._scale,y:(n[e].y+this._translatePoint.y)*this._scale});var s=t.y-r.y,h=f.y-r.y,c=f.x-r.x;(r.y<t.y&&f.y>=t.y||f.y<t.y&&r.y>=t.y)&&r.x+s/h*c<t.x&&(o=!0);e=u}return o},dragDown:function(n){var r=n.data.map,t=r.model.layers[0],i=this._mapContainer,u;if(n.type=="mousedown"?(r._startPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop},r._stopPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop}):n.type=="touchstart"?(r._startPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop}):n.type=="MSPointerDown"&&(r._startPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop}),r.mouseClickable=!0,r.model.draggingOnSelection&&t._prevSelectedShapes.length>0){for(u=0;u<t._prevSelectedShapes.length;u++)t._prevSelectedShapes[u].setAttribute("class","mapShape"),_isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t.fillcolor=t._prevSelectedShapes[u].getAttribute("nodeValue"),t.strokecolor=t.shapeSettings.stroke,t.strokeweight=t.shapeSettings.strokeThickness/this._scale);t._prevSelectedShapes=[]}},dragMove:function(n){var i=n.data.map,o=i.model.layers[0],f,e,r=this._mapContainer,u;i.model.draggingOnSelection&&i.mouseClickable&&(i.ispanning=!1,n.type=="mousemove"?i._stopPoint={x:n.pageX-r[0].offsetLeft,y:n.pageY-r[0].offsetTop}:n.type=="touchmove"?i._stopPoint={x:n.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:n.type=="MSPointerMove"&&(i._stopPoint={x:n.originalEvent.pageX-r[0].offsetLeft,y:n.originalEvent.pageY-r[0].offsetTop}),t(".e-mapDragSelection").remove(),u=t('<div class = "e-mapDragSelection"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),t(u).css({top:Math.min(i._startPoint.y,i._stopPoint.y),left:Math.min(i._startPoint.x,i._stopPoint.x),width:f,height:e,position:"absolute","z-index":100}),t(u).appendTo("#maps"))},dragUp:function(n){var i=n.data.map,s=Math.abs(i._stopPoint.x-i._startPoint.x),h=Math.abs(i._stopPoint.y-i._startPoint.y),e=i.model.layers[0],o=this._mapContainer,u,r,f;if(i.model.draggingOnSelection){for(t(".e-mapDragSelection").remove(),t(".e-mapDragSelection").css({display:"none"}),i.mouseClickable=!1,u=0;u<i.model.layers[0]._mapShapes.length;u++)r=i.model.layers[0]._mapShapes[u].shape,f=r.getBoundingClientRect(),f.left-o[0].offsetLeft+f.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+s<f.left-o[0].offsetLeft||f.top-o[0].offsetTop+f.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+h<f.top-o[0].offsetTop||i.model.layers[0]._contains(e._prevSelectedShapes,r)||e._prevSelectedShapes.push(r);for(u=0;u<e._prevSelectedShapes.length;u++)r=e._prevSelectedShapes[u],f=r.getBoundingClientRect(),r.setAttribute("class","e-mapSelectedShape mapShape"),_isSVG&&(r.setAttribute("fill",e.shapeSettings.selectionColor),r.setAttribute("stroke",e.shapeSettings.selectionStroke),r.setAttribute("stroke-width",e.shapeSettings.selectionStrokeWidth/i._scale))}},isIntersectBubbles:function(){for(var r,n,i,t=[],u=0;u<this.model.layers.length;u++)for(r=this.model.layers[u],Array.prototype.push.apply(t,r._bubbleCollection),n=0;n<r.subLayers.length;n++)Array.prototype.push.apply(t,r.subLayers[n]._bubbleCollection);for(n=0;n<t.length;n++){var f=t[n].getAttribute("cx"),e=t[n].getAttribute("cy"),h=t[n].getAttribute("r");for(i=n+1;i<t.length;i++){var o=t[i].getAttribute("cx"),s=t[i].getAttribute("cy"),c=t[i].getAttribute("r"),l=Math.sqrt((f-o)*(f-o)+(e-s)*(e-s)),a=parseFloat(h)+parseFloat(c);if(l<=a)return!0}}return!1},_zooming:function(n,t){var i=this._getCurrentPoint(t);n>=120?this._zoomingIn(i.x,i.y,t):this._zoomingOut(i.x,i.y,t)},_zoomingIn:function(n,t,i){var r=this,f,e,u;r.model.zoomSettings.enableZoom&&r._zoomLevel()>=r._minZoom()&&r._zoomLevel()<=r._maxZoom()&&(f=r._scale,e={x:n,y:t},r._prevScale=f,this._isTileMap?(this._tileZoom(r._zoomLevel()-r._zoomFactor(),r._zoomLevel(),e),u=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor()),this._generateTiles(this._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,u))/Math.pow(2,u),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,u))/Math.pow(2,u),r._scale=Math.pow(2,u)):(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale+r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale+r._zoomFactor()))/(r._height/t),r._scale=f+r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor())),r._trigger("zoomedIn",{originalEvent:i,zoomLevel:r._zoomLevel()}),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue())},_zoomingOut:function(n,t,i){var r=this,u,f,e;r.model.zoomSettings.enableZoom&&(r._zoomLevel()>this._minZoom()?(u=r._scale,f={x:n,y:t},r._prevScale=u,r._isTileMap?(r._tileZoom(r._zoomLevel()+r._zoomFactor(),r._zoomLevel(),f),e=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._generateTiles(r._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._scale=Math.pow(2,r._zoomLevel()-r._zoomFactor())):r._scale>1&&(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale-r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale-r._zoomFactor()))/(r._height/t),r._scale=r._scale-r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._scale=r._zoomLevel()),r._zoomLevel()<r._minZoom()&&(r.model.zoomSettings.level=r._minZoom(),r._zoomLevel(r._minZoom()),r.zoom(r._zoomLevel())),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue()):r.zoom(r._minZoom(),!1),r._trigger("zoomedOut",{originalEvent:i,zoomLevel:r._zoomLevel()}))},_getRatioOfBubble:function(n,t,i,r,u){var e=100/(u-r)*(i-r),f=(parseFloat(t)-parseFloat(n))/100*e+parseFloat(n);return u==r&&(f=(parseFloat(t)-parseFloat(n))/100+parseFloat(n)),f},_reflection:function(n,i){var r=n,f,e,o;if(i!=null&&n!=null){for(f=i.split("."),e=0,f.push(i);e<f.length;e++)n!=u&&r!=null&&(o=r.hasOwnProperty(f[e]),o&&t.each(r,function(n,t){if(n==f[e])return r=t,!1}));return r}return null},clearShapeSelection:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._clearShapeWidth(this._scale),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._clearShapeWidth(this._scale)},shapeSelectionOnResize:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._shapeSelection(),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._shapeSelection()},refreshMarkers:function(){for(var t,i=document.getElementsByClassName("mapMarker"),n=i.length-1;n>=0;n--)i[n].parentNode.removeChild(i[n]);for(n=this.baseMapIndex(),this.model.layers[n]._generateMarkerForLayers(this),t=0;t<this.model.layers[n].subLayers.length;t++)this.model.layers[n].subLayers[t]._generateMarkerForLayers(this);this._refrshLayers()},_generateTooltipForLayers:function(n){var i,r,u;n.showTooltip&&(i=document.documentMode==8?document.querySelectorAll("shapeToolTip"):document.getElementsByClassName("shapeToolTip"),i!=null&&i.length==0?(r=t("<div class='shapeToolTip' style='display:none;position:absolute;z-index:1000;pointer-events:none;'><\/div>"),t(document.body).append(r),n._tooltipElement=r):n._tooltipElement=i[0],n.tooltipTemplate==null&&(u=n.shapeSettings.valuePath,u!=null&&(n.tooltipTemplate="defaultTooltip",this._mapContainer.append(t('<div id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">{{:#data["'+u+'"]}}<\/label><\/p><\/div><\/div><\/div>')))))},_orderByNameAscending:function(n,t){return n.Range==t.Range?0:n.Range>t.Range?1:-1},_resizingContainer:function(){this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-1):1;this._isTileMap?(this._translatePoint.x=(this._tileTranslatePoint.x-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor()),this._translatePoint.y=(this._tileTranslatePoint.y-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor())):(this._translatePoint.x=this._tileTranslatePoint.x/this._scale,this._translatePoint.y=this._tileTranslatePoint.y/this._scale);this._applyTransform(this._scale,this._translatePoint);this._zoomLevel()>1&&(this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-this._zoomFactor()):this._zoomLevel(),this._applyTransform(this._scale,this._translatePoint));this._baseScale=1;this._baseTranslatePoint={x:this._translatePoint.x*2,y:this._translatePoint.y*2}},_calculateMarginConditions:function(){var n=this._calculateMinMax();this._translatePoint.y>n.maxY?this._translatePoint.y=n.maxY:this._translatePoint.y<n.minY&&(this._translatePoint.y=n.minY);this._translatePoint.x>n.maxX?this._translatePoint.x=n.maxX:this._translatePoint.x<n.minX&&(this._translatePoint.x=n.minX)},_calculateMinMax:function(){var n=this._groupBorder,t,i,r,u;return this._containerHeight*this._scale<=this._height?(i=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y,u=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y):(i=-n.y+1,u=(this._height-this._containerHeight*this._scale)/this._scale-n.y-1),this._containerWidth*this._scale<=this._width?(t=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x,r=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x):(t=-n.x+1,r=(this._width-this._containerWidth*this._scale)/this._scale-n.x-1),{minX:r,maxX:t,minY:u,maxY:i}},_findMidPointofPoylgon:function(n){var y,p,r,t;if(n.length>0){var k=0,v=n.length,u=n[0],d=u.x,g=u.x,nt=u.y,tt=u.y,h,c,f,e,o=0,s=0,i=0;for(r=k;r<=v-1;r++)y=n[r],h=y.x,c=y.y,r==v-1?(f=u.x,e=u.y):(p=n[r+1],f=p.x,e=p.y),o=o+Math.abs(h*e-f*c),s=s+Math.abs((h+f)*(h*e-f*c)),i=i+Math.abs((c+e)*(h*e-f*c));o=.5*o;s=1/(4*o)*s;i=1/(4*o)*i;var w={x:0,y:0},l={x:0,y:0},b={x:0,y:0},a={x:0,y:0};for(r=k;r<=v-1;r++)t=n[r],t.x>s?t.y<i&&i-t.y<i-w.y?w={x:t.x,y:t.y}:t.y>i&&(l.y==0||t.y-i<l.y-i)&&(l={x:t.x,y:t.y}):t.y<i&&i-t.y<i-b.y?b={x:t.x,y:t.y}:t.y>i&&(a.y==0||t.y-i<a.y-i)&&(a={x:t.x,y:t.y});return{x:s,y:i,rightMin:w,rightMax:l,leftMin:b,leftMax:a,points:n}}},_convertPointToLatLong:function(n,t,i,r){var u,f,e;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,f=Math.min(n,0,u-1)/u-.5,e=.5-Math.min(t,0,u-1)/u,latitude=90-360*Math.atan(Math.exp(-e*2*Math.PI))/Math.PI,longitude=360*f,{x:latitude,y:longitude}},_convertTileLatLongtoPointForShapes:function(n,t,i,r){var u,s,f,h,e,o;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,s=(t+180)/360,f=Math.sin(n*Math.PI/180),f==-1&&(f=-.5),h=.5-Math.log((1+f)/(1-f))/(4*Math.PI),this._isMapCoordinates?(e=Math.min(Math.max(s*u+.5,0),u-1),o=Math.min(Math.max(h*u+.5,0),u-1)):r!=null?(e=Math.abs((t-this._mapBounds[0][0])*r),o=Math.abs((this._mapBounds[1][1]-n)*r)):(e=t,o=n),{x:e,y:o}},_convertTileLatLongtoPoint:function(n,t){var u=Math.pow(2,this._zoomLevel())*256,e=(t+180)/360,f=Math.sin(n*Math.PI/180),o=.5-Math.log((1+f)/(1-f))/(4*Math.PI),i,r;return this._isMapCoordinates?(i=e*u+.5+this._tileTranslatePoint.x,r=o*u+.5+this._tileTranslatePoint.y):factor!=null?(i=Math.abs((t-this._mapBounds[0][0])*factor),r=Math.abs((this._mapBounds[1][1]-n)*factor)):(i=t,r=n),{x:i,y:r}},_convertLatLongtoPointforMarker:function(n,t){var r=this._getFactor(),i=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,r);return{x:(i.x+this._translatePoint.x)*this._scale,y:(i.y+this._translatePoint.y)*this._scale}},_animate:function(n){function s(n,t){return n[0]==t[0]?null:(t[1]-n[1])/(t[0]-n[0])}function h(n,t){return t===null?n[0]:n[1]-t*n[0]}this._calculateMarginConditions();t(this._rootgroup).stop(!0,!1);this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1);var i=this,e={x:this._translatePoint.x,y:this._translatePoint.y},r=[this._prevPoint.x,this._prevPoint.y],u=[this._translatePoint.x,this._translatePoint.y];var f=s(r,u),c=h(r,f),l=u[0]-r[0],a=u[1]-r[1],v=this._scale-this._prevScale,o=this._scale;this._updateSliderValue();t(this._rootgroup).animate({count:10},{duration:n,step:function(n,t){var u=i._prevScale+n*(v/t.end),e=r[0]+n*(l/t.end)/(u/o),s;s=f==null?r[1]+n*(a/t.end):f*e+c;_isSVG?i._rootgroup.setAttribute("transform","scale("+u+") translate("+e+", "+s+")"):(i._rootgroup.coordorigin=-e+","+-s,i._rootgroup.coordsize=i._width/u+","+i._height/u);i._translatePoint.x=e;i._translatePoint.y=s;i._scale=u;i._refrshLayers();i._resizeShape()},complete:function(){i._translatePoint.x=e.x;i._translatePoint.y=e.y;i._scale=o;this.count=0}})},_applyTransform:function(n,t){this._scale=n;this._translatePoint=t;this._isTileMap||this._calculateMarginConditions();this._translatePoint.x!=Number.POSITIVE_INFINITY&&this._translatePoint.y!=Number.POSITIVE_INFINITY&&(_isSVG?this._rootgroup.setAttribute("transform","scale("+this._scale+") translate("+this._translatePoint.x+", "+this._translatePoint.y+")"):(this._rootgroup.coordorigin=-this._translatePoint.x+","+-this._translatePoint.y,this._rootgroup.coordsize=this._width/n+","+this._height/n))},_mouseMove:function(n){var t,i,f,e,r,u;n.type=="touchmove"&&n.originalEvent.touches.length>1?this._isPinching=!0:(t=this,t.ispanning&&t.enablePan()&&(n.preventDefault(),n.type=="mousemove"||n.type=="pointermove"?i={x:n.pageX,y:n.pageY}:n.type=="touchmove"?i={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerMove"&&(i={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),this._isTileMap&&(f=this._tileTranslatePoint.x-(this._dragStartX-i.x),e=this._tileTranslatePoint.y-(this._dragStartY-i.y),this._tileTranslatePoint.x=f,this._tileTranslatePoint.y=e,this._generateTiles(this._zoomLevel())),r=t._translatePoint.x-(t._dragStartX-i.x)/t._scale,u=t._translatePoint.y-(t._dragStartY-i.y)/t._scale,(r!=t._translatePoint.x||u!=t._translatePoint.y)&&(t._isDragging=!0),this._translatePoint.x=r,this._translatePoint.y=u,t._applyTransform(t._scale,t._translatePoint),t._dragStartX=i.x,t._dragStartY=i.y,t._refrshLayers()))},_svgMouseLeave:function(){var n=this;n.ispanning=!1},_mouseWheel:function(n){if(this.model.zoomSettings.enableZoom){this.enableAnimation()&&t(this._rootgroup).stop(!0,!1);var i=n.originalEvent,r=n;_isSVG||(i=n);n.target.className!="LegendDiv"&&n.target.className!="e-defaultLegendLabel"&&(i.preventDefault?i.preventDefault():r.preventDefault(),_isSVG?this._zooming(n.originalEvent.wheelDelta,n.originalEvent):this._zooming(n.originalEvent.wheelDelta,i))}},_mouseButtonUp:function(n){var t=this;t.ispanning&&t._trigger("panned",{originalEvent:n});t.ispanning=!1},_mouseUp:function(){this.ispanning=!1;this._isDragging=!1},_mouseButtonDown:function(n){var r,i;this._isPinching=!1;n.target.className!="e-vhandle"&&(this._isNavigationPressed=!1,this.enableAnimation()&&(t(this._rootgroup).stop(!0,!1),this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1)),n.type=="touchstart"&&n.originalEvent.touches.length>1||(n.type=="mousedown"||n.type=="pointerdown"?r={x:n.pageX,y:n.pageY}:n.type=="touchstart"?r={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerDown"&&(r={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),i=this,i._scale>1&&i.model.enablePan&&(n.preventDefault(),i.ispanning=!0),i._dragStartX=r.x,i._dragStartY=r.y))},_getCurrentPoint:function(n){var t=this._mapContainer,i=n.pageX-t.offset().left,r=n.pageY-t.offset().top;return{x:i,y:r}},_legendDoubleClick:function(n){for(var t=n.target;t.parentNode!=null&&t.parentNode.className!="ScrollLegendDiv e-scroller e-js e-widget";)t=t.parentNode;t.parentNode!=null&&t.parentNode.className=="ScrollLegendDiv e-scroller e-js e-widget"&&(this._isNavigationPressed=!0)},_doubleClick:function(n){var t=this,f=t._zoomLevel(),r,u,i;t._legendDoubleClick(n);this._isNavigationPressed||n.target.className.toString().indexOf("e-icon1")!=-1||(r=this._getCurrentPoint(n),t.model.zoomSettings.enableZoom&&t._zoomLevel()+t._zoomFactor()>=t._minZoom()&&t._zoomLevel()+t._zoomFactor()<=t._maxZoom()&&(u=t._scale,t._prevScale=u,this._isTileMap?(this._tileZoom(t._zoomLevel()-t._zoomFactor(),t._zoomLevel(),r),i=t._zoomLevel(),t.model.zoomSettings.level=t._zoomLevel()+t._zoomFactor(),t._zoomLevel(t._zoomLevel()+t._zoomFactor()),this._generateTiles(this._zoomLevel()),t._translatePoint.x=(t._tileTranslatePoint.x-.5*Math.pow(2,i))/Math.pow(2,i),t._translatePoint.y=(t._tileTranslatePoint.y-.5*Math.pow(2,i))/Math.pow(2,i),t._scale=Math.pow(2,i)):(t._prevPoint={x:t._translatePoint.x,y:t._translatePoint.y},t._translatePoint.x-=(t._width/t._scale-t._width/(t._scale+t._zoomFactor()))/(t._width/r.x),t._translatePoint.y-=(t._height/t._scale-t._height/(t._scale+t._zoomFactor()))/(t._height/r.y),t._scale=u+t._zoomFactor(),t.model.zoomSettings.level=t._zoomLevel()+t._zoomFactor(),t._zoomLevel(t._zoomLevel()+t._zoomFactor())),f<t._zoomLevel()&&t._trigger("zoomedIn",{originalEvent:null,zoomLevel:t._zoomLevel()}),t.enableAnimation()&&!this._isTileMap?t._animate(600):(t._applyTransform(t._scale,t._translatePoint),t._refrshLayers(),t._resizeShape()),t._updateSliderValue()))},_tileZoom:function(n,t,i){var c=this,r;if(t>0&&t<20){this._tileDiv.html("");r=Math.pow(2,n)*256;i==u&&(i={x:this._width/2,y:this._height/2});var f=Math.pow(2,t)*256,e=(i.x-this._tileTranslatePoint.x)/r*100,o=(i.y-this._tileTranslatePoint.y)/r*100,s=e*f/100,h=o*f/100;this._tileTranslatePoint.x=i.x-s;this._tileTranslatePoint.y=i.y-h}},_bubbleEnterFunction:function(n){if(n.data.templateID!=null){var i=t("#"+n.data.templateID).render(n.data.itemsrc);t(n.data.htmlobj).html(i)}return t(document.body).append(n.data.htmlobj),t(n.data.htmlobj).css("display","block").css({left:n.pageX+8+"px",top:n.pageY+6+"px"})},_bubbleleaveFunction:function(n){return t(n.data.htmlobj).remove(),t(n.data.htmlobj).css("display","none")},_bubbleOverFunction:function(n){return t(n.data.htmlobj).css("display","block").css({left:n.pageX+8+"px",top:n.pageY+6+"px"})},_polyEnterFunction:function(n){var p=jQuery.uaMatch(navigator.userAgent),i=n.data.Param1,f,w=this.isTouch?this.isTouch(n):!1,h,e,o,s,a,c,l,v,y;if(w&&p.browser=="chrome"?(h=n.originalEvent.changedTouches[0],f=document.elementFromPoint(h.clientX,h.clientY)):f=n.data.Param2.shape,e=n.data.map,o=jQuery.grep(i._smartLabels,function(n){return n.shape==f}),i.enableMouseHover){if(i._clearShapeWidth(e._scale),i._prevHoverdLegend==null||i._contains(i._prevSelectedLegends,i._prevHoverdLegend)||i._prevHoverdLegend.css("background-color",_isSVG?i._prevHoveredShape.getAttribute("fill"):i._prevHoveredShape.fillcolor.value),_isSVG?(f.setAttribute("stroke-width",i.shapeSettings.highlightBorderWidth/e._scale),f.setAttribute("stroke",i.shapeSettings.highlightStroke)):(f.strokeweight=i.shapeSettings.highlightBorderWidth,f.strokecolor=i.shapeSettings.highlightStroke/e._scale),i.shapeSettings.highlightColor!=null&&(i.shapeSettings.highlightColor=="transparent"||i._contains(i._prevSelectedShapes,f)||(f.setAttribute("class","e-mapHighlightedShape mapShape"),_isSVG?(i.shapeSettings.highlightColor!="none"&&f.highlightcolor==null?f.setAttribute("fill",i.shapeSettings.highlightColor):f.setAttribute("fill",f.highlightcolor),f.setAttribute("stroke-width",i.shapeSettings.highlightBorderWidth/e._scale),f.setAttribute("stroke",i.shapeSettings.highlightStroke)):f.fillcolor=i.shapeSettings.highlightColor),o.length>0&&!i._contains(i._prevSelectedLegends,o[0].legend)&&(o[0].legend[0].setAttribute("class","e-mapHighlightedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.highlightColor),i._prevHoverdLegend=o[0].legend),i._prevHoveredShape=f),i.legendSettings!=null&&i.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&i.shapeSettings.colorMappings!=null&&i.shapeSettings.colorMappings.rangeColorMapping!=null&&!i.shapeSettings.autoFill&&(i.legendSettings.showLegend==u||i.legendSettings.showLegend))for(s=0;s<i._mapShapes.length;s++)if(a=i._mapShapes[s].shape,a==f&&(c=null,i.shapeSettings.colorMappings.rangeColorMapping!=u&&(c=i.shapeSettings.colorMappings.rangeColorMapping),l=i.legendSettings.width,i.legendSettings.width==u&&(l=150),v=l/c.length/10,i._mapShapes[s].legendrect!=null)){y=i._mapShapes[s].legendrect.marginLeft;t(i._interactiveArrow).css({"margin-left":y+Math.ceil(v)-i._interactiveArrow.width()/2,display:"block"});break}e._trigger("mouseover",{originalEvent:n.data.Param2})}},_updateShapeRect:function(n){for(var i,t=0;t<n._mapShapes.length;t++)i=n._mapShapes[t],i.left==null&&(i.left=n._mapShapes[t].shape.getBoundingClientRect().left,i.right=n._mapShapes[t].shape.getBoundingClientRect().right,i.top=n._mapShapes[t].shape.getBoundingClientRect().top,i.bottom=n._mapShapes[t].shape.getBoundingClientRect().bottom,n._mapShapes[t]=i)},_polyUpFunction:function(n){var i=n.data.Param2,o=n.data.Param3,s=this.isTouch(n),h,u,f,e;if(s&&n.stopImmediatePropagation(),this.model.zoomSettings.enableZoomOnSelection&&!this._isDragging&&!this._isTileMap&&!this._isPinching){if(_isSVG)h=o.getBBox(),this._zoomOnSelection(h);else for(this._updateShapeRect(i),u=0;u<i._mapShapes.length;u++)if(o==i._mapShapes[u].shape){var c=i._mapShapes[u].left,l=i._mapShapes[u].top,b=i._mapShapes[u].right,k=i._mapShapes[u].bottom,d={x:c,y:l,width:b-c,height:k-l};this._zoomOnSelection(d);break}this.ispanning=!1}if(f=i._tooltipElement,f!=null&&t(f).delay(200).queue(function(n){t(this).css("display","none");n()}),s&&i.showTooltip){var a=this.getEventXY(n),r=this,v=r.model.cachedXY,y=10,p,w;p=Math.abs(v.x-a.X);w=Math.abs(v.y-a.Y);p<y&&w<y&&(this.touchEnd=!0,e=n.data.Param1,n.data.Param1=i,n.data.Param2=e,r._polyMoveFunction(n),n.data.Param1=e,n.data.Param2=i,r.tooltipElement=i._tooltipElement[0],t(r.tooltipElement).stop(!0,!0),r._timeOut=r._timeOut.bind(r),r.touchTimeOut=window.setTimeout(r._timeOut,1e3))}},_timeOut:function(){t(this.tooltipElement).fadeOut()},_markerPressed:function(n){this._trigger("markerSelected",{originalEvent:n.data})},_polyMouseDown:function(n){var e=n.data.Param2,u,y,p,w;if(n.type=="mousedown"||n.type=="pointerdown"?u={x:n.pageX||n.originalEvent.pageX,y:n.pageY||n.originalEvent.pageY}:n.type=="touchstart"?u={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerDown"&&(u={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),this.model.cachedXY=u,!this.isTouch(n)&&n.data.Param1.hasOwnProperty("data")&&e.showTooltip){var i=e._tooltipElement,v=e.tooltipTemplate,f=t(this._mapContainer).offset();f==null&&(f={left:0,width:0,height:0});var r=e._tooltipSize,o=this._height,s=this._width;if(i!=null&&v!=null){t(i).css({display:"block"});y=t("#"+v).render(n.data.Param1.data);t(i).html(y);p=i[0]!=null?i[0].clientHeight:i.clientHeight;w=i[0]!=null?i[0].clientWidth:i.clientWidth;r={height:p,width:w};var c=u.x-t(this._mapContainer).offset().left,l=u.y-t(this._mapContainer).offset().top,h=u.x,a=u.y;r.width+c>=s&&(h-r.width>f.left?h=f.left+s-(s-c)-r.width:h-=r.width+c-s);r.height>o?o+r.height>this._height+l&&(a-=f.top+10):r.height+l>=o&&(a-=r.height+l-o);t(i).css({left:h+10,top:a+10})}}},getEventXY:function(n){var t,i;return t=n.pageX||n.originalEvent.pageX||n.originalEvent.changedTouches[0].pageX,i=n.pageY||n.originalEvent.pageY||n.originalEvent.changedTouches[0].pageY,{X:t,Y:i}},_polyClickFunction:function(n){var k=n.ctrlKey,i=n.data.Param2,h=this,a=10,v=h.model.cachedXY,y,p,w=h.getEventXY(n),f,s,o,b,c,l,e;if(y=Math.abs(v.x-w.X),p=Math.abs(v.y-w.Y),y<a&&p<a){if(f=n.data.Param3,n.data.param4!=u&&(s=n.data.param4),o=jQuery.grep(i._smartLabels,function(n){return n.shape==f}),h._isPolygonSelected=!0,i.enableSelection)if(k&&i.selectionMode==r.datavisualization.Map.SelectionMode.Multiple)o!=null&&o.length>0&&(t.inArray(o[0].legend,i._prevSelectedLegends)==-1?(o[0].legend[0].setAttribute("class","e-mapSelectedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.selectionColor),i._prevSelectedLegends.push(o[0].legend)):(c=i._prevSelectedLegends.indexOf(o[0].legend),o[0].legend[0].setAttribute("class","mapShape"),o[0].legend.css("background-color",o[0].legend[0].getAttribute("nodeValue")),i._prevSelectedLegends.splice(c,1))),s!=null&&(l=document.getElementsByClassName("e-map-labelContainer"),t.inArray(s,i._prevSelectedTemp)==-1?(t(s).css("background-color",i.shapeSettings.selectionColor),t(s).css("width",l[0].clientWidth),i._prevSelectedTemp.push(s)):(t(s).css("background-color",""),b=i._prevSelectedTemp.indexOf(s),i._prevSelectedTemp.splice(b,1))),t.inArray(f,i._prevSelectedShapes)==-1?(f.setAttribute("class","e-mapSelectedShape mapShape"),_isSVG?(f.setAttribute("fill",i.shapeSettings.selectionColor),f.setAttribute("stroke",i.shapeSettings.selectionStroke),f.setAttribute("stroke-width",i.shapeSettings.selectionStrokeWidth/h._scale)):(f.fillcolor=i.shapeSettings.selectionColor,f.strokecolor=i.shapeSettings.selectionStroke,f.strokeweight=i.shapeSettings.selectionStrokeWidth/h._scale),i._prevSelectedShapes.push(f),i.selectedItems.push(n.data.Param1)):(f.setAttribute("class","mapShape"),f.setAttribute("fill",f.getAttribute("nodeValue")),f.setAttribute("stroke",i.shapeSettings.stroke),f.setAttribute("stroke-width",i.shapeSettings.strokeThickness/this._scale),c=i._prevSelectedShapes.indexOf(f),i._prevSelectedShapes.splice(c,1),i.selectedItems.splice(c,1));else{for(e=0;e<i._prevSelectedLegends.length;e++)i._prevSelectedLegends[e][0].setAttribute("class","mapShape"),i._prevSelectedLegends[e].css("background-color",i._prevSelectedLegends[e][0].getAttribute("nodeValue"));for(o!=null&&o.length>0&&(o[0].legend[0].setAttribute("class","e-mapSelectedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.selectionColor),i._prevSelectedLegends.push(o[0].legend)),e=0;e<i._prevSelectedShapes.length;e++)i._prevSelectedShapes[e].setAttribute("class","mapShape"),_isSVG?(i._prevSelectedShapes[e].setAttribute("fill",i._prevSelectedShapes[e].getAttribute("nodeValue")),i._prevSelectedShapes[e].setAttribute("stroke",i.shapeSettings.stroke),i._prevSelectedShapes[e].setAttribute("stroke-width",i.shapeSettings.strokeThickness/this._scale)):(i.fillcolor=i._prevSelectedShapes[e].getAttribute("nodeValue"),i.strokecolor=i.shapeSettings.stroke,i.strokeweight=i.shapeSettings.strokeThickness/this._scale);if(s!=null)if(l=document.getElementsByClassName("e-map-labelContainer"),t.inArray(s,i._prevSelectedTemp)==-1){for(e=0;e<i._prevSelectedTemp.length;e++)t(i._prevSelectedTemp[e]).css("background-color","");i._prevSelectedTemp=[];t(s).css("background-color",i.shapeSettings.selectionColor);t(s).css("width",l[0].clientWidth);i._prevSelectedTemp.push(s)}else{for(e=0;e<i._prevSelectedTemp.length;e++)t(i._prevSelectedTemp[e]).css("background-color","");i._prevSelectedTemp=[]}this._isPinching||t.inArray(f,i._prevSelectedShapes)!=-1?(i._prevSelectedShapes=[],i.selectedItems=[]):(f.setAttribute("class","e-mapSelectedShape mapShape"),i._prevSelectedShapes=[],i.selectedItems=[],_isSVG?(f.setAttribute("fill",i.shapeSettings.selectionColor),f.setAttribute("stroke",i.shapeSettings.selectionStroke),f.setAttribute("stroke-width",i.shapeSettings.selectionStrokeWidth/h._scale)):(f.fillcolor=i.shapeSettings.selectionColor,f.strokecolor=i.shapeSettings.selectionStroke,f.strokeweight=i.shapeSettings.selectionStrokeWidth/h._scale),i._prevSelectedShapes.push(f),i.selectedItems.push(n.data.Param1))}h._trigger("shapeSelected",{originalEvent:i.selectedItems})}},_updateSelection:function(n,t,i){n.enableSelection&&(n.selectionMode!=r.datavisualization.Map.SelectionMode.Multiple&&(n._prevSelectedShapes.pop(),n.selectedItems.pop()),n._prevSelectedShapes.push(t),n.selectedItems.push(i))},_zoomOnSelection:function(n){var u,t,i,r;_isSVG||(n.x=n.x-this._baseTranslatePoint.x/2-n.width/2,n.y=n.y-this._baseTranslatePoint.y/2-n.height/2);t=n.width;i=n.height;u=(this._width-100)/(this._height-100)>t/i?(this._height-100)/i:(this._width-100)/t;this._prevScale=this._scale;this._scale=u;this._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y};this.model.zoomSettings.level=this._scale-this._baseScale+1;this._zoomLevel(this._scale-this._baseScale+1);r=this._zoomLevel();r>this._minZoom()&&r<this._maxZoom()||(this.model.zoomSettings.level=r>(this._maxZoom()-this._minZoom())/2+this._minZoom()?this._maxZoom():this._minZoom(),this._zoomLevel(this.model.zoomSettings.level),this._scale=this._zoomLevel()+this._baseScale-1);var f=this._width/2-t*this._scale/2,e=f/this._scale,o=this._height/2-i*this._scale/2,s=o/this._scale;this._translatePoint.x=-n.x+e;this._translatePoint.y=-n.y+s;this.enableAnimation()&&!this._isTileMap?this._animate(1200):(this._applyTransform(this._scale,this._translatePoint),this._updateSliderValue())},_polyMoveFunction:function(n){var y=n.data.Param1,it=this.isTouch?this.isTouch(n):!1,k,e,s,nt,tt,v;if((!it&&n.type.toString().indexOf("move")>-1||this.touchEnd)&&(this.touchEnd=!1,this.model!=null)){var o=this.model.layers[this.baseMapIndex()],i=y._tooltipElement,d=y.tooltipTemplate,g=n.data.Param2,u=y._tooltipSize,f=t(this._mapContainer).offset();f==null&&(f={left:0,top:0,width:0,height:0});v=o.legendSettings.dockOnMap&&o.legendSettings.dockPosition=="right"?this._width+o.legendSettings.width+20+o.legendSettings.leftLabel.length*10+o.legendSettings.rightLabel.length*10:this._width;var h=this._height,c=v,l=this.getEventXY(n),p=l.X-f.left,w=l.Y-f.top,a=l.X,b=l.Y;if(i!=null&&d!=null&&g.hasOwnProperty("data")&&n.data.Param1.showTooltip){if(t(i).css({display:"block"}),k=this.model.locale,e=t.extend({},g.data),k&&this.model.enableGroupSeparator)for(s in e)e[s]=isNaN(parseFloat(e[s]))?e[s]:parseFloat(e[s]).toLocaleString(k);nt=t("#"+d).render(e);t(i).html(nt);tt=i[0]!=null?i[0].clientHeight:i.clientHeight;v=i[0]!=null?i[0].clientWidth:i.clientWidth;u={height:tt,width:v};r.util.isNullOrUndefined(this.touchTimeOut)||window.clearTimeout(this.touchTimeOut);u.width+p>=c&&(a-u.width>f.left?a=f.left+c-(c-p)-u.width:a-=u.width+p-c);u.height>h?h+u.height>this._height+w&&(b-=f.top+10):u.height+w>=h&&(b-=u.height+w-h);t(i).css({left:a+10,top:b+10})}}},_polyLeaveFunction:function(n){var u=n.data.Param1,h=this.isTouch(n),e=n.data.map,o=n.data.Param2.shape,s=u._tooltipElement,f=u._prevSelectedShapes;if(f.length>0)for(o.setAttribute("class","mapShape"),i=0;i<f.length;i++)f[i].setAttribute("class","e-mapSelectedShape mapShape");else o.setAttribute("class","mapShape");s==null||h||t(s).css("display","none");u.legendSettings!=null&&u.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&u._interactiveArrow!=null&&t(u._interactiveArrow).css("display","none");u._clearShapeWidth(e._scale);e._trigger("mouseleave",{originalEvent:n.data.Param2})},_wireEvents:function(){function o(i){n.enableAnimation()&&t(n._rootgroup).stop(!0,!1);i.preventDefault(i);n._zooming(-40*i.detail,i)}var e=jQuery.uaMatch(navigator.userAgent),i=e.browser.toLowerCase(),f,n,u;this._on(t(this._mapContainer),r.eventType.mouseDown,this._mouseButtonDown);t(document).keydown({className:"home",map:this},this._keyboardKeysPressed);this._on(t(this._mapContainer),r.eventType.mouseMove,this._mouseMove);this._on(t(document),r.eventType.mouseUp,this._mouseUp);f=!!navigator.userAgent.match(/Trident\/7\./);f&&(i="msie");window.navigator.msPointerEnabled?(this._on(t(this._mapContainer),"MSPointerUp",this._mouseButtonUp),this.model.zoomSettings.enableZoom&&t(this._mapContainer).css("-ms-touch-action","none")):this._on(t(this._mapContainer),"mouseup",this._mouseButtonUp);n=this;this._browser=i;i!="mozilla"?this._on(t(this._mapContainer),"mousewheel",this._mouseWheel):(u=this._svgDocument||this._mapContainer[0],u.addEventListener&&u.addEventListener("DOMMouseScroll",o,!1));this._on(t(this._mapContainer),"dblclick",this._doubleClick);(this.model.enableResize||this.model.isResponsive)&&(r.isTouchDevice()?this._on(t(window),"orientationchange",this._mapResize):this._on(t(window),"resize",this._mapResize))},clip:function(n,t,i){return Math.min(Math.max(n,t),i)},pointToLatLong:function(n,t){var i=this,u=i._getFactor(),f=n/i._scale-i._translatePoint.x,e=t/i._scale-i._translatePoint.y,r=Math.min(i._height,i._width)*u,o=i.clip(f,0,r-1)/r-.5,s=.5-i.clip(e,0,r-1)/r;return latitude=90-360*Math.atan(Math.exp(-s*2*Math.PI))/Math.PI,longitude=360*o,{latitude:latitude,longitude:longitude}},_mapResize:function(n){n.preventDefault();n.stopPropagation();var i={width:this._width,height:this._height},r=this._translatePoint,t=this;this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){if(t.model!=null){var n=t.pointToLatLong(t._width/2,t._height/2);t.refresh(!0);t._isTileMap||t.navigateTo(n.latitude,n.longitude,t._zoomLevel(),!1)}},500)},_isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_unWireEvents:function(){var u=jQuery.uaMatch(navigator.userAgent),n=u.browser.toLowerCase(),i;this._off(t(document),"keydown",this._keyboardKeysPressed);this._off(t(document),r.eventType.mouseUp,this._mouseUp);i=!!navigator.userAgent.match(/Trident\/7\./);i&&(n="msie");n!="mozilla"&&this._off(t(this._mapContainer),"mousewheel",this._mouseWheel);window.navigator.msPointerEnabled?(this._off(t(this._mapContainer),"MSPointerDown",this._mouseButtonDown),this._off(t(this._mapContainer),"MSPointerMove",this._mouseMove),this._off(t(this._mapContainer),"MSPointerUp",this._mouseButtonUp)):n=="webkit"||n=="chrome"||n=="mozilla"?(this._off(t(this._mapContainer),"mousedown",this._mouseButtonDown),this._off(t(this._mapContainer),"mousemove",this._mouseMove),this._off(t(this._mapContainer),"mouseup",this._mouseButtonUp)):(this._off(t(this._mapContainer),"mousedown",this._mouseButtonDown),this._off(t(this._mapContainer),"mousemove",this._mouseMove),this._off(t(this._mapContainer),"mouseup",this._mouseButtonUp));this._off(t(this._mapContainer),"dblclick",this._doubleClick)},navigateTo:function(n,t,i,r){var e,f,o,s;r==u&&(r=this.enableAnimation());i=parseFloat(i);i==u&&(i=this._zoomLevel());i>this._minZoom()&&i<this._maxZoom()?(this.model.zoomSettings.level=i,this._zoomLevel(i)):(this.model.zoomSettings.level=i>(this._maxZoom()-this._minZoom())/2+this._minZoom()?this._maxZoom():this._minZoom(),this._zoomLevel(this.model.zoomSettings.level));e=this._getFactor();f=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,e);this._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y};this._prevScale=this._scale;this._scale=this._baseScale+(i-1)*this._zoomFactor();o=(this._containerWidth+this._baseTranslatePoint.x)/2/this._scale;s=(this._containerHeight+this._baseTranslatePoint.y)/2/this._scale;this._translatePoint.x=-f.x+o;this._translatePoint.y=-f.y+s;r&&!this._isTileMap?this._animate(1200):this._applyTransform(this._scale,this._translatePoint);this._updateSliderValue();this._refrshLayers()},selectShape:function(n,t,i){var e,f,u;if(n!=null)for(t==null&&(t=this.model.layers[this.baseMapIndex()]),u=0;u<t._mapShapes.length;u++)if(e=t._mapShapes[u].data,f=t._mapShapes[u].shape,e!=null&&n==this._reflection(e,t.shapeSettings.valuePath)){if(t._prevSelectedShapes.length!=0&&t.selectionMode!=r.datavisualization.Map.SelectionMode.Multiple)for(u=0;u<t._prevSelectedShapes.length;u++)_isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t._prevSelectedShapes[u].fillcolor=t._prevSelectedShapes[u].style.behavior,t._prevSelectedShapes[u].strokecolor=t.shapeSettings.stroke,t._prevSelectedShapes[u].strokeweight=t.shapeSettings.strokeThickness/this._scale);t.enableSelection&&(_isSVG?(t.shapeSettings.selectionColor!="none"&&f.setAttribute("fill",t.shapeSettings.selectionColor),f.setAttribute("stroke",t.shapeSettings.selectionStroke),f.setAttribute("stroke-width",t.shapeSettings.selectionStrokeWidth/this._scale)):(t.shapeSettings.selectionColor!="none"&&(f.fillcolor=t.shapeSettings.selectionColor),f.strokecolor=t.shapeSettings.selectionStroke,f.strokeweight=t.shapeSettings.selectionStrokeWidth/this._scale),this._updateSelection(t,f,n),t._contains(t.selectedItems,t._mapShapes[u])||t.selectedItems.push(t._mapShapes[u]),this._trigger("shapeSelected",{originalEvent:t.selectedItems}));i&&this.model.zoomSettings.enableZoomOnSelection&&this._zoomOnSelection(f.getBBox());u=t._mapShapes.length}},_getIntersectedElements:function(n,i){var r,u;if(n.width+=5,n.height+=5,_isSVG&&this._browser!="mozilla"&&this._browser!="webkit")return r=this._svgDocument.createSVGRect(),r.x=n.left,r.y=n.top,r.width=n.width,r.height=n.height,this._svgDocument.getIntersectionList(r,null);var o=[],s=t(this._mapContainer).offset(),h=s.left,c=s.top;for(u=0;u<i.length;u++){var f=i[u].shape,e=f.getBoundingClientRect(),l=t(f).offset().left-h,a=t(f).offset().top-c;if(this._isIntersect(n,{left:l,top:a,height:e.bottom-e.top,width:e.right-e.left}))return o.push(f),o}return o},_isIntersect:function(n,t){return n.left>=t.left+t.width||n.left+n.width<=t.left||n.top>=t.top+t.height||n.top+n.height<=t.top?!1:!0},pan:function(t){var i=this,r=0,u=0,f,e,o,s;if(this._zoomLevel()!=1){switch(t){case"right":r=this._width/7;u=0;break;case"top":r=0;u=-(this._height/7);break;case"left":r=-(this._width/7);u=0;break;case"bottom":r=0;u=this._height/7}i.enablePan()&&(this._isTileMap&&(f=this._tileTranslatePoint.x-r/i._scale,e=this._tileTranslatePoint.y-u/i._scale,this._tileTranslatePoint.x=f,this._tileTranslatePoint.y=e,this._generateTiles(this._zoomLevel())),o=i._translatePoint.x-r/i._scale,i._prevScale=i._scale,s=i._translatePoint.y-u/i._scale,i._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y},this._translatePoint.x=o,this._translatePoint.y=s,i.enableAnimation()&&!this._isTileMap?i._animate(600):i._applyTransform(i._scale,i._translatePoint),i._refrshLayers())}},zoom:function(n,t){var i=this,r=i._zoomLevel(),f;n<=this._maxZoom()&&n>=this._minZoom()?(this._isTileMap?(this._tileZoom(i._zoomLevel(),n,{x:this._width/2,y:this._height/2}),r=i._zoomLevel(),i.model.zoomSettings.level=n,i._zoomLevel(n),this._generateTiles(this._zoomLevel()),i._translatePoint.x=(i._tileTranslatePoint.x-.5*Math.pow(2,r))/Math.pow(2,r),i._translatePoint.y=(i._tileTranslatePoint.y-.5*Math.pow(2,r))/Math.pow(2,r),i._scale=Math.pow(2,r)):(f=i._baseScale+(n-1)*i._zoomFactor(),i._prevPoint={x:i._translatePoint.x,y:i._translatePoint.y},i._prevScale=i._scale,i._translatePoint.x-=(i._width/i._scale-i._width/f)/2,i._translatePoint.y-=(i._height/i._scale-i._height/f)/2,i._scale=f,i.model.zoomSettings.level=n,i._zoomLevel(n),(i.enableAnimation()&&t||t==u)&&i._animate(600)),i.enableAnimation()&&t||(i._applyTransform(i._scale,i._translatePoint),i._refrshLayers(),i._resizeShape()),i._updateSliderValue()):n<=this._minZoom()?(this.model.zoomSettings.level=this._minZoom(),this._zoomLevel(this._minZoom()),this.zoom(this._zoomLevel())):n>=this._maxZoom()&&(this.model.zoomSettings.level=this._maxZoom(),this._zoomLevel(this._maxZoom()),this.zoom(this._zoomLevel()));r<n?i._trigger("zoomedIn",{originalEvent:null,zoomLevel:i._zoomLevel()}):r>n&&i._trigger("zoomedOut",{originalEvent:null,zoomLevel:i._zoomLevel()})},refresh:function(n){var i,r;t(this._svgDocument).children().remove();t(this._svgDocument).empty();t(this._mapContainer).empty();this.baseMapIndex()>=this.model.layers.length&&this.baseMapIndex(0);this.model.layers[this.baseMapIndex()]._mapItems&&(this.model.layers[this.baseMapIndex()]._mapItems=null);this._svgDocument!=null&&(this._svgDocument=null);this._scale=1;this._margintop=0;this._marginleft=0;this._translatePoint={x:0,y:0};this._height=this._mapContainer.height();this._width=this._mapContainer.width();this._height==0&&(this._height=this._mapContainer[0].parentElement.clientHeight!=0?this._mapContainer[0].parentElement.clientHeight:t(document).height());this._width==0&&(this._width=this._mapContainer[0].parentElement.clientWidth!=0?this._mapContainer[0].parentElement.clientWidth:t(document).width());i=this.model.layers[this.baseMapIndex()];i.legendSettings!=null&&i.legendSettings.showLegend&&i.shapeSettings.colorMappings!=null&&i._sizeCalculation(this);this._generatePath();this._groupSize!=null&&(this._isMapCoordinates?(this._containerHeight=this._groupSize.maxY-this._groupSize.minY,this._containerWidth=this._groupSize.maxX-this._groupSize.minX,this._groupBorder={x:this._groupSize.minX,y:this._groupSize.minY}):(r=this._getFactor(),this._containerHeight=Math.abs((this._groupSize.maxY-this._groupSize.minY)*r),this._containerWidth=Math.abs((this._groupSize.maxX-this._groupSize.minX)*r)));i.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background);this._resizingContainer();this._renderMapElements();i.legendSettings!=null&&i.legendSettings.showLegend&&i.shapeSettings.colorMappings!=null&&this._renderLegend();_isSVG&&t(this._svgDocument).css({height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft});this.model.enableLayerChangeAnimation&&t(this._mapContainer).animate({opacity:1},500);this.model.centerPosition==null||this._isTileMap||this.navigateTo(this.model.centerPosition[0],this.model.centerPosition[1],this._zoomLevel(),!1);this._legendContainer!=null&&this._legendContainer.css({height:this._legendSize.height});this._trigger("refreshed");n||(this._events=null,t(this._mapContainer).removeData(),t(this._mapContainer).data("ejMap",this))},_updateSliderValue:function(n){var t=this._sliderControl,i;n==u&&(n=this.enableAnimation());t!=null&&(i=t.data("ejSlider"),i.option("value",this._zoomLevel()))},_createDivElement:function(n,t,i,u){var f=n,e=t;e.appendTo(f);f.appendTo(i);this._on(e,r.eventType.mouseDown,{className:u,map:this},this._navigationControlPressed)},_navigationControlPressed:function(n){n.stopPropagation();this._isNavigationPressed=!0;var t=n.data.map,i=t.enableAnimation();n.data.className=="zoomIn"?(t.zoom(t._zoomLevel()+1,!0),i||t._updateSliderValue(),t._refrshLayers()):n.data.className=="zoomOut"?(t.zoom(t._zoomLevel()-1,!0),i||t._updateSliderValue()):n.data.className=="panLeft"?t.pan("left"):n.data.className=="panRight"?t.pan("right"):n.data.className=="panTop"?t.pan("top"):n.data.className=="panBottom"?t.pan("bottom"):n.data.className=="home"&&(t.zoom(1,!0),i||t._updateSliderValue())},_keyboardKeysPressed:function(n){this._iskeyboardKeysPressed=!0;var t=n.data.map,i=t.enableAnimation();n.ctrlKey&&n.keyCode==38?t._zoomingIn(t._width/2,t._height/2,n,i):n.ctrlKey&&n.keyCode==40?t._zoomingOut(t._width/2,t._height/2,n,i):n.keyCode==37?t.pan("left"):n.keyCode==39?t.pan("right"):n.keyCode==38?t.pan("top"):n.keyCode==40&&t.pan("bottom")},refreshNavigationControl:function(n){function tt(n){o!=null&&o._isRendered&&o._zoomLevel()!=n.value&&o.zoom(n.value,!1)}function it(n){o!=null&&o._isRendered&&o._zoomLevel()!=n.value&&o.zoom(n.value,!1)}var f=this.model.layers[this.baseMapIndex()],d=this._mapContainer.find("#ejNavigation"),e,l,s,a,h,v,o,p,w,b,k,i;if(d.length>0&&this._mapContainer[0].removeChild(d[0]),this.model.navigationControl!=null&&this.model.navigationControl.enableNavigation){n==u&&(n=this.model.navigationControl);var y=r.datavisualization.Map.LabelOrientation.Vertical,c,g=120,nt=12;c={width:90,height:320};e=t("<div id='ejNavigation' class='e-map-navigation e-orientation-vert'/>");(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(l=t("<div style='height:120px;width:10px;margin-top:-197px;margin-left: 34px;' />"));n.orientation=="horizontal"&&(y=r.datavisualization.Map.LabelOrientation.Horizontal,g=12,nt=120,c={width:320,height:90},e=t("<div id='ejNavigation' class='e-map-navigation e-orientation-horz' />"),(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(l=t("<div style='height:10px;width:120px;margin-top:-18px' />")));(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(s=t("<div class='e-panContainer'/>"),a=y=="horizontal"?"Horz":"Vert",n.orientation=="horizontal"?(h=t("<div style='margin-left: 94px;' />"),v=t("<div style='margin-left: 137px;'/>")):(h=t("<div />"),v=t("<div style='margin-top: 34px;'/>")),s.appendTo(e),h.appendTo(e),l.appendTo(v),v.appendTo(e),this._sliderControl=l,i={x:0,y:0},n.dockPosition==null||n.dockPosition==r.datavisualization.Map.Position.None?(i.x=this._width*n.absolutePosition.x/100,i.y=this._height*n.absolutePosition.y/100):i=this._getPosition(n.dockPosition,c),e.css({"margin-left":i.x+"px","margin-top":i.y+"px"}));o=this;p=this._height*.0025;this.model.navigationControl.content==null||this.model.navigationControl.content==""?navigationStyle=this._browser!="chrome"&&this._browser!="msie"?t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;zoom:"+p+";}<\/style>"):t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;-moz-transform: scale("+p+");}<\/style>"):(w=t("#"+this.model.navigationControl.content).height()||t(this.navigationControlData[0]).height(),b=t("#"+this.model.navigationControl.content).width()||t(this.navigationControlData[0]).width(),navigationStyle=this._browser!="mozilla"&&this._browser!="chrome"?t("<style> .e-map-navigation {width: "+b+"px;height: "+w+"px;position:absolute;z-index:2;}<\/style>"):t("<style> .e-map-navigation {width: "+b+"px;height: "+w+"px;position:absolute;z-index:2;}<\/style>"));this._browser!="mozilla"&&this._browser!="chrome"?(navigationStyle.remove(),t("html > head").append(navigationStyle)):t("html > head").append(navigationStyle);this.model.navigationControl.content==null||this.model.navigationControl.content==""?(t(l).ejSlider({orientation:y,sliderType:r.SliderType.MinRange,value:1,animationSpeed:1200,minValue:this._minZoom(),showTooltip:!0,enableAnimation:!1,maxValue:this._maxZoom(),incrementStep:this._zoomFactor(),slide:it,change:tt,height:g,width:nt}),e.appendTo(this._mapContainer),n.orientation=="horizontal"?(this._createDivElement(t("<div title='"+this._localizedLabels.zoomIn+"' class='e-icon1 e-incrementButton icon_margin1' />"),t("<div class='e-icon1 nav-inc-"+a+" e-innerIncrement'/>"),h,"zoomIn"),this._createDivElement(t("<div title='"+this._localizedLabels.zoomOut+"' class='e-icon1 e-incrementButton icon_margin2'/>"),t("<div class='e-icon1 nav-dec-"+a+" e-innerDecrement'/>"),h,"zoomOut")):(this._createDivElement(t("<div title='"+this._localizedLabels.zoomIn+"' class='e-icon1 e-incrementButton icon_margin1' />"),t("<div class='e-icon1 nav-inc-"+a+" e-innerIncrement'/>"),h,"zoomIn"),this._createDivElement(t("<div title='"+this._localizedLabels.zoomOut+"' class='e-icon1 e-incrementButton icon_margin2'/>"),t("<div class='e-icon1 nav-dec-"+a+" e-innerDecrement'/>"),h,"zoomOut")),this._createDivElement(t("<div title='"+this._localizedLabels.panTop+"' class='e-icon1 e-radialTop'/>"),t("<div class='e-icon1 e-arrowUp'/>"),s,"panTop"),this._createDivElement(t("<div title='"+this._localizedLabels.panLeft+"' class='e-icon1 e-radialLeft'/>"),t("<div class='e-icon1 e-arrowLeft'/>"),s,"panLeft"),this._createDivElement(t("<div title='"+this._localizedLabels.panRight+"' class='e-icon1 e-radialRight'/>"),t("<div class='e-icon1 e-arrowRight'/>"),s,"panRight"),this._createDivElement(t("<div title='"+this._localizedLabels.panBottom+"' class='e-icon1 e-radialBottom'/>"),t("<div class='e-icon1 e-arrowDown'/>"),s,"panBottom"),k=t("<div title='"+this._localizedLabels.home+"' class='e-icon1 e-home-bg'><div class='e-icon1 e-map-home'><\/div>"),k.appendTo(s),k.mousedown({className:"home",map:this},this._navigationControlPressed)):(this.navigationControlData==null?(this.navigationControlData=t("#"+this.model.navigationControl.content),this.navigationControlData.css({display:"block"}),this.navigationControlData.appendTo(e)):this.navigationControlData.appendTo(e),e.appendTo(this._mapContainer),c={width:this.navigationControlData[0].getBoundingClientRect().right-this.navigationControlData[0].getBoundingClientRect().left,height:this.navigationControlData[0].getBoundingClientRect().bottom-this.navigationControlData[0].getBoundingClientRect().top},i={x:0,y:0},n.dockPosition==null||n.dockPosition==r.datavisualization.Map.Position.None?(i.x=this._width*n.absolutePosition.x/100,i.y=this._height*n.absolutePosition.y/100):i=this._getPosition(n.dockPosition,c),f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?e.css({"margin-left":i.x+"px","margin-top":i.y+f.legendSettings.height+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?e.css({"margin-left":i.x+f.legendSettings.width+20+f.legendSettings.leftLabel.length*10+f.legendSettings.rightLabel.length*10+"px","margin-top":i.y+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Default?e.css({"margin-left":i.x+"px","margin-top":i.y+f.legendSettings.height+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Default?e.css({"margin-left":i.x+f.legendSettings.width+"px","margin-top":i.y+"px"}):e.css({"margin-left":i.x+"px","margin-top":i.y+"px"}))}},_getPosition:function(n,t){var i={x:0,y:0};switch(n){case r.datavisualization.Map.Position.TopCenter:i.x=this._width/2-t.width/2;break;case r.datavisualization.Map.Position.TopRight:i.x=this._width-t.width;break;case r.datavisualization.Map.Position.CenterLeft:i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.Center:i.x=this._width/2-t.width/2;i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.CenterRight:i.x=this._width-t.width;i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.BottomLeft:i.y=this._height-t.height;break;case r.datavisualization.Map.Position.BottomCenter:i.x=this._width/2-t.width/2;i.y=this._height-t.height;break;case r.datavisualization.Map.Position.BottomRight:i.x=this._width-t.width;i.y=this._height-t.height}return i},_renderMapElements:function(){this._templateDiv=t("<div class='TemplateDiv'/>");this._templateDiv.appendTo(this._mapContainer);this._templateDiv.css({"pointer-events":"none",overflow:"hidden",position:"absolute","z-index":"1",height:this._height,width:this._width});this.refreshLayers();this.refreshNavigationControl(this.model.navigationControl)},_renderLegend:function(){var n=this.model.layers[this.baseMapIndex()],f,i;this._scrollLegendDiv=t("<div class='ScrollLegendDiv'/>");this._scrollLegendDiv.appendTo(this._mapContainer);this._legendContainer=t("<div id='LegendcontainerDiv'/>");this._legendContainer.appendTo(this._scrollLegendDiv);this._legendDiv=t("<div class='LegendDiv'/>");this._legendDiv.css({height:this._legendDivHeight+"px",width:this._legendDivWidth+"px"});this._isNavigationPressed=!0;this._legendDiv.appendTo(this._legendContainer);this._legendDiv[0].getBoundingClientRect();this._legendContainer.css({position:"relative"});this._scrollLegendDiv.ejScroller({height:Math.round(this._legendSize.height),width:Math.round(this._legendSize.width)});n.legendSettings.labelOrientation==u&&n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Vertical;n.legendSettings.dockOnMap?(n.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?(pos="none",height=n.legendSettings.height+50,width=n.legendSettings.width+20+n.legendSettings.leftLabel.length*10+n.legendSettings.rightLabel.length*10):(pos="auto",height=n.legendSettings.height,width=n.legendSettings.width),this._scrollLegendDiv.css({position:"absolute","z-index":"2",height:this._legendSize.height,width:this._legendSize.width}),(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Center?this._scrollLegendDiv.css({"margin-left":this._width/2-this._legendSize.width/2}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Far?this._scrollLegendDiv.css({"margin-left":this._width-this._legendSize.width}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Center?this._scrollLegendDiv.css({"margin-top":this._height/2-this._legendSize.height/2}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Far&&this._scrollLegendDiv.css({"margin-top":this._height-this._legendSize.height}),n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom?this._scrollLegendDiv.css({"margin-top":this._height}):n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right&&this._scrollLegendDiv.css({"margin-left":this._width})):(n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Horizontal||n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Vertical)&&(f=n.legendSettings.position==u?"topleft":n.legendSettings.position,i=this._getPosition(f,this._legendSize),this._scrollLegendDiv.css({position:"absolute","z-index":"2","margin-left":i.x+"px","margin-top":i.y}));this.refreshLayers();this.refreshNavigationControl(this.model.navigationControl)},_renderMapLayers:function(){var u,i,o,e,n,s;for(t(this._templateDiv).empty(),u=0,i=this.model.layers[this.baseMapIndex()],i.layerType==r.datavisualization.Map.LayerType.Geometry?(this._renderLayers(i,u),i.shapeData!=null&&(u=i._polygonData.length)):(i._initializeLocalValues(),o=t("<div class='map-contribution'>"),o[0].innerHTML=i.contribution,this._mapContainer.append(o)),e=0;e<this.model.layers[this.baseMapIndex()].subLayers.length;e++)n=this.model.layers[this.baseMapIndex()].subLayers[e],n._isBaseLayer=!1,n.layerType==r.datavisualization.Map.LayerType.Geometry&&n.shapeData!=null?(r.util.isNullOrUndefined(n._initializeLocalValues)&&(s=new f,t.extend(s,n),t.extend(n,s)),this._renderLayers(n,u),u+=n._polygonData.length):n._initializeLocalValues();this.refreshMarkers();_isSVG&&this.enableAnimation()&&!this._isTileMap?this._refreshWithAnimation():this._refrshLayers()},refreshLayers:function(){var n=this.model.layers[this.baseMapIndex()];this._processOData(n,this);this.shapeSelectionOnResize()},_processOData:function(n,t){if(n.dataSource!=null)if(n.dataSource instanceof r.DataManager){var i=n.dataSource.executeQuery(n.query);i.done(function(i){i.result!=null&&(n.dataSource=i.result,t._renderMapLayers())})}else t._renderMapLayers();else t._renderMapLayers()}});var e=function(n,t){this.X=n;this.Y=t;this.left=0;this.top=0;this.height=256;this.width=256;this.src=null},f=function(){this.enableSelection=!0;this.selectionMode="default";this.bingMapType="aerial";this.key="";this.selectedItems=[];this.enableMouseHover=!1;this.shapeData=null;this.markers=[];this.dataSource=null;this.urlTemplate="http://a.tile.openstreetmap.org/level/tileX/tileY.png";this.showTooltip=!1;this.tooltipTemplate=null;this.mapItemsTemplate=null;this.enableAnimation=!1;this.legendSettings={showLegend:!1,showLabels:!1,rowSpacing:10,columnSpacing:10,position:"topleft",positionX:0,positionY:0,height:0,width:0,iconHeight:20,iconWidth:20,type:"layers",mode:"default",title:null,leftLabel:null,rightLabel:null,icon:"rectangle",dockOnMap:!1,dockPosition:"top",labelOrientation:"vertical",alignment:"bottom",columnCount:0};this.labelSettings={showLabels:!1,labelPath:"",enableSmartLabel:!1,smartLabelSize:"fixed",labelLength:2};this.markerTemplate=null;this.showMapItems=!1;this.layerType="geometry";this.geometryType="geographic";this._colorPaletteSettings={Palette1:{highlightColor:"#F7CD1C",highlightStroke:"white",SelectionColor:"#F96C0D",SelectionStroke:"white"},Palette2:{highlightColor:"#68A3EA",highlightStroke:"White",SelectionColor:"#116EF4",SelectionStroke:"White"},Palette3:{highlightColor:"#CCCCCC",highlightStroke:"white",SelectionColor:"#4D4D4D",SelectionStroke:"white"}};this.colorPalettes={Palette1:["#4A3825","#736F3D","#F2DABD","#BF9D7E","#7F6039","#7F715F","#70845D","#CC995C","#736F3D","#89541B"],Palette2:["#E51400","#730202","#EF6535","#C63477","#BF004D","#F0A30B","#CE1B1B","#97993D","#D6BF38","#835A2C"],Palette3:["#A4C400","#008B00","#1BA0E2","#0050EF","#AA00FF","#D90073","#E51400","#F96800","#E3C800","#A20026"]};this._prevPaletteIndex=0;this._newBounds=[];this.subLayers=[];this.shapeSettings={highlightColor:"gray",highlightBorderWidth:1,selectionColor:"gray",fill:"#E5E5E5",radius:5,strokeThickness:"0.2",stroke:"#C1C1C1",colorPalette:"palette1",highlightStroke:"#C1C1C1",selectionStroke:"#C1C1C1",selectionStrokeWidth:1,colorValuePath:null,valuePath:null,enableGradient:!1,colorMappings:null,autoFill:!1};this.bubbleSettings={showBubble:!0,bubbleOpacity:"0.9",minValue:10,maxValue:20,color:"gray",colorValuePath:null,valuePath:null,colorMappings:null,showTooltip:!1,tooltipTemplate:null}};f.prototype={dataTypes:{dataSource:"data",markers:"array",subLayers:"array",shapeSettings:{colorMappings:"array"},bubbleSettings:{colorMappings:"array"}},_initializeLocalValues:function(){this._svgns="http://www.w3.org/2000/svg";this._bounds=[];this._bubbleCollection=[];this._prevSelectedShapes=[];this._prevSelectedTemp=[];this._prevSelectedLegends=[];this._isBaseLayer=!0;this._prevHoverdLegend=null;this._prevHoveredShape=null;this._labelCollection=[];this._scrollBar=null;this._mapShapes=[];this._bubbles=[];this._labelBounds=[];this._bubbleCount=0;this._mapItems=[];this._mapMarkers=[];this.selectedItems;this._tooltipSize={height:0,width:0};this._smartLabels=[];this._labelData=[];this._interactiveArrow=null;this._legendRects=[]},_generateMarkerForLayers:function(n){var h,c,e,f,i,o,u,s;for(this._mapMarkers=[],h=n._rootgroup.getBoundingClientRect().top,c=n._rootgroup.getBoundingClientRect().left,e=0;e<this.markers.length;e++)f=this.markers[e],this.markerTemplate!=null?(i=t(".markerTemplateDiv"),i=t("<div class='mapMarker' style='display:block;position:absolute;pointer-events: stroke;'><\/div>"),n._templateDiv.append(i),t(i).css({height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft}),o=t("#"+this.markerTemplate).render(f),n.model.markerSelected==null&&t(i).css({"pointer-events":"none"}),t(i).html(o),n._on(t(i),r.eventType.mouseDown,{marker:t(i),data:f},n._markerPressed),this._mapMarkers.push(i)):(u=t(' <div class="mapMarker" style="display:block;position:absolute;pointer-events: stroke;"><label>'+f.label+"<\/label><\/div>"),_isSVG?n._templateDiv.append(u):u.appendTo(n._templateDiv),n.model.markerSelected==null&&t(u).css({"pointer-events":"none"}),n._on(t(u),r.eventType.mouseDown,{marker:t(u),data:f},n._markerPressed),this._mapMarkers.push(u)),s=this,s.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&(this._height=this._height,this._width=this._width-parseFloat(width),this._marginleft=parseFloat(width))},_contains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i]===t)return!0;return!1},_shapeContains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i].shapeIndex===t)return{isContains:!0,index:n.length-i};return{isContains:!1}},_labelSizeCalculation:function(n){var t=document.getElementsByClassName("e-map-labelContainer"),r=t[0].offsetHeight,i=t[0].offsetWidth;n._width=n._width-i;n._marginleft=i},_sizeCalculation:function(n){var u=this.shapeSettings.colorMappings,v=!1,i;if(this.shapeSettings.colorMappings!=null){u.rangeColorMapping!=null&&(u=u.rangeColorMapping,v=!0);u.equalColorMapping!=null&&(u=u.equalColorMapping);var o=0,c=0,h=this.legendSettings.rowSpacing,y=this.legendSettings.columnSpacing,p=this.legendSettings.iconWidth+5,a=this.legendSettings.iconHeight+5,k=a+h,f=this.legendSettings.iconHeight+h,e=0,t=this.legendSettings,l=this.legendSettings.columnCount;if(t.height==0&&t.width==0&&l==0){for(i=0;i<u.length;i++){var w=u[i].legendLabel!=null?u[i].legendLabel:v?u[i].from:u[i].value,b=this._calcWidth(w),s=p+b+y;t.dockOnMap&&(t.dockPosition==r.datavisualization.Map.DockPosition.Top||t.dockPosition==r.datavisualization.Map.DockPosition.Bottom)||!t.dockOnMap?n._width<o+s?(f=a+h+f,e=Math.max(e,o),o=s):o+=s+5:n._height<c+a+h?(e+=o,f=Math.max(f,c),o=s,c=0):(c+=a+h,o=Math.max(s,o))}t.dockOnMap&&(t.dockPosition==r.datavisualization.Map.DockPosition.Top||t.dockPosition==r.datavisualization.Map.DockPosition.Bottom)||!t.dockOnMap?(e=Math.max(e,o),f+=5):(e+=o+y,f=Math.max(f,c))}else l==0&&(f=t.height.toString().indexOf("%")!=-1?n._height/100*parseInt(t.height.toString().replace("%","")):t.height,e=t.width.toString().indexOf("%")!=-1?n._width/100*parseInt(t.width.replace("%","")):t.width);if(t.height==0&&t.width==0&&l!=0)for(i=0;i<u.length;i++){var w=u[i].legendLabel!=null?u[i].legendLabel:v?u[i].from:u[i].value,b=this._calcWidth(w),s=p+b+y;i%l!=0?(o+=s,i==l-1&&(e=Math.max(e,o))):(i!=0&&(f=p+h+f),e=Math.max(e,o),o=s)}}t.height!=0&&t.width!=0&&(f=t.height,e=t.width);n._legendSize={height:f,width:e};t.dockOnMap&&(t.mode==r.datavisualization.Map.LegendMode.Interactive&&(f=55),this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom?(n._height=n._height-parseFloat(f),this.legendSettings.tempWidth=o):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top?(n._height=n._height-parseFloat(f),n._margintop=parseFloat(f)):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left?(n._width=n._width-e,n._marginleft=e):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right&&(n._height=n._height,n._width=n._width-e))},_clearShapeWidth:function(n){var i,t;for(n==null&&(n=1),i=0;i<this._mapShapes.length;i++)t=this._mapShapes[i],this._contains(this._prevSelectedShapes,t.shape)||(_isSVG?(this.shapeSettings.colorMappings!=null||this.shapeSettings.autoFill?t.shape.setAttribute("fill",t.shape.getAttribute("nodeValue")):(t.shape.setAttribute("nodeValue",this.shapeSettings.fill),t.shape.setAttribute("fill",this.shapeSettings.fill)),t.shape.setAttribute("stroke-width",this.shapeSettings.strokeThickness/n),t.shape.setAttribute("stroke",this.shapeSettings.stroke)):(t.shape.fillcolor=t.shape.style.behavior,t.shape.strokeweight=this.shapeSettings.strokeThickness,t.shape.strokecolor=this.shapeSettings.stroke))},_shapeSelection:function(){for(var n,i,t=0;t<this._mapShapes.length;t++)n=this._mapShapes[t],i=this._shapeContains(this.selectedItems,n.shapeIndex),i.isContains&&(this._contains(this._prevSelectedShapes,n.shape)||this._prevSelectedShapes.push(n.shape),_isSVG?(n.shape.setAttribute("fill",this.shapeSettings.selectionColor),n.shape.setAttribute("stroke-width",this.shapeSettings.selectionStrokeWidth),n.shape.setAttribute("stroke",this.shapeSettings.selectionStroke)):(n.shape.fillcolor=this.shapeSettings.selectionColor,n.shape.strokeweight=this.shapeSettings.selectionStrokeWidth,n.shape.strokecolor=this.shapeSettings.selectionStroke))},_rgbToHex:function(n,t,i){return"#"+this._toHex(n)+this._toHex(t)+this._toHex(i)},_toHex:function(n){var t="0123456789ABCDEF";return(n=parseInt(n,10),isNaN(n))?"00":(n=Math.max(0,Math.min(n,255)),t.charAt((n-n%16)/16)+t.charAt(n%16))},_hexToR:function(n){return parseInt(this._cropHex(n).substring(0,2),16)},_hexToG:function(n){return parseInt(this._cropHex(n).substring(2,4),16)},_hexToB:function(n){return parseInt(this._cropHex(n).substring(4,6),16)},_cropHex:function(n){return n.charAt(0)=="#"?n.substring(1,7):n},_getRangeColorValues:function(n,t,i){var u=[],f,r;if(u.push(t),t>i)for(f=(t-i)/(n-1),r=n;r>2;r--)t=t-f,u.push(t);else for(f=(i-t)/(n-1),r=2;r<n;r++)t=t+f,u.push(t+f);return u.push(i),u},_generateGradientCollection:function(n){for(var f=[],r=n[0],u=n[n.length-1],e=this._hexToR(r),o=this._hexToG(r),s=this._hexToB(r),h=this._hexToR(u),c=this._hexToG(u),l=this._hexToB(u),i=10,a=this._getRangeColorValues(i,e,h),v=this._getRangeColorValues(i,o,c),y=this._getRangeColorValues(i,s,l),t=0;t<i;t++)f.push(this._rgbToHex(a[t],v[t],y[t]));return f},_calculateTextWidth:function(n){var i=t("<span>"+n+"<\/span>"),r;return t("body").append(i),r=i.width(),i.remove(),r},_trimFunction:function(n,i){for(var u=t("#spantag").text(n),r=n;u.width()>i;)r=r.slice(0,-2),u.text(r+"...");return r},_createLabel:function(n,i,r,u){var f=t("<div class="+u+"><\/div>");return f[0].innerHTML=n,f.css({"margin-left":i+"px","margin-top":r+"px",position:"absolute"}),f},_createInteractiveArrow:function(n,i){var r=t("<div class='e-icon1 e-interactiveArrow'><\/div>");return r[0].innerHTML="▲",r.css({"margin-left":n+"px","margin-top":i+"px",position:"absolute"}),r},_getEllipseLegend:function(n,i){var r=t("<div class='e-mapLegend'/>");return r.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","border-radius":this.legendSettings.iconHeight/2+"px",left:n+"px",top:i+"px",position:"absolute"}),r},_getRectLegend:function(n,i){var r=t("<div />");return r.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px",left:n+"px",top:i+"px",position:"absolute"}),r},_generateLegend:function(n){var l=!0,f=null,i;this.shapeSettings.colorMappings.rangeColorMapping!=u?f=this.shapeSettings.colorMappings.rangeColorMapping:this.shapeSettings.colorMappings.equalColorMapping!=u&&(f=this.shapeSettings.colorMappings.equalColorMapping,l=!1);var t=0,e=0,o=this.legendSettings,c=0,a,v,h=o.rowSpacing,y=o.columnSpacing,d=o.iconWidth+5,g=o.iconHeight+h,p=o.columnCount;for(i=0;i<f.length;i++){var w=f[i].legendLabel=f[i].legendLabel!=null?f[i].legendLabel:l?f[i].from:f[i].value,b=this._calcWidth(w),s=o.iconWidth+y+b,k=o.iconHeight;p!=0?i%p!=0?(this._drawLegend(f[i],t,e,n),t+=s+5):(i!=0&&(e+=o.iconHeight+h),t=0,this._drawLegend(f[i],t,e,n),t+=s+5):o.dockPosition==r.datavisualization.Map.DockPosition.Top||o.dockPosition==r.datavisualization.Map.DockPosition.Bottom?n._legendSize.width<t+s?(e+=o.iconHeight+h,t=0,this._drawLegend(f[i],t,e,n),t+=s):(this._drawLegend(f[i],t,e,n),t+=s):n._legendSize.height<e+o.iconHeight?(e=0,t+=c+y,this._drawLegend(f[i],t,e,n),c=0,e+=o.iconHeight+h):(this._drawLegend(f[i],t,e,n),c=Math.max(c,s),e+=o.iconHeight+h);a=n._legendDivHeight>e?n._legendDivHeight:e+k;v=n._legendDivWidth>t+s?n._legendDivWidth:t+s;n._legendDivWidth=v;n._legendDivHeight=a}},_drawLegend:function(n,i,u,f){var o,e;o=this.legendSettings.icon==r.datavisualization.Map.LegendIcons.Circle?this._getEllipseLegend(i,u):this._getRectLegend(i,u);i+=this.legendSettings.iconWidth+5;t(o).css("background-color",n.color);o.appendTo(f._legendDiv);e=t("<div class='e-defaultLegendLabel'/>");e.css({left:i+"px",top:u+"px",position:"absolute","text-overflow":"ellipsis","white-space":"nowrap",overflow:"hidden"});e[0].title=n.legendLabel;e[0].innerHTML=n.legendLabel;e.appendTo(f._legendDiv)},_generateLegends:function(n){var it=this.shapeSettings.colorMappings,rt,lt,ut,ft,a,c,k,o,v,d,st,at,ht,g,e,tt,s,yt,pt;if(it.rangeColorMapping!=null||it.equalColorMapping!=null){var gt=this.legendSettings,ni=this.legendSettings.iconWidth+5,bt=this.legendSettings.iconHeight+5,ti=this.legendSettings.rowSpacing,ii=this.legendSettings.columnSpacing,ri=this.legendSettings.iconHeight+this.legendSettings.rowSpacing,ui=bt+this.legendSettings.rowSpacing;if((this.legendSettings.showLegend==u||this.legendSettings.showLegend)&&!this.shapeSettings.autoFill){t(n._mapContainer).append(t('<div id="labelTooltip" style="display:none;background-color:grey;padding-left:5px; padding-right:5px;position:absolute;z-index:1000;pointer-events:none;"/>'));var w=this,f=10,h=0,ui=this.iconHeight+this.legendSettings.rowSpacing,b=this.legendSettings.height,l=this.legendSettings.width,i=t("<div/>");if(w.legendSettings.dockOnMap?i=t(n._legendDiv):w.legendSettings.dockOnMap||w.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?_isSVG?i.appendTo(n._templateDiv):n._templateDiv.append(i):i=t(n._legendDiv),(this.legendSettings.type==u||this.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&this.shapeSettings.colorMappings!=null&&(this.legendSettings.mode==u||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Default||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.shapeSettings.colorMappings.equalColorMapping!=null))this._generateLegend(n);else if((this.legendSettings.type==u||this.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.shapeSettings.colorMappings!=null){if(s="",this.legendSettings.height==0&&(b=18),this.legendSettings.width==0&&(l=150),this.legendSettings.leftLabel==null&&(this.legendSettings.leftLabel=""),this.legendSettings.rightLabel==null&&(this.legendSettings.rightLabel=""),this.legendSettings.title!=null){if(rt=f,this.legendSettings.showLabels||(rt=f+this.legendSettings.leftLabel.length*10),lt=this.legendSettings.title.length*10,ut=titleText=this.legendSettings.title,lt>l)for(e=1;e<titleText.toString().length;e++)ut=titleText.toString().substring(0,e-1)+"...";s=this._createLabel(ut,rt,h,"e-interactivelegend-title");s[0].title=titleText;s.css({width:l+"px"});_isSVG?s.appendTo(i):i.append(s);h+=25}for(this.legendSettings.showLabels&&(h+=25),this.legendSettings.leftLabel==null||this.legendSettings.showLabels||(s=this._createLabel(this.legendSettings.leftLabel,f,h-3,"e-interactivelegend-leftlabel"),_isSVG?s.appendTo(i):i.append(s),f=f+this.legendSettings.leftLabel.length*10),ft=this._createInteractiveArrow(f,h+b),ft.appendTo(i),this._interactiveArrow=ft,a=null,!_isSVG&&this.shapeSettings.enableGradient&&(a=n._createGroup(!1,"legendGroup"),a.style.left="0px",a.style.top="0px",a.style.position="relative",i.append(a)),c=it.rangeColorMapping,k=0;k<c.length;k++)if(o=c[k],!o.hideLegend){if(v=[],this.shapeSettings.enableGradient&&(v=this._generateGradientCollection(o.gradientColors)),d={},this.shapeSettings.enableGradient)if(_isSVG){var et=t("<canvas/>"),ot=et[0].getContext("2d"),y=ot.createLinearGradient(0,0,300,0),p=0;for(e=0;e<10;e++)p=p+1/10,e==0?(y.addColorStop(0,o.gradientColors[0]),y.addColorStop(p,v[e])):e==v.length-1?(y.addColorStop(p-1/10,v[e]),y.addColorStop(p,o.gradientColors[1])):(y.addColorStop(p-1/10,v[e]),y.addColorStop(p,v[e+1]));ot.fillStyle=y;ot.fillRect(0,0,300,300);et.css({height:b+"px",width:l/c.length+"px","margin-left":f+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"});et.appendTo(i)}else st="legend"+k,at="<v:rect id="+st+' display="block" style="position:absolute;top: '+(h-2)+"px;left:"+f+"px;width:"+l/c.length+"px;height:"+b+'px;"><v:fill opacity="0.9px" type="gradient" method="linear sigma" angle="270"/><v:stroke opacity="0px"/><\/v:rect>',a.innerHTML=a.innerHTML+at,ht=document.getElementById(st),ht.fillcolor=o.gradientColors[0],ht.fill.color2=o.gradientColors[1];else g=t("<div/>"),g.css({height:b+"px",width:l/this.shapeSettings.colorMappings.rangeColorMapping.length+"px","background-color":o.color,"margin-left":f+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"}),_isSVG?g.appendTo(i):i.append(g);for(e=0;e<10;e++)d={},d.marginLeft=f,this._legendRects.push(d),f=f+l/c.length/10;if(this.legendSettings.showLabels){var nt=f-l/c.length,ct=h-25,vt=this._createLabel(o.from,nt,ct,"e-legend-rangestartlabel");nt=f;tt=this._createLabel(o.to,nt,ct);o.legendLabel!=u&&(tt=this._createLabel(o.legendLabel,nt-o.legendLabel.length*5,ct,"e-legend-rangeendlabel"));_isSVG?(o==c[0]&&vt.appendTo(i),tt.appendTo(i)):(o==c[0]&&i.append(vt),i.append(tt))}}this.legendSettings.rightLabel==null||this.legendSettings.showLabels||(s=this._createLabel(this.legendSettings.rightLabel,f+10,h-3,"e-interactivelegend-rightlabel"),_isSVG?s.appendTo(i):i.append(s),f=f+this.legendSettings.rightLabel.length*10);totalwidth=f+10;totalheight=h+b+10;n._legendSize={width:totalwidth,height:totalheight};w.legendSettings.dockOnMap&&(this.legendSettings.dockPosition=="left"?n._marginleft=totalwidth:this.legendSettings.dockPosition=="top"&&(n._margintop=totalheight))}if(w.legendSettings.dockOnMap||this.legendSettings.position!="none"){if(!w.legendSettings.dockOnMap&&this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive){var kt=this.legendSettings.position==u?"topleft":this.legendSettings.position,dt={width:totalwidth,height:totalheight},wt=n._getPosition(kt,dt);i.css({"margin-left":wt.x+"px","margin-top":wt.y})}}else yt=n._width*this.legendSettings.positionX/100,pt=n._height*this.legendSettings.positionY/100,i.css({"margin-left":yt+"px","margin-top":pt+"px"})}}},_generateLabels:function(n){var f=t("<div class='e-map-labelContainer'><\/div>"),i;for(t(f).css({position:"absolute",overflow:"scroll"}),i=0;i<this._polygonData.length;i++){var e=this._polygonData[i].properties,o=n._reflection(e,this.labelSettings.labelPath),u=t("<div class='e-map-label'><\/div>");t(u).css({"margin-top":i*20,position:"absolute"});u[0].innerHTML=o;f.append(u);n._mapContainer.append(f);u.mouseenter({Param1:this,Param2:this._mapShapes[i],map:n},n._polyEnterFunction);n._off(t(u),r.eventType.mouseUp,n._polyClickFunction);n._on(t(u),r.eventType.mouseUp,{Param1:this._mapShapes[i],Param2:this,Param3:this._mapShapes[i].shape,param4:u},n._polyClickFunction)}},_calcWidth:function(n){var i=t('<span class="e-defaultLegendLabel">'+n+"<\/span>"),r;return t("body").append(i),r=i.width()+5,i.remove(),r},_generateBubbleLegends:function(n){var c,i,o,e,y,p,k,d;if(this.legendSettings.showLegend==u||this.legendSettings.showLegend){var l=10,s=10,it=this.legendSettings.iconHeight,a=this.legendSettings.iconWidth,f=t("<div/>");_isSVG?f.appendTo(n._templateDiv):n._templateDiv.append(f);var v=0,w=0,b=!0,h=null;if(this.bubbleSettings.colorMappings.rangeColorMapping!=u?h=this.bubbleSettings.colorMappings.rangeColorMapping:this.bubbleSettings.colorMappings.equalColorMapping!=u&&(h=this.bubbleSettings.colorMappings.equalColorMapping,b=!1),this.legendSettings.type==r.datavisualization.Map.LegendType.Bubbles&&this.bubbleSettings.colorMappings!=null&&(this.legendSettings.mode==u||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Default||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.bubbleSettings.colorMappings.equalColorMapping!=null)){for(this.legendSettings.iconHeight==u&&(this.legendSettings.iconHeight=20),this.legendSettings.iconWidth==u&&(this.legendSettings.iconWidth=20),c=0;c<h.length;c++)i=h[c],i.hideLegend||(o=t("<div class='e-mapBubbleLegend'/>"),this.legendSettings.icon==r.datavisualization.Map.LegendIcons.Circle?o.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","border-radius":this.legendSettings.iconHeight/2+"px","background-color":i.color,"margin-left":l+"px","margin-top":s+"px",position:"absolute"}):o.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","background-color":i.color,"margin-left":l+"px","margin-top":s+"px",position:"absolute"}),e=this._createLabel(i.legendLabel,l+a+5,s,"e-legendlabeltext"),i.legendLabel!=null?e[0].innerText=i.legendLabel:i.legendLabel=e[0].innerText=b?i.from:i.value,_isSVG?(o.appendTo(f),e.appendTo(f)):(f.append(o),f.append(e)),v<e[0].innerText.length*10+a&&(v=e[0].innerText.length*10+a),y=e.height(),p=o.height(),s+=y>p?y+5:p+5);w=s}if(this.legendSettings.position=="none")k=n._width*this.legendSettings.positionX/100,d=n._height*this.legendSettings.positionY/100,f.css({"margin-left":k+"px","margin-top":d+"px"});else{var nt=this.legendSettings.position==u?"topleft":this.legendSettings.position,tt={width:v,height:w},g=n._getPosition(nt,tt);f.css({"margin-left":g.x+"px","margin-top":g.y+"px"})}}},_animateBubble:function(n,i){var u={fx:n.getAttribute("r")/2},e=u.fx*2,f=t(n),r=this;t(u).delay(i).each(function(){}).animate({fx:e},{duration:700,step:function(n){_isSVG&&(f.attr("style","display:block;pointer-events:stroke;"),f.attr("r",n))},complete:function(){r._bubbleCount++;r._bubbleCount==r._bubbles.length&&r._setMapElements()}})},_setMapElements:function(){for(var i,n=0;n<this._mapItems.length;n++)i=this._mapItems[n],t(i).css({display:"block"})},_setMapItemsPositionWithAnimation:function(n){var s,o,e,i,r,u;for(this._bubbleCollection=[],i=0;i<this._bubbles.length;i++){var h=this._bubbles[i],a=this._bubbles[i].getAttribute("r"),u=this._bounds[i],o=(u.x+n._translatePoint.x)*n._scale,e=(u.y+n._translatePoint.y)*n._scale,c=n.validateBubblePosition(u.points,{x:o,y:e},a),l=0,v=Math.floor(Math.random()*(20-l)+l),y=parseInt(v*50);_isSVG&&t(h).attr({cx:c.x,cy:c.y});this._animateBubble(h,y);this._bubbleCollection.push(h)}for(i=0;i<this._mapMarkers.length;i++)r=this._mapMarkers[i],this.markers.length>0&&(s=this.markers[i]),u=n._isTileMap?n._convertTileLatLongtoPoint(s.latitude,s.longitude):n._convertLatLongtoPointforMarker(s.latitude,s.longitude),o=_isSVG?u.x:(u.x+n._transformX)*n._scale,e=u.y,t(r).css({display:"block",left:o,top:e-100}),t(r).delay(500).each(function(){}).animate({top:e},500);for(i=0;i<this._mapItems.length;i++){var r=this._mapItems[i],u=this._bounds[i],f=r[0].getBoundingClientRect(),p=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cx")):0,w=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cy")):0,o=this._bubbleCollection[i]?p-f.width/2:(u.x+n._translatePoint.x)*n._scale-f.width/2,e=this._bubbleCollection[i]?w-f.height/4:(u.y+n._translatePoint.y)*n._scale-f.height/4;this._bubbles.length>0?t(r).css({left:o,top:e,display:"none"}):t(r).css({left:o,top:e,display:"block"})}for(i=0;i<this._labelCollection.length;i++){r=this._labelCollection[i];u=this._labelBounds[i];t(r).css("display","block");var f=r[0].getBoundingClientRect(),b=_isSVG?f.width:f.right-f.left,k=_isSVG?f.height:f.bottom-f.top,o=(u.x+n._translatePoint.x)*n._scale-b/2,e=(u.y+n._translatePoint.y)*n._scale-k/2;(r[0].className="smartLabelStyle")&&(r[0].className="labelStyle",t(r[0]).css({"pointer-events":"none",position:"absolute"}));r[0].innerHTML=this._labelData[i];t(r).css({left:o,top:e})}this.labelSettings!=null&&this.labelSettings.showLabels&&this._validateSmartLabel(n)},_resizeShapes:function(n){var r=this.shapeSettings.strokeThickness/n._scale,i,t;if(this._mapShapes!=u)for(i=0;i<this._mapShapes.length;i++)t=this._mapShapes[i].shape,_isSVG?t.localName=="circle"?t.setAttribute("r",this.shapeSettings.radius/n._scale):this._contains(this._prevSelectedShapes,t)?t.setAttribute("stroke-width",this.shapeSettings.selectionStrokeWidth/n._scale):t.setAttribute("stroke-width",r):t.nodeName=="oval"||(t.strokeweight=this._contains(this._prevSelectedShapes,t)?this.shapeSettings.selectionStrokeWidth/n._scale:r)},_setMapItemsPosition:function(n){var c,s,h,i,e,f;if(this._bubbleCollection=[],this._bubbles!=u)for(i=0;i<this._bubbles.length;i++){var o=this._bubbles[i],a=this._bubbles[i].getAttribute("r"),f=this._bounds[i];if(_isSVG){var s=(f.x+n._translatePoint.x)*n._scale,h=(f.y+n._translatePoint.y)*n._scale,l=n.validateBubblePosition(f.points,{x:s,y:h},a);t(o).attr({cx:l.x,cy:l.y})}else{o=document.getElementById(o.id);var s=(f.x+n._translatePoint.x)*n._scale,h=(f.y+n._translatePoint.y)*n._scale,l=n.validateBubblePosition(f.points,{x:s,y:h},a),v=l.y-(o.getBoundingClientRect().bottom-o.getBoundingClientRect().top)/2,y=l.x-(o.getBoundingClientRect().right-o.getBoundingClientRect().left)/2;t(o).css({left:y,top:v})}this._bubbleCollection.push(o)}if(this._mapItems!=u)for(i=0;i<this._mapItems.length;i++){e=this._mapItems[i];f=this._bounds[i];t(e).css({display:"block"});var r=e[0].getBoundingClientRect(),p=_isSVG?r.width:r.right-r.left,w=_isSVG?r.height:r.bottom-r.top,b=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cx")):0,k=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cy")):0,s=this._bubbleCollection[i]?b-r.width/2:(f.x+n._translatePoint.x)*n._scale-r.width/2,h=this._bubbleCollection[i]?k-r.height/4:(f.y+n._translatePoint.y)*n._scale-r.height/4;t(e).css({left:s,top:h})}if(this._mapMarkers!=u)for(i=0;i<this._mapMarkers.length;i++)e=this._mapMarkers[i],this.markers.length>0&&(c=this.markers[i]),f=n._isTileMap?n._convertTileLatLongtoPoint(c.latitude,c.longitude):n._convertLatLongtoPointforMarker(c.latitude,c.longitude),s=f.x,h=f.y,t(e).css({left:s,top:h});if(this._labelCollection!=u)for(i=0;i<this._labelCollection.length;i++){e=this._labelCollection[i];f=this._labelBounds[i];t(e).css("display","block");var r=e[0].getBoundingClientRect(),p=_isSVG?r.width:r.right-r.left,w=_isSVG?r.height:r.bottom-r.top,s=(f.x+n._translatePoint.x)*n._scale-p/2,h=(f.y+n._translatePoint.y)*n._scale-w/2;(e[0].className="smartLabelStyle")&&(e[0].className="labelStyle",t(e[0]).css("background-color","transparent"),t(e[0]).css({"pointer-events":"none",position:"absolute"}));e[0].innerHTML=this._labelData[i];t(e).css({left:s,top:h})}this.labelSettings!=null&&this.labelSettings.showLabels&&this._validateSmartLabel(n)},_validateSmartLabel:function(n){function fi(n){var i=[],t;for(i.push(0),t=10;t<=n;t+=20)i.push(-t),i.push(t);return i}function ei(n){for(var t=0;t<ht.length;t++)if(oi(n,ht[t]))return!1;return!0}function oi(n,t){return n.left-2>=t.left+t.width||n.left-2+n.width<=t.left-2||n.top-2>=t.top+t.height||n.top+n.height<=t.top-2?!1:!0}var ht,p,yt,pt,it,rt,lt,bt,at,ui,tt,v,et,c,e,st,f;if(this._smartLabels=[],ht=[],this._labelCollection.length>0)for(p=0;p<this._mapShapes.length;p++){var o=this._labelBounds[p],i={x:(o.x+n._translatePoint.x)*n._scale,y:(o.y+n._translatePoint.y)*n._scale},dt={x:(o.rightMin.x+n._translatePoint.x)*n._scale,y:(o.rightMin.y+n._translatePoint.y)*n._scale},gt={x:(o.rightMax.x+n._translatePoint.x)*n._scale,y:(o.rightMax.y+n._translatePoint.y)*n._scale},ni={x:(o.leftMin.x+n._translatePoint.x)*n._scale,y:(o.leftMin.y+n._translatePoint.y)*n._scale},ti={x:(o.leftMax.x+n._translatePoint.x)*n._scale,y:(o.leftMax.y+n._translatePoint.y)*n._scale},l=this._labelCollection[p];if(i.x>0&&i.x<n._width&&i.y>0&&i.y<n._height){var ct=this._mapShapes[p].shape,a=ct.getBoundingClientRect(),w=!1,nt=l[0].getBoundingClientRect(),s=nt.height,h=nt.width;_isSVG||(a={width:a.right*n._scale-a.left*n._scale,height:a.bottom*n._scale-a.top*n._scale},s=nt.bottom-nt.top,h=nt.right-nt.left);yt=!1;pt=!1;(h/2>dt.x-i.x||h/2>gt.x-i.x)&&(s/2>i.y-dt.y||s/2>gt.y-i.y)?yt=!0:(h/2>i.x-ni.x||h/2>i.x-ti.x)&&(s/2>i.y-ni.y||s/2>ti.y-i.y)&&(pt=!0);var b=0,k=0,wt=20,d=[],ii=[];if(s>a.height||h>a.width||yt||pt)if(this.labelSettings.enableSmartLabel)for(this.labelSettings.smartLabelSize==r.datavisualization.Map.LabelSize.Fixed?(s=25,h=15*this.labelSettings.labelLength):(h*=1.3,s=25);!w;){for(wt>400&&(w=!0),d=fi(wt),ii=d,it=0;it<d.length;it++)for(rt=0;rt<d.length;rt++)b=ii[rt],k=d[it],i.x+b+h>n._width&&i.x<n._width&&(b-=i.x+b+h-n._width),i.x+b<0&&(b=0),i.y+k<0&&(k=0),i.y+k+s>n._height&&i.y<n._height&&(k-=i.y+k+s-n._height),lt={left:i.x+b,top:i.y+k,height:s,width:h},ei(lt)&&(bt=n._getIntersectedElements(lt,this._mapShapes),bt!=null&&bt.length==0&&(w=!0,it=d.length,rt=d.length,l[0].className="smartLabelStyle",t(l).css({"pointer-events":"stroke",position:"absolute"}),this.labelSettings.smartLabelSize==r.datavisualization.Map.LabelSize.Fixed&&(l[0].innerHTML=l[0].innerHTML.substring(0,this.labelSettings.labelLength)),l.mouseenter({Param1:this,Param2:this._mapShapes[p],map:n},n._polyEnterFunction),l.mousemove({Param1:this,Param2:this._mapShapes[p]},n._polyMoveFunction),t(l).css({left:i.x+b,top:i.y+k,"background-color":_isSVG?ct.getAttribute("fill"):ct.fillcolor.value}),ht.push(lt),at={},at.shape=ct,at.legend=l,this._smartLabels.push(at)));wt+=10}else{var ri=!0,ut=0,ft=0,w=!0;for(c=0;c<o.points.length;c++)v={x:(o.points[c].x+n._translatePoint.x)*n._scale,y:(o.points[c].y+n._translatePoint.y)*n._scale},w?(ut=v.y,ft=v.y,w=!1):(ut=Math.min(ut,v.y),ft=Math.max(ft,v.y));for(ui=Math.floor((ft-ut)/s),tt=[],f=0;f<ui;f++)e=[],tt.push(e);for(c=0;c<o.points.length;c++)v={x:(o.points[c].x+n._translatePoint.x)*n._scale,y:(o.points[c].y+n._translatePoint.y)*n._scale},et=Math.floor((v.y-ut)/s),et>0&&(et-=1),e=tt[et],e==u&&(e=[]),e.push({x:v.x,y:v.y}),tt[et]=e;for(c=0;c<tt.length;c++){e=tt[c];w=!0;var y=0,g=0,ot=0,vt=[],kt=[];for(f=0;f<e.length;f++)w?(y=e[f].x,g=e[f].x,ot=e[f].y,w=!1):(y=Math.min(y,e[f].x),g=Math.max(g,e[f].x),e[f].x==g&&(ot=e[f].y)),e[f].x<i.x&&vt.push(e[f].x),e[f].x>i.x&&kt.push(e[f].x);for(a.left<n._mapContainer[0].getBoundingClientRect().left+1&&(y=n._mapContainer[0].getBoundingClientRect().left+1-a.left,vt.push(y)),st=!1,f=0;f<vt.length;f++)if(g-vt[f]<h+1){st=!0;break}if(!st)for(f=0;f<kt.length;f++)if(kt[f]-y<h+1){st=!0;break}if(g-y>h+1&&!st){l.css("left",a.left*n._scale+(y-a.left*n._scale)+(g-y)/2-h/2+"px");l.css("top",ot+"px");ft-ot<s&&l.css("top",ot-s+"px");ri=!1;break}}ri&&l.css("display","none")}}}},_fillColors:function(n,t,i){t.rangeColorMapping!=null?this._fillRangeColors(n,t.rangeColorMapping,i):t.equalColorMapping!=null&&this._fillEqualColors(n,t,i)},_fillEqualColors:function(n,i,r){t.each(i.equalColorMapping,function(t,i){i.value==n&&(_isSVG?r.setAttribute("fill",i.color):r.fillcolor=i.color,r.highlightcolor=i.highlightcolor)})},_updateLegendRange:function(n,i,r){for(var h,f,c,a,s,o,l,y,v=i.shapeSettings.colorMappings.rangeColorMapping,e=0;e<v.length;e++)if(h=null,f=v[e],i.shapeSettings.enableGradient&&(h=this._generateGradientCollection(f.gradientColors)),n>=f.from&&n<=f.to)for(c=e,e!=0&&(c=e*10),a=f.from,s=f.from+(f.to-f.from)/10,o=c;o<c+10;o++){if(n>=a&&n<=s)return l={},y=this._getColorRatio(.7,1,n,f.from,f.to),i._legendRects[o]!=u&&(l=i._legendRects[o]),l.color=i.shapeSettings.enableGradient?e!=0?h[o-e*10]:h[o]:f.color,t(r).css({opacity:y}),l;a=s;s=s+(f.to-f.from)/10}},_fillRangeColors:function(n,i,r){for(var u,e,f=0;f<i.length;f++)u=i[f],n>=u.from&&n<=u.to&&(e=this._getColorRatio(.7,1,n,u.from,u.to),_isSVG?r.setAttribute("fill",u.color):r.fillcolor=u.color,r.highlightcolor=u.highlightcolor,t(r).css({opacity:e}))},_getColorRatio:function(n,t,i,r,u){var f=100/(u-r)*(i-r);return(parseFloat(t)-parseFloat(n))/100*f+parseFloat(n)}};t.fn.pinchZoom=function(n,i){var f,u,e=this[0],r=[],o=function(n){var t=e.createSVGPoint(),r=n.targetTouches,u,f,i;return r.length&&(i=r[0],u=i.pageX,f=i.pageY),t.x=u,t.y=f,t},l=function(i){var y=n,e,s,c,l,h,a,v;if(u=y.getCTM().inverse(),f=o(i).matrixTransform(u),e=i.touches,e.length>=2)for(i.preventDefault(),s=0;s<e.length;s++){for(c=e[s],l=!1,h=0;h<r.length;h++)if(a=r[h],c.identifier===a.identifier){l=!0;break}l||(v=t.extend({},c),r.push(v))}},s=function(n,t){var i=t.pageX-n.pageX,r=t.pageY-n.pageY;return Math.sqrt(i*i+r*r)},h=function(n,t){var r=null,u="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";t.a>i._baseScale&&i.model.zoomSettings.enableZoom&&i.enablePan()&&(t.a>i._scale?r=!0:t.a<i._scale&&(r=!1),i._scale=t.a,i._translatePoint.x=t.e/t.a,i._translatePoint.y=t.f/t.a,i._applyTransform(i._scale,i._translatePoint),i.model.zoomSettings.level=i._scale-i._baseScale+1,i._zoomLevel(i._scale-i._baseScale+1),r!=null&&r?(i._trigger("zoomedIn",{originalEvent:null,zoomLevel:i._zoomLevel()}),i._updateSliderValue(!1),i._resizeShape()):r!=null&&(i._trigger("zoomedOut",{originalEvent:null,zoomLevel:i._zoomLevel()}),i._updateSliderValue(!1),i._resizeShape()),i._isDragging=!0,i._refrshLayers())},a=function(n){for(var e,t,u,o,f=n.changedTouches,i=0;i<f.length;i++)for(e=f[i],t=0;t<r.length;t++)u=r[t],u.identifier===e.identifier&&(o=r.indexOf(u),r.splice(o,1));n.preventDefault()},c=function(n,t){n.pageX=t.pageX;n.pageY=t.pageY},v=function(t){var l=n,y=t.touches,w,i,p;if(y.length>=2){t.preventDefault();var a=y[0],v=y[1],b=r[0],k=r[1];w=s(a,v)/s(b,k);i=e.createSVGPoint();i.x=(a.pageX+v.pageX)/2;i.y=(a.pageY+v.pageY)/2;i=i.matrixTransform(l.getCTM().inverse());p=e.createSVGMatrix().translate(i.x,i.y).scale(w).translate(-i.x,-i.y);h(l,l.getCTM().multiply(p));typeof u=="undefined"&&(u=l.getCTM().inverse());u=u.multiply(p.inverse());c(b,a);c(k,v)}else r.length||(i=o(t).matrixTransform(u),h(l,u.inverse().translate(i.x-f.x,i.y-f.y)))};this[0].addEventListener("touchstart",l,!1);this[0].addEventListener("touchend",a,!1);this[0].addEventListener("touchmove",v,!1)};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}};r.datavisualization.Map.Locale=r.datavisualization.Map.Locale||{};r.datavisualization.Map.Locale["default"]=r.datavisualization.Map.Locale["en-US"]={zoomIn:"Zoom In",zoomOut:"Zoom Out",panTop:"Pan Top",panBottom:"Pan Bottom",panLeft:"Pan Left",panRight:"Pan Right",home:"Home"};r.datavisualization.Map.LayerType={Geometry:"geometry",OSM:"osm",Bing:"bing"};r.datavisualization.Map.LegendIcons={Rectangle:"rectangle",Circle:"circle"};r.datavisualization.Map.LabelSize={Fixed:"fixed",Default:"default"};r.datavisualization.Map.LegendMode={Default:"default",Interactive:"interactive"};r.datavisualization.Map.BingMapType={Aerial:"aerial",AerialWithLabel:"aerialwithlabel",Road:"road"};r.datavisualization.Map.GeometryType={Normal:"normal",Geographic:"geographic"};r.datavisualization.Map.SelectionMode={Default:"default",Multiple:"multiple"};r.datavisualization.Map.ColorPalette={Palette1:"palette1",Palette2:"palette2",Palette3:"palette3",CustomPalette:"custompalette"};r.datavisualization.Map.LegendType={Layers:"layers",Bubbles:"bubbles"};r.datavisualization.Map.Position={None:"none",TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",CenterLeft:"centerleft",Center:"center",CenterRight:"centerright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};r.datavisualization.Map.DockPosition={Top:"top",Bottom:"bottom",Right:"right",Left:"left"};r.datavisualization.Map.Alignment={Near:"near",Center:"center",Far:"far"};r.datavisualization.Map.LabelOrientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion),function(n,t,r){var u;t.widget({ejTreeMap:"ej.datavisualization.TreeMap"},{validTags:["div"],defaults:{locale:null,enableGroupSeparator:!1,leafItemSettings:{borderThickness:1,borderBrush:"white",showLabels:!1,labelPath:null,gap:0,itemTemplate:null,labelPosition:"topleft",labelVisibilityMode:"visible"},header:null,isHierarchicalDatasource:!1,dataSource:null,groupColorMapping:[],enableDrillDown:!1,drillDownHeaderColor:null,drillDownSelectionColor:"#000000",colorValuePath:null,weightValuePath:null,treeMapItems:[],showLegend:!1,borderBrush:"white",borderThickness:1,enableResize:!0,enableGradient:!1,isResponsive:!0,itemsLayoutMode:"squarified",levels:[],legendSettings:{template:"",iconHeight:15,iconWidth:15,title:"",height:0,width:0,mode:"default",leftLabel:"",rightLabel:"",dockPosition:"top",alignment:"near",columnCount:0},rangeColorMapping:[],uniColorMapping:{color:null},desaturationColorMapping:{from:0,to:0,color:"",rangeMinimum:0,rangeMaximum:0},paletteColorMapping:{colors:[]},highlightOnSelection:!1,selectionMode:"default",highlightGroupOnSelection:!1,groupSelectionMode:"default",draggingOnSelection:!1,draggingGroupOnSelection:!1,showTooltip:!1,tooltipTemplate:null,highlightBorderThickness:5,highlightGroupBorderThickness:4,highlightBorderBrush:"gray",highlightGroupBorderBrush:"gray"},dataTypes:{dataSource:"data",treeMapItems:"array",levels:"array",rangeColorMapping:"array",paletteColorMapping:"object",groupColorMapping:"array"},observables:["dataSource","colorValuePath","weightValuePath","showLegend","enableResize","highlightOnSelection","selectionMode","groupSelectionMode","highlightGroupOnSelection","enableDrillDown","drillDownHeaderColor","drillDownSelectionColor","showTooltip","highlightBorderThickness","highlightBorderBrush","itemsLayoutMode","leafItemSettings.borderThickness","leafItemSettings.borderBrush","leafItemSettings.showLabels","leafItemSettings.labelPath","legendSettings.iconWidth","legendSettings.iconHeight","legendSettings.dockPosition","legendSettings.height","legendSettings.width","uniColorMapping.color","desaturationColorMapping.from","desaturationColorMapping.to","desaturationColorMapping.color","desaturationColorMapping.rangeMinimum","desaturationColorMapping.rangeMaximum"],_tags:[{tag:"levels",attr:["groupPath","groupGap","headerHeight","showHeader","groupPadding","groupBackground","groupBorderColor","groupBorderThickness"],singular:"level"},{tag:"rangeColorMapping",attr:["color","legendLabel","from","to"],singular:"rangeColor"},{tag:"groupColorMapping",attr:["groupID",{tag:"groupColorMapping.rangeColorMapping",attr:["color","legendLabel","from","to"],singular:"groupRangeColor"},"uniColorMapping.color","desaturationColorMapping.from","desaturationColorMapping.to","desaturationColorMapping.color","desaturationColorMapping.rangeMinimum","desaturationColorMapping.rangeMaximum"],singular:"groupColor"}],dataSource:t.util.valueFunction("dataSource"),colorValuePath:t.util.valueFunction("colorValuePath"),weightValuePath:t.util.valueFunction("weightValuePath"),showLegend:t.util.valueFunction("showLegend"),enableResize:t.util.valueFunction("enableResize"),highlightOnSelection:t.util.valueFunction("highlightOnSelection"),selectionMode:t.util.valueFunction("selectionMode"),highlightGroupOnSelection:t.util.valueFunction("highlightGroupOnSelection"),groupSelectionMode:t.util.valueFunction("groupSelectionMode"),enableDrillDown:t.util.valueFunction("enableDrillDown"),drillDownHeaderColor:t.util.valueFunction("drillDownHeaderColor"),drillDownSelectionColor:t.util.valueFunction("drillDownSelectionColor"),showTooltip:t.util.valueFunction("showTooltip"),highlightBorderThickness:t.util.valueFunction("highlightBorderThickness"),itemsLayoutMode:t.util.valueFunction("itemsLayoutMode"),highlightBorderBrush:t.util.valueFunction("highlightBorderBrush"),borderThickness:t.util.valueFunction("leafItemSettings.borderThickness"),borderBrush:t.util.valueFunction("leafItemSettings.borderBrush"),showLabels:t.util.valueFunction("leafItemSettings.showLabels"),labelPath:t.util.valueFunction("leafItemSettings.labelPath"),iconWidth:t.util.valueFunction("legendSettings.iconWidth"),iconHeight:t.util.valueFunction("legendSettings.iconHeight"),dockPosition:t.util.valueFunction("legendSettings.dockPosition"),legendheight:t.util.valueFunction("legendSettings.height"),legendwidth:t.util.valueFunction("legendSettings.width"),itemTemplate:t.util.valueFunction("leafItemSettings.itemTemplate"),uniColor:t.util.valueFunction("uniColorMapping.color"),_color:t.util.valueFunction("desaturationColorMapping.color"),_from:t.util.valueFunction("desaturationColorMapping.from"),_to:t.util.valueFunction("desaturationColorMapping.to"),_rangeMinimum:t.util.valueFunction("desaturationColorMapping.rangeMinimum"),_rangeMaximum:t.util.valueFunction("desaturationColorMapping.rangeMaximum"),_initPrivateProperties:function(){this._svgDocument=null;this._templateDiv=null;this._legenddiv=null;this._drillHeaderDiv=null;this._drillHoverDiv=null;this._legendHeight=0;this._backgroundTile=null;this._tooltipSize={height:0,width:0};this._height=500;this._margintop=null;this._marginleft=null;this._startPoint={x:0,y:0};this._stopPoint={x:0,y:0};this.mouseClickable=!1;this.dragDiv=null;this._initDiv=null;this._width=500;this._svgns="http://www.w3.org/2000/svg";this._prevSelectedItems=[];this._prevSelectedHeaders=[];this._isLevelColors;this.selectedItems==null&&(this.selectedItems=[]);this.treeMapItemSelected=null;this.treeMapGroupSelected=null;this._browser=null;this._toolTipElement=null;this._rootTreeMapItems=[];this.treemapgroups=[];this._drillHeader=null;this._drilldownItem=null;this._drilldownItems=[];this._treeMapHeaders=[];this._drilldownHeaders=[];this.drillStarted=null;this.drillDownItemSelected=null;this._treeMapLabels=[];this._labelTemplateElements=[];this._itemGroups=[];this._prevSelectedGroupDatas=[];this._interactiveArrow=null;this._legendRects=[]},_setModel:function(n){for(var t in n)switch(t){case"itemsLayoutMode":this.itemsLayoutMode(n[t]);this.refresh()}},_levels:function(){this.refresh()},_rangeColorMapping:function(){this._setColorMappings(this._rootTreeMapItems,this.model)},_groupColorMapping:function(){this._setColorMappings(this._rootTreeMapItems,this.model)},_groupColorMapping_rangeColorMapping:function(){this._setColorMappings(this._rootTreeMapItems,this.model)},_init:function(){this._initPrivateProperties();var t=n("<style>.drillGroupRect:hover{ background-color:"+this.drillDownSelectionColor()+";}<\/style>");n("html > head").append(t);this._levelInitialize();this._isSVG()||(document.createStyleSheet().addRule(".vml","behavior:url(#default#VML);display:inline-block"),document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"));this.refresh()},_destroy:function(){this._unWireEvents();n(this.element).removeClass("e-treemap e-js").find().remove(".tooltipelement");n(this.element).empty()},_levelInitialize:function(){var t=this;this.model.levels!=null?n.each(this.model.levels,function(i,r){r=t._checkArrayObject(r,i);var f=new u;n.extend(f,r);n.extend(r,f)}):this.levels.treeMapLevel=new u},_checkArrayObject:function(t,i){var f=["borderBrush","dataSource","groupColorMapping","enableDrillDown","drillDownHeaderColor","drillDownSelectionColor","colorValuePath","weightValuePath","treeMapItems","showLegend","borderBrush","borderThickness","enableResize","enableGradient","isResponsive","itemsLayoutMode","levels","groupBackground","groupBorderColor","groupBorderThickness","groupPadding","groupPath","groupGap","headerHeight","showHeader","showLabels","headerTemplate","labelTemplate","labelPosition","headerVisibilityMode","labelVisibilityMode","color","leafItemSettings","showLabels","labelPath","gap","itemTemplate","legendSettings","template","iconHeight","iconWidth","height","width","mode","leftLabel","rightLabel","dockPosition","alignment","highlightOnSelection","selectionMode","highlightGroupOnSelection","groupSelectionMode","draggingOnSelection","draggingGroupOnSelection","showTooltip","tooltipTemplate","highlightBorderThickness","highlightGroupBorderThickness","highlightBorderBrush","highlightGroupBorderBrush"],r=this;return n.each(t,function(n,t){if(f.indexOf(n)>-1)if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new u;r._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),t},_loadIndividualDefaultValues:function(t,i,r){var u=null,f=this;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),n.each(t,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},refresh:function(i){var u;if(document.getElementById(this._id)!=null||document.getElementById(this._id)!=r){this._unWireEvents();i||(this._drilldownItems=[]);this.model.enableResize||this.model.isResponsive?this._drilldownItems.length==0&&this._initPrivateProperties():this._initPrivateProperties();n(this.element).empty();this._svgDocument!=null&&n(this._svgDocument).empty();this._height=this.element.height();this._width=this.element.width();this._height==0&&(this._height=this.element[0].parentElement.clientHeight!=0?this.element[0].parentElement.clientHeight:n(document).height());this._width==0&&(this._width=this.element[0].parentElement.clientWidth!=0?this.element[0].parentElement.clientWidth:n(document).width());this.showLegend()&&this._sizeCalculation();var f=jQuery.uaMatch(navigator.userAgent),e=f.browser.toLowerCase(),o=!!navigator.userAgent.match(/Trident\/7\./);if(this._browser=e,n(this.element).css({position:"relative"}),this._height!=0&&this._width!=0){if(this._templateDiv=n("<div class='_templateDiv'><\/div>"),this._templateDiv.css({"pointer-events":"none",overflow:"hidden",float:"left","z-index":"2",height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft,position:"absolute",left:"0",top:"0"}),this.enableDrillDown()&&this._drilldownItems.length==0&&(this._drillHeaderDiv=n("<div class='_drillHeaderDiv'><\/div>"),this._drillHeaderDiv.css({overflow:"hidden",float:"left","z-index":"3",position:"absolute",left:"0",top:"0"}),this._drillHoverDiv=n("<div class='_drillHoverDiv'><\/div>"),this._drillHoverDiv.css({overflow:"hidden",float:"left","z-index":"3",height:this._height-30,width:this._width,position:"absolute",left:"0",top:"30px"})),this._backgroundTile=n('<div id="backgroundTile" style="overflow:hidden;z-index:0;"><\/div>'),this.showLegend()&&this.model.legendSettings!=null&&this._renderLegend(),this.dataSource()!=null)if(this._drilldownItems.length>0){if(this.enableDrillDown()&&this.model.levels.length>=1&&(this._drilldownItem!=null||this._drilldownItem==null)){for(u=0;u<this._drillHeaderDiv[0].children[0].children.length;u++)this._drillHeaderDiv[0].children[0].children[u].className=="e-drilldownlabel"&&(header=this._drillHeaderDiv[0].children[0].children[u].innerHTML);this._backgroundTile[0].innerHTML="";this._drillHeaderDiv[0].innerHTML="";this._templateDiv[0].innerHTML="";this._drillHoverDiv[0].innerHTML="";this._drillDownHeader(header,!0);this._groupdrillDownLevels(this._drilldownItems[this._drilldownItems.length-1],this._drilldownItems.length)}this.showLegend()&&this._generateLegend();this._generateToolTip()}else this.model.dataSource instanceof t.DataManager?this._processOData(this):this._renderTreeMap(this.dataSource());(this.enableResize()||this.model.isResponsive)&&this._on(n(window),"resize",this._treeMapResize)}this._selectItemResize();this._trigger("refreshed","")}},_renderTreeMap:function(n){this.model.browserInfo=this.browserInfo();this.showLegend()&&this._generateLegend();this._groupLevels(n);this._generateToolTip();this._renderLabels()},_renderLegend:function(){this._legenddiv=n("<div class='LegendDiv'/>");this._legenddiv.appendTo(this.element);this._legenddiv.css({"pointer-events":"none",overflow:"hidden",position:"absolute","z-index":"2",height:this._legendSize.height,width:this._legendSize.width})},_processOData:function(n){var t=this,i=n.model.dataSource.executeQuery(n.model.query);i.done(function(n){n.result!=null&&t._renderTreeMap(n.result)})},_treeMapResize:function(n){n.preventDefault();n.stopPropagation();var t=this;this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){t.refresh(!0)},500)},_unWireEvents:function(){var n=jQuery.uaMatch(navigator.userAgent),t=n.browser.toLowerCase()},_groupLevels:function(t){var r=null,h=this.model.isHierarchicalDatasource,f,u,i,s,e,o;if(this.enableDrillDown()&&(this._drilldownHeaders.push(this.model.header||this.model.levels[0].groupPath),this._drillDownHeader(!1)),f=this._getTopGroupitem(this.labelPath(),t,0),r=f,this.model.levels.length==0&&(i=this.model.leafItemSettings,this._rootTreeMapItems=f,this._getTopLevels(f[0].innerItems,i),this._generateTreeMapItems(f[0].innerItems,"gray",this.colorValuePath()),this.showLabels()&&this._generateLabels(f[0].innerItems,i)),this.model.levels.length>0)for(u=0;u<=this.model.levels.length;u++)if(i=this.model.levels[u],i!=null&&(n.isNumeric(i.groupGap)||(i.groupGap=0),n.isNumeric(i.groupPadding)||(i.groupPadding=0),n.isNumeric(i.groupBorderThickness)||(i.groupBorderThickness=0)),u!=0){if(s=r,e=this.model.levels[u-1],r=[],i==null&&(i=this.model.leafItemSettings),this._generateSubItems(s,i,r,e),this._rootTreeMapItems=r,this.enableDrillDown()){if(u==1)return this._generateTreeMapItems(r,"gray",e.DisplayPath),!1}else u==this.model.levels.length&&this._generateTreeMapItems(r,"gray",e.DisplayPath);this.showLabels()&&u==this.model.levels.length&&this._generateLabels(r,i)}else o=this._getGroupitem(h?this.labelPath():i.groupPath,f[0].Data,i.headerHeight),this._rootTreeMapItems=o,this._getTopLevels(o,i),r=o},_groupdrillDownLevels:function(t,i){var f=null,c=this.model.isHierarchicalDatasource,s,u,r,h,e,o;if(i==this.model.levels.length-1?this._drillHoverDiv.css("pointer-events","none"):this._drillHoverDiv.css("pointer-events","auto"),this.model.levels.length>0)for(s=!1,u=c?i-1:0;u<this.model.levels.length;u++)r=this.model.levels[u],r!=null&&(n.isNumeric(r.groupGap)||(r.groupGap=0),n.isNumeric(r.groupPadding)||(r.groupPadding=0),n.isNumeric(r.groupBorderThickness)||(r.groupBorderThickness=0)),u!=(c?i-1:0)?(h=f,e=this.model.levels[u-1],f=[],r==null&&(r=this.model.leafItemSettings),u==i+1?this._generateSubItems(h,r,f,e,null,i+1!=u):this._generateSubItems(h,r,f,e,!0,i+1!=u),this._rootTreeMapItems=f,u!=i+1&&u!=this.model.levels.length-1||s||(this._generateTreeMapItems(f,"gray",e.DisplayPath),s=!0),i==this.model.levels.length-1&&u==i&&r.showLabels&&this._generateLabels(f,r)):(o=this._getGroupitem(this.model.isHierarchicalDatasource?null:r.groupPath,t.Data,r.headerHeight),this._rootTreeMapItems=o,this._getTopLevels(o,r),f=o);this.showLegend()&&this._generateLegend();this._renderLabels();this._trigger("drillDownItemSelected",{level:i,header:this.getDrillDownHeader(this._drilldownHeaders),prevLevel:i-1})},_getTopLevels:function(n,i){var f=i.groupGap!=null?i.groupGap:i.gap!=null?i.gap:0,e=this.itemsLayoutMode(),r=0,u=0;this.enableDrillDown()&&(u=30);this.showLegend()&&this.model.legendSettings!=null&&(r=r);this._legendHeight=r;this.enableDrillDown()&&(this._drillHeaderDiv.css({top:r}),this._drillHoverDiv.css({top:30+r}));e==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceHorizontal?this._calculateSliceAndDiceItemSize(n,0,r,this._width,this._height,f,u,!0,r):e==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceVertical?this._calculateSliceAndDiceItemSize(n,0,r,this._width,this._height,f,u,!1,r):e==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceAuto?this._calculateSliceAndDiceItemSize(n,0,r,this._width,this._height,f,u,null,r):this._calculateSquarifiedItemSize(n,0,r,this._width,this._height,f,u,r)},_generateSubItems:function(n,i,u,f,e,o){var h=f.groupPadding,s,c,l,v,p,y;h==""&&(h=0);var d=this.itemsLayoutMode(),g=n.length,w=this.model.isHierarchicalDatasource?null:i.groupPath;w==null&&(w=this.labelPath());w==null&&(w=this.weightValuePath());var b=i.groupGap!=null?i.groupGap:i.gap!=null?i.gap:0,k=(f.showHeader||f.showHeader==null)&&!this.enableDrillDown()?f.headerHeight:0,a=0;for(s=0;s<g;s++){if(c=this._getGroupitem(w,n[s].Data,i.headerHeight,this.model.isHierarchicalDatasource?f.groupPath:null),d==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceHorizontal?this._calculateSliceAndDiceItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,!0,0):d==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceVertical?this._calculateSliceAndDiceItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,!1,0):d==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceAuto?this._calculateSliceAndDiceItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,null,0):this._calculateSquarifiedItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,0),l=this._rootTreeMapItems[s],l.headerHeight=f.headerHeight,l.showHeader=f.showHeader,l.headerWidth=n[s].ItemWidth,l.headerTemplate=f.headerTemplate,l.headerLeftPosition=n[s].LeftPosition,l.headerTopPosition=n[s].TopPosition,this.enableDrillDown()&&this._createBackGround(l,f,n[s],o),(f.showHeader||f.showHeader==null)&&(this.enableDrillDown()||(this._createBackGround(l,f,n[s]),this._generateHeaders(l,f))),n[s].ChildtreeMapItems=c,n[s].GroupingLevel=this.model.levels.indexOf(f)+1,this.model.levels.indexOf(f)==0){if(this.model.groupColorMapping!=null&&this.model.groupColorMapping.length>0)for(this._isLevelColors=!0,v=0;v<this.model.groupColorMapping.length;v++)p=this.model.groupColorMapping[v],p.groupID==l.header&&this._setColorMappings(c,p,!0)}else if(this.model.levels.indexOf(f)>0&&this.model.groupColorMapping!=null&&this.model.groupColorMapping.length>0)for(v=0;v<this.model.groupColorMapping.length;v++)p=this.model.groupColorMapping[v],p.groupID==n[s].ParentHeader&&this._setColorMappings(c,p,!0);for(y=0;y<c.length;y++)u[a]=c[y],c[y].backgroundColor==null&&(c[y].backgroundColor=n[s].backgroundColor),c[y].backgroundOpacity==null&&(c[y].backgroundOpacity=n[s].backgroundOpacity),(this.enableDrillDown()||u[a].ItemHeight<l.ItemHeight-l.headerHeight)&&(u[a].ParentHeader=l.header,u[a].ItemHeight-=h,u[a].ItemWidth-=h,u[a].LeftPosition+=f.groupBorderThickness,u[a].TopPosition+=f.groupBorderThickness),a++}e==r&&f.showLabels&&this._generateLabels(n,f)},_createBackGround:function(t,i,r,u){var f=n("<div />"),o=t.showHeader||t.showHeader==null||this.enableDrillDown()?t.ItemHeight-2*i.groupBorderThickness:0,h=t.showHeader||t.showHeader==null||this.enableDrillDown()?t.TopPosition:0,e,s;f.css({height:o+"px",width:t.ItemWidth-2*i.groupBorderThickness+"px",left:t.LeftPosition+"px",top:h+"px","border-style":"solid","border-width":i.groupBorderThickness+"px",position:"absolute"});i.groupBorderColor!=null&&f.css("border-color",i.groupBorderColor);i.groupBackground!=null&&f.css("background-color",i.groupBackground);this.treemapgroups.push({header:t.header,element:f});f.appendTo(this._backgroundTile);o=parseFloat(f[0].style.top)-30-this._legendHeight+"px";this.enableDrillDown()&&!u&&(e=n("<div class='drillGroupRect'/>"),e.css({height:f[0].style.height,width:f[0].style.width,left:f[0].style.left,top:o,position:"absolute",opacity:.2,display:"block"}),this._drillHoverDiv.append(e),n(e).mousedown({treemap:this,level:i,param1:r},this._headerClickFunction),n(e).mouseleave({treemap:this,param1:t.header},this._mouseLeaveFunction),s={data:t.Data,label:t.header,header:t.header},n(e).mousemove({treemap:this,hoverItem:s},this._mouseRectHoverFunction));n(f).mousedown({treemap:this,level:i,param1:r},this._headerClickFunction);n(f).mousemove({treemap:this,hoverItem:t.Data},this._mouseRectHoverFunction)},_mouseRectHoverFunction:function(t){var r=t.data.treemap,h=t.data.hoverItem,i,f,e,o,s,u;r.showTooltip()&&(i=r._toolTipElement,f=r.model.tooltipTemplate,i!=null&&f!=null&&(n(i).css({left:t.pageX+10,top:t.pageY+10,display:"block"}),e=n("#"+f).render(h),n(i).html(e),o=i[0]!=null?i[0].clientHeight:i.clientHeight,s=i[0]!=null?i[0].clientWidth:i.clientWidth,r._tooltipSize={height:o,width:s}),u=r._tooltipSize,u.width+t.pageX>=r._width&&(t.pageX-=u.width,t.pageX<0&&(t.pageX=10)),u.height+t.pageY>=r._height&&(t.pageY-=u.height,t.pageY<0&&(t.pageY=10)),i!=null&&(r.enableDrillDown()?n(i).css({left:t.pageX+10,top:t.pageY+10,display:"block"}):n(i).css({left:t.pageX+10,top:t.pageY+10,display:"none"})))},_mouseLeaveFunction:function(t){var i=t.data.treemap;i.showTooltip()&&i._toolTipElement!=null&&n(i._toolTipElement).css("display","none")},_headerClickFunction:function(t){var f=t.data.level,r=t.data.param1,c=t.ctrlKey,i=t.data.treemap,s,o,e,h,u;if(i.highlightGroupOnSelection())if(i._browser!="msie"&&(s=i._backgroundTile[0].children[i._backgroundTile[0].children.length-0],i._backgroundTile[0].insertBefore(this,s)),i.groupSelectionMode()=="multiple"&&c)n.inArray(this,i._prevSelectedHeaders)==-1?(n(this).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders.push(this),i._prevSelectedGroupDatas.push(t.data.Param1)):(n(this).css({"border-width":f.groupBorderThickness,"border-color":f.groupBorderColor}),o=i._prevSelectedHeaders.indexOf(this),i._prevSelectedHeaders.splice(o,1),i._prevSelectedGroupDatas.splice(o,1));else{for(e=0;e<i._prevSelectedHeaders.length;e++)n(i._prevSelectedHeaders[e]).css({"border-width":f.groupBorderThickness,"border-color":f.groupBorderColor});n.inArray(this,i._prevSelectedHeaders)==-1?(n(this).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders=[],i._prevSelectedHeaders.push(this)):i._prevSelectedHeaders=[];i._prevSelectedGroupDatas.push(t.data.Param1)}if(i.enableDrillDown()&&i._trigger("drillStarted",t),i.enableDrillDown()&&i.model.levels.length>1&&(i._drilldownItem!=null&&i._drilldownItem.header!=r.header||i._drilldownItem==null)){for(h="",u=0;u<i._drillHeaderDiv[0].children[0].children.length;u++)i._drillHeaderDiv[0].children[0].children[u].className=="e-drilldownlabel"&&(h=i._drillHeaderDiv[0].children[0].children[u].innerHTML);return i._backgroundTile[0].innerHTML="",i._labelTemplateElements=[],i._drillHeaderDiv[0].innerHTML="",i._templateDiv[0].innerHTML="",i._drillHoverDiv[0].innerHTML="",i._drilldownHeaders.push(r.header),i._drillDownHeader(!0),i._drilldownItem=r,i._drilldownItems.push(r),i._groupdrillDownLevels(r,i._drilldownItems.length),!1}},_rectMouseDown:function(n){n.data.treeMap.isTouch(n)&&n.preventDefault()},_docClickFunction:function(t){var u=t.data.treemap,r=this._toolTipElement,i=this;clearTimeout(i.model.timer);r&&(i.model.trackerElement=r,i.model.timer=setTimeout(function(){i.model.trackerElement&&n(i.model.trackerElement).fadeOut(500,function(){i.model.trackerElement=null})},1200))},mousePosition:function(n){return!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0?n:n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0?n.originalEvent:n.originalEvent&&n.originalEvent.changedTouches!=r&&!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0?n.originalEvent.changedTouches[0]:n},_highlightTreemap:function(t){var i=t.data.treemap,v=t.data.Param1,h=i.model.levels[0],c,a=t.ctrlKey,l,e=i.mousePosition(t),f,r,u,s,o;if(i.highlightGroupOnSelection()){for(f=0;f<i.treemapgroups.length;f++)if(l=i.treemapgroups[f],r=i.treemapgroups[f].element,u=r[0].getBoundingClientRect(),u.left<e.clientX&&u.left+u.width>e.clientX&&u.top<e.clientY&&u.top+u.height>e.clientY){n(r).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush(),"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});c=!0;break}if(c)if(i.groupSelectionMode()=="multiple"&&a)n.inArray(r,i._prevSelectedHeaders)==-1?(n(r).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders.push(l),i._prevSelectedGroupDatas.push(t.data.Param1)):(n(r).css({"border-width":h.groupBorderThickness,"border-color":h.groupBorderColor}),s=i._prevSelectedHeaders.indexOf(l),i._prevSelectedHeaders.splice(s,1),i._prevSelectedGroupDatas.splice(s,1));else{for(o=0;o<i._prevSelectedHeaders.length;o++)n(i._prevSelectedHeaders[o].element).css({"border-width":h.groupBorderThickness,"border-color":h.groupBorderColor});n.inArray(r,i._prevSelectedHeaders)==-1?(n(r).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders=[],i._prevSelectedHeaders.push(l)):i._prevSelectedHeaders=[];i._prevSelectedGroupDatas.push(t.data.Param1)}i._trigger("treeMapGroupSelected",{selectedGroups:i._prevSelectedHeaders,orginalEvent:t})}if(i.highlightOnSelection()){for(f=0;f<i._rootTreeMapItems.length;f++)if(r=i._rootTreeMapItems[f],u=r.Rectangle.getBoundingClientRect(),u.left<e.clientX&&u.left+u.width>e.clientX&&u.top<e.clientY&&u.top+u.height>e.clientY){n(r.Rectangle).css({"border-width":i.highlightBorderThickness(),"border-color":i.highlightBorderBrush(),"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});c=!0;break}if(c){if(i.selectionMode()=="multiple"&&a)n.inArray(r.Rectangle,i._prevSelectedItems)==-1?(n(r.Rectangle).css({"border-width":i.highlightBorderThickness(),"border-color":i.highlightBorderBrush(),"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"}),i._prevSelectedItems.push(r.Rectangle),i.selectedItems.push(r.Data)):(n(r.Rectangle).css({"border-width":i.borderThickness(),"border-color":i.borderBrush()}),s=i._prevSelectedItems.indexOf(r.Rectangle),i._prevSelectedItems.splice(s,1),i.selectedItems.splice(s,1));else{for(o=0;o<i._prevSelectedItems.length;o++)n(i._prevSelectedItems[o]).css({"border-width":i.borderThickness(),"border-color":i.borderBrush()});n.inArray(r.Rectangle,i._prevSelectedItems)==-1?(n(r.Rectangle).css({"border-width":i.highlightBorderThickness(),"border-color":i.highlightBorderBrush()}),i._prevSelectedItems=[],i.selectedItems=[],i._prevSelectedItems.push(r.Rectangle),i.selectedItems.push(r.Data)):(i._prevSelectedItems=[],i.selectedItems=[])}i._trigger("treeMapItemSelected",{selectedItems:i.selectedItems,originalEvent:t})}}},doubleTap:function(n){var i=n.targetTouches?n.targetTouches[0]:n,r=i.pageX,u=i.pageY,e=this.model,f=200,t=n.data.treemap;t.model.cachedX=t.model.cachedX||r;t.model.cachedY=t.model.cachedY||u;timestamp=(new Date).getTime();Math.abs(r-t.model.cachedX)<f&&Math.abs(u-t.model.cachedY)<f&&t.model.tapNum++},rectClick:function(n){var t=n.data.treemap;t.doubleTap(n);t.isTouch(n)||t._highlightTreemap(n)},dragDown:function(t){var i=t.data.treemap,e=i.model.levels[0],r=i._svgDocument,u,f,o;if(t.type=="mousedown"?(i._startPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop},i._stopPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop}):t.type=="touchstart"?(i._startPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop},i._stopPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop}):t.type=="MSPointerDown"&&(i._startPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop},i._stopPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop}),i.mouseClickable=!0,i.model.draggingGroupOnSelection&&i._prevSelectedGroupDatas.length>0){for(u=0;u<i._prevSelectedGroupDatas.length;u++)f=i._prevSelectedGroupDatas[u][0],o=f.getBoundingClientRect(),n.inArray(f,i._prevSelectedGroupDatas[u][0])==-1&&n(i._prevSelectedGroupDatas[u]).css({"border-width":e.groupBorderThickness,"border-color":i.model.highlightGroupBorderBrush});i._prevSelectedGroupDatas=[]}if(i.model.draggingOnSelection&&i._prevSelectedItems.length>0){for(u=0;u<i._prevSelectedItems.length;u++)f=i._prevSelectedItems[u].rectangle,o=f.getBoundingClientRect(),n.inArray(f,i._prevSelectedItems[u].rectangle)==-1&&n(i._prevSelectedItems[u].rectangle).css({"border-width":e.groupBorderThickness,"border-color":i.model.highlightGroupBorderBrush});i._prevSelectedItems=[]}},dragMove:function(t){var f,e,i=t.data.treemap,r=i._svgDocument,u;(i.model.draggingGroupOnSelection||i.model.draggingOnSelection)&&i.mouseClickable&&(t.type=="mousemove"?i._stopPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop}:t.type=="touchmove"?i._stopPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:t.type=="MSPointerMove"&&(i._stopPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop}),n("#dragDiv").remove(),u=n('<div id = "dragDiv"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),n(u).css({top:Math.min(i._startPoint.y,i._stopPoint.y),left:Math.min(i._startPoint.x,i._stopPoint.x),width:f,height:e,border:"1px solid green",position:"absolute","z-index":100}),n(u).appendTo("#svgDocument"))},dragUp:function(t){var i=t.data.treemap,o=Math.abs(i._stopPoint.x-i._startPoint.x),s=Math.abs(i._stopPoint.y-i._startPoint.y),e=i._svgDocument,r,f,u;if((i.model.draggingGroupOnSelection||i.model.draggingOnSelection)&&(n("#dragDiv").remove(),n("#dragDiv").css({display:"none"}),i.mouseClickable=!1),i.model.draggingGroupOnSelection){for(r=0;r<i.treemapgroups.length;r++)f=i.treemapgroups[r].element,u=f[0].getBoundingClientRect(),u.left-e[0].offsetLeft+u.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+o<u.left-e[0].offsetLeft||u.top-e[0].offsetTop+u.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+s<u.top-e[0].offsetTop||i._contains(i._prevSelectedGroupDatas,f)||i._prevSelectedGroupDatas.push(f);for(r=0;r<i._prevSelectedGroupDatas.length;r++)f=i._prevSelectedGroupDatas[r][0],u=f.getBoundingClientRect(),n(f).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.model.highlightGroupBorderBrush,"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});i.selectedItems.push(i._prevSelectedGroupDatas)}if(i.model.draggingOnSelection){for(r=0;r<i._rootTreeMapItems.length;r++)f=i._rootTreeMapItems[r],u=f.rectangle.getBoundingClientRect(),u.left-e[0].offsetLeft+u.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+o<u.left-e[0].offsetLeft||u.top-e[0].offsetTop+u.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+s<u.top-e[0].offsetTop||i._contains(i._prevSelectedItems,f)||i._prevSelectedItems.push(f);for(r=0;r<i._prevSelectedItems.length;r++)f=i._prevSelectedItems[r].rectangle,u=f.getBoundingClientRect(),n(f).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.model.highlightGroupBorderBrush,"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});i.selectedItems.push(i._prevSelectedItems)}},_generateLabels:function(i,u){for(var f,v,l,s,o,k,b,h,y,p,c=0;c<i.length;c++){if(f=i[c],u.labelTemplate==null){var w=8,a=5,e=n('<label class="e-treemap-label" >'+f.label+"<\/label>");this.enableDrillDown()?n(e).css({position:"absolute",color:"black",overflow:"hidden",left:f.LeftPosition+w+"px",top:f.TopPosition+a+"px","font-weight":"normal","pointer-events":"none"}):n(e).css({position:"absolute",color:"white",overflow:"hidden",left:f.LeftPosition+w+"px",top:f.TopPosition+a+"px","font-weight":"normal","pointer-events":"none"});this._treeMapLabels.push(e);this._templateDiv.append(e);v=0;l=0;u.groupPadding!=r&&(v=u.groupPadding);u.groupBorderThickness!=r&&(l=u.groupBorderThickness);s=e[0].getBoundingClientRect().width>0?e[0].getBoundingClientRect().width+v+l+2:f.label.length*8;o=e[0].getBoundingClientRect().height;o==0&&f.ItemHeight>18?o=18:o>0&&o>f.ItemHeight&&(o=f.ItemHeight-a);n(e).css({width:s+"px",height:o+"px"});f.labelPosition=u.labelPosition;f.labelVisibilityMode=l;f.groupPadding=u.groupPadding;f.groupBorderThickness=u.groupBorderThickness;e[0].data=f;this._labelTemplateElements.push(e);u.labelVisibilityMode==t.datavisualization.TreeMap.VisibilityMode.HideOnExceededLength?(s>f.ItemWidth&&(n(e).css({display:"none"}),f.Rectangle!=null&&(f.Rectangle.title=f.label)),k=u.labelVisibilityMode):s<f.ItemWidth?n(e).css({width:s}):n(e).css({width:f.ItemWidth})}u.labelTemplate!=null&&(b=n("#"+u.labelTemplate),h=n("<div style='overflow:hidden;display:block;position:absolute;pointer-events: none;'><\/div>"),h[0].data=f,f.labelPosition=u.labelPosition,f.labelVisibilityMode=u.labelVisibilityMode,y=n.templates(b.html()),p="",p=f.Data instanceof Array?y.render({data:f.Data}):y.render(f.Data),n(h).html(p),this._templateDiv.append(h),this._labelTemplateElements.push(h))}},_generateToolTip:function(){var t,i,r;this.showTooltip()&&(t=document.documentMode==8?document.querySelectorAll("tooltipelement"):document.getElementsByClassName("tooltipelement"+this._id),t!=null&&t.length==0?(i=n("<div><\/div>").attr("class","tooltipelement"+this._id).css({position:"absolute","z-index":"1000",display:"none","pointer-events":"none"}),n(document.body).append(i),this._toolTipElement=i):this._toolTipElement=t[0],this.model.tooltipTemplate==null&&(r=this.labelPath()!=null?this.labelPath():this.weightValuePath(),r!=null&&(this.model.tooltipTemplate="defaultTooltip",this.element.append(n('<div id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">{{:#data["'+r+'"]}}<\/label><\/p><\/div><\/div><\/div>')))))},_generateLegend:function(){var u,e,r,h,f;if(this.model.rangeColorMapping!=null){if(u=this.model.rangeColorMapping,e=this.model.legendSettings,e.mode!=t.datavisualization.TreeMap.LegendMode.Interactive){var n=0,i=0,o=0,c=this.iconWidth()+5,l=this.iconHeight()+15,s=this.model.legendSettings.columnCount;for(r=0;r<u.length;r++)h=this._calcWidth(u[r].legendLabel),f=this.iconWidth()+10+h,s!=0?r%s!=0?(this._drawLegend(u[r],n,i),n+=f+5):(r!=0&&(i+=this.iconHeight()+18),n=0,this._drawLegend(u[r],n,i),n+=f+5):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?this._legendSize.width<n+f?(i+=this.iconHeight()+18,n=0,this._drawLegend(u[r],n,i),n+=f):(this._drawLegend(u[r],n,i),n+=f):this._legendSize.height<i+this.iconHeight()?(i=0,n+=o+10,this._drawLegend(u[r],n,i),o=0,i+=this.iconHeight()+18):(this._drawLegend(u[r],n,i),o=Math.max(o,f),i+=this.iconHeight()+18)}else this._drawInteractiveLegend();(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom)&&e.alignment==t.datavisualization.TreeMap.Alignment.Center?this._legenddiv.css({"margin-left":this._width/2-this._legendSize.width/2}):(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom)&&e.alignment==t.datavisualization.TreeMap.Alignment.Far?this._legenddiv.css({"margin-left":this._width-this._legendSize.width}):(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Left||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right)&&e.alignment==t.datavisualization.TreeMap.Alignment.Center?this._legenddiv.css({"margin-top":this._height/2-this._legendSize.height/2}):(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Left||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right)&&e.alignment==t.datavisualization.TreeMap.Alignment.Far&&this._legenddiv.css({"margin-top":this._height-this._legendSize.height});this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?this._legenddiv.css({"margin-top":this._height+5}):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right&&this._legenddiv.css({"margin-left":this._width+5})}},_drawLegend:function(t,i,r){var f,u;f=this.model.legendSettings.template=="Ellipse"?this._getEllipseLegend(this.model.legendSettings,i,r):this._getRectLegend(this.model.legendSettings,i,r);i+=this.iconWidth()+5;n(f).css("background-color",t.color);f.appendTo(this._legenddiv);u=n("<div class='e-treemap-legendLabel'/>");u.css({left:i+"px",top:r+"px",position:"absolute"});u[0].innerHTML=t.legendLabel;u.appendTo(this._legenddiv)},_calcWidth:function(t){var i=n('<span class ="e-treemap-legendLabel" >'+t+"<\/span>"),r;return n("body").append(i),r=i.width(),i.remove(),r},_getEllipseLegend:function(t,i,r){var u=n("<div class='e-mapLegend'/>");return u.css({height:this.iconHeight()+"px",width:this.iconWidth()+"px","border-radius":this.iconHeight()/2+"px",left:i+"px",top:r+"px",position:"absolute"}),u},_getRectLegend:function(t,i,r){var u=n("<div />");return u.css({height:this.iconHeight()+"px",width:this.iconWidth()+"px",left:i+"px",top:r+"px",position:"absolute"}),u},_getPositionFromParent:function(n,t){var i=n.getBoundingClientRect(),r=t.getBoundingClientRect(),u=window.SVGSVGElement?i.width:i.right-i.left,f=window.SVGSVGElement?i.height:i.bottom-i.top;return{left:i.left-r.left,top:i.top-r.top,height:f,width:u}},_renderLabels:function(){for(var r=0;r<this._labelTemplateElements.length;r++){var u=this._labelTemplateElements[r],f=this._getPositionFromParent(u[0],this._templateDiv[0]),i=u[0].data,e=this._getDockPositionPoint({left:i.LeftPosition,top:i.TopPosition,width:i.ItemWidth,height:i.ItemHeight},f,i);n(u).css({left:e.x,top:e.y,"pointer-events":"none",overflow:"hidden"});i.labelVisibilityMode==t.datavisualization.TreeMap.VisibilityMode.HideOnExceededLength&&(f.height>i.ItemHeight||f.width>i.ItemWidth)&&n(u).css("display","none")}},_generateHeaders:function(i,r){var a=r.headerVisibilityMode,e=!1,s=2,h=2,u,c,o,f,arguments,l;a==t.datavisualization.TreeMap.VisibilityMode.HideOnExceededLength?(u=n("<span>"+i.header+"<\/span>"),n(document.body).append(u),c=u.outerWidth(),u.remove(),i.headerHeight<i.ItemHeight-2*s&&c<i.ItemWidth-2*h&&(e=!0)):i.headerHeight<i.ItemHeight&&(e=!0);e&&(i.headerTemplate==null?(o=n('<div style="display:block;position:absolute;pointer-events: stroke;overflow: hidden;"><label class="e-treemap-header">'+i.header+"<\/label><\/div>"),n(o).css({left:i.headerLeftPosition+s,top:i.headerTopPosition+h,width:i.headerWidth-r.groupPadding,height:i.headerHeight,"margin-left":r.groupPadding}),this._templateDiv.append(o)):(f=n("<div style='display:block;position:absolute;pointer-events: none;overflow: hidden;'><\/div>"),this._templateDiv.append(f),n(f).css({left:i.headerLeftPosition,width:i.headerWidth,top:i.headerTopPosition,height:i.headerHeight}),arguments={header:i.header,data:i.Data},l=n("#"+i.headerTemplate).render(arguments),n(f).html(l)))},getDrillDownHeader:function(n){var i="",t;if(n.length==1)return n[0];for(t=0;t<n.length;t++)i+=n[t],t!=n.length-1&&(i+=".");return i},_drillDownHeader:function(t){var u=[],r;for(i=0;i<this._drilldownHeaders.length;i++)u+="<label class='e-drilldownlabel' style='margin-left:-8px'>"+this._drilldownHeaders[i]+"<\/label>",this._drilldownHeaders.length>1&&i<this._drilldownHeaders.length-1&&(u=u+".");r=n("<div class='e-drilldownHeader' style='display:block;overflow: hidden;'><label class='e-drilldownlabel' style='position:absolute;height:30px;position:absolute;margin-top: 5px;top: 0px;'>"+u+"<\/label><\/div>");t&&(r=n("<div class='e-drilldownHeader' style='display:block;overflow: hidden;'><svg class='e-drilldownarrow' style='width:15px;height:15px;margin-top: 10px;'><polyline points='8,0 8,10 0,5 8,0'/><\/svg><label class='e-drilldownlabel' style='left:17px;position:absolute;height:30px;position:absolute;margin-top: 5px;top: 0px;'>"+u+"<\/label><\/div>"));n(r).css({left:"0px",width:this._width+"px",top:0,height:"30px",cursor:"pointer"});this.drillDownHeaderColor()!=null&&n(r).css("background-color",this.drillDownHeaderColor());this._drillHeaderDiv.append(r);n(r).mousedown({treemap:this},this._drilldownfunction);n(".e-drilldownlabel").mousedown({treemap:this},this._drilldownLabel)},_drilldownLabel:function(n){var u=this.innerHTML,t=n.data.treemap,r,f,e;if(t._drilldownHeaders[0]==u)t._drilldownItems=[],t.refresh();else{for(f="",t._drillHeaderDiv[0].innerHTML="",t._backgroundTile[0].innerHTML="",e="",i=0;i<t._drilldownHeaders.length;i++)u==t._drilldownHeaders[i]&&(r=i+1,t._drilldownHeaders.splice(i+1));return t._labelTemplateElements=[],t._drillDownHeader(!0),t._drilldownItem=t._drilldownItems[r-2],t._drilldownItems.splice(r-1),t._templateDiv[0].innerHTML="",t._groupdrillDownLevels(t._drilldownItem,t._drilldownItems.length),!1}},_drilldownfunction:function(n){var t=n.data.treemap,r,i,u,f;if(t._trigger("drillStarted",n),t._drilldownItems.length>0){if(t._drilldownItems.length==1)t._drilldownItems=[],t.refresh();else{for(r="",i=0;i<t._drillHeaderDiv[0].children[0].children.length;i++)t._drillHeaderDiv[0].children[0].children[i].className=="e-drilldownlabel"&&(r=t._drillHeaderDiv[0].children[0].children[i].innerHTML);u=r.split(".");t._drillHeaderDiv[0].innerHTML="";t._backgroundTile[0].innerHTML="";f="";t._drilldownHeaders.length>1&&t._drilldownHeaders.pop(t._drilldownHeaders.length-1);t._labelTemplateElements=[];t._drillDownHeader(!0);t._drilldownItem=t._drilldownItems[t._drilldownItems.length-2];t._drilldownItems.pop(t._drilldownItems[t._drilldownItems.length-1]);t._templateDiv[0].innerHTML="";t._groupdrillDownLevels(t._drilldownItem,t._drilldownItems.length)}t._trigger("drillDownItemSelected",{level:t._drilldownItems.length,header:t.getDrillDownHeader(t._drilldownHeaders),prevLevel:t._drilldownItems.length-1})}},_sizeCalculation:function(){var o,n,l;if(this.model.rangeColorMapping!=null){var i=this.model.rangeColorMapping,e=0,h=0,a=this.iconWidth()+5,u=this.iconHeight()+15,f=0,c=this.model.legendSettings.columnCount,s=this.model.legendSettings;if(this.model.legendSettings.mode!=t.datavisualization.TreeMap.LegendMode.Interactive){if(this.legendheight()==0&&this.legendwidth()==0&&c==0){for(n=0;n<i.length;n++)i[n].legendLabel==r&&(i[n].legendLabel=i[n].from+"-"+i[n].to),l=this._calcWidth(i[n].legendLabel),o=a+l+10,this.legendheight()==0&&this.legendwidth()==0?this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?this._width<e+o?(u=this.iconHeight()+15+u,f=Math.max(f,e),e=o):e+=o:this._height<h+this.iconHeight()+15?(f+=e,u=Math.max(u,h),e=o,h=0):(h+=this.iconHeight()+18,e=Math.max(o,e)):(xPos+=_legendlabelwidth+18,xPos+150>=this.legendwidth()&&(xPos=10,yPos+=40));this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?(f=Math.max(f,e),u+=5):(f+=e+15,u=Math.max(u,h))}else if(c==0){for(n=0;n<i.length;n++)i[n].legendLabel==r&&(i[n].legendLabel=i[n].from+"-"+i[n].to);u=this.legendheight().toString().indexOf("%")!=-1?this._height/100*parseInt(this.legendheight().replace("%","")):this.legendheight();f=this.legendwidth().toString().indexOf("%")!=-1?this._width/100*parseInt(this.legendwidth().replace("%","")):this.legendwidth()}if(c!=0)for(n=0;n<i.length;n++)i[n].legendLabel==r&&(i[n].legendLabel=i[n].from+"-"+i[n].to),l=this._calcWidth(i[n].legendLabel),o=a+l+10,n%c!=0?(e+=o,n==c-1&&(f=Math.max(f,e))):(n!=0&&(u=this.iconHeight()+15+u),f=Math.max(f,e),e=o)}else u=(s.height!=0?s.height:30)+18,s.title!=null&&s.title!=""&&(u+=25),f=(s.width!=0?s.width:100)+20+s.leftLabel.length*10+s.rightLabel.length*10;this._legendSize={height:u,width:f};this.model.legendSettings!=null&&(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?(this._height=this._height-parseFloat(u),this.model.legendSettings.tempWidth=e):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top?(this._height=this._height-parseFloat(u),this._margintop=parseFloat(u)):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Left?(this._width=this._width-f,this._marginleft=f):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right&&(this._height=this._height,this._width=this._width-f))}},_getDockPositionPoint:function(n,i,u){var o=u.labelPosition,e=2,f=2;return u.groupPadding!=r&&u.groupBorderThickness!=r&&(e=u.groupPadding+u.groupBorderThickness+e,f=u.groupPadding+u.groupBorderThickness+f),u.showHeader&&!this.enableDrillDown()&&(f=f+u.headerHeight),o==t.datavisualization.TreeMap.Position.TopCenter?e=n.width/2-i.width/2:o==t.datavisualization.TreeMap.Position.TopRight?e=n.width-i.width-e:o==t.datavisualization.TreeMap.Position.CenterLeft?f=n.height/2-i.height/2:o==t.datavisualization.TreeMap.Position.Center||o==null?(e=n.width/2-i.width/2,f=n.height/2-i.height/2):o==t.datavisualization.TreeMap.Position.CenterRight?(e=n.width-i.width-e,f=n.height/2-i.height/2):o==t.datavisualization.TreeMap.Position.BottomLeft?f=n.height-i.height-f:o==t.datavisualization.TreeMap.Position.BottomCenter?(e=n.width/2-i.width/2,f=n.height-i.height-f):o==t.datavisualization.TreeMap.Position.BottomRight&&(e=n.width-i.width-e,f=n.height-i.height-f),{x:n.left+e,y:n.top+f}},_generateTreeMapItems:function(t){var u,i,r;if(this._rootTreeMapItems=t,this._getTreeMapItemTemplate(t),t!=null){for(this._isLevelColors||this._setColorMappings(t,this.model),u=0;u<t.length;u++)i=t[u],r=i.rectangle,i.Data!=null&&i.Data.length>0&&(i.Data=i.Data[0]),i.Rectangle=r,n(r).css({"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"}),i.backgroundColor!=null?n(r).css("background-color",i.backgroundColor):n(r).css("background-color","#E5E5E5"),i.backgroundOpacity!=null&&n(r).css("opacity",i.backgroundOpacity),this._wireEventForTreeMapItem(i,r);this.model.rangeColorMapping.length==0&&this.uniColor()==null&&this._color()!=""?this._setDesaturationColor(t,this.model.desaturationColorMapping):this.model.PaletteColorMapping!=null&&this._setPaletteColor(t,this.model.PaletteColorMapping)}},browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_wireEventForTreeMapItem:function(t,i){browserInfo=this.model.browserInfo;isPointer=browserInfo.isMSPointerEnabled;isIE11Pointer=browserInfo.pointerEnabled;touchStartEvent=isPointer?isIE11Pointer?"pointerdown":"MSPointerDown":"touchstart mousedown";touchStopEvent=isPointer?isIE11Pointer?"pointerup":"MSPointerUp":"touchend mouseup";touchMoveEvent=isPointer?isIE11Pointer?"pointermove":"MSPointerMove":"touchmove mousemove";touchEnterEvent=isPointer?isIE11Pointer?"pointerenter":"MSPointerEnter":"touchenter mouseenter";touchCancelEvent=isPointer?isIE11Pointer?"pointerleave":"MSPointerOut":"touchleave mouseleave";this._on(n(i),touchMoveEvent,{Param1:t,Param2:this},this._rectMouseMove);this._on(n(i),touchCancelEvent,{treeMap:this},this._rectMouseLeave);this._on(n(i),touchStopEvent,{Param1:t,Param2:this},this._rectMouseUp);this._on(n(i),touchStartEvent,{treeMap:this},this._rectMouseDown);this._on(n(i),touchEnterEvent,{Param1:t,Param2:this},this._rectMouseEnter)},_getTreeMapItemTemplate:function(i){for(var r,e,o,s,f="",u=0;u<i.length;u++)r=i[u],this.model.leafItemSettings.itemTemplate==null?f+='<div style="border-style:solid;position:absolute;left:'+r.LeftPosition+"px;top:"+r.TopPosition+"px;height:"+r.ItemHeight+"px;width:"+r.ItemWidth+"px;border-width:"+this.borderThickness()+"px;border-color:"+this.borderBrush()+'"><\/div>':(e=n("#"+this.model.leafItemSettings.itemTemplate),r.Data!=null&&r.Data.length==1&&(r.Data=r.Data[0]),o=n.templates(e.html()),s="<div style='overflow:hidden;position:absolute;left:"+r.LeftPosition+"px;top:"+r.TopPosition+"px;height:"+r.ItemHeight+"px;width:"+r.ItemWidth+"px'>"+o.render(r)+"<\/div>",f+=s);this._svgDocument!=null&&this.enableDrillDown()&&(this._svgDocument[0].innerHTML="");this._svgDocument=n('<div style= "overflow:hidden;z-index:1;"id="svgDocument">'+f+"<\/div>");this._backgroundTile.appendTo(this.element);this._svgDocument.appendTo(this.element);this._svgDocument.css({height:this._height+"px",width:this._width+"px","margin-top":this._margintop+"px","margin-left":this._marginleft,overflow:"hidden","z-index":1,position:"absolute",left:"0",top:"0"});n(this._backgroundTile).css({height:this._height+"px",width:this._width+"px","margin-top":this._margintop+"px","margin-left":this._marginleft,overflow:"hidden","z-index":0,position:"absolute",left:"0",top:"0"});this._templateDiv.appendTo(this.element);n(this._templateDiv).mousemove({Param2:this},this._rectMouseMove);var h=this.model.browserInfo,c=h.isMSPointerEnabled,l=h.pointerEnabled,a=c?l?"pointerdown":"MSPointerDown":"touchstart mousedown",v=c?l?"pointerup":"MSPointerUp":"touchend mouseup";for(this._on(n(this.element),a,{treemap:this,Param1:i},this.rectClick),this._on(n(this.element),v,{treemap:this,Param1:i},this._docClickFunction),this._on(n(this.element),t.eventType.mouseDown,{treemap:this},this.dragDown),this._on(n(this.element),t.eventType.mouseMove,{treemap:this},this.dragMove),this._on(n(this.element),t.eventType.mouseUp,{treemap:this},this.dragUp),this.enableDrillDown()&&(this._drillHeaderDiv.appendTo(this.element),this._drillHoverDiv.appendTo(this.element)),u=0;u<i.length;u++)i[u].rectangle=this._svgDocument[0].childNodes[u]},selectItem:function(t){var r,i,u,f;if(this._rootTreeMapItems!=null)for(r=0;r<this._rootTreeMapItems.length;r++)i=this._rootTreeMapItems[r],u=i.rectangle,i.Data!=null&&i.Data.length>0&&(i.Data=i.Data[0]),t==i.Data&&this.highlightOnSelection()&&(n(u).css({"border-width":this.highlightBorderThickness(),"border-color":this.highlightBorderBrush()}),this._browser!="msie"&&(f=this._svgDocument[0].children[this._svgDocument[0].children.length-1],this._svgDocument[0].insertBefore(u,f)),this._prevSelectedItems.push(u),this._trigger("treeMapItemSelected",{selectedItems:t,originalEvent:event}))},_selectTreemapItem:function(t){var r,i,u,f;if(this._rootTreeMapItems!=null)for(r=0;r<this._rootTreeMapItems.length;r++)i=this._rootTreeMapItems[r],u=i.rectangle,i.Data!=null&&i.Data.length>0&&(i.Data=i.Data[0]),t!=i.Data||this._contains(this.selectedItems,t)||this.highlightOnSelection()&&(n(u).css({"border-width":this.highlightBorderThickness(),"border-color":this.highlightBorderBrush()}),this._browser!="msie"&&(f=this._svgDocument[0].children[this._svgDocument[0].children.length-1],this._svgDocument[0].insertBefore(u,f)),this._prevSelectedItems=[],this.selectedItems=[],this._prevSelectedItems.push(u),this.selectedItems.push(t))},_selectItemResize:function(){for(var n,i,t=0;t<this._rootTreeMapItems.length;t++)n=this._rootTreeMapItems[t],i=n.rectangle,n.Data!=null&&n.Data.length>0&&(n.Data=n.Data[0]),this._contains(this.selectedItems,n.Data)&&this.selectItem(n.Data)},_updateLegendRange:function(n,t){for(var o,i,s,c,e,f,h,a,l=this.model.rangeColorMapping,u=0;u<l.length;u++)if(o=null,i=l[u],this.model.enableGradient&&(o=this._generateGradientCollection(i.gradientColors)),n>=i.from&&n<=i.to)for(s=u,u!=0&&(s=u*10),c=i.from,e=i.from+(i.to-i.from)/10,f=s;f<s+10;f++){if(n>=c&&n<=e)return h={},a=this._getColorRatio(.7,1,n,i.from,i.to),this._legendRects[f]!=r&&(h=this._legendRects[f]),t.backgroundColor=this.model.enableGradient?u!=0?o[f-u*10]:o[f]:i.color,t.backgroundOpacity=a,h.color=t.backgroundColor,h;c=e;e=e+(i.to-i.from)/10}},selectItemByPath:function(n,t,i){for(var e,c,l,s,f,o=n.split(i),a=t.split(i),n,t,u=this._rootTreeMapItems,r=0;r<o.length;r++){var n=o[r],t=a[r],h=[];for(e=0;e<u.length;e++){for(f=u[e],c=f.Data,s=0;s<o.length;s++)l=this._reflection(c,n);t==l&&h.push(f)}u=h}for(r=0;r<u.length;r++)f=u[r],this.selectItem(f.Data)},_getColorRatio:function(n,t,i,r,u){var f=100/(u-r)*(i-r);return(parseFloat(t)-parseFloat(n))/100*f+parseFloat(n)},_contains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i]===t)return!0;return!1},_rectMouseEnter:function(i){var u=i.data.Param2,h=u.model.legendSettings,y=i.data.Param1.Data,f,c,l,e,s,p,w,b,o,k,a,v,d,g,nt;if(y!=null&&(f=i.data.Param2._toolTipElement,c=i.data.Param2.model.tooltipTemplate,f!=null&&c!=null)){if(u.isTouch(i)||n(f).css({left:i.pageX+10,top:i.pageY+10,display:"block"}),l=this.model.locale,e=n.extend({},y),l&&this.model.enableGroupSeparator)for(s in e)e[s]=isNaN(parseFloat(e[s]))?e[s]:parseFloat(e[s]).toLocaleString(l);p=n("#"+c).render(e);n(f).html(p);w=f[0]!=null?f[0].clientHeight:f.clientHeight;b=f[0]!=null?f[0].clientWidth:f.clientWidth;i.data.Param2._tooltipSize={height:w,width:b}}if(h!=null&&h.mode==t.datavisualization.TreeMap.LegendMode.Interactive&&u.model.rangeColorMapping!=null&&(u.showLegend()==r||u.showLegend()))for(o=0;o<u._rootTreeMapItems.length;o++)if(k=u._rootTreeMapItems[o].Rectangle,k==i.target&&(a=null,u.model.rangeColorMapping!=r&&(a=u.model.rangeColorMapping),v=h.width,h.width==r&&(v=150),d=v/a.length/10,u._rootTreeMapItems[o].legendrect!=null)){g=u._rootTreeMapItems[o].legendrect.marginLeft;nt=g+Math.ceil(d)-u._interactiveArrow.width()/2;n(u._interactiveArrow).css({"margin-left":nt,display:"block"});break}},displayTooltip:function(t){var u=t.data.Param2,f=u._toolTipElement,i=u.mousePosition(t),a=!0,h,o,c,v,y,p,s,e,l;if(u.model.trackerElement&&(clearTimeout(u.model.timer),n(".tooltipelement"+this._id).finish()),t.data.Param1==r&&f!=null){for(e=0;e<u._rootTreeMapItems.length;e++)if(o=u._rootTreeMapItems[e],o.rectangle.offsetLeft<i.offsetX&&o.rectangle.offsetLeft+o.rectangle.offsetWidth>i.offsetX&&o.rectangle.offsetTop<i.offsetY&&o.rectangle.offsetTop+o.rectangle.offsetHeight>i.offsetY){h=o.Data;break}h!=null?(c=t.data.Param2.model.tooltipTemplate,f!=null&&c!=null&&(n(f).css({left:i.pageX+10,top:i.pageY+10,display:"block"}),v=n("#"+c).render(h),n(f).html(v),y=f[0]!=null?f[0].clientHeight:f.clientHeight,p=f[0]!=null?f[0].clientWidth:f.clientWidth,u._tooltipSize={height:y,width:p})):f!=null&&(a=!1,n(f).css("display","none"))}if(a){if(s=u._tooltipSize,s.width+i.pageX>=u._width&&(i.pageX-=s.width,i.pageX<0&&(i.pageX=10)),s.height+i.pageY>=u._height&&(i.pageY-=s.height,i.pageY<0&&(i.pageY=10)),u.enableDrillDown()&&u._browser!="msie")for(e=0;e<u._drillHoverDiv[0].children.length;e++)l=u._drillHoverDiv[0].children[e],l.className==t.data.Param1.ParentHeader&&n(l).css({display:"block"});f!=null&&n(f).css({left:i.pageX+10,top:i.pageY+10,display:"block"})}},_rectMouseUp:function(n){this.isTouch(n)&&this.displayTooltip(n)},_rectMouseMove:function(n){n.data.Param2.isTouch(n)||n.data.Param2.displayTooltip(n)},_rectMouseLeave:function(t){var i=t.data.treeMap._toolTipElement;i==null||t.data.treeMap.isTouch(t)||n(i).css("display","none")},_setColorMappings:function(n,i,r){for(var e,o,f=this,s=this.model.legendSettings,u=0;u<n.length;u++)r||(e=n[u].Data instanceof Array?f._reflection(n[u].Data[0],this.colorValuePath()):f._reflection(n[u].Data,this.colorValuePath())),i.rangeColorMapping!=null&&i.rangeColorMapping.length>0||i.uniColorMapping!=null&&(i.uniColorMapping.color!=null||this.uniColor()!=null)?s.mode==t.datavisualization.TreeMap.LegendMode.Interactive||this.model.enableGradient?n[u].legendrect=this._updateLegendRange(e,n[u]):(o=n[u]._generateColorMappings(i,this),n[u].backgroundColor=o):i.desaturationColorMapping!=null&&(i.desaturationColorMapping.color!=""||this._color()!="")?this._setDesaturationColor(n,i.desaturationColorMapping):i.paletteColorMapping!=null&&this._setPaletteColor(n,i.paletteColorMapping)},_setDesaturationColor:function(n,t){var e,c,u,l,r;n=n.sort(this._orderBycolorWeight);var i=typeof t.from=="number"?t.from:this._from(),f=typeof t.to=="number"?t.to:this._to(),s=typeof t.rangeMinimum=="number"?t.rangeMinimum:this._rangeMinimum(),h=typeof t.rangeMaximum=="number"?t.rangeMaximum:this._rangeMaximum(),o=[];for(e=0;e<n.length;e++)c=n[e].Data[0],u=this._reflection(c,this.colorValuePath()),u!=null&&typeof u!="number"&&(u=Number(u.replace(/[^0-9\.]+/g,""))),o.push(u);for(this._rangeMinimum()==0&&(s=Math.min.apply(Math,o)),this._rangeMaximum()==0&&(h=Math.max.apply(Math,o)),(i<0||i>1)&&(i=1),(f>1||f<0)&&(f=0),l=(i-f)/n.length,r=0;r<n.length;r++)n[r].backgroundColor=typeof t.color=="string"?t.color:this._color(),n[r].colorWeight>=s&&n[r].colorWeight<=h&&(n[r].backgroundOpacity=i,i=i-l)},_generateGradientCollection:function(n){for(var f=[],r=n[0],u=n[n.length-1],e=this._hexToR(r),o=this._hexToG(r),s=this._hexToB(r),h=this._hexToR(u),c=this._hexToG(u),l=this._hexToB(u),i=10,a=this._getRangeColorValues(i,e,h),v=this._getRangeColorValues(i,o,c),y=this._getRangeColorValues(i,s,l),t=0;t<i;t++)f.push(this._rgbToHex(a[t],v[t],y[t]));return f},_hexToR:function(n){return parseInt(this._cropHex(n).substring(0,2),16)},_hexToG:function(n){return parseInt(this._cropHex(n).substring(2,4),16)},_hexToB:function(n){return parseInt(this._cropHex(n).substring(4,6),16)},_cropHex:function(n){return n.charAt(0)=="#"?n.substring(1,7):n},_rgbToHex:function(n,t,i){return"#"+this._toHex(n)+this._toHex(t)+this._toHex(i)},_toHex:function(n){var t="0123456789ABCDEF";return(n=parseInt(n,10),isNaN(n))?"00":(n=Math.max(0,Math.min(n,255)),t.charAt((n-n%16)/16)+t.charAt(n%16))},_getRangeColorValues:function(n,t,i){var u=[],f,r;if(u.push(t),t>i)for(f=(t-i)/(n-1),r=n;r>2;r--)t=t-f,u.push(t);else for(f=(i-t)/(n-1),r=2;r<n;r++)t=t+f,u.push(t+f);return u.push(i),u},_isSVG:function(){return window.SVGSVGElement?!0:!1},_drawInteractiveLegend:function(){var i=this.model.legendSettings,u=0,h=0,f=this._legenddiv,w=this.model.legendSettings.height!=0?this.model.legendSettings.height:30,c=this.model.legendSettings.width!=0?this.model.legendSettings.width:100,it,ht,k,rt,a,l,b,e,v,d,et,ct,ot,g,s,tt,o;if(i.mode==t.datavisualization.TreeMap.LegendMode.Interactive||this.model.rangeColorMapping!=null){for(o="",i.height==0&&(w=30),i.width==0&&(c=100),i.leftLabel==null&&(i.leftLabel=""),i.title!=null&&(it=u,i.showLabels||(it=u+i.leftLabel.length*10),ht=i.title.length*10,k=titleText=i.title,ht>c&&(k=this._trimFunction(k,c)),o=this._createLabel(k,it,h,"e-interactivelegend-title"),o[0].title=titleText,o.css({width:c+"px"}),this._isSVG()?o.appendTo(f):f.append(o),h+=25),i.showLabels&&(h+=25),i.leftLabel==null||i.showLabels||(o=this._createLabel(i.leftLabel,u,h-3,"e-interactivelegend-leftlabel"),this._isSVG()?o.appendTo(f):f.append(o),u=u+i.leftLabel.length*10),rt=this._createInteractiveArrow(u,h+w),rt.appendTo(f),this._interactiveArrow=rt,a=null,!this._isSVG()&&this.model.enableGradient&&(a=this._createGroup(!1,"legendGroup"),a.style.left="0px",a.style.top="0px",a.style.position="relative",f.append(a)),l=this.model.rangeColorMapping,b=0;b<l.length;b++)if(e=l[b],!e.hideLegend){if(v=[],this.model.enableGradient&&(v=this._generateGradientCollection(e.gradientColors)),d={},this.model.enableGradient)if(this._isSVG()){var ut=n("<canvas/>"),ft=ut[0].getContext("2d"),y=ft.createLinearGradient(0,0,300,0),p=0;for(s=0;s<10;s++)p=p+1/10,s==0?(y.addColorStop(0,e.gradientColors[0]),y.addColorStop(p,v[s])):s==v.length-1?(y.addColorStop(p-1/10,v[s]),y.addColorStop(p,e.gradientColors[1])):(y.addColorStop(p-1/10,v[s]),y.addColorStop(p,v[s+1]));ft.fillStyle=y;ft.fillRect(0,0,300,300);ut.css({height:w+"px",width:c/l.length+"px","margin-left":u+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"});ut.appendTo(f)}else et="legend"+b,ct="<v:rect id="+et+' display="block" style="position:absolute;top: '+(h-2)+"px;left:"+u+"px;width:"+c/l.length+"px;height:"+w+'px;"><v:fill opacity="0.9px" type="gradient" method="linear sigma" angle="270"/><v:stroke opacity="0px"/><\/v:rect>',a.innerHTML=a.innerHTML+ct,ot=document.getElementById(et),ot.fillcolor=e.gradientColors[0],ot.fill.color2=e.gradientColors[1];else g=n("<div/>"),g.css({height:w+"px",width:c/this.model.rangeColorMapping.length+"px","background-color":e.color,"margin-left":u+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"}),this._isSVG()?g.appendTo(f):f.append(g);for(s=0;s<10;s++)d={},d.marginLeft=u,this._legendRects.push(d),u=u+c/l.length/10;if(this.model.legendSettings.showLabels){var nt=u-c/l.length,st=h-25,lt=this._createLabel(e.from,nt,st,"e-legend-rangestartlabel");nt=xpos;tt=this._createLabel(e.to,nt,st);e.legendLabel!=r&&(tt=this._createLabel(e.legendLabel,nt-e.legendLabel.length*5,st,"e-legend-rangeendlabel"));this._isSVG()?(e==l[0]&<.appendTo(f),tt.appendTo(f)):(e==l[0]&&f.append(lt),f.append(tt))}}i.rightLabel==null||i.showLabels||(o=this._createLabel(i.rightLabel,u+10,h-3,"e-interactivelegend-rightlabel"),this._isSVG()?o.appendTo(f):f.append(o),u=u+i.rightLabel.length*10);totalwidth=u+10;totalheight=h+w+this._interactiveArrow.height();this._legendSize={width:totalwidth,height:totalheight};i.dockPosition=="left"?this._marginleft=totalwidth:i.dockPosition=="top"&&(this._margintop=totalheight)}},_trimFunction:function(t,i){var r=n('<div style="width:auto;position:absolute;" class= "e-interactivelegend-title">'+t+"<\/div>"),u;for(n(document.body).append(r),u=t;r.width()>i;)u=u.slice(0,-2),r.text(u+"...");return document.body.removeChild(r[0]),r.text()},_createLabel:function(t,i,r,u){var f=n("<div class="+u+"><\/div>");return f[0].innerHTML=t,f.css({"margin-left":i+"px","margin-top":r+"px",position:"absolute"}),f},_createInteractiveArrow:function(t,i){var r=n("<div class='e-icon1 e-interactiveArrow'><\/div>");return r[0].innerHTML="▲",r.css({"margin-left":t+"px","margin-top":i+"px",position:"absolute"}),r},_createGroup:function(n,t){var i;return i=document.createElement("<v:group class="+t+">"),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,n&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_setPaletteColor:function(n,t){n=n.sort(this._orderBycolorWeight);for(var i=0;i<n.length;i++)t.colors!=null&&t.colors.length>0&&(n[i].backgroundColor=t.colors[i%t.colors.length])},_orderBycolorWeight:function(n,t){return n.colorWeight==t.colorWeight?0:n.colorWeight<t.colorWeight?1:-1},_orderByAreaWight:function(n,t){return n.AreaByWeight==t.AreaByWeight?0:n.AreaByWeight<t.AreaByWeight?1:-1},_calculateSliceAndDiceItemSize:function(n,t,i,u,f,e,o,s,h){var a,g,l,p,nt,b,v,tt,d,c,k,y;e==""&&(e=0);a=e;g=this._getTotalWeight(n);s==r&&(s=u>f?!0:!1);l={Width:u,Height:f-h};p=o<l.Height?o:0;l.Height=l.Height-p;var rt={X:t,Y:i+p,Width:l.Width,Height:l.Height},it=l.Height*l.Width,w=n.length;if(s)for(nt=l.Height,b=0,c=0;c<w;c++)k=it/g*n[c].weight,v=k/nt,e=v>a?a:0,b<=l.Width&&(n[c].ItemWidth=c!=w-1?v-parseFloat(e):v,n[c].ItemHeight=nt,n[c].LeftPosition=b+t,n[c].TopPosition=i+o,b+=v);else for(tt=l.Width,d=0,c=0;c<w;c++)k=it/g*n[c].weight,y=k/tt,e=y>a?a:0,d<=l.Height&&(n[c].ItemWidth=tt,n[c].ItemHeight=c!=w-1?y-parseFloat(e):y,n[c].LeftPosition=t,n[c].TopPosition=d+i+p,d+=y)},_calculateSquarifiedItemSize:function(n,t,i,r,u,f,e,o){var a,tt,it,s,v,y,l,g,c;f==""&&(f=0);var rt=this._getTotalWeight(n),p={Width:r,Height:u-o},nt=e<p.Height?e:0;for(p.Height=p.Height-nt,a=n.length-1;a>=0;a--)l=n[a],l.AreaByWeight=p.Height*p.Width*l.weight/rt,l.headerTopPosition=i;var h={X:t,Y:i+nt,Width:p.Width,Height:p.Height},b=n.sort(this._orderByAreaWight),k=0,d=0,w=0;for(a=0;a<n.length;a=w)for(tt=b[a],weightObject=this._getGroupTotalWeight(tt,b,h,a),it=weightObject.totalWeight,w=weightObject.index,s={},v=h.Width>h.Height?!0:!1,y=a;y<w;y++)l=b[y],g=it,y==a&&(s.X=h.X,s.Y=h.Y,v?(s.Width=g/h.Height,s.Height=h.Height,h.X+=s.Width,h.Width=Math.max(0,h.Width-s.Width)):(s.Width=h.Width,s.Height=g/h.Width,h.Y+=s.Height,h.Height=Math.max(0,h.Height-s.Height)),k=s.X,d=s.Y),c={},b.indexOf(l)!=b.length-1?(c.X=0,c.Y=0,c.Width=v?s.Width-parseFloat(f):l.AreaByWeight/s.Height,c.Height=v?l.AreaByWeight/s.Width:s.Height-parseFloat(f),w-y!=1&&(v?c.Height-=parseFloat(f):c.Width-=parseFloat(f))):(c.Width=v?s.Width:l.AreaByWeight/s.Height,c.Height=v?l.AreaByWeight/s.Width:s.Height),l.ItemWidth=c.Width,l.ItemHeight=c.Height,l.LeftPosition=k,l.TopPosition=d,v?d+=w-y!=1?c.Height+parseFloat(f):c.Height:k+=w-y!=1?c.Width+parseFloat(f):c.Width},_getGroupTotalWeight:function(n,t,i,r){for(var f=0,o=0,s,e,h;r<t.length;r++){s=this._getShortersideLength(i.Width,i.Height);e=t[r];f+=e.AreaByWeight;var u=f/s,c=n.AreaByWeight/u,l=e.AreaByWeight/u;if(r==0&&(o=this._aspectRatio(u,s)),h=Math.max(this._aspectRatio(c,u),this._aspectRatio(l,u)),f==e.AreaByWeight||h<o)o=h;else{f-=e.AreaByWeight;u=f/s;o=Math.max(this._aspectRatio(c,u),this._aspectRatio(l,u));break}}return{totalWeight:f,index:r}},_aspectRatio:function(n,t){return n>t?n/t:t/n},_getShortersideLength:function(n,t){return n>t?t:n},_getTotalWeight:function(n){for(var i=0,t=0;t<n.length;t++)i+=parseFloat(n[t].weight);return i},_getGroupitem:function(t,i,r,u){var a=[],y,h,v,e,l,o,s,d;if(u&&(i=i[0][u]),t==null&&(t=this.labelPath()||this.weightValuePath()),i!=null&&this.weightValuePath()!=null){for(h in i)e=i[h],(e!=null&&e.hasOwnProperty(t)?!0:this._containsProperty(e,t))&&(l=this._reflection(e,t),n.inArray(l,a)==-1&&a.push(l));for(y=[],h=0;h<a.length;h++){var c={},w=[],b=a[h],k=0,p=0,g=0;for(v=0;v<i.length;v++)e=i[v],l=this._reflection(e,t),l==b&&(o=this._reflection(e,this.weightValuePath()),o!=null&&typeof o!="number"&&(o=Number(o.replace(/[^0-9\.]+/g,""))),o<0&&(o=-1*o),s=this._reflection(e,this.colorValuePath()),s!=null&&typeof s!="number"&&(s=Number(s.replace(/[^0-9\.]+/g,""))),w.push(e),g++,o!=null&&(p+=parseFloat(o)),s!=null&&(k+=parseFloat(s)));c.header=b;c.data=w;c.weight=p;c.colorWeight=k;c.headerHeight=r;p>0&&(d=new f(c),y.push(d))}return y}return null},_getTopGroupitem:function(n,t){var s,r,y,h,p;n==null&&(n=this.labelPath());n==null&&(n=this.weightValuePath());var u={},c=0,l=0,a=[],v=[];for(s=0;s<t.length;s++){var e=t[s],w=this._reflection(e,n),o={},i=this._reflection(e,this.weightValuePath());i!=null&&typeof i!="number"&&(i=Number(i.replace(/[^0-9\.]+/g,"")));i<0&&(i=-1*i);r=this._reflection(e,this.colorValuePath());r!=null&&typeof r!="number"&&(r=Number(r.replace(/[^0-9\.]+/g,"")));i!=null&&(c+=parseFloat(i));r!=null&&(l+=parseFloat(r));v.push(e);o.weight=i;o.data=e;o.header=w;o.colorWeight=r;y=new f(o);a.push(y)}return u.header="",u.data=v,u.weight=c,u.innerItem=a,u.colorWeight=l,h=[],p=new f(u),h.push(p),h},_containsProperty:function(n,t){for(var i in n)if(i==t)return!0;return!1},_reflection:function(t,i){var r=t,u,f,e;if(i!=null&&t!=null){for(u=i.split("."),u.push(i),f=0;f<u.length;f++)r!=null&&(e=r.hasOwnProperty(u[f])?!0:this._containsProperty(r,u[f]),e&&n.each(r,function(n,t){if(n==u[f])return r=t,!1}));return r}return null}});u=function(){this.groupBackground=null;this.groupBorderColor=null;this.groupBorderThickness=1;this.groupPadding=4;this.groupPath=null;this.groupGap=1;this.headerHeight=20;this.showHeader=!0;this.showLabels=!1;this.headerTemplate=null;this.labelTemplate=null;this.labelPosition="center";labelVisibilityMode="visible";headerVisibilityMode="visible";this.treeMapItems=[]};u.prototype={};var e=function(){this.groupID=null;this.rangeColorMapping=[];this.desaturationColorMapping={from:0,to:0,color:"",rangeMinimum:0,rangeMaximum:0};this.uniColorMapping={color:null};this.paletteColorMapping={colors:[]}},o=function(){this.from=-1;this.to=-1;this.legendlabel=null;this.color=null},f=function(n){this.weight=n.weight;this.colorWeight=n.colorWeight;this.Data=n.data;this.headerHeight=n.headerHeight;this.header=n.header;this.label=n.header;this.headerLeftPosition=0;this.headerTopPosition=0;this.innerItems=n.innerItem;this.headerWidth=0;this.headerTemplate=null};f.prototype={_generateColorMappings:function(n,t){return n.rangeColorMapping!=null&&n.rangeColorMapping.length>0?this._getRangeBrushColor(n.rangeColorMapping):t.uniColor()!=null&&n.uniColorMapping!=null?t.uniColor():n.uniColorMapping.color!=null&&n.uniColorMapping!=null?this._getUniColor(n.uniColorMapping):void 0},_getUniColor:function(n){return n.color},_getRangeBrushColor:function(n){for(var i,t=0;t<n.length;t++)if(i=n[t],this.colorWeight>=i.from&&this.colorWeight<=i.to)return i.color}};t.datavisualization.TreeMap.selectionMode={Default:"default",Multiple:"multiple"};t.datavisualization.TreeMap.groupSelectionMode={Default:"default",Multiple:"multiple"};t.datavisualization.TreeMap.ItemsLayoutMode={Squarified:"squarified",SliceAndDiceHorizontal:"sliceanddicehorizontal",SliceAndDiceVertical:"sliceanddicevertical",SliceAndDiceAuto:"sliceanddiceauto"};t.datavisualization.TreeMap.DockPosition={Top:"top",Bottom:"bottom",Right:"right",Left:"left"};t.datavisualization.TreeMap.LegendMode={Default:"default",Interactive:"interactive"};t.datavisualization.TreeMap.Position={TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",CenterLeft:"centerleft",Center:"center",CenterRight:"centerright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};t.datavisualization.TreeMap.Alignment={Near:"near",Center:"center",Far:"far"};t.datavisualization.TreeMap.VisibilityMode={Visible:"visible",HideOnExceededLength:"hideonexceededlength"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejBarcode","ej.datavisualization.Barcode",{element:{target:null},model:null,validTags:["div","span"],_rootCSS:"e-barcode",defaults:{displayText:!0,text:"",height:"",width:"",symbologyType:"qrbarcode",textColor:"black",lightBarColor:"white",darkBarColor:"black",quietZone:{left:1,top:1,right:1,bottom:1,all:1},narrowBarWidth:1,wideBarWidth:3,barHeight:150,barcodeToTextGapHeight:10,xDimension:4,encodeStartStopSymbol:!0,load:null,enabled:!0},dataTypes:{displayText:"boolean",text:"string",enabled:"boolean",symbologyType:"enum",narrowBarWidth:"number",wideBarWidth:"number",barHeight:"number",encodeStartStopSymbol:"boolean"},_defaultScaleValues:function(){return{enabled:!0,displayText:!0,text:"",symbologyType:"qrbarcode",textColor:"black",lightBarColor:"white",darkBarColor:"black",quietZone:{left:1,top:1,right:1,bottom:1},narrowBarWidth:1,wideBarWidth:3,barHeight:150,barcodeToTextGapHeight:10,xDimension:4,encodeStartStopSymbol:!0}},_init:function(){this._initialize();this._renderBarcode()},_destroy:function(){this.element.empty()},_setModel:function(n){for(var t in n)switch(t){case"enabled":this._disabled(!n[t]);break;case"height":this.model.height=n[t];break;case"width":this.model.width=n[t];break;case"lightBarColor":this.model.lightBarColor=n[t];break;case"darkBarColor":this.model.darkBarColor=n[t];break;case"textColor":this.model.textColor=n[t];break;case"displayText":this.model.displayText=n[t];break;case"quietZone":this.model.quietZone=n[t];break;case"narrowBarWidth":this.model.narrowBarWidth=n[t];break;case"wideBarWidth":this.model.wideBarWidth=n[t];break;case"barHeight":this.model.barHeight=n[t];break;case"xDimension":this.model.xDimension=n[t];break;case"encodeStartStopSymbol":this.model.encodeStartStopSymbol=n[t];break;case"symbologyType":this.model.symbologyType=n[t];this._itemInitialize();break;case"text":this.model.text=n[t];this._itemInitialize()}this._renderBarcode()},_initialize:function(){this.BarcodeEl=this.element;this.target=this.element[0];this._itemInitialize();this.Model=this.model},_renderBarcode:function(){this.initialize()},_itemInitialize:function(){var t=this;this.model.scales!=null?n.each(this.model.scales,function(i,r){r=t._checkArrayObject(r,i);var u=t._defaultScaleValues();n.extend(u,r);n.extend(r,u)}):this.model.scales=[this._defaultScaleValues()]},_checkArrayObject:function(t,i){var r=this;return n.each(t,function(n,t){if(t instanceof Array)t=r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var u=r._defaultScaleValues();t=r._LoadIndividualDefaultValues(t,u,typeof n=="number"?i:n)}}),t},_LoadIndividualDefaultValues:function(t,i,r){var u=null,f=this;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),n.each(t,function(n,t){t instanceof Array?t=f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&(t=f._LoadIndividualDefaultValues(t,u,typeof n=="number"?r:n))}),n.extend(u,t),n.extend(t,u),t},initialize:function(){this.model.enabled&&(this._initObject(this),this.Model.text!=null&&this._findBarcodeType())},enable:function(){this.model.enabled||(this.element.removeClass("e-disable"),this.model.enabled=!0)},height:function(n){this.Model.height=n},width:function(n){this.Model.width=n},resize:function(){this.Model.text!=null&&this._findBarcodeType()},disable:function(){this.model.enabled&&(this.element.addClass("e-disable"),this.model.enabled=!1)},_disabled:function(n){n?this.disable():this.enable()},_initObject:function(t){t.BarcodeEl=n("#"+t.target.id);t.canvasEl?t.canvasEl.remove():t.canvasEl=n("<canvas><\/canvas>");t.BarcodeEl.append(t.canvasEl);t.BarcodeEl.css("width",t.model.width);t.BarcodeEl.css("height",t.model.height);t.canvasEl[0].setAttribute("width",t.BarcodeEl.width());t.canvasEl[0].setAttribute("height",t.BarcodeEl.height());t.centerX=t.canvasEl[0].width/2;t.centerY=t.canvasEl[0].height/2;var r=t.canvasEl[0];(typeof G_vmlCanvasManager!="undefined"&&(r=window.G_vmlCanvasManager.initElement(r)),r&&r.getContext)&&(t.contextEl=t.canvasEl[0].getContext("2d"),t.contextEl==i)},_findBarcodeType:function(){var y,p,c,o,n,v,s,h,u,l,r,f,e,a,w,b;if(this.contextEl!=i&&this.Model.text!=""){if(this.textFont={size:"12px",fontFamily:"Segoe UI",fontStyle:"Regular"},this.model.quietZone.all>1&&(this.model.quietZone.left=this.model.quietZone.right=this.model.quietZone.top=this.model.quietZone.bottom=this.model.quietZone.all),intercharacterGap=1,extendedText="",continuous=!1,validatorExp="",encodedText=this.Model.text,n=this.Model.symbologyType,v=!0,t.datavisualization.Barcode.SymbologyType.dataMatrix==n||t.datavisualization.Barcode.SymbologyType.qrBarcode==n)v=!1;else if(y=t.datavisualization.Barcode.symbologySettings[n].startSymbol,p=t.datavisualization.Barcode.symbologySettings[n].stopSymbol,validatorExp=t.datavisualization.Barcode.symbologySettings[n].validatorExp,c=t.datavisualization.Barcode.symbologySettings[n].symbolTable,o=t.datavisualization.Barcode.symbologySettings[n].extendedCodes,encodedText=this._calculateCheckDigit(encodedText,c,n),t.datavisualization.Barcode.SymbologyType.code39Extended==n){for(s=encodedText.split(""),h="",u=0;u<s.length;u++)for(l=s[u],r=0;r<o.length;r++)if(o[r][0]==l&&(f=o[r][1],!(f==i)))for(e=0;e<f.length;e++)h+=f[e];extendedText=h}else if(t.datavisualization.Barcode.SymbologyType.code93Extended==n){for(s=encodedText.split(""),h="",u=0;u<s.length;u++)for(l=s[u],r=0;r<o.length;r++)if(o[r][0]==l&&(f=o[r][1],!(f==i)))for(e=0;e<f.length;e++)h+=f[e];extendedText=h}if(v){if(!this._validateText(this.Model.text,validatorExp)){console.log("Barcode Text contains characters that are not accepted by this barcode specification.");return}if(this.model.symbologyType=="code32"&&this.model.text.length!=8){console.log("Barcode Text Length that are not accepted by this barcode specification.");return}extendedText.length>0&&(encodedText=extendedText);this.Model.encodeStartStopSymbol&&(encodedText=y.toString()+encodedText+p.toString());a=this._getCharWidth(encodedText,c);a-=continuous==!1?intercharacterGap*encodedText.length:extendedText.length>0?intercharacterGap*(extendedText.length-this.Model.text.length):intercharacterGap;w=parseInt(this.Model.displayText?this.textFont.size.replace("px",""):0);b=this.Model.quietZone.top+this.Model.quietZone.bottom+this.Model.barHeight+intercharacterGap+(this.Model.displayText?w+this.Model.barcodeToTextGapHeight:0);a+=this.Model.quietZone.left+this.Model.quietZone.right;this._draw1DBarcode(encodedText,c,a)}else t.datavisualization.Barcode.SymbologyType.dataMatrix==n?this._buildDataMatrix():t.datavisualization.Barcode.SymbologyType.qrBarcode==n&&this._buildQRBarcode();this._raiseEvent("load")}},_calculateCheckDigit:function(n,t,i){var f,l,a,v,o,e,r,u;if(i=="code128b"){for(f=0,l=[n.split("")],r=0;r<n.split("").length;r++)a=l[0][r],v=this._findCheckDigit(a,t)[1],f+=v*(r+1);for(f+=104,f=f%103,o=[1],e=0;e<t.length;e++)e==f&&(o[0]=t[e][0]);n+=o.toString()}else if(i=="upcbarcode"){var l=[n.split("")],y=0,s=0;for(r=0;r<n.split("").length;r++)r<11&&(s=n[r],y+=r%2==0?s*3:s*1);var p=(10-y%10)%10,h=n.split(""),c=6;for(u=0;u<h.length;u++)u==6?c+="B"+h[u]:u!=11&&(c+=h[u]);n=c;n+=p;n+=6}return n},_findCheckDigit:function(n,t){for(var i=0;i<t.length;i++)if(t[i][0]==n)return t[i]},_raiseEvent:function(n){this.model[n]&&this._trigger(n)},_buildQRBarcode:function(){var t=this.Model.text,u,i,f,n,r,e,o,s,h;for(this.m_EciAssignmentNumber=3,this.mode="numeric",this.isEci=!1,this.m_Version=1,u=[14,26,42,62,84,106,122,152,180,213,251,287,331,362,412,450,504,560,624,666,711,779,857,911,997,1059,1125,1190,1264,1370,1452,1538,1628,1722,1809,1911,1989,2099,2213,2331],n=0;n<t.length;n++)if(i=t.charCodeAt(n),!(i<58)||!(i>47))if(i<91&&i>64||t[n]=="$"||t[n]=="%"||t[n]=="*"||t[n]=="+"||t[n]=="-"||t[n]=="."||t[n]=="/"||t[n]==":"||t[n]==" ")this.mode="alphanumeric";else if(i>=65377&&i<=65439||i>=97&&i<=122){this.mode="binary";break}else{this.mode="binary";this.isEci=!0;break}for(this.mode=="numeric"?u=[34,63,101,149,202,255,293,365,432,513,604,691,796,871,991,1082,1212,1346,1500,1600,1708,1872,2059,2188,2395,2544,2701,2857,3035,3289,3486,3693,3909,4134,4343,4588,4775,5039,5313,5596]:this.mode=="alphanumeric"&&(u=[20,38,61,90,122,154,178,221,262,311,366,419,483,528,600,656,734,816,909,970,1035,1134,1248,1326,1451,1542,1637,1732,1839,1994,2113,2238,2369,2506,2632,2780,2894,3054,3220,3391]),this.isEci==!0&&(this.m_EciAssignmentNumber=this._findECINumber(t)),n=0;n<u.length;n++)if(u[n]>t.length){this.m_Version=n+1;break}for(this.qrbarcodeValues={Version:this.m_Version,ErrorCorrectionLevel:1,NumberOfDataCodeWord:this._getNumberOfDataCodeWord(),NumberOfErrorCorrectingCodeWords:this._getNumberOfErrorCorrectingCodeWords(),NumberOfErrorCorrectionBlocks:this._getNumberOfErrorCorrectionBlocks(),End:this._getEnd(),DataCapacity:this._getDataCapacity(),FormatInformation:this._getFormatInformation(),VersionInformation:this._getVersionInformation()},this.noOfModules=(this.m_Version-1)*4+21,this.moduleValue=this._create2DArray(this.noOfModules,this.noOfModules),n=0;n<this.noOfModules;n++)for(r=0;r<this.noOfModules;r++)this.moduleValue[n][r]={IsBlack:!1,IsFilled:!1,IsPDP:!1};if(this._drawPDP(0,0),this._drawPDP(this.noOfModules-7,0),this._drawPDP(0,this.noOfModules-7),this._drawTimingPattern(),this.m_Version!=1)for(f=this._getAlignmentPatternCoOrdinates(),n=0;n<f.length;n++)for(r=0;r<f.length;r++)e=f[n],o=f[r],this.moduleValue[e][o].IsPDP!=!0&&this._drawAlignmentPattern(e,o);this._allocateFormatVersionInfo();this._encodeData();this._drawFormatInformation();this._addQuietZone();s=this.moduleValue.length*this.Model.xDimension;h=this.moduleValue[0].length*this.Model.xDimension;this.contextEl.beginPath();this.contextEl.fillStyle="white";this.contextEl.fillRect(0,0,s,h);this.contextEl.closePath();this._drawQRBarcode(h,s)},_allocateFormatVersionInfo:function(){for(var i,r,t,n=0;n<9;n++)this.moduleValue[8][n].IsFilled=!0,this.moduleValue[n][8].IsFilled=!0;for(n=this.noOfModules-8;n<this.noOfModules;n++)this.moduleValue[8][n].IsFilled=!0,this.moduleValue[n][8].IsFilled=!0;if(this.m_Version>6)for(i=this.qrbarcodeValues.VersionInformation,r=0,n=0;n<6;n++)for(t=2;t>=0;t--)this.moduleValue[n][this.noOfModules-9-t].IsBlack=i[r]==1?!0:!1,this.moduleValue[n][this.noOfModules-9-t].IsFilled=!0,this.moduleValue[this.noOfModules-9-t][n].IsBlack=i[r++]==1?!0:!1,this.moduleValue[this.noOfModules-9-t][n].IsFilled=!0},_drawTimingPattern:function(){for(var n=8;n<this.noOfModules-8;n+=2)this.moduleValue[n][6].IsBlack=!0,this.moduleValue[n][6].IsFilled=!0,this.moduleValue[n+1][6].IsBlack=!1,this.moduleValue[n+1][6].IsFilled=!0,this.moduleValue[6][n].IsBlack=!0,this.moduleValue[6][n].IsFilled=!0,this.moduleValue[6][n+1].IsBlack=!1,this.moduleValue[6][n+1].IsFilled=!0;this.moduleValue[this.noOfModules-8][8].IsBlack=!0;this.moduleValue[this.noOfModules-8][8].IsFilled=!0},_drawQRBarcode:function(n,t){var u=this.Model.quietZone.all,o,i,s,r,e;u<2&&(u=2);var f=parseInt(this.Model.xDimension);this.Model.height!=""&&this.Model.width!=""?(this.Model.height=this._getProperValue(this.Model.height),this.Model.width=this._getProperValue(this.Model.width)):(this.Model.height=n,this.Model.width=t,this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width),this.canvasEl[0].setAttribute("height",this.Model.height),this.BarcodeEl.css("height",this.Model.height));o=Math.min(this.Model.width,this.Model.height);o!=0&&(f=o/(this.noOfModules+2*u));var h=0,t=this.noOfModules+2*u,c=this.noOfModules+2*u;for(this.contextEl.beginPath(),i=0;i<t;i++){for(s=0,r=0;r<c;r++)e=null,e=this.moduleValue[i][r].IsBlack?this.model.darkBarColor:this.model.lightBarColor,this.dataAllocationValues[r][i].IsFilled&&this.dataAllocationValues[r][i].IsBlack&&(e="black"),this.contextEl.fillStyle=e,this.contextEl.fillRect(s,h,f,f),s+=f;h+=f}this.contextEl.closePath();this.contextEl.stroke()},_getProperValue:function(n){return n==""?"":typeof n=="string"?(n=n.replace("px",""),parseInt(n)):typeof n=="number"?n:0},_addQuietZone:function(){var n=this.Model.quietZone.all,t,i;n<2&&(n=2);var r=this.noOfModules+2*n,u=this.noOfModules+2*n,f=this._create2DArray(r,u),e=this._create2DArray(r,u);for(t=0;t<r;t++)for(i=0;i<u;i++)f[t][i]={IsBlack:!1,IsFilled:!1,IsPDP:!1},e[t][i]={IsBlack:!1,IsFilled:!1,IsPDP:!1};for(t=n;t<r-n;t++)for(i=n;i<u-n;i++)f[t][i]=this.moduleValue[t-n][i-n],e[t][i]=this.dataAllocationValues[t-n][i-n];this.moduleValue=f;this.dataAllocationValues=e},_drawFormatInformation:function(){for(var t=this.qrbarcodeValues.FormatInformation,i=0,n=0;n<7;n++)n==6?this.moduleValue[n+1][8].IsBlack=t[i]==1?!0:!1:this.moduleValue[n][8].IsBlack=t[i]==1?!0:!1,this.moduleValue[8][this.noOfModules-n-1].IsBlack=t[i++]==1?!0:!1;for(i=14,n=0;n<7;n++)n==6?this.moduleValue[8][n+1].IsBlack=t[i]==1?!0:!1:this.moduleValue[8][n].IsBlack=t[i]==1?!0:!1,this.moduleValue[this.noOfModules-n-1][8].IsBlack=t[i--]==1?!0:!1;this.moduleValue[8][8].IsBlack=t[7]==1?!0:!1;this.moduleValue[8][this.noOfModules-8].IsBlack=t[7]==1?!0:!1},_dataAllocationAndMasking:function(n){var r=this.noOfModules,u,t,i,f;for(this.dataAllocationValues=this._create2DArray(r,r),u=0,t=0;t<r;t++)for(i=0;i<r;i++)this.dataAllocationValues[t][i]={IsBlack:!1,IsFilled:!1,IsPDP:!1};for(t=r-1;t>=0;t-=2){for(i=r-1;i>=0;i--)u=this._allocateValues(n,t,i,u);for(t-=2,t==6&&t--,i=0;i<r;i++)u=this._allocateValues(n,t,i,u)}for(t=0;t<r;t++)for(i=0;i<r;i++)this.moduleValue[t][i].IsFilled||(f=this.dataAllocationValues[t][i].IsBlack,this.dataAllocationValues[t][i].IsBlack=f?!1:!0)},_allocateValues:function(n,t,i,r){return this.moduleValue[t][i].IsFilled&&this.moduleValue[t-1][i].IsFilled||(this.moduleValue[t][i].IsFilled||(r+1<n.length&&(this.dataAllocationValues[t][i].IsBlack=n[r++]),this.dataAllocationValues[t][i].IsBlack=(t+i)%3==0?this.dataAllocationValues[t][i].IsBlack?!0:!1:this.dataAllocationValues[t][i].IsBlack?!1:!0,this.dataAllocationValues[t][i].IsFilled=!0),this.moduleValue[t-1][i].IsFilled||(r+1<n.length&&(this.dataAllocationValues[t-1][i].IsBlack=n[r++]),this.dataAllocationValues[t-1][i].IsBlack=(t-1+i)%3==0?this.dataAllocationValues[t-1][i].IsBlack?!0:!1:this.dataAllocationValues[t-1][i].IsBlack?!1:!0,this.dataAllocationValues[t-1][i].IsFilled=!0)),r},_encodeData:function(){var t=[],i=-1,b,s,u,nt,p,a,f,e,l,k,d,g,tt,w,it,c,v,n,o,r;switch(this.mode){case"numeric":t[++i]=!1;t[++i]=!1;t[++i]=!1;t[++i]=!0;break;case"alphanumeric":t[++i]=!1;t[++i]=!1;t[++i]=!0;t[++i]=!1;break;case"binary":if(this.isEci)for(t[++i]=!1,t[++i]=!0,t[++i]=!0,t[++i]=!0,e=this._stringToBoolArray(this.m_EciAssignmentNumber.toString(),8),b=0;b<e.length;b++)t[++i]=e[b];t[++i]=!1;t[++i]=!0;t[++i]=!1;t[++i]=!1}if(s=0,this.m_Version<10)switch(this.mode){case"numeric":s=10;break;case"alphanumeric":s=9;break;case"binary":s=8}else if(this.m_Version<27)switch(this.mode){case"numeric":s=12;break;case"alphanumeric":s=11;break;case"binary":s=16}else switch(this.mode){case"numeric":s=14;break;case"alphanumeric":s=13;break;case"binary":s=16}for(u=this.Model.text,nt=this._intToBoolArray(u.length,s),n=0;n<s;n++)t[++i]=nt[n];if(this.mode=="numeric"){for(f="",n=0;n<u.length;n++)if(e=[],f+=u[n],n%3==2&&n!=0||n==u.length-1)for(e=f.length==3?this._stringToBoolArray(f,10):f.length==2?this._stringToBoolArray(f,7):this._stringToBoolArray(f,4),f="",r=0;r<e.length;r++)t[++i]=e[r]}else if(this.mode=="alphanumeric")for(p="",f=0,n=0;n<u.length;n++){if(e=[],p+=u[n],n%2==0&&n+1!=u.length&&(f=45*this._getAlphanumericvalues(u[n])),n%2==1&&n!=0){for(f+=this._getAlphanumericvalues(u[n]),e=this._intToBoolArray(f,11),f=0,a=0;a<e.length;a++)t[++i]=e[a];p=""}if(n!=1&&p!=null&&n+1==u.length&&p.length==1)for(f=this._getAlphanumericvalues(u[n]),e=this._intToBoolArray(f,6),f=0,r=0;r<e.length;r++)t[++i]=e[r]}else if(this.mode="binary")for(n=0;n<u.length;n++){if(f=0,u.charCodeAt(n)>=32&&u.charCodeAt(n)<=126||u.charCodeAt(n)>=161&&u.charCodeAt(n)<=255)f=u.charCodeAt(n);else if(u.charCodeAt(n)>=65377&&u.charCodeAt(n)<=65439)f=u.charCodeAt(n)-65216;else{console.log("Input text contains non-convertable characters");return}for(e=this._intToBoolArray(f,8),r=0;r<e.length;r++)t[++i]=e[r]}for(n=0;n<4;n++)if(t.length/8==this.qrbarcodeValues.NumberOfDataCodeWord)break;else t[++i]=!1;for(;;)if(t.length%8==0)break;else t[++i]=!1;for(;;){if(t.length/8==this.qrbarcodeValues.NumberOfDataCodeWord)break;else t[++i]=!0,t[++i]=!0,t[++i]=!0,t[++i]=!1,t[++i]=!0,t[++i]=!0,t[++i]=!1,t[++i]=!1;if(t.length/8==this.qrbarcodeValues.NumberOfDataCodeWord)break;else t[++i]=!1,t[++i]=!1,t[++i]=!1,t[++i]=!0,t[++i]=!1,t[++i]=!1,t[++i]=!1,t[++i]=!0}w=this.qrbarcodeValues.NumberOfDataCodeWord;blocks=this.qrbarcodeValues.NumberOfErrorCorrectionBlocks;l=blocks[0];blocks.length==6&&(l=blocks[0]+blocks[3]);var y=new Array(l),h=t,a=-1;if(blocks.length==6)for(k=blocks[0]*blocks[2]*8,h=new Array(k),n=0;n<k;n++)h[++a]=t[n];for(d=this._create2DArray(blocks[0],h.length/8/blocks[0]),d=this._createBlocks(h,blocks[0]),n=0;n<blocks[0];n++)y[n]=this._splitCodeWord(d,n,h.length/8/blocks[0]);if(a=-1,blocks.length==6){for(h=[],n=parseInt(blocks[0]*blocks[2]*8);n<t.length;n++)h[++a]=t[n];for(g=this._create2DArray(blocks[0],h.length/8/blocks[3]),g=this._createBlocks(h,blocks[3]),n=blocks[0],v=0;n<l;n++)y[n]=this._splitCodeWord(g,v++,h.length/8/blocks[3])}for(t=[],i=-1,n=0;n<125;n++)for(o=0;o<l;o++)for(r=0;r<8;r++)n<y[o].length&&(tt=y[o][n][r],t[++i]=tt=="1"?!0:!1);for(this.corCodeWords={DataBits:this.qrbarcodeValues.NumberOfDataCodeWord,ECCW:this.qrbarcodeValues.NumberOfErrorCorrectingCodeWords,DC:0},w=this.corCodeWords.DataBits,it=this.corCodeWords.ECCW,blocks=this.qrbarcodeValues.NumberOfErrorCorrectionBlocks,this.corCodeWords.DataBits=blocks.length==6?(w-blocks[3]*blocks[5])/blocks[0]:w/blocks[0],this.corCodeWords.ECCW=it/l,c=new Array(l),v=0,n=0;n<blocks[0];n++)this.corCodeWords.DC=y[v],c[v++]=this._getERCW();if(blocks.length==6)for(this.corCodeWords.DataBits=(w-blocks[0]*blocks[2])/blocks[3],n=0;n<blocks[3];n++)this.corCodeWords.DC=y[v],c[v++]=this._getERCW();if(blocks.length!=6)for(n=0;n<c[0].length;n++)for(o=0;o<blocks[0];o++)for(r=0;r<8;r++)n<c[o].length&&(t[++i]=c[o][n][r]=="1"?!0:!1);else for(n=0;n<c[0].length;n++)for(o=0;o<l;o++)for(r=0;r<8;r++)n<c[o].length&&(t[++i]=c[o][n][r]=="1"?!0:!1);this._dataAllocationAndMasking(t)},_getERCW:function(){var i,t=new Array(this.corCodeWords.DataBits),n=[];switch(this.corCodeWords.ECCW){case 7:n=[0,87,229,146,149,238,102,21];n=this._getElement(n);break;case 10:n=[0,251,67,46,61,118,70,64,94,32,45];n=this._getElement(n);break;case 13:n=[0,74,152,176,100,86,100,106,104,130,218,206,140,78];n=this._getElement(n);break;case 15:n=[0,8,183,61,91,202,37,51,58,58,237,140,124,5,99,105];n=this._getElement(n);break;case 16:n=[0,120,104,107,109,102,161,76,3,91,191,147,169,182,194,225,120];n=this._getElement(n);break;case 17:n=[0,43,139,206,78,43,239,123,206,214,147,24,99,150,39,243,163,136];n=this._getElement(n);break;case 18:n=[0,215,234,158,94,184,97,118,170,79,187,152,148,252,179,5,98,96,153];n=this._getElement(n);break;case 20:n=[0,17,60,79,50,61,163,26,187,202,180,221,225,83,239,156,164,212,212,188,190];n=this._getElement(n);break;case 22:n=[0,210,171,247,242,93,230,14,109,221,53,200,74,8,172,98,80,219,134,160,105,165,231];n=this._getElement(n);break;case 24:n=[0,229,121,135,48,211,117,251,126,159,180,169,152,192,226,228,218,111,0,117,232,87,96,227,21];n=this._getElement(n);break;case 26:n=[0,173,125,158,2,103,182,118,17,145,201,111,28,165,53,161,21,245,142,13,102,48,227,153,145,218,70];n=this._getElement(n);break;case 28:n=[0,168,223,200,104,224,234,108,180,110,190,195,147,205,27,232,201,21,43,245,87,42,195,212,119,242,37,9,123];n=this._getElement(n);break;case 30:n=[0,41,173,145,152,216,31,179,182,50,48,110,86,239,96,222,125,42,173,226,193,224,130,156,37,251,216,238,40,192,180];n=this._getElement(n);break;case 32:n=[0,10,6,106,190,249,167,4,67,209,138,138,32,242,123,89,27,120,185,80,156,38,69,171,60,28,222,80,52,254,185,220,241];n=this._getElement(n);break;case 34:n=[0,111,77,146,94,26,21,108,19,105,94,113,193,86,140,163,125,58,158,229,239,218,103,56,70,114,61,183,129,167,13,98,62,129,51];n=this._getElement(n);break;case 36:n=[0,200,183,98,16,172,31,246,234,60,152,115,0,167,152,113,248,238,107,18,63,218,37,87,210,105,177,120,74,121,196,117,251,113,233,30,120];n=this._getElement(n);break;case 40:n=[0,59,116,79,161,252,98,128,205,128,161,247,57,163,56,235,106,53,26,187,174,226,104,170,7,175,35,181,114,88,41,47,163,125,134,72,20,232,53,35,15];n=this._getElement(n);break;case 42:n=[0,250,103,221,230,25,18,137,231,0,3,58,242,221,191,110,84,230,8,188,106,96,147,15,131,139,34,101,223,39,101,213,199,237,254,201,123,171,162,194,117,50,96];n=this._getElement(n);break;case 44:n=[0,190,7,61,121,71,246,69,55,168,188,89,243,191,25,72,123,9,145,14,247,1,238,44,78,143,62,224,126,118,114,68,163,52,194,217,147,204,169,37,130,113,102,73,181];n=this._getElement(n);break;case 46:n=[0,112,94,88,112,253,224,202,115,187,99,89,5,54,113,129,44,58,16,135,216,169,211,36,1,4,96,60,241,73,104,234,8,249,245,119,174,52,25,157,224,43,202,223,19,82,15];n=this._getElement(n);break;case 48:n=[0,228,25,196,130,211,146,60,24,251,90,39,102,240,61,178,63,46,123,115,18,221,111,135,160,182,205,107,206,95,150,120,184,91,21,247,156,140,238,191,11,94,227,84,50,163,39,34,108];n=this._getElement(n);break;case 50:n=[0,232,125,157,161,164,9,118,46,209,99,203,193,35,3,209,111,195,242,203,225,46,13,32,160,126,209,130,160,242,215,242,75,77,42,189,32,113,65,124,69,228,114,235,175,124,170,215,232,133,205];n=this._getElement(n);break;case 52:n=[0,116,50,86,186,50,220,251,89,192,46,86,127,124,19,184,233,151,215,22,14,59,145,37,242,203,134,254,89,190,94,59,65,124,113,100,233,235,121,22,76,86,97,39,242,200,220,101,33,239,254,116,51];n=this._getElement(n);break;case 54:n=[0,183,26,201,87,210,221,113,21,46,65,45,50,238,184,249,225,102,58,209,218,109,165,26,95,184,192,52,245,35,254,238,175,172,79,123,25,122,43,120,108,215,80,128,201,235,8,153,59,101,31,198,76,31,156];n=this._getElement(n);break;case 56:n=[0,106,120,107,157,164,216,112,116,2,91,248,163,36,201,202,229,6,144,254,155,135,208,170,209,12,139,127,142,182,249,177,174,190,28,10,85,239,184,101,124,152,206,96,23,163,61,27,196,247,151,154,202,207,20,61,10];n=this._getElement(n);break;case 58:n=[0,82,116,26,247,66,27,62,107,252,182,200,185,235,55,251,242,210,144,154,237,176,141,192,248,152,249,206,85,253,142,65,165,125,23,24,30,122,240,214,6,129,218,29,145,127,134,206,245,117,29,41,63,159,142,233,125,148,123];n=this._getElement(n);break;case 60:n=[0,107,140,26,12,9,141,243,197,226,197,219,45,211,101,219,120,28,181,127,6,100,247,2,205,198,57,115,219,101,109,160,82,37,38,238,49,160,209,121,86,11,124,30,181,84,25,194,87,65,102,190,220,70,27,209,16,89,7,33,240];n=this._getElement(n);break;case 62:n=[0,65,202,113,98,71,223,248,118,214,94,0,122,37,23,2,228,58,121,7,105,135,78,243,118,70,76,223,89,72,50,70,111,194,17,212,126,181,35,221,117,235,11,229,149,147,123,213,40,115,6,200,100,26,246,182,218,127,215,36,186,110,106];n=this._getElement(n);break;case 64:n=[0,45,51,175,9,7,158,159,49,68,119,92,123,177,204,187,254,200,78,141,149,119,26,127,53,160,93,199,212,29,24,145,156,208,150,218,209,4,216,91,47,184,146,47,140,195,195,125,242,238,63,99,108,140,230,242,31,204,11,178,243,217,156,213,231];n=this._getElement(n);break;case 66:n=[0,5,118,222,180,136,136,162,51,46,117,13,215,81,17,139,247,197,171,95,173,65,137,178,68,111,95,101,41,72,214,169,197,95,7,44,154,77,111,236,40,121,143,63,87,80,253,240,126,217,77,34,232,106,50,168,82,76,146,67,106,171,25,132,93,45,105];n=this._getElement(n);break;case 68:n=[0,247,159,223,33,224,93,77,70,90,160,32,254,43,150,84,101,190,205,133,52,60,202,165,220,203,151,93,84,15,84,253,173,160,89,227,52,199,97,95,231,52,177,41,125,137,241,166,225,118,2,54,32,82,215,175,198,43,238,235,27,101,184,127,3,5,8,163,238];n=this._getElement(n)}return t=this._toDecimal(this.corCodeWords.DC,t),i=this._divide(n,t),this._toBinary(i)},_toBinary:function(n){for(var i,r,u,f=new Array(this.corCodeWords.ECCW),t=0;t<n.length;t++){for(i=n[t].toString(2),r=new String,u=0;u<8-i.length;u++)r+="0";f[t]=r+i}return f},_divide:function(n,t){for(var r,h,u,c,e,s,o=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142],l=this.corCodeWords.ECCW,f=[],i=0;i<t.length;i++)f.push({Exponent:t.length-1-i,Coefficient:t[i]});for(r=[],i=0;i<n.length;i++)r.push({Exponent:n.length-1-i,Coefficient:this._findElement(n[i],o)});for(i=0;i<f.length;i++)f[i].Exponent=f[i].Exponent+l;for(h=f[0].Exponent-r[0].Exponent,i=0;i<r.length;i++)r[i].Coefficient=r[i].Coefficient,r[i].Exponent=r[i].Exponent+h;for(u=f,i=0;i<f.length;i++)u[0].Coefficient==0?u.splice(0,1):(c=this._convertToAlphaNotation(u,o),e=this._multiplyGeneratorPolynomByLeadterm(r,c[0],i),e=this._convertToDecNotation(e,o),e=this._XORPolynoms(u,e),u=e);for(s=[],i=0;i<u.length;i++)s.push(u[i].Coefficient);return s},_convertToAlphaNotation:function(n,t){for(var r=[],i=0;i<n.length;i++)n[i].Coefficient!=0&&r.push({Exponent:n[i].Exponent,Coefficient:this._findElement(n[i].Coefficient,t)});return r},_multiplyGeneratorPolynomByLeadterm:function(n,t,i){for(var u=[],r=0;r<n.length;r++)u.push({Exponent:n[r].Exponent-i,Coefficient:(n[r].Coefficient+t.Coefficient)%255});return u},_convertToDecNotation:function(n,t){for(var r=[],i=0;i<n.length;i++)r.push({Exponent:n[i].Exponent,Coefficient:this._getIntValFromAlphaExp(n[i].Coefficient,t)});return r},_getIntValFromAlphaExp:function(n,t){return n>255&&(n=n-255),t[n]},_XORPolynoms:function(n,t){var f=[],r=[],u=[],i;for(n.length>=t.length?(r=n,u=t):(r=t,u=n),i=0;i<r.length;i++)f.push({Exponent:n[0].Exponent-i,Coefficient:r[i].Coefficient^(u.length>i?u[i].Coefficient:0)});return f.splice(0,1),f},_findElement:function(n,t){for(var i=0;i<t.length;i++)if(n==t[i])break;return i},_getElement:function(n){for(var i=new Array(n.length),r=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142],t=0;t<n.length;t++)n[t]>255&&(n[t]=n[t]-255),i[t]=r[n[t]];return i},_toDecimal:function(n){for(var i=new Array(n.length),t=0;t<n.length;t++)i[t]=parseInt(n[t],2);return i},_splitCodeWord:function(n,t,i){var u,r;for(i=parseInt(i),u=new Array(i),r=0;r<i;r++)u[r]=n[t][r];return u},_createBlocks:function(n,t){for(var f=this._create2DArray(t,n.length/8/t),u="",i=0,r=0,e=0;i<n.length;i++)i%8==0&&i!=0&&(f[e][r]=u,u="",r++,r==n.length/t/8&&(e++,r=0)),u+=n[i]?1:0;return f[e][r]=u,f},_getAlphanumericvalues:function(n){return["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"].indexOf(n)},_stringToBoolArray:function(n,t){for(var u=new Array(t),r=0,i=0;i<n.length;i++)r=r*10+n.charCodeAt(i)-48;for(i=0;i<t;i++)u[t-i-1]=(r>>i&1)==1;return u},_intToBoolArray:function(n,t){for(var r=new Array(t),i=0;i<t;i++)r[t-i-1]=(n>>i&1)==1;return r},_drawPDP:function(n,t){for(var i=n,r=t;i<n+7;i++,r++)this.moduleValue[i][t].IsBlack=!0,this.moduleValue[i][t].IsFilled=!0,this.moduleValue[i][t].IsPDP=!0,this.moduleValue[i][t+6].IsBlack=!0,this.moduleValue[i][t+6].IsFilled=!0,this.moduleValue[i][t+6].IsPDP=!0,t+7<this.noOfModules?(this.moduleValue[i][t+7].IsBlack=!1,this.moduleValue[i][t+7].IsFilled=!0,this.moduleValue[i][t+7].IsPDP=!0):t-1>=0&&(this.moduleValue[i][t-1].IsBlack=!1,this.moduleValue[i][t-1].IsFilled=!0,this.moduleValue[i][t-1].IsPDP=!0),this.moduleValue[n][r].IsBlack=!0,this.moduleValue[n][r].IsFilled=!0,this.moduleValue[n][r].IsPDP=!0,this.moduleValue[n+6][r].IsBlack=!0,this.moduleValue[n+6][r].IsFilled=!0,this.moduleValue[n+6][r].IsPDP=!0,n+7<this.noOfModules?(this.moduleValue[n+7][r].IsBlack=!1,this.moduleValue[n+7][r].IsFilled=!0,this.moduleValue[n+7][r].IsPDP=!0):n-1>=0&&(this.moduleValue[n-1][r].IsBlack=!1,this.moduleValue[n-1][r].IsFilled=!0,this.moduleValue[n-1][r].IsPDP=!0);for(n+7<this.noOfModules&&t+7<this.noOfModules?(this.moduleValue[n+7][t+7].IsBlack=!1,this.moduleValue[n+7][t+7].IsFilled=!0,this.moduleValue[n+7][t+7].IsPDP=!0):n+7<this.noOfModules&&t+7>=this.noOfModules?(this.moduleValue[n+7][t-1].IsBlack=!1,this.moduleValue[n+7][t-1].IsFilled=!0,this.moduleValue[n+7][t-1].IsPDP=!0):n+7>=this.noOfModules&&t+7<this.noOfModules&&(this.moduleValue[n-1][t+7].IsBlack=!1,this.moduleValue[n-1][t+7].IsFilled=!0,this.moduleValue[n-1][t+7].IsPDP=!0),n++,t++,i=n,r=t;i<n+5;i++,r++)this.moduleValue[i][t].IsBlack=!1,this.moduleValue[i][t].IsFilled=!0,this.moduleValue[i][t].IsPDP=!0,this.moduleValue[i][t+4].IsBlack=!1,this.moduleValue[i][t+4].IsFilled=!0,this.moduleValue[i][t+4].IsPDP=!0,this.moduleValue[n][r].IsBlack=!1,this.moduleValue[n][r].IsFilled=!0,this.moduleValue[n][r].IsPDP=!0,this.moduleValue[n+4][r].IsBlack=!1,this.moduleValue[n+4][r].IsFilled=!0,this.moduleValue[n+4][r].IsPDP=!0;for(n++,t++,i=n,r=t;i<n+3;i++,r++)this.moduleValue[i][t].IsBlack=!0,this.moduleValue[i][t].IsFilled=!0,this.moduleValue[i][t].IsPDP=!0,this.moduleValue[i][t+2].IsBlack=!0,this.moduleValue[i][t+2].IsFilled=!0,this.moduleValue[i][t+2].IsPDP=!0,this.moduleValue[n][r].IsBlack=!0,this.moduleValue[n][r].IsFilled=!0,this.moduleValue[n][r].IsPDP=!0,this.moduleValue[n+2][r].IsBlack=!0,this.moduleValue[n+2][r].IsFilled=!0,this.moduleValue[n+2][r].IsPDP=!0;this.moduleValue[n+1][t+1].IsBlack=!0;this.moduleValue[n+1][t+1].IsFilled=!0;this.moduleValue[n+1][t+1].IsPDP=!0},_drawAlignmentPattern:function(n,t){for(var i=n-2,r=t-2;i<n+3;i++,r++)this.moduleValue[i][t-2].IsBlack=!0,this.moduleValue[i][t-2].IsFilled=!0,this.moduleValue[i][t+2].IsBlack=!0,this.moduleValue[i][t+2].IsFilled=!0,this.moduleValue[n-2][r].IsBlack=!0,this.moduleValue[n-2][r].IsFilled=!0,this.moduleValue[n+2][r].IsBlack=!0,this.moduleValue[n+2][r].IsFilled=!0;for(i=n-1,r=t-1;i<n+2;i++,r++)this.moduleValue[i][t-1].IsBlack=!1,this.moduleValue[i][t-1].IsFilled=!0,this.moduleValue[i][t+1].IsBlack=!1,this.moduleValue[i][t+1].IsFilled=!0,this.moduleValue[n-1][r].IsBlack=!1,this.moduleValue[n-1][r].IsFilled=!0,this.moduleValue[n+1][r].IsBlack=!1,this.moduleValue[n+1][r].IsFilled=!0;this.moduleValue[n][t].IsBlack=!0;this.moduleValue[n][t].IsFilled=!0},_getAlignmentPatternCoOrdinates:function(){var n=[];switch(this.m_Version){case 02:n=[6,18];break;case 03:n=[6,22];break;case 04:n=[6,26];break;case 05:n=[6,30];break;case 06:n=[6,34];break;case 07:n=[6,22,38];break;case 8:n=[6,24,42];break;case 9:n=[6,26,46];break;case 10:n=[6,28,50];break;case 11:n=[6,30,54];break;case 12:n=[6,32,58];break;case 13:n=[6,34,62];break;case 14:n=[6,26,46,66];break;case 15:n=[6,26,48,70];break;case 16:n=[6,26,50,74];break;case 17:n=[6,30,54,78];break;case 18:n=[6,30,56,82];break;case 19:n=[6,30,58,86];break;case 20:n=[6,34,62,90];break;case 21:n=[6,28,50,72,94];break;case 22:n=[6,26,50,74,98];break;case 23:n=[6,30,54,78,102];break;case 24:n=[6,28,54,80,106];break;case 25:n=[6,32,58,84,110];break;case 26:n=[6,30,58,86,114];break;case 27:n=[6,34,62,90,118];break;case 28:n=[6,26,50,74,98,122];break;case 29:n=[6,30,54,78,102,126];break;case 30:n=[6,26,52,78,104,130];break;case 31:n=[6,30,56,82,108,134];break;case 32:n=[6,34,60,86,112,138];break;case 33:n=[6,30,58,86,114,142];break;case 34:n=[6,34,62,90,118,146];break;case 35:n=[6,30,54,78,102,126,150];break;case 36:n=[6,24,50,76,102,128,154];break;case 37:n=[6,28,54,80,106,132,158];break;case 38:n=[6,32,58,84,110,136,162];break;case 39:n=[6,26,54,82,110,138,166];break;case 40:n=[6,30,58,86,114,142,170]}return n},_findECINumber:function(n){for(var r,i=3,u=0;u<n.length;u++)if(r=n.charCodeAt(u),!(r>=32)||!(r<=255)){var t=r.toString(16);if(["2591","2592","2593","2502","2524","2561","2562","2556","2555","2563","2551","2557","255D","255C","255B","2510","2514","2534","252C","251C","2500","253C","255E","255F","255A","2554","2569","2566","2560","2550","256C","2567","2568","2564","2565","2559","2558","2552","2553","256B","256A","2518","250C","2588","2584","258C","2590","2580","25A0"].indexOf(t)!=-1){i=2;break}else if(["104","2D8","141","13D","15A","160","15E","164","179","17D","17B","105","2DB","142","13E","15B","2C7","161","15F","165","17A","2DD","17E","17C","154","102","139","106","10C","118","11A","10E","110","143","147","150","158","16E","170","162","155","103","13A","107","10D","119","11B","10F","111","144","148","151","159","16F","171","163","2D9"].indexOf(t)!=-1){i=4;break}else if(["126","124","130","15E","11E","134","17B","127","125","131","15F","11F","135","17C","10A","108","120","11C","16C","15C","10B","109","121","11D","16D","15D"].indexOf(t)!=-1){i=5;break}else if(["104","138","156","128","13B","160","112","122","166","17D","105","2DB","157","129","13C","2C7","161","113","123","167","14A","17E","14B","100","12E","10C","118","116","12A","110","145","14C","136","172","168","16A","101","12F","10D","119","117","12B","111","146","14D","137","173","169","16B"].indexOf(t)!=-1){i=6;break}else if(t>=1025&&t<=1119&&t!=1037&&t!=1104&&t!=1117){i=7;break}else if(t>=1569&&t<=1594||t>=1600&&t<=1618||t==1567||t==1563||t==1548){i=8;break}else if(t>=900&&t<=974||t==890){i=9;break}else if(t>=1488&&t<=1514){i=10;break}else if(t>=3585&&t<=3675){i=13;break}else if(["141","104","15E","17B","142","105","15F","13D","13E","17C"].indexOf(t)!=1||t>=1569&&t<=1610){i=21;break}else if(["402","403","453","409","40A","40C","40B","40F","452","459","45A","45C","45B","45F","40E","45E","408","490","401","404","407","406","456","491","451","454","458","405","455","457"].indexOf(t)!=1||t>=1040&&t<=1103){i=22;break}else if(["20AC","201A","192","201E","2026","2020","2021","2C6","2030","160","2039","152","17D","2018","2019","201C","201D","2022","2013","2014","2DC","2122","161","203A","153","17E","178"].indexOf(t)!=-1){i=23;break}else if(["67E","679","152","686","698","688","6AF","6A9","691","153","6BA","6BE","6C1"].indexOf(t)!=-1){i=24;break}}return i},_getNumberOfDataCodeWord:function(){var n=0;switch(this.m_Version){case 01:n=16;break;case 02:n=28;break;case 03:n=44;break;case 04:n=64;break;case 05:n=86;break;case 06:n=108;break;case 07:n=124;break;case 8:n=154;break;case 9:n=182;break;case 10:n=216;break;case 11:n=254;break;case 12:n=290;break;case 13:n=334;break;case 14:n=365;break;case 15:n=415;break;case 16:n=453;break;case 17:n=507;break;case 18:n=563;break;case 19:n=627;break;case 20:n=669;break;case 21:n=714;break;case 22:n=782;break;case 23:n=860;break;case 24:n=914;break;case 25:n=1e3;break;case 26:n=1062;break;case 27:n=1128;break;case 28:n=1193;break;case 29:n=1267;break;case 30:n=1373;break;case 31:n=1455;break;case 32:n=1541;break;case 33:n=1631;break;case 34:n=1725;break;case 35:n=1812;break;case 36:n=1914;break;case 37:n=1992;break;case 38:n=2102;break;case 39:n=2216;break;case 40:n=2334}return n},_getNumberOfErrorCorrectingCodeWords:function(){var n=(this.m_Version-1)*4,t;return n+=1,t=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430],t[n]},_getNumberOfErrorCorrectionBlocks:function(){var n=[];switch(this.m_Version){case 01:case 02:case 03:n[0]=1;break;case 04:case 05:n[0]=2;break;case 06:case 07:n[0]=4;break;case 8:n=[2,60,38,2,61,39];break;case 9:n=[3,58,36,2,59,37];break;case 10:n=[4,69,43,1,70,44];break;case 11:n=[1,80,50,4,81,51];break;case 12:n=[6,58,36,2,59,37];break;case 13:n=[8,59,37,1,60,38];break;case 14:n=[4,64,40,5,65,41];break;case 15:n=[5,65,41,5,66,42];break;case 16:n=[7,73,45,3,74,46];break;case 17:n=[10,74,46,1,75,47];break;case 18:n=[9,69,43,4,70,44];break;case 19:n=[3,70,44,11,71,45];break;case 20:n=[3,67,41,13,68,42];break;case 21:case 22:n[0]=17;break;case 23:n=[4,75,47,14,76,48];break;case 24:n=[6,73,45,14,74,46];break;case 25:n=[8,75,47,13,76,48];break;case 26:n=[19,74,46,4,75,47];break;case 27:n=[22,73,45,3,74,46];break;case 28:n=[3,73,45,23,74,46];break;case 29:n=[21,73,45,7,74,46];break;case 30:n=[19,75,47,10,76,48];break;case 31:n=[2,74,46,29,75,47];break;case 32:n=[10,74,46,23,75,47];break;case 33:n=[14,74,46,21,75,47];break;case 34:n=[14,74,46,23,75,47];break;case 35:n=[12,75,47,26,76,48];break;case 36:n=[6,75,47,34,76,48];break;case 37:n=[29,74,46,14,75,47];break;case 38:n=[13,74,46,32,75,47];break;case 39:n=[40,75,47,7,76,48];break;case 40:n=[18,75,47,31,76,48]}return n},_getEnd:function(){return[208,359,567,807,1079,1383,1568,1936,2336,2768,3232,3728,4256,4651,5243,5867,6523,7211,7931,8683,9252,10068,10916,11796,12708,13652,14628,15371,16411,17483,18587,19723,20891,22091,23008,24272,25568,26896,28256,29648][this.m_Version-1]},_getDataCapacity:function(){return[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706][this.m_Version-1]},_getFormatInformation:function(){return[1,1,0,1,0,0,1,0,1,1,0,1,1,0,1]},_getVersionInformation:function(){var n=[];switch(this.m_Version){case 07:n=[0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0,0];break;case 8:n=[0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0,0];break;case 9:n=[1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,0];break;case 10:n=[1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,0,0];break;case 11:n=[0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,0,0];break;case 12:n=[0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0,0];break;case 13:n=[1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,0,0];break;case 14:n=[1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0];break;case 15:n=[0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0];break;case 16:n=[0,0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0];break;case 17:n=[1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,0];break;case 18:n=[1,1,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1,0];break;case 19:n=[0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0];break;case 20:n=[0,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,0];break;case 21:n=[1,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0];break;case 22:n=[1,0,0,1,0,0,1,1,0,0,0,1,0,1,1,0,1,0];break;case 23:n=[0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,0];break;case 24:n=[0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0];break;case 25:n=[1,0,0,0,0,1,1,1,1,0,0,0,1,0,0,1,1,0];break;case 26:n=[1,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0];break;case 27:n=[0,1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,0];break;case 28:n=[0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0];break;case 29:n=[1,1,1,1,1,1,0,0,1,1,0,0,1,0,1,1,1,0];break;case 30:n=[1,0,1,0,1,1,1,0,1,0,1,1,0,1,1,1,1,0];break;case 31:n=[0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0];break;case 32:n=[1,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,1];break;case 33:n=[0,0,0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1];break;case 34:n=[0,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1];break;case 35:n=[1,1,1,1,1,0,0,1,1,1,1,0,1,1,0,0,0,1];break;case 36:n=[1,1,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1];break;case 37:n=[0,1,1,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1];break;case 38:n=[0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1];break;case 39:n=[1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,0,1];break;case 40:n=[1,0,0,1,0,1,1,0,0,0,1,1,0,0,0,1,0,1]}return n},_getStringCodePoints:function(){function n(n,t){return((n&1023)<<10)+(t&1023)+65536}return function(t){for(var u=[],i=0,r;i<t.length;)r=t.charCodeAt(i),(r&63488)==55296?u.push(n(r,t.charCodeAt(++i))):u.push(r),++i;return u}}(),_create2DArray:function(n,t){var r,i;for(n=parseInt(n),t=parseInt(t),r=new Array(n),i=0;i<n;i++)r[i]=new Array(t);return r},_buildDataMatrix:function(){for(var f,s,h=[[10,10,1,1,3,5,1,3],[12,12,1,1,5,7,1,5],[14,14,1,1,8,10,1,8],[16,16,1,1,12,12,1,12],[18,18,1,1,18,14,1,18],[20,20,1,1,22,18,1,22],[22,22,1,1,30,20,1,30],[24,24,1,1,36,24,1,36],[26,26,1,1,44,28,1,44],[32,32,2,2,62,36,1,62],[36,36,2,2,86,42,1,86],[40,40,2,2,114,48,1,114],[44,44,2,2,144,56,1,144],[48,48,2,2,174,68,1,174],[52,52,2,2,204,84,2,102],[64,64,4,4,280,112,2,140],[72,72,4,4,368,144,4,92],[80,80,4,4,456,192,4,114],[88,88,4,4,576,224,4,144],[96,96,4,4,696,272,4,174],[104,104,4,4,816,336,6,136],[120,120,6,6,1050,408,6,175],[132,132,6,6,1304,496,8,163],[144,144,6,6,1558,620,10,156],[8,18,1,1,5,7,1,5],[8,32,2,1,10,11,1,10],[12,26,1,1,16,14,1,16],[12,36,2,1,22,18,1,22],[16,36,2,1,32,24,1,32],[16,48,2,1,49,28,1,49]],u=this._getStringCodePoints(this.Model.text),l,i,t=[],e=0,n=0;n<u.length;n++)u[n]<127?t[e]=u[n]+1:(t[e++]=235,t[e]=u[n]-127),e++;for(n=0;n<h.length;n++)if(h[n][4]>=u.length){i=h[n];break}if(i[4]>t.length){var r=t.length,o=new Array(i[4]);for(f=0;f<r;f++)o[f]=t[f];for(r<i[4]+1&&(o[r]=129),r++;r<i[4];)s=129+(r+1)*149%253+1,s>254&&(s-=254),o[r++]=s;t=o}l=i[5];errCorrArray=this._errorCorrection(l,t);var y=t.concat(errCorrArray),c=this._createMatrix(y,i),a=c.length*this.Model.xDimension,v=c[0].length*this.Model.xDimension;this.contextEl.beginPath();this.contextEl.fillStyle="white";this.contextEl.fillRect(0,0,a,v);this.contextEl.closePath();this._drawDataMatrix(c,a,v)},_drawDataMatrix:function(n,t,i){var r=parseInt(this.Model.xDimension),h,e,u,o,f,s;for(n.length==n[0].length&&this.Model.height!=""&&this.Model.width!=""?(this.Model.height=this._getProperValue(this.Model.height),this.Model.width=this._getProperValue(this.Model.width),h=Math.min(this.Model.width,this.Model.height),r=h/n.length):(this.Model.height=i,this.Model.width=t,this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width),this.canvasEl[0].setAttribute("height",this.Model.height),this.BarcodeEl.css("height",this.Model.height)),e=0,this.contextEl.beginPath(),u=0;u<n.length;u++){for(o=0,f=0;f<n[u].length;f++)s=null,s=n[u][f]==1?this.model.darkBarColor:this.model.lightBarColor,this.contextEl.fillStyle=s,this.contextEl.fillRect(o,e,r,r),o+=r;e+=r}this.contextEl.closePath();this.contextEl.stroke()},_createMatrix:function(n,t){var i,r,c,l,d=[],e=t[1],s=t[0],b=e/t[2],k=s/t[3],o,a,rt,p,w,g,u,f;for(c=e-2*(e/b),l=s-2*(s/k),d=new Array(c*l),this._ecc200placement(d,l,c),o=new Array(e*s),u=0;u<o.length;u++)o[u]=0;for(r=0;r<s;r+=k){for(i=0;i<e;i++)o[parseInt(r*e)+i]=1;for(i=0;i<e;i+=2)o[parseInt((r+k-1)*e)+i]=1}for(i=0;i<e;i+=b){for(r=0;r<s;r++)o[parseInt(r*e)+i]=1;for(r=0;r<s;r+=2)o[parseInt(r*e)+i+b-1]=1}for(r=0;r<l;r++)for(i=0;i<c;i++)a=d[(l-r-1)*c+i],(a==1||a>7&&(n[(a>>3)-1]&1<<(a&7))!=0)&&(rt=parseInt(parseInt(1+r+2*parseInt(r/(k-2)))*e+1+i+ +(2*parseInt(i/(b-2)))),o[rt]=1);var v=t[1],y=t[0],ut=this._create2DArray(v,y);for(p=0;p<v;p++)for(w=0;w<y;w++)ut[p][w]=o[v*w+p];for(g=this._create2DArray(y,v),u=0;u<y;u++)for(f=0;f<v;f++)g[y-1-u][f]=ut[f][u];var nt=t[0]+(this.Model.quietZone.top+this.Model.quietZone.bottom),tt=t[1]+(this.Model.quietZone.left+this.Model.quietZone.right),h=this.Model.quietZone.all,it=this._create2DArray(nt,tt);for(u=0;u<nt;u++)for(f=0;f<tt;f++)it[u][f]=0;for(u=h;u<nt-h;u++)for(f=h;f<tt-h;f++)it[u][f]=g[u-h][f-h];return it},_ecc200placement:function(n,t,i){for(var u,f,r=0;r<t;r++)for(u=0;u<i;u++)n[r*i+u]=0;f=1;r=4;u=0;do{r!=t||u!=0||this._ecc200placementcornerA(n,t,i,f++);r!=t-2||u!=0||i%4==0||this._ecc200placementcornerB(n,t,i,f++);r!=t-2||u!=0||i%8!=4||this._ecc200placementcornerC(n,t,i,f++);r!=t+4||u!=2||i%8!=0||this._ecc200placementcornerD(n,t,i,f++);do r<t&&u>=0&&!(n[r*i+u]!=0)&&this._ecc200placementblock(n,t,i,r,u,f++),r-=2,u+=2;while(r>=0&&u<i);r++;u+=3;do r>-1&&u<i&&!(n[r*i+u]!=0)&&this._ecc200placementblock(n,t,i,r,u,f++),r+=2,u-=2;while(r<t&&u>=0);r+=3;u++}while(r<t||u<i);n[t*i-1]!=0||(n[t*i-1]=n[t*i-i-2]=1)},_ecc200placementcornerA:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-1,0,r,7);this._ecc200placementbit(n,t,i,t-1,1,r,6);this._ecc200placementbit(n,t,i,t-1,2,r,5);this._ecc200placementbit(n,t,i,0,i-2,r,4);this._ecc200placementbit(n,t,i,0,i-1,r,3);this._ecc200placementbit(n,t,i,1,i-1,r,2);this._ecc200placementbit(n,t,i,2,i-1,r,1);this._ecc200placementbit(n,t,i,3,i-1,r,0)},_ecc200placementcornerB:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-3,0,r,7);this._ecc200placementbit(n,t,i,t-2,0,r,6);this._ecc200placementbit(n,t,i,t-1,0,r,5);this._ecc200placementbit(n,t,i,0,i-4,r,4);this._ecc200placementbit(n,t,i,0,i-3,r,3);this._ecc200placementbit(n,t,i,0,i-2,r,2);this._ecc200placementbit(n,t,i,0,i-1,r,1);this._ecc200placementbit(n,t,i,1,i-1,r,0)},_ecc200placementcornerC:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-3,0,r,7);this._ecc200placementbit(n,t,i,t-2,0,r,6);this._ecc200placementbit(n,t,i,t-1,0,r,5);this._ecc200placementbit(n,t,i,0,i-2,r,4);this._ecc200placementbit(n,t,i,0,i-1,r,3);this._ecc200placementbit(n,t,i,1,i-1,r,2);this._ecc200placementbit(n,t,i,2,i-1,r,1);this._ecc200placementbit(n,t,i,3,i-1,r,0)},_ecc200placementcornerD:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-1,0,r,7);this._ecc200placementbit(n,t,i,t-1,i-1,r,6);this._ecc200placementbit(n,t,i,0,i-3,r,5);this._ecc200placementbit(n,t,i,0,i-2,r,4);this._ecc200placementbit(n,t,i,0,i-1,r,3);this._ecc200placementbit(n,t,i,1,i-3,r,2);this._ecc200placementbit(n,t,i,1,i-2,r,1);this._ecc200placementbit(n,t,i,1,i-1,r,0)},_ecc200placementblock:function(n,t,i,r,u,f){this._ecc200placementbit(n,t,i,r-2,u-2,f,7);this._ecc200placementbit(n,t,i,r-2,u-1,f,6);this._ecc200placementbit(n,t,i,r-1,u-2,f,5);this._ecc200placementbit(n,t,i,r-1,u-1,f,4);this._ecc200placementbit(n,t,i,r-1,+u,f,3);this._ecc200placementbit(n,t,i,+r,u-2,f,2);this._ecc200placementbit(n,t,i,+r,u-1,f,1);this._ecc200placementbit(n,t,i,+r,+u,f,0)},_ecc200placementbit:function(n,t,i,r,u,f,e){r<0&&(r+=t,u+=4-(t+4)%8);u<0&&(u+=i,r+=4-(i+4)%8);n[r*i+u]=(f<<3)+e},_errorCorrection:function(n,t){var f,a=1,h,u=new Array(n+1),e=new Array(256),r=new Array(256),l,c,o,i,s;for(e[0]=-255,r[0]=1,i=1;i<=255;i++)r[i]=r[i-1]*2,r[i]>=256&&(r[i]=r[i]^301),e[r[i]]=i;for(u[0]=1,i=1;i<=n;i++){for(u[i]=1,f=i-1;f>0;f--)u[f]!=0&&(u[f]=r[(e[u[f]]+a)%255]),u[f]^=u[f-1];u[0]=r[(e[u[0]]+a)%255];a++}for(h=new Array(n),l=0;l<h.length;l++)h[l]=u[l];for(c=0,o=new Array(n),i=0;i<n;i++)o[i]=0;for(i=0;i<t.length;i++){for(c=o[n-1]^t[i],s=n-1;s>0;s--)o[s]=c!=0&&h[s]!=0?o[s-1]^r[(e[c]+e[h[s]])%255]:o[s-1];o[0]=c!=0&&h[0]!=0?r[(e[c]+e[h[0]])%255]:0}return o.reverse()},_validateText:function(n,t){var i=new RegExp(t);return i.test(n)},_getCharWidth:function(n,t){for(var i=0,u=n.split(""),r=0;r<u.length;r++)i=i+intercharacterGap+this._getWidth(t,u[r]);return i},_getWidth:function(n,t){for(var u,f,e=!1,i=0,r=0;r<n.length;r++)if(n[r][0]==t){for(u=n[r][2],f=0;f<u.length;f++)e==!1&&u.length%2!=0&&(continuous=!0),i=i+u[f]*this.Model.narrowBarWidth,e=!0;return i}return i},_draw1DBarcode:function(n,t,i){var a,g,nt,u,s,f,r,e,w,b,k,d,h;if(t.length>0){var v=n.split(""),o=this.Model.quietZone.left,c=this.Model.quietZone.top,y=parseInt(this.textFont.size.replace("px",""));this.Model.height==""&&this.Model.width==""&&(this.Model.height=c+this.Model.barHeight+this.Model.quietZone.bottom,this.Model.width=i,this.Model.displayText&&(this.Model.height+=y+this.Model.barcodeToTextGapHeight),this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width),this.canvasEl[0].setAttribute("height",this.Model.height),this.BarcodeEl.css("height",this.Model.height));var tt=this.Model.width,l=this.Model.height,p=0;for(u=0;u<v.length;u++)for(s=0;s<t.length;s++)if(t[s][0]==v[u]){for(f=t[s][2],r=0;r<f.length;r++)e=f[r]*this.Model.narrowBarWidth,p+=f[r];f.length%2!=0&&p++}for(a=(this._getProperValue(this.Model.width)-this.Model.quietZone.right-this.Model.quietZone.left)/p,a<1&&(a=1),this.Model.narrowBarWidth=Math.floor(a),g=(a%1).toFixed(3),nt=p*g,o=parseInt(this.model.quietZone.left)+Math.round(nt/2),this.model.barHeight=this._getProperValue(this.Model.height)-this.Model.quietZone.top-this.Model.quietZone.bottom-(y+this.Model.barcodeToTextGapHeight),this.model.barHeight<0&&(this.model.barHeight=0),intercharacterGap=this.Model.narrowBarWidth,this.contextEl.fillStyle="white",this.contextEl.fillRect(0,0,tt,l),u=0;u<v.length;u++)for(s=0;s<t.length;s++)if(t[s][0]==v[u]){if(f=t[s][2],this.model.symbologyType=="upcbarcode")for(r=0;r<f.length;r++)e=f[r]*this.Model.narrowBarWidth,u>1&&u<=7?r%2!=0&&(this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.darkBarColor,this.contextEl.fillRect(o,c,e,this.Model.barHeight),this.contextEl.closePath()):r%2==0?(this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.darkBarColor,this.contextEl.fillRect(o,c,e,this.Model.barHeight),this.contextEl.closePath()):(this.contextEl.beginPath(),this.contextEl.fillStyle=this.model.lightBarColor,this.contextEl.fillRect(o,c,e,this.model.barHeight)),o+=e,u==1&&r==f.length-1&&(o-=e);else for(r=0;r<f.length;r++)e=f[r]*this.Model.narrowBarWidth,r%2==0?(this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.darkBarColor,this.contextEl.fillRect(o,c,e,this.Model.barHeight),this.contextEl.closePath()):(this.contextEl.beginPath(),this.contextEl.fillStyle=this.model.lightBarColor,this.contextEl.fillRect(o,c,e,this.model.barHeight),this.contextEl.closePath()),o+=e;(f.length%2!=0||this.model.symbologyType=="upcbarcode"&&u==7)&&(o+=intercharacterGap)}if(this.Model.displayText){if(w=this.textFont.fontStyle.toLowerCase()=="regular"?"":+this.textFont.fontStyle.toLowerCase()+" ",w+=this.textFont.size+" "+this.textFont.fontFamily.toLowerCase()+",sans-serif",this.contextEl.font=w,b=0,b=this.contextEl.measureText(this.Model.text).width,this.Model.width<b&&(this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width)),this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.textColor,this.contextEl.textAlign="center",l=l-y+y/2,this.model.symbologyType=="upcbarcode"){for(k=n.split(""),d="",h=0;h<k.length;h++)(h>1&&h<=7||h>8&&h<=14)&&(d+=k[h]);this.contextEl.fillText(d,this.Model.width/2,l)}else this.contextEl.fillText(this.Model.text,this.Model.width/2,l);this.contextEl.closePath();this.contextEl.stroke()}}}});t.datavisualization.Barcode.SymbologyType={code39:"code39",code39Extended:"code39extended",code11:"code11",codabar:"codabar",code32:"code32",code93:"code93",code93Extended:"code93extended",code128A:"code128a",code128B:"code128b",code128C:"code128c",dataMatrix:"datamatrix",qrBarcode:"qrbarcode",upca:"upcbarcode"};t.datavisualization.Barcode.symbologySettings={code39:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[A-Z0-9-.$/+% ]+$",symbolTable:[["0",0,[1,1,1,3,3,1,3,1,1]],["1",1,[3,1,1,3,1,1,1,1,3]],["2",2,[1,1,3,3,1,1,1,1,3]],["3",3,[3,1,3,3,1,1,1,1,1]],["4",4,[1,1,1,3,3,1,1,1,3]],["5",5,[3,1,1,3,3,1,1,1,1]],["6",6,[1,1,3,3,3,1,1,1,1]],["7",7,[1,1,1,3,1,1,3,1,3]],["8",8,[3,1,1,3,1,1,3,1,1]],["9",9,[1,1,3,3,1,1,3,1,1]],["A",10,[3,1,1,1,1,3,1,1,3]],["B",11,[1,1,3,1,1,3,1,1,3]],["C",12,[3,1,3,1,1,3,1,1,1]],["D",13,[1,1,1,1,3,3,1,1,3]],["E",14,[3,1,1,1,3,3,1,1,1]],["F",15,[1,1,3,1,3,3,1,1,1]],["G",16,[1,1,1,1,1,3,3,1,3]],["H",17,[3,1,1,1,1,3,3,1,1]],["I",18,[1,1,3,1,1,3,3,1,1]],["J",19,[1,1,1,1,3,3,3,1,1]],["K",20,[3,1,1,1,1,1,1,3,3]],["L",21,[1,1,3,1,1,1,1,3,3]],["M",22,[3,1,3,1,1,1,1,3,1]],["N",23,[1,1,1,1,3,1,1,3,3]],["O",24,[3,1,1,1,3,1,1,3,1]],["P",25,[1,1,3,1,3,1,1,3,1]],["Q",26,[1,1,1,1,1,1,3,3,3]],["R",27,[3,1,1,1,1,1,3,3,1]],["S",28,[1,1,3,1,1,1,3,3,1]],["T",29,[1,1,1,1,3,1,3,3,1]],["U",30,[3,3,1,1,1,1,1,1,3]],["V",31,[1,3,3,1,1,1,1,1,3]],["W",32,[3,3,3,1,1,1,1,1,1]],["X",33,[1,3,1,1,3,1,1,1,3]],["Y",34,[3,3,1,1,3,1,1,1,1]],["Z",35,[1,3,3,1,3,1,1,1,1]],["-",36,[1,3,1,1,1,1,3,1,3]],[".",37,[3,3,1,1,1,1,3,1,1]],[" ",38,[1,3,3,1,1,1,3,1,1]],["$",39,[1,3,1,3,1,3,1,1,1]],["/",40,[1,3,1,3,1,1,1,3,1]],["+",41,[1,3,1,1,1,3,1,3,1]],["%",42,[1,1,1,3,1,3,1,3,1]],["*",0,[1,3,1,1,3,1,3,1,1]]]},code39extended:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[\x00-]+$",symbolTable:[["0",0,[1,1,1,3,3,1,3,1,1]],["1",1,[3,1,1,3,1,1,1,1,3]],["2",2,[1,1,3,3,1,1,1,1,3]],["3",3,[3,1,3,3,1,1,1,1,1]],["4",4,[1,1,1,3,3,1,1,1,3]],["5",5,[3,1,1,3,3,1,1,1,1]],["6",6,[1,1,3,3,3,1,1,1,1]],["7",7,[1,1,1,3,1,1,3,1,3]],["8",8,[3,1,1,3,1,1,3,1,1]],["9",9,[1,1,3,3,1,1,3,1,1]],["A",10,[3,1,1,1,1,3,1,1,3]],["B",11,[1,1,3,1,1,3,1,1,3]],["C",12,[3,1,3,1,1,3,1,1,1]],["D",13,[1,1,1,1,3,3,1,1,3]],["E",14,[3,1,1,1,3,3,1,1,1]],["F",15,[1,1,3,1,3,3,1,1,1]],["G",16,[1,1,1,1,1,3,3,1,3]],["H",17,[3,1,1,1,1,3,3,1,1]],["I",18,[1,1,3,1,1,3,3,1,1]],["J",19,[1,1,1,1,3,3,3,1,1]],["K",20,[3,1,1,1,1,1,1,3,3]],["L",21,[1,1,3,1,1,1,1,3,3]],["M",22,[3,1,3,1,1,1,1,3,1]],["N",23,[1,1,1,1,3,1,1,3,3]],["O",24,[3,1,1,1,3,1,1,3,1]],["P",25,[1,1,3,1,3,1,1,3,1]],["Q",26,[1,1,1,1,1,1,3,3,3]],["R",27,[3,1,1,1,1,1,3,3,1]],["S",28,[1,1,3,1,1,1,3,3,1]],["T",29,[1,1,1,1,3,1,3,3,1]],["U",30,[3,3,1,1,1,1,1,1,3]],["V",31,[1,3,3,1,1,1,1,1,3]],["W",32,[3,3,3,1,1,1,1,1,1]],["X",33,[1,3,1,1,3,1,1,1,3]],["Y",34,[3,3,1,1,3,1,1,1,1]],["Z",35,[1,3,3,1,3,1,1,1,1]],["-",36,[1,3,1,1,1,1,3,1,3]],[".",37,[3,3,1,1,1,1,3,1,1]],[" ",38,[1,3,3,1,1,1,3,1,1]],["$",39,[1,3,1,3,1,3,1,1,1]],["/",40,[1,3,1,3,1,1,1,3,1]],["+",41,[1,3,1,1,1,3,1,3,1]],["%",42,[1,1,1,3,1,3,1,3,1]],["*",0,[1,3,1,1,3,1,3,1,1]]],extendedCodes:[['\0',["%","U"]],[String.fromCharCode(parseInt("0001",16)),["$","A"]],[String.fromCharCode(parseInt("0002",16)),["$","B"]],[String.fromCharCode(parseInt("0003",16)),["$","C"]],[String.fromCharCode(parseInt("0004",16)),["$","D"]],[String.fromCharCode(parseInt("0005",16)),["$","E"]],[String.fromCharCode(parseInt("0006",16)),["$","F"]],["a",["$","G"]],["\b",["$","H"]],["\t",["$","I"]],["\n",["$","J"]],['\v',["$","K"]],["\f",["$","L"]],["\r",["$","M"]],[String.fromCharCode(parseInt("000e",16)),["$","N"]],[String.fromCharCode(parseInt("000f",16)),["$","O"]],[String.fromCharCode(parseInt("0010",16)),["$","P"]],[String.fromCharCode(parseInt("0011",16)),["$","Q"]],[String.fromCharCode(parseInt("0012",16)),["$","R"]],[String.fromCharCode(parseInt("0013",16)),["$","S"]],[String.fromCharCode(parseInt("0014",16)),["$","T"]],[String.fromCharCode(parseInt("0015",16)),["$","U"]],[String.fromCharCode(parseInt("0016",16)),["$","V"]],[String.fromCharCode(parseInt("0017",16)),["$","W"]],[String.fromCharCode(parseInt("0018",16)),["$","X"]],[String.fromCharCode(parseInt("0019",16)),["$","Y"]],[String.fromCharCode(parseInt("001a",16)),["$","Z"]],[String.fromCharCode(parseInt("001b",16)),["%","A"]],[String.fromCharCode(parseInt("001c",16)),["%","B"]],[String.fromCharCode(parseInt("001d",16)),["%","C"]],[String.fromCharCode(parseInt("001e",16)),["%","D"]],[String.fromCharCode(parseInt("001f",16)),["%","E"]],[" ",[" "]],["!",["/","A"]],['"',["/","B"]],["#",["/","C"]],["$",["/","D"]],["%",["/","E"]],["&",["/","F"]],["'",["/","G"]],["(",["/","H"]],[")",["/","I"]],["*",["/","J"]],["+",["/","K"]],[",",["/","L"]],["-",["/","M"]],[".",["/","N"]],["/",["/","O"]],["0",["0"]],["1",["1"]],["2",["2"]],["3",["3"]],["4",["4"]],["5",["5"]],["6",["6"]],["7",["7"]],["8",["8"]],["9",["9"]],[":",["/","Z"]],[";",["%","F"]],["<",["%","G"]],["=",["%","H"]],[">",["%","I"]],["?",["%","J"]],["@",["%","V"]],["A",["A"]],["B",["B"]],["C",["C"]],["D",["D"]],["E",["E"]],["F",["F"]],["G",["G"]],["H",["H"]],["I",["I"]],["J",["J"]],["K",["K"]],["L",["L"]],["M",["M"]],["N",["N"]],["O",["O"]],["P",["P"]],["Q",["Q"]],["R",["R"]],["S",["S"]],["T",["T"]],["U",["U"]],["V",["V"]],["W",["W"]],["X",["X"]],["Y",["Y"]],["Z",["Z"]],["[",["%","K"]],["\\",["%","L"]],["]",["%","M"]],["^",["%","N"]],["_",["%","O"]],["`",["%","W"]],["a",["+","A"]],["b",["+","B"]],["c",["+","C"]],["d",["+","D"]],["e",["+","E"]],["f",["+","F"]],["g",["+","G"]],["h",["+","H"]],["i",["+","I"]],["j",["+","J"]],["k",["+","K"]],["l",["+","L"]],["m",["+","M"]],["n",["+","N"]],["o",["+","O"]],["p",["+","P"]],["q",["+","Q"]],["r",["+","R"]],["s",["+","S"]],["t",["+","T"]],["u",["+","U"]],["v",["+","V"]],["w",["+","W"]],["x",["+","X"]],["y",["+","Y"]],["z",["+","Z"]],["{",["%","P"]],["|",["%","Q"]],["}",["%","R"]],["~",["%","S"]],[String.fromCharCode(parseInt("007f",16)),["%","T"]]]},code11:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[0-9-]*$",symbolTable:[["0",0,[1,1,1,1,2]],["1",1,[2,1,1,1,2]],["2",2,[1,2,1,1,2]],["3",3,[2,2,1,1,1]],["4",4,[1,1,2,1,2]],["5",5,[2,1,2,1,1]],["6",6,[1,2,2,1,1]],["7",7,[1,1,1,2,2]],["8",8,[2,1,1,2,1]],["9",9,[2,1,1,1,1]],["-",10,[1,1,2,1,1]],["*",0,[1,1,2,2,1]]]},codabar:{startSymbol:"A",stopSymbol:"B",validatorExp:"^[0-9-.$/:+]*$",symbolTable:[["0",0,[1,1,1,1,1,2,2]],["1",0,[1,1,1,1,2,2,1]],["2",0,[1,1,1,2,1,1,2]],["3",0,[2,2,1,1,1,1,1]],["4",0,[1,1,2,1,1,2,1]],["5",0,[2,1,1,1,1,2,1]],["6",0,[1,2,1,1,1,1,2]],["7",0,[1,2,1,1,2,1,1]],["8",0,[1,2,2,1,1,1,1]],["9",0,[2,1,1,2,1,1,1]],["-",0,[1,1,1,2,2,1,1]],["$",0,[1,1,2,2,1,1,1]],[":",0,[2,1,1,1,2,1,2]],["/",0,[2,1,2,1,1,1,2]],[".",0,[2,1,2,1,2,1,1]],["+",0,[1,1,2,1,2,1,2]],["A",0,[1,1,2,2,1,2,1]],["B",0,[1,1,1,2,1,2,2]]]},code32:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[A-Z0-9 -*.$/+%]+$",symbolTable:[["0",0,[1,1,1,3,3,1,3,1,1]],["1",1,[3,1,1,3,1,1,1,1,3]],["2",2,[1,1,3,3,1,1,1,1,3]],["3",3,[3,1,3,3,1,1,1,1,1]],["4",4,[1,1,1,3,3,1,1,1,3]],["5",5,[3,1,1,3,3,1,1,1,1]],["6",6,[1,1,3,3,3,1,1,1,1]],["7",7,[1,1,1,3,1,1,3,1,3]],["8",8,[3,1,1,3,1,1,3,1,1]],["9",9,[1,1,3,3,1,1,3,1,1]],["B",10,[1,1,3,1,1,3,1,1,3]],["C",11,[3,1,3,1,1,3,1,1,1]],["D",12,[1,1,1,1,3,3,1,1,3]],["F",13,[1,1,3,1,3,3,1,1,1]],["G",14,[1,1,1,1,1,3,3,1,3]],["H",15,[3,1,1,1,1,3,3,1,1]],["J",16,[1,1,1,1,3,3,3,1,1]],["K",17,[3,1,1,1,1,1,1,3,3]],["L",18,[1,1,3,1,1,1,1,3,3]],["M",19,[3,1,3,1,1,1,1,3,1]],["N",20,[1,1,1,1,3,1,1,3,3]],["P",21,[1,1,3,1,3,1,1,3,1]],["Q",22,[1,1,1,1,1,1,3,3,3]],["R",23,[3,1,1,1,1,1,3,3,1]],["S",24,[1,1,3,1,1,1,3,3,1]],["T",25,[1,1,1,1,3,1,3,3,1]],["U",26,[3,3,1,1,1,1,1,1,3]],["V",27,[1,3,3,1,1,1,1,1,3]],["W",28,[3,3,3,1,1,1,1,1,1]],["X",29,[1,3,1,1,3,1,1,1,3]],["Y",30,[3,3,1,1,3,1,1,1,1]],["Z",31,[1,3,3,1,3,1,1,1,1]],["*",0,[1,3,1,1,3,1,3,1,1]]]},code93:{startSymbol:"*",stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"^[A-Z0-9-.$/+% ]+$",symbolTable:[["0",0,[1,3,1,1,1,2]],["1",1,[1,1,1,2,1,3]],["2",2,[1,1,1,3,1,2]],["3",3,[1,1,1,4,1,1]],["4",4,[1,2,1,1,1,2]],["5",5,[1,2,1,2,1,2]],["6",6,[1,2,1,3,1,1]],["7",7,[1,1,1,1,1,4]],["8",8,[1,3,1,2,1,1]],["9",9,[1,4,1,1,1,1]],["A",10,[2,1,1,1,1,3]],["B",11,[2,1,1,2,1,2]],["C",12,[2,1,1,3,1,1]],["D",13,[2,2,1,1,1,2]],["E",14,[2,2,1,2,1,1]],["F",15,[2,3,1,1,1,1]],["G",16,[1,1,2,1,1,3]],["H",17,[1,1,2,2,1,2]],["I",18,[1,1,2,3,1,1]],["J",19,[1,2,2,1,1,2]],["K",20,[1,3,2,1,1,1]],["L",21,[1,1,1,1,2,3]],["M",22,[1,1,1,2,2,2]],["N",23,[1,1,1,3,2,1]],["O",24,[1,2,1,1,2,2]],["P",25,[1,3,1,1,2,1]],["Q",26,[2,1,2,1,1,2]],["R",27,[2,1,2,2,1,1]],["S",28,[2,1,1,1,2,2]],["T",29,[2,1,1,2,2,1]],["U",30,[2,2,1,1,2,1]],["V",31,[2,2,2,1,1,1]],["W",32,[1,1,2,1,2,2]],["X",33,[1,1,2,2,2,1]],["Y",34,[1,2,2,1,2,1]],["Z",35,[1,2,3,1,1,1]],["-",36,[1,2,1,1,3,1]],[".",37,[3,1,1,1,1,2]],[" ",38,[3,1,1,2,1,1]],["$",39,[3,2,1,1,1,1]],["/",40,[1,1,2,1,3,1]],["+",41,[1,1,3,1,2,1]],["%",42,[2,1,1,1,3,1]],["*",0,[1,1,1,1,4,1]],[String.fromCharCode(parseInt("00ff",16)),0,[1,1,1,1,4,1,1]],[String.fromCharCode(parseInt("00fb",16)),43,[1,2,1,2,2,0]],[String.fromCharCode(parseInt("00fc",16)),44,[3,1,2,1,1,1]],[String.fromCharCode(parseInt("00fd",16)),45,[3,1,1,1,2,1]],[String.fromCharCode(parseInt("00fe",16)),46,[1,2,2,2,1,1]]]},code93extended:{startSymbol:"*",stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"^[\x00-\x00fb\x00fd\x00fe'þ''ü''ý']+$",symbolTable:[["0",0,[1,3,1,1,1,2]],["1",1,[1,1,1,2,1,3]],["2",2,[1,1,1,3,1,2]],["3",3,[1,1,1,4,1,1]],["4",4,[1,2,1,1,1,2]],["5",5,[1,2,1,2,1,2]],["6",6,[1,2,1,3,1,1]],["7",7,[1,1,1,1,1,4]],["8",8,[1,3,1,2,1,1]],["9",9,[1,4,1,1,1,1]],["A",10,[2,1,1,1,1,3]],["B",11,[2,1,1,2,1,2]],["C",12,[2,1,1,3,1,1]],["D",13,[2,2,1,1,1,2]],["E",14,[2,2,1,2,1,1]],["F",15,[2,3,1,1,1,1]],["G",16,[1,1,2,1,1,3]],["H",17,[1,1,2,2,1,2]],["I",18,[1,1,2,3,1,1]],["J",19,[1,2,2,1,1,2]],["K",20,[1,3,2,1,1,1]],["L",21,[1,1,1,1,2,3]],["M",22,[1,1,1,2,2,2]],["N",23,[1,1,1,3,2,1]],["O",24,[1,2,1,1,2,2]],["P",25,[1,3,1,1,2,1]],["Q",26,[2,1,2,1,1,2]],["R",27,[2,1,2,2,1,1]],["S",28,[2,1,1,1,2,2]],["T",29,[2,1,1,2,2,1]],["U",30,[2,2,1,1,2,1]],["V",31,[2,2,2,1,1,1]],["W",32,[1,1,2,1,2,2]],["X",33,[1,1,2,2,2,1]],["Y",34,[1,2,2,1,2,1]],["Z",35,[1,2,3,1,1,1]],["-",36,[1,2,1,1,3,1]],[".",37,[3,1,1,1,1,2]],[" ",38,[3,1,1,2,1,1]],["$",39,[3,2,1,1,1,1]],["/",40,[1,1,2,1,3,1]],["+",41,[1,1,3,1,2,1]],["%",42,[2,1,1,1,3,1]],["*",0,[1,1,1,1,4,1]],[String.fromCharCode(parseInt("00ff",16)),0,[1,1,1,1,4,1,1]],[String.fromCharCode(parseInt("00fb",16)),43,[1,2,1,2,2,0]],[String.fromCharCode(parseInt("00fc",16)),44,[3,1,2,1,1,1]],[String.fromCharCode(parseInt("00fd",16)),45,[3,1,1,1,2,1]],[String.fromCharCode(parseInt("00fe",16)),46,[1,2,2,2,1,1]]],extendedCodes:[['\0',[String.fromCharCode(parseInt("00fc",16)),"U"]],[String.fromCharCode(parseInt("0001",16)),[String.fromCharCode(parseInt("00fb",16)),"A"]],[String.fromCharCode(parseInt("0002",16)),[String.fromCharCode(parseInt("00fb",16)),"B"]],[String.fromCharCode(parseInt("0003",16)),[String.fromCharCode(parseInt("00fb",16)),"C"]],[String.fromCharCode(parseInt("0004",16)),[String.fromCharCode(parseInt("00fb",16)),"D"]],[String.fromCharCode(parseInt("0005",16)),[String.fromCharCode(parseInt("00fb",16)),"E"]],[String.fromCharCode(parseInt("0006",16)),[String.fromCharCode(parseInt("00fb",16)),"F"]],["a",[String.fromCharCode(parseInt("00fb",16)),"G"]],["\b",[String.fromCharCode(parseInt("00fb",16)),"H"]],["\t",[String.fromCharCode(parseInt("00fb",16)),"I"]],["\n",[String.fromCharCode(parseInt("00fb",16)),"J"]],['\v',[String.fromCharCode(parseInt("00fb",16)),"K"]],["\f",[String.fromCharCode(parseInt("00fb",16)),"L"]],["\r",[String.fromCharCode(parseInt("00fb",16)),"M"]],[String.fromCharCode(parseInt("000e",16)),[String.fromCharCode(parseInt("00fb",16)),"N"]],[String.fromCharCode(parseInt("000f",16)),[String.fromCharCode(parseInt("00fb",16)),"O"]],[String.fromCharCode(parseInt("0010",16)),[String.fromCharCode(parseInt("00fb",16)),"P"]],[String.fromCharCode(parseInt("0011",16)),[String.fromCharCode(parseInt("00fb",16)),"Q"]],[String.fromCharCode(parseInt("0012",16)),[String.fromCharCode(parseInt("00fb",16)),"R"]],[String.fromCharCode(parseInt("0013",16)),[String.fromCharCode(parseInt("00fb",16)),"S"]],[String.fromCharCode(parseInt("0014",16)),[String.fromCharCode(parseInt("00fb",16)),"T"]],[String.fromCharCode(parseInt("0015",16)),[String.fromCharCode(parseInt("00fb",16)),"U"]],[String.fromCharCode(parseInt("0016",16)),[String.fromCharCode(parseInt("00fb",16)),"V"]],[String.fromCharCode(parseInt("0017",16)),[String.fromCharCode(parseInt("00fb",16)),"W"]],[String.fromCharCode(parseInt("0018",16)),[String.fromCharCode(parseInt("00fb",16)),"X"]],[String.fromCharCode(parseInt("0019",16)),[String.fromCharCode(parseInt("00fb",16)),"Y"]],[String.fromCharCode(parseInt("001a",16)),[String.fromCharCode(parseInt("00fb",16)),"Z"]],[String.fromCharCode(parseInt("001b",16)),[String.fromCharCode(parseInt("00fc",16)),"A"]],[String.fromCharCode(parseInt("001c",16)),[String.fromCharCode(parseInt("00fc",16)),"B"]],[String.fromCharCode(parseInt("001d",16)),[String.fromCharCode(parseInt("00fc",16)),"C"]],[String.fromCharCode(parseInt("001e",16)),[String.fromCharCode(parseInt("00fc",16)),"D"]],[String.fromCharCode(parseInt("001f",16)),[String.fromCharCode(parseInt("00fc",16)),"E"]],[" ",[" "]],["!",[String.fromCharCode(parseInt("00fd",16)),"A"]],['"',[String.fromCharCode(parseInt("00fd",16)),"B"]],["#",[String.fromCharCode(parseInt("00fd",16)),"C"]],["$",[String.fromCharCode(parseInt("00fd",16)),"D"]],["%",[String.fromCharCode(parseInt("00fd",16)),"E"]],["&",[String.fromCharCode(parseInt("00fd",16)),"F"]],["'",[String.fromCharCode(parseInt("00fd",16)),"G"]],["(",[String.fromCharCode(parseInt("00fd",16)),"H"]],[")",[String.fromCharCode(parseInt("00fd",16)),"I"]],["*",[String.fromCharCode(parseInt("00fd",16)),"J"]],["+",[String.fromCharCode(parseInt("00fd",16)),"K"]],[",",[String.fromCharCode(parseInt("00fd",16)),"L"]],["-",[String.fromCharCode(parseInt("00fd",16)),"M"]],[".",[String.fromCharCode(parseInt("00fd",16)),"N"]],["/",[String.fromCharCode(parseInt("00fd",16)),"O"]],["0",["0"]],["1",["1"]],["2",["2"]],["3",["3"]],["4",["4"]],["5",["5"]],["6",["6"]],["7",["7"]],["8",["8"]],["9",["9"]],[":",[String.fromCharCode(parseInt("00fd",16)),"Z"]],[";",[String.fromCharCode(parseInt("00fc",16)),"F"]],["<",[String.fromCharCode(parseInt("00fc",16)),"G"]],["=",[String.fromCharCode(parseInt("00fc",16)),"H"]],[">",[String.fromCharCode(parseInt("00fc",16)),"I"]],["?",[String.fromCharCode(parseInt("00fc",16)),"J"]],["@",[String.fromCharCode(parseInt("00fc",16)),"V"]],["A",["A"]],["B",["B"]],["C",["C"]],["D",["D"]],["E",["E"]],["F",["F"]],["G",["G"]],["H",["H"]],["I",["I"]],["J",["J"]],["K",["K"]],["L",["L"]],["M",["M"]],["N",["N"]],["O",["O"]],["P",["P"]],["Q",["Q"]],["R",["R"]],["S",["S"]],["T",["T"]],["U",["U"]],["V",["V"]],["W",["W"]],["X",["X"]],["Y",["Y"]],["Z",["Z"]],["[",[String.fromCharCode(parseInt("00fc",16)),"K"]],["\\",[String.fromCharCode(parseInt("00fc",16)),"L"]],["]",[String.fromCharCode(parseInt("00fc",16)),"M"]],["^",[String.fromCharCode(parseInt("00fc",16)),"N"]],["_",[String.fromCharCode(parseInt("00fc",16)),"O"]],["`",[String.fromCharCode(parseInt("00fc",16)),"W"]],["a",[String.fromCharCode(parseInt("00fe",16)),"A"]],["b",[String.fromCharCode(parseInt("00fe",16)),"B"]],["c",[String.fromCharCode(parseInt("00fe",16)),"C"]],["d",[String.fromCharCode(parseInt("00fe",16)),"D"]],["e",[String.fromCharCode(parseInt("00fe",16)),"E"]],["f",[String.fromCharCode(parseInt("00fe",16)),"F"]],["g",[String.fromCharCode(parseInt("00fe",16)),"G"]],["h",[String.fromCharCode(parseInt("00fe",16)),"H"]],["i",[String.fromCharCode(parseInt("00fe",16)),"I"]],["j",[String.fromCharCode(parseInt("00fe",16)),"J"]],["k",[String.fromCharCode(parseInt("00fe",16)),"K"]],["l",[String.fromCharCode(parseInt("00fe",16)),"L"]],["m",[String.fromCharCode(parseInt("00fe",16)),"M"]],["n",[String.fromCharCode(parseInt("00fe",16)),"N"]],["o",[String.fromCharCode(parseInt("00fe",16)),"O"]],["p",[String.fromCharCode(parseInt("00fe",16)),"P"]],["q",[String.fromCharCode(parseInt("00fe",16)),"Q"]],["r",[String.fromCharCode(parseInt("00fe",16)),"R"]],["s",[String.fromCharCode(parseInt("00fe",16)),"S"]],["t",[String.fromCharCode(parseInt("00fe",16)),"T"]],["u",[String.fromCharCode(parseInt("00fe",16)),"U"]],["v",[String.fromCharCode(parseInt("00fe",16)),"V"]],["w",[String.fromCharCode(parseInt("00fe",16)),"W"]],["x",[String.fromCharCode(parseInt("00fe",16)),"X"]],["y",[String.fromCharCode(parseInt("00fe",16)),"Y"]],["z",[String.fromCharCode(parseInt("00fe",16)),"Z"]],["{",[String.fromCharCode(parseInt("00fc",16)),"P"]],["|",[String.fromCharCode(parseInt("00fc",16)),"Q"]],["}",[String.fromCharCode(parseInt("00fc",16)),"R"]],["~",[String.fromCharCode(parseInt("00fc",16)),"S"]],[String.fromCharCode(parseInt("007f",16)),[String.fromCharCode(parseInt("00fc",16)),"T"]]]},code128a:{startSymbol:String.fromCharCode(parseInt("00f9",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"[\0\x0001\x0002\x0003\x0004\x0005\x0006\a\b\t\n\v\f\r\x000e\x000f\x0010\x0011\x0012\x0013\x0014\x0015\x0016\x0017\x0018\x0019\x001a\x001b\x001c\x001d\x001e\x001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\x00f0\x00f1\x00f2\x00f3\x00f4]",symbolTable:[["\0",64,[1,1,1,4,2,2]],[String.fromCharCode(parseInt("0001",16)),65,[1,2,1,1,2,4]],[String.fromCharCode(parseInt("0002",16)),66,[1,2,1,4,2,1]],[String.fromCharCode(parseInt("0003",16)),67,[1,4,1,1,2,2]],[String.fromCharCode(parseInt("0004",16)),68,[1,4,1,2,2,1]],[String.fromCharCode(parseInt("0005",16)),69,[1,1,2,2,1,4]],[String.fromCharCode(parseInt("0006",16)),70,[1,1,2,4,1,2]],["a",71,[1,2,2,1,1,4]],["\b",72,[1,2,2,4,1,1]],["\t",73,[1,4,2,1,1,2]],["\n",74,[1,4,2,2,1,1]],["\v",75,[2,4,1,2,1,1]],["\f",76,[2,2,1,1,1,4]],["\r",77,[4,1,3,1,1,1]],[String.fromCharCode(parseInt("000e",16)),78,[2,4,1,1,1,2]],[String.fromCharCode(parseInt("000f",16)),79,[1,3,4,1,1,1]],[String.fromCharCode(parseInt("0010",16)),80,[1,1,1,2,4,2]],[String.fromCharCode(parseInt("0011",16)),81,[1,2,1,1,4,2]],[String.fromCharCode(parseInt("0012",16)),82,[1,2,1,2,4,1]],[String.fromCharCode(parseInt("0013",16)),83,[1,1,4,2,1,2]],[String.fromCharCode(parseInt("0014",16)),84,[1,2,4,1,1,2]],[String.fromCharCode(parseInt("0015",16)),85,[1,2,4,2,1,1]],[String.fromCharCode(parseInt("0016",16)),86,[4,1,1,2,1,2]],[String.fromCharCode(parseInt("0017",16)),87,[4,2,1,1,1,2]],[String.fromCharCode(parseInt("0018",16)),88,[4,2,1,2,1,1]],[String.fromCharCode(parseInt("0019",16)),89,[2,1,2,1,4,1]],[String.fromCharCode(parseInt("001a",16)),90,[2,1,4,1,2,1]],[String.fromCharCode(parseInt("001b",16)),91,[4,1,2,1,2,1]],[String.fromCharCode(parseInt("001c",16)),92,[1,1,1,1,4,3]],[String.fromCharCode(parseInt("001d",16)),93,[1,1,1,3,4,1]],[String.fromCharCode(parseInt("001e",16)),94,[1,3,1,1,4,1]],[String.fromCharCode(parseInt("001f",16)),95,[1,1,4,1,1,3]],[" ",0,[2,1,2,2,2,2]],["!",1,[2,2,2,1,2,2]],['"',2,[2,2,2,2,2,1]],["#",3,[1,2,1,2,2,3]],["$",4,[1,2,1,3,2,2]],["%",5,[1,3,1,2,2,2]],["&",6,[1,2,2,2,1,3]],["'",7,[1,2,2,3,1,2]],["(",8,[1,3,2,2,1,2]],[")",9,[2,2,1,2,1,3]],["*",10,[2,2,1,3,1,2]],["+",11,[2,3,1,2,1,2]],[",",12,[1,1,2,2,3,2]],["-",13,[1,2,2,1,3,2]],[".",14,[1,2,2,2,3,1]],["/",15,[1,1,3,2,2,2]],["0",16,[1,2,3,1,2,2]],["1",17,[1,2,3,2,2,1]],["2",18,[2,2,3,2,1,1]],["3",19,[2,2,1,1,3,2]],["4",20,[2,2,1,2,3,1]],["5",21,[2,1,3,2,1,2]],["6",22,[2,2,3,1,1,2]],["7",23,[3,1,2,1,3,1]],["8",24,[3,1,1,2,2,2]],["9",25,[3,2,1,1,2,2]],[":",26,[3,2,1,2,2,1]],[";",27,[3,1,2,2,1,2]],["<",28,[3,2,2,1,1,2]],["=",29,[3,2,2,2,1,1]],[">",30,[2,1,2,1,2,3]],["?",31,[2,1,2,3,2,1]],["@",32,[2,3,2,1,2,1]],["A",33,[1,1,1,3,2,3]],["B",34,[1,3,1,1,2,3]],["C",35,[1,3,1,3,2,1]],["D",36,[1,1,2,3,1,3]],["E",37,[1,3,2,1,1,3]],["F",38,[1,3,2,3,1,1]],["G",39,[2,1,1,3,1,3]],["H",40,[2,3,1,1,1,3]],["I",41,[2,3,1,3,1,1]],["J",42,[1,1,2,1,3,3]],["K",43,[1,1,2,3,3,1]],["L",44,[1,3,2,1,3,1]],["M",45,[1,1,3,1,2,3]],["N",46,[1,1,3,3,2,1]],["O",47,[1,3,3,1,2,1]],["P",48,[3,1,3,1,2,1]],["Q",49,[2,1,1,3,3,1]],["R",50,[2,3,1,1,3,1]],["S",51,[2,1,3,1,1,3]],["T",52,[2,1,3,3,1,1]],["U",53,[2,1,3,1,3,1]],["V",54,[3,1,1,1,2,3]],["W",55,[3,1,1,3,2,1]],["X",56,[3,3,1,1,2,1]],["Y",57,[3,1,2,1,1,3]],["Z",58,[3,1,2,3,1,1]],["[",59,[3,3,2,1,1,1]],["\\",60,[3,1,4,1,1,1]],["]",61,[2,2,1,4,1,1]],["^",62,[4,3,1,1,1,1]],["_",63,[1,1,1,2,2,4]],[String.fromCharCode(parseInt("00f0",16)),102,[4,1,1,1,3,1]],[String.fromCharCode(parseInt("00f1",16)),97,[4,1,1,1,1,3]],[String.fromCharCode(parseInt("00f2",16)),96,[1,1,4,3,1,1]],[String.fromCharCode(parseInt("00f3",16)),101,[3,1,1,1,4,1]],[String.fromCharCode(parseInt("00f4",16)),98,[4,1,1,3,1,1]],[String.fromCharCode(parseInt("00fc",16)),99,[1,1,3,1,4,1]],[String.fromCharCode(parseInt("00fb",16)),100,[1,1,4,1,3,1]],[String.fromCharCode(parseInt("00f9",16)),103,[2,1,1,4,1,2]],[String.fromCharCode(parseInt("00ff",16)),-1,[2,3,3,1,1,1,2]]]},code128b:{startSymbol:String.fromCharCode(parseInt("00fd",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"^[\x00-]",symbolTable:[[" ",0,[2,1,2,2,2,2]],["!",1,[2,2,2,1,2,2]],['"',2,[2,2,2,2,2,1]],["#",3,[1,2,1,2,2,3]],["$",4,[1,2,1,3,2,2]],["%",5,[1,3,1,2,2,2]],["&",6,[1,2,2,2,1,3]],["'",7,[1,2,2,3,1,2]],["(",8,[1,3,2,2,1,2]],[")",9,[2,2,1,2,1,3]],["*",10,[2,2,1,3,1,2]],["+",11,[2,3,1,2,1,2]],[",",12,[1,1,2,2,3,2]],["-",13,[1,2,2,1,3,2]],[".",14,[1,2,2,2,3,1]],["/",15,[1,1,3,2,2,2]],["0",16,[1,2,3,1,2,2]],["1",17,[1,2,3,2,2,1]],["2",18,[2,2,3,2,1,1]],["3",19,[2,2,1,1,3,2]],["4",20,[2,2,1,2,3,1]],["5",21,[2,1,3,2,1,2]],["6",22,[2,2,3,1,1,2]],["7",23,[3,1,2,1,3,1]],["8",24,[3,1,1,2,2,2]],["9",25,[3,2,1,1,2,2]],[":",26,[3,2,1,2,2,1]],[";",27,[3,1,2,2,1,2]],["<",28,[3,2,2,1,1,2]],["=",29,[3,2,2,2,1,1]],[">",30,[2,1,2,1,2,3]],["?",31,[2,1,2,3,2,1]],["@",32,[2,3,2,1,2,1]],["A",33,[1,1,1,3,2,3]],["B",34,[1,3,1,1,2,3]],["C",35,[1,3,1,3,2,1]],["D",36,[1,1,2,3,1,3]],["E",37,[1,3,2,1,1,3]],["F",38,[1,3,2,3,1,1]],["G",39,[2,1,1,3,1,3]],["H",40,[2,3,1,1,1,3]],["I",41,[2,3,1,3,1,1]],["J",42,[1,1,2,1,3,3]],["K",43,[1,1,2,3,3,1]],["L",44,[1,3,2,1,3,1]],["M",45,[1,1,3,1,2,3]],["N",46,[1,1,3,3,2,1]],["O",47,[1,3,3,1,2,1]],["P",48,[3,1,3,1,2,1]],["Q",49,[2,1,1,3,3,1]],["R",50,[2,3,1,1,3,1]],["S",51,[2,1,3,1,1,3]],["T",52,[2,1,3,3,1,1]],["U",53,[2,1,3,1,3,1]],["V",54,[3,1,1,1,2,3]],["W",55,[3,1,1,3,2,1]],["X",56,[3,3,1,1,2,1]],["Y",57,[3,1,2,1,1,3]],["Z",58,[3,1,2,3,1,1]],["[",59,[3,3,2,1,1,1]],["\\",60,[3,1,4,1,1,1]],["]",61,[2,2,1,4,1,1]],["^",62,[4,3,1,1,1,1]],["_",63,[1,1,1,2,2,4]],["`",64,[1,1,1,4,2,2]],["a",65,[1,2,1,1,2,4]],["b",66,[1,2,1,4,2,1]],["c",67,[1,4,1,1,2,2]],["d",68,[1,4,1,2,2,1]],["e",69,[1,1,2,2,1,4]],["f",70,[1,1,2,4,1,2]],["g",71,[1,2,2,1,1,4]],["h",72,[1,2,2,4,1,1]],["i",73,[1,4,2,1,1,2]],["j",74,[1,4,2,2,1,1]],["k",75,[2,4,1,2,1,1]],["l",76,[2,2,1,1,1,4]],["m",77,[4,1,3,1,1,1]],["n",78,[2,4,1,1,1,2]],["o",79,[1,3,4,1,1,1]],["p",80,[1,1,1,2,4,2]],["q",81,[1,2,1,1,4,2]],["r",82,[1,2,1,2,4,1]],["s",83,[1,1,4,2,1,2]],["t",84,[1,2,4,1,1,2]],["u",85,[1,2,4,2,1,1]],["v",86,[4,1,1,2,1,2]],["w",87,[4,2,1,1,1,2]],["x",88,[4,2,1,2,1,1]],["y",89,[2,1,2,1,4,1]],["z",90,[2,1,4,1,2,1]],["{",91,[4,1,2,1,2,1]],["|",92,[1,1,1,1,4,3]],["}",93,[1,1,1,3,4,1]],["~",94,[1,3,1,1,4,1]],[String.fromCharCode(parseInt("007f",16)),95,[1,1,4,1,1,3]],[String.fromCharCode(parseInt("00f0",16)),102,[4,1,1,1,3,1]],[String.fromCharCode(parseInt("00f1",16)),97,[4,1,1,1,1,3]],[String.fromCharCode(parseInt("00f2",16)),96,[1,1,4,3,1,1]],[String.fromCharCode(parseInt("00f3",16)),100,[1,1,4,1,3,1]],[String.fromCharCode(parseInt("00f4",16)),98,[4,1,1,3,1,1]],[String.fromCharCode(parseInt("00fc",16)),99,[1,1,3,1,4,1]],[String.fromCharCode(parseInt("00fa",16)),101,[3,1,1,1,4,1]],[String.fromCharCode(parseInt("00fd",16)),104,[2,1,1,2,1,4]],[String.fromCharCode(parseInt("00ff",16)),-1,[2,3,3,1,1,1,2]]]},code128c:{startSymbol:String.fromCharCode(parseInt("00fe",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"[0-9]",symbolTable:[["\0",0,[2,1,2,2,2,2]],[String.fromCharCode(parseInt("0001",16)),1,[2,2,2,1,2,2]],[String.fromCharCode(parseInt("0002",16)),2,[2,2,2,2,2,1]],[String.fromCharCode(parseInt("0003",16)),3,[1,2,1,2,2,3]],[String.fromCharCode(parseInt("0004",16)),4,[1,2,1,3,2,2]],[String.fromCharCode(parseInt("0005",16)),5,[1,3,1,2,2,2]],[String.fromCharCode(parseInt("0006",16)),6,[1,2,2,2,1,3]],["a",7,[1,2,2,3,1,2]],["\b",8,[1,3,2,2,1,2]],["\t",9,[2,2,1,2,1,3]],["\n",10,[2,2,1,3,1,2]],["\v",11,[2,3,1,2,1,2]],["\f",12,[1,1,2,2,3,2]],["\r",13,[1,2,2,1,3,2]],[String.fromCharCode(parseInt("000e",16)),14,[1,2,2,2,3,1]],[String.fromCharCode(parseInt("000f",16)),15,[1,1,3,2,2,2]],[String.fromCharCode(parseInt("0010",16)),16,[1,2,3,1,2,2]],[String.fromCharCode(parseInt("0011",16)),17,[1,2,3,2,2,1]],[String.fromCharCode(parseInt("0012",16)),18,[2,2,3,2,1,1]],[String.fromCharCode(parseInt("0013",16)),19,[2,2,1,1,3,2]],[String.fromCharCode(parseInt("0014",16)),20,[2,2,1,2,3,1]],[String.fromCharCode(parseInt("0015",16)),21,[2,1,3,2,1,2]],[String.fromCharCode(parseInt("0016",16)),22,[2,2,3,1,1,2]],[String.fromCharCode(parseInt("0017",16)),23,[3,1,2,1,3,1]],[String.fromCharCode(parseInt("0018",16)),24,[3,1,1,2,2,2]],[String.fromCharCode(parseInt("0019",16)),25,[3,2,1,1,2,2]],[String.fromCharCode(parseInt("001a",16)),26,[3,2,1,2,2,1]],[String.fromCharCode(parseInt("001b",16)),27,[3,1,2,2,1,2]],[String.fromCharCode(parseInt("001c",16)),28,[3,2,2,1,1,2]],[String.fromCharCode(parseInt("001d",16)),29,[3,2,2,2,1,1]],[String.fromCharCode(parseInt("001e",16)),30,[2,1,2,1,2,3]],[String.fromCharCode(parseInt("001f",16)),31,[2,1,2,3,2,1]],[" ",32,[2,3,2,1,2,1]],["!",33,[1,1,1,3,2,3]],['"',34,[1,3,1,1,2,3]],["#",35,[1,3,1,3,2,1]],["$",36,[1,1,2,3,1,3]],["%",37,[1,3,2,1,1,3]],["&",38,[1,3,2,3,1,1]],["'",39,[2,1,1,3,1,3]],["[",40,[2,3,1,1,1,3]],[")",41,[2,3,1,3,1,1]],["*",42,[1,1,2,1,3,3]],["+",43,[1,1,2,3,3,1]],[",",44,[1,3,2,1,3,1]],["-",45,[1,1,3,1,2,3]],[".",46,[1,1,3,3,2,1]],["/",47,[1,3,3,1,2,1]],["0",48,[3,1,3,1,2,1]],["1",49,[2,1,1,3,3,1]],["2",50,[2,3,1,1,3,1]],["3",51,[2,1,3,1,1,3]],["4",52,[2,1,3,3,1,1]],["5",53,[2,1,3,1,3,1]],["6",54,[3,1,1,1,2,3]],["7",55,[3,1,1,3,2,1]],["8",56,[3,3,1,1,2,1]],["9",57,[3,1,2,1,1,3]],[":",58,[3,1,2,3,1,1]],[";",59,[3,3,2,1,1,1]],["<",60,[3,1,4,1,1,1]],["=",61,[2,2,1,4,1,1]],[">",62,[4,3,1,1,1,1]],["?",63,[1,1,1,2,2,4]],["@",64,[1,1,1,4,2,2]],["A",65,[1,2,1,1,2,4]],["B",66,[1,2,1,4,2,1]],["C",67,[1,4,1,1,2,2]],["D",68,[1,4,1,2,2,1]],["E",69,[1,1,2,2,1,4]],["F",70,[1,1,2,4,1,2]],["G",71,[1,2,2,1,1,4]],["H",72,[1,2,2,4,1,1]],["I",73,[1,4,2,1,1,2]],["J",74,[1,4,2,2,1,1]],["K",75,[2,4,1,2,1,1]],["L",76,[2,2,1,1,1,4]],["M",77,[4,1,3,1,1,1]],["N",78,[2,4,1,1,1,2]],["O",79,[1,3,4,1,1,1]],["P",80,[1,1,1,2,4,2]],["Q",81,[1,2,1,1,4,2]],["R",82,[1,2,1,2,4,1]],["S",83,[1,1,4,2,1,2]],["T",84,[1,2,4,1,1,2]],["U",85,[1,2,4,2,1,1]],["V",86,[4,1,1,2,1,2]],["W",87,[4,2,1,1,1,2]],["X",88,[4,2,1,2,1,1]],["Y",89,[2,1,2,1,4,1]],["Z",90,[2,1,4,1,2,1]],["[",91,[4,1,2,1,2,1]],["\\",92,[1,1,1,1,4,3]],["]",93,[1,1,1,3,4,1]],["^",94,[1,3,1,1,4,1]],["_",95,[1,1,4,1,1,3]],["`",96,[1,1,4,3,1,1]],["a",97,[4,1,1,1,1,3]],["b",98,[4,1,1,3,1,1]],["c",99,[1,1,3,1,4,1]],[String.fromCharCode(parseInt("00f0",16)),102,[4,1,1,1,3,1]],[String.fromCharCode(parseInt("00fa",16)),101,[3,1,1,1,4,1]],[String.fromCharCode(parseInt("00fb",16)),100,[1,1,4,1,3,1]],[String.fromCharCode(parseInt("00fe",16)),105,[2,1,1,2,3,2]],[String.fromCharCode(parseInt("00ff",16)),-1,[2,3,3,1,1,1,2]]]},upcbarcode:{startSymbol:String.fromCharCode(parseInt("00fd",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"[0-9]",symbolTable:[["0",0,[3,2,1,1]],["1",1,[2,2,2,1]],["2",2,[2,1,2,2]],["3",3,[1,4,1,1]],["4",4,[1,1,3,2]],["5",5,[1,2,3,1]],["6",6,[1,1,1,4]],["7",7,[1,3,1,2]],["8",8,[1,2,1,3]],["9",9,[3,1,1,2]],["B",0,[1,1,1,1]]]}}}(jQuery,Syncfusion),function($,ej,undefined){"use strict";ej.widget("ejDiagram","ej.datavisualization.Diagram",{element:null,model:null,_requiresID:!0,validTags:["div"],defaults:{width:"",height:"",nodes:[],connectors:[],labelRenderingMode:"html",defaultSettings:{connector:null,node:null,group:null},nodeTemplate:null,connectorTemplate:null,dataSourceSettings:{dataSource:null,query:null,tableName:null,id:"",parent:"",nodes:null,connectors:null,root:"",crudAction:{create:"",update:"",destroy:"",read:""},customFields:[],connectionDataSource:{dataSource:null,id:"",sourceNode:"",targetNode:"",sourcePointX:"",sourcePointY:"",targetPointX:"",targetPointY:"",crudAction:{create:"",update:"",destroy:"",read:""},customFields:[]}},snapSettings:{horizontalGridLines:{linesInterval:[1.25,18.75,.25,19.75,.25,19.75,.25,19.75,.25,19.75],snapInterval:[20],lineDashArray:"",lineColor:"lightgray"},verticalGridLines:{linesInterval:[1.25,18.75,.25,19.75,.25,19.75,.25,19.75,.25,19.75],snapInterval:[20],lineDashArray:"",lineColor:"lightgray"},snapConstraints:15,enableSnapToObject:!0,snapAngle:5,snapObjectDistance:5},scrollSettings:{horizontalOffset:0,verticalOffset:0,currentZoom:1,viewPortHeight:0,viewPortWidth:0,zoomFactor:.2,padding:{left:0,right:0,top:0,bottom:0}},pageSettings:{pageWidth:null,pageHeight:null,multiplePage:!1,pageBorderWidth:0,pageBackgroundColor:"#ffffff",pageBorderColor:"#565656",pageMargin:24,showPageBreak:!1,pageOrientation:"portrait",scrollLimit:"infinity",scrollableArea:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},autoScrollBorder:{left:15,top:15,right:15,bottom:15},boundaryConstraints:"infinity"},locale:"en-US",contextMenu:{items:[],showCustomMenuItemsOnly:!1},enableContextMenu:!0,enableAutoScroll:!0,tooltip:{templateId:"",relativeMode:"object",alignment:{horizontal:"center",vertical:"bottom"},margin:{left:5,right:5,top:5,bottom:5}},showTooltip:!0,layout:{bounds:null,type:"none",horizontalAlignment:"center",verticalAlignment:"top",orientation:"toptobottom",horizontalSpacing:30,verticalSpacing:30,margin:{left:0,right:0,top:0,bottom:0},marginX:0,marginY:0,fixedNode:"",getLayoutInfo:null,getConnectorSegments:null},drawingTools:{},backgroundImage:{source:"",scale:"meet",alignment:"xmidymid"},backgroundColor:"transparent",bridgeDirection:"top",version:"13.1",constraints:502,tool:null,drawType:{},selectedItems:{offsetX:0,offsetY:0,width:0,height:0,rotateAngle:0,children:[],constraints:30,userHandles:[],tooltip:{templateId:"",alignment:{horizontal:"center",vertical:"bottom"},margin:{top:10}},getConstraints:null},commandManager:{commands:{}},historyManager:{push:null,pop:null,canPop:null,canLog:null,undo:null,redo:null,startGroupAction:null,closeGroupAction:null,stackLimit:null,undoStack:[],redoStack:[]},editorFocusChange:null,nodeCollectionChange:null,templateNodeRendering:null,historyChange:null,autoScrollChange:null,itemClick:null,connectorCollectionChange:null,selectionChange:null,mouseLeave:null,mouseEnter:null,mouseOver:null,click:null,doubleClick:null,dragEnter:null,dragOver:null,dragLeave:null,drop:null,drag:null,textChange:null,sizeChange:null,connectionChange:null,rotationChange:null,contextMenuClick:null,contextMenuBeforeOpen:null,connectorSourceChange:null,connectorTargetChange:null,scrollChange:null,segmentChange:null,propertyChange:null,groupChange:null,create:null,destroy:null},observables:["nodes","connectors","locale","enableContextMenu","backgroundColor","backgroundImage","enableAutoScroll","showTooltip","bridgeDirection","tool","pageSettings.pageHeight","pageSettings.pageWidth","pageSettings.multiplePage","pageSettings.pageBorderWidth","pageSettings.pageBackgroundColor","pageSettings.pageBorderColor","pageSettings.pageMargin","pageSettings.showPageBreak","pageSettings.pageOrientation","pageSettings.scrollLimit","snapSettings.enableSnapToObject","snapSettings.snapAngle","snapSettings.snapObjectDistance","snapSettings.snapConstraints","dataSourceSettings.id","dataSourceSettings.parent","dataSourceSettings.root","dataSourceSettings.dataSource","dataSourceSettings.tableName","dataSourceSettings.query","layout.type","layout.orientation","layout.horizontalSpacing","layout.verticalSpacing","layout.marginX","layout.marginY","layout.fixedNode","selectedItems.offsetX","selectedItems.offsetY","selectedItems.width","selectedItems.height","selectedItems.rotateAngle","scrollSettings.horizontalOffset","scrollSettings.verticalOffset","scrollSettings.zoomFactor","tooltip.templateId","tooltip.relativeMode","tooltip.alignment.horizontal","tooltip.alignment.vertical","contextMenu.items","contextMenu.showCustomMenuItemsOnly"],nodes:ej.util.valueFunction("nodes"),connectors:ej.util.valueFunction("connectors"),locale:ej.util.valueFunction("locale"),enableContextMenu:ej.util.valueFunction("enableContextMenu"),enableAutoScroll:ej.util.valueFunction("enableAutoScroll"),showTooltip:ej.util.valueFunction("showTooltip"),bridgeDirection:ej.util.valueFunction("bridgeDirection"),tool:ej.util.valueFunction("tool"),_backgroundColor:ej.util.valueFunction("backgroundColor"),_backgroundImage:ej.util.valueFunction("backgroundImage"),_pageHeight:ej.util.valueFunction("pageSettings.pageHeight"),_pageWidth:ej.util.valueFunction("pageSettings.pageWidth"),_multiplePage:ej.util.valueFunction("pageSettings.multiplePage"),_pageBorderWidth:ej.util.valueFunction("pageSettings.pageBorderWidth"),_pageBackgroundColor:ej.util.valueFunction("pageSettings.pageBackgroundColor"),_pageBorderColor:ej.util.valueFunction("pageSettings.pageBorderColor"),_pageMargin:ej.util.valueFunction("pageSettings.pageMargin"),_showPageBreak:ej.util.valueFunction("pageSettings.showPageBreak"),_pageOrientation:ej.util.valueFunction("pageSettings.pageOrientation"),_scrollLimit:ej.util.valueFunction("pageSettings.scrollLimit"),_enableSnapToObject:ej.util.valueFunction("snapSettings.enableSnapToObject"),_snapConstraints:ej.util.valueFunction("snapSettings.snapConstraints"),_snapAngle:ej.util.valueFunction("snapSettings.snapAngle"),_snapObjectDistance:ej.util.valueFunction("snapSettings.snapObjectDistance"),_selectorOffsetX:ej.util.valueFunction("selectedItems.offsetX"),_selectorOffsetY:ej.util.valueFunction("selectedItems.offsetY"),_selectorWidth:ej.util.valueFunction("selectedItems.width"),_selectorHeight:ej.util.valueFunction("selectedItems.height"),_selectorRotateAngle:ej.util.valueFunction("selectedItems.rotateAngle"),_horizontalOffset:ej.util.valueFunction("scrollSettings.horizontalOffset"),_verticalOffset:ej.util.valueFunction("scrollSettings.verticalOffset"),zoomFactor:ej.util.valueFunction("scrollSettings.zoomFactor"),_layoutType:ej.util.valueFunction("layout.type"),_layoutOrientation:ej.util.valueFunction("layout.orientation"),_horizontalSpacing:ej.util.valueFunction("layout.horizontalSpacing"),_verticalSpacing:ej.util.valueFunction("layout.verticalSpacing"),_layoutMarginX:ej.util.valueFunction("layout.marginX"),_layoutMarginY:ej.util.valueFunction("layout.marginY"),_fixedNode:ej.util.valueFunction("layout.fixedNode"),_dataSourceUniqueId:ej.util.valueFunction("dataSourceSettings.id"),_dataSourceParentId:ej.util.valueFunction("dataSourceSettings.parent"),_dataSource:ej.util.valueFunction("dataSourceSettings.dataSource"),_dataSourceTableName:ej.util.valueFunction("dataSourceSettings.tableName"),_dataSourceQueryString:ej.util.valueFunction("dataSourceSettings.query"),_dataSourceRoot:ej.util.valueFunction("dataSourceSettings.root"),_tooltipTemplateId:ej.util.valueFunction("tooltip.templateId"),_horizontalTooltipAlignment:ej.util.valueFunction("tooltip.alignment.horizontal"),_verticalTooltipAlignment:ej.util.valueFunction("tooltip.alignment.vertical"),_tooltipMode:ej.util.valueFunction("tooltip.relativeMode"),_showCustomContextMenuItems:ej.util.valueFunction("contextMenu.showCustomMenuItemsOnly"),_contextMenuItems:ej.util.valueFunction("contextMenu.items"),dataTypes:{nodes:"data",connectors:"data",contextMenu:{items:"array"},dataSourceSettings:{dataSource:"data"},defaultSettings:{connector:{segments:"data",labels:"data"},node:{children:"data",gradient:{stops:"data"},labels:"data",lanes:"data",phases:"data",points:"data",ports:"data"},group:{children:"data",gradient:{stops:"data"},labels:"data",lanes:"data",phases:"data",points:"data",ports:"data"}},snapSettings:{horizontalGridLines:{linesInterval:"data",snapInterval:"data"},verticalGridLines:{linesInterval:"data",snapInterval:"data"}},selectedItems:{children:"data",userHandles:"data"}},_doubleClickEvent:!1,_nodes:[],_connectors:[],_canvas:null,_svg:null,_toolToActivate:null,_inAction:!1,_isPinching:!1,_isEditing:!1,_nodeToHit:null,_enableAPIMethods:!0,_currentCursor:null,_pasteIndex:null,_page:null,_view:null,_currentLabel:null,_zOrder:0,_clipboardData:null,_currZoom:1,_UndoRedo:!0,_mouseEventTriggered:!1,_selectedItem:"",_historyList:{currentEntry:{next:null,previous:null},canUndo:!1,canRedo:!1},_historyCount:0,_lastbefore:null,_defaultContextMenuItems:[{name:"cut",text:"Cut"},{name:"copy",text:"Copy"},{name:"paste",text:"Paste"},{name:"undo",text:"Undo"},{name:"redo",text:"Redo"},{name:"selectAll",text:"Select All"},{name:"grouping",text:"Grouping",subItems:[{name:"group",text:"Group"},{name:"ungroup",text:"Ungroup"}]},{name:"order",text:"Order",subItems:[{name:"bringToFront",text:"Bring To Front"},{name:"moveForward",text:"Move Forward"},{name:"sendToBack",text:"Send To Back"},{name:"sendBackward",text:"Send Backward"}]}],_hScrollOffset:0,_vScrollOffset:0,_hScrollbar:null,_vScrollbar:null,_scrollPixel:30,_previousSelectedItems:[],_eventCause:{},_crudDeleteNodes:[],_isMobile:!1,_labelHashTable:{},activeTool:null,selectionList:[],tools:null,nameTable:{},boundaryTable:{},_init:function(){var i,r,u,n,f,t;this.boundaryTable={};this.nameTable={};this.selectionList=[];this._isInit=!0;this.nameTable={};this.boundaryTable={};i=window.SVGSVGElement?!0:!1;i&&(ej.widget.unobtrusive!==undefined&&(this.model.snapSettings.horizontalGridLines&&this.model.snapSettings.horizontalGridLines.linesInterval&&typeof this.model.snapSettings.horizontalGridLines.linesInterval=="string"&&(this.model.snapSettings.horizontalGridLines.linesInterval=JSON.parse(this.model.snapSettings.horizontalGridLines.linesInterval)),this.model.snapSettings.verticalGridLines&&this.model.snapSettings.verticalGridLines.linesInterval&&typeof this.model.snapSettings.verticalGridLines.linesInterval=="string"&&(this.model.snapSettings.verticalGridLines.linesInterval=JSON.parse(this.model.snapSettings.verticalGridLines.linesInterval)),this.model.defaultSettings.connector&&(r=ej.datavisualization.Diagram.Connector({}),this.model.defaultSettings.connector=this._equivalentPropMap(r,this.model.defaultSettings.connector)),this.model.defaultSettings.node&&(u=ej.datavisualization.Diagram.Node({}),this.model.defaultSettings.node=this._equivalentPropMap(u,this.model.defaultSettings.node))),n=this,n.model.dataSourceSettings.crudAction.read&&(f=$.ajax({type:"GET",url:n.model.dataSourceSettings.crudAction.read,async:!1,success:function(t){n.model.dataSourceSettings.dataSource=t},error:function(){}}),this._isWebAPI=!0),n.model.dataSourceSettings.connectionDataSource.crudAction.read&&(f=$.ajax({type:"GET",url:n.model.dataSourceSettings.connectionDataSource.crudAction.read,async:!1,success:function(t){n.model.dataSourceSettings.connectionDataSource.dataSource=t},error:function(){}}),this._isWebAPI=!0),this.model.backgroundImage&&(typeof this.model.backgroundImage=="string"&&(t=this.model.backgroundImage),typeof this.model.backgroundImage=="function"&&(t=this.model.backgroundImage()),t&&(this.model.backgroundImage=ej.datavisualization.Diagram.BackgroundImage({source:t}))),this._layoutMarginX()&&(this.model.layout.margin.left=this.model.layout.margin.right=this._layoutMarginX()),this._layoutMarginY()&&(this.model.layout.margin.top=this.model.layout.margin.bottom=this._layoutMarginY()),this._cloneGlobalVariables(),this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch(),this._initDefaults(),this._initViews(),this._initData(),this._initCanvas(),this._initDiagramTool(),this._initVisualGuide(),this._wireEvents(),this._initHandles(),this._initContextMenu(),this._drawingTool=!1,this._isDropped=!1,this._initCommands(),this._initHistoryManager(),this.model.zoomFactor&&this.model.zoomFactor!==.2&&(this.model.scrollSettings.zoomFactor=this.model.zoomFactor),this._updateScrollSettings(this.model.scrollSettings),delete this._viewPort,this._cloneModel=$.extend(!0,{},this.model));delete this._isInit},_equivalentPropMap:function(n,t){var u={},r;for(var i in n)r=i.toLowerCase(),ej.isPlainObject(t[r])||ej.isPlainObject(t[i])?u[i]=this._equivalentPropMap(n[i],t[r]?t[r]:t[i]):(t[r]||t[i])&&(u[i]=t[r]?t[r]:t[i]);return u},refresh:function(){var t,n;if(this._updateTableNodes(),this._updateGroupChildren(this.model),this._isSwimlaneExist){for(t=this.connectors(),n=0;n<t.length;n++)t[n].zOrder=-1;delete this._isSwimlaneExist}this._updateScrollOffset(0,0);this._destroy();this.element.addClass("e-datavisualization-diagram");this._currZoom=1;this._hScrollbar=null;this._vScrollbar=null;this._view=null;this._svg=null;this._page=null;this._pageBackgroundLayer=null;this._diagramLayer=null;this._htmlLayer=null;this.clearHistory();this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch();this.model.dataSourceSettings&&this.model.dataSourceSettings.dataSource&&(this.nodes([]),this.connectors([]),this._nodes=[],this._connectors=[]);this._init()},_initCommands:function(n){var u=ej.datavisualization.Diagram.KeyModifiers,i=ej.datavisualization.Diagram.Keys,r,f,t,e;if(n)r=this.model.commandManager.commands;else{n=this.model.commandManager.commands;r={copy:{gesture:{key:i.C,keyModifiers:u.Control},_isDefault:!0},paste:{gesture:{key:i.V,keyModifiers:u.Control},_isDefault:!0},cut:{gesture:{key:i.X,keyModifiers:u.Control},_isDefault:!0},"delete":{gesture:{key:i.Delete},_isDefault:!0},undo:{gesture:{key:i.Z,keyModifiers:u.Control},_isDefault:!0},redo:{gesture:{key:i.Y,keyModifiers:u.Control},_isDefault:!0},selectAll:{gesture:{key:i.A,keyModifiers:u.Control},_isDefault:!0},nudgeUp:{parameter:"up",gesture:{key:i.Up},_isDefault:!0},nudgeRight:{parameter:"right",gesture:{key:i.Right},_isDefault:!0},nudgeDown:{parameter:"down",gesture:{key:i.Down},_isDefault:!0},nudgeLeft:{parameter:"left",gesture:{key:i.Left},_isDefault:!0},startEdit:{gesture:{key:113},_isDefault:!0},endEdit:{gesture:{key:i.Escape}},focusToNextItem:{gesture:{key:i.Tab},_isDefault:!0},focusToPreviousItem:{gesture:{key:i.Tab,keyModifiers:u.Control},_isDefault:!0},selectFocusedItem:{gesture:{key:i.Enter},_isDefault:!0}};for(f in r)this._initCommandValues(f,r[f])}for(t in n)r[t]?n[t]?(n[t]&&r[t].gesture&&n[t].gesture&&(this._isLoad||r[t]._isDefault&&delete r[t]._isDefault,n[t].gesture=ej.datavisualization.Diagram.Gesture($.extend({},!0,r[t].gesture,n[t].gesture)),this._tempCommandManager&&this._tempCommandManager.commands&&this._tempCommandManager.commands[t]._isDefault&&this._initCommandValues(t,n[t])),$.extend(r[t],!0,n[t])):r[t]=null:n[t]&&(e=ej.datavisualization.Diagram.Command(n[t]),r[t]=e);this.model.commandManager.commands=r},_initCommandValues:function(n,t){switch(n){case"copy":t.execute=$.proxy(this.copy,this);t.canExecute=$.proxy(this._canExecute,this);break;case"paste":t.execute=$.proxy(this._commandPaste,this);t.canExecute=$.proxy(this._canExecute,this);break;case"cut":t.execute=$.proxy(this.cut,this);t.canExecute=$.proxy(this._canExecute,this);break;case"delete":t.execute=$.proxy(this.remove,this);t.canExecute=$.proxy(this._canExecute,this);break;case"undo":t.execute=$.proxy(this.undo,this);t.canExecute=$.proxy(this._canExecute,this);break;case"redo":t.execute=$.proxy(this.redo,this);t.canExecute=$.proxy(this._canExecute,this);break;case"selectAll":t.execute=$.proxy(this._selectCommand,this);t.canExecute=$.proxy(this._canExecute,this);break;case"nudgeUp":case"nudgeRight":case"nudgeDown":case"nudgeLeft":t.execute=$.proxy(this._nudgeCommand,this);t.canExecute=$.proxy(this._canExecute,this);break;case"startEdit":t.execute=$.proxy(this._startEditCommand,this);t.canExecute=$.proxy(this._canExecute,this);break;case"endEdit":t.execute=$.proxy(this._endEdit,this);t.canExecute=$.proxy(this._canExecute,this);break;case"focusToNextItem":case"focusToPreviousItem":t.execute=$.proxy(this._focusToItem,this);t.canExecute=$.proxy(this._canExecute,this);break;case"selectFocusedItem":t.execute=$.proxy(this._selectFocusedItem,this);t.canExecute=$.proxy(this._canExecute,this)}},_initViews:function(n){n||(this._views=[],this._views.push(this._id));this._views[this._id]={type:"mainview",context:ej.datavisualization.Diagram.SvgContext,style:"position:relative; height:"+this.model.height+"; width:"+this.model.width+";"}},_initDefaults:function(){this.tool()||(ej.isMobile()?(this.tool(ej.datavisualization.Diagram.Tool.ZoomPan),this._isMobile=!0):this.tool(ej.datavisualization.Diagram.Tool.SingleSelect|ej.datavisualization.Diagram.Tool.MultipleSelect));this._initTools()},_initCanvas:function(n){this._renderCanvas(n)},_initVisualGuide:function(){this.model.tooltip&&(this.model.tooltip=ej.datavisualization.Diagram.Tooltip(this.model.tooltip));this.model.selectedItems&&(this.model.selectorConstraints&&(this.model.selectedItems.constraints=this.model.selectorConstraints),this.model.selectedItems.tooltip=ej.datavisualization.Diagram.Util.canEnableTooltip(this)&&this.showTooltip()?this.model.selectedItems.tooltip?ej.datavisualization.Diagram.Tooltip(this.model.selectedItems.tooltip):ej.datavisualization.Diagram.Tooltip({margin:{top:10}}):null,this.model.selectedItems.tooltip&&this.model.tooltipTemplateId&&(this.model.selectedItems.tooltip.templateId=this.model.selectedItems.tooltip.templateId||this.model.tooltipTemplateId))},_initTools:function(){this.tools={select:new ej.datavisualization.Diagram.SelectTool(this),move:new ej.datavisualization.Diagram.MoveTool(this),resize:new ej.datavisualization.Diagram.ResizeTool(this),rotate:new ej.datavisualization.Diagram.RotateTool(this),endPoint:new ej.datavisualization.Diagram.ConnectionEditTool(this),panTool:new ej.datavisualization.Diagram.PanTool(this),straightLine:new ej.datavisualization.Diagram.StraightLineTool(this),orthogonalLine:new ej.datavisualization.Diagram.OrthogonalLineTool(this),bezierLine:new ej.datavisualization.Diagram.BezierLineTool(this),phase:new ej.datavisualization.Diagram.PhaseTool(this),shapeTool:new ej.datavisualization.Diagram.ShapeTool(this),text:new ej.datavisualization.Diagram.TextTool(this)};this._toolToActivate="select";this.activeTool=this.tools[this._toolToActivate];this._registerDrawingTools()},_initDiagramTool:function(){var n=this.tool(),t;n&ej.datavisualization.Diagram.Tool.ContinuesDraw?this.model.drawType&&(t=this.model.drawType.shape?this.model.drawType.shape:this.model.drawType.type,this._drawToolShape(t,!1)):n&ej.datavisualization.Diagram.Tool.DrawOnce?this.model.drawType&&(t=this.model.drawType.shape?this.model.drawType.shape:this.model.drawType.type,this._drawToolShape(t,!0)):n&ej.datavisualization.Diagram.Tool.ZoomPan?ej.datavisualization.Diagram.Util.canPanning(this)&&(this._toolToActivate="panTool",this.activeTool=this.tools[this._toolToActivate],this.activeTool._isMouseDown=!1,this._currentCursor="pointer"):n&ej.datavisualization.Diagram.Tool.MultipleSelect&&(this.activateTool("select"),this.activeTool.singleAction=!1)},_initHandles:function(){var t=this.model.selectedItems.userHandles,n;if(t)for(n=0;n<t.length;n++)t[n]=ej.datavisualization.Diagram.UserHandle(t[n]),t[n].tool&&(t[n].tool.diagram=this,this.tools[t[n].name]=t[n].tool)},_initHistoryManager:function(){this.model.historyManager.push=$.proxy(this.addHistoryEntry,this);this.model.historyManager.pop=$.proxy(this.removeHistoryEntry,this);this.model.historyManager.canPop=$.proxy(this.canRemoveHistoryEntry,this);this.model.historyManager.startGroupAction=$.proxy(this._startGroupAction,this);this.model.historyManager.closeGroupAction=$.proxy(this._closeGroupAction,this)},_cloneGlobalVariables:function(){this._historyList=$.extend(!0,{},this._historyList)},_setNodesConnectors:function(n,t){var r=[],u=!1,f=!1,e=n.nodes?typeof n.nodes=="function"?n.nodes().length:n.nodes.length:0,o=n.connectors?n.connectors&&typeof n.connectors=="function"?n.connectors().length:n.connectors.length:0,i;if(n.nodes&&e!=this._nodes.length){for(i=0;i<this.nodes().length;i++)this._removeElementFromCollection(this.nameTable[this.nodes()[i].name]);this._isPreventModelChange=!0;this.nodes(typeof n.nodes=="function"?n.nodes():n.nodes);this._isPreventModelChange=!1;this._initNodeCollection(t);u=!0}if(n.connectors&&o!=this._connectors.length){for(i=0;i<this.connectors().length;i++)this._removeElementFromCollection(this.nameTable[this.connectors()[i].name]);this._isPreventModelChange=!0;this.connectors(typeof n.connectors=="function"?n.connectors():n.connectors);this._isPreventModelChange=!1;this._initConnectorCollection();f=!0}return r=this.nodes(),r=r.length>0?this.nodes().concat(this.connectors()):this.connectors(),(r.length>0||n.nodes.length==0||n.connectors.length==0)&&this._resetObjectCollection(r,t,u,f),!0},_removeElementFromCollection:function(n){if(n){if(n.children)for(var t=0;t<n.children.length;t++)this._removeElementFromCollection(this.nameTable[n.children[t]]);n.segments?this._removeEdges(n):(this._disConnect(n,{}),n.inEdges=n.outEdges=[]);ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[n.name],n);ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,n);this._removeElement(n);delete this.nameTable[n.name]}},_updateCloneModel:function(n){n&&(this._cloneModel[n]=typeof this.model[n]=="string"?this.model[n]:$.extend(!0,{},this.model[n]))},_compareModelProperty:function(n,t,i){if(n&&this._cloneModel[n]!==this.model[n]){var r={};r[n]=this.model[n];this._comparePropertyValues(this._cloneModel,n,r,t,i);this._updateCloneModel(n)}},_setModel:function(n){var l=!1,i,u,t,s,f,h,a,v,r;for(t in n){switch(t){case"height":case"width":this._initViews(!0);this._initCanvas(!0);break;case"nodes":case"connectors":l||this._isPreventModelChange||(l=this._setNodesConnectors(n,this._isLoad));break;case"enableContextMenu":this.model.enableContextMenu=n[t];this._initContextMenu(this._isLoad);break;case"contextMenu":this.model.contextMenu=$.extend({},this.model.contextMenu,n[t]);this._initContextMenu(this._isLoad);break;case"snapSettings":u=n[t];u&&Object.keys(u).length>0&&(this._updateSnapSettings(n[t]),ej.datavisualization.Diagram.SvgContext._renderGrid(this._canvas,this._svg,this._page,this));break;case"selectorConstraints":this._setSelectorConstraints(n[t]);break;case"constraints":if(this.model.constraints=n[t],this._hasSelection()&&!ej.datavisualization.Diagram.Util.isPageEditable(this)&&this._clearSelection(),s=this._getConnectors(),s.length>0)for(f=0;f<s.length;f++)ej.datavisualization.Diagram.Util.updateBridging(this.model.connectors[f],this),ej.datavisualization.Diagram.DiagramContext.update(this.model.connectors[f],this);break;case"drawingTools":this.model.drawingTools=n[t];this._registerDrawingTools();break;case"backgroundImage":this.model.backgroundImage=this.model.backgroundImage&&typeof this.model.backgroundImage=="string"?ej.datavisualization.Diagram.BackgroundImage({source:this.model.backgroundImage}):$.extend(!0,{},this.model.backgroundImage,n[t]);ej.datavisualization.Diagram.SvgContext._renderBackground(this,this._canvas,this._svg,this._page,this.model);break;case"backgroundColor":this.model.backgroundColor=n[t];ej.datavisualization.Diagram.SvgContext._renderBackground(this,this._canvas,this._svg,this._page,this.model);break;case"enableAutoScroll":this.enableAutoScroll(n[t]);break;case"autoScrollMargin":this.model.autoScrollMargin=n[t];break;case"layout":n[t].marginX&&(this.model.layout.margin.left=this.model.layout.margin.right=Number(typeof n[t].marginX=="function"?this._layoutMarginX():n[t].marginX));n[t].marginY&&(this.model.layout.margin.top=this.model.layout.margin.bottom=Number(typeof n[t].marginY=="function"?this._layoutMarginY():n[t].marginY));this.model.layout=$.extend(!0,{},this.model.layout,n[t]);this._setLayout(n[t]);break;case"selectedItems":this.updateSelector(n[t]);break;case"pageSettings":this.updatePageSettings(n[t]);break;case"scrollSettings":this._updateScrollSettings(n[t]);break;case"locale":this.locale(n[t]);h=document.getElementById(this.element[0].id+"_contextMenu");h.parentNode.removeChild(h);this.model.contextMenu&&this.model.contextMenu.items&&this.model.contextMenu.items.length>0&&(this.model.contextMenu.items=[]);this._renderContextMenu();break;case"nodeTemplate":this.clear();this._initData();i=this;this._views.forEach(function(n){var t=i._views[n],r=i._setNodeZOrder(t);i._renderDiagramObjects(r,t)});this.layout();break;case"bridgeDirection":case"tool":this.update(n);break;case"connectorTemplate":this._updateConnectors();break;case"commandManager":a=n[t]&&n[t].commands?n[t].commands:undefined;this._initCommands(a);break;case"historyManager":this.model.historyManager=$.extend(!0,this.model.historyManager,{},n[t]);var e=this.model.historyManager.stackLimit,o=this.model.historyManager.redoStack.length,c=this.model.historyManager.undoStack.length;o>0&&(o>e?(r=o-e,this.model.historyManager.redoStack.splice(0,r),this.model.historyManager.undoStack=[]):(v=e-o,r=c-v,this.model.historyManager.undoStack.splice(0,r)));c>0&&(r=c-e,r>0&&this.model.historyManager.undoStack.splice(0,r));this._initHistoryManager();break;case"showTooltip":this.model.showTooltip=n[t];this.model.selectedItems.tooltip=this.showTooltip()?ej.datavisualization.Diagram.Tooltip({margin:{top:10}}):null;break;case"toolTipTemplateId":this.model.selectedItems.tooltip||(this.model.selectedItems.tooltip=ej.datavisualization.Diagram.Tooltip({margin:{top:10}}));this.model.selectedItems.tooltip.templateId=n[t];break;case"tooltip":this.model.tooltip=n[t]===null?null:ej.datavisualization.Diagram.Tooltip($.extend(!0,this.model.tooltip,{},n[t]));break;case"dataSourceSettings":u=n[t];u&&Object.keys(u).length>0&&(this.clear(),$.extend(this.model.dataSourceSettings,n[t]),this._initData(),i=this,this._views.forEach(function(n){var t=i._views[n],r=i._setNodeZOrder(t);i._renderDiagramObjects(r,t)}),this.layout())}t==="nodes"||t==="connectors"||t==="selectorConstraints"||t==="selectedItems"||t==="bridgeDirection"||t==="tool"||t==="dataSourceSettings"||this._compareModelProperty(t)}},_resetObjectCollection:function(n,t,i,r){var f,u,o,e;if(i&&($(this.element).find(".ej-d-node").remove(),$(this.element).find(".ej-d-group").remove()),r)for(f=$(this.element).find(".ej-d-connector"),u=f.length-1;u>=0;u--)o=this.nameTable[f[u].id],o&&o.parent==""&&$(f[u]).remove();this._hasSelection()&&this._clearSelection();e=this;this._views.forEach(function(n){var t=e._views[n],i=e._setNodeZOrder(t);e._renderDiagramObjects(i,t)})},_getConnectors:function(){var t=[],i,n;for(i in this.nameTable)n=this.nameTable[i],(n._type==="connector"||n.segments)&&t.push(n);return t},_generateNodes:function(n){for(var u,t,i=[],r=0;r<n.length;r++)u=n[r],t=this._makeNode(u),t!=null&&t.name&&!this._findNodeByName(i,t.name)&&i.push(t);return i},_generateConnectors:function(n){for(var u,t,i=[],r=0;r<n.length;r++)u=n[r],t=this._makeLine(u),t&&t.name&&!this._findNodeByName(i,t.name)&&i.push(t);return i},_findNodeByName:function(n,t){for(var i=0;i<n.length;i++)if(n[i].name===t)return!0;return!1},_makeNode:function(n){var t=this.model.dataSourceSettings,r={},u=n[t.id],i;if(u){if(r.name=u,t.customFields&&t.customFields.length>0)for(i=0;i<t.customFields.length;i++)r[t.customFields[i]]=n[t.customFields[i]];return r}return null},_makeLine:function(n){var t=this.model.dataSourceSettings.connectionDataSource,i={},r;if(i.name=n[t.id]?n[t.id]:"connector_"+ej.datavisualization.Diagram.Util.randomId(),i.sourceNode=n[t.sourceNode],i.targetNode=n[t.targetNode],n[t.sourcePointX]&&n[t.sourcePointY]&&(i.sourcePoint={x:Number(n[t.sourcePointX]),y:Number(n[t.sourcePointY])}),n[t.targetPointX]&&n[t.targetPointY]&&(i.targetPoint={x:Number(n[t.targetPointX]),y:Number(n[t.targetPointY])}),t.customFields&&t.customFields.length>0)for(r=0;r<t.customFields.length;r++)i[t.customFields[r]]=n[t.customFields[r]];return i},insertData:function(n){var u,r,f,t,i;if(n)t=this._parameterMap(n),u=n.type==="connector"?this.model.dataSourceSettings.connectionDataSource.crudAction.create:this.model.dataSourceSettings.crudAction.create,t&&this._raiseAjaxPost(JSON.stringify({data:[t]}),u);else{if(r=this._getNewNodes(),r.nodes){for(t=[],i=0;i<r.nodes.length;i++)t.push(this._parameterMap(r.nodes[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.crudAction.create)}if(r.connectors){for(t=[],i=0;i<r.connectors.length;i++)t.push(this._parameterMap(r.connectors[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.connectionDataSource.crudAction.create)}}},updateData:function(n){var u,r,f,t,i;if(n)t=this._parameterMap(n),u=n.type==="connector"?this.model.dataSourceSettings.connectionDataSource.crudAction.update:this.model.dataSourceSettings.crudAction.update,t&&this._raiseAjaxPost(JSON.stringify({data:[t]}),u);else{if(r=this._getUpdatedNodes(),r.nodes){for(t=[],i=0;i<r.nodes.length;i++)t.push(this._parameterMap(r.nodes[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.crudAction.update)}if(r.connectors){for(t=[],i=0;i<r.connectors.length;i++)t.push(this._parameterMap(r.connectors[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.connectionDataSource.crudAction.update)}}},removeData:function(n){var u,r,f,t,i;if(n)t=this._parameterMap(n),u=n.type==="connector"?this.model.dataSourceSettings.connectionDataSource.crudAction.destroy:this.model.dataSourceSettings.crudAction.destroy,t&&this._raiseAjaxPost(JSON.stringify({data:[t]}),u);else{if(r=this._getDeletedNodes(),r.nodes){for(t=[],i=0;i<r.nodes.length;i++)t.push(this._parameterMap(r.nodes[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.crudAction.destroy)}if(r.connectors){for(t=[],i=0;i<r.connectors.length;i++)t.push(this._parameterMap(r.connectors[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.connectionDataSource.crudAction.destroy)}}},_parameterMap:function(n){var i={},t,r;if(n.type==="connector"){if(t=this.model.dataSourceSettings.connectionDataSource,t.id&&(i[t.id]=n.name),t.sourcePointX&&t.sourcePointY&&(i[t.sourcePointX]=n.sourcePoint.X,i[t.sourcePointY]=n.sourcePoint.Y),t.targetPointX&&t.targetPointY&&(i[t.targetPointX]=n.targetPoint.X,i[t.targetPointY]=n.targetPoint.Y),t.sourceNode&&(i[t.sourceNode]=n.sourceNode),t.targetNode&&(i[t.targetNode]=n.targetNode),t.customFields&&t.customFields.length>0)for(r=0;r<t.customFields.length;r++)i[t.customFields[r]]=n[t.customFields[r]]}else if(t=this.model.dataSourceSettings,t.id&&(i[t.id]=n.name),t.width&&(i[t.width]=n.width),t.height&&(i[t.height]=n.height),t.offsetX&&(i[t.offsetX]=n.offsetX),t.offsetY&&(i[t.offsetY]=n.offsetY),t.customFields&&t.customFields.length>0)for(r=0;r<t.customFields.length;r++)i[t.customFields[r]]=n[t.customFields[r]];return i},_raiseAjaxPost:function(n,t){var i=this,r=$.ajax({contentType:"application/json",type:"POST",url:t,data:this._isWebAPI?JSON.stringify(JSON.parse(n).data):JSON.stringify(JSON.parse(n)),dataType:"json",error:function(n){n.status===404&&console.log("Method not found")}})},_initData:function(){var dataSourceSettings,dataSource,nodes,connectors,dataSourceApplied,tempNodes,tempconnectors,i,collapsedNodes;if(this.model.dataSourceSettings&&(dataSourceSettings={},this.model.dataSourceSettings.dataSource&&this.model.dataSourceSettings.connectionDataSource.dataSource?(dataSourceSettings.dataSource=this.model.dataSourceSettings.dataSource,dataSourceSettings.isBinding=!0,dataSourceSettings.nodes=this._generateNodes(this.model.dataSourceSettings.dataSource),dataSourceSettings.connectors=this._generateConnectors(this.model.dataSourceSettings.connectionDataSource.dataSource)):this.model.dataSourceSettings.dataSource&&(dataSourceSettings.id=this._dataSourceUniqueId(),dataSourceSettings.parent=this._dataSourceParentId(),dataSourceSettings.root=this._dataSourceRoot(),dataSourceSettings.dataSource=this._dataSource(),dataSourceSettings.tableName=this._dataSourceTableName(),dataSourceSettings.query=this._dataSourceQueryString()),dataSource=dataSourceSettings.dataSource||this.model.dataSourceSettings.nodes||this.model.dataSourceSettings.connectors),dataSource){if(nodes=[],connectors=[],dataSourceSettings&&dataSourceSettings.isBinding)dataSourceSettings.nodes&&dataSourceSettings.nodes.length>0&&this._applyTemplate(this.model.dataSourceSettings,dataSourceSettings.nodes,nodes,"nodes"),dataSourceSettings.connectors&&dataSourceSettings.connectors.length>0&&this._applyTemplate(this.model.dataSourceSettings,dataSourceSettings.connectors,connectors,"connectors");else if(this.model.dataSourceSettings.nodes||this.model.dataSourceSettings.connectors){if(this.model.dataSourceSettings.nodes){if(dataSource=this.model.dataSourceSettings.nodes||this.model.dataSourceSettings.dataSource,dataSource)if(dataSource instanceof ej.DataManager){$.ajaxSetup({async:!1});var query=this._findQuery(this.model.dataSourceSettings.nodes,this.model.dataSourceSettings.nodeBinding),queryPromise=dataSource.executeQuery(eval(query)),diagram=this;queryPromise.done(function(n){diagram.retriveData=n.result;diagram._applyTemplate(diagram.model.dataSourceSettings,n.result,nodes,"nodes")})}else this._applyTemplate(this.model.dataSourceSettings,dataSource,nodes,"nodes");this.model.dataSourceSettings.connectors&&(dataSource=this.model.dataSourceSettings.connectors||this.model.dataSourceSettings.dataSource,dataSource&&(dataSource instanceof ej.DataManager?($.ajaxSetup({async:!1}),query=this._findQuery(this.model.dataSourceSettings.connectors,this.model.dataSourceSettings.connectorBinding),queryPromise=dataSource.executeQuery(eval(query)),queryPromise.done(function(n){diagram.retriveData=n.result;diagram._applyTemplate(diagram.model.dataSourceSettings,n.result,connectors,"connectors")})):this._applyTemplate(this.model.dataSourceSettings,dataSource,connectors,"connectors")))}}else dataSource instanceof ej.DataManager?(this._initDataSource(dataSourceSettings,nodes,connectors),dataSourceSettings.parent&&(dataSourceApplied=!0)):typeof dataSource!="string"&&dataSource.length&&(this._applyDataSource(dataSourceSettings,dataSource,nodes,connectors),this.model.dataSourceSettings.parent&&(dataSourceApplied=!0));for(tempNodes=[],tempconnectors=[],this.nodes().length>0&&(tempNodes=this.nodes()),this.connectors().length>0&&(tempconnectors=this.connectors()),this.nodes(nodes),this.connectors(connectors),i=0;i<tempNodes.length;i++)this.nodes().push(tempNodes[i]),this._nodes=$.extend(!0,[],this.nodes());for(i=0;i<tempconnectors.length;i++)this.connectors().push(tempconnectors[i]),this._connectors=$.extend(!0,[],this.connectors())}collapsedNodes=this._initNodeCollection(!1,dataSourceApplied);this._initConnectorCollection(dataSourceApplied);collapsedNodes.length>0&&this._collapseNodes(collapsedNodes);this._cloneModel=$.extend(!0,{},this.model)},_getNodeTemplate:function(){var n;return this.model.nodeTemplate&&(typeof this.model.nodeTemplate=="string"&&(n=ej.util.getObject(this.model.nodeTemplate,window)),$.isFunction(this.model.nodeTemplate)&&(n=this.model.nodeTemplate)),n},_getConnectorTemplate:function(){var n;return this.model.connectorTemplate&&(typeof this.model.connectorTemplate=="string"&&(this.model.connectorTemplate=ej.util.getObject(this.model.connectorTemplate,window)),$.isFunction(this.model.connectorTemplate)&&(n=this.model.connectorTemplate)),n},_initNodeCollection:function(n,t){var f=[],r=this.nodes(),e=this.nodes().length,u,i;for(this.model.dataSourceSettings.dataSource||(u=this._getNodeTemplate()),this._isNodeInitializing=!0,i=0;i<e;i++)r[i].container&&!$.isEmptyObject(r[i].container)||r[i].isSwimlane||r[i].type==="swimlane"?r[i]=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,r[i]):typeof r[i].shape!="object"&&(r[i]=ej.datavisualization.Diagram.NodeType(r[i],this)),r[i].name==""&&(r[i].name="node_"+ej.datavisualization.Diagram.Util.randomId()),r[i].type==="swimlane"||r[i].isSwimlane?this.nameTable[r[i].name]=ej.datavisualization.Diagram.Group(r[i]):r[i]._type==="group"||r[i].children&&r[i].children.length>0?(r[i]=r[i].type=="bpmn"&&r[i].container?ej.datavisualization.Diagram.ContainerHelper._initContainer(this,r[i]):this._getNewGroup(r[i]),r[i]._type="group",this.nameTable[r[i].name]=r[i],this._initGroupNode(r[i]),n||r[i].type==="bpmn"||this._udpateChildRotateAngle(r[i])):t?r[i].shape&&typeof r[i].shape=="object"&&ej.datavisualization.Diagram.Util._updateShapeProperties(r[i]):(r[i]=this._getNewNode(r[i]),this.nameTable[r[i].name]=r[i]),!t&&u&&u(this,r[i]),r[i]._type==="node"&&r[i].labels.length&&(r[i].width==0||r[i].height==0)&&this._getNodeDimension(r[i]),this.nameTable[r[i].name]=r[i],this._updateQuad(r[i]),r[i].isExpanded||f.push(r[i]);return delete this._isNodeInitializing,this._nodes=$.extend(!0,[],r),f},_initConnectorCollection:function(n){for(var i=this.connectors(),t,u=this._getConnectorTemplate(),r=0,f=i.length;r<f;r++)t=n?i[r]:this._getNewConnector(i[r]),this.nameTable[t.name]=t,n||this.model.layout&&this._layoutType()===ej.datavisualization.Diagram.LayoutTypes.None&&this._dock(t,this.nameTable),this._updateEdges(t),u&&!n&&u(this,t),i[r]=t;this._connectors=$.extend(!0,[],i)},_initDataSource:function(dataSourceSettings,nodes,connectors){var dataSource=dataSourceSettings.dataSource,diagram=this,mapper,query,queryPromise;dataSource.dataSource.json&&dataSource.dataSource.json.length>0?diagram._applyDataSource(dataSourceSettings,dataSource.dataSource.json,nodes,connectors):dataSource.dataSource.table||(mapper=dataSourceSettings,dataSource instanceof ej.DataManager&&($.ajaxSetup({async:!1}),query=this._findQuery(mapper,dataSourceSettings.nodeBinding),queryPromise=dataSourceSettings.dataSource.executeQuery(eval(query)),queryPromise.done(function(n){diagram.retriveData=n.result;diagram._applyDataSource(dataSourceSettings,n.result,nodes,connectors)})))},_findQuery:function(n,t){var u=[],e=ej.Query(),h=n.query||this.model.dataSourceSettings.query,c,o,r,i,s,f;if(ej.isNullOrUndefined(h)){c=n.dataSource||this.model.dataSourceSettings.dataSource;o=n.tableName||this.model.dataSourceSettings.tableName;for(r in n)r==="tableName"||r==="dataSource"||r==="designTemplate"||r.match("Binding")||n[r]&&u.push(n[r]);for(i in t)if(i==="labels")for(s=t[i],f=0;f<s.length;f++)s[f].text&&u.push(s[f].text);else i=="shape"||i=="line"?t[i][type]&&r.push(t[i][type]):t[i]&&u.push(t[i]);u.length>0&&e.select(u);c.dataSource.url.match(o+"$")||ej.isNullOrUndefined(o)||e.from(o)}else e=h;return e},_updateMultipleRootNodes:function(n,t,i){var r=n[i.parent],u,f;if(r&&r.length>0)for(f=0;f<r.length;f++)u=r[f],t[u]?t[u].items.push(n):t[u]={items:[n]};return t},_applyDataSource:function(n,t,i,r){for(var u=[],v,s,c,p,l,e,f,o,a,y,w,h=0;h<t.length;h++)f=t[h],$.isArray(f[n.parent])?u=this._updateMultipleRootNodes(f,u,n,t):u[f[n.parent]]?u[f[n.parent]].items.push(f):u[f[n.parent]]={items:[f]},n.root===f[n.id]&&(v={items:[f]});if(o=[],n.parent)if(v)o.push(v);else for(e in u)(e||e===0)&&e!="undefined"&&e!='""'&&e!="null"||o.push(u[e]);else o.push(u[undefined]);for(this.model.nodeTemplate&&(y=this._getNodeTemplate()),this.model.connectorTemplate&&(w=this._getConnectorTemplate()),s=0;s<o.length;s++)for(c=0;c<o[s].items.length;c++)p=o[s].items[c],l=this._applyNodeTemplate(n,p,y),i.push(l),n.parent&&(a=u[l[n.id]],a&&a.items&&this._renderChildNodes(n,a,l.name,i,r,u,y,w))},_getNewNodes:function(){var t=[],i=[],r,n;for(r in this.nameTable)n=this.nameTable[r],n&&n.type==="connector"&&n._status==="new"?(n._status="",i.push(n)):n&&n._status==="new"&&(n._status="",t.push(n));return{nodes:t,connectors:i}},_getUpdatedNodes:function(){var t=[],i=[],r,n;for(r in this.nameTable)n=this.nameTable[r],n&&n.type==="connector"&&n._status==="update"?(n._status="",i.push(n)):n&&n._status==="update"&&(n._status="",t.push(n));return{nodes:t,connectors:i}},_getDeletedNodes:function(){for(var n,i=[],r=[],t=0;t<this._crudDeleteNodes.length;t++)n=this._crudDeleteNodes[t],n&&n.type==="connector"?r.push(n):n&&i.push(n);return this._crudDeleteNodes=[],{nodes:i,connectors:r}},_isContainsSameConnector:function(n,t,i){var r,u;if(t&&i)for(r=0;r<n.length;r++)if(u=n[r],u&&u.sourceNode===t&&u.targetNode===i)return!0;return!1},_renderChildNodes:function(n,t,i,r,u,f,e,o){for(var c,s,l,h=0;h<t.items.length;h++)c=t.items[h],s=this._applyNodeTemplate(n,c,e),this._collectionContains(s.name,r)||r.push(s),this._isContainsSameConnector(u,i,s.name)||u.push(this._applyConnectorTemplate(n,null,i,s.name,o)),l=f[c[n.id]],l&&this._renderChildNodes(n,l,s.name,r,u,f,e,o)},_applyTemplate:function(n,t,i,r){var f,u,e,o,s;if(this.model.nodeTemplate&&(f=this._getNodeTemplate()),this.model.connectorTemplate&&(s=this._getConnectorTemplate()),r=="nodes")for(u=0;u<t.length;u++)e=this._applyNodeTemplate(n,t[u],f),i.push(e);if(r=="connectors")for(u=0;u<t.length;u++)o=this._applyConnectorTemplate(n,t[u],t[u].sourceNode,t[u].targetNode,s),i.push(o)},_applyNodeTemplate:function(n,t,i){var r=t;return r.name!==""&&r.name||(r.name=ej.datavisualization.Diagram.Util.randomId()),r=r.type!="group"?this._getNewNode(r):this._getNewGroup(r),i&&i(this,r),r._type==="group"&&this._initGroupNode(r),r},_applyConnectorTemplate:function(n,t,i,r,u){var f={};return f.name=t&&t.name?t.name:ej.datavisualization.Diagram.Util.randomId(),f.sourceNode=i,f.targetNode=r,f=this._getNewConnector(f),u&&u(this,f),f},_collapseNodes:function(n){for(var i,t=0;t<n.length;t++)i=n[t],this._collapseChildren(i)},_getNewNode:function(n){return n.shape&&typeof n.shape=="object"&&ej.datavisualization.Diagram.Util._updateShapeProperties(n),ej.datavisualization.Diagram.Node($.extend(!0,{},this.model.defaultSettings.node,n))},_getNewGroup:function(n){var t=null,i=0,r;if(n.type=="bpmn"&&(n=ej.datavisualization.Diagram.Util._updateBpmnChild(ej.datavisualization.Diagram.Node(n),this)),n.children&&n.children.length>0)for(r in n.children)t=this.nameTable[this._getChild(n.children[r])],t&&(ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t.name],t),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,t),t.segments?(i=this.connectors().indexOf(t),delete this.nameTable[t.name],this.nameTable[t.name]=this._getNewConnector(t),i>=0&&(this.connectors()[i]=this.nameTable[t.name]),this._dock(this.nameTable[t.name],this.nameTable),ej.datavisualization.Diagram.Util.updateBridging(this.nameTable[t.name],this)):t._type==="node"?(i=this.nodes().indexOf(t),delete this.nameTable[t.name],this.nameTable[t.name]=this._getNewNode(t),i>=0&&(this.nodes()[i]=this.nameTable[t.name])):t._type==="group"&&(i=this.nodes().indexOf(t),delete this.nameTable[t.name],this.nameTable[t.name]=this._getNewGroup(t),i>=0&&(this.nodes()[i]=this.nameTable[t.name])));return ej.datavisualization.Diagram.Group($.extend(!0,{},this.model.defaultSettings.group,n))},_isEmptyDiagramObject:function(n){if($.isEmptyObject(n))return!0;for(var t in n)if(typeof n[t]=="object")return this._isEmptyDiagramObject(n[t]);return!1},_getNewConnector:function(n){var t=$.extend(!0,{},this.model.defaultSettings.connector,n),r,u,i;return this.model.layout&&this.model.layout.type=="organizationalchart"&&(t=$.extend(!0,{},{segments:[{type:"orthogonal"}]},t)),this.model.defaultSettings.connector&&this.model.defaultSettings.connector.segments&&this.model.defaultSettings.connector.segments[0]&&(t.defaultType=this.model.defaultSettings.connector.segments[0].type),t.shape&&!this._isEmptyDiagramObject(t.shape)&&(t.shape.type=="umlactivity"&&(t=ej.datavisualization.Diagram.UMLConnectorShape(t),t.sourceNode&&(r=this.nameTable[t.sourceNode]),t.targetNode&&(u=this.nameTable[t.targetNode]),i=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(u,r,t,this),t.targetNode=i?i.name:null),t.shape.type=="umlclassifier"?(t=ej.datavisualization.Diagram.UMLConnectorShape(t),t.sourceNode&&(r=this.nameTable[t.sourceNode]),t.targetNode&&(u=this.nameTable[t.targetNode]),i=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(u,r,t,this),t.targetNode=i?i.name:null):(t.shape=$.extend(!0,{},ej.datavisualization.Diagram.ConnectorShapeDefaults,t.shape),t.shape.flow=="sequence"&&(t.shape.sequence=="normal"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],targetDecorator:{shape:"arrow"},lineWidth:2},t)),t.shape.sequence=="conditional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],targetDecorator:{shape:"arrow"},lineWidth:2},t),t.sourceDecorator={shape:"diamond",fillColor:"white",width:20,height:10}),t.shape.sequence=="default"&&(t=$.extend(!0,{segments:[{type:"straight"}],targetDecorator:{shape:"arrow"},lineWidth:2},t))),t.shape.flow=="association"&&(t.shape.association=="directional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],lineWidth:2,lineDashArray:"2 2",targetDecorator:{shape:"openarrow",width:5,height:10}},t)),t.shape.association=="nondirectional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],lineWidth:2,lineDashArray:"2 2",targetDecorator:{shape:"none"}},t)),t.shape.association=="bidirectional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],lineWidth:2,lineDashArray:"2 2",targetDecorator:{shape:"openarrow",width:5,height:10}},t),t.sourceDecorator={shape:"openarrow",width:5,height:10})),t.shape.flow=="message"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],sourceDecorator:{shape:"circle",fillColor:"white"},targetDecorator:{shape:"arrow",fillColor:"white"},lineWidth:2,lineDashArray:"4 4"},t)))),ej.datavisualization.Diagram.Util._initConnectionEnds(t,this),ej.datavisualization.Diagram.Connector(t)},_setOverview:function(n,t){var i,r,u;n?(this._overview=n,this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),this._views[n._id]||(this._views.push(n._id),this._views[n._id]={context:ej.datavisualization.Diagram.SvgContext,type:"overview"},n._renderDocument(this._views[n._id]),i=this._views[n._id],r=this._setNodeZOrder(i),this._renderDiagramObjects(r,i,null,!0),n._updateOverview(i)),delete this._viewPort):(n=$("#"+t).ejOverview("instance"),n._removeDocument(this._views[t]),this._views[t]=undefined,u=this._views.indexOf(t),this._views.splice(u,1))},_updateScrollOffset:function(n,t,i){this._hScrollOffset=Number(n);this._vScrollOffset=Number(t);this._verticalOffset(Number(t));this._horizontalOffset(Number(n));this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);ej.datavisualization.Diagram.ScrollUtil._transform(this,n,t,i);var r=this;this._views.forEach(function(i){var f=r._views[i],u;f.type=="overview"&&(u=$("#"+i).ejOverview("instance"),u&&u._scrollOverviewRect(n,t,r._currZoom))});this.model.scrollSettings.viewPortHeight=this._viewPort.height;this.model.scrollSettings.viewPortWidth=this._viewPort.width;this.model.scrollSettings.currentZoom=this._currZoom},_getChild:function(n){return ej.datavisualization.Diagram.Util.getChild(n)},_getChildren:function(n){var i,r,t;if(n){for(i=[],r=0;r<n.length;r++)t=n[r],t&&(typeof t=="object"?i.push(t.name):i.push(t));return i}},_initGroupNode:function(n,t){for(var i=null,r,u=0;n.children&&u<n.children.length;u++)r=t?$.extend(!0,{},t[this._getChild(n.children[u])]):n.children[u],i=typeof r=="string"?this.nameTable[r]:r,i&&(i._type||i.type!="umlclassifier"||(i._type="group"),i.container&&(i._type="group",i.labels=[]),r&&typeof r=="object"&&(typeof i.shape!="object"&&n.type!="bpmn"&&(i=ej.datavisualization.Diagram.NodeType(i,this)),i._type=="group"||i.children||i.segments||i.type=="connector"?i.segments||i.type=="connector"?(i=this._getNewConnector(i),i.name==""&&(i.name=ej.datavisualization.Diagram.Util.randomId())):(i=this._getNewGroup(i),i.name==""&&(i.name=ej.datavisualization.Diagram.Util.randomId()),this._initGroupNode(i)):(n.type!="bpmn"&&n.type!="umlclassifier"&&(i=this._getNewNode(i)),i.name==""&&(i.name=ej.datavisualization.Diagram.Util.randomId()),i._type=="node"&&i.labels.length&&(i.width==0||i.height==0)&&this._getNodeDimension(i)),n.children[u]=i,i.parent=n.name,this.nameTable[i.name]=i,i.segments&&this._dock(i,this.nameTable)),this._updateQuad(this.nameTable[this._getChild(n.children[u])]));this._isLoad||ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)},_udpateChildRotateAngle:function(n){var f,t,i,r,u,e;if(n.rotateAngle)for(i=ej.Matrix.identity(),ej.Matrix.rotate(i,n.rotateAngle,n.offsetX,n.offsetY),r=0;r<n.children.length;r++)t=this.nameTable[this._getChild(n.children[r])],t.rotateAngle=t.rotateAngle?t.rotateAngle+n.rotateAngle:n.rotateAngle,t.rotateAngle%=360,t.rotateAngle<0&&(t.rotateAngle+=360),t.segments?(t.sourceNode||this._setEndPoint(t,ej.Matrix.transform(i,t.sourcePoint),!1),t.targetNode||this._setEndPoint(t,ej.Matrix.transform(i,t.targetPoint),!0)):(t.type=="group"&&this._udpateChildRotateAngle(t),u=t.offsetX,f=t.offsetY,e=ej.Matrix.transform(i,ej.datavisualization.Diagram.Point(u,f)),this._translate(t,e.x-u,e.y-f,this.nameTable),this._updateAssociatedConnectorEnds(t,this.nameTable))},_getNodeDimension:function(n){var f=n._width,e=n._height,o=n.width?n.width:n.maxWidth?n.maxWidth:n.minWidth,i=document.createElement("span"),s=0,h=0,t,r,u,c;if(n.labels.length){for(ej.datavisualization.Diagram.Util.attr(i,{id:n.name+"_label","class":"ej-d-label",style:"display: inline-block; position: absolute; pointer-events: all; line-height: normal;"}),this.element[0].appendChild(i),r=0;r<n.labels.length;r++)t=n.labels[r],t.bold&&(i.style.fontWeight="bold"),t.italic&&(i.style.fontStyle="italic"),i.style.textDecoration=t.textDecoration,i.style.fontFamily=t.fontFamily,i.style.fontSize=t.fontSize+"px",i.style.color=t.fontColor,i.style.backgroundColor=t.fillColor,i.style.borderColor=t.borderColor,i.style.borderWidth=t.borderWidth+"px",i.textContent=t.text,t.wrapping=="nowrap"?(i.style.whiteSpace="nowrap",i.style.wordWrap="normal"):(t.wrapping=="wrap"&&(i.style.wordBreak="break-all"),i.style.wordWrap="break-word",i.style.whiteSpace="pre"),n.maxWidth&&(i.style.maxWidth=o-(t.margin.left+t.margin.right)-t.fontSize+"px"),n.minWidth&&(i.style.minWidth=o-(t.margin.left+t.margin.right)-t.fontSize+"px"),s+=i.offsetWidth+t.margin.left+t.margin.right+5,h+=i.offsetHeight+t.margin.top+t.margin.bottom;u=n.name.match("_attribute")?"attribute":n.name.match("_method")?"method":n.name.match("_member")?"member":"header";n._width=Math.max(n.minWidth||0,s||0);n.maxWidth&&(n._width=Math.min(n.maxWidth,n._width));n._height=Math.max(n.minHeight||0,h||0);n.maxHeight&&(n._height=Math.min(n.maxHeight,n._height));n.width||n.labels[0].horizontalAlignment!="left"||u=="attribute"||u=="method"||u=="member"||(n.offsetX+=(n._width-f)/2);n.width||n.labels[0].horizontalAlignment!="right"||(n.offsetX-=(n._width-f)/2);n.height||n.labels[0].verticalAlignment!="top"||(n.offsetY+=(n._height-e)/2);n.height||n.labels[0].verticalAlignment!="bottom"||(n.offsetY-=(n._height-e)/2);n.parent&&(c=this.nameTable[n.parent]);this.element[0].removeChild(i)}},_getMinMaxSize:function(n,t,i,r,u){var s=null,h=null,l,f,e,c,a,o;return t>=n.minWidth&&t<=n.maxWidth?s=t:n.horizontalAlign!="stretch"||!n.parent||r||u?u?(f=this.nameTable[n.parent],f&&(e=ej.datavisualization.Diagram.Util.bounds(f),o=this._getMinMaxSize(f,e.width,e.height),s=o.width?o.width:t)):s=t<n.minWidth&&n.minWidth!=0?n.minWidth:t>n.maxWidth&&n.maxWidth!=0&&!n.isSwimlane?n.maxWidth:t:(f=this.nameTable[n.parent],f&&(e=ej.datavisualization.Diagram.Util.bounds(f),e.width==0&&e.height==0&&(e.width=t,e.height=i),o=this._getMinMaxSize(f,e.width,e.height),f.isSwimlane&&f.orientation=="vertical"&&(l=this.nameTable[f.children[0]],l&&(o.height-=l.height)),o.width-=f.paddingLeft+f.paddingRight+f.marginLeft+f.marginRight,o.height-=f.paddingTop+f.paddingBottom+f.marginTop+f.marginBottom,s=o.width?o.width:t)),i>=n.minHeight&&i<=n.maxHeight?h=i:(f=this.nameTable[n.parent],n.verticalAlign!="stretch"||!n.parent||r||n.isLane?h=i<n.minHeight&&n.minHeight!=0?n.minHeight:i>n.maxHeight&&n.maxHeight!=0?n.maxHeight:i:(e=ej.datavisualization.Diagram.Util.bounds(f),e.width==0&&e.height==0&&(c=null,a=!1,e.width=n.minWidth,e.height=n.minHeight,(n.minWidth==0||n.minHeight==0)&&(e.width=t,e.height=i,c=!1,a=!0),a||(c=!0)),o=this._getMinMaxSize(f,e.width,e.height),o.width-=f.paddingLeft+f.paddingRight+f.marginLeft+f.marginRight,o.height-=f.paddingTop+f.paddingBottom+f.marginTop+f.marginBottom,c&&(o.height-=n.marginTop),h=o.height?o.height:i)),{width:s,height:h}},_updateConnectorBridging:function(n){var r=[],i,t;for(this.boundaryTable[n.name]=ej.datavisualization.Diagram.Util.bounds(n),n._intersects&&n._intersects.length&&(r=n._intersects),i=0;i<r.length;i++)t=this.nameTable[r[i]],t&&t.visible&&t.segments&&t!=n&&ej.datavisualization.Diagram.Util.canBridge(t,this)&&(ej.datavisualization.Diagram.Util.updateBridging(t,this,[n]),this._disableSegmentChange||ej.datavisualization.Diagram.DiagramContext._refreshOnlySegments(t,this))},_drawToolShape:function(n,t){n=="image"||n=="native"||n=="html"||n==="text"||n==="basic"||n==="flow"||n==="arrow"||n==="bpmn"?this.activateTool("shapeTool",t):n=="straightLine"?this.activateTool("straightLine",t):n=="orthogonalLine"?this.activateTool("orthogonalLine",t):n=="bezierLine"&&this.activateTool("bezierLine",t)},_destroy:function(){if(this.element.empty().removeClass("e-datavisualization-diagram"),this.enableContextMenu()){var n=$("#"+this.element[0].id+"_contextMenu").data("ejMenu");n.destroy()}$("#"+this.element[0].id+"_contextMenu").remove()},_updateScrollSettings:function(n){var u=this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Limited?!0:!1,r=this.model.pageSettings.scrollableArea,f=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),e,t,i,o;(n.horizontalOffset!==undefined||n.verticalOffset!==undefined)&&(e={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:f},n.horizontalOffset!==undefined&&(t=Number(typeof n.horizontalOffset=="function"?n.horizontalOffset():n.horizontalOffset),(!u||t>=r.x&&t<=r.x+r.width)&&(this._scrollLimit()=="diagram"&&(t=Math.max(this._hScrollbar.model.minimum,t),t=Math.min(this._hScrollbar.model.maximum,t)),this._updateScrollOffset(t,this._verticalOffset()))),n.verticalOffset!==undefined&&(i=Number(typeof n.verticalOffset=="function"?n.verticalOffset():n.verticalOffset),(!u||i>=r.y&&i<=r.y+r.height)&&(this._scrollLimit()=="diagram"&&(i=Math.max(this._vScrollbar.model.minimum,i),i=Math.min(this._vScrollbar.model.maximum,i)),this._updateScrollOffset(this._horizontalOffset(),i))),o={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:f},this._raiseEvent("scrollChange",{newValues:o,oldValues:e}));n.zoomFactor&&this.zoomFactor(typeof n.zoomFactor=="function"?n.zoomFactor():n.zoomFactor);n.padding&&($.extend(this.model.scrollSettings.padding,n.padding),this._updateScrollOffset(this._horizontalOffset(),this._verticalOffset()))},updatePageSettings:function(n){if(n){var t=$.extend(!0,{},this.model.pageSettings);n.pageHeight&&this._pageHeight(Number(typeof n.pageHeight=="function"?n.pageHeight():n.pageHeight));n.pageWidth&&this._pageWidth(Number(typeof n.pageWidth=="function"?n.pageWidth():n.pageWidth));(typeof n.multiplePage=="function"||typeof n.multiplePage=="boolean")&&this._multiplePage(typeof n.multiplePage=="function"?n.multiplePage():n.multiplePage);(typeof n.showPageBreak=="function"||typeof n.showPageBreak=="boolean")&&this._showPageBreak(typeof n.showPageBreak=="function"?n.showPageBreak():n.showPageBreak);(n.pageBorderColor||n.pageBorderColor==="")&&this._pageOrientation(typeof n.pageOrientation=="function"?n.pageOrientation():n.pageOrientation);(n.pageBorderWidth||n.pageBorderWidth===0)&&this._pageBorderWidth(Number(typeof n.pageBorderWidth=="function"?n.pageBorderWidth():n.pageBorderWidth));(n.pageMargin||n.pageMargin===0)&&this._pageMargin(Number(typeof n.pageMargin=="function"?n.pageMargin():n.pageMargin));(n.pageBackgroundColor||n.pageBackgroundColor==="")&&this._pageBackgroundColor(typeof n.pageBackgroundColor=="function"?n.pageBackgroundColor():n.pageBackgroundColor);n.scrollLimit&&this._scrollLimit(typeof n.scrollLimit=="function"?n.scrollLimit():n.scrollLimit);n.scrollableArea&&(this.model.pageSettings.scrollableArea=n.scrollableArea);(n.pageBorderColor||n.pageBorderColor==="")&&this._pageBorderColor(typeof n.pageBorderColor=="function"?n.pageBorderColor():n.pageBorderColor);this._compareModelProperty("pageSettings");this._isUndo||this.addHistoryEntry({type:"pagesettingschanged",undoObject:t,category:"internal",redoObject:$.extend(!0,{},this.model.pageSettings)});ej.datavisualization.Diagram.PageUtil._updatePageSize(this);ej.datavisualization.Diagram.SvgContext._updateBackground(this._hScrollOffset,this._vScrollOffset,this._currZoom,this);ej.datavisualization.Diagram.SvgContext._updateGrid(this._hScrollOffset,this._vScrollOffset,this._currZoom,this)}},_updateSnapSettings:function(n){n&&(n.horizontalGridLines&&n.horizontalGridLines.linesInterval&&(this.model.snapSettings.horizontalGridLines.linesInterval=n.horizontalGridLines.linesInterval),n.verticalGridLines&&n.verticalGridLines.linesInterval&&(this.model.snapSettings.verticalGridLines.linesInterval=n.verticalGridLines.linesInterval),n.snapAngle&&this._snapAngle(Number(typeof n.snapAngle=="function"?n.snapAngle():n.snapAngle)),n.snapObjectDistance&&this._snapObjectDistance(Number(typeof n.snapObjectDistance=="function"?n.snapObjectDistance():n.snapObjectDistance)))},_cloneObject:function(n){var t,i;if((this.getObjectType(n)==="node"||this.getObjectType(n)==="connector")&&n.type!="bpmn")return $.extend(!0,{},n);if(this.getObjectType(n)!=="group"&&n.type!=="bpmn"||n.isSwimlane){if(this.getObjectType(n)==="group"&&n.isSwimlane)return this.getNode(n)}else{for(t=$.extend(!0,{},n),i=0;t.children&&t.children.length>0&&i<t.children.length;i++)t.children[i]=this._cloneObject(this.nameTable[this._getChild(t.children[i])]),t.children[i].parent=t.name;return t}},_cloneSelectionList:function(){for(var n,i,r=[],t=0&&this.selectionList&&this.selectionList.length>0;t<this.selectionList.length;t++)if(this.getObjectType(this.selectionList[t])==="pseudoGroup")for(n=this.selectionList[0],i=0;n.children&&n.children.length>0&&i<n.children.length;i++)r.push(this._cloneObject(this.nameTable[this._getChild(n.children[i])]));else r.push(this._cloneObject(this.selectionList[t]));return r},getNode:function(n,t){if(n)return this._getNode(n,t)},addPhase:function(n,t){this._addPhase(n,t)},stopEvents:function(n){this.activeTool.inAction&&!n.originalEvent.target&&n.target&&(n.originalEvent.target=n.target,this._mouseup(n))},_updateSwimlanePhase:function(n,t){var i,r;n&&t&&(t.label&&(i=this.nameTable[n.name],i&&(this._comparePropertyValues(n,"label",t),t.label=$.extend(!0,{},t.label),t.label.rotateAngle=t.orientation==="vertical"?270:0,t.label.name=i.labels[0].name,t.label.mode=ej.datavisualization.Diagram.LabelEditMode.View,n.label=t.label,this.updateLabel(i.name,i.labels[0],n.label))),(t.lineColor||t.lineDashArray||t.lineWidth)&&(r={},t.lineColor&&(this._comparePropertyValues(n,"lineColor",t),n.lineColor=t.lineColor,r.stroke=t.lineColor),t.lineDashArray&&(this._comparePropertyValues(n,"lineDashArray",t),n.lineDashArray=t.lineDashArray,r["stroke-dasharray"]=t.lineDashArray),t.lineWidth&&(this._comparePropertyValues(n,"lineWidth",t),n.lineWidth=t.lineWidth,r["stroke-width"]=t.lineWidth),ej.datavisualization.Diagram.SvgContext._updatePhaseStyle(n,r,this)),t.fillColor&&(this._comparePropertyValues(n,"fillColor",t),n.fillColor=t.fillColor,ej.datavisualization.Diagram.DiagramContext.updateNodeStyle(n,this)))},_updateNodeVisibility:function(n,t){var u,r,i,f;if(n){if(n.type==="group")for(i=0;i<n.children.length;i++)u=this.nameTable[n.children[i]],u&&this._updateNodeVisibility(u,t);if(n.isSwimlane&&(r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,n),r))for(i=0;i<r.length;i++)f=this.nameTable[r[i]],f.visible=t.visible,ej.datavisualization.Diagram.SvgContext._updatePhaseStyle(f,t,this);n.visible=t.visible}},_compareInnerProperties:function(n,t){var r=!0,i;if(n&&t)for(i in t)if(typeof n[i]=="object"){if(r=this._compareInnerProperties(n[i],t[i]),!r)return!1}else if(n[i]!==t[i])return!1;return!0},_comparePropertyValues:function(n,t,i,r,u){var e,c;if(n){var f=null,s=n,h=i,o=t.split("."),l=o.length;if(l>1)for(e=0;l>e;)if(s=s[o[e]],h=h[o[e]],e++,s&&h)e==l-1&&s[o[e]]!=h[o[e]]&&(f={element:n,cause:u?u:r?ej.datavisualization.Diagram.ActionType.Mouse:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:o[0],oldValue:s,newValue:h},this._raisePropertyChange(f));else break;else f={cause:u?u:r?ej.datavisualization.Diagram.ActionType.Mouse:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:t,oldValue:n[t],newValue:i[t]},t==="labels"||t==="ports"||t==="segments"||(typeof n[t]!="object"||this._compareInnerProperties(n[t],i[t]))&&n[t]&&(typeof n[t]=="object"||n[t]==i[t])?t==="segments"?n[t]!=i[t]&&(f.element=n):(t==="labels"||t==="ports")&&n[t].length>0&&(c=t==="ports"?this._findPort(n,i.name):this._findLabel(n,i.name),this._compareInnerProperties(c,i)||(f.element=c,f.oldValue=c,f.newValue=i)):f.element=n,f.element&&this._raisePropertyChange(f)}},updateNode:function(n,t){var r,w,b,c,o,s,k,l,a,i,v;if(n){var i=this._findNode(n),y=ej.Matrix.identity(),d,f,e,h,u=ej.datavisualization.Diagram.NodeConstraints,p=i&&(i.isSwimlane||i.isLane||i.isPhase||i.type==="phase");(p||!p)&&(this._needUpdate=!1,r=null,i&&(this._isUndo||this._isSizingCommand||this._recordPropertiesChanged(i,t,"node"),t.pivot!=undefined&&(d=ej.datavisualization.Diagram.Util.bounds(i,!0),ej.Matrix.rotate(y,i.rotateAngle,i.offsetX,i.offsetY),t.pivot.x!==undefined&&(this._comparePropertyValues(i,"pivot.x",t),w=t.pivot.x-i.pivot.x,i.pivot.x=t.pivot.x,i.offsetX+=w*(i.width||i._width||0)),t.pivot.y!==undefined&&(this._comparePropertyValues(i,"pivot.y",t),b=t.pivot.y-i.pivot.y,i.pivot.y=t.pivot.y,i.offsetY+=b*(i.height||i._height||0)),h=ej.Matrix.transform(y,{x:i.offsetX,y:i.offsetY}),i.offsetX=h.x,i.offsetY=h.y),t.offsetX!=undefined&&(f=t.offsetX-i.offsetX,this._outOfBoundsOnNudge(i,f,0)&&(r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"offsetX",oldValue:i.offsetX,newValue:i.offsetX+f},this._raisePropertyChange(r),this._translate(i,f,0,this.nameTable),i.marginLeft!=0&&(i.marginLeft+=f))),t.offsetY!=undefined&&(e=t.offsetY-i.offsetY,this._outOfBoundsOnNudge(i,0,e)&&(r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"offsetY",oldValue:i.offsetY,newValue:i.offsetY+e},this._raisePropertyChange(r),this._translate(i,0,e,this.nameTable),i.marginTop!=0&&(i.marginTop+=e))),t.rotateAngle!=undefined&&(this._comparePropertyValues(i,"rotateAngle",t),this._rotate(i,t.rotateAngle-i.rotateAngle,this.nameTable)),i.isSwimlane||i.isLane?this._updateSwimlaneSize(i,t):(c=this.tools.resize,t.width!=undefined&&(i.width=i.width?i.width:1,r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"width",oldValue:i.width,newValue:t.width},this._raisePropertyChange(r),o=!1,s=i.isLane?!0:!1,c._outOfBoundsDrag(i,t.width/i.width,1,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY))&&(this.scale(i,t.width/i.width,1,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable,o,s),i.type==="bpmn"&&i._type==="group"&&ej.datavisualization.Diagram.Util._updateGroupBounds(i,this))),t.height!=undefined&&(i.height=i.height?i.height:1,r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"height",oldValue:i.height,newValue:t.height},this._raisePropertyChange(r),o=!1,s=i.isLane?!0:!1,c._outOfBoundsDrag(i,1,t.height/i.height,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY))&&(this.scale(i,1,t.height/i.height,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable,o,s),i.type==="bpmn"&&i._type==="group"&&ej.datavisualization.Diagram.Util._updateGroupBounds(i,this)))),t.connectorPadding!=undefined&&(this._comparePropertyValues(i,"connectorPadding",t),i.connectorPadding=t.connectorPadding,this.scale(i,1,1,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable)),t.visible!=undefined&&(this._comparePropertyValues(i,"visible",t),this._updateNodeVisibility(i,t),t.visible||this._clearSelection()),t.constraints!=undefined&&(this._comparePropertyValues(i,"constraints",t),(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&((i._type!="group"||i.type==="bpmn")&&(i.constraints&u.Shadow||t.constraints&u.Shadow)&&(!(i.constraints&u.Shadow)&&t.constraints&u.Shadow?(i.constraints=t.constraints,i.type==="bpmn"&&i.children&&i.shape!="group"?(ej.datavisualization.Diagram.DiagramContext.updateBPMNNodeStyle(i,this),ej.datavisualization.Diagram.DiagramContext.renderShadow(this.nameTable[this._getChild(i.children[0])],this)):ej.datavisualization.Diagram.DiagramContext.renderShadow(i,this)):i.constraints&u.Shadow&&!(t.constraints&u.Shadow)&&(i.constraints=t.constraints,ej.datavisualization.Diagram.DiagramContext.removeShadow(i,this))),i.constraints=t.constraints,this.selectionList[0]&&this.selectionList[0].name===i.name&&(ej.datavisualization.Diagram.Util.canSelect(this.selectionList[0])?(ej.datavisualization.Diagram.SvgContext.clearSelector(this._adornerSvg,this._adornerLayer),ej.datavisualization.Diagram.SvgContext.renderSelector(this.selectionList[0],this._adornerSvg,this._adornerLayer,this._currZoom,this.model.selectedItems.constraints),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.renderUserHandles(this.model.selectedItems.userHandles,this.selectionList[0],this._adornerSvg,this.selectionList[0].type==="pseudoGroup",this._currZoom,this._adornerLayer,this)):this._clearSelection(!0)))),t.fillColor!=undefined&&(this._comparePropertyValues(i,"fillColor",t),i.fillColor=t.fillColor),t.cssClass!=undefined&&(this._comparePropertyValues(i,"cssClass",t),i.cssClass=t.cssClass),t.opacity!=undefined&&(this._comparePropertyValues(i,"opacity",t),i.opacity=t.opacity),t.borderColor!=undefined&&(this._comparePropertyValues(i,"borderColor",t),i.borderColor=t.borderColor),t.borderWidth!=undefined&&(this._comparePropertyValues(i,"borderWidth",t),i.borderWidth=t.borderWidth),t.borderDashArray!=undefined&&(this._comparePropertyValues(i,"borderDashArray",t),i.borderDashArray=t.borderDashArray),t.shadow!=undefined&&(this._comparePropertyValues(i,"shadow",t),i.type==="bpmn"&&i.children&&i.shape!="group"?(i.children[0].shadow=ej.datavisualization.Diagram.Shadow($.extend(!0,i.children[0].shadow,{},t.shadow)),ej.datavisualization.Diagram.DiagramContext.updateShadow(i.children[0],this)):(i.shadow=ej.datavisualization.Diagram.Shadow($.extend(!0,i.shadow,{},t.shadow)),ej.datavisualization.Diagram.DiagramContext.updateShadow(i,this))),t.gradient!==undefined&&(this._comparePropertyValues(i,"gradient",t),i.gradient=t.gradient===null?t.gradient:t.gradient&&t.gradient.type==="radial"?ej.datavisualization.Diagram.RadialGradient(t.gradient):ej.datavisualization.Diagram.LinearGradient(t.gradient)),t.isExpanded!==undefined&&(this._comparePropertyValues(i,"isExpanded",t),i._updateExpander=!0,t.isExpanded?(i.isExpanded=!0,this._expandChildren(i)):(i.isExpanded=!1,this._collapseChildren(i)),this._selectionContains(i)&&(k=!0,this._clearSelection(!0)),this.layout(),k&&this._addSelection(i,!0)),t.tooltip!==undefined&&(this._comparePropertyValues(i,"tooltip",t),i.tooltip=ej.datavisualization.Diagram.Tooltip($.extend(!0,i.tooltip,{},t.tooltip))),t.excludeFromLayout!=undefined&&(this._comparePropertyValues(i,"excludeFromLayout",t),i.excludeFromLayout=t.excludeFromLayout,this.layout()),t.addInfo!=undefined&&(this._comparePropertyValues(i,"addInfo",t),i.addInfo=t.addInfo),t.maxWidth!=undefined&&(this._comparePropertyValues(i,"maxWidth",t),i.maxWidth=t.maxWidth),t.maxHeight!=undefined&&(this._comparePropertyValues(i,"maxHeight",t),i.maxHeight=t.maxHeight),i=this._findNode(n),t.shape&&typeof t.shape=="object"&&(this._comparePropertyValues(i,"shape",t),ej.datavisualization.Diagram.Util._updateShapeProperties(t),i.type=="html"&&(l=document.getElementById(i.name+"_parentdiv"),l.parentNode.removeChild(l)),ej.datavisualization.Diagram.DiagramContext.setNodeShape(i,this)),this.getObjectType(i)=="node"&&(i=this._updateShape(i,t)),i&&i.type!="phase"&&(ej.datavisualization.Diagram.DiagramContext.update(i,this),i.type=="bpmn"?ej.datavisualization.Diagram.DiagramContext.updateBPMNNodeStyle(i,this):ej.datavisualization.Diagram.DiagramContext.updateNodeStyle(i,this)),this.selectionList[0]&&this.selectionList[0].name===i.name&&ej.datavisualization.Diagram.SvgContext.updateSelector(i,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)));n&&(t&&t.pathData&&(a=i._absolutePath),i=this._findNode(n),a&&(i._absolutePath=a,i._absoluteBounds=null),i&&i._type==="node"&&t&&t.type==="group"&&t.children&&t.children.length>0&&(v=!1,this._svg.document.getElementById(i.name)&&(v=!0),this.remove(i),i.borderColor="transparent",i.borderDashArray="",i.borderWidth=1,i.fillColor="#1BA0E2",i.labels=[],i.fillColor="",i.type=t.type,i.children=t.children,i=ej.datavisualization.Diagram.Group(i),this._initGroupNode(i),v&&(ej.datavisualization.Diagram.Util._updateGroupBounds(i,this),this.add(i))));i&&(i.isLane||i.isSwimlane||i.type==="phase"||i.isPhase)&&(this._needUpdate=!0,i.isLane?this._updateLane(i,t):i.isSwimlane?(this._needUpdate=!1,this._updateSwimlane(i,t,!0)):(i.type==="phase"||i.phase)&&(this._needUpdate=!1,this._updateSwimlanePhase(i,t)))}},_updateSwimlaneSize:function(n,t){var o,f,e,r,i,u;if(n)if(t.height&&(this._comparePropertyValues(n,"height",t),o=t.height-n.height,this._comparePropertyValues(n,"offsetY",{offsetY:n.offsetY+o/2})),t.width&&(this._comparePropertyValues(n,"width",t),o=t.width-n.width,this._comparePropertyValues(n,"offsetX",{offsetX:n.offsetX+o/2})),n.isSwimlane&&(t.height||t.width)){if(r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(this,n),r.length>0&&(f=this.nameTable[r[r.length-1]],f)){if(n.orientation==="vertical"){if(t.width&&t.width>n.width&&(f.minWidth=f.width+t.width-n.width,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,f,!0)),t.height)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.height>=n.height&&(u.minHeight=t.height)}else{if(t.width)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.width>=n.width&&(u.minWidth=t.width);t.height&&t.height>n.height&&(f.minHeight=f.height+t.height-n.height,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,f,!0))}ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this);ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,n,!0);ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,n)}}else if(n.isLane&&(t.height||t.width)){if(e=this.nameTable[n.parent.split("laneStack")[0]],r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(this,e),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),e&&e.orientation==="vertical"){if(t.width&&(t.minWidth=t.width,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,n,!0)),t.height)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.height>=u.height&&(u.minHeight=t.height,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,u,!0))}else{if(t.width)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.width>=u.width&&(u.minWidth=t.width,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,u,!0));t.height&&(t.minHeight=t.height,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,n,!0))}ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,e,!0);ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,e)}},_updateShape:function(n,t){var i=!1,u,r,f;return t.type&&(this._comparePropertyValues(n,"type",t),n.type=n._shape=t.type,i=!0),t.shape&&(this._comparePropertyValues(n,"shape",t),n.shape=n._shape=t.shape,i=!0),n.type!="bpmn"?(t.cornerRadius!=undefined&&(this._comparePropertyValues(n,"cornerRadius",t),n.cornerRadius=t.cornerRadius,i=!0),t.pathData&&(this._comparePropertyValues(n,"pathData",t),n.pathData=t.pathData,i=!0),t.templateId!==undefined&&(n.templateId=t.templateId,i=!0),t.html!==undefined&&(this._comparePropertyValues(n,"html",t),n.html=t.html,i=!0),t.contentId!==undefined&&(this._comparePropertyValues(n,"contentId",t),n.contentId=t.contentId,i=!0),t.source&&(this._comparePropertyValues(n,"source",t),n.source=t.source,i=!0),t.textBlock&&(this._comparePropertyValues(n,"textBlock",t),n.textBlock=t.textBlock,i=!0),t.points&&(this._comparePropertyValues(n,"points",t),n.points=t.points,i=!0),i&&(n.children&&delete n.children,n=ej.datavisualization.Diagram.NodeType(n,this),u=document.getElementById(n.name+"_parentdiv"),u&&u.parentNode.removeChild(u),ej.datavisualization.Diagram.DiagramContext.setNodeShape(n,this),this._clearSelection(!0),this._addSelection(n,!0))):(r=$.extend(!0,{},this.nameTable[n.name]),t.event&&(this._comparePropertyValues(n,"event",t),r.event=t.event,i=!0),t.trigger&&(this._comparePropertyValues(n,"trigger",t),r.trigger=t.trigger,i=!0),t.gateway&&(this._comparePropertyValues(n,"gateway",t),r.gateway=t.gateway,i=!0),t.data&&(this._comparePropertyValues(n,"data",t),r.data=$.extend(r.data,t.data),i=!0),t.activity&&(this._comparePropertyValues(n,"activity",t),r.activity=t.activity,i=!0),t.task!==undefined&&(this._comparePropertyValues(n,"task",t),r.task=$.extend(r.task,t.task),i=!0),t.annotation!==undefined&&(this._comparePropertyValues(n,"annotation",t),r.annotation=$.extend(r.annotation,t.annotation),i=!0),t.subProcess!==undefined&&(this._comparePropertyValues(n,"subProcess",t),r.subProcess=$.extend(r.subProcess,t.subProcess),i=!0),t.direction&&(this._comparePropertyValues(n,"direction",t),r.direction=t.direction,i=!0),i&&(f=this._svg.getElementById(n.name).nextSibling,this._removeElement(n),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[n.name],n),ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable[n.name]),this._nodes=$.extend(!0,[],this.nodes()),n=ej.datavisualization.Diagram.NodeType(r,this),n=n.type=="bpmn"&&n.container?ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n):this._getNewGroup(n),this._initGroupNode(n),this.nameTable[n.name]=n,this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()),this._updateQuad(n),ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this),f&&this._svg.getElementById(n.name).parentNode.insertBefore(this._svg.getElementById(n.name),this._svg.getElementById(f.id)),this._clearSelection(!0),this._addSelection(n,!0))),n},_updateObject:function(n){var r,i,t,u;if(n)if(n.type=="pseudoGroup")for(i=this._getChildren(n.children),t=0,u=i.length;t<u;t++)r=this.nameTable[i[t]],ej.datavisualization.Diagram.DiagramContext.update(r,this);else n.parent&&ej.datavisualization.Diagram.Util._updateGroupBounds(this.nameTable[n.parent],this),ej.datavisualization.Diagram.DiagramContext.update(n,this)},_udatePhaseSize:function(n,t){var i=this.nameTable[this._getChild(n.children[1])],s,o,h,f,u,r,e;if(n.orientation==="vertical"){if(i.minWidth!=t.phaseSize){if(i.width=i.maxWidth,i.minWidth=t.phaseSize,s=i.maxWidth-t.phaseSize,o=t.phaseSize/i.maxWidth,i.maxWidth=t.phaseSize,this.scale(i,o,.0001,ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable),i.children&&i.children.length>0)for(u=0;u<i.children.length;u++)r=this.nameTable[this._getChild(i.children[u])],r&&this.scale(r,o,.0001,ej.datavisualization.Diagram.Point(r.offsetX,r.offsetY),this.nameTable);e=this.nameTable[this._getChild(n.children[2])];e.marginLeft-=s}}else if(n.orientation==="horizontal"&&i.minHeight!=t.phaseSize){if(i.height=i.maxHeight,i.minHeight=t.phaseSize,h=i.maxHeight-t.phaseSize,f=t.phaseSize/i.maxHeight,f=f===Infinity?0:f,i.maxHeight=t.phaseSize,this.scale(i,.0001,f,ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable),i.children&&i.children.length>0)for(u=0;u<i.children.length;u++)r=this.nameTable[this._getChild(i.children[u])],r&&this.scale(r,.0001,f,ej.datavisualization.Diagram.Point(r.offsetX,r.offsetY),this.nameTable);e=this.nameTable[this._getChild(n.children[2])];e.marginTop-=h}},_updateLane:function(n,t){var u,i,e,f,r;n&&t&&(t.header&&(this._comparePropertyValues(this.getNode(n.name),"header",t),n.children&&n.children.length>0&&(u=this._getChild(n.children[0]),u&&(i=this.nameTable[u]),i&&(e=this._isUndo,this._isUndo=!0,this.updateLabel(i.name,i.labels[0],t.header),this._isUndo=e,t.header.fillColor&&t.header.fillColor!=i.fillColor&&this.updateNode(i.name,{fillColor:t.header.fillColor})))),t.fillColor&&t.fillColor!=n.fillColor&&(this._comparePropertyValues(n,"fillColor",t),this.updateNode(n.name,{fillColor:t.fillColor})),(t.minHeight&&t.minHeight!=n.minHeight||t.minWidth&&t.minWidth!=n.minWidth)&&(t.minHeight&&(this._comparePropertyValues(n,"minHeight",t),n.minHeight=t.minHeight),t.minWidth&&(this._comparePropertyValues(n,"minWidth",t),n.minWidth=t.minWidth),f=this.nameTable[n.parent],f&&(r=this.nameTable[f.parent],r&&ej.datavisualization.Diagram.SwimLaneContainerHelper._updateSwimlane(this,r)),ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,r),ej.datavisualization.Diagram.SvgContext.updateSelector(r,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)),t.constraints&&t.constraints!=n.constraints&&(this._comparePropertyValues(n,"constraints",t),n.constraints=t.constraints))},_updateLastPhase:function(n,t,i){var r,u,e,f;n.isSwimlane&&n.phases&&n.phases.length==1&&(r=0,u=this.nameTable[n.phases[0]],n.orientation==="horizontal"?(u.offset=n.minWidth-r,this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{width:n.minWidth-r}),i&&(f=ej.datavisualization.Diagram.Util.bounds(n),this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{offsetX:f.x+n.width/2}))):n.orientation==="vertical"&&(u.offset=n.minHeight-r,e=u.offset-r,e=e-(t.header?t.header.height:50),this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{height:e}),i&&(f=ej.datavisualization.Diagram.Util.bounds(n),this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{offsetY:(t.header?t.header.height:50)/2+f.y+n.height/2}))))},_updateSwimlane:function(n,t,i){var s,e,y,r,h,c,f,w,v,u,o;t.header&&n.children&&n.children.length>0&&(s=this._getChild(n.children[0]),s&&(e=this.nameTable[s]),e&&(y=this._isUndo,this._isUndo=!0,this._comparePropertyValues(this.getNode(n.name),"header",t),this.updateLabel(e.name,e.labels[0],$.extend({},t.header,{width:50})),t.header.fillColor&&t.header.fillColor!=e.fillColor&&this.updateNode(e.name,{fillColor:t.header.fillColor}),this._isUndo=y));for(r in t)n[r]&&t[r]!==n[r]&&(r==="offsetX"?(this._comparePropertyValues(this.getNode(n.name),"offsetX",t),h=t.offsetX-n.offsetX,this._outOfBoundsOnNudge(n,h,0)&&this._translate(n,h,0,this.nameTable)):r==="offsetY"?(this._comparePropertyValues(this.getNode(n.name),"offsetY",t),c=t.offsetY-n.offsetY,this._outOfBoundsOnNudge(n,0,c)&&this._translate(n,0,c,this.nameTable)):r!=="minWidth"&&r!=="minHeight"&&r!=="maxwidth"&&r!=="maxHeight"&&r!="width"&&r!="height"&&r!="phaseSize"&&(n[r]=t[r]));if(t.phases&&t.phases.length>0)for(u=0;u<t.phases.length;u++)f=this.nameTable[this._getChild(t.phases[u])],f&&this._updateSwimlanePhase(f,t.phases[u],!0);if(i&&(t.phaseSize||t.phaseSize===0)&&t.phaseSize!==n.phaseSize){this._comparePropertyValues(this.getNode(n.name),"phaseSize",t);t.phaseSize!=n.phaseSize&&(w=!0);var l=this.nameTable[n.name+"phaseStack"],p=this.nameTable[n.name+"laneStack"],f,a=t.phaseSize-n.phaseSize;for(u=0;u<l.children.length;u++)f=this.nameTable[this._getChild(l.children[u])],f&&(t.phaseSize=t.phaseSize===0?.0001:t.phaseSize,n.orientation==="horizontal"?f.height=t.phaseSize:f.width=t.phaseSize);n.phaseSize+=a;n.orientation==="horizontal"?p.marginTop+=a:p.marginLeft+=a;ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,l,null,n)}if(t.lanes&&t.lanes.length>0)for(u=0;u<t.lanes.length;u++)v=this.nameTable[this._getChild(t.lanes[u])],v&&this._updateLane(v,t.lanes[u]);i||(t&&t.phaseSize&&(o=!1),t.minHeight&&t.minHeight!=n.minHeight&&(this._comparePropertyValues(this.getNode(n.name),"minHeight",t),n.minHeight=t.minHeight,o=!0),t.minWidth&&t.minWidth!=n.minWidth&&(this._comparePropertyValues(this.getNode(n.name),"minWidth",t),n.minWidth=t.minWidth,o=!0),t.maxHeight&&t.maxHeight!=n.maxHeight&&(this._comparePropertyValues(this.getNode(n.name),"maxHeight",t),n.minHeight=t.maxHeight,o=!0),t.maxWidth&&t.maxWidth!=n.maxWidth&&(this._comparePropertyValues(this.getNode(n.name),"maxWidth",t),n.minWidth=t.maxWidth,o=!0),o&&!this._isUndo&&this._updateLastPhase(n,t),(t.phaseSize||t.phaseSize===0)&&t.phaseSize!=n.phaseSize&&(this._comparePropertyValues(this.getNode(n.name),"phaseSize",t),this._udatePhaseSize(n,t),t.phaseSize===0&&(n.phaseSize=0)));ej.datavisualization.Diagram.DiagramContext.update(n,this);this.selectionList[0]&&this.selectionList[0].name===n.name&&ej.datavisualization.Diagram.SvgContext.updateSelector(n,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)},updateConnector:function(n,t){var i,o,r,s,h,f;if(n&&(i=this._findConnector(n),i)){if(this._isUndo||this._recordPropertiesChanged(i,t,"connector"),(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&t.constraints!==undefined&&(this._comparePropertyValues(i,"constraints",t),i.constraints=t.constraints,ej.datavisualization.Diagram.Util.canSelect(i)||this._clearSelection(!0)),t.lineColor&&(this._comparePropertyValues(i,"lineColor",t),i.lineColor=t.lineColor),(t.cssClass||t.cssClass==="")&&(this._comparePropertyValues(i,"cssClass",t),i.cssClass=t.cssClass),(t.lineWidth||t.lineWidth===0)&&(this._comparePropertyValues(i,"lineWidth",t),i.lineWidth=t.lineWidth),t.lineDashArray!==undefined&&(this._comparePropertyValues(i,"lineDashArray",t),i.lineDashArray=t.lineDashArray),i.shape&&i.shape.type=="umlclassifier"&&t.shape&&t.shape.multiplicity!=undefined)for(i.shape.multiplicity=t.shape.multiplicity,i.shape.multiplicity=ej.datavisualization.Diagram.UMLConnectorMultiplicity(i.shape.multiplicity),o=ej.datavisualization.Diagram.ClassifierHelper.umlConnectorMultiplicity(i),r=0;r<i.labels.length;r++)i.labels[r].name==i.name+"_sourcelabel"?i.labels[r].text=o[0].text:i.labels[r].name==i.name+"_targetlabel"&&(i.labels[r].text=o[1].text);if(t.opacity!==undefined&&(this._comparePropertyValues(i,"opacity",t),i.opacity=t.opacity),t.cornerRadius!==undefined&&(this._comparePropertyValues(i,"cornerRadius",t),i.cornerRadius=t.cornerRadius),t.lineHitPadding!==undefined&&(this._comparePropertyValues(i,"lineHitPadding",t),i.lineHitPadding=t.lineHitPadding),t.sourcePadding!=undefined&&(this._comparePropertyValues(i,"sourcePadding",t),i.sourcePadding=t.sourcePadding,this._dock(i,this.nameTable)),t.targetPadding!=undefined&&(this._comparePropertyValues(i,"targetPadding",t),i.targetPadding=t.targetPadding,this._dock(i,this.nameTable)),t.visible!=undefined&&(this._comparePropertyValues(i,"visible",t),i.visible=t.visible,t.visible||this._clearSelection()),t.bridgeSpace!=undefined&&(this._comparePropertyValues(i,"bridgeSpace",t),i.bridgeSpace=t.bridgeSpace),t.tooltip!==undefined&&(this._comparePropertyValues(i,"tooltip",t),i.tooltip=ej.datavisualization.Diagram.Tooltip($.extend(!0,i.tooltip,{},t.tooltip))),t.segments&&(this._comparePropertyValues(i,"segments",t),t.segments.length>1?(s=$.extend(!0,[],t.segments),i.segments=s):i.segments=t.segments,ej.datavisualization.Diagram.Util._initConnectionEnds(i,this),this.model.defaultSettings.connector&&this.model.defaultSettings.connector.segments&&this.model.defaultSettings.connector.segments.length&&(h=this.model.defaultSettings.connector.segments[0].type),ej.datavisualization.Diagram.Util._initializeSegments(i,h),this._dock(i,this.nameTable),ej.datavisualization.Diagram.Util.updateBridging(i,this),i==this.selectionList[0]&&(ej.datavisualization.Diagram.SvgContext.clearSegments(this._adornerSvg),ej.datavisualization.Diagram.SvgContext.addSegments(this._adornerSvg,this.selectionList[0],this._currZoom))),t.targetDecorator&&(this._comparePropertyValues(i,"targetDecorator",t),f=i.targetDecorator?$.extend(!0,{},i.targetDecorator,t.targetDecorator):ej.datavisualization.Diagram.Decorator(t.targetDecorator),i.targetDecorator=f),t.sourceDecorator&&(this._comparePropertyValues(i,"sourceDecorator",t),f=i.sourceDecorator?$.extend(!0,{},i.sourceDecorator,t.sourceDecorator):ej.datavisualization.Diagram.Decorator(t.sourceDecorator),i.sourceDecorator=f),(t.sourceDecorator||t.targetDecorator)&&(ej.datavisualization.Diagram.DiagramContext.clearDecorators(i,this),ej.datavisualization.Diagram.DiagramContext.renderDecorators(i,this)),t.hasOwnProperty("sourceNode")||t.hasOwnProperty("targetNode")||t.hasOwnProperty("targetPort")||t.hasOwnProperty("sourcePort")||t.hasOwnProperty("targetPoint")||t.hasOwnProperty("sourcePoint")){if(t.sourceNode!==undefined){this._comparePropertyValues(i,"sourceNode",t);var u=this.nameTable[i.sourceNode],c=this.nameTable[t.sourceNode],l=this.nameTable[i.targetNode],e=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(c,l,i,this);t.sourceNode=e?e.name:null;u&&u.outEdges.indexOf(i.name)!=-1&&ej.datavisualization.Diagram.Util.removeItem(u.outEdges,i.name);i.sourceNode=t.sourceNode}if(t.targetNode!==undefined){this._comparePropertyValues(i,"targetNode",t);var c=this.nameTable[i.sourceNode],l=this.nameTable[t.targetNode],u=this.nameTable[i.targetNode],e=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(l,c,i,this);t.targetNode=e?e.name:null;u&&u.inEdges.indexOf(i.name)!=-1&&ej.datavisualization.Diagram.Util.removeItem(u.inEdges,i.name);i.targetNode=t.targetNode}t.targetPort!==undefined&&(this._comparePropertyValues(i,"targetPort",t),i.targetPort=t.targetPort);t.sourcePort!==undefined&&(this._comparePropertyValues(i,"sourcePort",t),i.sourcePort=t.sourcePort);t.targetPoint!==undefined&&(this._comparePropertyValues(i,"targetPoint",t),ej.datavisualization.Diagram.Util._setLineEndPoint(i,t.targetPoint,!0));t.sourcePoint!==undefined&&(this._comparePropertyValues(i,"sourcePoint",t),ej.datavisualization.Diagram.Util._setLineEndPoint(i,t.sourcePoint,!1));this._updateEdges(i);this._dock(i,this.nameTable)}ej.datavisualization.Diagram.Util.updateBridging(i,this);this._svg&&(this._updateConnectorBridging(i),ej.datavisualization.Diagram.DiagramContext.update(i,this),ej.datavisualization.Diagram.DiagramContext.updateConnectorStyle(i,this));this.selectionList[0]&&this.selectionList[0].name===i.name&&ej.datavisualization.Diagram.SvgContext.updateSelector(i,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},_updateDrawType:function(n){var u,i=!1,r,e=n.tool,t,s;if(e&ej.datavisualization.Diagram.Tool.ContinuesDraw?i=!1:e&ej.datavisualization.Diagram.Tool.DrawOnce&&(i=!0),t=n.drawType?n.drawType:this.model.drawType,t)if(t.type==="connector"){var f=this.model.defaultSettings.connector,h=f&&f.segments&&f.segments.length?f.segments[0].type:"",o=t.segments&&t.segments.length&&t.segments[0].type?t.segments[0].type:h;o==="bezier"?this.activateTool("bezierLine",i):o==="orthogonal"?this.activateTool("orthogonalLine",i):this.activateTool("straightLine",i)}else if(t.type==="text")this.activateTool("text",i);else if(t.type||t.shape){u=t.shape?t.shape:t.type;t.type=="basic"?r=ej.datavisualization.Diagram.BasicShapes:t.type=="flow"?r=ej.datavisualization.Diagram.FlowShapes:t.type=="arrow"?r=ej.datavisualization.Diagram.ArrowShapes:t.type=="bpmn"&&(r=ej.datavisualization.Diagram.BPMNShapes);for(s in r)if(r[s]==t.shape){u=t.type;break}u&&this._drawToolShape(u,i)}},update:function(n){var t,u,r,f,i;if(n.scrollSettings&&(this._eventCause.scrollChange=ej.datavisualization.Diagram.ScrollChangeCause.Unknown,this._setModel({scrollSettings:n.scrollSettings})),n.backgroundColor&&this._setModel({backgroundColor:n.backgroundColor}),n.tool&&(this.activeTool._showAllPorts(!0),t=n.tool,this.tool(t),this._compareModelProperty("tool"),t&ej.datavisualization.Diagram.Tool.ContinuesDraw||t&ej.datavisualization.Diagram.Tool.DrawOnce?this._updateDrawType(n):t&ej.datavisualization.Diagram.Tool.ZoomPan?ej.datavisualization.Diagram.Util.canPanning(this)&&(this._toolToActivate="panTool",this.activeTool=this.tools[this._toolToActivate],this.activeTool._isMouseDown=!1,this._currentCursor="pointer"):t&ej.datavisualization.Diagram.Tool.MultipleSelect&&this.activateTool("select",!1)),n.bridgeDirection)for(this.bridgeDirection(typeof n.bridgeDirection=="function"?n.bridgeDirection():n.bridgeDirection),this._compareModelProperty("bridgeDirection"),u=this.connectors(),r=0,f=u.length;r<f;r++)i=u[r],i&&ej.datavisualization.Diagram.Util.canBridge(i,this)&&(ej.datavisualization.Diagram.Util.updateBridging(i,this),ej.datavisualization.Diagram.DiagramContext.update(i,this))},bringToCenter:function(n){var t=this._currZoom,r=this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),i={x:n.x*t,y:n.y*t,width:n.width*t,height:n.height*t},u=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2;ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1,this._hScrollOffset-u,this._vScrollOffset-f,null,!1)},bringIntoView:function(n){var r=0,u=0,t=this._currZoom,o;n.right=n.right?n.right:n.x+n.width;n.bottom=n.bottom?n.bottom:n.y+n.height;var f=this._hScrollOffset,e=this._vScrollOffset,i=this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);n={x:n.x*t,y:n.y*t,width:n.width*t,height:n.height*t,right:n.right*t,bottom:n.bottom*t};o={x:this._hScrollOffset,y:this._vScrollOffset,width:i.width,height:i.height};ej.datavisualization.Diagram.Geometry.containsRect(o,n)||(n.right>-f+i.width&&(r=n.right-i.width),n.x<-f&&(r=n.x),n.bottom>-e+i.height&&(u=n.bottom-i.height),n.y<-e&&(u=n.y),ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1,this._hScrollOffset-r,this._vScrollOffset-u,null,!1))},getBridgeSegment:function(n,t,i,r,u){return"A "+r/2+" "+r/2+" "+i+" , 1 "+u+" "+t.x+","+t.y},fitToPage:function(n,t,i){var r,f,s={},u,o=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),c,a,l,e,h,v;if(i=i||{},i={top:isNaN(i.top)?25:i.top,bottom:isNaN(i.bottom)?25:i.bottom,left:isNaN(i.left)?25:i.left,right:isNaN(i.right)?25:i.right},t=t?t:"pageSettings",t=="pageSettings"&&this.model.pageSettings.pageWidth&&this.model.pageSettings.pageHeight||this.nodes().length>0||this.connectors().length>0){n=n?n:"page";t!="custom"&&(u=this._getDigramBounds(t),u.x-=this.model.scrollSettings.padding.left,u.y-=this.model.scrollSettings.padding.top,u.width+=this.model.scrollSettings.padding.left+this.model.scrollSettings.padding.right,u.height+=this.model.scrollSettings.padding.top+this.model.scrollSettings.padding.bottom);c=u.width;a=u.height;s.x=(o.width-(i.left+i.right))/c;s.y=(o.height-(i.top+i.bottom))/a;l=this._hScrollOffset;e=this._vScrollOffset;switch(n){case"width":r=s.x;f=r/this._getCurrentZoom();h=(o.width-(t!="content"?u.width:c)*r)/2-u.x*r;l+=h+(i.left-i.right)/2*r;e-=this._vScrollOffset*f;e=t!="custom"?e:e+this._vScrollOffset*f;break;case"height":r=s.y;f=r/this._getCurrentZoom();h=(o.width-(t!="content"?u.width:c)*r)/2-u.x*r;v=(o.height-(t!="content"?u.height:a)*r)/2-u.y*r;l+=h+(i.left-i.right)/2*r;e+=v+(i.top-i.bottom)/2*r;break;case"page":r=Math.min(s.x,s.y);f=r/this._getCurrentZoom();h=(o.width-(t!="content"?u.width:c)*r)/2-u.x*r;v=(o.height-(t!="content"?u.height:a)*r)/2-u.y*r;l+=h+(i.left-i.right)/2*r;e+=v+(i.top-i.bottom)/2*r}ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,f,l,e,new ej.datavisualization.Diagram.Point(0,0),!0)}else f=1/this._getCurrentZoom(),ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,f,this._hScrollOffset,this._vScrollOffset,new ej.datavisualization.Diagram.Point(0,0),!0)},exportDiagram:function(n){var h,ot,s,i,k,d,g,c,nt,tt,it,l,u,a,ht,rt,ct,v,y,r,f,lt,e,at,w,ft,o,vt,et;n=ej.datavisualization.Diagram.ExportSettings(n);n||(n={});var st=n&&n.region?n.region:"content",b=n&&n.mode?n.mode:"download",t=n.margin||{};for(t={top:isNaN(t.top)?25:t.top,bottom:isNaN(t.bottom)?25:t.bottom,left:isNaN(t.left)?25:t.left,right:isNaN(t.right)?25:t.right},i=this._getDigramBounds(st),n.bounds&&(ot=!0,i={x:isNaN(n.bounds.x)?i.x:n.bounds.x,y:isNaN(n.bounds.y)?i.y:n.bounds.y,width:n.bounds.width||i.width,height:n.bounds.height||i.height}),k=this.nodes(),r=0;r<k.length;r++)for(d=k[r],g=d.labels,c=0;c<g.length;c++)nt=g[c],nt.visible&&(tt=ej.datavisualization.Diagram.Util.getLabelbounds(this,d,nt)),tt&&(i=this._union(tt,i));if(i.x-=t.left,i.y-=t.top,i.width+=t.left+t.right,i.height+=t.top+t.bottom,it=n.fileName||"diagram",n.format!="svg"){if(this._setScaleValueforCanvas(n,i),l=this._diagramAsCanvas({bounds:i,margin:t,region:st,scaleX:n._scaleX,scaleY:n._scaleY},ot),h=n.format||"jpg",u=s=l.toDataURL(),b=="data")return s;if(!(ej.browserInfo().name==="msie"&&parseFloat(ej.browserInfo().version)<10))for(n.multiplePage?(n.pageHeight=n.pageHeight?n.pageHeight:this.model.pageSettings.pageHeight,n.pageWidth=n.pageWidth?n.pageWidth:this.model.pageSettings.pageWidth,n.pageHeight=n.pageHeight?n.pageHeight:l.width,n.pageWidth=n.pageWidth?n.pageWidth:l.height,t=n.margin||{},a=!1,n.pageOrientation==ej.datavisualization.Diagram.PageOrientations.Landscape?n.pageHeight>n.pageWidth&&(a=!0):n.pageWidth>n.pageHeight&&(a=!0),a&&(ht=n.pageWidth,n.pageWidth=n.pageHeight,n.pageHeight=ht),n.margin={top:isNaN(t.top)?0:t.top,bottom:isNaN(t.bottom)?0:t.bottom,left:isNaN(t.left)?0:t.left,right:isNaN(t.right)?0:t.right},rt=document.createElement("img"),ct={id:this.element[0].id+"_printImage",src:u},ej.datavisualization.Diagram.Util.attr(rt,ct),v=this._getMultipleImage(rt,n,!0)):v=[u],f=[],y=0;y<v.length;y++){u=v[y];u=u.replace(/^data:[a-z]*;,/,"");var yt=u.split(","),ut=atob(yt[1]),p=new ArrayBuffer(ut.length),pt=new Uint8Array(p);for(r=0;r<ut.length;r++)pt[r]=ut.charCodeAt(r);f.push(p)}}else{if(f=[],h=n.format||"svg",lt=s=this._diagramAsSvg({bounds:i,margin:t}),b=="data")return s;ej.browserInfo().name==="msie"&&parseFloat(ej.browserInfo().version)<10||(p=(new XMLSerializer).serializeToString(lt),f.push(p))}if(b=="download"){if(e=ej.browserInfo(),e.name==="msie"&&parseFloat(e.version)<10||e.name=="webkit")return at=e.name=="webkit"?"Safari":"IE-9",alert("Downloading option is not supported in "+at+", Please use the returned data"),s;for(w=0;w<f.length;w++)ft=new Blob([f[w]],{type:"application/octet-stream"}),e.name==="msie"?window.navigator.msSaveOrOpenBlob(ft,it+"."+h):(o=document.createElement("a"),vt=URL.createObjectURL(ft),o.href=vt,o.setAttribute("download",it+"."+h),document.createEvent?(et=document.createEvent("MouseEvents"),et.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),o.dispatchEvent(et)):o.fireEvent&&o.fireEvent("onclick"))}},_diagramAsSvg:function(n){var i=new ej.datavisualization.Diagram.Svg({id:"diagram_svg",width:n.bounds.width,height:n.bounds.height}),t,o,r,f,h,s,u,c;document.body.appendChild(i.document);t=this._svg.document.getElementById(this._canvas.id+"_pageBackground");t=$(t).find("#pageback")[0];t=t.cloneNode(!0);var e=this._getDigramBounds(),l=e.x,a=e.y,v=e.width,y=e.height;for(i.appendChild(t),t.setAttribute("transform","translate("+-n.bounds.x+", "+-n.bounds.y+")"),t.setAttribute("x",l),t.setAttribute("y",a),t.setAttribute("width",v),t.setAttribute("height",y),t=this._svg.document.getElementById(this._canvas.id+"_diagramLayer"),t=t.cloneNode(!0),i.appendChild(t),t.setAttribute("transform","translate("+-n.bounds.x+", "+-n.bounds.y+")"),o=this.nodes(),u=0;u<o.length;u++)if(r=o[u],r._type=="group"?ej.datavisualization.Diagram.SvgContext._renderLabelGroup(r,i,this):ej.datavisualization.Diagram.SvgContext._renderLabelsAsSvg(r,i,this),r.annotation&&r._annotation&&r._annotation.length)for(f=0;f<r._annotation.length;f++)diagram.nameTable[r._annotation[f]]&&(h=diagram.nameTable[r._annotation[f]],ej.datavisualization.Diagram.SvgContext._renderLabelsAsSvg(h,i,this));for(s=this.connectors(),u=0;u<s.length;u++)c=s[u],ej.datavisualization.Diagram.SvgContext._renderLabelsAsSvg(c,i,this);return document.body.removeChild(i.document),i.appendChild(this._svg.document.getElementById(this._canvas.id+"patterndefinition").cloneNode(!0)),i.document},_setScaleValueforCanvas:function(n,t){n._scaleX=1;n._scaleY=1;n.pageHeight=n.pageHeight?n.pageHeight:this.model.pageSettings.pageHeight;n.pageWidth=n.pageWidth?n.pageWidth:this.model.pageSettings.pageWidth;var i=n.pageHeight?n.pageHeight:t.height,r=n.pageWidth?n.pageWidth:t.width;(n.stretch==="fill"||n.stretch==="uniform"||n.stretch==="uniformtofill")&&(n._scaleX=r/t.width,n._scaleY=i/t.height,n.stretch==="uniform"?n._scaleX=n._scaleY=Math.min(n._scaleX,n._scaleY):n.stretch==="uniformtofill"&&(n._scaleX=n._scaleY=Math.max(n._scaleX,n._scaleY)),t.width=r,t.height=i);t.x*=n._scaleX;t.y*=n._scaleY},_diagramAsCanvas:function(n){var h,u,e=n.bounds,s=n.margin,t=this._getDigramBounds(),nt=this._pageBackgroundColor(),o=new ej.datavisualization.Diagram.Canvas({id:"mycanvas",width:e.width,height:e.height}),i,r,f,a,w,b,v;if(o._diagram=this,o._scaleX=n.scaleX,o._scaleY=n.scaleY,i=o.document.getContext("2d"),i.fillStyle=this._backgroundColor(),i.translate(-e.x,-e.y),i.fillRect(e.x,e.y,e.width,e.height),r=this._backgroundImage(),r&&r.source){t=this._getDigramBounds();f=new Image;f.src=r.source;var k=t.width/f.width,d=t.height/f.height,c=t.x,l=t.y,y=t.width,p=t.height,g=ej.datavisualization.Diagram.CanvasContext._isImageExportable(r);r.scale!="none"&&r.alignment!="none"?(a=r.scale=="meet"?Math.min(k,d):Math.max(k,d),y=a*f.width,p=a*f.height,r.alignment.indexOf("xmid")>-1?c+=(t.width-y)/2:r.alignment.indexOf("xmax")>-1&&(c=c+t.width-y),r.alignment.indexOf("ymid")>-1?l+=(t.height-p)/2:r.alignment.indexOf("ymax")>-1&&(l=l+t.height-p),(this._backgroundColor()=="none"||this._backgroundColor()=="transparent")&&(i.fillStyle="white",i.fillRect(t.x*n.scaleX,t.y*n.scaleY,t.width*n.scaleX,t.height*n.scaleY)),g&&i.drawImage(f,c,l,a*f.width,a*f.height)):g&&i.drawImage(f,c,l,t.width,t.height)}else i.fillStyle=nt,i.fillRect(t.x*n.scaleX-s.left,t.y*n.scaleY-s.top,t.width*n.scaleX+s.left+s.right,n.scaleY*t.height+s.top+s.bottom);for(w=this._pageBorderColor(),b=this._pageBorderWidth(),b&&(i.strokeStyle=w=="none"?"transparent":w,i.lineWidth=b,i.strokeRect(t.x*n.scaleX,t.y*n.scaleY,t.width*n.scaleX,t.height*n.scaleY)),h=this.nodes().concat(this.connectors()),h=this._sortByZIndex(h,!0),this._sortByGroupChildrenZIndex(!0),v=0;v<h.length;v++)u=h[v],u.segments?ej.datavisualization.Diagram.CanvasContext.renderConnector(u,o):u._type!=="group"||u.parent?u._type!=="node"||u.isPhase||u.parent||ej.datavisualization.Diagram.CanvasContext.renderNode(u,o):ej.datavisualization.Diagram.CanvasContext.renderGroup(u,o,this);return o.document},_renderCanvasPhase:function(n,t){var h=0,e=0,y=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,n),o,c,l,p,s,r,a,v,f;if(y)for(c=0;c<y.length;c++){if(o=this.nameTable[y[c]],l=this.nameTable[n.name],l){p=this._getChildren(l.children);p.length>1&&(s=this.nameTable[p[0]]);var u=ej.datavisualization.Diagram.Util.bounds(l),i=[],w,b=u.top+50,k=u.left+50;if(o.orientation=="vertical")for(i.push({x:0,y:0}),i.push({x:u.width,y:0}),w=ej.datavisualization.Diagram.SvgContext._convertToSVGPoints(i),h=u.x,e=u.y+o.offset,s&&(e+=s.height),r=0,a=i.length;r<a;++r)f=ej.datavisualization.Diagram.Geometry.translate(i[r],h,e),i[r]=f;else for(i.push({x:0,y:s.height?s.height:0}),i.push({x:0,y:u.height}),h=u.x+o.offset,e=u.y,r=0,a=i.length;r<a;++r)f=ej.datavisualization.Diagram.Geometry.translate(i[r],h,e),i[r]=f}for(v=0;v<i.length;v++)f=i[v],f.x*=t._scaleX,f.y*=t._scaleY;ej.datavisualization.Diagram.CanvasContext.renderPhases(o,t,i)}},_getPrintCanvasStyle:function(n,t){var i=0,r=0,u;return n&&(i=n.width,r=n.height),t&&((t.pageHeight||t.pageWidth)&&(r=t.pageHeight?t.pageHeight:r,i=t.pageWidth?t.pageWidth:i),t.pageOrientation&&(t.pageOrientation==="landscape"&&r>i?u=i:t.pageOrientation==="portrait"&&i>r&&(u=i),u&&(i=r,r=u))),{height:r,width:i}},_getMultipleImage:function(n,t,i){var ut=[],a=document.createElement("div"),r=this._getPrintCanvasStyle(n,t),v,y,w=t.margin,e=w.left,o=w.top,b=w.right,k=w.bottom,d=0,it=0,u,f,s,h;if(v=r.width+d,y=r.height+it,u=0,f=0,t&&t.multiplePage){if(a.style.height="auto",a.style.width="auto",s=n.height,h=n.width,n){var g=0,rt=0,p,c,l,nt=0,tt=0;do{do nt=r.width,tt=r.height,u+r.width>=h&&(nt=h-u),f+r.height>=s&&(tt=s-f),l=new ej.datavisualization.Diagram.Canvas({id:"multiplePrint"+g+""+rt,width:r.width,height:r.height}),c=l.document.getContext("2d"),c.drawImage(n,d+u+e,it+f+o,nt-b-e,tt-k-o,0+e,0+o,nt-b-e,tt-k-o),u+r.width>=h&&(u-=u-h),p=l.document.toDataURL(),c.restore(),u+=v,i?ut.push(p):this._printImage(a,p,g+""+rt),g++;while(u<h);rt++;g=d=u=0;f+r.height>=s&&(f-=f-s);f+=y}while(f<s)}}else{var d=0,it=0,r=this._getPrintCanvasStyle(n,t),v,y;v=r.width;y=r.height;l=new ej.datavisualization.Diagram.Canvas({id:"multiplePrint0",width:v,height:y});c=l.document.getContext("2d");c.drawImage(n,d+e,it+o,n.width-(b+e),n.height-(o+k),0+e,0+o,v-(b+e),y-(o+k));p=l.document.toDataURL();c.restore();this._printImage(a,p,0)}return i?ut:a},_printImage:function(n,t,i){var f,r,u;f=document.createElement("img");r=document.createElement("div");u={"class":"e-diagram-print-page"};ej.datavisualization.Diagram.Util.attr(r,u);u={id:this.element[0].id+"_multiplePrint_img"+i,style:"float:left",src:t};ej.datavisualization.Diagram.Util.attr(f,u);r.appendChild(f);n.appendChild(r)},print:function(n){var r,t;n=ej.datavisualization.Diagram.PrintSettings(n);var u=this.exportDiagram({mode:"data",region:n.region,margin:{top:0,bottom:0,left:0,right:0},stretch:n.stretch}),i=document.createElement("img"),f={id:this.element[0].id+"_printImage",src:u};ej.datavisualization.Diagram.Util.attr(i,f);r=this._getMultipleImage(i,n);t=window.open("");t!=null&&(t.document.write("<html><head><style> body{margin:0px;} @media print { .e-diagram-print-page {page-break-after: left; }.e-diagram-print-page:last-child {page-break-after: avoid;}} <\/style><title><\/title><\/head>"),t.document.write('<BODY onload="setTimeout(function(){window.print();}, 100)">'),t.document.write("<center>"+r.innerHTML+"<\/center>"),t.document.close())},save:function(){var t=this.model.drawingTools,i=this.model.selectedItems.userHandles,n;return this.model.drawingTools=null,this.model.selectedItems.userHandles=null,this.nameTable.multipleSelection&&(ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable.multipleSelection),this._nodes=$.extend(!0,[],this.nodes())),this._updateTableNodes(),n=jQuery.extend(!0,{},this.model),ej.version&&(n.version=ej.version),this._updateGroupChildren(n),this.model.drawingTools=t,this.model.selectedItems.userHandles=i,this._checkForNullValues(n),n},_checkForNullValues:function(n){this._checkTargetNull(n.pageSettings)},_checkTargetNull:function(n){for(var t in n)n[t]==null||n[t]==Infinity?n[t]=0:typeof n[t]=="object"&&n[t]&&this._checkTargetNull(n[t])},_updateGroupChildren:function(n){var i=[],r,t;if(n&&n.nodes&&n.nodes.length>0)for(t=0;t<n.nodes.length;t++)n.nodes[t].parent!==""||n.nodes[t].isSwimlane?n.nodes[t].isSwimlane&&(r=this._getNode(n.nodes[t].name),this._isSwimlaneExist=!0,r&&i.push(jQuery.extend(!0,{},r))):(this._updateChildren(n.nodes[t]),i.push(jQuery.extend(!0,{},n.nodes[t])));n.nodes=i},_updateChildren:function(n){var u=[],i,r,t;if(n&&n.children&&n.children.length>0)for(t=0;t<n.children.length;t++)r=this._getChild(n.children[t]),r&&(i=this.nameTable[r]),i&&u.push(jQuery.extend(!0,{},i));n.children=u},_containsNode:function(n){var t,i;for(n=this._getChild(n),t=null,i=0;i<this.nodes().length;i++)if(t=this.nodes()[i],t&&t.name===n)return!0;return null},_updateTableNodes:function(){var n=0,t,i;for(n;n<this.nodes().length;n++)t=this.nameTable[this.nodes()[n].name],t&&(this.nodes()[n]=t,t._type==="group"&&this._updateTableGroup(t));for(n;n<this.connectors().length;n++)i=this.nameTable[this.connectors()[n].name],i&&(this.connectors()[n]=i)},_updateTableGroup:function(n){for(var i=n.children,t=0;t<n.children.length;t++)n.children[t]=this.nameTable[this._getChild(n.children[t])],n.children[t]&&n.children[t]._type==="group"&&this._updateTableGroup(n.children[t])},upgrade:function(n){var r=Number(n.version),t,e,u,i,o,f;if(isNaN(r)&&(r=n.version.split("."),n.version=r=Number(r[0]+"."+r[1])),n.version)if(r<14.2){if(n.nodes&&r<14.1)for(t=0;t<n.nodes.length;t++)e=n.nodes[t],this.setConstraints(e);if(n.connectors)for(u=0;u<n.connectors.length;u++){if(i=n.connectors[u],r<14.1&&(i.constraints|=ej.datavisualization.Diagram.ConnectorConstraints.PointerEvents,i.labels&&i.labels.length>0))for(f=0;f<i.labels.length;f++)o=i.labels[f],o.relativeMode=ej.datavisualization.Diagram.LabelRelativeMode.SegmentBounds;r<14.2&&i&&i.segments&&i.segments.length===1&&i.segments[0].type==="orthogonal"&&(i.segments[0].length=13)}}else n.version=="13.1";else if(this.commonAPIChanges(n),n.nodes)for(t=0;t<n.nodes.length;t++)n.nodes[t].inEdges||(n.nodes[t].inEdges=[],n.nodes[t].outEdges=[]),n.nodes[t].constraints=ej.datavisualization.Diagram.NodeConstraints.Default},setConstraints:function(n){var i,r,u,f,t;if(n&&n.type=="group"&&!n.isSwimlane)for(n.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents,i=0;i<n.children.length;i++)t=n.children[i],t.type=="group"?this.setConstraints(t):t.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents;else if(n&&n.type=="group"&&n.isSwimlane)for(n.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents,r=0;r<n.lanes.length;r++)for(u=n.lanes[r],u.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents,f=0;f<u.children.length;f++)t=u.children[f],t.type=="group"?this.setConstraints(t):t.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents;else n.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents},commonAPIChanges:function(n){var t,i;if(n.defaultSettings={node:n.nodeDefaults,connectors:n.connectorDefaults},n.connectors)for(t=0;t<n.connectors.length;t++)n.connectors[t].constraints=ej.datavisualization.Diagram.ConnectorConstraints.Default,n.connectors[t].line&&(n.connectors[t].line.type=="straight"?(i=[{type:"straight",startPoint:n.connectors[t].line.startPoint,endPoint:n.connectors[t].line.endPoint}],this.commonSourceTargetChanges(n.connectors[t])):n.connectors[t].line.type=="orthogonal"?(i=[{type:"orthogonal",startPoint:n.connectors[t].line.startPoint,endPoint:n.connectors[t].line.endPoint}],this.commonSourceTargetChanges(n.connectors[t])):n.connectors[t].line.type=="bezier"&&(i=[{type:"bezier",startPoint:n.connectors[t].line.startPoint,endPoint:n.connectors[t].line.endPoint,point1:n.connectors[t].line.point1,point2:n.connectors[t].line.point2}],this.commonSourceTargetChanges(n.connectors[t])),n.connectors[t].sourcePoint=n.connectors[t].line.startPoint,n.connectors[t].targetPoint=n.connectors[t].line.endPoint,n.connectors[t].segments=i)},commonSourceTargetChanges:function(n){n.sourceNodeName&&(n.sourceNode=n.sourceNodeName);n.sourceNodePort&&(n.sourcePort=n.sourceNodePort);n.targetNodeName&&(n.targetNode=n.targetNodeName);n.targetPortName&&(n.targetPort=n.targetPortName)},load:function(n){var e,i,t,r,f,u;if(this._isLoad=!0,this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch(),this.clear(),this._zOrder=0,this.enableContextMenu()&&(e=$("#"+this.element[0].id+"_contextMenu").data("ejMenu"),e.destroy(),$("#"+this.element[0].id+"_contextMenu").remove()),n&&n.nodes&&n.nodes.length>0)for(t=n.nodes.length-1;t>=0;t--)i=n.nodes[t],i&&(i.type==="connector"||i.segments)&&(n.connectors.push(i),n.nodes.splice(t,1));if(n&&n.connectors&&n.connectors.length>0)for(t=n.connectors.length-1;t>=0;t--)r=n.connectors[t],f=!1,r.targetNode&&(this._isExist(n,r.targetNode)||(f=!0,n.connectors.splice(t,1))),r.sourceNode&&(this._isExist(n,r.sourceNode)||f||n.connectors.splice(t,1));this.upgrade(n);u={nodes:n.nodes?n.nodes:[],connectors:n.connectors?n.connectors:[],commandManager:n.commandManager?n.commandManager:{},contextMenu:n.contextMenu?n.contextMenu:{},snapSettings:n.snapSettings?n.snapSettings:{},historyManager:n.historyManager?n.historyManager:this._initHistoryManager(),backgroundImage:n.backgroundImage?n.backgroundImage:ej.datavisualization.Diagram.BackgroundImage({source:""}),enableAutoScroll:n.enableAutoScroll?n.enableAutoScroll:!0,autoScrollMargin:n.autoScrollMargin?n.autoScrollMargin:20,layout:n.layout?n.layout:{},pageSettings:n.pageSettings?n.pageSettings:{},click:n.click?n.click:null,connectionChange:n.connectionChange?n.connectionChange:null,defaultSettings:n.defaultSettings?n.defaultSettings:{node:null,connector:null},dataSource:n.dataSource?n.dataSource:null,dataSourceSchema:n.dataSourceSettings?n.dataSourceSettings:{},doubleClick:n.doubleClick?n.doubleClick:null,enableContextMenu:n.enableContextMenu?n.enableContextMenu:!0,tooltip:n.tooltip?n.tooltip:null,height:n.height?n.height:null,mouseEnter:n.mouseEnter?n.mouseEnter:null,mouseOver:n.mouseOver?n.mouseOver:null,mouseLeave:n.mouseLeave?n.mouseLeave:null,nodeTemplate:n.nodeTemplate?n.nodeTemplate:null,rotationChange:n.rotationChange?n.rotationChange:null,selectorConstraints:n.selectorConstraints?n.selectorConstraints:ej.datavisualization.Diagram.SelectorConstraints.All,width:n.width?n.width:null,constraints:n.constraints,phases:n.phases?n.phases:[],scrollSettings:n.scrollSettings?n.scrollSettings:{horizontalOffset:0,verticalOffset:0,currentZoom:1,viewPortHeight:0,viewPortWidth:0,zoomFactor:n.zoomFactor?n.zoomFactor:.2,padding:{left:0,right:0,top:0,bottom:0}}};this._tempCommandManager=n.commandManager;n.showTooltip!==undefined&&(u.showTooltip=n.showTooltip);n.tooltipTemplateId!==undefined&&(u.tooltipTemplateId=n.tooltipTemplateId);$("#"+this._id).ejDiagram(u);this._isLoad=!1;delete this._tempCommandManager},_isExist:function(n,t){for(var r,e,u,i=!1,f=0;n.nodes&&f<n.nodes.length;f++)if(!i&&(r=n.nodes[f],r))if(r.isSwimlane){if(r.lanes)for(e=r.lanes,u=0;u<e.length;u++)if(i=this._checkNodeExist(e[u],t),i)break}else if(i=this._checkNodeExist(r,t),i)break;return i},_checkNodeExist:function(n,t){var i,r,u;if(n.children)for(i=0;i<n.children.length;i++)if(r=n.children[i],r&&(u=this._checkNodeExist(r,t),u))return!0;return n.name===t?!0:!1},layout:function(){this._setLayout()},_setLayout:function(){this._doLayout();ej.datavisualization.Diagram.PageUtil._updatePageSize(this);this._clearSelection()},addSelection:function(n,t){var r,i;n&&!this._selectionContains(n)&&(this.model.selectedItems.children.length>0&&!t?(i=this.nameTable.multipleSelection,i||(i=ej.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),this.nodes().push(i),this.nameTable[i.name]=i),this.model.selectedItems.children.length>1?i.children=this.selectionList[0].children:i.children.push(this.selectionList[0].name),i.children.push(n.name),ej.datavisualization.Diagram.Util._updateGroupBounds(i,this,null,!0),r=i):r=n,this._hasSelection()&&this._clearSelection(!0),i&&this.nameTable.multipleSelection===undefined&&t===!1&&(this.nodes().push(i),this.nameTable[i.name]=i),this._addSelection(r))},clearSelection:function(){this._clearSelection()},removeSelection:function(n){var n,t;(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&n&&(n=this.nameTable[n.name],this.selectionList[0]==n||this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children.length==1?this._clearSelection():this.selectionList[0].type=="pseudoGroup"&&this._collectionContains(n.name,this.selectionList[0].children)&&(t=this.selectionList[0].children.indexOf(n.name),t!=-1?ej.datavisualization.Diagram.Util.removeItem(this.selectionList[0].children,n.name):ej.datavisualization.Diagram.Util.removeItem(this.selectionList[0].children,n),ej.datavisualization.Diagram.Util.removeItem(this.model.selectedItems.children,n),ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this),this._updateSelectionHandle()))},updateSelectedObject:function(n,t){var i=this.nameTable[n];i&&(ej.datavisualization.Diagram.Util.canSelect(i)||i._isHeader)&&(this.activeTool.selectedObject=i);t&&t.isSwimlane&&(this.activeTool.selectedObject=t)},updateSelection:function(n){(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&this._updateSelectionHandle(n)},activateTool:function(n,t){this.tools[n]&&(this.activeTool instanceof ej.datavisualization.Diagram.LineTool&&this.activeTool._showAllPorts(!0),this._toolToActivate=n,this.activeTool=this.tools[this._toolToActivate],this.activeTool.singleAction=!0,(t===!1||n==="panTool")&&(this.activeTool.singleAction=!1));this.activeTool instanceof ej.datavisualization.Diagram.PanTool&&(this._currentCursor="pointer",this.activeTool.startPoint=ej.datavisualization.Diagram.Point(0,0),this.activeTool._isMouseDown=!1);this.activeTool instanceof ej.datavisualization.Diagram.LineTool&&(this.activeTool.singleAction?this.tool(this.tool()|ej.datavisualization.Diagram.Tool.DrawOnce):this.tool(this.tool()|ej.datavisualization.Diagram.Tool.ContinuesDraw),this.activeTool._showAllPorts());this._drawingTool=!0},deactivateTool:function(){this.activeTool instanceof ej.datavisualization.Diagram.LineTool&&this.activeTool._showAllPorts(!0);this.tool()&ej.datavisualization.Diagram.Tool.DrawOnce&&this.tool(this.tool()^ej.datavisualization.Diagram.Tool.DrawOnce);this.tool()&ej.datavisualization.Diagram.Tool.ContinuesDraw&&this.tool(this.tool()^ej.datavisualization.Diagram.Tool.ContinuesDraw);this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan?(this._toolToActivate="panTool",this.activeTool=this.tools[this._toolToActivate],this.activeTool._mousedown=!1,this._currentCursor="pointer"):(this._toolToActivate="select",this.activeTool=this.tools[this._toolToActivate],this.tool(ej.datavisualization.Diagram.Tool.SingleSelect|ej.datavisualization.Diagram.Tool.MultipleSelect))},updateLabel:function(n,t,i){var r,u;if(n&&(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(r=this._findNode(n),r||(r=this._findConnector(n)),i&&t&&!i.name||t.name==i.name)){if(r){this._isUndo||this._recordPropertiesChanged(r,i,"label",t);r.type!=="text"&&(t=this._findLabel(r,t.name));i.name=t.name;this._comparePropertyValues(r,"labels",i);for(u in i)t.hasOwnProperty(u)&&(t[u]=typeof i[u]=="object"?$.extend(!0,{},t[u],i[u]):i[u]);i.wrapText!==undefined&&(t.wrapping=i.wrapText?"wrapwithoverflow":"nowrap");r.segments||r.type!=="text"?(ej.datavisualization.Diagram.DiagramContext.updateLabelStyle(r,t,this),ej.datavisualization.Diagram.DiagramContext.updateLabel(r,t,this)):r.type==="text"&&ej.datavisualization.Diagram.DiagramContext.updateTextBlock(r,t,this)}i.mode===ej.datavisualization.Diagram.LabelEditMode.Edit&&this.startLabelEdit(r,t)}return t},startLabelEdit:function(n,t){var r,i,u;if(n){for(r=0;r<this.selectionList.length;r++)if(i=this.selectionList[r],i!==n&&typeof i.labels.length!="undefined")for(u=0;u<i.labels.length;u++)i.labels[u].mode=ej.datavisualization.Diagram.LabelEditMode.View;t||n.type!=="text"||(t=n.textBlock);this._setLabelEditing(t)?this._startEdit(n):this._endEdit()}},_setSelectorConstraints:function(n){this.model.selectedItems.constraints=n;this.selectionList[0]&&(ej.datavisualization.Diagram.SvgContext.clearSelector(this._adornerSvg,this._adornerLayer),ej.datavisualization.Diagram.SvgContext.renderSelector(this.selectionList[0],this._adornerSvg,this._adornerLayer,this._currZoom,n),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.renderUserHandles(this.model.selectedItems.userHandles,this.selectionList[0],this._adornerSvg,this.selectionList[0].type=="pseudoGroup",this._currZoom,this._adornerLayer,this))},_raiseGroupChangeEvent:function(n,t,i,r){var u={};u.element=n?n:null;u.oldParent=t?t:null;u.newParent=i?i:null;u.cause=r?r:null;t!=i&&this._raiseEvent("groupChange",u)},group:function(){var t,n,i,f,r,u,e;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"){for(t=[],n=0;n<this.selectionList[0].children.length;n++)t.push(this.nameTable[this.selectionList[0].children[n]]);for(this._sortByZIndex(t,!0),f=ej.datavisualization.Diagram.Util.randomId(),r=new ej.datavisualization.Diagram.Group({name:f,rotateAngle:this.selectionList[0].rotateAngle}),this._clearSelection(!0),n=0;n<t.length;n++)this._isUndo=!0,r.children.push(t[n].name),t[n].parent&&(u=this.nameTable[t[n].parent],u&&ej.datavisualization.Diagram.Util.removeChildFromGroup(u.children,t[n].name)),t[n].parent=f,ej.datavisualization.Diagram.Util.removeItem(this.selectionList,t[n].name),t[n].segments?(ej.datavisualization.Diagram.Util.removeItem(this.connectors(),this.nameTable[t[n].name]),this._connectors=$.extend(!0,[],this.connectors())):(ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable[t[n].name]),this._nodes=$.extend(!0,[],this.nodes())),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t[n].name],t[n]),t[n].type=="html"?(i=document.getElementById(t[n].name+"_parentdiv"),i.parentNode.removeChild(i)):t[n]._type==="group"&&this._checkForHtmlNode(t[n]),i=this._svg.document.getElementById(t[n].name),i&&i.parentNode.removeChild(i),this._removeElement(t[n]),this._raiseGroupChangeEvent(t[n],u,r,"group");ej.datavisualization.Diagram.Util.clear(this.selectionList);r=this._getNewGroup(r);this._eventCause.nodeCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.Unknown;this._isGroupNode=!0;this.add(r);e={type:"groupchanged",object:r,actionType:"group",category:"internal"};this.addHistoryEntry(e);this._isUndo=!1;delete this._isGroupNode}},_checkForHtmlNode:function(n){for(var t,r,u=this._getChildren(n.children),i=0;i<u.length;i++)t=this.nameTable[u[i]],t&&(t._type==="group"?this._checkForHtmlNode(t):t.type=="html"&&(r=document.getElementById(t.name+"_parentdiv"),r.parentNode.removeChild(r)))},_removeChildren:function(n,t){for(var i,u=this._getChildren(n.children),r=0;r<u.length;r++)i=this.nameTable[u[r]],i&&(n.isLane?(this._disConnect(i,t),this._removeConnector(i,t)):i.segments?(this._removeEdges(i),i.sourceNode=i.sourcePort=i.targetNode=i.targetPort=null):this._disConnect(i,t,!0),ej.datavisualization.Diagram.Util.removeItem(this.nodes(),i),this._nodes=$.extend(!0,[],this.nodes()),i._type==="group"?(this._removeChildren(i,t),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i),delete this.nameTable[i.name]):(ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i),delete this.nameTable[i.name]),this._removeElement(i))},ungroup:function(){var f,r,i,u,n,e,o,t,s;if(this.selectionList[0]&&this.selectionList[0]._type==="group"&&this.selectionList[0].canUngroup&&!(this.selectionList[0].isSwimlane||this.selectionList[0].isLane)){for(this._isUndo=!0,f=this.selectionList[0].children,u=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],i=this.selectionList[0],$("#"+this.selectionList[0].name)[0].parentNode.removeChild($("#"+this.selectionList[0].name)[0]),this._removeElement(this.selectionList[0]),this._checkForHtmlNode(this.selectionList[0]),this._clearSelection(),ej.datavisualization.Diagram.Util.clear(this.selectionList),r=0;r<f.length;r++)t=this.nameTable[this._getChild(f[r])],t.parent&&(o=this.nameTable[t.parent]),$(u).children("#"+t.name)[0]&&u.removeChild($(u).children("#"+t.name)[0]),t&&(t.parent&&(t.parent=null),t.segments?(n=t,n.parent="",this._updateEdges(n),this._dock(n,this.nameTable),ej.datavisualization.Diagram.DiagramContext.renderConnector(n,this),this.connectors().indexOf(n)===-1&&(this.connectors().push(n),this._connectors=$.extend(!0,[],this.connectors()))):(n=t,n.parent="",n._type==="group"?(this._updateChildrenEdges(n),(n.isLane||n.isSwimlane)&&(n.width=0,n.height=0),ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this)):ej.datavisualization.Diagram.DiagramContext.renderNode(n,this),this.nodes().indexOf(n)===-1&&(this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()))),t.parent&&(e=this.nameTable[t.parent]),this._raiseGroupChangeEvent(t,o,e,"unGroup"));ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this._findNode(i.name));ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i);ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i);s={type:"groupchanged",object:i,actionType:"ungroup",category:"internal"};this.addHistoryEntry(s);this._isUndo=!1}},nudge:function(n,t){t=t?t:1;var u={up:{x:0,y:-t},down:{x:0,y:t},left:{x:-t,y:0},right:{x:t,y:0}},r=u[n],i;n==="up"?i="down":n==="down"?i="up":n==="left"?i="right":n==="right"&&(i="left");r&&this.selectionList[0]&&!this.selectionList[0].isLane&&!this.selectionList[0].isPhase&&(this._isUndo||this.addHistoryEntry({type:"nudge",object:this.selectionList[0],undoDirection:i,redoDirection:n,values:t,category:"internal"}),this._nudge(this.selectionList[0],r.x,r.y,n))},selectAll:function(){var t,u,n,f,i=null,r;for(this._clearSelection(!0),t=ej.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),u=this.nodes(),n=0,f=u.length;n<f;n++)ej.datavisualization.Diagram.Util.canSelect(u[n])&&(i=this.nameTable[u[n].name],i&&i.parent==""&&i.type!="pseudoGroup"&&i.visible&&t.children.push(i.name));for(r=this.connectors(),n=0,f=r.length;n<f;n++)ej.datavisualization.Diagram.Util.canSelect(r[n])&&r[n].parent==""&&r[n].visible&&t.children.push(r[n].name);ej.datavisualization.Diagram.Util._updateGroupBounds(t,this);this.nodes().push(t);this._nodes=$.extend(!0,[],this.nodes());this.nameTable[t.name]=t;t.children.length>0&&this._addSelection(t)},align:function(n){var t,s,i,e,u,f;if(this.selectionList[0]&&(this.selectionList[0].type==="group"||this.selectionList[0].type=="pseudoGroup")&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var h=this.nameTable[this.selectionList[0].name].children,c=[],r,o=this._findCornerNodes();if(n==="left"?r=o.left:n==="right"?r=o.right:n==="top"?r=o.top:n==="bottom"&&(r=o.bottom),r?t=ej.datavisualization.Diagram.Util.bounds(r):(n==="center"||n==="middle")&&(t=ej.datavisualization.Diagram.Util.bounds(this.selectionList[0])),t){for(u=0,f=0,s=0;s<h.length;s++)e=this.nameTable[h[s]],i=ej.datavisualization.Diagram.Util.bounds(e),n==="left"?u=-(i.x-t.x):n==="right"?u=-(i.x+i.width-(t.x+t.width)):n==="top"?f=-(i.y-t.y):n==="bottom"?f=-(i.y+i.height-(t.y+t.height)):n==="center"?u=-(i.x+i.width/2-(t.x+t.width/2)):n==="middle"&&(f=-(i.y+i.height/2-(t.y+t.height/2))),this._moveNode(u,f,e),this._updateContainerOnNudge(e),c.push({object:e,delta:{x:u,y:f}});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}this.addHistoryEntry({type:"alignCommand",values:c,category:"internal",object:this.selectionList[0]})}},sameSize:function(){var t,n;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var i=this.nameTable[this.selectionList[0].name].children,f=this.nameTable[this.selectionList[0].children[0]],r=ej.datavisualization.Diagram.Util.bounds(f),u=[];for(this._isSizingCommand=!0,t=0;t<i.length;t++)n=this.nameTable[i[t]],n.segments||(u.push({object:n,values:{width:n.width||n._width||0,height:n.height||n._height||0}}),this.updateNode(n.name,{width:r.width,height:r.height}));delete this._isSizingCommand;this.addHistoryEntry({type:"sizeCommand",category:"internal",object:this.selectionList[0],values:u});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},sameHeight:function(){var t,n;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var i=this.nameTable[this.selectionList[0].name].children,u=this.nameTable[this.selectionList[0].children[0]],r=[],f=ej.datavisualization.Diagram.Util.bounds(u);for(this._isSizingCommand=!0,t=0;t<i.length;t++)n=this.nameTable[i[t]],n.segments||(r.push({object:n,values:{width:n.width||n._width||0,height:n.height||n._height||0}}),this.updateNode(n.name,{height:f.height}));delete this._isSizingCommand;this.addHistoryEntry({type:"sizeCommand",category:"internal",object:this.selectionList[0],values:r});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},sameWidth:function(){var t,n;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var i=this.nameTable[this.selectionList[0].name].children,u=this.nameTable[this.selectionList[0].children[0]],f=ej.datavisualization.Diagram.Util.bounds(u),r=[];for(this._isSizingCommand=!0,t=0;t<i.length;t++)n=this.nameTable[i[t]],n.segments||(r.push({object:n,values:{width:n.width||n._width||0,height:n.height||n._height||0}}),this.updateNode(n.name,{width:f.width}));delete this._isSizingCommand;this.addHistoryEntry({type:"sizeCommand",category:"internal",object:this.selectionList[0],values:r});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},spaceDown:function(){var t,o,s,i,n,e,u,r,f;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&(t=this.selectionList[0].children,this._sliceDockLines(t),this._sortByYvalue(this.selectionList[0].children),o=t.length,s=[],t&&o>2)){var c=this._findCornerNodes(),l=c.top,h=0,i=null,n=null;for(u in t)i=null,n=null,i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),h+=f.y-(r.y+r.height));e=h/(o-1);for(u in t)i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),this._comparePropertyOnAlign(n,0,r.bottom-f.top+e),this._translate(n,0,r.bottom-f.top+e,this.nameTable),s.push({object:n,delta:{x:0,y:r.bottom-f.top+e}}),this._updateQuad(this,n),this._updateNodeMargin(n),ej.datavisualization.Diagram.DiagramContext.update(n,this));this.addHistoryEntry({type:"spacingCommand",values:s,category:"internal",object:this.selectionList[0]})}},spaceAcross:function(){var t,o,s,i,n,e,l,u,r,f;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&(t=this.selectionList[0].children,this._sliceDockLines(t),this._sortByXvalue(this.selectionList[0].children),o=t.length,s=[],t&&o>2)){var c=this._findCornerNodes(),a=c.left,h=0,i=null,n=null;for(u in t)i=null,n=null,i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),h+=f.x-(r.x+r.width));e=h/(o-1);l=0;for(u in t)i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),this._comparePropertyOnAlign(n,r.right-f.left+e,0),this._translate(n,r.right-f.left+e,0,this.nameTable),s.push({object:n,delta:{x:r.right-f.left+e,y:0}}),this._updateQuad(this,n),this._updateNodeMargin(n),ej.datavisualization.Diagram.DiagramContext.update(n,this));this.addHistoryEntry({type:"spacingCommand",values:s,category:"internal",object:this.selectionList[0]})}},sendBackward:function(){var t,i,n,r,f,u;if(this.selectionList[0]&&this.selectionList[0].type!="pseudoGroup"&&(n=this.selectionList[0],n)){for(t=this._findOverlapNode(n),this._sortByZIndex(t),r=0;r<t.length;r++)if(n.zOrder>t[r].zOrder){i=t[r];break}f=n.zOrder;i&&(u=i.zOrder,this._comparePropertyValues(n,"zOrder",{zOrder:u},null,ej.datavisualization.Diagram.ActionType.Order),this._sendElementsToBack(f,u,n,i),this.addHistoryEntry({type:"zOrder",command:"back",start:u,end:f,nearestNode:i,object:n,category:"internal"}))}},_sendElementsToBack:function(n,t,i,r){for(var o,f=t;f<n;f++)i.parent!=""?this._findObjectByIndex(f,!0).zOrder+=1:this._findObjectByIndex(f).zOrder+=1;i.parent!=""?i.parent&&(o=this.nameTable[i.parent],this._findChildren(o,i.name).zOrder=t):this._findObjectByName(i.name).zOrder=t;var e=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],s=$(e).find("#"+i.name)[0],h=$(e).find("#"+i.name+"_parentdiv")[0],u=$(e).find("#"+r.name+"_parentdiv")[0];u||(u=$(e).find("#"+r.name)[0]);u&&h&&u.parentNode.insertBefore(h,u);u&&s&&u.parentNode.insertBefore(s,u);this._svg.getElementById(r.name).parentNode.insertBefore(this._svg.getElementById(i.name),this._svg.getElementById(r.name));this._updateSelectionHandle()},_bringElementsToFront:function(n,t,i,r){for(var h,u=t;u>n;u--)i.parent!=""?this._findObjectByIndex(u,!0)&&(this._findObjectByIndex(u,!0).zOrder-=1):this._findObjectByIndex(u)&&(this._findObjectByIndex(u).zOrder-=1);i.parent?(h=this.nameTable[i.parent],this._findChildren(h,i.name).zOrder=t):this._findObjectByName(i.name).zOrder=t;var e=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],c=$(e).find("#"+i.name)[0],s=$(e).find("#"+r.name)[0],f=$(e).find("#"+i.name+"_parentdiv")[0],o=$(e).find("#"+r.name+"_parentdiv")[0];o||(o=$(e).find("#"+r.name)[0]);s&&f&&s.parentNode.insertBefore(f,s.nextSibling);f&&c&&f.parentNode.insertBefore(c,f.nextSibling);o&&f&&o.parentNode.insertBefore(f,o.nextSibling);this._svg.getElementById(r.name).parentNode.insertBefore(this._svg.getElementById(i.name),this._svg.getElementById(r.name).nextSibling);this._updateSelectionHandle()},moveForward:function(){var t,i,n,r,f,u;if(this.selectionList[0]&&this.selectionList[0].type!="pseudoGroup"&&(n=this.selectionList[0],n)){for(t=this._findOverlapNode(n),this._sortByZIndex(t),r=t.length-1;r>=0;r--)if(n.zOrder<t[r].zOrder){i=t[r];break}f=n.zOrder;i&&(u=i.zOrder,this._comparePropertyValues(n,"zOrder",{zOrder:u},null,ej.datavisualization.Diagram.ActionType.Order),this._bringElementsToFront(f,u,n,i),this.addHistoryEntry({type:"zOrder",command:"front",start:u,end:f,nearestNode:i,object:n,category:"internal"}))}},sendToBack:function(){var n=this.selectionList[0],u,t;if(n&&n.type!="pseudoGroup"){var o=this._findOverlapNode(n),i=this._sortByZIndex(o),f=n.zOrder,r=n.zOrder,e;for(t=0;t<i.length;t++)i[t].zOrder<r&&(t==0&&(e=i[t]),r=i[t].zOrder,u=i[t]);u&&(this._comparePropertyValues(n,"zOrder",{zOrder:r},null,ej.datavisualization.Diagram.ActionType.Order),this._sendElementsToBack(f,r,n,u),this.addHistoryEntry({type:"zOrder",command:"back",start:r,end:f,nearestNode:e,object:n,category:"internal"}))}},bringToFront:function(){var n=this.selectionList[0],u,t;if(n&&n.type!="pseudoGroup"){var e=this._findOverlapNode(n),i=this._sortByZIndex(e),f=n.zOrder,r=n.zOrder;for(t=0;t<i.length;t++)i[t].zOrder>r&&(r=i[t].zOrder,u=i[t]);u&&(this._comparePropertyValues(n,"zOrder",{zOrder:r},null,ej.datavisualization.Diagram.ActionType.Order),this._bringElementsToFront(f,r,n,u),this.addHistoryEntry({type:"zOrder",command:"front",start:r,end:f,nearestNode:i[t-1],object:n,category:"internal"}))}},_getChildFromCollection:function(n,t){if(n&&n.length>0&&t)for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i]},_updateNameTable:function(n){var i,t;if(n.children&&n.children.length>0)for(i=0;i<n.children.length;i++)t=typeof n.children[i]=="object"?n.children[i]:null,t&&(this.nameTable[t.name]=t,t.children&&t.children.length>0&&this._updateNameTable(t))},_recordPageSettingsChanged:function(n){var t=n.redoObject;n.isUndo&&(t=n.undoObject);t&&this.updatePageSettings(t)},_recordMultiRotationChanged:function(n){ej.datavisualization.Diagram.canvasHelper._undoMultiRotateNode(this,n)},_recordMultiPinPointChanged:function(n){ej.datavisualization.Diagram.canvasHelper._undoMultiDragNode(this,n)},_recordMultiSizeChanged:function(n){ej.datavisualization.Diagram.canvasHelper._undoMultiResizeNode(this,n)},undo:function(){var n;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&ej.datavisualization.Diagram.Util.canUndo(this)){if(this._getHistoryList(),this._isUndo=!0,n=this.getUndoEntry(),n&&(n.type=="closeGroup"?this._groupUndo=!0:this._undo(n),this._groupUndo)){for(n=this.getUndoEntry();n&&n.type!="startGroup";)this._undo(n),n=this.getUndoEntry();delete this._groupUndo}this._isUndo=!1}},redo:function(){this._isUndo=!0;var n=this.getRedoEntry();if(n&&(n.type=="startGroup"?this._groupRedo=!0:this._redo(n),this._groupRedo)){for(n=this.getRedoEntry();n&&n.type!="closeGroup";)this._isUndo=!0,this._redo(n),n=this.getRedoEntry();delete this._groupRedo}this._isUndo=!1},_ComparehistoryChangeEvent:function(n,t){var i,r={source:[],changes:[]},s,u,f,h,o,e;switch(t.type){case"positionchanged":case"rotationchanged":case"sizechanged":r=this._getPseudoGroupElements(n,t);break;case"endpointchanged":this._UndoRedo?(s=this._historyChangeEvent(t.undoObject,t.redoObject,t),i={type:t.type,oldValues:s.oldValues,newValues:s.newValues,cancel:!1},r.source.push(t.undoObject)):(s=this._historyChangeEvent(t.redoObject,t.undoObject,t),i={type:t.type,oldValues:s.oldValues,newValues:s.newValues,cancel:!1},r.source.push(t.redoObject));r.changes.push(i);break;case"collectionchanged":t.changeType=="remove"&&(i={type:t.type,addedItems:[],deletedItems:[n]});t.changeType=="insert"&&(i={type:t.type,addedItems:[n],deletedItems:[]});r.changes.push(i);r.source.push(n);break;case"labelchanged":i=this._UndoRedo?{type:t.type,newValues:{text:t.previousLabelValue},oldValues:{text:t.updatedLabelValue}}:{type:t.type,newValues:{text:t.updatedLabelValue},oldValues:{text:t.previousLabelValue}};r.changes.push(i);r.source.push(t.shape);break;case"labelcollectionchanged":i={type:t.type,source:t.shape,addedItems:[t.label],deletedItems:[]};r.changes.push(i);r.source.push(t.shape);case"groupchanged":i=t.actionType=="group"?{type:t.type,source:t.object,addedItems:[t.object],deletedItems:[]}:{type:t.type,source:t.object,addedItems:[],deletedItems:[t.object]};r.changes.push(i);r.source.push(t.object);break;case"phasepositionchanged":this._UndoRedo?(i={type:t.type,newValues:{offset:t.undoObject.offset},oldValues:{offset:t.redoObject.offset}},r.source.push(t.undoObject)):(i={type:t.type,newValues:{offset:t.redoObject.offset},oldValues:{offset:t.undoObject.offset}},r.source.push(t.redoObject));r.changes.push(i);break;case"phasecollectionchanged":i=t.isAdded?{type:t.type,addedItems:[t.phase],deletedItems:[]}:{type:t.type,addedItems:[],deletedItems:[t.phase]};r.source.push(t.phase);r.changes.push(i);break;case"propertiesChanged":i=this._propertyChangeEventValues(t);r.source.push(i.source);r.changes.push(i.changes);break;case"portscollectionchanged":t.changeType=="insert"&&(i={type:t.type,addedItems:[t.collection],deletedItems:[]});t.changeType=="remove"&&(i={type:t.type,addedItems:[],deletedItems:[t.collection]});r.source.push(t.object);r.changes.push(i);break;case"nudge":u={};f={};this._UndoRedo?(t.undoDirection=="left"&&(u.offsetX=t.object.offsetX-t.values,f.offsetX=t.object.offsetX),t.undoDirection=="right"&&(u.offsetX=t.object.offsetX+t.values,f.offsetX=t.object.offsetX),t.undoDirection=="up"&&(u.offsetY=t.object.offsetY-t.values,f.offsetY=t.object.offsetY),t.undoDirection=="down"&&(u.offsetY=t.object.offsetY+t.values,f.offsetY=t.object.offsetY),i={type:t.type,newValues:u,oldValues:f}):(t.redoDirection=="left"&&(u.offsetX=t.object.offsetX-t.values,f.offsetX=t.object.offsetX),t.redoDirection=="right"&&(u.offsetX=t.object.offsetX+t.values,f.offsetX=t.object.offsetX),t.redoDirection=="up"&&(u.offsetY=t.object.offsetY-t.values,f.offsetY=t.object.offsetY),t.redoDirection=="down"&&(u.offsetY=t.object.offsetY+t.values,f.offsetY=t.object.offsetY),i={type:t.type,newValues:u,oldValues:f});r.source.push(t.object);r.changes.push(i);break;case"spacingCommand":case"alignCommand":var u={},f={},c=[],l=[];for(o=0;o<t.values.length;o++)e=t.values[o],e.object.segments?(h=$.extend(!0,{},e.object),f={sourcePoint:h.sourcePoint,targetPoint:h.targetPoint},l.push(f),ej.datavisualization.Diagram.Util._translateLine(h,e.delta.x,e.delta.y),u={sourcePoint:h.sourcePoint,targetPoint:h.targetPoint},c.push(u)):(u={offsetX:e.object.offsetX-e.delta.x,offsetY:e.object.offsetY-e.delta.y},c.push(u),f={offsetX:e.object.offsetX,offsetY:e.object.offsetY},l.push(f));i={type:t.type,newValues:c,oldValues:l};r.source.push(t.object);r.changes.push(i);break;case"sizeCommand":var u={},f={},c=[],l=[];for(o=0;o<t.values.length;o++)e=t.values[o],u={width:e.values.width,height:e.values.height},c.push(u),f={width:e.object.width,height:e.object.height},l.push(f);i={type:t.type,newValues:c,oldValues:l};r.source.push(t.object);r.changes.push(i);break;case"zOrder":i={type:t.type,source:t.object,newValues:{zOrder:t.end},oldValues:{zOrder:t.object.zOrder}};r.source.push(t.object);r.changes.push(i)}return r},_getPseudoGroupElements:function(n,t){var e,r,u,i,s=this._UndoRedo?this.nameTable[t.undoObject.node.name]:t.redoObject.node,f,o;if(u={source:[],changes:[]},n&&n.type=="pseudoGroup")for(f=this._getChildren(n.children),r=0;r<f.length;r++)e=this.nameTable[f[r]],o=this._UndoRedo?t.undoObject.childTable[f[r]]:t.redoObject.childTable[f[r]],i=this._historyChangeEvent(o,e,t),i.source&&u.source.push(i.source),i.changes&&u.changes.push(i.changes);else i=this._UndoRedo?this._historyChangeEvent(n,s,t):this._historyChangeEvent(s,n,t),i.source&&u.source.push(i.source),i.changes&&u.changes.push(i.changes);return u},_propertyChangeEventValues:function(n){var f,e=[],i,r,u,t;i=n.elementType=="label"?n.label:n.elementType=="port"?n.port:n.object;r={};u={};for(t in n.values)i[t]!=n.values[t]&&(r[t]=i[t],u[t]=n.values[t]);return f={type:n.type,newValues:u,oldValues:r,deletedItems:[],addedItems:[]},e.push(f),{changes:e,source:i}},_historyChangeEvent:function(n,t,i){var r={type:i.type,deletedItems:[],addedItems:[],oldValues:{},newValues:{}};return n.offsetX!=t.offsetX&&(r.oldValues.offsetX=t.offsetX,r.newValues.offsetX=n.offsetX),n.offsetY!=t.offsetY&&(r.oldValues.offsetY=t.offsetY,r.newValues.offsetY=n.offsetY),n.width!=t.width&&(r.oldValues.width=t.width,r.newValues.width=n.width),n.height!=t.height&&(r.oldValues.height=t.height,r.newValues.height=n.height),n.rotateAngle!=t.rotateAngle&&(r.oldValues.rotateAngle=t.rotateAngle,r.newValues.rotateAngle=n.rotateAngle),n.sourcePoint!=t.sourcePoint&&(r.oldValues.sourcePoint=t.sourcePoint,r.newValues.sourcePoint=n.sourcePoint),n.targetPoint!=t.targetPoint&&(r.oldValues.targetPoint=t.targetPoint,r.newValues.targetPoint=n.targetPoint),{changes:r,source:t}},_undo:function(n){var f=[],t,s,e,i,h,c,l,a,r,v,u,o;if(this._UndoRedo=!0,n)if(n.category=="internal"){if(t=n.object||(n.undoObject?n.undoObject.node||n.undoObject:undefined)||n.shape,!t&&n.phase&&(t=n.phase),t&&n.undoObject&&n.undoObject.node&&(t=this.nameTable[t.name]||t),!t){this.undo();return}if(this.model.historyManager.undoStack.length>0&&(s=this.model.historyManager.undoStack.splice(0,1),this.model.historyManager.redoStack.splice(0,0,s[0])),f=this._ComparehistoryChangeEvent(t,n),f.cause=ej.datavisualization.Diagram.HistoryChangeCause.Undo,this._raiseEvent("historyChange",f),t&&t.parent&&(e=typeof t.parent=="object"?t.parent.name:t.parent),e&&!t.isLane&&!this.nameTable[e]){this._isUndo=!1;this.undo();return}switch(n.type){case"pagesettingschanged":h={isUndo:!0,undoObject:n.undoObject,redoObject:n.redoObject};this._recordPageSettingsChanged(h);break;case"positionchanged":n.swimlaneMultiSelection?(n.undo=!0,this._recordMultiPinPointChanged(n)):(i={object:n.undoObject,isMultipleNode:n.isMultipleNode},this._recordPinPointChanged(i));break;case"rotationchanged":n.swimlaneMultiSelection?(n.undo=!0,this._recordMultiRotationChanged(n)):(i={object:n.undoObject,isMultipleNode:n.isMultipleNode},this._recordRotationChanged(i));break;case"sizechanged":n.undo=!0;n.swimlaneMultiSelection?this._recordMultiSizeChanged(n):(i={object:n.undoObject,isMultipleNode:n.isMultipleNode},this._recordSizeChanged(i,n));break;case"endpointchanged":i={undoObject:n.undoObject,redoObject:n.redoObject,isMultipleNode:n.isMultipleNode,_isUndo:!0};this._recordEndPointChanged(i);break;case"collectionchanged":if(n.changeType=="insert"&&!this.nameTable[n.object.name]){if(this._groupUndo)return;this._isUndo=!1;this.undo()}i={changeType:n.changeType,childTable:n.childTable,edgeTable:n.edgeTable,isUndo:!0,sourcePorts:n.sourcePorts,targetPorts:n.targetPorts,index:n.index};i.object=jQuery.extend(!0,{},n.object);c=this._recordCollectionChanged(i,n);c&&(n.sourcePorts=i.sourcePorts,n.targetPorts=i.targetPorts,n.edgeTable=i.edgeTable,n.childTable=i.childTable);break;case"labelchanged":i={object:n.shape,label:n.previousLabelValue,index:n.index?n.index:0};this._recordLabelChanged(i);break;case"labelcollectionchanged":n.isUndo=!0;this.labelcollectionchanged(n);break;case"groupchanged":i={object:n.object,isUndo:!0,actionType:n.actionType};this._recordGroupChanged(i);break;case"phasepositionchanged":n.undo=!0;this._recordPhasesizeChanged(n);break;case"phasecollectionchanged":n=$.extend(!0,{},{phase:n.phase,group:n.group,isAdded:n.isAdded,phaseObject:n.phaseObject,islastPhase:n.islastPhase});n.undo=!0;this._recordPhaseCollectionChanged(n);break;case"propertiesChanged":r=this.nameTable[n.object.name];r&&(l=this._getModifiedProperties(r,n.values,n[n.elementType]),n.elementType=="node"?this.updateNode(r.name,n.values):n.elementType=="connector"?this.updateConnector(r.name,n.values):n.elementType=="label"?n.label=this.updateLabel(r.name,n.label,n.values):n.elementType=="port"&&this.updatePort(r.name,n.port,n.values),n.values=l);break;case"portscollectionchanged":n.isUndo=!0;this._recordPortsCollectionChanged(n);break;case"nudge":this._recordNudgingChanges(t,n);break;case"spacingCommand":case"alignCommand":this._recordAlignCommandChanges(n);break;case"sizeCommand":this._recordSizeCommandChanges(n);break;case"swapLane":n=jQuery.extend(!0,{},{undoObject:n.undoObject,redoObject:n.redoObject,moveIndex:n.moveIndex,insertIndex:n.currentIndex});n.undo=!0;ej.datavisualization.Diagram.canvasHelper._undoSwap(this,n);break;case"zOrder":a=n.start;r=this.nameTable[n.object.name];this._comparePropertyValues(r,"zOrder",{zOrder:n.end});n.command=="back"?(this._bringElementsToFront(n.start,n.end,n.object,n.nearestNode),n.command="front"):(this._sendElementsToBack(n.start,n.end,n.object,n.nearestNode),n.command="back");n.nearestNode=this._findObjectByIndex(a);v=n.start;n.start=n.end;n.end=v}this.selectionList.length&&t&&this.selectionList[0].name!=t.name&&(this._clearSelection(!0),this._addSelection(this.nameTable[t.name],!0))}else this.model.historyManager.undo&&(u=this.model.historyManager.undo,typeof u=="string"&&(u=ej.util.getObject(u,window)),$.isFunction(u)&&(o=u(n.data),o&&(n.data=o)))},_redo:function(n){var f=[],t,s,e,h,i,c,l,r,a,u,o;if(this._UndoRedo=!1,n)if(n.category=="internal"){if(t=n.object||(n.undoObject?n.undoObject.node||n.undoObject:undefined)||n.shape,!t&&n.phase&&(t=n.phase),t&&n.undoObject&&n.undoObject.node&&(t=this.nameTable[t.name]||t),!t){this.redo();return}if(this.model.historyManager.redoStack.length>0&&(s=this.model.historyManager.redoStack.splice(0,1),this.model.historyManager.undoStack.splice(0,0,s[0])),f=this._ComparehistoryChangeEvent(t,n),f.cause=ej.datavisualization.Diagram.HistoryChangeCause.Redo,this._raiseEvent("historyChange",f),t&&t.parent&&(e=typeof t.parent=="object"?t.parent.name:t.parent),e&&!this.nameTable[e]){this._isUndo=!1;this.redo();return}switch(n.type){case"pagesettingschanged":h={isUndo:!1,undoObject:n.undoObject,redoObject:n.redoObject};this._recordPageSettingsChanged(h);break;case"positionchanged":n.swimlaneMultiSelection?(n.undo=!1,this._recordMultiPinPointChanged(n)):(i={object:n.redoObject,isMultipleNode:n.isMultipleNode},this._recordPinPointChanged(i));break;case"rotationchanged":n.swimlaneMultiSelection?(n.undo=!1,this._recordMultiRotationChanged(n)):(i={object:n.redoObject,isMultipleNode:n.isMultipleNode},this._recordRotationChanged(i));break;case"sizechanged":n.undo=!1;n.swimlaneMultiSelection?this._recordMultiSizeChanged(n):(i={object:n.redoObject,isMultipleNode:n.isMultipleNode},this._recordSizeChanged(i));break;case"endpointchanged":i={undoObject:n.undoObject,redoObject:n.redoObject,isMultipleNode:n.isMultipleNode,_isUndo:!1};this._recordEndPointChanged(i);break;case"collectionchanged":i={changeType:n.changeType,childTable:n.childTable,edgeTable:n.edgeTable,isUndo:!1,sourcePorts:n.sourcePorts,targetPorts:n.targetPorts,index:n.index};i.object=jQuery.extend(!0,{},n.object);this._recordCollectionChanged(i,n.object);break;case"labelchanged":i={object:n.shape,label:n.updatedLabelValue,index:n.index?n.index:0};this._recordLabelChanged(i);break;case"labelcollectionchanged":n.isUndo=!1;this.labelcollectionchanged(n);break;case"groupchanged":i={object:n.object,actionType:n.actionType,isUndo:!1};this._recordGroupChanged(i);break;case"phasepositionchanged":n.undo=!1;this._recordPhasesizeChanged(n);break;case"phasecollectionchanged":n=$.extend(!0,{},{phase:n.phase,group:n.group,phaseObject:n.phaseObject,islastPhase:n.islastPhase,isAdded:n.isAdded});n.undo=!1;this._recordPhaseCollectionChanged(n);break;case"propertiesChanged":r=this.nameTable[n.object.name];r&&(c=this._getModifiedProperties(r,n.values,n[n.elementType]),n.elementType=="node"?this.updateNode(r.name,n.values):n.elementType=="connector"?this.updateConnector(r.name,n.values):n.elementType=="label"?n.label=this.updateLabel(r.name,n.label,n.values):n.elementType=="port"&&this.updatePort(r.name,n.port,n.values),n.values=c);break;case"portscollectionchanged":n.isUndo=!1;this._recordPortsCollectionChanged(n);break;case"nudge":this._recordNudgingChanges(t,n,!0);break;case"spacingCommand":case"alignCommand":this._recordAlignCommandChanges(n);break;case"sizeCommand":this._recordSizeCommandChanges(n);break;case"swapLane":n=jQuery.extend(!0,{},{undoObject:n.undoObject,redoObject:n.redoObject,moveIndex:n.moveIndex,insertIndex:n.currentIndex});n.undo=!1;ej.datavisualization.Diagram.canvasHelper._undoSwap(this,n);break;case"zOrder":l=n.start;r=this.nameTable[n.object.name];this._comparePropertyValues(r,"zOrder",{zOrder:n.end});n.command=="back"?(this._bringElementsToFront(n.start,n.end,n.object,n.nearestNode),n.command="front"):(this._sendElementsToBack(n.start,n.end,n.object,n.nearestNode),n.command="back");n.nearestNode=this._findObjectByIndex(l);a=n.start;n.start=n.end;n.end=a}this.selectionList.length&&t&&this.selectionList[0].name!=t.name&&(this._clearSelection(!0),this._addSelection(this.nameTable[t.name],!0))}else this.model.historyManager.redo&&(u=this.model.historyManager.redo,typeof u=="string"&&(u=ej.util.getObject(u,window)),$.isFunction(u)&&(o=u(n.data),o&&(n.data=o)))},_startGroupAction:function(){this.addHistoryEntry({type:"startGroup",category:"internal"})},_closeGroupAction:function(){this.addHistoryEntry({type:"closeGroup",category:"internal"})},addHistoryEntry:function(n){var i,r,t,e,f,u;if(!this.model.historyManager.suspend){if(this.model.historyManager.canLog&&(i=this.model.historyManager.canLog,typeof i=="string"&&(i=ej.util.getObject(i,window)),$.isFunction(i)&&(f=n.object||n.undoObject&&n.undoObject.node||n.shape,r=this._ComparehistoryChangeEvent(f,n),u={changes:r.changes.length?r.changes[0]:null,source:r.source.length?r.source[0]:null},i(u)==!1)))return;n.category!="internal"&&(n={data:n});this._historyList.canUndo&&this._historyList.currentEntry&&(this._historyList.currentEntry.data||this._historyList.currentEntry.category=="internal")&&(t=this._historyList.currentEntry,t.next?t.previous&&(e=t.next,e.previous=null,t.next=n,n.previous=t):(t.next=n,n.previous=t));this._historyList.currentEntry=n;this.model.historyManager.stackLimit&&(this._historyList.currentEntry&&this._historyList.currentEntry.previous&&!this._lastbefore?this._lastbefore=n:this._historyList.currentEntry.previous||(this._lastbefore=null,this._historyCount=0),this._historyCount<this.model.historyManager.stackLimit?this._historyCount++:this._lastbefore&&(this._lastbefore.previous&&delete this._lastbefore.previous,this._lastbefore.next&&(this._lastbefore=this._lastbefore.next)));f=n.object||(n.redoObject?n.redoObject.node||n.redoObject:undefined)||n.shape;u=this._ComparehistoryChangeEvent(f,n);u.cause=ej.datavisualization.Diagram.HistoryChangeCause.CustomAction;this._getHistoryList();this._raiseEvent("historyChange",u);this._historyList.canUndo=!0;this._historyList.canRedo=!1}},removeHistoryEntry:function(n){var r,t,i,u,f;if(this._historyList.currentEntry!=null){if(r=this._historyList.currentEntry,r)if(r==n)t=r.previous,i=r.next,this._historyList.currentEntry=i||t;else{for(u=r.next;u;)if(u==n){t=u.previous;i=u.next;break}else u=u.next;for(f=r.previous;f;)if(f==n){t=f.previous;i=f.next;break}else f=f.previous}t&&i?(t.next=i,i.previous=t):t?t.next=null:i&&(i.previous=null)}},canRemoveHistoryEntry:function(n){return n.category!="internal"},clearHistory:function(){var n=this._historyList;n.currentEntry=null;n.canUndo=!1;n.canRedo=!1;this.model.historyManager.undoStack=[];this.model.historyManager.redoStack=[]},_getHistroyObject:function(n,t){t&&n.push({redoObject:t.redoObject?t.redoObject:null,undoObject:t.undoObject?t.undoObject:null,type:t.type?t.type:null,isMultipleNode:t.isMultipleNode?t.isMultipleNode:null,category:t.category?t.category:""})},_getHistoryList:function(){var t=[],i=[],n=this._historyList.currentEntry,r,u;for(n=this._historyList.currentEntry,this._historyList.canUndo||this.model.historyManager.undoStack.length===0?this._getHistroyObject(t,n):this._getHistroyObject(i,n);n&&n.previous;)r=n.previous,this._getHistroyObject(t,r),n=n.previous;for(n=this._historyList.currentEntry;n&&n.next;)u=n.next,this._getHistroyObject(i,u),n=n.next;this.model.historyManager.undoStack=t;this.model.historyManager.redoStack=i},getUndoEntry:function(){var i=null,t,n=this._historyList;return n.canUndo&&(i=n.currentEntry,t=n.currentEntry.previous,t?(n.currentEntry=t,n.canRedo||(n.canRedo=!0)):(n.canRedo=!0,n.canUndo=!1)),i},getRedoEntry:function(){var i=null,t,n=this._historyList;return n.canRedo&&(t=n.currentEntry.previous||n.canUndo?n.currentEntry.next:n.currentEntry,t&&(n.currentEntry=t,n.canUndo||(n.canUndo=!0),t.next||(n.canRedo=!1,n.canUndo=!0)),i=n.currentEntry),i},cut:function(){(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(this._pasteIndex=0,this._setClipboard(),this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.ClipBoard,this._multipleAction=!0,this._delete(),delete this._multipleAction)},insertLabel:function(n,t,i){var r,u,f,e;ej.datavisualization.Diagram.Util.isPageEditable(this)&&(r=this.nameTable[n],r&&t&&(u=this.getObjectType(r)=="node"?this.model.defaultSettings.node:this.model.defaultSettings.connector,u&&u.labels&&r.labels&&u.labels[i!==undefined?i:r.labels.length]&&(t=$.extend(!0,{},u.labels[i!==undefined?i:r.labels.length],t)),t=ej.datavisualization.Diagram.Label(t),f=u.labels,f.splice(),r.labels.push(t),e={element:r,index:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"labels",oldValue:f,newValue:r.labels},this._raisePropertyChange(e),ej.datavisualization.Diagram.DiagramContext.addLabel(r,t,this,i),this.addHistoryEntry({type:"labelcollectionchanged",shape:r,label:t,isUndo:!0,category:"internal",index:i})))},addLabel:function(n,t){var i,u,r,f;ej.datavisualization.Diagram.Util.isPageEditable(this)&&(i=this.nameTable[n],i&&t&&(r=this.getObjectType(i)=="node"?this.model.defaultSettings.node:this.model.defaultSettings.connector,r&&r.labels&&i.labels&&r.labels[i.labels.length]&&(t=$.extend(!0,{},r.labels[i.labels.length],t)),t=ej.datavisualization.Diagram.Label(t),u=i.labels,i.labels.push(t),f={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"labels",oldValue:u,newValue:i.labels},this._raisePropertyChange(f),ej.datavisualization.Diagram.DiagramContext.addLabel(i,t,this),this.addHistoryEntry({type:"labelcollectionchanged",shape:i,label:t,isUndo:!0,category:"internal"})))},addPorts:function(n,t){var r,i;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(r=this.nameTable[n],r&&t)){for(i=0;i<t.length;i++)t[i]=ej.datavisualization.Diagram.Port(t[i]),r.ports.push(t[i]),this._raisePropertyChange({element:r,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"ports",oldValue:null,newValue:t[i]}),ej.datavisualization.Diagram.DiagramContext.renderPort(r,t[i],this);this.addHistoryEntry({type:"portscollectionchanged",object:r,collection:t,changeType:"insert",isUndo:!0,category:"internal"})}},updatePort:function(n,t,i){var u,r;if(n&&(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(u=this._findNode(n),i&&t&&(!i.name||t.name==i.name)&&u)){t=this._findPort(u,t.name);this._isUndo||this._recordPropertiesChanged(u,i,"port",t);i.name=t.name;this._comparePropertyValues(u,"ports",i);for(r in i)t.hasOwnProperty(r)&&(t[r]=typeof i[r]=="object"?$.extend(!0,{},t[r],i[r]):i[r]);ej.datavisualization.Diagram.DiagramContext.updatePort(u,t,this)}},copy:function(){return(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(this._pasteIndex=1,this.selectionList&&this.selectionList.length>0&&this._setClipboard()),this._cloneSelectionList()},paste:function(n,t){(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.ClipBoard,this._paste(n,t!==undefined?t:!0))},_commandPaste:function(){this.paste()},_getNodesfrombounds:function(n,t){for(var e=!1,c,i,s=[],l=this.nodes(),r,h,f,u=0,o=l.length;u<o;u++)r=this.nameTable[l[u].name],t&&(e=t.name===r.name?!0:!1),r&&r.visible&&!e&&(i=ej.datavisualization.Diagram.Util.bounds(r),i=ej.datavisualization.Diagram.Geometry.rect([i.topLeft,i.topRight,i.bottomRight,i.bottomLeft]),ej.datavisualization.Diagram.Util.canSelect(r)&&(c=this.getObjectType(r),ej.datavisualization.Diagram.Geometry.containsRect(n,i)?r.parent===""&&s.push(r):c==="group"&&this.activeTool&&this.activeTool.inAction&&this.activeTool._checkGroupChildren(s,r,n)));for(h=this.connectors(),u=0,o=h.length;u<o;u++)f=this.nameTable[h[u].name],t&&(e=t.name===f.name?!0:!1),f&&f.visible&&!e&&(i=ej.datavisualization.Diagram.Util.bounds(f),i=ej.datavisualization.Diagram.Geometry.rect([i.topLeft,i.topRight,i.bottomRight,i.bottomLeft]),ej.datavisualization.Diagram.Util.canSelect(f)&&ej.datavisualization.Diagram.Geometry.containsRect(n,i)&&f.parent===""&&s.push(f));return s},_setClipboard:function(){var l,r,u,t,o,s;if(this.selectionList.length>0){var i,n=this.selectionList[0],f={},h=[],e,c;if(n._type==="group"||n.type==="pseudoGroup"){for(t=this._getChildren(n.children),r=0;r<t.length;r++)for(u=r+1;u<t.length;u++)o=this.nameTable[t[r]],s=this.nameTable[t[u]],s&&o&&s.zOrder<o.zOrder&&(l=t[r],t[r]=t[u],t[u]=l);f=this._getChildTable(n,f)}f[n.name]=n;e=ej.datavisualization.Diagram.Util.bounds(n);c={x:e.x,y:e.y,width:e.width,height:e.height};h=this._getNodesfrombounds(c,n);i=$.extend(!0,{},{childTable:f,node:n,collection:h});i.node.segments&&(i.node.targetNode=null,i.node.targetPort=null,i.node.sourceNode=null,i.node.sourcePort=null);i.addInfo=this._updateClipBoardConnectors(n,f);this._clipboardData=i}},_updateClipBoardConnectors:function(n,t){var i,u=[],r;if(n&&n.type==="pseudoGroup"&&n.children.length>0)for(r=0;r<n.children.length;r++)i=this.nameTable[this._getChild(n.children[r])],i&&i.isSwimlane&&this._updateSwimlaneGroupConnectors(n,i,t,u);else this._updateSwimlaneGroupConnectors(null,n,t,u);return u},_updateEdgesToClipboard:function(n,t,i,r,u,f){var e,o,s,h;i.parent&&n&&(e=this.nameTable[n.sourceNode],o=this.nameTable[n.targetNode],e&&o&&(s=this.nameTable[e.parent],h=this.nameTable[o.parent],s&&s.isLane&&h&&h.isLane&&(!this._collectionContains(n.name,f?i.outEdges:i.inEdges)||this._collectionContains(n.name,u)||this._collectionContains(n.name,t?t:[])||u.push(this.nameTable[this._getChild(n)]))))},_updateSwimlaneConnectors:function(n,t,i,r){if(t){for(var f,u=0;u<t.inEdges.length>0;u++)f=this.nameTable[this._getChild(t.inEdges[u])],this._updateEdgesToClipboard(f,n,t,i,r);for(u=0;u<t.outEdges.length>0;u++)f=this.nameTable[this._getChild(t.outEdges[u])],this._updateEdgesToClipboard(f,n,t,i,r,!0)}},_updateSwimlaneGroupConnectors:function(n,t,i,r){for(var u,f,h,e=ej.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(this,t),o,s=0;e&&s<e.length;s++)if(u=this.nameTable[this._getChild(e[s])],u&&u.children&&u.children.length>0)for(o=u.children,f=0;f<o.length;f++)h=this.nameTable[this._getChild(o[f])],h&&this._updateSwimlaneConnectors(n&&n.children?n.children:null,h,i,r)},_getChildTable:function(n,t){var u,f,o,e,i,s,h,r;if(f=this._getChildren(n.children),f)for(e=0;e<f.length;e++)if(o=f[e],u=this.nameTable[o],u&&(u.parent===n.name||n.type=="pseudoGroup")){if(i=t[u.name]=$.extend(!0,{},u),(i._type==="group"||i.type==="pseudoGroup")&&(t=this._getChildTable(i,t)),i.inEdges&&i.inEdges.length>0)for(s in i.inEdges)r=this.nameTable[i.inEdges[s]],r&&(t[r.name]&&delete t[r.name],t[r.name]=r);if(i.outEdges&&i.outEdges.length>0)for(h in i.outEdges)r=this.nameTable[i.outEdges[h]],r&&(t[r.name]&&delete t[r.name],t[r.name]=r)}return t},_paste:function(n,t){var f,o,i,w,s,h,r,a,b,k,d,y,nt,tt,l,v,p,it,e,rt,g,u;if(n){var h="",c=[],s=ej.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup"});for(t&&(h=ej.datavisualization.Diagram.Util.randomId()),u=0;u<n.length;u++)n[u].name+=h,n[u].outEdges&&(n[u].outEdges=[]),n[u].inEdges&&(n[u].inEdges=[]),n.length>1&&s.children.push(n[u].name),n[u].type!="connector"?(n[u].type!=="group"&&n[u].type!=="bpmn"||n[u].isSwimlane||(this._clonePasteGroup(n[u],h,n),this.add($.extend({},n[u]))),n[u].isSwimlane?(this._clonePasteSwimlaneObj(n[u],h,n),g=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n[u],f),this._outOfBoundsOnNudge(g,diagram._pasteIndex*10,this._pasteIndex*10)&&this.add(g)):this.add($.extend({},n[u]))):c.push(n[u]);for(u=0;u<c.length;u++)c[u].sourceNode&&this.nameTable[c[u].sourceNode+h]?c[u].sourceNode+=h:(c[u].sourceNode="",c[u].sourcePort=""),c[u].targetNode&&this.nameTable[c[u].targetNode+h]?c[u].targetNode+=h:(c[u].targetNode="",c[u].targetPort=""),n.length>1&&s.children.push(c[u].name),this.add($.extend({},c[u]));n.length>1&&(this.nodes().push(s),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[s.name]=s,this._clearSelection(!0),ej.datavisualization.Diagram.Util._updateGroupBounds(s,this),this.addSelection(s,!0))}else if(this._clipboardData&&(f=this._clipboardData,f=$.extend(!0,{},this._clipboardData),i=f.node,i.zOrder=-1,this.tools.move._outOfBoundsDrag(i,this._pasteIndex*10,this._pasteIndex*10)&&i&&i.type!="phase")){if(i.container)i.isSwimlane?(i=this._pasteSwimlaneObj(i,f),f.childTable=this._getChildTable(i,f.childTable)):(i.isLane?(i=this._cloneLaneObj(i,ej.datavisualization.Diagram.Util.randomId(),f.childTable),i.orientation==="vertical"&&(i.height=i.height),p=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(i,this,this._clipboardData,!0),p&&(this._pasteObj=!0,this.add(p),this._pasteObj=!1),i=p):!i.container||i.isLane||i.isSwimlane||(i=this._cloneContainer(i,ej.datavisualization.Diagram.Util.randomId(),f.childTable),this._preserveConnection(f.childTable,i),this.add(i),i=this.nameTable[i.name]),o=this._pasteIndex*10,this._translate(i,o,o,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(i,this)),this._selectionContains(i)&&(this._clearSelection(!0),this._addSelection(i));else if(i.type=="pseudoGroup"){for(w=i.children,s=ej.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),this._isUndo=!0,this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.ClipBoard,this._multipleAction=!0,u=0;u<w.length;u++)h=w[u],r=f.childTable[h],r.zOrder=-1,r._annotation&&delete r._annotation,r&&(r.isSwimlane||r.type==="swimlane")?(this._isUndo=!1,r=this._pasteSwimlaneObj(r,f),r&&s.children.push(r.name),this._isUndo=!0):r&&r.isLane?(a=this._pasteSwimlane(r,f,!0,this._pasteIndex*10),a&&s.children.push(a.name),o=this._pasteIndex*10,this._translate(a,o,o,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(a,this)):r&&(h=h+ej.datavisualization.Diagram.Util.randomId(),delete f.childTable[r.name],r.name=h,r.parent="",f.childTable[r.name]=r,this._preserveConnection(f.childTable,r),b=!0,r.segments&&(k=!0,d=!0,f.childTable[r._oldSourceNode]&&!this.nameTable[r.sourceNode]&&(k=!1,r.sourceNode=null),f.childTable[r._oldTargetNode]&&!this.nameTable[r.targetNode]&&(d=!1,r.targetNode=null),k||d||(b=!1)),b&&(s.children.push(h),r._type==="group"&&r.type!="bpmn"?this._pasteChildren(f.childTable,r):r.children=[],o=this._pasteIndex*10,this._translate(r,o,o,this.nameTable),!r.segments||r.segments.length!=1||r.segments[0].type!="orthogonal"||r.sourceNode||r.targetNode||(l=r.segments[0].points),v=!1,v=this.add(r),l&&v&&(r=this.nameTable[r.name],r.segments[0].points=l,ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom))));delete this._multipleAction;this._clearSelection();s&&s.children.length>0&&(this.nodes().push(s),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[s.name]=s,ej.datavisualization.Diagram.Util._updateGroupBounds(s,this),this._addSelection(s),y={},y=this._getChildTable(this.selectionList[0],y),nt={type:"collectionchanged",object:this._updatePsedoGroupChildren(this.selectionList[0]),childTable:jQuery.extend(!0,{},y),changeType:"insert",category:"internal"},this.addHistoryEntry(nt),this._isUndo=!1)}else i.type=="bpmn"?(tt=ej.datavisualization.Diagram.Util.randomId(),i.parent="",i.name=i.name+tt,i.inEdges=[],i.outEdges=[],i.children=[],i._annotation&&delete i._annotation,o=this._pasteIndex*10,this._translate(i,o,o,this.nameTable),this.add(i)):(i.name=i.name+ej.datavisualization.Diagram.Util.randomId(),i.parent="",i._type==="group"?this._pasteChildren(f.childTable,i):i.segments||i.segments||(i.inEdges=[],i.outEdges=[]),o=this._pasteIndex*10,this._translate(i,o,o,this.nameTable),!i.segments||i.segments.length!=1||i.segments[0].type!="orthogonal"||i.sourceNode||i.targetNode||(l=i.segments[0].points),v=this.add(i),v&&l&&(i=this.nameTable[i.name],i.segments[0].points=l,ej.datavisualization.Diagram.DiagramContext.update(i,this),ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom)),this._updateSelectionHandle());if(f.addInfo.length){for(it in f.addInfo)e=f.addInfo[it],e.isSwimlane?(f.childTable[e.name]=e,f.childTable=this._getChildTable(e,f.childTable),e=this._pasteSwimlaneObj(e,f),f.childTable[e.name]=e,f.childTable=this._getChildTable(e,f.childTable)):(f.childTable[e.name]&&e!==f.childTable[e.name]&&(e=$.extend(!0,{},f.childTable[e.name])),rt=e.name+ej.datavisualization.Diagram.Util.randomId(),e.name=rt,e.parent="",f.childTable[e.name]=e,this._preserveConnection(f.childTable,e),o=this._pasteIndex*10,this._translate(e,o,o,this.nameTable),this.add(e),this._selectionContains(e)&&this._clearSelection(!0));this._selectionContains(i)||this._addSelection(i)}this._pasteIndex++}},_cloneContainer:function(n,t,i){var u,f,r;for(n.name=n.name+t,u=0;u<n.children.length;u++)f=i?i:this.nameTable,r=f[this._getChild(n.children[u])],r.name+=t,r.parent=n.name,r.children&&r.children.length>0&&(r=this._cloneContainer(r,t,i)),n.children[u]=r;return ej.datavisualization.Diagram.bpmnHelper.updateProcessCollection(n,this),n},_clonePasteGroup:function(n,t,i){for(var f,u,r=0;r<n.children.length;r++)if(n.children[r].name+=t,n.children[r].parent=n.name,n.children[r].segments)n.children[r].sourceNode&&(n.children[r].sourceNode+=t),n.children[r].targetNode&&(n.children[r].targetNode+=t);else{for(u=0;u<n.children[r].inEdges.length;u++)f=n.children[r].inEdges[u],this._collectionContains(f,n.children)||i&&this._collectionContains(f,i)?f+=t:n.children[r].inEdges.splice(u,1);for(u=0;u<n.children[r].outEdges.length;u++)f=n.children[r].outEdges[u],this._collectionContains(f,n.children)||i&&this._collectionContains(f,i)?f+=t:n.children[r].outEdges.splice(u,1)}},_clonePasteSwimlaneObj:function(n,t,i){var s,h,e,u,f,c,r,o;if(n.lanes&&n.lanes.length>0)for(r=0;r<n.lanes.length;r++)if(n.lanes[r]&&(n.lanes[r].name+=t,n.lanes[r].children&&n.lanes[r].children.length>0)){for(s=n.lanes[r].children,h=[],e=0;e<s.length;e++){for(u=jQuery.extend(!0,{},s[e]),u.name+=t,u.parent=n.lanes[r].name,f=0;f<u.inEdges.length;f++)this._collectionContains(u.inEdges[f],i)?(u.inEdges[f]+=t,n.lanes[r].children[e]=u):u.inEdges.splice(f,1);for(f=0;f<u.outEdges.length;f++)this._collectionContains(u.outEdges[f],i)?(u.outEdges[f]+=t,n.lanes[r].children[e]=u):u.outEdges.splice(f,1);h.push(u)}n.lanes[r].children=h}if(n.phases&&n.phases.length>0){for(c=[],r=0;r<n.phases.length;r++)n.phases[r]&&(o=jQuery.extend(!0,{},n.phases[r]),o.name+=t,o.parent="",c.push(o));n.phases=c}},_cloneLaneObj:function(n,t,i){var n=ej.datavisualization.Diagram.SwimLaneContainerHelper._cloneLaneObj(this,n,t,i);return n},_cloneSwimlaneObj:function(n,t,i){n=$.extend(!0,{},n);var n=ej.datavisualization.Diagram.SwimLaneContainerHelper._cloneSwimlaneObj(this,n,t,i);return n},_pasteSwimlaneObj:function(n,t){return ej.datavisualization.Diagram.SwimLaneContainerHelper._pasteSwimlaneObj(this,n,t)},_pasteSwimlane:function(n,t,i,r){if(n&&n.isSwimlane)return ej.datavisualization.Diagram.SwimLaneContainerHelper._pasteSwimlane(this,n,t,i,r)},_cloneNode:function(n,t,i,r){var f=!1,e=null,n,u;if(n){if(n=typeof n=="string"?n:n.name,n=jQuery.extend(!0,{},t.childTable[n]),n.isPhaseStack&&(n.name=n.name.split("phaseStack")[0]+i+"phaseStack",f=!0,e=n.name),n.children&&n.children.length>0)for(u in n.children)this._cloneNode(n.children[u],t,i,e),n.children[u]&&(typeof n.children[u]=="string"?n.children[u]+=i:n.children[u].name+=i);r?n.parent=typeof r=="string"?r:r.name:n.parent!=""&&(n.parent+=i);f||(n.name+=i);this._preserveConnection(t.childTable,n);this.nameTable[n.name]=n}},_cloneSwimlane:function(n,t,i){var f=n.name,u,r;if(n.name+=i,n.children&&n.children.length>0)for(r in n.children)this._cloneNode(n.children[r],t,i,n),typeof n.children[r]=="string"?n.children[r]+=i:n.children[r]=n.children[r].isPhaseStack?f+i+"phaseStack":n.children[r].name+i;if(n.phases&&n.phases.length>0)for(r in n.phases)u=jQuery.extend(!0,{},this.nameTable[n.phases[r]]),u.name+=i,u.parent+=i,this.nameTable[u.name]=u,n.phases[r]=u.name;this.nameTable[n.name]=n},_pasteChild:function(n,t,i,r){var u=n.name+ej.datavisualization.Diagram.Util.randomId();delete t[n.name];n.name=u;t[n.name]=n;this._preserveConnection(t,n);n.parent=i.name;r.push(u);n._type==="group"&&this._pasteChildren(t,n);this.add(n)},_pasteChildren:function(n,t){for(var i,f,e=[],u=t.children,r=0;r<u.length;r++)f=this._getChild(u[r]),i=n[f],i.zOrder=-1,i&&this._pasteChild(i,n,t,e);t.children=e;this._preserveConnection(n,t)},_preserveConnections:function(n,t){for(var i,u=this._getChildren(t.children),r=0;r<u.length;r++)i=n[u[r]],i&&(this._preserveConnection(n,i),i._type==="group"&&this._preserveConnections(n,t))},_preserveConnection:function(n,t){var r,i,f,u;if(t.segments)t.targetNode&&(u=n[t.targetNode],u&&u.inEdges.push(t.name)),t.sourceNode&&(u=n[t.sourceNode],u&&u.outEdges.push(t.name));else{if(f=t.inEdges.length,f>0){for(r=0;r<f;r++)i=n[t.inEdges[r]],i&&(i._oldTargetNode=i.targetNode,i.targetNode=t.name);t.inEdges=[]}if(f=t.outEdges.length,f>0){for(r=0;r<t.outEdges.length;r++)i=n[t.outEdges[r]],i&&(i._oldSourceNode=i.sourceNode,i.sourceNode=t.name);t.outEdges=[]}}},_expandChildren:function(n){for(var i,t,r=0;r<n.outEdges.length;r++)i=this.nameTable[n.outEdges[r]],t=this.nameTable[i.targetNode],t.excludeFromLayout||(i.visible=!0,ej.datavisualization.Diagram.DiagramContext.update(i,this),this._updateQuad(i),t.isExpanded&&this._expandChildren(t),t.visible=!0,ej.datavisualization.Diagram.DiagramContext.update(t,this),this._updateQuad(t))},_collapseChildren:function(n){for(var i,t,r=0;r<n.outEdges.length;r++)i=this.nameTable[n.outEdges[r]],t=this.nameTable[i.targetNode],t.excludeFromLayout||(i.visible=!1,ej.datavisualization.Diagram.DiagramContext.update(i,this),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i),t.isExpanded&&this._collapseChildren(t),t.visible=!1,ej.datavisualization.Diagram.DiagramContext.update(t,this),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t.name],t),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,t))},zoomTo:function(n){n||(n=new ej.datavisualization.Diagram.Zoom);n.zoomCommand&ej.datavisualization.Diagram.ZoomCommand.ZoomIn?ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1+n.zoomFactor,0,0,n.focusPoint,!0):ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1/(1+n.zoomFactor),0,0,n.focusPoint,!0)},remove:function(n){n&&this.nameTable[n.name]&&(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))?this._delete(n):this._delete()},clear:function(){if(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this)){this._clearSelection();var n=this;this._views.forEach(function(t){var i=n._views[t];$(i.diagramLayer).empty();$(n._expander).empty();$(i.svg.document.parentNode.getElementsByClassName("htmlLayer")[0]).empty()});this.nodes([]);this.connectors([]);this._nodes=[];this._connectors=[];this.nameTable={};this.selectionList=[];this.clearHistory();this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch();this._updateScrollOffset(0,0)}},_updateChildOnGroup:function(n){var i=null,t;return n&&n.parent&&(i=this._svg.document.getElementById(n.parent),t=this.nameTable[n.parent],t&&(t.container?ej.datavisualization.Diagram.ContainerHelper._add(this,n):(t.children.push(n.name),n._type=="group"&&this._initGroupNode(n),ej.datavisualization.Diagram.Util._refreshParentGroup(n,this)))),i},_raiseChildrenPropertyChange:function(n,t){var i,r,s;if(n&&n.parent){var r=this._findNode(n.parent),e,o,u=[],f=[];r&&(r.isLaneStack?(i=this._getNode(r.parent),f=i.lanes,f=f.slice(),t?i.lanes.push(n):i.lanes.splice(u.indexOf(this.getNode(n.name)),1),u=i.lanes,e=i,o="lanes"):r.isPhaseStack?(i=this._getNode(r.parent),f=i.phases,f=f.slice(),t?i.phases.push(n):i.phases.splice(u.indexOf(this.getNode(n.name)),1),u=i.phases,e=i,o="phases"):(r=this._getNode(n.parent),f=r.children.slice(),u=r.children.slice(),t?u.push(n.name):u.splice(u.indexOf(n.name),1),e=r,o="children"),s={element:e,cause:this._isDragg||this.activeTool.inAction?ej.datavisualization.Diagram.ActionType.Mouse:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:o,oldValue:f,newValue:u},this._raisePropertyChange(s))}},addLane:function(n,t){var i,r;n.isLane&&(n=this._dynamicLane(n,this),t||n.parent?(i=this._updateDynamicLane(this,n,t),i&&i.isSwimlane?(r=this.nameTable[this._getChild(i.children[2])],n=ej.datavisualization.Diagram.canvasHelper._updateDropLaneProperties(this,n,i),t||t===0?r.children.splice(t,0,n.name):r.children.push(n.name),n.parent=r.name,this._swimlaneObject=!0):n=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(n,this),this.add(n),r&&i&&(ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,r),ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,i),this._clearSelection(!0),this._addSelection(i)),delete this._swimlaneObject):(n=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(n,this),this.add(n)))},_dynamicLane:function(n,t){var i=ej.datavisualization.Diagram.SwimLaneHelper._createPaletteLane(n,t.nameTable),r=i.orientation;return i=ej.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(i,t.nameTable),i.minHeight=n.height,i.minWidth=n.width,i.parent=n.parent,i.orientation=r,n.orientation&&(i.orientation=n.orientation),i.isLane&&(i=ej.datavisualization.Diagram.ContainerHelper._initContainer(t,i)),i},_updateDynamicLane:function(n,t){var i,r;if(t.parent)r=n.nameTable[t.parent];else for(i=0;i<this.selectionList.length;i++)r=this.selectionList[i];return r},_add:function(n,t,i,r){var v,y,e,f,u,s,p,h,c,l,o,w,a,b;if(!n.length>0&&(n=ej.datavisualization.Diagram.NodeType(n,this),this.model.nodeTemplate&&n._type==="node"?v=this._getNodeTemplate():y=this._getConnectorTemplate(),v&&v(this,n),y&&y(this,n)),n.pivot||(n.pivot={x:.5,y:.5}),this._outOfBoundsOnNudge(n,0,0)){if(this._raiseChildrenPropertyChange(n,!0),e=!1,(n.isSwimlane||n.type==="swimlane")&&!this._pasteObj&&this._isNewNode&&(n=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n)),n.length>0)for(o=0;o<n.length;o++)this.add(n[o]);else if(n.addInfo&&(n.addInfo.height&&(n.height=n.addInfo.height),n.addInfo.width&&(n.width=n.addInfo.width)),f=n.type=="connector"?"connector":"node",u={changeType:"insert",element:this.getNode(n)},n.isLane?(u=this._raiseCollectionChangeEvent(n,f),this._updateLane(n,u.element)):n.isSwimlane?(u=this._raiseCollectionChangeEvent(n,f),this._updateSwimlane(n,u.element,!0)):n.container&&!$.isEmptyObject(n.container)&&(n=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n)),n.isLane||n.isSwimlane){if(!u.cancel&&(e=n.isLane&&(this._selectedSymbol&&this._selectedSymbol.isLane||this._swimlaneObject||this._isUndo)?!0:this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[n.name]=n,e)){if(n._type==="group"&&t){if(this._paletteItemClick&&(n.offsetX=n.minWidth/2+50,n.offsetY=n.minHeight/2+50),ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this),n.phases&&n.phases.length>0)for(l=null,o=0,w=n.phases.length;o<w;o++)l=this.nameTable[n.phases[o]],l.type=="phase"&&ej.datavisualization.Diagram.SvgContext.renderphase(l,this._svg,this._diagramLayer,this);this._clearSelection(!0);this._addSelection(n)}this._updateQuad(n)}}else n.type!="connector"?(c=this._eventCause[f+"CollectionChange"],c||(this._eventCause[f+"CollectionChange"]=this._isUndo?ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange:ej.datavisualization.Diagram.CollectionChangeCause.Unknown),n._type==="group"||n.children&&n.children.length>0?(n=ej.datavisualization.Diagram.Group(n),this.nameTable[n.name]=n,u=this._raiseCollectionChangeEvent(n,f),n._type="group",n.type=="bpmn"&&(n=ej.datavisualization.Diagram.Util._updateBpmnChild(n,this)),this._initGroupNode(n),this._isGroupNode||n.type==="bpmn"||this._udpateChildRotateAngle(n)):n.isPhase||(n=this._getNewNode(n),this.nameTable[n.name]=n,u=this._raiseCollectionChangeEvent(n,f),this._getNodeDimension(n)),u.cancel||(n._status="new",e=this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[n.name]=n,e&&(n._type==="group"||n.children&&n.children.length>0?(this._updateParent(n),n.offsetX==0&&n.offsetY==0&&ej.datavisualization.Diagram.Util._updateGroupBounds(n,this,!0),this._updateChildrenEdges(n),s=null,s=this._updateChildOnGroup(n),t&&!n.parent&&(delete this._isNodeInitializing,ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this))):t&&(s=null,s=this._updateChildOnGroup(n),(n.parent===""||n.isPhase||this._isInsert)&&ej.datavisualization.Diagram.DiagramContext.renderNode(n,this,s),this._selectedSymbol&&n.textBlock&&(p=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],p&&(h=$(p).find("#"+n.name)[0],h&&h.childNodes&&h.childNodes.length>0&&(h.childNodes[0].style.display="none")))),this._updateQuad(n),this.nameTable[n.name]=n,t&&!r&&(this._clearSelection(!0),this._addSelection(n))))):(n=this._getNewConnector(n),this.nameTable[n.name]=n,c=this._eventCause[f+"CollectionChange"],c||(this._eventCause[f+"CollectionChange"]=this._isUndo?ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange:ej.datavisualization.Diagram.CollectionChangeCause.Unknown),u=this._raiseCollectionChangeEvent(n,f),u.cancel||(e=n.parent?!0:this.connectors().push(n),n._status="new",e&&(this._updateEdges(n),this._dock(n,this.nameTable),ej.datavisualization.Diagram.Util.updateBridging(n,this),n.parent||t&&ej.datavisualization.Diagram.DiagramContext.renderConnector(n,this),this.nameTable[n.name]=n,this._updateQuad(n),this._updateChildOnGroup(n),t&&!r&&(this._clearSelection(!0),this._addSelection(n)))));this._setZorder(n);!this._isUndo&&(!this._selectedSymbol||this._endEditing)&&e&&(a={},this.selectionList&&this.selectionList.length>0&&(a=this._getChildTable(this.selectionList[0],a)),i&&(!i||i.entryHistory)||n.isPhase||(b={type:"collectionchanged",object:jQuery.extend(!0,{},n),childTable:jQuery.extend(!0,{},a),changeType:"insert",category:"internal"},this.addHistoryEntry(b)));this._trigger("refresh");e&&!n.isPhase&&(!this._selectedSymbol||this._endEditing)&&(u.state="changed",this._raiseEvent(f+"CollectionChange",u))}return delete this._isNewNode,e},_raiseCollectionChangeEvent:function(n,t){var i={changeType:"insert",element:this.getNode(n),state:"changing"};return n.isPhase||this._selectedSymbol&&!this._endEditing||(this._raiseEvent(t+"CollectionChange",i),n._absolutePath=null),i},add:function(n,t){if(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this)){this._isNodeInitializing=!0;this._isNewNode=!0;var i=this._add(n,!0,t);return delete this._isNodeInitializing,i}},updateUserHandles:function(n){n=this.nameTable[n.name];ej.datavisualization.Diagram.SvgContext.updateUserHandles(this.model.selectedItems.userHandles,n,this._adornerSvg,!1,!1,this._currZoom,this)},scrollToNode:function(n){var u,f,i=this._currZoom,r=this.element[0].getBoundingClientRect(),t=ej.datavisualization.Diagram.Util.bounds(n),e,o;u=(t.x+t.width/2)*i;f=(t.y+t.height/2)*i;e=this._hScrollOffset;o=this._vScrollOffset;r.width+this._hScrollOffset<u+t.width/2*i&&(e=u+(t.width/2+20)*i-r.width);r.height+this._vScrollOffset<f+t.height/2*i&&(o=f+(t.height/2+20)*i-r.height);this._updateScrollOffset(e,o)},findNode:function(n){return this._findNode(n)},getObjectType:function(n){return ej.datavisualization.Diagram.Util.getObjectType(n)},_registerDrawingTools:function(){var t,n;for(t in this.model.drawingTools)n=this.model.drawingTools[t],n.diagram=this,this.tools[n.name]=n},_sortByXvalue:function(n){for(var f,i,r,u,e,o,t=0;t<n.length;t++)for(i=t+1;i<n.length;i++)e=this.nameTable[this._getChild(n[t])],o=this.nameTable[this._getChild(n[i])],r=ej.datavisualization.Diagram.Util.bounds(e),u=ej.datavisualization.Diagram.Util.bounds(o),(r.x>u.x||r.right>u.right)&&(f=n[t],n[t]=n[i],n[i]=f);return n},_sortByYvalue:function(n){for(var f,i,r,u,e,o,t=0;t<n.length;t++)for(i=t+1;i<n.length;i++)e=this.nameTable[this._getChild(n[t])],o=this.nameTable[this._getChild(n[i])],r=ej.datavisualization.Diagram.Util.bounds(e),u=ej.datavisualization.Diagram.Util.bounds(o),(r.y>u.y||r.bottom>u.bottom)&&(f=n[t],n[t]=n[i],n[i]=f);return n},_sortByZIndex:function(n,t){var u,i,r;if(t)for(i=0;i<n.length;i++)for(r=i+1;r<n.length;r++)n[i].zOrder>n[r].zOrder&&(u=n[i],n[i]=n[r],n[r]=u);else for(i=0;i<n.length;i++)for(r=i+1;r<n.length;r++)n[i].zOrder<n[r].zOrder&&(u=n[i],n[i]=n[r],n[r]=u);return n},_updateBPMNIndex:function(n,t){var s,r,u,o,i,f,e;if(n.type==="bpmn"&&n.parent&&(o=this.nameTable[n.parent],o&&o.isLane))for(i=o.children,r=0;r<i.length;r++)for(u=r+1;u<i.length;u++)f=this.nameTable[i[r]],e=this.nameTable[i[u]],!(t?f.zOrder>e.zOrder:f.zOrder<e.zOrder)||f.isPhase||e.isPhase||f.isLane||e.isLane||(s=i[r],i[r]=i[u],i[u]=s)},_sortByGroupChildrenZIndex:function(n){for(var s=this.nodes(),h,i,u,r,t,f,e,o=0;o<s.length;o++)if(r=s[o],this._updateBPMNIndex(r,n),r._type==="group"&&r.type!=="bpmn"&&!r.isSwimlane){for(t=this._getChildren(r.children),i=0;i<t.length;i++)for(u=i+1;u<t.length;u++)f=this.nameTable[t[i]],e=this.nameTable[t[u]],!(n?f.zOrder>e.zOrder:f.zOrder<e.zOrder)||f.isPhase||e.isPhase||f.isLane||e.isLane||(h=t[i],t[i]=t[u],t[u]=h);r.children=t}},_findCornerNodes:function(){var i,r,u,f,e,n,s=this.selectionList[0].children,o=this.nameTable[this.selectionList[0].children[0]],t,h,c,l,a;if(i=o,r=o,u=o,f=o,s.length>1)for(e=0;e<s.length;e++)t=this.nameTable[s[e]],n=ej.datavisualization.Diagram.Util.bounds(t),h=ej.datavisualization.Diagram.Util.bounds(r),n.x+n.width>h.x+h.width&&(r=t),c=ej.datavisualization.Diagram.Util.bounds(f),n.y+n.height>c.y+c.height&&(f=t),l=ej.datavisualization.Diagram.Util.bounds(i),n.x<l.x&&(i=t),a=ej.datavisualization.Diagram.Util.bounds(u),n.y<a.y&&(u=t);return{left:i,right:r,top:u,bottom:f}},_comparePropertyOnAlign:function(n,t,i,r){n&&(n.segments?(this._comparePropertyValues(n,"sourcePoint",{sourcePoint:{x:n.sourcePoint.x+t,y:n.sourcePoint.y+i}},r),this._comparePropertyValues(n,"targetPoint",{targetPoint:{x:n.targetPoint.x+t,y:n.targetPoint.y+i}},r)):(n.offsetX!=n.offsetX+t&&this._comparePropertyValues(n,"offsetX",{offsetX:n.offsetX+t},null,r),n.offsetY!=n.offsetY+i&&this._comparePropertyValues(n,"offsetY",{offsetX:n.offsetY+i},null,r)))},_moveNode:function(n,t,i){this._comparePropertyOnAlign(i,n,t,ej.datavisualization.Diagram.ActionType.Align);this._translate(i,n,t,this.nameTable);this._updateNodeMargin(i);ej.datavisualization.Diagram.DiagramContext.update(i,this)},_updateContainerOnNudge:function(n){var t=this.nameTable[n.parent];t&&t.container&&(ej.datavisualization.Diagram.canvasHelper._updateNodeMargin(this,n,t),ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,t,!0))},_outOfBoundsOnNudge:function(n,t,i){var r=this.nameTable[this._getChild(n.parent)],u,e,h,a;if(r&&r.isLane&&r.parent){if(u=this.nameTable[this._getChild(r.parent)],u&&u.isLaneStack&&u.parent&&(e=this.nameTable[this._getChild(u.parent)],e&&this.model.pageSettings.boundaryConstraints!="infinity")){var c=ej.datavisualization.Diagram.Util.bounds(r),l=ej.datavisualization.Diagram.Util.bounds(n),f=ej.datavisualization.Diagram.Util.bounds(e),o=f.right,s=f.bottom;if(l.bottom+i+20>=c.bottom&&(s+=i),l.right+t+20>=c.right&&(o+=t),h=this.activeTool._getPageBounds(),i>0&&f.bottom!=s&&s>h.height||t>0&&f.right!=o&&o>h.width)return!1}}else return a=this.tools.move,a._outOfBoundsDrag(n,t,i);return!0},_nudge:function(n,t,i,r,u,f){var a,s,v,e,y,c,o;if(!n||!n.segments||!n.sourceNode||!n.targetNode){var l,k=this.nameTable[n.parent],h;if(this._outOfBoundsOnNudge(n,t,i)){if(!u)if(n.segments)h={element:n,cause:ej.datavisualization.Diagram.ActionType.Nudge,keyCode:r,propertyName:"sourcePoint",oldValue:{sourcePoint:n.sourcePoint},newValue:{sourcePoint:{x:n.sourcePoint.x+t,y:n.sourcePoint.y+i}}},this._raisePropertyChange(h),h={element:n,cause:ej.datavisualization.Diagram.ActionType.Nudge,keyCode:r,propertyName:"targetPoint",oldValue:{targetPoint:n.targetPoint},newValue:{targetPoint:{x:n.targetPoint.x+t,y:n.targetPoint.y+i}}},this._raisePropertyChange(h);else{var p=r==="right"||r==="left"?n.offsetX:n.offsetY,w=r==="right"||r==="left"?n.offsetX+t:n.offsetY+i,b=r==="right"||r==="left"?"offsetX":"offsetY";h={element:n,cause:ej.datavisualization.Diagram.ActionType.Nudge,keyCode:r,propertyName:b,oldValue:p,newValue:w};this._raisePropertyChange(h)}if(e=this.nameTable[n.parent],e&&e.isLane&&(a=this._moveOnLane(n,e,t,i)),!0&&(!a||a.proceedY)||(i=0),!0&&(!a||a.proceedX)||(t=0),n.type=="pseudoGroup"){for(s=this._removeContainerConnector(this._getChildren(n.children)),s=this._sortByYvalue(s),s=this._sortByXvalue(s),v=s.length-1;v>=0;v--)if(l=this.nameTable[this._getChild(s[v])],l){if(!this._nudge(l,t,i,r,!0,v===0))break;this._updateContainerOnNudge(l)}ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdateNode(this,l);delete this._disableSwimlaneUptate;ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)}else this._translate(n,t,i,this.nameTable),this._updateContainerOnNudge(n);if(this._updateNodeMargin(n),n.parent){if(e=this.nameTable[n.parent],e&&e.container&&(ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),this._disablePhaseUpdate=!0,this._disableSwimlaneUptate=!0,e.container.type==="canvas"&&ej.datavisualization.Diagram.canvasHelper._updateCollectionChange(this,e),delete this._disablePhaseUpdate,!u,y=this.nameTable[e.parent],y&&(c=this.nameTable[y.parent],ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,c),!u,this._updateSwimlanes||(this._updateSwimlanes=[]),this._collectionContains(c.name,this._updateSwimlanes)||this._updateSwimlanes.push(c.name),u||(delete this._disableSwimlaneUptate,ej.datavisualization.Diagram.DiagramContext.update(c,this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,c,!0)))),f&&this._updateSwimlanes){for(delete this._disableSwimlaneUptate,o=0;o<this._updateSwimlanes.length;o++)ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[this._updateSwimlanes[o]],this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,this.nameTable[this._updateSwimlanes[o]]);delete this._updateSwimlanes}}else if(f&&this._updateSwimlanes){for(o=0;o<this._updateSwimlanes.length;o++)ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[this._updateSwimlanes[o]],this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,this.nameTable[this._updateSwimlanes[o]]);delete this._updateSwimlanes}else ej.datavisualization.Diagram.DiagramContext.update(n,this);return this._updateSelectionHandle(!0),!0}return!1}},_removeContainerConnector:function(n){var r=[],t,i;if(n&&n.length>0)for(t=0;t<n.length;t++)i=this.nameTable[this._getChild(n[t])],i&&!i.segments?r.push(n[t]):!i.segments||i.sourceNode||i.targetNode||r.push(n[t]);return r},_moveOnLane:function(n,t,i,r){var h=!1,o=0,c=!1,s=0,u,f,e;return i=i?i:0,r=r?r:0,t.children&&t.children.length>0&&(u=this.nameTable[this._getChild(t.children[0])],u&&u.name.indexOf("_Headerr")!=-1&&(t.orientation==="horizontal"?o=u.width:t.orientation==="vertical"&&(s=u.height))),n&&t?(f=ej.datavisualization.Diagram.Util.bounds(n),e=ej.datavisualization.Diagram.Util.bounds(t),f.y+r>=e.y+t.paddingTop+s&&(h=!0),f.x+i>=e.x+t.paddingLeft+o&&(c=!0),{proceedY:h,proceedX:c,x:e.x+t.paddingLeft+o-f.x+i,y:e.y+t.paddingTop+s-f.y+r}):void 0},_selectCommand:function(n){this._isEditing&&(this._endEdit(),document.getElementById(this._id).focus());n.keyDownEventArgs.preventDefault();this.selectAll()},_nudgeCommand:function(n){!this._currentState&&this.selectionList[0]&&(this._currentState={x:this.selectionList[0].offsetX,y:this.selectionList[0].offsetY});this.nudge(n.parameter,n.keyDownEventArgs.shiftKey?5:1);n.keyDownEventArgs.preventDefault()},_startEditCommand:function(){var n,t,i;this.selectionList.length>0&&(n=this.selectionList[0],n.type=="pseudoGroup"||(n.type==="text"&&this._setLabelEditing(n.textBlock)&&this._startEdit(n),n.isSwimlane?(t=this.nameTable[n.name+"_header_swimlane"],t&&this._startEdit(t)):n.isLane?n.children&&n.children.length>0&&(t=this.nameTable[this._getChild(n.children[0])],t&&this._startEdit(t)):n.type&&n.type==="phase"?(i=this.nameTable["phaseStack"+n.name],i&&this._startEdit(i)):n.labels.length>0&&this._setLabelEditing(n.labels[0])&&this._startEdit(n)))},_findObjectByName:function(n){var t=null;return this._findNode(n)&&(t=this._findNode(n)),this._findConnector(n)&&(t=this._findConnector(n)),t},_findObjectByIndex:function(n,t){var e,u=null,i,r,f,o;if(t){if(o=this.nameTable[this.selectionList[0].parent],o)for(e=this._getChildren(o.children),f=0;f<e.length;f++)i=this.nameTable[e[f]],i.zOrder===n&&(u=e[f])}else{for(r=0;r<this.nodes().length;r++)i=this.nodes()[r],i.zOrder===n&&(u=i);for(r=0;r<this.connectors().length;r++)i=this.connectors()[r],i.zOrder===n&&(u=i)}return typeof u=="string"?this.nameTable[u]:u},_findOverlapNode:function(n){var i=[],t,r,s=[],u,h,e,o,f;if(n.parent){if(u=ej.datavisualization.Diagram.Util.bounds(n),h=this.nameTable[n.parent],h)for(o=this._getChildren(h.children),t=0;t<o.length;t++)o[t]!==n.name&&(e=this.nameTable[o[t]],f=ej.datavisualization.Diagram.Util.bounds(e),e&&this._intersect(u,f)&&s.push(e))}else{for(t=0;t<this.nodes().length;t++)i.push(this.nodes()[t]);for(t=0;t<this.connectors().length;t++)i.push(this.connectors()[t]);if(u=ej.datavisualization.Diagram.Util.bounds(n),n)for(r=0;r<i.length;r++)f=ej.datavisualization.Diagram.Util.bounds(i[r]),n.name===i[r].name||n.children&&this._collectionContains(i[r].name,n.children)||this._intersect(u,f)&&s.push(i[r])}return s},_intersect:function(n,t){return n.x<=t.x+t.width&&t.x<=n.x+n.width&&n.y<=t.y+t.height&&t.y<=n.y+n.height},_focusToItem:function(n){var u=this.nodes(),f=this.connectors(),i=0,r=[],t,e=this;if(u.length||f.length){this._diagramElements||(r=this.nodes().concat(this.connectors()),r=this._sortByZIndex(r,!0),r=r.map(function(n){return n.name}),this._diagramElements=r);i=this._focusedElement||this.selectionList.length||!this._diagramElements.length?this._focusedElement?this._diagramElements.indexOf(this._focusedElement):this.selectionList[0].type!="pseudoGroup"?this._diagramElements.indexOf(this.selectionList[0].name):Math.min.apply(Math,this.selectionList[0].children.map(function(n){return e._diagramElements.indexOf(n.name||n)})):n.keyDownEventArgs.shiftKey?0:this._diagramElements.length-1;do(i=n.keyDownEventArgs.shiftKey?i!=0?--i:this._diagramElements.length-1:i!=this._diagramElements.length-1?++i:0,this.nameTable[this._diagramElements[i]].type!="pseudoGroup")&&(this._focusedElement=this._diagramElements[i]);while(!ej.datavisualization.Diagram.Util.canSelect(this.nameTable[this._focusedElement]));t=ej.datavisualization.Diagram.Util.bounds(this.nameTable[this._focusedElement]);t={x:t.x-8,y:t.y-8,width:t.width+16,height:t.height+16};this.bringIntoView({x:t.x-25,y:t.y-25,width:t.width+50,height:t.height+50});ej.datavisualization.Diagram.SvgContext._drawNavigationHighlighter(t,this._adornerSvg,this._adornerLayer,this._currZoom);n.keyDownEventArgs.preventDefault()}},_selectFocusedItem:function(n){ej.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this._adornerSvg,this._adornerLayer);var t=this.nameTable[this._focusedElement];this._eventCause.selectionChange=ej.datavisualization.Diagram.SelectionChangeCause.Keydown;t&&this.addSelection(t,!0);this._diagramElements=null;this._focusedElement=null;n.keyDownEventArgs.preventDefault()},_createDefaultTooltip:function(){var n=document.createElement("div"),t={id:this.element[0].id+"_DefaulttooltipDiv","class":"e-diagram-tooltip-default",style:"padding-top:3px; height: 24px;pointer-events:none;"},i;return ej.datavisualization.Diagram.Util.attr(n,t),this._tooltipLayer.appendChild(n),this.model.tooltipTemplateId||(i=document.createElement("span"),t={"class":"e-diagram-tooltipLabel-default",id:"e-diagram-tooltipLabel-default"},ej.datavisualization.Diagram.Util.attr(i,t),n.appendChild(i)),n},_createMouseOverTooltip:function(){var n=document.createElement("div"),t={id:this.element[0].id+"_mouseovertooltipDiv","class":"e-diagram-tooltip-mouseover",style:"pointer-events:none;"};return ej.datavisualization.Diagram.Util.attr(n,t),this._tooltipLayer.appendChild(n),n},_renderTooltip:function(n,t){var r,e,u,o,s,f,h,i;n.parent&&this.nameTable[n.parent]&&this.nameTable[n.parent].container||this.model.selectedItems.tooltip&&(r=document.getElementById(this.element[0].id+"_DefaulttooltipDiv"),r||(r=this._createDefaultTooltip()),f=this._currZoom,this.model.selectedItems.tooltip.templateId?$.templates&&this.model.selectedItems.tooltip&&(n.segments||(i=this._getTooltipPosition(n,this.model.selectedItems.tooltip),i.x=-this._hScrollOffset+i.x*f,i.y=-this._vScrollOffset+i.y*f,r.style.top=i.y+"px",r.style.left=i.x+"px",r.style.transform="translate("+i.tx+" ,"+i.ty+")",e=$.templates("#"+this.model.selectedItems.tooltip.templateId),o=e.render(n),$(r).html(o))):(t&&(r.style.width="150px"),s=150,h=r.childNodes[0],this.activeTool instanceof ej.datavisualization.Diagram.MoveTool?n.segments||(u="X : "+Math.round(n.offsetX-n.width*n.pivot.x)+"px Y : "+Math.round(n.offsetY-n.height*n.pivot.y)+"px"):this.activeTool instanceof ej.datavisualization.Diagram.ResizeTool?u="W : "+Math.round(n.width)+"px H : "+Math.round(n.height)+"px":this.activeTool instanceof ej.datavisualization.Diagram.RotateTool&&(t&&(r.style.width="50px"),s=50,u=Math.round(n.rotateAngle)+"°"),u?(i=this._getTooltipPosition(n,this.model.selectedItems.tooltip),i.x=-this._hScrollOffset+i.x*f,i.y=-this._vScrollOffset+i.y*f,r.style.top=i.y+"px",r.style.left=i.x+"px",r.style.transform="translate("+i.tx+" ,"+i.ty+")",h.textContent=u):this._removeTooltip()))},_removeTooltip:function(){var n=document.getElementById(this.element[0].id+"_DefaulttooltipDiv");n&&n.parentNode.removeChild(n)},_removeMouseOverTooltip:function(){var n=document.getElementById(this.element[0].id+"_mouseovertooltipDiv");n&&n.parentNode.removeChild(n)},_renderCanvas:function(n){this._browserInfo=ej.browserInfo();this._canvas=document.getElementById(this.element[0].id+"_canvas");this._canvas||(this._canvas=document.createElement("div"),this.element.append(this._canvas));this._canvas.setAttribute("id",this.element[0].id+"_canvas");(this._canvas.getAttribute("class")===null||this._canvas.getAttribute("class")==="")&&this._canvas.setAttribute("class","drawing");this._canvas.setAttribute("style","position:relative; height:"+this.model.height+"; width:"+this.model.width+";");this.element.css({overflow:"hidden",outline:"none",display:"block",height:this.model.height,width:this.model.width});this._views[this._id].canvas=this._canvas;this.element[0].setAttribute("tabindex",0);this._renderDiagram(n);ej.datavisualization.Diagram.Util.canFloatElements(this)&&this._setItemDraggable(this._canvas)},_getDigramBounds:function(n){var t,i,u,f,r;return t=this._spatialSearch.pageLeft||0,i=this._spatialSearch.pageTop||0,u=this._spatialSearch.pageRight-this._spatialSearch.pageLeft||0,f=this._spatialSearch.pageBottom-this._spatialSearch.pageTop||0,n!="content"&&(this.model.pageSettings&&this._multiplePage()?(t=this._spatialSearch.pageLeft,i=this._spatialSearch.pageTop,this._pageWidth()&&(t=Math.floor(t/this._pageWidth())*this._pageWidth(),u=Math.ceil(this._spatialSearch.pageRight/this._pageWidth())*this._pageWidth()-t),this._pageHeight()&&(i=Math.floor(i/this._pageHeight())*this._pageHeight(),f=Math.ceil(this._spatialSearch.pageBottom/this._pageHeight())*this._pageHeight()-i),this._spatialSearch.pageRight===null&&this._pageWidth()!==0&&(u=this._pageWidth()),this._spatialSearch.pageBottom===null&&this._pageHeight()!==0&&(f=this._pageHeight())):(this._pageWidth()&&(t=0,u=this._pageWidth()),this._pageHeight()&&(i=0,f=this._pageHeight()))),r=new ej.datavisualization.Diagram.Rectangle,r.x=t,r.y=i,r.width=u,r.height=f,r},_initContextMenu:function(n){this.enableContextMenu()?this._renderContextMenu(n):$("#"+this.element[0].id+"_contextMenu").remove()},_renderContextMenuItem:function(n){var r=document.createElement("li"),o=document.createElement("a"),h=ej.datavisualization.Diagram.Locale[this.locale()],t,u,f,e,i,s;if(o.innerHTML=h[n.name]||n.text,r.setAttribute("id",this.element[0].id+"_contextMenu_"+n.name),t=document.createElement("span"),t.setAttribute("id",n.name+"_image"),u="display:table-cell; vertical-align:middle; text-align:center;",n.imageUrl&&(u=u+"background-image: url("+n.imageUrl+");width:25px;height:25px"),t.setAttribute("style",u),f="sf-d-menuitem "+n.name,n.cssClass&&(f=f+" "+n.cssClass),t.setAttribute("class",f),o.appendChild(t),n.subItems&&n.subItems.length>0){for(e=document.createElement("ul"),i=0,i;i<n.subItems.length;i++)s=this._renderContextMenuItem(n.subItems[i],e),s.setAttribute("style","display:block;"),e.appendChild(s);r.appendChild(e)}return r.appendChild(o),r},_renderContextMenu:function(){var f=$.extend(!0,[],this.model.contextMenu.items),r,e,u,n,t,s,i,o;if(!this.model.contextMenu.showCustomMenuItemsOnly){for(r=[],n=0;n<this._defaultContextMenuItems.length;n++)if(e=!1,this.model.contextMenu.items.length)for(u=0;u<this.model.contextMenu.items.length;u++){if(this.model.contextMenu.items[u].name===this._defaultContextMenuItems[n].name){e=!0;break}u!==this.model.contextMenu.items.length-1||e||r.push(this._defaultContextMenuItems[n])}else r.push(this._defaultContextMenuItems[n]);for(n=0;n<r.length;n++)f.push(r[n])}for(n=0,i=document.createElement("ul"),i.setAttribute("id",this.element[0].id+"_contextMenu"),n=0;n<f.length;n++)t=f[n],t.templateId?(o=this._renderEjTemplate("#"+t.templateId,t),o&&(i.innerHTML=o)):t&&t.name&&(s=this._renderContextMenuItem(t,i),i.appendChild(s));this._canvas.appendChild(i);$("#"+this.element[0].id+"_contextMenu").ejMenu({menuType:ej.MenuType.ContextMenu,contextMenuTarget:"#"+this.element[0].id+"_canvas",click:$.proxy(this._onMenuItemClick,this),beforeOpen:$.proxy(this._onContextMenuOpen,this),mouseover:$.proxy(this._onMenuItemMouseOver,this),mouseout:$.proxy(this._onMenuItemMouseOut,this),close:$.proxy(this._onContextMenuClose,this)});$("#"+this.element[0].id+"_contextMenu")[0].style.display="none"},_onContextMenuClose:function(){this.element[0].focus()},_onContextMenuOpen:function(n){var t,i,r,u;if(this._disableDefaultContextMenu)return delete this._disableDefaultContextMenu,!1;t=this.element[0].id;i=this._findNodeUnderMouse(n);i===null&&n.target&&$(n.target).attr("class")==="segmentEnd"&&this.selectionList[0]&&(i=this.selectionList[0]);r=!1;$(n.target).parents(".e-scrollbar").length&&this.enableContextMenu()&&(n.cancel=!0,$("#"+this.element[0].id+"_contextMenu").ejMenu("instance").hideContextMenu());this.selectionList[0]&&(this.selectionList[0].type==="pseudoGroup"||this.selectionList[0]._type==="group")&&(r=!0);!i&&this.selectionList.length>0&&!r&&this._clearSelection();this.enableContextMenu()&&($("#"+t+"_contextMenu_cut")[0]&&($("#"+t+"_contextMenu_cut")[0].style.display=this.selectionList.length?"block":"none"),$("#"+t+"_contextMenu_copy")[0]&&($("#"+t+"_contextMenu_copy")[0].style.display=this.selectionList.length?"block":"none"),$("#"+t+"_contextMenu_paste")[0]&&($("#"+t+"_contextMenu_paste")[0].style.display=this._clipboardData?"block":"none"),$("#"+t+"_contextMenu_undo")[0]&&($("#"+t+"_contextMenu_undo")[0].style.display=this._historyList&&this._historyList.canUndo?"block":"none"),$("#"+t+"_contextMenu_redo")[0]&&($("#"+t+"_contextMenu_redo")[0].style.display=this._historyList&&this._historyList.canRedo?"block":"none"),$("#"+t+"_contextMenu_selectAll")[0]&&($("#"+t+"_contextMenu_selectAll")[0].style.display=this.nodes().length+this.connectors().length?"block":"none"),$("#"+t+"_contextMenu_grouping")[0]&&($("#"+t+"_contextMenu_grouping")[0].style.display=this.selectionList[0]&&(this.selectionList[0].type=="group"||this.selectionList[0].type=="pseudoGroup")?"block":"none"),$("#"+t+"_contextMenu_order")[0]&&($("#"+t+"_contextMenu_order")[0].style.display=this.selectionList.length?"block":"none"));u={diagram:this,contextmenu:n};u.target=this.selectionList.length?this.selectionList[0]:this.activeTool.prevSelectObject?this.activeTool.prevSelectObject:this;this._trigger("contextMenuBeforeOpen",u);this.enableContextMenu()&&($("#"+t+"_contextMenu")[0].style.display="block",$("#"+t+"_contextMenu")[0].clientHeight<=2&&(n.cancel=!0),$("#"+t+"_contextMenu")[0].style.display="none");n.events&&!n.events.originalEvent&&(n.events.originalEvent=n.events);this.activeTool.mouseup(n.events,!0)},_onMenuItemClick:function(n){var t=n.events.ID.replace(this._id+"_contextMenu_","");if(n.canExecute=!0,n.target=this.selectionList.length?this.selectionList[0]:this.activeTool.prevSelectObject?this.activeTool.prevSelectObject:this,this._trigger("contextMenuClick",n),n.canExecute)switch(t){case"cut":this.cut();break;case"copy":this.copy();break;case"paste":this.paste();break;case"undo":this.undo();break;case"redo":this.redo();break;case"selectAll":this.selectAll();break;case"group":this.group();break;case"ungroup":this.ungroup();break;case"bringToFront":this.bringToFront();break;case"sendToBack":this.sendToBack();break;case"moveForward":this.moveForward();break;case"sendBackward":this.sendBackward()}},_onMenuItemMouseOver:function(n){var t=n.events.element.lastChild.childNodes[1];$(t).addClass("hover")},_onMenuItemMouseOut:function(n){var t=n.events.element.lastChild.childNodes[1];$(t).removeClass("hover")},_renderDiagram:function(n){var t=this;this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);this._doLayout();this._views.forEach(function(i){var r=t._views[i],u;r.type=="mainview"&&r.context==ej.datavisualization.Diagram.SvgContext&&(r.context._renderDocument(r,t,n),t._createScrollbar(t._canvas),ej.datavisualization.Diagram.ScrollUtil._initScrollbar(t),ej.datavisualization.Diagram.PageUtil._updatePageSize(t));n||(u=t._setNodeZOrder(r),t._renderDiagramObjects(u,r))});$(this._svg.document).pinchDiagram(this._view,this)},_createScrollbar:function(n){var i=document.createElement("div"),t;i.setAttribute("id",n.id+"_hScrollbar");document.getElementById(n.id+"_hScrollbar")||n.appendChild(i);t=document.createElement("div");t.setAttribute("id",n.id+"_vScrollbar");document.getElementById(n.id+"_vScrollbar")||n.appendChild(t)},_disableScrollbar:function(){this._isMobile&&($("#"+this._hScrollbar._id).addClass("e-disable").attr({"aria-disabled":!0,style:"display: none;"}),$("#"+this._vScrollbar._id).addClass("e-disable").attr({"aria-disabled":!0,style:"display: none;"}))},_doLayout:function(){this.model.layout&&this._layoutType()!==ej.datavisualization.Diagram.LayoutTypes.None&&(this._updateEdgeCollection(),ej.datavisualization.Diagram.Layout.doLayout(this))},_updateNodes:function(){for(var t=this.nodes(),n=0;n<t.length;n++)ej.datavisualization.Diagram.DiagramContext.update(t[n],this)},_updateConnectors:function(){for(var t=this.connectors(),n=0;n<t.length;n++)ej.datavisualization.Diagram.DiagramContext.update(t[n],this)},_updateEdgeCollection:function(){for(var n=0;n<this.connectors().length;n++)this._updateEdges(this.connectors()[n])},updateViewPort:function(){this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);ej.datavisualization.Diagram.DiagramContext.updateViewPort(this);this.model.scrollSettings.viewPortHeight=this._viewPort.height;this.model.scrollSettings.viewPortWidth=this._viewPort.width;var n=this;this._views.forEach(function(t){var r=n._views[t],i;r.type=="overview"&&(i=$("#"+t).ejOverview("instance"),i&&i._scrollOverviewRect(n._hScrollOffset,n._vScrollOffset,n._currZoom))})},_containsSameIndex:function(n,t){var u,f,e,o,s,r,i;if(t){for(s=t.children,i=0;i<s.length;i++)if(r=this.nameTable[this._getChild(s[i])],r&&r.zOrder&&r.zOrder===n)return!0}else{for(u=this.nodes(),i=0;i<u.length>0;i++)if(f=u[i],f&&f.zOrder===n)return!0;for(e=this.connectors(),i=0;i<e.length>0;i++)if(o=e[i],o&&o.zOrder===n)return!0}return!1},_setZorder:function(n){var r,t,i;if(n&&n.zOrder){if(n.zOrder==-1)if(this._containsSameIndex(this._zOrder)){do this._zOrder++;while(this._containsSameIndex(this._zOrder));n.zOrder=this._zOrder}else n.zOrder=this._zOrder,this._zOrder++;if(n._type==="group")for(r=n.children,i=0;i<r.length;i++)t=this.nameTable[this._getChild(r[i])],t&&t.zOrder&&t.zOrder===-1&&this._setZorder(t)}},_union:function(n,t){var i=Math.min(n.x,t.x),r=Math.min(n.y,t.y),u=Math.max(n.x+n.width,t.x+t.width),f=Math.max(n.y+n.height,t.y+t.height);return new ej.datavisualization.Diagram.Rectangle(i,r,u-i,f-r)},_getSeperetor:function(n){return this.nameTable[n]},_updateNextPhase:function(n,t,i){ej.datavisualization.Diagram.SwimLaneContainerHelper._updateNextPhase(this,n,t,i)},_getOuterNodes:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getOuterNodes(this,n,t,i)},_getInnerNodes:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getInnerNodes(this,n,t,i)},_moveOuterNodes:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._moveOuterNodes(this,n,t,i)},_moveOnPhaseChange:function(n,t,i){ej.datavisualization.Diagram.SwimLaneContainerHelper._moveOnPhaseChange(this,n,t,i)},_getPhaseDifferece:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getPhaseDifferece(this,n,t,i)},_updatePhaseOffset:function(n){var t=this.nameTable[n.name],o,i,e=this.nameTable[t.parent],f=this._getChildren(e.children),u=f.indexOf(t.name),r;f&&f.length>0&&u>-1&&n.offset!=undefined&&(o=this.nameTable[f[u]],i=n.offset-t.offset,r=this.nameTable[e.parent],i=this._getPhaseDifferece(r,u,i),this._moveOuterNodes(r,i,u),u===0?t.orientation==="horizontal"?(t.width+=i,t.offset=t.width,this._comparePropertyValues(r,"offsetX",{offsetX:r.offsetX+i/2},this.activeTool.inAction)):(t.height+=i,t.offset=t.height,this._comparePropertyValues(r,"offsetY",{offsetY:r.offsetY+i/2},this.activeTool.inAction)):t.orientation==="horizontal"?(t.width+=i,t.offset+=i,this._comparePropertyValues(r,"offsetX",{offsetX:r.offsetX+i/2},this.activeTool.inAction)):(t.height+=i,t.offset+=i,this._comparePropertyValues(r,"offsetY",{offsetY:r.offsetY+i/2},this.activeTool.inAction)),this._disablePhaseUpdate=!0,this._disableSwimlaneUptate=!0,ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),this._moveOnPhaseChange(t,i,u),this._updateNextPhase(r,i,u),delete this._disablePhaseUpdate,delete this._disableSwimlaneUptate,ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,r))},_updatePhase:function(n){var t=this.nameTable[n.name];t&&(t.offset!=undefined&&n.offset!=undefined&&n.offset!=t.offset&&(this._comparePropertyValues(t,"offset",{offset:n.offset},this.activeTool.inAction),this._updatePhaseOffset(n),this._hasSelection()&&this._clearSelection(!0)),this._updateSwimlanePhase(t,n))},_setNodeZOrder:function(){for(var o=null,n=this.nodes(),i,f,t,r,u,s,h,n=n.concat(this.connectors()),e=0;e<n.length;e++)n[e].parent===""&&this._setZorder(n[e]);for(i=0;i<n.length;i++){for(f=i+1;f<n.length;f++)n[i].zOrder>n[f].zOrder&&n[i].parent===""&&n[f].parent===""&&(o=n[i],n[i]=n[f],n[f]=o);if(n[i]._type==="group"&&(t=n[i].children,!n[i].isSwimlane))for(r=0;r<t.length;r++)for(u=r+1;u<t.length;u++)s=typeof t[r]=="object"?t[r]:this.nameTable[t[r]],h=typeof t[u]=="object"?t[u]:this.nameTable[t[u]],!(s.zOrder>h.zOrder)||s.isPhase||h.isPhase||s.isLane||h.isLane||(o=t[r],t[r]=t[u],t[u]=o)}return n},_renderDiagramObjects:function(n,t,i,r){for(var e,o,u=0,f=n.length;u<f;++u)this.getObjectType(n[u])==="node"||this.getObjectType(n[u])==="group"?(e=this.nameTable[n[u].name],this._isLoad&&(this._disableSegmentChange=!0),ej.datavisualization.Diagram.DiagramContext._renderNodeObject(e,t,i,r,this),this._isLoad&&delete this._disableSegmentChange):(o=this.nameTable[n[u].name]||n[u],ej.datavisualization.Diagram.DiagramContext._renderConnectorObject(o,t,this))},_unWireEvents:function(){var n=$(this._canvas);this._off(n,ej.eventType.mouseDown,this._mousedown);this._off(n,ej.eventType.mouseMove,this._mousemove);this._off(n,ej.eventType.mouseUp,this._mouseup);this._off(n,ej.eventType.mouseLeave,this._documentmouseup);this._off(n,"doubletap",this._doubleclick);this._off(this.element,"keydown",this._keydown);this._off(this.element,"keyup",this._keyup);this._off(n,"pinchin",this._pinchin);this._off(n,"pinchout",this._pinchout);this._off(this.element,"touchstart",this._handleTouchStart);ej.browserInfo().name==="mozilla"?this._off(this.element,"DOMMouseScroll",this._handleMouseWheel):this._off(this.element,"mousewheel",this._handleMouseWheel);this._off($(document),"mouseup",this._documentmouseup);window&&this.model.constraints&ej.datavisualization.Diagram.DiagramConstraints.Resizable&&this._off($(window),"resize",this.updateViewPort)},_wireEvents:function(){var t=$(this._canvas),n;this._on(t,ej.eventType.mouseDown,this._mousedown);this._on(t,ej.eventType.mouseMove,this._mousemove);this._on(t,ej.eventType.mouseUp,this._mouseup);this._on(t,ej.eventType.mouseLeave,this._documentmouseup);this._on(t,"doubletap",this._doubleclick);this._on(this.element,"keydown",this._keydown);this._on(this.element,"keyup",this._keyup);this._on(this.element,"contextmenu",this._preventDefaultContextMenu);this._on(t,"pinchin",this._pinchin);this._on(t,"pinchout",this._pinchout);this._on(this.element,"touchstart",this._handleTouchStart);ej.browserInfo().name==="mozilla"?this._on(this.element,"DOMMouseScroll",this._handleMouseWheel):this._on(this.element,"mousewheel",this._handleMouseWheel);this._on($(document),"mouseup",this._documentmouseup);window&&this.model.constraints&ej.datavisualization.Diagram.DiagramConstraints.Resizable&&this._on($(window),"resize",this.updateViewPort);n=this;$(t).ejDroppable({over:function(t){n._isDropOver=!0;var i=!1;t.originalEvent&&t.originalEvent.changedTouches?i=!0:t&&t.changedTouches&&(i=!0);i||n.activeTool.inAction===!1&&n._selectedSymbol&&(n._viewPort||(n._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(n,!0)),n._addSymbolToDiagram(t),n._isSvgDropover=!0)},out:function(){delete n._isDropOver},drop:function(t,i){n._svgdrop(t,i);n._isDropped=!0}})},_preventDefaultContextMenu:function(n){if(this._disableDefaultContextMenu)return n.preventDefault(),n.stopPropagation(),delete this._disableDefaultContextMenu,!1},_mousePosition:function(n,t){var u=this._isTouchEvent(n),e=this._scrollLeft!==undefined?this._scrollLeft:this._canvas.scrollLeft,o=this._scrollTop!==undefined?this._scrollTop:this._canvas.scrollTop,f=this._controlBBox?this._controlBBox:this._canvas.getBoundingClientRect(),i=u.clientX+e-f.left,r=o+u.clientY-f.top;return t||(i=(i+this._hScrollOffset)/this._currZoom,r=(r+this._vScrollOffset)/this._currZoom),new ej.datavisualization.Diagram.Point(Math.round(i*100)/100,Math.round(r*100)/100)},_contextmenu:function(n){n.preventDefault();n.stopPropagation()},_pinchin:function(n){this._getTouchEvent(n);n.preventDefault()},_pinchout:function(n){this._getTouchEvent(n);n.preventDefault()},_handleTouchStart:function(n){this._getTouchEvent(n);n.preventDefault()},_getTouchEvent:function(n){this._isTouchedEvent=n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"?!0:!1},_mousedown:function(n){var r,t,u,i;this._getTouchEvent(n);this._isPinching=!1;this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);this._diagramElements=null;ej.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this._adornerSvg,this._adornerLayer);this._invoke(n)&&(this._scrollLeft=this._canvas.scrollLeft,this._scrollTop=this._canvas.scrollTop,this._controlBBox=this._canvas.getBoundingClientRect(),r=this._mousePosition(n),n.preventDefault(),this.model.contextMenu&&$("#"+this.element[0].id+"_contextMenu").css("display")!=="none"&&(n.cancel=!0),this._isEditing&&(this._endEdit(),this.activeTool.name==="textTool"&&this.activeTool.singleAction&&this.activeTool.diagram.deactivateTool()),(n.which===1||n.which===3||n.which===0&&n.originalEvent.changedTouches)&&(this._removeMouseOverTooltip(),n.which===0&&n.originalEvent.changedTouches&&(t=null,u=this._isUserHandle(n),this._isInternalTool(this.activeTool)&&!this.activeTool.inAction&&(u||(t=this._findNodeUnderMouse(n),this._raiseMouseEvents(t,r)),!t&&this.selectionList[0]&&(t=this.selectionList[0]),ej.datavisualization.Diagram.Util.isPageEditable(this)&&this._checkToolToActivate(n,t))),(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)&&n.shiftKey&&(t=this._findNodeUnderMouse(n),!t&&this.selectionList[0]&&(t=this.selectionList[0]),this._checkToolToActivate(n,t)),this._toolToActivate==="panTool"?this.activeTool=this.tools[this._toolToActivate]:(this._toolToActivate==="move"&&(t=this._findNodeUnderMouse(n),t&&t.isLane&&ej.datavisualization.Diagram.Util.canMultiSelectOnLane(t)&&(this._toolToActivate="select",this._currentCursor="default",this._updateCursor())),i=this.tools[this._toolToActivate]||this.activeTool,this.activateTool(this._toolToActivate,i?i.singleAction:null)),this.activeTool.mousedown(n),this._focusedElement=this.activeTool._findNodeUnderMouse(n,!0)))},_mousemove:function(n){var f,i,t,r,u;if(this._getTouchEvent(n),this._mouseEventTriggered=!0,this._viewPort||(this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0)),n.type=="touchmove"&&n.originalEvent.touches.length>1)this._isPinching=!0;else if(this._isPinching=!1,i=null,f=this._isUserHandle(n),this.activeTool.inAction===!1&&this._selectedSymbol)this._addSymbolToDiagram(n);else{if(this._isInternalTool(this.activeTool)&&!this.activeTool.inAction?(f||(i=ej.datavisualization.Diagram.Util.isClassifier(n)?ej.datavisualization.Diagram.ClassifierHelper.getSelectableElementUnderMouse(n,this):this._findNodeUnderMouse(n),i&&(this._nodeUnderMouse&&this._nodeUnderMouse!=i&&!this._nodeUnderMouse.segments&&this.activeTool._showPort(this._nodeUnderMouse,!0),i.segments||this.activeTool._showPort(i))),!i&&this.selectionList[0]&&(i=this.selectionList[0]),ej.datavisualization.Diagram.Util.isPageEditable(this)&&this._checkToolToActivate(n,i),n.which==1&&n.buttons==1&&(this._focusedElement=this.activeTool._findNodeUnderMouse(n,!0))):(this.activeTool.inAction||(this._toolToActivate=this.activeTool.name,this._currentCursor=this.activeTool.cursor),t=ej.datavisualization.Diagram.Util.isClassifier(n)?ej.datavisualization.Diagram.ClassifierHelper.getDropableElementUnderMouse(n,this):this._findNodeUnderMouse(n),i),this._updateCursor(),t=t||this._findNodeUnderMouse(n),this.activeTool.mousemove(n),this._raiseMouseEvents(t,n),r=!1,this.activeTool.inAction){do if(t&&!ej.datavisualization.Diagram.Util.canAllowDrop(t))if(t.parent)t=this.nameTable[t.parent];else if(t.segments){r=!0;break}else if(t.container)break;else t=null;else break;while(t);this._nodeUnderMouse&&this._nodeUnderMouse.segments&&this._nodeUnderMouse!=t&&ej.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this._adornerLayer,this._adornerSvg);t&&t!=this._focusedElement&&t!=this.nodeUnderMouse&&(r||ej.datavisualization.Diagram.Util.canAllowDrop(t))?(u=this.getObjectType(t),this._focusedElement&&(this._focusedElement.isLane||this._focusedElement.isSwimlane||this._focusedElement.isPhase)&&u=="node"&&u=="connector"?this._nodeUnderMouse=null:this._nodeUnderMouse&&(this._nodeUnderMouse.isLane||this._nodeUnderMouse.isSwimlane||this._nodeUnderMouse.isPhase)&&t.segments||(this._nodeUnderMouse=t)):t&&t.container||(this._nodeUnderMouse=null)}else this._focusedElement||(this._nodeUnderMouse=t);this._initiateAutoScroll(n)}},_mouseup:function(n){var e,r,f,o,c,t,s,i,u,h;this._getTouchEvent(n);!this._isPinching&&n.originalEvent&&n.originalEvent.target&&this._invoke(n)&&(e=this._isForeignObject(n.originalEvent.target),!e&&this._isHyperLink(n)&&n.preventDefault(),this.activeTool instanceof ej.datavisualization.Diagram.PanTool?(document.onmousemove=null,document.onmouseup=null,(!ej.datavisualization.Diagram.Util.isPageEditable(this)||this.activeTool instanceof ej.datavisualization.Diagram.PanTool)&&!this.activeTool.inAction&&(t=this.activeTool._findNodeUnderMouse(n),t&&this._raiseEvent("itemClick",{actualObject:t,selectedObject:t,model:this.model,cancel:!1,event:n}),r=this._mousePosition(n.originalEvent),this._raiseEvent("click",{element:t,actualObject:this.getNode(this.activeTool.actualObject),count:this._getEventDetail(n),offsetX:r.x,offsetY:r.y,event:n}),this.activeTool instanceof ej.datavisualization.Diagram.PanTool&&(document.onmousemove=null,document.onmouseup=null))):n.target.id!==this._id+"_canvas_svg"||!this.activeTool.name!="panTool"&&this.activeTool.inAction||(r=this._mousePosition(n.originalEvent),this._raiseEvent("click",{element:this,actualObject:this.getNode(this.activeTool.actualObject),count:this._getEventDetail(n),offsetX:r.x,offsetY:r.y,event:n})),n.target&&!this._isAnimating&&(f=$(n.target).parents(".ej-d-icon-template"),f&&f.length&&(o=f[0],o.id.endsWith("_expander")&&(c=o.id.replace("_expander",""),t=this.nameTable[c],t&&(s=this.getObjectType(t),(s=="node"||s=="group")&&(this.clearSelection(),ej.datavisualization.Diagram.LayoutUtil.expandSubTree(this,t,t.name,!0,ej.datavisualization.Diagram.Util.canSelect(t))))))),!this._selectedSymbol||this._selectedSymbol.isLane||this._isNodeEnters?this._selectedSymbol&&this._isNodeEnters&&(i=this.findNode(this.selectionList[0].name),this.edgeTable?delete this.edgeTable:(u={},u=this._getChildTable(this.selectionList[0],u),this._selectedSymbol.type=="pseudoGroup"?h={type:"collectionchanged",object:this._updatePsedoGroupChildren(this._selectedSymbol),childTable:jQuery.extend(!0,{},u),changeType:"insert",category:"internal"}:this._selectedSymbol.isPhase||(h={type:"collectionchanged",object:jQuery.extend(!0,{},this._selectedSymbol),childTable:jQuery.extend(!0,{},u),changeType:"insert",category:"internal"}),this.addHistoryEntry(h),this._isDragg=!0),this._clearSelection(!0),this._selectedSymbol=null,delete this._isNodeEnters,i.type=="pseudoGroup"&&(this.nodes().push(i),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[i.name]=i,ej.datavisualization.Diagram.Util._updateGroupBounds(i,this)),this._addSelection(i)):(this._findLabelEditing=!0,this._dropSymbol(null,n),delete this._findLabelEditing,this._isDragg=!0),ej.browserInfo().name==="msie"&&this._doubleClickEvent&&(this.activeTool._isMouseDown=!0),this.activeTool.mouseup(n),this.activeTool instanceof ej.datavisualization.Diagram.TextTool||!document.activeElement||document.activeElement.id===this.element[0].id||this._isEditing||e||this.element[0].focus(),this._currentCursor=this.activeTool.cursor,this.activeTool.name==="move"&&this._focusedElement&&!ej.datavisualization.Diagram.Util.canSelect(this._focusedElement)?(this._currentCursor="default",this._updateCursor()):this._updateCursor());this._isSvgDropover&&($("#"+this.element[0].id+"_canvas").ejDroppable("instance")._mouseOver=!1);delete this._isSvgDropover;this._focusedElement=null;this._nodeUnderMouse=this._findNodeUnderMouse(n);delete this._scrollLeft;delete this._scrollTop;delete this._controlBBox;this._mouseEventTriggered=!1;this._isDragg=!1;delete this._viewPort;delete this._isDropOver;this._timeStamp=n.timeStamp},_doubleclick:function(n){var u,e,f,t,i,r;if(this._getTouchEvent(n),this._doubleClickEvent=!this._doubleClickEvent,t=this._nodeUnderMouse||this,u={element:this.getNode(t),cancel:!1,actualObject:this.getNode(this.activeTool.actualObject)},this._isEditing||this._raiseEvent("doubleClick",u),e=this.activeTool._drawingPolygon,this.activeTool.name!="panTool"&&(this._nodeUnderMouse&&this.activeTool._doubleClick(this._nodeUnderMouse),ej.datavisualization.Diagram.Util.isClassifier(n)&&(f=ej.datavisualization.Diagram.ClassifierHelper.getEditableElementUnderMouse(n,this)),ej.datavisualization.Diagram.Util.isPageEditable(this)&&!this.activeTool.inAction&&(this.selectionList.length>0||f||this.activeTool.selectedObject)&&!u.cancel&&!e)){if(t=this.activeTool.selectedObject?this.activeTool.selectedObject:this.selectionList[0]?this.selectionList[0]:f,t.type=="umlclassifier")for(i=0;i<t.children.length;i++)t.children[i]=typeof t.children[i]=="string"?this.nameTable[t.children[i]]:t.children[i],i!=t.children.length-t.children.length&&i==t.children.length-1&&(t.children[i].labels[0].text="\n---\n"+t.children[i].labels[0].text),i!=t.children.length-t.children.length&&i==t.children.length-2&&(t.children[i].labels[0].text="\n---\n"+t.children[i].labels[0].text),t.labels[0].text+=t.children[i].labels[0].text;this._isEditing||t.type=="pseudoGroup"||u.cancel||(this.activeTool._findLabelUnderMouse(n,!1,this._mousePosition(n.originalEvent),!0),t.labels&&t.labels.length>0&&(r=this.activeTool.getLabelUnderMouse(),r||(r=t.labels[0])),!this._isEditing&&t.type==="text"&&this._setLabelEditing(t.textBlock)?(this.scrollToNode(t),this._startEdit(t)):this._isEditing||t.isLane||t.isSwimlane||!(t.labels&&(t.labels.length===0||typeof t.labels.length=="undefined")||t.labels&&t.labels.length>0&&this._setLabelEditing(r))?t.isLane&&t.labels&&t.labels.length>0&&this._setLabelEditing(r)?t.labels&&t.labels.length>0?(this.scrollToNode(t),this._startEdit(t)):this.activeTool.selectedObject=null:t.isLane&&(this.activeTool.selectedObject=null):(this.scrollToNode(t),this._startEdit(t)))}this.activeTool._isMouseDown=!1},_documentmouseup:function(n){var i,t;this._getTouchEvent(n);i=this._selectedSymbol;this._removeMouseOverTooltip();this._viewPort||(this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0));!this.activeTool||!this.activeTool.inAction||this.activeTool instanceof ej.datavisualization.Diagram.TextTool||this.activeTool instanceof ej.datavisualization.Diagram.ShapeTool&&this.activeTool._drawingPolygon||(this._selectedSymbol&&n.type!="mouseleave"&&(this._findLabelEditing=!0,this._dropSymbol(null,n),delete this._findLabelEditing,this._isDragg=!0),this.activeTool.mouseup(n,!0));i&&(n.keyCode!=27&&n.keyCode!=46&&(t=document.getElementsByClassName("e-paletteItem dragClone")[0],t!=null&&(t.style.display="block"),this._selectedSymbol=i),this._raiseEvent("dragLeave",{element:this.selectionList[0]}),this._mouseEventTriggered&&this._delete(this.selectionList[0]));this._isNodeEnters&&(delete this._isNodeEnters,this._selectedSymbol=null,t=document.getElementsByClassName("dragClone")[0],t!=null&&(t.style.display="block"));delete this._viewPort;delete this._isDropOver;this._mouseEventTriggered=!1;this._isDragg=!1},_invoke:function(n){if(n.originalEvent.target){var t=n.originalEvent.target.className;if(t&&typeof t=="string"&&(t=="edit"||t=="editBox"||t.indexOf("e-hhandle")>-1||t.indexOf("e-hhandlespace")>-1||t.indexOf("e-vhandle")>-1||t.indexOf("e-vhandlespace")>-1))return!1}return!0},_handleMouseWheel:function(n){var r,t,u,i,o,f,s,h,e;n.originalEvent.preventDefault&&n.originalEvent.preventDefault();r=new ej.datavisualization.Diagram.Point(0,0);this._isEditing&&this._endEdit();(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)?(r=this._mousePosition(n.originalEvent),n.originalEvent.wheelDelta>0||-40*n.originalEvent.detail>0?ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1+Number(this.zoomFactor()),0,0,r,!0):ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1/(1+Number(this.zoomFactor())),0,0,r,!0)):(t=0,u={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:this._viewPort},n.originalEvent.wheelDelta>0||-40*n.originalEvent.detail>0?(o=this._vScrollbar.model.minimum,f=this._scrollLimit()==="limited"&&this._vScrollOffset-this._scrollPixel>=this.model.pageSettings.scrollableArea.y*this._currZoom,this._vScrollOffset-this._scrollPixel>=o||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity||f?(this._updateScrollOffset(this._hScrollOffset,this._vScrollOffset-this._scrollPixel),i=!0,t=-this._scrollPixel):(this._updateScrollOffset(this._hScrollOffset,o),i=!0,t=0)):(s=this._vScrollbar.model.maximum,h=ej.datavisualization.Diagram.ScrollUtil._viewPort(this),f=this._scrollLimit()==="limited"&&(this.model.pageSettings.scrollableArea.y+this.model.pageSettings.scrollableArea.height)*this._currZoom>=this._vScrollOffset+this._scrollPixel+h.height,s>=this._vScrollOffset+this._scrollPixel||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity||f?(this._updateScrollOffset(this._hScrollOffset,this._vScrollOffset+this._scrollPixel),i=!0,t=this._scrollPixel):(this._updateScrollOffset(this._hScrollOffset,s),i=!0,t=0)),i&&(e={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:this._viewPort},(u.horizontalOffset!=e.horizontalOffset||u.verticalOffset!=e.verticalOffset)&&(this._eventCause.scrollChange=ej.datavisualization.Diagram.ScrollChangeCause.Pan,this._raiseEvent("scrollChange",{newValues:e,oldValues:u}))),this._updateEditBox(0,t))},_setActiveTool:function(n){var u=this._mousePosition(n),t,i,r;this.activeTool.inAction||!this._isUserHandleActive(this.activeTool.name)&&this.model.selectedItems.userHandles&&this.model.selectedItems.userHandles.length||(this._isInternalTool(this.activeTool)||this.activeTool.singleAction)&&(i=!1,this.selectionList[0]&&(t=this.selectionList[0],i=this._checkToolToActivate(n,t)),i||(t=this._findNodeUnderMouse(n),this._isUserHandle(n)?(r=$(n.target).parents("g").first().context.id.split("_")[0],this._checkToolToActivate(n,t),this.activeTool=this.tools[this._toolToActivate]):(this._checkToolToActivate(n,t),this._raiseMouseEvents(t),this._isUserHandleActive(this.activateTool.name)&&!this._drawingTool&&(this.activeTool=this.tools[this._toolToActivate]))))},_beginAutoScroll:function(n,t,i){var o=i?i:100,u=this,f=0,e=0,r=ej.datavisualization.Diagram.ScrollUtil._viewPort(this),s=this._hScrollbar.model.maximum+r.width,h=this._vScrollbar.model.maximum+r.height;if(this._canAutoScroll){switch(n){case"right":(this._hScrollOffset+r.width+10<s||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(f=10);break;case"left":(this._hScrollOffset-10>this._hScrollbar.model.minimum||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(f=-10);break;case"bottom":(this._vScrollOffset+r.height+10<h||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(e=10);break;case"top":(this._vScrollOffset-10>this._vScrollbar.model.minimum||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(e=-10)}u._clearTimeOutValue=window.setTimeout(function(i){var r=this,i={delay:o};u._raiseEvent("autoScrollChange",i);u._updateScrollBar(f,e,n,t,i.delay)},o)}},_updateScrollBar:function(n,t,i,r,u){if(this._clearTimeOutValue&&window.clearTimeout(this._clearTimeOutValue),n===0&&t===0)this._canAutoScroll=!1;else if(this.activeTool.inAction){var f=this._hScrollOffset+n*this._currZoom,e=this._vScrollOffset+t*this._currZoom,o=this._updateSelectionOnScroll(n,t);o?(this._updateScrollOffset(f,e),this._beginAutoScroll(i,r,u)):this._canAutoScroll=!1}},_updateSelectionOnScroll:function(n,t){var i=this.activeTool,r,f,e,u;if(i.name==="select")i.currentPoint=new ej.datavisualization.Diagram.Point(i.currentPoint.x+n,i.currentPoint.y+t),i._updateHelper();else if(i.name==="orthogonalLine"||i.name==="straightLine")i.currentPoint=new ej.datavisualization.Diagram.Point(i.currentPoint.x+n,i.currentPoint.y+t),i._targetPossibleConnection=i._currentPossibleConnection,i._targetPort=i._possibleConnectionPort,i._updateHelper();else if(this.selectionList.length>0){if(r=this.selectionList[0],r.isLane||(i.currentPoint=ej.datavisualization.Diagram.Point(i.currentPoint.x+n,i.currentPoint.y+t)),i.name==="move")if(!r.isLane&&i._outOfBoundsDrag(r,n,t))i._canMoveLabel?this._translateLabel(r,i.activeLabel,n,t):this._translate(r,n,t,this.nameTable);else return!1;else i.name==="resize"?(ej.datavisualization.Diagram.SnapUtil._removeGuidelines(this),i._updateSize(r,i.previousPoint,i.currentPoint)):i.name==="endPoint"&&(i.selectedSegment&&i._endPoint=="segmentEnd"?(f=i.currentPoint.x-i.previousPoint.x,e=i.currentPoint.y-i.previousPoint.y,i._updateAdjacentSegments(f,e)):(u=i._updatePoints(r),u.cancel||(i._disconnect(r),i._updateConnection(r,u.updateSelection))));i.previousPoint=ej.datavisualization.Diagram.Point(i.currentPoint.x,i.currentPoint.y);i._canMoveLabel||r.type=="phase"||(ej.datavisualization.Diagram.DiagramContext.update(r,this),this._updateSelectionHandle(!0),this._renderTooltip(r))}return!0},_isUserHandle:function(n){return n.target.parentNode.className.animVal==="userHandle"?!0:!1},_isUserHandleActive:function(n){var i=!1,t,r;if(this.model.selectedItems.userHandles&&this.model.selectedItems.userHandles.length>0)for(t=0,r=this.model.selectedItems.userHandles.length,t;t<r;t++)if(this.model.selectedItems.userHandles[t].name===n){i=!0;break}else i=!0;return i},_getEventDetail:function(n){return ej.browserInfo().name==="msie"?this._timeStamp?n.timeStamp-this._timeStamp>=300?1:2:1:n.originalEvent.detail},_raiseMouseEvents:function(n,t){var i,r;this._isEditing||(this._nodeUnderMouse&&(!n||this._nodeUnderMouse!=n)&&(i=document.getElementById(this.element[0].id+"_mouseovertooltipDiv"),i&&i.parentNode.removeChild(i),this._raiseEvent("mouseLeave",{element:this.getNode(this._nodeUnderMouse)}),this._nodeUnderMouse==null||this._nodeUnderMouse.segments||this.activeTool instanceof ej.datavisualization.Diagram.LineTool||this.activeTool._showPort(this._nodeUnderMouse,!0)),n&&this._nodeUnderMouse!==n&&this._raiseEvent("mouseEnter",{element:this.getNode(n)}),n&&(r={element:this.getNode(n)},this._raiseEvent("mouseOver",r),r.element&&!this.activeTool.inAction?this._renderMouseOverTooltip(n,t):this._removeMouseOverTooltip()))},_renderMouseOverTooltip:function(n,t){var v,i,w,h,c,l,y,p,a,nt,f,b,k;if(ej.datavisualization.Diagram.Util.canShowTooltip(n,this)&&(v=this.getObjectType(n),w=v=="node"||v=="group"?ej.datavisualization.Diagram.NodeConstraints:ej.datavisualization.Diagram.ConnectorConstraints,n.constraints&w.InheritTooltip?(i=this.model.tooltip,h=!0):i=n.tooltip,i&&(!h||this._tooltipTemplateId()))){a=this._getTooltipPosition(n,i,t,h);c=a.x;l=a.y;y=a.tx;p=a.ty;c=-this._hScrollOffset+c*this._currZoom;l=-this._vScrollOffset+l*this._currZoom;nt="left:"+c+"px; top:"+l+"px; display: block; position: absolute; pointer-events: none; transform:translate("+y+","+p+")";f=document.getElementById(this.element[0].id+"_mouseovertooltipDiv");f||(f=this._createMouseOverTooltip());f.style.left=c+"px";f.style.top=l+"px";f.style.transform="translate("+y+" ,"+p+")";f.style.display="block";f.style.position="absolute";$.templates&&(b=h?this._tooltipTemplateId():i.templateId,k=$.templates("#"+b).render(n));$(f).html(k);f.style.marginLeft=f.style.marginTop="0px";var u=this.element[0].getBoundingClientRect(),r=f.getBoundingClientRect(),d=this.model.scrollSettings.currentZoom,g=ej.datavisualization.Diagram.Util.bounds(n,this.activeTool.name=="rotatetool"?!0:!1);if(u.left>r.left||u.right<r.right){if((h?this._tooltipMode():i.relativeMode)=="mouse"||i.alignment.horizontal=="center")var s=u.left>r.left?"left":"right",o=s=="right"?r.right-u.right:u.left-r.left,e=s=="right"?-o-i.margin.right:i.margin.left+o;else(i.alignment.horizontal=="left"||i.alignment.horizontal=="right")&&i.alignment.vertical=="center"?(e=g.width*d+r.width+i.margin.left+i.margin.right,e=i.alignment.horizontal=="left"?e*1:e*-1):(s=i.alignment.horizontal,s=="center"&&(s=u.left>r.left?"left":"right"),o=s=="right"?r.right-u.right:u.left-r.left,e=s=="right"?-o-i.margin.right:i.margin.left+o);f.style.marginLeft=e+"px"}(u.bottom<r.bottom||u.top>r.top)&&((h?this._tooltipMode():i.relativeMode)=="mouse"||i.alignment.vertical=="center"?(s=u.top>r.top?"top":"bottom",o=s=="top"?r.top-u.top:r.bottom-u.bottom,e=s=="top"?i.margin.top-o:-(o+i.margin.bottom)):i.alignment.horizontal=="center"&&(i.alignment.vertical=="bottom"||i.alignment.vertical=="top")?(e=g.height*d+r.height+(i.margin.bottom+i.margin.top),e=i.alignment.vertical=="bottom"?e*-1:e*1):(o=i.alignment.vertical=="top"?u.top-r.top:u.bottom-r.bottom,e=i.alignment.vertical=="top"?i.margin.top+o:o-i.margin.bottom),f.style.marginTop=e+"px")}},_getTooltipPosition:function(n,t,i,r){var e=ej.datavisualization.Diagram.Util.bounds(n,!1),u,f,o,s,h;if((r?this._tooltipMode():t.relativeMode)=="object"){switch(r?this._horizontalTooltipAlignment():t.alignment.horizontal){case"left":u=e.x;u-=t.margin.left;o="-100%";break;case"right":u=e.right;u+=t.margin.right;o="0%";break;case"center":u=e.center.x;o="-50%"}switch(r?this._verticalTooltipAlignment():t.alignment.vertical){case"top":f=e.y;f-=t.margin.top;s="-100%";break;case"bottom":f=e.bottom;f+=t.margin.bottom;s="0%";break;case"center":f=e.center.y;s="-50%"}}else i&&(h=this._mousePosition(i),u=h.x+t.margin.left,f=h.y+t.margin.top);return{x:u,y:f,tx:o,ty:s}},_isHandle:function(n){var t=$(n.target).parent("g.handle");return t.length>0?!0:!1},_findNodeUnderMouse:function(n){var t=null,i;if(n.target){var r=$(n.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group"),f=n.target.className,u=n.target.id.split("_");if(u[u.length-1]=="lblbg")return;r&&(i=r.attr("class"),i&&(i==="ej-d-node"||i==="ej-d-group"||ej.datavisualization.Diagram.Util.isClassifier(n))?(t=this._findNode(r.attr("id")),t||(t=this._findNode(r.attr("id").split("_parentdiv")[0])),t&&t._isInternalShape&&t.parent&&this.nameTable[t.parent]&&this.nameTable[t.parent].type=="bpmn"&&(t=this.nameTable[t.parent])):i==="ej-d-connector"&&(t=this._findConnector(r.attr("id"))))}return t},_findConnectableNodeUnderMouse:function(n){var t=null,r,e,o,f,v,i,s,h;if(n&&n.type==="touchmove"){var c=this._mousePosition(n),l=ej.datavisualization.Diagram.Rectangle(c.x,c.y,0,0),a=ej.datavisualization.Diagram.SpatialUtil.findQuads(this._spatialSearch,l);for(r=0;r<a.length;r++)if(e=a[r],e.objects.length>0)for(o=0;o<e.objects.length;o++)if(f=e.objects[o],v=ej.datavisualization.Diagram.Util.bounds(f),ej.datavisualization.Diagram.Geometry.intersectsRect(l,v)&&!f.segments&&f.visible)return f}else{for(var p,y=$(n.target).parents(".ej-d-node,.ej-d-group"),u=y[0],r=1;u;)p=u.getAttribute("class"),t=this._findNode(u.getAttribute("id")),t||(t=this._findNode(u.getAttribute("id").split("_parentdiv")[0])),t&&(ej.datavisualization.Diagram.Util.canConnect(t)||!t.parent)?u=null:(u=y[r],r++);t&&(t.type=="umlclassifier"&&(i=this.activeTool.selectedObject),i&&i.sourceNode&&(s=this.nameTable[i.sourceNode]),i&&i.targetNode&&(h=this.nameTable[i.targetNode]),s&&(t=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(t,s,i,this)),h&&(t=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(t,h,i,this)))}return t},_isForeignObject:function(n){var t=n;if(t)while(t.parentNode!=null){if(t.tagName==="foreignObject"||typeof t.className=="string"&&t.className.split(" ").indexOf("foreignObject")!==-1)return t;t=t.parentNode}return null},_altKeyPressed:function(n){return n&ej.datavisualization.Diagram.KeyModifiers.Alt},_ctrlKeyPressed:function(n){return n&ej.datavisualization.Diagram.KeyModifiers.Control},_shiftKeyPressed:function(n){return n&ej.datavisualization.Diagram.KeyModifiers.Shift},_keydown:function(n){var u,t,i,r;this._isKeyDown=!0;this._removeMouseOverTooltip();var e=n.keyCode?n.keyCode:n.which,f=navigator.platform.match("Mac")?n.metaKey:n.ctrlKey,o=n.key;for(u in this.model.commandManager.commands)t=this.model.commandManager.commands[u],t&&t.gesture&&(t.gesture.keyModifiers||t.gesture.key)&&(t.gesture.key&&e!=t.gesture.key&&o!=t.gesture.key||t.gesture.keyModifiers&&(!(f||n.altKey||n.shiftKey)||this._altKeyPressed(t.gesture.keyModifiers)&&!n.altKey||this._shiftKeyPressed(t.gesture.keyModifiers)&&!n.shiftKey||this._ctrlKeyPressed(t.gesture.keyModifiers)&&!f)||(this._currentCommand=u,this._currentCommand!=="focusToNextItem"&&this._currentCommand!=="focusToPreviousItem"&&this._currentCommand!=="selectFocusedItem"&&(this._diagramElements=null,this._focusedElement=null,ej.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this._adornerSvg,this._adornerLayer)),t.execute&&t.canExecute&&(i=t.canExecute,typeof t.canExecute=="string"&&(i=ej.util.getObject(t.canExecute,window)),$.isFunction(i)&&i({model:this.model})&&(r=t.execute,typeof t.execute=="string"&&(r=ej.util.getObject(t.execute,window)),$.isFunction(r)&&r({keyDownEventArgs:n,parameter:t.parameter,model:this.model})))));this.activeTool.keydown(n);this._isKeyDown=!1},_keyup:function(n){var t=n.keyCode?n.keyCode:n.which;this._isEditing||t!==37&&t!==38&&t!==39&&t!==40||(this._currentState,delete this._currentState,n.preventDefault(),this.activeTool.inAction=!1,this._updateSelectionHandle())},_registerHistoryEvents:function(){this.historyManager.addEventHandler("collectionchanged",$.proxy(this._recordCollectionChanged,this));this.historyManager.addEventHandler("positionchanged",$.proxy(this._recordPinPointChanged,this));this.historyManager.addEventHandler("sizechanged",$.proxy(this._recordResizeChanged,this));this.historyManager.addEventHandler("rotationchanged",$.proxy(this._recordRotationChanged,this));this.historyManager.addEventHandler("endpointchanged",$.proxy(this._recordEndPointChanged,this));this.historyManager.addEventHandler("labelchanged",$.proxy(this._recordLabelChanged,this));this.historyManager.addEventHandler("groupingchanged",$.proxy(this._recordGroupChanged,this))},_svgdrop:function(n,t){var f,o,w,s,e,r,h,c;if(this._selectedSymbol&&ej.datavisualization.Diagram.Util.isPageEditable(this)){f={};o=n.originalEvent;o.preventDefault?o.preventDefault():o.returnValue=!1;var l=this._currZoom,a=$("#"+this.element[0].id).offset(),u=this._isTouchEvent(n);u.pageX||n.pageX||(n.originalEvent&&n.originalEvent.changedTouches?u=n.originalEvent.changedTouches[0]:n&&n.changedTouches&&(u=n.changedTouches[0]));var v=(u?u.pageX:n.pageX)+this._hScrollOffset-a.left,y=(u?u.pageY:n.pageY)+this._vScrollOffset-a.top,i=$.extend(!0,{},this._selectedSymbol),p=t.helper[0].getAttribute("paletteId"),b=$("#"+p).ejSymbolPalette("instance");if(p){if(this._selectedSymbol=null,i.name+=ej.datavisualization.Diagram.Util.randomId(),!i.isPhase&&i.segments)i.segments&&ej.datavisualization.Diagram.Util._translateLine(i,v,y),i=this.getNode(i);else if(!i.isPhase){if(w=$.extend(!0,{},b.nameTable),i.offsetX=v/l,i.offsetY=y/l,i._type==="group"){for(s=this._getChildren(i.children),e=0;e<s.length;e++)r=$.extend(!0,{},w[s[e]]),r.parent=i.name,r.name=i.name+r.name,s[e]=r.name,this.nameTable[r.name]=r,this.nodes().push(r),this._nodes=$.extend(!0,[],this.nodes()),this._updateQuad(this.nameTable[r.name]);i.height=i.width=0;this._updateChildBounds(i,this.nameTable)}i._type==="group"?i=this._getNewGroup(i):i.segments?i=this._getNewConnector(i):i.isPhase||i.type==="phase"||(i=this._getNewNode(i))}i&&i.isLane&&(this._cloneGroupNode(i,ej.datavisualization.Diagram.Util.randomId()),i=ej.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(i,this.nameTable));f={element:i,cancel:!1};this._raiseDropEvent(f);i&&i.isLane&&(h=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(i,this),h&&h.isSwimlane&&(i=h));i.isPhase||(f.cancel||this.add(i),i=this.selectionList[0],this.scrollToNode(i),i.labels.length>0&&i.labels[0].mode==="edit"?(this._isEditing=!0,this.startLabelEdit(i,i.labels[0])):this.element[0].focus())}}else c=null,c=this._findNodeUnderMouse(n),f={element:t.helper,e:n,draggable:t.draggable,targetNode:c},this._raiseDropEvent(f)},_isTouchEvent:function(n){return n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"?n.originalEvent?n.originalEvent.changedTouches[0]:n.changedTouches[0]:n},_raiseDropEvent:function(n){n.source=this._symbolPalette?this._symbolPalette:null;n.objectType=n.source?ej.datavisualization.Diagram.ObjectTypes.Palette:ej.datavisualization.Diagram.ObjectTypes.Diagram;this._raiseEvent("drop",n);this._symbolPalette=null},_recordCollectionChanged:function(n,t){var s,o,y,r,e,l,h,f,u,i,c,a,v,p;if(this._isUndo=!0,this._isInsert=!0,s=n.changeType,n.isUndo&&(s=n.changeType=="insert"?"remove":"insert"),this._clearSelection(s=="insert"?!1:!0),s=="insert")if(n.object.container){for(i in n.childTable)u=n.childTable[i],this.nameTable[i]=u;r=n.object;r.isSwimlane?(this.nameTable[r.name]=r,r.width=0,r.height=0,this._swimlanePaste=!0,this._multipleAction=!0,this._eventCause.nodeCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange,this._pasteSwimlaneObj(r),delete this._swimlanePaste,this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange,this._addAssiciatedChildConnectors(r),delete this._multipleAction,this._clearSelection(!0)):r.isLane?(n.object&&n.object.parent&&(c=this.nameTable[n.object.parent]),c&&c&&(a=this.nameTable[c.parent]),a&&(this.activeTool.selectedObject=n.object,ej.datavisualization.Diagram.canvasHelper._addNewLane(this,r,a,!0,n.index),this._addAssiciatedChildConnectors(r),this._clearSelection(!0))):(this.add(r),this._addConnector(r,n))}else if(n.object.type!="pseudoGroup"){if(!n.object.segments){if(o=null,n.object.inEdges&&n.object.inEdges.length>0)for(i=0;i<n.object.inEdges.length;i++)this.nameTable[n.object.inEdges[i]]&&(this.nameTable[n.object.inEdges[i]].targetNode=n.object.name),n.targetPorts&&(o=n.targetPorts[n.object.inEdges[i]]),o&&this.nameTable[n.object.inEdges[i]]&&(this.nameTable[n.object.inEdges[i]].targetPort=o);if(n.object.outEdges&&n.object.outEdges.length>0)for(i=0;i<n.object.outEdges.length;i++)this.nameTable[n.object.outEdges[i]]&&(this.nameTable[n.object.outEdges[i]].sourceNode=n.object.name),n.sourcePorts&&(o=n.sourcePorts[n.object.outEdges[i]]),o&&this.nameTable[n.object.outEdges[i]]&&(this.nameTable[n.object.outEdges[i]].sourcePort=o)}n.object._type==="group"&&this._addChildren(n.object,n.childTable);n.object.isSwimlane&&(n.object=ej.datavisualization.Diagram.SwimLaneHelper._initSwimLane(n.object,this));this.add(n.object,n);n.object.parent&&(y=this.nameTable[n.object.parent]);n.object._type==="group"?(this._addConnector(n.object,n),this._addGroupConnector(n.object,n)):this._addConnector(n.object,n)}else{for(delete this.nameTable.multipleSelection,h=[],f=ej.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup"}),i=0;i<n.object.children.length;i++)u=typeof n.object.children[i]=="object"?n.object.children[i]:n.childTable[n.object.children[i]],u&&(l=this.getObjectType(u),l!=="group"||u.isSwimlane||this._addChildren(u,n.childTable),u.isSwimlane?(this._swimlanePaste=!0,this._isUndo=!0,u=this._pasteSwimlaneObj(u,n),delete this._swimlanePaste):l!="connector"?this.add(u,n):h.push(u),u&&f.children.push(u.name));for(i=0;i<h.length;i++)this.add(h[i],n);for(this._addGroupConnector(n.object,n),i=0;i<f.children.length;i++)if(r=this.nameTable[f.children[i]],r&&!r.segments){if(r.inEdges.length>0)for(e=0;e<r.inEdges.length;e++)this._isUndo?n.childTable[r.inEdges[e]].targetNode=r.name:this.nameTable[r.inEdges[e]].targetNode=r.name;if(r.outEdges.length>0)for(e=0;e<r.outEdges.length;e++)this._isUndo?n.childTable[r.outEdges[e]].sourceNode=r.name:this.nameTable[r.outEdges[e]].sourceNode=r.name}this._clearSelection();this.nodes().push(f);this._nodes=$.extend(!0,[],this.nodes());f.offsetX=n.object.offsetX;f.offsetY=n.object.offsetY;f.height=n.object.height;f.width=n.object.width;f.rotateAngle=n.object.rotateAngle;this.nameTable[f.name]=f;this.addSelection(f,!0)}else if(s=="remove")if(n.object.type=="pseudoGroup"||n.object.isLane)if(n.object.isLane)v=n.object,n.index||n.index==0||(p=null,n.object.isLane&&t&&(t.index=this._getRemoveIndex(n.object,!0))),this._remove(v);else for(i=0;i<n.object.children.length;i++)this._remove(this.nameTable[this._getChild(n.object.children[i])]);else return this._removeAdjacentConnections(n.object,n),n.object.isSwimlane||n.object.annotation?this._remove(this.nameTable[n.object.name]):this._remove(n.object),!0;this._groupUndo||(this._isUndo=!1);this._isInsert=!1;this.tools.move._isLane=!1},_addAssiciatedChildConnectors:function(n){var i=this._getChildren(n.children),r,u,t;if(i&&i.length>0)for(r=0,u=i.length;r<u;r++)t=this.nameTable[i[r]],t&&(this._addConnector(t),t.type==="group"&&this._addAssiciatedChildConnectors(t))},_updateRecordPinPoint:function(n,t,i){var r,o,u,s,h,c,l,e,v,a,f;if(n.type=="pseudoGroup"){for(h=n,c=this._getChildren(n.children),o=0;o<c.length;o++)u=this.nameTable[c[o]],s=t[c[o]],s&&(u.segments?(l=t[u.name],u.sourcePoint=l.sourcePoint,u.targetPoint=l.targetPoint,u.segments=jQuery.extend(!0,u.segments,l.segments)):(this._propertyChangeValues(u,s),this._translate(u,s.offsetX-u.offsetX,s.offsetY-u.offsetY,this.nameTable)),ej.datavisualization.Diagram.DiagramContext.update(u,this));this.selectionList[0]&&this.selectionList[0].name===h.name&&(this.selectionList[0].offsetX=h.offsetX,this.selectionList[0].offsetY=h.offsetY);ej.datavisualization.Diagram.SvgContext.updateSelector(h,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}else n.segments?i?(r=t[n.name],n.sourcePoint=r.sourcePoint,n.targetPoint=r.targetPoint,n.segments=$.extend(!0,[],r.segments),ej.datavisualization.Diagram.DiagramContext.update(n,this)):(this._clearSelection(!0),r=this._findConnector(n.name),n.targetNode&&(e=this.nameTable[n.targetNode],ej.datavisualization.Diagram.Util.removeItem(e.inEdges,n)),n.sourceNode&&(e=this.nameTable[n.sourceNode],ej.datavisualization.Diagram.Util.removeItem(e.outEdges,n)),n.targetNode&&(e=this.nameTable[n.targetNode],e.inEdges.push(n.name)),n.sourceNode&&(e=this.nameTable[n.sourceNode],e.outEdges.push(n.name)),this._propertyChangeConnectorValues(r,n),r.targetNode=n.targetNode,r.sourceNode=n.sourceNode,r.targetPort=n.targetPort,r.sourcePort=n.sourcePort,r.sourcePoint=n.sourcePoint,r.targetPoint=n.targetPoint,r.segments=$.extend(!0,[],n.segments),ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.SvgContext.updateSelector(n,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints),this.addSelection(n,!0)):i?(r=t[n.name],this._translate(n,r.offsetX-n.offsetX,r.offsetY-n.offsetY,t),ej.datavisualization.Diagram.DiagramContext.update(r,this)):(r=this._findNode(n.name),this._clearSelection(!0),this._propertyChangeValues(r,n),n.parent&&(f=this.nameTable[n.parent]),f||(f=this.nameTable[r.parent],v=!0),f&&f.container?(ej.datavisualization.Diagram.canvasHelper._undoDragNode(this,this.nameTable[n.name],n),v&&(a=this.nameTable[f.parent.split("laneStack")[0]],a&&ej.datavisualization.Diagram.DiagramContext.update(a,this))):(this._translate(r,n.offsetX-r.offsetX,n.offsetY-r.offsetY,this.nameTable),n.parent&&ej.datavisualization.Diagram.Util._updateGroupBounds(this.nameTable[r.parent],this),r.parent&&(f=this.nameTable[r.parent],f&&r.parent&&n.parent==""&&(ej.datavisualization.Diagram.Util.removeChildFromGroup(f.children,r.name),this._delete(r),(n.type==="group"||n.type==="bpmn")&&this._initGroupNode(n,t),this.add(n))),n.parent&&(f=this.nameTable[n.parent],n.parent&&r.parent==""&&(this._delete(r),n=$.extend(!0,{},n),(n.type==="group"||n.type==="bpmn")&&this._initGroupNode(n,t),this.add(n)))),ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,r),this.addSelection(r,!0))},_propertyChangeValues:function(n,t){var r=n.offsetX===t.offsetX?"":"offsetX",u=n.offsetY===t.offsetY?"":"offsetY",i;r==="offsetX"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:r,oldValue:n.offsetX,newValue:t.offsetX},this._raisePropertyChange(i));u==="offsetY"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:u,oldValue:n.offsetY,newValue:t.offsetY},this._raisePropertyChange(i))},_propertyChangeResizeValues:function(n,t){var r=t.width===n.width?"":"width",u=t.height===n.height?"":"height",i;r==="width"&&(i={element:n,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:r,oldValue:n.width,newValue:t.width},this._raisePropertyChange(i));u==="height"&&(i={element:n,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:u,oldValue:n.height,newValue:t.height},this._raisePropertyChange(i))},_propertyChangeConnectorValues:function(n,t){var r=n.sourcePoint.x===t.sourcePoint.x||n.sourcePoint.y===t.sourcePoint.y?"":"sourcePoint",u=n.targetPoint.x===t.targetPoint.x||n.targetPoint.y===t.targetPoint.y?"":"targetPoint",i;r==="sourcePoint"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:r,oldValue:n.sourcePoint,newValue:t.sourcePoint},this._raisePropertyChange(i));u==="targetPoint"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:u,oldValue:n.targetPoint,newValue:t.targetPoint},this._raisePropertyChange(i))},_renderNodeOnLane:function(n,t){var i,u,r=this;r._views.forEach(function(f){var e;i=r._views[f];u=i.svg||i._canvas;t=i.svg.getElementById(n.parent);i.type=="overview"&&(e=!0);n._type==="group"?i.context.renderGroup(n,u,t||i.diagramLayer,r.nameTable,r,null,!0):r.getObjectType(n)==="node"&&i.context.renderNode(n,u,t||i.diagramLayer)})},_updateUndoObject:function(n,t){var i,u,r;t.parent&&(r=this.nameTable[t.parent]);r&&this._collectionContains(t.name,r.children)?(ej.datavisualization.Diagram.Util.removeChildFromGroup(r.children,t.name),n.parent&&(i=this.nameTable[n.parent]),i&&i.children&&!this._collectionContains(t.name,i.children)&&(i.children.push(n.name),this.nameTable[n.name].parent=i.name,i.isLane&&(u=this.tools.move,u._updateMargin(t,i)))):n.parent&&(r=this.nameTable[n.parent])},_collectionContains:function(n,t){for(var i=0;i<t.length;i++)if(typeof t[i]=="string"&&t[i]===n||t[i].name===n)return!0},_recordPinPointChanged:function(n){var t=n.object.node,i=n.object.childTable;(t||t.isSwimlane)&&this._updateRecordPinPoint(t,i)},_updateRecordRotation:function(n,t){var f,r,u,e,s,h,o,i;if(n.type=="pseudoGroup"){for(this._clearSelection(!0),this.nameTable[n.name]=n,i=this.nameTable[n.name],e=n.children,f=0;f<e.length;f++)r=this.nameTable[e[f]],u=t[e[f]],r&&(r.segments?(s=t[r.name],r.sourcePoint=s.sourcePoint,r.targetPoint=s.targetPoint):u&&(this._translate(r,u.offsetX-r.offsetX,u.offsetY-r.offsetY,this.nameTable),this._comparePropertyValues(r,"rotateAngle",{rotateAngle:u.rotateAngle}),this._rotate(r,u.rotateAngle-r.rotateAngle,this.nameTable)),ej.datavisualization.Diagram.DiagramContext.update(r,this));i&&(h=n.rotateAngle-i.rotateAngle,i.rotateAngle+=h,this.selectionList[0]&&(this.selectionList[0].rotateAngle=i.rotateAngle));this.nameTable[n.name]=n;this.addSelection(n,!0)}else o=null,n.parent&&(o=this.nameTable[n.parent]),o&&o.container?(i=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoRotateNode(this,i,n)):n&&(this._clearSelection(!0),i=this._findNode(n.name),this._comparePropertyValues(i,"rotateAngle",{rotateAngle:n.rotateAngle}),this._rotate(i,n.rotateAngle-i.rotateAngle,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(i,this),this.addSelection(i,!0))},_recordSizeChanged:function(n,t){var i=n.object.node,r=n.object.childTable;this._updateRecordSize(i,r,t)},_updateRecordSize:function(n,t,i){var r,o,e,h,c,u,s,f;if(this._clearSelection(!0),n._type!=="group"&&n.type!=="pseudoGroup"||n.isLane||n.isSwimlane||n.type==="bpmn")n.isLane||n.isSwimlane?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeLane(this,n,i)):n.type=="bpmn"&&n.container?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeNode(this,r,n)):(f=null,n.parent&&(f=this.nameTable[n.parent]),f&&f.container?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeNode(this,r,n)):n.segments||(r=this._findNode(n.name),this._propertyChangeResizeValues(r,n),this._translate(r,n.offsetX-r.offsetX,n.offsetY-r.offsetY,this.nameTable),this.scale(r,n.width/r.width,n.height/r.height,ej.datavisualization.Diagram.Point(r.offsetX,r.offsetY),this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(r,this),this.addSelection(r,!0)));else{for(n.type=="pseudoGroup"&&(this.nameTable[n.name]=n),r=this._findNode(n.name),h=this._getChildren(r.children),c=this._getChildren(n.children),o=0;h&&o<h.length;o++)u=this.nameTable[c[o]],e=t[c[o]],e&&(u.segments?(s=t[u.name],u.sourcePoint=s.sourcePoint,u.targetPoint=s.targetPoint,u.segments=$.extend(!0,[],s.segments)):(this._propertyChangeResizeValues(u,e),this._translate(u,e.offsetX-u.offsetX,e.offsetY-u.offsetY,this.nameTable),this.scale(u,e.width/u.width,e.height/u.height,ej.datavisualization.Diagram.Point(u.offsetX,u.offsetY),this.nameTable)));f=null;n.parent&&(f=this.nameTable[n.parent]);f&&f.container?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeNode(this,r,n)):(r.offsetX=n.offsetX,r.offsetY=n.offsetY,r.width=n.width,r.height=n.height,this.activeTool.name=="resize"&&this.activeTool.inAction&&this.selectionList[0].type!="pseudoGroup"&&this.selectionList[0].type!="group"||this._updateAssociatedConnectorEnds(r,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(r,this),this.addSelection(r,!0))}},_recordRotationChanged:function(n){var t=n.object.node,i=n.object.childTable;this._updateRecordRotation(t,i)},_recordEndPointChanged:function(n){this.clearSelection(!0);var t,i,r,u;n._isUndo?(t=i=n.undoObject,r=n.redoObject):(t=i=n.redoObject,r=n.undoObject);t=t.parent?this._findChildren(this.nameTable[t.parent],t.name):this._findConnector(t.name);r.targetNode&&(u=this.nameTable[r.targetNode],ej.datavisualization.Diagram.Util.removeItem(u.inEdges,r.name));r.sourceNode&&(u=this.nameTable[r.sourceNode],ej.datavisualization.Diagram.Util.removeItem(u.outEdges,r.name));i.targetNode&&(u=this.nameTable[i.targetNode],u.inEdges.push(i.name));i.sourceNode&&(u=this.nameTable[i.sourceNode],u.outEdges.push(i.name));this._propertyChangeConnectorValues(t,i);this._comparePropertyValues(t,"targetNode",{targetNode:i.targetNode});t.targetNode=i.targetNode;this._comparePropertyValues(t,"sourceNode",{sourceNode:i.sourceNode});t.sourceNode=i.sourceNode;this._comparePropertyValues(t,"targetPort",{targetPort:i.targetPort});t.targetPort=i.targetPort;this._comparePropertyValues(t,"sourcePort",{sourcePort:i.sourcePort});t.sourcePort=i.sourcePort;this._comparePropertyValues(t,"sourcePoint",{sourcePoint:i.sourcePoint});t.sourcePoint=i.sourcePoint;this._comparePropertyValues(t,"targetPoint",{targetPoint:i.targetPoint});t.targetPoint=i.targetPoint;t.segments=$.extend(!0,[],i.segments);this._updateEdges(t);this._dock(t,this.nameTable);ej.datavisualization.Diagram.Util._updateConnectorSegments(t,t.sourcePort,t.targetPort,this);ej.datavisualization.Diagram.DiagramContext._refreshSegments(t,this);ej.datavisualization.Diagram.Util.updateBridging(t,this);ej.datavisualization.Diagram.DiagramContext.update(t,this);this._updateConnectorBridging(t);this._addSelection(t,this._selectionContains(t)?!0:!1);this.selectionList[0]&&ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom);ej.datavisualization.Diagram.SvgContext.updateSelector(t,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)},_recordLabelChanged:function(n){var t=this.nameTable[n.object.name];this._comparePropertyValues(t.labels[n.index?n.index:0],"text",{text:n.label});n.object.type==="text"?(t.textBlock.text=n.label,ej.datavisualization.Diagram.DiagramContext.updateTextBlock(t,t.textBlock,this)):t.type=="umlclassifier"?(this._clearSelection(!0),n.label=ej.datavisualization.Diagram.ClassifierHelper.getEditboxValue(n.label,t,this),t=ej.datavisualization.Diagram.ClassifierHelper.getClassifierNodeDimension(t,this),t.labels[n.index].text="",ej.datavisualization.Diagram.DiagramContext.update(t,this),this.addSelection(t,!0)):t.shape&&t.shape.type=="umlclassifier"?(t=ej.datavisualization.Diagram.ClassifierHelper.getUMLConnectorValue(t,n.label,t.labels[n.index]),ej.datavisualization.Diagram.DiagramContext.update(t,this)):t.labels[n.index]?(t.labels[n.index].text=n.label,ej.datavisualization.Diagram.DiagramContext.updateLabel(t,t.labels[n.index],this)):(t.labels[n.index]=ej.datavisualization.Diagram.Label({text:n.label}),ej.datavisualization.Diagram.DiagramContext.addNodeLabel(t,t.labels[n.index],null,this))},labelcollectionchanged:function(n){var t=this.nameTable[n.shape.name],i=t.labels;i.slice(0);n.isUndo?(ej.datavisualization.Diagram.Util.removeItem(t.labels,n.label),diagram._views.forEach(function(i){var u=diagram._views[i],f=u.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],r=$(f).find("#"+t.name+"_"+n.label.name+"_lblbg")[0];r&&r.parentNode.removeChild(r)})):ej.datavisualization.Diagram.DiagramContext.addLabel(t,n.label,this,n.index);this._raisePropertyChange({element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"labels",oldValue:i,newValue:t.labels})},_recordGroupChanged:function(n){var o=n.actionType,f,u,i,e,s,h,r,c,t;if(n.isUndo&&(n.actionType==="group"&&(o="ungroup"),n.actionType==="ungroup"&&(o="group")),this._clearSelection(o=="group"?!0:!1),f=this._getChildren(n.object.children),o==="group"){for(u=new ej.datavisualization.Diagram.Group(n.object),u.children=[],i=0;i<f.length;i++)u.children.push(f[i]),t=this.nameTable[f[i]],t.parent&&(s=this.nameTable[t.parent]),t.parent=u.name,r=this._svg.document.getElementById(f[i]),r&&r.parentNode.removeChild(r),t.parent&&(h=this.nameTable[t.parent]),this._raiseGroupChangeEvent(t,s,h,"group");this._eventCause.nodeCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange;this.add(u);this._addSelection(u)}else{for(e=n.object,r=this._svg.document.getElementById(e.name),r&&r.parentNode.removeChild(r),c=this._getChildren(e.children),i=0;i<c.length;i++)t=this.nameTable[c[i]],t.parent&&(s=this.nameTable[t.parent]),t.parent="",this._isUndo=!0,t.segments||(t._type=="group"?ej.datavisualization.Diagram.DiagramContext.renderGroup(t,this):ej.datavisualization.Diagram.DiagramContext.renderNode(t,this),this.nodes().indexOf(t)===-1&&(this.nodes().push(t),this._nodes=$.extend(!0,[],this.nodes()))),t.segments&&(ej.datavisualization.Diagram.DiagramContext.renderConnector(t,this),this.connectors().indexOf(t)===-1&&(this.connectors().push(t),this._connectors=$.extend(!0,[],this.connectors()))),this._isUndo=!1,this._nodes=$.extend(!0,[],this.nodes()),t.parent&&(h=this.nameTable[t.parent]),this._raiseGroupChangeEvent(t,s,h,"ungroup");this._removeElement(e);ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this._findNode(e.name));this._nodes=$.extend(!0,[],this.nodes())}},_recordNudgingChanges:function(n,t,i){var r,u;this._isUndo=!0;r=t.undoDirection;i&&(r=t.redoDirection);this._clearSelection(!0);n.type==="pseudoGroup"&&(u=ej.datavisualization.Diagram.Group(n),delete this.nameTable[u.name],this.nameTable[u.name]=n);this._addSelection(this.nameTable[n.name],!0);this.nudge(r,t.values);this._isUndo=!1},_recordPropertiesChanged:function(n,t,i,r){var u=this._getModifiedProperties(i=="port"||i=="label"?r:n,t),f;u&&Object.keys(u).length&&(i=="connector"&&((t.sourcePoint||t.sourceNode)&&(u.sourcePoint=n.sourcePoint,u.sourceNode=n.sourceNode,u.sourcePort=n.sourcePort),(t.targetPoint||t.targetNode)&&(u.targetNode=n.targetNode,u.targetPort=n.targetPort,u.targetPoint=n.targetPoint)),f={type:"propertiesChanged",values:u,category:"internal",object:n,elementType:i},f[i]=r,this.addHistoryEntry(f))},_recordAlignCommandChanges:function(n){var r,t,u,i;if(n&&n.values.length){for(r=0;r<n.values.length;r++)t=n.values[r],t.object&&t.delta&&(u={x:-t.delta.x,y:-t.delta.y},i=this.nameTable[this._getChild(t.object)],this._comparePropertyOnAlign(i,-t.delta.x,-t.delta.y),this._translate(i,-t.delta.x,-t.delta.y,this.nameTable),this._updateContainerOnNudge(i),t.delta=u,this._updateObject(i));this.nameTable[n.object.name]||(this.nameTable[n.object.name]=n.object);ej.datavisualization.Diagram.Util._updateGroupBounds(n.object,this);this._hasSelection()?ej.datavisualization.Diagram.SvgContext.updateSelector(n.object,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints):this.addSelection(n.object,!0)}},_recordPhaseCollectionChanged:function(n){n.undo?n.isAdded?n.phase&&this._removePhase(n.phase.name):n.phase&&this._addPhase(n.group,n.phase,n):n.isAdded?n.phase&&this._addPhase(n.group,n.phase,n):n.phase&&this._removePhase(n.phase.name);this._clearSelection(!0)},_recordSizeCommandChanges:function(n){var r,t,u,i;if(n&&n.values.length){for(r=0;r<n.values.length;r++)t=n.values[r],t.object&&t.values&&(u={width:t.object.width||t.object._width||0,height:t.object.height||t.object._height||0},i=this.nameTable[this._getChild(t.object)],this._comparePropertyValues(i,"height",{height:t.values.height}),this._comparePropertyValues(i,"width",{width:t.values.width}),this.scale(i,t.values.width/(i.width||i._width||0),t.values.height/(i.height||i.height||0),{x:i.offsetX,y:i.offsetY},this.nameTable),t.values=u,this._updateObject(i));this.nameTable[n.object.name]||n.object.type!="pseudoGroup"||(this.nameTable[n.object.name]=n.object);ej.datavisualization.Diagram.Util._updateGroupBounds(n.object,this);this._hasSelection()?ej.datavisualization.Diagram.SvgContext.updateSelector(n.object,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints):this.addSelection(n.object,!0)}},_getModifiedProperties:function(n,t,i){var u,r;if(i=i||n,t&&Object.keys(t).length&&i){u={};for(r in t)(t[r]!=i[r]||typeof i[r]=="object")&&(u[r]=i[r]&&i[r]instanceof Array?i[r]:i[r]&&typeof i[r]=="object"?$.extend(!0,{},i[r]):i[r]);return u}},_addCollectionChangeToHistory:function(n){var t,i;n.parent==""&&(t={},this.selectionList&&this.selectionList.length>0&&(t=this._getChildTable(this.selectionList[0],t)),i={type:"collectionchanged",object:jQuery.extend(!0,{},n),childTable:jQuery.extend(!0,{},t),changeType:"insert",category:"internal"},this.addHistoryEntry(i))},_recordPhasesizeChanged:function(n){var t=$.extend(!0,{},n.undoObject),i=$.extend(!0,{},n.redoObject);n.undo?this._updatePhase({name:t.name,offset:t.offset}):this._updatePhase({name:i.name,offset:i.offset})},_recordPortsCollectionChanged:function(n){var u=n.changeType,i,f,r,t;if(n.isUndo&&(u=n.changeType=="insert"?"remove":"insert"),i=this.nameTable[n.object.name],u=="remove")for(t=0;t<n.collection.length;t++)for(ej.datavisualization.Diagram.Util.removeItem(i.ports,n.collection[t]),t=0;t<this._views.length;t++)f=this._views[t],r=this._views[f].svg.document.getElementById(i.name+"_"+n.collection[t].name),r&&r.parentNode.removeChild(r);else for(t=0;t<n.collection.length;t++)i.ports.push(n.collection[t]),ej.datavisualization.Diagram.DiagramContext.renderPort(i,n.collection[t],this)},_addSymbolToDiagram:function(n){var s,h,a,e,r,o,v;if(ej.datavisualization.Diagram.Util.isPageEditable(this)){var f=this._currZoom,y=$("#"+this.element[0].id).offset(),u=this._isTouchEvent(n);u.pageX||n.pageX||(n.originalEvent&&n.originalEvent.changedTouches?u=n.originalEvent.changedTouches[0]:n&&n.changedTouches&&(u=n.changedTouches[0]));var c=(u?u.pageX:n.pageX)+this._hScrollOffset-y.left,l=(u?u.pageY:n.pageY)+this._vScrollOffset-y.top,i=$.extend(!0,{},this._selectedSymbol),t;if(this._selectedSymbol&&(t=i,this._isNodeEnters?t.isSwimlane&&(this.nameTable[t.name]=t,t=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,t,{childTable:this.childTable,object:t}),this._addAssiciatedChildConnectors(t)):(t&&t.type!="pseudoGroup"&&(i.name+=ej.datavisualization.Diagram.Util.randomId()),i.segments?ej.datavisualization.Diagram.Util._translateLine(i,c/f,l/f):(this._cloneGroupNode(i,ej.datavisualization.Diagram.Util.randomId()),i._type==="group"?(s=ej.datavisualization.Diagram.Util._getChildrenBounds(i,this),ej.datavisualization.Diagram.Util._translate(i,c/f-s.x-s.height/2,l/f-s.y-s.width/2,this.nameTable,null,this)):(i.offsetX=c/f,i.offsetY=l/f),i.isLane&&(h=ej.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(i,this.nameTable),h.isLane=i.isLane,h.orientation=i.orientation,t=h),i.type=="bpmn"&&delete t.children)),t&&(a={element:t,cancel:!1},this._raiseEvent("dragEnter",a),!a.cancel))){if(this._isEditing&&(this._endEditing=!0,this._endEdit(),delete this._endEditing),t&&!this._isNodeEnters){if(t.isLane&&(t=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,t),e=this.nameTable[this._getChild(t.children[0])],e&&t.labels&&e.labels.length>0))for(e.ports=[],r=0;r<e.labels.length;r++)e.labels[r].visible=!1;if(t.labels&&t.labels.length>0)for(r=0;r<t.labels.length;r++)t.labels[r].visible=!1}if(t.type!="pseudoGroup")t.isLane&&(this.nameTable[t.children[0]]._isHeader=!0),this.add(t);else{for(o=0;o<t.children.length;o++)this.add(t.children[o]),t.children[o]=t.children[o].name;for(v in this.edgeTable)this.nameTable[v]||this.add(this.edgeTable[v]);this._hasSelection()&&this._clearSelection(!0);this.nodes().push(t);this._nodes=$.extend(!0,[],this.nodes());this.nameTable[t.name]=t;ej.datavisualization.Diagram.Util._updateGroupBounds(t,this);this.addSelection(t,!0)}this._focusedElement=t;t.isLane&&ej.datavisualization.Diagram.SvgContext._hideNode(t,this._svg);this.element[0].focus();this._toolToActivate="move";document.getElementsByClassName("e-paletteItem dragClone")[0]&&$(".e-paletteItem.dragClone").css("display","none");this.activateTool("move",!1);this._symbolDrop=!0;this.activeTool.mousedown(n);this.activeTool.mousemove(n)}}delete this._symbolDrop},_removeSymbolFromDiagram:function(){if(this._selectedSymbol){var n=document.getElementsByClassName("e-paletteItem dragClone")[0];n!=null&&(n.style.display="block");this._remove(this.selectionList[0]);this._selectedSymbol=null}},_updateGroupChild:function(n){for(var i=n.children,t=0;t<n.children.length;t++)n.children[t]=this.nameTable[this._getChild(n.children[t])],n.children[t]&&n.children[t]._type==="group"&&this._updateGroupChild(n.children[t])},_dropSymbol:function(n,t){var f,i,o,u,r,e,s;if(ej.datavisualization.Diagram.Util.isPageEditable(this)){if(f=n||this.selectionList[0]||this.activeTool.selectedObject,i={element:this.getNode(f)},this._nodeUnderMouse&&(i.target=this._nodeUnderMouse),o=!1,i.target||(i.target=this.model),f&&f._type==="group"&&this._updateGroupChild(f),this._remove(f),this.nameTable[i.element.name]=i.element,this._selectedSymbol=null,u=n||i.element,r=this.activeTool._getMouseOverElement(t),this.activeTool._outOfBoundsDrag(u)&&ej.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this,this.activeTool.selectedObject,r)){if(this._raiseDropEvent(i),!i.cancel){if(this._isInsert=!0,u&&u.labels&&u.labels.length>0)for(e=0;e<u.labels.length;e++)u.labels[e].visible=!0;r&&r.container&&ej.datavisualization.Diagram.Util.canAllowDrop(r)&&!r.isSwimlane&&ej.datavisualization.Diagram.bpmnHelper.canAllowDropOnContainer(this.activeTool.selectedObject,r)&&(ej.datavisualization.Diagram.canvasHelper._addNodeToContainer(this,this.activeTool.selectedObject,r),this._raiseGroupChangeEvent(this.selectedObject,null,r,"group"));this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.Drop;o=this.add(u);this.activeTool.selectedObject=this.selectionList[0];this._isInsert=!1}o?(s=this.nameTable[i.element.name],this._updateDroppedSymbol(s)):this.activeTool.selectedObject=null}else this.activeTool.selectedObject=null,delete this.nameTable[i.element.name],this._clearSelection(!0);ej.datavisualization.Diagram.Util.canDoSingleSelection(this)||(this._clearSelection(!0),this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan&&this.activateTool("panTool"))}},_updateDroppedSymbol:function(n){n&&this.selectionList.length>0&&(this.scrollToNode(n),n.labels.length>0&&n.labels[0].mode==="edit"&&!n.labels[0].readOnly?n.isPhase||n.isSwimlane||n.isLane||(this._isEditing=!0,this.startLabelEdit(n,n.labels[0])):this.element[0].focus(),this._nodeUnderMouse&&this._nodeUnderMouse.segments&&ej.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this._adornerLayer,this._adornerSvg))},_initiateAutoScroll:function(n){if(this.activeTool.inAction&&this.enableAutoScroll()&&!(this.activeTool instanceof ej.datavisualization.Diagram.RotateTool)){var r=this._viewPort,t=this._mousePosition(n,!0),i=this.model.pageSettings.autoScrollBorder;t.x+i.right>=r.width-18?(this._beginAutoScroll("right",n),this._canAutoScroll=!0):t.x<=i.left?(this._beginAutoScroll("left",n),this._canAutoScroll=!0):t.y+i.bottom>=r.height-18?(this._beginAutoScroll("bottom",n),this._canAutoScroll=!0):t.y<=i.top?(this._beginAutoScroll("top",n),this._canAutoScroll=!0):this._canAutoScroll=!1}},_updatePoints:function(n,t,i,r){var u=new ej.datavisualization.Diagram.Point(i.x-t.x,i.y-t.y);ej.datavisualization.Diagram.Geometry.isEmptyPoint(u)||n._updateEndPoint(u.x,u.y,r)},_cloneGroupNode:function(n,t,i){var r=null,u,e=n.children=this._getChildren(n.children),f;if(n._type==="group")for(f=0;f<e.length;f++)i?r=i[e[f]]:this._paletteTable&&(r=this._paletteTable[e[f]]),r&&(r=$.extend(!0,{},r),r._type==="group"&&this._cloneGroupNode(r,t),u=$.extend(!0,{},r),u.name+=t,u.parent=n.name,e[f]=u.name,this.nameTable[u.name]=u)},_addGroupConnector:function(n,t){var r,u,e,i,o,s,f;if(!n.segments)for(s=this._getChildren(n.children),e=0;e<s.length;e++)if(f=this.nameTable[s[e]],f){if(f.inEdges&&f.inEdges.length>0)for(r=f.inEdges,i=0,o=r.length;i<o;i++)u=t.edgeTable?t.edgeTable[r[i]]:t.childTable[r[i]],u&&!this.nameTable[u.name]&&this.add(u);if(f.outEdges&&f.outEdges.length>0)for(r=f.outEdges,i=0,o=r.length;i<o;i++)u=t.edgeTable?t.edgeTable[r[i]]:t.childTable[r[i]],u&&!this.nameTable[u.name]&&this.add(u)}},_addConnector:function(n,t){var r,u,i,f;if(!n.segments){if(n.inEdges&&n.inEdges.length>0)for(r=n.inEdges,i=0,f=r.length;i<f;i++)u=t?t.edgeTable[r[i]]:this.nameTable[r[i]],u.zOrder=-1,this.add(u);if(n.outEdges&&n.outEdges.length>0)for(r=n.outEdges,i=0,f=r.length;i<f;i++)u=t?t.edgeTable[r[i]]:this.nameTable[r[i]],u.zOrder=-1,this.add(u)}},_addChildren:function(n,t){for(var r,u=this._getChildren(n.children),i=0;i<u.length;i++)r=t[u[i]],r._type==="group"&&this._addChildren(r,t),this.nameTable[u[i]]=r,n.children[i]=r.name},_updateLabels:function(n,t){n.labels=t;for(var i=0;i<n.labels.length;i++)ej.datavisualization.Diagram.DiagramContext.updateLabel(n,n.labels[i],this)},_getNode:function(n,t){var i;return(i=t?typeof n=="object"?t[n.name]:t[n]:typeof n=="object"?this.nameTable[n.name]:this.nameTable[n],i||typeof n!="object"?i&&typeof n=="string"&&(i=t?t[n]:this.nameTable[n]):i=n,i)?i.isLane?ej.datavisualization.Diagram.SwimLaneHelper._mapObject(this,i,"lane"):i.isPhase||i.type==="phase"?ej.datavisualization.Diagram.SwimLaneHelper._mapObject(this,i,"phase"):i.isSwimlane?ej.datavisualization.Diagram.SwimLaneHelper._mapObject(this,i,"swimlane",t):i._type==="node"||i._type==="group"||i._type==="pseudoGroup"||this.getObjectType(i)=="node"?i:i:null},_updateEdges:function(n){var t;ej.datavisualization.Diagram.Util.isTargetConnected(n)&&(t=this.nameTable[n.targetNode],t&&t.inEdges.indexOf(n.name)==-1&&t.inEdges.push(n.name));ej.datavisualization.Diagram.Util.isSourceConnected(n)&&(t=this.nameTable[n.sourceNode],t&&t.outEdges.indexOf(n.name)==-1&&t.outEdges.push(n.name))},_updateChildrenEdges:function(n){for(var t,r=this._getChildren(n.children),i=0;i<r.length;i++)t=r[i],t.segments?(this._updateEdges(t),this._dock(t,this.nameTable)):t._type==="group"&&this._updateChildrenEdges(t)},_updateParent:function(n){for(var u,t,r=this._getChildren(n.children),i=0;i<r.length;i++)u=this.nodes().indexOf(this.nameTable[r[i]]),t=this.nameTable[r[i]],t=t.type!="bpmn"&&t.type!="connector"?this._getNewNode(t):t,t&&t._type==="group"?this._updateParent(t):t&&(t.parent=n.name,ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t.name],this.nameTable[t.name]),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,this.nameTable[t.name]),this.nameTable[t.name]=t,u!=-1&&(this.nodes()[u]=t)),this._updateQuad(this.nameTable[t.name])},_findPortAtPoint:function(n,t){var f,i,s,e,r,h,c,l,o,u,a;if(t)for(l=ej.datavisualization.Diagram.Util.bounds(t,!0),f=t.ports,u=0,a=f.length;u<a;++u)if(i=f[u],e=ej.datavisualization.Diagram.Size(i.size,i.size),r=ej.datavisualization.Diagram.Util._getPortPosition(i,l),o=ej.Matrix.identity(),ej.Matrix.rotate(o,t.rotateAngle,t.offsetX,t.offsetY),r=ej.Matrix.transform(o,r),h=r.x-i.size/2,c=r.y-i.size/2,s=ej.datavisualization.Diagram.Rectangle(h,c,e.width,e.height),ej.datavisualization.Diagram.Geometry.containsPoint(s,n))return ej.datavisualization.Diagram.Util.canConnect(i,!0)?i:null;return null},_findLabelAtPoint:function(n,t){var o,r=null,y,u,i,p,w,c,l,a,f,s,e,k=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],v=[],h,b;if(t&&(f=ej.datavisualization.Diagram.Util.bounds(t,!0),o=t.labels,o.length>0))for(r=o[0],h=0,b=o.length;h<b;h++)if(r=o[h],s=$(k).find("#"+t.name+"_"+r.name)[0],c=s?s.offsetWidth:0,l=s?s.offsetHeight:0,c||(c=f.width),l||(l=r.fontSize),u=ej.datavisualization.Diagram.Size(c,l),i=ej.datavisualization.Diagram.Util._getLabelPosition(r,f),i.x=f.x+i.x,i.y=f.y+i.y,e=ej.Matrix.identity(),t.segments?ej.Matrix.rotate(e,0,f.x+f.width/2,f.y+f.height/2):ej.Matrix.rotate(e,-t.rotateAngle,t.offsetX,t.offsetY),a=ej.Matrix.transform(e,n),e=ej.Matrix.identity(),ej.Matrix.rotate(e,-r.rotateAngle,i.x,i.y),a=ej.Matrix.transform(e,a),r.verticalAlignment==ej.datavisualization.Diagram.VerticalAlignment.Top?i.y+=u.height/2:r.verticalAlignment==ej.datavisualization.Diagram.VerticalAlignment.Bottom&&(i.y-=u.height/2),r.horizontalAlignment==ej.datavisualization.Diagram.HorizontalAlignment.Left?i.x+=u.width/2:r.horizontalAlignment==ej.datavisualization.Diagram.HorizontalAlignment.Right&&(i.x-=u.width/2),p=i.x-u.width/2,w=i.y-u.height/2,y=ej.datavisualization.Diagram.Rectangle(p,w,u.width,u.height),ej.datavisualization.Diagram.Geometry.containsPoint(y,a)&&v.push(r),h==o.length-1)return v.length?v[v.length-1]:null;return r},_getCurrentZoom:function(){return this._currZoom},_findNode:function(n){return this.nameTable[n]},_findPort:function(n,t){for(var r=n.ports,i=0,u=r.length;i<u;i++)if(r[i].name===t)return r[i];return null},_findLabel:function(n,t){for(var r=n.labels,i=0,u=r.length;i<u;i++)if(r[i].name===t)return r[i];return null},_findConnector:function(n){return this.nameTable[n]},_findChildren:function(n,t){for(var i,r,f=this._getChildren(n.children),u=0;u<f.length;u++)if(i=this.nameTable[f[u]],i){if(t==i.name)return i;if(i._type==="group"&&(r=this._findChildren(i,t),r))return r}return null},_removeLaneParent:function(n){var t,i;return n.isLane&&n.parent&&(t=this.nameTable[n.parent],t.children&&t.children.length===1&&t&&t.parent&&(i=this.nameTable[t.parent],i))?{remove:!0,node:i}:{remove:!1}},_delete:function(n){var u=!1,f,t,e,r,i,o,s;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(n=n||this.selectionList[0],n))if(!n.isPhase&&(n.type&&n.type!="phase"||n.segments||n._type=="node"||n._type=="pseudoGroup")||this._dropPhase){if(f=this._removeLaneParent(n),f.remove&&(n=f.node),this._selectedSymbol||this._removeAdjacentConnections(n),t=n,t.type=="pseudoGroup"){for(e=this._getChildren(t.children),this._multipleAction=!0,r=e.length-1;r>=0;r--)this._remove(this.nameTable[e[r]])&&(u=!0),this._isUndo=!0;delete this._multipleAction;this._isUndo=!1}else this._nodeUnderMouse===t&&(this._nodeUnderMouse=null),u=this._remove(t),t.container&&t.parent&&(i=this.nameTable[t.parent],i&&i.container&&i.container.type=="stack"&&(this._getChild(i.children[0])?(o=this._getSwimlane(t),o&&this._updateChildAdjacentConnectors(o,!0),ej.datavisualization.Diagram.DiagramContext.update(i,this)):(s=this.nameTable[i.parent],s&&this._remove(s))));u&&this._clearSelection()}else n.type&&n.type=="phase"&&(this._removePhase(n.name),this._clearSelection())},_removeAdjacentConnections:function(n,t){var u={},f={},e,o,i,s,r,h,t;if(u=this._getChildTable(n,u),f=this._getEdgeTable(n,f),!this._isUndo||t){if(e={},o={},!n.segments){if(n.outEdges&&n.outEdges.length>0)for(s=n.outEdges.length,r=0;r<s;r++)i=this.nameTable[n.outEdges[r]],i&&i.sourcePort&&(e[i.name]=i.sourcePort);if(n.inEdges&&n.inEdges.length>0)for(s=n.inEdges.length,r=0;r<s;r++)i=this.nameTable[n.inEdges[r]],i&&i.targetPort&&(o[i.name]=i.targetPort)}this._isUndo?(t.targetPorts=o,t.sourcePorts=e,t.edgeTable=f,t.childTable=u):(h=null,n.isLane&&(h=this._getRemoveIndex(n)),t={type:"collectionchanged",object:this._updatePsedoGroupChildren(n),index:h,childTable:jQuery.extend(!0,{},u),edgeTable:jQuery.extend(!0,{},f),sourcePorts:e,targetPorts:o,changeType:"remove",category:"internal"},n.isPhase||ej.datavisualization.Diagram.Util.canDelete(n)&&this.addHistoryEntry(t))}},_updatePsedoGroupChildren:function(n){var i=jQuery.extend(!0,{},n),r,t;if(n&&n.type=="pseudoGroup")for(t=0;t<i.children.length;t++)r=this.nameTable[this._getChild(i.children[t])],r&&r.isSwimlane&&(i.children[t]=this.getNode(r));return i},_getRemoveIndex:function(n){var t,r,i;if(n.parent&&(t=this.nameTable[n.parent],t&&t.children&&t.children.length>0))for(i in t.children)if(r=this._getChild(t.children[i]),r===this._getChild(n))return Number(i);return 0},_getSwimlaneHeader:function(n){var t;return n&&n.isSwimlane&&n.children&&n.children.length>0&&(t=this.nameTable[n.children[0]]),t},_addPhase:function(n,t,i){var r=this.nameTable[n],h=!1,f,o,e,a,u,l;if(r&&r.isSwimlane&&t&&(r&&r.orientation&&t.offset&&(r.orientation=="horizontal"?(f=r.offsetX-r.width/2,e=this._getFirstLane(r),e&&(f+=e.width),h=t.offset>r.width||r.offsetX-r.width/2+t.offset<f?!0:!1):r.orientation=="vertical"&&(f=r.offsetY-r.height/2,o=this._getSwimlaneHeader(r),o&&(f+=o.height),e=this._getFirstLane(r),e&&(f+=e.height),h=t.offset>r.height||r.offsetY-r.height/2+t.offset<f?!0:!1)),t.offset&&!h)){if(i&&i.islastPhase&&(a=i.phase,r.orientation==="horizontal"?r.width>t.offset&&(t.width+=r.width-t.offset,t.offset=r.width):r.height-o.height>t.offset&&(t.height+=r.height-o.height-t.offset,t.offset=r.height-o.height)),u=ej.datavisualization.Diagram.Phase(t),u.orientation=r.orientation,u.label=ej.datavisualization.Diagram.Label(t.label?t.label:{text:"Phase"}),u.parent=r.name,this.nameTable[u.name]&&(ej.datavisualization.Diagram.Util.removeItem(this.model.phases,this.nameTable[u.name]),delete this.nameTable[u.name]),i&&i.islastPhase){var s=this._getInsertIndex(u)+1,c=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,r),v=$.extend(!0,{},i.phaseObject.prevPhase);this._updateInsertPhase(u,v.name,r,s,i);ej.datavisualization.Diagram.SvgContext.renderphase(u,this._svg,this._diagramLayer,this,r);ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this);ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,this.nameTable[this._getChild(r.children[1])],!0);ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdatePhase(this,u)}else{var s=this._getInsertIndex(u)+1,c=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,r),v=$.extend(!0,{},this.nameTable[this._getChild(c[s-1])]);this._updateInsertPhase(u,c[s],r,s);ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this);ej.datavisualization.Diagram.SvgContext.renderphase(u,this._svg,this._diagramLayer,this,r);ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,this.nameTable[this._getChild(r.children[1])],!0);ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdatePhase(this,u)}this._isUndo||(l={type:"phasecollectionchanged",phase:u,category:"internal",group:r.name,isAdded:!0},this.addHistoryEntry(l))}this._clearSelection(!0)},_removePhase:function(n){var t=this.nameTable[n],s=!1,h=null,f,r,c,i,u,o,e,l;t&&(this._raiseChildrenPropertyChange(t),f=this.nameTable[t.parent.split("phaseStack")[0]],r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,f),f&&r&&r.length>1&&(e=this,c=r.indexOf(t.name),this._views.forEach(function(t){var r=e._views[t],i=r.svg.getElementById(n+"_phase_g");i&&i.parentNode.removeChild(i)}),i=ej.datavisualization.Diagram.SwimLaneContainerHelper._getNextPhase(this,t),c===r.length-1&&(i=ej.datavisualization.Diagram.SwimLaneContainerHelper._getPrevPhase(this,t),h=$.extend(!0,{},{prevPhase:i,currPhase:t}),i.offset=t.offset,s=!0),f.orientation==="horizontal"?i.width+=t.width:i.height+=t.height,u=this.nameTable[n],ej.datavisualization.Diagram.Util.removeItem(this.nodes(),u),this._nodes=$.extend(!0,[],this.nodes()),o=this.nameTable[u.parent],delete this.nameTable[n],ej.datavisualization.Diagram.SvgContext._updatephase(i,this),ej.datavisualization.Diagram.Util.removeItem(r,t.name),ej.datavisualization.Diagram.Util.removeItem(o.children,u.name),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,o,!0),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdatePhase(this,t),e=this,this._views.forEach(function(t){var r=e._views[t],f=r.svg.getElementById(n);f&&f.parentNode.removeChild(f);var o=r.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],s=$(o).find("#"+u.name)[0],i=r.svg.getElementById(u.name);i&&i.parentNode&&i.parentNode.removeChild(i);s&&o.removeChild(s)}),this._isUndo||(l={type:"phasecollectionchanged",phase:t,group:f.name,category:"internal",phaseObject:h,islastPhase:s,isAdded:!1},this.addHistoryEntry(l))))},_getEdgeTable:function(n,t){var u,e,o,i,r,h,f,s;if(!n.segments){if(n._type==="group"||n._type==="pseudoGroup")for(h=this._getChildren(n.children),o=0;o<h.length;o++){if(f=this.nameTable[h[o]],f&&f.inEdges&&f.inEdges.length>0)for(u=f.inEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r));if(f&&f.outEdges&&f.outEdges.length>0)for(u=f.outEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r))}if(n.inEdges&&n.inEdges.length>0)for(u=n.inEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r));if(n.outEdges&&n.outEdges.length>0)for(u=n.outEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r))}return t},_remove:function(n,t,i){var l=!1,h,t,u,a,v,s,o,f,e,r,y,c;if(this._raiseChildrenPropertyChange(n),(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&n&&(ej.datavisualization.Diagram.Util.canDelete(n)||i)&&(h=n.segments?"connector":"node",t=t?ej.datavisualization.Diagram.dependentconnector.dependent:ej.datavisualization.Diagram.dependentconnector.independent,u={changeType:"remove",element:this.getNode(n),cancel:!1,dependent:t,state:"changing"},n.segments||(u.adjustDependent=!0,u.deleteDependent=!0),a=this._eventCause[h+"CollectionChange"],a||(this._isKeyDown||this._isUndo)&&(this._eventCause[h+"CollectionChange"]=this._isUndo&&!this._multipleAction?ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange:ej.datavisualization.Diagram.CollectionChangeCause.Keydown),n.isPhase||this._selectedSymbol||n.isLane||this._raiseEvent(h+"CollectionChange",u),!u.cancel)){if(l=!0,v=n.name,n.type=="group"&&n.type!="pseudoGroup")for(s=this._getChildren(n.children),o=0;o<s.length;o++)if(f=this.nameTable[s[o]],f&&!ej.datavisualization.Diagram.Util.canDelete(f))return;if(n.isSwimlane&&ej.datavisualization.Diagram.SvgContext._removephases(n,this),n.type=="bpmn")for(s=this._getChildren(n.children),o=0;s&&o<s.length;o++)if(f=this.nameTable[s[o]],f&&f.annotation&&f._annotation)for(e=0;e<f._annotation.length;e++)this.nameTable[f._annotation[e]]&&this._remove(this.nameTable[f._annotation[e]],t,!0);if(n.segments)this._removeEdges(n),n.sourceNode=n.sourcePort=n.targetNode=n.targetPort=null,this._crudDeleteNodes&&!this._selectedSymbol&&this._crudDeleteNodes.push(this.nameTable[n.name]),ej.datavisualization.Diagram.Util.removeItem(this.connectors(),this.nameTable[n.name]),this._connectors=$.extend(!0,[],this.connectors());else{if(n.annotation&&n._annotation)for(e=0;e<n._annotation.length;e++)this.nameTable[n._annotation[e]]&&this._remove(this.nameTable[n._annotation[e]]);this._disConnect(n,u);this._removeConnector(n,u);this._crudDeleteNodes&&!this._selectedSymbol&&this._crudDeleteNodes.push(this.nameTable[n.name]);ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable[n.name]);this._nodes=$.extend(!0,[],this.nodes())}h=this.getObjectType(n);ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[n.name],n);ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,n,!1);n.parent&&(r=this.nameTable[n.parent],r&&(r.type=="group"||r.type=="bpmn"||r.type=="umlclassifier")&&(ej.datavisualization.Diagram.Util.removeChildFromGroup(r.children,n.name),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),y=$.extend(!0,{},r),ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,r,!0),r.parent&&ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,this.nameTable[r.parent]),ej.datavisualization.Diagram.Util._refreshParentGroup(n,this),ej.datavisualization.Diagram.canvasHelper._updateAddRemoveNodeConnectors(this,r,y),ej.datavisualization.Diagram.canvasHelper._updateAddRemoveLaneConnectors(this,n),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,this.nameTable[r.parent]),this._updateQuad(r)));delete this.nameTable[v];n.segments&&this._updateConnectorBridging(n);c=this._svg.getElementById(n.name);n._type=="group"&&n.type!="pseudoGroup"&&this._removeChildren(n,u);this._removeElement(n);c&&c.parentNode&&c.parentNode.removeChild(c);ej.datavisualization.Diagram.SvgContext._removeContainerHelper(this.activeTool.selectedObject,this._adornerSvg,this._adornerLayer);this._clearSelection(this._selectedSymbol||this._dropPhase?!0:!1)}return!l||n.isPhase||this._selectedSymbol||(u.state="changed",n.type==="connector"?this._raiseEvent("connectorCollectionChange",u):this._raiseEvent("nodeCollectionChange",u)),l},_removeConnector:function(n,t){var r,i,u;if(!n.segments){if(t.deleteDependent&&!t.adjustDependent){if(n.inEdges&&n.inEdges.length>0)for(r=n.inEdges,i=r.length-1;i>=0;i--)this._updateConnection(this.nameTable[r[i]],!0);if(n.outEdges&&n.outEdges.length>0)for(r=n.outEdges,i=0,u=r.length;i<u;i++)this._updateConnection(this.nameTable[r[i]],!0)}if(t.deleteDependent&&t.adjustDependent)if(n.inEdges&&n.inEdges.length>0&&n.outEdges&&n.outEdges.length>0){for(r=n.outEdges,i=r.length-1;i>=0;i--)this._updateConnection(this.nameTable[r[i]],!0);for(r=n.inEdges,i=r.length-1;i>=0;i--)this.nameTable[r[i]]&&this._updateConnection(this.nameTable[r[i]],!0)}else if(n.inEdges&&n.inEdges.length==0&&n.outEdges.length>0)for(r=n.outEdges,i=r.length-1;i>=0;i--)this._updateConnection(this.nameTable[r[i]],!0);else if(n.outEdges&&n.outEdges.length==0&&n.inEdges.length>0)for(r=n.inEdges,i=r.length-1;i>=0;i--)this.nameTable[r[i]]&&this._updateConnection(this.nameTable[r[i]],!0);else if((n.inEdges&&n.inEdges.length==1||n.inEdges.length>1)&&n.outEdges.length==1)for(r=n.outEdges,i=0,u=r.length;i<u;i++)this._updateConnection(this.nameTable[r[i]],!0);else if(!(n.inEdges&&n.inEdges.length>1&&n.outEdges.length>1))for(r=n.inEdges,i=0,u=r.length;i<u;i++)this._updateConnection(this.nameTable[r[i]],!0)}},_updateConnection:function(n,t){n&&ej.datavisualization.Diagram.Util.canDelete(n)&&(this._remove(n,t),this.updateConnector(n.name))},_removeElement:function(n){for(var i,t=0;t<this._views.length;t++)i=this._views[t],this._views[i].context.removeChild(n,this._views[i])},_disConnect:function(n,t,i){var u,f,s,c,h,l,r,o,e,v,a;if(n.inEdges&&n.inEdges.length>0)for(u=n.inEdges,r=0,e=u.length;r<e;r++)ej.datavisualization.Diagram.Util.canDelete(this.nameTable[u[r]])&&(a=!0);if(n.outEdges&&n.outEdges.length>0)for(f=n.outEdges,r=0,e=f.length;r<e;r++)ej.datavisualization.Diagram.Util.canDelete(this.nameTable[f[r]])&&(a=!0);if(t.deleteDependent&&t.adjustDependent&&!i&&a){if(n.inEdges&&n.inEdges.length>0&&n.outEdges.length>0)if(u=n.inEdges,f=n.outEdges,(n.inEdges.length>1||n.inEdges.length==1)&&n.outEdges.length==1){for(r=0,e=u.length;r<e;r++)this.nameTable[u[r]]&&this.nameTable[f[0]]&&this.nameTable[u[r]].targetNode==this.nameTable[f[0]].sourceNode&&(h=this.nameTable[this.nameTable[f[0]].targetNode],h&&(l=$.extend(!0,{},h),this.nameTable[u[r]].sourceNode!=this.nameTable[f[0]].targetNode&&(this.nameTable[u[r]].targetNode=this.nameTable[f[0]].targetNode,this.nameTable[u[r]].targetPort=this.nameTable[f[0]].targetPort,h.inEdges.push(this.nameTable[u[r]].name))),ej.datavisualization.Diagram.Util.dock(this.nameTable[u[r]],this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[u[r]],this));this.nameTable[f[0]]&&(this.nameTable[f[0]].sourceNode=null,this.nameTable[f[0]].sourcePort=null)}else if(!(n.inEdges.length>1&&n.outEdges.length>1))for(r=0,e=u.length;r<e;r++)if(n.outEdges.length>0&&this.nameTable[u[r]]){for(c=this.nameTable[this.nameTable[u[r]].sourceNode],l=$.extend(!0,{},c),o=0,v=f.length;o<v;o++)this.nameTable[u[r]].targetNode==this.nameTable[f[o]].sourceNode&&(this.nameTable[f[o]].sourceNode=this.nameTable[u[r]].sourceNode,this.nameTable[f[o]].sourcePort=this.nameTable[u[r]].sourcePort,c.outEdges[l.outEdges.length+o]=this.nameTable[f[o]].name,ej.datavisualization.Diagram.Util.dock(this.nameTable[f[o]],this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[f[o]],this));this.nameTable[u[r]].targetNode=null;this.nameTable[u[r]].targetPort=null}return}if(n.inEdges&&n.inEdges.length>0)for(u=n.inEdges,r=0,e=u.length;r<e;r++)s=this.nameTable[u[r]],s&&(s.targetNode=null,s.targetPort=null);if(n.outEdges&&n.outEdges.length>0)for(f=n.outEdges,r=0,e=f.length;r<e;r++)s=this.nameTable[f[r]],s&&(s.sourceNode=null,s.sourcePort=null)},_removeEdges:function(n){n.targetNode&&this.nameTable[n.targetNode]&&this.nameTable[n.targetNode].inEdges&&ej.datavisualization.Diagram.Util.removeItem(this.nameTable[n.targetNode].inEdges,n.name);n.sourceNode&&this.nameTable[n.sourceNode]&&this.nameTable[n.sourceNode].outEdges&&ej.datavisualization.Diagram.Util.removeItem(this.nameTable[n.sourceNode].outEdges,n.name)},_selectionContains:function(n){if(this._hasSelection()&&n)for(var t=0;t<this.selectionList.length;t++)if(n.name===this.selectionList[t].name)return!0;return!1},_getPhaseIndex:function(n){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getPhaseIndex(this,n)},_getPhaseBounds:function(n){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getPhaseBounds(this,n)},_addSelection:function(n,t){var s,o,u,c,a,i,l,h;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(ej.datavisualization.Diagram.Util.canDoSingleSelection(this)||n&&n._type==="pseudoGroup"||this._selectedSymbol||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&n&&(ej.datavisualization.Diagram.Util.canSelect(n)||n.type=="phase")&&!this._selectionContains(n)){var f=[],r=[],e=[];if(this._previousSelectedItems&&(r=this._previousSelectedItems),n.type=="pseudoGroup")for(s=this._getChildren(n.children),o=0;o<s.length;o++)u=this.nameTable[s[o]],r.indexOf(u)==-1?f.push(u):ej.datavisualization.Diagram.Util.removeItem(r,u),e.push(u);else f.push(n),e.push(n);c=this._eventCause.selectionChange;c||(this._eventCause.selectionChange=ej.datavisualization.Diagram.SelectionChangeCause.Unknown);a=this.getNode(n);i={changeType:"insert",element:this.getNode(n),state:"changing",selectedItems:e,oldItems:r,newItems:f,cancel:!1};this._selectedSymbol&&!this._endEditing||t||(this._raiseEvent("selectionChange",i),this._previousSelectedItems=i.newItems);i.cancel||(this.selectionList.push(n),this._updateSelectorObject(n),n.isPhase&&(l=this._getPhaseBounds(n)),ej.datavisualization.Diagram.SvgContext.renderSelector(n,this._adornerSvg,this._adornerLayer,this._currZoom,this.model.selectedItems.constraints,l),this.model.selectedItems.userHandles!=null&&this.model.selectedItems.userHandles.length>0&&(h=!1,n.type=="pseudoGroup"&&(h=!0),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.renderUserHandles(this.model.selectedItems.userHandles,n,this._adornerSvg,h,this._currZoom,this._adornerLayer,this)),this._selectedSymbol&&!this._endEditing||t||(i={changeType:"insert",element:this.getNode(n),state:"changed",cause:i.cause,selectedItems:e,oldItems:r,newItems:f,cancel:!1},this._raiseEvent("selectionChange",i)))}},_getInsertIndex:function(n){var f=-1,u,i,e=this.nameTable[n.parent],t=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,e),r;if(t&&t.length>0&&this.nameTable[t[0]])for(u=this.nameTable[t[0]].offset,r=0;r<t.length;r++)i=this.nameTable[t[r]],i&&i.offset<=n.offset&&i.offset>=u&&(u=i.offset,f=r);return f},_updateInsertPhase:function(n,t,i,r,u){var c=this.nameTable[t],o=this.nameTable[this._getChild(i.children[1])],e,f,s,l,h,a;o&&o.children&&o.children.length>0&&(e=this.nameTable[t],f=ej.datavisualization.Diagram.Node(n),i.isSwimlane&&i.orientation&&i.orientation=="vertical"?(u?(s=n.height,e.height=u.phaseObject.prevPhase.height,e.offset=u.phaseObject.prevPhase.offset):(s=e.height,e.height=c.offset-n.offset,l=s-e.height,f.height=l),f.parent=o.name,f.name=n.name,f.width=e.width,f.isPhase=!0):(u?(h=n.width,e.width=u.phaseObject.prevPhase.width,e.offset=u.phaseObject.prevPhase.offset):(h=e.width,e.width=c.offset-n.offset,a=h-e.width,f.width=a),f.parent=o.name,f.name=n.name,f.height=e.height,f.isPhase=!0),f.x=0,f.y=0,this._isUndo&&f.labels.length!==0||(f.labels=[n.label?n.label:ej.datavisualization.Diagram.Label()]),f.labels[0].rotateAngle=n.orientation=="horizontal"?0:270,f.constraints=ej.datavisualization.Diagram.NodeConstraints.Default&~(ej.datavisualization.Diagram.NodeConstraints.Select|ej.datavisualization.Diagram.NodeConstraints.Connect),f.isPhase=!0,f._type="node",this.add(f,{entryHistory:!0}),o.children.pop(f.name),o.children.splice(r,0,f.name))},_getFirstLane:function(n){var t,i,r;return(n.children[2]&&(t=this.nameTable[this._getChild(n.children[2])]),t&&t.children&&t.children.length>0&&(i=this.nameTable[this._getChild(t.children[0])],i&&i.children&&i.children.length>0&&(r=this.nameTable[this._getChild(i.children[0])],r)))?r:null},updateSelector:function(n){if(this._selectedItem!=""){var t={};n.offsetX&&(t.offsetX=Number(typeof n.offsetX=="function"?n.offsetX():n.offsetX));n.offsetY&&(t.offsetY=Number(typeof n.offsetY=="function"?n.offsetY():n.offsetY));n.width&&(t.width=Number(typeof n.width=="function"?n.width():n.width));n.height&&(t.height=Number(typeof n.height=="function"?n.height():n.height));n.rotateAngle&&(t.rotateAngle=Number(typeof n.rotateAngle=="function"?n.rotateAngle():n.rotateAngle));this.updateNode(this._selectedItem,t)}n.userHandles&&(this.model.selectedItems.userHandles=n.userHandles,this._initHandles(),this.selectionList[0]&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.updateUserHandles(this.model.selectedItems.userHandles,this.selectionList[0],this._adornerSvg,this.selectionList[0].type=="pseudoGroup",!1,this._currZoom,this));n.tooltip&&(this.model.selectedItems.tooltip=ej.datavisualization.Diagram.Tooltip($.extend(!0,this.model.selectedItems.tooltip,{},n.tooltip)))},_updateSelectorObject:function(n){var i,t;if(n.segments||(this._selectorOffsetX(n.offsetX),this._selectorOffsetY(n.offsetY),this._selectorWidth(n.width),this._selectorHeight(n.height),this._selectorRotateAngle(n.rotateAngle),this._selectedItem=n.name),n.type=="pseudoGroup")for(i=0;i<n.children.length;i++)t=n.children[i],typeof t=="object"?this.model.selectedItems.children.indexOf(t)<0&&this.model.selectedItems.children.push(t):typeof t=="string"&&this.model.selectedItems.children.indexOf(this.nameTable[t])<0&&this.model.selectedItems.children.push(this.nameTable[t]);else this.model.selectedItems.children.indexOf(n)<0&&this.model.selectedItems.children.push(n)},_clearSelectorObject:function(){this._selectorOffsetX(0);this._selectorOffsetY(0);this._selectorWidth(0);this._selectorHeight(0);this._selectorRotateAngle(0);this._selectedItem="";this.model.selectedItems.children=[]},_raiseEvent:function(n,t){if(this.model[n])return t.elementType=this.getObjectType(t.element),((n==="nodeCollectionChange"||n==="connectorCollectionChange"||n==="selectionChange")&&t.state==="changing"||n==="scrollChange")&&(t.cause=this._eventCause[n]?this._eventCause[n]:"unknown"),this._multipleAction||(this._eventCause={}),t.diagramId=this.element[0].id,this._trigger(n,t)},_clearSelection:function(n){if(this._hasSelection()){this._isEditing&&this.selectionList.length>0&&!this._isDragg&&this._endEdit();var t={changeType:"remove",state:"changing",element:null,selectedItems:[],oldItems:this.model.selectedItems.children,newItems:[],cancel:!1};this._selectedSymbol||n||(this._raiseEvent("selectionChange",t),this._previousSelectedItems=[]);t.cancel||(this._clearSelectorObject(),this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&(ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.selectionList[0]),this._nodes=$.extend(!0,[],this.nodes()),delete this.nameTable[this.selectionList[0].name]),ej.datavisualization.Diagram.Util.clear(this.selectionList),ej.datavisualization.Diagram.SvgContext.clearSelector(this._adornerSvg,this._adornerLayer),this._selectedSymbol||n||(t={changeType:"remove",state:"changed",cause:t.cause,element:null,selectedItems:[],oldItems:this.model.selectedItems.children,newItems:[],cancel:!1},this._raiseEvent("selectionChange",t)))}},_updateSelectionHandle:function(n){var t,i,u,r;this.selectionList.length>0&&(t=this.nameTable[this.selectionList[0].name],i=this.model.selectedItems.constraints,n&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&(i=i&~ej.datavisualization.Diagram.SelectorConstraints.UserHandles),this._updateSelectorObject(t),u=ej.datavisualization.Diagram.SvgContext.updateSelector(t,this._adornerSvg,this._currZoom,this,i),u||this.model.selectedItems.userHandles!=null&&this.model.selectedItems.userHandles.length>0&&(r=!1,t.type=="pseudoGroup"&&(r=!0),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.updateUserHandles(this.model.selectedItems.userHandles,t,this._adornerSvg,r,n,this._currZoom,this)))},_hasSelection:function(){return this.selectionList.length>0},_checkToolToActivate:function(n,t){var i=!1,r,e,f,u,o,s;return r=ej.datavisualization.Diagram.Util._getPseudoGroupConstraints(this,t,this.selectionList[0]),t?((t.segments&&(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)&&n.shiftKey||(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)&&n.altKey)&&(this._toolToActivate="endPoint",this._currentCursor="move",i=!0),i||(this._selectionContains(t)?(t.segments?i=this._canActivateEndPointTool(n,t):((!r||r&ej.datavisualization.Diagram.NodeConstraints.Resize)&&(i=this._canActivateResizeTool(n,t)),i||(!r||r&ej.datavisualization.Diagram.NodeConstraints.Rotate)&&(i=this._canActivateRotateTool(n,t))),i||(i=this._canActivateUserHandle(n,t)),i||(!r||r&ej.datavisualization.Diagram.NodeConstraints.Drag)&&(t&&t.isLane&&ej.datavisualization.Diagram.Util.canMultiSelectOnLane(t)?(this._toolToActivate="select",this._currentCursor="default"):i=this._canActivateMoveTool(n,t)),i||(i=this._canActivatephaseTool(n))):(n&&n.target&&n.target.getAttribute("class")==="ej-d-port"&&(e=this._mousePosition(n),f=this._findPortAtPoint(e,t),f&&f.constraints&ej.datavisualization.Diagram.PortConstraints.ConnectOnDrag&&f.visibility&ej.datavisualization.Diagram.PortVisibility.Visible&&(this._currentCursor="crosshair",u=this.model.drawType,o=u.segments&&u.segments.length&&u.segments[0].type?u.segments[0].type:"orthogonal",o==="orthogonal"?this.activateTool("orthogonalLine",!0):this.activateTool("straightLine",!0),i=!0)),(!r||r&ej.datavisualization.Diagram.NodeConstraints.Drag)&&(i=this._canActivateMoveTool(n,t))))):i=this._canActivatephaseTool(n),i||(this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan?(this.tool()&ej.datavisualization.Diagram.Tool.SingleSelect&&(s=this._findNodeUnderMouse(n),s&&(this._toolToActivate="select",this._currentCursor="default",i=!0)),i||(this._toolToActivate="panTool",this._currentCursor="pointer")):(this._toolToActivate="select",this._currentCursor="default")),this._toolToActivate!="rotate"&&this._adornerSvg.document.removeAttribute("class"),i},_canActivatephaseTool:function(n){if($(n.target).parents(".ej-d-seperator").first()[0]){var r=$(n.target).parents("g").first()[0].id,t=this._getSeperetor(r.split("_phase_g")[0]),i=this.nameTable[t.parent.split("phaseStack")[0]];if(i&&ej.datavisualization.Diagram.Util.canResize(i))return this._currentCursor=t?t.orientation=="horizontal"?"e-resize":"n-resize":"default",this._toolToActivate="phase",!0}},_canActivateUserHandle:function(n){if(this._isUserHandle(n)&&n.target){var t=n.target.id.split("_")[0];return this._toolToActivate=t,this._currentCursor=this.tools[this._toolToActivate].cursor,!0}return!1},_canActivateEndPointTool:function(n,t){if(t){var i=n.target.getAttribute("class");if(i&&(i==="targetEndPoint"&&ej.datavisualization.Diagram.Util.canDragTargetEnd(t)||i==="sourceEndPoint"&&ej.datavisualization.Diagram.Util.canDragSourceEnd(t)||(i.match("bezierpoint")||i=="segmentEnd")&&ej.datavisualization.Diagram.Util.canDragSegmentThumbs(t)))return this._toolToActivate="endPoint",this._currentCursor="move",!0}return!1},_canActivateResizeTool:function(n,t){var i=n.target.getAttribute("class");return ej.datavisualization.Diagram.Util.canResize(t,i)&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.Resizer&&(i==="nw-resize"||i==="n-resize"||i==="ne-resize"||i==="w-resize"||i==="e-resize"||i==="sw-resize"||i==="s-resize"||i==="se-resize")?(this._toolToActivate="resize",t.rotateAngle>=0&&t.rotateAngle<25||t.rotateAngle>=160&&t.rotateAngle<=205||t.rotateAngle>=340&&t.rotateAngle<=360?this._currentCursor=i:t.rotateAngle>=25&&t.rotateAngle<=70||t.rotateAngle>=205&&t.rotateAngle<=250?this._currentCursor=i==="n-resize"||i==="s-resize"?"ne-resize":i==="nw-resize"||i==="se-resize"?"n-resize":i==="e-resize"||i==="w-resize"?"nw-resize":"e-resize":t.rotateAngle>=70&&t.rotateAngle<=115||t.rotateAngle>=250&&t.rotateAngle<=295?this._currentCursor=i==="n-resize"||i==="s-resize"?"e-resize":i==="nw-resize"||i==="se-resize"?"ne-resize":i==="e-resize"||i==="w-resize"?"n-resize":"nw-resize":(t.rotateAngle>=115&&t.rotateAngle<=155||t.rotateAngle>=295&&t.rotateAngle<=340)&&(this._currentCursor=i==="n-resize"||i==="s-resize"?"nw-resize":i==="nw-resize"||i==="se-resize"?"e-resize":i==="e-resize"||i==="w-resize"?"ne-resize":"n-resize"),!0):!1},_canActivateMoveTool:function(n,t){var s,r,u,f,e,o,i;if(n.target&&(s=n.target.className),r=s&&ej.datavisualization.Diagram.Util.isClassifier(n)?ej.datavisualization.Diagram.ClassifierHelper.getMovableElementUnderMouse(n,this):this._findNodeUnderMouse(n),r&&r.name===t.name){if(u=!0,t.parent&&(u=this.selectionList.length>0&&this._selectionContains(t)?!0:!1),u&&ej.datavisualization.Diagram.Util.canMoveLabel(t)&&(f=n.target.parentNode.id.split("_"),e=n.target.parentNode.getAttribute("class"),f[f.length-1]=="lblbg"||this._isLabelTemplate(n)||e&&e==="ej-d-label"))return this._toolToActivate="move",this._currentCursor="pointer",!0;if(o=!1,t.parent&&(i=this.nameTable[t.parent],i&&((i.isSwimlane||i.isLane)&&ej.datavisualization.Diagram.Util.canMove(i)||i.isPhaseStack)&&(o=!0)),ej.datavisualization.Diagram.Util.canMove(t)||o)return this._toolToActivate="move",this._currentCursor=this._isHyperLink(n)?"pointer":this.selectionList.length>0&&(this._selectionContains(t)||this.selectionList[0].children&&this._findChildren(this.selectionList[0],t.name))?"move":"default",!0}return!1},_isLabelTemplate:function(n){var f,i,r,t,u;if(n&&(f=$(n.target).parents(".ej-label-template"),i=f[0],i)){if(r=i.parentNode.id.split("_"),r[r.length-1]=="lblbg")return!0;for(t=n.target.parentNode,u=t.getAttribute("class");t;){if(u==="ej-label-template")return!0;t=t.parentNode;u=t.getAttribute("class")}}},_isHyperLink:function(n){var t=n.target,i=t.getAttribute("class");return(!i||!i=="ej-d-label")&&t.parentNode&&$(t.parentNode).hasClass("ej-d-label")&&(t=t.parentNode,$(t.parentNode).hasClass("ej-d-anchor"))?!0:!1},_canActivateRotateTool:function(n,t){if(ej.datavisualization.Diagram.Util.canRotate(t)&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.Rotator){var i=n.target.getAttribute("class");if(i==="rotateHandle")return this._toolToActivate="rotate",ej.browserInfo().name==="msie"?(this._currentcursor="default",this._adornerSvg.document.setAttribute("class","svg-rotate-ie"),this._currentCursor=""):(this._adornerSvg.document.setAttribute("class","svg-rotate"),this._currentCursor=""),!0}return!1},_canActivatePivotTool:function(n){var t=n.target.getAttribute("class");return t==="pivot"?(this._toolToActivate="pivot",this._currentCursor="default",!0):!1},_updateCursor:function(){this.element[0].style.cursor=this._currentCursor;this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0].style.cursor=this._currentCursor},_getResizeCursor:function(n){var t="default";switch(n){case"topleft":t="nw-resize";break;case"topcenter":t="n-resize";break;case"topright":t="ne-resize";break;case"middleleft":t="w-resize";break;case"middleright":t="e-resize";break;case"bottomleft":t="sw-resize";break;case"bottomcenter":t="s-resize";break;case"bottomright":t="se-resize"}return t},_startEdit:function(n){var i,f,e,r,s,t,u,v=ej.Matrix.identity(),l=n.width?n.width:n._width,a=n.height?n.height:n._height,y,w,b,o,c,p,h;ej.Matrix.rotate(v,n.rotateAngle,l/2,a/2);n.type==="text"?(r=this._svg.getElementById(n.name+"_shape")!==null?this._svg.getElementById(n.name+"_shape").getBBox():{x:n.offsetX-l*n.pivot.x,y:n.offsetY-a*n.pivot.y,width:l,height:a},i=n.textBlock,i&&!i.readOnly&&(s=ej.datavisualization.Diagram.Util.bounds(n),t=new ej.datavisualization.Diagram.Rectangle(r.x-i.fontSize,r.y-i.fontSize,r.width+i.fontSize/2,r.height+i.fontSize/2),u=this._currZoom,h=ej.Matrix.transform(v,ej.datavisualization.Diagram.Util._getLabelPosition(i,s)),f=n.offsetX-l*n.pivot.x+h.x,e=n.offsetY-a*n.pivot.y+h.y,i.horizontalAlignment=="left"?f+=r.width/2:i.horizontalAlignment=="right"&&(f-=r.width/2),i.verticalAlignment=="top"?e+=r.height/2:i.verticalAlignment=="bottom"&&(e-=r.height/2),r.width===0||r.height===0?(r=ej.datavisualization.Diagram.Util.bounds(n),t.width=r.width==0?50:s.width*u,t.x=f*u-t.width/2*u-this._hScrollOffset,t.height=i.fontSize,t.y=e*u-t.height/2*u-this._vScrollOffset):(t.width=50,t.height=i.fontSize,t.x=f*u-t.width/2*u-this._hScrollOffset,t.y=e*u-t.height/2*u-this._vScrollOffset),this._boundingBox=t,this._createEditBox(i,t.x,t.y,t.width,t.height,n),this._isEditing=!0)):(n.labels.length>0?(i=this.activeTool.getLabelUnderMouse(),i||(i=n.labels[0])):(y=this._findNode(n.name),i=new ej.datavisualization.Diagram.Label({name:"label"+ej.datavisualization.Diagram.Util.randomId()}),n.labels.push(i),w=y!==n?y:null,ej.datavisualization.Diagram.DiagramContext.addNodeLabel(n,i,w,this),this.activeTool.name==="textTool"&&(this.activateTool.activeLabel=i)),i&&!i.readOnly&&i.hyperlink===""&&i.templateId===""&&(this.model.labelRenderingMode!=="svg"?(b=this._htmlLayer?this._htmlLayer:this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],o=$(b).find("#"+n.name+"_"+i.name)[0]):o=this._svg.document.getElementById(n.name+"_"+i.name),o?(s=ej.datavisualization.Diagram.Util.bounds(n),this.model.labelRenderingMode!=="svg"?(t=new ej.datavisualization.Diagram.Rectangle(o.offsetLeft,o.offsetTop,o.offsetWidth,o.offsetHeight),r=t):(r=o.getBBox(),t=new ej.datavisualization.Diagram.Rectangle(0,0,r.width,r.height)),u=this.model.labelRenderingMode!="svg"?this._currZoom:1,c=ej.datavisualization.Diagram.Util._getLabelPosition(i,s),n.segments||i.relativeMode=="segmentpath"?(t=o.getBoundingClientRect(),t={x:t.left,y:t.top,width:t.width,height:t.height},p=this._controlBBox?this._controlBBox:this._canvas.getBoundingClientRect(),f=(t.x+t.width/2-p.left+this._hScrollOffset)/u,e=(t.y+t.height/2-p.top+this._vScrollOffset)/u):(i.horizontalAlignment=="left"?c.x+=r.width/2:i.horizontalAlignment=="right"&&(c.x-=r.width/2),i.verticalAlignment=="top"?c.y+=r.height/2:i.verticalAlignment=="bottom"&&(c.y-=r.height/2),h=ej.Matrix.transform(v,c),f=n.offsetX-l*n.pivot.x+h.x,e=n.offsetY-a*n.pivot.y+h.y),r.width===0||r.height===0?(r=ej.datavisualization.Diagram.Util.bounds(n),n.segments?(t.width=r.width<50?50:s.width,t.x=f*u-t.width/2-this._hScrollOffset):(t.width=r.width<50?50:s.width,t.x=f*u-t.width/2-this._hScrollOffset),t.height=n.type=="umlclassifier"?n.height:i.fontSize,t.y=e*u-t.height/2*u-this._vScrollOffset):(t.x=f*u-t.width/2*u-this._hScrollOffset,t.y=e*u-t.height/2*u-this._vScrollOffset),this._boundingBox=t,this._createEditBox(i,t.x,t.y,t.width,t.height,n),this._isEditing=!0):this.activeTool.selectedObject=null))},_hideShowSVGLabels:function(n,t,i){if(this._svg&&t){var r;r=t.type==="text"?this._svg.document.getElementById(t.name+"_shape_lblbg"):this._svg.document.getElementById(t.name+"_"+n.name);r&&r.setAttribute("visibility",i&&(n.visible||t.visible)?"visible":"hidden");r=this._svg.document.getElementById(t.name+"_"+n.name+"_lblbg");r&&r.setAttribute("visibility",i&&n.visible?"visible":"hidden")}},_createEditBox:function(n,t,i,r,u,f){var c,a,l,s,h,e,o;this._svg&&(this.model.labelRenderingMode==ej.datavisualization.Diagram.LabelRenderingMode.Svg?this._hideShowSVGLabels(n,f):(c=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],c&&(a=f.type==="text"?$(c).find("#"+f.name+"_shape_lblbg")[0]:$(c).find("#"+f.name+"_"+n.name+"_lblbg")[0],a&&(a.style.display="none"))),l=ej.datavisualization.Diagram.Util.bounds(f),s=document.createElement("div"),n.horizontalAlignment=="stretch"&&n.textOverflow&&n.rotateAngle==0&&f.isSwimlane?i=i-n.fontSize:n.horizontalAlignment=="stretch"&&!f.isSwimlane&&f._isHeader&&n.textOverflow&&n.rotateAngle!=0&&(t=-t-n.fontSize-r/4),h={id:this.element[0].id+"_editBoxDiv","class":"edit",style:"top:"+i+"px;left:"+t+"px;width:"+r+"px;font-family:"+n.fontFamily+";font-size:"+n.fontSize+"px;min-width: 50px;min-height:"+n.fontSize+"px;"},ej.datavisualization.Diagram.Util.canZoomTextEditor(this)&&(h.style+="transform: scale("+this._currZoom+");"),ej.datavisualization.Diagram.Util.attr(s,h),e=document.createElement("textarea"),o=n.fontColor?n.fontColor.toLowerCase():"black",o=o!="white"&&o!="ffffff"&&o!="rgb(255,255,255)"?o:"black",h={id:this.element[0].id+"_editBox","class":"editBox",style:"font-size:"+n.fontSize+"px;font-family:"+n.fontFamily+";min-height:"+n.fontSize+"px; height: "+u+"px; line-height: normal; color:"+o+";font-weight:"+(n.bold?"bold":"normal")+";font-style:"+(n.italic?"italic":"normal")+";text-decoration:"+n.textDecoration,nodeWidth:l.width,nodeHeight:l.height,fontSize:n.fontSize,nodeOffsetX:f.offsetX,nodeOffsetY:f.offsetY,containerName:f.name},ej.datavisualization.Diagram.Util.attr(e,h),e.value=n.text,s.appendChild(e),$(this._canvas).append(s),n.text!==""&&this._updateEditor(null,s,e,l.width,n.fontSize,n,f),this._on($(e),"focusout",this._editboxfocusout),this._on($(e),"keyup",this._editBoxKeyUp),this._on($(e),"input",this._editBoxTextChange),this._on($(e),"focusin",this._editboxfocusin),e.focus())},_editBoxKeyUp:function(n){this._updateLabelPosition(n)},_editBoxTextChange:function(n){this._updateLabelPosition(n)},_updateEditBox:function(n,t){var i=document.getElementById(this.element[0].id+"_editBoxDiv");i&&(i.style.left=i.offsetLeft-n+"px",i.style.top=i.offsetTop-t+"px")},_editboxfocusout:function(){this._endEditing=!0;this._endEdit();delete this._endEditing},_editboxfocusin:function(n){n.target.select();this._raiseEvent("editorFocusChange",n)},_updateLabelPosition:function(n){var t=50,o=this._currZoom,r=this._boundingBox,e=Number(n.target.getAttribute("fontSize")),f=Number(n.target.getAttribute("nodeWidth")),s=r.x+r.width/2,l=r.y+r.height/2,i=this._textLength(n),u,h,c;i.width===0?(u=r.width<t?t:r.width,n.target.parentNode.style.width=u+"px",n.target.parentNode.style.left=s-u/2-e/4+"px"):(u=i.width<=f*o?i.width<t?t:i.width:i.width>=f*o?i.width>t?i.width:t:f<t?t:f*o,n.target.parentNode.style.width=u+"px",n.target.parentNode.style.left=s-u/2+"px");i.height===0?(n.target.style.height=e+"px",n.target.parentNode.style.top=l-e/2+"px"):this._selectedItem&&(h=this.nameTable[this._selectedItem],h.type==="text"&&(c=this._currentLabel));this._updateEditor(n,n.target.parentNode,n.target,f,e,c)},_updateEditor:function(n,t,i,r,u,f,e){var y,p,o,s=this._textLength(n,f),h=this.model.labelRenderingMode!="svg"||e&&e.type==="text"?this._currZoom:1,nt=50,k=this._boundingBox.x,tt=this._boundingBox.y,d=this._boundingBox.width,g=this._boundingBox.height,ut=i.value,ft=ut.split("\n"),c,w,b,l,v;e||(e=this.activeTool.selectedObject);e&&e.parent&&(c=this.nameTable[e.parent]);this._nodeUnderMouse&&(this.old=this._nodeUnderMouse,w=this._nodeUnderMouse.name.match("_attribute")?"attribute":this._nodeUnderMouse.name.match("_method")?"method":this._nodeUnderMouse.name.match("_member")?"member":this._nodeUnderMouse.name.match("_header_classifier")?"header":"null");this.old&&(w=this.old.name.match("_attribute")?"attribute":this.old.name.match("_method")?"method":this.old.name.match("_member")?"member":this.old.name.match("_header_classifier")?"header":"null");b=w&&w!="null"?s.width>r?s.width:r:r<s.width?r:s.width;this._browserInfo.name==="mozilla"&&(b+=2);l=b<nt?nt:b;t.style.width=l+"px";y=n?(l-d)/2:(l-d*h)/2;t.style.left=c&&c.isLane&&f&&f.horizontalAlignment=="stretch"&&f.textOverflow&&f.rotateAngle!=0?k-y-u-d/4+"px":k-y-u/4+"px";ft.length>1||s.width!=r?(e&&e.type!="umlclassifier"&&(i.style.height="0"),o=this._browserInfo.name==="mozilla"?i.scrollHeight-5:i.scrollHeight-4):o=u;var it=$(i).offset(),rt=$(this._canvas).offset(),a=$(this._canvas).height();a||(a=this._getCanvasHeight(this._canvas,a));it.top-rt.top+Number(o)>a&&(o=o-(it.top-rt.top+Number(o)-a),o=this._browserInfo.name==="mozilla"?o-7:o-6);i.style.height=o+"px";v=0;n?(p=(o-g)/2,v=tt-p*h):(p=c&&c.isSwimlane&&f&&f.horizontalAlignment=="stretch"&&f.textOverflow&&f.rotateAngle==0?(o-g*h)/2+f.fontSize:(o-g*h)/2,v=tt-p-3*h);t.style.top=v+"px";this._boundingBox=new ej.datavisualization.Diagram.Rectangle(k-y,v,l,o)},_getCanvasHeight:function(n,t){for(var r=t,i=n;r<=0;)i=i.parentNode,i&&(r=$(i).height());return r},_textLength:function(n,t){var i=document.createElement("div"),r=document.getElementById(this.element[0].id+"_editBox"),u={id:this.element[0].id+"_editBoxHiddenDiv",style:"position : absolute; width : auto; height : auto;font-size:"+r.style.fontSize+"px;font-family:"+r.style.fontFamily+";word-wrap: break-word;white-space:pre-wrap;"},f;return t&&(u.style="position : absolute; width : auto; height : auto;font-weight:"+(t.bold?"bold":"normal")+";font-style:"+(t.italic?"italic":"normal")+";text-decoration:"+t.textDecoration+";font-size:"+t.fontSize+"px;font-family:"+t.fontFamily+";word-wrap: break-word;white-space:pre-wrap;"),ej.datavisualization.Diagram.Util.attr(i,u),n?i.appendChild(document.createTextNode(n.target.value)):i.appendChild(document.createTextNode(r.value)),document.body.appendChild(i),f=i.getBoundingClientRect(),document.body.removeChild(i),f},_endEdit:function(n){var k,h,w,b,r=document.getElementById(this.element[0].id+"_editBox"),t,e,c,i,u,d,g,l,f,o,s,a,v,y,p;if(r){if(t=this._findNode(r.getAttribute("containerName")),this.activeTool.name==="textTool")t=this.activeTool.selectedObject;else if(!t)for(e=0;e<this.selectionList.length;e++)c=this.selectionList[e],typeof c.labels.length!="undefined"&&c.labels.length>0&&c.labels[0].mode===ej.datavisualization.Diagram.LabelEditMode.Edit&&(t=this.selectionList[e]);t&&(this._isEditing=!1,t.type=="text"?i=t.textBlock:(i=this.activeTool.getLabelUnderMouse(),i||(i=t.labels[0])),t.type=="umlclassifier"&&(r.value=ej.datavisualization.Diagram.ClassifierHelper.getEditboxValue(r.value,t,this)),i&&(u=i.text),t._type!="node"||t.width&&t.height||!this.nameTable[t.name]||(w=t._width,b=t._height,t.labels[0].text=r.value,this._getNodeDimension(t)),t.type=="umlclassifier"&&(t=ej.datavisualization.Diagram.ClassifierHelper.getClassifierNodeDimension(t,this)),n&&(d=n.keyDownEventArgs.keyCode===27?"ESC":String.fromCharCode(n.keyDownEventArgs.keyCode)),r.value!=u&&(k=this._raiseEvent("textChange",{element:this.getNode(t),label:i,value:r.value,keyCode:d})),k?(t._width&&w&&(t._width=w),t._height&&b&&(t._height=b),t&&t.type==="text"?ej.datavisualization.Diagram.DiagramContext.update(t,this):(i=this.activeTool.activeLabel?this.activeTool.activeLabel:t.labels.length>0?t.labels[0]:null,i!=undefined&&(i.mode=ej.datavisualization.Diagram.LabelEditMode.View,ej.datavisualization.Diagram.DiagramContext.updateLabel(t,i,this))),this.activeTool&&(this.activeTool.activeLabel=null,this.activeTool.selectedObject=null)):(t&&t.type!==undefined&&t.type==="text"?(g=u,t.textBlock.text=r.value,t.textBlock.mode=ej.datavisualization.Diagram.LabelEditMode.View,this._findNode(t.name)?(ej.datavisualization.Diagram.DiagramContext.update(t,this),h={type:"labelchanged",shape:t,previousLabelValue:g,updatedLabelValue:r.value,category:"internal"},this.addHistoryEntry(h)):(r.value!==""&&(l=Number(r.style.height.substring(0,r.style.height.length-2)),t.height<l&&(t.offsetY=t.offsetY-t.height/2+l/2,t.height=l),this.selectionList.length>0&&this._clearSelection(!0),this.tools.move._outOfBoundsDrag(t)&&(this.add(t),f=this.nameTable[t.parent],f&&f.isLane&&(o=this._moveOnLane(t,f),o.proceedX||this.updateNode(t.name,{offsetX:t.offsetX+o.x}),o.proceedY||this.updateNode(t.name,{offsetY:t.offsetY+o.y}),this._updateNodeMargin(t),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),this._disableSwimlaneUptate=!0,ej.datavisualization.Diagram.canvasHelper._updateCollectionChange(this,f),f.isLane&&(s=this._getSwimlane(f),s&&(this._updateChildAdjacentConnectors(s,!0),delete this._disableSwimlaneUptate,ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,s),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,s)))))),this.activeTool.selectedObject=null)):t==undefined||t.type=="pseudoGroup"||(i!=undefined?(this._comparePropertyValues(i,"text",{text:r.value}),u=u?u:i.text,u!=r.value&&(h={type:"labelchanged",shape:t,previousLabelValue:i.text,updatedLabelValue:r.value,index:t.labels.indexOf(i),category:"internal"},this.addHistoryEntry(h)),i.text=r.value,i.mode=ej.datavisualization.Diagram.LabelEditMode.View,ej.datavisualization.Diagram.DiagramContext.updateLabel(t,i,this),t.isPhase&&(t.name.split("phaseStack")[1]&&(a=this.nameTable[t.name.split("phaseStack")[1]]),a&&a.label&&(a.label.text=r.value)),this.activeTool.selectedObject=null):t.labels.length==0&&(i=ej.datavisualization.Diagram.Label(),i.text=r.value,i.mode=ej.datavisualization.Diagram.LabelEditMode.View,t.labels.push(i),ej.datavisualization.Diagram.DiagramContext.addNodeLabel(t,i,null,this)),this.activeTool.activeLabel&&(this.activeTool.activeLabel=null)),t.shape&&t.shape.type=="umlclassifier"&&(t=ej.datavisualization.Diagram.ClassifierHelper.getUMLConnectorValue(t,r.value,i)),t._type!="node"||t.width&&t.height||!this.nameTable[t.name]||(ej.datavisualization.Diagram.DiagramContext.update(t,this),t.parent&&ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[t.parent],this)),t.type=="umlclassifier"&&(t.labels[0].text="",ej.datavisualization.Diagram.DiagramContext.update(t,this)),t.shape&&t.shape.type=="umlclassifier"&&ej.datavisualization.Diagram.DiagramContext.update(t,this)));this._off($(r),"focusout",this._editboxfocusout);this._off($(r),"keyup",this._editBoxKeyUp);this._off($(r),"input",this._editBoxTextChange);v=$("#"+this.element[0].id+"_editBoxDiv")[0];v&&v.parentNode.removeChild(v);this._svg&&(this.model.labelRenderingMode==ej.datavisualization.Diagram.LabelRenderingMode.Svg?this._hideShowSVGLabels(i,t,!0):(y=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],y&&(t.type==="text"?p=$(y).find("#"+t.name+"_shape_lblbg")[0]:i&&(p=$(y).find("#"+t.name+"_"+i.name+"_lblbg")[0]),p&&(p.style.display="block"))))}n&&n.keyDownEventArgs&&n.keyDownEventArgs.keyCode===27&&this.element[0].focus()},_getSwimlane:function(n){var i,t;return n=typeof n=="string"?this.nameTable[n]:n,t=this.nameTable[n.parent],t&&(i=this.nameTable[t.parent]),i},_setLabelEditing:function(n){var t;if(n)return n.readOnly?(n.mode=ej.datavisualization.Diagram.LabelEditMode.View,t=!1):(this._currentLabel&&(this._currentLabel.mode=ej.datavisualization.Diagram.LabelEditMode.View),n.mode=ej.datavisualization.Diagram.LabelEditMode.Edit,this._currentLabel=n,t=!0),t},_isInternalTool:function(n){return n instanceof ej.datavisualization.Diagram.SelectTool||n instanceof ej.datavisualization.Diagram.ConnectionEditTool||n instanceof ej.datavisualization.Diagram.MoveTool||n instanceof ej.datavisualization.Diagram.ResizeTool||n instanceof ej.datavisualization.Diagram.PhaseTool||n instanceof ej.datavisualization.Diagram.RotateTool||n instanceof ej.datavisualization.Diagram.PanTool&&this.tool()&ej.datavisualization.Diagram.Tool.SingleSelect&&this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan?!0:!1},_updateNodeMargin:function(n){var t,s,h,r,u,c,o;if(n.parent!=""&&(t=this.nameTable[n.parent],t&&t.container&&t.container.type=="canvas")){var f=ej.datavisualization.Diagram.Util.bounds(t),e=ej.datavisualization.Diagram.Util.bounds(n),i=ej.datavisualization.Diagram.Geometry.rect([e.topLeft,e.topRight,e.bottomRight,e.bottomLeft]);n.marginLeft=i.x-(f.x+t.paddingLeft);s=f.x+t.width-(i.x+i.width)-t.paddingRight;n.marginRight=s<0?0:s;n.marginTop=i.y-(f.y+t.paddingTop);h=f.y+t.height-(i.y+i.height)-t.paddingBottom;n.marginBottom=h<0?0:h;t.isLane&&(r=0,u=0,t.orientation==="horizontal"?(r=50,u=0):(r=0,u=50),n.marginLeft=n.marginLeft>=r?n.marginLeft:r,n.marginTop=n.marginTop>=u?n.marginTop:u)}if((n.type=="pseudoGroup"||n.name=="multipleSelection")&&n.children.length>0)for(o=0;o<n.children.length;o++)c=this.nameTable[this._getChild(n.children[o])],c&&this._updateNodeMargin(c)},_raisePropertyChange:function(n){n&&(this._isSizingCommand?n.cause=ej.datavisualization.Diagram.ActionType.Size:this._isUndo?n.cause=ej.datavisualization.Diagram.ActionType.HistoryChange:this._isTouchedEvent&&(n.cause=ej.datavisualization.Diagram.ActionType.Touch),this._raiseEvent("propertyChange",n))},_updateAdjacentEdges:function(n,t){var i,r;if(n.inEdges&&n.inEdges.length>0)for(i=0,r=n.inEdges.length;i<r;i++)t[n.inEdges[i]]=this.nameTable[n.inEdges[i]];if(n.outEdges&&n.outEdges.length>0)for(i=0,r=n.outEdges.length;i<r;i++)t[n.outEdges[i]]=this.nameTable[n.outEdges[i]]},_translate:function(n,t,i,r,u,f){var h,f,s,o,e;if(t||i)if(n.segments)ej.datavisualization.Diagram.Util._translateLine(n,t,i,n),this._dock(n,r),ej.datavisualization.Diagram.Util.updateBridging(n,this),this._updateConnectorBridging(n);else{if(f||(h=!0),f=f||{},this._updateAdjacentEdges(n,f),n.offsetX+=t,n.offsetY+=i,this._parentNode||this.activeTool.name=="phase"||(this._parentNode=n),(n._type==="group"||n.type==="pseudoGroup")&&!u){for(s=this._getChildren(n.children),o=0;o<s.length;o++)e=r[s[o]],e&&(this._translate(e,t,i,r,undefined,f),e.parent&&e.parent!=n.name&&n.type!="pseudoGroup"&&ej.datavisualization.Diagram.Util._updateGroupBounds(r[e.parent],this));n.type!="group"&&n.container&&ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)}if(n!=this.activeTool.helper&&(this.nameTable[n.name]&&this._updateQuad(n),ej.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(n,t,i,null,this)),this._parentNode==n&&delete this._parentNode,h&&!this._preventDocking&&n!=this.activeTool.helper&&!this._disableSegmentChange)for(o in f)e=this.nameTable[o],e&&((n.isSwimlane||(n.type=="pseudoGroup"||n.type=="group")&&!this._containsChild(n,e))&&ej.datavisualization.Diagram.Util._translateLine(e,t,i,e),this._dock(e,this.nameTable),e.annotation&&ej.datavisualization.Diagram.DefautShapes.updateAnnotationProperties(e,this))}else return!1},_containsChild:function(n,t){var i,r,f,u;if(n.children&&n.children.length>0)for(i=this._getChildren(n.children),r=0;r<i.length;r++){if(f=this._collectionContains(t.name,i),f)return!0;u=this._getChild(i[r]);u&&u.children&&this._containsChild(u,t)}},_translateLabel:function(n,t,i,r){var u=$.extend(!0,{},t);t.margin.left+=i;t.margin.top+=r;t.margin.right-=i;t.margin.bottom-=r;t.horizontalAlignment=="center"&&(t.margin.right=0);t.verticalAlignment=="center"&&(t.margin.bottom=0);ej.datavisualization.Diagram.DiagramContext.updateLabel(n,t,this);this._comparePropertyValues(n,"labels",u)},_rotate:function(n,t,i){var u,e,o,s,r,f,h;if(!n.segments&&t){if(n.rotateAngle+=t,n.rotateAngle%=360,n.rotateAngle<0&&(n.rotateAngle+=360),n._type==="group"||n.type==="pseudoGroup"){for(u=ej.Matrix.identity(),ej.Matrix.rotate(u,t,n.offsetX,n.offsetY),s=this._getChildren(n.children),f=0;f<s.length;f++)r=i[s[f]],r&&(r.segments?(r.sourceNode||this._setEndPoint(r,ej.Matrix.transform(u,r.sourcePoint),!1),r.targetNode||this._setEndPoint(r,ej.Matrix.transform(u,r.targetPoint),!0)):(this._rotate(r,t,i),e=r.offsetX,o=r.offsetY,h=ej.Matrix.transform(u,ej.datavisualization.Diagram.Point(e,o)),this._translate(r,h.x-e,h.y-o,i),this._updateAssociatedConnectorEnds(r,i)),r.parent&&r.parent!=n.name&&n.type!="pseudoGroup"&&ej.datavisualization.Diagram.Util._updateGroupBounds(i[r.parent],this));ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)}n.parent&&this._updateParentBounds(n.parent);n!=this.activeTool.helper&&this._updateQuad(n);this._updateAssociatedConnectorEnds(n,i)}},_raiseOffsetPropertyChange:function(n,t,i,r){n&&!n.segments?(t=t?t:0,i=i?i:0,t!=n.offsetX&&this._comparePropertyValues(n,"offsetX",{offsetX:t},r),i!=n.offsetY&&this._comparePropertyValues(n,"offsetY",{offsetY:i},r)):(t=t?t:0,i=i?i:0,this._comparePropertyValues(n,"sourcePoint",{sourcePoint:{x:n.sourcePoint.x+t,y:n.sourcePoint.y+i}},r),this._comparePropertyValues(n,"targetPoint",{targetPoint:{x:n.targetPoint.x+t,y:n.targetPoint.y+i}},r))},_raiseSizePropertyChange:function(n,t,i,r){if(n&&i&&t){var u=n.height*i,f=n.width*t;u!=n.height&&(this._comparePropertyValues(n,"height",{height:u},r),this._comparePropertyValues(n,"offsetY",{offsetY:n.offsetY+(u-n.height)},r));f!=n.width&&(this._comparePropertyValues(n,"width",{width:f},r),this._comparePropertyValues(n,"offsetX",{offsetX:n.offsetX+(f-n.width)/2},r))}},scale:function(n,t,i,r,u,f,e){var w,y,l,o,p,v,d,g,s,b,k;if(t&&t!=1||i&&i!=1||n.isPhase)if(n.container)switch(n.container.type){case"canvas":v={};s=ej.Matrix.identity();ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY));c=n.width*t;h=n.height*i;e&&(n.minHeight=h,n.minWidth=c);v.width=c;v.height=h;v&&v.width>1&&(d=n.offsetX-n.width/2,n.width!=v.width&&(n._scaled=!0),n.width=v.width,n.offsetX=n._isBpmn?a.x:d+n.width/2);v&&v.height>1&&(g=n.offsetY-n.height/2,n.height!=v.height&&(n._scaled=!0),n.height=v.height,n.offsetY=n._isBpmn?a.y:g+n.height/2);break;case"stack":s=ej.Matrix.identity();ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY));b=0;k=0;t!=0&&(b=n.marginLeft,k=n.marginRight);c=n.width*t-(b+k);h=n.height*i-(n.marginTop+n.marginBottom);v={height:n.height,width:n.width};this._resizeStack&&(n.width=c,n.height=h,n.offsetX=a.x,n.offsetY=a.y)}else if(s=ej.Matrix.identity(),n.segments){for(ej.Matrix.scale(s,t,i,r.x,r.y),l=0;l<n.segments.length;l++){for(o=n.segments[l],p=0;p<o.points.length;p++)o.points[p]=ej.Matrix.transform(s,o.points[p]),l!=0||p!=0||n.sourceNode||(o._startPoint=o.points[0],o._endPoint=o.points[o.points.length-1],ej.datavisualization.Diagram.Util._setLineEndPoint(n,ej.Matrix.transform(s,n.sourcePoint),!1)),l!=n.segments.length-1||p!=o.points.length-1||n.targetNode||(o._startPoint=o.points[0],o._endPoint=o.points[o.points.length-1],n.targetPoint=o._endPoint);o._startPoint=o.points[0];o._endPoint=o.points[o.points.length-1];o.type=="orthogonal"?o.length||o.length===0?o.length=o._length=ej.datavisualization.Diagram.Geometry.distance(o._startPoint,o._endPoint):ej.datavisualization.Diagram.Util._addOrthogonalPoints(o,n.segments[l-1],n.segments[l+1],n.sourcePoint,n.targetPoint):(o.point&&(o.point=o._endPoint),o._point=o._endPoint)}(n.sourceNode||n.targetNode)&&this._dock(n,u)}else{if(n._type==="group"||n.type==="pseudoGroup"){if(n.type!="bpmn"||n.width*t>=20&&n.height*i>=20){for(w=this._getChildren(n.children),l=0;l<w.length;l++)y=u[w[l]],y&&(n.type!="bpmn"||ej.datavisualization.Diagram.Util.canResize(y))&&(this.scale(y,t,i,r,u),y.parent&&y.parent!=n.name&&n.type!="pseudoGroup"&&ej.datavisualization.Diagram.Util._updateGroupBounds(u[y.parent],this));if(n.type=="bpmn"&&ej.datavisualization.Diagram.Util._updateBPMNProperties(n,this,u,!0),n.children.length<=0){ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);var a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),c=n.width?n.width*t:n._width*t,h=n.height?n.height*i:n._height*i;c>1&&(n.width?(c!=n.width&&(n._scaled=!0),n.width=c,n.offsetX=a.x):(c!=n._width&&(n._scaled=!0),n.maxWidth=n.parent&&u[n.parent].width!=n.maxWidth?u[n.parent].width:c,n.offsetX=a.x-(n._width*t-n._width)/2));h>1&&(n.height?(h!=n.height&&(n._scaled=!0),n.height=h,n.offsetY=a.y):(h!=n._height&&(n._scaled=!0),n.maxHeight=n.parent&&u[n.parent].height>h?u[n.parent].height:h,n.offsetY=a.y-(n._height*i-n._height)/2))}ej.datavisualization.Diagram.Util._updateGroupBounds(n,this);n!=this.activeTool.helper&&ej.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(n,1/t,1/i,r,this)}}else{ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);var a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),c=n.width*t,h=n.height*i;n.maxWidth!=0&&(c=Math.min(n.maxWidth,c));n.minWidth!=0&&(c=Math.max(n.minWidth,c));n.maxHeight!=0&&(h=Math.min(n.maxHeight,h));n.minHeight!=0&&(h=Math.max(n.minHeight,h));c>0&&(c!=n.width&&(n._scaled=!0),c!=n.maxWidth&&c!=n.minWidth&&(n.width=c,n.offsetX=a.x));h>0&&(h!=n.height&&(n._scaled=!0),h!=n.maxHeight&&h!=n.minHeight&&(n.height=h,n.offsetY=a.y))}n.parent&&this._updateParentBounds(n.parent);ej.datavisualization.Diagram.Util._updateBPMNProperties(n,this,u,!0);this.activeTool.name=="resize"&&this.activeTool.inAction&&this.selectionList[0]&&this.selectionList[0].type!="pseudoGroup"&&this.selectionList[0].type!="group"||this._updateAssociatedConnectorEnds(n,u);n!=this.activeTool.helper&&this._updateQuad(n)}},_updateParentBounds:function(n){n=this.nameTable[this._getChild(n)];n&&n.type!="bpmn"&&!n.container&&(ej.datavisualization.Diagram.Util._updateGroupBounds(n,this),ej.datavisualization.Diagram.DiagramContext.update(n,this),n.parent&&this._updateParentBounds(n.parent))},_dock:function(n,t,i){if(!this._preventDocking&&!this._disableSegmentChange&&(!this._layoutInAction||!this._isAnimating)){var r=n.segments.length,u=n.segments[0].points.length,f=n.segments[n.segments.length-1].points.length;this._preventSegmentAdjusting&&(n._preventSegmentAdjusting=!0);ej.datavisualization.Diagram.Util.dock(n,t,this);delete n._preventSegmentAdjusting;r!=n.segments.length&&this._svg&&(ej.datavisualization.Diagram.Util._updateConnectorSegments(n,n.sourcePort,n.targetPort,this),ej.datavisualization.Diagram.DiagramContext._refreshSegments(n,this));this.selectionList[0]==n&&(i||u!=n.segments[0].points.length||f!=n.segments[n.segments.length-1].points.length)&&ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom);this._updateQuad(n)}},_updateChildAdjacentConnectors:function(n,t){var u=this._getChildTable(n,{}),r,i;for(r in u)i=this.nameTable[r],i&&i.segments&&n.children.indexOf(r)==-1&&(t||(i._staticLength=!0),this._dock(i,this.nameTable),delete i._staticLength,ej.datavisualization.Diagram.DiagramContext.update(i,this))},_setEndPoint:function(n,t,i){ej.datavisualization.Diagram.Util._setLineEndPoint(n,t,i);this._updateQuad(n)},_updateAssociatedConnectorEnds:function(n,t){var r,f,i,s,u,o,e;if(!n.segments&&(n.inEdges.length||n.outEdges.length)){for(s=this._isNodeToNodeConnection(n),u=n,n.type=="bpmn"&&n._type=="group"&&(u=typeof n.children[0]=="object"?n.children[0]:this.nameTable[n.children[0]]),s&&(o=ej.datavisualization.Diagram.Util._findSegmentPoints(u)),e={},this._parentNode&&(e=this._getChildTable(this._parentNode,{})),r=0,f=n.inEdges.length;r<f;r++)i=t[n.inEdges[r]],!i||this._parentNode&&e[i.sourceNode]||(i.targetPadding?delete u._segmentPoints:u._segmentPoints=o,this._dock(i,t));for(r=0,f=n.outEdges.length;r<f;r++)i=t[n.outEdges[r]],!i||this._parentNode&&e[i.targetNode]||(i.sourcePadding?delete u._segmentPoints:u._segmentPoints=o,this._dock(i,t));delete u._segmentPoints}},_isNodeToNodeConnection:function(n){var t,i;if(n.inEdges.length)for(t=0,i=n.inEdges.length;t<i;t++)if(this.nameTable[n.inEdges[t]]&&!this.nameTable[n.inEdges[t]].targetPort&&(n.type!="bpmn"||this.nameTable[n.inEdges[t]].segments[0].type!="orthogonal"))return!0;if(n.outEdges.length)for(t=0,i=n.outEdges.length;t<i;t++)if(this.nameTable[n.outEdges[t]]&&!this.nameTable[n.outEdges[t]].sourcePort&&(n.type!="bpmn"||this.nameTable[n.outEdges[t]].segments[this.nameTable[n.outEdges[t]].segments.length-1].type!="orthogonal"))return!0},_updateChildBounds:function(n,t){var r,u,i,f,e,o,s;n.width==0&&n.height==0?(r=n.offsetX,u=n.offsetY,ej.datavisualization.Diagram.Util._updateGroupBounds(n,this),this._translate(n,r-n.offsetX,u-n.offsetY,t)):(r=n.offsetX,u=n.offsetY,i=ej.datavisualization.Diagram.Util._getChildrenBounds(n,this),n.offsetX=i.x+i.width*n.pivot.x,n.offsetY=i.y+i.height*n.pivot.y,f=r-n.offsetX,e=r-n.offsetY,this._translate(n,f,e,t),o=n.width/i.width,s=n.height/i.height,this._scale(n,o,s,n.pivot,t),this._translate(n,r-n.offsetX,u-n.offsetY,t))},_updateQuad:function(n){var r,t,i;this._spatialSearch&&this.nameTable[n.name]&&(r=this.getObjectType(n),t=!1,(n.isPhase||n.isLane||n._isHeader||n.isLaneStack||n.isPhaseStack||n._isInternalShape||n.type=="pseudoGroup")&&(t=!0),n.parent&&this.nameTable[n.parent]&&(i=this.nameTable[n.parent],(i.isPhaseStack||i.isSwimlane)&&(t=!0),i.type!="bpmn"&&this._updateQuad(i)),this._selectedSymbol!=null&&this._selectedSymbol.isLane&&n.isLane&&!n.parent&&(t=!1),this._disableUpdateQuad&&(t=!0),t||n._connectorType||ej.datavisualization.Diagram.SpatialUtil._updateQuad(this,this._spatialSearch,n))},_sliceDockLines:function(n){var i=$.extend({},n),t=null;for(var r in i)t=this.nameTable[this._getChild(i[r])],t&&t.segments&&(t.sourceNode||t.targetNode)&&n.pop(t.name)},_canExecute:function(){return this._isEditing&&(this._currentCommand=="delete"||this._currentCommand=="cut"||this._currentCommand=="focusToPreviousItem"||this._currentCommand=="undo"||this._currentCommand=="redo"||this._currentCommand=="focusToNextItem"||this._currentCommand=="selectFocusedItem"||this._currentCommand=="selectAll"||this._currentCommand=="copy"||this._currentCommand=="paste"||this._currentCommand.match("nudge"))?!1:this._currentCommand=="endEdit"&&!this._isEditing?!1:!0},_setItemDraggable:function(n){var t=this,i=!1;this._canDragGlobally=!0;$(n).ejDraggable({clone:!0,helper:function(){var u,n,f,i,r;return this._selectedSymbol=null,this._isDragged=!1,u=t._renderItemContainer("diagram_clone",document.body),u.document.setAttribute("drag","true"),t.activeTool&&t.activeTool.selectedObject&&!t.activeTool.helper&&(n=$.extend(!0,{},t.activeTool.selectedObject),t._updateChildren(n),t.edgeTable={},t.edgeTable=t._getEdgeTable(n,t.edgeTable),this._updateSelectedItem(n,n.isSwimlane),this._selectedSymbol=n,this._isDragged=!1,this._targetId=t._id,f=ej.datavisualization.Diagram.Util.bounds(n),this.cursorAt={top:105,left:105},i=ej.datavisualization.Diagram.NodeType({offsetX:n.offsetX,offsetY:n.offsetY,width:100,height:100,shape:"path",opacity:.5,pathData:"M49.955,50.7915L1.74601,99L98.164,99zM1,1.83699L1,98.332L49.2477,50.0843zM99,1.74699L50.662,50.0845L99,98.422zM1.57701,1L49.9548,49.3773L98.332,1zM0,0L100,0L100,100L0,100z "},t),i=t._getNewNode(i),ej.datavisualization.Diagram.SvgContext.renderNode(i,u,null,!0,t)),r=document.getElementById("diagram_clone_paletteItem"),$(r).addClass("dragClone"),$(r).css("display","none"),$(r)},drag:function(n){var l=$(n.target).parents(".e-datavisualization-diagram"),s,e,h,t,f,r;if(l.length){if(t=$("#"+l.attr("id")).ejDiagram("instance"),(this.model._isDragged||this.model._targetId!=t._id)&&this.model._selectedSymbol){this.model._isDragged||this.model._targetId==t._id?this.model._targetId!=t._id&&(t.edgeTable&&delete t.edgeTable,i=!1):(s=$("#"+this.model._targetId).ejDiagram("instance"),s._delete(s.nameTable[this.model._selectedSymbol.name]),i=!1,f=s._historyList.currentEntry,r=f.previous,f.object=r.undoObject.node,r.undoObject.childTable&&(f.childTable=r.undoObject.childTable),r.undoObject.edgeTable&&(f.edgeTable=r.undoObject.edgeTable),s.removeHistoryEntry(r));this.model._isDragged=!0;t._selectedSymbol=this.model._selectedSymbol;t._isNodeEnters=!0;var u=t._selectedSymbol,o=t._currZoom,a=$("#"+t.element[0].id).offset(),c=t._isTouchEvent(n.event),v=((c?c.pageX:n.event.pageX)+t._hScrollOffset-a.left)/o,y=((c?c.pageY:n.event.pageY)+t._vScrollOffset-a.top)/o;if(u.segments?this.model._translate(u,v-(u.sourcePoint.x+u.targetPoint.x)/2*o,y-(u.sourcePoint.y+u.targetPoint.y)/2*o):this.model._translate(u,v-u.offsetX/o,y-u.offsetY/o),this.model._isDragged&&t.edgeTable&&t.nameTable[u.name]&&!i&&u.type!="pseudoGroup"){for(e in t.edgeTable)t.nameTable[e]?(h=t.nameTable[e],h.sourceNode=t.edgeTable[e].sourceNode,h.sourcePort=t.edgeTable[e].sourcePort,h.targetNode=t.edgeTable[e].targetNode,h.targetPort=t.edgeTable[e].targetPort):t.add(t.edgeTable[e]);t._clearSelection(!0);t._addSelection(t.nameTable[u.name],!0);i=!0}}this.helper.css("display","none")}else this.model._selectedSymbol&&(t=$("#"+this.model._targetId).ejDiagram("instance"),t._delete(t.nameTable[this.model._selectedSymbol.name]),i=!1,this.model._isDragged||(f=t._historyList.currentEntry,r=f.previous,f.object=r.undoObject.node,r.undoObject.childTable&&(f.childTable=r.undoObject.childTable),r.undoObject.edgeTable&&(f.edgeTable=r.undoObject.edgeTable),t.removeHistoryEntry(r)),this.helper.css("display","block"),this.model._isDragged=!0);$("html,body").css("cursor","no-drop")},dragStop:function(n){var u=$(n.target).parents(".e-datavisualization-diagram"),i,r,t;u&&(i=$("#"+u.attr("id")).ejDiagram("instance"),this.model._isDragged&&this.model._targetId==i._id&&(r=i._historyList.currentEntry,t=r.previous,r.undoObject.node=t.object,t.childTable&&(r.undoObject.childTable=t.childTable),t.edgeTable&&(r.undoObject.edgeTable=t.edgeTable),i.removeHistoryEntry(t)),i._selectedSymbol=null,delete i._isNodeEnters);$(this.helper).remove();$("html,body").css("cursor","default")},_translate:function(n,t,i){if(n.segments)ej.datavisualization.Diagram.Util._translateLine(n,t,i,n);else if(n.offsetX+=t,n.offsetY+=i,n.type=="pseudoGroup"||n.type=="group")for(var r=0;r<n.children.length;r++)this._translate(n.children[r],t,i)},_updateSelectedItem:function(n,i){var r,u;if(n.type=="pseudoGroup"||n.type=="group")for(r=0;r<n.children.length;r++)typeof n.children[r]=="string"&&(n.children[r]=t.nameTable[n.children[r]]),this._updateSelectedItem(n.children[r],i);if(!i)if(n.segments)n.sourceNode=n.targetNode=n.sourcePort=n.targetPort="";else{for(r=0;r<n.inEdges.length;r++)u=t.findNode(n.inEdges[r]),t.model.selectedItems.children.indexOf(u)==-1&&n.inEdges.splice(r,1);for(r=0;r<n.outEdges.length;r++)u=t.findNode(n.outEdges[r]),t.model.selectedItems.children.indexOf(u)==-1&&n.outEdges.splice(r,1)}}})},_renderItemContainer:function(n,t){var r=document.createElement("div"),i={width:100,height:100},u={id:n+"_paletteItem",draggable:"true",height:i.height+"px",width:i.width+"px",style:"padding: 4; height:"+(i.height+1)+"px;width:"+(i.width+1)+"px;-ms-touch-action: none;touch-action: none;"};return ej.datavisualization.Diagram.Util.attr(r,u),t.appendChild(r),this._setItemDraggable(r),this._renderAnchor(r,n,i)},_renderAnchor:function(n,t,i){var r=document.createElement("div"),u={id:t+"_anchor",height:i.height+"px","class":"e-anchor"};return ej.datavisualization.Diagram.Util.attr(r,u),n.appendChild(r),this._renderSvg(r,t,i)},_renderSvg:function(n,t,i){var r=document.createElement("div"),u={id:t+"_svgWrapper","class":"e-svg-container",style:"width:"+i.width+"px;height:"+i.height+"px;"},f;return ej.datavisualization.Diagram.Util.attr(r,u),u={id:t+"_svg",width:i.width,height:i.height,version:"1.1",xlink:"http://www.w3.org/1999/xlink"},f=new ej.datavisualization.Diagram.Svg(u),r.appendChild(f.document),n.appendChild(r),f}});ej.datavisualization.Diagram.Locale={};ej.datavisualization.Diagram.Locale["default"]={cut:"Cut",copy:"Copy",paste:"Paste",undo:"Undo",redo:"Redo",selectAll:"Select All",grouping:"Grouping",group:"Group",ungroup:"Ungroup",order:"Order",bringToFront:"Bring To Front",moveForward:"Move Forward",sendBackward:"Send Backward",sendToBack:"Send To Back"};ej.datavisualization.Diagram.Locale["en-US"]={cut:"Cut",copy:"Copy",paste:"Paste",undo:"Undo",redo:"Redo",selectAll:"Select All",grouping:"Grouping",group:"Group",ungroup:"Ungroup",order:"Order",bringToFront:"Bring To Front",moveForward:"Move Forward",sendBackward:"Send Backward",sendToBack:"Send To Back"};$.fn.pinchDiagram=function(n,t){var i=[],f=function(n){var u=n.touches,t,f,e,r,o,s;if(u.length>=2)for(t=0;t<u.length;t++){for(f=u[t],e=!1,r=0;r<i.length;r++)if(o=i[r],f.identifier===o.identifier){e=!0;break}e||(s=$.extend({},f),i.push(s))}n.preventDefault()},r=function(n,t){var i=t.pageX-n.pageX,r=t.pageY-n.pageY;return Math.sqrt(i*i+r*r)},e=function(n){for(var e,t,u,o,f=n.changedTouches,r=0;r<f.length;r++)for(e=f[r],t=0;t<i.length;t++)u=i[t],u.identifier===e.identifier&&(o=i.indexOf(u),i.splice(o,1));n.preventDefault()},u=function(n,t){n.pageX=t.pageX;n.pageY=t.pageY},o=function(n){var f,e,l;if(n.preventDefault(),f=n.touches,f.length>=2){var o=f[0],s=f[1],h=i[0],c=i[1];e=r(o,s)/r(h,c);l=t._mousePosition(n,!1);ej.datavisualization.Diagram.ZoomUtil.zoomPan(t,e,0,0,l,!0,!0);u(h,o);u(c,s)}};this[0].addEventListener("touchstart",f,!1);this[0].addEventListener("touchend",e,!1);this[0].addEventListener("touchmove",o,!1)}}(jQuery,Syncfusion),function(n,t){"use strict";t.MatrixTypes={Identity:0,Translation:1,Scaling:2,Unknown:4};t.MatrixDefaults={m11:1,m12:0,m21:0,m22:1,offsetX:0,offsetY:0,type:t.MatrixTypes.Identity};t.Matrix={identity:function(){return n.extend(!0,{},t.MatrixDefaults)},multiply:function(n,i){var u=n.type,f=i.type,e,r,o,s;if(f!=t.MatrixTypes.Identity){if(u==t.MatrixTypes.Identity){n.m11=i.m11;n.m12=i.m12;n.m21=i.m21;n.m22=i.m22;n.offsetX=i.offsetX;n.offsetY=i.offsetY;n.type=i.type;return}if(f==t.MatrixTypes.Translation){n.offsetX+=i.offsetX;n.offsetY+=i.offsetY;u!=t.MatrixTypes.Unknown&&(n.type|=t.MatrixTypes.Translation);return}if(u!=t.MatrixTypes.Translation){e=u<<4|f;switch(e){case 34:n.m11*=i.m11;n.m22*=i.m22;return;case 35:n.m11*=i.m11;n.m22*=i.m22;n.offsetX=i.offsetX;n.offsetY=i.offsetY;n.type=t.MatrixTypes.Translation|t.MatrixTypes.Scaling;return;case 36:break;default:switch(e){case 50:n.m11*=i.m11;n.m22*=i.m22;n.offsetX*=i.m11;n.offsetY*=i.m22;return;case 51:n.m11*=i.m11;n.m22*=i.m22;n.offsetX=i.m11*n.offsetX+i.offsetX;n.offsetY=i.m22*n.offsetY+i.offsetY;return;case 52:break;default:switch(e){case 66:case 67:case 68:break;default:return}}}r=this.identity();this._setMatrix(r,n.m11*i.m11+n.m12*i.m21,n.m11*i.m12+n.m12*i.m22,n.m21*i.m11+n.m22*i.m21,n.m21*i.m12+n.m22*i.m22,n.offsetX*i.m11+n.offsetY*i.m21+i.offsetX,n.offsetX*i.m12+n.offsetY*i.m22+i.offsetY);r.m21||r.m12?r.type=t.MatrixTypes.Unknown:((r.m11&&r.m11!=1||r.m22&&r.m22!=1)&&(r.type=t.MatrixTypes.Scaling),(r.offsetX||r.offsetY)&&(r.type|=t.MatrixTypes.Translation),(r.type&(t.MatrixTypes.Translation|t.MatrixTypes.Scaling))==t.MatrixTypes.Identity&&(r.type=t.MatrixTypes.Identity));n.m11=r.m11;n.m12=r.m12;n.m21=r.m21;n.m22=r.m22;n.offsetX=r.offsetX;n.offsetY=r.offsetY;n.type=r.type;return}if(o=n.offsetX,s=n.offsetY,n.m11=i.m11,n.m12=i.m12,n.m21=i.m21,n.m22=i.m22,n.offsetX=i.offsetX,n.offsetY=i.offsetY,n.type=i.type,n.offsetX=o*i.m11+s*i.m21+i.offsetX,n.offsetY=o*i.m12+s*i.m22+i.offsetY,f==t.MatrixTypes.Unknown){n.type=t.MatrixTypes.Unknown;return}n.type=t.MatrixTypes.Translation|t.MatrixTypes.Scaling}},transform:function(n,t){var i=this._multiplyPoint(n,t.x,t.y);return{x:Math.round(i.x*100)/100,y:Math.round(i.y*100)/100}},rotate:function(n,t,i,r){t%=360;this.multiply(n,this._createRotationRadians(t*.017453292519943295,i?i:0,r?r:0))},scale:function(n,t,i,r,u){this.multiply(n,this._createScaling(t,i,r?r:0,u?u:0))},translate:function(n,i,r){if(n.type&t.MatrixTypes.Identity){this._setMatrix(n,1,0,0,1,i,r,t.MatrixTypes.Translation);return}if(n.type&t.MatrixTypes.Unknown){n.offsetX+=i;n.offsetY+=r;return}n.offsetX+=i;n.offsetY+=r;n.type|=t.MatrixTypes.Translation},_createScaling:function(n,i,r,u){var f=this.identity();return this._setMatrix(f,n,0,0,i,r-n*r,u-i*u,(r||u)?t.MatrixTypes.Scaling|t.MatrixTypes.Translation:t.MatrixTypes.Scaling),f},_createRotationRadians:function(n,i,r){var e=this.identity(),u=Math.sin(n),f=Math.cos(n),o=i*(1-f)+r*u,s=r*(1-f)-i*u;return this._setMatrix(e,f,u,-u,f,o,s,t.MatrixTypes.Unknown),e},_multiplyPoint:function(n,i,r){switch(n.type){case t.MatrixTypes.Identity:break;case t.MatrixTypes.Translation:i+=n.offsetX;r+=n.offsetY;break;case t.MatrixTypes.Scaling:i*=n.m11;r*=n.m22;break;case t.MatrixTypes.Translation|t.MatrixTypes.Scaling:i*=n.m11;i+=n.offsetX;r*=n.m22;r+=n.offsetY;break;default:var u=r*n.m21+n.offsetX,f=i*n.m12+n.offsetY;i*=n.m11;i+=u;r*=n.m22;r+=f}return{x:i,y:r}},_setMatrix:function(n,i,r,u,f,e,o,s){n.m11=i;n.m12=r;n.m21=u;n.m22=f;n.offsetX=e;n.offsetY=o;n.type=s||t.MatrixTypes.Identity}}}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.HitTesting={_getResizeHandleCenter:function(n,i,r){var f,u;r||(r=1);f=this.bounds(n);u=t.datavisualization.Diagram.Point(0,0);switch(i){case"topleft":u=f.topLeft;break;case"topcenter":u=f.top;break;case"topright":u=f.topRight;break;case"middleleft":u=f.left;break;case"middleright":u=f.right;break;case"bottomleft":u=f.bottomLeft;break;case"bottomcenter":u=f.bottom;break;case"bottomright":u=f.bottomRight;break;case"pivot":u=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY);break;case"rotate":var o=20/r,s=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY-n.height*n.pivot.y-10-o),e=t.Matrix.identity();t.Matrix.rotate(e,n.rotateAngle,n.offsetX,n.offsetY);u=t.Matrix.transform(e,s)}return u},findResizeHandleAtPoint:function(n,i){var e=null,u,o,f,r,s;if(n)for(f=["topleft","topcenter","topright","middleleft","middleright","bottomleft","bottomcenter","bottomright"],r=0,s=f.length;r<s;r++)if(u=this._getResizeHandleCenter(n,f[r]),u!==t.datavisualization.Diagram.Point(0,0)&&(o=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),o)){e=f[r];break}return e},findRotationHandleAtPoint:function(n,i,r){var u=this._getResizeHandleCenter(n,"rotate",r),f=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),10);return f?!0:!1},findPivotHandleAtPoint:function(n,i){var r=this._getResizeHandleCenter(n,"pivot"),u=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(r.x,r.y),7);return u?!0:!1},findEndPointHandleAtPoint:function(n,i){var f=null,r,e,u,o;return n&&(e=n.line.points,u=e[e.length-1],r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),r&&(f="targetEndPoint"),r||(u=e[0],r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),r&&(f="sourceEndPoint")),r||n.line.type!=="bezier"||(u=n.line._point1,r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),r&&(f="bezierpoint1"),r||(o=n.line._point2,r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(o.x,o.y),7),r&&(f="bezierpoint2")))),f}};t.datavisualization.Diagram.LayoutUtil={expandSubTree:function(n,i,r,u,f,e,o){var s,c,h,l;n._isAnimating||(s=n.model.scrollSettings.currentZoom,c=i.offsetX*s-n.model.scrollSettings.viewPortWidth/2-n.model.scrollSettings.horizontalOffset,(i.offsetY*s<n.model.scrollSettings.verticalOffset||i.offsetY*s>n.model.scrollSettings.verticalOffset+n.model.scrollSettings.viewPortHeight-3*i.height*s)&&n.update({scrollSettings:{verticalOffset:i.offsetY-n.model.scrollSettings.viewPortHeight/2}}),h=0,c!=0&&e?(n._preventScrollerUpdate=!0,l=setInterval(function(){h<4&&n.update({scrollSettings:{horizontalOffset:n.model.scrollSettings.horizontalOffset+c/4}});h++;h==5&&(clearInterval(l),delete n._preventScrollerUpdate,(o!==!1||!i.isExpanded)&&i.outEdges.length?t.datavisualization.Diagram.LayoutUtil.expand(n,i,r,u,f):t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(n))},25)):(delete n._preventScrollerUpdate,(o!==!1||!i.isExpanded)&&i.outEdges.length?this.expand(n,i,r,u,f):t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(n)))},_updateVisiblity:function(n,i,r){for(var u,f,e=0;e<i.outEdges.length;e++)u=i.outEdges[e],u=n.findNode(u),f=n.findNode(u.targetNode),u.opacity=f.opacity=r/100,t.datavisualization.Diagram.DiagramContext.updateNodeStyle(f,n),t.datavisualization.Diagram.DiagramContext.updateConnectorStyle(u,n),f.isExpanded&&f.outEdges.length&&this._updateVisiblity(n,f,r)},expand:function(i,r,u,f,e){var v,s,h,o,y,l,c,a,p;if(u===undefined&&(u=r.name),v=i.model.layout.fixedNode,i.model.layout.fixedNode=u,s=i.selectionList[0]?i.selectionList[0].name:"",s&&i._clearSelection(!0),f){if(!i._isAnimating){if(r._updateExpander=!0,i._updateEdgeCollection(),r.isExpanded?(i._collapseChildren(r),r.isExpanded=!1):(i._expandChildren(r),r.isExpanded=!0),i._isAnimating=!0,h=t.datavisualization.Diagram.Layout.doLayout(i,!1),o=0,h.length)n(".ej-d-connector").attr("opacity",0),n(".ej-d-icon-template").attr("opacity",0),i._layoutInAction=!0,y=setInterval(function(){var r,f,c;if(o++,o<5)for(r=0;r<h.length;r++)f=i.nameTable[h[r].object],i._disableSegmentChange=!0,i.updateNode(f.name,{offsetX:f.offsetX+h[r].diff/4,offsetY:f.offsetY+h[r].diffy/4}),i._disableSegmentChange=!1;if(o==5){for(clearInterval(y),delete i._layoutInAction,c=i._internalLayout,o=0;o<c._firstLevelNodes.length;o++)t.datavisualization.Diagram.HierarchicalLayout._updateConnectors(c,c._firstLevelNodes[o],1);delete i._internalLayout;n(".ej-d-connector").attr("opacity",1);n(".ej-d-icon-template").attr("opacity",1);(s||e)&&i._addSelection(i.findNode(s||u),!e);i._isAnimating=!1;delete i._preventScrollerUpdate;t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(i)}},50);else{for(l=i._internalLayout,o=0;o<l._firstLevelNodes.length;o++)t.datavisualization.Diagram.HierarchicalLayout._updateConnectors(l,l._firstLevelNodes[o],1);(s||e)&&i._addSelection(i.findNode(s||u),!e);i._isAnimating=!1;delete i._internalLayout}c=0;a=this;r.isExpanded&&(a._updateVisiblity(i,r,0),p=setInterval(function(){r.isExpanded&&(c<=100&&a._updateVisiblity(i,r,c),c==120&&clearInterval(p),c+=5)},25));t.datavisualization.Diagram.PageUtil._updatePageSize(i)}}else i.layout();i.model.layout.fixedNode=v}};t.datavisualization.Diagram.Util={convertPathToArray:function(n){var u=[],e=this.parsePathData(n),f,i,r,t;if(e.length>0)for(f=0;f<e.length;f++){i=e[f];r=i[0];switch(r.toLowerCase()){case"m":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x:i[t],y:i[t+1]}),t=t+1,r==="m"?r="l":r==="M"&&(r="L");break;case"l":case"t":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x:i[t],y:i[t+1]}),t=t+1;break;case"h":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x:i[t]});break;case"v":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,y:i[t]});break;case"z":u.push({pathSegTypeAsLetter:r});break;case"c":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x1:i[t],y1:i[t+1],x2:i[t+2],y2:i[t+3],x:i[t+4],y:i[t+5]}),t=t+5;break;case"s":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x2:i[t],y2:i[t+1],x:i[t+2],y:i[t+3]}),t=t+3;break;case"q":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x1:i[t],y1:i[t+1],x:i[t+2],y:i[t+3]}),t=t+3;break;case"a":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,r1:i[t],r2:i[t+1],angle:i[t+2],largeArcFlag:this.parseArcFlag(i[t+3]),sweepFlag:this.parseArcFlag(i[t+4]),x:i[t+5],y:i[t+6]}),t=t+6}}return u},_getImageAlignment:function(n){if(n)switch(n.toLowerCase()){case"xminymin":return"xMinYMin";case"xminymid":return"xMinYMid";case"xminymax":return"xMinYMax";case"xmidymin":return"xMidYMin";case"xmidymid":return"xMidYMid";case"xmidymax":return"xMidYMax";case"xmaxymin":return"xMaxYMin";case"xmaxymid":return"xMaxYMid";case"xmaxymax":return"xMaxYMax";case"none":return"none"}return"none"},parseArcFlag:function(n){var t;return n==="0"||n===0?t=!1:(n==="1"||n===1)&&(t=!0),t},parsePathData:function(n){var f=/([a-z]+)|([+-]?(?:\d+\.?\d*|\.\d+))/gi,i,t,r=[],u,e;for(f.lastIndex=0,u=!1;i=f.exec(n);)i[1]==="e"?(e="",u=!0):i[1]?(i[1].toLowerCase()==="zm"?(t&&r.push(t),r.push(["Z"]),t=[i[1].substring(1,2)]):(t&&r.push(t),t=[i[1]]),u=!1):(t||(t=[]),u||t.push(Number(i[2])),u=!1);return t&&r.push(t),r},pathSegArrayAsString:function(n){for(var i,r="",t=0;t<n.length;t++)i=n[t],r+=t===0?this.pathToString(i):" "+this.pathToString(i);return r},canEnablePointerEvents:function(n,i){var r=n,u;if(i)while(r){if(u=r.segments?r.constraints&t.datavisualization.Diagram.ConnectorConstraints.PointerEvents:r.constraints&t.datavisualization.Diagram.NodeConstraints.PointerEvents,!u)return u;r=typeof r.parent=="string"?i.nameTable[r.parent]:r}return!0},isClassifier:function(t){var i=typeof t.target.className=="string"?t.target.className:t.target.className.baseVal;return n(t.target).hasClass("ej-d-classifier")||i.indexOf("ej-d-classifier")>-1?!0:!1},pathToString:function(n){var t;switch(n.pathSegTypeAsLetter){case"Z":case"z":t=n.pathSegTypeAsLetter;break;case"M":case"m":case"L":case"l":t=n.pathSegTypeAsLetter+" "+n.x+" "+n.y;break;case"C":case"c":t=n.pathSegTypeAsLetter+" "+n.x1+" "+n.y1+" "+n.x2+" "+n.y2+" "+n.x+" "+n.y;break;case"Q":case"q":t=n.pathSegTypeAsLetter+" "+n.x1+" "+n.y1+" "+n.x+" "+n.y;break;case"A":case"a":t=n.pathSegTypeAsLetter+" "+n.r1+" "+n.r2+" "+n.angle+" "+(n.largeArcFlag?"1":"0")+" "+(n.sweepFlag?"1":"0")+" "+n.x+" "+n.y;break;case"H":case"h":t=n.pathSegTypeAsLetter+" "+n.x;break;case"V":case"v":t=n.pathSegTypeAsLetter+" "+n.y;break;case"S":case"s":t=n.pathSegTypeAsLetter+" "+n.x2+" "+n.y2+" "+n.x+" "+n.y;break;case"T":case"t":t=n.pathSegTypeAsLetter+" "+n.x+" "+n.y}return t},findPortByName:function(n,t){var r,i,u;if(n&&n.ports)for(i=0,u=n.ports.length;i<u;i++)if(r=n.ports[i],r.name===t)return r;return null},attr:function(n,t){for(var i in t)n.setAttribute(i.toString(),t[i])},removeChildFromGroup:function(n,t){var i=n.indexOf(t),r;if(i<0)for(r in n)if(typeof n[r]=="object"&&typeof t=="string"&&n[r].name===t){i=r;break}i>=0&&n.splice(i,1)},removeFromCollection:function(n,t,i){var i,r,u;if(n){i=n.nameTable[n._getChild(i)];for(r in t)u=n.nameTable[n._getChild(t[r])],u.name===i.name&&t.splice(r,1)}},removeItem:function(n,t){var i=n.indexOf(t);i>=0&&n.splice(i,1)},clear:function(n){while(n.length>0)n.pop()},getChild:function(n){if(n)return typeof n=="object"?n.name:n},randomId:function(){for(var n,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",r="",u=0;u<4;u++)n=t.getRandomValue(0,i.length-1),r+=i.substring(n,n+1);return r},htmlEncode:function(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")},canMove:function(n){if(this.canSelect(n))return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Drag:n.constraints&t.datavisualization.Diagram.NodeConstraints.Drag},canMoveLabel:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragLabel:n.constraints&t.datavisualization.Diagram.NodeConstraints.DragLabel},canRotate:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Rotate:n.constraints&t.datavisualization.Diagram.NodeConstraints.Rotate},canShowTooltip:function(n,i){var r;return(r=n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.InheritTooltip:n.constraints&t.datavisualization.Diagram.NodeConstraints.InheritTooltip,r)?i.model.tooltip:n.tooltip},canSelect:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Select:n.constraints&t.datavisualization.Diagram.NodeConstraints.Select},canBridge:function(n,i){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Bridging?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Bridging:n.constraints&t.datavisualization.Diagram.ConnectorConstraints.InheritBridging?i.model.constraints&t.datavisualization.Diagram.DiagramConstraints.Bridging:void 0},canCrispEdges:function(n,i){if(n.segments){if(n.constraints&t.datavisualization.Diagram.ConnectorConstraints.CrispEdges)return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.CrispEdges;if(i&&n.constraints&t.datavisualization.Diagram.ConnectorConstraints.InheritCrispEdges)return i.model.constraints&t.datavisualization.Diagram.DiagramConstraints.CrispEdges}else{if(n.constraints&t.datavisualization.Diagram.NodeConstraints.CrispEdges)return n.constraints&t.datavisualization.Diagram.NodeConstraints.CrispEdges;if(i&&n.constraints&t.datavisualization.Diagram.NodeConstraints.InheritCrispEdges)return i.model.constraints&t.datavisualization.Diagram.DiagramConstraints.CrispEdges}},canAllowPan:function(n){return n.constraints&t.datavisualization.Diagram.NodeConstraints.AllowPan},canAllowDrop:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.AllowDrop:n.constraints&t.datavisualization.Diagram.NodeConstraints.AllowDrop},canDelete:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Delete:n.constraints&t.datavisualization.Diagram.NodeConstraints.Delete},isPageEditable:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.UserInteraction},canFloatElements:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.FloatElements},canEnableAPIMethods:function(n){if(n&&n._enableAPIMethods)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.APIUpdate},canDoMultipleSelection:function(n){if(n&&this.isPageEditable(n))return n.tool()&t.datavisualization.Diagram.Tool.MultipleSelect},canDoSingleSelection:function(n){if(n&&this.isPageEditable(n))return n.tool()&t.datavisualization.Diagram.Tool.SingleSelect},canMoveOutofBoundary:function(n){return n.model.pageSettings.boundaryConstraints!="infinity"?!0:!1},_getPseudoGroupConstraints:function(i,r,u){var f,e,o,h,s;if(u&&u.type==="pseudoGroup")if((u.children.indexOf(r.name)>=0||r.name===u.name)&&i.model.selectedItems.getConstraints&&(e=i.model.selectedItems.getConstraints,typeof e=="string"&&(e=t.util.getObject(e,window))),e&&n.isFunction(e))f=e();else if(u.children)for(f=t.datavisualization.Diagram.NodeConstraints.Default,o=0;o<u.children.length;o++)h=i.nameTable[i._getChild(u.children[o])],h&&(s=h.constraints,s&t.datavisualization.Diagram.NodeConstraints.Resize||(f=f&~t.datavisualization.Diagram.NodeConstraints.Resize),s&t.datavisualization.Diagram.NodeConstraints.Rotate||(f=f&~t.datavisualization.Diagram.NodeConstraints.Rotate),s&t.datavisualization.Diagram.NodeConstraints.Drag||(f=f&~t.datavisualization.Diagram.NodeConstraints.Drag));return f},canPanning:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableX||n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableY},canZooming:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.Zoomable},canUndo:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.Undoable},canZoomTextEditor:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.ZoomTextEditor},canMultiSelectOnLane:function(n){return n.constraints&t.datavisualization.Diagram.NodeConstraints.MultiSelect},canMultiSelectOnNode:function(n){return n.constraints&t.datavisualization.Diagram.NodeConstraints.PointerEvents},canEnableTooltip:function(n){return n.model.selectedItems.constraints&t.datavisualization.Diagram.SelectorConstraints.Tooltip?!0:!1},canDrawStackHighlighter:function(n,i,r){var o,u,f,e;if(t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)&&n&&i&&r&&(o=n.nameTable[r.parent],o&&o.isLaneStack&&(u=n.nameTable[o.parent],u&&u.isSwimlane)))if(f=this.bounds(u),e=n.activeTool._getPageBounds(),u.orientation==="horizontal"){if(i.height+f.bottom>=e.height||i.width-u.width+f.right>e.width)return n.activeTool.updateCursor("not-allowed"),n._notAllow=!0,!1}else if(i.width+f.right>=e.width||i.height-u.height+f.bottom>e.height)return n.activeTool.updateCursor("not-allowed"),n._notAllow=!0,!1;return!0},canDragSourceEnd:function(n){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragSourceEnd},canDragTargetEnd:function(n){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragTargetEnd},canDragSegmentThumbs:function(n){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragSegmentThumb},isTargetConnected:function(n){return n.targetNode?!0:!1},isSourceConnected:function(n){return n.sourceNode?!0:!1},bounds:function(n,i){var r={},o,s,h,c,u,e,f;if(n)if(n.segments)for(o=0;o<n.segments.length;o++)s=n.segments[o],o==0?s.points&&(r=t.datavisualization.Diagram.Geometry.rect(s.points)):r=t.datavisualization.Diagram.Geometry.union(r,t.datavisualization.Diagram.Geometry.rect(s.points)),r.width==0&&(r.width=n.lineWidth,r.x-=n.lineWidth/2),r.height==0&&(r.height=n.lineWidth,r.y-=n.lineWidth/2);else n._type=="node"||n._type==="group"||n.type=="umlclassifier"||n._type=="pseudoGroup"?(h=n.width?n.width:n._width||0,c=n.height?n.height:n._height||0,r={x:n.offsetX-h*n.pivot.x,y:n.offsetY-c*n.pivot.y,width:h,height:c}):r=n;else r=t.datavisualization.Diagram.Rectangle();return r?(u={},r.x=Math.round(r.x*100)/100,r.y=Math.round(r.y*100)/100,r.width=Math.round(r.width*100)/100,r.height=Math.round(r.height*100)/100,u.width=r.width,u.height=r.height,u.x=u.left=r.x,u.right=r.x+r.width,u.y=u.top=r.y,u.bottom=r.y+r.height,u.center={x:r.x+r.width/2,y:r.y+r.height/2},u.topLeft={x:r.x,y:r.y},u.topCenter={x:r.x+r.width/2,y:r.y},u.topRight={x:r.x+r.width,y:r.y},u.middleLeft={x:r.x,y:r.y+r.height/2},u.middleRight={x:r.x+r.width,y:r.y+r.height/2},u.bottomLeft={x:r.x,y:r.y+r.height},u.bottomCenter={x:r.x+r.width/2,y:r.y+r.height},u.bottomRight={x:r.x+r.width,y:r.y+r.height},n&&n.rotateAngle&&!i&&(e=t.Matrix.identity(),t.Matrix.rotate(e,n.rotateAngle,n.offsetX,n.offsetY),u.topLeft=t.Matrix.transform(e,u.topLeft),u.topCenter=t.Matrix.transform(e,u.topCenter),u.topRight=t.Matrix.transform(e,u.topRight),u.middleLeft=t.Matrix.transform(e,u.middleLeft),u.middleRight=t.Matrix.transform(e,u.middleRight),u.bottomLeft=t.Matrix.transform(e,u.bottomLeft),u.bottomCenter=t.Matrix.transform(e,u.bottomCenter),u.bottomRight=t.Matrix.transform(e,u.bottomRight),f=t.datavisualization.Diagram.Geometry.rect([u.topLeft,u.topRight,u.bottomRight,u.bottomLeft]),u.x=u.left=f.x,u.y=u.top=f.y,u.right=f.x+f.width,u.bottom=f.y+f.height,u.center=t.datavisualization.Diagram.Point(f.x+f.width/2,f.y+f.height/2)),u.points=[u.topLeft,u.topRight,u.bottomRight,u.bottomLeft],u):r},_swapBounds:function(n,i){var n,i,u,r;return i=i,n.rotateAngle?(n.rotateAngle<45||(n.rotateAngle<=135?(u=t.Matrix.identity(),t.Matrix.rotate(u,n.rotateAngle,n.offsetX,n.offsetY),r=i.topCenter,i.topCenter=i.middleLeft,i.middleLeft=i.bottomCenter,i.bottomCenter=i.middleRight,i.middleRight=r,r=i.topLeft,i.topLeft=i.bottomLeft,i.bottomLeft=i.bottomRight,i.bottomRight=i.topRight,i.topRight=r):n.rotateAngle<=225?(u=t.Matrix.identity(),t.Matrix.rotate(u,n.rotateAngle,n.offsetX,n.offsetY),r=i.topCenter,i.topCenter=i.bottomCenter,i.bottomCenter=r,r=i.middleLeft,i.middleLeft=i.middleRight,i.middleRight=r,r=i.bottomLeft,i.bottomLeft=i.topLeft,i.topLeft=r,r=i.bottomRight,i.bottomRight=i.topRight,i.topRight=r):n.rotateAngle<=315&&(u=t.Matrix.identity(),t.Matrix.rotate(u,n.rotateAngle,n.offsetX,n.offsetY),r=i.topCenter,i.topCenter=i.middleRight,i.middleRight=i.bottomCenter,i.bottomCenter=i.middleLeft,i.middleLeft=r,r=i.topRight,i.topRight=i.bottomRight,i.bottomRight=i.bottomLeft,i.bottomLeft=i.topLeft,i.topLeft=r)),i.points=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],i):void 0},canResize:function(n,i){if(i)switch(i){case"n-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorth;case"s-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouth;case"e-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeEast;case"w-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeWest;case"se-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast;case"ne-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast;case"sw-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest;case"nw-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest}else return n.constraints&t.datavisualization.Diagram.NodeConstraints.Resize},canConnect:function(n,i){var r=null;return n&&(i?r=n.constraints&t.datavisualization.Diagram.PortConstraints.Connect:n.segments||(r=n.constraints&t.datavisualization.Diagram.NodeConstraints.Connect)),r},_initializeSegments:function(n,i){var u,f,r;if(n.segments&&n.segments.length<=1){n.segments.length||n.segments.push(t.datavisualization.Diagram.Segment({type:i||"straight"}));u=n.segments[0];switch(u.type){case"straight":u.point?(u.point.x!=n.targetPoint.x||u.point.y!=n.targetPoint.y)&&n.segments.push({type:u.type||"straight"}):u._point=n.targetPoint;break;case"orthogonal":u.length&&u.direction?(t.datavisualization.Diagram.Util._addOrthogonalPoints(u,null,null,n.sourcePoint,n.targetPoint),(u._endPoint.x!=n.targetPoint.x||u._endPoint.y!=n.targetPoint.y)&&n.segments.push({type:u.type||"straight"})):(u._length=u.length||20,u._direction=u.direction||"auto");break;case"bezier":u.point?(u.point.x!=n.targetPoint.x||u.point.y!=n.targetPoint.y)&&n.segments.push({type:u.type||"straight"}):u._point=n.targetPoint}}var e=n.sourcePoint,o=null,h=null,s;for(f=0;f<n.segments.length;f++){if(r=n.segments[f],r._startPoint=e,h=n.segments[f+1],r=n.segments[f]=t.datavisualization.Diagram.Segment(n.segments[f]),r.type=="orthogonal"){if(r._direction=r.direction||"auto",r._length=r.length||20,s=t.datavisualization.Diagram.Util._addOrthogonalPoints(n.segments[f],o,h,n.sourcePoint,n.targetPoint,s),e=n.segments[f]._endPoint,!r.length||!r.direction)break}else if(r.type=="straight"){if(r.points.push(e),r.points.push(n.segments[f].point||n.targetPoint),r._point=r._endPoint=n.segments[f].point||n.targetPoint,s=t.datavisualization.Diagram.Geometry.findAngle(e,r._endPoint),e=n.segments[f]._endPoint,!r.point)break}else if(r.type=="bezier"){if(r._point=r._endPoint=n.segments[f].point||n.targetPoint,r.points.push(e),r.points.push(n.segments[f].point||n.targetPoint),s=t.datavisualization.Diagram.Geometry.findAngle(e,r._endPoint),t.datavisualization.Diagram.Util._updateBezierPoints(r),e=n.segments[f]._endPoint,!r.point)break}else{r=t.datavisualization.Diagram.Segment({type:"orthogonal"});r._direction="auto";r._length=20;r._startPoint=e;r._endPoint=n.targetPoint;n.segments.push(r);t.datavisualization.Diagram.Util._addOrthogonalPoints(r,o,null,n.sourcePoint,n.targetPoint,s);break}o=n.segments[f]}(e.x!=n.targetPoint.x||e.y!=n.targetPoint.y)&&(r=t.datavisualization.Diagram.Segment({type:(o?o.type:i)||"straight"}),r._startPoint=e,r._endPoint=n.targetPoint,r.type=="orthogonal"?t.datavisualization.Diagram.Util._addOrthogonalPoints(r,o,null,n.sourcePoint,n.targetPoint,s):(r._point=n.targetPoint,r.points.push(e),r.points.push(n.targetPoint),r.type=="bezier"&&this._updateBezierPoints(r)),n.segments.push(r))},_getDockableBPMNNode:function(n,t,i,r){var u=r?t.segments[t.segments.length-1]:t.segments[0];if(n&&n.type=="bpmn"){if(u.type=="orthogonal")return n;n._type=="group"&&(n=typeof n.children[0]=="object"?n.children[0]:i[n.children[0]])}return n},dock:function(n,t,i){var r,o=null,u,s=null,h=n._srcDecoratorSize,c=n._tarDecoratorSize,f,e;n.sourcePadding&&(n._srcDecoratorSize+=n.sourcePadding);n.targetPadding&&(n._tarDecoratorSize+=n.targetPadding);r=t[n.targetNode];r&&(o=this.findPortByName(r,n.targetPort));u=t[n.sourceNode];u&&(s=this.findPortByName(u,n.sourcePort));f=this.isSourceConnected(n);e=this.isTargetConnected(n);s?s.connectorPadding&&(n._srcDecoratorSize+=s.connectorPadding):(u=this._getDockableBPMNNode(u,n,t,!1),u&&u.connectorPadding&&(n._srcDecoratorSize+=u.connectorPadding));o?o.connectorPadding&&(n._tarDecoratorSize+=o.connectorPadding):(r=this._getDockableBPMNNode(r,n,t,!0),r&&r.connectorPadding&&(n._tarDecoratorSize+=r.connectorPadding));e&&f&&o&&s?this._dockPortToPort(n,r,o,u,s):e&&o?f?n.segments.length==1?(this._dockNode(n,u,null,e,f),this._dockPortToNode(n,r,o,u,s,!0)):(this._dockNode(n,u,null,e,f),this._updateIntermediateSegments(n),this._dockPortToPoint(n,r,o,!0),this._updatePreviousSegment(n)):(this._dockPortToPoint(n,r,o,!0),this._updatePreviousSegment(n)):f&&s?e?n.segments.length==1?(this._dockNode(n,r,null,e,f),this._dockPortToNode(n,u,s,r,o,!1)):(this._dockPortToPoint(n,u,s,!1),this._updateIntermediateSegments(n),this._dockNode(n,r,null,e,f),this._updatePreviousSegment(n)):(this._dockPortToPoint(n,u,s,!1),this._updateIntermediateSegments(n)):e&&f?r&&u&&this._dockNode(n,r,u,e,f,i):e?this._dockNode(n,r,null,e,f):f&&this._dockNode(n,u,null,e,f);this._adjustEndPoint(n,u,s,r,o);n._srcDecoratorSize=h;n._tarDecoratorSize=c},_dockPortToPort:function(n,i,r,u,f){var o,s,h;if(n.segments.length==1){i&&(s=this.bounds(i,!0));u&&(h=this.bounds(u,!0));var e,c=n.segments[0],w=n.segments[n.segments.length-1],v=n.segments[0];if(v.type!=="orthogonal")r&&(o=this._getPortPosition(r,s),i.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,i.rotateAngle,i.offsetX,i.offsetY),o=t.Matrix.transform(e,o)),this._setLineEndPoint(n,o,!0)),f&&(o=this._getPortPosition(f,h),u.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,u.rotateAngle,u.offsetX,u.offsetY),o=t.Matrix.transform(e,o)),this._setLineEndPoint(n,o,!1)),v.type==="bezier"&&this._updateBezierPoints(v,i,r,s,u,f,h);else{var l=this._getPortPosition(r,s),a=this._getPortPosition(f,h),y=this._swapDirection(i.rotateAngle,this._getDirection(s,l)),p=this._swapDirection(u.rotateAngle,this._getDirection(h,a));u.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,u.rotateAngle,u.offsetX,u.offsetY),a=t.Matrix.transform(e,a));i.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,i.rotateAngle,i.offsetX,i.offsetY),l=t.Matrix.transform(e,l));this._constructSegements(n,c,s,l,y,h,a,p);this._setLineEndPoint(n,c.points[0],!1);this._setLineEndPoint(n,c.points[c.points.length-1],!0)}}else this._dockPortToPoint(n,u,f,!1),this._updateIntermediateSegments(n),this._dockPortToPoint(n,i,r,!0),this._updatePreviousSegment(n)},_dockPortToNode:function(n,i,r,u,f,e){var p=n.segments[0],w=n.segments[n.segments.length-1],h,l,c,b,a,o,y,s,v;i&&(h=this.bounds(i,!0));u&&(l=this.bounds(u,!0));b=e?w:p;b.type!=="orthogonal"?(a=this._getPortPosition(r,h),c=t.Matrix.identity(),t.Matrix.rotate(c,i.rotateAngle,i.offsetX,i.offsetY),a=t.Matrix.transform(c,a),this._setLineEndPoint(n,a,e)):(o=this._getPortPosition(r,h),y=this._swapDirection(i.rotateAngle,this._getDirection(h,o)),c=t.Matrix.identity(),t.Matrix.rotate(c,i.rotateAngle,i.offsetX,i.offsetY),o=t.Matrix.transform(c,o),s=e?n.sourcePoint:n.targetPoint,v=u?this._getDirection(l,s):"top",v&&(h=this.bounds(i),l=u?this.bounds(u):{left:s.x,right:s.x,top:s.y,bottom:s.y},e?(this._setLineEndPoint(n,o,!0),this._constructSegements(n,w,h,o,y,l,s,v)):(this._setLineEndPoint(n,o,!1),this._constructSegements(n,p,l,s,v,h,o,y))))},_dockPortToPoint:function(n,i,r,u){var s=n.segments[0],h=n.segments[n.segments.length-1],a=u?h:s,o,v,y;if(a.type!=="orthogonal")this._dockPortToNode(n,i,r,null,null,u);else{var e=this.bounds(i,!0),f=this._getPortPosition(r,e),c=this._swapDirection(i.rotateAngle,this._getDirection(e,f)),l=t.Matrix.identity();t.Matrix.rotate(l,i.rotateAngle,i.offsetX,i.offsetY);f=t.Matrix.transform(l,f);o=u?h._startPoint:s._endPoint;v=this.bounds(t.datavisualization.Diagram.Rectangle(o.x,o.y,0,0));e=this.bounds(i);y="top";u?(this._setLineEndPoint(n,f,!0),this._pointsFromNodeToPoint(n,h,c,e,i.rotateAngle,f,o,!0)):(this._setLineEndPoint(n,f,!1),this._pointsFromNodeToPoint(n,s,c,e,i.rotateAngle,f,o,!1))}},_containsminSpaceBetweenNode:function(n,t,i){var r;if(n&&n.minSpaceBetweenNode&&t&&i&&n.minSpaceBetweenNode&&n.minSpaceBetweenNode.length>0)for(r in n.minSpaceBetweenNode)if(n.minSpaceBetweenNode[r]===t.name||n.minSpaceBetweenNode[r]===i.name)return!0;return!1},_dockNode:function(n,t,i,r,u,f){var v,y,c=n._srcDecoratorSize+n._tarDecoratorSize,o,e,s,h,l,a,p;c=this._containsminSpaceBetweenNode(f,i,t)?0:c;n.segments.length==1?v=y=n.segments[0]:(v=n.segments[0],y=n.segments[n.segments.length-1]);r&&u&&!n.targetPort&&!n.sourcePort?n.segments.length==1?n.segments[0].type=="orthogonal"?(o=this.bounds(i),e=this.bounds(t),this._swapBounds(i,o),this._swapBounds(t,e),o.y-c>=e.bottom?(s=o.topCenter,l="top",h=e.bottomCenter,a="bottom"):o.bottom+c<=e.y&&(h=e.topCenter,a="top",s=o.bottomCenter,l="bottom"),o.bottom+c>e.y&&o.y<e.bottom+c&&(o.right+c<e.x||e.right>=o.x-c&&o.x>e.x?(s=o.middleRight,l="right",h=e.middleLeft,a="left"):e.right+c<o.x||o.right>=e.x-c&&o.x<e.x?(s=o.middleLeft,l="left",h=e.middleRight,a="right"):o.x<=e.x?(s=o.middleLeft,l="left",h=e.middleLeft,a="left"):o.x<=e.right?(s=o.middleRight,l="right",h=e.middleRight,a="right"):(s=o.middleLeft,l="left",h=e.middleRight,a="right")),p=this._findEndPoint(l,s,i)||o.center,s=this._findIntersection(i,o,n,s,p,!1)||s,p=this._findEndPoint(a,h,t)||e.center,h=this._findIntersection(t,e,n,h,p,!0)||h,this._setLineEndPoint(n,s,!1),this._setLineEndPoint(n,h,!0),n.segments[0].type=="orthogonal"&&(this._constructSegements(n,n.segments[0],e,n.targetPoint,a,o,n.sourcePoint,l),n.segments[0]._direction=l)):(t&&(e=this.bounds(t),this._swapBounds(t,e),i&&(o=this.bounds(i),this._swapBounds(i,o),this._setLineEndPoint(n,o.center,!1),this._setLineEndPoint(n,e.center,!0),this._dockBounds(n,i,o,!1)),this._setLineEndPoint(n,e.center,!0),this._dockBounds(n,t,e,!0)),n.segments[0].type=="bezier"&&this._updateBezierPoints(n.segments[0])):(this._dock(n,v,i,null,!1),this._updateIntermediateSegments(n),n.segments.length==1?(this._dock(n,v,i,t,!1),this._dock(n,y,t,i,!0)):(this._dock(n,y,t,null,!0),this._updatePreviousSegment(n))):r&&!n.targetPort?(this._dock(n,y,t,i,!0),this._updatePreviousSegment(n)):u&&!n.sourcePort&&(this._dock(n,v,t,i,!1),this._updateIntermediateSegments(n))},_adjustEndPoint:function(n,t,i,r,u){var h,c,l,f,a;if(n.sourcePadding||n.targetPadding||i&&i.connectorPadding||u&&u.connectorPadding){var e=0,o=r?this.bounds(r):null,s=t?this.bounds(t):null;t&&(f=n.segments[0],h=f.type!=="orthogonal"?f.type!=="bezier"?f._endPoint:f._point1:f.points[1],i&&(e=n.sourcePadding+i.connectorPadding),c=this._adjustPoint(f._startPoint,h,!0,e),this._setLineEndPoint(n,c,!1),f.type=="bezier"&&this._updateBezierPoints(f,r,u,o,t,i,s));r&&(f=n.segments[n.segments.length-1],l=f.type!=="orthogonal"?f.type!=="bezier"?f._startPoint:f._point2:f.points[f.points.length-2],u&&(e=n.targetPadding+u.connectorPadding),a=this._adjustPoint(l,f._endPoint,!1,e),this._setLineEndPoint(n,a,!0),f.type=="bezier"&&this._updateBezierPoints(f,r,u,o,t,i,s))}},_findEndPoint:function(n,t,i){var r;switch(n){case"top":r={x:t.x,y:t.y+Math.max(i.width,i.height)};break;case"bottom":r={x:t.x,y:t.y-Math.max(i.width,i.height)};break;case"left":r={y:t.y,x:t.x+Math.max(i.width,i.height)};break;case"right":r={y:t.y,x:t.x-Math.max(i.width,i.height)}}return r},_dock:function(n,i,r,u,f){var o,a,c,s,h,v,e,l,y;if(r)if(a=r,c=f?i._startPoint:i._endPoint,o=this.bounds(r),this._swapBounds(r,o),f)if(i.type=="orthogonal")if(e=n.segments[n.segments.length-2],e&&e.type=="orthogonal")if(i.points.length>2&&t.datavisualization.Diagram.Geometry.containsPoint(o,i.points[i.points.length-2])){if(l=!1,e.direction=="top"||e.direction=="bottom"){if(e._endPoint.x>=o.left&&e._endPoint.x<=o.right){this._removeLastSegment(n,i,e,r,u,f);return}e._length=e.length=Math.abs(e._startPoint.y-o.middleLeft.y);e.length==0?l=!0:(e.length<0&&(e._length=e.length*=-1,e._direction=e.direction=e.direction=="top"?"bottom":"top"),n.targetPoint=e._endPoint.x>o.right?o.middleRight:o.middleLeft)}else{if(e._endPoint.y>=o.top&&e._endPoint.y<=o.bottom){this._removeLastSegment(n,i,e,r,u,f);return}e._length=e.length=Math.abs(e._startPoint.x-o.topCenter.x);e.length==0?l=!0:(e.length<0&&(e._length=e.length*=-1,e._direction=e.direction=e.direction=="left"?"right":"left"),n.targetPoint=e._endPoint.y>o.bottom?o.bottomCenter:o.topCenter)}if(l){n.segments.splice(n.segments.length-2,1);this._dock(n,i,r,u,f);return}n.targetPoint=this._findIntersection(r,o,n,n.targetPoint,o.center,f)||n.targetPoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);i._direction=this._getOrthoDirection(i._startPoint,i._endPoint,e);this._setLineEndPoint(n,n.targetPoint,f)}else if(t.datavisualization.Diagram.Geometry.containsPoint(o,i._startPoint)){if(y=e.direction=="left"||e.direction=="right"?a.width/2:a.height/2,e._length=e.length-=y+30,e.length==0){n.segments.splice(n.segments.length-2,1);this._dock(n,i,r,u,f);return}n.targetPoint=e.direction=="left"||e.direction=="right"?e.direction=="right"?o.middleLeft:o.middleRight:e.direction=="bottom"?o.topCenter:o.bottomCenter;n.targetPoint=this._findIntersection(r,o,n,n.targetPoint,o.center,f)||n.targetPoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);i._direction=this._getOrthoDirection(i._startPoint,i._endPoint,e);this._setLineEndPoint(n,n.targetPoint,f)}else this._dockNodeToPoint(n,c,r,f);else this._dockNodeToPoint(n,c,r,f);else this._dockNodeToPoint(n,c,r,f);else if(i.type=="orthogonal"&&n.segments[1]&&n.segments[1].type=="orthogonal")if(n.segments[0]._isInternal&&t.datavisualization.Diagram.Geometry.containsPoint(o,i._endPoint))this._insertSegmentAtSourceEnd(n,i,o,r,f);else if(t.datavisualization.Diagram.Geometry.containsPoint(o,i._endPoint))this._removeFirstSegment(n,i,o,r,f);else{switch(i.direction){case"left":h="left";s=o.middleLeft;break;case"right":h="right";s=o.middleRight;break;case"top":h="top";s=o.topCenter;break;case"bottom":h="bottom";s=o.bottomCenter}i.points=[];v=this._findEndPoint(h,s,r)||o.center;s=this._findIntersection(r,o,n,s,v,f)||s;i.points.push(s);i.points.push(i._endPoint);this._setLineEndPoint(n,s,f)}else this._dockNodeToPoint(n,i._endPoint,r,f)},_removeLastSegment:function(n,t,i,r,u,f){n.segments.splice(n.segments.length-1,1);i.length=i._length=null;i.direction=null;i._direction=t._direction;this._dock(n,i,r,u,f)},_insertSegmentAtSourceEnd:function(n,t,i,r,u){var f=n.segments[1],e=n.segments[2],s,o;n.segments[0].direction=="left"||n.segments[0].direction=="right"?(s="horizontal",n.sourcePoint=f.direction=="top"?i.topCenter:i.bottomCenter,f&&(f.length||f.length===0)&&(f._length=f.length=Math.max(Math.abs(n.sourcePoint.y-f._endPoint.y),25)),e&&(e.length||e.length===0)&&(e.length=e._length=Math.abs(i.topCenter.x-e._endPoint.x))):(s="vertical",n.sourcePoint=f.direction=="left"?i.middleLeft:i.middleRight,f&&(f.length||f.length===0)&&(f._length=f.length=Math.max(Math.abs(n.sourcePoint.x-f._endPoint.x),25)),e&&(e.length||e.length===0)&&(e.length=e._length=Math.abs(i.middleRight.y-e._endPoint.y)));n.segments[3]&&(n.segments[3].length||n.segments[3].length==0)&&(o=f.direction=="bottom"||f.direction=="right"?f.length:-f.length,n.segments[3].length=n.segments[3]._length=s=="vertical"?Math.abs(n.sourcePoint.x+o-n.segments[3]._endPoint.x):Math.abs(n.sourcePoint.y+o-n.segments[3]._endPoint.y),n.segments[3].length<0&&(o=f.direction=="bottom"||f.direction=="right"?f.length:-f.length,n.segments[3].length=n.segments[3]._length=s=="vertical"?Math.abs(n.sourcePoint.x+o-n.segments[3]._endPoint.x):Math.abs(n.sourcePoint.y+o-n.segments[3]._endPoint.y)));n.segments.splice(0,1);n.sourcePoint=this._findIntersection(r,i,n,n.sourcePoint,i.center,u)||n.sourcePoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);this._setLineEndPoint(n,n.sourcePoint,u)},_removeFirstSegment:function(n,i,r,u,f){var h,c,e=n.segments[1].direction||this._getBezierDirection(n.segments[1].points[0],n.segments[1].points[1]),o,l,s,a;e=="left"||e=="right"?(o=i._endPoint.y-r.middleRight.y,n.segments[0].direction=n.segments[0]._direction=o>=0?"bottom":"top",n.segments[0].length=n.segments[0]._length=Math.abs(o),l=e=="right"?n.segments[1]._endPoint.x-r.right:r.left-n.segments[1]._endPoint.x,n.sourcePoint=e=="left"?r.middleLeft:r.middleRight,h=Math.abs(n.sourcePoint.x-n.segments[0]._startPoint.x),c=Math.abs(n.sourcePoint.y-n.segments[0]._endPoint.y)):((n.segments[0].length||n.segments[0].length==0)&&(o=i._endPoint.x-r.bottomCenter.x,n.segments[0].direction=n.segments[0]._direction=o>=0?"right":"left",n.segments[0].length=n.segments[0]._length=Math.abs(o)),l=e=="bottom"?n.segments[1]._endPoint.y-r.bottom:r.top-n.segments[1]._endPoint.y,n.sourcePoint=e=="top"?r.topCenter:r.bottomCenter,h=Math.abs(n.sourcePoint.y-n.segments[0]._startPoint.y),c=Math.abs(n.sourcePoint.x-n.segments[0]._endPoint.x));n.segments[1]&&(n.segments[1].length||n.segments[1].length===0)&&(n.segments[1]._length=n.segments[1].length=l-25,n.segments[1]._length<0&&(n.segments.splice(0,2),(n.segments[0].length||n.segments[0].length===0)&&(n.segments[0].length=n.segments[0]._length=h),s=t.datavisualization.Diagram.Segment({type:"orthogonal",length:c,direction:e})));s||(s=t.datavisualization.Diagram.Segment({type:"orthogonal",length:25,direction:e}));a=[s];s._isInternal=!0;n.segments=a.concat(n.segments);n.sourcePoint=this._findIntersection(u,r,n,n.sourcePoint,r.center,f)||n.sourcePoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);this._setLineEndPoint(n,n.sourcePoint,f)},_dockNodeToPoint:function(n,t,i,r){var l,u,a,f,o,e,s,v,y,k,h;if(l=r?n.segments[n.segments.length-1]:n.segments[0],l.type!="orthogonal")u=this.bounds(i),this._swapBounds(i,u),this._setLineEndPoint(n,u.center,r),this._dockBounds(n,i,u,r);else{if(u=this.bounds(i),this._swapBounds(i,u),s=t,n.segments.length>1){var c=n.segments[n.segments.length-2],d=Math.abs(s.x-u.left),p=Math.abs(s.x-u.right),w=Math.abs(s.y-u.top),b=Math.abs(s.y-u.bottom);c&&r&&(v=c.direction=="left"||c.direction=="right",y=c.direction=="top"||c.direction=="bottom");l=r?n.segments[n.segments.length-1]:n.segments[0];l.points.length!=2&&c||l.type!="orthogonal"||(v=y=!1);u.bottom<s.y&&!v?(o="bottom",e="top",f=u.bottomCenter):u.y>s.y&&!v?(o="top",e="bottom",f=u.topCenter):u.right<s.x&&!y?(o="right",e="left",f=u.middleRight):u.x>s.x&&!y?(o="left",e="right",f=u.middleLeft):(h=d,f=u.middleLeft,o="left",e="right",h>=p&&p!=0&&(f=u.middleRight,o="right",e="left",h=p),h>w&&w!=0&&(f=u.topCenter,o="top",e="bottom",h=w),h>b&&b!=0&&(f=u.bottomCenter,o="bottom",e="top",h=b))}else{f=u.center;o=this._getBezierDirection(t,f);switch(o){case"left":e="right";break;case"right":e="left";break;case"top":e="bottom";break;case"bottom":e="top"}}f&&(r||n.segments.length==1?(a=n.segments[n.segments.length-1],a.type=="orthogonal"&&(a._direction=r?o:e)):a=n.segments[0],k=this._findEndPoint(o,f,i)||u.center,f=this._findIntersection(i,u,n,f,k,r)||f,r?n.targetPoint=f:n.sourcePoint=f,n.segments.length!=1&&this._addOrthogonalPoints(a,r?n.segments[n.segments.length-2]:null,r?null:n.segments[1],n.sourcePoint,n.targetPoint),this._setLineEndPoint(n,f,r))}},_getDockSegment:function(n,i,r,u,f,e){var o=this._getEdges(r,u),e="",s,h,c=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint);return(h=f?t.datavisualization.Diagram.LineSegment(i.points[i.points.length-2],i.points[i.points.length-1]):c>5?t.datavisualization.Diagram.LineSegment(i._startPoint,i._endPoint):t.datavisualization.Diagram.LineSegment(i._startPoint,n.segments[1]?n.segments[1]._endPoint:n.targetPoint),t.datavisualization.Diagram.Geometry.intersectSegment(h,o.left)?(s=o.left,e="left"):t.datavisualization.Diagram.Geometry.intersectSegment(h,o.top)?(s=o.top,e="top"):t.datavisualization.Diagram.Geometry.intersectSegment(h,o.right)?(s=o.right,e="right"):t.datavisualization.Diagram.Geometry.intersectSegment(h,o.bottom)&&(s=o.bottom,e="bottom"),e=this._swapDirection(r,e),s)?{dockPoint:t.datavisualization.Diagram.Geometry.midPoint(s),direction:e}:null},_dockBounds:function(n,t,i,r){var u,f,e,o;u=r?n.segments[n.segments.length-1]:n.segments[0];f=u._startPoint;e=u._endPoint||u.point;u.type=="bezier"&&(u.point1||u.point2)&&(r?f=u._point2:e=u._point1);o=this._findIntersection(t,i,n,f,e,r);o&&(this._setLineEndPoint(n,o,r),u.type==="bezier"&&this._updateBezierPoints(u))},_findIntersection:function(n,i,r,u,f,e){var o,v,l=e?r.segments[r.segments.length-1]:r.segments[0],s=n.connectorPadding,y,w,b,c,h,k,d,a,g,p,nt;if(s+=e?r.targetPadding:r.sourcePadding,l.type=="orthogonal"&&(u={x:u.x,y:u.y},u.x==f.x&&(u.y<f.y?u.y-=s+5:u.y+=s+5),u.y==f.y&&(u.x<f.x?u.x-=s+5:u.x+=s+5)),w=e||l.type=="orthogonal"?u:f,l.type!="orthogonal"&&(e?(y=t.datavisualization.Diagram.Geometry.findAngle(u,f),f=t.datavisualization.Diagram.Geometry.transform({x:f.x,y:f.y},y,Math.max(n.width/2,n.height/2))):(y=t.datavisualization.Diagram.Geometry.findAngle(f,u),u=t.datavisualization.Diagram.Geometry.transform({x:u.x,y:u.y},y,Math.max(n.width/2,n.height/2)))),n._shape==="ellipse")return p=t.datavisualization.Diagram.LineSegment(u,f),this._getEllipseIntersectCoords(n,p,r,w,e);if(n._shape!=="polygon"||n.type=="bpmn"&&l.type=="orthogonal")n._shape!=="path"||n.type=="bpmn"&&l.type=="orthogonal"?((n.connectorPadding||r.sourcePadding||r.targetPadding)&&(g=t.datavisualization.Diagram.Rectangle(i.x-s,i.y-s,n.width+2*s,n.height+2*s),i=this.bounds(g)),o=i.points,o[o.length]=o[0],v=i.points.length):(n._segmentPoints||(a=this._findSegmentPoints(n,r,e)),o=a||n._segmentPoints,n.pathData.split("m").length-1+(n.pathData.split("M").length-1)==1&&(o[o.length]=o[0]),v=o.length);else{for(o=[],o=n._segmentPoints?n._segmentPoints:this._findSegmentPoints(n,r,e),n.rotateAngle&&(b=t.Matrix.identity(),t.Matrix.rotate(b,n.rotateAngle,n.offsetX,n.offsetY)),v=o.length,a=[],c=0;c<v;c++)h=t.datavisualization.Diagram.Point(o[c].x+(n.offsetX-n.width*n.pivot.x),o[c].y+(n.offsetY-n.height*n.pivot.y)),n.rotateAngle!=0&&(h=t.Matrix.transform(b,h)),(n.connectorPadding||r.sourcePadding||r.targetPadding)&&(k=n.offsetX==h.x?0:n.offsetX<h.x?1:-1,d=n.offsetY==h.y?0:n.offsetY<h.y?1:-1,h=s?t.datavisualization.Diagram.Geometry.translate(h,k*s,d*s):h),a[c]=h;o=a}return p=t.datavisualization.Diagram.LineSegment(u,f),nt=this._getIntersectionPoints(p,o,!0,w),nt},_getIntersectionPoints:function(n,i,r,u){var e,l=i.length,h=t.datavisualization.Diagram.LineSegment(i[0],i[1]),o=t.datavisualization.Diagram.Geometry.intersectSegment(n,h),f,s,c;if(o){if(!r)return o;f=t.datavisualization.Diagram.Geometry.distance(o,u)}if(isNaN(f)||f>0)for(e=1;e<l-1;e++)if(h=t.datavisualization.Diagram.LineSegment(i[e],i[e+1]),s=t.datavisualization.Diagram.Geometry.intersectSegment(n,h),s){if(!r)return s;if(c=t.datavisualization.Diagram.Geometry.distance(s,u),(isNaN(f)||f>c)&&(f=c,o=s),f>=0&&f<=1)break}return o},_findSegmentPoints:function(n,i,r){var e=[],o,f,y,u,l,a,p,v,h,c,w,s;if(n._shape=="path"){for(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("xlink","http://www.w3.org/1999/xlink"),document.body.appendChild(o),f=document.createElementNS("http://www.w3.org/2000/svg","path"),f.setAttributeNS(null,"d",n._absolutePath||n.pathData),o.appendChild(f),y=!n._absoluteBounds||n._scaled||n._absolutePath?f.getBBox():n._absoluteBounds,u=n.connectorPadding,i&&(u+=r?i.targetPadding:i.sourcePadding),u||!n._absolutePath||n._scaled?(l=t.datavisualization.Diagram.Geometry.updatePath(-u,-u,n.width+2*u,n.height+2*u,n._absolutePath||n.pathData,null,y,u?null:n),f.setAttributeNS(null,"d",l),(!n._scaled||u)&&n._absolutePath||(n._absolutePath=l,n._scaled=!1)):f.setAttributeNS(null,"d",n._absolutePath),a=t.Matrix.identity(),t.Matrix.rotate(a,n.rotateAngle,n.offsetX,n.offsetY),p=f.getTotalLength(),h=0;h<=p;h+=10)v=f.getPointAtLength(h),c={x:n.offsetX-n.width*n.pivot.x+v.x,y:n.offsetY-n.height*n.pivot.y+v.y},n.rotateAngle!=0&&(c=t.Matrix.transform(a,c)),e.push(c);document.body.removeChild(o)}else if(n._shape=="polygon"){for(w=n.points.length,s=0;s<w;s++)e[s]=n.points[s];t.datavisualization.Diagram.Geometry.updatePolygonPoints(n,e);e[e.length]=e[0]}else return null;return e},_getEdges:function(n,i){var u=i.points,r={},e=n%360,f;return r.left=t.datavisualization.Diagram.LineSegment(u[3],u[0]),r.top=t.datavisualization.Diagram.LineSegment(u[0],u[1]),r.right=t.datavisualization.Diagram.LineSegment(u[1],u[2]),r.bottom=t.datavisualization.Diagram.LineSegment(u[2],u[3]),e<0&&(e+=360),e>315||e<45||(e<135?(f=r.top,r.top=r.left,r.left=r.bottom,r.bottom=r.right,r.right=f):e<225?(f=r.top,r.top=r.bottom,r.bottom=f,f=r.left,r.left=r.right,r.right=f):(f=r.bottom,r.bottom=r.left,r.left=r.top,r.top=r.right,r.right=f)),r},_pointsFromNodeToPoint:function(n,t,i,r,u,f,e,o){var h=o?n._tarDecoratorSize:n._srcDecoratorSize,s=[],a,c,l;s.push(f);a=f.y==e.y&&(i=="left"&&e.x<f.x||i=="right"&&e.x>f.x)||f.x==e.x&&(i=="top"&&e.y<f.y||i=="bottom"&&e.y>f.y);a||(i=="top"||i=="bottom"?i=="top"&&e.y<f.y&&e.y>f.y-h||i=="bottom"&&e.y>f.y&&e.y<f.y+h?(c=i=="top"?r.top-h:r.bottom+h,s.push({x:f.x,y:c}),s.push({x:f.x+(e.x-f.x)/2,y:c}),s.push({x:f.x+(e.x-f.x)/2,y:e.y})):Math.abs(f.x-e.x)>h&&(i=="top"&&e.y<f.y||i=="bottom"&&e.y>f.y)?s.push({x:f.x,y:e.y}):Math.abs(f.x-e.x)<=h||(e.x<r.left||e.x>r.right)&&e.y!=f.y?(c=i=="top"?r.top-h:r.bottom+h,s.push({x:f.x,y:c}),s.push({x:e.x,y:c})):(c=i=="top"?r.top-h:r.bottom+h,l=e.x<f.x?r.left-h:r.right+h,s.push({x:f.x,y:c}),s.push({x:l,y:c}),s.push({x:l,y:e.y})):i=="left"&&e.x<f.x&&e.x>f.x-h||i=="right"&&e.x>f.x&&e.x<f.x+h?(l=i=="left"?r.left-h:r.right+h,s.push({x:l,y:f.y}),s.push({x:l,y:f.y+(e.y-f.y)/2}),s.push({x:e.x,y:f.y+(e.y-f.y)/2})):Math.abs(f.y-e.y)>h&&(i=="left"&&e.x<f.x||i=="right"&&e.x>f.x)?s.push({x:e.x,y:f.y}):Math.abs(f.y-e.y)<=h||(e.y<r.top||e.y>r.bottom)&&e.x!=f.x?(l=i=="left"?r.left-h:r.right+h,s.push({x:l,y:f.y}),s.push({x:l,y:e.y})):(c=e.y<f.y?r.top-h:r.bottom+h,l=i=="left"?r.left-h:r.right+h,s.push({x:l,y:f.y}),s.push({x:l,y:c}),s.push({x:e.x,y:c})));s.push(e);o&&s.reverse();t._startPoint=s[0];t._endPoint=s[s.length-1];t.points=s;t.direction&&(t.direction=="left"||t.direction=="right"?(t.length=t._length=Math.abs(t._startPoint.x-t._endPoint.x),t._direction=t._startPoint.x<t._endPoint.x?t.direction="right":t.direction="left"):(t.length=t._length=Math.abs(t._startPoint.y-t._endPoint.y),t._direction=t._startPoint.y<t._endPoint.y?t.direction="bottom":t.direction="top"))},_constructSegements:function(n,t,i,r,u,f,e,o){var s,l,h,c;for(o==="right"&&(u==="left"?s=this._rightToLeft(n,t,i,r,f,e,!1):u==="right"?s=this._rightToRight(n,i,r,f,e):u==="top"?s=this._rightToTop(n,i,r,f,e,!1):u==="bottom"&&(s=this._rightToBottom(n,i,r,f,e,!1))),o==="left"&&(u==="right"&&(s=this._rightToLeft(n,t,f,e,i,r,!0),l=!0),u==="left"&&(s=this._leftToLeft(n,i,r,f,e)),u==="top"&&(s=this._leftToTop(n,i,r,f,e,!1)),u==="bottom"&&(s=this._leftToBottom(n,i,r,f,e,!1))),o==="top"&&(u==="left"&&(s=this._leftToTop(n,f,e,i,r,!0),l=!0),u==="right"&&(s=this._rightToTop(n,f,e,i,r,!0),l=!0),u==="top"&&(s=this._topToTop(n,i,r,f,e)),u==="bottom"&&(s=this._topToBottom(n,t,i,r,f,e,!1))),o==="bottom"&&(u==="left"&&(s=this._leftToBottom(n,f,e,i,r,!0),l=!0),u==="right"&&(s=this._rightToBottom(n,f,e,i,r,!0),l=!0),u==="top"&&(s=this._topToBottom(n,t,f,e,i,r,!0),l=!0),u==="bottom"&&(s=this._bottomToBottom(n,i,r,f,e))),l&&s.reverse(),h=s[s.length-1],c=s[s.length-2];s.length>2&&h.x==c.x&&h.y==c.y;)s.splice(s.length-1,1),h=s[s.length-1],c=s[s.length-2];for(h=s[0],c=s[1];s.length>2&&h.x==c.x&&h.y==c.y;)s.splice(0,1),h=s[0],c=s[1];t._startPoint=s[0];t._endPoint=s[s.length-1];t.points=s},_updateIntermediateSegments:function(n){var u=n.segments[0]._endPoint,r=n.segments[0],f=r.points.length,i;n.segments[1]&&(i=n.segments[1],i._startPoint=u,i.type=="orthogonal"&&(i.length||i.length===0)?(i.direction=="left"||i.direction=="right"?(n.segments[2]&&(n.segments[2].length||n.segments[2].length===0)&&(n.segments[2].direction=="top"?n.segments[2].length+=i._startPoint.y-i._endPoint.y:n.segments[2].length-=i._startPoint.y-i._endPoint.y,n.segments[2].length<0&&(n.segments[2].length*=-1,n.segments[2].direction=n.segments[2]._direction=n.segments[2]._direction=="bottom"?"top":"bottom"),n.segments[2]._length=n.segments[2].length),i._endPoint.y=i._startPoint.y):(n.segments[2]&&(n.segments[2].length||n.segments[2].length===0)&&(n.segments[2].direction=="left"?n.segments[2].length+=i._startPoint.x-i._endPoint.x:n.segments[2].length-=i._startPoint.x-i._endPoint.x,n.segments[2].length<0&&(n.segments[2].length*=-1,n.segments[2].direction=n.segments[2]._direction=n.segments[2]._direction=="right"?"left":"right"),n.segments[2]._length=n.segments[2].length),i._endPoint.x=i._startPoint.x),n.sourcePort&&r.points.length>2&&(i.direction=="left"||i.direction=="right"?r.points[r.points.length-1].y==r.points[r.points.length-2].y&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1],i.points.length==2&&(i._endPoint.y=i._startPoint.y)):r.points[r.points.length-1].x==r.points[r.points.length-2].x&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1],i.points.length==2&&(i._endPoint.x=i._startPoint.x))),(i.length||i.length===0)&&(i.length=i._length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i.points[1])),i.length>0&&(i.direction=i._direction=this._getBezierDirection(i._startPoint,i._endPoint)||i._direction),this._addOrthogonalPoints(i,r,n.segments[2],n.sourcePoint,n.targetPoint),n.segments[2]&&this._addOrthogonalPoints(n.segments[2],n.segments[1],n.segments[3],n.sourcePoint,n.targetPoint)):i.type=="orthogonal"&&i.length===null?(n.sourcePort&&r.points.length>2&&(i._direction=="left"||i._direction=="right"?r.points[r.points.length-1].y==r.points[r.points.length-2].y&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1]):r.points[r.points.length-1].x==r.points[r.points.length-2].x&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1])),i._startPoint=i.points[0]=n.segments[0]._endPoint,this._addOrthogonalPoints(n.segments[1],n.segments[0],null,n.sourcePoint,n.targetPoint)):(i._startPoint=i.points[0]=n.segments[0]._endPoint,i.type=="bezier"&&this._updateBezierPoints(i)))},_updatePreviousSegment:function(n){var i=n.segments[n.segments.length-2],r=n.segments[n.segments.length-1],u,f,e;i&&(i.type=="orthogonal"&&r.points.length>2&&(u=!1,f=i.points.length==2?i.direction:t.datavisualization.Diagram.Util._getBezierDirection(i.points[i.points.length-2],i.points[i.points.length-1]),f=="left"||f=="right"?r.points[0].y==r.points[1].y&&(u=!0,e=r.points[1].x-r.points[0].x,r.points.splice(0,1),r._startPoint=r.points[0],i._endPoint=r.points[0]):r.points[0].x==r.points[1].x&&(u=!0,r.points.splice(0,1),r._startPoint=r.points[0],i._endPoint=r.points[0])),i._endPoint=r._startPoint,i.points[i.points.length-1]=r._startPoint,i.type=="orthogonal"&&u?(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i._length>0&&(i._direction=i.direction=this._getBezierDirection(i._startPoint,i._endPoint)),(n.segments.length>2||!n.sourcePort)&&this._addOrthogonalPoints(i,n.segments[n.segments.length-3],r,n.sourcePoint,n.targetPoint)):i.point=r._startPoint)},_initConnectionEnds:function(n,i){var u,r,e,o,f;if(n.segments&&n.segments[0]&&n.segments[0].type=="orthogonal"&&n.segments[0].length){if(n.sourceNode&&(e=i.nameTable[n.sourceNode],e))if(r=t.datavisualization.Diagram.Util.bounds(e,!0),n.sourcePort)u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.sourceNode],n.sourcePort),n.sourcePoint=t.datavisualization.Diagram.Util._getPortPosition(u,r);else{f=n.segments[0];switch(f.direction){case"left":n.sourcePoint=r.middleLeft;break;case"right":n.sourcePoint=r.middleRight;break;case"top":n.sourcePoint=r.topCenter;break;case"bottom":n.sourcePoint=r.bottomCenter}}if(n.targetNode&&(o=i.nameTable[n.targetNode],o))if(r=t.datavisualization.Diagram.Util.bounds(o,!0),n.targetPort)u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.targetNode],n.targetPort),n.targetPoint=t.datavisualization.Diagram.Util._getPortPosition(u,r);else{f=n.segments[0];switch(f.direction){case"left":n.targetPoint=r.middleLeft;break;case"right":n.targetPoint=r.middleRight;break;case"top":n.targetPoint=r.topCenter;break;case"bottom":n.targetPoint=r.bottomCenter}}}else n.sourceNode&&(r=t.datavisualization.Diagram.Util.bounds(i.nameTable[n.sourceNode],!0),n.sourcePort?(u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.sourceNode],n.sourcePort),n.sourcePoint=t.datavisualization.Diagram.Util._getPortPosition(u,r)):n.sourcePoint=r.center),n.targetNode&&(r=t.datavisualization.Diagram.Util.bounds(i.nameTable[n.targetNode],!0),n.targetPort?(u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.targetNode],n.targetPort),n.targetPoint=t.datavisualization.Diagram.Util._getPortPosition(u,r)):n.targetPoint=r.center)},_swapDirection:function(n,t){var u,i=n%360,r;return i<0&&(i+=360),i>315||i<45?u=t:i<135?(r={left:"top",top:"right",right:"bottom",bottom:"left"},u=r[t]):i<225?(r={left:"right",top:"bottom",right:"left",bottom:"top"},u=r[t]):(r={left:"bottom",top:"left",right:"top",bottom:"right"},u=r[t]),u},_getEllipseIntersectCoords:function(n,i,r,u,f){var a=[],o=n.connectorPadding,w,s,c,e,h,l;r&&(o+=f?r.targetPadding:r.sourcePadding);o||(o=0);var v=n.width/2,y=n.height/2,p=t.Matrix.identity();for(t.Matrix.rotate(p,n.rotateAngle,n.offsetX,n.offsetY),w="M "+(n.offsetX-n.width*n.pivot.x-o)+", "+n.offsetY+" A "+v+" "+y+" 0 0 1 "+(n.offsetX+n.width*(1-n.pivot.x)+o)+", "+n.offsetY+" A "+v+" "+y+" 0 0 1 "+(n.offsetX-n.width*n.pivot.x-o)+", "+n.offsetY+"z",s=document.createElementNS("http://www.w3.org/2000/svg","path"),s.setAttributeNS(null,"d",w),c=s.getTotalLength(),e=[],h=0;h<c;h=h+3)l=s.getPointAtLength(h),n.rotateAngle!=0&&(l=t.Matrix.transform(p,l)),e[e.length]=l;return e[e.length-1]!=s.getPointAtLength(c)&&(e[e.length]=s.getPointAtLength(c)),a=e,this._getIntersectionPoints(i,a,!0,u)},_rightToLeft:function(n,i,r,u,f,e,o){var c=[],h,s,a,l,v;return c.push(e),a=n._srcDecoratorSize,l=n._tarDecoratorSize,o&&(l=n._srcDecoratorSize,a=n._tarDecoratorSize),f.width==0&&(a=0),r.width==0&&(l=0),v=a+l,u.x>e.x?e.y!=u.y&&(e.x>r.left?(h=f.right+a,s=e.y,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y>f.top?u.y:r.bottom+l,c.push(t.datavisualization.Diagram.Point(h,s)),u.y<=f.top&&(h=r.right+l,c.push(t.datavisualization.Diagram.Point(h,s)),s=r.top-l,c.push(t.datavisualization.Diagram.Point(h,s)),h=r.left-l,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y,c.push(t.datavisualization.Diagram.Point(h,s)))):(h=i.direction||i.length==undefined?r.left-f.right>0?f.right+(r.left-f.right)/2:f.right+a:f.right+i.length,s=e.y,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y,c.push(t.datavisualization.Diagram.Point(h,s)))):(Math.abs(r.top-f.bottom)<v||Math.abs(r.bottom-f.top)<v?e.x>r.right?(h=e.x+a,s=e.y):(h=r.right+l,s=e.y):(h=f.right+a,s=e.y),c.push(t.datavisualization.Diagram.Point(h,s)),r.top-f.bottom>=v?(s=r.top-l,c.push(t.datavisualization.Diagram.Point(h,s))):e.y>u.y?(s=f.top-r.bottom<v?r.left>f.right?r.bottom+(f.top-r.bottom)/2:Math.min(r.top-l,f.top-a):r.bottom+l,c.push(t.datavisualization.Diagram.Point(h,s))):(s=r.left>f.right?r.bottom+(f.top-r.bottom)/2:Math.max(r.bottom+l,f.bottom+a),c.push(t.datavisualization.Diagram.Point(h,s))),h=r.left-l,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y,c.push(t.datavisualization.Diagram.Point(h,s))),c.push(u),c},_rightToRight:function(n,i,r,u,f){var s=[],e,o,c,h;return s.push(f),o=f.y,c=n._srcDecoratorSize,h=n._tarDecoratorSize,u.width==0&&(c=0),i.width==0&&(h=0),i.right>=u.left?f.y>=i.top-h&&f.y<=i.bottom+h?(e=f.x+c,s.push(t.datavisualization.Diagram.Point(e,o)),f.y>=i.center.y?(o=f.x>i.left?f.y>r.y?i.bottom+h:i.top-h:i.top-h,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o))):(o=i.bottom+h,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o)))):i.right<u.right?(e=u.right+c,s.push(t.datavisualization.Diagram.Point(e,o))):(e=r.x+h,s.push(t.datavisualization.Diagram.Point(e,o))):(e=f.x+c,s.push(t.datavisualization.Diagram.Point(e,o)),r.y>=u.top-c&&r.y<=u.bottom+c&&(r.y<=u.center.y?(o=u.top-c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o))):(o=u.bottom+c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o))))),s.push(t.datavisualization.Diagram.Point(e,r.y)),s.push(r),s},_rightToTop:function(n,i,r,u,f,e){var h=[],c,o,s,l,a;return h.push(f),o=f.y,s=n._srcDecoratorSize,l=n._tarDecoratorSize,e&&(l=n._srcDecoratorSize,s=n._tarDecoratorSize),u.width==0&&(s=0),i.width==0&&(l=0),a=s+l,r.x>=f.x+s?f.y+s>=r.y&&i.height!==0&&(c=i.left<=u.right?i.right+l:i.left-u.right>a?u.right+s:u.right+(i.left-u.right)/2,h.push(t.datavisualization.Diagram.Point(c,o)),o=i.top-l,h.push(t.datavisualization.Diagram.Point(c,o))):u.bottom+s>i.top-l?(c=f.x+s<=i.right?i.right+l:u.right+s,h.push(t.datavisualization.Diagram.Point(c,o)),o=u.top>=i.top?i.height!==0?i.top-l:r.y:u.top>=i.top-l?i.top-l-s:u.top-s,h.push(t.datavisualization.Diagram.Point(c,o))):(c=f.x+s,h.push(t.datavisualization.Diagram.Point(c,o)),i.top-u.bottom<a&&i.height!==0?u.left-i.right>=a?(o=u.bottom+s,h.push(t.datavisualization.Diagram.Point(c,o)),c=u.left-s,h.push(t.datavisualization.Diagram.Point(c,o)),o=i.top-l,h.push(t.datavisualization.Diagram.Point(c,o))):(o=i.top-(i.top-u.bottom)/2,h.push(t.datavisualization.Diagram.Point(c,o))):(o=i.height!==0?i.top-l:r.y,h.push(t.datavisualization.Diagram.Point(c,o)))),h.push(t.datavisualization.Diagram.Point(r.x,o)),h.push(r),h},_rightToBottom:function(n,i,r,u,f,e){var h=[],s,o,c,l,a;return h.push(f),o=f.y,c=n._srcDecoratorSize,l=n._tarDecoratorSize,e&&(l=n._srcDecoratorSize,c=n._tarDecoratorSize),u.width==0&&(c=0),i.width==0&&(l=0),a=c+l,r.x>=f.x?f.y<=i.bottom+l?i.left>u.right+c?(s=f.x+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=i.bottom+l,h.push(t.datavisualization.Diagram.Point(s,o))):(s=i.right+l,h.push(t.datavisualization.Diagram.Point(s,o)),o=i.bottom+l,h.push(t.datavisualization.Diagram.Point(s,o))):u.right+c>r.x?(s=f.x+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=u.top-i.bottom>a?i.bottom+l:i.bottom+(u.top-i.bottom)/2,h.push(t.datavisualization.Diagram.Point(s,o))):o=f.y:f.y<=i.bottom?(s=u.right+c>i.right?u.right+c:i.right+l,h.push(t.datavisualization.Diagram.Point(s,o)),o=i.bottom+l,o<=u.bottom+c&&(o=u.bottom+c),h.push(t.datavisualization.Diagram.Point(s,o))):i.bottom+l<u.top-c?(s=u.right+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=u.top-i.bottom<a?i.bottom+(u.top-i.bottom)/2:i.bottom+l,h.push(t.datavisualization.Diagram.Point(s,o))):(s=u.right+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=u.bottom+c,h.push(t.datavisualization.Diagram.Point(s,o))),h.push(t.datavisualization.Diagram.Point(r.x,o)),h.push(r),h},_leftToLeft:function(n,i,r,u,f){var s=[],e,o,c,h,l;return s.push(f),o=f.y,c=n._srcDecoratorSize,h=n._tarDecoratorSize,u.width==0&&(c=0),i.width==0&&(h=0),l=c+h,r.x-h>=f.x-c?(e=u.left-c,s.push(t.datavisualization.Diagram.Point(e,o)),f.y>r.y?r.y+h>=u.top?(o=u.top-c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.left-u.right>l?i.left-h:u.right+(i.left-u.right)/2,s.push(t.datavisualization.Diagram.Point(e,o))):(o=r.y,s.push(t.datavisualization.Diagram.Point(e,o)),e=r.x):u.bottom+c<r.y?(o=r.y,s.push(t.datavisualization.Diagram.Point(e,o)),e=r.x):(o=u.bottom+c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.left-u.right>l?i.left-h:u.right+(i.left-u.right)/2,s.push(t.datavisualization.Diagram.Point(e,o)))):(r.y>f.y?f.y>i.top-h&&(e=u.left-i.right<l?i.right+(u.left-i.right)/2:u.left-c,s.push(t.datavisualization.Diagram.Point(e,o)),o=i.top-h,s.push(t.datavisualization.Diagram.Point(e,o))):i.bottom+h>=f.y&&(e=u.left-i.right<l?i.right+(u.left-i.right)/2:u.left-c,s.push(t.datavisualization.Diagram.Point(e,o)),o=i.bottom+h,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.left-h,s.push(t.datavisualization.Diagram.Point(e,o))),e=i.left-h,s.push(t.datavisualization.Diagram.Point(e,o))),s.push(t.datavisualization.Diagram.Point(e,r.y)),s.push(r),s},_leftToTop:function(n,i,r,u,f,e){var h=[],l,c,o,s;return h.push(f),c=f.y,o=n._srcDecoratorSize,s=n._tarDecoratorSize,e&&(s=n._srcDecoratorSize,o=n._tarDecoratorSize),u.width==0&&(o=0),i.width==0&&(s=0),f.x<=r.x?(l=f.y>r.y&&i.left<=u.left?i.left-s:u.left-o,h.push(t.datavisualization.Diagram.Point(l,c)),c=u.bottom<=i.top?u.bottom+o<i.top-s?i.height!==0?i.top-s:r.y:r.x<u.right?u.bottom+(i.top-u.bottom)/2:u.top-o:u.top-o>=i.top-s?i.height!==0?i.top-s:r.y:u.top-o,h.push(t.datavisualization.Diagram.Point(l,c))):r.y<=f.y+o&&(l=u.left-o>i.right+s?u.left-o:i.right+s>=u.left-o?i.left-s:i.right+(u.left-i.right)/2,h.push(t.datavisualization.Diagram.Point(l,c)),c=i.top-s,h.push(t.datavisualization.Diagram.Point(l,c))),h.push(t.datavisualization.Diagram.Point(r.x,c)),h.push(r),h},_leftToBottom:function(n,i,r,u,f,e){var c=[],l,o,s,h,a;return c.push(f),o=f.y,s=n._srcDecoratorSize,h=n._tarDecoratorSize,e&&(h=n._srcDecoratorSize,s=n._tarDecoratorSize),u.width==0&&(s=0),i.width==0&&(h=0),a=s+h,f.x-s<=r.x?(l=i.left<=f.x&&f.y<=i.top?i.left-h:u.left-s,c.push(t.datavisualization.Diagram.Point(l,o)),i.bottom+h<u.top-s?(o=u.top-i.bottom<a?i.bottom+(u.top-i.bottom)/2:i.bottom+h,c.push(t.datavisualization.Diagram.Point(l,o))):(o=i.bottom<u.bottom?u.bottom+s:i.bottom+h,c.push(t.datavisualization.Diagram.Point(l,o)))):f.y-s>r.y||(l=i.right>=u.left?i.left-h:u.left-i.right<a?u.left-(u.left-i.right)/2:u.left-s,c.push(t.datavisualization.Diagram.Point(l,o)),o=i.bottom+h,c.push(t.datavisualization.Diagram.Point(l,o))),c.push(t.datavisualization.Diagram.Point(r.x,o)),c.push(r),c},_topToTop:function(n,i,r,u,f){var s=[],o,e,c,h,l;return s.push(f),o=f.x,c=n._srcDecoratorSize,h=n._tarDecoratorSize,u.width==0&&(c=0),i.width==0&&(h=0),l=c+h,r.x>=f.x?r.y-h>=f.y-c?(e=u.top-c,s.push(t.datavisualization.Diagram.Point(o,e)),r.x<=u.right&&(o=u.right+c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.height!==0?i.top-u.bottom>l?i.top-h:u.bottom+(i.top-u.bottom)/2:r.y,s.push(t.datavisualization.Diagram.Point(o,e)))):i.left<=f.x?(e=u.top-i.bottom>l?u.top-c:i.bottom+(u.top-i.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.left-h,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.top-h,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.height!==0?i.top-h:r.y,s.push(t.datavisualization.Diagram.Point(o,e))):r.y-h>=f.y-c?(e=u.top-c,s.push(t.datavisualization.Diagram.Point(o,e)),r.x>=u.left&&(o=u.left-c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.height!==0?i.top-u.bottom>l?i.top-h:u.bottom+(i.top-u.bottom)/2:r.y,s.push(t.datavisualization.Diagram.Point(o,e)))):i.right>=f.x?(e=u.top-i.bottom>l?u.top-c:i.bottom+(u.top-i.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.right+h,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.top-h,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.height!==0?i.top-h:r.y,s.push(t.datavisualization.Diagram.Point(o,e))),o=r.x,s.push(t.datavisualization.Diagram.Point(o,e)),s.push(r),s},_topToBottom:function(n,i,r,u,f,e,o){var h=[],c,s,l,a,v;return h.push(e),c=e.x,l=n._srcDecoratorSize,a=n._tarDecoratorSize,o&&(a=n._srcDecoratorSize,l=n._tarDecoratorSize),f.width==0&&(l=0),r.width==0&&(a=0),v=l+a,u.x>e.x?(f.top>=r.bottom?f.top-r.bottom>0?(s=i.length==undefined||i.direction?f.top-r.bottom>0?r.bottom+(f.top-r.bottom)/2:r.bottom+a:r.bottom+i.length,h.push(t.datavisualization.Diagram.Point(c,s))):(s=f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=r.left-f.right>=v?f.right+l:f.right+(r.left-f.right)/2,h.push(t.datavisualization.Diagram.Point(c,s)),s=r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))):(s=r.top<f.top?r.left>=f.right+l?f.top-l:r.top-a:f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=r.left>=f.right+l?f.right+l:r.right+a,h.push(t.datavisualization.Diagram.Point(c,s)),s=r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))),h.push(t.datavisualization.Diagram.Point(u.x,s))):u.x<e.x&&(f.top>=r.bottom?f.top-r.bottom>0?(s=i.length==undefined||i.direction?f.top-r.bottom>0?r.bottom+(f.top-r.bottom)/2:r.bottom+a:r.bottom+i.length,h.push(t.datavisualization.Diagram.Point(c,s))):(s=f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=f.left-r.right>=v?f.left-l:r.right+(f.left-r.right)/2,h.push(t.datavisualization.Diagram.Point(c,s)),s=r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))):(s=f.left-l>=r.right+a?f.top-l:f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=f.left>=r.right+a||f.right+l<r.right+a?r.right+a:f.right+l,h.push(t.datavisualization.Diagram.Point(c,s)),s=f.left>=r.right+a?r.bottom+a:r.bottom<=f.bottom?f.bottom+l:r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))),h.push(t.datavisualization.Diagram.Point(u.x,s))),h.push(u),h},_bottomToBottom:function(n,i,r,u,f){var s=[],o,e,h,c,l;return s.push(f),o=f.x,h=n._srcDecoratorSize,c=n._tarDecoratorSize,u.width==0&&(h=0),i.width==0&&(c=0),l=h+c,r.x>=f.x?u.bottom+h>=i.bottom+h?(e=u.bottom+h,s.push(t.datavisualization.Diagram.Point(o,e)),r.x<u.right&&(o=u.right+h,s.push(t.datavisualization.Diagram.Point(o,e)),e=u.top-h>=i.bottom+c?u.top-i.bottom>=l?i.bottom+c:i.bottom+(u.top-i.bottom)/2:i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e)))):f.x>i.left?(e=i.bottom-u.bottom>=l?u.bottom+h:u.bottom+(i.bottom-u.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.left-c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))):u.bottom+h>=i.bottom+h?(e=u.bottom+h,s.push(t.datavisualization.Diagram.Point(o,e)),r.x>u.left&&(o=u.left-h,s.push(t.datavisualization.Diagram.Point(o,e)),e=u.top-h>=i.bottom+c?u.top-i.bottom>=l?i.bottom+c:i.bottom+(u.top-i.bottom)/2:i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e)))):f.x<i.right?(e=i.bottom-u.bottom>=l?u.bottom+h:u.bottom+(i.bottom-u.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.right+c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))),s.push(t.datavisualization.Diagram.Point(r.x,e)),s.push(r),s},_addOrthogonalPoints:function(n,i,r,u,f,e){var v=[],o=i?i._endPoint:u,p,w,s,l,y;v.push(o);n._direction||(n._direction=this._getOrthoDirection(o,f,i));n._direction!=="auto"||i||r||(n._direction=this._getBezierDirection(o,f));var h=!e&&e!=0?this._directionToAngle(n._direction||this._getBezierDirection(o,f)):e,l=n._direction;if(l=="left"||l=="right"||l=="top"||l=="bottom")h={right:0,left:180,top:270,bottom:90,auto:90}[l];else switch(l){case"straight":h=0;break;case"clockWise90":h+=90;break;case"opposite":h+=180;break;case"antiClockWise90":h+=270}if((n.length||n.length==0)&&n.direction)s=t.datavisualization.Diagram.Geometry.transform(o,h||0,n._length),s.x=Math.round(s.x*100)/100,s.y=Math.round(s.y*100)/100,v.push(s),n._endPoint=s,r&&(r._startPoint=n._endPoint,r.points&&(r.points[0]=n._endPoint,r.type=="bezier"&&this._updateBezierPoints(r)));else{if(o.x!=f.x&&o.y!=f.y||i&&i._startPoint.x==f.x){var b=20,a=f.x-(s?s.x:o.x),c=f.y-(s?s.y:o.y);a=Math.abs(a)<=.0001?0:a;c=Math.abs(c)<=.0001?0:c;switch(h){case 0:if(f.x<o.x)break;w=Math.abs(o.x-f.x)<30;break;case 180:if(f.x>o.x)break;w=Math.abs(o.x-f.x)<30;break;case 90:if(f.y<o.y)break;w=Math.abs(o.y-f.y)<30;break;case 270:if(f.y>o.y)break;w=Math.abs(o.y-f.y)<30}i?p=i&&i._startPoint.x==f.x?3:a==0||c==0?2:3:(w?(b=h==90||h==270?Math.abs(o.y-f.y):Math.abs(o.x-f.x),p=2,b<10&&(b+=20,p=3)):p=3,(p!=2||Math.abs(c)>1&&Math.abs(a)>1)&&(s=t.datavisualization.Diagram.Geometry.transform(o,h,b)));p==3&&(l=n._direction=="auto"?i?i._direction=="left"||i.direction=="right"?"left":"top":"bottom":n._direction,l=="left"||l=="right"||c==0?(c=c>0?c:-c,y=t.datavisualization.Diagram.Geometry.transform(s||o,90,f.y-(s?s.y:o.y))):(a=a>0?a:-a,y=t.datavisualization.Diagram.Geometry.transform(s||o,0,f.x-(s?s.x:o.x))));s&&(s.x=Math.round(s.x*100)/100,s.y=Math.round(s.y*100)/100,v.push(s));y&&(y.x=Math.round(y.x*100)/100,y.y=Math.round(y.y*100)/100,v.push(y))}n._direction=this._getBezierDirection(v[v.length-1],f);v.push(f);n._endPoint=f;r&&(r._startPoint=n._endPoint,r.points||(r.points=[]),r.points[0]=n._endPoint,r.type=="bezier"&&this._updateBezierPoints(r))}return n.points=v,h},_getOrthoDirection:function(n,t,i){if(i){var r=t;return Math.abs(r.x-n.x)>Math.abs(r.y-n.y)&&i&&(i._direction=="left"||i._direction=="right")?n.x<r.x?"right":"left":n.y<r.y?"bottom":"top"}return n.y<t.y?"bottom":n.y>t.y?"top":n.x<t.x?"right":n.x>t.x?"left":void 0},_directionToAngle:function(n){return{right:0,left:180,top:270,bottom:90,auto:90}[n]},_resetOrthogonalPoints:function(n){var t=[],i;t.push(n.sourcePoint);t.push(n.targetPoint);n.points=[];n.sourcePoint=t[0];n.points.push(t[0]);i=this._constructOrthogonalPoints(t[0],t[1]);n.points.push(i[0]);n.points.push(i[1]);n.targetPoint=t[1];n.points.push(t[1])},_updateBezierPoints:function(n,i,r,u,f,e,o){var c,v={right:0,left:180,top:270,bottom:90},s,h,l,a;(n.vector1||n.vector2)&&(n.vector1&&(n._point1=t.datavisualization.Diagram.Geometry.transform(n._startPoint,n.vector1.angle,n.vector1.distance)),n.vector2&&(n._point2=t.datavisualization.Diagram.Geometry.transform(n._endPoint,n.vector2.angle,n.vector2.distance)));(n.point1!=null||n.vector1)&&(n.point2!=null||n.vector2)||(s=n._endPoint,h=n._startPoint,e?(c=o,h=this._getPortPosition(e,c),f.rotateAngle!==0&&(a=t.Matrix.identity(),t.Matrix.rotate(a,f.rotateAngle,f.offsetX,f.offsetY),h=t.Matrix.transform(a,h)),l=this._getDirection(c,h,!0)):l=this._getBezierDirection(h,s),n.vector1||(n._point1=n.point1||this._getBezierAdjPoint(v[l],n._startPoint,n._endPoint)),r?(c=u,s=this._getPortPosition(r,c),i.rotateAngle!==0&&(a=t.Matrix.identity(),t.Matrix.rotate(a,i.rotateAngle,i.offsetX,i.offsetY),s=t.Matrix.transform(a,s)),l=this._getDirection(c,s,!0)):l=this._getBezierDirection(s,h),n.vector2||(n._point2=n.point2||this._getBezierAdjPoint(v[l],n._endPoint,n._startPoint)))},_getBezierDirection:function(n,t){return Math.abs(t.x-n.x)>Math.abs(t.y-n.y)?n.x<t.x?"right":"left":n.y<t.y?"bottom":"top"},_findDocAngle:function(n,t){var r={x:t.x,y:n.y},e=this.findLength(n,r),u=this.findLength(r,t),f=this.findLength(t,n),i=Math.asin(u/f);return i=i*180/Math.PI,n.x<t.x?n.y<t.y||(i=360-i):i=n.y<t.y?180-i:180+i,i},_getDirection:function(n,i,r){var e=n.center,h,f,o,c,s,u,a,l;return r?(a=n.points,l=r?45:180/(2+2/(n.height/n.width)),h=l,f=180-l,o=f+2*l,c=360-l,u=t.datavisualization.Diagram.Geometry.findAngle(i,e),s=u>h&&u<f?"top":u>f&&u<o?"right":u>o&&u<c?"bottom":"left"):(u=this._findDocAngle(e,i),h=this._findDocAngle(e,n.bottomRight),f=this._findDocAngle(e,n.bottomLeft),o=this._findDocAngle(e,n.topLeft),c=this._findDocAngle(e,n.topRight),u>o&&u<c?s="top":u>=h&&u<f?s="bottom":u>=f&&u<=o?s="left":(u>=c||u<h)&&(s="right")),s},_getBezierAdjPoint:function(n,i,r){var u=60,f=t.datavisualization.Diagram.Point(0,0),e=n>45&&n<135?"Bottom":n>135&&n<225?"Left":n>225&&n<315?"Top":"Right";switch(e){case"Right":u=Math.min(Math.abs(i.x-r.x)*.45,u);f=t.datavisualization.Diagram.Point(i.x+u,i.y);break;case"Bottom":u=Math.min(Math.abs(i.y-r.y)*.45,u);f=t.datavisualization.Diagram.Point(i.x,i.y+u);break;case"Left":u=Math.min(Math.abs(i.x-r.x)*.45,u);f=t.datavisualization.Diagram.Point(i.x-u,i.y);break;case"Top":u=Math.min(Math.abs(i.y-r.y)*.45,u);f=t.datavisualization.Diagram.Point(i.x,i.y-u)}return f},_setLineEndPoint:function(n,t,i){var o=n,u,r,e,f;t.x=Math.round(t.x*100)/100;t.y=Math.round(t.y*100)/100;i?(u=n.segments[n.segments.length-1],o.targetPoint=t,u.type!="orthogonal"&&(u.point&&(u.point=t),u._point=t),u.points[u.points.length-1]=t,u._endPoint=t):(o.sourcePoint=t,r=n.segments[0],r.points[0]=t,r._startPoint=t,r.type!="orthogonal"||n.sourcePort||n._staticLength||(r.length||r.length===0)&&r.direction&&r.points.length==2&&(r._direction=="left"||r._direction=="right"?(r._endPoint.y=r._startPoint.y,e=Math.abs(r._startPoint.x-r._endPoint.x)):(r._endPoint.x=r._startPoint.x,e=Math.abs(r._startPoint.y-r._endPoint.y)),n.segments[0]._length=e,n.segments[0].length=n.segments[0]._length,n.segments[0].direction=n.segments[0]._direction));f=i?n.segments[n.segments.length-1]:n.segments[0];f.type!=="orthogonal"||(i||n.sourcePort)&&(!i||n.targetPort)||n.sourceNode&&n.targetNode&&!(n.segments.length>1)?f.type==="bezier"&&this._updateBezierPoints(f):(f.points=[],this._addOrthogonalPoints(f,i?n.segments[n.segments.length-2]:null,i?null:n.segments[1],n.sourcePoint,n.targetPoint))},_setBezierPoint:function(n,i,r){r==="bezierpoint1"?n.vector1?(n.vector1={distance:t.datavisualization.Diagram.Geometry.distance(n._startPoint,i),angle:t.datavisualization.Diagram.Geometry.findAngle(n._startPoint,i)},n._point1=i):n.point1=n._point1=i:n.vector2?(n.vector2={distance:t.datavisualization.Diagram.Geometry.distance(n._endPoint,i),angle:t.datavisualization.Diagram.Geometry.findAngle(n._endPoint,i)},n._point2=i):n.point2=n._point2=i},_setPoints:function(n,t){n.sourcePoint=n.points[0]=t[0];n.targetPoint=n.points[n.points.length-1]=t[t.length-1];n.points=t;n.type==="bezier"&&(n.point1=t[2]||n.point1,n.point2=t[3]||n.point2,n.point1||(n._point1=n.point1),n.point2||(n._point2=n.point2),this._updateBezierPoints(n))},_updateConnectorSegments:function(n,i,r,u){for(var o,s=n.sourcePoint,f=0;f<n.segments.length;f++){var e=n.segments[f],h=n.segments[f-1],c=n.segments[f+1];e._startPoint=h?h._endPoint:s;f==0&&i||f==n.segments.length-1&&r||(e.type=="orthogonal"?o=t.datavisualization.Diagram.Util._addOrthogonalPoints(e,h,c,n.sourcePoint,n.targetPoint,o):(o=t.datavisualization.Diagram.Geometry.findAngle(s,e._endPoint),e.type=="bezier"&&this._updateBezierPoints(e)));s=e._endPoint}u&&u._dock(n,u.nameTable)},_translateLine:function(n,i,r){for(var u,f,e=0;e<n.segments.length;e++){for(u=n.segments[e],f=0;f<u.points.length;f++)f==0?(u._startPoint=u.points[f]=t.datavisualization.Diagram.Geometry.translate(u.points[f],i,r),e==0&&(n.sourcePoint=u._startPoint)):f==u.points.length-1?(u._endPoint=u.points[f]=t.datavisualization.Diagram.Geometry.translate(u.points[f],i,r),e==n.segments.length-1&&(n.targetPoint=u._endPoint)):u.points[f]=t.datavisualization.Diagram.Geometry.translate(u.points[f],i,r);u.type===t.datavisualization.Diagram.Segments.Bezier?(u._point1=t.datavisualization.Diagram.Geometry.translate(u._point1,i,r),u._point2=t.datavisualization.Diagram.Geometry.translate(u._point2,i,r),u.point1&&(u.point1=u._point1),u.point2&&(u.point2=u._point2),u.point&&(u.point=u._endPoint),u._point=u._endPoint):u.type=="straight"&&(u.point&&(u.point=u._endPoint),u._point=u._endPoint)}},_adjustPoint:function(n,i,r,u){var f=r?{x:n.x,y:n.y}:{x:i.x,y:i.y},e;return n.x==i.x?n.y<i.y&&r||n.y>i.y&&!r?f.y+=u:f.y-=u:n.y==i.y?n.x<i.x&&r||n.x>i.x&&!r?f.x+=u:f.x-=u:r?(e=t.datavisualization.Diagram.Geometry.findAngle(n,i),f=t.datavisualization.Diagram.Geometry.transform(n,e,u)):(e=t.datavisualization.Diagram.Geometry.findAngle(i,n),f=t.datavisualization.Diagram.Geometry.transform(i,e,u)),f},_getIconPosition:function(n,i,r){var o,s,f,e,u,h,c;if(n)return o=n.margin.left-n.margin.right,s=n.margin.top-n.margin.bottom,f=n.offset.x,e=n.offset.y,r?(u=t.datavisualization.Diagram.Point(i.width*f+o,i.height*e+s),(u.x>i.width||u.y>i.height)&&(u=t.datavisualization.Diagram.Point(i.width*f,i.height*e)),u):(h=i.center.x-i.width/2+i.width*f+o,c=i.center.y-i.height/2+i.height*e+s,t.datavisualization.Diagram.Point(h,c))},_rBounds:function(n,i){var r={},u,e,f;return(n?(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height,r.rotateAngle=i):r=t.datavisualization.Diagram.Rectangle(),r)?(u={},r.x=Math.round(r.x*100)/100,r.y=Math.round(r.y*100)/100,r.width=Math.round(r.width*100)/100,r.height=Math.round(r.height*100)/100,u.width=r.width,u.height=r.height,u.x=u.left=r.x,u.right=r.x+r.width,u.y=u.top=r.y,u.bottom=r.y+r.height,u.center={x:r.x+r.width/2,y:r.y+r.height/2},u.topLeft={x:r.x,y:r.y},u.topCenter={x:r.x+r.width/2,y:r.y},u.topRight={x:r.x+r.width,y:r.y},u.middleLeft={x:r.x,y:r.y+r.height/2},u.middleRight={x:r.x+r.width,y:r.y+r.height/2},u.bottomLeft={x:r.x,y:r.y+r.height},u.bottomCenter={x:r.x+r.width/2,y:r.y+r.height},u.bottomRight={x:r.x+r.width,y:r.y+r.height},r&&r.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,r.rotateAngle,r.x+r.width/2,r.y+r.height/2),u.topLeft=t.Matrix.transform(e,u.topLeft),u.topCenter=t.Matrix.transform(e,u.topCenter),u.topRight=t.Matrix.transform(e,u.topRight),u.middleLeft=t.Matrix.transform(e,u.middleLeft),u.middleRight=t.Matrix.transform(e,u.middleRight),u.bottomLeft=t.Matrix.transform(e,u.bottomLeft),u.bottomCenter=t.Matrix.transform(e,u.bottomCenter),u.bottomRight=t.Matrix.transform(e,u.bottomRight),f=t.datavisualization.Diagram.Geometry.rect([u.topLeft,u.topRight,u.bottomRight,u.bottomLeft]),u.x=u.left=f.x,u.y=u.top=f.y,u.right=f.x+f.width,u.bottom=f.y+f.height,u.center=t.datavisualization.Diagram.Point(f.x+f.width/2,f.y+f.height/2),u.width=-u.topLeft.x+u.right,u.height=-u.topRight.y+u.bottom),u.points=[u.topLeft,u.topRight,u.bottomRight,u.bottomLeft],u):r},_getLabelPosition:function(n,i,r,u,f,e){var c,h,o,s;return e&&(c=e.getBBox(),h=this._rBounds(c,n.rotateAngle)),o=i.width*(r?r.x:n.offset.x),s=i.height*(r?r.y:n.offset.y),n.horizontalAlignment=="left"?o+=n.margin.left:n.horizontalAlignment=="right"?o-=n.margin.right:o+=n.margin.left-n.margin.right+(f?-((h?h.width:i.width)/2):0),n.verticalAlignment=="top"?s+=n.margin.top:n.verticalAlignment=="bottom"?s-=n.margin.bottom:s+=n.margin.top-n.margin.bottom+(u?n.fontSize/2:0),t.datavisualization.Diagram.Point(o,s)},_getPortPosition:function(n,i,r){var u,f,e,o;if(n)return u=(n.margin.left?n.margin.left:0)+(n.margin.right?n.margin.right:0),f=(n.margin.top?n.margin.top:0)+(n.margin.bottom?n.margin.bottom:0),r?t.datavisualization.Diagram.Point(i.width*n.offset.x+u,i.height*n.offset.y+f):(e=i.center.x-i.width/2+i.width*n.offset.x+u,o=i.center.y-i.height/2+i.height*n.offset.y+f,t.datavisualization.Diagram.Point(e,o))},_translate:function(n,i,r,u,f,e){var h,o,s;if(n.segments)t.datavisualization.Diagram.Util._translateLine(n,i,r,n);else if(n.offsetX+=i,n.offsetY+=r,n._type==="group"&&!f){for(h=e._getChildren(n.children),s=0;s<h.length;s++)o=u[h[s]],this._translate(o,i,r,u,null,e),o.parent&&o.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(u[o.parent],e);n._type!="group"&&n.container&&t.datavisualization.Diagram.Util._updateGroupBounds(n,e)}},scale:function(n,i,r,u,f,e,o,s,h){var nt,b,v,c,w,a,d,g,l;if(n.container)switch(n.container.type){case"canvas":a={};l=t.Matrix.identity();t.Matrix.rotate(l,-n.rotateAngle,u.x,u.y);t.Matrix.scale(l,i,r,u.x,u.y);t.Matrix.rotate(l,n.rotateAngle,u.x,u.y);k=t.Matrix.transform(l,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY));y=n.width*i;p=n.height*r;o&&(n.minHeight=p,n.minWidth=y);s!=!0?a=h._getMinMaxSize(n,y,p):(a.width=y,a.height=p);a&&a.width>1&&(d=n.offsetX-n.width/2,n.width=a.width,n.offsetX=d+n.width/2);a&&a.height>1&&(g=n.offsetY-n.height/2,n.height=a.height,n.offsetY=g+n.height/2);break;case"stack":l=t.Matrix.identity();t.Matrix.rotate(l,-n.rotateAngle,u.x,u.y);t.Matrix.scale(l,i,r,u.x,u.y);t.Matrix.rotate(l,n.rotateAngle,u.x,u.y);k=t.Matrix.transform(l,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY));y=n.width*i-(n.marginLeft+n.marginRight);p=n.height*r-(n.marginTop+n.marginBottom);a=h._getMinMaxSize(n,y,p);a.width>1&&(d=n.offsetX-n.width/2,n.width=a.width-n.marginLeft,n.offsetX=d+n.width/2+n.marginLeft);a.height>1&&(g=n.offsetY-n.height/2,n.height=a.height-n.marginTop,n.offsetY=g+n.height/2+n.marginTop);t.datavisualization.Diagram.SvgContext._alignOnStack(n,h)}else if(l=t.Matrix.identity(),n.segments)for(t.Matrix.scale(l,i,r,u.x,u.y),v=0;v<n.segments.length;v++){for(c=n.segments[v],w=0;w<c.points.length;w++)c.points[w]=t.Matrix.transform(l,c.points[w]),v!=0||w!=0||n.sourceNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],t.datavisualization.Diagram.Util._setLineEndPoint(n,t.Matrix.transform(l,n.sourcePoint),!1)),v!=n.segments.length-1||w!=c.points.length-1||n.targetNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],n.targetPoint=c._endPoint);c._startPoint=c.points[0];c._endPoint=c.points[c.points.length-1];c.type=="orthogonal"?c.length||c.length===0?c.length=c._length=t.datavisualization.Diagram.Geometry.distance(c._startPoint,c._endPoint):t.datavisualization.Diagram.Util._addOrthogonalPoints(c,n.segments[v-1],n.segments[v+1],n.sourcePoint,n.targetPoint):(c.point&&(c.point=c._endPoint),c._point=c._endPoint)}else if(n._type==="group"){for(nt=h._getChildren(n.children),v=0;v<nt.length;v++)b=f[nt[v]],b&&(this.scale(b,i,r,u,f),b.parent&&b.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(f[b.parent],h));t.datavisualization.Diagram.Util._updateGroupBounds(n,h)}else{t.Matrix.rotate(l,-n.rotateAngle,u.x,u.y);t.Matrix.scale(l,i,r,u.x,u.y);t.Matrix.rotate(l,n.rotateAngle,u.x,u.y);var k=t.Matrix.transform(l,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),y=n.width*i,p=n.height*r;y>1&&(n.width=y,n.offsetX=k.x);p>1&&(n.height=p,n.offsetY=k.y)}},_getIntersectingElement:function(n,i){for(var u,f,r,h,o=t.datavisualization.Diagram.SpatialUtil.findQuads(n._spatialSearch,i),s=[],e=0;e<o.length;e++)if(u=o[e],u.objects.length>0)for(f=0;f<u.objects.length;f++)r=u.objects[f],r.visible&&(h=t.datavisualization.Diagram.Util.bounds(r),t.datavisualization.Diagram.Geometry.intersectsRect(i,h)&&(r=n._sortByZIndex(r,!0),s.push(r)));return s},_getIntersectingNodeElement:function(n,i){for(var u,f,r,h,o=t.datavisualization.Diagram.SpatialUtil.findQuads(n._spatialSearch,i),s=[],e=0;e<o.length;e++)if(u=o[e],u.objects.length>0)for(f=0;f<u.objects.length;f++)r=u.objects[f],r.visible&&(h=t.datavisualization.Diagram.Util.bounds(r),t.datavisualization.Diagram.Geometry.intersectsRect(i,h)&&(r=n._sortByZIndex(r,!0),r.segments||s.push(r)));return s},_updateChildBounds:function(n,i){var u,f,e,o,r,s,h;e=n.width;o=n.height;u=n.offsetX;f=n.offsetY;r=t.datavisualization.Diagram.Util._getChildrenBounds(n,i);n.offsetX=r.x+r.width/2;n.offsetY=r.y+r.height/2;n.height=r.height;n.width=r.width;s=e/n.width;h=o/n.height;this.scale(n,s,h,n.pivot,i.nameTable,null,null,null,i);this._translate(n,u-n.offsetX,f-n.offsetY,i.nameTable,null,i)},_updateGroupBounds:function(n,i,r,u){var h,c,o,a,v,e,s;if(n&&!n.container&&n&&(n.type==="pseudoGroup"||n.children&&n.children.length>0)){h=n.width;c=n.height;o=n.offsetX;a=n.offsetY;u&&this._updateRotateAngle(n,i.nameTable);var f=this._getChildrenBounds(n,i,r),y=f.x+f.width*n.pivot.x,p=f.y+f.height*n.pivot.y,l={x:y,y:p};if(n.rotateAngle&&(!i._isNodeInitializing||i._isGroupNode)&&(v=t.Matrix.identity(),t.Matrix.rotate(v,n.rotateAngle),l=t.Matrix.transform(v,l)),f&&(n.offsetX=l.x,n.offsetY=l.y,n.width=f.width,n.height=f.height),r){if(e=null,n.children&&n.children.length>0)for(s=0;s<n.children.length;s++)i._getChild(n.children[s])&&(e=i.nameTable[i._getChild(n.children[s])]),e&&(e._type==="group"||e.children&&e.children.length>0)&&this._updateGroupBounds(e,i,r);h&&h!=n.width&&i.scale(n,h/n.width,1,new t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),i.nameTable);c&&c!=n.height&&i.scale(n,1,c/n.height,new t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),i.nameTable);o&&o!=n.offsetX&&i._translate(n,o-n.offsetX,1,i.nameTable);o&&a!=n.offsetY&&i._translate(n,1,a-n.offsetY,i.nameTable)}}},_getChildrenBounds:function(n,i,r){var f=i._getChildren(n.children),e,o=t.datavisualization.Diagram.Rectangle(),u,s,h;for(f.length>0&&(u=i.nameTable[f[0]],u&&(o=this._rotateChildBounds(u,n,i))),s=0,h=f.length;s<h;s++)u=i.nameTable[f[s]],u&&(i.selectedItem||!u._isInternalShape)&&(u._type==="group"?(this._updateGroupBounds(u,i,r),e=this._rotateChildBounds(u,n,i)):e=this._rotateChildBounds(u,n,i)),e&&(o=t.datavisualization.Diagram.Geometry.union(o,e));return o},_updateRotateAngle:function(n,t){var i,r;if(n.offsetX==0&&n.offsetY==0&&n.width==0&&n.height==0)for(i=0;i<n.children.length;i++)if(r=t[n.children[i]],r&&!r.segments&&!n.rotateAngle){n.rotateAngle=r.rotateAngle;return}},_rotateChildBounds:function(n,i,r){var f,u;if(n.segments||(i.rotateAngle||n.rotateAngle)&&(!r._isNodeInitializing||r._isGroupNode)){f=this.bounds(n);u=t.Matrix.identity();t.Matrix.rotate(u,-i.rotateAngle);var e=t.Matrix.transform(u,f.topLeft),o=t.Matrix.transform(u,f.topRight),s=t.Matrix.transform(u,f.bottomLeft),h=t.Matrix.transform(u,f.bottomRight),c=Math.min(e.x,o.x,s.x,h.x),l=Math.min(e.y,o.y,s.y,h.y);return{x:c,width:Math.max(e.x,o.x,s.x,h.x)-c,y:l,height:Math.max(e.y,o.y,s.y,h.y)-l}}return{x:n.offsetX-(n.width||n._width)*n.pivot.x,y:n.offsetY-(n.height||n._height)*n.pivot.y,width:n.width||n._width,height:n.height||n._height}},updateBridging:function(i,r,u){var lt,at,e=[],y,ft,et,c,ni,ot,p,w,ti,ii,ht,bt,ui,tt,kt,dt,fi,h,nt,v,b,o,ei,d,ut,a,gt,s,k,g,oi,si;if(u&&u.length){if(i.segments.length>0)for(h=0;h<i.segments.length;h++)for(v=i.segments[h]._bridges,y=0;y<v.length;y++)v[y]._target==u[0].name?v.splice(y,1):this.findLength(v[y].startPoint,v[y].endPoint)>u[0].bridgeSpace&&(r.nameTable[v[y]._target]&&u.push(r.nameTable[v[y]._target]),v.splice(y,1))}else if(i.segments.length>0)for(h=0;h<i.segments.length;h++)i.segments[h]._bridges=[];if(i._intersects=[],t.datavisualization.Diagram.Util.canBridge(i,r)){var vt=this.getPoints(i),l=i.bridgeSpace,yt=r.bridgeDirection(),pt=-1;if(lt=u&&r.boundaryTable[i.name]?r.boundaryTable[i.name]:t.datavisualization.Diagram.Util.bounds(i),r.boundaryTable[i.name]=lt,ft=u?u:r._getConnectors(),ft.length>0)for(et=0;et<ft.length;et++)if(c=ft[et],i&&i.segments&&i.segments.length>0&&i.segments[0].type!="bezier"&&c&&c.segments&&c.segments.length>0&&c.segments[0].type!="bezier"&&c.segments&&c.visible&&i.name!==c.name&&(at=r.boundaryTable[c.name]?r.boundaryTable[c.name]:t.datavisualization.Diagram.Util.bounds(c),r.boundaryTable[c.name]=at,t.datavisualization.Diagram.Geometry.intersectsRect(lt,at)&&(ni=this.getPoints(c),ot=this.interSect(vt,ni,!1,r,!0),i._intersects.push(c.name),ot.length>0)))for(b=0;b<ot.length;b++){var wt=0,f=0,it=0,rt=0,st=this.getLengthAtFractionPoint(i,ot[b]);if((it=st.lengthAtFractionPt,wt=st.fullLength,f=st.segmentIndex,rt=st.pointIndex,!(f<0))&&i.segments[0])if(ti=(it-l/2)/wt,p=this.getPointAtLength(it-l/2,vt),ti=(it+l/2)/wt,w=this.getPointAtLength(it+l/2,vt),t.datavisualization.Diagram.Geometry.isEmptyPoint(w)&&(w=p),ii=f===0?i.sourcePoint:i.segments[f-1]._endPoint,k=i.segments[f].type==="straight"?i.segments[f]._point:i.segments[f].points[rt],ht=this._findAngle(ii,k),e.length>f&&e[f]!=null){bt=f===0?i.sourcePoint:i.segments[f-1]._endPoint;var hi=Math.abs(this.findLength(bt,w)),ri=0,ct=-1;for(pt=-1,s=0;s<e[f].bridges.length;s++)if(pt++,ui=e[f].bridges[s],ri=Math.abs(this.findLength(bt,ui.endPoint)),hi<ri){ct=pt;break}ct>=0?(tt=this.createSegment(p,w,ht,yt,rt,i,r),tt._target=c.name,e[f].bridges.splice(ct,0,tt),e[f].bridges.join(),e[f].bridgeStartPoint.splice(ct,0,p),e[f].bridgeStartPoint.join(),e[f].segmentIndex=f):(tt=this.createSegment(p,w,ht,yt,rt,i,r),tt._target=c.name,e[f].bridges.push(tt),e[f].bridgeStartPoint.push(p),e[f].segmentIndex=f)}else isNaN(p.x)||isNaN(p.y)||t.datavisualization.Diagram.Geometry.isEmptyPoint(w)||(kt=this.createSegment(p,w,ht,yt,rt,i,r),kt._target=c.name,dt=[],fi=[],dt.push(p),fi.push(w),e.length<f+1,e[f]=n.extend(!0,{},t.datavisualization.Diagram.BridgeSegments,{}),e[f].bridges.push(kt),e[f].bridgeStartPoint=dt,e[f].segmentIndex=f)}if(u&&u.length&&i.segments.length>0)for(h=0;h<i.segments.length;h++)nt=i.segments[h],v=i.segments[h]._bridges,e[h]||(e[h]=n.extend(!0,{},t.datavisualization.Diagram.BridgeSegments),e[h].segmentIndex=h),e[h].bridges=e[h].bridges.concat(v).sort(function(n,t){return nt._startPoint.x!=nt._endPoint.x?nt._startPoint.x<nt._endPoint.x?n.startPoint.x-t.startPoint.x:t.startPoint.x-n.startPoint.x:nt._startPoint.y<nt._endPoint.y?n.startPoint.y-t.startPoint.y:t.startPoint.y-n.startPoint.y}),e[h].bridgeStartPoint=e[h].bridges.map(function(n){return n.startPoint}),i.segments[h]._bridges=[];if(e.length!=0)for(b=0;b<e.length;b++)if(o=e[b],o){for(s=1;s<o.bridges.length;s++)this.findLength(o.bridges[s].endPoint,o.bridges[s-1].endPoint)<l&&(o.bridges[s-1].endPoint=o.bridges[s].endPoint,a=o.bridges[s-1],ei=r.getBridgeSegment(a.startPoint,a.endPoint,a.angle,l,a.sweep),o.bridges[s-1].path=ei,u&&u.length&&o.bridges[s-1]._target==u[0].name&&(o.bridges[s-1]._target=o.bridges[s]._target),o.bridges.splice(s,1),o.bridgeStartPoint.splice(s,1),s--);for(d=i.sourcePoint,ut=0;ut<o.bridges.length;ut++){for(a=o.bridges[ut],gt=!0,s=0;u&&s<u.length;s++)a._target==u[s].name&&(gt=!1);gt?(i.segments[o.segmentIndex]._bridges.push(a),d=a.endPoint):(i.segments[o.segmentIndex].type==="straight"?k=i.segments[o.segmentIndex]._endPoint:i.segments[o.segmentIndex].type==="orthogonal"&&(k=i.segments[o.segmentIndex].points[a.segmentPointIndex]),f!=0&&(d=i.segments[o.segmentIndex]._endPoint),g=[],g.push(t.datavisualization.Diagram.Point(k.x-l,k.y-l)),g.push(t.datavisualization.Diagram.Point(k.x+l,k.y+l)),oi=t.datavisualization.Diagram.Geometry.rect(g),g=[],g.push(t.datavisualization.Diagram.Point(d.x-l,d.y-l)),g.push(t.datavisualization.Diagram.Point(d.x+l,d.y+l)),si=t.datavisualization.Diagram.Geometry.rect(g),t.datavisualization.Diagram.Geometry.containsPoint(oi,o.bridgeStartPoint[ut])||t.datavisualization.Diagram.Geometry.containsPoint(si,a.endPoint)||(i.segments[o.segmentIndex]._bridges.push(a),d=a.endPoint))}}}},createSegment:function(i,r,u,f,e,o,s){var l,c,h=n.extend(!0,{},t.datavisualization.Diagram.PathSegment);return c=this.sweepDirection(u,f,o,s),l=s.getBridgeSegment(i,r,u,o.bridgeSpace,c),h.path=l,h.startPoint=i,h.endPoint=r,h.angle=u,h.segmentPointIndex=e,h.sweep=c,h},sweepDirection:function(n,t){var r=Math.abs(n),i;return t==="top"||t==="bottom"?(i=1,r>=0&&r<=90&&(i=0)):(t==="right"||t==="left")&&(i=1,n<0&&n>=-180&&(i=0)),(t==="right"||t==="bottom")&&(i=i===0?1:0),i},getPointAtLength:function(n,i){for(var u,o,f=0,r=null,s=t.datavisualization.Diagram.Point(0,0),e=0;e<i.length;e++){if(u=i[e],r)if(o=this.findLength(r,u),f+o>n){var h=n-f,c=this.findAngle(r,u),l=h*Math.cos(c*Math.PI/180),a=h*Math.sin(c*Math.PI/180);s=t.datavisualization.Diagram.Point(r.x+l,r.y+a);break}else f+=o;else{r=u;continue}r=u}return s},getLengthAtFractionPoint:function(n,t){var c=100,o=0,l=-1,a=0,v=0,y=-1,f,e,s,w,i,r,h;if(n.segments===null)return 0;var b=n.segments,u=n.sourcePoint,p=u;for(f=0;f<n.segments.length;f++){for(e=[],s=n.segments[f],i=0;i<s.points.length;i++)w=s.points[i],e.push(w);for(i=0;i<e.length;i++)r=e[i],h=this.getSlope(r,u,t,n),h<c&&(c=h,v=o+this.findLength(t,p),l=a,y=i),o+=this.findLength(r,u),u=r,p=r;a++}return{lengthAtFractionPt:v,fullLength:o,segmentIndex:l,pointIndex:y}},getSlope:function(n,t,i,r){var e=3,o=Math.abs(n.x-t.x),s=Math.abs(n.y-t.y),u=(i.y-n.y)/(t.y-n.y),f=(i.x-n.x)/(t.x-n.x);return!isFinite(u)||!isFinite(f)||isNaN(u)||isNaN(f)?n.x===t.x?n.y===t.y?1e4:n.y>i.y&&i.y>t.y||n.y<i.y&&i.y<t.y?Math.abs(n.x-i.x):1e4:n.y==t.y?n.x>i.x&&i.x>t.x||n.x<i.x&&i.x<t.x?Math.abs(n.y-i.y):1e4:1e4:r.segments.length>0?n.x>=i.x&&i.x>=t.x||n.x<=i.x&&i.x<=t.x||o<e?n.y>=i.y&&i.y>=t.y||n.y<=i.y&&i.y<=t.y||s<e?Math.abs(u-f):1e4:1e4:1e4},getPoints:function(n){var r=[],t,i,u;if(n.segments.length>0)for(t=0;t<n.segments.length;t++)if(i=n.segments[t],i.type==="straight"||i.type==="bezier")t===0&&r.push(n.sourcePoint),i._point&&r.push(i._point);else if(i.type==="orthogonal")for(u=0;u<n.segments[t].points.length;u++)r.push(n.segments[t].points[u]);return r},interSect:function(n,t,i,r,u){var s,h,f,e,o;for(i&&t.length>=2&&(t.splice(0,1),t.splice(0,1)),s=[],h=r.bridgeDirection(),f=0;f<n.length-1;f++){if(e=this.interSect1(n[f],n[f+1],t,r,u,h),e.length>0)for(o=0;o<e.length;o++)s.push(e[o]);i&&t.length>=1&&t.splice(0,1)}return s},checkforHorizontalLine:function(n){var t=Math.abs(n);return t>90?180-t:t},interSect1:function(n,i,r,u,f,e){for(var c,s,h,l=[],o=0;o<r.length-1;o++)c=this.interSect2(n,i,r[o],r[o+1]),t.datavisualization.Diagram.Geometry.isEmptyPoint(c)||(s=this._findAngle(n,i),h=this._findAngle(r[o],r[o+1]),s=this.checkforHorizontalLine(s),h=this.checkforHorizontalLine(h),e==="left"||e==="right"?s>h&&l.push(c):(e==="top"||e==="bottom")&&s<h&&l.push(c),s===h&&f&&l.push(c));return l},interSect2:function(n,i,r,u){var e=t.datavisualization.Diagram.LineUtil(n.x,n.y,i.x,i.y),o=t.datavisualization.Diagram.LineUtil(r.x,r.y,u.x,u.y),f=this.interSect3(e,o);return f.enabled?f.intersectPt:t.datavisualization.Diagram.Point(0,0)},interSect3:function(n,i){var f=t.datavisualization.Diagram.Point(0,0),r=n,u=i,o=(u.y2-u.y1)*(r.x2-r.x1)-(u.x2-u.x1)*(r.y2-r.y1),h=(u.x2-u.x1)*(r.y1-u.y1)-(u.y2-u.y1)*(r.x1-u.x1),c=(r.x2-r.x1)*(r.y1-u.y1)-(r.y2-r.y1)*(r.x1-u.x1),e,s;return o==0?{enabled:!1,intersectPt:f}:(e=h/o,s=c/o,e>=0&&e<=1&&s>=0&&s<=1)?(f.x=r.x1+e*(r.x2-r.x1),f.y=r.y1+e*(r.y2-r.y1),{enabled:!0,intersectPt:f}):{enabled:!1,intersectPt:f}},findLength:function(n,t){try{return Math.sqrt((n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y))}catch(i){throw i;}},_findAngle:function(n,t){var i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)*(180/Math.PI)},findAngle:function(n,i){if(t.datavisualization.Diagram.Geometry.isEqualPoint(n,i))return 0;var u=t.datavisualization.Diagram.Point(i.x,n.y),o=this.findLength(n,u),f=this.findLength(u,i),e=this.findLength(i,n),r=Math.asin(f/e);return r=r*180/Math.PI,n.x<i.x?n.y<i.y||(r=360-r):r=n.y<i.y?180-r:180+r,r},_mapPalettePhase:function(n){var i,r;return n.orientation&&n.orientation=="horizontal"?(i={x:0,y:0},r={x:40,y:0}):(i={x:0,y:0},r={x:0,y:40}),t.datavisualization.Diagram.Connector({name:n?n.name:t.datavisualization.Diagram.Util.randomId(),segments:[{type:"straight"}],sourcePoint:{x:i.x,y:i.y},targetPoint:{x:r.x,y:r.y},lineWidth:n.lineWidth?n.lineWidth:1,lineDashArray:n.lineDashArray?n.lineDashArray:null,lineColor:n.lineColor?n.lineColor:"#606060",targetDecorator:{shape:"none"},isPhase:!0,orientation:n.orientation?n.orientation:"horizontal",labels:n.label?[n.label]:[],paletteItem:n.paletteItem?n.paletteItem:null})},_updateShapeProperties:function(n){n._type="node";n.shape.type||(n.shape.type="rectangle");switch(n.shape.type){case"rectangle":n.type="basic";n._shape=n.shape.type;n.shape.cornerRadius&&(n.cornerRadius=n.shape.cornerRadius);break;case"ellipse":n.type="basic";n._shape=n.shape.type;break;case"path":n.type="basic";n._shape=n.shape.type;n.pathData=n.shape.pathData;break;case"polygon":n.type="basic";n._shape=n.shape.type;n.points=n.shape.points;break;case"image":n.type="image";n._shape=n.shape.type;n.source=n.shape.src;break;case"native":n.type="native";n._shape=n.shape.type;n.templateId=n.shape.templateId;break;case"text":n.type="text";n._shape=n.shape.type;n.textBlock=n.shape.textBlock;break;case"html":n.type="html";n._shape=n.shape.type;n.templateId=n.shape.templateId}},_refreshParentGroup:function(n,i){var r=i.nameTable[n.parent],u;r&&(this._updateGroupBounds(r,i),u=r.parent?document.getElementById(r.parent):i._diagramLayer,t.datavisualization.Diagram.DiagramContext.renderGroup(r,i),i._raiseGroupChangeEvent(n,undefined,r,"group"))},intersectsWith:function(n,t){var i=t;return n.x<i.x&&i.x<n.x+n.width&&n.y<i.y&&i.y<n.y+n.height},_findOffsetOnConnector:function(n,i,r,u){for(var e,a,k,l,y=0,o=[],f=0;f<n.segments.length;f++)for(o[f]=[],e=0;e<n.segments[f].points.length-1;e++)y+=t.datavisualization.Diagram.Geometry.distance(n.segments[f].points[e],n.segments[f].points[e+1]),o[f][e]=y;var p=n.sourceNode&&i.offset==0&&u.nameTable[n.sourceNode]||n.targetNode&&i.offset==1&&u.nameTable[n.targetNode],s=p?this.bounds(p):null,r=i.segmentOffset||0,v,c,b,h,w=y*r;for(f=0;f<o.length;f++)for(e=0;e<o[f].length;e++){if(o[f][e]>=w){if(c=n.segments[f],b=t.datavisualization.Diagram.Geometry.findAngle(c.points[e],n.segments[f].points[e+1]),h=t.datavisualization.Diagram.Geometry.transform(c.points[e],b,w-(v||0)),p){if(this.intersectsWith(s,h)&&!t.datavisualization.Diagram.Geometry.containsRect(s,this.bounds(n))){k=i.offset==0?this._getBezierDirection(c.points[e],n.segments[f].points[e+1]):this._getBezierDirection(c.points[e+1],n.segments[f].points[e]);a=i.offset==0?c.points[e+1]:c.points[e];l=!1;switch(k){case"top":s.y>a.y?h.y=s.top:l=!0;break;case"bottom":s.bottom<a.y?h.y=s.bottom:l=!0;break;case"right":s.right<a.x?h.x=s.right:l=!0;break;case"left":s.left>a.x?h.x=s.left:l=!0}if(l){w=i.offset==1?v||0:o[f][e];v=i.offset==0?o[f][e]:o[f][e-2]||(o[f-1]&&o[f-1].length>1?o[f-1][o[f-1].length-1]:o[f-2]&&o[f-2][o[f-2].length-1])||0;i.offset==0?f=f:e?e-=2:f-=2;continue}}return{segment:f,point:e,offset:{x:h.x,y:h.y}}}return{segment:f,point:e,offset:{x:h.x,y:h.y}}}v=o[f][e]}},_alignLabelOnSegments:function(n,i,r,u){var b=u.angle%360,y,c,f,e,p,w,o;u.angle%=360;var s=45,l=135,h=225,v=315,a;(i.segmentOffset==0&&n.sourceNode||i.segmentOffset==1&&n.targetNode)&&(y=i.segmentOffset==0&&n.sourceNode?r.nameTable[n.sourceNode]:r.nameTable[n.targetNode],y&&(a=this.bounds(y)),a&&(c=180/(2+2/(a.height/a.width)),s=c,l=180-c,h=l+2*c,v=360-c));switch(i.alignment){case"before":u.angle>=s&&u.angle<=l?(f="right",e=i.segmentOffset==.5?"center":"top"):u.angle>=h&&u.angle<=v?(f="left",e=i.segmentOffset==.5?"center":"bottom"):u.angle>s&&u.angle<h?(e="top",f=i.segmentOffset==.5?"center":"right"):(e="bottom",f=i.segmentOffset==.5?"center":"left");break;case"after":u.angle>=s&&u.angle<=l?(f="left",e=i.segmentOffset==.5?"center":"top"):u.angle>=h&&u.angle<=v?(f="right",e=i.segmentOffset==.5?"center":"bottom"):u.angle>s&&u.angle<h?(e="bottom",f=i.segmentOffset==.5?"center":"right"):(e="top",f=i.segmentOffset==.5?"center":"left");break;case"center":f="center";e="center"}if(i.boundaryConstraints&&(i.segmentOffset==0||i.segmentOffset==1)){n.segments.length>1&&(o=n.segments[n.segments.length-1]);p=o?o.points.length:n.segments[0].points.length;n.labels[0].name==i.name?w=t.datavisualization.Diagram.Util._getBezierDirection(n.segments[0].points[0],n.segments[0].points[1]):(o=o?o:n.segments[0],w=t.datavisualization.Diagram.Util._getBezierDirection(o.points[p-2],o.points[p-1]));switch(w){case"left":f=i.segmentOffset==0?"right":"left";break;case"right":f=i.segmentOffset==0?"left":"right";break;case"bottom":e=i.segmentOffset==0?"top":"bottom";break;case"top":e=i.segmentOffset==0?"bottom":"top"}}return{hAlign:f,vAlign:e}},getObjectType:function(n){return n?n.segments?"connector":n.type=="bpmn"&&n.container?"group":n._type==="node"||n.type=="bpmn"||n.type=="basic"||n.type=="flow"||n.type=="arrow"?"node":n.type==="text"||n.type==="image"||n.type==="native"||n.type==="html"?"node":n._type!="group"&&n.type=="pseudoGroup"?"pseudoGroup":n._type==="group"||n.isLane||n.isSwimlane?"group":n.isSwimlane?"swimlane":null:null},_canBeTarget:function(n,t){return t&&n.activeTool.helper&&n.activeTool.helper._name&&n.activeTool.helper._name===t.name?!1:!0},getLabelbounds:function(i,r,u){var o=i._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],s=o.getBoundingClientRect(),e,f;if(u&&(e=n(o).find("#"+r.name+"_"+u.name)[0],e))return f=e.getBoundingClientRect(),t.datavisualization.Diagram.Rectangle(f.left-s.left,f.top-s.top,f.right-f.left,f.bottom-f.top)},_updateBpmnChild:function(n,i){switch(n.shape){case"event":n=t.datavisualization.Diagram.DefautShapes._getBPMNEventShape(n,i);break;case"gateway":n=t.datavisualization.Diagram.DefautShapes._getBPMNGatewayShape(n,i);break;case"dataobject":n=t.datavisualization.Diagram.DefautShapes._getBPMNDataShape(n,i);break;case"activity":n=t.datavisualization.Diagram.DefautShapes._getBPMNActivityShape(n,i);break;case"group":n=t.datavisualization.Diagram.DefautShapes._getBPMNGroupShape(n,i)}return t.datavisualization.Diagram.DefautShapes.initBPMNAnnotationShape(n,i)},_getUndoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._undoObject=n.extend(!0,{},{node:i,childTable:r})},_getRedoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._redoObject=n.extend(!0,{},{node:i,childTable:r})},_collectionContains:function(n,t){for(var i=0;i<t.length;i++)if(typeof t[i]=="string"&&t[i]===n||t[i].name===n)return!0},_updateBPMNProperties:function(n,i,r,u){var o,w,f,e,l,a,s,v;switch(n.shape){case"activity":var h=t.datavisualization.Diagram.Util.bounds(n,!0),y=n.offsetX,p=n.offsetY,c=i._getChildren(n.children);for(s=0;s<c.length;s++)(o=typeof c[s]=="object"?c[s]:r[c[s]],u&&s==0&&(h=t.datavisualization.Diagram.Util.bounds(o,!0),y=o.offsetX,p=o.offsetY),s==0&&(o.pathData=o._absolutePath=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(n,12),n.subProcess.type=="transaction"&&(w={x:3,y:3,width:n.width-3,height:n.height-3},o.pathData=o._absolutePath+=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(w,12)),delete o._absoluteBounds),u&&t.datavisualization.Diagram.Util.canResize(o))||(f=o.addInfo,f.offset&&(e=t.datavisualization.Diagram.Point(h.x+h.width*f.offset.x,h.y+h.height*f.offset.y),f.margin=t.datavisualization.Diagram.Margin(f.margin?f.margin:{}),f.hAlign&&(e.x+=f.margin.left-f.margin.right,e.x=f.hAlign=="left"?e.x+f.margin.right:f.hAlign=="right"?e.x-f.margin.left:e.x),f.vAlign&&(e.y+=f.margin.top-f.margin.bottom,e.y=f.vAlign=="top"?e.y+f.margin.bottom:f.vAlign=="bottom"?e.y-f.margin.top:e.y),n.rotateAngle&&(l=t.Matrix.identity(),t.Matrix.rotate(l,n.rotateAngle,y,p),e=t.Matrix.transform(l,e)),o.offsetX=e.x,o.offsetY=e.y));break;case"group":n.pathData=n._absolutePath=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(n,15);n._scaled=!1;break;case"annotation":for(s=0;s<n.outEdges.length;s++)if(v=i.nameTable[n.outEdges[s]],v._isAnnotationLine){a=v;break}a&&t.datavisualization.Diagram.DefautShapes.updateBPMNAnnotationShape(a,null,null,i)}}};t.datavisualization.Diagram.BridgeSegments={bridges:[],bridgeStartPoint:[],segmentIndex:-1};t.datavisualization.Diagram.PathSegment={path:"",startPoint:{x:0,y:0},endPoint:{x:0,y:0},angle:0,segmentPointIndex:-1,sweep:1};t.datavisualization.Diagram.LineUtil=function(n,t,i,r){return{x1:Number(n)||0,y1:Number(t)||0,x2:Number(i)||0,y2:Number(r)||0}};t.datavisualization.Diagram.Geometry={checkPointOnCircle:function(n,t,i){var r=Math.pow(i,2),u=Math.pow(n.x-t.x,2),f=Math.pow(n.y-t.y,2);return u+f<=r?!0:!1},rect:function(n){var c=t.datavisualization.Diagram.Rectangle(),e,i,r,h;if(arguments.length===1){var o=Number.MAX_VALUE,s=Number.MAX_VALUE,l=-Number.MAX_VALUE,a=-Number.MAX_VALUE,v=n.length,u,f;for(e=0;e<v;e++)u=n[e].x,f=n[e].y,u<o&&(o=u),u>l&&(l=u),f<s&&(s=f),f>a&&(a=f);c=t.datavisualization.Diagram.Rectangle(o,s,l-o,a-s)}else arguments.length===2&&(i=t.datavisualization.Diagram.Point(arguments[0]),r=t.datavisualization.Diagram.Point(arguments[1]),i.x>r.x&&(h=i.x,i.x=r.x,r.x=h),i.y>r.y&&(h=i.y,i.y=r.y,r.y=h),c=t.datavisualization.Diagram.Rectangle(i.x,i.y,r.x-i.x,r.y-i.y));return c},union:function(n,i){var r=Math.min(n.x,i.x),u=Math.min(n.y,i.y),f=Math.max(n.x+n.width,i.x+i.width),e=Math.max(n.y+n.height,i.y+i.height);return t.datavisualization.Diagram.Rectangle(r,u,f-r,e-u)},distance:function(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))},translate:function(n,i,r){return t.datavisualization.Diagram.Point(n.x+i,n.y+r)},intersectsRect:function(n,t){return t.x<n.x+n.width&&n.x<t.x+t.width&&t.y<n.y+n.height&&n.y<t.y+t.height},findAngle:function(n,t){var i=Math.atan2(t.y-n.y,t.x-n.x);return i=180*i/Math.PI,i%=360,i<0&&(i+=360),i},intersectSegment:function(n,i){var a=n.point1.x,v=n.point1.y,y=n.point2.x,p=n.point2.y,w=i.point1.x,b=i.point1.y,k=i.point2.x,d=i.point2.y,e,o,s,h,c,l,rt,ut,g,nt,tt,it,r,f,u;return(e=p-v,s=a-y,c=y*v-a*p,tt=e*w+s*b+c,it=e*k+s*d+c,tt!==0&&it!==0&&this.sameSign(tt,it))?null:(o=d-b,h=w-k,l=k*b-w*d,g=o*a+h*v+l,nt=o*y+h*p+l,g!==0&&nt!==0&&this.sameSign(g,nt))?null:(r=e*h-o*s,r===0)?null:(f=r<0?-r/2:r/2,f=0,u=s*l-h*c,rt=u<0?(u-f)/r:(u+f)/r,u=o*c-e*l,ut=u<0?(u-f)/r:(u+f)/r,t.datavisualization.Diagram.Point(rt,ut))},updatePath:function(n,i,r,u,f,e,o,s){var h,c;e&&e.pathBounds?(c=!0,h=o||e.pathBounds(f)):(c=s&&!s._absolutePath?!0:!1,h=o);s&&(s._absoluteBounds=h);var l=0,a=0,v=!1;return(n.toString()!==h.x||i.toString()!==h.y)&&(l=n-Number(h.x),a=i-Number(h.y)),(r!==h.width||u!==h.height)&&(l=r/Number(h.width?h.width:1),a=u/Number(h.height?h.height:1),v=!0),t.datavisualization.Diagram.Geometry.processPathData(f,l,a,v,h.x,h.y,n,i,c,e)},processPathData:function(n,i,r,u,f,e,o,s,h,c){var rt=document.createElementNS("http://www.w3.org/2000/svg","path"),ut,ft,p,w,b,k,d,v,nt,y,tt,it;rt.setAttribute("d",n);h&&(c=c||new t.datavisualization.Diagram.Svg({}),n=c.absolutePath(rt).getAttribute("d"),rt.setAttribute("d",n));d=t.datavisualization.Diagram.Util.convertPathToArray(n);for(var l=0,a=0,g=0,et=d.length;g<et;++g){v=d[g];nt=v.pathSegTypeAsLetter;"x1"in v&&(p=v.x1);"x2"in v&&(b=v.x2);"y1"in v&&(w=v.y1);"y2"in v&&(k=v.y2);"x"in v&&(l=v.x);"y"in v&&(a=v.y);u?(l!=undefined&&(l=t.datavisualization.Diagram.Geometry.scalePathData(l,i,f,o),l=Number(l.toFixed(2))),a!=undefined&&(a=t.datavisualization.Diagram.Geometry.scalePathData(a,r,e,s),a=Number(a.toFixed(2))),p!=undefined&&(p=t.datavisualization.Diagram.Geometry.scalePathData(p,i,f,o),p=Number(p.toFixed(2))),w!=undefined&&(w=t.datavisualization.Diagram.Geometry.scalePathData(w,r,e,s),w=Number(w.toFixed(2))),b!=undefined&&(b=t.datavisualization.Diagram.Geometry.scalePathData(b,i,f,o),b=Number(b.toFixed(2))),k!=undefined&&(k=t.datavisualization.Diagram.Geometry.scalePathData(k,r,e,s),k=Number(k.toFixed(2)))):(l!=undefined&&(l=l+i),a!=undefined&&(a=a+r),p!=undefined&&(p=p+i),w!=undefined&&(w=w+r),b!=undefined&&(b=b+i),k!=undefined&&(k=k+r));switch(nt){case"M":y={pathSegTypeAsLetter:"M",x:l,y:a};break;case"L":y={pathSegTypeAsLetter:"L",x:l,y:a};break;case"H":y={pathSegTypeAsLetter:"H",x:l};break;case"V":y={pathSegTypeAsLetter:"V",y:a};break;case"C":y={pathSegTypeAsLetter:"C",x:l,y:a,x1:p,y1:w,x2:b,y2:k};break;case"S":y={pathSegTypeAsLetter:"S",x:l,y:a,x2:b,y2:k};break;case"Q":y={pathSegTypeAsLetter:"Q",x:l,y:a,x1:p,y1:w};break;case"T":y={pathSegTypeAsLetter:"T",x:l,y:a};break;case"A":tt=v.r1;it=v.r2;u&&(tt=tt*i,it=it*r);y={pathSegTypeAsLetter:"A",x:l,y:a,r1:tt,r2:it,angle:v.angle,largeArcFlag:v.largeArcFlag,sweepFlag:v.sweepFlag};break;case"z":case"Z":l=ut;a=ft;y=d[g]}y&&(d[g]=y);(nt==="M"||nt==="m")&&(ut=l,ft=a)}return t.datavisualization.Diagram.Util.pathSegArrayAsString(d)},scalePathData:function(n,t,i,r){return n!==i?n=r!==i?n*t-(Number(i)*t-Number(i))+(r-Number(i)):Number(n)*t-(Number(i)*t-Number(i)):r!==i&&(n=r),n},updatePolygonPoints:function(n,i){var f,r,e,u;if(n.points)for(i||(i=n.points),t.datavisualization.Diagram.Geometry.scalePoints(i,n),f=t.datavisualization.Diagram.Geometry.rect(n.points),r=0,e=n.points.length;r<e;++r)u=t.datavisualization.Diagram.Geometry.translate(i[r],-f.x,-f.y),u=t.datavisualization.Diagram.Geometry.translate(u,0,0),i[r]=u},scalePoints:function(n,i){var u=t.datavisualization.Diagram.Geometry.rect(i.points),f,e,r,o;if(u.width>0&&u.height>0)for(f=i.width/u.width,e=i.height/u.height,r=0,o=i.points.length;r<o;++r)n[r].x=n[r].x*f,n[r].y=n[r].y*e},sameSign:function(n,t){return n*t>=0},containsPoint:function(n,t){return n.x<=t.x&&t.x<=n.x+n.width&&n.y<=t.y&&t.y<=n.y+n.height},containsRect:function(n,t){return n.x<=t.x&&t.x+t.width<=n.x+n.width&&n.y<=t.y&&t.y+t.height<=n.y+n.height},inflate:function(n,t,i){n.x-=t;n.y-=i;n.width+=2*t;n.height+=2*i},isEmptyRect:function(n){return n.x===0&&n.y===0&&n.width===0&&n.height===0},isEmptyPoint:function(n){return n.x===0&&n.y===0},isEqualPoint:function(n,t){return n.x===t.x&&n.y===t.y},isEmptySize:function(n){return n.width===0&&n.height===0},length:function(n){return t.datavisualization.Diagram.Geometry.distance(n.point1,n.point2)},midPoint:function(n){return t.datavisualization.Diagram.Point((n.point1.x+n.point2.x)/2,(n.point1.y+n.point2.y)/2)},transform:function(n,t,i){var r={};return r.x=Math.round((n.x+i*Math.cos(t*Math.PI/180))*100)/100,r.y=Math.round((n.y+i*Math.sin(t*Math.PI/180))*100)/100,r}};t.datavisualization.Diagram.LineSegment=function(n,t){return{point1:n,point2:t}};t.datavisualization.Diagram.Point=function(n,t){return{x:Number(n)||0,y:Number(t)||0}};t.datavisualization.Diagram.Size=function(n,t){return{width:Number(n)||0,height:Number(t)||0}};t.datavisualization.Diagram.Rectangle=function(n,t,i,r){return{x:Number(n)||0,y:Number(t)||0,width:Number(i)||0,height:Number(r)||0}};t.datavisualization.Diagram.ImageAlignment={None:"none",XMinYMin:"xminymin",XMinYMid:"xminymid",XMinYMax:"xminymax",XMidYMin:"xmidymin",XMidYMid:"xmidymid",XMidYMax:"xmidymax",XMaxYMin:"xmaxymin",XMaxYMid:"xmaxymid",XMaxYMax:"xmaxymax"};t.datavisualization.Diagram.ScaleConstraints={None:"none",Stretch:"stretch",Meet:"meet",Slice:"slice"};t.datavisualization.Diagram.KeyModifiers={None:0,Control:1,Meta:1,Alt:2,Shift:4};t.datavisualization.Diagram.Keys={None:"",Number0:0,Number1:1,Number2:2,Number3:3,Number4:4,Number5:5,Number6:6,Number7:7,Number8:8,Number9:9,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,Left:37,Up:38,Right:39,Down:40,Escape:27,Delete:46,Tab:9,Enter:13};t.datavisualization.Diagram.LabelRenderingMode={Html:"html",Svg:"svg"};t.datavisualization.Diagram.TemplateType={Html:"html",Svg:"svg"};t.datavisualization.Diagram.DecoratorShapes={None:"none",Arrow:"arrow",OpenArrow:"openarrow",Circle:"circle",Diamond:"diamond",Path:"path"};t.datavisualization.Diagram.ActionType={Unknown:"unknown",Nudge:"nudge",Touch:"touch",Mouse:"mouse",Order:"order",Align:"align",Size:"size",HistoryChange:"historyChange"};t.datavisualization.Diagram.dependentconnector={dependent:1,independent:2};t.datavisualization.Diagram.ContainerType={Canvas:"canvas",Stack:"stack"};t.datavisualization.Diagram.IconShapes={Minus:"minus",Plus:"plus",ArrowUp:"arrowup",ArrowDown:"arrowdown",Template:"template",Path:"path",Image:"image",None:"none"};t.datavisualization.Diagram.PortShapes={X:"x",Circle:"circle",Square:"square",Path:"path"};t.datavisualization.Diagram.PortVisibility={Visible:1,Hidden:2,Hover:4,Connect:8,Default:8};t.datavisualization.Diagram.TextAlign={Left:"left",Center:"center",Right:"right",Justify:"justify"};t.datavisualization.Diagram.HorizontalAlignment={Left:"left",Center:"center",Right:"right",Stretch:"stretch"};t.datavisualization.Diagram.Alignment={Before:"before",After:"after",Center:"center"};t.datavisualization.Diagram.LabelRelativeMode={SegmentBounds:"segmentbounds",SegmentPath:"segmentpath"};t.datavisualization.Diagram.LabelEditMode={Edit:"edit",View:"view"};t.datavisualization.Diagram.RelativeMode={Object:"object",Mouse:"mouse"};t.datavisualization.Diagram.TextWrapping={NoWrap:"nowrap",Wrap:"wrap",WrapWithOverflow:"wrapwithoverflow"};t.datavisualization.Diagram.VerticalAlignment={Top:"top",Center:"center",Bottom:"bottom",Stretch:"stretch"};t.datavisualization.Diagram.TextDecorations={Underline:"underline",Overline:"overline",LineThrough:"line-through",None:"none"};t.datavisualization.Diagram.PaletteConstraints={HeaderVisibility:2,Visible:4,Expandable:8,Default:14};t.datavisualization.Diagram.NodeConstraints={None:1,Select:2,Delete:4,Drag:8,Rotate:16,Connect:32,ResizeNorthEast:64,ResizeEast:128,ResizeSouthEast:256,ResizeSouth:512,ResizeSouthWest:1024,ResizeWest:2048,ResizeNorthWest:4096,ResizeNorth:8192,Resize:16320,Shadow:16384,DragLabel:32768,AllowPan:65536,AspectRatio:131072,AllowDrop:262144,InheritTooltip:524288,MultiSelect:1048576,PointerEvents:2097152,PointerVisibility:2097152,CrispEdges:4194304,InheritCrispEdges:8388608,Interaction:16347,Default:11026430};t.datavisualization.Diagram.HistoryChangeCause={Undo:"undo",Redo:"redo",CustomAction:"customAction"};t.datavisualization.Diagram.CollectionChangeCause={ClipBoard:"clipBoard",Drop:"drop",HistoryChange:"historyChange",Unknown:"unknown"};t.datavisualization.Diagram.SelectionChangeCause={Keydown:"keydown",RubberBand:"rubberBand",Mouse:"mouse",Touch:"touch",Unknown:"unknown"};t.datavisualization.Diagram.ScrollChangeCause={Zoom:"zoom",Pan:"pan",Unknown:"unknown"};t.datavisualization.Diagram.ConnectorConstraints={None:1,Select:2,Delete:4,Drag:8,DragSourceEnd:16,DragTargetEnd:32,DragSegmentThumb:64,Bridging:128,DragLabel:256,InheritBridging:512,AllowDrop:1024,InheritTooltip:2048,PointerEvents:4096,PointerVisibility:4096,CrispEdges:8192,InheritCrispEdges:16384,Interaction:122,Default:23166};t.datavisualization.Diagram.PortConstraints={None:1,Connect:2,ConnectOnDrag:4};t.datavisualization.Diagram.SelectorConstraints={None:1,Rotator:2,Resizer:4,UserHandles:8,Tooltip:16,All:30};t.datavisualization.Diagram.UserHandlePositions={TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",MiddleLeft:"middleleft",MiddleRight:"middleright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};t.datavisualization.Diagram.SnapConstraints={None:0,SnapToHorizontalLines:1,SnapToVerticalLines:2,SnapToLines:3,ShowHorizontalLines:4,ShowVerticalLines:8,ShowLines:12,All:15};t.datavisualization.Diagram.PageOrientations={Landscape:"landscape",Portrait:"portrait"};t.datavisualization.Diagram.ScrollLimit={Infinity:"infinity",Diagram:"diagram",Limited:"limited"};t.datavisualization.Diagram.BoundaryConstraints={Infinity:"infinity",Diagram:"diagram",Page:"page"};t.datavisualization.Diagram.LayoutOrientations={TopToBottom:"toptobottom",BottomToTop:"bottomtotop",LeftToRight:"lefttoright",RightToLeft:"righttoleft"};t.datavisualization.Diagram.ObjectTypes={Diagram:"diagram",Palette:"palette",Lane:"lane",Group:"group"};t.datavisualization.Diagram.PaletteDefaults={name:"",expanded:!1,subControlId:null,items:[],constraints:t.datavisualization.Diagram.PaletteConstraints.Default};t.datavisualization.Diagram.Palette=function(i){return n.extend(!0,{},t.datavisualization.Diagram.PaletteDefaults,i)};t.datavisualization.Diagram.Shapes={Image:"image",Text:"text",Html:"html",Native:"native",Basic:"basic",Flow:"flow",Arrow:"arrow",BPMN:"bpmn"};t.datavisualization.Diagram.ClipBoardChangeType={All:"all",None:"none",Specific:"specific"};t.datavisualization.Diagram.OverflowType={Clip:"clip",Ellipsis:"ellipsis"};t.datavisualization.Diagram.ShapeDefaults={shape:"",source:"",pathData:"",textBlock:null,points:[],templateId:null,scale:"meet",contentAlignment:"xmidymid"};t.datavisualization.Diagram.Shape=function(i){return i&&(i.type==="html"&&typeof i.html=="string"&&(i.html=t.datavisualization.Diagram.Util.htmlEncode(i.html)),i.type==="text"&&(i.textBlock=t.datavisualization.Diagram.TextBlock(i.textBlock?i.textBlock:{}),i.fillColor=i.fillColor?i.fillColor:"transparent",i.borderColor=i.borderColor?i.borderColor:"transparent",i.borderWidth=i.borderWidth?i.borderWidth:0),(i.type=="image"||i.type=="native"||i.type==="text"||i.type==="html")&&(i._shape=i.type),i._type||(i._type=i.type?i.type:"node"),i._shape||(i._shape=i.shape?i.shape:"rectangle")),n.extend(!0,{},t.datavisualization.Diagram.ShapeDefaults,i)};t.datavisualization.Diagram.Segments={Straight:"straight",Orthogonal:"orthogonal",Bezier:"bezier"};t.datavisualization.Diagram.SegmentDefaults={type:t.datavisualization.Diagram.Segments.Straight,point:null,point1:null,point2:null,vector1:null,vector2:null,_point1:t.datavisualization.Diagram.Point(),_point2:t.datavisualization.Diagram.Point(),length:null,_length:null,_bridges:[],direction:null,_direction:null};t.datavisualization.Diagram.Segment=function(i){var r=n.extend(!0,{},t.datavisualization.Diagram.SegmentDefaults,i);return r.points=[],r.type=="orthogonal"?(r._length=r.length,r._direction=r.direction):(r.type=="bezier"&&(r._point1=r.point1,r._point2=r.point2),r.point&&(r._point=r.point)),r};t.datavisualization.Diagram.MarginDefaults={top:0,left:0,right:0,bottom:0};t.datavisualization.Diagram.Margin=function(i){return n.extend(!0,{},t.datavisualization.Diagram.MarginDefaults,i)};t.datavisualization.Diagram.GestureDefaults={key:t.datavisualization.Diagram.Keys.None,keyModifiers:t.datavisualization.Diagram.KeyModifiers.None};t.datavisualization.Diagram.Gesture=function(i){return n.extend(!0,{},t.datavisualization.Diagram.GestureDefaults,i)};t.datavisualization.Diagram.CommandDefaults={gesture:t.datavisualization.Diagram.Gesture(),execute:null,canExecute:null,parameter:null};t.datavisualization.Diagram.Command=function(i){return i.gesture&&(i.gesture=t.datavisualization.Diagram.Gesture(i.gesture)),i.canExecute||(i.canExecute=function(){return!0}),i.execute||(i.execute=function(){}),n.extend(!0,{},t.datavisualization.Diagram.CommandDefaults,i)};t.datavisualization.Diagram.TooltipDefaults={templateId:"",relativeMode:"object",alignment:{horizontal:"center",vertical:"bottom"},margin:{left:5,right:5,top:5,bottom:5},offset:null,delay:0};t.datavisualization.Diagram.Tooltip=function(i){return n.extend(!0,{},t.datavisualization.Diagram.TooltipDefaults,i)};t.datavisualization.Diagram.BackgroundImageDefaults={source:"",alignment:"xmidymid",scale:"meet"};t.datavisualization.Diagram.BackgroundImage=function(i){return n.extend(!0,{},t.datavisualization.Diagram.BackgroundImageDefaults,i)};t.datavisualization.Diagram.Path=function(){this._path=""};t.datavisualization.Diagram.Path.prototype={moveTo:function(n,t){return this._path+="M"+n+","+t,this},lineTo:function(n,t){return this._path+="L"+n+","+t,this},cubicBezierTo:function(n,t){return this._path+=t?"S":"C",this._addPoints(n),this},quadraticBezierTo:function(n,t){return this._path+=t?"T":"Q",this._addPoints(n),this},ellipticalArcTo:function(n,t,i,r,u,f,e){return this._path+="A"+n+","+t+" "+i+" "+r+","+u+" "+f+","+e,this},close:function(){return this._path+="Z",this},toString:function(){return this._path},_addPoints:function(n){for(var i,t=0;t<n.length;t++)i=n[t],this._path+=i.x+", "+i.y,t!==n.length-1&&(this._path+=" ")}};t.datavisualization.Diagram.DecoratorDefaults={shape:t.datavisualization.Diagram.DecoratorShapes.Arrow,width:8,height:8,borderColor:"black",borderWidth:1,fillColor:"black",pathData:"",cssClass:""};t.datavisualization.Diagram.Decorator=function(i){return n.extend(!0,{},t.datavisualization.Diagram.DecoratorDefaults,i)};t.datavisualization.Diagram.TextBlockDefaults={readOnly:!1,bold:!1,italic:!1,text:"",textDecoration:t.datavisualization.Diagram.TextDecorations.None,fontSize:12,fontFamily:"Arial",fontColor:"black",boundaryConstraints:!0,segmentOffset:.5,offset:t.datavisualization.Diagram.Point(.5,.5),textAlign:t.datavisualization.Diagram.TextAlign.Center,alignment:t.datavisualization.Diagram.Alignment.Center,relativeMode:t.datavisualization.Diagram.LabelRelativeMode.SegmentPath,horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Center,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Center,wrapping:t.datavisualization.Diagram.TextWrapping.WrapWithOverflow,margin:t.datavisualization.Diagram.Margin(),textOverflow:!1,overflowType:t.datavisualization.Diagram.OverflowType.Ellipsis,mode:t.datavisualization.Diagram.LabelEditMode.Edit,width:50,rotateAngle:0,opacity:1,templateId:"",templateType:"html"};t.datavisualization.Diagram.TextBlock=function(i){return i.wrapText!==undefined&&(i.wrapping=i.wrapText?"wrapwithoverflow":"nowrap"),n.extend(!0,{},t.datavisualization.Diagram.TextBlockDefaults,i)};t.datavisualization.Diagram.LabelDefaults=n.extend(!0,{},t.datavisualization.Diagram.TextBlockDefaults,{name:"",visible:!0,borderColor:"transparent",borderWidth:0,fillColor:"transparent",cssClass:"",hyperlink:""});t.datavisualization.Diagram.Label=function(i){var r=n.extend(!0,{},t.datavisualization.Diagram.LabelDefaults,i);return r.name||(r.name="label_"+t.datavisualization.Diagram.Util.randomId()),r};t.datavisualization.Diagram.ExportSettingsDefaults={multiplePage:!1,pageWidth:null,pageHeight:null,pageOrientation:"portrait",stretch:"none"};t.datavisualization.Diagram.ExportSettings=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ExportSettingsDefaults,i)};t.datavisualization.Diagram.PrintSettingsDefaults={multiplePage:!1,pageWidth:null,pageHeight:null,pageOrientation:"portrait",margin:{left:0,top:0,right:0,bottom:0},region:"pageSettings"};t.datavisualization.Diagram.PrintSettings=function(i){return n.extend(!0,{},t.datavisualization.Diagram.PrintSettingsDefaults,i)};t.datavisualization.Diagram.IconDefaults={shape:t.datavisualization.Diagram.IconShapes.None,width:15,height:15,offset:{x:.5,y:1},borderColor:"#1a1a1a",borderWidth:1,margin:t.datavisualization.Diagram.Margin(),horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Center,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Center,cornerRadius:0,fillColor:"white",source:"",pathData:"",templateId:""};t.datavisualization.Diagram.expandIcon=function(i){return n.extend(!0,{},t.datavisualization.Diagram.IconDefaults,i)};t.datavisualization.Diagram.collapseIcon=function(i){return n.extend(!0,{},t.datavisualization.Diagram.IconDefaults,i)};t.datavisualization.Diagram.PortDefaults={name:"",visibility:t.datavisualization.Diagram.PortVisibility.Default,constraints:t.datavisualization.Diagram.PortConstraints.Connect,size:8,offset:t.datavisualization.Diagram.Point(0,0),borderColor:"#1a1a1a",borderWidth:1,fillColor:"white",shape:t.datavisualization.Diagram.PortShapes.Square,pathData:"",connectorPadding:0,cssClass:"",margin:t.datavisualization.Diagram.Margin()};t.datavisualization.Diagram.ShadowDefaults={distance:5,angle:45,opacity:.7};t.datavisualization.Diagram.Shadow=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ShadowDefaults,i)};t.datavisualization.Diagram.Port=function(i){var r=n.extend(!0,{},t.datavisualization.Diagram.PortDefaults,i);return r.name||(r.name="port_"+t.datavisualization.Diagram.Util.randomId()),r};t.datavisualization.Diagram.StopDefaults={color:"",offset:0,opacity:1};t.datavisualization.Diagram.Stop=function(i){return n.extend(!0,{},t.datavisualization.Diagram.StopDefaults,i)};t.datavisualization.Diagram.LinearGradientDefaults={type:"linear",x1:0,x2:0,y1:0,y2:0,stops:[]};t.datavisualization.Diagram.LinearGradient=function(i){for(var r=0;i.stops&&r<i.stops.length;r++)i.stops[r]=t.datavisualization.Diagram.Stop(i.stops[r]);return n.extend(!0,{},t.datavisualization.Diagram.LinearGradientDefaults,i)};t.datavisualization.Diagram.RadialGradientDefaults={type:"radial",cx:0,cy:0,fx:0,fy:0,r:50,stops:[]};t.datavisualization.Diagram.RadialGradient=function(i){for(var r=0;r<i.stops.length;r++)i.stops[r]=t.datavisualization.Diagram.Stop(i.stops[r]);return n.extend(!0,{},t.datavisualization.Diagram.RadialGradientDefaults,i)};t.datavisualization.Diagram.NodeBaseDefaults={name:"",width:0,height:0,offsetX:0,offsetY:0,visible:!0,zOrder:-1,excludeFromLayout:!1,constraints:t.datavisualization.Diagram.NodeConstraints.Default,parent:"",labels:[],expandIcon:{shape:t.datavisualization.Diagram.IconShapes.None,width:13,height:10,margin:t.datavisualization.Diagram.Margin(),offset:{x:.5,y:1},borderColor:"#1a1a1a",borderWidth:1,cornerRadius:0,fillColor:"black",pathData:"",templateId:""},collapseIcon:{shape:t.datavisualization.Diagram.IconShapes.None,width:13,height:10,margin:t.datavisualization.Diagram.Margin(),offset:{x:.5,y:1},borderColor:"#1a1a1a",borderWidth:1,cornerRadius:0,fillColor:"black",pathData:"",templateId:""},ports:[],inEdges:[],outEdges:[],rotateAngle:0,pivot:t.datavisualization.Diagram.Point(.5,.5),addInfo:{},marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,horizontalAlign:t.datavisualization.Diagram.HorizontalAlignment.Left,verticalAlign:t.datavisualization.Diagram.VerticalAlignment.Top,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,connectorPadding:0,cornerRadius:0,paletteItem:null};t.datavisualization.Diagram.NodeBase=function(i){var r;if(i.expandIcon&&(i.expandIcon=t.datavisualization.Diagram.expandIcon(i.expandIcon?i.expandIcon:{})),i.collapseIcon&&(i.collapseIcon=t.datavisualization.Diagram.collapseIcon(i.collapseIcon?i.collapseIcon:{})),i.labels)for(r=0;r<i.labels.length;r++)i.labels[r]=t.datavisualization.Diagram.Label(i.labels[r]);if(i.ports)for(r=0;r<i.ports.length;r++)i.ports[r]=t.datavisualization.Diagram.Port(i.ports[r]);return i.paletteItem=t.datavisualization.Diagram.PaletteItem(i.paletteItem?i.paletteItem:{}),n.extend(!0,{},t.datavisualization.Diagram.NodeBaseDefaults,i)};t.datavisualization.Diagram.NodeDefaults={fillColor:"white",borderColor:"black",borderWidth:1,borderDashArray:"",opacity:1,gradient:null,type:t.datavisualization.Diagram.Shapes.Basic,isExpanded:!0,shadow:t.datavisualization.Diagram.Shadow(),cssClass:""};t.datavisualization.Diagram.Node=function(i){return i=i||{},i.container&&n.isEmptyObject(i.container)&&(i.container=null),(i.linearGradient||i.radialGradient)&&(i.gradient=i.linearGradient||i.radialGradient),i.gradient&&(i.gradient.type==="linear"?i.gradient=t.datavisualization.Diagram.LinearGradient(i.gradient):i.gradient.type==="radial"&&(i.gradient=t.datavisualization.Diagram.RadialGradient(i.gradient))),i.shadow&&(i.shadow=t.datavisualization.Diagram.Shadow(i.shadow)),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i&&!i.name&&(i.name="node_"+t.datavisualization.Diagram.Util.randomId()),i.minWidth=i.minWidth?i.minWidth:0,i.minHeight=i.minHeight?i.minHeight:0,i.maxWidth=i.maxWidth?i.maxWidth:0,i.maxHeight=i.maxHeight?i.maxHeight:0,i.width||i._width||(i._width=i.minWidth?i.minWidth:i.maxWidth),i.height||i._height||(i._height=i.minHeight?i.minHeight:i.maxHeight),i._hidePorts&&(i.ports=[]),n.extend(!0,{},t.datavisualization.Diagram.NodeDefaults,t.datavisualization.Diagram.NodeBase(i),t.datavisualization.Diagram.Shape(i))};t.datavisualization.Diagram.ConnectorDefaults={name:"",visible:!0,lineDashArray:"",targetDecorator:{shape:t.datavisualization.Diagram.DecoratorShapes.Arrow,width:8,height:8,borderColor:"black",fillColor:"black",pathData:""},sourceDecorator:{shape:t.datavisualization.Diagram.DecoratorShapes.Arrow,width:8,height:8,borderColor:"black",fillColor:"black",pathData:""},shape:undefined,segments:[t.datavisualization.Diagram.Segment({type:"straight"})],sourcePoint:t.datavisualization.Diagram.Point(),targetPoint:t.datavisualization.Diagram.Point(),lineColor:"black",lineWidth:1,constraints:t.datavisualization.Diagram.ConnectorConstraints.Default,opacity:1,parent:"",labels:[],zOrder:-1,lineHitPadding:10,addInfo:{},targetNode:null,targetPort:null,sourceNode:null,sourcePort:null,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,horizontalAlign:t.datavisualization.Diagram.HorizontalAlignment.Left,verticalAlign:t.datavisualization.Diagram.VerticalAlignment.Top,cornerRadius:0,bridgeSpace:10,sourcePadding:0,targetPadding:0,type:"connector",cssClass:""};t.datavisualization.Diagram.Connector=function(i){if(i=i||{},i.name=i.name?i.name:t.datavisualization.Diagram.Util.randomId(),i.targetDecorator=t.datavisualization.Diagram.Decorator(i.targetDecorator||{}),i.sourceDecorator=t.datavisualization.Diagram.Decorator(i.sourceDecorator&&!n.isEmptyObject(i.sourceDecorator)?i.sourceDecorator:{shape:t.datavisualization.Diagram.DecoratorShapes.None}),i.segments=i.segments||[t.datavisualization.Diagram.Segment({type:"straight"})],i._srcDecoratorSize=Math.max(parseInt(i.sourceDecorator.height),parseInt(i.sourceDecorator.width))+5*i.sourceDecorator.borderWidth,i._tarDecoratorSize=Math.max(parseInt(i.targetDecorator.height),parseInt(i.targetDecorator.width))+5*i.targetDecorator.borderWidth,i._inlineDecorators=[],i.segments&&(i.sourcePoint=i.sourcePoint||t.datavisualization.Diagram.Point(),i.targetPoint=i.targetPoint||t.datavisualization.Diagram.Point(),t.datavisualization.Diagram.Util._initializeSegments(i,i.defaultType)),i.labels)for(var r=0;r<i.labels.length;r++)i.labels[r]=t.datavisualization.Diagram.Label(i.labels[r]);return i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i.paletteItem=t.datavisualization.Diagram.PaletteItem(i.paletteItem?i.paletteItem:{}),n.extend(!0,{},t.datavisualization.Diagram.ConnectorDefaults,i)};t.datavisualization.Diagram.ContainerDefaults={type:t.datavisualization.Diagram.ContainerType.Canvas,orientation:"vertical"};t.datavisualization.Diagram.Container=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ContainerDefaults,i)};t.datavisualization.Diagram.GroupDefaults={children:[],canUngroup:!0,allowDrop:!0,container:null,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,minWidth:100,maxWidth:Number.POSITIVE_INFINITY,minHeight:100,maxHeight:Number.POSITIVE_INFINITY,type:"group"};t.datavisualization.Diagram.Group=function(i){return i=i?i:{},i.type=="bpmn"&&(i=t.datavisualization.Diagram.Node(i)),i.minWidth=i.minWidth?i.minWidth:100,i.minHeight=i.minHeight?i.minHeight:100,i.maxWidth=i.maxWidth?i.maxWidth:Number.POSITIVE_INFINITY,i.maxHeight=i.maxHeight?i.maxHeight:Number.POSITIVE_INFINITY,i.container=i.container?t.datavisualization.Diagram.Container(i.container):null,i.fillColor=i.fillColor?i.fillColor:"transparent",i.borderColor=i.borderColor?i.borderColor:"transparent",i&&!i.name&&(i.name="group_"+t.datavisualization.Diagram.Util.randomId()),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i._type||i.type=="umlclassifier"||(i._type=i.type?i.type:"group"),n.extend(!0,{},t.datavisualization.Diagram.NodeDefaults,t.datavisualization.Diagram.GroupDefaults,t.datavisualization.Diagram.NodeBase(i))};t.datavisualization.Diagram.ZoomCommand={ZoomIn:1,ZoomOut:2};t.datavisualization.Diagram.Zoom=function(i){return n.extend(!0,{},{zoomFactor:.2,focusPoint:null,zoomCommand:t.datavisualization.Diagram.ZoomCommand.ZoomIn},i)};t.datavisualization.Diagram.DragState={Starting:"starting",Dragging:"dragging",Completed:"completed"};t.datavisualization.Diagram.ResizeState={Starting:"starting",Resizing:"resizing",Completed:"completed"};t.datavisualization.Diagram.DiagramConstraints={None:1,UserInteraction:2,APIUpdate:4,PageEditable:6,Bridging:8,Zoomable:16,PannableX:32,PannableY:64,Pannable:96,Undoable:128,Resizable:256,ZoomTextEditor:512,FloatElements:1024,CrispEdges:2048,Default:502};t.datavisualization.Diagram.BridgeDirection={Top:"top",Bottom:"bottom",Left:"left",Right:"right"};t.datavisualization.Diagram.Tool={None:1,SingleSelect:2,MultipleSelect:4,ZoomPan:8,DrawOnce:16,ContinuesDraw:32};t.datavisualization.Diagram.Region={Content:"content",PageSettings:"pageSettings"};t.datavisualization.Diagram.FileFormats={JPG:"jpg",PNG:"png",BMP:"bmp",SVG:"svg"};t.datavisualization.Diagram.ExportModes={Download:"download",Data:"data"};t.datavisualization.Diagram.FitMode={Page:"page",Width:"width",Height:"height"};t.datavisualization.Diagram.Stretch={None:"none",Fill:"fill",Uniform:"uniform",UniformToFill:"uniformtofill"};t.datavisualization.Diagram.shapeType={Image:"image",Path:"path",Native:"native"};t.datavisualization.Diagram.UserHandleDefaults={name:"",pathData:"",templateId:"",source:"",shape:t.datavisualization.Diagram.shapeType.Path,borderColor:"",backgroundColor:"#2382c3",position:t.datavisualization.Diagram.UserHandlePositions.BottomCenter,pathColor:"white",tool:"",size:20,visible:!0,enableMultiSelection:!1};t.datavisualization.Diagram.UserHandle=function(i){return n.extend(!0,{},t.datavisualization.Diagram.UserHandleDefaults,i)};t.datavisualization.Diagram.SwimLaneDefaults={header:n.extend(!0,{},t.datavisualization.Diagram.LabelDefaults,{text:"Title",borderColor:"black",fillColor:"#C7D4DF",horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Stretch,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Stretch}),fillColor:"transparent",orientation:"vertical",type:"group",isSwimlane:!0,offsetX:100,offsetY:100,minHeight:100,maxHeight:Number.POSITIVE_INFINITY,minWidth:100,maxWidth:Number.POSITIVE_INFINITY,height:100,width:100,lanes:[],phases:[],phaseSize:20,constraints:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~(t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest),addInfo:{},cssClass:""};t.datavisualization.Diagram.SwimLane=function(i){return i=i||{},i&&!i.name&&(i.name="swimlane_"+t.datavisualization.Diagram.Util.randomId()),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i.header||(i.header={}),i.header.height=i.header.height?i.header.height:50,i.header.width=i.header.width?i.header.width:50,n.extend(!0,{},t.datavisualization.Diagram.SwimLaneDefaults,i)};t.datavisualization.Diagram.LaneDefaults={header:n.extend(!0,{},t.datavisualization.Diagram.LabelDefaults,{text:"Function",borderColor:"black",fillColor:"#C7D4DF",horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Stretch,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Stretch}),name:"",children:[],isLane:!0,orientation:"horizontal",fillColor:"#f5f5f5",labels:[],addInfo:{},minHeight:100,minWidth:100,maxHeight:Number.POSITIVE_INFINITY,maxWidth:Number.POSITIVE_INFINITY,constraints:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,cssClass:""};t.datavisualization.Diagram.Lane=function(i){return i=i||{},i&&!i.name&&(i.name="lane_"+t.datavisualization.Diagram.Util.randomId()),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),n.extend(!0,{},t.datavisualization.Diagram.LaneDefaults,i)};t.datavisualization.Diagram.PhaseDefaults={name:"",type:"phase",offset:100,lineWidth:1,lineDashArray:"3,3",lineColor:"#606060",parent:"",fillColor:"white",orientation:"horizontal",label:{text:"Phase"}};t.datavisualization.Diagram.Phase=function(i){return i.label&&(i.label=t.datavisualization.Diagram.Label(i.label),i.label.text=i.label.text?i.label.text:"Phase"),n.extend(!0,{},t.datavisualization.Diagram.PhaseDefaults,i)};t.datavisualization.Diagram.PaletteItemDefaults={width:undefined,height:undefined,enableScale:!0,previewHeight:undefined,previewWidth:undefined,wrapping:t.datavisualization.Diagram.TextWrapping.NoWrap,label:null,margin:t.datavisualization.Diagram.Margin({left:4,right:4,top:4,bottom:4})};t.datavisualization.Diagram.PaletteItem=function(i){return n.extend(!0,{},t.datavisualization.Diagram.PaletteItemDefaults,i)};t.datavisualization.Diagram.SwimLaneHelper={_initSwimLane:function(i,r,u){var f=null,b=null,i=t.datavisualization.Diagram.SwimLane(i),k,s,e,a,v,o;i.orientation=i.orientation?i.orientation:"vertical";k=this._initphases(i,r);b=this._initLanes(i,r,u);s=[];e=null;i.header||(i.header={text:"",height:0,fillColor:"white"});i.orientation==="horizontal"?a=i.header.height:v=i.header.width;i.header&&(e=t.datavisualization.Diagram.Node({_type:"node",_isHeader:!0,name:i.name+"_header_swimlane",labels:[i.header],height:a?a:50,width:v?v:50,fillColor:i.header.fillColor?i.header.fillColor:"white",rotateAngle:0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,horizontalAlign:"stretch",parent:i.name}));e&&(r.nodes().push(e),r._nodes=n.extend(!0,[],r.nodes()),r.nameTable[e.name]=e,s.push(e.name));o=null;o=i.phaseSize==0?.001:i.phaseSize?i.phaseSize:20;var tt=this._initPhaseStack(i,r,s,o),g=null,nt=null;i.orientation=="vertical"?nt="stretch":g="stretch";var y,d=0,p=0,w=0;i.orientation=="horizontal"?(y="vertical",p=(i.header?i.header.height:50)+o,w=0):(y="horizontal",p=i.header?i.header.height:50,d=i.phaseSize?i.phaseSize:o,w=(i.header?i.header.height:50)+o);var h=t.datavisualization.Diagram.Group({name:i.name+"_stack",children:b,parent:i.name,container:{type:t.datavisualization.Diagram.ContainerType.Stack,orientation:y},horizontalAlign:"stretch",verticalAlign:"stretch",marginTop:p,width:10,height:10,marginLeft:d,minHeight:w,constraints:t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Select|t.datavisualization.Diagram.NodeConstraints.Connect)}),c=0,l=0;return i.orientation=="horizontal"?(c=i.width,l=100):i.orientation=="vertical"&&(c=100,l=i.height-e.height),r.nodes().push(h),r._nodes=n.extend(!0,[],r.nodes()),r.nameTable[h.name]=h,s.push(h.name),f=t.datavisualization.Diagram.Group({name:i.name?i.name:"",type:"group",addInfo:i.addInfo?i.addInfo:{},parent:"",offsetX:i.offsetX?i.offsetX:100,offsetY:i.offsetY?i.offsetY:100,children:s,zOrder:i.zOrder||i.zOrder===0?i.zOrder:-1,fillColor:"transparent",labels:[{mode:t.datavisualization.Diagram.LabelEditMode.View}],container:{type:t.datavisualization.Diagram.ContainerType.Canvas},minHeight:l?l:100,maxHeight:i.maxHeight?i.maxHeight:Number.POSITIVE_INFINITY,minWidth:c?c:100,maxWidth:i.maxWidth?i.maxWidth:Number.POSITIVE_INFINITY,constraints:i.constraints?i.constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.AllowDrop^t.datavisualization.Diagram.NodeConstraints.ResizeNorth^t.datavisualization.Diagram.NodeConstraints.ResizeWest^t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest^t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast^t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest,phaseSize:o,cssClass:i.cssClass}),f.isSwimlane=!0,f.phases=k,f.orientation=i.orientation,f.constraints=f.orientation=="horizontal"?f.constraints^t.datavisualization.Diagram.NodeConstraints.ResizeEast^t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast:f.constraints^t.datavisualization.Diagram.NodeConstraints.ResizeSouth^t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast,f},_initPhaseStack:function(i,r,u,f){var c="horizontal",y="left",p="top",l,h,v,e,o;c&&(i.orientation=="horizontal"?(c="horizontal",y="stretch",l=!0):(c="vertical",p="stretch",l=!1));var s=t.datavisualization.Diagram.Group({name:i.name+"phaseStack",container:{type:"stack",orientation:c},type:"group",parent:i.name,offsetX:0,offsetY:0,minHeight:f,maxHeight:f,minWidth:f,maxWidth:f,marginTop:i.header?i.header.height:50,isPhaseStack:!0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect}),a=0;for(i.phaseSize&&(i.phaseSize=i.phaseSize<1?20:i.phaseSize),e=0;e<i.phases.length;e++)l?(h=i.phaseSize?i.phaseSize:20,v=i.phases[e].offset-a):(h=i.phases[e].offset-a,e==0&&(h=h-(i.header?i.header.height:50)),v=i.phaseSize?i.phaseSize:20,i.phases[e].label&&(i.phases[e].label.rotateAngle=270)),o=t.datavisualization.Diagram.Node({parent:i.name+"phaseStack",_isHeader:!0,name:"phaseStack"+i.phases[e].name,height:h,width:v,labels:[i.phases[e].label],constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect}),o.labels[0].name="phaseStack"+i.phases[e].name+"label",o.labels[0].mode=t.datavisualization.Diagram.LabelEditMode.View,o.isPhase=!0,a=i.phases[e].offset,r.nameTable[o.name]=o,s.children.push(o.name),r.nodes().push(o),r._nodes=n.extend(!0,[],r.nodes());r.nodes().push(s);r._nodes=n.extend(!0,[],r.nodes());u.push(s);r.nameTable[s.name]=s},_setDefaultLaneProperties:function(n){n.lanes=n.lanes?n.lanes:[];n.lanes.push(t.datavisualization.Diagram.Lane({}))},_initLanes:function(i,r,u){var o=[],e=null,f;if(i.lanes&&i.lanes.length!==0||this._setDefaultLaneProperties(i),i.lanes)for(f=0;f<i.lanes.length;f++)jQuery.isEmptyObject(i.lanes[f])&&(i.lanes[f]=t.datavisualization.Diagram.Lane()),i.lanes[f]._laneHeader=i.lanes[f]._laneHeader?i.lanes[f]._laneHeader:i.lanes[f].header,e=this._initLane(i.lanes[f],i,r,u),o.push(e.name),r.nodes().push(e),r._nodes=n.extend(!0,[],r.nodes()),r.nameTable[e.name]=e;return o},_initLane:function(i,r,u,f){var c=null,l=null,y,e,s,v,o,a,h;if(r.orientation=="horizontal"?c="stretch":l="stretch",y=!1,e=t.datavisualization.Diagram.Group({name:i.name,addInfo:i.addInfo?i.addInfo:{},type:"group",isLane:!0,parent:r.name+"_stack",offsetX:0,offsetY:0,borderColor:i.borderColor?i.borderColor:"black",orientation:r.orientation?r.orientation:"horizontal",fillColor:i.fillColor,container:{type:t.datavisualization.Diagram.ContainerType.Canvas},horizontalAlign:c?c:"left",verticalAlign:l?l:"top",minHeight:i.height?i.height:100,maxHeight:i.maxHeight?i.maxHeight:Number.POSITIVE_INFINITY,minWidth:i.width?i.width:100,maxWidth:i.maxWidth?i.maxWidth:Number.POSITIVE_INFINITY,paddingTop:20,paddingRight:20,paddingBottom:20,paddingLeft:20,constraints:i.constraints?i.constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,cssClass:i.cssClass}),i.labels&&i.labels.length>0){for(s=0;s<i.labels.length;s++)i.labels[s]=t.datavisualization.Diagram.Label(i.labels[s]);e.labels=i.labels}for(f||(v=i._laneHeader?i._laneHeader:null,o=this._iniLaneHeader(i,e.name,r,u,v),o&&(u.nodes().push(o),u._nodes=n.extend(!0,[],u.nodes()),u.nameTable[o.name]=o,e.children.push(o.name))),a=this._initChildren(i,e.name,u),h=0;h<a.length;h++)e.children.push(a[h]);return e},_iniLaneHeader:function(n,i,r,u,f){var e=null;return n.header&&(e=t.datavisualization.Diagram.Node({_isHeader:!0,name:i+"_Headerr_",type:"node",labels:[r.header],height:f.height?f.height:50,width:f.width?f.width:50,fillColor:n.header.fillColor?n.header.fillColor:"white",rotateAngle:0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,marginLeft:-20,marginTop:-20,marginRight:-20,marginBottom:-20,parent:i}),r.orientation&&r.orientation=="horizontal"?(e.verticalAlign="stretch",e.height=1,e.width=f.width?f.width:50):r.orientation&&r.orientation=="vertical"&&(e.horizontalAlign="stretch",e.labels[0].rotateAngle=0,e.height=f.width?f.width:50,e.width=1)),e},_initChildren:function(t,i,r){var o=[],u=null,f,e;if(t.children)for(f=0;f<t.children.length;f++)u=typeof t.children[f]=="object"?t.type&&t.type==="bpmn"?t.children[f]:this._initChild(t.children[f],i,r):r.nameTable[t.children[f]],u&&(u.segments?(r.connectors().push(u),r._connectors=n.extend(!0,[],r.connectors())):(u.children&&(e=this._initChildren(u,u.name,r)),e&&(u.children=e),r.nodes().push(u),r._nodes=n.extend(!0,[],r.nodes())),o.push(u.name),r.nameTable[u.name]=u);return o},_initChild:function(n,i,r){var u=null;return u=n&&n.children&&n.children.length>0?r._getNewGroup(t.datavisualization.Diagram.NodeType(n,r)):r._getNewNode(t.datavisualization.Diagram.NodeType(n,r)),u.parent=i,u},_swapPhaseSize:function(n){if(n.phases.length>0)for(var i=n.phases,t,u,r=0;r<i.length;r++)for(t=0;t<i.length-r-1;t++)i[t].offset>i[t+1].offset&&(u=i[t],i[t]=i[t+1],i[t+1]=u)},_setSwimlaneSize:function(n){var t,i;if(n.phases.length>0)for(i in n.phases)t=n.phases[i],n.orientation==="horizontal"?t.offset>n.width&&(n.width=t.offset):t.offset>n.height&&(n.height=t.offset)},_setLastPhaseSize:function(n){if(n.phases.length>0){var t=n.phases[n.phases.length-1];t.offset=n.orientation==="horizontal"?n.width:n.height}},_NeedDefaultPhase:function(n){return n.phases.length>0?!1:!0},_checkForDefPhase:function(n){return n.phases.length>0?!1:!0},_initphases:function(n,i){var e=[],r=null,o=0,f=0,s,u;if(n.orientation==="vertical"?(f=n.height,o=270):f=n.width,s=t.datavisualization.Diagram.Phase({name:n.name+"defPhase",offset:f,label:n._lastPhase?n._lastPhase.labels[0]:{text:"Phase",rotateAngle:o}}),this._NeedDefaultPhase(n)?n.phases.push(s):(this._swapPhaseSize(n),this._setSwimlaneSize(n),this._setLastPhaseSize(n)),n.phases&&n.phases.length>0)for(u=0;u<n.phases.length;u++)r=t.datavisualization.Diagram.Phase(n.phases[u]),r.parent=n.name,r.orientation=n.orientation,i.nameTable[r.name]=r,e.push(r.name);return e},_createSwimlane:function(n,i,r,u,f){var l=[],a=r?r.childTable:i.nameTable,o=500,s=500,h=null,p=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,e,c,v,y;return n.children[0]?(e=u?n.children[0]:a[n.children[0]],e||(e=f),typeof e=="string"&&(e=a[e]),h={text:"Title",width:50,fillColor:e.fillColor?e.fillColor:n.fillColor,height:50}):h={text:"Title",width:50,fillColor:"white",height:50},n.orientation||n.container&&(n.orientation=n.container.orientation),c=0,n.orientation=="horizontal"&&i._selectedSymbol?(o=n.height?n.height:100,s=n.width?n.width:650,c=o):(o=n.height?n.height:650,s=n.width?n.width:100,c=n.height+h.height),n.children.length>1&&(n.children.splice(0,0),l=n.children),v={name:n.name+t.datavisualization.Diagram.Util.randomId(),header:h,fillColor:"white",isSwimlane:!0,minWidth:s,minHeight:o,height:c+1,width:s+1,maxHeight:o+Number.POSITIVE_INFINITY,maxWidth:s+Number.POSITIVE_INFINITY,offsetX:n.offsetX,offsetY:n.offsetY,orientation:n.orientation?n.orientation:"horizontal",addInfo:n.addInfo?n.addInfo:null,paletteItem:n.paletteItem?n.paletteItem:null,lanes:[{name:n.name,addInfo:n.addInfo?n.addInfo:{},constraints:p,header:{text:e.labels[0].text?e.labels[0].text:"HEADER",fontSize:e.labels[0].fontSize?e.labels[0].fontSize:11,width:e.width?e.width:50,height:e.height?e.height:50,fillColor:e.fillColor,bold:e.labels[0].bold?!0:!1,italic:e.labels[0].italic?!0:!1,fontFamily:e.labels[0].fontFamily?e.labels[0].fontFamily:"Arial",fontColor:e.labels[0].fontColor?e.labels[0].fontColor:"black"},fillColor:n.fillColor?n.fillColor:"white",height:o,width:s,minHeight:o,minWidth:s,children:l?l:[],_laneHeader:n._laneHeader?n._laneHeader:null},]},y=t.datavisualization.Diagram.ContainerHelper._initContainer(i,v),y},_createDiagramLane:function(n){var i=n._lane?n._lane:null,r=n.orientation,f=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,u={children:[{name:n.name+"_Headerr_",height:i.header?i.header.height:50,width:i.header?i.header.width:50,fillColor:i.header?i.header.fillColor:50,labels:i.header?[i.header]:[],horizontalAlign:r==="vertical"?"stretch":"left",verticalAlign:r==="vertical"?"top":"stretch"}],container:{type:"canvas"},name:n.name?n.name:t.datavisualization.Diagram.Util.randomId(),minHeight:i.minHeight?i.minHeight:100,minWidth:i.minWidth?i.minWidth:100,maxHeight:Number.POSITIVE_INFINITY,maxWidth:Number.POSITIVE_INFINITY,borderColor:"black",constraints:f|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,cssClass:i.cssClass?i.cssClass:"",addInfo:i.addInfo?i.addInfo:null,paletteItem:n.paletteItem?n.paletteItem:null,fillColor:i.fillColor?i.fillColor:"white",isLane:!0,offsetX:n.offsetX?n.offsetX:100,offsetY:n.offsetY?n.offsetY:100};return u.children[0].labels[0].rotateAngle=r==="horizontal"?270:0,u},_createPaletteLane:function(n,i){var r=0,u=0,f=0,e=0,l=0,a="left",c=0,v,y,h,s,o;return n=t.datavisualization.Diagram.Lane(n),v=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,!n.paletteItem||n.paletteItem.enableScale||n.paletteItem.width||n.orientation==="horizontal"&&(c+=2),n.orientation=="horizontal"?(r=n.height?n.height:50,u=25,f=14+c,e=r/2+1,l=270,a="left"):n.orientation=="vertical"&&(r=25,u=n.width?n.width:50,f=u/2,e=15,a="left"),y=n.header.text?n.header.text:"",h=t.datavisualization.Diagram.Node({name:n.name+"_"+y,_type:"node",labels:[{text:n.header.text?n.header.text:"Function",fontSize:n.header.fontSize?n.header.fontSize:11,offset:{x:.5,y:.5},width:100,rotateAngle:l}],height:r,width:u,fillColor:n.header.fillColor?n.header.fillColor:"white",parent:n.name,offsetX:f,offsetY:e,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Connect}),i[h.name]=h,n.orientation=="horizontal"?(r=n.height,u=n.width-25,f=25+u/2+c,e=r/2+1):n.orientation=="vertical"&&(r=n.height-25,u=n.width,f=u/2,e=25+r/2),s=t.datavisualization.Diagram.Node({name:n.name+"content",_type:"node",height:r,width:u,fillColor:n.fillColor?n.fillColor:"white",parent:n.name,offsetX:f,offsetY:e}),s._laneHeader=n.header,i[s.name]=s,o=t.datavisualization.Diagram.Group({name:n.name+"_group",addInfo:n.addInfo?n.addInfo:{},height:n.height,width:n.width,header:n.header?n.header:null,offsetX:n.offsetX,offsetY:n.offsetY,children:[h.name,s.name,],paletteItem:n.paletteItem?n.paletteItem:null}),o._lane=n,o.constraints=v,o.isLane=!0,o.orientation=n.orientation,o},_mapObject:function(n,t,i,r){var u;switch(i){case"lane":u=this._mapLane(n,t);break;case"phase":u=this._mapPhase(n,t);break;case"swimlane":u=this._mapSwimlane(n,t,r)}return u},_mapLane:function(n,i,r){var u=t.datavisualization.Diagram.Lane();return this._mapLaneHeader(n,i,u,r),this._mapChildren(n,i,u,r),u.name=i.name,u.labels=i.labels,u.fillColor=i.fillColor,u.orientation=i.orientation,u.maxHeight=i.maxHeight,u.maxWidth=i.maxWidth,u.minHeight=i.height>i.minHeight?i.height:i.minHeight,u.minWidth=i.width>i.minWidth?i.width:i.minWidth,u.constraints=i.constraints,u.addInfo=i.addInfo?i.addInfo:{},i.orientation==="horizontal"?(u.height=i.height,u.width=null):(u.height=null,u.width=i.width),u},_mapLaneHeader:function(n,t,i,r){var u;t.children[0]&&(u=n.nameTable[n._getChild(t.children[0])]);!u&&r&&(u=r[n._getChild(t.children[0])]);u&&(u.labels&&u.labels[0]&&(i.header.text=u.labels[0].text,i.header.fontColor=u.labels[0].fontColor,i.header.fontSize=u.labels[0].fontSize,i.header.fontFamily=u.labels[0].fontFamily,i.header.bold=u.labels[0].bold,i.header.italic=u.labels[0].italic,i.header.textDecoration=u.labels[0].textDecoration,i.header.rotateAngle=u.labels[0].rotateAngle,i.header.textOverflow=u.labels[0].textOverflow,i.header.overflowType=u.labels[0].overflowType),i.header.fillColor=u.fillColor,t.orientation==="vertical"?(i.header.height=u.height,i.header.width=null):(i.header.height=null,i.header.width=u.width))},_mapChildren:function(n,t,i,r){var u,f;if(t.children&&t.children.length>=2)for(f=1;f<t.children.length;f++)n._getChild(t.children[f])&&(u=n.nameTable[n._getChild(t.children[f])]),r&&!u&&(u=r[n._getChild(t.children[f])]),u&&(u.marginRight=0,u.marginBottom=0,i.children.push(u))},_mapSwimlane:function(n,i,r){var u=t.datavisualization.Diagram.SwimLane();return this._mapSwimlaneHeader(n,i,u,r),this._mapLanes(n,i,u,r),this._mapPhases(n,i,u,r),u.name=i.name,u.orientation=i.orientation,u.offsetX=i.offsetX,u.offsetY=i.offsetY,u.maxHeight=i.maxHeight,u.maxWidth=i.maxWidth,u.minHeight=i.minHeight,u.minWidth=i.minWidth,u.minWidth=u.orientation==="horizontal"?i.width&&i.minWidth&&i.width>i.minWidth?i.width:i.minWidth:i.minWidth,u.phaseSize=i.phaseSize,u.constraints=i.constraints,u.zOrder=i.zOrder,u.addInfo=i.addInfo?i.addInfo:{},u.height=i.height,u.width=i.width,u},_mapSwimlaneHeader:function(n,t,i,r){if(t.children[0])var u=n.nameTable[n._getChild(t.children[0])];!u&&r&&(u=r[n._getChild(t.children[0])]);u&&(u.labels&&u.labels[0]&&(i.header.text=u.labels[0].text,i.header.fontColor=u.labels[0].fontColor,i.header.fontSize=u.labels[0].fontSize,i.header.fontFamily=u.labels[0].fontFamily,i.header.bold=u.labels[0].bold,i.header.italic=u.labels[0].italic,i.header.textDecoration=u.labels[0].textDecoration,i.header.textOverflow=u.labels[0].textOverflow,i.header.overflowType=u.labels[0].overflowType),i.header.fillColor=u.fillColor,i.header.height=u.height,i.header.width=u.width)},_mapLanes:function(n,t,i,r){var u,e,o,f;if(t.children[2]&&n._getChild(t.children[2])&&(u=r?r[n._getChild(t.children[2])]:n.nameTable[n._getChild(t.children[2])]),u&&u.children&&u.children.length>0)for(f=0;f<u.children.length;f++)n._getChild(u.children[f])&&(e=r?r[n._getChild(u.children[f])]:n.nameTable[n._getChild(u.children[f])]),e&&(o=this._mapLane(n,e,r),o&&i.lanes.push(o))},_mapPhases:function(n,i,r,u){var f=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i,u),s,e,h,o,c;if(f&&f.length>0){for(s=f.length,e=u?u:n.nameTable,f[f.length-1]&&e[f[f.length-1]]&&(h=e[f[f.length-1]],h.name.split("defPhase").length>1||h.offset==i.width||s++),o=0;o<s;o++)c=this._mapPhase(n,e[n._getChild(f[o])],u),c&&r.phases.push(c);e["phaseStack"+f[f.length-1]]&&(r._lastPhase=this._mapPhase(n,e["phaseStack"+f[f.length-1]],u))}},_mapPhase:function(n,t,i){var r;return t&&(r=i?i[t.name]:n.nameTable[t.name]),r?r:null},_getSwimLaneNode:function(n,t,i,r){if(n.isSwimlane)if(i){if(r.nameTable[r._getChild(n.children[2])].container.orientation==t.orientation)return n}else if(r.nameTable[r._getChild(n.children[2])].container.orientation!=t.orientation)return n;if(n.parent){var u=r.nameTable[n.parent];if(u)return this._getSwimLaneNode(u,t,undefined,r)}return null}}}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.BasicShapes={Rectangle:"rectangle",Ellipse:"ellipse",Path:"path",Polygon:"polygon",Triangle:"triangle",Plus:"plus",Star:"star",Pentagon:"pentagon",Heptagon:"heptagon",Octagon:"octagon",Trapezoid:"trapezoid",Decagon:"decagon",RightTriangle:"righttriangle",Cylinder:"cylinder"};t.datavisualization.Diagram.FlowShapes={Process:"process",Decision:"decision",Document:"document",PreDefinedProcess:"predefinedprocess",Terminator:"terminator",PaperTap:"papertap",DirectData:"directdata",SequentialData:"sequentialdata",Sort:"sort",MultiDocument:"multidocument",Collate:"collate",SummingJunction:"summingjunction",Or:"or",InternalStorage:"internalstorage",Extract:"extract",ManualOperation:"manualoperation",Merge:"merge",OffPageReference:"offpagereference",SequentialAccessStorage:"sequentialaccessstorage",Annotation1:"annotation1",Annotation2:"annotation2",Data:"data",Card:"card"};t.datavisualization.Diagram.ArrowShapes={None:"none",CircularArrow:"circulararrow",CurvedRightArrow:"curvedrightarrow",CurvedUpArrow:"curveduparrow",CurvedLeftArrow:"curvedleftarrow",CurvedDownArrow:"curveddownarrow",JumpingRightArrow:"jumpingrightarrow",JumpingLeftArrow:"jumpingleftarrow"};t.datavisualization.Diagram.BPMNShapes={Event:"event",Gateway:"gateway",Message:"message",DataObject:"dataobject",DataSource:"datasource",Activity:"activity",Group:"group"};t.datavisualization.Diagram.BPMNEvents={Start:"start",Intermediate:"intermediate",End:"end",NonInterruptingStart:"noninterruptingstart",NonInterruptingIntermediate:"noninterruptingintermediate",ThrowingIntermediate:"throwingintermediate"};t.datavisualization.Diagram.BPMNTriggers={None:"none",Message:"message",Timer:"timer",Escalation:"escalation",Link:"link",Error:"error",Compensation:"compensation",Signal:"signal",Multiple:"multiple",Parallel:"parallel",Cancel:"cancel",Conditional:"conditional",Terminate:"terminate"};t.datavisualization.Diagram.BPMNGateways={None:"none",Exclusive:"exclusive",Inclusive:"inclusive",Parallel:"parallel",Complex:"complex",EventBased:"eventbased",ExclusiveEventBased:"exclusiveeventbased",ParallelEventBased:"paralleleventbased"};t.datavisualization.Diagram.BPMNDataObjects={None:"none",Input:"input",Output:"output"};t.datavisualization.Diagram.BPMNActivity={None:"none",Task:"task",SubProcess:"subprocess"};t.datavisualization.Diagram.BPMNLoops={None:"none",Standard:"standard",ParallelMultiInstance:"parallelmultiinstance",SequenceMultiInstance:"sequencemultiinstance"};t.datavisualization.Diagram.BPMNTasks={None:"none",Service:"service",Receive:"receive",Send:"send",InstantiatingReceive:"instantiatingreceive",Manual:"manual",BusinessRule:"businessrule",User:"user",Script:"script",Parallel:"parallel"};t.datavisualization.Diagram.BPMNSubProcessTypes={None:"none",Transaction:"transaction",Event:"event"};t.datavisualization.Diagram.BPMNBoundary={Default:"default",Call:"call",Event:"event"};t.datavisualization.Diagram.BPMNAnnotationDirections={Top:"top",Left:"left",Right:"right",Bottom:"bottom"};t.datavisualization.Diagram.BPMNFlows={Sequence:"sequence",Association:"association",Message:"message"};t.datavisualization.Diagram.BPMNSequenceFlows={Normal:"normal",Conditional:"conditional",Default:"default"};t.datavisualization.Diagram.BPMNMessageFlows={Default:"default",InitiatingMessage:"initiatingmessage",NonInitiatingMessage:"noninitiatingmessage"};t.datavisualization.Diagram.ClassifierShapes={Package:"package",Class:"class",Interface:"interface",Enumeration:"enumeration",CollapsedPackage:"collapsedpackage",Inheritance:"inheritance",Association:"association",Aggregation:"aggregation",Composition:"composition",Realization:"realization",DirectedAssociation:"directedassociation",Dependency:"dependency"};t.datavisualization.Diagram.AssociationFlows={Default:"default",Directional:"directional",BiDirectional:"bidirectional"};t.datavisualization.Diagram.UMLActivityShapes={Action:"action",Decision:"decision",MergeNode:"mergenode",InitialNode:"initialnode",FinalNode:"finalnode",ForkNode:"forknode",JoinNode:"joinnode",TimeEvent:"timeevent",AcceptingEvent:"acceptingevent",SendSignal:"sendsignal",ReceiveSignal:"receivesignal",StructuredNode:"structurednode",Note:"note"};t.datavisualization.Diagram.UMLActivityFlow={Object:"object",Control:"control",Exception:"exception"};t.datavisualization.Diagram.BPMNEventDefaults={event:t.datavisualization.Diagram.BPMNEvents.Start,trigger:t.datavisualization.Diagram.BPMNTriggers.None,name:null,offset:t.datavisualization.Diagram.Point()};t.datavisualization.Diagram.BPMNGatewayDefaults={gateway:t.datavisualization.Diagram.BPMNGateways.None};t.datavisualization.Diagram.BPMNDataObject=function(i){return n.extend(!0,{},{type:t.datavisualization.Diagram.BPMNDataObjects.None,collection:!1},i)};t.datavisualization.Diagram.BPMNDataObjectDefaults={data:t.datavisualization.Diagram.BPMNDataObject()};t.datavisualization.Diagram.BPMNTaskDefaults={loop:t.datavisualization.Diagram.BPMNLoops.None,type:t.datavisualization.Diagram.BPMNTasks.None,call:!1,compensation:!1,events:[]};t.datavisualization.Diagram.BPMNTask=function(i){return n.extend(!0,{},t.datavisualization.Diagram.BPMNTaskDefaults,i)};t.datavisualization.Diagram.BPMNSubProcessDefaults={type:t.datavisualization.Diagram.BPMNSubProcessTypes.None,event:t.datavisualization.Diagram.BPMNEvents.Start,trigger:t.datavisualization.Diagram.BPMNTriggers.Message,boundary:t.datavisualization.Diagram.BPMNBoundary.Default,loop:t.datavisualization.Diagram.BPMNLoops.None,adhoc:!1,compensation:!1,collapsed:!0,events:[],processes:[]};t.datavisualization.Diagram.BPMNSubProcess=function(i){return n.extend(!0,{},t.datavisualization.Diagram.BPMNSubProcessDefaults,i)};t.datavisualization.Diagram.BPMNActivityDefaults={activity:t.datavisualization.Diagram.BPMNActivity.Task,task:t.datavisualization.Diagram.BPMNTask(),subProcess:t.datavisualization.Diagram.BPMNSubProcess()};t.datavisualization.Diagram.BPMNTextAnnotationDefaults={annotation:{width:20,height:20,angle:0,length:0,text:"",direction:t.datavisualization.Diagram.BPMNAnnotationDirections.Left}};t.datavisualization.Diagram.ConnectorShapeDefaults={type:"bpmn",flow:t.datavisualization.Diagram.BPMNFlows.Sequence,sequence:t.datavisualization.Diagram.BPMNSequenceFlows.Normal,association:t.datavisualization.Diagram.AssociationFlows.Default,message:t.datavisualization.Diagram.BPMNMessageFlows.Default};t.datavisualization.Diagram.Multiplicity={OneToOne:"onetoone",OneToMany:"onetomany",ManyToOne:"manytoone",ManyToMany:"manytomany"};t.datavisualization.Diagram.ClassifierMultiplicityDefault={type:t.datavisualization.Diagram.Multiplicity.OneToOne,source:{optional:!0,lowerBounds:null,upperBounds:null},target:{optional:!0,lowerBounds:null,upperBounds:null}};t.datavisualization.Diagram.UMLActivityFlowDefaults={type:"umlactivity",activityFlow:t.datavisualization.Diagram.UMLActivityFlow.Control};t.datavisualization.Diagram.AssociationDefaults={type:"classifier",association:t.datavisualization.Diagram.AssociationFlows.BiDirectional,multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.AggregationDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.CompositionDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.DependencyDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.RealizationDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.InheritanceDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.ScopeValueDefaults={Public:"public",Protected:"",Private:"",Package:""};t.datavisualization.Diagram.ClassMemberDefaults={name:"",value:""};t.datavisualization.Diagram.ClassAttributeDefaults={name:"",type:"",scope:t.datavisualization.Diagram.ScopeValueDefaults.Public};t.datavisualization.Diagram.ClassMethodsArgumentsDefault={name:"",type:""};t.datavisualization.Diagram.ClassMethodsDefaults={name:"",type:"",arguments:t.datavisualization.Diagram.ClassMethodsArgumentsDefault,scope:t.datavisualization.Diagram.ScopeValueDefaults.Public};t.datavisualization.Diagram.ClassmethodArguments=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassMethodsArgumentsDefault,i)};t.datavisualization.Diagram.ClassMethod=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassMethodsDefaults,i)};t.datavisualization.Diagram.ClassMember=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassMemberDefaults,i)};t.datavisualization.Diagram.ClassAttribute=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassAttributeDefaults,i)};t.datavisualization.Diagram.ClassifierClass=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassDefaults,i)};t.datavisualization.Diagram.ClassifierInterface=function(i){return n.extend(!0,{},t.datavisualization.Diagram.InterfaceDefaults,i)};t.datavisualization.Diagram.ClassifierEnumeration=function(i){return n.extend(!0,{},t.datavisualization.Diagram.EnumerationDefaults,i)};t.datavisualization.Diagram.UMLConnector=function(i){return n.extend(!0,{},t.datavisualization.Diagram.UMLConnectorDefaults,i)};t.datavisualization.Diagram.UMLConnectorAssociation=function(i){return n.extend(!0,{},t.datavisualization.Diagram.AssociationDefaults,i)};t.datavisualization.Diagram.UMLConnectorAggregation=function(i){return n.extend(!0,{},t.datavisualization.Diagram.AggregationDefaults,i)};t.datavisualization.Diagram.UMLConnectorComposition=function(i){return n.extend(!0,{},t.datavisualization.Diagram.CompositionDefaults,i)};t.datavisualization.Diagram.UMLConnectorDependency=function(i){return n.extend(!0,{},t.datavisualization.Diagram.DependencyDefaults,i)};t.datavisualization.Diagram.UMLConnectorRealization=function(i){return n.extend(!0,{},t.datavisualization.Diagram.RealizationDefaults,i)};t.datavisualization.Diagram.UMLConnectorInheritance=function(i){return n.extend(!0,{},t.datavisualization.Diagram.InheritanceDefaults,i)};t.datavisualization.Diagram.UMLConnectorMultiplicity=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassifierMultiplicityDefault,i)};t.datavisualization.Diagram.UMLActivityFlow=function(i){return n.extend(!0,{},t.datavisualization.Diagram.UMLActivityFlowDefaults,i)};t.datavisualization.Diagram.ClassDefaults={name:" ",attributes:[t.datavisualization.Diagram.ClassAttribute()],methods:[t.datavisualization.Diagram.ClassMethod()]};t.datavisualization.Diagram.InterfaceDefaults={name:" ",attributes:[t.datavisualization.Diagram.ClassAttribute()],methods:[t.datavisualization.Diagram.ClassMethod()]};t.datavisualization.Diagram.EnumerationDefaults={name:" ",members:[t.datavisualization.Diagram.ClassMember()]};t.datavisualization.Diagram.NodeType=function(i,r){if(!i._isInternalShape){var u=r.model.defaultSettings&&r.model.defaultSettings.node&&r.model.defaultSettings.node.type?r.model.defaultSettings.node.type:"",f=!i.isPhase&&r.model.defaultSettings&&r.model.defaultSettings.node?r.model.defaultSettings.node:{};i.type||i.children||i.isLane||i.isSwimlane||i.isPhase||i.isPhaseStack||(i.type=i.segments||i.sourceNode||i.sourcePort||i.sourcePoint||i.targetNode||i.targetPort||i.targetPoint?"connector":u?u:"basic");(i.isSwimlane||i.type=="swimlane")&&(i._type="group");(i.type=="basic"||i.type=="flow"||i.type=="arrow"||i.type=="bpmn"||i.type=="image"||i.type=="native"||i.type==="html"||i.type==="text"||i.type=="umlactivity")&&(r._isLoad&&(!r._isLoad||i._type)||(i._type="node"),i=n.extend(!0,{},f,i));r._isLoad||(i.type=="basic"?i=t.datavisualization.Diagram.BasicShape(i):i.type=="flow"?i=t.datavisualization.Diagram.FlowShape(i):i.type=="arrow"?i=t.datavisualization.Diagram.ArrowShape(i):i.type=="bpmn"?i=t.datavisualization.Diagram.BPMNShape(i):i.type=="umlclassifier"?i=t.datavisualization.Diagram.ClassifierShape(i,r):i.type=="umlactivity"&&(i=t.datavisualization.Diagram.UMLActivityShape(i,r)))}return i};t.datavisualization.Diagram.BasicShape=function(n){n._shape="path";n.shape||(n.shape="rectangle");switch(n.shape){case"rectangle":n._shape="rectangle";break;case"ellipse":n._shape="ellipse";break;case"path":n._shape="path";break;case"polygon":n._shape="polygon";break;case"triangle":n.pathData="M81.1582,85.8677L111.1582,33.9067L141.1582,85.8677L81.1582,85.8677z";break;case"plus":n.pathData="M696.6084,158.2656L674.8074,158.2656L674.8074,136.4656L658.4084,136.4656L658.4084,158.2656L636.6084,158.2656L636.6084,174.6646L658.4084,174.6646L658.4084,196.4656L674.8074,196.4656L674.8074,174.6646L696.6084,174.6646L696.6084,158.2656z";break;case"star":n.pathData="M540.3643,137.9336L546.7973,159.7016L570.3633,159.7296L550.7723,171.9366L558.9053,194.9966L540.3643,179.4996L521.8223,194.9966L529.9553,171.9366L510.3633,159.7296L533.9313,159.7016L540.3643,137.9336z";break;case"pentagon":n.pathData="M370.9702,194.9961L359.5112,159.7291L389.5112,137.9341L419.5112,159.7291L408.0522,194.9961L370.9702,194.9961z";break;case"heptagon":n.pathData="M223.7783,195.7134L207.1303,174.8364L213.0713,148.8034L237.1303,137.2174L261.1883,148.8034L267.1303,174.8364L250.4813,195.7134L223.7783,195.7134z";break;case"octagon":n.pathData="M98.7319,196.4653L81.1579,178.8923L81.1579,154.0393L98.7319,136.4653L123.5849,136.4653L141.1579,154.0393L141.1579,178.8923L123.5849,196.4653L98.7319,196.4653z";break;case"trapezoid":n.pathData="M127.2842,291.4492L95.0322,291.4492L81.1582,256.3152L141.1582,256.3152L127.2842,291.4492z";break;case"decagon":n.pathData="M657.3379,302.4141L642.3369,291.5161L636.6089,273.8821L642.3369,256.2481L657.3379,245.3511L675.8789,245.3511L690.8789,256.2481L696.6089,273.8821L690.8789,291.5161L675.8789,302.4141L657.3379,302.4141z";break;case"righttriangle":n.pathData="M836.293,292.9238L776.293,292.9238L776.293,254.8408L836.293,292.9238z";break;case"cylinder":n.pathData="M 542.802,362.009C 542.802,368.452 525.341,373.676 503.802,373.676C 482.263,373.676 464.802,368.452 464.802,362.009L 464.802,466.484C 464.802,472.928 482.263,478.151 503.802,478.151C 525.341,478.151 542.802,472.928 542.802,466.484L 542.802,362.016C 542.802,368.459 525.341,373.534 503.802,373.534C 482.263,373.534 464.802,368.31 464.802,361.867L 464.802,362.016C 464.802,355.572 482.263,350.349 503.802,350.349C 525.341,350.349 542.802,355.572 542.802,362.016"}return n};t.datavisualization.Diagram.FlowShape=function(n){n._shape="path";n.shape||(n.shape="process");var i=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default;n.constraints&t.datavisualization.Diagram.NodeConstraints.AspectRatio||(i=i|t.datavisualization.Diagram.NodeConstraints.AspectRatio);switch(n.shape){case"process":n.pathData="M419.511,76.687L359.511,76.687L359.511,43.086L419.511,43.086z";break;case"decision":n.pathData="M 253.005,115.687L 200.567,146.071L 148.097,115.687L 200.534,85.304L 253.005,115.687 Z";break;case"document":n.pathData="M 60 31.9 c 0 0 -11 -7.7 -30 0 s -30 0 -30 0 V 0 h 60 V 31.9 Z";break;case"predefinedprocess":n.pathData="M 0,0 L 50,0 L 50,50 L 0,50 Z M 8.333333333333334,0 L 8.333333333333334,50 M 41.66666666666667,0 L 41.66666666666667,50";break;case"terminator":n.pathData="M 269.711,29.3333C 269.711,44.061 257.772,56 243.044,56L 158.058,56C 143.33,56 131.391,44.061 131.391,29.3333L 131.391,29.3333C 131.391,14.6057 143.33,2.66669 158.058,2.66669L 243.044,2.66669C 257.772,2.66669 269.711,14.6057 269.711,29.3333 Z";break;case"papertap":n.pathData="M0.000976562,17.2042 L0.000976562,47.1654 C0.000976562,47.1654 14.403,53.5455 25.001,47.1654 C35.599,40.7852 44.403,43.5087 50.001,47.1654 L50.001,17.2042 M50.001,32.7987 L50.001,2.84052 C50.001,2.84052 35.599,-3.54271 25.001,2.84052 C14.403,9.22376 5.599,6.49418 0.000976562,2.84052 L0.000976562,32.7987";break;case"directdata":n.pathData="M 1477 613 L 1619 613 C 1627 613 1634 636 1634 665 C 1634 694 1627 717 1619 717 L 1477 717 C 1469 717 1461 694 1461 665 C 1461 636 1469 613 1477 613 ZM 1619 613 C 1610 613 1603 636 1603 665 C 1603 694 1610 717 1619 717M 1619 613 C 1610 613 1603 636 1603 665 C 1603 694 1610 717 1619 717";break;case"sequentialdata":n.pathData="M0.00297546,24.999 C0.00297546,11.1922 10.433,0.00216177 23.295,0.00216177 C36.159,0.00216177 46.585,11.1922 46.585,24.999 C46.585,38.8057 36.159,49.9979 23.295,49.9979 C10.433,49.9979 0.00297546,38.8057 0.00297546,24.999 z M23.294,49.999 L50.002,49.999";break;case"sort":n.pathData="M50.001,24.9971 L25.001,49.9971 L0.000976562,24.9971 L25.001,-0.00286865 L50.001,24.9971 z M0.000976562,24.9971 L50.001,24.9971";break;case"multidocument":n.pathData="M43.6826,40 C44.8746,40.6183 45.8586,41.3502 46.8366,42.1122 L46.8366,4.74487 L3.09857,4.74487 L3.09857,10.9544 M46.837,35.1437 C48.027,35.7653 49.025,36.6042 50.003,37.3695 L50.003,0.0021928 L6.26497,0.0021928 L6.26497,4.74451 M43.6826,47.1132 L43.6826,10.7652 L0.00257874,10.7652 L0.00257874,47.1132 C0.00257874,47.1132 12.5846,53.6101 21.8426,47.1132 C31.1006,40.6163 38.7926,43.3935 43.6826,47.1132 z";break;case"collate":n.pathData="M50.001,0.00286865 L25.001,25.0029 L0.000976562,0.00286865 L50.001,0.00286865 z M0.000976562,50.0029 L25.001,25.0029 L50.001,50.0029 L0.000976562,50.0029 z";break;case"summingjunction":n.constraints=i;n.pathData="M7.3252,42.6768 L42.6772,7.32477 M42.6768,42.6768 L7.3248,7.32477 M0.000976562,25.001 C0.000976562,11.193 11.197,0.000976562 25.001,0.000976562 C38.809,0.000976562 50.001,11.193 50.001,25.001 C50.001,38.809 38.809,50.001 25.001,50.001 C11.197,50.001 0.000976562,38.809 0.000976562,25.001 z";break;case"or":n.pathData="M 0 50 L 100 50 M 50 100 L 50 0.0 M 0 50 C 0 22.384 22.392 0 50 0 C 77.616 0 100 22.384 100 50 C 100 77.616 77.616 100 50 100 C 22.392 100 0 77.616 0 50 Z";break;case"internalstorage":n.pathData="M 0 3.8194444444444446A 2.5,3.8194444444444446 0 0,1 2.5,0L 47.5 0A 2.5,3.8194444444444446 0 0,1 50,3.8194444444444446L 50 45.833333333333336A 2.5,3.8194444444444446 0 0,1 47.5,49.65277777777778L 2.5 49.65277777777778A 2.5,3.8194444444444446 0 0,1 0,45.833333333333336L 0 3.8194444444444446ZM 0 11.458333333333334L 50 11.458333333333334M 12.5 0L 12.5 49.65277777777778";break;case"extract":n._shape="polygon";n.constraints=i;n.points=[{x:0,y:35},{x:30,y:0},{x:60,y:35}];break;case"manualoperation":n._shape="polygon";n.points=[{x:46.4,y:28.8},{x:14.8,y:28.8},{x:0,y:0},{x:60,y:0}];break;case"merge":n._shape="polygon";n.constraints=i;n.points=[{x:60,y:0},{x:30,y:35},{x:0,y:0}];break;case"offpagereference":n._shape="polygon";n.points=[{x:60,y:33.3},{x:30.1,y:39},{x:0,y:33.3},{x:0,y:0},{x:60,y:0}];break;case"sequentialaccessstorage":n.constraints=i;n.pathData="M 60 30 C 60 13.4 46.6 0 30 0 S 0 13.4 0 30 s 13.4 30 30 30 h 28.6 v -6.5 h -9.9 C 55.5 48 60 39.5 60 30 Z";break;case"annotation1":n.pathData="M49.9984,50.0029 L-0.00271199,50.0029 L-0.00271199,0.00286865 L49.9984,0.00286865";break;case"annotation2":n.pathData="M49.9977,50.0029 L25.416,50.0029 L25.416,0.00286865 L49.9977,0.00286865 M25.4166,25.0029 L-0.00227869,25.0029";break;case"card":n._shape="polygon";n.points=[{x:275,y:60},{x:400,y:60},{x:400,y:110},{x:260,y:110},{x:260,y:75}];break;case"data":n.pathData="M 10 0 L 40 0 L 30 40 L 0 40 Z "}return n};t.datavisualization.Diagram.ArrowShape=function(n){n._shape="path";n.shape||(n.shape="circulararrow");switch(n.shape){case"circulararrow":n.pathData="M433.4624,503.8848C429.4244,493.2388,419.1354,485.6678,407.0734,485.6678C391.4884,485.6678,378.8544,498.3018,378.8544,513.8868L384.4984,513.8868C384.4984,501.4178,394.6054,491.3108,407.0734,491.3108C415.9494,491.3108,423.6264,496.4338,427.3144,503.8848L422.9114,503.8848L426.8974,508.8848L430.8824,513.8868L434.8684,508.8848L438.8544,503.8848L433.4624,503.8848z";break;case"curvedrightarrow":n.pathData="M0.83006144,28.226993 C2.4030598,37.092016 9.5750604,44.49601 19.365042,48.044014 L19.365042,43.129004 25.376032,47.706001 31.386044,52.282999 25.376032,56.858988 19.365042,61.436991 19.365042,55.399027 C8.24608,51.372995 0.50004381,42.368995 0.50004357,31.905003 0.50004381,30.65601 0.6160717,29.429996 0.83006144,28.226993 z M31.402985,0.5 L31.402985,7.4419994 C15.834992,7.4419994 2.9619988,16.497999 0.81800008,28.275999 0.61199981,27.139999 0.49999988,25.981999 0.5,24.803999 0.49999988,11.379999 14.334993,0.5 31.402985,0.5 z";break;case"curveduparrow":n.pathData="M52.283021,0.51798058 L56.859025,6.5279841 61.436024,12.537989 55.399022,12.537989 C51.373021,23.656996 42.369015,31.403002 31.905011,31.403002 30.65601,31.403002 29.430011,31.288002 28.22701,31.073002 37.092015,29.500999 44.496018,22.328995 48.044018,12.537989 L43.129018,12.537989 47.706021,6.5279841 z M0.5,0.5 L7.4420163,0.5 C7.4420163,16.067989 16.497985,28.940971 28.276,31.083977 27.140013,31.290977 25.981993,31.402 24.804015,31.402 11.380005,31.402 0.5,17.567989 0.5,0.5 z";break;case"curvedleftarrow":n.pathData="M31.073116,28.227982 C31.287107,29.429977 31.403074,30.65599 31.403074,31.905989 31.403074,42.368966 23.657099,51.372959 12.538074,55.399935 L12.538074,61.436979 6.5270846,56.85898 0.51707193,52.282993 6.5270846,47.706976 12.538074,43.129983 12.538074,48.044958 C22.328056,44.496956 29.500118,37.091961 31.073116,28.227982 z M0.5,0.5 C17.568025,0.5 31.403045,11.380997 31.403045,24.803993 31.403045,25.981992 31.291046,27.139992 31.085045,28.276992 28.941042,16.497995 16.068023,7.442997 0.5,7.442997 z";break;case"curveddownarrow":n.pathData="M24.804015,0.50000453 C25.981993,0.50000453 27.140013,0.61301103 28.276,0.8180277 16.498045,2.9630154 7.4420161,15.836023 7.4420156,31.404005 L0.5,31.404005 C0.5,14.336024 11.380004,0.50000453 24.804015,0.50000453 z M31.90502,0.5 C42.369025,0.49999976 51.37303,8.2460016 55.399031,19.365004 L61.436034,19.365004 56.859034,25.377005 52.28303,31.387007 47.70603,25.377005 43.129027,19.365004 48.044028,19.365004 C44.496027,9.5760015 37.092024,2.4040001 28.227019,0.82999995 29.43002,0.61699978 30.65602,0.49999976 31.90502,0.5 z";break;case"jumpingrightarrow":n.pathData="M571.7207,727.7451L563.4507,716.8841L572.3297,716.8841C565.9217,699.1961,552.5427,686.2371,536.5277,683.3951C538.6997,683.0091,540.9157,682.8001,543.1717,682.8001C562.0777,682.8001,578.3457,696.7961,585.6187,716.8841L596.5277,716.8841L588.2577,727.7451L579.9907,738.6041L571.7207,727.7451z";break;case"jumpingleftarrow":n.pathData="M688.4209,727.7441L696.6889,716.8851L687.8119,716.8851C694.2179,699.1971,707.5989,686.2381,723.6119,683.3941C721.4409,683.0101,719.2259,682.8011,716.9679,682.8011C698.0639,682.8011,681.7959,696.7951,674.5209,716.8851L663.6119,716.8851L671.8839,727.7441L680.1509,738.6031L688.4209,727.7441z"}return n};t.datavisualization.Diagram.UMLConnectorShape=function(i){var u,r;i.shape.relationship||(i.shape.relationship="association");switch(i.shape.relationship){case"association":i.shape=t.datavisualization.Diagram.UMLConnectorAssociation(i.shape);break;case"aggregation":i.shape=t.datavisualization.Diagram.UMLConnectorAggregation(i.shape);break;case"composition":i.shape=t.datavisualization.Diagram.UMLConnectorComposition(i.shape);break;case"realization":i.shape=t.datavisualization.Diagram.UMLConnectorRealization(i.shape);break;case"dependency":i.shape=t.datavisualization.Diagram.UMLConnectorDependency(i.shape);break;case"inheritance":i.shape=t.datavisualization.Diagram.UMLConnectorInheritance(i.shape)}if(i.shape.type=="umlactivity")if(i.shape=t.datavisualization.Diagram.UMLActivityFlow(i.shape),i.shape.activityFlow=="object"){if(i=n.extend(!0,i,{lineDashArray:"8 4",targetDecorator:{shape:"openarrow"},lineWidth:2}),i.labels)for(r=0;r<i.labels.length;r++)i.labels[r]=t.datavisualization.Diagram.Label(i.labels[r]),i.labels[r].text="["+i.labels[r].text+"]"}else i.shape.activityFlow=="control"?i=n.extend(!0,i,{sourceDecorator:{shape:"none"},targetDecorator:{shape:"openarrow"},lineWidth:2}):i.shape.activityFlow=="exception"&&(i=n.extend(!0,i,{segments:[{type:"straight"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"openarrow"}}));else if(i.shape.multiplicity)if(u=[],u=t.datavisualization.Diagram.ClassifierHelper.umlConnectorMultiplicity(i),i.labels)for(r=0;r<u.length;r++)i.labels.push(u[r]);else i=n.extend(!0,{},{labels:u},i);return i.shape.type=="umlclassifier"&&(i.shape.relationship=="association"&&(i.shape.association=="bidirectional"?i=n.extend(!0,i,{segments:[{type:"straight"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"none"},lineWidth:2}):i.shape.association=="directional"&&(i=n.extend(!0,i,{segments:[{type:"straight"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"arrow"},lineWidth:2}))),i.shape.relationship=="inheritance"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"arrow",fillColor:"white"},lineWidth:2,lineDashArray:"4 4"})),i.shape.relationship=="composition"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"diamond",fillColor:"black"},targetDecorator:{shape:"none"},lineWidth:2})),i.shape.relationship=="aggregation"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"diamond",fillColor:"white"},targetDecorator:{shape:"none"},lineWidth:2})),i.shape.relationship=="dependency"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"openarrow",fillColor:"white"},lineWidth:2,lineDashArray:"4 4"})),i.shape.relationship=="realization"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"arrow",fillColor:"white"},lineWidth:2}))),i};t.datavisualization.Diagram.BPMNShape=function(t){t.shape||(t.shape="event");(t.shape!="sequentialflow"||t.shape!="associationflow"||t.shape!="messageflow")&&(t.labels&&t.labels.length||(t.labels=[{}]),t.labels.length&&t.labels[0].offset||(t.labels[0]=n.extend(!0,{},t.labels[0],{offset:{x:.5,y:1},verticalAlignment:"top",margin:{top:2}})));switch(t.shape){case"event":case"gateway":case"dataobject":case"activity":t._type="group";t._isBpmn=!0;t.children==undefined&&(t.children=[]);t.shape=="activity"&&t.activity=="subprocess"&&t.subProcess&&t.subProcess.collapsed==!1&&(t=n.extend(!0,{container:{type:"canvas"},paddingLeft:10,paddingRight:10,paddingBottom:10,paddingTop:10},t));break;case"message":t=n.extend(!0,t,{_shape:"path",pathData:"M0,0L19.8,12.8L40,0L0,0L0,25.5L40,25.5L40,0z"});break;case"datasource":t=n.extend(!0,t,{_shape:"path",pathData:"M 0 10.6 c 0 5.9 16.8 10.6 37.5 10.6 S 75 16.4 75 10.6 v 0 v 68.9 v -0.1 C 75 85.3 58.2 90 37.5 90 S 0 85.3 0 79.4 l 0 0.1 V 56 V 40.6 L 0 10.6 C 0 4.7 16.8 0 37.5 0 S 75 4.7 75 10.6 S 58.2 21.2 37.5 21.2 S 0 16.5 0 10.6 l 0 6.7 v -0.2 c 0 5.9 16.8 10.6 37.5 10.6 S 75 22.9 75 17.1 v 6.8 v -0.1 c 0 5.9 -16.8 10.6 -37.5 10.6 S 0 29.6 0 23.8"});break;case"group":t=n.extend(!0,t,{_type:"group",_isBpmn:!0,minWidth:t.width,minHeight:t.height,cornerRadius:10,container:{type:"canvas"},paddingLeft:10,paddingRight:10,paddingBottom:10,paddingTop:10,borderDashArray:"2 2 6 2"})}return t};t.datavisualization.Diagram.ClassifierShape=function(i,r){var u,f;i.classifier||(i.classifier="class");i.labels||(i.labels=[{margin:{}}]);i.fillColor||(i.fillColor="transparent");i.borderColor||(i.borderColor="transparent");i.borderWidth||(i.borderWidth=1);i.opacity||(i.opacity=1);switch(i.classifier){case"class":for(i["class"]=t.datavisualization.Diagram.ClassifierClass(i["class"]),u=0;u<i["class"].attributes.length;u++)i["class"].attributes[u]=t.datavisualization.Diagram.ClassAttribute(i["class"].attributes[u]);for(f=0;f<i["class"].methods.length;f++)i["class"].methods[f]=t.datavisualization.Diagram.ClassMethod(i["class"].methods[f]);i=t.datavisualization.Diagram.DefautShapes._getClassShape(i,r);break;case"interface":for(i["interface"]=t.datavisualization.Diagram.ClassifierInterface(i["interface"]),u=0;u<i["interface"].attributes.length;u++)i["interface"].attributes[u]=t.datavisualization.Diagram.ClassAttribute(i["interface"].attributes[u]);for(f=0;f<i["interface"].methods.length;f++)i["interface"].methods[f]=t.datavisualization.Diagram.ClassMethod(i["interface"].methods[f]);i=t.datavisualization.Diagram.DefautShapes._getClassShape(i,r);break;case"enumeration":i.enumeration=t.datavisualization.Diagram.ClassifierEnumeration(i.enumeration);i=t.datavisualization.Diagram.DefautShapes._getClassShape(i,r);break;case"member":i.labels[0]=n.extend(!0,{},{name:i.name+"_member",horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5},text:"Member"},i.labels[0]);i=n.extend(!0,{},{borderColor:"transparent",fillColor:"transparent",_shape:"rectangle",horizontalAlign:"stretch",verticalAlign:"bottom",_isClassMember:!0},i)}return i};t.datavisualization.Diagram.UMLActivityShape=function(n){n.type="umlactivity";n.shape||(n.shape="action");n._shape="path";switch(n.shape){case"action":n.pathData="M 90 82.895 C 90 86.819 86.776 90 82.8 90 H 7.2 C 3.224 90 0 86.819 0 82.895 V 7.105 C 0 3.181 3.224 0 7.2 0 h 75.6 C 86.776 0 90 3.181 90 7.105 V 82.895 Z";break;case"decision":n.pathData="M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z";break;case"mergenode":n.pathData="M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z";break;case"initialnode":n.pathData="M10,19.5c-5.238,0-9.5-4.262-9.5-9.5S4.762,0.5,10,0.5s9.5,4.262,9.5,9.5S15.238,19.5,10,19.5z";break;case"finalnode":n.borderColor="transparent";n._type="group";var i=[],r=0,u=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Resize);for(i.push({name:n.name+"_activity_final_1",width:n.width,height:n.height,offsetX:n.offsetX,offsetY:n.offsetY,constraints:u|t.datavisualization.Diagram.NodeConstraints.Resize,type:"node",shape:"path",pathData:"M164.1884,84.6909000000001C156.2414,84.6909000000001,149.7764,78.2259000000001,149.7764,70.2769000000001C149.7764,62.3279000000001,156.2414,55.8629000000001,164.1884,55.8629000000001C172.1354,55.8629000000001,178.6024,62.3279000000001,178.6024,70.2769000000001C178.6024,78.2259000000001,172.1354,84.6909000000001,164.1884,84.6909000000001"}),i.push({name:n.name+"_activity_final_2",width:n.width/2,height:n.height/2,fillColor:"black",offsetX:n.offsetX,offsetY:n.offsetY,constraints:u|t.datavisualization.Diagram.NodeConstraints.Resize,type:"node",shape:"path",pathData:"M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50"}),r=0;r<i.length;r++)i[r]=t.datavisualization.Diagram.Node(i[r]);n.elementType="group";n.children=i;break;case"forknode":n.width=n.width?n.width:40;n.height=5;n.fillColor="black";n.pathData="m0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z";n.labels=[{readOnly:!0}];n.ports=[];break;case"joinnode":n.width=n.width?n.width:40;n.height=5;n.fillColor="black";n.pathData="m0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z";n.labels=[{readOnly:!0}];n.ports=[];break;case"timeevent":n.pathData="M50.001,0.00286865 L25.001,25.0029 L0.000976562,0.00286865 L50.001,0.00286865 z M0.000976562,50.0029 L25.001,25.0029 L50.001,50.0029 L0.000976562,50.0029 z";break;case"acceptingevent":n.pathData="M17.8336 32.164 L29.64 24 L17.32 16 L48.1664 16 L48.5 32 Z";break;case"sendsignal":n.pathData="M48.164 31.8336 L56 23.832 L47.836 16 L16.168 16 L16.1668 31.8336 Z";break;case"receivesignal":n.pathData="M48.1664 31.8336 L39.836 24 L47.836 16 L16.168 16 L16.168 31.836 Z";break;case"structurednode":n._shape="rectangle";n.borderDashArray="2 3";n.labels=[{text:"<<"+n.labels[0].text+">>",wrapText:"nowrap",fillColor:"white"}];break;case"note":n.pathData="M20 12 L4 12 L4 22 L22 22 L22 14 L20 14 L20 12 L22 14 Z"}return n};t.datavisualization.Diagram.DefautShapes={_getBPMNEventShape:function(i,r){var f=[],u,o,s;for(i.children==undefined&&(i.children=[]),i._type="group",i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNEventDefaults,i),u=0;u<i.children.length;u++)r.nameTable[i.children[u].name||i.children[u]]&&(f.push(r.nameTable[i.children[u].name||i.children[u]]),f[u].rotateAngle=i.rotateAngle);var e=i.pivot||{x:.5,y:.5},h=i.offsetX?i.offsetX-i.width*e.x+i.width/2:i.width*e.x+i.width/2,c=i.offsetY?i.offsetY-i.height*e.y+i.height/2:i.height*e.y+i.height/2;if(!f.length)for(o=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect),s={parent:i.name,type:"node",shape:"path",offsetX:h,offsetY:c,ports:[],rotateAngle:i.rotateAngle,constraints:o,_isDisabled:!0,_isInternalShape:!0},f.push({name:i.name+"_0",width:i.width,height:i.height}),f.push({name:i.name+"_1",width:i.width*.85,height:i.height*.85}),f.push({name:i.name+"_2",width:i.width*.5,height:i.height*.5}),u=0;u<f.length;u++)f[u]=t.datavisualization.Diagram.Node(n.extend(!0,{},s,f[u]));return i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.children=this._updateBPMNEventShape(i,f,i.event,i.trigger),i},_getBPMNGatewayShape:function(i,r){var u=[],f,o,s;for(i.children==undefined&&(i.children=[]),i._type="group",i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNGatewayDefaults,i),f=0;f<i.children.length;f++)r.nameTable[i.children[f].name||i.children[f]]&&(u.push(r.nameTable[i.children[f].name||i.children[f]]),u[f].rotateAngle=i.rotateAngle);var e=i.pivot||{x:.5,y:.5},h=i.offsetX?i.offsetX-i.width*e.x+i.width/2:i.width*e.x+i.width/2,c=i.offsetY?i.offsetY-i.height*e.y+i.height/2:i.height*e.y+i.height/2;if(!u.length)for(o=t.datavisualization.Diagram.NodeConstraints.Default^(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect),s={parent:i.name,type:"node",shape:"path",offsetX:h,offsetY:c,ports:[],rotateAngle:i.rotateAngle,constraints:o,_isDisabled:!0,_isInternalShape:!0},u.push({name:i.name+"_0",width:i.width,height:i.height,pathData:"M 40 20 L 20 40 L 0 20 L 20 0 L 40 20 Z"}),u.push({name:i.name+"_1",width:i.width*.45,height:i.height*.45}),f=0;f<u.length;f++)u[f]=t.datavisualization.Diagram.Node(n.extend(!0,{},s,u[f]));i.children=u;i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default;n.extend(!0,u,[{fillColor:i.fillColor,constraints:i.constraints,shadow:i.shadow,borderColor:i.borderColor,borderWidth:i.borderWidth,opacity:i.opacity,gradient:i.gradient},{opacity:i.opacity,fillColor:"black",visible:!0}]);switch(i.gateway){case"none":u[1].visible=!1;break;case"exclusive":u[1].pathData="M 11.196 29.009 l 6.36 -9.712 l -5.764 -8.899 h 4.393 l 3.732 5.979 l 3.656 -5.979 h 4.354 l -5.789 9.039 l 6.36 9.572 h -4.532 l -4.126 -6.437 l -4.139 6.437 H 11.196 Z";break;case"inclusive":u[1].pathData="M 20.323 31.333 c -6.625 0 -12.015 -5.39 -12.015 -12.015 s 5.39 -12.015 12.015 -12.015 s 12.016 5.39 12.016 12.015 S 26.948 31.333 20.323 31.333 Z M 20.323 9.303 c -5.522 0 -10.015 4.493 -10.015 10.015 s 4.492 10.015 10.015 10.015 s 10.016 -4.493 10.016 -10.015 S 25.846 9.303 20.323 9.303 Z";break;case"parallel":u[1].pathData="M 18.394 29.542 v -8.833 H 9.626 v -3.691 h 8.768 V 8.251 h 3.734 v 8.767 h 8.768 v 3.691 h -8.768 v 8.833 H 18.394 Z";break;case"complex":u[1].pathData="M29.198,19.063L23.089,19.063L27.794,14.358L26.38,12.944L21.223,18.101L21.223,10.443L19.223,10.443L19.223,17.976L14.022,12.776L12.608,14.19L17.48,19.063L10.365,19.063L10.365,21.063L18.261,21.063L12.392,26.932L13.806,28.346L19.223,22.929L19.223,30.225L21.223,30.225L21.223,22.805L25.925,27.507L27.339,26.093L22.309,21.063L29.198,21.063z";break;case"eventbased":u[1].fillColor="white";u[1].pathData="M 20.322 29.874 c -5.444 0 -9.873 -4.43 -9.873 -9.874 s 4.429 -9.874 9.873 -9.874 s 9.874 4.429 9.874 9.874 S 25.767 29.874 20.322 29.874 Z M 20.322 32.891 c -7.107 0 -12.89 -5.783 -12.89 -12.891 c 0 -7.107 5.782 -12.89 12.89 -12.89 c 7.108 0 12.891 5.783 12.891 12.89 C 33.213 27.108 27.431 32.891 20.322 32.891 Z M 24.191 25.386 h -7.984 l -2.469 -7.595 l 6.461 -4.693 l 6.461 4.693 L 24.191 25.386 Z";break;case"exclusiveeventbased":u[1].fillColor="white";u[1].pathData="M 30 15 C 30 23.28 23.28 30 15 30 S 0 23.28 0 15 S 6.72 0 15 0 S 30 6.72 30 15 z M 15 5 L 5 12.5 L 8 22.5 H 22 L 25 12.5 z";break;case"paralleleventbased":u[1].fillColor="white";u[1].pathData="M 35 17.5 C 35 27.16 27.16 35 17.5 35 S 0 27.16 0 17.5 S 7.84 0 17.5 0 S 35 7.84 35 17.5 z M 14.58 5.83 V 14.58 H 5.83 V 20.42 H 14.58 V 29.17 H 20.42 V 20.42 H 29.17 V 14.58 H 20.42 V 5.83 z"}return i},_getClassShape:function(i,r){var f=[],k,l,y="",p="",w="",b="",v,a,o,c,e,h,u,s;if(i.children){for(u=0;u<i.children.length;u++)r.nameTable[i.children[u].name||i.children[u]]&&f.push(r.nameTable[i.children[u].name||i.children[u]]);if(f.length<=0&&i.children.length>0)for(s=0;s<i.children.length;s++)f.push(i.children[s])}else{if(v=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Select|t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeSouth|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Rotate|t.datavisualization.Diagram.NodeConstraints.ResizeEast|t.datavisualization.Diagram.NodeConstraints.Drag),a={width:i.width,offsetX:i.offsetX,parent:i.name,ports:[],fillColor:"transparent",borderColor:i.borderColor,type:"node",labels:[{margin:{left:5,right:5,top:5,bottom:5}}],_isClassMember:!0},i.fillColor&&(a.fillColor=i.fillColor),i.borderColor&&(a.borderColor=i.borderColor),i.borderWidth&&(a.borderWidth=i.borderWidth),i.labels)for(u=0;u<i.labels.length;u++)a.labels[u]=n.extend(!0,{},a.labels[u],i.labels[u]);switch(i.classifier){case"class":f.push({ports:[],name:i.name+"_header_classifier",minHeight:30,labels:[{name:"title",offset:{x:.5,y:.65},text:i["class"].name,bold:!0,fontSize:14},{name:"class",offset:{x:.5,y:.25},text:"<<Class>>"}],constraints:v});break;case"interface":f.push({name:i.name+"_header_classifier",minHeight:40,labels:[{name:"title",offset:{x:.5,y:.65},text:i["interface"].name,bold:!0,fontSize:14},{name:"interface",offset:{x:.5,y:.25},text:"<<Interface>>"}],constraints:v});break;case"enumeration":f.push({name:i.name+"_header_classifier",minHeight:40,labels:[{name:i.name+"Label1",offset:{x:.5,y:.65},text:i.enumeration.name,bold:!0,fontSize:14},{name:i.name+"enumeration",offset:{x:.5,y:.25},text:"<<Enumeration>>"}],constraints:v})}if(o=i["class"]?i["class"]:i["interface"],o&&o.attributes&&o.attributes.length){for(u=0;u<o.attributes.length;u++)o.attributes[u]=t.datavisualization.Diagram.ClassAttribute(o.attributes[u]),i.Interface&&(o.attributes[u].scope=t.datavisualization.Diagram.ScopeValueDefaults.Public),o.attributes[u].scope&&o.attributes[u].scope=="public"&&(h="+"),o.attributes[u].scope&&o.attributes[u].scope=="private"&&(h="-"),o.attributes[u].scope&&o.attributes[u].scope=="protected"&&(h="#"),o.attributes[u].scope&&o.attributes[u].scope=="package"&&(h="~"),o.attributes[u].name!=""&&(y+=h?h+" "+o.attributes[u].name+" : "+o.attributes[u].type:o.attributes[u].name+": "+o.attributes[u].type),u!=o.attributes.length-1&&(y+="\n");y&&f.push({name:i.name+"_attribute_classifier",labels:[{text:y,horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:v})}if(c=i.enumeration,c&&c.members&&c.members.length){for(u=0;u<c.members.length;u++)c.members[u]=t.datavisualization.Diagram.ClassMember(c.members[u]),c.members[u].name!=""&&(w+=c.members[u].name),u!=c.members.length-1&&(w+="\n");w&&f.push({name:i.name+"_member_classifier",labels:[{text:w,horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:v})}if(e=i["class"]?i["class"]:i["interface"],e&&e.methods&&e.methods.length){for(u=0;u<e.methods.length;u++){if(e.methods[u]=t.datavisualization.Diagram.ClassMethod(e.methods[u]),e.methods[u].scope&&e.methods[u].scope=="public"&&(h="+"),e.methods[u].scope&&e.methods[u].scope=="private"&&(h="-"),e.methods[u].scope&&e.methods[u].scope=="protected"&&(h="#"),e.methods[u].scope&&e.methods[u].scope=="package"&&(h="~"),e.methods[u].arguments)for(s=0;s<e.methods[u].arguments.length;s++)b+=e.methods[u].arguments[s].type?e.methods[u].arguments[s].name+":"+e.methods[u].arguments[s].type:e.methods[u].arguments[s].name,s!=e.methods[u].arguments.length-1&&(b+=",");e.methods[u].name!=""&&(p+=h?h+" "+e.methods[u].name+"("+b+") : "+e.methods[u].type:e.methods[u].name+"("+b+") :"+e.methods[u].type);u!=e.methods.length-1&&(p+="\n")}p&&f.push({name:i.name+"_method_classifier",labels:[{text:p,horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:v})}for(u=0;u<f.length;u++)for(f[u]=t.datavisualization.Diagram.Node(n.extend(!0,{},a,f[u])),s=0;s<f[u].labels.length;s++)f[u].labels[s]=n.extend(!0,{},f[u].labels[s],a.labels[0]);for(i.children=f,i._type="group",i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.constraints=i.constraints&~(t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeSouth|t.datavisualization.Diagram.NodeConstraints.Rotate|t.datavisualization.Diagram.NodeConstraints.ResizeEast|t.datavisualization.Diagram.NodeConstraints.Drag),u=0;u<f.length;u++)f.length==1&&(i["class"]&&(delete i["class"].attributes,delete i["class"].methods),i["interface"]&&(delete i["interface"].attributes,delete i["interface"].methods),i.enumeration&&delete i.enumeration.members),f.length==2&&(i.children[u]=typeof i.children[u]=="string"?r.nameTable[i.children[u]]:i.children[u],i["class"]&&(i.children[u].name.match("attribute")&&delete i["class"].methods,i.children[u].name.match("method")&&delete i["class"].attributes),i["interface"]&&(i.children[u].name.match("attribute")&&delete i["interface"].methods,i.children[u].name.match("method")&&delete i["interface"].attributes))}for(i._height=0,u=0;u<f.length;u++)r._getNodeDimension(f[u],f[u].labels[0]),k=f[u].height?f[u].height:f[u]._height,f[u].offsetY=i._height+k/2,i._height+=k;for(l=f[0]._width,f[1]&&(l=f[0]._width>f[1]._width?f[0]._width:f[1]._width),f[2]&&(l=f[2]._width>l?f[2]._width:l),f[0].width=l,f[1]&&(f[1].width=l),f[2]&&(f[2].width=l),i._width=l,i.width=i._width,i.height=i._height,u=0;u<f.length;u++)f[u].offsetY+=i.offsetY-i.height/2;return i},_updateClassNode:function(n,i){var h;if(n.name.match("_header"))i.type=="class"?i.className=n.labels[0].text:i.type=="interface"?i.interfaceName=n.labels[0].text:i.enumerationName=n.labels[0].text;else{for(var o=n.name.match("_attribute")?"attribute":n.name.match("_method")?"method":"member",s=n.labels[0],e=s.text.split("\n"),u=[],r,f=0;f<e.length;f++){h=i.Class?i.Class:i.Interface;switch(o){case"attribute":r=e[f].split(/:[ ]*/g);u.push(t.datavisualization.Diagram.ClassMember({name:r[0],type:r[1]}));break;case"method":r=e[f].replace(")","").replace("(",":").split(/:[ ]*/g);u.push(t.datavisualization.Diagram.ClassMember({name:r[0],returnType:r[1],parameter:r[2]}));break;case"member":u.push(t.datavisualization.Diagram.ClassMember({name:e[f]}))}}o=="attribute"?i.attributes=u:o=="method"?i.methods=u:i.members=u}},_getBPMNDataShape:function(i,r){var u=[],f,e,s,o,h,c,l;for(i.children==undefined&&(i.children=[]),i._type="group",e=i.pivot||{x:.5,y:.5},i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNDataObjectDefaults,i),s=i.offsetX?i.offsetX-i.width*e.x:i.width*e.x,o=i.offsetY?i.offsetY-i.height*e.y:i.height*e.y,f=0;f<i.children.length;f++)r.nameTable[i.children[f].name||i.children[f]]&&(u.push(r.nameTable[i.children[f].name||i.children[f]]),u[f].rotateAngle=i.rotateAngle);if(h=i.offsetX?i.offsetX-i.width*e.x+i.width/2:i.width*e.x+i.width/2,!u.length)for(c=t.datavisualization.Diagram.NodeConstraints.Default^(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect),l={parent:i.name,type:"node",shape:"path",offsetX:h,ports:[],rotateAngle:i.rotateAngle,constraints:c,_isDisabled:!0,_isInternalShape:!0},u.push({name:i.name+"_0",width:i.width,height:i.height,offsetY:o+i.height/2,shape:"polygon",points:[{x:29.904,y:5},{x:7.853,y:5},{x:7.853,y:45},{x:42.147,y:45},{x:42.147,y:17.242},{x:29.932,y:5},{x:29.932,y:17.242},{x:42.147,y:17.242}]}),u.push({name:i.name+"_1",width:i.width*.075,height:i.height*.15,offsetY:i.height*.85+o,fillColor:"black",pathData:"M 0 0 L 0.1 0 L 0.1 2 L 0 2 Z M 0.4 0 L 0.6 0 L 0.6 2 L0.4 2 Z M 0.9 0 L 1 0 L 1 2 L 0.9 2 Z "}),u.push({name:i.name+"_2",width:i.width*.25,height:i.height*.2,offsetX:s+i.width*.175,offsetY:o+i.height*.15,borderColor:"black",fillColor:"white",pathData:"M 3 9.4 l 6 0 v 2.4 l 3.6 -4 L 9 4 v 2.5 H 3 V 9.4 Z"}),f=0;f<u.length;f++)u[f]=t.datavisualization.Diagram.Node(n.extend(!0,{},l,u[f]));i.children=u;i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default;n.extend(!0,u,[{fillColor:i.fillColor,constraints:i.constraints,shadow:i.shadow,borderColor:i.borderColor,borderWidth:i.borderWidth,opacity:i.opacity,gradient:i.gradient},{opacity:i.opacity,visible:i.data.collection},{opacity:i.opacity,visible:!0}]);switch(i.data.type){case"none":u[2].visible=!1;break;case"input":u[2].fillColor="white";break;case"output":u[2].fillColor="black"}return i},_getBPMNActivityShape:function(i,r){var f=[],h={},u,s,c,e,o;for(i.children==undefined&&(i.children=[]),i._type="group",i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNActivityDefaults,i),u=0;u<i.children.length;u++)r.nameTable[i.children[u].name||i.children[u]]&&(f.push(r.nameTable[i.children[u].name||i.children[u]]),f[u].rotateAngle=i.rotateAngle);if(!f.length){for(s=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Resize),c={parent:i.name,type:"node",shape:"path",ports:[],labels:[],constraints:s,rotateAngle:i.rotateAngle,_isDisabled:!0,_isInternalShape:!0},f.push({name:i.name+"_activity",width:i.width,height:i.height,addInfo:{offset:{x:.5,y:.5}},constraints:s|t.datavisualization.Diagram.NodeConstraints.Resize}),f.push({name:i.name+"_taskType",width:14,height:14,borderColor:"black",addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:14,top:14}},pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_loop",width:12,height:12,addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_compensation",width:12,height:12,addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_expanded",width:12,height:12,constraints:t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Resize|t.datavisualization.Diagram.NodeConstraints.Select),addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_adhoc",width:12,height:8,addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_event_1",width:24,height:24,addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:18,top:18}}}),f.push({name:i.name+"_event_2",width:20.4,height:20.4,addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:18,top:18}}}),f.push({name:i.name+"_event_3",width:12,height:12,addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:18,top:18}}}),u=0;u<f.length;u++)f[u]=t.datavisualization.Diagram.Node(n.extend(!0,{},c,f[u]));if(i.activity=="subprocess"&&!i.subProcess.collapsed&&i.subProcess.processes.length)for(e=0,o=i.subProcess.processes;e<i.subProcess.processes.length;e++)o[e]=t.datavisualization.Diagram.Node(t.datavisualization.Diagram.NodeType(o[e],r)),f.push(o[e])}for(i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.children=this._updateBPMNActivityShape(i,f),u=0;u<i.children.length;u++)h[i.children[u].name]=i.children[u];return t.datavisualization.Diagram.Util._updateBPMNProperties(i,r,h),i},_getBPMNGroupShape:function(n,i){var u=[],r=0,f;for(n.children==undefined&&(n.children=[]),r=0;r<n.children.length;r++)i.nameTable[n.children[r].name||n.children[r]]&&u.push(i.nameTable[n.children[r].name||n.children[r]]);if(!u.length)for(r=0;r<n.children.length;r++)f=t.datavisualization.Diagram.Node(t.datavisualization.Diagram.NodeType(n.children[r],i)),f.type=="bpmn"&&u.push(f);return n.ports=[],n.children=u,n.constraints=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,n.constraints=n.constraints&~t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.AllowDrop,n},_updateBPMNEventShape:function(i,r,u,f){var e,o,s;r&&r[0]&&(e=r[0].constraints?r[0].constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(e=e|t.datavisualization.Diagram.NodeConstraints.Shadow));o="M164.1884,84.6909000000001C156.2414,84.6909000000001,149.7764,78.2259000000001,149.7764,70.2769000000001C149.7764,62.3279000000001,156.2414,55.8629000000001,164.1884,55.8629000000001C172.1354,55.8629000000001,178.6024,62.3279000000001,178.6024,70.2769000000001C178.6024,78.2259000000001,172.1354,84.6909000000001,164.1884,84.6909000000001";s=[{pathData:o,fillColor:i.fillColor,constraints:e,shadow:i.shadow,borderWidth:i.borderWidth,borderColor:i.borderColor,borderDashArray:"1 0",opacity:i.opacity,gradient:i.gradient,visible:!0},{pathData:o,fillColor:i.fillColor,borderColor:i.borderColor,borderDashArray:"1 0",opacity:i.opacity,gradient:i.gradient,visible:!0},{pathData:o,fillColor:"white",borderColor:i.borderColor,opacity:i.opacity,height:r[0].height*.5,visible:!0}];n.extend(!0,r,s);switch(u){case"start":r[1].visible=!1;break;case"noninterruptingstart":r[0].borderDashArray="2 3";r[1].visible=!1;break;case"intermediate":r[0].fillColor="white";r[0].gradient=null;break;case"noninterruptingintermediate":r[0].fillColor="white";r[0].gradient=null;r[0].borderDashArray="2 3";r[1].borderDashArray="2 3";break;case"throwingintermediate":case"end":r[0].fillColor=u!="end"?"white":"black";r[0].gradient=null;r[2].fillColor="black";r[2].borderColor=i.fillColor}switch(f){case t.datavisualization.Diagram.BPMNTriggers.None:r[2].visible=!1;break;case t.datavisualization.Diagram.BPMNTriggers.Message:r[2].pathData="M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0";r[2].height=3*r[2].width/4;break;case t.datavisualization.Diagram.BPMNTriggers.Timer:r[2].pathData="M40,20c0,8.654-5.496,16.024-13.189,18.81C24.685,39.58,22.392,40,20,40C8.954,40,0,31.046,0,20S8.954,0,20,0S40,8.954,40,20z M20,0 L20,2.583 L20,5.283 M10.027,2.681 L11.659,5.507 L12.669,7.257 M2.731,9.989 L6.014,11.885 L7.307,12.631 M0.067,19.967 L2.667,19.967 L5.35,19.967M2.748,29.939 L5.731,28.217 L7.323,27.298 M10.056,37.236 L11.292,35.095 L12.698,32.66 M20.033,39.9 L20.033,36.417 L20.033,34.617 M30.006,37.219 L28.893,35.292 L27.364,32.643 M37.302,29.911 L34.608,28.355 L32.727,27.269M39.967,19.933 L37.417,19.933 L34.683,19.933 M37.286,9.961 L34.583,11.521 L32.71,12.602 M29.977,2.664 L28.653,4.957 L27.336,7.24 M22.104,8.5 L19.688,20 L24.75,20 L31.604,20 L24.75,20 L19.688,20z";break;case t.datavisualization.Diagram.BPMNTriggers.Error:r[2].pathData="M 23.77 18.527 l -7.107 27.396 l 8.507 -17.247 L 36.94 40.073 l 6.394 -25.997 l -8.497 15.754 L 23.77 18.527 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Escalation:r[2].pathData="M 30.001 8.098 L 11.842 43.543 l 18.159 -18.882 l 18.162 18.882 L 30.001 8.098 Z ";break;case t.datavisualization.Diagram.BPMNTriggers.Cancel:r[2].pathData="M 3.5 16 L 0 12.6 L 4.6 8 L 0 3.5 L 3.4 0 L 8 4.6 l 4.5 -4.5 L 16 3.5 L 11.5 8 l 4.5 4.5 l -3.4 3.5 L 8 11.4 L 3.5 16 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Compensation:r[2].pathData="M 25.7086 0 L 0 25 L 25.7086 50 V 26.3752 L 50 50 V 0 L 25.7086 23.6248 V 0 Z ";break;case t.datavisualization.Diagram.BPMNTriggers.Conditional:r[2].pathData="M 0 0 H 16 V 16 H 0 z M 1.14 3.2 H 14.85 M 1.14 6.4 H 14.85 M 1.14 9.6 H 14.85 M 1.14 12.8 H 14.85";break;case t.datavisualization.Diagram.BPMNTriggers.Link:r[2].pathData="M 32.014 19.258 v 5.992 H 9.373 v 9.504 h 22.641 v 5.988 L 50.622 30 L 32.014 19.258 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Signal:r[2].pathData="M 50 50 H 0 L 25.0025 0 L 50 50 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Terminate:r[2].pathData="M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50";break;case t.datavisualization.Diagram.BPMNTriggers.Multiple:r[2].pathData="M 17.784 48.889 H 42.21 l 7.548 -23.23 L 29.997 11.303 L 10.236 25.658 L 17.784 48.889 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Parallel:r[2].pathData="M 27.276 49.986 h 5.58 v -17.15 h 17.146 V 27.17 h -17.15 l 0.004 -17.15 h -5.58 l -0.004 17.15 H 9.994 v 5.666 h 17.278 L 27.276 49.986 Z"}return r},_updateBPMNActivityShape:function(i,r){var v,y,f,u,o,h,p,e,b;r&&r[0]&&(h=r[0].constraints?r[0].constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(h=h|t.datavisualization.Diagram.NodeConstraints.Shadow));var k=[{fillColor:i.fillColor,borderWidth:i.borderWidth,constraints:h,shadow:i.shadow,borderColor:i.borderColor,borderDashArray:"1 0",opacity:i.opacity,gradient:i.gradient,pathData:this._updateRoundedRectanglePath(i,12)},{fillColor:"white",borderColor:"black",width:14,height:14,opacity:i.opacity,visible:!1},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!0},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!0},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!1},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!1},{opacity:i.opacity,visible:!1},{opacity:i.opacity,visible:!1},{opacity:i.opacity,visible:!1}],c=[],l=9,e=0;n.extend(!0,r,k);i.activity=="subprocess"&&!i.subProcess.collapsed&&r.length>l&&i.subProcess.processes.length&&(c=r.splice(r.length-i.subProcess.processes.length,i.subProcess.processes.length));v=i.activity=="task"?i.task.loop:i.subProcess.loop;y=i.activity=="task"?i.task.compensation:i.subProcess.compensation;switch(v){case"none":r[2].visible=!1;break;case"standard":r[2].pathData="M 52.002 73.379 c -2.494 -2.536 -6.55 -2.534 -9.043 0 c -1.208 1.228 -1.874 2.861 -1.874 4.598 c 0 1.225 0.337 2.395 0.957 3.411 l -1.167 1.186 l 2.071 0.458 l 2.071 0.458 l -0.45 -2.106 l -0.45 -2.106 l -1.292 1.314 c -1.119 -2.065 -0.842 -4.709 0.877 -6.458 c 2.084 -2.119 5.475 -2.117 7.557 0 c 2.083 2.119 2.083 5.565 0 7.685 c -0.976 0.992 -2.272 1.557 -3.65 1.59 l 0.025 1.068 c 1.65 -0.041 3.2 -0.716 4.368 -1.903 c 1.208 -1.228 1.874 -2.861 1.874 -4.597 C 53.875 76.24 53.209 74.607 52.002 73.379 Z";break;case"parallelmultiinstance":r[2].pathData="M 51.5,69.5 L52.5,69.5 L52.5,84.5 L51.5 84.5 Z M 46.5,69.5 L47.5,69.5 L47.5,84.5 L46.5 84.5 Z M 41.5,69.5 L42.5,69.5 L42.5,84.5 L41.5 84.5 Z ";break;case"sequencemultiinstance":r[2].pathData="M 40.375,71.5 L 55.375,71.5 L 55.375,72.5 L 40.375,72.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,81.5 L 55.375,81.5 L 55.375,82.5 L 40.375,82.5 Z"}if(y?r[3].pathData="M 22.462 18.754 l -6.79 3.92 l 6.79 3.92 V 22.89 l 6.415 3.705 v -7.841 l -6.415 3.705 V 18.754 Z M 28.331 19.701 v 5.947 l -5.149 -2.973 L 28.331 19.701 Z M 21.916 25.647 l -5.15 -2.973 l 5.15 -2.973 V 25.647 Z M 22.275 12.674 c -5.513 0 -9.999 4.486 -9.999 9.999 c 0 5.514 4.486 10.001 9.999 10.001 c 5.514 0 9.999 -4.486 9.999 -10.001 C 32.274 17.16 27.789 12.674 22.275 12.674 Z M 22.275 32.127 c -5.212 0 -9.453 -4.241 -9.453 -9.454 c 0 -5.212 4.241 -9.453 9.453 -9.453 c 5.212 0 9.453 4.241 9.453 9.453 C 31.728 27.887 27.487 32.127 22.275 32.127 Z":r[3].visible=!1,f=i.activity==t.datavisualization.Diagram.BPMNActivity.Task?i.task.events:i.subProcess.events,f&&f.length)for(u=0;u<f.length;u++){if(o=r.slice(l+u*3,l+3+u*3),!o.length||o.length<3){for(h=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Resize),p={parent:i.name,type:"node",shape:"path",ports:[],labels:[],constraints:h,rotateAngle:i.rotateAngle,_isInternalShape:!0,opacity:i.opacity,visible:!1,addInfo:{offset:f[u].offset}},f[u]=n.extend(!0,{},t.datavisualization.Diagram.BPMNEventDefaults,f[u]),o=[{width:24,height:24},{width:20.4,height:20.4},{width:12,height:12}],e=0;e<o.length;e++)o[e]=t.datavisualization.Diagram.Node(n.extend(!0,{name:i.name+"_"+t.datavisualization.Diagram.Util.randomId()},p,o[e])),e==0&&(o[e].constraints=t.datavisualization.Diagram.NodeConstraints.Default&~t.datavisualization.Diagram.NodeConstraints.Resize,o[e].name=f[u].name?f[u].name:i.name+"_"+f[u].event+"_"+f[u].trigger+"_"+t.datavisualization.Diagram.Util.randomId());r=r.concat(o)}this._updateBPMNEventShape(i,o,f[u].event,f[u].trigger)}else r.splice(l,r.length-1);if(i.activity==t.datavisualization.Diagram.BPMNActivity.Task){r[1].visible=!0;switch(i.task.type){case"none":r[1].visible=!1;break;case"service":r[1].pathData="M 32.699 20.187 v -4.005 h -3.32 c -0.125 -0.43 -0.292 -0.83 -0.488 -1.21 l 2.373 -2.375 l -2.833 -2.83 l -2.333 2.333 c -0.44 -0.253 -0.9 -0.448 -1.387 -0.595 v -3.32 h -4.003 v 3.32 c -0.46 0.137 -0.89 0.322 -1.3 0.537 l -2.285 -2.275 l -2.833 2.83 l 2.285 2.278 c -0.235 0.42 -0.41 0.847 -0.547 1.307 h -3.33 v 4.005 h 3.33 c 0.148 0.488 0.343 0.955 0.588 1.395 l -2.325 2.325 l 2.822 2.832 l 2.373 -2.382 c 0.392 0.205 0.792 0.37 1.212 0.497 v 3.33 h 4.003 v -3.33 c 0.46 -0.138 0.89 -0.323 1.3 -0.547 l 2.43 2.432 l 2.822 -2.832 l -2.42 -2.422 c 0.222 -0.41 0.4 -0.85 0.535 -1.297 H 32.699 Z M 22.699 21.987 c -2.1 0 -3.803 -1.703 -3.803 -3.803 c 0 -2.1 1.703 -3.803 3.803 -3.803 c 2.1 0 3.803 1.703 3.803 3.803 C 26.502 20.285 24.8 21.987 22.699 21.987 Z";break;case"receive":r[1].pathData="M 12.217 12.134 v 13.334 h 20 V 12.134 H 12.217 Z M 30.44 13.007 l -8.223 5.35 l -8.223 -5.35 H 30.44 Z M 13.09 24.594 V 13.459 l 9.127 5.94 l 9.127 -5.94 v 11.135 H 13.09 Z";r[1].height=12;break;case"send":r[1].pathData="M 45.7256 3.16055 L 25 23.4017 L 4.27442 3.16055 H 45.7256 Z M 47.8963 46.8413 H 2.10375 V 4.80813 L 25 27.1709 L 47.8963 4.80813 V 46.8413 Z";r[1].height=12;r[1].fillColor="black";r[1].borderColor="white";break;case"instantiatingreceive":r[1].pathData="M 16.306 17.39 v 8.79 h 13.198 v -8.79 H 16.306 Z M 28.375 17.946 l -5.47 3.558 l -5.47 -3.558 H 28.375 Z M 28.948 25.625 H 16.861 v -7.389 l 6.043 3.931 l 6.043 -3.931 V 25.625 Z M 22.905 11.785 c -5.514 0 -9.999 4.486 -9.999 10 c 0 5.514 4.485 10 9.999 10 s 9.999 -4.486 9.999 -10 C 32.904 16.272 28.419 11.785 22.905 11.785 Z M 22.905 31.239 c -5.212 0 -9.453 -4.241 -9.453 -9.454 c 0 -5.212 4.241 -9.453 9.453 -9.453 s 9.452 4.241 9.452 9.453 C 32.357 26.998 28.117 31.239 22.905 31.239 Z";r[1].width=20;r[1].height=20;break;case"manual":r[1].pathData="M 13.183 15.325 h 2.911 c 0.105 0 0.207 -0.043 0.281 -0.117 c 0.078 -0.074 0.117 -0.176 0.117 -0.281 c 0 -0.753 0.718 -1.362 1.596 -1.362 h 2.579 c -0.117 0.227 -0.191 0.48 -0.195 0.757 c 0 0.433 0.168 0.851 0.46 1.144 c 0.008 0.004 0.015 0.011 0.019 0.015 c -0.289 0.285 -0.475 0.691 -0.479 1.148 c 0 0.433 0.168 0.846 0.46 1.139 c 0.011 0.012 0.023 0.02 0.035 0.032 c -0.301 0.281 -0.491 0.694 -0.495 1.155 c 0 0.432 0.168 0.847 0.46 1.143 c 0.265 0.266 0.612 0.414 0.975 0.414 h 0.839 c 0.027 0.004 0.051 0.012 0.074 0.012 h 8.443 c 0.352 0 0.636 0.344 0.636 0.761 c 0 0.414 -0.285 0.753 -0.636 0.753 h -6.687 c -0.019 0 -0.035 -0.008 -0.051 -0.008 h -2.27 c -0.121 -0.835 -0.667 -1.187 -1.795 -1.187 h -2.158 c -0.223 0 -0.402 0.18 -0.402 0.403 c 0 0.219 0.179 0.398 0.402 0.398 h 2.158 c 0.972 0 1.019 0.203 1.019 0.784 c 0 0.219 0.179 0.399 0.402 0.399 c 0.008 0 0.016 -0.004 0.027 -0.004 c 0.028 0.004 0.055 0.016 0.082 0.016 h 2.56 c 0.34 0.015 0.616 0.343 0.616 0.752 c 0 0.418 -0.285 0.757 -0.636 0.761 h -0.004 h -6.442 c -0.878 0 -1.595 -0.639 -1.595 -1.427 v -0.683 c 0 -0.109 -0.043 -0.211 -0.114 -0.285 c -0.078 -0.074 -0.179 -0.117 -0.285 -0.117 h -0.004 l -2.989 0.027 c -0.223 0 -0.398 0.184 -0.398 0.402 c 0 0.219 0.179 0.395 0.398 0.395 h 0.004 l 2.591 -0.02 v 0.282 c 0 1.229 1.073 2.223 2.391 2.223 h 3.895 c 0.004 0 0.007 0.004 0.011 0.004 h 2.536 c 0.792 0 1.436 -0.698 1.436 -1.561 c 0 -0.273 -0.07 -0.53 -0.188 -0.752 h 5.49 c 0.792 0 1.436 -0.695 1.436 -1.553 c 0 -0.858 -0.644 -1.557 -1.436 -1.557 h -3.566 c 0.121 -0.226 0.199 -0.487 0.199 -0.768 c 0 -0.468 -0.195 -0.882 -0.495 -1.167 c 0.301 -0.285 0.495 -0.698 0.495 -1.163 c 0 -0.456 -0.191 -0.866 -0.483 -1.152 c 0.293 -0.285 0.483 -0.694 0.483 -1.151 c 0 -0.858 -0.647 -1.557 -1.439 -1.557 h -8.373 c -1.167 0 -2.142 0.757 -2.352 1.76 l -2.548 -0.004 c -0.219 0 -0.399 0.18 -0.399 0.403 C 12.784 15.145 12.964 15.325 13.183 15.325 L 13.183 15.325 Z M 21.907 19.707 c -0.191 0 -0.328 -0.094 -0.41 -0.176 c -0.144 -0.145 -0.226 -0.355 -0.226 -0.577 c 0.003 -0.418 0.289 -0.753 0.643 -0.753 h 4.468 c 0.008 0 0.015 -0.004 0.027 -0.008 h 0.051 c 0.351 0 0.636 0.344 0.636 0.761 c 0 0.414 -0.286 0.753 -0.636 0.753 H 21.907 Z M 27.097 16.629 c 0 0.414 -0.286 0.753 -0.64 0.753 h -4.464 c -0.004 0 -0.004 0 -0.004 0 h -0.082 c -0.191 0 -0.328 -0.098 -0.414 -0.18 c -0.14 -0.145 -0.222 -0.352 -0.222 -0.573 c 0 -0.413 0.285 -0.749 0.631 -0.753 h 3.434 c 0 0 0 0 0.004 0 h 1.116 c 0.008 0 0.012 -0.004 0.02 -0.004 C 26.819 15.887 27.097 16.215 27.097 16.629 L 27.097 16.629 Z M 27.097 14.322 c 0 0.41 -0.278 0.737 -0.62 0.749 c -0.008 0 -0.012 0 -0.016 0 h -3.637 c -0.008 0 -0.015 0.004 -0.023 0.004 h -0.886 c -0.004 0 -0.008 0 -0.012 0 c -0.187 0 -0.324 -0.094 -0.406 -0.176 c -0.144 -0.144 -0.226 -0.355 -0.226 -0.577 c 0.003 -0.414 0.293 -0.753 0.643 -0.753 h 4.468 c 0.008 0 0.015 -0.004 0.027 -0.004 h 0.051 C 26.811 13.565 27.097 13.905 27.097 14.322 L 27.097 14.322 Z M 27.097 14.322";r[1].width=20;break;case"businessrule":r[1].pathData="M 32.844 13.245 h -0.089 v 0 H 13.764 v -0.015 h -1.009 v 16.989 h 0.095 v 0.011 h 19.716 v -0.011 h 0.278 V 13.245 Z M 31.844 14.229 v 4.185 h -18.08 v -4.185 H 31.844 Z M 18.168 25.306 v 3.938 h -4.404 v -3.938 H 18.168 Z M 13.764 24.322 v -4.923 h 4.404 v 4.923 H 13.764 Z M 19.177 25.306 h 12.667 v 3.938 H 19.177 V 25.306 Z M 19.177 24.322 v -4.923 h 12.667 v 4.923 H 19.177 Z";break;case"user":r[1].pathData="M 21.762 21.935 c 2.584 0 4.687 -2.561 4.687 -5.703 c 0 -3.147 -2.103 -5.703 -4.687 -5.703 c -1.279 0 -2.475 0.61 -3.363 1.721 c -0.855 1.071 -1.327 2.484 -1.324 3.983 C 17.075 19.374 19.178 21.935 21.762 21.935 L 21.762 21.935 Z M 21.762 11.779 c 1.894 0 3.436 1.995 3.436 4.452 c 0 2.453 -1.541 4.452 -3.436 4.452 c -1.895 0 -3.44 -1.999 -3.44 -4.452 C 18.323 13.774 19.864 11.779 21.762 11.779 L 21.762 11.779 Z M 25.699 21.309 c -0.348 0 -0.626 0.277 -0.626 0.626 c 0 0.344 0.277 0.622 0.626 0.622 c 2.136 0 3.875 1.74 3.875 3.879 c 0 0.272 -0.227 0.498 -0.501 0.498 H 14.447 c -0.274 0 -0.497 -0.223 -0.497 -0.498 c 0 -2.139 1.736 -3.879 3.872 -3.879 c 0.344 0 0.625 -0.277 0.625 -0.622 c 0 -0.348 -0.28 -0.626 -0.625 -0.626 c -2.826 0 -5.124 2.297 -5.124 5.126 c 0 0.965 0.784 1.749 1.748 1.749 h 14.626 c 0.964 0 1.748 -0.784 1.748 -1.749 C 30.822 23.606 28.524 21.309 25.699 21.309 L 25.699 21.309 Z M 22.217 9.832 c 0.448 -0.263 0.924 -0.396 1.419 -0.396 c 1.895 0 3.436 1.995 3.436 4.452 c 0 0.439 -0.048 0.873 -0.143 1.284 c -0.08 0.336 0.128 0.672 0.464 0.751 c 0.048 0.012 0.098 0.019 0.143 0.019 c 0.284 0 0.541 -0.195 0.608 -0.483 c 0.119 -0.506 0.18 -1.034 0.18 -1.571 c 0 -3.147 -2.102 -5.703 -4.687 -5.703 c -0.711 0 -1.419 0.198 -2.054 0.573 c -0.296 0.174 -0.397 0.559 -0.219 0.855 C 21.536 9.911 21.921 10.009 22.217 9.832 L 22.217 9.832 Z M 27.697 18.81 c -0.345 0 -0.626 0.277 -0.626 0.622 c 0 0.348 0.281 0.626 0.626 0.626 c 2.137 0 3.75 1.782 3.75 3.918 c 0 0.07 -0.013 0.141 -0.043 0.205 c -0.14 0.314 0.003 0.684 0.318 0.823 c 0.082 0.037 0.167 0.055 0.253 0.055 c 0.241 0 0.466 -0.141 0.57 -0.373 c 0.101 -0.226 0.153 -0.464 0.153 -0.714 C 32.699 21.15 30.523 18.81 27.697 18.81 L 27.697 18.81 Z M 27.697 18.81";break;case"script":r[1].pathData="M 22.453 15.04 c 0 0 -1.194 -3.741 2.548 -3.774 c 0 0 2.497 0.126 1.766 4.321 c -0.008 0.043 -0.015 0.086 -0.024 0.13 c -0.806 4.323 -2.516 8.42 -3.193 10.581 h 3.904 c 0 0 0.983 4.581 -2.549 4.968 H 13.292 c 0 0 -3.097 -1.42 -1.517 -5.323 l 3 -10.839 H 11.84 c 0 0 -1.129 -2.902 1.709 -3.806 l 11.425 -0.032 l -0.73 0.355 l -1.193 1.726 L 22.453 15.04 Z M 22.409 12.597 c 0 0 -0.242 0.483 -0.278 0.98 h -9.098 c 0 0 -0.06 -0.871 0.714 -1.041 L 22.409 12.597 Z M 26.341 27.734 c 0 0 -0.13 2.678 -2.226 1.871 c 0 0 -0.823 -0.565 -0.758 -1.855 L 26.341 27.734 Z M 22.905 15.008 c 0 0 0.653 -0.258 0.709 -1.501 c 0 0 0.145 -1.144 1.483 -0.693 c 0 0 0.808 0.355 0.259 2.404 c 0 0 -2.226 8.5 -3.032 10.339 c 0 0 -1.064 2.646 0.096 4.226 h -8.581 c 0 0 -1.806 -0.452 -0.741 -3.613 c 0 0 2.935 -9.549 3.193 -11.162 L 22.905 15.008 Z"}i.task.call&&(r[0].borderWidth=4);i.task.compensation&&i.task.loop!="none"&&(r[2].addInfo.margin.left-=r[2].width/2+2,r[3].addInfo.margin.left+=r[3].width/2+2)}else if(i.activity==t.datavisualization.Diagram.BPMNActivity.SubProcess){var w=0,a=0,s=2;if(i.subProcess.collapsed)r[4].constraints=h|t.datavisualization.Diagram.NodeConstraints.PointerEvents,r[4].visible=!0,r[4].pathData="M 8.13789 15 H 0 V 0 H 8.13789 V 15 Z M 0.625991 13.75 H 7.51189 V 1.25 H 0.625991 V 13.75 Z M 2.18095 7.03125 L 5.95631 7.03125 L 5.95631 7.46875 L 2.18095 7.46875 Z M 3.8342 3.73 L 4.30369 3.73 L 4.30369 11.2687 L 3.8342 11.2687 Z";else{for(r[4].constraints=r[4].constraints|t.datavisualization.Diagram.NodeConstraints.PointerEvents,r[4].visible=!0,r[4].pathData="M 8.13789 15 H 0 V 0 H 8.13789 V 15 Z M 0.625991 13.75 H 7.51189 V 1.25 H 0.625991 V 13.75 Z M 2.18095 7.03125 L 5.95631 7.03125 L 5.95631 7.46875 L 2.18095 7.46875 Z M 3.8342 3.73 L 4.30369 3.73 L 4.30369 11.2687 L 3.8342 11.2687 Z",r[0]=n.extend(!0,r[0],{marginLeft:-i.paddingLeft,marginRight:-i.paddingRight,marginTop:-i.paddingTop,marginBottom:-i.paddingBottom,minWidth:i.width,minHeight:i.height}),i.constraints=i.constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop,i.minWidth=i.width,i.minHeight=i.height;e<c.length;)c[e].type!="bpmn"&&c.splice(e,1),e++;r=r.concat(c)}switch(i.subProcess.boundary){case"default":r[0].borderWidth=1;r[0].borderDashArray="1 0";break;case"call":r[0].borderWidth=4;r[0].borderDashArray="1 0";break;case"event":r[0].borderWidth=1;r[0].borderDashArray="2 2"}i.subProcess.adhoc?(r[5].visible=!0,r[5].pathData="M 49.832 76.811 v -2.906 c 0 0 0.466 -1.469 1.931 -1.5 c 1.465 -0.031 2.331 1.219 2.897 1.688 s 1.06 0.75 1.526 0.75 c 0.466 0 1.548 -0.521 1.682 -1.208 s 0.083 3.083 0.083 3.083 s -0.76 0.969 -1.859 0.969 c -1.066 0 -1.865 -0.625 -2.464 -1.438 s -1.359 -0.998 -2.064 -0.906 C 50.598 75.467 49.832 76.811 49.832 76.811 Z"):i.subProcess.type=="event"?(r[0].borderWidth=1,r[0].borderDashArray="2 2",this._updateBPMNEventShape(i,r.slice(6,9),i.subProcess.event,i.subProcess.trigger)):i.subProcess.type=="transaction"&&(b={x:3,y:3,width:i.width-3,height:i.height-3},r[0].pathData+=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(b,12));do r[s].visible&&(r[s].addInfo.margin.left=a+r[s].width/2,a+=r[s].width+2),s++;while(s<6);a-=2;s=2;w=a/2;do r[s].visible&&(r[s].addInfo.margin.left-=w),s++;while(s<6)}return r},_updateRoundedRectanglePath:function(n,t){for(var u="",i=0,r=[{x:n.x||0,y:n.y||0},{x:n.x||0,y:n.height},{x:n.width,y:n.height},{x:n.width,y:n.y||0}],f=[{x:t,y:t},{x:t,y:-t},{x:-t,y:-t},{x:-t,y:t}],i=0;i<r.length;i++)u+=u?"L":"M",u+=r[i].x+(i%2==0?f[i].x:0)+","+(r[i].y+(i%2!=0?f[i].y:0)),u+="C"+r[i].x+","+r[i].y+" "+r[i].x+","+r[i].y,u+=" "+(r[i].x+(i%2!=0?f[i].x:0))+","+(r[i].y+(i%2==0?f[i].y:0));return u+="L"+(r[0].x+f[0].x)+","+r[0].y,u+"Z"},initBPMNAnnotationShape:function(i,r){var u=[],c=0,o,v,f,e;if(i._annotation&&i._annotation.length)while(c<i._annotation.length)if(o=r.nameTable[i._annotation[c++]],o&&o.name.split("annotation_")[0]!=i.name)i._annotation.splice(--c,1);else if(o)u.push(o);else break;if(i.annotation&&i.annotation.text){if(i=n.extend(!0,{},t.datavisualization.Diagram.BPMNTextAnnotationDefaults,i),!u.length){var s=t.datavisualization.Diagram.PortVisibility.Hidden,h=t.datavisualization.Diagram.PortConstraints.None,y=[{offset:{x:0,y:.5},name:"left",visibility:s,constraints:h},{offset:{x:.5,y:0},name:"top",visibility:s,constraints:h},{offset:{x:1,y:.5},name:"right",visibility:s,constraints:h},{offset:{x:.5,y:1},name:"bottom",visibility:s,constraints:h}],l=i.name+"annotation_"+t.datavisualization.Diagram.Util.randomId(),a=i.name+"annotation_"+t.datavisualization.Diagram.Util.randomId(),p=t.datavisualization.Diagram.NodeConstraints.Default&~t.datavisualization.Diagram.NodeConstraints.Connect,w=t.datavisualization.Diagram.ConnectorConstraints.Default&~(t.datavisualization.Diagram.ConnectorConstraints.DragSourceEnd|t.datavisualization.Diagram.ConnectorConstraints.Drag);i._annotation&&i._annotation.length?(l=typeof i._annotation[0]=="string"?i._annotation[0]:i._annotation[0].name,a=typeof i._annotation[1]=="string"?i._annotation[1]:i._annotation[1].name):i._annotation=[];u.push({name:l,labels:[{text:i.annotation.text}],annotation:i.annotation,type:"bpmn",shape:"annotation",_type:"node",_shape:"path",ports:y,constraints:p,width:i.annotation.width,height:i.annotation.height,_preventStretch:!0});u.push({name:a,labels:[{readOnly:!0}],type:"connector",segments:[{type:"straight"}],targetDecorator:{shape:"none"},sourceNode:u[0].name,targetNode:i.name,constraints:w,annotation:i.annotation,_isAnnotationLine:!0})}u[0].offsetX=i.offsetX+i.annotation.length*Math.cos(-i.annotation.angle*(Math.PI/180));u[0].offsetY=i.offsetY+i.annotation.length*Math.sin(-i.annotation.angle*(Math.PI/180));v=[{fillColor:"transparent",borderColor:i.borderColor,rotateAngle:i.rotateAngle,opacity:i.opacity,ports:[]},{lineColor:i.borderColor,opacity:i.opacity}];n.extend(!0,u,v);f=r.nameTable[u[0].name];e=r.nameTable[u[1].name];f||(f=r._getNewNode(u[0]),r.nameTable[f.name]=f,i._annotation.splice(0,1,f.name));e||(e=r._getNewConnector(u[1]),r.nameTable[e.name]=e,i._annotation.splice(1,1,e.name));this.updateBPMNAnnotationShape(e,f,null,i,r)}return i},renderBPMNAnnotationShape:function(n,i){var u,r,f,e;if(n._annotation&&n._annotation.length)for(u=0;u<n._annotation.length;u++)r=typeof n._annotation[u]=="string"?i.nameTable[n._annotation[u]]:n._annotation[u],r&&(i.nameTable[r.name]=r,f=i.getObjectType(r),f=="node"?t.datavisualization.Diagram.DiagramContext.renderNode(r,i):f=="connector"&&(e=i._disableSegmentChange,i._disableSegmentChange=!1,i._updateEdges(r),i._dock(r,i.nameTable),t.datavisualization.Diagram.DiagramContext.renderConnector(r,i),i._disableSegmentChange=e))},updateBPMNAnnotationShape:function(i,r,u,f,e){var a,l,v;if(e.getObjectType(i)=="connector"&&i._isAnnotationLine){u&&e.nameTable[u]&&(a=e.nameTable[u],n.extend(!0,a,t.datavisualization.Diagram.BPMNTextAnnotationDefaults),delete a._annotation);f||(f=e.nameTable[i.targetNode]);var o=t.datavisualization.Diagram.Util.bounds(r),s=20,h=20,c;c=f?t.datavisualization.Diagram.Util.bounds(f):{x:i.targetPoint.x,y:i.targetPoint.y,width:i.lineWidth,height:i.lineWidth};l="";o.x<=c.x+c.width&&o.x+o.width>=c.x&&(o.y+o.height<c.y&&(l="bottom"),o.y>c.y+c.height&&(l="top"));l||(o.x>c.x+c.width&&(l="left"),o.x+o.width<c.x&&(l="right"));l||i.annotation.direction||(l="left");i.annotation.direction=l;r.labels[0].horizontalAlignment=r.labels[0].verticalAlignment=r.labels[0].textAlign="center";switch(i.annotation.direction){case"left":h=o.height;r.pathData="M"+s+","+h+" L0,"+h+" L0,0 L"+s+",0";r.labels[0].horizontalAlignment="left";r.labels[0].textAlign="left";r.labels[0].offset=t.datavisualization.Diagram.Point(.05,.5);break;case"right":h=o.height;s=o.width-20;r.pathData="M"+s+","+h+" L"+(s+20)+","+h+" L"+(s+20)+",0 L"+s+",0";r.labels[0].horizontalAlignment="right";r.labels[0].textAlign="right";r.labels[0].offset=t.datavisualization.Diagram.Point(.95,.5);break;case"top":s=o.width;r.pathData="M"+s+","+h+" L"+s+",0 L0,0 L0,"+h;r.labels[0].verticalAlignment="top";r.labels[0].offset=t.datavisualization.Diagram.Point(.5,0);break;case"bottom":h=o.height-20;s=o.width;r.pathData="M"+s+","+h+" L"+s+","+(h+20)+" L0,"+(h+20)+" L0,"+h;r.labels[0].verticalAlignment="bottom";r.labels[0].offset=t.datavisualization.Diagram.Point(.5,1)}e.nameTable[i.name]&&(v=e._disableSegmentChange,e._disableSegmentChange=!1,i.annotation.direction=i.sourcePort=l,e._updateEdges(i),e._dock(i,e.nameTable),e._disableSegmentChange=v);t.datavisualization.Diagram.DiagramContext.update(r,e)}},translateBPMNAnnotationShape:function(i,r,u,f,e){var h,c,p,w,v,y,b,k;if(i.annotation&&i.shape!="annotation"){if(h=[],i.annotation&&i.annotation.text&&(i=n.extend(!0,{},t.datavisualization.Diagram.BPMNTextAnnotationDefaults,i),i._annotation&&i._annotation.length)){for(c=0;c<i._annotation.length;c++)e.nameTable[i._annotation[c]]&&h.push(e.nameTable[i._annotation[c]]);if(h.length){if(p=r,w=u,f){var p=0,w=0,l=t.Matrix.identity();i.rotateAngle?(t.Matrix.rotate(l,-i.rotateAngle,f.x,f.y),t.Matrix.scale(l,r,u,f.x,f.y),t.Matrix.rotate(l,i.rotateAngle,f.x,f.y)):t.Matrix.scale(l,r,u,f.x,f.y);var o=t.datavisualization.Diagram.Util.bounds(i),d=i.offsetX-f.x,g=i.offsetY-f.y,nt={bottom:{x:i.offsetX,y:o.y},left:{x:o.x+o.width,y:i.offsetY},top:{x:i.offsetX,y:o.y+o.height},right:{x:o.x,y:i.offsetY}},s=nt[h[0].annotation.direction],a=t.Matrix.transform(l,{x:s.x-d,y:s.y-g});a.x!=s.x&&(p=s.x-a.x);a.y!=s.y&&(w=s.y-a.y)}e._translate(h[0],p,w,e.nameTable)}}}else if(i.annotation&&i.shape=="annotation"){for(y=0;y<i.outEdges.length;y++)if(b=e.nameTable[i.outEdges[y]],b._isAnnotationLine){v=b;break}v&&(k=i.targetNode?e.nameTable[i.targetNode]:null,this.updateBPMNAnnotationShape(v,e.nameTable[v.sourceNode],null,k,e))}},updateAnnotationProperties:function(i,r){r.getObjectType(i)=="node"&&(i=r.nameTable[i.outEdges[0]]);var f=r.nameTable[i.targetNode],u=r.nameTable[i.sourceNode];f&&u?(i.annotation.angle=t.datavisualization.Diagram.Util._findAngle({x:u.offsetX,y:u.offsetY},{x:f.offsetX,y:f.offsetY})*-1,i.annotation.length=t.datavisualization.Diagram.Util.findLength({x:f.offsetX,y:f.offsetY},{x:u.offsetX,y:u.offsetY}),u.annotation=f.annotation=n.extend(!0,{},i.annotation),f._annotation=[i.sourceNode,i.name],r.nodes().indexOf(u)>-1&&(t.datavisualization.Diagram.Util.removeItem(r.nodes(),u),t.datavisualization.Diagram.Util.removeItem(r.connectors(),i),r._nodes=n.extend(!0,[],r.nodes()))):u&&(i.annotation.angle=t.datavisualization.Diagram.Util._findAngle({x:u.offsetX,y:u.offsetY},i.targetPoint)*-1,i.annotation.length=t.datavisualization.Diagram.Util.findLength(i.targetPoint,{x:u.offsetX,y:u.offsetY}),u.annotation=n.extend(!0,{},i.annotation),r.nodes().push(u),r.connectors().push(i),r._nodes=n.extend(!0,[],r.nodes()))},updateInlineDecoratorsShape:function(n,i){var r,f,u,e;return n.shape&&n.shape.type=="bpmn"&&n.shape.flow=="message"&&(n._inlineDecorators.length&&(f=n._inlineDecorators.filter(function(t){if(t.name==n.name+"_"+n.shape.message)return t}),f.length&&(r=f[0])),n._inlineDecorators=[],(n.shape.message=="initiatingmessage"||n.shape.message=="noninitiatingmessage")&&(u=t.datavisualization.Diagram.Util._findOffsetOnConnector(n,{segmentOffset:.5},.5,i),e=n.shape.message=="noninitiatingmessage"?"lightgrey":"white",r?(r.offsetX=u.offset.x,r.offsetY=u.offset.y,r.fillColor=e):r=t.datavisualization.Diagram.Node({name:n.name+"_"+n.shape.message,width:25,height:15,offsetX:u.offset.x,offsetY:u.offset.y,fillColor:e,shape:"path",pathData:"M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0",constraints:t.datavisualization.Diagram.NodeConstraints.Delete}),n._inlineDecorators.push(r))),n}};t.datavisualization.Diagram.bpmnHelper={resetNodeMargin:function(n,i,r){var e={marginLeft:n.marginLeft,marginRight:n.marginRight,marginTop:n.marginTop,marginBottom:n.marginBottom},u,o,f;if(t.datavisualization.Diagram.canvasHelper._updateNodeMargin(r,n,i),i&&i._type=="group")for(u=0;u<i.children.length;u++){o=typeof i.children[u]=="string"?r.nameTable[i.children[u]]:i.children[u];for(f in e)e[f]==0&&(o[f]=0)}},updateCanvas:function(n,i){var r,u;i._isUndo||t.datavisualization.Diagram.canvasHelper._updateNodeMargin(i,n,i.nameTable[n.parent]);n.container&&n.container.type==="canvas"&&(t.datavisualization.Diagram.canvasHelper._setSize(i,n,!0),this.updateProcessCollection(n,i),n.parent&&i.nameTable[n.parent]?(r=i.nameTable[n.parent],this.resetNodeMargin(n,r,i),this.updateCanvas(r,i)):t.datavisualization.Diagram.canvasHelper._updateNodeMargin(i,n,i.nameTable[n.parent]),i.nameTable[n.name]&&(u=i._disableSegmentChange,i._disableSegmentChange=!1,i._updateAssociatedConnectorEnds(n,i.nameTable),t.datavisualization.Diagram.DiagramContext.update(n,i),i._disableSegmentChange=u))},updateProcessCollection:function(n,i){var r,f;if(n.shape=="activity"&&n.activity=="subprocess"){for(var u=n.subProcess.processes,r=0,e=i._getChildren(n.children);u&&u.length&&r<u.length;)e.indexOf(u[r].name)==-1?t.datavisualization.Diagram.Util.removeItem(u,u[r]):u[r]=i.nameTable[u[r++].name];for(r=0;r<n.children.length;r++)f=typeof n.children[r]=="string"?i.nameTable[n.children[r]]:n.children[r],f._isInternalShape||u.indexOf(f)!=-1||u.push(f)}},isBPMNContainerChild:function(n,t){if(n&&n.parent){var i=t.nameTable[n.parent];return i&&i.type=="bpmn"&&i.shape!="group"&&i.container?!0:!1}},canMoveOutofBounds:function(n,i,r,u){var e,o,f;return n.getObjectType(i)=="connector"&&(i.sourceNode||i.targetNode)&&(e=n.nameTable[i.sourceNode||i.targetNode],e&&this.isBPMNContainerChild(e,n))?(o=n.nameTable[e.parent],f=t.datavisualization.Diagram.Util.bounds(o),f=t.datavisualization.Diagram.Geometry.rect([f.topLeft,f.topRight,f.bottomRight,f.bottomLeft]),r>=f.x+f.width||r<=f.x||u>=f.y+f.height||u<=f.y?!1:!0):!0},canAllowConnection:function(n,t,i){var r=null;if(t&&i&&i.type=="bpmn"){if(i.parent&&(r=n.nameTable[i.parent]),r&&r.type=="bpmn"&&r.shape!="group"&&t.parent!=i.parent)return r;if(n._containsChild(i,t)||n._containsChild(t,i))return null}return i},canAllowDropOnContainer:function(n,t){return t.type!="bpmn"||n.type=="bpmn"&&n.shape!="annotation"?!0:!1}}}(jQuery,Syncfusion),function(n,t){"use strict";var i=function(){function n(n){return this.xmlns="http://www.w3.org/2000/svg",this.document=document.createElementNS(this.xmlns,"svg"),this.id=n.id,n&&t.datavisualization.Diagram.Util.attr(this.document,n),this}return n.prototype.element=function(n,i){var r;return n&&n.id&&(r=this.document.getElementById(n.id)),r||(r=document.createElementNS(this.xmlns,i)),n&&t.datavisualization.Diagram.Util.attr(r,n),r},n.prototype.g=function(n){return this.element(n,"g")},n.prototype.defs=function(n){return this.element(n,"defs")},n.prototype.image=function(n){return this.element(n,"image")},n.prototype.path=function(n){return this.element(n,"path")},n.prototype.text=function(n){return this.element(n,"text")},n.prototype.textPath=function(n){return this.element(n,"textPath")},n.prototype.tspan=function(n){return this.element(n,"tspan")},n.prototype.rect=function(n){return this.element(n,"rect")},n.prototype.ellipse=function(n){return this.element(n,"ellipse")},n.prototype.circle=function(n){return this.element(n,"circle")},n.prototype.title=function(n){return this.element(n,"title")},n.prototype.line=function(n){return this.element(n,"line")},n.prototype.polyline=function(n){return this.element(n,"polyline")},n.prototype.polygon=function(n){return this.element(n,"polygon")},n.prototype.foreignObject=function(n){return this.element(n,"foreignObject")},n.prototype.linearGradient=function(n){return this.element(n,"linearGradient")},n.prototype.radialGradient=function(n){return this.element(n,"radialGradient")},n.prototype.stop=function(n){return this.element(n,"stop")},n.prototype.pattern=function(n){return this.element(n,"pattern")},n.prototype.appendChild=function(n){this.document.appendChild(n)},n.prototype.removeChild=function(n,t){t?t.removeChild(n):this.document.removeChild(n)},n.prototype.getElementById=function(n){return this.document.getElementById(n)},n.prototype.getElementsByClassName=function(n){return this.document.getElementsByClassName(n)},n.prototype.getElementsByTagName=function(n){return this.document.getElementsByTagName(n)},n.prototype.pathBounds=function(n){var f={d:n},r=this.path(f),i=new t.datavisualization.Diagram.Svg({id:"TempSvg"}),u;return document.body.appendChild(i.document),i.document.appendChild(r),u=r.getBBox(),document.body.removeChild(i.document),u},n.prototype.textBounds=function(n,t,i){var u=null,r;return n&&t?(r=this.text(t),r.appendChild(document.createTextNode(n)),this.document.appendChild(r),u=r.getBBox(),this.document.removeChild(r)):i&&(this.document.appendChild(i),u=i.getBBox(),this.document.removeChild(i)),u},n.prototype.absolutePath=function(n){for(var i,s,f,v,y,h,c,l,a,e=t.datavisualization.Diagram.Util.convertPathToArray(n.getAttribute("d")),r=0,u=0,o=0,p=e.length;o<p;++o){if(i=e[o],s=i.pathSegTypeAsLetter,/[MLHVCSQTA]/.test(s))"x"in i&&(r=i.x),"y"in i&&(u=i.y);else{"x1"in i&&(h=r+i.x1);"x2"in i&&(l=r+i.x2);"y1"in i&&(c=u+i.y1);"y2"in i&&(a=u+i.y2);"x"in i&&(r+=i.x);"y"in i&&(u+=i.y);switch(s){case"m":f={pathSegTypeAsLetter:"M",x:r,y:u};break;case"l":f={pathSegTypeAsLetter:"L",x:r,y:u};break;case"h":f={pathSegTypeAsLetter:"H",x:r};break;case"v":f={pathSegTypeAsLetter:"V",y:u};break;case"c":f={pathSegTypeAsLetter:"C",x:r,y:u,x1:h,y1:c,x2:l,y2:a};break;case"s":f={pathSegTypeAsLetter:"S",x:r,y:u,x2:l,y2:a};break;case"q":f={pathSegTypeAsLetter:"Q",x:r,y:u,x1:h,y1:c};break;case"t":f={pathSegTypeAsLetter:"T",x:r,y:u};break;case"a":f={pathSegTypeAsLetter:"A",x:r,y:u,r1:i.r1,r2:i.r2,angle:i.angle,largeArcFlag:i.largeArcFlag,sweepFlag:i.sweepFlag};break;case"z":case"Z":r=v;u=y;f=e[o]}f&&(e[o]=f)}(s==="M"||s==="m")&&(v=r,y=u)}return n.setAttribute("d",t.datavisualization.Diagram.Util.pathSegArrayAsString(e)),n},n}();t.datavisualization.Diagram.Svg=i;t.datavisualization.Diagram.SvgContext={_renderDocument:function(n,i,r){var f,u;window.SVGSVGElement&&(f={id:n.canvas.id+"_svg",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:"position:absolute","class":"mainview_svg",role:"img"},t.isMobile()&&(f.style="position: inherit"),u=r?i._svg:new t.datavisualization.Diagram.Svg(f),n.svg=u,i&&(i._svg=u,r||document.getElementById(u.document.id)||n.canvas.appendChild(u.document),i._view=this._renderView(n.canvas,n.svg,r),i._page=this._renderPage(n.canvas,n.svg,i._view,r),this._renderBackground(i,n.canvas,n.svg,i._page,i.model,r),i._pageBackgroundLayer=this._renderBackgroundLayer(n.canvas,n.svg,i._page,r),this._renderGrid(n.canvas,n.svg,i._page,i),i._diagramLayer=n.diagramLayer=this._renderDiagramLayer(n.canvas,n.svg,i._page),i._htmlLayer=this._renderHtmlLayer(n.canvas,r),this._renderAdornerLayer(i,n.canvas,r,n)))},_renderView:function(n,t,i){var r=t.document.getElementById(n.id+"_view"),u;return r||(u={id:n.id+"_view"},r=t.g(u)),i||t.appendChild(r),r},_renderHtmlLayer:function(n,i){var r=document.getElementById(n.id+"_htmlLayer"),f,u;return r||(r=document.createElement("div")),f={id:n.id+"_htmlLayer","class":"htmlLayer"},t.datavisualization.Diagram.Util.attr(r,f),u=r,r.style.pointerEvents="none",i||n.appendChild(u),u},_renderAdornerLayer:function(n,i,r,u){var f=document.getElementById(i.id+"_adorner"),e;f||(f=document.createElement("div"));e={id:i.id+"_adorner","class":"adornerLayer",style:"position:absolute;left:0px;top:0px"};t.datavisualization.Diagram.Util.attr(f,e);n._adornerLayer=this._renderAdornerSvg(n,i,f,r,u);n._tooltipLayer=this._renderTooltipLayer(i,f,r);r||i.appendChild(f)},_renderTooltipLayer:function(n,i,r){var u=document.getElementById(n.id+"_tooltip"),e,f;return u||(u=document.createElement("div")),e={id:n.id+"_tooltip","class":"diagram_tooltip"},t.datavisualization.Diagram.Util.attr(u,e),f=u,u.style.pointerEvents="none",r||i.appendChild(f),f},_renderPage:function(n,t,i,r){var u=t.document.getElementById(n.id+"_page"),f;return u||(f={id:n.id+"_page","class":"page"},u=t.g(f)),r||i.appendChild(u),u},_renderDiagramLayer:function(n,t,i){var r=t.document.getElementById(n.id+"_diagramLayer"),u;return r||(u={id:n.id+"_diagramLayer","class":"DiagramLayer"},r=t.g(u),i.appendChild(r)),r},_renderAdornerSvg:function(n,i,r,u,f){var e,s,h,o;if(window.SVGSVGElement)return o={id:i.id+"_svg_adorner",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:"position:absolute",fill:"none","pointer-events":"none"},e=u?n._adornerSvg:new t.datavisualization.Diagram.Svg(o),u||document.getElementById(e.document.id)||r.appendChild(e.document),s=e.document.getElementById(i.id+"_expander"),s||(o={id:i.id+"_expander","class":"ExpanderLayer","pointer-events":"all"},s=e.g(o),e.document.appendChild(s)),f._expander=n._expander=s,h=e.document.getElementById(i.id+"_adornerLayer"),h||(o={id:i.id+"_adornerLayer","class":"AdornerLayer","pointer-events":"none"},h=e.g(o),e.document.appendChild(h)),n._adornerSvg=e,h},_renderBackgroundLayer:function(n,t,i,r){var u=t.document.getElementById(n.id+"_pageBackground"),f;return u||(f={id:n.id+"_pageBackground","class":"PageBackgroundLayer",style:"pointer-events:none;"},u=t.g(f)),r||i.appendChild(u),u},_renderBackground:function(n,i,r,u){var c,l,s;r.document.style.msTouchAction="none";r.document.style.display="block";r.document.style.backgroundColor="white";var h={id:i.id+"_backgroundLayer"},f=r.g(h),e=n._getDigramBounds();if(n._backgroundImage()){var o=n._backgroundImage(),a=t.datavisualization.Diagram.Util._getImageAlignment(o.alignment),v="none "+a!="none"&&o.scale!="none"?a+" "+o.scale:"none";h={id:i.id+"_backgroundImage",x:e.x,y:e.y,width:e.width,height:e.height,preserveAspectRatio:v,"pointer-events":"none"};c=r.image(h);c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o.source);r.getElementById(i.id+"_backgroundImage")||f.appendChild(c)}l=n._backgroundColor();s=r.rect({id:i.id+"_backgroundColor",width:"100%",height:"100%",fill:l,preserveAspectRatio:"none","pointer-events":"none"});l?r.getElementById(i.id+"_backgroundColor")||f.appendChild(s):r.getElementById(s.id)&&f.removeChild(r.getElementById(s.id));r.getElementById(f.id)||u.appendChild(f)},_renderGrid:function(n,i,r,u){var h=u._svg.document.getElementById(n.id+"patterndefinition"),o,c,l,a,e,f,v,s;if(h||(h=i.defs({id:n.id+"patterndefinition"}),i.appendChild(h)),u._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.ShowHorizontalLines||u._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.ShowVerticalLines){var s=document.getElementById(n.id+"_grid"),v=document.getElementById(n.id+"pattern_gridline"),f=document.getElementById(n.id+"pattern_grid");f&&f.parentNode&&f.parentNode.removeChild(f);c={id:n.id+"_grid","pointer-events":"none"};o=i.g(c);l=0;u.model.snapSettings.horizontalGridLines.linesInterval&&u.model.snapSettings.horizontalGridLines.linesInterval.forEach(function(n){l+=n});a=0;u.model.snapSettings.verticalGridLines.linesInterval&&u.model.snapSettings.verticalGridLines.linesInterval.forEach(function(n){a+=n});e=this._scaleSnapInterval(u.model,u._currZoom);c={id:n.id+"pattern_grid",x:0,y:0,width:a*e,height:l*e,patternUnits:"userSpaceOnUse"};f=i.pattern(c);e=this._scaleSnapInterval(u.model,e);this._renderHorizontalGridlines(e,f,a,u,i);this._renderVerticalGridlines(e,f,l,u,i);h.appendChild(f);v=i.rect({id:n.id+"pattern_gridline",x:u._hScrollOffset,y:u._vScrollOffset,width:"100%",height:"100%",fill:"url(#"+n.id+"pattern_grid)"});o.appendChild(v);s||(u._diagramLayer?r.insertBefore(o,u._diagramLayer):r.appendChild(o))}else o=document.getElementById(n.id+"_grid"),o&&(s=document.getElementById(n.id+"pattern_gridline"),s&&s.parentNode&&s.parentNode.removeChild(s))},_updateBackground:function(n,i,r,u){var s={x:n,y:i},o=document.getElementById(u._id+"_canvas_backgroundColor"),e,f;o&&t.datavisualization.Diagram.Util.attr(o,s);e=document.getElementById(u._id+"_canvas_backgroundImage");f=u._getDigramBounds();e&&t.datavisualization.Diagram.Util.attr(e,{transform:"scale("+r+")",x:f.x,y:f.y,width:f.width,height:f.height})},_updateGrid:function(n,i,r,u){var l=document.getElementById(u._canvas.id+"pattern_gridline"),f,e,o,s,a,c,h;if(l){if(e=document.getElementById(u._canvas.id+"pattern_grid"),o=0,u.model.snapSettings.horizontalGridLines.linesInterval)for(f=0;f<u.model.snapSettings.horizontalGridLines.linesInterval.length;f++)o+=u.model.snapSettings.horizontalGridLines.linesInterval[f];if(s=0,u.model.snapSettings.verticalGridLines.linesInterval)for(f=0;f<u.model.snapSettings.verticalGridLines.linesInterval.length;f++)s+=u.model.snapSettings.verticalGridLines.linesInterval[f];h={x:n,y:i};t.datavisualization.Diagram.Util.attr(l,h);r=this._scaleSnapInterval(u.model,r);a=u._svg;c=a.defs({id:u._canvas.id+"patterndefinition"});e&&c.removeChild(e);h={id:u._canvas.id+"pattern_grid",x:0,y:0,width:s*r,height:o*r,patternUnits:"userSpaceOnUse"};e=u._svg.pattern(h);this._renderHorizontalGridlines(r,e,s,u,u._svg);this._renderVerticalGridlines(r,e,o,u,u._svg);c.appendChild(e)}},_scaleSnapInterval:function(n,t){if(t>=2)while(t>=2)t/=2;else if(t<=.5)while(t<=.5)t*=2;var i;if(t!==1){for(n.snapSettings.horizontalGridLines._snapinterval=[],i=0;i<n.snapSettings.horizontalGridLines.snapInterval.length;i++)n.snapSettings.horizontalGridLines._snapinterval[i]=n.snapSettings.horizontalGridLines.snapInterval[i]*t;for(n.snapSettings.verticalGridLines._snapinterval=[],i=0;i<n.snapSettings.verticalGridLines.snapInterval.length;i++)n.snapSettings.verticalGridLines._snapinterval[i]=n.snapSettings.verticalGridLines.snapInterval[i]*t}return t},_renderHorizontalGridlines:function(n,i,r,u,f){var a=u.model,o=a.snapSettings,s,c,e,h,l;if(u._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.ShowHorizontalLines)for(s=0,c=0,e=0;e<o.horizontalGridLines.linesInterval.length;e=e+2)h=o.horizontalGridLines.linesInterval[e],l=f.line({x1:0,y1:s*n,x2:r*n,y2:s*n,stroke:o.horizontalGridLines.lineColor,"stroke-width":h,"stroke-dasharray":o.horizontalGridLines.lineDashArray}),s+=o.horizontalGridLines.linesInterval[e+1]+h,i.appendChild(l),c++},_renderVerticalGridlines:function(n,i,r,u,f){var c=u.model,o=c.snapSettings,s,l,e,h,a;if(o.snapConstraints&t.datavisualization.Diagram.SnapConstraints.ShowVerticalLines)for(s=0,l=0,e=0;e<o.verticalGridLines.linesInterval.length;e=e+2)h=c.snapSettings.verticalGridLines.linesInterval[e],a=f.line({x1:s*n,y1:0,x2:s*n,y2:r*n,stroke:o.verticalGridLines.lineColor,"stroke-width":h,"stroke-dasharray":o.verticalGridLines.lineDashArray}),s+=o.verticalGridLines.linesInterval[e+1]+h,i.appendChild(a),l++},transformView:function(n,i,r){var f=n._view,u={transform:"translate("+i+","+r+")"};t.datavisualization.Diagram.Util.attr(f,u);t.datavisualization.Diagram.Util.attr(n._adornerLayer,u);t.datavisualization.Diagram.Util.attr(n._expander,{transform:"translate("+i+","+r+"),scale("+n.model.scrollSettings.currentZoom+")"});n._htmlLayer&&(n._htmlLayer.style.left=i+"px",n._htmlLayer.style.top=r+"px",n._htmlLayer.style.position="absolute")},scaleContent:function(n,i){var e=n._diagramLayer,u,f,r;t.datavisualization.Diagram.Util.attr(e,{transform:"scale("+i+")"});u=typeof n.model.scrollSettings.horizontalOffset=="function"?n.model.scrollSettings.horizontalOffset():n.model.scrollSettings.horizontalOffset;f=typeof n.model.scrollSettings.verticalOffset=="function"?n.model.scrollSettings.verticalOffset():n.model.scrollSettings.verticalOffset;t.datavisualization.Diagram.Util.attr(n._expander,{transform:"translate("+-u+","+-f+"),scale("+i+")"});n._htmlLayer&&(n._htmlLayer.style.webkitTransform="scale("+i+")",n._htmlLayer.style.MozTransform="scale("+i+")",n._htmlLayer.style.OTransform="scale("+i+")",n._htmlLayer.style.msTransform="scale("+i+")",n._htmlLayer.style.transform="scale("+i+")");n.selectionList.length>0&&this.updateSelector(n.selectionList[0],n._adornerSvg,i,n,n.model.selectedItems.constraints);n.selectionList[0]&&n.model.selectedItems.userHandles&&n.model.selectedItems.userHandles.length>0&&(r=!1,n.selectionList[0].type=="pseudoGroup"&&(r=!0),n.model.selectedItems.constraints&t.datavisualization.Diagram.SelectorConstraints.UserHandles&&t.datavisualization.Diagram.SvgContext.updateUserHandles(n.model.selectedItems.userHandles,n.selectionList[0],n._adornerSvg,r,!1,i,n))},setSize:function(n,i,r){t.datavisualization.Diagram.Util.attr(n._svg.document,{width:i+"px",height:r+"px"});t.datavisualization.Diagram.Util.attr(n._adornerSvg.document,{width:i+"px",height:r+"px"})},_findIndex:function(t,i){var r,f=1,e,u;return u=i.parent?n("#"+i.parent.name).find(">.node,>.connector,>.group"):n("#DiagramContent_canvas_svg").find(">.node,>.connector,>.group"),i.name!="helper"&&(r=u[u.length-1],r&&r.id=="helper"&&(r=u[u.length-2]),r&&(e=0,r.className.animVal=="ej-d-node"||r.className.animVal=="ej-d-group"?f=e+1:r.className.animVal=="ej-d-connector"&&(f=e+1))),f},renderNode:function(n,i,r,u,f){var e,v=n.width?n.width:n._width||0,y=n.height?n.height:n._height||0,p=n.name,c=0,l=0,o=0,s=0,a=0,w=n.visible?"visible":"hidden",h;return u||(o=n.offsetX-v*n.pivot.x,s=n.offsetY-y*n.pivot.y,c=n.offsetX,l=n.offsetY,a=n.rotateAngle),t.datavisualization.Diagram.Util.canCrispEdges(n,f)&&(o=Math.floor(o)+.5,s=Math.floor(s)+.5),h={id:p,"class":"ej-d-node",transform:"rotate("+a+","+c+","+l+"),translate("+o+","+s+")",visibility:w},t.datavisualization.Diagram.Util.canEnablePointerEvents(n,f)||(h.style="pointer-events:none"),n._isClassifier&&(h["class"]+=" ej-d-classifier"),e=i.g(h),r?r.appendChild(e):i.appendChild(e),n._isDisabled&&t.datavisualization.Diagram.Util.attr(e,{style:"pointer-events:none;"}),this._renderNode(n,i,e,f,u),n&&n.annotation&&t.datavisualization.Diagram.DefautShapes.renderBPMNAnnotationShape(n,f),n._isClassifier&&delete n._isClassifier,e},_renderNode:function(n,t,i,r,u){this._renderShape(n,t,i,r);this._renderLabels(n,t,r,u);this._renderPorts(n,t,i);n.outEdges.length>0&&this._renderIcons(n,r)},_renderShadow:function(n,i){var u,f,r,e,o,s;n.segments||(u=i.document.getElementById(n.name),n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=n.fillColor,n.type==="image"||n.type==="text"||n.type==="html"?r=i.document.getElementById(n.name+"_backRect"):n.type!="text"&&n.type!="image"&&(r=i.document.getElementById(n.name+"_shape")),r&&(e=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),o={id:n.name+"_shadow",width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:f!="none"||f!="transparent"?"lightgrey":"none",transform:"translate("+e.x+","+e.y+")",opacity:n.shadow.opacity,"stroke-dasharray":""},n.type==="native"||n.type==="html"?u.insertBefore(i.rect(o),r):(s=r.cloneNode(!0),u.insertBefore(s,r),t.datavisualization.Diagram.Util.attr(s,o)))))},_updateShadow:function(n,i){var f=i.document.getElementById(n.name),r=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),u={id:n.name+"_shadow",transform:"translate("+r.x+","+r.y+")",opacity:n.shadow.opacity};i.g(u)},_removeShadow:function(n,t){if(n.type!="text"){var i,r,u=n.name;n.type==="bpmn"&&n.children&&n.shape!="group"&&(u=n.children[0].name);i=t.document.getElementById(u);r=t.document.getElementById(u+"_shadow");i&&r&&i.removeChild(r)}},_renderphase:function(n,i,r,u,f){var o,p,s,v,y;o=i.g({id:n.name+"_phase_g","class":"ej-d-seperator"});n.parent?r.appendChild(o):i.appendChild(o);var w="visible",c=0,l=0;if(f){p=u._getChildren(f.children);p.length>1&&(s=u.nameTable[p[0]]);var e=t.datavisualization.Diagram.Util.bounds(f),h=[],a,b=e.top+50,k=e.left+50;n.orientation=="vertical"?(h.push({x:0,y:0}),h.push({x:e.width,y:0}),a=this._convertToSVGPoints(h),c=e.x,l=e.y+n.offset+s.height,s&&(b+=s.height),l<e.bottom&&l>b||(w="hidden")):(h.push({x:0,y:s.height?s.height:0}),h.push({x:0,y:e.height}),a=this._convertToSVGPoints(h),c=e.x+n.offset,l=e.y,c<e.right&&c>k||(w="hidden"));v={id:n.name+"_phase",stroke:n.lineColor,"stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,points:a};y=i.polyline(v);o.appendChild(y);v={id:n.name+"_phase_hitTest","class":"hitTest","stroke-width":10,points:a,stroke:"transparent"};y=i.polyline(v);o.appendChild(y);o.setAttribute("transform","translate("+c+","+l+")")}},renderphase:function(n,t,i,r,u){var f,e;r._views.forEach(function(t){f=r._views[t];e=f.svg||f._canvas;i&&(i=e.document.getElementById(i.id));f.context._renderphase(n,e,i||f.diagramLayer,r,u)})},_renderGroupBackground:function(n,i,r,u){var c,f,y,l;if(n.fillColor!="none"){var e=n.offsetX-n.width*n.pivot.x,o=n.offsetY-n.height*n.pivot.y,s=n.fillColor,a=n.borderColor;(n.type=="bpmn"&&n.shape!="group"||n.classifier&&n.classifier=="package")&&(s="transparent",a="transparent");t.datavisualization.Diagram.Util.canCrispEdges(n,u)&&(e=Math.floor(e)+.5,o=Math.floor(o)+.5);var p=n.rotateAngle,v=new t.datavisualization.Diagram.Point(e+n.width*n.pivot.x,o+n.height*n.pivot.y),h={id:n.name+"_shape",rx:n.cornerRadius,ry:n.cornerRadius,width:Math.round(n.width<0?0:n.width),height:Math.round(n.height<0?0:n.height),fill:s,stroke:a,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,transform:"rotate("+p+","+v.x+","+v.y+"),translate("+e+","+o+")"};(n.type=="umlclassifier"||n._isClassifier)&&(h["class"]="ej-d-group ej-d-classifier");n.gradient&&n.type!="bpmn"&&(h.fill=this._renderGradient(n.name,n.gradient,r));this._addCssClass(n,h);c=r.rect(h);i.appendChild(c);n.type==="bpmn"&&n.shape==="group"&&n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),n.shape==="group"&&n.children.length===0&&(f.x=n.offsetX-n.width*n.pivot.x+f.x,f.y=n.offsetY-n.height*n.pivot.y+f.y),y={id:n.name+"_shadow",width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:s!="none"||s!="transparent"?"lightgrey":"none",transform:"translate("+f.x+","+f.y+")",opacity:n.shadow.opacity,"stroke-dasharray":""},l=c.cloneNode(!0),i.insertBefore(l,c),t.datavisualization.Diagram.Util.attr(l,y))}},renderGroup:function(n,i,r,u,f,e,o){var h,b=n.visible?"visible":"hidden",y={id:n.name,"class":"ej-d-group",visibility:b},c,a,w,s,l,p,r,v;if(t.datavisualization.Diagram.Util.canEnablePointerEvents(n,f)||(y.style="pointer-events:none"),(n.type=="umlclassifier"||n._isClassifier)&&(y["class"]+=" ej-d-classifier"),h=i.g(y),r?r.appendChild(h):i.appendChild(h),n.parent==""&&n.container&&(e&&(n.height=0,n.width=0),o||f._updateChildAdjacentConnectors(n)),this._renderGroupBackground(n,h,i,f),n.isSwimlane&&(f._disableSwimlaneUptate=!0),c=n.children,c&&c.length>0)for(a=0,w=c.length;a<w;a++)s=u[t.datavisualization.Diagram.Util.getChild(c[a])],s&&(s._type==="group"?(n.type=="umlclassifier"&&(s._isClassifier=!0),this.renderGroup(s,i,h,u,f,e,o),t.datavisualization.Diagram.Util._updateGroupBounds(s,f,!0),t.datavisualization.Diagram.DiagramContext.update(s,f)):s.segments?(t.datavisualization.Diagram.Util.updateBridging(s,f),this.renderConnector(s,i,h,f)):(n.type=="umlclassifier"&&(s._isClassifier=!0),this.renderNode(s,i,h,undefined,f)));return this._renderLabels(n,i,f),this._renderPorts(n,i,h),n.isSwimlane&&delete f._disableSwimlaneUptate,n&&n.annotation&&t.datavisualization.Diagram.DefautShapes.renderBPMNAnnotationShape(n,f),n&&n.isSwimlane&&(v=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(f,n),f._views.forEach(function(t){var i,u;for(l=f._views[t],p=l.svg||l._canvas,r&&(r=p.document.getElementById(r.id)),i=0;v&&i<v.length;i++)u=f.nameTable[v[i]],u&&l.context._renderphase(u,p,r||l.diagramLayer,f,n)})),n._isClassifier&&delete n._isClassifier,h},_renderGradient:function(n,t,i){var u,r;return t.type==="linear"?(r=this._renderLinearGradient(i.id+"_"+n,t,i),u="url(#"+r+")"):t.type==="radial"&&(r=this._renderRadialGradient(i.id+"_"+n,t,i),u="url(#"+r+")"),u},_checkGradientTag:function(n,t,i){if(t.getElementById(n+"_gradient")){var r=t.getElementById(n+"_gradient");(i&&r.localName==="radialGradient"||!i&&r.localName==="linearGradient")&&r.parentNode.removeChild(r)}},_renderLinearGradient:function(n,t,i){var u=i.document.getElementById(i.document.parentNode.id+"patterndefinition")||i.document.getElementById(n+"patterndefinition"),f,r;return u?(this._checkGradientTag(n,i,!0),f={id:n+"_gradient",x1:t.x1+"%",y1:t.y1+"%",x2:t.x2+"%",y2:t.y2+"%"},r=i.linearGradient(f),this._renderStops(t,i,r),u.appendChild(r),r.id):null},_renderRadialGradient:function(n,t,i){var u=i.document.getElementById(i.document.parentNode.id+"patterndefinition")||i.document.getElementById(n+"patterndefinition"),f,r;return u?(this._checkGradientTag(n,i,!1),f={id:n+"_gradient",cx:t.cx+"%",cy:t.cy+"%",fx:t.fx+"%",fy:t.fy+"%",r:t.r+"%"},r=i.radialGradient(f),this._renderStops(t,i,r),u.appendChild(r),r.id):null},_renderStops:function(n,t,i){var f,r,u,e;if(t.getElementById(i.getAttribute("id"))===i)while(i.firstChild)i.removeChild(i.firstChild);for(f=n.stops,u=0,e=f.length;u<e;u++)r=f[u],i.appendChild(t.stop({offset:r.offset+"%","stop-color":r.color,"stop-opacity":r.opacity}))},_renderShape:function(n,t,i,r){var u=n._shape?n._shape:n.type;switch(u){case"rectangle":this._renderRect(n,t,i);break;case"ellipse":this._renderEllipse(n,t,i);break;case"image":this._renderImage(n,t,i);break;case"path":this._renderPath(n,t,i);break;case"polygon":this._renderPolygon(n,t,i);break;case"text":this._renderTextElement(n,t,i,r);break;case"html":this._renderHtmlElement(n,t,i,r);break;case"native":this._rendercontent(n,t,i,r)}},_renderHTMLTemplate:function(t,i){if(t.templateId&&n.templates)return i._renderEjTemplate("#"+t.templateId,t)},_renderSvgTemplate:function(n,t,i,r){var e=document.createElement("div"),u,o,f;e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g id="tempNative">'+r+"<\/g><\/svg>";document.body.appendChild(e);u=document.getElementById("tempNative").cloneNode(!0);u.id=n.name+"_shape";i.appendChild(u);o={id:n.name+"_shape",fill:n.fillColor,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray};this._addCssClass(n,o);n.gradient&&(o.fill=this._renderGradient(n.name,n.gradient,t));t.g(o);f=this._scaleNodeContent(n,u);f&&u.setAttribute("transform","translate("+f.x+","+f.y+"),scale("+f.sx+","+f.sy+")");u.setAttribute("id",n.name+"_shape");e.parentNode.removeChild(e)},_scaleNodeContent:function(n,t){var u,f,i,r;if(n.scale!="none"){t&&(i=n.type=="html"?t.getBoundingClientRect():t.getBBox());n.type=="html"&&(i.x=i.left,i.y=i.top);u=n.width?n.width:n._width;f=n.height?n.height:n._height;t||(i={x:n.offsetX-n.width*n.pivot.x,y:n.offsetY-n.height*n.pivot.y,width:u,height:f});var e=i.width?u/i.width:1,o=i.height?f/i.height:1,s=i.x*e*-1,h=i.y*o*-1;return n.scale!="stretch"&&n.contentAlignment!="none"?(r=n.scale=="meet"?Math.min(e,o):Math.max(e,o),n.contentAlignment.indexOf("xmid")>-1?s=u/2-i.width*r/2:n.contentAlignment.indexOf("xmax")>-1&&(s=i.x+u-i.width*r),n.contentAlignment.indexOf("ymid")>-1?h=i.y+f/2-i.height*r/2:n.contentAlignment.indexOf("ymax")>-1&&(h=i.y+f-i.height*r),{x:s,y:h,sx:r,sy:r}):{x:s,y:h,sx:e,sy:o}}return null},_rendercontent:function(i,r,u,f){var s,h,c;if(i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow){var e=i.fillColor,o=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},i.shadow.angle,i.shadow.distance),l={id:i.name+"_shadow",width:i.width,height:i.height,stroke:i.borderColor!="none"||i.borderColor!="transparent"?"lightgrey":"none",fill:e!="none"||e!="transparent"?"lightgrey":"none",transform:"translate("+o.x+","+o.y+")",opacity:i.shadow.opacity};u.appendChild(r.rect(l))}!i.segments&&i.templateId&&n.templates&&(s=i.width,h=i.height,i._type!=="node"||i.height||i.width||(i.width=i._width,i.height=i._height),c=f._renderEjTemplate("#"+i.templateId,i),i.width=s,i.height=h,this._renderSvgTemplate(i,r,u,c))},_fill:function(n,t){var i;return n.gradient&&(i=this._renderGradient(n.name,n.gradient,t)),i||(i=n.fillColor),i},_addCssClass:function(n,t){return n.cssClass&&t&&(t["class"]=t["class"]?t["class"]+" "+n.cssClass:n.cssClass),n._cssClass=n.cssClass,t},_updateCssClass:function(n,t){if((n._cssClass!=""||n._cssClass===""&&n.cssClass!=="")&&n._cssClass!==undefined&&n.cssClass!=n._cssClass){var i=t["class"];return i&&(t["class"]=i.replace(n._cssClass,"").trim()),this._addCssClass(n,t)}return t},_renderRect:function(n,i,r){var u=this._fill(n,i),h=n.width?n.width:n._width,c=n.height?n.height:n._height,f={id:n.name+"_shape",rx:n.cornerRadius,ry:n.cornerRadius,role:"presentation",width:h,height:c,fill:u,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray},o,e,s;n._isClassifier&&(o="ej-d-node ej-d-classifier");f["class"]=o;this._addCssClass(n,f);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(e=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),s={id:n.name+"_shadow",rx:n.cornerRadius,ry:n.cornerRadius,width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+e.x+","+e.y+")",opacity:n.shadow.opacity},r.appendChild(i.rect(s)));r.appendChild(i.rect(f))},_renderEllipse:function(n,i,r){var e=n.width?n.width:n._width,o=n.height?n.height:n._height,u=this._fill(n,i),s={id:n.name+"_shape",rx:e/2,ry:o/2,role:"presentation",cx:e/2,cy:o/2,fill:u,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray},f,h;this._addCssClass(n,s);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),h={id:n.name+"_shadow",rx:n.width/2,ry:n.height/2,cx:n.width/2,cy:n.height/2,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+f.x+","+f.y+")",opacity:n.shadow.opacity},r.appendChild(i.ellipse(h)));r.appendChild(i.ellipse(s))},_renderImage:function(n,i,r){var l=n.fillColor,a=this._renderBackgroundRect(n,i,r),o=n.width?n.width:n._width,s=n.height?n.height:n._height,h=t.datavisualization.Diagram.Util._getImageAlignment(n.contentAlignment),c=n.scale=="none"?"meet":n.scale,f={id:n.name+"_shape",opacity:n.opacity,preserveAspectRatio:c!="stretch"&&h!="none"?h+" "+c:"none",width:o,height:s,role:"img"},u=new Image,e;u.src=n.source;n.scale=="none"&&(f.width=u.width||o,f.height=u.height||s);e=i.image(f);e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u.src);r.appendChild(e)},_renderPolygon:function(n,i,r){var u=this._fill(n,i),f,e,o,s;t.datavisualization.Diagram.Geometry.updatePolygonPoints(n);f=this._convertToSVGPoints(n.points);e={id:n.name+"_shape",fill:u,stroke:n.borderColor,role:"presentation","stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,points:f};this._addCssClass(n,e);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(o=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),s={id:n.name+"_shadow",points:f,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+o.x+","+o.y+")",opacity:n.shadow.opacity},r.appendChild(i.polygon(s)));r.appendChild(i.polygon(e))},_renderPath:function(n,i,r){var e=this._fill(n,i),s=n.width?n.width:n._width,h=n.height?n.height:n._height,u,f,o,c;n._absolutePath=n._preventStretch?u=n.pathData:u=t.datavisualization.Diagram.Geometry.updatePath(0,0,s,h,n.pathData,i,null,n);f={id:n.name+"_shape",width:s,height:h,d:u,opacity:n.opacity,role:"presentation","stroke-dasharray":n.borderDashArray,stroke:n.borderColor,"stroke-width":n.borderWidth,fill:e};n._isClassifier&&(f["class"]="ej-d-node ej-d-classifier");this._addCssClass(n,f);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(o=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),c={id:n.name+"_shadow",width:n.width,height:n.height,d:u,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:e!="none"||e!="transparent"?"lightgrey":"none",transform:"translate("+o.x+","+o.y+")",opacity:n.shadow.opacity},r.appendChild(i.path(c)));r.appendChild(i.path(f))},_renderHtmlElement:function(i,r,u,f){var d=this._renderBackgroundRect(i,r,u),c,o,h,l,y,s,p,w,e;if(!i.segments&&i.templateId){e=r.document.parentNode.getElementsByClassName("htmlLayer")[0];c=n(e).children("#"+i.name+"_parentdiv")[0];c&&e.removeChild(c);var a=i.width?i.width:i._width,v=i.height?i.height:i._height,b=i.offsetX-a*i.pivot.x,k=i.offsetY-v*i.pivot.y,o=r.document.getElementById(i.name+"_html");o||(o=document.createElement("div"));h="width:"+a+"px;height:"+v+"px;padding:1px; left:"+b+"px; top:"+k+"px;position:absolute;";h+="display: block; border:0px; pointer-events: all; opacity:"+i.opacity+";";h+="transform:rotate("+i.rotateAngle+"deg)";l={id:i.name+"_html","class":"foreignObject",style:h};this._addCssClass(i,l);t.datavisualization.Diagram.Util.attr(o,l);!i.segments&&i.templateId&&(y=this._renderHTMLTemplate(i,f),o.innerHTML=y);s=document.createElement("div");p={id:i.name+"_parentdiv","class":"ej-d-node"};t.datavisualization.Diagram.Util.attr(s,p);s.appendChild(o);w=i.visible?"visible":"hidden";s.style.visibility=w;e=r.document.parentNode.getElementsByClassName("htmlLayer")[0];e?e.appendChild(s):r.document.parentNode.appendChild(o)}},_initializeGuidelines:function(n,t,i){var r=n.g(t);return i.appendChild(r),r},_renderSideAlignmentLines:function(n,t,i,r,u){var f=r.line({x1:n.x*u,y1:n.y*u,x2:t.x*u,y2:t.y*u,stroke:"#07EDE1","stroke-width":1});i.appendChild(f)},_renderCenterAlignmentLines:function(n,t,i,r,u){var f=r.line({x1:n.x*u,y1:n.y*u,x2:t.x*u,y2:t.y*u,stroke:"#07EDE1","stroke-width":1});i.appendChild(f)},_renderSpacingLines:function(n,t,i,r,u){var e,o,f,s;i&&(f=r.g({}),n.x==t.x?(e="M"+(n.x*u-5)+" "+(n.y*u+5)+" L"+n.x*u+" "+n.y*u+" L"+(n.x*u+5)+" "+(n.y*u+5)+"z",o="M"+(t.x*u-5)+" "+(t.y*u-5)+" L"+t.x*u+" "+t.y*u+" L"+(t.x*u+5)+" "+(t.y*u-5)+"z",f.appendChild(r.line({x1:n.x*u-8,x2:n.x*u+8,y1:n.y*u-1,y2:n.y*u-1,stroke:"#07EDE1","stroke-width":1})),f.appendChild(r.line({x1:t.x*u-8,x2:t.x*u+8,y1:t.y*u+1,y2:t.y*u+1,stroke:"#07EDE1","stroke-width":1}))):(e="M"+(n.x*u+5)+" "+(n.y*u+5)+" L"+n.x*u+" "+n.y*u+" L"+(n.x*u+5)+" "+(n.y*u-5)+"z",o="M"+(t.x*u-5)+" "+(t.y*u-5)+" L"+t.x*u+" "+t.y*u+" L"+(t.x*u-5)+" "+(t.y*u+5)+"z",f.appendChild(r.line({x1:n.x*u-1,x2:n.x*u-1,y1:n.y*u-8,y2:n.y*u+8,stroke:"#07EDE1","stroke-width":1})),f.appendChild(r.line({x1:t.x*u+1,x2:t.x*u+1,y1:t.y*u-8,y2:t.y*u+8,stroke:"#07EDE1","stroke-width":1}))),f.appendChild(r.path({d:e,fill:"#07EDE1"})),s=r.line({x1:n.x*u,y1:n.y*u,x2:t.x*u,y2:t.y*u,stroke:"#07EDE1","stroke-width":.6,fill:"#07EDE1"}),f.appendChild(s),f.appendChild(r.path({d:o,fill:"#07EDE1"})),i.appendChild(f))},_removeGuidelines:function(n,t){t!=null&&n.removeChild(t)},update:function(n,t){t&&!t._isInit&&n._status!=="new"&&(n._status="update");var i=t._svg;n._type==="group"?this.updateGroup(n,i,t):n.segments?this.updateConnector(n,i,t):this.updateNode(n,i,t)},_updateGoupBackground:function(n,i,r){var u=n.offsetX-n.width*n.pivot.x,f=n.offsetY-n.height*n.pivot.y,y=n.rotateAngle,c=new t.datavisualization.Diagram.Point(u+n.width*n.pivot.x,f+n.height*n.pivot.y),l=n.fillColor,a=n.borderColor,p=t.datavisualization.Diagram.NodeConstraints,e,s,h,v,o;(n.type=="bpmn"&&n.shape!="group"||n.classifier&&n.classifier=="package")&&(l="transparent",a="transparent");t.datavisualization.Diagram.Util.canCrispEdges(n,r)&&(u=Math.floor(u)+.5,f=Math.floor(f)+.5);e={id:n.name+"_shape",rx:n.cornerRadius,ry:n.cornerRadius,width:Math.round(n.width<0?0:n.width),height:Math.round(n.height<0?0:n.height),fill:l,stroke:a,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,transform:"rotate("+y+","+c.x+","+c.y+"),translate("+u+","+f+")"};n.shape==="group"&&n.constraints&p.Shadow&&(s=i.document.getElementById(n.name+"_shadow"),h=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),u=n.offsetX-n.width*n.pivot.x+h.x,f=n.offsetY-n.height*n.pivot.y+h.y,v={id:n.name+"_shadow",width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",transform:"translate("+u+","+f+")",opacity:n.shadow.opacity,"stroke-dasharray":""},s&&t.datavisualization.Diagram.Util.attr(s,v));n.gradient&&n.type!="bpmn"&&(e.fill=this._renderGradient(n.name,n.gradient,i));o=i.getElementById(n.name+"_shape");o&&(e["class"]=o.getAttribute("class"),this._updateCssClass(n,e),t.datavisualization.Diagram.Util.attr(o,e))},updateGroup:function(n,i,r,u){var l=r._getChildren(n.children),v=n.visible?"visible":"hidden",o="display:block;",s,a,f,e,h,c;for(n.visible||(o="display:none;"),t.datavisualization.Diagram.Util.canEnablePointerEvents(n,r)||(o="pointer-events:none"),i.g({id:n.name,visibility:"visible",style:o}),s=0,a=l.length;s<a;s++)f=r.nameTable[l[s]],f&&(f._type==="group"?this.updateGroup(f,i,r,u):f.segments?(t.datavisualization.Diagram.Util.updateBridging(f,r),this.updateConnector(f,i,r)):this.updateNode(f,i,r,u));if(i.g({id:n.name,visibility:v,style:o}),this._updateGoupBackground(n,i,r),this._updateAssociatedConnector(n,i,r),this._updateLabels(n,i,r),this._updatePorts(n,i),n.isSwimlane&&(e=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(r,n),h=null,e&&e.length>0))for(c=0;c<e.length;c++)h=r.nameTable[r._getChild(e[c])],h&&this._updatephase(h,r,n)},_removephases:function(n,i){var r,u,f;if(n.isSwimlane&&(r=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(i,n),r))for(u=r.length;u>=0;u--)f=i.nameTable[r[u]],this._removePhase(i,f)},_removePhase:function(n,t){t&&n._views.forEach(function(i){var u=n._views[i],f=u.svg||u._canvas,r=f.document.getElementById(t.name+"_phase_g");r&&r.parentNode.removeChild(r)})},_updatePhaseStyle:function(n,t,i){if(n&&t){var r=n.visible?"visible":"hidden";i._svg.g({id:n.name+"_phase_g",visibility:r});t.id=n.name+"_phase";i._svg.g(t)}},_updatephase:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;r.context._updatephase1(n,t,u,i)})},_updatephase1:function(i,r,u,f){var l,o;if(u=u?u:r._svg,f){var s=0,h=0,a=null,c=[],v,e=t.datavisualization.Diagram.Util.bounds(f),y=r._getChildren(f.children);y.length>1&&(l=r.nameTable[y[0]]);var p=e.top+50,w=e.left+50;i.orientation=="vertical"?(s=e.x,h=e.y+l.height+i.offset,l&&(p+=l.height),h-.1<=e.bottom&&h-.1>=p&&(a="translate("+s+","+h+")"),c.push({x:0,y:0}),c.push({x:e.width,y:0}),v=this._convertToSVGPoints(c)):(s=e.x+i.offset,h=e.y,s-.1<=e.right&&s-.1>w&&(a="translate("+s+","+h+")"),l&&(c.push({x:0,y:l.height}),c.push({x:0,y:e.height})),v=this._convertToSVGPoints(c));o={points:v,id:i.name+"_phase"};u.polyline(o);o={points:v,id:i.name+"_phase_hitTest"};u.polyline(o);a&&(o={id:i.name+"_phase_g",transform:a});i.label&&r.model.labelRenderingMode!=t.datavisualization.Diagram.LabelRenderingMode.Svg&&this._updatePhaseLabel(i,i.label,r);u.g(o);u.getElementById(o.id)&&n("#"+o.id).insertAfter(n("#"+o.id)[0].parentNode.lastChild)}},_updatePhaseLabel:function(n,i,r){var f=r._svg,e=r._getPhaseBounds(n),u=f.getElementById(n.name+"_"+i.name);if(u){if(u.setAttribute("fill",i.fontColor),!i.text)return;u.textContent=i.text;e=t.datavisualization.Diagram.Util.bounds(n);this._wrapText(n,e,u,i,f);this._alignTextOnPhase(n,e,u,i,f)}},updateLabelStyle:function(i,r,u,f){var s,e,o;r.templateId||(f&&f.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg?(o={id:i.name+"_"+r.name+"_lblbg",fill:r.fillColor,stroke:r.borderColor,"stroke-width":r.borderWidth,"pointer-events":"none",visibility:r.visible?"visible":"hidden","fill-opacity":r.opacity,"stroke-opacity":r.opacity},u.rect(o),o={id:i.name+"_"+r.name,"class":"ej-d-label","font-family":r.fontFamily,"font-size":r.fontSize,fill:r.fontColor,"text-decoration":r.textDecoration,"font-weight":r.bold?"bold":"normal","font-style":r.italic?"italic":"normal",visibility:r.visible?"visible":"hidden","fill-opacity":r.opacity,"stroke-opacity":r.opacity},e=u.text(o),o["class"]=e.getAttribute("class"),this._updateCssClass(r,o),t.datavisualization.Diagram.Util.attr(e,o)):(s=u.document.parentNode.getElementsByClassName("htmlLayer")[0],e=n(s).find("#"+i.name+"_"+r.name)[0],i&&e&&r&&!r.templateId&&(e.style.fontWeight=r.bold?"bold":"",e.style.fontStyle=r.italic?"italic":"",e.style.visibility=r.visible?"":"hidden",e.style.opacity=r.opacity,e.style.textDecoration=r.textDecoration,e.style.fontFamily=r.fontFamily,e.style.fontSize=r.fontSize+"px",e.style.color=r.fontColor,e.style.backgroundColor=r.fillColor,e.style.borderColor=r.borderColor,e.style.borderWidth=r.borderWidth+"px",e.style.borderStyle="solid",i._isHeader&&(e.style.borderWidth="0px",e.style.backgroundColor="transparent"),o=this._updateCssClass(r,{"class":e.className}),o&&(e.className=o["class"]))))},updatePort:function(n,i,r){var u=r.getElementById(n.name+"_"+i.name),f;u&&(u&&u.parentNode&&u.parentNode.removeChild(u),f=document.getElementById(n.name),u=t.datavisualization.Diagram.SvgContext._renderPort(n,i,r),f.appendChild(u))},_updateNodeStyle:function(i,r){var u,o,s,f,e;i&&r&&(u={},u.opacity=i.opacity,u.fill=i.fillColor,u.stroke=i.borderColor,u["stroke-width"]=i.borderWidth,u["stroke-dasharray"]=i.borderDashArray,i.gradient&&(u.fill=this._renderGradient(i.name,i.gradient,r)),i._type=="node"&&(o=i.type=="text"||i.type=="html"?"_backRect":"_shape",i.type=="html"&&(s=r.document.parentNode.getElementsByClassName("htmlLayer")[0],f=n(s).children("#"+i.name+"_parentdiv")[0].childNodes[0],f&&(f.style.opacity=i.opacity)),f=r.getElementById(i.name+o),f&&(u["class"]=f.getAttribute("class"),this._updateCssClass(i,u),t.datavisualization.Diagram.Util.attr(f,u)),i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(e=r.document.getElementById(i.name+"_shadow"),e&&t.datavisualization.Diagram.Util.attr(e,{fill:i.fillColor!="none"||i.fillColor!="transparent"?"lightgrey":"none"}))))},_updateConnectorStyle:function(n,i){var r,u;n&&i&&(r={},r.opacity=n.opacity,r.stroke=n.lineColor,r["stroke-width"]=n.lineWidth,r["stroke-dasharray"]=n.lineDashArray,u=i.getElementById(n.name+"_segments"),u&&(r["class"]=u.getAttribute("class"),this._updateCssClass(n,r),t.datavisualization.Diagram.Util.attr(u,r)))},updateTargetDecoratorStyle:function(n,i){var r,u;i&&(r={},r.stroke=n.targetDecorator.borderColor,r.fill=n.targetDecorator.fillColor,u=i.getElementById(n.name+"_targetDecorator"),u&&(r["class"]=u.getAttribute("class"),this._updateCssClass(n.targetDecorator,r),t.datavisualization.Diagram.Util.attr(u,r)))},updateSourceDecoratorStyle:function(n,i){var r,u;i&&(r={},r.stroke=n.sourceDecorator.borderColor,r.fill=n.sourceDecorator.fillColor,u=i.getElementById(n.name+"_sourceDecorator"),u&&(r["class"]=u.getAttribute("class"),this._updateCssClass(n.sourceDecorator,r),t.datavisualization.Diagram.Util.attr(u,r)))},updateNode:function(n,t,i){if(t){if(i&&!i._isInit&&n._status!=="new"&&(n._status="update"),this._updateLabels(n,t,i),this._updateNode(n,t,i),n.outEdges.length&&this._updateIcons(n,t,i),n._scaled=!1,i._layoutInAction)return;this._updateAssociatedConnector(n,t,i);i.activeTool.inAction&&(i.activeTool.name==="move"||i.activeTool.name==="rotate")||this._updatePorts(n,t)}},updateTextBlock:function(t,i,r,u){var e=r.document.parentNode.getElementsByClassName("htmlLayer")[0],o=n(e).children("#"+t.name)[0],s=n(o).children("#"+t.name+"_shape_lblbg")[0],f=s.childNodes[0];t&&f&&i&&(f.style.fontWeight=i.bold?"bold":"",f.style.fontStyle=i.italic?"italic":"",f.style.textDecoration=i.textDecoration,f.style.fontFamily=i.fontFamily,f.style.fontSize=i.fontSize+"px",f.style.color=i.fontColor);this._updateTextElement(t,r,u)},_updateAssociatedConnector:function(n,i,r){var u,f;if(n.inEdges&&n.inEdges.length>0)for(u=0,f=n.inEdges.length;u<f;u++)r.nameTable[n.inEdges[u]]&&(r.nameTable[n.inEdges[u]]&&t.datavisualization.Diagram.Util.canBridge(r.nameTable[n.inEdges[u]],r)&&(t.datavisualization.Diagram.Util.updateBridging(r.nameTable[n.inEdges[u]],r),r._updateConnectorBridging(r.nameTable[n.inEdges[u]])),r._disableSegmentChange||t.datavisualization.Diagram.DiagramContext.update(r.nameTable[n.inEdges[u]],r));if(n.outEdges&&n.outEdges.length>0)for(u=0,f=n.outEdges.length;u<f;u++)r.nameTable[n.outEdges[u]]&&(r.nameTable[n.outEdges[u]]&&t.datavisualization.Diagram.Util.canBridge(r.nameTable[n.outEdges[u]],r)&&(t.datavisualization.Diagram.Util.updateBridging(r.nameTable[n.outEdges[u]],r),r._updateConnectorBridging(r.nameTable[n.outEdges[u]])),r._disableSegmentChange||t.datavisualization.Diagram.DiagramContext.update(r.nameTable[n.outEdges[u]],r))},_updateNode:function(i,r,u){var e=i.width?i.width:i._width,o=i.height?i.height:i._height,c=i.offsetX-e*i.pivot.x,l=i.offsetY-o*i.pivot.y,w=i.rotateAngle,a=t.datavisualization.Diagram.Point(i.offsetX,i.offsetY),b=i.visible?"visible":"hidden",v,s,h,f;t.datavisualization.Diagram.Util.canCrispEdges(i,u)&&(c=Math.floor(c)+.5,l=Math.floor(l)+.5);f={id:i.name,transform:"rotate("+w+","+a.x+","+a.y+"),translate("+c+","+l+")",visibility:b};f.style=t.datavisualization.Diagram.Util.canEnablePointerEvents(i,u)?"":"pointer-events:none";r.g(f);v=i._shape?i._shape:i.type;switch(v){case"rectangle":r.rect({id:i.name+"_shape",width:e<0?0:e,height:o<0?0:o});i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"ellipse":r.ellipse({id:i.name+"_shape",rx:e/2,ry:o/2,cx:e/2,cy:o/2});i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.ellipse({id:i.name+"_shadow",rx:i.width/2,ry:i.height/2,cx:i.width/2,cy:i.height/2});break;case"image":this._updateBackgroundRect(i,r);var y=t.datavisualization.Diagram.Util._getImageAlignment(i.contentAlignment),p=i.scale=="none"?"meet":i.scale,f={id:i.name+"_shape",preserveAspectRatio:p!="stretch"&&y!="none"?y+" "+p:"none"};i.scale!="none"&&(f.width=e,f.height=o);r.image(f);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"path":i._preventStretch?s=i._absolutePath=i.pathData:i._scaled||!i._absolutePath?(s=t.datavisualization.Diagram.Geometry.updatePath(0,0,e,o,i.pathData,r,i._absoluteBounds),i._absolutePath=s,i._scaled=!1):s=i._absolutePath;r.path({id:i.name+"_shape",d:s});i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.path({id:i.name+"_shadow",d:s});break;case"polygon":this._updatePolygon(i,r);break;case"text":this._updateTextElement(i,r,u);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"html":this._updateHtmlElement(i,r);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"native":h=this._scaleNodeContent(i,n("#"+i.name+"_shape")[0]);f={id:i.name+"_shape",width:i.width,height:i.height};h&&(f.transform="translate("+h.x+","+h.y+"),scale("+h.sx+","+h.sy+")");r.g(f);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height})}},_updateHtmlElement:function(t,i){this._updateBackgroundRect(t,i);var f=t.visible?"visible":"hidden",e=t.width?t.width:t._width,o=t.height?t.height:t._height,s=t.offsetX-e*t.pivot.x,h=t.offsetY-o*t.pivot.y,r,c=i.document.parentNode.getElementsByClassName("htmlLayer")[0],u=n(c).children("#"+t.name+"_parentdiv");u&&(r=n(u).children("#"+t.name+"_html")[0],r&&(r.style.left=s+"px",r.style.top=h+"px",r.style.webkitTransform="rotate("+t.rotateAngle+"deg)",r.style.MozTransform="rotate("+t.rotateAngle+"deg)",r.style.OTransform="rotate("+t.rotateAngle+"deg)",r.style.msTransform="rotate("+t.rotateAngle+"deg)",r.style.transform="rotate("+t.rotateAngle+"deg)",r.style.opacity=t.opacity,r.style.visibility=f));r&&(r.style.width=t.width.toString()+"px",r.style.height=t.height.toString()+"px")},_updatePolygon:function(n,i){t.datavisualization.Diagram.Geometry.updatePolygonPoints(n);i.polygon({id:n.name+"_shape",points:this._convertToSVGPoints(n.points)});n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&i.polygon({id:n.name+"_shadow",points:this._convertToSVGPoints(n.points)})},_convertToSVGPoints:function(n){for(var i="",t=0,r=n.length;t<r;t++)i+=n[t].x+","+n[t].y+" ";return i.trim()},_renderTextElement:function(i,r,u,f){var o,c,l,s,a,e,p;if(f.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){this._renderBackgroundRect(i,r,u);var h=i.textBlock,w=r.getElementById(i.name),b={id:i.name+"_shape_lblbg","class":"ej-d-label","font-family":h.fontFamily,"font-size":h.fontSize,fill:h.fontColor,"text-decoration":h.textDecoration,"font-weight":h.bold?"bold":"normal","font-style":h.italic?"italic":"normal"},o=r.text(b);w.appendChild(o);this._renderLabelSpanElement(o,i,h,r,f,!1)}else if(o=i.textBlock,o){c=r.document.parentNode.getElementsByClassName("htmlLayer")[0];this._renderBackgroundRect(i,r,u);l=document.createElement("div");s=document.createElement("span");t.datavisualization.Diagram.Util.attr(s,{id:i.name,"class":"ej-d-label",style:"display: inline-block; position: absolute; pointer-events: all; line-height: normal; alignment-baseline:middle"});o.bold&&(s.style.fontWeight="bold");o.italic&&(s.style.fontStyle="italic");s.style.textDecoration=o.textDecoration;s.style.fontFamily=o.fontFamily;s.style.fontSize=o.fontSize+"px";s.style.color=o.fontColor;s.textContent=o.text;a="display: inline-block; position: absolute; width: inherit; height: inherit; pointer-events: none; ";t.datavisualization.Diagram.Util.attr(l,{id:i.name+"_shape_lblbg",style:a});l.appendChild(s);e=n(c).children("#"+i.name)[0];e&&c.removeChild(e);e=document.createElement("div");var v=i.width?i.width:i._width,y=i.height?i.height:i._height,k=i.offsetX-v*i.pivot.x,d=i.offsetY-y*i.pivot.y,a="width:"+v+"px; height:"+y+"px; left:"+k+"px; top:"+d+"px; display: block; position: absolute; pointer-events: none; ";t.datavisualization.Diagram.Util.attr(e,{id:i.name,"class":"ej-d-node",style:a});e.style.webkitTransform="rotate("+i.rotateAngle+"deg) ";e.style.MozTransform="rotate("+i.rotateAngle+"deg) ";e.style.OTransform="rotate("+i.rotateAngle+"deg) ";e.style.msTransform="rotate("+i.rotateAngle+"deg)";e.style.transform="rotate("+i.rotateAngle+"deg) ";e.appendChild(l);c&&c.appendChild(e);p=t.datavisualization.Diagram.Util.bounds(i);this._alignTextOnLabel(i,p,s,l,i.textBlock)}},_updateTextElement:function(i,r,u){var s,o,c;if(u.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){this._updateBackgroundRect(i,r);var e=i.textBlock,b=r.getElementById(i.name),p={id:i.name+"_shape_lblbg","class":"ej-d-label","font-family":e.fontFamily,"font-size":e.fontSize,fill:e.fontColor,"text-decoration":e.textDecoration,"font-weight":e.bold?"bold":"normal","font-style":e.italic?"italic":"normal"},k=r.text(p);this._updateLabelSpanElement(i,e,r,u,!1)}else if(this._updateBackgroundRect(i,r),s=r.document.parentNode.getElementsByClassName("htmlLayer")[0],s){var f=this._findChild(s.childNodes,i),w=i.visible?"visible":"hidden",h=t.datavisualization.Diagram.Util.bounds(i),l,a,v,y;f&&(l=h.width,a=h.height,v=i.offsetX-i.width*i.pivot.x,y=i.offsetY-i.height*i.pivot.y,f.style.width=l+"px",f.style.height=a+"px",f.style.left=v+"px",f.style.top=y+"px",f.style.visibility=w,f.style.webkitTransform="rotate("+i.rotateAngle+"deg)",f.style.MozTransform="rotate("+i.rotateAngle+"deg)",f.style.OTransform="rotate("+i.rotateAngle+"deg)",f.style.msTransform="rotate("+i.rotateAngle+"deg)",f.style.transform="rotate("+i.rotateAngle+"deg)");o=n(f).children("#"+i.name+"_shape_lblbg")[0];o&&(c=o.childNodes[0],c.textContent=i.textBlock.text,this._alignTextOnLabel(i,h,c,o,i.textBlock,u))}},_renderBackgroundRect:function(n,i,r){var u=this._fill(n,i),e={id:n.name+"_backRect","class":"backrect",x:0,y:0,width:n.width,height:n.height,fill:u,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray},f,o;this._addCssClass(n,e);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),o={id:n.name+"_shadow","class":"backrect",width:n.width,height:n.height,stroke:"lightgrey",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+f.x+","+f.y+")",opacity:n.shadow.opacity},r.appendChild(i.rect(o)));r.appendChild(i.rect(e))},_updateBackgroundRect:function(n,t){var i=this._fill(n,t),r={id:n.name+"_backRect",x:0,y:0,width:n.width,height:n.height,fill:i,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,"class":n.cssClass};t.rect(r)},_hideNode:function(n,t){var i={id:n.name,style:"pointer-events:none;"};t.rect(i)},_showNode:function(n,t){var i={id:n.name,style:"pointer-events:auto;"};t.rect(i)},_removePhasehelper:function(n){n._adornerSvg.getElementById("phase_helper")&&n._adornerSvg.removeChild(n._adornerSvg.getElementById("phase_helper"),n._adornerLayer)},_updatePhaseHelper:function(n,t,i){if(t){var f=n._adornerSvg,r=n._currZoom,u;i.width=i.width<0?1:i.width;i.height=i.height<0?1:i.height;u={id:"phase_helper","class":"helper","pointer-events":"none",width:i.width*r,height:i.height*r};n._adornerSvg.rect(u)}},_phasehelper:function(n,t,i){if(t){var u=n._adornerSvg,r=n._currZoom,f=i.x+i.width/2,e=i.y+i.height/2,o=u.rect({id:"phase_helper","class":"helper","stroke-width":2,"stroke-dasharray":"3,3","pointer-events":"none",width:i.width*r,height:i.height*r,fill:"transparent",stroke:"green",transform:"translate("+(f-i.width/2)*r+","+(e-i.height/2)*r+"),rotate(0,"+i.width/2*r+","+i.height/2*r+")"});n._adornerLayer.appendChild(o)}},_drawContainerHelper:function(n){var i=n.activeTool.helper,c=n._adornerSvg,u=n._currZoom,r,f,e,o,s,h;i&&(r=t.datavisualization.Diagram.Util.bounds(i,!0));f=r.height;e=r.width;o=i.pivot?{x:r.width*i.pivot.x,y:r.height*i.pivot.y}:{x:e/2,y:f/2};s=i.rotateAngle?i.rotateAngle:0;h=c.rect({id:"helper","class":"helper","stroke-width":1,"stroke-dasharray":"3,3","pointer-events":"none",width:e*u,height:f*u,fill:"transparent",stroke:"red",transform:"translate("+r.x*u+","+r.y*u+"),rotate("+s+","+o.x*u+","+o.y*u+")"});n._adornerLayer.appendChild(h)},_updateContainerHelper:function(n){var s,i=n.activeTool.helper,u=n._currZoom,r,f,e,o,h;i&&(r=t.datavisualization.Diagram.Util.bounds(i,!0));f=r.height;e=r.width;o=i.pivot?{x:r.width*i.pivot.x,y:r.height*i.pivot.y}:{x:e/2,y:f/2};n._raiseOffsetPropertyChange(i,r.center.x,r.center.y,!0);n._raiseSizePropertyChange(i,r.width/i.width,r.height/i.height,!0);h=i.rotateAngle?i.rotateAngle:0;s={id:"helper","class":"helper",width:e*u,height:f*u,fill:"transparent",stroke:"red",transform:"translate("+r.x*u+","+r.y*u+"),rotate("+h+","+o.x*u+","+o.y*u+")"};n._adornerSvg.rect(s)},_removeContainerHelper:function(n,t,i){t.getElementById("helper")&&t.removeChild(t.getElementById("helper"),i)},setNodeShape:function(t,i,r,u){var f,e;r?(e=i.getElementById(r.name),f=n(e).find("#"+t.name)[0]):f=i.getElementById(t.name);f&&(n(f).empty(),this._renderNode(t,i,f,u))},setLine:function(t,i,r,u){var f,e;r?(e=i.getElementById(r.name),f=n(e).find("#"+t.name)[0]):f=i.getElementById(t.name);n(f).empty();this.renderConnector(t,i,f,u)},addNodeLabel:function(n,t,i,r,u){this._renderLabels(n,i,u)},renderConnector:function(n,i,r,u){var f,o,h=n.visible?"visible":"hidden",s,e;if(o=t.datavisualization.Diagram.Util.canCrispEdges(n,u)?{id:n.name,"class":"ej-d-connector",visibility:h,opacity:n.opacity,transform:"translate("+.5+","+.5+")"}:{id:n.name,"class":"ej-d-connector",visibility:h,opacity:n.opacity},t.datavisualization.Diagram.Util.canEnablePointerEvents(n,u)||(o.style="pointer-events:none"),f=i.g(o),r?r.id!==f.id&&r.appendChild(f):i.appendChild(f),s=i.g({id:n.name+"segments"}),this._renderSegments(n,i,s,u),f.appendChild(s),this._renderLabels(n,i,u),this._renderDecorators(n,i,f,u),n.shape)for(t.datavisualization.Diagram.DefautShapes.updateInlineDecoratorsShape(n,u),e=0;e<n._inlineDecorators.length;e++)this.renderNode(n._inlineDecorators[e],i,f,undefined,u);return f},_renderSegments:function(n,i,r,u){var h=n.visible&&(u&&u._browserInfo?u._browserInfo.name:t.browserInfo().name)==="msie"?"collapse":"hidden",o=this._findPath(n,u),f={id:n.name+"_hitTest","class":"hitTest","stroke-width":n.lineHitPadding,d:o,stroke:"transparent",visibility:"hidden"},e,s;f["pointer-events"]=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,u)?n.visible?"stroke":"none":"none";e=i.path(f);r.appendChild(e);f={id:n.name+"_segments",d:o,fill:"none",stroke:n.lineColor,"stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,opacity:n.opacity};this._addCssClass(n,f);e=i.path(f);r.appendChild(e);n.shape&&n.shape.type=="umlactivity"&&n.shape.activityFlow=="exception"&&(f={id:n.name+"_Activityflow","class":"umlactivityflow",fill:"none",stroke:n.lineColor,"pointer-events":"none","stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,opacity:n.opacity,d:n._temppath},s=i.path(f),this._addCssClass(n,f),r.appendChild(s))},_findPath:function(n,i){for(var r,k,nt,u,y,c,g,b,w,f,l,tt,a,v,e,s=0;s<n.segments.length;s++){if(r=n.segments[s],r._bridges.length>0)for(k=0;k<r._bridges.length;k++)nt=r._bridges[k],nt._rendered=!1;if(u=r.points,n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&s==0){y={x:r.points[0].x,y:r.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(r.points[0],r.points[1]);c=Math.min(30,c/2);var p=t.datavisualization.Diagram.Geometry.findAngle(r.points[0],r.points[1]),d=t.datavisualization.Diagram.Geometry.transform({x:y.x,y:y.y},p,c),o=t.datavisualization.Diagram.Geometry.transform({x:d.x,y:d.y},p+45,-12),h=t.datavisualization.Diagram.Geometry.transform({x:o.x,y:o.y},p+45,24);g=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?"M"+Math.floor(o.x)+" "+Math.floor(o.y)+" L"+Math.floor(h.x)+" "+Math.floor(h.y):"M"+o.x+" "+o.y+" L"+h.x+" "+h.y}if(n.shape&&n.shape.type=="umlactivity"&&n.shape.activityFlow=="exception"&&s==0){y={x:r.points[0].x,y:r.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(r.points[0],r.points[1]);c=Math.max(30,c/2);var p=t.datavisualization.Diagram.Geometry.findAngle(r.points[0],r.points[1]),d=t.datavisualization.Diagram.Geometry.transform({x:y.x,y:y.y},p,c),o=t.datavisualization.Diagram.Geometry.transform({x:d.x,y:d.y},p+145,9),h=t.datavisualization.Diagram.Geometry.transform({x:o.x,y:o.y},p+225,14);g=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?"M"+Math.floor(o.x)+" "+Math.floor(o.y)+" L"+Math.floor(h.x)+" "+Math.floor(h.y):"M"+h.x+" "+o.y+"L"+h.x+" "+h.y+" L"+o.x+" "+o.y+" L"+o.x+" "+h.y}if(s==0&&(i&&n.sourceNode&&(b=i._findNode(n.sourceNode)),u=this._clipDecorators(n,r,!0,b),r.type=="bezier"&&n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u[0]=t.datavisualization.Diagram.Util._adjustPoint(u[0],r._point1,!0,n.lineWidth)),e=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?"M"+Math.floor(u[0].x)+" "+Math.floor(u[0].y):"M"+u[0].x+" "+u[0].y),s==n.segments.length-1&&(i&&n.targetNode&&(b=i._findNode(n.targetNode)),u=this._clipDecorators(n,r,!1,b)),r.type!="bezier")if(n.cornerRadius>0)for(f=0;f<u.length-1;f++)w=t.datavisualization.Diagram.Geometry.distance(u[f],u[f+1]),w>0&&(v=s<n.segments.length-1||f<u.length-2?w<n.cornerRadius*2?t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!1,w/2):t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!1,n.cornerRadius):u[f+1],(s>0||f>0)&&(w<n.cornerRadius*2?(a=t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!0,w/2),(s<n.segments.length-1||f<u.length-2)&&(v=null)):a=t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!0,n.cornerRadius)),a&&(e+=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" Q"+Math.floor(u[f].x)+" "+Math.floor(u[f].y)+" "+Math.floor(a.x)+" "+Math.floor(a.y):" Q"+u[f].x+" "+u[f].y+" "+a.x+" "+a.y),v&&(r._bridges.length>0&&(e=this._updateBridging(r,e,f),r.type==="orthogonal"&&(e=this._updateBridging(r,e,f+1))),e+=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" L"+Math.floor(v.x)+" "+Math.floor(v.y):" L"+v.x+" "+v.y));else for(f=0;f<u.length;f++)f>0&&(e=this._updateBridging(r,e,f)+(t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" L"+Math.floor(u[f].x)+" "+Math.floor(u[f].y):" L"+u[f].x+" "+u[f].y));else l=r._endPoint,n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(l=t.datavisualization.Diagram.Util._adjustPoint(r._endPoint,r._point2,!0,n.lineWidth)),n.targetNode&&i&&(tt=i._findNode(n.targetNode),b.borderColor!="none"&&(l=t.datavisualization.Diagram.Util._adjustPoint(l,r._point2,!0,tt.borderWidth/2))),e+=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" C"+Math.floor(r._point1.x)+" "+Math.floor(r._point1.y)+" "+Math.floor(r._point2.x)+" "+Math.floor(r._point2.y)+" "+Math.floor(l.x)+" "+Math.floor(l.y):" C"+r._point1.x+" "+r._point1.y+" "+r._point2.x+" "+r._point2.y+" "+l.x+" "+l.y}return n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&(e+=g),n.shape&&n.shape.activityFlow=="exception"&&n.shape.type=="umlactivity"&&(e=e,n._temppath=g),e},_updateBridging:function(n,t,i){var f=t,u,r;if(n._bridges.length>0)if(n.type==="straight")for(u=0;u<n._bridges.length;u++)r=n._bridges[u],r._rendered||(f+=" L"+r.startPoint.x+" "+r.startPoint.y,f+=r.path);else if(n.type==="orthogonal")for(u=0;u<n._bridges.length;u++)r=n._bridges[u],r.segmentPointIndex!==i||r._rendered||(f+=" L"+r.startPoint.x+" "+r.startPoint.y,f+=r.path,r._rendered=!0);return f},_refreshSegments:function(n,t,i){this._updateConnector(n,t,i);this._updateDecorators(n,t,i)},_refreshOnlySegments:function(n,t,i){var u=this._findPath(n,i),r=t.document.getElementById(n.name+"_segments");r&&(r.setAttribute("d",u),r=t.document.getElementById(n.name+"_hitTest"),r.setAttribute("d",u))},_clipDecorators:function(n,i,r,u){var f=[],o,c,s,l,h,e;if(!r&&n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None){for(e=0;e<i.points.length;e++)f[e]=i.points[e];o=f[f.length-1];c=f[f.length-2];s=t.datavisualization.Diagram.Geometry.distance(o,c);s=s==0?1:s;l=n.lineWidth;h=t.datavisualization.Diagram.Point();h.x=o.x+l*(c.x-o.x)/s;h.y=o.y+l*(c.y-o.y)/s;u&&u.borderColor!="none"&&(h=t.datavisualization.Diagram.Util._adjustPoint(h,c,!0,u.borderWidth/2));f[f.length-1]=h}else if(r&&n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None){for(e=0;e<i.points.length;e++)f[e]=i.points[e];o=f[0];c=f[1];s=t.datavisualization.Diagram.Geometry.distance(o,c);s=s==0?1:s;l=n.lineWidth;h=t.datavisualization.Diagram.Point();h.x=o.x+l*(c.x-o.x)/s;h.y=o.y+l*(c.y-o.y)/s;i.type=="bezier"&&(h.x=o.x+(i._point1.x-o.x)/s,h.y=o.y+(i._point1.y-o.y)/s);u&&u.borderColor!="none"&&(h=t.datavisualization.Diagram.Util._adjustPoint(h,i.type!="bezier"?c:i._point1,!0,u.borderWidth/2));f[0]=h}else if(r){for(e=0;e<i.points.length;e++)f[e]=i.points[e];u&&u.borderColor!="none"&&(f[0]=t.datavisualization.Diagram.Util._adjustPoint(f[0],f[1],!0,u.borderWidth/2))}else{for(e=0;e<i.points.length;e++)f[e]=i.points[e];u&&u.borderColor!="none"&&(f[f.length-1]=t.datavisualization.Diagram.Util._adjustPoint(f[f.length-1],f[f.length-2],!0,u.borderWidth/2))}return f},_updateConnector:function(n,i,r){var f,u;r&&!r._isInit&&n._status!=="new"&&(n._status="update");f=this._findPath(n,r);i.path({id:n.name+"_segments",d:f});u={id:n.name+"_hitTest",d:f,"stroke-width":n.lineHitPadding};u["pointer-events"]=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,r)?n.isPhase||r._selectedSymbol&&r.selectionList[0]&&r.selectionList[0].name==n.name?"none":n.visible?"stroke":"none":"none";i.path(u);n.shape&&n.shape.type=="umlactivity"&&n.shape.activityFlow=="exception"&&(u={id:n.name+"_Activityflow","class":"umlactivityflow",fill:"none",stroke:n.lineColor,"pointer-events":"none","stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,opacity:n.opacity,d:n._temppath},i.path(u))},updateConnector:function(n,i,r){var f,e,u;if(i&&(f=n.visible?"visible":"hidden",e=t.datavisualization.Diagram.Util.canCrispEdges(n,r)?{id:n.name,visibility:f,opacity:n.opacity,transform:"translate("+.5+","+.5+")"}:{id:n.name,visibility:f,opacity:n.opacity},e.style=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,r)?"":"pointer-events:none",r._animatingLayout||i.g(e),this._updateConnector(n,i,r),this._updateLabels(n,i,r),this._updateDecorators(n,i,r),n.shape))for(t.datavisualization.Diagram.DefautShapes.updateInlineDecoratorsShape(n,r),u=0;u<n._inlineDecorators.length;u++)this.updateNode(n._inlineDecorators[u],i,r)},renderDecorators:function(n,t,i){var r=t.getElementById(n.name);this._renderDecorators(n,t,r,i)},clearDecorators:function(n,t,i){this._updateConnector(n,t,i);var u=t.getElementById(n.name),r=t.getElementById(n.name+"_targetDecorator");r&&t.removeChild(r,u);r=t.getElementById(n.name+"_sourceDecorator");r&&t.removeChild(r,u)},_renderDecorators:function(n,i,r,u){var e,o,s,f,h;n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(f=n.segments[n.segments.length-1],e=f.points[f.points.length-2],o=n.targetPoint,f.type=="bezier"&&(e=f._point2),n.targetNode&&u&&(s=u._findNode(n.targetNode),s&&s.borderColor!="none"&&(o=t.datavisualization.Diagram.Util._adjustPoint(o,e,!0,s.borderWidth/2))),this._renderDecorator(n.name+"_targetDecorator",o,e,n,n.targetDecorator,i,r));n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(f=n.segments[0],e=n.sourcePoint,o=f.points[1],f.type=="bezier"&&(o=f._point1),n.sourceNode&&u&&(h=u._findNode(n.sourceNode),h&&h.borderColor!="none"&&(e=t.datavisualization.Diagram.Util._adjustPoint(e,o,!0,h.borderWidth/2))),this._renderDecorator(n.name+"_sourceDecorator",e,o,n,n.sourceDecorator,i,r))},_renderIcons:function(n,t){var u=n.expandIcon,f=n.collapseIcon,l,i,a;if(u.shape!="none"||f.shape!="none"){var r,v=n.width?n.width:n._width||0,y=n.height?n.height:n._height||0,p=n.name,e=0,o=0,s=0,h=0,c=0,w=n.visible?"visible":"hidden";s=n.offsetX-v*n.pivot.x;h=n.offsetY-y*n.pivot.y;e=n.offsetX;o=n.offsetY;c=n.rotateAngle;l={id:p,transform:"rotate("+c+","+e+","+o+"),translate("+s+","+h+")",visibility:w};i=t._adornerSvg;r=i.g(l);a=i.document.parentNode.getElementsByClassName("ExpanderLayer")[0]||t._expander;a.appendChild(r);u!=undefined&&n.isExpanded&&this._renderIcon(n,i,u,r,t);f==undefined||n.isExpanded||this._renderIcon(n,i,f,r,t)}},_renderIcon:function(n,i,r,u,f){var s,e,u,h,l,a,c,o;if(r!=undefined){if(e=t.datavisualization.Diagram.Util._getIconPosition(r,t.datavisualization.Diagram.Util.bounds(n,!0),!0),r.shape!="path")this._renderExpanderTemplate(n,i,r,u,f,e);else if(r.shape=="path")return u=document.createElementNS("http://www.w3.org/2000/svg","g"),u.setAttribute("id",n.name+"_expander"),u.setAttribute("class","ej-d-icon-template"),h=t.datavisualization.Diagram.Geometry.updatePath(e.x-r.width/2,e.y-r.height/2,r.width,r.height,r.pathData,i),l=n.visible?"visible":"hidden",r._absolutePath=h,r.margin.left&&r.margin.right&&(r.width-=(r.margin.left||0)+(r.margin.right||0)),r.margin.top&&r.margin.bottom&&(r.height-=(r.margin.top||0)+(r.margin.bottom||0)),s={id:n.name+"_pathexpander",x:e.x,y:e.y,width:r.width,height:r.height,fill:r.borderColor,stroke:r.borderColor,"stroke-width":r.borderWidth,visibility:l,d:h},this._addCssClass(u,s),a=i.path(s),u.appendChild(a),u;return r.shape=="image"&&(c=new Image,c.src=r.source,o=i.image(s),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c.src),u.appendChild(o)),o}},_renderExpanderTemplate:function(n,t,i,r,u,f,e){var v=this.construct_template_iconshape(i,n.isExpanded,u),s,h,c,w,b;if(v!="undefined"){e&&r.removeChild(t.document.getElementById(n.name+"_expander"));s=document.createElement("div");s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g id="tempNative">'+v+"<\/g><\/svg>";document.body.appendChild(s);h=document.getElementById("tempNative");c=h.cloneNode(!0);c.id=n.name+"_expander";var o=h.getBBox(),y=i.width,p=i.height,l=o.width?y/o.width:1,a=o.height?p/o.height:1;if(s.parentNode.removeChild(s),r.appendChild(c),w=Math.min(l,a),b=n.visible?"visible":"hidden",i.horizontalAlignment||i.verticalAlignment){var nt={x:i.offset.x,y:i.offset.y};switch(i.horizontalAlignment){case"left":f.x+=0;break;case"center":f.x-=i.width/2;break;case"right":f.x-=i.width}switch(i.verticalAlignment){case"top":f.y+=0;break;case"center":f.y-=i.height/2;break;case"bottom":f.y-=i.height}var k=f.x-o.x*l,d=f.y-o.y*a,g={id:n.name+"_expander","class":"ej-d-icon-template",transform:"translate("+k+","+d+"),scale("+l+","+a+")",x:f.x,y:f.y,width:i.width,height:i.height,fill:i.borderColor,stroke:i.borderColor,"stroke-width":i.borderWidth};t.g(g)}}},construct_template_iconshape:function(n,t,i){var r;if(n.shape){switch(n.shape){case"arrowup":r='<rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><path d="M8.7,7.2L8.9,7h2.2l0.2,0.2l0,0l4.8,4.8h-2.5L10,8.4L6.4,12H3.9L8.7,7.2L8.7,7.2z"/><\/path><\/rect>';break;case"arrowdown":r='<rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><path d="M9,12.2l0.1,0.1h1.7l0.1-0.1l0,0l3.8-3.8h-2L10,11.2L7.2,8.4h-2L9,12.2L9,12.2z"/><\/path><\/rect>';break;case"plus":r='<rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><line style="fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10" x1="6.1" y1="10" x2="13.9" y2="10"/><\/line><line style=" fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10" x1="10" y1="6.1" x2="10" y2="13.9"/><\/line><\/rect>';break;case"minus":r=' <rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><line style="fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10" x1="6.1" y1="10" x2="13.9" y2="10"/><\/line><\/rect>';break;case"template":r=i._renderEjTemplate("#"+n.templateId,n)}return r}},_updateIcons:function(n,t,i){var r=n.expandIcon,u=n.collapseIcon,l,t,w;if(r.shape!="none"||u.shape!="none"){var f,a=n.width?n.width:n._width||0,v=n.height?n.height:n._height||0,y=n.name,e=0,o=0,s=0,h=0,c=0,p=n.visible?"visible":"hidden";s=n.offsetX-a*n.pivot.x;h=n.offsetY-v*n.pivot.y;e=n.offsetX;o=n.offsetY;c=n.rotateAngle;l={id:y,transform:"rotate("+c+","+e+","+o+"),translate("+s+","+h+")",visibility:p};t=i._adornerSvg;f=t.g(l);w=t.document.parentNode.getElementsByClassName("ExpanderLayer")[0]||i._expander;r!=undefined&&n.isExpanded&&this._updateIcon(n,i._adornerSvg,f,r,i);u==undefined||n.isExpanded||this._updateIcon(n,i._adornerSvg,f,u,i)}},_updateIcon:function(n,i,r,u,f){var o,e,s,l,h,c;u!=undefined&&(n._scaled||n._updateExpander)&&(e=t.datavisualization.Diagram.Util._getIconPosition(u,t.datavisualization.Diagram.Util.bounds(n,!0),!0),u.shape!="path"?(n._scaled||n._updateExpander)&&this._renderExpanderTemplate(n,i,u,r,f,e,!0):u.shape=="path"&&(s=t.datavisualization.Diagram.Geometry.updatePath(e.x-u.width/2,e.y-u.height/2,u.width,u.height,u.pathData,i),l=n.visible?"visible":"hidden",u._absolutePath=s,u.margin.left&&u.margin.right&&(u.width-=(u.margin.left||0)+(u.margin.right||0)),u.margin.top&&u.margin.bottom&&(u.height-=(u.margin.top||0)+(u.margin.bottom||0)),o={id:n.name+"_pathexpander",x:e.x,y:e.y,width:u.width,height:u.height,fill:u.borderColor,stroke:u.borderColor,"stroke-width":u.borderWidth,visibility:l,d:s},i.path(o)),u.shape=="image"&&(h=new Image,h.src=u.source,c=i.image(o),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.src),r.appendChild(c)),n._updateExpander=!1)},_renderDecorator:function(n,i,r,u,f,e,o){var c,s,l,a,h=t.datavisualization.Diagram.Size(f.width,f.height),p,w,v,y;switch(f.shape){case"arrow":l=this._constructArrow(i,h);s={id:n,"class":"decorator",d:l,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=1.1*f.borderWidth;break;case"openarrow":l=this._constructArrow(i,h,!0);s={id:n,"class":"decorator",d:l,fill:"transparent",stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=1.1*f.borderWidth;break;case"circle":p=h.width/2;w=h.height/2;s={id:n,"class":"decorator",rx:p,ry:w,cx:i.x+h.width/2,cy:i.y,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.ellipse(s);a=.5*f.borderWidth;break;case"diamond":l=this._constructDiamond(i,h,e);s={id:n,"class":"decorator",x:i.x,y:i.y,width:h.width,height:h.height,d:l,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=.7*f.borderWidth;break;case"path":l=t.datavisualization.Diagram.Geometry.updatePath(i.x,i.y-h.height/2,h.width,h.height,f.pathData,e);f._absolutePath=l;s={id:n,"class":"decorator",x:i.x,y:i.y,width:h.width,height:h.height,d:l,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=.5*f.borderWidth}c&&(f.borderColor!="none"?(v=t.datavisualization.Diagram.Geometry.findAngle(i,r),y=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},v,a),c.setAttribute("transform","translate("+y.x+","+y.y+"),rotate("+v+" "+i.x+" "+i.y+")")):c.setAttribute("transform","rotate("+t.datavisualization.Diagram.Geometry.findAngle(i,r)+" "+i.x+" "+i.y+")"),o.appendChild(c))},_updateDecorators:function(n,i,r){var f,e,s,u,o,h;n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u=n.segments[n.segments.length-1],o=u.points,f=o[o.length-2],e=n.targetPoint,u.type=="bezier"&&(f=u._point2),n.targetNode&&r&&(s=r._findNode(n.targetNode),s&&s.borderColor!="none"&&(e=t.datavisualization.Diagram.Util._adjustPoint(n.targetPoint,f,!0,s.borderWidth/2))),this._updateDecorator(n.name+"_targetDecorator",e,f,n,n.targetDecorator,i));n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u=n.segments[0],o=u.points,f=n.sourcePoint,e=o[1],u.type=="bezier"&&(e=u._point1),n.sourceNode&&r&&(h=r._findNode(n.sourceNode),h.borderColor!="none"&&(f=t.datavisualization.Diagram.Util._adjustPoint(n.sourcePoint,e,!0,h.borderWidth/2))),this._updateDecorator(n.name+"_sourceDecorator",f,e,n,n.sourceDecorator,i))},_updateDecorator:function(n,i,r,u,f,e){var c,s,h,l,o=t.datavisualization.Diagram.Size(f.width,f.height),y,p,a,v;switch(f.shape){case"arrow":h=this._constructArrow(i,o);s={id:n,d:h};c=e.path(s);l=1.1*f.borderWidth;break;case"openarrow":h=this._constructArrow(i,o,!0);s={id:n,d:h,fill:"transparent",stroke:f.borderColor,"stroke-width":f.borderWidth};c=e.path(s);l=1.1*f.borderWidth;break;case"circle":y=o.width/2;p=o.height/2;s={id:n,rx:y,ry:p,cx:i.x+o.width/2,cy:i.y,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};c=e.ellipse(s);l=.5*f.borderWidth;break;case"diamond":h=this._constructDiamond(i,o,e);s={id:n,x:i.x,y:i.y,width:o.width,height:o.height,d:h,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};c=e.path(s);l=.7*f.borderWidth;break;case"path":h=t.datavisualization.Diagram.Geometry.updatePath(i.x,i.y-o.height/2,o.width,o.height,f.pathData,e);f._absolutePath=h;s={id:n,d:h};c=e.path(s);l=.5*f.borderWidth}c&&(f.borderColor!="none"?(a=t.datavisualization.Diagram.Geometry.findAngle(i,r),v=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},a,l),c.setAttribute("transform","translate("+v.x+","+v.y+"),rotate("+a+" "+i.x+" "+i.y+")")):c.setAttribute("transform","rotate("+t.datavisualization.Diagram.Geometry.findAngle(i,r)+" "+i.x+" "+i.y+")"))},_constructArrow:function(n,i,r){var u=new t.datavisualization.Diagram.Path;return u.moveTo(n.x+i.width,n.y+i.height/2),u.lineTo(n.x,n.y),u.lineTo(n.x+i.width,n.y-i.height/2),r||u.close(),u.toString()},_constructDiamond:function(n,i){var r=new t.datavisualization.Diagram.Path;return r.moveTo(n.x+i.width,n.y),r.lineTo(n.x+i.width/2,n.y+i.height/2),r.lineTo(n.x,n.y),r.lineTo(n.x+i.width/2,n.y-i.height/2),r.lineTo(n.x+i.width,n.y),r.toString()},_addLabel:function(i,r,u,f,e){var l,p,w,k,d,o,h,v,b,c;if(f&&f.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){if(c=this._renderSVGLabel(i,r,f._svg,f),e!=undefined&&e!=i.labels.length-1&&!(e>i.labels.length-1)&&(l=i.labels[e],l)){var s=f._svg.document.getElementById(i.name+"_"+l.name+"_lblbg"),y=f._svg.document.getElementById(i.name+"_"+r.name+"_lblbg"),a=f._svg.document.getElementById(i.name+"_"+r.name);s&&y&&s.parentNode.insertBefore(y,s);a&&a&&s.parentNode.insertBefore(a,s)}}else o=t.datavisualization.Diagram.Util.bounds(i),p=o.width,w=o.height,k=o.x,d=o.y,v=u.document.parentNode.getElementsByClassName("htmlLayer")[0],h=n(v).children("#"+i.name)[0],b=i._type==="node"?"ej-d-node":i._type==="group"?"ej-d-group":"ej-d-connector",t.datavisualization.Diagram.Util.attr(h,{id:i.name,"class":b}),c=this._renderLabel(i,o,r,h,v,u,p,w,f),e!=undefined&&h.insertBefore(c,h.childNodes[e])},_getCharBoundsValues:function(n,t,i,r,u){var f={id:r.name+"_"+t.name+"temp","class":"ej-d-label","font-family":t.fontFamily,"font-size":12},e=i.text(f),c,l,a,v,y;if(i.document.appendChild(e),c=i.tspan({id:r.name+"_"+t.name+"temp_snap"}),c.textContent=n,e.appendChild(c),l=e.childNodes[0].getComputedTextLength(),f["font-style"]="normal",f["font-weight"]="bold",i.text(f),a=e.childNodes[0].getComputedTextLength(),f["font-style"]="italic",f["font-weight"]="normal",i.text(f),v=e.childNodes[0].getComputedTextLength(),f["font-style"]="italic",f["font-weight"]="bold",i.text(f),y=e.childNodes[0].getComputedTextLength(),i.document.removeChild(e),n==" "){var p=t.text[u-1]&&t.text[u-1]!="\n"?t.text[u-1]:"W",w=t.text[u+1]&&t.text[u+1]!="\n"?t.text[u+1]:"W",o=this._getCharBoundsValues(p,t,i,r,u),s=this._getCharBoundsValues(w,t,i,r,u),h=this._getCharBoundsValues(p+" "+w,t,i,r,u);return{normal:h.normal-(o.normal+s.normal),bold:h.bold-(o.bold+s.bold),italic:h.italic-(o.italic+s.italic),boldItalic:h.boldItalic-(o.boldItalic+s.boldItalic)}}return{normal:l,bold:a,italic:v,boldItalic:y}},_updateHashTableValues:function(n,t,i,r,u){for(var e,f=0;f<n.length;f++)t[n[f]]||(e=n[f]=="\n"?"new_space_line":n[f],t[e]=this._getCharBoundsValues(n[f],i,u,r,f))},_updateHashTable:function(n,i,r,u,f){var e,o,h,s;if(n&&r&&u)if(n.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap||f)(n.text!=""||n.hyperlink!="")&&(o=n.text?n.text:n.hyperlink,e=u._labelHashTable[n.fontFamily],e||(e=u._labelHashTable[n.fontFamily]={}),this._updateHashTableValues(o,e,n,i,r,u));else if(n.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow){for(o=n.text?n.text:n.hyperlink,h=o.split("\n"),s=0;s<h.length;s++){var c=h[s],l=c.split(" "),e=u._labelHashTable[n.fontFamily];e||(e=u._labelHashTable[n.fontFamily]={});this._updateHashTableValues(l,e,n,i,r,u)}e.new_space_line=this._getCharBoundsValues(" ",n,r,i)}},_getSuitableLabelSize:function(n,t,i){t=t=="\n"||t==="."?"new_space_line":t;var r=i._labelHashTable[n.fontFamily][t];return n.bold&&n.italic?r.boldItalic:n.bold?r.bold:n.italic?r.italic:r.normal},_postionConnectorTextElement:function(n,i,r,u,f){var o=0,e=0,h=t.datavisualization.Diagram.Util.bounds(n),s=r.getBBox(),w=this._getCharBoundsValues("W",i,u,n),c=i.horizontalAlignment,l=i.verticalAlignment,p=!1,a,v,y;if(n.segments&&i.relativeMode=="segmentpath"){a=this._getConnectorHandlePosition(i,n,1,f);v=a.position;o=v.x;e=v.y;y=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,i,f,a);l=y.vAlign;c=y.hAlign;p=!0;switch(c){case"left":o=o-s.x+i.margin.left;break;case"right":o=o-s.width-i.margin.right;break;case"stretch":case"center":o=o-s.width/2+i.margin.left-i.margin.right}switch(l){case"top":e=e-s.y+i.fontSize+i.margin.top;break;case"bottom":e=e-s.height+i.fontSize-i.margin.bottom;break;case"stretch":case"center":e=e-s.height/2+i.fontSize+i.margin.top-i.margin.bottom}}else{switch(c){case"left":o=h.width/2+i.margin.left;break;case"right":o=h.width/2-s.width+i.margin.right;break;case"stretch":case"center":o=h.width/2-s.width/2+i.margin.left-i.margin.right}switch(l){case"top":e=h.height/2+s.height/2+i.margin.top;break;case"bottom":e=h.height/2-s.height/2+i.margin.bottom;break;case"stretch":e=h.height/2-s.height/2+i.margin.top-i.margin.bottom;break;case"center":e=h.height/2-s.height/2+i.margin.top-i.margin.bottom}n.segments&&(o+=h.left,e+=h.top)}!i.relativeMode=="segmentpath"&&(o=o*(i.offset.x?i.offset.x/.5:0),e=e*(i.offset.y?i.offset.y/.5:0)+i.fontSize,o=o+(h.center.x-h.width/2),e=e+(h.center.y-h.height/2));this._updateLabelBackground(o,e,s,n,i,r,u,f);n.segments&&n.segments.length>0?r.setAttribute("transform","translate("+o+","+e+")"):r.setAttribute("transform","translate("+o+","+e+") rotate("+i.rotateAngle+" "+(s.x+s.width/2)+" "+(s.y+s.height/2)+")")},_postionNodeTextElement:function(n,i,r,u,f){var o=0,s=0,h=t.datavisualization.Diagram.Util.bounds(n),e=r.getBBox(),a=this._getCharBoundsValues("W",i,u,n);switch(i.horizontalAlignment){case"left":o=h.width/2+i.margin.left;break;case"right":o=h.width/2-e.width;break;case"stretch":o=h.width/2-e.width/2;break;case"center":o=h.width/2-e.width/2}switch(i.verticalAlignment){case"top":s=h.height/2;break;case"bottom":s=h.height/2-e.height;break;case"stretch":s=h.height/2-e.height/2;break;case"center":s=h.height/2-e.height/2}if(o=o*(i.offset.x?i.offset.x/.5:0)+i.margin.left-i.margin.right,s=s*(i.offset.y?i.offset.y/.5:0)+i.fontSize+i.margin.top-i.margin.bottom,this._updateLabelBackground(o,s,e,n,i,r,u,f),n.segments&&n.segments.length>0)r.setAttribute("transform","translate("+(h.center.x-e.width/2)+","+(h.center.y-e.height/2+i.fontSize)+")");else if(n.type==="group"||n.children&&n.children.length>0){var c=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),v=n.width?n.width:n._width,y=n.height?n.height:n._height,o=o+(n.offsetX-n.width/2),s=s+(n.offsetY-n.height/2),l=n.rotateAngle+i.rotateAngle;r.setAttribute("transform","rotate("+l+","+c.x+","+c.y+"),translate("+o+","+s+")")}else r.setAttribute("transform","translate("+o+","+s+") rotate("+i.rotateAngle+" "+(e.x+e.width/2)+" "+(e.y+e.height/2)+")")},_postionSpanElement:function(n,t,i,r,u){for(var e,o,f=0;f<i.childNodes.length;f++)e=i.childNodes[f],e&&(o=this._getSVGTextAlignPosition(e,n,t,i,r,u),e.setAttribute("x",o.x))},_getSVGTextAlignPosition:function(n,t,i,r){var e=0,u,f;if(n&&i){u=n.getAttribute("totalWidth");u=u?Number(u):n.getComputedTextLength();f=r.getBBox();switch(i.textAlign){case"left":e=f.x;break;case"right":e=f.x+f.width-u;break;case"center":case"justify":e=f.x+f.width/2-u/2}}return{x:e,y:0}},_updateTspanElement:function(n,t,i,r,u){this._postionSpanElement(n,t,i,r,u);n.segments&&n.segments.length>0?this._postionConnectorTextElement(n,t,i,r,u):this._postionNodeTextElement(n,t,i,r,u)},_updateLabelBackground:function(i,r,u,f,e,o,s){var c=e.verticalAlignment==="stretch"?f.height-2:u.height,l=e.horizontalAlignment==="stretch"?f.width-2:u.width,v,h;if(i=e.horizontalAlignment==="stretch"?1:i,r=e.verticalAlignment==="stretch"?1:r-e.fontSize,v=n("#"+f.name+"_"+e.name+"_lblbg")[0],h={id:f.name+"_"+e.name+"_lblbg",height:c,width:l,x:i,y:r,transform:"rotate("+e.rotateAngle+" "+(i+l/2)+" "+(r+c/2)+")"},f.type==="group"||f.children&&f.children.length>0){var a=t.datavisualization.Diagram.Point(f.offsetX,f.offsetY),i=i+(f.offsetX-f.width/2),r=r+(f.offsetY-f.height/2),y=f.rotateAngle+e.rotateAngle;h.x=0;h.y=0;h.transform="rotate("+y+","+a.x+","+a.y+"),translate("+i+","+r+")"}s.rect(h)},_renderLabelSpanElement:function(n,i,r,u,f,e){var o,s;r.templateId||(this._updateHashTable(r,i,u,f),r.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap?this._svgTextWrapping(n,i,r,u,f,e):r.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow?this._svgWordWrapping(n,i,r,u,f,e):(o=u.tspan(),n.appendChild(o),o.setAttribute("x","0px"),o.setAttribute("y","0px"),r.textOverflow?(s=this._getLabelSize(r,i,f),this._updateOverFlowTspan(n,i,r,u,f,e,r.text,o,s)):o.textContent=r.text),this._updateTspanElement(i,r,n,u,f))},_getLabelSize:function(n,i){var r=t.datavisualization.Diagram.Util.bounds(i);return Math.max(n.width,r.width)},_svgTextWrapping:function(n,i,r,u,f){var a=t.datavisualization.Diagram.Util.bounds(i),e=u.tspan(),h,o,c,s,l;for(n.appendChild(e),e.setAttribute("x","0px"),e.setAttribute("y","0px"),h=0,o=r.text?r.text:r.hyperlink,e.textContent+=o[0],c=this._getLabelSize(r,i,f),h+=this._getSuitableLabelSize(r,o[0],f)*(r.fontSize/12),s=1;s<o.length;s++)if(o[s]=="\n"||h+this._getSuitableLabelSize(r,o[s],f)*(r.fontSize/12)>=c){if(r.textOverflow)return r.overflowType=="ellipsis"&&(e.textContent=e.textContent.substr(0,e.textContent.length-3),e.textContent+="..."),!1;e.setAttribute("totalWidth",h);e=u.tspan();n.appendChild(e);l=n.getBBox();e.setAttribute("x","0px");e.setAttribute("y",l.height+"px");o[s]!="\n"?(e.textContent+=o[s],h=this._getSuitableLabelSize(r,o[s],f)*(r.fontSize/12)):h=0}else e.textContent+=o[s],h+=this._getSuitableLabelSize(r,o[s],f)*(r.fontSize/12)},_updateOverFlowTspan:function(n,t,i,r,u,f,e,o,s){var l=e,h;this._updateHashTable(i,t,r,u,!0);var a=0,c="",v="",y=0;for(i.overflowType=="ellipsis"&&(y=this._getSuitableLabelSize(i,".",u)*(i.fontSize/12)*3),h=0;h<l.length;h++){if(c=l[h],a+=this._getSuitableLabelSize(i,c,u)*(i.fontSize/12),a+y>=s)break;v+=c}o.textContent=v+(i.overflowType=="ellipsis"?"...":"")},_svgWordWrapping:function(n,i,r,u,f,e){var w,c=0,v,l,y,p,h,s,o,a;for(w=t.datavisualization.Diagram.Util.bounds(i),v=r.text?r.text.split("\n"):r.hyperlink.split("\n"),l=0;l<v.length;l++)for(a=n.getBBox(),o=u.tspan(),n.appendChild(o),o.setAttribute("x","0px"),o.setAttribute("y",a.height+"px"),y=v[l],c=0,p=this._getLabelSize(r,i,f),h=y.split(" "),s=0;s<h.length;s++)if(c+this._getSuitableLabelSize(r,h[s],f)*(r.fontSize/12)>=p)if(r.textOverflow){this._updateOverFlowTspan(n,i,r,u,f,e,y,o,p);break}else o.setAttribute("totalWidth",c),o=u.tspan(),n.appendChild(o),a=n.getBBox(),o.setAttribute("x","0px"),o.setAttribute("y",a.height+"px"),h[s]!="\n"?(o.textContent+=h[s],c=this._getSuitableLabelSize(r,h[s],f)*(r.fontSize/12)):c=0;else c&&(o.textContent+=" "),o.textContent+=h[s],c+=this._getSuitableLabelSize(r,h[s],f)*(r.fontSize/12)},_renderSVGLabel:function(n,i,r,u,f){var s=r.getElementById(n.name),l,h,a,e,v,o,c;return i.templateId&&i.templateType===t.datavisualization.Diagram.TemplateType.Svg?(l=u._renderEjTemplate("#"+i.templateId,i),h=document.createElement("div"),h.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g class="ej-label-template" id='+n.name+"_"+i.name+">"+l+"<\/g><\/svg>",document.body.appendChild(h),a=document.getElementById(n.name+"_"+i.name).cloneNode(!0),s.appendChild(a),h.parentNode.removeChild(h),this._updateSVGTemplate(n,i,r,u,f)):(e={id:n.name+"_"+i.name+"_lblbg",fill:n._isHeader?"transparent":i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth,"pointer-events":"none",visibility:i.visible?"visible":"hidden","fill-opacity":i.opacity,"stroke-opacity":i.opacity},v=r.rect(e),s.appendChild(v),e={id:n.name+"_"+i.name,"class":"ej-d-label","font-family":i.fontFamily,"font-size":i.fontSize,fill:i.hyperlink!==""?"blue":i.fontColor,"text-decoration":i.hyperlink!==""?"underline":i.textDecoration,"font-weight":i.bold?"bold":"normal","font-style":i.italic?"italic":"normal",visibility:i.visible?"visible":"hidden","fill-opacity":i.opacity,"stroke-opacity":i.opacity},this._addCssClass(i,e),i.hyperlink?(o=document.createElementNS("http://www.w3.org/2000/svg","a"),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i.hyperlink),o.setAttribute("target","_blank"),o.setAttribute("class","ej-d-anchor"),c=r.text(e),o.appendChild(c),s.appendChild(o)):(c=r.text(e),s.appendChild(c)),this._renderLabelSpanElement(c,n,i,r,u,f)),s},_renderSVGLabels:function(n,t,i,r){var f,u;if(n.labels.length&&n.type!="text")for(f=n.labels,u=0;u<f.length;u++)this._renderSVGLabel(n,f[u],t,i,r)},_updateLabelSpanElement:function(i,r,u,f,e){var o=u.getElementById(i.name+"_"+r.name),s,h;i.textBlock&&(o=u.getElementById(i.name+"_shape_lblbg"));o&&(n(o).empty(),this._updateHashTable(r,i,u,f),r.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap?this._svgTextWrapping(o,i,r,u,f,e):r.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow?this._svgWordWrapping(o,i,r,u,f,e):(s=u.tspan(),o.appendChild(s),s.setAttribute("x","0px"),s.setAttribute("y","0px"),r.textOverflow?(h=this._getLabelSize(r,i,f),this._updateOverFlowTspan(o,i,r,u,f,e,r.text,s,h)):s.textContent=r.text),this._updateTspanElement(i,r,o,u,f))},_updateSVGTemplate:function(n,i,r,u){var f=0,e=0,s=t.datavisualization.Diagram.Util.bounds(n),h=r.document.getElementById(n.name+"_"+i.name),o,c,l;if(h){if(o=h.getBBox(),n.segments&&i.relativeMode=="segmentpath"){c=this._getConnectorHandlePosition(i,n,1,u);l=c.position;f=l.x;e=l.y;var a=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,i,u,c),v=a.vAlign,y=a.hAlign;switch(y){case"left":f=f-o.x+i.margin.left;break;case"right":f=f-o.width-i.margin.right;break;case"stretch":case"center":f=f-o.width/2+i.margin.left-i.margin.right}switch(v){case"top":e=e-o.y+i.margin.top;break;case"bottom":e=e-o.height+i.margin.bottom;break;case"stretch":case"center":e=e-o.height/2+i.margin.top-i.margin.bottom}}else{switch(i.horizontalAlignment){case"left":f=s.width/2+i.margin.left;break;case"right":f=s.width/2-o.width;break;case"stretch":f=s.width/2-o.width/2;break;case"center":f=s.width/2-o.width/2}switch(i.verticalAlignment){case"top":e=s.height/2;break;case"bottom":e=s.height/2-o.height;break;case"stretch":e=s.height/2-o.height/2;break;case"center":e=s.height/2-o.height/2}f=f*(i.offset.x?i.offset.x/.5:0)+i.margin.left-i.margin.right;e=e*(i.offset.y?i.offset.y/.5:0)+i.margin.top-i.margin.bottom;n.segments&&(f+=s.left,e+=s.top)}h.setAttribute("transform","translate("+f+","+e+")")}},_updateSVGLabel:function(n,t,i,r,u){if(t.templateId)this._updateSVGTemplate(n,t,i,r,u);else{var f={id:n.name+"_"+t.name,"class":"ej-d-label","font-family":t.fontFamily,"font-size":t.fontSize,fill:t.hyperlink!==""?"blue":t.fontColor,"text-decoration":t.hyperlink!==""?"underline":t.textDecoration};i.text(f);this._updateLabelSpanElement(n,t,i,r,u)}},_updateSVGLabels:function(n,t,i,r){var f,u;if(n.labels.length&&n.type!="text")for(f=n.labels,u=0;u<f.length;u++)this._updateSVGLabel(n,f[u],t,i,r)},_renderLabels:function(i,r,u,f){var o,s;if(u&&u.model.labelRenderingMode!=t.datavisualization.Diagram.LabelRenderingMode.Svg){if(i.labels.length&&i.type!="text"){var y=i.labels,h=t.datavisualization.Diagram.Util.bounds(i),c,l,a,v,e,p=!1;for(o=0;o<y.length;o++)if(i.labels[o].hyperlink&&!i.labels[o].text)this._renderSVGLabel(i,i.labels[o],r,u,f);else{if(!p){p=!0;s=r.document.parentNode.getElementsByClassName("htmlLayer")[0];e=n(s).children("#"+i.name)[0];e&&s.removeChild(e);e=document.createElement("div");i.segments?(c=h.width,l=h.height,a=h.x,v=h.y):(c=i.width?i.width:i._width,l=i.height?i.height:i._height,a=i.offsetX-c*i.pivot.x,v=i.offsetY-l*i.pivot.y);f&&(a=0,v=0);var b=i.visible?"visible":"hidden",k="width:"+c+"px; height:"+l+"px; left:"+a+"px; top:"+v+"px; display: block; position: absolute; pointer-events: none; visibility:"+b+"; padding: inherit;",w=i._type==="node"?"ej-d-node":i._type==="group"?"ej-d-group":"ej-d-connector";i._isClassifier&&(w+=" ej-d-classifier");t.datavisualization.Diagram.Util.attr(e,{id:i.name,"class":w,style:k});i.rotateAngle&&(e.style.webkitTransform="rotate("+i.rotateAngle+"deg) ",e.style.MozTransform="rotate("+i.rotateAngle+"deg) ",e.style.OTransform="rotate("+i.rotateAngle+"deg) ",e.style.msTransform="rotate("+i.rotateAngle+"deg)",e.style.transform="rotate("+i.rotateAngle+"deg) ",e.style["transform-origin"]=i.pivot.x*100+"% "+i.pivot.y*100+"%");s&&s.appendChild(e)}this._renderLabel(i,h,y[o],e,s,r,c,l,u)}}}else this._renderSVGLabels(i,r,u,f)},_isParentVisible:function(n,t){for(var i=t.document.getElementById(n);i&&(i.getAttribute("class")!="DiagramLayer"||i.localName&&i.localName!=="svg");){if(i.localName&&i.localName!=="svg")break;if(i&&i.getAttribute("visibility")!=="visible")return!0;i=i.parentNode}},_renderLabel:function(n,i,r,u,f,e,o,s,h){var l=document.createElement("div"),c=document.createElement("span"),p,w,y,v,b,a;return r.templateId&&(p=h._renderEjTemplate("#"+r.templateId,r)),e.document&&e.document.getAttribute("class")==="overview_svg"?t.datavisualization.Diagram.Util.attr(c,this._addCssClass(r,{id:n.name+"_"+r.name,"class":"ej-d-label",style:"display: inline-block; position: absolute; line-height: normal; pointer-events: none"})):(w=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,h),y="ej-d-label",n._isClassifier&&(y+=" ej-d-classifier"),t.datavisualization.Diagram.Util.attr(c,this._addCssClass(r,{id:n.name+"_"+r.name,"class":y,style:"display: inline-block; position: absolute; line-height: normal; pointer-events:"+(w?"all":"none")}))),(r.horizontalAlignment=="stretch"||r.verticalAlignment=="stretch")&&(v=this._rotateLabel(o,s,r),r.horizontalAlignment=="stretch"&&(c.style.width=Math.abs(v.x)+"px"),r.verticalAlignment=="stretch"&&(c.style.alignItems="center",c.style.display="flex",c.style.justifyContent="center",c.style.height=Math.abs(v.y)+"px"),r.textOverflow&&(c.style.display="inline-block",r.rotateAngle==0&&n._isHeader?(c.style.top=Math.abs(v.y)/2-r.fontSize/2+"px",c.style.left="0px"):n._isHeader&&(c.style.left=Math.abs(v.y)/2-r.fontSize/2+"px",c.style.top="0px"))),r.bold&&(c.style.fontWeight="bold"),r.italic&&(c.style.fontStyle="italic"),(!r.visible||this._isParentVisible(n.name,e))&&(c.style.visibility="hidden"),c.style.opacity=r.opacity,c.style.textDecoration=r.textDecoration,c.style.fontFamily=r.fontFamily,c.style.fontSize=r.fontSize+"px",c.style.color=r.fontColor,c.style.backgroundColor=r.fillColor,c.style.borderColor=r.borderColor,c.style.borderWidth=r.borderWidth+"px",n._isHeader&&(c.style.borderWidth="0px",c.style.backgroundColor="transparent"),c.style.borderStyle="solid",c.textContent=r.text,o=o>r.width?o:r.width,s=s>r.height?s:r.height,r.margin.left&&r.margin.right&&(o-=(r.margin.left||0)+(r.margin.right||0)),r.margin.top&&r.margin.bottom&&(s-=(r.margin.top||0)+(r.margin.bottom||0)),b="display: inline-block; position: absolute; pointer-events: none; width:"+o+"px;height:"+s+"px;",t.datavisualization.Diagram.Util.attr(l,{id:n.name+"_"+r.name+"_lblbg",style:b}),r.templateId||(l.appendChild(c),u.appendChild(l),this._alignTextOnLabel(n,i,c,l,r,h,a)),r.templateId&&(a=document.createElement("div"),a.setAttribute("class","ej-label-template"),a.innerHTML=p,l.appendChild(a),u.appendChild(l),a.style.position="absolute",this._alignTextOnLabel(n,i,a,l,r,h)),l},_findChild:function(n,t){for(var r=n.length,i=0;i<r;i++)if(n[i].id==t.name)return n[i]},_updateLabels:function(n,i,r){var u,d,g,h,nt,c,tt,w,o,f,e,b;if(r.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg)this._updateSVGLabels(n,i,r);else if(n.labels&&n.labels.length&&n.type!="text"){var k=n.labels,l=t.datavisualization.Diagram.Util.bounds(n),s,a,v,y,p=i.document.parentNode.getElementsByClassName("htmlLayer")[0];for(p&&(u=p.childNodes[n.zOrder],u&&u.id==n.name||(d=p.childNodes,u=this._findChild(d,n,i))),u&&(n.segments?(s=l.width,a=l.height,v=l.x,y=l.y):(s=n.width?n.width:n._width,a=n.height?n.height:n._height,v=n.offsetX-s*n.pivot.x,y=n.offsetY-a*n.pivot.y),g=n.visible?"visible":"hidden",u.style.width=s+"px",u.style.height=a+"px",u.style.left=v+"px",u.style.top=y+"px",u.style.opacity=n.opacity,h="rotate("+n.rotateAngle+"deg) ",nt=n.pivot?n.pivot.x*100+"% "+n.pivot.y*100+"%":"50% 50%",u.style.webkitTransform=h,u.style.MozTransform=h,u.style.OTransform=h,u.style.msTransform=h,u.style.transform=h,u.style["transform-origin"]=u.style["ms-transform-origin"]=u.style["webkit-transform-origin"]=u.style["o-transform-origin"]=u.style["moz-transform-origin"]=nt,u.style.visibility=g),o=0;o<k.length;o++)n.labels[o].hyperlink&&!n.labels[o].text?this._updateSVGLabel(n,n.labels[o],i,r):u&&(f=k[o],c=u.childNodes[o],c&&(e=c.childNodes[0],(f.text||e.textContent)&&(w=s>f.width?s:f.width,f.margin.left&&f.margin.right&&(w-=(f.margin.left||0)+(f.margin.right||0)),f.margin.top&&f.margin.bottom&&(tt-=(f.margin.top||0)+(f.margin.bottom||0)),c.style.height=tt+"px",c.style.width=w+"px",f.templateId||(e.textContent=f.text),(f.horizontalAlignment=="stretch"||f.verticalAlignment=="stretch")&&(b=this._rotateLabel(s,a,f),f.horizontalAlignment=="stretch"&&(e.style.width=Math.abs(b.x)+"px"),f.verticalAlignment=="stretch"&&(e.style.alignItems="center",e.style.display="flex",e.style.justifyContent="center",e.style.height=Math.abs(b.y)+"px"),f.textOverflow&&(e.style.display="inline-block")),this._alignTextOnLabel(n,l,e,c,f,r))))}},_alignTextOnPhase:function(n,i,r,u,f){var o,e,s,h;f.getElementById(n.name)&&(o=f.getElementById(n.name).getBoundingClientRect());o&&(e=r.getBBox(),s=f.getElementById(n.name+"_"+u.name+"_lblbg"),r.setAttribute("transform","translate("+-e.width/2+",50), rotate(0,0,0)"),r.setAttribute("pointer-events","auto"),s&&(h={width:e.width,height:e.height,fill:u.fillColor,stroke:u.borderColor,"stroke-width":u.borderWidth,transform:"translate("+-e.width+","+o.top+"), rotate(0,0,0)"},t.datavisualization.Diagram.Util.attr(s,h)))},updateLabel:function(i,r,u,f){var e,a;if(typeof r.text=="string"){var o,v,h,s,c,l=t.datavisualization.Diagram.Util.bounds(i),y=u.document.parentNode.getElementsByClassName("htmlLayer")[0]||f._htmlLayer,p=n(y).children("#"+i.name)[0];i.segments?(s=l.width,c=l.height):(s=i.width?i.width:i._width,c=i.height?i.height:i._height);o=n(p).children("#"+i.name+"_"+r.name+"_lblbg")[0];o?(e=o.childNodes[0],h=s>r.width?s:r.width,r.margin.left&&r.margin.right&&(h-=(r.margin.left||0)+(r.margin.right||0)),r.margin.top&&r.margin.bottom&&(v-=(r.margin.top||0)+(r.margin.bottom||0)),o.style.height=v+"px",o.style.width=h+"px",r.templateId||(e.textContent=r.text),e.style.opacity=r.opacity,(r.horizontalAlignment=="stretch"||r.verticalAlignment=="stretch")&&(a=this._rotateLabel(s,c,r),r.horizontalAlignment=="stretch"&&(e.style.width=Math.abs(a.x)+"px"),r.verticalAlignment=="stretch"&&(e.style.alignItems="center",e.style.display="flex",e.style.justifyContent="center",e.style.height=Math.abs(a.y)+"px"),r.textOverflow&&(e.style.display="inline-block")),i.type!="node"||i.width||i.height||this.updateNode(i,u,f),this._alignTextOnLabel(i,l,e,o,r,f)):this._updateLabelSpanElement(i,r,u,f)}},_alignTextOnLabel:function(n,i,r,u,f,e){var c,p,w,h,l,y,b;if(n.segments&&f.relativeMode=="segmentpath"){var k=this._getConnectorHandlePosition(f,n,1,e),d=k.position,h={x:(d.x-i.x)/i.width,y:(d.y-i.y)/i.height},g=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,f,e,k);w=g.vAlign;p=g.hAlign}else h={x:f.offset.x,y:f.offset.y},p=f.horizontalAlignment,w=f.verticalAlignment;r.style["pointer-events"]=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,e)?e&&e.activeTool&&e.activeTool.name==="move"&&e.activeTool.inAction?"none":"all":"none";l=n.width?n.width:n._width;y=n.height?n.height:n._height;l-=f.margin.left+f.margin.right;y-=f.margin.top+f.margin.bottom;c={x:l,y:y};f.textOverflow&&(r.style.textOverflow=f.overflowType,r.style.overflow="hidden",r.style.whiteSpace="nowrap",r.style.width=l+"px");f.rotateAngle&&(b=t.Matrix.identity(),t.Matrix.rotate(b,f.rotateAngle,h.x,h.y),c=t.Matrix.transform(b,{x:l,y:y}));var o=0,s=0,a,v,nt=t.datavisualization.Diagram.Util.canMoveLabel(n);f.wrapping==t.datavisualization.Diagram.TextWrapping.NoWrap?(r.style.whiteSpace="nowrap",r.style.wordWrap="normal",r.style.maxWidth="",r.style.maxHeight=""):f.templateId||(f.textOverflow||(r.style.whiteSpace=f.textAlign!="justify"?"pre-wrap":"pre-line"),f.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap?(r.style.wordBreak="break-all",r.style.wordWrap="break-word",n.segments?r.style.maxWidth=Math.abs(f.width)+"px":(Math.abs(c.x)<f.width&&(c.x=f.width),r.style.maxWidth=Math.abs(c.x)+"px",r.style.maxHeight=Math.abs(c.y)+"px")):(r.style.wordWrap="break-word",r.style.maxWidth="",r.style.maxHeight=""));switch(p){case t.datavisualization.Diagram.HorizontalAlignment.Left:o="0%";a=f.margin.left+"px";break;case t.datavisualization.Diagram.HorizontalAlignment.Center:o="-50%";a=f.margin.left-f.margin.right+"px";break;case t.datavisualization.Diagram.HorizontalAlignment.Right:o="-100%";a=-f.margin.right+"px";break;case t.datavisualization.Diagram.HorizontalAlignment.Stretch:o="-50%"}switch(w){case t.datavisualization.Diagram.VerticalAlignment.Top:s="0%";v=f.margin.top+"px";break;case t.datavisualization.Diagram.VerticalAlignment.Center:s="-50%";v=f.margin.top-f.margin.bottom+"px";break;case t.datavisualization.Diagram.VerticalAlignment.Bottom:s="-100%";v=-f.margin.bottom+"px";break;case t.datavisualization.Diagram.VerticalAlignment.Stretch:s="-50%"}f.margin.left&&f.margin.right&&f.margin.top&&f.margin.bottom&&!n._isClassifier&&!n._isClassMember?(r.style.marginLeft=a,r.style.marginTop=v):(u.style.marginLeft=a,u.style.marginTop=v);h.x*=100;h.y*=100;r.style.textAlign=f.textAlign;r.style.webkitTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.MozTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.OTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.msTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.transform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";f.horizontalAlignment=="stretch"||f.verticalAlignment=="stretch"||f.templateId||(r.style.left="0px",r.style.top="0px");u&&(u.style.left=h.x+"%",u.style.top=h.y+"%")},_rotateLabel:function(n,i,r){var f={x:n,y:i},u;return r.rotateAngle&&(u=t.Matrix.identity(),t.Matrix.rotate(u,r.rotateAngle,0,0),f=t.Matrix.transform(u,{x:n,y:i})),f},_renderLabelGroup:function(n,t,i){var r,u;if(n._type=="group"){for(r=0;r<n.children.length;r++)u=i.nameTable[i._getChild(n.children[r])],u._type=="group"?this._renderLabelGroup(u,t,i):this._renderLabelsAsSvg(u,t,i);this._renderLabelsAsSvg(n,t,i)}},_renderLabelsAsSvg:function(n,t,i){var u=t.document.getElementById(n.name),r;if(n.type=="text")this._renderTextElementAsSvg(n,n.textBlock,u,t,i);else for(r=0;r<n.labels.length;r++)this._renderTextElementAsSvg(n,n.labels[r],u,t,i)},_renderTextElementAsSvg:function(n,i,r,u,f){var o={id:n.name+"_"+i.name,"class":"ej-d-label","font-family":i.fontFamily,"font-size":i.fontSize,fill:i.fontColor,"text-decoration":i.textDecoration,"pointer-events":"none"},e,a,h,s,c,l;(i.bold&&(o["font-weight"]="bold"),i.italic&&(o["font-style"]="italic"),e=u.text(o),e.textContent=i.text,o={id:n.name+"_"+i.name+"_lblbg",fill:i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth,transform:"translate(0,0)"},a=u.rect(o),i.text)&&(r.appendChild(e),r.insertBefore(a,e),h=t.datavisualization.Diagram.Util.bounds(n),s=!1,n._isHeader&&i.rotateAngle&&f&&(c=f.nameTable[n.parent],c&&c.isLane&&(s=!0),l=f.nameTable[n.parent],l&&l.isPhaseStack&&!n.orientation=="vertical"&&(s=!0)),this._wrapText(n,h,e,i,u,s),this._alignTextOnSvgLabel(n,h,e,i,u,f,s))},_alignTextOnSvgLabel:function(n,i,r,u,f,e,o){var l=r.getBBox(),h=t.datavisualization.Diagram.Util._getLabelPosition(u,i),s,c,y,v,a,p;o&&(l=t.datavisualization.Diagram.Util._rBounds(l,u.rotateAngle),h=t.datavisualization.Diagram.Util._getLabelPosition(u,i,null,null,o,r));s=o?h:this._adjustOffsetWithTextBounds(n,u,r,h,l,i,e);c=u.borderWidth||0;r.setAttribute("transform","translate("+(s.x+c)+","+(s.y+c)+"), rotate("+u.rotateAngle+","+(h.x-s.x)+","+(h.y-s.y)+")");y=f.getElementById(n.name+"_"+u.name+"_lblbg");y&&(v=s.x+l.x,a=s.y,t.browserInfo().name==="mozilla"&&(a=s.y+u.fontSize/2),v=v+c/2,a=a+c/2,p={width:l.width+c,height:l.height+c,transform:"translate("+v+","+a+"), rotate("+u.rotateAngle+","+(h.x-v)+","+(h.y-a)+")",fill:u.fillColor?u.fillColor:"transparent",stroke:u.borderColor,"stroke-width":u.borderWidth},o&&(p.fill="transparent"),t.datavisualization.Diagram.Util.attr(y,p))},_adjustOffsetWithTextBounds:function(n,i,r,u,f,e,o){var s={x:0,y:0},c=0,h,a,v;if(n.segments&&i.relativeMode==="segmentpath"){var y=this._getConnectorHandlePosition(i,n,1,o),p=y.position,l={x:(p.x-e.x)/e.width,y:(p.y-e.y)/e.height};l=t.datavisualization.Diagram.Util._getLabelPosition(i,e,l);u.x=l.x;u.y=l.y;v=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,i,o,y);a=v.hAlign;h=v.vAlign}else a=i.horizontalAlignment,h=i.verticalAlignment;if(h==t.datavisualization.Diagram.VerticalAlignment.Top?c=u.y:h==t.datavisualization.Diagram.VerticalAlignment.Center?c=u.y-f.height/2:h==t.datavisualization.Diagram.VerticalAlignment.Bottom?c=u.y-f.height:h==t.datavisualization.Diagram.VerticalAlignment.Stretch&&(c=u.y-f.height/2),s.y=c,i.textAlign=="justify")s.x=r.childNodes.length>1?u.x-n.width/2:u.x;else switch(a){case t.datavisualization.Diagram.HorizontalAlignment.Left:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x+f.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x+f.width}break;case t.datavisualization.Diagram.HorizontalAlignment.Center:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x-f.width/2;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x+f.width/2}break;case t.datavisualization.Diagram.HorizontalAlignment.Right:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x-f.width;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x-f.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x}break;case t.datavisualization.Diagram.HorizontalAlignment.Stretch:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x-e.width/2;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x+e.width/2}}return(n.segments||n._type=="group")&&(s.x=s.x+e.x,s.y=s.y+e.y,u.x+=e.x,u.y+=e.y),t.browserInfo().name==="mozilla"&&(s.y=s.y-i.fontSize/2),s},_wrapText:function(n,t,i,r,u,f){for(var d=r.text,o,y,w,l,e,h,g,s,b,c,p,a,v,k;i.hasChildNodes();)i.removeChild(i.lastChild);if(n.segments?(o=t.width,y=t.height):(o=t.width-r.margin.left-r.margin.right,y=t.height-r.margin.top-r.margin.bottom),f&&(w=o,o=y,y=w),o-=2*(r.borderWidth?r.borderWidth:1),o=o<r.width?r.width:o,l=d.split("\n"),g="",u.getElementById(i.id)&&(s=u.getElementById(i.id).childNodes),s){for(p=r.wrapping=="wrapwithoverflow"?!0:!1,h=0;h<l.length;h++)if(e=u.tspan(),e.style.fontSize=r.fontSize,i.appendChild(e),r.wrapping!="nowrap")for(a=r.wrapping=="wrapwithoverflow"?l[h].split(" "):l[h],c=0;c<a.length;c++)e.textContent+=(v&&p?" ":"")+a[c],b=s[s.length-1].getComputedTextLength(),b>=o?c==a.length-1||(e=u.tspan(),i.appendChild(e),v=""):p&&(v=e.textContent,e.textContent+=a[c+1]||"",k=s[s.length-1].getComputedTextLength(),e.textContent=v,k>o&&(e=u.tspan(),i.appendChild(e),v=""));else e.textContent+=l[h];this._wrapTextAlign(i,s,r.fontSize,r.textAlign,n)}},_wrapTextAlign:function(n,i,r,u,f){for(var l,a,o,h,c,e,s=0;s<i.length;s++){u=="justify"&&s!=i.length-1?(e=i[s].textContent,e[e.length-1]==" "&&(e=e.slice(0,e.length-1)),e[0]==" "&&(e=e.slice(1,e.length)),i[s].textContent=e,o=i[s].getComputedTextLength(),h=f.width-o,c=h/(e.split(" ").length-1),i[s].setAttribute("word-spacing",c+"px"),o=i[s].getComputedTextLength()):o=i[s].getComputedTextLength();u=="justify"&&(u=i.length>1?"left":"center");switch(u){case"left":o=0;break;case"center":o=-o/2;break;case"right":o=-o}l={x:Number(o),dy:r};a=i[s];t.datavisualization.Diagram.Util.attr(a,l)}},_renderPorts:function(n,t,i){for(var e,u=n.ports,f,r=0,o=u.length;r<o;++r)f=u[r],e=this._renderPort(n,f,t),i.appendChild(e)},_renderPort:function(n,i,r){var o,u,s,e=t.datavisualization.Diagram.Size(i.size,i.size),f,h,c,l,a;s=i.visibility&t.datavisualization.Diagram.PortVisibility.Hidden||i.visibility&t.datavisualization.Diagram.PortVisibility.Hover||i.visibility&t.datavisualization.Diagram.PortVisibility.Connect?"hidden":"visible";f=n._type==="group"?t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!1):t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!0);n._type==="group"&&n.rotateAngle&&(h=t.Matrix.identity(),t.Matrix.rotate(h,n.rotateAngle,n.offsetX,n.offsetY),f=t.Matrix.transform(h,f),i._absolutePoint=f);switch(i.shape){case"x":c=this._constructX(f,i.size);u={id:n.name+"_"+i.name,"class":"ej-d-port",fill:i.fillColor,visibility:s,stroke:i.borderColor,"stroke-width":i.borderWidth,d:c};this._addCssClass(i,u);o=r.path(u);break;case"circle":l=e.width/2;a=e.height/2;u={id:n.name+"_"+i.name,"class":"ej-d-port",rx:l,ry:a,visibility:s,cx:f.x,cy:f.y,fill:i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth};this._addCssClass(i,u);o=r.ellipse(u);break;case"square":u={id:n.name+"_"+i.name,"class":"ej-d-port",x:f.x-i.size/2,visibility:s,y:f.y-i.size/2,width:e.width,height:e.height,fill:i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth};this._addCssClass(i,u);o=r.rect(u);break;case"path":var v=e.width,y=e.height,c=i._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(f.x-i.size/2,f.y-i.size/2,v,y,i.pathData,r),u={id:n.name+"_"+i.name,width:v,height:y,d:c,stroke:i.borderColor,"stroke-width":i.borderWidth,fill:i.fillColor,visibility:s};this._addCssClass(i,u);o=r.path(u)}return o},_insertPort:function(n,i,r){var f,u;f=document.getElementById(n.name);u=t.datavisualization.Diagram.SvgContext._renderPort(n,i,r);f.appendChild(u);(i.visibility&t.datavisualization.Diagram.PortVisibility.Hidden||i.visibility&t.datavisualization.Diagram.PortVisibility.Hover||i.visibility&t.datavisualization.Diagram.PortVisibility.Connect)&&u.setAttribute("visibility","hidden")},_updatePort:function(n,i,r){var e=t.datavisualization.Diagram.Size(i.size,i.size),u=null,f,s,o,h,c;u=n._type==="group"?t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!1):t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!0);f=n.name+"_"+i.name;n._type==="group"&&n.rotateAngle&&(s=t.Matrix.identity(),t.Matrix.rotate(s,n.rotateAngle,n.offsetX,n.offsetY),u=t.Matrix.transform(s,u),i._absolutePoint=u);switch(i.shape){case"x":o=this._constructX(u,i.size);r.path({id:f,d:o});break;case"circle":h=e.width/2;c=e.height/2;n.type==="group"?r.ellipse({id:f,rx:h,ry:c,cx:0,cy:0,transform:"rotate("+n.rotateAngle+","+u.x+","+u.y+"),translate("+u.x+","+u.y+")"}):r.ellipse({id:f,rx:h,ry:c,cx:u.x,cy:u.y});break;case"square":n.type==="group"?r.rect({id:f,x:0,y:0,transform:"rotate("+n.rotateAngle+","+u.x+","+u.y+"),translate("+(u.x-i.size/2)+","+(u.y-i.size/2)+")"}):r.rect({id:f,x:u.x-i.size/2,y:u.y-i.size/2});break;case"path":var a=e.width,v=e.height,o=i._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(u.x-i.size/2,u.y-i.size/2,a,v,i.pathData,r),l={id:f,d:o};n.type==="group"&&(l={id:f,d:o,transform:"rotate("+n.rotateAngle+","+u.x+","+u.y+")"});r.path(l)}},_updatePorts:function(n,t){for(var u,r=n.ports,i=0,f=r.length;i<f;++i)u=r[i],this._updatePort(n,u,t)},_constructX:function(n,i){var r=new t.datavisualization.Diagram.Path;return r.moveTo(n.x-i/2,n.y-i/2),r.lineTo(n.x+i/2,n.y+i/2),r.moveTo(n.x+i/2,n.y-i/2),r.lineTo(n.x-i/2,n.y+i/2),r.toString()},_enableSelectedNode:function(t,i,r){var e,u,a,o,v,s,h,f,c,l;if(t){if(t.type=="pseudoGroup")for(e=t.children,u=0,a=e.length;u<a;u++)o=r.nameTable[r._getChild(e[u])],o&&this._enableSelectedNode(o,i,r);else v={id:t.name,"pointer-events":"auto",style:"pointer-events:block"},t.segments&&(s=i.document.getElementById(t.name+"_hitTest"),s&&s.setAttribute("pointer-events",t.visible?"stroke":"none")),i.g(v);t&&t.type==="html"&&(h=r._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],h&&(f=n(h).find("#"+t.name+"_parentdiv")[0]),f&&(f.style.pointerEvents="all",c=f.children[0],c&&(c.style.pointerEvents="all")));r._adornerSvg&&(l=r._adornerSvg.document.getElementById(r._adornerSvg.document.id+"handle_g"),l&&l.setAttribute("pointer-events","visible"));n(".ej-d-seperator").css("pointer-events","stroke");n(".e-resize").css("pointer-events","visible");n(".s-resize").css("pointer-events","visible")}},_disableSelectedNode:function(t,i,r){var e,u,l,o,a,v,s,h,f,c;if(t){if(t.type=="pseudoGroup")for(e=t.children,u=0,l=e.length;u<l;u++)o=r.nameTable[r._getChild(e[u])],o&&this._disableSelectedNode(o,i,r);else a={id:t.name,style:"pointer-events:none","pointer-events":"none"},t.segments&&(v=i.document.getElementById(t.name+"_hitTest"),v.setAttribute("pointer-events","none")),i.g(a);r._adornerSvg&&(s=r._adornerSvg.document.getElementById(r._adornerSvg.document.id+"handle_g"),s&&s.setAttribute("pointer-events","none"));t&&t.type==="html"&&(h=r._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],h&&(f=n(h).find("#"+t.name+"_parentdiv")[0]),f&&(f.style.pointerEvents="none",c=f.children[0],c&&(c.style.pointerEvents="none")));n(".e-resize").css("pointer-events","none");n(".ej-d-seperator").css("pointer-events","none");n(".s-resize").css("pointer-events","none")}},_drawStackHighlighter:function(n,i,r,u,f,e){var c,s=[],o=t.datavisualization.Diagram.Util.bounds(n);e?f.y>=o.y&&f.y<o.center.y?(s.push({x:o.topLeft.x*u-5,y:o.topLeft.y*u-5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.topLeft.x*u-5,y:o.topLeft.y*u+5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.topRight.x*u+5,y:o.topRight.y*u-5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.topRight.x*u+5,y:o.topRight.y*u+5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u})):(s.push({x:o.bottomLeft.x*u-5,y:o.bottomLeft.y*u-5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u-5,y:o.bottomLeft.y*u+5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u+5,y:o.bottomRight.y*u-5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u+5,y:o.bottomRight.y*u+5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u})):f.x>=o.x&&f.x<o.center.x?(s.push({x:o.topLeft.x*u-5,y:o.topLeft.y*u-5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.topLeft.x*u+5,y:o.topLeft.y*u-5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u-5,y:o.bottomLeft.y*u+5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u+5,y:o.bottomLeft.y*u+5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u})):(s.push({x:o.topRight.x*u-5,y:o.topRight.y*u-5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.topRight.x*u+5,y:o.topRight.y*u-5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u-5,y:o.bottomRight.y*u+5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u+5,y:o.bottomRight.y*u+5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}));var c=this._convertToSVGPoints(s),l={id:"nodeHighlighter",points:c,fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":"none",style:"pointer-events: none"},h=i.polyline(l);return r.appendChild(h),h},_drawNodeHighlighter:function(n,i,r,u){var f,e=n.width?n.width:n._width,o=n.height?n.height:n._height,h=n.offsetX-e*n.pivot.x,c=n.offsetY-o*n.pivot.y,s=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),l="rotate("+n.rotateAngle+","+s.x*u+","+s.y*u+")",a=n.isLane||n.isSwimlane?"red":"#0dc923",v={id:"nodeHighlighter","class":"ej-d-node",x:h*u,y:c*u,width:e*u,height:o*u,fill:"transparent",stroke:a,"stroke-width":2,"pointer-events":"none",transform:l,style:"pointer-events: none"};return f=i.rect(v),r.appendChild(f),f},_drawNavigationHighlighter:function(n,t,i,r){var u={id:"nodeHighlighter",x:n.x*r,y:n.y*r,width:n.width*r,height:n.height*r,fill:"transparent",stroke:"black","stroke-dasharray":"2 2","shape-rendering":"crispEdges",style:"pointer-events: none"};i.appendChild(t.rect(u))},_removeNodeHighlighter:function(n,t){var i=n.getElementById("nodeHighlighter");i&&n.removeChild(i,t)},_drawPortHighlighter:function(n,i,r,u,f){var l,o,e,h,c,a,d=i.width?i.width:i._width,g=i.height?i.height:i._height,s,v="#8CC63F",w="#1A1A1A",b=.5,y,p,k;return n?(o=t.datavisualization.Diagram.Size(n.size*2,n.size*2),e=t.datavisualization.Diagram.Util._getPortPosition(n,t.datavisualization.Diagram.Util.bounds(i,!0)),p=t.Matrix.identity(),t.Matrix.rotate(p,i.rotateAngle,i.offsetX,i.offsetY),e=t.Matrix.transform(p,e),h=(e.x-n.size)*f,c=(e.y-n.size)*f,a="rotate(0,"+(h+o.width/2)+","+(c+o.height/2)+")"):(s=t.datavisualization.Diagram.Util.bounds(i,!0),o=t.datavisualization.Diagram.Size(s.width,s.height),e=t.datavisualization.Diagram.Point(s.x,s.y),h=e.x*f,c=e.y*f,w=v,v="transparent",b=2,y=t.datavisualization.Diagram.Point(i.offsetX,i.offsetY),a="rotate("+i.rotateAngle+","+y.x*f+","+y.y*f+")"),k={id:"portHighlighter","class":"ej-d-port",x:h,y:c,width:o.width*f,height:o.height*f,fill:v,stroke:w,"stroke-width":b,"pointer-events":"none",transform:a},l=r.rect(k),u.appendChild(l),l},_drawConnectorHighlighter:function(n,t,i){var u=t._adornerSvg,r=u.g({id:"connector_highlighter",visibility:"visible",transform:"scale("+i+")"});t._adornerLayer.appendChild(r);var f=this._findPath(n,t),e={id:"highlighter_segments",d:f,fill:"none",stroke:"#0dc923","stroke-width":n.lineWidth,"pointer-events":"none"},o=u.path(e);return r.appendChild(o),r},_removeConnectorHighlighter:function(n,t){var i=t.getElementById("connector_highlighter");i&&n.removeChild(i)},_removePortHighlighter:function(n,t){var i=n.getElementById("portHighlighter");i&&n.removeChild(i,t)},_renderPhaseResize:function(n,i,r,u,f){var s,e=[],l="",a=!1,v=!1,o=t.datavisualization.Diagram.Util.bounds(n),c,h;s;e=[];e.push({x:o.topLeft.x*r,y:o.topLeft.y*r});e.push({x:o.bottomLeft.x*r,y:o.bottomLeft.y*r});s=this._convertToSVGPoints(e);h={id:"w-resize",points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":"none"};c=i.polyline(h);f.appendChild(c);s;e=[];e.push({x:o.topLeft.x*r,y:o.topLeft.y*r});e.push({x:o.topRight.x*r,y:o.topRight.y*r});s=this._convertToSVGPoints(e);h={id:"n-resize",points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":"none"};c=i.polyline(h);f.appendChild(c);l="";n.orientation=="vertical"&&(l="e-resize",v=!0);s;e=[];e.push({x:o.topRight.x*r,y:o.topRight.y*r});e.push({x:o.bottomRight.x*r,y:o.bottomRight.y*r});s=this._convertToSVGPoints(e);v&&(h={id:"e-resize-hitTest","class":l,points:s,fill:"transparent",stroke:"transparent","stroke-width":10,"pointer-events":v?"stroke":"none"},c=i.polyline(h),f.appendChild(c));h={id:"e-resize","class":l,points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":v?"stroke":"none"};c=i.polyline(h);f.appendChild(c);l="";n.orientation=="horizontal"&&(l="s-resize",a=!0);s;e=[];e.push({x:o.bottomLeft.x*r,y:o.bottomLeft.y*r});e.push({x:o.bottomRight.x*r,y:o.bottomRight.y*r});s=this._convertToSVGPoints(e);a&&(h={id:"s-resize-hitTest","class":l,points:s,fill:"transparent",stroke:"transparent","stroke-width":10,"pointer-events":a?"stroke":"none"},c=i.polyline(h),f.appendChild(c));h={id:"s-resize","class":l,points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":a?"stroke":"none"};c=i.polyline(h);f.appendChild(c)},renderSelector:function(t,i,r,u,f,e){var s,h,o,c;n(".phaseSelector").remove();s=t.width?t.width:t._width;h=t.height?t.height:t._height;t.segments?(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible"}),r.appendChild(o),this._renderEndPointHandle(t,i,u)):t.type!="phase"?t.isLane||t.isSwimlane?(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible"}),r.appendChild(o),this._renderPhaseResize(t,i,u,f,o,e)):(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible",transform:"translate("+(t.offsetX-s*t.pivot.x)*u+","+(t.offsetY-h*t.pivot.y)*u+"),rotate("+t.rotateAngle+","+s*t.pivot.x*u+","+h*t.pivot.y*u+")"}),r.appendChild(o),this._renderResizeHandle(t,i,u,f)):t.type=="phase"&&e&&(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible",transform:"translate("+e.x*u+","+e.y*u+"),rotate(0,"+e.width/2*u+","+e.height/2*u+")"}),i.document.getElementById(i.document.id+"handle_g")||r.appendChild(o),c=i.rect({id:"phaseSelector","class":"phaseSelector","stroke-width":2,"stroke-dasharray":"3,3","pointer-events":"none",width:e.width<0?1:e.width*u,height:e.height<0?1:e.height*u,fill:"transparent",stroke:"red"}),o.appendChild(c))},_renderResizeHandle:function(n,i,r,u){var f=n.width?n.width:n._width,e=n.height?n.height:n._height,s=n.pivot,o=t.datavisualization.Diagram.Point(f*s.x,-20/r);u&t.datavisualization.Diagram.SelectorConstraints.Rotator&&n.type!="umlclassifier"&&(this._renderPivotLine(n,i,r),this._renderRotateThumb("rotateHandle",n,o.x,o.y,r,i));u&t.datavisualization.Diagram.SelectorConstraints.Resizer&&(this._renderResizeBorder("resizeBorder",n,i,r),n.type!="umlclassifier"&&(this._renderResizeCorner("nw-resize",n,0,0,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest)),this._renderResizeCorner("n-resize",n,f/2*r,0,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorth)),this._renderResizeCorner("ne-resize",n,f*r,0,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast)),this._renderResizeCorner("w-resize",n,0,e/2*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeWest)),this._renderResizeCorner("e-resize",n,f*r,e/2*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeEast)),this._renderResizeCorner("sw-resize",n,0,e*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest)),this._renderResizeCorner("s-resize",n,f/2*r,e*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouth)),this._renderResizeCorner("se-resize",n,f*r,e*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast))))},renderUserHandles:function(n,t,i,r,u,f,e){var h,s,o;if(t&&(t.type==="phase"&&e&&(h=e._getPhaseBounds(t)),n.length))for(s=i.g({id:i.document.id+"userHandle_g","class":"userHandle","pointer-events":"visible"}),f.appendChild(s),o=0;o<n.length;o++)(r&&n[o].enableMultiSelection||!r)&&this._renderUserHandle(n[o],t,i,u,s,h,e)},_renderUserHandle:function(n,i,r,u,f,e,o){var s,w=this._getHandlePosition(n,i,u,e,o),l=w.x*u,a=w.y*u,g=this._getHandleShape(n,l,a),k,v,y,it,d,c,h,p;n._size=n.size;var nt=f.appendChild(r.circle(g)),tt={id:n.name+"_title"},b=r.title(tt);b.innerHTML=n.name;nt.appendChild(b);switch(n.shape){case"path":k=n._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(0,0,n.size/2,n.size/2,n.pathData,r);s=this._getHandleIcon(n,l-n.size/4,a-n.size/4);s.d=k;f.appendChild(r.path(s));break;case"image":s=this._getHandleIcon(n,l-n.size/4,a-n.size/4);s.preserveAspectRatio="none";v=new Image;v.src=n.source;y=r.image(s);y.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",v.src);f.appendChild(y);break;case"native":it=n.visible?"visible":"hidden";s=this._getHandleIcon(n,l-n.size/4,a-n.size/4);d=o._renderEjTemplate("#"+n.templateId,n);c=document.createElement("div");c.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g id="tempNative">'+d+"<\/g><\/svg>";document.body.appendChild(c);h=document.getElementById("tempNative").cloneNode(!0);h.id=n.name+"_shape";f.appendChild(h);var e=h.getBBox(),rt=s.width,ut=s.height,ft=e.width?rt/e.width:1,et=e.height?ut/e.height:1;h.setAttribute("transform","scale("+ft+","+et+")");c.parentNode.removeChild(c);p=r.g(s);p.appendChild(h);f.appendChild(p)}},_getHandleIcon:function(n,t,i){var r=n.visible?"visible":"hidden";return{id:n.name+"_icon","class":"userHandle-icon",fill:n.pathColor,transform:"translate("+t+","+i+")",visibility:r,width:n.size/2,height:n.size/2}},_getHandlePosition:function(n,i,r,u,f){var o,s,e;if(i){if(i.segments&&n.offset)return this._getConnectorHandlePosition(n,i,r,f).position;o=t.datavisualization.Diagram.Point();s=i.type==="phase"&&u?t.datavisualization.Diagram.Util.bounds(u):t.datavisualization.Diagram.Util.bounds(i);var l=n.position,h=10,c=t.Matrix.identity();i.rotateAngle&&t.Matrix.rotate(c,i.rotateAngle);e=new t.datavisualization.Diagram.Point;switch(l){case"topleft":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,h+n.size/2));o.x=s.topLeft.x-e.x/r;o.y=s.topLeft.y-e.y/r;break;case"topcenter":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(0,h+n.size/2));o.x=s.topCenter.x-e.x/r;o.y=s.topCenter.y-e.y/r;break;case"topright":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,-(h+n.size/2)));o.x=s.topRight.x+e.x/r;o.y=s.topRight.y+e.y/r;break;case"middleleft":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(-(h+n.size/2),0));o.x=s.middleLeft.x+e.x/r;o.y=s.middleLeft.y+e.y/r;break;case"middleright":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,0));o.x=s.middleRight.x+e.x/r;o.y=s.middleRight.y+e.y/r;break;case"bottomleft":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(-(h+n.size/2),h+n.size/2));o.x=s.bottomLeft.x+e.x/r;o.y=s.bottomLeft.y+e.y/r;break;case"bottomcenter":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(0,h+n.size/2));o.x=s.bottomCenter.x+e.x/r;o.y=s.bottomCenter.y+e.y/r;break;case"bottomright":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,h+n.size/2));o.x=s.bottomRight.x+e.x/r;o.y=s.bottomRight.y+e.y/r}return o}},_getConnectorHandlePosition:function(n,i,r,u){var e=t.datavisualization.Diagram.Util._findOffsetOnConnector(i,n,n.segmentOffset,u),o=e.segment,s=e.point,c=e.offset,a=i.segments[o],l=i.segments[o].points[s],f=t.datavisualization.Diagram.Geometry.findAngle(l,i.segments[o].points[s+1]),h;return n.alignment&&n.alignment!="auto"?(n.offset==1&&(f+=180),{position:t.datavisualization.Diagram.Geometry.transform(e.offset,n.offset!=0&&n.offset!=1?f+45:f,this._getAlignedPosition(i,n)),angle:f}):(h=this._avoidOverlapWithSourceAndTarget(i,n.offset,n.size,e.offset,f,o,s,u),c={position:h.position,angle:n.offset==1?(180+f)%360:f,direction:h.direction},c)},_getAlignedPosition:function(n,t){var i=t.text===undefined?10:0;switch(t.alignment){case"center":return 0;case"before":return-((t.size||0)/2+i);case"after":return(t.size||0)/2+i}return 0},_avoidOverlapWithSourceAndTarget:function(n,i,r,u,f,e,o,s){var y,p,w=u,nt=n.segments[e],h=90,l,k,c;if(i==0?(y=n.segments[e].points[o+2]?n.segments[e].points[o+2]:n.segments[e+1]?n.segments[e+1].points[1]:null,y&&(p=t.datavisualization.Diagram.Geometry.findAngle(n.segments[e].points[o],y)),n.sourceNode&&(h=45)):i==1&&(y=n.segments[e].points[o-1]?n.segments[e].points[o-1]:n.segments[e-1]?n.segments[e-1][n.segments[e].points.length-2]:null,y&&(p=t.datavisualization.Diagram.Geometry.findAngle(n.segments[e].points[o+1],y)),f+=180,f%=360,n.targetNode&&(h=45)),y)if(f%90==0)p>270&&f==0&&(f=360),f==90?p<f?(f+=h,l="right"):(f-=h,l="left"):f==270?p<f?(f+=h,l="left"):(f-=h,l="right"):f==180?p<f?(f+=h,l="bottom"):(f-=h,l="top"):p<f?(f+=h,l="top"):(f-=h,l="bottom"),w=t.datavisualization.Diagram.Geometry.transform(w,f,r!=undefined?Math.max(5,r/2+10):0);else{var d=45,a=135,b=225,g=315,v;(i==0&&n.sourceNode||i==1&&n.targetNode)&&(k=i==0&&n.sourceNode?s.nameTable[n.sourceNode]:s.nameTable[n.targetNode],k&&(v=t.datavisualization.Diagram.Util.bounds(k)),v&&(c=180/(2+2/(v.height/v.width)),d=c,a=180-c,b=a+2*c,g=360-c));h=f>=d&&f<=a||f>=b&&f<=g?f%180>90?-h:h:f>a&&f<b?f>180?-45:45:f>0?-45:45;w=t.datavisualization.Diagram.Geometry.transform(w,f+h,r!=undefined?Math.max(5,r/2+10):0)}else{var d=45,a=135,b=225,g=315,v;(i==0&&n.sourceNode||i==1&&n.targetNode)&&(k=i==0&&n.sourceNode?s.nameTable[n.sourceNode]:s.nameTable[n.targetNode],k&&(v=t.datavisualization.Diagram.Util.bounds(k)),v&&(c=180/(2+2/(v.height/v.width)),d=c,a=180-c,b=a+2*c,g=360-c));h=f>=d&&f<=a||f>=b&&f<=g?f%180>90?-h:h:f>a&&f<b?f>180?-45:45:f<=d?-45:45;f+=360;f%=360;w=t.datavisualization.Diagram.Geometry.transform(w,f+h,r!=undefined?Math.max(5,r/2+(Math.abs(h%45)>0?13:10)):0)}return{position:w,direction:l}},_getHandleShape:function(n,t,i){var r=n.visible?"visible":"hidden";return{id:n.name+"_shape","class":"userHandle",cx:t,cy:i,r:n.size/2,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth||0,visibility:r}},_updateHandleShape:function(n,t,i,r){var u=n.visible?"visible":"hidden",f={id:n.name+"_shape",cx:t,cy:i,r:n.size/2,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth||0,visibility:u};r.circle(f)},_updateHanleIcon:function(n,t,i,r,u){var f=n.visible?"visible":"hidden",e={id:n.name+"_icon",d:t,fill:n.pathColor,transform:"translate("+r+","+u+")",visibility:f};i.path(e)},_getHanleIcon:function(n,t){return{id:n.name,d:t,stroke:n.borderColor,"stroke-width":n.borderWidth,fill:n.fillColor}},renderPivotPoint:function(n,i,r){var u=n.width*n.pivot.x,f=n.height*n.pivot.y;r.getElementById("pivot")?t.datavisualization.Diagram.SvgContext._updateResizeCorner("pivot",u*i,f*i,r):t.datavisualization.Diagram.SvgContext._renderResizeCorner("pivot",n,u*i,f*i,r,undefined,4);this._updatePivotLine(n,r,i,!0)},_removePivotPoint:function(n,t,i){var r=t.getElementById("pivot");r&&(r.parentNode.removeChild(r),this._updatePivotLine(n,t,i,!1))},_renderPivotLine:function(n,i,r){if(!n.container){var u=n.width?n.width:n._width,h=n.height?n.height:n._height,f=t.datavisualization.Diagram.Point(u*n.pivot.x,-20/r),e=t.datavisualization.Diagram.Point(u*n.pivot.x,0),o=i.getElementById(i.document.id+"handle_g"),s=i.line({id:"pivotLine",x1:f.x*r,y1:f.y*r,x2:e.x*r,y2:e.y*r,stroke:"black","stroke-width":1,"stroke-dasharray":"2,3",fill:"none"});o.appendChild(s)}},_renderResizeBorder:function(n,i,r,u){var e=r.getElementById(r.document.id+"handle_g"),o=i.width?i.width:i._width,s=i.height?i.height:i._height,f;f=i.type=="umlclassifier"?t.datavisualization.Diagram.ClassifierHelper.renderResizeBorder(n,i,r,u):r.rect({id:n,"class":"resizeRect",width:o*u,height:s*u,stroke:"#097F7F","stroke-width":.6,"stroke-dasharray":"6,3",fill:"none","pointer-events":"none"});e.appendChild(f)},_renderResizeCorner:function(n,i,r,u,f,e,o){var l=f.getElementById(f.document.id+"handle_g"),h,c="white",s;t.datavisualization.Diagram.Util.canResize(i)||(c="darkgray");e&&(c="darkgray",h="none");s={id:n,"class":"resizeCorners",fill:c,stroke:"black","stroke-width":1,cx:r,cy:u,r:o||7};l.appendChild(f.circle(s));s={id:n+"_transparent","class":n,fill:"transparent",cx:r,cy:u,r:o||10};h&&(s["pointer-events"]=h);l.appendChild(f.circle(s))},_renderRotateThumb:function(n,i,r,u,f,e){if(!i.container){var h=e.getElementById(e.document.id+"handle_g"),c="#231f20";t.datavisualization.Diagram.Util.canRotate(i)||(c="darkgray");var o=20,s=20,l={id:"rotatehandle","class":n,fill:c,stroke:"black","stroke-width":.5,width:o,height:s,d:"M 16.856 10.239 L 18 3.438 l -2.189 0.817 c -0.974 -1.694 -2.482 -2.995 -4.326 -3.696 C 9.375 -0.245 7.071-0.18 5.01 0.744 C 2.942 1.668 1.365 3.342 0.558 5.453 c -0.803 2.115 -0.738 4.414 0.185 6.478 c 0.925 2.064 2.6 3.645 4.714 4.45 c 0.969 0.371 1.993 0.554 3.013 0.554 c 1.345 0 2.685 -0.317 3.897 -0.948 l -1.016 -1.962 c -1.584 0.822-3.445 0.929 -5.114 0.293 c -1.56 -0.596 -2.793 -1.762 -3.479 -3.289 C 2.078 9.502 2.031 7.803 2.622 6.244 C 3.216 4.68 4.387 3.443 5.914 2.761 C 7.437 2.079 9.137 2.03 10.7 2.626 c 1.246 0.475 2.271 1.328 2.986 2.424 L 11.54 5.851 L 16.856 10.239 Z",transform:"translate("+(r*f-o/2)+","+(u*f-s)+")"},a=e.path(l),v=e.circle({id:"rotate","class":n,fill:"transparent",stroke:"none",cx:o/2,cy:s/2,r:13,transform:"translate("+(r*f-o/2)+","+(u*f-s)+")"});h.appendChild(a);h.appendChild(v)}},_refreshEndPointHandles:function(n,t,i){var r,f,u;if(n&&n.segments){if(r=t.getElementById(t.document.id+"handle_g"),r&&r.childNodes.length>0)for(f=r.childNodes.length-1;f>=0;f--)u=r.childNodes[f],u.id!=="sourceEndPoint"&&u.id!=="targetEndPoint"&&u.parentNode.removeChild(u);this._renderEndPointHandle(n,t,i)}},_renderEndPointHandle:function(n,i,r){var e,f,u,o;if(!n.isPhase)for(e=t.datavisualization.Diagram.Util.canDragSegmentThumbs(n),f=0;f<n.segments.length;f++)u=n.segments[f],u.type=="bezier"&&(this._renderBezierLine("bezierline1_"+f,u._startPoint,u._point1,r,i,e),this._renderBezierLine("bezierline2_"+f,u._endPoint,u._point2,r,i,e),this._renderEndPointCorner("bezierpoint1_"+f,u._point1.x*r,u._point1.y*r,!1,i,e),this._renderEndPointCorner("bezierpoint2_"+f,u._point2.x*r,u._point2.y*r,!1,i,e)),o=u.points,f==0&&this._renderEndPointCorner("sourceEndPoint",u._startPoint.x*r,u._startPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)),f==n.segments.length-1?(this._renderEndPointCorner("targetEndPoint",u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isTargetConnected(n),i,t.datavisualization.Diagram.Util.canDragTargetEnd(n)),u.type=="orthogonal"&&this._renderTerminalOrthoThumbs(u,i,r,f,e)):u.type!="orthogonal"?this._renderSegmentEndThumb("segmentEnd_"+f,u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)):this._renderTerminalOrthoThumbs(u,i,r,f,e)},_renderTerminalOrthoThumbs:function(n,i,r,u,f){var o,e,h,s;if(n.points.length>2)for(e=0;e<n.points.length-1;e++)s=t.datavisualization.Diagram.Geometry.distance(n.points[e],n.points[e+1]),o=n.points[e].y.toFixed(2)==n.points[e+1].y.toFixed(2)?"horizontal":"vertical",h=s>=50?"visible":"hidden",this._renderOrthogonalThumb("OrthoThumb_"+e+"_"+u,(n.points[e].x+n.points[e+1].x)/2*r,(n.points[e].y+n.points[e+1].y)/2*r,i,h,o,f);else s=n.length||t.datavisualization.Diagram.Geometry.distance(n._startPoint,n._endPoint),h=s>=50?"visible":"hidden",o=n._startPoint.y.toFixed(2)==n._endPoint.y.toFixed(2)?"horizontal":"vertical",this._renderOrthogonalThumb("OrthoThumb_"+u,(n._endPoint.x+n._startPoint.x)/2*r,(n._endPoint.y+n._startPoint.y)/2*r,i,h,o,f)},_renderEndPointCorner:function(n,t,i,r,u,f){var s=u.getElementById(u.document.id+"handle_g"),o=r?"#8CC63F":"white",e;f||(o="darkgray");e={id:n,"class":n,opacity:.75,fill:o,stroke:"black","stroke-width":2,cx:t,cy:i,r:7};u.getElementById(n)?u.circle(e):s.appendChild(u.circle(e))},_renderSegmentEndThumb:function(n,t,i,r,u,f){var s=u.getElementById(u.document.id+"handle_g"),e="#e2e2e2",o;f||(e="darkgray");o={id:n,"class":"segmentEnd",fill:e,stroke:"black","stroke-width":2,cx:t,cy:i,r:5};s.appendChild(u.circle(o))},_renderOrthogonalThumb:function(n,t,i,r,u,f,e){var o,s,h,l,c,a;f=="horizontal"?(o="M0,7 L15,0 L30,7 L15,14 z",s=-15,h=-7):(o="M7,0 L0,15 L7,30 L14,15 z",s=-7,h=-15);l=r.getElementById(r.document.id+"handle_g");c="#e2e2e2";e||(c="darkgray");a={id:n,"class":"segmentEnd",fill:c,stroke:"black","stroke-width":1,d:o,transform:"translate("+(t+s)+","+(i+h)+")",visibility:u};l.appendChild(r.path(a))},_renderBezierLine:function(n,t,i,r,u){var f=u.line({id:n,x1:t.x*r,y1:t.y*r,x2:i.x*r,y2:i.y*r,stroke:"black","stroke-width":1,"stroke-dasharray":"3,3",fill:"none"}),e=u.getElementById(u.document.id+"handle_g");e.appendChild(f)},_renderControlPointCorner:function(n,t,i,r){var u=r.g({"class":n}),f;r.getElementById(r.document.id+"handle_g").appendChild(u);f={id:n+"_"+i,fill:"white",stroke:"black","stroke-width":2,cx:t.x,cy:t.y,r:5};u.appendChild(r.circle(f))},updateSelector:function(n,i,r,u,f){var o,s,e,l,c,h;if(n)if(o=n.width?n.width:n._width,s=n.height?n.height:n._height,n.segments)this._updateEndPointHandle(n,i,r),f&t.datavisualization.Diagram.SelectorConstraints.UserHandles&&this.updateUserHandles(u.model.selectedItems.userHandles,n,i,!1,!1,r,u);else if(n.type==="phase")e=u._getPhaseBounds(n),i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible",transform:"translate("+e.x*r+","+e.y*r+"),rotate(0,"+e.width/2*r+","+e.height/2*r+")"}),i.rect({id:"phaseSelector","class":"phaseSelector","stroke-width":2,"stroke-dasharray":"3,3","pointer-events":"none",width:e.width<0?1:e.width*r,height:e.height<0?1:e.height*r,fill:"transparent",stroke:"red"});else if(n.isSwimlane||n.isLane||(l=i.g({id:i.document.id+"handle_g",transform:"translate("+(n.offsetX-o*n.pivot.x)*r+","+(n.offsetY-s*n.pivot.y)*r+"),rotate("+n.rotateAngle+","+o*n.pivot.x*r+","+s*n.pivot.y*r+")"})),c=u.getObjectType(n),c!=="group"&&n.type!=="pseudoGroup"&&(u.activeTool.name=="move"||u.activeTool.name=="rotate")&&u.activeTool.inAction||this._updateResizeHandle(n,i,r,f),u.activeTool.name=="rotatetool"&&u.activeTool.inAction&&this.renderPivotPoint(n,r,i),u.model.selectedItems.userHandles&&u.model.selectedItems.userHandles.length>0&&(h=!1,u.selectionList[0]&&u.selectionList[0].name=="multipleSelection"&&(h=!0),f&t.datavisualization.Diagram.SelectorConstraints.UserHandles))return this.updateUserHandles(u.model.selectedItems.userHandles,n,i,h,!1,r,u),!0},_updatePhaseResize:function(n,i,r){var e,u=[],o,f=t.datavisualization.Diagram.Util.bounds(n);e;u=[];u.push({x:f.topLeft.x*r,y:f.topLeft.y*r});u.push({x:f.bottomLeft.x*r,y:f.bottomLeft.y*r});e=this._convertToSVGPoints(u);o={id:"w-resize",points:e};i.polyline(o);e;u=[];u.push({x:f.topLeft.x*r,y:f.topLeft.y*r});u.push({x:f.topRight.x*r,y:f.topRight.y*r});e=this._convertToSVGPoints(u);o={id:"n-resize",points:e};i.polyline(o);e;u=[];u.push({x:f.topRight.x*r,y:f.topRight.y*r});u.push({x:f.bottomRight.x*r,y:f.bottomRight.y*r});e=this._convertToSVGPoints(u);o={id:"e-resize-hitTest",points:e};i.polyline(o);o={id:"e-resize",points:e};i.polyline(o);e;u=[];u.push({x:f.bottomLeft.x*r,y:f.bottomLeft.y*r});u.push({x:f.bottomRight.x*r,y:f.bottomRight.y*r});e=this._convertToSVGPoints(u);o={id:"s-resize-hitTest",points:e};i.polyline(o);o={id:"s-resize",points:e};i.polyline(o)},_updateResizeHandle:function(n,i,r,u){if(n.isSwimlane||n.isLane)this._updatePhaseResize(n,i,r,u);else{var f=n.width?n.width:n._width,e=n.height?n.height:n._height,s=n._corners,o=t.datavisualization.Diagram.Point(f*n.pivot.x,-20/r);u&t.datavisualization.Diagram.SelectorConstraints.Rotator&&n.type!="umlclassifier"&&(this._updateRotateHandle("rotate",o.x,o.y,r,i,n),this._updatePivotLine(n,i,r));u&t.datavisualization.Diagram.SelectorConstraints.Resizer&&(n.type!="umlclassifier"&&(this._updateResizeCorner("nw-resize",0,0,i),this._updateResizeCorner("n-resize",f/2*r,0,i),this._updateResizeCorner("ne-resize",f*r,0,i),this._updateResizeCorner("w-resize",0,e/2*r,i),this._updateResizeCorner("e-resize",f*r,e/2*r,i),this._updateResizeCorner("sw-resize",0,e*r,i),this._updateResizeCorner("s-resize",f/2*r,e*r,i),this._updateResizeCorner("se-resize",f*r,e*r,i)),this._updateResizeBorder("resizeBorder",n,i,r))}},_updateRotateHandle:function(n,t,i,r,u){var f=20,e=20,o={id:"rotatehandle",transform:"translate("+(t*r-f/2)+","+(i*r-e)+")"};u.path(o);u.circle({id:"rotate",transform:"translate("+(t*r-f/2)+","+(i*r-e)+")"})},_updatePivotLine:function(n,i,r,u){var f=n.width?n.width:n._width,s=n.height?n.height:n._height,o=t.datavisualization.Diagram.Point(f*n.pivot.x,-20/r),e,h;e=u?t.datavisualization.Diagram.Point(f*n.pivot.x,s*n.pivot.y):t.datavisualization.Diagram.Point(f*n.pivot.x,0);h=i.line({id:"pivotLine",x1:o.x*r,y1:o.y*r,x2:e.x*r,y2:e.y*r})},_updateResizeBorder:function(n,i,r,u){var f=i.width?i.width:i._width,e=i.height?i.height:i._height,o;i.type=="umlclassifier"?o=t.datavisualization.Diagram.ClassifierHelper.renderResizeBorder(n,i,r,u):r.rect({id:n,width:f*u,height:e*u})},_updateResizeCorner:function(n,t,i,r){var u={id:n,cx:t,cy:i};r.circle(u);u={id:n+"_transparent",cx:t,cy:i};r.circle(u)},_updateEndPointHandle:function(n,i,r){for(var u,e,o=t.datavisualization.Diagram.Util.canDragSegmentThumbs(n),f=0;f<n.segments.length;f++)u=n.segments[f],e=u.points,f==n.segments.length-1?(this._updateEndPointCorner("targetEndPoint",e[e.length-1].x*r,e[e.length-1].y*r,t.datavisualization.Diagram.Util.isTargetConnected(n),i,t.datavisualization.Diagram.Util.canDragTargetEnd(n)),u.type=="orthogonal"&&this._updateTerminalOrthoThumbs(u,i,r,f,o)):u.type!="orthogonal"?this._updateSegmentEndThumb("segmentEnd_"+f,u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)):this._updateTerminalOrthoThumbs(u,i,r,f,o),f==0&&this._updateEndPointCorner("sourceEndPoint",e[0].x*r,e[0].y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)),u.type=="bezier"&&(this._updateEndPointCorner("bezierpoint1_"+f,u._point1.x*r,u._point1.y*r,!1,i,o),this._updateEndPointCorner("bezierpoint2_"+f,u._point2.x*r,u._point2.y*r,!1,i,o),this._updateBezierLine("bezierline1_"+f,u._startPoint,u._point1,r,i),this._updateBezierLine("bezierline2_"+f,u._endPoint,u._point2,r,i))},_updateEndPointCorner:function(n,t,i,r,u,f){var e=r?"#8CC63F":"white",o;f||(e="darkgray");o={id:n,fill:e,cx:t,cy:i};u.circle(o)},_updateSegmentEndThumb:function(n,t,i,r,u){var f={id:n,cx:t,cy:i};u.circle(f)},_updateOrthoThumb:function(n,t,i,r,u,f,e){var c="#e2e2e2",o,s,h,l;e||(c="darkgray");f=="horizontal"?(o="M0,7 L15,0 L30,7 L15,14 z",s=-15,h=-7):(o="M7,0 L0,15 L7,30 L14,15 z",s=-7,h=-15);l={id:n,visibility:u,transform:"translate("+(t+s)+","+(i+h)+")",d:o,fill:c};r.path(l)},_updateTerminalOrthoThumbs:function(n,i,r,u,f){var o,e,h,s;if(n.points.length>2)for(e=0;e<n.points.length-1;e++)s=t.datavisualization.Diagram.Geometry.distance(n.points[e],n.points[e+1]),o=n.points[e].y.toFixed(2)==n.points[e+1].y.toFixed(2)?"horizontal":"vertical",h=s>=50?"visible":"hidden",this._updateOrthoThumb("OrthoThumb_"+e+"_"+u,(n.points[e].x+n.points[e+1].x)/2*r,(n.points[e].y+n.points[e+1].y)/2*r,i,h,o,f);else s=n.length||t.datavisualization.Diagram.Geometry.distance(n._startPoint,n._endPoint),o=n._startPoint.y.toFixed(2)==n._endPoint.y.toFixed(2)?"horizontal":"vertical",h=s>=50?"visible":"hidden",this._updateOrthoThumb("OrthoThumb_"+u,(n._endPoint.x+n._startPoint.x)/2*r,(n._endPoint.y+n._startPoint.y)/2*r,i,h,o,f)},_updateBezierLine:function(n,t,i,r,u){var f=u.line({id:n,x1:t.x*r,y1:t.y*r,x2:i.x*r,y2:i.y*r})},_updateControlPointCorner:function(n,t,i,r){r.circle({id:n+"_"+i,cx:t.x,cy:t.y})},updateUserHandles:function(n,i,r,u,f,e,o){var h=r.document.getElementById(r.document.id+"userHandle_g"),s;if(o.model.selectedItems.constraints&t.datavisualization.Diagram.SelectorConstraints.UserHandles)if(h){if(n&&n.length>0)for(s=0;s<n.length;s++)(u&&n[s].enableMultiSelection||!u)&&this._updateHandle(n[s],i,r,f,e,o)}else this.renderUserHandles(n,i,r,u,e,o._adornerLayer,o)},_updateHandle:function(n,i,r,u,f,e){var s,o,h,c;!u&&i&&n.visible?(s=this._getHandlePosition(n,i,f,null,e),o=n._absolutePath,o&&n.size==n._size||(o=n._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(0,0,n.size/2,n.size/2,n.pathData,r)),n._size=n._size,h=s.x*f,c=s.y*f,this._updateHandleShape(n,h,c,r),this._updateHanleIcon(n,o,r,h-n.size/4,c-n.size/4),r.getElementById(n.name+"_shape")&&n.visible&&(r.getElementById(n.name+"_shape").style.display="block",r.getElementById(n.name+"_icon").style.display="block")):r.getElementById(n.name+"_shape")&&(r.getElementById(n.name+"_shape").style.display="none",r.getElementById(n.name+"_icon").style.display="none")},clearSelector:function(n,t){var i=n.getElementById(n.document.id+"handle_g");i&&t.removeChild(i);i=n.getElementById(n.document.id+"userHandle_g");i&&t.removeChild(i)},clearSegments:function(t){var i=t.getElementById(t.document.id+"handle_g");n(i).find(".segmentEnd").remove()},addSegments:function(n,t,i){var r=n.getElementById(n.document.id+"handle_g");this._renderSegmentHandle(t,n,i)},_renderSegmentHandle:function(n,i,r){var e,f,u,o;if(!n.isPhase)for(e=t.datavisualization.Diagram.Util.canDragSegmentThumbs(n),f=0;f<n.segments.length;f++)u=n.segments[f],u.type=="bezier"&&(this._renderBezierLine("bezierline1_"+f,u._startPoint,u._point1,r,i,e),this._renderBezierLine("bezierline2_"+f,u._endPoint,u._point2,r,i,e),this._renderEndPointCorner("bezierpoint1_"+f,u._point1.x*r,u._point1.y*r,!1,i,e),this._renderEndPointCorner("bezierpoint2_"+f,u._point2.x*r,u._point2.y*r,!1,i,e)),o=u.points,f===0||f===n.segments.length-1||(u.type!="orthogonal"?this._renderSegmentEndThumb("segmentEnd_"+f,u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)):this._renderTerminalOrthoThumbs(u,i,r,f,e))},_initializePageBreaks:function(n,t,i){var r=n.g(t);return i.appendChild(r),r},_renderVPageBreakLine:function(n,t,i,r){var u=i.line({x1:n.x,y1:n.y,x2:t.x,y2:t.y,style:"stroke:#aaaaaa;stroke-width:1;stroke-dasharray:10,10 "});r.appendChild(u)},_renderPageSettingsRect:function(n,t,i,r,u,f,e){var o=i.rect({id:"pageback",x:n.x,y:n.y,width:t.x,height:t.y,style:"fill:"+f+";stroke:"+u+";stroke-width:"+e+""});r.appendChild(o)},_updatePageBakground:function(n,i,r,u,f,e,o){var s=r.document.getElementById("pageback"),h={x:n.x,y:n.y,width:i.x<0?0:i.x,height:i.y<0?0:i.y,style:"fill:"+e+";stroke:"+f+";stroke-width:"+o+""};s&&t.datavisualization.Diagram.Util.attr(s,h)},_renderHPageBreakLine:function(n,t,i,r){var u=i.line({x1:n.x,y1:n.y,x2:t.x,y2:t.y,style:"stroke:#aaaaaa;stroke-width:1;stroke-dasharray:10,10 "});r.appendChild(u)},_removePageBreaks:function(n,t,i){t!=null&&i!=null&&i.removeChild(t)},removeChild:function(n,t){var r=t.svg.document.getElementById(n.name),u=t.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],f=this._findChild(u.childNodes,n),i;r&&r.parentNode.removeChild(r);f&&u.removeChild(f);n._type==="node"&&n.type==="html"&&(i=u.children[n.name+"_parentdiv"],i&&i.parentNode&&i.parentNode.removeChild(i))}};t.datavisualization.Diagram.DiagramContext={_renderNodes:function(n,t,i,r){var f,u,e,o,s;if(r.nodes())for(f=r.nodes(),u=0,e=f.length;u<e;++u)o=r.nameTable[f[u].name],s=n.svg||n._canvas,this._renderNodeObject(o,n,t,i,r)},_renderNodeObject:function(n,i,r,u,f){var e=i.svg||i._canvas;n._type!=="group"||n.parent?n.parent||i.context.renderNode(n,e,i.diagramLayer,null,f):(!n.container,i.context.renderGroup(n,e,i.diagramLayer,f.nameTable,f,r,u),t.datavisualization.Diagram.DiagramContext.update(n,f))},_renderConnectors:function(n,t){var r,e,u,i,f;if(t.connectors()){for(r=t.connectors(),e=n.svg||n._canvas,i=0,f=r.length;i<f;++i)u=r[i],t._setZorder(u);for(i=0,f=r.length;i<f;++i)u=r[i],this._renderConnectorObject(u,n,t)}},_renderConnectorObject:function(n,i,r){var u=i.svg||i._canvas;t.datavisualization.Diagram.Util.updateBridging(n,r);n.parent||i.context.renderConnector(n,u,i.diagramLayer,r)},updateViewPort:function(n){var i;n._views.forEach(function(r){i=n._views[r];i.context==t.datavisualization.Diagram.SvgContext&&i.type=="mainview"&&t.datavisualization.Diagram.PageUtil._updatePageSize(n)})},renderNode:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;i&&(i=u.document.getElementById(i.id));r.context.renderNode(n,u,i||r.diagramLayer,undefined,t)})},addLabel:function(n,t,i,r){var u,f;i._views&&i._views.forEach(function(e){u=i._views[e];f=u.svg||u.canvas;u.context._addLabel(n,t,f,i,r)})},renderPort:function(n,t,i){var r,u;i._views.forEach(function(f){r=i._views[f];u=r.svg||r._canvas;r.context._insertPort(n,t,u)})},renderConnector:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;r.context.renderConnector(n,u,i||r.diagramLayer,t)})},renderGroup:function(n,t,i){var r,u;t._views.forEach(function(f){var e;r=t._views[f];u=r.svg||r._canvas;i=r.svg.getElementById(n.parent);r.type=="overview"&&(e=!0);r.context.renderGroup(n,u,i||r.diagramLayer,t.nameTable,t,null,e)})},update:function(n,t,i){var f=!0,r,u;n.isSwimlane&&t._disableSwimlaneUptate&&(f=!1);f&&t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;t&&!t._isInit&&n._status!=="new"&&(n._status="update");n._type==="group"||n.type==="pseudoGroup"?r.context.updateGroup(n,u,t,i):n.segments?r.context.updateConnector(n,u,t):r.context.updateNode(n,u,t,i)})},_refreshSegments:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;n.segments&&i.context._refreshSegments(n,r,t)})},_refreshOnlySegments:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;n.segments&&i.context._refreshOnlySegments(n,r,t)})},renderShadow:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i._canvas;i.context._renderShadow(n,r)})},updateShadow:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i._canvas;i.context._updateShadow(n,r)})},removeShadow:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i._canvas;i.context._removeShadow(n,r)})},addNodeLabel:function(n,t,i,r){var u,f;r._views&&r._views.forEach(function(e){u=r._views[e];f=u.svg||u.canvas;u.context.addNodeLabel(n,t,f,i,r)})},updateLabel:function(n,i,r){var u,f;r._views.forEach(function(e){u=r._views[e];f=u.svg||u.canvas;r.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg?u.context._updateSVGLabel(n,i,f,r):u.context.updateLabel(n,i,f,r)})},updatePort:function(n,t,i){var r,u;i._views.forEach(function(f){r=i._views[f];u=r.svg||r.canvas;r.context.updatePort(n,t,u,i)})},setNodeShape:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r.canvas;r.context.setNodeShape(n,u,i,t)})},setLine:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r.canvas;r.context.setLine(n,u,i,t)})},renderDecorators:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.renderDecorators(n,r,t)})},clearDecorators:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.clearDecorators(n,r,t)})},updateTargetDecoratorStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.updateTargetDecoratorStyle(n,r)})},updateSourceDecoratorStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.updateSourceDecoratorStyle(n,r)})},updateNodeStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context._updateNodeStyle(n,r)})},updateLabelStyle:function(n,t,i){i._views.forEach(function(r){var u=i._views[r],f=u.svg||u.canvas;u.context.updateLabelStyle(n,t,f,i)})},updateConnectorStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context._updateConnectorStyle(n,r)})},updateTextBlock:function(n,t,i){var r,u;i._views.forEach(function(f){r=i._views[f];u=r.svg||r.canvas;r.context.updateTextBlock(n,t,u,i)})},updateBPMNNodeStyle:function(n,i){var f,u,r=0;if(n=t.datavisualization.Diagram.Util._updateBpmnChild(n,i),n.children)for(u=i._getChildren(n.children),r=0;r<u.length;r++)f=i.nameTable[u[r]],t.datavisualization.Diagram.DiagramContext.updateNodeStyle(f,i,n);else t.datavisualization.Diagram.DiagramContext.updateNodeStyle(n,i)},updateBPMNNodeShape:function(n,i){var f,r,u=0,e;if(n=t.datavisualization.Diagram.Util._updateBpmnChild(n,i),r=i._getChildren(n.children),r.length>0&&i.nameTable[r[0]])for(u=0;u<r.length;u++)f=i.nameTable[r[u]],f&&t.datavisualization.Diagram.DiagramContext.setNodeShape(f,i,n);else e=i._svg.getElementById(n.name),e.parentNode.removeChild(e),i.add(n)}}}(jQuery,Syncfusion),function(n,t,i){"use strict";t.widget("ejSymbolPalette","ej.datavisualization.SymbolPalette",{element:null,model:null,_requiresID:!0,nameTable:{},defaults:{width:"250px",height:"400px",labelRenderingMode:"html",paletteItemWidth:i,paletteItemHeight:i,previewWidth:i,previewHeight:i,previewOffset:{x:110,y:110},diagramId:"",headerHeight:30,selectedPaletteName:"",cssClass:"e-datavisualization-symbolpalette",showPaletteItemText:!0,allowDrag:!0,palettes:[],defaultSettings:{connector:null,node:null},selectionChange:null,create:null,destroy:null},_oldItem:null,_labelHashTable:{},dataTypes:{paletteItemWidth:"number",paletteItemHeight:"number",previewWidth:"number",previewHeight:"number",headerHeight:"number",showPaletteItemText:"boolean",allowDrag:"boolean",palettes:"array"},_canvas:null,_init:function(){t.browserInfo().name==="msie"&&Number(t.browserInfo().version)<9||(this.nameTable={},this.selectedItem=null,this.activePalette=null,this._selectedElement=null,this._renderSymbolPalette(),this._wireEvents(),this.updateScrollerViewport())},_setModel:function(t){var i,r;for(i in t)switch(i){case"width":this._setWidth(t[i]);break;case"height":this._setHeight(t[i]);break;case"paletteItemWidth":this.model.paletteItemWidth=t[i];this._redrawContent();break;case"paletteItemHeight":this.model.paletteItemHeight=t[i];this._redrawContent();break;case"headerHeight":this._setHeaderHeight(t[i]);break;case"cssClass":this._setCssClass(t[i]);break;case"showPaletteItemText":this._showItemText(t[i]);break;case"allowDrag":this._setAllowDrag(t[i]);break;case"palettes":this._updatePalettes(t[i]);break;case"selectedPaletteName":r=this._getPalette(t.selectedPaletteName);r&&r!==this.activePalette&&(n(document.getElementById(this.activePalette.name+"_header")).removeClass("selected"),this.activePalette=r,n(document.getElementById(this.activePalette.name+"_header")).addClass("selected"))}},_destroy:function(){this.element.empty().removeClass(this.model.cssClass)},_renderSymbolPalette:function(){this._canvas=document.createElement("div");this._canvas.setAttribute("class","e-scanvas");this._canvas.setAttribute("id",this.element[0].id+"_canvas");this.element[0].setAttribute("style","height:"+this.model.height+"; width:"+this.model.width+";");this.element.append(this._canvas);this.element.ejScroller({width:this._setViewPortWidth(),height:this._setViewPortHeight(),enableTouchScroll:!1});this._renderPalettes()},_updatePalettes:function(t){this.model.palettes=t;n("#"+this.element[0].id+"_canvas").empty();this._renderPalettes();this.updateScrollerViewport()},_renderPalettes:function(){var i=this.model.palettes,n,r;if(i)for(n=0,r=i.length;n<r;n++)i[n]=t.datavisualization.Diagram.Palette(i[n]),this._initPaletteitems(i[n]),this._renderPalette(i[n])},_updatePaletteItemWidth:function(n){var i=t.datavisualization.Diagram.Util.bounds(n);n.segments?i.width>this.element.width()-40&&!n.paletteItem&&t.datavisualization.Diagram.Util.scale(n,(this.element.width()-45)/i.width,1,i.center):n.width>this.element.width()-40?n.width=this.element.width()-40:n.paletteItem&&n.paletteItem.width&&n.paletteItem.width>this.element.width()-40&&(n.paletteItem.width=this.element.width()-40)},_renderHtmlLayer:function(n,i){var r=document.createElement("div"),f={id:n.id+"_htmlLayer","class":"htmlLayer"},u;return t.datavisualization.Diagram.Util.attr(r,f),u=r,r.style.pointerEvents="none",r.style.position="absolute",r.style.left=i?i.style.paddingLeft:"0px",r.style.top=i?i.style.paddingTop:"0px",n.appendChild(u),u},_initPaletteitems:function(n){if(n.items)for(var t=0;t<n.items.length;t++)n.items[t]=this._extendPaletteItem(n.items[t])},_initGroupNode:function(i){for(var r=null,f=this.model.defaultSettings&&this.model.defaultSettings.node?this.model.defaultSettings.node:null,e=this.model.defaultSettings&&this.model.defaultSettings.connector?this.model.defaultSettings.connector:null,u=0;u<i.children.length;u++)r=i.children[u],typeof r=="object"&&(r._type=="group"?(r=t.datavisualization.Diagram.Group(n.extend(!0,{},f,r)),r=t.datavisualization.Diagram.Util._updateBpmnChild(r,this),this._initGroupNode(r)):r=r.segments?t.datavisualization.Diagram.Connector(n.extend(!0,{},e,r)):t.datavisualization.Diagram.Node(n.extend(!0,{},f,r)),r=t.datavisualization.Diagram.NodeType(r,this),r.parent=i.name,i.children[u]=r.name,this.nameTable[r.name]=r)},_setViewPortWidth:function(){this.element[0].setAttribute("style","width:"+this.model.width+";");var n=this.element.width();return Math.abs(n)},_setViewPortHeight:function(){this.element[0].setAttribute("style","height:"+this.model.height+";");var n=this.element.height();return Math.abs(n)},_renderPalette:function(n){this._renderHeader(n);this._updateHeaderWrapper(n,this.model.headerHeight);this._renderContent(n);this._collapse(n);this._updatePaletteVisibility(n)},_renderHeader:function(i){var r=document.createElement("div"),u={id:i.name+"_header","class":"e-header",style:"height:"+this.model.headerHeight+"px;"};i.constraints&this._canHeaderVisible(i)||(u.style+="display:none");t.datavisualization.Diagram.Util.attr(r,u);this._renderHeaderArrow(r,i.expanded,i.name,this._canExpand(i));i.templateId&&n.templates?this._renderHeaderTemplate(r,i):this._renderHeaderText(r,i.name);this._addExpandedClass(r,i.expanded);this._disableClickClass(r,this._canExpand(i));this.model.selectedPaletteName===i.name&&(n(r).addClass("selected"),this.activePalette=i);this._canvas.appendChild(r)},_renderHeaderText:function(n,t){var i=document.createElement("span");i.setAttribute("class","e-header-text");i.innerHTML=t;n.appendChild(i)},_renderHeaderTemplate:function(n,i){var u=this._renderEjTemplate("#"+i.templateId,i),r=document.createElement("div"),f={id:i.name+"_Wrapper","class":"e-header-wrapper"};t.datavisualization.Diagram.Util.attr(r,f);this._renderTemplateContent(i,r,u);n.appendChild(r)},_renderTemplateContent:function(i,r,u){var f=document.createElement("div"),e;f.innerHTML=u;f.style.display="inline-block";document.body.appendChild(f);e=f.cloneNode(!0);e.id=i.name+"_templateHeader";var o=f.offsetWidth,h=f.offsetHeight,c=n("#"+this._id).width()-18/o,l=this.model.headerHeight/h,s=Math.min(c,l),a=(s-1)*o/2;t.datavisualization.Diagram.Util.attr(e,{style:"position: relative; left: "+a+"px; transform: scale("+s+")"});r.appendChild(e);f.parentNode.removeChild(f)},_renderHeaderArrow:function(t,i,r,u){var f,e;u?(f=t.getElementsByClassName("e-header-arrow e-icon")[0],f||(f=document.createElement("span"),f.setAttribute("class","e-header-arrow e-icon"),f.setAttribute("style","top:"+(this.model.headerHeight-16)/2+"px;"),this._addExpandedClass(f,i),this.model.selectedPaletteName===name&&n(f).addClass("selected"),t.appendChild(f))):(e=t.getElementsByClassName("e-header-arrow e-icon")[0],e&&e.parentNode.removeChild(e))},_renderContent:function(n){var r=document.getElementById(n.name+"_content"),t,i,u;if(r||(r=document.createElement("div"),this._canvas.appendChild(r)),r.setAttribute("id",n.name+"_content"),r.setAttribute("class","e-scontent"),this.model.palettes.length-1===this.model.palettes.indexOf(n)&&r.setAttribute("style","border-bottom-width: 0px;"),t=n.items,t&&t.length>0)for(i=0,u=t.length;i<u;i++)t[i].parent?this.nameTable[t[i].name]=t[i]:(this._renderItem(t[i],r),this.nameTable[t[i].name]=t[i])},_updateRenderSize:function(n,i,r){var f,e,u;if(n.paletteItem&&(n.type!=="group"||n.isLane)&&(n._type!=="group"||n.type!=="bpmn"))if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase){var u=t.datavisualization.Diagram.Util.bounds(n),o=(n.paletteItem.width?n.paletteItem.width:this.model.paletteItemWidth)/u.width,s=(n.paletteItem.height?n.paletteItem.height:this.model.paletteItemHeight)/u.height;t.datavisualization.Diagram.Util.scale(n,o,s,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase||n.isPhase&&n.paletteItem.width!=n.paletteItem.height){var u=t.datavisualization.Diagram.Util.bounds(n),o=(n.paletteItem.width?n.paletteItem.width:this.model.paletteItemWidth)/u.width,s=(n.paletteItem.height?n.paletteItem.height:this.model.paletteItemHeight)/u.height;t.datavisualization.Diagram.Util.scale(n,o,s,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else n._type=="node"&&this._checkItemUpdate(n)&&(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2);else n.segments?(u=t.datavisualization.Diagram.Util.bounds(n),t.datavisualization.Diagram.Util._translate(n,i.width/2-u.center.x,i.height/2-u.center.y,this.nameTable)):n._type=="group"?this._checkItemUpdate(n)?(f=i.width/n.width,e=i.height/n.height,this.scale(n,f,e,n.pivot,r,null,null,null,this),t.datavisualization.Diagram.Util._translate(n,i.width/2-n.offsetX,i.height/2-n.offsetY,r,null,this)):t.datavisualization.Diagram.Util._translate(n,n.width/2-n.offsetX,n.height/2-n.offsetY,r,null,this):(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2)},_checkItemUpdate:function(n){return(n.paletteItem&&n.paletteItem.enableScale)?!1:!0},_updatePreviewSize:function(n,i){var u,f,r;if(n.paletteItem&&(n.type!=="group"||n.isLane))if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase){var r=t.datavisualization.Diagram.Util.bounds(n),e=(n.paletteItem.previewWidth?n.paletteItem.previewWidth:this.model.previewWidth)/r.width,o=(n.paletteItem.previewHeight?n.paletteItem.previewHeight:this.model.previewHeight)/r.height;t.datavisualization.Diagram.Util.scale(n,e,o,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase||n.isPhase&&n.paletteItem.previewWidth!=n.paletteItem.previewHeight){var r=t.datavisualization.Diagram.Util.bounds(n),e=(n.paletteItem.previewWidth?n.paletteItem.previewWidth:this.model.previewWidth)/r.width,o=(n.paletteItem.previewHeight?n.paletteItem.previewHeight:this.model.previewHeight)/r.height;t.datavisualization.Diagram.Util.scale(n,e,o,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else(n._type=="node"||n._type=="group")&&(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2);else n.segments?(r=t.datavisualization.Diagram.Util.bounds(n),t.datavisualization.Diagram.Util._translate(n,i.width/2-r.center.x,i.height/2-r.center.y,this.nameTable)):n.container&&!n.isLane?(u=i.width/n.width,f=i.height/n.height,this.scale(n,u,f,n.pivot,this.nameTable,null,null,null,this),t.datavisualization.Diagram.Util._translate(n,i.width/2-n.offsetX,i.height/2-n.offsetY,this.nameTable,null,this)):(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2)},_getRenderItemSize:function(n){var i=this.model.paletteItemWidth,r=this.model.paletteItemHeight,o,s,f,e,u;return n.segments?(u=t.datavisualization.Diagram.Util.bounds(n),n.paletteItem?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:n.width,r=r?r:n.height,n.paletteItem.width=i,n.paletteItem.height=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=i?i:u.width,r=r?r:u.height)):n.type==="group"?(u=t.datavisualization.Diagram.Util._getChildrenBounds(n,this),n.paletteItem&&!n.isLane?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.width=i,n.paletteItem.height=r):n.paletteItem&&n.isLane?n.paletteItem.enableScale?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.width=i,n.paletteItem.height=r):(o=(n.paletteItem.width?n.paletteItem.width:this.model.paletteItemWidth)/n.width,s=(n.paletteItem.height?n.paletteItem.height:this.model.paletteItemHeight)/n.height,t.datavisualization.Diagram.Util.scale(n,o,s,{x:.5,y:.5},this.nameTable,!1,!1,!1,this),f=.0001,e=.001,n.isLane&&n.paletteItem&&!n.paletteItem.enableScale&&(n.orientation==="horizontal"?f-=2.2:f+=.8,e-=1),t.datavisualization.Diagram.Util._translate(n,f,e,this.nameTable,!1,this),i=n.width?n.width:i,r=n.height?n.height:r):(i=i?i:u.width,r=r?r:u.height)):n.paletteItem?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:n.width,r=r?r:n.height,n.paletteItem.width=i,n.paletteItem.height=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=u.width?u.width:i,r=u.height?u.height:r),{width:i,height:r}},_renderPetternDefinition:function(n,t){if(n&&t){var i=t.document.getElementById(n+"patterndefinition");i||(i=t.defs({id:n+"patterndefinition"}),t.appendChild(i))}},_renderItem:function(t,i){for(var f,r=n.extend(!0,{},t),u=this._getRenderItemSize(r),o=[],e=0;t.children&&e<t.children.length;e++)o[t.children[e]]=n.extend(!0,{},this.nameTable[t.children[e]]);return this._updateRenderSize(r,u,o),f=this._renderItemContainer(r.name,i,null,u,r),r.segments?this._renderConnector(r,f,u):r._type!="node"||r.children&&r.children.length>0?this._renderGroup(r,f,u,o):this._renderNode(r,f,u),r.isLane&&r.paletteItem&&!r.paletteItem.enableScale&&r.orientation==="vertical"&&f.document.setAttribute("height",u.height+2),r},_getPreviewItemSize:function(n){var i=this.model.previewWidth,r=this.model.previewHeight,u;return n.segments?(u=t.datavisualization.Diagram.Util.bounds(n),n.paletteItem?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:n.width,r=r?r:n.height,i=i?i:u.width,r=r?r:u.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=i?i:u.width,r=r?r:u.height)):n.type==="group"?(u=t.datavisualization.Diagram.Util._getChildrenBounds(n,this),n.paletteItem&&!n.isLane?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):n.paletteItem&&n.isLane?n.paletteItem.enableScale?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r):(i=i?i:u.width,r=r?r:u.height)):n.paletteItem?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:n.width,r=r?r:n.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=u.width?u.width:i,r=u.height?u.height:r),{width:i,height:r}},_renderItemContainer:function(n,i,r,u,f){var e=document.createElement("div"),o=this.model.showPaletteItemText?u.height+18:u.height,s=u.width,h=f&&f.paletteItem?f.paletteItem.margin.left:4,c=f&&f.paletteItem?f.paletteItem.margin.top:4,l=f&&f.paletteItem?f.paletteItem.margin.right:4,a=f&&f.paletteItem?f.paletteItem.margin.bottom:4,v={id:n+"_paletteItem",draggable:"true",height:o+"px",width:s+"px","class":"e-paletteItem",style:"padding-left:"+h+"px;padding-right:"+(l+2)+"px;padding-top:"+(c+1)+"px;padding-bottom:"+(a+1)+"px;height:"+(o+1)+"px;width:"+(s+1)+"px;-ms-touch-action: none;touch-action: none;"};return t.datavisualization.Diagram.Util.attr(e,v),i.appendChild(e),this.model.allowDrag&&this._setItemDraggable(e),this._renderAnchor(e,n,u,f)},_renderAnchor:function(n,i,r,u){var f=document.createElement("div"),o={id:i+"_anchor",height:r.height+"px","class":"e-anchor"},e;return t.datavisualization.Diagram.Util.attr(f,o),n.appendChild(f),e=this._renderSvg(f,i,r),this._renderText(f,i,r,u),e},_renderSvg:function(i,r,u){var s,f=document.createElement("div"),e={id:r+"_svgWrapper",width:this.model.paletteItemWidth+"px;",height:+this.model.paletteItemHeight+"px;","class":"e-svg-container",style:"width:"+u.width+"px;height:"+u.height+"px;"},o;return t.datavisualization.Diagram.Util.attr(f,e),e={id:r+"_svg",width:u.width,height:u.height,version:"1.1",xlink:"http://www.w3.org/1999/xlink"},o=new t.datavisualization.Diagram.Svg(e),f.appendChild(o.document),i.id.split("_clone").length>1&&(s=n(i).parents(".e-paletteItem")[0]),this._renderHtmlLayer(f,s),i.appendChild(f),o},_renderText:function(n,i,r,u){var e=document.createElement("div"),f,o,s;e.setAttribute("class","e-text-container");e.setAttribute("style","width:"+r.width+"px; text-align : center;overflow: hidden;text-overflow: ellipsis;font-size: 12px;");f=document.createElement("span");f.setAttribute("class","e-paletteItemText");u&&u.paletteItem&&(i=u.paletteItem.label?u.paletteItem.label:i);f.innerHTML=i.split("_clone").length>1?i.split("_clone")[0]:i;u&&u.paletteItem.wrapping==t.datavisualization.Diagram.TextWrapping.NoWrap&&(f.style.whiteSpace="nowrap",f.style.wordWrap="normal");u&&u.paletteItem.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap&&(f.style.whiteSpace="pre-wrap",f.style.wordBreak="break-all",f.style.wordWrap="break-word");u&&u.paletteItem.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow&&(f.style.whiteSpace="pre-wrap",f.style.wordWrap="break-word");e.appendChild(f);this.model.showPaletteItemText||(e.style.display="none");n.appendChild(e);u&&!u.paletteItem.enableScale&&(o=document.getElementById(u.name+"_paletteItem"),s=document.getElementById(u.name+"_anchor").lastChild.getBoundingClientRect(),o.style.height=r.height+s.height+"px")},_renderNode:function(n,i,r){this._renderPetternDefinition(i.id+"_"+n.name,i);var f=t.datavisualization.Diagram.SvgContext.renderNode(n,i,null,!0,this),u=!1;i.document.getAttribute("drag")!=null&&(u=!0);this._transformItem(f,n.width,n.height,n,u,r)},_updateChildBounds:function(n,i){var u=null,f,r;if(n._type=="group"){for(f=this._getChildren(n.children),r=0;r<f.length;r++)u=i[f[r]],u._type=="group"&&this._updateChildBounds(u,i);t.datavisualization.Diagram.Util._updateChildBounds(n,this)}},_getChildren:function(n){var i,r,t;if(n){for(i=[],r=0;r<n.length;r++)t=n[r],t&&(typeof t=="object"?i.push(t.name):typeof t=="string"&&i.push(t));return i}},_renderGroup:function(n,i,r,u){this._renderPetternDefinition(i.id+"_"+n.name,i);u||(u=this.nameTable);(!n.container||n.isLane)&&this._updateChildBounds(n,u);var e=t.datavisualization.Diagram.SvgContext.renderGroup(n,i,null,u,this,!1,!0),f=!1;i.document.getAttribute("drag")!=null&&(f=!0);this._transformItem(e,n.width,n.height,n,f,r)},_renderConnector:function(n,i,r){var e=t.datavisualization.Diagram.SvgContext.renderConnector(n,i,null,this),u=t.datavisualization.Diagram.Util.bounds(n),f=!1;i.document.getAttribute("drag")!=null&&(f=!0);this._transformItem(e,u.width,u.height,n,f,r)},_wireEvents:function(){this._on(this.element,t.eventType.click,".e-header",this._headerClick);this._on(this.element,t.eventType.mouseDown,".e-header",this._headerMouseDown);this._on(this.element,"mouseover",".e-header",this._headerMouseOver);this._on(this.element,"mouseout",".e-header",this._headerMouseOut);this._on(this.element,t.eventType.mouseDown,".e-paletteItem",this._itemMouseDown);this._on(this.element,"mouseover",".e-paletteItem",this._itemMouseOver);this._on(this.element,"mouseout",".e-paletteItem",this._itemMouseOut);this._on(this.element,t.eventType.click,".e-anchor",this._itemClick)},_headerClick:function(n){this._expandOrCollapsePalette("",n.currentTarget);var t=this._getActivePalette(n.currentTarget.id);t&&t!==this.activePalette&&(this.activePalette=t)},_headerMouseDown:function(n){n.preventDefault();n.stopPropagation()},_headerMouseOver:function(t){var i=this._getActivePalette(t.currentTarget.id);i&&this._canExpand(i)&&(n(t.currentTarget).addClass("hover"),n(t.currentTarget).find(".e-header-arrow").addClass("hover"))},_headerMouseOut:function(t){n(t.currentTarget).removeClass("hover");n(t.currentTarget).find(".e-header-arrow").removeClass("hover")},_itemMouseDown:function(i){var r,u,s,e,f,h,o;if(this.model.diagramId&&(r=n("#"+this.model.diagramId).ejDiagram("instance"),r.activeTool instanceof t.datavisualization.Diagram.LineTool&&(r.activeTool._showAllPorts(!0),r.deactivateTool())),this.model.allowDrag||(i.preventDefault(),i.stopPropagation()),this._selectedElement?this._selectedElement!==i.currentTarget&&(n(this._selectedElement).removeClass("selected"),this._selectedElement=i.currentTarget):this._selectedElement=i.currentTarget,n(i.currentTarget).hasClass("selected")||n(i.currentTarget).addClass("selected"),u=this._getActivePalette(i.currentTarget.parentElement.id),u&&u!==this.activePalette&&(this._clearHeaderSelection(),this._updateHeaderSelection(n(i.currentTarget.parentElement).prev()),this.activePalette=u),this.activePalette&&this._selectedElement)for(s=this._selectedElement.id.slice(0,this._selectedElement.id.lastIndexOf("_")),e=this.activePalette.items,f=0,h=e.length;f<h;f++)o=e[f],o.name===s&&(this.selectedItem=o)},_itemMouseOver:function(t){n(t.currentTarget).addClass("hover")},_itemMouseOut:function(t){n(t.currentTarget).removeClass("hover")},_itemDraStart:function(n){var t=n.originalEvent.dataTransfer;t.setData("Text",this.element[0].id);t.effectAllowed="copy"},_itemClick:function(i){var u,r,l,h,s,f,a,e,o,v,c,y;if((i.type==="click"||i.type==="touchend"&&!n(".dragClone")[0])&&this.model.diagramId){if(u=n("#"+this.model.diagramId).ejDiagram("instance"),r=n.extend(!0,{},this.selectedItem),r.name+=t.datavisualization.Diagram.Util.randomId(),r.type=="bpmn"&&(r.children=[]),l=u.getObjectType(r),l=="group"){for(h=this._getChildren(r.children),s=0;s<h.length;s++)f=n.extend(!0,{},this.nameTable[h[s]]),f.parent=r.name,f.name=r.name+f.name,r.children[s]=f.name,u.nameTable[f.name]=f,u.nodes().push(f),u._nodes=n.extend(!0,[],u.nodes()),u.nameTable[f]&&u._updateQuad(u.nameTable[f]);r.isLane||(r.height=r.width=0,u._updateChildBounds(r,u.nameTable))}r&&r.isLane&&(a=t.datavisualization.Diagram.Util.randomId(),u._cloneGroupNode(r,a),e=t.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(r,u.nameTable),e.isLane=r.isLane,e.orientation=r.orientation,e.height=120,e=t.datavisualization.Diagram.Lane(e),o=t.datavisualization.Diagram.SwimLaneHelper._createSwimlane(e,u,null,!0),o&&(o.offsetX+=10,o.offsetY+=40));v=n.extend(!0,{},this._oldItem);c=o?o:r;this._oldItem=n.extend(!0,{},c);y={oldElement:v,newElement:c};this._trigger("selectionChange",y)}},_updatePaletteVisibility:function(n){this._canHeaderVisible(n)&&(this._canPaletteVisible(n)?(document.getElementById(n.name+"_header").style.display="",document.getElementById(n.name+"_content").style.display=""):(document.getElementById(n.name+"_header").style.display="none",document.getElementById(n.name+"_content").style.display="none"))},_collectionChanged:function(n){var t,i,r;n.changeType=="insert"?this._renderPalette(n.element):n.changeType=="remove"&&(t=n.element,t!=null&&(i=document.getElementById(t.name+"_header"),i&&i.parentNode.removeChild(i),r=document.getElementById(t.name+"_content"),r&&r.parentNode.removeChild(r)))},_extendPaletteItem:function(i){var r=this.model.defaultSettings&&this.model.defaultSettings.node?this.model.defaultSettings.node:null,u=this.model.defaultSettings&&this.model.defaultSettings.connector?this.model.defaultSettings.connector:null;return i.shape&&typeof i.shape=="object"?t.datavisualization.Diagram.Util._updateShapeProperties(i):i=t.datavisualization.Diagram.NodeType(i,this),i.type=="connector"?i=t.datavisualization.Diagram.Connector(n.extend(!0,{},u,i)):i.isLane?i=t.datavisualization.Diagram.SwimLaneHelper._createPaletteLane(i,this.nameTable):i.type=="phase"?i=t.datavisualization.Diagram.Util._mapPalettePhase(i):i.container?i=t.datavisualization.Diagram.ContainerHelper._initContainer(this,i):i._type==="group"||i.children&&i.children.length>0?(i=t.datavisualization.Diagram.Group(n.extend(!0,{},r,i)),i=t.datavisualization.Diagram.Util._updateBpmnChild(i,this),this._initGroupNode(i,this),t.datavisualization.Diagram.Util._updateGroupBounds(i,this)):i=t.datavisualization.Diagram.Node(n.extend(!0,{},r,i)),i},addPaletteItem:function(n,t){for(var i,u,r,o,f,e=0;e<this.model.palettes.length;e++)for(i=[],t.length?i=t:i.push(t),u=0;u<i.length;u++)f=this.model.palettes[e],f.name===n&&(r=this._extendPaletteItem(i[u]),f.items.push(r),o=document.getElementById(n+"_content"),this.nameTable[r.name]=r,this._renderItem(r,o))},removePaletteItem:function(i,r){for(var f,o,u,s,e,a,h,c,l=0;l<this.model.palettes.length;l++)for(f=[],r.length?f=r:f.push(r),o=0;o<f.length;o++)if(c=this.model.palettes[l],c.name===i){if(u=f[o],t.datavisualization.Diagram.Util.removeItem(c.items,u),delete this.nameTable[u.name],u.children&&u.children.length)for(s=0;s<u.children.length;s++)e=u.children[s],e&&(typeof e=="object"?delete this.nameTable[e.name]:delete this.nameTable[e]);h=document.getElementById(i+"_content");a=n(h).find("#"+u.name+"_paletteItem")[0];a&&(h.removeChild(a),this.selectedItem=null)}},expandPalette:function(n){var t=this._findPalette(n);t&&!t.expanded&&this._canExpand(t)&&(t.expanded=!0,this._expandOrCollapsePalette(n))},collapsePalette:function(n){var t=this._findPalette(n);t&&t.expanded&&this._canExpand(t)&&(t.expanded=!1,this._expandOrCollapsePalette(n))},addPalette:function(n){this.model.palettes.push(n);this._renderPalette(n)},removePalette:function(n){for(var r,u,i,f=0;f<this.model.palettes.length;f++)i=this.model.palettes[f],i.name===n&&(t.datavisualization.Diagram.Util.removeItem(this.model.palettes,i),r=document.getElementById(i.name+"_header"),r&&r.parentNode.removeChild(r),u=document.getElementById(i.name+"_content"),u&&u.parentNode.removeChild(u))},setWidth:function(n){this.model.width=n;this._setWidth(n)},setHeight:function(n){this.model.height=n;this._setHeight(n)},setPaletteItemWidth:function(n){this.model.paletteItemWidth=n;this._redrawContent()},setPaletteItemHeight:function(n){this.model.paletteItemHeight=n;this._redrawContent()},setHeaderHeight:function(n){this.model.headerHeight=n;this._setHeaderHeight(n)},setCssClass:function(n){this._setCssClass(n);this.model.cssClass=n},showPaletteItemText:function(n){this._showItemText(n);this.model.showPaletteItemText=n},searchPalette:function(n,i){var r=new t.datavisualization.Diagram.Collection;return i!=""&&(n=this._getSearchPaletteItems(i),r.add(n)),r},updatePalette:function(n,t){var r=this._findPalette(n),u,f;r&&t&&(t.constraints&&r.constraints!=t.constraints&&(r.constraints=t.constraints,u=document.getElementById(r.name+"_header"),this._renderHeaderArrow(u,r.expanded,r.name,this._canExpand(r)),this._disableClickClass(u,this._canExpand(r)),this._updatePaletteVisibility(r),u.style.display=this._canHeaderVisible(r)&&this._canPaletteVisible(r)?"":"none"),t.expanded!=i&&this._canExpand(r)&&(r.expanded=t.expanded,this._expandOrCollapsePalette(n)),t.items&&t.items.length>0&&(f=document.getElementById(r.name+"_content"),f.innerHTML="",r.items=t.items,this._initPaletteitems(r),this._renderContent(r)));this.updateScrollerViewport()},_findPalette:function(n){for(var i,t=0;t<this.model.palettes.length;t++)if(this.model.palettes[t].name==n){i=this.model.palettes[t];break}return i},_canExpand:function(n){return n.constraints&t.datavisualization.Diagram.PaletteConstraints.Expandable},_canHeaderVisible:function(n){return n.constraints&t.datavisualization.Diagram.PaletteConstraints.HeaderVisibility},_canPaletteVisible:function(n){return n.constraints&t.datavisualization.Diagram.PaletteConstraints.Visible},_canClick:function(n){var t,i;if(n&&(t=n.id.split("_header")[0],t&&(i=this._findPalette(t),this._canExpand(i))))return!0},_expandOrCollapsePalette:function(t,i){var i=i||(t?document.getElementById(t+"_header"):null),r;if(i)if(this._canClick(i))r=this,n(i).next(".e-scontent").slideToggle(200,function(){r._refresh()}),this._updateHeaderState(i);else return!1},_getSearchPaletteItems:function(n){for(var f=new t.datavisualization.Diagram.Palette,u=this.model.palettes,r,i=0;i<u.length;i++)if(u[i].name.toLocaleLowerCase().search(n.toLocaleLowerCase())>=0)for(r=0;r<u[i].items.length;r++)this.element.find("#"+u[i].items[r].name+"_paletteItem")[0].style.display="block";else for(r=0;r<u[i].items.length;r++)this.element.find("#"+u[i].items[r].name+"_paletteItem")[0].style.display=u[i].items[r].name.toLocaleLowerCase().search(n.toLocaleLowerCase())>=0?"block":"none";return f},_disableClickClass:function(t,i){i?n(t).removeClass("e-disableclick"):n(t).addClass("e-disableclick")},_addExpandedClass:function(t,i){i?n(t).addClass("expanded"):n(t).addClass("collapsed")},_collapse:function(t){t.expanded||n(document.getElementById(t.name+"_header")).next(".e-scontent").slideToggle(10)},_transformItem:function(n,i,r,u,f,e){var h,v;if(!f)if(e&&!u.segments&&u.paletteItem&&u.paletteItem.width&&u.paletteItem.height&&u.paletteItem.enableScale){var k=30*e.width/100,d=30*e.height/100,o=(e.width-k)/u.width,s=(e.height-d)/u.height;o=s=Math.min(o,s);o=o>1?1:o;s=s>1?1:s;var c=e.width/2-i*o/2,l=e.height/2-r*s/2,a="";a+="translate("+c+","+l+")";a+="scale("+o+","+s+")";n.setAttribute("transform",a);h=n.parentNode.nextSibling;h||(h=document.getElementById(n.id+"_svgWrapper_htmlLayer"));h.style.webkitTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.MozTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.OTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.msTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.transform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";u&&t.browserInfo().name==="msie"&&u._type=="group"&&u.type==="html"&&(v=document.getElementById(u.name+"_html"),v.setAttribute("style","zoom:"+scale+";"))}else if(u.segments){if(e&&u.paletteItem&&u.paletteItem.width&&u.paletteItem.height||u.isPhase&&u.paletteItem&&u.paletteItem.enableScale){var k=e.width/10,d=e.height/10,o=(e.width-k)/i,s=(e.height-d)/r;o=s=Math.min(o,s);o=o>1?1:o;s=s>1?1:s;var c=e.width/2-i*o/2,l=e.height/2-r*s/2,a="";a+="translate("+c+","+l+")";a+="scale("+o+","+s+")";n.setAttribute("transform",a);h=document.getElementById(n.id+"_svgWrapper_htmlLayer");h.style.webkitTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.MozTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.OTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.msTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.transform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";u&&t.browserInfo().name==="msie"&&u._type=="group"&&u.type==="html"&&(v=document.getElementById(u.name+"_html"),v.setAttribute("style","zoom:"+scale+";"))}}else{var y=i/(i+u.borderWidth*3),p=r/(r+u.borderWidth*3),w=(i-i*y)/2,b=(r-r*p)/2;n.childNodes[0].setAttribute("transform","scale("+y+","+p+") translate("+w+","+b+")");u&&u.type==="image"&&n.childNodes[1]?n.childNodes[1].setAttribute("transform","scale("+y+","+p+") translate("+w+","+b+")"):u&&u._type==="group"&&n.setAttribute("transform","scale("+y+","+p+") translate("+w+","+b+")")}},_getScaleFactor:function(n,t){var u=30*this.model.paletteItemWidth/100,f=30*this.model.paletteItemHeight/100,i=(this.model.paletteItemWidth-u)/n,r=(this.model.paletteItemHeight-f)/t;return i=i>1?1:i,r=r>1?1:r,Math.min(i,r)},_getTranslateFactor:function(){var n=15/100*this.model.paletteItemWidth,t=15/100*this.model.paletteItemHeight;return Math.min(n,t)},_setWidth:function(n){this.element.css("width",n)},_setHeight:function(n){this.element.css("height",n)},_setHeaderHeight:function(n){var t,i;for(this.element.find(".e-header").css("height",n),this.element.find(".e-header-arrow").css("top",(n-16)/2),t=0;t<this.model.palettes.length;t++)i=this.model.palettes[t],i&&this._updateHeaderWrapper(i,n);this.updateScrollerViewport()},_updateHeaderWrapper:function(n,t){var i=document.getElementById(n.name+"_Wrapper"),r;i&&(r=i.getBoundingClientRect(),r.height>0&&(i.style.marginTop=t/2-r.height/2+"px"))},_setCssClass:function(n){this.element.removeClass(this.model.cssClass).addClass(n)},_showItemText:function(n){n!==this.model.showPaletteItemText&&(n?this.element.find(".e-text-container").show():this.element.find(".e-text-container").hide())},_setAllowDrag:function(t){var i,e,r,u,f;if(this.model.allowDrag=t,i=this.model.palettes,i)for(r=0;r<i.length;r++)if(u=i[r].items,u)for(f=0;f<u.length;f++)e=document.getElementById(u[f].name+"_paletteItem"),this.model.allowDrag?this._setItemDraggable(e):n(e).ejDraggable("instance").destroy()},_cloneNode:function(n){var u=t.datavisualization.Diagram.Util.randomId(),r,i;if(n.children&&n.children.length>0)for(i=0;i<n.children.length;i++)r=this._cloneChildren(n.children[i],u),this.nameTable[r.name]=r,n.children[i]=r.name;return n.name+=u,n},_cloneChildren:function(t,i){if(typeof t=="object")return r=n.extend(!0,{},t),r.parent+=i,r.name+=i,r;if(typeof t=="string"){var r=this.nameTable[t];if(r)return this._cloneChildren(r,i)}},_setItemDraggable:function(i){var u=this.element[0].id,r=this;n(i).ejDraggable({clone:!0,cursorAt:{top:r.model.previewOffset.y,left:r.model.previewOffset.x},helper:function(){var f=n("#"+r.model.diagramId).ejDiagram("instance"),h,c,i,u,e,s;if(h=r.model.paletteItemWidth,c=r.model.paletteItemHeight,f._selectedSymbol=r.selectedItem,f._symbolPalette=r.model,i=n.extend(!0,{},r.selectedItem),i=r._cloneNode(i),i.isLane&&(r.model.paletteItemWidth=i.paletteItem&&i.paletteItem.previewWidth?i.paletteItem.previewWidth:r.model.previewWidth,r.model.paletteItemHeight=i.paletteItem&&i.paletteItem.previewHeight?i.paletteItem.previewHeight:r.model.previewHeight),u=r._getPreviewItemSize(r.selectedItem),e=r._renderItemContainer(r.selectedItem.name+"_clone",document.body,!0,u),e.document.setAttribute("drag","true"),f._paletteTable=r.nameTable,f._palNameTable=n.extend(!0,{},r.nameTable),i.segments){var o=t.datavisualization.Diagram.Util.bounds(i),l=(u.width-10)/o.width,a=(u.height-10)/o.height;t.datavisualization.Diagram.Util.scale(i,l,a,o.topLeft,f.nameTable);r._renderConnector(i,e,u)}else{if(i.isLane&&i.paletteItem&&!i.paletteItem.enableScale)i.width=u.width,i.height=u.height,i.offsetX=i.width/2,i.offsetY=i.height/2;else if(i._type=="group"){var v=u.width/i.width,y=u.height/i.height;r.scale(i,v,y,i.pivot,r.nameTable,null,null,null,r);t.datavisualization.Diagram.Util._translate(i,i.width/2-i.offsetX,i.height/2-i.offsetY,r.nameTable,null,r)}else i.width=u.width-10,i.height=u.height-10,u&&(u.width=u.width-10,u.height=u.height-10),i.offsetX=i.width/2+10,i.offsetY=i.height/2+1;r._updatePreviewSize(i,u);i._type=="node"?r._renderNode(i,e,u):r._renderGroup(i,e)}return s=document.getElementById(r.selectedItem.name+"_clone_paletteItem"),n(s).addClass("dragClone"),r.model.paletteItemWidth=h,r.model.paletteItemHeight=c,n(s)},drag:function(){var t=this.helper[0];n("#"+r.selectedItem.name+"_clone_svg").css("padding","2px");n("#"+r.selectedItem.name+"_clone_svg").siblings(".htmlLayer").css("padding","2px");t&&t.setAttribute("paletteId",u)},dragStop:function(t){var u=!1,i;t.event&&t.event.originalEvent&&t.event.originalEvent.changedTouches?u=!0:t.event&&t.event.changedTouches&&(u=!0);i=n("#"+r.model.diagramId).ejDiagram("instance");u&&i._isDropOver&&(i._svgdrop(t.event,this),i._isDropped=!0);i._selectedSymbol=null;n(this.helper).remove()}})},_redrawContent:function(){for(var u,e,t,r,o,f=this.element.find(".e-scontent"),i=0,s=f.length;i<s;++i)if(u=f[i],n(u).empty(),e=this.model.palettes[i],t=e.items,t&&t.length>0)for(r=0,o=t.length;r<o;r++)this._renderItem(t[r],u)},_getPalette:function(n){for(var t,r=this.model.palettes,i=0,u=r.length;i<u;i++)if(t=r[i],t.name===n&&t!==this.activePalette)return t;return null},_getActivePalette:function(n){var t=n.slice(0,n.lastIndexOf("_"));return this._getPalette(t)},_updateHeaderState:function(n){this._clearHeaderSelection();this._updateExpandState(n);this._updateHeaderSelection(n)},_updateExpandState:function(t){n(t).hasClass("expanded")?(n(t).removeClass("expanded").addClass("collapsed"),n(t).find(".e-header-arrow").removeClass("expanded").addClass("collapsed"),n(t).attr("aria-expanded","false"),n(t).attr("aria-selected","false")):(n(t).removeClass("collapsed").addClass("expanded"),n(t).find(".e-header-arrow").removeClass("collapsed").addClass("expanded"),n(t).attr("aria-selected","true"),n(t).attr("aria-expanded","true"))},_updateHeaderSelection:function(t){n(t).hasClass("selected")||(n(t).addClass("selected"),n(t).find(".e-header-arrow").addClass("selected"))},_clearHeaderSelection:function(){this.element.find(".e-header").removeClass("selected");this.element.find(".e-header-arrow").removeClass("selected")},_addItem:function(n,t){var i=document.getElementById(n.name+"_content");this._renderItem(t,i)},_removeItem:function(n,t){var i=document.getElementById(n.name+"_content");i.removeChild(document.getElementById(t.name+"_paletteItem"));t===this._selectedElement&&(this._selectedElement=null)},updateScrollerViewport:function(){var n=this.element.ejScroller("instance");n.model.touchScroll=!1;n.model.width=this._setViewPortWidth();n.model.height=this._setViewPortHeight();this._refresh()},_refresh:function(){this.element.ejScroller("refresh")},_getNodeDimension:function(n){var f=n._width,e=n._height,o=n.width?n.width:n.maxWidth?n.maxWidth:n.minWidth,i=document.createElement("span"),s=0,h=0,r,u;if(n.labels.length){for(t.datavisualization.Diagram.Util.attr(i,{id:n.name+"_label","class":"ej-d-label",style:"display: inline-block; position: absolute; pointer-events: all; line-height: normal;"}),this.element[0].appendChild(i),u=0;u<n.labels.length;u++)r=n.labels[u],r.bold&&(i.style.fontWeight="bold"),r.italic&&(i.style.fontStyle="italic"),i.style.textDecoration=r.textDecoration,i.style.fontFamily=r.fontFamily,i.style.fontSize=r.fontSize+"px",i.style.color=r.fontColor,i.style.backgroundColor=r.fillColor,i.style.borderColor=r.borderColor,i.style.borderWidth=r.borderWidth,i.textContent=r.text,i.style.wordWrap="break-word",i.style.whiteSpace="pre",o&&(i.style.maxWidth=o-(r.margin.left+r.margin.right)-r.fontSize+"px"),s+=i.offsetWidth+r.margin.left+r.margin.right,h+=i.offsetHeight+r.margin.top+r.margin.bottom;n._width=s;n._height=h;n.minWidth&&(n.minWidth>n._width||!n._width)&&(n._width=n.minWidth);n.maxWidth&&(n.maxWidth<n._width||!n._width)&&(n._width=n.maxWidth);n.minHeight&&(n.minHeight>n._height||!n._height)&&(n._height=n.minHeight);n.maxHeight&&(n.maxHeight<n._height||!n._height)&&(n._height=n.maxHeight);n.width||n.labels[0].horizontalAlignment!="left"||(n.offsetX+=(n._width-f)*(1-n.pivot.x));n.width||n.labels[0].horizontalAlignment!="right"||(n.offsetX-=(n._width-f)*n.pivot.x);n.height||n.labels[0].verticalAlignment!="top"||(n.offsetY+=(n._height-e)*(1-n.pivot.y));n.height||n.labels[0].verticalAlignment!="bottom"||(n.offsetY-=(n._height-e)*n.pivot.y);this.element[0].removeChild(i)}},_getNewNode:function(i){return i.shape&&typeof i.shape=="object"&&t.datavisualization.Diagram.Util._updateShapeProperties(i),t.datavisualization.Diagram.Node(n.extend(!0,{},this.model.defaultSettings.node,i))},_getNewGroup:function(i){return i.type=="bpmn"&&(i=t.datavisualization.Diagram.Util._updateBpmnChild(t.datavisualization.Diagram.Node(i),this)),t.datavisualization.Diagram.Group(n.extend(!0,{},this.model.defaultSettings.group,i))},scale:function(n,i,r,u,f,e,o,s,h){var a=t.Matrix.identity(),p,y,l,c,v;if(n.segments)for(t.Matrix.scale(a,i,r,u.x,u.y),l=0;l<n.segments.length;l++){for(c=n.segments[l],v=0;v<c.points.length;v++)c.points[v]=t.Matrix.transform(a,c.points[v]),l!=0||v!=0||n.sourceNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],t.datavisualization.Diagram.Util._setLineEndPoint(n,t.Matrix.transform(a,n.sourcePoint),!1)),l!=n.segments.length-1||v!=c.points.length-1||n.targetNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],n.targetPoint=c._endPoint);c._startPoint=c.points[0];c._endPoint=c.points[c.points.length-1];c.type=="orthogonal"?c.length||c.length===0?c.length=c._length=t.datavisualization.Diagram.Geometry.distance(c._startPoint,c._endPoint):t.datavisualization.Diagram.Util._addOrthogonalPoints(c,n.segments[l-1],n.segments[l+1],n.sourcePoint,n.targetPoint):(c.point&&(c.point=c._endPoint),c._point=c._endPoint)}else{if(n._type==="group"){for(p=n.children,l=0;l<p.length;l++)y=f[typeof p[l]=="string"?p[l]:p[l].name],y&&(this.scale(y,i,r,u,f),y.parent&&y.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(f[y.parent],h));t.datavisualization.Diagram.Util._updateGroupBounds(n,h)}t.Matrix.rotate(a,-n.rotateAngle,u.x,u.y);t.Matrix.scale(a,i,r,u.x,u.y);t.Matrix.rotate(a,n.rotateAngle,u.x,u.y);var w=t.Matrix.transform(a,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),b=n.width*i,k=n.height*r;b>1&&(n.width=b,n.offsetX=w.x);k>1&&(n.height=k,n.offsetY=w.y)}},_translate:function(n,i,r,u,f,e){var h,o,s;if(n.segments)t.datavisualization.Diagram.Util._translateLine(n,i,r,n);else if(n.offsetX+=i,n.offsetY+=r,n._type==="group"&&!f){for(h=e._getChildren(n.children),s=0;s<h.length;s++)o=u[h[s]],this._translate(o,i,r,u,null,e),o.parent&&o.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(u[o.parent],e);n._type!="group"&&n.container&&t.datavisualization.Diagram.Util._updateGroupBounds(n,e)}}})}(jQuery,Syncfusion),function(n,t){"use strict";var i,u,f,e,o,s,r,h,c,l,a,v,y,p,w,b;t.datavisualization.Diagram.extend=function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r};i=function(){function i(n,i){this.name=n;this.diagram=i;this.helper=null;this.inAction=!1;this.selectedObject=null;this.startPoint=t.datavisualization.Diagram.Point(0,0);this.currentPoint=t.datavisualization.Diagram.Point(0,0);this.previousPoint=t.datavisualization.Diagram.Point(0,0);this.cursor="default";this._currentPossibleConnection=null;this._previousPossibleConnection=null;this._possibleConnectionPort=null;this.singleAction=!1;this.svgHelper=null;this.single=null;this._centralPoint=t.datavisualization.Diagram.Point(0,0);this._enableAutoNode=null;this._prevTool=null;this.activeLabel=null;this._adjustLines={lines:[]}}return i.prototype.abort=function(){this._endAction();this.diagram.selectionList&&this.diagram.selectionList[0]&&t.datavisualization.Diagram.SvgContext.updateSelector(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom,this.diagram,this.diagram.model.selectedItems.constraints);this.diagram._removeTooltip()},i.prototype._snapTop=function(n,i,r,u,f,e){var o=u,s,c,h;if(i.top=!0,n.left=n.right=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.y-this.initialBounds.height*f.pivot.y+u-(f.offsetY-f.height*f.pivot.y),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,r,h,this.selectedObject,e)),i.snapped)o=u-h+i.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines){var l=this.initialBounds.y-this.initialBounds.height*f.pivot.y,a=l+u,v=t.datavisualization.Diagram.SnapUtil._round(a,s.horizontalGridLines.snapInterval,c);o=v-l}return o},i.prototype._getSwimLaneStackIndex=function(n){var u=null,i,r;return n.container.type=="canvas"&&(n.parent&&(i=this.diagram.nameTable[n.parent]),i&&(r=t.datavisualization.Diagram.Util.bounds(n),u=i.container.orientation==="vertical"?this.currentPoint.y>=r.y&&this.currentPoint.y<r.center.y?this._getIndex(i.children,n):this._getIndex(i.children,n)+1:this.currentPoint.x>=r.x&&this.currentPoint.x<r.center.x?this._getIndex(i.children,n):this._getIndex(i.children,n)+1)),u},i.prototype._getIndex=function(n,t){var r,i;if(n&&t){for(r=null,i=0;i<n.length;i++)if(r=this.diagram.nameTable[this.diagram._getChild(n[i])],r&&r.name==t.name)return i}else return-1},i.prototype._snapLeft=function(n,i,r,u,f,e){var o=r,s,c,h,a;if(n.left=!0,i.top=i.bottom=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.x-this.initialBounds.width*f.pivot.x+r-(f.offsetX-f.width*f.pivot.x),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,h,u,this.selectedObject,e)),a=t.datavisualization.Diagram.Util.bounds(f),n.snapped)o=r-h+n.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines){var l=this.initialBounds.x-this.initialBounds.width*f.pivot.x,v=l+r,y=t.datavisualization.Diagram.SnapUtil._round(v,s.horizontalGridLines.snapInterval,c);o=y-l}return o},i.prototype._snapBottom=function(n,i,r,u,f,e){var o=u,s,c,h,a;if(!this.diagram._disableSnap)if(i.bottom=!0,n.left=n.right=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.y+this.initialBounds.height*(1-f.pivot.y)+u-(f.offsetY+f.height*(1-f.pivot.y)),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,r,h,this.selectedObject,e)),a=t.datavisualization.Diagram.Util.bounds(f),i.snapped)o=u-h+i.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines){var l=this.initialBounds.y+this.initialBounds.height*(1-f.pivot.y),v=l+u,y=t.datavisualization.Diagram.SnapUtil._round(v,s.horizontalGridLines.snapInterval,c);o=y-l}return o},i.prototype._snapRight=function(n,i,r,u,f,e){var o=r,s,c,h;if(!this.diagram._disableSnap)if(n.right=!0,i.top=i.bottom=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.x+this.initialBounds.width*(1-f.pivot.x)+r-(f.offsetX+f.width*(1-f.pivot.x)),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,h,u,this.selectedObject,e)),n.snapped)o=r-h+n.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines){var l=this.initialBounds.x+this.initialBounds.width*(1-f.pivot.x),a=l+r,v=t.datavisualization.Diagram.SnapUtil._round(a,s.verticalGridLines.snapInterval,c);o=v-l}return o},i.prototype.keydown=function(n){var i=n.keyCode?n.keyCode:n.which;i===27&&this.inAction?(this.diagram._selectedSymbol?(this.diagram._documentmouseup(n),this._removeHighLighter(),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.diagram._selectedSymbol=null):(this.seletedObject||this.selectedObject)&&(this.selectedObject&&(t.datavisualization.Diagram.SvgContext._enableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram),t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer)),this.seletedObject&&(t.datavisualization.Diagram.SvgContext._enableSelectedNode(this.seletedObject,this.diagram._svg,this.diagram),t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.seletedObject,this.diagram._adornerSvg,this.diagram._adornerLayer)),this._removeHighLighter(),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram)),this.abort()):i===46&&this.inAction?(this.diagram._selectedSymbol&&(this.diagram._documentmouseup(n),this.diagram._selectedSymbol=null),this.abort()):this.inAction||i!=27||this.diagram._clearSelection()},i.prototype._getSwimlaneHeader=function(n){var t;return n&&n.isSwimlane&&n.children&&n.children.length>0&&(t=this.diagram.nameTable[n.children[0]]),t},i.prototype._removeHelpers=function(){t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer);t.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this.diagram._adornerLayer,this.diagram._adornerSvg);this._removeHighLighter()},i.prototype._cloneGroupNode=function(t,i){var o=null,r,u,e,f;if(u=n.extend(!0,{},t),u.name+=i,t&&t._type==="group")for(u.children=[],e=this.diagram._getChildren(t.children),f=0;f<e.length;f++)o=this.diagram.nameTable[e[f]],r=n.extend(!0,{},o),r.name+=i,r.parent&&(r.parent+=i),r._type==="group"&&this._cloneGroupNode(r,i),this.diagram.nameTable[r.name]=r,this.diagram.nodes().push(r),this.diagram._nodes=n.extend(!0,[],this.diagram.nodes()),u.children.push(r.name);return u},i.prototype._updateNextPhases=function(n,i,r){var o=0,s,u,e,f;for(o=n.orientation=="horizontal"?i:r,s=this.diagram._getPhaseIndex(n.name),e=this.diagram.nameTable[n.parent],f=s+1;f<e.phases.length;f++)u=this.diagram.nameTable[e.phases[f]],u&&(u.offset+=o),t.datavisualization.Diagram.SvgContext._updatephase(u,this.diagram)},i.prototype._getphase=function(n){return this.diagram.nameTable[n]},i.prototype._containsSwimlane=function(n){var i,t;for(i in n)if(t=this.diagram.nameTable[n[i]],t.isSwimlane||t.isLane)return!0;return!1},i.prototype._raiseEndPointDrag=function(n,t,i,r){if(t||i){var u,f,e,o;return f=this._currentPossibleConnection?this._currentPossibleConnection:null,e=this._possibleConnectionPort?this._possibleConnectionPort:null,o=this.currentPoint,u=t?"Target":"Source",this._raiseEvent("connector"+u+"Change",{element:n,node:f,port:e,point:o,dragState:r,cancel:!1})}},i.prototype._decideSelectedItem=function(n,t,i){var r=null,f,u;if(t)t.parent?this.diagram.selectionList&&this.diagram.selectionList[0]&&t.parent==this.diagram.selectionList[0].name&&!i?(r=t,this.diagram.selectionList[0].type=="bpmn"&&(r=this.diagram.selectionList[0])):i&&this.diagram.selectionList[0]&&this.diagram.selectionList[0].name==t.name?r=t:(f=this.diagram.nameTable[t.parent],t.isPhase?(u=t.name.split("phaseStack")[1],u&&(t=this.diagram.nameTable[u]),r=t):(r=this._decideSelectedItem(n,f,i),this.diagram.selectionList&&this.diagram.selectionList[0]&&r&&this.diagram.selectionList[0].name==r.name&&!i&&(r=t))):r=t;else return null;return r},i.prototype._isParentAsLane=function(n){for(var i,t,u,r=0;n.children&&r<n.children.length>0;r++)if(i=this.diagram.nameTable[this.diagram._getChild(n.children[r])],i&&(t=this.diagram.nameTable[i.parent],t&&t.isLane))return u=this.diagram.nameTable[t.parent],this.diagram._activeSwimLane=this.diagram.nameTable[u.parent],!0;return null},i.prototype._getAdjustjecentLines=function(n){if(!n.segments){for(var t=0;n.inEdges&&n.inEdges.length>0&&t<n.inEdges.length;t++)this._containsCollection(this._adjustLines.lines,this.diagram.nameTable[n.inEdges[t]])||this._adjustLines.lines.push(jQuery.extend(!0,{},this.diagram.nameTable[n.inEdges[t]]));for(t=0;n.outEdges&&n.outEdges.length>0&&t<n.outEdges.length;t++)this._containsCollection(this._adjustLines.lines,this.diagram.nameTable[n.outEdges[t]])||this._adjustLines.lines.push(jQuery.extend(!0,{},this.diagram.nameTable[n.outEdges[t]]))}},i.prototype._containsCollection=function(n,t){for(var i=0;n&&n.length>0&&i<n.length;i++)if(t&&n[i].name===t.name)return!0},i.prototype._updateMultipleUndoObject=function(n){for(var t,r=[],i=0;n.children&&n.children.length>0&&i<n.children.length;i++)t=this.diagram.nameTable[n.children[i]],t&&(r.push(jQuery.extend(!0,{},t)),this._getAdjustjecentLines(t));this._undoObject||(this._undoObject={collection:r,adjustLines:jQuery.extend(!0,{},this._adjustLines)})},i.prototype._updateNameTable=function(n){this.diagram._updateNameTable(n)},i.prototype._getParentSwimlane=function(n){var t;return n&&n.isLane?(t=this.diagram.nameTable[n.parent],this.diagram.nameTable[t.parent]):null},i.prototype._removeHighLighter=function(){t.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer)},i.prototype._getPadding=function(n){var i=0,r=0,t;return n&&n.parent&&(t=this.diagram.nameTable[n.parent],t&&(i=t.paddingRight,r=t.paddingBottom)),{x:i,y:r}},i.prototype._findStackOverNode=function(n,i){var u,o,r,s,c,h,f,e;if(n&&(u=this.diagram.nameTable[n.parent],o=null,u))for(c=u.children.length,h=0;h<c;h++)if(o=this.diagram.nameTable[this.diagram._getChild(u.children[h])],r=this.mousePosition(i),s=t.datavisualization.Diagram.Util.bounds(o),f=this.diagram.nameTable[this.diagram._getChild(u.children[c-1])],e=this.diagram.nameTable[this.diagram._getChild(u.children[0])],u.container.orientation=="vertical"){if(r.y>=s.y&&r.y<=s.bottom)return o;if(r.y<=e.offsetY-e.height/2)return e;if(r.y>=f.offsetY+f.height/2)return f}else{if(r.x>=s.x&&r.x<=s.right)return o;if(r.x<=e.offsetX-e.width/2)return e;if(r.x>=f.offsetX+f.width/2)return f}},i.prototype._getPageBounds=function(){var i=t.datavisualization.Diagram.Rectangle(0,0,0,0),n=this.diagram.model.pageSettings;return i.x=n.boundaryConstraints==="diagram"?Math.min(this.diagram._getDigramBounds().x,0):0,i.y=n.boundaryConstraints==="diagram"?Math.min(this.diagram._getDigramBounds().y,0):0,i.width=n.boundaryConstraints==="page"?n.pageWidth?n.pageWidth:this.diagram.element.width():this.diagram.element.width(),i.height=n.boundaryConstraints==="page"?n.pageHeight?n.pageHeight:this.diagram.element.height():this.diagram.element.height(),i},i.prototype._nodeHighLighter=function(n){var f=null,r=null,u=null,i,o,e;n&&this.selectedObject.parent?(i=this.diagram.nameTable[this.selectedObject.parent],i&&(i.container&&i.container.type=="stack"&&this.selectedObject.name!=n.name?(o=this._stackOverNode,t.datavisualization.Diagram.SvgContext._drawStackHighlighter(o,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom,this.currentPoint,i.container.orientation==="vertical"?!0:!1)):i.container&&i.container.type=="canvas"&&this.selectedObject.parent!=n.name&&!n.isPhase&&t.datavisualization.Diagram.Util.canAllowDrop(n)?t.datavisualization.Diagram.Util._canBeTarget(this.diagram,n)&&t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom):this._removeHighLighter())):n&&n.container&&!n.isSwimlane?this.selectedObject.isLane?(i=this.diagram.nameTable[n.parent],i&&n.name.indexOf("phaseStack")===-1&&t.datavisualization.Diagram.Util.canDrawStackHighlighter(this.diagram,this.selectedObject,n)&&t.datavisualization.Diagram.SvgContext._drawStackHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom,this.currentPoint,i.container.orientation==="vertical"?!0:!1)):t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom):n.segments?this._removeHighLighter():t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom);this._nodeToHit&&n&&n.name!=this._nodeToHit.name&&(r=t.datavisualization.Diagram.Util.bounds(this._nodeToHit),u=this._getTargetNode(this._nodeToHit,r),this._raiseEvent("mouseLeave",{element:this.diagram.getNode(this.selectedObject),source:this.diagram.getNode(this._nodeToHit),target:this.diagram.getNode(u)}));n?(this._nodeToHit&&this._nodeToHit.name!==n.name||!this._nodeToHit)&&(this._nodeToHit=n,this.selectedObject.parent&&(f=this.diagram.nameTable[this.selectedObject.parent]),this.selectedObject.type=="pseudoGroup"&&(e=this.diagram.nameTable[this.diagram._getChild(this.selectedObject.children[0])],e&&e.parent&&(f=this.diagram.nameTable[e.parent])),r=t.datavisualization.Diagram.Util.bounds(n),u=this._getTargetNode(n,r),this._raiseEvent("mouseEnter",{element:this.diagram.getNode(this.selectedObject),source:this.diagram.getNode(f),target:this.diagram.getNode(u)})):this._nodeToHit=null;n&&(this.selectedObject.parent&&(f=this.diagram.nameTable[this.selectedObject.parent]),r=t.datavisualization.Diagram.Util.bounds(n),u=this._getTargetNode(n,r),this._raiseEvent("mouseOver",{element:this.diagram.getNode(this.selectedObject),source:this.diagram.getNode(f),target:this.diagram.getNode(u)}))},i.prototype._doubleClick=function(n){var t,i;n&&n.parent&&(t=this.diagram.nameTable[n.parent],t&&(i=n.name,this.diagram.updateSelectedObject(i),t.isLane||t.isSwimlane||t.isPhaseStack||(this.diagram._clearSelection(!0),this.diagram.addSelection(n,!0))))},i.prototype._itemClick=function(n,t,i,r){var u,s,e,o,f;if(t&&t.parent){if(u=this.diagram.nameTable[t.parent],u)if(u.container)t&&!this.diagram._selectedSymbol&&(s=t.name,s.indexOf("_header_swimlane")!=-1?n&&this.diagram.updateSelectedObject(n.parent,u):s.indexOf("_Headerr_")!=-1?this.diagram.updateSelectedObject(t.parent):t&&t.isPhase?n.isPhase&&(f=this.diagram.nameTable[n.parent],f&&(this.diagram.selectionList.length===0||this.diagram.selectionList[0].name!=f.name)&&(this.diagram._clearSelection(!0),this.diagram.addSelection(n,!0),this.selectedObject=null)):this.diagram.updateSelectedObject(s)),this.diagram._selectedGNode=null;else if(u.type==="group"){if(u.parent){if(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y)e=this.diagram.nameTable[u.parent];else while(u.parent)if(e=this.diagram.nameTable[u.parent],e&&e.isLane)break;else if(o=this.diagram.nameTable[u.parent],this.diagram._selectedGNode&&o)if(o.name===this.diagram._selectedGNode.name){this.diagram.updateSelectedObject(u.name);break}else u=o;else u=o;e&&e.isLane&&(f=this._getSelectedItem(t,r),f&&this.diagram.updateSelectedObject(f.name))}this.selectedObject&&this.selectedObject.parent&&(this.diagram._selectedGNode=this.selectedObject)}}else t?this.diagram._selectedSymbol||this.diagram.updateSelectedObject(t.name):this.diagram._selectedGNode=null;n&&(n.type=="pseudoGroup"||n.name=="multipleSelection")&&t&&!this._containsChild(n,t.name)&&this.diagram.updateSelectedObject(n.name)},i.prototype._getSelectedItem=function(n,t){var i;if(n&&n.parent)return i=this.diagram.nameTable[n.parent],t&&t.name==i.name?n:i.isLane?n:this._getSelectedItem(i)},i.prototype._getTargetNode=function(n,i){for(var e,o,u,s,h=null,f=[],c=t.datavisualization.Diagram.SpatialUtil.findQuads(this.diagram._spatialSearch,i),r=0;r<c.length;r++)if(e=c[r],e.objects.length>0)for(o=0;o<e.objects.length;o++)u=e.objects[o],!u.segments&&u.visible&&(h=t.datavisualization.Diagram.Util.bounds(u),f.indexOf(u)==-1&&t.datavisualization.Diagram.Geometry.intersectsRect(i,h)&&f.push(u));for(s=[],s.push(n),r=0;r<f.length;r++)f[r].name!=n.name&&s.push(f[r]);return s},i.prototype._updateMargin=function(n,i){var o,s,f,r,u;if(n.type=="pseudoGroup")for(o=null,s=this.diagram._getChildren(n.children),f=0;f<s.length;f++)o=this.diagram.nameTable[s[f]],this._updateMargin(o,i);else if(i&&i.container&&i.container.type=="canvas"){var h=t.datavisualization.Diagram.Util.bounds(i),e=t.datavisualization.Diagram.Util.bounds(n),c=t.datavisualization.Diagram.Geometry.rect([e.topLeft,e.topRight,e.bottomRight,e.bottomLeft]);n.marginLeft=c.x-(h.x+i.paddingLeft);n.marginTop=c.y-(h.y+i.paddingTop);i.isLane&&(r=0,u=0,i.orientation==="horizontal"?(r=50,u=0):(r=0,u=50),n.marginLeft=n.marginLeft>=r?n.marginLeft:r,n.marginTop=n.marginTop>=u?n.marginTop:u)}},i.prototype._getNodeUnderMouse=function(){var n=this.diagram._nodeUnderMouse,i,f,u,r;if(this.diagram._focusedElement&&(this.diagram._focusedElement.isPhase||this.diagram._focusedElement.isLane||this.diagram._focusedElement.isSwimlane)&&(f=!0),this.diagram._focusedElement&&n&&this._containsChild(this.diagram._focusedElement,n.name)&&n&&(f||!t.datavisualization.Diagram.Util.canAllowDrop(n)))if(u=this.diagram.getObjectType(n),u=="connector"||u==="group")i=n;else if(n.parent){if(r=this.diagram.nameTable[n.parent],r&&r.container&&r.container.type=="stack"&&t.datavisualization.Diagram.Util.canAllowDrop(n))return n;u=this.diagram.getObjectType(r);r&&u!="node"&&(i=r)}if(i){if(this.selectedObject!=i&&t.datavisualization.Diagram.Util.canAllowDrop(i)&&(i.type!="bpmn"||this.selectedObject.type=="bpmn"))return i}else if(n&&this.selectedObject!=n&&t.datavisualization.Diagram.Util.canAllowDrop(n))return n},i.prototype._isChange=function(n,t){var i=null;return n._type==="group"||n.type==="pseudoGroup"||t._type==="group"||t.type==="pseudoGroup"?(n._type!=="group"&&n.type!=="pseudoGroup"||t._type==="group"||t.type==="pseudoGroup"||(i=!this._containsChild(n,t.name)),n._type==="group"||n.type==="pseudoGroup"||t._type!=="group"&&t.type!=="pseudoGroup"?(n._type==="group"||n.type==="pseudoGroup")&&(t._type==="group"||t.type==="pseudoGroup")&&n.name==t.name&&(i=!0):i=!this._containsChild(t,n.name)):n.name==t.name&&(i=!0),i},i.prototype._containsChild=function(n,t){var u=!0,i=null,e,f,r;if(n.children)for(f=this.diagram._getChildren(n.children),r=0;r<f.length;r++)i=this.diagram.nameTable[f[r]],e=this.diagram.getObjectType(i),e==="group"?u=this._containsChild(i,t):i&&i.name==t&&(u=!1);return u},i.prototype._findNodeUnderMouse=function(i,r){var f=null,u=null,o,s=this.diagram._isForeignObject(i.target),e,h;return s&&(i.target=s),e=n(i.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group"),h=i.target.className,e&&(s||i.target.localName!="div")?(o=e.attr("class"),o&&(o==="ej-d-node"||o==="ej-d-group"||t.datavisualization.Diagram.Util.isClassifier(i))?(u=this.diagram._findNode(e.attr("id")),u||(u=this.diagram._findNode(e.attr("id").split("_parentdiv")[0]))):o==="ej-d-connector"&&(u=this.diagram._findConnector(e.attr("id")))):this.diagram._isLabelTemplate(i)&&(u=this.diagram._findNode(e.attr("id")),u||(u=this.diagram._findConnector(e.attr("id")))),f=u&&!u.parent?u:this._decideSelectedItem(i,u,r),this.prevSelectObject=f,r&&this.diagram.selectionList[0]&&(f&&f._type==="group"&&!this._containsChild(f,this.diagram.selectionList[0].name)?f=f:f&&this.diagram.selectionList[0].name!=f.name&&this._isChange(this.diagram.selectionList[0],f)?f=this.diagram.selectionList[0]:u&&u.name==this.diagram.selectionList[0].name&&!this._isChange(this.diagram.selectionList[0],f)&&(f=this.diagram.selectionList[0])),this.actualObject=u&&this.diagram._selectedSymbol&&u.name!=this.diagram._selectedSymbol.name&&this.diagram._symbolDrop?this.diagram._selectedSymbol:u,f},i.prototype._findLabelUnderMouse=function(i,r,u,f){var o,p=n(i.target),l=p[0].getAttribute("class"),d,w,k,a,v,b,h,c,g,y,s,e;if(this.diagram.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){if(!l||!l=="ej-d-label")if(p[0].parentNode&&(d=p[0].parentNode.getAttribute("class")),d==="ej-d-label"){for(w=p[0].parentNode.id.split("_"),k="",e=1;e<w.length;e++)k+=w[e],e!=w.length-1&&(k+="_");if(a=this.diagram.nameTable[w[0]],a&&a.labels.length>0)for(e=0;e<a.labels.length;e++)if(a.labels[e].name===k)return this.activeLabel=a.labels[e],a.labels[e]}else for(v=i.target.parentNode,l=v.getAttribute("class");v;){if(l==="ej-label-template")for(s=v.id.split("_"),o=this.diagram._findNode(s[0]),o||(o=this.diagram._findConnector(s[0])),e=0;o&&e<o.labels.length;e++)if(c=o.labels[e].name.split("_"),s[s.length-1]==c[c.length-1])return h=o.labels[e],this.diagram._selectedSymbol||(this.activeLabel=h),h;v=v.parentNode;l=v.getAttribute("class")}}else if(l=="ej-d-label"){if(y=n(i.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group"),y&&(s=y[0].getAttribute("id"),b=y[0].getAttribute("class"),b))if(b==="ej-d-node"||b==="ej-d-group")o=this.diagram._findNode(s),h=this.diagram._findLabelAtPoint(u?u:this.currentPoint,o),this.diagram._selectedSymbol||(this.activeLabel=h);else if(b==="ej-d-connector"){if(o=this.diagram._findConnector(s),h=this.diagram._findLabelAtPoint(u?u:this.currentPoint,o),t.datavisualization.Diagram.Util.canMoveLabel(o)||f){if(h==null&&(p=n(i.target),l=p[0].getAttribute("class"),l=="ej-d-label"))for(s=i.target.id.split("_"),e=0;e<o.labels.length;e++)c=o.labels[e].name.split("_"),s[s.length-1]==c[c.length-1]&&(h=o.labels[e])}else h=null;this.diagram._selectedSymbol||(this.activeLabel=h)}}else if(this.diagram._isLabelTemplate(i)){if(g=n(i.target).parents(".ej-label-template"),y=g[0],y){if(s=y.parentNode.id.split("_"),o=this.diagram._findNode(s[0]),o||(o=this.diagram._findConnector(s[0])),o)for(e=0;e<o.labels.length;e++)c=o.labels[e].name.split("_"),s[2]==c[c.length-1]&&(h=o.labels[e]);this.diagram._selectedSymbol||(this.activeLabel=h)}}else this.activeLabel=null;return o},i.prototype._selectionContainsChild=function(n){var i,t,r,u,f;if(this.diagram.selectionList[0].children){for(i=this.diagram._getChildren(this.diagram.selectionList[0].children),t=null,r=0;r<i.length;r++)if(t=this.diagram.nameTable[i[r]],t&&t.name==n)return!0}else if(this.diagram.selectionList[0]._type==="group"&&this.diagram.selectionList[0].type!="pseudoGroup"){if(this.diagram.selectionList[0].name==n)return!0}else if(this.diagram.nameTable[n]&&this.diagram.nameTable[n]._type==="group"){for(i=this.diagram._getChildren(this.diagram.nameTable[n].children),u=0;u<i.length;u++)if(t=this.diagram.nameTable[i[u]],t&&(f=this._selectionContainsChild(t.name)),f)return f}else if(this.diagram.selectionList[0].name==n)return!0;return!1},i.prototype._isSelected=function(n){var u=null,i=this.diagram.nameTable[n],r,t;if(this._selectionContainsChild(i.name))return!0;if(i._type==="group")for(r=this.diagram._getChildren(i.children),t=0;t<r.length;t++)if(u=r[t],this._selectionContainsChild(u))return!0;return!1},i.prototype._isColleagueSelected=function(n){var u=this.diagram.nameTable[n],f=null,i,r,t;if(u.parent&&(i=this.diagram.nameTable[u.parent],i))for(r=this.diagram._getChildren(i.children),t=0;t<r.length;t++)if(f=r[t],this._isSelected(f))return!0;return!1},i.prototype._isInSelection=function(n){var i,r,t;if(this.diagram.selectionList[0].type=="pseudoGroup"&&this.diagram.selectionList[0].children)for(i=this.diagram._getChildren(this.diagram.selectionList[0].children),r=null,t=0;t<i.length;t++)if(r=this.diagram.nameTable[i[t]],r.name==n)return!0},i.prototype._getCloneNode=function(n){var t=null;return t=jQuery.extend(!0,{},n),t.children=[],t.minHeight=0,t.minWidth=0,t.maxHeight=0,t.maxWidth=0,t},i.prototype._getProcessedObject=function(n){var t=this.diagram.nameTable[n],i;if(t){if(this._isInSelection(n))return null;if(this._selectionContainsChild(t.name))return{add:t,remove:null};if(t.parent)if(this._selectionContainsChild(t.parent)){if(this._isInSelection(t.parent))return{add:t,remove:this.diagram.nameTable[t.parent]};if(i=this.diagram.nameTable[t.parent],i)return{add:i,remove:this.diagram.nameTable[i.parent]}}else return this._isColleagueSelected(t.parent)&&!this._selectionContainsChild(t.parent)?this._isSelected(t.parent)?{add:t,remove:null}:{add:this.diagram.nameTable[t.parent],remove:null}:this.diagram.selectionList[0]&&this._isInSelection(t.parent)?{add:this.diagram.nameTable[t.name],remove:this.diagram.nameTable[t.parent]}:this._getProcessedObject(t.parent);else return{add:t,remove:null}}},i.prototype.hasSameParent=function(){var n,t,u,r,i;if(this.selectedObject.type=="pseudoGroup"){if(n=this.selectedObject,t=null,this.diagram.nameTable[this.diagram._getChild(n.children[0])])for(u=this.diagram.nameTable[this.diagram._getChild(n.children[0])].parent,r=this.diagram._getChildren(n.children),i=0;i<r.length;i++)if(t=this.diagram.nameTable[r[i]],t.parent!=u||t.parent=="")return!1;return!0}return!1},i.prototype._fromDiagram=function(n){for(var r=!0,t=null,i=0;i<n.length;i++)if(t=this.diagram.nameTable[this.diagram._getChild(n[i])],t&&t.parent){r=!1;break}return r},i.prototype._fromContainer=function(n){for(var t=null,i=null,r=0;r<n.length;r++)if(t=this.diagram.nameTable[this.diagram._getChild(n[r])],t.parent&&(i=this.diagram.nameTable[t.parent],i&&i.container))return!0},i.prototype._fromSameContainer=function(n){for(var t=null,i=null,r=0;r<n.length;r++)if(t=this.diagram.nameTable[this.diagram._getChild(n[r])],!i&&t.parent&&(i=t.parent),t.parent&&t.parent!=i)return!1;return!0},i.prototype._anyFromContainer=function(n){for(var i=null,t=null,r=0;r<n.length;r++)if(i=this.diagram.nameTable[this.diagram._getChild(n[r])],i.parent&&(t=this.diagram.nameTable[i.parent]),t&&t.container&&t.container.type==="canvas")return!0;return!1},i.prototype._processCtrlKey=function(i){var s,r,e,b,l,f,u;if(this.diagram.selectionList.length>0&&t.datavisualization.Diagram.Util.canDoMultipleSelection(this.diagram)){var o=this.diagram.selectionList,a,f,c,v=[],y=[],p=[];o[0].type=="pseudoGroup"?(a=!0,s=this._findNodeUnderMouse(i)):s=this._findNodeUnderMouse(i);var w=this._findNodeUnderMouse(i,!0),k=this.selectedObject,h=this._raiseEvent("itemClick",{element:this.selectedObject,actualObject:this.actualObject,selectedObject:w,cancel:!1,event:i});if(this._itemClick(this.selectedObject,this.actualObject,w),h.cancel&&(this.selectedObject=k),this.actualObject)if(this.actualObject.parent)a?(r=o[0],e=this._getProcessedObject(this.actualObject.name),e?(this.selectedObject?(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,this.selectedObject.name)):e.remove&&(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,e.remove.name)),this.selectedObject?this._hasMultipleSelection(this.selectedObject)||r.children.push(this.selectedObject.name):e.add&&(this._hasMultipleSelection(e.add)||r.children.push(e.add.name))):(f=this.actualObject,this.selectedObject?this._hasMultipleSelection(this.selectedObject)?(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,this.selectedObject.name)):r.children.push(this.selectedObject.name):this._hasMultipleSelection(f)?(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,f.name)):r.children.push(f.name)),t.datavisualization.Diagram.Util._updateGroupBounds(r,this.diagram),r.children.length<=1?(b=this.diagram.nameTable[this.diagram._getChild(r.children[0])],this.diagram._hasSelection()&&this.diagram._clearSelection(!0),this.selectedObject=b,this.diagram._addSelection(this.selectedObject)):(this.selectedObject=o[0],this.diagram.updateSelection())):(this.diagram.selectionList[0]._type==="group"&&this.diagram.selectionList[0].type!=="bpmn"?(o=this.diagram.selectionList[0],e=this._getProcessedObject(this.actualObject.name),f=e.add,e&&this.diagram._hasSelection()&&this.diagram._clearSelection()):(e=null,s._type==="group"&&(e=this._getProcessedObject(this.actualObject.name)),f=e?e.add:s,o=this.diagram.selectionList[0],this.diagram._hasSelection()&&this.diagram._clearSelection()),this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Keydown,u=t.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),o.name!=f.name&&u.children.push(o.name),this.selectedObject?u.children.push(this.selectedObject.name):this._containsChild(u,f.name)&&u.children.push(f.name),this._checkRepeatedChild(u.children),this.diagram.nodes().push(u),this.diagram._nodes=n.extend(!0,[],this.diagram.nodes()),this.diagram.nameTable[u.name]=u,t.datavisualization.Diagram.Util._updateGroupBounds(u,this.diagram),this.selectedObject=u,this.diagram._addSelection(this.selectedObject));else if(a){for(r=o[0],f=this.selectedObject?this.selectedObject:this.actualObject,c=this._hasMultipleSelection(f)?"remove":"insert",c=="insert"?(r.children.push(f.name),v.push(f)):(t.datavisualization.Diagram.Util.removeItem(r.children,f.name),y.push(f)),l=0;l<r.children.length;l++)p.push(this.diagram.nameTable[r.children[l]]);h={changeType:c,state:"changing",element:this.diagram.nameTable.multipleSelection,selectedItems:p,oldItems:y,newItems:v,cancel:!1};this._raiseEvent("selectionChange",h);h.cancel||(c=="remove"&&t.datavisualization.Diagram.Util.removeItem(this.diagram.model.selectedItems.children,f),this.diagram.updateSelection(this.selectedObject),t.datavisualization.Diagram.Util._updateGroupBounds(r,this.diagram),this.selectedObject=o[0],this.diagram.model.selectedItems.children.length?t.datavisualization.Diagram.SvgContext.updateSelector(this.selectedObject,this.diagram._adornerSvg,this.diagram._currZoom,this.diagram,this.diagram.model.selectedItems.constraints):(t.datavisualization.Diagram.Util.clear(this.diagram.selectionList),t.datavisualization.Diagram.SvgContext.clearSelector(this.diagram._adornerSvg,this.diagram._adornerLayer)),h={changeType:c,state:"changed",element:this.diagram.nameTable.multipleSelection,selectedItems:p,oldItems:y,newItems:v,cancel:!1},this._raiseEvent("selectionChange",h))}else f=this.actualObject,this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Keydown,o=this.diagram.selectionList[0],f!=o&&(this.diagram._hasSelection()&&this.diagram._clearSelection(!0),u=t.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),u.children.push(o.name),this.selectedObject?u.children.push(this.selectedObject.name):u.children.push(f.name),this.diagram.nodes().push(u),this.diagram._nodes=n.extend(!0,[],this.diagram.nodes()),this.diagram.nameTable[u.name]=u,t.datavisualization.Diagram.Util._updateGroupBounds(u,this.diagram,null,!0),this.selectedObject=u,this.diagram._addSelection(this.selectedObject));this.selectedObject=this.diagram.selectionList[0]}else s=this._findNodeUnderMouse(i),this.selectedObject=s;return s},i.prototype._checkRepeatedChild=function(i){for(var e=null,r=n.extend(!0,{},i),u,r=this.diagram._getChildren(r),f=0;f<r.length;f++)if(e=this.diagram.nameTable[r.children[f]],e._type==="group")for(u=0;u<r.children.length;u++)this._containsChild(e,r.children[u])||(i.children=this.diagram._getChildren(i.children),t.datavisualization.Diagram.Util.removeItem(i.children,r.children[u]))},i.prototype._hasMultipleSelection=function(n){for(var i=this.diagram._getChildren(this.diagram.selectionList[0].children),t=0;t<i.length;t++)if(n.name==i[t])return!0;return!1},i.prototype._getNextParent=function(n){if(n.parent){var t=this.diagram.nameTable[n.parent];return this._hasMultipleSelection(t)?n:this._getNextParent(t)}return n},i.prototype._findObj=function(n,t){var r,u=n.getAttribute("id"),i;return t?r=this.diagram._findChildren(t,u):(i=n.getAttribute("class"),i&&(i==="ej-d-node"||i==="ej-d-group"?r=this.diagram._findNode(u):i==="ej-d-connector"&&(r=this.diagram._findConnector(u)))),r},i.prototype.mousedown=function(n){this.startPoint=this.mousePosition(n);this.currentPoint=this.startPoint;this.previousPoint=this.startPoint;this.diagramBounds=this.diagram._getDigramBounds()},i.prototype.mousemove=function(n){(!t.datavisualization.Diagram.Geometry.isEmptyPoint(this.startPoint)||this instanceof t.datavisualization.Diagram.LineTool)&&(this.currentPoint=this.mousePosition(n))},i.prototype.mouseup=function(){this._endAction();this.diagram._pageBackgroundLayer&&t.datavisualization.Diagram.PageUtil._updatePageSize(this.diagram);this.singleAction&&this.diagram.activateTool("select");delete this.diagramBounds;this._adjustLines={lines:[]};this._undoObject=null;this._redoObject=null},i.prototype.mousePosition=function(n){return this.diagram._mousePosition(n)},i.prototype.updateCursor=function(n){this.diagram._currentCursor=n;this.diagram._updateCursor()},i.prototype.nearestGridPoint=function(n){var i=t.datavisualization.Diagram.Point();if(this.diagram.model.snap&t.datavisualization.Diagram.Snap.Grid){var o=this.diagram.model.magnification/100,r=this.diagram.model.grid.horizontalSpacing*o,u=this.diagram.model.grid.verticalSpacing*o,f=n.x%r,e=n.y%u;i.x=f>=r/2?n.x+r-f:n.x-f;i.y=e>=u/2?n.y+u-e:n.y-e}return i},i.prototype.snap=function(n){var i=this.diagram.model.snapSettings,r=this.diagram._currZoom;return i.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines&&(n.x=t.datavisualization.Diagram.SnapUtil._round(n.x,i.verticalGridLines.snapInterval,r)),i.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines&&(n.y=t.datavisualization.Diagram.SnapUtil._round(n.y,i.horizontalGridLines.snapInterval,r)),n},i.prototype._endAction=function(){var i,r,s,u,h,f,o,c,e;if(this.inAction=!1,this.svgHelper)if(i=this.helper,r=this.diagram._spatialSearch,i._type!="group")t.datavisualization.Diagram.SpatialUtil._removeFromaQuad(r,r.quadTable[i.name],i);else for(s=this.helper.children.length-1,u=s;u>=0;u--)t.datavisualization.Diagram.SpatialUtil._removeFromaQuad(r,r.quadTable[i.children[u].name],i.children[u]);this.helper&&(this.svgHelper&&(h=this.diagram,f=this,this.diagram._views.forEach(function(t){var r=h._views[t];if(f.helper)var i=r.svg.getElementById(f.helper.name),u=r.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],e=n(u).find("#"+f.helper.name)[0];i&&i.parentNode&&i.parentNode.removeChild(i);e&&u.removeChild(e)})),this.helper.gradient&&(o=this.diagram._svg.getElementsByTagName("defs")[0],c=this.diagram._svg.getElementById(this.helper.name+"_gradient"),o&&c&&o.removeChild(this.diagram._svg.getElementById(this.helper.name+"_gradient"))),e=document.getElementById(this.helper.name+"_parentdiv"),e&&e.parentNode.removeChild(e));this._previousPossibleConnection&&(this._previousPossibleConnection=null,t.datavisualization.Diagram.SvgContext._removePortHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer));this._currentPossibleConnection=null;this._possibleConnectionPort=null;this.helper=null;this.svgHelper=null;this.selectedObject=null;this.startPoint=t.datavisualization.Diagram.Point(0,0);this.currentPoint=t.datavisualization.Diagram.Point(0,0);this.previousPoint=t.datavisualization.Diagram.Point(0,0)},i.prototype._isResizeCorner=function(n){var t=!1;switch(n){case"n-resize":case"e-resize":case"w-resize":case"s-resize":case"ne-resize":case"nw-resize":case"se-resize":case"sw-resize":case"targetEndPoint":case"sourceEndPoint":t=!0}return t},i.prototype._initHelper=function(){this.selectedObject&&(this.helper=n.extend(!0,{},this.selectedObject),this._updateHelperName(this.helper))},i.prototype._updateHelperName=function(n,t){var u,i,r,f,e;for(t?n.name+="helper":n.name="helper",n.opacity=.5,u=n.labels,i=0,r=u.length;i<r;++i)u[i].name+="helper";if(n.ports)for(f=n.ports,i=0,r=f.length;i<r;++i)f[i].name+="helper";if(n._type==="group")for(e=this.diagram._getChildren(n.children),i=0,r=e.length;i<r;i++)this._updateHelperName(e[i],!0)},i.prototype._raiseEvent=function(n,t){return this.diagram.model[n]&&(t.elementType=this.diagram.getObjectType(t.element),t.diagramId=this.diagram.element[0].id,this.diagram._trigger(n,t)),t},i.prototype._findPort=function(n,t){var f=this.diagram._findPortAtPoint(n,t),r,e,u,i;if(!f&&t._type==="group")for(e=this.diagram._getChildren(t.children),u=0;u<e.length;u++)if(i=this.diagram.nameTable[e[u]],i&&!i.segments&&!i._isInternalShape)if(r=this._findPort(n,i),r&&this.diagram.getObjectType(i)!="group")this._currentPossibleConnection=i,f=r;else if(r)return r;return f},i.prototype._checkConnectionPossible=function(n){var r=null,o=null,s=this._sourcePossibleConnection,b=t.datavisualization.Diagram.Point(this.currentPoint.x,this.currentPoint.y),i=this.diagram._findConnectableNodeUnderMouse(n),e,a,v,u,h,c,f,p;if(i&&(this._sourcePossibleConnection||this.selectedObject)&&(this.selectedObject&&(this._endPoint=="targetEndPoint"&&this.selectedObject.sourceNode&&(s=this.diagram.nameTable[this.selectedObject.sourceNode]),this._endPoint=="sourceEndPoint"&&this.selectedObject.targetNode&&(s=this.diagram.nameTable[this.selectedObject.targetNode])),this.selectedObject&&!this.selectedObject._isAnnotationLine&&(i=t.datavisualization.Diagram.bpmnHelper.canAllowConnection(this.diagram,s,i))),i&&!i.segments)i.type=="pseudoGroup"||i.isLane||i.isSwimlane?(this._currentPossibleConnection=null,this._possibleConnectionPort=null):(this._showPorts(i),this._currentPossibleConnection=i,(this._previousPossibleConnection==null||this._previousPossibleConnection.name!==this._currentPossibleConnection.name)&&(this._previousPossibleConnection=this._currentPossibleConnection));else if(this.diagram.activeTool instanceof t.datavisualization.Diagram.LineTool)this._showPorts(),this._currentPossibleConnection=null,this._possibleConnectionPort=null;else{for(e=t.datavisualization.Diagram.Point(0,0),this._endPoint=="targetEndPoint"?(e.x=this.selectedObject.targetPoint.x-25,e.y=this.selectedObject.targetPoint.y-25):this._endPoint=="sourceEndPoint"&&(e.x=this.selectedObject.sourcePoint.x-25,e.y=this.selectedObject.sourcePoint.y-25),a=t.datavisualization.Diagram.Rectangle(e.x,e.y,50,50),v=t.datavisualization.Diagram.SpatialUtil.findQuads(this.diagram._spatialSearch,a),u=0;u<this._nearestNodes.length;u++)this._showPort(this._nearestNodes[u],!0);for(this._nearestNodes=[],u=0;u<v.length;u++)if(h=v[u],h.objects.length>0)for(c=0;c<h.objects.length;c++)f=h.objects[c],p=t.datavisualization.Diagram.Util.bounds(f),t.datavisualization.Diagram.Geometry.intersectsRect(a,p)?!f.segments&&f.visible&&(this._showPort(f),this._nearestNodes.push(f)):f.segments||this._showPort(f,!0);this._currentPossibleConnection=null;this._possibleConnectionPort=null}if(this._currentPossibleConnection){if(r=this._findPort(b,this._currentPossibleConnection),this._currentPossibleConnection&&(this._sourcePossibleConnection||this.selectedObject)&&this.selectedObject&&!this.selectedObject._isAnnotationLine&&(o=t.datavisualization.Diagram.bpmnHelper.canAllowConnection(this.diagram,s,this._currentPossibleConnection),this._currentPossibleConnection!=o&&(this._showPort(this._currentPossibleConnection,!0),o&&this._showPort(o),r=null),this._currentPossibleConnection=o),r&&t.datavisualization.Diagram.Util.canConnect(r,!0)||t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection)?t.datavisualization.Diagram.SvgContext._drawPortHighlighter(r,this._currentPossibleConnection,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom):t.datavisualization.Diagram.SvgContext._removePortHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),this._possibleConnectionPort=r,r&&t.datavisualization.Diagram.Util.canConnect(r,!0)){var l=this._currentPossibleConnection,y=t.datavisualization.Diagram.Util._getPortPosition(this._possibleConnectionPort,t.datavisualization.Diagram.Util.bounds(l,!0)),w=t.Matrix.identity();t.Matrix.rotate(w,l.rotateAngle,l.offsetX,l.offsetY);y=t.Matrix.transform(w,y);this.currentPoint=y}}else this._previousPossibleConnection&&(this._previousPossibleConnection=null,t.datavisualization.Diagram.SvgContext._removePortHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),this._possibleConnectionPort=null)},i.prototype._showPorts=function(n){n?(this._currentPossibleConnection&&this._currentPossibleConnection.name!==n.name&&this._showPort(this._currentPossibleConnection,!0),this._showPort(n)):this._currentPossibleConnection!=null&&this._showPort(this._currentPossibleConnection,!0)},i.prototype._showPort=function(n,i){var r,u,e,f,o;if(i){if(r=n.ports,r)for(f=0,o=r.length;f<o;++f)u=r[f],(u.visibility&t.datavisualization.Diagram.PortVisibility.Hover||u.visibility&t.datavisualization.Diagram.PortVisibility.Connect&&(this.name=="endPoint"||this instanceof t.datavisualization.Diagram.LineTool))&&(e=this.diagram._svg.getElementById(n.name+"_"+u.name),e&&e.setAttribute("visibility","hidden"))}else if(n.visible&&(r=n.ports,r))for(f=0,o=r.length;f<o;++f)u=r[f],(u.visibility&t.datavisualization.Diagram.PortVisibility.Hover||u.visibility&t.datavisualization.Diagram.PortVisibility.Connect&&(this.name=="endPoint"&&this.inAction||this instanceof t.datavisualization.Diagram.LineTool))&&(e=this.diagram._svg.getElementById(n.name+"_"+u.name),e&&e.setAttribute("visibility","visible"))},i.prototype._getAllLaneChildren=function(n,t){var i=this.diagram.getNode(n.name),r,u;if(i&&i.lanes&&i.lanes.length>0)for(r=0;r<i.lanes.length;r++)for(u=0;u<i.lanes[r].children.length;u++)t.push(i.lanes[r].children[u]);return t},i.prototype._getAllChildren=function(n){for(var t=0;t<n.length;t++)n[t].isSwimlane&&n.concat(this._getAllLaneChildren(n[t],n));return n},i.prototype._showAllPorts=function(n){var i,u,r=this.diagram.nodes();if(r=this._getAllChildren(r),t.datavisualization.Diagram.Util.isPageEditable(this.diagram)||(n=!0),n)for(i=0,u=r.length;i<u;i++)this._showPort(r[i],n);else for(i=0,u=r.length;i<u;++i)this._showPort(r[i])},i.prototype._disconnect=function(n){var r,i=this.diagram.nameTable[n.targetNode],u=null;i&&(u=t.datavisualization.Diagram.Util.findPortByName(i,n.targetPort),r=this._raiseEvent("connectionChange",{element:n,connection:i,port:u,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(i.inEdges,n.name),r.cancel||(n.targetNode=null,n.targetPort=null));i=this.diagram.nameTable[n.sourceNode];i&&(u=t.datavisualization.Diagram.Util.findPortByName(i,n.sourcePort),r=this._raiseEvent("connectionChange",{element:n,connection:i,port:u,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(i.outEdges,n.name),r.cancel||(n.sourceNode=null,n.sourcePort=null))},i.prototype.getLabelUnderMouse=function(){return this.diagram._findLabelEditing?null:this.activeLabel},i}();t.datavisualization.Diagram.ToolBase=i;u=function(i){function r(n){i.call(this,"select",n);this.cursor="default";this._svgHelper=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){i.prototype.mousedown.call(this,n);var r=this._findNodeUnderMouse(n);this.selectedObject=r&&t.datavisualization.Diagram.Util.canSelect(r)?r:null;this._itemClick(this.selectedObject,this.actualObject,this.selectedObject);this._nodeUnderMouseDown=this.diagram._findNodeUnderMouse(n)},r.prototype.mousemove=function(n){i.prototype.mousemove.call(this,n);var r=this._nodeUnderMouseDown;(!this.selectedObject&&!t.datavisualization.Diagram.Geometry.isEmptyPoint(this.startPoint)||r&&r.isLane&&t.datavisualization.Diagram.Util.canMultiSelectOnLane(r)||r&&r._type!="connector"&&t.datavisualization.Diagram.Util.canMultiSelectOnNode(r))&&t.datavisualization.Diagram.Util.canDoMultipleSelection(this.diagram)&&(this.inAction||this.startPoint.x==this.currentPoint.x&&this.startPoint.y==this.currentPoint.y?this._updateHelper():(this.inAction=!0,this._initHelper()))},r.prototype.mouseup=function(r){var o,u,s,f,e,h,l,c;if(this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Mouse,this.inAction)if(this.currentPoint=this.mousePosition(r),o=t.datavisualization.Diagram.Geometry.rect([{x:this.startPoint.x,y:this.startPoint.y},{x:this.currentPoint.x,y:this.currentPoint.y}]),o.width!==0||o.height!==0){if(u=[],u=this.diagram._getNodesfrombounds(o),this.diagram._hasSelection()&&(u=this.diagram._getChildren(u),t.datavisualization.Diagram.Util.removeItem(u,"multipleSelection"),this.diagram._clearSelection(u.length?!0:!1)),u.length>0){if(s=u,this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.RubberBand,s.length>1){for(e=t.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),h=0;h<s.length;h++)e.children.push(this.diagram._getChild(s[h]));this.diagram.nodes().push(e);this.diagram._nodes=n.extend(!0,[],this.diagram.nodes());this.diagram.nameTable[e.name]=e;f=e}else t.datavisualization.Diagram.Util.canDoSingleSelection(this.diagram)&&(f=u[0]);f&&((f._type==="group"||f.type==="pseudoGroup")&&t.datavisualization.Diagram.Util._updateGroupBounds(f,this.diagram),this.diagram._addSelection(f))}}else this.diagram._hasSelection()&&!this.diagram._isDropped&&this.diagram._clearSelection();else this.selectedObject||this.diagram._hasSelection()?(r.ctrlKey||r.shiftKey?t.datavisualization.Diagram.Util.canDoMultipleSelection(this.diagram)&&this._processCtrlKey(r):this.diagram._hasSelection()&&(!this.selectedObject||this.diagram.selectionList[0].name!=this.selectedObject.name)&&this.diagram._clearSelection(this.selectedObject?!0:!1),this.diagram._enableAPIMethods=!1,this.diagram._addSelection(this.selectedObject),this.diagram._enableAPIMethods=!0):this.diagram._hasSelection()&&!this.diagram._isDropped&&this.diagram._clearSelection();this.diagram._isDropped=!1;this._nodeUnderMouseDown=null;(this.selectedObject||this.actualObject)&&(l=this.selectedObject||this.actualObject,c=this.diagram._mousePosition(r.originalEvent),this._raiseEvent("click",{element:this.diagram.getNode(l),actualObject:this.actualObject,count:this.diagram._getEventDetail(r),offsetX:c.x,offsetY:c.y,event:r}));i.prototype.mouseup.call(this,r)},r.prototype._endAction=function(){this._svgHelper&&(this.diagram._adornerLayer.removeChild(this._svgHelper),this.selectedObject=null,this._svgHelper=null);i.prototype._endAction.apply(this)},r.prototype._initHelper=function(){var n,t,i;this._svgHelper||(n=this.diagram._adornerSvg.g(),this.diagram._adornerLayer.appendChild(n),t=this.diagram._currZoom,i=this.diagram._svg.rect({id:"helper","class":"rubberBandSelection",x:this.startPoint.x*t,y:this.startPoint.y*t,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"}),n.appendChild(i),n.setAttribute("pointer-events","none"),this._svgHelper=n)},r.prototype._updateHelper=function(){var t=this.diagram._adornerSvg.getElementById("helper"),i=Math.abs(this.startPoint.x-this.currentPoint.x),r=Math.abs(this.startPoint.y-this.currentPoint.y),n=this.diagram._currZoom,u=(this.startPoint.x>this.currentPoint.x?this.currentPoint.x:this.startPoint.x)*n,f=(this.startPoint.y>this.currentPoint.y?this.currentPoint.y:this.startPoint.y)*n;t&&this.diagram._adornerSvg.rect({id:t.id,x:u,y:f,width:i*n,height:r*n})},r.prototype._checkGroupChildren=function(n,i,r){for(var u,e,o=this.diagram._getChildren(i.children),f=0;f<o.length;f++)u=this.diagram.nameTable[o[f]],u&&t.datavisualization.Diagram.Util.canSelect(u)&&(e=t.datavisualization.Diagram.Util.bounds(u),t.datavisualization.Diagram.Geometry.containsRect(r,e)&&n.indexOf(u)<0?n.push(u):u._type==="group"&&this._checkGroupChildren(n,u,r))},r}(i);t.datavisualization.Diagram.SelectTool=u;f=function(i){function r(n){i.call(this,"move",n);this.cursor="move";this._isMouseDown=!1;this.diffx=0;this.diffy=0;this.helper=null;this.hoverNode=null;this.stackOverNode=null;this.undoObject=[];this.activeLabel=null;this._canMoveLabel=!1;this.dragState=""}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){if(t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.diffx=0,this.diffy=0,this._allowPan(this.selectedObject,"mousedown",n),i.prototype.mousedown.call(this,n),this._isMouseDown=!0,this._canMoveLabel=!1,this.activeLabel=null,n)var r=this._findNodeUnderMouse(n);r&&!t.datavisualization.Diagram.Util.canSelect(r)?this.updateCursor("default"):this.diagram._currentCursor!="pointer"&&this.updateCursor(this.cursor);this._findLabelUnderMouse(n);this.dragState=t.datavisualization.Diagram.DragState.Starting},r.prototype.mousemove=function(r){var o,u,f,s,h,e,c;this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Mouse;this._allowPan(this.selectedObject,"mousemove",r);i.prototype.mousemove.call(this,r);t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);o=!this.inAction;this._isMouseDown&&!this.inAction&&(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y||this.diagram._selectedSymbol)&&(this.selectedObject||(this._updateSelectedObject(),this._itemClick(this.selectedObject,this.actualObject,this.diagram.model),this.selectedObject!=null&&(u=f=t.datavisualization.Diagram.Util.bounds(this.selectedObject),s={bounds:{x:f.x,y:f.y,width:f.width,height:f.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},h={bounds:{x:u.x,y:u.y,width:u.width,height:u.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},this.diagram.selectionList[0]!=this.selectedObject&&this.diagram._clearSelection(!0),this._raiseDragEvent({element:this.diagram.getNode(this.selectedObject),offset:{x:0,y:0},oldValue:s,newValue:h,cancel:!1}),e={},this.selectedObject&&(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(e=this.diagram._getChildTable(this.selectedObject,e)),c=n.extend(!0,{},{childTable:e,node:this.selectedObject}),this.undoObject=jQuery.extend(!0,{},c))));this._isMouseDown&&this.selectedObject&&t.datavisualization.Diagram.Util.canSelect(this.selectedObject)&&!this.diagram._isEditing&&(this.dragState=t.datavisualization.Diagram.DragState.Dragging,this.inAction||(this.inAction=!0,this._canMoveLabel||this.updateCursor("move"),this._updateSelection(),this.selectedObject.segments&&!this._canMoveLabel&&(t.datavisualization.Diagram.Util.isTargetConnected(this.selectedObject)||t.datavisualization.Diagram.Util.isSourceConnected(this.selectedObject))&&this._disconnect(this.selectedObject),t.datavisualization.Diagram.SvgContext._disableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram)),this._canMoveLabel?this._updateLabelXY(this.activeLabel,this.previousPoint,this.currentPoint):(this.diagram&&!this.diagram._isEditing&&this._containerMouseMove(r),this.helper||this._updateObject(),this.selectedObject.segments||this.selectedObject.isLane||this.diagram._renderTooltip(this.selectedObject,o),this.diagram._updateSelectionHandle(!0)));this.previousPoint=this.currentPoint;this._stackOverNode=this._findStackOverNode(this.helper,r);delete this.diagram._notAllow},r.prototype._updateSelectedObject=function(){var n=this.diagram._focusedElement;n&&(this.activeLabel&&!this.diagram._selectedSymbol&&(t.datavisualization.Diagram.Util.canMoveLabel(n)?this._canMoveLabel=!0:(this._disableLabel(n,this.activeLabel),this._canMoveLabel=!1)),this.diagram.selectionList[0]&&this.diagram.selectionList[0].type=="pseudoGroup"?this._canMoveLabel?(this.selectedObject=n,this.diagram._clearSelection(!0)):this.selectedObject=this.diagram.selectionList[0]:this.diagram.selectionList[0]!=n?(this.diagram._clearSelection(!0),this.selectedObject=this.diagram.nameTable[n.name]):this.selectedObject=this.diagram.nameTable[this.diagram.selectionList[0].name])},r.prototype._nodeCanHighlight=function(n){var t=!1;return this.diagram._getChildren(n.children).indexOf(this.selectedObject.name)==-1&&(this.selectedObject._type!="group"?t=!0:n._type==="group"&&(this._containsChild(this.selectedObject,n.name)||(t=!0))),t},r.prototype._swimlanPhaseDrag=function(){if(this.selectedObject&&this.selectedObject.isPhase){var n=null,i=this._getNodeUnderMouse();i&&(n=this._getSwimLaneNode(i,this.selectedObject,!0));n&&t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom)}},r.prototype._containerMouseMove=function(n){var i,f,r=this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent],u;r&&r.container?(u=r.container,(u.type=="canvas"||u.type=="stack")&&(t.datavisualization.Diagram.canvasHelper._updateHelper(this.diagram),t.datavisualization.Diagram.canvasHelper._updateHighlighter(this.diagram,n))):(this.selectedObject.isSwimlane||(this.selectedObject.type=="pseudoGroup"&&this._isParentAsLane(this.selectedObject)?this._removeHighLighter():this.isDiagram(n)||this.selectedObject.segments?!this.isDiagram(n)&&this.selectedObject.isPhase?t.datavisualization.Diagram.SvgContext._disableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram):this._removeHighLighter():(i=this._getNodeUnderMouse(),i&&i.container&&(this.selectedObject.isSwimlane||this.selectedObject.isLane)?this._getSwimLaneNode(i,this.selectedObject)&&this._nodeHighLighter(i):i&&i.container&&i.container.type!="stack"?(this.selectedObject.name!=i.name&&this.selectedObject.type!="pseudoGroup"&&t.datavisualization.Diagram.bpmnHelper.canAllowDropOnContainer(this.selectedObject,i)&&this._nodeHighLighter(i),i&&(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this._fromDiagram(this.selectedObject.children)&&this._nodeHighLighter(i)):i&&(this._removeHighLighter(),i.segments?t.datavisualization.Diagram.SvgContext._drawConnectorHighlighter(i,this.diagram,this.diagram._currZoom):this._nodeHighLighter(i)))),f||(this.selectedObject.type=="pseudoGroup"?this._fromDiagram(this.diagram._getChildren(this.selectedObject.children))?(this._undoObject||t.datavisualization.Diagram.Util._getUndoObject(this.diagram,this.selectedObject),this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)):(this._fromSameContainer(this.diagram._getChildren(this.selectedObject.children))&&this.hasSameParent()||this._anyFromContainer(this.diagram._getChildren(this.selectedObject.children)))&&(t.datavisualization.Diagram.canvasHelper._removeFromParentContainer(this.diagram,this.selectedObject),this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)):t.datavisualization.Diagram.Util.canMove(this.selectedObject)&&this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)));this._swimlanPhaseDrag(n)},r.prototype.isDiagram=function(n){return n.target.id==this.diagram._id+"_canvas_svg"||n.target.id.match(this.selectedObject.name)?!0:!1},r.prototype._allowPan=function(n,i,r){i==="mousedown"&&this.diagram.tools.panTool.mousedown(r);n&&(n._type==="group"||n._type=="node")&&n.constraints&t.datavisualization.Diagram.NodeConstraints.AllowPan&&(i==="mousemove"?this.diagram.tools.panTool.mousemove(r):i==="mouseup"&&this.diagram.tools.panTool.mouseup(r))},r.prototype._checkForDropEvent=function(n,i){var o;if(!this.diagram._selectedSymbol){var r=this.diagram,f=n,e=null,u=t.datavisualization.Diagram.ObjectTypes.Diagram;this.selectedObject&&this.selectedObject.parent&&(r=this.diagram.nameTable[this.selectedObject.parent],r.isLane?u=t.datavisualization.Diagram.ObjectTypes.Lane:r._type=="group"&&(u=t.datavisualization.Diagram.ObjectTypes.Group));n&&!i&&(e=t.datavisualization.Diagram.Util.bounds(n),f=this._getTargetNode(n,e));do if(n&&!t.datavisualization.Diagram.Util.canAllowDrop(n))if(n.parent)n=this.diagram.nameTable[n.parent];else if(n.container)break;else n=null;else break;while(n);if(n)return o=this._raiseEvent("drop",{cancel:!1,element:this.selectedObject,source:this.diagram.getNode(r),target:this.diagram.getNode(f),sourceType:u}),o.cancel}return!1},r.prototype._getSwimLaneNode=function(n,t,i){if(n.isSwimlane)if(i){if(this.diagram.nameTable[this.diagram._getChild(n.children[2])].container.orientation==t.orientation)return n}else if(this.diagram.nameTable[this.diagram._getChild(n.children[2])].container.orientation!=t.orientation)return n;if(n.parent){var r=this.diagram.nameTable[n.parent];if(r)return this._getSwimLaneNode(r,t,i)}return null},r.prototype._cloneGroupNode=function(t,i){var o=null,r,u,e,f;if(u=n.extend(!0,{},t),u.name+=i,t&&t._type==="group")for(u.children=[],e=this.diagram._getChildren(t.children),f=0;f<e.length;f++)o=this.diagram.nameTable[e[f]],r=n.extend(!0,{},o),r.name+=i,r.parent&&(r.parent+=i),r._type==="group"&&this._cloneGroupNode(r,i),this.diagram.nameTable[r.name]=r,u.children.push(r.name);return u},r.prototype._outOfBoundsLaneDrop=function(n,i){var r,o,s;if(n&&n.isLane&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var p=t.datavisualization.Diagram.Util.bounds(n),u=this._getPageBounds(),l=i.offsetX,a=i.offsetY,h=0,c=0,f=0,v=0,y=this.diagram.nameTable[i.children[2]],e=this.diagram.nameTable[i.children[0]];if((v=e?e.height:v,f=i.phaseSize?i.phaseSize:f,y&&(r=this.diagram.nameTable[y.children[0]],r&&(h=r.minHeight>100?r.minHeight:100,c=r.minWidth>100?r.minWidth:100)),n.orientation==="horizontal"?(o=c,s=h+e.height+f):(o=c+f,s=h+e.height),l+o/2+5>=u.width||l-o/2-5<=u.x)||a+s/2+5>=u.height||a-s/2-5<=u.y)return!1}return!0},r.prototype._getMouseOverElement=function(t,i){var r=null,h,e,f;if(t&&t.target)for(var o=n(t.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group,.ej-d-group ej-d-classifier,.ej-d-node ej-d-classifier,.ej-d-label ej-d-classifier"),u=o[0],s=1;u;)if(h=this.diagram._isForeignObject(t.target),r=h?this.diagram._findNode(u.getAttribute("id").split("_parentdiv")[0]):this.diagram._findNode(u.getAttribute("id")),r&&r.container)u=null;else{if(r&&i&&r._isHeader&&r.parent&&(e=this.diagram.nameTable[r.parent],e&&e.isSwimlane))break;u=o[s];!u&&r&&r.parent&&(f=this.diagram.nameTable[r.parent],f&&f.isLane&&(r=f));s++}return r},r.prototype._multiNodedrag=function(n){t.datavisualization.Diagram.canvasHelper&&!this._containsSwimlane(this.selectedObject.children)&&t.datavisualization.Diagram.canvasHelper._multiNodedrag(this.diagram,n,this.selectedObject)},r.prototype._changeNodeState=function(n,i,r){var a,o=null,u=this._getMouseOverElement(n,r),c,f,s,h,e,l;return u&&(u=this.selectedObject&&!this.selectedObject.isLane||u.isLane?u:null),this.diagram._selectedSymbol&&this.diagram._selectedSymbol.isLane&&!i?(this.diagram._isDragg=!0,u&&(o=this._getSwimLaneNode(u,this.selectedObject)),u&&o?t.datavisualization.Diagram.canvasHelper._addNewLane(this.diagram,u,o):(c=this.diagram.nameTable[this.selectedObject.children[0]],this.diagram._isUndo=!0,this.diagram.remove(this.selectedObject),t.datavisualization.Diagram.containerCommon._removeObject(this.diagram,this.selectedObject),this.diagram._selectedSymbol&&t.datavisualization.Diagram.containerCommon._removeObject(this.diagram,this.diagram._selectedSymbol),this.diagram._isUndo=!1,f=t.datavisualization.Diagram.SwimLaneHelper._createSwimlane(this.selectedObject,this.diagram,null,null,c),f&&(s={element:this.diagram.getNode(this.selectedObject),cancel:!1},this.diagram._selectedSymbol=null,this._outOfBoundsLaneDrop(this.selectedObject,f)?(this.diagram._raiseDropEvent(s),s.cancel?this.selectedObject=null:(this.diagram._eventCause.nodeCollectionChange=t.datavisualization.Diagram.CollectionChangeCause.Drop,this.diagram.add(f)?(f=this.diagram.nameTable[f.name]||f,this.diagram._selectedSymbol=f,this.diagram._updateDroppedSymbol(f),this.selectedObject=f):this.selectedObject=null)):this.selectedObject=null))):this.selectedObject&&this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent].container?(h=this.diagram.nameTable[this.selectedObject.parent],h&&(e=h.container,this._removeHelpers(),e&&e.type=="canvas"?(t.datavisualization.Diagram.SvgContext._showNode(this.selectedObject,this.diagram._svg),this.selectedObject.type=="pseudoGroup"||this.diagram._isDragg||(this._swimlaneNodeDragged=t.datavisualization.Diagram.canvasHelper._singleNodedrag(this.diagram,n,u))):e.type=="stack"?t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer):(this.isDiagram(n)&&this._addToDiagram(),this.diffx=this.diffy=0))):this.selectedObject&&!this.selectedObject.isSwimlane&&(this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()?(this.currentPoint=this.previousPoint,this.diffx=0,this.diffy=0,this._removeHelpers(),this._multiNodedrag(n,u)):(this.selectedObject.type!="connector"||this.selectedObject.isPhase)&&!this.isDiagram(n)&&this.selectedObject.type!="pseudoGroup"?(u=this._getMouseOverElement(n),this.diagram._isDragg||(u&&u.container&&t.datavisualization.Diagram.Util.canAllowDrop(u)&&!this._checkForDropEvent(u)&&!u.isSwimlane&&t.datavisualization.Diagram.bpmnHelper.canAllowDropOnContainer(this.selectedObject,u)?(l=this.helper?this.helper:this.selectedObject,t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this.diagram,l,u)?(t.datavisualization.Diagram.canvasHelper._addNodeToContainer(this.diagram,this.selectedObject,u),this.diagram._raiseGroupChangeEvent(this.selectedObject,null,u,"group")):(this.diagram._translate(this.selectedObject,this.undoObject.node.offsetX-this.selectedObject.offsetX,this.undoObject.node.offsetY-this.selectedObject.offsetY,this.diagram.nameTable),this.diagram._updateAssociatedConnectorEnds(this.selectedObject,this.diagram.nameTable))):u&&this.selectedObject.name!=u.name&&this._checkForDropEvent(u,!0))):this.selectedObject.type!="connector"||this.selectedObject.isPhase?(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this.diagram._activeSwimLane?(this._multiNodedrag(n,u),this.selectedObject=null):!this.diagram._activeSwimLane&&u&&u.isLane?(this.diagram._activeSwimLane=this._getParentSwimlane(u),this._multiNodedrag(n,u),this.selectedObject=null):u&&u.type=="bpmn"&&(this._multiNodedrag(n,u),this.selectedObject=null):u&&(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this._fromDiagram(this.selectedObject.children)&&t.datavisualization.Diagram.Util.canAllowDrop(u)&&(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),this._multiNodedrag(n,u))),this._removeHelpers(),this._checkPhaseDrop(n),a},r.prototype._checkPhaseDrop=function(n){var i=null,r,u,f,e,s,o;this.selectedObject&&this.selectedObject.isPhase&&(f=this._findNodeUnderMouse(n),f&&(i=this._getSwimLaneNode(f,this.selectedObject,!0)),i?(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),e=this._getSwimlaneHeader(i),this.selectedObject.orientation=="vertical"?(r=this.currentPoint.x-(i.offsetX-i.width/2),u="horizontal"):(r=this.currentPoint.y-(i.offsetY-i.height/2),r-=e?e.height:0,u="vertical"),s={element:this.selectedObject,cancel:!1,target:i},this.diagram._dropPhase=!0,this.diagram.remove(this.selectedObject),delete this.diagram._dropPhase,this.diagram._selectedSymbol=null,this.inAction=!1,o=this.selectedObject.labels&&this.selectedObject.labels.length>0?this.selectedObject.labels[0]:{text:"Phase"},this.diagram._addPhase(i.name,{name:t.datavisualization.Diagram.Util.randomId(),offset:r,orientation:u,label:o,lineColor:this.selectedObject.lineColor,lineDashArray:this.selectedObject.lineDashArray,lineWidth:this.selectedObject.lineWidth}),this.diagram._selectedSymbol=null):(this.diagram._remove(this.selectedObject),this.diagram._clearSelection(!0),this.selectedObject=null,this.diagram._selectedSymbol=null))},r.prototype._removeHelpers=function(){t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer);t.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this.diagram._adornerLayer,this.diagram._adornerSvg);this._removeHighLighter();this.diffx=0;this.diffy=0},r.prototype._updateNodeState=function(n,i){var f,u,o,h,c,e,r,a,l,s;this.diagram.nameTable[this.selectedObject.parent]&&(f=this.diagram.nameTable[this.selectedObject.parent].container);u=this._getNodeUnderMouse();u&&(u=!this.selectedObject.isLane||u.isLane?u:null);f?f.type=="canvas"?u&&i&&(o=this.selectedObject.parent,h=this.diagram._getSwimlane(o),h&&this.diagram._updateChildAdjacentConnectors(h,!0),t.datavisualization.Diagram.DiagramContext.update(i,this.diagram)):f.type=="stack"&&(c=this._checkForDropEvent(u),c||(e=this._stackOverNode,e?(r=this.diagram.nameTable[e.parent],r||(r=u),a=t.datavisualization.Diagram.Util.bounds(r),l=r.rotateAngle,r.rotateAngle==0||l!=0||this.diagram._rotate(r,-r.rotateAngle,this.diagram.nameTable),r.children=this.diagram._getChildren(r.children),this.selectedObject.name!=e.name&&(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.canvasHelper._swapLane(this.diagram,r.children,this.selectedObject.name,e.name,r.container.orientation==="vertical"?!0:!1,r))):this.diffx=this.diffy=0)):this.selectedObject.type=="pseudoGroup"&&(s=this.diagram.nameTable[this.diagram._getChild(this.selectedObject.children[0])],s&&s.parent&&(f=this.diagram.nameTable[s.parent].container),f&&f.type=="canvas"&&u&&i&&(o=this.selectedObject.parent,this.diagram._updateChildAdjacentConnectors(o,!0),t.datavisualization.Diagram.DiagramContext.update(i,this.diagram)))},r.prototype.mouseup=function(r,u){var y=this.inAction,f,c,e,o,p,w,b,k,s,d,g,l,it,a,nt,h,v;if(t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Mouse,this.inAction?(this.dragState=t.datavisualization.Diagram.DragState.Completed,t.datavisualization.Diagram.SvgContext._enableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram),this._canMoveLabel||(c=this._changeNodeState(r,u,!0)),this.inAction=!1,this.selectedObject&&(this._canMoveLabel?this._updateLabelXY(this.activeLabel,this.previousPoint,this.currentPoint):(e=o=t.datavisualization.Diagram.Util.bounds(this.selectedObject),p={bounds:{x:o.x,y:o.y,width:o.width,height:o.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},w={bounds:{x:e.x,y:e.y,width:e.width,height:e.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},this.selectedObject.isLane||(this._swimlaneNodedragged||(b=this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)),this.selectedObject&&this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent].container&&c||(this._raiseDragEvent({element:this.diagram.getNode(this.selectedObject),offset:{x:0,y:0},oldValue:p,newValue:w,cancel:!1}),this.dragState=""))),u||this._updateNodeState(r,c),this._updateObject(),s={},(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(s=this.diagram._getChildTable(this.selectedObject,s)),this.diagram._selectedSymbol||this.selectedObject.isPhase||this.selectedObject.isLane||this._isLane||this.diagram._isDragg||(d={childTable:s,node:this.selectedObject},k=n.extend(!0,{},d),g={type:"positionchanged",undoObject:jQuery.extend(!0,{},this.undoObject),redoObject:jQuery.extend(!0,{},k),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"},this._multipleUndo||this.diagram.addHistoryEntry(g),this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent].type=="bpmn"&&this.diagram._isGroupActionEnabled&&(this.diagram._closeGroupAction(),delete this.diagram._isGroupActionEnabled)),this.diagram._selectedSymbol&&this.diagram._selectedSymbol.isSwimlane&&(this.diagram._selectedSymbol=null),this.diagram._updateSelectionHandle(),f=this.selectedObject,this._isLane=!1,this._multipleUndo=!1)):this.selectedObject?f=this._findNodeUnderMouse(r):(r.ctrlKey||r.shiftKey?f=this._processCtrlKey(r):(l=!0,it=r.target.className,a=t.datavisualization.Diagram.Util.isClassifier(r)?t.datavisualization.Diagram.ClassifierHelper.getSelectableElementUnderMouse(r,this.diagram):this._findNodeUnderMouse(r),r.which===3&&this.diagram.selectionList[0]&&(this.diagram.selectionList[0].type==="pseudoGroup"||this.diagram.selectionList[0]._type==="group")&&this._hasMultipleSelection(a)&&(l=!1),t.datavisualization.Diagram.Util.canDoSingleSelection(this.diagram)&&this._isMouseDown&&(this.selectedObject=l?a:this.diagram.selectionList[0]),f=this.selectedObject),nt=this.diagram.selectionList.length>0?this.diagram.selectionList[0]:null,this.selectedObject&&!this.diagram._selectionContains(this.selectedObject)&&this.diagram._clearSelection(!0)),!b&&this.selectedObject){if(this.selectedObject&&this.selectedObject.type!="pseudoGroup"&&!y){var tt=this._findNodeUnderMouse(r,!0),rt=this.selectedObject,ut=this._raiseEvent("itemClick",{element:this.selectedObject,actualObject:this.actualObject,selectedObject:tt,model:this.diagram.model,cancel:!1,event:r});this._itemClick(this.selectedObject,this.actualObject,tt,nt);ut.cancel&&(this.selectedObject=rt)}this.selectedObject&&(this._allowPan(this.selectedObject,"mouseup",r),this.selectedObject.isPhase||this._updateSelection(),this._enableLabel(this.selectedObject,this.activeLabel),this.selectedObject&&this.selectedObject.parent===""&&(this.selectedObject.isSwimlane?(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this.diagram,this.selectedObject)):t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),h=this.selectedObject,this.diagram._isDragg&&!this.diagram._selectionContains(h)&&(this.diagram._clearSelection(),h.isPhase||this.diagram._addSelection(h))));f&&!y&&(v=this.diagram._mousePosition(r.originalEvent),this._raiseEvent("click",{element:this.diagram.getNode(f),actualObject:this.diagram.getNode(this.actualObject),count:this.diagram._getEventDetail(r),offsetX:v.x,offsetY:v.y,event:r}))}this._multipleUndo=!1;delete this.diffx;delete this.diffy;delete this._isMouseDown;delete this.actualObject;delete this._swimlaneNodedragged;this.diagram._removeTooltip();this.diagram._isEditing||this.diagram._isDragg||this.diagram._endEdit();delete this.hoverNode;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);this.diagram._activeSwimLane=null;i.prototype.mouseup.call(this,r)},r.prototype._updateObject=function(){var i,r,n,u;if(this.selectedObject)if(this.selectedObject.type=="pseudoGroup")for(r=this.diagram._getChildren(this.selectedObject.children),n=0,u=r.length;n<u;n++)i=this.diagram.nameTable[r[n]],i&&t.datavisualization.Diagram.DiagramContext.update(i,this.diagram);else this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),this.selectedObject.isSwimlane?(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this.diagram,this.selectedObject)):t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram)},r.prototype._endAction=function(){i.prototype._endAction.apply(this);this._isMouseDown=!1;this._mouseOffset=t.datavisualization.Diagram.Size(0,0)},r.prototype._updateHelperXY=function(n,i,r){var a=r.x<i.x,v=r.y<i.y,o=this.diffx+(r.x-i.x),s=this.diffy+(r.y-i.y),u,f,c,e,l,h;(this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines||this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines)&&this.diagram._enableSnapToObject()&&(u=t.datavisualization.Diagram.SnapUtil._snapPoint(this.diagram,this.helper,a,v,t.datavisualization.Diagram.Point(o,s),r,i));u||(u=t.datavisualization.Diagram.Point(o,s));this.diffx=o-u.x;this.diffy=s-u.y;t.datavisualization.Diagram.Geometry.isEmptyPoint(u)||(f=t.datavisualization.Diagram.Util.bounds(n),f=t.datavisualization.Diagram.Rectangle(f.left,f.top,f.right-f.left,f.bottom-f.top),c={bounds:{x:f.x,y:f.y,width:f.width,height:f.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},this._outOfBoundsDrag(n,u.x,u.y)&&this.diagram._translate(n,u.x,u.y,this.diagram.nameTable),e=t.datavisualization.Diagram.Util.bounds(n),e=t.datavisualization.Diagram.Rectangle(e.left,e.top,e.right-e.left,e.bottom-e.top),l={bounds:{x:e.x,y:e.y,width:e.width,height:e.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},h=this._raiseDragEvent({element:this.diagram.getNode(this.helper),offset:u,oldValue:c,newValue:l,cancel:!1}),h&&!h.cancel?this.inAction||n._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram):this.diagram._translate(n,-u.x,-u.y,this.diagram.nameTable))},r.prototype._outOfBoundsDrag=function(n,i,r,u){var f,e,o;if(i=i?i:0,r=r?r:0,n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)&&(f=t.datavisualization.Diagram.Util.bounds(n),e=this._getPageBounds(),u&&(i=u==="horizontal"?0:i,r=u==="vertical"?0:r),f)){if(o=this._getPadding(n),n.isPhase)return!0;if((!this.diagram._selectedSymbol||this._skipSelectedSymbol)&&(f.right+i+o.x>e.width||f.left+i-o.x<e.x)||(!this.diagram._selectedSymbol||this._skipSelectedSymbol)&&(f.bottom+r+o.y>e.height||f.top+r-o.y<e.y))return this.updateCursor("not-allowed"),!1}return this.diagram._notAllow||this.updateCursor("move"),!0},r.prototype._updateXY=function(n,i,r,u){var v=r.x<i.x,y=r.y<i.y,h=this.diffx+(r.x-i.x),c=this.diffy+(r.y-i.y),f,s,e,l,o,a;if((this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines||this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines||this.diagram._enableSnapToObject())&&(f=t.datavisualization.Diagram.SnapUtil._snapPoint(this.diagram,this.selectedObject,v,y,t.datavisualization.Diagram.Point(h,c),r,i)),f||(f=t.datavisualization.Diagram.Point(h,c)),this.diffx=h-f.x,this.diffy=c-f.y,(!t.datavisualization.Diagram.Geometry.isEmptyPoint(f)||this.diagram._selectedSymbol&&!this.inAction)&&(e=t.datavisualization.Diagram.Util.bounds(n),e=t.datavisualization.Diagram.Rectangle(e.left,e.top,e.right-e.left,e.bottom-e.top),l={bounds:{x:e.x,y:e.y,width:e.width,height:e.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},n.segments||t.datavisualization.Diagram.Util.canAllowPan(n)&&(this.diagram._hScrollOffset===0&&(f.x=0),this.diagram._vScrollOffset===0&&(f.y=0)),u&&!n.isSwimlane&&n.type!="pseudoGroup"&&(this.diagram._preventDocking=!0),this._outOfBoundsDrag(n,f.x,f.y))){if(this.diagram._raiseOffsetPropertyChange(n,f.x,f.y,!0),this.diagram._translate(n,f.x,f.y,this.diagram.nameTable),delete this.diagram._preventDocking,o=t.datavisualization.Diagram.Util.bounds(n),o=t.datavisualization.Diagram.Rectangle(o.left,o.top,o.right-o.left,o.bottom-o.top),a={bounds:{x:o.x,y:o.y,width:o.width,height:o.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},this.diagram._selectedSymbol){if(s={element:this.diagram.getNode(this.selectedObject),allowDrop:!0,target:this._getNodeUnderMouse(),oldValue:l,newValue:a,cancel:!1},s.target&&s.target.segments&&t.datavisualization.Diagram.SvgContext._drawConnectorHighlighter(s.target,this.diagram,this.diagram._currZoom),this._raiseEvent("dragOver",s),s.allowDrop)this.diagram._notAllow||this.updateCursor("move");else if(this.updateCursor("not-allowed"),!this.inAction)return this.diagram._removeSymbolFromDiagram(),!0}else s=this._raiseDragEvent({element:this.diagram.getNode(this.selectedObject),offset:f,oldValue:l,newValue:a,cancel:!1});s&&!s.cancel||this.diagram._selectedSymbol?(n._type==="group"&&n.type!="bpmn"||n.type==="pseudoGroup")&&t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram):s&&s.cancel&&this.diagram._translate(n,-f.x,-f.y,this.diagram.nameTable)}},r.prototype._updateLabelXY=function(n,i,r){var u=r.x-i.x,f=r.y-i.y,e,o,s;this.selectedObject.segments||(e=t.Matrix.identity(),t.Matrix.rotate(e,-this.selectedObject.rotateAngle),o=t.Matrix.transform(e,t.datavisualization.Diagram.Point(u,f)),u=o.x,f=o.y);this.diagram._translateLabel(this.selectedObject,n,u,f);s=this._raiseDragEvent({element:this.diagram.getNode(n),offset:n.offset,cancel:!1});s&&s.cancel&&this.diagram._translateLabel(this.selectedObject,n,-u,-f)},r.prototype._raiseDragEvent=function(n){if(!this.diagram._selectedSymbol&&!this.diagram._isDragg)return n.dragState=this.dragState,this._raiseEvent("drag",n)},r.prototype._updateSelection=function(){this.diagram._selectionContains(this.selectedObject)||(this.diagram._clearSelection(!0),this.diagram._addSelection(this.selectedObject))},r.prototype._disableLabel=function(t,i){if(t&&i){var u=this.diagram._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],f=t._shape=="text"?t.name:t.name+"_"+i.name,r=n(u).find("#"+f+".ej-d-label")[0];r&&(r.style.pointerEvents="none")}},r.prototype._enableLabel=function(t,i){if(t&&i){var u=this.diagram._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],f=t._shape=="text"?t.name:t.name+"_"+i.name,r=n(u).find("#"+f+".ej-d-label")[0];r&&(r.style.pointerEvents="all")}},r}(i);t.datavisualization.Diagram.MoveTool=f;e=function(i){function r(n){i.call(this,"resize",n);this.cursor="default";this._resizeDirection=null;this._mouseOffset=t.datavisualization.Diagram.Size(0,0);this.diffx=0;this.diffy=0;this._startPoint=t.datavisualization.Diagram.Size(0,0);this.undoObject=null;this.pseudoGroupConstraints=null;this._mouseDown=!1;this.resizeState=""}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);i.prototype.mousedown.call(this,n);this._mouseDown=!0;this.resizeState=t.datavisualization.Diagram.ResizeState.Starting},r.prototype.mousemove=function(r){var h,c,e,u,f,l,a,v,o,s;i.prototype.mousemove.call(this,r);h=!this.inAction;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);!this.inAction&&this.diagram.selectionList[0]&&this._mouseDown&&(this.selectedObject=this.diagram.nameTable[this.diagram.selectionList[0].name],e={},u=f=t.datavisualization.Diagram.Util.bounds(this.selectedObject),l={bounds:{x:f.x,y:f.y,width:f.width,height:f.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},a={bounds:{x:u.x,y:u.y,width:u.width,height:u.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},this._raiseEvent("sizeChange",{element:this.diagram.getNode(this.selectedObject),resizeState:this.resizeState,offset:{x:0,y:0},oldValue:l,newValue:a,cancel:!1,direction:this._resizeDirection}),(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(e=this.diagram._getChildTable(this.selectedObject,e)),v={childTable:e,node:this.selectedObject},this.selectedObject&&this.selectedObject.type==="pseudoGroup"&&(this.pseudoGroupConstraints=this.diagram.model.selectedItems.getConstraints&&n.isFunction(this.diagram.model.selectedItems.getConstraints)?this.diagram.model.selectedItems.getConstraints():t.datavisualization.Diagram.Util._getPseudoGroupConstraints(this.diagram,this.selectedObject,this.selectedObject)),c=n.extend(!0,{},v),this.undoObject=jQuery.extend(!0,{},c),this._resizeDirection=r.target.getAttribute("class"),this.selectedObject.width||(this.selectedObject.width=this.selectedObject._width),this.selectedObject.height||(this.selectedObject.height=this.selectedObject._height),this.initialBounds={width:this.selectedObject.width,height:this.selectedObject.height,y:this.selectedObject.offsetY,x:this.selectedObject.offsetX},t.datavisualization.Diagram.SvgContext._removePivotPoint(this.selectedObject,this.diagram._svg,this.diagram._currZoom),this.inAction=!0);this.selectedObject&&(this.resizeState=t.datavisualization.Diagram.DragState.Resizing,o=!1,this.selectedObject&&this.selectedObject.parent?(s=this.diagram.nameTable[this.selectedObject.parent],s.container&&(s.container.type=="canvas"||s.container.type=="stack")&&(o=!0)):this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(o=!0),this.selectedObject&&o||this.selectedObject.type==="pseudoGroup"&&this._anyFromContainer(this.diagram._getChildren(this.selectedObject.children))?this.selectedObject.type==="pseudoGroup"&&this._isParentAsLane(this.selectedObject)?t.datavisualization.Diagram.canvasHelper._removeFromParentContainer(this.diagram,this.selectedObject):t.datavisualization.Diagram.canvasHelper._updateResizeHelper(this.diagram):this.selectedObject&&this.diagram.nameTable[this.selectedObject.name].container?t.datavisualization.Diagram.canvasHelper._updateResizeHelper(this.diagram):this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent]&&this.diagram.nameTable[this.selectedObject.parent].container&&this.diagram.nameTable[this.selectedObject.parent].container.type=="stack"?(this.helper||(this.helper=this._getCloneNode(this.selectedObject)),t.datavisualization.Diagram.SvgContext._drawContainerHelper(this.diagram),this._startPoint=this.currentPoint,this._updateSize(this.helper,this.previousPoint,this.currentPoint),t.datavisualization.Diagram.DiagramContext.update(this.helper,this.diagram)):this.selectedObject.type!="pseudoGroup"?this._updateSize(this.selectedObject,this.previousPoint,this.currentPoint):this.selectedObject.type=="pseudoGroup"&&!this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&this._fromSameContainer(this.diagram._getChildren(this.selectedObject.children))&&(this._undoObject||t.datavisualization.Diagram.Util._getUndoObject(this.diagram,this.selectedObject),this._updateSize(this.selectedObject,this.previousPoint,this.currentPoint)),this.helper||(this.selectedObject.isSwimlane?this._isMouseDown||(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this.diagram,this.selectedObject)):t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram)),this.diagram._renderTooltip(this.selectedObject,h),this.diagram._updateSelectionHandle(!0));this.previousPoint=this.currentPoint},r.prototype.mouseup=function(r){var h=null,s,u,o,l,c,a,e,v,f,y,p;this._mouseDown=!1;this.inAction&&(this.resizeState=t.datavisualization.Diagram.ResizeState.Completed,t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.inAction=!1,s=!1,o=t.datavisualization.Diagram.Util.bounds(this.undoObject.node),l={bounds:{x:o.x,y:o.y,width:o.width,height:o.height},offsetX:this.undoObject.node.offsetX,offsetY:this.undoObject.node.offsetY,width:this.undoObject.node.width,height:this.undoObject.node.height},this.selectedObject.parent?(c=this.diagram.nameTable[this.selectedObject.parent],c&&c.container&&(u=t.datavisualization.Diagram.Util.bounds(this.helper))):u=t.datavisualization.Diagram.Util.bounds(this.selectedObject),a={bounds:{x:u.x,y:u.y,width:u.width,height:u.height},offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,width:u.width,height:u.height},this._raiseEvent("sizeChange",{element:this.diagram.getNode(this.selectedObject),resizeState:this.resizeState,offset:{x:0,y:0},oldValue:l,newValue:a,cancel:!1,direction:this._resizeDirection}),this.resizeState="",(this.selectedObject.isLane||this.selectedObject.isSwimlane)&&(f={},f=this.diagram._getChildTable(this.selectedObject,f),h=n.extend(!0,{},{childTable:f,node:this.selectedObject})),this.selectedObject&&this.selectedObject.parent?(e=this.diagram.nameTable[this.selectedObject.parent],e.container&&(e.container.type=="canvas"||e.container.type=="stack")&&(s=!0)):this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(s=!0),this.selectedObject&&s&&!e.isLaneStack?(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this.diagram,this.diagram.activeTool.helper,e)&&(this.selectedObject.container?t.datavisualization.Diagram.canvasHelper._resizeLane(this.diagram,this.selectedObject):t.datavisualization.Diagram.canvasHelper._singleNodeResize(this.diagram,r,this.selectedObject),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram))):this.selectedObject&&this.diagram.nameTable[this.selectedObject.name].container?(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.canvasHelper._resizeLane(this.diagram,this.selectedObject)):(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this.diagram._activeSwimLane&&t.datavisualization.Diagram.canvasHelper._multiNodeResize(this.diagram,r,this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.diagram._updateSelectionHandle(),f={},(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(f=this.diagram._getChildTable(this.selectedObject,f)),y={childTable:f,node:this.selectedObject},v=n.extend(!0,{},y),p={type:"sizechanged",undoObject:h?h:this.undoObject,redoObject:jQuery.extend(!0,{},v),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"},this._multipleUndo||this.diagram.addHistoryEntry(p),this.diagram._removeTooltip(),this._multipleUndo=!1);i.prototype.mouseup.call(this,r)},r.prototype._updateSize=function(n,i,r,u,f,e,o,s,h){var y,a,tt=t.Matrix.identity(),rt,ut,v,et,ft,p,ht,w,ct,ot,st;t.Matrix.rotate(tt,-n.rotateAngle);var b={snapped:!1,offset:0,left:!1,right:!1},k={snapped:!1,offset:0,top:!1,bottom:!1},l=u?u:this.currentPoint.x-this.startPoint.x,c=f?f:this.currentPoint.y-this.startPoint.y,d=t.datavisualization.Diagram.Point(0,0),it=t.Matrix.identity(),g=n.offsetX,nt=n.offsetY;t.Matrix.rotate(it,n.rotateAngle,g,nt);rt=n.width;ut=n.height;g=g-rt*n.pivot.x;nt=nt-ut*n.pivot.y;switch(this._resizeDirection){case"n-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt/2,nt+ut));v=1;a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapTop(b,k,l,c,n,r==i);y=(this.initialBounds.height-c)/n.height;break;case"e-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g,nt+ut/2));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;l=this._snapRight(b,k,l,c,n,r==i,h);c=0;v=(this.initialBounds.width+l)/n.width;y=1;break;case"w-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt,nt+ut/2));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;l=this._snapLeft(b,k,l,c,n,r==i);c=0;v=(this.initialBounds.width-l)/n.width;y=1;break;case"s-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt/2,nt));v=1;a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapBottom(b,k,a.x,a.y,n,r&&i&&r==i?!0:!1);y=(this.initialBounds.height+c)/n.height;break;case"ne-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g,nt+ut));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;l=this._snapRight(b,k,l,c,n,r==i,h);c=this._snapTop(b,k,l,c,n,r==i);v=(this.initialBounds.width+l)/n.width;y=(this.initialBounds.height-c)/n.height;break;case"nw-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt,nt+ut));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapTop(b,k,l,c,n,r==i);l=this._snapLeft(b,k,l,c,n,r==i);v=(this.initialBounds.width-l)/n.width;y=(this.initialBounds.height-c)/n.height;break;case"se-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g,nt));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapBottom(b,k,l,c,n,r==i,h);l=s?l:this._snapRight(b,k,l,c,n,r==i);v=(this.initialBounds.width+l)/n.width;y=(this.initialBounds.height+c)/n.height;break;case"sw-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt,nt));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapBottom(b,k,l,c,n,r==i,h);l=this._snapLeft(b,k,l,c,n,r==i);v=(this.initialBounds.width-l)/n.width;y=(this.initialBounds.height+c)/n.height}if(n&&(this.pseudoGroupConstraints||(this.pseudoGroupConstraints=n.constraints)),this.pseudoGroupConstraints&t.datavisualization.Diagram.NodeConstraints.AspectRatio&&(this._resizeDirection=="n-resize"||this._resizeDirection=="s-resize"||this._resizeDirection=="w-resize"||this._resizeDirection=="e-resize"?(et=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(i.x-r.x,i.y-r.y)),Math.abs(et.x)>Math.abs(et.y)?y=v:v=y):y=i!=r?v=Math.max(y,v):v=0),ft=t.datavisualization.Diagram.Size(),v<0&&(v=1),y<0&&(y=1),ft.width=v,ft.height=y,p=t.datavisualization.Diagram.Util.bounds(n),p=t.datavisualization.Diagram.Rectangle(p.left,p.top,p.right-p.left,p.bottom-p.top),ht={bounds:{x:p.x,y:p.y,width:p.width,height:p.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},!t.datavisualization.Diagram.Geometry.isEmptySize(ft))if(this.resizeState=t.datavisualization.Diagram.ResizeState.Resizing,this._outOfBoundsDrag(n,v,y,d))this.diagram._raiseSizePropertyChange(n,v,y,!0),this.diagram.scale(n,v,y,d,this.diagram.nameTable,null,e,o),w=t.datavisualization.Diagram.Util.bounds(n),w=t.datavisualization.Diagram.Rectangle(w.left,w.top,w.right-w.left,w.bottom-w.top),ct={bounds:{x:w.x,y:w.y,width:w.width,height:w.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},ot=n.pathData,(p.width!=w.width||p.height!=w.height)&&(st=this._raiseEvent("sizeChange",{element:this.diagram.getNode(this.selectedObject),resizeState:this.resizeState,offset:ft,oldValue:ht,newValue:ct,direction:this._resizeDirection})),ot&&n.pathData!=ot&&(n._absoluteBounds=null,n._scaled=!0),st&&st.cancel&&!o&&this.diagram.scale(n,1/v,1/y,d,this.diagram.nameTable),n._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram),this.diagram._updateAssociatedConnectorEnds(n,this.diagram.nameTable);else return!0;this.pseudoGroupConstraints=null},r.prototype._getSwimLaneNode=function(n){var u,t,i,r;if(n&&(u=n.parent,t=this.diagram.nameTable[u],t&&(i=t.parent,i&&(r=this.diagram.nameTable[i],r))))return r},r.prototype._outOfBoundsDrag=function(n,i,r,u){var o;if(!this.diagram._skipoutOfBounds&&n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var f=this._getPageBounds(),c=n.height*r-n.height,l=n.width*i-n.width;if(!this.inAction&&n.isLane){var a=this._getSwimLaneNode(n),e=t.datavisualization.Diagram.Util.bounds(a),s=this._getPadding(n);if(!this.diagram._selectedSymbol&&e.right+l+s.x>f.width||!this.diagram._selectedSymbol&&e.bottom+c+s.y>f.height)return this.updateCursor("not-allowed"),!1}else{var e=t.datavisualization.Diagram.Util.bounds(n),s=this._getPadding(n),h=t.Matrix.identity();if((t.Matrix.rotate(h,-n.rotateAngle,u.x,u.y),t.Matrix.scale(h,i,r,u.x,u.y),t.Matrix.rotate(h,n.rotateAngle,u.x,u.y),o=t.Matrix.transform(h,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),!this.diagram._selectedSymbol&&(o.x+(e.width+l)/2+s.x>f.width||o.x-(e.width+l)/2<f.x))||!this.diagram._selectedSymbol&&(o.y+(e.height+c)/2+s.y>f.height||o.y-(e.height+c)/2<f.y))return this.updateCursor("not-allowed"),!1}this.updateCursor(this._resizeDirection)}return!0},r}(i);t.datavisualization.Diagram.ResizeTool=e;o=function(i){function r(n){i.call(this,"endPoint",n);this.cursor="move";this._endPoint=null;this._undoObject=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(r){var u;if(!this.inAction){i.prototype.mousedown.call(this,r);r.ctrlKey&&r.shiftKey&&(u=n(r.target).parents(".ej-d-connector"),u.length>0&&(this.selectedObject=this.diagram.nameTable[u[0].id],this.diagram._hasSelection()&&this.diagram._clearSelection(!0),this.diagram._addSelection(this.selectedObject)));this._initialValue=null;this.diagram.selectionList[0]&&!this.selectedObject&&(this.selectedObject=this.diagram.nameTable[this.diagram.selectionList[0].name]);this.undoObject=this._getClonedObject(this.selectedObject);this._endPoint=r.target.getAttribute("class");this.targetid=r.target.id;this._selectedSegment="";this._nearestNodes=[];var f=this._endPoint=="targetEndPoint"?!0:!1,e=this._endPoint=="sourceEndPoint"?!0:!1,o=this._raiseEndPointDrag(this.selectedObject,f,e,t.datavisualization.Diagram.DragState.Starting)}},r.prototype.mousemove=function(r){var g,c,l,v,y,p,o,e,w,a,k,d,s,h,b;if(i.prototype.mousemove.call(this,r),g=!this.inAction,this.selectedObject&&!(r.ctrlKey&&r.shiftKey)){c=!1;this.selectedObject.segments.length==2&&(c=!0);var u=this.currentPoint.x-this.previousPoint.x,f=this.currentPoint.y-this.previousPoint.y,nt=n.extend(!0,{},this.selectedObject.sourcePoint),tt=n.extend(!0,{},this.selectedObject.targetPoint),it=n.extend(!0,{},this.selectedObject.segments);if(this._outOfBoundsDrag(this.selectedObject,this.currentPoint.x,this.currentPoint.y))if(this.inAction||this.startPoint.x==this.currentPoint.x&&this.startPoint.y==this.currentPoint.y)this.inAction&&(this.selectedSegment&&this._endPoint=="segmentEnd"?(d=this._raiseSegmentEditEvent(t.datavisualization.Diagram.DragState.Dragging),d.cancel||u==0&&f==0||(s=this.currentPoint.x-this.startPoint.x,h=this.currentPoint.y-this.startPoint.y,this._initialValue&&(s=this._initialValue.x+s-this.selectedSegment._endPoint.x,h=this._initialValue.y+h-this.selectedSegment._endPoint.y),u=u*s<0?0:s,f=f*h<0?0:h,this._updateAdjacentSegments(u,f))):this._endPoint!="segmentEnd"&&((this._endPoint=="targetEndPoint"||this._endPoint=="sourceEndPoint")&&this._checkConnectionPossible(r),b=this._updatePoints(this.selectedObject,t.datavisualization.Diagram.DragState.Dragging),b.cancel||(this._disconnect(this.selectedObject),this._updateConnection(this.selectedObject,b.updateSelection))),this.diagram._updateSelectionHandle(!0),this.diagram._updateQuad(this.selectedObject),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram));else{if(this.inAction=!0,this.selectedObject.segments.length>0)for(l=0;l<this.selectedObject.segments.length;l++)this.selectedObject.segments[l]._bridges=[];v=this.diagram._svg.getElementById(this.selectedObject.name+"_hitTest");v&&v.setAttribute("pointer-events","none");y=this.diagram._svg.getElementById(this.selectedObject.name);y&&y.setAttribute("pointer-events","none");p=this.diagram._adornerSvg.getElementById(this.diagram._adornerSvg.document.id+"handle_g");p&&p.setAttribute("pointer-events","none");o=this.targetid.split("_");o.reverse();e=Number(o[0]);this.selectedSegment=this.selectedObject.segments[e];w=this.selectedSegment;this.selectedSegment&&this.selectedSegment.type=="orthogonal"?(a=!1,e===0&&(k=!0),this.selectedSegment.length&&this.selectedSegment.direction?e==0?(this.insertFirstSegment(u,f,o),a=!0):this.nextSegment=this.selectedObject.segments[e+1]:(this._addTerminalSegment(u,f,o),a=!0)):this.nextSegment=this.selectedObject.segments[e+1];a&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,!(c||k||!this.selectedObject.sourcePort),!(c||!(w.length||w.length===0)||!this.selectedObject.targetPort),this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom));this.selectedSegment||this._endPoint!="targetEndPoint"||(this.selectedSegment=this.selectedObject.segments[this.selectedObject.segments.length-1]);this.selectedSegment||this._endPoint!="sourceEndPoint"||(this.selectedSegment=this.selectedObject.segments[0],this.nextSegment=this.selectedObject.segments[1]);this.selectedSegment&&(this._initialValue={x:this.selectedSegment._endPoint.x,y:this.selectedSegment._endPoint.y});this.diagram._updateSelectionHandle(!0);this._raiseSegmentEditEvent(t.datavisualization.Diagram.DragState.Starting)}this.diagram._comparePropertyValues(this.selectedObject,"sourcePoint",{sourcePoint:nt},!0);this.diagram._comparePropertyValues(this.selectedObject,"targetPoint",{targetPoint:tt},!0);this.diagram._comparePropertyValues(this.selectedObject,"segments",{segments:it},!0)}this.previousPoint=this.currentPoint},r.prototype._raiseSegmentEditEvent=function(n){return this._raiseEvent("segmentChange",{element:this.selectedObject,dragState:n,point:this.currentPoint,cancel:!1})},r.prototype._updateAdjacentSegments=function(n,i){var r=this.selectedSegment,u={x:n+r._endPoint.x,y:i+r._endPoint.y},e,f;u=this.snap(u);r.type=="orthogonal"?(r._direction=="left"||r._direction=="right"?(i=u.y-r._endPoint.y,r._startPoint.y+=i,r._endPoint.y=r._startPoint.y):(n=u.x-r._endPoint.x,r._startPoint.x+=n,r._endPoint.x=r._startPoint.x),r.points[0]=r._startPoint,r.points[r.points.length-1]=r._endPoint,e=this.selectedObject.segments.indexOf(this.selectedSegment),f=this.selectedObject.segments[e-1],f&&this.updatePreviousSegment(r,f,n,i)):r.type=="straight"?(r.points[r.points.length-1]=r._endPoint=u,r._point=r.point=u):(r.points[r.points.length-1]=r._endPoint=u,r._point=r.point=u,t.datavisualization.Diagram.Util._updateBezierPoints(r));this.nextSegment&&this.updateNextSegment(r,this.nextSegment,n,i)},r.prototype._addTerminalSegment=function(n,i,r){var u=this.selectedSegment,f,e,o,h,c,s;for(this.selectedObject.segments.pop(),f=this.selectedObject.segments[this.selectedObject.segments.length-1]&&this.selectedObject.segments[this.selectedObject.segments.length-1].type=="orthogonal"?this.selectedObject.segments[this.selectedObject.segments.length-1]:null,e=0;e<u.points.length-2;e++)o=t.datavisualization.Diagram.Segment({type:"orthogonal",length:t.datavisualization.Diagram.Geometry.distance(u.points[e],u.points[e+1]),direction:t.datavisualization.Diagram.Util._getBezierDirection(u.points[e],u.points[e+1])}),o.length==0&&(o._direction=f.direction=="top"||f.direction=="bottom"?o.direction=n>0?"right":"left":o.direction=i>0?"bottom":"top"),f=o,this.selectedObject.segments.push(o);if(h=Number(r[1]),(u.points.length==2||h==u.points.length-2)&&(f&&(f.length+=5,f._length=f.length),h!=0)){var l=t.datavisualization.Diagram.Geometry.distance(u.points[u.points.length-2],u._endPoint),a=t.datavisualization.Diagram.Util._getBezierDirection(u.points[u.points.length-2],u._endPoint),v=t.datavisualization.Diagram.Segment({type:"orthogonal",length:2*l/3,direction:a});this.selectedObject.segments.push(v)}c=t.datavisualization.Diagram.Segment({type:"orthogonal"});this.selectedObject.segments.push(c);s=Number(r[0])+(Number(r[1])||0);this.selectedSegment=this.selectedObject.segments[s];this.nextSegment=this.selectedObject.segments[s+1];s==this.selectedObject.segments.length-2?this.nextSegment._direction=Number(r[0])==0?t.datavisualization.Diagram.Util._getBezierDirection(u.points[u.points.length-2],u._endPoint):u._direction:c._direction=t.datavisualization.Diagram.Util._getBezierDirection(u.points[u.points.length-2],u._endPoint);s==0&&this.insertFirstSegment(n,i,r)},r.prototype.insertFirstSegment=function(n,i,r){var u=this.selectedSegment,c,e,o,f,h,l,s,a;if(this.selectedObject.sourcePort&&u.length&&this.selectedObject.segments[0].points.length>2){for(this.selectedObject.segments.splice(0,1),f=[],e=0;e<u.points.length-1;e++)o=t.datavisualization.Diagram.Segment({type:"orthogonal",length:t.datavisualization.Diagram.Geometry.distance(u.points[e],u.points[e+1]),direction:t.datavisualization.Diagram.Util._getBezierDirection(u.points[e],u.points[e+1])}),o.length==0&&(o._direction=c&&(c.direction=="top"||c.direction=="bottom")?o.direction=n>0?"right":"left":o.direction=i>0?"bottom":"top"),c=o,f.push(o);this.selectedObject.segments=f.concat(this.selectedObject.segments);this.selectedSegment=this.selectedObject.segments[Number(r[1])];this.nextSegment=this.selectedObject.segments[Number(r[1])+1]}else u=this.selectedObject.segments[0],f=[],f.push(t.datavisualization.Diagram.Segment({type:"orthogonal",direction:u.direction,length:u.length/3})),u.direction=="bottom"||u.direction=="top"?(h=Math.max(5,Math.abs(n)),l=n>0?"right":"left"):(h=Math.max(5,Math.abs(i)),l=i>0?"bottom":"top"),f.push(t.datavisualization.Diagram.Segment({type:"orthogonal",direction:l,length:h})),s=this.selectedObject.segments[1],s&&s.length&&(l!=s.direction&&(h*=-1),s.length-=h,s._length=s.length),u.length=u._length=2*u._length/3,this.selectedObject.segments=f.concat(this.selectedObject.segments),a=Number(r[0])+Number(r[1]),this.selectedSegment=this.selectedObject.segments[2],this.nextSegment=this.selectedObject.segments[3]},r.prototype.updatePreviousSegment=function(n,i,r,u){i._endPoint=i.points[i.points.length-1]=n._startPoint;i.type=="orthogonal"?(i.direction=="bottom"?(i.length+=u,i.length<0&&(i._direction=i.direction="top",i.length*=-1)):i.direction=="top"?(i.length-=u,i.length<0&&(i._direction=i.direction="bottom",i.length*=-1)):i.direction=="right"?(i.length+=r,i.length<0&&(i._direction=i.direction="left",i.length*=-1)):i.direction=="left"&&(i.length-=r,i.length<0&&(i._direction=i.direction="right",i.length*=-1)),i._length=i.length):i.type=="bezier"&&t.datavisualization.Diagram.Util._updateBezierPoints(i)},r.prototype.updateNextSegment=function(n,i,r,u){var o=n._endPoint,e,f;i._startPoint=i.points[0]=this.selectedSegment._endPoint;i&&(i.type=="orthogonal"?(i.length||i.length===0)&&(i._direction=="left"||i._direction=="right"?(r!=0&&(i._direction=="right"?i._length-=r:i._length+=r,(i.length||i.length===0)&&(i.length=i._length,i.length<0&&(i.direction=="left"?i.direction="right":i.direction=="right"&&(i.direction="left"),i.length*=-1,i._direction=i.direction,i._length=i.length))),u!=0&&n.type!="orthogonal"&&(i._startPoint.y=i.points[0].y=i._endPoint.y=i.points[i.points.length-1].y=o.y,e=this.selectedObject.segments.indexOf(i),f=this.selectedObject.segments[e+1],f._startPoint.y=f.points[0].y=i._endPoint.y,f.length&&(f.direction=="bottom"?(f.length-=u,f.length<0&&(f.direction="top",f.length*=-1)):(f.length+=u,f.length<0&&(f.direction="bottom",f.length*=-1))))):(u!=0&&(i._direction=="bottom"?i._length-=u:i._length+=u,(i.length||i.length===0)&&(i.length=i._length,i.length<0&&(i.direction=="top"?i.direction="bottom":i.direction=="bottom"&&(i.direction="top"),i.length*=-1,i._length=i.length,i._direction=i.direction))),r!=0&&n.type!="orthogonal"&&(i._startPoint.x=i.points[0].x=i._endPoint.x=i.points[i.points.length-1].x=o.x,e=this.selectedObject.segments.indexOf(i),f=this.selectedObject.segments[e+1],f.length&&(f.direction=="right"?(f.length+=r,f.length<0&&(f.direction="left",f.length*=-1)):(f.length-=r,f.length<0&&(f.direction="right",f.length*=-1)))))):i.type=="bezier"&&t.datavisualization.Diagram.Util._updateBezierPoints(i))},r.prototype.mouseup=function(n){var c,u,h,l,a,e;if(n.shiftKey&&n.ctrlKey)this._addOrRemoveStraightSegments(n);else if(this.inAction){if(this.inAction=!1,this._endPoint=="segmentEnd"&&this.selectedSegment.type=="orthogonal"){if(h=this._raiseSegmentEditEvent(t.datavisualization.Diagram.DragState.Completed),!h.cancel){var f=this.selectedObject.segments.indexOf(this.selectedSegment),o=this.selectedObject.segments[f-1],r=this.selectedObject.segments[f+1],s=!1;o&&o.type=="orthogonal"&&Math.abs(o.length)<5?f!=1&&(s=this._removePrevSegment(f)):r&&r.type=="orthogonal"&&(c=r.length||r.length===0?r.length:t.datavisualization.Diagram.Geometry.distance(r.points[0],r.points[1]),Math.abs(c<=5)&&(s=this._removeNextSegment(f)));s&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom))}}else this._endPoint!="segmentEnd"&&(u=this._updatePoints(this.selectedObject,t.datavisualization.Diagram.DragState.Completed),this.diagram.nameTable[this.selectedObject.name]||(this.selectedObject=null),this.selectedObject&&(u.cancel?u&&u.cancel&&u.eventType&&(u.eventType==="connectorSourceChange"&&(this.undoObject.sourceNode?(this.selectedObject.sourceNode=this.undoObject.sourceNode,this.diagram.nameTable[this.undoObject.sourceNode].outEdges.push(this.selectedObject.name),this.selectedObject.sourcePort=this.undoObject.sourcePort):this.undoObject.sourceNode==null&&this.selectedObject.sourceNode?(this.selectedObject.sourceNode=this.undoObject.sourceNode,this.selectedObject.sourcePort=this.undoObject.sourcePort,this.selectedObject.sourcePoint=this.undoObject.sourcePoint,this.selectedObject.segments=this.undoObject.segments):(this.selectedObject.sourcePoint=this.undoObject.sourcePoint,this.selectedObject.segments=this.undoObject.segments)),u.eventType==="connectorTargetChange"&&(this.undoObject.targetNode?(this.selectedObject.targetNode=this.undoObject.targetNode,this.diagram.nameTable[this.undoObject.targetNode].inEdges.push(this.selectedObject.name),this.selectedObject.targetPort=this.undoObject.targetPort):this.undoObject.targetNode==null&&this.selectedObject.targetNode?(this.selectedObject.targetNode=this.undoObject.targetNode,this.selectedObject.targetPort=this.undoObject.targetPort,this.selectedObject.targetPoint=this.undoObject.targetPoint,this.selectedObject.segments=this.undoObject.segments):(this.selectedObject.segments=this.undoObject.segments,this.selectedObject.targetPoint=this.undoObject.targetPoint))):(this._disconnect(this.selectedObject),this._currentPossibleConnection&&!this.inAction?this._updateConnection(this.selectedObject):(this.selectedObject.sourceNode||this.selectedObject.targetNode)&&this._updateConnection(this.selectedObject),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram))));this.selectedObject&&(this.selectedObject.annotation&&(l=this.diagram.nameTable[this.selectedObject.targetNode],t.datavisualization.Diagram.DefautShapes.updateBPMNAnnotationShape(this.selectedObject,this.undoObject.targetNode,l,this.diagram)),this.diagram._dock(this.selectedObject,this.diagram.nameTable,!0),t.datavisualization.Diagram.Util.updateBridging(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext.update(this.selectedObject,this.diagram),this.diagram._updateConnectorBridging(this.selectedObject),this.diagram._updateQuad(this.selectedObject),this.diagram._updateSelectionHandle(),this.selectedObject.annotation&&t.datavisualization.Diagram.DefautShapes.updateAnnotationProperties(this.selectedObject,this.diagram),this.selectedObject&&(this.diagram._svg.getElementById(this.selectedObject.name+"_hitTest").setAttribute("pointer-events","stroke"),this.diagram._svg.getElementById(this.selectedObject.name).setAttribute("pointer-events","auto")),this.diagram._adornerSvg.getElementById(this.diagram._adornerSvg.document.id+"handle_g").setAttribute("pointer-events","visible"),this._initialValue=null)}if(this.selectedObject)for(a={type:"endpointchanged",undoObject:this.undoObject,redoObject:this._getClonedObject(this.selectedObject),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"},this.diagram.addHistoryEntry(a),e=0;e<this._nearestNodes.length;e++)this._showPort(this._nearestNodes[e],!0);delete this._nearestNodes;i.prototype.mouseup.call(this,n)},r.prototype._addOrRemoveStraightSegments=function(n){var s,e,r,f,i,u;if(this._endPoint=="segmentEnd")s=n.target.id,e=s.split("_"),e.reverse(),r=Number(e[0]),i=this.selectedObject.segments[r],i&&i.type=="straight"&&(f=this.selectedObject.segments[r+1],f&&(this.selectedObject.segments.splice(r,1),f._startPoint=f.points[0]=i._startPoint,o=!0));else{var h=n.target.getAttribute("class"),s=n.target.id,o=!1,r=this._findIndex();this.selectedObject.segments&&this.selectedObject.segments[r]&&this.selectedObject.segments[r].type=="straight"&&(i=this.selectedObject.segments[r],u=t.datavisualization.Diagram.Segment({type:"straight",_point:i._endPoint}),this.selectedObject.segments.splice(r+1,0,u),r+1!=this.selectedObject.segments.length-1&&(u.point=u._point),i._point=i.point=i.points[1]=i._endPoint=this.currentPoint,u.points[0]=u._startPoint=this.currentPoint,u.points[1]=u._endPoint=u._point,o=!0)}o&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.Util.updateBridging(this.selectedObject,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom))},r.prototype._findIndex=function(){for(var n,o,e,s,h,u,c,l,f,r=[],i=0;i<this.selectedObject.segments.length;i++)n=this.selectedObject.segments[i],o={x:Math.min(n._startPoint.x,n._endPoint.x),y:Math.min(n._startPoint.y,n._endPoint.y),width:Math.abs(n._startPoint.x-n._endPoint.x),height:Math.abs(n._startPoint.y-n._endPoint.y)},t.datavisualization.Diagram.Geometry.inflate(o,this.selectedObject.lineHitPadding/2,this.selectedObject.lineHitPadding/2),t.datavisualization.Diagram.Geometry.containsPoint(o,this.currentPoint)&&r.push(n);if(r.length==1)return this.selectedObject.segments.indexOf(r[0]);for(i=0;i<r.length;i++)u=r[i],f=this.currentPoint,c=(f.y-u._startPoint.y)/(u._endPoint.y-f.y),l=(f.x-u._startPoint.x)/(u._endPoint.x-f.x),e=Math.abs(c-l),i==0&&(s=e,h=0),e<s&&(s=e,h=i);return this.selectedObject.segments.indexOf(r[h])},r.prototype._removeNextSegment=function(n){var i=this.selectedObject.segments[n-1],r=this.selectedObject.segments[n+2],u=this.selectedObject.segments[n+1];return u.length||u.length===0?(this.selectedObject.segments.splice(n,2),this.selectedSegment.direction=="top"||this.selectedSegment.direction=="bottom"?(r._startPoint.y=this.selectedSegment._startPoint.y,i._endPoint.x=r._startPoint.x):(r._startPoint.x=this.selectedSegment._startPoint.x,i._endPoint.y=r._startPoint.y)):(this.selectedObject.segments.splice(n+1,1),this.selectedSegment.direction=="top"||this.selectedSegment.direction=="bottom"?i._endPoint.x=u._endPoint.x:i._endPoint.y=u._endPoint.y,i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i.length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,i._endPoint)),this.selectedSegment.length=this.selectedSegment._length=this.selectedSegment.direction=null),i&&r&&(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,r._startPoint),i.length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,r._startPoint)),(r.length||r.length===0)&&(r._length=r.length=t.datavisualization.Diagram.Geometry.distance(i._endPoint,r._endPoint),r.length&&(r._direction=r.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._endPoint,r._endPoint)))),!0},r.prototype._removePrevSegment=function(n){var i=this.selectedObject.segments[n-2],f=this.selectedObject.segments[n+1],o=f.length||f.length===0?f.length:t.datavisualization.Diagram.Geometry.distance(f.points[0],f.points[1]),r,u,e;return o<=5?(r=this.selectedObject.segments[n+2],f.length===o?this.selectedObject.segments.splice(n-1,4):this.selectedObject.segments.splice(n-1,3),r?(i.direction=="top"||i.direction=="bottom"?(i._endPoint.y=r._endPoint.y,r._startPoint.x=i._endPoint.x):(i._endPoint.x=r._endPoint.x,r._startPoint.y=i._endPoint.y),(i.length||i.length===0)&&(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i.length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,i._endPoint))),(r.length||r.length===0)&&(r._length=r.length=t.datavisualization.Diagram.Geometry.distance(r._startPoint,r._endPoint),r._length&&(r._direction=r.direction=t.datavisualization.Diagram.Util._getBezierDirection(r._startPoint,r._endPoint)))):(i._endPoint=this.selectedObject.endPoint,i.direction=i.length=i._length=null,i._direction=f._direction)):(u=this.selectedObject.segments[n+1],this.selectedObject.segments.splice(n-1,2),e=this.selectedSegment,e.direction=="left"||e.direction=="right"?(i._endPoint.x=u._startPoint.x,u._startPoint.y=i._endPoint.y):(i._endPoint.y=u._startPoint.y,u._startPoint.x=i._endPoint.x),(this.selectedSegment.length||this.selectedSegment.length===0)&&(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i._length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,i._endPoint))),(u.length||u.length===0)&&(u._length=u.length=t.datavisualization.Diagram.Geometry.distance(u._startPoint,u._endPoint),u.length&&(u._direction=u.direction=t.datavisualization.Diagram.Util._getBezierDirection(u._startPoint,u._endPoint)))),!0},r.prototype._getClonedObject=function(t){if(t){var i=n.extend(!0,{},t);return i.targetNode=t.targetNode,i.sourceNode=t.sourceNode,i.targetPort=t.targetPort,i.sourcePort=t.sourcePort,i}},r.prototype._updateConnection=function(n,i){var r,u;this._endPoint=="targetEndPoint"?(this._currentPossibleConnection?this._possibleConnectionPort&&t.datavisualization.Diagram.Util.canConnect(this._possibleConnectionPort,!0)?(n.targetNode!=this._currentPossibleConnection.name||n.targetPort!=this._possibleConnectionPort.name)&&(r=this._raiseConnectionChangeEvent(n,!0)):t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection)&&(n.targetNode!=this._currentPossibleConnection.name||n.targetPort)&&(r=this._raiseConnectionChangeEvent(n,!0)):this.selectedObject.targetNode&&(r=this._raiseConnectionChangeEvent(n,!0)),r&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),(n.segments.length>2||n.segments[0].points.length==2)&&t.datavisualization.Diagram.Util._updatePreviousSegment(n),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom))):this._endPoint=="sourceEndPoint"&&(this._currentPossibleConnection?this._possibleConnectionPort&&t.datavisualization.Diagram.Util.canConnect(this._possibleConnectionPort,!0)?(n.sourceNode!=this._currentPossibleConnection.name||n.sourcePort!=this._possibleConnectionPort.name)&&(r=this._raiseConnectionChangeEvent(n)):t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection)&&(n.sourceNode!=this._currentPossibleConnection.name||n.sourcePort)&&(r=this._raiseConnectionChangeEvent(n)):(this.selectedObject.sourceNode&&(r=this._raiseConnectionChangeEvent(n),t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram)),r&&t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom)));u=this.selectedSegment._endPoint;this.diagram._dock(n,this.diagram.nameTable,i);r&&this._endPoint=="sourceEndPoint"&&this.selectedObject.segments.length>1&&(this.selectedSegment.points.length==2&&!this.selectedObject.sourcePort&&this.selectedSegment.length?(this.selectedSegment.direction=="right"||this.selectedSegment.direction=="left"?(this.selectedSegment.direction=this.selectedSegment._startPoint.x<u.x?this.selectedSegment._direction="right":this.selectedSegment._direction="left",this.selectedSegment.length=this.selectedSegment._length=Math.abs(this.selectedSegment._startPoint.x-u.x)):(this.selectedSegment.direction=this.selectedSegment._startPoint.y<u.y?this.selectedSegment._direction="bottom":this.selectedSegment._direction="top",this.selectedSegment.length=this.selectedSegment._length=Math.abs(this.selectedSegment._startPoint.y-u.y)),t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom)):r&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom)))},r.prototype._raiseConnectionChangeEvent=function(n,i){var u=this._raiseEvent("connectionChange",{element:this.selectedObject,endPoint:this._endPoint,connection:this._currentPossibleConnection,port:this._possibleConnectionPort,cancel:!1}),r;if(!u.cancel)return i?(this._currentPossibleConnection&&n.targetNode==this._currentPossibleConnection.name||(this._currentPossibleConnection&&this._currentPossibleConnection.inEdges.push(n.name),n.targetNode&&(r=this.diagram.nameTable[this.selectedObject.targetNode],r&&t.datavisualization.Diagram.Util.removeItem(r.inEdges,n.name))),this.diagram._comparePropertyValues(n,"targetNode",{targetNode:this._currentPossibleConnection?this._currentPossibleConnection.name:null},!0),n.targetNode=this._currentPossibleConnection?this._currentPossibleConnection.name:null,this.diagram._comparePropertyValues(n,"targetPort",{targetPort:this._possibleConnectionPort?this._possibleConnectionPort.name:null},!0),n.targetPort=this._possibleConnectionPort?this._possibleConnectionPort.name:null):(this._currentPossibleConnection&&n.sourceNode==this._currentPossibleConnection.name||(this._currentPossibleConnection&&this._currentPossibleConnection.outEdges.push(n.name),n.sourceNode&&(r=this.diagram.nameTable[this.selectedObject.sourceNode],r&&t.datavisualization.Diagram.Util.removeItem(r.outEdges,n.name))),this.diagram._comparePropertyValues(n,"sourceNode",{sourceNode:this._currentPossibleConnection?this._currentPossibleConnection.name:null},!0),n.sourceNode=this._currentPossibleConnection?this._currentPossibleConnection.name:null,this.diagram._comparePropertyValues(n,"sourcePort",{sourcePort:this._possibleConnectionPort?this._possibleConnectionPort.name:null},!0),n.sourcePort=this._possibleConnectionPort?this._possibleConnectionPort.name:null),!0},r.prototype._disconnect=function(){},r.prototype._endAction=function(){this._showPorts();var n;this._currentPossibleConnection&&!this._possibleConnectionPort&&(n=this._currentPossibleConnection);i.prototype._endAction.apply(this);this._endPoint&&(this._endPoint=null,n&&(this.diagram._checkToolToActivate(n,this.currentPoint),this.diagram._updateCursor()))},r.prototype._outOfBoundsDrag=function(n,i,r){if(i=i?i:0,r=r?r:0,n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var u=this._getPageBounds();if(!this.diagram._selectedSymbol&&(i>=u.width||i<=u.x)||!this.diagram._selectedSymbol&&(r>=u.height||r<=u.y))return this.updateCursor("not-allowed"),!1}else if(!t.datavisualization.Diagram.bpmnHelper.canMoveOutofBounds(this.diagram,n,i,r))return this.updateCursor("not-allowed"),!1;return this.updateCursor(this.cursor),!0},r.prototype._updatePoints=function(n,i){var h=!1,w="",f,c,e,y,r,b,l,a,p,u,o,s,v,k;if(this._endPoint&&this._endPoint!="segmentEnd"&&this.selectedSegment&&(f=this._endPoint=="targetEndPoint"?!0:!1,c=this._endPoint=="sourceEndPoint"?!0:!1,this._endPoint)){y=this._endPoint.match("bezierpoint1")?"bezierpoint1":this._endPoint.match("bezierpoint2")?"bezierpoint2":this._endPoint;switch(y){case"targetEndPoint":e=this.selectedSegment._endPoint;break;case"sourceEndPoint":e=this.selectedSegment._startPoint;break;case"bezierpoint1":e=this.selectedSegment._point1;break;case"bezierpoint2":e=this.selectedSegment._point2}if(r=this.currentPoint,this._possibleConnectionPort==null&&(r=this.snap(r)),b=t.datavisualization.Diagram.Point(e.x-r.x,e.y-r.y),l=this._raiseEndPointDrag(n,f,c,i),l&&(h=l.cancel,w=l.type),!t.datavisualization.Diagram.Geometry.isEmptyPoint(b)&&!h)if(f||c){if(a=this._currentPossibleConnection?t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection,!1):!1,this._outOfBoundsDrag(this.selectedObject,r.x,r.y,f)&&(this.selectedObject.segments.length>1&&(f||a||this.selectedSegment.type!="orthogonal"||!this.selectedSegment.length&&this.selectedSegment.length!==0?f&&!a&&this.selectedSegment.type=="orthogonal"&&this.selectedSegment.points.length==2&&(o=r.x-this.selectedSegment._endPoint.x,s=r.y-this.selectedSegment._endPoint.y,this.selectedSegment._direction=="left"||this.selectedSegment._direction=="right"?(this.selectedSegment._startPoint.y=this.selectedSegment.points[0].y+=s,this.selectedSegment._endPoint.y=this.selectedSegment.points[1].y=this.selectedSegment._startPoint.y):(this.selectedSegment._startPoint.x=this.selectedSegment.points[0].x+=o,this.selectedSegment._endPoint.x=this.selectedSegment.points[1].x=this.selectedSegment._startPoint.x),v=this.selectedObject.segments.length-1,this.selectedObject.segments[v-1]&&this.updatePreviousSegment(this.selectedObject.segments[v],this.selectedObject.segments[v-1],o,s)):(this.selectedObject.sourcePoint=r,o=r.x-this.selectedSegment._startPoint.x,s=r.y-this.selectedSegment._startPoint.y,this.selectedSegment.direction=="left"||this.selectedSegment.direction=="right"?this.selectedSegment._endPoint.y=this.selectedSegment.points[this.selectedSegment.points.length-1].y=r.y:this.selectedSegment._endPoint.x=this.selectedSegment.points[this.selectedSegment.points.length-1].x=r.x,this.selectedSegment._startPoint=this.selectedSegment.points[0]=r,this.selectedSegment._length=this.selectedSegment.length=t.datavisualization.Diagram.Geometry.distance(r,this.selectedSegment._endPoint),this.selectedSegment._length&&(this.selectedSegment._direction=this.selectedSegment.direction=t.datavisualization.Diagram.Util._getBezierDirection(r,this.selectedSegment._endPoint)),this.updateNextSegment(this.selectedObject.segments[0],this.selectedObject.segments[1],o,s),u=this.selectedObject.segments[1],p=!1,u&&u.length&&(u.length=u._length=t.datavisualization.Diagram.Geometry.distance(this.selectedSegment._endPoint,u._endPoint),u.length&&(u.direction=u._direction=t.datavisualization.Diagram.Util._getBezierDirection(this.selectedSegment._endPoint,u._endPoint))),this.selectedSegment.length==0||u.length===0?(u.length==0&&this.selectedObject.segments.length>2?this.selectedObject.segments.splice(0,2):this.selectedObject.segments.length>1&&this.selectedObject.segments.splice(0,1),this.selectedSegment=this.selectedObject.segments[0],this.selectedSegment._startPoint=this.selectedSegment.points[0]=r,this.selectedSegment._direction=="left"||this.selectedSegment._direction=="right"?this.selectedSegment._endPoint.y=this.selectedSegment.points[this.selectedSegment.points.length-1].y=r.y:this.selectedSegment._endPoint.x=this.selectedSegment.points[this.selectedSegment.points.length-1].x=r.x,u=this.selectedObject.segments[1],this.selectedObject.segments.length>1?(this.selectedSegment._length=this.selectedSegment.length=t.datavisualization.Diagram.Geometry.distance(r,u._startPoint),t.datavisualization.Diagram.Util._addOrthogonalPoints(this.selectedSegment,null,n.segments[1],n.sourcePoint,n.targetPoint),t.datavisualization.Diagram.Util._addOrthogonalPoints(n.segments[1],n.segments[0],n.segments[2],n.sourcePoint,n.targetPoint),u._startPoint=u.points[0]=n.segments[0]._endPoint):t.datavisualization.Diagram.Util._addOrthogonalPoints(this.selectedSegment,null,n.segments[1],n.sourcePoint,n.targetPoint),p=!0):t.datavisualization.Diagram.Util._addOrthogonalPoints(this.selectedSegment,null,n.segments[1],n.sourcePoint,n.targetPoint),u&&u.length&&(u.length=u._length=t.datavisualization.Diagram.Geometry.distance(this.selectedSegment._endPoint,u._endPoint),u.length&&(u.direction=u._direction=t.datavisualization.Diagram.Util._getBezierDirection(this.selectedSegment._endPoint,u._endPoint))))),(c||f)&&!a&&(k=this.selectedSegment.points.length,this.diagram._setEndPoint(n,t.datavisualization.Diagram.Point(r.x,r.y),f),k!=this.selectedSegment.points.length||p)))return{updateSelection:!0,cancel:h}}else t.datavisualization.Diagram.Util._setBezierPoint(this.selectedSegment,t.datavisualization.Diagram.Point(r.x,r.y),y)}return{cancel:h,eventType:w}},r}(i);t.datavisualization.Diagram.ConnectionEditTool=o;s=function(i){function r(n){i.call(this,"shapeTool",n);this.cursor="crosshair";this._drawingPolygon=!1;this._points=[]}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){if(i.prototype.mousedown.call(this,n),this._drawingPolygon){var t=this.helper.points[this.helper.points.length-1];t={x:t.x,y:t.y};this.helper.points.push(t);this._points.push(this.snap(this.currentPoint))}else this.selectedObject=this.createNode(),this.selectedObject.type=="bpmn"&&this.diagram._initGroupNode(this.selectedObject),this.selectedObject._type="node";this._prevPoint=this.currentPoint},r.prototype.createNode=function(){var n=this.diagram._getNewNode(this.diagram.model.drawType),i,r;return n.name=this.diagram.model.drawType.name?this.diagram.model.drawType.name+t.datavisualization.Diagram.Util.randomId():"node"+t.datavisualization.Diagram.Util.randomId(),i=this.snap(this.currentPoint),n.offsetX=i.x,n.offsetY=i.y,n.width=5,n.height=5,n.type!="text"&&(n.shape=this.diagram.model.drawType.shape?this.diagram.model.drawType.shape:n.shape),this.diagram.model.drawType.shape!="polygon"||this.diagram.model.drawType.points&&this.diagram.model.drawType.points.length||(this._drawingPolygon=!0,r=this.snap(this.startPoint),n.points=[{x:r.x,y:r.y},{x:i.x,y:i.y}],this._points=[{x:r.x,y:r.y},{x:i.x,y:i.y}]),t.datavisualization.Diagram.NodeType(n,this.diagram)},r.prototype.mousemove=function(n){if(i.prototype.mousemove.call(this,n),this.selectedObject)if(this.inAction)this._updateHelper();else{if(this.inAction=!0,this.selectedObject.shape==="polygon"&&(!this.diagram.model.drawType.points||!this.diagram.model.drawType.points.length)&&(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y)){var t=this.snap(this.startPoint),r=this.snap(this.currentPoint);this.selectedObject.points=[{x:t.x,y:t.y},{x:r.x,y:r.y}];this._points=[{x:t.x,y:t.y},{x:r.x,y:r.y}]}this._initHelper();this._renderHelper()}this.previousPoint=this.currentPoint},r.prototype.mouseup=function(n){this._drawingPolygon&&n.button!=2&&this.diagram._getEventDetail(n)!=2||(this.inAction&&(this.inAction=!1,this._drawingPolygon&&(this.selectedObject.points=this.helper.points),this._updateSize(this.selectedObject,this.startPoint,this.currentPoint),this.diagram.add(this.selectedObject)),this.diagram._toolToActivate="selectTool",this.diagram._drawingTool=!1,i.prototype.mouseup.call(this,n),this._drawingPolygon&&(this.diagram._disableDefaultContextMenu=!0,delete this._drawingPolygon,delete this._points))},r.prototype._renderHelper=function(){this.svgHelper||(this.helper.type!="bpmn"?this.svgHelper=t.datavisualization.Diagram.SvgContext.renderNode(this.helper,this.diagram._svg,this.diagram._diagramLayer,undefined,this.diagram):(this.helper._type="group",this.diagram._initGroupNode(this.helper),this.svgHelper=t.datavisualization.Diagram.SvgContext.renderGroup(this.helper,this.diagram._svg,this.diagram._diagramLayer,this.diagram.nameTable,this.diagram)),this.svgHelper=document.getElementById(this.helper.name),this.svgHelper.setAttribute("pointer-events","none"))},r.prototype._updateHelper=function(){var i;if(this._drawingPolygon){var u=this.snap(this.currentPoint),f=this.snap(this.previousPoint),r={x:u.x-f.x,y:u.y-f.y};this.helper.points[this.helper.points.length-1].x+=r.x;this.helper.points[this.helper.points.length-1].y+=r.y;this._points[this._points.length-1].x+=r.x;this._points[this._points.length-1].y+=r.y}i=n.extend(!0,{},this.helper);this._updateSize(this.helper,this.snap(this.startPoint),this.snap(this.currentPoint));this.diagram._comparePropertyValues(this.helper,"height",{height:i.height},!0);this.diagram._comparePropertyValues(this.helper,"width",{width:i.width},!0);this.diagram._comparePropertyValues(this.helper,"offsetX",{offsetX:i.offsetX},!0);this.diagram._comparePropertyValues(this.helper,"offsetY",{offsetY:i.offsetY},!0);this.helper.shape!="polygon"||this._drawingPolygon||(this.helper.width=this.helper.width!=0?this.helper.width:5,this.helper.height=this.helper.height!=0?this.helper.height:5);t.datavisualization.Diagram.SvgContext.update(this.helper,this.diagram)},r.prototype._updateSize=function(n,i,r){var o=this._drawingPolygon?this._points:[i,r],f=t.datavisualization.Diagram.Geometry.rect(o),u={width:f.width,height:f.height},e={x:f.x,y:f.y};t.datavisualization.Diagram.Geometry.isEmptySize(u)||(this.helper.type!="bpmn"?(n.offsetX=e.x+u.width/2,n.offsetY=e.y+u.height/2,n.width=u.width,n.height=u.height,n._shape==="path"&&(n._scaled=!0)):(n._type="group",this.diagram._translate(n,e.x+u.width/2-n.offsetX,e.y+u.height/2-n.offsetY,this.diagram.nameTable),this.diagram.scale(n,u.width/this.helper.width,u.height/this.helper.height,new t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),this.diagram.nameTable),t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram)))},r}(i);t.datavisualization.Diagram.ShapeTool=s;r=function(i){function r(n,t){i.call(this,n,t);this.cursor="crosshair";this._isMouseDown=!1;this._targetPossibleConnection=null;this._sourcePossibleConnection=null;this._targetPort=null;this._sourcePort=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){if(i.prototype.mousedown.call(this,n),t.datavisualization.Diagram.Util.isPageEditable(this.diagram)){if(this._isMouseDown=!0,this.diagram._hasSelection()&&this.diagram._clearSelection(),n&&n.type==="touchstart"&&(this._currentPossibleConnection=this.diagram._findConnectableNodeUnderMouse(n),this._currentPossibleConnection)){var r=this.mousePosition(n);this._possibleConnectionPort=this.diagram._findPortAtPoint(r,this._currentPossibleConnection)}this._currentPossibleConnection&&(this._sourcePossibleConnection=this._currentPossibleConnection,this._sourcePort=this._possibleConnectionPort);this._raiseEndPointDrag(this.helper,!0,!1,t.datavisualization.Diagram.DragState.Starting)}},r.prototype.mousemove=function(r){if(i.prototype.mousemove.call(this,r),this._checkConnectionPossible(r),this._isMouseDown)if(this.inAction){if(this._targetPossibleConnection=this._currentPossibleConnection,this._targetPort=this._possibleConnectionPort,this.helper){var f=this._raiseEndPointDrag(this.helper,!0,!1,t.datavisualization.Diagram.DragState.Dragging),u=n.extend(!0,{},this.helper);f.cancel||this._updateHelper();this.diagram._comparePropertyValues(this.helper,"sourcePoint",{sourcePoint:u.sourcePoint},!0);this.diagram._comparePropertyValues(this.helper,"targetPoint",{targetPoint:u.targetPoint},!0);this.diagram._comparePropertyValues(this.helper,"segments",{segments:u.segments},!0);this.diagram._comparePropertyValues(this.helper,"targetNode",{targetNode:this._targetPossibleConnection},!0);this.diagram._comparePropertyValues(this.helper,"targetPort",{targetPort:this._targetPort},!0)}}else this.inAction=!0,this._initHelper(),this._renderHelper();this.previousPoint=this.currentPoint},r.prototype.mouseup=function(n){var r,u,f,s;if(this._isMouseDown=!1,this.inAction){this.inAction=!1;var e=this._getStartPoint(),o=this._getCurrentPoint(),h=t.datavisualization.Diagram.Geometry.distance(e,o);this._outOfBoundsDrag(this.helper,o.x,o.y)&&this._outOfBoundsDrag(this.helper,e.x,e.y)&&h>0&&(r=this.createConnector(e,o),r.name="connector"+t.datavisualization.Diagram.Util.randomId(),this._sourcePossibleConnection&&(this._sourcePort&&t.datavisualization.Diagram.Util.canConnect(this._sourcePort,!0)?(u=this._raiseEvent("connectionChange",{element:r,connection:this._sourcePossibleConnection,port:this._sourcePort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._sourcePossibleConnection.outEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.sourceNode=this._sourcePossibleConnection.name,r.sourcePort=this._sourcePort.name)):t.datavisualization.Diagram.Util.canConnect(this._sourcePossibleConnection)&&(u=this._raiseEvent("connectionChange",{element:r,connection:this._sourcePossibleConnection,port:this._sourcePort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._sourcePossibleConnection.outEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.sourceNode=this._sourcePossibleConnection.name))),this._targetPossibleConnection&&(this._targetPort&&t.datavisualization.Diagram.Util.canConnect(this._targetPort,!0)?(u=this._raiseEvent("connectionChange",{element:r,connection:this._targetPossibleConnection,port:this._targetPort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._targetPossibleConnection.inEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.targetNode=this._targetPossibleConnection.name,r.targetPort=this._targetPort.name)):t.datavisualization.Diagram.Util.canConnect(this._targetPossibleConnection)&&(u=this._raiseEvent("connectionChange",{element:r,connection:this._targetPossibleConnection,port:this._targetPort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._targetPossibleConnection.inEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.targetNode=this._targetPossibleConnection.name))),s=this.diagram.add(r),s&&(r=this.diagram.nameTable[r.name],t.datavisualization.Diagram.Util.updateBridging(r,this.diagram),t.datavisualization.Diagram.SvgContext.update(r,this.diagram),this.diagram._updateConnectorBridging(r)))}this.singleAction&&this.diagram.deactivateTool();this._prevTool&&(this._prevTool.inAction=!1);this._showPorts();i.prototype.mouseup.call(this,n)},r.prototype._getStartPoint=function(){return this._sourcePossibleConnection&&this._sourcePort?t.datavisualization.Diagram.Util._getPortPosition(this._sourcePort,t.datavisualization.Diagram.Util.bounds(this._sourcePossibleConnection)):this.snap(this.startPoint)},r.prototype._getCurrentPoint=function(){return this._targetPossibleConnection&&this._targetPort?t.datavisualization.Diagram.Util._getPortPosition(this._targetPort,t.datavisualization.Diagram.Util.bounds(this._targetPossibleConnection)):this.snap(this.currentPoint)},r.prototype._initHelper=function(){this.helper=this.createConnector(t.datavisualization.Diagram.Point(0,0),t.datavisualization.Diagram.Point(0,0));this.diagram._setZorder(this.helper);this.helper.name="helper";this.helper._connectorType="helper"},r.prototype.createConnector=function(){return null},r.prototype._renderHelper=function(){this.svgHelper||(this.svgHelper=t.datavisualization.Diagram.SvgContext.renderConnector(this.helper,this.diagram._svg,this.diagram._diagramLayer,this.diagram),this.svgHelper=this.diagram._svg.document.getElementById(this.helper.name),this.svgHelper.setAttribute("pointer-events","none"),n(this.diagram._svg.getElementById(this.svgHelper.id)).attr("pointer-events","none"),n(this.diagram._svg.getElementById(this.svgHelper.id+"_hitTest")).attr("pointer-events","none"))},r.prototype._outOfBoundsDrag=function(n,i,r){if(i=i?i:0,r=r?r:0,n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var u=this._getPageBounds();if(!this.diagram._selectedSymbol&&(i>=u.width||i<=u.x)||!this.diagram._selectedSymbol&&(r>=u.height||r<=u.y))return this.updateCursor("not-allowed"),!1}else if(n.sourceNode!=null&&!t.datavisualization.Diagram.bpmnHelper.canMoveOutofBounds(this.diagram,n,i,r))return this.updateCursor("not-allowed"),!1;return this.updateCursor(this.cursor),!0},r.prototype._updateHelper=function(){var r=[],n=this._getStartPoint(),i=this._getCurrentPoint();r.push(n);r.push(i);this._outOfBoundsDrag(this.helper,i.x,i.y)&&this._outOfBoundsDrag(this.helper,n.x,n.y)&&(this.diagram._setEndPoint(this.helper,n,!1),this.diagram._setEndPoint(this.helper,i,!0),this._disconnect(this.helper),this._sourcePossibleConnection&&(this._sourcePort&&t.datavisualization.Diagram.Util.canConnect(this._sourcePort,!0)?(this.helper.sourceNode=this._sourcePossibleConnection.name,this.helper.sourcePort=this._sourcePort.name,this._sourcePossibleConnection.outEdges.push(this.helper.name)):t.datavisualization.Diagram.Util.canConnect(this._sourcePossibleConnection)&&(this.helper.sourceNode=this._sourcePossibleConnection.name,this._sourcePossibleConnection.outEdges.push(this.helper.name))),this._targetPossibleConnection&&(this._targetPort&&t.datavisualization.Diagram.Util.canConnect(this._targetPort,!0)?(this.helper.targetNode=this._targetPossibleConnection.name,this.helper.targetPort=this._targetPort.name,this._targetPossibleConnection.inEdges.push(this.helper.name)):t.datavisualization.Diagram.Util.canConnect(this._targetPossibleConnection)&&(this.helper.targetNode=this._targetPossibleConnection.name,this._targetPossibleConnection.inEdges.push(this.helper.name))),this.diagram._dock(this.helper,this.diagram.nameTable));t.datavisualization.Diagram.SvgContext.update(this.helper,this.diagram)},r.prototype._endAction=function(){i.prototype._endAction.apply(this);this._targetPossibleConnection=null;this._sourcePossibleConnection=null;this._targetPort=null;this._sourcePort=null;this._isMouseDown=!1},r.prototype._showPorts=function(){},r.prototype._showAllPorts=function(n){i.prototype._showAllPorts.call(this,n)},r}(i);t.datavisualization.Diagram.LineTool=r;h=function(i){function r(n){i.call(this,"straightLine",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createConnector=function(t,i){var r={segments:[{type:"straight"}],sourcePoint:t,targetPoint:i};return this.diagram._getNewConnector(n.extend(!0,{},r,this.diagram.model.drawType))},r}(r);t.datavisualization.Diagram.StraightLineTool=h;c=function(i){function r(n){i.call(this,"orthogonalLine",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createConnector=function(t,i){var r={segments:[{type:"orthogonal"}],sourcePoint:t,targetPoint:i};return this.diagram._getNewConnector(n.extend(!0,{},r,this.diagram.model.drawType))},r}(r);t.datavisualization.Diagram.OrthogonalLineTool=c;l=function(i){function r(n){i.call(this,"bezierLine",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createConnector=function(t,i){var r={segments:[{type:"bezier"}],sourcePoint:t,targetPoint:i};return this.diagram._getNewConnector(n.extend(!0,{},r,this.diagram.model.drawType))},r}(r);t.datavisualization.Diagram.BezierLineTool=l;a=function(i){function r(n){i.call(this,"rotatetool",n);this._mouseOffset=t.datavisualization.Diagram.Size(0,0);this.undoObject=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(t){var u,r,f,e;i.prototype.mousedown.call(this,t);this.selectedObject=this.diagram.selectionList[0];r={};(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(r=this.diagram._getChildTable(this.selectedObject,r));f={childTable:r,node:this.selectedObject};u=n.extend(!0,{},f);this.undoObject=jQuery.extend(!0,{},u);e=this.diagram._currZoom},r.prototype.mousemove=function(n){var f,e,r,o,u,s;if(i.prototype.mousemove.call(this,n),f=!this.inAction,this.selectedObject){if(!this.inAction){if(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")for(e=this.diagram._getChildren(this.selectedObject.children),r=0;r<e.length;r++)if(o=this.diagram.nameTable[e[r]],!o.segments&&!t.datavisualization.Diagram.Util.canRotate(o))return;this._initialValue=this.selectedObject.rotateAngle;this.inAction=!0}u=!1;this.selectedObject.parent?(s=this.diagram.nameTable[this.selectedObject.parent],s.container&&(u=!0)):this.selectedObject.type=="pseudoGroup"&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(u=!0);u?this.selectedObject.type=="pseudoGroup"&&this._isParentAsLane(this.selectedObject)?(t.datavisualization.Diagram.canvasHelper._removeFromParentContainer(this.diagram,this.selectedObject),this._rotate(this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram)):(this.helper||(this.helper=this._getCloneNode(this.selectedObject),this.helper.inEdges=this.helper.outEdges=[],this.helper.type=null,this.helper.name="helper"),this._rotate(this.helper),t.datavisualization.Diagram.SvgContext._drawContainerHelper(this.diagram)):this.selectedObject.type=="pseudoGroup"&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))?this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(this._rotate(this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.diagram._updateSelectionHandle(!0),this.diagram._renderTooltip(this.selectedObject,f)):(this.selectedObject.type==="pseudoGroup"&&this._updateMultipleUndoObject(this.selectedObject),this._rotate(this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.diagram._updateSelectionHandle(!0),this.diagram._renderTooltip(this.selectedObject,f))}this.previousPoint=this.currentPoint},r.prototype._rotate=function(n){var u,f,e=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),c=this.currentPoint,r=t.datavisualization.Diagram.Geometry.findAngle(t.datavisualization.Diagram.Point(e.x,e.y),c)+90,i,o,s,h;r=t.datavisualization.Diagram.SnapUtil._snapAngle(this.diagram,r)-n.rotateAngle;i=t.datavisualization.Diagram.Util.bounds(n);u=t.datavisualization.Diagram.Rectangle(i.left,i.top,i.right-i.left,i.bottom-i.top);o={bounds:u,offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height};this.diagram._comparePropertyValues(n,"rotateAngle",{rotateAngle:r},!0);this.diagram._rotate(n,r,this.diagram.nameTable);i=t.datavisualization.Diagram.Util.bounds(n);f=t.datavisualization.Diagram.Rectangle(i.left,i.top,i.right-i.left,i.bottom-i.top);s={bounds:f,offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height};h=this._raiseEvent("rotationChange",{element:this.diagram.getNode(n),angle:n.rotateAngle,oldValue:o,newValue:s,cancel:!1});h.cancel&&this.diagram._rotate(n,-r,this.diagram.nameTable)},r.prototype.mouseup=function(r){var u,h,c,f,l,a;if(this.inAction){this.inAction=!1;var e=!1,o=!0,s=!1;this.selectedObject.parent?(u=this.diagram.nameTable[this.selectedObject.parent],u.container&&(e=!0)):this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(h=this.diagram.nameTable[this.diagram._getChild(this.selectedObject.children[0])],u=this.diagram.nameTable[h.parent],u.container&&(e=!0));(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this.diagram._activeSwimLane?t.datavisualization.Diagram.canvasHelper._multiNodeRotate(this.diagram,r,this.selectedObject):e&&(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),this._removeHighLighter(),u.container.type=="canvas"&&(s=!0),s&&(t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this.diagram,this.diagram.activeTool.helper,u)?t.datavisualization.Diagram.canvasHelper._singleNodeRotate(this.diagram,r,this.selectedObject):o=!1));this.selectedObject.type!="pseudoGroup"?o&&this._rotate(this.selectedObject):this._fromContainer(this.diagram._getChildren(this.selectedObject.children))||this._rotate(this.selectedObject);t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram);f={};(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(f=this.diagram._getChildTable(this.selectedObject,f));l={childTable:f,node:this.selectedObject};c=n.extend(!0,{},l);a={type:"rotationchanged",undoObject:this.undoObject,redoObject:jQuery.extend(!0,{},c),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"};this._multipleUndo||this.diagram.addHistoryEntry(a);this.selectedObject&&t.datavisualization.Diagram.SvgContext._removePivotPoint(this.selectedObject,this.diagram._adornerSvg,this.diagram._currZoom);this.diagram._updateSelectionHandle();this.diagram._removeTooltip()}this._multipleUndo=!1;i.prototype.mouseup.call(this,r)},r}(i);t.datavisualization.Diagram.RotateTool=a;v=function(n){function i(i){n.call(this,"PivotTool",i);this._mouseOffset=t.datavisualization.Diagram.Size(0,0)}return t.datavisualization.Diagram.extend(i,n),i.prototype.mousedown=function(t){n.prototype.mousedown.call(this,t);this.selectedObject=this.diagram.selectionList[0]},i.prototype.mousemove=function(i){if(n.prototype.mousemove.call(this,i),this.selectedObject)if(this.inAction){var r=this.currentPoint.x-this.previousPoint.x,u=this.currentPoint.y-this.previousPoint.y,f=t.Matrix.identity();t.Matrix.rotate(f,-this.selectedObject.rotateAngle);var e=t.Matrix.transform(f,t.datavisualization.Diagram.Point(r,u)),o=(this.selectedObject.width*this.selectedObject.pivot.x+e.x)/this.selectedObject.width,s=(this.selectedObject.height*this.selectedObject.pivot.y+e.y)/this.selectedObject.height;this.selectedObject.pivot.x=o;this.selectedObject.pivot.y=s;this.selectedObject.offsetX+=r;this.selectedObject.offsetY+=u;this.diagram._updateSelectionHandle()}else this.inAction=!0;this.previousPoint=this.currentPoint},i.prototype._rotate=function(n){var i=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),r=this.currentPoint,u=this.FindAngle(i,r);this.diagram._rotate(n,u-n.rotateAngle,i,this.diagram.nameTable)},i.prototype.mouseup=function(t){this.inAction&&(this.inAction=!1,this.diagram._updateSelectionHandle());n.prototype.mouseup.call(this,t)},i}(i);t.datavisualization.Diagram.PivotTool=v;y=function(n){function i(t){n.call(this,"panTool",t);this.diagram=t;this._isMouseDown=!1;this.cursor="pointer"}return t.datavisualization.Diagram.extend(i,n),i.prototype.mousedown=function(t){var r;n.prototype.mousedown.call(this,t);var u=this.diagram._svg.document,i=this.diagram._svg.document.createSVGPoint(),f=this.diagram._isTouchEvent(t);return i.x=f.clientX,i.y=f.clientY,r=i.matrixTransform(this.diagram._svg.document.getScreenCTM().inverse()),u.lastMouseX=r.x,u.lastMouseY=r.y,this._isMouseDown=!0,!1},i.prototype.mousemove=function(i){if(n.prototype.mousemove.call(this,i),this._isMouseDown&&(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y)){this.inAction=!0;var r=this.diagram._svg.document,u=this.diagram._svg.document.createSVGPoint(),h=this.diagram._isTouchEvent(i);u.x=h.clientX;u.y=h.clientY;var c=u.matrixTransform(this.diagram._svg.document.getScreenCTM().inverse()),f=c.x,e=c.y,o,s;return o=f-r.lastMouseX,s=e-r.lastMouseY,this.diagram.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableX||(o=0),this.diagram.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableY||(s=0),t.datavisualization.Diagram.ZoomUtil.zoomPan(this.diagram,1,o,s,t.datavisualization.Diagram.Point(f,e)),r.lastMouseX=f,r.lastMouseY=e,!1}},i.prototype.mouseup=function(i){this.inAction=!1;document.onmousemove=null;document.onmouseup=null;this._isMouseDown=!1;this.diagram._removeTooltip();this.diagram._isEditing||this.diagram._isDragg||this.diagram._endEdit();delete this.hoverNode;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);n.prototype.mouseup.call(this,i)},i}(i);t.datavisualization.Diagram.PanTool=y;p=function(i){function r(n,r){i.call(this,n,r);this.boundingRect=t.datavisualization.Diagram.Rectangle();this.activeLabel=null;this._overNode="";this.cursor="crosshair"}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){i.prototype.mousedown.call(this,n);this._findNodeUnderMouse(n);var t=this._getNodeUnderMouse();t&&(this._overNode=this.selectedObject&&!this.selectedObject.isLane||t.isLane?t.name:"");this.diagram._isEditing&&this.diagram._endEdit()},r.prototype.createNode=function(){},r.prototype.mousemove=function(n){i.prototype.mousemove.call(this,n);t.datavisualization.Diagram.Util.isPageEditable(this.diagram)&&(this.selectedObject||t.datavisualization.Diagram.Geometry.isEmptyPoint(this.startPoint)||this.diagram._isEditing||(this.inAction?this._updateHelper():(this.inAction=!0,this._initHelper())))},r.prototype.mouseup=function(n){var r,u,i;this.activeLabel=null;r=12;this.inAction?(i=this.getBoundingRect(this.startPoint,this.currentPoint),this._endAction(),(i.width===0||i.height===0)&&(i.width=90,i.height=r),this.selectedObject=this.createNode(i.x+i.width/2,i.y+i.height/2,i.width,i.height),this.diagram._startEdit(this.selectedObject)):(u=this._findNodeUnderMouse(n),t.datavisualization.Diagram.Util.isPageEditable(this.diagram)&&(u==null||u.isSwimlane||u.isLane?(i=t.datavisualization.Diagram.Rectangle(this.currentPoint.x-45,this.currentPoint.y-r/2,90,r),this._endAction(),this.selectedObject=this.createNode(i.x+i.width/2,i.y+i.height/2,i.width,r),this.diagram._startEdit(this.selectedObject)):(this.selectedObject=u,this.diagram._startEdit(this.selectedObject))));this._overNode=""},r.prototype.getBoundingRect=function(n,t){var n=this.snap(this.startPoint),t=this.snap(this.currentPoint),i=Math.abs(n.x-t.x),r=Math.abs(n.y-t.y),u=n.x>t.x?t.x:n.x,f=n.y>t.y?t.y:n.y;return{x:u,y:f,width:i,height:r}},r.prototype._initHelper=function(){var n,t,i;this._svgHelper||(n=this.diagram._adornerSvg.g(),this.diagram._adornerLayer.appendChild(n),t=this.diagram._currZoom,i=this.diagram._svg.rect({id:"helper",x:this.startPoint.x*t,y:this.startPoint.y*t,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"}),n.appendChild(i),n.setAttribute("pointer-events","none"),this._svgHelper=n)},r.prototype._updateHelper=function(){var n=this.snap(this.startPoint),t=this.snap(this.currentPoint),r=this.diagram._adornerSvg.getElementById("helper"),u=Math.abs(n.x-t.x),f=Math.abs(n.y-t.y),i=this.diagram._currZoom,e=(n.x>t.x?t.x:n.x)*i,o=(n.y>t.y?t.y:n.y)*i;r&&this.diagram._adornerSvg.rect({id:r.id,x:e,y:o,width:u*i,height:f*i})},r.prototype._endAction=function(){this._svgHelper&&(this.diagram._adornerLayer.removeChild(this._svgHelper),this._svgHelper=null);i.prototype._endAction.apply(this)},r.prototype._findNodeUnderMouse=function(t){var i,o=this.diagram._isForeignObject(t.target),e,s,r,f;if(o&&(t.target=o),e=t.target,e.getAttribute("class")=="ej-d-label")s=n(e).parents(".ej-d-node,.ej-d-connector,.ej-d-group")[0],i=this._findObj(s),this.activeLabel=this.diagram._findLabelAtPoint(this.currentPoint,i);else if(r=n(t.target).parents("g"),r.length>3){var h=r[r.length-4],c=h.getAttribute("id"),u=h.getAttribute("class");u&&(u==="ej-d-node"||u==="ej-d-group"?(i=this.diagram._findNode(c),f=this.diagram._findLabelAtPoint(this.currentPoint,i),this.activeLabel=f):u==="ej-d-connector"&&(i=this.diagram._findConnector(c),f=this.diagram._findLabelAtPoint(this.currentPoint,i),this.activeLabel=f))}return i},r}(t.datavisualization.Diagram.ToolBase);t.datavisualization.Diagram.TextToolBase=p;w=function(i){function r(n){i.call(this,"textTool",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createNode=function(i,r,u,f){var s={offsetX:i,offsetY:r,width:u,height:f,parent:this._overNode,labels:[],ports:[],type:"text"},e=this.diagram._getNewNode(n.extend(!0,{},s,this.diagram.model.drawType)),o;return e.name=this.diagram.model.drawType.name?this.diagram.model.drawType.name+t.datavisualization.Diagram.Util.randomId():"text"+t.datavisualization.Diagram.Util.randomId(),(e._type="text")&&(e._type="node"),o=this.diagram.nameTable[e.parent],o&&o.container&&this._updateMargin(e,o),e},r}(t.datavisualization.Diagram.TextToolBase);t.datavisualization.Diagram.TextTool=function(n){return new w(n)};b=function(i){function r(n){i.call(this,"phase",n);this.selectedSeperator=null;this._svgHelper=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){i.prototype.mousedown.call(this,n);this.inAction=!0;this.diagram._selectedGNode=null},r.prototype._getSeperator=function(t){if(n(t.target).parents("g").first()[0]){var i=n(t.target).parents("g").first()[0].id;if(i)return this._getphase(i.split("_phase_g")[0])}},r.prototype._removePhasehelper=function(){t.datavisualization.Diagram.SvgContext._removePhasehelper(this.diagram)},r.prototype._outOfBoundsDrag=function(n){var f=this.currentPoint.x-this.startPoint.x,e=this.currentPoint.y-this.startPoint.y,i,r,u;if(n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){if(i=this._getPageBounds(),r=this.diagram.nameTable[n.parent],r&&((u=t.datavisualization.Diagram.Util.bounds(r),!this.diagram._selectedSymbol&&(u.right+f>=i.width||n.offset+f<i.x))||!this.diagram._selectedSymbol&&(u.bottom+e>=i.height||n.offset+e<i.y)))return this.updateCursor("not-allowed"),!1;n.orientation=="horizontal"?this.updateCursor("e-resize"):this.updateCursor("n-resize")}return!0},r.prototype._updatePhasehelper=function(i){var f=this._bounds?jQuery.extend(!0,{},this._bounds):this.diagram._getPhaseBounds(i),r,u,e=this.startPoint,o=this.currentPoint,s={snapped:!1,offset:0,left:!1,right:!1},h={snapped:!1,offset:0,top:!1,bottom:!1};this.selectedObject=this.diagram.nameTable[this.selectedSeperator.parent];this.initialBounds={width:this.selectedObject.width,height:this.selectedObject.height,y:this.selectedObject.offsetY,x:this.selectedObject.offsetX};i.orientation==="horizontal"?(r=o.x-e.x,r=this._snapRight(s,h,r,0,this.selectedObject,!1),u=0,this.diagram._comparePropertyValues(i,"offset",{offset:i.offset+r},!0)):(r=0,u=o.y-e.y,u=this._snapBottom(s,h,0,u,this.selectedObject,!1),this.diagram._comparePropertyValues(i,"offset",{offset:i.offset+u},!0));f&&(f.width+=r,f.height+=u,this._helperBounds=n.extend(!0,{},f),t.datavisualization.Diagram.SvgContext._updatePhaseHelper(this.diagram,i,f))},r.prototype._drawPhasehelper=function(n){var i=this.diagram._getPhaseBounds(n);n&&i&&t.datavisualization.Diagram.SvgContext._phasehelper(this.diagram,n,i)},r.prototype.mousemove=function(n){if(i.prototype.mousemove.call(this,n),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this._outOfBoundsDrag(this.selectedSeperator)){if(this.selectedSeperator)this.selectedSeperator&&(this._bounds||(this._bounds=this.diagram._getPhaseBounds(this.selectedSeperator)),this._updatePhasehelper(this.selectedSeperator));else{if(this.inAction){var r=this._getSeperator(n);r&&!this.selectedSeperator&&(this.selectedSeperator=r)}this._drawPhasehelper(this.selectedSeperator);this.diagram.selectionList[0]&&this.diagram.selectionList[0].type!="phase"?(this.diagram._clearSelection(!0),this.diagram.addSelection(this.selectedSeperator,!0)):this.diagram.addSelection(this.selectedSeperator,!0)}this.previousPoint=this.currentPoint}},r.prototype._getPadding=function(n){var r=20,u=20,f=this.diagram.nameTable[this.diagram._getChild(n.children[n.children.length-1])],i,t;return f&&(i=f.children,i.length>0&&(t=this.diagram.nameTable[this.diagram._getChild(i[0])],t&&t.isLane&&(r=t.paddingRight,u=t.paddingBottom))),{x:r,y:u}},r.prototype.mouseup=function(n){var u=this._getSeperator(n),e,r,h,c;if(this.diagram.selectionList.length>0&&u&&this.diagram.selectionList[0].name!=u.name&&this.diagram._clearSelection(!0),u&&!this.selectedSeperator)this.selectedSeperator=u,this.diagram.addSelection(this.selectedSeperator,!0);else if(this.selectedSeperator&&(e=this.selectedSeperator.parent.split("phaseStack")[0],e&&(r=this.diagram.nameTable[e],r&&this._helperBounds&&r.isSwimlane))){var o=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this.diagram,r),f=0,s=o.indexOf(this.selectedSeperator.name);s>0?f=this.diagram.nameTable[o[s-1]].offset:r.orientation==="horizontal"&&(f=50);h=jQuery.extend(!0,{},this.selectedSeperator);r.orientation==="horizontal"?this.diagram._updatePhase({name:this.selectedSeperator.name,offset:f+this._helperBounds.width}):this.diagram._updatePhase({name:this.selectedSeperator.name,offset:f+this._helperBounds.height});c={type:"phasepositionchanged",undoObject:jQuery.extend(!0,{},h),redoObject:jQuery.extend(!0,{},jQuery.extend(!0,{},this.selectedSeperator)),category:"internal"};this._multipleUndo||this.diagram.addHistoryEntry(c);this.diagram.addSelection(this.selectedSeperator,!0)}this._removePhasehelper();this._bounds=null;this.inAction=!1;this.selectedSeperator=null;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);i.prototype.mouseup.call(this,n)},r.prototype._getOuterPhaseNodes=function(n,i){var f,r,e;if(n){var o=this.diagram.nameTable[this.diagram._getChild(n.children[2])],s=[],h=null,u=null;for(f=0;o&&f<o.children.length;f++)if(r=this.diagram.nameTable[this.diagram._getChild(o.children[f])],r&&r.children&&r.children.length>1)for(e=0;e<r.children.length;e++)u=this.diagram.nameTable[this.diagram._getChild(r.children[e])],u&&(h=t.datavisualization.Diagram.Util.bounds(u),i?h.y>n.offsetY-n.height/2+this.selectedSeperator.offset&&s.push(u):h.x>n.offsetX-n.width/2+this.selectedSeperator.offset&&s.push(u))}return s},r}(i);t.datavisualization.Diagram.PhaseTool=b}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.LayoutTypes={None:"none",HierarchicalTree:"hierarchicaltree",OrganizationalChart:"organizationalchart",RadialTree:"radialtree"};t.datavisualization.Diagram.ChartOrientations={Horizontal:"horizontal",Vertical:"vertical"};t.datavisualization.Diagram.ChartTypes={Left:"left",Right:"right",Alternate:"alternate",Center:"center"};t.datavisualization.Diagram.Layout={doLayout:function(i,r){var e=i.model,u={diagram:i,_anchorX:0,_anchorY:0,_graphNodes:{},_firstLevelNodes:[],_centerNode:null,levels:[],maxLevel:0,layoutNodes:[]};for(var f in e.layout)f=="type"?u.type=i._layoutType():f=="orientation"?u.orientation=i._layoutOrientation():f=="fixedNode"?u.fixedNode=i._fixedNode():f=="horizontalSpacing"?u.horizontalSpacing=Number(i._horizontalSpacing()):f=="verticalSpacing"?u.verticalSpacing=Number(i._verticalSpacing()):f=="marginX"?u.marginX=Number(i._layoutMarginX()):f=="marginY"?u.marginY=Number(i._layoutMarginY()):f=="getLayoutInfo"?typeof e.layout.getLayoutInfo=="string"?u.getLayoutInfo=t.util.getObject(e.layout.getLayoutInfo,window):n.isFunction(e.layout.getLayoutInfo)&&(u.getLayoutInfo=e.layout.getLayoutInfo):f=="getConnectorSegments"?typeof e.layout.getConnectorSegments=="string"?u.getConnectorSegments=t.util.getObject(e.layout.getConnectorSegments,window):n.isFunction(e.layout.getConnectorSegments)&&(u.getConnectorSegments=e.layout.getConnectorSegments):u[f]=e.layout[f];return u.updateView=r===undefined?!0:u.updateView,u.objects=[],u.type!="radialtree"?t.datavisualization.Diagram.HierarchicalLayout.doLayout(u):t.datavisualization.Diagram.RadialTreeLayout.doLayout(u),u.updateView?void 0:u.objects}};t.datavisualization.Diagram.HierarchicalLayout={doLayout:function(n){var f,p,o,r,y,t,i,a,v,s,h,c,l,e,u;if(f=n.diagram,p=f.model,o=f.nodes(),o.length>0){for(t=0;t<o.length;t++)r=o[t],r.excludeFromLayout||(y=n._graphNodes[r.name]=this._setUpLayoutInfo(n,r),y.tree.hasSubTree=!1,r.inEdges&&r.inEdges.length||n._firstLevelNodes.push(r));for(t=0;t<n._firstLevelNodes.length;t++)r=n._firstLevelNodes[t],this._updateEdges(n,r,1);if(n._firstLevelNodes.length>0){for(n._rootNode=n._firstLevelNodes[0],a=0,v=0,t=0;t<n._firstLevelNodes.length;t++)i=this._updateTree(n,a,v,n._firstLevelNodes[t],0,n._firstLevelNodes[t-1]),e=n._graphNodes[n._firstLevelNodes[t].name],e.y<i.y&&(i.y=e.y),e.x<i.x&&(i.x=e.x),n.orientation=="lefttoright"||n.orientation=="righttoleft"?v=i.right+n.horizontalSpacing:a=i.right+n.horizontalSpacing,t==0?(s=i.x,c=i.y,h=i.right,l=i.bottom):(s=Math.min(s,i.x),c=Math.min(c,i.y),h=Math.max(h,i.right),l=Math.max(l,i.bottom));for(this._updateAnchor(n,{x:s,y:c,right:h,bottom:l}),f._layoutInAction=!0,t=0;t<n._firstLevelNodes.length;t++)this._updateNodes(n,n._firstLevelNodes[t],0);if(f._layoutInAction=!1,n.updateView||(f._internalLayout=n),n.updateView){for(t=0;t<n._firstLevelNodes.length;t++)this._updateConnectors(n,n._firstLevelNodes[t],1);for(u=0;u<n.diagram.model.connectors.length;u++)delete n.diagram.model.connectors[u]._visited;for(u=0;u<n.diagram.model.nodes.length;u++)delete n.diagram.model.nodes[u]._visited1,delete n.diagram.model.nodes[u]._isRightAdded}}}delete n.diagram.minSpaceBetweenNode},_getGroupBounds:function(n,i){for(var s,h=t.datavisualization.Diagram.Rectangle(),r,l=0,a=n.length;l<a;l++){if(r=i.diagram.nameTable[i.diagram._getChild(n[l])],r)if(r._visited)s=t.datavisualization.Diagram.Util.bounds(r);else{var e=r.width?r.width:r._width||0,o=r.height?r.height:r._height||0,u=i._anchorX,f=i._anchorY,c=0;i.orientation=="lefttoright"?(u+=i._graphNodes[r.name].y+e/2,f+=i._graphNodes[r.name].x+c+o/2):i.orientation=="righttoleft"?(u-=i._graphNodes[r.name].y+e/2,f+=i._graphNodes[r.name].x+c+o/2):i.orientation=="toptobottom"?(u+=i._graphNodes[r.name].x+c+e/2,f+=i._graphNodes[r.name].y+o/2):(u+=i._graphNodes[r.name].x+c+e/2,f-=i._graphNodes[r.name].y+o/2);u=u;f=f;s={x:u-e*r.pivot.x,y:f-o*r.pivot.y,width:e,height:o}}s&&(h=t.datavisualization.Diagram.Geometry.isEmptyRect(h)?s:t.datavisualization.Diagram.Geometry.union(h,s))}return h},_updateTree:function(n,t,i,r,u,f,e){var s,o,l,y,p,h,w,a,b,v,k,c;return r._visited1?r._treeBounds:(r._visited1=!0,s=this._getDimensions(n,r,t,i,u),o=n._graphNodes[r.name],n.maxLevel=Math.max(n.maxLevel,u),l=u,p=this._hasChild(n,r),p||o.tree.assistants.length?(c=s.y+s.height+n.verticalSpacing,o.tree.assistants.length&&(y=this._setDepthSpaceForAssistants(n,r,c,s.height,u,n.verticalSpacing),l=y.level,c=y.bottom),o.tree.assistants.length||o.tree.orientation=="horizontal"||(c=s.y+s.height+n.verticalSpacing/2),o.tree.children.length&&(h=o.tree.orientation=="horizontal"&&(o.tree.type!="balanced"||o.tree.children.length==1)?this._updateHorizontalTree(n,r,f,s.x,c,l):o.tree.type=="balanced"?this._updateHorizontalTreeWithMultipleRows(n,r,f,s.x,c,l):this._updateVerticalTree(n,r,s.x,c,l,e)),o.y&&o.y>s.y||(o.y=s.y),t&&t>o.mid||(t=o.mid),o.tree.assistants.length&&(k=t!==undefined?t:s.x,v=this._setBreadthSpaceForAssistants(n,r,s,k,c,u),p||(a=h=v,t=(a.x+a.right)/2-s.width/2,h=a),b=v?v.canMoveBy:undefined),o.x=t,o.translate||(o._treeWidth=h.right-h.x),w={x:t,y:s.y,right:t+s.width,bottom:s.y+s.height},this._translateSubTree(n,r,w,h,s,u,b,f!=undefined,e),typeof o.firstChild!="string"&&(o.firstChild.x+=o.subTreeTranslation),r._treeBounds=h,h):(r._treeBounds=this._updateLeafNode(n,r,f,s,u,e),r._treeBounds))},_updateLeafNode:function(n,t,i,r,u,f){var e,o;return e=n._graphNodes[t.name],e.x&&e.x>r.x||(e.x=r.x),e.y&&e.y>r.y||(e.y=r.y),e.maxLevel=Math.max(u,e.maxLevel||0),o={x:r.x,y:r.y,right:r.x+r.width,bottom:r.y+r.height},e.maxLevel=Math.max(e.maxLevel||0,u),this._translateSubTree(n,t,o,o,r,u,undefined,i!=undefined,f),{x:e.x,y:e.y,right:e.x+r.width,bottom:e.y+r.height}},_translateSubTree:function(n,t,i,r,u,f,e,o,s){var h=n._graphNodes[t.name],c=n.diagram.nameTable[h.firstChild?h.firstChild.child:h.tree.children[0]],l=c?n._graphNodes[c.name]:null,a=this._hasChild(n,t),v=this._findIntersectingLevels(n,i,f,h.actualLevel),p=this._findIntersectingLevels(n,r,f,h.actualLevel),y=[];v.length&&h.translate?(h.intersect=v,this._spaceLeftFromPrevSubTree(n,t,i),h.canMoveBy=h.diff,e!==undefined&&(h.canMoveBy=Math.min(e,h.canMoveBy)),c&&l.canMoveBy!==undefined&&(l.canMoveBy>=h.canMoveBy&&(h.translated=!0),h.canMoveBy=Math.min(h.canMoveBy,l.canMoveBy)),o&&(h.x-=h.canMoveBy,h.subTreeTranslation-=h.canMoveBy,a&&(this._shiftSubordinates(n,p,h.canMoveBy),r.x=Math.min(r.x,h.x),r.right=Math.max(r.right,h.x+u.width),r.bottom=Math.max(r.bottom,h.y+u.height),r.x-=h.canMoveBy,r.right-=h.canMoveBy),c&&l.canMoveBy>h.canMoveBy?h.canMoveBy=l.canMoveBy-h.canMoveBy:c&&h.canMoveBy!==undefined&&(h.canMoveBy=0))):(a&&(r.x=Math.min(r.x,i.x),r.right=Math.max(r.right,i.x+u.width),r.bottom=Math.max(r.bottom,h.y+u.height)),h.translate||(h.canMoveBy=0,h.subTreeTranslation=0));s||(i={x:h.x,y:u.y,right:h.x+u.width,bottom:u.y+u.height},y.push({rBounds:i}),this._updateRearBounds(n,t,y,f))},_updateRearBounds:function(n,t,i,r,u){var f,o,u,s,h,a=!0,c,l,e;if(t&&(c=n._graphNodes[t.name],u=c.intersect,a=!c.tree.children.length&&!c.tree.assistants.length),s=i[0].rBounds,h=i[i.length-1].rBounds,u&&u.length){for(f=n.levels[u[0]].rBounds,l=f.bottom,f.y<s.y&&(f.bottom=s.y,i.splice(0,0,{rBounds:f})),l>h.bottom?i.push({rBounds:{x:f.x,right:f.right,y:s.bottom,bottom:l}}):(f=n.levels[u[u.length-1]].rBounds,a&&f.bottom>h.bottom&&(f.y=h.bottom,i.push({rBounds:f}))),o=u[0],e=i.length-1;e>=0;e--)n.levels.splice(o,0,i[e]);o+=i.length;n.levels.splice(o,u.length)}else for(o=this._findLevel(n,i[i.length-1].rBounds,r),e=i.length-1;e>=0;e--)n.levels.splice(o,0,i[e])},_shiftSubordinates:function(n,t,i){var r;if(i!=0)for(r=0;r<t.length;r++)n.levels[t[r]].rBounds&&(n.levels[t[r]].rBounds.x-=i,n.levels[t[r]].rBounds.right-=i)},_setDepthSpaceForAssistants:function(n,t,i,r,u,f){for(var h=n._graphNodes[t.name],s,c,o,l=i,e=0;e<h.tree.assistants.length;e++)s=n._graphNodes[h.tree.assistants[e]],s&&(s.tree.children=s.tree.assistants=[],s.y=i,o=n.diagram.nameTable[h.tree.assistants[e]],c=o.height?o.height:o._height,(n.orientation=="lefttoright"||n.orientation=="righttoleft")&&(c=o.width?o.width:o._width),l=i+c+f/2,n.maxLevel=u+1,e%2==1&&e!=h.tree.assistants.length-1&&(i=l,u++));return{level:n.maxLevel,bottom:i+c+f}},_setBreadthSpaceForAssistants:function(n,t,i,r,u,f){for(var s,y,h,o,c=n._graphNodes[t.name],b=u,a=f,p,v,l,w,e=0;e<c.tree.assistants.length;e++)s=n._graphNodes[c.tree.assistants[e]],s&&(o=n.diagram.nameTable[c.tree.assistants[e]],y=o.width?o.width:o._width,(n.orientation=="lefttoright"||n.orientation=="righttoleft")&&(y=o.height?o.height:o._height),p=e%2==0?r+i.width/2-20-y:r+i.width/2+20,h=this._updateTree(n,p,s.y,n.diagram.nameTable[c.tree.assistants[e]],a+1),this._hasChild(n,t)||(e==0?l=h:this._uniteRects(l,h)),e%2==0&&s.prevBounds&&(v=v===undefined?s.canMoveBy:Math.min(v,s.canMoveBy)),(e%2==1||e==c.tree.assistants.length-1)&&(w=this._findIntersectingLevels(n,h,a+1),this._updateRearBounds(n,null,[{rBounds:h}],a+1,w),a++));return l&&(l.canMoveBy=v),l},_updateHorizontalTree:function(n,t,i,r,u,f){var s,e,h,nt,tt,y,et,p,c,w,it,rt=this._getDimensions(n,t,r,u,f),o=n._graphNodes[t.name],ut=o.tree.type,b=f,ft=r,ot=u,k,d,st=n.levels.slice(0,n.levels.length),g,l,a,v;if(this._hasChild(n,t)){for(g=n.orientation=="lefttoright"||n.orientation=="righttoleft"?!0:!1,l=0;l<o.tree.children.length;l++)s=n.diagram.nameTable[o.tree.children[l]],k=s.width?s.width:s._width,d=s.height?s.height:s._height,nt=g?d:k,tt=g?k:d,et=n.levels[b+1]?n.levels[b+1].rBounds:null,h=this._updateTree(n,ft,ot,s,b+1,n.diagram.nameTable[o.tree.children[l-1]]),e=n._graphNodes[s.name],o.maxLevel=Math.max(o.maxLevel||0,e.maxLevel||0),c={x:e.x,y:e.y,right:e.x+nt,bottom:e.y+tt},l==0&&(p={x:Math.min(e.x,h.x),y:Math.min(e.y,h.y),right:h.right,bottom:h.bottom},y=e),a?(a.x=c.x,a.y=c.y,c.right>a.right&&(a.right=c.right),a.bottom=c.bottom):a=c,l==0&&(o.firstChild={x:e.x,canMoveBy:e.canMoveBy,child:s.name}),this._hasChild(n,s)&&(!o.firstChild||o.firstChild.x>=e.firstChild.x?(e.firstChild&&o.firstChild.canMoveBy<e.canMoveBy&&(v=o.firstChild.canMoveBy,e.canMoveBy=v,n._graphNodes[o.firstChild.child].canMoveBy=v,o.firstChild.canMoveBy=v),o.firstChild={x:e.firstChild.x,canMoveBy:v!==undefined?v:e.canMoveBy,child:s.name}):e.firstChild&&e.translated&&o.firstChild.canMoveBy>e.canMoveBy&&(o.firstChild.canMoveBy=n._graphNodes[o.firstChild.child].canMoveBy=e.canMoveBy)),w=w?Math.max(e.maxLevel,w):e.maxLevel,s._isRightAdded||(this._uniteRects(p,h),ft=l!=0&&!this._hasChild(n,s)&&e.subTreeTranslation<0?h.right-e.subTreeTranslation+n.horizontalSpacing:h.right+n.horizontalSpacing),s._isRightAdded=!0;isNaN(it)||(y.canMoveBy=it);o.mid=(y.x+a.right)/2-rt.width/2;ut=="left"?o.mid=c.right-rt.width:ut=="right"&&(o.mid=r)}return p},_updateHorizontalTreeWithMultipleRows:function(n,t,i,r,u,f,e){var h,l,a,rt,kt,st,ut,ni,ft=this._getDimensions(n,t,r,u,f),b=n._graphNodes[t.name],fi=b.tree.type,g=f,nt=r,ht=u,et,ot,ei=n.levels.slice(0,n.levels.length),e=[],tt=0,bt,lt,p,it,d,ti,dt,gt,at,oi,v,o,vt,yt,pt,wt,s;if(this._hasChild(n,t)){var ct=n.orientation=="lefttoright"||n.orientation=="righttoleft"?!0:!1,w=this._splitChildrenInRows(n,t),k=b.tree.children.length==5&&w[0].length==3,y=[],c=[];if(k)c=w;else for(o=0;o<w.length;o++){if(y[o]=[],c[o]=[],bt=w[o].length,w[o].length%2!=1)for(bt=Math.ceil(w[o].length/2),lt=0;lt<bt;lt++)y[o].push(w[o][lt]);for(s=y[o].length;s<w[o].length;s++)c[o].push(w[o][s])}for(p=[],tt=0,o=0;o<y.length&&y[o].length;o++){for(nt=r,p[o-1]&&(ht=p[o-1].bottom+n.verticalSpacing),s=0;s<y[o].length;s++)h=n.diagram.nameTable[y[o][s]],et=h.width?h.width:h._width,ot=h.height?h.height:h._height,rt=ct?ot:et,kt=ct?et:ot,st=n.levels[g+1]?n.levels[g+1].rBounds:null,l=n._graphNodes[h.name],l.actualLevel=g+1+o,a=this._updateTree(n,nt,ht,h,g+1,n.diagram.nameTable[y[o][s-1]]),s==0?p[o]={x:a.x,y:a.y,right:a.right,bottom:a.bottom}:this._uniteRects(p[o],a),o==0&&s==0?(tt=l.canMoveBy,b.firstChild={x:l.x,child:h.name,canMoveBy:l.canMoveBy}):s==0&&l.canMoveBy!==undefined&&tt>l.canMoveBy&&(tt=Math.min(tt,l.canMoveBy||0),b.firstChild={x:l.x,child:h.name,canMoveBy:l.canMoveBy}),nt=a.right+n.horizontalSpacing;it=o==0?p[o].right:Math.max(it,p[o].right);st=ni}for(o=0;o<y.length&&y[o].length;o++){if(it!=p[o].right)for(d=it-p[o].right,s=0;s<y[o].length;s++)ti=n.diagram.nameTable[y[o][s]],dt=n._graphNodes[y[o][s]],dt.x+=d;o==0?ut={x:p[0].x,y:p[0].y,right:p[0].right,bottom:p[0].bottom}:this._uniteRects(ut,p[o]);st=a}for(gt=(it||0)+(it!==undefined?n.horizontalSpacing/2:0),it!==undefined&&(b.mid=gt-ft.width/2,at=it+n.horizontalSpacing),ht=u,v=[],o=0;o<c.length;o++){for(nt=w[o].length%2==1&&o==c.length-1||k?r:at||r,o!=0&&(ht=v[o-1].bottom+n.verticalSpacing),s=0;s<c[o].length;s++)h=n.diagram.nameTable[c[o][s]],et=h.width?h.width:h._width,ot=h.height?h.height:h._height,rt=ct?ot:et,kt=ct?et:ot,st=n.levels[g+1]?n.levels[g+1].rBounds:null,l=n._graphNodes[h.name],l.actualLevel=g+1+o,s==0&&y[o]&&y[o].length&&(l.translate=!1),k&&o==1&&(s==0&&yt+rt+n.horizontalSpacing<=pt&&(vt=!0,nt=yt-rt/2),vt&&s==1&&(nt=pt-rt/2)),a=this._updateTree(n,nt,ht,h,g+1,n.diagram.nameTable[c[o][s-1]]),k&&s<=2&&o==0&&s==1&&(yt=a.x-n.horizontalSpacing/2,pt=a.x+rt+n.horizontalSpacing/2),s==0?v[o]={x:a.x,y:a.y,right:a.right,bottom:a.bottom}:this._uniteRects(v[o],a),ut||(ut={x:v[o].x,y:v[o].y,right:v[o].right,bottom:v[o].bottom}),this._uniteRects(ut,v[o]),nt=a.right+n.horizontalSpacing,st=a,(!b.firstChild||(o==c.length-1&&w[o].length%2==1||k)&&s==0&&l.canMoveBy!==undefined&&tt>l.canMoveBy)&&(tt=Math.min(tt,l.canMoveBy||0),b.firstChild={x:l.x,child:h.name,canMoveBy:l.canMoveBy});if(k&&o==1&&(wt=v[0].right-v[0].x>=v[1].right-v[1].x?0:1),o==w.length-1&&(w[o].length%2==1||k&&o==1)){var e=c[o][Math.floor(c[o].length/2)],ii=n.diagram.nameTable[e],ri=this._getDimensions(n,ii,n._graphNodes[e].x,n._graphNodes[e].y,g+1);if(d=undefined,!vt&&k?(wt==1&&(o=0),d=(v[wt].x+v[wt].right)/2-(v[o].x+v[o].right)/2,o==0&&(b.mid+=d)):k||at===undefined||(d=at-n.horizontalSpacing/2-(n._graphNodes[e].x+ri.width/2)),d!==undefined)for(s=0;s<c[o].length;s++)if(n._graphNodes[c[o][s]].x+=d,n._graphNodes[c[o][s]].canMoveBy+=d,s==c[o].length-1){var si=this._getDimensions(n,n.diagram.nameTable[c[o][s]],n._graphNodes[c[o][s]].x,n._graphNodes[c[o][s]].y,n._graphNodes[c[o][s]].actualLevel),h=n._graphNodes[c[o][s]],ui=this._findIntersectingLevels(n,{x:h.x,y:h.y,right:h.x+ft.width,bottom:h.y+ft.height},n._graphNodes[c[o][s]].actualLevel);this._updateRearBounds(n,null,[{rBounds:{x:h.x,y:h.y,right:h.x+ft.width,bottom:h.y+ft.height}}],n._graphNodes[c[o][s]].actualLevel,ui)}k&&(b.mid=(pt+yt)/2+(o==0?d:0)-ft.width/2);b.mid==undefined&&n._graphNodes[e]&&(b.mid=n._graphNodes[e].x);vt=!1;o++}}}return ut},_updateVerticalTree:function(n,t,i,r,u,f){var s,o,a,k,nt,tt,v,y,ot,p,ct,e,st,it,rt,ut,d,w,h,ht,b=[],l=[],g,ft,et,c;for(ct=this._getDimensions(n,t,i,r,u),e=n._graphNodes[t.name],st=n.diagram.nameTable[e.tree.children[0]],it=n.orientation=="lefttoright"||n.orientation=="righttoleft"?!0:!1,rt=e.tree.type=="left"||e.tree.type=="leftoffset"?-1:0,ut=i,d=r,w=u,h=0;h<e.tree.children.length;h++)e.tree.type=="alternate"&&(ht=h%2==0&&e.tree.children.length>2?"left":"right",rt=h%2==0&&e.tree.children.length>2?-1:0),ut=i+this._findOffset(n,t,e,ht),s=n.diagram.nameTable[e.tree.children[h]],ft=s.width?s.width:s._width,et=s.height?s.height:s._height,k=it?et:ft,nt=it?ft:et,a=this._updateTree(n,ut+rt*k,d,s,u+1,undefined,!0),o=n._graphNodes[s.name],y={x:o.x,y:o.y,right:o.x+k,bottom:o.y+nt},h==0?(this._uniteRects(a,y),v=a):this._uniteRects(v,a),!o.prevBounds||e.tree.type=="alternate"&&h%2==1&&e.tree.children.length>2||(c=c!==undefined?Math.min(o.canMoveBy,c):o.canMoveBy),e.maxLevel=Math.max(e.maxLevel||0,o.maxLevel||0),e.tree.type=="alternate"&&e.tree.children.length>2&&h%2==0?(h!=0&&(d=tt.bottom+n.verticalSpacing/2),l.push({rBounds:y}),o.levelBounds&&(l=l.concat(o.levelBounds))):(d=e.tree.type=="alternate"&&e.tree.children.length>2?Math.max(a.bottom,tt.bottom)+n.verticalSpacing/2:a.bottom+n.verticalSpacing/2,u=e.maxLevel,b.push({rBounds:y}),p?this._uniteRects(p,y):p={x:o.x,y:o.y,right:o.x+k,bottom:o.y+nt},o.levelBounds&&(b=b.concat(o.levelBounds))),h==0&&(e.firstChild={x:o.x,canMoveBy:o.canMoveBy,child:s.name}),this._hasChild(n,s)&&(!e.firstChild||e.firstChild.x>=o.firstChild.x?(o.firstChild&&e.firstChild.canMoveBy<o.canMoveBy&&(c=e.firstChild.canMoveBy,o.canMoveBy=c,n._graphNodes[e.firstChild.child].canMoveBy=c,e.firstChild.canMoveBy=c),e.firstChild={x:o.firstChild.x,canMoveBy:c!==undefined?c:o.canMoveBy,child:s.name}):o.firstChild&&o.translated&&e.firstChild.canMoveBy>o.canMoveBy&&(e.firstChild.canMoveBy=n._graphNodes[e.firstChild.child].canMoveBy=o.canMoveBy)),tt=y;return f?e.levelBounds=b:(e.tree.type=="alternate"&&e.tree.children.length>2&&(ot={x:l[0].rBounds.x,y:l[0].rBounds.y,right:l[l.length-1].rBounds.right,bottom:l[l.length-1].rBounds.bottom},g=this._findIntersectingLevels(n,ot,w+1),this._updateRearBounds(n,null,l,w+1,g)),g=this._findIntersectingLevels(n,p||v,w+1),this._updateRearBounds(n,null,p?b:[{rBounds:v}],w+1,g)),isNaN(c)||(n._graphNodes[st.name].canMoveBy=c),e.childBounds=v,e.mid=i,v},_splitChildrenInRows:function(t,i){var r=t._graphNodes[i.name],u=4,o=[],f=r.tree.children.length,h=n.extend([],!0,r.tree.children),s,e;for(r.tree.rows?(s=r.tree.children.length,e=Math.ceil(s/r.tree.rows),u=e%2==0?e:e+1):r.tree.children.length==3||r.tree.children.length==4?u=2:r.tree.children.length==5&&(u=3);f>0;)o[o.length]=h.splice(0,u),f-=u,f<u&&(u=f);return o},_findOffset:function(n,t,i,r){var u=0,f=n.orientation=="lefttoright"||n.orientation=="righttoleft"?t.height?t.height:t._height:t.width?t.width:t._width,e=r?r:i.tree.type;u=i.tree.offset||(i.tree.offset===0?0:20);i.tree.type=="alternate"&&u>=n.horizontalSpacing&&(u=n.horizontalSpacing/2);switch(e){case"left":u=f/2-u;break;case"right":u=u+f/2}return u},_translateSiblings:function(n,t,i){var r,f,u,e;for(u=n._graphNodes[t.name],e=n._graphNodes[i.name].diff-n._graphNodes[i.name].canMoveBy,r=0;r<u.tree.children.length;r++){if(i.name==u.tree.children[r])break;f=n._graphNodes[u.tree.children[r]];f.x+=e}},_uniteRects:function(n,t){n.x=Math.min(n.x,t.x);n.right=Math.max(n.right,t.right);n.bottom=Math.max(n.bottom,t.bottom)},_spaceLeftFromPrevSubTree:function(n,t,i){for(var r=n._graphNodes[t.name],f,e,o=n.horizontalSpacing,u=0;u<r.intersect.length;u++)e=n.levels[r.intersect[u]].rBounds,f=i.x-(e.right+o),(r.diff==undefined||f<r.diff)&&(r.diff=f,r.prevBounds=n.levels[r.intersect[u]])},_findIntersectingLevels:function(n,t,i,r){var f={x:t.x,y:t.y,right:t.right,bottom:t.bottom},o,u,e;f.y-=n.verticalSpacing/2;f.bottom+=n.verticalSpacing/2;o=[];e=r!==undefined?r:i;u=n.levels[e]?n.levels[e].rBounds:null;do{if(u&&(f.y<u.y&&f.bottom>u.y||f.y<u.bottom&&u.bottom<f.bottom||f.y>=u.y&&f.bottom<=u.bottom||f.y<u.y&&f.bottom>u.bottom))o.splice(0,0,e);else if(u&&u.bottom<f.y)break;e--;u=n.levels[e]?n.levels[e].rBounds:null}while(e>=0);e=(r!==undefined?r:i)+1;u=n.levels[e]?n.levels[e].rBounds:null;do{if(u&&(f.y<u.y&&f.bottom>u.y||f.y<u.bottom&&u.bottom<f.bottom||f.y>=u.y&&f.bottom<=u.bottom||f.y<u.y&&f.bottom>u.bottom))o.push(e);else if(u&&u.y>f.bottom)break;e++;u=n.levels[e]?n.levels[e].rBounds:null}while(e<=n.levels.length);return o},_findLevel:function(n,t){for(var u=t,i=0,r=n.levels[i]?n.levels[i].rBounds:null;i<n.levels.length;){if(r&&u.bottom<r.y)return i;i++;r=n.levels[i]?n.levels[i].rBounds:null}return i},_updateEdges:function(n,i,r){var u=n._graphNodes[i.name],e,f;if(i.outEdges&&i.outEdges.length&&i.isExpanded)for(e=0;e<i.outEdges.length;e++)f=n.diagram.nameTable[n.diagram.nameTable[i.outEdges[e]].targetNode],f.excludeFromLayout||(t.datavisualization.Diagram.Util._collectionContains(f.name,u.tree.children)||u.tree.children.push(f.name),f.outEdges&&f.outEdges.length&&f.isExpanded&&(u.tree.hasSubTree=!0),this._updateEdges(n,f,r+1));u.tree.level=r;u.tree.hasSubTree&&(u.tree.orientation="horizontal");n.getLayoutInfo&&n.type=="organizationalchart"&&(n.getLayoutInfo(n.diagram,i,u.tree),u.tree.type=="balanced"&&u.tree.hasSubTree&&(u.tree.type="center",u.tree.orientation="horizontal"));n.level&&u.tree.type!="alternate"&&r>=n.level&&(u.tree.hasSubTree=!1)},_updateAnchor:function(n,i){var o,s,u,c,l,h,r,f,a,v,y,p,e;if(n.diagram.viewPort=s=t.datavisualization.Diagram.ScrollUtil._viewPort(n.diagram,!0),s.x=0,s.y=0,r=n.bounds?n.bounds:s,f=n.diagram._layoutOrientation(),f=="toptobottom"||f=="bottomtotop"){switch(n.horizontalAlignment){case"left":n._anchorX=r.x-i.x+n.margin.left;break;case"right":n._anchorX=r.x+r.width-n.margin.right-i.right;break;case"center":n._anchorX=r.x+r.width/2-(i.x+i.right)/2}switch(n.verticalAlignment){case"top":a=r.y+n.margin.top;n._anchorY=f=="toptobottom"?a:i.bottom+a;break;case"bottom":v=r.y+r.height-n.margin.bottom;n._anchorY=f=="toptobottom"?v-i.bottom:v;break;case"center":e=r.y+r.height/2;n._anchorY=n.orientation=="toptobottom"?e-(i.y+i.bottom)/2:e+(i.y+i.bottom)/2}}else if(f=="lefttoright"||f=="righttoleft"){switch(n.horizontalAlignment){case"left":y=r.x+n.margin.left;n._anchorX=f=="lefttoright"?y:i.bottom+y;break;case"right":p=r.x+r.width-n.margin.right;n._anchorX=f=="lefttoright"?p-i.bottom:p;break;case"center":e=r.width/2+r.x;n._anchorX=n.orientation=="lefttoright"?e-(i.y+i.bottom)/2:e+(i.y+i.bottom)/2}switch(n.verticalAlignment){case"top":n._anchorY=r.y+n.margin.top-i.x;break;case"center":n._anchorY=r.y+r.height/2-(i.right+i.x)/2;break;case"bottom":n._anchorY=r.y+r.height-n.margin.bottom-i.right}}if(n.fixedNode){for(u=n.diagram.nameTable[n.fixedNode],c=u.width?u.width:u._width,l=u.height?u.height:u._height,n._anchorX=u.offsetX,n._anchorY=u.offsetY,n._anchorX+=n.orientation=="righttoleft"?c*u.pivot.x:-c*u.pivot.x,n._anchorY+=n.orientation=="bottomtotop"?l*u.pivot.y:-l*u.pivot.y,o=u,h=0;o.inEdges.length;)o=this._getParentNode(n,o),h+=n._graphNodes[o.name].subTreeTranslation||0;n.orientation=="lefttoright"||n.orientation=="righttoleft"?(n._anchorX-=n._graphNodes[u.name].y,n._anchorY-=n._graphNodes[u.name].x+h):(n._anchorX-=n._graphNodes[u.name].x+h,n._anchorY-=n._graphNodes[u.name].y)}},_updateConnectors:function(n,i,r){var l,s,u,f,c,y,e,v=0,a=0,p=0,w=0,o=0,b=0,h,k,d;if(f=n._graphNodes[i.name],i.outEdges.length)for(l=0;l<i.outEdges.length;l++)if(s=n.diagram.nameTable[i.outEdges[l]],u=n.diagram.nameTable[s.targetNode],s.visible&&!s._visited){if(s._visited=!0,n.getConnectorSegments)e=n.getConnectorSegments(n.diagram,s);else if(f&&f.tree.children.indexOf(s.targetNode)!=-1){var g=i.width?i.width:i._width,nt=i.height?i.height:i._height,tt=u.width?u.width:u._width,it=u.height?u.height:u._height;n.type=="organizationalchart"&&(n.orientation=="toptobottom"||n.orientation=="bottomtotop"?(a=n.orientation=="toptobottom"?nt:-nt,w=n.orientation=="toptobottom"?-it:it,c=n.orientation=="toptobottom"?"bottom":"top",f.tree.assistants.length?(o=Math.abs(u.offsetY+w/2-(i.offsetY+a/2))-n.verticalSpacing/2,e=[{type:"orthogonal",length:o,direction:c}]):f.tree.orientation=="horizontal"&&(s.segments.length==1||f.tree.type=="balanced")?f.tree.type=="balanced"?f.tree.children.length==5&&l>2?(h=f.tree.children[1],isNaN(n._graphNodes[h]._treeWidth)&&(n._graphNodes[h]._treeWidth=n.diagram.nameTable[h].width),k=l==3?n.diagram.nameTable[h].offsetX-n._graphNodes[h]._treeWidth/2-n.horizontalSpacing/2:n.diagram.nameTable[h].offsetX+n._graphNodes[h]._treeWidth/2+n.horizontalSpacing/2,e=[{type:"orthogonal",length:n.verticalSpacing/2,direction:"bottom"},{type:"orthogonal",length:i.offsetX-k,direction:"left"},{type:"orthogonal",length:u.offsetY+w/2-(i.offsetY+a/2)-n.verticalSpacing,direction:"bottom"}]):(d=Math.min(30,n.verticalSpacing/2)*(c=="bottom"?1:-1),o=Math.abs(u.offsetY+w*u.pivot.y-d-(i.offsetY+a*(1-u.pivot.y))),e=[{type:"orthogonal",length:o,direction:c}]):n.diagram._dock(s,n.diagram.nameTable):f.tree.orientation=="horizontal"?e=[{type:"orthogonal"}]:f.tree.enableRouting&&(o=Math.abs(u.offsetY-(i.offsetY+a/2)),e=[{type:"orthogonal",length:o,direction:c}],f.tree.offset<5&&(y=f.tree.type=="left"?"right":"left",o=n.verticalSpacing/4,b=Math.abs(f.tree.offset)+n.horizontalSpacing/2,e=[{type:"orthogonal",length:o,direction:c},{type:"orthogonal",length:b,direction:y}]))):(v=n.orientation=="lefttoright"?g:-g,p=n.orientation=="lefttoright"?-tt:tt,c=n.orientation=="lefttoright"?"right":"left",f.tree.assistants.length?(o=Math.abs(u.offsetX+p/2-(i.offsetX+v/2))-n.verticalSpacing/2,e=[{type:"orthogonal",length:o,direction:c}]):f.tree.orientation=="horizontal"&&(s.segments.length==1||f.tree.type=="balanced")?f.tree.type=="balanced"?f.tree.children.length==5&&l>2?(h=f.tree.children[1],isNaN(n._graphNodes[h]._treeWidth)&&(n._graphNodes[h]._treeWidth=n.diagram.nameTable[h].width),k=l==3?n.diagram.nameTable[h].offsetY-n._graphNodes[h]._treeWidth/2-n.verticalSpacing/2:n.diagram.nameTable[h].offsetY+n._graphNodes[h]._treeWidth/2+n.verticalSpacing/2,e=[{type:"orthogonal",length:n.horizontalSpacing/2,direction:"right"},{type:"orthogonal",length:i.offsetY-k,direction:"top"},{type:"orthogonal",length:u.offsetX+p/2-(i.offsetX+v/2)-n.horizontalSpacing,direction:"right"}]):(d=Math.min(30,n.horizontalSpacing/2)*(c=="right"?1:-1),o=Math.abs(u.offsetX+p*u.pivot.x-d-(i.offsetX+v*(1-u.pivot.x))),e=[{type:"orthogonal",length:o,direction:c}]):n.diagram._dock(s,n.diagram.nameTable):f.tree.orientation=="horizontal"?e=[{type:"orthogonal"}]:(o=Math.abs(u.offsetX-(i.offsetX+v/2)),e=[{type:"orthogonal",length:o,direction:c}],f.tree.offset<5&&(y=f.tree.type=="left"?"bottom":"top",o=n.verticalSpacing/4,b=Math.abs(f.tree.offset)+10,e=[{type:"orthogonal",length:o,direction:c},{type:"orthogonal",length:b,direction:y}]))))}e?n.diagram.updateConnector(s.name,{segments:e}):n.diagram._dock(s,n.diagram.nameTable);n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(s,n.diagram);u&&(u.isExpanded||this._hasChild(n,u))&&this._updateConnectors(n,u,r+1)}if(f&&f.tree.assistants.length)for(l=0;l<f.tree.assistants.length;l++)u=n.diagram.nameTable[f.tree.assistants[l]],s=n.diagram.nameTable[u.inEdges[0]],o=Math.abs(u.offsetY-(i.offsetY+a/2)),e=[{type:"orthogonal",length:o,direction:c}],e&&n.diagram.updateConnector(s.name,{segments:e}),n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(s,n.diagram),(u.isExpanded||this._hasChild(n,u))&&this._updateConnectors(n,u,r+1)},_updateNodes:function(n,i,r,u,f,e){var c,h,b,k,v,w,d,y,p,g;i._visited=!0;var l=i.width?i.width:i._width,a=i.height?i.height:i._height,o=i.offsetX,s=i.offsetY;if(!i.excludeFromLayout){if(o=n._anchorX,s=n._anchorY,n.orientation=="lefttoright"?(o+=n._graphNodes[i.name].y+l/2,s+=n._graphNodes[i.name].x+r+a/2):n.orientation=="righttoleft"?(o-=n._graphNodes[i.name].y+l/2,s+=n._graphNodes[i.name].x+r+a/2):n.orientation=="toptobottom"?(o+=n._graphNodes[i.name].x+r+l/2,s+=n._graphNodes[i.name].y+a/2):(o+=n._graphNodes[i.name].x+r+l/2,s-=n._graphNodes[i.name].y+a/2),n._graphNodes&&(b=n._graphNodes[i.name],b&&(k=b.tree,k.enableRouting||(n.diagram.minSpaceBetweenNode||(n.diagram.minSpaceBetweenNode=[]),n.diagram.minSpaceBetweenNode.push(i.name)))),f=f?f:0,e=e?e:0,o+=f,s+=e,i.inEdges&&i.inEdges.length>1){for(v=[],w=0;w<i.inEdges.length;w++)d=n.diagram.nameTable[i.inEdges[w]],y=n.diagram.nameTable[d.sourceNode],y&&y.outEdges&&y.outEdges.length<=1&&v.push(y.name);v&&v.length>0&&(p=this._getGroupBounds(v,n,r),n.orientation==="toptobottom"||n.orientation==="bottomtotop"?f=p.x+p.width/2-o:e=p.y+p.height/2-s,o+=f,s+=e)}n.updateView?n.diagram._translate(i,o-(i.offsetX||0),s-(i.offsetY||0),n.diagram.nameTable):(u=i.name==n.fixedNode||u,!u&&this._withinView(o,s,l,a,i,n)?(o!=i.offsetX||s!=i.offsetY)&&n.objects.push({object:i.name,diff:o-i.offsetX,diffy:s-i.offsetY}):n.diagram._translate(i,o-(i.offsetX||0),s-(i.offsetY||0),n.diagram.nameTable))}if(g=[],this._hasChild(n,i))for(h=0;h<n._graphNodes[i.name].tree.children.length;h++)c=n.diagram.nameTable[n._graphNodes[i.name].tree.children[h]],this._updateNodes(n,c,r+(n._graphNodes[i.name].subTreeTranslation||0),u,f,e),g.push(c);if(n._graphNodes[i.name].tree.assistants.length)for(h=0;h<n._graphNodes[i.name].tree.assistants.length;h++)c=n.diagram.nameTable[n._graphNodes[i.name].tree.assistants[h]],this._updateNodes(n,c,r+(n._graphNodes[i.name].subTreeTranslation||0),null,f,e);n.diagram._updateQuad(n.diagram.nameTable[i.name]);n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(i,n.diagram)},_withinView:function(n,t,i,r,u,f){var e=f.diagram.model.scrollSettings.horizontalOffset/f.diagram.model.scrollSettings.currentZoom,o=f.diagram.model.scrollSettings.verticalOffset/f.diagram.model.scrollSettings.currentZoom,s=f.diagram.model.scrollSettings.viewPortWidth/f.diagram.model.scrollSettings.currentZoom+e,h=f.diagram.model.scrollSettings.viewPortHeight/f.diagram.model.scrollSettings.currentZoom+o;return(n+i/2>e||u.offsetX+i/2>e)&&(n-i/2<s||u.offsetX-i/2<s)&&(t+r/2>o||u.offsetY+r/2>o)&&(t-r/2<h||u.offsetY-r/2<h)?!0:!1},_getDimensions:function(n,t,i,r,u){var f=t.width?t.width:t._width,e=t.height?t.height:t._height,o;return(n.orientation=="lefttoright"||n.orientation=="righttoleft")&&(u||(o=i,i=r,r=o),e=t.width?t.width:t._width,f=t.height?t.height:t._height),{x:i,y:r,width:f,height:e}},_getParentNode:function(n,t){if(t.inEdges&&t.inEdges.length)return n.diagram.nameTable[n.diagram.nameTable[t.inEdges[0]].sourceNode]},_hasChild:function(n,t){var t=n._graphNodes[t.name];return t.tree.children&&t.tree.children.length},_setUpLayoutInfo:function(n){var t={};return t.subTreeTranslation=0,n.type=="organizationalchart"?t.tree={orientation:"vertical",type:"alternate",offset:20,enableRouting:!0}:n.type=="hierarchicaltree"&&(t.tree={orientation:"horizontal",type:"center",enableRouting:!0}),t.tree.children=[],t.tree.assistants=[],t.tree.level=0,t.translate=!0,t}};t.datavisualization.Diagram.RadialTreeLayout={doLayout:function(n){var r,i,t;for(r=n.diagram,i=r.nodes(),t=0;t<i.length;t++)i[t].excludeFromLayout||(n._graphNodes[i[t].name]=this._setUpLayoutInfo(n,i[t]),i[t].inEdges&&i[t].inEdges.length||n._firstLevelNodes.push(i[t]));n.rootNode&&r.nameTable[n.rootNode]?n._centerNode=r.nameTable[n.rootNode]:n._firstLevelNodes.length&&(n._centerNode=n._firstLevelNodes[0],r.model.layout.rootNode=n._centerNode.name);n._centerNode&&(this._updateEdges(n,n._centerNode,0),this._depthFirstAllignment(n,n._centerNode,0,0),this._populateLevels(n),this._transformToCircleLayout(n),this._updateAnchor(n),this._updateNodes(n,n._centerNode))},_updateEdges:function(n,t,i){var u=n._graphNodes[t.name],f,r;for(n.layoutNodes.push(u),u.level=i,u.visited=!0,n.maxLevel=Math.max(n.maxLevel,i),f=0;f<t.outEdges.length;f++)r=n.diagram.nameTable[n.diagram.nameTable[t.outEdges[f]].targetNode],r.excludeFromLayout||r.visited||(u.children.push(r),this._updateEdges(n,r,i+1))},_depthFirstAllignment:function(n,t,i,r){var s,u,o,f,e;if(t){if(u=n._graphNodes[t.name],u.children.length){for(r+=300,e=0;e<u.children.length;e++)s=this._depthFirstAllignment(n,u.children[e],i,r),i=s.x,r=s.y;if(u.children=u.children.sort(function(t,i){return n._graphNodes[t.name].x-n._graphNodes[i.name].x}),o=n._graphNodes[u.children[0].name].min,f=n._graphNodes[u.children[u.children.length-1].name].max,u.x=o+(f-o)/2,i=f+n.horizontalSpacing,u.segmentOffset=f+n.horizontalSpacing,u.x-=u.width/2,u.y-=u.height/2,u.min=o,u.max=f,u.x<o&&u.visited){for(u.x=o,i=u.x+u.width/2-(f-o)/2,u.visited=!1,e=0;e<u.children.length;e++)s=this._depthFirstAllignment(n,u.children[e],i,r);u.visited=!0;i=u.x+u.width+n.horizontalSpacing}f=n._graphNodes[u.children[u.children.length-1].name].segmentOffset;i=i<f?f:i;r-=300;u.y=r}else u.x=i,u.y=r,u.min=i,u.max=i+u.width,i+=u.width+n.horizontalSpacing;return{x:i,y:r}}},_populateLevels:function(n){var i=[],e=Math.min.apply(Math,n.layoutNodes.map(function(n){return n.x})),o=Math.max.apply(Math,n.layoutNodes.map(function(t){return t.x+t.width+n.horizontalSpacing})),s=o-e,r,t,u,f;for(n.levels=[],r=0;r<=n.maxLevel;r++){for(i=n.layoutNodes.filter(function(n){if(n.level==r)return n}),t={},i=i.sort(function(n,t){return n.x-t.x}),t.min=i[0].x,t.max=i[i.length-1].x+i[i.length-1].width+n.horizontalSpacing,t._actualCircumference=0,t.height=0,u=0;u<i.length;u++)i[u].height>t.height&&(t.height=i[u].height),t._actualCircumference+=Math.max(i[u].width,i[u].height),u!=i.length-1&&(t._actualCircumference+=n.horizontalSpacing);for(t.circumference=t.max-t.min,t._actualCircumference<t.circumference&&(t.circumference=(t.circumference+t._actualCircumference)/2),t.radius=t.circumference/(2*Math.PI)+t.height,t.nodes=[],r>1&&n.levels[r-1].radius+n.levels[r-1].height>=t.radius&&(t.radius=n.levels[r-1].radius+n.levels[r-1].height),f=0;f<i.length;f++)i[f].ratio=Math.abs(i[f].x+i[f].width/2-e)/s,t.nodes.push(i[f]);n.levels.push(t)}},_transformToCircleLayout:function(n){var u=n._graphNodes[n._centerNode.name],t,r,i;for(u.x=0,u.y=0,t=1;t<n.levels.length;t++)for(r=0;r<n.levels[t].nodes.length;r++)i=n.levels[t].nodes[r],i.x=Math.cos(i.ratio*360*Math.PI/180)*(n.levels[t].radius+n.verticalSpacing*t),i.y=Math.sin(i.ratio*360*Math.PI/180)*(n.levels[t].radius+n.verticalSpacing*t),n._anchorX=Math.min(n._anchorX,i.x),n._anchorY=Math.min(n._anchorY,i.y)},_updateAnchor:function(n){var i=t.datavisualization.Diagram.ScrollUtil._viewPort(n.diagram);n._anchorX=i.width/2;n._anchorY=i.height/2},_updateNodes:function(n,i){var r=n._graphNodes[i.name],e=r.x+n._anchorX,o=r.y+n._anchorY,u,f;for(n.diagram._translate(i,e-i.offsetX||0,o-i.offsetY||0,n.diagram.nameTable),u=0;u<r.children.length;u++)f=r.children[u],this._updateNodes(n,n.diagram.nameTable[f.name]);n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(i,n.diagram)},_isValidLayout:function(n){if(n._centerNode){var t=Math.max.apply(Math,n.diagram.nodes().map(function(n){return n.inEdges.length}));if(t<2)return!0}return!1},_setUpLayoutInfo:function(n,t){var i={};return i.name=t.name,i.x=0,i.y=0,i.min=0,i.max=0,i.width=t.width?t.width:t._width,i.height=t.height?t.height:t._height,i.children=[],i.level=0,i.ratio=0,i.visited=!1,i}}}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.ZoomUtil={zoomPan:function(i,r,u,f,e,o){var h,c,a,v,y;if(o&&t.datavisualization.Diagram.Util.canZooming(i)||!o&&t.datavisualization.Diagram.Util.canPanning(i)){var l=t.datavisualization.Diagram.ScrollUtil._viewPort(i,!0),p={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:l},s=t.Matrix.identity();t.Matrix.scale(s,i._currZoom,i._currZoom);t.Matrix.translate(s,-i._hScrollOffset,-i._vScrollOffset);h=i._currZoom*r;h>30?r=30/i._currZoom:h<.25&&(r=.25/i._currZoom);c=t.Matrix.identity();a=e?t.Matrix.transform(s,e):t.datavisualization.Diagram.Point(n(i.element).width()/2,n(i.element).height()/2);t.Matrix.scale(c,r,r,a.x,a.y);h=i._currZoom*r;t.Matrix.translate(c,u,f);t.Matrix.multiply(s,c);v=t.Matrix.transform(s,t.datavisualization.Diagram.Point(0,0));i._compareModelProperty("scrollSettings",!0);this._applyTransform(i,h,v,o,l);y={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:l};i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Zoom;o||(i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Pan);i._raiseEvent("scrollChange",{newValues:y,oldValues:p})}},_applyTransform:function(n,i,r,u,f){n._currZoom=i;var e=r.x*-1,o=r.y*-1,s=n._getDigramBounds();if(!u&&n._scrollLimit()!==t.datavisualization.Diagram.ScrollLimit.Infinity)if(n._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Diagram){s.x-=n.model.scrollSettings.padding.left;s.y-=n.model.scrollSettings.padding.top;s.width+=n.model.scrollSettings.padding.left+n.model.scrollSettings.padding.right;s.height+=n.model.scrollSettings.padding.top+n.model.scrollSettings.padding.bottom;var h=s.width*n._currZoom>f.width,c=s.height*n._currZoom>f.height,l=(s.width+s.x)*n._currZoom-f.width,a=(s.height+s.y)*n._currZoom-f.height;!h&&e>n._hScrollOffset&&e>s.x*n._currZoom||h&&e<n._hScrollOffset&&e<s.x*n._currZoom?e=n._hScrollOffset:(!h&&e<n._hScrollOffset&&e<l||h&&e>n._hScrollOffset&&e>l)&&(e=n._hScrollOffset);!c&&o>n._vScrollOffset&&o>s.y*n._currZoom||c&&o<n._vScrollOffset&&o<s.y*n._currZoom?o=n._vScrollOffset:(!c&&o<n._vScrollOffset&&o<a||c&&o>n._vScrollOffset&&o>a)&&(o=n._vScrollOffset)}else e<n._hScrollbar.model.minimum&&!(n._hScrollbar.model.minimum==0&&-n._hScrollOffset>r.x)?e=n._hScrollOffset:e>n._hScrollbar.model.maximum&&(e=n._hScrollbar.model.maximum),o<n._vScrollbar.model.minimum&&!(n._vScrollbar.model.minimum==0&&-n._vScrollOffset>r.y)?o=n._vScrollOffset:o>n._vScrollbar.model.maximum&&(o=n._vScrollbar.model.maximum);n._updateScrollOffset(e,o,!0,u)}};t.datavisualization.Diagram.PageUtil={_createPageBreaks:function(n){this._removePageBreaks(n);var i={id:n._canvas.id+"pagebreaks","pointer-events":"none"},r=t.datavisualization.Diagram.SvgContext._initializePageBreaks(n._svg,i,n._pageBackgroundLayer);this._updatePageBreaks(r,n)},_removePageBreaks:function(n){var i=n._svg.getElementById(n._canvas.id+"pagebreaks");i&&t.datavisualization.Diagram.SvgContext._removePageBreaks(n._svg,i,n._pageBackgroundLayer)},_updatePageBreaks:function(n,i){var o=i._getDigramBounds(),k=i.model.pageSettings,r=o.x,w=o.width+o.x,u=o.y,b=o.height+o.y,f=i._currZoom,a=i._pageHeight(),v=i._pageWidth(),e=i._pageMargin(),y=parseInt(Math.ceil((w-r)/v)),p=parseInt(Math.ceil((b-u)/a)),s,h,c,l;for(r=-i._canvas.clientLeft+(e+r)*f,u=-i._canvas.clientTop+(e+u)*f,s=(v*y-e*2)*f,h=(a*p-e*2)*f,t.datavisualization.Diagram.SvgContext._renderVPageBreakLine(t.datavisualization.Diagram.Point(r,u),t.datavisualization.Diagram.Point(r+s,u),i._svg,n),t.datavisualization.Diagram.SvgContext._renderHPageBreakLine(t.datavisualization.Diagram.Point(r,u),t.datavisualization.Diagram.Point(r,u+h),i._svg,n),c=1;c<y;c++)t.datavisualization.Diagram.SvgContext._renderVPageBreakLine(t.datavisualization.Diagram.Point(r+(v*c-e)*f,u),t.datavisualization.Diagram.Point(r+(v*c-e)*f,u+h),i._svg,n);for(l=1;l<p;l++)t.datavisualization.Diagram.SvgContext._renderHPageBreakLine(t.datavisualization.Diagram.Point(r,u+(a*l-e)*f),t.datavisualization.Diagram.Point(r+s,u+(a*l-e)*f),i._svg,n);t.datavisualization.Diagram.SvgContext._renderVPageBreakLine(t.datavisualization.Diagram.Point(r+s,u),t.datavisualization.Diagram.Point(r+s,u+h),i._svg,n);t.datavisualization.Diagram.SvgContext._renderHPageBreakLine(t.datavisualization.Diagram.Point(r,u+h),t.datavisualization.Diagram.Point(r+s,u+h),i._svg,n)},_updatePageSize:function(n,i){var f=!1,e,l;n._pageOrientation()==t.datavisualization.Diagram.PageOrientations.Landscape?n._pageHeight()>n._pageWidth()&&(f=!0):n._pageWidth()>n._pageHeight()&&(f=!0);f&&(e=n._pageWidth(),n._pageWidth(n._pageHeight()),n._pageHeight(e));var r=n._getDigramBounds(),u=n._currZoom,o=r.x*u,s=r.y*u,h=r.width*u,c=r.height*u,a=n.model.pageSettings;n._pageBackgroundLayer&&n._pageBackgroundLayer.firstChild?t.datavisualization.Diagram.SvgContext._updatePageBakground(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),n._svg,n._pageBackgroundLayer,n._pageBorderColor(),n._pageBackgroundColor(),n._pageBorderWidth()):t.datavisualization.Diagram.SvgContext._renderPageSettingsRect(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),n._svg,n._pageBackgroundLayer,n._pageBorderColor(),n._pageBackgroundColor(),n._pageBorderWidth());n.model.backgroundImage&&n.model.backgroundImage.source&&t.datavisualization.Diagram.SvgContext._updateBackground(n._hScrollOffset,n._vScrollOffset,n._currZoom,n);n._svg.document.style.left=0;n._svg.document.style.top=0;l=!1;n._pageWidth()||n._pageHeight()||(l=!0);a.pageWidth&&n._pageHeight()&&(n._showPageBreak()?this._createPageBreaks(n):this._removePageBreaks(n));i||t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(n)}};t.datavisualization.Diagram.ScrollUtil={_transform:function(n,i,r,u){t.datavisualization.Diagram.SvgContext.transformView(n,-i,-r);u&&t.datavisualization.Diagram.SvgContext.scaleContent(n,n._currZoom);t.datavisualization.Diagram.PageUtil._updatePageSize(n);t.datavisualization.Diagram.SvgContext._updateGrid(i,r,n._currZoom,n)},_viewPort:function(n,i){var o;if(n._viewPort&&!i)return n._viewPort;var h=n.element[0],r=n.element[0].getBoundingClientRect(),u=r.width,f=n._vScrollbar&&n._vScrollbar.model.height?n._vScrollbar.model.height:null,e=f?r.height===f?f+18:r.height:r.height,s=window.screenX<0?window.screenX*-1:window.screenX;return u===0&&(u=Math.floor(window.innerWidth-s-Math.floor(r.left))),o=window.screenY<0?window.screenY*-1:window.screenY,e===0&&(e=Math.floor(window.innerHeight-o-Math.floor(r.window))),t.datavisualization.Diagram.Size(u,e)},_union:function(n,t){var i,r,u,f;return n.width<=0?t:n.width>0?(i=Math.min(n.x,t.x),r=Math.min(n.y,t.y),t.width===Infinity||n.width===Infinity?n.width=Infinity:(u=Math.max(n.x+n.width,t.x+t.width),n.width=Math.max(u-i,0)),t.height===Infinity||n.height===Infinity?n.height=Infinity:(f=Math.max(n.y+n.height,t.y+t.height),n.height=Math.max(f-r,0)),n.x=i,n.y=r,n):void 0},_setScrollContentSize:function(i){var l=i._currZoom,u=this._viewPort(i),a,v,r,p,b,y,w,k,c,d;u=t.datavisualization.Diagram.Rectangle(i._hScrollOffset,i._vScrollOffset,u.width,u.height);var h=i.model.scrollSettings.padding,f=i._spatialSearch.pageLeft,o=i._spatialSearch.pageRight,e=i._spatialSearch.pageTop,s=i._spatialSearch.pageBottom;f>o&&(f=o=0);e>s&&(e=s=0);i.model.pageSettings&&(a=Number(i._pageWidth()),v=Number(i._pageHeight()),a>0&&v>0?(i._multiplePage()?(f=Math.floor(f/a)*a,e=Math.floor(e/v)*v,o=Math.ceil(o/a)*a,s=Math.ceil(s/v)*v):(f=0,e=0,o=a,s=v),f-=h.left,o+=h.right,e-=h.top,s+=h.bottom):(f=f<0?f:0,e=e<0?e:0,o=o>u.width?o:u.width,s=s>u.height?s:u.height,i._spatialSearch.pageLeft-f<h.left&&(f+=i._spatialSearch.pageLeft-f-h.left),i._spatialSearch.pageTop-e<h.top&&(e+=i._spatialSearch.pageTop-e-h.top),i._spatialSearch.pageRight+h.right>u.width&&i._spatialSearch.pageRight<u.width?o+=h.right+i._spatialSearch.pageRight-u.width:i._spatialSearch.pageRight>u.width&&(o+=h.right),i._spatialSearch.pageBottom+h.bottom>u.height&&i._spatialSearch.pageBottom<u.height?s+=h.bottom+i._spatialSearch.pageBottom-u.height:i._spatialSearch.pageBottom>u.height&&(s+=h.bottom)));f=f*l;e=e*l;o=o*l;s=s*l;r=t.datavisualization.Diagram.Rectangle(0,0,0,0);r=this._union(r,t.datavisualization.Diagram.Rectangle(0,0,u.width,u.height));r=this._union(r,t.datavisualization.Diagram.Geometry.rect([{x:f,y:e},{x:o,y:s}]));r.width-=u.width;r.height-=u.height;r.x>i._hScrollOffset&&(y=r.x-i._hScrollOffset,r.x-=y,r.width+=y);i._hScrollOffset>r.x+r.width&&(r.width=i._hScrollOffset-r.x);p=r.x;b=Math.max(0,r.x+r.width);r.y>i._vScrollOffset&&(y=r.y-i._vScrollOffset,r.y-=y,r.height+=y);i._vScrollOffset>r.y+r.height&&(r.height=i._vScrollOffset-r.y);w=r.y;k=Math.max(0,r.y+r.height);r.width=r.width<u.width?u.width:r.width;r.height=r.height<u.height?u.height:r.height;i._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Limited&&(c=i.model.pageSettings.scrollableArea,p=c.x*l,w=c.y*l,b=(c.x+c.width)*l-u.width,k=(c.y+c.height)*l-u.height,s=(c.y+c.height)*l,o=(c.x+c.width)*l,e=c.y*l,f=c.x*l);f>=i._hScrollOffset&&o<=u.width+i._hScrollOffset?(i._hScrollbar._remove(),i._hScrollbar.model.width=0,i._hScrollbar.model.minimum=i._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Limited?Math.min(0,p):0,i._hScrollbar.model.maximum=0):(i._preventScrollerUpdate?(i._hScrollbar.model.minimum=p,i._hScrollbar.model.maximum=b):(n("#"+i._canvas.id+"_hScrollbar").ejScrollBar({width:u.width-18,viewportSize:u.width-18,maximum:b,minimum:p}),n("#"+i._canvas.id+"_hScrollbar").ejScrollBar("scroll",i._hScrollOffset)),d=document.getElementById(i._canvas.id+"_hScrollbar"),d.style.marginTop=u.height-18+"px");e>=i._vScrollOffset&&s<=u.height+i._vScrollOffset?(i._vScrollbar._remove(),i._vScrollbar.model.height=0,i._vScrollbar.model.minimum=i._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Limited?Math.min(0,w):0,i._vScrollbar.model.maximum=0):i._preventScrollerUpdate?(i._vScrollbar.model.minimum=w,i._vScrollbar.model.maximum=k):(n("#"+i._canvas.id+"_vScrollbar").ejScrollBar({height:u.height-18,viewportSize:u.height-18,maximum:k,minimum:w}),n("#"+i._canvas.id+"_vScrollbar").ejScrollBar("scroll",i._vScrollOffset));i._isMobile&&i._disableScrollbar();t.datavisualization.Diagram.SvgContext.setSize(i,r.width,r.height)},_setMinMaxValues:function(n,t,i,r,u,f,e){var o=n.model.pageSettings.scrollableArea;return t=Math.max(t,o.x*e),i=Math.max(i,o.y*e),r=Math.min((o.x+o.width)*e-f.width,r),u=Math.min((o.y+o.height)*e-f.height,u),r=r>0?r:0,u=u>0?u:0,{minX:t,minY:i,maxX:r,maxY:u}},_initScrollbar:function(i){var u=i._canvas,f=document.getElementById(u.id+"_hScrollbar"),e=document.getElementById(u.id+"_vScrollbar"),r=this._viewPort(i);n(f).ejScrollBar({orientation:t.ScrollBar.Orientation.Horizontal,width:r.width-18,viewportSize:r.width-18,scroll:function(n){var r,u;n.source!=null&&(n.source=="thumb"||n.source=="button"||n.source=="key")&&n.scrollData!=null&&(r={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._updateScrollOffset(n.scrollLeft,i._vScrollOffset),u={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._compareModelProperty("scrollSettings",!0),i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Pan,i._raiseEvent("scrollChange",{newValues:u,oldValues:r}))}});i._hScrollbar=n(f).ejScrollBar("instance");n(e).ejScrollBar({orientation:t.ScrollBar.Orientation.Vertical,height:r.height-18,viewportSize:r.height-18,scroll:function(n){var r,u;n.source!=null&&(n.source=="thumb"||n.source=="button"||n.source=="key")&&n.scrollData!=null&&(r={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._updateScrollOffset(i._hScrollOffset,n.scrollTop),u={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._compareModelProperty("scrollSettings",!0),i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Pan,i._raiseEvent("scrollChange",{newValues:u,oldValues:r}))}});i._vScrollbar=n(e).ejScrollBar("instance")}};t.datavisualization.Diagram.SnapUtil={_canConsider:function(n,t,i){var r=!1;return t!=i&&(t._type=="group"||t._type=="pseudoGroup"?r=i.isSwimlane&&!t.isSwimlane?!1:!this._contains(n,t,i):i._type=="group"&&i.type!="bpmn"||i.type=="pseudoGroup"?r=i.isSwimlane&&!t.isSwimlane?!1:!this._contains(n,i,t):t.segments||(r=!(t==i))),r},_contains:function(n,t,i){var e=i.name,o=null,f,u,r;if(t.children.indexOf(e)>=0){if(o=n[e],o==i)return!0}else if(t.children.indexOf(i)>=0)return!0;if(t._type=="group"||t._type=="pseudoGroup"){for(f=!1,u=0;u<t.children.length;u++)if(this.diagram&&(r=typeof t.children[u]=="string"?n[t.children[u]]:n[t.children[u].name],r&&(typeof r=="string"&&(r=n[r]),r._type=="group"&&(f=this._contains(n,r,i)),f)))return f;return f}return!1},_round:function(n,t,i){var f,r;for(i=i>1?Math.pow(2,Math.floor(Math.log(i)/Math.log(2))):Math.pow(2,Math.ceil(Math.log(i)/Math.log(2))),f=0,r=0;r<t.length;r++)f+=t[r];f/=i;var o=Math.floor(Math.abs(n)/f),e=n%f,u=o*f;if(u!=n)if(n>=0)for(r=0;r<t.length;r++){if(e<=t[r]/i)return u+(e<t[r]/(2*i)?0:t[r]/i);u+=t[r]/i;e-=t[r]/i}else for(u=u*-1,r=t.length-1;r>=0;r--){if(Math.abs(e)<=t[r]/i)return u-(Math.abs(e)<t[r]/(2*i)?0:t[r]/i);u-=t[r]/i;e+=t[r]/i}return n},_findNodes:function(n,i,r,u,f){for(var c=[],o,e,l,h,a=t.datavisualization.Diagram.SpatialUtil.findQuads(n,f?u:r),s=0;s<a.length;s++)if(o=a[s],o.objects.length>0)for(h=0;h<o.objects.length;h++)e=o.objects[h],!e.segments&&e.visible&&(l=t.datavisualization.Diagram.Util.bounds(e),c.indexOf(e)==-1&&t.datavisualization.Diagram.Geometry.intersectsRect(r,l)&&c.push(e),f&&f.indexOf(e)&&t.datavisualization.Diagram.Geometry.intersectsRect(u,l)&&f.push(e));return c},_snapAngle:function(n,t){var i=n._snapAngle(),r=t%i;return r>=i/2?t+i-r:t-r},_snapPoint:function(n,i,r,u,f,e,o){var c=n.model.snapSettings,l=n._currZoom,h=t.datavisualization.Diagram.Point(),s=t.datavisualization.Diagram.Util.bounds(i),k={snapped:!1,offset:0},d={snapped:!1,offset:0};this.diagram=n;n._enableSnapToObject()&&this._snapObject(n,i,k,d,f,o==e);var g=s.x+f.x,nt=s.y+f.y,tt=s.x+s.width+f.x,it=s.y+s.height+f.y,a=this._round(tt,c.verticalGridLines.snapInterval,l),v=this._round(g,c.verticalGridLines.snapInterval,l),y=this._round(nt,c.horizontalGridLines.snapInterval,l),p=this._round(it,c.horizontalGridLines.snapInterval,l),w=s.x+s.width,b=s.y+s.height;return k.snapped?h.x=n._enableSnapToObject()?k.offset:e.x-o.x:n._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines?Math.abs(f.x)>=1&&(h.x+=r?Math.abs(a-w)>Math.abs(v-s.x)?v-s.x:a-w:Math.abs(a-w)<Math.abs(v-s.x)?a-w:v-s.x):h.x=e.x-o.x,d.snapped?h.y=d.offset:n._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines?Math.abs(f.y)>=1&&(h.y+=u?Math.abs(p-b)>Math.abs(y-s.y)?y-s.y:p-b:Math.abs(p-b)<Math.abs(y-s.y)?p-b:y-s.y):h.y=e.y-o.y,h},_snapObject:function(n,i,r,u,f,e){var v=null,y=null,w,b,d=[],g=[],it=[],rt=[],o=t.datavisualization.Diagram.Util.bounds(i),l=n._currZoom,ut=n._hScrollOffset,ft=n._vScrollOffset,h=n._snapObjectDistance(),p=n._viewPort,et=t.datavisualization.Diagram.Rectangle(ut/l,o.y-h-5,p.width/l,o.height+2*h+10),ot=t.datavisualization.Diagram.Rectangle(o.x-h-5,ft/l,o.width+2*h+10,p.height/l),k,a,c,s,nt,tt;for(p=t.datavisualization.Diagram.Rectangle(ut/l,ft/l,p.width/l,p.height/l),k=this._findNodes(n._spatialSearch,i,ot,p),nt=n.nameTable,a=0;a<k.length;a++)c=k[a],t.datavisualization.Diagram.Util._canBeTarget(n,c)&&!c.segments&&this._canConsider(nt,i,c)&&(s=t.datavisualization.Diagram.Util.bounds(c),s.y+s.height<o.y+f.y?it.push({object:c,distance:Math.abs(o.y+f.y-s.y-s.height)}):s.y>o.y+f.y+o.height&&rt.push({object:c,distance:Math.abs(o.y+f.y+o.height-s.y)}),(v==null||v>Math.abs(s.y-o.y-f.y))&&(Math.abs(s.x+s.width/2-(o.x+o.width/2+f.x))<=h?(w=this._createSnapObject(s,o,"centerX"),v=Math.abs(s.y-o.y)):Math.abs(s.x-(o.x+f.x))<=h?(w=this._createSnapObject(s,o,"left"),v=Math.abs(s.y-o.y)):Math.abs(s.x+s.width-(o.x+o.width+f.x))<=h?(w=this._createSnapObject(s,o,"right"),v=Math.abs(s.y-o.y)):Math.abs(s.x+s.width-(o.x+f.x))<=h?(w=this._createSnapObject(s,o,"leftRight"),v=Math.abs(s.y-o.y)):Math.abs(s.x-(o.x+o.width+f.x))<=h&&(w=this._createSnapObject(s,o,"rightLeft"),v=Math.abs(s.y-o.y))));for(k=this._findNodes(n._spatialSearch,i,et,p),a=0;a<k.length;a++)c=k[a],t.datavisualization.Diagram.Util._canBeTarget(n,c)&&!c.segments&&this._canConsider(nt,i,c)&&(s=t.datavisualization.Diagram.Util.bounds(c),s.x+s.width<o.x+f.x&&(d[d.length]={object:c,distance:Math.abs(o.x+f.x-s.x-s.width)}),s.x>o.x+f.x+o.width&&(g[g.length]={object:c,distance:Math.abs(o.x+f.x+o.width-s.x)}),(y==null||y>Math.abs(s.x-o.x-f.x))&&(Math.abs(s.y+s.height/2-(o.y+o.height/2+f.y))<=h?(b=this._createSnapObject(s,o,"centerY"),y=Math.abs(s.x-o.x)):Math.abs(s.y-o.y-f.y)<=h?(b=this._createSnapObject(s,o,"top"),y=Math.abs(s.x-o.x)):Math.abs(s.y+s.height-(o.y+o.height+f.y))<=h?(b=this._createSnapObject(s,o,"bottom"),y=Math.abs(s.x-o.x)):Math.abs(s.y+s.height-o.y-f.y)<=h?(b=this._createSnapObject(s,o,"topBottom"),y=Math.abs(s.x-o.x)):Math.abs(s.y-(o.y+o.height+f.y))<=h&&(b=this._createSnapObject(s,o,"bottomTop"),y=Math.abs(s.x-o.x))));tt=this._createGuidelines(n,w,b,r,u,e);r.snapped||this._createHSpacingLines(n,i,d,g,r,u,e,tt,f,h);u.snapped||this._createVSpacingLines(n,i,it,rt,r,u,e,tt,f,h)},_snapSize:function(n,i,r,u,f,e,o){var p=null,w=null,d,g,s=t.datavisualization.Diagram.Util.bounds(e),ut=n.nameTable,nt=[],tt=[],l=n._currZoom,st=n._hScrollOffset,ht=n._vScrollOffset,v=n._snapObjectDistance(),y=n._viewPort,lt=t.datavisualization.Diagram.Rectangle(st/l,(s.y-5)/l,y.width/l,(s.height+10)/l),at=t.datavisualization.Diagram.Rectangle((s.x-5)/l,ht/l,(s.width+10)/l,y.height/l),it,b,a,c,h,et,ot;for(y=t.datavisualization.Diagram.Rectangle(st/l,ht/l,y.width/l,y.height/l),it=[],b=this._findNodes(n._spatialSearch,e,at,y,it),a=0;a<b.length;a++)c=b[a],this._canConsider(ut,e,c)&&!c.segments&&(h=t.datavisualization.Diagram.Util.bounds(c),(p==null||p>Math.abs(h.y-s.y))&&(i.left?Math.abs(s.x+u-h.x)<=v?(d=this._createSnapObject(h,s,"left"),p=Math.abs(h.y-s.y)):Math.abs(s.x+u-h.x-h.width)<=v&&(d=this._createSnapObject(h,s,"leftRight"),p=Math.abs(h.y-s.y)):i.right&&(Math.abs(s.x+u+s.width-h.x-h.width)<=v?(d=this._createSnapObject(h,s,"right"),p=Math.abs(h.y-s.y)):Math.abs(s.x+u+s.width-h.x)<=v&&(d=this._createSnapObject(h,s,"rightLeft"),p=Math.abs(h.y-s.y)))));for(b=this._findNodes(n._spatialSearch,e,lt,y),a=0;a<b.length;a++)c=b[a],this._canConsider(ut,e,c)&&!c.segments&&(h=t.datavisualization.Diagram.Util.bounds(c),(w==null||w>Math.abs(h.x-s.x))&&(r.top?Math.abs(s.y+f-h.y)<=v?(g=this._createSnapObject(h,s,"top"),w=Math.abs(h.x-s.x)):Math.abs(s.y+f-h.y-h.height)<=v&&(g=this._createSnapObject(h,s,"topBottom"),w=Math.abs(h.x-s.x)):r.bottom&&(Math.abs(s.y+s.height+f-h.y-h.height)<=v?(g=this._createSnapObject(h,s,"bottom"),w=Math.abs(h.x-s.x)):Math.abs(s.y+s.height+f-h.y)<=v&&(g=this._createSnapObject(h,s,"bottomTop"),w=Math.abs(h.x-s.x)))));for(a=0;a<it.length;a++)if(c=it[a],this._canConsider(ut,e,c)){var k=t.datavisualization.Diagram.Util.bounds(c),ft=i.left?-u:u,ct=Math.abs(s.width+ft-k.width),rt;ct<=v&&(rt=i.left?-k.width+s.width:k.width-s.width,nt[nt.length]={source:c,diff:ct,offset:rt});ft=r.top?-f:f;et=Math.abs(s.height+ft-k.height);et<=v&&(rt=r.top?-k.height+s.height:k.height-s.height,tt[tt.length]={source:c,diff:et,offset:rt})}n.activeTool.selectedSeperator||(ot=this._createGuidelines(n,d,g,i,r,o));!i.snapped&&nt.length>0&&(i.left||i.right)&&this._addSameWidthLines(n,nt,i,o,ot,e);!r.snapped&&tt.length>0&&(r.top||r.bottom)&&this._addSameHeightLines(n,tt,r,o,ot,e)},_createSnapObject:function(n,i,r){var u;switch(r){case"left":u={start:t.datavisualization.Diagram.Point(n.x,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x-i.x,offsetY:0,type:"sideAlign"};break;case"right":u={start:t.datavisualization.Diagram.Point(n.x+n.width,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x+n.width,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x+n.width-i.x-i.width,offsetY:0,type:"sideAlign"};break;case"top":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y),offsetY:n.y-i.y,offsetX:0,type:"sideAlign"};break;case"bottom":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y+n.height),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y+n.height),offsetY:n.y+n.height-i.y-i.height,offsetX:0,type:"sideAlign"};break;case"topBottom":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y+n.height),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y+n.height),offsetY:n.y+n.height-i.y,offsetX:0,type:"sideAlign"};break;case"bottomTop":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y),offsetY:n.y-i.y-i.height,offsetX:0,type:"sideAlign"};break;case"leftRight":u={start:t.datavisualization.Diagram.Point(n.x+n.width,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x+n.width,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x+n.width-i.x,offsetY:0,type:"sideAlign"};break;case"rightLeft":u={start:t.datavisualization.Diagram.Point(n.x,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x-i.x-i.width,offsetY:0,type:"sideAlign"};break;case"centerX":u={start:t.datavisualization.Diagram.Point(n.x+n.width/2,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x+n.width/2,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x+n.width/2-(i.x+i.width/2),offsetY:0,type:"centerAlign"};break;case"centerY":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y+n.height/2),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y+n.height/2),offsetY:n.y+n.height/2-(i.y+i.height/2),offsetX:0,type:"centerAlign"}}return u},_createGuidelines:function(n,i,r,u,f,e){var l={id:n._canvas.id+"guideline",style:"pointer-events:none;"},o=t.datavisualization.Diagram.SvgContext._initializeGuidelines(n._adornerSvg,l,n._adornerLayer),s=n._currZoom,h=n._hScrollOffset,c=n._vScrollOffset;return i&&(u.offset=i.offsetX,u.snapped=!0,e||(i.type=="sideAlign"?t.datavisualization.Diagram.SvgContext._renderSideAlignmentLines(i.start,i.end,o,n._adornerSvg,s,h,c):i.type=="centerAlign"&&t.datavisualization.Diagram.SvgContext._renderCenterAlignmentLines(i.start,i.end,o,n._adornerSvg,s,h,c))),r&&(f.offset=r.offsetY,f.snapped=!0,e||(r.type=="sideAlign"?t.datavisualization.Diagram.SvgContext._renderSideAlignmentLines(r.start,r.end,o,n._adornerSvg,s,h,c):r.type=="centerAlign"&&t.datavisualization.Diagram.SvgContext._renderCenterAlignmentLines(r.start,r.end,o,n._adornerSvg,s,h,c))),o},_removeGuidelines:function(n){var i=n._adornerSvg.getElementById(n._canvas.id+"guideline");i!=null&&t.datavisualization.Diagram.SvgContext._removeGuidelines(n._adornerLayer,i)},_sortByDistance:function(n,t,i){var r,u,f;if(i)for(r=0;r<n.length;r++)for(u=r+1;u<n.length;u++)n[r][t]>n[u][t]&&(f=n[r],n[r]=n[u],n[u]=f);else for(r=0;r<n.length;r++)for(u=r+1;u<n.length;u++)n[r][t]<n[u][t]&&(f=n[r],n[r]=n[u],n[u]=f)},_createHSpacingLines:function(n,i,r,u,f,e,o,s,h,c){var a=null,l,w,p,y,b,v,d,g,k;this._sortByDistance(r,"distance",!0);this._sortByDistance(u,"distance",!0);l=[];w=t.datavisualization.Diagram.Util.bounds(i);r.length>0&&(l[l.length]=r[0],p=t.datavisualization.Diagram.Util.bounds(r[0].object),a=p.y,r.length>1?(b=t.datavisualization.Diagram.Util.bounds(r[1].object),v=p.x-b.x-b.width,Math.abs(v-r[0].distance)<=c?a=this._findEquallySpacedNodesAtLeft(r,v,a,l):v=r[0].distance):v=r[0].distance);this._sortByDistance(l,"distance");l[l.length]={object:i,distance:0};a=w.y<a||!a?w.y:a;u.length>0&&(y=t.datavisualization.Diagram.Util.bounds(u[0].object),a=y.y<a?y.y:a,u.length>1&&(b=t.datavisualization.Diagram.Util.bounds(u[1].object),d=b.x-y.x-y.width),r.length>0?Math.abs(u[0].distance-r[0].distance)<=c?(g=Math.abs(u[0].distance-r[0].distance)/2,u[0].distance<r[0].distance?v-=g:v+=g,l[l.length]=u[0]):r.length==1&&(p=undefined,l.splice(0,1),l[l.length]=u[0],v=d):(v=d,l[l.length]=u[0]),u.length>1&&y.x+y.width<b.x&&(a=this._findEquallySpacedNodesAtRight(u,d,a,l,c)));l.length>2&&(this._addHSpacingLines(n,l,o,s,a),k=0,o&&(k=h.x),p?f.offset=v-Math.abs(w.x+k-p.x-p.width)+k:y&&(f.offset=Math.abs(w.x+w.width+k-y.x)-v+k),f.snapped=!0)},_createVSpacingLines:function(n,i,r,u,f,e,o,s,h,c){var a=null,l,p,w,v,b,y,d,g,k;this._sortByDistance(r,"distance",!0);this._sortByDistance(u,"distance",!0);l=[];p=t.datavisualization.Diagram.Util.bounds(i);r.length>0&&(l[l.length]=r[0],w=t.datavisualization.Diagram.Util.bounds(r[0].object),a=w.x+w.width,r.length>1?(b=t.datavisualization.Diagram.Util.bounds(r[1].object),y=w.y-b.y-b.height,Math.abs(y-r[0].distance)<=c?a=this._findEquallySpacedNodesAtTop(r,y,a,l):y=r[0].distance):y=r[0].distance);this._sortByDistance(l,"distance");l[l.length]={object:i,distance:0};a=p.x+p.width>a||!a?p.x+p.width:a;u.length>0&&(v=t.datavisualization.Diagram.Util.bounds(u[0].object),a=v.x+v.width>a?v.x+v.width:a,u.length>1&&(b=t.datavisualization.Diagram.Util.bounds(u[1].object),d=b.y-v.y-v.height),r.length>0?Math.abs(u[0].distance-r[0].distance)<=c?(g=Math.abs(u[0].distance-r[0].distance)/2,u[0].distance<r[0].distance?y-=g:y+=g,l[l.length]=u[0]):r.length==1&&(w=undefined,l.splice(0,1),l[l.length]=u[0],y=d):(y=d,l[l.length]=u[0]),u.length>1&&b.y>v.y+v.height&&(a=this._findEquallySpacedNodesAtBottom(u,d,a,l,c)));l.length>2&&(this._addVSpacingLine(n,l,o,s,a),k=0,o&&(k=h.y),w?e.offset=y-Math.abs(p.y+k-w.y-w.height)+k:v&&(e.offset=Math.abs(p.y+p.height+k-v.y)-y+k),e.snapped=!0)},_addHSpacingLines:function(n,i,r,u,f){var h=n._currZoom,c=n._hScrollOffset,l=n._vScrollOffset,e,o,s;if(i.length>2&&!r)for(e=0;e<i.length-1;e++)o=t.datavisualization.Diagram.Util.bounds(i[e].object),s=t.datavisualization.Diagram.Util.bounds(i[e+1].object),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+o.width,f-15),t.datavisualization.Diagram.Point(s.x,f-15),u,n._adornerSvg,h,c,l)},_addVSpacingLine:function(n,i,r,u,f){var h=n._currZoom,c=n._hScrollOffset,l=n._vScrollOffset,o,s,e;if(i.length>2&&!r)for(e=0;e<i.length-1;e++)o=t.datavisualization.Diagram.Util.bounds(i[e].object),s=t.datavisualization.Diagram.Util.bounds(i[e+1].object),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(f+15,o.y+o.height),t.datavisualization.Diagram.Point(f+15,s.y),u,n._adornerSvg,h,c,l)},_addSameWidthLines:function(n,i,r,u,f,e){var l=n._currZoom,a=n._hScrollOffset,v=n._vScrollOffset,s,y;this._sortByDistance(i,"offset");var o=t.datavisualization.Diagram.Util.bounds(e),c=i[0],p=t.datavisualization.Diagram.Util.bounds(c.source),h=[];for(h.push(i[0]),s=1;s<i.length;s++)y=t.datavisualization.Diagram.Util.bounds(i[s].source),y.width==p.width&&h.push(i[s]);if(h.length>0&&!u)for(t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+c.offset,o.y-15),t.datavisualization.Diagram.Point(o.x+o.width+c.offset,o.y-15),f,n._adornerSvg,l,a,v),s=0;s<h.length;s++)o=t.datavisualization.Diagram.Util.bounds(h[s].source),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x,o.y-15),t.datavisualization.Diagram.Point(o.x+o.width,o.y-15),f,n._adornerSvg,l,a,v);r.offset=c.offset;r.snapped=!0},_addSameHeightLines:function(n,i,r,u,f,e){var l=n._currZoom,a=n._hScrollOffset,v=n._vScrollOffset,s,y;this._sortByDistance(i,"offset");var o=t.datavisualization.Diagram.Util.bounds(e),c=i[0],p=t.datavisualization.Diagram.Util.bounds(c.source),h=[];for(h.push(i[0]),s=0;s<i.length;s++)y=t.datavisualization.Diagram.Util.bounds(i[s].source),y.height==p.height&&h.push(i[s]);if(h.length>0){if(!u)for(t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+o.width+15,o.y+c.offset),t.datavisualization.Diagram.Point(o.x+o.width+15,o.y+o.height+c.offset),f,n._adornerSvg,l,a,v),s=0;s<h.length;s++)o=t.datavisualization.Diagram.Util.bounds(h[s].source),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+o.width+15,o.y),t.datavisualization.Diagram.Point(o.x+o.width+15,o.y+o.height),f,n._adornerSvg,l,a,v);r.offset=c.offset;r.snapped=!0}},_findEquallySpacedNodesAtLeft:function(n,i,r,u){for(var o,f,s,e=1;e<n.length;e++)if(o=t.datavisualization.Diagram.Util.bounds(n[e-1].object),f=t.datavisualization.Diagram.Util.bounds(n[e].object),s=o.x-f.x-f.width,Math.abs(s-i)<=1)u[u.length]=n[e],f.y<r&&(r=f.y);else break;return r},_findEquallySpacedNodesAtRight:function(n,i,r,u,f){var l=n[0].distance,s,h,o,c,e;if(Math.abs(i-l)<=f)for(e=0;e<n.length-1;e++)if(s=n[e].object,h=t.datavisualization.Diagram.Util.bounds(n[e+1].object),o=t.datavisualization.Diagram.Util.bounds(s),c=h.x-o.x-o.width,Math.abs(c-i)<=1)u[u.length]=n[e+1],o.y<r&&(r=o.y);else break;return r},_findEquallySpacedNodesAtTop:function(n,i,r,u){for(var o,f,s,e=1;e<n.length;e++)if(o=t.datavisualization.Diagram.Util.bounds(n[e-1].object),f=t.datavisualization.Diagram.Util.bounds(n[e].object),s=o.y-f.y-f.height,Math.abs(s-i)<=1)u[u.length]=n[e],f.x+f.width>r&&(r=f.x+f.width);else break;return r},_findEquallySpacedNodesAtBottom:function(n,i,r,u,f){var l=n[0].distance,s,h,e,c,o;if(Math.abs(i-l)<=f)for(o=0;o<n.length-1;o++)if(s=n[o].object,h=t.datavisualization.Diagram.Util.bounds(n[o+1].object),e=t.datavisualization.Diagram.Util.bounds(s),c=h.y-e.y-e.height,Math.abs(c-i)<=1)u[u.length]=n[o+1],e.x+e.width>r&&(r=e.x+e.width);else break;return r}};t.datavisualization.Diagram.SpatialUtil={findQuads:function(n,t){n.quads=[];var i=n.parentQuad;return this._findQuads(n,i,t),n.quads},_addIntoAQuad:function(n){for(var t=!1;!t;)t=this._add(n,n.parentQuad)},_setCurrentNode:function(n,i){n.childnode=i;var r=t.datavisualization.Diagram.Util.bounds(i);n.childLeft=r.left;n.childTop=r.top;n.childRight=r.right;n.childBottom=r.bottom},_add:function(n,i){if(this._isContained(n,i))return this._selectQuad(n,i),!0;var r,u=!i.objects.length&&i.first==null&&i.second==null&&i.third==null&&i.fourth==null;return n.childLeft<i.left?n.childTop<i.top?(r=t.datavisualization.Diagram.Quad(i.left-i.width,i.top-i.height,i.width*2,i.height*2),u||(r.fourth=i)):(r=t.datavisualization.Diagram.Quad(i.left-i.width,i.top,i.width*2,i.height*2),u||(r.second=i)):n.childTop<i.top?(r=t.datavisualization.Diagram.Quad(i.left,i.top-i.height,i.width*2,i.height*2),u||(r.third=i)):(r=t.datavisualization.Diagram.Quad(i.left,i.top,i.width*2,i.height*2),u||(r.first=i)),i.parent=r,n.parentQuad=r,!1},_isContained:function(n,t){return n.childLeft>=t.left&&n.childRight<=t.left+t.width&&n.childTop>=t.top&&n.childBottom<=t.top+t.height?!0:!1},_selectQuad:function(n,t){for(var i=t;i!==null;)i=this._getQuad(n,i)},_getQuad:function(n,i){var u=i.width/2,f=i.height/2,e,r;if(u>=100&&f>=100)if(e=i.left+u,r=i.top+f,n.childRight<=e){if(n.childBottom<=r)return i.first?i.first:i.first=t.datavisualization.Diagram.Quad(i.left,i.top,u,f,i);if(n.childTop>=r)return i.third?i.third:i.third=t.datavisualization.Diagram.Quad(i.left,r,u,f,i)}else if(n.childLeft>=e){if(n.childBottom<=r)return i.second?i.second:i.second=t.datavisualization.Diagram.Quad(e,i.top,u,f,i);if(n.childTop>=r)return i.fourth?i.fourth:i.fourth=t.datavisualization.Diagram.Quad(e,r,u,f,i)}return i.objects.push(n.childnode),n.quadTable[n.childnode.name]=i,null},_findQuads:function(n,t,i){t.first&&this._isIntersect(t.first,i)&&this._findQuads(n,t.first,i);t.second&&this._isIntersect(t.second,i)&&this._findQuads(n,t.second,i);t.third&&this._isIntersect(t.third,i)&&this._findQuads(n,t.third,i);t.fourth&&this._isIntersect(t.fourth,i)&&this._findQuads(n,t.fourth,i);t.objects.length>0&&n.quads.push(t)},_isIntersect:function(n,t){return n.left+n.width<t.x||n.top+n.height<t.y||n.left>t.x+t.width||n.top>t.y+t.height?!1:!0},_update:function(n){if(n.parent!=null&&n.objects.length==0&&n.first==null&&n.second==null&&n.third==null&&n.fourth==null){var t=n.parent;t.first==n?t.first=null:t.second==n?t.second=null:t.third==n?t.third=null:t.fourth==n&&(t.fourth=null);this._update(n.parent)}else return},_isWithinPageBounds:function(n,t){return t.left>=n.pageLeft&&t.right<=n.pageRight&&t.top>=n.pageTop&&t.bottom<=n.pageBottom?!0:!1},_updateBounds:function(n,i,r,u){var f=!1;i.topElement&&r.name==i.topElement.name&&(f=!0,i.pageTop=null,this._findQuadElement(i,i.parentQuad,"top"));i.leftElement&&r.name==i.leftElement.name&&(f=!0,i.pageLeft=null,this._findQuadElement(i,i.parentQuad,"left"));i.rightElement&&r.name==i.rightElement.name&&(f=!0,i.pageRight=null,this._findQuadElement(i,i.parentQuad,"right"));i.bottomElement&&r.name==i.bottomElement.name&&(f=!0,i.pageBottom=null,this._findQuadElement(i,i.parentQuad,"bottom"));f&&n._pageBackgroundLayer&&t.datavisualization.Diagram.PageUtil._updatePageSize(n,u!==undefined?u:!0)},_findQuadElement:function(n,i,r){var u,f;switch(r){case"bottom":i.third!=null||i.fourth!=null?(i.third!=null&&this._findQuadElement(n,i.third,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r)):(i.first!=null&&this._findQuadElement(n,i.first,r),i.second!=null&&this._findQuadElement(n,i.second,r));break;case"top":i.first!=null||i.second!=null?(i.first!=null&&this._findQuadElement(n,i.first,r),i.second!=null&&this._findQuadElement(n,i.second,r)):(i.third!=null&&this._findQuadElement(n,i.third,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r));break;case"left":i.first!=null||i.third!=null?(i.first!=null&&this._findQuadElement(n,i.first,r),i.third!=null&&this._findQuadElement(n,i.third,r)):(i.second!=null&&this._findQuadElement(n,i.second,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r));break;case"right":i.second!=null||i.fourth!=null?(i.second!=null&&this._findQuadElement(n,i.second,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r)):(i.third!=null&&this._findQuadElement(n,i.third,r),i.first!=null&&this._findQuadElement(n,i.first,r))}for(f=0;f<i.objects.length;f++)u=t.datavisualization.Diagram.Util.bounds(i.objects[f]),r==="bottom"&&(n.pageBottom<=u.bottom||n.pageBottom==null)?(n.pageBottom=u.bottom,n.bottomElement=i.objects[f]):r==="top"&&(n.pageTop>=u.top||n.pageTop==null)?(n.pageTop=u.top,n.topElement=i.objects[f]):r==="left"&&(n.pageLeft>=u.left||n.pageLeft==null)?(n.pageLeft=u.left,n.leftElement=i.objects[f]):r==="right"&&(n.pageRight<=u.right||n.pageRight==null)&&(n.pageRight=u.right,n.rightElement=i.objects[f])},_initializeNodes:function(n,t){for(var r,f,u=n.nodes(),i=0;i<u.length;i++)r=u[i],f=this.getObjectType(r),f!="group"&&this._updateQuad(n,t,r)},_initializeConnectors:function(n,t){for(var r=n.connectors(),i=0;i<r.length;i++)this._updateQuad(n,t,r[i])},_updateQuad:function(i,r,u){var h,s,f,o,e;this._setCurrentNode(r,u);h=t.datavisualization.Diagram.Util.bounds(u);s=r.quadTable[u.name];s?this._isContained(r,s)||(this._removeFromaQuad(r,s,u),this._addIntoAQuad(r)):(r.parentQuad||(r.parentQuad=t.datavisualization.Diagram.Quad(0,0,200,200)),this._addIntoAQuad(r));this._isWithinPageBounds(r,h)&&r.leftElement!=u&&r.topElement!=u&&r.rightElement!=u&&r.bottomElement!=u||(f=!1,o=!1,r.pageLeft>=r.childLeft||r.pageLeft==null?(r.pageLeft=r.childLeft,r.leftElement=u,f=!0):u==r.leftElement&&(r.pageLeft=null,this._findQuadElement(r,r.parentQuad,"left"),o=f=!0),r.pageTop>=r.childTop||r.pageTop==null?(r.pageTop=r.childTop,r.topElement=u,f=!0):u==r.topElement&&(r.pageTop=null,this._findQuadElement(r,r.parentQuad,"top"),o=f=!0),r.pageBottom<=r.childBottom||r.pageBottom==null?(f=!0,r.pageBottom=r.childBottom,r.bottomElement=u):u==r.bottomElement&&(r.pageBottom=null,this._findQuadElement(r,r.parentQuad,"bottom"),o=f=!0),r.pageRight<=r.childRight||r.pageRight==null?(r.pageRight=r.childRight,r.rightElement=u,f=!0):u==r.rightElement&&(r.pageRight=null,this._findQuadElement(r,r.parentQuad,"right"),o=f=!0));e=i.activeTool.diagramBounds;f&&i.model.pageSettings.multiplePage&&(i.model.pageSettings.pageWidth||i.model.pageSettings.pageHeight)&&e&&(f=!1,(o||r.pageLeft<e.x||r.pageTop<e.y||r.pageRight>e.x+e.width||r.pageBottom>e.y+e.height)&&(f=!0,i.activeTool.diagramBounds=i._getDigramBounds()));f&&(i._views.forEach(function(t){var u=i._views[t],r;u.type=="overview"&&(r=n("#"+t).ejOverview("instance"),r&&r._updateOverview(u))}),!i._layoutInAction&&i._pageBackgroundLayer&&t.datavisualization.Diagram.PageUtil._updatePageSize(i,i.activeTool.inAction||i._selectedSymbol))},_removeFromaQuad:function(n,t,i){if(t){var r=t.objects.indexOf(i);t.objects.splice(r,1);this._update(t);delete n.quadTable[i.name]}}};t.datavisualization.Diagram.Quad=function(n,t,i,r,u){return{left:n,top:t,width:i,height:r,parent:u,first:null,second:null,third:null,fourth:null,objects:[]}};t.datavisualization.Diagram.SpatialSearch=function(){return{pageLeft:null,pageRight:null,pageTop:null,pageBottom:null,topElement:null,bottomElement:null,rightElement:null,leftElement:null,childLeft:null,childTop:null,childRight:null,childBottom:null,childNode:null,quads:null,parentQuad:t.datavisualization.Diagram.Quad(0,0,200,200),quadTable:{}}};t.datavisualization.Diagram.ClassifierHelper={getEditableElementUnderMouse:function(n,t){var i=t._findNodeUnderMouse(n),r;return i&&(r=i.name.match("_attribute")?"attribute":i.name.match("_method")?"method":i.name.match("_member")?"member":"header",r&&i.parent&&(i=t.nameTable[i.parent])),i},getMovableElementUnderMouse:function(n,t){var i=t._findNodeUnderMouse(n),r=n.target.className;return!i||!i.parent||i.type=="umlclassifier"||(i=t.nameTable[i.parent]),i},getSelectableElementUnderMouse:function(n,t){var i=t._findNodeUnderMouse(n);return!i||!i.parent||i.type=="umlclassifier"||(i=t.nameTable[i.parent]),i},getDropableElementUnderMouse:function(n,i){var r=i._findNodeUnderMouse(n);return i._nodeUnderMouse||(i._nodeUnderMouse=r),r&&t.datavisualization.Diagram.Util.canAllowDrop(r)?r:!0},renderResizeBorder:function(n,t,i,r){var u=t.width?t.width:t._width,f=t.height?t.height:t._height;return i.rect({id:n,width:u*r+t.borderWidth+4,height:f*r+t.borderWidth+4,x:-(t.borderWidth/2+2),y:-(t.borderWidth/2+2),stroke:"#f93732","stroke-width":2,"stroke-dasharray":"0",fill:"none","pointer-events":"none"})},getEditboxValue:function(i,r,u){for(var v,s,y,o,p,c,w,a,f,e=0;e<r.children.length;e++)typeof r.children[e]=="string"&&(r.children[e]=u.nameTable[r.children[e]]),v=r.children[e].name.match("_attribute")?"attribute":r.children[e].name.match("_method")?"method":r.children[e].name.match("_member")?"member":"header";for(s=i.split("\n"),f=0;f<s.length;f++)s[f]=s[f].trim().replace(/\s+/g," "),!s[f].indexOf("---")>-1&&s[f].charAt(0)=="+"||s[f].charAt(0)=="-"||s[f].charAt(0)=="#"||s[f].charAt(0)=="~"?s[f]=s[f]:f!=s[f].length-s[f].length&&!s[f].indexOf("---")>-1&&s[f].length>0&&v!="member"&&!r.enumeration&&(s[f]="+ "+s[f]),s[f].indexOf("---")>-1&&s[f].match(/\w|\d|\D|\s/g)&&(y=s[f].match(/---/g),s[f]=y[0]);for(i=s.join("\n"),o=i.split("\n---\n"),f=0;f<o.length;f++)o[f]=o[f].replace(/^\n+/g,"");for(o[0].indexOf("+")>-1&&(o[0]=o[0].replace(/[+]/g,"")),o[0].length>0&&(r.children[0].labels[0].text=o[0]),r.children[1]&&!o[2]?r.children[1].labels[0].text=o[1]:r.children[1]&&o[2]&&(r.children[1].name.indexOf("method")>-1?r.children[1].labels[0].text.indexOf(o[1])>-1?(r.children[1].labels[0].text=o[1],o.pop()):r.children[1].labels[0].text=o[2]:(p=r.children[1].name.indexOf("attribute")>-1?o[1]:r.children[1].name.indexOf("member")>-1?o[1]:o[2],r.children[1].labels[0].text=p)),r.children[2]&&(r.children[2].labels[0].text=o[2]),e=0;e<r.children.length;e++)c=r.children[e].labels[0].text,c&&c.indexOf("--")>-1&&(c=c.replace(/---\n*/g,""),r.children[e].labels[0].text=c),c&&c.endsWith("\n")&&(w=c.replace(/\n+$/g,""),r.children[e].labels[0].text=w),a=r.children[e].labels[0].text?r.children[e].labels[0].text.length:null,!a&&a<=0&&(u._remove(r.children[e]),e--),u.nameTable[r.children[e].name]=r.children[e];if(o[2]&&!r.children[2]||o[1]&&!r.children[1]){var h=[],l=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Select|t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeSouth|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Rotate|t.datavisualization.Diagram.NodeConstraints.ResizeEast),b={width:r.width,offsetX:r.offsetX,parent:r.name,ports:[],fillColor:"transparent",borderColor:r.borderColor,type:"node",labels:[{margin:{left:5,right:5,top:5,bottom:5}}],_isClassMember:!0};for(e=0;e<r.children.length;e++)e!=0&&r.children[e].name.indexOf("_attribute")>-1&&o[2].length>0?h.push({name:r.name+"_method_classifier",labels:[{text:o[2],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l}):e!=0&&r.children[e].name.indexOf("_method")>-1&&o[1].length>0&&h.push({name:r.name+"_attribute_classifier",labels:[{text:o[1],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l});for(r.children.length<2&&(o[1]&&h.push({name:r.name+"_attribute_classifier",labels:[{text:o[1],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l}),o[2]&&h.push({name:r.name+"_method_classifier",labels:[{text:o[2],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l})),f=0;f<h.length;f++)h[f].labels[0]=n.extend(!0,{},r.labels[0],h[f].labels[0]),h[f]=t.datavisualization.Diagram.Node(n.extend(!0,{},b,h[f])),u._getNodeDimension(h[f],h[f].labels[0]),h[f].offsetY+=r.offsetY-r.height/2,u.add(h[f]),u.nameTable[h[f].name]=h[f];r.children[2]&&r.children[2].match("_attribute")&&(r.children.splice(1,0,r.children[2]),r.children.pop());typeof r.children[1]=="string"&&(r.children[1]=u.nameTable[r.children[1]]);typeof r.children[2]=="string"&&(r.children[2]=u.nameTable[r.children[2]])}for(e=0;e<r.children.length;e++)r.children.length==1&&(r["class"]&&(delete r["class"].attributes,delete r["class"].methods),r["interface"]&&(delete r["interface"].attributes,delete r["interface"].methods),r.enumeration&&delete r.enumeration.members),r.children.length==2&&(r["class"]&&(r.children[e].name.match("attribute")&&delete r["class"].methods,r.children[e].name.match("method")&&delete r["class"].attributes),r["interface"]&&(r.children[e].name.match("attribute")&&delete r["interface"].methods,r.children[e].name.match("method")&&delete r["interface"].attributes)),this._updateClassNode(r.children[e],r);return i},getUMLConnectorValue:function(t,i,r){var o,f,e,u;return(r.name===t.name+"_sourcelabel"||r.name===t.name+"_targetlabel")&&((t.shape.multiplicity.type=="onetoone"||t.shape.multiplicity.type=="manytoone"||t.shape.multiplicity.type=="onetomany")&&(i.length==1&&(i.indexOf("1")>-1||i.indexOf("*")>-1)&&(o=!0),f=!1,r.name===t.name+"_sourcelabel"&&(t.shape.multiplicity.type=="onetoone"||t.shape.multiplicity.type=="onetomany")?(i="1",t.shape.multiplicity=n.extend(!0,{},t.shape.multiplicity,{source:{optional:f,lowerBounds:null,upperBounds:null}})):r.name===t.name+"_targetlabel"&&(t.shape.multiplicity.type=="manytoone"||t.shape.multiplicity.type=="onetoone")&&(i="1",t.shape.multiplicity=n.extend(!0,{},t.shape.multiplicity,{target:{optional:f,lowerBounds:null,upperBounds:null}}))),i=this.umlConnectorEditBox(i),i.match(/\d\.{3}\d/g)?u=i.split("..."):o||(e=this.umlConnectorMultiplicity(t),r.name==t.name+"_sourcelabel"?(u=e[0].text.split("..."),i=e[0].text):(u=e[1].text.split("..."),i=e[1].text)),u&&(t.shape.multiplicity=r.name==t.name+"_sourcelabel"?n.extend(!0,{},t.shape.multiplicity,{source:{optional:f,lowerBounds:u[0],upperBounds:u[1]}}):n.extend(!0,{},t.shape.multiplicity,{target:{optional:f,lowerBounds:u[0],upperBounds:u[1]}}))),r.text=i,t},umlConnectorMultiplicity:function(n){var o=[],t,i,r,u,f,e;return n.shape.multiplicity.source&&(n.shape.multiplicity.source.lowerBounds=this.umlConnectorEditBox(n.shape.multiplicity.source.lowerBounds),n.shape.multiplicity.source.upperBounds=this.umlConnectorEditBox(n.shape.multiplicity.source.upperBounds)),n.shape.multiplicity.target&&(n.shape.multiplicity.target.lowerBounds=this.umlConnectorEditBox(n.shape.multiplicity.target.lowerBounds),n.shape.multiplicity.target.upperBounds=this.umlConnectorEditBox(n.shape.multiplicity.target.upperBounds)),f=n.shape.multiplicity.source,e=n.shape.multiplicity.target,t=f.upperBounds?f.lowerBounds+"..."+f.upperBounds:f.lowerBounds,i=e.upperBounds?e.lowerBounds+"..."+e.upperBounds:e.lowerBounds,n.shape.multiplicity.type=="manytoone"&&(n.shape.multiplicity.target.optional=!1,r=t?t:"*",u="1"),n.shape.multiplicity.type=="onetomany"&&(n.shape.multiplicity.source.optional=!1,u=i?i:"*",r="1"),n.shape.multiplicity.type=="manytomany"&&(r=t?t:"*",u=i?i:"*"),n.shape.multiplicity.type=="onetoone"&&(n.shape.multiplicity.target.optional=!1,n.shape.multiplicity.source.optional=!1,r="1",u="1"),o.push({name:n.name+"_sourcelabel",text:r,segmentOffset:0,alignment:"before",margin:{left:5,top:5}},{name:n.name+"_targetlabel",text:u,segmentOffset:1,alignment:"before",margin:{right:5,bottom:5}}),o},umlConnectorEditBox:function(n){return typeof n=="string"&&n.match(/[a-zA-Z]/g)&&(n=n.replace(/[a-zA-Z]/g,"")),n},EnableorDisableConnection:function(n,t,i){return i.shape&&i.shape.type=="umlclassifier"&&i.shape.relationship!="association"&&(i.shape.relationship!="dependency"&&i.shape.relationship!="inheritance"&&i.shape.relationship!="realization"&&t&&n&&n["interface"]&&t["class"]&&(n=null),i.shape.relationship=="dependency"&&t&&n&&n["class"]&&t["interface"]&&(n=null)),n},getClassifierNodeDimension:function(n,t){for(var f,r,u,i=0;i<n.children.length;i++)t._getNodeDimension(n.children[i]);for(n._height=0,i=0;i<n.children.length;i++)f=n.children[i].height?n.children[i].height:n.children[i]._height,n.children[i].offsetY=n._height+f/2,n._height+=f,n.height=n._height;for(r=n.children[0]._width,n.children[1]&&(r=n.children[0]._width>n.children[1]._width?n.children[0]._width:n.children[1]._width),n.children[2]&&(r=n.children[2]._width>r?n.children[2]._width:r),n.children[0].width=r,n.children[1]&&(n.children[1].width=r),n.children[2]&&(n.children[2].width=r),n.width=r,u=0;u<n.children.length;u++)n.children[u].offsetY+=n.offsetY-n.height/2;return t._updateAssociatedConnectorEnds(n,t.nameTable),n},_updateClassNode:function(n,i){var s,a;if(n.name.match("_header"))i["class"]?i["class"].name=n.labels[0].text:i["interface"]?i["interface"].name=n.labels[0].text:i.enumeration.name=n.labels[0].text;else{for(var v=n.name.match("_attribute")?"attribute":n.name.match("_method")?"method":"member",y=n.labels[0],h,u,l=[],c,f=y.text.split("\n"),e=[],o,r=0;r<f.length;r++){f[r].indexOf("+")>-1?h="public":f[r].indexOf("-")>-1?h="private":f[r].indexOf("#")>-1?h="protected":f[r].indexOf("~")>-1&&(h="package");(f[r].indexOf("+")>-1||f[r].indexOf("-")>-1||f[r].indexOf("#")>-1||f[r].indexOf("~")>-1)&&(f[r]=f[r].replace(/[+|~|#|-]\s/g,""));switch(v){case"attribute":o=f[r].split(/:[ ]*/g);e.push(t.datavisualization.Diagram.ClassAttribute({name:o[0],type:o[1],scope:h}));break;case"method":for(u=f[r].split(/["("|")"]/g),s=0;s<u.length;s++)u[s].indexOf(",")>-1&&(o=u[s].split(",")),s==u.length-1&&(u[s]=u[s].replace(/[:\s]|:/g,""));if(o)for(a=0;a<o.length;a++)c=o[a].split(":"),l.push(t.datavisualization.Diagram.ClassmethodArguments({name:c[0],type:c[1]}));u.length!=3||o||(u[1].indexOf(":")>-1?(c=u[1].split(":"),l.push(t.datavisualization.Diagram.ClassmethodArguments({name:c[0],type:c[1]}))):l.push(t.datavisualization.Diagram.ClassmethodArguments({name:u[1]})));e.push(t.datavisualization.Diagram.ClassMethod({name:u[0],arguments:l,type:u[u.length-1],scope:h}));break;case"member":e.push(t.datavisualization.Diagram.ClassMember({name:f[r]}))}}v=="attribute"?i["class"]?i["class"].attributes=e:i["interface"]&&(i["interface"].attributes=e):v=="method"?i["class"]?i["class"].methods=e:i["interface"]&&(i["interface"].methods=e):i.enumeration.members=e}}};t.datavisualization.Diagram.SwimLaneContainerHelper={_initSwimLane:function(n,i){var i=t.datavisualization.Diagram.SwimLane(i);return i=this._initLaneCollection(n,i),this._swapPhaseSize(i),i=this._setPhaseMinValues(n,i),this._initPhaseCollection(n,i)},_initLaneCollection:function(n,i){var r,u,f,e;for(i.lanes.length===0&&(i.lanes=[t.datavisualization.Diagram.Lane({orientation:i.orientation})]),r=0;r<i.lanes.length;r++){if(i.lanes[r]=t.datavisualization.Diagram.Lane(i.lanes[r]),i.lanes[r].container={type:"canvas",orientation:i.orientation},i.lanes[r].borderColor=i.lanes[r].borderColor?i.lanes[r].borderColor:"black",i.lanes[r].orientation=i.orientation?i.orientation:"horizontal",i.lanes[r].horizontalAlign=i.orientation==="horizontal"?"stretch":"left",i.lanes[r].verticalAlign=i.orientation==="vertical"?"stretch":"top",i.lanes[r].addInfo=i.lanes[r].addInfo?i.lanes[r].addInfo:{},i.lanes[r].fillColor=i.lanes[r].fillColor,i.lanes[r].paddingTop=20,i.lanes[r].paddingRight=20,i.lanes[r].paddingBottom=20,i.lanes[r].paddingLeft=20,i.lanes[r].constraints=i.lanes[r].constraints?i.lanes[r].constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,i.lanes[r].cssClass=i.lanes[r].cssClass,i.lanes[r]._laneHeader=i.lanes[r]._laneHeader?i.lanes[r]._laneHeader:null,i.lanes[r].labels&&i.lanes[r].labels.length>0)for(u=0;u<i.lanes[r].labels.length;u++)i.lanes[r].labels[u]=t.datavisualization.Diagram.Label(i.lanes[r].labels[u]);f=i.lanes[r]._laneHeader=i.lanes[r]._laneHeader?i.lanes[r]._laneHeader:i.lanes[r].header;e=this._initLaneHeader(n,i.lanes[r],f,i);i.lanes[r].children.splice(0,0,e)}return i},_initLaneHeader:function(n,i,r,u){var f=i.header,s=u.orientation,e,o,u;return s==="horizontal"?(e="left",o="stretch",f.rotateAngle=270):(e="stretch",o="top",f.rotateAngle=0),t.datavisualization.Diagram.Node({_hidePorts:!0,_isHeader:!0,name:n._isUndo&&r.name?r.name:i.name+"_Headerr_",type:"node",labels:[f],height:r.height?r.height:50,width:r.width?r.width:50,fillColor:f.fillColor?f.fillColor:"white",rotateAngle:0,horizontalAlign:e,verticalAlign:o,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,marginLeft:-20,marginTop:-20,marginRight:-20,marginBottom:-20})},_initPhaseCollection:function(n,i){var u=0,f=0,r;for(i.phases.length===0&&(i.phases=[t.datavisualization.Diagram.Phase({orientation:i.orientation})]),r=0;r<i.phases.length;r++)i.phases[r]=t.datavisualization.Diagram.Phase(i.phases[r]),i.phases[r].isPhase=!0,i.phases[r]._hidePorts=!0,i.phases[r].constraints=t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,i.phases[r].parent="",i.phases[r]._isHeader=!0,i.phases[r]._type="node",i.phases[r].orientation=i.orientation,n._isLoad?i.phases[r].labels&&i.phases[r].labels.length>0&&(i.phases[r].label=[i.phases[r].labels[0]]):i.phases[r].label&&i.phaseSize!=0&&(i.phases[r].label.rotateAngle=i.orientation==="vertical"?270:0,i.phases[r].labels=[i.phases[r].label]),i.orientation==="horizontal"?(i.phases[r].width=i.phases[r].offset-f,i.phases[r].height=i.phaseSize,f=i.phases[r].offset):(i.phases[r].height=i.phases[r].offset-u,i.phases[r].width=i.phaseSize,u=i.phases[r].offset);return i},_setPhaseMinValues:function(n,t){var u,i,r;if(i=t.phases[0],i)for(i.offset<70&&(i.offset=70),r=1;r<t.phases.length;r++)u=t.phases[r],i=t.phases[r-1],i.offset+20>=u.offset&&(u.offset=i.offset+20);return t},_swapPhaseSize:function(n){if(n.phases.length>0)for(var i=n.phases,t,u,r=0;r<i.length;r++)for(t=0;t<i.length-r-1;t++)i[t].offset>i[t+1].offset&&(u=i[t],i[t]=i[t+1],i[t+1]=u)},_setLastPhaseSize:function(n){if(n.phases.length>0){var t=n.phases[n.phases.length-1];t.offset=n.orientation==="horizontal"?n.width:n.height}},_createSwimlane:function(n,i){var e=this._createSwimlaneHeader(n,i),l=i.orientation==="horizontal"?"vertical":"horizontal",s=i.orientation,h,c,f,o;s==="horizontal"?(h=Math.round(e.height+i.phaseSize),c=0):(h=e.height,c=Math.round(i.phaseSize));var u={name:i.name+"phaseStack",isPhaseStack:!0,container:{type:"stack",orientation:s},minHeight:10,minWidth:10,children:i.phases,marginTop:e.height,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect&~t.datavisualization.Diagram.NodeConstraints.AllowDrop},a={name:i.name+"laneStack",isLaneStack:!0,container:{type:"stack",orientation:l},children:i.lanes,marginTop:h,marginLeft:c,verticalAlign:"stretch",horizontalAlign:"stretch",constraints:(t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop)&~t.datavisualization.Diagram.NodeConstraints.Connect},r={_hidePorts:!0,name:i.name,container:{type:"canvas"},children:[e,a],addInfo:i.addInfo?i.addInfo:null,paletteItem:i.paletteItem?i.paletteItem:null,constraints:i.constraints,cssClass:i.cssClass,offsetX:i.offsetX?i.offsetX:100,offsetY:i.offsetY?i.offsetY:100,orientation:i.orientation,phaseSize:i.phaseSize,isSwimlane:!0,height:i.height?i.height:100,width:i.width?i.width:100};return r.offsetX=i.offsetX?i.offsetX:100,r.offsetY=i.offsetY?i.offsetY:100,f=t.datavisualization.Diagram.containerCommon._cloneObject(n,r,t.datavisualization.Diagram.Util.randomId()),f=t.datavisualization.Diagram.ContainerHelper._initContainer(n,f),o=t.datavisualization.Diagram.Util.bounds(f),o=this._setSwimlaneSize(n,r,o),t.datavisualization.Diagram.containerCommon._removeObject(n,f),s==="horizontal"?(u.maxHeight=i.phaseSize,u.minWidth=10):(u.minHeight=10,u.maxWidth=i.phaseSize),r.children.splice(1,0,u),this._setPhaseValues(n,r,o),t.datavisualization.Diagram.ContainerHelper._initContainer(n,r)},_setSwimlaneSize:function(n,t,i){var f,r,u;if(t.orientation==="horizontal"){if(t.width>i.width){for(r=t.children[1].children,u=0;u<r.length;u++)r[u].minWidth=t.width;i.width=t.width}t.height>i.height&&(r=t.children[1].children,f=r[r.length-1],f.minHeight+=t.height-i.height,i.height=t.height)}else if(t.width>i.width&&(r=t.children[1].children,f=r[r.length-1],f.minWidth+=t.width-i.width,i.height=t.height),t.height>i.height){for(r=t.children[1].children,u=0;u<r.length;u++)r[u].minHeight=t.height-2*t.children[0].height;i.height=t.height}return i},_setPhaseValues:function(n,t,i){var f=t.children[1].children,u=f[f.length-1],c=t.orientation,s,h,o,e,r;if(c==="horizontal")if(u.offset<=i.width)for(f.length==1?(u.offset=i.width,u.width=i.width):(h=f[f.indexOf(u)-1],u.offset=i.width,u.width=i.width-h.offset),e=t.children[2].children,r=0;r<e.length;r++)e[r].minWidth=u.offset;else{for(o=0,r=0;r<f.length;r++)f[r].offset>=o&&(o=f[r].offset);for(e=t.children[2].children,r=0;r<e.length;r++)e[r].minWidth=o}else if(s=t.children[0],u.offset<=i.height-s.height)for(f.length==1?(u.offset=i.height-s.height,u.height=u.offset):(h=f[f.indexOf(u)-1],u.offset=i.height-s.height,u.height=i.height-h.offset-s.height),e=t.children[2].children,r=0;r<e.length;r++)e[r].minHeight=u.offset;else{for(o=0,r=0;r<f.length;r++)f[r].offset>=o&&(o=f[r].offset);for(e=t.children[2].children,r=0;r<e.length;r++)e[r].minHeight=o}},_createSwimlaneHeader:function(n,i){var r=i.header,f=i.lanes[0]._laneHeader?i.lanes[0]._laneHeader:null,u=t.datavisualization.Diagram.Node({_type:"node",_hidePorts:!0,_isHeader:!0,name:i.name+"_header_swimlane",labels:[r],height:r.height?r.height:50,width:r.width?r.width:50,fillColor:i.header.fillColor?i.header.fillColor:f?f.fillColor:"white",rotateAngle:0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,horizontalAlign:"stretch",parent:i.name});return u.labels[0].fillColor="transparent",n._isLoad&&(u.fillColor=i.header.fillColor),u},_updateSwimlane:function(n,i){this._updateLaneStack(n,i);this._updatePhaseStack(n,i);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,i)},_updateLaneStack:function(n,t){for(var r,f,e=this.getLanes(n,t),i,u=0;u<e.length;u++)if(i=n.nameTable[n._getChild(e[u])],i){for(r=1;r<i.children.length;r++)f=typeof i.children[r]=="string"?n.nameTable[i.children[r]]:i.children[r],f.marginBottom=f.marginRight=0;this._updateLane(n,i)}},_updatePhaseStack:function(n,i){var r=n.nameTable[n._getChild(i.children[1])];t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r)},_updateLane:function(n,i){t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,i)},getPhases:function(n,t,i){var u,r;if(t&&(t.children[1]&&(u=i?i[n._getChild(t.children[1])]:n.nameTable[n._getChild(t.children[1])]),u&&(r=n._getChildren(u.children),r&&r.length>0)))return r},getLanes:function(n,t){var r,i;return t&&t.isSwimlane&&t.children[2]&&(r=n.nameTable[n._getChild(t.children[2])]),r&&(i=r.children,i&&i.length>0)?i:void 0},_updateLanesMinValue:function(n,t,i,r){for(var e=this.getLanes(n,t),u,f=0;f<e.length;f++)u=n.nameTable[n._getChild(e[f])],u&&(u[i]=r)},_resizeLastPhase:function(){},_getPhaseBounds:function(n,i){var r=null,u,l,o,f=0,h=0,s=0,c=0,e,a,v,y;return i&&i.type=="phase"&&i.parent&&(e=this._getPrevPhase(n,i),a=this._getNextPhase(n,i),u=n.nameTable[i.parent.split("phaseStack")[0]],u&&u.orientation&&(r=t.datavisualization.Diagram.Util.bounds(u),u.orientation=="horizontal"?(o=this._getPrevOffset(n,i,e,a,u,r),e&&e.name===i.name?(f=o.left+r.left,h=f+(i.offset-f-o.left)):(e&&(f=r.left+e.offset),h=i.offset-f+r.left),s=o.top+r.top,c=r.bottom-s,l=t.datavisualization.Diagram.Rectangle(f,s,h,c)):(o=this._getPrevOffset(n,i,e,a,u,r),e===i?(f=o.left+r.left,c=i.offset+s,s=o.top+r.top):(v=typeof u.children[0]=="string"?n.nameTable[u.children[0]]:n.nameTable[u.children[0].name],y=v?v.height:0,f=o.left+r.left,e&&(s=e.offset+r.top+y),c=r.top+i.offset-s+y),h=r.right-f,l=t.datavisualization.Diagram.Rectangle(f,s,h,c)))),l},_getPrevPhase:function(n,i){var f=null,u,e=n.nameTable[i.parent.split("phaseStack")[0]],r=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,e);return e&&r&&r.length>0&&(u=this._getPhaseIndex(n,i.name),f=u===0?n.nameTable[r[0]]:n.nameTable[r[u-1]]),f},_getPrevOffset:function(n,t,i,r,u){var f,e,h=0,c=0,s,o;return u.children[0]&&(s=n.nameTable[n._getChild(u.children[0])],s&&(c=s.height)),u.orientation=="horizontal"&&(u.children[2]&&(f=n.nameTable[n._getChild(u.children[2])]),f&&f.children&&f.children.length>0&&(e=n.nameTable[n._getChild(f.children[0])],e&&e.children&&e.children.length>0&&(o=n.nameTable[n._getChild(e.children[0])],o&&o.name.indexOf("_Headerr")!=-1&&(h=o.width)))),{left:h,top:c}},_getNextPhase:function(n,i){var f=null,u,e=n.nameTable[i.parent.split("phaseStack")[0]],r=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,e);return e&&r&&r.length>0&&(u=n._getPhaseIndex(i.name),f=u===r.length-1?n.nameTable[r[u]]:n.nameTable[r[u+1]]),f},_getPhaseIndex:function(n,i){var r,f,e=-1,u;return r=n.nameTable[i],r&&r.parent&&(f=n.nameTable[r.parent.split("phaseStack")[0]],u=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,f),u&&u.length>0&&(e=u.indexOf(i))),e},_cloneLaneObj:function(t,i,r,u){var s=u?u:t.nameTable,e,o,f;if(i=n.extend(!0,{},i),e=i.children,e&&e.length>0)for(o=0;o<e.length;o++)f=s[t._getChild(e[o])],f&&(f=jQuery.extend(!0,{},f),f&&f.children&&f.children.length&&(f=t._cloneLaneObj(f,r,u)),f.name+=r,f.parent=r,i.children[o]=f,u&&t._preserveConnection(u,f));return i&&i.header&&(i.header.name+=r),i.name+=r,i},_cloneSwimlaneObj:function(t,i,r,u){var f;if(i=n.extend(!0,{},i),i&&i.isSwimlane){if(i=jQuery.extend(!0,{},i),i.name+=r,i.lanes&&i.lanes.length>0)for(f=0;f<i.lanes.length;f++)i.lanes[f]&&(i.lanes[f]=t._cloneLaneObj(i.lanes[f],r,u&&u.childTable?u.childTable:null));if(i.phases&&i.phases.length>0)for(f=0;f<i.phases.length;f++)i.phases[f]&&(i.phases[f].name+=r,i.phases[f].parent="")}return i},_pasteSwimlaneObj:function(n,i,r){if(i=n._pasteSwimlane(i,r),i){var u=n._isUndo?0:n._pasteIndex*10;n._translate(i,u,u,n.nameTable);t.datavisualization.Diagram.DiagramContext.update(i,n)}return i},_pasteSwimlane:function(n,i,r){if(n._pasteObj=!0,i&&i.isSwimlane){var f=n._isUndo?0:n._pasteIndex*10,u=n._cloneSwimlaneObj(n._getNode(i.name,r?r.childTable:null),n._swimlanePaste?"":t.datavisualization.Diagram.Util.randomId(),r);if(u=t.datavisualization.Diagram.ContainerHelper._initContainer(n,u,r),n._outOfBoundsOnNudge(u,f,f))n.add(u);else return t.datavisualization.Diagram.containerCommon._removeObject(n,u),null;return n._pasteObj=!1,u}},_updateNextPhase:function(n,i,r,u){for(var o=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),f,e=u+1;e<o.length;e++)f=n.nameTable[n._getChild(o[e])],f&&(f.offset+=r)},_getOuterNodes:function(n,i,r,u){for(var f,e,o,l,h=[],c=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,i),a=i.orientation==="horizontal"?"left":"top",v=i.orientation==="horizontal"?r:u,s=0;s<c.length;s++)if(f=n.nameTable[n._getChild(c[s])],f&&f.children.length>1)for(e=0;e<f.children.length;e++)o=n.nameTable[n._getChild(f.children[e])],o&&(l=t.datavisualization.Diagram.Util.bounds(o),l[a]>v&&h.push(o));return h},_getInnerNodes:function(n,i,r,u){for(var f,e,o,h,c=[],l=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,i),a=i.orientation==="horizontal"?"left":"top",v=i.orientation==="horizontal"?"right":"bottom",s=0;s<l.length;s++)if(f=n.nameTable[n._getChild(l[s])],f&&f.children.length>1)for(e=0;e<f.children.length;e++)o=n.nameTable[n._getChild(f.children[e])],o&&(h=t.datavisualization.Diagram.Util.bounds(o),h[a]>=r&&h[v]<=u&&c.push(o));return c},_moveOuterNodes:function(n,i,r,u){var v=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),s=n.nameTable[n._getChild(v[u])],h=t.datavisualization.Diagram.Util.bounds(i),y=n.nameTable[n._getChild(i.children[0])],c=h.left+s.offset,l=h.top+s.offset+y.height,a=i.orientation==="horizontal"?"offsetX":"offsetY",w=i.orientation==="horizontal"?c:l,p=i.orientation==="horizontal"?"marginLeft":"marginTop",f=n._getOuterNodes(i,c,l),e,o;if(f&&f.length>0)for(e=0;e<f.length;e++)o=n.nameTable[n._getChild(f[e])],n._translate(o,a==="offsetX"?r:0,a==="offsetY"?r:0,n.nameTable),o[p]+=r},_moveOnPhaseChange:function(n,i,r){var u,s=i.parent.split("phaseStack")[0],f,o,h,e;if(s&&(f=n.nameTable[s]),f){for(o=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,f),h=n.nameTable[n._getChild(f.children[0])],e=0;e<o.length;e++)u=n.nameTable[n._getChild(o[e])],u&&(i.orientation==="horizontal"?(u.width+=r,u.minWidth=u.width):(u.height+=r,u.minHeight=u.height));i.orientation==="horizontal"?f.minWidth+=r:f.minHeight=u.height;t.datavisualization.Diagram.SwimLaneContainerHelper._updateSwimlane(n,f)}},_getPhaseDifferece:function(n,i,r,u){var p=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),f=n.nameTable[n._getChild(p[r])],e=t.datavisualization.Diagram.Util.bounds(i),y=i.orientation==="horizontal"?"left":"top",v=n.nameTable[n._getChild(i.children[0])],c=0,a,s,l,o,h;return i.orientation==="vertical"&&(c=v.height),r===0?(s=n._getInnerNodes(i,e[y]+c,e[y]+f.offset+c),s&&s.length>0?(l=t.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup",children:s}),t.datavisualization.Diagram.Util._updateGroupBounds(l,n),o=t.datavisualization.Diagram.Util.bounds(l)):(o=t.datavisualization.Diagram.Util.bounds(),o.right=e.left+50),i.orientation==="horizontal"?(e.left+(f.offset+u)>=o.right+20||(h=o.right+20-(e.left+(f.offset+u)),u=u+h),f.offset+u<100&&(u=0)):(e.top+v.height+(f.offset+u)>=o.bottom+20||(h=o.bottom+20-(e.top+c+(f.offset+u)),u=u+h),f.offset+u<100&&(u=0))):(a=n.nameTable[n._getChild(p[r-1])],s=n._getInnerNodes(i,e[y]+a.offset+c,e[y]+f.offset+c),s&&s.length>0?(l=t.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup",children:s}),t.datavisualization.Diagram.Util._updateGroupBounds(l,n),o=t.datavisualization.Diagram.Util.bounds(l)):(o=t.datavisualization.Diagram.Util.bounds(),o.bottom=e.top+v.height+a.offset),i.orientation==="horizontal"?e.left+(f.offset+u)>=o.right+20||(h=o.right+20-(e.left+(f.offset+u)),u=u+h):e.top+v.height+(f.offset+u)>=o.bottom+20||(h=o.bottom+20-(e.top+v.height+(f.offset+u)),u=u+h)),a&&f.offset-a.offset+u<20&&(u-=f.offset-a.offset+u-20),u}};t.datavisualization.Diagram.ContainerHelper={_initContainer:function(n,i){if(i.container)switch(i.container.type){default:case"canvas":if(i=t.datavisualization.Diagram.canvasHelper._initCanvas(n,i),i.type=="bpmn"){var r=t.datavisualization.Diagram.ContainerHelper.updateparent(i,n);r||t.datavisualization.Diagram.bpmnHelper.updateCanvas(i,n)}break;case"stack":i=t.datavisualization.Diagram.stackHelper._initStack(n,i)}else(i.type==="swimlane"||i.isSwimlane)&&(i=t.datavisualization.Diagram.SwimLaneContainerHelper._initSwimLane(n,i),i=t.datavisualization.Diagram.SwimLaneContainerHelper._createSwimlane(n,i));return i},_add:function(i,r){var u,f,o,s,e;if(i.getObjectType(r)!=="connector"&&(u=r.parent?i.nameTable[r.parent]:null,u&&u.container)){for(f=u.children.length-1;f>=0;f--)o=i.nameTable[i._getChild(u.children[f])],o.name===r.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(u.children,u.children[f]);u.children.push(r.name);i._disableSwimlaneUptate=!0;t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(i);s=n.extend(!0,{},u);this._updateCollectionChange(i,u,!0);t.datavisualization.Diagram.canvasHelper._updateAddRemoveNodeConnectors(i,u,s);delete i._disableSwimlaneUptate;t.datavisualization.Diagram.canvasHelper._updateLastSwimlanePhase(i,r);e=i._svg.document.getElementById(r.parent);r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e);t.datavisualization.Diagram.canvasHelper._enableConnectorUpdateNode(i,r)}},updateparent:function(n,t){var i=n;if(t)while(i&&i.parent)if(i=t.nameTable[i.parent],i&&i.isLane)return i;return!1},_updateCollectionChange:function(n,i,r,u){var f,e,o,s,u,h;n._diagramClear||(o=!0,i&&(s=t.datavisualization.Diagram.Util.bounds(i),f={x:s.x,y:s.y},i.container&&(i.container.type==="canvas"?i._isBpmn?(u=this.updateparent(i,n),u?t.datavisualization.Diagram.canvasHelper._updateCollectionChange(n,i):t.datavisualization.Diagram.bpmnHelper.updateCanvas(i,n)):t.datavisualization.Diagram.canvasHelper._updateCollectionChange(n,i):t.datavisualization.Diagram.stackHelper._updateCollectionChange(n,i,null,u)),(r&&!i.isLane&&!i._isBpmn||i.isSwimlane)&&(n._disableSwimlaneUptate&&(o=!1),h=t.datavisualization.Diagram.Util.bounds(i),e={x:h.x,y:h.y},n._translate(i,f.x-e.x,f.y-e.y,n.nameTable),o&&t.datavisualization.Diagram.DiagramContext.update(i,n))),!i||!i.container||i.isLane||i.isSwimlane||i.isLaneStack||i.isPhaseStack||t.datavisualization.Diagram.DiagramContext.update(i,n))}};t.datavisualization.Diagram.stackHelper={_initStack:function(n,i){return i=t.datavisualization.Diagram.Group(i),i=this._initGroupNode(n,i),i=this._initChildren(n,i),this._setSize(n,i),this._alignChildren(n,i),i},_initGroupNode:function(n,i){return t.datavisualization.Diagram.containerCommon._initGroupNode(n,i)},_initChildren:function(n,i){return t.datavisualization.Diagram.containerCommon._initChildren(n,i)},_setSize:function(n,t){var i=this._getStackBoundsBounds(n,t);i.width>=t.minWidth&&i.width<=t.maxWidth?t.width=i.width:i.width<=t.minWidth?t.width=t.minWidth:i.width>=t.maxWidth&&(t.width=t.maxWidth);i.height>=t.minHeight&&i.height<=t.maxHeight?t.height=i.height:i.height<=t.minHeight?t.height=t.minHeight:i.height>=t.maxHeight&&(t.height=t.maxHeight)},_getStackBoundsBounds:function(n,i){var f=t.datavisualization.Diagram.Rectangle(),e,u,r,c=0,l=0,s=0,h=0,a=i.container.orientation?i.container.orientation:"vertical",o;if(i.children&&i.children.length>0)for(o=i.children,e=0;e<o.length;e++)u=typeof o[e]=="string"?n.nameTable[o[e]]:o[e],u&&(r=t.datavisualization.Diagram.Util.bounds(u),r=t.datavisualization.Diagram.Geometry.rect([r.topLeft,r.topRight,r.bottomRight,r.bottomLeft]),r&&(a==="vertical"?(l=r.width+=u.marginLeft+u.marginRight,l>s&&(s=r.width=l),r.width=u.horizontalAlign==="stretch"?r.width>u.minWidth?r.width:s:s,r.height+=u.marginTop+u.marginBottom,r.height+=f.height):(c=r.height+=u.marginTop+u.marginBottom,c>h&&(h=r.height=c),r.height=u.verticalAlign==="stretch"?r.height>u.minHeight?r.height:h:h,r.width+=u.marginLeft+u.marginRight,r.width+=f.width),r.x=0,r.y=0),f=n._union(f,r));return f.width+=i.paddingLeft+i.paddingRight,f.height+=i.paddingTop+i.paddingBottom,f},_alignChildren:function(n,t){for(var f,i,e=0,o=0,u=t.children,r=0;r<u.length;r++)i=typeof u[r]=="string"?n.nameTable[u[r]]:u[r],i&&(f=this._getStackPosition(n,i,t,e,o),this._translate(n,i,f.x,f.y),t.container.orientation=="vertical"?o+=(i.height?i.height:i._height)+i.marginTop+i.marginBottom:e+=(i.width?i.width:i._width)+i.marginLeft+i.marginRight)},_getStackPosition:function(n,i,r,u,f){var s=0,h=0,e=t.datavisualization.Diagram.Util.bounds(r),o=t.datavisualization.Diagram.Util.bounds(i),y=r.container.orientation?r.container.orientation:"vertical",a=i.width?i.width:i._width,v=i.height?i.height:i._height,c,l;if(r.container.orientation=="vertical"){h=e.y-o.y+f+i.marginTop+r.paddingTop;switch(i.horizontalAlign){case"left":s=e.x-o.x+i.marginLeft+r.paddingLeft;break;case"center":s=e.center.x-o.center.x;break;case"right":s=e.x+e.width-(o.x+o.width+r.paddingRight);break;case"stretch":c=(r.width-(r.paddingLeft+r.paddingRight)-(i.marginLeft+i.marginRight))/a;n.scale(i,c,1,r.pivot,n.nameTable);e=t.datavisualization.Diagram.Util.bounds(r);o=t.datavisualization.Diagram.Util.bounds(i,n);s=e.x+r.paddingLeft+i.marginLeft-o.x}}else{s=e.x-o.x+u+i.marginLeft+r.paddingLeft;switch(i.verticalAlign){case"top":h=e.y-o.y+i.marginTop+r.paddingTop;break;case"center":h=e.center.y-o.center.y;break;case"bottom":h=e.y+e.height-(o.y+o.height+r.paddingBottom);break;case"stretch":l=(r.height-(r.paddingTop+r.paddingBottom)-(i.marginTop+i.marginBottom))/v;n.scale(i,1,l,r.pivot,n.nameTable);e=t.datavisualization.Diagram.Util.bounds(r);o=t.datavisualization.Diagram.Util.bounds(i,n);h=e.y+r.paddingTop+i.marginTop-o.y}}return{x:s,y:h}},_translate:function(n,i,r,u){var f,o,e;if(r||u)if(i.segments)t.datavisualization.Diagram.Util._translateLine(i,r,u,i);else{if(i.offsetX+=r,i.offsetY+=u,i._type==="group"||i.type==="pseudoGroup"||i.type=="umlclassifier")for(f=i.children,e=0;f&&e<f.length;e++)o=n.nameTable[n._getChild(f[e])],o&&this._translate(n,o,r,u);t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(i,r,u,null,n)}},_updateCollectionChange:function(n,i,r,u){if(this._setSize(n,i),this._alignChildren(n,i),i.parent){var f=n.nameTable[i.parent];f||u&&i.isPhaseStack&&(f=u);f&&f.container&&!r&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f)}}};t.datavisualization.Diagram.canvasHelper={_initCanvas:function(n,i){return i._type="group",i.type||(i.type="group"),i=t.datavisualization.Diagram.Group(i),i=this._initGroupNode(n,i),i=this._initChildren(n,i),this._setSize(n,i),this._alignChildren(n,i),i},_initGroupNode:function(n,i){return t.datavisualization.Diagram.containerCommon._initGroupNode(n,i)},_initChildren:function(n,i){return t.datavisualization.Diagram.containerCommon._initChildren(n,i)},_setSize:function(i,r,u,f){var e=this._getCanvasBounds(i,r,f),o=t.datavisualization.Diagram.Util.bounds(r),c,h,s;if(o=t.datavisualization.Diagram.Geometry.rect([o.topLeft,o.topRight,o.bottomRight,o.bottomLeft]),e.width>=r.minWidth&&e.width<=r.maxWidth?e.width=e.width:e.width<=r.minWidth?e.width=r.minWidth:e.width>=r.maxWidth&&(e.width=r.maxWidth),e.height>=r.minHeight&&e.height<=r.maxHeight?e.height=e.height:e.height<=r.minHeight?e.height=r.minHeight:e.height>=r.maxHeight&&(e.height=r.maxHeight),u){var l=e.width/o.width,a=e.height/o.height,v=e.x+e.width/2-(o.x+o.width/2),y=e.y+e.height/2-(o.y+o.height/2),p=t.datavisualization.Diagram.Point(r.offsetX,r.offsetY);if(i._translate(r,v,y,i.nameTable,!0),i.scale(r,l,a,t.datavisualization.Diagram.Point(r.offsetX,r.offsetY),i.nameTable),r._isBpmn){for(c=i._getChildren(r.children),h=0;h<c.length;h++)s=i.nameTable[c[h]],s&&s._isInternalShape&&t.datavisualization.Diagram.Util.canResize(s)&&(s=n.extend(!0,s,{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height}));t.datavisualization.Diagram.Util._updateBPMNProperties(r,i,i.nameTable,!0)}t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(r,1/l,1/a,p,i)}else r.width=e.width,r.height=e.height},_alignChildren:function(i,r){for(var o,u,s=!0,e=r.children,f=0;f<e.length;f++)u=typeof e[f]=="string"?i.nameTable[e[f]]:e[f],u&&!u._isInternalShape&&(i._disablePhaseUpdate&&u.isPhaseStack&&(s=!1),s&&(o=this._getCanvasPosition(i,u,r),this._translate(i,u,o.x,o.y))),u&&u._isInternalShape&&t.datavisualization.Diagram.Util.canResize(u)&&(u=n.extend(!0,u,{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height}),t.datavisualization.Diagram.Util._updateBPMNProperties(r,i,i.nameTable,!0))},_translate:function(n,i,r,u){var o,f,e;if(r||u)if(i.segments)t.datavisualization.Diagram.Util._translateLine(i,r,u,i);else{if(i.offsetX+=r,i.offsetY+=u,i._type==="group"||i.type==="pseudoGroup")for(o=i.children,e=0;e<o.length;e++)f=n.nameTable[n._getChild(o[e])],f&&(this._translate(n,f,r,u),n._updateQuad(f));t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(i,r,u,null,n)}},_getCanvasPosition:function(n,i,r){var e=0,o=0,u=t.datavisualization.Diagram.Util.bounds(r),f=t.datavisualization.Diagram.Util.bounds(i),s,h;switch(i.horizontalAlign){case"left":e=u.x-f.x+i.marginLeft+r.paddingLeft;break;case"center":e=u.x+u.width/2-(f.x+f.width/2)+i.marginLeft+r.paddingLeft;break;case"right":e=u.x+u.width-i.marginRight-(f.x+f.width+r.paddingRight);break;case"stretch":s=(u.width-r.paddingLeft-r.paddingRight-i.marginLeft-i.marginRight)/i.width;n.scale(i,s,0,r.pivot,n.nameTable);f=t.datavisualization.Diagram.Util.bounds(i,n);e=u.x+r.paddingLeft-f.x+i.marginLeft}switch(i.verticalAlign){case"top":o=u.y-f.y+i.marginTop+r.paddingTop;break;case"center":o=u.y+u.height/2-(f.y+f.height/2)+i.marginTop+r.paddingTop;break;case"bottom":o=u.y+u.height-i.marginBottom-(f.y+f.height+r.paddingBottom);break;case"stretch":h=(u.height-r.paddingTop-r.paddingBottom-i.marginTop-i.marginBottom)/i.height;n.scale(i,0,h,r.pivot,n.nameTable);f=t.datavisualization.Diagram.Util.bounds(i,n);o=u.y+r.paddingTop-f.y+i.marginTop}return{x:e,y:o}},_getCanvasBounds:function(n,i,r){var e=t.datavisualization.Diagram.Rectangle(),o=0,f,u,h,c,l,a,s;if(i.children&&i.children.length>0)for(s=i.children;o<s.length;o++)f=typeof s[o]=="string"?n.nameTable[s[o]]:s[o],f&&!f._isInternalShape&&(u=t.datavisualization.Diagram.Util.bounds(f),u=t.datavisualization.Diagram.Geometry.rect([u.topLeft,u.topRight,u.bottomRight,u.bottomLeft]),f.horizontalAlign==="stretch"&&(u.width=u.width>=i.minWidth?u.width:1,(i.isLane||i.isSwimlane)&&o==0&&(u.width=1)),f.verticalAlign==="stretch"&&(u.height=u.height>=i.minHeight?u.height:1,i.isLane&&o==0&&(u.height=1)),u&&(l=f.marginLeft>0?u.x-f.marginLeft:u.x,a=f.marginTop>0?u.y-f.marginTop:u.y,h=h==undefined?l:Math.min(h,l),c=c==undefined?a:Math.min(c,a),u.width+=f.marginLeft+(r?0:f.marginRight),u.height+=f.marginTop+(r?0:f.marginBottom),u.x=0,u.y=0,i.type=="bpmn"&&(f.marginLeft<0&&(u.width-=f.marginLeft),f.marginTop<0&&(u.height-=f.marginTop))),e=t.datavisualization.Diagram.Geometry.union(e,u));return i.type=="bpmn"&&t.datavisualization.Diagram.Geometry.isEmptyRect(e)?(e=t.datavisualization.Diagram.Util.bounds(i),e=t.datavisualization.Diagram.Geometry.rect([e.topLeft,e.topRight,e.bottomRight,e.bottomLeft])):(e.width+=i.paddingLeft+i.paddingRight,e.height+=i.paddingTop+i.paddingBottom,e.x=h-i.paddingLeft,e.y=c-i.paddingTop),e},_updateCollectionChange:function(n,i){var u=!1,r;n.activeTool.name==="resize"&&i.isLane&&(u=!0);this._setSize(n,i,null,u);this._alignChildren(n,i);i.parent&&(r=n.nameTable[i.parent],r&&r.container&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r))},_getSwimlane:function(n,t){var i=n.nameTable[n._getChild(t)],r,u;if(i&&i.isLane&&(r=n.nameTable[i.parent],r&&(u=n.nameTable[r.parent],u)))return n.getNode(u.name)},_laneConnectors:function(n,t,i){var r,f,t,u;if(t&&t.isLane)for(f=0;f<t.children.length;f++)if(u=n.nameTable[n._getChild(t.children[f])],u){if(u.inEdges&&u.inEdges.length>0)for(r=0;r<t.children.length;r++)n._collectionContains(u.inEdges[r],i)||i.push(u.inEdges[r]);if(u.outEdges&&u.outEdges.length>0)for(r=0;r<t.children.length;r++)n._collectionContains(u.outEdges[r],i)||i.push(u.outEdges[r])}},_connectorRelateTolaneCollection:function(n,t,i){if(t){var r,u,e,o,f;if(o=t.sourceNode?n.nameTable[t.sourceNode]:null,e=t.targetNode?n.nameTable[t.targetNode]:null,o&&o.parent&&(r=n.nameTable[o.parent]),e&&e.parent&&(u=n.nameTable[e.parent]),r&&u&&u.name===r.name)return!1;for(f=0;f<i.length;f++)if(r&&r.name===i[f]||u&&u.name===i[f])return!0}return!1},_recreateConnectorSegments:function(n,i,r,u,f){if(n&&i){var h=[],c=[],v,o,e,s,l,a;if(i=n.nameTable[n._getChild(i)],(i&&i.isLane||i.isSwimlane)&&i.isLane&&Array.isArray(r)){for(a=this._getIntermediateLanes(n,r,u,f),e=0;e<a.length;e++)s=n.nameTable[n._getChild(a[e])],this._laneConnectors(n,s,h);for(v=this._getSwimlane(n,i.name),l=v.lanes,e=0;e<l.length;e++)s=n.nameTable[n._getChild(l[e])],this._laneConnectors(n,s,c);for(e=0;e<h.length;e++)o=n.nameTable[n._getChild(h[e])],o&&this._connectorRelateTolaneCollection(n,o,[u,f])&&(o.segments=[],t.datavisualization.Diagram.Util._initializeSegments(o,"orthogonal"));for(e=0;e<c.length;e++)o=n.nameTable[n._getChild(c[e])],o&&this._updateConnectorEndPoints(n,o)}}},_isLineInterSectingNode:function(n,i,r){var f=!1,u,h,e,c,l,a,v,y,p,w,o,s;if(i&&r&&(u=t.datavisualization.Diagram.Util.bounds(r),h=[{x:u.topLeft.x,y:u.topLeft.y},{x:u.topRight.x,y:u.topRight.y},{x:u.bottomRight.x,y:u.bottomRight.y},{x:u.bottomLeft.x,y:u.bottomLeft.y},{x:u.topLeft.x,y:u.topLeft.y}]),e=i.segments,e&&e.length>0)for(c=0;!f&&c<e.length;c++)if(l=e[c],l&&l.points.length>0)for(a=l.points,o=0;!f&&o<a.length-1;o++)for(v=a[o],y=a[o+1],s=0;!f&&s<h.length-1;s++)if(p=h[s],w=h[s+1],this._isInterSecting(v.x,v.y,y.x,y.y,p.x,p.y,w.x,w.y,!0)){f=!0;break}return f},_updateConnectorEndPoints:function(n,i){var r,u,f;n&&i&&(r=!1,i.sourcePoint=t.datavisualization.Diagram.Point(),i.targetPoint=t.datavisualization.Diagram.Point(),t.datavisualization.Diagram.Util._initConnectionEnds(i,n),t.datavisualization.Diagram.Util._initializeSegments(i,"orthogonal"),n._dock(i,n.nameTable),i.sourceNode&&(u=n.nameTable[i.sourceNode]),u&&this._isLineInterSectingNode(n,i,u)&&(r=!0),i.targetNode&&(f=n.nameTable[i.targetNode]),f&&this._isLineInterSectingNode(n,i,f)&&(r=this._anySegmentOrtho(i)?!1:!0),r&&(i.segments=[],t.datavisualization.Diagram.Util._initializeSegments(i,"orthogonal"),n._dock(i,n.nameTable)),t.datavisualization.Diagram.Util._initializeSegments(i,"orthogonal"),n._dock(i,n.nameTable))},_anySegmentOrtho:function(n){var r=!1,i,t;if(n&&n.segments&&n.segments.length>0)for(t=0;t<n.segments.length;t++)if(i=n.segments[t],i&&i.type!=="orthogonal"){r=!0;break}return r},_getIntermediateLanes:function(n,t,i,r){var f=[],u;if(t){var e=t.indexOf(i),o=t.indexOf(r),s=Math.min(e,o),h=Math.max(e,o);for(u=s;u<=h;u++)f.push(t[u])}return f},_swapLane:function(i,r,u,f,e,o){var l=i.nameTable[f],w=r.slice(),s=i.tools.move,a=this._getSwimlane(i,u),y,p;if(s._undoObject=n.extend(!0,{},{name1:u,name2:f}),l){var c=t.datavisualization.Diagram.Util.bounds(l),v=r.indexOf(u),h=r.indexOf(f);r.splice(r.indexOf(u),1);h+=v>h?0:-1;h+=e?s.currentPoint.y>=c.y&&s.currentPoint.y<c.center.y?0:1:s.currentPoint.x>=c.x&&s.currentPoint.x<c.center.x?0:1;r.splice(h,0,u)}s._redoObject=n.extend(!0,{},{name1:f,name2:u});y={type:"swapLane",undoObject:jQuery.extend(!0,{},s._undoObject),redoObject:jQuery.extend(!0,{},s._redoObject),currentIndex:v,moveIndex:h,category:"internal"};p=this._getSwimlane(i,u);a&&i._comparePropertyValues(p,"lanes",{lanes:a.lanes},!0);i.addHistoryEntry(y);s._multipleUndo=!0;o&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,o,!1);i.activeTool.selectedObject&&(t.datavisualization.Diagram.canvasHelper._recreateConnectorSegments(i,i.activeTool.selectedObject.name,w,u,f),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdateLane(i,i.activeTool.selectedObject))},_updateHelper:function(n){n.activeTool.helper?(this._updateHelperXY(n,n.activeTool.helper,n.activeTool.previousPoint,n.activeTool.currentPoint),t.datavisualization.Diagram.SvgContext._updateContainerHelper(n)):this._initHelper(n)},_updateHelperXY:function(n,i,r,u){var h=u.x<r.x,c=u.y<r.y,e=n.activeTool.diffx+(u.x-r.x),o=n.activeTool.diffy+(u.y-r.y),f,l=n.activeTool.diagram._enableSnapToObject(),s;n.activeTool.diagram._enableSnapToObject(!0);f=t.datavisualization.Diagram.SnapUtil._snapPoint(n,n.activeTool.helper,h,c,t.datavisualization.Diagram.Point(e,o),u,r);n.activeTool.diagram._enableSnapToObject(l);f||(f=t.datavisualization.Diagram.Point(e,o));n.activeTool.diffx=e-f.x;n.activeTool.diffy=o-f.y;t.datavisualization.Diagram.Geometry.isEmptyPoint(f)||(s=n.activeTool._raiseDragEvent({element:n.getNode(n.activeTool.helper),offset:f,cancel:!1}),s&&!s.cancel&&(n.activeTool._outOfBoundsDrag(i,f.x,f.y)&&n._translate(i,f.x,f.y,n.nameTable),i._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(i,n)))},_initHelper:function(n){n.activeTool.helper=this._getCloneNode(n.activeTool.selectedObject);n.activeTool.helper._name=n.activeTool.selectedObject.name;n.activeTool.helper.name="helper";n.activeTool.startPoint=n.activeTool.currentPoint;t.datavisualization.Diagram.SvgContext._drawContainerHelper(n)},_getCloneNode:function(n){var t=null;return t=jQuery.extend(!0,{},n),t.children=[],t.minHeight=0,t.minWidth=0,t.maxHeight=0,t.maxWidth=0,t},_updateHighlighter:function(n,t){var i=n.activeTool._getMouseOverElement(t);i&&!i.segments&&(!n.activeTool.selectedObject.isLane||i.isLane)?n.activeTool._nodeHighLighter(i,t):n.activeTool._removeHighLighter()},_updateNodeMargin:function(i,r,u){var h,c,a,o,s;if(r._type=="group")for(h=0;h<r.children.length;h++)c=r.children[h],this._updateNodeMargin(i,typeof c=="string"?i.nameTable[c]:c,r);if(r&&u){var l=n.extend(!0,{},r),f=t.datavisualization.Diagram.Util.bounds(r),e=t.datavisualization.Diagram.Util.bounds(u),y=u.container&&u.container.type&&u.container.type=="stack"?!0:!1;y?u.container.orientation==="horizontal"?r.marginTop=f.top-e.top-u.paddingTop:r.marginLeft=f.left-e.left-u.paddingLeft:(r.marginLeft=f.left-e.left-u.paddingLeft,r.marginTop=f.top-e.top-u.paddingTop);var p=f.right-f.left,w=f.bottom-f.top,v=e.x+e.width-(f.x+p)-u.paddingRight;r.marginRight=v<0?0:v;a=e.y+e.height-(f.y+w)-u.paddingBottom;r.marginBottom=a<0?0:a;u.isLane&&(o=0,s=0,u.orientation==="horizontal"?(o=50,s=0):(o=0,s=50),r.marginLeft=r.marginLeft>=o?r.marginLeft:o,r.marginTop=r.marginTop>=s?r.marginTop:s,i._comparePropertyValues(r,"marginLeft",{marginLeft:l.marginLeft},!0),i._comparePropertyValues(r,"marginRight",{marginLeft:l.marginRight},!0),i._comparePropertyValues(r,"marginBottom",{marginLeft:l.marginBottom},!0),i._comparePropertyValues(r,"marginRight",{marginLeft:l.marginRight},!0))}},_singleNodedrag:function(i,r,u){var c=!i.activeTool._checkForDropEvent(u),f,s,h,o;if(c)if(u){if((t.datavisualization.Diagram.Util.canAllowDrop(u)||u.name==i.activeTool.selectedObject.parent)&&u.container&&u.container.type=="canvas")if(s=!u._isBpmn||u._isBpmn&&i.activeTool.selectedObject.parent!=u.name?!0:!1,t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(i,i.activeTool.helper,u)&&s)u.isLane&&this._disableConnectorUpdate(i),i.activeTool.seletedObject=i.nameTable[i.activeTool.selectedObject.name],i.activeTool.selectedObject.parent&&(f=i.nameTable[i.activeTool.selectedObject.parent]),i._disablePhaseUpdate=!0,i._disableSwimlaneUptate=!0,this._removeNodeFromContainer(i,i.activeTool.selectedObject),this._addNodeToContainer(i,i.activeTool.selectedObject,u,null,!0),i._raiseGroupChangeEvent(i.activeTool.selectedObject,f,u,"group"),i._comparePropertyValues(i.activeTool.selectedObject,"parent",{parent:f.name},!0),delete i._disablePhaseUpdate,delete i._disableSwimlaneUptate,this._updateLastSwimlanePhase(i,i.activeTool.selectedObject),u.isLane&&this._enableConnectorUpdateNode(i,i.activeTool.selectedObject);else if(u._isBpmn){var e=i.nameTable[i.activeTool.selectedObject.parent],l=e.width,a=e.height,v={x:e.offsetX,y:e.offsetY};i._translate(i.activeTool.selectedObject,i.activeTool.helper.offsetX-i.activeTool.selectedObject.offsetX,i.activeTool.helper.offsetY-i.activeTool.selectedObject.offsetY,i.nameTable);i._updateAssociatedConnectorEnds(i.activeTool.selectedObject,i.nameTable);h=t.datavisualization.Diagram.ContainerHelper.updateparent(u,i);h?(this._removeNodeFromContainer(i,i.activeTool.selectedObject),this._addNodeToContainer(i,i.activeTool.selectedObject,u,null,!0)):t.datavisualization.Diagram.bpmnHelper.updateCanvas(e,i)}else i._translate(i.activeTool.selectedObject,i.activeTool.undoObject.node.offsetX-i.activeTool.selectedObject.offsetX,i.activeTool.undoObject.node.offsetY-i.activeTool.selectedObject.offsetY,i.nameTable),i._updateAssociatedConnectorEnds(i.activeTool.selectedObject,i.nameTable),this._updateLastSwimlanePhase(i,u)}else o=n.extend(!0,{},i.activeTool.selectedObject),i.activeTool.selectedObject.type!="pseudoGroup"&&this._disableConnectorUpdate(i),i.activeTool.selectedObject.parent&&(f=i.nameTable[i.activeTool.selectedObject.parent]),this._removeNodeFromContainer(i,i.activeTool.selectedObject),i._raiseGroupChangeEvent(i.activeTool.selectedObject,f,null,"group"),this._addMultiNodeToDiagram(i,i.activeTool.selectedObject),this._enableConnectorUpdateNode(i,o),i._updateAssociatedConnectorEnds(o,i.nameTable);return!0},_updateLastSwimlanePhase:function(n,i){var r=t.datavisualization.Diagram.ContainerHelper.updateparent(i,n),u,f;r&&r.isLane&&(u=n.nameTable[r.parent],u&&(f=n.nameTable[u.parent],f&&this._updateLastPhase(n,f)))},_updateLastPhase:function(n,i){var f,r;if(i&&i.isSwimlane){var h=n.nameTable[n._getChild(i.children[2])],c=n.nameTable[n._getChild(i.children[1])],o=t.datavisualization.Diagram.stackHelper._getStackBoundsBounds(n,h),s=t.datavisualization.Diagram.stackHelper._getStackBoundsBounds(n,c),e=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),l=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,i),u;u=n.nameTable[n._getChild(l[0])];e.length>0&&(f=n.nameTable[e[e.length-1]],f&&(i.orientation==="horizontal"?(r=o.width-s.width,f.width+=r,f.offset+=r,u&&u.isLane&&(u.minWidth+=r)):(r=o.height-s.height,f.height+=r,f.offset+=r,u&&u.isLane&&(u.minHeight+=r))),t.datavisualization.Diagram.SwimLaneContainerHelper._updatePhaseStack(n,i))}},_disableConnectorUpdate:function(n){n._disableSegmentChange=!0},_enableConnectorUpdate:function(n,t,i){delete n._disableSegmentChange;t&&(n._updateChildAdjacentConnectors(t,!0),i||(n._disableSegmentChange=!0,this._updateSwimalneAssociatedConnectors(n,t,n._svg),delete n._disableSegmentChange),this._updateChildAdjacentConnectors(n,t))},_updateChildAdjacentConnectors:function(n,i){var f=n._getChildTable(i,{}),u,r;for(u in f)r=n.nameTable[u],r&&r.segments&&i.children.indexOf(u)==-1&&t.datavisualization.Diagram.DiagramContext.update(r,n)},_updateSwimalneAssociatedConnectors:function(n,i,r,u){var e=n._getChildren(i.children),o,s,f;if(e&&e.length>0)for(o=0,s=e.length;o<s;o++)f=n.nameTable[e[o]],f&&(f._type==="group"?this._updateSwimalneAssociatedConnectors(n,f,r,u):this._updateSwimalneAssociatedConnectors(n,f,r,u));i.type!="group"&&t.datavisualization.Diagram.SvgContext._updateAssociatedConnector(i,r,n)},_enableConnectorUpdateNode:function(n,t){var i=null,r;t&&t.parent&&(i=n.nameTable[t.parent]);i&&(i.isLane?(r=n.nameTable[i.parent.split("laneStack")[0]],r&&r.isSwimlane&&this._enableConnectorUpdate(n,r)):i.type=="bpmn"&&this._enableConnectorUpdate(n,i))},_enableConnectorUpdatePhase:function(n,t){if(t&&(t.isPhase||t.type==="phase")){var i=n.nameTable[t.parent.split("phaseStack")[0]];i&&i.isSwimlane&&this._enableConnectorUpdate(n,i)}},_enableConnectorUpdateLane:function(n,t){if(t&&t.isLane){var i=n.nameTable[t.parent.split("laneStack")[0]];i&&i.isSwimlane&&this._enableConnectorUpdate(n,i)}},_outOfBoundaryMultiNodeDrop:function(n,i){var r,u,e,o,f;if(t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)&&i&&i.type==="pseudoGroup")for(o=i.children,f=0;f<o.length;f++)if(r=n.nameTable[n._getChild(o[f])],u=this._getTargets(n,r),u&&u.length>0&&!r.segments&&(e=this._getContainerFromTarget(n,u,r),e&&!this._isExeedBounds(n,r,e)))return!1;return!0},_multiNodedrag:function(n,i,r){var u,e,c,l,o,s,h,f,a;if(this._outOfBoundaryMultiNodeDrop(n,r)){if(r){if(n._disableSwimlaneUptate=!0,this._disableConnectorUpdate(n),r.children.length>0)for(l=r.children,o=0;o<l.length;o++)u=n.nameTable[n._getChild(l[o])],e=this._getTargets(n,u),e&&e.length>0?(c=this._getContainerFromTarget(n,e,u),c?this._addNodeToContainer(n,u,c):this._addMultiNodeToDiagram(n,u)):this._addMultiNodeToDiagram(n,u),u.parent&&(s=n.nameTable[u.parent],s&&s.isLane&&(h=n.nameTable[s.parent.split("laneStack")[0]],h&&(n._updateSwimlanes||(n._updateSwimlanes=[]),n._collectionContains(h.name,n._updateSwimlanes)||n._updateSwimlanes.push(h.name))));if(delete n._disableSwimlaneUptate,n._updateSwimlanes&&n._updateSwimlanes.length>0)for(f=0;f<n._updateSwimlanes.length;f++)t.datavisualization.Diagram.DiagramContext.update(n.nameTable[n._updateSwimlanes[f]],n),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(n,n.nameTable[n._updateSwimlanes[f]]);else delete n._disableSegmentChange;delete n._updateSwimlanes;this._getRedoObject(n,r);a={type:"positionchanged",node:jQuery.extend(!0,{},r),undoObject:jQuery.extend(!0,{},n.activeTool._undoObject),redoObject:jQuery.extend(!0,{},n.activeTool._redoObject),category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(a);n.activeTool._multipleUndo=!0;t.datavisualization.Diagram.Util._updateGroupBounds(r,n);n.updateSelection()}}else this._updateBoundsExceedNodes(n,r,"move")},_updateBoundsExceedNodes:function(n,i,r){var h=n.tools[r].undoObject,s=i.children,e,f,u,c,o;for(i.rotateAngle=h.node.rotateAngle,e=0;e<s.length;e++)f=h.childTable[s[e]],u=n.nameTable[s[e]],f&&u&&(r==="move"?n._translate(u,f.offsetX-u.offsetX,f.offsetY-u.offsetY,n.nameTable):r==="resize"?(n._translate(u,f.offsetX-u.offsetX,f.offsetY-u.offsetY,n.nameTable),n.scale(u,f.width/u.width,f.height/u.height,t.datavisualization.Diagram.Point(u.offsetX,u.offsetY),n.nameTable)):r==="rotate"&&(n._translate(u,f.offsetX-u.offsetX,f.offsetY-u.offsetY,n.nameTable),c=f.rotateAngle-u.rotateAngle,u.rotateAngle+=c),u._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(u,n),n._updateAssociatedConnectorEnds(f,n.nameTable),f.parent&&(o=n.nameTable[f.parent],o&&o.children.length>0&&(o.children.push(f.name),u.parent=f.parent)),t.datavisualization.Diagram.DiagramContext.update(f,n));t.datavisualization.Diagram.Util._updateGroupBounds(i,n);n.updateSelection()},_getContainerFromTarget:function(n,i,r){for(var f,e,u=0;u<i.length;u++)if(i[u].container&&i[u].container.type==="canvas"&&(f=t.datavisualization.Diagram.Util.bounds(r),e=t.datavisualization.Diagram.Util.bounds(i[u]),f.center.x>e.left&&f.center.x<e.right&&f.center.y>e.top&&f.center.y<e.bottom))return i[u]},_getTargets:function(n,i){var a=null,s,u=[],h,c,f,e,o,r,l,v;if(i)for(s=t.datavisualization.Diagram.Util.bounds(i),c=t.datavisualization.Diagram.SpatialUtil.findQuads(n._spatialSearch,s),f=0;f<c.length;f++)if(e=c[f],e.objects.length>0)for(o=0;o<e.objects.length;o++)if(r=e.objects[o],!r.segments&&r.visible&&(a=t.datavisualization.Diagram.Util.bounds(r),u.indexOf(r)==-1&&t.datavisualization.Diagram.Geometry.intersectsRect(s,a)))if(r.isSwimlane){l=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,r);for(v in l)h=n.nameTable[n._getChild(l[v])],h&&u.splice(0,0,h)}else u.push(r);return u},_removeFromParentContainer:function(n,t){this._removeNodeFromContainer(n,t)},_removeNodeFromContainer:function(n,i,r){var s,h,f,o,u,e;if(n._removedFromContiner=!0,i.type!=="pseudoGroup"){if(e=n.nameTable[i.parent],e){for(f=e.children,s=f,s=s.slice(0),o=0;o<f.length;o++)u=n.nameTable[n._getChild(f[o])],u.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(e.children,f[o]);t.datavisualization.Diagram.SpatialUtil._removeFromaQuad(n._spatialSearch,n._spatialSearch.quadTable[u.name],u);h={element:e,cause:n.activeTool.inAction?t.datavisualization.Diagram.ActionType.Mouse:t.datavisualization.Diagram.ActionType.Unknown,propertyName:"children",oldValue:s,newValue:f};n._raisePropertyChange(h);n._comparePropertyValues(i,"parent",{parent:""},h.cause);i.parent="";u._type==="group"?t.datavisualization.Diagram.SvgContext.renderGroup(u,n._svg,n._diagramLayer,n.nameTable,n):u.segments?t.datavisualization.Diagram.SvgContext.renderConnector(u,n._svg,n._diagramLayer):t.datavisualization.Diagram.SvgContext.renderNode(u,n._svg,n._diagramLayer,undefined,n);r||t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,e,!0)}}else if(f=i.children,f.length>0){for(this._getUndoObject(n,i),o=0;o<f.length;o++)u=n.nameTable[f[o]],u&&this._removeNodeFromContainer(n,u,!0);u.parent&&(e=n.nameTable[u.parent]);e&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,e,!0)}},_addDrgaHistoryEntry:function(n,t){var i={},i=n._getChildTable(t,i),r;n.activeTool._multipleUndo=!0;r={type:"positionchanged",node:jQuery.extend(!0,{},t),childTable:i,category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(r)},_cloneNode:function(t,i,r){var f,e,u;if(i){if(i=n.extend(!0,{},i),i.name+=r,i.parent+=r,i.children&&i.children.length>0)for(e=i.children,u=0;u<e.length;u++)f=t.nameTable[t._getChild(e[u])],f&&(i.children[u]=this._cloneNode(t,f,r));return i}},_isExeedBounds:function(n,i,r){var s,o,f,u,e,h,c;if(n._disableUpdateQuad=!0,i&&r&&r.isLane&&(s=n.nameTable[r.parent.split("laneStack")[0]],s)){if(o=t.datavisualization.Diagram.Util.randomId(),f=n._cloneSwimlaneObj(n._getNode(s.name),o),f=t.datavisualization.Diagram.ContainerHelper._initContainer(n,f),u=this._cloneNode(n,i,o),n.nameTable[u.name]=u,e=n.nameTable[r.name+o],e){if((e.children.push(u.name),this._updateNodeMargin(n,u,n.nameTable[r.name+o]),n._disableSwimlaneUptate=!0,this._disableConnectorUpdate(n),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,e),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f),delete n._disableSegmentChange,delete n._disableSwimlaneUptate,h=t.datavisualization.Diagram.Util.bounds(f),t.datavisualization.Diagram.containerCommon._removeObject(n,e),t.datavisualization.Diagram.containerCommon._removeObject(n,f),delete n._disableUpdateQuad,c=n.activeTool._getPageBounds(),h.bottom>c.height)||h.right>c.width)return!1;e.children.pop(u.name)}n.nameTable[u.name]}return delete n._disableUpdateQuad,!0},_outOfBoundaryNodeDrop:function(n,i,r){return t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)?this._isExeedBounds(n,i,r):!0},_addNodeToContainer:function(i,r,u,f,e){var h,w,c,v,o,y,nt,tt,it,l,a,s,p;if(i.getObjectType(r)!=="connector"&&r&&u&&!r.isPhase)if(r.parent&&(h=i.nameTable[r.parent],h.container||(w=h.children,t.datavisualization.Diagram.Util.removeFromCollection(i,w,r),t.datavisualization.Diagram.Util._updateGroupBounds(h,i))),r.type!=="pseudoGroup"){var b=t.datavisualization.Diagram.Util.bounds(i.activeTool.helper),k=t.datavisualization.Diagram.Util.bounds(i.activeTool.selectedObject),d=i.activeTool.helper?b.x-k.x:0,g=i.activeTool.helper?b.y-k.y:0;i._raiseOffsetPropertyChange(r,r.offsetX+d,r.offsetY+g,!0);i._translate(r,d,g,i.activeTool.diagram.nameTable);c=u.children;c=c.slice(0);u.children.push(r.name);v={element:u,cause:i.activeTool.inAction?t.datavisualization.Diagram.ActionType.Mouse:t.datavisualization.Diagram.ActionType.Unknown,propertyName:"children",oldValue:c,newValue:u.children};i._raisePropertyChange(v);i._comparePropertyValues(r,"parent",{parent:u.name},v.cause);r.parent=u.name;this._updateNodeMargin(i,r,u);i._isDragg&&(o=i._historyList,o&&o.currentEntry&&o.currentEntry.object&&o.currentEntry.object.parent===""&&(o.currentEntry.object=n.extend(!0,{},r)));y=i._svg.getElementById(u.name);r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,y):r.segments||t.datavisualization.Diagram.DiagramContext.renderNode(r,i,y);this._disableConnectorUpdate(i);f||(u.type=="bpmn"&&(nt=n.extend(!0,{},{node:u})),tt=jQuery.extend(!0,{},u),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),this._updateAddRemoveNodeConnectors(i,u,tt),u.type=="bpmn"&&(i._isGroupActionEnabled=!0,i._startGroupAction(),it={type:"sizechanged",node:jQuery.extend(!0,{},u),undoObject:nt,redoObject:n.extend(!0,{},{node:u}),category:"internal"},i.addHistoryEntry(it)));this._updateLastSwimlanePhase(i,r);e||this._enableConnectorUpdateNode(i,r);i._findLabelEditing&&u.children.splice(u.children.indexOf(r.name),1)}else if(l=r.children,l.length>0){for(a=0;a<l.length;a++)s=i.nameTable[i._getChild(l[a])],s&&this._addNodeToContainer(i,s,u,!0);s&&s.parent&&(p=i.nameTable[s.parent]);p&&(t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,p,!0),t.datavisualization.Diagram.Util._updateGroupBounds(r,i),t.datavisualization.Diagram.SvgContext.updateSelector(r,i._adornerSvg,i._currZoom,i,i.model.selectedItems.constraints))}},_addMultiNodeToDiagram:function(n,i){var r,u,o;if(n.activeTool.helper){var f=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),e=t.datavisualization.Diagram.Util.bounds(i),s=n.activeTool.helper?f.x-e.x:0,h=n.activeTool.helper?f.y-e.y:0;n._translate(i,s,h,n.nameTable)}for(r=n.nodes(),u=r.length-1;u>=0;u--)o=n.nameTable[n._getChild(r[u])],i.name===o.name&&t.datavisualization.Diagram.Util.removeItem(r,r[u]);n.nodes().push(i);n._removedFromContiner&&(i._type==="group"?t.datavisualization.Diagram.SvgContext.renderGroup(i,n._svg,n._diagramLayer,n.nameTable,n):i.segments?t.datavisualization.Diagram.SvgContext.renderConnector(i,n._svg,n._diagramLayer):t.datavisualization.Diagram.SvgContext.renderNode(i,n._svg,n._diagramLayer,undefined,n));delete n._removedFromContiner;n.activeTool.helper&&this._updateLastSwimlanePhase(n,n.activeTool.helper)},_singleNodeResize:function(n,t,i){n.activeTool.selectedObject&&this._resizeNode(n,i)},_resizeNode:function(n,i){var r;if(i){var f=t.datavisualization.Diagram.Util.bounds(i),e=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),u=!0;i.container||(i.parent==""&&i._parent&&(i.parent=i._parent,delete i._parent,u=!1),i.segments||(i.parent&&(r=n.nameTable[i.parent]),r&&r.isLane&&this._disableConnectorUpdate(n),u&&n.activeTool._updateSize(i,n.activeTool.startPoint,n.activeTool.currentPoint),r&&(this._updateNodeMargin(n,i,r),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0),this._updateLastSwimlanePhase(n,i)),this._enableConnectorUpdateNode(n,i)))}},_updateResizeHelper:function(n){var i,r;n.activeTool.helper?(i=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),n._resizeStack=!0,n.activeTool._updateSize(n.activeTool.helper,n.activeTool.previousPoint,n.activeTool.currentPoint,null,null,null,!0),delete n._resizeStack,r=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),n.activeTool.selectedObject.container&&!n.activeTool.helper._isBpmn&&n._translate(n.activeTool.helper,i.topLeft.x-r.topLeft.x,i.topLeft.y-r.topLeft.y,n.nameTable),t.datavisualization.Diagram.SvgContext._updateContainerHelper(n)):(n.activeTool.helper=n.activeTool._getCloneNode(n.activeTool.selectedObject),n.activeTool.helper.inEdges=n.activeTool.helper.outEdges=[],n.activeTool.helper.type=null,n.activeTool.helper.name="helper",t.datavisualization.Diagram.SvgContext._drawContainerHelper(n),n.activeTool._startPoint=n.activeTool.currentPoint,n._resizeStack=!0,n.activeTool._updateSize(n.activeTool.helper,n.activeTool.previousPoint,n.activeTool.currentPoint,null,null,null,!0),delete n._resizeStack)},_multiNodeResize:function(n,i,r){var u,f,o,s,e,h;if(r)if(this._outOfBoundaryMultiNodeDrop(n,r)){if(r.children.length>0)for(s=r.children,e=0;e<s.length;e++)u=n.nameTable[n._getChild(s[e])],f=this._getTargets(n,u),f&&f.length>0?(o=this._getContainerFromTarget(n,f,u),o?this._addNodeToContainer(n,u,o):this._addMultiNodeToDiagram(n,u)):this._addMultiNodeToDiagram(n,u);this._getRedoObject(n,r);h={type:"sizechanged",node:jQuery.extend(!0,{},r),undoObject:jQuery.extend(!0,{},n.activeTool._undoObject),redoObject:jQuery.extend(!0,{},n.activeTool._redoObject),category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(h);n.activeTool._multipleUndo=!0;t.datavisualization.Diagram.Util._updateGroupBounds(r,n);n.updateSelection()}else this._updateBoundsExceedNodes(n,r,"resize")},_singleNodeRotate:function(n,t,i){n.activeTool.selectedObject&&this._rotateNode(n,i)},_rotateNode:function(n,i){var u,r,e,f;i&&(u=!0,i.container||(i.parent==""&&i._parent&&(i.parent=i._parent,delete i._parent,u=!1),i.parent&&(r=n.nameTable[i.parent]),r&&r.isLane&&this._disableConnectorUpdate(n),i.segments||(u&&(e=n.nameTable[n.activeTool.selectedObject.name],n.activeTool.helper&&(f=n.activeTool.helper.rotateAngle-n.nameTable[n.activeTool.selectedObject.name].rotateAngle,n._comparePropertyValues(i,"rotateAngle",{rotateAngle:n.activeTool.helper.rotateAngle},!0),n._rotate(n.activeTool.selectedObject,f,n.nameTable))),r&&(this._updateNodeMargin(n,i,r),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0),this._updateLastSwimlanePhase(n,i)),this._enableConnectorUpdateNode(n,i))))},_multiNodeRotate:function(n,i,r){var u,f,o,s,e,h;if(r)if(this._outOfBoundaryMultiNodeDrop(n,r)){if(r.children.length>0)for(s=r.children,e=0;e<s.length;e++)u=n.nameTable[n._getChild(s[e])],f=this._getTargets(n,u),f&&f.length>0?(o=this._getContainerFromTarget(n,f,u),o?this._addNodeToContainer(n,u,o):this._addMultiNodeToDiagram(n,u)):this._addMultiNodeToDiagram(n,u);this._getRedoObject(n,r);h={type:"rotationchanged",node:jQuery.extend(!0,{},r),undoObject:jQuery.extend(!0,{},n.activeTool._undoObject),redoObject:jQuery.extend(!0,{},n.activeTool._redoObject),category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(h);n.activeTool._multipleUndo=!0;t.datavisualization.Diagram.Util._updateGroupBounds(r,n);n.updateSelection()}else this._updateBoundsExceedNodes(n,r,"rotate")},_updateDropLaneProperties:function(n,i,r){if(i&&r){i.orientation=r.orientation;i.horizontalAlign=r.orientation==="horizontal"?"stretch":"left";i.verticalAlign=r.orientation==="vertical"?"stretch":"top";i.paddingBottom=20;i.paddingTop=20;i.paddingLeft=20;i.paddingRight=20;var u=n.nameTable[i.children[0]];u&&(u.marginLeft=-20,u.marginTop=-20,u.marginRight=-20,u.marginBottom=-20,u.constraints=t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,u._isHeader=!0)}return i},_updateAddRemoveNodeConnectors:function(n,t,i){if(t&&t.isLane&&i&&i.isLane){var r=0,u=0;r=t.width-i.width;u=t.height-i.height;(r||u)&&this._updateOverlappedConnectorSegment(n,i,r,u)}},_updateAddRemoveLaneConnectors:function(n,t){if(t&&t.isLane){var r=[],u,e,f,i,t;for(e=this._getSwimlane(n,t.name),f=e.lanes,i=0;i<f.length;i++)t=n.nameTable[n._getChild(f[i])],this._laneConnectors(n,t,r);for(i=0;i<r.length;i++)u=n.nameTable[n._getChild(r[i])],u&&this._updateConnectorEndPoints(n,u)}},_outOfBoundaryAddLane:function(i,r,u,f){var e,o,s,h,c;return t.datavisualization.Diagram.Util.canMoveOutofBoundary(i)&&((e=i._cloneSwimlaneObj(i._getNode(r.name),t.datavisualization.Diagram.Util.randomId()),e=t.datavisualization.Diagram.ContainerHelper._initContainer(i,e),o=i.activeTool._cloneGroupNode(n.extend(!0,{},u),t.datavisualization.Diagram.Util.randomId()),i.nameTable[o.name]=o,s=i.nameTable[i._getChild(e.children[2])],f||f===0?s.children.splice(f,0,o.name):s.children.push(o.name),o.parent=s.name,i._disableSwimlaneUptate=!0,this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,o),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,e),this._enableConnectorUpdate(i,e),delete i._disableSwimlaneUptate,h=t.datavisualization.Diagram.Util.bounds(e),t.datavisualization.Diagram.containerCommon._removeObject(i,o),t.datavisualization.Diagram.containerCommon._removeObject(i,e),c=i.activeTool._getPageBounds(),h.bottom>c.height)||h.right>c.width)?!1:!0},_addNewLane:function(n,i,r,u,f){var l,o,e,a,c,f,s,h,v,y;if(n.activeTool._removeHelpers(),o=n.nameTable[n._getChild(r.children[2])],o){if(e=n.activeTool._cloneGroupNode(n.activeTool.selectedObject,u?"":t.datavisualization.Diagram.Util.randomId()),e=this._updateDropLaneProperties(n,e,r),a=n._isUndo,n._isUndo=!0,n.activeTool.selectedObject=null,n.remove(n.activeTool.selectedObject),n._isUndo=a,n._isUndo||this._outOfBoundaryAddLane(n,r,e,f)){if(c={element:n.getNode(e),cancel:!1,target:i},i&&(f=f!==undefined?f:n.activeTool._getSwimLaneStackIndex(i)),f||f===0?o.children.splice(f,0,e.name):o.children.push(e.name),e.parent=o.name,n._raiseDropEvent(c),n.remove(e),!c.cancel){if(n.activeTool._isLane=!0,e.isLane&&(s=n.nameTable[n._getChild(e.children[0])],s&&e.labels&&s.labels.length>0))for(h=0;h<s.labels.length;h++)s.labels[h].visible=!0;n._isUndo||(v=n._getChildTable(e,{}),y={type:"collectionchanged",object:jQuery.extend(!0,{},e),childTable:jQuery.extend(!0,{},v),index:f,changeType:"insert",category:"internal"},n.addHistoryEntry(y));n.add(e)&&n._updateDroppedSymbol(e)}this._disableConnectorUpdate(n);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,o);this._updateAddRemoveLaneConnectors(n,e);t.datavisualization.Diagram.canvasHelper._updateLastPhase(n,r);this._enableConnectorUpdateLane(n,e);l=!0}n._clearSelection(!0);l&&n._addSelection(r,!0);n.activeTool.selectedObject=null}},_outOfBoundsOnLaneResize:function(n,i,r){var e,o,u,f,s,h;return t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)&&(e=r?n.nameTable[i.parent.split("laneStack")[0]]:i,o=t.datavisualization.Diagram.Util.randomId(),e&&((u=n._cloneSwimlaneObj(n._getNode(e.name),o),u=t.datavisualization.Diagram.ContainerHelper._initContainer(n,u),r?(f=n.nameTable[i.name+o],f&&(f.minWidth=n.activeTool.helper.width,f.minHeight=n.activeTool.helper.height)):(u.minWidth=n.activeTool.helper.width,u.minHeight=n.activeTool.helper.height),n._disableSwimlaneUptate=!0,this._disableConnectorUpdate(n),r&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,u),this._enableConnectorUpdateLane(n,u),delete n._disableSwimlaneUptate,s=t.datavisualization.Diagram.Util.bounds(u),t.datavisualization.Diagram.containerCommon._removeObject(n,u),h=n.activeTool._getPageBounds(),s.bottom>h.height)||s.right>h.width))?!1:!0},_getLaneIndex:function(n,t){for(var r=n.lanes,i=0;i<r.length;i++)if(t.name===r[i].name)return i;return null},_isCanAddNodeToSegmentUpdate:function(n,t,i){if(i)if(i&&i.parent){var r=n.nameTable[i.parent],u,f;if(r&&r.isLane){if(u=this._getSwimlane(n,r.name),f=this._getLaneIndex(u,r),f>t)return!0}else return!1}else return!1;return!1},_getUpdateConnectorByEdges:function(n,t,i,r){t&&(this._getUpdateSegmentConnectors(n,t,i,r,t.inEdges),this._getUpdateSegmentConnectors(n,t,i,r,t.outEdges))},_getUpdateSegmentConnectors:function(n,t,i,r,u){var f,o,s,e;if(u&&u.length>0)for(e=0;e<u.length;e++)f=n.nameTable[u[e]],f.sourceNode&&(o=n.nameTable[f.sourceNode]),f.targetNode&&(s=n.nameTable[f.targetNode]),o&&s&&this._isCanAddNodeToSegmentUpdate(n,i,o)&&this._isCanAddNodeToSegmentUpdate(n,i,s)&&!n._collectionContains(f.name,r)&&r.push(f)},_updateConnectorSegments:function(n,i,r,u){var l=this._getSwimlane(n,i.name),o,e,h,f,c,s;if(o=this._getLaneIndex(l,i),o!=null)for(e=[],h=l.lanes,f=o+1;f<h.length;f++)for(c=h[f].children,s=0;s<c.length;s++)this._getUpdateConnectorByEdges(n,c[s],o,e);if(e&&e.length>0&&r!=null&&u!=null)for(f=0;f<e.length;f++)t.datavisualization.Diagram.Util._translateLine(e[f],r,u,e[f])},_resizeLane:function(i,r){var u=i.nameTable[r.name],a=!0,v,c,l,y,p,h,e,f,s;if(u)if(u.isLane||u._isBpmn){if(this._outOfBoundsOnLaneResize(i,u,!0)){if(u.type=="bpmn"&&u.container){var o=i.activeTool.helper,w=o.width/r.width,b=o.height/r.height,k={x:r.offsetX,y:r.offsetY};i._raiseSizePropertyChange(r,o.width/r.width,o.height/r.height,!0);i.activeTool._undoObject=n.extend(!0,{},{node:u});u=n.extend(!0,u,{width:o.width,height:o.height,offsetX:o.offsetX,offsetY:o.offsetY,minWidth:o.width,minHeight:o.height});u.parent?(v=t.datavisualization.Diagram.ContainerHelper.updateparent(u,i),v?(u.minWidth=i.activeTool.helper.width,u.minHeight=i.activeTool.helper.height,t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),this._updateLastSwimlanePhase(i,u)):t.datavisualization.Diagram.bpmnHelper.updateCanvas(u,i)):t.datavisualization.Diagram.bpmnHelper.updateCanvas(u,i);t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(u,1/w,1/b,k,i);i.activeTool._redoObject=n.extend(!0,{},{node:u})}else u.container&&(i._raiseSizePropertyChange(r,i.activeTool.helper.width/r.width,i.activeTool.helper.height/r.height,!0),i.activeTool._undoObject=n.extend(!0,{},{node:u}),i._comparePropertyValues(r,"minWidth",{minWidth:i.activeTool.helper.width},!0),i._comparePropertyValues(r,"offsetX",{offsetX:r.offsetX+i.activeTool.helper.width/2},!0),u.minWidth=i.activeTool.helper.width<=100?100:i.activeTool.helper.width,i._comparePropertyValues(r,"minHeight",{minHeight:i.activeTool.helper.height},!0),i._comparePropertyValues(r,"offsetY",{offsetY:r.offsetY+i.activeTool.helper.height/2},!0),u.minHeight=i.activeTool.helper.height<=100?100:i.activeTool.helper.height,i.activeTool._redoObject=n.extend(!0,{},{node:u}));s={type:"sizechanged",node:jQuery.extend(!0,{},u),undoObject:jQuery.extend(!0,{},i.activeTool._undoObject),redoObject:jQuery.extend(!0,{},i.activeTool._redoObject),category:"internal"};i.addHistoryEntry(s);i.activeTool._multipleUndo=!0;u.isLane&&(this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),c=u.width-i.activeTool._undoObject.node.width,l=u.height-i.activeTool._undoObject.node.height,y=i._preventDocking,p=i._disableSegmentChange,delete i._preventDocking,delete i._disableSegmentChange,this._updateOverlappedConnectorSegment(i,i.activeTool._undoObject.node,c,l),i._preventDocking=y,i._disableSegmentChange=p,this._updateConnectorSegments(i,u,c,l),this._enableConnectorUpdateLane(i,u))}}else u.isSwimlane?(h=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(i,u),h.length>0&&(f=i.nameTable[h[h.length-1]],f&&(i.activeTool._undoObject=n.extend(!0,{},{node:f}),i._raiseSizePropertyChange(u,i.activeTool.helper.width/u.width,i.activeTool.helper.height/u.height,!0),u.orientation==="vertical"?(e=f.width+i.activeTool.helper.width-u.width,i._comparePropertyValues(f,"minWidth",{minWidth:e},!0),i._comparePropertyValues(f,"offsetX",{offsetX:r.offsetX+e/2},!0),f.minWidth=e<=100?100:e):(e=f.height+i.activeTool.helper.height-u.height,e==f.minHeight?a=!1:(i._comparePropertyValues(f,"minHeight",{minHeight:e},!0),i._comparePropertyValues(f,"offsetY",{offsetY:r.offsetY+e/2},!0),f.minHeight=e<=100?100:e)),a&&(this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0),this._enableConnectorUpdateLane(i,u),i.activeTool._redoObject=n.extend(!0,{},{node:f}),s={type:"sizechanged",node:jQuery.extend(!0,{},u),undoObject:jQuery.extend(!0,{},i.activeTool._undoObject),redoObject:jQuery.extend(!0,{},i.activeTool._redoObject),category:"internal"},i.addHistoryEntry(s),i.activeTool._multipleUndo=!0,this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),this._enableConnectorUpdateLane(i,u))))):u.container&&(u.minWidth=i.activeTool.helper.width,u.minHeight=i.activeTool.helper.height,t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0))},_updateOverlappedConnectorSegment:function(n,i,r,u){var y,p,w,l,e,o,a,s,f,v,h,c,b;if(i&&(r!=undefined&&u!=undefined&&(h=this._overLappedConnectros(n,i)),h&&h.length>0))for(c=t.datavisualization.Diagram.Util.bounds(i),i.orientation==="horizontal"?(y=c.bottomLeft,p=c.bottomRight):(y=c.topRight,p=c.bottomRight),w=[],l=0;l<h.length;l++)if(e=this._lineSegmentsIntersect(n,i,h[l],{start:y,end:p}),e&&e.length>0)for(o=0;o<e.length;o++)a=Object.keys(e[o])[0],s=e[o][a].index,b=e[o][a].point,f=n.nameTable[n._getChild(a)],f&&f.segments&&f.segments.length>0&&(i.orientation==="horizontal"?(f.segments[s]&&(v=f.segments[s].length),v&&(f.segments[s].length+=u)):(v=f.segments[s].length,v&&(f.segments[s].length+=r)),this._updateConnectorEndPoints(n,f))},_lineSegmentsIntersect:function(n,t,i,r){var c,l,y,p,o,u,f,e,s,w,b,k,d,a,v,g,h;if(c=r.start.x,l=r.start.y,y=r.end.x,p=r.end.y,v=[],g=t&&t.orientation?t.orientation:"horizontal",i=n.nameTable[n._getChild(i)],i&&i.segments&&i.segments.length>0&&i.segments.length!==1)for(o=0;o<i.segments.length;o++)if(u=i.segments[o],u&&u.points.length>0)for(f=0;f<u.points.length-1;f++)e=u.points[f],s=u.points[f+1],e&&s&&(w=e.x,b=e.y,k=s.x,d=s.y,this._isInterSecting(c,l,y,p,w,b,k,d)&&(a={},h=f,g==="horizontal"?e.y>l&&(h=-1):e.x>c&&(h=-1),a[i.name]={index:o,point:h},v.push(a)));return v},_isInterSecting:function(n,t,i,r,u,f,e,o,s){var l=i-n,a=r-t,v=e-u,y=o-f,h=(-a*(n-u)+l*(t-f))/(-v*a+l*y),c=(+v*(t-f)-y*(n-u))/(-v*a+l*y);return s?h>0&&h<1&&c>0&&c<1:h>=0&&h<=1&&c>=0&&c<=1},_overLappedConnectros:function(n,t){var f=this._getSwimlane(n,t.name),o,i,e,r,u;if(f&&f.isSwimlane&&(o=this._getLaneIndex(f,t),i=n.nameTable[t.parent],e=[],i&&i.isLaneStack&&i&&i.children.length>0))for(r=o;r>=0;r--)u=n.nameTable[n._getChild(i.children[r])],u&&u.isLane&&this._laneConnectors(n,u,e);return e},_getUndoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._undoObject=n.extend(!0,{},{node:i,childTable:r})},_getRedoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._redoObject=n.extend(!0,{},{node:i,childTable:r})},_undoRemoveNodeFromContainer:function(n,i){var r,f,e,u;if(i.type!=="pseudoGroup"&&(r=n.nameTable[i.parent],r)){for(i.parent="",f=r.children,u=0;u<f.length;u++)e=n.nameTable[n._getChild(f[u])],e&&e.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(r.children,f[u]);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0)}},_undoAddNodeToContainer:function(i,r,u){if(r.type!=="pseudoGroup"){var f=i.nameTable[u.parent],e;i._translate(r,u.offsetX-r.offsetX,u.offsetY-r.offsetY,i.nameTable);f&&(r.parent=f.name,f.children.push(r.name),e=i._svg.getElementById(f.name),f._isBpmn?(t.datavisualization.Diagram.bpmnHelper.resetNodeMargin(r,f,i),r=n.extend(!0,r,{marginLeft:u.marginLeft,marginRight:u.marginRight,marginTop:u.marginTop,marginBottom:u.marginBottom})):this._updateNodeMargin(i,r,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0));r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):r.segments?t.datavisualization.Diagram.DiagramContext.renderConnector(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e)}},_undoDragNode:function(t,i,r,u){if(r=n.extend(!0,{},r),i&&r&&i.type!=="pseudoGroup"){var e=n.extend(!0,{},r),f=n.extend(!0,{},i);u||(this._disableConnectorUpdate(t),t._disableSwimlaneUptate=!0);this._undoRemoveNodeFromContainer(t,i);this._undoAddNodeToContainer(t,i,r);u||delete t._disableSwimlaneUptate;t._clearSelection(!0);t._addSelection(i,!0);this._updateLastSwimlanePhase(t,i);u||(f.parent?this._enableConnectorUpdateNode(t,f):this._enableConnectorUpdateNode(t,e))}},_undoMultiDragNode:function(i,r){var u=n.extend(!0,{},r.node),s,a,h,f,e,c,l,o;if(u&&u.type==="pseudoGroup"){for(a=u.children,i._disableSwimlaneUptate=!0,h=0;h<a.length;h++)this._disableConnectorUpdate(i),f=i.nameTable[i._getChild(a[h])],e=f.parent,s=r.undo&&f?r.undoObject.childTable?r.undoObject.childTable[f.name]:null:r.redoObject.childTable?r.redoObject.childTable[f.name]:null,this._undoDragNode(i,f,s,!0),e||s.parent&&(e=s.parent),e?(c=i.nameTable[e],c&&c.isLane&&(l=i.nameTable[c.parent.split("laneStack")[0]],l&&(i._updateSwimlanes||(i._updateSwimlanes=[]),i._collectionContains(l.name,i._updateSwimlanes)||i._updateSwimlanes.push(l.name)))):(delete i._disableSegmentChange,this._updateAssociatedConnectorEnds(i,f,i.nameTable)),delete i._disableSegmentChange,this._updateAssociatedConnectorEnds(i,f,i.nameTable);if(delete i._disableSwimlaneUptate,i._updateSwimlanes&&i._updateSwimlanes.length>0)for(o=0;o<i._updateSwimlanes.length;o++)t.datavisualization.Diagram.DiagramContext.update(i.nameTable[i._updateSwimlanes[o]],i),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(i,i.nameTable[i._updateSwimlanes[o]]);delete i._updateSwimlanes;i._clearSelection(!0);t.datavisualization.Diagram.Util._updateGroupBounds(u,i);i._addSelection(u,!0);delete i.nameTable[u.name];i.nameTable[u.name]=u}},_updateAssociatedConnectorEnds:function(n,i,r){var f,o,u,c,e,h,s;if(n.getObjectType(i)!=="connector"&&(i.inEdges.length||i.outEdges.length)){for(c=n._isNodeToNodeConnection(i),e=i,i.type=="bpmn"&&i._type=="group"&&(e=typeof i.children[0]=="object"?i.children[0]:n.nameTable[i.children[0]]),c&&(h=t.datavisualization.Diagram.Util._findSegmentPoints(e)),s={},n._parentNode&&(s=n._getChildTable(n._parentNode,{})),f=0,o=i.inEdges.length;f<o;f++)u=r[i.inEdges[f]],!u||n._parentNode&&s[u.sourceNode]||(u.targetPadding?delete e._segmentPoints:e._segmentPoints=h,n._dock(u,r),t.datavisualization.Diagram.DiagramContext.update(u,n));for(f=0,o=i.outEdges.length;f<o;f++)u=r[i.outEdges[f]],!u||n._parentNode&&s[u.targetNode]||(u.sourcePadding?delete e._segmentPoints:e._segmentPoints=h,n._dock(u,r));delete e._segmentPoints}},_undoRemoveResizeNodeFromContainer:function(n,i){var r,f,e,u;if(i.type!=="pseudoGroup"&&(r=n.nameTable[i.parent],r)){for(i.parent="",f=r.children,u=0;u<f.length;u++)e=n.nameTable[n._getChild(f[u])],e&&e.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(r.children,f[u]);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0)}},_undoAddResizeNodeToContainer:function(i,r,u){if(r.type!=="pseudoGroup"){var f=i.nameTable[u.parent],e;r.segments||(i._translate(r,u.offsetX-r.offsetX,u.offsetY-r.offsetY,i.nameTable),i.scale(r,u.width/r.width,u.height/r.height,t.datavisualization.Diagram.Point(r.offsetX,r.offsetY),i.nameTable),r._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(r,i),r.container&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,r,!0));f&&(r.parent=f.name,f.children.push(r.name),e=i._svg.getElementById(f.name),f._isBpmn?(t.datavisualization.Diagram.bpmnHelper.resetNodeMargin(r,f,i),r=n.extend(!0,r,{marginLeft:u.marginLeft,marginRight:u.marginRight,marginTop:u.marginTop,marginBottom:u.marginBottom})):this._updateNodeMargin(i,r,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0));r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):r.segments?t.datavisualization.Diagram.DiagramContext.renderConnector(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e)}},_undoResizeNode:function(t,i,r,u){r=n.extend(!0,{},r);i&&r&&i.type!=="pseudoGroup"&&(u||this._disableConnectorUpdate(t),this._undoRemoveResizeNodeFromContainer(t,i),this._undoAddResizeNodeToContainer(t,i,r),t._clearSelection(!0),t._addSelection(i,!0),this._updateLastSwimlanePhase(t,i),u||this._enableConnectorUpdateNode(t,i))},_undoMultiResizeNode:function(i,r){var u=n.extend(!0,{},r.node),s,o,e,f;if(u&&u.type==="pseudoGroup"){for(o=u.children,e=0;e<o.length;e++)f=i.nameTable[i._getChild(o[e])],s=r.undo&&f?r.undoObject.childTable?r.undoObject.childTable[f.name]:null:r.redoObject.childTable?r.redoObject.childTable[f.name]:null,this._undoResizeNode(i,f,s);i._clearSelection(!0);t.datavisualization.Diagram.Util._updateGroupBounds(u,i);i._addSelection(u,!0);delete i.nameTable[u.name];i.nameTable[u.name]=u}},_undoResizeLane:function(i,r,u){var f=i.nameTable[r.name],o,e,s,h,c,l;f&&(u&&u.node&&u.node.isSwimlane?(o=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(i,u.node),o.length>0&&(e=i.nameTable[o[o.length-1]],e&&(r=u.undo?u.undoObject&&u.undoObject.node?u.undoObject.node:e:u.undoObject&&u.redoObject.node?u.redoObject.node:e,i._comparePropertyValues(e,"minWidth",{minWidth:r.minWidth}),e.minWidth=r.minWidth,i._comparePropertyValues(e,"minHeight",{minHeight:r.minHeight}),e.minHeight=r.minHeight,this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0),this._enableConnectorUpdateLane(i,f)))):f.isLane&&(f.container&&(i.activeTool._undonode=n.extend(!0,{},{node:f}),i._comparePropertyValues(f,"minWidth",{minWidth:r.minWidth}),f.minWidth=r.minWidth,i._comparePropertyValues(f,"minHeight",{minHeight:r.minHeight}),f.minHeight=r.minHeight),this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0),s=f.width-i.activeTool._undonode.node.width,h=f.height-i.activeTool._undonode.node.height,c=i._preventDocking,l=i._disableSegmentChange,delete i._preventDocking,delete i._disableSegmentChange,this._updateOverlappedConnectorSegment(i,i.activeTool._undonode.node,s,h),i._preventDocking=c,i._disableSegmentChange=l,this._updateConnectorSegments(i,f,s,h),this._enableConnectorUpdateLane(i,f)))},_undoRemoveRotateNodeFromContainer:function(n,i){var r,f,e,u;if(i.type!=="pseudoGroup"&&(r=n.nameTable[i.parent],r)){for(i.parent="",f=r.children,u=0;u<f.length;u++)e=n.nameTable[n._getChild(f[u])],e&&e.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(r.children,f[u]);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0)}},_undoAddRotateNodeToContainer:function(i,r,u){var f,e,o;r.type!=="pseudoGroup"&&(f=i.nameTable[u.parent],r.segments||(o=u.rotateAngle-r.rotateAngle,i._rotate(r,o,i.nameTable)),f&&(r.parent=f.name,f.children.push(r.name),e=i._svg.getElementById(f.name),f._isBpmn?(t.datavisualization.Diagram.bpmnHelper.resetNodeMargin(r,f,i),r=n.extend(!0,r,{marginLeft:u.marginLeft,marginRight:u.marginRight,marginTop:u.marginTop,marginBottom:u.marginBottom})):this._updateNodeMargin(i,r,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0)),r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):r.segments?t.datavisualization.Diagram.DiagramContext.renderConnector(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e))},_undoRotateNode:function(t,i,r,u){r=n.extend(!0,{},r);i&&r&&i.type!=="pseudoGroup"&&(u||this._disableConnectorUpdate(t),this._undoRemoveRotateNodeFromContainer(t,i),this._undoAddRotateNodeToContainer(t,i,r),t._clearSelection(!0),t._addSelection(i,!0),this._updateLastSwimlanePhase(t,i),u||this._enableConnectorUpdateNode(t,i))},_undoMultiRotateNode:function(i,r){var u=n.extend(!0,{},r.node),o,s,e,f;if(u&&u.type==="pseudoGroup"){for(s=u.children,e=0;e<s.length;e++)f=i.nameTable[i._getChild(s[e])],o=r.undo&&f?r.undoObject.childTable?r.undoObject.childTable[f.name]:null:r.redoObject.childTable?r.redoObject.childTable[f.name]:null,this._undoRotateNode(i,f,o,!0);i._clearSelection(!0);u.rotateAngle=o.rotateAngle;t.datavisualization.Diagram.Util._updateGroupBounds(u,i);i._addSelection(u,!0);delete i.nameTable[u.name];i.nameTable[u.name]=u}},_undoSwap:function(n,i){var r,e,o,s;n.activeTool._removeHelpers();n._clearSelection(!0);var h=i.undo?i.insertIndex:i.moveIndex,u=n.nameTable[i.undoObject.name1],f=u&&u.parent?n.nameTable[u.parent]:null;f&&f.children.length>0&&(r=f.children);e=r.slice();o=this._getSwimlane(n,r[0]);r&&r.length>0&&(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(n),this._undoSwapLane(n,r,h,u,null),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f,!1),t.datavisualization.Diagram.canvasHelper._recreateConnectorSegments(n,u.name,e,i.undoObject.name2,i.undoObject.name1),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdateLane(n,u));s=this._getSwimlane(n,r[0]);n._comparePropertyValues(s,"lanes",{lanes:o.lanes})},_undoSwapLane:function(n,t,i,r){t&&t.length>0&&(t.splice(t.indexOf(r.name),1),t.splice(i,0,r.name))}};t.datavisualization.Diagram.containerCommon={_initGroupNode:function(n,i){var r=null,u;for(i=n._getNewGroup(i),u=0;u<i.children.length;u++)r=i.children[u],r&&typeof r=="object"&&(typeof r.shape!="object"&&(r=t.datavisualization.Diagram.NodeType(r,n)),r._type=="group"||r.children||r.segments||r.type=="connector"?r.segments||r.type=="connector"?(r=n._getNewConnector(r),r.name==""&&(r.name=t.datavisualization.Diagram.Util.randomId())):(r=n._getNewGroup(r),r.name==""&&(r.name=t.datavisualization.Diagram.Util.randomId()),r=this._initGroupNode(n,r)):(i.type!="bpmn"&&(r=n._getNewNode(r)),r.name==""&&(r.name=t.datavisualization.Diagram.Util.randomId()),r._type=="node"&&r.labels.length&&(r.width==0||r.height==0)&&n._getNodeDimension(r)),i.children[u]=r,r.parent=i.name);return i},_initChildren:function(n,i){var u,r,f;if(i.children&&i.children.length>0)for(u=i.children,r=0;r<u.length;r++)f=typeof u[r]=="string"?n.nameTable[u[r]]:u[r],f&&(f._isInternalShape||(i.container&&(f.type==="bpmn"?n._translate(f,0-f.offsetX,0-f.offsetY,n.nameTable):f.offsetX=0,f.offsetY=0),f.container?u[r]=t.datavisualization.Diagram.ContainerHelper._initContainer(n,f):f.children?(u[r]=t.datavisualization.Diagram.Group(f),u[r]=this._initGroupNode(n,u[r]),u[r]=n._getNewGroup(u[r]),u[r]=this._initChildren(n,u[r]),this._updateGroupBounds(n,u[r])):f.segments?(u[r]=t.datavisualization.Diagram.Connector(f),u[r]=n._getNewConnector(f)):(u[r]=t.datavisualization.Diagram.NodeType(f,n),u[r]=n._getNewNode(f))),n.nameTable[u[r].name]=u[r],i.children[r]=u[r].name,n._spatialSearch&&n._updateQuad(n.nameTable[i.children[r]]));return i},_getChildrenBounds:function(n,i){var u=i.children,f,e=t.datavisualization.Diagram.Rectangle(),r,o,s;for(u.length>0&&(r=n.nameTable[n._getChild(u[0])],r&&(e=t.datavisualization.Diagram.Util._rotateChildBounds(r,i,n))),o=0,s=u.length;o<s;o++)r=n.nameTable[n._getChild(u[o])],r&&(r._type==="group"?(t.datavisualization.Diagram.Util._updateGroupBounds(r,n),f=t.datavisualization.Diagram.Util._rotateChildBounds(r,i,n)):f=t.datavisualization.Diagram.Util._rotateChildBounds(r,i,n)),f&&(e=t.datavisualization.Diagram.Geometry.union(e,f));return e},_updateGroupBounds:function(n,i,r){var o,s,h,c,e;if(i&&!i.container&&i&&(i.type==="pseudoGroup"||i.children&&i.children.length>0)){o=i.width;s=i.height;h=i.offsetX;c=i.offsetY;r&&t.datavisualization.Diagram.Util._updateRotateAngle(i,n.nameTable);var u=this._getChildrenBounds(n,i),l=u.x+u.width*i.pivot.x,a=u.y+u.height*i.pivot.y,f={x:l,y:a};i.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,i.rotateAngle),f=t.Matrix.transform(e,f));u&&(i.offsetX=f.x,i.offsetY=f.y,i.width=u.width,i.height=u.height)}},_cloneObject:function(t,i,r){var u,f;if(i){if(u=n.extend(!0,{},i),u.children&&u.children.length>0)for(f=0;f<u.children.length;f++)u.children[f]=this._cloneObject(t,u.children[f],r);u.name+=r}return u},_removeObject:function(n,t){var i;if(t){if(typeof t=="string"&&(t=n.nameTable[t]),t&&t.children&&t.children.length>0)for(i=0;i<t.children.length;i++)this._removeObject(n,t.children[i]);t&&delete n.nameTable[t.name]}}}}(jQuery,Syncfusion),function(n,t){"use strict";t.widget("ejOverview","ej.datavisualization.Overview",{element:null,validTags:["div"],model:null,defaults:{sourceID:"",width:null,height:null},_canvas:null,_actionName:"",_startPoint:null,_currentPoint:null,_prevPoint:null,_helper:null,_viewPortRatio:1,_resizeDirection:"",_inAction:!1,_init:function(){t.browserInfo().name==="msie"&&Number(t.browserInfo().version)<9||(this._wireEvents(),this._renderCanvas(),this._setParent(this.model.sourceID))},_renderCanvas:function(){var t=n("#"+this.element[0].id+"_canvas")[0];t||(t=document.createElement("div"),this.element.append(t));t.setAttribute("id",this.element[0].id+"_canvas");t.setAttribute("class","drawing");t.setAttribute("style","position:relative; height:"+this.model.height+"; width:"+this.model.width+";style:-ms-touch-action: none;touch-action: none;");this.element[0].setAttribute("tabindex",0);this.element.css({overflow:"hidden",outline:"none",display:"block",height:this.model.height,width:this.model.width});this._canvas=t},_renderDocument:function(i){var o,r,h,c;if(i.canvas=this._canvas,window.SVGSVGElement){r=n("#"+this._canvas.id+"_svg")[0];r&&r.parentNode.removeChild(r);o={id:this._canvas.id+"_svg",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:i.style,"class":"overview_svg"};r=new t.datavisualization.Diagram.Svg(o);this._svg=r;i.svg=r;var l=document.getElementById(this._id),e=l,u=n(e).width(),f=n(e).height(),s=e.getBoundingClientRect(),a=window.screenX<0?window.screenX*-1:window.screenX;u===0&&(u=Math.floor(window.innerWidth-a-Math.floor(s.left)));h=window.screenY<0?window.screenY*-1:window.screenY;f===0&&(f=Math.floor(window.innerHeight-h-Math.floor(s.top)));r.document.setAttribute("width",u);r.document.setAttribute("height",f);this.width=u;this.height=f;i.diagramLayer=t.datavisualization.Diagram.SvgContext._renderDiagramLayer(i.canvas,i.svg,i.svg);c=r.defs({id:i.canvas.id+"patterndefinition"});r.appendChild(c);i.canvas.appendChild(r.document);this._renderHtmlLayer(i.canvas);this._addOverviewRectPanel(i)}},_removeDocument:function(){var t=document.getElementById(this._canvas.id+"_svg"),n;this._canvas.removeChild(t);n=document.getElementById(this._canvas.id+"_htmlLayer");this._canvas.removeChild(n)},_renderHtmlLayer:function(n){var i=document.createElement("div"),u={id:n.id+"_htmlLayer","class":"htmlLayer"},r;return t.datavisualization.Diagram.Util.attr(i,u),r=i,i.style.pointerEvents="none",i.style.position="absolute",i.style.left="0px",i.style.top="0px",n.appendChild(r),r},_setModel:function(n){var t=!1;for(var i in n)switch(i){case"sourceID":this._setParent(n[i]);break;case"width":case"height":t||(this._renderCanvas(),this._setParent(this.model.sourceID));t=!0}},_setParent:function(t){if(this._parent){var i=n("#"+this._parent._id).ejDiagram("instance");this._parent=null;i._setOverview(null,this._id)}t&&(this.model.sourceID=t,this._parent=n("#"+t).ejDiagram("instance"),this._parent&&this._parent._setOverview(this))},_destroy:function(){this.element.empty().removeClass(this.model.cssClass)},_wireEvents:function(){var i=n(this._canvas);this._on(i,t.eventType.mouseDown,this._mousedown);this._on(i,t.eventType.mouseMove,this._mousemove);this._on(i,t.eventType.mouseUp,this._mouseup);this._on(i,t.eventType.mouseLeave,this._documentmouseup);this._on(i,"touchstart",this.handleTouchStart);this._on(i,"touchmove",this.handleTouchMove);this._on(i,"touchend",this.handleTouchEnd)},_mouseup:function(n){var f,e,t,u;if(this._currentPoint=this._mouseposition(n),f=this.width,e=this.height,this._actionName)if(this._startPoint.x!=this._currentPoint.x||this._startPoint.y!=this._currentPoint.y){if(this._actionName!="pan"&&this._helper){t=this._helper.getBBox();this._resizeDirection=this._resizeDirection||"";var o=t.x,s=t.y,i=t.width,r=t.height,h=this._resizeDirection=="topleft"||this._resizeDirection=="topright"||this._resizeDirection=="bottomleft"||this._resizeDirection=="bottomright";this._renderOverviewRect(o,s,i,r)}}else if((n.target.id==this._canvas.id+"overviewbackrect"||n.target.id=="helper")&&this._startPoint.x==this._currentPoint.x&&this._startPoint.y==this._currentPoint.y){var u=document.getElementById(this._canvas.id+"overviewrect"),t=u.getBBox(),i=t.width||100,r=t.height||100/this._viewPortRatio;this.inAction=!0;this._actionName="pan";this._renderOverviewRect(this._currentPoint.x-i/2,this._currentPoint.y-r/2,i,r);this.inAction=!1}this._helper&&(u=document.getElementById(this._canvas.id+"overviewhandle"),u.removeChild(this._helper),this._helper=null);this._actionName="";this._startPoint=null;this._currentPoint=null;this._prevPoint=null;this._helper=null;this._viewPortRatio=1;this._resizeDirection="";this._inAction=!1},_mousedown:function(n){if(n.target.className.animVal=="overviewbackrect"&&(this._actionName="draw"),n.target.id==this._canvas.id+"overviewrect"&&(this._actionName="pan"),n.target.className.animVal=="overviewresizer"){this._actionName="scale";switch(n.target.id){case this._canvas.id+"left":this._resizeDirection="left";break;case this._canvas.id+"right":this._resizeDirection="right";break;case this._canvas.id+"top":this._resizeDirection="top";break;case this._canvas.id+"bottom":this._resizeDirection="bottom";break;case this._canvas.id+"topleft":this._resizeDirection="topleft";break;case this._canvas.id+"topright":this._resizeDirection="topright";break;case this._canvas.id+"bottomleft":this._resizeDirection="bottomleft";break;case this._canvas.id+"bottomright":this._resizeDirection="bottomright"}}this._startPoint=this._prevPoint=this._mouseposition(n);var i=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent);this._viewPortRatio=i.width/i.height},_mouseposition:function(n){var i=this._parent._isTouchEvent(n);i||(i=n);var u=this._canvas.scrollLeft,f=this._canvas.scrollTop,r=this._canvas.getBoundingClientRect(),e=i.clientX+u-r.left,o=f+i.clientY-r.top;return new t.datavisualization.Diagram.Point(e,o)},_updateCursor:function(n){if(n.target.className.animVal=="overviewresizer")switch(n.target.id){case this._canvas.id+"left":this._canvas.style.cursor="w-resize";break;case this._canvas.id+"right":this._canvas.style.cursor="e-resize";break;case this._canvas.id+"top":this._canvas.style.cursor="n-resize";break;case this._canvas.id+"bottom":this._canvas.style.cursor="s-resize";break;case this._canvas.id+"topleft":this._canvas.style.cursor="nw-resize";break;case this._canvas.id+"topright":this._canvas.style.cursor="ne-resize";break;case this._canvas.id+"bottomleft":this._canvas.style.cursor="sw-resize";break;case this._canvas.id+"bottomright":this._canvas.style.cursor="se-resize"}else this._canvas.style.cursor="default"},_mousemove:function(n){if(this._updateCursor(n),this._currentPoint=this._mouseposition(n),this._actionName)switch(this._actionName){case"draw":this._inAction||this._startPoint.x==this._currentPoint.x&&this._startPoint.y!=this._currentPoint.y||(this._initHelper(),this._inAction=!0);this._inAction&&this._updateHelper();break;case"scale":this._inAction||(this._initHelper(),this._inAction=!0);this._updateOverviewRectangle();break;case"pan":(this._startPoint.x!=this._currentPoint.x||this._startPoint.y==this._currentPoint.y||this._inAction)&&(this._inAction=!0,this._translateOverviewRectangle())}this._prevPoint=this._currentPoint},_documentmouseup:function(){if(this._inAction=!1,this._actionName="",this._helper){var n=document.getElementById(this._canvas.id+"overviewhandle");n.removeChild(this._helper);this._helper=null}},_addOverviewRectPanel:function(){var r=n("#"+this._canvas.id+"_overviewsvg")[0],f,e,u,i,o;r&&r.parentNode.removeChild(r);r=new t.datavisualization.Diagram.Svg({id:this._canvas.id+"_overviewsvg",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:"position:absolute;left:0px;top:0px",width:this.width,height:this.height});this._canvas.appendChild(r.document);f=r.g({id:this._id+"_overviewlayer"});r.appendChild(f);e=r.rect({fill:"transparent",width:"100%",height:"100%","class":"overviewbackrect",id:this._canvas.id+"overviewbackrect"});f.appendChild(e);u=n(f);this._on(u,t.eventType.mouseDown,this._mousedown);this._on(u,t.eventType.mouseMove,this._mousemove);this._on(u,t.eventType.mouseUp,this._mouseup);this._on(u,t.eventType.mouseLeave,this._documentmouseup);this._on(u,"touchstart",this.handleTouchStart);this._on(u,"touchmove",this.handleTouchMove);this._on(u,"touchend",this.handleTouchEnd);i=r.g({id:this._canvas.id+"overviewhandle"});f.appendChild(i);o=r.rect({id:this._canvas.id+"overviewrect",fill:"transparent"});i.appendChild(o);this._renderOverviewCorner("left",i);this._renderOverviewCorner("right",i);this._renderOverviewCorner("top",i);this._renderOverviewCorner("bottom",i);this._renderOverviewCorner("topleft",i);this._renderOverviewCorner("topright",i);this._renderOverviewCorner("bottomleft",i);this._renderOverviewCorner("bottomright",i)},_updateOverview:function(n){var c,l,i,f,e,v,r,u,y,h;n=n||this._parent._views[this._id];i=this._parent._getDigramBounds();c=i.width;l=i.height;var a=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),o=this.width,s=this.height;n.context==t.datavisualization.Diagram.SvgContext?(f=Math.max(c,a.width),e=Math.max(l,a.height),this.contentWidth=f=Math.max(f,o/s*e),this.contentHeight=e=Math.max(e,s/o*f),v=document.getElementById(this._canvas.id+"_diagramLayer"),r=Math.min(o/f,s/e),this.scale=r,v.setAttribute("transform","scale("+r+","+r+"),translate("+-i.x+","+-i.y+")"),u=document.getElementById(this._canvas.id+"_htmlLayer"),u.style.webkitTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.MozTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.OTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.msTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.transform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",y=document.getElementById(this._id+"_overviewlayer"),y.setAttribute("transform","translate("+-i.x*r+","+-i.y*r+")")):(h=n._canvas.document.getContext("2d"),n.scale&&h.scale(1/n.scale.x,1/n.scale.y),n.scale={x:r,y:r},h.scale(r,r),t.datavisualization.Diagram.CanvasContext.refreshCanvas(this._parent.model,n));this._scrollOverviewRect(this._parent._hScrollOffset,this._parent._vScrollOffset,this._parent._currZoom)},_updateOverviewRectangle:function(){var n=this._currentPoint.x-this._prevPoint.x,t=this._currentPoint.y-this._prevPoint.y;if(this._actionName=="scale"){var i={width:0,height:0},r=0,u=0,f,e;switch(this._resizeDirection){case"left":i.width-=n;i.height-=n/this._viewPortRatio;r=n;u=n/this._viewPortRatio/2;break;case"right":i.width+=n;i.height+=n/this._viewPortRatio;u=n/this._viewPortRatio/-2;break;case"top":i.height-=t;i.width-=t*this._viewPortRatio;u=t;r=t*this._viewPortRatio/2;break;case"bottom":i.height+=t;i.width+=t*this._viewPortRatio;r=t*this._viewPortRatio/-2;break;case"topleft":Math.abs(t)>Math.abs(n)?n=t*this._viewPortRatio:t=n/this._viewPortRatio;i.width-=n;i.height-=t;r=n;u=t;break;case"topright":Math.abs(t)>Math.abs(n)?n=-t*this._viewPortRatio:t=-(n/this._viewPortRatio);u=t;i.width+=n;i.height-=t;break;case"bottomleft":Math.abs(t)>Math.abs(n)?n=-t*this._viewPortRatio:t=-n/this._viewPortRatio;r=n;i.width-=n;i.height+=t;break;case"bottomright":Math.abs(t)>Math.abs(n)?n=t*this._viewPortRatio:t=n/this._viewPortRatio;i.width+=n;i.height+=t}this._updateHelper(r,u,i,f,e)}},_initHelper:function(){var e,n,t;if(!this._helper){var o=this._svg,s=document.getElementById(this._canvas.id+"overviewhandle"),h=this._parent._currZoom,i=this._startPoint.x,r=this._startPoint.y,u=1,f=1;this._actionName=="scale"&&(e=document.getElementById(this._canvas.id+"overviewrect"),n=e.getBBox(),i=n.x,r=n.y,u=n.width,f=n.height);t=o.rect({id:"helper",x:i,y:r,width:u,height:f,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"});s.appendChild(t);this._helper=t}},_updateHelper:function(n,i,r){var n,i,o,s;if(r)var u=this._helper.getBBox(),h=u.x+n,c=u.y+i,f=u.width+r.width,e=u.height+r.height;else{n=this._currentPoint.x>this._startPoint.x?this._currentPoint.x-this._prevPoint.x:this._prevPoint.x-this._currentPoint.x;i=this._currentPoint.y>this._startPoint.y?this._currentPoint.y-this._prevPoint.y:this._prevPoint.y-this._currentPoint.y;Math.abs(i)>Math.abs(n)?(n=this._viewPortRatio*i,s=!0,o=!1):(i=n/this._viewPortRatio,o=!0,s=!1);var u=this._helper.getBBox(),h=this._startPoint.x>this._currentPoint.x?u.x-n:u.x,c=this._startPoint.y>this._currentPoint.y?u.y-i:u.y,f=u.width+n,e=u.height+i}this._helper&&t.datavisualization.Diagram.Util.attr(this._helper,{id:this._helper.id,x:h,y:c,width:f<0?0:f,height:e<0?0:e})},_renderOverviewCorner:function(n,t){var i=this._svg,r,u;n=="top"||n=="bottom"||n=="right"||n=="left"?(r=i.rect({id:this._canvas.id+"visible"+n}),t.appendChild(r),u=i.rect({id:this._canvas.id+n,"class":"overviewresizer",fill:"transparent"}),t.appendChild(u)):(r=i.circle({id:this._canvas.id+"visible"+n}),t.appendChild(r),u=i.circle({id:this._canvas.id+n,"class":"overviewresizer",fill:"transparent"}),t.appendChild(u))},_updateOverviewrect:function(n,i,r,u){if(r&&u){var f=document.getElementById(this._canvas.id+"overviewrect"),e={x:n,y:i,width:Math.max(1,r),height:Math.max(1,u)};t.datavisualization.Diagram.Util.attr(f,e);this._updateOverviewCorner("top",n+8,i-2,Math.max(0,r-16),2);this._updateOverviewCorner("bottom",n+8,i+u,Math.max(0,r-16),2);this._updateOverviewCorner("left",n-2,i+8,2,Math.max(0,u-16));this._updateOverviewCorner("right",n+r,i+8,2,Math.max(0,u-16));this._updateOverviewCorner("topleft",n,i,5,5);this._updateOverviewCorner("topright",n+r,i,5,5);this._updateOverviewCorner("bottomleft",n,i+u,5,5);this._updateOverviewCorner("bottomright",n+r,i+u,5,5)}},_scrollOverviewRect:function(n,i,r,u){if(!this._actionName||u){var a=this.width,v=this.height,f=Math.min(this.contentWidth/a,this.contentHeight/v),e={},s=e.x=n/r/f,h=e.y=i/r/f,o=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),c=e.width=o.width/r/f,l=e.height=o.height/r/f,y=o.width/o.height;if(u)return{x:s,y:h,width:c,height:l};this._updateOverviewrect(s,h,c,l)}},_updateOverviewCorner:function(n,i,r,u,f){var h="visible"+n,c=document.getElementById(this._canvas.id+h),e,o,s;n=="top"||n=="bottom"||n=="right"||n=="left"?(e={x:i,y:r,width:u,height:f,fill:"#ED1C24"},o={x:i-2,y:r-2,width:u==2?4:u,height:f==2?4:f}):(e={cx:i,cy:r,r:4,fill:"#ED1C24"},o={cx:i,cy:r,r:6,fill:"transparent"});t.datavisualization.Diagram.Util.attr(c,e);s=document.getElementById(this._canvas.id+n);t.datavisualization.Diagram.Util.attr(s,o)},_translateOverviewRectangle:function(){var o=this.width,s=this.height,h=this._currentPoint.x-this._prevPoint.x,c=this._currentPoint.y-this._prevPoint.y,i=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),a=Math.min(i.width/o,i.height/s),l=document.getElementById(this._canvas.id+"overviewrect"),n=l.getBBox(),r=n.x+h,u=n.y+c,f=n.width,e=n.height;this._updateOverviewrect(r,u,f,e);this._updateView(this._parent._currZoom,r,u,f,e,null)},_updateView:function(i,r,u,f,e,o){var b=this.width,k=this.height,d=this.contentWidth/b,g=this.contentHeight/k,y=r*d*i,p=u*g*i,h=this._parent._getDigramBounds(),v,s;if(i!=1||this._actionName=="pan"){var a=n("#"+this._parent._canvas.id+"_hScrollbar").ejScrollBar("instance").model,w=-y+a.maximum,c=-y+this._parent._hScrollOffset,l=-p+this._parent._vScrollOffset;h.width*i<w&&(s=h.width*i-w,Math.abs(s)<Math.abs(c)&&(c=c-s));a=n("#"+this._parent._canvas.id+"_vScrollbar").ejScrollBar("instance").model;v=-p+a.maximum;h.height*i<v&&(s=h.height*i-v,Math.abs(s)<Math.abs(l)&&(l=l-s))}t.datavisualization.Diagram.ZoomUtil.zoomPan(this._parent,i/this._parent._currZoom,c,l,o,!1)},_renderOverviewRect:function(n,i,r,u){var s=this.width,h=this.height,o=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),c=r/s*this.contentWidth,l=u/h*this.contentHeight,e=Math.max(o.width/c,o.height/l),f;e>=.25&&e<=30&&(this._updateView(e,n,i,r,u,new t.datavisualization.Diagram.Point(0,0)),f=this._scrollOverviewRect(this._parent._hScrollOffset,this._parent._vScrollOffset,this._parent._currZoom,!0),this._updateOverviewrect(f.x,f.y,f.width,f.height))},handleTouchStart:function(n){n.preventDefault()},handleTouchMove:function(n){n.preventDefault()},handleTouchEnd:function(n){n.preventDefault()},handleTouchLeave:function(n){n.preventDefault()}})}(jQuery,Syncfusion),function(n,t){"use strict";var i=function(){function i(n){return this.document=document.createElement("canvas"),this.id=n.id,this._scaleX=1,this._scaleY=1,n&&t.datavisualization.Diagram.Util.attr(this.document,n),this}return i.prototype.rect=function(n,t,i,r,u,f){var e=this.document.getContext("2d");e.beginPath();u&&u.angle&&this.rotateContext(u,e);f&&(this.setStyle(f,e),f.dashArray&&this.dashedRectangle(n,t,i,r,f.dashArray));e.fillRect(n,t,i,r);e.strokeRect(n,t,i,r);e.closePath();u&&u.angle&&e.restore()},i.prototype.roundedRect=function(n,t,i,r,u,f,e){var h=this.document.getContext("2d"),o;h.beginPath();f&&f.angle&&this.rotateContext(f,h);var s=[{x:n+u,y:t},{x:n+i-u,y:t},{x:n+i,y:t+u},{x:n+i,y:t+r-u},{x:n+i-u,y:t+r},{x:n+u,y:t+r},{x:n,y:t+r-u},{x:n,y:t+u}],l=[{x:n+i,y:t},{x:n+i,y:t+r},{x:n,y:t+r},{x:n,y:t}],c=0,a,v;for(e&&this.setStyle(e,h),h.moveTo(s[0].x,s[0].y),o=0;o<s.length;o=o+2)a=s[o+1],h.lineTo(a.x,a.y),v=s[o+2]||s[0],h.quadraticCurveTo(l[c].x,l[c].y,v.x,v.y),c++;if(h.fill(),e&&e.dashArray)for(c=0,o=0;o<s.length;o=o+2)this.dashedLine(s[o].x,s[o].y,s[o+1].x,s[o+1].y,e.dashArray),this.quadraticCurve(s[o+1],l[c],s[o+2]||s[0],e),c++;h.stroke();h.closePath();f&&f.angle&&h.restore()},i.prototype.ellipse=function(n,i,r,u,f,e){var s=this.document.getContext("2d"),o;e&&this.setStyle(e,s);o=4*((Math.sqrt(2)-1)/3);s.beginPath();f&&f.angle&&this.rotateContext(f,s);s.moveTo(n,i-u);s.bezierCurveTo(n+o*r,i-u,n+r,i-o*u,n+r,i);s.bezierCurveTo(n+r,i+o*u,n+o*r,i+u,n,i+u);s.bezierCurveTo(n-o*r,i+u,n-r,i+o*u,n-r,i);s.bezierCurveTo(n-r,i-o*u,n-o*r,i-u,n,i-u);s.fill();e&&e.dashArray&&(this.bezierCurve(t.datavisualization.Diagram.Point(n,i-u),new t.datavisualization.Diagram.Point(n+o*r,i-u),new t.datavisualization.Diagram.Point(n+r,i-o*u),new t.datavisualization.Diagram.Point(n+r,i),e),this.bezierCurve(t.datavisualization.Diagram.Point(n+r,i),new t.datavisualization.Diagram.Point(n+r,i+o*u),new t.datavisualization.Diagram.Point(n+o*r,i+u),new t.datavisualization.Diagram.Point(n,i+u),e),this.bezierCurve(t.datavisualization.Diagram.Point(n,i+u),new t.datavisualization.Diagram.Point(n-o*r,i+u),new t.datavisualization.Diagram.Point(n-r,i+o*u),new t.datavisualization.Diagram.Point(n-r,i),e),this.bezierCurve(t.datavisualization.Diagram.Point(n-r,i),new t.datavisualization.Diagram.Point(n-r,i-o*u),new t.datavisualization.Diagram.Point(n-o*r,i-u),new t.datavisualization.Diagram.Point(n,i-u),e));s.stroke();s.closePath();f&&f.angle&&s.restore()},i.prototype.circle=function(n,t,i,r,u){var f=this.document.getContext("2d");u&&this.setStyle(u,f);r&&r.angle&&this.rotateContext(r,f);u&&u.dashArray?(f.beginPath(),f.arc(n,t,i,0,2*Math.PI),f.fill(),f.stroke(),f.closePath()):this.ellipse(n,t,i*2,i*2,r,u);r&&r.angle&&f.restore()},i.prototype.arc=function(n,t,i,r,u,f){var o={angle:r,x:n,y:t},e=this.document.getContext("2d"),s,h;f&&this.setStyle(f,e);o&&o.angle&&this.rotateContext(o,e);e.beginPath();s=0;h=Math.PI;u||(s=Math.PI,h=0);f&&f.dashArray?e.arc(n,t,i,s,h):e.arc(n,t,i,s,h);e.stroke();e.closePath();o&&o.angle&&e.restore()},i.prototype.path=function(n,i,r,u,f,e,o){var h=this.document.getContext("2d"),pt,tt,it,s,wt,g;o&&this.setStyle(o,h);h.beginPath();pt=i;tt=r;h.translate(pt,tt);e&&e.angle&&this.rotateContext(e,h);it=document.createElementNS("http://www.w3.org/2000/svg","path");it.setAttribute("d",n);this.document.appendChild(it);for(var ti=this.getSegments(it),fi=i,ei=r,et,ot,k,d,st,ht,ct=ti,i=0,r=0,lt=0,ii=ct.length;lt<ii;++lt){s=ct[lt];wt=s.command;"x1"in s&&(k=s.x1);"x2"in s&&(st=s.x2);"y1"in s&&(d=s.y1);"y2"in s&&(ht=s.y2);"x"in s&&(i=s.x);"y"in s&&(r=s.y);switch(wt){case"M":h.moveTo(i,r);s.x=i;s.y=r;break;case"L":h.lineTo(i,r);s.x=i;s.y=r;break;case"C":h.bezierCurveTo(k,d,st,ht,i,r);s.x=i;s.y=r;s.x1=k;s.y1=d;s.x2=st;s.y2=ht;break;case"Q":h.quadraticCurveTo(k,d,i,r);s.x=i;s.y=r;s.x1=k;s.y1=d;break;case"A":var w=new t.datavisualization.Diagram.Point(et,ot),c=s.r1,l=s.r2,v=s.angle*(Math.PI/180),ri=s.largeArcFlag,rt=s.sweepFlag,b=new t.datavisualization.Diagram.Point(i,r),a=new t.datavisualization.Diagram.Point(Math.cos(v)*(w.x-b.x)/2+Math.sin(v)*(w.y-b.y)/2,-Math.sin(v)*(w.x-b.x)/2+Math.cos(v)*(w.y-b.y)/2),at=Math.pow(a.x,2)/Math.pow(c,2)+Math.pow(a.y,2)/Math.pow(l,2);at>1&&(c*=Math.sqrt(at),l*=Math.sqrt(at));g=(ri==rt?-1:1)*Math.sqrt((Math.pow(c,2)*Math.pow(l,2)-Math.pow(c,2)*Math.pow(a.y,2)-Math.pow(l,2)*Math.pow(a.x,2))/(Math.pow(c,2)*Math.pow(a.y,2)+Math.pow(l,2)*Math.pow(a.x,2)));isNaN(g)&&(g=0);var y=new t.datavisualization.Diagram.Point(g*c*a.y/l,g*-l*a.x/c),p=new t.datavisualization.Diagram.Point((w.x+b.x)/2+Math.cos(v)*y.x-Math.sin(v)*y.y,(w.y+b.y)/2+Math.sin(v)*y.x+Math.cos(v)*y.y),bt=function(n){return Math.sqrt(Math.pow(n[0],2)+Math.pow(n[1],2))},ut=function(n,t){return(n[0]*t[0]+n[1]*t[1])/(bt(n)*bt(t))},kt=function(n,t){return(n[0]*t[1]<n[1]*t[0]?-1:1)*Math.acos(ut(n,t))},ft=kt([1,0],[(a.x-y.x)/c,(a.y-y.y)/l]),vt=[(a.x-y.x)/c,(a.y-y.y)/l],yt=[(-a.x-y.x)/c,(-a.y-y.y)/l],nt=kt(vt,yt);ut(vt,yt)<=-1&&(nt=Math.PI);ut(vt,yt)>=1&&(nt=0);var ui=1-rt?1:-1,dt=ft+ui*(nt/2),oi=new t.datavisualization.Diagram.Point(p.x+c*Math.cos(dt),p.y+l*Math.sin(dt));if(s.centp=p,s.xAxisRotation=v,s.rx=c,s.ry=l,s.a1=ft,s.ad=nt,s.sweepFlag=rt,h!=null){var ut=c>l?c:l,gt=c>l?1:c/l,ni=c>l?l/c:1;h.save();h.translate(p.x,p.y);h.rotate(v);h.scale(gt,ni);h.arc(0,0,ut,ft,ft+nt,1-rt);h.scale(1/gt,1/ni);h.rotate(-v);h.translate(-p.x,-p.y);h.restore()}break;case"Z":case"z":h.closePath();i=et;r=ot}et=i;ot=r}h.fill();o&&o.dashArray?this.drawDashedPath(ct,o):h.stroke();h.translate(-tt,-tt);e&&e.angle&&h.restore()},i.prototype.getSegments=function(i){for(var r,a,c,l,k,u,e,o,v,y,p,w,d,g,nt=t.datavisualization.Diagram.Util.convertPathToArray(i.getAttribute("d")),f=[],s=0,h=0,b=0,tt=nt.length;b<tt;++b){r=nt[b];a=r.pathSegTypeAsLetter;"x1"in r&&(v=r.x1);"x2"in r&&(p=r.x2);"y1"in r&&(y=r.y1);"y2"in r&&(w=r.y2);"x"in r&&(s=r.x);"y"in r&&(h=r.y);switch(a){case"M":f.push({command:"M",x:s,y:h});break;case"L":f.push({command:"L",x0:e,y0:o,x:s,y:h});break;case"H":f.push({command:"L",x0:e,y0:o,x:s,y:o});break;case"V":f.push({command:"L",x0:e,y0:o,x:e,y:h});break;case"C":f.push({command:"C",x0:e,y0:o,x1:v,y1:y,x2:p,y2:w,x:s,y:h});break;case"S":u&&(c=u.command=="C"||u.command=="S"?{x:u.x2,y:u.y2}:{x:u.x0,y:u.y0},l=new t.datavisualization.Diagram.Point(2*e-c.x,2*o-c.y),f.push({command:"C",x0:e,y0:o,x1:l.x,y1:l.y,x2:p,y2:w,x:s,y:h}));break;case"Q":f.push({command:"Q",x0:e,y0:o,x1:v,y1:y,x:s,y:h});break;case"T":u&&(c=u.command=="Q"?{x:u.x1,y:u.y1}:{x:u.x0,y:u.y0},l=new t.datavisualization.Diagram.Point(2*e-c.x,2*o-c.y),f.push({command:"Q",x0:e,y0:o,x1:l.x,y1:l.y,x:s,y:h}));break;case"A":k=n.extend(!0,{},r);k.command="A";f.push(k);break;case"Z":case"z":f.push({command:"L",x0:s,y0:h,x:d,y:g});s=e;h=o}u=f[f.length-1];(a==="M"||a==="m")&&(d=s,g=h);e=s;o=h}return f},i.prototype.drawDashedPath=function(n,i){for(var r,p,u,h,c,v,y,o,s,l,f=0,e=0,a=0,k=n.length;a<k;++a){r=n[a];p=r.command;"x1"in r&&(h=r.x1);"x2"in r&&(v=r.x2);"y1"in r&&(c=r.y1);"y2"in r&&(y=r.y2);"x"in r&&(f=r.x);"y"in r&&(e=r.y);switch(p){case"M":l={x:f,y:e};break;case"L":this.dashedLine(o,s,f,e,i.dashArray);break;case"H":this.dashedLine(o,s,f,s,i.dashArray);break;case"V":this.dashedLine(o,s,o,e,i.dashArray);break;case"C":this.bezierCurve(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),t.datavisualization.Diagram.Point(v,y),t.datavisualization.Diagram.Point(f,e),i);break;case"Q":this.quadraticCurve(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),t.datavisualization.Diagram.Point(f,e),i);break;case"A":if(u=this.document.getContext("2d"),u!=null){var d=r.rx>r.ry?r.rx:r.ry,w=r.rx>r.ry?1:r.rx/r.ry,b=r.rx>r.ry?r.ry/r.rx:1;u.save();u.translate(r.centp.x,r.centp.y);u.rotate(r.xAxisRotation);u.scale(w,b);this.dashedArc(d,0,0,r.a1,r.a1+r.ad,1-r.sweepFlag,i.dashArray);u.scale(1/w,1/b);u.rotate(-r.xAxisRotation);u.translate(-r.centp.x,-r.centp.y);u.restore()}break;case"Z":case"z":this.dashedLine(f,e,l.x,l.y,i.dashArray);f=o;e=s}o=f;s=e}},i.prototype.calculateCirclePoints=function(n,i,r,u,f,e){var h,o,s,c;for(u=u*180/Math.PI,f=f*180/Math.PI,h=2*Math.PI*n*(Math.abs(u-f)/360)*.7,o=Math.abs(u-f)/h,o=e?o*-1:o,s=0,c=[];s<h;)c.push(t.datavisualization.Diagram.Geometry.transform({x:i,y:r},u+o*s,n)),s++;return c},i.prototype.polygon=function(n,t,i){var u=this.document.getContext("2d"),r;for(u.beginPath(),t&&t.angle&&this.rotateContext(t,u),i&&this.setStyle(i,u),u.moveTo(n[0].x,n[0].y),r=1;r<n.length;r++)u.lineTo(n[r].x,n[r].y);if(u.lineTo(n[0].x,n[0].y),u.fill(),i&&i.dashArray){for(r=1;r<n.length;r++)this.line(n[r-1],n[r],i);this.line(n[r-1],n[0],i)}u.stroke();u.closePath();t&&t.angle&&u.restore()},i.prototype.image=function(n,t,i,r,u,f,e){var o=this.document.getContext("2d");o.beginPath();f&&f.angle&&this.rotateContext(f,o);e&&this.setStyle(e,o);r&&u?o.drawImage(n,t,i,r,u):o.drawImage(n,t,i);o.closePath();f&&f.angle&&o.restore()},i.prototype.text=function(n,t,i,r,u){var f=this.document.getContext("2d");f.beginPath();r&&r.angle&&this.rotateContext(r,f);u&&this.setStyle(u,f);f.fillText(n.text,t,i);f.closePath();r&&r.angle&&f.restore()},i.prototype.line=function(n,t,i,r,u){var f=this.document.getContext("2d");r||(f.beginPath(),i&&this.setStyle(i,f));i&&i.dashArray?this.dashedLine(n.x,n.y,t.x,t.y,i.dashArray):(r||f.moveTo(n.x,n.y),f.lineTo(t.x,t.y),f.stroke());u||f.closePath()},i.prototype.polyline=function(n,t){var r=this.document.getContext("2d"),i;for(r.beginPath(),t&&this.setStyle(t,r),i=1;i<n.length;i++)this.line(n[i-1],n[i],t);r.stroke()},i.prototype.bezierCurve=function(n,t,i,r,u){var f=this.document.getContext("2d"),e,c,o,h;if(f.beginPath(),f.moveTo(n.x,n.y),u&&this.setStyle(u,f),u&&u.dashArray){for(e=[],this.flattenCubicBezier(e,n,t,i,r),c=0,o=0;o<u.dashArray.length;o++)c+=Number(u.dashArray[o]);var a=e.length/c,l=!0,s=0;for(o=0;o<a;o++)for(h=0;h<u.dashArray.length;h++)s+=Number(u.dashArray[h]),s<e.length&&(l?f.lineTo(e[s].x,e[s].y):f.moveTo(e[s].x,e[s].y)),l=!l}else f.moveTo(n.x,n.y),f.bezierCurveTo(t.x,t.y,i.x,i.y,r.x,r.y);f.stroke()},i.prototype.quadraticCurve=function(n,t,i,r){var u=this.document.getContext("2d"),f,h,e,s;if(u.beginPath(),u.moveTo(n.x,n.y),r&&this.setStyle(r,u),r&&r.dashArray){for(f=[],this.flattenQuadraticBezier(f,n,t,i),h=0,e=0;e<r.dashArray.length;e++)h+=Number(r.dashArray[e]);var l=f.length/h,c=!0,o=0;for(e=0;e<l;e++)for(s=0;s<r.dashArray.length;s++)o+=Number(r.dashArray[s]),o<f.length&&(c?u.lineTo(f[o].x,f[o].y):u.moveTo(f[o].x,f[o].y)),c=!c}else u.moveTo(n.x,n.y),u.quadraticCurveTo(t.x,t.y,i.x,i.y);u.stroke()},i.prototype.arrow=function(n,t,i,r,u){var f=this.document.getContext("2d");f.beginPath();u&&this.setStyle(u,f);t&&t.angle&&this.rotateContext(t,f);f.moveTo(n.x+i.width,n.y+i.height/2);f.lineTo(n.x,n.y);f.lineTo(n.x+i.width,n.y-i.height/2);r||(f.closePath(),f.fill());f.stroke();t&&t.angle&&f.restore()},i.prototype.diamond=function(n,t,i,r){var u=this.document.getContext("2d");u.beginPath();r&&this.setStyle(r,u);t&&t.angle&&this.rotateContext(t,u);u.moveTo(n.x+i.width,n.y);u.lineTo(n.x+i.width/2,n.y+i.height/2);u.lineTo(n.x,n.y);u.lineTo(n.x+i.width/2,n.y-i.height/2);u.lineTo(n.x+i.width,n.y);u.stroke();u.fill();u.closePath();t&&t.angle&&u.restore()},i.prototype.dashedLine=function(n,t,i,r,u){var f=this.document.getContext("2d");f.save();var o=i-n,s=r-t,h=Math.sqrt(o*o+s*s),l=Math.atan2(s,o);f.beginPath();f.translate(n,t);f.moveTo(0,0);f.rotate(l);for(var a=u.length,v=0,c=!0,e=0;h>e;)e+=Number(u[v++%a]),e>h&&(e=h),c?f.lineTo(e,0):f.moveTo(e,0),c=!c,f.stroke();f.restore()},i.prototype.dashedRectangle=function(n,t,i,r,u){this.dashedLine(n,t,n+i,t,u);this.dashedLine(n+i,t,n+i,t+r,u);this.dashedLine(n+i,t+r,n,t+r,u);this.dashedLine(n,t+r,n,t,u)},i.prototype.dashedArc=function(n,t,i,r,u,f,e){for(var o,h,l,a=0,s=0;s<e.length;s++)a+=Number(e[s]);o=this.calculateCirclePoints(n,t,i,r,u,f,a);h=this.document.getContext("2d");h.beginPath();var y=o.length/a,v=!0,c=0;for(s=0;s<y;s++)for(l=0;l<e.length;l++)c+=Number(e[l]),c<o.length&&(v?(h.lineTo(o[c].x,o[c].y),h.stroke()):h.moveTo(o[c].x,o[c].y)),v=!v;h.closePath()},i.prototype.absolutePath=function(n){for(var r,h,e,y,p,c,l,a,v,o=t.datavisualization.Diagram.Util.convertPathToArray(n.getAttribute("d")),u=0,f=0,s=0,w=o.length;s<w;++s){if(r=o[s],h=r.pathSegTypeAsLetter,/[MLHVCSQTA]/.test(h))"x"in r&&(u=r.x),"y"in r&&(f=r.y);else{"x1"in r&&(c=u+r.x1);"x2"in r&&(a=u+r.x2);"y1"in r&&(l=f+r.y1);"y2"in r&&(v=f+r.y2);"x"in r&&(u+=r.x);"y"in r&&(f+=r.y);switch(h){case"m":e={pathSegTypeAsLetter:"M",x:u,y:f};break;case"l":e={pathSegTypeAsLetter:"L",x:u,y:f};break;case"h":e={pathSegTypeAsLetter:"H",x:u};break;case"v":e={pathSegTypeAsLetter:"V",y:f};break;case"c":e={pathSegTypeAsLetter:"C",x:u,y:f,x1:c,y1:l,x2:a,y2:v};break;case"s":e={pathSegTypeAsLetter:"S",x:u,y:f,x2:a,y2:v};break;case"q":e={pathSegTypeAsLetter:"Q",x:u,y:f,x1:c,y1:l};break;case"t":e={pathSegTypeAsLetter:"T",x:u,y:f};break;case"a":e={pathSegTypeAsLetter:"A",x:u,y:f,r1:r1,r2:r2,angle:angle,largeArcFlag:largeArcFlag,sweepFlag:sweepFlag};break;case"z":case"Z":u=y;f=p;e=o[s]}e&&(o[s]=e)}(h==="M"||h==="m")&&(y=u,p=f)}return n.setAttribute("d",t.datavisualization.Diagram.Util.pathSegArrayAsString(o)),i.prototype._scalePathData=function(n,t,i,r){return n!==i?n=r!==i?n*t-(Number(i)*t-Number(i))+(r-Number(i)):Number(n)*t-(Number(i)*t-Number(i)):r!==i&&(n=r),n},n},i.prototype.setStyle=function(n,t){n.fill&&(t.fillStyle=n.fill);n.stroke&&(t.strokeStyle=n.stroke=="none"?"transparent":n.stroke);n.font&&(t.font=n.font);n.lineWidth&&(t.lineWidth=n.lineWidth)},i.prototype.rotateContext=function(n,t){t.save();t.translate(n.x,n.y);t.rotate(n.angle*Math.PI/180);t.translate(-n.x,-n.y)},i.prototype.pathBounds=function(n){for(var i,b,r,v,y,p,w,c,l,u,f,e,o,s=0,h=0,a=0,k=n.length;a<k;++a){i=n[a];b=i.command;a==0&&i.x&&i.y&&(u=e=i.x,f=o=i.y);"x1"in i&&(v=i.x1);"x2"in i&&(p=i.x2);"y1"in i&&(y=i.y1);"y2"in i&&(w=i.y2);"x"in i&&(s=i.x);"y"in i&&(h=i.y);switch(b){case"M":c=s;l=h;case"L":case"H":case"V":s&&(u=Math.min(s,u),e=Math.max(s,e));h&&(f=Math.min(h,f),o=Math.max(h,o));break;case"C":case"S":r=this.getBezierBounds(t.datavisualization.Diagram.Point(c,l),t.datavisualization.Diagram.Point(v,y),t.datavisualization.Diagram.Point(p,w),t.datavisualization.Diagram.Point(s,h));u=Math.min(r.x,u);e=Math.max(r.x+r.width,e);f=Math.min(r.y,f);o=Math.max(r.y+r.height,o);break;case"Q":case"q":case"T":r=this.getQuadraticBounds(t.datavisualization.Diagram.Point(c,l),t.datavisualization.Diagram.Point(v,y),t.datavisualization.Diagram.Point(s,h));u=Math.min(r.x,u);e=Math.max(r.x+r.width,e);f=Math.min(r.y,f);o=Math.max(r.y+r.height,o);break;case"Z":case"z":s=c;h=l}}return{x:u,y:f,width:e-u,height:o-f}},i.prototype.flattenCubicBezier=function(n,i,r,u,f,e){for(var e=1.5,h=Number((t.datavisualization.Diagram.Geometry.distance(r,i)+t.datavisualization.Diagram.Geometry.distance(u,r)+t.datavisualization.Diagram.Geometry.distance(f,u))/e),s=0;s<=h;s++){var o=s/h,c=(1-o)*(1-o)*(1-o)*i.x+3*o*(1-o)*(1-o)*r.x+3*o*o*(1-o)*u.x+o*o*o*f.x,l=(1-o)*(1-o)*(1-o)*i.y+3*o*(1-o)*(1-o)*r.y+3*o*o*(1-o)*u.y+o*o*o*f.y;n.push(new t.datavisualization.Diagram.Point(c,l))}},i.prototype.flattenQuadraticBezier=function(n,i,r,u,f){for(var f=1.5,s=Number((t.datavisualization.Diagram.Geometry.distance(r,i)+t.datavisualization.Diagram.Geometry.distance(u,r))/f),o=0;o<=s;o++){var e=o/s,h=(1-e)*(1-e)*i.x+2*e*(1-e)*r.x+e*e*u.x,c=(1-e)*(1-e)*i.y+2*e*(1-e)*r.y+e*e*u.y;n.push(new t.datavisualization.Diagram.Point(h,c))}},i.prototype.getBezierBounds=function(n,i,r,u,f){for(var f=3,o,s,h,c,y=Number((t.datavisualization.Diagram.Geometry.distance(i,n)+t.datavisualization.Diagram.Geometry.distance(r,i)+t.datavisualization.Diagram.Geometry.distance(u,r))/f),l=0;l<=y;l++){var e=l/y,a=(1-e)*(1-e)*(1-e)*n.x+3*e*(1-e)*(1-e)*i.x+3*e*e*(1-e)*r.x+e*e*e*u.x,v=(1-e)*(1-e)*(1-e)*n.y+3*e*(1-e)*(1-e)*i.y+3*e*e*(1-e)*r.y+e*e*e*u.y;l==0?(o=h=a,s=c=v):(o=Math.min(a,o),s=Math.min(v,s),h=Math.max(a,h),c=Math.max(v,c))}return{x:o,y:s,width:h-o,height:c-s}},i.prototype.getQuadraticBounds=function(n,i,r,u){for(var u=3,e,o,s,h,v=Number((t.datavisualization.Diagram.Geometry.distance(i,n)+t.datavisualization.Diagram.Geometry.distance(r,i))/u),c=0;c<=v;c++){var f=c/v,l=(1-f)*(1-f)*n.x+2*f*(1-f)*i.x+f*f*r.x,a=(1-f)*(1-f)*n.y+2*f*(1-f)*i.y+f*f*r.y;c==0?(e=s=l,o=h=a):(e=Math.min(l,e),o=Math.min(a,o),s=Math.max(l,s),h=Math.max(a,h))}return{x:e,y:o,width:s-e,height:h-o}},i}();t.datavisualization.Diagram.Canvas=i;t.datavisualization.Diagram.CanvasContext={_renderDocument:function(n,i){var r={id:n.canvas.id+"_canvas",width:i._canvas.clientWidth,height:i._canvas.clientHeight,version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:n.style,"pointer-events":"none"};n._canvas=new t.datavisualization.Diagram.Canvas(r);i._view=n.canvas;n.canvas.appendChild(n._canvas.document);n.type=="mainview"&&(this._canvas=n.canvas,i._svg=this._svg=n._canvas)},_renderGroupBackground:function(n,i,r){var u,f,e,h,o,s;n.pivot||(n.pivot={},n.pivot.x=.5,n.pivot.y=.5);u=i.document.getContext("2d");n.visible&&(f={angle:n.rotateAngle,x:n.offsetX*i._scaleX,y:n.offsetY*i._scaleY},u.save(),u.translate(f.x,f.y),u.rotate(f.angle*Math.PI/180),u.translate(-f.x,-f.y),u.fillStyle=n.type!="bpmn"?n.fillColor:"transparent",u.strokeStyle=n.type!="bpmn"?n.borderColor:"transparent",u.lineWidth=n.borderWidth,n.borderDashArray&&(n.borderDashArray.indexOf("[")!=-1||n.borderDashArray instanceof Array?e=n.borderDashArray:n.borderDashArray.indexOf(",")!=-1?e=n.borderDashArray.split(","):n.borderDashArray.indexOf(" ")!=-1&&(e=n.borderDashArray.split(" ")),u.setLineDash?u.setLineDash(e):u.mozDash?u.mozDash=e:h={dashArray:e}));o=n.offsetX*i._scaleX-n.width*i._scaleX*n.pivot.x;s=n.offsetY*i._scaleY-n.height*i._scaleY*n.pivot.y;t.datavisualization.Diagram.Util.canCrispEdges(n,r)&&(o=Math.floor(o)+.5,s=Math.floor(s)+.5);i.rect(o,s,n.width*i._scaleX,n.height*i._scaleY,null,h);u.restore()},renderGroup:function(n,t,i){var u,f,o,r,c,l,e,s,h;if(n.visible){for(u=t.document.getContext("2d"),f={angle:n.rotateAngle,x:n.offsetX*t._scaleX,y:n.offsetY*t._scaleY},u.save(),this._renderGroupBackground(n,t,i),o=0;o<n.children.length;o++)r=i.nameTable[i._getChild(n.children[o])],r&&(r._type==="group"?this.renderGroup(r,t,i):r._type==="node"?this.renderNode(r,t):r.segments&&this.renderConnector(r,t));if(u.translate(f.x,f.y),u.rotate(f.angle*Math.PI/180),u.translate(-f.x,-f.y),c=n.offsetX*t._scaleX-n.width*t._scaleX*n.pivot.x,l=n.offsetY*t._scaleY-n.height*t._scaleY*n.pivot.y,n.isLane||(this.renderLabels(n,t),this.renderPorts(n,t,c,l)),n.isSwimlane&&i._renderCanvasPhase(n,t),n.annotation&&n._annotation&&n._annotation.length)for(e=0;e<n._annotation.length;e++)i.nameTable[n._annotation[e]]&&(s=i.nameTable[n._annotation[e]],h=i.getObjectType(s),h=="node"?this.renderNode(s,t):h=="connector"&&this.renderConnector(s,t));u.restore()}},_isExportable:function(n,i){var f=!0,e,i,r,u;if(n.type==="image")try{i=new t.datavisualization.Diagram.Canvas({id:"temp_canvas",width:100,height:100});r=i.document.getContext("2d");r.save();i.rect(0,0,n.width*i._scaleX,n.height*i._scaleY);u=new Image;u.src=n.source;i.image(u,0,0,n.width*i._scaleX,n.height*i._scaleY);r.restore();e=i.document.toDataURL()}catch(o){f=!1}return f},_isImageExportable:function(n){var f=!0,e,i,r,u;if(n.source)try{i=new t.datavisualization.Diagram.Canvas({id:"temp_canvas",width:100,height:100});r=i.document.getContext("2d");r.save();u=new Image;u.src=n.source;i.image(u,0,0,100,100);r.restore();e=i.document.toDataURL()}catch(o){f=!1}return f},renderNode:function(n,i){var r=i.document.getContext("2d"),u,f,e,o,d,s,a,h,c,l,g,v,p,y,w,nt;if(n.visible&&this._isExportable(n,i)){u=n.width||n._width||0;f=n.height||n._height||0;u*=i._scaleX;f*=i._scaleY;var b=n.offsetX*i._scaleX,k=n.offsetY*i._scaleY,l={angle:n.rotateAngle,x:b,y:k};if(r.save(),r.translate(l.x,l.y),r.rotate(l.angle*Math.PI/180),r.translate(-l.x,-l.y),r.save(),r.fillStyle=n.fillColor,r.strokeStyle=n.borderColor=="none"||!n.borderWidth?"transparent":n.borderColor,r.lineWidth=n.borderWidth,r.globalAlpha=n.opacity,e=b-u*n.pivot.x,o=k-f*n.pivot.y,t.datavisualization.Diagram.Util.canCrispEdges(n,i._diagram)&&(e=Math.floor(e)+.5,o=Math.floor(o)+.5),n._shape=="path"?this._renderGradient(n,r,0,0):this._renderGradient(n,r,e,o),d=n.fillColor,n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow){r.save();r.strokeStyle="lightgrey";s=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance);r.fillStyle=d!="none"||d!="transparent"?"lightgrey":"none";switch(n._shape){case"image":case"rectangle":n.cornerRadius?i.roundedRect(e+s.x,o+s.y,u,f,n.cornerRadius,null):i.rect(e+s.x,o+s.y,u,f,null);break;case"ellipse":i.ellipse(e+u/2+s.x,o+f/2+s.y,u/2,f/2,null);break;case"path":c=n._absolutePath;(i._scaleX!==1||i._scaleY!==1)&&(c=t.datavisualization.Diagram.Geometry.updatePath(e,o,u,f,c,i._diagram._svg,null,null));i.path(c,e+s.x,o+s.y,u,f,null);break;case"polygon":p=this._updatePolygonPoints(n,i);r.translate(s.x,s.y);i.polygon(p,null,h)}r.restore()}n.borderDashArray&&(n.borderDashArray.indexOf("[")!=-1||n.borderDashArray instanceof Array?a=n.borderDashArray:n.borderDashArray.indexOf(",")!=-1?a=n.borderDashArray.split(","):n.borderDashArray.indexOf(" ")!=-1&&(a=n.borderDashArray.split(" ")),r.setLineDash?r.setLineDash(a):r.mozDash?r.mozDash=a:h={dashArray:a});switch(n._shape){case"rectangle":n.cornerRadius?i.roundedRect(e,o,u,f,n.cornerRadius,null,h):i.rect(e,o,u,f,null,h);break;case"ellipse":i.ellipse(e+u/2,o+f/2,u/2,f/2,null,h);break;case"path":c=n._absolutePath;(i._scaleX!==1||i._scaleY!==1)&&(c=t.datavisualization.Diagram.Geometry.updatePath(0,0,u,f,c,i._diagram._svg,null,null));i.path(c,e,o,u,f,null,h);break;case"image":l={angle:n.rotateAngle,x:b,y:k};i.rect(e,o,u,f,null,h);g=new Image;g.src=n.source;i.image(g,e,o,u,f,null);break;case"text":i.rect(e,o,u,f,null,h);n.textBlock&&(v="",n.textBlock.italic&&(v+="italic "),n.textBlock.bold&&(v+="bold "),v+=n.textBlock.fontSize+" ",v+=n.textBlock.fontFamily,r.font=v,this._renderTextElement(n,n.textBlock,i));break;case"polygon":p=this._updatePolygonPoints(n,i);i.polygon(p,null,h);break;case"native":case"html":diagram._raiseEvent("templateNodeRendering",{element:n,canvas:i})}if(r.restore(),this.renderPorts(n,i,e,o),n.type!="text"&&this.renderLabels(n,i),n.annotation&&n._annotation&&n._annotation.length)for(y=0;y<n._annotation.length;y++)diagram.nameTable[n._annotation[y]]&&(w=diagram.nameTable[n._annotation[y]],nt=diagram.getObjectType(w),nt=="node"?this.renderNode(w,i):nt=="connector"&&this.renderConnector(w,i));r.restore()}},renderPhases:function(n,t,i){var f,r,u;n&&t&&(r=t.document.getContext("2d"),r.save(),r.strokeStyle=n.lineColor?n.lineColor:"black",r.lineWidth=n.lineWidth?n.lineWidth:1,n.lineDashArray&&(n.lineDashArray.indexOf("[")!=-1||n.lineDashArray instanceof Array?u=n.lineDashArray:n.lineDashArray.indexOf(",")!=-1?u=n.lineDashArray.split(","):n.lineDashArray.indexOf(" ")!=-1&&(u=n.lineDashArray.split(" ")),r.setLineDash?r.setLineDash(u):r.mozDash?r.mozDash=u:f={dashArray:u}),i&&i.length>0&&t.line(i[0],i[1],f));r.restore()},renderConnector:function(n,t){var i,r,f,u;if(n.visible&&(i=t.document.getContext("2d"),i.save(),i.strokeStyle=n.lineColor,i.lineWidth=n.lineWidth,n.lineDashArray&&(n.lineDashArray.indexOf("[")!=-1||n.lineDashArray instanceof Array?r=n.lineDashArray:n.lineDashArray.indexOf(",")!=-1?r=n.lineDashArray.split(","):n.lineDashArray.indexOf(" ")!=-1&&(r=n.lineDashArray.split(" ")),i.setLineDash?i.setLineDash(r):i.mozDash?i.mozDash=r:f={dashArray:r}),n.segments&&this._renderSegments(n,t,f),i.restore(),this._renderDecorators(n,t),this.renderLabels(n,t),n.shape))for(u=0;u<n._inlineDecorators.length;u++)this.renderNode(n._inlineDecorators[u],t)},_renderSegments:function(n,i,r){for(var f,d,ut,u,w,b,g,nt,v,c,a,it,h,l,e,p,rt,o,s=0;s<n.segments.length;s++){if(f=n.segments[s],f._bridges.length>0)for(d=0;d<f._bridges.length;d++)ut=f._bridges[d],ut._rendered=!1;if(u=f.points,w=i._diagram,s==0?(w&&n.sourceNode&&(g=w._findNode(n.sourceNode)),u=t.datavisualization.Diagram.SvgContext._clipDecorators(n,f,!0,g),f.type=="bezier"&&n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u[0]=t.datavisualization.Diagram.Util._adjustPoint(u[0],f._point1,!0,n.lineWidth)),a=u[0],b=!0):b=!1,s==n.segments.length-1&&(w&&n.targetNode&&(g=w._findNode(n.targetNode)),u=t.datavisualization.Diagram.SvgContext._clipDecorators(n,f,!1,g),a&&n.segments.length<2&&(u[0]=a,a=null),nt=!0),n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&s==0){v={x:f.points[0].x,y:f.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(f.points[0],f.points[1]);c=Math.min(30,c/2);var y=t.datavisualization.Diagram.Geometry.findAngle(f.points[0],f.points[1]),tt=t.datavisualization.Diagram.Geometry.transform({x:v.x,y:v.y},y,c),k=t.datavisualization.Diagram.Geometry.transform({x:tt.x,y:tt.y},y+135,-12),ft=t.datavisualization.Diagram.Geometry.transform({x:k.x,y:k.y},y+135,24)}if(n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&s==0){v={x:f.points[0].x,y:f.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(f.points[0],f.points[1]);c=Math.min(30,c/2);var y=t.datavisualization.Diagram.Geometry.findAngle(f.points[0],f.points[1]),tt=t.datavisualization.Diagram.Geometry.transform({x:v.x,y:v.y},y,c),k=t.datavisualization.Diagram.Geometry.transform({x:tt.x,y:tt.y},y+135,-12),ft=t.datavisualization.Diagram.Geometry.transform({x:k.x,y:k.y},y+135,24)}if(f.type=="bezier")a=u[0],it=f._endPoint,n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(it=t.datavisualization.Diagram.Util._adjustPoint(f._endPoint,f._point2,!0,n.lineWidth)),i.bezierCurve(a,f._point1,f._point2,it,r);else if(n.cornerRadius>0)for(e=0;e<u.length-1;e++)p=t.datavisualization.Diagram.Geometry.distance(u[e],u[e+1]),p>0&&(rt=l||h,l=s<n.segments.length-1||e<u.length-2?p<n.cornerRadius*2?this._adjustPoint(u[e],u[e+1],!1,p/2):this._adjustPoint(u[e],u[e+1],!1,n.cornerRadius):u[e+1],(s>0||e>0)&&(p<n.cornerRadius*2?(h=this._adjustPoint(u[e],u[e+1],!0,p/2),(s<n.segments.length-1||e<u.length-2)&&(l=null)):h=this._adjustPoint(u[e],u[e+1],!0,n.cornerRadius)),rt&&h?i.quadraticCurve(rt,u[e],h,r):h=u[e],f._bridges.length>0&&this._updateBridging(f,i,e+1,h?h:u[e],l?l:u[e+1],n.bridgeSpace,r,b&&o==1?!0:!1,nt&&o==u.length-1?!0:!1),l&&(f._bridges.length>0||i.line(h,l,r)));else for(o=1;o<u.length;o++)f._bridges.length>0?this._updateBridging(f,i,o,u[o-1],u[o],n.bridgeSpace,r,b&&o==1?!0:!1,nt&&o==u.length-1?!0:!1):i.line(this._scalePointforStretch(u[o-1],i,n),this._scalePointforStretch(u[o],i,n),r,b&&o==1?!1:!0,nt&&o==u.length-1?!1:!0)}n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&i.line(this._scalePointforStretch(k,i,n),this._scalePointforStretch(ft,i,n),r)},_scalePointforStretch:function(n,i,r){var u={x:n.x,y:n.y};return r&&t.datavisualization.Diagram.Util.canCrispEdges(r,i._diagram)&&(u.x=Math.floor(u.x),u.y=Math.floor(u.y)),u.x*=i._scaleX,u.y*=i._scaleY,u},_updateBridging:function(n,i,r,u,f,e,o,s,h){var a,v=this._findAngle(u,f),p=i._diagram.bridgeDirection(),y,l,c;if(n._bridges.length>0)if(n.type==="straight"){for(l=0;l<n._bridges.length;l++)if(c=n._bridges[l],!c._rendered){a=n._bridges[l-1]!=null&&n._bridges[l-1].segmentPointIndex==c.segmentPointIndex?n._bridges[l-1].endPoint:u;i.line(a,c.startPoint,o,!(s||l==0),!0);var w=c.startPoint.x+(c.endPoint.x-c.startPoint.x)/2,b=c.startPoint.y+(c.endPoint.y-c.startPoint.y)/2,k=t.datavisualization.Diagram.Util.sweepDirection(v,p,null,i._diagram);i.arc(w,b,e/2,v,k,o);n._bridges[l+1]!=null&&n._bridges[l+1].segmentPointIndex==c.segmentPointIndex?i.line(c.endPoint,n._bridges[l+1].startPoint,o,!1):i.line(c.endPoint,f,o,!1,!h);c._rendered=!0}}else if(n.type==="orthogonal"){for(y=u,l=0;l<n._bridges.length;l++)if(c=n._bridges[l],c.segmentPointIndex===r&&!c._rendered){a=n._bridges[l-1]!=null&&n._bridges[l-1].segmentPointIndex==c.segmentPointIndex?n._bridges[l-1].endPoint:u;i.line(a,c.startPoint,o,!(s||l==0),!0);var w=c.startPoint.x+(c.endPoint.x-c.startPoint.x)/2,b=c.startPoint.y+(c.endPoint.y-c.startPoint.y)/2,k=t.datavisualization.Diagram.Util.sweepDirection(v,p,null,i._diagram);i.arc(w,b,e/2,v,k,o);n._bridges[l+1]!=null&&n._bridges[l+1].segmentPointIndex==c.segmentPointIndex?i.line(c.endPoint,n._bridges[l+1].startPoint,o,!1):y=c.endPoint;c._rendered=!0}i.line(y,f,o,!1,!h)}},_findAngle:function(n,t){var i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)*(180/Math.PI)},_adjustPoint:function(n,i,r,u){var f=r?{x:n.x,y:n.y}:{x:i.x,y:i.y},e;return n.x==i.x?n.y<i.y&&r||n.y>i.y&&!r?f.y+=u:f.y-=u:n.y==i.y?n.x<i.x&&r||n.x>i.x&&!r?f.x+=u:f.x-=u:r?(e=t.datavisualization.Diagram.Geometry.findAngle(n,i),f=t.datavisualization.Diagram.Geometry.transform(n,e,u)):(e=t.datavisualization.Diagram.Geometry.findAngle(i,n),f=t.datavisualization.Diagram.Geometry.transform(i,e,u)),f},renderLabels:function(n,t){for(var i,r,u=0;u<n.labels.length;u++)i=n.labels[u],r=t.document.getContext("2d"),r.save(),r.globalAlpha=i.opacity,r.lineWidth=i.borderWidth,r.strokeStyle=i.borderColor,i.text&&i.visible&&this._renderTextElement(n,i,t),r.restore()},renderPorts:function(n,i,r,u){for(var e,o,f,a,v,l,h,s=i.document.getContext("2d"),c=0;c<n.ports.length;c++)if(e=n.ports[c],!(e.visibility&t.datavisualization.Diagram.PortVisibility.Hidden||e.visibility&t.datavisualization.Diagram.PortVisibility.Hover||e.visibility&t.datavisualization.Diagram.PortVisibility.Connect)){o=t.datavisualization.Diagram.Util._getPortPosition(e,t.datavisualization.Diagram.Util.bounds(n,!0));o=this._scalePointforStretch(o,i);f=e.size*i._scaleY;s.fillStyle=e.fillColor;s.strokeStyle=e.borderColor;s.lineWidth=e.borderWidth;switch(e.shape){case"x":s.beginPath();s.moveTo(o.x-f/2,o.y-f/2);s.lineTo(o.x+f/2,o.y+f/2);s.moveTo(o.x+f/2,o.y-f/2);s.lineTo(o.x-f/2,o.y+f/2);s.stroke();s.fill();s.closePath();break;case"circle":a=f/2;v=f/2;i.ellipse(o.x,o.y,a,v);break;case"square":i.rect(o.x-f/2,o.y-f/2,f,f);break;case"path":s.save();n._type=="group"?(s.translate(offsetX,n.offsetY),s.rotate(-n.rotateAngle*Math.PI/180),s.translate(-offsetX,-n.offsetY),n.rotateAngle&&(l={angle:n.rotateAngle,x:e._absolutePoint.x,y:e._absolutePoint.y}),h=e._absolutePath,(i._scaleX!==1||i._scaleY!==1)&&(h=t.datavisualization.Diagram.Geometry.updatePath(e._absolutePoint.x,e._absolutePoint.y,f,f,h,i._diagram._svg,null,null)),i.path(h,0,0,f,f,l)):(r=o.x-n.width*e.offset.x,u=o.y-n.height*e.offset.y,h=e._absolutePath,(i._scaleX!==1||i._scaleY!==1)&&(h=t.datavisualization.Diagram.Geometry.updatePath(r,u,f,f,h,i._diagram._svg,null,null)),i.path(h,r,u,f,f,l));s.restore()}}},_renderTextElement:function(n,t,i){var f,u,r,e;t&&(f={childNodes:[]},u=i.document.getContext("2d"),u.save(),r="",t.italic&&(r+="italic "),t.bold&&(r+="bold "),r+=t.fontSize*i._scaleY+"px ",r+=t.fontFamily,u.font=r,e=this._wrapText(n,f,t,i),this._alignTextOnLabel(t,n,f,i,e),u.restore())},_alignTextOnLabel:function(n,i,r,u,f){var d=i.width||i._width||0,vt=i.height||i._height||0,o,h,e,it,b,rt,ut,ft,et,s,p,g,nt,st,w,l,ct,tt,lt,at;d*=u._scaleX;vt*=u._scaleY;o={width:f&&f.width||n.width,height:r.childNodes.length*n.fontSize*u._scaleY};h=t.datavisualization.Diagram.Util.bounds(i);h.width*=u._scaleX;h.height*=u._scaleY;h.x*=u._scaleX;h.y*=u._scaleY;rt=u._diagram;i.segments&&n.relativeMode=="segmentpath"?(ut=t.datavisualization.Diagram.SvgContext._getConnectorHandlePosition(n,i,1,rt),ft=this._scalePointforStretch(ut.position,u),e={x:(ft.x-h.x)/h.width,y:(ft.y-h.y)/h.height},et=t.datavisualization.Diagram.Util._alignLabelOnSegments(i,n,rt,ut),b=et.vAlign,it=et.hAlign):(it=n.horizontalAlignment,b=n.verticalAlignment);e=t.datavisualization.Diagram.Util._getLabelPosition(n,h,e);var c={x:0,y:0},y={x:e.x,y:e.y},k=0;k=b==t.datavisualization.Diagram.VerticalAlignment.Top?e.y+o.height/2:b==t.datavisualization.Diagram.VerticalAlignment.Center||b==t.datavisualization.Diagram.VerticalAlignment.Stretch?e.y:e.y-o.height/2;c.y=k;c.x=e.x;y.y=k;s=u.document.getContext("2d");n.textAlign=="justify"?r.childNodes.length>1?(s.textAlign="left",o.width=d-2*n.borderWidth):s.textAlign="center":s.textAlign=n.textAlign;switch(it){case t.datavisualization.Diagram.HorizontalAlignment.Left:y.x=e.x+o.width/2;switch(s.textAlign){case t.datavisualization.Diagram.TextAlign.Left:c.x=e.x;break;case t.datavisualization.Diagram.TextAlign.Center:c.x=e.x+o.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:c.x=e.x+o.width}break;case t.datavisualization.Diagram.HorizontalAlignment.Center:y.x=e.x;switch(s.textAlign){case t.datavisualization.Diagram.TextAlign.Left:c.x=e.x-o.width/2;break;case t.datavisualization.Diagram.TextAlign.Center:c.x=e.x;break;case t.datavisualization.Diagram.TextAlign.Right:c.x=e.x+o.width/2}break;case t.datavisualization.Diagram.HorizontalAlignment.Right:y.x=e.x-o.width/2;switch(s.textAlign){case t.datavisualization.Diagram.TextAlign.Left:c.x=e.x-o.width;break;case t.datavisualization.Diagram.TextAlign.Center:c.x=e.x-o.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:c.x=e.x}break;case t.datavisualization.Diagram.HorizontalAlignment.Stretch:y.x=e.x;c.x=e.x}g=h.x;nt=h.y;i.segments||(g=i.offsetX*u._scaleX-d*i.pivot.x,nt=i.offsetY*u._scaleY-vt*i.pivot.y);var a=n.borderWidth||0,ot=g+c.x+(f?f.x:0)-a/2,k=nt+c.y-o.height/2-a/2;for(n.verticalAlignment=="stretch"?u.rect(ot,h.y,o.width+a,h.height+a,null,{fill:n.fillColor&&!i._isHeader?n.fillColor:"transparent",stroke:a&&!i._isHeader?n.borderColor||"transparent":"transparent",lineWidth:a}):u.rect(ot,k,o.width+a,o.height+a,null,{fill:n.fillColor?n.fillColor:"transparent",stroke:a?n.borderColor||"transparent":"transparent",lineWidth:a}),p={angle:n.rotateAngle,x:g+y.x,y:nt+y.y},n.textAlign=="justify"&&(st=Math.max(d,n.width)-2*n.borderWidth),s.save(),s.translate(p.x,p.y),s.rotate(p.angle*Math.PI/180),s.translate(-p.x,-p.y),w=0;w<r.childNodes.length;w++){var v=r.childNodes[w],yt=ot+v.x-f.x+a/2,pt=k+v.dy*w+n.fontSize*u._scaleY*.8+a/2,ht=s.measureText(v.text).width;if(st>ht&&w<r.childNodes.length-1&&(l=v.text,l[l.length-1]==" "&&(l=l.slice(0,l.length-1)),l[0]==" "&&(l=l.slice(1,l.length)),ht=s.measureText(l).width,ct=l.split(" "),ct.length>1)){for(tt=(st-ht)/s.measureText(" ").width/(ct.length-1),tt=Math.round(tt),lt="",at=0;at<tt;at++)lt+=" ";v.text=l.replace(" ",lt)}if(n.horizontalAlignment=="stretch")switch(n.textAlign){case"left":v.x=e.x-o.width/2;break;case"center":v.x=-o.width/2;break;case"right":v.x=-e.x-o.width/2}u.text({text:v.text},yt-v.x,pt,null,{fill:n.fontColor});n.textDecoration!="none"&&this._renderTextDecoration(yt-v.x,pt,s.measureText(v.text).width,n,u)}s.restore()},_wrapText:function(n,i,r,u){var d=r.text,a,y,f,o,p,e,c,k;r.rotateAngle!=undefined?u&&u._diagram?(a=u._diagram.nameTable[n.parent],a&&a.isLane&&r.rotateAngle!==0?(f=t.datavisualization.Diagram.Util.bounds(n),y=f.width,f.width=f.height,f.height=y):f=t.datavisualization.Diagram.Util.bounds(n)):f=t.datavisualization.Diagram.Util.bounds(n):f=t.datavisualization.Diagram.Util.bounds(n);f.width*=u._scaleX;f.height*=u._scaleY;f.x*=u._scaleX;f.y*=u._scaleY;n.segments?(o=f.width,p=f.height):(o=f.width-r.margin.left-r.margin.right,p=f.height-r.margin.top-r.margin.bottom);o-=2*(r.borderWidth?r.borderWidth:1);o=o<r.width?r.width:o;for(var l=d.split("\n"),w,h,v=u.document.getContext("2d"),b=r.wrapping=="wrapwithoverflow"?!0:!1,s=0;s<l.length;s++)if(e="",r.wrapping!="nowrap")for(c=r.wrapping=="wrapwithoverflow"?l[s].split(" "):l[s],h=0;h<c.length;h++)e+=(e&&b?" ":"")+c[h],w=v.measureText(e).width,w>=o?(i.childNodes[i.childNodes.length]={text:e},e=""):(b&&(k=e+" "+(c[h+1]||""),v.measureText(k).width>o&&(i.childNodes[i.childNodes.length]={text:e},e="")),h==c.length-1&&(i.childNodes[i.childNodes.length]={text:e},e=""));else e+=l[s],i.childNodes[i.childNodes.length]={text:e};return this._wrapTextAlign(i,i.childNodes,r.fontSize*u._scaleY,r.textAlign,v,n,r,u)},_wrapTextAlign:function(n,i,r,u,f,e,o,s){var a,c,v=t.datavisualization.Diagram.Util.bounds(e),l,h;for(v.width*=s._scaleX,v.height*=s._scaleY,v.x*=s._scaleX,v.y*=s._scaleY,l=0;l<i.length;l++){if(h=f.measureText(i[l].text).width,a=h,o.horizontalAlignment=="stretch")a=v.width,h=-a/2;else switch(u){case"left":h=0;break;case"center":h=-h/2;break;case"right":h=-h;break;case"justify":h=i.length>1?0:-h/2}i[l].x=Number(h);i[l].dy=r;c?(c.x=Math.min(c.x,h),c.width=Math.max(c.width,a)):c={x:h,width:a}}return c},_renderTextDecoration:function(n,t,i,r,u){var f=u.document.getContext("2d"),e,o;f.save();f.strokeStyle=r.fontColor;f.lineWidth=1;switch(f.textAlign){case"center":n-=i/2;break;case"right":n-=i}t+=2;switch(r.textDecoration){case"overline":t-=r.fontSize*u._scaleY;break;case"line-through":t-=r.fontSize/2*u._scaleY}e={x:n,y:t};o={x:n+i,y:t};u.line(e,o,null);f.restore()},_renderGradient:function(n,t,i,r){var f,o,s,u,e,h;if(n.gradient){for(u=0;u<n.gradient.stops.length;u++)f=f?Math.max(f,n.gradient.stops[u].offset):n.gradient.stops[u].offset,o=o?Math.min(o,n.gradient.stops[u].offset):n.gradient.stops[u].offset;if(n.gradient.type=="linear")for(s=t.createLinearGradient(i+n.gradient.x1,r+n.gradient.y1,i+n.gradient.x2,r+n.gradient.y2),u=0;u<n.gradient.stops.length;u++)e=n.gradient.stops[u],h=o<0?(f+e.offset)/(2*f):e.offset/f,s.addColorStop(h,e.color);else if(n.gradient.type=="radial")for(s=t.createRadialGradient(i+n.gradient.fx,r+n.gradient.fy,0,i+n.gradient.cx,r+n.gradient.cy,n.gradient.r),u=0;u<n.gradient.stops.length;u++)e=n.gradient.stops[u],h=o<0?(f+e.offset)/(2*f):e.offset/f,s.addColorStop(h,e.color);t.fillStyle=s}},_renderDecorators:function(n,i){var u,f,e=i._diagram,o,r,s;n.targetDecorator&&n.targetDecorator.shape&&(r=n.segments[n.segments.length-1],u=r.points[r.points.length-2],f=n.targetPoint,r.type=="bezier"&&(u=r._point2),n.targetNode&&e&&(o=e._findNode(n.targetNode),o&&o.borderColor!="none"&&(f=t.datavisualization.Diagram.Util._adjustPoint(f,u,!0,o.borderWidth/2))),this._renderDecorator(n.name+"_targetDecorator",f,u,n.targetDecorator,i));n.sourceDecorator&&n.sourceDecorator.shape&&(r=n.segments[0],u=n.sourcePoint,f=r.points[1],r.type=="bezier"&&(f=r._point1),n.sourceNode&&e&&(s=e._findNode(n.sourceNode),s&&s.borderColor!="none"&&(u=t.datavisualization.Diagram.Util._adjustPoint(u,f,!0,s.borderWidth/2))),this._renderDecorator(n.name+"_sourceDecorator",u,f,n.sourceDecorator,i))},_renderDecorator:function(n,i,r,u,f){var v,e=this._scalePointforStretch(i,f),y=this._scalePointforStretch(r,f),o=new t.datavisualization.Diagram.Size(Number(u.width*f._scaleY),Number(u.height*f._scaleY)),h=f.document.getContext("2d"),c,s,l,a;h.fillStyle=u.fillColor;h.strokeStyle=u.borderColor=="none"?"transparent":u.borderColor;h.lineWidth=u.borderWidth;c=t.datavisualization.Diagram.Geometry.findAngle(e,y);s={angle:c,x:e.x,y:e.y};switch(u.shape){case"arrow":f.arrow(e,s,o);break;case"openarrow":f.arrow(e,s,o,!0);break;case"circle":l=o.width/2;a=o.height/2;f.ellipse(e.x+o.width/2,e.y,l,a,s);break;case"diamond":f.diamond(e,s,o);break;case"path":f.path(u._absolutePath,0,0,o.width,o.height,s)}return v},_updatePolygonPoints:function(n,i){var u=[],f,e,o,r,h,c;if(n.points){for(f=n.width||n._width||0,e=n.height||n._height||0,f*=i._scaleX,e*=i._scaleY,r=0;r<n.points.length;r++)o=n.points[r],u.push({x:o.x,y:o.y});if(u.length){this._scalePoints(u,n,i);var s=t.datavisualization.Diagram.Geometry.rect(u),l=n.offsetX*i._scaleX-f*n.pivot.x-s.x,a=n.offsetY*i._scaleY-e*n.pivot.y-s.y;for(r=0,h=u.length;r<h;++r)c=t.datavisualization.Diagram.Geometry.translate(u[r],l,a),u[r]=c}}return u},_scalePoints:function(n,i,r){var f=t.datavisualization.Diagram.Geometry.rect(n),e,o,s,h,u,c;if(f.width>0&&f.height>0)for(e=i.width||i._width||0,o=i.height||i._height||0,e*=r._scaleX,o*=r._scaleY,s=e/f.width,h=o/f.height,u=0,c=n.length;u<c;++u)n[u].x=n[u].x*s,n[u].y=n[u].y*h},updateNode:function(n,t){this.refreshCanvas(n,t)},updateConnector:function(n,t){this.refreshCanvas(n,t)},updateGroup:function(n,t){this.refreshCanvas(n,t)},refreshCanvas:function(n,t){var r=t.document.getContext("2d"),u,i;for(r.save(),view.scale&&r.scale(1/view.scale.x,1/view.scale.y),u={x:t.document.offsetLeft,y:t.document.offsetTop,width:t.document.offsetWidth,height:t.document.offsetHeight},r.clearRect(u.x,u.y,u.width,u.height),view.scale&&r.scale(view.scale.x,view.scale.y),r.restore(),i=0;i<n.nodes.length;i++)n.nodes[i]._type==="node"?this.renderNode(n.nodes[i],t):n.nodes[i]._type==="group"&&this.renderGroup(n.nodes[i],t);for(i=0;i<n.connectors.length;i++)this.renderConnector(n.connectors[i],t)},updateViewport:function(){},addNodeLabel:function(n,t){this.refreshCanvas(n,t)},updateLabel:function(n,t){this.refreshCanvas(n,t)},setNodeShape:function(n,t){this.refreshCanvas(n,t)},setLine:function(n,t){this.refreshCanvas(n,t)},renderDecorators:function(n,t){this.refreshCanvas(n,t)},clearDecorators:function(n,t){this.refreshCanvas(n,t)},updateTargetDecoratorStyle:function(n,t){this.refreshCanvas(n,t)},updateSourceDecoratorStyle:function(n,t){this.refreshCanvas(n,t)},_updateNodeStyle:function(n,t){this.refreshCanvas(n,t)},updateLabelStyle:function(n,t){this.refreshCanvas(n,t)},updateConnectorStyle:function(n,t){this.refreshCanvas(n,t)},updateTextBlock:function(n,t,i){this.refreshCanvas(n,i)},removeChild:function(){this.refreshCanvas(model,canvas)}}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t,i,r;(function(n){n[n.Line="line"]="Line";n[n.Column="column"]="Column";n[n.Area="area"]="Area";n[n.WinLoss="winloss"]="WinLoss";n[n.Pie="pie"]="Pie"})(n.Type||(n.Type={}));t=n.Type,function(n){n[n.flatlight="flatlight"]="flatlight";n[n.azurelight="azurelight"]="azurelight";n[n.limelight="limelight"]="limelight";n[n.saffronlight="saffronlight"]="saffronlight";n[n.gradientlight="gradientlight"]="gradientlight";n[n.flatdark="flatdark"]="flatdark";n[n.azuredark="azuredark"]="azuredark";n[n.limedark="limedark"]="limedark";n[n.saffrondark="saffrondark"]="saffrondark";n[n.gradientdark="gradientdark"]="gradientdark"}(n.Themes||(n.Themes={}));i=n.Themes;r=function(r){function u(u,f){r.call(this);this.defaults={locale:null,enableGroupSeparator:!1,enableCanvasRendering:!1,padding:8,palette:["#8A2BE2","#ff1a75","#99cc00","#4d4dff","#660066","#FFA500","#FFD700","#FF00FF","#808000","#990000"],isResponsive:!0,dataSource:null,xName:"",yName:"",type:t.Line,width:1,stroke:null,opacity:1,fill:"#33ccff",border:{color:"transparent",width:1},rangeBandSettings:{startRange:null,endRange:null,opacity:.4,color:"transparent"},highPointColor:null,lowPointColor:null,negativePointColor:null,startPointColor:null,endPointColor:null,tooltip:{visible:!1,template:null,fill:"white",border:{width:1,color:null},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",color:"#111111",opacity:1,size:"8px"}},markerSettings:{visible:!1,fill:null,width:2,opacity:1,border:{color:"white",width:1}},background:"transparent",size:{height:"",width:""},axisLineSettings:{visible:!1,color:"#111111",width:1,dashArray:""},theme:i.flatlight,load:null,loaded:null,sparklineMouseMove:null,sparklineMouseLeave:null,seriesRendering:null,pointRegionMouseMove:null,pointRegionMouseClick:null,tooltipInitialize:null};this.dataTypes={dataSource:"data",palette:"array",type:"enum",theme:"enum"};this.model=null;this.svgLink="http://www.w3.org/2000/svg";this._id=null;this.negativePointIndexes=[];this.validTags=["div"];this._id=u;!f||(this.model=n.compareExtend({},f,this.defaults))}return __extends(u,r),u.prototype.isTouch=function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},u.prototype.browserInfo=function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},u.prototype.fadeOut=function(n){var t=1,i=setInterval(function(){t<=.1&&(clearInterval(i),n.parentNode?n.parentNode.removeChild(n):n);n.style.opacity=t;n.style.filter="alpha(opacity="+t*100+")";t-=t*.1},50)},u.prototype._setModel=function(t){var i;for(i in t)switch(i){default:n.deepExtend(!0,this.model,{},t[i])}this.redraw()},u.prototype.unBindEvents=function(){var t=document.getElementById(this.rootId),n="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove",f;n=e+" "+o;n=n.split(" ");for(f in n)t.removeEventListener(n[f],this.sparkMouseMove);t.removeEventListener("mouseout",this.sparkMouseLeave)},u.prototype.bindEvents=function(n){var f;this.sparkMouseMove=this.sparkMouseMove.bind(this);this.sparkMouseLeave=this.sparkMouseLeave.bind(this);var t="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove";t=e+" "+o;t=t.split(" ");for(f in t)n.addEventListener(t[f],this.sparkMouseMove);n.addEventListener("mouseout",this.sparkMouseLeave)},u.prototype.sparkMouseMove=function(n){var ci=this.isTouch(n),rt,si,di,kt,hi,ti,ii,et;if(!(ci&&n.type.toString().toLowerCase().indexOf("move")>-1)){var t=this.model,ot=this,ri=t.locale,li=ri&&t.enableGroupSeparator,ai,vi,ui=this.visiblePoints,yi=this.container.id+"_markerExplode",st,g,h,nt,l,y,lt=t.enableCanvasRendering?0:3,at="",s,u,p,w,b,vt=parseInt(t.size.height),tt=parseInt(t.size.width),e=t.tooltip.font,yt="#point.x#",pt="#point.y#",a=this.container.id+"_tooltip",gi=document.getElementById(a),pi,k=t.tooltip.border.color,wt=document.getElementById(this.container.id),fr=wt.clientHeight,nr=wt.parentNode,it=wt.getClientRects()[0],ht=it.top,ct=it.left,fi=n.clientX||(n.changedTouches?n.changedTouches[0].clientX:n.touches?n.touches[0].clientX:0),wi=n.clientY||(n.changedTouches?n.changedTouches[0].clientY:n.touches?n.touches[0].clientY:0),ei=ui.map(function(n){return n.location.X+it.left}),er=ui.map(function(n){return n.location.markerPos+it.top}),i=Infinity,oi=this.measureText,bi,o=this.model.markerSettings,bt,d,v,ki,r,f,tr=document.getElementById(this.container.id+"_canvasTracker");for(rt=0,di=ei.length;rt<di;rt++)si=Math.abs(fi-ei[rt]),i>si&&(i=si,bt=ei[rt],this.pointIndex=rt);if(fi>ct&&fi<ct+it.width&&wi>ht&&wi<ht+it.height)if(i=ui[this.pointIndex].location,kt=function(n){bi=n.length/2;var o=oi(n,e);s=o.height+4;u=o.width+bi;r=i.X;f=i.markerPos;f-s/2<0?f+=s/2:f+s/2>vt&&(f-=s/2);r+u+u/10>tt-t.padding?(r=i.X-Number(t.markerSettings.width)-Number(t.markerSettings.border.width)-4,at="M "+r+" "+i.markerPos+" L "+(r-u/10)+" "+(f-4)+" L "+(r-u/10)+" "+(f-s/2)+" L "+(r-u-u/10)+" "+(f-s/2)+" L "+(r-u-u/10)+" "+(f+s/2)+" L "+(r-u/10)+" "+(f+s/2)+" L "+(r-u/10)+" "+(f+4)+" Z"):(r=i.X+Number(t.markerSettings.width)+Number(t.markerSettings.border.width)+4,at="M "+r+" "+i.markerPos+" L "+(r+u/10)+" "+(f-4)+" L "+(r+u/10)+" "+(f-s/2)+" L "+(r+u+u/10)+" "+(f-s/2)+" L "+(r+u+u/10)+" "+(f+s/2)+" L "+(r+u/10)+" "+(f+s/2)+" L "+(r+u/10)+" "+(f+4)+" Z")},(t.tooltip.template==null||t.tooltip.template=="")&&(ai=li&&i.Xval?i.Xval.toLocaleString(ri):i.Xval,vi=li&&i.Yval?i.Yval.toLocaleString(ri):i.Yval,h=" X : "+ai+" Y : "+vi+" ",kt(h)),st=this.pointIndex,this.prevMousePos==undefined&&(this.prevMousePos=bt),hi=function(n){var i=ot.highPointIndex,r=ot.lowPointIndex,u=ot.negativePointIndexes,f=ot.startPointIndex,e=ot.endPointIndex;return n==i?t.highPointColor:n==r?t.lowPointColor:n==f&&t.startPointColor!=null?t.startPointColor:n==e&&t.endPointColor!=null?t.endPointColor:u.indexOf(n)>=0&&t.negativePointColor!=null?t.negativePointColor:o.fill?o.fill:t.fill},gi||tr){if(this.prevMousePos!=bt){if(p={data:{pointIndex:st,currentText:h,location:i}},this.model.tooltipInitialize!=null&&this._trigger("tooltipInitialize",p),pi=i.X-t.width/2,h!=p.data.currentText&&(h=p.data.currentText,kt(h)),this.prevMousePos=bt,b=hi(st),nt={id:yi,cx:i.X,cy:i.markerPos,r:Number(o.width),fill:o.border.color,stroke:b,"stroke-width":Number(o.border.width)},t.tooltip.template==null||t.tooltip.template=="")l={id:a,fill:t.tooltip.fill,stroke:k!=null?k:b,"stroke-width":t.tooltip.border.width,d:at},y={x:i.X+u+u/10>tt-t.padding?r+lt-u-u/10:r+lt+u/10,y:f+s/4,fill:e.color,"font-size":e.size,"font-family":e.fontFamily,"font-weight":e.fontWeight,"font-style":e.fontStyle};else{var dt=document.getElementById(t.tooltip.template),ut=dt.innerHTML,ut=ut.replace(yt," "+i.Xval+" "),ut=ut.replace(pt," "+i.Yval+" "),ft=dt.innerText,gt=Number(t.markerSettings.width),ft=ft.replace(yt," "+i.Xval+" "),ft=ft.replace(pt," "+i.Yval+" "),c=oi(ft,e),ni=i.X+Number(o.width)+Number(o.border.width)+gt;f=ht+i.markerPos-c.height/2;r=ct+ni;i.markerPos-c.height/2<t.padding?f+=c.height/2:i.markerPos+c.height/2>vt-t.padding&&(f-=c.height/2);ni+c.width>tt-t.padding&&(r=r-c.width-(Number(o.width)+Number(o.border.width)+gt)*2);l={background:t.tooltip.fill,border:t.tooltip.border.width+"px solid "+(k!=null?k:b),left:r+"px",top:f+"px"};w=document.getElementById(a);w.innerHTML=ut;this.setStyles(l,w)}t.enableCanvasRendering?(d=document.getElementById(this.container.id+"_canvasTracker"),v=d.getContext("2d"),v.clearRect(0,0,tt,vt),this.canvasDrawCircle(nt,v),(t.tooltip.template==null||t.tooltip.template=="")&&(this.canvasDrawPath(l,v),y.font=e.size+" "+e.fontFamily,this.canvasDrawText(y,h,v))):(ti=document.getElementById(a+"_g"),this.drawCircle(nt,ti),t.tooltip.template==null&&(this.drawPath(l,ti),g=wt.getElementsByTagName("text")[0],g.textContent=h,this.setAttributes(y,g),ti.appendChild(g)))}}else{if(p={data:{pointIndex:st,currentText:h,location:i}},this.model.tooltipInitialize!=null&&this._trigger("tooltipInitialize",p),pi=i.X-t.width/2,h!=p.data.currentText&&(h=p.data.currentText,kt(h)),ii=document.getElementsByClassName("ej-sparkline-tooltip"),ii[0]&&ii[0].parentNode.removeChild(ii[0]),b=hi(st),nt={id:yi,cx:i.X,cy:i.markerPos,r:Number(o.width),fill:o.border.color,stroke:b,"stroke-width":Number(o.border.width)},t.tooltip.template==null||t.tooltip.template=="")l={id:a,fill:t.tooltip.fill,stroke:k!=null?k:b,"stroke-width":t.tooltip.border.width,d:at},y={x:i.X+u+u/10>tt-t.padding?r+lt-u-u/10:r+lt+u/10,y:f+s/4,fill:e.color,opacity:e.opacity,"font-size":e.size,"font-family":e.fontFamily,"font-weight":e.fontWeight,"font-style":e.fontStyle};else{var dt=document.getElementById(t.tooltip.template),ut=dt.innerHTML,ut=ut.replace(yt," "+i.Xval+" "),ut=ut.replace(pt," "+i.Yval+" "),ft=dt.innerText,gt=Number(t.markerSettings.width),ft=ft.replace(yt," "+i.Xval+" "),ft=ft.replace(pt," "+i.Yval+" "),c=oi(ft,e),ni=i.X+Number(o.width)+Number(o.border.width)+gt;f=ht+i.markerPos-c.height/2;r=ct+ni;i.markerPos-c.height/2<t.padding?f+=c.height/2:i.markerPos+c.height/2>vt-t.padding&&(f-=c.height/2);ni+c.width>tt-t.padding&&(r=r-c.width-(Number(o.width)+Number(o.border.width)+gt)*2);l={background:t.tooltip.fill,border:t.tooltip.border.width+"px solid "+(k!=null?k:b),left:r+"px",top:f+"px",position:"fixed",height:"auto",width:"auto",display:"block",opacity:e.opacity,font:e.size+" "+e.fontFamily};w=document.createElement("div");this.setAttributes({id:a,"class":"ej-sparkline-tooltip"},w);this.setStyles(l,w);w.innerHTML=ut;nr.appendChild(w)}t.enableCanvasRendering?(d=document.createElement("canvas"),ki={id:this.container.id+"_canvasTracker",fill:"transparent","class":"ej-sparkline-tooltip",height:t.size.height,width:t.size.width},this.setAttributes(ki,d),this.setStyles({left:ct+"px",top:ht+"px",position:"fixed"},d),v=d.getContext("2d"),this.canvasDrawCircle(nt,v),(t.tooltip.template==null||t.tooltip.template=="")&&(this.canvasDrawPath(l,v),y.font=e.size+" "+e.fontFamily,this.canvasDrawText(y,h,v)),this.container.parentNode.appendChild(d)):(et=document.createElementNS(this.svgLink,"g"),this.setAttributes({id:a+"_g","class":"ej-sparkline-tooltip"},et),this.container.appendChild(et),this.drawCircle(nt,et),t.tooltip.template==null&&(this.drawPath(l,et),g=this.createText(y,h),et.appendChild(g)))}if(ci){var ir=t.tooltip.template==null||t.tooltip.template==""?t.enableCanvasRendering?this.container.id+"_canvasTracker":a+"_g":a,rr=document.getElementById(ir),ur=this;setTimeout(function(){ur.fadeOut(rr)},1e3)}}},u.prototype.sparkMouseLeave=function(n){var f=n.clientX||(n.touches[0]?n.touches[0].clientX:n.changedTouches[0].clientX),e=n.clientY||(n.touches[0]?n.touches[0].clientY:n.changedTouches[0].clientY),o=this.container,v=o.clientHeight,r=o.getClientRects()[0],s=r.top,h=r.left,c=this.model,l=this.container.id+"_tooltip",t,a,u,i;(f<h||f>h+r.width||e<s||e>s+r.height||this.touchEnd)&&(c.tooltip.template!=null&&c.tooltip.template!=""&&(t=document.getElementById(l),t?t.parentNode.removeChild(t):t),this.model.enableCanvasRendering?(i=document.getElementById(this.container.id+"_canvasTracker"),i?i.parentNode.removeChild(i):i):(a=l+"_g",u=document.getElementById(a),u?this.container.removeChild(u):u))},u.prototype.bindPieEvents=function(n){var f;this.pieTooltip=this.pieTooltip.bind(this);this.pieTooltipHide=this.pieTooltipHide.bind(this);var t="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove";t=e+" "+o;t=t.split(" ");for(f in t)n.addEventListener(t[f],this.pieTooltip);n.addEventListener("mouseout",this.pieTooltipHide);this.model.pointRegionMouseClick!=null&&(n.addEventListener("click",this.pieTooltip),n.addEventListener("touchstart",this.pieTooltip))},u.prototype.unbindPieEvents=function(){var n="",t=this.browserInfo(),i=t.isMSPointerEnabled,r=t.pointerEnabled,e=i?r?"pointerup":"MSPointerUp":"touchend mouseup",o=i?r?"pointermove":"MSPointerMove":"touchmove mousemove",u=document.getElementById(this.rootId),f;n=e+" "+o;n=n.split(" ");for(f in n)u.removeEventListener(n[f],this.pieTooltip);u.removeEventListener("mouseout",this.pieTooltipHide)},u.prototype.pieTooltip=function(n){var y=this.isTouch(n),e,ot,i,s,st,ht;if(y&&n.stopImmediatePropagation(),!(y&&n.type.toString().toLowerCase().indexOf("move")>-1)){this.model.sparklineMouseMove!=null&&this._trigger("sparklineMouseMove");var t=this.model,h=n.clientX||(n.changedTouches?n.changedTouches[0].clientX:n.touches?n.touches[0].clientX:0),yt=parseInt(t.size.height),pt=parseInt(t.size.width),u=t.tooltip.font,c=n.clientY||(n.changedTouches?n.changedTouches[0].clientY:n.touches?n.touches[0].clientY:0),d=document.getElementById(this.container.id),wt=d.parentNode,g=d.getClientRects()[0],ct=g.top,lt=g.left,bt=this.visiblePoints.map(function(n){return n.coordinates}),nt=this.visiblePoints.map(function(n){return n.location}),at=this.visiblePoints.radius,tt=this.visiblePoints.centerPos,p=this.visiblePoints,it,rt,f,w=h-(tt.X+lt),b=c-(tt.Y+ct),o=Math.atan2(b,w),ut=this.container.id+"_pieTooltip",r=document.getElementById(ut),l,a=t.tooltip.border.color,vt=Math.sqrt(w*w+b*b),k=t.pointRegionMouseClick!=null?"pointRegionMouseClick":t.pointRegionMouseMove!=null?"pointRegionMouseMove":null,v=t.palette,ft=t.locale,et=t.enableGroupSeparator;if(Math.abs(vt)<=at)for(e=0,ot=p.length;e<ot;e++)it=p[e].stAng,rt=p[e].endAng,o=o<0?6.283+o:o,o<=rt&&o>=it&&(f=e,(k=="pointRegionMouseClick"&&(n.type=="click"||n.type=="touchstart")||k=="pointRegionMouseMove")&&this._trigger(k,{data:{pointIndex:e,seriesType:"Pie",locationX:h,locationY:c}}));else r&&r.parentNode.removeChild(r);r&&f!=null?(i=nt[f].Percent.toFixed(2),i=et?" "+parseFloat(i).toLocaleString(ft):i+" % ",s=this.measureText(i,u),l={left:h+12+"px",top:c+"px",border:t.tooltip.border.width+"px solid "+(a!=null?a:v[f%v.length]),"background-color":t.tooltip.fill,height:s.height+"px",width:s.width+"px"},this.setStyles(l,r),r.innerHTML=i):f!=null&&(r=document.createElement("div"),i=nt[f].Percent.toFixed(2),i=et?" "+parseFloat(i).toLocaleString(ft):i+" % ",s=this.measureText(i,u),l={left:h+12+"px",top:c+"px","background-color":t.tooltip.fill,color:u.color,border:t.tooltip.border.width+"px solid "+(a!=null?a:v[f%v.length]),height:s.height+"px",width:s.width+"px","font-size":u.size,opacity:u.opacity,"font-weight":u.fontWeight,"font-family":u.fontFamily,"font-style":u.fontStyle,"z-index":"100000",position:"fixed"},r.setAttribute("id",ut),this.setStyles(l,r),r.innerHTML=i,document.body.appendChild(r));y&&(this.touchEnd=!0,st=document.getElementById(this.container.id+"_pieTooltip"),ht=this,setTimeout(function(){ht.fadeOut(st)},500))}},u.prototype.pieTooltipHide=function(){if(!this.touchEnd){this.model.sparklineMouseLeave!=null&&this._trigger("sparklineMouseLeave");var t=this.container.id+"_pieTooltip",n=document.getElementById(t);n?document.body.removeChild(n):n}},u.prototype.bindRegionEvents=function(n){this.sparklineEvent=this.sparklineEvent.bind(this);var t=this.findBrowser();(t=="IE"||t=="firefox")&&(n.style["touch-action"]="none");this.model.pointRegionMouseMove!=null&&(n.addEventListener("mousemove",this.sparklineEvent,!0),n.addEventListener("touchmove",this.sparklineEvent,!0));this.model.pointRegionMouseClick!=null&&(n.addEventListener("click",this.sparklineEvent,!0),n.addEventListener("touchstart",this.sparklineEvent,!0));this.model.sparklineMouseMove!=null&&(n.addEventListener("mousemove",this.sparklineEvent,!0),n.addEventListener("touchmove",this.sparklineEvent,!0));this.model.sparklineMouseLeave!=null&&(this.sparklineLeave=this.sparklineLeave.bind(this),n.addEventListener("mouseout",this.sparklineLeave,!0),t=="firefox"&&n.addEventListener("mouseup",this.sparklineLeave,!0),n.addEventListener("touchend",this.sparklineLeave,!0))},u.prototype.sparklineLeave=function(){this.model.sparklineMouseLeave!=null&&this._trigger("sparklineMouseLeave")},u.prototype.sparklineEvent=function(n){var i,p;this.model.sparklineMouseMove!=null&&this._trigger("sparklineMouseMove");var s=this.model,l=n.clientX||n.touches[0].clientX,a=n.clientY||n.touches[0].clientY,u=s.type,r=this.visiblePoints,f,e,v,y,o,h,w=document.getElementById(this.container.id),g=w.parentNode,b=w.getClientRects()[0],k=b.top,d=b.left,c;if(c=s.pointRegionMouseClick!=null?"pointRegionMouseClick":s.pointRegionMouseMove!=null?"pointRegionMouseMove":null,u==t.Line||u==t.Area)for(o=2*(s.markerSettings.width+s.markerSettings.border.width),h=o,i=0,p=r.length;i<p;i++)f=d+r[i].location.X-o/2,e=k+r[i].location.Y-h/2,v=f+o,y=e+h,l>=f&&l<=v&&a>=e&&a<=y&&c!=null&&this._trigger(c,{data:{pointIndex:i,seriesType:u,locationX:r[i].location.X,locationY:r[i].location.Y}});else if(u==t.Column||u==t.WinLoss)for(o=r[0].location.width,i=0,p=r.length;i<p;i++)h=r[i].location.height,f=d+r[i].location.X,e=k+r[i].location.Y,v=f+o,y=e+h,l>=f&&l<=v&&a>=e&&a<=y&&c!=null&&this._trigger(c,{data:{pointIndex:i,seriesType:u,locationX:r[i].location.X,locationY:r[i].location.Y}})},u.prototype.findBrowser=function(){return navigator.userAgent.indexOf("Firefox")!=-1?"firefox":navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0?"IE":null},u.prototype.resize=function(){var t=this,n=document.getElementById(this.rootId);n!=null||n!=undefined?(window.removeEventListener("resize",this.resize),this._destroy(),this.createSvg(),this.renderSparkline()):window.removeEventListener("resize",this.resize)},u.prototype.supportsSvg=function(){return!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg")},u.prototype._init=function(){this.supportsSvg()&&(this.rootId=this.rootId!=null?this.rootId:this._id,this.parentElement=this.parentElement!=null?this.parentElement:document.getElementById(this.rootId),this.model.load!=null&&this._trigger("load"),this.setTheme(this.model),this.height=parseInt(this.model.size.height),this.width=parseInt(this.model.size.width),this.createSvg(),this.renderSparkline(),this.model.loaded!=null&&this._trigger("loaded"))},u.prototype.redraw=function(){this.emptyContainer();this.renderSparkline()},u.prototype.touchCheck=function(n){this.touchEnd=!0;this.model.type.toString().toLocaleLowerCase()!="pie"?this.sparkMouseLeave(n):this.pieTooltipHide(n)},u.prototype.emptyContainer=function(){var t=this.model,n;if(t.enableCanvasRendering)this.ctx.clearRect(0,0,this.height,this.width);else for(n=this.container;n.firstChild;)n.removeChild(n.firstChild)},u.prototype._destroy=function(){var n=document.getElementById(this.container.id);n!=null?(this.unBindEvents(),this.unbindPieEvents(),window.removeEventListener("resize",this.resize),n.parentNode.removeChild(n)):window.removeEventListener("resize",this.resize)},u.prototype.renderSparkline=function(){this.setStyles({background:this.model.background},this.container);this.calculatePoints();this.seriesRender();this.resize=this.resize.bind(this);this.model.isResponsive?window.addEventListener("resize",this.resize):window.removeEventListener("resize",this.resize);this.model.type!=t.WinLoss&&this.model.type!=t.Pie&&this.model.tooltip.visible?this.bindEvents(this.parentElement):this.unBindEvents();this.model.type==t.Pie&&this.model.tooltip.visible?this.bindPieEvents(this.parentElement):this.unbindPieEvents();this.bindRegionEvents(this.parentElement)},u.prototype.animateSparkline=function(){function ht(){n<=a?r.setAttribute("width",n.toString()):(clearInterval(it),h._trigger("animationComplete"));n=n+i}function ct(){f=u-n;n>=0?(r.setAttribute("y",n.toString()),r.setAttribute("height",f)):(clearInterval(ut),h._trigger("animationComplete"));n=n-i}function lt(){n<=u?r.setAttribute("height",n.toString()):(clearInterval(rt),h._trigger("animationComplete"));n=n+i}function at(){f=(l-n)*2;n>=-i?(r.setAttribute("y",n<0?0:n.toString()),r.setAttribute("height",f)):(clearInterval(ft),h._trigger("animationComplete"));n=n-i}function vt(){n<=v.length-1?(d=90,et=v[n].location.Degree,ot+=et+(n==0?d:0),b=(d-90)*Math.PI/180,p=(ot-90)*Math.PI/180,n==v.length-1&&(p-=.0001),f={sX:o.X+s*Math.cos(b),sY:o.Y+s*Math.sin(b),eX:o.X+s*Math.cos(p),eY:o.Y+s*Math.sin(p)},k="M "+o.X+" "+o.Y+" L "+f.eX+" "+f.eY+" A "+s+" "+s+" 0 1,0 "+f.sX+" "+f.sY+" Z",r.setAttribute("d",k)):(clearInterval(st),h._trigger("animationComplete"));n+=1}var y=this.model,h=this,c=y.type,g=y.padding,l=this.axisHeight,a=parseInt(y.size.width),u=parseInt(y.size.height),n,f,i,nt=document.createElementNS(this.svgLink,"defs"),w=document.createElementNS(this.svgLink,"clipPath"),e,tt,r,it,rt,ut,ft,st;if(r=c==t.Pie?document.createElementNS(this.svgLink,"path"):document.createElementNS(this.svgLink,"rect"),c==t.Line||c==t.Area)e={id:"clipRectSparkline",x:0,y:0,width:0,height:u},i=a/10,it=setInterval(ht,120),n=i;else if(c==t.Column||c==t.WinLoss)l==g?(e={id:"clipRectSparkline",x:0,y:0,width:a,height:0},i=u/10,n=i,rt=setInterval(lt,120)):l==u-g?(e={id:"clipRectSparkline",x:0,y:u,width:a,height:0},i=u/10,n=u,ut=setInterval(ct,120)):(e={id:"clipRectSparkline",x:0,y:l,width:a,height:0},i=u/10,n=l,ft=setInterval(at,120));else{var v=this.visiblePoints,o=v.centerPos,s=v.radius,et,b,p,k="",d=90,ot=0;n=0;e={id:"clipRectSparkline",d:k};st=setInterval(vt,120)}tt={id:this.container.id+"_sparklineRect"};this.setAttributes(e,r);this.setAttributes(tt,w);w.appendChild(r);nt.appendChild(w);this.container.appendChild(nt)},u.prototype.setTheme=function(n){var r=n.theme,t=this.defaults;r==i.flatdark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#B5B5B5":n.fill,n.stroke=n.stroke==t.stroke?"#F6D321":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#AAAAAA":n.axisLineSettings.color):r==i.gradientlight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#F34649":n.fill,n.stroke=n.stroke==t.stroke?"#597B15":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#8E8E8E":n.axisLineSettings.color):r==i.gradientdark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#005378":n.fill,n.stroke=n.stroke==t.stroke?"#6A9319":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#AAAAAA":n.axisLineSettings.color):r==i.azuredark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#007fff":n.fill,n.stroke=n.stroke==t.stroke?"#f0ffff":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#336699":n.axisLineSettings.color):r==i.azurelight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#336699":n.fill,n.stroke=n.stroke==t.stroke?"#007fff":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#336699":n.axisLineSettings.color):r==i.limedark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#238f23":n.fill,n.stroke=n.stroke==t.stroke?"#32CD32":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#43da21":n.axisLineSettings.color):r==i.limelight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#238f23":n.fill,n.stroke=n.stroke==t.stroke?"#32CD32":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#43da21":n.axisLineSettings.color):r==i.saffrondark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#ffaa33":n.fill,n.stroke=n.stroke==t.stroke?"#ffdba9":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#ffc26e":n.axisLineSettings.color):r==i.saffronlight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#ffaa33":n.fill,n.stroke=n.stroke==t.stroke?"#ffdba9":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#ffc26e":n.axisLineSettings.color):(r==null||r==i.flatlight)&&(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#33ccff":n.fill,n.stroke=n.stroke==t.stroke?"#33ccff":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#FF0000":n.axisLineSettings.color)},u.prototype.createSvg=function(){var r=this.model,n=this.parentElement,u,f=parseInt(n.style.height)>n.clientHeight?parseInt(n.style.height):n.clientHeight,e=parseInt(n.style.width)>n.clientWidth?parseInt(n.style.width):n.clientWidth,t=parseInt(r.size.width),i=parseInt(r.size.height);i=i>0?i:f>0?f:30;t=t>0?t:e>0?e:50;r.size.height=i.toString();r.size.width=t.toString();this.height=i;this.width=t;u={id:this.rootId+"_sparkline_svg",width:t,height:i};r.enableCanvasRendering?(this.container=document.createElement("canvas"),this.ctx=this.container.getContext("2d")):this.container=document.createElementNS(this.svgLink,"svg");this.setAttributes(u,this.container);n.appendChild(this.container)},u.prototype.setStyles=function(n,t){for(var r=Object.keys(n),u,f=r.map(function(t){return n[t]}),i=0,e=r.length;i<e;i++)u=r[i],t.style[u]=f[i]},u.prototype.setAttributes=function(n,t){for(var r=Object.keys(n),u=r.map(function(t){return n[t]}),i=0,f=r.length;i<f;i++)t.setAttribute(r[i],u[i])},u.prototype.getDefaultPoints=function(n){for(var t=[],i=1;i<=n;i++)Math.random()*10>5&&t.push(-Math.round(Math.random()*100)),t.push(Math.round(Math.random()*100));return t},u.prototype.calculatePoints=function(){var n=this.model,l=n.type,r=n.dataSource!=null?n.dataSource:this.getDefaultPoints(12),e,y,s,w,k,ft=[],h=r.length,o,d=0,a,et,c,i,ut,ot;if(Array.isArray(r)&&typeof r[0]!="object")if(n.type==t.Pie)for(i=0;i<h;i++)d+=Math.abs(r[i]);else y=Math.max.apply(null,r),s=Math.min.apply(null,r),w=0,k=h-1;else if(n.type==t.Pie)for(i=0;i<h;i++)d+=Math.abs(r[i][n.yName]);else r[0][n.xName]?(o=r,o=o.sort(function(t,i){return t[n.yName]-i[n.yName]}),y=o[o.length-1][n.yName],s=o[0][n.yName]):(a=r.map(function(t){return t[n.yName]}),y=Math.max.apply(null,a),s=Math.min.apply(null,a)),r[0][n.xName]?(o=o.sort(function(t,i){return t[n.xName]-i[n.xName]}),k=o[o.length-1][n.xName],w=o[0][n.xName]):(w=0,k=h-1);if(n.type!=t.Pie){this.maxLength=h;var c,b=Number(n.padding),u=parseInt(n.size.height)-b*2,tt=parseInt(n.size.width)-b*2,g=k-w,p=y-s,g=g==0?1:g;p=p==0?1:p;this.min=s;this.unitX=g;this.minX=w;this.unitY=p;this.max=y;this.maxX=k;var it=0,v=u-u/p*-s,f,v=s<0&&y<0?0:s<0&&y>0?v:u;this.axisHeight=v+b;l!=t.WinLoss&&n.axisLineSettings.visible&&this.drawAxis()}for(i=0;i<h;i++){if(r[i][n.xName]||r[i][n.yName]?r[i][n.xName]?(a=r[i][n.xName],e=r[i][n.yName]):(a=i,e=r[i][n.yName]):(a=i,e=r[i]),l==t.Line||l==t.Area)f=h!=1?u-Math.round(u*((e-s)/p)):0,c={X:h!=1?Math.round(tt*((a-w)/g)):tt/2,Y:f,markerPos:f};else if(l==t.Column||l==t.WinLoss){var nt=tt/h,rt=.5*2;nt-=rt;it=i*(nt+rt)+rt/2;l==t.WinLoss?(ut=.5,ot=40,f=e>0?u/4:e<0?u*ut:u*ut-u/ot,c={X:it,Y:f,height:e!=0?u/4:u/20,width:nt}):(f=h!=1?u-u/p*(e-s):0,c={X:it,Y:f>v?v:f,height:Math.abs(f-v),width:nt,markerPos:f>v?v+Math.abs(f-v):f})}else l==t.Pie&&(et=Math.abs(e)/d*100,c={Percent:et,Degree:Math.abs(e)/d*360});l!=t.Pie&&(c.X+=b,c.Y+=b);l!=t.WinLoss&&(c.markerPos+=b);c.Xval=a;c.Yval=e;ft.push({location:c})}this.visiblePoints=ft},u.prototype.seriesRender=function(){var i=this.model,r=this.visiblePoints,f=r.length,u,n=i.type;u={data:{minX:this.minX,minY:this.min,maxX:this.maxX,maxY:this.max,xName:i.xName,yName:i.yName,pointsCount:f,seriesType:n,visiblePoints:this.visiblePoints}};this.model.seriesRendering!=null&&this._trigger("seriesRendering",u);n==t.Line?this.drawLineSeries(r):n==t.Area?this.drawAreaSeries(r):n==t.Column?this.drawColumnSeries(r):n==t.WinLoss?this.drawWinlossSeries(r):n==t.Pie&&this.drawPieSeries();i.markerSettings.visible&&n!=t.WinLoss&&n!=t.Pie&&this.drawMarker(r);i.rangeBandSettings.startRange!=null&&i.rangeBandSettings.endRange!=null&&n!=t.WinLoss&&n!=t.Pie&&this.drawRangeBand()},u.prototype.drawPieSeries=function(){var n=this.model,r=this.visiblePoints,i,c,b,y;n.padding=n.padding==this.defaults.padding?2:n.padding;var nt=r.length,l=parseInt(n.size.height)-n.padding*2,a=parseInt(n.size.width)-n.padding*2,u=l<=a?l/2:a/2,f,e,t={X:a/2,Y:l/2},o,p,v,w=n.palette,s=0,k=n.border.color,d=n.opacity,g=n.border.width,h;for(r.centerPos=t,r.radius=u,i=0,c=90;i<r.length;i++)c+=s,s=r[i].location.Degree,b=c+s,f=(c-90)*Math.PI/180,e=(b-90)*Math.PI/180,r[i].stAng=f,r[i].endAng=e,y=s<180?"0":"1",o=r[i].coordinates={sX:t.X+u*Math.cos(f),sY:t.Y+u*Math.sin(f),eX:t.X+u*Math.cos(e),eY:t.Y+u*Math.sin(e)},p="M "+t.X+" "+t.Y+" L "+o.eX+" "+o.eY+" A "+u+" "+u+" 0 "+y+",0 "+o.sX+" "+o.sY+" Z",v={id:this.container.id+"_pieBase"+i,fill:w[i%w.length],stroke:k,opacity:d,"stroke-width":g,d:p,start:e,end:f,x:t.X,y:t.Y,counterClockWise:y,radius:u},n.enableCanvasRendering?this.canvasDrawPath(v):(h=this.createGroup({id:"sparkpieSeries"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},h),this.container.appendChild(h),this.drawPath(v,h))},u.prototype.drawRangeBand=function(){var n=this.model,t=parseInt(n.size.height)-n.padding*2,f=parseInt(n.size.width)-n.padding*2,o=n.rangeBandSettings.startRange,s=n.rangeBandSettings.endRange,i=Number(t-t/this.unitY*(o-this.min))+n.padding,r=Number(t-t/this.unitY*(s-this.min))+n.padding,u,e;r=r>Number(t+n.padding)?Number(t+n.padding):r<0+n.padding?0+n.padding:r;i=i>Number(t+n.padding)?Number(t+n.padding):i<0+n.padding?0+n.padding:i;e="M "+n.padding+" "+i+" L "+(f+Number(n.padding))+" "+i+" L "+(f+Number(n.padding))+" "+r+" L "+n.padding+" "+r+" Z";u={id:this.container.id+"_rangeBand",fill:n.rangeBandSettings.color,opacity:n.rangeBandSettings.opacity,stroke:"transparent","stroke-width":n.border.width,d:e};n.enableCanvasRendering?this.canvasDrawPath(u):this.drawPath(u)},u.prototype.drawAxis=function(){var n=this.model,r=this.axisHeight,u=n.axisLineSettings.color,f=n.type,i;f!=t.WinLoss&&f!=t.Pie&&(n.axisLineSettings.visible||(u="transparent"),i={id:this.container.id+"_Sparkline_XAxis",x1:0+n.padding,y1:r,x2:parseInt(n.size.width)-n.padding,y2:r,stroke:u,"stroke-dasharray":n.axisLineSettings.dashArray,"stroke-width":n.axisLineSettings.width},n.enableCanvasRendering?this.canvasDrawLine(i):this.drawLine(i))},u.prototype.drawColumnSeries=function(t){var f,u,r=this.model,c=t.length,w=n.compareExtend({},[],t),b=r.border.width,l,k=r.opacity,a,d=r.fill,g=r.border.color,o=r.highPointColor,s=r.lowPointColor,v=r.startPointColor,y=r.endPointColor,p=r.negativePointColor,e,h,i;for((o||s)&&(h=w.map(function(n){return n.location.markerPos}),a=Math.min.apply(null,h),l=Math.max.apply(null,h)),r.enableCanvasRendering==!1&&(e=this.createGroup({id:this.container.id+"sparkcolumnSeries"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},e),this.container.appendChild(e)),i=0;i<c;i++)u=t[i].location,f={id:this.container.id+"_column_series_"+i,x:u.X,y:u.Y,height:u.height,width:u.width,fill:d,stroke:g,opacity:k,"stroke-width":b},u.markerPos==a&&o?(f.fill=o,this.highPointIndex=i):u.markerPos==l&&s?(f.fill=s,this.lowPointIndex=i):i==0&&v?(f.fill=v,this.startPointIndex=i):i==c-1&&y?(f.fill=y,this.endPointIndex=i):u.markerPos>=this.axisHeight&&p&&(f.fill=p,this.negativePointIndexes.push(i)),r.enableCanvasRendering?this.canvasDrawRectangle(f):this.drawRect(f,e),u.X+=u.width/2},u.prototype.drawWinlossSeries=function(n){var f,i,t=this.model,s=t.border.width,e=t.padding,h=t.border.color,c=t.opacity,l=n.length,o=parseInt(t.size.height)-e*2,u,r;for(t.enableCanvasRendering==!1&&(u=this.createGroup({id:this.container.id+"sparkwinlossSeries"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},u),this.container.appendChild(u)),r=0;r<l;r++)i=n[r].location,f={id:this.container.id+"_winloss_series_"+r,x:i.X,y:i.Y,height:i.height,width:i.width,fill:i.Y<o/2+e?i.Y>o/4+e?"#EE82EE":t.fill:t.negativePointColor?t.negativePointColor:"#FF0000",stroke:h,opacity:c,"stroke-width":s},t.enableCanvasRendering?this.canvasDrawRectangle(f):this.drawRect(f,u)},u.prototype.drawAreaSeries=function(n){for(var r="",e=this.axisHeight,t=this.model,f,u,i=0,o=n.length;i<o;i++)i==0&&(r="M "+n[0].location.X+" "+e+" "),r+="L "+n[i].location.X+" "+n[i].location.Y+" ",i==o-1&&(r+="L "+n[i].location.X+" "+e+" Z");f={id:this.container.id+"_area_series_fill",fill:t.fill,stroke:t.stroke?t.stroke:t.fill,"fill-opacity":t.opacity,"stroke-width":t.width,d:r};t.enableCanvasRendering?this.canvasDrawPath(f):(u=this.createGroup({id:"sparkAreaSeries"}),this.container.appendChild(u),this.drawPath(f,u),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},u))},u.prototype.drawLineSeries=function(n){for(var f,u="",t=this.model,r,i=0,e=n.length;i<e;i++)i==0&&(u="M "+n[0].location.X+" "+n[i].location.Y+" "),u+="L "+n[i].location.X+" "+n[i].location.Y+" ";f={id:this.container.id+"_Line_series",fill:"transparent",stroke:t.stroke?t.stroke:t.fill,opacity:t.opacity,"stroke-width":t.width,d:u};t.enableCanvasRendering?this.canvasDrawPath(f):(r=this.createGroup({id:"sparklineSeries"}),this.container.appendChild(r),this.drawPath(f,r),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},r))},u.prototype.drawMarker=function(i){var a=i.length,f,o=this.model.markerSettings,u=this.model,g=n.compareExtend({},[],i),nt=o.fill?o.fill:u.fill,tt=o.border.color,v=o.width,it=o.opacity,y=o.border.width,e,p,w,h=u.highPointColor,c=u.lowPointColor,b=u.startPointColor,k=u.endPointColor,d=u.negativePointColor,s,l,r,rt;for(u.enableCanvasRendering==!1&&(s=this.createGroup({id:this.container.id+"sparkmarkers"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},s),this.container.appendChild(s)),(o.visible==!1||u.type==t.Pie||u.type==t.WinLoss)&&(v=0,y=0),(h||c)&&(l=g.map(function(n){return n.location.markerPos}),w=Math.min.apply(null,l),p=Math.max.apply(null,l)),r=0;r<a;r++)e=i[r].location,rt=e.width!=undefined?e.width/2:0,f={id:this.container.id+"_marker_"+r,cx:e.X,cy:e.markerPos,r:v,fill:nt,stroke:tt,opacity:it,"stroke-width":y},e.markerPos==w&&h?(f.fill=h,this.highPointIndex=r):e.markerPos==p&&c?(f.fill=c,this.lowPointIndex=r):r==0&&b?(f.fill=b,this.startPointIndex=r):r==a-1&&k?(f.fill=k,this.endPointIndex=r):e.markerPos>=this.axisHeight&&d&&(f.fill=d,this.negativePointIndexes.push(r)),this.model.enableCanvasRendering?this.canvasDrawCircle(f):this.drawCircle(f,s)},u.prototype.drawLine=function(n){var t=document.getElementById(n.id);t||(t=document.createElementNS(this.svgLink,"line"));this.setAttributes(n,t);this.container.appendChild(t)},u.prototype.drawCircle=function(n,t){t=!t?this.container:t;var i=document.getElementById(n.id);i||(i=document.createElementNS(this.svgLink,"circle"));this.setAttributes(n,i);t.appendChild(i)},u.prototype.drawPolyLine=function(n){var t=document.getElementById(n.id);t||(t=document.createElementNS(this.svgLink,"polyline"));this.setAttributes(n,t);this.container.appendChild(t)},u.prototype.drawPath=function(n,t){t=!t?this.container:t;var i=document.getElementById(n.id);i||(i=document.createElementNS(this.svgLink,"path"));this.setAttributes(n,i);t.appendChild(i)},u.prototype.drawRect=function(n,t){t=!t?this.container:t;var i=document.getElementById(n.id);i||(i=document.createElementNS(this.svgLink,"rect"));this.setAttributes(n,i);t.appendChild(i)},u.prototype.createGroup=function(n){var t=document.createElementNS(this.svgLink,"g");return this.setAttributes(n,t),t},u.prototype.createText=function(n,t){var i=document.createElementNS(this.svgLink,"text");return this.setAttributes(n,i),t&&(i.textContent=t),i},u.prototype.canvasDrawLine=function(n,t){var i=t?t:this.ctx;i.save();i.beginPath();i.lineWidth=n["stroke-width"];i.strokeStyle=n.stroke;i.moveTo(n.x1,n.y1);i.lineTo(n.x2,n.y2);i.stroke();i.restore();this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawRectangle=function(n,t){var i=t?t:this.ctx,u=t?t:this.ctx,r;i.save();i.beginPath();i.globalAlpha=n.opacity;i.lineWidth=n["stroke-width"];r=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1;r&&this.ctx.setLineDash(r);i.strokeStyle=n.stroke;i.rect(n.x,n.y,n.width,n.height);n.fill=="none"&&(n.fill="transparent");i.fillStyle=n.fill;i.fillRect(n.x,n.y,n.width,n.height);i.stroke();i.restore();i=u;this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawPath=function(n,t){var c=n.d,u=c.split(" "),h=n["stroke-width"],i=t?t:this.ctx,l=t?t:this.ctx,o,s,r,f,e;for(i.save(),i.beginPath(),i.globalAlpha=n.opacity?n.opacity:n["fill-opacity"],o=!0,i.lineWidth=h,s=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1,s&&i.setLineDash(s),i.strokeStyle=n.stroke,r=0;r<u.length;r=r+3){f=parseFloat(u[r+1]);e=parseFloat(u[r+2]);switch(u[r]){case"M":n.innerR||n.cx||i.moveTo(f,e);break;case"L":n.innerR||i.lineTo(f,e);break;case"C":i.bezierCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]),parseFloat(u[r+5]),parseFloat(u[r+6]));r=r+4;break;case"A":n.innerR?o&&(i.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),i.arc(n.x,n.y,n.innerR,n.end,n.start,!n.counterClockWise),o=!1):n.cx?i.arc(n.cx,n.cy,n.radius,0,2*Math.PI,n.counterClockWise):(i.moveTo(n.x,n.y),i.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),i.lineTo(n.x,n.y));r=r+5;break;case"Z":i.closePath()}}n.fill!="none"&&n.fill!=undefined&&(i.fillStyle=n.fill,i.fill());h>0&&i.stroke();i.restore();i=l;this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawCircle=function(n,t){var i=t?t:this.ctx,u=t?t:this.ctx,r;i.save();i.beginPath();i.arc(n.cx,n.cy,n.r,0,2*Math.PI);i.fillStyle=n.fill;i.globalAlpha=n.opacity;i.fill();i.lineWidth=n["stroke-width"];r=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1;r&&i.setLineDash(r);i.strokeStyle=n.stroke;i.stroke();i.restore();i=u;this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawPolyline=function(n,t){var i=t?t:this.ctx,u,r;for(i.save(),i.beginPath(),u=n.points.split(" "),r=0;r<u.length-1;r++){var f=u[r].split(","),e=f[0],o=f[1];r==0?i.moveTo(e,o):i.lineTo(e,o)}i.lineWidth=n["stroke-width"];i.strokeStyle=n.stroke;i.stroke();i.restore();this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawText=function(n,t,i){var e=n.font,u=n["text-anchor"],o=n.opacity!==undefined?n.opacity:1,r,f;u=="middle"&&(u="center");r=i?i:this.ctx;r.save();r.fillStyle=n.fill;r.font=e;r.textAlign=u;r.globalAlpha=o;n.baseline&&(r.textBaseline=n.baseline);f=0;n.labelRotation==90&&n.id.indexOf("XLabel")!=-1&&(f=r.measureText(t).width);r.translate(n.x+f/2,n.y);r.rotate(n.labelRotation*Math.PI/180);r.fillText(t,0,0);r.restore();this.dataURL=this.container.toDataURL()},u.prototype.measureText=function(n,t){var e=document.getElementById("measureTex"),i,u,f,r;e&&e.clientHeight!=0?i=e:(i=document.createElement("text"),i.setAttribute("id","measureTex"),document.body.appendChild(i));var o=null,s=null,h=null,c=null;if(typeof n=="string"&&(n.indexOf("<")>-1||n.indexOf(">")>-1)){for(u=n.split(" "),f=0;f<u.length;f++)u[f].indexOf("<br/>")==-1&&(u[f]=u[f].replace(/[<>]/g,"&"));n=u.join(" ")}return i.innerHTML=n,t!=undefined&&t.size==undefined&&(r=t,r=r.split(" "),o=r[0],s=r[1],h=r[2],c=r[3]),t!=null&&(i.style.fontSize=t.size>0?t.size+"px":t.size?t.size:s,i.style.fontStyle&&(i.style.fontStyle=t.fontStyle?t.fontStyle:o),i.style.fontFamily=t.fontFamily?t.fontFamily:h,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(i.style.fontWeight=t.fontWeight?t.fontWeight:c)),i.style.backgroundColor="white",i.style.position="absolute",i.style.top="-100px",i.style.left="0px",i.style.visibility="hidden",i.style.whiteSpace="nowrap",{width:i.offsetWidth,height:i.offsetHeight}},u}(ej.WidgetBase);n.Sparkline=r;ej.widget("ejSparkline","ej.Sparkline",new r);n.deepExtend=function(t){var u,i,r;for(t=t||{},u=1;u<arguments.length;u++)if(i=arguments[u],i)for(r in i)i.hasOwnProperty(r)&&(t[r]=typeof i[r]=="object"?n.deepExtend(t[r],i[r]):i[r]);return t};n.compareExtend=function(t,i,r){var e,o,u,f;if(typeof r=="object"&&r!==null)for(e=Object.keys(r),o=e.length,f=0;f<o;f++)u=e[f],i.hasOwnProperty(u)&&i[u]!=null?(Array.isArray(i[u])||typeof i[u]=="object"&&i[u]!==null)&&n.compareExtend({},i[u],r[u]):i[u]=r[u];return i}}(ejSparkline||(ejSparkline={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var s,v,h,y,r,e,i,t,l,u,f,p,o,c,w,a;(function(n){n[n.left="left"]="left";n[n.right="right"]="right";n[n.center="center"]="center"})(n.sunburstHorizontalAlignment||(n.sunburstHorizontalAlignment={}));s=n.sunburstHorizontalAlignment,function(n){n[n.circle="circle"]="circle";n[n.diamond="diamond"]="diamond";n[n.cross="cross"]="cross";n[n.pentagon="pentagon"]="pentagon";n[n.rectangle="rectangle"]="rectangle";n[n.triangle="triangle"]="triangle"}(n.sunburstLegendShape||(n.sunburstLegendShape={}));v=n.sunburstLegendShape,function(n){n[n.top="top"]="top";n[n.bottom="bottom"]="bottom";n[n.middle="middle"]="middle"}(n.sunburstVerticalAlignment||(n.sunburstVerticalAlignment={}));h=n.sunburstVerticalAlignment,function(n){n[n.flatlight="flatlight"]="flatlight";n[n.flatdark="flatdark"]="flatdark"}(n.sunburstTheme||(n.sunburstTheme={}));y=n.sunburstTheme,function(n){n[n.opacity="opacity"]="opacity";n[n.color="color"]="color"}(n.sunburstHighlightType||(n.sunburstHighlightType={}));r=n.sunburstHighlightType,function(n){n[n.rotation="rotation"]="rotation";n[n.fadeIn="fadeIn"]="fadeIn"}(n.sunburstAnimationType||(n.sunburstAnimationType={}));e=n.sunburstAnimationType,function(n){n[n.opacity="opacity"]="opacity";n[n.color="color"]="color"}(n.sunburstSelectionType||(n.sunburstSelectionType={}));i=n.sunburstSelectionType,function(n){n[n.top="top"]="top";n[n.bottom="bottom"]="bottom";n[n.left="left"]="left";n[n.right="right"]="right";n[n.float="float"]="float"}(n.sunburstLegendPosition||(n.sunburstLegendPosition={}));t=n.sunburstLegendPosition,function(n){n[n.none="none"]="none";n[n.toggleSegmentVisibility="toggleSegmentVisibility"]="toggleSegmentVisibility";n[n.toggleSegmentSelection="toggleSegmentSelection"]="toggleSegmentSelection"}(n.sunburstLegendClickAction||(n.sunburstLegendClickAction={}));l=n.sunburstLegendClickAction,function(n){n[n.near="near"]="near";n[n.far="far"]="far";n[n.center="center"]="center"}(n.sunburstAlignment||(n.sunburstAlignment={}));u=n.sunburstAlignment,function(n){n[n.point="point"]="point";n[n.all="all"]="all";n[n.child="child"]="child";n[n.parent="parent"]="parent"}(n.sunburstHighlightMode||(n.sunburstHighlightMode={}));f=n.sunburstHighlightMode,function(n){n[n.point="point"]="point";n[n.all="all"]="all";n[n.child="child"]="child";n[n.parent="parent"]="parent"}(n.sunburstSelectionMode||(n.sunburstSelectionMode={}));p=n.sunburstSelectionMode,function(n){n[n.trim="trim"]="trim";n[n.hide="hide"]="hide";n[n.none="none"]="none"}(n.sunburstLabelOverflowMode||(n.sunburstLabelOverflowMode={}));o=n.sunburstLabelOverflowMode,function(n){n[n.angle="angle"]="angle";n[n.normal="normal"]="normal"}(n.sunburstLabelRotationMode||(n.sunburstLabelRotationMode={}));c=n.sunburstLabelRotationMode,function(n){n[n.center="center"]="center";n[n.near="near"]="near";n[n.far="far"]="far"}(n.titleAlignment||(n.titleAlignment={}));w=n.titleAlignment;a=function(a){function w(w,b){a.call(this);this.defaults={enableAnimation:!1,load:null,preRender:null,loaded:null,dataLabelRendering:null,titleRendering:null,tooltipInitialize:null,pointRegionClick:null,drillDownClick:null,drillDownBack:null,drillDownReset:null,pointRegionMouseMove:null,legendItemRendering:null,legendItemClick:null,segmentRendering:null,animationType:e.rotation,palette:null,opacity:1,valueMemberPath:null,margin:{top:10,bottom:10,left:10,right:10},points:{x:null,y:null,text:null,fill:null},border:{color:null,width:2},segmentBorder:{color:null,width:2},startAngle:null,endAngle:null,dataSource:null,isResponsive:!0,size:{height:"",width:""},innerRadius:.4,radius:1,tooltip:{visible:!1,border:{color:"#707070",width:1},fill:"#FFFFFF",opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",color:"#707070",opacity:1,size:"12px"},template:null,format:"#point.x# : #point.y#"},dataLabelSettings:{visible:!1,labelRotationMode:c.angle,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",color:null,opacity:1,size:"12px"},template:null,fill:null,labelOverflowMode:o.trim},title:{text:"",textAlignment:u.center,font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"20px"},subtitle:{visible:!0,textAlignment:u.far,text:"",font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"12px"}},visible:!0},zoomSettings:{enable:!1,toolbarHorizontalAlignment:s.right,toolbarVerticalAlignment:h.top},highlightSettings:{enable:!1,mode:f.point,opacity:.5,color:"red",type:r.opacity},selectionSettings:{enable:!1,mode:p.point,opacity:.5,color:"green",type:i.opacity},levels:null,legend:{clickAction:l.toggleSegmentVisibility,visible:!1,position:t.bottom,rowCount:null,columnCount:null,shape:v.circle,alignment:u.center,title:{font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"12px"},text:"",textAlignment:u.center,visible:!0},itemStyle:{height:7.5,width:7.5},itemPadding:10,size:{height:null,width:null},border:{color:null,width:1},font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"12px"},location:{x:null,y:null}},theme:y.flatlight,background:null};this.model=null;this.svgLink="http://www.w3.org/2000/svg";this.elementSpacing=10;this._id=null;this._legendHighlight=!1;this.legendClicked=!1;this._legendMaxWidth=0;this._legendMaxHeight=0;this._drillInnerRadius=[];this._drillOuterRadius=[];this.common={data:null,cancel:!1};this.legendPages=[];this.groupID=[];this.highlightgroupID=[];this.selectedgroupID=[];this.baseID=null;this._previousState=[];this._drillDownStartAngle=[];this._drillDownEndAngle=[];this._sunburstRedraw=!1;this._isDoubleClickEvent=!1;this.tapCount=0;this.drilldownCount=0;this.tapped=0;this._points=[];this.visiblePoints=[];this.parentNames=[];this.levelNames=[];this.isResize=!1;this.revAnimation=!1;this.validTags=["div"];this._id=w;!b||(this.model=n.compareExtend({},b,this.defaults))}return __extends(w,a),w.prototype._destroy=function(){var n;n=document.getElementById(this.container.id);this.isNullOrUndefined(n)||(this.unBindEvents(this.parentElement),this.unbindResizeEvents(),n.parentNode.removeChild(n))},w.prototype.unBindEvents=function(n){var t="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove",f;t=o;t=t.split(" ");for(f in t)n.removeEventListener(t[f],this.sunburstMousemove),n.removeEventListener(e,this.sunburstLeave);n.removeEventListener("mouseout",this.sunburstLeave)},w.prototype.unbindResizeEvents=function(){ej.isTouchDevice()&&this._isOrientationSupported()?window.removeEventListener("orientationchange",this.sunBurstResize):window.removeEventListener("resize",this.sunBurstResize)},w.prototype._setModel=function(t){for(var i in t)switch(i){default:n.deepExtend(!0,this.model,{},t[i])}this.redraw()},w.prototype.supportSVG=function(){return!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg")},w.prototype._init=function(){if(this.supportSVG()){var n=void 0,r=void 0,t=void 0,i=void 0;this._startAngle=this.model.startAngle;this._endAngle=this.model.endAngle;this.isResize||(this._enableAnimation=this.model.enableAnimation,this._drillDownStartAngle=[],this._drillDownEndAngle=[],this._drillInnerRadius=[],this._drillOuterRadius=[]);r=$.extend({},this.common);this._trigger("load",r);this.parentElement=this.isNullOrUndefined(this.parentElement)?document.getElementById(this._id):this.parentElement;n=this.createSvg({id:this._id+"_svg"});this.container=n;this.parentElement.appendChild(n);this.setSvgsize(this.model.size,this._id);this._sunburstRedraw==!1&&this.bindEvents(this.parentElement);this.isResize?this.isResize=this.isResize?!1:!0:(!this.isNullOrUndefined(this.model.dataSource)&&this.model.dataSource.length>0&&this.processDataSource(this.model.dataSource),this.setColors(this.model.points),this._previousState.push(this.model.points),this.processData(this.model.points));t=$.extend({},this.common);t.data={};this._trigger("preRender",t);this.drawSunburst(this.layerData);this._isDrillDown&&this.drawToolbar(n);i=$.extend({},this.common);i.data={model:this.model};this._trigger("loaded",i)}else alert("Sunburst will not be support in IE version < 8")},w.prototype.drawSunburst=function(n){var s,h,f,t,o,i=this.model.title,c=this.model.legend,l=this.model.dataLabelSettings,v=this.model.enableAnimation,r,u,a;s=this.drawContainerRect();document.getElementById(this._id+"_svg").appendChild(s);c.visible&&!this.legendClicked&&this.calculateLegendBounds();o={width:this.width,height:this.height};i.text!=""&&i.visible&&(h=this.drawTitle(i,o),document.getElementById(this._id+"_svg").appendChild(h));this.areaBounds=this.calculateSize(o,i);f=this.sunburstRender(n);document.getElementById(this._id+"_svg").appendChild(f);this._enableAnimation&&(r=void 0,this.groupingRegions(this.model.points),this.animationRegions.length>0&&(this.model.animationType==e.rotation?this._isDrillDown?this.rotateDrillDownAnimation(this,this.animationRegions):this.rotateAnimation(this,this.animationRegions):(this.totallayerCount>1?(u=this.animationRegions[0].length,r=this.animationRegions[0][u-1].endAngle):(u=this.animationRegions.length,r=this.animationRegions[u-1][0].endAngle),this.animateLayer(this,f,this.animationRegions[0],0,0,r))));l.visible&&(t=this.drawDatalabel(n),l.template==null?(this._enableAnimation&&t.setAttribute("visibility","hidden"),document.getElementById(this._id+"_svg").appendChild(t)):this._enableAnimation&&(document.getElementById(t.id).style.visibility="hidden"),this.sunburstDoubleClick=this.sunburstDoubleClick.bind(this),document.getElementById(t.id).addEventListener("dblclick",this.sunburstDoubleClick,!0));c.visible&&(this.gLegendEle=this.createGroup({id:this._id+"SunburstLegend"}),this.model.legendInitialize&&(a=$.extend({},this.common),this._trigger("legendInitialize",a)),this.drawSunburstLegend())},w.prototype.animateLayer=function(n,t,i,r,u,f){var h=i[r].startAngle,o=i[r].endAngle,w,e,a,g,nt,c,b,k,s,v=h,l,y,p=0,d=50;w=(o-h)/Math.ceil(d*(o-h)/f);y=n.model.opacity/2/Math.ceil(d*(o-h)/f);e=i[r];this.layeranim=setInterval(function(){a=e.layerNumber;g=e.layerIndex;nt=e.pointIndex;k=n.circularRadius[a-1];l=e.id;v=v+w;c=v;e.endAngle=c>o?o:c;n.isNullOrUndefined(n.model)?clearInterval(n.layeranim):(b=n.calculateArcData(e,a,k),s=t.querySelector("#"+l),p+=y,s&&(s.setAttribute("d",b.Direction),s.setAttribute("opacity",p.toString())),document.getElementById(l).getAttribute("visibility")=="hidden"&&document.getElementById(l).setAttribute("visibility","visible"),c>=o&&(clearInterval(n.layeranim),n.fadeIn(s,p,n,y),r=r+1,r<i.length?n.animateLayer(n,t,i,r,u,f):(r=0,u=u+1,u<n.animationRegions.length?n.animateLayer(n,t,n.animationRegions[u],r,u,f):n.model.dataLabelSettings.visible&&(document.getElementById(n._id+"_svg_DataLabelGroup").style.visibility="visible"))))},10)},w.prototype.fadeIn=function(n,t,i){var r=setInterval(function(){t=t+.1;n.setAttribute("opacity",t.toString());(i.model==null||t>=i.model.opacity)&&clearInterval(r)},50)},w.prototype.rotateAnimation=function(n,t){var y=t.length,r=0,e,h,u,f,l,i=0,a,v,o,c,s=0;l=document.getElementById(n._id+"_svg");f=n.model.startAngle||0;u=n.model.endAngle||360;o=Math.abs(u-f);c=10/o;r=20/360*o+f;y>0&&(this.rotateanim=setInterval(function(){if(n.model){if(e=document.getElementById(n._id+"_svg_SunBurstElementGroup"),e!=null&&e.parentNode.removeChild(e),n.model.startAngle=f,n.model.endAngle=r>u?u:r,n._enableAnimation=!1,h=n.sunburstRender(n.layerData),l.appendChild(h),i=i+c,i=i>1?1:i,a=n.width/2*(1-i),v=n.height/2*(1-i),h.setAttribute("transform","translate("+a+","+v+") scale("+i+")"),r>=u&&(clearInterval(n.rotateanim),n.rotateanim=undefined,n._enableAnimation=!0,n.model.startAngle=f,n.model.endAngle=u,n.model.dataLabelSettings.visible)){var t=document.getElementById(n._id+"_svg_DataLabelGroup"),y=.1;n.model.dataLabelSettings.template==null?document.getElementById(n._id+"_svg").appendChild(t):document.getElementById(n._id).appendChild(t);t.style.visibility="visible";t.style.opacity=y.toString();n.datalabelanim=setInterval(function(){t.style.opacity=y.toString();y=y+.05;y>1&&clearInterval(n.datalabelanim)},10)}r=r+(10-s);s=s+.1;c=1/(o/10-s)}else clearInterval(n.rotateanim)},25))},w.prototype.rotateDrillDownAnimation=function(n,t){var w=t.length,s=0,h=0,c,l,i,r,a,f=0,v,y,o=1,u=.05,e=0,p;a=document.getElementById(n._id+"_svg");r=n.model.startAngle||0;i=n.model.endAngle||360;s=f=n._drillDownStartAngle[n.drilldownCount-1];h=e=n._drillDownEndAngle[n.drilldownCount-1];v=(s-r)/20;y=(i-h)/20;w>0&&(p=setInterval(function(){var t,w,b;c=document.getElementById(n._id+"_svg_SunBurstElementGroup");c.parentNode.removeChild(c);n.model.startAngle=f<r?r:f;n.model.endAngle=e>i?i:e;n._enableAnimation=!1;l=n.sunburstRender(n.layerData);a.appendChild(l);f<=r&&e>=i&&(clearInterval(p),n._enableAnimation=!0,n.model.startAngle=r,n.model.endAngle=i,n.model.dataLabelSettings.visible&&(t=document.getElementById(n._id+"_svg_DataLabelGroup"),w=.1,n.model.dataLabelSettings.template==null?document.getElementById(n._id+"_svg").appendChild(t):document.getElementById(n._id).appendChild(t),t.style.visibility="visible",t.style.opacity=w.toString(),b=setInterval(function(){t.style.opacity=w.toString();w=w+.05;w>1&&clearInterval(b)},10)));o=o+(1-u);u=u+.015;u=u>.7?.7:u;f=s-v*o;e=h+y*o},25))},w.prototype.groupingRegions=function(){var o=this.sunburstRegions,n,t,r=this.sunburstRegions[this.sunburstRegions.length-1].region,u=[],f,i;for(this.animationRegions=[],u.push(r),i=0;i<r.length;i++)o.length>1?(n=[],t=this.layerData[r[i].layerIndex].point[r[i].pointIndex],f=t.groupNumber,this.isNullOrUndefined(t.point)||this.findChildRegions(t.point,n,t.layerNumber,u,f),this.model.animationType==e.rotation?(n.splice(0,0,t),t.count=0,t.groupLength=n.length,this.animationRegions.push(n)):this.animationRegions=u):(n=[],n.push(r[i]),this.animationRegions.push(n))},w.prototype.findChildRegions=function(n,t,i,r,u){for(var f=0;f<n.length;f++)n[f].pointIndex=f,n[f].layerNumber=this.layerData[n.layerData].layerNumber,n[f].groupNumber=u,n[f].count=0,this.model.animationType==e.rotation?t.push(n[f]):(this.isNullOrUndefined(r[n[f].layerNumber-1])&&(r[n[f].layerNumber-1]=[]),r[n[f].layerNumber-1].push(n[f])),this.isNullOrUndefined(n[f].point)||this.findChildRegions(n[f].point,t,i,r,u)},w.prototype.bindEvents=function(n){var t="",i="",r=this.browserInfo(),u=ej.isDevice(),f=r.isMSPointerEnabled,e=r.pointerEnabled,s=f?e?"pointerup":"MSPointerUp":"touchend mouseup",h=f?e?"pointermove":"MSPointerMove":"touchmove mousemove",o;t=h;t=t.split(" ");this.sunburstMousemove=this.sunburstMousemove.bind(this);this.sunburstClick=this.sunburstClick.bind(this);n.addEventListener("click",this.sunburstClick,!0);this.sunburstLeave=this.sunburstLeave.bind(this);for(o in t)(n.addEventListener(s,this.sunburstLeave),i=t[o],u&&i=="mousemove")||n.addEventListener(i,this.sunburstMousemove);u&&n.addEventListener("mousedown",this.sunburstMousemove);n.addEventListener("mouseout",this.sunburstLeave,!0);this.getIEversion()!=-1&&(this.sunburstDoubletap=this.sunburstDoubletap.bind(this),n.addEventListener("pointerdown",this.sunburstDoubletap,!0));this.model.isResponsive&&this.bindResizeEvents()},w.prototype.browserInfo=function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},w.prototype.sunburstDoubletap=function(n){var t=n.target.id,i;t.indexOf("reset")==-1&&t.indexOf("back")==-1&&(n.preventDefault(),this.tapped=this.tapped+1,i=this.tapped)},w.prototype.bindResizeEvents=function(){this.sunBurstResize=this.sunBurstResize.bind(this);ej.isTouchDevice()&&this._isOrientationSupported()?window.addEventListener("orientationchange",this.sunBurstResize,!0):window.addEventListener("resize",this.sunBurstResize.bind(this),!0)},w.prototype._isOrientationSupported=function(){return"orientation"in window&&"onorientationchange"in window},w.prototype.sunBurstResize=function(){var n=this,t=$(n.container);this._resizeTO&&clearTimeout(this._resizeTO);this._resizeTO=setTimeout(function(){n.model&&(n.isResize=!0,n.isNullOrUndefined(document.getElementById(n._id+"reset"))||(n._isDrillDown=!0),n.legendClicked=!0,n._enableAnimation=!1,n.redraw(),n._enableAnimation=n.model.enableAnimation,n._isDrillDown=!1,n.legendClicked=!1)},500)},w.prototype.getIEversion=function(){var i=-1,n,t;return navigator.appName=="Microsoft Internet Explorer"?(n=navigator.userAgent,t=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),t.exec(n)!=null&&(i=parseFloat(RegExp.$1))):navigator.appName=="Netscape"&&(n=navigator.userAgent,t=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),t.exec(n)!=null&&(i=parseFloat(RegExp.$1))),i},w.prototype.sunburstDoubleClick=function(n){var t;this.model.zoomSettings.enable&&(t=this.getSunburstPoint(n),this.isNullOrUndefined(t)||(t.pointData[0].layerNumber==1?this.drilldownCount==0&&this.drillDown(t):this.drillDown(t)))},w.prototype.drillDown=function(n){var t,u=[],f,i,o,s,r,h,c;i=document.getElementById(this._id+"_svg");i.parentNode.replaceChild(i.cloneNode(!1),i);t=this.layerData[n.pointData[0].layerIndex].point[n.pointData[0].pointIndex];this.drilldownCount=this.drilldownCount+1;this._drillDownStartAngle.push(t.startAngle*180/Math.PI);this._drillDownEndAngle.push(t.endAngle*180/Math.PI);this._isDrillDown=!0;this._isDoubleClickEvent=!0;this.model.enableAnimation&&this.model.animationType==e.rotation&&(r=n.pointData[0].layerNumber,r==1?(this._drillInnerRadius.push(this.innerRadius),this._drillOuterRadius.push(this.circularRadius)):(h=this.innerRadius.slice(r-1,this.innerRadius.length),c=this.circularRadius.slice(r-1,this.circularRadius.length),this._drillInnerRadius.push(h),this._drillOuterRadius.push(c)));f={fill:n.pointData[0].fill,x:n.pointData[0].x,y:n.pointData[0].y,point:t.point,text:n.pointData[0].text};this.model.drillDownClick&&(o=$.extend({},this.common),o.data=f,this._trigger("drillDownClick",o));u.push(f);this._previousState.push(u);this.processData(u);this.drawSunburst(this.layerData);this._isDrillDown=!1;this.isNullOrUndefined(document.getElementById(this._id+"reset"))&&(s=document.getElementById(this._id+"_svg"),this.drawToolbar(s))},w.prototype.drawToolbar=function(n){var t,i,r;r=n.getBoundingClientRect();i=this.drawResetButton(r);n.appendChild(i);this.reset=this.reset.bind(this);document.getElementById(this._id+"reset").addEventListener("click",this.reset,!0);t=this.drawBackButton(r);n.appendChild(t);this.back=this.back.bind(this);document.getElementById(this._id+"back").addEventListener("click",this.back,!0);ej.isDevice()||(document.getElementById(this._id+"back").addEventListener("mousemove",this.sunburstMousemove,!0),document.getElementById(this._id+"reset").addEventListener("mousemove",this.sunburstMousemove,!0));this.toolbarPositioning(t,i)},w.prototype.toolbarPositioning=function(n,t){var e,o,u,f,c,r,i=this.elementSpacing,l=this.model.zoomSettings.toolbarHorizontalAlignment,a=this.model.zoomSettings.toolbarVerticalAlignment;r=n.getBoundingClientRect();c=t.getBoundingClientRect();l==s.right?(o=this.width-i-c.width,u=this.width-2*i-2*c.width):l==s.left?(u=i,o=r.width+2*i):l==s.center&&(u=this.width/2-(r.width+i+c.width)/2,o=u+i+r.width);a==h.top?f=i:a==h.bottom?f=this.height-i-r.height:a==h.middle&&(f=this.height/2-r.height/2);e="translate("+o.toString()+","+f.toString()+")";t.setAttribute("transform",e);e="translate("+u.toString()+","+f.toString()+")";n.setAttribute("transform",e)},w.prototype.drawBackButton=function(){var n,t,i;return i=this.createGroup({id:this._id+"back"}),n={id:this._id+"backPath",d:"M24,27H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h21c1.7,0,3,1.3,3,3v21C27,25.7,25.7,27,24,27z",fill:"#D6D6D6"},t=this.drawPath(n),i.appendChild(t),n={id:this._id+"backPath1",x:7.7,y:12.5,width:13.8,height:2,fill:"#5E5C5C"},t=this.drawRect(n),i.appendChild(t),n={id:this._id+"backPath2",points:"11.4,19.8 5.5,13.5 11.4,7.2 12.9,8.6 8.2,13.5 12.9,18.4",fill:"#5E5C5C"},t=this.drawPolygon(n),i.appendChild(t),i},w.prototype.back=function(){var f=this.layerData,n=document.getElementById(this._id+"_svg"),o=document.getElementById(this._id+"back"),s=document.getElementById(this._id+"reset"),u=this.model,t,i,r;this.revAnimation||(u.drillDownBack&&(i=$.extend({},this.common),i.data=f,this._trigger("drillDownBack",i)),this._enableAnimation&&u.animationType==e.rotation?(this._enableAnimation=!1,this.reverseAnimation(this,this.animationRegions)):(n.parentNode.replaceChild(n.cloneNode(!1),n),r=this._previousState.length-1,this.layerData=this._previousState[r-1],this._previousState.splice(r,1),this.drilldownCount=this.drilldownCount-1,this.processData(this.layerData),this.drawSunburst(this.layerData),this.drilldownCount!=0&&(t=document.getElementById(this._id+"_svg"),t.appendChild(s),t.appendChild(o))))},w.prototype.reverseAnimation=function(n,t){var nt=t.length,e=0,o=0,h,b,c,l,r,a,v,k,d,y=0,i,tt=document.getElementById(n._id+"back"),it=document.getElementById(n._id+"reset"),s,f,p,w,u=.1,g;r=document.getElementById(n._id+"_svg");l=n.model.startAngle||0;c=n.model.endAngle||360;e=n._drillDownStartAngle[n.drilldownCount-1];o=n._drillDownEndAngle[n.drilldownCount-1];k=(e-l)/20;d=(c-o)/20;i=document.getElementById(n._id+"_svg_DataLabelGroup");nt>0&&(g=setInterval(function(){if(n.revAnimation=!0,h=document.getElementById(n._id+"_svg_SunBurstElementGroup"),h&&h.parentNode.removeChild(h),i&&(i.style.visibility="hidden"),a=k*y+l,n.model.startAngle=a>=e?e:a,v=c-d*y,n.model.endAngle=v<o?o:v,b=n.sunburstRender(n.layerData),r.appendChild(b),v<=o&&a>=e){clearInterval(g);s=document.getElementById(n._id+"_svg_SunBurstElementGroup");s.id=n._id+"_svg_tempSeg";f=document.getElementById(n._id+"_svg_DataLabelGroup");r.parentNode.replaceChild(r.cloneNode(!1),r);document.getElementById(n._id+"_svg").appendChild(s);f&&(f.id=n._id+"_svg_tempLabel",document.getElementById(n._id+"_svg").appendChild(f));p=n._previousState.length-1;n.layerData=n._previousState[p-1];n._previousState.splice(p,1);n.model.startAngle=l;n.model.endAngle=c;n.drilldownCount=n.drilldownCount-1;n._drillDownStartAngle.length=n.drilldownCount;n._drillDownEndAngle.length=n.drilldownCount;n._drillInnerRadius.length=n.drilldownCount;n._drillOuterRadius.length=n.drilldownCount;n.processData(n.layerData);n.drawSunburst(n.layerData);n.drilldownCount!=0&&(r=document.getElementById(n._id+"_svg"),r.appendChild(it),r.appendChild(tt));n._enableAnimation=!0;w=document.getElementById(n._id+"_svg_SunBurstElementGroup");w.style.opacity=u.toString();i&&(i.style.opacity=u.toString());n.model.dataLabelSettings.visible&&(i=document.getElementById(n._id+"_svg_DataLabelGroup"),n.model.dataLabelSettings.template==null?document.getElementById(n._id+"_svg").appendChild(i):document.getElementById(n._id).appendChild(i),i.style.visibility="visible",i.style.opacity=u.toString());var t=setInterval(function(){w.style.opacity=u.toString();i&&(i.style.opacity=u.toString());u>=1&&(clearInterval(t),n.revAnimation=!1,s.parentNode.removeChild(s),f&&f.parentNode.removeChild(f));u=u+.1},50)}y=y+1},40))},w.prototype.drawResetButton=function(){var n,i,t,r;return t=this.createGroup({id:this._id+"reset"}),n={id:this._id+"resetPath",d:"M24,27H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h21c1.7,0,3,1.3,3,3v21C27,25.7,25.7,27,24,27z",fill:"#D6D6D6"},i=this.drawPath(n),t.appendChild(i),n={id:this._id+"resetPath1",d:"M13.6,21.9c-3.6,0-6.8-2.3-8-5.7l1.8-0.6c0.9,2.6,3.4,4.4,6.2,4.4c3.4,0,6.2-2.6,6.5-6l1.9,0.2 C21.6,18.6,18,21.9,13.6,21.9z",fill:"#5E5C5C"},i=this.drawPath(n),t.appendChild(i),n={id:this._id+"resetPath2",d:"M7.1,12.5l-1.9-0.3c0.6-4.1,4.2-7.1,8.3-7.1c3,0,5.8,1.6,7.3,4.2c0.1,0.2,0.2,0.4,0.3,0.6l-1.7,0.8 c-0.1-0.2-0.2-0.3-0.2-0.4c-1.2-2-3.3-3.3-5.7-3.3C10.4,7,7.6,9.3,7.1,12.5z",fill:"#5E5C5C"},i=this.drawPath(n),t.appendChild(i),n={id:this._id+"resetPath3",points:"21.4,11.9 16.2,10.7 16.6,8.9 19.9,9.6 20.7,6.3 22.5,6.7",fill:"#5E5C5C"},r=this.drawPolygon(n),t.appendChild(r),n={id:this._id+"resetPath4",points:"6.3,20.3 4.5,19.9 5.6,14.8 10.8,16 10.4,17.8 7.1,17.1",fill:"#5E5C5C"},r=this.drawPolygon(n),t.appendChild(r),t},w.prototype.reset=function(){if(this.model.drillDownReset){var n=$.extend({},this.common);this._trigger("drillDownReset",n)}this.redraw()},w.prototype.redraw=function(){this.legendPages=[];this.isResize||(this.drilldownCount=0,this._previousState=[],this._drillDownStartAngle=[],this._drillDownEndAngle=[],this._drillInnerRadius=[],this._drillOuterRadius=[]);this._sunburstRedraw=!0;var n=document.getElementById(this._id+"_svg");this.isNullOrUndefined(n)||(n.parentNode.removeChild(n),(this.rotateanim||this.model.enableAnimation)&&this.stopAnimation(),this.parentElement=undefined,this._init(),this._sunburstRedraw=!1)},w.prototype.stopAnimation=function(){this.rotateanim&&(clearInterval(this.rotateanim),this.isResize||(this._enableAnimation=this.model.enableAnimation),this.model.startAngle=this._startAngle,this.model.endAngle=this._endAngle,this.datalabelanim&&clearInterval(this.datalabelanim));this.layeranim&&clearInterval(this.layeranim)},w.prototype.sunburstMousemove=function(n){var e=n.target.id,y,i,c,v,a,o,s,t,u,h,f;if(e.indexOf("reset")!=-1||e.indexOf("back")!=-1)if(this.toolbarTooltip(n,e),e.indexOf("reset")!=-1)for(y=document.getElementById(this._id+"reset"),t=0;t<5;t++)t==0?document.getElementById(this._id+"resetPath").setAttribute("fill","rgb(20, 185, 255)"):document.getElementById(this._id+"resetPath"+t.toString()).setAttribute("fill","#FFFFFF");else for(t=0;t<3;t++)t==0?document.getElementById(this._id+"backPath").setAttribute("fill","rgb(20, 185, 255)"):document.getElementById(this._id+"backPath"+t.toString()).setAttribute("fill","#FFFFFF");else if(document.getElementById(this._id+"toolbarTooltip")!=null&&document.getElementById(this._id+"toolbarTooltip").style.visibility!="hidden"&&(document.getElementById(this._id+"toolbarTooltip").style.visibility="hidden",document.getElementById(this._id+"reset")!=null&&document.getElementById(this._id+"back")!=null)){for(t=0;t<5;t++)t==0?document.getElementById(this._id+"resetPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"resetPath"+t.toString()).setAttribute("fill","#5E5C5C");for(t=0;t<3;t++)t==0?document.getElementById(this._id+"backPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"backPath"+t.toString()).setAttribute("fill","#5E5C5C")}if(i=this.getSunburstPoint(n),i!=undefined&&this.model.pointRegionMouseMove&&(c=$.extend({},this.common),c.data=i,this._trigger("pointRegionMouseMove",c)),!this.isNullOrUndefined(i)&&this.model.tooltip.visible){for(v={id:this._id+"_ToolTip"},this.gTransToolEle=this.createGroup(v),a={X:i.location.x,Y:Math.abs(i.location.y)},t=0;t<this.layerData.length;t++)this.layerData[t].layerNumber==i.pointData[0].layerNumber&&(this.isNullOrUndefined(i.pointData[0].parentName)?(s=this.layerData[0],o=this.layerData[0].point[i.pointData[0].pointIndex]):this.layerData[t].parentName==i.pointData[0].parentName&&(s=this.layerData[t],o=this.layerData[t].point[i.pointData[0].pointIndex]));this.model.tooltip.template?this.createTooltiptemplate(a,o,s,i):this.showTooltip(a,o,s,i)}else this.isNullOrUndefined(document.getElementById(this._id+"_ToolTip"))||(document.getElementById(this._id+"_ToolTip").style.visibility="hidden");if(this.model.highlightSettings.enable&&(u=void 0,h=this.model.highlightSettings,this.highlightSunburst(i),!this.isNullOrUndefined(i)&&this.model.legend.visible))for(f=0;f<this.model.points.length;f++)u=document.getElementById(this._id+"_svg_LegendItemShape"+f),h.type==r.opacity?this.selectedGroupNumber-1!=f&&i.pointData[0].legendIndex!=f&&(u.style.opacity=h.opacity.toString()):i.pointData[0].legendIndex==f?u.getAttribute("class")!="SelectionStyleSunburst"&&(u.setAttribute("class","HighlightStyleSunburst"),u.style.opacity=h.opacity.toString()):u.getAttribute("class")=="HighlightStyleSunburst"||u.removeAttribute("class");e.indexOf(this._id+"_svg_LegendItem")!=-1&&this.model.legend.clickAction==l.toggleSegmentSelection&&this.legendSegments(e)},w.prototype.legendSegments=function(n){var o,u,s,t,f,h,e,r,i;for(o=n.replace(this._id+"_svg",""),u=parseInt(o.replace(/[^0-9\.]/g,"")),s=document.getElementById(this._id+"legendItem_Group"),t=s.childNodes,f=this.model.highlightSettings.opacity.toString(),r=0;r<t.length;r++)document.getElementById(t[r].id).style.opacity=u!=r?f:"1";for(h=document.getElementById(this._id+"_svg_SunBurstElementGroup"),t=h.childNodes,i=0;i<t.length;i++)t[i].id.indexOf("_legendIndex"+u)==-1&&(document.getElementById(t[i].id).style.opacity=f);if(this.model.dataLabelSettings.visible&&(e=document.getElementById(this._id+"_svg_DataLabelGroup"),e))for(t=e.childNodes,i=0;i<t.length;i++)t[i].id.indexOf("_legendIndex"+u)==-1&&(document.getElementById(t[i].id).style.opacity=f);this._legendHighlight=!0},w.prototype.toolbarTooltip=function(n,t){var i,r,u;t=t.indexOf("reset")!=-1?"Reset":"Back";r={top:n.clientY,left:n.clientX,"background-color":"white","border-style":"solid",position:"absolute","border-color":"#2F4F4F","border-width":"1px",opacity:.95,"z-index":1e6,"border-radius":"0px 0px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"};this.isNullOrUndefined(document.getElementById(this._id+"toolbarTooltip"))?(i=document.createElement("div"),i.setAttribute("id",this._id+"toolbarTooltip")):i=document.getElementById(this._id+"toolbarTooltip");i.style.pointerEvents="none";this.setStyles(r,i);u={top:n.clientY,left:n.clientX,color:this.model.tooltip.font.color,"font-size":this.model.tooltip.font.size,"font-family":this.model.tooltip.font.fontFamily,"font-style":this.model.tooltip.font.fontStyle,"font-weight":this.model.tooltip.font.fontWeight,"align-self":"baseline"};this.setStyles(u,i);this.isNullOrUndefined(document.getElementById(this._id+"toolbarTooltip"))&&document.body.appendChild(i);i.innerHTML=t;i.style.visibility=="hidden"&&(i.style.visibility="visible");i.style.left=(n.clientX+window.pageXOffset+10).toString()+"px";i.style.top=(n.clientY+window.pageYOffset+10).toString()+"px"},w.prototype.removeHighlight=function(n){for(var t=0;t<n.length&&document.getElementById(n[t])!=null;t++)document.getElementById(n[t]).getAttribute("class")=="HighlightStyleSunburst"&&document.getElementById(n[t]).removeAttribute("class")},w.prototype.isSelectedElement=function(n,t){for(var r=!1,i=0;i<t.length;i++)n==t[i]&&(r=!0);return r},w.prototype.highlightSunburst=function(n){var u=document.getElementsByTagName("path"),o=n,e,h,y,b,p,d=this.model.legend,i=this.model.highlightSettings,g=this.model.points,k,c,l,a,v,s,w,t;if(this.isNullOrUndefined(o))if(i.type!=r.opacity){if(i.mode==f.point)e=document.getElementsByClassName("HighlightStyleSunburst"),e.length>0&&(e[0].removeAttribute("class"),this.baseID=undefined);else if(i.mode==f.all){if(!this.isNullOrUndefined(this.highlightgroupID)){for(s=0;s<this.highlightgroupID.length;s++)document.getElementById(this.highlightgroupID[s])!=null&&(document.getElementById(this.highlightgroupID[s]).getAttribute("class")==null||document.getElementById(this.highlightgroupID[s]).getAttribute("class")=="HighlightStyleSunburst")&&document.getElementById(this.highlightgroupID[s]).removeAttribute("class");this.groupID=undefined;this.selelectedElementId=undefined}}else if(e=document.getElementsByClassName("HighlightStyleSunburst"),e.length>0){for(w=0;w<e.length;w++)this.highlightgroupID.push(e[w].id);this.removeHighlight(this.highlightgroupID);this.highlightgroupID=[];this.highlightedElementId=null}}else for(t=0;t<u.length;t++)this.selectedgroupID.length==0?this.selectedgroupID.indexOf(u[t].id)==-1&&(u[t].style.opacity="1"):this.selectedgroupID.indexOf(u[t].id)==-1&&(u[t].style.opacity=this.model.selectionSettings.opacity.toString());else if(i.mode==f.point)if(i.type!=r.opacity)e=document.getElementsByClassName("HighlightStyleSunburst"),i.mode==f.point&&e.length>0&&e[0].removeAttribute("class"),h=document.getElementById(o.pointData[0].id),k=this.isSelectedElement(h.id,this.selectedgroupID),document.getElementById(h.id).getAttribute("class")!=null||k||this.createHighlightStyle(h,i),this.baseID=h.id;else{for(t=0;t<u.length;t++)this.selectedgroupID.indexOf(u[t].id)==-1&&(u[t].style.opacity=i.opacity.toString());document.getElementById(o.pointData[0].id).style.opacity="1"}else if(i.mode==f.all){if(y=this.findGroupElements(o),b=this._id+"_legendIndex"+y[0].legendIndex+"_layerNumber1_layerIndex0_pointIndex"+y[0].pointIndex.toString(),i.type!=r.opacity){if(p=document.getElementsByClassName("HighlightStyleSunburst"),p.length>0)for(c=0;c<p.length;c++)this.highlightgroupID.push(p[c].id),this.highlightgroupID[c].indexOf(this._id+"_svg_LegendItemShape")<0&&this.removeHighlight(this.highlightgroupID);this.groupID=undefined;this.highlightgroupID=[];this.selelectedElementId=undefined}if(this.highlightGroup(y,o),i.type==r.opacity){for(l=0;l<u.length;l++)this.selectedgroupID.indexOf(u[l].id)==-1&&(u[l].style.opacity=i.opacity.toString());for(t=0;t<this.highlightgroupID.length;t++)document.getElementById(this.highlightgroupID[t]).style.opacity="1"}}else if(i.mode==f.child){if(b=o.pointData[0].id,i.type!=r.opacity&&(!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.highlightgroupID=[],this.highlightedElementId=undefined),this.highlightChild(o),i.type==r.opacity){for(a=0;a<u.length;a++)this.selectedgroupID.indexOf(u[a].id)==-1&&(u[a].style.opacity=i.opacity.toString());for(t=0;t<this.highlightgroupID.length;t++)document.getElementById(this.highlightgroupID[t]).style.opacity="1";this.highlightedElementId=undefined}}else if(b=o.pointData[0].id,i.type!=r.opacity&&(!this.isNullOrUndefined(this.groupID)&&this.groupID.length>0&&this.removeHighlight(this.groupID),this.groupID=undefined,this.selelectedElementId=undefined),this.highlightParent(o),i.type==r.opacity){for(v=0;v<u.length;v++)this.selectedgroupID.indexOf(u[v].id)==-1&&(u[v].style.opacity=this.model.selectionSettings.opacity.toString());for(t=0;t<this.groupID.length;t++)document.getElementById(this.groupID[t]).style.opacity="1"}},w.prototype.highlightGroup=function(n,t){var i,f=this.model.highlightSettings,e=!1,u,o;for(this.highlightgroupID=[],u=0;u<n.length;u++)if(n[u].layerNumber==1)i=document.getElementById(this._id+"_legendIndex"+t.pointData[0].legendIndex+"_layerNumber1_layerIndex0_pointIndex"+n[u].pointIndex.toString()),e=this.isSelectedElement(i.id,this.selectedgroupID),f.type==r.opacity||document.getElementById(i.id).getAttribute("class")!=null||e||(this.createHighlightStyle(i,f),this.selelectedElementId=i.id),this.highlightgroupID.push(i.id);else for(o=0;o<n[u].point.length;o++)n[u].layerNumber!=1&&(i=document.getElementById(this._id+"_legendIndex"+t.pointData[0].legendIndex+"_layerNumber"+n[u].layerNumber.toString()+"_layerIndex"+n[u].layerIndex.toString()+"_pointIndex"+o.toString()),e=this.isSelectedElement(i.id,this.selectedgroupID),f.type==r.opacity||document.getElementById(i.id).getAttribute("class")!=null||e||this.createHighlightStyle(i,f),this.highlightgroupID.push(i.id))},w.prototype.highlightParent=function(n){var t,e,u=this.model.highlightSettings,f=!1,i;for(this.groupID=[],this.parentEle=[],this.parentEle.push(n.pointData[0]),e=n.pointData[0].id,this.isNullOrUndefined(n.pointData[0].parentName)||this.findSelectionparent(n.pointData[0].parentName),i=0;i<this.parentEle.length;i++)document.getElementById("selectionSunburst")?(t=document.getElementById(this._id+"_legendIndex"+n.pointData[0].legendIndex+"_layerNumber"+this.parentEle[i].layerNumber.toString()+"_layerIndex"+this.parentEle[i].layerIndex.toString()+"_pointIndex"+this.parentEle[i].pointIndex),f=this.isSelectedElement(t.id,this.selectedgroupID),u.type==r.opacity||f||this.createHighlightStyle(t,u),this.groupID.push(t.id),this.highlightgroupID.push(t.id)):(t=document.getElementById(this._id+"_legendIndex"+n.pointData[0].legendIndex+"_layerNumber"+this.parentEle[i].layerNumber.toString()+"_layerIndex"+this.parentEle[i].layerIndex.toString()+"_pointIndex"+this.parentEle[i].pointIndex),f=this.isSelectedElement(t.id,this.selectedgroupID),u.type==r.opacity||f||this.createHighlightStyle(t,u),this.groupID.push(t.id),this.highlightgroupID.push(t.id))},w.prototype.highlightChild=function(n){var f,o,i=this.model.highlightSettings,l,h,c,e=!1,u,t,s;if(this.childEle=[],this.highlightgroupID=[],f=this.layerData[n.pointData[0].layerIndex].point[n.pointData[0].pointIndex],o=n.pointData[0].id,u=document.getElementById(o),e=this.isSelectedElement(u.id,this.selectedgroupID),f.point||f.layerIndex==0||e){for(l=n.pointData[0].layerNumber,this.isNullOrUndefined(f.point)||this.findChild(f,l),i.type==r.opacity||e||this.createHighlightStyle(u,i),this.highlightgroupID.push(u.id),this.highlightedElementId=o,t=0;t<this.childEle.length;t++)if(this.childEle[t].layerNumber>n.pointData[0].layerNumber)for(s=0;s<this.childEle[t].length;s++)h=this._id+"_legendIndex"+n.pointData[0].legendIndex+"_layerNumber"+this.childEle[t].layerNumber.toString()+"_layerIndex"+this.childEle[t].layerIndex+"_pointIndex"+s.toString(),c=document.getElementById(h),e=this.isSelectedElement(h,this.selectedgroupID),i.type==r.opacity||e||this.createHighlightStyle(c,i),this.highlightgroupID.push(c.id)}else i.type!=r.opacity&&(this.createHighlightStyle(u,i),this.highlightedElementId=o),this.highlightgroupID.push(u.id)},w.prototype.createHighlightStyle=function(n,t){var i,r,u;n.getAttribute("class")!="SelectionStyleSunburst"&&(document.getElementById("highlightSunburst")||(i=document.createElement("style"),i.type="text/css",r=t.color,u="1",i.innerHTML=" .HighlightStyleSunburst{ fill:"+r+";opacity:"+u+";stroke:;stroke-width:1}",i.setAttribute("id","highlightSunburst"),document.body.appendChild(i)),n.setAttribute("class","HighlightStyleSunburst"))},w.prototype.showTooltip=function(n,t,i,r){var h=7,c,u,l,o,s,e,f=this.model.tooltip,y=document.getElementById(this._id+"_svg"),p=window.pageYOffset,w=window.pageXOffset,a=y.getBoundingClientRect(),v;o=n.X+h/2+w+a.left;s=n.Y-3*h+p+a.top;document.getElementById(this._id+"_ToolTip")==null?(u=document.createElement("div"),u.id=this._id+"_ToolTip",u.style.pointerEvents="none"):(u=document.getElementById(this._id+"_ToolTip"),u.style.pointerEvents="none");c=this.formatTooltip(r.pointData[0],f.format);e=$.extend({},this.common);e.data={pointIndex:r.pointData[0].pointIndex,currentText:c,Location:{x:o,Y:s}};this._trigger("tooltipInitialize",e);u.innerHTML=e.data.currentText;l={top:e.data.Location.X,left:e.data.Location.Y,"background-color":f.fill,"border-style":"solid",position:"absolute","border-color":f.border.color,"border-width":f.border.width+"px",opacity:f.opacity,"z-index":1e6,"border-radius":"0px 0px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"};this.setStyles(l,u);v={top:s,left:o,color:f.font.color,"font-size":f.font.size,"font-family":f.font.fontFamily,"font-style":f.font.fontStyle,"font-weight":f.font.fontWeight,"align-self":"baseline"};this.setStyles(v,u);this.isNullOrUndefined(document.getElementById(this._id+"Tooltip"))&&document.body.appendChild(u);u.style.visibility=="hidden"&&(u.style.visibility="visible");u.style.left=o.toString()+"px";u.style.top=s.toString()+"px"},w.prototype.formatTooltip=function(n,t){var i=t;return i.search("#point.x#")!=-1&&(i=i.replace("#point.x#",n.x)),i.search("#point.y#")!=-1&&(i=i.replace("#point.y#",n.y)),i},w.prototype.setStyles=function(n,t){for(var r=Object.keys(n),u,f=r.map(function(t){return n[t]}),i=0,e=r.length;i<e;i++)u=r[i],t.style[u]=f[i]},w.prototype.createTooltiptemplate=function(n,t,i,r){var u=document.getElementById("tooltipDiv"),f,e,s=document.getElementById(this._id+"_svg"),h=window.pageYOffset,c=window.pageXOffset,o=s.getBoundingClientRect();f=n.X+c+o.left+10;e=n.Y+h+o.top;this.isNullOrUndefined(u)?(this.tooltipfirst=!0,u=document.createElement("div"),u.className="tooltipDiv",u.style.position="absolute",u.style.zIndex="13000",u.style.display="block",u.id="tooltipDiv",u.style.backgroundColor="white",document.body.appendChild(u),this.clonenode=document.getElementById(this.model.tooltip.template).cloneNode(!0),this.clonenode.style.display="block",document.getElementById("tooltipDiv").innerHTML="",this.clonenode.innerHTML=this.parseTooltipTemplate(r.pointData[0],this.clonenode.innerHTML),document.getElementById("tooltipDiv").appendChild(this.clonenode)):(u.style.display="block",this.tooltipfirst=!1,this.clonenode.innerHTML=this.parseTooltipTemplate(r.pointData[0],this.clonenode.innerHTML));document.getElementById("tooltipDiv").style.left=f.toString()+"px";document.getElementById("tooltipDiv").style.top=e.toString()+"px"},w.prototype.parseTooltipTemplate=function(n){var i=document.getElementById(this.model.tooltip.template).cloneNode(!0),t=i.innerHTML;return t.search("#point.x#")!=-1&&(t=t.replace("#point.x#",n.x.toString())),t.search("#point.y#")!=-1&&(t=t.replace("#point.y#",n.y.toString())),t.search("#point.text#")!=-1&&(t=this.isNullOrUndefined(n.text)?t.replace("#point.text#",n.y.toString()):t.replace("#point.text#",n.text.toString())),t},w.prototype.bindClickEvent=function(n){var t,i;return t=this.getSunburstPoint(n),!this.isNullOrUndefined(t)&&this.model.pointRegionClick&&(i=$.extend({},this.common),i.data=t,this._trigger("pointRegionClick",i)),t},w.prototype.sunburstClick=function(n){var o=this.bindClickEvent(n),t,s,f,e=this.model.selectionSettings,h,u,r;if(e.enable&&(this.selectSunburst(o,n),!this.isNullOrUndefined(o)&&this.model.legend.visible))for(r=0;r<this.model.points.length;r++)u=document.getElementById(this._id+"_svg_LegendItemShape"+r),h=this.model.points[r],e.type==i.opacity?o.pointData[0].legendIndex!=r&&(u.style.opacity=e.opacity.toString()):this.selectedGroupNumber-1==r?(u.setAttribute("class","SelectionStyleSunburst"),u.style.opacity=e.opacity.toString()):u.getAttribute("class")=="SelectionStyleSunburst"||u.removeAttribute("class");t=this;t.tapCount++;s=setTimeout(function(){t.tapCount>=2&&t._isDoubleClickEvent==!1&&(t.sunburstDoubleClick(n),t._isDoubleClickEvent=!1);t.tapCount=0},200);f=document.getElementById(t._id+"toolbarTooltip");t.isNullOrUndefined(f)||f.parentNode.removeChild(f)},w.prototype.isTouch=function(n){var i,t;return(i=this.browserInfo(),t=n.originalEvent?n.originalEvent:n,t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1)?!0:!1},w.prototype.sunburstLeave=function(n){var i=this,u=n.target.id,l,h,c,f,e,o,s,r,a,v,t;if(this._legendHighlight){for(l=document.getElementById(this._id+"legendItem_Group"),h=l.childNodes,r=0;r<h.length;r++)document.getElementById(h[r].id).style.opacity="1";for(c=document.querySelectorAll("[id^="+this._id+"_legendIndex]"),s=0;s<c.length;s++)document.getElementById(c[s].id).style.opacity="1";this._legendHighlight=!1}if(this.model.legend.visible&&this.model.highlightSettings.enable)for(r=0;r<this.model.points.length;r++)f=document.getElementById(this._id+"_svg_LegendItemShape"+r),f!=null&&(f.style.opacity="1",f.removeAttribute("class"));if(this.isNullOrUndefined(document.getElementById(i._id+"_ToolTip"))||(ej.isTouchDevice()||this.isTouch(n)?a=setTimeout(function(){document.getElementById(i._id+"_ToolTip").style.visibility="hidden"},3e3):u==i._id+"_svg_svgRect"&&(this._hideTooltip||clearTimeout(this._hideTooltip),this._hideTooltip=setTimeout(function(){document.getElementById(i._id+"_ToolTip").style.visibility="hidden"},1e3))),o=document.getElementById(i._id+"toolbarTooltip"),i.isNullOrUndefined(o)||o.parentNode.removeChild(o),e=document.getElementById("tooltipDiv"),i.isNullOrUndefined(e)||(ej.isTouchDevice()||this.isTouch(n)?v=setTimeout(function(){e.style.display="none"},3e3):u==i._id+"_svg_svgRect"&&(this._hideTooltipTemplate||clearTimeout(this._hideTooltipTemplate),this._hideTooltipTemplate=setTimeout(function(){e.style.display="none"},1e3))),u.indexOf(this._id+"reset")!=-1)for(t=0;t<5;t++)t==0?document.getElementById(this._id+"resetPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"resetPath"+t.toString()).setAttribute("fill","#5E5C5C");if(u.indexOf(this._id+"back")!=-1)for(t=0;t<3;t++)t==0?document.getElementById(this._id+"backPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"backPath"+t.toString()).setAttribute("fill","#5E5C5C")},w.prototype.selectSunburst=function(n,t){var l,d,a,v=this.model.selectionSettings.mode.toString(),e=document.getElementsByTagName("path"),g,s=this.model.selectionSettings.opacity.toString(),o=this.model.selectionSettings.type,p=this.model.legend,w=this.model.points,r,y,h,b,c,u,k,f;if(this.isNullOrUndefined(n)){if(i.opacity!=o)v=="point"?(h=document.getElementsByClassName("SelectionStyleSunburst"),h.length>0&&h[0].removeAttribute("class")):this.selectedgroupID.length>0&&(this.removeSelection(this.selectedgroupID),this.selectedgroupID=[],this.selectedGroupNumber=null,v=="child"&&(this.selelectedElementId=null),v=="parent"&&(this.groupNumber=null));else{for(this.selectedgroupID=[],f=0;f<e.length;f++)e[f].style.opacity="1";this.mouseClickedElementId="";this.selectedGroupNumber=null}this.removeLegendSelection()}else if(this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),v=="point"){if(this.selectedgroupID=[],g=t.target.id.replace("_layerIndex"+n.pointData[0].layerIndex.toString(),""),i.opacity!=o)!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),l=document.getElementById(n.pointData[0].id),l.getAttribute("class")=="SelectionStyleSunburst"?(l.removeAttribute("class"),this.highlightgroupID.indexOf(l.id)!=-1&&l.setAttribute("class","HighlightStyleSunburst")):(h=document.getElementsByClassName("SelectionStyleSunburst"),this.highlightgroupID.length>0&&h.length>0&&this.highlightgroupID.indexOf(h[0].id)!=-1&&h[0].setAttribute("class","HighlightStyleSunburst"),h.length>0&&h[0].getAttribute("class")=="SelectionStyleSunburst"&&h[0].removeAttribute("class"),!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.selectPointData(l),this.selectedgroupID.push(l.id));else{if(this.mouseClickedElementId!=g){for(u=0;u<e.length;u++)e[u].style.opacity=s;document.getElementById(n.pointData[0].id).style.opacity="1";this.mouseClickedElementId=g;this.selectedgroupID.push(n.pointData[0].id)}else{for(f=0;f<e.length;f++)e[f].style.opacity="1";this.mouseClickedElementId=""}this.selectedGroupNumber=n.pointData[0].groupNumber}if(p.visible&&this.selectedgroupID.length>0)for(c=0;c<w.length;c++)r=document.getElementById(this._id+"_svg_LegendItemShape"+c),n.pointData[0].legendIndex!=c?r!=null&&(r.style.opacity=s,r.removeAttribute("class")):i.opacity==o?r.style.opacity="1":(r.setAttribute("class","SelectionStyleSunburst"),r.style.opacity=s);this.selectedgroupID.length==0&&this.removeLegendSelection()}else if(v=="all")if(y=this.findGroupElements(n),a=n.pointData[0].id,this.selectedgroupID.indexOf(a)==-1){if(this.selectedGroupNumber!=y[0].groupNumber?(this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),this.selectGroup(y,n),this.selectedGroupNumber=y[0].groupNumber):(this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),this.selectedgroupID=[],this.selectedGroupNumber=null),i.opacity==o){for(u=0;u<e.length;u++)e[u].style.opacity=s;for(f=0;f<this.selectedgroupID.length;f++)document.getElementById(this.selectedgroupID[f]).style.opacity="1";this.isSelected=!0}if(p.visible){for(b=0;b<w.length;b++)r=document.getElementById(this._id+"_svg_LegendItemShape"+b),r!=null&&(r.style.opacity=s,r.removeAttribute("class"));i.opacity!=o?document.getElementById(this._id+"_svg_LegendItemShape"+y[0].pointIndex.toString()).setAttribute("class","SelectionStyleSunburst"):document.getElementById(this._id+"_svg_LegendItemShape"+y[0].pointIndex.toString()).style.opacity="1"}}else{if(this.selectedgroupID.length>0)if(i.opacity!=o)this.removeSelection(this.selectedgroupID);else for(u=0;u<e.length;u++)e[u].style.opacity="1";this.isSelected=!1;this.selectedGroupNumber=null;this.selectedgroupID=[];this.baseID="";this.removeLegendSelection()}else if(v=="child")if(a=n.pointData[0].id,this.selectedgroupID.indexOf(a)==-1){if(!this.isNullOrUndefined(this.selectedgroupID)&&this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.selectedgroupID=[],this.selelectedElementId=undefined,this.selectchild(n),i.opacity==o){for(u=0;u<e.length;u++)e[u].style.opacity=s;for(f=0;f<this.selectedgroupID.length;f++)document.getElementById(this.selectedgroupID[f]).style.opacity="1";this.isSelected=!0}if(this.selectedGroupNumber=n.pointData[0].groupNumber,p.visible)for(c=0;c<w.length;c++)r=document.getElementById(this._id+"_svg_LegendItemShape"+c),n.pointData[0].legendIndex!=c?r!=null&&(r.style.opacity=s,r.removeAttribute("class")):i.opacity==o?r.style.opacity="1":(r.setAttribute("class","SelectionStyleSunburst"),r.style.opacity=s)}else this.selectedgroupID=[],this.selelectedElementId=this.baseID="",this.removeSegmentSelection(e,o),this.removeLegendSelection(),this.isSelected=!1;else if(a=n.pointData[0].id,this.selectedgroupID.indexOf(a)==-1){if(this.isNullOrUndefined(this.groupNumber)||this.groupNumber==n.pointData[0].groupNumber?this.selectedgroupID.length>0&&(this.removeSelection(this.selectedgroupID),this.selectedgroupID=[]):this.removeSegmentSelection(e,this.model.selectionSettings.type),!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.selectParent(n),this.groupNumber=n.pointData[0].groupNumber,i.opacity==o){for(u=0;u<e.length;u++)e[u].style.opacity=s;for(f=0;f<this.selectedgroupID.length;f++)document.getElementById(this.selectedgroupID[f]).style.opacity="1"}if(this.selectedGroupNumber=n.pointData[0].groupNumber,d=n.pointData[0].legendIndex,p.visible){for(k=0;k<w.length;k++)r=document.getElementById(this._id+"_svg_LegendItemShape"+k),r!=null&&(r.style.opacity=s,r.removeAttribute("class"));i.opacity!=o?document.getElementById(this._id+"_svg_LegendItemShape"+d.toString()).setAttribute("class","SelectionStyleSunburst"):document.getElementById(this._id+"_svg_LegendItemShape"+d.toString()).style.opacity="1"}}else this.selectedgroupID=[],this.selelectedElementId=this.baseID="",this.removeSegmentSelection(e,this.model.selectionSettings.type),this.removeLegendSelection()},w.prototype.removeSegmentSelection=function(n,t){for(var r=0;r<n.length;r++)t==i.opacity?n[r].style.opacity="1":n[r].removeAttribute("class")},w.prototype.removeLegendSelection=function(){var n,t;if(this.model.legend.visible)for(t=0;t<this.model.points.length;t++)n=document.getElementById(this._id+"_svg_LegendItemShape"+t),n!=null&&(n.style.opacity="1",n.removeAttribute("class"))},w.prototype.selectParent=function(n){var r,f,u,e=this.model.selectionSettings,o,t;for(this.parentEle=[],u=n.pointData[0].legendIndex,i.opacity==e.type&&(this.selectedgroupID=[]),this.parentEle.push(n.pointData[0]),o=n.pointData[0].id,i.opacity!=e.type&&(this.selectedgroupID=[],this.removeSelection(this.selectedgroupID),this.selelectedElementId=o),this.isNullOrUndefined(n.pointData[0].parentName)||this.findSelectionparent(n.pointData[0].parentName),t=0;t<this.parentEle.length;t++)document.getElementById("selectionSunburst")?(r=document.getElementById(this._id+"_legendIndex"+u+"_layerNumber"+this.parentEle[t].layerNumber.toString()+"_layerIndex"+this.parentEle[t].layerIndex.toString()+"_pointIndex"+this.parentEle[t].pointIndex),i.opacity!=this.model.selectionSettings.type&&r.setAttribute("class","SelectionStyleSunburst"),this.selectedgroupID.push(r.id)):(r=document.getElementById(this._id+"_legendIndex"+u+"_layerNumber"+this.parentEle[t].layerNumber.toString()+"_layerIndex"+this.parentEle[t].layerIndex.toString()+"_pointIndex"+this.parentEle[t].pointIndex),i.opacity!=this.model.selectionSettings.type&&(f=this.createselectionStyle(r,this.model.selectionSettings),document.body.appendChild(f),r.setAttribute("class","SelectionStyleSunburst")),this.selectedgroupID.push(r.id))},w.prototype.findSelectionparent=function(n){var r=this.sunburstRegions,t,i;n:for(t=0;t<r.length;t++)for(i=0;i<r[t].region.length;i++)if(n==r[t].region[i].x)if(this.parentEle.push(r[t].region[i]),this.isNullOrUndefined(r[t].region[i].parentName))break n;else{this.findSelectionparent(r[t].region[i].parentName);break n}},w.prototype.selectchild=function(n){var u,e,t,f=this.model.selectionSettings,o,c,l,h,a,r,s;if(this.childEle=[],u=this.layerData[n.pointData[0].layerIndex].point[n.pointData[0].pointIndex],e=n.pointData[0].id,t=document.getElementById(e),u.point||u.layerIndex==0){for(a=n.pointData[0].layerNumber,this.isNullOrUndefined(u.point)||this.findChild(u,a),f.type!=i.opacity&&(document.getElementById("SelectionStyleSunburst")||(o=this.createselectionStyle(t,f),document.body.appendChild(o)),t.setAttribute("class","SelectionStyleSunburst")),this.selectedgroupID.push(t.id),this.selelectedElementId=e,c=n.pointData[0].legendIndex,r=0;r<this.childEle.length;r++)if(this.childEle[r].layerNumber>n.pointData[0].layerNumber)for(s=0;s<this.childEle[r].length;s++)l=this._id+"_legendIndex"+c+"_layerNumber"+this.childEle[r].layerNumber.toString()+"_layerIndex"+this.childEle[r].layerIndex+"_pointIndex"+s.toString(),h=document.getElementById(l),f.type!=i.opacity&&h.setAttribute("class","SelectionStyleSunburst"),this.selectedgroupID.push(h.id)}else f.type!=i.opacity&&(document.getElementById("selectionSunburst")||(o=this.createselectionStyle(t,f),document.body.appendChild(o)),t.setAttribute("class","SelectionStyleSunburst"),this.selelectedElementId=e),this.selectedgroupID.push(t.id)},w.prototype.findChild=function(n,t){for(var r=[],i=0;i<n.point.length;i++)n.point[i].point?(r.push(n.point[i]),this.findChild(n.point[i],t+1)):r.push(n.point[i]);r.layerNumber=t+1;r.layerIndex=n.point.layerData;this.childEle.push(r)},w.prototype.selectGroup=function(n,t){var s,f=this.model.selectionSettings,r,e,u,o,h;for(this.selectedgroupID=[],s=t.pointData[0].legendIndex,u=0;u<n.length;u++)if(n[u].layerNumber==1)r=document.getElementById(this._id+"_legendIndex"+s+"_layerNumber1_layerIndex0_pointIndex"+n[u].pointIndex.toString()),f.type!=i.opacity&&(e=this.createselectionStyle(r,f),document.body.appendChild(e),r.setAttribute("class","SelectionStyleSunburst")),this.selectedgroupID.push(r.id);else for(o=0;o<n[u].point.length;o++)r=document.getElementById(this._id+"_legendIndex"+s+"_layerNumber"+n[u].layerNumber.toString()+"_layerIndex"+n[u].layerIndex.toString()+"_pointIndex"+o.toString()),f.type!=i.opacity&&(h=document.getElementById("selectionSunburst"),h?r.setAttribute("class","SelectionStyleSunburst"):(e=this.createselectionStyle(r,f),document.body.appendChild(e),r.setAttribute("class","SelectionStyleSunburst"))),this.selectedgroupID.push(r.id)},w.prototype.removeSelection=function(n){for(var t=0;t<n.length&&document.getElementById(n[t])!=null;t++)document.getElementById(n[t]).getAttribute("class")=="SelectionStyleSunburst"&&document.getElementById(n[t]).removeAttribute("class")},w.prototype.findGroupElements=function(n){for(var i,u=n.pointData[0].groupNumber?n.pointData[0].groupNumber:n.pointData[0].pointIndex+1,r=[],t=0;t<this.layerData.length;t++)if(t==0)for(i=0;i<this.layerData[t].point.length;i++)this.layerData[t].point[i].groupNumber==u&&r.push(this.layerData[t].point[i]);else this.layerData[t].groupNumber==u&&(this.layerData[t].layerIndex=t,r.push(this.layerData[t]));return r},w.prototype.selectPointData=function(n){var t;document.getElementById("selectionSunburst")?(n.setAttribute("class","SelectionStyleSunburst"),this.selelectedElementId=n.id):(t=this.createselectionStyle(n,this.model.selectionSettings),document.body.appendChild(t),n.setAttribute("class","SelectionStyleSunburst"),this.selelectedElementId=n.id)},w.prototype.createselectionStyle=function(n,t){var i,r,u;return i=document.createElement("style"),i.type="text/css",r=t.color,u="1",i.innerHTML=" .SelectionStyleSunburst{ fill:"+r+";opacity:"+u+";stroke:;stroke-width:1}",i.setAttribute("id","selectionSunburst"),i},w.prototype.getSunburstPoint=function(n){var r,u,e,s,h,c,f,i,t,o;return f=this.calMousePosition(n),c=this.circularRadius,r=f.X,u=f.Y,i=this.model.startAngle,t=this.model.endAngle,s=this.areaBounds.actualWidth,h=this.areaBounds.actualHeight,o=this.model.startAngle*(Math.PI/180),this.sunburstRegions.forEach(function(n){var a=n.sunburstData,l=n.region,v,y,d,nt,p=0,h,f,s,w=[],g,b,c,k;if(d=a.innerRadius?a.innerRadius:0,v=r-a.centerX,y=u-a.centerY,nt=n.region,i=i<0?i+360:i,t=t<0?t+360:t,g=t-i,b=-.5*Math.PI+o,g<0){for(t=t/360,p=t?2*Math.PI*(t<0?1+t:t):0,h=(Math.atan2(y,v)-b-p)%(2*Math.PI),h<0&&(h=2*Math.PI+h),c=0;c<l.length;c++)if(f=parseFloat(l[c].startAngle.toFixed(14)),s=parseFloat(l[c].endAngle.toFixed(14)),f=f<0?2*Math.PI+f:f,s=s<0?2*Math.PI+s:s,f-=p,s-=p,f=parseFloat(f.toFixed(14)),s=parseFloat(s.toFixed(14)),h<=f&&h>=s){w.push(l[c]);break}}else for(h=(Math.atan2(y,v)-b)%(2*Math.PI),h<0&&(h=2*Math.PI+h),c=0;c<l.length;c++)if(f=parseFloat(l[c].startAngle.toFixed(14)),s=parseFloat(l[c].endAngle.toFixed(14)),f=f<0?2*Math.PI+f:f,s=s<0?2*Math.PI+s:s,f=parseFloat(f.toFixed(14)),s=parseFloat(s.toFixed(14)),h>=f&&h<=s){w.push(l[c]);break}w.length>0&&(k=Math.sqrt(Math.pow(Math.abs(v),2)+Math.pow(Math.abs(y),2)),k<=a.Radius&&k>d&&(e={pointData:w,location:{x:r,y:u}}))}),e},w.prototype.calMousePosition=function(n){var r,u,t,f,i,e,o;return t=this.mousePosition(n),n.pageX=t.x,n.pageY=t.y,f=document.getElementById(this._id+"_svg"),e=window.pageYOffset,o=window.pageXOffset,i=f.getBoundingClientRect(),r=n.pageX-o-i.left,u=n.pageY-e-i.top,{X:r,Y:u}},w.prototype.mousePosition=function(n){return!this.isNullOrUndefined(n.pageX)&&n.pageX>0?{x:n.pageX,y:n.pageY}:{x:0,y:0}},w.prototype.drawSunburstLegend=function(){var n=this.model.legend,i=this.model.legend.title,f,r=!1,u,e=this.elementSpacing;this.gLegendEle=this.createGroup({id:this._id+"_legend_group"});(n.position==t.top||n.postion==t.bottom)&&(f=this.height*(20/100));document.getElementById(this._id+"_svg").appendChild(this.gLegendEle);i.text!=""&&i.visible&&this.gLegendEle.appendChild(this.drawLegendTitle(i,n));u=this.drawlegendItem(n,this.legendCollection,r);this.drilldownCount==0&&(this.legendClick=this.legendClick.bind(this),this.legendItemGroup.addEventListener("click",this.legendClick,!0));this.gLegendEle.appendChild(u);this.legendPages.length>0&&this.drawScrollbuttons(n);this.legendPositioning(n,r)},w.prototype.legendPositioning=function(n,i){var f,c,l,o,p,e,a=this.elementSpacing,s,r,w,b,k,h,v,y;f=document.getElementById(this._id+"_legend_group");c=document.getElementById(this._id+"legendItem_Group");n.position==t.bottom||n.position==t.top?(l=document.getElementById(this._id+"legendItem_Group"),o=l.getBoundingClientRect(),p=o.width,e=this.width/2-p/2,s=n.position==t.bottom?this.isNullOrUndefined(n.size.height)?this.LegendBounds.Height-a:o.height+a:this.isNullOrUndefined(n.size.height)?0:this.LegendBounds.Height-o.top+a,r="translate("+e.toString()+",0)",l.setAttribute("transform",r),n.title.text!=""&&n.title.visible&&document.getElementById(this._id+"_LegendTitleText").setAttribute("transform",r),this.legendPages.length>0&&(w=document.getElementById(this._id).getBoundingClientRect(),e=this.width/2-document.getElementById("scrollButtons").getBoundingClientRect().width/2,n.position==t.bottom?s=o.bottom-w.top:n.position==t.top&&(s=o.top+o.height),r="translate("+e.toString()+","+s.toString()+")",document.getElementById("scrollButtons").setAttribute("transform",r))):n.position==t.left||n.position==t.right?(i||(h=void 0,v=(this.height-f.getBoundingClientRect().height-document.getElementById(this._id+"_legend_group").getBoundingClientRect().top)/2,n.position==t.left?r="translate("+this.elementSpacing.toString()+","+v.toString()+")":(this.isNullOrUndefined(n.size.width)?h=this.width-f.getBoundingClientRect().width-f.getBoundingClientRect().left-2*this.elementSpacing:(h=this.width-f.getBoundingClientRect().width-f.getBoundingClientRect().left-2*this.elementSpacing,h=h-n.size.width),r="translate("+h.toString()+","+v.toString()+")"),f.setAttribute("transform",r)),this.legendPages.length>0&&(o=f.getBoundingClientRect(),b=document.getElementById("scrollButtons").getBoundingClientRect(),e=o.width/2-b.width/2,s=o.height,r="translate("+e.toString()+","+s.toString()+")",document.getElementById("scrollButtons").setAttribute("transform",r))):n.title.visible&&n.title.text!=""&&(k=(c.getBoundingClientRect().width-document.getElementById(this._id+"_LegendTitleText").getBoundingClientRect().width)/2,r="translate("+k.toString()+",0)",document.getElementById(this._id+"_LegendTitleText").setAttribute("transform",r));(n.position==t.bottom||n.position==t.top)&&n.alignment!=u.center?n.alignment==u.near?(e=-Math.abs(c.getBoundingClientRect().left)+this.elementSpacing,r="translate("+e.toString()+"0)",f.setAttribute("transform",r)):n.alignment==u.far&&(e=Math.abs(c.getBoundingClientRect().right-c.getBoundingClientRect().width),e=e-(this.elementSpacing+this.model.margin.right),r="translate("+e.toString()+",0)",f.setAttribute("transform",r)):(n.position==t.left||n.position==t.right)&&n.alignment!=u.center&&(y=f.getAttribute("transform").split(" "),n.alignment==u.near?(e=f.getBoundingClientRect().left+this.elementSpacing,s=this.elementSpacing+this.model.margin.top,r=y[0]+","+s.toString()+")",f.setAttribute("transform",r)):(e=f.getBoundingClientRect().left+this.elementSpacing,s=this.areaBounds.actualHeight-f.getBoundingClientRect().height+this.elementSpacing+this.model.margin.bottom,r=y[0]+","+s.toString()+")",f.setAttribute("transform",r)))},w.prototype.drawScrollbuttons=function(n){var o=n.position,i,r,u,f,e;n.position!=t.float&&(r=this.createGroup({id:"scrollButtons"}),i={id:"scrollUp",d:"M 6 0 L 12 12 0 12 Z",fill:"#3E576F"},u=this.drawPath(i),r.appendChild(u),i={id:"scrollDown",d:"M 40.359375 0 L 52.359375 0 46.359375 12 Z",fill:"#3E576F"},u=this.drawPath(i),r.appendChild(u),i={id:"pageNumber",x:15,y:10,fill:n.font.color,"font-size":n.font.size,"font-style":n.font.fontStyle,"font-family":n.font.fontFamily,"font-weight":n.font.fontWeight,"text-anchor":"start"},e=this.currentpageNumber.toString()+"/"+this.totalpageNumbers,f=this.createText(i,e),r.appendChild(f),this.scrollClick=this.scrollClick.bind(this),r.addEventListener("click",this.scrollClick,!0));this.gLegendEle.appendChild(r)},w.prototype.scrollClick=function(n){var r=this.model.legend,o=n.target.id,i,u=this.currentpageNumber,s=this.totalpageNumbers,e,f;i=document.getElementById(this._id+"legendItem_Group");e=document.getElementById("pageNumber");o=="scrollDown"&&u!=s?(this.currentpageNumber=u+1,i.parentNode.removeChild(i),f=this.drawlegendItem(r,this.legendPages[this.currentpageNumber-1],!0),this.gLegendEle.appendChild(f),document.getElementById(this._id+"_svg").appendChild(this.gLegendEle),e.textContent=this.currentpageNumber.toString()+"/"+this.totalpageNumbers.toString(),this.legendClick=this.legendClick.bind(this),i.addEventListener("click",this.legendClick,!0)):o=="scrollUp"&&u!=1&&(this.currentpageNumber=u-1,i.parentNode.removeChild(i),f=this.drawlegendItem(r,this.legendPages[this.currentpageNumber-1],!0),this.gLegendEle.appendChild(f),document.getElementById(this._id+"_svg").appendChild(this.gLegendEle),e.textContent=this.currentpageNumber.toString()+"/"+this.totalpageNumbers.toString(),this.legendClick=this.legendClick.bind(this),i.addEventListener("click",this.legendClick,!0));(r.position==t.top||r.position==t.bottom)&&this.legendPositioning(r,!1)},w.prototype.drawLegendTitle=function(n,i){var h=n.text,f=this.measureText(n.text,n.font),s,e=this.elementSpacing,c=this.circularRadius[this.totallayerCount-1],r=0,u=0,o=n.font.color;o=this.isNullOrUndefined(o)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":o;i.position==t.bottom?u=this.areaBounds.actualHeight+f.height/2+e+this.yOffset:i.position==t.top?(u=e+this.yOffset+f.height/2,this.isNullOrUndefined(i.size.height)||(u=i.size.height+this.yOffset)):i.position==t.left||i.position==t.right?(u=e+this.model.margin.top,r-=e):(u=i.location.y,r=i.location.x);switch(n.textAlignment){case"far":r+=this.LegendBounds.Width-f.width/2;break;case"near":r+=f.width/2;break;case"center":r+=this.LegendBounds.Width/2}return this.legendTitleLocation={x:r,y:u,width:f.width,height:f.height},s={id:this._id+"_LegendTitleText",x:r,y:u,fill:o,"font-size":n.font.size,"font-style":n.font.fontStyle,"font-family":n.font.fontFamily,"font-weight":n.font.fontWeight,"text-anchor":"middle"},this.createText(s,n.text)},w.prototype.drawlegendItem=function(n,i,r){var f=0,e=0,a,s,h=this.model.legend.itemStyle,k,v,y=0,o,p,w,c,u,l,b;if(this.legendItemGroup=this.createGroup({id:this._id+"legendItem_Group"}),this.model.legend.position==t.bottom||this.model.legend.position==t.top)return this.drawBottomTopLegend(n,i);if(this.model.legend.position==t.left||this.model.legend.position==t.right)return this.drawLeftRightLegend(n,i,r);for(c=0,n.title.visible&&n.title.text!=" "?(a=this.measureText(n.title.text,n.title.font),e=n.location.y+a.height/2+this.elementSpacing):e=n.location.y,f=n.location.x,u=0;u<i.length;u++)f+=y+c,s=Math.sqrt(h.width*h.width+h.height*h.height)/2,k=i[u].visibility?i[u].fill:"grey",v=this.drawLegendShape(i[u],f,e,u),this.model.legendItemRendering&&(l=$.extend({},this.common),b={location:{x:f,y:e},text:i[u].Text,shape:i[u].sunburstLegendShape},l.data=b,this._trigger("legendItemRendering",l)),y=this.measureText(i[u].Text,i[u].font).width+s+this.model.legend.itemPadding,c=n.itemPadding,o=this.createGroup({id:this._id+"_svg_Legend"+u.toString()}),o.style.cursor="pointer",p={id:this._id+"_svg_LegendItemText"+u.toString(),x:f+s,y:e+s*3/4,fill:i[u].font.color,"font-size":i[u].font.size,"font-style":i[u].font.fontStyle,"font-family":i[u].font.fontFamily,"font-weight":i[u].font.fontWeight,"text-anchor":"start"},w=this.createText(p,i[u].Text),o.appendChild(v),o.appendChild(w),this.legendItemGroup.appendChild(o);return this.legendItemGroup},w.prototype.legendClick=function(n){var s,h,u,f=[],i={},a,e,r,t,o,c;if((this.rotateanim||this.model.enableAnimation)&&this.stopAnimation(),this.model.legend.clickAction==l.toggleSegmentVisibility){for(s=n.target.id,e=document.getElementById(s).parentNode,h=e.childNodes[1],a=e.childNodes[0],u=h.textContent,r=document.getElementById(this._id+"_svg"),r.parentNode.replaceChild(r.cloneNode(!1),r),t=0;t<this.legendCollection.length;t++)u==this.legendCollection[t].Text?this.legendCollection[t].visibility?(this.legendCollection[t].visibility=!1,i={x:this.legendCollection[t].x,y:this.legendCollection[t].y,fill:this.legendCollection[t].fill,text:this.legendCollection[t].Text,point:this.legendCollection[t].points}):(this.legendCollection[t].visibility=!0,f.push({x:this.legendCollection[t].x,y:this.legendCollection[t].y,fill:this.legendCollection[t].fill,text:this.legendCollection[t].Text,point:this.legendCollection[t].points})):this.legendCollection[t].visibility&&f.push({x:this.legendCollection[t].x,y:this.legendCollection[t].y,fill:this.legendCollection[t].fill,text:this.legendCollection[t].Text,point:this.legendCollection[t].points});this.model.legendItemClick&&(o=$.extend({},this.common),c={location:{x:i.x,y:i.y},text:u,point:i.point},o.data=c,this._trigger("legendItemClick",o));this.processData(f);this.legendClicked=!0;this.drawSunburst(this.layerData);this.legendClicked=!1}},w.prototype.drawLegendShape=function(n,t,i,r){var y=this.model.legend.itemStyle,e=y.width,u=y.height,p=n.visibility?n.fill:"grey",b=n.sunburstLegendShape,w="Path",k=n.visibility?this.model.legend.border.color:"grey",f,s=t+-e/2,d=i+-u/2,c,o,l,a,v,h;o={id:this._id+"_svg_LegendItemShape"+r.toString(),fill:p,stroke:k,"stroke-width":this.model.legend.border.width,x:s,y:d,width:e,height:u};switch(b){case"circle":w="Circle";c=Math.sqrt(u*u+e*e)/2;o.r=c;o.cx=t;o.cy=i;break;case"diamond":f="M "+s+" "+i+" L "+t+" "+(i+-u/2)+" L "+(t+e/2)+" "+i+" L "+t+" "+(i+u/2)+" L "+s+" "+i+" z";o.d=f;break;case"rectangle":f="M "+s+" "+(i+-u/2)+" L "+(t+e/2)+" "+(i+-u/2)+" L "+(t+e/2)+" "+(i+u/2)+" L "+s+" "+(i+u/2)+" L "+s+" "+(i+-u/2)+" z";o.d=f;break;case"triangle":f="M "+s+" "+(i+u/2)+" L "+t+" "+(i+-u/2)+" L "+(t+e/2)+" "+(i+u/2)+" L "+s+" "+(i+u/2)+" z";o.d=f;break;case"pentagon":for(l=72,c=Math.sqrt(u*u+e*e)/2,h=0;h<=5;h++)a=c*Math.cos(Math.PI/180*h*l),v=c*Math.sin(Math.PI/180*h*l),f=h===0?"M "+(t+a)+" "+(i+v)+" ":f.concat("L "+(t+a)+" "+(i+v)+" ");f=f.concat("Z");o.d=f;break;case"cross":f="M "+(t-e)+" "+i+" L "+(t+e)+" "+i+" M "+t+" "+(i+u)+" L "+t+" "+(i-u);o.d=f;o.stroke=p}return this["draw"+w](o)},w.prototype.drawBottomTopLegend=function(n,i){var rt=this.legendTitleLocation,v=this.model.margin,s=this.yOffset,c=0,tt=0,u=this.elementSpacing,nt,f,y,o,h=this.model.legend.itemStyle,w=this.model.legend.font.color,b,l=0,e,k,d,r,p,g;if(nt=this.isNullOrUndefined(w)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":w,this.isNullOrUndefined(n.rowCount||n.columnCount))for(this.legendItemGroup=this.createGroup({id:this._id+"legendItem_Group"}),n.title.visible&&n.title.text!=" "?(y=this.measureText(n.title.text,n.title.font),f=n.position==t.bottom?this.areaBounds.actualHeight+y.height+2*u+s:s+y.height+2*u):f=(n.position=t.bottom)?u+v.top+2*this.circularRadius[this.totallayerCount-1]+s+u:u+v.top+s+u,r=0;r<i.length;r++)if(c+=u+l+tt,o=Math.sqrt(h.width*h.width+h.height*h.height)/2,w=i[r].visibility?i[r].fill:"grey",c+l>900&&(f=f+this.measureText(i[r].Text,i[r].font).height+u,c=u),this.findLegendPosition(o,c,f,n,i[r]),this.legendInRegion)this.model.legendItemRendering&&(p=$.extend({},this.common),g={location:{x:c,y:f},text:i[r].Text,shape:i[r].sunburstLegendShape},p.data=g,this._trigger("legendItemRendering",p)),e=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),e.style.cursor="pointer",b=this.drawLegendShape(i[r],c,f,r),e.appendChild(b),l=this.measureText(i[r].Text,i[r].font).width+o*2,k={id:this._id+"_svg_LegendItemText"+r.toString(),x:c+u,y:f+o*3/4,fill:nt,"font-size":i[r].font.size,"font-style":i[r].font.fontStyle,"font-family":i[r].font.fontFamily,"font-weight":i[r].font.fontWeight,"text-anchor":"start"},tt=n.itemPadding,d=this.createText(k,i[r].Text),e.appendChild(d),this.legendItemGroup.appendChild(e);else{this.legendPaging(n,r,i);break}else{var ut=n.rowCount,ft=n.columnCount,it=i.length,a=10;for(n.title.visible&&n.title.text!=" "?(y=this.measureText(n.title.text,n.title.font),f=n.position==t.bottom?2*u+v.top+2*this.circularRadius[this.totallayerCount-1]+s+y.height:2*u+v.top+s+y.height):f=n.position==t.bottom?2*u+v.top+2*this.circularRadius[this.totallayerCount-1]+s:2*u+v.top+s,r=0;r<it;r++)if(w=i[r].visibility?i[r].fill:"grey",e=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),o=Math.sqrt(h.width*h.width+h.height*h.height)/2,a+i[r].Bounds.Width>this.LegendBounds.Width+10&&(a=l=10,f+=u+i[r].Bounds.Height),this.findLegendPosition(o,a,f,n,i[r]),this.legendInRegion)this.model.legendItemRendering&&(p=$.extend({},this.common),g={location:{x:a,y:f},text:i[r].Text,shape:i[r].sunburstLegendShape},p.data=g,this._trigger("legendItemRendering",p)),l=this.measureText(i[r].Text,i[r].font).width+o*2,e=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),e.style.cursor="pointer",b=this.drawLegendShape(i[r],a,f,r),e.appendChild(b),l=this.measureText(i[r].Text,i[r].font).width+o*2,k={id:this._id+"_svg_LegendItemText"+r.toString(),x:a+u,y:f+o*3/4,fill:nt,"font-size":i[r].font.size,"font-style":i[r].font.fontStyle,"font-family":i[r].font.fontFamily,"font-weight":i[r].font.fontWeight,"text-anchor":"start"},a+=l+u,d=this.createText(k,i[r].Text),e.appendChild(d),this.legendItemGroup.appendChild(e);else{this.legendPaging(n,r,i);break}}return this.legendItemGroup},w.prototype.drawLeftRightLegend=function(n,t,i){var c=0,it=0,d,o=0,s,u,e=this.model.legend.itemStyle,y=this.model.legend.font.color,p,g=0,f,w,b,a=0,nt=this.elementSpacing,rt=this.model.margin,r,l,k;if(d=this.isNullOrUndefined(y)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":y,this.isNullOrUndefined(n.rowCount||n.columnCount)){for(n.title.visible&&n.title.text!=" "&&(s=this.measureText(n.title.text,n.title.font),a=s.height+nt),o=a+nt+it,c=nt+rt.left,r=0;r<t.length;r++)if(s=this.measureText(t[r].Text,t[r].font),u=Math.sqrt(e.width*e.width+e.height*e.height)/2,y=t[r].visibility?t[r].fill:"grey",this.findLegendPosition(u,c,o,n,t[r]),this.legendInRegion)this.model.legendItemRendering&&(l=$.extend({},this.common),k={location:{x:c,y:o},text:t[r].Text,shape:t[r].sunburstLegendShape},l.data=k,this._trigger("legendItemRendering",l)),p=this.drawLegendShape(t[r],c,o,r),g+=s.width+u,f=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),w={id:this._id+"_svg_LegendItemText"+r.toString(),x:c+this.elementSpacing,y:o+u*3/4,fill:d,"font-size":t[r].font.size,"font-style":t[r].font.fontStyle,"font-family":t[r].font.fontFamily,"font-weight":t[r].font.fontWeight,"text-anchor":"start"},it=n.itemPadding,o+=s.height/2+this.elementSpacing,b=this.createText(w,t[r].Text),f.appendChild(p),f.appendChild(b),this.legendItemGroup.appendChild(f);else{this.legendPaging(n,r,t);break}return this.legendItemGroup}var ft=n.rowCount,et=n.columnCount,ut=t.length,v=10,h=26,tt=0;for(i||(this.LegendBounds.Height+=this.measureText(n.title.text,n.title.font).height),this.model.legend.title.visible&&this.model.legend.title.text!=" "&&(s=this.measureText(n.title.text,n.title.font),a=s.height),o=a+this.elementSpacing,c=this.elementSpacing+this.model.margin.left,r=0;r<ut;r++)if(y=t[r].visibility?t[r].fill:"grey",f=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),u=Math.sqrt(e.width*e.width+e.height*e.height)/2,h+t[r].Bounds.Height+n.itemPadding+a+2>this.LegendBounds.Height+26&&(h=26,v+=tt+n.itemPadding),h+=t[r].Bounds.Height/2+n.itemPadding,tt=Math.max(tt,t[r].Bounds.Width),this.findLegendPosition(u,v,h,n,t[r]),this.legendInRegion)this.model.legendItemRendering&&(l=$.extend({},this.common),k={location:{x:v,y:h},text:t[r].Text,shape:t[r].sunburstLegendShape},l.data=k,this._trigger("legendItemRendering",l)),g=this.measureText(t[r].Text,t[r].font).width+u*2,f=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),f.style.cursor="pointer",p=this.drawLegendShape(t[r],v,h,r),f.appendChild(p),g=this.measureText(t[r].Text,t[r].font).width+u*2,w={id:this._id+"_svg_LegendItemText"+r.toString(),x:v+u,y:h+u*3/4,fill:d,"font-size":t[r].font.size,"font-style":t[r].font.fontStyle,"font-family":t[r].font.fontFamily,"font-weight":t[r].font.fontWeight,"text-anchor":"start"},b=this.createText(w,t[r].Text),f.appendChild(b),this.legendItemGroup.appendChild(f);else{this.legendPaging(n,r,t);break}return this.legendItemGroup},w.prototype.legendPaging=function(n,t,i){var u=this.legendCollection.length,o=t,f,r,e;for(this.legendPages=[],this.currentpageNumber=1,this.totalpageNumbers=t==0?u:u%t==0?Math.floor(u/t):Math.floor(u/t)+1,r=0;r<u;r=r+o){for(f=[],e=0;e<o;e++)r+e<u&&f.push(i[r+e]);if(o==0){f.push(i[r]);this.legendPages.push(f);break}this.legendPages.push(f)}},w.prototype.findLegendPosition=function(n,i,r,u,f){var e=this.elementSpacing,o,s=20/100;u.position==t.bottom?this.legendInRegion=n+r+e>this.height-e?!1:!0:u.position==t.top?this.legendInRegion=this.yOffset+s*this.height-this.elementSpacing-n>r?!0:!1:(u.position==t.left||u.position==t.right)&&(this.isNullOrUndefined(u.rowCount)&&this.isNullOrUndefined(u.columnCount)?this.legendInRegion=n+r+e>this.height-e?!1:!0:(o=this.measureText(f.Text,f.font),this.legendInRegion=s*this.width+e>i+n+o.width?!0:!1))},w.prototype.drawDatalabel=function(n){var y,a,v;for(this.dataLabelGroupEle=this.createGroup({id:this._id+"_svg_DataLabelGroup"}),y=0;y<n.length;y++){var r=n[y],t=void 0,u=void 0,e=void 0,g=void 0,f=void 0,nt=void 0,tt=void 0,it=void 0,k=void 0,vt=void 0,d=void 0,p=void 0,w=void 0,rt=void 0,l=void 0,ut=void 0,ft=void 0,yt=void 0,s=void 0,h=void 0,et=void 0,ot=void 0,st=void 0,ht=void 0,b=void 0,ct=void 0,lt=void 0,i=this.model,pt=this.circularRadius[0]-this.innerRadius[0],at=void 0;for(a=0;a<r.point.length;a++)t=r.point[a],t.y!=null&&(b=r.layerNumber,u=t.text?t.text:i.dataSource?t.x:t.y.toString(),e=this.measureText(u,i.dataLabelSettings.font),g=-.5*Math.PI,k=this.circularRadius[r.layerNumber-1],yt=e.height/2,s=this.circleCenterX,h=this.circleCenterY,f=t.midAngle+g,et=this.getXcordinate(s,k,f),ot=this.getYcordinate(h,k,f),ct=this.getXcordinate(s,this.innerRadius[b-1],f),lt=this.getYcordinate(h,this.innerRadius[b-1],f),at={dMidX:ct,dMidY:lt},r.layerNumber>1&&(st=this.getXcordinate(s,this.circularRadius[r.layerNumber-2],f),ht=this.getYcordinate(h,this.circularRadius[r.layerNumber-2],f)),nt={midX:et,midY:ot},tt={childMidX:st,childMidY:ht},it={midPoint:nt,childMidPoint:tt,sunburstMidPoint:at},ft={startX:s,startY:h},vt={width:this.width,height:this.height},d=this.calculateLabelPosition(ft,it),p=d.positionX,w=d.positionY,rt="middle",l=this.textOptions(t,p,w,e,rt,r.layerNumber,a),this.isNullOrUndefined(i.dataLabelSettings.template)?(v=$.extend({},this.common),v.data={Text:u,location:{x:p,y:w},pointIndex:t.pointIndex},this._trigger("dataLabelRendering",v),i.dataLabelSettings.labelRotationMode==c.normal&&i.dataLabelSettings.labelOverflowMode!=o.none&&this.isNullOrUndefined(i.dataLabelSettings.template)?u=this.horizontalTrim(l,e.width,v.data.Text,s,h,t,this.model.dataLabelSettings.font,b-1):i.dataLabelSettings.labelRotationMode==c.angle&&i.dataLabelSettings.labelOverflowMode!=o.none&&this.isNullOrUndefined(i.dataLabelSettings.template)&&(u=this.rotatedTrim(l,e.width,v.data.Text,pt,t)),u!=""&&(ut=this.createText(l,u),this.dataLabelGroupEle.appendChild(ut))):this.labelTemplate(p,w,l,e,t))}return this.dataLabelGroupEle},w.prototype.labelTemplate=function(n,t,i,r,u){var l=this._id,o={interior:this.model.dataLabelSettings.fill,opacity:1,borderColor:"white",borderWidth:.1},s,f,e,h,c;s=!this.isNullOrUndefined(o)&&o.interior?o.interior:"transparent";e=document.getElementById(this._id+"_svg_DataLabelGroup");this.isNullOrUndefined(e)&&(e=document.createElement("div"),e.id=this._id+"_svg_DataLabelGroup",e.style.zIndex="5000",document.getElementById(this._id).appendChild(e));f=document.createElement("div");f.id="template_ele_"+this._id;this.clonenode=document.getElementById(this.model.dataLabelSettings.template).cloneNode(!0);this.clonenode.style.display="block";this.clonenode.innerHTML=this.parseTemplate(this.clonenode,u);f.style.backgroundColor=s;f.style.display="block";f.style.cursor="default";f.style.position="absolute";f.appendChild(this.clonenode);document.getElementById(this._id+"_svg_DataLabelGroup").appendChild(f);h=f.clientWidth;c=f.clientHeight;f.style.left=(i.x-h/2).toString()+"px";f.style.top=(i.y-c/2).toString()+"px"},w.prototype.parseTemplate=function(n,t){var i;return i=n.innerHTML,i.search("#point.x#")!=-1&&(i=i.replace("#point.x#",t.x.toString())),i.search("#point.y#")!=-1&&(i=i.replace("#point.y#",t.y.toString())),i.search("#point.text#")!=-1&&(i=this.isNullOrUndefined(t.text)?i.replace("#point.text#",t.y.toString()):i.replace("#point.text#",t.text.toString())),i},w.prototype.rotatedTrim=function(n,t,i,r){for(var u=this.model;r-u.segmentBorder.width<t;)if(u.dataLabelSettings.labelOverflowMode==o.trim)if(i=this.trimText(i,i.length,"..."),i=="..."){i="";break}else t=this.measureText(i,u.dataLabelSettings.font).width;else{i="";break}return i},w.prototype.trimText=function(n,t,i){var r,u;return t--,r=t-i.length,u=n.substr(0,r),u+i},w.prototype.horizontalTrim=function(n,t,i,r,u,f,e,s){var w=-.5*Math.PI,v,a,c,l,d="...",k,y,b,p=this.model,h;if(h=this.calculatePosition(n,t,r,u),v=p.startAngle,a=p.endAngle,k=a-v,v=(Math.atan2(h.rightEndY,h.rightEndX)-w)%(2*Math.PI),v<0&&(v=2*Math.PI+v),a=(Math.atan2(h.leftEndY,h.leftEndX)-w)%(2*Math.PI),a<0&&(a=2*Math.PI+a),c=parseFloat(f.start.toFixed(14)),l=parseFloat(f.end.toFixed(14)),k>0?(c=c,l=l):(c=c<0?2*Math.PI+c:c,l=l<0?2*Math.PI+l:l),v<0&&(a>0||a==null)&&(c=c<0?2*Math.PI+c:c,l=l<=0?2*Math.PI+l:l),y=this.circleCenterX<n.x?Math.sqrt(Math.pow(Math.abs(h.rightEndX),2)+Math.pow(Math.abs(h.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(h.leftEndX),2)+Math.pow(Math.abs(h.leftEndY),2)),k<0&&(l=[c,c=l][0]),a>=c&&a<=l&&v>=c&&v<=l&&y<=this.circularRadius[s]-p.segmentBorder.width&&y>0)b=!0;else{if(p.dataLabelSettings.labelOverflowMode==o.hide)return"";for(b=!1;!b;){if(i=this.trimText(i,i.length,d),i==d){i="";break}t=this.measureText(i,p.dataLabelSettings.font).width;h=this.calculatePosition(n,t,r,u);v=(Math.atan2(h.rightEndY,h.rightEndX)-w)%(2*Math.PI);v<0&&(v=2*Math.PI+v);a=(Math.atan2(h.leftEndY,h.leftEndX)-w)%(2*Math.PI);a<0&&(a=2*Math.PI+a);y=this.circleCenterX<n.x?Math.sqrt(Math.pow(Math.abs(h.rightEndX),2)+Math.pow(Math.abs(h.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(h.leftEndX),2)+Math.pow(Math.abs(h.leftEndY),2));a>=c&&a<=l&&v>=c&&v<=l&&y<=this.circularRadius[s]&&y>0&&(b=!0)}}return i},w.prototype.calculatePosition=function(n,t,i,r){var u,f,e,o;return u=n.x+t/2-i,f=n.y-r,e=n.x-t/2-i,o=n.y-r,{rightEndX:u,rightEndY:f,leftEndX:e,leftEndY:o}},w.prototype.textOptions=function(n,t,i,r,u,f,e){var s,a=0,v,o=this.model.dataLabelSettings.font,h=o.color,l,y;return this.model.dataLabelSettings.labelRotationMode==c.angle&&((n.midAngle>2*Math.PI||n.midAngle<0)&&(s=this.findAngle(n.midAngle)),a=n.midAngle<=Math.PI||!this.isNullOrUndefined(s)?this.isNullOrUndefined(s)?(n.startAngle-Math.PI/2+(n.endAngle-Math.PI/2))/2*(180/Math.PI):s<=Math.PI?(n.startAngle-Math.PI/2+(n.endAngle-Math.PI/2))/2*(180/Math.PI):(n.startAngle+n.endAngle)*90/Math.PI-270:(n.startAngle+n.endAngle)*90/Math.PI-270),v=this._colorNameToHex(n.fill),(this.isNullOrUndefined(h)||h=="")&&(l=this._hexToRgb(v),y=Math.round((parseInt(l.r)*299+parseInt(l.g)*587+parseInt(l.b)*114)/1e3),h=y>=128?"black":"white"),{id:this._id+"_legendIndex"+n.legendIndex+"_layerNumber"+f.toString()+"_pointIndex"+e.toString(),x:t,y:i+r.height/4,fill:h,"font-size":o.size,"font-family":o.fontFamily,"font-style":o.fontStyle,"font-weight":o.fontWeight,opacity:o.opacity,"text-anchor":u,cursor:"default",transform:"rotate("+a+","+t+","+i+")"}},w.prototype._colorNameToHex=function(n){var t=n,i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",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",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:"#ff00ff",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",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#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:"#6b8e23",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return Object.prototype.toString.call(t)=="[object Array]"?t:typeof i[t.toLowerCase()]!="undefined"?i[t.toLowerCase()]:t},w.prototype._hexToRgb=function(n){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},w.prototype.findAngle=function(n){var t;if(n>0)if(t=n%(2*Math.PI),t>2*Math.PI)this.findAngle(t);else return t;else return 2*Math.PI+n},w.prototype.calculateLabelPosition=function(n,t){var i,r,u,f,e,o,c,l,s,h;return u=t.midPoint.midX,f=t.midPoint.midY,e=t.childMidPoint.childMidX,o=t.childMidPoint.childMidY,c=n.startX,l=n.startY,s=t.sunburstMidPoint.dMidX,h=t.sunburstMidPoint.dMidY,this.isNullOrUndefined(e)?(i=(u+s)/2,r=(f+h)/2):(i=(u+e)/2,r=(f+o)/2),{positionX:i,positionY:r}},w.prototype.drawPath=function(n){var t=document.getElementById(n._id);return t===null&&(t=this.createElement("path")),this.setAttributes(n,t),t},w.prototype.sunburstRender=function(n){var i,r,t;for(this.circleCenterX=[],this.circleCenterY=[],this.circularRadius=[],this.sunburstRegions=[],this.startX=[],this.startY=[],this._visiblePoints=n,this.calculateSliceAngle(n[0].point),i=2;i<=this.totallayerCount;i++)for(t=1;t<n.length;t++)i==n[t].layerNumber&&this.calculateChildAngle(n[t]);for(this.circularRadius=this.calculateRadius(this.areaBounds.actualWidth,this.areaBounds.actualHeight,this.totallayerCount),this._drillInnerRadius.length==0?this.circularRadius=this.calculateRadius(this.areaBounds.actualWidth,this.areaBounds.actualHeight,this.totallayerCount):(this.circularRadius=this._drillOuterRadius[this.drilldownCount-1],this.innerRadius=this._drillInnerRadius[this.drilldownCount-1]),this.gSeriesGroupEle=this.createGroup({id:this._id+"_svg_SunBurstElementGroup"}),r=this.totallayerCount;r>0;r--)for(t=0;t<n.length;t++)r==n[t].layerNumber&&this.drawRegion(n[t],t);return this.sunburstDoubleClick=this.sunburstDoubleClick.bind(this),this.gSeriesGroupEle.addEventListener("dblclick",this.sunburstDoubleClick,!0),this.gSeriesGroupEle},w.prototype.calculateArcData=function(n,t,i){var b,c,r,u,a,o,k,v,f,e,s,y,h,p,w,d,g;b=this.model.points;c=-.5*Math.PI;r=n.startAngle+c;u=n.endAngle+c-1e-6;a=this.model.endAngle-this.model.startAngle;o=u-r<Math.PI?0:1;k=(r+u)/2;n.currentMidAngle==undefined&&(n.currentMidAngle=(r+u)/2);s=a>0?1:0;o=s?u-r<Math.PI?0:1:u-r>-1*Math.PI?0:1;f=this.circleCenterX;e=this.circleCenterY;y=f+i*Math.cos(r);p=e+i*Math.sin(r);h=f+i*Math.cos(u);w=e+i*Math.sin(u);var nt=f+this.innerRadius[t-1]*Math.cos(r),tt=e+this.innerRadius[t-1]*Math.sin(r),l=f+this.innerRadius[t-1]*Math.cos(u),it=e+this.innerRadius[t-1]*Math.sin(u),rt=s?0:1;return r<0&&Math.round(n.endAngle-n.startAngle)==6&&(l=l-.01,h=h-.01),v="M "+y+" "+p+" A "+i+" "+i+" 0 "+o+" "+s+" "+h+" "+w+" L "+l+" "+it+" A "+this.innerRadius[t-1]+" "+this.innerRadius[t-1]+" 1 "+o+" "+rt+" "+nt+" "+tt+" z",{Direction:v,centerX:d,centerY:g}},w.prototype.findParent=function(n){for(var i,r=n.layerNumber-1,t=0;t<this._visiblePoints.length;t++)if(r==this._visiblePoints[t].layerNumber)for(i=0;i<this._visiblePoints[t].point.length;i++)if(this._visiblePoints[t].point[i].x==n.parentName&&this._visiblePoints[t].point[i].legendIndex==n.legendIndex)return this._visiblePoints[t].point[i]},w.prototype.drawRegion=function(n,t){var l,a,tt,r,f,b,k=[],d,g,e=this.model,v,y,o=e.segmentBorder.color,p,s,h,it,w,u,c,nt;for(v=this.model.startAngle*(Math.PI/180),h=e.selectionSettings,o=this.isNullOrUndefined(o)?this.model.theme.toString().search("dark")!=-1?"black":"white":o,u=0;u<n.point.length;u++)if(s=!1,y=e.opacity,!isNaN(n.point[u].startAngle)){for(r=n.point[u],it=r.fill,l=this.calculateArcData(r,n.layerNumber,this.circularRadius[n.layerNumber-1]),tt=l.Direction.split(" "),g=this.circularRadius[n.layerNumber-1],r.layerIndex=t,f=this._id+"_legendIndex"+r.legendIndex+"_layerNumber"+n.layerNumber.toString()+"_layerIndex"+t.toString()+"_pointIndex"+u.toString(),c=0;c<this.selectedgroupID.length;c++)f==this.selectedgroupID[c]&&(s=!0);h.type==i.opacity&&!s&&this.selectedgroupID.length>0&&(y=h.opacity);r.id=f;a={id:f,fill:r.fill,"stroke-width":e.segmentBorder.width,"stroke-dasharray":"",d:l.Direction,stroke:o,"stroke-linecap":"butt","stroke-linejoin":"round",opacity:y,radius:g,start:r.startAngle-1.57,end:r.endAngle-1.57,innerR:this.innerRadius[n.layerNumber-1],counterClockWise:!1,x:this.circleCenterX,y:this.circleCenterY,visibility:this._enableAnimation?"hidden":"visible"};p=$.extend({},this.common);p.data={point:r,pathOptions:a};this._trigger("segmentRendering",p);w=this.drawPath(a);s&&h.type==i.color&&this.selectPointData(w);this.gSeriesGroupEle.appendChild(w);b={x:r.x,y:r.y,fill:r.fill,text:r.text,layerNumber:n.layerNumber,layerIndex:t,parentName:n.parentName,pointIndex:u,startAngle:r.startAngle-v,endAngle:r.endAngle-v,startX:this.startX,startY:this.startY,groupNumber:n.groupNumber,id:f,legendIndex:r.legendIndex};k.push(b)}d={Radius:this.circularRadius[n.layerNumber-1],centerX:this.circleCenterX,centerY:this.circleCenterY,innerRadius:this.innerRadius[n.layerNumber-1]};nt={sunburstData:d,region:k};this.sunburstRegions.push(nt)},w.prototype.calculateRadius=function(n,t,i){var r=0,f=[],s,e=this.model.radius,c=Math.min(n,t),o,h=this.model.innerRadius,u;for(this.innerRadius=[],s=e>1?1:e<0?0:e,o=c/2*s,h!=0?this.innerRadius.push(h*o):this.innerRadius.push(0),u=0;u<i;u++)u==0?(r=(o-this.innerRadius[0])/i+this.innerRadius[0],f[u]=r):(this.innerRadius.push(r),r=r-this.innerRadius[u-1]+r,f[u]=r);return f},w.prototype.calculateSliceAngle=function(n){for(var v=n.length,o=0,u=360,i,s=this.model.margin,y,p,h,c=0,w,b,f,d,l=0,a=0,k=this.model.border.width,r=this.model.legend,e=0;e<v;e++)n[e].y=this.isNullOrUndefined(n[e].y)?this.isNullOrUndefined(n[e].point)?0:this.calculateSumofY(n[e],o):n[e].y,o+=n[e].y;for(this.model.startAngle>this.model.endAngle&&(this.model.endAngle==0?this.model.endAngle=360:this.model.endAngle<0&&(this.model.endAngle=360+this.model.endAngle)),u=this.model.endAngle!=null&&this.model.startAngle<this.model.endAngle?this.model.endAngle-this.model.startAngle:this.model.startAngle>this.model.endAngle&&!this.isNullOrUndefined(this.model.endAngle)?360-this.model.startAngle+this.model.endAngle:360,u=u!=360&&u!=-360?u%360:u,this.model.startAngle?(this.model.startAngle=this.model.startAngle%360,this.model.endAngle=this.model.startAngle+u,c=this.model.startAngle?o/360*this.model.startAngle:0,c=c/o):this.model.endAngle=u,r.visible&&(r.position==t.right||r.position==t.left?(l+=this.elementSpacing+this.LegendBounds.Width,this.isNullOrUndefined(r.size.width)||(l=parseFloat(r.size.width))):(r.position==t.bottom||r.position==t.top)&&(a+=this.elementSpacing+this.LegendBounds.Height,this.isNullOrUndefined(r.size.height)||(a=parseFloat(r.size.height)))),y=this.height-(a+s.top+s.bottom+k*2+this.yOffset),p=this.width-(l+s.left+s.right+k*2),this.circleCenterX=p*.5+s.left+(r.visible&&r.position==t.left?l:0),this.circleCenterY=y*.5+s.top+this.yOffset+(r.visible&&r.position==t.top?a:0),u=this.model.endAngle-this.model.startAngle,b=u/180,f=0;f<v;f++)i=n[f],i.startAngle=f==0?2*Math.PI*c:h,h=i.endAngle=b*Math.PI*(i.y/o)+i.startAngle,h=i.endAngle=isNaN(h)?i.startAngle:h,i.start=i.startAngle,i.end=i.endAngle,i.midAngle=(i.endAngle+i.startAngle)/2,i.pointIndex=f,w=-.5*Math.PI,i.radian=i.midAngle/2%(2*Math.PI),c+=i.y/o,d=i.midAngle+w,this.startX[f]=this.circleCenterX,this.startY[f]=this.circleCenterY},w.prototype.calculateTotaldegree=function(n,t){var i=0;return n<t?i=t-n:n>t&&(i=360-n+t),i},w.prototype.calculateSumofY=function(n,t){for(var r=n.point,i=0;i<r.length;i++)this.isNullOrUndefined(r[i].y)?this.isNullOrUndefined(r[i].point)||(r[i].y=this.calculateSumofY(r[i],t),t+=r[i].y):t+=r[i].y;return t},w.prototype.calculateChildAngle=function(n){for(var i,u,o,f=0,s,t,r=this.findParent(n),e=0;e<n.point.length;e++)f=f+n.point[e].y;for(s=r.y,u=i=r.startAngle,o=r.endAngle-r.startAngle,t=0;t<n.point.length;t++)t==0?(n.point[t].startAngle=u,n.point[t].start=u,i=n.point[t].y/f*o+u,n.point[t].end=n.point[t].endAngle=i,n.point[t].midAngle=(n.point[t].startAngle+n.point[t].endAngle)/2):(n.point[t].startAngle=i,n.point[t].start=i,i=n.point[t].y/f*o+i,n.point[t].end=n.point[t].endAngle=i,n.point[t].midAngle=(n.point[t].startAngle+n.point[t].endAngle)/2)},w.prototype.calculateSize=function(n,t){var o,s,u=this.model.border.width,i,f,h,c,l,r=this.model.margin,e=this.elementSpacing;return i=this._getLegendSpace(this.model.legend),f=i.leftLegendWidth+u+r.left,h=i.rightLegendWidth+r.right+r.left+2*u,c=n.width,o=c-(f+h),l=r.top+e+i.modelTitleHeight+i.modelsubTitleHeight+i.topLegendHeight+u,this.yOffset=t.text&&t.visible?this.titleLocation.size.height+e+(t.subtitle.text==""?0:t.subtitle.text&&t.subtitle.visible?this.subTitleLocatation.size.height:0):0,s=n.height-(i.modelTitleHeight+e+r.top+i.modelsubTitleHeight+i.topLegendHeight+i.bottomLegendHeight),{x:f,y:l,actualWidth:o,actualHeight:s}},w.prototype._getLegendSpace=function(n){var l=this.LegendActualBounds,f=this.elementSpacing,k=this.model.legend.border.width,e=0,r=0,u=0,o=0,a,c=this.model.legend.position,v=0,y=0,p=0,w,b,s,h,i=this.model.title;return f=this.legendClicked?0:f,n.visible&&(a=parseFloat(l.Width)+5+f+2*k,h=this.width*(20/100),e=c==t.left?a:0,e>h&&this.isNullOrUndefined(n.size.width)&&(e=h),r=c==t.right?a:0,r>h&&this.isNullOrUndefined(n.size.width)&&(r=h),s=this.height*(20/100),v=n.title.visible?this.measureText(n.title.text,n.title.font).height:0,u=c==t.top?f+parseFloat(l.Height)+v:0,o=c==t.bottom?f+parseFloat(l.Height)+v:0,u>s&&this.isNullOrUndefined(n.size.height)?u=s:o>s&&this.isNullOrUndefined(n.size.height)&&(o=s),this.LegendActualBounds.Height=u==0&&o!=0?o:u!=0?u:this.LegendActualBounds.Height,this.LegendActualBounds.Width=r==0&&e!=0?e:r!=0?r:this.LegendActualBounds.Width),y=this.measureText(i.text,i.font).height,p=this.measureText(i.subtitle.text,i.subtitle.font).height,w=i.text==""||!i.visible?0:y+f,b=i.subtitle.text==""||!i.subtitle.visible?0:p,{leftLegendWidth:e,rightLegendWidth:r,topLegendHeight:u,bottomLegendHeight:o,modelTitleHeight:w,modelsubTitleHeight:b}},w.prototype.calculateLegendBounds=function(){var r,it,k,w;this.legendCollection=[];this.legendRegion=[];this.legendTextRegion=[];this._legendMaxHeight=0;this._legendMaxWidth=0;var u=this.model.legend,h=10,et=u.size.height,ot=u.size.width,n=u.itemPadding>0?u.itemPadding:0,c=u.position.toLowerCase(),f=0,e=0,vt=this.height,yt=this.width,l=0,a=0,t=0,s=0,rt=1,st={},v=[],d=this.model.legend.rowCount,g=this.model.legend.columnCount,nt=this.elementSpacing,tt=this.measureText(u.title.text,u.title.font),ht=u.border.width,ct=this.model.border.width,pt=vt-(nt*4+ct*2+ht*2),wt=yt-(nt*4+ct*2+ht*2),o=[],lt,bt,ut,b,y,at,i,kt,p,ft;if(u.visible){for(o=this.layerData[0].point,lt=o.length,r=0;r<lt;r++)kt=o[r],bt=o[r].fill,ut=o[r].x,st={sunburstLegendShape:u.shape,Text:ut,displayText:ut,font:u.font,groupNumber:o[r].groupNumber,layerIndex:o[r].layerIndex,layerNumber:o[r].layerNumber,Shape:"None",visibility:!0,fill:o[r].fill,points:o[r].point,x:o[r].x,y:o[r].y},v.push(st);for(b=v.length,it=0;it<b;it++)y=v[it],at=u.itemStyle.width,i=this._getLegendSize(y),l=Math.max(this._legendMaxWidth>0?this._legendMaxWidth+n+at:i.Width,l),a=Math.max(i.Height,a);for(s=a+nt*2,t=l,(d||g)&&(ft=this.legendItemBounds(b,l+n,a+n),t=ft.LegendWidth,s=ft.LegendHeight,c==="top"||c==="bottom"||c==="custom"?s=s-n+nt:t=t-n),k=0;k<b;k++)y=v[k],i=this._getLegendSize(y),p=d||g?{Width:l,Height:a}:i,p._Width=i.Width,v[k].Bounds=p,this.legendCollection.push(y);for(w=0;w<b;w++)y=v[w],i=this._getLegendSize(y),d||g||(c=="top"||c=="bottom"||c=="custom"?(f+=i.Width+n,f>wt&&w!=0?(f-=i.Width+n,t=Math.max(t,f),f=i.Width+n,rt++,s+=a+n):t=Math.max(t,f),e=Math.max(e,a)):(e+=i.Height+n,e>pt?(e-=i.Height+n,s=Math.max(s,e),e=i.Height+n,t+=l+n):s=Math.max(s,e),f=Math.max(f,l))),p=d||g?{Width:l,Height:a}:i,p._Width=i.Width,v[w].Bounds=p;c==="top"||c==="bottom"||c==="custom"?(t=tt.width>t-n?tt.width+h*2+n:t+h*2,f+=h,e+=h*2,this.LegendBounds={Width:Math.max(t,f)-n,Height:Math.max(s,e),Rows:rt}):(t=tt.width>t-n?tt.width+h*2+n:t+h*2,f+=h,e+=h*2,this.LegendBounds={Width:Math.max(t,f),Height:Math.max(s,e)+h-n,Columns:rt})}else this.LegendBounds={Width:0,Height:0};this.LegendActualBounds=this.LegendBounds;ot!=null&&(this.LegendActualBounds.Width=ot);et!=null&&(this.LegendActualBounds.Height=et)},w.prototype._getLegendSize=function(n){var r=this.model.legend,t=r.itemStyle,i=this.measureText(n.Text,n.font),u=t.width+10+i.width,f=Math.max(t.height,i.height);return{Width:u,Height:f}},w.prototype.legendItemBounds=function(n,t,i){var r=this.model.legend,s,h=r.position,c=r.itemPadding,u,e,o=0,f=0;return this.isNullOrUndefined(r.columnCount)&&r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):this.isNullOrUndefined(r.rowCount)&&r.columnCount?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):r.rowCount&&r.columnCount&&(r.columnCount<r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):r.columnCount>r.rowCount?h==="top"||h==="bottom"||h==="custom"?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):(u=Math.ceil(n/r.columnCount),e=Math.ceil(n/u),o=t*e,f=i*u):h==="top"||h==="bottom"?(u=Math.ceil(n/r.columnCount),s=Math.ceil(n/r.rowCount),o=t*r.columnCount,f=i*s):(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u)),f+=this.elementSpacing,{LegendWidth:o,LegendHeight:f}},w.prototype.drawTitle=function(n,t){var r,o,s,h,c,i,e=this.elementSpacing,f=n.font.color;return f=this.isNullOrUndefined(f)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":f,r=this.measureText(n.text,n.font),o=n.textAlignment==u.center?t.width/2-r.width/2:n.textAlignment==u.near?2*e:t.width-r.width-2*e,s=r.height/2+e,i=$.extend({},this.common),i.data={TitleText:n.text,location:{X:o,Y:s},size:r},this._trigger("titleRendering",i),h={id:this._id+"SunburstTitle",x:i.data.location.X,y:i.data.location.Y,fill:f,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,"text-anchor":"start"},this.gTitleGroupElement=this.createGroup({id:this._id+"SunburstTitle"}),c=this.createText(h,i.data.TitleText),this.gTitleGroupElement.appendChild(c),this.titleLocation={size:r,x:i.data.location.X,y:i.data.location.Y},n.subtitle.text!=""&&n.subtitle.visible&&this.drawSubtitle(n,t,r,this.titleLocation),this.gTitleGroupElement},w.prototype.drawSubtitle=function(n,t,i,r){var s,e,o,h,c,l,f=n.subtitle.font.color;f=this.isNullOrUndefined(f)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":f;s=this.measureText(n.subtitle.text,n.subtitle.font);e=n.subtitle.textAlignment==u.far?r.x+r.size.width:n.subtitle.textAlignment==u.near?r.x:r.x+i.width/2;o=r.size.height+2*this.elementSpacing;l=n.subtitle.textAlignment==u.far?"end":n.subtitle.textAlignment==u.near?"start":"middle";h={id:this._id+"SunburstSunbtitle",x:e,y:o,fill:f,"font-size":n.subtitle.font.size,"font-family":n.subtitle.font.fontFamily,"font-style":n.subtitle.font.fontStyle,"font-weight":n.subtitle.font.fontWeight,opacity:n.subtitle.font.opacity,"text-anchor":l};this.subTitleLocatation={size:s,x:e,y:o};c=this.createText(h,n.subtitle.text);this.gTitleGroupElement.appendChild(c)},w.prototype.measureText=function(n,t){var r=document.querySelectorAll("#measureTex"),i;return r.length==0?(i=document.createElement("text"),i.setAttribute("id","measureTex"),document.body.appendChild(i)):(i=r[0],i.style.display="block"),i.innerHTML=n,i.style.fontSize=t.size,i.style.fontFamily=t.fontFamily,i.style.fontWeight=t.fontWeight,i.style.backgroundColor="white",i.style.position="absolute",i.style.visibility="hidden",i.style.whiteSpace="nowrap",{width:i.offsetWidth,height:i.offsetHeight}},w.prototype.drawContainerRect=function(){var n;return n={id:this._id+"_svg_svgRect",x:0,y:0,width:this.width,height:this.height,fill:this.model.background||"transparent",stroke:this.model.border.color,"stroke-width":this.model.border.width,opacity:"0.5"},this.drawRect(n)},w.prototype.processData=function(n){var r=n.length,i,t;for(this.findBaseData(n),t=0;t<n.length;t++)i=n[t],i.legendIndex=t,n[t].point&&this.findLayerData(n[t].point,n[t].x,1,n[t].groupNumber,t)},w.prototype.findBaseData=function(n){var i=[],t;for(this.layerData=[],t=0;t<n.length;t++)i.push(n[t]),i[t].groupNumber=t+1,i[t].layerIndex=0,i[t].layerNumber=1,i[t].legendIndex=t,n[t].groupNumber=t+1;this.layerData.push({point:i,layerNumber:1,legendIndex:0});this.totallayerCount=1},w.prototype.findLayerData=function(n,t,i,r,u){for(var e=[],f=0;f<n.length;f++)n[f].point?(n[f].legendIndex=u,this.findLayerData(n[f].point,n[f].x,i+1,r,u),n[f].layerIndex=this.layerData.length,e.push(n[f])):(n[f].legendIndex=u,n[f].layerIndex=this.layerData.length,e.push(n[f]));n.layerData=this.layerData.length;this.layerData.push({point:e,parentName:t,layerNumber:i+1,groupNumber:r,layerIndex:this.layerData.length,legendIndex:u});i+1>this.totallayerCount&&(this.totallayerCount=i+1)},w.prototype.setColors=function(n){for(var r=["#3082bd","#e55725","#9cbb59","#F6851F","#8165a3","#4fa045","#d456a0","#0dbdef","#e2a325","#03a09c"],i=this.model.palette,t=0;t<n.length;t++)this.isNullOrUndefined(n[t].fill)||this._sunburstRedraw?(this.isNullOrUndefined(i)||i.length!=0?(n[t].fill=this.isNullOrUndefined(i)?r[t%r.length]:i[t%i.length],n[t].fill.trim().length==0&&(n[t].fill="black")):n[t].fill="black",this.isNullOrUndefined(n[t].point)||this.setchildColors(n[t].point,n[t].fill)):this.isNullOrUndefined(n[t].point)||(n[t].fill.trim().length==0&&(n[t].fill="black"),this.setchildColors(n[t].point,n[t].fill))},w.prototype.setchildColors=function(n,t){t=t.trim().length==0?"black":t;for(var i=0;i<n.length;i++)this.isNullOrUndefined(n[i].fill)||this._sunburstRedraw?(n[i].fill=t,n[i].fill.trim().length==0&&(n[i].fill="black"),this.isNullOrUndefined(n[i].point)||this.setchildColors(n[i].point,t)):this.isNullOrUndefined(n[i].point)||this.setchildColors(n[i].point,t)},w.prototype.processDataSource=function(n){var h=this.model.levels.length,u=[],f=0,e,o,t,s,i,r;for(this.model.points=[],this.parentNames=[],this.levelNames=[],this.childProcess=undefined,i=0;i<n.length;i++)if(e=n[i],o=this.model.levels[f].groupMemberPath,t=e[o],s=$.inArray(t,u),s<0)this.model.points.push({x:t,y:n[i][this.model.valueMemberPath],layer:f+1,parentName:t,parentChildName:t}),u.push(t);else for(r=0;r<this.model.points.length;r++)this.model.points[r].x==t&&(this.model.points[r].y+=n[i][this.model.valueMemberPath]);this.model.levels.length>1&&this.createOtherLayerPoints(n,1)},w.prototype.createOtherLayerPoints=function(n,t){for(var o,e,i=n,s=this.model.levels[t].groupMemberPath,h,c=this.model.levels,f=this.model.points,r=0;r<i.length;r++){var u="",l="",v=0,a=void 0,y=void 0,p=void 0,w=void 0;for(o=0;o<=t;o++)y=c[o].groupMemberPath,l=i[r][y],this.isNullOrUndefined(l)||(u+=l+"_"),v==t&&(u=u.substring(0,u.length-1)),v++;if(p=$.inArray(u,this.levelNames),w=c[t-1].groupMemberPath,a=i[r][w],p<0&&!this.isNullOrUndefined(i[r][s]))this.levelNames.push(u),h=i[r][this.model.valueMemberPath],f.push({x:i[r][s],y:h,layer:t+1,parentChildName:u,parentName:a});else if(!this.isNullOrUndefined(i[r][s]))for(e=0;e<f.length;e++)f[e].parentName==a&&u==f[e].parentChildName&&(f[e].y+=h)}t<c.length-1?this.createOtherLayerPoints(i,t+1):(this._points=f,this.model.points=[],this.alignDataSourcePoints(i,1))},w.prototype.alignDataSourcePoints=function(n,t){for(var i,u=this.model.levels,r=t;r<u.length;r++)for(i=0;i<this._points.length;i++)if(r==this._points[i].layer)this.parentNames.push(this._points[i].parentName+"_layer_"+this._points[i].layer);else{r=u.length;break}this.findParentElements(this.model.points)},w.prototype.findParentElements=function(n){for(var r,t,i=0;i<this.parentNames.length;i++)for(r=this.parentNames[i],t=0;t<this._points.length;t++)r==this._points[t].x+"_layer_"+this._points[t].layer&&n.push(this._points[t]);(this.isNullOrUndefined(this.childProcess)||this.childProcess)&&this.findChildElements(n,0)},w.prototype.findChildElements=function(n,t){var i,r;this.visiblePoints=[];t<=n.length-1?(this.childProcess=!0,this.visiblePoints.push(n[t]),this.findOtherChildElements(this.visiblePoints,this.parentNames[t],2,0,i,r,t)):this.childProcess=!1},w.prototype.findOtherChildElements=function(n,t,i,r,u,f,e){for(var c,h,l,v,s=n,a,y=t.substring(0,t.indexOf("_layer_")),o=0;o<s.length;o++){for(s[o].point=[],c=0;c<this._points.length;c++)i==this._points[c].layer&&s[o].x==this._points[c].parentName&&this._points[c].parentChildName.indexOf(y)>=0&&s[o].point.push(this._points[c]);if(this.isNullOrUndefined(u))u=s,f=[],f.push({layer:i}),f[0].point=[];else if(r>=u[o].point.length){for(r>=u[o].point.length&&i>=this.model.levels.length&&this.findChildElements(this.model.points,e+1),r=0,h=0;h<s[o].point.length;h++)f[0].point.push(s[o].point[h]);u=f}else for(h=0;h<s[o].point.length;h++)f[0].point.push(s[o].point[h]);for(l=r;l<u[o].point.length;l++)r<u[o].point.length&&(i=r==0?i+1:i,r++,v=u[o].point[l],a=[],a.push(v)),this.childProcess&&this.findOtherChildElements(a,t,i,r,u,f,e)}},w.prototype.setSvgsize=function(n,t){var u,f,i,r,e,o;u=document.getElementById(t).clientWidth;f=document.getElementById(t).clientHeight;i=450;r=ej.isTouchDevice()?250:600;n.width==""||this.isResize&&this.model.isResponsive?u>0&&(r=u):(e=n.width,r=typeof e=="string"&&e.indexOf("%")!=-1?u/100*parseInt(e):parseFloat(n.width));this.width=r;this.container.setAttribute("width",r.toString());n.height!=""?(o=n.height,i=typeof o=="string"&&o.indexOf("%")!=-1?f/100*parseInt(o):parseFloat(n.height)):f>0&&(i=f);this.height=i;this.container.setAttribute("height",i.toString())},w.prototype.isNullOrUndefined=function(n){return n===undefined||n===null},w.prototype.createSvg=function(n){var t=this.createElement("svg");return this.setAttributes(n,t),t},w.prototype.drawPolygon=function(n){var t=document.getElementById(n.id);return this.isNullOrUndefined(t)&&(t=this.createElement("polygon")),this.setAttributes(n,t),t},w.prototype.createText=function(n,t){var i=this.createElement("text");return this.setAttributes(n,i),t&&(i.textContent=t),i},w.prototype.createGroup=function(n){var t=this.createElement("g");return this.setAttributes(n,t),t},w.prototype.drawRect=function(n){var t=document.getElementById(n._id);return t===null&&(t=this.createElement("rect")),this.setAttributes(n,t),t},w.prototype.drawCircle=function(n){var t=document.getElementById(n.id);return this.isNullOrUndefined(t)&&(t=this.createElement("circle")),this.setAttributes(n,t),t},w.prototype.createElement=function(n){return document.createElementNS("http://www.w3.org/2000/svg",n)},w.prototype.getXcordinate=function(n,t,i){return n+t*Math.cos(i)},w.prototype.getYcordinate=function(n,t,i){return n+t*Math.sin(i)},w.prototype.setAttributes=function(n,t){var r,u,i,f;for(r=Object.keys(n),u=r.map(function(t){return n[t]}),i=0,f=r.length;i<f;i++)t.setAttribute(r[i],u[i])},w}(ej.WidgetBase);n.SunburstChart=a;ej.widget("ejSunburstChart","ej.SunburstChart",new a);n.compareExtend=function(t,i,r){var e,o,u,f;if(typeof r=="object"&&r!==null)for(e=Object.keys(r),o=e.length,f=0;f<o;f++)u=e[f],i.hasOwnProperty(u)&&i[u]!=null?(Array.isArray(i[u])||typeof i[u]=="object"&&i[u]!==null)&&n.compareExtend({},i[u],r[u]):i[u]=r[u];return i};n.deepExtend=function(t){var u,i,r;for(t=t||{},u=1;u<arguments.length;u++)if(i=arguments[u],i)for(r in i)i.hasOwnProperty(r)&&(t[r]=typeof i[r]=="object"?n.deepExtend(t[r],i[r]):i[r]);return t}}(ejSunburstChart||(ejSunburstChart={})),function(n,t,i){t.olap=t.olap||{};t.olap.base={_initProperties:function(){this._columnHeaders=[];this._rowHeaders=[];this._valueCells=[];this.pivotEngine=[];this.olapCtrlObj=null;this._cBIndx=null;this._rBIndx=null;this._OlapDataSource;this._measureDt={};this._cTotIndexInfo=null;this._rTotIndexInfo=null;this._kpi=null;this._rowCount=0;this._colCount=0;this._isPaging=!1},_initControlProperties:function(n){n._drilledCellSet=n.model.enablePaging||n.model.enableVirtualScrolling?t.isNullOrUndefined(n._drilledCellSet)?[]:n._drilledCellSet:[];n.XMLACellSet=null;(t.isNullOrUndefined(n._fieldData)||!t.isNullOrUndefined(n._fieldData)&&t.isNullOrUndefined(n._fieldData.hierarchy))&&this._getFieldItemsInfo(n);this._currIndex={};this._isRowDrilled=!1;this._isColDrilled=!1;this._isNoSummary=n.model.layout=="nosummaries"?!0:!1},getJSONData:function(n,i,r){var u,o,e,f;n.action&&(n.action=="initialLoad"||n.action=="navPaging")&&(this._initControlProperties(r),this._applyTrim(r));this._initProperties();this.olapCtrlObj=r;this._OlapDataSource=i;u="";o=i.data;r.model.enableGroupingBar&&r._createGroupingBar(i);this._isPaging=this.olapCtrlObj.model.enablePaging||this.olapCtrlObj.model.enableVirtualScrolling?!0:!1;u=i.MDXQuery?i.MDXQuery:this._getParsedMDX(i,i.cube,n.action&&n.action!="navPaging"&&this._isPaging&&!t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?!0:!1);f=this._getConnectionInfo(this.olapCtrlObj.model.dataSource.data);e=t.isNullOrUndefined(i.providerName)||i.providerName==t.olap.Providers.SSAS?'<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+u+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+i.catalog+"<\/Catalog> <LocaleIdentifier>"+f.LCID+"<\/LocaleIdentifier> <\/PropertyList> <\/Properties><\/Execute> <\/Body> <\/Envelope>":'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command><Statement><![CDATA['+u+"]\]><\/Statement><\/Command><Properties><PropertyList><DataSourceInfo>"+i.sourceInfo+"<\/DataSourceInfo><Catalog>"+i.catalog+"<\/Catalog><AxisFormat>TupleFormat<\/AxisFormat><Content>Data<\/Content><Format>Multidimensional<\/Format><\/PropertyList><\/Properties><\/Execute><\/SOAP-ENV:Body><\/SOAP-ENV:Envelope>";n.action!="drilldown"||this._isPaging?this.olapCtrlObj.doAjaxPost("POST",f.url,{XMLA:e},n.action&&n.action!="navPaging"&&this._isPaging&&!t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?this._generatePagingData:this._generateJSONData,null,n):this.olapCtrlObj.doAjaxPost("POST",f.url,{XMLA:e},this._onDemandExpand,null,n)},_getParsedMDX:function(n,r,u){var o,e,f,c,s,h;if(n!=i){if(o="",s=n.providerName==t.olap.Providers.Mondrian,s&&n.columns.length==0&&!(n.values[0].axis=="columns"&&n.values[0].measures.length>0))return"";e=t.olap._mdxParser._getRowMDX(n);f=t.olap._mdxParser._getcolumnMDX(n);delete n._isCollapse;e=e.length>0?this._isPaging&&!u||s?"("+e+")":"NON EMPTY("+e+")":"";f=f.length>0?this._isPaging&&!u||s?"("+f+")":"NON EMPTY("+f+")":"";!this._isPaging||u||t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)||(h=this._getPagingQuery(e,f),e=h.rowQuery,f=h.columnQuery);c=t.olap._mdxParser._getSlicerMDX(n,this.olapCtrlObj);o="\nSelect \n"+(f==""?"{}":f)+"\ndimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON COLUMNS \n"+(e==""?"":","+e+"\ndimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON ROWS")+"\n "+t.olap._mdxParser._getIncludefilterQuery(n,r,this.olapCtrlObj)+c+"\n CELL PROPERTIES VALUE, FORMAT_STRING, FORMATTED_VALUE \n ";f==""&&o.replace(/NON EMPTY/g," ")}return o},_getPagingQuery:function(n,t){var i=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)==0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj._categCurrentPage)&&this._colCount>0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize):this.olapCtrlObj._categCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage),r=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)==0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj._seriesCurrentPage)&&this._rowCount>0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize):this.olapCtrlObj._seriesCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage),u=n;return{rowQuery:n!=""?"SUBSET({NONEMPTY("+n+(t!=""?","+t:"")+")},"+((r==0?1:r)-1)*this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize+","+this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize+")":"",columnQuery:t!=""?"SUBSET({NONEMPTY("+t+(u!=""?","+u:"")+")},"+((i==0?1:i)-1)*this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize+","+this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize+")":""}},_getAxisElementsUName:function(n){for(var i="",t=0;t<n.length;t++)i+=i==""?"{"+n[t].uniqueName+"}":", {"+n[t].uniqueName+"}";return i},_generatePagingData:function(i,r){var u,f,e;if(n(r).find("Error").length>0)return this.olapCtrlObj._createErrorDialog(n(r).find("faultstring").text(),i.action),!1;u=n(r).find("Axes, CellData");this._rowCount=u.find("Axis[name|='Axis1'] Tuple").length;this._colCount=u.find("Axis[name|='Axis0'] Tuple").length;f=this._getParsedMDX(this.olapCtrlObj.model.dataSource,this.olapCtrlObj.model.dataSource.cube,!1);e=this._getConnectionInfo(this.olapCtrlObj.model.dataSource.data);this.olapCtrlObj.doAjaxPost("POST",e.url,{XMLA:t.olap._mdxParser.getSoapMsg(f,this.olapCtrlObj.model.dataSource.data,this.olapCtrlObj.model.dataSource.catalog)},this._generateJSONData,null,i)},_generateJSONData:function(r,u){var o,s,h,y,w,p,c,l,a,f,e,v;if(this.olapCtrlObj.model.dataSource=this._OlapDataSource,this._isPaging&&r.action=="drilldown"&&this._onDemandExpand(r,u),o=[],s=[],n(u).find("Error").length>0)return t.Pivot._createErrorDialog(n(u).find("faultstring").text(),"Error",this.olapCtrlObj),!1;if(n(u).find("Axis[name|='SlicerAxis']").remove(),this.olapCtrlObj.XMLACellSet=n(u).find("Axes, CellData"),w=[],r=="onDemandDrill"&&(this.olapCtrlObj.XMLACellSet=u),h=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple"),y=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple"),h.length>0){if(p=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),this._rowHeaders=this._getHeaderCollection(y,"rowheader"),this._columnHeaders=this._getHeaderCollection(h,"colheader"),this._valueCells=this._getValueCells(p,h.length),indexRCell=this._measureDt.axis=="rowheader"?t.sum(this._rowHeaders.maxLvlLen)+1:t.sum(this._rowHeaders.maxLvlLen),indexCCell=this._measureDt.axis=="colheader"?t.sum(this._columnHeaders.maxLvlLen)+1:t.sum(this._columnHeaders.maxLvlLen),this._rowHeaders.headers.length>0&&t.sum(this._rowHeaders.maxLvlLen)==0&&(indexRCell=this._rowHeaders.headers[0].length),this._columnHeaders.headers.length>0&&t.sum(this._columnHeaders.maxLvlLen)==0&&(indexCCell=this._columnHeaders.headers[0].length),this._isPaging)for(f=0;f<this._rowHeaders.headers.length;f++)for(e=0;e<this._columnHeaders.headers.length;e++)t.isNullOrUndefined(this._valueCells[f])?(this._valueCells[f]=[],this._valueCells[f][e]={FormatString:"#,#",Value:""}):t.isNullOrUndefined(this._valueCells[f][e])&&(this._valueCells[f][e]={FormatString:"#,#",Value:""});for(this._populateEngine(this._rowHeaders.headers,this._columnHeaders.headers,this._valueCells),n(this.olapCtrlObj).find(".pivotGridTable").remove(),this.olapCtrlObj._measureDt=this._measureDt,c=this._rowHeaders.headers.length+indexCCell,l=this._columnHeaders.headers.length+indexRCell,this.pivotEngine.length>1&&(c=this.pivotEngine.length),f=0;f<c;f++)for(e=0;e<l;e++)o[e]==i&&(o[e]=[]),this.pivotEngine[f]!=i&&this.pivotEngine[f][e]!=i?(o[e][f]={Index:e+","+f,CSS:this.pivotEngine[f][e].CSS==""?"none":this.pivotEngine[f][e].CSS==i?"value":this.pivotEngine[f][e].CSS,Value:this.pivotEngine[f][e].Value,State:this.pivotEngine[f][e].ChildCount>0?2:this.pivotEngine[f][e].ChildCount<0?1:0,RowSpan:this.pivotEngine[f][e].RowSpan!=i?this.pivotEngine[f][e].RowSpan:1,ColSpan:this.pivotEngine[f][e].ColSpan!=i?this.pivotEngine[f][e].ColSpan:1,Info:this.pivotEngine[f][e].UName+"::"+this.pivotEngine[f][e].LName+"::"+this.pivotEngine[f][e].Value+"::"+this.pivotEngine[f][e].PUName,Span:this.pivotEngine[f][e].Span=="Block"?"Block":"None",Expander:1},this.pivotEngine[f][e].kpiInfo&&(o[e][f].kpi=this.pivotEngine[f][e].kpi,o[e][f].kpiInfo=this.pivotEngine[f][e].kpiInfo),this.pivotEngine[f][e].ActualValue&&(o[e][f].ActualValue=this.pivotEngine[f][e].ActualValue)):this.pivotEngine[f]!=i&&(a="none",f<indexCCell&&e<indexRCell&&(a="rowheader"),o[e][f]={Index:e+","+f,CSS:a,Value:"",State:0,RowSpan:1,ColSpan:1,Info:"",Span:"Block",Expander:0});for(f=0;f<l;f++)for(e=0;e<c;e++)o[f]!=i&&o[f][e]!=i&&s.push(o[f][e]);for(v=0,index=0;index<s.length;index++)if(parseInt(s[index].Index.split(",")[0])==0)v++;else break}this.olapCtrlObj._pivotRecords={records:s,rowCount:v};typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotGrid"?typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotChart"&&typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotGauge"&&typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotTreeMap"?(this._renderPager(r),this.olapCtrlObj.generateJSON({baseObj:this,tranposeEngine:o,jsonObj:s})):this.olapCtrlObj.generateJSON({baseObj:this},o):this._renderPivotGrid(r,s);this._columnHeaders=this._rowHeaders=this._valueCells=this.pivotEngine=[];this._cBIndx=this._rBIndx=null;this._measureDt={axis:"",posision:null};this._cTotIndexInfo=this._rTotIndexInfo=null},_renderPager:function(n){var i,r,u,f;this._isPaging&&n.action!="navPaging"&&(t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?this.olapCtrlObj.model.enablePaging&&(u={CategorialCurrentPage:1,CategorialPageSize:1,SeriesCurrentPage:1,SeriesPageSize:1},f={Column:1,Row:1},this.olapCtrlObj._pagerObj.initPagerProperties(f,u),this.olapCtrlObj._pagerObj.element.css("opacity","0.5"),this.olapCtrlObj._pagerObj.element.find(".pagerTextBox").attr("disabled","disabled"),this.olapCtrlObj._pagerObj._unwireEvents()):(i=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)==0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj._categCurrentPage)?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize):this.olapCtrlObj._categCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage),r=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)==0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj._seriesCurrentPage)?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize):this.olapCtrlObj._seriesCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage),i=i==0?1:i,r=r==0?1:r,this._colCount=this._colCount==0?1:this._colCount,this._rowCount=this._rowCount==0?1:this._rowCount,this.olapCtrlObj.model.enablePaging?(u={CategorialCurrentPage:i,CategorialPageSize:this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize,SeriesCurrentPage:r,SeriesPageSize:this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize},f={Column:this._colCount,Row:this._rowCount},this.olapCtrlObj._pagerObj.element.css("opacity","1"),this.olapCtrlObj._pagerObj.element.find(".pagerTextBox").removeAttr("disabled"),this.olapCtrlObj._pagerObj._unwireEvents(),this.olapCtrlObj._pagerObj._wireEvents(),this.olapCtrlObj._pagerObj.initPagerProperties(f,u)):this.olapCtrlObj.model.enableVirtualScrolling&&(this.olapCtrlObj._categPageCount=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize),this.olapCtrlObj._seriesPageCount=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)),this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage=this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage=0,this.olapCtrlObj._categCurrentPage=i,this.olapCtrlObj._seriesCurrentPage=r,t.isNullOrUndefined(this.olapCtrlObj._pivotGrid)||(this.olapCtrlObj._pivotGrid._categCurrentPage=i,this.olapCtrlObj._pivotGrid._seriesCurrentPage=r,this.olapCtrlObj._pivotGrid._categPageCount=this.olapCtrlObj._categPageCount,this.olapCtrlObj._pivotGrid._seriesPageCount=this.olapCtrlObj._seriesPageCount)))},_renderPivotGrid:function(n,i){this.olapCtrlObj._dataModel="XMLA";this.olapCtrlObj.setJSONRecords(JSON.stringify(i));this.olapCtrlObj.setOlapReport(this.olapCtrlObj.model.dataSource);this._renderPager(n);this.olapCtrlObj.model.enableGroupingBar&&this.olapCtrlObj._createGroupingBar(this.olapCtrlObj.model.dataSource);this.olapCtrlObj.model.layout!=null&&this.olapCtrlObj.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.olapCtrlObj.excelLikeLayout(i):this.olapCtrlObj.renderControlFromJSON(i);n.action&&(n.action=="initialLoad"||n.action=="navPaging")&&(this.olapCtrlObj._trigger("renderSuccess",this.olapCtrlObj),this.olapCtrlObj._fieldData={hierarchy:this.olapCtrlObj._fieldData.hierarchy,measures:this.olapCtrlObj._fieldData.measures})},_onDemandExpand:function(t,i){var et=i,f,it,r="",e=this.olapCtrlObj.XMLACellSet,b,k,d=n(this.olapCtrlObj.XMLACellSet).find("Axis[name='Axis0'] Tuple").length,c=n(this.olapCtrlObj.XMLACellSet).find("Axis[name='Axis1'] Tuple").length,y,rt=0,ut=0,h,u,nt,ft,tt;c=c?c:1;rt=n(i).find("CellData Cell").length;ut=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell").length;it=t.cellInfo.previousElements.split(">#>");var l=n(i).find("Axis[name|='Axis0'] Tuple"),a=n(i).find("Axis[name|='Axis1'] Tuple"),b=l.length;k=a.length;n(i).find("Axis[name='SlicerAxis']").remove();var g=t.cellInfo.itemPosition,v,p,o=0,s=!1,w="";for(p=t.cellInfo.axis=="rowheader"?a[0]:l[0],r=v=n(p).find("Member:nth-child("+(g+1)+") PARENT_UNIQUE_NAME").text(),h=g+1;h>0;h--)e=n(e).find("Tuple Member:nth-child("+h+") UName:contains('"+v+"')").parents("tuple"),v=n(p).find("Member:nth-child("+(h-1)+") UName").text(),w=v+w;if(r=w+r,y=e.index()+1,r=t.cellInfo.previousElements.split(">#>").join().replace(/,/g,""),f=t.cellInfo.preRepItm.split(">#>").join().replace(/,/g,""),this.olapCtrlObj._drilledCellSet&&(o=this.olapCtrlObj._drilledCellSet.length),r=r+" !#"+t.cellInfo.axis,this.olapCtrlObj._drilledCellSet[0]&&o)for(u=0;u<o;u++){for(nt=this.olapCtrlObj._drilledCellSet[u].length,ft=t.cellInfo.parentUniqueName,cEllen=0;cEllen<nt;cEllen++)if(t.cellInfo.previousElements.startsWith(this.olapCtrlObj._drilledCellSet[u][cEllen].key)){this.olapCtrlObj._drilledCellSet[u].push({key:r,repItms:f});s=!0;break}else if(this.olapCtrlObj._drilledCellSet[u][cEllen].key.startsWith(t.cellInfo.previousElements)){this.olapCtrlObj._drilledCellSet[u].splice(cEllen,0,{key:r,repItms:f});s=!0;break}if(s)break}else this.olapCtrlObj._drilledCellSet[0]=[],this.olapCtrlObj._drilledCellSet[0][0]={key:r,repItms:f},s=!0;s||(this.olapCtrlObj._drilledCellSet[o]=[],this.olapCtrlObj._drilledCellSet[o].push({key:r,repItms:f}));this._isPaging||(t.cellInfo.axis=="rowheader"?(tt=n(i).find("Axis[name|='Axis1'] Tuple"),this._insertCellSet("rowheader",e,a,l,k,d,b,y,i)):(tt=n(i).find("Axis[name|='Axis1'] Tuple"),this._insertCellSet("colheader",e,l,a,c,d,b,y,i)),this._generateJSONData("onDemandDrill",this.olapCtrlObj.XMLACellSet))},_insertCellSet:function(t,i,r,u,f,e,o,s,h){var g=n(n(h).find("CellData Cell")[0]).clone(),a,l,c,v,it;n(g).find("FmtValue").text("");i.length>1?n(i[0]).after(r):n(i).after(r);l=e;t=="rowheader"?a=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple"):(a=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple"),l=o);var y=0,nt=n(a).filter(function(t,i){if(u[y]&&n(i).find("UName").text()==n(u[y]).find("UName").text())return y++,!0}),p=0,w=!1;for(c=0;c<f;c++){var tt="",b=0,k=0,d;for(d=t=="rowheader"?(s+c)*l:c*(e+l)+s,v=0;v<l;v++)(t!="rowheader"||n(nt[b]).index()!=v)&&(t!="colheader"||n(nt[p]).index()!=c)&&a.length?n(this.olapCtrlObj.XMLACellSet).find("CellData Cell:nth-child("+(d+k)+")").after(n(g).clone()):(it=t=="rowheader"?c*o:p*o,tt=n(n(h).find("CellData Cell")[it+b]).clone(),n(this.olapCtrlObj.XMLACellSet).find("CellData Cell:nth-child("+(d+k)+")").after(tt),b++,w=!0),k++;t=="colheader"&&(w&&p++,w=!1)}this._setCellOrdinal(this.olapCtrlObj.XMLACellSet[1])},_clearDrilledCellSet:function(){for(var u=n.extend([],this.olapCtrlObj._drilledCellSet),t="",i,r=0;r<u.length;r++)t=u[r][0].key.split("!#"),t.length&&(i=this._getDrilledMemeber({item:{previousElements:t[0]}})),i.length&&this._onDemandCollapse({drilledMembers:i,action:""},t[1])},_onDemandCollapse:function(i,r){var u,f;f=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple");u=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple");try{this.olapCtrlObj.model.dataSource=t.olap._mdxParser._clearCollapsedItems(r,i.drilledMembers[i.drilledMembers.length-1],this.olapCtrlObj.model.dataSource);i.drilledMembers=i.drilledMembers.splice(0,i.drilledMembers.length-1)}catch(e){this.olapCtrlObj._ogridWaitingPopup.hide()}i.drilledMembers.length?this._onDemandCollapse({drilledMembers:i.drilledMembers,action:i.action},r):i.action=="collapse"&&(this.olapCtrlObj.model.dataSource._isCollapse=!0,delete this._currIndex.axis,this.getJSONData({action:"onDemandCollapse"},this.olapCtrlObj.model.dataSource,this.olapCtrlObj))},_removeCellSets:function(t,i,r,u,f,e){for(var c,s,v,p,o,l=t.length,h,y,w=f[0],a=0;a<i.length;a++)if(n(i[a]).find("UName").text()==n(w).find("UName").text()){y=i[a];break}if(c=l,s=n(y).index(),s)if(e=="rowheader"){for(h=r.length;c>0;)n(n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple")[s]).remove(),c--;for(o=ext=s;o<ext+l;o++)v=n(n(this.olapCtrlObj.XMLACellSet).find("CellData Cell")).splice(s*h,h),n(v).remove()}else{for(h=i.length,p=r.length;c>0;)n(n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple")[s]).remove(),c--;for(o=0;o<p;o++)v=n(n(this.olapCtrlObj.XMLACellSet).find("CellData Cell")).splice(h*o-o*l+s,l),n(v).remove()}this._setCellOrdinal(this.olapCtrlObj.XMLACellSet[1])},_getDrilledMemeber:function(t){var e=[],u,i,r,f;for(keyVal=t.item.previousElements.split(">#>").join().replace(/,/g,""),u=this.olapCtrlObj._drilledCellSet,e=n.map(this.olapCtrlObj._drilledCellSet,function(t){return e=n.map(t,function(n){if(n.key.startsWith(keyVal))return n})}),i=0;i<u.length;i++)for(r=0,f=u[i];u[i]&&r<u[i].length;r++)f[r]&&f[r].key.startsWith(keyVal)&&(f.splice(r,1),r--,f.length||(u.splice(i,1),i--));return e},_getHeaderCollection:function(t,r){var f,lt,c=[],tt,it="",w=[],k=null,rt={},p={},o=this,at,e,pt,ot,st,ht,ct,u,ft,h,dt,y,gt,nt;if(f=n(t).filter(function(t,i){var f=n(i).find("Member"),e=n(f[0]).find("LName").text().indexOf("[(All)]")!=-1,l=e?1:0,s=0,u,h;for(k=null,e?(tt=0,it="total"):(it="",tt=f.length),u=1,n(f[0]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1&&(u=0),u;u<f.length;u++)n(f[u]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1?(s=e,p.axis=r,p.posision=u,parseInt(n(f[u]).find("MEMBER_TYPE").text())==4&&(h=n(f[u]).find("UName").text().toLowerCase(),h.indexOf("trend]")!=-1?(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text(),"trend"))&&(k="trend",p.isKpiExist=!0)):h.indexOf("status]")!=-1?(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text(),"status"))&&(k="status",p.isKpiExist=!0)):h.indexOf("goal]")!=-1&&(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text()+"::"+n(f[u]).find("Caption").text(),"goal"))&&(k="goal",p.isKpiExist=!0)))):s=n(f[u]).find("LName").text().indexOf("[(All)]")!=-1,(e==!1&&s==!0||e==!0&&s==!1)&&(l++,tt=u,it="total"),e=s;return lt=t,l<2&&c.push({selIndx:lt,totLvl:tt,type:it,kpi:k,kpiInfo:rt}),l<2}).map(function(t,u){for(var s,a,l,e=n(u).find("Member"),h=[],f=0;f<e.length;f++)s=parseInt(n(e[f]).find("LNum").text()),r=="colheader"&&o._OlapDataSource.columns[f]?o._OlapDataSource.columns[f].hasAllMember&&(s+=1):r=="rowheader"&&o._OlapDataSource.rows[f]&&o._OlapDataSource.rows[f].hasAllMember&&(s+=1),a=n(e[f]).find("PARENT_UNIQUE_NAME").length?n(e[f]).find("PARENT_UNIQUE_NAME").text():"",h.push({CSS:r,Value:n(e[f]).find("Caption").text()==""?"(Blank)":n(e[f]).find("Caption").text(),ColSpan:1,RowSpan:1,HUName:n(e[f]).attr("Hierarchy"),LName:n(e[f]).find("LName").text(),UName:n(e[f]).find("UName").text(),ChildCount:parseInt(n(e[f]).find("CHILDREN_CARDINALITY").text()),PUName:a,LNum:s,MemberType:parseInt(n(e[f]).find("MEMBER_TYPE").text())}),n(e[f]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1&&c[t].kpi&&(h[h.length-1].kpiInfo=c[t].kpiInfo,h[h.length-1].kpi=c[t].kpi),w[f]==i?w[f]=s:w[f]<s&&(w[f]=s);return l=[],l[0]=h,l}),r=="colheader"?this._cTotIndexInfo=c:this._rTotIndexInfo=c,f={headers:f,indxInfo:c,maxLvlLen:w},n.isEmptyObject(p)||(this._measureDt=n.extend({},p)),at=1,r.indexOf(this._OlapDataSource.values[0].axis.substring(0,3))>-1&&(at=this._measureDt.measureCount=this._OlapDataSource.values[0].measures.length),!this._OlapDataSource._enableBasicEngine&&!this._isPaging){var v={headers:[],indxInfo:[]},ni=c,s=c.length,et=v.length,ut=[],vt=[];try{for(u=0;u<s;u++)u<s&&f.indxInfo[u].type=="total"&&(v.indxInfo.push(f.indxInfo.splice(u,1)[0]),v.headers.push(f.headers.splice(u,1)[0]),s--,u--);var b=f.headers.length>0?f.headers[0].length:0,yt=0,d=0;for(this._measureDt.posision==b-1&&this._measureDt.axis==r&&(d=1),s=f.headers.length,u=0;u<=s;u++){var h=null,ft=null,l=null,a=null;for(a=this._updateMemberVariables(f.headers,h,ft,l,u),h=a.prev,ft=a.next,l=a.cur,a=null,e=b-2-d;e>=0;e--)if(pt=this._comparePrevMembers(f.headers,s,u,e,b,-2),u==s||u>0&&(h&&h[e].UName!=l[e].UName||h[e].UName==l[e].UName&&pt))if(l&&h[e].UName==l[e].PUName)ot=this._removeSubtotalMembers(f,u,e),u-=ot,s-=ot,a=this._updateMemberVariables(f.headers,h,ft,l,u),h=a.prev,ft=a.next,l=a.cur,a=null;else{var wt=h,et=0,g,bt=0,kt=0;for(h&&(kt=h[e].LNum),l&&(bt=l[e].LNum),st=!1,ht=bt;ht<=kt;ht++){for(g=this._getSummaryHeaders(wt,v,e,st,d),et=g.headers.length;g.headers.length>0;)f.headers.splice(u,0,g.headers.pop()),f.indxInfo.splice(u,0,g.indexInfo.pop());st=!0;u+=et;s+=et;wt=f.headers[u-1]}}if(u==s&&v.headers.length>0){for(ct=0;v.headers.length>0;)f.headers.splice(u,0,v.headers.pop()),f.indxInfo.splice(u,0,v.indxInfo.pop()),s++,ct++;u+=ct}}var e=0,dt="";for(ut={headers:[],indxInfo:[]},e=b-1-d,s=f.headers.length,u=0;u<s;u++)if(h=this._findPreviousMember(f.headers,u-1,e),u>0&&f.headers[u-1][e].UName!=f.headers[u][e].UName&&e==b-1-d&&w[e]>1){if(u>0&&f.headers[u]!=i&&f.headers[u-1][e].LNum!=0&&f.headers[u-1][e].UName==f.headers[u][e].PUName)for(y=h;y<0;y++)f.indxInfo[u+y].lnum=f.headers[u+y][e].LNum,f.indxInfo[u+y].type="total",ut.indxInfo.push(f.indxInfo.splice(u+y,1)[0]),ut.headers.push(f.headers.splice(u+y,1)[0]),u+1==s?dt=f.headers[u][e].PUName:(u--,s--);(u!=0&&f.headers[u]!=i&&f.headers[u-1][e].LNum>f.headers[u][e].LNum||!1)&&(gt=[],nt=this._insertSummaryHeaders(f,ut,gt,u,e,b,yt,dt,!1,vt),s=nt.itmCnt,u=nt.hCnt,yt=nt.insCnt,vt[e]=nt.subPos)}}catch(ti){this.olapCtrlObj._waitingPopup.hide()}}return r=="rowheader"?this._rBIndx=c:this._cBIndx=c,f},_insertSummaryHeaders:function(t,r,u,f,e,o,s,h,c,l){var u=[],p,w,v,b="",s=0,y,a,k;for(t.headers[f-1]&&(h=t.headers[f-1][e].PUName),v=t.headers.length,p=t.headers[f][e].LNum,w=t.headers[f-1][e].LNum,y=this._comparePrevMembers(t.headers,v,f,e,o,s),lev=p;lev<w;lev++){for(n.grep(r.headers,function(n,r){(h==n[e].UName||t.headers[f+1+s]!=i&&t.headers[f][e].UName!=t.headers[f+1+s][e].UName&&t.headers[f][e].PUName==n[e].UName&&y)&&(b=n[e].PUName,u.push(r))}),h=b,y&&(u.reverse(),y=!1);u.length>0;){for(a=u.length-1,k=u[u.length-1],t.headers.splice(f,0,r.headers.splice(u[u.length-1],1)[0]),t.indxInfo.splice(f,0,r.indxInfo.splice(u[u.length-1],1)[0]);a>=0;)k<u[a]&&u[a]--,a--;u.pop();v++;s++;c&&l[e]++}s>0&&(f+=s,s=0)}return{itmCnt:v,hCnt:f,insCnt:s,subPos:l[e]}},_comparePrevMembers:function(n,t,i,r,u,f){var o=!1,e;if(r>0&&i<t&&i+1+f>=0&&i+1+f<t)for(e=r-1;e>=0;e--)n[i][e].UName!=n[i+1+f][e].UName&&(o=!0);return o},_updateMemberVariables:function(n,t,i,r,u){return n[u]&&(r=n[u]),i=n[u+1]?n[u+1]:null,t=n[u-1]?n[u-1]:null,{cur:r,prev:t,next:i}},_removeSubtotalMembers:function(n,t,i){for(var r=t-1,u=n.headers[r][i].UName;n.headers[r]&&n.headers[r][i].UName==u;)n.indxInfo.splice(r,1),n.headers.splice(r,1),r--;return t-(r+1)},_getSummaryHeaders:function(t,i,r,u){var o=i.headers,f=t,e=r,s=[],h=[],c=i.indxInfo,l;return l=n.grep(o,function(n,t){for(var r=!1,i=e;i>=0;i--)if(n[i].UName==f[i].UName||u&&i==e&&n[i].UName==f[i].PUName)i==0&&(r=!0,h.push(c[t]));else break;return r}),i.headers=n.grep(o,function(n,t){for(var r=!0,i=e;i>=0;i--)if(n[i].UName==f[i].UName||u&&i==e&&n[i].UName==f[i].PUName)i==0&&(r=!1);else break;return r&&s.push(c[t]),r}),i.indxInfo=s,{headers:l,indexInfo:h}},_drillOrderHeaderCollection:function(t,i,r){var o=t,s=i,e=r,u=0,f=this;return n(o).map(function(t,i){var o=n(s[i.selIndx]).find("Member"),h=[],r,l,a,c;for(h[u]=[],r=0;r<o.length;r++)l=parseInt(n(o[r]).find("LNum").text()),e=="colheader"&&f._OlapDataSource.columns[r]?f._OlapDataSource.columns[r].hasAllMember&&(l+=1):e=="rowheader"&&f._OlapDataSource.rows[r]&&f._OlapDataSource.rows[r].hasAllMember&&(l+=1),a=n(o[r]).find("PARENT_UNIQUE_NAME").length?n(o[r]).find("PARENT_UNIQUE_NAME").text():"",h[u].push({CSS:e,Value:n(o[r]).find("Caption").text(),ColSpan:1,RowSpan:1,HUName:n(o[r]).attr("Hierarchy"),LName:n(o[r]).find("LName").text(),UName:n(o[r]).find("UName").text(),ChildCount:parseInt(n(o[r]).find("CHILDREN_CARDINALITY").text()),PUName:a,LNum:l,MemberType:parseInt(n(o[r]).find("MEMBER_TYPE").text())}),c=h[u][h[u].length-1],i.kpiInfo&&c.UName.toLowerCase().indexOf("[measures]")>-1&&c.MemberType==4&&(h[u][h[u].length-1].kpiInfo=i.kpiInfo),i.kpi&&c.UName.toLowerCase().indexOf("[measures]")>-1&&c.MemberType==4&&(h[u][h[u].length-1].kpi=i.kpi);return h})},_loadKpi:function(n,t,i){i={action:"loadFieldElements"};var r=this._getConnectionInfo(n.data),u='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_KPIS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";this.olapCtrlObj.doAjaxPost("POST",r.url,{XMLA:u},this._loadKpiSuccess,null,i)},_loadKpiSuccess:function(n,t){this._kpi=t},_isKpi:function(t,i){var u=n(this._kpi).find("row:contains("+t.split("::")[0]+")"),r={};return u.length?(i=="trend"?(r.Graphic=n(u).find("KPI_TREND_GRAPHIC").text(),r.Value=n(u).find("KPI_NAME").text()):i=="status"?(r.Graphic=n(u).find("KPI_STATUS_GRAPHIC").text(),r.Value=n(u).find("KPI_NAME").text()):i=="goal"&&(r.Caption=t.split("::")[1],r.Value=n(u).find("KPI_NAME").text()),r):!1},_getValueCells:function(t,i){var s=this._columnHeaders.headers.length,c=this._rowHeaders.headers.length?this._rowHeaders.headers.length:1,e=0,u=0,f,l,r,o,h;if(this._valueCells[e]=[],this._fillAllValueCells(),t=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),this._OlapDataSource._enableBasicEngine||this._isPaging)for(r=0;r<t.length;r++)u<s&&(this._valueCells[e][u]={Value:n(t[r]).find("FmtValue")[0]?n(t[r]).find("FmtValue").text():"",FormatString:n(t[r]).find("FormatString")[0]?n(t[r]).find("FormatString").text():""},u++),u==s&&e+1<c&&(u=0,e++,this._valueCells[e]=[]);else for(f=0;f<c;f++)for(l=this._rBIndx.length?this._rBIndx[f].selIndx:0,r=0;r<s;r++)o=n(t[l*i+this._cBIndx[r].selIndx]),h="",(this._columnHeaders.indxInfo[r]&&this._columnHeaders.indxInfo[r].type=="total"||this._rowHeaders.indxInfo[f]&&this._rowHeaders.indxInfo[f].type=="total")&&(h="summary"),u<s&&(this._valueCells[f][r]={ActualValue:n(o).find("Value").text(),Value:n(o).find("FmtValue")[0]?this._getFormatedValue(n(o),n(o).find("FormatString")[0]):"",FormatString:n(o).find("FormatString")[0]?n(o).find("FormatString").text():"",kpi:this._cBIndx[r].kpi?this._cBIndx[r].kpi:this._rBIndx[f]?this._rBIndx[f].kpi:"",summary:h,Span:this._isNoSummary&&h=="summary"?"Block":"None"},u++),u==s&&e+1<c&&(u=0,e++,this._valueCells[e]=[]);return this._valueCells},_fillAllValueCells:function(t){var u,o,i,f,e,r;for(t=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),u=n(t[0]).clone(),n(u).find("FmtValue").text(""),o=t,i=0;i<t.length;i++)if(f=parseInt(n(t[i]).attr("CellOrdinal")),t[i+1]&&(e=parseInt(n(t[i+1]).attr("CellOrdinal"))),f+1<e)for(r=f+1;r<e;r++)n(t[i]).after(n(u).clone().attr("CellOrdinal",r)[0]);return t},_setCellOrdinal:function(t){for(var r=n(t).find("Cell"),i=0;i<r.length;i++)n(r[i]).attr("CellOrdinal",i)},_getFormatedValue:function(i,r){var r,u;if((this.olapCtrlObj.model.locale=="en-US"||!n.isNumeric(parseFloat(n(i).find("Value").text())))&&n(i).length>0)u=n(i).find("FmtValue").text();else{r=n(r).length>0?n(r).text().toLowerCase():t.isNullOrUndefined(r)?"":r.length>0?r:"";u=n(i).length>0?parseFloat(i.find("Value").text()):i;switch(r){case"decimal":u=parseFloat(t.widgetBase.formatting("{0:D2}",u,this.olapCtrlObj.model.locale));break;case"percent":u=t.widgetBase.formatting("{0:P0}",u,this.olapCtrlObj.model.locale);break;case"number":u=t.widgetBase.formatting("{0:N}",u,this.olapCtrlObj.model.locale);break;case"currency":u=t.widgetBase.formatting("{0:C2}",u,this.olapCtrlObj.model.locale);break;case"date":u=new Date((Number(u)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(u)&&(u=t.widgetBase.formatting("{0:MM/dd/yyyy}",u,this.olapCtrlObj.model.locale));break;case"scientific":u=Number(u).toExponential(2).replace("e","E");break;case"accounting":u=this._toAccounting(u,"{0:C2}",this.olapCtrlObj.model.locale);break;case"time":u=new Date((Number(u)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(u)&&(u=t.widgetBase.formatting("{0:h:mm:ss tt}",u,this.olapCtrlObj.model.locale));break;case"fraction":u=this._toFraction(u);u="numerator"in u?u.integer+" "+u.numerator+"/"+u.denominator:u.integer;break;default:u=n(i).find("FmtValue").text()}}return u},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_toAccounting:function(n,i,r){var h=t.preferredCulture(r).numberFormat,f,e,u=h.currency.symbol,o,s;return val=t.widgetBase.formatting(i,n,this.olapCtrlObj.model.locale),o=val.replace(u,""),s=val.indexOf(u),!s||n<0&&s===1?(f=u,e=Number(n)?o:"-"):(f=Number(n)?o:"-",e=u),f+" "+e},_toFraction:function(n){if(this._isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this._getPlaceValue(t,i),f=this._getGCD(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},_isNumber:function(n){return n-parseFloat(n)>=0},_getGCD:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this._getGCD(t,n%t)},_getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},_populateEngine:function(r,u,f){var y=r.length,p=u.length,w=y?r[0].length:y,h=p?u[0].length:p,b=[],g=f.length,nt=f[0].length,o,v,ft,d,a,e,c;try{this.pivotEngine=[];var tt=[],it=[],et=!1,k=[],l=!1,s=[];for(e=0;e<p;e++)for(this.pivotEngine[e+h]==i&&(this.pivotEngine[e+h]=[]),e==0&&(this.pivotEngine[0]=[],this.pivotEngine[0][0]={CSS:"none",Value:"",ColSpan:indexCCell?indexCCell:1,RowSpan:indexRCell?indexRCell:1,HUName:"",LName:"",UName:"",LNum:""}),o=0;o<h;o++)l=!1,this._OlapDataSource.columns&&this._OlapDataSource.columns[o]&&this._OlapDataSource.columns[o].isNamedSets&&(l=!0),this._pivotEngineSpanCalculation("colheader",u,r,this._columnHeaders.maxLvlLen,f,o,e,it,tt,this._cTotIndexInfo,l,k);for(s=this.pivotEngine.slice(),this.pivotEngine=[],e=0;e<s.length;e++)if(s[e])for(o=0;o<s[e].length;o++)s[e][o]&&(this.pivotEngine[o]==i&&(this.pivotEngine[o]=[]),this.pivotEngine[o][e]={CSS:s[e][o].CSS,ColSpan:s[e][o].RowSpan,HUName:s[e][o].HUName,LName:s[e][o].LName,LNum:s[e][o].LNum,RowSpan:s[e][o].ColSpan,UName:s[e][o].UName,PUName:s[e][o].PUName,Value:s[e][o].Value,ChildCount:s[e][o].ChildCount,MemberType:s[e][o].MemberType,Span:s[e][o].Span=="Block"?"Block":"None"},s[e][o].kpiInfo&&(this.pivotEngine[o][e].kpiInfo=s[e][o].kpiInfo,this.pivotEngine[o][e].kpi=s[e][o].kpi));var rt=[],ut=[],et=!1,k=[];for(e=0;e<y;e++)for(this.pivotEngine[e+indexCCell]==i&&(this.pivotEngine[e+indexCCell]=[]),o=0;o<w;o++)l=!1,this._OlapDataSource.rows&&this._OlapDataSource.rows[o]&&this._OlapDataSource.rows[o].isNamedSets&&(l=!0),this._pivotEngineSpanCalculation("rowheader",r,u,this._rowHeaders.maxLvlLen,f,o,e,ut,rt,this._rTotIndexInfo,l,k);for(b=n.extend(!0,[],this.pivotEngine),w=this._measureDt.axis=="rowheader"?indexRCell+1:indexRCell,h=indexCCell?indexCCell:h,e=0;e<g;e++)for(this.pivotEngine[e+h]!=i&&(w=this.pivotEngine[e+h].length),o=0;o<nt;o++)t.isNullOrUndefined(f[e][o])||(this.pivotEngine[e+h]==i&&(this.pivotEngine[e+h]=[]),v=this._setClassName(f[e][o]),f[e][o].CSS=v,v.indexOf("kpiiconvalue")>-1&&(!1||this.olapCtrlObj.pluginName=="ejPivotGrid")?f[e][o].Value="":v.indexOf("kpiiconvalue")>-1&&(f[e][o].Value=parseInt(f[e][o].Value)),this.pivotEngine[e+indexCCell][o+indexRCell]=f[e][o]);if(ft=n.grep(this.pivotEngine,function(n){return n}),this._isPaging){for(t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName)||this.olapCtrlObj._pagingSavedObjects.curDrilledItem.action!="collapse"?t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index)?t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName)||(n.each(this.olapCtrlObj._pagingSavedObjects.savedHdrEngine,function(i,r){n.each(r,function(n,r){if(!t.isNullOrUndefined(r)&&r.UName==t.olap.base.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName.split("::")[0].split("amp;").join(""))return t.olap.base.olapCtrlObj._pagingSavedObjects.drillEngine.push(t.olap.base.olapCtrlObj._pagingSavedObjects.savedHdrEngine[i][n]),!1})}),this.olapCtrlObj._pagingSavedObjects.drillEngine[this.olapCtrlObj._pagingSavedObjects.drillEngine.length-1].ChildCount=-1):(this.olapCtrlObj._pagingSavedObjects.drillEngine.push(this.olapCtrlObj._pagingSavedObjects.savedHdrEngine[parseInt(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index.split(",")[1])][parseInt(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index.split(",")[0])]),this.olapCtrlObj._pagingSavedObjects.drillEngine[this.olapCtrlObj._pagingSavedObjects.drillEngine.length-1].ChildCount=-1):n.each(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n,i){if(i.UName==t.olap.base.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName.split("::")[0].split("amp;").join(""))return t.olap.base.olapCtrlObj._pagingSavedObjects.drillEngine.splice(n,1),!1}),n.map(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(i){var r=n.map(t.olap.base.olapCtrlObj.model.dataSource.columns,function(n){return n.fieldName==i.HUName?!0:!1});i.CSS=r[0]?"colheader":"rowheader"}),this.olapCtrlObj._pagingSavedObjects.curDrilledItem={},e=this.pivotEngine[0][0].RowSpan-2;e>=0;e--){for(d="empty",o=1;o<this.pivotEngine[this.pivotEngine[0][0].RowSpan-1].length;o++)t.isNullOrUndefined(this.pivotEngine[e])&&(this.pivotEngine[e]=[]),t.isNullOrUndefined(this.pivotEngine[e+1])||!t.isNullOrUndefined(this.pivotEngine[e][o])||t.isNullOrUndefined(this.pivotEngine[e+1][o])||(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==t.olap.base.pivotEngine[e+1][o].PUName})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].ColSpan=t.isNullOrUndefined(this.pivotEngine[e][o-1])||this.pivotEngine[e][o-1].UName!=this.pivotEngine[e][o].UName?1:this.pivotEngine[e][o-1].ColSpan+1,this.pivotEngine[e][o].RowSpan=1,d=this.pivotEngine[e][o].UName));for(a=1,o=this.pivotEngine[this.pivotEngine[0][0].RowSpan-1].length-2;o>0;o--)t.isNullOrUndefined(this.pivotEngine[e])||t.isNullOrUndefined(this.pivotEngine[e][o])||t.isNullOrUndefined(this.pivotEngine[e][o+1])||this.pivotEngine[e][o+1].UName!=this.pivotEngine[e][o].UName?t.isNullOrUndefined(this.pivotEngine[e])||t.isNullOrUndefined(this.pivotEngine[e][o+1])||(this.pivotEngine[e][o+1].ColSpan=a==1?this.pivotEngine[e][o+1].ColSpan:a,a=1):(this.pivotEngine[e][o].ColSpan==this.pivotEngine[e][o+1].ColSpan,a++)}for(e=this.pivotEngine[0][0].RowSpan;e<this.pivotEngine.length;e++)for(c="empty",o=this.pivotEngine[0][0].ColSpan-1;o>=0;o--)t.isNullOrUndefined(this.pivotEngine[e][o])?t.isNullOrUndefined(this.pivotEngine[e-1][o])||this.pivotEngine[e-1][o].UName!=c?(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==c})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].RowSpan=1,this.pivotEngine[e][o].ColSpan=1,c=this.pivotEngine[e][o].PUName)):(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==c})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].RowSpan=this.pivotEngine[e-1][o].RowSpan+1,this.pivotEngine[e][o].ColSpan=1,c=this.pivotEngine[e][o].PUName)):c=this.pivotEngine[e][o].PUName;this.olapCtrlObj._pagingSavedObjects.savedHdrEngine=b}}catch(ot){this.olapCtrlObj._ogridWaitingPopup.hide()}},_pivotEngineSpanCalculation:function(t,r,u,f,e,o,s,h,c,l,a,v){var ct=r.length,ft="",kt=u.length,d=ct?r[0].length:ct,p=kt?u[0].length:kt,fi=e.length,ei=e[0].length,gt,g,it,y,dt,yt,rt,nt,ot,ti,lt,pt,wt,at,bt,ii,ri,ui,ht;t=="rowheader"?(p=indexCCell?indexCCell:p,ft="row"):(p=indexRCell?indexRCell:p,ft="col");gt=1;g=0;a&&(r[s][o].ChildCount=0);this._measureDt.axis==t&&this._measureDt.posision==d-1&&(g=1);h[o]||(h[o]=[]);this._isNoSummary&&!v[o]&&(v[o]=[]);this.pivotEngine[s+p]||(this.pivotEngine[s+p]=[]);c[o]=s;var ni=f[o]?f[o]:1,w=0,vt=0;for(it=0;it<o;it++)f[it]&&(w+=f[it]-1,vt+=f[it]);if(!this._OlapDataSource._enableBasicEngine||this._OlapDataSource._checkSummaryHeaders)for(y=1;y<=ni;y++){var k=null,et=!1,b=r[s][o].LNum;if(h[o][y]==i&&(h[o][y]=0),this._isNoSummary&&v[o][y]==i&&(v[o][y]=0),r[s-1]&&h[o][b]&&(r[s][o].LNum!=0&&r[s-1][o].PUName==r[s][o].UName||o+g==d-1&&r[s-1][o].LNum<r[s][o].LNum)&&(tempSpan=h[o][b],this._isNoSummary&&(tempSpan+=v[o][b],v[o][b]=0),this.pivotEngine[s+p-tempSpan][o+b-1+w]=r[s][o],o+g!=d-1&&(this.pivotEngine[s+p][o+b-1+w]=n.extend({},r[s][o]),this._isNoSummary&&(this.pivotEngine[s+p][o+b-1+w].Span="Block")),this._isNoSummary&&(this.pivotEngine[s+p-tempSpan][o+b-1+w].RowSpan=0),a||(this.pivotEngine[s+p-tempSpan][o+b-1+w].ChildCount=-1),this.pivotEngine[s+p-tempSpan][o+b-1+w].ColSpan=1,this.pivotEngine[s+p-tempSpan][o+b-1+w].RowSpan+=h[o][b],this._drilledJSONData(s+p-tempSpan,s+p,o+b-1+w,r[s][o]),h[o][b]=0,o+g==d-1&&r[s-1][o].LNum>r[s][o].LNum)){for(dt=f[o]-b,yt=this._findNextMember(r,s,o),rt=0;rt<yt;rt++)this.pivotEngine[s+p+rt]||(this.pivotEngine[s+p+rt]=[]),this.pivotEngine[s+p+rt][o+w+b]={CSS:"summary "+ft,Value:"Total",ColSpan:dt,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"};this._isNoSummary||(this.pivotEngine[s+p-tempSpan][o+b-1+w].RowSpan+=yt-1)}if(r[s][o].LNum>y&&!(this._isNoSummary&&l[s].type=="total")?h[o][y]++:r[s][o].LNum>y&&this._isNoSummary&&l[s].type=="total"&&v[o][y]++,k=s+p,y==r[s][o].LNum&&s==0&&r[s][o].LNum>1)this.pivotEngine[k]||(this.pivotEngine[k]=[]),this.pivotEngine[k][o+y-1+w]=r[s][o],(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+g==d-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&(this.pivotEngine[k][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[k][o+y-1+w].LNum);else if(s!=0&&r[s][o].LNum>1&&y==r[s][o].LNum&&r[s-1][o].UName!=r[s][o].UName&&r[s-1][o].PUName!=r[s][o].UName)this.pivotEngine[k]==i&&(this.pivotEngine[k]=[]),this.pivotEngine[k][o+y-1+w]=r[s][o],(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+g==d-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&(this.pivotEngine[k][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[k][o+y-1+w].LNum);else if(s!=0&&y==r[s][o].LNum&&r[s-1][o].UName==r[s][o].UName)this._isNoSummary&&l[s].type=="total"?this._isNoSummary&&l[s].type=="total"&&v[o][y]++:h[o][y]++,this.pivotEngine[s+p][o+y-1+w]=r[s][o],this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block"),(r[s+1]!=i&&r[s+1][o].UName!=r[s][o].UName||s+1==ct&&h[o][y]>0)&&(nt=h[o][y],ot=r[s][o].LNum,this._isNoSummary&&(nt+=v[o][y],v[o][y]=0),nt&&this.pivotEngine[s+p-nt][o+ot-1+w]!=i&&this.pivotEngine[s+p-nt][o+ot-1+w].Value!=i&&(this.pivotEngine[s+p-nt][o+ot-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-nt,s+p,o+ot-1+w,r[s][o])),h[o][y]=0);else if(r[s][o].LNum<2&&(y==r[s][o].LNum||r[s][o].LNum==0)||r[s][o].LNum<y&&r[s-1]&&r[s][o].LNum<r[s-1][o].LNum&&l[s].type=="total"&&this._measureDt.axis==t)if(ti=y-1,r[s-1]&&r[s-1][o].UName==r[s][o].UName&&r[s][o].LName.toLowerCase().indexOf("[measures]")>-1&&(this.pivotEngine[s+p][o+y-1+w]=n.extend({},r[s][o]),this._measureDt.measureCount>1&&t==this._measureDt.axis||this._isNoSummary&&l[s].type=="total"?this._measureDt.measureCount>1&&t==this._measureDt.axis||!this._isNoSummary||l[s].type!="total"||v[o][y]++:h[o][y]++,this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block")),r[s][o].UName.indexOf("Measures")!=-1&&this._isPaging||l[s].type=="total")if(l[s].type=="total"&&r[s][o].LName.toLowerCase().indexOf("[measures]")==-1&&r[s][o].LNum!=y&&f[o]!=0){if((r[s][o-1]&&r[s][o-1].LName.toLowerCase().indexOf("[measures]")==-1||this._measureDt.axis!=t)&&(o>l[s].totLvl||o==d-1&&y>l[s].totLvl&&l[s].totLvl!=0||l[s].totLvl==0&&y-1>l[s].totLvl))break;for(var tt=1,st=1,ut=0;r[s-st][o]&&r[s-st][o].LNum==0&&!r[s][o].LName.toLowerCase().indexOf("[measures]")>-1;)r[s][o-1]&&r[s-st+1][o-1].UName!=r[s-st][o-1].UName&&ut++,st++;if(0){for(lt=0,et=!1,ut=0,o<this._measureDt.posision?(pt=o,wt=this._measureDt.posision):o>this._measureDt.posision&&(wt=f.length,pt=o,et=!0),at=pt;at<wt;at++)lt+=f[at];r[s][o+1]&&r[s][o+1].LName.toLowerCase().indexOf("[measures]")>-1&&f[o]>1&&(et=!0,lt-=r[s][o].LNum);tt=lt}else r[s][o].LNum==0&&!r[s][o].LName.toLowerCase().indexOf("[measures]")>-1&&(ht=0,bt=0,s>0&&o>0&&r[s][o].LName.indexOf("(All)")>-1&&r[s][o-1]&&f[o-1]>1&&(ht=this._findPreviousMember(r,s,o-1)),s!=0&&r[s][o-1]&&f[o-1]>1&&r[s+ht]&&r[s][o-1].LNum<r[s+ht][o-1].LNum&&(ut=f[o-1]-r[s][o-1].LNum),t=="rowheader"?(tt=indexRCell-vt+ut,bt=indexRCell-tt):t=="colheader"&&(tt=indexCCell-vt+ut,bt=indexCCell-tt),(f.length!=1&&o==d-1||f.length>1&&o<d-1)&&(et=!0),this._measureDt.axis==t&&(tt-=1),ri=1,s!=0&&r[s][o-1]&&(ii=r[s][o-1].LNum+1),ui=1,ht=s+p,this.pivotEngine[s+p][o+y-1+w-ut]={CSS:"summary "+ft,Value:"Total",ColSpan:tt,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"})}else r[s][o].LName.toLowerCase().indexOf("[measures]")!=-1?(r[s-1]&&r[s-1][o].UName==r[s][o].UName||(this.pivotEngine[s+p][o+y-1+w]=n.extend({},r[s][o]),this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block")),(r[s-1]&&r[s-1][o].UName!=r[s][o].UName||s+1==ct)&&(rSCnt=h[o][y],this._isNoSummary&&(rSCnt+=v[o][y],v[o][y]=0),rSCnt&&this.pivotEngine[s+p-rSCnt][o+y-1+w]!=i&&(this.pivotEngine[s+p-rSCnt][o+y-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-rSCnt,s+p,o+y-1+w,r[s][o])),h[o][y]=0)):l[s].type=="total"&&r.length==1&&(this.pivotEngine[s+p][o+y-1+w]={CSS:"summary "+ft,Value:"Total",ColSpan:1,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"});else r[s-1]&&r[s-1][o].UName==r[s][o].UName||(this.pivotEngine[s+p][o+y-1+w]=r[s][o],rSCnt=h[o][y],this._isNoSummary&&(rSCnt+=v[o][y],v[o][y]=0),rSCnt&&this.pivotEngine[s+p-rSCnt][o+y-1+w]!=i&&(this.pivotEngine[s+p-rSCnt][o+y-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-rSCnt,s+p,o+y-1+w,r[s][o])),h[o][y]=0),!r[s][o].LNum==0&&(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+g==d-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&this.pivotEngine[s+p][o+y-1+w]&&(this.pivotEngine[s+p][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[s+p][o+y-1+w].LNum);if(et)break}else this.pivotEngine[s+p][o]=r[s][o]},_findNextMember:function(n,t,i){for(var r=0;n[t+r]&&n[t][i].UName==n[t+r][i].UName;)r++;return r},_findPreviousMember:function(n,t,i){for(var r=-1;n[t+r]&&n[t][i].UName==n[t+r][i].UName;)r--;return r},_drilledJSONData:function(t,i,r,u){for(var f=t+1;f<i;f++)this.pivotEngine[f][r]=n.extend({},u),this._isNoSummary&&(this.pivotEngine[f][r].Span="Block")},_setClassName:function(n){var i=parseInt(n.Value),t="value";if(n.kpi)if(n.kpi=="trend")switch(i){case-1:t="value kpiiconvalue kpidownarrow";break;case 0:t="value kpiiconvalue kpirightarrow";break;case 1:t="value kpiiconvalue kpiuparrow"}else if(n.kpi=="status")switch(i){case-1:t="value kpiiconvalue kpidiamond";break;case 0:t="value kpiiconvalue kpitriangle";break;case 1:t="value kpiiconvalue kpicircle"}return n.summary+" "+t},_getFieldItemsInfo:function(n){var t=this._getConnectionInfo(n.model.dataSource.data),i='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_HIERARCHIES<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+t.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";n.doAjaxPost("POST",t.url,{XMLA:i},this._getHierarchyInfo,null,{pvtGridObj:n,action:"loadFieldElements"})},_getHierarchyInfo:function(t,i){for(var u,s,o=[],r=t.pvtGridObj,f=this._getConnectionInfo(r.model.dataSource.data),e=0;e<n(i).find("row").length;e++)u=n(n(i).find("row")[e]),o.push({pid:u.find("DIMENSION_UNIQUE_NAME").text(),id:u.find("HIERARCHY_UNIQUE_NAME").text(),name:u.find("HIERARCHY_CAPTION").text(),tag:u.find("HIERARCHY_UNIQUE_NAME").text(),hasAllMember:u.children("ALL_MEMBER").length==0?!0:!1});r._fieldData={hierarchy:o,hierarchySuccess:i,measures:[]};f.LCID.indexOf("1033")>=0&&!r.model.enableDrillThrough||(s='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_MEASURES<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+r.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+r.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+r.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+f.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",r.doAjaxPost("POST",f.url,{XMLA:s},this._getMeasureInfo,null,{pvtGridObj:r,action:"loadFieldElements"}))},_getMeasureInfo:function(t,i){for(var f=[],r=0;r<n(i).find("row").length;r++){var u=n(n(i).find("row")[r]),o=u.children("MEASUREGROUP_NAME").text(),e=u.find("MEASURE_UNIQUE_NAME").text();f.push({id:e,pid:o,name:u.children("MEASURE_CAPTION").text(),tag:e})}t.pvtGridObj._fieldData.measures=f;t.pvtGridObj._fieldData.measureSuccess=i},_getConnectionInfo:function(t){var i={url:"",LCID:"1033"};return t!=""&&n.map(t.split(";"),function(n){n.toLowerCase().indexOf("locale")<0&&i.url.length==0?i.url=n:n.toLowerCase().indexOf("locale")>=0&&(i.LCID=n.replace(/ /g,"").split("=")[1])}),i},_applyTrim:function(r){var f=[],u=r.model.dataSource,e=this;r._fieldData&&r._fieldData.measures&&r._fieldData.hierarchy?(n.merge(f,r._fieldData.hierarchy),n.merge(f,r._fieldData.measures)):r._fieldData&&r._fieldData.hierarchy?r._fieldData.hierarchy:[];u.rows=n.map(u.rows,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.columns=n.map(u.columns,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.filters=n.map(u.filters,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.values=u.values.length>0&&u.values[0].measures!=i?u.values:[{measures:[],axis:"columns"}];u.values[0].measures=n.map(u.values[0].measures,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});r.model.dataSource=u},_getCaption:function(t,r){var f=t.fieldName,u=[];return r.length>0?(u=n.map(r,function(t){if(t.tag!=i&&t.tag.toLowerCase()==n.trim(f.toLowerCase()))return t}),f.toLowerCase().indexOf("[measures]")>=0&&u.length==0&&f.split(".[").length>0?t.fieldCaption=f.split(".[")[1].replace(/]/g,""):u.length>0&&(t.hasAllMember=u[0].hasAllMember?!0:!1,t.fieldCaption=u[0].name)):u.length==0&&(t.fieldCaption=f),t},clearDrilledItems:function(r,u,f){var e=u.action;return r.rows=n.grep(r.rows,function(n){return n.filterItems!=i&&e!="filtering"?delete n.filterItems:n,n.filterItems!=i&&e!="advancedFilter"?delete n.advancedFilter:n,n.drilledItems!=i?delete n.drilledItems:n,n}),r.columns=n.grep(r.columns,function(n){return n.filterItems!=i&&e!="filtering"?delete n.filterItems:n,n.filterItems!=i&&e!="advancedFilter"?delete n.advancedFilter:n,n.drilledItems!=i?delete n.drilledItems:n,n}),r.filters=n.grep(r.filters,function(n){return n.filterItems!=i&&e!="filtering"?delete n.filterItems:n,n.filterItems!=i&&e!="advancedFilter"?delete n.advancedFilter:n,n.drilledItems!=i?delete n.drilledItems:n,n}),e!="filtering"&&(f._currentReportItems=n.map(f._currentReportItems,function(n){if(!t.isNullOrUndefined(n.dataSrc))if(n.dataSrc.cube==r.cube){if(!(n.dataSrc.reportName==r.reportName))return n}else return n}),t.isNullOrUndefined(f._schemaData)||f._schemaData.element.find(".filter").remove()),t.olap.base._clearDrilledCellSet(),r}};t.olap._mdxParser={_getRowMDX:function(r){var f=n(r)[0].rows,o,u,c;if(rowQuery="",measureQuery="",updateQuery=[],isSorted=!1,isDrilled=!1,isCollapse=r._isCollapse,o=r.values.length>0&&r.values[0].measures!=i&&r.values[0].axis==t.olap.AxisName.Row,t.isNullOrUndefined(r.providerName)||r.providerName==t.olap.Providers.SSAS){if(f.length>0){for(isDrilled=t.isNullOrUndefined(f[0].drillCellInfo)?!1:!0,u=0;u<f.length;u++){var h=t.isNullOrUndefined(f[u].isNamedSets)||!f[u].isNamedSets?!1:!0,e="",s="";f[u].fieldName==i||h?h&&(rowQuery=u>0?rowQuery+"*{"+f[u].fieldName+"}":"{"+f[u].fieldName+"}"):(e=this._getDimensionQuery(f[u],r,"rows",u,!1),updateQuery.push(e.replace(/["'\(\)]/g,"").replace(/["'\{\}]/g,"").replace(/\levels0/g,"levels(0)")),t.olap.base._isPaging&&isDrilled&&(s=this._getDimensionQuery(f[u],r,"rows",u,!0)),f[u].sortOrder&&f[u].sortOrder!=t.olap.SortOrder.None?(c=f[u].sortOrder==t.olap.SortOrder.Ascending?"asc":"desc",isSorted=!0,rowQuery=rowQuery+(u>0?"*":"")+"{ORDER({HIERARCHIZE({"+(t.olap.base._isPaging&&isDrilled?s:e)+"})},"+f[u].fieldName+".CurrentMember.MEMBER_CAPTION,"+c+")}"):rowQuery=rowQuery+(u>0?"*":"")+"{HIERARCHIZE({({"+(t.olap.base._isPaging&&isDrilled?s:e)+"})})}")}t.olap.base._isPaging&&this._updateOlapReport(n(r)[0].rows,rowQuery,"rows",updateQuery);isCollapse&&(isSorted=isCollapse);rowQuery=(isSorted?" ":" HIERARCHIZE ")+"( {"+(t.olap.base._isPaging?rowQuery:this._updateOlapReport(n(r)[0].rows,rowQuery,"rows",updateQuery))+"})";isCollapse&&(rowQuery="HIERARCHIZE("+rowQuery+")")}o&&(measureQuery=t.olap._mdxParser._getMeasuresQuery(r),rowQuery=rowQuery!=""?(t.olap.base._isPaging?rowQuery.slice(0,-1):rowQuery)+(rowQuery!=""&&measureQuery!=""?t.olap.base._isPaging?"*":",":"")+measureQuery:(t.olap.base._isPaging?measureQuery!=""?"(":"":"")+measureQuery);t.olap.base._isPaging&&(rowQuery=rowQuery!=""?measureQuery==""?(rowQuery[rowQuery.length-1]!="}"?rowQuery.slice(0,-1):rowQuery)+this._getDrilledSection(r,n.extend(!0,{},f),"row",measureQuery)+")":rowQuery+this._getDrilledSection(r,n.extend(!0,{},f),"row",measureQuery)+")":"")}else rowQuery=this._generateAxisMDXOnMondrian(r,f,o);return rowQuery},_generateAxisMDXOnMondrian:function(n,i,r){for(var e,f="",u=0;u<i.length;u++)e="DrillDownLevel({"+i[u].fieldName+"})",!t.isNullOrUndefined(i[u].drilledItems)&&i[u].drilledItems.length>0&&(e=this._getDrilledMDXOnMondrian(i[u].drilledItems,e)),f+=(f==""?"":"*")+e;return r&&(f+=(f==""?"":"*")+t.olap._mdxParser._getMeasuresQuery(n)),f},_getDrilledMDXOnMondrian:function(n,t){for(var i=0;i<n.length;i++)t="DrillDownMember("+t+", {"+n[i].join()+"})";return t},_getcolumnMDX:function(r){var e=n(r)[0].columns,u="",o="",c=[],l=!1,s=!1,a=r._isCollapse,y=r.values.length>0&&r.values[0].measures!=i&&r.values[0].axis==t.olap.AxisName.Column,f,p;if(t.isNullOrUndefined(r.providerName)||r.providerName==t.olap.Providers.SSAS){if(e.length>0){for(s=t.isNullOrUndefined(e[0].drillCellInfo)?!1:!0,f=0;f<e.length;f++){var w=t.isNullOrUndefined(e[f].isNamedSets)||!e[f].isNamedSets?!0:!1,l=!1,h="",v="";e[f].fieldName!=i&&w?(h=this._getDimensionQuery(e[f],r,"columns",f,!1),c.push(h.replace(/["'\(\)]/g,"").replace(/["'\{\}]/g,"")),t.olap.base._isPaging&&s&&(v=this._getDimensionQuery(e[f],r,"columns",f,!0)),e[f].sortOrder&&e[f].sortOrder!=t.olap.SortOrder.None?(p=e[f].sortOrder==t.olap.SortOrder.Ascending?"asc":"desc",l=!0,u=u+(f>0?"*":"")+"{ ORDER ({HIERARCHIZE ({"+(t.olap.base._isPaging&&s?v:h)+"})},"+e[f].fieldName+".CurrentMember.MEMBER_CAPTION,"+p+")}"):u=u+(f>0?"*":"")+"{"+(t.olap.base._isPaging&&s?v:h)+"}"):u=f>0?u+"*{"+e[f].fieldName+"}":"{"+e[f].fieldName+"}"}t.olap.base._isPaging&&s&&this._updateOlapReport(n(r)[0].columns,u,"columns",c);a&&(l=a);u=(l?" ":" HIERARCHIZE ")+"( {"+(t.olap.base._isPaging?u:this._updateOlapReport(e,u,"columns",c))+"})";a&&(u="HIERARCHIZE("+u+")")}y&&(o=t.olap._mdxParser._getMeasuresQuery(r),u=u!=""?(t.olap.base._isPaging?u.slice(0,-1):u)+(u!=""&&o!=""?t.olap.base._isPaging?"*":",":"")+o:(t.olap.base._isPaging?o!=""?"(":"":"")+o);t.olap.base._isPaging&&(u=u!=""?o==""?(u[u.length-1]!="}"?u.slice(0,-1):u)+this._getDrilledSection(r,n.extend(!0,{},e),"column",o)+")":u+this._getDrilledSection(r,n.extend(!0,{},e),"column",o)+")":"")}else u=this._generateAxisMDXOnMondrian(r,e,y);return u},_getDrilledSection:function(i,r,u,f){var e="",r=r;return n.each(r,function(i,r){t.isNullOrUndefined(r.drilledItems)||n.each(r.drilledItems,function(t,r){var u="",o="";n.each(r,function(n,t){u=u==""?"{"+t+"}":u+"*{"+t+"}";t=n==i?t.replace(".children",""):t;o=o==""?"{"+t+"}":o+"*{"+t+"}"});f!=""&&(u=u+"*"+f,o=o+"*"+f);e=e==""?"+{"+u+"}-{"+o+"}":e+"+{"+u+"}-{"+o+"}"})}),e},_getSortedMembers:function(i){var r=i.fieldName,u;return i.sortOrder&&i.sortOrder!=t.olap.SortOrder.None?(u=i.sortOrder=="ascending"?"asc":"desc",n.map(i.drilledItems,function(t){return n.map(t,function(n){return n.indexOf(r)>=0&&(n="order ( "+n+" , "+r+".CurrentMember.MEMBER_CAPTION,"+u+")"),n})})):i.drilledItems},_updateOlapReport:function(r,u,f,e){var c=this,s,h,o;return f=="rows"?(s=n.map(r,function(n,t){if(r[t].drilledItems!=i)return c._getSortedMembers(n,r)}),t.olap.base._isRowDrilled&&"rows"==t.olap.base._currIndex.axis&&r[t.olap.base._currIndex.Index]!=i&&r[t.olap.base._currIndex.Index].drilledItems!=i?(o=n.map(e,function(n){return n.indexOf("DrillDownlevel")>=0&&(n=n.replace("DrillDownlevel","DrillDownlevel(")+")"),n}),r[t.olap.base._currIndex.Index].drilledItems.push(o),t.olap.base._isRowDrilled=!1):s.length>0&&(t.olap.base._currIndex.axis==i||t.olap.base._currIndex.axis=="columns"&&!t.olap.base._isRowDrilled)&&(u=this._getDrillQuery(s,u,r)),t.isNullOrUndefined(t.olap.base._currIndex.axis)||t.olap.base._currIndex.axis!="rows"||(t.olap.base._currIndex={})):(h=n.map(r,function(n,t){if(r[t].drilledItems!=i)return c._getSortedMembers(n,r)}),t.olap.base._isColDrilled&&"columns"==t.olap.base._currIndex.axis&&r[t.olap.base._currIndex.Index]!=i&&r[t.olap.base._currIndex.Index].drilledItems!=i?(o=n.map(e,function(n){return n.indexOf("DrillDownlevel")>=0&&(n=n.replace("DrillDownlevel","DrillDownlevel(")+")"),n}),r[t.olap.base._currIndex.Index].drilledItems.push(o),t.olap.base._isColDrilled=!1):h.length>0&&(t.olap.base._currIndex.axis==i||t.olap.base._currIndex.axis=="rows"&&!t.olap.base._isColDrilled)&&(u=this._getDrillQuery(h,u,r)),t.isNullOrUndefined(t.olap.base._currIndex.axis)||t.olap.base._currIndex.axis!="columns"||(t.olap.base._currIndex={})),u},_getDrillQuery:function(r,u,f){for(var h,o,c,s="",e=0;e<r.length;e++)if(r[e][r[e].length-1].toLowerCase().indexOf(".children")>=0||r[e][r[e].length-1].toLowerCase().indexOf("drilldownlevel")>=0||r[e][r[e].length-1].toLowerCase().indexOf("members")>=0||(r[e][r[e].length-1]=r[e][r[e].length-1]+".children"),r[e].length!=f.length){for(h=n.map(f,function(u){if(u.fieldName!=i&&u.fieldName!=r[e][[r[e].length-1]].split(".").splice(0,2).join("."))return{uniqueName:t.olap.base._isPaging?"("+n.trim(u.fieldName)+").children":"DrillDownLevel("+n.trim(u.fieldName)+")",fieldName:n.trim(u.fieldName)}}),o=0;o<h.length;o++)c=this._getItemPosition(f,h[o].fieldName)[0],r[e].toString().indexOf(h[o].fieldName)>=0||r[e].splice(c,0,h[o].uniqueName);s=s+""+(e>0?",":"")+"\n ("+r[e]+")"}else s=s+""+(e>0?",":"")+"\n ("+r[e].toString()+")\n";return"("+u+"),"+s},_createDrillThroughQuery:function(i,r){var o;if(r.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)r._waitingPopup.show(),r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.drillThroughDataTable,JSON.stringify({currentReport:n(r.element).parents(".e-pivotclient").length>0||n(r.element).length>0?r.currentReport:JSON.parse(r.getOlapReport()).Report,layout:r.model.layout,cellPos:"",selectorValue:i}),function(n){this._trigger("drillThrough",{element:n.element,data:n})}),r._waitingPopup.hide();else{var e=r.measureGrp,u="",f="DRILLTHROUGH Select("+r._colHeader.join()+","+r._rowHeader.join()+") on 0 from ["+r.model.dataSource.cube+"] RETURN";n.map(r._fieldData.measures,function(n){n.pid==e&&(u+=u==""?"["+e+"]."+n.id.split(".")[1]:",["+e+"]."+n.id.split(".")[1])});f+=i!=""&&!t.isNullOrUndefined(i)?" "+u+","+i:" "+u;f=f.replace(/&/g,"&");o=r._getConnectionInfo(r.model.dataSource.data);pData='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+f+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+r.model.dataSource.catalog+"<\/Catalog> <\/PropertyList> <\/Properties><\/Execute> <\/Body> <\/Envelope>";r.doAjaxPost("POST",o.url,{XMLA:pData},t.Pivot._generateDrillData,null,{pvtGridObj:r,action:"loadFieldElements"})}},_getDimensionQuery:function(r,u,f,e,o){var s="";return r.drillCellInfo==i||o?s=t.isNullOrUndefined(r.hasAllMember)||!r.hasAllMember?t.olap.base._isPaging?"(("+n.trim(r.fieldName)+").children)":"DrillDownlevel(("+n.trim(r.fieldName)+"))":"(("+n.trim(r.fieldName)+").levels(0).members)":(s="{("+r.drillCellInfo.uniqueName+")}",delete r.drillCellInfo),s},_updateReport:function(i,r,u,f){var c=f.model.dataSource.providerName==t.olap.Providers.Mondrian,s,e,h={},o;c?(s=r.preRepItm.split(">#>"),o=r.itemPosition,e=o?r.previousElements.split(s[o-1])[1].split("][").length:r.previousElements.split("][").length,u.drilledItems&&(u.drilledItems.length<=e-1&&(u.drilledItems[e-1]=[]),r.action&&r.action=="collapse"?u.drilledItems[e-1]=n.grep(u.drilledItems[e-1],function(n){return n!=s[o]}):u.drilledItems[e-1].push(s[o]))):(u.drillCellInfo=n.extend({},r),u.drillCellInfo.uniqueName="("+n.trim(u.drillCellInfo.uniqueName)+".children)",h={action:"drilldown",cellInfo:r});t.olap.base.getJSONData(h,f.model.dataSource,f)},_splitCellInfo:function(n){var r=t.olap.base.olapCtrlObj.model.dataSource.providerName==t.olap.Providers.Mondrian?1:2,i;return n&&(i={hierarchyUniqueName:n.split("::")[1].split(".").splice(0,r).join("."),uniqueName:n.split("::")[0],levelUniqueName:n.split("::")[1],leveName:n.split("::")[2],parentUniqueName:n.split("::")[3]}),i},updateDrilledReport:function(r,u,f){var g,o,p,s,c,tt;t.olap.base._isPaging&&!t.isNullOrUndefined(f._pagingSavedObjects.curDrilledItem)&&(f._pagingSavedObjects.curDrilledItem=r);var it=t.olap._mdxParser,l=null,e,w,b="",a="",k,v,nt=f.model.dataSource.providerName==t.olap.Providers.Mondrian;if(e=this._splitCellInfo(r.uniqueName),e.targetUName=r.uniqueName,e.previousElements="",w=u=="rowheader"?f.model.dataSource.rows:u=="colheader"?f.model.dataSource.columns:null,w.length>0){if(k=n.map(w,function(t,r){if(t.fieldName!=i&&n.trim(t.fieldName).toLowerCase()==n.trim(e.hierarchyUniqueName).toLowerCase())return{report:t,index:r}}),l=k[0].report,e.itemPosition=k[0].index,g=n.map(f._pivotRecords.records,function(n){if(n.Info.replace(/&/g,"&")==r.uniqueName)return n.Index}),l.drilledItems!=i?l.drilledItems:l.drilledItems=[],t.olap.base._currIndex={axis:u=="rowheader"?"rows":"columns",Index:k[0].index},f.pluginName=="ejPivotChart"||f.pluginName=="ejPivotTreeMap"||t.isNullOrUndefined(r.index)){for(e.cellIndex=g.length>0?"":r.index,e.axis=v=u,u!="rowheader"?t.olap.base._isColDrilled=r.action!=i&&r.action=="collapse"?!1:!0:t.olap.base._isRowDrilled=r.action!=i&&r.action=="collapse"?!1:!0,o=0;o<f.model.dataSource.rows.length;o++)if(r.seriesInfo[o]==r.uniqueName)break;else f.model.dataSource.rows[o].drillCellInfo=this._splitCellInfo(r.seriesInfo[o]);for(e.previousElements="",e.preRepItm="",o=0;o<r.uniqueNameArray.length;o++)e.previousElements+=this._splitCellInfo(r.uniqueNameArray[o]).uniqueName;for(o=0;o<r.seriesInfo.length;o++)e.preRepItm+=e.preRepItm==""?this._splitCellInfo(r.seriesInfo[o]).uniqueName:">#>"+this._splitCellInfo(r.seriesInfo[o]).uniqueName}else{e.cellIndex=r.index;var y=e.hierarchyUniqueName,v="",b="",h="",d=e.cellIndex.split(",")[0];if(rowPos=e.cellIndex.split(",")[1],u=="rowheader")for(v="rowheader",t.olap.base._isRowDrilled=r.action!=i&&r.action=="collapse"?!1:!0,o=parseInt(d);o>=0;o--)!f._pivotRecords.records[parseInt(o*f._pivotRecords.rowCount+parseInt(d))].Info.indexOf(y)>=0&&(h=f._pivotRecords.records[parseInt(o*f._pivotRecords.rowCount+parseInt(rowPos))].Info,p=this._splitCellInfo(h),p&&(b=p.uniqueName+b),h==""||h.indexOf(y)>=0||(s=this._splitCellInfo(h),s.uniqueName=s.uniqueName.replace(/&/g,"&"),a=s.uniqueName+">#>"+a,currReport=n.map(w,function(t,r){if(t.fieldName!=i&&n.trim(t.fieldName).toLowerCase()==n.trim(s.hierarchyUniqueName).toLowerCase())return r}),r.action!="collapse"&&(f.model.dataSource.rows[currReport[0]].drillCellInfo=s),y=s.hierarchyUniqueName));else for(v="colheader",t.olap.base._isColDrilled=r.action!=i&&r.action=="collapse"?!1:!0,o=parseInt(rowPos);o>=0;o--)!f._pivotRecords.records[parseInt(d*f._pivotRecords.rowCount+parseInt(o))].Info.indexOf(y)>=0&&(h=f._pivotRecords.records[parseInt(d*f._pivotRecords.rowCount+parseInt(o))].Info,p=this._splitCellInfo(h),p&&(b=p.uniqueName+">#>"+b),h==""||h.indexOf(y)>=0||(s=this._splitCellInfo(h),s.uniqueName=s.uniqueName.replace(/&/g,"&"),a=s.uniqueName+a,currReport=n.map(w,function(t,r){if(t.fieldName!=i&&n.trim(t.fieldName).toLowerCase()==n.trim(s.hierarchyUniqueName).toLowerCase())return r}),r.action!="collapse"&&(f.model.dataSource.columns[currReport[0]].drillCellInfo=s),y=s.hierarchyUniqueName));a+=e.uniqueName;e.previousElements=b.replace(/&/g,"&");e.preRepItm=a.replace(/&/g,"&");e.axis=v}if(e.previousElements=e.previousElements.replace(/&/g,"&"),e.preRepItm=e.preRepItm.replace(/&/g,"&"),r.action)if(r.action){if(nt){e.action="collapse";t.olap._mdxParser._updateReport(l.drilledItems,e,l,f);return}if(c=t.olap.base._getDrilledMemeber({item:e}),c.length&&!t.olap.base._isPaging)t.olap.base._onDemandCollapse({drilledMembers:c,action:r.action},v);else{while(c.length!=0)t.olap.base.olapCtrlObj.model.dataSource=t.olap._mdxParser._clearCollapsedItems(v,c[c.length-1],t.olap.base.olapCtrlObj.model.dataSource),c=c.splice(0,c.length-1);t.olap.base.getJSONData(r,t.olap.base.olapCtrlObj.model.dataSource,t.olap.base.olapCtrlObj)}}else tt=n(r.drilledMember).clone(!0),t.olap.base._onDemandExpand({action:"drilldown",cellInfo:e,isExist:!0},r.drilledMember);else c=t.olap.base._getDrilledMemeber({item:e}),t.olap._mdxParser._updateReport(l.drilledItems,e,l,f)}},_clearCollapsedItems:function(t,r,u){return t=="rowheader"?u.rows=n.map(u.rows,function(t){return t.drilledItems!=i&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(r.repItms.replace(/&/g,"&"))<0)return[n]})),t}):t=="colheader"&&(u.columns=n.map(u.columns,function(t){return t.drilledItems!=i&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(r.repItms.replace(/&/g,"&"))<0)return[n]})),t})),u},_getSlicerMDX:function(r,u){for(var c,o=n(r)[0].filters,f="",s=this,h=u._fieldData,l=r.providerName==t.olap.Providers.Mondrian,a=n.merge(n.merge([],r.columns),r.rows),e=0;e<o.length;e++)c=n.grep(a,function(n){var t=s._getDimensionUniqueName(n.fieldName,h),i=s._getDimensionUniqueName(o[e].fieldName,h);return t==i&&!(l&&i==""&&t=="")}).length>0,c||(o[e].fieldName!=i&&o[e].filterItems==i?f=f+(f!=""?"*":"")+"{"+this._getDimensionQuery(o[e])+"}":o[e].filterItems!=i&&(f=f+(f!=""?"*":"")+"{"+o[e].filterItems.values.toString()+"}"));return f!=""?"where ("+f.replace(/DrillDownlevel/g,"")+")":""},_getDimensionUniqueName:function(t,i){var u=i.hierarchy,r;return u?(r=n.map(u,function(n){if(n.id.toLowerCase()==t.toLowerCase())return n.pid}),r.length>0?r[0]:""):t.split(".")[0]},_getMeasuresQuery:function(t){var u=n(t)[0].values,f=[],e="",s="",r,o;return u.length>0&&(r=jQuery.map(u,function(n,t){if(n.measures!=i)return{measureElements:n.measures,Index:t,axisName:n.axis}}),o=r.length>0?n.map(r[0].measureElements,function(n){return n.fieldName}):null,o!=null?f.push({values:o,Index:r[0].Index}):f,s=u.axis),e=n.map(f,function(n){return n.values.toString()}),e[0]!=""?"{"+e+"}":""},_getIncludefilterQuery:function(t,r,u){var l="FROM ["+r+"]",e="FROM ( SELECT (",o,s,a=u._fieldData,h=[],y="COLUMNS",f;for(o=n.map(n(t.rows),function(n){if(n.filterItems!=i)return[n.filterItems.values]}),s=n.map(n(t.columns),function(n){if(n.filterItems!=i)return[n.filterItems.values]}),f=0;f<t.filters.length;f++){var c=t.filters,v=this,p=!1;n.map(t.columns,function(n){v._getDimensionUniqueName(n.fieldName,a)==v._getDimensionUniqueName(c[f].fieldName,a)&&c[f].filterItems!=i&&(s.push(c[f].filterItems.values),p=!0)});p||n.map(t.rows,function(n){v._getDimensionUniqueName(n.fieldName,a)==v._getDimensionUniqueName(c[f].fieldName,a)&&c[f].filterItems!=i&&o.push(c[f].filterItems.values)})}if(t.enableAdvancedFilter){for(f=0;f<=t.columns.length-1;f++)t.columns[f].advancedFilter&&n.merge(h,this._getAdvancedFilterQuery(t.columns[f],e,y));for(f=0;f<=t.rows.length-1;f++)t.rows[f].advancedFilter&&n.merge(h,this._getAdvancedFilterQuery(t.rows[f],e,y))}for(f=0;f<=s.length-1;f++)e=f==0?e+"{"+s[f].toString()+"}":e+",{"+s[f].toString()+"}";for(s.length>0&&(e=o.length>0?e+" ) on COLUMNS ,(":e+" ) on COLUMNS "),f=0;f<=o.length-1;f++)e=f>0?e+",{"+o[f].toString()+"}":e+"{"+o[f].toString()+"}";return e=s.length>0&&o.length>0?e=e+") on ROWS ":s.length==0&&o.length>0?e+") on COLUMNS ":e,h.length>0&&(h=(s.length>0||o.length>0?e:"")+" "+h.join(" ")+" "+l+Array(h.length+1+s.length+o.length).join(")")),l=s.length==0&&o.length==0?l:e+l+")",h.length>0?h:l},_getAdvancedFilterQuery:function(i,r,u){var f=[],e=this;return n.map(i.advancedFilter,function(r){t.isNullOrUndefined(r.labelFilterOperator)&&r.labelFilterOperator==t.olap.LabelFilterOptions.None&&t.isNullOrUndefined(r.valueFilterOperator)&&r.valueFilterOperator==t.olap.ValueFilterOptions.None||f.push("FROM (SELECT Filter("+n.trim(r.name)+".AllMembers, "+e._getAdvancedFilterCondtions(i.fieldName,r.advancedFilterType==t.olap.AdvancedFilterType.LabelFilter||t.isNullOrUndefined(r.advancedFilterType)?r.labelFilterOperator:r.valueFilterOperator,r.values,r.advancedFilterType,r.measure)+")) on "+u)}),f},_getAdvancedFilterCondtions:function(n,i,r,u,f){var e="",u=t.isNullOrUndefined(u)?"label":u;switch(i.toLowerCase()){case"equals":e="("+(u!="value"?n+'.CurrentMember.member_caption ="'+r[0]+'"':f+" = "+r[0]);break;case"notequals":e="("+(u!="value"?n+'.CurrentMember.member_caption <>"'+r[0]+'"':f+" <>"+r[0]);break;case"contains":e="( InStr (1,"+n+'.CurrentMember.member_caption,"'+r[0]+'")>0';break;case"notcontains":e="( InStr (1,"+n+'.CurrentMember.member_caption,"'+r[0]+'")=0';break;case"beginswith":e="( Left ("+n+".CurrentMember.member_caption,"+r[0].length+')="'+r[0]+'"';break;case"notbeginswith":e="( Left ("+n+".CurrentMember.member_caption,"+r[0].length+')<>"'+r[0]+'"';break;case"endswith":e="( Right ("+n+".CurrentMember.member_caption,"+r[0].length+')="'+r[0]+'"';break;case"notendswith":e="( Right ("+n+".CurrentMember.member_caption,"+r[0].length+')<>"'+r[0]+'"';break;case"greaterthan":e="("+(u!="value"?n+'.CurrentMember.member_caption >"'+r[0]+'"':f+" >"+r[0]+"");break;case"greaterthanorequalto":e="("+(u!="value"?n+'.CurrentMember.member_caption >="'+r[0]+'"':f+" >="+r[0]+"");break;case"lessthan":e="("+(u!="value"?n+'.CurrentMember.member_caption <"'+r[0]+'"':f+" <"+r[0]+"");break;case"lessthanorequalto":e="("+(u!="value"?n+'.CurrentMember.member_caption <="'+r[0]+'"':f+" <="+r[0]+"");break;case"between":e="("+(u!="value"?n+'.CurrentMember.member_caption >="'+r[0]+'"AND '+n+'.CurrentMember.member_caption <="'+r[1]+'"':f+" >="+r[0]+" AND "+f+"<="+r[1]);break;case"notbetween":e="("+(u!="value"?n+'.CurrentMember.member_caption >="'+r[0]+'"OR '+n+'.CurrentMember.member_caption <="'+r[1]+'"':f+" >="+r[0]+" OR "+f+"<="+r[1]);break;default:e="( InStr (1,"+n+'.CurrentMember.member_caption,"'+r[0]+'")>0'}return e},_getItemPosition:function(t,r){return n.map(t,function(t,u){if(t.fieldName!=i&&n.trim(t.fieldName)==n.trim(r))return u})},getAllMember:function(i,r,u){var f="select {"+r+"} dimension properties CHILDREN_CARDINALITY on 0 from ["+n.trim(i.cube)+"]",e=t.olap._mdxParser.getSoapMsg(f,i.data,i.catalog),o=t.olap.base._getConnectionInfo(i.data);u.doAjaxPost("POST",o.url,{XMLA:e},u._generateAllMember,null,{action:"loadFieldElements"})},getMembers:function(i,r,u){var f=t.Pivot.getReportItemByFieldName(r,i).item;t.isNullOrUndefined(u.model.pivotControl)||u.model.pivotControl.model.dataSource.providerName!=t.olap.Providers.Mondrian||(this._controlObj=u.model.pivotControl);var e="select {"+(f&&f.hasAllMember?r+".levels(0).members":r+".children")+"}dimension properties CHILDREN_CARDINALITY, MEMBER_TYPE on 0 from ["+n.trim(i.cube)+"]",o=t.olap._mdxParser.getSoapMsg(e,i.data,i.catalog),s=t.olap.base._getConnectionInfo(i.data);u.doAjaxPost("POST",s.url,{XMLA:o},u._generateMembers,null,{action:"fetchMembers"})},getChildren:function(n,i,r){var o="select {"+i+".children} dimension properties CHILDREN_CARDINALITY on 0 from ["+n.cube+"]",u=r.model.pivotControl,f,e;t.isNullOrUndefined(u)||u.model.dataSource.providerName!=t.olap.Providers.Mondrian||(this._controlObj=r.model.pivotControl);f=t.olap._mdxParser.getSoapMsg(o,n.data,n.catalog);e=t.olap.base._getConnectionInfo(n.data);r.doAjaxPost("POST",e.url,{XMLA:f},t.Pivot.generateChildMembers,null,{action:"nodeExpand",currentNode:i})},getSoapMsg:function(n,i,r){var e=t.olap.base._getConnectionInfo(i),f="",u;return t.isNullOrUndefined(this._controlObj)?u='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+n+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+r+"<\/Catalog> <LocaleIdentifier>"+e.LCID+"<\/LocaleIdentifier><\/PropertyList> <\/Properties> <\/Execute> <\/Body> <\/Envelope>":(f=this._controlObj.model.dataSource.sourceInfo,u='<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command><Statement><![CDATA['+n+"]\]><\/Statement><\/Command><Properties><PropertyList><DataSourceInfo>"+f+"<\/DataSourceInfo><Catalog>"+r+"<\/Catalog><AxisFormat>TupleFormat<\/AxisFormat><Content>Data<\/Content><Format>Multidimensional<\/Format><\/PropertyList><\/Properties><\/Execute><\/SOAP-ENV:Body><\/SOAP-ENV:Envelope>",delete this._controlObj),u}};t.olap.SortOrder={None:"none",Ascending:"ascending",Descending:"descending"};t.olap.Providers={SSAS:"ssas",Mondrian:"mondrian"};t.olap.AdvancedFilterType={LabelFilter:"label",ValueFilter:"value"};t.olap.ValueFilterOptions={None:"none",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.olap.LabelFilterOptions={None:"none",BeginsWith:"beginswith",NotBeginsWith:"notbeginswith",EndsWith:"endswith",NotEndsWith:"notendswith",Contains:"contains",NotContains:"notcontains",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.olap.AxisName={Row:"rows",Column:"columns"}}(jQuery,Syncfusion),function($,ej,undefined){ej.PivotAnalysis={_initProperties:function(){this._colKeysCalcValues=[];this._rowKeysCalcValues=[];this._tableKeysCalcValues=[];this._gridMatrix=null;this._rowTotCalc=[];this._colTotCalc=[];this._transposeEngine=[];this._tRowCnt=0;this._tColCnt=0;this._cellType="";this._valueFilterArray=ej.isNullOrUndefined(this._valueFilterArray)?[]:this._valueFilterArray;this._currentFilterVal={};this._fieldMembers={};this._summaryTypes=[];this._editCellsInfo=[];this._locale="en-US";this._valueSorting=ej.isNullOrUndefined(this._valueSorting)?null:this._valueSorting;this._sort=ej.isNullOrUndefined(this._sort)?null:this._sort},setFieldCaptions:function(n){$.each(n.rows,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)});$.each(n.columns,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)});$.each(n.filters,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)});$.each(n.values,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)})},getTreeViewData:function(n){var t=[],e=[],o,f,i,u,r,s;if(n.data!=null)for(i=0;i<n.data.length;i++)jQuery.each(n.data[i],function(n){jQuery.inArray(n,t)==-1&&t.push(n)});for(jQuery.each(n.values,function(n,i){i.isCalculatedField==!0&&jQuery.inArray(i.fieldName,t)==-1&&t.push(i.fieldName)}),o=[n.rows,n.columns,n.filters,n.values],f=[].concat.apply([],o),i=0;i<t.length;i++){for(u=0;u<f.length;u++)(t[i].caption==undefined||t[i].caption=="")&&f[u].fieldName==t[i]&&(t[i]={name:f[u].fieldName,caption:f[u].fieldCaption});(t[i].caption==undefined||t[i].caption=="")&&(t[i]={name:t[i].name||t[i],caption:t[i].name||t[i]})}for(r=0;r<t.length;r++)s=$.grep(n.rows,function(n){return n.fieldName==t[r].name}).length>0||$.grep(n.columns,function(n){return n.fieldName==t[r].name}).length>0||$.grep(n.values,function(n){return n.fieldName==t[r].name}).length>0||$.grep(n.filters,function(n){return n.fieldName==t[r].name}).length>0,e.push({id:t[r].name,name:t[r].name,caption:t[r].caption,isSelected:s,spriteCssClass:""});return e},pivotEnginePopulate:function(model){var dataSource=model.dataSource,currentObj=this,rowFilters,fields,vC,cnt,nC,outputString,rC,cC,isFiltered,temp,value,val,formula,oldValue,newValue,colkeyvalues,rowKeyValues,me,isColumnEmpty,j,i,k,rCnt,emptyCellColSpan,tcnt,cCnt;this._initProperties();model.dataSource.enableAdvancedFilter&&this._valueFilterArray.length==0&&(this._valueFilterArray=$.grep(dataSource.columns,function(n){if(n.advancedFilter&&n.advancedFilter.length>0&&n.advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter)return n.advancedFilter}),rowFilters=$.grep(dataSource.rows,function(n){if(n.advancedFilter&&n.advancedFilter.length>0&&n.advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter)return n.advancedFilter}),rowFilters.length>0&&$.merge(this._valueFilterArray,rowFilters));this._locale=model.locale;var colAxis=dataSource.columns,rowAxis=dataSource.rows,filters=dataSource.filters,calcValues=dataSource.values,colLen,jsonObj=[],pivotFieldList=[],rowLen;if(this._editCellsInfo=[],!ej.isNullOrUndefined(model.editCellsInfo)){var rowHeaders=model.editCellsInfo.rowHeader,colHeaders=model.editCellsInfo.columnHeader,values=model.editCellsInfo.JSONRecords;if(!ej.isNullOrUndefined(values)){for(uV=0;uV<values.length;uV++)fields={},rowAxis.length>0&&(fields.row=rowHeaders[uV].toString().split("#").splice(0,rowAxis.length).join(".")),colAxis.length>0&&(fields.column=colHeaders[uV].toString().split("#").splice(0,colAxis.length).join(".")),fields.value=colHeaders[uV].toString().split("#")[colHeaders[uV].toString().split("#").length-1]+"#"+values[uV].Value,this._editCellsInfo.push(fields);for(vC=0;vC<calcValues.length;vC++)$.each(this._editCellsInfo,function(n,t){calcValues[vC].fieldName==t.value.split("#")[0]&&(ej.PivotAnalysis._editCellsInfo[n].value=vC+"#"+t.value.split("#")[1])})}}for(i=0;i<calcValues.length;i++)this._summaryTypes.push(calcValues[i].summaryType!=null&&calcValues[i].summaryType!=undefined?calcValues[i].summaryType:ej.PivotAnalysis.SummaryType.Sum);if(dataSource.data!=null)for(cnt=0;cnt<dataSource.data.length;cnt++){list=jQuery.extend(!0,{},dataSource.data[cnt]);var table={keys:[],uniqueName:"",value:null},row={keys:[],uniqueName:"",value:null},col={keys:[],uniqueName:"",value:null},values={keys:[],uniqueName:"",value:null},isExcluded=!1;for(i=0;i<filters.length;i++)if(val=this._getReflectedValue(list,filters[i].fieldName,null,null),this._fieldMembers[filters[i].fieldName]==undefined||this._fieldMembers[filters[i].fieldName]==null?this._fieldMembers[filters[i].fieldName]=[val]:$.inArray(val,this._fieldMembers[filters[i].fieldName])==-1&&this._fieldMembers[filters[i].fieldName].push(val),filters[i].filterItems!=null&&filters[i].filterItems!=undefined&&((filters[i].filterItems.filterType==ej.PivotAnalysis.FilterType.Exclude||filters[i].filterItems.filterType==null)&&$.inArray(val!=null?val.toString():val,filters[i].filterItems.values)>=0||filters[i].filterItems.filterType==ej.PivotAnalysis.FilterType.Include&&$.inArray(val!=null?val.toString():val,filters[i].filterItems.values)<0)){isExcluded=!0;break}for(nC=0;nC<calcValues.length;nC++)val="",calcValues[nC]!=undefined&&calcValues[nC]!=null&&(list[calcValues[nC].fieldName]=model.dataSource.isFormattedValues?this._getNumber($(list).prop(calcValues[nC].fieldName),calcValues[nC].formatString):list[calcValues[nC].fieldName],val=this._getReflectedValue(list,calcValues[nC].fieldName,calcValues[nC].format,calcValues[nC].formatString),this._fieldMembers[calcValues[nC].fieldName]==undefined||this._fieldMembers[calcValues[nC].fieldName]==null?this._fieldMembers[calcValues[nC].fieldName]=[val]:$.inArray(val,this._fieldMembers[calcValues[nC].fieldName])==-1&&this._fieldMembers[calcValues[nC].fieldName].push(val)),outputString=val!=null?val.toString().replace(/([AMPME~!@#$%^&*()_+=`{}\[\]\|\\:;'<>,-.\/? ])+/g,""):"0",outputString=outputString.replace(ej.globalize.preferredCulture(this._locale).numberFormat.currency.symbol,""),$.isNumeric(outputString)||calcValues[nC].format=="date"?values.keys.push(val!=null?val:0):values.keys.push(1);for(rC=0;rC<rowAxis.length;rC++){if(val="",rowAxis[rC]!=undefined&&rowAxis[rC]!=null)if(val=this._getReflectedValue(list,rowAxis[rC].fieldName,null,null),this._fieldMembers[rowAxis[rC].fieldName]==undefined||this._fieldMembers[rowAxis[rC].fieldName]==null?this._fieldMembers[rowAxis[rC].fieldName]=[val]:$.inArray(val,this._fieldMembers[rowAxis[rC].fieldName])==-1&&this._fieldMembers[rowAxis[rC].fieldName].push(val),dataSource.enableAdvancedFilter&&!ej.isNullOrUndefined(rowAxis[rC].advancedFilter)&&rowAxis[rC].advancedFilter.length&&rowAxis[rC].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.LabelFilter){if(isFiltered=this._applyLabelFilter(rowAxis[rC].advancedFilter,val),isFiltered){isExcluded=!0;break}}else if(rowAxis[rC].filterItems!=null&&rowAxis[rC].filterItems!=undefined&&((rowAxis[rC].filterItems.filterType==ej.PivotAnalysis.FilterType.Exclude||rowAxis[rC].filterItems.filterType==null)&&$.inArray(val!=null?val.toString():val,rowAxis[rC].filterItems.values)>=0||rowAxis[rC].filterItems.filterType==ej.PivotAnalysis.FilterType.Include&&$.inArray(val!=null?val.toString():val,rowAxis[rC].filterItems.values)<0)){isExcluded=!0;break}val!=null&&val.toString().replace(/^\s+|\s+$/gm,"")||(val="(blank)");row.keys.push(val);row.uniqueName+=row.uniqueName==""?val:"."+val;table.keys.push(val);table.uniqueName+=table.uniqueName==""?val:"."+val}for(cC=0;cC<colAxis.length;cC++){if(val="",colAxis[cC]!=undefined&&colAxis[cC]!=null)if(val=this._getReflectedValue(list,colAxis[cC].fieldName,null,null),this._fieldMembers[colAxis[cC].fieldName]==undefined||this._fieldMembers[colAxis[cC].fieldName]==null?this._fieldMembers[colAxis[cC].fieldName]=[val]:$.inArray(val,this._fieldMembers[colAxis[cC].fieldName])==-1&&this._fieldMembers[colAxis[cC].fieldName].push(val),dataSource.enableAdvancedFilter&&!ej.isNullOrUndefined(colAxis[cC].advancedFilter)&&colAxis[cC].advancedFilter.length&&colAxis[cC].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.LabelFilter){if(isFiltered=this._applyLabelFilter(colAxis[cC].advancedFilter,val),isFiltered){isExcluded=!0;break}}else if(colAxis[cC].filterItems!=null&&colAxis[cC].filterItems!=undefined&&((colAxis[cC].filterItems.filterType==ej.PivotAnalysis.FilterType.Exclude||colAxis[cC].filterItems.filterType==null)&&$.inArray(val!=null?val.toString():val,colAxis[cC].filterItems.values)>=0||colAxis[cC].filterItems.filterType==ej.PivotAnalysis.FilterType.Include&&$.inArray(val!=null?val.toString():val,colAxis[cC].filterItems.values)<0)){isExcluded=!0;break}val!=null&&val.toString().replace(/^\s+|\s+$/gm,"")||(val="(blank)");col.keys.push(val);col.uniqueName+=col.uniqueName==""?val:"."+val;table.keys.push(val);table.uniqueName+=table.uniqueName==""?val:"."+val}isExcluded||(this._isMemberExist("row",row,$.extend(!0,{},values),dataSource),this._isMemberExist("column",col,$.extend(!0,{},values),dataSource),this._isMemberExist("calc",table,$.extend(!0,{},values),dataSource))}for(i=0;i<calcValues.length;i++)if(temp=$.grep(calcValues,function(n){return n.isCalculatedField==!0}),calcValues[i].isCalculatedField&&temp.length!=calcValues.length)for(j=0;j<this._tableKeysCalcValues.length;j++){for(formula=calcValues[i].formula.replace(/\s/g,""),k=0;k<calcValues.length;k++)calcValues[k].isCalculatedField!=!0&&(value=ej.globalize.parseFloat(this._tableKeysCalcValues[j].value.keys[k]==null?"0":calcValues[k].format=="date"?this._dateToInt(this._tableKeysCalcValues[j].value.keys[k].toString()).toString():calcValues[k].format=="time"?this._dateToInt(new Date("1900",this._tableKeysCalcValues[j].value.keys[k].toString().split(":")[0],this._tableKeysCalcValues[j].value.keys[k].toString().split(":")[1],this._tableKeysCalcValues[j].value.keys[k].toString().split(":")[2].split(" ")[0]).toString()).toString():this._tableKeysCalcValues[j].value.keys[k].toString(),this._locale),formula=formula.replace(new RegExp(calcValues[k].fieldName,"g"),calcValues[k].format=="percentage"&&value!=0?value<0?"("+value/100+")":value:value<0?"("+value+")":value));formula.indexOf("^")>-1&&(formula=this._powerFunction(formula));oldValue=!isNaN(eval(formula))&&isFinite(eval(formula))?this._getReflectedValue({calcField:eval(formula)},"calcField",calcValues[i].format,calcValues[i].formatString):dataSource.values[i].format==null?0:"0";newValue=dataSource.values[i].format==null?0:"0";this._tableKeysCalcValues[j].value.keys[i]=this._getSummaryValue(oldValue,newValue,1,this._summaryTypes[i],dataSource.values[i].format,dataSource.values[i].formatString)}else if(calcValues[i].isCalculatedField)for(val={keys:[],uniqueName:"",value:null},j=0;j<this._tableKeysCalcValues.length;j++){for(k=0;k<calcValues.length&&calcValues[k].isCalculatedField;k++)formula=calcValues[k].formula.replace(/\s/g,""),formula.indexOf("^")>-1&&(formula=this._powerFunction(formula)),oldValue=!isNaN(eval(formula))&&isFinite(eval(formula))?this._getReflectedValue({calcField:eval(formula)},"calcField",calcValues[k].format,calcValues[k].formatString):dataSource.values[k].format==null?0:"0",newValue=dataSource.values[k].format==null?0:"0",val.keys.push(this._getSummaryValue(oldValue,newValue,1,"sum",dataSource.values[k].format,dataSource.values[k].formatString));this._tableKeysCalcValues[j].value=val;val={keys:[],uniqueName:"",value:null}}if(rowAxis.length>0&&(this._rowKeysCalcValues=this._sortHeaders(this._rowKeysCalcValues,rowAxis,0)),colAxis.length>0&&(this._colKeysCalcValues=this._sortHeaders(this._colKeysCalcValues,colAxis,0)),colkeyvalues=$.extend([],this._colKeysCalcValues),rowKeyValues=$.extend([],this._rowKeysCalcValues),colAxis.length>0&&this._insertTotalHeader(colAxis,this._colKeysCalcValues),rowAxis.length>0)this._insertTotalHeader(rowAxis,this._rowKeysCalcValues);else if(calcValues.length>0)if(this._rowKeysCalcValues.length>0)this._rowKeysCalcValues[0].keys[0]="Grand Total";else{for(this._rowKeysCalcValues.push({keys:[""],value:{keys:[]}}),i=0;i<calcValues.length;i++)this._rowKeysCalcValues[0].value.keys.push();this._rowKeysCalcValues[0].keys[0]="Grand Total"}for(this._tRowCnt=0,this._tColCnt=0,this._currentFilterVal=this._valueFilterArray.length>0?this._valueFilterArray[0]:{},this._calculateValues(dataSource),i=0;i<this._valueFilterArray.length;i++)this._advancedFilterInfo.length>0&&(me=this,this._rowKeysCalcValues=this._filterKeyValues(rowKeyValues),this._colKeysCalcValues=this._filterKeyValues(colkeyvalues),this._gridMatrix=null,colkeyvalues=$.extend([],this._colKeysCalcValues),rowKeyValues=$.extend([],this._rowKeysCalcValues),colAxis.length>0&&this._insertTotalHeader(colAxis,this._colKeysCalcValues),rowAxis.length>0?this._insertTotalHeader(rowAxis,this._rowKeysCalcValues):calcValues.length>0&&(this._rowKeysCalcValues[0].keys[0]="Grand Total"),this._tRowCnt=0,this._tColCnt=0,this._currentFilterVal=this._valueFilterArray.length!=i+1?this._valueFilterArray[i+1]:{},this._calculateValues(dataSource));if(isColumnEmpty=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot",this._colTotCalc=[],this._rowTotCalc=[],this._colKeysCalcValues=[],this._rowKeysCalcValues=[],this._tableKeysCalcValues=[],this._transposeEngineCreation(),!ej.isNullOrUndefined(model.valueSortSettings)&&!ej.isNullOrUndefined(model.valueSortSettings.sortOrder)&&model.valueSortSettings.sortOrder!="none"&&model.dataSource.values.length>0&&(!ej.isNullOrUndefined(this._valueSorting)||!ej.isNullOrUndefined(model.valueSortSettings.headerText)))if(j=0,model.valueSortSettings.headerDelimiters=model.valueSortSettings.headerDelimiters==undefined?"##":model.valueSortSettings.headerDelimiters,ej.isNullOrUndefined(this._valueSorting)){for(i=0;i<this._transposeEngine.length;i++){for(k=0;k<model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters).length;k++)ej.isNullOrUndefined(this._transposeEngine[i][k])||this._transposeEngine[i][k].Value!=model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters)[k]||j++;if(j==model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters).length){this._valueSorting=i;break}j=0}this._sort=!ej.isNullOrUndefined(model.valueSortSettings)&&!ej.isNullOrUndefined(model.valueSortSettings.sortOrder)?model.valueSortSettings.sortOrder:this._sort;model.dataSource.columns.length+1!=model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters).length||ej.isNullOrUndefined(this._valueSorting)||this._applyValueSorting(model)}else this._applyValueSorting(model);for(rCnt=0;rCnt<this._tColCnt-1;rCnt++){if(rowAxis.length=rowAxis.length==0?1:rowAxis.length,rCnt<rowAxis.length)for(emptyCellColSpan=(isColumnEmpty?1:colAxis.length)+(dataSource.values.length>0?1:0),emptyCellColSpan==0&&rowAxis.length>0&&(emptyCellColSpan=1),tcnt=0;tcnt<emptyCellColSpan;tcnt++)this._gridMatrix.length>0&&jsonObj.push({Index:rCnt+","+tcnt,CSS:"none",Value:"",State:0,ColSpan:rCnt==0&&tcnt==0?rowAxis.length:1,RowSpan:rCnt==0&&tcnt==0?(isColumnEmpty?1:colAxis.length)+(dataSource.values.length>0?1:0):1,Info:"",Span:"None",Expander:0});for(cCnt=0;cCnt<this._tRowCnt-1;cCnt++)this._transposeEngine[rCnt]==undefined||this._transposeEngine[rCnt][cCnt]==undefined||cCnt<(isColumnEmpty?1:colAxis.length)+(dataSource.values.length>0?1:0)&&rCnt<rowAxis.length||jsonObj.push(this._transposeEngine[rCnt][cCnt])}return this._gridMatrix=[],dataSource.rows[0]==undefined&&(dataSource.rows.length=0),{json:jsonObj,pivotEngine:this._transposeEngine}},_applyValueSorting:function(n){for(var s,o,g,nt,a,p,tt,y,c,e,t,rt,f=[],u=[],r=0,v=0,d="",i=0;i<this._transposeEngine.length;i++)for(f[r]=[],ej.isNullOrUndefined(u[v])&&(u[v]=[]),t=0;t<this._transposeEngine[i].length&&this._valueSorting==Number(this._transposeEngine[i][t].Index.split(",")[0]);t++)(this._transposeEngine[i][t].CSS=="colheader"||this._transposeEngine[i][t].CSS.trim()=="calc"||this._transposeEngine[i][t].CSS=="colheader calc"||this._transposeEngine[i][t].CSS=="summary cstot"||this._transposeEngine[i][t].CSS=="summary cstot calc"||this._transposeEngine[i][t].CSS=="summary cgtot"||this._transposeEngine[i][t].CSS=="summary cgtot calc")&&(d=d==""?this._transposeEngine[i][t].Value:d+n.valueSortSettings.headerDelimiters+this._transposeEngine[i][t].Value),this._transposeEngine[n.dataSource.rows.length][t].CSS=="value"&&(f[r].push(this._transposeEngine[i][t]),v=0),this._transposeEngine[n.dataSource.rows.length][t].CSS=="summary value"&&(u[v].push(this._transposeEngine[i][t]),f[r].length>0&&(r=r+1,f[r]=[]),this._transposeEngine[0][t].CSS!="summary rgtot"&&u[v].length>0&&v++,ej.isNullOrUndefined(u[v])&&(u[v]=[]));for(n.valueSortSettings.headerText=d,n.valueSortSettings.sortOrder=this._sort,r=0;r<f.length;r++)for(i=0;i<f[r].length;i++)for(t=i;t<f[r].length;t++)g=this._sort=="descending"?this._getNumber(f[r][i].Value)<this._getNumber(f[r][t].Value):this._getNumber(f[r][i].Value)>this._getNumber(f[r][t].Value),g&&(nt=f[r][t],f[r][t]=f[r][i],f[r][i]=nt);for(r=0;r<f.length;r++)f[r].length==0&&f.splice(r,1);for(s=[],i=0;i<this._tRowCnt-1;i++)s[i]={index:0,level:-1};var l=0,h=[],b=[];for(r=u.length-2;r>=0;r--){for(o=0,t=0;t<u[r].length;t++)for(i=t;i<u[r].length;i++)g=this._sort=="descending"?this._getNumber(u[r][t].Value)<this._getNumber(u[r][i].Value):this._getNumber(u[r][t].Value)>this._getNumber(u[r][i].Value),g&&(nt=u[r][i],u[r][i]=u[r][t],u[r][t]=nt);if(l==0)for(t=0;t<u[r].length;t++)o=o==0?this._transposeEngine[l][Number(u[r][t].Index.split(",")[1])].MCnt+n.dataSource.columns.length+1:this._transposeEngine[l][Number(u[r][t].Index.split(",")[1])].MCnt+o+1,s[o]={index:Number(u[r][t].Index.split(",")[1]),level:l},h[t]==undefined&&(h[t]={}),h[t].end=Number(u[r][t].Index.split(",")[1]),h[t].start=Number(u[r][t].Index.split(",")[1])-this._transposeEngine[l][Number(u[r][t].Index.split(",")[1])].MCnt;else{for(a=[],p=0,c=0;c<h.length;c++){for(a=[],t=0;t<u[r].length;t++)Number(u[r][t].Index.split(",")[1])>h[c].start&&Number(u[r][t].Index.split(",")[1])<h[c].end&&a.push(u[r][t]);for(t=0;t<a.length;t++)o=o==0?this._transposeEngine[l][Number(a[t].Index.split(",")[1])].MCnt+n.dataSource.columns.length+1:this._transposeEngine[l][Number(a[t].Index.split(",")[1])].MCnt+o+1,s[o]={index:Number(a[t].Index.split(",")[1]),level:l},b[p]==undefined&&(b[p]={}),b[p].end=Number(a[t].Index.split(",")[1]),b[p].start=Number(a[t].Index.split(",")[1])-this._transposeEngine[l][Number(a[t].Index.split(",")[1])].MCnt,p++;while(o<this._tRowCnt-2&&s[o].level>s[o+1].level)o++;o--}h=jQuery.extend(!0,[],b)}l++}if(u.length==1&&u[0].length>0)for(tt=n.dataSource.columns.length+1,i=0;i<f[0].length;i++)s[tt]={index:Number(f[0][i].Index.split(",")[1])},tt++;for(y=n.dataSource.columns.length+1,c=0;c<h.length;c++)for(r=0;r<f.length;r++)if(Number(f[r][0].Index.split(",")[1])>=h[c].start&&Number(f[r][0].Index.split(",")[1])<=h[c].end){for(t=0,i=h[c].start;i<h[c].end;i++)s[y]={index:Number(f[r][t].Index.split(",")[1])},t++,y++;for(y++;s[y].index!=0&&y<=s.length;)y++}for(e=[],i=0;i<n.dataSource.columns.length+1;i++)s[i]={index:i};for(i=0;i<s.length-1;i++)e.push(this._gridMatrix[s[i].index]);for(e.push(this._gridMatrix[i]),i=0;i<this._gridMatrix.length&&this._gridMatrix[i]!=undefined&&e[i]!=undefined;i++)for(t=0;t<this._gridMatrix[i].length&&this._gridMatrix[i][t]!=undefined;t++)this._gridMatrix[i][t]!=undefined&&e[i][t]!=undefined&&(e[i][t].Index=this._gridMatrix[i][t].Index);for(t=0;t<n.dataSource.rows.length-1;t++){var w=n.dataSource.columns.length+1,k=0,r=0,it=!1;for(i=n.dataSource.columns.length+(n.dataSource.values.length>0?1:0);i<e.length;i++)if(e[i]!=undefined&&e[i][t]!=undefined&&e[i][t].CSS=="rowheader"&&e[i][t].RowSpan!=undefined&&(it=!0,k=k>e[i][t].RowSpan?k:e[i][t].RowSpan),e[i]!=undefined&&e[i][t]!=undefined&&e[i][t].CSS=="summary rstot"&&it&&!ej.isNullOrUndefined(e[w])){for(it=!1;e[w]==undefined||e[w][t]==undefined;)w++;e[w][t].RowSpan=k;k=0;rt=0;w=i+1;r++}}this._gridMatrix=e;this._transposeEngineCreation()},_transposeEngineCreation:function(){for(var t,n=0;n<this._tRowCnt-1;n++)for(t=0;t<this._tColCnt-1;t++)this._transposeEngine[t]==undefined&&(this._transposeEngine[t]=[]),this._gridMatrix[n]!=undefined&&this._gridMatrix[n][t]!=undefined?this._transposeEngine[t][n]={Index:t+","+n,CSS:this._gridMatrix[n][t].CSS,Value:typeof this._gridMatrix[n][t]=="string"||typeof this._gridMatrix[n][t]=="number"||typeof this._gridMatrix[n][t]=="object"?this._gridMatrix[n][t].Value==0?"":this._gridMatrix[n][t].Value==undefined?"":this._gridMatrix[n][t].Value:"",State:this._gridMatrix[n][t].State,RowSpan:this._gridMatrix[n][t].RowSpan!=undefined?this._gridMatrix[n][t].RowSpan:1,ColSpan:this._gridMatrix[n][t].ColSpan!=undefined?this._gridMatrix[n][t].ColSpan:1,Info:"",Span:"None",Expander:this._gridMatrix[n][t].Expander,MCnt:this._gridMatrix[n][t].MCnt!=undefined?this._gridMatrix[n][t].MCnt:1}:this._gridMatrix[n]!=undefined&&(this._transposeEngine[t][n]={Index:t+","+n,CSS:"none",Value:"",State:0,RowSpan:1,ColSpan:1,Info:"",Span:"None",Expander:0})},_filterKeyValues:function(n){var t=this;return $.grep(n,function(n){for(var i=!1,r=0;r<(!ej.isNullOrUndefined(n.uniqueName)&&n.uniqueName.split(".").length);r++)if(i=$.inArray(n.uniqueName.split(".")[r],t._advancedFilterInfo)>-1?!0:i,i=$.inArray(n.uniqueName,t._advancedFilterInfo)>-1?!0:i,i)break;if(!i)return n})},_getFilteredIndex:function(n,t,i,r){return $.map(t,function(t,u){if(n.length>0&&r[i].keys.length>0&&n[r[i].keys.length-1].advancedFilter&&n[r[i].keys.length-1].advancedFilter.length>0&&(n[r[i].keys.length-1].advancedFilter[0].measure==t.fieldName||n[r[i].keys.length-1].advancedFilter[0].name==t.fieldName))return u})[0]},_applyValueFilter:function(n,t){if(isFiltered=!1,n.length>0&&!ej.isNullOrUndefined(t)){var r=n[0].valueFilterOperator,i=n[0].values;switch(r.toLowerCase()){case"equals":isFiltered=!(t==JSON.parse(n[0].values[0]));break;case"notequals":isFiltered=!(t!=JSON.parse(n[0].values[0]));break;case"greaterthan":isFiltered=!(t>JSON.parse(n[0].values[0]));break;case"greaterthanorequalto":isFiltered=!(t>=JSON.parse(n[0].values[0]));break;case"lessthan":isFiltered=!(t<JSON.parse(n[0].values[0]));break;case"lessthanorequalto":isFiltered=!(t<=JSON.parse(n[0].values[0]));break;case"between":isFiltered=!(t>JSON.parse(i[0]))||!(t<JSON.parse(i[1]));break;case"notbetween":isFiltered=!(!(t>JSON.parse(i[0]))||!(t<JSON.parse(i[1])));break;default:isFiltered=!(t==JSON.parse(n[0].values[0]))}}return isFiltered},_applyLabelFilter:function(n,t){if(n.length>0){var u=n[0].labelFilterOperator,i=n[0].values,r=!1;t=ej.isNullOrUndefined(t)?"":t.toString();switch(u.toLowerCase()){case"equals":r=!(t.toLowerCase()==i[0].toLowerCase());break;case"notequals":r=t.toLowerCase()==i[0].toLowerCase();break;case"contains":r=!(t.toLowerCase().indexOf(i[0].toLowerCase())>-1);break;case"notcontains":r=t.toLowerCase().indexOf(i[0].toLowerCase())>-1;break;case"beginswith":r=!(t.toLowerCase().indexOf(i[0].toLowerCase())==0);break;case"notbeginswith":r=t.toLowerCase().indexOf(i[0].toLowerCase())==0;break;case"endswith":r=ej.isNullOrUndefined(t.toLowerCase().match(i[0].toLowerCase()+"$"));break;case"notendswith":r=!ej.isNullOrUndefined(t.toLowerCase().match(i[0].toLowerCase()+"$"));break;case"greaterthan":r=!(t.toLowerCase()>i[0].toLowerCase());break;case"greaterthanorequalto":r=!(t.toLowerCase()>=i[0].toLowerCase());break;case"lessthan":r=!(t.toLowerCase()<i[0].toLowerCase());break;case"lessthanorequalto":r=!(t.toLowerCase()<=i[0].toLowerCase());break;case"between":r=!(t.toLowerCase()>i[0].toLowerCase())&&!(t.toLowerCase()<i[1].toLowerCase());break;case"notbetween":r=!(!(t.toLowerCase()>i[0].toLowerCase())&&!(t.toLowerCase()<i[1].toLowerCase()));break;default:r=!(t.toLowerCase().indexOf(i[0].toLowerCase())>-1)}return r}},getMembers:function(n,t){var i,r,u;if(ej.isNullOrUndefined(t))return ej.isNullOrUndefined(this._fieldMembers)?[]:ej.isNullOrUndefined(this._fieldMembers[n])?[]:this._fieldMembers[n];for(i={},r=0;r<t.length;r++)u=t[r],$.each(u,function(n,t){ej.isNullOrUndefined(i[n])?i[n]=[t]:i[n].indexOf(t)<0&&i[n].push(t)});return i[n]},_powerFunction:function(n){if(n.indexOf("^")>-1){for(var t=[];n.indexOf("(")>-1;)n=n.replace(/(\([^\(\)]*\))/g,function(n,i){return t.push(i),"~"+(t.length-1)});for(t.push(n),n="~"+(t.length-1);n.indexOf("~")>-1;)n=n.replace(new RegExp("~(\\d+)","g"),function(n,i){return t[i].replace(/(\w*)\^(\w*)/g,"Math.pow($1,$2)")})}return n},_calculatedFieldSummaryValue:function(index,calValue,dataSource){var formula,i,value,oldValue,newValue;if(dataSource.values[index].isCalculatedField==!0){for(formula=dataSource.values[index].formula.replace(/\s/g,""),i=0;i<dataSource.values.length;i++)dataSource.values[i].isCalculatedField!=!0&&(value=ej.globalize.parseFloat(calValue[i]==null?"0":dataSource.values[i].format=="date"?this._dateToInt(calValue[i].toString()).toString():dataSource.values[i].format=="time"?this._dateToInt(new Date("1900",calValue[i].toString().split(":")[0],calValue[i].toString().split(":")[1],calValue[i].toString().split(":")[2].split(" ")[0]).toString()).toString():calValue[i].toString(),this._locale),formula=formula.replace(new RegExp(dataSource.values[i].fieldName,"g"),dataSource.values[i].format=="percentage"&&value!=0?value<0?"("+value/100+")":value:value<0?"("+value+")":value));return formula.indexOf("^")>-1&&(formula=this._powerFunction(formula)),oldValue=!isNaN(eval(formula))&&isFinite(eval(formula))?this._getReflectedValue({calcField:eval(formula)},"calcField",dataSource.values[index].format,dataSource.values[index].formatString):dataSource.values[index].format==null?0:"0",newValue=dataSource.values[index].format==null?0:"0",this._getSummaryValue(oldValue,newValue,1,this._summaryTypes[index]=="count"?"sum":this._summaryTypes[index],dataSource.values[index].format,dataSource.values[index].formatString)}},_sortHeaders:function(n,t,i){for(var r=[],e=[],f=0,o,u=t[i].sortOrder!=ej.PivotAnalysis.SortOrder.None?ej.DataManager(n).executeLocal(ej.Query().sortBy("keys."+i,t[i].sortOrder!=null&&t[i].sortOrder==ej.PivotAnalysis.SortOrder.Descending?ej.sortOrder.Descending:ej.sortOrder.Ascending,!1)):n;f<u.length;)o=u[f].keys[i],r=$.grep(u,function(n){return n.keys[i]==o}),r.length>1&&i+1<u[f].keys.length&&(r=this._sortHeaders(r,t,i+1)),e=e.concat(r),f+=r.length;return e},_isValidTime:function(n){var t=n.indexOf(":")>-1?n.split(":"):[];return t.length==3?(t[3]=t[2].indexOf(" ")>-1?t[2].split(" ")[1]:"AM",t[2]=t[2].indexOf(" ")>-1?t[2].split(" ")[0]:t[2],Number(t[0])>-1&&Number(t[0])<13&&Number(t[1])>-1&&Number(t[1])<61&&jQuery.isNumeric(t[2])&&(t[3]=="AM"||t[3]=="PM")?!0:!1):!1},_getNumber:function(n,t){return ej.isNullOrUndefined(n)||(jQuery.isNumeric(n.toString().replace(/[,.]/g,""))?(n=n.toString().replace(/[,]/g,ej.preferredCulture(this._locale).numberFormat[","]==","?"":"~").replace(/[.]/g,ej.preferredCulture(this._locale).numberFormat["."]=="."?".":""),n=Number(n.toString().replace(/[~]/g,"."))):n=this._isValidTime(n)?this._formatToInt(n,"time",t):ej.isNullOrUndefined(ej.parseDate(n,t==undefined?"MM/dd/yyyy":t))?n.indexOf("/")!=-1&&n.split("/")==2?this._formatToInt(n,"fraction",undefined):n.trim().indexOf("%")==n.trim().length-1?Number(n.replace(/[^\d.-]/g,""))/100:/[a-zA-Z]/.test(n)?1:Number(n.replace(/[^\d.-]/g,"")):this._formatToInt(n,"date",t)),n},_setFormat:function(n,t,i){switch(t){case"percentage":var r=jQuery.isNumeric(n)?1:100;n=typeof n=="string"?n.toString().split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",",".").replace(ej.preferredCulture(this._locale).numberFormat.percent.symbol,"").trim():n;n=jQuery.isNumeric(n)?n:0;n=ej.widgetBase.formatting("{0:P}",n==""?0:n/r,this._locale);break;case"decimal":case"number":n=typeof n=="string"?n.toString().split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",","."):n;n=jQuery.isNumeric(n)?n:0;n=ej.widgetBase.formatting("{0:N}",n,this._locale);break;case"currency":n=typeof n=="string"?n.toString().split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",",".").replace(ej.preferredCulture(this._locale).numberFormat.currency.symbol,"").trim():n;n=jQuery.isNumeric(n)?n:0;n=ej.widgetBase.formatting("{0:C2}",n==""?0:n,this._locale);break;case"date":jQuery.isNumeric(n)?(n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime()),this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:"+(i==undefined?"MM/dd/yyyy":i)+"}",n,this._locale))):new Date(n)!="Invalid Date"?n=ej.widgetBase.formatting("{0:"+(i==undefined?"MM/dd/yyyy":i)+"}",n,this._locale):(n=new Date((Number(0)-2)*864e5+new Date("01/01/1900").getTime()),n=ej.widgetBase.formatting("{0:"+(i==undefined?"MM/dd/yyyy":i)+"}",n,this._locale));break;case"scientific":n=typeof n=="string"?n.split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",","."):n;n=jQuery.isNumeric(n)?n:0;n=Number(n).toExponential(2).replace("e","E");break;case"accounting":n=this._toAccounting(n,"{0:C2}",this._locale);break;case"time":jQuery.isNumeric(n)?(n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime()),this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale))):this._isValidTime(n)?n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale):(n=new Date((Number(0)-2)*864e5+new Date("01/01/1900").getTime()),n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale));break;case"fraction":n=typeof n=="string"?n.split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",","."):n;n=jQuery.isNumeric(n)?this._toFraction(n):this._toFraction(0);n="numerator"in n?n.integer+" "+n.numerator+"/"+n.denominator:n.integer;break;default:n}return n},_getReflectedValue:function(n,t,i,r){var u=$(n).prop(t);return u==null?u:this._setFormat(u,i,r)},_formatToInt:function(value,format,formatString){var time;switch(format){case"date":value=ej.parseDate(value.toString(),formatString==undefined?"MM/dd/yyyy":formatString,this._locale)!=null?this._dateToInt(ej.parseDate(value,formatString==undefined?"MM/dd/yyyy":formatString,this._locale)):value;break;case"percentage":value=value!=0?ej.globalize.parseFloat(value.toString(),this._locale)/100:Number(value);break;case"currency":case"accounting":value=value!=0?ej.globalize.parseFloat(ej.globalize.format(value.toString(),"c",this._locale),this._locale):Number(value);break;case"decimal":case"number":value=value!=0?ej.globalize.parseFloat(value.toString(),this._locale):Number(value);break;case"scientific":value=value!=0||value==0?parseFloat(value):Number(value);break;case"time":this._isNumber(value)||(time=value.toString().split(":"),time=new Date("1900",time[0],time[1],time[2].split(" ")[0]).toString(),value=this._dateToInt(time));break;case"fraction":var temp1=parseFloat(value.toString().split(" ")[0]),temp2=eval(value.toString().split(" ")[1])!=undefined?parseFloat(eval(value.toString().split(" ")[1])):parseFloat(0),value=value!=0?temp1+temp2:Number(value)}return value},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_toAccounting:function(n,t,i){var s=ej.preferredCulture(i).numberFormat,f,e,u=s.currency.symbol,r,o;return val=ej.widgetBase.formatting(t,n),val=val.indexOf(" ")>-1?val.split(" ").join(""):val,r=val.replace(u,""),o=jQuery.isNumeric(r.toString().split(s[","]).join("").replace(",","."))?val.indexOf(u):0,r=jQuery.isNumeric(r.toString().split(",").join(""))?r:"0.00",!o||Number(r)<0&&o===1?(f=u,e=r):(f=r,e=u),f+" "+e},_toFraction:function(n){if(this._isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this._getPlaceValue(t,i),f=this._getGCD(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},_isNumber:function(n){return n-parseFloat(n)>=0},_getGCD:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this._getGCD(t,n%t)},_getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},_cellEdit:function(n,t,i,r){return $.each(this._editCellsInfo,function(u,f){if(n==(ej.isNullOrUndefined(f.row)&&ej.isNullOrUndefined(f.column)?"":ej.isNullOrUndefined(f.row)?f.column:ej.isNullOrUndefined(f.column)?f.row:f.row+"."+f.column)&&i==parseInt(f.value.split("#")[0]))return t=ej.PivotAnalysis._setFormat(ej.isNullOrUndefined(r.format)?jQuery.isNumeric(f.value.split("#")[1].toString().split(",").join(""))?parseFloat(f.value.split("#")[1].toString().split(",").join("")):0:f.value.split("#")[1],r.format,r.formatString),!1}),t},_isMemberExist:function(n,t,i,r){var h=this,f,s,e,u,o;switch(n){case"row":for(s=!1,this._rowKeysCalcValues.length==0&&this._rowKeysCalcValues.push(t),e=0;e<this._rowKeysCalcValues.length;e++)if(t.uniqueName==this._rowKeysCalcValues[e].uniqueName){s=!0;f=e;break}if(s)for(u=0;u<i.keys.length;u++)if(this._rowKeysCalcValues[f].value==null){this._rowKeysCalcValues[f].value=i;break}else this._rowKeysCalcValues[f].value.keys[u]+=i.keys[u];else this._rowKeysCalcValues.push(t);break;case"column":for(s=!1,this._colKeysCalcValues.length==0&&(r.columns.length>0||r.values.length>0)&&this._colKeysCalcValues.push(t),e=0;e<this._colKeysCalcValues.length;e++)if(t.uniqueName==this._colKeysCalcValues[e].uniqueName){s=!0;f=e;break}if(s)for(u=0;u<i.keys.length;u++)if(this._colKeysCalcValues[f].value==null){this._colKeysCalcValues[f].value=i;break}else this._colKeysCalcValues[f].value.keys[u]+=i.keys[u];else(r.columns.length>0||r.values.length>0)&&this._colKeysCalcValues.push(t);break;case"calc":for(s=!1,this._tableKeysCalcValues.length==0&&this._tableKeysCalcValues.push(t),e=0;e<this._tableKeysCalcValues.length;e++)if(t.uniqueName==this._tableKeysCalcValues[e].uniqueName){s=!0;f=e;break}if(s)for(u=0;u<i.keys.length;u++)if(this._tableKeysCalcValues[f].value==null){for(this._tableKeysCalcValues[f].value=i,this._tableKeysCalcValues[f].value.count=1,o=0;o<i.keys.length;o++)this._summaryTypes[o]==ej.PivotAnalysis.SummaryType.Count&&(this._tableKeysCalcValues[f].value.keys[o]=this._tableKeysCalcValues[f].value.count);break}else this._tableKeysCalcValues[f].value.count++,r.values[u].isCalculatedField!=!0&&(this._tableKeysCalcValues[f].value.keys[u]=this._getSummaryValue(this._tableKeysCalcValues[f].value.keys[u],i.keys[u],this._tableKeysCalcValues[f].value.count,this._summaryTypes[u],r.values[u].format,r.values[u].formatString));else for(this._tableKeysCalcValues.push(t),this._tableKeysCalcValues[this._tableKeysCalcValues.length-1].value=i,o=0;o<i.keys.length;o++)this._summaryTypes[o]==ej.PivotAnalysis.SummaryType.Count&&(this._tableKeysCalcValues[this._tableKeysCalcValues.length-1].value.keys[o]=1),this._tableKeysCalcValues[this._tableKeysCalcValues.length-1].value.count=1}},_getSummaryValue:function(n,t,i,r,u,f){n=this._formatToInt(n,u,f);t=this._formatToInt(t,u,f);switch(r){case ej.PivotAnalysis.SummaryType.Sum:n+=t;break;case ej.PivotAnalysis.SummaryType.Average:n=(n*(i-1)+t)/i;Math.floor(n)!=n&&(n=Number(n.toFixed(2)));break;case ej.PivotAnalysis.SummaryType.Min:n=i==1?t:Math.min(n,t);break;case ej.PivotAnalysis.SummaryType.Max:n=i==1?t:Math.max(n,t);break;case ej.PivotAnalysis.SummaryType.Count:n=i}switch(u){case"percentage":n=ej.widgetBase.formatting("{0:P}",n,this._locale);break;case"decimal":case"number":n=ej.widgetBase.formatting("{0:N}",n,this._locale);break;case"date":n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:"+(f==undefined?"MM/dd/yyyy":f)+"}",n,this._locale));break;case"currency":n=ej.widgetBase.formatting("{0:C2}",n,this._locale);break;case"scientific":n=n.toExponential(2).replace("e","E");break;case"accounting":n=this._toAccounting(n,"{0:C2}",this._locale);break;case"time":n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale));break;case"fraction":n=this._toFraction(n);n="numerator"in n?n.integer+" "+n.numerator+"/"+n.denominator:n.integer;break;default:n}return n},_dateToInt:function(n){var t=new Date("01/01/1900"),i=this._isDateTime(n)?n:new Date(n),r=i.getTime()-t.getTime();return r/864e5+2},_insertTotalHeader:function(n,t){var s,r,o,u,h,i;if(n.length<=1){t.push({cellType:"RGTot",keys:["Grand Total"],tot:"sub"});return}for(s=-1,r=n.length-2;r>=0;r--)if(s++,o=t.length,o>0){u=t[0].uniqueName.split(".");h=t[0].keys[s];u=u.slice(0,r+1).join(".");var e="",f=0,c="";for(i=1;i<=o;i++)t[i]!=undefined?(e=t[i].uniqueName.split("."),e=e.slice(0,r+1).join("."),c=t[i].keys[r+1]):e=undefined,e!=undefined&&e.indexOf("Total")==-1?u!=undefined&&e!=u&&(t.splice(i,0,{keys:[u.split(".")[r]+" Total"],cellType:"SubTot",uniqueName:u,level:r,mSpan:i-f}),t[f].span==undefined&&(t[f].span=[]),t[f].span[r]=i-f,i++,o++,u=e,f=i,h=c):u!=undefined&&(t.splice(i,0,{keys:[u.split(".")[r]+" Total"],cellType:"SubTot:",uniqueName:u,level:r,mSpan:i-f}),t[f].span==undefined&&(t[f].span=[]),t[f].span[r]=i-f,i++,o++,u=e,f=i,h=c)}t.push({cellType:"RGTot",keys:["Grand Total"]})},_isPreviousLevelEqual:function(n,t,i,r){for(var u=r-1;u>=0;u--)return n[t].keys[u]!=n[i].keys[u]?!0:!1},_calculateValues:function(n){var t=this._rowKeysCalcValues.length+(n.values.length>0?1:0),u=this._colKeysCalcValues.length==0?1:this._colKeysCalcValues.length*(n.values.length==0?1:n.values.length)+1,i,r;this._gridMatrix=new Array(t+n.rows.length+1);this._populateRowHeaders(n,t+n.rows.length+1,n.rows.length==0?1:n.rows.length);i=n.columns.length+1;r=u+(n.rows.length==0?1:n.rows.length);this._populateColumnHeaders(n,i,r);this._advancedFilterInfo=[];n.values.length>0&&this._populateCalcTable(n);this._tRowCnt=t+i;this._tColCnt=r},_populateRowHeaders:function(n,t,i){var u,c,r,h;if(this._rowKeysCalcValues.length!=0){for(u=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?1+(n.values.length>0?1:0):n.columns.length+(n.values.length>0?1:0),this._gridMatrix=[],c="",r=0;r<this._rowKeysCalcValues.length;r++){c=this._rowKeysCalcValues[r];var e=0,f=0,o=0,s=0;if(this._rowKeysCalcValues[r].keys!=undefined&&this._rowKeysCalcValues[r].keys.length!=0)for(this._gridMatrix[u]=new Array(i),s=this._rowKeysCalcValues[r].keys.length,kCnt=0;kCnt<s;kCnt++)this._rowKeysCalcValues[r].cellType!=undefined?this._rowKeysCalcValues[r].cellType.indexOf("SubTot")>-1?(f=this._rowKeysCalcValues[r].level+e,o=i-this._rowKeysCalcValues[r].level,this._cellType="summary rstot"):(this._cellType="summary rgtot",f=e,o=n.rows.length):(this._cellType="rowheader",f=e,o=1),h=s>1?s-kCnt>1?1:0:0,this._gridMatrix[u][f]={Index:f+","+u,CSS:this._cellType,Value:this._rowKeysCalcValues[r].keys[kCnt],State:h,RowSpan:this._rowKeysCalcValues[r].span!=undefined?this._rowKeysCalcValues[r].span[kCnt]:1,ColSpan:o,Info:"",Span:"None",Expander:h,MCnt:this._rowKeysCalcValues[r].mSpan!=undefined?this._rowKeysCalcValues[r].mSpan:0},e++;u++}this._cellType=""}},_populateColumnHeaders:function(n,t){var i,e,u;if(this._colKeysCalcValues.length!=0){var o=tempCnt=n.rows.length==0?1:n.rows.length,f=n.values.length==0?1:n.values.length,s="",r=colKLen=0,h=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?1:n.columns.length;for(i=0;i<this._colKeysCalcValues.length;i++){for(r=0,tempRIndx=0,tempRSpan=0,tempCSpan=0,s=this._colKeysCalcValues[i].keys,this._gridMatrix[r]==undefined&&(this._gridMatrix[r]=[]),colKLen=this._colKeysCalcValues[i].keys.length,kCnt=0;kCnt<colKLen;kCnt++){for(this._gridMatrix[r]==undefined&&(this._gridMatrix[r]=[]),this._colKeysCalcValues[i].cellType!=undefined?this._colKeysCalcValues[i].cellType.indexOf("SubTot")>-1?(tempRIndx=this._colKeysCalcValues[i].level+r,tempRSpan=t-this._colKeysCalcValues[i].level-1,this._cellType="summary cstot"):(tempRIndx=r,tempRSpan=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?1:n.columns.length,this._cellType="summary cgtot"):(tempRIndx=r,tempRSpan=1,this._cellType="colheader"),e=colKLen>1?colKLen-kCnt>1?1:0:0,u=0;u<f;u++)this._gridMatrix[tempRIndx][f*i+u+tempCnt]={Index:o+","+tempRIndx,CSS:this._cellType,Value:this._colKeysCalcValues[i].keys[kCnt],State:e,ColSpan:(this._colKeysCalcValues[i].span!=undefined?this._colKeysCalcValues[i].span[kCnt]==undefined?1:this._colKeysCalcValues[i].span[kCnt]:1)*f,RowSpan:tempRSpan,Info:"",Span:"None",Expander:e};r++}if(n.values.length>0)for(u=0;u<f;u++)this._gridMatrix[r]==undefined&&(this._gridMatrix[r]=[]),this._gridMatrix[h][f*i+u+tempCnt]={Index:f*i+u+tempCnt+","+r,CSS:this._cellType+" calc",Value:n.values[u].fieldName,State:0,ColSpan:1,RowSpan:1,Info:"",Span:"None",Expander:0};o++}this._cellType=""}},_populateCalcTable:function(n){var t=[],o=n.values.length,f=this,et,w,s,c,d,r,a,rt,g,ut,ft,i,e;this._rowTotCalc=[];this._rowTotCalc=[];var u=n.rows.length==0?1:n.rows.length,nt=0,b=!1,p=0,h=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?2:n.columns.length+1,tt=h,v,k=!1;for(i=0;i<this._rowKeysCalcValues.length;i++){for(this._colTotCalc=[],v=u,b=!0,this._gridMatrix[i+h]==undefined&&(this._gridMatrix[i+h]=[]),this._rowTotCalc[p]=[],cCnt=0;cCnt<this._colKeysCalcValues.length;cCnt++){if(t=[],this._cellType="value",n.columns.length>0&&n.rows.length>0?$.grep(f._tableKeysCalcValues,function(n){if(n.uniqueName==f._rowKeysCalcValues[i].uniqueName+"."+f._colKeysCalcValues[cCnt].uniqueName)for(r=0;r<n.value.keys.length;r++)t.push(n.value.keys[r]);return}):n.rows.length==0?$.grep(f._tableKeysCalcValues,function(n){if(n.uniqueName==f._colKeysCalcValues[cCnt].uniqueName)for(r=0;r<n.value.keys.length;r++)t.push(n.value.keys[r]);return}):$.grep(f._tableKeysCalcValues,function(n){if(n.uniqueName==f._rowKeysCalcValues[i].uniqueName)for(r=0;r<n.value.keys.length;r++)t.push(n.value.keys[r]);return}),this._editCellsInfo.length>0)for(e=0;e<n.values.length;e++)t[e]=ej.PivotAnalysis._cellEdit(n.columns.length>0&&n.rows.length>0?this._rowKeysCalcValues[i].uniqueName+"."+this._colKeysCalcValues[cCnt].uniqueName:n.rows.length==0?this._colKeysCalcValues[cCnt].uniqueName:this._rowKeysCalcValues[i].uniqueName,t[e],e,n.values[e]);if(this._colKeysCalcValues[cCnt].cellType!=undefined&&(this._colKeysCalcValues[cCnt].cellType.indexOf("SubTot")>-1||this._colKeysCalcValues[cCnt].cellType.indexOf("RGTot")>-1)){for(t=[],r=0;r<o;r++)for(a=0,s=0,c=v;c<=cCnt*o+u;c++)this._gridMatrix[i+h]!=undefined&&this._gridMatrix[i+h][v+a*o+r]!=undefined&&this._gridMatrix[i+h][v+a*o+r].Value!=undefined&&(t[r]==undefined&&(t[r]=0),s++,t[r]=n.values[r].isCalculatedField?this._calculatedFieldSummaryValue(r,t,n):this._getSummaryValue(t[r],this._gridMatrix[i+h][v+a*o+r].Value,s,this._summaryTypes[r]=="count"?"sum":this._summaryTypes[r],n.values[r].format,n.values[r].formatString)),a++;nt=0;v=(cCnt+1)*o+u;t!=0&&this._colTotCalc.push({uniqueName:this._colKeysCalcValues[cCnt].uniqueName,level:this._colKeysCalcValues[cCnt].level,value:t});this._colKeysCalcValues[cCnt-1]!=undefined&&this._colKeysCalcValues[cCnt-1].cellType!=undefined&&this._colKeysCalcValues[cCnt-1].cellType.indexOf("SubTot")>-1&&this._colKeysCalcValues[cCnt-1].cellType.indexOf("RGTot")==-1&&(w=$(this._colTotCalc).filter(function(n,t){return t!=undefined&&t.uniqueName!=undefined&&f._colKeysCalcValues[cCnt].uniqueName!=undefined&&t.level!=undefined&&f._colKeysCalcValues[cCnt].level!=undefined&&t.uniqueName.indexOf(f._colKeysCalcValues[cCnt].uniqueName)===0&&f._colKeysCalcValues[cCnt].level+1==t.level}).map(function(i,r){for(var u=0;u<r.value.length;u++)t[u]=ej.isNullOrUndefined(t[u])?0:t[u],r.value[u]=ej.isNullOrUndefined(r.value[u])?0:r.value[u],n.values[u].isCalculatedField?t[u]=ej.PivotAnalysis._calculatedFieldSummaryValue(u,t,n):t[u]+=r.value[u];return t}),t!=0&&this._colTotCalc.push({uniqueName:this._colKeysCalcValues[cCnt].uniqueName,level:this._colKeysCalcValues[cCnt].level,value:t}));this._cellType="summary value"}if(this._colKeysCalcValues[cCnt].cellType!=undefined&&this._colKeysCalcValues[cCnt].cellType.indexOf("RGTot")>-1&&t==0&&(t=[],s=0,w=$(this._colTotCalc).filter(function(n,t){return t!=undefined&&t!=undefined&&t.level!=undefined&&t.level==0}).map(function(i,r){for(var u=0;u<r.value.length;u++)t[u]=ej.isNullOrUndefined(t[u])?0:t[u],r.value[u]=ej.isNullOrUndefined(r.value[u])?0:r.value[u],s++,t[u]=n.values[u].isCalculatedField?ej.PivotAnalysis._calculatedFieldSummaryValue(u,t,n):ej.PivotAnalysis._getSummaryValue(t[u],r.value[u],s,f._summaryTypes[u]=="count"?"sum":f._summaryTypes[u],n.values[u].format,n.values[u].formatString);return t}),this._cellType="summary value"),this._rowKeysCalcValues[i].cellType!=undefined&&(this._rowKeysCalcValues[i].cellType.indexOf("SubTot")>-1||this._rowKeysCalcValues[i].cellType.indexOf("RGTot")>-1)){for(t=[],et=this._rowKeysCalcValues[i].uniqueName,this._rowKeysCalcValues[i-1]!=undefined&&this._rowKeysCalcValues[i-1].cellType!=undefined&&this._rowKeysCalcValues[i-1].cellType.indexOf("SubTot")>-1&&this._rowKeysCalcValues[i].cellType.indexOf("RGTot")==-1&&(s=0,w=$(this._rowTotCalc).filter(function(n,t){return t[0]!=undefined&&t[0].uniqueName!=undefined&&f._rowKeysCalcValues[i].uniqueName!=undefined&&t[0].level!=undefined&&f._rowKeysCalcValues[i].level!=undefined&&t[0].uniqueName.indexOf(f._rowKeysCalcValues[i].uniqueName)===0&&f._rowKeysCalcValues[i].level+1==t[0].level}).map(function(i,r){if(r[u+cCnt].length>0){s++;for(var e=0;e<r[u+cCnt].length;e++)t[e]=ej.isNullOrUndefined(t[e])?0:t[e],r[u+cCnt][e]=ej.isNullOrUndefined(r[u+cCnt][e])?0:r[u+cCnt][e],t[e]=n.values[e].isCalculatedField?ej.PivotAnalysis._calculatedFieldSummaryValue(e,t,n):ej.PivotAnalysis._getSummaryValue(t[e],r[u+cCnt][e],s,f._summaryTypes[e]=="count"?"sum":f._summaryTypes[e],n.values[e].format)}return t})),this._rowKeysCalcValues[i].cellType!=undefined&&this._rowKeysCalcValues[i].cellType.indexOf("RGTot")>-1&&(s=0,w=$(this._rowTotCalc).filter(function(n,t){return t!=undefined&&t[0]!=undefined&&t[0].level!=undefined&&t[0].level==0}).map(function(i,r){if(r[u+cCnt].length>0){s++;for(var e=0;e<r[u+cCnt].length;e++)t[e]=ej.isNullOrUndefined(t[e])?0:t[e],r[u+cCnt][e]=ej.isNullOrUndefined(r[u+cCnt][e])?0:r[u+cCnt][e],t[e]=n.values[e].isCalculatedField?ej.PivotAnalysis._calculatedFieldSummaryValue(e,t,n):ej.PivotAnalysis._getSummaryValue(t[e],r[u+cCnt][e],s,f._summaryTypes[e]=="count"?"sum":f._summaryTypes[e],n.values[e].format,n.values[e].formatString)}return t})),s=1,c=tt;c<=i+h;c++){for(d=!1,r=0;r<o;r++)a=0,this._gridMatrix[c]!=undefined&&this._gridMatrix[c][u+cCnt*o+r]!=undefined&&this._gridMatrix[c][u+cCnt*o+r].Value!=undefined&&(t[r]==undefined&&(t[r]=0),d=!0,t[r]=n.values[r].isCalculatedField?this._calculatedFieldSummaryValue(r,t,n):this._getSummaryValue(t[r],this._gridMatrix[c][u+cCnt*o+r].Value,s,this._summaryTypes[r]=="count"?"sum":this._summaryTypes[r],n.values[r].format,n.values[r].formatString)),a++;d&&s++}nt=0;k=!0;b&&(this._rowTotCalc[p][0]={uniqueName:this._rowKeysCalcValues[i].uniqueName,level:this._rowKeysCalcValues[i].level},b=!1);this._rowTotCalc[p][u+cCnt]=t;this._cellType="summary value"}if(n.enableAdvancedFilter){var y=0,it=this,l=this._currentFilterVal.fieldName?ej.Pivot.getReportItemByFieldName(this._currentFilterVal.fieldName,n):null;l!=null&&l.axis=="rows"&&(y=this._getFilteredIndex(n.rows,n.values,i,it._rowKeysCalcValues));ej.isNullOrUndefined(y)||l==null||l.axis=="rows"||(y=this._getFilteredIndex(n.columns,n.values,cCnt,it._colKeysCalcValues));ej.isNullOrUndefined(y)||(rt=this._rowKeysCalcValues[i].keys.length>0&&n.rows.length>0&&n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter&&n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter.length>0&&n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter?1:null,g=l&&l!=null&&rt!=null&&n.rows[this._rowKeysCalcValues[i].keys.length-1].fieldName==l.item.fieldName?this._applyValueFilter(n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter,t[y]):!1,this._colKeysCalcValues[cCnt].keys.indexOf("Grand Total")>=0&&g&&this._rowKeysCalcValues[i].uniqueName?this._advancedFilterInfo.push(this._rowKeysCalcValues[i].uniqueName):n.columns.length==0&&g&&this._rowKeysCalcValues[i].uniqueName&&this._advancedFilterInfo.push(this._rowKeysCalcValues[i].uniqueName),ut=this._colKeysCalcValues[cCnt].keys.length>0&&n.columns.length>0&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter.length>0&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter?1:null,ft=l!=null&&ut!=null&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].fieldName==l.item.fieldName?this._applyValueFilter(n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter,t[y]):!1,this._colKeysCalcValues[cCnt].uniqueName&&jQuery.type(this._rowKeysCalcValues[i].keys[0])==="string"&&this._rowKeysCalcValues[i].keys[0].indexOf("Grand Total")>-1&&ft&&this._advancedFilterInfo.push(this._colKeysCalcValues[cCnt].uniqueName))}for(e=0;e<o;e++)this._gridMatrix[h+i][o*cCnt+e+u]=t!=undefined&&t.length!=undefined?{Index:o*cCnt+e+u+","+h+i,CSS:this._cellType,Value:t[e],State:0,ColSpan:1,RowSpan:1,Info:"",Span:"None",Expander:0}:0}k&&(p++,tt=i+h+1,k=!1)}for(i=0;i<this._rowKeysCalcValues.length;i++)for(cCnt=0;cCnt<this._colKeysCalcValues.length;cCnt++)for(e=0;e<o;e++)n.values[e].isCalculatedField&&this._gridMatrix[h+i][o*cCnt+e+u].Value==null&&(this._gridMatrix[h+i][o*cCnt+e+u].Value=this._calculatedFieldSummaryValue(e,[],n));return this._gridMatrix}};ej.PivotAnalysis.SortOrder={Ascending:"ascending",Descending:"descending",None:"none"};ej.PivotAnalysis.FilterType={Exclude:"exclude",Include:"include"};ej.PivotAnalysis.SummaryType={Sum:"sum",Average:"average",Count:"count",Min:"min",Max:"max"}}(jQuery,Syncfusion);ej.Pivot=ej.Pivot||{},function(n,t,r){t.Pivot={addReportItem:function(n,i){if(i.isMeasuresDropped)i.droppedClass!=""?n.values[0].axis=i.droppedClass=="row"?"rows":i.droppedClass=="column"?"columns":n.values[0].axis:n.values[0].measures=[];else{var r=this.removeReportItem(n,i.droppedFieldName,i.isMeasuresDropped);t.isNullOrUndefined(r)&&(r={fieldName:i.droppedFieldName,fieldCaption:i.droppedFieldCaption});switch(i.droppedClass){case"row":i.droppedPosition.toString()!=""?n.rows.splice(i.droppedPosition,0,r):n.rows.push(r);break;case"column":i.droppedPosition.toString()!=""?n.columns.splice(i.droppedPosition,0,r):n.columns.push(r);break;case"value":n.cube==""?i.droppedPosition.toString()!=""?n.values.splice(i.droppedPosition,0,r):n.values.push(r):i.droppedPosition.toString()!=""?n.values[0].measures.splice(i.droppedPosition,0,r):n.values[0].measures.push(r);break;case"filter":i.droppedPosition.toString()!=""?n.filters.splice(i.droppedPosition,0,r):n.filters.push(r)}}},removeReportItem:function(i,r,u){var o=i.cube==""?t.Pivot.AnalysisMode.Pivot:t.Pivot.AnalysisMode.Olap,f=n.grep(i.columns,function(n){return n.fieldName==r}),e;return u?i.values[0].measures=[]:f.length>0?i.columns=n.grep(i.columns,function(n){return n.fieldName!=r}):(f=n.grep(i.rows,function(n){return n.fieldName==r}),f.length>0?i.rows=n.grep(i.rows,function(n){return n.fieldName!=r}):(e=o==t.Pivot.AnalysisMode.Olap?i.values[0].measures:i.values,f=n.grep(e,function(n){return n.fieldName==r}),f.length>0?i.values=o==t.Pivot.AnalysisMode.Olap?[{measures:n.grep(e,function(n){return n.fieldName!=r}),axis:i.values[0].axis}]:n.grep(e,function(n){return n.fieldName!=r}):(f=n.grep(i.filters,function(n){return n.fieldName==r}),f.length>0&&(i.filters=n.grep(i.filters,function(n){return n.fieldName!=r}))))),f[0]},getReportItemByFieldName:function(i,r){var f="columns",u=n.grep(r.columns,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),e;return u.length==0&&(u=n.grep(r.rows,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),f="rows"),u.length==0&&(e=r.cube==""?r.values:r.values.length>0&&!t.isNullOrUndefined(r.values[0].measures)?r.values[0].measures:[],u=n.grep(e,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),f="values"),u.length==0&&(u=n.grep(r.filters,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),f="filters"),{item:u[0],axis:f}},getReportItemByFieldCaption:function(i,r){var f="columns",u=n.grep(r.columns,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),e;return u.length==0&&(u=n.grep(r.rows,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),f="rows"),u.length==0&&(e=r.cube==""?r.values:r.values.length>0&&!t.isNullOrUndefined(r.values[0].measures)?r.values[0].measures:[],u=n.grep(e,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),f="values"),u.length==0&&(u=n.grep(r.filters,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),f="filters"),{item:u[0],axis:f}},closePreventPanel:function(n){var i=n.type!="close"?n:this;i.element.find("#preventDiv").remove();t.isNullOrUndefined(i.model.pivotControl)||i.model.pivotControl.element.find("#preventDiv").remove();t.isNullOrUndefined(i._waitingPopup)||i._waitingPopup.hide();t.isNullOrUndefined(i.model.pivotControl)||t.isNullOrUndefined(i.model.pivotControl._waitingPopup)||i.model.pivotControl._waitingPopup.hide()},openPreventPanel:function(i){var r=t.buildTag("div#preventDiv.errorDlg").css({width:n("body").width()+"px",height:n("body").height()+"px",position:"absolute",top:n("body").offset().top+"px",left:n("body").offset().left+"px","z-index":10})[0].outerHTML;n("#"+i._id).append(r)},_createErrorDialog:function(i,r,u){var e,o;if(t.Pivot.closePreventPanel(u),u._errorDialog=r,t.Pivot.openPreventPanel(u),u.element.find(".errorDialog:visible").length==0){e=t.isNullOrUndefined(i.Exception)?t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent action:",i)[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK",{margin:"20px 0 10px 165px"})[0].outerHTML)[0].outerHTML).attr("title",r)[0].outerHTML:t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent action:",i.Exception.Message)[0].outerHTML+t.buildTag("br")[0].outerHTML+t.buildTag("div."+u._id+"stackTraceContent","Stack Trace :"+i.Exception.StackTraceString)[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK",{margin:"20px 0 10px 165px"})[0].outerHTML)[0].outerHTML).attr("title",r)[0].outerHTML;u.element.append(e);u.element.find(".errorDialog").ejDialog({target:"#"+u._id,enableResize:!1,enableRTL:u.model.enableRTL,width:"400px",close:t.proxy(t.Pivot.closePreventPanel,u)});o=u.element.find(".errorDialog").data("ejDialog");n("#"+o._id+"_wrapper").css({left:"50%",top:"50%"});u.element.find(".errOKBtn").ejButton({type:t.ButtonType.Button,width:"50px"}).on(t.eventType.click,function(){u._errorDialog!="nodeCheck"||t.isNullOrUndefined(u._schemaData)||t.isNullOrUndefined(u._schemaData._selectedTreeNode)||u._schemaData._tableTreeObj.uncheckNode(u._schemaData._selectedTreeNode);u.element.find("#preventDiv").remove();(u._errorDialog=="Warning"||u._errorDialog=="Exception"||u._errorDialog=="Error")&&u.element.children("#ErrorDialog_wrapper").remove()});if(u.element.find(".e-dialog .e-close").attr("title","Close"),t.isNullOrUndefined(n("#"+u._id).data("ejWaitingPopup"))||n("#"+u._id).data("ejWaitingPopup").hide(),typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide(),!t.isNullOrUndefined(i.Exception)){var f=50,h="...",s="Show more",c="Show less";n("."+u._id+"stackTraceContent").each(function(){var i=n(this).html();if(i.length>f){u._id;var r=i.substr(0,f),e=i.substr(f,i.length-f),o=r+t.buildTag("span."+u._id+"moreellipses",h)[0].outerHTML+t.buildTag("span."+u._id+"morecontent",t.buildTag("span",e).css("display","none")[0].outerHTML+t.buildTag("a."+u._id+"morelink",s).css("display","block")[0].outerHTML)[0].outerHTML;n(this).html(o)}});n("."+u._id+"morelink").click(function(){return n(this).hasClass("less")?(n(this).removeClass("less"),n(this).html(s)):(n(this).addClass("less"),n(this).html(c)),n(this).parent().prev().toggle("slow",function(){}),n(this).prev().toggle("slow",function(){}),!1})}}},_contextMenuOpen:function(i,r){var f,e,u;if(t.Pivot.openPreventPanel(r),r._selectedMember=n(i.target),r.pluginName=="ejPivotGrid"?(f=r.model.analysisMode==t.Pivot.AnalysisMode.Olap?"olap":"pivot",u=n("#pivotTree").data("ejMenu")):(t.isNullOrUndefined(r.model.pivotControl)||(f=r.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"olap":"pivot"),u=n("#pivotTreeContextMenu").data("ejMenu")),f==t.Pivot.AnalysisMode.Olap){if(t.isNullOrUndefined(n(i.target).parent().attr("tag"))&&n(i.target).hasClass("pivotButton")&&n(i.target).children(".pvtBtn:eq(0)").length>0)return r._selectedMember=n(i.target).children(".pvtBtn:eq(0)"),!1;n(i.target).parent().attr("tag").split(":")[1].toLowerCase().startsWith("[measures]")?u.disable():r._selectedMember.parent().attr("tag").split(":")[1].toLowerCase()=="measures"?(u.disableItem(r._getLocalizedLabels("AddToValues")),u.disableItem(r._getLocalizedLabels("AddToFilter")),u.enableItem(r._getLocalizedLabels("AddToRow")),u.enableItem(r._getLocalizedLabels("AddToColumn"))):(u.disableItem(r._getLocalizedLabels("AddToValues")),n(i.target.parentElement).find(".namedSetCDB").length>0?u.disableItem(r._getLocalizedLabels("AddToFilter")):u.enableItem(r._getLocalizedLabels("AddToFilter")),u.enableItem(r._getLocalizedLabels("AddToRow")),u.enableItem(r._getLocalizedLabels("AddToColumn")))}else f==t.Pivot.AnalysisMode.Pivot&&(e=i.target.textContent,n(i.target).hasClass("e-btn")?(u.enable(),r.pluginName=="ejPivotGrid"&&(u.disableItem(r._getLocalizedLabels("CalculatedField")),n(i.target).parents(".pivotButton").attr("tag").split(":")[0].toLowerCase()=="values"&&(r.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&n.grep(r.model.dataSource.values,function(n){return n.fieldCaption==e&&n.isCalculatedField==!0}).length>0?u.disable():r.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n.grep(JSON.parse(r.getOlapReport()).PivotCalculations,function(n){return n.FieldHeader==e&&n.CalculationType==8}).length>0&&u.disable(),u.enableItem(r._getLocalizedLabels("CalculatedField"))))):(u=n("#pivotTree").data("ejMenu"),u.disable()))},_searchTreeNodes:function(i){var a=n(i.target).hasClass("searchTreeView")?this.element.find(".searchTreeView").data("ejMaskEdit"):this.element.find(".searchEditorTreeView").data("ejMaskEdit"),u=n(i.target).hasClass("searchTreeView")?this.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.find(".schemaFieldTree").data("ejTreeView"):this.element.find(".cubeTreeView").data("ejTreeView"):this.element.find(".editorTreeView").data("ejTreeView"),s=u.element,v=t.isNullOrUndefined(a.get_StrippedValue())?"":a.get_StrippedValue().toLowerCase(),f,e,c,o,l,r;if(v.length>0){var y=[],p=[],h=s.find("ul>li>div>a");for(f=0;f<h.length;f++)n(h[f]).text().toLowerCase().indexOf(v)!=-1?y.push(h[f]):p.push(h[f]);for(e=s.find(y).closest("li").css("display","block"),s.find(p).closest("li").css("display","none"),r=0;r<e.length;r++)c=n(e[r]),o=c.parents("ul").closest("li").css("display","block"),o.length>0&&(u.expandNode(o),u.model.expandedNodes.indexOf(n(u._liList).index(o))!=-1||t.isNullOrUndefined(window._temp)||window._temp.push(o)),l=c.children("ul"),l.length>0&&l.children("li:visible").length==0&&(c.children("ul").children("li").css("display","block"),u.expandNode(e[r]),u.model.expandedNodes.indexOf(n(u._liList).index(e[r]))!=-1||t.isNullOrUndefined(window._temp)||window._temp.push(e[r]))}else{if(s.find("ul>li").css("display","block"),!t.isNullOrUndefined(window._temp))for(r=0;r<window._temp.length;r++)u._collpaseNode(window._temp[r]);window._temp=[];n(i.target).hasClass("searchTreeView")&&u.collapseAll()}},editorTreeNavigatee:function(i,u){var o=u._memberPageSettings.currentMemeberPage,e,f;if(!n(i.target).hasClass("pageDisabled")){if(n(i.target).hasClass("nextPage"))u._memberPageSettings.startPage+=u.model.memberEditorPageSize,u._memberPageSettings.currentMemeberPage+=1,u._memberPageSettings.endPage+=u.model.memberEditorPageSize;else if(n(i.target).hasClass("prevPage"))u._memberPageSettings.currentMemeberPage-=1,u._memberPageSettings.startPage=Math.abs(u._memberPageSettings.startPage-(u._memberPageSettings.currentMemeberPage==1?u.model.memberEditorPageSize:u.model.memberEditorPageSize)),u._memberPageSettings.endPage-=u.model.memberEditorPageSize;else if(n(i.target).hasClass("firstPage"))u._memberPageSettings.currentMemeberPage=1,u._memberPageSettings.endPage=u.model.memberEditorPageSize,u._memberPageSettings.startPage=0;else if(n(i.target).hasClass("lastPage"))u._memberPageSettings.currentMemeberPage=parseInt(u.element.find(".memberPageCount").text().split("/")[1].trim()),u._memberPageSettings.endPage=u._memberPageSettings.currentMemeberPage*u.model.memberEditorPageSize,u._memberPageSettings.startPage=u._memberPageSettings.endPage-u.model.memberEditorPageSize;else{if(parseInt(n(i.target).val())>parseInt(t.isNullOrUndefined(u._pivotSchemaDesigner)?u.element.find(".memberPageCount").text().split("/")[1].trim():u._pivotSchemaDesigner.element.find(".memberPageCount").text().split("/")[1].trim())||parseInt(n(i.target).val())==0)return!1;u._memberPageSettings.currentMemeberPage=parseInt(n(i.target).val());u._memberPageSettings.endPage=u._memberPageSettings.currentMemeberPage*u.model.memberEditorPageSize;u._memberPageSettings.startPage=u._memberPageSettings.currentMemeberPage==1||u._memberPageSettings.currentMemeberPage==0?0:u._memberPageSettings.endPage-u.model.memberEditorPageSize}u._waitingPopup.show();u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?(u._isMemberPageFilter=!0,e=t.Pivot.updateTreeView(u._pivotSchemaDesigner),f=t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),f.splice(0,0,{id:"All",name:"All",checkedStatus:u._isAllMemberChecked,tag:""}),u._pivotSchemaDesigner._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(f)})):(u._isSearchApplied=!1,this.editorTreePageInfoSuccess(u._editorTreeData,u))}},editorTreePageInfoSuccess:function(i,u){setTimeout(function(){u._memberPageSettings.currentMemeberPage>1?u.element.find(".prevPage, .firstPage").removeClass("pageDisabled").addClass("pageEnabled"):u.element.find(".prevPage, .firstPage").removeClass("pageEnabled").addClass("pageDisabled");u._memberPageSettings.currentMemeberPage==parseInt(u.element.find(".memberPageCount").text().split("/")[1].trim())?u.element.find(".nextPage, .lastPage").removeClass("pageEnabled").addClass("pageDisabled"):u.element.find(".nextPage, .lastPage").removeClass("pageDisabled").addClass("pageEnabled");var e,f;u.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(e=i[0]!=r?i[0].Value:i.d!=r?i.d[0].Value:i.EditorTreeInfo,f=n.parseJSON(e),f.splice(-1,1));u.element.find(".memberCurrentPage").val(u._memberPageSettings.currentMemeberPage);u._appendTreeViewData(u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?f:t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),!1);u._unWireEvents();u._wireEvents();u._waitingPopup.hide()},0)},_searchEditorTreeNodes:function(i,u){u._waitingPopup.show();var f=this;setTimeout(function(){var e="",s,o,i;if(e=t.isNullOrUndefined(u._pivotSchemaDesigner)?t.isNullOrUndefined(n.trim(u.element.find(".searchEditorTreeView").val()))?"":n.trim(u.element.find(".searchEditorTreeView").val()).toLowerCase():t.isNullOrUndefined(n.trim(u._pivotSchemaDesigner.element.find(".searchEditorTreeView").val()))?"":n.trim(u._pivotSchemaDesigner.element.find(".searchEditorTreeView").val()).toLowerCase(),e!=""){for(i=jQuery.extend(!0,[],t.DataManager(u._editorTreeData).executeLocal(t.Query().where("name","contains",e,!0))),s=jQuery.extend(!0,[],t.DataManager(i).executeLocal(t.Query().where("pid","notEqual",null||r).where("name","contains",e,!0))),o=0;o<s.length;o++)f._appendParentNodes(i,s[o],u);u._isSearchApplied=!0;t.isNullOrUndefined(u._pivotSchemaDesigner)?u._appendTreeViewData(i,!1):(i.length>0&&i.splice(0,0,{id:"All",name:"All",checkedStatus:u._isAllMemberChecked,tag:""}),f._createSearchTreeview(i,u._pivotSchemaDesigner))}else u._isSearchApplied=!1,t.isNullOrUndefined(u._pivotSchemaDesigner)?u._appendTreeViewData(t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),!1):(i=t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),i.splice(0,0,{id:"All",name:"All",checkedStatus:u._isAllMemberChecked,tag:""}),f._createSearchTreeview(i,u._pivotSchemaDesigner));t.isNullOrUndefined(u._pivotSchemaDesigner)&&(u._unWireEvents(),u._wireEvents());u._waitingPopup.hide()},0)},_createSearchTreeview:function(i,r){var f,u;for(r.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:r.model.enableRTL,beforeDelete:function(){return!1},height:r.element.find(".memberEditorDiv").height(),fields:{id:"id",text:"name",isChecked:"checkedStatus",hasChild:"hasChildren",dataSource:i}}),f=r.element.find(".editorTreeView").find("li"),u=0;u<f.length;u++)t.isNullOrUndefined(n(f[u]).attr("id"))||n(f[u]).attr("tag",t.DataManager(i).executeLocal(t.Query().where("id","equal",n(f[u]).attr("id")))[0].tag);r._memberTreeObj=r.element.find(".editorTreeView").data("ejTreeView");r._memberTreeObj.model.nodeCheck=t.proxy(r._nodeCheckChanges,r);r._memberTreeObj.model.nodeUncheck=t.proxy(r._nodeCheckChanges,r);r._memberTreeObj.model.beforeExpand=t.proxy(r._beforeNodeExpand,r);t.isNullOrUndefined(r.element.find(".e-dialog .e-text:visible").first())||(r.element.find(".e-dialog .e-text:visible").length>0?(r.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"),r.element.find(".e-dialog button").removeClass("hoverCell")):r.element.find(".e-dialog button:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"))},_appendParentNodes:function(n,i,r){var u=jQuery.extend(!0,[],t.DataManager(r._editorTreeData).executeLocal(t.Query().where("id","equal",i.pid)));!t.isNullOrUndefined(u)&&u.length>0&&t.DataManager(n).executeLocal(t.Query().where("id","equal",u[0].id)).length==0&&(u[0].expanded=!0,n.push(u[0]),t.isNullOrUndefined(u[0].pid)||this._appendParentNodes(n,u[0],r))},_selectParentTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("id","equal",n.pid));!t.isNullOrUndefined(r)&&r.length>0&&(r[0].checkedStatus=!0,this._selectParentTreeNode(r[0],i))},_selectChildTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",n.id)),u;if(!t.isNullOrUndefined(r)&&r.length>0)for(u=0;u<r.length;u++)r[u].checkedStatus=!0,this._selectChildTreeNode(r[u],i)},_unSelectChildTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",n.id)),u;if(!t.isNullOrUndefined(r)&&r.length>0)for(u=0;u<r.length;u++)r[u].checkedStatus=!1,this._selectChildTreeNode(r[u],i)},_unSelectParentTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("id","equal",n.pid));!t.isNullOrUndefined(r)&&r.length>0&&(r[0].checkedStatus=!1,t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",r[0].pid).where("checkedStatus","equal",!0)).length==0&&this._unSelectParentTreeNode(r[0],i))},_getSelectedTreeState:function(n,i){var f,o,h,s,e,u;if(n){for(e=[],f=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r)),u=0;u<f.length;u++){if(o=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",f[u].id)),h={caption:f[u].name,parentId:t.isNullOrUndefined(f[u].pid)?"None":f[u].pid,id:f[u].id,checked:f[u].checkedStatus,expanded:o.length>0?!0:!1,childNodes:[],tag:f[u].tag},o.length>0)for(s=0;s<o.length;s++)h.childNodes.push(this._getEditorSlicerInfo(o[s],i));e.push(h)}return JSON.stringify(e)}for(e="",u=0;u<i._editorTreeData.length;u++)i._editorTreeData[u].checkedStatus==!0&&(e+="::"+i._editorTreeData[u].id+"||"+i._editorTreeData[u].tag);return e},_getUnSelectedTreeState:function(n){for(var i="",t=0;t<n._editorTreeData.length;t++)n._editorTreeData[t].checkedStatus==!1&&(i+="::"+n._editorTreeData[t].id+"||"+n._editorTreeData[t].tag);return i},_getEditorSlicerInfo:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",n.id)),f={caption:n.name,parentId:t.isNullOrUndefined(n.pid)?"None":n.pid,id:n.id,checked:n.checkedStatus,expanded:r.length>0?!0:!1,childNodes:[],tag:n.tag},u;if(r.length>0)for(u=0;u<r.length;u++)f.childNodes.push(this._getEditorSlicerInfo(r[u],i));return f},createErrorDialog:function(i){var r,u;t.Pivot.openPreventPanel(i);i.element.find(".errorDialog").length==0?(u=t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent",i._getLocalizedLabels("AlertMsg"))[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK")[0].outerHTML)[0].outerHTML).attr("title",i._getLocalizedLabels("Warning"))[0].outerHTML,i.element.append(u),i.element.find(".errorDialog").ejDialog({target:"#"+i._id,enableResize:!1,enableRTL:i.model.enableRTL,width:"400px"}),r=i.element.find(".errorDialog").data("ejDialog"),n("#"+r._id+"_wrapper").css({left:"50%",top:"50%"}),i.element.find(".errOKBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(t.Pivot.errOKBtnClick,i)}),i.element.find(".e-dialog .e-close").attr("title",i._getLocalizedLabels("Close"))):(r=i.element.find(".errorDialog").data("ejDialog"),r.open())},errOKBtnClick:function(){this.element.find("#preventDiv").remove();var n=this.element.find(".errorDialog").data("ejDialog");n._ejDialog.find("div.e-dialog-icon").trigger("click")},doAjaxPost:function(i,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==r?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:i,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(t){n.proxy(t,this);var i={action:this._currentAction,customObject:"",element:this.element}},this),error:t.proxy(function(n){typeof this._ogridWaitingPopup!="undefined"&&this._ogridWaitingPopup!=null&&this._ogridWaitingPopup.hide();typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide();var t={action:this._drillAction!=""?this._drillAction:"initialize",customObject:"",element:this.element,Message:n};this._trigger("renderFailure",t);this.renderControlFromJSON("");this._dataModel=="XMLA"&&this._createErrorDialog(n.statusText,this._getLocalizedLabels("Error"));n.statusText},this)})},getCubeList:function(t,i){for(var f,u=[],r=0;r<n(i).find("row").length;r++)f=n(n(i).find("row")[r]),u.push({name:n(f).children("CUBE_NAME").text()});t.pvtCtrldObj.setCubeList(u)},generateTreeViewData:function(n){var t={catalog:n.model.pivotControl.model.dataSource.catalog,cube:n.model.pivotControl.model.dataSource.cube,url:n.model.pivotControl.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"};this._getTreeData(t,this.loadDimensionElements,{schemaData:n,action:"loadFieldElements"})},loadDimensionElements:function(i,u){var h,f=i.schemaData.model.pivotControl,c={},v=t.olap.base._getConnectionInfo(f.model.dataSource.data),o={},a=f.model.dataSource.providerName==t.olap.Providers.Mondrian,s;for(o={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},f.schemaTreeView=[],f.reportItemNames=[],s=0;s<n(u).find("row").length;s++){var l=n(n(u).find("row")[s]),e=l.find("DIMENSION_UNIQUE_NAME").text(),h=l.find("DIMENSION_CAPTION").text();e.toLowerCase().indexOf("[measure")>=0?c={hasChildren:!0,isSelected:!1,id:e,name:h,spriteCssClass:e.toLowerCase()=="[measures]"?"folderCDB e-icon":"dimensionCDB e-icon",tag:e}:!n(n(u).find("row")[0]).find("HIERARCHY_CAPTION").length>0&&f.schemaTreeView.push({hasChildren:!0,isSelected:!1,id:a?e+"~#^Dim":e,name:h,spriteCssClass:"dimensionCDB e-icon",tag:e,defaultHierarchy:n(n(u).find("row")[s]).children("DEFAULT_HIERARCHY").text()})}f.schemaTreeView.splice(0,0,c);!f.model.enableDrillThrough||i.schemaData!=r&&i.schemaData.model.olap.showNamedSets?(o.request="MDSCHEMA_SETS",t.Pivot._getTreeData(o,t.Pivot.loadNamedSetElements,i)):(o.request="MDSCHEMA_HIERARCHIES",(t.isNullOrUndefined(f._fieldData)||!t.isNullOrUndefined(f._fieldData)&&t.isNullOrUndefined(f._fieldData.hierarchy))&&this._getFieldItemsInfo(f),f._fieldData.hierarchySuccess==r?t.Pivot._getTreeData(o,f.loadHierarchyElements,i):t.Pivot.loadHierarchyElements(i,f._fieldData.hierarchySuccess))},loadNamedSetElements:function(i,u){var e=i.schemaData.model.pivotControl,c={catalog:e.model.dataSource.catalog,cube:e.model.dataSource.cube,url:e.model.dataSource.data,request:"MDSCHEMA_HIERARCHIES"},u=e.model.dataSource,h=[],o,s,f;for(o=n.map(u.rows,function(n){if(n.fieldName!=r)return n.fieldName}),n.merge(o,n.map(u.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(o,n.map(u.filters,function(n){if(n.fieldName!=r)return n.fieldName})),s=0;s<n(u).find("row").length;s++)f=n(n(u).find("row")[s]),n.inArray(f.find("DIMENSIONS").text().split(".")[0],h)>=0||(e.schemaTreeView.push({hasChildren:!0,isSelected:!1,pid:f.find("DIMENSIONS").text().split(".")[0],id:f.find("SET_DISPLAY_FOLDER").text()+"_"+f.find("DIMENSIONS").text().split(".")[0],name:f.find("SET_DISPLAY_FOLDER").text(),spriteCssClass:"folderCDB e-icon namedSets"}),h.push(f.find("DIMENSIONS").text().split(".")[0])),e.schemaTreeView.push({hasChildren:!0,isSelected:n.inArray("["+n.trim(f.children("SET_NAME").text())+"]",o)>=0,pid:f.find("SET_DISPLAY_FOLDER").text()+"_"+f.find("DIMENSIONS").text().split(".")[0],id:"["+n.trim(f.children("SET_NAME").text()).replace(/\&/g,"&")+"]",name:f.children("SET_CAPTION").text(),spriteCssClass:"namedSetCDB e-icon",tag:f.find("EXPRESSION").text()});t.isNullOrUndefined(e._fieldData)||e._fieldData.hierarchySuccess==r?t.Pivot._getTreeData(c,t.Pivot.loadHierarchyElements,i):t.Pivot.loadHierarchyElements(i,e._fieldData.hierarchySuccess)},loadHierarchyElements:function(i,u){var f=i.schemaData.model.pivotControl,v={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_LEVELS"},c=f.model.dataSource,o,a=f.model.dataSource.providerName==t.olap.Providers.Mondrian,s;for(o=n.map(c.rows,function(n){if(n.fieldName!=r)return n.fieldName}),n.merge(o,n.map(c.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(o,n.map(c.filters,function(n){if(n.fieldName!=r)return n.fieldName})),s=0;s<n(u).find("row").length;s++){var e=n(n(u).find("row")[s]),l=e.find("DIMENSION_UNIQUE_NAME").text(),h=e.find("HIERARCHY_UNIQUE_NAME").text(),y=n(f.schemaTreeView).filter(function(n,t){return t.tag==l}).map(function(n,t){return t});y.length>0&&(l!=h||a)&&f.schemaTreeView.push({hasChildren:!0,isSelected:n.inArray(h,o)>=0,pid:l+(a?"~#^Dim":""),id:h,name:e.find("HIERARCHY_CAPTION").text(),spriteCssClass:e.find("HIERARCHY_ORIGIN").text()!="2"&&e.find("HIERARCHY_ORIGIN").text()!="6"?"hierarchyCDB e-icon":"attributeCDB e-icon",tag:h})}t.Pivot._getTreeData(v,t.Pivot.loadLevelElements,i)},loadLevelElements:function(i,r){var u=i.schemaData.model.pivotControl,e=n.map(n(r).find("row"),function(t){if(parseInt(n(t).children("LEVEL_TYPE").text())!="1"&&n(t).children("HIERARCHY_UNIQUE_NAME").text().toLowerCase()!="[measures]")return{hasChildren:!1,isChecked:!1,id:n(t).find("LEVEL_UNIQUE_NAME").text(),pid:n(t).find("HIERARCHY_UNIQUE_NAME").text(),name:n(t).find("LEVEL_CAPTION").text(),tag:n(t).find("LEVEL_UNIQUE_NAME").text(),spriteCssClass:"level"+parseInt(n(t).children("LEVEL_NUMBER").text())+" e-icon"}}),f;n.merge(u.schemaTreeView,e);(!u.model.enableDrillThrough||u._fieldData.measureSuccess)&&(t.isNullOrUndefined(u._fieldData)||!u._fieldData.measureSuccess?(f={catalog:u.model.dataSource.catalog,cube:u.model.dataSource.cube,url:u.model.dataSource.data,request:"MDSCHEMA_MEASURES"},t.Pivot._getTreeData(f,t.Pivot.loadMeasureElements,i)):t.Pivot.loadMeasureElements(i,u._fieldData.measureSuccess))},loadMeasureGroups:function(i,r){t.isNullOrUndefined(i.pivotControl._fieldData)&&(i.pivotControl._fieldData={});i.pivotControl._fieldData.measuresGroups=n(r).find("row")},loadMeasureElements:function(i,u){var f=i.schemaData.model.pivotControl,s={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},v=[],y=[],c,h,a;for(v=n.map(f.model.dataSource.values,function(n){if(n.measures!=r)return n.measures}),f.reportItemNames=n.map(v,function(n){if(n.fieldName!=r)return n.fieldName}),f.model.locale!="en-US"&&(s={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_MEASUREGROUPS"},t.Pivot._getTreeData(s,t.Pivot.loadMeasureGroups,{pivotControl:f,action:"loadFieldElements"})),h=0;h<n(u).find("row").length;h++){var l=n(n(u).find("row")[h]),e=l.children("MEASUREGROUP_NAME").text(),o=l.find("MEASURE_UNIQUE_NAME").text();n.inArray(e,y)>=0||(f.model.locale!="en-US"?(a=n.map(f._fieldData.measuresGroups,function(t){if(n(t).children("MEASUREGROUP_NAME").text()==e)return n(t).children("MEASUREGROUP_CAPTION").text()}),c=a.length>0?a[0]:e):c=e,e!=""&&f.schemaTreeView.push({hasChildren:!0,isChecked:!1,pid:"[Measures]",id:e,name:c,spriteCssClass:"measureGroupCDB e-icon",tag:e}),y.push(e));f.schemaTreeView.push({hasChildren:!0,isSelected:n.inArray(o,f.reportItemNames)>=0,id:o,pid:e==""?"[Measures]":e,name:l.children("MEASURE_CAPTION").text(),spriteCssClass:"measure",tag:o});n.inArray(o,f.reportItemNames)>=0&&f.reportItemNames.splice(f.reportItemNames.indexOf(o),1)}!t.isNullOrUndefined(i.schemaData)&&i.schemaData.model.olap.showKpi?(treeNodeElement={hasChildren:!0,isChecked:!1,id:"folderStruct",name:"KPI",spriteCssClass:"KPICDB folderCDB e-icon",tag:""},f.schemaTreeView.splice(1,0,treeNodeElement),s.request="MDSCHEMA_KPIS",f._getTreeData(s,f.loadKPIElements,i)):t.isNullOrUndefined(i.schemaData)||i.schemaData._createTreeView(this,f.schemaTreeView)},loadKPIElements:function(t,i){for(var r=t.schemaData.model.pivotControl,i=r.model.dataSource,e=this.reportItemNames,a=[],o=0;o<n(i).find("row").length;o++){var f=n(n(i).find("row")[o]),u=f.children("KPI_CAPTION").text(),s=f.children("KPI_goal").text(),h=f.children("KPI_STATUS").text(),c=f.children("KPI_TREND").text(),l=f.find("KPI_VALUE").text();n.inArray(f.children("KPI_NAME").text(),a)>=0||(treeNodeElement={hasChildren:!0,isChecked:!1,pid:"folderStruct",id:u,name:u,spriteCssClass:"measureGroupCDB e-icon",tag:u},r.schemaTreeView.push(treeNodeElement),a.push(u));treeNodeElement={hasChildren:!0,isSelected:n.inArray(s,e)>=0,id:s,pid:u,name:r._getLocalizedLabels("Goal"),spriteCssClass:"kpiGoal e-icon",tag:s};r.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(h,e)>=0,id:h,pid:u,name:r._getLocalizedLabels("Status"),spriteCssClass:"kpiStatus e-icon",tag:h};r.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(c,e)>=0,id:c,pid:u,name:r._getLocalizedLabels("Trend"),spriteCssClass:"kpiTrend e-icon",tag:c};r.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(l,e)>=0,id:l,pid:u,name:r._getLocalizedLabels("Value"),spriteCssClass:"kpiValue e-icon",tag:l};r.schemaTreeView.push(treeNodeElement)}t.schemaData._createTreeView(this,r.schemaTreeView);delete r.reportItemNames;delete r.schemaTreeView},_createCalcMemberDialog:function(i){var o="",s,h,e,c,f,a,l,u;o=i.length>1&&i[0]!=r?JSON.parse(i[0].Value):i.d!=r?JSON.parse(i.d[0].Value):JSON.parse(i.CubeTreeInfo);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchCalcMemberTreeView",element:this.element,customObject:this.model.customObject});t.Pivot.openPreventPanel(this);this.element.find(".calcMemberDialog",".clientDialog",".e-dialog").remove();var v=t.buildTag("div.cubeBrowserCalcMember",t.buildTag("div#"+this._id+"_cubeTreeViewCalcMember.cubeTreeViewCalcMember")[0].outerHTML,{})[0].outerHTML,y=t.buildTag("label.lblCaption",this._getLocalizedLabels("Caption"),{})[0].outerHTML+t.buildTag("input#"+this._id+"_captionFieldCM.captionFieldCM","",{}).attr("aria-label",this._getLocalizedLabels("Caption"))[0].outerHTML,p=t.buildTag("label.lblexpression",this._getLocalizedLabels("Expression"),{})[0].outerHTML+t.buildTag("textarea#"+this._id+"_expressionFieldCM.e-textarea e-droppable expressionFieldCM"+(this.model.enableRTL?" e-rtl":""),"",{}).attr("aria-label",this._getLocalizedLabels("Expression"))[0].outerHTML,w=t.buildTag("label.lblmemberType",this._getLocalizedLabels("MemberType"),{})[0].outerHTML+t.buildTag("input#"+this._id+"_memberTypeFieldCM.memberTypeFieldCM","",{}).attr("aria-label",this._getLocalizedLabels("MemberType"))[0].outerHTML+t.buildTag("input#"+this._id+"_dimensionFieldCM.dimensionFieldCM","",{}).attr("aria-label","dimension")[0].outerHTML,b=t.buildTag("label.lblformat",this._getLocalizedLabels("FormatString"),{})[0].outerHTML+t.buildTag("input#"+this._id+"_formatFieldCM.formatFieldCM","",{}).attr("aria-label",this._getLocalizedLabels("FormatString"))[0].outerHTML+t.buildTag("input#"+this._id+"_customFormatFieldCM.customFormatFieldCM","",{}).attr("aria-label","custom format")[0].outerHTML,k=t.buildTag("div.calcMemberFieldPanel",y+p+w+b,{})[0].outerHTML,d=t.buildTag("button#"+this._id+"_btnOk.btnCalcMemberOk",this._getLocalizedLabels("OK"),{},{name:this._getLocalizedLabels("OK")}).attr("aria-label",this._getLocalizedLabels("OK"))[0].outerHTML,g=t.buildTag("button#"+this._id+"_btnCancel.btnCalcMemberCancel",this._getLocalizedLabels("Cancel"),{},{name:this._getLocalizedLabels("Cancel")}).attr("aria-label",this._getLocalizedLabels("Cancel"))[0].outerHTML,nt=t.buildTag("div.calcMemberFooter",d+g,{})[0].outerHTML;for(this._calcMemberDialog=t.buildTag("div#"+this._id+"_calcMemberDialog",v+k+nt,{})[0].outerHTML,n(this._calcMemberDialog).appendTo("#"+this._id),n("#"+this._id+"_calcMemberDialog").ejDialog({width:"auto",title:this._getLocalizedLabels("CalculatedMember"),cssClass:this.model.cssClass+" calcMemberDialog",enableModal:!1,target:"#"+this._id,enableRTL:this.model.enableRTL,enableResize:!1,close:t.proxy(function(){t.Pivot.closePreventPanel(this)},this),beforeOpen:t.proxy(function(){this.element.find(".calcMemberDialog .e-dialog").css("display","block")},this)}),this._calcMemberDialog=this.element.find("#"+this._id+"_calcMemberDialog").data("ejDialog"),n("#"+this._id+"_btnCancel").ejButton({type:t.ButtonType.Button,width:"80px",enableRTL:this.model.enableRTL,click:t.proxy(function(){this._calcMemberDialog.close();this._selectedCalcMember=null;t.Pivot.closePreventPanel(this)},this)}),n("#"+this._id+"_btnOk").ejButton({type:t.ButtonType.Button,width:"80px",enableRTL:this.model.enableRTL,click:t.proxy(function(){var i,u,r,f;if(n.trim(this.element.find("#"+this._id+"_captionFieldCM").val())==""||n.trim(this.element.find("#"+this._id+"_expressionFieldCM").val())==""){t.Pivot._createErrorDialog(this._getLocalizedLabels("EmptyField"),this._getLocalizedLabels("Warning"),this);return}if(this.element.find("#"+this._id+"_formatFieldCM").val()=="Custom"&&n.trim(this.element.find("#"+this._id+"_customFormatFieldCM").val())==""){t.Pivot._createErrorDialog(this._getLocalizedLabels("EmptyFormat"),this._getLocalizedLabels("Warning"),this);return}if(t.isNullOrUndefined(this._selectedCalcMember))for(i=0;i<this._calcMembers.length;i++)if(n.trim(this.element.find("#"+this._id+"_captionFieldCM").val()).toLowerCase()==this._calcMembers[i].name.toLowerCase())if(confirm(this._getLocalizedLabels("Confirm")))this._selectedCalcMember=n.trim(this.element.find("#"+this._id+"_captionFieldCM").val());else return;this._calcMemberDialog.close();t.Pivot.closePreventPanel(this);u="";t.isNullOrUndefined(this._selectedCalcMember)||(r=t.DataManager(this._calcMembers).executeLocal(t.Query().where("name","equal",this._selectedCalcMember,!0)),!t.isNullOrUndefined(r)&&r.length>0&&(u=r[0].tag));this._selectedCalcMember=null;this._waitingPopup.show();f=JSON.stringify({action:"calculatedMember",olapReport:this.currentReport,clientReports:this.reports,caption:this.currentCubeName+"%"+n.trim(this.element.find("#"+this._id+"_captionFieldCM").val()),expression:n.trim(this.element.find("#"+this._id+"_expressionFieldCM").val()),memberType:this.element.find("#"+this._id+"_memberTypeFieldCM").val(),dimension:this.element.find("#"+this._id+"_dimensionFieldCM").val(),formatString:this.element.find("#"+this._id+"_formatFieldCM").val()=="Custom"?n.trim(this.element.find("#"+this._id+"_customFormatFieldCM").val()):this.element.find("#"+this._id+"_formatFieldCM").val(),uniqueName:u,customObject:this.model.customObject});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.calculatedMember,f,this._calcMemberDroppedSuccess)},this)}),this.element.find("#"+this._id+"_cubeTreeViewCalcMember").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:o},allowDragAndDrop:!0,enableRTL:this.model.enableRTL,allowDropChild:!1,allowDropSibling:!1,dragAndDropAcrossControl:!0,cssClass:"calcMemberTreeViewDragedNode",nodeDropped:t.proxy(function(t){t.target!=null&&t.target.attr("id")==""+this._id+"_expressionFieldCM"&&this.element.find("#"+this._id+"_expressionFieldCM").val(this.element.find("#"+this._id+"_expressionFieldCM").val()+n(t.droppedElement).attr("tag"))},this),beforeExpand:t.proxy(t.Pivot._getMemberChildNodes,this)}),this.element.find("#"+this._id+"_captionFieldCM").ejMaskEdit({name:"inputbox",inputMode:t.InputMode.Text,watermarkText:"",maskFormat:"",textAlign:this.model.enableRTL?"right":"left",width:"100%"}),this.element.find("#"+this._id+"_customFormatFieldCM").ejMaskEdit({name:"inputbox",inputMode:t.InputMode.Text,watermarkText:"",maskFormat:"",textAlign:this.model.enableRTL?"right":"left",width:"100%",cssClass:"calcMemberCustomFormat"}),this.element.find(".calcMemberCustomFormat").css("visibility","hidden"),this.element.find("#"+this._id+"_memberTypeFieldCM").ejDropDownList({dataSource:[{text:"Measure",value:"Measure"},{text:"Dimension",value:"Dimension"}],enableRTL:this.model.enableRTL,width:"100%",selectedIndex:0,change:t.proxy(function(n){n.text=="Dimension"?this.element.find(".calcMemberDimensionField").css("visibility","visible"):this.element.find(".calcMemberDimensionField").css("visibility","hidden")},this)}),s=t.DataManager(o).executeLocal(t.Query().where("spriteCssClass","contains","dimensionCDB")),h=[],u=0;u<s.length;u++)h.push({text:s[u].name,value:s[u].name});for(this.element.find("#"+this._id+"_dimensionFieldCM").ejDropDownList({dataSource:h,selectedIndex:0,width:"100%",enableRTL:this.model.enableRTL,cssClass:"calcMemberDimensionField"}),this.element.find(".calcMemberDimensionField").css("visibility","hidden"),this.element.find("#"+this._id+"_formatFieldCM").ejDropDownList({dataSource:[{text:"Standard",value:"Standard"},{text:"Currency",value:"Currency"},{text:"Percent",value:"Percent"},{text:"Custom",value:"Custom"}],enableRTL:this.model.enableRTL,selectedIndex:0,width:"100%",enableRTL:this.model.enableRTL,change:t.proxy(function(n){n.text=="Custom"?this.element.find(".calcMemberCustomFormat").css("visibility","visible"):this.element.find(".calcMemberCustomFormat").css("visibility","hidden")},this)}),e=this.element.find(".cubeTreeViewCalcMember").find("li"),u=0;u<e.length;u++)t.isNullOrUndefined(n(e[u]).attr("id"))||n(e[u]).attr("tag",t.DataManager(o).executeLocal(t.Query().where("id","equal",n(e[u]).attr("id")))[0].tag);for(c=this.element.find(".cubeTreeViewCalcMember .folderCDB"),u=0;u<c.length;u++)n(c[u].parentElement).removeClass("e-draggable");if(this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").length>0&&this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parent().removeClass("e-draggable"),this._calcMemberTreeObj=this.element.find(".cubeTreeViewCalcMember").data("ejTreeView"),!t.isNullOrUndefined(this._selectedCalcMember)&&(f=t.DataManager(this._calcMembers).executeLocal(t.Query().where("name","equal",this._selectedCalcMember)),f.length>0)){if(this.element.find("#"+this._id+"_captionFieldCM").val(f[0].name),this.element.find("#"+this._id+"_expressionFieldCM").val(f[0].expression),this.element.find("#"+this._id+"_memberTypeFieldCM").data("ejDropDownList").selectItemsByIndices(f[0].nodeType),f[0].nodeType==1)for(a=f[0].tag.split(".")[0].replace(/\[/g,"").replace(/\]/g,""),l=this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").model.dataSource,u=0;u<l.length;u++)l[u].value==a&&this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").selectItemsByIndices(u);t.isNullOrUndefined(f[0].formatString)||(f[0].formatString=="Currency"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(1):f[0].formatString=="Percent"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2):(this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2),this.element.find("#"+this._id+"_customFormatFieldCM").val(f[0].formatString)))}this._waitingPopup.hide()},_getMemberChildNodes:function(i){var r,u,f;(n(i.currentElement).find("a > span")[0].className.indexOf("level")>-1||n(i.currentElement).find("a > span")[0].className.indexOf("member")>-1)&&(r=t.DataManager(this._calcMemberTreeObj.dataSource()).executeLocal(t.Query().where("pid","equal",n(i.currentElement).attr("id")).where("name","equal","(Blank)")),!t.isNullOrUndefined(r)&&r.length>0&&(this._calcMemberTreeObj.hideNode(r[0].id),this.pNode=i.currentElement,this._waitingPopup.show(),u=n(i.currentElement).find("a > span")[0].className.indexOf("level")>-1?"level":"member",this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"fetchMemberChildNodes",element:this.element,customObject:this.model.customObject}),f=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchMemberChildNodes",dimensionName:n(i.currentElement).attr("tag")+":"+u+":"+n(i.currentElement).attr("id"),olapReport:this.currentReport,customObject:f}),t.proxy(t.Pivot._fetchMemberSuccess,this))))},_fetchMemberSuccess:function(u){var f=[],e,o;for(f=u.length>1&&u[0]!=r?JSON.parse(u[0].Value):u.d!=r?JSON.parse(u.d[0].Value):JSON.parse(u.MemberChildNodes),this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchMemberChildNodes",element:this.element,customObject:this.model.customObject}),this._calcMemberTreeObj.model.beforeExpand=null,this._calcMemberTreeObj.addNode(f,n(this.pNode)),e=t.DataManager(this._calcMemberTreeObj.dataSource()).executeLocal(t.Query().where("pid","equal",n(this.pNode).attr("id")).where("name","equal","(Blank)")),!t.isNullOrUndefined(e)&&e.length>0&&this._calcMemberTreeObj.removeNode(e[0].id),n.each(n(this.pNode).children().find("li"),function(n,t){t.setAttribute("tag",f[n].tag)}),o=n(this.pNode).children().find("li"),i=0;i<o.length;i++)f[i].hasChildren==!0&&(this._calcMemberTreeObj.addNode({id:f[i].id+"_Blank_"+i,name:"(Blank)",parentId:f[i].id},o[i]),this.element.find("#"+f[i].id).find("> div > div:first").removeClass("e-process"),this._calcMemberTreeObj.collapseNode(this.element.find("#"+f[i].id)));this._calcMemberTreeObj.model.beforeExpand=t.proxy(t.Pivot._getMemberChildNodes,this);this._waitingPopup.hide()},_drillThroughCellClick:function(r,u){var s,f,h,e,c,o;if(u._waitingPopup.show(),f=n(r.currentTarget.parentElement).attr("p"),u.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.drillThroughDataTable,JSON.stringify({currentReport:JSON.parse(u.getOlapReport()).Report,layout:u.model.layout,cellPos:f,customObject:JSON.stringify(u.model.customObject)}),function(t){n(u.element).parents(".e-pivotclient").length>0?n(u.element).parents(".e-pivotclient").data("ejPivotClient")._trigger("drillThrough",{element:u.element,data:t}):u._trigger("drillThrough",{element:u.element,data:t})});else{for(h=n("#"+u._id).find("tbody").find("tr:first").find("th").length,i=0;i<h;i++)e=u.getJSONRecords()[parseInt(i*u._rowCount+parseInt(f.split(",")[1]))].Info.indexOf("Measures")!=-1||u.getJSONRecords()[parseInt(i*u._rowCount+parseInt(f.split(",")[1]))].RowSpan<=1?u.getJSONRecords()[parseInt(i*u._rowCount+parseInt(f.split(",")[1]))].Info.split("::")[0]:"",e.indexOf("Measures")!=-1&&(s=e),e!=""&&(u._rowHeader[i]=e);for(c=n("#"+u._id).find("tbody").find('[p="'+parseInt(f.split(",")[0])+","+parseInt(f.split(",")[1])+'"]').closest("tbody").prev().children("tr").length,i=0;i<c;i++)o=u.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*u._rowCount+i)].Info.indexOf("Measures")!=-1||u.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*u._rowCount+i)].ColSpan<=1?u.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*u._rowCount+i)].Info.split("::")[0]:"",o.indexOf("Measures")!=-1&&(s=o),o!=""&&(u._colHeader[i]=o);for((t.isNullOrUndefined(u._fieldData)||!t.isNullOrUndefined(u._fieldData)&&t.isNullOrUndefined(u._fieldData.hierarchy))&&u._getFieldItemsInfo(u),j=0;j<u._fieldData.measures.length;j++)s==u._fieldData.measures[j].id&&(u.measureGrp=u._fieldData.measures[j].pid);u._rowHeader=n.grep(u._rowHeader,function(n){return n==0||n});u._colHeader=n.grep(u._colHeader,function(n){return n==0||n});u._createDrillThroughQuery("",u)}},openHierarchySelector:function(n,i){var r,u,f;n.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._createDrillThroughDialog(n,i):(n._waitingPopup.show(),r=n.target.className.indexOf("e-pivotclient")>=0?n._pivotGrid:n,u=r._getConnectionInfo(n.model.dataSource.data),f='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_MEASUREGROUP_DIMENSIONS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.model.dataSource.cube+"<\/CUBE_NAME><MEASUREGROUP_NAME>"+r.measureGrp+"<\/MEASUREGROUP_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+u.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",this.doAjaxPost("POST",u.url,{XMLA:f},r._loadDimensionElements,null,{pvtGridObj:r,action:"loadMeasureElements"}))},_createDrillThroughDialog:function(i,r){var e,u,o,f;i.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode&&r.shift();i.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();var s=t.buildTag("label#",i._getLocalizedLabels("SelectHierarchy"))[0].outerHTML,h="<div class=cubeTable style='width:200px; overflow:auto'><div valign=\"bottom\">"+this._createHierarchyBrowser()+"<\/div><\/div>",c=t.buildTag("div#dropDlg.dropDlg",'<table class="outerTable"><tr><td>'+h+"<\/td><td>"+s+"<br><textarea id='hrSel' style='width:270px; height:300px; resize:none; margin:0px 5px 0 5px'><\/textarea><\/br><br><\/td><\/tr><\/table>")[0].outerHTML+"<\/br>",l=t.buildTag("div",t.buildTag("button#btnOK.dialogBtnOK",i._getLocalizedLabels("OK"))[0].outerHTML+t.buildTag("button#btnCancel.dialogBtnCancel",i._getLocalizedLabels("Cancel"))[0].outerHTML,{float:"right",margin:"-5px 0 6px"})[0].outerHTML,a=t.buildTag("div#clientDialog.clientDialog",c+l,{opacity:"1"}).attr("title","Hierarchy Selector")[0].outerHTML;for(n(a).appendTo("#"+i._id),n("#btnOK, #btnCancel").ejButton(),n("#btnOK, #btnCancel").css({margin:"0 20px 20px 0",width:"50px"}),i.element.find(".clientDialog").ejDialog({width:550,target:"#"+i._id,enableResize:!1,enableRTL:i.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,i)}),i.element.find(".cubeTreeViewHierarchy").ejTreeView({showCheckbox:!0,fields:{id:"id",parentId:"pid",text:"name",isChecked:"isSelected",spriteCssClass:"spriteCssClass",dataSource:i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.parseJSON(r.d):r},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:i.model.enableRTL?!0:!1,beforeDelete:function(){return!1},dragAndDropAcrossControl:!0,nodeDropped:t.proxy(this._hierarchyNodeDropped,i)}),i._tableTreeObj=i.element.find(".cubeTreeViewHierarchy").data("ejTreeView"),i._tableTreeObj.element.find(".e-ul").css({width:"100%",height:"100%"}),i._tableTreeObj.element.find(".e-chkbox-wrap").remove(),e=i._tableTreeObj.element.find("li"),u=0;u<e.length;u++)o=i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.parseJSON(r.d)[u].tag:r[u].tag,e[u].setAttribute("tag",o);i._tableTreeObj&&i._tableTreeObj.element.find("li").mouseover(t.proxy(function(t){n(t.target).parent().find(".measureGroupCDB, .dimensionCDB, .folderCDB").length>0&&n(t.target).css("cursor","default")},i));f=i;n("#btnOK").click(function(){var i=n("#hrSel").val();n(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog, .drilltableDialog").remove();f._waitingPopup.show();t.olap._mdxParser._createDrillThroughQuery(i,f);f._waitingPopup.hide()});n("#btnCancel").click(function(){n(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();f._waitingPopup.hide()});i.model.enableRTL&&(n(".e-dialog").addClass("e-rtl"),n(".dialogBtnCancel").css("margin","0 -70px 0 0"))},_createHierarchyBrowser:function(){return t.buildTag("div.cubeBrowserHierarchy",t.buildTag("div.cubeTreeViewHierarchy")[0].outerHTML,{width:"200px",height:"300px",overflow:"auto"})[0].outerHTML},_hierarchyNodeDropped:function(i){var r,f,u;if(i.dropTarget[0].id=="hrSel"){for(r=n(n(i.droppedElement).children()[0]).find(".dimensionCDB").length>0?this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(i.droppedElement).find("li:first").attr("tag"):n(i.droppedElement).find("li:first")[0].id:n(i.droppedElement).find("li:first").length==0?this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(i.droppedElement.parent().parent()).attr("tag"):n(i.droppedElement.parent().parent())[0].id:this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(i.droppedElement).attr("tag"):i.droppedElementData.id,r=r.replace("[","[$"),f=0;f<n("#hrSel").val().split(",").length;f++)if(r==n("#hrSel").val().split(",")[f])return!1;u=this.element.find("#hrSel").val();u.length!=0?(u=u+","+r,this.element.find("#hrSel").val(u)):this.element.find("#hrSel").val(r)}},_generateDrillData:function(t,i){for(var e=n(i).find("row").children(),r=n.map(e,function(n){var t=parseFloat(n.textContent),i=n.tagName.replace(/_x005B_/g,"[").replace(/_x0020_/g," ").replace(/_x005D_/g,"]").replace(/_x0024_/g,"$").replace("].[","]-[");return'"'+i+'":'+t}),o=r[0],u="",f=0;f<r.length;f++){if(r[f]==o){u+=u==""?"[{"+r[f]:"}, {"+r[f];continue}u+=","+r[f]}u+="}]";n(t.pvtGridObj.element).parents(".e-pivotclient").length>0?n(t.pvtGridObj.element).parents(".e-pivotclient").data("ejPivotClient")._trigger("drillThrough",{element:t.pvtGridObj.element,data:u}):t.pvtGridObj._trigger("drillThrough",{element:t.pvtGridObj.element,data:u})},_getFilterState:function(i,r,u,f){var e="",o;return f.model.operationalMode==t.Pivot.OperationalMode.ClientMode?i?((f._fieldSelectedMembers[u.fieldName.toLowerCase()]=="All"||t.isNullOrUndefined(f._fieldSelectedMembers[u.fieldName.toLowerCase()]))&&t.olap._mdxParser.getAllMember(f.model.dataSource,u.fieldName,f),e=f._fieldSelectedMembers[u.fieldName.toLowerCase()]=="All"||t.isNullOrUndefined(f._fieldSelectedMembers[u.fieldName.toLowerCase()])?f._allMember:f._fieldSelectedMembers[u.fieldName.toLowerCase()]):e=u.filterItems.filterType=="include"?u.filterItems.values.length==1?u.filterItems.values[0]:f._getLocalizedLabels("MultipleItems"):r.length-(u.filterItems.values.indexOf("All")==-1?u.filterItems.values.length:u.filterItems.values.length-1)==1?r.filter(function(n){if(u.filterItems.values.indexOf(n.toString())==-1)return n}):f._getLocalizedLabels("MultipleItems"):f.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(o=t.isNullOrUndefined(f._tempFilterData)?[]:n.map(f._tempFilterData,function(n){return n[u.DimensionHeader]}),e=o.length>0&&f._fieldMembers[u.DimensionHeader]?f._fieldMembers[u.DimensionHeader].length-o.length==1?f._fieldMembers[u.DimensionHeader].filter(function(n){if(o.indexOf(n)==-1)return n}):f._getLocalizedLabels("MultipleItems"):f._getLocalizedLabels("All")):e=(f._fieldSelectedMembers[u.Tag]=="All"?u.AllMember:f._fieldSelectedMembers[u.Tag])||u.AllMember,e},_getTreeViewItems:function(t){for(var r,e=t.element.find(".editorTreeView"),u=[],f=n(e).find(":input.nodecheckbox"),i=0;i<f.length;i++)r=n(f[i]).parents("li:eq(0)"),u.push({Id:r[0].id,name:n(r[0]).find("a:eq(0)").text()});return u},_getEditorMember:function(i,r,u){var f,h,e,o;if(r.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){var c=this._getTreeViewItems(u?r._schemaData:r),l=n.extend(!0,[],u?r._schemaData._memberTreeObj.dataSource():r._memberTreeObj.dataSource()),s=n.map(c,function(i){if(i.Id!="All")return n.map(l,function(n){i.Id==n.id&&(i=n,i.name=t.isNullOrUndefined(i.parentId)?i.name+"_1":i.name)}),i}),f=[],e=n.map(s,function(t){return n.map(s,function(n){t.parentId==n.id&&(t.name=t.name+"_"+(Number(n.name.split("_")[n.name.split("_").length-1])+1))}),t});return n.map(e,function(n){var t=n.name.split("_")[n.name.split("_").length-2],i=Number(n.name.split("_")[n.name.split("_").length-1]),r=n.checkedStatus;f.push({name:t,checked:r,level:Number(i)})}),this._updateEditorMembers(i,f,r)}if(r.model.analysisMode==t.Pivot.AnalysisMode.Olap)return f=[],r.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&r.model.enableMemberEditorPaging?(e=r._editorTreeData,n.map(e,function(n){var t=n.name,i=n.id.split("_")[n.id.split("_").length-1],r=n.checkedStatus;f.push({name:t,checked:r,level:Number(i)})})):(h=u?r._schemaData.element.find(".editorTreeView"):r.element.find(".editorTreeView"),e=n(h).find(":input.nodecheckbox"),n.map(e,function(t){if(n(t).parents("li:eq(0)").attr("id")!="All"){var i=n(t).parent().siblings("a").text(),r=t.value.split("_")[t.value.split("_").length-1],u=t.checked||n(t.parentElement).attr("aria-checked")=="mixed"?!0:!1;f.push({name:i,checked:u,level:Number(r)})}})),this._updateEditorMembers(i,f,r);for(textArr=[],o=1;o<i.length;o++)textArr.push(n(i[o].parentElement).siblings("a").text());return textArr},_updateEditorMembers:function(i,r,u){var f,y,s,a;if(!t.isNullOrUndefined(u._fieldMembers[i])){var v=[],e=0,c="",o=u._fieldMembers[i];for(f=0;f<r.length;f++)if(t.isNullOrUndefined(o[f+e])||r[f].level==o[f+e].level)v.push(r[f]);else if(t.isNullOrUndefined(o[f+e])||r[f].level<o[f+e].level){s=f;do r[f-1].checked&&v.push(o[s]),e++,s++;while(r[f].level<o[s].level);f--}else if(t.isNullOrUndefined(o[f+e])||r[f].level>o[f+e].level){y=o[f+e].level;s=f;do v.push(r[s]),e--,s++,f=s-1;while(r[s].level>y)}}u._fieldMembers[i]=t.isNullOrUndefined(u._fieldMembers[i])?r:v;var l=1,p="",w="",h=[];do if(a=n.map(u._fieldMembers[i],function(n){if(n.level==l)return n}),h=n.map(a,function(n){if(n.checked)return n}),a.length==h.length)c=l==1?"All":p,a.length>1&&(w="All"),l++;else if(h.length==1)p=c=w=="All"?"multiple":h[0].name,l++;else if(h.length>1&&a.length>h.length){c="multiple";break}while(h.length>0&&c!="All"&&c!="multiple"&&n.map(u._fieldMembers[i],function(n){if(n.level==l)return n}).length>0);return c},_getTreeData:function(n,i,r){var u=t.olap.base._getConnectionInfo(n.url),f='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>'+n.request+"<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>"+n.catalog+"<\/CATALOG_NAME>"+(r.action=="loadcubelist"?"":"<CUBE_NAME>"+n.cube+"<\/CUBE_NAME>")+"<\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><LocaleIdentifier>"+u.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";r.action="loadFieldElements";this.doAjaxPost("POST",u.url,{XMLA:f},i,null,r)},updateTreeView:function(t){for(var h,c,o,s,f,e=t.element.find(".editorTreeView").find("li"),l=e.length,i=t._memberTreeObj.dataSource(),a=i.length,u=0;u<l;u++)for(h=n(e[u]).find("span:first").attr("aria-checked"),f=0;f<a;f++)if(e[u].id==i[f].id&&(h=="mixed"||h=="true")){i[f].checkedStatus=!0;break}else if(e[u].id==i[f].id&&h=="false"){i[f].checkedStatus=!1;break}for(u=0;u<i.length;u++)if(c=!1,i[u].checkedStatus==!0){for(f=0;f<i.length;f++)if(i[f].hasOwnProperty("parentId")&&i[f].parentId==i[u].id&&i[f].checkedStatus==!0){c=!0;break}if(!c)for(o=0;o<i.length;o++)i[o].hasOwnProperty("parentId")&&i[o].parentId==i[u].id&&(i[o].checkedStatus=!0)}else if(i[u].checkedStatus==!1)for(s=0;s<i.length;s++)i[s].hasOwnProperty("parentId")&&i[s].parentId==i[u].id&&(i[s].checkedStatus=!1);for(u=0;u<l;u++)if(n(e[u]).attr("tag")==null||r)for(f=0;f<a;f++)if(n(e[u]).attr("id")==i[f].id){n(e[u]).attr("tag",i[f].tag);break}return t._memberTreeObj},getNodesState:function(n){for(var r="",u="",i=[],i=n.pluginName=="ejTreeView"?n.dataSource():n,t=0;t<i.length;t++)i[t].checkedStatus==!0?r+="::"+i[t].id+"||"+i[t].tag+"||"+i[t].parentId+"||"+i[t].name:u+="::"+i[t].parentId+"||"+i[t].tag+"||"+i[t].name;return{selectedNodes:r,unSelectedNodes:u}},removeParentSelectedNodes:function(t){for(var i,u=n.extend([],t),f=0;f<t.length;f++)for(i=0;i<u.length;i++)u[i].Id==t[f].parentId&&u.splice(i,1);return n.map(u,function(n){if(n.tag!=""&&n.tag!=r)return n.tag.replace(/\&/g,"&")})},getChildNodes:function(i,u,f,e,o){var s=i.targetElement,p=e.cube,w=e.catalog,b=e.data,k=o._generateChildMembers,v=n(i.currentElement).find("li").length,h=!1,c,a;if(v==0){var y=t.buildTag("span.nodeExpand e-load e-icon")[0].outerHTML,l=n(s).parents("li:eq(0)").attr("id"),d=n.map(f,function(i){if(i.fieldName==u&&!t.isNullOrUndefined(i.filterItems)){var f=i.filterItems;(t.isNullOrUndefined(o.model.pivotControl)?o.model.enableMemberEditorPaging:o.model.pivotControl.model.enableMemberEditorPaging)?(f=n.map(f,function(n){if(n.pid!=r&&n.pid==l.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"))return h=!0,n}),f.length>0&&h==!0&&(n(s).parents("li:eq(0)").find(".nodeExpand").remove(),n(s).parents("li:eq(0)").find(".e-load").removeClass("e-load"),n.each(f,function(n,t){delete t.parentId}),o._memberTreeObj.addNode(f,n(s).parents("li:eq(0)")),n.each(n(s).parents("li:eq(0)").find("li"),function(n,t){t.setAttribute("tag",f[n].tag)}))):n.map(f,function(n){n.parentId!=r&&n.parentId==l.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-")&&(h=!0)})}});i.isChildLoaded=h?!0:!1;h||(n(s).parents("li:eq(0)").prepend(y),n(s).parents("li:eq(0)").attr("tag")==r&&(c=n.map(f,function(n){if(n.fieldName==u)return n})[0],c&&n.map(c.filterItems,function(t){t.id==n(s).parents("li:eq(0)").attr("id")&&n(s).parents("li:eq(0)").attr("tag",t.tag)})),a=n(s).parents("li:eq(0)").attr("tag").replace(/\&/g,"&"),t.olap._mdxParser.getChildren(e,a,o))}},_getFilterParams:function(n,i,r){var o="",f,u,e;if(n!="schemaValue"){if(f="",!t.isNullOrUndefined(i))for(u=0;u<i.length;u++)if(!t.isNullOrUndefined(i[u][r]))for(e=0;e<i[u][r].length;e++)f+="##"+i[u][r][e];f!=""&&(o=n+"::"+r+"::FILTERED"+f)}return o},generateChildMembers:function(i,r){for(var h,c,o=n(r).find("Axis:eq(0) Tuple"),f=[],u=n("[tag='"+i.currentNode.replace(/&/g,"&")+"']"),e=0;e<o.length;e++){var s=n(n(r).find("Axis:eq(0) Tuple:eq("+e+")").children().children()[0]).text(),l=n(n(r).find("Axis:eq(0) Tuple:eq("+e+")").children()).find("Caption").text()==""?"(Blank)":n(n(r).find("Axis:eq(0) Tuple:eq("+e+")").children()).find("Caption").text(),a={hasChildren:n(o[e]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!1,id:s.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:l,tag:s};f.push(a)}parentNode=n(u).parents("li").length>1?n(u).parents("li").first():n(u).parents("li");n(n(parentNode).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});this._memberTreeObj=n(".editorTreeView").data("ejTreeView");f.length>0&&!t.isNullOrUndefined(this.model)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.enableMemberEditorPaging&&(h=this._selectedFieldName,c=this.model.pivotControl,n.map(this.model.pivotControl._currentReportItems,function(i){i.fieldName!=h||t.isNullOrUndefined(i.filterItems)||(n.each(f,function(t,i){i.pid=n(u).attr("id")}),n.merge(i.filterItems,f),c._editorTreeData=i.filterItems)}));u.find(".nodeExpand").remove();u.find(".e-load").removeClass("e-load");this._memberTreeObj.addNode(f,n(u));n.each(u.find("li"),function(n,t){t.setAttribute("tag",f[n].tag)})},createAdvanceFilterTag:function(r,u){var f="",k=t.buildTag("li.e-separator").css("margin-left","29px")[0].outerHTML,o=u.element.hasClass("e-pivotschemadesigner")?u.model.pivotControl.model.operationalMode:u.model.operationalMode,b=u.element.hasClass("e-pivotschemadesigner")?u.model.pivotControl.model.analysisMode:u.model.analysisMode,h,c,s,a,v,e,y,l,p,w;if(r.action=="filterTag")f=[{id:"ascOrder",text:u._getLocalizedLabels("SortAtoZ"),parentId:null,spriteCssClass:"ascImage e-icon"},{id:"descOrder",text:u._getLocalizedLabels("SortZtoA"),parentId:null,spriteCssClass:"descImage e-icon"},{id:"clearSorting",text:u._getLocalizedLabels("ClearSorting"),parentId:null,spriteCssClass:"e-clrSort e-icon"},{id:"sep",parentId:null,text:"",spriteCssClass:"e-seperator"},{id:"clearAllFilters",text:u._getLocalizedLabels("ClearFilterFrom"),parentId:null,spriteCssClass:"e-clrFilter e-icon"},{id:"labelFilterBtn",text:u._getLocalizedLabels("LabelFilters"),parentId:null},{id:"valueFilterBtn",text:u._getLocalizedLabels("ValueFilters"),parentId:null},{id:"labelClearFilter",parentId:"labelFilterBtn",text:u._getLocalizedLabels("ClearFilter"),spriteCssClass:"e-clrFilter e-icon"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"equals",parentId:"labelFilterBtn",text:u._getLocalizedLabels("Equals"),spriteCssClass:"sprite"},{id:"notequals",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotEquals")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"beginswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("BeginsWith")+"...",spriteCssClass:"sprite"},{id:"notbeginswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotBeginsWith")+"...",spriteCssClass:"sprite"},{id:"endswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("EndsWith")+"...",spriteCssClass:"sprite"},{id:"notendswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotEndsWith")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"contains",parentId:"labelFilterBtn",text:u._getLocalizedLabels("Contains")+"...",spriteCssClass:"sprite"},{id:"notcontains",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotContains")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"greaterthan",parentId:"labelFilterBtn",text:u._getLocalizedLabels("GreaterThan")+"...",spriteCssClass:"sprite"},{id:"greaterthanorequalto",parentId:"labelFilterBtn",text:u._getLocalizedLabels("GreaterThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"lessthan",parentId:"labelFilterBtn",text:u._getLocalizedLabels("LessThan")+"...",spriteCssClass:"sprite"},{id:"lessthanorequalto",parentId:"labelFilterBtn",text:u._getLocalizedLabels("LessThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"valueClearFilter",parentId:"valueFilterBtn",text:u._getLocalizedLabels("ClearFilter"),spriteCssClass:"e-clrFilter e-icon"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"equals",parentId:"valueFilterBtn",text:u._getLocalizedLabels("Equals"),spriteCssClass:"equals"},{id:"notequals",parentId:"valueFilterBtn",text:u._getLocalizedLabels("DoesNotEquals")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"greaterthan",parentId:"valueFilterBtn",text:u._getLocalizedLabels("GreaterThan")+"...",spriteCssClass:"sprite"},{id:"greaterthanorequalto",parentId:"valueFilterBtn",text:u._getLocalizedLabels("GreaterThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"lessthan",parentId:"valueFilterBtn",text:u._getLocalizedLabels("LessThan")+"...",spriteCssClass:"sprite"},{id:"lessthanorequalto",parentId:"valueFilterBtn",text:u._getLocalizedLabels("LessThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"between",parentId:"valueFilterBtn",text:u._getLocalizedLabels("Between")+"...",spriteCssClass:"sprite"},{id:"notbetween",parentId:"valueFilterBtn",text:u._getLocalizedLabels("NotBetween")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"topCount",parentId:"valueFilterBtn",text:u._getLocalizedLabels("Top10")+"...",spriteCssClass:"sprite"}],o==t.Pivot.OperationalMode.ClientMode||o==t.Pivot.OperationalMode.ServerMode&&b==t.Pivot.AnalysisMode.Pivot?f.splice(f.length-1,2):f.splice(0,5);else if(r.action=="clearFilter")f=t.buildTag("div.clearSorting",t.buildTag("span.e-clrSort","",{padding:"0px 10px 0px 4px"}).addClass("e-icon").attr("aria-label","clear sort")[0].outerHTML+t.buildTag("span.clearSortText","Clear Sorting",{padding:"5px 0px"})[0].outerHTML)[0].outerHTML+t.buildTag("div.separator",{padding:"5px 0px"})[0].outerHTML+t.buildTag("div.clearAllFilters",t.buildTag("span.e-clrFilter","",{padding:"0px 10px 0px 4px"}).addClass("e-icon").attr("aria-label"," clear filter")[0].outerHTML+t.buildTag("span.clearFltrText",'Clear Filter From"'+r.selectedLevel.text+'"',{padding:"5px 0px"})[0].outerHTML)[0].outerHTML;else if(r.action=="sort")f=t.buildTag("div#sortDiv.sortDiv",t.buildTag("li#ascOrder.ascOrder",t.buildTag("span.ascImage").addClass("e-icon").attr("aria-label","ascending")[0].outerHTML+u._getLocalizedLabels("Sort")+" A to Z")[0].outerHTML+t.buildTag("li#descOrder.descOrder",t.buildTag("span.descImage").addClass("e-icon").attr("aria-label","descending")[0].outerHTML+u._getLocalizedLabels("Sort")+" Z to A")[0].outerHTML)[0].outerHTML;else if(r.action=="labelFilterDlg"||r.action=="valueFilterDlg"){if(h="",c=[],r.action=="labelFilterDlg")h=t.buildTag("table.labelfilter",t.buildTag("tr",t.buildTag("td",u._getLocalizedLabels("LabelFilterLabel")).attr("colspan","2")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","<input type='text' id='filterOptions' class='filterOptions' style='width:220px'/>")[0].outerHTML+t.buildTag("td.filterValuesTd","<input type='text' id='filterValue1' value='"+(r.filterInfo.length>0?o==t.Pivot.OperationalMode.ClientMode?r.filterInfo[0].values[0]:r.filterInfo[0].value1:"")+"' style='display:inline; width:160px; height:19px; margin-left:7px;' class='filterValues'/><\/br>")[0].outerHTML)[0].outerHTML)[0].outerHTML,c=[{value:"equals",option:u._getLocalizedLabels("Equals").toLowerCase()},{value:"not equals",option:u._getLocalizedLabels("DoesNotEquals").toLowerCase()},{value:"begins with",option:u._getLocalizedLabels("BeginsWith").toLowerCase()},{value:"not begins with",option:u._getLocalizedLabels("DoesNotBeginsWith").toLowerCase()},{value:"ends with",option:u._getLocalizedLabels("EndsWith").toLowerCase()},{value:"not ends with",option:u._getLocalizedLabels("DoesNotEndsWith").toLowerCase()},{value:"contains",option:u._getLocalizedLabels("Contains").toLowerCase()},{value:"not contains",option:u._getLocalizedLabels("DoesNotContains").toLowerCase()},{value:"greater than",option:u._getLocalizedLabels("IsGreaterThan").toLowerCase()},{value:"greater than or equal to",option:u._getLocalizedLabels("IsGreaterThanOrEqualTo").toLowerCase()},{value:"less than",option:u._getLocalizedLabels("IsLessThan").toLowerCase()},{value:"less than or equal to",option:u._getLocalizedLabels("IsLessThanOrEqualTo").toLowerCase()},];else{if(s=[],v=n(r.selectedArgs.element).attr("id")=="between"||n(r.selectedArgs.element).attr("id")=="notbetween"||r.selectedArgs.value=="between"||r.selectedArgs.value=="not between"?"4":"3",u.element.find(".cubeTreeView ").length>0)s=n.map(u.element.find(".cubeTreeView [tag*='[Measures]'] "),function(t){return{option:n(t).text(),value:n(t).attr("tag")}});else for(e=u.element.hasClass("e-pivotschemadesigner")?u.element.find(".schemaValue .pivotButton"):u.element.find(".groupingBarPivot .values .pivotButton"),e=u._schemaData&&e.length==0?n(u._schemaData.element.find(".schemaValue .pivotButton")):e,i=0;i<e.length;i++)s.push({option:n(e[i]).text(),value:n(e[i]).attr("tag").split(":")[1]});a=n(r.selectedArgs.element).hasClass("topCount")?t.buildTag("td","<input type='text' id='filterOptions' class='filterOptions' />").attr("width","80px")[0].outerHTML+t.buildTag("td","<input type='text' id='filterValue1' class='filterValues' />").attr("width","50px")[0].outerHTML+t.buildTag("td","<input type='text' id='filterMeasures' class='filterMeasures' />").attr("width","180px")[0].outerHTML:t.buildTag("td","<input type='text' id='filterMeasures' class='filterMeasures' />").attr("width","180px")[0].outerHTML+t.buildTag("td","<input type='text' id='filterOptions' class='filterOptions'/>").attr("width","180px")[0].outerHTML+t.buildTag("td.filterValuesTd","<input type='text' id='filterValue1' value='"+(r.filterInfo.length>0?o==t.Pivot.OperationalMode.ClientMode?r.filterInfo[0].values[0]:r.filterInfo[0].value1:"")+"' style='display:inline; width:190px; height:19px;' class='filterValues'/>"+(v=="4"?"<span>"+u._getLocalizedLabels("and")+" <\/span><input type='text' id='filterValue2' value='"+(r.filterInfo.length>0?o==t.Pivot.OperationalMode.ClientMode&&!t.isNullOrUndefined(r.filterInfo[0].values[1])?r.filterInfo[0].values[1]:o==t.Pivot.OperationalMode.ServerMode&&!t.isNullOrUndefined(r.filterInfo[0].value2)?r.filterInfo[0].value2:"":"")+"' style='display:inline; width:190px; height:19px;' class='filterValues'/> <\/br>":"<\/br>"))[0].outerHTML;h=t.buildTag("table.valuefilter",t.buildTag("tr",t.buildTag("td",u._getLocalizedLabels("ValueFilterLabel")).attr("colspan",r.text=="Between"?"4":"3")[0].outerHTML)[0].outerHTML+t.buildTag("tr",a)[0].outerHTML)[0].outerHTML;c=[{value:"equals",option:u._getLocalizedLabels("Equals").toLowerCase()},{value:"not equals",option:u._getLocalizedLabels("DoesNotEquals").toLowerCase()},{value:"greater than",option:u._getLocalizedLabels("IsGreaterThan").toLowerCase()},{value:"greater than or equal to",option:u._getLocalizedLabels("IsGreaterThanOrEqualTo").toLowerCase()},{value:"less than",option:u._getLocalizedLabels("IsLessThan").toLowerCase()},{value:"less than or equal to",option:u._getLocalizedLabels("IsLessThanOrEqualTo").toLowerCase()},{value:"between",option:u._getLocalizedLabels("Between").toLowerCase()},{value:"not between",option:u._getLocalizedLabels("NotBetween").toLowerCase()}]}y=t.buildTag("div",t.buildTag("button#filterDlgOKBtn.dialogOKBtn","OK")[0].outerHTML+t.buildTag("button#filterDlgCancelBtn.dialogCancelBtn","Cancel")[0].outerHTML,{float:u.model.enableRTL?"left":"right",margin:"8px 0 6px"})[0].outerHTML;u.element.find(".e-dialog").remove();n(t.buildTag("div#filterDialog.filterDialog",h+y,{opacity:"1"})).appendTo("#"+u._id);u.element.find(".filterDialog").ejDialog({enableRTL:u.model.enableRTL,enableResize:!1,cssClass:"labelValueFilterDlg",width:"auto",content:"#"+u._id,close:t.proxy(t.Pivot.closePreventPanel,u)});r.action=="valueFilterDlg"&&(u.element.find(".filterMeasures").ejDropDownList({dataSource:s,width:"180px",height:"25px",fields:{text:"option",value:"value"},create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),u._measureDDL=u.element.find(".filterMeasures").data("ejDropDownList"),l=s.length>0?s[0].value:r.filterInfo.length>0?r.filterInfo[0].measure:"",l!=""&&u._measureDDL.selectItemByValue(l));n(r.selectedArgs.element).attr("id")=="topCount"?(u.element.find("#filterOptions").ejDropDownList({dataSource:[{option:"Top",value:"topCount"},{option:"Bottom",value:"BottomCount"}],fields:{text:"option",value:"value"},value:r.filterInfo.length>0?r.filterInfo[0].operator:"topCount",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),u.element.find("#filterValue1").ejNumericTextbox({value:r.filterInfo.length>0?parseInt(r.filterInfo[0].value1):5,minValue:1})):(p=n(r.selectedArgs.element).parent().children("li:not(#sep)").index(r.selectedArgs.element),u.element.find(".filterOptions").ejDropDownList({dataSource:c,width:"180px",height:"25px",fields:{value:"value",text:"option"},selectedIndices:[p-1],change:t.proxy(u._filterOptionChanged,u),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(r.selectedArgs.element).length==0&&(w=u.element.find(".filterOptions").data("ejDropDownList"),w.selectItemByValue(r.selectedArgs.selectedValue)));u.element.find("#filterDlgOKBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(u._filterElementOkBtnClick,u)});u.element.find("#filterDlgCancelBtn").ejButton({type:t.ButtonType.Button,click:function(){n(".e-dialog").hide();t.Pivot.closePreventPanel(u)}});u.element.find(".e-titlebar").prepend(t.buildTag("div",(r.action=="valueFilterDlg"?u._getLocalizedLabels("ValueFilters")+"(":u._getLocalizedLabels("LabelFilters")+"(")+(u._selectedLevelUniqueName.indexOf(".")==-1?u._selectedLevelUniqueName:u._selectedLevelUniqueName.indexOf(".")<0?u._selectedLevelUniqueName:u._selectedLevelUniqueName.split(".")[2].replace(/\[/g,"").replace(/\]/g,""))+")",{display:"inline"}))}return f}};t.Pivot.SortOrder={None:"none",Ascending:"ascending",Descending:"descending"};t.Pivot.AdvancedFilterType={LabelFilter:"label",ValueFilter:"value"};t.Pivot.ValueFilterOptions={None:"none",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.Pivot.LabelFilterOptions={None:"none",BeginsWith:"beginswith",NotBeginsWith:"notbeginswith",EndsWith:"endswith",NotEndsWith:"notendswith",Contains:"contains",NotContains:"notcontains",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.Pivot.AnalysisMode={Olap:"olap",Pivot:"pivot"};t.Pivot.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"}}(jQuery,Syncfusion),function(n,t,r){t.olap=t.olap||{};t.widget("ejPivotGrid","ej.PivotGrid",{_rootCSS:"e-pivotgrid",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:{url:"",cssClass:"",jsonRecords:"",currentReport:"",layout:"normal",analysisMode:"olap",operationalMode:"clientmode",filterType:"filterType",enablePivotFieldList:!0,enableGroupingBar:!1,enableDeferUpdate:!1,enableJSONRendering:!1,enableVirtualScrolling:!1,enablePaging:!1,enableColumnResizing:!1,enableContextMenu:!1,enableCellContext:!1,enableRTL:!1,enableToolTip:!0,enableToolTipAnimation:!0,enableCellSelection:!1,enableConditionalFormatting:!1,enableCellEditing:!1,enableColumnGrandTotal:!0,enableRowGrandTotal:!0,enableGrandTotal:!0,enableCollapseByDefault:!1,enableCellDoubleClick:!1,enableDrillThrough:!1,isResponsive:!1,enableAdvancedFilter:!1,showUniqueNameOnPivotButton:!1,editCellsInfo:{},hyperlinkSettings:{enableValueCellHyperlink:!1,enableRowHeaderHyperlink:!1,enableColumnHeaderHyperlink:!1,enableSummaryCellHyperlink:!1},headerSettings:{showRowItems:!1,showColumnItems:!1},frozenHeaderSettings:{enableFrozenRowHeaders:!1,enableFrozenColumnHeaders:!1,enableFrozenHeaders:!1,scrollerSize:18},valueSortSettings:{headerText:"",headerDelimiters:"##",sortOrder:t.PivotAnalysis.SortOrder.None},serviceMethodSettings:{initialize:"InitializeGrid",drillDown:"DrillGrid",exportPivotGrid:"Export",paging:"Paging",fetchMembers:"FetchMembers",nodeStateModified:"NodeStateModified",nodeDropped:"NodeDropped",filtering:"Filtering",sorting:"Sorting",valueSorting:"ValueSorting",deferUpdate:"DeferUpdate",memberExpand:"MemberExpanded",writeBack:"WriteBack",cellEditing:"CellEditing",saveReport:"SaveReport",loadReport:"LoadReportFromDB",calculatedField:"CalculatedField",drillThroughHierarchies:"DrillThroughHierarchies",drillThroughDataTable:"DrillThroughDataTable",removeButton:"RemoveButton"},customObject:{},locale:"en-US",dataSource:{data:null,sourceInfo:"",providerName:"ssas",enableAdvancedFilter:!1,isFormattedValues:!1,reportName:"Default",columns:[],cube:"",catalog:"",rows:[],values:[],filters:[],pagerOptions:{categoricalPageSize:0,seriesPageSize:0,categoricalCurrentPage:0,seriesCurrentPage:0}},pivotTableFieldListID:"",collapsedMembers:null,cellSelection:null,valueCellHyperlinkClick:null,rowHeaderHyperlinkClick:null,columnHeaderHyperlinkClick:null,summaryCellHyperlinkClick:null,beforeServiceInvoke:null,afterServiceInvoke:null,drillThrough:null,drillSuccess:null,cellContext:null,load:null,renderComplete:null,renderFailure:null,renderSuccess:null,cellDoubleClick:null,applyFieldCaption:null,beforeExport:null,beforePivotEnginePopulate:null,saveReport:null,loadReport:null,cellEdit:null},dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum",drillDown:"enum",exportPivotGrid:"enum",paging:"enum",fetchMembers:"enum",nodeStateModified:"enum",nodeDropped:"enum",filtering:"enum",sorting:"enum",deferUpdate:"enum",memberExpand:"enum",writeBack:"enum",cellEditing:"enum",saveReport:"enum",loadReport:"enum",calculatedField:"enum",drillThroughHierarchies:"enum",drillThroughDataTable:"enum",removeButton:"enum"},customObject:"data"},observables:["layout","enableCellContext","hyperlinkSettings.enableValueCellHyperlink","hyperlinkSettings.enableRowHeaderHyperlink","hyperlinkSettings.enableColumnHeaderHyperlink","hyperlinkSettings.enableSummaryCellHyperlink"],layout:t.util.valueFunction("layout"),enableCellContext:t.util.valueFunction("enableCellContext"),enableValueCellHyperlink:t.util.valueFunction("hyperlinkSettings.enableValueCellHyperlink"),enableRowHeaderHyperlink:t.util.valueFunction("hyperlinkSettings.enableRowHeaderHyperlink"),enableColumnHeaderHyperlink:t.util.valueFunction("hyperlinkSettings.enableColumnHeaderHyperlink"),enableSummaryCellHyperlink:t.util.valueFunction("hyperlinkSettings.enableSummaryCellHyperlink"),locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(t){this._JSONRecords=n.parseJSON(t)},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){n(this.element).next().length>0&&n(this.element).next()[0].className=="pGridTooltip"&&n(this.element).next().remove();this.element.empty().removeClass("e-pivotgrid"+this.model.cssClass);this._waitingPopup!=r&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._excelLikeJSONRecords=null;this._drillCaption="";this._drillAction="";this._startDrilldown=!1;this._pagerObj=null;this._seriesPageCount=null;this._categPageCount=null;this._seriesCurrentPage=1;this._categCurrentPage=1;this._drillHeaders=[];this._collapsedRowHeaders=[];this._isDragging=!1;this._droppedClass="";this._dataModel="";this._ascdes="";this._filterUpdate=[];this._pivotRow=[];this._pivotColumn=[];this._pivotCalculation=[];this._pivotFilter=[];this._pivotTableFields=[];this._schemaData=null;this._waitingPopup=null;this._oriX=null;this._oriY=null;this._startPosCell=null;this._maxViewLoading=null;this._list=[];this._list.push(this._getLocalizedLabels("AddNew"));this._rowCount=0;this._excelRowCount=0;this._dialogTitle="";this._selectedField="";this._selectedAxis="";this._isUpdateRequired=!1;this._isMembersFiltered=!1;this._selectedCell=null;this._onholdKey="";this._primaryCellPos="";this._currentReportItems=[];this._rowHeader=[];this._colHeader=[];this._cellInfo=[];this._editorFlag=!0;this._isSubTotalHide=!1;this._isSubTotalhidden=!1;this._dimension;this._calculatedField=[];this._isFormatApply=!1;this._cFormat=[];this._curFocus={cell:null,tab:null,tree:null,cformat:null,grp:null,selection:null,filter:null,field:null,formula:null};this._index={index:0,grp:1,cell:1,dialog:1,paging:1,cformat:1,filter:0,field:0,formula:0};this._dataSet=[];this._currentCell=-1;this._target=null;this._orgX=null;this._orgY=null;this._expand=!1;this._excelFilterInfo=[];this._pagingSavedObjects={drillEngine:[],savedHdrEngine:[],curDrilledItem:{}};this._isSchemaInitialize=!0;this._fieldMembers={};this._fieldSelectedMembers={};this._allMember="";this._selectedMeasure="";this._selectedFormat="";this._dialogName="";this._pivotClientObj=null},_load:function(){var r={element:this.element,customObject:this.model.customObject},i;(this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter)&&(this.model.dataSource.enableAdvancedFilter=this.model.enableAdvancedFilter=!0);this.model.enableCellEditing&&this.model.enableCellSelection&&(this.model.enableCellSelection=!1);this._trigger("load",r);this.element.addClass(this.model.cssClass);n(this.element).parents(".e-pivotclient").length>0?(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+this._pivotClientObj._id+"_maxView")[0]&&n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}),t.isNullOrUndefined(this._waitingPopup)&&!t.isNullOrUndefined(this._pivotClientObj._waitingPopup)&&(this._waitingPopup=this._pivotClientObj._waitingPopup),this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)&&(n("#"+this._id).ejWaitingPopup({showOnInit:!0}),this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"));this._waitingPopup.show();this.model.enableJSONRendering?(this.setJSONRecords(this.model.jsonRecords),this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.excelLikeLayout(this.getJSONRecords()):this.renderControlFromJSON()):t.isNullOrUndefined(this.model.dataSource.data)&&this.model.url==""&&!t.isNullOrUndefined(this._pivotClientObj)?(this.renderControlFromJSON(),this._waitingPopup.hide()):this.model.dataSource.data==null&&this.model.url!=""||this.model.dataSource.data!=null&&this.model.url!=""&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(this.model.operationalMode=t.Pivot.OperationalMode.ServerMode,t.isNullOrUndefined(this.model.beforeServiceInvoke)||this._trigger("beforeServiceInvoke",{action:"initialize",element:this.element,customObject:this.model.customObject}),i=JSON.stringify(this.model.customObject),this.model.enableVirtualScrolling&&(this.model.layout=t.PivotGrid.Layout.NoSummaries),this.element[0]!=null&&this.element.parents().find(".controlPanel").length>0&&this.layout()!=""&&this.layout()!=t.PivotGrid.Layout.Normal?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initializeGrid",currentReport:this.model.currentReport,gridLayout:this.layout(),customObject:i}),this._renderControlSuccess):this.element[0]!=null&&this.element.parents().find(".controlPanel").length>0?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:this.model.enableCellDoubleClick||this.model.enableDrillThrough?"initializeGrid:getDataSet":"initializeGrid",currentReport:this.model.currentReport,customObject:i}),this._renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:this.model.enableCellDoubleClick||this.model.enableDrillThrough?"initializeGrid:getDataSet":"initializeGrid",gridLayout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:i}),this._renderControlSuccess)):(this.model.operationalMode=t.Pivot.OperationalMode.ClientMode,this.model.dataSource.cube!=""?(this.model.analysisMode=t.Pivot.AnalysisMode.Olap,this._trigger("beforePivotEnginePopulate",{pivotGridObj:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)):this.model.dataSource.data!=null&&(this.model.analysisMode=t.Pivot.AnalysisMode.Pivot,t.PivotAnalysis.setFieldCaptions(this.model.dataSource),this._populatePivotGrid()))},refreshControl:function(){if(t.Pivot.openPreventPanel(this),this._trigger("beforePivotEnginePopulate",{pivotObject:this}),this.model.enableGroupingBar&&this._createGroupingBar(this.model.dataSource),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){var n=t.PivotAnalysis.pivotEnginePopulate(this.model);this.setJSONRecords(JSON.stringify(n.json));this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.excelLikeLayout(n.json):this.renderControlFromJSON(n.json);this._trigger("renderSuccess",this)}else t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)},_setCaptions:function(){n.each(this.model.dataSource.rows,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)});n.each(this.model.dataSource.columns,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)});n.each(this.model.dataSource.filters,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)});n.each(this.model.dataSource.values,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)})},refreshFieldCaption:function(n,t,i){var r;if(i.indexOf("row")>=0)for(r=0;r<this.model.dataSource.rows.length;r++)n==this.model.dataSource.rows[r].fieldName&&(this.model.dataSource.rows[r].fieldCaption=t);else if(i.indexOf("calc")>=0)for(r=0;r<this.model.dataSource.values.length;r++)n==this.model.dataSource.values[r].fieldName&&(this.model.dataSource.values[r].fieldCaption=t);else if(i.indexOf("col")>=0)for(r=0;r<this.model.dataSource.columns.length;r++)n==this.model.dataSource.columns[r].fieldName&&(this.model.dataSource.columns[r].fieldCaption=t);else for(r=0;r<this.model.dataSource.filters.length;r++)n==this.model.dataSource.filters[r].fieldName&&(this.model.dataSource.filters[r].fieldCaption=t);for(r=0;r<this._pivotTableFields.length;r++)n==this._pivotTableFields[r].name&&(this._pivotTableFields[r].caption=t)},refreshPivotGrid:function(){this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this.getOlapReport()&&(this.model.dataSource.rows&&(this.model.dataSource.rows=this.getOlapReport().rows),this.model.dataSource.columns&&(this.model.dataSource.columns=this.getOlapReport().columns),this.model.dataSource.filters&&(this.model.dataSource.filters=this.getOlapReport().filters),this.model.dataSource.values&&(this.model.dataSource.values=this.getOlapReport().values)),this.model.editCellsInfo={},this._populatePivotGrid()):(this._trigger("beforePivotEnginePopulate",{olapObject:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)):this._load()},_populatePivotGrid:function(){var f,u,r,i,e;for(this._trigger("beforePivotEnginePopulate",{pivotObject:this}),f=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,u=n.grep(this.model.dataSource.values,function(n){return n.isCalculatedField==!0}),this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1}),r=0;r<u.length;r++)i=u[r].formula,n.grep(this._calculatedField,function(n){return n.name==u[r].fieldName}).length==0&&(i=i.replace(/\s+|\s+$/gm,""),i=this._parenthesisAsterisk(i),i=i.replace(/[-+/^%*]/g,function(n){return" "+n+" "}),this._calculatedField.push({name:u[r].fieldName,formula:i})),u[r].formula=i,this.model.dataSource.values.push(u[r]);e=t.PivotAnalysis.pivotEnginePopulate(this.model);this.setJSONRecords(JSON.stringify(e.json));this.setOlapReport(this.model.dataSource);this._createGroupingBar(this.model.dataSource);this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.excelLikeLayout(e.json):this.renderControlFromJSON();t.isNullOrUndefined(f)||(f._isTimeOut=!1);this._waitingPopup.hide();this._trigger("renderSuccess",this);t.isNullOrUndefined(this._pivotClientObj)||typeof this._pivotClientObj._pivotSchemaDesigner=="undefined"||(this._schemaData=this._pivotClientObj._pivotSchemaDesigner);this._schemaData!=null&&(pschemaDesignerWaitingPopup.hide(),this._calculatedField.length>0&&this._schemaCalculatedField())},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"OlapReport":this.setOlapReport(n[t]);break;case"JsonData":this.setOlapReport(n[t]);break;case"RefreshOlapGrid":this.element.renderControlFromJSON(n[t]);break;case"layout":this._load();break;case"customObject":this.model.customObject=n[t];break;case"enableCellContext":this._load();break;case"enableValueCellHyperlink":this._load();break;case"enableRowHeaderHyperlink":this._load();break;case"enableColumnHeaderHyperlink":this._load();break;case"enableSummaryCellHyperlink":this._load();break;case"locale":this._load()}},_wireEvents:function(){if(this._on(this.element,"mouseover",".value,.rowheader,.colheader,.summary",t.proxy(function(t){var i,r,u;n(t.target).hasClass("cellValue")||n(t.target).children().hasClass("cellValue")||(i=n(t.target).contents().filter(function(){return this.nodeType==3}),i.text()!=0&&(r=n(t.target).find(".valueSorting").length>0?!0:!1,u=r?n(t.target).find(".valueSorting"):"",n(t.target).find(".valueSorting").remove(),n(t.target).contents().filter(function(){return this.nodeType==3}).remove(),n(t.target).append("<span class='cellValue'>"+i.text()+"<\/span>"),r&&(n(t.target).hasClass("colheader")||n(t.target).hasClass("summary"))&&n(t.target).hasClass("calc")&&!n(t.target).hasClass("rowheader")?n(t.target).append(u):""))})),this._on(this.element,"contextmenu",".value,.rowheader,.colheader,.summary",t.proxy(function(i){var o;if(this.model.enableContextMenu&&t.isNullOrUndefined(this._pivotClientObj)&&!this.model.enableCellContext){i.preventDefault();var r="",u="",f="",e="";e=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?"<li><a>"+this._getLocalizedLabels("Layouts")+"<\/a><ul><li id='normalLayout'><a>"+this._getLocalizedLabels("NormalLayout")+"<\/a><li><li id='excelLikeLayout'><a>"+this._getLocalizedLabels("ExcelLikeLayout")+"<\/a><li><\/ul><\/li>":this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?"<li><a>"+this._getLocalizedLabels("Layouts")+"<\/a><ul><li id='normalLayout'><a>"+this._getLocalizedLabels("NormalLayout")+"<\/a><li><li id='excelLikeLayout'><a>"+this._getLocalizedLabels("ExcelLikeLayout")+"<\/a><li><li id='noSummariesLayout'><a>"+this._getLocalizedLabels("NoSummaries")+"<\/a><li><\/ul><\/li>":"<li><a>"+this._getLocalizedLabels("Layouts")+"<\/a><ul><li id='normalLayout'><a>"+this._getLocalizedLabels("NormalLayout")+"<\/a><li><li id='excelLikeLayout'><a>"+this._getLocalizedLabels("ExcelLikeLayout")+"<\/a><li><li id='noSummariesLayout'><a>"+this._getLocalizedLabels("NoSummaries")+"<\/a><li><li id='normalTopSummaryLayout'><a>"+this._getLocalizedLabels("NormalTopSummary")+"<\/a><li><\/ul><\/li>";r=((this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.analysisMode==t.Pivot.AnalysisMode.Olap)&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)?"":t.buildTag("li.advancedFiltering",t.buildTag("a",this._getLocalizedLabels("AdvancedFiltering"))[0].outerHTML)[0].outerHTML;this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f=t.buildTag("li.collapseByDefault",t.buildTag("a",this._getLocalizedLabels("CollapseByDefault"))[0].outerHTML)[0].outerHTML);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(u=t.buildTag("li.numberFormatting",t.buildTag("a",this._getLocalizedLabels("NumberFormatting"))[0].outerHTML)[0].outerHTML);var s="<li><a>"+this._getLocalizedLabels("HyperLink")+"<\/a><ul><li id='rowHeader'><a>"+this._getLocalizedLabels("EnableRowHeaderHyperlink")+"<\/a><\/li><li id='columnHeader'><a>"+this._getLocalizedLabels("EnableColumnHeaderHyperlink")+"<\/a><\/li><li id='valueCell'><a>"+this._getLocalizedLabels("EnableValueCellHyperlink")+"<\/a><\/li><li id='summaryCell'><a>"+this._getLocalizedLabels("EnableSummaryCellHyperlink")+"<\/a><\/li><\/ul><\/li>",h="<li><a>"+this._getLocalizedLabels("Exporting")+"<\/a><ul><li id='excel'><a>"+this._getLocalizedLabels("Excel")+"<\/a><\/li><li id='word'><a>"+this._getLocalizedLabels("Word")+"<\/a><\/li><li id='pdf'><a>"+this._getLocalizedLabels("PDF")+"<\/a><\/li><li id='csv'><a>"+this._getLocalizedLabels("CSV")+"<\/a><\/li><\/ul><\/li>",c="<li class='e-separator'><a>"+this._getLocalizedLabels("FrozenHeader")+"<\/a><ul><li id='row'><a>"+this._getLocalizedLabels("Row")+"<\/a><\/li><li id='column'><a>"+this._getLocalizedLabels("Column")+"<\/a><\/li><\/ul><\/li>",l=t.buildTag("ul#"+this._id+"contextMenu.pivotGridContextMenu",t.buildTag("li.cellSelect",t.buildTag("a",this._getLocalizedLabels("CellSelection"))[0].outerHTML)[0].outerHTML+t.buildTag("li.columnResize",t.buildTag("a",this._getLocalizedLabels("ColumnResize"))[0].outerHTML)[0].outerHTML+t.buildTag("li.toolTip",t.buildTag("a",this._getLocalizedLabels("ToolTip"))[0].outerHTML)[0].outerHTML+f+r+t.buildTag("li.groupingBar",t.buildTag("a",this._getLocalizedLabels("GroupingBar"))[0].outerHTML)[0].outerHTML+(this.model.analysisMode=="pivot"?t.buildTag("li.cellEditing",t.buildTag("a",this._getLocalizedLabels("CellEditing"))[0].outerHTML)[0].outerHTML:"")+t.buildTag("li.drillThrough",t.buildTag("a",this._getLocalizedLabels("DrillThrough"))[0].outerHTML)[0].outerHTML+t.buildTag("li.rtl",t.buildTag("a",this._getLocalizedLabels("RTL"))[0].outerHTML)[0].outerHTML+e+s+h+c+t.buildTag("li.summaryCustomize",t.buildTag("a",this._getLocalizedLabels("SummaryCustomization"))[0].outerHTML)[0].outerHTML+t.buildTag("li.conditionalFormat",t.buildTag("a",this._getLocalizedLabels("ConditionalFormatting"),{})[0].outerHTML)[0].outerHTML+(this.model.analysisMode=="pivot"?t.buildTag("li.calculatedField",t.buildTag("a",this._getLocalizedLabels("CalculatedField"))[0].outerHTML)[0].outerHTML+u+(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?t.buildTag("li.summaryTypes",t.buildTag("a",this._getLocalizedLabels("SummaryTypes"),{})[0].outerHTML)[0].outerHTML:""):""))[0].outerHTML;n("#"+this._id).append(l);n("li.rtl").addClass("e-separator");o=this.element.find(".pivotGridTable");this.element.find("#"+this._id+"contextMenu").ejMenu({width:"200px",menuType:t.MenuType.ContextMenu,contextMenuTarget:o,enableRTL:this.model.enableRTL,click:t.proxy(this._contextMenuClick,this)});this._stateMaintenance()}})),this._on(n(document),"keydown",this._keyDownPress),this._on(n(document),"keyup",this._keyUpPress),this.model.enableCellSelection&&(this._on(this.element,"mousedown touchstart",".value",this._initCellSelection),this._on(this.element,"click",".colheader,.rowheader",this._headerClickCellSelection)),this.enableCellContext()==!0&&(document.addEventListener?(document.removeEventListener("contextmenu",this._cellContext,!1),document.addEventListener("contextmenu",this._cellContext,!1)):(document.detachEvent("oncontextmenu",this._cellContext),document.attachEvent("oncontextmenu",this._cellContext))),this._on(this.element,"mouseover",".pivotButton",t.proxy(function(i){this._isDragging&&(this.element.append(t.buildTag("span.dropIndicator dropIndicatorActive")[0].outerHTML),i.target.className.indexOf("pivotButton")>=0?this.element.find(".dropIndicator").css("top",n(i.target).position().top-20).css("left",n(i.target).position().left-3):this.element.find(".dropIndicator").css("top",n(i.target).parents(".pivotButton").position().top-20).css("left",n(i.target).parents(".pivotButton").position().left-3))},this)),this._on(this.element,"mouseleave",".pivotButton",t.proxy(function(){this._isDragging&&this.element.find(".dropIndicator").removeClass("dropIndicatorActive")},this)),this._on(this.element,"click","#preventDiv",t.proxy(function(){this.element.find(".e-dialog.advancedFilterDlg:visible").length>0&&(this.element.find(".e-dialog.advancedFilterDlg").hide(),this.element.find("#preventDiv").remove())},this)),this.model.enableCellEditing&&this._on(this.element,"mousedown",".value",this._initCellEditing),this.drillDownHandler=n.proxy(this._drillDown,this),this.addHyperlinkHandler=n.proxy(this._addHyperlink,this),this.removeHyperlinkHandler=n.proxy(this._removeHyperlink,this),this.model.enableCellSelection){n(document).on("click",this._clearSelection);n(document).on("keyup",this._endCellSelection);n(document).on("keydown",this._startCellSelection)}this._on(this.element,"mouseover",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value .cellValue, .rowheader .cellValue, .colheader .cellValue":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue",this.addHyperlinkHandler);this._on(this.element,"mouseleave",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue",this.removeHyperlinkHandler);this._on(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value .cellValue, .rowheader .cellValue, .colheader .cellValue":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue",function(i){if(i.target.className.indexOf("hyperlink")!=-1){var r=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?n(i.target.parentElement).attr("i"):n(i.target.parentElement).attr("p"),f=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this._excelLikeJSONRecords[parseInt(parseInt(r.split(",")[0])*this._rowCount+parseInt(r.split(",")[1]))].Info:this.getJSONRecords()[parseInt(parseInt(r.split(",")[0])*this._excelRowCount+parseInt(r.split(",")[1]))].Info,u={cellValue:i.target.innerHTML,cellPosition:r,cellType:i.target.parentElement.className.split(" ")[0],uniqueName:f.split("::")[0],args:i,rawdata:f};this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&i.target.parentElement.className.indexOf("summary")>=0||i.target.parentElement.className.indexOf("summary value")>=0?this._trigger("summaryCellHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u}):i.target.parentElement.className.indexOf("value")>=0?this._trigger("valueCellHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u}):i.target.parentElement.className.indexOf("rowheader")>=0?this._trigger("rowHeaderHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u}):i.target.parentElement.className.indexOf("colheader")>=0&&this._trigger("columnHeaderHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u});i.target.parentElement.className.indexOf("value")>=0&&this.model.enableDrillThrough&&(this._rowHeader=[],this._colHeader=[],this.model.analysisMode==t.Pivot.AnalysisMode.Olap?t.Pivot._drillThroughCellClick(i,this):this._cellRangeInfo(i))}});this._on(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?".rowheader, .colheader, .summary":".rowheader, .colheader",function(i){var r,e,s,o,h,u,c,f;if(this.model.enableCellSelection&&!(n(i.target).hasClass("cellValue")&&n(i.target).hasClass("hyperlinkHeaderCell")))if(r=n(i.target).hasClass("cellValue")?i.target.parentElement:i.target,i.shiftKey){if(window.getSelection().removeAllRanges(),n(this.element).find(".selected").removeClass("selected"),e=n(this._selectedCell).attr("p"),s=n(r).attr("p"),(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader")&&(n(this._selectedCell).hasClass("rowheader")||n(this._selectedCell).attr("role")=="rowheader"))for(u=Math.min(e.split(",")[1],s.split(",")[1]);u<=Math.max(e.split(",")[1],s.split(",")[1]);u++)this.element.find("[p='"+e.split(",")[0]+","+u+"']").addClass("selected");if((n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(n(this._selectedCell).hasClass("colheader")||n(this._selectedCell).attr("role")=="columnheader"))for(u=Math.min(e.split(",")[0],s.split(",")[0]);u<=Math.max(e.split(",")[0],s.split(",")[0]);u++)this.element.find("[p='"+u+","+e.split(",")[1]+"']").addClass("selected");if(o=n(this.element).find(".selected"),o.length>0){for(h=[],u=0;u<o.length;u++)c=n(o[u]).attr("p"),f=this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))],f.Value=n(o[u]).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f.Field=this._getFieldName(o[u])),h.push(f);this._trigger("cellSelection",{JSONRecords:h})}}else i.ctrlKey||n(this.element).find(".selected").removeClass("selected"),(n(r).hasClass("colheader")||n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).attr("role")=="columnheader")&&(i.ctrlKey?n(r).toggleClass("selected"):n(r).addClass("selected"),this._selectedCell=r,this._primaryCellPos=n(r).attr("p"),f=this.getJSONRecords()[parseInt(parseInt(this._primaryCellPos.split(",")[0])*this._rowCount+parseInt(this._primaryCellPos.split(",")[1]))],f.Value=n(r).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f.Field=this._getFieldName(r)),i.ctrlKey||this._trigger("cellSelection",{JSONRecords:[f]}))});t.isNullOrUndefined(this._pivotClientObj)?this._on(this.element,"click",".expand, .collapse",t.proxy(this._drillDown,this)):this._pivotClientObj.model.enableDeferUpdate||this._on(this.element,"click",".expand, .collapse",t.proxy(this._drillDown,this));this._on(this.element,"mouseover",".colheader, .rowheader, .expand, .collapse",function(t){if(t.target.className.indexOf("expand")>-1&&!n(t.target).hasClass("header-hover-expand"))n(t.target).addClass("header-hover-expand");else if(t.target.className.indexOf("collapse")>-1&&!n(t.target).hasClass("header-hover-collapse"))n(t.target).addClass("header-hover-collapse");else if((t.target.className.indexOf("expand")<0||t.target.className.indexOf("collapse")<0)&&n(t.target).children("span").length>0){var i=n(t.target).children("span")[0];!n(i).hasClass("header-hover-expand")&&i.className.indexOf("expand")>-1?n(i).addClass("header-hover-expand"):!n(i).hasClass("header-hover-collapse")&&i.className.indexOf("collapse")>-1&&n(i).addClass("header-hover-collapse")}});this._on(this.element,"mouseleave",".colheader, .rowheader, .expand, .collapse",function(){this.element.find(".expand, .collapse").removeClass("header-hover-expand header-hover-collapse")});this.model.enableToolTip&&(this._on(this.element,"mouseover",".value",this._applyToolTip),this._on(this.element,"mouseleave",".value",function(){this.model.enableToolTipAnimation?n("#"+this._id+"_gridTooltip").hide("slow"):n("#"+this._id+"_gridTooltip").hide()}));this.model.enableDrillThrough&&n.proxy(this._addHyperlink,this);this._on(this.element,"click",".filter",t.proxy(this._filterBtnClick,this));this._on(this.element,"click",".sorting",t.proxy(this._sortBtnClick,this));this._on(this.element,"click",".removeBtn",t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._removePvtBtn:this._clientRemovePvtBtn,this));this._on(this.element,"click",".ascOrder, .descOrder",t.proxy(this._sortField,this));this._on(this.element,"mouseover",".pvtBtn",function(t){n(t.target.parentElement).addClass("e-btn e-select")});this._on(this.element,"mouseleave",".pvtBtn",function(t){n(t.target.parentElement).removeClass("e-btn e-select");n(t.target).removeClass("hoverBtn")});this._on(this.element,"mouseover",".pivotButton",function(t){t.target.title=t.target.textContent;n(t.target).find("button").addClass("hoverBtn")});this._on(this.element,"mouseleave",".pivotButton",function(t){n(t.target).find("button").removeClass("hoverBtn")});this._on(this.element,"mouseover",".filter,.sorting,.removeBtn",function(t){n(t.target.parentElement).find("button").addClass("hoverBtn")});this._on(this.element,"mouseleave",".filter,.sorting,.removeBtn",function(t){n(t.target.parentElement).find("button").removeClass("hoverBtn")});this._on(this.element,"mouseleave",".value,.rowheader,.colheader,.summary",t.proxy(function(t){var r=n(t.target).find(".cellValue").contents().filter(function(){return this.nodeType==3}),i,u;r.text()!=0&&(i=n(t.target).find(".valueSorting").length>0?!0:!1,u=i?n(t.target).find(".valueSorting"):"",n(t.target).find(".valueSorting").remove(),n(t.target).find(".cellValue").remove(),n(t.target).append(r.text()),i&&(n(t.target).hasClass("colheader")||n(t.target).hasClass("summary"))&&n(t.target).hasClass("calc")&&!n(t.target).hasClass("rowheader")?n(t.target).append(u):"")}));this._on(this.element,"click",".e-close",t.proxy(function(){this.element.find("#preventDiv").remove()}));this._on(this.element,"click",".dialogOkBtn",t.proxy(this._dialogOKBtnClick,this));(this.model.enableContextMenu||n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen)&&(this._on(this.element,"click",".cellSelect",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".columnResize",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".excelLikeLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".advancedFiltering",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".toolTip",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".collapseByDefault",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".rtl",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".calculatedField",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".cellEditing",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".conditionalFormat",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".summaryCustomize",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".summaryTypes",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".numberFormatting",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".rowHeaderHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".colHeaderHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".valueCellHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".summaryCellHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".rowFreeze",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".colFreeze",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".excel",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".word",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".pdf",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".csv",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".normalLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".normalTopSummaryLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".noSummariesLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".drillThrough",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".groupingBar",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".frozenHeaders",t.proxy(this._createMenuIcons,this)),this._on(this.element,"click",".exporting",t.proxy(this._createMenuIcons,this)),this._on(this.element,"click",".hyperlinkOptions",t.proxy(this._createMenuIcons,this)),this._on(this.element,"click",".layouts",t.proxy(this._createMenuIcons,this)),n(document).click(function(t){t.target.className.indexOf("hyperlinkOptions")==-1&&n(".hyperLinkDialog").remove();t.target.className.indexOf("exporting")==-1&&n(".exportDialog").remove();t.target.className.indexOf("frozenHeaders")==-1&&n(".frozenDialog").remove();t.target.className.indexOf("layouts")==-1&&n(".layoutsDialog").remove()}));this._on(this.element,"click",".dialogCancelBtn",t.proxy(function(){this.element.find(".e-dialog, .clientDialog").hide();n("#preventDiv").remove()}));this.model.enableColumnResizing&&(this._on(this.element,"mousemove",t.proxy(function(n){this._colResizing(n)})),this._on(this.element,"mousedown","thead,.pivotGridFrozenTable,.pivotGridColValueTable",t.proxy(function(n){this._startColResizing(n)})),this._on(this.element,"mouseup",".e-reSizeColbg",t.proxy(function(n){this._endColResizing(n)})));this._on(this.element,"click",".colheader,.cstot,.cgtot,.calc,.stot,.gtot",t.proxy(function(i){var f,r,o,s,e,u;if(n(i.target).hasClass("collapse")||n(i.target).hasClass("expand"))return!1;if(!t.isNullOrUndefined(this.model.valueSortSettings)&&!t.isNullOrUndefined(this.model.valueSortSettings.sortOrder)&&this.model.valueSortSettings.sortOrder!="none"&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.dataSource.values.length>0||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&JSON.parse(this.getOlapReport()).PivotCalculations.length>0))if(f=this.model.valueSortSettings.sortOrder,r=n(i.target).hasClass("cellValue")||n(i.target).hasClass("valueSorting")||n(i.target).hasClass("expand")||n(i.target).hasClass("collapse")?n(i.target).parent():n(i.target),r.hasClass("calc")||(r=n(this.element).find("[p='"+(Number(r.attr("p").split(",")[0])+Number(r.attr("colspan"))-1)+","+(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource.columns.length:JSON.parse(this.getOlapReport()).PivotColumns.length)+"']")[0]),f=n(r).find(".valueSorting").length>0?n(r).find(".valueSorting").hasClass("descending")?"ascending":"descending":f,this.element.find(".valueSorting").remove(),n(r).find(".valueSorting").length!=0||n(r).hasClass("rowheader")?n(r).find(".valueSorting").removeClass("ascending").removeClass("descending").addClass(f):(o=t.buildTag("span.valueSorting e-icon "+f).css("width","30px").attr("role","button").attr("aria-label","sort")[0].outerHTML,n(r).append(o)),s=JSON.stringify(this.model.customObject),t.PivotAnalysis._valueSorting=Number(n(r).attr("p").split(",")[0]),t.PivotAnalysis._sort=f,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)this.refreshControl();else{for(e="",u=0;u<this.getJSONRecords().length;u++)Number(this.getJSONRecords()[u].Index.split(",")[0])==t.PivotAnalysis._valueSorting&&Number(this.getJSONRecords()[u].Index.split(",")[1])<JSON.parse(this.getOlapReport()).PivotColumns.length+1&&(e=e==""?this.getJSONRecords()[u].Value.indexOf(".")==-1?this.getJSONRecords()[u].Value:this.getJSONRecords()[u].Value.split(".")[1]:e+this.model.valueSortSettings.headerDelimiters+(this.getJSONRecords()[u].Value.indexOf(".")==-1?this.getJSONRecords()[u].Value:this.getJSONRecords()[u].Value.split(".")[1]));this.model.valueSortSettings.index=t.PivotAnalysis._valueSorting;this.model.valueSortSettings.headerText=e;this.model.valueSortSettings.sortOrder=f;this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.valueSorting,JSON.stringify({action:"valueSorting",valueSorting:JSON.stringify(this.model.valueSortSettings),currentReport:JSON.parse(this.getOlapReport()).Report,customObject:s}),this._renderControlSuccess);delete this.model.valueSortSettings.index}}))},_stateMaintenance:function(){var i=t.buildTag("span.enabledState").addClass("e-icon").attr("aria-label",this._getLocalizedLabels("EnabledState"))[0].outerHTML;this.model.dataSource.enableAdvancedFilter&&(this.element.parents(".e-pivotclient").length>0?n(".advancedFiltering").addClass("enabled"):n(".advancedFiltering a:eq(0)").append(i));this.model.enableDrillThrough&&(n(".drillThrough a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CellEditing")));this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough&&(this.element.find(".drillThrough").addClass("enabled"),this.element.find(".toolBar").ejToolbar("disableItemByID","cellEditing"));!this.model.enableToolTip||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||(this.element.parents(".e-pivotclient").length>0?n(".toolTip").addClass("enabled"):n(".toolTip a:eq(0)").append(i));this.model.enableCellSelection&&(n(".cellSelect a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CellEditing")));this.model.enableColumnResizing&&(this.element.parents(".e-pivotclient").length>0?(n(".columnResize").addClass("enabled"),n(".toolBar").ejToolbar("disableItemByID","collapseByDefault")):(n(".columnResize a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CollapseByDefault"))));this.model.enableGroupingBar&&n(".groupingBar a:eq(0)").append(i);this.model.enableRTL&&(this.element.parents(".e-pivotclient").length>0?n(".rtl").addClass("enabled"):n(".rtl a:eq(0)").append(i));this.model.enableCollapseByDefault&&(this.element.parents(".e-pivotclient").length>0?(n(".toolBar").ejToolbar("disableItemByID","columnResize"),n(".toolBar").ejToolbar("disableItemByID","frozenHeaders"),n(".collapseByDefault").addClass("enabled")):(n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("ColumnResize")),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("FrozenHeader")),n(".collapseByDefault a:eq(0)").append(i)));this.model.enableCellEditing&&(this.element.parents(".e-pivotclient").length>0?(this.element.find(".cellEditing").addClass("enabled"),this.element.find(".toolBar").ejToolbar("disableItemByID","drillThrough")):n(".cellEditing a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("DrillThrough")),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CellSelection")));this.model.frozenHeaderSettings.enableFrozenRowHeaders&&n("li#row a:eq(0)").append(i);this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&n("li#column a:eq(0)").append(i);this.model.hyperlinkSettings.enableRowHeaderHyperlink&&n("li#rowHeader a:eq(0)").append(i);this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&n("li#columnHeader a:eq(0)").append(i);this.model.hyperlinkSettings.enableValueCellHyperlink&&n("li#valueCell a:eq(0)").append(i);this.model.hyperlinkSettings.enableSummaryCellHyperlink&&n("li#summaryCell a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.Normal&&n("li#normalLayout a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.NoSummaries&&n("li#noSummariesLayout a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout&&n("li#excelLikeLayout a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.NormalTopSummary&&n("li#normalTopSummaryLayout a:eq(0)").append(i);(this.model.layout==t.PivotGrid.Layout.NormalTopSummary||this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout||this.model.layout==t.PivotGrid.Layout.NoSummaries||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this.element.parents(".e-pivotclient").length>0?n(".toolBar").ejToolbar("disableItemByID","summaryCustomize"):n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("SummaryCustomization")))},_contextMenuClick:function(i){var e=t.buildTag("span.enabledState").addClass("e-icon").attr("aria-label","")[0].outerHTML,o=this.element.parents(".e-pivotclient").length>0?n(i.target):n(i.element),u,f;(n(i.element).hasClass("numberFormatting")||n(i.target).hasClass("numberFormatting"))&&this._createMenuDialog(i);(n(i.element).hasClass("cellSelect")||n(i.target).hasClass("cellSelect"))&&(this.model.enableCellEditing||(this.model.enableCellSelection=!this.model.enableCellSelection),this.renderControlFromJSON());(n(i.element).hasClass("columnResize")||n(i.target).hasClass("columnResize"))&&!this.model.enableCollapseByDefault&&(this.model.enableColumnResizing=!this.model.enableColumnResizing,this.renderControlFromJSON());(n(i.element).hasClass("toolTip")||n(i.target).hasClass("toolTip"))&&(this.model.enableToolTip=!this.model.enableToolTip,this.renderControlFromJSON());!(n(i.element).hasClass("collapseByDefault")||n(i.target).hasClass("collapseByDefault"))||this.model.enableColumnResizing||this.model.enableFrozenColumnHeaders||this.model.enableFrozenRowHeaders||(this.model.enableCollapseByDefault?this.model.enableCollapseByDefault=!1:(this.model.enableCollapseByDefault=!0,this.model.collapsedMembers=null),this.renderControlFromJSON());(n(i.element).hasClass("rtl")||n(i.target).hasClass("rtl"))&&(this.model.enableRTL=!this.model.enableRTL,this.renderControlFromJSON());(n(i.element).hasClass("calculatedField")||n(i.target).hasClass("calculatedField"))&&this._createCalculatedField();(n(i.element).hasClass("cellEditing")||n(i.target).hasClass("cellEditing"))&&(this.model.enableCellSelection||(this.model.enableCellEditing=!this.model.enableCellEditing,this.model.enableDrillThrough=!1),this.renderControlFromJSON());(n(i.element).hasClass("drillThrough")||n(i.target).hasClass("drillThrough"))&&(this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(dialogTitle="Cube Configuration",dialogContent="<p>Please configure cube!<\/p>",u=t.buildTag("div#clientDialog.clientDialog",{opacity:"1"}).attr("title",dialogTitle)[0].outerHTML,n(u).appendTo("#"+this._id),n(dialogContent).appendTo(this.element.find(".clientDialog")),this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:200,target:"#"+this._id,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)})):this.element.parents(".e-pivotclient").length>0?(this._pivotClientObj.model.enableDrillThrough=!this._pivotClientObj.model.enableDrillThrough,this.model.enableDrillThrough=this._pivotClientObj.model.enableDrillThrough,this.model.enableCellEditing=!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.renderControlFromJSON():this._pivotClientObj._load()):(this.model.enableDrillThrough=!this.model.enableDrillThrough,this.model.enableCellEditing=!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.renderControlFromJSON():this._load()));(n(i.element).hasClass("summaryCustomize")||n(i.target).hasClass("summaryCustomize"))&&this._createMenuDialog(i);(n(i.element).hasClass("conditionalFormat")||n(i.target).hasClass("conditionalFormat"))&&(this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.operationalMode=="clientmode"&&this.setOlapReport(this._pivotClientObj.model.dataSource),this.model.enableConditionalFormatting=!0,this.openConditionalFormattingDialog(),t.Pivot.closePreventPanel(this));(n(i.element).hasClass("summaryTypes")||n(i.target).hasClass("summaryTypes"))&&this._createMenuDialog(i);(n(i.element).hasClass("advancedFiltering")||n(i.target).hasClass("advancedFiltering"))&&(this.model.dataSource.enableAdvancedFilter=!this.model.dataSource.enableAdvancedFilter,this.renderControlFromJSON());n(i.element).hasClass("groupingBar")&&(this.model.enableGroupingBar=!this.model.enableGroupingBar,this.renderControlFromJSON());(i.element!="undefined"&&i.parentText==this._getLocalizedLabels("Layouts")||n(i.target).parents().hasClass("layoutsDialog"))&&((i.ID=="normalLayout"||n(i.target).hasClass("normalLayout"))&&(this.model.layout=t.PivotGrid.Layout.Normal,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="normal")),(i.ID=="excelLikeLayout"||n(i.target).hasClass("excelLikeLayout"))&&(this.model.layout=t.PivotGrid.Layout.ExcelLikeLayout,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="excellikelayout")),(i.ID=="noSummariesLayout"||n(i.target).hasClass("noSummariesLayout"))&&(this.model.layout=t.PivotGrid.Layout.NoSummaries,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="nosummaries")),(i.ID=="normalTopSummaryLayout"||n(i.target).hasClass("normalTopSummaryLayout"))&&(this.model.layout=t.PivotGrid.Layout.NormalTopSummary,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="normaltopsummary")),i.ID=="excelLikeLayout"||n(i.target).hasClass("excelLikeLayout")?this.excelLikeLayout(this.getJSONRecords()):(this._excelLikeJSONRecords=null,this.refreshPivotGrid()));(i.element!="undefined"&&i.parentText==this._getLocalizedLabels("HyperLink")||n(i.target).parents().hasClass("hyperLinkDialog"))&&((i.ID=="rowHeader"||n(i.target).hasClass("rowHeaderHyperLink"))&&(this.model.hyperlinkSettings.enableRowHeaderHyperlink=!this.model.hyperlinkSettings.enableRowHeaderHyperlink),(i.ID=="columnHeader"||n(i.target).hasClass("colHeaderHyperLink"))&&(this.model.hyperlinkSettings.enableColumnHeaderHyperlink=!this.model.hyperlinkSettings.enableColumnHeaderHyperlink),(i.ID=="valueCell"||n(i.target).hasClass("valueCellHyperLink"))&&(this.model.hyperlinkSettings.enableValueCellHyperlink=!this.model.hyperlinkSettings.enableValueCellHyperlink),(i.ID=="summaryCell"||n(i.target).hasClass("summaryCellHyperLink"))&&(this.model.hyperlinkSettings.enableSummaryCellHyperlink=!this.model.hyperlinkSettings.enableSummaryCellHyperlink),this.renderControlFromJSON());(i.element!=r&&i.parentText==this._getLocalizedLabels("Exporting")||n(i.target).parents().hasClass("exportDialog"))&&(f=this.element.parents(".e-pivotclient").length>0?n(i.target).attr("class").split(" ")[0]:i.ID,this.element.parents(".e-pivotclient").length>0&&!t.isNullOrUndefined(this._pivotClientObj)&&(this.model.beforeExport=this._pivotClientObj.model.beforeExport),this.exportPivotGrid(f,"Sample"));(i.element!=r&&i.parentText==this._getLocalizedLabels("FrozenHeader")||n(i.target).parents().hasClass("frozenDialog"))&&!this.model.enableCollapseByDefault&&((i.ID=="row"||n(i.target).hasClass("rowFreeze"))&&(this.model.frozenHeaderSettings.enableFrozenRowHeaders=this.model.frozenHeaderSettings.enableFrozenRowHeaders?!1:!0),(i.ID=="column"||n(i.target).hasClass("colFreeze"))&&(this.model.frozenHeaderSettings.enableFrozenColumnHeaders=this.model.frozenHeaderSettings.enableFrozenColumnHeaders?!1:!0),this.renderControlFromJSON())},_createMenuIcons:function(i){var u,r,f,e;n(i.target).hasClass("exporting")&&(u=t.buildTag("div.exportDialog#exportDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.excel exportingIcons").attr({"aria-label":this._getLocalizedLabels("Excel"),title:this._getLocalizedLabels("Excel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.word exportingIcons").attr({"aria-label":this._getLocalizedLabels("Word"),title:this._getLocalizedLabels("Word"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pdf exportingIcons").attr({"aria-label":this._getLocalizedLabels("PDF"),title:this._getLocalizedLabels("PDF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.csv exportingIcons").attr({"aria-label":this._getLocalizedLabels("CSV"),title:this._getLocalizedLabels("CSV"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,this.element.find("div .exportDialog").length==0&&(n(u).appendTo(this.element),n(".exportDialog").css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px")));n(i.target).hasClass("hyperlinkOptions")&&(r=t.buildTag("div.hyperLinkDialog#hyperLinkTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.rowHeaderHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableRowHeaderHyperlink"),title:this._getLocalizedLabels("EnableRowHeaderHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.colHeaderHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableColumnHeaderHyperlink"),title:this._getLocalizedLabels("EnableColumnHeaderHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.valueCellHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableValueCellHyperlink"),title:this._getLocalizedLabels("EnableValueCellHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.summaryCellHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableSummaryCellHyperlink"),title:this._getLocalizedLabels("EnableSummaryCellHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.hyperLinkDialog").length==0&&(n(r).appendTo(this.element),n(r).css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px"),this.model.hyperlinkSettings.enableRowHeaderHyperlink&&this.element.find(".rowHeaderHyperLink").addClass("enabled"),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&this.element.find(".colHeaderHyperLink").addClass("enabled"),this.model.hyperlinkSettings.enableValueCellHyperlink&&this.element.find(".valueCellHyperLink").addClass("enabled"),this.model.hyperlinkSettings.enableSummaryCellHyperlink&&this.element.find(".summaryCellHyperLink").addClass("enabled")));n(i.target).hasClass("frozenHeaders")&&(f=t.buildTag("div.frozenDialog#frozenDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.rowFreeze frozenHeaderIcons").attr({"aria-label":this._getLocalizedLabels("Row"),title:this._getLocalizedLabels("Row"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.colFreeze frozenHeaderIcons").attr({"aria-label":this._getLocalizedLabels("Column"),title:this._getLocalizedLabels("Column"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,this.element.find("div.frozenDialog").length==0&&(n(f).appendTo(this.element),n(".frozenDialog").css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px"),this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.element.find(".rowFreeze").addClass("enabled"),this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.element.find(".colFreeze").addClass("enabled"),this.model.frozenHeaderSettings.enableFrozenHeaders&&this.element.find(".bothFreeze").addClass("enabled")));n(i.target).hasClass("layouts")&&(e=t.buildTag("div.layoutsDialog#layoutsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.normalLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("NormalLayout"),title:this._getLocalizedLabels("NormalLayout"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.excelLikeLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("ExcelLikeLayout"),title:this._getLocalizedLabels("ExcelLikeLayout"),tabindex:0})[0].outerHTML)[0].outerHTML+(this.model.analysisMode==t.Pivot.AnalysisMode.Olap?t.buildTag("td",t.buildTag("div.noSummariesLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("NoSummaries"),title:this._getLocalizedLabels("NoSummaries"),tabindex:0})[0].outerHTML)[0].outerHTML:"")+(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?t.buildTag("td",t.buildTag("div.normalTopSummaryLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("NormalTopSummary"),title:this._getLocalizedLabels("NormalTopSummary"),tabindex:0})[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,this.element.find("div .layoutsDialog").length==0&&(n(e).appendTo(this.element),n(".layoutsDialog").css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px"),this.model.layout==t.PivotGrid.Layout.Normal&&this.element.find(".normalLayout").addClass("enabled"),this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout&&this.element.find(".excelLikeLayout").addClass("enabled"),this.model.layout==t.PivotGrid.Layout.NoSummaries&&this.element.find(".noSummariesLayout").addClass("enabled"),this.model.layout==t.PivotGrid.Layout.NormalTopSummary&&this.element.find(".normalTopSummaryLayout").addClass("enabled")))},_createMenuDialog:function(i){var c,e,l,a,v,o,s,f,u,h,b,k,d,g;if(this._dialogName=t.isNullOrUndefined(i.target)?n(i.element).attr("class").split(" ")[0]:n(i.target).attr("class").split(" ")[0],t.Pivot.openPreventPanel(this),c=t.buildTag("div#clientDialog.clientDialog",{opacity:"1"})[0].outerHTML,e=currentTag=dialogContent="",n(i.target).hasClass("numberFormatting")||n(i.element).hasClass("numberFormatting")){for(e=this._getLocalizedLabels("NumberFormatting"),currentTag="Number Formatting",l=t.buildTag("label",this._getLocalizedLabels("Measures"))[0].outerHTML,f="<select id='measureOption'>",u=0;u<this.model.dataSource.values.length;u++)f+="<option>"+this.model.dataSource.values[u].fieldName+"<\/option>";f+="<\/select>";a=t.buildTag("label",this._getLocalizedLabels("NumberFormats"))[0].outerHTML;v="<div class='summarTypes'><select id='numberFormatOption'><option value='Decimal'>Decimal<\/option><option value='Currency'>Currency<\/option><option value='Percentage'>Percentage<\/option><option value='Number'>Number<\/option><option value='Date'>Date<\/option><option value='Time'>Time<\/option><option value='Scientific'>Scientific<\/option><option value='Fraction'>Fraction<\/option><\/select><\/div>";dialogContent=t.buildTag("div#reportDlg.reportDlg","<table><tr><td>"+l+"<\/td><td>"+f+"<\/td><\/tr><tr><td>"+a+"<\/td><td>"+v+"<\/td><\/tr><\/table>")[0].outerHTML}if(n(i.target).hasClass("summaryCustomize")||n(i.element).hasClass("summaryCustomize")){e=this._getLocalizedLabels("SummaryCustomization");var s=t.buildTag("label",this._getLocalizedLabels("HideGrandTotal"))[0].outerHTML,h=t.buildTag("label",this._getLocalizedLabels("HideSubTotal"))[0].outerHTML,f="<div class='measures'><select id='hideSubTotal'>";if(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(u=0;u<this.model.dataSource.columns.length;u++)f+="<option>"+this.model.dataSource.columns[u].fieldCaption+"<\/option>";for(u=0;u<this.model.dataSource.rows.length;u++)f+="<option>"+this.model.dataSource.rows[u].fieldCaption+"<\/option>"}else if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){for(o=n(this.element).parents(".e-pivotclient").length>0?this._pivotClientObj.getOlapReport():this.getOlapReport(),u=0;u<JSON.parse(o).PivotRows.length;u++)f+="<option>"+JSON.parse(o).PivotRows[u].FieldName+"<\/option>";for(u=0;u<JSON.parse(o).PivotColumns.length;u++)f+="<option>"+JSON.parse(o).PivotColumns[u].FieldName+"<\/option>"}f+="<\/div>";var y=t.buildTag("input#rowSumCheckBox.rowSumCheckBox","",{},{name:"row",type:"checkbox",tabindex:0})[0].outerHTML+" "+t.buildTag("label.rowGrndlabel",this._getLocalizedLabels("Row"))[0].outerHTML+"<br/>",p=t.buildTag("input#colSumCheckBox.colSumCheckBox","",{},{name:"column",type:"checkbox",tabindex:0})[0].outerHTML+" "+t.buildTag("label.colGrndlabel",this._getLocalizedLabels("Column"))[0].outerHTML+"<br/>",w=t.buildTag("input#bothSumCheckBox.bothSumCheckBox","",{},{name:"both",type:"checkbox",tabindex:0})[0].outerHTML+" "+t.buildTag("label.bothGrndlabel",this._getLocalizedLabels("Both"))[0].outerHTML+"<br/>";dialogContent=this.model.analysisMode=="pivot"?t.buildTag("div#customizeDlg.customizeDlg","<table><tr><td style='vertical-align:top'>"+s+"<\/td><td>"+y+p+w+"<\/td><\/tr><tr><td>"+h+"<\/td><td>"+f+"<\/td><\/tr><\/table>")[0].outerHTML:t.buildTag("div#customizeDlg.customizeDlg","<table><tr><td>"+s+"<\/td><td>"+y+p+w+"<\/td><\/tr><\/table>")[0].outerHTML}if(n(i.target).hasClass("summaryTypes")||n(i.element).hasClass("summaryTypes")){if(e=this._getLocalizedLabels("SummaryTypes"),s=t.buildTag("label",this._getLocalizedLabels("Measures"))[0].outerHTML,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(f="<div class='measures'><select id='drillMeasure'>",u=0;u<this.model.dataSource.values.length;u++)f+="<option>"+this.model.dataSource.values[u].fieldCaption+"<\/option>";f+="<\/div>"}h=t.buildTag("label",this._getLocalizedLabels("SummaryType"))[0].outerHTML;b=t.buildTag("input#drillSum").attr("type","text")[0].outerHTML;dialogContent=t.buildTag("div#summaryDlg.#summaryDlg","<table><tr><td>"+s+"<\/td><td>"+f+"<\/td><\/tr><tr><td>"+h+"<\/td><td>"+b+"<\/td><\/tr><\/table>")[0].outerHTML}k=t.buildTag("div#EditorDiv.editorDiv","",{"margin-left":"5px"})[0].outerHTML;dialogContent+=k;d="<button id=OKBtn class='dialogOkBtn'>"+this._getLocalizedLabels("OK")+"<\/button>";g="<button id=CancelBtn class='dialogCancelBtn'>"+this._getLocalizedLabels("Cancel")+"<\/button>";dialogFooter=t.buildTag("div.dialogFooter",d+g,{float:"right","margin-bottom":"7px"})[0].outerHTML;n(c).appendTo("#preventDiv");n(dialogContent+dialogFooter).appendTo(".clientDialog");n(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:"auto",target:"#"+this._id,enableResize:!1,close:t.Pivot.closePreventPanel(this)});n(".e-titlebar").prepend(t.buildTag("div",e,{display:"inline"})[0].outerHTML)[0];n(".dialogOkBtn, .dialogCancelBtn").ejButton({width:"67px",enableRTL:this.model.enableRTL,type:t.ButtonType.Button});this._selectedFormat==""&&this._selectedMeasure==""&&(n("#numberFormatOption").ejDropDownList({enableRTL:this.model.enableRTL,selectedIndex:0,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n("#measureOption").ejDropDownList({enableRTL:this.model.enableRTL,selectedIndex:0,showCheckbox:!0,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}));this._selectedMeasure!=""&&this._selectedFormat!=""&&(n("#numberFormatOption").ejDropDownList({enableRTL:this.model.enableRTL,text:this._selectedFormat,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n("#measureOption").ejDropDownList({enableRTL:this.model.enableRTL,text:this._selectedMeasure,showCheckbox:!0,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}));n("#categoricalInput").ejMaskEdit({name:"mask",inputMode:t.InputMode.Text,watermarkText:"Column Page Size"});n("#seriesInput").ejMaskEdit({name:"mask",inputMode:t.InputMode.Text,watermarkText:"Row Page Size"});n("#rowSumCheckBox,#colSumCheckBox,#bothSumCheckBox").ejCheckBox({size:"small",showRoundedCorner:!0});this.rowCheckBox=n("#rowSumCheckBox").data("ejCheckBox");this.colCheckBox=n("#colSumCheckBox").data("ejCheckBox");this.bothCheckBox=n("#bothSumCheckBox").data("ejCheckBox");(n(i.target).hasClass("summaryCustomize")||n(i.element).hasClass("summaryCustomize"))&&(this.rowGrand==!1&&this.rowCheckBox.setModel({checked:"checked"}),this.colGrand==!1&&this.colCheckBox.setModel({checked:"checked"}),this.bothGrand==!1&&this.bothCheckBox.setModel({checked:"checked"}),n("#hideSubTotal").ejDropDownList({showCheckbox:!0,enableRTL:this.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.dropmeasure=n("#hideSubTotal").data("ejDropDownList"),this.selval!=r&&this.dropmeasure.setModel({value:this.selval}));(n(i.target).hasClass("summaryTypes")||n(i.element).hasClass("summaryTypes"))&&(n("#_summaryOK,#_summaryCancel").ejButton({enableRTL:this.model.enableRTL}),n("#drillMeasure").ejDropDownList({selectedIndices:[0],enableRTL:this.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n("#drillSum").ejDropDownList({dataSource:[{option:"Sum",value:this._getLocalizedLabels("Sum")},{option:"Average",value:this._getLocalizedLabels("Average")},{option:"Count",value:this._getLocalizedLabels("Count")},{option:"Min",value:this._getLocalizedLabels("Min")},{option:"Max",value:this._getLocalizedLabels("Max")}],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),drilmes=n("#drillMeasure").data("ejDropDownList"),drilsum=n("#drillSum").data("ejDropDownList"),this.drilsumval!=r&&drilmes.setModel({value:this.drilsumval}),this.sumtyp!=null&&drilsum.setModel({value:this.sumtyp}))},_dialogOKBtnClick:function(){var o,f,e,i,h,s,c,l,u,a;if(this._dialogName=="numberFormatting"){for(this._selectedFormat=n("#numberFormatOption").ejDropDownList("getSelectedValue"),this._selectedMeasure=n("#measureOption").ejDropDownList("getSelectedValue"),o=this._selectedMeasure.split(","),this.element.find(".e-dialog").remove(),t.Pivot.closePreventPanel(this),u=0;u<this.model.dataSource.values.length;u++)for(f=0;f<o.length;f++)this.model.dataSource.values[u].fieldName==o[f]&&(this.model.dataSource.values[u].format=this._selectedFormat.toLowerCase());t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.model.analysisMode!="pivot"||this._pivotClientObj.model.operationalMode!="clientmode"||(this.model.collapsedMembers=null);this._populatePivotGrid()}if(this._dialogName=="summaryCustomize"&&(pGridObj=this,t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.model.analysisMode!="pivot"||this._pivotClientObj.model.operationalMode!="clientmode"||(pGridObj.model.collapsedMembers=null),pGridObj.rowCheckBox.model.checked?(pGridObj.model.enableColumnGrandTotal=pGridObj.model.enableGrandTotal=!0,pGridObj.model.enableRowGrandTotal=pGridObj.rowGrand=!1):pGridObj.model.enableRowGrandTotal=pGridObj.rowGrand=!0,pGridObj.colCheckBox.model.checked?(pGridObj.model.enableRowGrandTotal=pGridObj.model.enableGrandTotal=!0,pGridObj.model.enableColumnGrandTotal=pGridObj.colGrand=!1):pGridObj.model.enableColumnGrandTotal=pGridObj.colGrand=!0,pGridObj.bothCheckBox.model.checked||pGridObj.colCheckBox.model.checked&&pGridObj.rowCheckBox.model.checked?(pGridObj.model.enableRowGrandTotal=pGridObj.model.enableColumnGrandTotal=!0,pGridObj.model.enableGrandTotal=pGridObj.bothGrand=!1):pGridObj.model.enableGrandTotal=pGridObj.bothGrand=!0,n("#hideSubTotal").ejDropDownList("getSelectedValue")!=null&&this.model.analysisMode=="pivot"&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(pGridObj.selval=n("#hideSubTotal").ejDropDownList("getSelectedValue"),e=n("#hideSubTotal").ejDropDownList("getSelectedValue").split(","),pGridObj.model.dataSource.rows.length>0&&n.each(pGridObj.model.dataSource.rows,function(n,t){t.fieldName.length>0&&(t.showSubTotal=!0)}),pGridObj.model.dataSource.columns.length>0&&n.each(pGridObj.model.dataSource.columns,function(n,t){t.fieldName.length>0&&(t.showSubTotal=!0)}),n.each(e,function(t,i){pGridObj.model.dataSource.rows.length>0&&n.each(pGridObj.model.dataSource.rows,function(n,t){t.fieldName.length>0&&t.fieldName==i&&(t.showSubTotal=!1)});pGridObj.model.dataSource.columns.length>0&&n.each(pGridObj.model.dataSource.columns,function(n,t){t.fieldName.length>0&&t.fieldName==i&&(t.showSubTotal=!1)})}),pGridObj._populatePivotGrid()):this.model.analysisMode=="pivot"&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(pGridObj.selval=n("#hideSubTotal").ejDropDownList("getSelectedValue"),e=n("#hideSubTotal").ejDropDownList("getSelectedValue").split(","),i=n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()):JSON.parse(pGridObj.getOlapReport()),i.PivotRows.length>0&&n.each(i.PivotRows,function(n,t){t.FieldName.length>0&&(t.showSubTotal=!0)}),i.PivotColumns.length>0&&n.each(i.PivotColumns,function(n,t){t.FieldName.length>0&&(t.showSubTotal=!0)}),n.each(e,function(t,r){i.PivotRows.length>0&&n.each(i.PivotRows,function(n,t){t.FieldName.length>0&&t.FieldName==r&&(t.showSubTotal=!1)});i.PivotColumns.length>0&&n.each(i.PivotColumns,function(n,t){t.FieldName.length>0&&t.FieldName==r&&(t.showSubTotal=!1)})}),h={JsonRecords:JSON.stringify(pGridObj.getJSONRecords()),PivotReport:JSON.stringify(i)},pGridObj._renderControlSuccess(h)):pGridObj._load(),t.Pivot.closePreventPanel(this)),this._dialogName=="summaryTypes"){if(n("#drillSum").val()!=r&&(this.drilsumval=n("#drillMeasure").ejDropDownList("getSelectedValue"),s=this.sumtyp=n("#drillSum").val(),s!=null&&(c=s.toLowerCase()),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)){for(l=n("#drillMeasure").ejDropDownList("getSelectedValue").split(",").length,u=0;u<l;u++)a=n("#drillMeasure").ejDropDownList("getSelectedValue").split(",")[u],n.grep(this.model.dataSource.values,function(n){return n.fieldName==a})[0].summaryType=c;t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.model.analysisMode!="pivot"||this._pivotClientObj.model.operationalMode!="clientmode"||(this.model.collapsedMembers=null);this._populatePivotGrid()}t.Pivot.closePreventPanel(this)}},_keyUpPress:function(t){if(t.which===16&&this.model.enableCellSelection&&(this._completeCellSelection(t),n("#"+this._id).find(".value").removeClass("hoverCell"),this._startPosCell=null,_startPosCell=null),t.which===13&&this.model.enableCellEditing&&!this.model.enableCellSelection&&n("#"+this._id).find(".value.hoverCell").length){n("#"+this._id).find(".value.hoverCell").trigger("mouseover");_startPosCell=n(n("#"+this._id).find(".value.hoverCell")).attr("p");var i={target:n("#"+this._id).find(".value.hoverCell > span")[0]};this._completeCellEditing(i);t.preventDefault();n("#"+this._id).find(".value.hoverCell .curInput").focus();n("#"+this._id).find(".value").removeClass("hoverCell")}},_keyDownPress:function(i){var c,f,u,o,r,s,e,v,a,l;if(n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&((document.activeElement.id=="Pager_CategCurrentPage"||document.activeElement.id=="Pager_SeriesCurrentPage")&&(i.which===35?(i.preventDefault(),document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveLast").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveLast").last().trigger("click")):i.which==36&&(i.preventDefault(),document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveFirst").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveFirst").last().trigger("click")),i.which===39?document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveNext").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveNext").last().trigger("click"):i.which===37&&(document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .movePrevious").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .movePrevious").last().trigger("click"))),i.stopImmediatePropagation()),i.which!==27||t.isNullOrUndefined(this._curFocus.grp)&&(t.isNullOrUndefined(this._curFocus.tab)||!this._curFocus.tab.hasClass("pivotButton"))?i.which===27&&(this._index.dialog=0):(this._curFocus.tab.mouseleave().removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)?!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("pivotButton")&&(l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),a.mouseover().addClass("hoverCell").focus(),this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,this._index.field=0),i.which===70&&i.ctrlKey&&(i.preventDefault(),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.find(".filter").click():this._curFocus.grp.find(".filter").click()),i.which===83&&i.ctrlKey&&(i.preventDefault(),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(this._curFocus.tab.find(".sorting").click(),l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(this._curFocus.grp.find(".sorting").click(),l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),a.mouseover().addClass("hoverCell").focus()),(i.which===46||i.which===82&&i.ctrlKey)&&(i.which!=46&&i.preventDefault(),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.find(".removeBtn").click():this._curFocus.grp.find(".removeBtn").click()),i.shiftKey&&t.isNullOrUndefined(this._startPosCell)&&(_startPosCell=i.target.getAttribute("p"),this._startPosCell=i.target.getAttribute("p")),i.which===39&&n("#"+this._id).find(".e-dialog .hoverCell").length>0?n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-plus").click():i.which===37&&n("#"+this._id).find(".e-dialog .hoverCell").length>0&&n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-minus").click(),(i.which===40||i.which===39||i.which===38||i.which===37)&&i.shiftKey&&this.model.enableCellSelection){if(n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","0"),c=n(i.target),i.which=="40")for(f=c.attr("p"),u=parseInt(f.split(",")[1])+Number(c.attr("rowspan"));t.isNullOrUndefined(o)&&u<this._rowCount;)r=n(n("#"+this._id)).find("[p='"+f.split(",")[0]+","+u+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),this._curFocus.selection=n(o),u++;else if(i.which=="38")for(f=c.attr("p"),u=parseInt(f.split(",")[1])-1;t.isNullOrUndefined(o)&&u>=0;)r=n(n("#"+this._id)).find("[p='"+f.split(",")[0]+","+u+"']")[0],t.isNullOrUndefined(r)&&(r=n(n("#"+this._id)).find("[p='"+(parseInt(f.split(",")[0])-1)+","+u+"']")[0]),!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),this._curFocus.selection=n(o),u--;else if(i.which=="39")for(f=c.attr("p"),u=parseInt(f.split(",")[0])+Number(c.attr("colspan"));t.isNullOrUndefined(o)&&u<Math.ceil(this.getJSONRecords().length/this._rowCount);)r=n(n("#"+this._id)).find("[p='"+u+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),this._curFocus.selection=n(o),u++;else if(i.which=="37"){for(var f=c.attr("p"),u=parseInt(f.split(",")[0])-1,o=n(n("#"+this._id)).find("[p='"+(parseInt(f.split(",")[0])-1)+","+f.split(",")[1]+"']")[0];t.isNullOrUndefined(o)&&u>=0;)r=n(n("#"+this._id)).find("[p='"+u+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),u--;this._curFocus.selection=n(o)}if(this._curFocus.selection.attr("tabindex","-1").focus().addClass("hoverCell"),Number(_startPosCell.split(",")[0])<=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])<=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u<=Number(this._curFocus.selection.attr("p").split(",")[0]);u++)for(h=Number(_startPosCell.split(",")[1]);h<=Number(this._curFocus.selection.attr("p").split(",")[1]);h++)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell");else if(Number(_startPosCell.split(",")[0])>=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])>=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u>=Number(this._curFocus.selection.attr("p").split(",")[0]);u--)for(h=Number(_startPosCell.split(",")[1]);h>=Number(this._curFocus.selection.attr("p").split(",")[1]);h--)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell");else if(Number(_startPosCell.split(",")[0])<=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])>=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u<=Number(this._curFocus.selection.attr("p").split(",")[0]);u++)for(h=Number(_startPosCell.split(",")[1]);h>=Number(this._curFocus.selection.attr("p").split(",")[1]);h--)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell");else if(Number(_startPosCell.split(",")[0])>=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])<=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u>=Number(this._curFocus.selection.attr("p").split(",")[0]);u--)for(h=Number(_startPosCell.split(",")[1]);h<=Number(this._curFocus.selection.attr("p").split(",")[1]);h++)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell")}else if((i.which===40||i.which===38||i.which===37||i.which===39)&&n("#"+this._id).find(".calcFormulaDiv:visible").length>0)i.preventDefault(),s=n("#"+this._id).find(".calcFormulaDiv td:visible"),t.isNullOrUndefined(this._curFocus.formula)?(this._index.formula=i.which==39?0:i.which==37?s.length-1:0,this._curFocus.formula=s.eq(this._index.formula).addClass("hoverCell").mouseover()):(this._curFocus.formula.removeClass("hoverCell").mouseleave(),i.which===39?this._index.formula=this._index.formula+1>s.length-1?0:this._index.formula+1:i.which===37?this._index.formula=this._index.formula-1<0?s.length-1:this._index.formula-1:i.which===40?this._index.formula=this._index.formula+4>s.length-1?(this._index.formula+4)%10:this._index.formula+4:i.which===38&&(this._index.formula=this._index.formula-4<0?this._index.formula- -16:this._index.formula-4),this._curFocus.formula=s.eq(this._index.formula).addClass("hoverCell").mouseover());else if((i.keyCode===40||i.which===38)&&n("#"+this._id).find(".e-dialog:visible").length>0&&!t.isNullOrUndefined(n("#"+this._id).find(".e-dialog .e-text"))&&n(".e-dialog .e-text").hasClass("hoverCell"))n("#"+this._id).find(".e-dialog .hoverCell").removeClass("hoverCell"),i.preventDefault(),s=n("#"+this._id).find(".e-dialog .e-text:visible"),t.isNullOrUndefined(this._curFocus.filter)?(this._index.filter=i.which==40?1:i.which==38?s.length-1:0,this._curFocus.filter=s.eq(this._index.filter).attr("tabindex","-1")):(this._curFocus.filter.attr("tabindex","0").removeClass("hoverCell"),i.which===40?this._index.filter=this._index.filter+1>s.length-1?0:this._index.filter+1:i.which===38&&(this._index.filter=this._index.filter-1<0?s.length-1:this._index.filter-1),this._curFocus.filter=s.eq(this._index.filter).attr("tabindex","-1")),this._curFocus.filter.focus().addClass("hoverCell"),n(".e-node-focus").removeClass("e-node-focus");else if((i.which===40||i.which===38||i.which===37||i.which===39)&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("pivotButton")&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&!n("#"+this._id).find(".e-dialog:visible").length>0)i.preventDefault(),t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.mouseleave().attr("tabindex","0").removeClass("hoverCell"),s=n("#"+this._id).find(".pivotButton"),t.isNullOrUndefined(this._curFocus.grp)?i.which===40||i.which===39?this._curFocus.grp=s.eq(1).attr("tabindex","-1"):(i.which===38||i.which===37)&&(this._curFocus.grp=s.eq(s.length-1).attr("tabindex","-1")):(this._curFocus.grp.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40||i.which===39?this._index.grp=this._index.grp+1>s.length-1?0:this._index.grp+1:(i.which===38||i.which===37)&&(this._index.grp=this._index.grp-1<0?s.length-1:this._index.grp-1),this._curFocus.grp=s.eq(this._index.grp)),this._curFocus.grp.addClass("hoverCell").mouseover().focus();else if((i.which===40||i.which===38||i.which===37||i.which===39)&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&(document.activeElement.getAttribute("role")=="columnheader"||document.activeElement.getAttribute("role")=="rowheader"||document.activeElement.getAttribute("role")=="gridcell")){if(t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","0"),t.isNullOrUndefined(this._curFocus.cell)||(this._curFocus.cell.attr("tabindex","0").removeClass("hoverCell"),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&this._curFocus.cell.find("span").mouseleave()),this._index.menu=0,this._curFocus.cmenu=null,c=n(i.target),i.which=="40")for(f=c.attr("p"),u=parseInt(f.split(",")[1])+Number(c.attr("rowspan"));t.isNullOrUndefined(o)&&u<=this._rowCount;){if(r=n("#"+this._id).find("[p='"+f.split(",")[0]+","+u+"']")[0],t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+k+","+u+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);t.isNullOrUndefined(o)||(this._curFocus.cell=n(o));u++}else if(i.which=="38")for(var f=c.attr("p"),u=parseInt(f.split(",")[1])-1,o,h=parseInt(f.split(",")[0]);t.isNullOrUndefined(o)&&u>=0;){if(r=n("#"+this._id).find("[p='"+f.split(",")[0]+","+u+"']")[0],t.isNullOrUndefined(r)&&(c.attr("role")=="gridcell"||c.hasClass("summary")&&c.hasClass("calc")))for(k=parseInt(f.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+h+","+k+"']")[0]);if(t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+k+","+u+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);t.isNullOrUndefined(o)||n(o).hasClass("grpRow")||(this._curFocus.cell=n(o));u--;h--}else if(i.which=="39")for(f=c.attr("p"),u=parseInt(f.split(",")[0])+Number(c.attr("colspan"));t.isNullOrUndefined(o)&&u<=Math.ceil((Number(n("#"+this._id).find(".pivotGridTable td:last").attr("p").split(",")[0])+1)*(Number(n("#"+this._id).find(".pivotGridTable td:last").attr("p").split(",")[1])+1)/this._rowCount);){if(r=n("#"+this._id).find("[p='"+u+","+f.split(",")[1]+"']")[0],t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+u+","+k+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);t.isNullOrUndefined(o)||(this._curFocus.cell=n(o));u++}else if(i.which=="37"){for(var f=c.attr("p"),u=parseInt(f.split(",")[0])-1,o=n("#"+this._id).find("[p='"+(parseInt(f.split(",")[0])-1)+","+f.split(",")[1]+"']")[0],h=parseInt(f.split(",")[1]);t.isNullOrUndefined(o)&&u>=0;){if(r=n("#"+this._id).find("[p='"+u+","+f.split(",")[1]+"']")[0],t.isNullOrUndefined(r)&&c.attr("role")=="gridcell")for(k=parseInt(f.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+k+","+h+"']")[0]);if(t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+u+","+k+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);u--;h--}t.isNullOrUndefined(o)||n(o).hasClass("grpRow")||(this._curFocus.cell=n(o))}t.isNullOrUndefined(this._curFocus.cell)||(n(".hoverCell").removeClass("hoverCell"),this._curFocus.cell.attr("tabindex","-1").focus().addClass("hoverCell"),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&(this._curFocus.cell.mouseover(),this._curFocus.cell.find("span").mouseover()))}else i.which==40&&n(".e-list").hasClass("hoverCell")&&n("#"+this._id).find(".hoverCell").removeClass("hoverCell");i.which===9&&n("#"+this._id).find(".colheader.hoverCell")&&(this._curFocus.cell=n("#"+this._id).find(".colheader.hoverCell"));(i.which===9&&i.shiftKey||i.which===9)&&n("#"+this._id).find("#"+this._id+"_clientDlg_wrapper :visible").length>0?(i.preventDefault(),s=n("#"+this._id+"_editCon_hidden").hasClass("e-disable")||n("#"+this._id+"_conTo").attr("disabled")=="disabled"?n("#"+this._id+"_conTo").attr("disabled")!="disabled"?n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_conFrom,#"+this._id+"_conTo,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"):n("#"+this._id+"_editCon_hidden").hasClass("e-disable")?n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"):n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_editCon_wrapper,#"+this._id+"_removeBtn,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"):n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_editCon_wrapper,#"+this._id+"_removeBtn,#"+this._id+"_conFrom,#"+this._id+"_conTo,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"),t.isNullOrUndefined(this._curFocus.cformat)?(this._index.cformat=1,this._curFocus.cformat=s.eq(this._index.cformat).attr("tabindex","-1")):(this._curFocus.cformat.attr("tabindex","0").removeClass("hoverCell"),i.which===9&&i.shiftKey?this._index.cformat=this._index.cformat-1<0?s.length-1:this._index.cformat-1:i.which===9&&(this._index.cformat=this._index.cformat+1>s.length-1?0:this._index.cformat+1),this._curFocus.cformat=s.eq(this._index.cformat).attr("tabindex","-1")),this._curFocus.cformat.focus().addClass("hoverCell")):(i.which===9&&i.shiftKey||i.which===9)&&n("#"+this._id).find(".dlgCalculatedField:visible").length>0?(i.preventDefault(),n("#"+this._id).find(".calcFormulaDiv:visible").length>0&&n("#"+this._id).find(".calcFormulaDiv").css("display","none"),e=[],e.push(n("#"+this._id).find("#"+this._id+"_calculateFieldName:visible")),e.push(n("#"+this._id).find("#"+this._id+"_calculateFieldList_dropdown:visible")),e.push(n("#"+this._id).find(".calculatorFields:visible")),e.push(n("#"+this._id).find(".editFormula:visible")),e.push(n("#"+this._id).find("#"+this._id+"_fieldCollection_container:visible")),n("#"+this._id).find("#"+this._id+"_btnInsert:visible:not([aria-disabled='true'])").length>0&&e.push(n("#"+this._id).find("#"+this._id+"_btnInsert:visible:not([aria-disabled='true'])")),e.push(n("#"+this._id).find("#"+this._id+"_btnAdd:visible")),e.push(n("#"+this._id).find("#"+this._id+"_btnDelete:visible")),e.push(n("#"+this._id).find("#"+this._id+"_btnOk:visible")),e.push(n("#"+this._id).find("#"+this._id+"_btnCancel:visible")),t.isNullOrUndefined(this._curFocus.field)?(this._index.field=e.length>5?6:0,this._curFocus.field=e[this._index.field].attr("tabindex","-1")):(this._curFocus.field.attr("tabindex","0").removeClass("hoverCell").blur(),i.which===9&&i.shiftKey?this._index.field=this._index.field-1<0?e.length-1:this._index.field-1:i.which===9&&(this._index.field=this._index.field+1>e.length-1?0:this._index.field+1),this._curFocus.field=e[this._index.field].attr("tabindex","-1")),this._curFocus.field.focus().addClass("hoverCell")):(i.which===9&&i.shiftKey||i.which===9)&&n("#"+this._id).find(".e-dialog:visible").length>0?(i.preventDefault(),n("#"+this._id).find(".e-dialog .hoverCell").removeClass("hoverCell"),this._curFocus.filter=null,this._index.filter=0,e=n("#"+this._id).find(".dialogOKBtn:visible:not([aria-disabled='true']),.dialogCancelBtn:visible,.e-close:visible,#GroupLabelDrop_wrapper:visible,.filterElementTag:visible,.e-dialog .e-text:visible:first,.filterValues:visible,#filterMeasures_wrapper:visible,#filterOptions_wrapper:visible,#filterValue1:visible,#filterValue2:visible,.searchEditorTreeView"),t.isNullOrUndefined(this._curFocus.tree)?(this._index.dialog=this.model.dataSource.enableAdvancedFilter?1:2,this._curFocus.tree=e.eq(this._index.dialog).attr("tabindex","-1").focus()):(this._curFocus.tree.attr("tabindex","0").removeClass("hoverCell"),i.which===9&&i.shiftKey?this._index.dialog=this._index.dialog-1<0?e.length-1:this._index.dialog-1:i.which===9&&(this._index.dialog=this._index.dialog+1>e.length-1?0:this._index.dialog+1),this._curFocus.tree=e.eq(this._index.dialog).attr("tabindex","-1").focus()),this._curFocus.tree.hasClass("filterElementTag")?this._curFocus.tree.find(".e-list:first:visible").addClass("hoverCell"):this._curFocus.tree.addClass("hoverCell")):(i.which===9&&i.shiftKey||i.which===9)&&!n(".e-dialog:visible").length>0&&t.isNullOrUndefined(this._pivotClientObj)&&(i.preventDefault(),n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._schemaData)||n("#"+this._schemaData._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)||this._curFocus.grp.mouseleave(),this._index.field=0,this._index.grp=1,this._index.cell=1,this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,t.isNullOrUndefined(this._schemaData)||t.isNullOrUndefined(this._schemaData._curFocus)||(this._schemaData._curFocus.tree=null,this._schemaData._curFocus.node=null,this._schemaData._curFocus.button=null),this._curFocus.field=null,this._curFocus.cell=null,this._curFocus.grp=null,this._curFocus.tree=null,this._curFocus.cmenu=null,this._curFocus.cformat=null,this._curFocus.selection=null,e=[],this.model.enableGroupingBar&&n("#"+this._id).find(".pivotButton:visible").first().length>0&&e.push(n("#"+this._id).find(".pivotButton:visible").first()),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&n("[role='columnheader']:visible:not([p='0,0'])").first().length>0?e.push(n("[role='columnheader']:visible:not([p='0,0'])").first()):n("#"+this._id).find("[role='columnheader']:visible").first().length>0&&e.push(n("[role='columnheader']:not('.grpRow'):visible:first")),!t.isNullOrUndefined(this._schemaData)&&n("#"+this._schemaData._id).find(".e-text:visible").first().length>0&&e.push(n("#"+this._schemaData._id).find(".e-text:visible").first()),!t.isNullOrUndefined(this._schemaData)&&n("#"+this._schemaData._id).find(".pvtBtn:visible").first().length>0&&e.push(n("#"+this._schemaData._id).find(".pvtBtn:visible").first()),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&n("#Pager_CategCurrentPage:visible").length>0&&e.push(n("#Pager_CategCurrentPage:visible")),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&n("#Pager_SeriesCurrentPage:visible").length>0&&e.push(n("#Pager_SeriesCurrentPage:visible")),t.isNullOrUndefined(this._curFocus.tab)?this._curFocus.tab=e[0].attr("tabindex","-1"):(this._curFocus.tab.attr("tabindex","0").removeClass("hoverCell"),this._curFocus.tab.hasClass("e-active")&&this._curFocus.tab.removeClass("e-active"),t.isNullOrUndefined(this._schemaData)||(n("#"+this._schemaData._id).find(".e-active").removeClass("e-active"),n("#"+this._schemaData._id).find(".e-node-hover").removeClass("e-node-hover"),n("#"+this._schemaData._id).find(".e-node-focus").removeClass("e-node-focus")),this._curFocus.tab.hasClass("e-node-hover")&&this._curFocus.tab.removeClass("e-node-hover"),this._curFocus.tab.mouseleave(),i.which===9&&i.shiftKey?this._index.index=this._index.index-1<0?e.length-1:this._index.index-1:i.which===9&&(this._index.index=this._index.index+1>e.length-1?0:this._index.index+1),this._curFocus.tab=e[this._index.index].attr("tabindex","-1")),this._curFocus.tab.focus().addClass("hoverCell").mouseover(),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&(this._curFocus.tab.mouseover(),this._curFocus.tab.find("span").mouseover()),n(".e-node-focus").removeClass("e-node-focus"),i.stopImmediatePropagation());i.which===93&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&this.model.enableGroupingBar&&(!t.isNullOrUndefined(this._curFocus.grp)||!t.isNullOrUndefined(this._curFocus.tab))&&(i.preventDefault(),document.activeElement.className.startsWith("pivotButton")&&(t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(v={x:n(this._curFocus.tab).offset().left+n(this._curFocus.tab).outerWidth(),y:n(this._curFocus.tab).offset().top+n(this._curFocus.tab).outerHeight()},this._curFocus.tab.find("button").trigger({type:"mouseup",which:3,clientX:v.x,clientY:v.y,pageX:v.x,pageY:v.y})):(v={x:n(this._curFocus.grp).offset().left+n(this._curFocus.grp).outerWidth(),y:n(this._curFocus.grp).offset().top+n(this._curFocus.grp).outerHeight()},this._curFocus.grp.find("button").trigger({type:"mouseup",which:3,clientX:v.x,clientY:v.y,pageX:v.x,pageY:v.y}))));i.which===13&&this.model.hyperlinkSettings.enableColumnHeaderHyperlink?t.isNullOrUndefined(this._curFocus.cell)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.find(".cellValue").click():this._curFocus.cell.find(".cellValue").click():i.which==13&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&!n(".e-waitpopup-pane:visible").length>0&&(n("#"+this._id).find(".e-dialog .hoverCell").length>0&&n("#"+this._id).find(".e-dialog .hoverCell").hasClass("e-text")?n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click():document.activeElement.className.startsWith("pivotGridTable")||document.activeElement.getAttribute("role")=="rowheader"||document.activeElement.getAttribute("role")=="columnheader"?t.isNullOrUndefined(this._curFocus.cell)?t.isNullOrUndefined(this._curFocus.tab)||(this._curFocus.tab.find(".expand").length>0?this._curFocus.tab.find(".expand").click():this._curFocus.tab.find(".collapse").length>0&&this._curFocus.tab.find(".collapse").click(),this._curFocus.tab=n("#"+this._id).find("[role='"+this._curFocus.tab.attr("role")+"']:contains('"+this._curFocus.tab.text()+"'):visible").first(),this._curFocus.tab.attr("tabindex","-1").focus().addClass("hoverCell")):this._curFocus.cell.find(".expand,.collapse").length>0?(this._curFocus.cell.find(".expand,.collapse").click(),this._curFocus.cell.removeClass("hoverCell").attr("tabindex","0"),this._curFocus.cell=n("#"+this._id).find("[role='"+this._curFocus.cell.attr("role")+"']:contains('"+this._curFocus.cell.text()+"'):visible").first(),this._curFocus.cell.attr("tabindex","-1").focus().addClass("hoverCell")):(this._curFocus.cell.click(),this._curFocus.cell.removeClass("hoverCell").attr("tabindex","0"),this._curFocus.cell=n("#"+this._id).find("[p='"+this._curFocus.cell.attr("p")+"']"),this._curFocus.cell.attr("tabindex","-1").focus().addClass("hoverCell")):t.isNullOrUndefined(this._curFocus.tree)&&t.isNullOrUndefined(this._curFocus.formula)&&(t.isNullOrUndefined(this._curFocus.field)||!this._curFocus.field.hasClass("editFormula"))||n("#"+this._id).find(".e-dialog .hoverCell:visible").length>0&&(n("#"+this._id).find(".e-dialog .hoverCell:visible").click(),this._index.tree=1),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.attr("tabindex","-1").focus());i.keyCode==79&&n("#"+this._id).find(".e-dialog").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogOKBtn:visible").click(),this._index.field=0,this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,this._curFocus.tree=null,t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.mouseleave().removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),t.isNullOrUndefined(a)||a.mouseover().addClass("hoverCell").focus());i.keyCode==67&&n("#"+this._id).find(".e-dialog:visible").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogCancelBtn:visible").click(),this._index.field=0,this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,this._curFocus.tree=null,t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.mouseleave().removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),t.isNullOrUndefined(a)||a.mouseover().addClass("hoverCell").focus())},_unWireEvents:function(){this._off(this.element,"click",".colheader,.cstot,.cgtot,.calc,.stot,.gtot");this._off(n(document),"keydown",this._keyDownPress);this._off(n(document),"keyup",this._keyUpPress);this._off(this.element,"click","#preventDiv");this._off(this.element,"click",".expand, .collapse");this._off(this.element,"dblclick",".value, .summary");this._off(this.element,"mouseover",".colheader, .rowheader, .expand, .collapse");this._off(this.element,"mouseleave",".colheader, .rowheader, .expand, .collapse");this._off(this.element,"mouseover",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value, .rowheader, .colheader, .summary",this.addHyperlinkHandler);this._off(this.element,"mouseleave",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value, .rowheader, .colheader, .summary",this.removeHyperlinkHandler);this._off(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value, .rowheader, .colheader, .summary");this._off(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value .cellValue, .rowheader .cellValue, .colheader .cellValue":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue");this._off(this.element,"mouseover",".value");this._off(this.element,"mouseleave",".value");this._off(this.element,"mousedown touchstart",".value");this._off(this.element,"mouseup touchend",".value");this._off(this.element,"click",".filter");this._off(this.element,"click",".sorting");this._off(this.element,"click",".removeBtn");this._off(this.element,"mouseover",".pvtBtn");this._off(this.element,"mouseleave",".pvtBtn");n(document).off("keyup",this._endCellSelection);n(document).off("keydown",this._startCellSelection);n(document).off("click",this._clearSelection);this._off(this.element,"click",".calculatedFieldPopup .menuItem ");this._off(this.element,"contextmenu",".values .pivotButton");this._off(this.element,"click",".filter",t.proxy(this._filterBtnClick,this));this._off(this.element,"click",".sorting",t.proxy(this._sortBtnClick,this));this._off(this.element,"click",".removeBtn",t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._removePvtBtn:this._clientRemovePvtBtn,this));this._off(this.element,"click",".ascOrder, .descOrder");this._off(this.element,"click",".clearAllFilters, .clearSorting");this._off(this.element,"contextmenu");this._off(this.element,"click",".dialogOkBtn");this._off(this.element,"click",".cellSelect");this._off(this.element,"click",".columnResize");this._off(this.element,"click",".excelLikeLayout");this._off(this.element,"click",".advancedFiltering");this._off(this.element,"click",".toolTip");this._off(this.element,"click",".collapseByDefault");this._off(this.element,"click",".rtl");this._off(this.element,"click",".calculatedField");this._off(this.element,"click",".cellEditing");this._off(this.element,"click",".groupingBar");this._off(this.element,"click",".conditionalFormat");this._off(this.element,"click",".summaryCustomize");this._off(this.element,"click",".summaryTypes");this._off(this.element,"click",".numberFormatting");this._off(this.element,"click",".rowHeaderHyperLink");this._off(this.element,"click",".colHeaderHyperLink");this._off(this.element,"click",".valueCellHyperLink");this._off(this.element,"click",".summaryCellHyperLink");this._off(this.element,"click",".rowFreeze");this._off(this.element,"click",".colFreeze");this._off(this.element,"click",".bothFreeze");this._off(this.element,"click",".excel");this._off(this.element,"click",".word");this._off(this.element,"click",".pdf");this._off(this.element,"click",".csv");this._off(this.element,"click",".frozenHeaders");this._off(this.element,"click",".exporting");this._off(this.element,"click",".layouts");this._off(this.element,"click",".hyperlinkOptions");this._off(this.element,"click",".normalLayout");this._off(this.element,"click",".normalTopSummaryLayout");this._off(this.element,"click",".noSummariesLayout");this._off(this.element,"click",".drillThrough");this._off(this.element,"mousedown touchstart",".value",this._initCellSelection);this._off(this.element,"click",".colheader,.rowheader",this._headerClickCellSelection)},_getFieldName:function(i){var r;if(n(i).hasClass("colheader")||n(i).attr("role")=="columnheader"){var u=parseInt(n(i).attr("p").split(",")[1]),f=t.isNullOrUndefined(this.model.dataSource.data)||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()).PivotColumns:JSON.parse(this.getOlapReport()).PivotColumns:this.model.dataSource.columns,e=i.textContent.replace("expanded","");return u<f.length?this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?f[u].fieldName:f[u].FieldName:e}if(n(i).hasClass("rowheader")||n(i).attr("role")=="rowheader")return r=parseInt(n(i).attr("p").split(",")[0]),t.isNullOrUndefined(this.model.dataSource.data)||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.element.parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this._pivotClientObj.getOlapReport()).PivotRows[r].FieldName:JSON.parse(this.getOlapReport()).PivotRows[r].FieldName:t.isNullOrUndefined(this.model.dataSource.rows)?this.model.dataSource.rows[r].fieldName:""},_colResizing:function(t){var r,i,f,u;if(this.model.enableColumnResizing)if(this._expand)x=t.clientX,y=t.clientY,_hedBound=this.element.find("thead,.pivotGridFrozenTable,.pivotGridColValueTable").first()[0].getBoundingClientRect(),_hedBound.left+document.documentElement.scrollLeft+_hedBound.width<x||x<_hedBound.left+document.documentElement.scrollLeft?this.element.find(".e-reSizeColbg").remove():this._currentCell!=-1&&this.element.find(".e-reSizeColbg").css({left:x,top:this._tableY});else{if(this.element.find(".e-reSizeColbg").is(":visible"))return;n(t.target).attr("role")=="columnheader"?(r=this.resCell=t.target,i=r.getBoundingClientRect(),x=t.clientX,y=t.clientY,f=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(".pivotGridFrozenTable,.pivotGridColValueTable").width()+n(".pivotGridFrozenTable,.pivotGridColValueTable").find("tr").offset().left:n(this.element).find("thead").width()+n(this.element).find("thead tr").offset().left,(x>=i.left+document.documentElement.scrollLeft+r.offsetWidth-5||x<=i.left+3)&&x<f&&x>=i.left&&y<=i.top+document.documentElement.scrollTop+t.target.offsetHeight?(x>i.left+3?(u=n(t.target).find("span"),this._currentCell=t.target):(u=n(t.target).prevAll("th:visible:first").find("span"),this._currentCell=n(t.target).prev()),u.length&&n(t.target).parents(".pivotGridTable tr").css("cursor","col-resize")):(n(t.target).parent("tr").css("cursor","pointer"),this._currentCell=null)):(this.element.find("thead,.pivotGridFrozenTable,.pivotGridColValueTable tr").css("cursor","pointer"),this._currentCell=null)}},_startColResizing:function(t){var o,u;if(n(t.target).closest("tr").css("cursor")=="col-resize"&&(x=t.clientX,y=t.clientY,this._target=t.target,this._orgX=x,x+=document.documentElement.scrollLeft,t.button!=2))if(o=n(this._target).parent("tr").find("[role='columnheader']"),this._currentCell!=null&&(u=n(this._currentCell)[0].getBoundingClientRect()),_top=this._tableY=(u==r?0:u.top)+document.documentElement.scrollTop,n(this._target).closest("tr").css("cursor")=="col-resize"){var e=n(document.createElement("div")),f=this.model.enableGroupingBar?this.element.height()-this.element.find(".groupingBarPivot").height():this.element.height(),s=this.element.find("thead,.pivotGridFrozenTable,.pivotGridColValueTable").find("tr[role='row']"),h=n(this._target).parent("tr")[0]==r?0:n(this._target).parent("tr")[0].rowIndex;for(i=0;i<h;i++)f=f-n(s[i]).height();e.addClass("e-reSizeColbg").appendTo(this.element).attr("unselectable","on").css("visibility","hidden");e.css({visibility:"visible",height:f+"px",cursor:"col-resize",left:x,top:_top,position:"fixed"});this._orgX=x;this._orgY=y;this._expand=!0}else this._currentCell=null},_endColResizing:function(i){var h,c,f,e,l,a,o,s,v,p,w;if(this._expand&&(x=i.clientX,y=i.clientY),this.element.find(".e-reSizeColbg").remove(),x+=document.documentElement.scrollLeft,h=n(this._target).parents("thead,.pivotGridFrozenTable,.pivotGridColValueTable"),this._currentCell!=null&&this._expand){c=30;this._expand=!1;var r=this._currentCell,b=n(r)[0].offsetWidth,u=x-this._orgX;parseInt(u)+parseInt(b)>c&&u!=0&&(h.css("cursor","default"),f=parseInt(n(this._currentCell).attr("colspan")),e=(this.model.frozenHeaderSettings.enableFrozenHeaders||!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._JSONRecords[0].CSS=="none"?parseInt(n(r).attr("p").split(",")[0])-this._JSONRecords[0].ColSpan:this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?parseInt(n(r).attr("i").split(",")[0]):parseInt(n(r).attr("p").split(",")[0]),l=Math.round(u/f),a=this.element.find("col:eq("+e+")").width()+l,this._setWidthColResize(e,f,a),n(r).next().length&&(s=parseInt(n(r).next().attr("colspan")),o=(this.model.frozenHeaderSettings.enableFrozenHeaders||!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._JSONRecords[0].CSS=="none"?parseInt(n(r).next().attr("p").split(",")[0])-this._JSONRecords[0].ColSpan:this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?parseInt(n(r).next().attr("i").split(",")[0]):parseInt(n(r).next().attr("p").split(",")[0]),v=Math.round(u/s),p=this.element.find("col:eq("+o+")").width()-v,this._setWidthColResize(o,s,p),this.element.find("tr").css("cursor","default")))}this.model.enableGroupingBar&&this._createFields(null,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth());(this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&this._refreshScroller();!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders&&(w=this.element.find(".e-scroller").data("ejScroller"),w.model.enableTouchScroll=!1);this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.element.find("#coltable").width()<this.element.find(".valScrollArea").width()&&this.element.find("#coltable").width(this.element.find(".valScrollArea").width());this._target=null;this.element.find(".e-reSizeColbg").remove();this._expand=!1;this._currentCell=null},_setWidthColResize:function(n,t,i){for(var u=30,f=i>u?i:u,r=n;r<n+t;r++)this.element.find("colgroup").find("col:eq("+r+")").outerWidth(f)},_direction:function(n){return this.model.enableRTL&&n.indexOf("-")>-1?n.split("-").reverse().join("-"):n},_clearSelection:function(t){n(t.target).parents(".pivotGridTable").length==0&&n(this.element).find(".selected").removeClass("selected")},_startCellSelection:function(i){var f,e,u,o,r;if(this._onholdKey!="Control"&&!t.isNullOrUndefined(this._selectedCell))if(i.preventDefault(),this._onholdKey==""&&(this._onholdKey=i.which.toString()=="16"?"Shift":i.which.toString()=="17"?"Control":""),i.which=="40"){for(f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[1])+this._selectedCell.rowSpan;t.isNullOrUndefined(u)&&e<this._rowCount;)r=n(this.element).find("[p='"+f.split(",")[0]+","+e+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e++;t.isNullOrUndefined(u)||this._selectCells("Down",u)}else if(i.which=="38"){for(f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[1])-1;t.isNullOrUndefined(u)&&e>=0;)r=n(this.element).find("[p='"+f.split(",")[0]+","+e+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e--;if(t.isNullOrUndefined(u)&&this._onholdKey!="Shift"&&(n(this._selectedCell).hasClass("colheader")||n(this._selectedCell).attr("role")=="columnheader"))for(column=parseInt(f.split(",")[0])-1;column>0&&t.isNullOrUndefined(u);column--)for(row=parseInt(f.split(",")[1]-1);row>=0&&t.isNullOrUndefined(u);row--)r=n(this.element).find("[p='"+column+","+row+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r);t.isNullOrUndefined(u)||this._selectCells("Up",u)}else if(i.which=="39"){for(f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[0])+this._selectedCell.colSpan;t.isNullOrUndefined(u)&&e<Math.ceil(this.getJSONRecords().length/this._rowCount);)r=n(this.element).find("[p='"+e+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e++;t.isNullOrUndefined(u)||this._selectCells("Right",u)}else if(i.which=="37"){for(var f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[0])-1,u=n(this.element).find("[p='"+(parseInt(f.split(",")[0])-1)+","+f.split(",")[1]+"']")[0];t.isNullOrUndefined(u)&&e>=0;)r=n(this.element).find("[p='"+e+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e--;if(t.isNullOrUndefined(u)&&this._onholdKey!="Shift"&&(n(this._selectedCell).hasClass("rowheader")||n(this._selectedCell).attr("role")=="rowheader"))for(o=parseInt(f.split(",")[1])-1;t.isNullOrUndefined(u)&&o>0;)r=n(this.element).find("[p='"+parseInt(f.split(",")[0]-1)+","+o+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader")&&(u=r),o--;t.isNullOrUndefined(u)||this._selectCells("Left",u)}},_endCellSelection:function(i){var r,e,u,o,f;if(!t.isNullOrUndefined(this._selectedCell)&&(i.preventDefault(),(i.which==16||i.which==17)&&(this._onholdKey="",r=n(this.element).find(".selected"),r.length>0))){for(e=[],u=0;u<r.length;u++)o=n(r[u]).attr("p"),f=this.getJSONRecords()[parseInt(parseInt(o.split(",")[0])*this._rowCount+parseInt(o.split(",")[1]))],f.Value=n(r[u]).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f.Field=this._getFieldName(r[u])),e.push(f);this._trigger("cellSelection",{JSONRecords:e})}},_selectCells:function(i,r){var e,u,s,f,h,o,c;if(this._onholdKey=="Shift")((i=="Up"||i=="Down")&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader")||(i=="Right"||i=="Left")&&(n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"))&&(e=i=="Up"||i=="Down"?1:0,(i=="Up"||i=="Left")&&parseInt(n(r).attr("p").split(",")[e])>=parseInt(this._primaryCellPos.split(",")[e])||(i=="Right"||i=="Down")&&parseInt(n(r).attr("p").split(",")[e])<=parseInt(this._primaryCellPos.split(",")[e])?n(this._selectedCell).removeClass("selected"):n(r).attr("p")!="0,0"&&n(r).addClass("selected"));else if(n(r).attr("p")!="0,0"&&(this.element.find(".selected").removeClass("selected"),n(r).addClass("selected"),this._primaryCellPos=n(r).attr("p"),u=n(this.element).find(".selected"),u.length>0)){for(s=[],f=0;f<u.length;f++)h=n(u[f]).attr("p"),o=this.getJSONRecords()[parseInt(parseInt(h.split(",")[0])*this._rowCount+parseInt(h.split(",")[1]))],o.Value=n(u[f]).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(o.Field=this._getFieldName(u[f])),s.push(o);this._trigger("cellSelection",{JSONRecords:s})}c=i=="Up"||i=="Down"?!n(this._selectedCell).hasClass("colheader")&&n(this._selectedCell).attr("role")!="columnheader":!n(this._selectedCell).hasClass("rowheader")&&n(this._selectedCell).attr("role")!="rowheader";n(r).attr("p")!="0,0"&&(this._onholdKey!="Shift"||c)&&(this._selectedCell=r)},_sortBtnClick:function(i){var s,h,f,r,u,o,e,c;if(t.PivotAnalysis._valueSorting=null,t.isNullOrUndefined(this.model.valueSortSettings)||(this.model.valueSortSettings.headerText=null),this._isUpdateRequired=!0,n(i.delegateTarget).attr("id")==this._id&&(n(i.target).toggleClass("descending"),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".pivotButton[tag='"+n(i.target).parent().attr("tag")+"']").find(".sorting").toggleClass("descending")),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)s=n(i.target).siblings(".pvtBtn").attr("fieldName"),h=t.Pivot.getReportItemByFieldName(s,this.model.dataSource).item,h.sortOrder=i.target.className.indexOf("descending")>=0?t.PivotAnalysis.SortOrder.Descending:t.PivotAnalysis.SortOrder.Ascending,this.refreshControl();else{for(f=this._ascdes.split("##"),r=0,u=0;u<f.length;u++)f[u]==n(n(i.target).siblings(".pvtBtn")).text()&&(r=1);classNames=i.target.className;isDescending=new RegExp("descending");isDescending.test(classNames)?r==0&&(this._ascdes+=n(n(i.target).siblings(".pvtBtn")).text()+"##"):r==1&&(this._ascdes=this._ascdes.replace(n(n(i.target).siblings(".pvtBtn")).text()+"##",""));e=JSON.stringify(this.model.customObject);try{o=JSON.parse(this.getOlapReport()).Report}catch(l){o=this.getOlapReport()}this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});e=JSON.stringify(this.model.customObject);c=JSON.stringify({action:"sorting",sortedHeaders:this._ascdes,currentReport:o,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:e});this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.model.enableDeferUpdate?this._waitingPopup.hide():this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.sorting,c,this._sortingSuccess)}},calculateCellWidths:function(){var f={rowHeight:0,columnWidths:[]},r,i,u,t;if(r=this._excelLikeJSONRecords!=null?this._excelLikeJSONRecords.length/this._excelRowCount:this.getJSONRecords()!=null?this.getJSONRecords().length/this._rowCount:0,i=1,u=!1,r>0)for(f.rowHeight=this.element.find("tbody tr:visible").length>0?this.element.find("tbody tr:visible").outerHeight():0,t=0;t<r&&i<=r;t++)n(this._excelLikeJSONRecords!=null?this.element.find("th[i^="+t+"]:visible"):this.element.find("th[p^="+t+"]:visible")).each(function(){if(n(this).length>0&&n(this).attr("colspan")==i&&(n(this).attr("i")!=null?n(this).attr("i").split(",")[0]==t:n(this).attr("p").split(",")[0]==t))return f.columnWidths.push(n(this).outerWidth()),t+=i-1,i=1,u=!0,!1;u=!1}),u||i==r?i=1:(t--,i++);return f},_deferUpdate:function(){var i,r,n,u,f;if(!this._isUpdateRequired)return!1;this._isUpdateRequired=!1;try{i=JSON.parse(this.getOlapReport()).Report}catch(e){i=this.getOlapReport()}for(r="",n=0;n<this._filterUpdate.length;n++)r+=this._filterUpdate[n]+"%%";u=JSON.stringify(this.model.customObject);f=JSON.stringify({action:"deferUpdate",sortedHeaders:this._ascdes,filterParams:r,currentReport:i,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:u});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.deferUpdate,f,this._renderControlSuccess);this._filterUpdate=[];this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()},_dialogBtnClick:function(i){var l,b,h,k,e,ut,d,g,o,y,u,ft,p,tt,it,et,c,rt;if(this.element.find(".e-dialog, .clientDialog").hide(),i.model.text.toLowerCase()=="cancel"||!this._isMembersFiltered)return t.Pivot.closePreventPanel(this),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style"),!1;if(this._isUpdateRequired=!0,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)l=[],b=[],this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueSorting=null,jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:checked"),function(n,t){t.value!="All"&&l.push(t.value)}),jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:not(:checked)"),function(n,t){b.push(t.value=t.value=="(blank)"?"":t.value)}),this._pivotFilterItems(l,b),e=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,e&&(e.advancedFilter=[]),this.model.editCellsInfo={},this._populatePivotGrid()):(this._waitingPopup.show(),h=this._selectedField.toLocaleLowerCase(),this._currentReportItems=n.grep(this._currentReportItems,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()!=h)return n}),this._memberTreeObj=t.Pivot.updateTreeView(this),k=t.Pivot.getNodesState(this._memberTreeObj),this._schemaData!=null&&(this._schemaData._memberTreeObj=this._memberTreeObj),this._currentReportItems.push({filterItems:this._memberTreeObj.dataSource(),fieldName:this._selectedField}),l=n.map(k.selectedNodes.split("::"),function(n){return{Id:n.split("||")[0],tag:n.split("||")[1],parentId:n.split("||")[2]}}),this.model.enableGroupingBar&&(o=t.Pivot._getEditorMember(h,this,!1),this._fieldSelectedMembers[h]=n.map(this._fieldMembers[h],function(n){if(!n.checked)return n}).length==0?"All":o!="All"&&o!="multiple"?o:this._getLocalizedLabels("MultipleItems")),e=t.Pivot.getReportItemByFieldName(h,this.model.dataSource).item,t.isNullOrUndefined(e)||(k.unSelectedNodes!=""?(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"filtering"},this),e.advancedFilter=[],e.filterItems={filterType:"include",values:this._removeSelectedNodes(l)},this.element.find(".pivotButton:contains('"+this._selectedField+"') .filter").addClass("filtered"),this._schemaData!=null&&this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedField+"'] .filter").length==0&&(this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedField+"'] div:first .e-text").after(t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").addClass("filtered"))):(delete e.filterItems,this._schemaData!=null&&(this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedField+"'] .filter").remove(),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").removeClass("filtered")))),this.getJSONData({action:"filtering"},this.model.dataSource,this));else{ut="";d="";d=this.element.find(".editorTreeView :input.nodecheckbox");var a=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?ut=this._getUnSelectedNodes()+"FILTERED"+this._getSelectedNodes(this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._curFilteredAxis=="Slicers"?!0:!1:this._curFilteredAxis=="Filter"?!0:!1):this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),w=!1,s=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?a:this._curFilteredAxis+"::"+this._curFilteredText+"::FILTERED",f=this._curFilteredText,nt=[],v={};if(g=this._getUnSelectedNodes()!=""?!0:!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){for(this.model.enableGroupingBar&&t.isNullOrUndefined(this._fieldMembers[f])&&(this._fieldMembers[f]=t.Pivot._getEditorMember(d,this,!1)),this._removeFilterTag(this._curFilteredText),u=0;u<a.length;u++)nt.push(n(a[u].parentElement).siblings("a").text());for(v[f]=nt,t.isNullOrUndefined(this._tempFilterData)&&(this._tempFilterData=[]),u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][f])||(this._tempFilterData[u][f]=nt,w=!0);if(w||this._tempFilterData.push(v),this._schemaData!=null&&(this._schemaData._tempFilterData=this._tempFilterData),t.isNullOrUndefined(this._curFilteredAxis)||this._curFilteredAxis!="")for(u=0;u<a.length;u++)s+="##"+n(a[u].parentElement).siblings("a").text()}else{for(this.model.enableGroupingBar&&(o=t.Pivot._getEditorMember(f.split(":")[1],this,!1),this._fieldSelectedMembers[f.split(":")[1]]=n.map(this._fieldMembers[f.split(":")[1]],function(n){if(!n.checked)return n}).length==0?"All":o!="All"&&o!="multiple"?o:this._getLocalizedLabels("MultipleItems")),v[this._curFilteredText.split(":")[1]]=s,t.isNullOrUndefined(this._tempFilterData)&&(this._tempFilterData=[]),u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][this._curFilteredText.split(":")[1]])||(this._tempFilterData[u]=v,w=!0);w||this._tempFilterData.push(v)}if(filteredBtn=this.model.layout=="excel"?this.element.find(".schemaFieldTree li:contains('"+this._curFilteredText+"')"):this.element.find("."+this._curFilteredAxis+" .pivotButton:contains("+this._curFilteredText+") .filterBtn"),y=this._curFilteredText,this.model.layout==t.PivotGrid.Layout.Normal&&this._schemaData!=null){for(u=0;u<this._schemaData.element.find(".fieldTable").find("li").length;u++)this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._curFilteredText.split(":")[1]==n(this._schemaData.element.find(".fieldTable").find("li")[u]).attr("tag").replace(/\]/g,"").replace(/\[/g,"")&&(this._schemaData._selectedTreeNode=this._schemaData.element.find(".fieldTable").find("li")[u],y=this._curFilteredText.split(":")[1].split(".")[1]):this._curFilteredText==this._schemaData.element.find(".fieldTable").find("li")[u].id&&(this._schemaData._selectedTreeNode=this._schemaData.element.find(".fieldTable").find("li")[u],y=this._curFilteredText);if(n(this._schemaData._selectedTreeNode).parents("li:eq(0)").children().children("span").hasClass("hierarchyCDB")&&(this._schemaData._selectedTreeNode=n(n(this._schemaData._selectedTreeNode).parents("li:eq(0)"))),g&&n(this._schemaData._selectedTreeNode).find(".filter").length<=0?(ft=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,n(n(this._schemaData._selectedTreeNode).find(".e-text")[0]).after(ft),this._schemaData.element.find(".pvtBtn:contains('"+y+"')").parent().find(".filter").addClass("filtered")):g||(n(this._schemaData._selectedTreeNode).find(".filter").remove(),this._schemaData.element.find(".pvtBtn:contains('"+y+"')").parent().find(".filter").removeClass("filtered")),this._curFilteredAxis=="")return!1}try{p=JSON.parse(this.getOlapReport()).Report}catch(ot){p=this.getOlapReport()}if(this.model.enableAdvancedFilter&&this._selectedLevelUniqueName&&this._selectedLevelUniqueName.split("].").length==3&&(tt=this._getAdvancedFilterInfo(this._selectedLevelUniqueName.split("].").slice(0,2).join(".").replace(/\[/g,"")),tt.length>0&&this._removeFilterTag(tt[0].levelUniqueName)),this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject}),it=JSON.stringify(this.model.customObject),et=this.model.customObject!={}&&s!=""?JSON.stringify({action:"filtering",filterParams:s,sortedHeaders:this._ascdes,currentReport:p,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:it,gridLayout:this.model.layout}):this.model.customObject!={}?JSON.stringify({action:"filtering",currentReport:p,customObject:it,gridLayout:this.model.layout}):s!=""?JSON.stringify({action:"filtering",filterParams:s,sortedHeaders:this._ascdes,currentReport:p,gridLayout:this.model.layout}):JSON.stringify({action:"filtering"}),this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").addClass("freeze").width(n(this._schemaData.element).width()).height(n(this._schemaData.element).height()).css({top:n(this._schemaData.element).offset().top,left:n(this._schemaData.element).offset().left}),this.model.enableDeferUpdate){if(this._filterUpdate.push(s),n.each(this.element.find(".pivotButton .filter"),function(t,i){n(i).removeClass("filtered")}),!t.isNullOrUndefined(this._tempFilterData))for(c=0;c<this._tempFilterData.length;c++)for(rt in this._tempFilterData[c])this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?rt==f.split(":")[1]&&this._tempFilterData[c][f.split(":")[1]].split("FILTERED::")[0].length>0&&this.element.find(".pivotButton[tag='"+f+"']").find("span.filter").addClass("filtered"):rt==f&&this._tempFilterData[c][f].length>0&&this.element.find("#pivotButton"+f).next().addClass("filtered");t.Pivot.closePreventPanel(this);t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")}else this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,et,this._filterElementSuccess)}t.isNullOrUndefined(this._schemaData)||this._schemaData._refreshPivotButtons()},_removeSelectedNodes:function(t){for(var i,u=n.extend([],t),f=0;f<t.length;f++)for(i=0;i<u.length;i++)u[i].Id==t[f].parentId&&u.splice(i,1);return n.map(u,function(n){if(n.tag!=""&&n.tag!=r)return n.tag.replace(/\&/g,"&")})},_pivotFilterItems:function(i,r){var s=this.model.dataSource[this._selectedAxis=="Slicers"?"filters":this._selectedAxis.toLowerCase()],f=t.PivotAnalysis.getMembers(this._selectedField),u,o;jQuery.each(f,function(n,t){t!=null&&t.toString().replace(/^\s+|\s+$/gm,"")||jQuery.each(r,function(n,i){i.toString().replace(/^\s+|\s+$/gm,"")||(r[n]=t)})});var h=this._selectedField,c=this._dialogTitle,e=n.grep(s,function(n){return n.fieldName==h});for(u=0;u<e.length;u++)e[u].filterItems=i.length==f.length?null:{filterType:t.PivotAnalysis.FilterType.Exclude,values:r};this._schemaData!=null&&(r.length>0&&this._schemaData.element.find(".schemaFieldTree li[id='"+this._selectedField+"']").find(".filter").length<=0?(o=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,this._schemaData.element.find(".schemaFieldTree li[id='"+this._selectedField+"']").find(".e-text").after(o),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").addClass("filtered")):r.length==0&&(this._schemaData.element.find(".schemaFieldTree li[id='"+this._selectedField+"']").find(".filter").remove(),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").removeClass("filtered")))},_getUnSelectedNodes:function(){var e=this.element.find(".editorTreeView")[0],f="",r=n(e).find(":input.nodecheckbox:not(:checked)"),i,u;if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)for(i=0;i<r.length;i++)n(r[i].parentElement).find("span:nth-child(1)").attr("class").indexOf("e-chk-act")>-1||n(r[i].parentElement).attr("aria-checked")=="mixed"||(u=n(r[i]).parents("li:eq(0)"),f+="::"+u[0].id+"||"+n(u).attr("tag"));return f},_getSelectedNodes:function(i){var o,e,f,h,c,s,u,r;if(i){for(this.element.find(".editorTreeView").length>0?o=this.element.find(".editorTreeView")[0].childNodes[0]:t.isNullOrUndefined(this._schemaData)||(o=this._memberTreeObj.element[0].childNodes[0]),e=[],f=n(o).children(),u=0;u<f.length;u++){if(r=f[u],h={caption:n(r.firstChild).find("a").text(),parentId:r.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(r).parents()[1].id,id:r.id,checked:n(r).find(":input.nodecheckbox")[0].checked||n(r).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(r.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(r).attr("tag")},n(r).find("ul:first").children().length>0)for(c=n(r).find("ul:first").children(),s=0;s<c.length;s++)h.childNodes.push(this._getNodeInfo(c[s]));e.push(h)}return JSON.stringify(e)}var o=this.element.find(".editorTreeView")[0],e="",f=n(o).find(":input.nodecheckbox");for(u=0;u<f.length;u++)(f[u].checked||n(f[u].parentElement).attr("aria-checked")=="mixed")&&(r=n(f[u]).parents("li:eq(0)"),e+="::"+r[0].id+"||"+n(r).attr("tag"));return e},_getNodeInfo:function(t){var u={caption:n(t.firstChild).find("a").text(),parentId:t.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(t).parents()[1].id,id:t.id,checked:n(t).find(":input.nodecheckbox")[0].checked||n(t).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(t.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(t).attr("tag")},r,i;if(n(t).find("ul:first").children().length>0)for(r=n(t).find("ul:first").children(),i=0;i<r.length;i++)u.childNodes.push(this._getNodeInfo(r[i]));return u},_getLevelInfo:function(t,i){var r=n.map(n(i).find("row"),function(i){if(parseInt(n(i).children("LEVEL_TYPE").text())!="1"&&n(i).children("HIERARCHY_UNIQUE_NAME").text().toLowerCase()!="[measures]"&&n(i).find("HIERARCHY_UNIQUE_NAME").text()==t.hierarchy)return{value:n(i).find("LEVEL_UNIQUE_NAME").text(),text:n(i).find("LEVEL_CAPTION").text()}});this.olapCtrlObj._currentReportItems.push({fieldName:t.hierarchy,dropdownData:r})},_sortField:function(i){var u,r;if(this.element.find(".e-dialog, .clientDialog").remove(),t.Pivot.closePreventPanel(this),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)return u=this._selectedField,this._ascdes=this._ascdes+u+"##",n(i.element).attr("id")!="descOrder"&&(this._ascdes=n.grep(this._ascdes.split("##"),function(n){return n!=u}).join("##")),this._applySorting(),!1;r=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item;r.sortOrder=n(i.element).attr("id")=="descOrder"?t.PivotAnalysis.SortOrder.Descending:t.PivotAnalysis.SortOrder.Ascending;this.refreshControl()}else t.olap.base._clearDrilledCellSet(),(n(i.element).attr("id")=="descOrder"||n(i.element).attr("id")=="ascOrder")&&(r=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,r.sortOrder=n(i.element).attr("id")=="descOrder"?t.olap.SortOrder.Descending:t.olap.SortOrder.Ascending,this._waitingPopup.show(),t.olap.base.getJSONData({action:"sorting"},this.model.dataSource,this))},_applySorting:function(){var i=JSON.stringify(this.model.customObject),n,r;try{n=JSON.parse(this.getOlapReport()).Report}catch(u){n=this.getOlapReport()}this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});i=JSON.stringify(this.model.customObject);r=JSON.stringify({action:"sorting",sortedHeaders:this._ascdes,currentReport:n,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:i});this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.model.enableDeferUpdate?t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide():this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.sorting,r,this._sortingSuccess)},_createDialog:function(i,r){var f=this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter,p=!1,o,s,a,g,nt,h,c,v,tt,y,u,it,rt,ut,l;f&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this._selectedField=this._curFilteredText,this._curFilteredAxis!="Slicers"&&(p=this._getAdvancedFilterInfo(this._curFilteredText).length>0),f=this.element.find(".pivotButton button[fieldname='"+this._curFilteredText+"']").parents("div:eq(0)").hasClass("drag")?!1:!0):f=f&&!this.element.find(".pivotButton[tag='"+this._curFilteredText+"']").parents("div:eq(0)").hasClass("drag")?!0:!1:f=f&&t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).axis!="filters"?!0:!1);this.element.find(".e-dialog, .clientDialog").remove();var w=this._selectedField,e,b="",k="",d="",st=n(document).height();f&&(s=JSON.parse(r),s[0].name="(Select All)",this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(e=s.splice(s.length-1,1),e=JSON.parse(e[0].levels)):this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(e=n.map(this._currentReportItems,function(n){if(n.fieldName==w)return n.dropdownData}),e.length==0&&(a=this._getConnectionInfo(this.model.dataSource.data),g='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_LEVELS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+this.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+this.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+this.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+a.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",this.doAjaxPost("POST",a.url,{XMLA:g},this._getLevelInfo,null,{pvtGridObj:this,action:"loadFieldElements",hierarchy:this._selectedField}),e=n.map(this._currentReportItems,function(n){if(n.fieldName==w)return n.dropdownData}))):e=[{value:this._selectedField,text:this._selectedField}],r=JSON.stringify(s),b=t.buildTag("div.ddlGroupWrap",this._getLocalizedLabels("SelectField")+t.buildTag("input#GroupLabelDrop.groupLabelDrop").attr("type","text")[0].outerHTML,{})[0].outerHTML,k=t.buildTag("ul.filterElementTag")[0].outerHTML,nt=t.Pivot.createAdvanceFilterTag({action:"filterTag"},this));d=t.buildTag("div.memberSearchEditorDiv",t.buildTag("input#searchEditorTreeView.searchEditorTreeView").attr("type","text")[0].outerHTML,{padding:f?"5px 5px 0px 9px":"0px"})[0].outerHTML;var ft=t.buildTag("div#EditorDiv.editorDiv",b+t.buildTag("div",k+d+t.buildTag("div.memberEditorDiv",t.buildTag("div#editorTreeView.editorTreeView")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML+"<\/br>",et=t.buildTag("div",t.buildTag("button#OKBtn.dialogOKBtn",this._getLocalizedLabels("OK"))[0].outerHTML+t.buildTag("button#CancelBtn.dialogCancelBtn",this._getLocalizedLabels("Cancel"))[0].outerHTML,{float:"right",margin:"-5px "+(f?" 5px 11px ":"0px 5px ")+" 0px"})[0].outerHTML,ot=t.buildTag("div#clientDialog.clientDialog",ft+et,{opacity:"1"}).attr("title",i)[0].outerHTML,r=JSON.parse(r);for(u=0;u<r.length;u++)r[u].name!=null&&r[u].name.toString().replace(/^\s+|\s+$/gm,"")||(r[u].name="(blank)",r[u].id="(blank)");if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!t.isNullOrUndefined(this._fieldMembers):!t.isNullOrUndefined(this._tempFilterData)){if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(u=0;u<Object.keys(this._fieldMembers).length;u++)t.isNullOrUndefined(this._fieldMembers[this._curFilteredText.split(":")[1]])||(h=n.map(this._fieldMembers[this._curFilteredText.split(":")[1]],function(n){if(!n.checked)return n.name}));else for(u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][i])||(h=this._tempFilterData[u][i]);if(!t.isNullOrUndefined(h))for(u=0;u<h.length;u++)for(c=0;c<r.length;c++)h[u]==r[c].name&&(r[c].checkedStatus=!1)}for(n(ot).appendTo("#"+this._id),this.element.find("#searchEditorTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search")+" "+i,maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),this.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:this.model.enableRTL,beforeDelete:function(){return!1},height:n(".memberEditorDiv").height(),fields:{id:"id",text:"name",isChecked:"checkedStatus",hasChild:"hasChildren",dataSource:r}}),f&&(o=this.element.find("[tag*='"+(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._selectedField:this._curFilteredText)+"']").offset(),this.element.find(".filterElementTag").ejMenu({fields:{dataSource:nt,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.NormalMenu,enableRTL:this.model.enableRTL,width:"100%",orientation:t.Orientation.Vertical,click:t.proxy(this._filterElementClick,this)}),this.element.find(".groupLabelDrop").ejDropDownList({width:"99%",enableRTL:this.model.enableRTL,dataSource:e,fields:{id:"id",text:"text",value:"value"},change:t.proxy(this._groupLabelChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),v=this.element.find(".groupLabelDrop").data("ejDropDownList"),v.selectItemByText(v.model.dataSource[0].text),this.element.find(".memberEditorDiv").addClass("advancedFilter")),p&&this.element.find(".editorTreeView").data("ejTreeView").checkAll(),tt=n.grep(r,function(n){if(n.hasChildren==!0)return n}).length>0,tt||this.element.find(".memberEditorDiv").addClass("noChildNode"),y=this.element.find(".editorTreeView").find("li"),u=0;u<y.length;u++)y[u].setAttribute("tag",r[u].tag);this.element.find(".dialogOKBtn, .dialogCancelBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(this._dialogBtnClick,this)});this._dialogOKBtnObj=this.element.find(".dialogOKBtn").data("ejButton");this._memberTreeObj=this.element.find(".editorTreeView").data("ejTreeView");it=this.element.find(".editorTreeView li:gt(0)");rt=n(it).find(":input.nodecheckbox:not(:checked)");rt.length>0&&(ut=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),n(ut).removeClass("e-checkmark").addClass("e-stop"));this.element.find(".clientDialog").ejDialog({width:f?"auto":265,target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,this)});this.element.find("#clientDialog_wrapper").css("top",this.element[0].offsetTop+20);this.element.find(".clientDialog").next(".e-scrollbar").hide();f&&(this.element.find("#clientDialog_wrapper").addClass("advancedFilterDlg"),l=n(".cols-sample-area").position(),l&&l.left>0?this.element.find("#clientDialog_wrapper").css({left:o.left+50-l.left,top:o.top}):t.isNullOrUndefined(o)||this.element.find("#clientDialog_wrapper").css({left:o.left+50,top:o.top}),this.element.find(".clientDialog").css({padding:"0px","min-width":"265px"}).parents().find(".e-titlebar").remove());this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this);this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this);this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this._memberTreeObj.model.beforeExpand=t.proxy(this._beforeNodeExpand,this):this._memberTreeObj.model.nodeClick=t.proxy(this._nodeExpand,this));this._memberTreeObj.element.find(".e-plus").length==0&&this._memberTreeObj.element.find(".e-item").css("padding","0px");this._isMembersFiltered=!1;this._unWireEvents();this._wireEvents();this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"));this.element.find(".e-dialog .e-close").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");t.isNullOrUndefined(i._schemaData)||i._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")})},_clearSorting:function(i){var u;if(n(i.target).parent().attr("disabled")=="disabled")return!1;if(t.Pivot.closePreventPanel(this),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._sortField(i):(u=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,u.sortOrder=t.PivotAnalysis.SortOrder.None,this.refreshControl());else{var f=this.model.dataSource,e=this._selectedField.toLowerCase(),u=n.map(f.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==e)return n});u.length==0&&(u=n.map(f.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==e)return n}));u.length>0&&delete u[0].sortOrder;this.model.dataSource=f;this.element.find(".e-dialog").remove();this.element.find("#preventDiv").remove();this._schemaData!=null&&this._schemaData.element.find(".e-dialog").remove();this._waitingPopup.show();this.getJSONData({action:"clearSorting"},this.model.dataSource,this)}},_clearAllFilters:function(i){var e,s,h,c,l,a;if(n(i.target).parent().attr("disabled")=="disabled")return!1;if(t.Pivot.closePreventPanel(this),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){var o=this.model.dataSource,f=this._selectedField.toLowerCase(),u=n.map(o.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==f)return n});u.length==0&&(u=n.map(o.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==f)return n}));u.length>0&&(e=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):this._schemaData==null?null:this._schemaData.element.find(".groupLabelDrop").data("ejDropDownList"),e!=null?(u[0].advancedFilter&&(u[0].advancedFilter=n.map(u[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLowerCase()!=e.getSelectedValue().toLowerCase())return n})),this._schemaData!=null&&(u[0].advancedFilter&&u[0].advancedFilter.length==0&&this._schemaData._tableTreeObj.element.find("li[tag ='"+u[0].fileName+"'] div:eq(0) .filter").remove(),this._schemaData._tableTreeObj.element.find("li[tag='"+e.getSelectedValue()+"'] div:eq(0) .filter").remove())):delete u[0].advancedFilter,delete u[0].filterItems);this._currentReportItems=n.grep(this._currentReportItems,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()!=f)return n});this.model.dataSource=o;this.element.find(".e-dialog").remove();this.element.find("#preventDiv").remove();this._schemaData!=null&&(this._schemaData._tableTreeObj.element.find("li[tag ='"+this._selectedField+"'] .filter").remove(),this._schemaData.element.find(".e-dialog").remove());this._waitingPopup.show();this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()!=f)return n}),this.refreshControl()):this.getJSONData({action:"advancedfiltering"},this.model.dataSource,this)}else{try{s=JSON.parse(this.getOlapReport()).Report}catch(v){s=this.getOlapReport()}h=this._curFilteredAxis+"::"+this._curFilteredText+"## Clear Filter";this._removeFilterTag(this._curFilteredText);c=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[c])return n});l=JSON.stringify(this.model.customObject);a=JSON.stringify({action:"labelfiltering",filterParams:h,sortedHeaders:this._ascdes,currentReport:s,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:l,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,a,this._filterElementSuccess)}},_removeFilterTag:function(i){var r=this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot,u;(i.indexOf("].")>=0||r)&&(u=i.split("].").length>2||r?"levelUniqueName":"hierarchyUniqueName",this._excelFilterInfo.length>0&&(levelName=this._selectedLevelUniqueName,hierarchyName=this._selectedFieldName,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n[u]!=i)return n})))},_groupLabelChange:function(i){var r=this.element.find(".filterElementTag").data("ejMenu"),a,p,c,w,e;if(r.disableItemByID("labelClearFilter"),r.disableItemByID("valueClearFilter"),r.disableItemByID("clearAllFilters"),r.disableItemByID("clearSorting"),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){var f=this.element.hasClass("e-pivotschemadesigner")?this.model.pivotControl:this,b=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):[],s=f._getAdvancedFiltervalue(f._selectedField,b.getSelectedValue()),v=t.Pivot.getReportItemByFieldName(f._selectedField,f.model.dataSource).item,h=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,y=t.buildTag("span.activeFilter").addClass("e-icon")[0].outerHTML,o=t.Pivot.getReportItemByFieldName(f._selectedField,f.model.dataSource).item,l;o&&o.sortOrder&&o.sortOrder!=t.olap.SortOrder.None&&(l=o&&o.sortOrder==t.olap.SortOrder.Descending?"desc":"asc",t.isNullOrUndefined(l)||l=="asc"?this.element.find(".clientDialog .ascImage").addClass("selectedSort"):this.element.find(".clientDialog .descImage").addClass("selectedSort"),r.enableItemByID("clearSorting"));this.element.find(".filterState,.activeFilter").remove();c=this.element.find("#clearAllFilters a").children().clone();this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(c);s.length>0?(s[0].advancedFilterType==t.Pivot.AdvancedFilterType.LabelFilter?(this.element.find("#labelFilterBtn a:eq(0)").append(h),this.element.find("#labelFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#labelFilterBtn li#"+s[0].labelFilterOperator+" a").append(y),r.enableItemByID("labelClearFilter")):(this.element.find("#valueFilterBtn a:eq(0)").append(h),this.element.find("#valueFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#valueFilterBtn li#"+s[0].valueFilterOperator+" a").append(y),r.enableItemByID("valueClearFilter")),r.enableItemByID("clearAllFilters")):v&&v.filterItems&&(this.element.find(".memberEditorDiv").before(h),this.element.find(".filterState").addClass("memberFilter").css("visibility","hidden"),r.enableItemByID("clearAllFilters"))}else{var a=this._selectedLevelUniqueName=i.selectedValue,h=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,u=[];this._excelFilterInfo.length>0&&(a=this._selectedLevelUniqueName,p=this._selectedFieldName,u=n.map(this._excelFilterInfo,function(n){if(n.hierarchyUniqueName==p&&n.levelUniqueName==a)return{action:n.action,operator:n.operator,value1:n.value1}}));this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(c=this.element.find("#clearAllFilters a").children().clone(),this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(c),w=n.grep(this._ascdes.split("##"),function(n){if(n==a)return n}),w.length>0?(this.element.find(".descImage").addClass("selectedSort"),r.enableItemByID("clearSorting")):this.element.find(".ascImage").addClass("selectedSort"));this.element.find(".filterElementTag .activeFilter,.filterIndicator").remove();u.length>0&&!t.isNullOrUndefined(u[0].operator)?(r.enableItemByID("clearAllFilters"),e="",u[0].action=="valuefiltering"?(e="valueFilterBtn",r.enableItemByID("valueClearFilter")):(e="labelFilterBtn",r.enableItemByID("labelClearFilter")),this.element.find("#"+e+" a:eq(0)").append(h),u[0].operator.replace(/ /g,"")=="BottomCount"?this.element.find("#"+e+" li#"+u[0].operator.replace(/ /g,"").replace("Bottom","top")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML)):this.element.find("#"+e+" li#"+u[0].operator.replace(/ /g,"")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML))):this._getUnSelectedNodes()!=""&&(this.element.find(".memberEditorDiv").before("<div class='filterState e-icon' style='margin-top:5px;position:absolute;visibility:hidden' />"),r.enableItemByID("clearAllFilters"))}},_getAdvancedFiltervalue:function(i,u){var f=t.Pivot.getReportItemByFieldName(i,this.model.dataSource).item,e=[];return f&&f.advancedFilter&&(e=n.map(f.advancedFilter,function(n){if(n.name!=r&&n.name.toLocaleLowerCase()==u.toLowerCase())return n})),e},_filterElementClick:function(i,u){var l,o,s,h,c,a,p,f,e;if(i.ID=="labelFilterBtn"||i.ID=="valueFilterBtn")return!1;if(l=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):u.element.find(".groupLabelDrop").data("ejDropDownList"),this._selectedLevelUniqueName=l.getSelectedValue(),i.ID=="clearAllFilters"||i.ID=="valueClearFilter"&&this.model.analysisMode=="pivot"&&this.model.operationalMode=="servermode"){if(this._clearAllFilters(i),i.ID=="valueClearFilter"&&this.model.analysisMode=="pivot"&&this.model.operationalMode=="servermode")return!1}else i.ID=="clearSorting"?this._clearSorting(i):(i.ID=="ascOrder"||i.ID=="descOrder")&&this._sortField(i);if(this.element.find(".e-dialog, .filterDialog, #preventDiv").remove(),this._schemaData!=null&&this._schemaData.element.find(".e-dialog").remove(),!n(i.element).parent().hasClass("filterElementTag")&&i.ID!="ascOrder"&&i.ID!="descOrder"&&i.ID!="clearSorting"&&i.ID!="clearAllFilters")if(o=this._selectedField,this._filterAction=t.isNullOrUndefined(i.element)?t.isNullOrUndefined(i.parentId)&&(t.isNullOrUndefined(i.menuId)||i.menuId=="")?n(i.selectedItem).attr("id")=="valueFilterBtn"?"valueFiltering":n(i.selectedItem).attr("id")=="labelFilterBtn"?"labelFiltering":"":i.parentId=="valueFilterBtn"?"valueFiltering":i.menuId=="labelFilterBtn"?"labelFiltering":"":n(i.element).parents("#valueFilterBtn").length==0?"labelFiltering":"valueFiltering",n.trim(i.text)==n.trim(this._getLocalizedLabels("ClearFilter")))if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode){this._removeFilterTag(this._selectedLevelUniqueName);try{s=JSON.parse(this.getOlapReport()).Report}catch(b){s=this.getOlapReport()}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)h=JSON.stringify(this.model.customObject),c=JSON.stringify({action:this._filterAction.toLowerCase(),filterParams:this._selectedLevelUniqueName+"--Clear Filter",currentReport:s,customObject:h,gridLayout:this.model.layout}),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,c,this._filterElementSuccess);else{a=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[a])return n});var w=this._curFilteredAxis+"::"+this._curFilteredText+"## Clear Filter",h=JSON.stringify(this.model.customObject),c=JSON.stringify({action:this._filterAction.toLowerCase(),filterParams:w,sortedHeaders:this._ascdes,currentReport:s,customObject:h,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,c,this._filterElementSuccess)}}else{t.Pivot.closePreventPanel(this);var v=this._selectedLevelUniqueName.toLowerCase(),y=[],f=n.map(this.model.dataSource.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n});return f.length==0&&(f=n.map(this.model.dataSource.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n})),t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()!=o.toLowerCase())return n}),f.length>0&&(f[0].advancedFilter&&(y=n.map(f[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLowerCase()!=v)return n})),f[0].advancedFilter=y,this._schemaData&&(f[0].advancedFilter.length==0&&this._schemaData._tableTreeObj.element.find("li[tag ='"+o+"'] div:eq(0) .filter").remove(),this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedLevelUniqueName+"'] div:eq(0) .filter").remove())),this._waitingPopup.show(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.refreshControl():this.getJSONData({action:"advancedfiltering"},this.model.dataSource,this),!1}else this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(e=[],p=this._selectedLevelUniqueName,this._excelFilterInfo.length>0&&n(i.element).siblings("li:eq(0)").attr("disable")!="true"&&(e=n.map(this._excelFilterInfo,function(n){if(n.levelUniqueName==p)return{value1:n.value1,value2:n.value2,operator:n.operator,measure:n.measure}}),e.length>0&&i.ID!=e[0].operator.replace(/ /g,"")&&(e=[])),t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:i,filterInfo:e},this)):(f=n.map(this.model.dataSource.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n}),f.length==0&&(f=n.map(this.model.dataSource.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n})),e=[],f[0].advancedFilter&&(e=n.map(f[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLowerCase()!=v)return n})),t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:i,filterInfo:e},this))},_filterOptionChanged:function(i){var r=this._getAdvancedFiltervalue(this._selectedField,this._selectedLevelUniqueName),u;r=r.length>0?r[0].advancedFilterType=="label"&&i.value.replace(/ /g,"")==r[0].labelFilterOperator?r[0].values:r[0].advancedFilterType=="value"&&i.value.replace(/ /g,"")==r[0].valueFilterOperator?r[0].values:[""]:[""];u=this.element.find(".filterValuesTd")[0];i.value.toLowerCase().indexOf("between")>=0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/> <span>"+this._getLocalizedLabels("and")+"<\/span> <input type='text' id='filterValue2' value='"+(t.isNullOrUndefined(r[1])?"":r[1])+"' class='filterValues' style='display:inline' /> <\/br>");i.value.toLowerCase().indexOf("between")<0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/>")},_filterElementOkBtnClick:function(){var c,a,v,p,y,nt,f;t.Pivot.closePreventPanel(this);var e=this.element.find(".filterOptions")[0].value,i=[this.element.find("#filterValue1")[0].value],u,l=[],s=this._selectedField;if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode){var tt=i[0].value,w=this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:"",u,o,h=this._filterAction.toLowerCase();if(o=this._selectedLevelUniqueName+"--"+e+"--"+i[0],this.element.find(".filterMeasures").length>0&&(this.element.find("#filterValue2").length>0&&(o=o+","+w),u=this.element.find(".filterMeasures").data("ejDropDownList").model.value,o=o+"--"+u,h="valuefiltering",u==null))return;try{c=JSON.parse(this.getOlapReport()).Report}catch(it){c=this.getOlapReport()}if(a=JSON.stringify(this.model.customObject),v=JSON.stringify({action:h,filterParams:o,currentReport:c,customObject:a,gridLayout:this.model.layout}),this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").addClass("freeze").width(n(this._schemaData.element).width()).height(n(this._schemaData.element).height()).css({top:n(this._schemaData.element).offset().top,left:n(this._schemaData.element).offset().left}),p=this._curFilteredText.indexOf(":")>-1?this._curFilteredText.split(":")[1]:"",p!=""&&this._tempFilterData&&(this._tempFilterData=n.grep(this._tempFilterData,function(n){if(t.isNullOrUndefined(n[p]))return n})),this._removeFilterTag(this._selectedLevelUniqueName),this._excelFilterInfo.push({action:h,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:e,measure:u,value1:i[0],value2:w}),this.model.analysisMode==t.Pivot.AnalysisMode.Olap)this.model.enableDeferUpdate||this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,v,this._filterElementSuccess);else if(this._filterAction=="labelFiltering"){y=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[y])return n});var b=this._curFilteredAxis+"::"+this._curFilteredText+"##"+e+"::"+i[0],a=JSON.stringify(this.model.customObject),v=JSON.stringify({action:h,filterParams:b,sortedHeaders:this._ascdes,currentReport:c,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:a,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,v,this._filterElementSuccess)}else{y=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[y])return n});this._measureDDL=this.element.find(".filterMeasures").data("ejDropDownList");u=this._measureDDL.getSelectedValue();var b=this._curFilteredText+"::"+e+"::"+u+"::"+i[0]+"::"+(this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:""),a=JSON.stringify(this.model.customObject),v=JSON.stringify({action:h,filterParams:b,sortedHeaders:this._ascdes,currentReport:c,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:a,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,v,this._filterElementSuccess)}return!1}if(this._filterAction=="valueFiltering"){if(this._measureDDL=this.element.find(".filterMeasures").data("ejDropDownList"),u=this._measureDDL.getSelectedValue(),!(!isNaN(parseFloat(i[0]))&&isFinite(i[0]))||u=="")return;this.element.find("#filterValue2")[0]!=r?","+i.push(this.element.find("#filterValue2")[0].value):i}if(this.element.find(".e-dialog").remove(),this._schemaData){var k=t.buildTag("span.filter").addClass("e-icon")[0].outerHTML,d=this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedLevelUniqueName+"'] div:eq(0)"),g=this._schemaData._tableTreeObj.element.find("li[tag ='"+s+"'] div:eq(0)");d.find(".filter").length==0&&d.append(k);g.find(".filter").length===0&&g.append(k)}nt=this._selectedLevelUniqueName.toLowerCase();f=n.map(this.model.dataSource.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()==s.toLowerCase())return n});f.length==0&&(f=n.map(this.model.dataSource.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()==s.toLowerCase())return n}));f.length>0&&(delete f[0].filterItems,f[0].advancedFilter&&(l=n.map(f[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLocaleLowerCase()!=nt)return n})),this._filterAction.toLowerCase()=="labelfiltering"?l.push({name:this._selectedLevelUniqueName,labelFilterOperator:e.replace(/ /g,""),advancedFilterType:t.Pivot.AdvancedFilterType.LabelFilter,values:i}):l.push({name:this._selectedLevelUniqueName,valueFilterOperator:e.replace(/ /g,""),advancedFilterType:t.Pivot.AdvancedFilterType.ValueFilter,values:i,measure:u}),this._currentReportItems=n.grep(this._currentReportItems,function(n){if(n.fieldName!=s)return n}),f[0].advancedFilter=l,this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"filtering"},this)));this._waitingPopup.show();this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueSorting=null,t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()!=s.toLowerCase())return n}),this._filterAction=="valueFiltering"&&t.PivotAnalysis._valueFilterArray.push(f[0]),this.refreshControl()):this.getJSONData({action:"advancedfiltering"},this.model.dataSource,this)},_nodeCheckChanges:function(i){if(this._isMembersFiltered=!0,(i.id.toLowerCase()=="(all)_0"||i.id.toLowerCase()=="all")&&i.type=="nodeUncheck")this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("unCheckAll"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.disable();else if((i.id.toLowerCase()=="(all)_0"||i.id.toLowerCase()=="all")&&i.type=="nodeCheck")this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("checkAll"),n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.enable();else if(i.id.toLowerCase()=="(all)_0"||i.id.toLowerCase()!="all"){var r=this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),u=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)");r.length==0||r.length==1&&r[0].id[r[0].id.length-1]==0?(n(u).parent().removeClass("e-chk-inact").removeClass("e-chk-ind").addClass("e-chk-act"),u.removeClass("e-stop").addClass("e-checkmark")):i.type=="nodeCheck"&&r.length==1&&r[0].id[r[0].id.length-1]==0?u.removeClass("e-stop").addClass("e-checkmark"):r.length>0&&u.removeClass("e-checkmark").addClass("e-stop");this._dialogOKBtnObj.enable();i.type=="nodeUncheck"&&r.length+1==this._memberTreeObj.element.find("li").length&&(u.removeClass("e-checkmark").removeClass("e-stop"),this._dialogOKBtnObj.disable())}},_fetchMemberSuccess:function(n){n[0]!=r&&n.length>0?(this._currentMembers=n[0].Value,n[1]!=null&&n[1]!=r&&(this.model.customObject=n[1].Value)):n.d!=r&&n.d.length>0?(this._currentMembers=n.d[0].Value,n.d[1]!=null&&n.d[1]!=r&&(this.model.customObject=n.d[1].Value)):n!=r&&n.length>0?(this._currentMembers=n.EditorTreeInfo,n!=null&&n!=r&&(this.model.customObject=n.customObject)):n!=r&&(this._currentMembers=n.EditorTreeInfo);this._createDialog(this._dialogHead,this._currentMembers);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.customObject});this.model.dataSource.enableAdvancedFilter?this.element.find(".e-dialog #GroupLabelDrop_wrapper:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"):t.isNullOrUndefined(this.element.find(".e-dialog .e-text:visible").first())||this.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell");this._waitingPopup.hide()},_filterElementSuccess:function(n){n[0]!=r?n[2]!=null&&n[2]!=r&&(this.model.customObject=n[2].Value):n.d!=r?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject});this._renderControlSuccess(n)},_sortingSuccess:function(n){n[0]!=r?n[2]!=r&&n.length>0&&(this.model.customObject=n[2].Value):n.d!=r&&n.d.length>0?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):n!=r&&n.length>0&&n.customObject!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});this._renderControlSuccess(n)},_nodeExpand:function(i){var u=i.event.originalEvent!=r&&i.event.originalEvent.target!=r?i.event.originalEvent.target:i.event.target,o="",v=n(u).parents("li").first().children().find("li").length,l,s,c,e,h,f,a;if(u!=r&&u.className!=r&&u.className!=""&&u.className.indexOf("e-plus")>-1&&v==0){n(u).removeClass("e-plus").addClass("e-load");l=n(u).parent().find("input.e-checkbox").prop("checked");c=n(u).parents("li").first().attr("tag");this.pNode=u;try{s=JSON.parse(this.model.pivotControl!=r?this.model.pivotControl.getOlapReport():this.getOlapReport()).Report}catch(y){s=this.model.pivotControl!=r?this.model.pivotControl.getOlapReport():this.getOlapReport()}for(e=this.element.find(".pivotButton"),f=0;f<e.length>0;f++)n(e[f]).attr("tag").indexOf(t.isNullOrUndefined(this._curFilteredText)?t.isNullOrUndefined(this._schemaData)?"":this._schemaData._curFilteredText:this._curFilteredText)>-1&&n(e[f]).attr("tag").split(":")[1].length==(t.isNullOrUndefined(this._curFilteredText)?t.isNullOrUndefined(this._schemaData)?0:this._schemaData._curFilteredText.length:this._curFilteredText.length)?o=n(e[f]).attr("tag"):n(e[f]).attr("tag").indexOf(t.isNullOrUndefined(this._curFilteredText)?t.isNullOrUndefined(this._schemaData)?"":this._schemaData._curFilteredText:this._curFilteredText)>-1&&(h=n(e[f]).attr("tag"));o=o==""?t.isNullOrUndefined(h)?t.isNullOrUndefined(this._curFilteredText)?this._schemaData._curFilteredText:this._curFilteredText:h.split(":")[1]:o.split(":")[1];this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});a=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.memberExpand,JSON.stringify({action:"memberExpanded",checkedStatus:l,parentNode:n(u).parents("li")[0].id,tag:c,cubeName:JSON.parse(this._olapReport).CurrentCube+"##"+o,currentReport:s,customObject:a}),this._fetchChildNodeSuccess)}},_fetchChildNodeSuccess:function(i){var u,f,e;i.length>1&&i[0]!=r?(u=JSON.parse(i[0].Value),i[1]!=null&&i[1]!=r&&(this.model.customObject=i[1].Value)):i.d!=r?(u=JSON.parse(i.d[0].Value),i.d[1]!=null&&i.d[1]!=r&&(this.model.customObject=i.d[1].Value)):(u=JSON.parse(i.ChildNodes),i.customObject!=null&&i.customObject!=r&&(this.model.customObject=i.customObject));e={id:"id",parentId:"pid",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus"};f=n(this.pNode).parents("li").length>1?n(this.pNode).parents("li").first():n(this.pNode).parents("li");n(n(f).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});!t.isNullOrUndefined(this._memberTreeObj)&&this._editorFlag?this._memberTreeObj._createSubNodesWhenLoadOnDemand(u,this.pNode,e):t.isNullOrUndefined(this._schemaData._memberTreeObj)||this._schemaData._memberTreeObj._createSubNodesWhenLoadOnDemand(u,this.pNode,e);n.each(n(f).children().find("li"),function(n,t){t.setAttribute("tag",u[n].tag)});this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});t.isNullOrUndefined(this._schemaData)||this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_beforeNodeExpand:function(n){t.Pivot.getChildNodes(n,this._selectedField,this._currentReportItems,this.model.dataSource,this)},_generateAllMember:function(t,i){this.olapCtrlObj._allMember=n(n(i).find("Axis:eq(0) Tuple:eq(0)").children().children()[1]).text()},_generateMembers:function(i,r){var o=n(r).find("Axis:eq(0) Tuple"),f=[],s={},u,e,h;for(f.push({id:"All",name:"All",checkedStatus:!0,tag:""}),u=0;u<o.length;u++)e=n(n(r).find("Axis:eq(0) Tuple:eq("+u+")").children().children()[0]).text(),h=n(n(r).find("Axis:eq(0) Tuple:eq("+u+")").children().children()[1]).text(),s={hasChildren:n(o[u]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!0,id:e.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:h,tag:e},f.push(s);t.isNullOrUndefined(this.olapCtrlObj)||(this.olapCtrlObj._waitingPopup.hide(),this.olapCtrlObj._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(f)}))},_filterBtnClick:function(i){var e,u,o;if(this._editorFlag=!0,t.Pivot.openPreventPanel(this),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap){var f=this._selectedField=n(i.currentTarget.parentNode).attr("tag").split(":")[1],r=[];this._dialogHead=n(i.target).siblings(".pvtBtn").attr("fieldCaption");r=n.map(this._currentReportItems,function(n){if(n.fieldName==f)return n.filterItems});r.length>0?this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(r)}):(this._waitingPopup.show(),t.olap._mdxParser.getMembers(this.model.dataSource,f,this))}else this._selectedField=n(i.target).siblings(".pvtBtn").attr("fieldName"),this._dialogHead=n(i.target).siblings(".pvtBtn").attr("fieldCaption"),this._selectedAxis=n(i.target).siblings(".pvtBtn").attr("axis"),e=this._getTreeViewData(this._selectedField,this._selectedAxis),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(e)});else{this._curFilteredAxis=i.target.parentElement.attributes.tag.value.split(":")[0];this._curFilteredText=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?i.target.parentElement.attributes.tag.value:n(n(i.target).siblings()[1]).attr("fieldname");this._dialogTitle=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?i.target.parentElement.attributes.tag.value:n(n(i.target).siblings()[1]).attr("fieldname");this._dialogHead=n(n(i.target).siblings("button")).attr("fieldCaption");try{u=JSON.parse(this.getOlapReport()).Report}catch(s){u=this.getOlapReport()}this._waitingPopup.show();t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").addClass("freeze").width(n(this._schemaData.element).width()).height(n(this._schemaData.element).height()).css({top:n(this._schemaData.element).offset().top,left:n(this._schemaData.element).offset().left});this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.customObject});o=JSON.stringify(this.model.customObject);eventArgs=JSON.stringify({action:"fetchMembers",headerTag:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.enableAdvancedFilter?this._dialogTitle+"##"+this.model.enableAdvancedFilter:this._dialogTitle,sortedHeaders:this._ascdes,currentReport:u,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:o});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMembers,eventArgs,this._fetchMemberSuccess)}},_getTreeViewData:function(i){var e=t.Pivot.getReportItemByFieldName(i,this.model.dataSource).item,f=t.PivotAnalysis.getMembers(i),o=[{id:"All",name:"All",checkedStatus:!0}],u;if(e.filterItems!=null&&e.filterItems!=r)for(u=0;u<f.length;u++)o.push({id:f[u],name:f[u],checkedStatus:e.filterItems.filterType==t.PivotAnalysis.FilterType.Include?n.inArray(f[u]!=null?f[u].toString():f[u],e.filterItems.values)>=0:n.inArray(f[u]!=null?f[u].toString():f[u],e.filterItems.values)<0});else for(u=0;u<f.length;u++)o.push({id:f[u],name:f[u],checkedStatus:!0});return o},_applyToolTip:function(i){var h,s,u,e,o,p,v,c,f,w,a,y,b;if(this.model.enableToolTip&&(e="",valueCell="",o=n(i.target).hasClass("cellValue")?i.target.parentElement:i.target,n(o).find("input").length==0&&!n(o).hasClass("curInput")&&!t.isNullOrUndefined(n(o).attr("role")))){if(u=this.element.find(".summary[role!='gridcell'][p$=',"+n(o).attr("p").split(",")[1]+"'] , .rowheader[role!='gridcell'][p$=',"+n(o).attr("p").split(",")[1]+"']").last().attr("p"),u==null&&(u=n(o).parent("tr").find(".summary,.rowheader").attr("p")),u!=null)if(u[0]==0&&parseInt(u.split(",")[0])!=null)u==this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Index&&(s=this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Value);else while(u[0]>=0)u==this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Index&&(h=this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Value,u=parseInt(u.split(",")[0])-1+","+parseInt(u.split(",")[1])),s=s?h!=""?h+"-"+s:s:h;var k=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,d=this.element.find(k?".pivotGridFrozenTable ":'tr:has(".colheader")').length-1,l=n(o).attr("p");for(l!=r&&l==this.getJSONRecords()[parseInt(parseInt(l.split(",")[0])*this._rowCount+parseInt(l.split(",")[1]))].Index&&(p=parseInt(l.split(",")[0])),v=0;v<=d;v++)c=p+","+v,p!=null&&c==this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))].Index&&(h=this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))].Value,e==""?e=h:h!=""&&(e=e+"-"+h));n("#"+this._id+"_gridTooltip").remove();this.element.find("span#celval").remove();f=n(o).position();(this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&(w=this.element.find(".e-scroller").data("ejScroller"),this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders||!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders?(f.left=f.left+this.element.find(".rowhead").width()-w.model.scrollLeft,f.top=f.top-w.model.scrollTop):this.model.frozenHeaderSettings.enableFrozenHeaders&&(f.top=f.top+(this.element.find(".e-vscrollbar").length>0?this.element.find(".valueCell").height()-80:0),f.left=f.left+(this.element.find(".e-vscrollbar").length>0&&this.element.find(".e-hscrollbar").length>0||this.element.find(".e-vscrollbar").length==0&&this.element.find(".e-hscrollbar").length==0?this.element.find(".rowhead").width():0)));n("#"+this._id).append('<div id="'+this._id+'_gridTooltip" class="pGridTooltip" role=\'tooltip\'><\/div>');n(o).append("<span id='celval' style='display:none'>row- "+s+": column- "+e+"<\/span>");n(o).find("span.cellValue").attr("aria-describedby","span#celval");a=n(o).find("span.cellValue:not('#celval')").text();this.model.enableRTL?(n("#"+this._id+"_gridTooltip").append('<p id="value" class="tooltipText">'+(a?a:this._getLocalizedLabels("NoValue"))+":"+this._getLocalizedLabels("ToolTipValue")+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="row" class="tooltipText">'+(s==r||this._rowCount==1?this._getLocalizedLabels("NoValue"):this._direction(s))+":"+this._getLocalizedLabels("ToolTipRow")+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="column" class="tooltipText">'+(e==r||e==""?this._getLocalizedLabels("NoValue"):this._direction(e))+":"+this._getLocalizedLabels("ToolTipColumn")+"<\/p>")):(n("#"+this._id+"_gridTooltip").append('<p id="value" class="tooltipText">'+this._getLocalizedLabels("ToolTipValue")+": "+(a?a:this._getLocalizedLabels("NoValue"))+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="row" class="tooltipText">'+this._getLocalizedLabels("ToolTipRow")+": "+(s==r||this._rowCount==1?this._getLocalizedLabels("NoValue"):s)+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="column" class="tooltipText">'+this._getLocalizedLabels("ToolTipColumn")+": "+(e==r||e==""?this._getLocalizedLabels("NoValue"):e)+"<\/p>"));y=0;y=t.isNullOrUndefined(this._pivotClientObj)?n("#"+this._id).parent().position().left+n("#"+this._id).parent().width():n("#"+this._id).parent().position().left+this._pivotClientObj.element.find(".gridContainer").width();b=f.left+n("#"+this._id+"_gridTooltip").width();n("#"+this._id+"_gridTooltip").css({left:(f.left>0?f.left:0)+(y-b<0?y-b-20:5),top:n(this.element).height()-f.top<100?f.top-n("#"+this._id+"_gridTooltip").outerHeight()-2:f.top+40});this.model.enableToolTipAnimation?n("#"+this._id+"_gridTooltip").show("fast"):n("#"+this._id+"_gridTooltip").show();t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.controlPlacement()!="tile"||n("#"+this._id+"_gridTooltip").css("position","absolute")}},_applyVScrolling:function(){var y,c=!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling,p=c?this._pivotClientObj.element.find(".e-pivotgrid"):n(this.element).find(".virtualScrollGrid"),u=c?this._pivotClientObj:this,i=c&&!t.isNullOrUndefined(this._pivotClientObj._pivotGrid)?this._pivotClientObj._pivotGrid:this,s=c&&this.model.isResponsive,h,a,f,l,e,v,r,o;if(i._seriesPageCount>1){h=function(){return s?Math.round(u.element.find(".vScrollPanel").offset().top)+1:Math.round(u.element.find(".vScrollPanel").position().top)+1};a=n(u.element).find(".vScrollPanel");a.height(c?this._pivotClientObj.model.isResponsive?parseInt(this._pivotClientObj.element.find(".controlPanel").height()):parseInt(this._pivotClientObj.element.find(".gridContainer").height()):n(p).height());a.html(t.buildTag("div.vScrollThumb")[0].outerHTML);f=a.find(".vScrollThumb");f.height(Math.max(Math.ceil((c?this._pivotClientObj.model.isResponsive?parseInt(this._pivotClientObj.element.find(".controlPanel").height()):parseInt(this._pivotClientObj.element.find(".gridContainer").height()):n(p).height())/i._seriesPageCount),15));l=a.height()-f.height()-2;f.offset({top:h()+(i._seriesCurrentPage-1)*(l/(i._seriesPageCount-1))});n(".vScrollPanel").on("mousewheel DOMMouseScroll",function(t){var r,e;n("body").on("mousewheel DOMMouseScroll",function(n){return n.preventDefault(),n.stopPropagation(),!1});initThumbPos=(s?f.offset().top:f.position().top)-h();r=i._seriesCurrentPage;movedDistance=t.originalEvent.wheelDelta<0||t.originalEvent.detail>0?t.target.offsetParent.offsetTop+10:-t.target.offsetParent.offsetTop-10;u.element.find(".seriesPageIndicator").removeClass("inActive").css({top:f.position().top,left:f.position().left+20});r=i._seriesCurrentPage;window.navigator.userAgent.indexOf("MSIE ")>-1?n(document).on("selectstart",function(n){n.preventDefault()}):window.getSelection().removeAllRanges();movedDistance>0&&initThumbPos+movedDistance<=l||movedDistance<0&&initThumbPos+movedDistance>=0?e=initThumbPos+movedDistance+h():initThumbPos+movedDistance>l?e=h()+l:initThumbPos+movedDistance<0?e=h():"";f.offset({top:e});r=Math.ceil(((s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount))==0?1:Math.ceil(((s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount));r>i._seriesPageCount&&(r=i._seriesPageCount);u.element.find(".seriesPageIndicator").css({top:f.position().top});u.element.find(".series_CurrentPage").html(r);r!=i._seriesCurrentPage&&(i._seriesCurrentPage=r,clearTimeout(y),y=setTimeout(function(){c?i._pivotClientObj.refreshPagedPivotClient("series",i._seriesCurrentPage):i.refreshPagedPivotGrid("series",i._seriesCurrentPage)},250))});n(f).on("mousedown touchstart",function(t){var o,r,e;n(this).addClass("dragging");o=t.pageY-h();r=(s?f.offset().top:f.position().top)-h();u.element.find(".seriesPageIndicator").removeClass("inActive").css({top:f.position().top,left:f.position().left+20});e=i._seriesCurrentPage;n(document).on("mousemove touchmove",function(t){if(window.navigator.userAgent.indexOf("Trident")>-1)n(document).on("selectstart",function(n){n.preventDefault()});else window.getSelection().removeAllRanges();var c=t.pageY-h()-o;c>0&&r+c<=l?f.offset({top:r+c+h()}):c<0&&r+c>=0?f.offset({top:r+c+h()}):r+c>l?f.offset({top:h()+l}):r+c<0&&f.offset({top:h()});e=Math.floor((Math.round(s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount))==0?1:Math.floor((Math.round(s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount));u.element.find(".seriesPageIndicator").css({top:f.position().top});u.element.find(".series_CurrentPage").html(e);u.element.find(".vScrollThumb").attr("title",u.element.find(".seriesPageIndicator").text())});n(document).on("mouseup touchend",function(){n(document).off("selectstart");n(this).off("mousemove touchmove").off("mouseup touchend");n(f).removeClass("dragging");e!=i._seriesCurrentPage?(i._seriesCurrentPage=e,c?i._pivotClientObj.refreshPagedPivotClient("series",i._seriesCurrentPage):i.refreshPagedPivotGrid("series",i._seriesCurrentPage)):u.element.find(".seriesPageIndicator").addClass("inActive")})})}if(i._categPageCount>1){e=function(){return s?Math.round(u.element.find(".hScrollPanel").offset().left)+1:Math.round(u.element.find(".hScrollPanel").position().left)+1};this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.element.find(".childsplit").length>0&&this._pivotClientObj.element.find(".childsplit").data("ejSplitter").refresh();v=n(u.element).find(".hScrollPanel");v.width(c?this._pivotClientObj.model.enableSplitter?parseInt(this._pivotClientObj.element.find(".controlPanelTD").width()):parseInt(this._pivotClientObj.element.find(".controlPanel").width()):n(p).width());v.html(t.buildTag("div.hScrollThumb")[0].outerHTML);r=v.find(".hScrollThumb");r.width(Math.max(Math.ceil((c?this._pivotClientObj.model.enableSplitter?parseInt(this._pivotClientObj.element.find(".controlPanelTD").width()):parseInt(this._pivotClientObj.element.find(".controlPanel").width()):n(p).width())/i._categPageCount),15));o=v.width()-r.width()-2;this.model.enableRTL?r.css({right:(i._categCurrentPage-1)*(o/(i._categPageCount-1))}):r.offset({left:e()+(i._categCurrentPage-1)*(o/(i._categPageCount-1))});n(".hScrollPanel").on("mousewheel DOMMouseScroll",function(t){n("body").on("mousewheel DOMMouseScroll",function(n){return n.preventDefault(),n.stopPropagation(),!1});initThumbPos=u.model.enableRTL?u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()):(s?r.offset().left:r.position().left)-e();currentPage=i._categCurrentPage;movedDistance=t.originalEvent.wheelDelta<0||t.originalEvent.detail>0?c?t.target.offsetParent.children[1].offsetLeft+10:t.target.offsetParent.offsetLeft+10:c?-t.target.offsetParent.children[1].offsetLeft-10:-t.target.offsetParent.offsetLeft-10;movedDistance=u.model.enableRTL?-movedDistance:movedDistance;u.element.find(".categPageIndicator").removeClass("inActive").css({left:r.position().left,top:r.position().top+20});window.navigator.userAgent.indexOf("MSIE ")>-1?n(document).on("selectstart",function(n){n.preventDefault()}):window.getSelection().removeAllRanges();var f;u.model.enableRTL?movedDistance>0&&initThumbPos+movedDistance<=o||movedDistance<0&&initThumbPos+movedDistance>=0?f=initThumbPos+movedDistance:initThumbPos+movedDistance>o?f=o:initThumbPos+movedDistance<0?f=0:"":movedDistance>0&&initThumbPos+movedDistance<=o||movedDistance<0&&initThumbPos+movedDistance>=0?f=initThumbPos+movedDistance+e():initThumbPos+movedDistance>o?f=e()+o:initThumbPos+movedDistance<0?f=e():"";u.model.enableRTL?r.css("right",f):r.offset({left:f});currentPage=u.model.enableRTL?Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount))==0?1:Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount)):Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount))==0?1:Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount));currentPage=currentPage>i._categPageCount?i._categPageCount:currentPage<1?1:currentPage;u.element.find(".categPageIndicator").css({left:r.position().left});u.element.find(".categ_CurrentPage").html(currentPage);currentPage!=i._categCurrentPage&&(i._categCurrentPage=currentPage,clearTimeout(y),y=setTimeout(function(){c?i._pivotClientObj.refreshPagedPivotClient("categ",i._categCurrentPage):i.refreshPagedPivotGrid("categ",i._categCurrentPage)},250))});n(r).on("mousedown touchstart",function(t){var l,f,h;n(this).addClass("dragging");l=u.model.enableRTL?u.element.find(".hScrollPanel").width()-(t.pageX-e()):t.pageX-e();f=u.model.enableRTL?u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()):(s?r.offset().left:r.position().left)-e();u.element.find(".categPageIndicator").removeClass("inActive").css({left:r.position().left,top:r.position().top+20});h=i._categCurrentPage;n(document).on("mousemove touchmove",function(t){if(window.navigator.userAgent.indexOf("Trident")>-1)n(document).on("selectstart",function(n){n.preventDefault()});else window.getSelection().removeAllRanges();var c=u.model.enableRTL?u.element.find(".hScrollPanel").width()-(t.pageX-e())-l:t.pageX-e()-l;c>0&&f+c<=o?u.model.enableRTL?r.css({right:f+c}):r.offset({left:f+c+e()}):c<0&&f+c>=0?u.model.enableRTL?r.css({right:f+c}):r.offset({left:f+c+e()}):f+c>o?u.model.enableRTL?r.css({right:o}):r.offset({left:e()+o}):f+c<0&&(u.model.enableRTL?r.css({right:"0px"}):r.offset({left:e()}));h=u.model.enableRTL?Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount))==0?1:Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount)):Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount))==0?1:Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount));h=h>i._categPageCount?i._categPageCount:h<1?1:h;u.element.find(".categPageIndicator").css({left:r.position().left});u.element.find(".categ_CurrentPage").html(h);u.element.find(".hScrollThumb").attr("title",u.element.find(".categPageIndicator").text())});n(document).on("mouseup touchend",function(){n(document).off("selectstart");n(this).off("mousemove touchmove").off("mouseup touchend");n(r).removeClass("dragging");h!=i._categCurrentPage?(i._categCurrentPage=h,c?i._pivotClientObj.refreshPagedPivotClient("categ",i._categCurrentPage):i.refreshPagedPivotGrid("categ",i._categCurrentPage)):u.element.find(".categPageIndicator").addClass("inActive")})})}n("body").off("mousewheel DOMMouseScroll")},_getLocalizedLabels:function(n){return t.PivotGrid.Locale[this.locale()][n]===r?t.PivotGrid.Locale["en-US"][n]:t.PivotGrid.Locale[this.locale()][n]},_drillDown:function(i){var r,y,c,f,g,p,u,w,v,b,l,nt,s,h;if(this._drillCaption=n(i.target).parent().find(".cellValue").text(),f=i.target.className,this._startDrilldown=!0,gridObj=this,r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,f=f.split(" "),n(i.target).hasClass("expand")?this._drillAction="drilldown":n(i.target).hasClass("collapse")&&(this._drillAction="drillup"),y=n(n(i.target).parent()).hasClass("rowheader")||n(n(i.target).parent()).attr("role")=="rowheader"?"rowheader":"colheader",this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){t.isNullOrUndefined(r)?this._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&gridObj._waitingPopup.show()},800));for(var a=n(i.target).parent().attr("p"),e=this.getJSONRecords()[parseInt(parseInt(a.split(",")[0])*this._rowCount+parseInt(a.split(",")[1]))].Info,d=e.replace(/&/g,"&"),o=parseInt(a.split(",")[0]),k=parseInt(a.split(",")[1]);o>0;){for(o--,s=this.getJSONRecords()[o*this._rowCount+k].Info,h=k;s==""&&h>0;)h--,s=this.getJSONRecords()[o*this._rowCount+h].Info;e=s+">#>"+e}return this.element.parents(".e-pivotclient").length>0?(c=this.element.parents(".e-pivotclient").data("ejPivotClient"),y=="rowheader"&&c.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(c._drillInfo=e,c.setChartDrillParams(e,this._drillAction))):c=this,c._pivotRecords={records:this.getJSONRecords(),rowCount:this._rowCount},n(i.target).hasClass("collapse")?this.updateDrilledReport({uniqueName:d,index:a,action:"collapse"},y,c):this.updateDrilledReport({uniqueName:d,index:a},y,c),!1}if(this.element.find(".e-dialog").remove(),!this.model.enableDeferUpdate){this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this._off(this.element,"click",".expand, .collapse");this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.element.find(".colheader, .rowheader, .value").removeClass("e-droppable");f=i.target.className;g=n(i.target).parent();this._startDrilldown=!0;f=f.split(" ");f[0]=="expand"?this._drillAction="drilldown":f[0]=="collapse"&&(this._drillAction="drillup");this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"drillDown",element:this.element,customObject:this.model.customObject});p=JSON.stringify(this.model.customObject);u=n(i.target).parent().attr("p");this._drillCaption=n(i.target).parent().find(".cellValue").text();t.isNullOrUndefined(this._pivotClientObj)||t.isNullOrUndefined(this._pivotClientObj._waitingPopup)?t.isNullOrUndefined(r)?this._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&gridObj._waitingPopup.show()},800)):(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&(n("#"+gridObj._pivotClientObj._id+"_maxView")[0]?(n("#"+gridObj._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}),gridObj._maxViewLoading=n("#"+gridObj._pivotClientObj._id+"_maxView").data("ejWaitingPopup")):gridObj._pivotClientObj._waitingPopup.show())},800));w=this.model.analysisMode=="relational"?this._drillHeaders.join("||"):this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Info;try{v=n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this._pivotClientObj.getOlapReport()).Report:this._pivotClientObj.currentReport:JSON.parse(this.getOlapReport()).Report}catch(tt){v=n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this._pivotClientObj.getOlapReport():this._pivotClientObj.currentReport:this.getOlapReport()}if(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){b=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(this.element).find(".pivotGridTable"):n(this.element).find("table").detach();l=this._getFieldName(n(i.target).parent()[0]);n(i.target).hasClass("collapse")?(t.isNullOrUndefined(this.model.collapsedMembers)&&(this.model.collapsedMembers={}),t.isNullOrUndefined(this.model.collapsedMembers[l])?this.model.collapsedMembers[l]=[n(i.target).parent()[0].textContent]:this.model.collapsedMembers[l].push(n(n(i.target).parent()[0]).clone().children().remove().end().text())):n(i.target).hasClass("expand")&&(this.model.collapsedMembers[l]=n.grep(this.model.collapsedMembers[l],function(t){return t!=n(i.target).parent()[0].textContent}));nt=n(n(i.target).parent()).hasClass("rowheader")||n(n(i.target).parent()).attr("role")=="rowheader"?"rowheader":n(n(i.target).parent()).hasClass("colheader")||n(n(i.target).parent()).attr("role")=="columnheader"?"columnheader":"";this._collapseMember(b,i.target);n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen?this.element.find("#"+this._id+"Toolbar").append(b):this.element.append(b);(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._applyFrozenHeaderWidth(this._JSONRecords,this._drillAction,g);this._hideGrandTotal(b);this.model.enableGroupingBar&&(tableWidth=n("#"+this._id).find(".pivotGridTable").width(),this.element.find(".groupingBarPivot .drag").width(tableWidth-5),cellWidth=n("#"+this._id).find(".pivotGridTable").find("th").width(),this.element.find(".groupingBarPivot .values").width(cellWidth-2),this.element.find(".groupingBarPivot .columns").width(tableWidth-cellWidth),this.element.find(".groupingBarPivot .valueColumn").width(tableWidth));this.element.find(".colheader, .rowheader, .value").addClass("e-droppable");t.isNullOrUndefined(r)||(r._isTimeOut=!1);this._waitingPopup.hide();var it=i,o=parseInt(u.split(",")[0]),k=parseInt(u.split(",")[1]),e=this._drillCaption;if(nt=="rowheader")while(o>0){for(o--,s=this.getJSONRecords()[this._rowCount*o+k].Value,h=k;s==""&&h>0;)h--,s=this.getJSONRecords()[this._rowCount*o+h].Value;e=s+">#>"+e}this._trigger("drillSuccess",{gridObj:this,drillAction:this._drillAction,drilledMember:e,fieldName:l,axis:y,cellPosition:u});this.model.enableGroupingBar&&this._createFields("drilldown",n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth());this._unWireEvents();this._wireEvents();this._drillAction=""}else this.layout()!=""||this.layout()!="normal"?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,headerInfo:w,layout:this.layout(),customObject:p}),this._drillDownSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,clientReports:this._pivotClientObj.reports,headerInfo:w,layout:this.layout(),customObject:p}),this._drillDownSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,headerInfo:w,customObject:p}),this._drillDownSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,clientReports:this._pivotClientObj.reports,headerInfo:w,customObject:p}),this._drillDownSuccess)}},_collapseMember:function(i,u){var e=n(u).parent()[0],y=n(e).attr("p"),st=n(u).attr("tag")!=r?parseInt(n(u).attr("tag"))+e.rowSpan:e.rowSpan,at=this.model.enableAdvancedFilter&&!t.isNullOrUndefined(n(e).attr("vfcolspan"))?parseInt(n(e).attr("vfcolspan")):n(u).attr("tag")!=r?parseInt(n(u).attr("tag"))+e.colSpan:e.colSpan,o=n(u).closest("tr")[0],ri=null,ui=null,et="false",pt=0,vt,bt,tt,ot,v,ei,c,p,s,w,hi,a,rt,l,ut,lt,g,h,ht,ft,ti,yt,b,k,oi,f,gt;if(e.className.indexOf("rowheader")>=0||e.className.indexOf("summary")>=0&&n(e).attr("role")=="rowheader"){if(this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout){var si=this.getJSONRecords()[1].Index=="0,0"?1:0,st=this.getJSONRecords()[parseInt(y.split(",")[0])*this._rowCount+parseInt(y.split(",")[1])+si].RowSpan,wt=o;for(n(u).attr("class").indexOf("expand")>-1&&n(o).removeAttr("tag"),s=0;s<st;s++)n(u).attr("class")&&n(u).attr("class").indexOf("collapse")>-1&&(n(n(o).next()).attr("tag")==r&&n(n(o).next()).attr("tag",y),n(n(o).next()).css("display","none"),(this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&n(i).find(".pivotGridValueTable td[i$=',"+n(n(o).next()).find("td").attr("i").split(",")[1]+"']").css("display","none")),n(u).attr("class").indexOf("expand")>-1&&(n(n(o).next()).attr("tag")==r||n(n(o).next()).attr("tag")==y)&&(n(n(o).next()).css("display","table-row"),n(n(o).next()).removeAttr("tag"),(this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&this.element.find(".pivotGridValueTable td[i$=',"+n(n(o).next()).find("td").attr("i").split(",")[1]+"']").css("display","")),o=n(o).next();vt=this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders?"td":"th";bt=n(wt).find(vt+" span:not(.cellValue)").css("margin-left");n(wt).find(vt+" span:not(.cellValue)").remove();n(wt).find(vt).prepend(n(u).attr("class").indexOf("collapse")>-1?'<span style="margin-left:'+bt+'" class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":'<span style="margin-left:'+bt+'" class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>");return}var fi=!n(e).index()>0,kt=isLeafHide=!1;if(n(u).attr("class")&&n(u).attr("class").indexOf("collapse")>-1){for(s=0;s<st;s++){if(ri=n(o).next(),fi)n(o).find(".stot,.rstot").length>=1&&s==1&&n(n(o).find(".stot,.rstot")).find(".expand").length>=1&&(isLeafHide=!0),(n(n(o).find(".stot,.rstot")).find(".expand").length>=1||n(o).css("display")=="none")&&(kt=!0),n(o).css("display","none"),(this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&n(i).find(".pivotGridValueTable tr:eq("+n(o).index()+")").css("display","none"),n(o).attr("tag",n(o).attr("tag")!=r?parseInt(n(o).attr("tag"))+1:1);else{for(v=e,k=0;k<=n(e).nextAll().length;k++)n(v).css("display","none").attr("hc",n(v).attr("hc")==r?1:parseInt(n(v).attr("hc"))+1),v=n(v).next();isTdSubSameRow=!1;et="true"}o=ri;fi=!0}for(tt=et=="true"?e.rowSpan-1:e.rowSpan,n(o).css("display")!="none"&&isLeafHide&&(ot=n(u).attr("subTag")!=r?parseInt(n(u).attr("subTag"))==-1?e.rowSpan+1:parseInt(n(u).attr("subTag"))+e.rowSpan:e.rowSpan),n(o).css("display")=="none"&&(n(o).css("display",""),kt=!0,tt=tt-1),kt&&t.isNullOrUndefined(ot)&&(ot=n(u).attr("subTag")!=r?parseInt(n(u).attr("subTag"))==-1?e.rowSpan:parseInt(n(u).attr("subTag"))+e.rowSpan:e.rowSpan),(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&n(i).find(".pivotGridValueTable").length>0?(n(o).find("td").text(n(o).find("td").text().replace(" Total","")),n(o).find("td span:not(.cellValue)").remove(),n(o).find("td").prepend('<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'" tag="'+st+":"+et+'"> <\/span>')):(n(o).find("th").text(n(o).find("th").text().replace(" Total","")),n(o).find("th span:not(.cellValue)").remove(),n(o).find("th").prepend('<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'" tag="'+st+":"+et+(t.isNullOrUndefined(ot)?"":n(u).attr("isChildSubNode")=="true"?'" subTag="'+ot+":"+et+'" isChildSubNode="true':'" subTag="'+ot+":"+et)+'"> <\/span>')),c=n(o).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)"),s=0;s<c.length;s++)parseInt(n(c[s]).attr("p").split(",")[0])<parseInt(y.split(",")[0])&&parseInt(n(c[s]).attr("p").split(",")[1])+c[s].rowSpan+(n(c[s]).find("span").attr("tag")!=r?parseInt(n(c[s]).find("span").attr("tag")):0)>=parseInt(y.split(",")[1])+st&&(c[s].rowSpan-=tt,n(c[s]).find("span").attr("tag")==r&&n(c[s]).find("span").attr("isChildSubNode",!0),n(c[s]).find("span").attr("tag",n(c[s]).find("span").attr("tag")!=r?parseInt(n(c[s]).find("span").attr("tag"))+tt:tt),n(c[s]).find("span").attr("subTag",n(c[s]).find("span").attr("subTag")!=r?parseInt(n(c[s]).find("span").attr("subTag"))+tt:tt))}else if(n(u).attr("class")&&n(u).attr("class").indexOf("expand")>-1){var ht=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,it=removeSubSpan=this._isSubTotalhidden=!1,nt=0;for(s=parseInt(n(u).attr("tag").split(":")[0]);s>=0;s--)ui=n(o).prev(),n(o).attr("tag")==r||parseInt(n(o).attr("tag"))<=1?(this._hideSubTotal(n(o),nt,n(u)),this._isSubTotalHide?(it=!0,this._isSubTotalHide=!1,n(o).css("display","none"),ht&&n(i).find(".pivotGridValueTable tr eq:("+n(o).index()+")").css("display","none")):(n(o).css("display","table-row"),(this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&n(i).find(".pivotGridValueTable tr:eq("+n(o).index()+")").css("display","table-row"))):pt++,nt=nt==0?1:nt,n(o).attr("tag")!=r&&(parseInt(n(o).attr("tag")-1)==0?n(o).removeAttr("tag"):n(o).attr("tag",parseInt(n(o).attr("tag"))-1)),o=ui;if(n(u).attr("tag").split(":")[1]=="true")for(v=n(i).find((ht?".pivotGridRowTable ":"th")+"[p='"+parseInt(n(e).attr("p").split(",")[0])+","+(parseInt(n(e).attr("p").split(",")[1])-parseInt(n(u).attr("tag").split(":")[0]))+"'], td[p='"+parseInt(n(e).attr("p").split(",")[0])+","+(parseInt(n(e).attr("p").split(",")[1])-parseInt(n(u).attr("tag").split(":")[0]))+"']"),ei=n(v).nextAll().length,k=0;k<=ei;k++)n(v).attr("hc")==r||parseInt(n(v).attr("hc"))<=1?(n(v).removeAttr("hc"),n(v).attr("ch")==r&&n(v).css("display","")):n(v).attr("hc",parseInt(n(v).attr("hc"))-1),v=n(v).next();for(c=n(n(u).closest("tr")[0]).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)"),p=n(u).attr("subTag")!=r&&it?n(u).attr("subTag").split(":")[1]=="true"?parseInt(n(u).attr("subTag").split(":")[0])-1:parseInt(n(u).attr("subTag").split(":")[0]):(n(u).attr("tag").split(":")[1]=="true"?parseInt(n(u).attr("tag").split(":")[0])-1:parseInt(n(u).attr("tag").split(":")[0]))-pt,it&&(p=n(u).attr("subTag")!=r?parseInt(n(u).attr("subTag").split(":")[0])==-1?p:p-1:p-1),s=0;s<c.length;s++)parseInt(n(c[s]).attr("p").split(",")[0])<parseInt(y.split(",")[0])&&parseInt(n(c[s]).attr("p").split(",")[1])+c[s].rowSpan+(n(c[s]).find("span").attr("tag")!=r?parseInt(n(c[s]).find("span").attr("tag")):0)>=parseInt(y.split(",")[1])&&(it&&(it=!1,p=n(n(c[s]).find("span")[0]).attr("subTag")!=r?parseInt(n(n(c[s]).find("span")[0]).attr("subTag").split(":")[0])<=p?p:p+1:p,n(u).attr("isChildSubNode")=="true"&&(p=p-pt,n(u).removeAttr("isChildSubNode"))),c[s].rowSpan+=p,n(c[s]).find("span").attr("tag")!=r&&n(c[s]).find("span").attr("tag",parseInt(n(c[s]).find("span").attr("tag"))-p),parseInt(n(c[s]).find("span").attr("tag"))==0&&n(c[s]).find("span").removeAttr("tag"),n(c[s]).find("span").attr("subTag")!=r&&n(c[s]).find("span").attr("subTag",parseInt(n(c[s]).find("span").attr("subTag"))-p),parseInt(n(c[s]).find("span").attr("subTag"))==0&&n(c[s]).find("span").removeAttr("subTag"));n(e).find(".cellValue").length>0?n(e).find(".cellValue").text(n.trim(n(e).find(".cellValue").text())+" Total"):n(e).text(n.trim(n(e).text())+" Total");n(e).find(".expand").remove();n(e).prepend("<span style='margin-left:10px'><\/span>")}}if(e.className.indexOf("colheader")>=0||e.className.indexOf("summary")>=0&&n(e).attr("role")=="columnheader")if(w=parseInt(y.split(",")[0]),hi=n(i).find("tr"),n(u).attr("class")&&n(u).attr("class").indexOf("collapse")>-1){if(rt=e.colSpan,n(e).next().css("display")=="none"){var dt=n(e).next().attr("p"),d=parseInt(dt.split(",")[0]),ci=n(i).find("tr"),ct=parseInt(n(e).next().attr("colspan"));if(n(e).next().attr("class").indexOf("stot","cstot")>-1)for(f=0;f<ct;f++){for(l=n(o).nextAll().find("th[p^='"+(f+d)+",']"),h=0;h<n(l).length;h++)n(l[h]).css("display","");if(n(l[h]).attr("hc")==r||parseInt(n(l[h]).attr("hc"))<1)for(n(i).find("td[p^='"+(f+d)+",']").css("display",""),b=0;b<n(i).find("td[p^='"+(f+d)+",']").length;b++)(n(n(i).find("td[p^='"+(f+d)+",']")[b]).attr("hc")!=r||n(n(i).find("td[p^='"+(f+d)+",']")[b]).attr("hc")>-1)&&n(n(i).find("td[p^='"+(f+d)+",']")[b]).css("display","none")}n(e).next().css("display","");rt=e.colSpan-ct}for(f=0;f<at;f++)if(l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(o).nextAll().find("td[p^='"+(f+w)+",']"):n(o).nextAll().find("th[p^='"+(f+w)+",']"),l.length!=0){for(h=0;h<n(l).length;h++)n(l[h]).attr("hc",n(l[h]).attr("hc")!=r?parseInt(n(l[h]).attr("hc"))+1:1).css("display","none");(n(l[h]).attr("hc")==r||parseInt(n(l[h]).attr("hc"))<1)&&(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?(n(i).find(".pivotGridValueTable td[p^='"+(f+w)+",']").css("display","none"),n(i).find(".pivotGridValueTable td[p^='0,']:not(.summary)").parent().find("td[p^='"+(f+w)+",']").attr("ch",1)):(n(i).find("td[p^='"+(f+w)+",']").css("display","none"),n(i).find("th[p^='0,']:not(.summary)").parent().find("td[p^='"+(f+w)+",']").attr("ch",1)))}for(n(e).attr("hc",1).css("display","none"),n(e).next().text(n(e).next().text().replace(" Total","")),n(e).next().find("span:not(.cellValue)").remove(),n(e).next().prepend('<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'" tag="'+at+'"> <\/span>'),a=n(o).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)"),f=0;f<a.length;f++)gt=this.model.enableAdvancedFilter&&!t.isNullOrUndefined(n(a[f]).attr("vfcolspan"))?parseInt(n(a[f]).attr("vfcolspan")):a[f].colSpan,parseInt(n(a[f]).attr("p").split(",")[1])<parseInt(y.split(",")[1])&&parseInt(n(a[f]).attr("p").split(",")[0])<=parseInt(y.split(",")[0])&&parseInt(n(a[f]).attr("p").split(",")[0])+gt+(n(a[f]).find("span").attr("tag")!=r?parseInt(n(a[f]).find("span").attr("tag")):0)>=parseInt(y.split(",")[0])+at&&(a[f].colSpan-=rt,n(a[f]).find("span").attr("tag",n(a[f]).find("span").attr("tag")!=r?parseInt(n(a[f]).find("span").attr("tag"))+rt:rt))}else if(n(u).attr("class")&&n(u).attr("class").indexOf("expand")>-1){var ni=0,it=removeCell=this._isSubTotalhidden=!1,nt=0,ct=parseInt(n(e).attr("colspan"));if(this._hideSubTotal(n(o),nt,n(u)),this._isSubTotalHide){removeCell=it=!0;this._isSubTotalHide=!1;var dt=n(e).attr("p"),d=parseInt(dt.split(",")[0]),ci=n(i).find("tr");if(n(e).attr("class").indexOf("stot","cstot")>-1)for(f=0;f<ct;f++){for(g=n(o).nextAll().find("th[p^='"+(f+d)+",']"),h=0;h<n(g).length;h++)n(g[h]).css("display","none");(n(g[h]).attr("hc")==r||parseInt(n(g[h]).attr("hc"))<1)&&n(i).find("td[p^='"+(f+d)+",']").css("display","none")}n(e).css("display","none")}for(rt=at-(ct-1),f=1;f<rt;f++){for(l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(o).nextAll().find("td[p^='"+(w-f)+",']"):n(o).nextAll().find("th[p^='"+(w-f)+",']"),h=0;h<n(l).length;h++){for(removeCell=!1,ut=0;ut<n(l[h]).length;ut++)(n(n(l[h])[ut]).hasClass("stot")||n(n(l[h])[ut]).hasClass("cstot"))&&!n(n(l[h])[ut]).hasClass("calc")&&this._hideSubTotal(n(n(l[h])[ut]),nt,n(u));if(this._isSubTotalHide){removeCell=!0;this._isSubTotalHide=!1;var dt=n(l[h]).attr("p"),d=parseInt(dt.split(",")[0]),ci=n(i).find("tr"),ct=parseInt(n(l[h]).attr("colspan"));if(n(l[h]).attr("class").indexOf("stot","cstot")>-1&&!(n(l[h]).find(".expand").length>0))for(lt=0;lt<ct;lt++){for(g=n(o).nextAll().find("th[p^='"+(lt+d)+",']"),h=0;h<n(g).length;h++)n(g[h]).css("display","none");n(g[h]).attr("hc")==r||parseInt(n(g[h]).attr("hc"))<1?n(i).find("td[p^='"+(lt+d)+",']").css("display","none"):ni++}n(l[h]).css("display","none")}n(l[h]).attr("hc")==r||parseInt(n(l[h]).attr("hc"))==1?(n(l[h]).css("display",""),n(l[h]).removeAttr("hc")):parseInt(n(l[h]).attr("hc"))-1==0?n(l[h]).removeAttr("hc"):n(l[h]).attr("hc",parseInt(n(l[h]).attr("hc"))-1)}if(nt=nt==0?1:nt,!removeCell)if(n(l).last().attr("hc")==r){if(ht=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ht?n(i).find("td[p^='"+(w-f)+",']").css("display",""):n(i).find("td[p^='"+(w-f)+",']").css("display",""),ft=[],ht){for(ti=n(i).find("[p^='0,']:not(.summary)").parent(),yt="",b=0;b<ti.length;b++)yt=yt+(b!=0?" , ":"")+" .pivotGridValueTable td:eq("+n(ti[b]).index()+")";ft=n(i).find(yt)}else ft=n(i).find("[p^='0,']:not(.summary)").parent().find("td[p^='"+(w-f)+",']");for(n(ft).removeAttr("ch"),k=0;k<=n(ft).length;k++)n(ft[k]).attr("hc")!=r&&n(ft[k]).css("display","none")}else ni++}n(e).prev().removeAttr("hc").css("display","");var li=parseInt(n(e).prev().attr("colspan")),ii=parseInt(n(u).attr("tag"))-ni,a=n(o).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)");for(it&&(it=!1,oi=n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this._pivotClientObj.getOlapReport():this.getOlapReport(),ii=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?parseInt(n(e).prev().attr("colSpan"))-this.model.dataSource.values.length:parseInt(n(e).prev().attr("colSpan"))-JSON.parse(oi).PivotCalculations.length),f=0;f<a.length;f++)gt=this.model.enableAdvancedFilter&&!t.isNullOrUndefined(n(a[f]).attr("vfcolspan"))?parseInt(n(a[f]).attr("vfcolspan")):a[f].colSpan,parseInt(n(a[f]).attr("p").split(",")[1])<parseInt(y.split(",")[1])&&parseInt(n(a[f]).attr("p").split(",")[0])<parseInt(y.split(",")[0])&&parseInt(n(a[f]).attr("p").split(",")[0])+a[f].colSpan+(n(a[f]).find("span").attr("tag")!=r?parseInt(n(a[f]).find("span").attr("tag")):0)>=parseInt(y.split(",")[0])&&(a[f].colSpan+=ii,n(a[f]).find("span").attr("tag")!=r&&n(a[f]).find("span").attr("tag",parseInt(n(a[f]).find("span").attr("tag"))-ii),parseInt(n(a[f]).find("span").attr("tag"))==0&&n(a[f]).find("span").removeAttr("tag"));n(e).find(".cellValue").length>0?n(e).find(".cellValue").text(n.trim(n(e).find(".cellValue").text())+" Total"):n(e).text(n.trim(n(e).text())+" Total");n(e).find(".expand").remove();n(e).prepend("<span style='margin-left:10px'><\/span>")}},_generateTreeViewData:function(){var n={catalog:this.model.dataSource.catalog,cube:this.model.dataSource.cube,url:this.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"};this._getTreeData(n,this._loadDimensionElements,{pvtGridObj:this,action:"loadFieldElements"})},_dimensionsDetails:function(t,i){t.pvtGridObj._dimension=n(i).find("row")},_loadDimensionElements:function(t,i){var y,s,h,c,u,f,e;t.pvtGridObj._waitingPopup.show();var o,l={},a={},v=t.pvtGridObj._getConnectionInfo(t.pvtGridObj.model.dataSource.data);for(t.pvtGridObj.schemaTreeView=[],t.pvtGridObj.reportItemNames=[],y='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_DIMENSIONS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+t.pvtGridObj.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+t.pvtGridObj.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+t.pvtGridObj.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+v.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",t.pvtGridObj.doAjaxPost("POST",v.url,{XMLA:y},t.pvtGridObj._dimensionsDetails,null,{pvtGridObj:t.pvtGridObj,action:"loadFieldElements"}),s=t.pvtGridObj._dimension,h=0;h<n(i).find("row").length;h++){if(c=n(n(i).find("row")[h]),u=c.find("DIMENSION_UNIQUE_NAME").text(),t.pvtGridObj.model.enableDrillThrough)for(f=0;f<s.length;f++)u==n(s[f]).find("DIMENSION_UNIQUE_NAME").text()&&(o=n(s[f]).find("DIMENSION_CAPTION").text());else o=c.find("DIMENSION_CAPTION").text();u.toLowerCase()=="[measures]"?a={hasChildren:!0,isSelected:!1,id:u,name:o,spriteCssClass:u.toLowerCase()=="[measures]"?"folderCDB e-icon":"dimensionCDB e-icon",tag:u}:!n(n(i).find("row")[0]).find("HIERARCHY_CAPTION").length>0&&(l={hasChildren:!0,isSelected:!1,id:u,name:o,spriteCssClass:"dimensionCDB e-icon",tag:u},t.pvtGridObj.schemaTreeView.push(l))}t.pvtGridObj.schemaTreeView.splice(0,0,a);e={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"};!t.pvtGridObj.model.enableDrillThrough||t.pvtGridObj._schemaData!=r&&t.pvtGridObj._schemaData.model.olap.showNamedSets?(e.request="MDSCHEMA_SETS",t.pvtGridObj._getTreeData(e,t.pvtGridObj._loadNamedSetElements,t)):(e.request="MDSCHEMA_HIERARCHIES",t.pvtGridObj._fieldData.hierarchySuccess==r?t.pvtGridObj._getTreeData(e,t.pvtGridObj._loadHierarchyElements,t):t.pvtGridObj._loadHierarchyElements(t,t.pvtGridObj._fieldData.hierarchySuccess))},_loadNamedSetElements:function(t,i){var f,u;t.pvtGridObj._waitingPopup.show();var s={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},e=t.pvtGridObj.model.dataSource,o=n.map(e.rows,function(n){if(n.fieldName!=r)return n.fieldName});for(n.merge(o,n.map(e.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(o,n.map(e.filters,function(n){if(n.fieldName!=r)return n.fieldName})),measureGroupItems=[],f=0;f<n(i).find("row").length;f++)u=n(n(i).find("row")[f]),n.inArray(u.find("DIMENSIONS").text().split(".")[0],measureGroupItems)>=0||(treeNodeElement={hasChildren:!0,isSelected:!1,pid:u.find("DIMENSIONS").text().split(".")[0],id:u.find("SET_DISPLAY_FOLDER").text()+"_"+u.find("DIMENSIONS").text().split(".")[0],name:u.find("SET_DISPLAY_FOLDER").text(),spriteCssClass:"folderCDB e-icon namedSets"},t.pvtGridObj.schemaTreeView.push(treeNodeElement),measureGroupItems.push(u.find("DIMENSIONS").text().split(".")[0])),treeNodeElement={hasChildren:!0,isSelected:n.inArray("["+n.trim(u.children("SET_NAME").text())+"]",o)>=0,pid:u.find("SET_DISPLAY_FOLDER").text()+"_"+u.find("DIMENSIONS").text().split(".")[0],id:"["+n.trim(u.children("SET_NAME").text()).replace(/\&/g,"&")+"]",name:u.children("SET_CAPTION").text(),spriteCssClass:"namedSetCDB e-icon",tag:u.find("EXPRESSION").text()},t.pvtGridObj.schemaTreeView.push(treeNodeElement);s.request="MDSCHEMA_HIERARCHIES";t.pvtGridObj._fieldData.hierarchySuccess==r?t.pvtGridObj._getTreeData(s,t.pvtGridObj._loadHierarchyElements,t):t.pvtGridObj._loadHierarchyElements(t,t.pvtGridObj._fieldData.hierarchySuccess)},_loadHierarchyElements:function(t,i){var h,a,f;t.pvtGridObj._waitingPopup.show();var l={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},o=t.pvtGridObj.model.dataSource,s=n.map(o.rows,function(n){if(n.fieldName!=r)return n.fieldName});for(n.merge(s,n.map(o.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(s,n.map(o.filters,function(n){if(n.fieldName!=r)return n.fieldName})),h={},a="",f=0;f<n(i).find("row").length;f++){var u=n(n(i).find("row")[f]),c=u.find("DIMENSION_UNIQUE_NAME").text(),e=u.find("HIERARCHY_UNIQUE_NAME").text(),v=n(t.pvtGridObj.schemaTreeView).filter(function(n,t){return t.tag==c}).map(function(n,t){return t});v.length>0&&c!=e&&(h={hasChildren:!0,isSelected:n.inArray(e,s)>=0,pid:c,id:e,name:u.find("HIERARCHY_CAPTION").text(),spriteCssClass:u.find("HIERARCHY_ORIGIN").text()!="2"&&u.find("HIERARCHY_ORIGIN").text()!="6"?"hierarchyCDB e-icon":"attributeCDB e-icon",tag:e},t.pvtGridObj.schemaTreeView.push(h))}l.request="MDSCHEMA_LEVELS";t.pvtGridObj._getTreeData(l,t.pvtGridObj._loadLevelElements,t)},_loadLevelElements:function(i,r){var u,r;i.pvtGridObj._waitingPopup.show();u=n.map(n(r).find("row"),function(t){if(parseInt(n(t).children("LEVEL_TYPE").text())!="1"&&n(t).children("HIERARCHY_UNIQUE_NAME").text().toLowerCase()!="[measures]")return treeNodeElement={hasChildren:!1,isChecked:!1,id:n(t).find("LEVEL_UNIQUE_NAME").text(),pid:n(t).find("HIERARCHY_UNIQUE_NAME").text(),name:n(t).find("LEVEL_CAPTION").text(),spriteCssClass:"level"+parseInt(n(t).children("LEVEL_NUMBER").text())+" e-icon",tag:n(t).find("LEVEL_UNIQUE_NAME").text()}});n.merge(i.pvtGridObj.schemaTreeView,u);!i.pvtGridObj.model.enableDrillThrough&&i.pvtGridObj._fieldData.measureSuccess?i.pvtGridObj._fieldData.measureSuccess?i.pvtGridObj._loadMeasureElements(i,i.pvtGridObj._fieldData.measureSuccess):(r={catalog:i.pvtGridObj.model.dataSource.catalog,cube:i.pvtGridObj.model.dataSource.cube,url:i.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_MEASURES"},i.pvtGridObj._getTreeData(r,i.pvtGridObj._loadMeasureElements,i)):t.Pivot._createDrillThroughDialog(i.pvtGridObj,i.pvtGridObj.schemaTreeView)},_loadMeasureGroups:function(t,i){t.pvtGridObj._fieldData.measuresGroups=n(i).find("row")},_loadMeasureElements:function(t,i){var e={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},a=t.pvtGridObj.model.dataSource,v=n.map(a.values,function(n){if(n.measures!=r)return n.measures}),s,y,h,o,l;for(this.reportItemNames=n.map(v,function(n){if(n.fieldName!=r)return n.fieldName}),s=[],y="",t.pvtGridObj.model.locale!="en-US"&&(e={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_MEASUREGROUPS"},t.pvtGridObj._getTreeData(e,this._loadMeasureGroups,{pvtGridObj:this,action:"loadFieldElements"})),o=0;o<n(i).find("row").length;o++){var c=n(n(i).find("row")[o]),u=c.children("MEASUREGROUP_NAME").text(),f=c.find("MEASURE_UNIQUE_NAME").text();n.inArray(u,s)>=0||(t.pvtGridObj.model.locale!="en-US"?(l=n.map(t.pvtGridObj._fieldData.measuresGroups,function(t){if(n(t).children("MEASUREGROUP_NAME").text()==u)return n(t).children("MEASUREGROUP_CAPTION").text()}),h=l.length>0?l[0]:u):h=u,treeNodeElement={hasChildren:!0,isChecked:!1,pid:"[Measures]",id:u,name:h,spriteCssClass:"measureGroupCDB e-icon",tag:u},t.pvtGridObj.schemaTreeView.push(treeNodeElement),s.push(u));treeNodeElement={hasChildren:!0,isSelected:n.inArray(f,this.reportItemNames)>=0,id:f,pid:u,name:c.children("MEASURE_CAPTION").text(),spriteCssClass:"measure",tag:f};t.pvtGridObj.schemaTreeView.push(treeNodeElement);n.inArray(f,t.pvtGridObj.reportItemNames)>=0&&t.pvtGridObj.reportItemNames.splice(t.pvtGridObj.reportItemNames.indexOf(f),1)}t.pvtGridObj._schemaData.model.olap.showKpi?(treeNodeElement={hasChildren:!0,isChecked:!1,id:"folderStruct",name:"KPI",spriteCssClass:"KPICDB folderCDB e-icon",tag:""},t.pvtGridObj.schemaTreeView.splice(1,0,treeNodeElement),e.request="MDSCHEMA_KPIS",t.pvtGridObj._getTreeData(e,t.pvtGridObj._loadKPIElements,t)):t.pvtGridObj._schemaData._createTreeView(this,t.pvtGridObj.schemaTreeView)},_loadKPIElements:function(t,i){for(var a=t.pvtGridObj.model.dataSource,f=this.reportItemNames,l=[],e=0;e<n(i).find("row").length;e++){var u=n(n(i).find("row")[e]),r=u.children("KPI_CAPTION").text(),o=u.children("KPI_goal").text(),s=u.children("KPI_STATUS").text(),h=u.children("KPI_TREND").text(),c=u.find("KPI_VALUE").text();n.inArray(u.children("KPI_NAME").text(),l)>=0||(treeNodeElement={hasChildren:!0,isChecked:!1,pid:"folderStruct",id:r,name:r,spriteCssClass:"measureGroupCDB e-icon",tag:r},t.pvtGridObj.schemaTreeView.push(treeNodeElement),l.push(r));treeNodeElement={hasChildren:!0,isSelected:n.inArray(o,f)>=0,id:o,pid:r,name:t.pvtGridObj._getLocalizedLabels("Goal"),spriteCssClass:"kpiGoal e-icon",tag:o};t.pvtGridObj.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(s,f)>=0,id:s,pid:r,name:t.pvtGridObj._getLocalizedLabels("Status"),spriteCssClass:"kpiStatus e-icon",tag:s};t.pvtGridObj.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(h,f)>=0,id:h,pid:r,name:t.pvtGridObj._getLocalizedLabels("Trend"),spriteCssClass:"kpiTrend e-icon",tag:h};t.pvtGridObj.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(c,f)>=0,id:c,pid:r,name:t.pvtGridObj._getLocalizedLabels("Value"),spriteCssClass:"kpiValue e-icon",tag:c};t.pvtGridObj.schemaTreeView.push(treeNodeElement)}t.pvtGridObj._schemaData._createTreeView(this,t.pvtGridObj.schemaTreeView);delete t.pvtGridObj.reportItemNames;delete t.pvtGridObj.schemaTreeView},_getTreeData:function(n,i,r){var u=t.olap.base._getConnectionInfo(n.url),f='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>'+n.request+"<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>"+n.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><LocaleIdentifier>"+u.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";this.doAjaxPost("POST",u.url,{XMLA:f},i,null,r)},_addHyperlink:function(i){if(n(".hyperlinkValueCell")[0]&&n(n(".hyperlinkValueCell")[0]).removeClass("hyperlinkValueCell"),n(".hyperlinkHeaderCell")[0]&&n(n(".hyperlinkHeaderCell")[0]).removeClass("hyperlinkHeaderCell"),n(i.target).text()==""||n(i.target).text()==null)return!1;i.target.parentElement.className.replace(/^\s+/,"").split(" ")[0]=="value"&&(this.enableValueCellHyperlink()||(t.isNullOrUndefined(this._pivotClientObj)?this.model.enableDrillThrough:this._pivotClientObj.model.enableDrillThrough))?n(i.target).addClass("hyperlinkValueCell"):n(i.target.parentElement).hasClass("summary value")&&this.enableSummaryCellHyperlink()?n(i.target).addClass("hyperlinkValueCell"):i.target.parentElement.className.split(" ")[0]=="rowheader"||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&n(i.target.parentElement).attr("role")=="rowheader"?this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot||this.model.enableDeferUpdate||n(this.element).parents(".e-pivotclient").length!=0?this.enableRowHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell"):n(i.target.parentElement).hasClass("rgtot")||(fieldIndex=n(i.target.parentElement).attr("p").split(",")[0],this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&!t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotRows[fieldIndex])&&JSON.parse(this.getOlapReport()).PivotRows[fieldIndex].EnableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.dataSource.rows.length>0&&!t.isNullOrUndefined(this.model.dataSource.rows[fieldIndex].enableHyperlink)&&this.model.dataSource.rows[fieldIndex].enableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.enableRowHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell")):(i.target.parentElement.className.split(" ")[0]=="colheader"||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&n(i.target.parentElement).attr("role")=="columnheader")&&(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot||this.model.enableDeferUpdate||n(this.element).parents(".e-pivotclient").length!=0?this.enableColumnHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell"):n(i.target.parentElement).hasClass("calc")||n(i.target.parentElement).hasClass("cgtot")||n(i.target.parentElement).hasClass("gtot")||(fieldIndex=n(i.target.parentElement).attr("p").split(",")[1],this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&!t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotColumns[fieldIndex])&&JSON.parse(this.getOlapReport()).PivotColumns[fieldIndex].EnableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&!t.isNullOrUndefined(this.model.dataSource.columns[fieldIndex].enableHyperlink)&&this.model.dataSource.columns[fieldIndex].enableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.enableColumnHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell")))},_removeHyperlink:function(t){n(t.target).removeClass("hyperlinkValueCell").removeClass("hyperlinkHeaderCell")},_cellContext:function(i){var r=n(i.target).parents(".e-pivotgrid").data("ejPivotGrid"),u=(n(i.target).hasClass("cellValue")?n(i.target).parent()[0]:i.target)||(n(i.srcElement).hasClass("cellValue")?n(i.srcElement).parent()[0]:i.srcElement),f;if(!t.isNullOrUndefined(r)&&r.enableCellContext()==!0&&n(u).parents("#"+r._id)[0]&&(f=n(u).attr("p"),f)){var f=r._excelLikeJSONRecords!=null&&r.model.layout.toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?n(u).attr("i"):n(u).attr("p"),e=r._excelLikeJSONRecords!=null&&r.model.layout.toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?r._excelLikeJSONRecords[parseInt(parseInt(f.split(",")[0])*r._excelRowCount+parseInt(f.split(",")[1]))].Info:r.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*r._rowCount+parseInt(f.split(",")[1]))].Info,o={cellValue:u.innerHTML,cellPosition:f,cellType:u.className.split(" ")[0]!=""?u.className.split(" ")[0]:u.className.split(" ")[1],role:n(u).attr("role"),uniqueName:e.split("::")[0],args:i,rawdata:e};o.cellType!=""&&r._trigger("cellContext",{args:o});i.target?i.preventDefault():window.event.returnValue=!1}},_initCellSelection:function(i){var r,u;n("#"+this._id+" td,th").removeClass("highlighted");this._on(this.element,"mouseup touchend",".value",this._completeCellSelection);_oriX=i.pageX;_oriY=i.pageY;r=i.target||window.event.srcElement;n(r).hasClass("cellValue")&&(r=r.parentElement);n(".value").addClass("selection");n("#"+this._id).append(t.buildTag("div.cellSelection#"+this._id+"_cellSelection","",{}));_startPosCell=n(r)[0].attributes.getNamedItem("p").value;this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&(u=this._excelLikeJSONRecords[0*this._rowCount+parseInt(n(r)[0].attributes.getNamedItem("i").value.split(",")[1])].Index,_startPosCell=this.getJSONRecords()[parseInt(n(r)[0].attributes.getNamedItem("p").value.split(",")[0])*this._rowCount+parseInt(u.split(",")[1])].Index);this._on(this.element,"mousemove touchmove",".value, .cellSelection",this._cellSelection)},_headerClickCellSelection:function(i){var r=n(i.target).attr("class").indexOf("colheader")&&n(i.target).attr("class").indexOf("rowheader")==-1?n(i.target).attr("class").indexOf("cellValue")!=-1?n(i.target).parent():null:n(i.target),s,o,h;if(r!=null){n("#"+this._id+" td,th").removeClass("highlighted");var f,e,u;for(f=r.attr("role"),u=f=="columnheader"?r.attr("p").split(",")[0]:r.attr("p").split(",")[1],e=f=="columnheader"?r.attr("colspan"):r.attr("rowspan"),this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&(s=parseInt(r.attr("p").split(",")[0])*this._rowCount+parseInt(r.attr("p").split(",")[1]),e=f=="columnheader"?this._excelLikeJSONRecords[parseInt(r.attr("i").split(",")[0])*this._rowCount+parseInt(r.attr("i").split(",")[1])].ColSpan:this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.getJSONRecords()[s+this._rowCount]!=null&&this.getJSONRecords()[s+this._rowCount].CSS.indexOf("value")==-1?this.getJSONRecords()[s].RowSpan+1:this.getJSONRecords()[s].RowSpan),o=0;o<e;o++)f=="columnheader"?(n("#"+this._id+" [p^='"+(parseInt(o)+parseInt(u))+",']").addClass("highlighted"),n("#"+this._id+" [p^='"+(parseInt(o)+parseInt(u))+",'][role='columnheader']").each(function(t,i){(parseInt(i.attributes.p.value.split(",")[1])<=parseInt(r.attr("p").split(",")[1])||parseInt(i.attributes.colspan.value)>parseInt(r.attr("colspan")))&&n(i).removeClass("highlighted")})):(n("#"+this._id+" [p$=',"+(parseInt(o)+parseInt(u))+"']").addClass("highlighted"),n("#"+this._id+" [p$=',"+(parseInt(o)+parseInt(u))+"'][role='rowheader']").each(function(t,i){(parseInt(i.attributes.p.value.split(",")[0])<=parseInt(r.attr("p").split(",")[0])||parseInt(i.attributes.rowspan.value)>parseInt(r.attr("rowspan")))&&n(i).removeClass("highlighted")}));_startPosCell=f=="columnheader"?n("#"+this._id+" [p^='"+(0+parseInt(u))+",'].value").eq(0).attr("p"):n("#"+this._id+" [p$=',"+(0+parseInt(u))+"'].value").eq(0).attr("p");this._excelLikeJSONRecords==null||this.layout().toLowerCase()!=t.PivotGrid.Layout.ExcelLikeLayout||this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||(_startPosCell=f=="columnheader"?n("#"+this._id+" [p^='"+(0+parseInt(u))+",'].value:not(.summary)").eq(0).attr("p"):n("#"+this._id+" [p$=',"+(0+parseInt(u))+"'].value:not(.summary)").eq(0).attr("p"));h=f=="columnheader"?n("#"+this._id+" [p^='"+(parseInt(e)-1+parseInt(u))+",']").eq(n("#"+this._id+" [p^='"+(parseInt(e)-1+parseInt(u))+",']").length-1):n("#"+this._id+" [p$=',"+(parseInt(e)-1+parseInt(u))+"']").eq(n("#"+this._id+" [p$=',"+(parseInt(e)-1+parseInt(u))+"']").length-1);this._completeCellSelection(h)}},_cellSelection:function(i){n("#"+this._id+"_gridTooltip").hide();var r=n(i.target).parents(".e-pivotclient").length>0,u=i.pageX-this.element.offset().left-(_oriX-this.element.offset().left),f=i.pageY-this.element.offset().top-(_oriY-this.element.offset().top),e=_oriX-this.element.offset().left,o=_oriY-this.element.offset().top+3;u<0&&(u=Math.abs(u),e-=u-5);f<0&&(f=Math.abs(f),o-=f-12);i.pageX<_oriX?n("#"+this._id+"_cellSelection").css({left:r?e:i.pageX+2,width:r?u:_oriX-i.pageX}):n("#"+this._id+"_cellSelection").css({left:r?e:_oriX-6,width:r?u:i.pageX-_oriX});i.pageY<_oriY?n("#"+this._id+"_cellSelection").css({top:r?o:i.pageY,height:r?f:_oriY-i.pageY-7}):n("#"+this._id+"_cellSelection").css({top:r?o:_oriY+7,height:r?f:i.pageY-_oriY-11});n(".pivotGridTable").mouseleave(function(i){var r=n(i.target).parents(".e-pivotgrid").data("ejPivotGrid");t.isNullOrUndefined(i.toElement)||t.isNullOrUndefined(i.toElement.classList)||i.toElement.classList[0]!="e-pivotgrid"||(n("#"+r._id+"_cellSelection").remove(),n(".value").removeClass("selection"),r._off(r.element,"mouseup mouseend",".value"))})},_completeCellSelection:function(i){var h,e,k=[],tt=[],u,it=[],c,ot,v,o,l,y,a,ut,p,s,b,g,ft,nt,et;for(this._off(this.element,"mousemove touchmove",".value"),n(".value").removeClass("selection"),h=n(i).hasClass("value")?i:i.target||window.event.srcElement,n(h).hasClass("cellValue")&&(h=h.parentElement),e=n(h)[0].attributes.getNamedItem("p").value,this._excelLikeJSONRecords==null||this.layout().toLowerCase()!=t.PivotGrid.Layout.ExcelLikeLayout||n(i).hasClass("value")||(ot=this._excelLikeJSONRecords[0*this._rowCount+parseInt(n(h)[0].attributes.getNamedItem("i").value.split(",")[1])].Index,e=this.getJSONRecords()[parseInt(n(h)[0].attributes.getNamedItem("p").value.split(",")[0])*this._rowCount+parseInt(ot.split(",")[1])].Index),v=0,o=parseInt(_startPosCell.split(",")[1])<parseInt(e.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(e.split(",")[1]);o<=(parseInt(_startPosCell.split(",")[1])>parseInt(e.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(e.split(",")[1]));o++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("td[p*=',"+o+"']").parent().is(":visible"))for(l=parseInt(_startPosCell.split(",")[0])<parseInt(e.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(e.split(",")[0]);l<=(parseInt(_startPosCell.split(",")[0])>parseInt(e.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(e.split(",")[0]));l++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("[p*='"+l+",']").last("th").is(":Visible")){k[v]=this.getJSONRecords()[l*this._rowCount+o];var f,w="",rt,st,d=0,ht=0;if(u=this.element.find(".summary[role!='gridcell'][p$=',"+o+"'] , .rowheader[role!='gridcell'][p$=',"+o+"']").last().attr("p"),u==r&&(u=n("#"+this._id).find("tbody").find('[p="'+l+","+o+'"]').parent("tr").find(".summary").first().attr("p")),rt=u,u!=null){while(u[0]>=0)u==this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Index&&(f=this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Value,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f=n("#"+this._id).find("td[p*='"+l+","+o+"']").prevAll("th").children(".expand").length>0?f.replace(this._getLocalizedLabels("Total"),""):f),u=parseInt(u.split(",")[0])-1+","+parseInt(u.split(",")[1])),w&&f!=""?w=f+"##"+w:f!=""&&(w=f);tt[v]=w}for(y="",ut=this.element.find('tr:has(".colheader")').length-1,st=ut,c=k[v].Index,c!=r&&c==this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))].Index&&(p=parseInt(c.split(",")[0])),s=0;s<=ut;s++){if(p!=null&&p+","+s==this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+s)].Index){if(a=this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+s)].Value,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(b=p;b>=0;b--)if(n("#"+this._id).find("th[p*='"+b+","+s+"']").length>0){a=n("#"+this._id).find("th[p*='"+b+","+s+"']").find(".expand").length>0?a.replace(this._getLocalizedLabels("Total"),""):a;break}y==""?y=a:a!=""&&(y=y+"##"+a)}it[v]=y}v++}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap){for(g=this.getJSONRecords()[parseInt(parseInt(rt.split(",")[0])*this._rowCount+parseInt(rt.split(",")[1]))].Info;g[0]>=0;)f=this.getJSONRecords()[parseInt(parseInt(g.split(",")[0])*this._rowCount+parseInt(g.split(",")[1]))].Info,(f.split("::")[0].indexOf("Measures")>0||f.split("::")[0].indexOf("MEASURES")>0)&&d++,u=parseInt(u.split(",")[0])-1+","+parseInt(u.split(",")[1]);if(ft=parseInt(c.split(",")[0]),d==0)for(nt=0;nt<=st;nt++)ft!=null&&(et=this.getJSONRecords()[parseInt(parseInt(ft)*this._rowCount+nt)].Info),(et.split("::")[0].indexOf("Measures")>0||et.split("::")[0].indexOf("MEASURES")>0)&&ht++}else measureCount=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this.getOlapReport()).PivotCalculations.length:this.model.dataSource.values.length;args={JSONRecords:k,rowHeader:tt,columnHeader:it,measureCount:d>0?"Row:"+d:"Column:"+ht};this._trigger("cellSelection",args);k=tt=it=[];n("#"+this._id+"_cellSelection").remove();this.model.enableToolTip&&this._on(this.element,"mousemove touchmove",".value",this._applyToolTip);this._off(this.element,"mouseup touchend",".value")},exportPivotGrid:function(i,u){var f={url:"",fileName:"PivotGrid",exportMode:t.PivotGrid.ExportMode.JSON,title:"",description:"",exportType:i,controlName:this},o,h,c,s,e;if(this._trigger("beforeExport",f),o={rowCellColor:t.isNullOrUndefined(this.element.find(".rowheader"))?"":t.isNullOrUndefined(this.element.find(".rowheader").css("color"))?"rgb(51, 51, 51)":this.element.find(".rowheader").css("color"),rowCellBGColor:t.isNullOrUndefined(this.element.find(".rowheader"))?"":t.isNullOrUndefined(this.element.find(".rowheader").css("background-color"))?"rgb(255, 255, 255)":this.element.find(".rowheader").css("background-color"),columnCellColor:t.isNullOrUndefined(this.element.find(".colheader"))?"":t.isNullOrUndefined(this.element.find(".colheader").css("color"))?"rgb(51, 51, 51)":this.element.find(".colheader").css("color"),columnCellBGColor:t.isNullOrUndefined(this.element.find(".colheader"))?"":t.isNullOrUndefined(this.element.find(".colheader").css("background-color"))?"rgb(255, 255, 255)":this.element.find(".colheader").css("background-color"),valueCellColor:t.isNullOrUndefined(this.element.find(".value"))?"":t.isNullOrUndefined(this.element.find(".value").css("color"))?"rgb(51, 51, 51)":this._cFormat.length<=0?this.element.find(".value").css("color"):"rgb(51, 51, 51)",valueCellBGColor:t.isNullOrUndefined(this.element.find(".value"))?"":t.isNullOrUndefined(this.element.find(".value").css("background-color"))?"rgb(255, 255, 255)":this._cFormat.length<=0?this.element.find(".value").css("background-color"):"rgb(255, 255, 255)",summaryCellColor:t.isNullOrUndefined(this.element.find(".summary"))?"":t.isNullOrUndefined(this.element.find(".summary").css("color"))?"rgb(51, 51, 51)":this.element.find(".summary").css("color"),summaryCellBGColor:t.isNullOrUndefined(this.element.find(".summary"))?"":t.isNullOrUndefined(this.element.find(".summary").css("background-color"))?"rgb(255, 255, 255)":this.element.find(".summary").css("background-color")},this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode||f.exportMode==t.PivotGrid.ExportMode.JSON)e={args:JSON.stringify({pGridData:this.exportRecords!=null&&this.exportRecords!=""?this.exportRecords:null,rowCount:this._excelLikeJSONRecords!=null?this._excelRowCount:this._rowCount,columnCount:this._excelLikeJSONRecords!=null?Math.floor(this._excelLikeJSONRecords.length/this._excelRowCount):this.getJSONRecords()!=null?Math.floor(this.getJSONRecords().length/this._rowCount):0,fileName:t.isNullOrUndefined(u)?t.isNullOrUndefined(f.fileName)?"PivotGrid":f.fileName:u,colorSettings:o,Formatting:this._cFormat,title:f.title,description:f.description,customObject:JSON.stringify(this.model.customObject)})},t.raiseWebFormsServerEvents&&(i=="excelExport"||i=="wordExport"||i=="pdfExport"||i=="csvExport")&&f.exportMode==t.PivotGrid.ExportMode.JSON&&n.trim(f.url)==""?(h={model:this.model,originalEventType:i},c=e,t.raiseWebFormsServerEvents(i,h,c),setTimeout(function(){t.isOnWebForms=!0},1e3)):this.doPostBack(n.trim(f.url)!=""?f.url:i,e);else{try{s=JSON.parse(this.getOlapReport()).Report}catch(l){s=this.getOlapReport()}e={args:JSON.stringify({exportOption:i,currentReport:s,layout:this.layout(),colorSettings:o!=r?JSON.stringify(o):"",customObject:JSON.stringify(this.model.customObject),title:f.title,description:f.description})};this.doPostBack(n.trim(f.url)!=""?f.url:this.model.url+"/"+this.model.serviceMethodSettings.exportPivotGrid,e)}},_createCalculatedField:function(){var i,r;t.Pivot.openPreventPanel(this);this.element.find(".calculatedFieldPopup",".clientDialog",".e-dialog").remove();dialogTitle=this._getLocalizedLabels("CalculatedField");var u=t.buildTag("label#"+this._id+"_lblCalFieldName",this._getLocalizedLabels("Name"))[0].outerHTML,f=t.buildTag("span.fieldDropDown",t.buildTag("input#"+this._id+"_calculateFieldList","",{},{type:"text"})[0].outerHTML+t.buildTag("input#"+this._id+"_calculateFieldName.calculateFieldName","",{"margin-left":this.model.enableRTL?"56px":"2px",outline:"none"},{type:"text"})[0].outerHTML,{})[0].outerHTML,e=t.buildTag("button#"+this._id+"_btnAdd",this._getLocalizedLabels("Add"),{"margin-top":"-5px"},{name:this._getLocalizedLabels("Add")})[0].outerHTML,o=t.buildTag("label#"+this._id+"_lblCalFieldFormula",this._getLocalizedLabels("Formula"))[0].outerHTML,s=t.buildTag("input.calculatedFieldFormula#"+this._id+"_calculatedFieldFormula","",{width:"192px",height:"27px"},{type:"text",disabled:"disabled"})[0].outerHTML,h=t.buildTag("button#"+this._id+"_btnDelete",this._getLocalizedLabels("Delete"),{"margin-top":"-24px"},{name:this._getLocalizedLabels("Delete")})[0].outerHTML,c=t.buildTag("label#"+this._id+"_pivotGridValueFields",this._getLocalizedLabels("Fields"))[0].outerHTML,l=t.buildTag("ul#"+this._id+"_fieldCollection","")[0].outerHTML,a=t.buildTag("button.calculatorFields","",{"margin-left":this.model.enableRTL?"0px":"10px","margin-right":this.model.enableRTL?"10px":"0px"})[0].outerHTML,v=t.buildTag("span.editFormula e-icon e-cancel","",{padding:"3px","margin-left":"-54px","margin-right":this.model.enableRTL?"-54px":"0px",position:"relative"}).attr("aria-label","cancel")[0].outerHTML,y=t.buildTag("span",t.buildTag("button#"+this._id+"_btnInsert",this._getLocalizedLabels("InsertField"),{},{name:this._getLocalizedLabels("InsertField")})[0].outerHTML,{"margin-right":"150px","margin-left":"150px"})[0].outerHTML,p=t.buildTag("button#"+this._id+"_btnOk",this._getLocalizedLabels("OK"),{"margin-left":"10px"},{name:this._getLocalizedLabels("OK")})[0].outerHTML,w=t.buildTag("button#"+this._id+"_btnCancel",this._getLocalizedLabels("Cancel"),{"margin-left":this.model.enableRTL?"0px":"10px"},{name:this._getLocalizedLabels("Cancel")})[0].outerHTML;dialogFooter=t.buildTag("div",p+w,{float:this.model.enableRTL?"left":"right","margin-bottom":"15px","margin-top":"4px"})[0].outerHTML;var b=t.buildTag("div.calcFormulaDiv",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td","+")[0].outerHTML+t.buildTag("td","-")[0].outerHTML+t.buildTag("td","*")[0].outerHTML+t.buildTag("td","/")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","7")[0].outerHTML+t.buildTag("td","8")[0].outerHTML+t.buildTag("td","9")[0].outerHTML+t.buildTag("td","%")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","4")[0].outerHTML+t.buildTag("td","5")[0].outerHTML+t.buildTag("td","6")[0].outerHTML+t.buildTag("td","^")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","1")[0].outerHTML+t.buildTag("td","2")[0].outerHTML+t.buildTag("td","3")[0].outerHTML+t.buildTag("td","(")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",".")[0].outerHTML+t.buildTag("td","0")[0].outerHTML+t.buildTag("td","C")[0].outerHTML+t.buildTag("td",")")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{display:"none"})[0].outerHTML,k=t.buildTag("div#calculatedField.dlgCalculatedField",'<table class="outerTable"><tr><td>'+u+"<\/td><td>"+f+"<\/td><td>"+e+"<\/td><\/tr><tr><td>"+o+"<\/td><td>"+s+a+v+"<\/td><td>"+h+'<\/td><\/tr><\/table><p class="borderLine"><\/p><table class="fieldTable"><tr><td>'+c+"<\/td><\/tr><tr><td>"+l+"<\/td><\/tr><tr><td>"+y+"<\/td><\/tr><\/table>")[0].outerHTML,d=t.buildTag("div#clientDialog.clientDialog",k+dialogFooter+b,{opacity:"1"}).attr("title",dialogTitle)[0].outerHTML;n(d).appendTo("#"+this._id);this.element.find(".clientDialog").ejDialog({width:"auto",target:"#"+this._id,enableRTL:this.model.enableRTL,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)});n("#"+this._id+"_btnAdd,#"+this._id+"_btnDelete,#"+this._id+"_btnOk,#"+this._id+"_btnCancel").ejButton({type:t.ButtonType.Button,width:"80",enableRTL:this.model.enableRTL});n("#"+this._id+"_btnInsert").ejButton({type:t.ButtonType.Button,enabled:!1,width:"100",enableRTL:this.model.enableRTL});n(".calculatorFields").ejButton({type:t.ButtonType.Button,contentType:"imageonly",prefixIcon:"e-icon e-sigma",htmlAttributes:{title:"Click Me"},enableRTL:this.model.enableRTL});n("#"+this._id+"_calculateFieldList").ejDropDownList({width:"230px",enableRTL:this.model.enableRTL,dataSource:this._calculatedField,fields:{text:"name",value:"name"},select:t.proxy(this._calculatedFieldListChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});i=[];this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(JSON.parse(this.getOlapReport()).PivotCalculations).each(function(){this.CalculationType!=8&&this.CalculationType!="Formula"&&i.push({fields:this.FieldName})}):n(n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1})).each(function(){i.push({fields:this.fieldName})});r=n("#"+this._id+"_btnInsert").data("ejButton");this._calculatedField.length==0&&(n("#"+this._id+"_btnOk").ejButton("disable"),n("#"+this._id+"_btnOk").attr("disabled","disabled"));n("#"+this._id+"_fieldCollection").ejListBox({dataSource:i,enableRTL:this.model.enableRTL,select:function(){r.enable()},height:"130",width:"400"});r.disable();this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"));n(".calculatorFields").click(function(){n("div.calcFormulaDiv").removeAttr("style")});n(".editFormula").click(function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i=n("#"+t._id+"_calculatedFieldFormula").val().lastIndexOf(" ");n("#"+t._id+"_calculatedFieldFormula").val()!==""&&i>0?i+1==n("#"+t._id+"_calculatedFieldFormula").val().length?n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val().substring(0,i-2)):n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val().substring(0,i)+" "):n("#"+t._id+"_calculatedFieldFormula").val("")});n(document).click(function(t){n(t.target).hasClass("calculatorFields")||n(t.target).hasClass("e-sigma")||n(t.target).parents(".calcFormulaDiv").length>0||n("div.calcFormulaDiv").css("display","none")});n("div.calcFormulaDiv").on("click","td",function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i=this.textContent=="C"?n("#"+t._id+"_calculatedFieldFormula").val(""):n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val()+("+-/%^*".indexOf(this.textContent)>-1?" "+this.textContent+" ":this.textContent))});n("#"+this._id+"_btnInsert").click(function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i=n("#"+t._id+"_fieldCollection").data("ejListBox");n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val()+i.value())});n("#"+this._id+"_btnAdd").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),r=n("#"+i._id+"_calculatedFieldFormula").val().split(" "),o=-1,f,s,e,u;if(n("#"+i._id+"_calculateFieldName").val()==""||n("#"+i._id+"_calculatedFieldFormula").val()==""){t.Pivot._createErrorDialog(i._getLocalizedLabels("EmptyField"),i._getLocalizedLabels("Warning"),i);return}for(u=0;u<r.length;u++){if(o="+-/%^*".indexOf(r[u])>-1?u:-1,o>-1&&r.length>0&&(r[0]==""||r[0]=="."||r[r.length-1]==""||r[r.length-1]=="."||r[o+1]==""||r[o+1]==".")){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotValid"),i._getLocalizedLabels("Warning"),i);return}if(r[u].indexOf("(")==r[u].length-1||r[u].indexOf(")")==0||n("#"+i._id+"_calculatedFieldFormula").val().replace(/[^\(_]/g,"").length!=n("#"+i._id+"_calculatedFieldFormula").val().replace(/[^\)_]/g,"").length){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotValid"),i._getLocalizedLabels("Warning"),i);return}}for(f=[],i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(JSON.parse(i.getOlapReport()).PivotCalculations).each(function(){this.CalculationType!=8&&this.CalculationType!="Formula"&&f.push({fields:this.FieldName})}):n(i.model.dataSource.values).each(function(){f.push({fields:this.fieldName})}),r=n("#"+i._id+"_calculatedFieldFormula").val().replace(/\(|\)/g," ").split(" "),u=0;u<r.length;u++){for(s=!1,e=0;e<f.length;e++)if(r[u].indexOf(f[e].fields)>-1&&r[u]!=f[e].fields)s=!0;else if(r[u]==f[e].fields){s=!1;break}if(s){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotPresent"),i._getLocalizedLabels("Warning"),i);return}}for(u=0;u<i._calculatedField.length;u++)if(i._calculatedField[u].name==n("#"+i._id+"_calculateFieldName").val()){if(confirm(i._getLocalizedLabels("Confirm"))){i._calculatedField[u].formula=n("#"+i._id+"_calculatedFieldFormula").val();n("#"+i._id+"_calculatedFieldFormula").val("");n("#"+i._id+"_calculateFieldName").val("");n("#"+i._id+"_calculateFieldList").ejDropDownList({dataSource:i._calculatedField,fields:{text:"name",value:"name"},enableRTL:i.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});return}return}i._calculatedField.push({name:n("#"+i._id+"_calculateFieldName").val(),formula:n("#"+i._id+"_calculatedFieldFormula").val()});n("#"+i._id+"_calculatedFieldFormula").val("");n("#"+i._id+"_calculateFieldName").val("");n("#"+i._id+"_calculateFieldList").ejDropDownList({dataSource:i._calculatedField,fields:{text:"name",value:"name"},enableRTL:i.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});i._calculatedField.length>0&&(n("#"+i._id+"_btnOk").ejButton("enable"),n("#"+i._id+"_btnOk").removeAttr("disabled"))});n("#"+this._id+"_btnDelete").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),u,f,e,s,r,h,o;if(i._calculatedField.length==0){t.Pivot._createErrorDialog(i._getLocalizedLabels("CalculatedFieldNameNotFound"),i._getLocalizedLabels("Warning"),i);return}for(u=hederTag=n("#"+i._id+"_calculateFieldName").val(),r=0;r<i._calculatedField.length;r++)if(i._calculatedField[r].name==n("#"+i._id+"_calculateFieldName").val()){if(i.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)i.model.dataSource.values=n.grep(i.model.dataSource.values,function(n){return n.fieldCaption!=i._calculatedField[r].name}),i._calculatedField.splice(r,1),i._populatePivotGrid();else{for(i._calculatedField.splice(r,1),r=0;r<i._pivotTableFields.length;r++)i._pivotTableFields[r].name==u&&(i._pivotTableFields[r].isSelected=!1,headerTag=i._pivotTableFields[r],i._pivotTableFields.splice(r,1));try{f=JSON.parse(i.getOlapReport()).Report}catch(c){f=i.getOlapReport()}s="schemaRow::"+headerTag.id+"::FILTERED";i._schemaData==null&&(i.model.beforeServiceInvoke!=null&&i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&i._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:i.element,customObject:i.model.customObject}),h=JSON.stringify(i.model.customObject),e=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(headerTag),dropAxis:"schemaValue::",sortedHeaders:i._ascdes,filterParams:s,currentReport:f,valueSorting:JSON.stringify(i.model.valueSortSettings),customObject:h}),i.model.enableDeferUpdate?i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.nodeStateModified,e.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),i._nodeStateModifiedSuccess):i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.nodeStateModified,e,i._nodeStateModifiedSuccess))}i._schemaData!=null&&(o=i._schemaData._tableTreeObj.element.find("li[id='"+u+"']"),i._schemaData._tableTreeObj.uncheckNode(o),i._schemaData._tableTreeObj.model.beforeDelete=null,i._schemaData._tableTreeObj.removeNode(o),i._schemaData._tableTreeObj.model.beforeDelete=function(){return!1})}else if(r==i._calculatedField.length-1){t.Pivot._createErrorDialog(i._getLocalizedLabels("CalculatedFieldNameNotFound"),i._getLocalizedLabels("Warning"),i);return}});n("#"+this._id+"_btnOk").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),r,f,u,o,e,s;for(i.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&(i.model.dataSource.values=n.grep(i.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1})),r=0;r<i._calculatedField.length;r++){for(f=i._calculatedField[r].formula.replace(/\(|\)/g," ").replace(/[-+*/^%]/g," ").split(" "),u=0;u<f.length;u++)if(!n.isNumeric(f[u])&&f[u].replace(/\s+|\s+$/gm,"")!=""&&(o=i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.grep(JSON.parse(i.getOlapReport()).PivotCalculations,function(n){return n.FieldName==f[u]}).length:n.grep(i.model.dataSource.values,function(n){return n.fieldName==f[u]}).length,o==0)){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotPresent"),i._getLocalizedLabels("Warning"),i);return}e=i._calculatedField[r].formula.replace(/\s+|\s+$/gm,"");e=i._parenthesisAsterisk(e);i.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode&&n.grep(i.model.dataSource.values,function(n){return n.fieldName==i._calculatedField[r].name&&(n.formula=i._calculatedField[r].formula),n.fieldName==i._calculatedField[r].name}).length==0&&(i.model.dataSource.values.push({fieldName:i._calculatedField[r].name,fieldCaption:i._calculatedField[r].name,isCalculatedField:!0,formula:e}),i._schemaData!=null&&i._schemaData._tableTreeObj.element.find("li[id='"+i._calculatedField[r].name+"']").find(".e-chk-inact").length>0&&i._schemaData._tableTreeObj.checkNode(i._calculatedField[r].name))}if(i.element.find(".e-dialog, .clientDialog").remove(),t.Pivot.closePreventPanel(i),i.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode)i._populatePivotGrid();else{t.isNullOrUndefined(i._waitingPopup)||i._waitingPopup.show();try{report=JSON.parse(i.getOlapReport()).Report}catch(h){report=i.getOlapReport()}i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"calculatedField",element:i.element,customObject:i.model.customObject});s=JSON.stringify(i.model.customObject);eventArgs=JSON.stringify({action:"calculatedField",headerTag:JSON.stringify(i._calculatedField),currentReport:report,valueSorting:JSON.stringify(i.model.valueSortSettings),customObject:s});i.model.enableDeferUpdate?(t.isNullOrUndefined(i._waitingPopup)||i._waitingPopup.hide(),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.calculatedField,eventArgs.replace("calculatedField","calculatedFieldDeferUpdate"),i._schemaData==null?i._renderControlSuccess:i._schemaCalculatedField)):i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.calculatedField,eventArgs,i._schemaData==null?i._renderControlSuccess:i._schemaCalculatedField)}});n("#"+this._id+"_btnCancel").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");i.element.find(".e-dialog, .clientDialog").remove();t.Pivot.closePreventPanel(i)});this._curFocus.field=this.element.find(".e-dialog .calculateFieldName").attr("tabindex","-1").focus().addClass("hoverCell")},_schemaCalculatedField:function(i){var f,u,r;for(this._schemaData._tableTreeObj.model.nodeCheck=null,this._schemaData._tableTreeObj.model.nodeUncheck=null,r=0;r<this._calculatedField.length;r++)f=this._schemaData.element.find(".schemaFieldTree").data("ejTreeView"),this._schemaData._tableTreeObj.element.find("li[id='"+this._calculatedField[r].name+"']").length==0?(u=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?{id:this._calculatedField[r].name,name:this._calculatedField[r].name,caption:this._calculatedField[r].name,isSelected:!0,spriteCssClass:""}:{id:this._calculatedField[r].name,name:this._calculatedField[r].name,isSelected:!0,calculationType:8,formula:this._calculatedField[r].formula,summaryType:6,format:null,allowRunTimeGroupByField:"false",pivotType:"PivotComputationInfo",spriteCssClass:""},this._pivotTableFields.push(u),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&(this._pivotTableFields=t.PivotAnalysis.getTreeViewData(this.model.dataSource)),this._schemaData._setTableFields(this._pivotTableFields),f.addNode(u),this._schemaData._tableTreeObj.element.find(".e-item").css("padding","0px")):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._schemaData!=null&&this._schemaData._tableTreeObj.element.find("li[id='"+this._calculatedField[r].name+"']").find(".e-chk-inact").length>0?this._schemaData._tableTreeObj.checkNode(this._calculatedField[r].name):this._schemaData._tableTreeObj.element.find("li[id='"+this._calculatedField[r].name+"']").removeClass("filter").find(".treeDrop , .filter").remove();if(this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style"),this._schemaData._tableTreeObj.model.nodeCheck=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._schemaData._checkedStateModified,this._schemaData):t.proxy(this._schemaData._pivotCheckedStateModified,this._schemaData),this._schemaData._tableTreeObj.model.nodeUncheck=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._schemaData._checkedStateModified,this._schemaData):t.proxy(this._schemaData._pivotCheckedStateModified,this._schemaData),this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(this.model.enableDeferUpdate?(this._isUpdateRequired=!0,this._deferUpdateSuccess(i)):this._renderControlSuccess(i)),n(this._schemaData.element.find(".schemaValue .pivotButton")).each(function(){n(this).remove()}),t.isNullOrUndefined(this._pivotClientObj)||typeof this._pivotClientObj._pivotSchemaDesigner=="undefined")if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(report=JSON.parse(this.getOlapReport()),r=0;r<report.PivotCalculations.length;r++)this._schemaData._createPivotButton({fieldName:report.PivotCalculations[r].FieldName,fieldCaption:report.PivotCalculations[r].FieldHeader},"value","","","");else for(r=0;r<this.model.dataSource.values.length;r++)this._schemaData._createPivotButton({fieldName:this.model.dataSource.values[r].fieldName,fieldCaption:this.model.dataSource.values[r].fieldCaption},"value","","","");else this._schemaData._refreshPivotButtons();this._schemaData._setPivotBtnWidth()},_calculatedFieldListChange:function(t){n("#"+this._id+"_calculateFieldName").val(t.selectedText);for(var i=0;i<this._calculatedField.length;i++)this._calculatedField[i].name==t.selectedText&&n("#"+this._id+"_calculatedFieldFormula").val(this._calculatedField[i].formula)},_parenthesisAsterisk:function(n){for(var t=1;t<n.length-1;t++)n[t]=="("&&"+-/%^*(".indexOf(n[t-1])==-1&&(n=n.substring(0,t)+"*"+n.substring(t),t--),n[t]==")"&&"+-/%^*)".indexOf(n[t+1])==-1&&(n=n.substring(0,t+1)+"*"+n.substring(t+1),t--);return n},_calcFieldNodeDrop:function(t){for(var r=n.grep(this.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(t.fieldName)>-1}),i=0;i<r.length;i++)this._schemaData._tableTreeObj.uncheckNode(r[i].fieldName)},_schemaButtonCreate:function(){if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){n(this._schemaData.element.find(".schemaValue .pivotButton")).each(function(){n(this).remove()});report=JSON.parse(this.getOlapReport());for(var i=0;i<report.PivotCalculations.length;i++)this._schemaData._createPivotButton({fieldName:report.PivotCalculations[i].FieldName,fieldCaption:report.PivotCalculations[i].FieldHeader},"value","","","")}this._schemaData._setPivotBtnWidth()},_calculatedFieldNodeRemove:function(i){for(var u=n.grep(JSON.parse(this.getOlapReport()).PivotCalculations,function(n){return n.CalculationType==8&&n.Formula.indexOf(i.id)>-1}),r=0;r<u.length;r++)this._schemaData._tableTreeObj.model.nodeUncheck=null,this._schemaData._tableTreeObj.uncheckNode(u[r].FieldName),this._schemaData._tableTreeObj.element.find("li[id='"+u[r].FieldName+"']").removeClass("filter").find(".treeDrop").remove(),this._schemaData._tableTreeObj.model.nodeUncheck=t.proxy(this._schemaData._checkedStateModified,this._schemaData)},createConditionalDialog:function(){this.openConditionalFormattingDialog()},openConditionalFormattingDialog:function(){var o,s,h,y,c,l,a,v,r,f;if(!this.model.enableConditionalFormatting)return!1;t.Pivot.openPreventPanel(this);this.element.find(".e-dialog").remove();o=t.buildTag("div#"+this._id+"_clientDlg.clientDialog",{opacity:"1"})[0].outerHTML;h=this._getLocalizedLabels("ConditionalFormatting");var p=t.buildTag("label#"+this._id+"_conLbl.conditionLbl",this._getLocalizedLabels("Condition"))[0].outerHTML,w=t.buildTag("input#"+this._id+"_conType.conditionType","",{},{type:"text",tabindex:0,accesskey:"f"})[0].outerHTML,b=t.buildTag("label#"+this._id+"_editcond.editcondition",this._getLocalizedLabels("Editcondtion"))[0].outerHTML,k=t.buildTag("label#"+this._id+"_value1.value1",this._getLocalizedLabels("Value1"))[0].outerHTML,d=t.buildTag("label#"+this._id+"_value2.value2",this._getLocalizedLabels("Value2"))[0].outerHTML,g=t.buildTag("label#"+this._id+"_backcolorLbl.backcolorLbl",this._getLocalizedLabels("Backcolor"))[0].outerHTML,nt=t.buildTag("label#"+this._id+"_bordercolorLbl.bordercolorLbl",this._getLocalizedLabels("Bordercolor"))[0].outerHTML,tt=t.buildTag("label#"+this._id+"_borderrangeLbl.borderrangeLbl",this._getLocalizedLabels("Borderrange"))[0].outerHTML,it=t.buildTag("label#"+this._id+"_borderstyleLbl.borderstyleLbl",this._getLocalizedLabels("Borderstyle"))[0].outerHTML,rt=t.buildTag("label#"+this._id+"_fStyleLbl.fStyleLbl",this._getLocalizedLabels("Fontstyle"))[0].outerHTML,ut=t.buildTag("label#"+this._id+"_fSizeLbl.fSizeLbl",this._getLocalizedLabels("Fontsize"))[0].outerHTML,ft=t.buildTag("label#"+this._id+"_fValueLbl.fValueLbl",this._getLocalizedLabels("Measures"))[0].outerHTML,et=t.buildTag("input#"+this._id+"_editCon.editconditionDropDown","",{},{type:"text",tabindex:1,accesskey:"e"})[0].outerHTML,y=t.buildTag("button#"+this._id+"_removeBtn.dialogremoveBtn e-icon","",{},{name:this._getLocalizedLabels("Remove")}).attr("role","button").attr("aria-label","remove")[0].outerHTML,ot=t.buildTag("input#"+this._id+"_conFrom.conditionFrom","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:2})[0].outerHTML,st=t.buildTag("input#"+this._id+"_conTo.conditionTo","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:3})[0].outerHTML,ht=t.buildTag("input#"+this._id+"_backcolor.backcolor","",{},{type:"text",tabindex:4,accesskey:"b"})[0].outerHTML,ct=t.buildTag("input#"+this._id+"_bordercolor.bordercolor","",{},{type:"text",tabindex:5,accesskey:"c"})[0].outerHTML,lt=t.buildTag("input#"+this._id+"_borderrange.borderrange","",{},{type:"text",tabindex:6,accesskey:"r"})[0].outerHTML,at=t.buildTag("input#"+this._id+"_borderstyle.borderstyle","",{},{type:"text",tabindex:7,accesskey:"s"})[0].outerHTML,vt=t.buildTag("input#"+this._id+"_fStyle.fStyle","",{},{type:"text",tabindex:8,accesskey:"o"})[0].outerHTML,yt=t.buildTag("input#"+this._id+"_fSize.fSize","",{},{type:"text",tabindex:9,accesskey:"l"})[0].outerHTML,pt=t.buildTag("input#"+this._id+"_fValue.fValue","",{},{type:"text",tabindex:10,accesskey:"v"})[0].outerHTML,wt=t.buildTag("div#"+this._id+"_conditionDlg.conditionDlg","<table class='conditionformatTbl'><tr><td>"+p+"<\/td><td>"+w+"<\/td><td>"+b+"<\/td><td>"+et+"<\/td><td>"+y+"<\/td><\/tr><tr><td>"+k+"<\/td><td>"+ot+"<\/td><td>"+d+"<\/td><td>"+st+"<\/td><\/tr><tr><td>"+g+"<\/td><td>"+ht+"<\/td><td>"+tt+"<\/td><td>"+lt+"<\/td><\/tr><tr><td>"+nt+"<\/td><td>"+ct+"<\/td><td>"+it+"<\/td><td>"+at+"<\/td><\/tr><tr><td>"+rt+"<\/td><td>"+vt+"<\/td><td>"+ut+"<\/td><td>"+yt+"<\/td><\/tr><tr><td>"+ft+"<\/td><td>"+pt+"<\/td><\/tr><\/table>")[0].outerHTML;s=wt;a=t.buildTag("button#"+this._id+"_OKBtn.dialogOKBtn","",{},{name:this._getLocalizedLabels("OK")})[0].outerHTML;v=t.buildTag("button#"+this._id+"_CancelBtn.dialogCancelBtn","",{},{name:this._getLocalizedLabels("Cancel")})[0].outerHTML;dialogFooter=t.buildTag("div",a+v,{float:this.model.enableRTL?"left":"right",margin:"20px 39px 6px"})[0].outerHTML;n("#"+this._id).after(o);n("#"+this._id+"_clientDlg").append(s+dialogFooter);n("#"+this._id+"_clientDlg").ejDialog({width:"auto",target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,this)});n(".e-titlebar").prepend(t.buildTag("div",h,{display:"inline"})[0].outerHTML)[0];n("#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,#"+this._id+"_removeBtn").ejButton({type:t.ButtonType.Button});n("#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn").css({margin:"0 0 0 10px",width:"67px"});n("#"+this._id+"_removeBtn").css({width:"29px",height:"29px"});n("#"+this._id+"_conFrom,#"+this._id+"_conTo").css({width:"200px",height:"26px"});n("#"+this._id+"_conditionDlg").css({margin:"13px 0 0 0"});n("#"+this._id+"_editcond,#"+this._id+"_value2,#"+this._id+"_borderrangeLbl,#"+this._id+"_borderstyleLbl,#"+this._id+"_fSizeLbl").css({margin:"0 0 0 15px"});n("#"+this._id+"_conTo").attr("disabled","disabled");this.removeBtn=n("#"+this._id+"_removeBtn").data("ejButton");c=n("#"+this._id+"_OKBtn").data("ejButton");l=n("#"+this._id+"_CancelBtn").data("ejButton");this.removeBtn.setModel({enabled:!1});c.setModel({text:this._getLocalizedLabels("OK")});l.setModel({text:this._getLocalizedLabels("Cancel")});n("#"+this._id+"_conType").ejDropDownList({change:"_activeConditionChange",dataSource:[{option:"Less Than",value:this._getLocalizedLabels("LessThan")},{option:"Less Than Or Equal To",value:this._getLocalizedLabels("LessThanOrEqualTo")},{option:"Greater Than",value:this._getLocalizedLabels("GreaterThan")},{option:"Greater Than Or Equal To",value:this._getLocalizedLabels("GreaterThanOrEqualTo")},{option:"Equals",value:this._getLocalizedLabels("Equals")},{option:"Not Equals",value:this._getLocalizedLabels("NotEquals")},{option:"Between",value:this._getLocalizedLabels("Between")},{option:"Not Between",value:this._getLocalizedLabels("NotBetween")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_editCon").ejDropDownList({change:"_editConditionChange",dataSource:this._list,selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_backcolor").ejDropDownList({dataSource:[{option:"AliceBlue",value:this._getLocalizedLabels("AliceBlue")},{option:"Black",value:this._getLocalizedLabels("Black")},{option:"Blue",value:this._getLocalizedLabels("Blue")},{option:"Brown",value:this._getLocalizedLabels("Brown")},{option:"Gold",value:this._getLocalizedLabels("Gold")},{option:"Green",value:this._getLocalizedLabels("Green")},{option:"Lime",value:this._getLocalizedLabels("Lime")},{option:"Maroon",value:this._getLocalizedLabels("Maroon")},{option:"Orange",value:this._getLocalizedLabels("Orange")},{option:"Pink",value:this._getLocalizedLabels("Pink")},{option:"Red",value:this._getLocalizedLabels("Red")},{option:"Violet",value:this._getLocalizedLabels("Violet")},{option:"White",value:this._getLocalizedLabels("White")},{option:"Yellow",value:this._getLocalizedLabels("Yellow")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_bordercolor").ejDropDownList({dataSource:[{option:"AliceBlue",value:this._getLocalizedLabels("AliceBlue")},{option:"Black",value:this._getLocalizedLabels("Black")},{option:"Blue",value:this._getLocalizedLabels("Blue")},{option:"Brown",value:this._getLocalizedLabels("Brown")},{option:"Gold",value:this._getLocalizedLabels("Gold")},{option:"Green",value:this._getLocalizedLabels("Green")},{option:"Lime",value:this._getLocalizedLabels("Lime")},{option:"Maroon",value:this._getLocalizedLabels("Maroon")},{option:"Orange",value:this._getLocalizedLabels("Orange")},{option:"Pink",value:this._getLocalizedLabels("Pink")},{option:"Red",value:this._getLocalizedLabels("Red")},{option:"Violet",value:this._getLocalizedLabels("Violet")},{option:"White",value:this._getLocalizedLabels("White")},{option:"Yellow",value:this._getLocalizedLabels("Yellow")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_borderrange").ejDropDownList({dataSource:["1","2","3","4","5","6","7","8","9"],selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_borderstyle").ejDropDownList({dataSource:[{option:"Solid",value:this._getLocalizedLabels("Solid")},{option:"Dashed",value:this._getLocalizedLabels("Dashed")},{option:"Dotted",value:this._getLocalizedLabels("Dotted")},{option:"Double",value:this._getLocalizedLabels("Double")},{option:"Groove",value:this._getLocalizedLabels("Groove")},{option:"Inset",value:this._getLocalizedLabels("Inset")},{option:"Outset",value:this._getLocalizedLabels("Outset")},{option:"Ridge",value:this._getLocalizedLabels("Ridge")},{option:"None",value:this._getLocalizedLabels("None")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_fStyle").ejDropDownList({dataSource:[{option:"Algerian",value:this._getLocalizedLabels("Algerian")},{option:"Arial",value:this._getLocalizedLabels("Arial")},{option:"Bodoni MT",value:this._getLocalizedLabels("BodoniMT")},{option:"Britannic Bold",value:this._getLocalizedLabels("BritannicBold")},{option:"Cambria",value:this._getLocalizedLabels("Cambria")},{option:"Calibri",value:this._getLocalizedLabels("Calibri")},{option:"Courier New",value:this._getLocalizedLabels("CourierNew")},{option:"DejaVu Sans",value:this._getLocalizedLabels("DejaVuSans")},{option:"Forte",value:this._getLocalizedLabels("Forte")},{option:"Gerogia",value:this._getLocalizedLabels("Gerogia")},{option:"Impact",value:this._getLocalizedLabels("Impact")},{option:"Segoe UI",value:this._getLocalizedLabels("SegoeUI")},{option:"Tahoma",value:this._getLocalizedLabels("Tahoma")},{option:"Times New Roman",value:this._getLocalizedLabels("TimesNewRoman")},{option:"Verdana",value:this._getLocalizedLabels("Verdana")},{option:"None",value:this._getLocalizedLabels("None")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_fSize").ejDropDownList({dataSource:["12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});var u=[],i=[],e;if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){if(n(this.element).parents(".e-pivotclient").length>0)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)for(r=0;r<this._JSONRecords.length;r++)this._JSONRecords[r].Info.indexOf("Measures")>-1&&i.push(this._JSONRecords[r].Value);else i=JSON.parse(this._pivotClientObj.getOlapReport()).PivotCalculations;else i=JSON.parse(this.getOlapReport()).PivotCalculations;e="FieldHeader"}else if(e="fieldCaption",this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)i=this.model.dataSource.values;else for(r=0;r<this.model.dataSource.values.length;r++)i=this.model.dataSource.values[r].measures;for(u=i.length>0?["All"]:u,f=0;f<i.length;f++)n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap?u.push(i[f]):u.push(i[f][e]);return u=u.length>0?u:["No Measure"],n("#"+this._id+"_fValue").ejDropDownList({dataSource:u,selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.element.find("#"+this._id+"_conType").ejDropDownList("option","change",t.proxy(this._activeConditionChange,this)),this.element.find("#"+this._id+"_editCon").ejDropDownList("option","change",t.proxy(this._editConditionChange,this)),this.isNewFormat=!0,this.ddlEditCondition=n("#"+this._id+"_editCon").data("ejDropDownList"),this.ddlConditionType=n("#"+this._id+"_conType").data("ejDropDownList"),this.ddlFont=n("#"+this._id+"_fStyle").data("ejDropDownList"),this.ddlFontSize=n("#"+this._id+"_fSize").data("ejDropDownList"),this.ddlBackColor=n("#"+this._id+"_backcolor").data("ejDropDownList"),this.ddlBorderColor=n("#"+this._id+"_bordercolor").data("ejDropDownList"),this.ddlBorderStyle=n("#"+this._id+"_borderstyle").data("ejDropDownList"),this.ddlBorderWidth=n("#"+this._id+"_borderrange").data("ejDropDownList"),this.ddlFieldValue=n("#"+this._id+"_fValue").data("ejDropDownList"),this.element.find("#"+this._id+"_conFrom,#"+this._id+"_conTo").keypress(function(t){return t.which==8||t.which==0?!0:t.which<45||t.which==45&&(t.target.value!=""||t.target.value.indexOf("-")>-1)||t.which>58?!1:t.which==46&&n(this).val().indexOf(".")!=-1||t.which==47?!1:void 0}),n("#"+this._id+"_OKBtn").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");this.ddlEditCondition=n("#"+i._id+"_editCon").data("ejDropDownList");n("#"+i._id+"_conFrom").val()==""?t.Pivot._createErrorDialog(i._getLocalizedLabels("EnterOperand1"),i._getLocalizedLabels("Warning"),i):n("#"+i._id+"_conTo").attr("disabled")||n("#"+i._id+"_conTo").val()!=""?n("#"+i._id+"_fValue").attr("disabled")&&n("#"+i._id+"_fValue").val()=="No Measure"?t.Pivot._createErrorDialog(i._getLocalizedLabels("NoMeasure"),i._getLocalizedLabels("Warning"),i):(i._applyFormatting(),t.Pivot.closePreventPanel(i)):t.Pivot._createErrorDialog(i._getLocalizedLabels("EnterOperand2"),i._getLocalizedLabels("Warning"),i)}),this.ddlEditCondition.getListData().length>1?n("#"+this._id+"_editCon").ejDropDownList("enable"):(n("#"+this._id+"_editCon").ejDropDownList("disable"),n("#"+this._id+"_editcond").css("color","#cbcbcb")),this.ddlFieldValue.getListData().length==1&&this.ddlFieldValue._selectedValue=="No Measure"?(n("#"+this._id+"_fValue").ejDropDownList("disable"),n("#"+this._id+"_fValueLbl").css("color","#cbcbcb")):n("#"+this._id+"_fValue").ejDropDownList("enable"),this._cFormat.length>0&&(this.ddlEditCondition.selectItemByValue(this._cFormat[this._cFormat.length-1].split(",")[0]),this._editConditionChange()),n("#"+this._id+"_removeBtn").click(function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i,r;t.removeBtn.option("enabled")&&(i=confirm(t._getLocalizedLabels("ConditionalFormattingConformMsg")),i==!0&&(r=t.ddlEditCondition._selectedIndices[0],t._removeCellFormatting(r,i)))}),n("#"+this._id+"_CancelBtn").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");i.element.find(".e-dialog, .clientDialog").remove();t.Pivot.closePreventPanel(i)}),!1},_activeConditionChange:function(t){t.selectedValue=="Between"||t.selectedValue=="Not Between"?n("#"+this._id+"_conTo").removeAttr("disabled"):(n("#"+this._id+"_conTo").attr("disabled","disabled"),n("#"+this._id+"_conTo").val(""))},_editConditionChange:function(){if(this.ddlEditCondition._selectedIndices[0]>0){var i=this.ddlEditCondition._selectedIndices[0]-1,t=this._cFormat[i].split(",");this.ddlConditionType.selectItemByValue(t[1]);n("#"+this._id+"_conFrom").val(t[8]);t[9]!="undefined"&&n("#"+this._id+"_conTo").val(t[9]);this.ddlBackColor.selectItemByValue(t[2]);this.ddlBorderColor.selectItemByValue(t[3]);this.ddlBorderStyle.selectItemByValue(t[7]);this.ddlBorderWidth.selectItemByValue(t[4]);this.ddlFont.selectItemByValue(t[5]);this.ddlFontSize.selectItemByValue(t[6]);this.ddlFieldValue.selectItemByValue(t[10]);this.removeBtn.option("enabled",!0);this._conditionTypeChange()}else this.removeBtn.option("enabled",!1),this._clearWindow()},_clearWindow:function(){n("#"+this._id+"_clientDlg").find("#"+this._id+"_conFrom,#"+this._id+"_conTo").val("");n("#"+this._id+"_conTo").disabled=!0},_conditionTypeChange:function(){n("#"+this._id+"_conTo").disabled=!(this.ddlConditionType._selectedIndices[0]==4||this.ddlConditionType._selectedIndices[0]==5)},_removeCellFormatting:function(n,t){for(var i,u=n,r=0;r<this._cFormat.length&&n;r++)for(t&&(r=n-1,n=0),i=0;i<this._JSONRecords.length;i++)this._JSONRecords[i].CSS=this._JSONRecords[i].CSS.replace(" "+this._cFormat[r].split(",")[0],"");t?(this._cFormat.splice(u-1,1),this._list.splice(u,1)):(this._cFormat=[],this._list=[]);this.renderControlFromJSON()},_applyStyle:function(t,i,r,u,f,e,o,s,h){var v=i.CSS,a=!1,l=t=="rows"?i.Index.split(",")[1]:t=="columns"?i.Index.split(",")[0]:null,c;(i.Value==r||r=="All")&&(n.inArray(Number(l),u)==-1?u.push(Number(l)):u);c=n.isNumeric(i.Value)==!0?i.Value:i.Value.replace(/[^\d.]/g,"");a=n.inArray(Number(l),u)!=-1?!0:!1;this._getResult(Number(f),Number(e),c,o)&&c!=""&&n.isNumeric(c)&&a&&i.CSS.indexOf("value")!=-1&&(i.CSS=v+" "+h)},_refreshCellFormatting:function(n){for(var u,t,i,f=this._getAxis(),r=0;r<this._cFormat.length;r++)for(u=[],t=this._cFormat[r].split(","),i=0;i<n.length;i++)n[i].CSS.indexOf(t[0])===-1&&this._applyStyle(f,n[i],t[10],u,t[8],t[9],t[1],i,this._cFormat[r].split(",")[0]);return n},_createDynamicRule:function(n,t,i,r,u,f,e){var o=function(){var n=document.createElement("style");return n.appendChild(document.createTextNode("")),document.head.appendChild(n),n.sheet}(),s="background-color: "+n+" !important;border:"+t+" "+i+"px "+r+" !important;font:"+u+"px "+f+" !important;";o.insertRule("."+e+"{"+s+"}",0)},_getAxis:function(){var f,u,i;if(this.getOlapReport())if(f=null,u="",this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){for(f=this.getOlapReport()!=r&&this.getOlapReport()!=""&&JSON.parse(this.getOlapReport()).PivotCalculations.length>0&&!n(this.element).parents(".e-pivotclient").length>0?JSON.parse(this.getOlapReport()).PivotCalculations[0].FieldHeader:JSON.parse(this._pivotClientObj.getOlapReport()).PivotCalculations[0].FieldHeader,i=0;i<this._JSONRecords.length;i++)if(this._JSONRecords[i].Value==f){u=this._JSONRecords[i].CSS=="colheader"?"columns":this._JSONRecords[i].CSS=="rowheader"?"rows":"";break}}else if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)u="columns";else for(i=0;i<this.getOlapReport().values.length;i++)u=this.getOlapReport().values[i].axis;return u},_applyCodeBehindFormatting:function(i){var o,s,r,f,e,h,u,c;if(this._isFormatApply=!0,s=this._getAxis(),!t.isNullOrUndefined(this.model.conditionalFormatSettings))for(r=0;r<this.model.conditionalFormatSettings.length;r++)if(f=[],f=this.model.conditionalFormatSettings[r].measures.split(","),n.inArray(this.model.conditionalFormatSettings[r].name,this._list)==-1){for(e=0;e<f.length;e++)for(h=[],o=f[e],u=0;u<i.length;u++)this._applyStyle(s,i[u],o,h,this.model.conditionalFormatSettings[r].value.split(",")[0],this.model.conditionalFormatSettings[r].value.split(",")[1],this.model.conditionalFormatSettings[r].condition,u,this.model.conditionalFormatSettings[r].name);c=this.model.conditionalFormatSettings[r].name+","+this.model.conditionalFormatSettings[r].condition+","+this.model.conditionalFormatSettings[r].style.backgroundcolor+","+this.model.conditionalFormatSettings[r].style.bordercolor+","+this.model.conditionalFormatSettings[r].style.borderwidth+","+this.model.conditionalFormatSettings[r].style.fontstyle+","+this.model.conditionalFormatSettings[r].style.fontsize+","+this.model.conditionalFormatSettings[r].style.borderstyle+","+this.model.conditionalFormatSettings[r].value.split(",")[0]+","+this.model.conditionalFormatSettings[r].value.split(",")[1]+","+o;this._cFormat.push(c);this._list.push(this.model.conditionalFormatSettings[r].name);this._createDynamicRule(this.model.conditionalFormatSettings[r].style.backgroundcolor,this.model.conditionalFormatSettings[r].style.borderstyle,this.model.conditionalFormatSettings[r].style.borderwidth,this.model.conditionalFormatSettings[r].style.bordercolor,this.model.conditionalFormatSettings[r].style.fontsize,this.model.conditionalFormatSettings[r].style.fontstyle,this.model.conditionalFormatSettings[r].name)}return this._JSONRecords=i,i},_applyFormatting:function(){var s,u,h,e,c,f,l,o,i;if(this._isFormatApply=!0,c=[],l=!1,t.isNullOrUndefined(n("#"+this._id+"_conFrom").val())||(this._formatValue1=n("#"+this._id+"_conFrom").val(),this._formatValue2=n("#"+this._id+"_conTo").val(),cdnTxt=this.ddlConditionType._selectedValue,color=this.ddlBackColor._selectedValue,bordercolor=this.ddlBorderColor._selectedValue,borderrange=this.ddlBorderWidth._selectedValue,fStyle=this.ddlFont._selectedValue,fSize=this.ddlFontSize._selectedValue,borderstyle=this.ddlBorderStyle._selectedValue,editCdn=this.ddlEditCondition._selectedValue),e=this.ddlFieldValue._selectedValue!=r?this.ddlFieldValue._selectedValue:"",n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap){for(i=0;i<this._JSONRecords.length;i++)if(this._JSONRecords[i].Info.indexOf("Measures")>-1&&(f=this._JSONRecords[i].CSS=="colheader"?"columns":this._JSONRecords[i].CSS=="rowheader"?"rows":""),f!="")break}else for(field=JSON.parse(this.getOlapReport()).PivotCalculations[0].FieldHeader,i=0;i<this._JSONRecords.length;i++)if(this._JSONRecords[i].Value==field){f=this._JSONRecords[i].CSS=="colheader calc"?"columns":this._JSONRecords[i].CSS=="rowheader"?"rows":"";break}}else f=this._getAxis();if(n("#"+this._id+"_editCon").val()==this._getLocalizedLabels("AddNew")){for(i=this._cFormat.length;i<this._cFormat.length+1;i++)for(u="Format"+i,o=i;n.inArray(u,this._list)!=-1;o++)u="Format"+o;s=u+","+this.ddlConditionType._selectedValue+","+color+","+bordercolor+","+borderrange+","+fStyle+","+fSize+","+borderstyle+","+this._formatValue1+","+this._formatValue2+","+e;this._cFormat.push(s);this._list.push(u)}else for(u=this.ddlEditCondition._selectedValue,h=this.ddlEditCondition._selectedIndices[0]-1,this._cFormat[h]=u+","+this.ddlConditionType._selectedValue+","+color+","+bordercolor+","+borderrange+","+fStyle+","+fSize+","+borderstyle+","+this._formatValue1+","+this._formatValue2+","+e,i=0;i<this._JSONRecords.length;i++)this._JSONRecords[i].CSS=this._JSONRecords[i].CSS.replace(" "+u,"");for(i=0;i<this._JSONRecords.length;i++)this._applyStyle(f,this._JSONRecords[i],e,c,this._formatValue1,this._formatValue2,this.ddlConditionType._selectedValue,i,u);this._createDynamicRule(color,borderstyle,borderrange,bordercolor,fSize,fStyle,u);this.renderControlFromJSON();this.element.find(".e-dialog, .clientDialog").remove()},_getResult:function(n,t,i,r){switch(r){case"Less Than":return i<n;case"Less Than Or Equal To":if(i<=n)return i;break;case"Greater Than":return i>n;case"Greater Than Or Equal To":if(i>=n)return i;break;case"Equals":if(i==n)return i;break;case"Not Equals":return i!=n;case"Between":return n<t&&i>n&&i<t||n>t&&i<n&&i>t||i==n&&i==t;case"Not Between":return!(n<t&&i>n&&i<t||n>t&&i<n&&i>t||i==n&&i==t)}},_updateReportSettings:function(i){var u=n.map(i,function(n){if(n.Key=="JsonRecords"||n.Key=="PivotRecords")return n}),f=n.map(i,function(n){if(n.Key=="PivotReport"||n.Key=="OlapReport")return n}),r=n.map(i,function(n){if(n.Key=="SortColIndex")return n});this.setJSONRecords(u[0].Value);this.setOlapReport(f[0].Value);r.length>0?(t.PivotAnalysis._valueSorting=JSON.parse(r[0].Value),t.PivotAnalysis._sort=this.model.valueSortSettings.sortOrder):t.PivotAnalysis._valueSorting=null},_updatePageSettings:function(t,i){var r=n.map(t,function(n){if(n.Key=="PageSettings")return n}),u=n.map(t,function(n){if(n.Key=="HeaderCounts")return n});r.length>0&&i._pagerObj!=null&&(i._pagerObj.element.css("opacity","1"),i._pagerObj.element.find(".pagerTextBox").removeAttr("disabled"),i._pagerObj._unwireEvents(),i._pagerObj._wireEvents(),i._pagerObj.initPagerProperties(JSON.parse(u[0].Value),JSON.parse(r[0].Value)))},_removeCells:function(i){var p=[],w=[],a,c,b,o,f,v,st,d,u,g,nt,h,ht,e,l,ut,ct,tt,it,y,s;if(i[0]!=r&&i.length>0?(a=n.map(i,function(n){if(n.Key=="FilteredColumnHeaders")return n}),c=n.map(i,function(n){if(n.Key=="FilteredRowHeaders")return n}),a.length>0&&(p=JSON.parse(a[0].Value)),c.length>0&&(w=JSON.parse(c[0].Value))):i.d!=r?(a=n.map(i.d,function(n){if(n.Key=="FilteredColumnHeaders")return n}),c=n.map(i.d,function(n){if(n.Key=="FilteredRowHeaders")return n}),a.length>0&&(p=JSON.parse(a[0].Value)),c.length>0&&(w=JSON.parse(c[0].Value))):(i.FilteredColumnHeaders&&(p=JSON.parse(i.FilteredColumnHeaders)),i.FilteredRowHeaders&&(w=JSON.parse(i.FilteredRowHeaders))),p.length>0){for(h=p,e=0;e<h.length;e++)for(l=h[e].From;l<=h[e].To;l++)for(u=h[e].Level;u<this._rowCount;u++)this.element.find(".pivotGridTable [p='"+l+","+u+"']").remove();for(c=this.element.find(".pivotGridTable thead").children(),b=c.length-2;b>=0;b--)for(o=n(c[b]).find("th.colheader:visible"),f=0;f<=o.length-1;f++){for(v=n(o[f]).attr("colSpan"),u=0;u<=parseInt(n(o[f]).attr("colSpan"))-1;u++)st=parseInt(n(o[f]).attr("p").split(",")[0])+u,d=this.element.find(".pivotGridTable [p='"+st+","+(b+1)+"']:visible"),n(d).length>0?v=parseInt(v)+(n(d).attr("colspan")?parseInt(n(d).attr("colspan"))-1:0):v--;if(v==0&&n(o[f]).nextAll(".summary.stot:eq(0)").length>0){var k=n(o[f]).nextAll(".summary.stot:eq(0)").attr("p").split(",")[0],rt=[],h=[];for(u=0;u<this._rowCount;u++){if(g="[p='"+parseInt(k)+","+u+"'] ",h.push(g),this._JSONRecords[parseInt(k)*this._rowCount+u].ColSpan>1&&this.element.find(".pivotGridTable [p='"+parseInt(k)+","+u+"']:visible").length>0)for(nt=1;nt<=this._JSONRecords[parseInt(k)*this._rowCount+u].ColSpan-1;nt++)rt.push(parseInt(k)+nt);for(hc=0;hc<rt.length;hc++)g+=", [p='"+rt[hc]+","+u+"'] ";this.element.find(".pivotGridTable "+g).remove()}}t.isNullOrUndefined(n(o[f]).attr("vfColSpan"))&&n(o[f]).attr("vfColSpan",n(o[f]).attr("colSpan"));n(o[f]).attr("colSpan",v)}this.element.find(".colheader[colspan='0']:not(.gtot,.calc)").remove()}if(w.length>0){for(h=w,ht=parseInt(this.element.find(".pivotGridTable td:eq(0)").attr("p").split(",")[0])-2,e=0;e<h.length;e++)for(l=h[e].From;l<=h[e].To;l++)this.element.find(".pivotGridTable tr:eq("+l+") th:last").css("display","none"),this.element.find(".pivotGridTable tr:eq("+l+") td").css("display","none");for(s=ht;s>=0;s--)for(ut=this.element.find(".pivotGridTable tbody").find(" .rowheader[p^='"+s+",'] :visible"),ct=this.element.find(".pivotGridTable th.rowheader").parent(),tt=0;tt<=ut.length;tt++){var ft=n(ut[tt]).parent(),lt=parseInt(ft.attr("rowSpan")),et=ft.attr("p");if(et){var at=parseInt(et.split(",")[1]),vt=parseInt(et.split(",")[0]),ot=0;for(it=at;it<=at+lt;it++)y=ct.children(" [p='"+(s+1)+","+it+"']"),y.length>0&&!y.is(":visible")&&(ot=ot+parseInt(y.attr("rowSpan"))+(y.next("th.rowheader").length>0||parseInt(y.attr("rowSpan"))>1?1:0));ot==lt&&ft.css("display","none")}}for(s=0;s<n(this.element.find(".summary.stot")).length;s++)n(this.element.find(".summary.stot")[s]).nextAll().text()==""&&(n(this.element.find(".summary.stot")[s]).css("display","none"),n(this.element.find(".summary.stot")[s]).nextAll().css("display","none"))}this.model.enableGroupingBar&&this._createFields(null,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth())},_renderControlSuccess:function(i){var o,s,f,h,c,u,e,l;try{if(i[0]!=r&&i.length>0?(this._updateReportSettings(i),i[2]!=null&&i[2]!=r&&i[2].Key=="PageSettings"&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i[3].Value).Column/JSON.parse(i[2].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i[3].Value).Row/JSON.parse(i[2].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i[2].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i[2].Value).SeriesPageSize):n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this._pagerObj!=null&&this._pagerObj.initPagerProperties(JSON.parse(i[3].Value),JSON.parse(i[2].Value)),t.isNullOrUndefined(i[4])||(i[4].Key=="DataSet"?(this._dataSet=i[4].Value,t.isNullOrUndefined(i[5])||(this.model.customObject=i[5].Value)):this.model.customObject=i[4].Value)),t.isNullOrUndefined(i[2])||i[2].Key=="PageSettings"||(i[2].Key=="DataSet"?(this._dataSet=i[2].Value,t.isNullOrUndefined([3])||(this.model.customObject=i[3].Value)):this.model.customObject=i[2].Value),t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._updatePageSettings(i,this._pivotClientObj)):i.d!=r&&i.d.length>0?(this._updateReportSettings(i.d),i.d[2]!=null&&i.d[2]!=r&&i.d[2].Key=="PageSettings"?(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i.d[3].Value).Column/JSON.parse(i.d[2].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.d[3].Value).Row/JSON.parse(i.d[2].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i.d[2].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.d[2].Value).SeriesCurrentPage):this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this._pagerObj.initPagerProperties(JSON.parse(i.d[3].Value),JSON.parse(i.d[2].Value)),t.isNullOrUndefined(i.d[4])||(i.d[4].Key=="DataSet"?(this._dataSet=i.d[4].Value,t.isNullOrUndefined(i.d[5])||(this.model.customObject=i.d[5].Value)):this.model.customObject=i.d[4].Value),t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._updatePageSettings(i.d,this._pivotClientObj)):t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||i.d.length!=2||(this._pivotClientObj._pagerObj.element.css("opacity","0.5"),this._pivotClientObj._pagerObj.element.find(".pagerTextBox").attr("disabled","disabled"),this._pivotClientObj._pagerObj._unwireEvents()),t.isNullOrUndefined(i[2])||i.d[2].Key=="PageSettings"||(i.d[2].Key=="DataSet"?(this._dataSet=i.d[2].Value,t.isNullOrUndefined([3])||(this.model.customObject=i.d[3].Value)):this.model.customObject=i.d[2].Value)):!t.isNullOrUndefined(i)&&t.isNullOrUndefined(i.d)&&(i.SortColIndex!=r?(t.PivotAnalysis._valueSorting=JSON.parse(i.SortColIndex)[0],t.PivotAnalysis._sort=this.model.valueSortSettings.sortOrder):t.PivotAnalysis._valueSorting=null,i.PivotRecords!=r?(this.setJSONRecords(i.PivotRecords),this.setOlapReport(i.OlapReport),i.HeaderCounts!=r&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling)?(this._categPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Column/JSON.parse(i.PageSettings).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Row/JSON.parse(i.PageSettings).SeriesPageSize),this._categCurrentPage=JSON.parse(i.PageSettings).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.PageSettings).SeriesCurrentPage):i.HeaderCounts!=r&&this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r?this._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)):i.HeaderCounts==r||t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings))):i.JsonRecords!=r&&this.model.enableJSONRendering==!0?(this.setJSONRecords(JSON.stringify(i.JsonRecords)),this.setOlapReport(JSON.stringify(i.PivotReport)),i.DataSet!=null&&(this._dataSet=i.DataSet)):i.JsonRecords!=r?(this.setJSONRecords(i.JsonRecords),this.setOlapReport(i.PivotReport),i.DataSet!=null&&(this._dataSet=i.DataSet)):i.JsonRecords==r&&(this.setJSONRecords(null),i.PivotReport&&this.setOlapReport(i.PivotReport),i.OlapReport&&this.setOlapReport(i.OlapReport)),i.customObject!=null&&i.customObject!=r&&(this.model.customObject=i.customObject)),t.isNullOrUndefined(this.getJSONRecords())&&!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enablePaging&&(o={CategorialCurrentPage:1,CategorialPageSize:1,SeriesCurrentPage:1,SeriesPageSize:1},s={Column:1,Row:1},this._pivotClientObj._pagerObj.initPagerProperties(s,o)),(this.model.enableVirtualScrolling||n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r)&&this.layout("nosummaries"),this.getOlapReport()!=r&&this.getOlapReport()!=""&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)try{t.isNullOrUndefined(JSON.parse(this.getOlapReport()).DataModel)||(this.model.analysisMode=JSON.parse(this.getOlapReport()).DataModel=="Olap"?t.Pivot.AnalysisMode.Olap:t.Pivot.AnalysisMode.Pivot)}catch(a){}if(this.model.enableGroupingBar==!0&&(report=JSON.parse(this.getOlapReport()),f=t.isNullOrUndefined(report.ItemsProperties)?[]:JSON.parse(report.ItemsProperties),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(h=report.PivotRows.concat(report.PivotColumns,report.PivotCalculations,report.Filters),c=n.grep(f,function(t){return n.grep(h,function(n){t.id==(n.FieldHeader||n.DimensionHeader)&&(t.id=n.FieldName||n.DimensionName)}),t}),this._pivotTableFields=c):this._pivotTableFields=f,this._createGroupingBar(report)),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(report=JSON.parse(this.getOlapReport()),u=0;u<report.PivotCalculations.length;u++)(report.PivotCalculations[u].CalculationType==8||report.PivotCalculations[u].CalculationType=="Formula")&&n.grep(this._calculatedField,function(n){return n.name==report.PivotCalculations[u].FieldName}).length==0&&this._calculatedField.push({name:report.PivotCalculations[u].FieldName,formula:report.PivotCalculations[u].Formula});this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"initialize",element:this.element,customObject:this.model.customObject});this.getJSONRecords()!=null&&this.getJSONRecords().length>0?this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&this.model.enableVirtualScrolling==!1&&n(".e-pivotpager")[0]==null?this.excelLikeLayout(this.getJSONRecords()):this.renderControlFromJSON(this.getJSONRecords()):this.renderControlFromJSON("");e=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(e)||(e._isTimeOut=!1);t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null?this._waitingPopup.hide():n("#"+this._pivotClientObj._id+"_maxView")[0]&&this._maxViewLoading?this._maxViewLoading.hide():this._pivotClientObj._waitingPopup.hide();t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")}catch(a){}this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._schemaData!=null&&this._schemaButtonCreate();l={action:"initialize",customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",l);t.isNullOrUndefined(i.Exception)||t.Pivot._createErrorDialog(i,"Exception",this);this.model.enableAdvancedFilter&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._removeCells(i)},_hideGrandTotal:function(u){var v=u.find(".pivotGridFrozenTable"),y,l,e,o,w,rt,d,s,g,nt,h,p,c,it,b,tt,a,f;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(this.model.enableRowGrandTotal&&this.model.enableGrandTotal||((this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&u.find(".rowhead tr:last").hide(),u.find("tbody").children().length>0&&u.find("tr:last").hide()),(u.find("tr:first th.summary").attr("p")!=r||u.find(".pivotGridFrozenTable tr:first td.summary").attr("p")!=r)&&(!this.model.enableColumnGrandTotal||!this.model.enableGrandTotal)&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(y=[],y=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders?this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?v.find(".gtot[role^='columnheader']"):v.find(".cgtot[role^='columnheader']"):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?u.find("th.gtot[role^='columnheader']"):u.find("th.cgtot[role^='columnheader']"),cLen=0;cLen<y.length;cLen++)u.find('[p^="'+parseInt(n(y[cLen]).attr("p").split(",")[0])+',"]').hide(),u.find('[p^="'+parseInt(n(y[cLen]).attr("p").split(",")[0])+',"]').hide()}else if(this.model.layout=="normal"&&(l=!0,e=0,this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||this.model.analysisMode==t.Pivot.AnalysisMode.Olap)){if((!this.model.enableColumnGrandTotal||!this.model.enableGrandTotal)&&(rwLen=n(u).find("thead tr").length||n(u).find(".pivotGridFrozenTable tr").length,rwLen>1||rwLen==1&&n(u).find("th.summary[p$=',"+e+"']").length>0)){while(l)o=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(u).find("td.summary[p$=',"+e+"']"):n(u).find("th.summary[p$=',"+e+"']"),o.length&&(l=!1),e++;for(h=0;h<o.length;h++){var p=e,c=o[h];for(selectedCellPos=n(c).attr("p"),i=parseInt(selectedCellPos.split(",")[1])-1,w=n(c).attr("colspan"),rt=n(u).find("thead tr").length+n(u).find("tbody tr").length,d=0;d<parseInt(w);d++)n(u).find(" [p^='"+(parseInt(selectedCellPos.split(",")[0])+d)+",']").css("display","none");for(s=0;s<rwLen;s++)this.model.frozenHeaderSettings.enableFrozenHeaders?n(v).find("tr:eq("+s+") td").length==1&&(g=n(v).find(" tr:eq("+s+") td").attr("colspan"),n(v).find(" tr:eq("+s+") td").attr("colspan",parseInt(g)-parseInt(w))):n(u).find("thead tr:eq("+s+") th").length==1&&(g=n(u).find("thead tr:eq("+s+") th").attr("colspan"),n(u).find("thead tr:eq("+s+") th").attr("colspan",parseInt(g)-parseInt(w)));if(i>=0)for(a=n(u).find(" [p^='"+selectedCellPos.split(",")[0]+","+i+"']")[0];p>1;){if(t.isNullOrUndefined(a))for(i=parseInt(selectedCellPos.split(",")[1])-1;i>=0;i--){if(f=n(u).find("[p='"+selectedCellPos.split(",")[0]+","+i+"']")[0],t.isNullOrUndefined(f))for(k=parseInt(selectedCellPos.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(f)&&(f=n(u).find("[p='"+k+","+i+"']")[0]);!t.isNullOrUndefined(f)&&n(f).css("display")!="none"&&n(n(f).parents("tr")[0]).css("display")!="none"&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader"||n(f).hasClass("colheader")||n(f).attr("role")=="columnheader"||n(f).hasClass("value")||n(f).attr("role")=="gridcell")&&(a=f);set_spn=parseInt(n(f).attr("colspan"))-parseInt(w);n(f).attr("colspan",set_spn)}t.isNullOrUndefined(f)||p--}}}if(l=!0,e=0,o="",!this.model.enableRowGrandTotal||!this.model.enableGrandTotal){if(nt=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,rwLen=n(u).find("tbody tr").length,rwLen>1||rwLen==1&&n(u).find(nt?"":"th[p^='"+e+",']")=="summary")for(rwLen=n(u).find("tbody tr").length;l;)o=nt?n(u).find("td.summary[p^='"+e+",']"):n(u).find("th.summary[p^='"+e+",']"),o.length&&(l=!1),e++;if(rwLen>0)for(h=0;h<o.length;h++){for(p=e,c=o[h],selectedCellPos=n(c).attr("p"),i=parseInt(selectedCellPos.split(",")[0])-1,it=n(c).attr("rowspan"),b=n(c).parent(),tt=0;tt<c.rowSpan;tt++)n(b).css("display","none"),nt&&n(u).find(".pivotGridValueTable tr:eq("+n(b).index()+")").css("display","none"),b=n(b).next();if(i>=0)for(a=n(u).find(" [p^='"+i+","+selectedCellPos.split(",")[1]+"']")[0];p>1;){if(t.isNullOrUndefined(a))for(i=parseInt(selectedCellPos.split(",")[0])-1;i>=0;i--){if(f=n(u).find("[p='"+i+","+selectedCellPos.split(",")[1]+"']")[0],t.isNullOrUndefined(f))for(k=parseInt(selectedCellPos.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(f)&&(f=n(u).find("[p='"+i+","+k+"']")[0]);!t.isNullOrUndefined(f)&&n(f).css("display")!="none"&&n(n(f).parents("tr")[0]).css("display")!="none"&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader"||n(f).hasClass("colheader")||n(f).attr("role")=="columnheader"||n(f).hasClass("value")||n(f).attr("role")=="gridcell")&&(a=f);set_spn=parseInt(n(f).attr("rowspan"))-parseInt(it);n(f).attr("rowspan",set_spn)}t.isNullOrUndefined(f)||p--}}}}},_hideSubTotal:function(i,u){var k,h,d,nt,g,l,e,p,a,s,v,b,y,c,f;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(k=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource.rows:this.element.parents(".e-pivotclient").length>0?JSON.parse(this._pivotClientObj.getOlapReport()).PivotRows:JSON.parse(this.getOlapReport()).PivotRows,d=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource.columns:this.element.parents(".e-pivotclient").length>0?JSON.parse(this._pivotClientObj.getOlapReport()).PivotColumns:JSON.parse(this.getOlapReport()).PivotColumns,!t.isNullOrUndefined(k))for(e=0;e<k.length;e++)if(k[e].showSubTotal==!1)if(nt=e.toString(),n(i).attr("role")=="row"&&n(i).parent().is("tbody")){if(n(i).find(".stot,.rstot").length==0||this._isSubTotalhidden&&n(i).find(".stot,.rstot").find(".expand").length>=1||n(i).find(".stot,.rstot").attr("p").split(",")[0]==nt&&u==1&&n(i).find(".stot,.rstot").find(".expand").length>=1)break;else if(n(i).find(".stot,.rstot").attr("p").split(",")[0]==nt){this._isSubTotalhidden=this._isSubTotalHide=!0;break}}else if(n(i).find("tbody").length>0&&(h=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?i.find('.summary.rstot[p^="'+e+',"]'):i.find('.summary.stot[p^="'+e+',"]'),h.length>0))for(g=0;g<h.length;g++){var tt=n(h[g]).closest("tr"),o=n(tt).find(".stot,.rstot").attr("p"),c=parseInt(o.split(",")[0])-1,ut=parseInt(n(tt).find(".stot,.rstot").attr("rowspan"));for(n(tt).css("display","none"),n(i).find(".valueCell td[p$=',"+o.split(",")[1]+"']").css("display","none"),l=parseInt(o.split(",")[1]);c>=0;){for(f=null;t.isNullOrUndefined(f)&&l>=0;){if(f=n(i).find("[p='"+c+","+l+"']")[0],!t.isNullOrUndefined(f)&&n(n(f).closest("tr")[0]).css("display")!="none"&&n(f).hasClass("rowheader")&&n(f).attr("role")=="rowheader"&&parseInt(n(f).attr("p").split(",")[0])<parseInt(o.split(",")[0])&&parseInt(n(f).attr("p").split(",")[1])+f.rowSpan+(n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag")):0)>=parseInt(o.split(",")[1])+ut){f.rowSpan-=1;n(f).find("span").attr("tag",n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag"))+1:1);break}l--}c--}}if(!t.isNullOrUndefined(d))for(e=0;e<d.length;e++)if(d[e].showSubTotal==!1)if(p=e.toString(),(n(i).hasClass("stot")||n(i).hasClass("cstot"))&&n(i).attr("role")=="columnheader"){if(this._isSubTotalhidden&&n(i).find(".stot,.cstot").find(".expand").length>=1||n(i).attr("p").split(",")[1]==p&&u==1&&n(i).find(".expand").length>=1)break;else if(n(i).attr("p").split(",")[1]==p){this._isSubTotalhidden=this._isSubTotalHide=!0;break}}else if(n(i).attr("role")=="row"&&n(i).parent().is("thead")){if(n(i).find(".stot,.cstot").length==0||this._isSubTotalhidden&&n(i).find(".stot,.cstot").find(".expand").length>=1||n(i).find(".stot,.cstot").attr("p").split(",")[1]==p&&u==1&&n(i).find(".stot,.cstot").find(".expand").length>=1)break;else if(n(i).find(".stot,.cstot").attr("p").split(",")[1]==p){this._isSubTotalhidden=this._isSubTotalHide=!0;break}}else if((n(i).find("thead").length>0||n(i).find(".colhead").length>0)&&(h=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?i.find('th.summary.cstot[p$=",'+e+'"]'):i.find('th.summary.stot[p$=",'+e+'"]'),h.length>0))for(a=h,s=0;s<a.length;s++){var ft=n(a[s]),rt=n(i),o=n(a[s]).attr("p"),et=n(a[s]).closest("tr")[0],it=parseInt(o.split(",")[0]),ut=parseInt(n(a[s]).attr("rowspan")),w=parseInt(n(a[s]).attr("colspan")),l=parseInt(o.split(",")[1])-1;for(v=0;v<w;v++){for(b=n(et).nextAll().find("[p^='"+(v+it)+",']"),y=0;y<n(b).length;y++)n(b[y]).css("display","none");(n(b[y]).attr("hc")==r||parseInt(n(b[y]).attr("hc"))<1)&&(n(rt).find("[p^='"+(v+it)+",']").css("display","none"),n(rt).find("[p^='0,']:not(.summary)").parent().find("td[p^='"+(v+it)+",']").attr("ch",1))}for(n(ft).css("display","none"),c=parseInt(o.split(",")[0]);l>=0;){for(f=null;t.isNullOrUndefined(f)&&c>=0;){if(f=n(i).find("[p='"+c+","+l+"']")[0],!t.isNullOrUndefined(f)&&n(n(f).closest("tr")[0]).css("display")!="none"&&n(f).hasClass("colheader")&&n(f).attr("role")=="columnheader"&&parseInt(n(f).attr("p").split(",")[1])<parseInt(o.split(",")[1])&&parseInt(n(f).attr("p").split(",")[0])<=parseInt(o.split(",")[0])&&parseInt(n(f).attr("p").split(",")[0])+f.colSpan+(n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag")):0)>=parseInt(o.split(",")[0])+w){f.colSpan-=w;n(f).find("span").attr("tag",n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag"))+w:w);break}c--}l--}}}},_filterReport:function(n){for(var r,i=0;i<n.Filters.length;i++)if(n.PivotColumns.length>=1)for(r=0;r<n.PivotColumns.length;r++)n.Filters.length==0||t.isNullOrUndefined(n.Filters[i])||n.Filters[i].Tag!=n.PivotColumns[r].FieldName||(n.Filters.splice(i,1),i=-1);for(i=0;i<n.Filters.length;i++)if(n.PivotRows.length>=1)for(r=0;r<n.PivotRows.length;r++)n.Filters.length==0||t.isNullOrUndefined(n.Filters[i])||n.Filters[i].Tag!=n.PivotRows[r].FieldName||(n.Filters.splice(i,1),i=-1);for(i=0;i<n.Filters.length;i++)if(n.PivotCalculations.length>=1)for(r=0;r<n.PivotCalculations.length;r++)n.Filters.length==0||t.isNullOrUndefined(n.Filters[i])||n.Filters[i].Tag!=n.PivotCalculations[r].FieldName||(n.Filters.splice(i,1),i=-1);return n},_createGroupingBar:function(n){this._pivotFilter=this._getLocalizedLabels("DragFieldHere");this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(n=this._filterReport(n),filterTag=this._createPivotButtons(this._pivotFilter!=null&&n.Filters.length>1&&n.Filters[0].Tag==n.Filters[1].Tag?n.Filters.slice(1):n.Filters,"filter")):filterTag=this._createPivotButtons(this._pivotFilter!=null&&n.filters.length>0?n.filters:"","filter");this._pivotFilter=filterTag;this._pivotRow=this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotRows:n.rows,"row");this._pivotColumn=this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotColumns:n.columns,"column");this._pivotCalculation=this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotCalculations:n.values,"values");this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&n.values.length>0&&n.values[0].measures&&(n.values[0].axis=="columns"&&n.values[0].measures.length>0?this._pivotColumn=this._pivotColumn+this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotColumns:[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}],"column"):n.values[0].axis=="rows"&&n.values[0].measures.length>0&&(this._pivotRow=this._pivotRow+this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotColumns:[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}],"row")))},_contextOpen:function(n){t.Pivot._contextMenuOpen(n,this)},_pivotContextClick:function(i){var e,o;if(i.text!=this._getLocalizedLabels("CalculatedField"))if(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){var r=i.text==this._getLocalizedLabels("AddToColumn")?"column":i.text==this._getLocalizedLabels("AddToRow")?"row":i.text==this._getLocalizedLabels("AddToValues")?"value":i.text==this._getLocalizedLabels("AddToFilter")?"filter":"",u=n(this._selectedMember).attr("fieldName"),s=n(this._selectedMember).text(),f={droppedFieldName:u,droppedFieldCaption:s,droppedClass:r,droppedPosition:"",isMeasuresDropped:u.toLocaleLowerCase().indexOf("measures")==0};this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&r!="values"&&(this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(f.droppedFieldName)==-1}));this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"pvtBtnDropped"},this));t.Pivot.addReportItem(this.model.dataSource,f);this.refreshControl();t.isNullOrUndefined(this._schemaData)||this._schemaData._refreshPivotButtons()}else e=i.text==this._getLocalizedLabels("AddToColumn")?this.element.find(".columns"):i.text==this._getLocalizedLabels("AddToRow")?this.element.find(".grpRow"):i.text==this._getLocalizedLabels("AddToValues")?this.element.find(".values"):i.text==this._getLocalizedLabels("AddToFilter")?this.element.find(".drag"):"",o={element:this._selectedMember,target:e,cancel:!1},this._pvtBtnDropped(o);else this._createCalculatedField()},_getAdvancedFilterInfo:function(t){var i=[],r;return this._excelFilterInfo.length>0&&(r=t,i=n.grep(this._excelFilterInfo,function(n){try{if(n.levelUniqueName.replace(/]/g,"").replace(/\[/g,"").indexOf(t)>-1)return n}catch(i){}})),i},_createPivotButtons:function(i,u){var c=this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?!0:!1,s,l,p,f,v,w,o,b,y,d;if(!t.isNullOrUndefined(i)){var a="",s=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"Slicers":"Values",h="";if(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)for(s=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"filters":"values",s=="values"&&c&&(i=n.map(i,function(n){return n.measures})),f=0;f<i.length;f++){h=i[f].fieldCaption;var g=c?"":t.PivotAnalysis.getMembers(i[f].fieldName),k=t.Pivot.getReportItemByFieldName(i[f].fieldName,this.model.dataSource),e=i[f].filterItems!=null&&i[f].filterItems.values.length>0||!t.isNullOrUndefined(i[f].advancedFilter)&&i[f].advancedFilter.length>0&&k.item&&k.axis!="filters"?"filtered":"";u=="filter"&&(e=="filtered"?h=t.Pivot._getFilterState(c,g,i[f],this):c?(t.olap._mdxParser.getAllMember(this.model.dataSource,i[f].fieldName,this),h=this._allMember):h=this._getLocalizedLabels("All"));l=c?"":i[f].sortOrder==t.PivotAnalysis.SortOrder.Descending?"descending":"";a+=t.buildTag("span.pivotButton",t.buildTag("button.pvtBtn#pivotButton_"+(i[f].fieldName||i[f]),(this.model.showUniqueNameOnPivotButton?u!="values"?i[f].fieldName.replace(/\[/g,"").replace(/\]/g,""):i[f].fieldCaption==r?i[f].fieldName:i[f].fieldCaption||i[f]:i[f].fieldCaption==r?i[f].fieldName:i[f].fieldCaption||i[f])+(u=="filter"?" ("+h+")":""),{},{fieldName:i[f].fieldName,fieldCaption:i[f].fieldCaption,axis:s})[0].outerHTML+(c&&(i[f].fieldName.toLowerCase()=="measures"||!t.isNullOrUndefined(i[f].isNamedSet)&&!i[f].isNamedSet)?"":t.buildTag("span.filter e-icon "+e).attr("role","button").attr("aria-label","filter")[0].outerHTML)+(c?" ":t.buildTag("span.sorting e-icon "+l).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML)+t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML).attr("tag",s+":"+i[f].fieldName||i[f])[0].outerHTML}else for(s=="Values"&&u=="values"&&(p=this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").length>0?this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").parent()[0].className.split(" ")[0]:"schemaColumn",this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(s=p=="schemaColumn"||p=="columns"?"Columns":"Rows")),f=0;f<i.length;f++){for(v=this._ascdes.split("##"),w=0,l="",e="",o=0;o<v.length;o++)(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&v[o]==i[f].Tag||this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&v[o]==i[f])&&(w=1);if(w==1&&(l="descending"),!t.isNullOrUndefined(this._tempFilterData))for(o=0;o<this._tempFilterData.length;o++)for(b in this._tempFilterData[o])this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?b==(i[f].FieldName||i[f].DimensionName)&&this._tempFilterData[o][i[f].FieldName||i[f].DimensionName]!=""&&(e="filtered"):this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&b==(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?i[f].Tag:i[f])&&this._tempFilterData[o][i[f].Tag].indexOf("FILTERED")!=0&&(e="filtered");this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(i[f].FieldHeader=i[f].FieldHeader=="Measures"?this._getLocalizedLabels("Measures"):i[f].FieldHeader,e=u!="filter"&&this.model.enableAdvancedFilter&&this._getAdvancedFilterInfo(i[f].Tag).length>0?"filtered":e,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(y=t.isNullOrUndefined(this._tempFilterData)?[]:n.map(this._tempFilterData,function(n){return n[i[f].DimensionHeader]}),u=="filter"&&(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.enableAdvancedFilter&&this._getAdvancedFilterInfo(i[f].Tag).length>0&&(e="filtered"),h=y.length>0&&e&&this._fieldMembers[i[f].DimensionHeader]?this._fieldMembers[i[f].DimensionHeader].length-y.length==1?this._fieldMembers[i[f].DimensionHeader].filter(function(n){if(y.indexOf(n)==-1)return n}):this._getLocalizedLabels("MultipleItems"):this._getLocalizedLabels("All"))):u=="filter"&&(h=(this._fieldSelectedMembers[i[f].Tag]=="All"?i[f].AllMember:this._fieldSelectedMembers[i[f].Tag])||i[f].AllMember),d=i[f].FieldHeader=="Measures"||i[f].Tag=="Measures"?"":t.buildTag("span.filter e-icon "+e).attr("role","button").attr("aria-label","filter")[0].outerHTML,a+=t.buildTag("span.pivotButton",t.buildTag("span.dropIndicator")[0].outerHTML+t.buildTag("button.pvtBtn#pivotButton"+i[f].FieldHeader||i[f].FieldName||i[f].Name||i[f].DimensionHeader||i[f].DimensionName,(this.model.showUniqueNameOnPivotButton?u!="values"?i[f].Tag:i[f].FieldHeader||i[f].FieldName||i[f].Name||i[f].DimensionHeader||i[f].DimensionName:i[f].FieldHeader||i[f].FieldName||i[f].Name||i[f].DimensionHeader||i[f].DimensionName)+(u=="filter"?" ("+h+")":""),{},this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?{fieldname:i[f].FieldName||i[f].DimensionName||i[f].FieldHeader||i[f].DimensionHeader,fieldCaption:i[f].FieldHeader||i[f].FieldName||i[f].DimensionName||i[f].DimensionHeader}:{fieldCaption:i[f].FieldHeader})[0].outerHTML+d+t.buildTag("span.sorting e-icon "+l).attr("role","button").attr("aria-label","sort")[0].outerHTML+t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML).attr("tag",s+":"+i[f].Tag)[0].outerHTML):a+=t.buildTag("span.pivotButton",t.buildTag("span.dropIndicator")[0].outerHTML+t.buildTag("button.pvtBtn#pivotButton"+i[f],i[f])[0].outerHTML+t.buildTag("span.filter e-icon "+e).attr("role","button").attr("aria-label","filter")[0].outerHTML+t.buildTag("span.sorting e-icon "+l).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML+t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML).attr("tag",s+":"+i[f])[0].outerHTML}return a}},_createFields:function(){var l,e,a,r,v,h,c,o,i,s,f,u,y,p;if(this.element.find(".groupingBarPivot").remove(),this.element.prepend(t.buildTag("div#groupingBarPivot.groupingBarPivot")[0].outerHTML),this.element.find(".groupingBarPivot").prepend(t.buildTag("div.valueColumn",t.buildTag("span.values",t.buildTag("span#grpvalue","values",{display:"none"})[0].outerHTML).attr("aria-describedby","grpvalue")[0].outerHTML+t.buildTag("span.columns",t.buildTag("span#grpcol","column",{display:"none"})[0].outerHTML).attr("aria-describedby","grpcol")[0].outerHTML,{width:"100%"})),this.element.find(".groupingBarPivot").prepend(t.buildTag("div.drag",t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+t.buildTag("span#grpdrag","filter",{display:"none"})[0].outerHTML+this._getLocalizedLabels("DragFieldHere"),{width:"100%"})[0].outerHTML).attr("aria-describedby","grpdrag"),this._pivotFilter!=""&&this._pivotFilter!=null&&this.element.find(".drag").text("").append("<span id='grpdrag' style='display:none'>filter<\/span>"),this.element.find(".drag").append(this._pivotFilter),this.element.find(".values").append(this._pivotCalculation),this.element.find(".columns").append(this._pivotColumn),this.element.find(".values .pivotButton").length==0&&this.element.find(".values").append(t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("ValueArea")),this.element.find(".columns .pivotButton").length==0&&this.element.find(".columns").append(t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("ColumnArea")),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.element.find(".rows").length==0&&!t.isNullOrUndefined(this.getJSONRecords())&&this.getJSONRecords().length>0&&this.getJSONRecords()[0].CSS=="colheader"?(this.element.find(".pivotGridTable thead tr:first").prepend(t.buildTag("th.grpRow",t.buildTag("div.rows",t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("RowArea"))[0].outerHTML,{},{rowspan:this.element.find("thead tr").length})[0].outerHTML),this.element.find(".pivotGridTable tbody tr:first").prepend(t.buildTag("td.rowheader",this._getLocalizedLabels("Total"))[0].outerHTML)):this.element.find(".rows .pivotButton").length==0&&(this.element.find(".rows").text("").children("span").remove(),this.element.find(".rows").append(t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("RowArea"))),(this.element.find(".rowheader").length==0&&this.element.find(".colheader").length==0&&this.element.find(".values .pivotButton").length==0||this.element.find(".pivotGridTable th").length==0)&&(l=t.buildTag("div.emptyRows",t.buildTag("span.rows",this._pivotRow!=""?this._pivotRow:this._getLocalizedLabels("RowArea"),{width:"5px"})[0].outerHTML,{width:140})[0].outerHTML,this.element.find(".rows").length==0?this.element.find(".groupingBarPivot").append(l):"",this.model.enableDeferUpdate&&this._pivotRow!=""&&(this.element.find(".rows").text(""),this.element.find(".rows").append(this._pivotRow)),(this.getJSONRecords()==null||this.getJSONRecords().length==0)&&this.element.find(".groupingBarPivot").addClass("emptyPivotGrid"),this.element.find(".emptyRows,.rows").ejDroppable({})),this.element.find(".values").find(".filter").remove(),this.element.find(".values").find(".sorting").remove(),this.element.find(".drag").find(".sorting").remove(),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.element.find(".pivotButton").find(".sorting").remove(),(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this.element.find(".rows").width(this.element.find(".pivotGridRowTable").width()),this._setGroupingBarFrozenRowBtnWidth()),this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._clientPvtBtnDropped:this._pvtBtnDropped,this),helper:t.proxy(function(t){return n(t.element).parent().addClass("dragHover"),n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1?n(t.sender.target).clone().addClass("dragClone").appendTo(this.element):!1},this)}),this.element.find(".drag, .values, .columns, .grpRow, .rows").ejDroppable({}),this.element.find(".pivotGridTable").find("thead th:eq(1), tbody td.value:eq(0)").length>0)this.element.find(".groupingBarPivot").width(this.element.find(".pivotGridTable").width());else if(this.element.find(".pivotGridTable").find("thead, tbody").length>0)this.model.isResponsive||this.element.find(".groupingBarPivot").width(this.element.find(".rows").width()+150);else if(this.element.find(".columns .pivotButton").length==0||this.element.find(".values .pivotButton").length==0&&this.element.find(".columns .pivotButton").length==1)this.element.find(".groupingBarPivot").width(300);else{for(e=0,u=0;u<n(this.element.find(".columns .pivotButton")).length;u++)e=Math.max(n(this.element.find(".columns .pivotButton")[u]).width(),e);e<140?this.element.find(".columns").css("min-width",e+"px"):"";a=e*n(this.element.find(".columns .pivotButton")).length+this.element.find(".values").width()+10;this.element.find(".groupingBarPivot").width(a)}for((this.element.find(".rows").width()>140||this.model.enableDeferUpdate&&this.element.find(".rows").width()<this.element.find(".grpRow").width()&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)&&(this.enableDeferUpdate?this.element.find(".rows").width(this.element.find(".colheader").length==0?this.element.find(".grpRow").width()-140:this.element.find(".grpRow").width()):this.model.isResponsive||this.element.find(".rows").width(this.model.enableDeferUpdate?this.element.find(".grpRow").width()-8:this.element.find(".grpRow").width())),(this.element.find(".pivotGridTable thead").length>0||this.model.enableDeferUpdate&&this.element.find(".pivotGridTable thead").length==0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this.model.isResponsive&&this.element.find(".values .pivotButton").length==0&&this.element.find(".columns .pivotButton").length==0?this.element.find(".values").width(140):this.element.find(".values").width(this.element.find(".grpRow").length>0?this.model.enableDeferUpdate&&this.element.find(".colheader").length==0?this.element.find(".grpRow").width():this.element.find(".grpRow").width()+4:140),this.model.enableDeferUpdate&&this.element.find(".colheader").length==0&&this.element.find(".pivotGridTable .rowheader").length!=0&&(f=this.element.find(".groupingBarPivot").width()-this.element.find(".values").width(),f<140&&this.element.find(".groupingBarPivot").width(this.element.find(".groupingBarPivot").width()+140)),this.element.find(".pivotGridTable").find("thead th:eq(1), tbody td.value:eq(0)").length>0||this.model.enableDeferUpdate&&this.element.find(".columns .pivotButton").length==0||this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?(r=this.element.find(".pivotGridTable").width()-this.element.find(".values").width()-4,this.element.find(".pivotGridTable").find("thead th:eq(2), tbody td:eq(1)").length==0?(this.element.find(".columns").css("min-width",r>=30&&this.element.find(".pivotGridTable .colheader").length==0&&this.element.find(".columns .pivotButton").length==0?140:r).width(r>=30&&this.element.find(".pivotGridTable .colheader").length==0&&this.element.find(".columns .pivotButton").length==0?82:r),this.element.find(".values").height(r>=30&&this.element.find(".pivotGridTable .colheader").length==0&&this.element.find(".columns .pivotButton").length==0?this.element.find(".columns").height():this.element.find(".values").height()),(this.element.find(".columns .pivotButton").length==0||this.model.enableDeferUpdate&&this.element.find(".pivotGridTable .colheader").length==0)&&(this.element.find(".columns .pivotButton").length==0&&(r=this.element.find(".groupingBarPivot").width()-this.element.find(".values").width()-5,this.element.find(".columns").width(r),r<140&&(n(".groupingBarPivot .values .pivotButton").length==1||n(".groupingBarPivot .values .pivotButton").length==0&&this.model.enableDeferUpdate)&&this.element.find(".columns").css("min-width",r+"px")),this.element.find(".columns").addClass("widthSetter"))):r<140?n(".columns .pivotButton").length<2?this.element.find(".columns").css("min-width",r).addClass("widthSetter"):(this.element.find(".columns").width(r).css("min-width",r),this.element.find(".values").height(this.element.find(".columns").height())):this.element.find(".columns").width(r)):this.element.find(".pivotGridTable").find("thead th:eq(1)").length!=0||this.model.enableDeferUpdate||(v=this.element.find(".columns .pivotButton").length<1?1:this.element.find(".columns .pivotButton").length,this.element.find(".columns").addClass("widthSetter"),this.element.find(".columns").css("min-width",(this.element.find(".groupingBarPivot").width()-this.element.find(".values").width()-7)/v))),this.model.dataSource.data!=null&&this.model.url==""&&(h=0,n(".columns .pivotButton").each(function(){h+=parseInt(n(this).width()+10)}),n(".valueColumn").height()>30&&this.element.find(".values button").length==0&&this.element.find(".columns").width()<h&&(c=this.element.find(".columns .pivotButton").length,i=(this.element.find(".valueColumn").width()-this.element.find(".values").width())/(c==0?1:c)-70,this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"}))),this.element.find(".columns").height()>30?(i=this.model.isResponsive?this.element.find(".columns").width()/this.element.find(".columns .pivotButton").length-5:this.element.find(".columns").width()/2-60,this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"})):this.element.find(".columns .pivotButton").width()>this.element.find(".columns").width()&&(i=this.element.find(".columns").width()-60,this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),this.element.find(".drag").height()>30?(i=this.element.find(".groupingBarPivot").width()/4-35,this.element.find(".drag .pvtBtn").width(i).css({"text-overflow":"ellipsis"})):this.element.find(".drag .pivotButton").width()>this.element.find(".drag").width()&&(i=this.element.find(".drag").width()-60,this.element.find(".drag .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),this.element.find(".values").height()>30?(i=this.model.isResponsive?this.element.find(".values").width()/this.element.find(".values .pivotButton").length-5:this.element.find(".values").width()/2-40,this.element.find(".values .pvtBtn").width(i).css({"text-overflow":"ellipsis"})):(this.element.find(".values .pivotButton").width()>this.element.find(".values").width()||this.element.find(".pivotGridTable").find("thead th:eq(1), tbody td.value:eq(0)").length==0&&this.element.find(".values .pivotButton").length>0)&&(i=this.element.find(".values").width()-40,this.element.find(".values .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),o=0,u=0;u<this.element.find(".rows .pivotButton").length;u++)o=o+this.element.find(".rows .pivotButton:eq("+u+")").width();if((o>this.element.find(".rows").width()||this.element.find(".colfreeze").length>0&&o>this.element.find(".colfreeze").width()||this.element.find(".rows").parent(".emptyRows").length>0&&this.element.find(".rows").parent(".emptyRows").width()<o)&&(i=0,i=this.element.find(".colfreeze").length>0?this.element.find(".colfreeze").width()/2-40:this.element.find(".rows").width()/2-40,this.element.find(".rows .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),this.model.enableDeferUpdate&&this.element.find(".columns .pivotButton").length!=0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){for(s=0,f=0,u=0;this.element.find(".columns .pivotButton").length>u;u++)s=this.element.find(".columns .pivotButton:eq("+u+")").width()+s+7;if(this.element.find(".pivotGridTable .colheader,.pivotGridTable tr:eq(0) .summary").each(function(){f=f+n(this).width()}),s>=f){var w=this.element.find(".pivotGridTable .colheader").length>0?1:0,r=w==0?140:f,i=r/(this.model.enableDeferUpdate?this.element.find(".columns .pivotButton").length:3)-15;this.model.enableDeferUpdate?this.element.find(".columns .pvtBtn").width(30).css({"text-overflow":"ellipsis"}):this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"})}}(this.element.find(".values").height()>this.element.find(".columns").height()||this.element.find(".columns").height()>this.element.find(".values").height())&&(this.element.find(".values").height()>this.element.find(".columns").height()?this.element.find(".columns").height(this.element.find(".values").height()):this.element.find(".values").height(this.element.find(".columns").height()));this.element.find(".colheader, .rowheader, .value").addClass("e-droppable");this.element.find(".summary").removeClass("e-droppable");this.model.enableGroupingBar&&(y=this.element.find(".pvtBtn"),p=t.buildTag("ul.pivotTree#pivotTree",(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?t.buildTag("li.calculatedFieldMenuItem",t.buildTag("a.menuItem",this._getLocalizedLabels("CalculatedField"))[0].outerHTML)[0].outerHTML:" ")+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToFilter"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToValues"))[0].outerHTML)[0].outerHTML)[0].outerHTML,n(this.element).append(p),n("#pivotTree").ejMenu({menuType:t.MenuType.ContextMenu,enableRTL:this.model.enableRTL,openOnClick:!1,contextMenuTarget:y,click:t.proxy(this._pivotContextClick,this),beforeOpen:t.proxy(this._contextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)}))},_clientPvtBtnDropped:function(i){var h,c,s,l,e;t.PivotAnalysis._valueSorting=null;this._isDragging=!1;t.Pivot.openPreventPanel(this);i.element.removeClass("dragHover").css("background-color","inherit");i.element.parent().removeClass("dragHover");this.element.find(".dragClone").remove();this.element.find(".dropIndicator").removeClass("dropIndicatorHover");this.element.find(".dragClone,.dropIndicator").remove();var r=n(i.target).hasClass("columns")||n(i.target).parents(".columns").length>0?"column":n(i.target).hasClass("grpRow")||n(i.target).parents(".grpRow").length>0||n(i.target).hasClass("rows")?"row":n(i.target).hasClass("values")||n(i.target).parents(".values").length>0?"value":n(i.target).hasClass("drag")||n(i.target).parents(".drag").length>0?"filter":"",o=i.element.text(),u=n(i.element).attr("fieldName");if(r!=""&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(u.toLowerCase().indexOf("[measures]")>=0&&r!="value"||u==this._getLocalizedLabels("Measures")&&r!="row"&&r!="column"||u.toLowerCase().indexOf("[measures]")<0&&r=="value")){t.Pivot._createErrorDialog(this._getLocalizedLabels("GroupingBarAlertMsg"),this._getLocalizedLabels("Warning"),this);return}if(r==""&&this._schemaData)if(o.toLowerCase()=="measures"&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)for(h=0;this.model.dataSource.values[0].measures.length>0;)selectedTreeNode=this._schemaData._tableTreeObj.element.find("li[tag='"+this.model.dataSource.values[0].measures[h].fieldName+"']"),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode);else this._schemaData&&(c=this._schemaData._tableTreeObj.element.find("li:contains('"+o+"')"),this._schemaData._tableTreeObj.uncheckNode(c));if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&r!=""&&r!="value"&&n.grep(this._calculatedField,function(n){return n.name==u}).length>0){t.Pivot._createErrorDialog(this._getLocalizedLabels("CalcValue"),this._getLocalizedLabels("Warning"),this);this.element.find(".dragClone,.dropIndicator").remove();return}var f=r==""?"":this._setSplitBtnTargetPos(i.event,r,"drop"),a=r==""?"":this._setSplitBtnTargetPos(i,r,"original"),v=n(i.element).hasClass("columns")||n(i.element).parents(".columns").length>0?"column":n(i.element).hasClass("grpRow")||n(i.element).parents(".grpRow").length>0||n(i.element).hasClass("rows")?"row":n(i.element).hasClass("values")||n(i.element).parents(".values").length>0?"value":n(i.element).hasClass("drag")||n(i.element).parents(".drag").length>0?"filter":"";r!=""&&r.toLowerCase()==v.toLowerCase()&&f>a&&(f=f-1);s={droppedFieldName:u,droppedFieldCaption:o,droppedClass:r,droppedPosition:f,isMeasuresDropped:u.toLocaleLowerCase().indexOf("measures")==0};this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&r!="value"?this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(s.droppedFieldName)==-1}):this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this._fieldMembers={},this._fieldSelectedMembers={},this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"pvtBtnDropped"},this));t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();t.Pivot.addReportItem(this.model.dataSource,s);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(l=n.grep(this.model.dataSource.values,function(n){return n.isCalculatedField==!0}),this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1}),n.merge(this.model.dataSource.values,l));(this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter)&&r=="filter"&&(e=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,e&&e.advancedFilter&&(e.advancedFilter=[]));this.refreshControl();t.isNullOrUndefined(this._schemaData)||(t.Pivot.getReportItemByFieldName(u,this.model.dataSource).item==null&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._schemaData._tableTreeObj.element.find("li[tag='"+u+"']").removeClass("filter").find(".treeDrop,.filter").remove(),this._schemaData._refreshPivotButtons())},_pvtBtnDropped:function(i){var h,r,c,l,v,a,w;t.Pivot.openPreventPanel(this);n(i.element).parent().removeClass("dragHover");n(i.element).removeClass("dragHover");this._isUpdateRequired=!0;this._isDragging=!1;this.element.find(".dropIndicator").removeClass("dropIndicatorHover");var s=null,f="",o="",e,y=!1,p=!1;if(droppedClass=t.isNullOrUndefined(i.target.className)?n(i.target).hasClass("columns")?"columns":n(i.target).hasClass("grpRow")?"rows":n(i.target).hasClass("values")?"values":n(i.target).hasClass("drag")?"drag":"":i.target.className.indexOf("e-droppable")>=0?i.target.className.split(" ")[0]:"",droppedClass=droppedClass=="grpRow"?"rows":droppedClass,y=n(i.element).parent().find(".filtered").length>0?!0:!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(n(i.target).hasClass("pvtBtn")&&this.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode&&(droppedClass=n(i.target).attr("axis").toLowerCase()),e=t.isNullOrUndefined(i.element.attr("fieldCaption"))?i.element.text():i.element.attr("fieldCaption"),p=n(i.element).parent().find(".descending").length>0?!0:!1,droppedClass==""&&(i.target.tagName=="BUTTON"||i.target.tagName=="SPAN")&&(droppedClass=i.target.parentNode.parentElement.className.split(" ")[0]),h=0;h<this._pivotTableFields.length;h++)this._pivotTableFields[h].name==e&&(this._pivotTableFields[h].isSelected=!0,o=this._pivotTableFields[h]);else t.isNullOrUndefined(i.target.className)?(s=n(i.target),f=n(i.target).hasClass("columns")?"Categorical":n(i.target).hasClass("grpRow")?"Series":n(i.target).hasClass("drag")?"Slicer":"",droppedClass=n(i.target).hasClass("columns")?"columns":n(i.target).hasClass("grpRow")?"rows":n(i.target).hasClass("values")?"values":n(i.target).hasClass("drag")?"drag":""):(s=i.target.className.indexOf("pvtBtn")>-1?n(i.target).parents(".e-droppable")[0]:i.target.className.indexOf("e-droppable")?i.target:i.target[0].tagName.toLowerCase()=="td"?i.target.children(":last")[0]:i.target,f=s.className.split(" ")[0]=="columns"?"Categorical":s.className.split(" ")[0]=="rows"||s.className.split(" ")[0]=="grpRow"?"Series":s.className.split(" ")[0]=="filters"?"Slicer":"",droppedClass=s.className.split(" ")[0]),f==""&&i.element.parent().attr("tag").indexOf("[Measures]")>-1&&(f=this.element.find(".schemaRow .pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").length>0?"Series":"Categorical"),o=n(i.element.parent()[0]).attr("tag"),droppedClass=droppedClass=="grpRow"?"rows":droppedClass,f=f=="grpRow"?"Series":f,e=i.element.text();if(this.element.find(".dragClone").remove(),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(o.split(":")[1].toLocaleUpperCase()=="MEASURES"&&(droppedClass!="columns"||droppedClass!="rows")&&(droppedClass=="drag"||droppedClass=="values")||o.toUpperCase().indexOf("[MEASURES]")>-1&&droppedClass!="values"&&(droppedClass=="rows"||droppedClass=="columns"||droppedClass=="drag")||o.toUpperCase().indexOf("[MEASURES]")==-1&&droppedClass=="values"))return t.Pivot._createErrorDialog(this._getLocalizedLabels("GroupingBarAlertMsg"),this._getLocalizedLabels("Error"),this),this.element.find(".dragClone,.dropIndicator").remove(),i.element.parent().removeAttr("style"),i.element.css("background-color","inherit"),!1;if(droppedClass=="rows"||droppedClass=="columns"||droppedClass=="values"||droppedClass=="drag"){if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&droppedClass!="values"&&(n.grep(this._calculatedField,function(n){return n.name==e}).length>0||n.grep(JSON.parse(this.getOlapReport()).PivotCalculations,function(n){return n.FieldHeader==e&&n.CalculationType==8}).length>0)){t.Pivot._createErrorDialog(this._getLocalizedLabels("CalcValue"),this._getLocalizedLabels("Warning"),this);i.element.parent().removeAttr("style");i.element.css("background-color","inherit");return}r=this._setSplitBtnTargetPos(i,droppedClass,"drop");c=this._setSplitBtnTargetPos(i,droppedClass,"original");droppedClass=="drag"&&this.element.find(".drag").text("").append("<span id='grpdrag' style='display:none'>filter<\/span>");try{report=JSON.parse(this.getOlapReport()).Report}catch(k){report=this.getOlapReport()}if(n(i.element.parent()).remove(),this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)l=i.element.parents(".pivotButton").attr("tag").split(":")[0],this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),n.isNumeric(r)&&droppedClass==l.toLowerCase()&&r>c&&(r=r-1),droppedClass=droppedClass=="rows"?"schemaRow":droppedClass=="columns"?"schemaColumn":droppedClass=="drag"?"schemaFilter":droppedClass=="values"?"schemaValue":"",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(this.model.enableAdvancedFilter&&droppedClass=="schemaFilter"&&!t.isNullOrUndefined(this._curFilteredText)&&this._curFilteredText.indexOf(":")>-1&&(v=this._getAdvancedFilterInfo(this._curFilteredText.split(":")[1]),v.length>0&&this._removeFilterTag(v[0].levelUniqueName)),f=droppedClass=="schemaFilter"?"Slicer":f,params=JSON.parse(this._olapReport).CurrentCube+"--"+o+"--"+f+"--"+r,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),a=JSON.stringify(this.model.customObject),eventArgs=JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:params,currentReport:report,gridLayout:this.model.layout,customObject:a}),this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtBtnDroppedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs,this._pvtBtnDroppedSuccess)):(this._calculatedField.length>0&&droppedClass!="schemaValue"&&this._schemaData!=null&&this._calculatedFieldNodeRemove(o),this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),a=JSON.stringify(this.model.customObject),w=t.Pivot._getFilterParams(droppedClass,this._tempFilterData,e),eventArgs=JSON.stringify({action:"nodeDropped",dropAxis:droppedClass+"::"+r,headerTag:JSON.stringify(o),sortedHeaders:this._ascdes,filterParams:w,currentReport:report,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:a}),successMethod=this._renderControlSuccess,this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtBtnDroppedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs,this._pvtBtnDroppedSuccess));else{if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&droppedClass!="values"&&n.grep(this._calculatedField,function(n){return n.name==e}).length>0){t.Pivot._createErrorDialog(this._getLocalizedLabels("CalcValue"),this._getLocalizedLabels("Warning"),this);this.model.editCellsInfo={};this._populatePivotGrid();return}var u=this._getDroppedItem(e),b={fieldName:u[0].fieldName,fieldCaption:u[0].fieldCaption},l=i.element.parents(".pivotButton").attr("tag").split(":")[0];this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&u.length>0&&droppedClass=="drag"&&(u[0].advancedFilter=[]);n.isNumeric(r)?droppedClass==l.toLowerCase()&&r>c?droppedClass=="rows"?this.model.dataSource.rows.splice(r-1,0,u[0]):droppedClass=="columns"?this.model.dataSource.columns.splice(r-1,0,u[0]):droppedClass=="values"?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures.splice(r-1,0,u[0]):this.model.dataSource.values.splice(r,0,u[0]):this.model.dataSource.filters.splice(r,0,u[0]):droppedClass=="rows"?this.model.dataSource.rows.splice(r,0,u[0]):droppedClass=="columns"?this.model.dataSource.columns.splice(r,0,u[0]):droppedClass=="values"?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures.splice(r,0,u[0]):this.model.dataSource.values.splice(r,0,u[0]):this.model.dataSource.filters.splice(r,0,u[0]):droppedClass=="rows"?this.model.dataSource.rows.push(u[0]):droppedClass=="columns"?this.model.dataSource.columns.push(u[0]):droppedClass=="values"?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures.push(u[0]):this.model.dataSource.values.push(u[0]):this.model.dataSource.filters.push(u[0]);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&droppedClass!="values"&&(this._schemaData!=null&&this._calcFieldNodeDrop(u[0]),this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(u[0].fieldName)==-1}));this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"pvtBtnDropped"},this));this._schemaData!=null&&(droppedClass==l&&r>c&&(r=r-1),this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._schemaData.element.find("button[fieldName='"+e+"']").remove():this._schemaData.element.find("#pivotButton"+e).parent().remove(),this._schemaData._createPivotButton(b,droppedClass=="rows"?"row":droppedClass=="columns"?"column":droppedClass=="drag"?"filter":droppedClass=="values"?"value":"",y,p,r));this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.getJSONData({action:"pvtBtnDropped"},this.model.dataSource,this)):(this.model.editCellsInfo={},this._populatePivotGrid())}}else this._removePvtBtn(i);t.isNullOrUndefined(this._schemaData)||this._schemaData._setPivotBtnWidth()},_getDroppedItem1:function(i){var f=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?!0:!1,r=n.grep(this.model.dataSource.columns,function(n){return n.fieldName==i}),u;return r.length>0?this.model.dataSource.columns=n.grep(this.model.dataSource.columns,function(n){return n.fieldName!=i}):(r=n.grep(this.model.dataSource.rows,function(n){return n.fieldName==i}),r.length>0?this.model.dataSource.rows=n.grep(this.model.dataSource.rows,function(n){return n.fieldName!=i}):(u=this.model.dataSource.values,this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(u=this.model.dataSource.values[0].measures),r=n.grep(u,function(n){return n.fieldName==i}),r.length>0?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures=n.grep(u,function(n){return n.fieldName!=i}):this.model.dataSource.values=n.grep(u,function(n){return n.fieldName!=i}):(r=n.grep(this.model.dataSource.filters,function(n){return n.fieldName==i}),r.length>0&&(this.model.dataSource.filters=n.grep(this.model.dataSource.filters,function(n){return n.fieldName!=i}))))),r},_clearCollapsedItems:function(t,i,u){return t=="rowheader"?u.rows=n.map(u.rows,function(t){return t.drilledItems!=r&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(i.repItms.replace(/&/g,"&"))<0)return[n]})),t}):t=="colheader"&&(u.columns=n.map(u.columns,function(t){return t.drilledItems!=r&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(i.repItms.replace(/&/g,"&"))<0)return[n]})),t})),u},_setSplitBtnTargetPos:function(t,i,r){var e="",f,o,u;for(o=r=="drop"?n(t.target).parents(".pivotButton"):n(t.element).parents(".pivotButton"),i=i=="column"?"columns":i=="row"?"rows":i=="filter"?"drag":i=="value"?"values":i,f=this.element.find("."+i).children(".pivotButton"),u=0;u<f.length;u++)n(f[u]).attr("tag")==n(o).attr("tag")&&(e=u);return e},_pvtBtnDroppedSuccess:function(n){!t.isNullOrUndefined(n[0])&&n.length>0?n[2]!=null&&n[2]!=r&&(this.model.customObject=n[2].Value):!t.isNullOrUndefined(n.d)&&n.d.length>0?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):t.isNullOrUndefined(n)||t.isNullOrUndefined(n.OlapReport)||n!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.model.enableDeferUpdate?this._deferUpdateSuccess(n):this._renderControlSuccess(n);this._schemaData!=null&&this._schemaData._refreshPivotButtons()},_deferUpdateSuccess:function(i){t.isNullOrUndefined(i.PivotReport)&&t.isNullOrUndefined(i.OlapReport)?(this.setOlapReport(i.d[0].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(i.d[2].Value),JSON.parse(i.d[1].Value))):(t.isNullOrUndefined(i.PivotReport)?this.setOlapReport(i.OlapReport):this.setOlapReport(i.PivotReport),i.HeaderCounts!=r&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)));this.model.enableGroupingBar&&(report=JSON.parse(this.getOlapReport()),this._pivotTableFields=JSON.parse(report.ItemsProperties),this._createGroupingBar(report),this.element.find(".grpRow .rows").text(""),this.element.find(".grpRow .rows").children().remove(),this.element.find(".grpRow .rows").append(this._pivotRow),this._createFields(null,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth()));this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._schemaData!=null&&this._schemaButtonCreate();t.Pivot.closePreventPanel(this)},_clientRemovePvtBtn:function(i){t.PivotAnalysis._valueSorting=null;t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();var r=n(n(i.target).siblings()[0]).attr("fieldName");delete this._fieldMembers[r.toLowerCase()];delete this._fieldSelectedMembers[r.toLowerCase()];this._calculatedField.length>0&&n.grep(this.model.dataSource.values,function(n){return n.fieldName==r}).length>0?this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return(n.isCalculatedField==null||n.isCalculatedField==!1||n.formula.indexOf(r)==-1)&&n.fieldName!=r}):t.Pivot.removeReportItem(this.model.dataSource,r,r.toLocaleLowerCase().indexOf("measures")==0);this.refreshControl();t.isNullOrUndefined(this._schemaData)||(this._schemaData._tableTreeObj.element.find("li[tag='"+r+"']").removeClass("filter").find(".treeDrop,.filter").remove(),this._schemaData.refreshControl())},_removePvtBtn:function(i){var v,f,h,r,c,y,s,u,p,o,a,l;if(this._isUpdateRequired=!0,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(i.type=="click"){var f=n(n(i.target).siblings()[0]).attr("fieldName"),e="",s="";v=n(n(i.target).siblings()[0]).text()}else{var f=i.element.attr("fieldName"),e="",s="";v=i.element.text()}for(u=0;u<this.element.find(".pivotButton").length;u++)s=n(this.element.find(".pivotButton")[u]).find("button").attr("fieldName"),s==f&&(e=n(this.element.find(".pivotButton")[u]));if(n(e).remove(),this._schemaData!=null){if(a=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._schemaData._tableTreeObj.element.find("li [tag='"+f+"']"):this._schemaData._tableTreeObj.element.find("li[id='"+f+"']"),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&a.length==0&&f.toLowerCase()=="measures"){for(this._schemaData.element.find("div[tag='"+e.attr("tag")+"']").remove(),u=0;u<this.model.dataSource.values[0].measures.length;u++)this._schemaData._nodeCheck=!0,selectedTreeNode=this._schemaData._tableTreeObj.element.find("li[tag='"+this.model.dataSource.values[0].measures[u].fieldName+"']"),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode),this.element.find("div[tag='values:"+this.model.dataSource.values[0].measures[u].fieldName+"']").remove(),this._schemaData.element.find("div[tag='values:"+this.model.dataSource.values[0].measures[u].fieldName+"']").remove();this.model.dataSource.values[0].measures=[];t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.getJSONData({action:"removeBtn"},this.model.dataSource,this)}this._schemaData._tableTreeObj.uncheckNode(a)}else this.model.dataSource.columns=n.grep(this.model.dataSource.columns,function(n){return n.fieldName!=f}),this.model.dataSource.rows=n.grep(this.model.dataSource.rows,function(n){return n.fieldName!=f}),this.model.analysisMode==t.Pivot.AnalysisMode.Olap?e.attr("tag").split(":")[1].toLowerCase()=="measures"?this.model.dataSource.values[0].measures=[]:this._getItemPosition(this.model.dataSource.values[0].measures,e.attr("tag").split(":")[1]).length>0&&this.model.dataSource.values[0].measures.splice(this._getItemPosition(this.model.dataSource.values[0].measures,e.attr("tag").split(":")[1])[0],1):this.model.dataSource.values=this._calculatedField.length>0?n.grep(this.model.dataSource.values,function(n){return(n.isCalculatedField==null||n.isCalculatedField==!1||n.formula.indexOf(f)==-1)&&n.fieldName!=f}):n.grep(this.model.dataSource.values,function(n){return n.fieldName!=f}),this.model.dataSource.filters=n.grep(this.model.dataSource.filters,function(n){return n.fieldName!=f}),this.model.analysisMode!=t.Pivot.AnalysisMode.Olap&&this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode?(this.model.editCellsInfo={},this._populatePivotGrid()):(t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"removeButton"},this),this.getJSONData({action:"removeButton"},this.model.dataSource,this))}else{if(i.type=="click"?(f=n(n(i.target).siblings("button")).attr("fieldcaption"),r=n(n(i.target).siblings("button")).parent().attr("tag")):(f=i.element.attr("fieldcaption"),r=i.element.parent().attr("tag")),!t.isNullOrUndefined(this._tempFilterData)&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)for(c=0;c<this._tempFilterData.length;c++)for(y in this._tempFilterData[c])y==r.split(":")[1]&&this._tempFilterData[c][r.split(":")[1]]!=""&&this._tempFilterData.splice(c,1);for(delete this._fieldMembers[r.split(":")[r.split(":").length-1]],delete this._fieldSelectedMembers[r.split(":")[r.split(":").length-1]],filterTag="",filterItems="",e="",r="",s="",h="",e=this.element.find(".pivotButton:contains("+f+")"),u=0;u<this._pivotTableFields.length;u++)this._pivotTableFields[u].name==f&&(this._pivotTableFields[u].isSelected=!1,r=this._pivotTableFields[u]);try{h=JSON.parse(this.getOlapReport()).Report}catch(w){h=this.getOlapReport()}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)if(r=n(e).attr("tag"),s=r.indexOf("[Measures]")>-1||r.indexOf("[")>-1?r.split(":")[1]:this._getNodeUniqueName(r),s=="[Measures]"){if(e.remove(),!t.isNullOrUndefined(this._schemaData))for(this._schemaData.element.find(".pivotButton:contains("+f+")").remove(),u=0;u<this._schemaData.model.pivotCalculations.length&&r.indexOf("Measures")>-1;u++)s=this._schemaData.model.pivotCalculations[u].Tag,this._schemaData._isMeasureBtnRemove=!0,selectedTreeNode=this._getNodeByUniqueName(s),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode);this._waitingPopup.show();this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.customObject});l=JSON.stringify(this.model.customObject);o=JSON.stringify({action:"removeButton",headerInfo:r,currentReport:h,gridLayout:this.model.layout,customObject:l});!t.isNullOrUndefined(this._schemaData)&&r.indexOf("[Measures]")<0&&r.indexOf("Measures")>=0&&this._schemaData.element.find(".schemaValue .pivotButton").remove();this.model.enableDeferUpdate&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(this._removeButtonDeferUpdate=!0,this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o.replace("removeButton","removeButtonDeferUpdate"),this._pvtBtnDroppedSuccess),this.element.find(".schemaNoClick").removeClass("freeze"),this._waitingPopup.hide()):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o,this._pvtBtnDroppedSuccess)}else if(t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),t.isNullOrUndefined(this._schemaData)){if(l=JSON.stringify(this.model.customObject),o=JSON.stringify({action:"removeButton",headerInfo:r,currentReport:h,gridLayout:this.model.layout,customObject:l}),t.isNullOrUndefined(r))return!1;this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o.replace("removeButton","removeButtonDeferUpdate"),this._pvtBtnDroppedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o,this._pvtBtnDroppedSuccess)}else selectedTreeNode=this._getNodeByUniqueName(s),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode);else filterTag="schemaRow::"+r.id+"::FILTERED"+filterItems,p=this._droppedClass!=""?this._droppedClass:r.pivotType=="PivotItem"?"schemaRow":"schemaValue",this._droppedClass="",n(e).remove(),this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this._schemaData!=null?(a=this._schemaData._tableTreeObj.element.find("li:contains('"+f+"')"),this._schemaData._tableTreeObj.uncheckNode(a)):(this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.customObject}),l=JSON.stringify(this.model.customObject),o=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:p+"::",sortedHeaders:this._ascdes,filterParams:filterTag,currentReport:h,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:l}),this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeStateModified,o.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeStateModified,o,this._nodeStateModifiedSuccess))}},_getNodeUniqueName:function(n){for(var t="",i=0;i<n.split(":")[1].split(".").length;i++)t!=""&&(t+="."),t+="["+n.split(":")[1].split(".")[i]+"]";return t},_getNodeByUniqueName:function(t){for(var r=null,i=0;i<n(this._schemaData._tableTreeObj.element.find("li")).length;i++)n(this._schemaData._tableTreeObj.element.find("li")[i]).attr("tag").toLowerCase()==t.toLowerCase()&&(r=n(this._schemaData._tableTreeObj.element.find("li")[i]));return r},_nodeStateModifiedSuccess:function(n){n[0]!=r?n[2]!=null&&n[2]!=r&&(this.model.customObject=n[2].Value):n.d!=r?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.customObject});this.model.enableDeferUpdate?this._deferUpdateSuccess(n):this._renderControlSuccess(n)},_drillDownSuccess:function(i){if(i[0]!=r)this.setJSONRecords(i[0].Value),this.setOlapReport(i[1].Value),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=JSON.parse(i[1].Value).Report,i[2].Value!=r&&i[2].Value!="undefined"&&(this._pivotClientObj.reports=i[2].Value)),i[3]!=null&&i[3]!=r&&i[3].Key=="PageSettings"&&(this.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i[4].Value).Column/JSON.parse(i[3].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i[4].Value).Row/JSON.parse(i[3].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i[3].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i[3].Value).SeriesPageSize):this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r?this._pagerObj.initPagerProperties(JSON.parse(i[4].Value),JSON.parse(i[3].Value)):t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i[4].Value),JSON.parse(i[3].Value)),i[5]!=null&&i[5]!=r&&(this.model.customObject=i[5].Value)),i[3]!=null&&i[3]!=r&&i[3].Key!="PageSettings"&&(this.model.customObject=i[3].Value);else if(i.d!=r)this.setJSONRecords(i.d[0].Value),this.setOlapReport(i.d[1].Value),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=JSON.parse(i.d[1].Value).Report,i.d[2].Value!=r&&i.d[2].Value!="undefined"&&(this._pivotClientObj.reports=i.d[2].Value),this._updatePageSettings(i.d,this._pivotClientObj)),i.d[3]!=null&&i.d[3]!=r&&i.d[3].Key=="PageSettings"&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i.d[4].Value).Column/JSON.parse(i.d[3].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.d[4].Value).Row/JSON.parse(i.d[3].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i.d[3].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.d[3].Value).SeriesCurrentPage):this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r?this._pagerObj.initPagerProperties(JSON.parse(i.d[4].Value),JSON.parse(i.d[3].Value)):t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i.d[4].Value),JSON.parse(i.d[3].Value)),i.d[5]!=null&&i.d[5]!=r&&(this.model.customObject=i.d[5].Value)),i.d[3]!=null&&i.d[3]!=r&&i.d[3].Key!="PageSettings"&&(this.model.customObject=i.d[3].Value);else{if(t.isNullOrUndefined(i.PivotRecords))return t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null?t.isNullOrUndefined(this._pivotClientObj)?t.isNullOrUndefined(this._pivotClientObj)&&(this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"),this._waitingPopup.hide()):this._pivotClientObj._waitingPopup.hide():this._pivotClientObj._waitingPopup.hide(),!1;this.setJSONRecords(i.PivotRecords);this.setOlapReport(i.OlapReport);t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=JSON.parse(i.OlapReport).Report,i.ClientReports!=r&&i.ClientReports!="undefined"&&(this._pivotClientObj.reports=i.ClientReports),i.PageSettings!=r&&i.PageSettings!=null&&this._pivotClientObj._pagerObj!=null&&this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)));i.PageSettings!=r&&i.PageSettings!=null&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Column/JSON.parse(i.PageSettings).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Row/JSON.parse(i.PageSettings).SeriesPageSize),this._categCurrentPage=JSON.parse(i.PageSettings).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.PageSettings).SeriesCurrentPage):this._pagerObj&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)));i.customObject!=null&&i.customObject!=r&&(this.model.customObject=i.customObject)}this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"drillDown",element:this.element,customObject:this.model.customObject});this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&this.model.enableVirtualScrolling==!1&&n(".e-pivotpager")[0]==null?this.excelLikeLayout(this.getJSONRecords()):this.renderControlFromJSON(this.getJSONRecords());try{this.model.currentReport=JSON.parse(this.getOlapReport()).Report}catch(f){this.model.currentReport=this.getOlapReport()}this._trigger("drillSuccess",this.element);t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null?t.isNullOrUndefined(this._pivotClientObj)?t.isNullOrUndefined(this._pivotClientObj)&&(this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"),this._waitingPopup.hide()):(!this._pivotClientObj||this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._startDrilldown)&&this._pivotClientObj.model.displaySettings.mode!="gridOnly"||this._pivotClientObj._waitingPopup.hide():n("#"+this._pivotClientObj._id+"_maxView")[0]&&this._maxViewLoading?(this._maxViewLoading.hide(),this._pivotClientObj._waitingPopup.hide()):this._pivotClientObj.model.displaySettings.mode=="gridOnly"&&this._pivotClientObj._waitingPopup.hide();t.isNullOrUndefined(this._pivotClientObj)?this._waitingPopup.hide():this._pivotClientObj._pivotGrid._startDrilldown=!1;var u={action:this._drillAction,customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",u)},saveReport:function(n,i,r){var u,f;i.toLowerCase()=="local"?this._trigger("saveReport",{report:this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource:this.getOlapReport()}):(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(report=JSON.stringify(this.model.dataSource),u="clientMode"):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(report=JSON.parse(this.getOlapReport()).Report,u="serverMode"),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"saveReport",element:this.element,customObject:this.model.customObject}),f=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:n,clientReports:report,operationalMode:u,customObject:f})))},loadReport:function(n,i,r){var e,f,o,u;if(this._waitingPopup.show(),i.toLowerCase()=="local")if(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)this._trigger("loadReport",{targetControl:this,dataModel:this.model.analysisMode}),this.refreshPivotGrid();else{this._trigger("loadReport",{targetControl:this,dataModel:this.model.analysisMode});try{o=JSON.parse(this.getOlapReport()).Report}catch(s){o=this.getOlapReport()}this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"loadReport",element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);e=JSON.stringify({action:"loadReport",gridLayout:this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.layout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,reportName:n,operationalMode:"serverMode",clientReports:o,customObject:u});this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.loadReport,e,this._renderControlSuccess)}else this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"loadReport",element:this.element,customObject:this.model.customObject}),u=JSON.stringify(this.model.customObject),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(f="clientMode",this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.loadReport,JSON.stringify({action:"loadReport",gridLayout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,reportName:n,operationalMode:f,customObject:u}),this._loadReportSuccess)):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(f="serverMode",e=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?JSON.stringify({action:"loadReport",reportName:n,gridLayout:this.model.layout,enablePivotFieldList:this.model.enablePivotFieldList,operationalMode:f,customObject:u}):JSON.stringify({action:"loadReport",gridLayout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,reportName:n,operationalMode:f,customObject:u}),this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.loadReport,e,this._renderControlSuccess))},_loadReportSuccess:function(n){n.d!=r&&n.d.length>0?this.setOlapReport(JSON.parse(n.d[0].Value)):this.setOlapReport(JSON.parse(n.report));this.model.dataSource=this.getOlapReport();this.refreshPivotGrid();this._unWireEvents();this._wireEvents()},doAjaxPost:function(i,u,f,e,o,s){t.isNullOrUndefined(f.XMLA)&&JSON.parse(f).action!="cellEditing"&&(this.model.editCellsInfo={});var h,c,l,a=!0;f.XMLA==r?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:i,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(i){n.proxy(i,this);var r={action:!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(s.action)?s.action:JSON.parse(f).action,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",r)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null||this._pivotClientObj._waitingPopup.hide();var i={action:this._drillAction!=""?this._drillAction:"initialize",customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",i);this.renderControlFromJSON("");this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.Pivot._createErrorDialog(n.statusText,this._getLocalizedLabels("Error"),this);n.statusText},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()},refreshPagedPivotGrid:function(i,r){if(this._isUpdateRequired=!0,t.isNullOrUndefined(this._pivotClientObj)&&(this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"),this._waitingPopup.show()),i=i.indexOf("categ")!=-1?"categorical":"series",this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)i=="categorical"?this._categCurrentPage=parseInt(r):this._seriesCurrentPage=parseInt(r),t.olap.base.getJSONData({action:"navPaging"},this.model.dataSource,this);else{var u;try{u=JSON.parse(this.getOlapReport()).Report}catch(f){u=this.getOlapReport()}this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"pagingDeferUpdate",pagingInfo:i+":"+r,currentReport:u,layout:this.layout(),customObject:JSON.stringify(this.model.customObject)}),this._deferUpdateSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:i+":"+r,currentReport:u,layout:this.layout(),customObject:JSON.stringify(this.model.customObject)}),this._renderControlSuccess)}},excelLikeLayout:function(i){var nt,v,g,rt,k,d,a,l,s,h,u,e,c;for(this._excelRowCount=0,u=0;u<i.length;u++)if(parseInt(i[u].Index.split(",")[0])==0)this._excelRowCount++;else break;this._rowCount=this._excelRowCount;var r=jQuery.extend(!0,[],i),f=[],w=[],o=null,y=0;if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(nt=n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this._pivotClientObj.getOlapReport():this.getOlapReport()),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.dataSource.rows.length==0&&this.model.dataSource.data!=null||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&nt!==""&&JSON.parse(nt).PivotRows.length==0)){this._excelLikeJSONRecords=null;this.renderControlFromJSON();this._excelRowCount=0;return}if(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot&&r!=null&&r!=""){for(v=null,s=r[0].CSS!="colheader"?r[0].ColSpan*this._excelRowCount:0;s<r.length;s++){if(r[s].Info.toLowerCase().indexOf("[measure")>-1&&(v=parseInt(r[s].Index.split(",")[1])),r[s].CSS.indexOf("value")>-1)break;g=parseInt(r[s].Index.split(",")[1])}for(v!=null&&v!=g&&v!=0&&this._columnExcelLikeLayout(r,v,g),rt=r.length/this._excelRowCount,k=0;k<rt&&k<r.length;k++)for(d=0;d<=g&&d<r.length;d++)if(u=k*this._excelRowCount+d,r[u].CSS=="colheader"&&r[u].Span!="Block"&&(r[u].Info.toLowerCase().indexOf("[measure")==-1||r[u].Info.toLowerCase().indexOf("[measure")>-1&&v!=null&&v==0)&&r[u].ColSpan>1){for(e=u;e<u+r[u].RowSpan;e++){for(c=e+this._excelRowCount;c<e+r[u].ColSpan*this._excelRowCount;c=c+this._excelRowCount)r[c].Span="Block";e!=u&&(r[e].Span="Block")}if(a=u+(r[u].RowSpan-1)+(r[u].ColSpan-1)*this._excelRowCount+1,l=null,r[a].CSS.indexOf("summary")>-1&&r[a].Value==this._getLocalizedLabels("Total")&&r[a-this._excelRowCount].CSS.indexOf("summary")==-1)l=a;else if(r[a].CSS.indexOf("summary")>-1&&r[a-this._excelRowCount].CSS.indexOf("summary")>-1)for(e=a-this._excelRowCount;e>=0&&e<r.length;e=e-this._excelRowCount)if(r[e].ColSpan>1||r[e-this._excelRowCount].CSS.indexOf("summary")==-1&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){l=e;break}l!=null&&(r[l].ColSpan=this.model.operationalMode!=t.PivotGrid.OperationalMode.ClientMode?r[l].ColSpan:parseInt(r[a].Index.split(",")[0])-parseInt(r[l].Index.split(",")[0])+1,r[u].ColSpan=r[u].ColSpan-r[l].ColSpan,r[u+r[u].ColSpan*this._excelRowCount]=n.extend(!0,{},r[l]),r[u+r[u].ColSpan*this._excelRowCount].RowSpan=r[l].RowSpan+r[u].RowSpan,r[u+r[u].ColSpan*this._excelRowCount].Value=r[u].Value+" Total")}}if(r!=null&&r!=""&&r[0].CSS!="colheader"&&!(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)){if(r[0].Index=="0,0"&&r[0].CSS!="colheader")for(y=r[0].ColSpan,r[0].RowSpan==0&&(r[0].RowSpan=1),e=0;e<r[0].RowSpan&&e<r.length;e++)f.push(r[e]),r[e].Level=1,r[e].Span="Block";for(s=r[0].RowSpan;s<r.length&&this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot&&this.model.dataSource.rows.length>0;s=s+this._excelRowCount)if(r[s].Info.toLowerCase().indexOf("[measure")>-1){o=parseInt(r[s].Index.split(",")[0]);break}for(u=0;u<r.length&&u<this._excelRowCount;u++)if(r[u].CSS=="rowheader"&&parseInt(r[u].Index.split(",")[0])==0&&r[u].Span!="Block"){for(r[u].Level=1,r[u+this._excelRowCount]!=null&&r[u+this._excelRowCount].CSS.indexOf("value")==-1&&(r[u].itemIndex=r[u+r[u].RowSpan-(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?1:0)].Index),f.push(r[u]),o!=null&&o==0&&r[u].Info.toLowerCase().indexOf("[measure")>-1&&w.push(r[u]),e=u+1;e<u+r[u].RowSpan;e++)(r[e].Info.toLowerCase().indexOf("[measure")==-1||o!=null&&o!=y-1)&&(r[e].Span="Block");this._rowExcelLikeLayout(u,r,f,2,o,w,y)}else(r[u].CSS=="summary rgtot"||r[u].CSS=="summary gtot"||r[u].CSS=="summary calc gtot"||r[u].CSS=="colheader"&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||(r[u].CSS=="summary"&&r[u].Value.indexOf(this._getLocalizedLabels("Total"))>-1||r[u].CSS=="summary row")&&this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot)&&parseInt(r[u].Index.split(",")[0])==0&&(o!=null&&o==y-1&&(r[u].Value+=" "+r[u+this._excelRowCount*parseInt(r[u].ColSpan)].Value),r[u].Value=r[u].Value==this._getLocalizedLabels("Total")?this._getLocalizedLabels("GrandTotal"):r[u].Value,f.push(r[u]),r[u].Level=1);if(o!=null&&o==0){for(u=0;u<w.length;u++)f.push(n.extend(!0,{},w[u])),f[f.length-1].CSS="summary",f[f.length-1].Value=this._getLocalizedLabels("Total")+" "+f[f.length-1].Value;w.splice(0,w.length)}var p=f.length,b=0,tt,ut,it=!1;for(u=0;u<p;u++){for(b=b+u,tt=f[u].itemIndex!=null?f[u].itemIndex:f[u].Index,ut=parseInt(tt.split(",")[0])*this._excelRowCount+parseInt(tt.split(",")[1]),h=ut;h<r.length;h=h+this._excelRowCount)(r[h].CSS.indexOf("value")>-1||r[h].CSS.indexOf("colheader")>-1||r[h].CSS.indexOf("calc")>-1||r[h].CSS.indexOf("cstot")>-1||r[h].CSS.indexOf("cgtot")>-1||r[h].CSS.indexOf("none")>-1)&&parseInt(r[h].Index.split(",")[0])>=y&&(it=!0),it&&(b=b+(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?parseInt(p):this._excelRowCount),f[b]=n.extend(!0,{},r[h]));b=0;it=!1}for(u=0;u<p;u++)f[u]!=null&&(f[u].Span="none",isNaN(f[u].Level)&&(f[u].Level=1),f[u].Index=="0,0"&&f[u].CSS!="colheader"&&u==0||(f[u].RowSpan=1),f[u].ColSpan=o!=null&&o==y-1&&f[u].CSS=="rowheader"&&f[u].Info.toLowerCase().indexOf("[measure")==-1?f.length/p:o!=null&&o==0&&f[u].Info.toLowerCase().indexOf("[measure")>-1&&f[u].CSS=="rowheader"?f.length/p:o!=null&&o!=y-1&&o!=0&&(f[u].Info.toLowerCase().indexOf("[measure")>-1||f[u].CSS=="rowheader"&&parseInt(f[u].Index.split(",")[0])<o)?f.length/p:1);this._excelRowCount=p}for(r!=null&&f.length==0&&(f=r),e=0;e<f.length/this._excelRowCount;e++)for(c=0;c<this._excelRowCount;c++)f[e*this._excelRowCount+c].i=""+e+","+c+"",f[e*this._excelRowCount+c].Span="none";this._excelLikeJSONRecords=f;this.renderControlFromJSON()},_rowExcelLikeLayout:function(n,i,r,u,f,e,o){for(var v,c,h,l=!1,s=n+(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?i[n].ColSpan*this._excelRowCount:this._excelRowCount),a=0;a<i[n].RowSpan&&s<i.length&&i[s].CSS.indexOf("value")==-1;s++,a++){if(f!=null&&f!=o-1&&f!=0&&i[s].Info.toLowerCase().indexOf("[measure")>-1&&i[s].Span!="Block"&&(l=!0),v=f!=null&&f==o-1?i[s].CSS=="summary row"&&(i[s+this._excelRowCount].CSS=="summary row"||i[s+this._excelRowCount].CSS=="none"||i[s+this._excelRowCount].Info.toLowerCase().indexOf("[measure")>-1):f!=null&&f!=o-1&&f!=0?i[s].CSS=="summary"&&(i[s+this._excelRowCount].CSS=="summary"||i[s+this._excelRowCount].CSS=="none"||i[s+this._excelRowCount].Info.toLowerCase().indexOf("[measure")>-1||parseInt(i[s].Index.split(",")[0])-1<=f):!1,(i[s].CSS=="rowheader"||i[s].CSS=="none"||v)&&i[s].Span!="Block"){for(h=s+1;h<s+i[s].RowSpan;h++)(i[h].Info.toLowerCase().indexOf("[measure")==-1||f!=null&&f!=o-1)&&(i[h].Span="Block");if(i[s].Level=u,i[s].CSS!="none")if(i[s+this._excelRowCount]!=null&&i[s+this._excelRowCount].CSS.indexOf("value")==-1&&(i[s].itemIndex=i[s+i[s].RowSpan-(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?1:0)].Index),v){for(c=s-i[n].ColSpan*this._excelRowCount;c>=0&&c<i.length;c--)if(i[c].Value!=""){i[s].Value=i[c].Value;i[s].Level=i[n].Level;break}f!=null&&f!=o-1&&f!=0&&parseInt(i[s].Index.split(",")[0])-1==f?e.push(i[s]):(i[s].Value+=" "+i[s+this._excelRowCount*parseInt(i[s].ColSpan)].Value,r.push(i[s]))}else r.push(i[s]);i[s].Span="Block";i[s].CSS!="summary row"&&i[s].CSS!="summary"&&this._rowExcelLikeLayout(s,i,r,u+1,f,e,o)}if(l&&a+1==i[n].RowSpan){for(l=!1,h=0;h<e.length;h++)e[h].Value=i[n].Value+" "+e[h].Value,r.push(e[h]);e.splice(0,e.length)}}},_columnExcelLikeLayout:function(t,i,r){for(var l,u,o,s,f,c,y,e,v,h,p=t.length/this._excelRowCount,a=0;a<p&&a<t.length;a++)for(l=0;l<=r&&l<t.length;l++)if(u=a*this._excelRowCount+l,t[u].CSS=="colheader"&&t[u].Span!="Block"&&t[u].Info.toLowerCase().indexOf("[measure")==-1&&t[u].ColSpan>1){for(f=u;f<u+t[u].RowSpan;f++){for(e=f+this._excelRowCount;e<f+t[u].ColSpan*this._excelRowCount;e=e+this._excelRowCount)t[e].Span="Block";f!=u&&(t[f].Span="Block")}if(o=u+(t[u].RowSpan-1)+(t[u].ColSpan-1)*this._excelRowCount+1,t[o].Info.toLowerCase().indexOf("[measure")>-1&&JSON.parse(this.getOlapReport()).PivotCalculations.length>1&&i!=null&&i!=r&&i!=0){for(s=[],f=u+t[u].RowSpan;f<=o;f=f+(t[f].ColSpan+1)*this._excelRowCount)if(c=f+(t[f].RowSpan-1)+(t[f].ColSpan-1)*this._excelRowCount+1,t[c].CSS.indexOf("summary")>-1){for(t[c-1].RowSpan=t[c-1].RowSpan+t[c].RowSpan,y=parseInt(t[c].Index.split(",")[0])*this._excelRowCount,e=0;e<this._excelRowCount;e++)t.splice(parseInt(t[o].Index.split(",")[0])*this._excelRowCount+this._excelRowCount+e+s.length*this._excelRowCount,0,n.extend(!0,{},t[y+e]));s.push(y);t[f].ColSpan=t[f].ColSpan-1}for(v=s.length-1;v>=0;v--)t.splice(parseInt(t[s[v]].Index.split(",")[0])*this._excelRowCount,this._excelRowCount);s.length>0&&(t[u].ColSpan=t[u].ColSpan-s.length,h=u+t[u].ColSpan*this._excelRowCount,t[h].ColSpan=s.length,t[h].RowSpan=t[u].RowSpan,t[h].Value=t[u].Value+" Total",t[h].CSS="summary",t[h].Span="none",t[h].State=0)}else t[o].Info.toLowerCase().indexOf("[measure")>-1&&t[o+1].CSS.indexOf("summary")>-1&&JSON.parse(this.getOlapReport()).PivotCalculations.length==1&&i!=null&&i!=r&&i!=0&&(t[u].ColSpan=t[u].ColSpan-1,t[u+t[u].ColSpan*this._excelRowCount]=n.extend(!0,{},t[o+1]),t[o+1].Value="",t[u+t[u].ColSpan*this._excelRowCount].Value=t[u].Value+" Total",t[u+t[u].ColSpan*this._excelRowCount].RowSpan=t[u].RowSpan)}},_getColumnIndices:function(t,i,r,u){var f=t=="rows"?i.Index.split(",")[1]:t=="columns"?i.Index.split(",")[0]:null;return i.Value==r&&(n.inArray(Number(f),u)==-1?u.push(Number(f)):u),u},renderControlFromJSON:function(){var p=null,i,tt,v,e,ht,ct,lt,gt,l,ut,s,u,h,k,g,w,c,o,ft,y,vt,yt,ri,bt,nt,kt,ot,st,r;if(!t.isNullOrUndefined(this.model.valueSortSettings)&&this.element.find(".valueSorting").length>0&&!t.isNullOrUndefined(t.PivotAnalysis._valueSorting)&&(p=this.element.find(".valueSorting").parent()),i=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this._excelLikeJSONRecords:this.getJSONRecords(),this.model.enableConditionalFormatting&&this._isFormatApply&&(i=this._refreshCellFormatting(i)),this.model.enableConditionalFormatting&&!this._isFormatApply&&(i=this._applyCodeBehindFormatting(i)),n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(tt=n("<div id="+this._id+"Toolbar style='width:"+this._pivotClientObj._gridWidth+";height:"+this._pivotClientObj._gridHeight+";overflow:auto;margin-top:5px;margin-left:5px'><\/div>")),i!=null&&i!="")for(v=0;v<i.length;v++)i[v].Value=="Total"&&(i[v].Value=this._getLocalizedLabels("Total")),i[v].Value=="Grand Total"&&(i[v].Value=this._getLocalizedLabels("GrandTotal"));if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this._applyLocale(i),e=n('<table class="pivotGridTable" cellspacing="0" cellpadding="0" role=\'grid\' aria-readonly=\'true\'><\/table>'),this.model.isResponsive&&e.addClass("e-table"),i!=null&&i!=""||this.model.enableGroupingBar){if(i!=null&&i!=""){for(lt=this._rowCount,this._rowCount=0,gt=this,index=0;index<i.length;index++)if(parseInt(i[index].Index.split(",")[0])==0)this._rowCount++;else break;this._rowCount=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this._excelRowCount:this._rowCount;var it=n("<thead><\/thead>"),rt=n("<tbody><\/tbody>"),at=!0,b=0;for(i[0].CSS=="none"?b=n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&JSON.parse(this.getOlapReport()).PivotCalculations.length==0&&JSON.parse(this.getOlapReport()).PivotRows.length==0?JSON.parse(this.getOlapReport()).PivotColumns.length-1:i[0].RowSpan-1:(jQuery.each(i,function(n){return b+=i[n].RowSpan,i[n].CSS=="colheader"}),b=b-2),l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ut=!1,index=0;index<i.length;index++)if(index<this._rowCount)if(at){for(at=index>=b?!1:!0,s="<tr role='row'>",this.model.enableGroupingBar&&i[index].Index=="0,0"&&i[index].CSS=="colheader"&&(s=s+"<"+(l?"td":"th")+" class='grpRow' p='-1,-1' colspan= 1 rowspan="+(this._rowCount-1)+"> <div class=rows>"+this._getLocalizedLabels("DragFieldHere")+"<\/div><\/th>",ut=!0),u=index;u<i.length;u=u+this._rowCount)if(i[u].Span!="Block")if(s=i[u].Index=="0,0"&&i[u].CSS!="colheader"&&this.model.enableGroupingBar?s+"<"+(l?"td":"th")+" class=grpRow p="+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='columnheader' aria-describedby='row'"+(i[u].i==null?"":"i="+i[u].i)+">"+t.buildTag("span#row","rows",{display:"none"})[0].outerHTML+(i[u].State==0?'<span style="margin-left: 0px"><\/span>':i[u].State==2?'<span class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":"")+i[u].Value+t.buildTag("div.rows",this._pivotRow,{})[0].outerHTML+"<\/th>":s+"<"+(l?"td":"th")+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+(i[u].CSS=="none"?" p="+i[u].Index:'" p='+i[u].Index)+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='columnheader'"+(i[u].i==null?"":"i="+i[u].i)+">"+(i[u].State==0?'<span style="margin-left: 10px"><\/span>':i[u].State==2?'<span class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span class="collapse e-icon" aria-describedby=\'collapsing\' title=" '+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":"")+i[u].Value+"<\/th>",i[u].RowSpan>1&&i[u].ColSpan<=1)for(r=u+1;r<u+i[u].RowSpan;r++)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan<=1)for(r=u+this._rowCount;r<u+i[u].ColSpan*this._rowCount;r=r+this._rowCount)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan>1)for(r=u;r<u+i[u].RowSpan;r++){for(h=r+this._rowCount;h<r+i[u].ColSpan*this._rowCount;h=h+this._rowCount)i[h].Span="Block";r!=u&&(i[r].Span="Block")}s+="<\/tr>";n(s).text()!=""&&n(it).append(s)}else{for(s="<tr role='row'>",parseInt(i[index].Index.split(",")[0])==0&&parseInt(i[index].Index.split(",")[1])==this._rowCount-1&&ut&&(s=s+"<td class='rowheader' p='-1,-2' colspan=1 rowspan=1>"+(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout?this._getLocalizedLabels("GrandTotal"):this._getLocalizedLabels("Total"))+"<\/td>"),u=index;u<i.length;u=u+this._rowCount)if(i[u].Span!="Block")if(s=i[u].CSS=="rowheader"||i[u].CSS=="summary"||i[u].CSS.indexOf("summary rstot")>-1||i[u].CSS.indexOf("summary stot")>-1||i[u].CSS=="summary row"||i[u].CSS.indexOf("summary rgtot")>-1?this.layout().toLowerCase()=="excellikelayout"?s+"<"+(l?"td":"th")+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+'" p='+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='rowheader'"+(i[u].i==null?"":"i="+i[u].i)+">"+(i[u].State==2?'<span style="margin-'+(this.model.enableRTL?"right:":"left:")+i[u].Level*10+'px" class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span style="margin-'+(this.model.enableRTL?"right:":"left:")+i[u].Level*10+'px" class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":'<span style="margin-'+(this.model.enableRTL?"right:":"left:")+(this._excelLikeJSONRecords!=null&&i[u].CSS=="summary row"?i[u].Level*10:(i[u].Level==1?1:i[u].Level+2)*10)+'px"> <\/span>')+i[u].Value+"<\/th>":s+"<"+(l?"td":"th")+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+'" p='+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='rowheader'>"+(i[u].State==0?'<span style="margin-left: 10px"><\/span>':i[u].State==2?'<span class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":"")+i[u].Value+"<\/th>":s+"<td"+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+'" p='+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='gridcell'"+(i[u].i==null?"":"i="+i[u].i)+">"+(i[u].State==2?'<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'"> <\/span>':i[u].State==1?'<span class="collapse e-icon" title="'+this._getLocalizedLabels("Collapse")+'"> <\/span>':"")+i[u].Value+"<\/td>",i[u].RowSpan>1&&i[u].ColSpan<=1)for(r=u+1;r<u+i[u].RowSpan;r++)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan<=1)for(r=u+this._rowCount;r<u+i[u].ColSpan*this._rowCount;r=r+this._rowCount)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan>1)for(r=u;r<u+i[u].RowSpan;r++){for(h=r+this._rowCount;h<r+i[u].ColSpan*this._rowCount;h=h+this._rowCount)i[h].Span="Block";r!=u&&(i[r].Span="Block")}s+="<\/tr>";n(s).text()!=""&&n(rt).append(s)}l?this._renderFrozenGridTable(e,it,rt):(n(e).append(it),n(e).append(rt))}}else ht=t.buildTag("tr",t.buildTag("th","",{width:"70px"})[0].outerHTML+t.buildTag("th","",{width:"70px"})[0].outerHTML+t.buildTag("th","",{width:"70px"})[0].outerHTML),ct=t.buildTag("tr",t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML)[0].outerHTML,n(e).append(ht),n(e).append(ct),this._rowCount=0;if(this._unWireEvents(),this._wireEvents(),this.model.enableVirtualScrolling||!(n(e).find("tr:last > td").length>0)||n(e).find("tr:last").find("td").text()!=""||this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this._pagerObj!=null||n(e).find("tr:last").hide(),this.model.enablePaging||this.model.enableVirtualScrolling||(this._hideGrandTotal(e),this._hideSubTotal(e)),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.enableCollapseByDefault||!t.isNullOrUndefined(this.model.collapsedMembers))&&!t.isNullOrUndefined(i))if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.enableCollapseByDefault){var l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ni=t.isNullOrUndefined(this.model.dataSource.data)?n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()).PivotRows.length:JSON.parse(this.getOlapReport()).PivotRows.length:this.model.dataSource.rows.length,ti=t.isNullOrUndefined(this.model.dataSource.data)?n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()).PivotColumns.length:JSON.parse(this.getOlapReport()).PivotColumns.length:this.model.dataSource.columns.length;for(this.model.collapsedMembers={},k=ni;k>=0;k--)for(thRList=l?n(e).find(".pivotGridRowTable [p^='"+k+",']:has('span.collapse')[class^='rowheader']"):n(e).find("th[p^='"+k+",']:has('span.collapse')[class^='rowheader']"),w=this._getFieldName(thRList[0]),this.model.collapsedMembers[w]=[],c=0;c<thRList.length;c++)this.model.collapsedMembers[w].push(n(thRList[c]).clone().children().remove().end().text()),this._collapseMember(e,n(thRList[c]).find(".collapse"));for(g=ti;g>=0;g--)for(thCList=n(e).find((l?".pivotGridFrozenTable ":"th")+"[p$=',"+g+"']:has('span.collapse')[class$='colheader']"),w=this._getFieldName(thCList[0]),this.model.collapsedMembers[w]=[],c=0;c<thCList.length;c++)this.model.collapsedMembers[w].push(n(thRList[c]).clone().children().remove().end().text()),this._collapseMember(e,n(thCList[c]).find(".collapse"))}else t.isNullOrUndefined(this.model.collapsedMembers)||(o=this,n.each(this.model.collapsedMembers,function(i,r){var r=r,c,l,a,v,u,f,h,s;if(o.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(u=0;u<o.model.dataSource.rows.length;u++)o.model.dataSource.rows[u].fieldName==i&&(c=u,l="row");for(u=0;u<o.model.dataSource.columns.length;u++)o.model.dataSource.columns[u].fieldName==i&&(c=u,l="column");if(!t.isNullOrUndefined(c))if(l=="row")for(u=o.model.dataSource.columns.length+1;u<o._rowCount;u+=t.isNullOrUndefined(f)?1:f.rowSpan){for(f=n(e).find("tBody th[p='"+c+","+u+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}else if(l=="column")for(u=o.model.dataSource.rows.length;u<Math.ceil(o.getJSONRecords().length/o._rowCount);u+=t.isNullOrUndefined(f)?1:f.colSpan){for(f=n(e).find("thead th[p='"+u+","+c+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("colheader")||n(f).attr("role")=="columnheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}}else{for(a=JSON.parse(o.getOlapReport()).PivotRows,v=JSON.parse(o.getOlapReport()).PivotColumns,u=0;u<a.length;u++)a[u].FieldName==i&&(c=u,l="row");for(u=0;u<v.length;u++)v[u].FieldName==i&&(c=u,l="column");if(!t.isNullOrUndefined(c))if(l=="row")for(u=v.length+1;u<o._rowCount;u+=t.isNullOrUndefined(f)?1:f.rowSpan){for(f=n(e).find("tBody th[p='"+c+","+u+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}else if(l=="column")for(u=a.length;u<Math.ceil(o.getJSONRecords().length/o._rowCount);u+=t.isNullOrUndefined(f)?1:f.colSpan){for(f=n(e).find("thead th[p='"+u+","+c+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("colheader")||n(f).attr("role")=="columnheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}}}));if(this.element.html(""),this.model.enableVirtualScrolling?(this._createVirtualPivotGrid(e),this.model.enableRTL&&this.element.addClass("e-rtl"),this._applyVScrolling()):this.model.enableGroupingBar?(this.element.append(e),(this._JSONRecords==null||this._JSONRecords.length==0)&&this.element.append(t.buildTag("span",this._getLocalizedLabels("NoRecordsToDisplay"),{display:"inline-block",padding:"10px 0px 0px 0px","font-family":"Segoe UI"})[0].outerHTML),this.model.enableRTL&&this.element.addClass("e-rtl"),this._createFields(e,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth())):n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen?(n(tt).append(e),this.element.append(n(tt))):this.element.append(e),this.model.enableColumnResizing&&!this.model.enablePaging&&!this.model.enableVirtualScrolling&&!this.model.frozenHeaderSettings.enableFrozenHeaders&&!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders){for(ft=n("<colgroup><\/colgroup>"),r=0;r<i.length/this._rowCount;r++){if(t.isNullOrUndefined(this.element.find("tbody tr:first").children()[r]))break;y="<col style='width:"+this.element.find("tbody tr:first").children()[r].offsetWidth/Number(n(this.element.find("tbody tr:first").children()[r]).attr("colspan"))+"px'><\/col>";ft.append(y)}n(e).append(ft)}if(t.isNullOrUndefined(this._pivotClientObj)||!this._pivotClientObj.model.enableVirtualScrolling||this._pivotClientObj.model.enablePaging||(this._pivotClientObj.element.find(".categPageIndicator, .seriesPageIndicator , .vScrollThumb, .hScrollThumb").remove(),vt=t.buildTag("div.seriesPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("SeriesPage")+" : ")[0].outerHTML+t.buildTag("span.series_CurrentPage",this._seriesCurrentPage)[0].outerHTML+" / "+t.buildTag("span.series_pageCount",this._seriesPageCount)[0].outerHTML)[0].outerHTML,this._seriesPageCount>1?(this._pivotClientObj.element.find(".vScrollPanel").width()!=12&&this._pivotClientObj.element.width(this._pivotClientObj.element.width()+12),this._pivotClientObj.element.find(".vScrollPanel").width(12),this._pivotClientObj.element.find(".virtualScrolling").append(vt),this._pivotClientObj.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this._pivotClientObj.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartAndGrid?this._pivotClientObj.element.find(".virtualScrolling").css("padding-top","10px"):this._pivotClientObj.element.find(".virtualScrolling").css("padding-left","2px")):this._pivotClientObj.element.find(".vScrollPanel").width()==12&&(this._pivotClientObj.element.width(this._pivotClientObj.element.width()-12),this._pivotClientObj.element.find(".vScrollPanel").width(0)),yt=t.buildTag("div.categPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("CategoricalPage")+" : ")[0].outerHTML+t.buildTag("span.categ_CurrentPage",this._categCurrentPage)[0].outerHTML+" / "+t.buildTag("span.categ_pageCount",this._categPageCount)[0].outerHTML)[0].outerHTML,this._categPageCount>1?(this._pivotClientObj.element.find(".hScrollPanel").height()!=12&&this._pivotClientObj.element.find(".hScrollPanel").height(12),this._pivotClientObj.controlPlacement()==t.PivotClient.ControlPlacement.title&&this._pivotClientObj.element.find(".hsVirtualScrolling").css("margin-top","3px"),this._pivotClientObj.element.find(".hsVirtualScrolling").append(yt)):this._pivotClientObj.element.find(".hScrollPanel").height()==12&&(this._pivotClientObj.model.isResponsive?this._pivotClientObj.element.find(".categoricalAxis, .rowAxis,.slicerAxis").height(this._pivotClientObj.element.find(".categoricalAxis, .rowAxis,.slicerAxis").height()-6):this._pivotClientObj.element.find(".categoricalAxis, .rowAxis,.slicerAxis").height(150),this._pivotClientObj.element.find(".cubeBrowser").height(this._pivotClientObj.element.find(".cubeBrowser").height()-20),this._pivotClientObj.element.find(".hScrollPanel").height(0)),this._applyVScrolling(),this._pivotClientObj.element.find(".chartContainer").length>0&&this._pivotClientObj.element.find(".gridContainer").height(this._pivotClientObj.element.find(".chartContainer").height()+5)),this.model.enableColumnResizing?this.element.addClass("column-resize"):this.element.removeClass("column-resize"),(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this._applyFrozenHeaderWidth(i),this.model.enableColumnResizing&&this.element.find(".pivotGridTable").width("auto")),this.model.enableCellDoubleClick&&this._on(this.element,"dblclick",".value, .summary",this._cellRangeInfo),this.model.enableRTL?(this.element.addClass("e-rtl"),this.element.find(".groupingBarPivot").addClass("e-rtl"),this.element.find("table .rowheader,.colheader,.summary, .groupingBarPivot, .grpRow").css("text-align","right")):(this.element.removeClass("e-rtl"),this.element.find(".groupingBarPivot").removeClass("e-rtl"),this.element.find("table .rowheader,.colheader,.summary, .grpRow, .groupingBarPivot ").css("text-align","left")),n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen){n("#"+this._id).prepend("<div class='toolBar' style='height:40px,width:"+this.element.find("#PivotGridToolbar").width()+"px'><\/div>");var pt="",wt="",ii=t.buildTag("li#frozenHeaders.frozenHeaders e-icon","",{}).attr("aria-label",this._getLocalizedLabels("FrozenHeader")).attr({title:this._getLocalizedLabels("FrozenHeader"),tabindex:0})[0].outerHTML,ui=t.buildTag("li.cellSelect e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CellSelection")).attr({title:this._getLocalizedLabels("CellSelection"),tabindex:0})[0].outerHTML;this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(wt=t.buildTag("li#collapseByDefault.collapseByDefault e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CollapseByDefault")).attr({title:this._getLocalizedLabels("CollapseByDefault"),tabindex:0})[0].outerHTML);pt=t.buildTag("li.numberFormatting e-icon","",{}).attr("aria-label",this._getLocalizedLabels("NumberFormatting")).attr({title:this._getLocalizedLabels("NumberFormatting"),tabindex:0})[0].outerHTML;ri=t.buildTag("li.calculatedField e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CalculatedField")).attr({title:this._getLocalizedLabels("CalculatedField"),tabindex:0})[0].outerHTML;bt=t.buildTag("ul",(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?t.buildTag("li#cellEditing.cellEditing e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CellEditing")).attr({title:this._getLocalizedLabels("CellEditing"),tabindex:0})[0].outerHTML:" ")+t.buildTag("li#drillThrough.drillThrough e-icon","",{}).attr("aria-label",this._getLocalizedLabels("DrillThrough")).attr({title:this._getLocalizedLabels("DrillThrough"),tabindex:0})[0].outerHTML+(((this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.analysisMode==t.Pivot.AnalysisMode.Olap)&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)?"":t.buildTag("li.advancedFiltering e-icon","",{}).attr("aria-label",this._getLocalizedLabels("AdvancedFiltering")).attr({title:this._getLocalizedLabels("AdvancedFiltering"),tabindex:0})[0].outerHTML)+t.buildTag("li#columnResize.columnResize e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ColumnResize")).attr({title:this._getLocalizedLabels("ColumnResize"),tabindex:0})[0].outerHTML+t.buildTag("li.toolTip e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ToolTip")).attr({title:this._getLocalizedLabels("ToolTip"),tabindex:0})[0].outerHTML+(this._pivotClientObj.displayMode()==t.PivotClient.DisplayMode.GridOnly?wt:"")+t.buildTag("li.rtl e-icon","",{}).attr("aria-label",this._getLocalizedLabels("RTL")).attr({title:this._getLocalizedLabels("RTL"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("ul",t.buildTag("li.hyperlinkOptions e-icon","",{}).attr("aria-label",this._getLocalizedLabels("HyperLink")).attr({title:this._getLocalizedLabels("HyperLink"),tabindex:0})[0].outerHTML+t.buildTag("li.layouts e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Layouts")).attr({title:this._getLocalizedLabels("Layouts"),tabindex:0})[0].outerHTML+ii+t.buildTag("li.exporting e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Exporting")).attr({title:this._getLocalizedLabels("Exporting"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("ul",t.buildTag("li.summaryCustomize#summaryCustomize e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SummaryCustomization")).attr({title:this._getLocalizedLabels("SummaryCustomization"),tabindex:0})[0].outerHTML+t.buildTag("li.conditionalFormat e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ConditionalFormatting")).attr({title:this._getLocalizedLabels("ConditionalFormatting"),tabindex:0})[0].outerHTML+(this._pivotClientObj.model.analysisMode=="pivot"&&this._pivotClientObj.model.operationalMode=="clientmode"?t.buildTag("li.summaryTypes e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SummaryTypes")).attr({title:this._getLocalizedLabels("SummaryTypes"),tabindex:0})[0].outerHTML+pt:""))[0].outerHTML;n(".toolBar").append(bt);n(".toolBar").ejToolbar({enableRTL:this.model.enableRTL,height:"35px",enableSeparator:!0})}this._stateMaintenance();n.trim(this.model.pivotTableFieldListID)!=""&&this._isSchemaInitialize&&this.model.enablePivotFieldList&&this._renderPivotSchemaDesigner();this._schemaData!=null&&this.element.find(".colheader, .rowheader, .value").addClass("e-droppable");this.exportRecords=i;t.Pivot.closePreventPanel(this);this._schemaData&&t.Pivot.closePreventPanel(this._schemaData);this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&(this._rowCount=lt);this.model.valueSortSettings&&(t.isNullOrUndefined(this.model.valueSortSettings.headerText)||this.model.valueSortSettings.headerText==""||t.isNullOrUndefined(t.PivotAnalysis._valueSorting)?t.isNullOrUndefined(p)||n(p).find(".rowheader").length!=0||this.element.find("[p='"+Number(n(p).attr("p").split(",")[0])+","+Number(n(p).attr("p").split(",")[1])+"']").html(p.html()):(nt=this.element.find("[p='"+Number(t.PivotAnalysis._valueSorting)+","+(Number(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?JSON.parse(this.getOlapReport()).PivotColumns.length:this.model.dataSource.columns.length)+"']")),n(nt).find(".valueSorting").length!=0||n(nt).hasClass("rowheader")||(kt=t.buildTag("span.valueSorting e-icon "+t.PivotAnalysis._sort).css("width","30px").attr("role","button").attr("aria-label","sort")[0].outerHTML,n(nt).append(kt))));this.model.enableGroupingBar&&this.element.find(".pivotGridTable").width()>0&&!(this.element.find(".values .pvtBtn, .columns .pvtBtn").length==0&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)&&this.element.find("tbody .value").length>0&&this.element.find("thead tr").length>0&&this.element.find(".groupingBarPivot").width(this.element.find(".pivotGridTable").width());(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._applyFrozenHeaderWidth(this._JSONRecords);var d=[],y=[],f={},et=[],dt,a=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!0:!1;if(this.model.analysisMode!=t.PivotGrid.AnalysisMode.Olap&&(this.model.headerSettings.showColumnItems||this.model.headerSettings.showRowItems)&&!this.model.enableGroupingBar){if(a&&(JSON.parse(this.getOlapReport()).PivotRows.length>0||JSON.parse(this.getOlapReport()).PivotColumns.length>0)&&JSON.parse(this.getOlapReport()).PivotCalculations.length>0||!a&&(this.model.dataSource.rows.length>0||this.model.dataSource.columns.length>0)&&this.model.dataSource.values.length>0){for(r=0;r<(a?JSON.parse(this.getOlapReport()).PivotRows.length:this.model.dataSource.rows.length);r++)d.push(a?JSON.parse(this.getOlapReport()).PivotRows[r].FieldHeader:this.model.dataSource.rows[r].fieldCaption);for(r=0;r<(a?JSON.parse(this.getOlapReport()).PivotColumns.length:this.model.dataSource.columns.length);r++)y.push(a?JSON.parse(this.getOlapReport()).PivotColumns[r].FieldHeader:this.model.dataSource.columns[r].fieldCaption);f={rows:d,columns:y}}}else if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&(this.model.headerSettings.showColumnItems||this.model.headerSettings.showRowItems)&&!this.model.enableGroupingBar&&(a&&JSON.parse(this.getOlapReport()).PivotCalculations.length||!a&&this.model.dataSource.values[0].measures.length)&&this._getAxis()=="columns"){for(r=0;r<i.length;r++)if(i[r].CSS!="value"&&i[r].CSS!=" value")i[r].CSS=="rowheader"&&i[r].Info!=""&&n.inArray(i[r].Info.split("::")[1].replace(/[\[\]]+/g,""),d)==-1&&(d.push(i[r].Info.split("::")[1].replace(/[\[\]]+/g,"")),et.push(this.element.find("[p='"+i[r].Index.split(",")[0]+","+i[r].Index.split(",")[1]+"']").width()),r=r+(this._rowCount-r%this._rowCount)),i[r].CSS=="colheader"&&i[r].Info!=""&&n.inArray(i[r].Info.split("::")[1].replace(/[\[\]]+/g,""),y)==-1&&i[r].Info.indexOf("Measure")===-1&&y.push(i[r].Info.split("::")[1].replace(/[\[\]]+/g,""));else{dt=i[r].Index.split(",")[0];break}f={rows:d,columns:y}}if(!n.isEmptyObject(f)&&(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&f.rows.length>0||this.model.analysisMode=="pivot")){for(f.rows!=null&&f.columns!=null&&f.rows.length>1&&f.columns.length>0?this.element.find("[p='0,0']").attr("rowspan",f.columns.length).attr("colspan",f.rows.length-1):this.element.find("[p='0,0']").attr("rowspan","1").attr("colspan","1"),r=0;r<f.columns.length;r++)f.rows.length==0||f.rows.length==1?r==0?this.model.headerSettings.showColumnItems?this.element.find("[p='0,"+r+"']").html(t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML).addClass("headcol").addClass("headcol").addClass("colfirst").addClass("rowfirst"):this.element.find("[p='0,"+r+"']").html("").addClass("headcol").addClass("headcol").addClass("colfirst").addClass("rowfirst"):this.model.headerSettings.showColumnItems?this.element.find("[p='1,"+r+"']").before(t.buildTag("th.headrow rowfirst",t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='1,"+r+"']").before("<th class='headcol rowfirst'><\/th>"):r==0?this.model.headerSettings.showColumnItems?this.element.find("[p='"+f.rows.length+","+r+"']").before(t.buildTag("th.headcol colfirst",t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+r+"']").before("<th class='headcol colfirst'><\/th>"):(this.model.headerSettings.showColumnItems?this.element.find("[p='"+f.rows.length+","+r+"']").before(t.buildTag("th.headrow",t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+r+"']").before("<th class='headcol'><\/th>"),this.element.find("[p='0,0']").addClass("topele"));for(f.rows.length==0&&this.element.find("[p='1,"+f.columns.length+"']").before("<th class='headrow rowfirst'><\/th>"),r=0;r<f.rows.length;r++)f.columns.length==0?r==0?this.model.headerSettings.showRowItems?this.element.find("[p='0,"+r+"']").html(t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML).addClass("headrow").addClass("rowfirst").addClass("colfirst"):this.element.find("[p='0,"+r+"']").html("").addClass("headrow").addClass("rowfirst").addClass("colfirst"):this.model.headerSettings.showRowItems?this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before(t.buildTag("th.headrow colfirst",t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before("<th class='headrow colfirst'><\/th>"):r==0?this.model.headerSettings.showRowItems?this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before(t.buildTag("th.headrow rowfirst",t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before("<th class='headrow rowfirst'><\/th>"):(this.model.headerSettings.showRowItems?this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before(t.buildTag("th.headrow",t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before("<th class='headrow'><\/th>"),this.element.find("[p='0,0']").addClass("topele"));for(ot=this.element.find(".colHeadBtn"),st=this.element.find(".rowHeadBtn"),r=0;r<ot.length&&!this.model.enableCollapseByDefault;r++)n(ot[r]).css({width:this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?et[dt-1]:this.element.find("[p='"+(f.rows.length==0?0:f.rows.length-1)+","+(f.columns.length+1)+"']").width()});for(r=0;r<st.length&&!this.model.enableCollapseByDefault;r++)n(st[r]).css({width:this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?et[r]:this.element.find("[p='"+r+","+(f.columns.length+1)+"']").width()})}},_applyLocale:function(i){var c,o,u,s,h,f,v,y;if(this.model.dataSource.values.length!=0){for(c=!1,u=0;u<this.model.dataSource.values[0].measures.length;u++)if(this.model.dataSource.values[0].measures[u].format){c=!0;break}if(c)for(o=this._getAxis(),u=0;u<this.model.dataSource.values[0].measures.length;u++){var p=[],l=[],a=this.model.dataSource.values[0].measures[u].format,e;for(s=0;s<i.length;s++)l=this._getColumnIndices(o,i[s],this.model.dataSource.values[0].measures[u].fieldCaption,p);for(h=0;h<l.length;h++)for(f=0;f<i.length;f++)v=o=="rows"?i[f].Index.split(",")[1]:o=="columns"?i[f].Index.split(",")[0]:null,v==l[h]&&i[f].Value!=""&&(e=i[f].Value.replace(/[\s,%]/g,""),e=e.replace(t.preferredCulture(this.model.locale).numberFormat.currency.symbol,""),n.isNumeric(e)&&a!=r&&(y=t.olap.base._getFormatedValue(e,a),i[f].Value=y))}}},_renderPivotSchemaDesigner:function(){var r,i,u;n("#"+this.model.pivotTableFieldListID).length>0&&(r=n("#"+this.model.pivotTableFieldListID).data("ejPivotSchemaDesigner"),r!=null?(r.model.pivotControl=this,r.model.enableWrapper=!0,r._load(),this._waitingPopup&&this._waitingPopup.hide(),this._isSchemaInitialize=!1):(i=this,u=setInterval(function(){var r=n("#"+i.model.pivotTableFieldListID).data("ejPivotSchemaDesigner");r!=null&&(clearInterval(u),r.model.pivotControl=i,r.model.enableWrapper=!0,r._load(),i._waitingPopup&&i._waitingPopup.hide(),i._isSchemaInitialize=!1,t.isNullOrUndefined(r.model.pivotControl)||r.model.pivotControl.element.find(".colheader, .rowheader, .value").addClass("e-droppable"))},10)))},_renderFrozenGridTable:function(i,r,u){var b=n("<table class=\"pivotGridFrozenTable\" style='height:47px' ><\/table>"),y=n('<table class="pivotGridRowTable" ><\/table>'),f,e,c,l,w;frozenValTable=n('<table class="pivotGridValueTable" ><\/table>');tbodyFrozenCol=n("<tbody><\/tbody>");tbodyFrozenRow=n("<tbody><\/tbody>");tbodyFrozenVal=n("<tbody><\/tbody>");f=tRow1="<tr role='row'>";e=n("<div class='rowhead' style='position: relative; float: left;display: inline-block'>");n(tbodyFrozenCol).append(n(r).children());c=u.children().clone();l=u.children().clone();n(l).find(".value").remove();n(tbodyFrozenRow).append(n(l));n(y).append(tbodyFrozenRow);n(e).append(y);n(c).find(".rowheader, .summary:not(.summary.value)").remove();n(tbodyFrozenVal).append(n(c));var p=n(t.buildTag("div.colhead").css({position:"relative",overflow:"hidden"})[0].outerHTML),o=n(t.buildTag("div.colmovable")[0].outerHTML),s=n(t.buildTag("div.colfreeze").css({float:"left",height:"100%",visibility:this.model.enableGroupingBar?"visible":"hidden"})[0].outerHTML);n(p).append(n(b).append(tbodyFrozenCol));n(f).children().length==0&&(f=n("<tr role='row'><\/tr>"));n(f).length>0&&(n(o).append(p),n(s).append(n("<table id='colfretable' style='height:100%'><\/table>").append(f)));var a=n(t.buildTag("div#rowvaluecontent.valScrollArea")[0].outerHTML),h=n(t.buildTag("div.valueCell").css({position:"relative"})[0].outerHTML),v=n(t.buildTag("div.rowHeaderArea")[0].outerHTML);n(h).append(n(frozenValTable).append(tbodyFrozenVal));!this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders?(n(i).append("<tr><td style='padding:0px' colspan='2'><\/td><\/tr><tr><td style='padding:0px' colspan='2'><\/td><\/tr>"),n(i).find("tr:first td:eq(0)").append(n("<div id='headerContent' class='headerContent'><\/div>")),n(n(i).find("tr:last td:eq(0)")).append(n(a)),n(i).find(".headerContent").append(o),n(i).find(".headerContent .colhead").prepend(s),n(i).find(".headerContent .colhead").append("<div class='headerTable'/>"),n(i).find(".pivotGridFrozenTable").appendTo(n(i).find(".headerTable")),n(i).find(".valScrollArea").append(n(v)),n(i).find(".rowHeaderArea").append(e,h)):this.model.frozenHeaderSettings.enableFrozenRowHeaders&&!this.model.frozenHeaderSettings.enableFrozenColumnHeaders?(n(i).append("<tr ><td style='padding:0px;border-right:0px' ><\/td><td style='padding:0px;'><\/td><\/tr>"),n(i).find("tr:first td:eq(0)").append(n("<div id='headerContent' class='headerContent' style='position:relative'><\/div>")),n(i).find(".headerContent").append(s,e),n(i).find("tr td:last").append(n(a)),n(i).find(".valScrollArea").append(n(v)),n(i).find(".rowHeaderArea").append(o,h)):(n(i).append("<tr><td style='padding:0px'><\/td><td style='padding:0px;'><\/td><\/tr><tr><td style='padding:0px'><\/td><td style='padding:0px' class='valueArea'><\/td><\/tr>"),n(i).find("tr:first td:eq(0)").append(s),n(i).find("tr:first").children("td:eq(1)").append(o),n(i).find("tr:last td:eq(0)").append(n(v)),n(i).find(".rowHeaderArea").append(e),n(i).find(".valueArea").append(n(a)),n(i).find(".valScrollArea").append(h));this.model.enableGroupingBar?n(i).find(".grpRow").length>0&&n(i).find(".grpRow").appendTo(n(i).find(".colfreeze table tr:eq(0)")):(n(i).find("[p='0,0']").length>0||n(i).find("[p='-1,-1']").length>0)&&(w=n(i).find("[p='-1,-1']").length>0?"-1,-1":"0,0",n(i).find("[p='"+w+"']").appendTo(n(i).find(".colfreeze table tr:eq(0)")))},_applyFrozenHeaderWidth:function(i){var r,o,e,f,l,u,s;if(i.length>0){r=this.element;o=this.element.find(".e-scroller").data("ejScroller");o&&(o.destroy(),n(this.element).css("overflow",""),n(r).find(".headerTable").css("display","initial"),n(r).find(".valScrollArea").css("height",""),n(r).find(".pivotGridRowTable, .pivotGridValueTable , .pivotGridFrozenTable").removeClass("frozenTableLayout"),n(r).find(".pivotGridRowTable, .pivotGridValueTable , .pivotGridFrozenTable").removeAttr("style"));n(r).find(".pivotGridFrozenTable colgroup, .pivotGridValueTable colgroup").remove();var h=n("<colgroup><\/colgroup>"),a=n(r).find(".pivotGridFrozenTable"),c=n(r).find(".pivotGridRowTable tr:visible").index();if(c>-1){for(e=n(r).find(".pivotGridValueTable tr:eq("+c+") td"),f=0;f<e.length;f++)l=n(e[f]).attr("p").split(",")[0],u=a.find("[p^='"+l+",']"),u=t.isNullOrUndefined(u.last().attr("colSpan"))||u.last().attr("colSpan")=="1"?n(u).last():u[u.length-2],n(e[f]).is(":visible")&&h.append("<col width ="+Math.max(n(u).outerWidth(),n(e[f]).outerWidth())+"px'>");this.element.find(".pivotGridFrozenTable, .pivotGridValueTable").append(h);this.model.enableColumnGrandTotal||(s=parseInt(n(r).find(".pivotGridFrozenTable tr:first td:last").attr("colspan")),n(r).find(".pivotGridFrozenTable colgroup col").slice(-s).remove(),n(r).find(".pivotGridValueTable colgroup col").slice(-s).remove());this._refreshScroller()}else this._refreshScroller()}},_refreshScroller:function(){var c,l,e,o;if(this.element.find(".pivotGridValueTable .value:visible").length>0){var a=this.element.find(".pivotGridFrozenTable"),s=this.element.find(".pivotGridRowTable"),h=this.element.find(".pivotGridValueTable"),v=this.element.find(".rowhead"),f=this.element.find(".valueCell"),i=t.isNullOrUndefined(this.model.frozenHeaderSettings.scrollerSize)?18:this.model.frozenHeaderSettings.scrollerSize;if(n(a).height(this.element.find(".colfreeze").height()),!this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders){if(this.element.find(".colfreeze").css({height:n(a).height(),width:n(s).width()}),n(f).css({display:"inline-block",width:this.element.width()-n(s).width()}),this.element.find(".headerTable").css({display:"inline-block",width:n(f).width()}),this.element.find(".pivotGridValueTable, .pivotGridFrozenTable").addClass("frozenTableLayout"),this.element.find(".headerContent, .colmovable").addClass("frozenStyle"),this.element.find(".headerContent").css({width:this.element.width(),height:this.element.find(".headerTable").height()}),c=0,l=0,n(h).height()>0){var y=this.model.enableGroupingBar?this.element.find(".groupingBarPivot").height():0,p=this.element.find(".headerContent").height(),w=n(f).height(),e=p+w+y,o=this.element.height(),r=n(h).width()+n(s).width(),u=this.element.find(".pivotGridTable").width();c=(o>e?e:o)-p-y;l=u>r?r:u}this.element.find(".valScrollArea").ejScroller({scrollerSize:i,width:l,height:c,targetControl:this,enableRTL:this.model.enableRTL,scroll:this._applyScroll});this.element.find(".e-vscrollbar").length>0&&(this.element.find(".headerContent").width(this.element.find(".headerContent").width()-i),n(f).width(n(f).width()-i),this.element.find(".headerContent").addClass("frozenColHeaderArea"))}else if(this.model.frozenHeaderSettings.enableFrozenRowHeaders&&!this.model.frozenHeaderSettings.enableFrozenColumnHeaders){var y=this.model.enableGroupingBar?this.element.find(".groupingBarPivot").height():0,c=0,l=0;if(this.element.find(".pivotGridValueTable, .pivotGridFrozenTable"+(this.model.enableGroupingBar?", .pivotGridRowTable":"")).addClass("frozenTableLayout"),this.element.find(".colfreeze").height(n(a).height()),this.element.find(".colhead").css("overflow","visible"),n(h).height()>0){var e=this.element.height(),o=this.element.find(".rowHeaderArea").height(),r=this.element.width()-this.element.find(".headerContent").width(),u=n(h).width();l=u>r?r:u;c=(o>e?e:o)-y+(u>r?i:0)}this.element.find(".valScrollArea").ejScroller({scroll:this._applyScroll,width:l,height:c,targetControl:this,enableRTL:this.model.enableRTL,scrollerSize:i});this.model.enableGroupingBar||this.element.find(".pivotGridRowTable").addClass("frozenTableLayout");this.element.find(".headerContent").css({height:this.element.find(".valScrollArea").height(),overflow:"hidden"});n(v).css("padding-bottom",this.element.find(".valScrollArea .e-hscrollbar").length>0?i:"0px")}else{this.model.enableGroupingBar&&this._setGroupingBarFrozenRowBtnWidth();e=this.element.height()-(this.element.find(".colhead").height()+(this.model.enableGroupingBar?this.element.find(".groupingBarPivot").height():0));o=n(h).height();n(v).css({overflow:"hidden",width:n(s).width()-3,height:o>e?e:o});this.element.find(".colfreeze").width(n(s).width()-3);this.element.find(".pivotGridFrozenTable, .pivotGridValueTable, .pivotGridRowTable").addClass("frozenTableLayout");var r=this.element.width()-n(s).width(),u=n(h).width(),l=u>r?r:u,c=n(v).height()+(u>r?i:0);this.element.find(".valScrollArea").ejScroller({scroll:this._applyScroll,width:l,height:c,targetControl:this,scrollerSize:i});n(v).height(n(f).height());this.element.find(".colmovable").width(n(f).width());this.element.find(".e-vscrollbar").length>0?this.element.find(".colmovable").addClass("frozenColHeaderArea"):this.element.find(".colmovable").removeClass("frozenColHeaderArea");n(v).css("padding-bottom",this.element.find(".valScrollArea .e-hscrollbar").length>0?i:"0px");this.element.find(".colhead , .colfreeze").height(n(a).height());n(a).height("100%");this.model.enableGroupingBar||this.element.find(".pivotGridRowTable").addClass("frozenTableLayout")}this.model.enableGroupingBar&&this._refreshGroupingBarLayout();this.element.find(".pivotGridFrozenTable tr:first td").css("border-top","0px");this.element.find(".pivotGridRowTable tr td:first-child").css(this.model.enableRTL?"border-right":"border-left","0px");this.element.find(".pivotGridRowTable tr td:last-child").css(this.model.enableRTL?"border-left":"border-right","0px");this.element.find(".pivotGridFrozenTable tr:last td").css("border-bottom","0px");!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders?(this.element.find(".pivotGridFrozenTable tr td:first-child").css(this.model.enableRTL?"border-right":"border-left","0px"),this.element.find(".pivotGridValueTable tr:last td").css("border-bottom","0px"),this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p")&&this.element.find(".pivotGridValueTable tr td[p^='"+this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p").split(",")[0]+",']").css(this.model.enableRTL?"border-right":"border-left","0")):this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders?(this.element.find(".pivotGridRowTable tr:eq(0) td").css("border-top","0px"),this.element.find(".pivotGridValueTable tr:eq(0) td").css("border-top","0px")):(this.element.find(".pivotGridFrozenTable tr td:first-child").css(this.model.enableRTL?"border-right":"border-left","0px"),this.element.find(".pivotGridValueTable tr:last td").css("border-bottom","0px"),this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p")&&this.element.find(".pivotGridValueTable tr td[p^='"+this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p").split(",")[0]+",']").css(this.model.enableRTL?"border-right":"border-left","0"),this.element.find(".pivotGridRowTable tr:eq(0) td").css("border-top","0px"),this.element.find(".pivotGridValueTable tr:eq(0) td").css("border-top","0px"))}else this.model.enableGroupingBar&&this._refreshGroupingBarLayout(),n(this.element).css("overflow","auto"),this.element.find(".headerTable").css("display","inline-block"),this.element.find(".valScrollArea").css("height","100%")},_applyScroll:function(){this.model.targetControl.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.targetControl.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.targetControl.model.frozenHeaderSettings.enableFrozenHeaders&&!this.model.targetControl.model.frozenHeaderSettings.enableFrozenRowHeaders&&!this.model.targetControl.model.frozenHeaderSettings.enableFrozenColumnHeaders?(this.isVScroll()&&this.model.targetControl.element.find(".rowhead").scrollTop(this.model.scrollTop),this.isHScroll()&&this.model.targetControl.element.find(".colhead").scrollLeft(this.model.scrollLeft)):!this.model.targetControl.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.targetControl.model.frozenHeaderSettings.enableFrozenColumnHeaders?this.isHScroll()&&this.model.targetControl.element.find(".colhead").scrollLeft(this.model.scrollLeft):this.isVScroll()&&this.model.targetControl.element.find(".headerContent").scrollTop(this.model.scrollTop)},_setGroupingBarFrozenRowBtnWidth:function(){var r,u,f;(this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders&&!(this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders))&&this.element.find(".pivotGridRowTable").outerWidth()>=this.element.find(".grpRow").outerWidth()&&this.element.find(".pivotGridRowTable").css("min-width",this.element.find(".grpRow").outerWidth());this.element.find(".grpRow .removeBtn, .grpRow .filter, .grpRow .sorting ").css("position","inherit");this.element.find(".colfreeze .pivotButton").width("auto");var t=this.element.find(".pivotGridRowTable").width(),i=this.element.find(".colfreeze .pivotButton"),n=t/i.length;t<n&&(n=t-40);this.element.find(".rows").width()>t&&(r=n*i.length,n>50&&r>140?(this.element.find(".rows .pivotButton").width(n-5),this.element.find(".rows .pvtBtn").css({width:n-37,"text-overflow":"ellipsis"})):(this.element.find(".rows .pivotButton").width(50),this.element.find(".rows .pvtBtn").css({width:20,"text-overflow":"ellipsis"})),u=this.element.find(".colfreeze .pivotButton:eq(0)").outerWidth(),f=u*i.length+30,this.element.find(".rowHead").width(f))},_refreshGroupingBarLayout:function(){n(".pivotGridTable .value").length>0||n(".pivotGridTable .colheader").length>0?this.element.find(".groupingBarPivot ").width(this.element.find(".pivotGridTable").width()):this.element.find(".pivotGridRowTable").length>0?this.element.find(".groupingBarPivot ").width(this.element.find(".pivotGridRowTable").width()+140):this.element.find(".groupingBarPivot ").width(330);var t=this.element.find(".pivotGridRowTable").width();this.element.find(".grpRow ,.values").width(t);this.element.find(".columns").css({height:"auto",width:this.element.find(".valueColumn").width()-this.element.find(".values").width()-1});this._setGroupingBarFrozenRowBtnWidth()},_cellRangeInfo:function(i){var a=n(i.target).parents(".e-pivotgrid").data("ejPivotGrid"),k,c,l,f,s,e,r,y,b;n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(this._dataSet=this._pivotClientObj.dataSet);n(i.target).hasClass("cellValue")&&(i.target=i.target.parentElement);var d=n("thead tr").length,h=[],p=0,u=n.grep(this.getJSONRecords(),function(t){return(t.CSS=="colheader"||t.CSS=="summary"||t.CSS==" calc")&&t.Index.split(",")[0]==n(i.target).attr("p").split(",")[0]}),o=n.grep(this.getJSONRecords(),function(t){return(t.CSS=="rowheader"||t.CSS=="summary"||t.CSS=="summary rstot")&&t.Index.split(",")[1]==n(i.target).attr("p").split(",")[1]});if(o.length==1&&u.length==1&&(o[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0||u[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0||u[0].CSS==" calc"))if(k=[],(u[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0||u[0].CSS==" calc")&&o[0].Value.toString().indexOf("Grand")>=0)for(r=0;r<this.model.dataSource.data.length;r++)h[r]=this.model.dataSource.data[r];else for(o[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0?c=u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0?u[0].Value.replace(" "+this._getLocalizedLabels("Total"),""):u[0].Value:(u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0||u[0].CSS==" calc")&&(c=o[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0?o[0].Value.replace(" "+this._getLocalizedLabels("Total"),""):o[0].Value),r=0;r<a.model.dataSource.data.length;r++)n.each(a.model.dataSource.data[r],function(n,t){t==c&&(h[p]=a.model.dataSource.data[r],p++)});else if(o.length>=1&&u.length>=1&&(o[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0||u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0)){for(o[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0?(c=u,l=o):u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0&&(c=o,l=u),f=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.model.dataSource.data:this._dataSet.length>0?JSON.parse(this._dataSet):[],s=c.length-1;s>=0;s--){for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==c[s].Value&&e.push(f[r])});f=e}if(h=e,l[0].Value.toString().indexOf("Grand")<=0)for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==l[0].Value.replace(" Total","")&&(h=[],e.push(f[r]))});h=h.length==0?e:h}else{var w=o,v=u,f=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.model.dataSource.data:this._dataSet.length>0?JSON.parse(this._dataSet):[];for(s=w.length-1;s>=0;s--){for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==w[s].Value&&e.push(f[r])});f=e}for(s=v.length-1;s>=0;s--)if(v[s].CSS.indexOf("calc")==-1){for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==v[s].Value&&e.push(f[r])});f=e}h=h.length==0?e:h}y={selectedData:h,element:this.element,customObject:this.model.customObject};this.model.enableCellDoubleClick&&this.model.enableCellDoubleClick!=null&&this._trigger("cellDoubleClick",y);(this.model.enableDrillThrough||n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough)&&h.length>0&&(b=n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough?this._pivotClientObj:this);b._trigger("drillThrough",y)},_initCellEditing:function(i){if(i.target.tagName=="INPUT"||n(i.target).hasClass("summary")||n(i.target).parent().hasClass("summary"))this._off(this.element,"mouseup",".value",this._completeCellEditing);else{this._on(this.element,"mouseup",".value",this._completeCellEditing);var r;_oriX=i.pageX;_oriY=i.pageY;r=i.target||window.event.srcElement;n(r).hasClass("cellValue")&&(r=n(r).parent()[0]);n(".value").addClass("selection");n("#"+this._id).append(t.buildTag("div.cellSelection#"+this._id+"_cellSelection","",{}));_startPosCell=n(r)[0].attributes.getNamedItem("p").value;this._on(this.element,"mousemove",".value, .cellSelection",this._cellSelection)}},_completeCellEditing:function(i){var a,l,w=[],s,y,h,rt,e,o,g,p,v,f,c,u,tt,it;if(i.target.tagName!="INPUT"){if(this._off(this.element,"mousemove",".value"),n(".value").removeClass("selection"),a=i.target||window.event.srcElement,n(a).hasClass("cellValue")&&(a=n(a).parent()[0]),l=n(a)[0].attributes.getNamedItem("p").value,h=0,rt=this.element.find(".curInput"),rt.length>0)return n(a).find(".curInput").length==0&&this._updateTableCell(),n("#"+this._id+"_cellSelection").remove(),this.model.enableToolTip&&this._on(this.element,"mousemove",".value",this._applyToolTip),this._off(this.element,"mouseup",".value"),!1;for(e=parseInt(_startPosCell.split(",")[1])<parseInt(l.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(l.split(",")[1]);e<=(parseInt(_startPosCell.split(",")[1])>parseInt(l.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(l.split(",")[1]));e++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("td[p*=',"+e+"']").parent().is(":visible"))for(o=parseInt(_startPosCell.split(",")[0])<parseInt(l.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(l.split(",")[0]);o<=(parseInt(_startPosCell.split(",")[0])>parseInt(l.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(l.split(",")[0]));o++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("[p*='"+o+",']").last("th").is(":Visible")||!this.model.enableGrandTotal||!this.model.enableRowGrandTotal){w[h]=this.getJSONRecords()[o*this._rowCount+e];n("[p='"+o+","+e+"']").hasClass("summary")||(n("[p='"+o+","+e+"'] span.cellValue").length>0?(g=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?n("[p='"+o+","+e+"'] span.cellValue").text()!=""?n("[p='"+o+","+e+"'] span.cellValue").text():n(".curInput").val():n("[p='"+o+","+e+"'] span.cellValue").text(),n("[p='"+o+","+e+"'] span.cellValue").html("<input type='text' class='curInput' value='"+g+"' />")):n("[p='"+o+","+e+"']").children().length>0?n("[p='"+o+","+e+"']").append("<input type='text' class='curInput' value='' />"):(g=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?n("[p='"+o+","+e+"']").text()!=""?n("[p='"+o+","+e+"']").text():n(".curInput").val():n("[p='"+o+","+e+"']").text(),n("[p='"+o+","+e+"']").html("<input type='text' class='curInput' value='"+g+"' />")));var b,k="",et,ot,ut=0;if(s=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?this.element.find(".summary[role!='gridcell'][p$=',"+n(a).attr("p").split(",")[1]+"'] , .rowheader[role!='gridcell'][p$=',"+n(a).attr("p").split(",")[1]+"']").last().attr("p"):this.element.find(".summary[role!='gridcell'][p$=',"+e+"'] , .rowheader[role!='gridcell'][p$=',"+e+"']").last().attr("p"),s==r&&(s=n("#"+this._id).find("tbody").find('[p="'+o+","+e+'"]').parent("tr").find(".summary").first().attr("p")),et=s,s!=null){while(s[0]>=0)s==this.getJSONRecords()[parseInt(parseInt(s.split(",")[0])*this._rowCount+parseInt(s.split(",")[1]))].Index&&(b=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.getJSONRecords()[parseInt(parseInt(s.split(",")[0])*this._rowCount+parseInt(s.split(",")[1]))].Info.split("::")[0]:this.getJSONRecords()[parseInt(parseInt(s.split(",")[0])*this._rowCount+parseInt(s.split(",")[1]))].Value,s=parseInt(s.split(",")[0])-1+","+parseInt(s.split(",")[1])),k&&b!=""?k=b+"#"+k:b!=""&&(k=b);if(this._rowHeader[h]=k,f=this._rowHeader[h].toString().split("#"),f.length>1){for(u=0;u<f.length-1;u++)for(c=0;c<f[u].split(".").length;c++)if(f[u].split(".")[c]==f[u+1].split(".")[c]&&f[u].split(".")[c+1]==f[u+1].split(".")[c+1]){f.splice(u,1);break}for(this._rowHeader[h]="",u=0;u<f.length;u++)this._rowHeader[h]+=this._rowHeader[h]==""?f[u]:"#"+f[u]}}var d="",nt,st=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ft=this.element.find((st?".pivotGridFrozenTable ":"")+'tr:has(".colheader")').length-1;for(ot=ft,y=w[h].Index,y!=r&&y==this.getJSONRecords()[parseInt(parseInt(y.split(",")[0])*this._rowCount+parseInt(y.split(",")[1]))].Index&&(p=parseInt(y.split(",")[0])),v=0;v<=ft;v++)p!=null&&p+","+v==this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+v)].Index&&(nt=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+v)].Info.split("::")[0]:this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+v)].Value,d==""?d=nt:nt!=""&&(d=d+"#"+nt)),this._colHeader[h]=d;if(f=this._colHeader[h].split("#"),f.length>1){for(u=0;u<f.length-1;u++)for(c=0;c<f[u].split(".").length;c++)if(f[u].split(".")[c]==f[u+1].split(".")[c]&&f[u].split(".")[c+1]==f[u+1].split(".")[c+1]){f.splice(u,1);break}for(this._colHeader[h]="",u=0;u<f.length;u++)this._colHeader[h]+=this._colHeader[h]==""?f[u]:"#"+f[u]}h++}for(this._originalValue="",this._cellInfo=w,tt=0;tt<this.element.find(".curInput").length;tt++)it=this.element.find(".curInput")[tt],this._originalValue+=this._originalValue==""?it.value:"#"+it.value;args={JSONRecords:w,rowHeader:this._rowHeader,columnHeader:this._colHeader,measureCount:ut>0?"Row:"+ut:"Column:0"};this._trigger("cellSelection",args);w=rowHeader=colHeader=[];n("#"+this._id+"_cellSelection").remove();this.model.enableToolTip&&this._on(this.element,"mousemove",".value",this._applyToolTip);this._off(this.element,"mouseup",".value")}n(".curInput").keypress(function(t){if(t.which==13){var i=n(t.target).parents(".e-pivotgrid").data("ejPivotGrid");i._updateTableCell()}})},_updateTableCell:function(){var r="",f="",e=n(".curInput"),u,l,k,s,y,i;n.each(e,function(n,t){r+=r==""?t.value:"#"+t.value});var p=[],h=this._rowHeader,c=this._colHeader;for(f=r.split("#"),u=f.length-1;u>=0;u--)f[u]==this._originalValue.split("#")[u]?(h.splice(u,1),c.splice(u,1),f.splice(u,1),this._cellInfo.splice(u,1)):(p.push(this._originalValue.split("#")[u]),this._cellInfo[u].Value=f[u]=f[u]==""?"0":f[u]);for(p=p.reverse(),r="",i=0;i<f.length;i++)r+=r==""?f[i]:"#"+f[i];if(r.length==0){for(i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(n(".curInput")[i].value);return!1}if(this._waitingPopup.show(),this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)try{l=JSON.parse(this.getOlapReport()).Report}catch(g){l=this.getOlapReport()}if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){(t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)||this.model.editCellsInfo.JSONRecords.length==0)&&(this.model.editCellsInfo={JSONRecords:[],rowHeader:[],columnHeader:[]});var d=this.model.editCellsInfo.rowHeader,o=this.model.editCellsInfo.columnHeader,w=this.model.editCellsInfo.JSONRecords,b=this._cellInfo;for(uV=0;uV<b.length;uV++){for(k=0,s=0;s<w.length;s++)if(d[s]==h[uV]&&o[s]==c[uV]){w[s].Value=b[uV].Value;k++;break}k==0&&(d.push(h[uV]),o.push(c[uV]),w.push(b[uV]))}if(this._trigger("cellEdit",{editCellsInfo:this.model.editCellsInfo}),!t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)&&this.model.editCellsInfo.JSONRecords.length>0)if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){var r="",a="",v="";for(n.each(this.model.editCellsInfo.JSONRecords,function(n,t){r=r==""?t.Value:r+":"+t.Value;a=a==""?t.Index:a+":"+t.Index;v=v==""?o[n].toString().split("#")[o[n].toString().split("#").length-1]:v+":"+o[n].toString().split("#")[o[n].toString().split("#").length-1]}),y=JSON.stringify({action:"cellEditing",index:a,valueHeaders:v,summaryValues:r,currentReport:l,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:JSON.stringify(this.model.customObject)}),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.cellEditing,y,this._renderControlSuccess),i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(n(e[i]).val())}else this._populatePivotGrid();else{for(i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(t.isNullOrUndefined(this._originalValue.split("#")[i])?"":this._originalValue.split("#")[i]);this._waitingPopup.hide()}}else if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)if(this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"writeBack",element:this.element}),this.model.editCellsInfo.JSONRecords=this._cellInfo,this.model.editCellsInfo.rowHeader=h,this.model.editCellsInfo.columnHeader=c,this._trigger("cellEdit",{editCellsInfo:this.model.editCellsInfo}),r="",!t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)&&this.model.editCellsInfo.JSONRecords.length>0&&n.each(this.model.editCellsInfo.JSONRecords,function(n,t){r=r==""?t.Value:r+":"+t.Value}),y=JSON.stringify({action:"writeBack",value:r,rowUniqueName:JSON.stringify(this.model.editCellsInfo.rowHeader),columnUniqueName:JSON.stringify(this.model.editCellsInfo.columnHeader),currentReport:l,customObject:JSON.stringify(this.model.customObject)}),!t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)&&this.model.editCellsInfo.JSONRecords.length>0)this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.writeBack,y,this._renderControlSuccess);else{for(i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(t.isNullOrUndefined(this._originalValue.split("#")[i])?"":this._originalValue.split("#")[i]);this._waitingPopup.hide()}this._rowHeader=[];this._colHeader=[]},_createVirtualPivotGrid:function(n){var u=this._seriesPageCount>1?t.buildTag("div.vScrollPanel")[0].outerHTML:"",f=this._categPageCount>1?t.buildTag("div.hScrollPanel")[0].outerHTML:"",e=t.buildTag("td.virtualScrollGrid",n[0].outerHTML)[0],o=t.buildTag("td.virtualScrollElement",u),s=t.buildTag("td.virtualScrollElement",f),h=t.buildTag("tr.virtualScrollElement",e.outerHTML+o[0].outerHTML),c=t.buildTag("tr.virtualScrollElement",s[0].outerHTML+t.buildTag("td.virtualScrollElement")[0].outerHTML),l=t.buildTag("tbody.oGridOuterDiv.virtualScrollElement",h[0].outerHTML+c[0].outerHTML),i,r;this.element.html(t.buildTag("table.virtualScrollElement",l[0].outerHTML));i=t.buildTag("div.seriesPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("SeriesPage"))[0].outerHTML+t.buildTag("span.series_CurrentPage",this._seriesCurrentPage)[0].outerHTML+" / "+t.buildTag("span.series_pageCount",this._seriesPageCount)[0].outerHTML)[0].outerHTML;this._seriesPageCount>1&&this.element.append(i);r=t.buildTag("div.categPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("CategoricalPage"))[0].outerHTML+t.buildTag("span.categ_CurrentPage",this._categCurrentPage)[0].outerHTML+" / "+t.buildTag("span.categ_pageCount",this._categPageCount)[0].outerHTML)[0].outerHTML;this._categPageCount>1&&this.element.append(r)}});t.PivotGrid.Layout={Normal:"normal",NormalTopSummary:"normaltopsummary",NoSummaries:"nosummaries",ExcelLikeLayout:"excellikelayout"};t.PivotGrid.Locale={};t.PivotGrid.Locale["en-US"]={Sort:"Sort",Search:"Search",SelectField:"select Field",LabelFilterLabel:"Show the items for which the label",ValueFilterLabel:"Show the items for which",ClearSorting:"Clear Sorting",ClearFilterFrom:"Clear Filter From",SortAtoZ:"Sort A to Z",SortZtoA:"Sort Z to A",and:"and",LabelFilters:"Label Filters ",BeginsWith:"Begins With",DoesNotBeginsWith:"Does Not Begins With",EndsWith:"Ends With",NotEndsWith:"Not Ends With",DoesNotEndsWith:"Does Not End With",Contains:"Contains",DoesNotContains:"Does Not Contain",ValueFilters:"Value Filters",ClearFilter:"Clear Filter",Equals:"Equals",DoesNotEquals:"Does Not Equal",NotEquals:"Not Equals",GreaterThan:"Greater Than",IsGreaterThan:"Is Greater Than",IsGreaterThanOrEqualTo:"Is Greater Than Or Equal To",IsLessThan:"Is Less Than",IsLessThanOrEqualTo:"Is Less Than Or Equal To",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between",Top10:"Top Count",AddToFilter:"Add to Filter",AddToRow:"Add to Row",AddToColumn:"Add to Column",AddToValues:"Add to Values",Warning:"Warning",Error:"Error",GroupingBarAlertMsg:"The field you are moving cannot be placed in that area of the report",Measures:"Measures",Expand:"Expand",Collapse:"Collapse",ToolTipRow:"Row",ToolTipColumn:"Column",ToolTipValue:"Value",NoValue:"No value",SeriesPage:"Series Page",CategoricalPage:"Categorical Page",DragFieldHere:"Drag field here",ColumnArea:"Drop column here",RowArea:"Drop row here",ValueArea:"Drop values here",Close:"Close",OK:"OK",Cancel:"Cancel",Remove:"Remove",Goal:"Goal",Status:"Status",Trend:"Trend",Value:"value",ConditionalFormattingErrorMsg:"The given value is not matched",ConditionalFormattingConformMsg:"Are you sure you want to remove the selected format?",EnterOperand1:"Enter Operand1",EnterOperand2:"Enter Operand2",ConditionalFormatting:"Conditional Formatting",Condition:"Conditional Type",Value1:"Value1",Value2:"Value2",Editcondtion:"Edit Condition",AddNew:"Add New",Format:"Format",Backcolor:"Back Color",Borderrange:"Border Range",Borderstyle:"Border Style",Fontsize:"Font Size",Fontstyle:"Font Style",Bordercolor:"Border Color",NoMeasure:"Please add any measure",AliceBlue:"AliceBlue",Black:"Black",Blue:"Blue",Brown:"Brown",Gold:"Gold",Green:"Green",Lime:"Lime",Maroon:"Maroon",Orange:"Orange",Pink:"Pink",Red:"Red",Violet:"Violet",White:"White",Yellow:"Yellow",Solid:"Solid",Dashed:"Dashed",Dotted:"Dotted",Double:"Double",Groove:"Groove",Inset:"Inset",Outset:"Outset",Ridge:"Ridge",None:"None",Algerian:"Algerian",Arial:"Arial",BodoniMT:"Bodoni MT",BritannicBold:"Britannic Bold",Cambria:"Cambria",Calibri:"Calibri",CourierNew:"Courier New",DejaVuSans:"DejaVu Sans",Forte:"Forte",Gerogia:"Gerogia",Impact:"Impact",SegoeUI:"Segoe UI",Tahoma:"Tahoma",TimesNewRoman:"Times New Roman",Verdana:"Verdana",CubeDimensionBrowser:"Cube Dimension Browser",SelectHierarchy:"Select Hierarchy",CalculatedField:"Calculated Field",Name:"Name:",Add:"Add",Formula:"Formula:",Delete:"Delete",Fields:"Fields:",MultipleItems:"Multiple items",All:"All",CalculatedFieldNameNotFound:"Given CalculatedField name is not found",InsertField:"Insert Field",EmptyField:"Please enter Calculated field name or formula",NotValid:"Given formula is not valid",NotPresent:"Value field used in any of the Calculated Field formula is not present in the PivotGrid",Confirm:"Calculated field with the same name already exists. Due to want to Replace ?",CalcValue:"Calculated field can be inserted only in value area field",NoRecordsToDisplay:"No records to display.",NumberFormatting:"Number Formatting",FrozenHeaders:"Frozen Headers",CellSelection:"Cell Selection",CellContext:"Cell Context",ColumnResize:"Column Resize",Layouts:"Layouts",ExcelLikeLayout:"Excel Like Layout",NormalLayout:"Normal Layout",NormalTopSummary:"NormalTopSummary Layout",NoSummaries:"NoSummaries Layout",FrozenHeader:"Frozen Header",AdvancedFiltering:"Advanced Filtering",Amount:"Amount",Quantity:"Quantity",Measures:"Measures",NumberFormats:"Number Formats",Exporting:"Exporting",FileName:"File Name",ToolTip:"Tool Tip",RTL:"RTL",CollapseByDefault:"Collapse By Default",EnableDisablePaging:"Enalbe / Disable Paging",PagingOptions:"Paging Options",CategoricalPageSize:"Categorical Page Size",SeriesPageSize:"Series Page Size",HyperLink:"HyperLink",CellEditing:"Cell Editing",GroupingBar:"Grouping Bar",SummaryCustomization:"Summary Customization",SummaryTypes:"Summary Types",SummaryType:"Summary Type",EnableRowHeaderHyperlink:"Enable RowHeaderHyperLink",EnableColumnHeaderHyperlink:"Enable ColumnHeaderHyperLink",EnableValueCellHyperlink:"Enable ValueCellHyperLink",EnableSummaryCellHyperlink:"Enable SummaryCellHyperLink",HideGrandTotal:"Hide GrandTotal",HideSubTotal:"Hide SubTotal",Row:"Row",Column:"Column",Both:"Both",Sum:"Sum",Average:"Average",Count:"Count",Min:"Min",Max:"Max",Excel:"Excel",Word:"Word",PDF:"PDF",CSV:"CSV",Total:"Total",GrandTotal:"Grand Total",DrillThrough:"Drill Through",EnabledState:"Enabled State"};t.PivotGrid.ExportOptions={Excel:"excel",Word:"word",PDF:"pdf",CSV:"csv"};t.PivotGrid.ConditionalOptions={Equals:"Equals",NotEquals:"Not Equals",GreaterThan:"Greater Than",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between"};t.PivotGrid.AnalysisMode={Olap:"olap",Relational:"relational"};t.PivotGrid.ExportMode={JSON:"json",PivotEngine:"pivotengine"};t.PivotGrid.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"};t.olap.base&&n.extend(t.PivotGrid.prototype,t.olap.base);t.olap._mdxParser&&n.extend(t.PivotGrid.prototype,t.olap._mdxParser)}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotSchemaDesigner","ej.PivotSchemaDesigner",{_rootCSS:"e-pivotschemadesigner",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:{url:"",cssClass:"",height:n(this.element).parents(".e-pivotclient").length>0?"":"630px",width:"415px",locale:"en-US",layout:"excel",enableRTL:!1,pivotControl:null,pivotTableFields:[],pivotCalculations:[],pivotColumns:[],pivotRows:[],filters:[],olap:{showKpi:!1,showNamedSets:!1},enableWrapper:!1,enableDragDrop:!0,serviceMethods:{fetchMembers:"FetchMembers",nodeStateModified:"NodeStateModified",nodeDropped:"NodeDropped",removeButton:"RemoveButton",memberExpand:"MemberExpanded",filtering:"filtering",sorting:"sorting"},customObject:{},beforeServiceInvoke:null,afterServiceInvoke:null,dragMove:null,applyFieldCaption:null},dataTypes:{serviceMethods:"data",customObject:"data",pivotControl:"data",pivotTableFieldList:"array",pivotCalculationList:"array",pivotColumnList:"array",pivotRowList:"array",filterList:"array"},locale:t.util.valueFunction("locale"),_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this.element.empty().removeClass("e-pivotschemadesigner"+this.model.cssClass)},_initPrivateProperties:function(){this._id=this.element.attr("id");this._dialogTitle="";this._currentMembers=[];this._memberTreeObj=null;this._tableTreeObj=null;this._dialogOKBtnObj=null;this._curFilteredText="";this._curFilteredAxis="";this._tempFilterData=null;this._droppedClass="";this._selectedTreeNode=null;this._selectedMember="";this._selectedLevel="";this._isDragging=!1;this._dataModel="";this._droppedPosition="";this._currentCubeName="";this._errorDialog="";this._nodeDropedParams="";this._contextMenuObj=null;this._removeButtonDeferUpdate=!1;this._isMeasureBtnRemove=!1;this._nodeCheck=!1;this._isFiltered=!1;this._curFocus={tree:null,node:null,tab:null,button:null};this._index={tree:0,node:0,tab:0,button:0};this._selectedFieldName="";this._selectedFieldCaption="";this._selectedFieldAxis="";this._isDropAction=!1;this._ascdes="";this._pivotClientObj=null},_load:function(){var u="",r,e,o,f,s;this.model.pivotControl!=null&&(this.model.pivotControl._schemaData=this,n(this.element).parents(".e-pivotclient").length>0&&(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient")),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(u=JSON.parse(JSON.parse(this.model.pivotControl.getOlapReport()).ItemsProperties),r=JSON.parse(this.model.pivotControl.getOlapReport()),this.model.pivotControl._dataModel=="Pivot"?(r=this.model.pivotControl._filterReport(r),e=r.PivotRows.concat(r.PivotColumns,r.PivotCalculations,r.Filters),o=n.grep(u,function(t){return n.grep(e,function(n){t.id==(n.FieldHeader||n.DimensionHeader)&&(t.id=n.FieldName||n.DimensionName)}),t}),this._setTableFields(o)):this._setTableFields(u),this._setPivotRows(r.PivotRows),this._setPivotColumns(r.PivotColumns),this._setPivotCalculations(r.PivotCalculations),this._setFilters(r.Filters),this._dataModel=r.DataModel,this._currentCubeName=r.CurrentCube):(r=this.model.pivotControl.model.dataSource,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.pivotTableFields=t.PivotAnalysis.getTreeViewData(this.model.pivotControl.model.dataSource))),this.model._waitingPopup?this._waitingPopup=this.model._waitingPopup:(n("#"+this._id).ejWaitingPopup({showOnInit:!0}),this._waitingPopup=n("#"+this._id).data("ejWaitingPopup")),this.element.width(this.model.width).height(this.model.height),pschemaDesignerWaitingPopup=this._waitingPopup,this._waitingPopup.show());this.model.enableWrapper?(this.element.show(),this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._refreshPivotButtons():(this._setFilters(r.Filters),this._refreshPivotButtons(),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.element.append(t.buildTag("div.deferUpdateLayout",t.buildTag("input.chkDeferUpdate","",{}).attr("type","checkbox")[0].outerHTML+t.buildTag("button.btnDeferUpdate",this._getLocalizedLabels("Update"),{}).attr("type","button")[0].outerHTML)[0].outerHTML),this.model.pivotControl!=null&&this.model.enableDragDrop&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)})),this._reSizeHandler()):(f=(this.model.layout=="onebyone"?"":t.buildTag("table.headerTable",t.buildTag("tr",t.buildTag("td",t.buildTag("div.listHeader",t.buildTag("span.headerText",this._getLocalizedLabels("PivotTableFieldList"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.listSubhead",t.buildTag("span.subheadText",this._getLocalizedLabels("ChooseFieldsToAddToReport"),{})[0].outerHTML,{})[0].outerHTML,{}).attr("valign","top")[0].outerHTML,{})[0].outerHTML,{width:"100%",height:"10%"})[0].outerHTML)+t.buildTag("div.fieldTable",(this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?t.buildTag("div.cubelists",t.buildTag("input#cubeList.cubeList").attr("type","text")[0].outerHTML)[0].outerHTML:"")+t.buildTag("div.parentSchemaFieldTree",t.buildTag("div.schemaFieldTree#"+this._id+"_schemaFieldTree",{},{width:"100%"})[0].outerHTML).attr("valign","top")[0].outerHTML).attr("overflow","auto")[0].outerHTML,filterAxis=t.buildTag("div.axisTd1",t.buildTag("div.pivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("ReportFilter"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaFilter",t.buildTag("p#reportfilter","report filter",{display:"none"})[0].outerHTML+this._createPivotButtons("filters",this.model.filters)).attr("aria-describedby","reportfilter").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,{})[0].outerHTML,columnAxis=t.buildTag("div.axisTd2",t.buildTag("div.rPivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("ColumnLabel"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaColumn",t.buildTag("p#columnlabel","column label",{display:"none"})[0].outerHTML+this._createPivotButtons("columns",this.model.pivotColumns)+(this._dataModel!="XMLA"||this.model.pivotCalculations.length==0?"":this.model.pivotCalculations[0].measures!=i&&this.model.pivotCalculations[0].measures.length>0&&this.model.pivotCalculations[0].axis!=i&&this.model.pivotCalculations[0].axis=="columns"?this._createPivotButtons("columns",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}]):""),{})[0].outerHTML,{}).attr("aria-describedby","columnlabel").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,rowAxis=t.buildTag("div.axisTd1#axisTd",t.buildTag("div.pivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("RowLabel"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaRow",t.buildTag("p#rowlabel","row label",{display:"none"})[0].outerHTML+this._createPivotButtons("rows",this.model.pivotRows)+(this._dataModel!="XMLA"||this.model.pivotCalculations.length==0?"":this.model.pivotCalculations[0].measures!=i&&this.model.pivotCalculations[0].measures.length>0&&this.model.pivotCalculations[0].axis!=i&&this.model.pivotCalculations[0].axis=="rows"?this._createPivotButtons("rows",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}]):""),{})[0].outerHTML,{}).attr("aria-describedby","rowlabel").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,values=t.buildTag("div.axisTd2#axisTd3",t.buildTag("div.rPivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("Values"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaValue",t.buildTag("p#valuelabel","values",{display:"none"})[0].outerHTML+this._createPivotButtons("values",this.model.pivotCalculations),{}).attr("aria-describedby","valuelabel").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,{})[0].outerHTML,axisTable=t.buildTag("div.axisTable",this.model.layout=="onebyone"?columnAxis+rowAxis+filterAxis+values:t.buildTag("div",filterAxis+columnAxis,{})[0].outerHTML+t.buildTag("div",rowAxis+values,{})[0].outerHTML,this.model.enableRTL&&this.model.layout=="onebyone"?{position:"relative",left:this._pivotClientObj.model.enableSplitter?"":"7px"}:{})[0].outerHTML,deferUpdate=t.buildTag("div.deferUpdateLayout",t.buildTag("input.chkDeferUpdate","",{}).attr("type","checkbox")[0].outerHTML+t.buildTag("button.btnDeferUpdate",this._getLocalizedLabels("Update"),{}).attr("type","button")[0].outerHTML)[0].outerHTML,htmlTag=this.model.enableRTL&&this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableSplitter?axisTable+(this.model.layout=="onebyone"?"":t.buildTag("div.centerDiv")[0].outerHTML+t.buildTag("div.centerHead",this._getLocalizedLabels("DragFieldBetweenAreasBelow"))[0].outerHTML)+f+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("span.responsiveSchema","")[0].outerHTML)+(this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n(this.element).parents(".e-pivotclient").length==0?deferUpdate:"")+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("div.schemaNoClick","")[0].outerHTML):f+(this.model.layout=="onebyone"?"":t.buildTag("div.centerDiv")[0].outerHTML+t.buildTag("div.centerHead",this._getLocalizedLabels("DragFieldBetweenAreasBelow"))[0].outerHTML)+axisTable+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("span.responsiveSchema","")[0].outerHTML)+(this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n(this.element).parents(".e-pivotclient").length==0?deferUpdate:"")+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("div.schemaNoClick","")[0].outerHTML),n(htmlTag).appendTo("#"+this._id),this.element.parents(".e-pivotclient").length>0&&!this._pivotClientObj.model.enableSplitter&&(this._pivotClientObj.model.isResponsive&&this.element.find(".fieldTable").addClass("addedFieldTable"),this.model.enableRTL||this.element.find(".fieldTable").addClass("fieldDisSplitTable")),this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableSplitter&&this.element.find(".fieldTable").addClass("fieldEnSplitTable"),this.model.enableRTL&&this.element.parents(".e-pivotclient").length>0&&(this.element.find(".fieldTable").addClass("clientFieldTable"),this.element.find(".fieldTable").addClass("rtlSplitTable"),this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableSplitter&&this.element.find(".axisTable").addClass("clientAxisSplitterTable")),this.model.pivotControl!=null?((this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.pivotControl.element.hasClass("e-pivotclient"))&&this._refreshPivotButtons(),this._reSizeHandler()):this.element.hide());this.model.enableDragDrop&&this.model.pivotControl&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)});this.element.find(".pivotButton .filterBtn").ejButton({size:"normal",enableRTL:this.model.enableRTL,type:t.ButtonType.Button,contentType:"imageonly",prefixIcon:"filter"});this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&(s={url:this.model.pivotControl.model.dataSource.data,cube:this.model.pivotControl.model.dataSource.cube,catalog:this.model.pivotControl.model.dataSource.catalog,request:"MDSCHEMA_CUBES"},t.Pivot._getTreeData(s,t.Pivot.getCubeList,{pvtCtrldObj:this,action:"loadcubelist",hierarchy:this._selectedField}),this.element.find(".cubeList").ejDropDownList({dataSource:this.model.cubeCollection,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},width:"100%",height:"27px",change:t.proxy(this._cubeChanged,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),ddlTarget=this.element.find(".cubeList").data("ejDropDownList"),t.isNullOrUndefined(ddlTarget)||ddlTarget.selectItemByText(this.model.pivotControl.model.dataSource.cube));this.element.find(".pivotButton input").ejToggleButton({size:"normal",enableRTL:this.model.enableRTL,contentType:"imageonly",defaultPrefixIcon:"ascending",activePrefixIcon:"descending",click:t.proxy(this._sortBtnClick,this)});this.model.pivotControl!=null&&(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this._createTreeView(this,this.model.pivotTableFields):t.Pivot.generateTreeViewData(this));this.model.enableRTL&&this.element.addClass("e-rtl");this._createContextMenu();this._waitingPopup&&this._waitingPopup.hide();this._setPivotBtnWidth()},setCubeList:function(n){this.model.cubeCollection=n},refreshControl:function(){var i,t;for(n(this._tableTreeObj.element).ejTreeView("unCheckAll"),this._isDropAction=!0,i=this.model.pivotControl.model.dataSource,t=0;t<i.rows.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.rows[t].fieldName+"']"));for(t=0;t<i.columns.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.columns[t].fieldName+"']"));for(t=0;t<i.filters.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.filters[t].fieldName+"']"));for(t=0;t<i.values.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.values[t].fieldName+"']"));this._isDropAction=!1;this._refreshPivotButtons()},_cubeChanged:function(i){this.model.pivotControl.model.dataSource.cube!=i.selectedValue&&(this._pivotClientObj._waitingPopup&&setTimeout(function(){var t=n(i.target).parents(".e-pivotclient").length>0?n(i.target).parents(".e-pivotclient").data("ejPivotClient"):n(this.element).parents(".e-pivotclient").data("ejPivotClient");t._waitingPopup.show()},0),this.model.pivotControl.model.dataSource.cube=i.selectedValue,this.model.pivotControl.model.dataSource.rows=this.model.pivotControl.model.dataSource.columns=this.model.pivotControl.model.dataSource.values=this.model.pivotControl.model.dataSource.filters=[],delete this.model.pivotControl._fieldData,this.element.find(".pivotButton").remove(),this.element.find(".schemaFieldTree").empty(),t.Pivot.generateTreeViewData(this,this.model.pivotControl.model.dataSource),this._pivotClientObj.refreshControl())},_setPivotBtnWidth:function(){if(this.model.layout!="excel"&&this.model.pivotControl){var r=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!0:!1,u=r?this._dataModel:this.model.pivotControl._dataModel,i=u=="Olap"||u=="XMLA"?15:20;n.each(this.element.find(".schemaRow .pvtBtn,.schemaColumn .pvtBtn"),function(t,u){n(u).attr("aria-describedby")=="Measures"?n(u).width(n(u).parent().width()-i-10):(n(u).width(n(u).parent().width()-3*i),this._dataModel!="Pivot"&&r&&n(".pivotButton:contains('"+n(u).text()+"'):first").find(".filtered").length>0&&n(u).parent().find(".filter").addClass("filtered"))});n.each(this.element.find(".schemaValue .pvtBtn"),function(t,r){n(r).width(n(r).parent().width()-i-10)});n.each(this.element.find(".schemaFilter .pvtBtn"),function(t,u){n(u).width(n(u).parent().width()-2*i-10);this._dataModel!="Pivot"&&r&&n(".pivotButton:contains('"+n(u).text()+"'):first").find(".filtered").length>0&&n(u).parent().find(".filter").addClass("filtered")})}else n.each(this.element.find(".pvtBtn"),function(t,i){n(i).width(n(i).parent().width()-15)})},_onContextOpen:function(i){n(i.target).hasClass("removeClientPivotBtn")||t.Pivot._contextMenuOpen(i,this)},_contextClick:function(i){var r,f,u;schemaObj=this;r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(r)?this.model.pivotControl._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));f=i.text==this._getLocalizedLabels("AddToColumn")?this.element.find(".schemaColumn"):i.text==this._getLocalizedLabels("AddToRow")?this.element.find(".schemaRow"):i.text==this._getLocalizedLabels("AddToValues")?this.element.find(".schemaValue"):i.text==this._getLocalizedLabels("AddToFilter")?this.element.find(".schemaFilter"):"";u={element:this._selectedMember,target:f[0],cancel:!1};this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped(u):this._clientOnPvtBtnDropped(u)},_createTreeView:function(r,u){var f,c,e,l,a,o,s,v,h;for(this.element.find(".schemaFieldTree").ejTreeView({showCheckbox:this.model.layout=="onebyone"?!1:!0,fields:{id:"id",parentId:"pid",text:this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"name":"caption",isChecked:"isSelected",spriteCssClass:"spriteCssClass",dataSource:u},enableRTL:this.model.enableRTL,allowDragAndDrop:this.model.enableDragDrop?!0:!1,allowDropChild:!1,allowDropSibling:!1,dragAndDropAcrossControl:!0,beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",nodeDropped:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._nodeDropped:this._clientOnNodeDropped,this),nodeDragStart:t.proxy(this._nodeDrag,this),nodeDrag:t.proxy(this._nodeDraged,this)}),f=[],c=this.model.pivotControl.model.dataSource.providerName==t.olap.Providers.Mondrian,this._tableTreeObj=this.element.find(".schemaFieldTree").data("ejTreeView"),this._tableTreeObj.element.find(".e-ul").css({width:"100%",height:"100%"}),this._tableTreeObj.element.find(".measureGroupCDB").parent().siblings(".e-chkbox-wrap").remove(),this._tableTreeObj.element.find(".folderCDB").parent().siblings(".e-chkbox-wrap").remove(),this._tableTreeObj.element.find(".dimensionCDB").parent().siblings(".e-chkbox-wrap").remove(),this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne&&(this._tableTreeObj.element.find(".measureGroupCDB").parents("li").length==0?this._tableTreeObj.element.find("#\\[Measures\\]").append(t.buildTag("span.elementSeparator")[0].outerHTML):this._tableTreeObj.element.find(".measureGroupCDB").parents("li").append(t.buildTag("span.elementSeparator")[0].outerHTML),this._tableTreeObj.element.find(".dimensionCDB").parents("li").append(t.buildTag("span.elementSeparator")[0].outerHTML)),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&(f=this._tableTreeObj.element,n.map(u,function(t){t.defaultHierarchy&&n(f).find("li[id='"+t.tag+"']").attr("defaultHierarchy",t.defaultHierarchy)})),f=this._tableTreeObj.element.find("li"),e=0;e<f.length;e++)l=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?c?n(f[e]).attr("id").split("~#^")[0]:n(f[e]).attr("id"):this.model.pivotTableFields[e].tag,f[e].setAttribute("tag",l),a=n(f[e]).find(".e-chkbox-wrap"),n(a[0]).attr("aria-checked")=="true"&&n(n(f[e])).find(".folderCDB").length<=0&&n(f[e]).attr("tag").toLowerCase().indexOf("[measures]")==-1&&(this.model.pivotControl._dataModel=="XMLA"?n(f[e]).parents("li:eq(0)").length>0&&n(f[e]).parents("li:eq(0)").attr("tag").toLowerCase().indexOf("[measures]")==-1&&(o=t.Pivot.getReportItemByFieldName(n(f[e]).attr("tag"),this.model.pivotControl.model.dataSource,this._dataModel).item,!t.isNullOrUndefined(o)>0&&(o.isNamedSets==i||!o.isNamedSets)&&(s=t.buildTag("span.e-icon").css("display","inline-block").addClass("treeDrop").attr("role","button").attr("aria-label","filter button")[0].outerHTML,n(n(f[e]).find(".e-text")[0]).after(s))):(s=t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML,n(n(f[e]).find(".e-text")[0]).after(s)));this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(this._tableTreeObj.model.nodeCheck=t.proxy(this._clientPivotCheckedStateModified,this),this._tableTreeObj.model.nodeUncheck=t.proxy(this._clientPivotCheckedStateModified,this)):(this._tableTreeObj.model.nodeCheck=t.proxy(this._checkedStateModified,this),this._tableTreeObj.model.nodeUncheck=t.proxy(this._checkedStateModified,this));this._tableTreeObj.element.find(".attributeCDB").parent().siblings("ul").remove();this._tableTreeObj.element.find(".attributeCDB").closest("div").find(".e-plus").remove();this._tableTreeObj.element.find(".hierarchyCDB").parent().parent().siblings("ul").find(".e-chkbox-wrap").remove();this._tableTreeObj.element.find(".e-plus").length==0&&this._tableTreeObj.element.find(".e-item").css("padding","0px");this.element.find(".schemaFilter, .schemaColumn, .schemaRow, .schemaValue").ejDroppable({});this.model.pivotControl!=null&&(v=t.buildTag("ul.pivotTreeContext#pivotTreeContext",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToFilter"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToValues"))[0].outerHTML)[0].outerHTML)[0].outerHTML,n(this.element).append(v),n("#pivotTreeContext").ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,enableRTL:this.model.enableRTL,contextMenuTarget:this._tableTreeObj.element,click:t.proxy(this._treeContextClick,this),beforeOpen:t.proxy(this._contextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)}));this.model.pivotControl!=null&&(h=!1,this.model.pivotControl.model.enableDeferUpdate&&(h=!0),this.element.find(".btnDeferUpdate").ejButton({size:"mini",type:t.ButtonType.Button,enabled:h,click:t.proxy(this.model.pivotControl._deferUpdate,this.model.pivotControl)}),this.element.find(".chkDeferUpdate").ejCheckBox({text:this._getLocalizedLabels("DeferLayoutUpdate"),change:this._checkedChange,size:"normal",checked:h}));pschemaDesignerWaitingPopup.hide();this._unWireEvents();this._wireEvents()},_nodeDraged:function(n){this._trigger("dragMove",n)},_setFirst:!0,_setModel:function(t){for(var i in t)switch(i){case"OlapReport":this.setOlapReport(t[i]);break;case"locale":this._load();break;case"locale":case"enableRTL":n(this.element).html("");this._load()}},_wireEvents:function(){this._on(n(document),"keydown",this._keyDownPress);this._on(n(document),"keyup",t.proxy(function(n){n.keyCode===93&&n.preventDefault()}));this.model.layout!="excel"&&this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne&&(this._on(this.element,"mouseover",".pivotButton .pvtBtnDiv",t.proxy(function(t){this._isDragging||n(t.target).find("button").removeClass("e-hoverBtn").addClass("e-hoverBtn")},this)),this._on(this.element,"mouseleave",".pivotButton .pvtBtnDiv",t.proxy(function(t){n(t.target).find("button").length>0?n(t.target).find("button").removeClass("e-hoverBtn"):n(t.target).removeClass("e-hoverBtn")},this)),this._on(this.element,"mouseover",".filter,.sorting,.removeBtn",t.proxy(function(t){this._isDragging||n(t.target.parentElement).find("button").removeClass("e-hoverBtn").addClass("e-hoverBtn")},this)),this._on(this.element,"mouseleave",".filter,.sorting,.removeBtn",t.proxy(function(t){n(t.target.parentElement).find("button").removeClass("e-hoverBtn")},this)));this._on(this.element,"mouseover",".pvtBtnDiv .pvtBtn",t.proxy(function(t){this._isDragging&&(this.element.find(".dropIndicator").removeClass("dropIndicatorHover"),n(t.target).parent().siblings(".dropIndicator").addClass("dropIndicatorHover"))},this));this._on(this.element,"click","#preventDiv",t.proxy(function(){this.element.find(".e-dialog.advancedFilterDlg:visible").length>0&&(this.element.find(".e-dialog.advancedFilterDlg").hide(),this.element.find("#preventDiv").remove())},this));this._on(this.element,"mouseleave",".pivotButton",t.proxy(function(t){this._isDragging&&n(t.target).siblings(".dropIndicator").removeClass("dropIndicatorHover")},this));this._on(this.element,"mouseover",".pivotButton",t.proxy(function(t){n(t.target).attr("title",t.target.textContent)},this));this._tableTreeObj.element.find("li").mouseover(t.proxy(function(i){var u,r;n(i.target).siblings("span.e-icon.filter:eq(0)").length>0||n(i.target).find("span.e-icon.filter:eq(0)").length>0||n(i.target).parentsUntil("li").find("span.e-icon.filter:eq(0)").length>0?(u="-31px",this.element.find("span.e-icon.filter").attr("role","button").attr("aria-label","filtered")):(u="-20px",this.element.find("span.e-icon.treeDrop").attr("role","button").attr("aria-label","filter button"));r=n(i.target).siblings("span.e-icon.filter:eq(0)").length>0||n(i.target).find("span.e-icon.filter:eq(0)").length>0||n(i.target).parentsUntil("li").find("span.e-icon.filter:eq(0)").length>0?10:5;this.model.enableRTL?this.model.pivotControl.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute",top:n(i.target).hasClass("filter")?n(i.target).position().top-22:n(i.target).position().top+2,left:n(i.target).hasClass("filter")?n(i.target).position().left+(6-r):(n(i.target).attr("role")==""?n(i.target).position().left:-2)+(5-r)}):n(i.target).find("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).parentsUntil("li").find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).siblings("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute",top:n(i.target).hasClass("filter")?n(i.target).position().top-22:n(i.target).position().top+2,left:n(i.target).hasClass("filter")?n(i.target).position().left+(7-r):n(i.target).position().left+(10-r)}):n(i.target).find("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).parentsUntil("li").find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).siblings("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"static","margin-left":u}):n(i.target).find("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"static"}):n(i.target).parentsUntil("li").find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"static"});n(i.target).parent().find(".measureGroupCDB, .folderCDB",this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?"":".dimensionCDB").length>0&&n(i.target).css("cursor","default")},this)).mouseout(t.proxy(function(){n(this._tableTreeObj.element).find("span.e-icon.treeDrop").css({display:"none"})},this));this._on(this.element,"click",".filterBtn,.filter",t.proxy(this._filterBtnClickCommon,this));this._on(this.element,"click",".sorting",t.proxy(this._sortBtnClick,this));this._on(this.element,"click",".removeBtn",t.proxy(this._removePvtBtn,this));this._on(this.element,"click",".pvtBtn",t.proxy(this._filterBtnClickCommon,this));this._on(this._tableTreeObj.element,"click",".treeDrop",t.proxy(this._filterBtnClickCommon,this));this._on(this.element,"click",".removeClientPivotBtn",t.proxy(this._removeBtnClick,this));this._on(this.element,"click",".removePivotBtn",t.proxy(this._removeBtnClick,this));this._on(this.element,"click",".ascOrder, .descOrder",t.proxy(this._sortField,this));this._on(this.element,"click",".collapseSchema",t.proxy(this._hideSchemaDesigner,this));this._on(this.element,"click",".expandSchema",t.proxy(this._showSchemaDesigner,this));this._on(this.element,"click",".nextPage, .prevPage, .firstPage, .lastPage",t.proxy(this._navigateTreeData,this));this._on(this.element,"click",".searchEditorTree",t.proxy(function(n){t.Pivot._searchEditorTreeNodes(n,this.model.pivotControl)},this));n(window).on("resize",n.proxy(this._reSizeHandler,this))},_navigateTreeData:function(n){t.Pivot.editorTreeNavigatee(n,this.model.pivotControl)},_filterBtnClickCommon:function(i){if(n(i.target).hasClass("pvtBtn")&&this.element.parents(".e-pivotclient").length>0||n(i.target).hasClass("treeDrop")||n(i.target).hasClass("filter"))if(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode)this._clientOnFilterBtnClick(i);else if(this.model.pivotControl.model.operationalMode!=t.Pivot.OperationalMode.ServerMode||t.isNullOrUndefined(n(i.target.nextElementSibling)))this._filterBtnClick(i);else{if(n(i.target.nextElementSibling).hasClass("treeDrop"))return!1;this._filterBtnClick(i)}},_unWireEvents:function(){this._off(this.element,"click",".filterBtn, .ascOrder, .descOrder, .nextPage, .prevPage, .firstPage, .lastPage, .searchEditorTree");this._off(n(document),"keydown",this._keyDownPress);this._off(n(document),"keyup");this._off(this.element,"click","#preventDiv");this._off(this.element,"mouseover",".pivotButton");this._off(this.element,"mouseover",".pivotButton .pvtBtn");this._off(this.element,"mouseleave",".pivotButton");this._off(this.element,"click",".sorting");this._off(this.element,"click",".filter");this._off(this.element,"click",".removeBtn,.removeClientPivotBtn");this._off(this.element,"mouseover",".schemaFieldTree li");this._off(this.element,"mouseout",".schemaFieldTree li");this._off(this._tableTreeObj.element,"click",".treeDrop");this._off(this.element,"click",".ascOrder, .descOrder",t.proxy(this._sortField,this));this._off(this.element,"click",".filterBtn");this._off(this.element,"click",".pvtBtn");this._off(this._tableTreeObj.element,"click",".treeDrop");this._off(this._tableTreeObj.element,"click","li");this._off(this.element,"click",".removeClientPivotBtn, .removePivotBtn");n(window).off("resize",n.proxy(this._reSizeHandler,this))},_keyDownPress:function(i){var r,u,e,f;if((i.keyCode===40||i.which===38)&&(!t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)&&this.model.pivotControl._curFocus.tab.hasClass("e-text")||n("#"+this._id).find(".schemaFieldList .e-text:visible").hasClass("hoverCell"))&&!n(".editorTreeView:visible").length>0&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0?(n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),this.model.pivotControl._curFocus.tab.mouseleave(),i.preventDefault(),r=n("#"+this._id).find(".schemaFieldTree .e-text:visible"),t.isNullOrUndefined(this._curFocus.tree)?(this._index.tree=i.which==40?1:i.which==38?r.length-1:0,this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1")):(this._curFocus.tree.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40?this._index.tree=this._index.tree+1>r.length-1?0:this._index.tree+1:i.which===38&&(this._index.tree=this._index.tree-1<0?r.length-1:this._index.tree-1),this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1")),this._curFocus.tree.focus().addClass("hoverCell").mouseover(),n(".e-node-focus").removeClass("e-node-focus")):(i.which===40||i.which===38||i.which===37||i.which===39)&&!t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)&&this.model.pivotControl._curFocus.tab.hasClass("pvtBtn")&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&document.activeElement.className.startsWith("pvtBtn")?(i.preventDefault(),n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.mouseleave().attr("tabindex","0").removeClass("hoverCell"),r=n("#"+this._id).find(".pvtBtn"),t.isNullOrUndefined(this._curFocus.button)?i.which===40||i.which===39?this._curFocus.button=r.eq(1).attr("tabindex","-1"):(i.which===38||i.which===37)&&(this._curFocus.button=r.eq(r.length-1).attr("tabindex","-1")):(this._curFocus.button.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40||i.which===39?this._index.button=this._index.button+1>r.length-1?0:this._index.button+1:(i.which===38||i.which===37)&&(this._index.button=this._index.button-1<0?r.length-1:this._index.button-1),this._curFocus.button=r.eq(this._index.button)),this._curFocus.button.addClass("hoverCell").mouseover().focus()):(i.keyCode===40||i.which===38)&&n("#"+this._id).find(".editorTreeView:visible").length>0&&!t.isNullOrUndefined(n("#"+this._id).find(".e-dialog .e-text"))&&n(".e-dialog .e-text").hasClass("hoverCell")&&(n("#"+this._id).find(".editorTreeView .hoverCell").removeClass("hoverCell"),i.preventDefault(),r=n("#"+this._id).find(".e-dialog .e-text:visible"),t.isNullOrUndefined(this._curFocus.node)?(this._index.node=i.which==40?1:i.which==38?r.length-1:0,this._curFocus.node=r.eq(this._index.node).attr("tabindex","-1")):(this._curFocus.node.attr("tabindex","0").removeClass("hoverCell"),i.which===40?this._index.node=this._index.node+1>r.length-1?0:this._index.node+1:i.which===38&&(this._index.node=this._index.node-1<0?r.length-1:this._index.node-1),this._curFocus.node=r.eq(this._index.node).attr("tabindex","-1")),this._curFocus.node.focus().addClass("hoverCell"),n(".e-node-focus").removeClass("e-node-focus")),(i.which===39||i.which===37)&&n("#"+this._id).find(".schemaFieldTree .e-text:visible").hasClass("hoverCell")&&!n(".editorTreeView:visible").length>0?n("#"+this._id).find(".schemaFieldTree .hoverCell").parent().find(".e-plus,.e-minus").click():(i.which===39||i.which===37)&&n("#"+this._id).find(".editorTreeView .e-text:visible").hasClass("hoverCell")?n("#"+this._id).find(".editorTreeView .hoverCell").parent().find(".e-plus,.e-minus").click():i.which===9&&n("#"+this._id).find(".editorTreeView:visible").length>0&&(i.preventDefault(),n("#"+this._id).find(".e-dialog .hoverCell").removeClass("hoverCell"),this._curFocus.node=null,this._index.node=0,u=[],u.push(n("#"+this._id).find(".e-dialog .e-text").first()),n("#"+this._id).find(".dialogOKBtn:visible").hasClass("e-disable")||u.push(n("#"+this._id).find(".dialogOKBtn:visible")),u.push(n("#"+this._id).find(".dialogCancelBtn:visible")),u.push(n("#"+this._id).find(".e-close:visible")),t.isNullOrUndefined(this._curFocus.tab)?(this._index.tab=1,this._curFocus.tab=u[this._index.tab].attr("tabindex","-1")):(this._curFocus.tab.attr("tabindex","0").removeClass("hoverCell"),this._index.tab=this._index.tab+1>u.length-1?0:this._index.tab+1,this._curFocus.tab=u[this._index.tab].attr("tabindex","-1")),this._curFocus.tab.focus().addClass("hoverCell"),i.stopImmediatePropagation()),i.which===13&&n("#"+this._id).find(".hoverCell").length>0&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0){if(n("#"+this._id).find(".e-dialog:visible").length>0){if(n(i.target).hasClass("memberCurrentPage")){t.Pivot.editorTreeNavigatee(i,this.model.pivotControl);return}if(n(i.target).hasClass("searchEditorTreeView")&&n(i.target).parents(".e-dialog").find(".nextPageDiv").length>0){t.Pivot._searchEditorTreeNodes(i,this.model.pivotControl);return}n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").length>0?n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click():(n("#"+this._id).find(".e-dialog .hoverCell").click(),this._index.tab=0,t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"))}else n("#"+this._id).find(".schemaFieldTree .hoverCell").length>0?n("#"+this._id).find(".schemaFieldTree .hoverCell").parent().find(".e-chkbox-small").click():n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&(this._curFocus.button&&(e=this._curFocus.button.parent().attr("tag")),this.model.pivotControl._curFocus.button=n("#"+this._id).find("[tag='"+e+"'] button"),this.model.pivotControl._curFocus.button.attr("tabindex","-1").focus().addClass("hoverCell"));i.stopImmediatePropagation()}i.which===70&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".treeDrop").length>0&&n("#"+this._id).find(".hoverCell").length>0&&n("#"+this._id).find(".hoverCell").parent().find(".treeDrop").click());i.keyCode===93&&n("#"+this._id).find(".hoverCell").length>0&&(i.preventDefault(),f={x:n(".hoverCell").offset().left+n(".hoverCell").outerWidth(),y:n(".hoverCell").offset().top+n(".hoverCell").outerHeight()},n(".hoverCell").trigger({type:"mouseup",which:3,clientX:f.x,clientY:f.y,pageX:f.x,pageY:f.y}));((i.which===79||i.which===67)&&i.ctrlKey||i.which===27)&&n("#"+this._id).find(".hoverCell").length>0&&(i.keyCode==79&&n("#"+this._id).find(".e-dialog").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogOKBtn:visible").click()),i.keyCode==67&&n("#"+this._id).find(".e-dialog").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogCancelBtn:visible").click()),this._index.node=0,n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this._curFocus.button)?t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"):this._curFocus.button.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"))},_getLocalizedLabels:function(n){return t.PivotSchemaDesigner.Locale[this.locale()][n]===i?t.PivotSchemaDesigner.Locale["en-US"][n]:t.PivotSchemaDesigner.Locale[this.locale()][n]},_setTableFields:function(n){t.isNullOrUndefined(n)||(this.model.pivotTableFields=n)},_setPivotRows:function(n){t.isNullOrUndefined(n)||(this.model.pivotRows=n)},_setPivotColumns:function(n){t.isNullOrUndefined(n)||(this.model.pivotColumns=n)},_setPivotCalculations:function(n){t.isNullOrUndefined(n)||(this.model.pivotCalculations=n)},_setFilters:function(n){t.isNullOrUndefined(n)||(this.model.filters=n)},_getSortedHeaders:function(){for(var i=this.element.find(".descending").parents("label"),r="",t=0;t<i.length;t++)r+=n(i[t]).attr("for").replace("toggleBtn","")+"##";return r},_contextOpen:function(i){var u,r;if(n(i.target.parentElement).find(".measureGroupCDB").length>0||n(i.target.parentElement).find(".folderCDB").length>0||!(this.element.parents(".e-pivotclient").length>0)&&n(i.target.parentElement).find(".dimensionCDB").length>0||!n(i.target).hasClass("e-text"))return!1;t.Pivot.openPreventPanel(this);this._selectedMember=n(i.target);this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(r=n("#pivotTreeContext").data("ejMenu"),n(i.target).parents("li:eq(0)").attr("tag").toLowerCase().indexOf("[measures]")>=0?(r.disableItem(this._getLocalizedLabels("AddToFilter")),r.disableItem(this._getLocalizedLabels("AddToRow")),r.disableItem(this._getLocalizedLabels("AddToColumn")),r.enableItem(this._getLocalizedLabels("AddToValues"))):(r.disableItem(this._getLocalizedLabels("AddToValues")),n(i.target.parentElement).find(".namedSetCDB").length>0?r.disableItem(this._getLocalizedLabels("AddToFilter")):r.enableItem(this._getLocalizedLabels("AddToFilter")),r.enableItem(this._getLocalizedLabels("AddToRow")),r.enableItem(this._getLocalizedLabels("AddToColumn")))):this._dataModel=="Pivot"&&(u=i.target.textContent,n(i.target).hasClass("e-text")&&(n(this.element).parents(".e-pivotclient").length>0||n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==u}).length==0)?(r=n("#pivotTreeContext").data("ejMenu"),r.enable()):(r=n("#pivotTreeContext").data("ejMenu"),r.disable()))},_nodeDrag:function(i){return this._isDragging=!0,(n(i.dragTarget.parentElement).find(".measureGroupCDB").length>0||n(i.dragTarget.parentElement).find(".folderCDB").length>0||n(i.dragTarget.parentElement).find(".dimensionCDB").length>0)&&!(n(i.dragTarget.parentElement).find(".dimensionCDB").length>0&&this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne)?!1:void 0},_treeContextClick:function(i){var r,u,f;schemaObj=this;r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.attr("tabindex","-1").focus().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().addClass("hoverCell");u=i.text==this._getLocalizedLabels("AddToColumn")?this.element.find(".schemaColumn"):i.text==this._getLocalizedLabels("AddToRow")?this.element.find(".schemaRow"):i.text==this._getLocalizedLabels("AddToValues")?this.element.find(".schemaValue"):i.text==this._getLocalizedLabels("AddToFilter")?this.element.find(".schemaFilter"):"";f={dropTarget:u,droppedElement:this._selectedMember.parent().parent(),target:u};t.isNullOrUndefined(r)?this.model.pivotControl._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._nodeDropped(f):this._clientOnNodeDropped(f)},_checkedChange:function(t){var i=n(t.event.target).parents(".e-pivotschemadesigner").data("ejPivotSchemaDesigner"),r=n(".btnDeferUpdate").data("ejButton");t.isChecked?(i.model.pivotControl.model.enableDeferUpdate=!0,r.enable()):(i.model.pivotControl.model.enableDeferUpdate=!1,i.model.pivotControl._isUpdateRequired&&i.model.pivotControl._deferUpdate(),r.disable())},_sortBtnClick:function(i){var r;if(n(i.target).toggleClass("descending"),this.model.pivotControl._dataModel!="Olap"&&this.model.pivotControl._dataModel!="XMLA")if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){t.PivotAnalysis._valueSorting=null;var f=n(i.target).parents(".pivotButton").attr("tag").split(":")[1],e=this.model.pivotControl.model.dataSource[n(i.target).parents(".pivotButton").attr("tag").split(":")[0].toLowerCase()],u=n.grep(e,function(n){return n.fieldName==f}),o=i.target.className.indexOf("descending")>=0?t.PivotAnalysis.SortOrder.Descending:t.PivotAnalysis.SortOrder.Ascending;for(r=0;r<u.length;r++)u[r].sortOrder=o;this.model.pivotControl._populatePivotGrid()}else this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.pivotControl._sortBtnClick(i)},_generateMembers:function(r,u){var c=n(u).find("Axis:eq(0) Tuple"),e=[],l={},f,o,a,s,h;for(e.push({id:"All",name:"All",checkedStatus:!0,tag:""}),f=0;f<c.length;f++)o=n(n(u).find("Axis:eq(0) Tuple:eq("+f+")").children().children()[0]).text(),a=n(n(u).find("Axis:eq(0) Tuple:eq("+f+")").children().children()[1]).text()==""?"(Blank)":n(n(u).find("Axis:eq(0) Tuple:eq("+f+")").children().children()[1]).text(),l={hasChildren:n(c[f]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!0,id:o.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:a,tag:o},e.push(l);t.isNullOrUndefined(pschemaDesignerWaitingPopup)||(s=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(s)||(s._isTimeOut=!1),pschemaDesignerWaitingPopup.hide());!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.enableMemberEditorPaging?(this.model.pivotControl._editorTreeData=e,this.model.pivotControl._editorTreeData.splice(0,1),this._memberCount=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i)).length,this.model.pivotControl._currentReportItems.push({filterItems:this.model.pivotControl._editorTreeData,fieldName:this._selectedFieldName,dataSrc:this.model.pivotControl.model.dataSource,pageSettings:this._memberCount}),h=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize)),h.splice(0,0,{id:"All",name:"All",checkedStatus:this.model.pivotControl._isAllMemberChecked,tag:""}),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(h)})):this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(e)})},_generateChildMembers:function(t,i){for(var e=n(i).find("Axis:eq(0) Tuple"),f=[],r=this.element.find("[tag='"+t.currentNode.replace(/&/g,"&")+"']"),u=0;u<e.length;u++){var o=n(n(i).find("Axis:eq(0) Tuple:eq("+u+")").children().children()[0]).text(),s=n(n(i).find("Axis:eq(0) Tuple:eq("+u+")").children()).find("Caption").text(),h={hasChildren:n(e[u]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!1,id:o.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:s,tag:o};f.push(h)}parentNode=n(r).parents("li").length>1?n(r).parents("li").first():n(r).parents("li");r.find(".e-load").removeClass("e-load");n(n(parentNode).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});n.each(r.find("li"),function(n,t){t.setAttribute("tag",f[n].tag)});this._memberTreeObj=n(".editorTreeView").data("ejTreeView");this._memberTreeObj.addNode(f,n(r))},_sortField:function(i){if(t.Pivot.closePreventPanel(this),this.element.find(".e-dialog, .clientDialog").remove(),n(i.element).attr("id")=="descOrder"||n(i.element).attr("id")=="ascOrder"){var r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource).item;t.isNullOrUndefined(r)||(r.sortOrder=n(i.element).attr("id")=="descOrder"?t.olap.SortOrder.Descending:t.olap.SortOrder.Ascending);this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.model.pivotControl.refreshControl():(t.olap.base._clearDrilledCellSet(),t.olap.base.getJSONData({action:"sorting"},this.model.pivotControl.model.dataSource,this.model.pivotControl))}},_clientOnFilterBtnClick:function(r){var u,e;if(t.Pivot.openPreventPanel(this),schemaObj=this,u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(u)?this._waitingPopup.show():(u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&schemaObj._waitingPopup.show()},800)),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){if(n(r.target).parents().hasClass("pivotButton")&&n(r.target).parents(".pivotButton").attr("tag").indexOf(":[")>=0&&!(n(r.target).parents(".pivotButton").attr("tag").toLowerCase().indexOf("[measures]")>=0))this._selectedFieldName=n(r.target).parents(".pivotButton").attr("tag").split(":")[1];else{if(n(r.target).parents().attr("tag")!=null&&(n(r.target).parents().attr("tag").split(":")[1]=="Measures"||n(r.target).parent().attr("tag").toLowerCase().indexOf("[measures]")>=0))return t.Pivot.closePreventPanel(this),t.isNullOrUndefined(u)||(u._isTimeOut=!1),!1;this._selectedLevel=n(n(r.target).parents("li:eq(0)")).attr("tag");this._selectedFieldName=n(r.target).parents("li:eq(0)").children("div:eq(0)").find(".levels").length>0?n(n(r.target).parents("li:eq(1)")).attr("tag"):n(n(r.target).parents("li:eq(0)")).attr("tag")}if(t.isNullOrUndefined(this._selectedFieldName)||this._selectedFieldName.toLocaleLowerCase().indexOf("measures")>=0)return!1;var h=this._selectedFieldName,s=this.model.pivotControl.model.dataSource,o,f=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName==h&&(t.isNullOrUndefined(n.dataSrc)||n.dataSrc.cube==s.cube&&n.dataSrc.reportName==s.reportName))return o=n.pageSettings,n.filterItems});this.model.pivotControl.model.enableMemberEditorPaging&&(o&&(this._memberCount=o),this.model.pivotControl._memberPageSettings.endPage=this.model.pivotControl.model.memberEditorPageSize,this.model.pivotControl._memberPageSettings.startPage=0,this.model.pivotControl._memberPageSettings.currentMemeberPage=1);f.length>0?(this.model.pivotControl.model.enableMemberEditorPaging&&(this.model.pivotControl._editorTreeData=f,this._memberCount=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i)).length,f=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize)),f.splice(0,0,{id:"All",name:"All",checkedStatus:this.model.pivotControl._isAllMemberChecked,tag:""})),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(f)})):t.olap._mdxParser.getMembers(this.model.pivotControl.model.dataSource,this._selectedFieldName,this)}else this._selectedFieldName=n(r.target).parent().hasClass("pivotButton")&&n(r.target).parent().attr("tag").indexOf(":")>=0?n.grep(this.model.pivotTableFields,function(t){return t.name==n(r.target).parent().attr("tag").split(":")[1]})[0].name:n.grep(this.model.pivotTableFields,function(t){return t.id==n(n(r.target).closest("li")).attr("id")})[0].name;e=n(this.element.find(".pivotButton button[fieldname='"+this._selectedFieldName+"']"));this._dialogHead=this._selectedFieldCaption=e.attr("fieldCaption");this._selectedFieldAxis=e.parents().hasClass("schemaRow")?"rows":e.parents().hasClass("schemaColumn")?"columns":e.parents().hasClass("schemaValue")?"values":"filters";this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(this._getTreeViewData())})},_getTreeViewData:function(){var s=this.model.pivotControl.model.dataSource[this._selectedFieldAxis],o=this._selectedFieldName,f=n.grep(s,function(n){return n.fieldName==o})[0],u=t.PivotAnalysis.getMembers(o,this.model.pivotControl.model.dataSource.data),e=[{id:"All",name:"All",checkedStatus:!0}],r;if(f.filterItems!=null&&f.filterItems!=i)for(r=0;r<u.length;r++)e.push({id:u[r],name:u[r],checkedStatus:f.filterItems.filterType==t.PivotAnalysis.FilterType.Include?n.inArray(u[r].toString(),f.filterItems.values)>=0:n.inArray(u[r].toString(),f.filterItems.values)<0});else for(r=0;r<u.length;r++)e.push({id:u[r],name:u[r],checkedStatus:!0});return e},_filterBtnClick:function(i){var s,e,h,v,l,y,c,u,r,o,f,a,p;if(this.model.pivotControl._editorFlag=!1,t.Pivot.openPreventPanel(this),schemaObj=this,s=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(this.model.pivotControl._dataModel=="XMLA"?n(i.target).parents("li:eq(0)").length>0?(this._selectedLevel=n(n(i.target).parents("li:eq(0)")).attr("tag"),e=n(i.target).parents("li:eq(0)").children("div:eq(0)").find(".levels").length>0?n(n(i.target).parents("li:eq(1)")).attr("tag"):n(n(i.target).parents("li:eq(0)")).attr("tag")):(this._selectedLevel=n(i.target).parent().attr("tag").split(":")[1],e=n(i.target).parent().attr("tag").split(":")[1]):e=n.grep(this.model.pivotTableFields,function(t){return t.caption==n(n(i.target).parent()).text()})[0].name,r=0;r<this.element.find(".pivotButton").length;r++)if(uniqueName=n(this.element.find(".pivotButton")[r]).find("button").attr("fieldName"),uniqueName==e){h=n(this.element.find(".pivotButton")[r]).find("button").text();this._selectedAxis=n(this.element.find(".pivotButton")[r]).parent()[0].className.split(" ")[0];break}this._selectedAxis=this.model.pivotControl._selectedAxis=this._selectedAxis=="schemaRow"?"rows":this._selectedAxis=="schemaColumn"?"columns":this._selectedAxis=="schemaValue"?"values":"filters";this._dialogTitle=this.model.pivotControl._dialogTitle=h;this._dialogHead=this.model.pivotControl._dialogHead=h;this._selectedMember=this.model.pivotControl._selectedField=e;this.model.pivotControl._dataModel=="XMLA"?(v=n(i.target).parents("li:eq(0)").length>0?n(i.currentTarget).parents("li:eq(0)").attr("tag"):n(i.target).parent().attr("tag").split(":")[1],l=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName==v)return n.filterItems}),l.length>0?this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(l)}):this._selectedMember=e):(y=this.model.pivotControl._getTreeViewData(e,h,this._selectedAxis),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(y)}))}else{if(n(this._tableTreeObj.element).find("span.e-icon.treeDrop").css({display:"none"}),this._dataModel=="Olap"){if(n(i.target).attr("class").indexOf("filter")>-1){for(r=0;r<this.model.pivotTableFields.length;r++)(this.model.pivotTableFields[r].tag.replace(/\[/g,"").replace(/\]/g,"").indexOf("Measures")>-1&&this.model.pivotTableFields[r].isSelected==!0||this.model.pivotTableFields[r].isSelected==!0&&n(i.target.parentElement).attr("tag").split(":")[1]==this.model.pivotTableFields[r].tag.replace(/\[/g,"").replace(/\]/g,""))&&(c=this.model.pivotTableFields[r].spriteCssClass);for(o=0;o<this._tableTreeObj.element.find("li").length;o++)n(n(i.target).parent()).attr("tag").split(":")[1]==n(this._tableTreeObj.element.find("li")[o]).attr("tag").replace(/\]/g,"").replace(/\[/g,"")&&(u=n(this._tableTreeObj.element.find("li")[o]))}else c=n(i.target).parent().find("a>span").attr("class");n(i.target).attr("class").indexOf("filter")>-1||(u=c.indexOf("hierarchyCDB")>-1||c.indexOf("attributeCDB")>-1?n(i.target).parents("li")[0]:n(i.target).parents("li")[1])}else u=n(i.target).attr("class").indexOf("filter")>-1?this._tableTreeObj.element.find("li:contains('"+n(n(i.target).parent()).attr("tag").split(":")[1]+"')"):n(n(i.target).parent()).parent();if(this._selectedTreeNode=u,i.target.tagName.toLowerCase()=="span"||i.target.tagName.toLowerCase()=="button"){if(this._curFilteredText=this.model.layout!="excel"&&n(i.target).attr("class").indexOf("filter")>-1?n(n(i.target).parents(".pivotButton")).attr("tag").split(":")[1].replace(/\]/g,"").replace(/\[/g,""):this._dataModel=="Olap"?n(u).attr("tag").replace(/\]/g,"").replace(/\[/g,""):n(u).attr("id"),n(this.element).parents(".e-pivotclient").length>0&&(this._curFilteredText=n(n(i.target).parents(".pivotButton")).attr("tag").split(":")[1].replace(/\]/g,"").replace(/\[/g,"")),n(i.target).parents("li:eq(1)").find("div:first>a>span").hasClass("hierarchyCDB")&&(this._curFilteredText=n(i.target).parents("li:eq(1)").find("div:first>a").text()),this._dataModel=="Pivot"&&(n(this.element).parents(".e-pivotclient").length>0?(this._curFilteredAxis=n(u)[0].className.split(" ")[0],this.model.pivotControl._curFilteredText=this._curFilteredText):this._curFilteredAxis=t.isNullOrUndefined(this.element.find(".e-btn:contains('"+(n(this.element).parents(".e-pivotclient").length>0?n(u).text():n(u).find("div:first").text())+"')").parents(".e-droppable")[0])?"":this.element.find(".e-btn:contains('"+n(u).find("div:first").text()+"')").parents(".e-droppable")[0].className.split(" ")[0],this._dialogHead=n(i.target).attr("fieldcaption")||this._curFilteredText),this._dialogTitle=this._dataModel=="Olap"?n(this.element.find(".pivotButton:contains('"+n(u).find("div:first").text()+"')")[0]).attr("tag"):n(i.target).parents("li").length>0?n(i.target).parents("li").attr("id")||i.target.id.replace("filterBtn","")||n(i.target).parents(".filterBtn")[0].id.replace("filterBtn",""):n(i.target).parent().attr("tag").split(":")[1]||i.target.id.replace("filterBtn","")||n(i.target).parents(".filterBtn")[0].id.replace("filterBtn",""),n(this.element).parents(".e-pivotclient").length>0&&n(u)[0].className.split(" ")[0]=="schemaFilter"&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(this._dialogTitle=this._dialogHead),this._dataModel=="Olap")for(f=0;f<this.element.find(".e-btn").length;f++)if(!t.isNullOrUndefined(n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag"))&&n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag").split(":")[1]==n(this._selectedTreeNode).attr("tag").replace(/\]/g,"").replace(/\[/g,"")&&n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag").indexOf(this._curFilteredText)>-1){this._curFilteredAxis=t.isNullOrUndefined(n(n(this.element.find(".e-btn"))[0]).parents(".e-droppable")[0])?"":n(n(this.element.find(".e-btn"))[0]).parents(".e-droppable")[0].className.split(" ")[0];this._dialogTitle=n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag");this._dialogHead=n(n(n(this.element.find(".e-btn"))[f])[0]).attr("fieldCaption");break}try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(w){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(a=this.model.pivotControl.getOlapReport())}sortedHeaders=this._getSortedHeaders();this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.pivotControl.model.customObject});p=JSON.stringify({action:"fetchMembers",headerTag:this._dialogTitle+(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.enableAdvancedFilter?"##true":"")||"UniqueName##"+n(u).attr("tag"),sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});t.isNullOrUndefined(s)?this.model.pivotControl._waitingPopup.show():(s._isTimeOut=!0,setTimeout(function(){s._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.fetchMembers,p,this._fetchMemberSuccess)}}},_removeBtnClick:function(i){var r,s,e,l,h,u,f,c,o;if(schemaObj=this,r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(r)?this.model.pivotControl._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800)),this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode)t.PivotAnalysis._valueSorting=null,s=n(i.target).parent().attr("tag").split(":")[1],t.Pivot.removeReportItem(this.model.pivotControl.model.dataSource,s,s.toLocaleLowerCase().indexOf("measures")==0),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.pivotControl._fieldMembers={},this.model.pivotControl._fieldSelectedMembers={},t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl)),this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl._pivotChart&&(this.model.pivotControl._pivotChart._labelCurrentTags={}),this._refreshPivotButtons(),this.model.pivotControl.refreshControl(),n(i.target).parent().remove();else{for(e=n(i.target.parentElement).find("button").attr("fieldcaption")||n(i.target.parentElement).text(),h=n(n(this._tableTreeObj.element).find("div:contains("+e+")>span")[1]).find(".e-chk-act"),n(h).removeClass("e-chk-act").addClass("e-chk-inact"),n(h).children("e-checkmark").removeClass("e-checkmark"),u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].FieldHeader==e&&(this.model.pivotTableFields[u].IsSelected=!1,l=this.model.pivotTableFields[u]);if(n(i.target.parentElement).remove(),n(this.element).parents(".e-pivotclient").length>0&&(f=n(i.target).parent().attr("tag"),delete this.model.pivotControl._fieldMembers[f.split(":")[f.split(":").length-1]],delete this.model.pivotControl._fieldSelectedMembers[f.split(":")[f.split(":").length-1]]),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject}),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&n(this.element).parents(".e-pivotclient").length>0){try{c=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(a){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(c=this.model.pivotControl.getOlapReport())}o=JSON.stringify({action:"removeButton",args:JSON.stringify({headerTag:e,currentReport:c,sortedHeaders:t.isNullOrUndefined(this.model.pivotControl._ascdes)?"":this.model.pivotControl._ascdes}),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,o,this._droppedSuccess)}else o=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(l),sortedHeaders:this._getSortedHeaders(),currentReport:this.model.pivotControl.getOlapReport(),customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,o,this._nodeStateModifiedSuccess)}t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||t.isNullOrUndefined(r)||(r._isTimeOut=!1)},_nodeCheckChanges:function(r){var s,u,h,f,e,o;if(this._isFiltered=!0,(r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()=="all")&&r.type=="nodeUncheck"){if(this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("unCheckAll"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.disable(),this.model.pivotControl&&this.model.pivotControl.model.enableMemberEditorPaging)for(this.element.find(".dialogOKBtn").attr("disabled","disabled"),this.model.pivotControl._isAllMemberChecked=!1,f=0;f<this.model.pivotControl._editorTreeData.length;f++)this.model.pivotControl._editorTreeData[f].checkedStatus=!1}else if((r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()=="all")&&r.type=="nodeCheck"){if(this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("checkAll"),n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.enable(),this.model.pivotControl&&this.model.pivotControl.model.enableMemberEditorPaging)for(this.element.find(".dialogOKBtn").removeAttr("disabled"),this.model.pivotControl._isAllMemberChecked=!0,f=0;f<this.model.pivotControl._editorTreeData.length;f++)this.model.pivotControl._editorTreeData[f].checkedStatus=!0}else if((r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()!="all")&&!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.enableMemberEditorPaging){if(r.type=="nodeUncheck")this.model.pivotControl._isMembersFiltered=!0,u="",u=n(r.currentElement).parent().parent().hasClass("editorTreeView")&&!this.model.pivotControl._isSearchApplied?t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize).where("id","equal",r.currentElement.attr("id")))[0]:t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("id","equal",r.currentElement.attr("id")))[0],t.isNullOrUndefined(u)||(u.checkedStatus=!1,t.isNullOrUndefined(u.pid)||(s=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",u.pid).where("checkedStatus","equal",!0)),t.isNullOrUndefined(s)||s.length!=0||t.Pivot._unSelectParentTreeNode(u,this.model.pivotControl)),s=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",u.id)),!t.isNullOrUndefined(s)&&s.length>0&&t.Pivot._unSelectChildTreeNode(u,this.model.pivotControl)),u=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).where("checkedStatus","equal",!0)),o=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),t.isNullOrUndefined(u)||u.length!=0?n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop").addClass("e-checkmark"):(this._dialogOKBtnObj.disable(),this.element.find(".dialogOKBtn").attr("disabled","disabled"),this.model.pivotControl._isAllMemberChecked=!1,o.removeClass("e-stop").removeClass("e-checkmark").addClass("e-chk-inact"));else if(r.type=="nodeCheck"){if(this.model.pivotControl._isMembersFiltered=!0,u="",u=n(r.currentElement).parent().parent().hasClass("editorTreeView")&&!this.model.pivotControl._isSearchApplied?t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize).where("id","equal",r.currentElement.attr("id")))[0]:t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("id","equal",r.currentElement.attr("id")))[0],!t.isNullOrUndefined(u)&&(u.checkedStatus=!0,t.isNullOrUndefined(u.pid)||t.Pivot._selectParentTreeNode(u,this.model.pivotControl),!t.isNullOrUndefined(u.id)&&(h=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",u.id)),!t.isNullOrUndefined(h)&&h.length>0)))for(f=0;f<h.length;f++)h[f].checkedStatus=!0,t.Pivot._selectChildTreeNode(h[f],this.model.pivotControl);this.element.find(".dialogOKBtn").data("ejButton").enable();this.element.find(".dialogOKBtn").removeAttr("disabled");this.model.pivotControl._isAllMemberChecked=!0;n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop").addClass("e-checkmark")}}else(r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()!="all")&&(e=this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),o=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),e.length==0||e.length==1&&e[0].id[e[0].id.length-1]==0?(n(o).parent().removeClass("e-chk-inact").removeClass("e-chk-ind").addClass("e-chk-act"),o.removeClass("e-stop").addClass("e-checkmark")):r.type=="nodeCheck"&&e.length==1&&e[0].id[e[0].id.length-1]==0?o.removeClass("e-stop").addClass("e-checkmark"):e.length>0&&o.removeClass("e-checkmark").addClass("e-stop"),this._dialogOKBtnObj.enable(),r.type=="nodeUncheck"&&e.length+1==this._memberTreeObj.element.find("li").length&&(o.removeClass("e-checkmark").removeClass("e-stop"),this._dialogOKBtnObj.disable()))},_pivotCheckedStateModified:function(r){var f,p,a,w,v,u;if(this._nodeCheck==!0)return this._nodeCheck=!1,!1;if(this._isDropAction)return!1;t.PivotAnalysis._valueSorting=null;var e=this.model.pivotControl._dataModel=="XMLA"?n(r.currentElement).attr("tag"):this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?n.grep(this.model.pivotTableFields,function(t){return t.caption==n(r.currentElement).find("a")[0].textContent})[0].name:n(r.currentElement).find("a")[0].textContent,s=n(r.currentElement).find("a")[0].textContent,h="",c="",y="",l="",o=this.model.pivotControl._dataModel=="XMLA"?"XMLA":"",h=[];for(u=0;u<this.element.find(".pivotButton").length;u++)if(y=n(this.element.find(".pivotButton")[u]).find("button").attr("fieldName"),y==e&&(h.push(this.element.find(".pivotButton")[u]),o=="XMLA"))break;for(u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].name==e&&r.type=="nodeCheck"?(this.model.pivotTableFields[u].isSelected=!0,c=this.model.pivotTableFields[u]):this.model.pivotTableFields[u].name==e&&r.type=="nodeUncheck"&&(this.model.pivotTableFields[u].isSelected=!1,c=this.model.pivotTableFields[u]);if(r.type=="nodeUncheck")if(h.length>1)for(u=0;u<h.length;u++)n(h[u]).find("button").attr("fieldName")==e&&n(h[u]).remove();else n(h).remove();try{l=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(b){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(l=this.model.pivotControl.getOlapReport())}if(o=="XMLA"&&l==""&&(l=this.model.pivotControl.model.dataSource,this._selectedMember=e,this._selectedTreeNode=n(r.currentElement),this.model.pivotControl.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeStateModefied"})),f=this._droppedClass!=""?this._droppedClass:c.pivotType!=i?c.pivotType=="PivotItem"?"schemaRow":"schemaValue":"schemaRow",this._droppedClass="",r.type=="nodeCheck"){if(o=="XMLA"?(s=n(r.currentElement).find(".kpi").length>0?n(r.currentElement).parents("li:eq(0)").children("div").text()+" "+s:s,p=this.model.pivotControl.model.dataSource.enableAdvancedFilter?n(r.currentElement.find(".e-text")):n(r.currentElement.find(".e-text")[0]),n(r.currentElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&!(n(r.currentElement).find(".namedSetCDB").length>0)?p.after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML):"",n(r.currentElement).attr("tag").toLocaleLowerCase().indexOf("[measures]")>=0&&(f="schemaValue"),droppedItem=n(r.currentElement).find(".namedSetCDB").length>0?{fieldName:n(r.currentElement).attr("tag"),fieldCaption:n(r.currentElement).text(),isNamedSets:!0}:t.olap.base._getCaption({fieldName:e,fieldCaption:s},this.model.pivotControl._fieldData.hierarchy)):(n(r.currentElement.find(".e-text")[0]).after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML),droppedItem={fieldName:e,fieldCaption:s}),f=f==""?"row":f=="schemaColumn"?"column":f=="schemaRow"?"row":f=="schemaValue"?"value":f=="schemaFilter"?"filter":"",this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(a=n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e}),a.length>0)){if(this._calculatedFieldItems(a))return;f="value";droppedItem={fieldName:e,fieldCaption:s,isCalculatedField:!0,formula:a[0].formula}}this._createPivotButton(droppedItem,f,"","","");o=="XMLA"&&f=="value"?(this.model.pivotControl.model.dataSource.values.length==0&&this.model.pivotControl.model.dataSource.values.push({measures:[],axis:"columns"}),measuresAxis=this.model.pivotControl.model.dataSource.values[0].axis=="columns"?"Columns:":"Rows:",this.element.find("div[tag='"+measuresAxis+"Measures']").length==0&&this._createPivotButton({fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")},measuresAxis=="Columns:"?"column":"row","","",""),this.model.pivotControl.model.dataSource.values[0].measures.push(droppedItem)):n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.fieldName==droppedItem.fieldName}).length==0&&(f=="row"?this.model.pivotControl.model.dataSource.rows.push(droppedItem):f=="column"?this.model.pivotControl.model.dataSource.columns.push(droppedItem):f=="filter"?this.model.pivotControl.model.dataSource.filters.push(droppedItem):this.model.pivotControl.model.dataSource.values.push(droppedItem));o=="XMLA"?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.show(),t.olap.base.getJSONData({action:"nodeCheck"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(this._trigger("fieldItemDropped",{axis:f,fieldItem:r.currentElement}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}else if(r.type=="nodeUncheck"){if(n(r.currentElement).removeClass("filter").find(".filter").remove(),n(r.currentElement).removeClass("filter").find(".treeDrop").remove(),this.model.pivotControl.model.dataSource.columns=n.grep(this.model.pivotControl.model.dataSource.columns,function(n){return n.fieldName!=e}),this.model.pivotControl.model.dataSource.rows=n.grep(this.model.pivotControl.model.dataSource.rows,function(n){return n.fieldName!=e}),w=this.model.pivotControl.model.dataSource.values,o=="XMLA")t.olap._mdxParser._getItemPosition(this.model.pivotControl.model.dataSource.values[0].measures,e).length>0&&this.model.pivotControl.model.dataSource.values[0].measures.splice(t.olap._mdxParser._getItemPosition(this.model.pivotControl.model.dataSource.values[0].measures,e)[0],1),this.model.pivotControl.model.dataSource.values[0].measures.length==0&&this.element.find("div[tag='"+(this.model.pivotControl.model.dataSource.values[0].axis=="columns"?"Columns":"Rows")+":Measures']").remove();else if(this.model.pivotControl.model.dataSource.values=n.grep(w,function(n){return n.fieldName!=e}),this.model.pivotControl._calculatedField.length>0)for(v=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(e)>-1}),u=0;u<v.length;u++)this._tableTreeObj.uncheckNode(v[u].fieldName);this.model.pivotControl.model.dataSource.filters=n.grep(this.model.pivotControl.model.dataSource.filters,function(n){return n.fieldName!=e});o=="XMLA"?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.show(),t.olap.base.getJSONData({action:"nodeUncheck"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(f=f==""?"row":f=="schemaColumn"?"column":f=="schemaRow"?"row":f=="schemaValue"?"value":f=="schemaFilter"?"filter":"",this._trigger("fieldItemDropped",{axis:f,fieldItem:r.currentElement}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}this._setPivotBtnWidth()},_calculatedFieldItems:function(i){var u,r;if(i.length>0)for(u=i[0].formula.replace(/\(|\)/g," ").replace(/[-+*/^%]/g," ").split(" "),r=0;r<u.length;r++)if(!n.isNumeric(u[r])&&u[r].replace(/\s+|\s+$/gm,"")!=""&&(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.fieldName==u[r]}).length==0||this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.FieldName==u[r]}).length==0))return alert(this.model.pivotControl._getLocalizedLabels("NotPresent")),this._tableTreeObj.model.nodeCheck=null,this._tableTreeObj.model.nodeUncheck=null,this._tableTreeObj.uncheckNode(i[0].name),this._tableTreeObj.model.nodeCheck=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._checkedStateModified,this):t.proxy(this._pivotCheckedStateModified,this),this._tableTreeObj.model.nodeUncheck=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._checkedStateModified,this):t.proxy(this._pivotCheckedStateModified,this),!0;return!1},_checkedStateModified:function(i){var nt,b,k,v,h,l,y,p,r,o,f,d,tt,w,u;if(this.model.pivotControl._isUpdateRequired=!0,this._isMeasureBtnRemove==!0)return this._isMeasureBtnRemove=!1,!1;if(this._nodeCheck==!0)return this._nodeCheck=!1,!1;var e=n(i.currentElement).find("a")[0].textContent,a="",g="",s="",r="",c="";if(this._dataModel!="Pivot"||i.type!="nodeCheck"||(nt=n.grep(this.model.pivotControl._calculatedField,function(t){return t.name==n(i.currentElement).attr("id")}),!this._calculatedFieldItems(nt))){if(this._dataModel=="Olap")if(!i.currentElement[0].id.indexOf("[Measures]")>-1){for(u=0;u<this.element.find(".pivotButton").length;u++)if(r=n(this.element.find(".pivotButton")[u]).attr("tag"),c="",c=r.indexOf("[Measures]")>-1||r.indexOf("[")>-1?r.split(":")[1]:this.model.pivotControl._getNodeUniqueName(r),c=c.replace("<>","."),n(i.currentElement).attr("tag").toLowerCase()==c.toLowerCase()){s=n(this.element.find(".pivotButton")[u]);break}}else s=this.element.find(".pivotButton:contains("+e+")"),r,o;else s=this.element.find(".pivotButton:contains("+e+")"),r,o;for(b=s.length>0&&n(s).siblings(".filterIndicator").length>0?!0:!1,k=i.currentElement.find("~ span:eq(0) span.descending").length>0?!0:!1,u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].name==e&&i.type=="nodeCheck"?(this.model.pivotTableFields[u].isSelected=!0,r=this.model.pivotTableFields[u]):this.model.pivotTableFields[u].name==e&&i.type=="nodeUncheck"&&(this.model.pivotTableFields[u].isSelected=!1,r=this.model.pivotTableFields[u]);if(t.isNullOrUndefined(r)&&(r=n(i.currentElement).attr("tag")),i.type=="nodeUncheck")if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this._clearFilterData(e),s.length>1)for(u=0;u<s.length;u++)n(s[u]).text()==e&&n(s[u]).remove();else n(s).remove();else this._droppedClass!=""?this._createPivotButton({fieldName:r.id,fieldCaption:e},this._droppedClass=="schemaColumn"?"column":this._droppedClass=="schemaRow"?"row":this._droppedClass=="schemaValue"?"value":this._droppedClass=="schemaFilter"?"filter":"",b,k,""):this._createPivotButton({fieldName:r.id,fieldCaption:e},this._dataModel=="Olap"&&n(i.currentElement).attr("tag").indexOf("[Measures]")<0||this._dataModel=="Pivot"&&r.pivotType=="PivotItem"?"row":"value",b,k,"");if(!t.isNullOrUndefined(this._tempFilterData))for(u=0;u<this._tempFilterData.length;u++)if(!t.isNullOrUndefined(this._tempFilterData[u][e]))for(v=0;v<this._tempFilterData[u][e].length;v++)g+="##"+this._tempFilterData[u][e][v];try{o=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(it){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(o=this.model.pivotControl.getOlapReport())}if(a="schemaRow::"+e+"::FILTERED"+g,h=this._droppedClass!=""?this._droppedClass:r.pivotType=="PivotItem"?"schemaRow":"schemaValue",this._droppedClass="",t.isNullOrUndefined(this.model.pivotControl)||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left}),i.type=="nodeCheck"||i.type=="nodeUncheck"||h==""){if(i.type=="nodeCheck")this._dataModel=="Olap"?(n(i.currentElement).attr("tag").indexOf("[Measures]")==-1&&(p=t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filter button").addClass("treeDrop")[0].outerHTML,n(i.currentElement.find(".e-text")[0]).after(n(p).hide())),this._nodeDropedParams=h=="schemaColumn"?"Categorical":h=="schemaRow"?"Series":h=="schemaFilter"?"Slicer":"",r=n(i.currentElement).attr("tag"),l=this._nodeDropedParams==""?n(i.currentElement).attr("tag").indexOf("[Measures]")>=0?"Categorical":"Series":this._nodeDropedParams,r.toLowerCase().indexOf("[measures]")>-1&&(l="Categorical"),y=this._currentCubeName+"--"+r+"--"+l+"--",o,this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:y,currentReport:o,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f,this._droppedSuccess)):(n(i.currentElement.find(".e-text")[0]).after(n(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filter button").addClass("treeDrop")[0].outerHTML).hide()),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:h+"::",sortedHeaders:this.model.pivotControl._ascdes,filterParams:a,currentReport:o,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess),t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f,this._nodeStateModifiedSuccess));else if(i.type=="nodeUncheck")if(this._dataModel=="Olap"){if(n(i.currentElement.find(".treeDrop")).remove(),n(i.currentElement).find(".filter").removeClass("filter"),r=n(s).attr("tag"),delete this.model.pivotControl._fieldMembers[r.split(":")[r.split(":").length-1]],delete this.model.pivotControl._fieldSelectedMembers[r.split(":")[r.split(":").length-1]],this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"removeButton",headerInfo:r,currentReport:o,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),t.isNullOrUndefined(r))return!1;(r.indexOf("[Measures]")>=0||r.toLowerCase().indexOf("[measures]"))&&this.element.find(".schemaValue .pivotButton").length==0?(d=r.split(":"),tt=d[0]=="Rows"?".schemaRow":d[0]=="Columns"?".schemaColumn":"",this.element.find(tt+" .pivotButton:contains('Measures')").remove()):r.indexOf("[Measures]")<0&&r.indexOf("Measures")>=0&&this.element.find(".schemaValue .pivotButton").remove();this.model.pivotControl.model.enableDeferUpdate?(this._removeButtonDeferUpdate=!0,this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,f.replace("removeButton","removeButtonDeferUpdate"),this._droppedSuccess)):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,f,this._pvtBtnDroppedSuccess)}else{if(this._clearFilterData(e),this.model.pivotControl._calculatedField.length>0)for(w=n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.CalculationType==8&&n.Formula.indexOf(r.id)>-1}),u=0;u<w.length;u++)this._tableTreeObj.model.nodeUncheck=null,this._tableTreeObj.uncheckNode(w[u].FieldName),this._tableTreeObj.element.find("li[id='"+w[u].FieldName+"']").removeClass("filter").find(".treeDrop").remove(),this._tableTreeObj.model.nodeUncheck=t.proxy(this._checkedStateModified,this);delete this.model.pivotControl._fieldMembers[r.name];n(i.currentElement).removeClass("filter").find(".filter").remove();n(i.currentElement).removeClass("filter").find(".treeDrop").remove();this.model.pivotControl._ascdes=this.model.pivotControl._ascdes.replace(e+"##","");this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject});f=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:h+"::",sortedHeaders:this.model.pivotControl._ascdes,filterParams:a,currentReport:o,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f,this._nodeStateModifiedSuccess)}}else this._dataModel=="Pivote"?(this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:h+"::"+this._droppedPosition,sortedHeaders:this.model.pivotControl._ascdes,filterParams:a,currentReport:o,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this._droppedPosition="",this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f,this._nodeStateModifiedSuccess)):(n(i.currentElement).attr("tag").toLowerCase().indexOf("[measures]")==-1&&(p=t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filter button").addClass("treeDrop")[0].outerHTML,n(i.currentElement.find(".e-text")[0]).after(n(p).hide())),r=n(i.currentElement).attr("tag"),l=this._nodeDropedParams==""?n(i.currentElement).attr("tag").toLowerCase().indexOf("[Measures]")>=0?"Categorical":"Series":this._nodeDropedParams,y=this._currentCubeName+"--"+r+"--"+l+"--",o,this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:y,currentReport:o,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f,this._droppedSuccess));this._setPivotBtnWidth()}},_clearFilterData:function(n){var i,r;if(!t.isNullOrUndefined(this._tempFilterData))for(i=0;i<this._tempFilterData.length;i++)for(r in this._tempFilterData[i])r==n&&this._tempFilterData[i][n]!=""&&this._tempFilterData.splice(i,1);this.model.pivotControl._tempFilterData=this._tempFilterData},_nodeDropped:function(r){var b,it,nt,et,ot,st,rt,k,ht,tt,u,o,d,l,p,w,h,y,ct,g,a;if(n(r.dropTarget).hasClass("pvtBtn")&&(r.dropTarget=n(r.dropTarget).parents("div.e-droppable").length>0&&n(r.dropTarget).parents(".e-pivotschemadesigner").length>0?n(r.dropTarget).parents("div.e-droppable"):r.dropTarget),n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot){var s="",f=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.pivotControl._dataModel!="XMLA"?n.grep(this.model.pivotTableFields,function(n){return n.caption==r.droppedElement.text()})[0].name:this._dataModel=="XMLA"?r.droppedElement.attr("tag"):r.droppedElement.text(),lt=n(r.droppedElement).attr("id"),ut=r.dropTarget.hasClass("schemaColumn")?"schemaColumn":r.dropTarget.hasClass("schemaRow")?"schemaRow":r.dropTarget.hasClass("schemaFilter")?"schemaFilter":r.dropTarget.hasClass("schemaValue")?"schemaValue":"";if(ut=="")return!1;h=this._setSplitBtnTargetPos(t.isNullOrUndefined(r.event)?r:r.event);try{v=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(vt){v=this.model.pivotControl.getOlapReport()}for(t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),u=0;u<this.model.pivotTableFields.length;u++)if(this.model.pivotTableFields[u].name==f){this.model.pivotTableFields[u].isSelected=!0;s=this.model.pivotTableFields[u];break}a=JSON.stringify({action:this.model.pivotControl.model.enableDeferUpdate?"nodeDroppedDeferUpdate":"nodeDropped",args:JSON.stringify({droppedFieldCaption:f,droppedFieldName:lt,headerTag:s,dropAxis:ut,droppedPosition:h,currentReport:v}),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a,this._pvtNodeDroppedSuccess);this._isDragging=!1;return}if(this.model.pivotControl._isUpdateRequired=!0,r.dropTarget[0]!=i||r.dropTarget.className!=i){if(b=!1,this._dataModel=="Pivot")for(it=n(r.dropTarget).parents(),u=0;u<it.length;u++)n(it[u]).hasClass("e-pivotgrid")&&(b=!0);if(r.dropTarget.hasClass("e-droppable")||r.dropTarget[0]!=i&&r.dropTarget[0].className.indexOf("e-droppable")>=0||r.dropTarget.className!=i&&r.dropTarget.className.indexOf("e-droppable")>=0||b){this._isDragging=!1;this.element.find(".dropIndicator").removeClass("dropIndicatorHover");var s=n(r.droppedElement).attr("tag"),f=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.pivotControl._dataModel!="XMLA"?n.grep(this.model.pivotTableFields,function(n){return n.caption==r.droppedElement.text()})[0].name:this._dataModel=="XMLA"?r.droppedElement.attr("tag"):r.droppedElement.text(),at="",v,c=this.element.find(".pivotButton:contains("+f+")"),e=this._dataModel=="XMLA"?this._tableTreeObj.element.find("li[tag='"+s+"']").length>1?r.droppedElement:this._tableTreeObj.element.find("li[tag='"+s+"']"):this._dataModel=="Pivot"&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this._tableTreeObj.element.find("li[id="+f+"]"):this._dataModel=="Pivot"?this._tableTreeObj.element.find("li:contains('"+f+"'):last"):this._tableTreeObj.element.find("li[tag='"+s+"']"),y=n(c).find(".filterIndicator").length>0?!0:!1,ft=n(c).find("~ span:eq(0) span.descending").length>0?!0:!1;if(r.dropTarget.parent().attr("role")=="presentation")return!1;if(this.model.pivotControl._dataModel=="XMLA"){if(nt=n.map(n(s.split("].")),function(n){return n.lastIndexOf("]")>=0?n:n+"]"}),nt.length>=2&&(et=nt[0]+"."+nt[1],e=this._tableTreeObj.element.find("li[tag='"+et+"']"),s=e.attr("tag")),ot=n(r.dropTarget).hasClass("value")||n(r.dropTarget).hasClass("colheader")||n(r.dropTarget).hasClass("rowheader")||n(r.dropTarget).hasClass("summary")||n(r.dropTarget).parents("table:eq(0)").hasClass("pivotGridTable")||n(r.dropTarget).parents(".groupingBarPivot").length>0,st=r.droppedElement.find(".namedSetCDB").length>0&&n(r.dropTarget).hasClass("schemaFilter"),ot||st||n(r.droppedElement).attr("tag").toLowerCase().indexOf("measures")>=0&&!n(r.dropTarget).hasClass("schemaValue")||n(r.droppedElement).attr("tag").indexOf("Measures")<0&&n(r.dropTarget).hasClass("schemaValue"))return this._createErrorDialog(),pschemaDesignerWaitingPopup.hide(),!1;if(rt=t.Pivot.getReportItemByFieldName(s,this.model.pivotControl.model.dataSource,this._dataModel),k=rt.axis,!(e.length>1)&&rt.item.length>0&&(k=="rows"&&r.dropTarget.hasClass("schemaRow")||k=="columns"&&r.dropTarget.hasClass("schemaColumn")||k=="values"&&n(r.dropTarget).hasClass("schemaValue")||k=="filters"&&n(r.dropTarget).hasClass("schemaFilter")))return!1;if(e.length>1&&r.droppedElement.find(".kpiValue").length>0&&(e=e.find(".kpiValue").parents("li:eq(0)")),this._tableTreeObj.isNodeChecked(e))for(u=0;u<this.element.find(".pivotButton").length;u++)this.element.find(".pivotButton:eq("+u+")").attr("tag").split(":")[1]==s?this.element.find(".pivotButton:eq("+u+")").remove():""}else if(this._dataModel=="Olap"&&(n(r.droppedElement).attr("tag").indexOf("Measures")>=0&&(n(r.dropTarget).hasClass("schemaFilter")||n(r.dropTarget).hasClass("drag"))||n(r.droppedElement).attr("tag").indexOf("Measures")<0&&n(r.dropTarget).hasClass("schemaValue")))return this._createErrorDialog(),pschemaDesignerWaitingPopup.hide(),!1;if(n(e).find(".filter").remove(),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)for(c=[],u=0;u<this.element.find(".pivotButton").length;u++)uniqueName=n(this.element.find(".pivotButton")[u]).find("button").attr("fieldName"),uniqueName==f&&c.push(this.element.find(".pivotButton")[u]);if(b)if(r.event.target.tagName=="TH"||r.event.target.tagName=="TD"||n(r.event.target).hasClass("cellValue")&&(n(r.event.target).parent("th").length>0||n(r.event.target).parent("td").length>0)){if(n(r.event.target).hasClass("cellValue")&&(n(r.event.target).parent("th").length>0?r.event.target=n(r.event.target).parent("th")[0]:n(r.event.target).parent("td").length>0&&(r.event.target=n(r.event.target).parent("td")[0])),this._droppedClass=r.event.target.className.split(" ")[0]=="rowheader"||r.event.target.className.split(" ")[0]=="grpRow"?"schemaRow":r.event.target.className.split(" ")[0]=="colheader"?"schemaColumn":n(r.event.target).hasClass("value")?"schemaValue":"",this._droppedClass=="")return}else this._droppedClass=r.event.target.className.split(" ")[0]=="rows"||r.event.target.className.split(" ")[0]=="emptyRows"?"schemaRow":r.event.target.className.split(" ")[0]=="columns"?"schemaColumn":r.event.target.className.split(" ")[0]=="values"?"schemaValue":r.event.target.className.split(" ")[0]=="drag"?"schemaFilter":"";else this._droppedClass=t.isNullOrUndefined(r.event)?r.dropTarget.hasClass("schemaColumn")?"schemaColumn":r.dropTarget.hasClass("schemaRow")?"schemaRow":r.dropTarget.hasClass("schemaFilter")?"schemaFilter":r.dropTarget.hasClass("schemaValue")?"schemaValue":"":r.event.target.className.split(" ")[0];if(this._dataModel=="Olap"&&(ht=n(r.droppedElement).children("div:eq(0)").find(".e-checkbox").length,e=ht==0?r.droppedElement.parent("ul").parent("li:eq(0)"):r.droppedElement),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._dataModel=="Pivot"&&this._droppedClass!="schemaValue"&&(n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e.attr("id")}).length>0||n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.FieldName==e.attr("id")&&n.CalculationType==8}).length>0)){this.model.pivotControl._createErrorDialog(this.model.pivotControl._getLocalizedLabels("CalcValue"),this.model.pivotControl._getLocalizedLabels("Warning"));return}if(e.find(".e-chk-inact").length>0&&this._droppedClass!=""&&(this._droppedClass=="schemaRow"||this._droppedClass=="schemaColumn"||this._droppedClass=="schemaFilter"||this._droppedClass=="schemaValue"))return this._tableTreeObj.checkNode(e),!1;if(e.find(".e-chk-inact").length>0&&this._droppedClass!=""&&(this._droppedClass=="pvtBtn"||this._droppedClass=="rowheader"||this._droppedClass=="colheader"||this._droppedClass=="value"&&n(r.droppedElement).attr("tag").indexOf("Measures")<0)&&(this._nodeCheck=!0,this._tableTreeObj.checkNode(e)),t.isNullOrUndefined(s))for(u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].name==f&&(this.model.pivotTableFields[u].isSelected=!0,s=this.model.pivotTableFields[u]);if(!t.isNullOrUndefined(this._tempFilterData))for(u=0;u<this._tempFilterData.length;u++)if(!t.isNullOrUndefined(this._tempFilterData[u][f]))for(tt=0;tt<this._tempFilterData[u][f].length;tt++)at+="##"+this._tempFilterData[u][f][tt];if(r.droppedElement[0].tagName.toLowerCase()=="button")if(c.length>1)for(u=0;u<c.length;u++)n(c[u]).text()==f&&n(c[u]).remove();else n(c).remove();try{v=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(vt){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(v=this.model.pivotControl.getOlapReport())}if(this.model.pivotControl._dataModel=="XMLA"&&(v=this.model.pivotControl.model.dataSource),this._dataModel=="Pivot"||this.model.pivotControl._dataModel=="XMLA"){for(f=this.model.pivotControl._dataModel=="XMLA"?s:f,h="",h=b?this._droppedPosition="":t.isNullOrUndefined(r.event)?"":this._droppedPosition=this._setSplitBtnTargetPos(r.event),u=0;u<this.model.pivotTableFields.length;u++)if(this.model.pivotTableFields[u].name==f){this.model.pivotTableFields[u].isSelected=!0;s=this.model.pivotTableFields[u];n(c).remove();break}if(e.find(".e-chk-inact").length>0&&this._droppedClass!=""&&(this._droppedClass=="schemaRow"||this._droppedClass=="schemaColumn"||this._droppedClass=="schemaFilter"||this._droppedClass=="schemaValue"))this._tableTreeObj.checkNode(e);else if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(o=this.model.pivotControl._getDroppedItem(f),o.length&&o[0].filterItems&&o[0].filterItems.values&&o[0].filterItems.values.length&&n(n(e).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),o.length||(o[0]={fieldName:f,fieldCaption:this._dataModel=="XMLA"&&e.find(".hierarchyCDB ").length>0?e.find("div:eq(0)").text():f}),this.model.pivotControl.model.dataSource.columns=n.grep(this.model.pivotControl.model.dataSource.columns,function(n){return n.fieldName!=f}),this.model.pivotControl.model.dataSource.rows=n.grep(this.model.pivotControl.model.dataSource.rows,function(n){return n.fieldName!=f}),this._dataModel!="XMLA"?this.model.pivotControl.model.dataSource.values=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.fieldName!=f}):this.model.pivotControl.model.dataSource.values[0].measures=n.grep(this.model.pivotControl.model.dataSource.values[0].measures,function(n){return n.fieldName!=f}),this.model.pivotControl.model.dataSource.filters=n.grep(this.model.pivotControl.model.dataSource.filters,function(n){return n.fieldName!=f}),d=this._droppedClass=="schemaRow"?"row":this._droppedClass=="schemaColumn"?"column":this._droppedClass=="schemaFilter"?"filter":this._droppedClass=="schemaValue"?"value":"",this.model.pivotControl._dataModel=="Pivot"&&n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==o[0].fieldCaption}).length>0&&d!="value"){alert(this.model.pivotControl._getLocalizedLabels("CalcValue"));this._tableTreeObj.checkNode(o[0].fieldCaption);return}this._createPivotButton(o[0],d,y,ft,h);n.isNumeric(h)?this._droppedClass=="schemaRow"?this.model.pivotControl.model.dataSource.rows.splice(h,0,o[0]):this._droppedClass=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.splice(h,0,o[0]):this._droppedClass=="schemaValue"?this.model.pivotControl._dataModel=="XMLA"?this.model.pivotControl.model.dataSource.values[0].measures.splice(h,0,o[0]):this.model.pivotControl.model.dataSource.values.splice(h,0,o[0]):this.model.pivotControl.model.dataSource.filters.splice(h,0,o[0]):this._droppedClass=="schemaRow"?this.model.pivotControl.model.dataSource.rows.push(o[0]):this._droppedClass=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.push(o[0]):this._droppedClass=="schemaValue"?this.model.pivotControl._dataModel=="XMLA"?this.model.pivotControl.model.dataSource.values[0].measures.push(o[0]):this.model.pivotControl.model.dataSource.values.push(o[0]):this.model.pivotControl.model.dataSource.filters==null?(this.model.pivotControl.model.dataSource.filters=[],this.model.pivotControl.model.dataSource.filters.push(o[0])):this.model.pivotControl.model.dataSource.filters.push(o[0]);this.model.pivotControl._dataModel=="Pivot"&&this.model.pivotControl._calculatedField.length>0&&d!="value"&&(this.model.pivotControl._calcFieldNodeDrop(o[0]),this.model.pivotControl.model.dataSource.values=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(o[0].fieldName)==-1}));this.model.pivotControl._dataModel=="XMLA"?(this._droppedClass=="schemaFilter"&&(this.model.pivotControl.model.dataSource.filters=n.map(this.model.pivotControl.model.dataSource.filters,function(n){return n.advancedFilter=[],n})),t.olap.base.getJSONData({action:"nodeDropped"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(this._trigger("fieldItemDropped",{axis:d,fieldItem:e}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}else y=!1,this._tempFilterData!=null&&n.each(this._tempFilterData,function(t,i){n.each(i,function(t,i){t==n(e).attr("id")&&i.length>0&&(y=!0)})}),y&&n(n(e).find(".e-text")[0]).after(t.buildTag("span.e-icon").addClass("filter")[0].outerHTML),this._dataModel=="Pivot"&&this.model.pivotControl._calculatedField.length>0&&this._droppedClass!="schemaValue"&&this.model.pivotControl._calculatedFieldNodeRemove(s),this._createPivotButton({fieldName:s.id,fieldCaption:f},this._droppedClass=="schemaRow"?"row":this._droppedClass=="schemaColumn"?"column":this._droppedClass=="schemaFilter"?"filter":this._droppedClass=="schemaValue"?"value":"",y,ft,h),g="",g=t.Pivot._getFilterParams(this._droppedClass,this._tempFilterData,f),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),a=JSON.stringify({action:"nodeDropped",dropAxis:this._droppedClass+"::"+h,filterParams:g,headerTag:JSON.stringify(s),sortedHeaders:this.model.pivotControl._ascdes,currentReport:v,valueSorting:this.model.pivotControl.model.valueSortSettings,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left}),this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtNodeDroppedSuccess),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a,this._pvtNodeDroppedSuccess)}else{if(l=r.dropTarget[0]!=i&&r.dropTarget[0].className=="pivotButton"?n(r.dropTarget).parents()[0]:r.dropTarget[0]!=i&&r.dropTarget[0].tagName.toLowerCase()=="td"&&!n(r.dropTarget.parents("table.pivotGridTable")[0]).length?r.dropTarget.children(":last")[0]:r.dropTarget,this._droppedClass=l[0].className.split(" ")[0],p="",w="",p=l[0].className.split(" ")[0],n(r.dropTarget.parents("table.pivotGridTable")[0]).length){if(w=n(l).hasClass("rowheader")?"Series":n(l).hasClass("grpRow")?"Series":n(l).hasClass("rows")?"Series":n(l).hasClass("colheader")?"Categorical":n(l).hasClass("columns")?"Categorical":n(l).hasClass("value")?"Slicer":n(l).hasClass("drag")?"Slicer":"",n(r.droppedElement).attr("tag").indexOf("Measures")>0&&w=="Slicer")return this._createErrorDialog(),!1}else w=p=="columns"?"Categorical":p=="schemaColumn"?"Categorical":p=="rows"?"Series":p=="schemaRow"?"Series":p=="drag"?"Slicer":p=="schemaFilter"?"Slicer":"";w==""&&(w=this.element.find(".schemaRow .pivotButton:contains('Measures')").length>0||this.element.find(".schemaRow .pivotButton:contains('MEASURES')").length>0?"Series":"Categorical");h=t.isNullOrUndefined(r.event)?"":this._setSplitBtnTargetPos(r.event);y=!1;this.model.pivotControl._tempFilterData!=null&&n.each(this.model.pivotControl._tempFilterData,function(t,i){n.each(i,function(n,t){n==s.replace(/[\[\]']/g,"")&&t.length>0&&(y=!0)})});y&&n(n(e).find(".e-text")[0]).after(t.buildTag("span.e-icon").addClass("filter")[0].outerHTML);ct=this._currentCubeName+"--"+s+"--"+w+"--"+h;g="";this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject});a=JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:ct,filterParams:g,currentReport:v,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.model.pivotControl.model.enableDeferUpdate||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show();this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a,this._droppedSuccess)}}this._setPivotBtnWidth()}},_addTreeDropIcon:function(i){this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(n(args.currentElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&!(n(args.currentElement).find(".namedSetCDB").length>0)?i.after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML):i.after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML))},_clientPivotCheckedStateModified:function(i){var r,u,f,e;(t.PivotAnalysis._valueSorting=null,this._isDropAction)||(r="",t.isNullOrUndefined(this.model.pivotControl)||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),r=this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?n.grep(this.model.pivotTableFields,function(t){return t.name==n(i.currentElement).attr("id")})[0].name:n(i.currentElement).attr("tag"):n(i.currentElement).find("a")[0].textContent,i.type=="nodeUncheck"?(delete this.model.pivotControl._fieldMembers[r.toLowerCase()],delete this.model.pivotControl._fieldSelectedMembers[r.toLowerCase()],t.Pivot.removeReportItem(this.model.pivotControl.model.dataSource,r,!1),n(i.currentElement).removeClass("filter").find(".treeDrop,.filter").remove()):(u="row",this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&n(i.currentElement).attr("tag").toLocaleLowerCase().indexOf("[measures]")>=0&&(u="value"),(this.model.pivotControl.model.analysisMode!=t.Pivot.AnalysisMode.Olap||n(i.currentElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&n(i.currentElement).find(".namedSetCDB").length==0)&&n(i.currentElement.find(".e-text")).after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML),f=n(i.currentElement).find("a")[0].textContent,e={droppedFieldName:r,droppedFieldCaption:f,droppedClass:u,droppedPosition:"",isMeasuresDropped:r.toLocaleLowerCase().indexOf("measures")==0},t.Pivot.addReportItem(this.model.pivotControl.model.dataSource,e)),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl),this._refreshPivotButtons(),this.model.pivotControl.refreshControl(),this._setPivotBtnWidth())},_clientOnNodeDropped:function(i){var o,u,s,e,r,h,c,l,v;if(t.PivotAnalysis._valueSorting=null,this._isDragging=!1,o=!1,schemaObj=this,u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(s=n(i.dropTarget).parents(),e=0;e<s.length;e++)s[e].className.split(" ")[0]=="e-pivotgrid"&&(o=!0);var f=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?n.grep(this.model.pivotTableFields,function(n){return n.name==i.droppedElement.attr("id")})[0].name:i.droppedElement.attr("defaulthierarchy")||(n(i.droppedElement).find("a:eq(0) span[class^='level'],div[class*='level']").length>0?n(i.droppedElement).parents("li:eq(0)").attr("tag"):i.droppedElement.attr("tag")),a=n(i.droppedElement).find("div:first").text(),r="";if(r=n(i.dropTarget).hasClass("pvtBtn")||n(i.dropTarget).hasClass("pivotButton")?n(i.dropTarget).parents("div.e-droppable").hasClass("schemaColumn")?"column":n(i.dropTarget).parents("div.e-droppable").hasClass("schemaRow")?"row":n(i.dropTarget).parents("div.e-droppable").hasClass("schemaFilter")?"filter":n(i.dropTarget).parents("div.e-droppable").hasClass("schemaValue")?"value":"":i.dropTarget.hasClass("schemaColumn")?"column":i.dropTarget.hasClass("schemaRow")?"row":i.dropTarget.hasClass("schemaFilter")?"filter":i.dropTarget.hasClass("schemaValue")?"value":"",o&&(r=n(i.dropTarget).prop("tagName")=="TH"||n(i.dropTarget).prop("tagName")=="TD"?n(i.dropTarget).hasClass("rowheader")||n(i.dropTarget).hasClass("grpRow")?"row":n(i.dropTarget).hasClass("colheader")?"column":n(i.dropTarget).hasClass("value")?"value":"":n(i.dropTarget).hasClass("rows")||n(i.dropTarget).hasClass("emptyRows")?"row":n(i.dropTarget).hasClass("columns")?"column":n(i.dropTarget).hasClass("values")?"value":n(i.dropTarget).hasClass("drag")?"filter":""),r=="")return!1;if(h=t.isNullOrUndefined(i.event)?"":this._setSplitBtnTargetPos(i.event),c=n(i.dropTarget).hasClass("value")||n(i.dropTarget).hasClass("colheader")||n(i.dropTarget).hasClass("rowheader")||n(i.dropTarget).hasClass("summary")||n(i.dropTarget).parents("table:eq(0)").hasClass("pivotGridTable")||n(i.dropTarget).parents(".groupingBarPivot").length>0,f.toLowerCase().indexOf("[measures]")>=0&&r!="value"||f==this._getLocalizedLabels("Measures")&&r!="row"&&r!="column"||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&f.toLowerCase().indexOf("[measures]")<0&&r=="value"||c&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){this._createErrorDialog();return}this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.pivotControl._fieldMembers={},this.model.pivotControl._fieldSelectedMembers={},f.toLowerCase().indexOf("[measures")>=0&&(this.model.pivotControl.model.dataSource.values[0].axis=r=="column"?"columns":r=="row"?"rows":this.model.pivotControl.model.dataSource.values[0].axis,r="value"));t.isNullOrUndefined(u)?this.model.pivotControl._waitingPopup.show():(u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));l={droppedFieldName:f,droppedFieldCaption:a,droppedClass:r,droppedPosition:h,isMeasuresDropped:f.toLocaleLowerCase().indexOf("measures")==0};t.Pivot.addReportItem(this.model.pivotControl.model.dataSource,l);this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl);this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl._pivotChart&&(this.model.pivotControl._pivotChart._labelCurrentTags={});v=i.droppedElement;this._isDropAction=!0;r==""?this._tableTreeObj.uncheckNode(i.droppedElement):(n(i.droppedElement).find(".treeDrop").length==0&&this.element.parents(".e-pivotclient").length==0&&(this.model.pivotControl.model.analysisMode!=t.Pivot.AnalysisMode.Olap||n(i.droppedElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&n(i.droppedElement).find(".namedSetCDB").length==0)&&n(i.droppedElement.find(".e-text")).after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML),this._tableTreeObj.checkNode(i.droppedElement));this._isDropAction=!1;this._refreshPivotButtons();this.model.pivotControl.refreshControl();this._setPivotBtnWidth();t.isNullOrUndefined(u)||u._isTimeOut&&(u._isTimeOut=!1)},_clientOnPvtBtnDropped:function(i){var f,r,c,u,l,a,o,s,e,v,h;if(t.PivotAnalysis._valueSorting=null,schemaObj=this,f=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(this.model.pivotControl)||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)?this.model.pivotControl._waitingPopup.show():(f._isTimeOut=!0,setTimeout(function(){f._isTimeOut&&f.element.find(".errorDialog:visible").length==0&&schemaObj.model.pivotControl._waitingPopup.show()},800))),n(i.target).hasClass("removeClientPivotBtn")&&(i.target=n(i.target).parent()),this._isDragging=!1,n("#"+this._id+"_dragClone").remove(),r="",r=this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?n.grep(this.model.pivotTableFields,function(t){return t.name==n(i.element).attr("fieldName")})[0].name:n(i.element).attr("fieldName"):i.element.text(),c=i.element.text(),t.isNullOrUndefined(this.model.pivotControl._fieldMembers)||(delete this.model.pivotControl._fieldMembers[r.toLowerCase()],delete this.model.pivotControl._fieldSelectedMembers[r.toLowerCase()]),u="",u=n(i.target).hasClass("pvtBtn")||this.element.parents(".e-pivotclient").length>0&&n(i.target).hasClass("pivotButton")?n(i.target).parents("div.e-droppable").hasClass("schemaColumn")?"column":n(i.target).parents("div.e-droppable").hasClass("schemaRow")?"row":n(i.target).parents("div.e-droppable").hasClass("schemaFilter")?"filter":n(i.target).parents("div.e-droppable").hasClass("schemaValue")?"value":"":n(i.target).hasClass("schemaColumn")?"column":n(i.target).hasClass("schemaRow")?"row":n(i.target).hasClass("schemaFilter")?"filter":n(i.target).hasClass("schemaValue")?"value":"",r.toLowerCase().indexOf("[measures]")>=0&&u!="value"&&(u=="row"||u=="column"||u=="filter")||r==this._getLocalizedLabels("Measures")&&u!="row"&&u!="column"&&(u=="value"||u=="filter")||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&r.toLowerCase().indexOf("[measures]")<0&&u=="value"){this._createErrorDialog();i.element.removeClass("dragHover").parent().removeClass("dragHover");return}if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl._calculatedField!=null&&u!="value"&&n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==r}).length>0){t.Pivot._createErrorDialog(this.model.pivotControl._getLocalizedLabels("CalcValue"),this.model.pivotControl._getLocalizedLabels("Warning"),this);i.element.removeClass("dragHover").parent().removeClass("dragHover");this.element.find(".dropIndicator").removeClass("dropIndicatorHover");this.model.pivotControl._waitingPopup.hide();return}if(l=t.isNullOrUndefined(i.event)?"":this._setSplitBtnTargetPos(i.event),a={droppedFieldName:r,droppedFieldCaption:c,droppedClass:u,droppedPosition:l,isMeasuresDropped:r.toLocaleLowerCase().indexOf("measures")==0},this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(r==this._getLocalizedLabels("Measures")||r=="[Measures]")&&(o=this.model.pivotControl.model.dataSource.values[0].measures),t.Pivot.addReportItem(this.model.pivotControl.model.dataSource,a),this.model.pivotControl._calculatedField!=null&&this.model.pivotControl._calculatedField.length>0&&u!="value")for(s=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(r)>-1}),e=0;e<s.length;e++)this._tableTreeObj.uncheckNode(s[e].fieldName);this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl._calculatedField!=null&&this.model.pivotControl._calculatedField.length>0&&(v=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0}),this.model.pivotControl.model.dataSource.values=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1}),n.merge(this.model.pivotControl.model.dataSource.values,v));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.pivotControl._fieldMembers={},this.model.pivotControl._fieldSelectedMembers={},t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl));this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl._pivotChart&&(this.model.pivotControl._pivotChart._labelCurrentTags={});u==""&&(this._isDropAction=!0,this._tableTreeObj.element.find("li[tag='"+r+"']").removeClass("filter").find(".treeDrop,.filter").remove(),t.isNullOrUndefined(o)?this._tableTreeObj.uncheckNode(this._tableTreeObj.element.find("li[tag='"+r+"']")):(h=this,n.grep(o,function(n){h._tableTreeObj.uncheckNode(h._tableTreeObj.element.find("li[tag='"+n.fieldName+"']"))})),this._isDropAction=!1);this._refreshPivotButtons();this.model.pivotControl.refreshControl();this._setPivotBtnWidth()},_refreshPivotButtons:function(){this.element.find(".axisTable .schemaFilter").html(this._createPivotButtons("filters",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.filters:JSON.parse(this.model.pivotControl.getOlapReport()).Filters));this.element.find(".axisTable .schemaRow").html(this._createPivotButtons("rows",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.rows:JSON.parse(this.model.pivotControl.getOlapReport()).PivotRows));this.element.find(".axisTable .schemaColumn").html(this._createPivotButtons("columns",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.columns:JSON.parse(this.model.pivotControl.getOlapReport()).PivotColumns));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.dataSource.values.length>0&&!t.isNullOrUndefined(this.model.pivotControl.model.dataSource.values[0].measures)&&this.model.pivotControl.model.dataSource.values[0].measures.length>0&&(this.model.pivotControl.model.dataSource.values[0].axis=="columns"?this.element.find(".axisTable .schemaColumn").append(this._createPivotButtons("columns",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}])):this.model.pivotControl.model.dataSource.values[0].axis=="rows"&&this.element.find(".axisTable .schemaRow").append(this._createPivotButtons("rows",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}])));this.element.find(".axisTable .schemaValue").html(this._createPivotButtons("values",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.values:JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations));this.model.enableDragDrop&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)});this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&this.element.find(".pvtBtn").css("max-width",this.element.find(".schemaColumn").width()-this.element.find(".removeClientPivotBtn").width()-6);this._createContextMenu();this.model.pivotControl.model.isResponsive&&this.model.pivotControl.model.enableSplitter&&!t.isNullOrUndefined(this.model.pivotControl.element.find(".splitresponsive").data("ejSplitter"))&&this.model.pivotControl.element.find(".splitresponsive").data("ejSplitter").refresh();this._setSplitButtonTitle();this.model.pivotControl.model.showUniqueNameOnPivotButton&&n(".pvtBtnDiv").addClass("schemaBtnUnique");this.element.parents(".e-pivotclient").length>0||this._setPivotBtnWidth()},_setSplitButtonTitle:function(){var i,r,f,u;if(this.element.find(".pvtBtn").length>0&&this._tableTreeObj!=null)for(i=0;i<this.element.find(".pvtBtn").length;i++)r=this.element.find(".pvtBtn:eq("+i+")").attr("fieldname"),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(f=this._tableTreeObj.element.find("li[tag='"+r+"']").parents("li:eq(0)").find("a:eq(0)").text(),u=this.element.find(".pvtBtn:eq("+i+")").text(),r.toLowerCase().indexOf("measures")>=0?this.element.find(".pvtBtn:eq("+i+")").attr("title",u):this.element.find(".pvtBtn:eq("+i+")").attr("title",f+" - "+u)):this.element.find(".pvtBtn:eq("+i+")").attr("title",n.grep(this.model.pivotTableFields,function(n){return n.name==r})[0].caption)},_createPivotButtons:function(r,u){var h="",a=r,r,f,e;if(t.isNullOrUndefined(this.model.pivotControl)||this.model.pivotControl.model.operationalMode!=t.Pivot.OperationalMode.ClientMode)for(r=="values"&&(r=this.element.find(".pivotButton:contains("+this._getLocalizedLabels("Measures")+")").length>0?this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").parent()[0].className.split(" ")[0]:"schemaColumn",r=r=="schemaColumn"?"columns":"rows"),f=0;f<u.length;f++)e="",t.isNullOrUndefined(this.model.pivotControl)||r!="filters"&&r!="slicers"||(e=t.Pivot._getFilterState("",[],u[f],this.model.pivotControl),r=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"slicers":r),h+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+(n(this.element).parents(".e-pivotclient").length>0?t.buildTag("button.pvtBtn#pivotButton"+(u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name),(this.model.pivotControl.model.showUniqueNameOnPivotButton?r!="values"?u[f].Tag:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name)+((r=="filters"||r=="slicers")&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f].FieldHeader||u[f].DimensionHeader||u[f].DimensionName||u[f].Name||u[f],fieldCaption:u[f].FieldHeader||u[f].FieldName||u[f].DimensionName||u[f].DimensionHeader,axis:r})[0].outerHTML:t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+(u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name),(this.model.pivotControl.model.showUniqueNameOnPivotButton?a!="values"?u[f].Tag:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name)+((r=="filters"||r=="slicers")&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f].FieldHeader||u[f].DimensionHeader||u[f].DimensionName||u[f].Name||u[f],fieldCaption:u[f].FieldHeader||u[f].FieldName||u[f].DimensionName||u[f].DimensionHeader,axis:r})[0].outerHTML).attr("tag",r+":"+u[f].Tag)[0].outerHTML)+t.buildTag("span."+(this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?"removeClientPivotBtn":"removePivotBtn"),{},{display:this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne?"none":"inline-block"}).addClass("e-icon")[0].outerHTML).attr("tag",r+":"+u[f].Tag)[0].outerHTML;else for(r=="values"&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(u=n.map(u,function(n){return n.measures})),f=0;f<u.length;f++){var l=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"":u[f].fieldName,o=n.grep(this.model.pivotTableFields,function(n){return n.name==u[f].fieldName}),s=n.grep(this.model.pivotTableFields,function(n){return n.name==u[f]});o.length>0&&(o=o[0].caption);s.length>0&&(s=s[0].caption);var e="",c=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?!0:!1,v=c?"":t.PivotAnalysis.getMembers(u[f].fieldName),y=u[f].filterItems!=null&&u[f].filterItems.values.length>0?"filtered":"";r=="filters"&&(y=="filtered"?e=t.Pivot._getFilterState(c,v,u[f],this.model.pivotControl):c?(t.olap._mdxParser.getAllMember(this.model.pivotControl.model.dataSource,u[f].fieldName,this.model.pivotControl),e=this.model.pivotControl._allMember):e=this.model.pivotControl._getLocalizedLabels("All"));h+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+(n(this.element).parents(".e-pivotclient").length>0?t.buildTag("button.pvtBtn#pivotButton"+l,(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.showUniqueNameOnPivotButton?r!="values"?u[f].fieldName.replace(/\[/g,"").replace(/\]/g,""):(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:o||s)+(r=="filters"&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f],fieldCaption:u[f].fieldCaption||u[f].fieldName,axis:r})[0].outerHTML:t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+l,(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.showUniqueNameOnPivotButton?r!="values"?u[f].fieldName.replace(/\[/g,"").replace(/\]/g,""):(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:o||s)+(r=="filters"&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f],fieldCaption:u[f].fieldCaption||u[f].fieldName,axis:r})[0].outerHTML).attr("tag",r+":"+u[f].fieldName)[0].outerHTML)+t.buildTag("span."+(this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?"removeClientPivotBtn":"removePivotBtn"),{},{display:this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne?"none":"inline-block"}).addClass("e-icon")[0].outerHTML).attr("tag",r+":"+u[f].fieldName||u[f])[0].outerHTML}return h},_pvtBtnDropped:function(r){var s,h,tt,a,l,it,w,b,f,k,d,rt,g,o,ut,nt,et;if(this.element.find(".dropIndicator").removeClass("dropIndicatorHover"),n(r.element).parent().removeClass("dragHover"),n(r.element).removeClass("dragHover"),n("#"+this._id+"_dragClone").remove(),s="",this._isDragging=!1,n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot){n(r.target).hasClass("pivotButton")&&(r.target=r.target.childNodes[1]);var u=t.isNullOrUndefined(r.target.className.indexOf)?"":n(r.target).attr("class")?r.target.className.indexOf("e-droppable")>=0?r.target.className.split(" ")[0]:r.target.className.split(" ")[0]=="pvtBtn"?n(r.target).parents("div.e-droppable").attr("class").split(" ")[0]:"":"",e=r.element.attr("fieldcaption")||r.element.attr("fieldname"),a,ft=r.element.parent().attr("tag").split(":")[1],h=t.isNullOrUndefined(r.event)?"":this._setSplitBtnTargetPos(r.event);for(o=0;o<this.model.pivotTableFields.length;o++)if(this.model.pivotTableFields[o].name==e){this.model.pivotTableFields[o].isSelected=!0;s=this.model.pivotTableFields[o];break}try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(ot){a=this.model.pivotControl.getOlapReport()}t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show();l=JSON.stringify({action:this.model.pivotControl.model.enableDeferUpdate?"nodeDroppedDeferUpdate":"nodeDropped",args:JSON.stringify({droppedFieldCaption:e,droppedFieldName:ft,headerTag:s,dropAxis:u,droppedPosition:h,currentReport:a,sortedHeaders:t.isNullOrUndefined(this.model.pivotControl._ascdes)?"":this.model.pivotControl._ascdes}),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l,this._pvtNodeDroppedSuccess);return}this.model.pivotControl._isUpdateRequired=!0;this._isDragging=!1;var c=null,v="",e,u,y=y=r.element.find("~ .filtered").length>0?!0:!1,p=!1;if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap)c=t.isNullOrUndefined(r.target.className)?r.target:r.target.className.indexOf("pvtBtn")>-1?n(r.target).parents(".e-droppable")[0]:r.target.className.indexOf("e-droppable")?r.target:r.target[0].tagName.toLowerCase()=="td"?r.target.children(":last")[0]:r.target,t.isNullOrUndefined(c.className)?(v=c.hasClass("schemaColumn")?"Categorical":c.hasClass("schemaRow")?"Series":c.hasClass("schemaFilter")?"Slicer":"",this._droppedClass=u=c.hasClass("schemaColumn")?"schemaColumn":c.hasClass("schemaRow")?"schemaRow":c.hasClass("schemaFilter")?"schemaFilter":c.hasClass("schemaValue")?"schemaValue":""):(v=c.className.split(" ")[0]=="schemaColumn"?"Categorical":c.className.split(" ")[0]=="schemaRow"?"Series":c.className.split(" ")[0]=="schemaFilter"?"Slicer":"",u=c.className.split(" ")[0]),v==""&&r.element.parent().attr("tag").toLowerCase().indexOf("[measures]")>-1&&(v=this.element.find(".schemaRow .pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").length>0?"Series":"Categorical"),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?e=s=n(r.element.parent()[0]).attr("tag").split(":")[1]:s=n(r.element.parent()[0]).attr("tag");else for(u=t.isNullOrUndefined(r.target.className)?n(r.target).hasClass("schemaColumn")?"schemaColumn":n(r.target).hasClass("schemaRow")?"schemaRow":n(r.target).hasClass("schemaFilter")?"schemaFilter":n(r.target).hasClass("schemaValue")?"schemaValue":"":r.target.className.indexOf("e-droppable")>=0?r.target.className.split(" ")[0]:r.target.className.split(" ")[0]=="pvtBtn"?n(r.target).parents("div.e-droppable").attr("class").split(" ")[0]:"",e=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?n.grep(this.model.pivotTableFields,function(n){return n.caption==r.element.text()})[0].name:r.element.attr("fieldCaption"),s,y=r.element.find("~ .filterIndicator").length>0?!0:!1,p=r.element.find("~ span:eq(0) span.descending").length>0?!0:!1,o=0;o<this.model.pivotTableFields.length;o++)this.model.pivotTableFields[o].name==e&&(this.model.pivotTableFields[o].isSelected=!0,s=this.model.pivotTableFields[o]);if(this._dataModel=="Olap"&&(s.split(":")[1].toLocaleUpperCase()=="MEASURES"&&(u!="schemaColumn"||u!="schemaRow")&&(u=="schemaFilter"||u=="schemaValue")||s.toUpperCase().indexOf("[MEASURES]")>-1&&u!="schemaValue"&&(u=="schemaRow"||u=="schemaColumn"||u=="schemaFilter")||s.toUpperCase().indexOf("[MEASURES]")==-1&&u=="schemaValue"))return this._createErrorDialog(),!1;if(u=="schemaValue"||u=="schemaRow"||u=="schemaColumn"||u=="schemaFilter"){if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._dataModel=="Pivot"&&u!="schemaValue"&&(n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e}).length>0||n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.FieldHeader==e&&n.CalculationType==8}).length>0)){this.model.pivotControl._createErrorDialog(this.model.pivotControl._getLocalizedLabels("CalcValue"),this.model.pivotControl._getLocalizedLabels("Warning"));return}h=t.isNullOrUndefined(r.event)?"":this._setSplitBtnTargetPos(r.event);try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(ot){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(a=this.model.pivotControl.getOlapReport())}if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(this.model.pivotControl.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"}),it=u=="schemaFilter"&&this.model.pivotControl._getNodeByUniqueName(e)!=null&&this.model.pivotControl._getNodeByUniqueName(e).find(".namedSetCDB").length>0,w=n(r.element.parent()).attr("tag").split(":")[0]=="Columns"&&this._droppedClass=="schemaColumn"&&s.toLowerCase()=="measures"||n(r.element.parent()).attr("tag").split(":")[0]=="Rows"&&this._droppedClass=="schemaRow"&&s.toLowerCase()=="measures",w||it||e.toLowerCase().indexOf("[measures]")>=0&&u!="schemaValue"||u=="schemaValue"&&!(e.toLowerCase().indexOf("[measures]")>=0)||u=="schemaFilter"&&e.toLowerCase().indexOf("measures")>=0)return pschemaDesignerWaitingPopup.hide(),w||this._createErrorDialog(),r.Cancel;if(e.toLowerCase().indexOf("measures")>=0&&!(e.toLowerCase().indexOf("[measures]")>=0))return n(r.element.parent().parent()).remove(),this.model.pivotControl.model.dataSource.values[0].axis=u=="schemaRow"?"rows":u=="schemaColumn"?"columns":"columns",this._createPivotButton({fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")},u=="schemaRow"?"row":u=="schemaColumn"?"column":"column","","",h),t.olap.base.getJSONData({action:"nodeDropped"},this.model.pivotControl.model.dataSource,this.model.pivotControl),pschemaDesignerWaitingPopup.hide(),this._setPivotBtnWidth(),!1}if(this.model.pivotControl._dataModel=="Pivot"&&u!="schemaValue"&&n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e}).length>0){alert(this.model.pivotControl._getLocalizedLabels("CalcValue"));return}if(n(r.element.parent().parent()).remove(),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)this.model.pivotControl.model.enableDeferUpdate||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left}),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(tt=this._currentCubeName+"--"+s+"--"+v+"--"+h,this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),l=JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:tt,currentReport:a,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l,this._droppedSuccess)):(this._createPivotButton({fieldName:r.element.attr("fieldName"),fieldCaption:r.element.attr("fieldCaption")},u=="schemaRow"?"row":u=="schemaColumn"?"column":u=="schemaFilter"?"filter":u=="schemaValue"?"value":"",y,p,h),!t.isNullOrUndefined(this.model.pivotControl._calculatedField)&&this.model.pivotControl._calculatedField.length>0&&u!="schemaValue"&&this.model.pivotControl._calculatedFieldNodeRemove(s),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),b="",b=t.Pivot._getFilterParams(u,this._tempFilterData,e),l=JSON.stringify({action:"nodeDropped",dropAxis:u+"::"+h,filterParams:b,headerTag:JSON.stringify(s),sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),successMethod=this.model.pivotControl._renderControlSuccess,this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtNodeDroppedSuccess),t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l,this._pvtNodeDroppedSuccess));else{if(f=this.model.pivotControl._getDroppedItem(e),k={},f.length>0&&(k=f[0].isNamedSets!=i?{fieldName:f[0].fieldName,fieldCaption:f[0].fieldCaption,isNamedSets:f[0].isNamedSets}:{fieldName:f[0].fieldName,fieldCaption:f[0].fieldCaption}),d=u=="schemaRow"?"row":u=="schemaColumn"?"column":u=="schemaFilter"?"filter":u=="schemaValue"?"value":"",this._createPivotButton(k,d,y,p,h),n.isNumeric(h)?u=="schemaRow"?this.model.pivotControl.model.dataSource.rows.splice(h,0,f[0]):u=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.splice(h,0,f[0]):u=="schemaValue"?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.dataSource.values[0].measures.splice(h,0,f[0]):this.model.pivotControl.model.dataSource.values.splice(h,0,f[0]):this.model.pivotControl.model.dataSource.filters.splice(h,0,f[0]):u=="schemaRow"?this.model.pivotControl.model.dataSource.rows.push(f[0]):u=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.push(f[0]):u=="schemaValue"?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.dataSource.values[0].measures.push(f[0]):this.model.pivotControl.model.dataSource.values.push(f[0]):this.model.pivotControl.model.dataSource.filters.push(f[0]),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl._calculatedField.length>0&&u!="schemaValue"){for(rt=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(f[0].fieldName)==-1}),g=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(f[0].fieldName)>-1}),o=0;o<g.length;o++)this._tableTreeObj.uncheckNode(g[o].fieldName);this.model.pivotControl.model.dataSource.values=rt}this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(ut=this.model.pivotControl.model.dataSource.values[0].axis=="columns"?"Columns:":"Rows:",nt=this.element.find("div[tag='"+ut+"Measures']:first"),nt.appendTo(nt.parent()),et=r.element.attr("axis").toLowerCase(),this.model.pivotControl.model.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"}));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.show(),t.olap.base.getJSONData({action:"nodeDropped"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(this._trigger("fieldItemDropped",{axis:d,fieldItem:f}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}}else this._removePvtBtn(r);this._setPivotBtnWidth()},_createErrorDialog:function(){if(t.Pivot.openPreventPanel(this),this.element.find(".errorDialog").length==0){var n=t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent",this._getLocalizedLabels("AlertMsg"))[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK")[0].outerHTML)[0].outerHTML).attr("title",this._getLocalizedLabels("Warning"))[0].outerHTML;this.element.append(n);this.element.find(".errorDialog").ejDialog({target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,width:"400px",close:t.proxy(t.Pivot.closePreventPanel,this)});this._errorDialog=this.element.find(".errorDialog").data("ejDialog");this.element.find(".errOKBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(this._errOKBtnClick,this)});this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"))}else this._errorDialog.open()},_errOKBtnClick:function(){t.Pivot.closePreventPanel(this);this._errorDialog._ejDialog.find("div.e-dialog-icon").trigger("click")},_hideSchemaDesigner:function(){n("#"+this._id).animate({left:"-"+n("#"+this._id).width()+"px"},500,function(){});this.element.find(".collapseSchema").addClass("expandSchema").removeClass("collapseSchema")},_showSchemaDesigner:function(){n("#"+this._id).animate({left:"5px"});this.element.find(".expandSchema").addClass("collapseSchema").removeClass("expandSchema")},_reSizeHandler:function(){var f,e,c,i,o,r,u,s,h;this.model.pivotControl&&(f=n("#"+this._id).width(),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?(this.element.find(".axisTd1, .axisTd2").css({width:"100%"}),this._pivotClientObj.model.isResponsive||(e=this._pivotClientObj.element.find("#"+this._id).width()/2,this._pivotClientObj.element.find("div.fieldTable").width(e-6),this._pivotClientObj.element.find("div.axisTable").width(e-5)),this._pivotClientObj.model.isResponsive&&this._pivotClientObj.element.find("div.axisTable").css({width:"52%"})):(this.element.find("div.axisTable").width(f),c=(f-2)/2,this.element.find(".axisTd1, .axisTd2").css({width:c})),i=t.PivotSchemaDesigner.Layouts.OneByOne==this.model.layout?this._pivotClientObj.element.find(".controlPanel").height()-15:25/100*n("#"+this._id).height(),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&(i=this.element.find(".cubelists").length>0?i-27:i+5),this.element.find("div.parentSchemaFieldTree, .schemaFieldTree, div.fieldTable").height(i),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&this.element.find("div.schemaFieldTree").height(i-35),n(this.element).parents(".e-pivotclient").length>0||(n("#"+this._id).height()<450&&n("#"+this._id).css("min-height","450px"),n("#"+this._id).width()<240&&n("#"+this._id).css("min-width","240px")),u=n(this.element).parents(".e-pivotclient").length>0?this._pivotClientObj.element.find(".controlPanel").height()-10:n("#"+this._id).height()+20,s=t.PivotSchemaDesigner.Layouts.OneByOne==this.model.layout?0:this.element.find("table.headerTable").height()+this.element.find("div.fieldTable").height()+this.element.find("div.centerDiv").height()+this.element.find("div.centerHead").height(),o=this.model.pivotControl==null||this.model.pivotControl.element.hasClass("e-pivotclient")||this.model.pivotControl.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode?t.PivotSchemaDesigner.Layouts.OneByOne==this.model.layout?u:u-(s+80):u-(s+105),this.element.find("div.axisTable").height(o),r=o/(this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?4:2),this.element.find(".axisTd1,.axisTd2").css({height:r}),n(this.element).parents(".e-pivotclient").length>0&&(this._pivotClientObj.element.find(".schemaColumn, .schemaValue").height(r-28),this._pivotClientObj.element.find(".schemaRow, .schemaFilter").height(r-28)),this._setPivotBtnWidth(),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(h=n(".schemaFieldTree ul>li div").width(),n(n(".e-pivotschemadesigner .schemaFieldTree.e-treeview .e-text")).each(function(){var t=(h-50)/h*100;n(this).width(t.toString()+"%")})))},_clientDialogBtnClick:function(i){var f=[],a=[],w=this._selectedFieldName,c={},v=this,e=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,h,s,y,p,u,o,r;if(this.element.find(".e-dialog, .clientDialog").hide(),this.element.find("#preventDiv").remove(),i.model.text.toLowerCase()!="cancel"){if(t.isNullOrUndefined(e)?this.model.pivotControl._waitingPopup.show():(e._isTimeOut=!0,setTimeout(function(){e._isTimeOut&&v.model.pivotControl._waitingPopup.show()},800)),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){this.model.pivotControl.element.hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._pivotChart)&&(this.model.pivotControl._pivotChart._labelCurrentTags={});t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"},this.model.pivotControl);this._memberTreeObj=t.Pivot.updateTreeView(this);var u=this._selectedFieldName,o=this.model.pivotControl.model.dataSource,l={};if(this.model.pivotControl._currentReportItems=n.map(this.model.pivotControl._currentReportItems,function(n){return n.fieldName==u&&(t.isNullOrUndefined(n.dataSrc)||n.dataSrc.cube==o.cube&&n.dataSrc.reportName==o.reportName)&&(l=n.filterItems,n.filterItems=v._memberTreeObj.dataSource()),n}),c=t.Pivot.getNodesState(!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.enableMemberEditorPaging?this.model.pivotControl._editorTreeData:this._memberTreeObj),h=t.Pivot._getEditorMember(u.toLocaleLowerCase(),this.model.pivotControl,!0),this.model.pivotControl._fieldSelectedMembers[u.toLocaleLowerCase()]=n.map(this.model.pivotControl._fieldMembers[u.toLocaleLowerCase()],function(n){if(!n.checked)return n}).length==0?"All":h!="All"&&h!="multiple"?h:this.model.pivotControl._getLocalizedLabels("MultipleItems"),r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).item,f=n.map(c.selectedNodes.split("::"),function(n){return{Id:n.split("||")[0],tag:n.split("||")[1],parentId:n.split("||")[2]}}),!t.isNullOrUndefined(this.model.pivotControl._selectedNodes))for(s=0;s<this.model.pivotControl._selectedNodes.length;s++)y=this.model.pivotControl._selectedNodes[s],p=n.map(f,function(n){if(y.tag==n.tag)return n}),p.length==0&&f.push(this.model.pivotControl._selectedNodes[s]);t.isNullOrUndefined(r)||(r.advancedFilter=[],r.filterItems={filterType:"include",values:t.Pivot.removeParentSelectedNodes(f)},this._selectedTreeNode=this.element.find(".schemaFieldTree").find("li[tag='"+r.fieldName+"']"),n(this._selectedTreeNode).parents("li:eq(0) span:eq(0)").hasClass("hierarchyCDB")&&(this._selectedTreeNode=n(this._selectedTreeNode).parents("li:eq(0)")),c.unSelectedNodes!=""?(this.model.pivotControl.model.dataSource=t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"},this.model.pivotControl),n(this._selectedTreeNode).find(".filter").length<=0&&(n(n(this._selectedTreeNode).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),this.element.find(".pivotButton:contains('"+this._selectedFieldName+"') .filter").addClass("filtered"),this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").addClass("filtered"))):this.model.pivotControl._unSelectedNodes?(this.model.pivotControl.model.dataSource=t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"},this.model.pivotControl),n(this._selectedTreeNode).find(".filter").length<=0&&(n(n(this._selectedTreeNode).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),this.element.find(".pivotButton:contains('"+this._selectedFieldName+"') .filter").addClass("filtered"),this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").addClass("filtered"))):(this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").removeClass("filtered"),this._selectedTreeNode.find(".filter").remove(),delete r.filterItems));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(u=this._selectedFieldName,o=this.model.pivotControl.model.dataSource,this.model.pivotControl._currentReportItems=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName!=u&&(t.isNullOrUndefined(n.dataSrc)||n.dataSrc.cube==o.cube&&n.dataSrc.reportName==o.reportName))return n}),l=this.model.pivotControl.model.enableMemberEditorPaging?this.model.pivotControl._editorTreeData:n.extend([],this._memberTreeObj.dataSource()),this.model.pivotControl._currentReportItems.push({filterItems:l,fieldName:u,dataSrc:this.model.pivotControl.model.dataSource,pageSettings:this._memberCount}));t.olap.base.getJSONData({action:"filtering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)}else t.PivotAnalysis._valueSorting=null,jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:checked"),function(n,t){t.value!="All"&&f.push(t.value)}),jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:not(:checked)"),function(n,t){a.push(t.value=t.value=="(blank)"?"":t.value)}),this._selectedFieldName&&(r=r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).item,r&&(r.advancedFilter=[])),this._pivotFilterItems(f,a),this.model.pivotControl.refreshControl();this._refreshPivotButtons();this.model.pivotControl._isMemberPageFilter=!0;t.isNullOrUndefined(e)||e._isTimeOut&&(e._isTimeOut=!1)}},_pivotFilterItems:function(i,r){var h=this.model.pivotControl.model.dataSource[this._selectedFieldAxis],e=t.PivotAnalysis.getMembers(this._selectedFieldName),o,f,u,s;for(jQuery.each(e,function(n,t){t!=null&&t.toString().replace(/^\s+|\s+$/gm,"")||jQuery.each(r,function(n,i){i.toString().replace(/^\s+|\s+$/gm,"")||(r[n]=t)})}),o=this._selectedFieldName,f=n.grep(h,function(n){return n.fieldName==o}),u=0;u<f.length;u++)f[u].filterItems=i.length==e.length?null:{filterType:t.PivotAnalysis.FilterType.Exclude,values:r};r.length>0&&this.element.find(".schemaFieldTree li[id='"+this._selectedFieldName+"']").find(".filter").length<=0?(s=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,this.element.find(".schemaFieldTree li[id='"+this._selectedFieldName+"']").find(".e-text").after(s),this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").addClass("filtered")):r.length==0&&(this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").removeClass("filtered"),this.element.find(".schemaFieldTree li[id='"+this._selectedFieldName+"']").find(".filter").remove())},_dialogBtnClick:function(r){var f,l,b,g,v,e,nt,k,tt,h,w,u,rt,a,ut;if(t.Pivot.closePreventPanel(this),this.element.find(".e-dialog, .clientDialog").hide(),schemaObj=this,f=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,!this._isFiltered)return!1;if(this.model.pivotControl._isUpdateRequired=!0,this.model.pivotControl!=null&&(this.model.pivotControl._memberTreeObj=this._memberTreeObj),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(r.model.text.toLowerCase()=="cancel")return;l=[];b=[];this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(g=this._selectedMember,this.model.pivotControl._currentReportItems=n.grep(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()!=g.toLocaleLowerCase())return n}),this._memberTreeObj=t.Pivot.updateTreeView(this),this.model.pivotControl._currentReportItems.push({filterItems:n.extend([],this._memberTreeObj.dataSource()),fieldName:this._selectedMember}),l=n.map(this.model.pivotControl._getSelectedNodes().split("::"),function(n){return{Id:n.split("||")[0],tag:n.split("||")[1],parentId:n.split("||")[2]}}),v=this._selectedMember!=i?this._selectedMember.toLocaleLowerCase():this._selectedMember.toLocaleLowerCase(),e=n.map(this.model.pivotControl.model.dataSource.columns,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()==v)return n}),e.length==0&&(e=n.map(this.model.pivotControl.model.dataSource.rows,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()==v)return n})),e.length==0&&(e=n.map(this.model.pivotControl.model.dataSource.filters,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()==v)return n})),e.length>0&&(this._getUnSelectedNodes()!=""&&(this.model.pivotControl.model.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"})),e[0].advancedFilter=[],e[0].filterItems={filterType:"include",values:this.model.pivotControl._removeSelectedNodes(l)},this._selectedTreeNode=this.element.find(".schemaFieldTree").find("li[tag='"+e[0].fieldName+"']"),n(this._selectedTreeNode).parents("li:eq(0)").children().children("span").hasClass("hierarchyCDB")&&(this._selectedTreeNode=n(n(this._selectedTreeNode).parents("li:eq(0)"))),this._getUnSelectedNodes()==""?(this._selectedTreeNode.find(".filter").remove(),this.element.find(".pvtBtn[fieldname='"+this._selectedMember+"']").parent().find(".filter").removeClass("filtered"),delete e[0].filterItems):n(n(this._selectedTreeNode)).find(".filter").length<=0&&(n(n(this._selectedTreeNode).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),this.element.find(".pvtBtn[fieldname='"+this._selectedMember+"']").parent().find(".filter").addClass("filtered"))),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)?this.model.pivotControl._waitingPopup.show():(f._isTimeOut=!0,setTimeout(function(){f._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800))),t.olap.base.getJSONData({action:"filtering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(t.PivotAnalysis._valueSorting=null,jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:checked"),function(n,t){t.value!="All"&&l.push(t.value)}),jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:not(:checked)"),function(n,t){b.push(t.value=t.value=="(blank)"?"":t.value)}),this.element.find(".e-dialog, .clientDialog").hide(),this.model.pivotControl._pivotFilterItems(l,b),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}else{if(nt="",tt=this.element.find(".editorTreeView :input.nodecheckbox"),r.model.text.toLowerCase()!="cancel"){var c=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?nt=this._getUnSelectedNodes()+"FILTERED"+this._getSelectedNodes(this._curFilteredAxis=="schemaFilter"?!0:!1):this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),y=!1,o=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?c:this._curFilteredAxis+"::"+this._curFilteredText+"::FILTERED",s=this._curFilteredText,d=[],p={};if(k=this._getUnSelectedNodes()!=""?!0:!1,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot){for(t.isNullOrUndefined(this.model.pivotControl._fieldMembers[s])&&(this.model.pivotControl._fieldMembers[s]=t.Pivot._getEditorMember(tt,this.model.pivotControl,!0)),u=0;u<c.length;u++)d.push(n(c[u].parentElement).siblings("a").text());for(p[s]=d,h=this.element.parents(".e-pivotclient").length>0?this.model.pivotControl._tempFilterData:this._tempFilterData,t.isNullOrUndefined(h)&&(h=[]),u=0;u<h.length;u++)t.isNullOrUndefined(h[u][s])||(h[u][s]=d,y=!0);if(y||h.push(p),this._tempFilterData=this.model.pivotControl._tempFilterData=h,(t.isNullOrUndefined(this._curFilteredAxis)||this._curFilteredAxis!="")&&this._curFilteredAxis!="schemaValue")for(u=0;u<c.length;u++)o+="##"+n(c[u].parentElement).siblings("a").text()}else{for(w=t.Pivot._getEditorMember(s,this.model.pivotControl,!0),this.model.pivotControl._fieldSelectedMembers[s]=n.map(this.model.pivotControl._fieldMembers[s],function(n){if(!n.checked)return n}).length==0?"All":w!="All"&&w!="multiple"?w:this.model.pivotControl._getLocalizedLabels("MultipleItems"),p[this._curFilteredText]=o,t.isNullOrUndefined(this.model.pivotControl._tempFilterData)&&(this.model.pivotControl._tempFilterData=[]),u=0;u<this.model.pivotControl._tempFilterData.length;u++)t.isNullOrUndefined(this.model.pivotControl._tempFilterData[u][this._curFilteredText])||(this.model.pivotControl._tempFilterData[u][this._curFilteredText]=o,y=!0);y||this.model.pivotControl._tempFilterData.push(p)}var it=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this._curFilteredText:this._curFilteredText.split(".")[1],ft=this._getSortedHeaders(),et=this.model.layout=="excel"?this.element.find(".schemaFieldTree li:contains('"+this._curFilteredText+"')"):this.element.find("."+this._curFilteredAxis+" .pivotButton:contains("+this._curFilteredText+") .filterBtn");if((this.model.layout=="excel"||this.model.layout=="normal")&&(n(this._selectedTreeNode).parents("li:eq(0)").children().children("span").hasClass("hierarchyCDB")&&(this._selectedTreeNode=n(n(this._selectedTreeNode).parents("li:eq(0)"))),k&&n(n(this._selectedTreeNode)).find(".filter").length<=0?(rt=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,n(n(this._selectedTreeNode).find(".e-text")[0]).after(rt),this.element.find(".pvtBtn:contains('"+it+"')").parent().find(".filter").addClass("filtered")):k||(n(this._selectedTreeNode).find(".filter").remove(),this.element.find(".pvtBtn:contains('"+it+"')").parent().find(".filter").removeClass("filtered")),this._curFilteredAxis==""))return!1;this.model.pivotControl.model.enableGroupingBar&&(n.each(this.model.pivotControl.element.find(".pivotButton .filter"),function(t,i){n(i).removeClass("filtered")}),(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?c.length>0:c.split("FILTERED::")[0].length>0)&&this.model.pivotControl.element.find("#pivotButton"+this._curFilteredText.split(".")[0]).next().addClass("filtered"));try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(ot){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(a=this.model.pivotControl.getOlapReport())}this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.pivotControl.model.customObject});ut=this.model.pivotControl.model.customObject!={}&&o!=""?JSON.stringify({action:"filtering",filterParams:o+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:this.model.pivotControl.model.valueSortSettings,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}):this.model.pivotControl.model.customObject!={}?JSON.stringify({action:"filtering",currentReport:a,valueSorting:this.model.pivotControl.model.valueSortSettings,customObject:serializedCustomObject}):o!=""?JSON.stringify({action:"filtering",filterParams:o,sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:this.model.pivotControl.model.valueSortSettings}):JSON.stringify({action:"filtering",valueSorting:this.model.pivotControl.model.valueSortSettings});t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)?this.model.pivotControl._waitingPopup.show():(f._isTimeOut=!0,setTimeout(function(){f._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800)));this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.model.pivotControl.model.enableDeferUpdate?(this.model.pivotControl._filterUpdate.push(o),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)||(f._isTimeOut=!1),this.model.pivotControl._waitingPopup.hide()),this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,ut,this._filterElementSuccess)}this._selectedTreeNode=null;this._refreshPivotButtons()}t.isNullOrUndefined(f)||f._isTimeOut&&(f._isTimeOut=!1)},_beforeNodeExpand:function(n){t.Pivot.getChildNodes(n,this._selectedFieldName,this.model.pivotControl._currentReportItems,this.model.pivotControl.model.dataSource,this)},_nodeExpand:function(n){this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl._nodeExpand(n)},_nodeStateModifiedSuccess:function(n){this.model.pivotControl._isUpdateRequired=!0;n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.customObject});this.model.pivotControl.model.enableDeferUpdate?this.model.pivotControl._deferUpdateSuccess(n):this.model.pivotControl._renderControlSuccess(n);this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_pvtNodeDroppedSuccess:function(r){r[0]!=i?r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value):r.d!=i?(r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value),r.d[0].Key=="PivotReport"&&this.model.pivotControl.setOlapReport(r.d[0].Value)):(r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject),this.model.pivotControl.setOlapReport(r.PivotReport));this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.model.pivotControl.model.enableDeferUpdate?this.model.pivotControl._deferUpdateSuccess(r):n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this.model.pivotControl.refreshControl(r),this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(r)):this.model.pivotControl._renderControlSuccess(r);this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_pvtBtnDroppedSuccess:function(n){n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.customObject});this.model.pivotControl._renderControlSuccess(n);this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(n);this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_filterElementSuccess:function(r){var u,f,e;n(this.element).parents(".e-pivotclient").length>0?(t.isNullOrUndefined(r.d)||(u={},u.PivotReport=r.d[0].Value,u.GridJSON=r.d[1].Value,u.ChartJSON=r.d[2].Value,f=n.map(r.d,function(n){if(n.Key=="FilteredColumnHeaders")return n.Value}),f.length>0&&(u.FilteredColumnHeaders=f[0]),e=n.map(r.d,function(n){if(n.Key=="FilteredRowHeaders")return n.Value}),e.length>0&&(u.FilteredRowHeaders=e[0]),r=u),this.model.pivotControl.refreshControl(r),this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(r)):(r[0]!=i?r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value):r.d!=i?r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value):r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject),this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject}),this.model.pivotControl._renderControlSuccess(r));this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style");t.Pivot.closePreventPanel(this);this.element.find(".e-dialog").remove()},_fetchChildNodeSuccess:function(r){var u,f,e;r.length>1&&r[0]!=i?(u=JSON.parse(r[0].Value),r[1]!=null&&r[1]!=i&&(this.model.customObject=r[1].Value)):r.d!=i?(u=JSON.parse(r.d[0].Value),r.d[1]!=null&&r.d[1]!=i&&(this.model.customObject=r.d[1].Value)):(u=JSON.parse(r.ChildNodes),r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject));e={id:"id",parentId:"pid",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus"};f=n(this.pNode).parents("li").length>1?n(this.pNode).parents("li").first():n(this.pNode).parents("li");n(n(f).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});this._memberTreeObj._createSubNodesWhenLoadOnDemand(u,this.pNode,e);n.each(n(f).children().find("li"),function(n,t){t.setAttribute("tag",u[n].tag)});this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_fetchMemberSuccess:function(r){if(r[0]!=i&&r.length>0?(this._currentMembers=r[0].Value,r[1]!=null&&r[1]!=i&&(this.model.customObject=r[1].Value)):r.d!=i&&r.d.length>0?(this._currentMembers=r.d[0].Value,r.d[1]!=null&&r.d[1]!=i&&(this.model.customObject=r.d[1].Value)):r!=i&&r.length>0?(this._currentMembers=r.EditorTreeInfo,r!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)):r!=i&&(this._currentMembers=r.EditorTreeInfo,r!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)),this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.customObject}),this._createDialog(this._dialogHead,this._currentMembers),this.model.pivotControl._waitingPopup){var u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(u)||(u._isTimeOut=!1);this.model.pivotControl._waitingPopup.hide()}this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style");t.isNullOrUndefined(this.element.find(".e-dialog .e-text:visible").first())||this.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell")},_droppedSuccess:function(r){var u=null;this.model.pivotControl.model.enableDeferUpdate?u=this._removeButtonDeferUpdate==!1?t.isNullOrUndefined(r.OlapReport)?JSON.parse(r.d[0].Value):JSON.parse(r.OlapReport):u=t.isNullOrUndefined(r.OlapReport)?r.d[0].Value:r.OlapReport:(!t.isNullOrUndefined(r[0])&&r.length>0?(u=JSON.parse(r[1].Value),r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value)):!t.isNullOrUndefined(r.d)&&r.d.length>0?(u=n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value):JSON.parse(r.d[1].Value),r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value)):t.isNullOrUndefined(r)||t.isNullOrUndefined(r.OlapReport)?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.PivotReport)||(u=JSON.parse(r.PivotReport)):u=JSON.parse(r.OlapReport),r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject));this._removeButtonDeferUpdate==!1&&(this.element.find(".axisTable .pivotButton").remove(),this._setPivotRows(u.PivotRows),this._setPivotColumns(u.PivotColumns),this._setPivotCalculations(u.PivotCalculations),this._setFilters(u.Filters),this.model.pivotControl.setOlapReport(JSON.stringify(u)),this._refreshPivotButtons(),this.model.enableDragDrop&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)}),this._unWireEvents(),this._wireEvents());this.model.pivotControl.model.enableDeferUpdate?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.hide(),t.isNullOrUndefined(r.OlapReport)?(this.model.pivotControl.setOlapReport(r.d[0].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(r.d[2].Value),JSON.parse(r.d[1].Value))):(this.model.pivotControl.setOlapReport(r.OlapReport),r.HeaderCounts!=i&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(r.HeaderCounts),JSON.parse(r.PageSettings))),this._removeButtonDeferUpdate=!1,this.model.pivotControl._deferUpdateSuccess(r)):n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this.model.pivotControl.refreshControl(r),this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(r)):this.model.pivotControl._renderControlSuccess(r);this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style");this._createContextMenu();this._setPivotBtnWidth()},_removePvtBtn:function(i){var f,u,o,e,s,r;this.model.pivotControl._waitingPopup.show();n(i.element).length>0?(f=n(i.element).parent().attr("tag").split(":")[1],u=n(i.element).parent().attr("tag")):(f=n(i.target).parent().attr("tag").split(":")[1],u=n(i.target).parent().attr("tag"));try{o=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(h){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(o=this.model.pivotControl.getOlapReport())}if(o==""&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(o=this.model.pivotControl.model.dataSource),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap)if(this._clearFilterData(f),e=u.indexOf("[Measures]")>-1||u.indexOf("[")>-1?u.split(":")[1]:this.model.pivotControl._getNodeUniqueName(u),e=e.indexOf("<>")?e.replace("<>","."):e,e=="[Measures]"){if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)t.Pivot.removeReportItem(this.model.pivotControl.model.dataSource,f,f.toLocaleLowerCase().indexOf("measures")==0),this.model.pivotControl.refreshControl(),this.refreshControl();else if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){for(n(i.element).length>0?n(i.element).parent().parent().remove():n(i.target).parent().parent().remove(),r=0;r<this.model.pivotCalculations.length&&u.indexOf(this._getLocalizedLabels("Measures"))>-1;r++)e=this.model.pivotCalculations[r].Tag,this._isMeasureBtnRemove=!0,selectedTreeNode=this.model.pivotControl._getNodeByUniqueName(e),this._tableTreeObj.uncheckNode(selectedTreeNode);this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.pivotControl.model.customObject});s=JSON.stringify({action:"removeButton",headerInfo:u,currentReport:o,customObject:JSON.stringify(this.model.pivotControl.model.customObject),gridLayout:this.model.pivotControl.model.layout});u.indexOf("[Measures]")<0&&u.indexOf("Measures")>=0&&this.element.find(".schemaValue .pivotButton").remove();this.model.pivotControl.model.enableDeferUpdate?(this._removeButtonDeferUpdate=!0,this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,s.replace("removeButton","removeButtonDeferUpdate"),this._droppedSuccess),this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,s,this._pvtBtnDroppedSuccess)}}else selectedTreeNode=this.model.pivotControl._getNodeByUniqueName(e),this._tableTreeObj.uncheckNode(selectedTreeNode);else if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(t.PivotAnalysis._valueSorting=null,f=n(i.element).length>0?n(i.element).parent().find(".pvtBtn").attr("fieldname"):n(i.target).parent().find(".pvtBtn").attr("fieldname"),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){if(u.split(":")[1].toLowerCase()=="measures"){for(this.model.pivotControl._ogridWaitingPopup.show(),this.element.find("div[tag='"+u+"']").remove(),r=0;r<this.model.pivotControl.model.dataSource.values[0].measures.length;r++)this._nodeCheck=!0,selectedTreeNode=this._tableTreeObj.element.find("li[tag='"+this.model.pivotControl.model.dataSource.values[0].measures[r].fieldName+"']"),this._tableTreeObj.uncheckNode(selectedTreeNode),this.element.find("div[tag='values:"+this.model.pivotControl.model.dataSource.values[0].measures[r].fieldName+"']").remove();this.model.pivotControl.model.dataSource.values[0].measures=[];t.olap.base.getJSONData({action:"removeButton"},this.model.pivotControl.model.dataSource,this.model.pivotControl)}if(selectedTreeNode=this._tableTreeObj.element.find("li[tag='"+f+"']"),selectedTreeNode.length>1)for(r=0;r<selectedTreeNode.length;r++)this._tableTreeObj.isNodeChecked(selectedTreeNode[r])&&(selectedTreeNode=selectedTreeNode[r])}else selectedTreeNode=this._tableTreeObj.element.find("li[id="+f+"]");this._tableTreeObj.uncheckNode(selectedTreeNode)}else selectedTreeNode=this._tableTreeObj.element.find("li:contains('"+f+"')"),this._tableTreeObj.uncheckNode(selectedTreeNode)},_createDialog:function(i,r){var s,nt,h,c,o,l,y,tt,p,u,rt,a,b;this.element.find(".e-dialog, .clientDialog").remove();var v,f,k="",d="",g="",e=this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl.model.enableAdvancedFilter||this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.dataSource.enableAdvancedFilter&&t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).axis!="filters"&&t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).axis!="values"&&!t.isNullOrUndefined(t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).item)?!0:!1;e&&(s=JSON.parse(r),s[0].name="(Select All)",v=this._selectedFieldName,this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(f=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName==v)return n.dropdownData}),f.length==0&&(f=n.map(this._tableTreeObj.element.find("li[tag ='"+this._selectedFieldName+"'] li"),function(t){return{value:n(t).attr("tag"),text:n(t).find("a").text()}}))):f=[{value:this._selectedFieldName,text:this._selectedFieldName}]:this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(f=s.splice(s.length-1,1),f=JSON.parse(f[0].levels)):f=[{value:this._curFilteredText,text:this._curFilteredText}],r=JSON.stringify(s),k=t.buildTag("div.ddlGroupWrap",this._getLocalizedLabels("SelectField")+":"+t.buildTag("input#"+this._id+"_GroupLabelDrop.groupLabelDrop").attr("type","text")[0].outerHTML,{})[0].outerHTML,d=t.buildTag("ul.filterElementTag")[0].outerHTML,nt=t.Pivot.createAdvanceFilterTag({action:"filterTag"},this));g=t.buildTag("div.memberSearchEditorDiv",t.buildTag("input#"+this._id+"_SearchEditorTreeView.searchEditorTreeView").attr("type","text")[0].outerHTML+(this.model.pivotControl.model.enableMemberEditorPaging&&n.parseJSON(r).length>=this.model.pivotControl.model.memberEditorPageSize?t.buildTag("span.e-icon searchEditorTree",{})[0].outerHTML:""),{padding:this.model.pivotControl.model.enableAdvancedFilter?"5px 5px 0px 9px":0})[0].outerHTML;var ut=t.buildTag("div#"+this._id+"_EditorDiv.editorDiv",k+d+t.buildTag("div",g+t.buildTag("div.memberEditorDiv",t.buildTag("div#editorTreeView.editorTreeView")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML+"<\/br>",ft=t.buildTag("div",t.buildTag("button#"+this._id+"_OKBtn.dialogOKBtn",this._getLocalizedLabels("OK"))[0].outerHTML+t.buildTag("button#CancelBtn.dialogCancelBtn",this._getLocalizedLabels("Cancel"))[0].outerHTML,{float:"right",margin:(!t.isNullOrUndefined(r)&&n.parseJSON(r).length>=this.model.pivotControl.model.memberEditorPageSize?"10px":"-5px ")+" "+(e?" 5px ":" 0px ")+" 6px 0px"})[0].outerHTML,et=t.buildTag("div.memberPager",t.buildTag("div#"+this._id+"_NextpageDiv.nextPageDiv",t.buildTag("div.e-icon e-media-backward_01 firstPage",{})[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-left prevPage",{})[0].outerHTML+t.buildTag("input.memberCurrentPage#memberCurrentPage",{},{width:"20px",height:"10px"})[0].outerHTML+t.buildTag("span.memberPageCount#memberPageCount")[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-right nextPage",{})[0].outerHTML+t.buildTag("div.e-icon e-media-forward_01 lastPage",{})[0].outerHTML)[0].outerHTML)[0].outerHTML,ot=t.buildTag("div#"+(e?"clientDialog":this._id+"_clientDialog")+".clientDialog",ut+(!t.isNullOrUndefined(r)&&this.model.pivotControl.model.enableMemberEditorPaging&&(n.parseJSON(r).length>=this.model.pivotControl.model.memberEditorPageSize||this.model.pivotControl.model.memberEditorPageSize<this.model.pivotControl._memberPageSettings.endPage)?et:"")+ft,{opacity:"1"}).attr("title",i)[0].outerHTML,r=JSON.parse(r),h;for(u=0;u<r.length;u++)r[u].name!=null&&r[u].name.toString().replace(/^\s+|\s+$/gm,"")||(r[u].name="(blank)",r[u].id="(blank)");if(this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!t.isNullOrUndefined(this.model.pivotControl._fieldMembers):!t.isNullOrUndefined(this._tempFilterData)){if(this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(u=0;u<Object.keys(this.model.pivotControl._fieldMembers).length;u++)t.isNullOrUndefined(this.model.pivotControl._fieldMembers[this._curFilteredText])||(h=n.map(this.model.pivotControl._fieldMembers[this._curFilteredText],function(n){if(!n.checked)return n.name}));else for(u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][i])||(h=this._tempFilterData[u][i]);if(!t.isNullOrUndefined(h))for(u=0;u<h.length;u++)for(c=0;c<r.length;c++)h[u]==r[c].name&&(r[c].checkedStatus=!1)}for(n(ot).appendTo("#"+this._id),this.model.pivotControl.model.enableMemberEditorPaging&&(r.length>=this.model.pivotControl.model.memberEditorPageSize||this.model.pivotControl.model.memberEditorPageSize<this.model.pivotControl._memberPageSettings.endPage)&&(this.element.find(".prevPage, .firstPage").addClass("pageDisabled"),this.element.find(".nextPage, .lastPage").addClass("pageEnabled"),o=this._memberCount/this.model.pivotControl.model.memberEditorPageSize,o!=Math.round(o)&&(o=parseInt(o)+1),this.element.find(".memberPageCount").html("/ "+o),this.element.find(".memberCurrentPage").val(this.model.pivotControl._memberPageSettings.currentMemeberPage),this.model.pivotControl._memberPageSettings.currentMemeberPage>1?this.element.find(".prevPage, .firstPage").removeClass("pageDisabled").addClass("pageEnabled"):this.element.find(".prevPage, .firstPage").removeClass("pageEnabled").addClass("pageDisabled"),this.model.pivotControl._memberPageSettings.currentMemeberPage==parseInt(this.element.find(".memberPageCount").text().split("/")[1].trim())?this.element.find(".nextPage, .lastPage").removeClass("pageEnabled").addClass("pageDisabled"):this.element.find(".nextPage, .lastPage").removeClass("pageDisabled").addClass("pageEnabled"),this.element.find(".nextPageDiv .pageDisabled").css("opacity","0.5")),this.element.find("#"+this._id+"_SearchEditorTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search")+" "+i,maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:!this.model.pivotControl.model.enableMemberEditorPaging||this.element.find(".nextPageDiv").length==0?t.proxy(t.Pivot._searchTreeNodes,this):t.proxy(function(n){t.isNullOrUndefined(n.value)&&t.Pivot._searchEditorTreeNodes(n,this.model.pivotControl)},this)}),this.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:this.model.enableRTL,beforeDelete:function(){return!1},height:n(".memberEditorDiv").height(),fields:{id:"id",text:"name",isChecked:"checkedStatus",hasChild:"hasChildren",dataSource:r}}),e&&(this.element.find(".filterElementTag").ejMenu({fields:{dataSource:nt,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.NormalMenu,width:"100%",enableRTL:this.model.enableRTL,orientation:t.Orientation.Vertical,click:t.proxy(this._filterElementClick,this)}),this.element.find(".groupLabelDrop").ejDropDownList({width:"99%",enableRTL:this.model.enableRTL,dataSource:f,fields:{id:"id",text:"text",value:"value"},change:t.proxy(this._groupLabelChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),l=t.isNullOrUndefined(this._selectedLevel)?"":this._selectedLevel,l=n.map(f,function(n){if(n.value.toLowerCase()==l.toLowerCase())return n.text}),y=this.element.find(".groupLabelDrop").data("ejDropDownList"),y.selectItemByText(l.length>0?l[0]:y.model.dataSource[0].text),this.element.find(".memberEditorDiv").addClass("advancedFilter")),tt=n.grep(r,function(n){if(n.hasChildren==!0)return n}).length>0,tt||this.element.find(".memberEditorDiv").addClass("noChildNode"),p=this.element.find(".editorTreeView").find("li"),u=0;u<p.length;u++)p[u].setAttribute("tag",r[u].tag);this.element.find(".dialogOKBtn, .dialogCancelBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._clientDialogBtnClick:this._dialogBtnClick,this)});this._dialogOKBtnObj=this.element.find(".dialogOKBtn").data("ejButton");this._memberTreeObj=this.element.find(".editorTreeView").data("ejTreeView");var it=this.element.find(".editorTreeView li:gt(0)"),w=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),st=n(it).find(":input.nodecheckbox:not(:checked)");st.length>0&&n(w).removeClass("e-checkmark").addClass("e-stop");!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.model.enableMemberEditorPaging&&(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.element.find(".memberPager").css("margin-top","0px"),this.model.pivotControl._isAllMemberChecked||(this._dialogOKBtnObj.disable(),this.element.find(".dialogOKBtn").attr("disabled","disabled"),n(w).removeClass("e-checkmark").removeClass("e-stop").addClass("e-chk-inact")));!t.isNullOrUndefined(this.model.pivotControl._unSelectedNodes)&&this.model.pivotControl._isMemberPageFilter&&(rt=this.model.pivotControl._unSelectedNodes,n.map(it,function(t){var i=t;n.map(rt,function(t){n(i).attr("tag")==t.tag&&(n(n(i).find("div .e-chkbox-small > span > span:eq(0)")).removeClass("e-checkmark"),n(w).removeClass("e-checkmark").addClass("e-stop"))})}));this.element.find(".clientDialog").ejDialog({width:e?"auto":265,target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,this)});this.element.find(".clientDialog").next(".e-scrollbar").hide();this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"));e&&(this.element.find("#clientDialog_wrapper").addClass("advancedFilterDlg"),this.element.find("#clientDialog_wrapper").css("min-width","265px"),this._droppedClass!="schemaFilter"&&(this.element.find(".clientDialog").css("padding","0px").parents().parents().find(".e-titlebar").remove(),a=t.Pivot.getReportItemByFieldName(v,this.model.pivotControl.model.dataSource).item,a&&a.sortOrder&&a.sortOrder!=t.olap.SortOrder.None&&(b=a.sortOrder==t.olap.SortOrder.Descending?"desc":"asc",t.isNullOrUndefined(b)||b=="asc"?this.element.find(".clientDialog .ascImage").addClass("selectedSort"):this.element.find(".clientDialog .descImage").addClass("selectedSort"))));this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this);this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this);this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._memberTreeObj.model.beforeExpand=t.proxy(this._beforeNodeExpand,this):this._memberTreeObj.model.nodeClick=t.proxy(this._nodeExpand,this);this._memberTreeObj.element.find(".e-plus").length==0&&this._memberTreeObj.element.find(".e-item").css("padding","0px");this._isFiltered=!1;this.model.pivotControl._isMemberPageFilter=!1;t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide();t.isNullOrUndefined(pschemaDesignerWaitingPopup)||pschemaDesignerWaitingPopup.hide()},_applySorting:function(){var i=JSON.stringify(this.model.pivotControl.model.customObject),n,r;try{n=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(u){n=this.model.pivotControl.getOlapReport()}this.model.pivotControl.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});i=JSON.stringify(this.model.pivotControl.model.customObject);r=JSON.stringify({action:"sorting",sortedHeaders:this.model.pivotControl._ascdes,currentReport:n,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:i});this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.model.pivotControl.model.enableDeferUpdate?t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide():this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.sorting,r,this._filterElementSuccess)},_filterElementClick:function(r){var f=this._selectedFieldName,h,s,l,p,c,e,w,o,u;if(this._filterAction=t.isNullOrUndefined(r.element)?r.menuId=="valueFilterBtn"?"valueFiltering":r.menuId=="labelFilterBtn"?"labelFiltering":"":n(r.element).parents("li:eq(0)#valueFilterBtn").length==0?"labelFiltering":"valueFiltering",h=this.element.find(".groupLabelDrop").data("ejDropDownList"),this._selectedLevelUniqueName=h.getSelectedValue(),this.model.pivotControl._selectedField=this._selectedFieldName,this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode){if(this.model.pivotControl._selectedField=this.model.pivotControl._curFilteredText=this._curFilteredText,this.model.pivotControl._curFilteredAxis=this._curFilteredAxis,this._selectedField=this._curFilteredText,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap)this.model.pivotControl._filterElementClick(r,this);else{try{s=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(b){s=this.model.pivotControl.getOlapReport()}if(u=[],l=this._selectedLevelUniqueName,n(r.element).find(".descImage").length>0||n(r.element).find(".ascImage").length>0||n(r.element).find(".e-clrSort").length>0)return t.isNullOrUndefined(this.model.pivotControl._ascdes)&&(this.model.pivotControl._ascdes=""),this.model.pivotControl._ascdes.indexOf(this._selectedField)>-1?this.model.pivotControl._ascdes=this.model.pivotControl._ascdes.replace(this._selectedField+"##",""):n(r.element).find(".e-clrSort").length==0&&(this.model.pivotControl._ascdes=this.model.pivotControl._ascdes+this._selectedField+"##"),this._applySorting(r),!1;if(n(r.element).find(".e-clrFilter").length>0){this.model.pivotControl._removeFilterTag(this._selectedLevelUniqueName);var a=this._selectedField+"::"+this._curFilteredText+"## Clear Filter"+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),v=JSON.stringify(this.model.customObject),y=JSON.stringify({action:this._filterAction.toLowerCase(),filterParams:a,sortedHeaders:this._ascdes,currentReport:s,customObject:v,gridLayout:this.model.pivotControl.model.layout});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,y,this._filterElementSuccess)}else t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:r,filterInfo:u},this)}return!1}if(n(r.element).attr("id")=="clearAllFilters"?this._clearAllFilter(r):n(r.element).attr("id")=="clearSorting"?this.model.pivotControl._clearSorting(r):(n(r.element).attr("id")=="ascOrder"||n(r.element).attr("id")=="descOrder")&&this._sortField(r),!n(r.element).parent().hasClass("filterElementTag")){if(this.element.find(".e-dialog, .filterDialog, #preventDiv").remove(),n.trim(r.text)==n.trim(this._getLocalizedLabels("ClearFilter")))return this._clearFilter(f,this._selectedLevelUniqueName,this.model.pivotControl.model.dataSource),this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()!=f.toLowerCase())return n}),this.model.pivotControl.refreshControl()):t.olap.base.getJSONData({action:"advancedfiltering"},this.model.pivotControl.model.dataSource,this.model.pivotControl),!1;p=!1;c=this._selectedLevelUniqueName;this.model.pivotControl&&(this.model.pivotControl._selectedLevelUniqueName=this._selectedLevelUniqueName);e=this._getAdvancedFiltervalue(f,this._selectedLevelUniqueName);w="";e=n(r.element).find(".activeFilter").length>0&&e.length>0?e[0].values:[""];o=t.Pivot.getReportItemByFieldName(f,this.model.pivotControl.model.dataSource).item;u=[];o&&o.advancedFilter&&(u=n.map(o.advancedFilter,function(n){if(n.name!=i&&n.name.toLowerCase()!=c)return n}));t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:r,filterInfo:u},this)}},_getAdvancedFiltervalue:function(r,u){if(!(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode)){var f=t.Pivot.getReportItemByFieldName(r,this.model.pivotControl.model.dataSource,"XMLA").item,e=[];return f.advancedFilter&&(e=n.map(f.advancedFilter,function(n){if(n.name!=i&&n.name.toLocaleLowerCase()==u.toLowerCase())return n})),e}return[]},_filterOptionChanged:function(i){var r=this._getAdvancedFiltervalue(this._selectedFieldName,this._selectedLevelUniqueName),u;r=r.length>0?r[0].advancedFilterType=="label"&&i.value.replace(/ /g,"")==r[0].labelFilterOperator?r[0].values:r[0].advancedFilterType=="value"&&i.value.replace(/ /g,"")==r[0].valueFilterOperator?r[0].values:[""]:[""];u=this.element.find(".filterValuesTd")[0];i.value.toLowerCase().indexOf("between")>=0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/> <span>"+this._getLocalizedLabels("and")+"<\/span> <input type='text' id='filterValue2' value='"+(t.isNullOrUndefined(r[1])?"":r[1])+"' class='filterValues' style='display:inline' /> <\/br>");i.value.toLowerCase().indexOf("between")<0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/>")},_removeFilterTag:function(i){var r=this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot,u;(i.indexOf("].")>=0||r)&&(u=i.split("].").length>2||r?"levelUniqueName":"hierarchyUniqueName",this._excelFilterInfo.length>0&&(levelName=this._selectedLevelUniqueName,hierarchyName=this._selectedFieldName,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n[u]!=i)return n})))},_filterElementOkBtnClick:function(){var f=this.element.find(".filterOptions")[0].value,r=[this.element.find("#filterValue1")[0].value],o=[],l=this._selectedFieldName,p=this._selectedLevelUniqueName.toLowerCase(),s,h,e,c,u;if(this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode){h="";e="";try{s=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(w){s=this.model.pivotControl.getOlapReport()}if(this._removeFilterTag(this._selectedLevelUniqueName),this.model.pivotControl.element.find(".reportlist")&&(h=this.model.pivotControl.element.find(".reportlist").data("ejDropDownList").model.value),t.isNullOrUndefined(this._excelFilterInfo)&&(this._excelFilterInfo=[]),this._filterAction=="labelFiltering"){this.model.pivotControl._excelFilterInfo.push({report:h,action:this._filterAction,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:f,measure:e,value1:"",value2:""});c=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[c])return n});var a=this._curFilteredAxis+"::"+this._curFilteredText+"##"+f+"::"+r[0]+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),v=JSON.stringify(this.model.customObject),y=JSON.stringify({action:this._filterAction,filterParams:a,sortedHeaders:this._ascdes,currentReport:s,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:v,gridLayout:this.model.pivotControl.model.layout});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,y,this._filterElementSuccess)}else{c=this._curFilteredText;this.model.pivotControl._excelFilterInfo.push({report:h,action:this._filterAction,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:f,measure:e,value1:"",value2:""});this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[c])return n});this._measureDDL=this.element.find(".filterMeasures").data("ejDropDownList");e=this._measureDDL.getSelectedValue();var a=this._curFilteredText+"::"+f+"::"+e+"::"+r[0]+"::"+(this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:"")+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),v=JSON.stringify(this.model.customObject),y=JSON.stringify({action:this._filterAction,filterParams:a,sortedHeaders:this._ascdes,currentReport:s,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:v,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,y,this._filterElementSuccess)}return!1}if(this._filterAction=="valueFiltering"){if(!(!isNaN(parseFloat(r[0]))&&isFinite(r[0]))||this._measureDDL.getSelectedValue()=="")return;this.element.find("#filterValue2")[0]!=i?","+r.push(this.element.find("#filterValue2")[0].value):r}this.element.find(".e-dialog").remove();u=t.Pivot.getReportItemByFieldName(l,this.model.pivotControl.model.dataSource).item;u&&(delete u.filterItems,u.advancedFilter&&(o=n.map(u.advancedFilter,function(n){if(n.name!=i&&n.name.toLocaleLowerCase()!=p.toLowerCase())return n})),this._filterAction.toLowerCase()=="labelfiltering"?o.push({name:this._selectedLevelUniqueName,labelFilterOperator:f.replace(/ /g,""),advancedFilterType:t.olap.AdvancedFilterType.LabelFilter,values:r}):o.push({name:this._selectedLevelUniqueName,valueFilterOperator:f.replace(/ /g,""),advancedFilterType:t.olap.AdvancedFilterType.ValueFilter,values:r,measure:this._measureDDL.getSelectedValue()}),this.model.pivotControl._currentReportItems=n.grep(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName!=l)return n}),u.advancedFilter=o);this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()!=l.toLowerCase())return n}),this._filterAction!="valueFiltering"||t.isNullOrUndefined(u)||t.PivotAnalysis._valueFilterArray.push(u),this.model.pivotControl.refreshControl()):t.olap.base.getJSONData({action:"advancedfiltering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)},_groupLabelChange:function(i){var r=this.element.find(".filterElementTag").data("ejMenu"),u,o,y,f,s,p,h;if(r.disableItemByID("labelClearFilter"),r.disableItemByID("valueClearFilter"),r.disableItemByID("clearAllFilters"),r.disableItemByID("clearSorting"),this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode)return this.model.pivotControl._selectedLevelUniqueName=i.selectedValue,u=[],o=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,this.model.pivotControl._excelFilterInfo.length>0&&(s=this.model.pivotControl._selectedLevelUniqueName,y=this.model.pivotControl._selectedFieldName,u=n.map(this.model.pivotControl._excelFilterInfo,function(n){if(n.hierarchyUniqueName==y&&n.levelUniqueName==s)return{action:n.action,operator:n.operator,value1:n.value1}})),this.element.find(".filterElementTag .activeFilter,.filterState").remove(),this.element.find("#labelClearFilter ,#valueClearFilter").css("opacity","0.5").attr("disable",!0),u.length>0&&!t.isNullOrUndefined(u[0].operator)?(f=u[0].action.toLowerCase()=="valuefiltering"?"valueFilterBtn":"labelFilterBtn",f=="labelFilterBtn"?r.enableItemByID("labelClearFilter"):r.enableItemByID("valueClearFilter"),r.enableItemByID("clearAllFilters"),this.element.find("#"+f+" a:eq(0)").append(o),this.element.find("#"+f+" #labelClearFilter").removeAttr("style disable"),this.element.find("#"+f+" #valueClearFilter").removeAttr("style disable"),u[0].operator.replace(/ /g,"")=="BottomCount"?this.element.find("#"+f+" li#"+u[0].operator.replace(/ /g,"").replace("Bottom","top")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML)):this.element.find("#"+f+" li#"+u[0].operator.replace(/ /g,"")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML))):this._getUnSelectedNodes()!=""&&this.element.find(".memberEditorDiv").before("<div class='filterState e-icon' style='top:126px;position:absolute;visibility:hidden' />"),this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(h=this.element.find("#clearAllFilters a").children().clone(),this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(h),s=this.model.pivotControl._curFilteredText,p=t.isNullOrUndefined(this.model.pivotControl._ascdes)?[]:n.grep(this.model.pivotControl._ascdes.split("##"),function(n){if(n==s)return n}),p.length>0?(this.element.find(".descImage").addClass("selectedSort"),r.enableItemByID("clearSorting")):this.element.find(".ascImage").addClass("selectedSort")),!1;var e=this,b=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):[],c=e._getAdvancedFiltervalue(e._selectedFieldName,b.getSelectedValue()),r=this.element.find(".filterElementTag").data("ejMenu"),l=t.Pivot.getReportItemByFieldName(e._selectedFieldName,e.model.pivotControl.model.dataSource).item,o=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,w=t.buildTag("span.activeFilter").addClass("e-icon")[0].outerHTML,a=t.Pivot.getReportItemByFieldName(e._selectedFieldName,e.model.pivotControl.model.dataSource).item,v;a&&(a.sortOrder&&a.sortOrder!=t.olap.SortOrder.None?(v=a.sortOrder==t.olap.SortOrder.Descending?"desc":"asc",t.isNullOrUndefined(v)||v=="asc"?this.element.find(".clientDialog .ascImage").addClass("selectedSort"):(this.element.find(".clientDialog .descImage").addClass("selectedSort"),r.enableItemByID("clearSorting"))):this.element.find("#clearSorting").css("opacity","0.5").attr("disabled","disabled"));this.element.find("#clearAllFilters").css("opacity","0.5").attr("disabled","disabled");this.element.find(".filterState,.activeFilter").remove();h=this.element.find("#clearAllFilters a").children().clone();this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(h);c.length>0?(c[0].advancedFilterType==t.olap.AdvancedFilterType.LabelFilter?(this.element.find("#labelFilterBtn a:eq(0)").append(o),this.element.find("#labelFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#labelFilterBtn li#"+c[0].labelFilterOperator+" a").append(w),r.enableItemByID("labelClearFilter")):(this.element.find("#valueFilterBtn a:eq(0)").append(o),this.element.find("#valueFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#valueFilterBtn li#"+c[0].valueFilterOperator+" a").append(w),r.enableItemByID("valueClearFilter")),r.enableItemByID("clearAllFilters"),this.element.find("#clearAllFilters").css("opacity","1").removeAttr("disabled")):(l.length>0&&l[0].filterItems||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&l&&l.filterItems)&&(this.element.find(".memberEditorDiv").before(o),this.element.find(".filterState").addClass("memberFilter").css("visibility","hidden"),this.element.find("#clearAllFilters").css("opacity","1").removeAttr("disabled"))},_clearAllFilter:function(){var r,u;t.Pivot.closePreventPanel(this);this.element.find(".e-dialog").remove();this._clearFilter(this._selectedFieldName,this._selectedLevelUniqueName,this.model.pivotControl.model.dataSource);r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource);r&&r.item&&r.item.filterItems&&(r.item.filterItems.values=[]);this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(u=this._selectedFieldName,t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()!=u.toLowerCase())return n}),this.model.pivotControl.refreshControl()):t.olap.base.getJSONData({action:"advancedfiltering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)},_clearFilter:function(r,u,f){var e=t.Pivot.getReportItemByFieldName(r,f);e.item&&e.item.advancedFilter&&(u=this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?r:u,e.item.advancedFilter=n.map(e.item.advancedFilter,function(n){if(n.name!=i&&n.name.toLowerCase()!=u.toLowerCase())return n}))},_createPivotButton:function(i,r,u,f,e){var l="",a="",o,c,w,b,k;if(u&&(l="filtered"),f&&(a="descending"),o=r=="row"?".schemaRow":r=="column"?".schemaColumn":r=="value"?".schemaValue":".schemaFilter",this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)var h=r=="column"?"columns":r=="row"?"rows":r=="filter"?"filters":"values",v=(r=="column"||r=="row")&&this.model.layout!="excel"&&this._dataModel!="Olap"&&this._dataModel!="XMLA"?t.buildTag("span.sorting e-icon "+a).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",y=(r=="column"||r=="row"||r=="filter")&&this.model.layout!="excel"&&i.fieldCaption!="Measures"?t.buildTag("span.filter e-icon "+l).attr("role","button").attr("aria-label","filter")[0].outerHTML:"",p=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"",s=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+i.fieldName,this.model.pivotControl._dataModel!="XMLA"?n.grep(this.model.pivotTableFields,function(n){return n.name==i.fieldName})[0].caption:i.fieldCaption,{},{fieldName:i.fieldName,fieldCaption:i.fieldCaption,axis:h})[0].outerHTML+y+v+p).attr("tag",h+":"+i.fieldName)[0].outerHTML).attr("tag",h+":"+i.fieldName)[0].outerHTML;else{c="";w={DimensionHeader:i.fieldCaption,Tag:i.fieldName};t.isNullOrUndefined(this.model.pivotControl)||r!="filter"||(c=t.Pivot._getFilterState("",[],w,this.model.pivotControl));var h=r=="column"?"columns":r=="row"?"rows":r=="filter"?this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Pivot?"filters":"slicers":"values",v=(r=="column"||r=="row")&&this.model.layout!="excel"&&this._dataModel!="Olap"&&this._dataModel!="XMLA"?t.buildTag("span.sorting e-icon "+a).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",y=(r=="column"||r=="row"||r=="filter")&&this.model.layout!="excel"&&i.fieldCaption!="Measures"?t.buildTag("span.filter e-icon "+l).attr("role","button").attr("aria-label","filter")[0].outerHTML:"",p=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"",s=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+i.fieldName,(this._dataModel=="Pivot"?i.fieldCaption:i=="Measures"?i:!t.isNullOrUndefined(i.fieldCaption)&&i.fieldCaption!=""?i.fieldCaption:i.fieldName.split(".")[1])+(c!=""?" ("+c+")":""),{},{fieldName:i.fieldName,fieldCaption:i.fieldCaption,axis:h})[0].outerHTML+y+v+p).attr("tag",h+":"+i.fieldName)[0].outerHTML).attr("tag",h+":"+(t.isNullOrUndefined(i.fieldName)?i:i.fieldName))[0].outerHTML}typeof e=="number"&&n(this.element.find(o+" .pivotButton")[e]).length>0?r=="row"?n(this.element.find(".schemaRow .pivotButton")[e]).before(s):r=="column"?n(this.element.find(".schemaColumn .pivotButton")[e]).before(s):r=="value"?n(this.element.find(".schemaValue .pivotButton")[e]).before(s):r=="filter"?n(this.element.find(".schemaFilter .pivotButton")[e]).before(s):"":r=="row"?this.element.find(".schemaRow").append(s):r=="column"?this.element.find(".schemaColumn").append(s):r=="value"?this.element.find(".schemaValue").append(s):r=="filter"?this.element.find(".schemaFilter").append(s):"";b=typeof e!="number"&&e==""?" .pivotButton .pvtBtn:last":" .pivotButton .pvtBtn:eq("+e+")";this.model.enableDragDrop&&this.element.find(o+b).ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)});this.element.find(o+" .pivotButton .filterBtn:last").ejButton({size:"normal",enableRTL:this.model.enableRTL,type:t.ButtonType.Button,contentType:"imageonly",prefixIcon:"filter"});this.element.find(o+" .pivotButton input:last").ejToggleButton({size:"normal",enableRTL:this.model.enableRTL,contentType:"imageonly",defaultPrefixIcon:"ascending",activePrefixIcon:"descending",click:t.proxy(this._sortBtnClick,this)});f&&(this.element.find(o+" .pivotButton:contains("+i+") span:eq(0) span").removeClass("ascending").addClass("descending"),this.element.find(o+" .pivotButton:contains("+i+") span:eq(0) button").addClass("e-active"));this.model.pivotControl._dataModel=="XMLA"&&this.element.find(".pivotButton[tag*=':Measures']").length>0&&(k=n(o+" .pivotButton[tag*=':Measures']"),n(o).append(k));this.element.find(".dropIndicator").removeClass("dropIndicatorHover");this._createContextMenu()},_createContextMenu:function(){var r=this.element.find(".pivotButton"),i;this.model.pivotControl!=null&&(i=t.buildTag("ul.pivotTreeContextMenu#pivotTreeContextMenu",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToFilter"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToValues"))[0].outerHTML)[0].outerHTML)[0].outerHTML,n(this.element).append(i),n("#pivotTreeContextMenu").ejMenu({menuType:t.MenuType.ContextMenu,enableRTL:this.model.enableRTL,openOnClick:!1,contextMenuTarget:r,click:t.proxy(this._contextClick,this),beforeOpen:t.proxy(this._onContextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)}))},_createPivotButtons_1:function(r,u){var o,e,l,f;if(!t.isNullOrUndefined(r)){if(o="",e=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"Slicers":"",this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)for(e=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"Slicers":"values",e=="values"&&this.model.pivotControl._dataModel=="XMLA"&&(r=n.map(r,function(n){return n.measures})),f=0;f<r.length;f++){var a=this.model.pivotControl._dataModel=="XMLA"||this.model.pivotControl._dataModel=="Olap"?"":t.isNullOrUndefined(r[f].filterItems)?"":"filtered",v=this.model.pivotControl._dataModel=="XMLA"||this.model.pivotControl._dataModel=="Olap"?"":r[f].sortOrder==t.PivotAnalysis.SortOrder.Descending?"descending":"",y=this.model.pivotControl._dataModel=="XMLA"?"":r[f].fieldName,s=(u=="column"||u=="row")&&this.model.layout!="excel"&&this.model.pivotControl._dataModel!="Olap"&&this.model.pivotControl._dataModel!="XMLA"?t.buildTag("span.sorting e-icon "+v).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",h=(u=="column"||u=="row"||u=="filter")&&this.model.layout!="excel"&&r[f].fieldCaption!="Measures"?t.buildTag("span.filter e-icon "+a).attr("role","button").attr("aria-label","filter")[0].outerHTML:"",c=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"";o+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+y,this.model.pivotControl._dataModel=="XMLA"?(r[f].fieldCaption!=i?r[f].fieldCaption:r[f].fieldName)||r[f]:n.grep(this.model.pivotTableFields,function(n){return n.name==r[f].fieldName})[0].caption||n.grep(this.model.pivotTableFields,function(n){return n.name==r[f]})[0].caption,{},{fieldName:r[f].fieldName||r[f],axis:e})[0].outerHTML+h+s+c).attr("tag",e+":"+r[f].fieldName||r[f])[0].outerHTML).attr("tag",e+":"+r[f].fieldName||r[f])[0].outerHTML}else for(e==""&&u=="values"&&(l=this.element.find(".pivotButton:contains("+this._getLocalizedLabels("Measures")+")").length>0?this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").parent()[0].className.split(" ")[0]:"schemaColumn",e=l=="schemaColumn"?"Columns":"Rows"),f=0;f<r.length;f++){r[f].FieldHeader=r[f].FieldHeader=="Measures"?this._getLocalizedLabels("Measures"):r[f].FieldHeader;var s=(u=="column"||u=="row")&&this.model.layout!="excel"&&this._dataModel!="Olap"&&this._dataModel!="XMLA"?t.buildTag("span.sorting e-icon ").attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",h=(u=="column"||u=="row"||u=="filter")&&this.model.layout!="excel"&&r[f].FieldHeader!="Measures"?t.buildTag("span.filter e-icon").attr("role","button").attr("aria-label","filter")[0].outerHTML:"",c=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"";o+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+r[f].FieldHeader||r[f].FieldName||r[f].Name||r[f].DimensionName,r[f].FieldHeader||r[f].FieldName||r[f].Name||r[f].DimensionName)[0].outerHTML+h+s+c).attr("tag",e+":"+r[f].Tag)[0].outerHTML).attr("tag",e+":"+r[f].Tag)[0].outerHTML}return this._createContextMenu(),o}},_setSplitBtnTargetPos:function(r){var s="",e,u,f,o;if(r.event!=i&&r.event.type=="touchend"?(u=r.event.originalEvent.target!=null?n(r.event.originalEvent.target).parents(".pivotButton"):n(r.event.originalEvent.srcElement).parents(".pivotButton"),f=r.event.originalEvent.target!=null?r.event.originalEvent.target.className:r.event.originalEvent.srcElement.className):(u=t.isNullOrUndefined(r.originalEvent)?n(r.target).parents(".pivotButton"):r.originalEvent.target!=null?n(r.originalEvent.target).parents(".pivotButton"):n(r.originalEvent.srcElement).parents(".pivotButton"),f=t.isNullOrUndefined(r.originalEvent)?n(r.target).attr("class")?n(r.target).attr("class"):"":r.originalEvent.target!=null&&n(r.originalEvent.target).attr("class")?n(r.originalEvent.target).attr("class"):n(r.originalEvent.srcElement).attr("class")?n(r.originalEvent.srcElement).attr("class"):""),this._droppedClass=u.length>0?n(u[0]).parent()[0].className.split(" ")[0]:f.split(" ")[0],u[0]||f!=i&&f!=null&&jQuery.type(f)=="string"&&f.indexOf("pivotButton")>-1)for(u=u[0]?u[0]:r.originalEvent.target!=null?r.originalEvent.target:r.originalEvent.srcElement,e=r.event!=i&&r.event.type=="touchend"?r.target:this._droppedClass!=null&&this._droppedClass!=i&&this._droppedClass!=""?this.element.find("."+this._droppedClass)[0]:u.parentNode,e=n(e).children(".pivotButton"),o=0;o<e.length;o++)n(e[o]).attr("tag")==n(u).attr("tag")&&(s=o);return s},_getUnSelectedNodes:function(){for(var r,f=this.element.find(".editorTreeView")[0],u="",i=n(f).find(":input.nodecheckbox:not(:checked)"),t=0;t<i.length;t++)n(i[t].parentElement).find("span:nth-child(1)").attr("class").indexOf("e-chk-act")>-1||n(i[t].parentElement).attr("aria-checked")=="mixed"||(r=n(i[t]).parents("li:eq(0)"),u+="::"+r[0].id+"||"+n(r).attr("tag"));return u},_getSelectedNodes:function(t){var o,s,e,r,i;if(t){var h=this.element.find(".editorTreeView")[0].childNodes[0],f=[],u=n(h).children();for(r=0;r<u.length;r++){if(i=u[r],o={caption:n(i.firstChild).find("a").text(),parentId:i.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(i).parents()[1].id,id:i.id,checked:n(i).find(":input.nodecheckbox")[0].checked||n(i).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(i.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(i).attr("tag")},n(i).find("ul:first").children().length>0)for(s=n(i).find("ul:first").children(),e=0;e<s.length;e++)o.childNodes.push(this._getNodeInfo(s[e]));f.push(o)}return JSON.stringify(f)}var h=n(".editorTreeView"),f="",u=n(h).find(":input.nodecheckbox");for(r=0;r<u.length;r++)(u[r].checked||n(u[r].parentElement).attr("aria-checked")=="mixed")&&(i=n(u[r]).parents("li:eq(0)"),f+="::"+i[0].id+"||"+n(i).attr("tag"));return f},_getNodeInfo:function(t){var u={caption:n(t.firstChild).find("a").text(),parentId:t.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(t).parents()[1].id,id:t.id,checked:n(t).find(":input.nodecheckbox")[0].checked||n(t).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(t.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(t).attr("tag")},r,i;if(n(t).find("ul:first").children().length>0)for(r=n(t).find("ul:first").children(),i=0;i<r.length;i++)u.childNodes.push(this._getNodeInfo(r[i]));return u},doAjaxPost:function(r,u,f,e,o,s){this.model.pivotControl.model.editCellsInfo={};var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,this,s),a=!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,dataType:c,async:a,data:f,success:l,complete:n.proxy(o,this),error:function(){this.model.pivotControl._ogridWaitingPopup.hide()}})}});t.PivotSchemaDesigner.Locale={};t.PivotSchemaDesigner.Locale["en-US"]={Sort:"Sort",Search:"Search",SelectField:"select Field",LabelFilterLabel:"Show the items for which the label",ValueFilterLabel:"Show the items for which",ClearSorting:"Clear Sorting",ClearFilterFrom:"Clear Filter From",SortAtoZ:"Sort A to Z",SortZtoA:"Sort Z to A",and:"and",LabelFilters:"Label Filters ",BeginsWith:"Begins With",DoesNotBeginsWith:"Not Begins With",EndsWith:"Ends With",DoesNotEndsWith:"Not Ends With",Contains:"Contains",DoesNotContains:"Not Contains",ValueFilters:"Value Filters",ClearFilter:"Clear Filter",Equals:"Equals",DoesNotEquals:"Not Equals",GreaterThan:"Greater Than",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between",Top10:"Top Count",GreaterThan:"Greater Than",IsGreaterThan:"Is Greater Than",IsGreaterThanOrEqualTo:"Is Greater Than Or Equal To",IsLessThan:"Is Less Than",IsLessThanOrEqualTo:"Is Less Than Or Equal To",ClearFilter:"Clear Filter",SelectField:"Select field",Measures:"Measures",Warning:"Warning",AlertMsg:"The field you are moving cannot be placed in that area of the report",Goal:"Goal",Status:"Status",Trend:"Trend",Value:"value",AddToFilter:"Add to Filter",AddToRow:"Add to Row",AddToColumn:"Add to Column",AddToValues:"Add to Value",PivotTableFieldList:"PivotTable Field List",ChooseFieldsToAddToReport:"Choose fields to add to report:",DragFieldBetweenAreasBelow:"Drag fields between areas below:",ReportFilter:"Filters",ColumnLabel:"Columns",RowLabel:"Rows",Values:"Values",DeferLayoutUpdate:"Defer Layout Update",Update:"Update",OK:"OK",Cancel:"Cancel",Close:"Close"};t.PivotSchemaDesigner.Layouts={Excel:"excel",Normal:"normal",OneByOne:"onebyone"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotClient","ej.PivotClient",{_rootCSS:"e-pivotclient",element:null,model:null,validTags:["div","span"],defaults:{url:"",cssClass:"",title:"",gridLayout:"normal",chartType:"column",clientExportMode:"chartandgrid",enableDeferUpdate:!1,enablePivotTreeMap:!1,enableRTL:!1,enableAdvancedFilter:!1,enablePaging:!1,enableSplitter:!1,enableToolBar:!1,enableLocalStorage:!1,enableVirtualScrolling:!1,enableMemberEditorPaging:!1,enableDrillThrough:!1,showUniqueNameOnPivotButton:!1,isResponsive:!1,dataSource:{data:null,sourceInfo:"",providerName:"ssas",enableAdvancedFilter:!1,isFormattedValues:!1,reportName:"Default",columns:[],cube:"",catalog:"",rows:[],values:[],filters:[],pagerOptions:{categoricalPageSize:0,seriesPageSize:0,categoricalCurrentPage:0,seriesCurrentPage:0}},displaySettings:{mode:"chartandgrid",defaultView:"grid",controlPlacement:"tab",enableTogglePanel:!1,enableFullScreen:!1},serviceMethodSettings:{initialize:"InitializeClient",removeSplitButton:"RemoveSplitButton",filterElement:"FilterElement",nodeDropped:"NodeDropped",toggleAxis:"ToggleAxis",fetchMemberTreeNodes:"FetchMemberTreeNodes",cubeChanged:"CubeChanged",measureGroupChanged:"MeasureGroupChanged",toolbarServices:"ToolbarOperations",memberExpand:"MemberExpanded",saveReport:"SaveReportToDB",fetchReportList:"FetchReportListFromDB",loadReport:"LoadReportFromDB",updateReport:"UpdateReport",exportPivotClient:"Export",mdxQuery:"GetMDXQuery",drillThroughHierarchies:"DrillThroughHierarchies",drillThroughDataTable:"DrillThroughDataTable",paging:"Paging",removeDBReport:"RemoveReportFromDB",renameDBReport:"RenameReportInDB",calculatedMember:"CalculatedMember"},size:{height:"685px",width:"1000px"},toolbarIconSettings:{enableAddReport:!0,enableNewReport:!0,enableRenameReport:!0,enableDBManipulation:!0,enableWordExport:!0,enableExcelExport:!0,enablePdfExport:!0,enableMDXQuery:!0,enableDeferUpdate:!1,enableFullScreen:!1,enableSortOrFilterColumn:!0,enableSortOrFilterRow:!0,enableToggleAxis:!0,enableChartTypes:!0,enableRemoveReport:!0,enableCalculatedMember:!1},customObject:{},enableMeasureGroups:!1,locale:"en-US",analysisMode:"olap",operationalMode:"clientmode",renderSuccess:null,renderFailure:null,renderComplete:null,load:null,chartLoad:null,treeMapLoad:null,drillThrough:null,beforeExport:null,beforeServiceInvoke:null,afterServiceInvoke:null,saveReport:null,loadReport:null,fetchReport:null,memberEditorPageSize:100},dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum",removeSplitButton:"enum",filterElement:"enum",nodeDropped:"enum",toggleAxis:"enum",fetchMemberTreeNodes:"enum",cubeChanged:"enum",measureGroupChanged:"enum",toolbarServices:"enum",memberExpand:"enum",saveReport:"enum",fetchReportList:"enum",loadReport:"enum",updateReport:"enum",exportPivotClient:"enum",mdxQuery:"enum",drillThroughHierarchies:"enum",drillThroughDataTable:"enum",paging:"enum",removeDBReport:"enum",renameDBReport:"enum",calculatedMember:"enum"},displaySettings:"data",customObject:"data"},observables:["title","gridLayout","displaySettings.mode","displaySettings.defaultView","displaySettings.controlPlacement","displaySettings.enableTogglePanel","locale"],title:t.util.valueFunction("title"),gridLayout:t.util.valueFunction("gridLayout"),displayMode:t.util.valueFunction("displaySettings.mode"),defaultView:t.util.valueFunction("displaySettings.defaultView"),controlPlacement:t.util.valueFunction("displaySettings.controlPlacement"),enableTogglePanel:t.util.valueFunction("displaySettings.enableTogglePanel"),locale:t.util.valueFunction("locale"),_init:function(){this._initPrivateProperties();this._load()},_initPrivateProperties:function(){this._id=this.element.attr("id");oclientProxy=this;currentReport="";currentCubeName="";reports="";reportsCount=0;this._pivotGrid=null;this._pivotChart=null;this._pivotSchemaDesigner=null;otreemapObj=null;chartObj=null;this._deferReport="";this._keypress=!1;this._memberTreeObj=null;this._chartHeight=0;this._chartWidth=0;this._gridHeight=0;this._gridWidth=0;this._initStyles=[];this._toggleStyles=[];this._initToggle=!0;this._toggleExpand=!1;this._treemapRender=!1;this._dimensionName="";this._dllSortMeasure=null;this._selectedFieldName="";this._axis="";this._isSorted=!1;this._isFiltered=!1;this._sortOrFilterTab="";this._currentAxis="";this._parentElwidth=0;this.pNode="";this.progressPos=null;this._selectedReport="";this._isMembersFiltered=!1;this._pagerObj=null;this._dialogTitle="";this._dataModel=" ";this._clientReportCollection=[];this._drillParams=[];this._drillInfo=[];draggedSplitBtn=null;isDragging=!1;isDropped=!1;measureGroupInfo="";this._currentTab=this.defaultView();this._currentItem=null;this._currentReportItems=[];this._treeViewData={};this._memberPageSettings={currentMemeberPage:1,startPage:0,endPage:0};this._isNodeOrButtonDropped=!1;this._ischartTypesChanged=!1;this._isrenderTreeMap=!1;this._isRemoved=!1;this._waitingPopup=null;this._isGridDrillAction=!1;this._isChartDrillAction=!1;this._olapReport="";this._jsonRecords=null;this._excelFilterInfo=[];this._index={tab:0,icon:1,chartimg:0,button:1,dialog:0,editor:0,tree:0};this._curFocus={tab:null,icon:null,chartimg:null,button:null,dialog:null,editor:null,tree:null};this._seriesCurrentPage=1;this._categCurrentPage=1;this._isReportListAction=!0;this._currentRecordName="";this._pagingSavedObjects={drillEngine:[],savedHdrEngine:[],curDrilledItem:{}};this._fieldMembers={};this._fieldSelectedMembers={};this._allMember="";this._editorTreeData=[];this._isSearchApplied=!1;this._isTimeOut=!1;this._calcMemberTreeObj=null;this._cubeTreeView=null;this._calcMemberDialog=null;this._calcMembers=[];this._selectedCalcMember=null;this._isAllMemberChecked=!0},getOlapReport:function(){return JSON.parse(this._olapReport)},setOlapReport:function(n){this._olapReport=JSON.stringify(n)},getJSONRecords:function(){return JSON.parse(this._jsonRecords)},setJSONRecords:function(n){this._jsonRecords=JSON.stringify(n)},getActiveTab:function(){return this._currentTab},_destroy:function(){this.element.empty().removeClass("e-pivotclient"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy();delete oclientProxy},_load:function(){var u={element:this.element,customObject:this.model.customObject},r,i;(this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter)&&(this.model.dataSource.enableAdvancedFilter=this.model.enableAdvancedFilter=!0);this.model.toolbarIconSettings.enableFullScreen=this.model.displaySettings.enableFullScreen=this.model.toolbarIconSettings.enableFullScreen||this.model.displaySettings.enableFullScreen?!0:!1;this.model.toolbarIconSettings.enableDeferUpdate=this.model.enableDeferUpdate=this.model.enableDeferUpdate?!0:!1;this._trigger("load",u);this.element.addClass(this.model.cssClass);n("#"+this._id).ejWaitingPopup({showOnInit:!0});this._waitingPopup=n("#"+this._id).data("ejWaitingPopup");this.model.dataSource.data==null&&this.model.url!=""||this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(this.model.operationalMode=t.Pivot.OperationalMode.ServerMode,t.isNullOrUndefined(this.model.beforeServiceInvoke)||this._trigger("beforeServiceInvoke",{action:"initializeClient",element:this.element,customObject:this.model.customObject}),r=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:this.model.enableDrillThrough&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?"initializeClient:getDataSet":"initializeClient",customObject:r,clientParams:this.model.enableMeasureGroups+"-"+this.model.chartType}),this._renderControlSuccess)):(this.model.operationalMode=t.Pivot.OperationalMode.ClientMode,this.model.analysisMode=this.model.dataSource.cube!=""?t.Pivot.AnalysisMode.Olap:t.Pivot.AnalysisMode.Pivot,i=this,setTimeout(function(){i._renderLayout();i._createControl();i.model.enableSplitter&&i._createSplitter()},0))},_renderClientControls:function(t){this._renderLayout();this.setOlapReport(t.PivotReport);var i=n.parseJSON(t.PivotReport);this.currentReport=this.getOlapReport()!=""?JSON.parse(this.getOlapReport()).Report:"";this.setJSONRecords({GridJSON:t.GridJSON,ChartJSON:t.ChartJSON});this._createControl();this.model.enableSplitter&&this._createSplitter();this.model.enableAdvancedFilter&&this._pivotGrid&&this._pivotGrid._removeCells(t)},_createControl:function(){var f="",e,o,h,r,i,u;if(this.element.find("#"+this._id+"_PivotSchemaDesigner").ejPivotSchemaDesigner({pivotControl:this,_waitingPopup:this._waitingPopup,enableRTL:this.model.enableRTL,layout:t.PivotSchemaDesigner.Layouts.OneByOne,olap:{showKPI:!1,showNamedSets:!1},serviceMethods:{nodeDropped:this.model.serviceMethodSettings.nodeDropped,memberExpand:this.model.serviceMethodSettings.memberExpand},locale:this.model.locale,width:this.model.enableSplitter?"100%":this.element.width()/3,height:this.element.find(".controlPanel").height()}),this.model.enablePaging&&(this.element.find("#"+this._id+"_Pager").ejPivotPager({locale:this.model.locale,mode:t.PivotPager.Mode.Both,targetControlID:this._id}),this.element.find(".controlPanel").height(this.element.find(".controlPanel").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".gridContainer").height(this.element.find(".gridContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".chartContainer").height(this.element.find(".chartContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+10))),e=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 5px"})[0].outerHTML,this.element.find(".parentSchemaFieldTree").prepend(e),this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",height:"25px",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),this.model.enableMeasureGroups&&this._createMeasureGroup(),o=this._clientReportCollection.length>0?this._clientReportCollection:[{name:this.model.dataSource.reportName}],this.element.find(".reportlist").ejDropDownList({dataSource:o,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"26px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.element.find(".reportlist").attr("tabindex",0),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this._clientReportCollection.push(this.model.dataSource),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){var s=this.element.find(".csHeader").width()-this.element.find(".cubeText").width()-this.element.find(".toggleExpandButton").width()-(this.model.enableSplitter?50:20),c=this.enableTogglePanel()?s-25:s,l=f==""?"":n.parseJSON(f);this.element.find(".cubeSelector").ejDropDownList({dataSource:l,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},width:this.model.enableSplitter&&!this.model.isResponsive?"100%":""+c+"px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});h=this.element.find(".cubeSelector").data("ejDropDownList");h.selectItemByText(this.currentCubeName)}r=this.element.find("#reportList").data("ejDropDownList");this._isReportListAction=!1;r.model.dataSource.length&&r.selectItemByText(r.model.dataSource[0].name);this._isReportListAction=!0;this._selectedReport=r._currentText;this.element.find(".cubeSelector").ejDropDownList("option","change",t.proxy(this._cubeChanged,this));this.element.find(".cubeSelector").attr("tabindex",0);this.element.find(".reportlist").ejDropDownList("option","change",t.proxy(this._reportChanged,this));this.model.enableMeasureGroups&&this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this));this.element.find("#clientTab").ejTab({enableRTL:this.model.enableRTL,itemActive:t.proxy(this._onTabClick,this)});this.model.enableSplitter||this.element.find(".controlPanel").width(this.element.width()-this.element.find("#"+this._id+"_PivotSchemaDesigner").width()-(this.model.displaySettings.enableTogglePanel?30:10));this.displayMode()!="chartonly"&&(this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({locale:this.model.locale,customObject:this.model.customObject,enableRTL:this.model.enableRTL,isResponsive:this.model.isResponsive,drillSuccess:t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._gridDrillSuccess:this._clientGridDrillSuccess,this),enableCollapseByDefault:!0}),this._pivotGrid=this.element.find("#"+this._id+"_PivotGrid").data("ejPivotGrid"),this._pivotGrid.model.operationalMode=this.model.operationalMode,this._pivotGrid.model.analysisMode=this.model.analysisMode,this._pivotGrid._waitingPopup=this._waitingPopup,this._pivotGrid.model.url=this.model.url,this._pivotGrid.model.dataSource=this.model.dataSource);this.displayMode()!="gridonly"&&(this.element.find("#"+this._id+"_PivotChart").ejPivotChart({locale:this.model.locale,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,drillSuccess:t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._chartDrillSuccess:this._clientChartDrillSuccess,this),size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}}}),this._pivotChart=this.element.find("#"+this._id+"_PivotChart").data("ejPivotChart"),this._pivotChart.model.operationalMode=this.model.operationalMode,this._pivotChart.model.analysisMode=this.model.analysisMode,this._pivotChart._waitingPopup=this._waitingPopup,this._pivotChart.model.url=this.model.url,this._pivotChart.model.dataSource=this.model.dataSource);this._pivotSchemaDesigner=this.element.find("#"+this._id+"_PivotSchemaDesigner").data("ejPivotSchemaDesigner");i={};this._pivotChart!=null&&(this.element.find("#"+this._id+"_PivotChart").width(this._pivotChart.model.size.width),i.chartModelWidth=this._pivotChart.model.size.width);i.controlPanelWidth=this.element.find(".controlPanel").width();i.chartOuterWidth=this._chartWidth;i.gridOuterWidth=this._gridWidth;this._initStyles.push(i);this.model.isResponsive&&(this._enableResponsive(),this._parentElwidth=n("#"+this._id).parent().width(),this._parentElwidth<850?this._rwdToggleCollapse():this._parentElwidth>850&&this._rwdToggleExpand(),this._pivotSchemaDesigner.element.width((this._pivotSchemaDesigner.element.width()-30)/this._pivotSchemaDesigner.element.width()*100+"%"));this.enableTogglePanel()&&this.element.find(".pivotFieldList").length>0&&(this.element.find(".togglePanel").height(this.element.find("#"+this._id+"_PivotSchemaDesigner").height()).width(14),this.element.find(".toggleExpandButton,.toggleCollapseButton").css("margin-top",(this.element.find("#"+this._id+"_PivotSchemaDesigner").parents("td:eq(0)").height()-9)/2),this.element.find(".togglePanel").children().addClass("toggleButtons"));this._trigger("renderSuccess",this);this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this),this.element.find(".fieldTable").css("border","none"),this.element.find(".parentSchemaFieldTree").addClass("olapFieldList")):this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this._pivotGrid.setJSONRecords(this.getJSONRecords().GridJSON),this._pivotGrid.setOlapReport(this.getOlapReport()),this.model.gridLayout=="excellikelayout"?this._pivotGrid.excelLikeLayout(this._pivotGrid.getJSONRecords()):this._pivotGrid.renderControlFromJSON()),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart.model.enableMultiLevelLabels?this._pivotChart._generateData({JsonRecords:this.getJSONRecords(),PivotReport:this.getOlapReport()}):this._pivotChart.renderControlSuccess({JsonRecords:this.getJSONRecords().ChartJSON,OlapReport:this.getOlapReport()})),this.currentReport=this.getOlapReport()!=""?JSON.parse(this.getOlapReport()).Report:""):(u=t.PivotAnalysis.pivotEnginePopulate(this.model),this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this._pivotGrid.setJSONRecords(JSON.stringify(u.json)),this.model.gridLayout=="excellikelayout"?this._pivotGrid.excelLikeLayout(u.json):this._pivotGrid.renderControlFromJSON()),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart.setPivotEngine(u.pivotEngine),this._pivotChart._generateData(u.pivotEngine)));this._unWireEvents();this._wireEvents()},_createMeasureGroup:function(){this.element.find(".measureGroupselector").remove();n(this.element).find(".cubeBrowser").prepend("<div class ='measureGroupselector' style='margin:5px 5px 0px 5px'><input type='text' id='measureGroupSelector' class='measureGroupSelector' /><\/div>");this.element.find(".measureGroupSelector").ejDropDownList({dataSource:this.measureGroupInfo,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"25px",width:"100%",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});this.element.find(".measureGroupSelector").attr("tabindex",0);measureDropTarget=this.element.find(".measureGroupSelector").data("ejDropDownList");measureDropTarget.selectItemByText(measureDropTarget.model.dataSource[0].name);this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this))},refreshControl:function(r){var s,o;if(t.isNullOrUndefined(this._pivotSchemaDesigner)||this._pivotSchemaDesigner._refreshPivotButtons(),this.element.find(".chartTypesDialog").length>0&&this.element.find(".chartTypesDialog").remove(),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart._labelCurrentTags={}),this.model.operationalMode==t.Pivot.OperationalMode.ServerMode){var u=null,f=null,e=null;r[0]!=i?(u=r[0].Value,f=r[1].Value,e=r[2].Value):t.isNullOrUndefined(r.d)?(u=r.PivotReport,f=r.GridJSON,e=r.ChartJSON):(u=r.d[0].Value,f=r.d[1].Value,e=r.d[2].Value);s=this;this._clientReportCollection=n.map(this._clientReportCollection,function(n){return n.report=n.name==s._currentReportName?JSON.parse(u).Report:n.report,n});this.setJSONRecords({GridJSON:f,ChartJSON:e});this.setOlapReport(u);this._pivotGrid.setJSONRecords(f);this._pivotGrid.renderControlFromJSON();this._pivotGrid&&this._pivotGrid._removeCells(r);this._pivotChart._drillAction&&(this._pivotChart._drillAction="");this._pivotChart.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(this._pivotChart._drillParams=this._drillParams=[],this._pivotChart._generateData({JsonRecords:r,PivotReport:u})):this._pivotChart.renderControlSuccess({OlapReport:u,JsonRecords:e})}else this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(o=t.PivotAnalysis.pivotEnginePopulate(this.model),this.generateJSON({tranposeEngine:o.pivotEngine,jsonObj:o.json})):t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this);this.model.isResponsive&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)||this.element.find("#"+this.chartObj._id).ejChart("option",{model:{size:{height:this._chartHeight}}}));this._unWireEvents();this._wireEvents()},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"title":this.element.find(".titleText").text(this.title());break;case"currentCubeName":this.currentCubeName=n[t];break;case"gridLayout":this._renderPivotGrid();break;case"olapReport":this.currentReport=n[t];break;case"clientReports":this.reports=n[t];break;case"customObject":this.model.customObject=n[t];break;case"locale":this.locale();(this._pivotGrid||this._pivotChart)&&this._load();break;case"displaySettings":(this._pivotGrid||this._pivotChart)&&this._load()}},_getMeasuresList:function(){var t="";return this.element.find(".memberEditorDiv").find("div").each(function(){t+=n(this)[0].id+","}),t},_getUnSelectedNodes:function(){var t="",n;if(this._currentItem.indexOf("Measures")<0)for(n=0;n<this._memberTreeObj.dataSource().length;n++)this._memberTreeObj.dataSource()[n].checkedStatus==!1&&(t+="::"+this._memberTreeObj.dataSource()[n].id+"||"+this._memberTreeObj.dataSource()[n].tag);return t},_getSelectedNodes:function(t){var i,e,o,f,u,r;if(t){var h=this.element.find(".editorTreeView")[0].childNodes[0],u=[],s=n(h).children();for(r=0;r<s.length;r++){if(i=s[r],e={caption:n(i.firstChild).find("a").text(),parentId:i.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(i).parents()[1].id,id:i.id,checked:n(i).find(":input.nodecheckbox")[0].checked||n(i).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(i.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(i).attr("tag")},n(i).find("ul:first").children().length>0)for(o=n(i).find("ul:first").children(),f=0;f<o.length;f++)e.childNodes.push(this._getNodeInfo(o[f]));u.push(e)}return JSON.stringify(u)}if(u="",this._currentItem.indexOf(this._getLocalizedLabels("Measures"))<0)for(r=0;r<this._memberTreeObj.dataSource().length;r++)this._memberTreeObj.dataSource()[r].checkedStatus==!0&&(u+="::"+this._memberTreeObj.dataSource()[r].id+"||"+this._memberTreeObj.dataSource()[r].tag);return u},_getNodeInfo:function(t){var u={caption:n(t.firstChild).find("a").text(),parentId:t.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(t).parents()[1].id,id:t.id,checked:n(t).find(":input.nodecheckbox")[0].checked||n(t).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(t.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(t).attr("tag")},r,i;if(n(t).find("ul:first").children().length>0)for(r=n(t).find("ul:first").children(),i=0;i<r.length;i++)u.childNodes.push(this._getNodeInfo(r[i]));return u},_removeSplitBtn:function(){var i=n(document).find(".dragClone"),u,f,r,e;clientObj=this;f=this.element.find(".splitBtn");jQuery.each(f,function(t,r){n(n(r).children()[0]).attr("title")==n(i).attr("title")&&(u=n(r).attr("tag"),n(r).remove())});this._currentReportItems.length!=0&&this._treeViewData.hasOwnProperty(n(i).attr("title"))&&(delete this._treeViewData[n(i).attr("title")],this._currentReportItems.splice(n.inArray(n(i).attr("title"),this._currentReportItems),1));this.model.enableAdvancedFilter&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(r=u.split(":")[1].split("."),t.isNullOrUndefined(r)||r.length!=2||(this._setUniqueNameFrmBtnTag(r),this._removeFilterTag(this._selectedFieldName)));n(".dragClone").remove();this._isTimeOut=!0;setTimeout(function(){clientObj._isTimeOut&&clientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"removeSplitButton",element:this.element,customObject:this.model.customObject});e=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeSplitButton,JSON.stringify({action:"removeSplitButton",clientParams:u,olapReport:this.currentReport,clientReports:this.reports,customObject:e}),this._removeSplitButtonSuccess);this._isNodeOrButtonDropped=!0},_wireEvents:function(){this._wireDialogEvent();this._wireEditorRemoveEvent();this._wireMeasureRemoveEvent();this._on(n(document),"keydown",this._keyPressDown);this._on(n(document),"keyup",this._keyPressUp);this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejDraggable({handle:"button",clone:!0,cursorAt:{top:-10,left:-10},dragStart:function(i){i.event.preventDefault();n(this.element.find(".e-txt")).off("touchstart");n(this.element.find(".e-txt")).off(t.eventType.click);isDragging=!0;this.element.find(".e-dialog").hide();draggedSplitBtn=i.event.target},dragStop:function(t){var r,e,u,f;this.element.find(".targetAxis").removeClass("targetAxis");isDragging=!1;r=null;u=n(this.element).parents(".e-pivotclient").data("ejPivotClient");e=t.event.type=="touchend"?u._setSplitBtnTargetPos(t):u._setSplitBtnTargetPos(t.event);u._dropAxisClassName!=i&&u._dropAxisClassName!=""?(u._dropAxisClassName=="outOfAxis"?u._removeSplitBtn():r=u._dropAxisClassName,u._dropAxisClassName=""):t.target!=i?n(t.target).hasClass("e-btn")||n(t.target).hasClass("removeSplitBtn")?r=n(t.target).parents("div:eq(1)").attr("class"):jQuery.type(t.target.className)!="string"?u._removeSplitBtn():r=t.target.className.indexOf("splitBtn")>-1?n(t.target).parents("div:eq(0)").attr("class"):t.target.className:r=n(t.event.originalEvent.srcElement).hasClass("e-btn")||n(t.event.originalEvent.srcElement).hasClass("removeSplitBtn")?n(t.event.originalEvent.srcElement).parents("div:eq(1)").attr("class"):t.event.originalEvent.srcElement.className.indexOf("splitBtn")>-1?n(t.event.originalEvent.srcElement).parents("div:eq(0)").attr("class"):t.event.originalEvent.srcElement.className;r!=i&&r!=null&&(f=r.indexOf("categoricalAxis")>r.indexOf("rowAxis")?r.indexOf("categoricalAxis")>r.indexOf("slicerAxis")?"Categorical":"Slicer":r.indexOf("rowAxis")>r.indexOf("slicerAxis")?"Series":r.indexOf("slicerAxis")>=0?"Slicer":null,f!=null?u._splitButtonDropped(f,e):u._removeSplitBtn(),u._setSplitBtnTitle())},helper:function(t){var i=n(t.sender.target).parents(".e-pivotclient").data("ejPivotClient");return t.sender.target.className.indexOf("e-btn")>-1?n(t.sender.target).clone().addClass("dragClone").appendTo(i.element):!1}});this.element.find(".nextPage, .prevPage, .firstPage, .lastPage").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");t.Pivot.editorTreeNavigatee(i,r)});this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").mouseover(function(){isDragging&&n(this).addClass("targetAxis")});this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").mouseleave(function(){n(this).removeClass("targetAxis")});this.element.find(".e-btn").mouseover(function(t){n(t.target.parentNode).find("span").css("display","inline")});this.model.enableDrillThrough&&(this._pivotGrid.model.enableDrillThrough=!0,n.proxy(this._pivotGrid._addHyperlink,this));this.element.find(".splitBtn").mouseover(function(){isDragging&&n(this).addClass("dropIndicator")});this.element.find(".splitBtn").mouseleave(function(){n(this).removeClass("dropIndicator")});this._on(this.element,"click","#preventDiv",t.proxy(function(){this.element.find(".e-dialog.advancedFilterDlg:visible").length>0&&(this.element.find(".e-dialog.advancedFilterDlg").hide(),this.element.find("#preventDiv").remove())},this));this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode||this._on(this.element,"mouseover",".pvtBtn",t.proxy(function(t){var i=n(t.currentTarget).parents(".e-pivotclient").data("ejPivotClient");(isDragging||i._pivotSchemaDesigner._isDragging)&&n(t.target).siblings(".dropIndicator").addClass("dropIndicatorActive")},this));this._on(this.element,"mouseleave",".pvtBtn",t.proxy(function(t){n(t.target).siblings(".dropIndicator").removeClass("dropIndicatorActive")},this));this.element.find(".sortDisable, .sortEnable, .filterDisable, .filterEnable ").on(t.eventType.click,function(t){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");t.target.className=="sortDisable"?(n(".measuresList_wrapper,.radioBtnAsc, .radioBtnDesc, .preserveHrchy").attr("disabled","disabled"),n(".measureListLbl, .orderLbl, .radioBtnAscLbl, .radioBtnDescLbl, .preserveHrchyLbl").addClass("sortFilterDisable"),i._dllSortMeasure.disable()):t.target.className=="sortEnable"?(n(".measuresList_wrapper,.radioBtnAsc, .radioBtnDesc, .preserveHrchy").removeAttr("disabled"),n(".measureListLbl, .orderLbl, .radioBtnAscLbl, .radioBtnDescLbl, .preserveHrchyLbl").removeClass("sortFilterDisable"),i._dllSortMeasure.enable()):t.target.className=="filterDisable"?(n(".filterFrom, .filterTo").attr("disabled","disabled"),n(".filterMeasureListLbl, .conditionLbl, .filterValueLbl, .filterBtw").addClass("sortFilterDisable"),i._dllFilterCondition.disable(),i._dllfMeasuresList.disable()):t.target.className=="filterEnable"&&(n(".filterFrom, .filterTo").removeAttr("disabled"),n(".filterMeasureListLbl, .conditionLbl, .filterValueLbl, .filterBtw").removeClass("sortFilterDisable"),i._dllFilterCondition.enable(),i._dllfMeasuresList.enable())});this.element.find(".filterFrom , .filterTo").keypress(function(t){return t.which==8||t.which==0?!0:t.which<46||t.which>58?!1:t.which==46&&n(this).val().indexOf(".")!=-1||t.which==47?!1:void 0});this.element.find(".toggleExpandButton").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r,u;i.model.isResponsive?i._rwdToggleCollapse():(i._toggleExpand=!0,i._initToggle&&(i._initToggle=!1,r={},u=(i.element.find(".cubeTable").width()||i.element.find(".pivotFieldList").width())+i.element.find(".controlPanel").width()-17,r.controlPanelWidth=u-3,r.chartOuterWidth=r.chartModelWidth=r.gridOuterWidth=u-17,i._toggleStyles.push(r)),i.displayMode()==t.PivotClient.DisplayMode.GridOnly?i.element.find(".gridContainer").width(i.element.width()-40):i.displayMode()==t.PivotClient.DisplayMode.ChartOnly?i.element.find(".chartContainer").width(i.element.width()-45):i.controlPlacement()==t.PivotClient.ControlPlacement.Tile?i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.width()-25),i.element.find(".chartContainer").width(i.element.width()-65)):(i.element.find(".gridContainer").width(i.element.width()-40),i.element.find(".chartContainer").width(i.element.width()-45)):i.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&(i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.width()-25),i.element.find(".chartContainer").width(i.element.width()-65)):(i.element.find(".gridContainer").width(i.element.width()-25),i.element.find(".chartContainer").width(i.element.width()-45))),i._performToggleAction(i._toggleStyles),i.element.find(".csHeader, .cubeTable,.toggleExpandButton, .pivotFieldList").hide(),i.element.find(".toggleCollapseButton").show(),i.element.find(".toggleText").show(),i.model.enablePivotTreeMap&&i.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(i.chartObj)&&!t.isNullOrUndefined(i.otreemapObj)&&(i.chartObj=i.element.find("#"+i.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(i.chartObj)||(i.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?i.otreemapObj._treeMap.refresh():i.chartObj.redraw())))});this.element.find(".toggleCollapseButton").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");i.model.isResponsive?(i._rwdToggleExpand(),i.model.enableSplitter&&i.element.find(".splitresponsive").data("ejSplitter").refresh()):(i._toggleExpand=!1,i._performToggleAction(i._initStyles),i.element.find(".csHeader, .cubeTable,.toggleExpandButton, .pivotFieldList").show(),i.element.find(".toggleCollapseButton").hide(),i.element.find(".toggleText").hide(),i.displayMode()==t.PivotClient.DisplayMode.GridOnly?i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5):i.displayMode()==t.PivotClient.DisplayMode.ChartOnly?i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5):i.controlPlacement()==t.PivotClient.ControlPlacement.Tile?i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5)):(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5)):i.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&(i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5)):(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5))),i.model.enableToolBar&&(i.element.find("#"+this._id+"_PivotCharttoolBar").width(i.element.find(".chartContainer").width()),i.element.find("#"+this._id+"_PivotGridToolbar").width(i.element.find(".gridContainer").width()-10),i.element.find(".chartToolBar").width(i.element.find(".chartContainer").width()),i.element.find(".toolBar").width(i.element.find(".gridContainer").width())),i.model.enablePivotTreeMap&&i.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(i.chartObj)&&!t.isNullOrUndefined(i.otreemapObj)&&(i.chartObj=i.element.find("#"+i.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(i.chartObj)||(i.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?i.otreemapObj._treeMap.refresh():i.chartObj.redraw())))});this.element.find(".maximizedView").click(function(){var t=n(this).parents(".e-pivotclient").data("ejPivotClient");t._maxViewBtnClick()});n(document).on("click",".winCloseBtn",function(t){var i=n("#"+n(t.target).attr("clientID")).data("ejPivotClient");i._maxViewClsBtnClick()});if(this.model.isResponsive)n(window).on("resize",n.proxy(this._reSizeHandler,this));this.model.enableSplitter&&this._on(this.element,"mouseup",".parentsplit,.childsplit",t.proxy(function(t){var i=this,r;n(t.target).hasClass("e-shadowbar")&&(n(t.target).parent().hasClass("childsplit")||!n(t.target).parent().hasClass("parentsplit")?r=i.element.find(".controlPanelTD").width():n(t.target).parent().hasClass("parentsplit")&&!i.model.enableRTL?r=i.element.find(".controlPanelTD").width()+(i.element.find(".controlPanelTD").offset().left-i.element.find(".e-shadowbar").offset().left):n(t.target).parent().hasClass("parentsplit")&&i.model.enableRTL&&(r=i.element.find(".controlPanelTD").width()+(i.element.find(".e-shadowbar").offset().left-i.element.find(".e-split-divider").offset().left)),n("#"+i._pivotChart._id+"Container").width(r),i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),i.chartObj.redraw())}))},_keyPressUp:function(n){if(n.keyCode===93&&!this.element.find(".e-dialog:visible").length>0&&this.element.find(".hoverCell:visible").length>0&&(n.preventDefault(),!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-text"))){var i={x:this.element.find(".hoverCell").offset().left+this.element.find(".hoverCell").outerWidth(),y:this.element.find(".hoverCell").offset().top+this.element.find(".hoverCell").outerHeight()};this.element.find(".hoverCell").trigger({type:"mouseup",which:3,clientX:i.x,clientY:i.y,pageX:i.x,pageY:i.y})}},_createSplitter:function(){this.model.isResponsive||(this.model.enableRTL?(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.enableVirtualScrolling||this.element.find(".parentsplit").ejSplitter({width:"100%",enableRTL:!0,isResponsive:!0,cssClass:"customCSS",height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5):this.element.find(".outerTable").height(),properties:[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"50%"},{collapsible:!1,minSize:225}],resize:function(){var n=this.element.find(".childsplit").data("ejSplitter");n.option("properties",[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"50%",minSize:0},{paneSize:"50%",minSize:0,collapsible:!1}])}}),this.element.find(".childsplit").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+30):"",width:"100%",enableRTL:!0,properties:[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"50%"},{paneSize:"50%",collapsible:!1}]})):(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.enableVirtualScrolling||this.element.find(".parentsplit").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5):this.element.find(".outerTable").height(),properties:[{expandable:!1,collapsible:!1},{enableAutoResize:!0,collapsible:!1}],resize:function(){var n=this.element.find(".childsplit").data("ejSplitter");n.option("properties",[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"47%",enableRTL:this.model.enableRTL},{paneSize:"47%",collapsible:!1}])}}),this.element.find(".childsplit").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+30):"",properties:[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"47%",enableRTL:this.model.enableRTL},{paneSize:"47%",collapsible:!1}]})));this.model.isResponsive&&this.element.find(".splitresponsive").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+25):"",properties:[{expandable:!1,collapsible:!1,paneSize:"48%"},{enableAutoResize:!0,collapsible:!1}]})},_keyPressDown:function(i){var u,o,f,e,r;if(t.isNullOrUndefined(this._curFocus.button)?t.isNullOrUndefined(this._curFocus.tab)||(u=this._curFocus.tab):u=this._curFocus.button,i.keyCode===93&&!t.isNullOrUndefined(u)&&!this.element.find(".e-dialog:visible").length>0&&this.element.find(".hoverCell:visible").length>0&&(i.preventDefault(),o={x:n(u).offset().left+n(u).outerWidth(),y:n(u).offset().top+n(u).outerHeight()},u.trigger({type:"mouseup",which:3,clientX:o.x,clientY:o.y,pageX:o.x,pageY:o.y})),(i.which===46||i.which===82&&i.ctrlKey)&&!this.element.find(".e-dialog:visible").length>0&&!t.isNullOrUndefined(u)?(i.preventDefault(),u.parent().find(".removeSplitBtn:visible").click()):(i.which===46||i.which===82&&i.ctrlKey&&(!t.isNullOrUndefined(this._curFocus.dialog)&&this._curFocus.dialog.hasClass("measureEditor")||!t.isNullOrUndefined(this._curFocus.editor)&&this._curFocus.editor.hasClass("measureEditor")))&&(t.isNullOrUndefined(this._curFocus.editor)?t.isNullOrUndefined(this._curFocus.dialog)||this._curFocus.dialog.find(".removeMeasure:visible").click():this._curFocus.editor.find(".removeMeasure:visible").click()),i.keyCode==79&&this.element.find(".e-dialog:visible").length>0&&i.ctrlKey&&(i.preventDefault(),!t.isNullOrUndefined(this._curFocus.icon)&&this._curFocus.icon.hasClass("mdxImg")?this.element.find(".dialogCancelBtn:visible").click():this.element.find(".dialogOKBtn:visible").click(),this._curFocus.dialog=null),i.which===70&&i.ctrlKey&&!t.isNullOrUndefined(u)&&u.click(),i.keyCode==67&&this.element.find(".e-dialog:visible").length>0&&this.element.find(".e-dialog .e-titlebar").attr("tag")!="MDX Query"&&i.ctrlKey&&(i.preventDefault(),this.element.find(".dialogCancelBtn:visible").click(),this._curFocus.dialog=null),this.element.find(".e-dialog:visible").length>0&&i.keyCode==27?(t.isNullOrUndefined(this._curFocus.icon)?t.isNullOrUndefined(this._curFocus.editor)?t.isNullOrUndefined(this._curFocus.dialog)||this._curFocus.dialog.attr("tabindex","-1").addClass("hoverCell").focus().mouseover():this._curFocus.editor.attr("tabindex","-1").addClass("hoverCell").focus().mouseover():this._curFocus.icon.attr("tabindex","-1").addClass("hoverCell").focus().mouseover(),this._curFocus.dialog=null,this._index.editor=0):this.element.find(".e-dialog:visible").length==0&&i.keyCode==27&&n(".fullScreenView").length!=0?(this._maxViewClsBtnClick(),t.isNullOrUndefined(this._pivotGrid._curFocus.cell)?this._curFocus.tab.hasClass("e-icon")||this._curFocus.tab.focus().mouseover():this._pivotGrid._curFocus.cell.focus().mouseover()):this.element.find(".chartTypesDialog:visible").length>0&&i.which===27?(this.element.find(".chartTypesDialog").remove(),this._curFocus.chartimg=null):n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&i.which===27&&(t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(u)||u.attr("tabindex","-1").focus().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().addClass("hoverCell")),(i.which===9&&i.shiftKey||i.which===9)&&this.element.find(".e-dialog:visible").length>0?(i.preventDefault(),this._curFocus.editor=null,this.element.find(".e-dialog .hoverCell:visible").removeClass("hoverCell"),f=!t.isNullOrUndefined(this._dllSortMeasure)&&this._dllSortMeasure.model.enabled&&this.element.find("#measuresList_container:visible").length>0||!t.isNullOrUndefined(this._dllfMeasuresList)&&this._dllfMeasuresList.model.enabled&&this.element.find("#fMeasuresList_container:visible").length>0?this.element.find(".e-dialog .filterEnable:visible,#measuresList_container:visible,#fMeasuresList_container:visible,#filterCondition_container:visible,.e-dialog .filterFrom:visible:not([disabled='disabled']),.e-dialog .filterTo:visible:not([disabled='disabled']),.e-dialog .radioBtnAsc:visible:not([disabled='disabled']),.e-dialog .preserveHrchy:visible:not([disabled='disabled']),.e-dialog .dialogOKBtn:visible:not([aria-disabled='true']),.e-dialog .dialogCancelBtn:visible,.e-dialog .e-close:visible,.e-dialog .checkAll:visible,.e-dialog .unCheckAll:visible,.e-dialog .sortfiltTab .e-active:visible,.e-dialog .measureEditor:visible:first,.e-dialog .e-text:visible:first,.e-dialog .sortEnable:visible,.e-dialog .reportName:visible,#reportNameList_container:visible"):this.element.find(".e-dialog .filterEnable:visible,.e-dialog .filterFrom:visible:not([disabled='disabled']),.e-dialog .filterTo:visible:not([disabled='disabled']),.e-dialog .radioBtnAsc:visible:not([disabled='disabled']),.e-dialog .preserveHrchy:visible:not([disabled='disabled']),.e-dialog .dialogOKBtn:visible:not([aria-disabled='true']),.e-dialog .dialogCancelBtn:visible,.e-dialog .e-close:visible,.e-dialog .checkAll:visible,.e-dialog .unCheckAll:visible,.e-dialog .sortfiltTab .e-active:visible,.e-dialog .measureEditor:visible:first,.e-dialog .e-text:visible:first,.e-dialog .sortEnable:visible,.e-dialog .reportName:visible,#reportNameList_container:visible"),t.isNullOrUndefined(this._curFocus.dialog)?(this._index.dialog=f.length>4?4:2,this._curFocus.dialog=f.eq(this._index.dialog)):(this._curFocus.dialog.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===9&&i.shiftKey?this._index.dialog=this._index.dialog-1<0?f.length-1:this._index.dialog-1:i.which===9&&(this._index.dialog=this._index.dialog+1>f.length-1?0:this._index.dialog+1),this._curFocus.dialog=f.eq(this._index.dialog)),this._curFocus.dialog.hasClass("e-input")||this._curFocus.dialog.attr("type")=="radio"?this._curFocus.dialog.attr("tabindex","-1").focus():this._curFocus.dialog.attr("tabindex","-1").focus().addClass("hoverCell").mouseover):(i.which===9&&i.shiftKey||i.which===9)&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&(i.preventDefault(),this.element.find(".hoverCell").removeClass("hoverCell").mouseleave(),this.element.find(".e-node-focus").removeClass("e-node-focus"),this._index.button=1,this._index.icon=1,this._index.chartimg=0,this._index.tree=0,this._index.dialog=0,this._curFocus.button=null,this._curFocus.icon=null,this._curFocus.chartimg=null,this._curFocus.tree=null,this._curFocus.editor=null,this._curFocus.dialog=null,n(".fullScreenView").length!=0?n("[role='columnheader']:visible:not([p='0,0'])").first().length>0&&(f=n("[role='columnheader']:visible:not([p='0,0']):first")):f=this.element.find("[role='columnheader']:visible:not([p='0,0']):first,.schemaFieldTree .e-text:visible:first,.reportToolbar li:visible:first,#reportList_wrapper:visible,#cubeList_wrapper:visible,#cubeSelector_wrapper:visible,.cubeTreeView .e-text:visible:first,.categoricalAxis button:visible:first,.rowAxis button:visible:first,.slicerAxis button:visible:first,.schemaColumn button:visible:first,.schemaRow button:visible:first,.schemaFilter button:visible:first,.schemaValue button:visible:first,.toggleExpandButton:visible:first,.toggleCollapseButton:visible:first,#clientTab .e-active:visible"),t.isNullOrUndefined(this._curFocus.tab)?(this._index.tab=0,this._curFocus.tab=f.eq(this._index.tab).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this._curFocus.tab.hasClass("e-button")&&this._curFocus.tab.parent().find(".removeSplitBtn:visible").addClass("hoverCell")):(this._curFocus.tab.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===9&&i.shiftKey?this._index.tab=this._index.tab-1<0?f.length-1:this._index.tab-1:i.which===9&&(this._index.tab=this._index.tab+1>f.length-1?0:this._index.tab+1),this._curFocus.tab=f.eq(this._index.tab).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this._curFocus.tab.hasClass("e-button")&&this._curFocus.tab.parent().find(".removeSplitBtn:visible").addClass("hoverCell"))),this.element.find(".e-dialog:visible").length>0&&i.keyCode==13){if(n(i.target).hasClass("memberCurrentPage")&&n(i.target).parents(".e-pivotschemadesigner").length==0){t.Pivot.editorTreeNavigatee(i,this);return}if(n(i.target).hasClass("searchEditorTreeView")&&n(i.target).parents(".e-pivotschemadesigner").length==0&&n(i.target).parents(".e-dialog").find(".nextPageDiv").length>0){t.Pivot._searchEditorTreeNodes(i,this);return}i.preventDefault();t.isNullOrUndefined(this._curFocus.editor)?t.isNullOrUndefined(this._curFocus.dialog)?t.isNullOrUndefined(this._curFocus.icon)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","-1").focus().mouseover():this._curFocus.icon.attr("tabindex","-1").focus().mouseover():this._curFocus.dialog.hasClass("e-text")?this.element.find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click():(this._curFocus.dialog.click(),(this._curFocus.dialog.hasClass("dialogOKBtn")||this._curFocus.dialog.hasClass("dialogCancelBtn")||this._curFocus.dialog.hasClass("e-close"))&&(this._curFocus.dialog=null),this._index.editor=0):this._curFocus.editor.hasClass("e-text")&&this.element.find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click()}else i.keyCode!=13||t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("role")=="columnheader"||(i.preventDefault(),(!t.isNullOrUndefined(this._curFocus.icon)||!t.isNullOrUndefined(this._curFocus.tab)&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&this.element.find(".hoverCell:visible").length>0)&&this.element.find(".hoverCell:visible")[0].click(),t.isNullOrUndefined(this.element.find(".chartTypesDialog"))||t.isNullOrUndefined(this._curFocus.chartimg)||(this._curFocus.chartimg.click(),t.isNullOrUndefined(this._curFocus.icon)||this._curFocus.icon.attr("tabindex","-1").focus().mouseover(),this._index.chartimg=0,this._curFocus.chartimg=null));(i.which===39||i.which===37)&&this.element.find(".e-dialog:visible").length>0&&this.element.find(".e-dialog .e-text:visible").hasClass("hoverCell")?this.element.find(".e-dialog .hoverCell").parent().find(".e-plus,.e-minus").click():(i.which===39||i.which===37)&&this.element.find(".cubeTreeView .e-text:visible").hasClass("hoverCell")&&!this.element.find(".editorTreeView:visible").length>0?this.element.find(".cubeTreeView .hoverCell").parent().find(".e-plus,.e-minus").click():(i.which===37||i.which===39||i.which===38||i.which===40)&&(this.element.find(".chartTypesDialog").length>0||this.element.find(".reportDBDialog").length>0)?(i.preventDefault(),e=this.element.find(".chartTypesDialog").length>0?this.element.find(".chartTypesDialog"):this.element.find(".reportDBDialog"),e.tabindex=-1,e.focus(),r=e.find(".chartTypesIcon").length>0?e.find(".chartTypesIcon"):this.element.find(".reportDBIcon"),t.isNullOrUndefined(this._curFocus.chartimg)?(this._index.chartimg=i.which==39?0:i.which==37?r.length-1:0,this._curFocus.chartimg=r.eq(this._index.chartimg).addClass("hoverCell").mouseover()):(this._curFocus.chartimg.removeClass("hoverCell").mouseleave(),i.which===39?this._index.chartimg=this._index.chartimg+1>r.length-1?0:this._index.chartimg+1:i.which===37?this._index.chartimg=this._index.chartimg-1<0?r.length-1:this._index.chartimg-1:i.which===40&&e.find(".chartTypesIcon").length>0?this._index.chartimg=this._index.chartimg+5>r.length-1?(this._index.chartimg+5)%10:this._index.chartimg+5:i.which===38&&e.find(".chartTypesIcon").length>0&&(this._index.chartimg=this._index.chartimg-5<0?r.length-1:this._index.chartimg-5),this._curFocus.chartimg=r.eq(this._index.chartimg).addClass("hoverCell").mouseover())):(i.which===37||i.which===39)&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-icon")&&!this._curFocus.tab.hasClass("toggleCollapseButton")&&!this._curFocus.tab.hasClass("toggleExpandButton")&&!this.element.find(".e-dialog:visible").length>0&&(i.preventDefault(),this._curFocus.tab.removeClass("hoverCell").mouseleave(),r=this.element.find(".reportToolbar .e-icon:visible:not(.reportCol)"),t.isNullOrUndefined(this._curFocus.icon)?(this._index.icon=i.which==39?1:i.which==37?r.length-2:0,this._curFocus.icon=r.eq(this._index.icon).addClass("hoverCell").mouseover()):(this._curFocus.icon.removeClass("hoverCell").mouseleave(),i.which===39?this._index.icon=this._index.icon+1>r.length-2?0:this._index.icon+1:i.which===37&&(this._index.icon=this._index.icon-1<0?r.length-2:this._index.icon-1),this._curFocus.icon=r.eq(this._index.icon).addClass("hoverCell").mouseover()));(i.which===40||i.which===38)&&this.element.find(".e-dialog:visible").length>0&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&(this.element.find(".e-dialog .e-text").hasClass("hoverCell")||this.element.find(".e-dialog .measureEditor").hasClass("hoverCell"))?(i.preventDefault(),this.element.find(".e-dialog .hoverCell").removeClass("hoverCell"),this.element.find(".e-dialog .e-node-focus").removeClass("e-node-focus"),t.isNullOrUndefined(this._curFocus.dialog)||this._curFocus.dialog.mouseleave(),r=this.element.find(".e-dialog .measureEditor:visible,.e-dialog .e-text:visible"),t.isNullOrUndefined(this._curFocus.editor)?(this._index.editor=r.length>1?i.which==40?1:i.which==38?r.length-1:0:0,this._curFocus.editor=r.eq(this._index.editor).attr("tabindex","0").focus().addClass("hoverCell")):(this._curFocus.editor.attr("tabindex","0").removeClass("hoverCell"),i.which===40?this._index.editor=this._index.editor+1>r.length-1?0:this._index.editor+1:i.which===38&&(this._index.editor=this._index.editor-1<0?r.length-1:this._index.editor-1),this._curFocus.editor=r.eq(this._index.editor).attr("tabindex","0").focus().addClass("hoverCell"))):(i.which===40||i.which===38)&&!this.element.find(".e-dialog:visible").length>0&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-text")&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&t.isNullOrUndefined(this._schemaData)?(this.element.find(".hoverCell").removeClass("hoverCell"),this._curFocus.tab.mouseleave(),i.preventDefault(),r=this.element.find(".cubeTreeView .e-text:visible"),t.isNullOrUndefined(this._curFocus.tree)?(this._index.tree=i.which==40?1:i.which==38?r.length-1:0,this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this.element.find(".e-node-focus").removeClass("e-node-focus")):(this._curFocus.tree.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40?this._index.tree=this._index.tree+1>r.length-1?0:this._index.tree+1:i.which===38&&(this._index.tree=this._index.tree-1<0?r.length-1:this._index.tree-1),this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this.element.find(".e-node-focus").removeClass("e-node-focus"))):(i.which===40||i.which===38)&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-button")&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&!this.element.find(".e-dialog:visible").length>0&&t.isNullOrUndefined(this._schemaData)&&(i.preventDefault(),r=null,(this._curFocus.tab.parent().parent().hasClass("categoricalAxis")||this._curFocus.tab.parent().parent().hasClass("rowAxis")||this._curFocus.tab.parent().parent().hasClass("slicerAxis"))&&(this._curFocus.tab.parent().parent().hasClass("categoricalAxis")?r=this.element.find(".categoricalAxis button"):this._curFocus.tab.parent().parent().hasClass("rowAxis")?r=this.element.find(".rowAxis button"):this._curFocus.tab.parent().parent().hasClass("slicerAxis")&&(r=this.element.find(".slicerAxis button")),t.isNullOrUndefined(this._curFocus.tab)||(this._curFocus.tab.removeClass("hoverCell").attr("tabindex","0").mouseleave(),this._curFocus.tab.parent().find(".removeSplitBtn:visible").focus().removeClass("hoverCell")),t.isNullOrUndefined(this._curFocus.button)?(this._index.button=i.which==40?r.length>1?1:0:i.which==38?r.length-1:0,this._curFocus.button=r.eq(this._index.button).attr("tabindex","0").focus().addClass("hoverCell"),this._curFocus.button.parent().find(".removeSplitBtn:visible").addClass("hoverCell")):(this._curFocus.button.attr("tabindex","0").removeClass("hoverCell"),this._curFocus.button.parent().find(".removeSplitBtn:visible").removeClass("hoverCell"),i.which===40?this._index.button=this._index.button+1>r.length-1?0:this._index.button+1:i.which===38&&(this._index.button=this._index.button-1<0?r.length-1:this._index.button-1),this._curFocus.button=r.eq(this._index.button).attr("tabindex","0").focus().addClass("hoverCell"),this._curFocus.button.parent().find(".removeSplitBtn:visible").addClass("hoverCell"))))},_wireMeasureRemoveEvent:function(){this.element.find(".removeMeasure").click(function(t){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");i._isMembersFiltered=!0;n(n(t.target).parent()).remove()})},_wireEditorRemoveEvent:function(){this.element.find(".removeSplitBtn").click(function(i){var r=n(i.target).parents(".e-pivotclient").data("ejPivotClient"),u,f;this._isTimeOut=!0;setTimeout(function(){r._isTimeOut&&r._waitingPopup.show()},800);n(n(i.target).parent()).remove();r._currentReportItems.length!=0&&r._treeViewData.hasOwnProperty(n(i.target).parent().find("button").attr("title"))&&(delete r._treeViewData[n(i.target).parent().find("button").attr("title")],r._currentReportItems.splice(n.inArray(n(i.target).parent().find("button").attr("title"),r._currentReportItems),1));r._off(this.element,"click",".removeSplitBtn");r.model.enableAdvancedFilter&&r.model.analysisMode==t.Pivot.AnalysisMode.Olap&&r.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(u=n(n(i.target)).parent("div:eq(0)").attr("Tag").split(":")[1].split("."),t.isNullOrUndefined(u)||u.length!=2||(r._setUniqueNameFrmBtnTag(u),r._removeFilterTag(r._selectedFieldName)));r.model.beforeServiceInvoke!=null&&r._trigger("beforeServiceInvoke",{action:"removeSplitButton",element:this.element,customObject:r.model.customObject});f=JSON.stringify(r.model.customObject);delete r._fieldSelectedMembers[n(i.target).parent().find("button").attr("title")];r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.removeSplitButton,JSON.stringify({action:"removeSplitButton",clientParams:n(i.target).parent().attr("tag"),olapReport:r.currentReport,clientReports:r.reports,customObject:f}),r._removeSplitButtonSuccess);r._isNodeOrButtonDropped=!0})},_setUniqueNameFrmBtnTag:function(t){var i,r;if(t.length>0)if(i=this.element.find(".cubeTreeView li[tag^='["+t[0]+"'][tag$='"+t[1]+"]']"),i.length>0){for(r=0;r<i.length;r++)if(n(i[r]).attr("tag").split("].").length==2){this._selectedFieldName=n(i[r]).attr("tag");break}}else this._selectedFieldName=i.attr("tag")},_wireDialogEvent:function(){this.element.find(".newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .pvtBtn, .mdxImg,.colSortFilterImg, .rowSortFilterImg, .autoExecuteImg").on(t.eventType.click,function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");if(i.currentTarget.parentElement.className.indexOf("splitBtn")>-1){if(n(n(i.currentTarget).parents(".splitBtn")[0]).attr("tag").indexOf("NAMEDSET")>-1)return!1;r._currentAxis=n(n(i.currentTarget).parents(".splitBtn")[0]).attr("tag").split(":")[0]}i.preventDefault();i.target.innerHTML!=r._getLocalizedLabels("Cancel")&&i.target.innerHTML!=r._getLocalizedLabels("OK")&&i.target.parentElement.innerHTML!=r._getLocalizedLabels("Cancel")&&i.target.parentElement.innerHTML!=r._getLocalizedLabels("OK")&&(r._off(r.element,"click",".newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .mdxImg, .e-txt,.colSortFilterImg, .rowSortFilterImg, .chartTypesImg, .autoExecuteImg"),i.target.className.indexOf("colSortFilterImg")>=0||i.target.className.indexOf("rowSortFilterImg")>=0?(r._sortOrFilterTab=i.target.className.indexOf("SortImg")>=0?"sort":"filter",i.target.className.indexOf("colSortFilterImg")>=0||i.target.className.indexOf("rowSortFilterImg")>=0||r.element.find(".rowAxis").html()!=""||r.element.find(".categoricalAxis").html()!=""||(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&r._waitingPopup.show()},800)),r._isSorted=!1,r._isFiltered=!1,r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"FetchSortState",toolbarOperation:null,clientInfo:r._axis=i.target.className.indexOf("colSortFilterImg")>=0?"Column":"Row",olapReport:r.currentReport,clientReports:"",customObject:JSON.stringify(r.model.customObject)}),r._fetchSortState)):i.target.className.indexOf("mdx")>=0?r.model.analysisMode==t.Pivot.AnalysisMode.Olap&&r.model.operationalMode==t.Pivot.OperationalMode.ClientMode?r._mdxQuery(t.olap.base._getParsedMDX(r.model.dataSource,r.model.dataSource.cube)):r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.mdxQuery,JSON.stringify({olapReport:r.currentReport,customObject:JSON.stringify(r.model.customObject)}),r._mdxQuery):i.target.className.indexOf("autoExecute")>=0?(r.model.enableDeferUpdate=!1,r._renderControls(),r._deferReport=r.currentReport,r.model.enableDeferUpdate=!0):(r.model.operationalMode!=t.Pivot.OperationalMode.ServerMode||r.model.analysisMode!=t.Pivot.AnalysisMode.Olap)&&n(i.currentTarget).hasClass("pvtBtn")||r._createDialogRequest(i),r._dimensionName=n(i.currentTarget).parent().attr("tag"));isDropped=!1});this.element.find(".excelExportImg, .wordExportImg, .pdfExportImg").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient"),e,o,s,f,l,a,h,u,c,v,y;(r.model.displaySettings.mode==r.model.clientExportMode||r.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartAndGrid||r.model.clientExportMode==t.PivotClient.ClientExportMode.ChartAndGrid)&&(t.browserInfo().name=="msie"&&t.browserInfo().version<=8&&(r.model.clientExportMode=t.PivotClient.ClientExportMode.GridOnly),e=i.target.className.indexOf("excel")>=0?"Excel":i.target.className.indexOf("word")>=0?"Word":"Pdf",r.model.displaySettings.mode!=t.PivotClient.DisplayMode.GridOnly&&r.model.clientExportMode!=t.PivotClient.ClientExportMode.GridOnly&&(r.chartObj=null,r.chartObj=r.element.find("#"+r._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(r.chartObj)&&!t.isNullOrUndefined(r.otreemapObj)&&(r.chartObj=r.element.find("#"+r.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),r.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"&&(l=r.chartObj.model.primaryXAxis.zoomFactor,r.chartObj.model.primaryXAxis.zoomFactor=1,r.chartObj.model.enableCanvasRendering=!0,r.chartObj.redraw(),a=r.chartObj["export"](),s=a.toDataURL("image/png"),r.chartObj.model.primaryXAxis.zoomFactor=l,r.chartObj.model.enableCanvasRendering=!1,r.chartObj.redraw())),h=r.element.find(".reportlist").data("ejDropDownList").getSelectedValue(),u={url:"",fileName:"PivotClient",exportMode:t.PivotClient.ExportMode.JSON,title:h!=null&&h!=""?h:"",description:""},r._trigger("beforeExport",u),r.model.displaySettings.mode!=t.PivotClient.DisplayMode.ChartOnly&&r.model.clientExportMode!=t.PivotClient.ClientExportMode.ChartOnly&&(c={valueCellColor:r._pivotGrid.element.find(".value").css("color"),valueCellBGColor:r._pivotGrid.element.find(".value").css("background-color"),summaryCellColor:r._pivotGrid.element.find(".summary").css("color"),summaryCellBGColor:r._pivotGrid.element.find(".summary").css("background-color")}),r.model.displaySettings.mode==t.PivotClient.DisplayMode.GridOnly||r.model.clientExportMode==t.PivotClient.ClientExportMode.GridOnly?(f=t.PivotClient.ClientExportMode.GridOnly,o=r.model.operationalMode==t.Pivot.OperationalMode.ClientMode||r._pivotGrid._excelLikeJSONRecords!=null&&u.exportMode==t.PivotClient.ExportMode.JSON||n.trim(u.url)!=""&&u.exportMode==t.PivotClient.ExportMode.JSON?{args:JSON.stringify({exportMode:f,exportOption:e,pGridData:r._pivotGrid.exportRecords!=null&&r._pivotGrid.exportRecords!=""?r._pivotGrid.exportRecords:null,rowCount:r._pivotGrid._excelLikeJSONRecords!=null?r._pivotGrid._excelRowCount:r._pivotGrid._rowCount,columnCount:r._pivotGrid._excelLikeJSONRecords!=null?Math.floor(r._pivotGrid._excelLikeJSONRecords.length/r._pivotGrid._excelRowCount):r._pivotGrid.getJSONRecords()!=null?Math.floor(r._pivotGrid.getJSONRecords().length/r._pivotGrid._rowCount):0,fileName:u.fileName,customObject:JSON.stringify(r._pivotGrid.model.customObject),title:u.title,description:u.description})}:{args:JSON.stringify({exportMode:f,exportOption:e,currentReport:r.model.enableDeferUpdate?r._deferReport:r.currentReport,layout:r.gridLayout(),colorSettings:JSON.stringify(c),title:u.title,description:u.description})}):r.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartOnly||r.model.clientExportMode==t.PivotClient.ClientExportMode.ChartOnly?(f=t.PivotClient.ClientExportMode.ChartOnly,o=r.model.operationalMode==t.Pivot.OperationalMode.ClientMode||r._pivotGrid._excelLikeJSONRecords!=null&&u.exportMode==t.PivotClient.ExportMode.JSON||n.trim(u.url)!=""&&u.exportMode==t.PivotClient.ExportMode.JSON?{args:JSON.stringify({exportMode:f,exportOption:e,fileName:u.fileName,chartdata:s.split(",")[1],bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}:{args:JSON.stringify({exportMode:f,exportOption:e,currentReport:r.model.enableDeferUpdate?r._deferReport:r.currentReport,chartdata:s.split(",")[1],legenddata:"",bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}):(f=t.PivotClient.ClientExportMode.ChartAndGrid,o=r.model.operationalMode==t.Pivot.OperationalMode.ClientMode||r._pivotGrid._excelLikeJSONRecords!=null&&u.exportMode==t.PivotClient.ExportMode.JSON||n.trim(u.url)!=""&&u.exportMode==t.PivotClient.ExportMode.JSON?{args:JSON.stringify({exportMode:f,exportOption:e,pGridData:r._pivotGrid.exportRecords!=null&&r._pivotGrid.exportRecords!=""?r._pivotGrid.exportRecords:null,rowCount:r._pivotGrid._excelLikeJSONRecords!=null?r._pivotGrid._excelRowCount:r._pivotGrid._rowCount,columnCount:r._pivotGrid._excelLikeJSONRecords!=null?Math.floor(r._pivotGrid._excelLikeJSONRecords.length/r._pivotGrid._excelRowCount):r._pivotGrid.getJSONRecords()!=null?Math.floor(r._pivotGrid.getJSONRecords().length/r._pivotGrid._rowCount):0,fileName:u.fileName,customObject:JSON.stringify(r._pivotGrid.model.customObject),chartdata:s.split(",")[1],bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}:{args:JSON.stringify({exportMode:f,exportOption:e,currentReport:r.model.enableDeferUpdate?r._deferReport:r.currentReport,layout:r.gridLayout(),colorSettings:JSON.stringify(c),chartdata:s.split(",")[1],legenddata:"",bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}),t.raiseWebFormsServerEvents&&n.trim(u.url)!=""&&u.url=="pivotClientExport"&&u.exportMode==t.PivotClient.ExportMode.JSON?(v={model:r.model,originalEventType:u.url},y=o,t.raiseWebFormsServerEvents(u.url,v,y),setTimeout(function(){t.isOnWebForms=!0},1e3)):r.doPostBack(n.trim(u.url)!=""?u.url:r.model.url+"/"+r.model.serviceMethodSettings.exportPivotClient,o))});this.element.find(".toggleaxisImg").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r;i._isTimeOut=!0;setTimeout(function(){i._isTimeOut&&i._waitingPopup.show()},800);i.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(i.chartObj)&&!t.isNullOrUndefined(i.otreemapObj)&&(i.chartObj=i.element.find("#"+i.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));i.model.operationalMode==t.Pivot.OperationalMode.ClientMode?(r=i.model.dataSource.rows,i.model.dataSource.rows=i.model.dataSource.columns,i.model.dataSource.columns=r,i.model.analysisMode==t.Pivot.AnalysisMode.Olap&&i.model.dataSource.values.length>0&&(i.model.dataSource.values[0].axis=i.model.dataSource.values[0].axis=="rows"?"columns":i.model.dataSource.values[0].axis=="columns"?"rows":"columns"),i.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.olap.base.clearDrilledItems(i.model.dataSource,{action:"nodeDropped"},i),i.refreshControl()):i.model.analysisMode==t.Pivot.AnalysisMode.Pivot?i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toggleAxis",args:JSON.stringify({currentReport:JSON.parse(i.getOlapReport()).Report,sortedHeaders:t.isNullOrUndefined(i._ascdes)?"":i._ascdes}),customObject:JSON.stringify(i.model.customObject)}),i._toggleAxisSuccess):(i.element.find(".rowAxis").html()!=""||i.element.find(".categoricalAxis").html()!="")&&i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.toggleAxis,JSON.stringify({action:"toggleAxis",currentReport:i.currentReport,clientReports:i.reports,customObject:JSON.stringify(i.model.customObject)}),i._toggleAxisSuccess)});this.element.find(".reportDBImg").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r=t.buildTag("div.reportDBDialog#reportDBDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.saveReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Save"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.saveAsReportImg reportDBIcon").attr({title:i._getLocalizedLabels("SaveAs"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.loadReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Load"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.removeDBReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Remove"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.renameDBReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Rename"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),u=i.element.find("div.reportDBDialog");u.length==0&&(n(r).appendTo(i.element),n(r).css("left",this.offsetLeft+20+"px").css("top",this.offsetTop+20+"px"));i.element.find(".reportDBIcon").click(function(u){var s,e,o,f;if(n(r).remove(),i=i,i._off(i.element,"click",".reportDBIcon"),u.target.className.indexOf("loadReportImg")>=0||u.target.className.indexOf("removeDBReportImg")>=0||u.target.className.indexOf("renameDBReportImg")>=0)s=u.target.className.indexOf("loadReportImg")>=0?"LoadReport":u.target.className.indexOf("removeDBReportImg")>=0?"RemoveDBReport":"RenameDBReport",i._isTimeOut=!0,setTimeout(function(){i._isTimeOut&&i._waitingPopup.show()},800),i.model.operationalMode=="servermode"?(i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"FetchingReportList",element:i.element,customObject:i.model.customObject}),f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.fetchReportList,JSON.stringify({customObject:f,action:s,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode}),i._fetchReportListSuccess)):(e={url:"",reportCollection:i._clientReportCollection,reportList:"",mode:i.model.analysisMode},i._trigger("fetchReport",{targetControl:i,fetchReportSetting:e}),i.model.enableLocalStorage?i._fetchReportListSuccess({d:[{Key:"ReportNameList",Value:e.reportList}]}):(f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",e.url+"/"+i.model.serviceMethodSettings.fetchReportList,JSON.stringify({customObject:f,action:s,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode}),i._fetchReportListSuccess)));else if(u.target.className.indexOf("saveReportImg")>=0){if(i._currentRecordName=="")return i._createDialogRequest(u),!1;i._isTimeOut=!0;setTimeout(function(){i._isTimeOut&&i._waitingPopup.show()},800);i.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"saveReport",element:this.element,customObject:i.model.customObject}),f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:i._currentRecordName,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode,olapReport:i.currentReport,clientReports:i.model.analysisMode=="pivot"?JSON.stringify(i._clientReportCollection):i.reports,customObject:f}),i._toolbarOperationSuccess)):(o={url:"",reportName:i._currentRecordName,reportCollection:i._clientReportCollection,mode:i.model.analysisMode,filterCollection:i._currentReportItems},i._trigger("saveReport",{targetControl:i,saveReportSetting:o}),i.model.enableLocalStorage||(f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",o.url+"/"+i.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:o.reportName,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode,olapReport:JSON.stringify(i.model.dataSource),clientReports:JSON.stringify(i._clientReportCollection)+":>>:"+JSON.stringify(i._currentReportItems),customObject:f}),i._toolbarOperationSuccess)))}else(i.model.operationalMode!=t.Pivot.OperationalMode.ServerMode||i.model.analysisMode!=t.Pivot.AnalysisMode.Olap)&&n(u.currentTarget).hasClass("pvtBtn")||i._createDialogRequest(u)})});this.element.find(".chartTypesImg").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient"),u=t.buildTag("div.chartTypesDialog#chartTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.line chartTypesIcon").attr({title:r._getLocalizedLabels("Line"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.spline chartTypesIcon").attr({title:r._getLocalizedLabels("Spline"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.column chartTypesIcon").attr({title:r._getLocalizedLabels("Column"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.area chartTypesIcon").attr({title:r._getLocalizedLabels("Area"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.splinearea chartTypesIcon").attr({title:r._getLocalizedLabels("SplineArea"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.stepline chartTypesIcon").attr({title:r._getLocalizedLabels("StepLine"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.steparea chartTypesIcon").attr({title:r._getLocalizedLabels("StepArea"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pie chartTypesIcon").attr({title:r._getLocalizedLabels("Pie"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.bar chartTypesIcon").attr({title:r._getLocalizedLabels("Bar"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.stackingarea chartTypesIcon").attr({title:r._getLocalizedLabels("StackingArea"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.stackingcolumn chartTypesIcon").attr({title:r._getLocalizedLabels("StackingColumn"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.stackingbar chartTypesIcon").attr({title:r._getLocalizedLabels("StackingBar"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.funnel chartTypesIcon").attr({title:r._getLocalizedLabels("Funnel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pyramid chartTypesIcon").attr({title:r._getLocalizedLabels("Pyramid"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.doughnut chartTypesIcon").attr({title:r._getLocalizedLabels("Doughnut"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.scatter chartTypesIcon").attr({title:r._getLocalizedLabels("Scatter"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.bubble chartTypesIcon").attr({title:r._getLocalizedLabels("Bubble"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.waterfall chartTypesIcon").attr({title:r._getLocalizedLabels("WaterFall"),tabindex:0})[0].outerHTML)[0].outerHTML+(r.model.enablePivotTreeMap?t.buildTag("td",t.buildTag("div.treemap chartTypesIcon").attr({title:r._getLocalizedLabels("TreeMap"),tabindex:0})[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML),f=r.element.find("div.chartTypesDialog");f.length==0&&(n(u).appendTo(r.element),r.model.enableToolBar?n(u).css("left",n(i.target).offset().left+10+"px").css("top",n(i.target).offset().top+15+"px"):n(u).css("left",this.offsetLeft+20+"px").css("top",this.offsetTop+20+"px"),r._pivotChart.model.enable3D||r.element.find("."+r._pivotChart.seriesType()).addClass("activeChartType"));n(".chartTypesIcon").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient"),f,e;if(r.element.find(".chartTypesIcon").removeClass("activeChartType"),n(u).remove(),f=i.target.className.split(" ")[0],r.model.chartType=f,r._pivotChart.model.enable3D=!1,r._pivotChart.model.type=f,r._pivotChart.model.commonSeriesOptions.type=f,f=="funnel"&&(r._pivotChart.model.commonSeriesOptions.marker={dataLabel:{visible:!0,shape:"none",font:{color:r.element.css("color"),size:"12px",fontWeight:"lighter"}}}),r._pivotChart.getJSONRecords()!=null){if(r.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){if(r.chartObj=null,r.chartObj=r.element.find("#"+r._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(r.chartObj)&&!t.isNullOrUndefined(r.otreemapObj)&&(r.chartObj=r.element.find("#"+r.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),!t.isNullOrUndefined(r.chartObj)){if(r._isrenderTreeMap=!0,r.model.enableDeferUpdate)r._ischartTypesChanged=!0,r.model.enablePivotTreeMap&&this.title.toLocaleLowerCase()=="treemap"?r.model.enablePivotTreeMap&&(r.element.find("#"+r._id+"_PivotChartContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivotchart"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivottreemap")?r.otreemapObj.renderTreeMapFromJSON(r._pivotChart.getJSONRecords()):(r.element.find("#"+r._id+"_PivotChart").ejPivotTreeMap({url:r.model.url,customObject:this.model.customObject,canResize:r.model.isResponsive,currentReport:r.currentReport,locale:r.locale(),size:{height:r._chartHeight,width:r._chartWidth},drillSuccess:t.proxy(r._treemapDrillSuccess,r),beforeServiceInvoke:r.model.treeMapLoad}),r.otreemapObj=r.element.find("#"+r._id+"_PivotChart").data("ejPivotTreeMap"),r._isrenderTreeMap=!0,r.chartObj=null)):(r.element.find("#"+r._id+"_PivotChartTreeMapContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivottreemap"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivotchart")?r._pivotChart.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()}):(r.element.find("#"+r._id+"_PivotChart").ejPivotChart({url:r.model.url,customObject:this.model.customObject,enableRTL:r.model.enableRTL,canResize:r.model.isResponsive,currentReport:r.currentReport,customObject:r.model.customObject,locale:r.locale(),showTooltip:!0,size:{height:r._chartHeight,width:r._chartWidth},commonSeriesOptions:{type:r.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:r.model.chartLoad,drillSuccess:t.proxy(r._chartDrillSuccess,r)}),r._pivotChart=r.element.find("#"+r._id+"_PivotChart").data("ejPivotChart"),r.chartObj=null));else if(r.model.enablePivotTreeMap&&this.title.toLocaleLowerCase()=="treemap")r.model.enablePivotTreeMap&&(r.element.find("#"+r._id+"_PivotChartContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivotchart"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivottreemap")?r.otreemapObj.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()}):(r.element.find("#"+r._id+"_PivotChart").ejPivotTreeMap({url:r.model.url,customObject:r.model.customObject,canResize:r.model.isResponsive,currentReport:r.currentReport,locale:r.locale(),size:{height:r._chartHeight,width:r._chartWidth},drillSuccess:t.proxy(r._treemapDrillSuccess,r),beforeServiceInvoke:r.model.treeMapLoad}),r.otreemapObj=r.element.find("#"+r._id+"_PivotChart").data("ejPivotTreeMap"),r.chartObj=null));else{if(r.element.find("#"+r._id+"_PivotChartTreeMapContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivottreemap"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivotchart"))return r._pivotChart.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()}),!1;r.element.find("#"+r._id+"_PivotChart").ejPivotChart({url:r.model.url,customObject:r.model.customObject,enableRTL:r.model.enableRTL,canResize:r.model.isResponsive,currentReport:r.currentReport,customObject:r.model.customObject,locale:r.locale(),showTooltip:!0,size:{height:r._chartHeight,width:r._chartWidth},commonSeriesOptions:{type:r.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:r.model.chartLoad,drillSuccess:t.proxy(r._chartDrillSuccess,r)});r._pivotChart=r.element.find("#"+r._id+"_PivotChart").data("ejPivotChart");r.chartObj=null}e=JSON.stringify(r.model.customObject);r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.updateReport,JSON.stringify({action:"chartTypeChanged",clientParams:f,olapReport:r.currentReport,clientReports:r.reports,customObject:e}),r._chartTypeChangedSuccess)}}else r._pivotChart.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()});r.model.isResponsive&&(r.chartObj=r.element.find("#"+r._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(r.chartObj)||r.element.find("#"+r.chartObj._id).ejChart("option",{model:{size:{height:r._chartHeight}}}))}else r._isTimeOut=!1,r._waitingPopup.hide()})});n(document).click(function(t){t.target.className.indexOf("chartTypesImg")==-1&&n(".chartTypesDialog").remove();t.target.className.indexOf("reportDBImg")==-1&&n(".reportDBDialog").remove();t.target.className.indexOf("exportImg")==-1&&n(".exportTypesDialog").remove();t.target.className.indexOf("chart3DImg")==-1&&n(".chart3DTypesDialog").remove();t.target.className.indexOf("smartLabels")==-1&&n(".smartLabelsDialog").remove();t.target.className.indexOf("interaction")==-1&&n(".interactionsDialog").remove()});this.element.find(".dialogCancelBtn").on(t.eventType.click,function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");i.preventDefault();r.element.find(".e-dialog").hide();r.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();t.Pivot.closePreventPanel(r)});this.element.find(".dialogOKBtn").on(t.eventType.click,function(r){var u=n(this).parents(".e-pivotclient").data("ejPivotClient"),b,p,y,o,v,tt,it,rt,a,k,d,ft,et,g,s,c,nt,f,l;if(r.preventDefault(),u.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(u.chartObj=u.element.find("#"+u._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(u.chartObj)&&u.model.enablePivotTreeMap&&!t.isNullOrUndefined(u.otreemapObj)&&(u.chartObj=u.element.find("#"+u.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),b=t.browserInfo().name=="msie"&&t.browserInfo().version<=8?u._dialogTitle:u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar")[0].textContent==i?u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar")[0].innerText:u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar")[0].textContent,b==u._getLocalizedLabels("Load"))if(u._currentRecordName=u.element.find(".reportNameList")[0].value,o=u.element.find(".reportNameList")[0].value,o!="")u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800),u._fieldMembers={},u._fieldSelectedMembers={},u.model.operationalMode=="servermode"?(u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"loadReport",element:this.element,customObject:u.model.customObject}),s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.loadReport,JSON.stringify({reportName:o,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:currentReport,clientReports:u.reports,customObject:s,clientParams:JSON.stringify(u.model.enableMeasureGroups)}),u.model.analysisMode==t.Pivot.AnalysisMode.Pivot?u._renderControlSuccess:u._toolbarOperationSuccess)):(p={url:"",reportCollection:u._clientReportCollection,selectedReport:o,mode:u.model.analysisMode},u._trigger("loadReport",{targetControl:u,loadReportSetting:p}),u.model.enableLocalStorage?(u.model.dataSource=p.reportCollection[0],u._currentReportCollection=p.reportCollection,u.refreshControl(),u._refreshReportList(),u._pivotSchemaDesigner&&u._pivotSchemaDesigner._refreshPivotButtons()):(s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",p.url+"/"+u.model.serviceMethodSettings.loadReport,JSON.stringify({reportName:o,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:currentReport,clientReports:u.reports,customObject:s,clientParams:JSON.stringify(u.model.enableMeasureGroups)}),u._clientToolbarOperationSuccess)));else return t.Pivot._createErrorDialog(u._getLocalizedLabels("SelectRecordAlertMsg"),"Error",u),!1;else if(b==u._getLocalizedLabels("Remove")){if(o=u.element.find(".reportNameList")[0].value,o==""||t.isNullOrUndefined(o))return t.Pivot._createErrorDialog(u._getLocalizedLabels("SelectRecordAlertMsg"),"Error",u),!1;u._currentRecordName=o==u._currentRecordName?"":u._currentRecordName;u._isTimeOut=!0;setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800);u.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(v={url:"",selectedReport:o,mode:u.model.analysisMode},u._trigger("loadReport",{targetControl:u,fetchReportSetting:v}));u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"removeDBReport",element:this.element,customObject:u.model.customObject});s=JSON.stringify(u.model.customObject);u._fieldMembers={};u._fieldSelectedMembers={};u.doAjaxPost("POST",(u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?v.url:u.model.url)+"/"+u.model.serviceMethodSettings.removeDBReport,JSON.stringify({reportName:o,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,customObject:s}),u._toolbarOperationSuccess)}else if(b==u._getLocalizedLabels("Rename")){if(y=u.element.find(".renameReport").val(),o=u.element.find(".reportNameList")[0].value,o==""||t.isNullOrUndefined(o)||y==""||t.isNullOrUndefined(y))return o==""||t.isNullOrUndefined(o)?t.Pivot._createErrorDialog(u._getLocalizedLabels("SelectRecordAlertMsg"),"Error",u):(y==""||t.isNullOrUndefined(y))&&t.Pivot._createErrorDialog(u._getLocalizedLabels("SetReportNameAlertMsg"),"Error",u),!1;u._isTimeOut=!0;setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800);u.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(v={url:"",selectedReport:o,mode:u.model.analysisMode},u._trigger("loadReport",{targetControl:u,fetchReportSetting:v}));u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"renameDBReport",element:this.element,customObject:u.model.customObject});s=JSON.stringify(u.model.customObject);u.doAjaxPost("POST",(u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?v.url:u.model.url)+"/"+u.model.serviceMethodSettings.renameDBReport,JSON.stringify({selectedReport:o,renameReport:y,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,customObject:s}),u._toolbarOperationSuccess)}else if(u.element.find(".sortingDlg").length>0){if(u.element.find(".sortEnable")[0].checked==!0&&u.element.find(".measuresList")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterMeasureSelectionAlertMsg"),"Error",u),!1;if(u.element.find(".filterEnable")[0].checked==!0){if(u.element.find(".fMeasuresList")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterMeasureSelectionAlertMsg"),"Error",u),!1;if(u.element.find(".filterCondition")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterConditionAlertMsg"),"Error",u),!1;if(u.element.find(".filterFrom")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterStartValueAlertMsg"),"Error",u),!1;if((u.element.find(".filterCondition")[0].value=="Between"||u.element.find(".filterCondition")[0].value=="NotBetween")&&u.element.find(".filterTo")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterEndValueAlertMsg"),"Error",u),!1}if(tt=null,it=null,tt=(u._isSorted==!1||u._isSorted==!0)&&u.element.find(".sortEnable")[0].checked==!0?n("li[tag*='"+u.element.find(".measuresList")[0].value+"']").attr("tag")+"::"+(u.element.find(".radioBtnAsc")[0].checked==!0?"ASC":"DESC")+"::"+u._axis+"::"+(u.element.find(".preserveHrchy")[0].checked==!0?"PHT":"PHF"):u._isSorted==!0&&u.element.find(".sortDisable")[0].checked==!0?"Disable Sorting:: ::"+u._axis+":: ":" :: ::"+u._axis+":: ",it=(u._isFiltered==!1||u._isFiltered==!0)&&u.element.find(".filterEnable")[0].checked==!0?n("li[tag*='"+u.element.find(".fMeasuresList")[0].value+"']").attr("tag")+"::"+u.element.find(".filterCondition")[0].value+"::"+u.element.find(".filterFrom")[0].value+"::"+u.element.find(".filterTo")[0].value:u._isFiltered==!0&&u.element.find(".filterDisable")[0].checked==!0?"Disable Filtering":"",u._SortFilterDetails=tt+"||"+it,u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800),u.element.find(".sortEnable")[0].checked==!0||u.element.find(".filterEnable")[0].checked==!0)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:"SortOrFilter",clientInfo:u._SortFilterDetails,olapReport:u.currentReport,clientReports:u.reports,customObject:JSON.stringify(u.model.customObject)}),u._toolbarOperationSuccess);else if(u.element.find(".sortDisable")[0].checked==!0||u.element.find(".filterDisable")[0].checked==!0)if(u._isSorted==!0||u._isFiltered==!0)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:"SortOrFilter",clientInfo:u._SortFilterDetails,olapReport:u.currentReport,clientReports:u.reports,customObject:JSON.stringify(u.model.customObject)}),u._toolbarOperationSuccess),u._isSorted=!1;else return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterInvalidAlertMsg"),"Error",u),u._isTimeOut=!1,u._waitingPopup.hide(),!1}else{if(n(".memberEditorDiv").length>0&&r.target.id=="OKBtn"){if(u.model.enableAdvancedFilter&&u._excelFilterInfo.length>0&&(u._removeFilterTag(u._selectedFieldName),u._selectedLevelUniqueName&&u._removeFilterTag(u._selectedLevelUniqueName)),u._currentItem.indexOf(u._getLocalizedLabels("Measures"))<0&&t.Pivot.updateTreeView(u),!u.model.enableMemberEditorPaging&&u._getSelectedNodes()==0&&args_innerHTML!=u._getLocalizedLabels("Measures")&&args_innerHTML!="ToolbarButtons")return!1;if(u._currentItem.indexOf(u._getLocalizedLabels("Measures"))<0){if(u._currentReportItems.length!=0)for(rt=!1,c=0;c<u._currentReportItems.length;c++)if(u._currentReportItems[c]==u._currentItem){rt=!0;break}rt&&u._currentReportItems.length!=0||u._currentReportItems.push(u._currentItem);u._treeViewData[u._currentItem]=u._memberTreeObj.dataSource()}}if(a=null,args_innerHTML!="ToolbarButtons"){if(u._isMembersFiltered||u.model.enableMemberEditorPaging)args_innerHTML==u._getLocalizedLabels("Measures")?a="Measures:"+u._getMeasuresList():args_innerHTML!="ToolbarButtons"&&args_innerHTML!=i&&(t.Pivot.updateTreeView(u),a=u._getUnSelectedNodes()+"CHECKED"+u._getSelectedNodes(u._currentAxis=="Slicers"?!0:!1));else{u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();t.Pivot.closePreventPanel(u);return}u._isTimeOut=!0;setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800);args_innerHTML==u._getLocalizedLabels("Measures")&&a!=null&&a.split(":")[1]==""&&n(u.element).find(".splitBtn").each(function(t,i){i.firstChild.innerHTML==u._getLocalizedLabels("Measures")&&n(i).remove()});n(u).find(".e-dialog").hide();u.model.enableMemberEditorPaging&&args_innerHTML!=u._getLocalizedLabels("Measures")&&(a=t.Pivot._getUnSelectedTreeState(u)+"CHECKED"+t.Pivot._getSelectedTreeState(u._currentAxis=="Slicers"?!0:!1,u));u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"filtering",element:this.element,customObject:u.model.customObject});k=t.Pivot._getEditorMember(u._dialogTitle,u,!1);u._fieldSelectedMembers[u._dimensionName.split(":")[1]]=n.map(u._fieldMembers[u._dialogTitle],function(n){if(!n.checked)return n}).length==0?"All":k!="All"&&k!="multiple"?k:u._getLocalizedLabels("MultipleItems");u._setSplitBtnTitle();s=JSON.stringify(u.model.customObject);u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.filterElement,JSON.stringify({action:"filtering",clientParams:a,olapReport:u.currentReport,clientReports:u.reports,customObject:s}),u._filterElementSuccess)}else if(u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("RemoveReport")&&reportsCount<2)u.element.find(".e-dialog").hide();else{if(n.trim(u.element.find(".reportName").val())===""&&u.element.find(".reportName").val()!=i)return u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("NewReport")||u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("AddReport")||u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("RenameReport")?t.Pivot._createErrorDialog(u._getLocalizedLabels("SetReportNameAlertMsg"),"Error",u):t.Pivot._createErrorDialog(u._getLocalizedLabels("SetReportNameAlertMsg"),"Error",u),!1;var ot=u.element.find("#reportList").data("ejDropDownList"),e=n.trim(u.element.find(".reportName").val())||ot.selectedTextValue,h=u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().attr("tag"),w=h=="New Report"?"":u.currentReport,ut=h=="New Report"?"":u.reports;if(u._currentRecordName=h=="New Report"?"":u._currentRecordName,u.element.find(".e-dialog").hide(),u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800),u.model.operationalMode==t.Pivot.OperationalMode.ClientMode)d={data:u.model.dataSource.data,reportName:e,enableAdvancedFilter:u.model.dataSource.enableAdvancedFilter,columns:[],cube:u.model.dataSource.cube,catalog:u.model.dataSource.catalog,reportName:e,rows:[],values:[],filters:[]},f=u.element.find(".reportlist").data("ejDropDownList"),u.element.find(".reportlist").ejDropDownList("option","change",t.proxy(u._reportChanged,u)),h=="New Report"?(u.model.dataSource=d,u._clientReportCollection=[d],u.element.find(".reportlist").ejDropDownList("option","dataSource",[{name:e}]),f.selectItemByText(e),u._fieldMembers={},u._fieldSelectedMembers={}):h=="Add Report"?(u.model.dataSource=d,u.model.dataSource.reportName=e,ft=n.map(u._clientReportCollection,function(n){if(n.reportName==u.model.dataSource.reportName)return n}),u._clientReportCollection=n.map(u._clientReportCollection,function(n){if(n.reportName!=u.model.dataSource.reportName)return n}),u._clientReportCollection.push(u.model.dataSource),u._fieldMembers={},u._fieldSelectedMembers={},ft.length==0?(f=u.element.find(".reportlist").data("ejDropDownList"),f.model.dataSource.push({name:e}),l=JSON.stringify(f.model.dataSource),u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l)),f.selectItemByText(e)):u._clientReportCollection.length>0&&u._reportChanged()):h=="Rename Report"?(u._clientReportCollection=n.map(u._clientReportCollection,function(n){return n.reportName==u.model.dataSource.reportName&&(n.reportName=e),n}),l=JSON.stringify(n.map(f.model.dataSource,function(n){return n.name!=f.getValue()?n:{name:e}})),u.model.dataSource.reportName=e,u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l)),f.selectItemByText(e),u._currentItem=""):h=="Remove Report"?(u._clientReportCollection=n.map(u._clientReportCollection,function(n){if(n.reportName!=e)return n}),et=n(f.getSelectedItem()).index()>=u._clientReportCollection.length?u._clientReportCollection.length-1:n(f.getSelectedItem()).index(),u.model.dataSource=u._clientReportCollection[et],l=JSON.stringify(n.map(f.model.dataSource,function(n){if(n.name!=f.getValue())return n})),u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l)),u._fieldMembers={},u._fieldSelectedMembers={},f.model.dataSource.length>0&&f.selectItemByText(u.model.dataSource.reportName)):h=="SaveAs Report"?(u._currentRecordName=e,g={url:"",reportName:e,reportCollection:u._clientReportCollection,mode:u.model.analysisMode,filterCollection:u._currentReportItems},u._trigger("saveReport",{targetControl:u,saveReportSetting:g}),u.model.enableLocalStorage||(s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",g.url+"/"+u.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:g.reportName,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:JSON.stringify(u.model.dataSource),clientReports:JSON.stringify(u._clientReportCollection)+":>>:"+JSON.stringify(u._currentReportItems),customObject:s}),u._toolbarOperationSuccess))):h!="Rename Report"&&(u.refreshControl(),u._pivotSchemaDesigner&&u._pivotSchemaDesigner._refreshPivotButtons()),u._isTimeOut=!1,u._waitingPopup.hide();else if(f=u.element.find(".reportlist").data("ejDropDownList"),u._clientReportCollection=n.map(u._clientReportCollection,function(n){return n.name==f.getValue()&&(n.report=w),n}),h=="SaveAs Report")u._currentRecordName=e,u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"saveReport",element:this.element,customObject:u.model.customObject}),s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:e,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:w,clientReports:u.model.analysisMode=="pivot"?JSON.stringify(u._clientReportCollection):ut,customObject:s}),u._toolbarOperationSuccess);else if(u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:u.model.customObject}),s=JSON.stringify(u.model.customObject),u.model.analysisMode==t.Pivot.AnalysisMode.Olap)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:h,clientInfo:e,olapReport:w,clientReports:ut,customObject:s}),u._toolbarOperationSuccess);else{if(h==u._getLocalizedLabels("NewReport"))u._currentReportName=e,u._fieldMembers={},u._fieldSelectedMembers={};else if(h==u._getLocalizedLabels("AddReport"))u._fieldMembers={},u._fieldSelectedMembers={},f.model.dataSource.push({name:e}),f.selectItemByText(e),u._currentReportName=e;else if(h==u._getLocalizedLabels("RemoveReport")){for(c=0;c<u._clientReportCollection.length;c++)u._clientReportCollection[c].name==u._currentReportName&&u._clientReportCollection.splice(c,1);for(f=u.element.find(".reportlist").data("ejDropDownList"),c=0;c<f.model.dataSource.length;c++)f.model.dataSource[c].name==u._currentReportName&&f.model.dataSource.splice(c,1);f.selectItemByText(f.model.dataSource[0].name);w=u._clientReportCollection[0].report;e=u._clientReportCollection[0].name;u._currentReport="";u._currentReportName=e;u._fieldMembers={};u._fieldSelectedMembers={}}else if(h==u._getLocalizedLabels("RenameReport")){nt="";try{nt=JSON.parse(u.getOlapReport()).Report}catch(st){nt=u.getOlapReport()}u._clientReportCollection=n.map(u._clientReportCollection,function(n){return n.name==u._currentReportName&&(n.name=e),n});f=u.element.find(".reportlist").data("ejDropDownList");l=JSON.stringify(n.map(f.model.dataSource,function(n){return n.name!=f.getValue()?n:{name:e,report:nt}}));u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l));u._isReportListAction=!1;f.selectItemByText(e);u._isReportListAction=!0;u._currentReportName=e;u._isTimeOut=!1;u._waitingPopup.hide();t.Pivot.closePreventPanel(u);return}u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:h,args:JSON.stringify({clientInfo:e,currentReport:w}),customObject:s}),u._toolbarOperationSuccess)}}}u._isTimeOut&&(u._isTimeOut=!1);u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();u.element.find("#preventDiv").remove()});this.element.find(".searchEditorTree").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");t.Pivot._searchEditorTreeNodes(i,r)});this.element.find(".calcMemberImg").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r;i.element.find(".calcMemberDialog").length>0?(i._calcMemberTreeObj.collapseAll(),t.Pivot.openPreventPanel(i),i._calcMemberDialog.open(),i.element.find("#"+i._id+"_captionFieldCM").val(""),i.element.find("#"+i._id+"_expressionFieldCM").val(""),i.element.find("#"+i._id+"_memberTypeFieldCM").data("ejDropDownList").selectItemsByIndices(0),i.element.find("#"+i._id+"_dimensionFieldCM").data("ejDropDownList").selectItemsByIndices(0),i.element.find("#"+i._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(0),i.element.find("#"+i._id+"_customFormatFieldCM").val("")):(i._waitingPopup.show(),i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"fetchCalcMemberTreeView",element:i.element,customObject:i.model.customObject}),r=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchCalcMemberTreeView",dimensionName:"calcMember",olapReport:i.currentReport,customObject:r}),t.proxy(t.Pivot._createCalcMemberDialog,i)))});this.element.find(".unCheckAll,.checkAll").click(function(t){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");t.target.className.indexOf("checkAll")>-1?(i.element.find(".editorTreeView").ejTreeView("checkAll"),i._isMembersFiltered=!0,i.element.find(".dialogOKBtn").data("ejButton").enable(),i.element.find(".dialogOKBtn").removeAttr("disabled"),i.model.enableMemberEditorPaging&&setTimeout(function(){i._waitingPopup.show();for(var n=0;n<i._editorTreeData.length;n++)i._editorTreeData[n].checkedStatus=!0;i._waitingPopup.hide()},0)):(i.element.find(".editorTreeView").ejTreeView("unCheckAll"),i.element.find(".dialogOKBtn").data("ejButton").disable(),i.element.find(".dialogOKBtn").attr("disabled","disabled"),i.model.enableMemberEditorPaging&&setTimeout(function(){i._waitingPopup.show();for(var n=0;n<i._editorTreeData.length;n++)i._editorTreeData[n].checkedStatus=!1;i._waitingPopup.hide()},0))})},_getLocalizedLabels:function(n){return t.PivotClient.Locale[this.locale()][n]===i?t.PivotClient.Locale["en-US"][n]:t.PivotClient.Locale[this.locale()][n]},_unWireEvents:function(){n(this.element.find(".dialogCancelBtn, .dialogOKBtn, .newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .pvtBtn, .removeSplitBtn, .unCheckAll, .checkAll, .removeMeasure, .toggleCollapseButton, .toggleExpandButton, .reportDBImg, .saveAsReportImg, .saveReportImg, .loadReportImg, .removeDBReportImg, .renameDBReportImg, .mdxImg,.maximizedView,.colSortFilterImg, .rowSortFilterImg, .chartTypesImg, .toggleaxisImg, .autoExecuteImg, .nextPage, .prevPage, .firstPage, .lastPage, .searchEditorTree, .calcMemberImg")).off(t.eventType.click);n(this.element.find(".dialogCancelBtn, .dialogOKBtn, .newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .pvtBtn, .removeSplitBtn, .unCheckAll, .checkAll, .removeMeasure, .toggleCollapseButton, .toggleExpandButton, .reportDBImg, .saveAsReportImg, .saveReportImg, .loadReportImg, .removeDBReportImg, .renameDBReportImg, .mdxImg,.maximizedView,.colSortFilterImg, .rowSortFilterImg, .chartTypesImg, .toggleaxisImg,.autoExecuteImg, .nextPage, .prevPage, .firstPage, .lastPage, .searchEditorTree,.calcMemberImg")).off("click");n(document).find(".winCloseBtn").off(t.eventType.click);n(this._off(this.element,"mouseup",".parentsplit"));this._off(this.element,"click","#preventDiv");n(document).find(".winCloseBtn").off("click");this._off(n(document),"keydown",this._keyPressDown);this._off(n(document),"keyup",this._keyPressUp);this.model.isResponsive&&n(window).off("resize",n.proxy(this._reSizeHandler,this))},_calculateHeight:function(){var i,r;n(this.element).height(n(this.element).height()<450?450:n(this.element).height());this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(i=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5),this.element.find(".oClientTbl").css("height",i+"px"),this.element.find(".outerTable").css("height",i+"px"),this.model.enableVirtualScrolling?(this.element.find(".controlPanel").css("height",i-25+"px"),this._pivotGrid._applyVScrolling()):this.model.enablePaging?this.model.displaySettings.controlPlacement==t.PivotClient.ControlPlacement.Tab?this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()):this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()-5):this.element.find(".controlPanel").css("height",i+"px"),this.element.find(".cubeTable").css("height",this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38)+"px"),cdbHeight=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38),this.element.find(".cubeBrowser").css("height",cdbHeight+7-this.element.find(".cdbHeader").height()),this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-this.element.find(".cubeName").height()-(7+(this.model.enableMeasureGroups?this.element.find(".measureGroupselector").height()+13:0))),aebHeight=cdbHeight-(this.element.find(".axisHeader").height()*3+4),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").css("height",aebHeight/3+"px"),this.model.enableSplitter&&this.element.find(".splitresponsive").height(this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+30))):(i=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5),this.element.find(".outerTable, .controlPanelTD").css("height",i+"px"),this.model.enableVirtualScrolling?(this.element.find(".controlPanel").height(i-15),this.model.displaySettings.mode!=t.PivotClient.DisplayMode.ChartOnly&&this._pivotGrid._applyVScrolling()):this.model.enablePaging?this.model.displaySettings.controlPlacement==t.PivotClient.ControlPlacement.Tab?this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()):this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()-5):this.element.find(".controlPanel").height(i),this.element.find("#"+this._id+"_PivotSchemaDesigner").height(i),this._pivotSchemaDesigner._reSizeHandler(),this.enableTogglePanel()&&this.element.find(".pivotFieldList").length>0&&(this.element.find("div.togglePanel").remove(),this.element.find(".controlPanel").width(this.element.width()-(this.element.width()/3+20)),n(t.buildTag("div.togglePanel",t.buildTag("div.toggleExpandButton e-icon","",{}).attr("aria-describedby","toggleexpand")[0].outerHTML+t.buildTag("div.toggleCollapseButton e-icon",{},{display:"none"}).attr("aria-describedby","togglecollapse")[0].outerHTML)[0].outerHTML).appendTo(this.element.find(".pivotFieldList").parent()),this.element.find(".togglePanel").height(this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5)+"px").width(14),this.element.find(".toggleExpandButton,.toggleCollapseButton").css("margin-top",(this.element.find("#"+this._id+"_PivotSchemaDesigner").parents("td:eq(0)").height()-9)/2),this.element.find(".togglePanel").children().addClass("toggleButtons"),this._unWireEvents(),this._wireEvents()));this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?(this.model.enableVirtualScrolling&&this.element.find(".controlPanel").height(this.element.find(".controlPanel").height()-5),this.defaultView()==t.PivotClient.DefaultView.Grid?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10)):this.displayMode()==t.PivotClient.DisplayMode.GridOnly?this.model.enablePaging?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-10):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-20):this.model.enableVirtualScrolling?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+30)):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+15)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-10):this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-15):this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()-17):(r=this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+20),this.model.enableVirtualScrolling?this.element.find(".chartContainer").height(r-5):this.element.find(".chartContainer").height(r-2)));this._chartHeight=this.model.enableToolBar?this.element.find(".chartContainer").height()-68+"px":this.element.find(".chartContainer").height()-3+"px";this._gridHeight=this.model.enableToolBar?this.element.find(".gridContainer").height()-46+"px":this.element.find(".gridContainer").height()-10+"px";this.model.enableToolBar&&(this.element.find("#"+this._id+"_PivotGridToolbar").height(this._gridHeight),this.element.find("#"+this._id+"_PivotCharttoolBar").height(this._chartHeight))},_performToggleAction:function(n){this.element.find(".controlPanel").width(n[0].controlPanelWidth);(this.controlPlacement()!="horizontal"||this.controlPlacement()=="horizontal"&&this.displayMode()=="chartOnly"||this.controlPlacement()=="horizontal"&&this.displayMode()=="gridOnly")&&(this.element.find(".e-pivotchart").width(n[0].chartOuterWidth),this.element.find(".e-pivotgrid").width(n[0].gridOuterWidth),this.element.find("#"+this._id+"_PivotChart").css({width:"100%"}),this.element.find("#"+this._id+"_PivotGrid").css({width:"98%"}),t.isNullOrUndefined(this._pivotChart)&&t.isNullOrUndefined(this.otreemapObj)||(this.element.find("#"+this._pivotChart._id).ejPivotChart("option","width",n[0].chartOuterWidth+"px"),this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)||(this.element.find("#"+this.chartObj._id).ejChart("option",{model:{size:{width:n[0].chartOuterWidth+"px"}}}),this.element.find("#"+this.chartObj._id+"_svg").width(n[0].chartOuterWidth),this.chartObj.redraw())),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this._toggleExpand&&!t.isNullOrUndefined(this.chartObj)&&(this.element.find("#"+this._id+"_PivotChartContainer").css("width",this.chartObj.model.size.width),this.chartObj.redraw()),this.model.enableToolBar&&(this.element.find("#"+this._id+"_PivotCharttoolBar").width(this.element.find(".chartContainer").width()),this.element.find("#"+this._id+"_PivotGridToolbar").width(this.element.find(".gridContainer").width()-10),this.element.find(".chartToolBar").width(this.element.find(".chartContainer").width()),this.element.find(".toolBar").width(this.element.find(".gridContainer").width())))},_rwdToggleExpand:function(){this.element.find(".csHeader, .cubeTable,.e-pivotschemadesigner,.toggleExpandButton").show();this.element.find(".toggleCollapseButton").hide();this.element.find(".toggleText").hide();this._calculateHeight();this._parentElwidth<850&&(this.element.find(".outerTable").css({position:"absolute",float:this.model.enableRTL?"right":"left",tableLayout:"auto","z-index":"10000"}),this.element.find(".pivotFieldList").width("91%"),this.element.find("table.cubeTable").css({width:"71%"}),this.element.find(".csHeader").css({width:"100%"}),this.element.find("#cubeSelector_wrapper").css({width:"100%"}),this.element.find(".controlPanelTD").css({width:this.element.find(".oClientTbl").width()-this.element.find("table.cubeTable").width(),float:this.model.enableRTL?"left":"right",left:this.model.enableRTL?"0px":"15px",right:this.model.enableRTL?"15px":"0px",position:"relative"}),this.element.find(".controlPanel").css({width:this.element.find(".controlPanelTD").width()-20}));this._parentElwidth>850&&(this.element.find(".controlPanelTD").css({width:"56%",left:"inherit",float:"left","margin-left":"5px"}),this.element.find("table.cubeTable").css({width:"98%"}),this.element.find(".outerTable,.controlPanelTD").css({position:"inherit"}),this._currentTab=="grid"?n(".controlPanel").width(n("#"+this._id).width()*55/100+"px"):this._currentTab=="chart"?n(".controlPanel").width(n("#"+this._id).width()*55/100+"px"):n(".controlPanel").width("100%"),window.navigator.userAgent.indexOf("Trident")>0?(this.element.find(".outerTable").width(n("#"+this._id).width()*43/100),this.element.find(".csHeader").width(n("#"+this._id).width()*41/100+"px"),this.element.find("#cubeSelector_wrapper").width(n("#"+this._id).width()*29/100-60+"px"),this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").width(n("#"+this._id).width()*56/100+"px")):(this.element.find(".outerTable").css({width:n("#"+this._id).width()*42/100+"px",tableLayout:"auto"}),this.element.find(".csHeader").css({width:n("#"+this._id).width()*42/100+"px"}),this.element.find("#cubeSelector_wrapper").css({width:n("#"+this._id).width()*32/100-60+"px"}),this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").css({width:n("#"+this._id).width()*57/100+"px"})));this.displayMode()!="gridonly"&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"?(this.element.find(".gridPanel").width(n(".controlPanel").width()-7),this.model.enableToolBar?n("#"+this._pivotChart._id).width(n(".controlPanel").width()-30):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-7)):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-12),this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()));this._overflow()},_overflow:function(){this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.element.find(".ellipse").remove(),this.element.find(".cdbHeader")[0].scrollHeight>this.element.find(".cdbHeader")[0].offsetHeight?(this.element.find(".cdbHeader").attr("title",this.element.find(".cdbHeader").text()),this.element.find(".cdbHeader").after("<span class='ellipse' style='margin-top:-"+this.element.find(".cdbHeader").height()*78/100+"px'>....<\/span>")):this.element.find(".cdbHeader").removeAttr("title"))},_rwdToggleCollapse:function(){this._parentElwidth<850&&(this.element.find(".outerTable").css({position:"absolute"}),this.element.find(".controlPanelTD").css({left:this.model.enableRTL?"0px":"35px",right:this.model.enableRTL?"35px":"0px",position:"relative"}));this._currentTab=="grid"?n(".controlPanel").css({width:n("#"+this._id).width()*94/100+"px"}):n(".controlPanel").css({width:"100%"});this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").css({width:n("#"+this._id).width()*94/100+"px"});this.element.find(".csHeader, .cubeTable, .e-pivotschemadesigner,.toggleExpandButton").hide();this.element.find(".controlPanelTD").css({left:this.model.enableRTL?"0":"4%",right:this.model.enableRTL?"4%":"0px",position:"relative",width:"95%",tableLayout:"fixed",float:""});n("#"+this._id).width("98%");this.element.find(".outerTable").css({position:"absolute",width:"0px",tableLayout:"fixed"});this.element.find(".toggleCollapseButton").show();this.element.find(".toggleText").show();this.displayMode()!="gridonly"&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"?this.model.enableToolBar?n("#"+this._pivotChart._id).width(n(".controlPanel").width()-45):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-17):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-15),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()))},_removeFilterTag:function(i){var u,r;if(i.indexOf("].")>=0){if(u=i.split("].").length>2?"levelUniqueName":"hierarchyUniqueName",this._excelFilterInfo.length>0){var f=this.element.find(".cubeSelector").data("ejDropDownList").model.value,r=this.element.find("#reportList").data("ejDropDownList").model.value,e=this._selectedLevelUniqueName,o=this._selectedFieldName;this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n.cubeName==f&&n.report==r&&!(n[u]==i))return n})}}else i&&this._excelFilterInfo.length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(r=this.element.find("#reportList").data("ejDropDownList").model.value,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n.report==r&&!(n.levelUniqueName==i))return n}))},_groupLabelChange:function(i){var r,u;if(this._selectedLevelUniqueName=i.selectedValue,r=[],this._excelFilterInfo.length>0){var f=this.element.find(".cubeSelector").data("ejDropDownList").model.value,e=this.element.find("#reportList").data("ejDropDownList").model.value,o=this._selectedLevelUniqueName,s=this._selectedFieldName;r=n.map(this._excelFilterInfo,function(n){if(n.cubeName==f&&n.report==e&&n.hierarchyUniqueName==s&&n.levelUniqueName==o)return{action:n.action,operator:n.operator,value1:n.value1}})}this.element.find(".filterElementTag .activeFilter,.filterIndicator").remove();this.element.find("#labelClearFilter").css("opacity","0.5").attr("disable",!0);this.element.find("#valueClearFilter").css("opacity","0.5").attr("disable",!0);r.length>0&&!t.isNullOrUndefined(r[0].operator)?(u=r[0].action=="valuefiltering"?"valueFilterBtn":"labelFilterBtn",this.element.find(".clientDialog").prepend("<div class='filterIndicator e-icon' style='top:"+(u=="labelFilterBtn"?"59px":"89px")+"' />"),this.element.find("#"+u+" #labelClearFilter").removeAttr("style disable"),this.element.find("#"+u+" #valueClearFilter").removeAttr("style disable"),r[0].operator.replace(/ /g,"")=="BottomCount"?this.element.find("#"+u+" li#"+r[0].operator.replace(/ /g,"").replace("Bottom","top")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML)):this.element.find("#"+u+" li#"+r[0].operator.replace(/ /g,"")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML))):this._getUnSelectedNodes()!=""&&this.element.find(".clientDialog").prepend("<div class='filterIndicator e-icon' />")},_filterElementClick:function(i){var u,r;if(n(i.element).hasClass("clearFilter")&&n(i.element).css("opacity")=="0.5"||n(i.element).parent(".filterElementTag").length>0)return i.Cancel;this._selectedLevelUniqueName=this.element.find(".groupLabelDrop").data("ejDropDownList").model.value||this.element.find(".groupLabelDrop").data("ejDropDownList").model.dataSource[0].value;var f=this.element.find(".cubeSelector").length>0?this.element.find(".cubeSelector").data("ejDropDownList").model.value:"",e=this.element.find("#reportList").data("ejDropDownList").model.value,o=this._selectedLevelUniqueName,s=this._selectedFieldName;n(i.element).attr("id")=="labelClearFilter"||n(i.element).attr("id")=="valueClearFilter"?(this._removeFilterTag(this._selectedLevelUniqueName),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filterElement,JSON.stringify({action:"labelfiltering",clientParams:this._selectedLevelUniqueName+"--Clear Filter",olapReport:this.currentReport,clientReports:this.reports,customObject:JSON.stringify(this.model.customObject)}),this._filterElementSuccess)):(u=n(i.element).parents("li:eq(0)#valueFilterBtn").length>0?"valueFilterDlg":"labelFilterDlg",r=[],this._excelFilterInfo.length>0&&n(i.element).siblings("li:eq(0)").attr("disable")!="true"&&(r=n.map(this._excelFilterInfo,function(n){if(n.cubeName==f&&n.report==e&&n.hierarchyUniqueName==s&&n.levelUniqueName==o)return{value1:n.value1,value2:n.value2,operator:n.operator,measure:n.measure}}),!n(i.element).hasClass(r[0].operator.replace(/ /g,""))&&r.length>0&&(r=[])),this._schemaData&&(this._schemaData._selectedLevelUniqueName=this._selectedLevelUniqueName,this._schemaData.selectedFieldName=this._selectedFieldName),t.Pivot.createAdvanceFilterTag({action:u,selectedArgs:i,filterInfo:r},this))},_filterOptionChanged:function(n){var i=this.element.find("#filterDialog_wrapper .e-titlebar").text().indexOf("Value")>=0?"valueFilterDlg":"labelFilterDlg";i=="valueFilterDlg"&&t.Pivot.createAdvanceFilterTag({action:i,selectedArgs:n,filterInfo:[]},this)},_filterElementOkBtnClick:function(){pivotClientObj=this;t.isNullOrUndefined(this._waitingPopup)||(pivotClientObj._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800));var u=this.element.find("#filterOptions").data("ejDropDownList").model.value||this.element.find("#filterOptions")[0].value,f=this.element.find("#filterValue1")[0].value,e=this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:"",i,n,r="labelfiltering";n=this._selectedLevelUniqueName+"--"+u+"--"+f;this.element.find(".filterMeasures").length>0&&(this.element.find("#filterValue2").length>0&&(n=n+","+e),i=this.element.find(".filterMeasures").data("ejDropDownList").model.value,n=n+"--"+i,r="valuefiltering");this._removeFilterTag(this._selectedLevelUniqueName);this._excelFilterInfo.push({cubeName:this.element.find(".cubeSelector").length>0?this.element.find(".cubeSelector").data("ejDropDownList").model.value:"",report:this.element.find("#reportList").data("ejDropDownList").model.value,action:r,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:u,measure:i,value1:f,value2:e});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filterElement,JSON.stringify({action:r,clientParams:n,olapReport:this.currentReport,clientReports:this.reports,customObject:JSON.stringify(this.model.customObject)}),this._filterElementSuccess)},_splitButtonDropped:function(i,r){var u,f,e,o;if(isDropped=!0,clientObj=this,u=i=="Series"?"row":i.toLowerCase(),n.trim(r)==""&&this.element.find("."+u+"Axis").find("button:last").attr("title")==this.element.find("button.dragClone").attr("title")||n.trim(r)!=""&&this.element.find(n("."+u+"Axis").find(".splitBtn")[r]).attr("tag").split(":")[1].replace("."," - ")==this.element.find("button.dragClone").attr("title"))return this.element.find("button.dragClone").remove(),!1;if(u=="slicer"&&draggedSplitBtn!=null&&n(draggedSplitBtn).parent("div:eq(0)").attr("Tag").indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1)return this.element.find("button.dragClone").remove(),t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;(n.trim(r)==""||draggedSplitBtn!=null&&this.element.find(n("."+u+"Axis").find(".splitBtn")[r]).attr("tag").split(":")[1].replace("."," - ")!=this.element.find("button.dragClone").attr("title"))&&(f=this.element.find(".cubeName").html()+"--"+n(draggedSplitBtn).parent("div:eq(0)").attr("Tag")+"--"+i+"--"+r,this.model.enableAdvancedFilter&&i=="Slicer"&&(e=n(draggedSplitBtn).parent("div:eq(0)").attr("Tag").split(":")[1].split("."),this._setUniqueNameFrmBtnTag(e),this._removeFilterTag(this._selectedFieldName)),this.element.find("button.dragClone").remove(),draggedSplitBtn=null,this._isTimeOut=!0,setTimeout(function(){clientObj._isTimeOut&&clientObj._waitingPopup.show()},800),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),o=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:f,olapReport:this.currentReport,clientReports:this.reports,customObject:o}),this._nodeDroppedSuccess));this._isNodeOrButtonDropped=!0},_filterElementSuccess:function(n){this._isSearchApplied=!1;t.Pivot.closePreventPanel(this);n[0]!=i?(this.currentReport=n[0].Value,this.reports=n[1].Value,n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value)):n.d!=i?(this.currentReport=n.d[0].Value,this.reports=n.d[1].Value,n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value)):(this.currentReport=n.UpdatedReport,this.reports=n.ClientReports,n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject));this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject});this._renderControls();this._unWireEvents();this._wireEvents();this._successAction="Filter";this._trigger("renderSuccess",this)},_maxViewBtnClick:function(){var r=n(window).width()-150,u=n(window).height()-100,f=t.buildTag("div.fullScreenView","",{width:n(document).width(),height:n(document).height()}),i=t.buildTag("div#"+this._id+"_maxView.maximumView","",{width:r,height:u}),o=t.buildTag("div#Winclose.winCloseBtn e-icon","").attr("role","button").attr("aria-label","close").attr("clientID",this._id),e;this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this.displayMode()==t.PivotClient.DisplayMode.ChartOnly&&(n("#"+this._pivotChart._id+"Container_svg")[0]||n("#"+this.otreemapObj._id+"TreeMapContainer").children().length>0)&&(this._fullScreenView(100,160),t.isNullOrUndefined(this.chartObj)||this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&(n("#"+this.otreemapObj._id).css({width:"99%"}),n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"})),i.append(this.element.find("#"+this._id+"_PivotChart")));this.displayMode()==t.PivotClient.DisplayMode.GridOnly&&i.append(this.element.find("#"+this._id+"_PivotGrid").css({"max-height":u,width:r,overflow:"auto"}));this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.displayMode()=="chartandgrid"?this._currentTab=="grid"?i.append(this.element.find("#"+this._id+"_PivotGrid").css({"max-height":u,width:r})):this._currentTab=="chart"&&(n("#"+this._pivotChart._id+"Container_svg")[0]||n("#"+this.otreemapObj._id+"TreeMapContainer").children().length>0)&&(this._fullScreenView(100,160),t.isNullOrUndefined(this.chartObj)||this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&(n("#"+this.otreemapObj._id).css({width:"99%"}),n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"})),i.append(this.element.find("#"+this._id+"_PivotChart"))):this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&(e=n(window).height()/2-50,this.element.find("#"+this._id+"_PivotGrid").css({"max-height":e,"margin-left":"0px",overflow:"auto"}),t.isNullOrUndefined(this.chartObj)||this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&(n("#"+this.otreemapObj._id).css({width:"99%"}),n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"})),this._fullScreenView(50,160),(n("#"+this._pivotChart._id+"Container_svg")[0]||n("#"+this.otreemapObj._id+"TreeMapContainer").children().length>0)&&(this.defaultView()=="chart"?i.append(this.element.find("#"+this._id+"_PivotChart")).append(this.element.find("#"+this._id+"_PivotGrid").width(n(window).width()-160)):i.append(this.element.find("#"+this._id+"_PivotGrid").width(n(window).width()-160)).append(this.element.find("#"+this._id+"_PivotChart"))),i.append(this.element.find("#"+this._id+"_PivotGrid").width(n(window).width()-160)));i.append(o);f.append(i);n("body").append(f);this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(t.isNullOrUndefined(this.chartObj)||(this.model.enablePivotTreeMap&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()))},_maxViewClsBtnClick:function(){var i=n(".fullScreenView");i.find("#"+this._id+"_PivotGrid").css("margin-left","7px");i.find("#"+this._id+"_PivotChart").appendTo(this.element.find(".chartContainer"));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this.displayMode()==t.PivotClient.DisplayMode.ChartOnly&&n("#"+this._pivotChart._id+"Container_svg")[0]&&this._fullScreenViewCls(560,557);this.displayMode()==t.PivotClient.DisplayMode.GridOnly&&i.find("#"+this._id+"_PivotGrid").css({width:"inherit","max-height":"",overflow:"hidden"});this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.displayMode()=="chartandgrid"&&(this._currentTab=="chart"&&n("#"+this._pivotChart._id+"Container_svg")[0]?this._fullScreenViewCls(533,553):i.find("#"+this._id+"_PivotGrid").css({"max-height":"550px",width:"555px"}));this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&(n("#"+this._pivotChart._id+"Container_svg")[0]?(this._fullScreenViewCls(275,555),i.find("#"+this._id+"_PivotGrid").css({"max-height":"300px",width:"555px",overflow:"hidden"})):i.find("#"+this._id+"_PivotGrid").css({"max-height":"275px",width:"555px"}));this.enableTogglePanel()&&this.element.find(".cubeTable").is(":visible")==!1&&i.find("#"+this._id+"_PivotGrid").css("width","950px");i.find("#"+this._id+"_PivotGrid").appendTo(this.element.find(".gridContainer"));n(".maximumView").remove();n(".fullScreenView").remove();this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(t.isNullOrUndefined(this.chartObj)||(this.model.enablePivotTreeMap&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()))},_enableResponsive:function(){this.element.find(".outerPanel").css({width:"100%"});n(".e-pivotclient").css({width:"100%"});this.element.find(".outerTable").css({float:this.model.enableRTL?"right":"left"});this.element.find(".cdbHeader, .cubeBrowser").addClass("responsive");this.element.find(".rowAxis, .slicerAxis, .categoricalAxis").width("99%");this.element.find(".controlPanelTD").width("56%");this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".controlPanelTD").css("display","inline-block");this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.element.find(".cubeTable,.e-pivotschemadesigner").width("100%"):this.element.find(".cubeTable").width("98%");window.navigator.userAgent.indexOf("Trident")>0?(this._currentTab=="grid"?n(".controlPanel").css({width:n("#"+this._id).width()*55/100+"px"}):n(".controlPanel").css({width:"99%"}),this.element.find(".outerTable").width(n("#"+this._id).width()*39/100),this.element.find(".csHeader").width(n("#"+this._id).width()*38/100),this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").width(n("#"+this._id).width()*55/100)):(this.element.find(".outerTable").width(n("#"+this._id).width()*38/100),this.element.find(".csHeader").width(n("#"+this._id).width()*38/100))},_fullScreenView:function(r,u){var f,e;this._pivotChart!=null&&this._pivotChart!=i&&n("#"+this._pivotChart._id+"Container_svg")[0]&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),f=this.chartObj.model.size.width=this._pivotChart.model.size.width=n(window).width()-u+"px",e=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"?this._pivotChart.model.size.height=this.chartObj.model.size.height=n(window).height()/2-r+"px":this._pivotChart.model.size.height=this.chartObj.model.size.height=n(window).height()-r+"px",this.element.find("#"+this._id+"_PivotChart").css({"min-height":e,width:f}),this.element.find("#"+this._id+"_PivotChartContainer").css({width:f,height:e}),this.chartObj.redraw())},_fullScreenViewCls:function(n,t){var u,r;this._pivotChart!=null&&this._pivotChart!=i&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),u=this.chartObj.model.size.height=this._pivotChart.model.size.height=n+"px",r=this.enableTogglePanel()&&this.element.find(".cubeTable").is(":visible")==!1?this.chartObj.model.size.width=this._pivotChart.model.size.width="950px":this.chartObj.model.size.width=this._pivotChart.model.size.width=t+"px",this.element.find("#"+this._id+"_PivotChart").css({"min-height":u,width:r}),this.element.find("#"+this._pivotChart._id+"Container").width(r),this.chartObj.redraw())},_calcMemberDroppedSuccess:function(n){var t;if(n[0]!=i){for(t=0;t<n.length;t++)if(n[t].Key=="calcMemberTreeData"){this._calcMembers=JSON.parse(n[t].Value);n.splice(t,1);break}}else if(n.d!=i){for(t=0;t<n.d.length;t++)if(n.d[t].Key=="calcMemberTreeData"){this._calcMembers=JSON.parse(n.d[t].Value);n.d.splice(t,1);break}}else this._calcMembers=JSON.parse(n.calcMemberTreeData),delete n.calcMemberTreeData;this._calcMemberTreeViewUpdate();this._nodeDroppedSuccess(n)},_nodeDroppedSuccess:function(r){var e,o,s,c,h,u,f;if(r[0]!=i?(e=r[0].Value,o=r[1].Value,s=r[2].Value,this.currentReport=r[3].Value,this.reports=r[4].Value,r[5]!=null&&r[5]!=i&&(this.model.customObject=r[5].Value)):r.d!=i?(e=r.d[0].Value,o=r.d[1].Value,s=r.d[2].Value,this.currentReport=r.d[3].Value,this.reports=r.d[4].Value,r.d[5]!=null&&r.d[5]!=i&&(this.model.customObject=r.d[5].Value)):(e=r.Columns,o=r.Rows,s=r.Slicers,this.currentReport=r.UpdatedReport,this.reports=r.ClientReports,r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)),this._isRemoved&&(this._isRemoved=!1,tempArray=[],e.length>0&&tempArray.push(e),o.length>0&&tempArray.push(o),s.length>0&&tempArray.push(s),tempArray.length>0))for(c=0;c<tempArray.length;c++)if(u=tempArray[c],!t.isNullOrUndefined(u))for(f=0;f<u.split("#").length;f++)h=u.split("#")[f]==""||u.split("#")[f]=="Measures"?null:u.split("#")[f].split(".").length>0?u.split("#")[f].replace("."," - "):u.split("#")[f],t.isNullOrUndefined(h)||this._currentReportItems.length!=0&&this._treeViewData.hasOwnProperty(h)&&(delete this._treeViewData[h],this._currentReportItems.splice(n.inArray(h,this._currentReportItems),1));this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find(".splitBtn, .e-btn").remove();n(this._createSplitButtons(e,"Columns")).appendTo(".categoricalAxis");n(this._createSplitButtons(o,"Rows")).appendTo(".rowAxis");n(this._createSplitButtons(s,"Slicers")).appendTo(".slicerAxis");this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button});this.model.showUniqueNameOnPivotButton&&(n(".pvtBtn").addClass("splitBtnUnique"),n(".removeSplitBtn").addClass("removeBtnUnqiue"));this._setSplitBtnTitle();this._renderControls();this._unWireEvents();this._wireEvents();this._successAction="NodeDrop";this._trigger("renderSuccess",this);this._buttonContextMenu()},_buttonContextMenu:function(){var i=t.buildTag("ul.pivotTree#pivotTree",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToSlicer"))[0].outerHTML)[0].outerHTML)[0].outerHTML;this.element.append(i);n("#pivotTree").ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:this.element.find(".e-button"),click:t.proxy(this._contextClick,this),beforeOpen:t.proxy(this._contextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)})},_editorTreeInfoSuccess:function(n){n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchMemberTreeNodes",element:this.element,customObject:this.model.customObject});this._createDialog(args_className,args_innerHTML,n);this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="EditorTreeInfo";this._trigger("renderSuccess",this);this.element.find(".e-dialog .e-text:visible").first().length>0?this._curFocus.editor=this.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"):this.element.find(".e-dialog .measureEditor:visible").first().length>0&&(this._curFocus.editor=this.element.find(".e-dialog .measureEditor:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"))},_generateAllMember:function(t,i){this.olapCtrlObj._allMember=n(n(i).find("Axis:eq(0) Tuple:eq(0)").children().children()[1]).text()},generateJSON:function(i){this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart.model.analysisMode=this.model.analysisMode,this._pivotChart.model.operationalMode=this.model.operationalMode,this._pivotChart.model.dataSource=this.model.dataSource,this._pivotChart.setPivotEngine(i.tranposeEngine),this._pivotChart._drillAction="",this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&this._pivotGrid._drillAction!=""?(this._setChartDrillMembers(i.tranposeEngine,this._pivotGrid._drillAction),this._drillInfo=[]):this._pivotChart.generateJSON(this,i.tranposeEngine),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this._pivotChart._drilledCellSet=this._drilledCellSet.length>0?this._drilledCellSet:[],this._pivotChart.XMLACellSet=this.XMLACellSet.length>0?this.XMLACellSet:[]),this._pivotChart._drillAction="");this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this._pivotGrid.model.analysisMode=this.model.analysisMode,this._pivotGrid.model.operationalMode=this.model.operationalMode,this._pivotGrid.model.dataSource=this.model.dataSource,this._pivotGrid.setJSONRecords(JSON.stringify(i.jsonObj)),this._pivotGrid.model.collapsedMembers=null,this.model.gridLayout=="excellikelayout"?this._pivotGrid.excelLikeLayout(i.jsonObj):this._pivotGrid.renderControlFromJSON(),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this._pivotGrid._drilledCellSet=this._drilledCellSet.length>0?this._drilledCellSet:[],this._pivotGrid.XMLACellSet=this.XMLACellSet.length>0?this.XMLACellSet:[]),this._pivotGrid._drillAction="");this._pivotSchemaDesigner&&this._pivotSchemaDesigner._refreshPivotButtons();this.model.showUniqueNameOnPivotButton&&(n(".pivotButton").addClass("pvtBtnUnique"),n(".pvtBtn").addClass("schemaBtnUnique"),n(".removeClientPivotBtn").addClass("schemaRemoveBtnUnqiue"));this.model.isResponsive&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)||this.element.find("#"+this.chartObj._id).ejChart("option",{model:{size:{height:this._chartHeight}}}))},_renderLayout:function(){var r,i,u,f;this.model.isResponsive&&(this.model.displaySettings.enableTogglePanel=!0);r=t.buildTag("div.reportToolbar#reportToolbar",this._reportToolbar(),{width:"410px",height:"29px"})[0].outerHTML;this.model.enableSplitter?this.model.isResponsive?this.model.isResponsive&&(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).addClass("splitresponsive")[0].outerHTML,u=t.buildTag("span.outerPanel","").append(t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML+r+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",i).attr("width","100%")[0].outerHTML).attr("width","100%")[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%"})[0].outerHTML)):this.model.enableRTL&&!this.model.enableVirtualScrolling?(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).attr("class","childsplit")[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append("<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>"+r+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td class=\"controlPanelTD\" style='width:50%'>"+this._controlPanel()+"<\/td><td style='width:50%'>"+i+"<\/td><\/tr><\/table>")):this.model.enableVirtualScrolling||this.model.enableRTL&&this.model.enableVirtualScrolling?(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).attr("class","childsplit")[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append("<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>"+r+"<table class=\"outerTable\" style='width:100%'><tr style='width:98%'><td style='width:49%'>"+i+"<\/td><td class=\"controlPanelTD\" style='width:49%'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).attr("class","childsplit")[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append("<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>"+r+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td style='width:50%'>"+i+"<\/td><td class=\"controlPanelTD\" style='width:50%'>"+this._controlPanel()+"<\/td><\/tr><\/table>")):this.model.isResponsive?this.model.isResponsive&&(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{})[0].outerHTML,u=t.buildTag("span.outerPanel","").append((n.trim(this.model.title)!=""?t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML:"")+r+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",i)[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%"})[0].outerHTML)):(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{})[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append((n.trim(this.model.title)!=""?"<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>":"")+r+"<table class=\"outerTable\" style='display:block'><tr><td>"+i+"<\/td><td class=\"controlPanelTD\"style='display:block'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>"));this.element.html(u);this.element.find(".reportToolbar").ejToolbar({enableRTL:this.model.enableRTL,height:"35px"});this._calculateSize();this.model.enableRTL&&this.element.addClass("e-rtl");(this.enableTogglePanel()&&!this.model.enableSplitter||this.model.isResponsive)&&(this.element.find(".controlPanel").width(this.element.width()-(this.element.width()/3+20)),n(t.buildTag("div.togglePanel",t.buildTag("div.toggleExpandButton e-icon","",{}).attr("aria-describedby","toggleexpand")[0].outerHTML+t.buildTag("div.toggleCollapseButton e-icon",{},{display:"none"}).attr("aria-describedby","togglecollapse")[0].outerHTML)[0].outerHTML).appendTo(this.element.find(".pivotFieldList").parent()));(this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.defaultView()==t.PivotClient.DefaultView.Grid||this.displayMode()==t.PivotClient.DisplayMode.GridOnly)&&this.element.find(".chartTypesImg").addClass("chartTypesOnGridView");this.element.find(".controlPanel").css("right",3);f="<div class ='reportList' ><input type='text' id='reportList' class='reportlist' title='"+this._getLocalizedLabels("ReportList")+"'/><\/div>";n(this.element).find(".reportCol").append(f)},_calculateSize:function(){var i,f,r,u;n(this.element).height(this.model.size.height).width(this.model.size.width);n(this.element).height(n(this.element).height()<500?500:n(this.element).height());n(this.element).width(n(this.element).width()<600?600:n(this.element).width());i=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5);this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(this.model.isResponsive||this.model.enableSplitter||(r=this.element.width()/2.5,this.element.find(".csHeader").width(r+15),this.element.find(".axisBuilderTD").width(r/2),this.element.find(".cdbHeader, .cubeBrowser").width(r/2),this.element.find(".controlPanel").width(this.element.width()-(r+25))),this.model.enableVirtualScrolling?this.element.find(".controlPanel").height(i-15):this.model.enablePaging?this.element.find(".controlPanel").height(i-5):this.element.find(".controlPanel").height(i),this.element.find(".cubeTable").height(this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38)),this.model.isResponsive?(this.element.find(".cubeBrowser").height(this.element.find(".cubeTable").height()-this.element.find(".cdbHeader").height()),this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(56+(this.model.enableMeasureGroups?35:0))),f=this.element.find(".cubeTable").height()-(this.element.find(".axisHeader").height()*3+4)):(this.element.find(".cdbTD, .cubeTableTD").height(this.element.find(".cubeTable").height()),this.element.find(".cubeBrowser").height(this.element.find(".cdbTD, .cubeTableTD").height()+9-this.element.find(".cdbHeader").height()),this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(61+(this.model.enableMeasureGroups?30:0))),f=this.element.find(".axisBuilderTD").height()-(this.element.find(".axisHeader").height()*3+3)),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").height(f/3)):(this.model.isResponsive||this.model.enableSplitter||(this.element.find(".outerTable").width(this.element.width()),this.element.find(".controlPanel").width(this.element.width()*(2/3)),this.enableTogglePanel()&&this.element.find(".pivotFieldList").length>0&&this.element.find(".controlPanel").width(this.element.width()-(this.element.width()/3+20))),this.element.find(".controlPanelTD, .outerTable").height(i),this.model.enableVirtualScrolling?this.element.find(".controlPanel").height(i-20):this.element.find(".controlPanel").height(i));this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?(this.model.enableVirtualScrolling&&this.element.find(".controlPanel").width(this.element.find(".controlPanel").width()-5),this.defaultView()==t.PivotClient.DefaultView.Grid?(this.model.enablePaging?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2+5):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10),this.model.isResponsive||this.model.enableSplitter||this.element.find(".gridContainer").width(this.element.find(".controlPanel").width()-15)):(this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10),this.model.isResponsive||this.model.enableSplitter||this.element.find(".gridContainer").width(this.element.find(".controlPanel").width()-20))):this.displayMode()==t.PivotClient.DisplayMode.GridOnly?(this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?12:20)),this.model.isResponsive||this.model.enableSplitter||this.element.find(".gridContainer").width(this.element.find(".controlPanel").width()-15)):this.model.enableVirtualScrolling?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+30)):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+15)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?(this.model.enablePaging?this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2+15):this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-10),this.model.isResponsive||this.model.enableSplitter||this.element.find(".chartContainer").width(this.element.find(".controlPanel").width()-15)):(this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-15),this.model.isResponsive||this.model.enableSplitter||this.element.find(".chartContainer").width(this.element.find(".controlPanel").width()-20)):this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?(this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()-17),this.model.isResponsive||this.model.enableSplitter||this.element.find(".chartContainer").width(this.element.find(".controlPanel").width()-20)):(u=this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+20),this.model.enableVirtualScrolling?this.element.find(".chartContainer").height(u-5):this.model.enablePaging?this.element.find(".chartContainer").height(u):this.element.find(".chartContainer").height(u-2)));this._chartHeight=this.model.enableToolBar?(this.model.enablePaging?this.element.find(".chartContainer").height()-105:this.element.find(".chartContainer").height()-68)+"px":this.element.find(".chartContainer").height()-3+"px";this._chartWidth=this.model.isResponsive||this.model.enableSplitter?"98%":this.element.find(".chartContainer").width()-15+"px";this._gridHeight=this.model.enableToolBar?this.element.find(".gridContainer").height()-46+"px":this.element.find(".gridContainer").height()-10+"px";this._gridWidth=this.model.isResponsive||this.model.enableSplitter?"98%":this.element.find(".gridContainer").width()-20+"px"},_reportToolbar:function(){return t.buildTag("ul",(this.model.toolbarIconSettings.enableNewReport?t.buildTag("li.newReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("NewReport")).attr({title:this._getLocalizedLabels("NewReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableAddReport?t.buildTag("li.addReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("AddReport")).attr({title:this._getLocalizedLabels("AddReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableRemoveReport?t.buildTag("li.removeReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("RemoveReport")).attr({title:this._getLocalizedLabels("RemoveReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableRenameReport?t.buildTag("li.renameReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("RenameReport")).attr({title:this._getLocalizedLabels("RenameReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableDBManipulation?t.buildTag("li.reportDBImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("DBReport")).attr({title:this._getLocalizedLabels("DBReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableMDXQuery&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap?t.buildTag("li.mdxImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("MDXQuery")).attr({title:this._getLocalizedLabels("MDXQuery"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableDeferUpdate&&this.model.enableDeferUpdate&&this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?t.buildTag("li.autoExecuteImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("DeferUpdate")).attr({title:this._getLocalizedLabels("DeferUpdate"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableCalculatedMember?t.buildTag("li.calcMemberImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CalculatedMember")).attr({title:this._getLocalizedLabels("CalculatedMember"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableExcelExport?t.buildTag("li.excelExportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ExportToExcel")).attr({title:this._getLocalizedLabels("ExportToExcel"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableWordExport?t.buildTag("li.wordExportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ExportToWord")).attr({title:this._getLocalizedLabels("ExportToWord"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enablePdfExport?t.buildTag("li.pdfExportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ExportToPdf")).attr({title:this._getLocalizedLabels("ExportToPdf"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableFullScreen&&this.model.displaySettings.enableFullScreen?t.buildTag("li.maximizedView e-icon","",{}).attr("aria-label",this._getLocalizedLabels("FullScreen")).attr({title:this._getLocalizedLabels("FullScreen"),tabindex:0})[0].outerHTML:"")+(this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&!this.model.enableAdvancedFilter?(this.model.toolbarIconSettings.enableSortOrFilterColumn?t.buildTag("li.colSortFilterImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SortOrFilterColumn")).attr({title:this._getLocalizedLabels("SortOrFilterColumn"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableSortOrFilterRow?t.buildTag("li.rowSortFilterImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SortOrFilterRow")).attr({title:this._getLocalizedLabels("SortOrFilterRow"),tabindex:0})[0].outerHTML:""):"")+(this.model.toolbarIconSettings.enableToggleAxis?t.buildTag("li.toggleaxisImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ToggleAxis")).attr({title:this._getLocalizedLabels("ToggleAxis"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableChartTypes?t.buildTag("li.chartTypesImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ChartTypes")).attr({title:this._getLocalizedLabels("ChartTypes"),tabindex:0})[0].outerHTML:"")+t.buildTag("li.reportCol e-icon","",{}).attr("aria-label","report").attr({title:this._getLocalizedLabels("ReportList"),tabindex:0})[0].outerHTML)},_clientGridDrillSuccess:function(i){if(this._isChartDrillAction)this._isChartDrillAction=!1;else if(i.axis=="rowheader"&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly){i.drillAction=="drilldown"?this._drillParams.push(i.drilledMember):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(i.drilledMember)<0});this._pivotChart._drillParams=this._drillParams;var r=i.drilledMember.split(">#>");this._pivotChart._labelCurrentTags.expandedMembers=r;i.drillAction=="drillup"&&(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this._pivotChart._labelCurrentTags.expandedMembers=[],this._drillParams.length>0&&this._getDrilledMember(i.drillAction)):this._pivotChart._labelCurrentTags.expandedMembers.length==0&&this._drillParams.length>0&&this._getDrilledMember(i.drillAction));this._pivotChart._drillAction=i.drillAction;this._pivotChart.refreshControl()}},_getDrilledMember:function(){var o=this._drillParams[this._drillParams.length-1],r=n.grep(this._drillParams,function(n){return n.indexOf(o)>=0}),e,f,u,i;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(i=0;i<r.length;i++)r[i].split(">#>").length>this._pivotChart._labelCurrentTags.expandedMembers.length&&(this._pivotChart._labelCurrentTags.expandedMembers=r[i].split(">#>"));else{for(e=r[0].split(">#>").length,f=0,i=1;i<r.length;i++)if(r[i].split(">#>").length>e){f=i;break}for(this._drillInfo=r[f].split(">#>"),u=0,this._pivotChart._labelCurrentTags.expandedMembers=[],i=0;i<this._drillInfo.length;i++)t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers[u])&&(this._pivotChart._labelCurrentTags.expandedMembers[u]=[]),i+1<this._drillInfo.length?t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillInfo[i]))||t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillInfo[i+1]))||t.olap._mdxParser._splitCellInfo(this._drillInfo[i]).hierarchyUniqueName!=t.olap._mdxParser._splitCellInfo(this._drillInfo[i+1]).hierarchyUniqueName?u++:this._pivotChart._labelCurrentTags.expandedMembers[u].push(this._drillInfo[i]):(this._pivotChart._labelCurrentTags.expandedMembers[u].push(this._drillInfo[i]),this._isChartDrillAction=!0)}},_clearSorting:function(r){if(n(r.target).parent().attr("disabled")=="disabled")return!1;t.Pivot.closePreventPanel(this);pivotClientObj=this;var f=this.model.dataSource,e=this._schemaData._selectedFieldName.toLowerCase(),u=n.map(f.columns,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()==e)return n});u.length==0&&(u=n.map(f.rows,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()==e)return n}));u.length>0&&delete u[0].sortOrder;this.model.dataSource=f;this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog)").remove();this._schemaData!=null&&this._schemaData.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog)").remove();pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.refreshControl():t.olap.base.getJSONData({action:"clearSorting"},this.model.dataSource,this)},_clientChartDrillSuccess:function(t){var u=[],f,e,i,o,r;for(t.drilledMember!=""&&(u=t.drilledMember.split(">#>"),this._isChartDrillAction=!0),f=0,e=this._pivotGrid._rowCount,i=0;i<u.length;i++)o=i==u.length-1&&t.drillAction=="drilldown"?this.element.find(".e-pivotgrid .pivotGridTable th.summary[p^='"+i+"']"):this.element.find(".e-pivotgrid .pivotGridTable th.rowheader[p^='"+i+"']"),r=n.grep(o,function(t){return n(t).clone().children().remove().end().text()==u[i]}),r=n.grep(r,function(t){return parseInt(n(t).attr("p").split(",")[1])>=f&&parseInt(n(t).attr("p").split(",")[1])<=e}),i==u.length-1?n(r).find("."+(t.drillAction=="drilldown"?"expand":"collapse")).trigger("click"):(f=parseInt(n(r).attr("p").split(",")[1]),e=f+parseInt(n(r).find("span").attr("tag"))+r[0].rowSpan)},setChartDrillParams:function(i,r){var e,u,h;r=="drilldown"?this._drillParams.push(i):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(i)<0});this._drillInfo=i.split(">#>");e=0;this._pivotChart._labelCurrentTags.expandedMembers=[];var o=this._drillInfo.length-1,s=r=="drillup"&&this._drillParams.length>0&&this._drillParams[this._drillParams.length-1]!=this._drillInfo.join(">#>")&&this._drillParams[this._drillParams.length-1].split(">#>").filter(function(n){return n<o}).join(">#>")==this._drillInfo.filter(function(n){return n<o}).join(">#>"),f=s?this._drillParams[this._drillParams.length-1].split(">#>"):this._drillInfo;for(u=0;u<f.length;u++)t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers[e])&&(this._pivotChart._labelCurrentTags.expandedMembers[e]=[]),u+1<f.length||s?(!t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(f[u]))&&!t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(f[u+1]))?t.olap._mdxParser._splitCellInfo(f[u]).hierarchyUniqueName==t.olap._mdxParser._splitCellInfo(f[u+1]).hierarchyUniqueName:u==f.length-1?!0:!1)?this._pivotChart._labelCurrentTags.expandedMembers[e].push(f[u]):e++:r=="drilldown"&&(this._pivotChart._labelCurrentTags.expandedMembers[e].push(f[u]),this._isChartDrillAction=!0);h=n.grep(this._pivotChart._labelCurrentTags.expandedMembers,function(n){return n.length>0});h.length==0&&this._drillParams.length>0&&(this._getDrilledMember(r),this._pivotGrid._drillAction="drilldown")},_setChartDrillMembers:function(n){var o,h,c,e,p,i,a,r;if(this._drillInfo.length>0&&!this._pivotChart.model.enableMultiLevelLabels){var f=0,u=this._pivotChart._cloneEngine(n),s=!1;for(i=0;i<this._pivotChart._labelCurrentTags.expandedMembers.length;i++)for(r=0;r<this._pivotChart._labelCurrentTags.expandedMembers[i].length;r++)s=!0;if(s){for(h=this._drillInfo[this._drillInfo.length-1],i=0;i<this.model.dataSource.rows.length;i++)c=t.olap._mdxParser._splitCellInfo(h).hierarchyUniqueName,this.model.dataSource.rows[i].fieldName==c&&(o=i);var v=this.model.dataSource.values[0].axis=="rows"?1:0,l=this._drillInfo.length-1,y=this._pivotGrid._drillAction=="drillup"&&this._drillParams.length>0&&this._drillParams[this._drillParams.length-1].split(">#>").filter(function(n){return n<l}).join(">#>")==this._drillInfo.filter(function(n){return n<l}).join(">#>");if(y)for(i=0;i<this._drillParams[this._drillParams.length-1].split(">#>").length;i++)t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillParams[this._drillParams.length-1].split(">#>")[i]))||t.olap._mdxParser._splitCellInfo(this._drillParams[this._drillParams.length-1].split(">#>")[i]).hierarchyUniqueName==""||(e=t.olap._mdxParser._splitCellInfo(this._drillParams[this._drillParams.length-1].split(">#>")[i]).leveName,this._pivotChart._cropData(u,e,i+f,!1));else{if(u[0+f][0].ColSpan>(this._drillInfo.length+this._pivotGrid._drillAction=="drilldown"?1:0))for(i=this._drillInfo.length+(this._pivotGrid._drillAction=="drilldown"?1:0)+(this.model.dataSource.rows.length-(o+1));i+v<u[0+f][0].ColSpan;i++)u.splice(i,1),u[0][0].ColSpan--;for(i=0;i<this._drillInfo.length-(this._pivotGrid._drillAction=="drillup"?1:0);i++)t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillInfo[i]))||t.olap._mdxParser._splitCellInfo(this._drillInfo[i]).hierarchyUniqueName==""||(e=t.olap._mdxParser._splitCellInfo(this._drillInfo[i]).leveName,this._pivotChart._cropData(u,e,i+f,!1))}if(p=0,!t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers))for(i=0;i<this._pivotChart._labelCurrentTags.expandedMembers.length;i++)if(!t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers[i]))if(i>o)for(r=0;r<this._pivotChart._labelCurrentTags.expandedMembers[i].length;r++)a=this._pivotChart._labelCurrentTags.expandedMembers[i][r].split("::")[2],this._pivotChart._cropData(u,a,i+f,!0),f++;else for(r=0;r<this._pivotChart._labelCurrentTags.expandedMembers[i].length;r++)f++}this._drillInfo=[];this._pivotChart._generateData(u)}else this._pivotChart.generateJSON(this,n)},refreshPagedPivotClient:function(n,i){var r;if(pivotClientObj=this,t.isNullOrUndefined(this._waitingPopup)||(pivotClientObj._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800)),n=n.indexOf("categ")!=-1?"categorical":"series",this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)n=="categorical"?this._categCurrentPage=parseInt(i):this._seriesCurrentPage=parseInt(i),t.olap.base.getJSONData({action:"navPaging"},this.model.dataSource,this);else if(this.currentReport!=""){try{r=JSON.parse(this.currentReport)}catch(u){r=this.currentReport}this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:n+":"+i,currentReport:r,layout:t.PivotGrid.Layout.NoSummaries,customObject:null}),this.refreshPagedPivotClientSuccess)}},refreshPagedPivotClientSuccess:function(n){var r=[];n.d!=i?(r[0]=n.d[2],r[1]=n.d[1]):r=n;this.model.displaySettings.mode==t.PivotClient.DisplayMode.GridOnly?this._pivotGrid._renderControlSuccess(n):this.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartOnly?this._pivotChart.renderControlSuccess(r):(this.model.displaySettings.mode=t.PivotClient.DisplayMode.ChartAndGrid)&&(this._pivotGrid._renderControlSuccess(n),this._pivotChart.renderControlSuccess(r))},_hiddenCellInfo:function(t){var i=n.map(t,function(n){if(n.Key=="FilteredColumnHeaders")return n.Value}),r=n.map(t,function(n){if(n.Key=="FilteredRowHeaders")return n.Value});return{columnArea:i.length>0?i[0]:i,rowArea:r.length>0?r[0]:[]}},_renderControlSuccess:function(r){var c,v,nt,l,y,f,p,tt,d,g,w,u,rt,ut,b;this.model.isResponsive&&(this.model.displaySettings.enableTogglePanel=this.model.isResponsive);eventArgs={element:this.element,customObject:this.model.customObject};this._trigger("load",eventArgs);var a="",o="",s="",h="",e="";if(r[0]!=i)a=r[0].Value,o=r[1].Value,s=r[2].Value,h=r[3].Value,e=r[4].Value,this.currentReport=this._deferReport=r[5].Value,this.reports=r[6].Value,reportsCount=r[7].Value,v=n.parseJSON(r[8].Value),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r[9].Value)),this.currentCubeName=r[10].Value,r[11]!=null&&r[11]!=i&&(this.model.customObject=r[11].Value);else if(r.d!=i){if(t.isNullOrUndefined(r.d[3])||r.d[3].Value=="Pivot"){this.model.analysisMode=t.Pivot.AnalysisMode.Pivot;this._currentReportName="Default";c=this._hiddenCellInfo(r.d);r.d.length>4&&r.d[4].Value=="LoadReport"?(this._clientReportCollection=JSON.parse(r.d[5].Value),this._renderClientControls({PivotReport:r.d[0].Value,GridJSON:r.d[1].Value,ChartJSON:r.d[2].Value,FilteredColumnHeaders:c.columnArea.length>0?c.columnArea:"[]",FilteredRowHeaders:c.rowArea.length>0?c.rowArea:"[]"}),v=n.map(this._clientReportCollection,function(n){if(n.name!=i)return{name:n.name}}),nt=this.element.find(".reportlist").data("ejDropDownList"),this.element.find(".reportlist").ejDropDownList("option","dataSource",v),nt.selectItemByText(v[0].name),this._unWireEvents(),this._wireEvents()):(this.model.enableDrillThrough&&!t.isNullOrUndefined(r.d[4].Value)&&(this.dataSet=r.d[4].Value),this._clientReportCollection=[{name:"Default",report:n.parseJSON(r.d[0].Value).Report}],this._renderClientControls({PivotReport:r.d[0].Value,GridJSON:r.d[1].Value,ChartJSON:r.d[2].Value,FilteredColumnHeaders:c.columnArea.length>0?c.columnArea[0]:"[]",FilteredRowHeaders:c.rowArea.length>0?c.rowArea[0]:"[]"}));return}a=r.d[0].Value;o=r.d[1].Value;s=r.d[2].Value;h=r.d[3].Value;e=r.d[4].Value;this.currentReport=this._deferReport=r.d[5].Value;this.reports=r.d[6].Value;reportsCount=r.d[7].Value;v=n.parseJSON(r.d[8].Value);this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.d[9].Value));this.currentCubeName=r.d[10].Value;r.d[11]!=null&&r.d[11]!=i&&(this.model.customObject=r.d[11].Value)}else if(r!="")if(t.isNullOrUndefined(r.DataModel)||r.DataModel=="Olap")this.model.analysisMode=t.Pivot.AnalysisMode.Olap,a=r.Cubes,o=r.Columns,s=r.Rows,h=r.Slicers,e=r.CubeTreeInfo,this.currentReport=r.CurrentReport,this.reports=r.ClientReports,v=n.parseJSON(r.ReportList),reportsCount=r.ReportsCount,this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.MeasureGroups)),this.currentCubeName=r.CurrentCubeName,r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject);else{this.model.analysisMode=t.Pivot.AnalysisMode.Pivot;this._currentReportName=t.isNullOrUndefined(r.ReportCollection)?"Default":JSON.parse(r.ReportCollection)[0].name;this._clientReportCollection=t.isNullOrUndefined(r.ReportCollection)?[{name:"Default",report:n.parseJSON(r.PivotReport).Report}]:JSON.parse(r.ReportCollection);this._renderClientControls(r);return}this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"initialize",element:this.element,customObject:this.model.customObject});l=null;r!=""&&(l=n.parseJSON(e));y=t.buildTag("div.reportToolbar#reportToolbar",this._reportToolbar(),{width:"410px",height:"29px"})[0].outerHTML;this.model.enableSplitter?this.model.isResponsive?(f=this._createCubeSelector()+t.buildTag("table.cubeTable",t.buildTag("tbody",t.buildTag("tr.splitresponsive",t.buildTag("td.cubeTableTD",this._createCubeBrowser(e)).attr({valign:"bottom"}).css("width","50%")[0].outerHTML+t.buildTag("td.cubeTableTD",this._createAxisElementBuilder(o,s,h)).attr({valign:"bottom"}).css("width","50%")[0].outerHTML).css("width","100%")[0].outerHTML)[0].outerHTML)[0].outerHTML,p=t.buildTag("span.outerPanel","").append((n.trim(this.model.title)!=""?t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML:"")+y+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",f)[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%"})[0].outerHTML)):this.model.enableRTL?this.model.enableVirtualScrolling?(f=this._createCubeSelector()+"<table class=cubeTable style='width:100%'><tr class='childsplit' style='width:98%'><td class=axisBuilderTD valign=\"bottom\" style='width:47%'>"+this._createAxisElementBuilder(o,s,h)+"<\/td><td class=cdbTD valign=\"bottom\" style='width:47%;'>"+this._createCubeBrowser(e)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td style='width:49%'>"+f+"<\/td><td class=\"controlPanelTD\" style='width:49%;'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):(f=this._createCubeSelector()+"<table class=cubeTable style='width:98%'><tr class='childsplit'><td class=axisBuilderTD valign=\"bottom\" style='"+(this.model.enableRTL?"padding-right:0px;":"padding-left:"+this.model.enableSplitter?"0px":"5px")+"'>"+this._createAxisElementBuilder(o,s,h)+'<\/td><td class=cdbTD valign="bottom"\'>'+this._createCubeBrowser(e)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit'><td class=\"controlPanelTD\">"+this._controlPanel()+"<\/td><td>"+f+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):(f=this._createCubeSelector()+"<table class=cubeTable style='width:100%'><tr class='childsplit' style='width:98%'><td class=cdbTD valign=\"bottom\" style='width:47%;'>"+this._createCubeBrowser(e)+'<\/td><td class=axisBuilderTD valign="bottom" style=\''+(this.model.enableRTL?"padding-right:5px;":"padding-left:"+this.model.enableSplitter?"0px":"5px")+"width:47%'>"+this._createAxisElementBuilder(o,s,h)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td style='width:49%'>"+f+"<\/td><td class=\"controlPanelTD\" style='width:49%'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):this.model.isResponsive?this.model.isResponsive&&(f=this._createCubeSelector()+t.buildTag("table.cubeTable",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td.cubeTableTD",this._createCubeBrowser(e)).attr({valign:"bottom",width:"50%",height:"100%"}).css({"table-layout":"fixed",display:"initial"})[0].outerHTML+t.buildTag("td.cubeTableTD",this._createAxisElementBuilder(o,s,h)).attr({valign:"bottom",width:"50%",height:"100%"})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,p=t.buildTag("span.outerPanel","").append((n.trim(this.model.title)!=""?t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML:"")+y+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",f)[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%","table-layout":"fixed"})[0].outerHTML)):(f=this._createCubeSelector()+"<table class=cubeTable><tr><td class=cdbTD valign=\"bottom\" style='display:block'>"+this._createCubeBrowser(e)+'<\/td><td class=axisBuilderTD valign="bottom" style=\''+(this.model.enableRTL?"padding-right:5px;":"padding-left:5px;")+"'>"+this._createAxisElementBuilder(o,s,h)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+'<table class="outerTable"><tr><td>'+f+"<\/td><td class=\"controlPanelTD\" style='display:block'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>"));this.element.html(p);this.element.find(".reportToolbar").ejToolbar({enableRTL:this.model.enableRTL,height:"35px"});this._calculateSize();this.model.enableRTL&&this.element.addClass("e-rtl");(this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.defaultView()==t.PivotClient.DefaultView.Grid||this.displayMode()==t.PivotClient.DisplayMode.GridOnly)&&this.element.find(".chartTypesImg").addClass("chartTypesOnGridView");tt="<div class ='reportList' ><input type='text' id='reportList' class='reportlist' title='"+this._getLocalizedLabels("ReportList")+"'/><\/div>";this.model.enableMeasureGroups&&this._createMeasureGroup();n(this.element).find(".reportCol").append(tt);this.element.find(".reportlist").ejDropDownList({dataSource:v,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"26px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});this.element.find(".reportlist").attr("tabindex",0);var k=this.element.find(".csHeader").width()-this.element.find(".cubeText").width()-(this.element.find(".toggleExpandButton").length>0?this.element.find(".toggleExpandButton").width():0)-(this.model.analysisMode=="olap"&&this.model.operationalMode=="servermode"||this.model.enableSplitter?20:50),it=this.enableTogglePanel()?k-25:k,ft=a==""?"":n.parseJSON(a);for(this.element.find(".cubeSelector").ejDropDownList({dataSource:ft,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},width:this.model.enableSplitter&&!this.model.isResponsive?"100%":""+it+"px"}),ddlTarget=this.element.find(".cubeSelector").data("ejDropDownList"),reportDropTarget=this.element.find("#reportList").data("ejDropDownList"),r==""||t.isNullOrUndefined(ddlTarget)||(ddlTarget.selectItemByText(this.currentCubeName),reportDropTarget.model.dataSource.length&&reportDropTarget.selectItemByText(reportDropTarget.model.dataSource[0].name),this._selectedReport=reportDropTarget.currentValue),this.element.find(".cubeSelector").ejDropDownList("option","change",t.proxy(this._cubeChanged,this)),this.element.find(".cubeSelector").attr("tabindex",0),this.element.find(".reportlist").ejDropDownList("option","change",t.proxy(this.reportChanged,this)),this.model.enableMeasureGroups&&this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this)),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:l},allowDragAndDrop:!0,enableRTL:this.model.enableRTL,allowDropChild:!1,allowDropSibling:!1,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",nodeDropped:t.proxy(this._nodeDropped,this)}),this.element.find(".cubeTreeView").attr("tabindex",0),d=this.element.find(".cubeTreeView").find("li"),u=0;u<d.length;u++)d[u].setAttribute("tag",l[u].tag);for(g=this.element.find(".cubeTreeView .folderCDB"),u=0;u<g.length;u++)n(g[u].parentElement).removeClass("e-draggable");if(this.element.find(".cubeTreeView .calcMemberGroupCDB").length>0&&(this.element.find(".cubeTreeView .calcMemberGroupCDB").parent().removeClass("e-draggable"),w=this.element.find(".cubeTreeView .calcMemberCDB").parents("li").find("li"),w.length>0))for(u=0;u<w.length;u++)this._calcMembers.push(l[u+1]),w[u].setAttribute("expression",l[u+1].expression),w[u].setAttribute("formatString",l[u+1].formatString),w[u].setAttribute("nodeType",l[u+1].nodeType);if(this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView"),rt=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 0px"})[0].outerHTML,ut=t.buildTag("div.cubeName",this.currentCubeName+rt),n(this.element).find(".cubeBrowser").prepend(ut),this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").ejDroppable({drop:t.proxy(this._onDropped,this)}),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button}),this.enableTogglePanel()&&(n(t.buildTag("div.toggleExpandButton e-icon",t.buildTag("p#toggleexpand","toggle expanded",{display:"none"})[0].outerHTML).attr("aria-describedby","toggleexpand")[0].outerHTML).appendTo(this.element.find(".csHeader")),n(this.element.find(".outerTable").find("td")[0]).append(t.buildTag("div.toggleCollapseButton e-icon",t.buildTag("p#togglecollapse","toggle collapsed",{display:"none"})[0].outerHTML).attr("aria-describedby","togglecollapse")[0].outerHTML),n(t.buildTag("div.toggleText")[0].outerHTML).insertAfter(this.element.find(".toggleCollapseButton")),this.element.find(".toggleCollapseButton").hide(),this.element.find(".toggleText").hide()),this._overflow(),this._setSplitBtnTitle(),this.element.find("#clientTab").ejTab({enableRTL:this.model.enableRTL,itemActive:t.proxy(this._onTabClick,this)}),this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){if(this.defaultView()==t.PivotClient.DefaultView.Chart?(this.element.find("#"+this._id+"_PivotChart").ejPivotChart({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),showTooltip:!0,size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:this.model.chartLoad,drillSuccess:t.proxy(this._chartDrillSuccess,this)}),this.gridLayout()!=t.PivotGrid.Layout.Normal?this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,layout:this.gridLayout(),locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}):this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)})):(this.gridLayout()!=t.PivotGrid.Layout.Normal?this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,locale:this.locale(),layout:this.gridLayout(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}):this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}),this.element.find("#"+this._id+"_PivotChart").ejPivotChart({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),showTooltip:!0,size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}},drillSuccess:t.proxy(this._chartDrillSuccess,this),beforeServiceInvoke:this.model.chartLoad})),this.model.enablePaging&&(this.element.find("#"+this._id+"_Pager").ejPivotPager({mode:t.PivotPager.Mode.Both,targetControlID:this._id}),this.element.find(".controlPanel").height(this.element.find(".controlPanel").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".gridContainer").height(this.element.find(".gridContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".chartContainer").height(this.element.find(".chartContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+10))),this.displayMode()!="chartonly"&&(this._pivotGrid=this.element.find("#"+this._id+"_PivotGrid").data("ejPivotGrid")),this.displayMode()!="gridOnly"&&(this._pivotChart=this.element.find("#"+this._id+"_PivotChart").data("ejPivotChart")),b={},this._pivotChart!=null&&(this.element.find("#"+this._id+"_PivotChart").width(this._pivotChart.model.size.width),b.chartModelWidth=this._pivotChart.model.size.width),b.controlPanelWidth=this.element.find(".controlPanel").width(),b.chartOuterWidth=this._chartWidth,b.gridOuterWidth=this._gridWidth,this._initStyles.push(b),this._wireEvents(),this.model.isResponsive&&(this._enableResponsive(),this._parentElwidth=n("#"+this._id).parent().width(),this._parentElwidth<850?this._rwdToggleCollapse():this._parentElwidth>850&&this._rwdToggleExpand()),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){var k=this.element.find(".csHeader").width()-this.element.find(".cubeText").width()-this.element.find(".toggleExpandButton").width()-(this.model.enableSplitter?50:20),it=this.enableTogglePanel()?k-25:k,ft=a==""?"":n.parseJSON(a);this.element.find(".cubeSelector").ejDropDownList({width:this.model.enableSplitter&&!this.model.isResponsive?"100%":""+it+"px"})}this._trigger("renderSuccess",this);this._successAction="ClientRender";this.progressPos=n("#"+this._id).position();this._treeContextMenu();this._buttonContextMenu();this.model.analysisMode=="olap"&&this.model.operationalMode=="servermode"&&this.model.enableSplitter&&this._createSplitter();t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this);this.model.showUniqueNameOnPivotButton&&(n(".pvtBtn").addClass("splitBtnUnique"),n(".removeSplitBtn").addClass("removeBtnUnqiue"))}},_contextOpen:function(i){t.Pivot.openPreventPanel(this);var r=n("#pivotTree").data("ejMenu");this._selectedMember=n(i.target);r.enableItem(this._getLocalizedLabels("AddToColumn"));r.enableItem(this._getLocalizedLabels("AddToRow"));r.enableItem(this._getLocalizedLabels("AddToSlicer"))},_contextClick:function(n){var i,r,u,f;if(t.Pivot.closePreventPanel(this),i=n.events.text,r="",pivotClientObj=this,i=i==this._getLocalizedLabels("AddToSlicer")?"Slicer":i==this._getLocalizedLabels("AddToColumn")?"Categorical":i==this._getLocalizedLabels("AddToRow")?"Series":"",i=="Slicer"&&this._selectedMember!=null&&this._selectedMember.parent().attr("tag").indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);f=this.currentCubeName+"--"+this._selectedMember.parent().attr("tag")+"--"+i+"--"+r;this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:f,olapReport:this.currentReport,clientReports:this.reports,customObject:u}),this._nodeDroppedSuccess)},_onContextOpen:function(i){if(n(i.target).find(".folderCDB").length>0||n(i.target).find(".calcMemberGroupCDB").length>0)return!1;t.Pivot.openPreventPanel(this);var r=n("#pivotTreeContext").data("ejMenu");this._selectedMember=n(i.target);r.enableItem(this._getLocalizedLabels("AddToColumn"));r.enableItem(this._getLocalizedLabels("AddToRow"));n(i.target).find(".calcMemberCDB").length>0?r.showItems(["#Remove"]):r.hideItems(["#Remove"]);n(i.target.parentElement).find(".namedSetCDB").length>0?r.disableItem(this._getLocalizedLabels("AddToSlicer")):r.enableItem(this._getLocalizedLabels("AddToSlicer"))},_onTreeContextClick:function(i){var r,o,e,u,f;if(t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","-1").focus().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().addClass("hoverCell"),delete this._fieldMembers[this._dialogTitle],delete this._fieldSelectedMembers[this._dialogTitle],t.Pivot.closePreventPanel(this),r=i.events.text,o="",pivotClientObj=this,pivotClientObj._isTimeOut=!0,r==this._getLocalizedLabels("Remove"))setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800),e=this.element.find(".splitBtn"),jQuery.each(e,function(t,i){n(e[t]).attr("tag").split(":")[1]==pivotClientObj._selectedMember.parent().parent().attr("tag").replace(/\[/g,"").replace(/\]/g,"")&&n(i).remove()}),pivotClientObj._cubeTreeView.model.beforeDelete=null,pivotClientObj._cubeTreeView.removeNode(pivotClientObj._selectedMember.parent().parent().attr("id")),pivotClientObj._cubeTreeView.model.beforeDelete=function(){return!1},t.isNullOrUndefined(pivotClientObj._calcMemberTreeObj)||pivotClientObj._calcMemberTreeObj.removeNode(pivotClientObj._selectedMember.parent().parent().attr("id")),pivotClientObj.element.find(".cubeTreeView .calcMemberCDB").length==0&&pivotClientObj.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li").length>0&&(pivotClientObj._cubeTreeView.model.beforeDelete=null,pivotClientObj._cubeTreeView.removeNode(pivotClientObj.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li").attr("id")),pivotClientObj._cubeTreeView.model.beforeDelete=function(){return!1}),pivotClientObj.element.find(".cubeTreeViewCalcMember .calcMemberCDB").length==0&&pivotClientObj.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li").length>0&&pivotClientObj._calcMemberTreeObj.removeNode(pivotClientObj.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li").attr("id")),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"removeCalculatedMember",element:this.element,customObject:this.model.customObject}),u=JSON.stringify(this.model.customObject),f=this._selectedMember.parent().parent().attr("tag"),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeSplitButton,JSON.stringify({action:"removeCalculatedMember",clientParams:f,olapReport:pivotClientObj.currentReport,clientReports:pivotClientObj.reports,customObject:u}),pivotClientObj._removeSplitButtonSuccess);else{if(r=r==pivotClientObj._getLocalizedLabels("AddToSlicer")?"Slicer":r==pivotClientObj._getLocalizedLabels("AddToColumn")?"Categorical":r==pivotClientObj._getLocalizedLabels("AddToRow")?"Series":"",r=="Slicer"&&this._selectedMember.parent().parent().attr("tag")!=null&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1||r=="Slicer"&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this._selectedMember.parent().parent().find(".calcMemberCDB").length>0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1&&this._selectedMember.parent().parent().attr("tag").replace(/\[/g,"").replace(/\]/g,"")!=this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").attr("tag").split(":")[1].split("::")[0]||r=="Slicer"&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this._selectedMember.parent().parent().find(".calcMemberCDB").length==0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1||r=="Slicer"&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this._selectedMember.parent().parent().find(".calcMemberCDB").length==1&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==0&&this.element.find(".splitBtn[tag*=Measure]").length==1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);f=pivotClientObj.currentCubeName+"--"+this._selectedMember.parent().parent().attr("tag")+"--"+r+"--"+o;pivotClientObj.doAjaxPost("POST",pivotClientObj.model.url+"/"+pivotClientObj.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:f,olapReport:pivotClientObj.currentReport,clientReports:pivotClientObj.reports,customObject:u}),pivotClientObj._nodeDroppedSuccess)}},_toggleAxisSuccess:function(r){var u,f,e,o;this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.isNullOrUndefined(r.d)?this.setOlapReport(r.PivotReport):this.setOlapReport(n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value),this.refreshControl(r)):(r[0]!=i?(u=r[0].Value,f=r[1].Value,e=r[2].Value,this.currentReport=r[3].Value,this.reports=r[4].Value):r.d!=i?(u=r.d[0].Value,f=r.d[1].Value,e=r.d[2].Value,this.currentReport=r.d[3].Value,this.reports=r.d[4].Value):(u=r.Columns,f=r.Rows,e=r.Slicers,this.currentReport=r.CurrentReport,this.reports=r.ClientReports),this.model.OperationalMode==t.Pivot.AnalysisMode.ServerMode&&(this.element.find(".cubeTable").find(".categoricalAxis").parent().html("").html(this._createAxisElementBuilder(u,f,e)),this.element.find(".cubeTable").height(this.element.height()-((this.element.find("div.titleText").length>0?this.element.find("div.titleText").height():0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38)),this.element.find(".cdbTD, .cubeTableTD").height(this.element.find(".cubeTable").height()),o=this.element.find(".cdbTD, .cubeTableTD").height()-(this.element.find(".axisHeader").height()*3+7),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").height(o/3)),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button}),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").addClass("e-droppable"),this._renderControls(),this._setSplitBtnTitle(),this._unWireEvents(),this._wireEvents(),this._trigger("renderSuccess",this),this._buttonContextMenu())},_measureGroupChangedSuccess:function(r){var f,r,e,o,u;for(r[0]!=i&&(f=r[0].Value),f=r.d!=i?r.d[0].Value:r.CubeTreeInfo,this.element.find(".e-treeview, .cubeTreeView").remove(),r=t.buildTag("div#cubeTreeView.cubeTreeView")[0].outerHTML,this.element.find(".cubeBrowser").append(r),e=n.parseJSON(f),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:e},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:this.model.enableRTL,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},nodeDropped:t.proxy(this._nodeDropped,this),beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:"464px"}),o=this.element.find(".cubeTreeView").find("li"),u=0;u<o.length;u++)o[u].setAttribute("tag",e[u].tag);this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-this.element.find(".cubeName").height()-(7+(this.model.enableMeasureGroups?this.element.find(".measureGroupselector").height()+13:0)));this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView");this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="MeasureGroupChange"},_cubeChangedSuccess:function(r){var f,e,o,s,u;r[0]!=i?(this.currentReport=r[0].Value,f=r[1].Value,this.reports=r[2].Value,reportsCount=r[3].Value,reportList=n.parseJSON(r[4].Value),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r[5].Value)),e=n.parseJSON(r[6].Value),r[7]!=null&&r[7]!=i&&(this.model.customObject=r[7].Value)):r.d!=i?(this.currentReport=r.d[0].Value,f=r.d[1].Value,this.reports=r.d[2].Value,reportsCount=r.d[3].Value,reportList=n.parseJSON(r.d[4].Value),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.d[5].Value)),e=n.parseJSON(r.d[6].Value),r.d[7]!=null&&r.d[7]!=i&&(this.model.customObject=r.d[7].Value)):(this.currentReport=r.NewReport,f=r.CubeTreeInfo,this.reports=r.ClientReports,reportsCount=r.ReportsCount,reportList=n.parseJSON(r.ReportList),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.MeasureGroups)),e=n.parseJSON(r.ControlSettings),r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject));this.model.chartType=e.ChartType.toLowerCase();this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"cubeChanged",element:this.element,customObject:this.model.customObject});this.model.enableDeferUpdate?this.element.find(".splitBtn, .e-treeview, .cubeTreeView, .cubeName, .searchDiv").remove():this.element.find(".splitBtn, .e-pivotgrid, .e-pivotchart, .e-treeview, .cubeTreeView, .cubeName, .searchDiv").remove();var h=t.buildTag("div#cubeTreeView.cubeTreeView")[0].outerHTML,c=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 5px"})[0].outerHTML,l=t.buildTag("div.cubeName",this.currentCubeName+c)[0].outerHTML;for(this.model.enableMeasureGroups&&this._createMeasureGroup(),o=n.parseJSON(f),n(h).appendTo(".cubeBrowser"),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:o},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:this.model.enableRTL,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},nodeDropped:t.proxy(this._nodeDropped,this),beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:this.model.enableMeasureGroups?"464px":""}),s=this.element.find(".cubeTreeView").find("li"),u=0;u<s.length;u++)s[u].setAttribute("tag",o[u].tag);this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView");this.element.find(".reportlist").ejDropDownList("option","change","");this.element.find(".reportlist").ejDropDownList("option","dataSource",reportList);this.element.find(".reportlist").ejDropDownList("option","value",reportList[0].name);n(this.element).find(".cubeBrowser").prepend(l);this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)});this.element.find(".cubeTable").height(this.element.height()-(this.element.find("div.titleText").height()+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38));this.element.find(".cdbTD, .cubeTableTD").height(this.element.find(".cubeTable").height());this.element.find(".cubeBrowser").height(this.element.find(".cdbTD, .cubeTableTD").height()-this.element.find(".cdbHeader").height());this._renderControls();this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="CubeChange";this._trigger("renderSuccess",this);this._treeContextMenu();this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-this.element.find(".cubeName").height()-(7+(this.model.enableMeasureGroups?this.element.find(".measureGroupselector").height()+13:0)))},_createMeasureGroup:function(){this.element.find(".measureGroupselector").remove();n(this.element).find(".cubeBrowser").prepend("<div class ='measureGroupselector' style='margin:5px 5px 0px 5px'><input type='text' id='measureGroupSelector' class='measureGroupSelector' /><\/div>");this.element.find(".measureGroupSelector").ejDropDownList({dataSource:this.measureGroupInfo,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"25px",width:"100%",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});this.element.find(".measureGroupSelector").attr("tabindex",0);measureDropTarget=this.element.find(".measureGroupSelector").data("ejDropDownList");measureDropTarget.selectItemByText(measureDropTarget.model.dataSource[0].name);this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this))},_treeContextMenu:function(){var i=t.buildTag("ul.pivotTreeContext#pivotTreeContext",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToSlicer"))[0].outerHTML)[0].outerHTML+t.buildTag("li#Remove",t.buildTag("a",this._getLocalizedLabels("Remove"))[0].outerHTML)[0].outerHTML)[0].outerHTML;n(this.element).append(i);n("#pivotTreeContext").ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:this.element.find(".cubeTreeView")[0],click:t.proxy(this._onTreeContextClick,this),beforeOpen:t.proxy(this._onContextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)})},_removeSplitButtonSuccess:function(n){n[0]!=i?(this.currentReport=n[0].Value,this.reports=n[1].Value,n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value)):n.d!=i?(this.currentReport=n.d[0].Value,this.reports=n.d[1].Value,n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value)):(this.currentReport=n.UpdatedReport,this.reports=n.ClientReports,n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject));this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"removeSplitButton",element:this.element,customObject:this.model.customObject});this._renderControls();this._unWireEvents();this._wireEvents();this._successAction="ButtonRemove";this._trigger("renderSuccess",this)},_chartTypeChangedSuccess:function(n){n[0]!=i?(this.currentReport=n[0].Value,this.reports=n[1].Value):n.d!=i?(this.currentReport=n.d[0].Value,this.reports=n.d[1].Value):(this.currentReport=n.CurrentReport,this.reports=n.ClientReports)},_mdxQuery:function(n){this.element.find(".e-dialog").hide();this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();n.d!=i?this._createDialog("mdx",n.d,""):this._createDialog("mdx",n,"")},_refreshReportList:function(){var t=n.map(this._clientReportCollection,function(n){if(n.reportName!=i)return{name:n.reportName}}),r=this.element.find(".reportlist").data("ejDropDownList");this.element.find(".reportlist").ejDropDownList("option","dataSource",t);r.selectItemByText(this.model.dataSource.reportName);this._unWireEvents();this._wireEvents()},_clientToolbarOperationSuccess:function(n){var t="",i;n!=null&&(i="",n&&n.d?(t=n.d[0].Value,t.indexOf(":>>:")>-1&&(this._currentReportItems=JSON.parse(t.split(":>>:")[1]),t=t.split(":>>:")[0]),i=JSON.parse(t)):n&&n.report&&(t=n.report,t.indexOf(":>>:")>-1&&(this._currentReportItems=JSON.parse(t.split(":>>:")[1]),t=t.split(":>>:")[0]),i=JSON.parse(t)),this.model.dataSource=i[0],this._clientReportCollection=i,this.model.dataSource?(this.refreshControl(this.model.dataSource),this._refreshReportList()):this._waitingPopup&&(this._isTimeOut=!1,this._waitingPopup.hide()))},_toolbarOperationSuccess:function(r){var o,s,h,u,a,p,v,y,e,w,d,b,l,f,g,nt,c,k;if(r!=null&&(r.d!=i&&r.d||r[0]!=i&&r[0]||r.CurrentReport||r.PivotReport)){if(r.length>1&&r[0]!=i)this.currentReport=r[0].Value,this.reports=r[1].Value,reportsCount=r[2].Value,o=r[3].Value,s=r[4].Value,h=r[5].Value,u=r[6].Value,e=n.parseJSON(r[7].Value),a=r[8].Value,p=n.parseJSON(r[9].Value),cubeTreeInfo=r[10].Value,v=r[11].Value,this.model.enableMeasureGroups&&r[12]!=null&&r[12]!=i&&(this.measureGroupInfo=r[12].Value),r[13]!=null&&r[13]!=i&&(this.model.customObject=r[13].Value);else if(r.d!=i){if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){u=n.grep(r.d,function(n){return n.Key=="CurrentAction"})[0].Value;this.setOlapReport(n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value);this.currentReport=n.parseJSON(this.getOlapReport()).Report;o=n.parseJSON(this.getOlapReport()).PivotColumns;s=n.parseJSON(this.getOlapReport()).PivotRows;h=n.parseJSON(this.getOlapReport()).Filters;u=="NewReport"?(this._clientReportCollection=[{name:this._currentReportName,report:this.currentReport}],this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value})):u=="AddReport"?(this._clientReportCollection.push({name:this._currentReportName,report:this.currentReport}),this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value})):(u=="RemoveReport"||u=="ChangeReport")&&(y=this._hiddenCellInfo(r.d),this.refreshControl({GridJSON:n.grep(r.d,function(n){return n.Key=="GridJSON"})[0].Value,ChartJSON:n.grep(r.d,function(n){return n.Key=="ChartJSON"})[0].Value,PivotReport:n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value,FilteredColumnHeaders:y.columnArea.length>0?y.columnArea:"[]",FilteredRowHeaders:y.rowArea.length>0?y.rowArea:"[]"}));e=n.map(this._clientReportCollection,function(n){return{name:n.name}});this.element.find(".reportlist").ejDropDownList("option","dataSource",e);w=this.element.find(".reportlist").data("ejDropDownList");this._isReportListAction=!1;w.selectItemByText(this._currentReportName);this._isReportListAction=!0;return}this.currentReport=r.d[0].Value;this.reports=r.d[1].Value;reportsCount=r.d[2].Value;o=r.d[3].Value;s=r.d[4].Value;h=r.d[5].Value;u=r.d[6].Value;e=n.parseJSON(r.d[7].Value);a=r.d[8].Value;p=n.parseJSON(r.d[9].Value);cubeTreeInfo=r.d[10].Value;v=r.d[11].Value;this.model.enableMeasureGroups&&r.d[12]!=null&&r.d[12]!=i&&(this.measureGroupInfo=r.d[12].Value);r.d[13]!=null&&r.d[13]!=i&&(this.model.customObject=r.d[13].Value)}else{if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){u=r.CurrentAction;this.setOlapReport(r.PivotReport);this.currentReport=n.parseJSON(this.getOlapReport()).Report;o=n.parseJSON(this.getOlapReport()).PivotColumns;s=n.parseJSON(this.getOlapReport()).PivotRows;h=n.parseJSON(this.getOlapReport()).Filters;u=="NewReport"?(this._clientReportCollection=[{name:this._currentReportName,report:this.currentReport}],this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:r.PivotReport})):u=="AddReport"?(this._clientReportCollection.push({name:this._currentReportName,report:this.currentReport}),this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:r.PivotReport})):(u=="RemoveReport"||u=="ChangeReport")&&this.refreshControl({GridJSON:r.GridJSON,ChartJSON:r.ChartJSON,PivotReport:r.PivotReport,FilteredColumnHeaders:t.isNullOrUndefined(r.FilteredColumnHeaders)?"[]":r.FilteredColumnHeaders,FilteredRowHeaders:t.isNullOrUndefined(r.FilteredRowHeaders)?"[]":r.FilteredRowHeaders});e=n.map(this._clientReportCollection,function(n){return{name:n.name}});this.element.find(".reportlist").ejDropDownList("option","dataSource",e);w=this.element.find(".reportlist").data("ejDropDownList");this._isReportListAction=!1;w.selectItemByText(this._currentReportName);this._isReportListAction=!0;return}this.currentReport=r.CurrentReport;this.reports=r.Reports;reportsCount=r.ReportsCount;o=r.Columns;s=r.Rows;h=r.Slicers;u=r.CurrentAction;e=n.parseJSON(r.ReportList);a=r.RenamedReport;p=n.parseJSON(r.ControlSettings);cubeTreeInfo=r.CubeTreeInfo;v=r.CubeSelector;this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.MeasureGroups));r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.chartType=p.ChartType.toLowerCase()),this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:this.model.customObject}),u!="Report Change"){if(this.element.find(".reportlist").ejDropDownList("option","change",""),this.element.find(".reportlist").ejDropDownList("option","dataSource",e),u=="Load Report"){for(ddlTarget._initValue=!0,ddlTarget.selectItemByText(v),ddlTarget._initValue=!1,reportDropTarget.selectItemByText(reportDropTarget.model.dataSource[0].name),this._selectedReport=reportDropTarget.currentValue,this.element.find(".searchDiv").remove(),d=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 0px"})[0].outerHTML,n(".cubeName").html(v+d),this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),c=n.parseJSON(cubeTreeInfo),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:c},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:this.model.enableRTL,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},nodeDropped:t.proxy(this._nodeDropped,this),beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:this.model.enableMeasureGroups?"464px":"495px"}),b=this.element.find(".cubeTreeView").find("li"),f=0;f<b.length;f++)b[f].setAttribute("tag",c[f].tag);for(l=this.element.find(".cubeTreeView .folderCDB"),f=0;f<l.length;f++)n(l[f].parentElement).removeClass("e-draggable");for(l=this.element.find(".cubeTreeViewCalcMember .folderCDB"),f=0;f<l.length;f++)n(l[f].parentElement).removeClass("e-draggable");this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView");this.model.isResponsive?this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(56+(this.model.enableMeasureGroups?35:0))):this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(61+(this.model.enableMeasureGroups?30:0)))}else u!="Rename Report"?(this._isReportListAction=!1,reportDropTarget.selectItemByText(reportDropTarget.model.dataSource[e.length-1].name),this._isReportListAction=!0,this._selectedReport=reportDropTarget.currentValue):(this._excelFilterInfo.length>0&&(g=this.element.find(".cubeSelector").data("ejDropDownList").model.value,nt=this.element.find("#reportList").data("ejDropDownList").model.value,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){return n.cubeName==g&&n.report==reportDropTarget.model.itemValue&&(n.report=a),n})),this._isReportListAction=!1,reportDropTarget.selectItemByText(a),this._isReportListAction=!0,this._selectedReport=reportDropTarget.currentValue);this.element.find(".reportlist").ejDropDownList("option","change",t.proxy(this._reportChanged,this))}u!="Rename Report"&&(this.model.enableDeferUpdate?this.element.find(".splitBtn").remove():this.element.find(".splitBtn, .e-pivotgrid, .e-pivotchart").remove());(u=="Add Report"||u=="New Report"||u=="Remove Report"||u=="Report Change"||u=="Load Report"||u=="SortOrFilter"||u=="Save Report")&&(c=n.parseJSON(cubeTreeInfo),k=t.DataManager(c).executeLocal(t.Query().where("spriteCssClass","contains","calcMemberGroupCDB")),this._cubeTreeView.model.beforeDelete=null,this._cubeTreeView.removeNode(this.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li")),this._cubeTreeView.model.beforeDelete=function(){return!1},t.isNullOrUndefined(this._calcMemberTreeObj)||this._calcMemberTreeObj.removeNode(this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li")),k.length>0&&!t.isNullOrUndefined(this._cubeTreeView)&&(this._calcMembers=[],this._calcMembers.push(k),n.merge(this._calcMembers,t.DataManager(c).executeLocal(t.Query().where("spriteCssClass","contains","calcMemberCDB"))),this._calcMemberTreeViewUpdate()));(u=="Remove Report"||u=="Report Change"||u=="Load Report"||u=="SortOrFilter"||u=="Save Report")&&(n(this._createSplitButtons(o,"Columns")).appendTo(".categoricalAxis"),n(this._createSplitButtons(s,"Rows")).appendTo(".rowAxis"),n(this._createSplitButtons(h,"Slicers")).appendTo(".slicerAxis"),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button}),this._renderControls());(u=="Add Report"||u=="New Report")&&this._renderControls()}this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(this._treeContextMenu(),this._buttonContextMenu());this.model.showUniqueNameOnPivotButton&&(n(".pvtBtn").addClass("splitBtnUnique"),n(".removeSplitBtn").addClass("removeBtnUnqiue"));this._setSplitBtnTitle();this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="ToolbarOperation";this._trigger("renderSuccess",this)},_calcMemberTreeViewUpdate:function(){var i,r,n;if(this._cubeTreeView.model.beforeDelete=null,this._cubeTreeView.removeNode(this.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li")),this._cubeTreeView.model.beforeDelete=function(){return!1},t.isNullOrUndefined(this._calcMemberTreeObj)||this._calcMemberTreeObj.removeNode(this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li")),this.element.find(".cubeTreeView").find("li").first().length>0?(this._cubeTreeView.insertBefore(this._calcMembers[0],this.element.find(".cubeTreeView").find("li").first()),this._cubeTreeView.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id),this.element.find(".cubeTreeView").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._cubeTreeView.collapseNode(this._calcMembers[0].id)):this._calcMembers.length>0&&(this._cubeTreeView.addNodes(this._calcMembers[0]),this.element.find(".cubeTreeView").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._cubeTreeView.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id)),!t.isNullOrUndefined(this._calcMemberTreeObj)&&this.element.find(".cubeTreeViewCalcMember").find("li").first().length>0?(this._calcMemberTreeObj.insertBefore(this._calcMembers[0],this.element.find(".cubeTreeViewCalcMember").find("li").first()),this._calcMemberTreeObj.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id),this.element.find(".cubeTreeViewCalcMember").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._calcMemberTreeObj.collapseNode(this._calcMembers[0].id)):!t.isNullOrUndefined(this._calcMemberTreeObj)&&this._calcMembers.length>0&&(this._calcMemberTreeObj.addNodes(this._calcMembers[0]),this.element.find(".cubeTreeViewCalcMember").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._calcMemberTreeObj.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id)),this.element.find(".cubeTreeView .calcMemberGroupCDB").length>0&&(this.element.find(".cubeTreeView .calcMemberGroupCDB").parent().removeClass("e-draggable"),this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parent().removeClass("e-draggable"),i=this.element.find(".cubeTreeView .calcMemberCDB").parents("li").find("li"),r=this.element.find(".cubeTreeViewCalcMember .calcMemberCDB").parents("li").find("li"),i.length>0))for(n=0;n<i.length;n++)i[n].setAttribute("tag",this._calcMembers[n+1].tag),i[n].setAttribute("expression",this._calcMembers[n+1].expression),i[n].setAttribute("formatString",this._calcMembers[n+1].formatString),i[n].setAttribute("nodeType",this._calcMembers[n+1].nodeType),r.length>0&&(r[n].setAttribute("tag",this._calcMembers[n+1].tag),r[n].setAttribute("expression",this._calcMembers[n+1].expression),r[n].setAttribute("formatString",this._calcMembers[n+1].formatString),r[n].setAttribute("nodeType",this._calcMembers[n+1].nodeType))},_fetchChildNodeSuccess:function(r){var u,f,e;u=r.length>1&&r[0]!=i?JSON.parse(r[0].Value):r.d!=i?JSON.parse(r.d[0].Value):JSON.parse(r.ChildNodes);r[0]!=i?r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value):r.d!=i?r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value):r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});e={id:"id",parentId:"pid",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus"};f=n(this.pNode).parents("li").length>1?n(this.pNode).parents("li").first():n(this.pNode).parents("li");n(n(f).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});u.length>0&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.enableMemberEditorPaging&&!t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",u[0].pid)).length>0&&n.merge(this._editorTreeData,u);this.element.find(".nodeExpand").remove();this._memberTreeObj.addNode(u,f);n.each(n(f).children().find("li"),function(n,t){t.setAttribute("tag",u[n].tag)});this._successAction="FetchChildNode";this._trigger("renderSuccess",this);this.element.find(".e-dialog #preventDiv").remove()},_createCubeSelector:function(){return t.buildTag("div.csHeader",t.buildTag("span.cubeText",this._getLocalizedLabels("CubeSelector"),{"padding-left":"6px",float:"left","margin-bottom":"10px",width:this.model.enableSplitter&&!this.model.isResponsive?"25%":"","text-overflow":"ellipsis"})[0].outerHTML+t.buildTag("div.cubeSelect","<input type='text' id='cubeSelector' class ='cubeSelector' />",{display:"inline",float:"left","padding-left":"5px",position:"relative",top:"-3px",width:this.model.enableSplitter&&!this.model.isResponsive?"70%":""})[0].outerHTML,{width:this.model.isResponsive||this.model.enableSplitter?"100%":"",height:"20px"})[0].outerHTML},_createCubeBrowser:function(){return t.buildTag("div.cdbHeader",t.buildTag("span",this._getLocalizedLabels("CubeDimensionBrowser"))[0].outerHTML,{width:this.model.enableSplitter?"100%":"",height:"30px"})[0].outerHTML+t.buildTag("div.cubeBrowser",t.buildTag("div.cubeTreeView.visibleHide")[0].outerHTML,{width:this.model.enableSplitter?"100%":""})[0].outerHTML},_createAxisElementBuilder:function(n,i,r){var u;return this.model.enableSplitter?t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Column"))[0].outerHTML,{height:"30px",width:"99%"})[0].outerHTML+t.buildTag("div.categoricalAxis",t.buildTag("p#categcol","colum",{display:"none"})[0].outerHTML+this._createSplitButtons(n,"Columns"),{width:this.model.isResponsive||this.model.enableSplitter?"99%":""}).attr("aria-describedby","categcol")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Row"))[0].outerHTML,{height:"30px",width:"99%"})[0].outerHTML+t.buildTag("div.rowAxis",t.buildTag("p#categrow","row",{display:"none"})[0].outerHTML+this._createSplitButtons(i,"Rows"),{width:this.model.isResponsive||this.model.enableSplitter?"99%":""}).attr("aria-describedby","categrow")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Slicer"))[0].outerHTML,{height:"30px",width:"99%"})[0].outerHTML+t.buildTag("div.slicerAxis",t.buildTag("p#sliceaxis","slicer",{display:"none"})[0].outerHTML+this._createSplitButtons(r,"Slicers"),{width:this.model.isResponsive||this.model.enableSplitter?"99%":""}).attr("aria-describedby","sliceaxis")[0].outerHTML:t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Column"))[0].outerHTML,{height:"30px"})[0].outerHTML+t.buildTag("div.categoricalAxis",t.buildTag("p#categcol","colum",{display:"none"})[0].outerHTML+this._createSplitButtons(n,"Columns"),{width:this.model.isResponsive?"99%":""}).attr("aria-describedby","categcol")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Row"))[0].outerHTML,{height:"30px"})[0].outerHTML+t.buildTag("div.rowAxis",t.buildTag("p#categrow","row",{display:"none"})[0].outerHTML+this._createSplitButtons(i,"Rows"),{width:this.model.isResponsive?"99%":""}).attr("aria-describedby","categrow")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Slicer"))[0].outerHTML,{height:"30px"})[0].outerHTML+t.buildTag("div.slicerAxis",t.buildTag("p#sliceaxis","slicer",{display:"none"})[0].outerHTML+this._createSplitButtons(r,"Slicers"),{width:this.model.isResponsive?"99%":""}).attr("aria-describedby","sliceaxis")[0].outerHTML},_createSplitButtons:function(n,r){var s="",e="",u,o,f;if(n.indexOf("~")>-1)for(u=0;u<n.split("~")[0].split("#").length-1;u++)e=n.split("~")[0].split("#")[u+1].split(".")[0],e=="Measures"?e=this._getLocalizedLabels("Measures"):n.startsWith("#Measure")?n.indexOf("#Measure")>-1&&(e=n.split("~")[u+1]):e=n.split("~")[u+2],e==i&&(e=n.split("~")[u+1]),s+=t.buildTag("div.splitBtn",t.buildTag("button.pvtBtn",e).attr({title:n.split("~")[0].split("#")[u+1].replace("."," - ").split("$")[0],fieldCaption:e,allMember:n.split("~")[0].split("#")[u+1].replace("."," - ").split("$")[1]})[0].outerHTML+t.buildTag("span.removeSplitBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML,"",{tag:r+":"+n.split("~")[0].split("#")[u+1].split("$")[0]})[0].outerHTML;else for(u=0;u<n.split("#").length-1;u++)n.split("#")[u+1].split("::")[1]=="CalculatedMember"?(f=n.split("#")[u+1].split("::")[0],o=f.split(".")[f.split(".").length-1],f=f.replace("."," - ")):(o=n.split("#")[u+1].split(".")[0]=="Measures"?this._getLocalizedLabels("Measures"):n.split("#")[u+1].split(".")[0],o.split("::")[1]=="NAMEDSET"&&(o=o.split("::")[0]),f=n.split("#")[u+1].replace("."," - ").split("$")[0]=="Measures"?this._getLocalizedLabels("Measures"):n.split("#")[u+1].replace("."," - ").split("$")[0]),this.model.enableRTL&&f.indexOf("-")>0&&(f=f.split("-").reverse().join(" - ")),s+=t.buildTag("div.splitBtn",t.buildTag("button.pvtBtn",this.model.showUniqueNameOnPivotButton?f:o).attr({title:f,fieldCaption:o,allMember:n.split("#")[u+1].split("$")[1]})[0].outerHTML+t.buildTag("span.removeSplitBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML,"",{tag:r+":"+n.split("#")[u+1].split("$")[0]})[0].outerHTML;return s},_setSplitBtnTitle:function(){for(var f,r,o,e,h,i=this.element.find(".splitBtn"),t=0;t<i.length;t++){var s=n(i[t]).attr("tag").split(":")[1].split("."),u="";for(f=0;f<s.length;f++)u+=s[0].toUpperCase()!="[Measures]"?"["+s[f]+"]"+(f%2==0?".":""):s[f]+(f%2==0?".":"");this.element.find(".cubeTreeView").length>0&&!(u.indexOf("Measures")>=0)&&(u=u.indexOf("<>")>0?u.replace("<>","."):u,r="",o=n(i[t]).find("button").attr("allMember"),o=o!="All"?o:this._getLocalizedLabels("All"),e=this.element.find(".cubeTreeView").find("li[tag='"+u+"'] a:eq(0)").text(),e==""&&(e=this.element.find(".cubeTreeView").find("li[tag='["+s[1]+"]'] a:eq(0)").text()),e.indexOf(".")>0?n(i[t]).find("button").attr("title",this.model.enableRTL?e.split(".").reverse().join(" - "):e.replace("."," - ")):(r=n(i[t]).find("button").attr("fieldCaption")+" - "+(this.element.find(".cubeTreeView").find("li[tag='"+u+"'] a:eq(0)").text()||this.element.find(".cubeTreeView").find("li[tag='"+u.toUpperCase()+"'] a:eq(0)").text()||e),r=this.model.enableRTL&&r.indexOf("-")>0?r.split("-").reverse().join(" - "):r,n(i[t]).find("button").attr("title",r)),n(i[t]).attr("tag").split(":")[0]=="Slicers"&&n(i[t]).attr("tag").indexOf("::CalculatedMember")<0&&(r=n(i[t]).attr("tag").split(":")[1],h=(this._fieldSelectedMembers[r]=="All"?o:this._fieldSelectedMembers[r])||o,n(i[t]).find("button").text((this.model.showUniqueNameOnPivotButton?n(i[t]).find("button").parent().attr("tag").split(":")[1].replace("."," - "):n(i[t]).find("button").attr("fieldCaption"))+" ("+h+")"),n(i[t]).find("button").attr("title",n(i[t]).find("button").attr("title")+" ("+h+")")))}},_controlPanel:function(){var f,n,i;if(this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(n=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar?"":"auto",left:"5px",top:"5px",width:this.model.isResponsive||this.model.enableSplitter?"100%":""})[0].outerHTML,{width:"auto",height:"auto"})[0].outerHTML:t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"10px 0px 7px":"10px 7px 7px",padding:"1px",width:this.model.isResponsive&&!this.model.enableSplitter?"auto":this.model.enableSplitter?"100%":""})[0].outerHTML,{position:"relative",left:"7px","border-top":"none","margin-top":"-7px",overflow:this.model.enableToolBar?"":"auto",height:this.model.enablePaging?"277px":"",width:this.model.isResponsive?"100%":""})[0].outerHTML,{width:"auto",height:"auto"})[0].outerHTML:this.displayMode()==t.PivotClient.DisplayMode.GridOnly?t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,{overflow:this.model.enableToolBar?"":"auto",position:"absolute",left:"7px","padding-top":"2px",width:this.model.isResponsive||this.model.enableSplitter?"100%":"",top:"3px"})[0].outerHTML,{width:"auto",height:"auto"})[0].outerHTML:t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,{overflow:this.model.enableToolBar?"":"auto",position:"relative",width:this.model.isResponsive||this.model.enableSplitter?"100%":"",left:window.navigator.userAgent.indexOf("Trident")>0?this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.model.enableRTL?"15px":"0px":this.model.enableRTL?"5px":"7px":this.model.enableRTL?"5px":"7px","padding-top":"5px","border-top":"none"})[0].outerHTML,{width:"100%",height:"auto"})[0].outerHTML),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{overflow:this.model.enableToolBar||this.model.isResponsive?"":"auto",border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter?"":"auto",left:"-2px",padding:this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px",width:this.model.isResponsive||this.model.enableSplitter?"98%":"","border-top":"none","margin-right":"-11px"})[0].outerHTML,{width:"98%",height:"auto"})[0].outerHTML:t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{"min-height":this.model.enablePaging?"255px":"",border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter||this.model.isResponsive?"":"auto",padding:this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px",width:this.model.isResponsive||this.model.enableSplitter?"98%":""})[0].outerHTML,{width:"98%",height:"auto"})[0].outerHTML:this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter||this.model.isResponsive?"":"auto",padding:this.model.enableRTL?"5px 25px 2px 6px":this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px","margin-right":this.model.enableRTL?"1px":"-11px"})[0].outerHTML,{width:"98%",height:"auto"})[0].outerHTML:t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter||this.model.isResponsive?"":"auto",top:"-5px",left:window.navigator.userAgent.indexOf("Trident")>0?"-7px":"0px",padding:this.model.enableRTL?"5px 5px 0px 5px":this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px","border-top":"none","margin-right":this.model.enableRTL?"0px":"-11px","margin-left":this.model.enableRTL?"-11px":"0px"})[0].outerHTML,{width:this.model.enableSplitter?"99%":"98%",height:"auto"})[0].outerHTML),this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid){var r,e,s="<a style='font: bold 12px Segoe UI' href='#gridPanel' tabindex='0'>"+this._getLocalizedLabels("Grid")+"<\/a>",h="<a style='font: bold 12px Segoe UI' href='#chartPanel' tabindex='0'>"+this._getLocalizedLabels("Chart")+"<\/a>",u=window.navigator.userAgent.indexOf("Trident")>0?this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.model.enableRTL?"15px":"7px":this.model.enableRTL?"5px":"7px":this.model.enableRTL?"5px":"7px",o=0;this.model.enableRTL&&(o="-"+u,u=0);this.defaultView()==t.PivotClient.DefaultView.Chart?(r=t.buildTag("ul.clientTab",t.buildTag("li",h)[0].outerHTML+t.buildTag("li",s)[0].outerHTML,{"margin-left":u,"margin-right":o})[0].outerHTML,e=t.buildTag("div#clientTab",r+i+n)[0].outerHTML):(r=t.buildTag("ul.clientTab",t.buildTag("li",s)[0].outerHTML+t.buildTag("li",h)[0].outerHTML,{"margin-left":u,"margin-right":o})[0].outerHTML,e=t.buildTag("div#clientTab",r+n+i,{height:"100%"})[0].outerHTML);f=e}else f=this._createControlContainer(this.controlPlacement(),i,n);return t.buildTag("div.controlPanel",f,{width:this.model.isResponsive?"100%":this.model.displaySettings.controlPlacement=="tab"?this.model.analysisMode=="olap"&&this.model.operationalMode=="servermode"||!this.model.enableSplitter?"":"100%":"auto",top:this.model.displaySettings.mode==t.PivotClient.DisplayMode.GridOnly?"3px":"none","margin-bottom":this.model.displaySettings.controlPlacement==t.PivotClient.ControlPlacement.Tile&&(this.model.enablePaging||this.model.enableVirtualScrolling)?"5px":"0"})[0].outerHTML+(this.model.enablePaging?t.buildTag("div#"+this._id+"_Pager")[0].outerHTML:this.model.enableVirtualScrolling?t.buildTag("div#hsVirtualScrolling.hsVirtualScrolling",t.buildTag("div.hScrollPanel")[0].outerHTML,{width:"10px"})[0].outerHTML:"")},_createControlContainer:function(n,i,r){return this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?"<table style='width:100%'><tr><td>"+i+"<\/td><\/tr><\/table>":this.displayMode()==t.PivotClient.DisplayMode.GridOnly?"<table style='width:100%'><tr><td>"+r+"<\/td><\/tr><\/table>":this.controlPlacement()==t.PivotClient.ControlPlacement.Tile?this.defaultView()==t.PivotClient.DefaultView.Chart?"<table style='width:100%'><tr><td>"+i+"<\/td><\/tr><tr><td>"+r+"<\/td><\/tr><\/table>":"<table style='width:100%'><tr><td>"+r+"<\/td><\/tr><tr><td>"+i+"<\/td><\/tr><\/table>":this.defaultView()==t.PivotClient.DefaultView.Chart?"<table style='width:100%'><tr><td valign='top'>"+i+"<\/td><td valign='top'>"+r+"<\/td><\/tr><\/table>":"<table style='width:100%'><tr><td valign='top'>"+r+"<\/td><td valign='top'>"+i+"<\/td><\/tr><\/table>"},_renderPivotGrid:function(r){var f,u;if(r=t.isNullOrUndefined(r)?"":r,this.element.find(".e-dialog").hide(),this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly)if(this._pivotChart!=i&&this._pivotChart._startDrilldown){try{u=JSON.parse(this._pivotGrid.getOlapReport()).Report}catch(e){u=this._pivotGrid.getOlapReport()}this._pivotGrid.doAjaxPost("POST",this.model.url+"/"+this._pivotGrid.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:"",currentReport:u,clientReports:this.reports,headerInfo:r,layout:this.gridLayout(),enableRTL:this.model.enableRTL}),this._pivotGrid._drillDownSuccess)}else this.model.enableDeferUpdate?(this._isTimeOut=!1,this._waitingPopup.hide()):(this.element.find(".e-pivotgrid, #"+this._id+"_PivotGrid").remove(),f=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",width:this.model.isResponsive?"auto":" ",padding:"1px"})[0].outerHTML:t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,n(f).appendTo(this.element.find(".gridContainer")),this.gridLayout()!=t.PivotGrid.Layout.Normal?this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,isResponsive:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),layout:this.gridLayout(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}):this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,isResponsive:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}),this._pivotGrid=this.element.find("#"+this._id+"_PivotGrid").data("ejPivotGrid"))},_renderPivotChart:function(r,u){var f,e;this.element.find(".e-dialog").hide();this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotGrid!=i&&this._pivotGrid._startDrilldown?(f=this._pivotChart.getOlapReport(),this._pivotChart.doAjaxPost("POST",this.model.url+"/"+this._pivotChart.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._pivotChart.model.enableMultiLevelLabels?u+"#fullchart":u,drilledSeries:r,olapReport:f,clientReports:this.reports}),this._pivotChart.renderControlSuccess)):this.model.enableDeferUpdate?(this._isTimeOut=!1,this._waitingPopup.hide()):(this.element.find(".e-pivotchart").remove(),e=t.buildTag("div#"+this._id+"_PivotChart","",{height:"auto"})[0].outerHTML,this.element.find(".chartContainer").children().length==0&&n(e).appendTo(this.element.find(".chartContainer")),this.element.find("#"+this._id+"_PivotChart").ejPivotChart({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,currentReport:this.currentReport,customObject:this.model.customObject,locale:this.locale(),showTooltip:!0,size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:this.model.chartLoad,drillSuccess:t.proxy(this._chartDrillSuccess,this)}),this._pivotChart=this.element.find("#"+this._id+"_PivotChart").data("ejPivotChart"),this.element.find("#"+this._id+"_PivotChart").width(this._pivotChart.model.size.width)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&this._toggleExpand&&!this.model.isResponsive&&this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"&&this.element.find(".toggleExpandButton").click()},_renderPivotTreeMap:function(r,u){var f,e;this.element.find(".e-dialog").hide();this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotGrid!=i&&this._pivotGrid._startDrilldown?(f=this.otreemapObj.getOlapReport(),this.otreemapObj.doAjaxPost("POST",this.model.url+"/"+this.otreemapObj.model.serviceMethodSettings.drillDown,JSON.stringify({action:u,drillInfo:r,olapReport:f,clientReports:this.reports}),this.otreemapObj.renderControlSuccess),t.isNullOrUndefined(this.chartObj)||(this.model.displaySettings.enableFullScreen||this.enableTogglePanel()&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap")&&(n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"}),this.otreemapObj._treeMap.refresh())):this.model.enableDeferUpdate?(this._isTimeOut=!1,this._waitingPopup.hide()):(this.element.find(".e-pivottreemap").remove(),e=t.buildTag("div#"+this._id+"_PivotChart","",{height:"auto"})[0].outerHTML,this.element.find(".chartContainer").children().length==0&&n(e).appendTo(this.element.find(".chartContainer")),this.element.find("#"+this._id+"_PivotChart").ejPivotTreeMap({url:this.model.url,customObject:this.model.customObject,canResize:this.model.isResponsive,currentReport:this.currentReport,customObject:this.model.customObject,locale:this.locale(),size:{height:this._chartHeight,width:this._chartWidth},beforeServiceInvoke:this.model.treeMapLoad,drillSuccess:t.proxy(this._treemapDrillSuccess,this)}),this.otreemapObj=this.element.find("#"+this._id+"_PivotChart").data("ejPivotTreeMap"),this.element.find("#"+this._id+"_PivotChart").width(this.otreemapObj.model.size.width)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&this._toggleExpand&&!this.model.isResponsive&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&this.element.find(".toggleExpandButton").click()},_renderControls:function(){(this._isNodeOrButtonDropped&&t.isNullOrUndefined(this.chartObj)||this._isrenderTreeMap)&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._isNodeOrButtonDropped=!1,this._isrenderTreeMap=!1,this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this.displayMode()==t.PivotClient.DisplayMode.GridOnly?this.defaultView()==t.PivotClient.DefaultView.Chart?(this._renderPivotChart(),this._renderPivotGrid()):(this._renderPivotGrid(),this._renderPivotChart()):this.defaultView()==t.PivotClient.DefaultView.Chart?(t.isNullOrUndefined(this.chartObj)?this.element.find("#"+this._pivotChart._id+"Container").length>0?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap():this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap(),this._renderPivotGrid()):(this._renderPivotGrid(),t.isNullOrUndefined(this.chartObj)?this.element.find("#"+this._pivotChart._id+"Container").length>0?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap():this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap())},_createDialogRequest:function(r){var u,c,s,h,e,f,o;if(!(r.target.className.indexOf("dialogOKBtn")>=0)){if(r.target.type=="button"&&n(r.target).parent().attr("tag").indexOf("::CalculatedMember")>-1){if(this._selectedCalcMember=n(r.target).parent().text(),this.element.find(".calcMemberDialog").length>0){if(this._calcMemberTreeObj.collapseAll(),t.Pivot.closePreventPanel(this),this._calcMemberDialog.open(),u=t.DataManager(this._calcMembers).executeLocal(t.Query().where("name","equal",this._selectedCalcMember)),u.length>0){if(this.element.find("#"+this._id+"_captionFieldCM").val(u[0].name),this.element.find("#"+this._id+"_expressionFieldCM").val(u[0].expression),this.element.find("#"+this._id+"_memberTypeFieldCM").data("ejDropDownList").selectItemsByIndices(u[0].nodeType),u[0].nodeType==1)for(c=u[0].tag.split(".")[0].replace(/\[/g,"").replace(/\]/g,""),s=this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").model.dataSource,f=0;f<s.length;f++)s[f].value==c&&this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").selectItemsByIndices(f);t.isNullOrUndefined(u[0].formatString)||(u[0].formatString=="Currency"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(1):u[0].formatString=="Percent"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2):(this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2),this.element.find("#"+this._id+"_customFormatFieldCM").val(u[0].formatString)))}}else this._waitingPopup.show(),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"fetchCalcMemberTreeView",element:this.element,customObject:this.model.customObject}),o=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchCalcMemberTreeView",dimensionName:"calcMember",olapReport:this.currentReport,customObject:o}),t.proxy(t.Pivot._createCalcMemberDialog,this));return}if(this.model.enableMemberEditorPaging&&(this._memberPageSettings.startPage=0,this._memberPageSettings.currentMemeberPage=1,this._selectedFieldName=n(r.target).parent().attr("tag"),this._memberPageSettings.filterReportCollection={}),pivotClientObj=this,args_className=r.target.className,args_innerHTML=r.target.innerHTML==""?"ToolbarButtons":r.target.innerHTML,this._dialogTitle=hierarchyCaption=t.browserInfo().name=="msie"&&t.browserInfo().version<=8?n(r.currentTarget)[0].title:r.currentTarget.attributes==""?"":n(r.currentTarget).attr("title")||n(r.currentTarget).attr("aria-label"),this._currentItem=hierarchyCaption,this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove(),args_innerHTML!="ToolbarButtons"&&args_innerHTML!=i&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap){if(n(r.target).parent().attr("tag").indexOf(":")>=0&&n(r.target).parent().attr("tag").split(":")[1].indexOf(".")>=0)if(h=n(r.target).parent().attr("tag").split(":")[1].split("."),e=this.element.find(".cubeTreeView li[tag^='["+h[0]+"'][tag$='"+h[1]+"]']"),e.length>0){for(f=0;f<e.length;f++)if(n(e[f]).attr("tag").split("].").length==2){this._selectedFieldName=n(e[f]).attr("tag");break}}else this._selectedFieldName=e.attr("tag");else this._selectedFieldName="";pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"fetchMemberTreeNodes",element:this.element,customObject:this.model.customObject});o=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchMemberTreeNodes",dimensionName:n(r.target).parent().attr("Tag"),olapReport:this.currentReport,customObject:o}),this._editorTreeInfoSuccess)}else this._createDialog(args_className,args_innerHTML,"")}},_fetchReportListSuccess:function(n){var r="";n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchReportList",element:this.element,customObject:this.model.customObject,reports:n});this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();n[0]!=i?(r=t.isNullOrUndefined(n[1].Value)?"":n[1].Value,n=t.isNullOrUndefined(n[0].Value)?"":n[0].Value):n.d!=i?(r=t.isNullOrUndefined(n.d[1].Value)?"":n.d[1].Value,n=t.isNullOrUndefined(n.d[0].Value)?"":n.d[0].Value):(r=n.action,n=n.ReportNameList);n==""?(t.Pivot._createErrorDialog(this._getLocalizedLabels("NoReports"),"Error",this),this._isTimeOut=!1):this._createDialog(r,n,"")},_fetchSortState:function(n){this._isTimeOut=!1;this._waitingPopup.hide();n[0]!=i?this._createDialog("SortFilterDlg",n[0].Value,""):n.d!=i?this._createDialog("SortFilterDlg",n.d[0].Value,""):this._createDialog("SortFilterDlg",n.FetchSortState,"")},_createDialog:function(r,u,f){var y=!1,nt,p,at,ut,ft,e,o,s,yt,pt,wt,bt,kt,dt,gt,l,b,ni,ti,et,ot,st,ii,ri,fi,ct,lt,tt,ei,k,d,g,rt,hi,a;if(t.Pivot.openPreventPanel(this),this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(r=="SortFilterDlg"||r=="mdx")){if(nt=this.element.find(".splitBtn"),p=jQuery.grep(nt,function(t){return n(t).attr("tag").split(":")[1]=="Measures"}).length,at=jQuery.grep(nt,function(t){return n(t).attr("tag").split(":")[1]!="Measures"&&n(t).attr("tag").split(":")[0]=="Rows"}).length,ut=jQuery.grep(nt,function(t){return n(t).attr("tag").split(":")[1]!="Measures"&&n(t).attr("tag").split(":")[0]=="Columns"}).length,r=="mdx"&&p==0&&ut==0)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MDXAlertMsg"),"Error",this),!1;if(p>0&&this.element.find(".categoricalAxis ")[0].childElementCount!=0){if(!at&&document.activeElement.className.indexOf("rowSortFilterImg")>-1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortRowAlertMsg"),"Error",this),!1;if(!ut&&document.activeElement.className.indexOf("colSortFilterImg")>-1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortColumnAlertMsg"),"Error",this),!1}else if(r!="mdx")return p||this._axis!="Column"?p||this._axis!="Row"?n(".categoricalAxis ")[0].childElementCount||t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortElementAlertMsg"),"Error",this):t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortrowMeasureAlertMsg"),"Error",this):t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortcolMeasureAlertMsg"),"Error",this),!1}this.model.analysisMode!=t.Pivot.AnalysisMode.Olap||t.isNullOrUndefined(this._selectedFieldName)||(y=this.element.find(".pvtBtn").parent("[tag='Slicers:"+this._selectedFieldName.replace(/\[/g,"").replace(/\]/g,"")+"']").length>0);var w="",v="",h="",vt=[],c;if(c=f[0]!=i?f[0].Value:f.d!=i?f.d[0].Value:f.EditorTreeInfo,ft=t.buildTag("div#"+(this.model.enableAdvancedFilter?"clientDialog":this._id+"_ClientDialog")+".clientDialog",{opacity:"1"})[0].outerHTML,r.split(" ")[0]=="newReportImg")o=this._getLocalizedLabels("NewReport"),s="New Report",pt="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",wt="<input type=text id=reportName class='reportName'/><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+pt+"<\/td><td>"+wt+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="addReportImg")o=this._getLocalizedLabels("AddReport"),s="Add Report",bt="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",kt="<input type=text id=reportName class='reportName'/><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+bt+"<\/td><td>"+kt+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="removeReportImg")o=this._getLocalizedLabels("RemoveReport"),s="Remove Report",(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)&&(reportsCount=this._clientReportCollection.length),e=reportsCount>1?"<p>"+this._getLocalizedLabels("AreYouSureToDeleteTheReport")+"?<\/p>":"<p>"+this._getLocalizedLabels("CannotRemoveSingleReport")+"!<\/p>";else if(r.split(" ")[0]=="SortFilterDlg"){w=u.split("||");w[1]!=""&&(v=w[1].split("<<"));w[2]!=""&&(h=w[2].split("<<"));this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();o=this._getLocalizedLabels("SortingAndFiltering");var ci=t.buildTag("label#sortingLbl.sortingLbl",this._getLocalizedLabels("Sorting"))[0].outerHTML,li=t.buildTag("label#measureListLbl.measureListLbl",this._getLocalizedLabels("Measure"))[0].outerHTML,ai=t.buildTag("label#orderLbl.orderLbl",this._getLocalizedLabels("Order"))[0].outerHTML,vi=t.buildTag("input#measuresList.measuresList","",{},{type:"text",accesskey:"M"})[0].outerHTML,yi=t.buildTag("input#sortDisable.sortDisable","",{},{name:"sort",type:"radio",checked:"checked",role:"radio",tabindex:0,accesskey:"i"})[0].outerHTML+t.buildTag("label.sortDisableLbl",this._getLocalizedLabels("Disable"))[0].outerHTML,pi=t.buildTag("input#sortEnable.sortEnable","",{},{name:"sort",type:"radio",role:"radio",tabindex:1,accesskey:"n"})[0].outerHTML+t.buildTag("label.sortEnableLbl",this._getLocalizedLabels("Enable"))[0].outerHTML+"<br/>",wi=t.buildTag("input#radioBtnAsc.radioBtnAsc","",{},{name:"order",type:"radio",checked:"checked",role:"radio",tabindex:0,accesskey:"A"})[0].outerHTML+t.buildTag("label.radioBtnAscLbl",this._getLocalizedLabels("Ascending"))[0].outerHTML+"<br/>",bi=t.buildTag("input#radioBtnDesc.radioBtnDesc","",{},{name:"order",type:"radio",role:"radio",tabindex:2,accesskey:"e"})[0].outerHTML+t.buildTag("label.radioBtnDescLbl",this._getLocalizedLabels("Descending"))[0].outerHTML,ki=t.buildTag("input#preserveHrchy.preserveHrchy","",{},{type:"checkbox",checked:"checked",tabindex:0,role:"radio",accesskey:"r"})[0].outerHTML+t.buildTag("label.preserveHrchyLbl",this._getLocalizedLabels("PreserveHierarchy"))[0].outerHTML,di=t.buildTag("label#filterLbl.filterLbl",this._getLocalizedLabels("Filtering"))[0].outerHTML,gi=t.buildTag("input#filterDisable.filterDisable","",{},{name:"filter",type:"radio",checked:"checked",role:"radio",tabindex:0,accesskey:"i"})[0].outerHTML+t.buildTag("label.filterDisableLbl",this._getLocalizedLabels("Disable"))[0].outerHTML,nr=t.buildTag("input#filterEnable.filterEnable","",{},{name:"filter",type:"radio",role:"radio",tabindex:0,accesskey:"n"})[0].outerHTML+t.buildTag("label.filterDisableLbl",this._getLocalizedLabels("Enable"))[0].outerHTML+"<br/>",tr=t.buildTag("label#conditionLbl.conditionLbl",this._getLocalizedLabels("Condition"))[0].outerHTML,ir=t.buildTag("input#filterCondition.filterCondition","",{},{type:"text",tabindex:0,accesskey:"o"})[0].outerHTML,rr=t.buildTag("div#filterfrom.filterFrmDiv",t.buildTag("input#filterFrom.filterFrom","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:0})[0].outerHTML)[0].outerHTML,ur=t.buildTag("div#filterbtw.filterBtw","<p>"+this._getLocalizedLabels("and")+"<\/p>")[0].outerHTML,fr=t.buildTag("div#filterto.filterToDiv",t.buildTag("input#filterTo.filterTo","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:0,accesskey:"d"})[0].outerHTML)[0].outerHTML,er=t.buildTag("label#filterMeasureListLbl.filterMeasureListLbl",this._getLocalizedLabels("Measure"))[0].outerHTML,or=t.buildTag("input#fMeasuresList.fMeasuresList","",{},{type:"text",tabindex:0,accesskey:"M"})[0].outerHTML,sr=t.buildTag("label#filterValueLbl.filterValueLbl",this._getLocalizedLabels("Value"),{},{tabindex:0,accesskey:"a"})[0].outerHTML,hr=t.buildTag("div#sortingDlg.sortingDlg","<table class='sortReportTbl'><tr><td style='vertical-align:top;'>"+ci+"<\/td><td>"+pi+yi+"<\/td><\/tr><tr><td>"+li+"<\/td><td>"+vi+"<\/td><\/tr> <tr><td>"+ai+"<\/td><td>"+wi+bi+"<\/td><\/tr><tr><td><\/td><td>"+ki+"<\/td><\/tr><\/table>")[0].outerHTML,cr=t.buildTag("div#filteringDlg.filteringDlg","<table class='sortReportTbl'><tr><td>"+di+"<\/td><td>"+nr+gi+"<\/td><\/tr><tr><td>"+er+"<\/td><td>"+or+"<\/td><\/tr><tr><td>"+tr+"<\/td><td>"+ir+"<\/td><\/tr><tr><td>"+sr+"<\/td><td>"+rr+ur+fr+"<\/td><\/tr><\/table>")[0].outerHTML,lr="<li><a style='font: bold 12px Segoe UI' href='#sortingDlg'>"+this._getLocalizedLabels("Sorting")+"<\/a><\/li>",ar="<li><a style='font: bold 12px Segoe UI' href='#filteringDlg'>"+this._getLocalizedLabels("Filtering")+"<\/a><\/li>",vr=t.buildTag("div#sortfilterTab.sortfilterTab","<ul class ='sortfiltTab'>"+(lr+ar+"<\/ul>"+hr+cr))[0].outerHTML;e=vr}else if(r.split(" ")[0]=="renameReportImg")o=this._getLocalizedLabels("RenameReport"),s="Rename Report",dt=t.isNullOrUndefined(this._currentReportName)?this.element.find(".reportlist").val():this._currentReportName,gt="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",renameReport="<input type=text id=reportName class='reportName' value='"+dt+"' /><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+gt+"<\/td><td>"+renameReport+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="saveAsReportImg"||r.split(" ")[0]=="saveReportImg")o=r.split(" ")[0]=="saveAsReportImg"?this._getLocalizedLabels("SaveAs"):this._getLocalizedLabels("Save"),s="SaveAs Report",l="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",recordName="<input type=text id=reportName class='reportName'/><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+l+"<\/td><td>"+recordName+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="LoadReport")o=this._getLocalizedLabels("Load"),s="Load Report",l="<table class='loadReportTbl'><tr><td class='loadReportTd'>"+this._getLocalizedLabels("ReportName")+"<\/td>",b="<td><input type='text' id='reportNameList' class='reportNameList'/><\/td><\/tr><\/table>",e=l+b;else if(r.split(" ")[0]=="RemoveDBReport")o=this._getLocalizedLabels("Remove"),s="RemoveDB Report",l="<table class='removeDBReportTbl'><tr><td class='removeDBReportTd'>"+this._getLocalizedLabels("ReportName")+"<\/td>",b="<td><input type='text' id='reportNameList' class='reportNameList'/><\/td><\/tr><\/table>",e=l+b;else if(r.split(" ")[0]=="RenameDBReport"){o=this._getLocalizedLabels("Rename");s="RenameDB Report";var l="<table class='renameDBReportTbl'><tr><td class='renameDBReportTd'>"+this._getLocalizedLabels("SelectReport")+"<\/td>",b="<td><input type='text' id='reportNameList' class='reportNameList'/><\/td><\/tr>",yr="<tr><td class='renameDBReportTd'>"+this._getLocalizedLabels("RenameReport")+"<\/td>";e=l+b+yr+"<td><input type='text' id='renameReport' class='renameReport' style='width:146px'/><\/td><\/tr><\/table>"}else if(r.split(" ")[0]=="mdx")o=this._getLocalizedLabels("MDXQuery"),s="MDX Query",ni="<textarea readonly='readonly' style='width:460px; height:180px; resize:none; margin:3px'>"+u+"<\/textarea>",e=ni;else if(r.split(" ")[0]=="chartTypesImg")o=this._getLocalizedLabels("ChartTypes"),s="Chart Types",ti="<p class='dialogPara'>"+this._getLocalizedLabels("ChartTypes")+"<\/p>",it="<input type=text id=reportName class='reportName'/><\/br>",e=ti+it;else if(r.indexOf("e-txt")>-1){u==this._getLocalizedLabels("Measures")?(o=this._getLocalizedLabels("MeasureEditor"),e="<p class='editorPara'>"+this._getLocalizedLabels("Measures")+"<\/p>"):(o=this._getLocalizedLabels("MemberEditor"),e=this.model.enableAdvancedFilter&&!y?"":"<p class='editorPara'>"+hierarchyCaption+"<\/p>");et="";st="";n(ct).appendTo(lt);u!=this._getLocalizedLabels("Measures")&&(ii=t.buildTag("div.checkAll e-icon").attr("role","button").attr("aria-label","checkall")[0].outerHTML,ri=t.buildTag("div.unCheckAll e-icon").attr("role","button").attr("aria-label","uncheckall")[0].outerHTML,st=t.buildTag("div.checkOptions",ii+ri,{height:"19px",margin:"10px 0px 0px 31px"})[0].outerHTML,et=t.buildTag("div.memberSearchEditorDiv",t.buildTag("input#searchEditorTreeView.searchEditorTreeView").attr("type","text")[0].outerHTML+(!t.isNullOrUndefined(c)&&u!=this._getLocalizedLabels("Measures")&&this.model.enableMemberEditorPaging&&n.parseJSON(c).length>=this.model.memberEditorPageSize?t.buildTag("span.e-icon searchEditorTree",{})[0].outerHTML:""),{padding:this.model.enableAdvancedFilter?"5px 0px 0px 0px":0})[0].outerHTML);u==this._getLocalizedLabels("Measures")?(this._isMembersFiltered=!1,ot=this._createMeasureEditor(f)):ot=t.buildTag("div#editorTreeView.editorTreeView")[0].outerHTML;var pr=t.buildTag("div.memberEditorDiv",(this._selectedFieldName!=""?st:"")+ot)[0].outerHTML,ht="",ui="";this._selectedFieldName!=""&&!y&&this.model.enableAdvancedFilter&&(ui=t.buildTag("div.ddlGroupWrap",this._getLocalizedLabels("SelectField")+":"+t.buildTag("input#GroupLabelDrop.groupLabelDrop").attr("type","text")[0].outerHTML,{})[0].outerHTML,ht=t.buildTag("div.filterElementTag")[0].outerHTML,fi=t.Pivot.createAdvanceFilterTag({action:"filterTag"},this),vt=n.map(this.element.find(".e-treeview li[tag='"+this._selectedFieldName+"'] li"),function(t){return{text:n(t).text(),value:n(t).attr("tag")}}));ct=t.buildTag("div",(ht!=""&&!y&&this.model.enableAdvancedFilter?ui+t.buildTag("div.e-seperator",{},{padding:"2px"},k)[0].outerHTML+ht+t.buildTag("div.e-seperator",{},{padding:"2px"})[0].outerHTML:"")+et+pr)[0].outerHTML;lt=t.buildTag("div#EditorDiv.editorDiv",ct,{"margin-left":this.model.enableAdvancedFilter?"5px":"0px"})[0].outerHTML;e+=lt;yt=t.buildTag("div.memberPager",t.buildTag("div#NextpageDiv.nextPageDiv",t.buildTag("div.e-icon e-media-backward_01 firstPage",{})[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-left prevPage",{})[0].outerHTML+t.buildTag("input.memberCurrentPage#memberCurrentPage",{},{width:"20px",height:"10px"})[0].outerHTML+t.buildTag("span.memberPageCount#memberPageCount")[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-right nextPage",{})[0].outerHTML+t.buildTag("div.e-icon e-media-forward_01 lastPage",{})[0].outerHTML)[0].outerHTML,{})[0].outerHTML}if(r.split(" ")[0]=="mdx"?(k="<button id=CancelBtn class='dialogCancelBtn'>"+this._getLocalizedLabels("OK")+"<\/button>",tt=t.buildTag("div.dialogFooter",k)[0].outerHTML,n(ft).appendTo("#"+this._id),n(e+tt).appendTo(this.element.find(".clientDialog")),this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:500,target:"#"+this._id,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)})):(ei="<button id=OKBtn class='dialogOKBtn'>"+(r.split(" ")[0]=="RemoveDBReport"?this._getLocalizedLabels("Remove"):this._getLocalizedLabels("OK"))+"<\/button>",k="<button id=CancelBtn class='dialogCancelBtn'>"+this._getLocalizedLabels("Cancel")+"<\/button>",tt=t.buildTag("div.dialogFooter",ei+(r.split(" ")[0]=="removeReportImg"&&reportsCount==1?"":k))[0].outerHTML,n(ft).appendTo("#"+this._id),n(e+(!t.isNullOrUndefined(c)&&u!=this._getLocalizedLabels("Measures")&&this.model.enableMemberEditorPaging&&n.parseJSON(c).length>=this.model.memberEditorPageSize?yt:"")+tt).appendTo(this.element.find(".clientDialog")),r.split(" ")[0]=="SortFilterDlg"?this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:"auto",target:"#"+this._id,cssClass:"SortFilterDlg",enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)}):this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:"auto",target:"#"+this._id,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)}),r.split(" ")[0]=="removeReportImg"&&(this.element.find(".clientDialog").css("min-height","60px"),this.element.find("#"+this._id+"_ClientDialog_wrapper").css("min-height","100px"))),this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").prepend(t.buildTag("div",o,{display:"inline"})[0].outerHTML)[0].setAttribute("tag",s),this.element.find(".reportName").ejMaskEdit({width:"155px",textAlign:this.model.enableRTL?"right":"left"}),this.element.find(".memberSearchEditorDiv .e-mask").addClass("dialogInput"),this.element.find(".prevPage, .firstPage").addClass("pageDisabled"),this.element.find(".nextPage, .lastPage").addClass("pageEnabled"),this.element.find(".dialogOKBtn, .dialogCancelBtn").ejButton({type:t.ButtonType.Button}),n(".sortfilterTab").ejTab({enableRTL:this.model.enableRTL}),n(".reportNameList").ejDropDownList({dataSource:u.split("__"),enableRTL:this.model.enableRTL,width:"150px",height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),r.indexOf("e-txt")>-1&&this.element.find("#searchEditorTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search")+" "+hierarchyCaption,maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:!this.model.enableMemberEditorPaging||this.element.find(".nextPageDiv").length==0?t.proxy(t.Pivot._searchTreeNodes,this):function(n){t.isNullOrUndefined(n.value)&&t.Pivot._searchEditorTreeNodes(n,this)}}),this.element.find(".filterElementTag").ejMenu({fields:{dataSource:fi,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.NormalMenu,width:"100%",height:"25px",enableRTL:this.model.enableRTL,orientation:t.Orientation.Vertical,click:t.proxy(this._filterElementClick,this)}),this.element.find(".groupLabelDrop").ejDropDownList({width:"100%",height:"25px",enableRTL:this.model.enableRTL,dataSource:vt,fields:{id:"id",text:"text",value:"value"},selectedIndices:[0],change:t.proxy(this._groupLabelChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(".filterFrom,.filterTo").ejMaskEdit({width:"80px",height:"20px",textAlign:this.model.enableRTL?"right":"left"}),n(".measuresList").ejDropDownList({dataSource:u.split("||")[0].split("__"),enableRTL:this.model.enableRTL,width:"80%",height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(".fMeasuresList").ejDropDownList({dataSource:u.split("||")[0].split("__"),width:"80%",enableRTL:this.model.enableRTL,height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(".filterCondition").ejDropDownList({change:"_onActiveConditionChange",enableRTL:this.model.enableRTL,dataSource:[{option:"EqualTo",value:this._getLocalizedLabels("EqualTo")},{option:"NotEquals",value:this._getLocalizedLabels("NotEquals")},{option:"GreaterThan",value:this._getLocalizedLabels("GreaterThan")},{option:"GreaterThanOrEqualTo",value:this._getLocalizedLabels("GreaterThanOrEqualTo")},{option:"LessThan",value:this._getLocalizedLabels("LessThan")},{option:"LessThanOrEqualTo",value:this._getLocalizedLabels("LessThanOrEqualTo")},{option:"Between",value:this._getLocalizedLabels("Between")},{option:"NotBetween",value:this._getLocalizedLabels("NotBetween")},],fields:{text:"value",value:"option"},width:"80%",height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.element.find(".filterCondition").ejDropDownList("option","change",t.proxy(this._onActiveConditionChange,this)),this._dllSortMeasure=n(".measuresList").data("ejDropDownList"),this._dllFilterCondition=n(".filterCondition").data("ejDropDownList"),this._dllfMeasuresList=n(".fMeasuresList").data("ejDropDownList"),v!=""&&(this.element.find(".radioBtnAsc")[0].checked=v[0]=="ASC"?!0:!1,this.element.find(".radioBtnDesc")[0].checked=v[0]=="DESC"?!0:!1,this.element.find(".sortDisable")[0].checked=!(this.element.find(".sortEnable")[0].checked=!0),this.element.find(".preserveHrchy")[0].checked=v[1]=="PH"?!0:!1,this._isSorted=!0,this._dllSortMeasure.setModel({value:v[2]})),h!=""&&(this.element.find(".filterEnable")[0].checked=!0,this._dllfMeasuresList.setModel({value:h[0]}),this._dllFilterCondition.setModel({value:h[1]}),this.element.find(".filterFrom").val(h[2]),h[3]!=i&&h[3]!=""&&(h[1]=="Between"||h[1]=="NotBetween")?this.element.find(".filterTo").val(h[3]):n(".filterTo").attr("disabled","disabled"),this._isFiltered=!0),this.element.find(".sortDisable")[0]!=i&&this.element.find(".sortDisable")[0].checked==!0&&(n(".measuresList_wrapper,.radioBtnAsc, .radioBtnDesc, .preserveHrchy").attr("disabled","disabled"),n(".measureListLbl, .orderLbl, .radioBtnAscLbl, .radioBtnDescLbl, .preserveHrchyLbl").addClass("sortFilterDisable"),this._dllSortMeasure.disable()),this.element.find(".filterDisable")[0]!=i&&this.element.find(".filterDisable")[0].checked==!0&&(n(".filterFrom, .filterTo").attr("disabled","disabled"),n(".filterMeasureListLbl, .conditionLbl, .filterValueLbl, .filterBtw").addClass("sortFilterDisable"),this._dllFilterCondition.disable(),this._dllfMeasuresList.disable()),this.element.find(".e-widget-content").height("auto"),d=!1,this._excelFilterInfo.length>0){var wr=this.element.find(".cubeSelector").length>0?this.element.find(".cubeSelector").data("ejDropDownList").model.value:"",it=this.element.find("#reportList").data("ejDropDownList").model.value,oi=this._selectedLevelUniqueName,si=this._selectedFieldName;this.model.analysisMode==t.Pivot.AnalysisMode.Olap?n.map(this._excelFilterInfo,function(n){n.cubeName==wr&&n.report==it&&(n.hierarchyUniqueName==si||n.levelUniqueName==oi)&&(d=!0)}):n.map(this._excelFilterInfo,function(n){n.report==it&&(n.hierarchyUniqueName==si||n.levelUniqueName==oi)&&(d=!0)})}if(f!=""&&f!=i&&u!=this._getLocalizedLabels("Measures")){if(g=null,!d&&this._currentReportItems.length!=0)for(rt=0;rt<this._currentReportItems.length;rt++)if(this._currentReportItems[rt]==this._currentItem){g=JSON.parse(JSON.stringify(this._treeViewData[this._currentItem]));break}g!=null&&d||(g=n.parseJSON(c));this.model.enableMemberEditorPaging&&u!=this._getLocalizedLabels("Measures")&&(this._editorTreeData=n.parseJSON(c),hi=this._editorTreeData.length,a=hi/this.model.memberEditorPageSize,a!=Math.round(a)&&(a=parseInt(a)+1),this._memberPageSettings.currentMemeberPage==a&&this.element.find(".nextPage, .lastPage").addClass("disabled"),this.element.find(".memberPageCount").html("/ "+a),this.element.find(".memberCurrentPage").val(this._memberPageSettings.currentMemeberPage));this._appendTreeViewData(this.model.enableMemberEditorPaging?t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).page(this._memberPageSettings.currentMemeberPage,this.model.memberEditorPageSize)):g,y);this.model.enableAdvancedFilter||this.element.find(".memberEditorDiv").css({height:"286px"});this.model.enableAdvancedFilter&&this.element.find("#clientDialog_wrapper").addClass("advancedFilterDlg")}this.element.find("#"+this._id+"_ClientDialog_closebutton").attr("title",this._getLocalizedLabels("Close"));this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide()},_appendTreeViewData:function(i,r){var f,u,e;if(this.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:this.model.enableRTL,nodeUncheck:function(i){var r=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),u,f;r._isMembersFiltered=!0;n(i.currentElement).parents(".e-treeview").find(".e-checkbox:checked").length!=0||r.model.enableMemberEditorPaging||r.element.find(".dialogOKBtn").data("ejButton").disable();r.model.operationalMode!=t.Pivot.OperationalMode.ClientMode&&r.model.enableMemberEditorPaging&&(u="",u=n(i.currentElement).parent().parent().hasClass("editorTreeView")&&!r._isSearchApplied?t.DataManager(r._editorTreeData).executeLocal(t.Query().page(r._memberPageSettings.currentMemeberPage,r.model.memberEditorPageSize).where("id","equal",i.currentElement.attr("id")))[0]:t.DataManager(r._editorTreeData).executeLocal(t.Query().where("id","equal",i.currentElement.attr("id")))[0],t.isNullOrUndefined(u)||(u.checkedStatus=!1,t.isNullOrUndefined(u.pid)||(f=t.DataManager(r._editorTreeData).executeLocal(t.Query().where("pid","equal",u.pid).where("checkedStatus","equal",!0)),t.isNullOrUndefined(f)||f.length!=0||t.Pivot._unSelectParentTreeNode(u,r))))},nodeCheck:function(i){var r=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),u,f,e;if(r._isMembersFiltered=!0,r.element.find(".dialogOKBtn").data("ejButton").enable(),r.element.find(".dialogOKBtn").removeAttr("disabled"),r.model.operationalMode!=t.Pivot.OperationalMode.ClientMode&&r.model.enableMemberEditorPaging&&(u="",u=n(i.currentElement).parent().parent().hasClass("editorTreeView")&&!r._isSearchApplied?t.DataManager(r._editorTreeData).executeLocal(t.Query().page(r._memberPageSettings.currentMemeberPage,r.model.memberEditorPageSize).where("id","equal",i.currentElement.attr("id")))[0]:t.DataManager(r._editorTreeData).executeLocal(t.Query().where("id","equal",i.currentElement.attr("id")))[0],!t.isNullOrUndefined(u)&&(u.checkedStatus=!0,t.isNullOrUndefined(u.pid)||t.Pivot._selectParentTreeNode(u,r),!t.isNullOrUndefined(u.id)&&(f=t.DataManager(r._editorTreeData).executeLocal(t.Query().where("pid","equal",u.id)),!t.isNullOrUndefined(f)&&f.length>0))))for(e=0;e<f.length;e++)f[e].checkedStatus=!0,t.Pivot._selectChildTreeNode(f[e],r)},beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:n(".memberEditorDiv").height(),fields:{id:"id",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus",dataSource:i},beforeExpand:t.proxy(this._onNodeExpand,this)}),f=this.element.find(".editorTreeView").find("li"),pivotClientObj._isSearchApplied)for(u=0;u<f.length;u++)t.isNullOrUndefined(n(f[u]).attr("id"))||n(f[u]).attr("tag",t.DataManager(i).executeLocal(t.Query().where("id","equal",n(f[u]).attr("id")))[0].tag);else for(u=0;u<f.length;u++)n(f[u]).attr("tag",i[u].tag);this._memberTreeObj=this.element.find(".editorTreeView").data("ejTreeView");e=n.grep(i,function(n){if(n.hasChildren==!0)return n}).length>0;e||this.element.find(".memberEditorDiv").addClass("noChildNode");this.element.find(".editorTreeView").height(256);r||!this.model.enableAdvancedFilter||t.isNullOrUndefined(this._memberTreeObj)||(t.isNullOrUndefined(this.element.find(".e-treeview li[tag='"+this._selectedLevelUniqueName+"']").attr("labelFiltering"))||this._memberTreeObj.element.find("."+this.element.find(".e-treeview li[tag='"+this._selectedLevelUniqueName+"']").attr("labelFiltering").split("--")[1].replace(" ","")+" a").append(t.buildTag("div.activeFilter").addClass("e-icon")[0].outerHTML),this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").hide(),this._groupLabelChange({selectedValue:this.element.find(".groupLabelDrop").data("ejDropDownList").model.value||this.element.find(".groupLabelDrop").data("ejDropDownList").model.dataSource[0].value}),this.element.find(".memberEditorDiv").height(286),this.element.find(".editorTreeView").height(256))},_createMeasureEditor:function(t){var u,f,r;for(u=t[0]!=i?n.parseJSON(t[0].Value):t.d!=i?n.parseJSON(t.d[0].Value):n.parseJSON(t.EditorTreeInfo),f="",r=0;r<u.length;r++)f+='<div id="'+u[r].uniqueName+'"class=measureEditor>'+u[r].name+"<span class='removeMeasure e-icon' role='button' aria-label='remove'><\/span><\/div>";return f},_onNodeExpand:function(r){for(var o,e,s,f=r.targetElement,h=t.buildTag("span.nodeExpand e-load e-icon")[0].outerHTML,c=n(f).parents("li").first().children().find("li").length,u=0;u<this._memberTreeObj.dataSource().length;u++)if(this._memberTreeObj.dataSource()[u].parentId==r.id){r.isChildLoaded=!0;t.Pivot.closePreventPanel(this);return}if(!t.isNullOrUndefined(this)&&this.model.enableMemberEditorPaging&&t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",r.id)).length>0){r.isChildLoaded=!0;t.Pivot.closePreventPanel(this);this.pNode=f;this._fetchChildNodeSuccess({ChildNodes:JSON.stringify(t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",r.id))),customObject:this.model.customObject});return}if(!r.isChildLoaded){if(n(f).parents("li").first().prepend(h),o=n(f).parent().find("input.e-checkbox").prop("checked"),e=n(f).parents("li").first().attr("tag"),e==i)for(u=0;u<this._memberTreeObj.dataSource().length;u++)if(this._memberTreeObj.dataSource()[u].id==r.id){e=this._memberTreeObj.dataSource()[u].tag;n(r.currentElement[0]).attr("tag",this._memberTreeObj.dataSource()[u].tag);break}this.pNode=f;this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});s=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.memberExpand,JSON.stringify({action:"memberExpanded",checkedStatus:o,parentNode:n(f).parents("li")[0].id,tag:e,dimensionName:this._dimensionName,cubeName:this.currentCubeName,olapReport:this.currentReport,clientReports:this.reports,customObject:s}),this._fetchChildNodeSuccess)}},_onActiveConditionChange:function(t){t.selectedValue=="Between"||t.selectedValue=="NotBetween"?(n(".filterTo").removeAttr("disabled"),n(".filterBtw").removeClass("sortFilterDisable")):(n(".filterTo").attr("disabled","disabled"),this.element.find(".filterTo").val(""),n(".filterBtw").addClass("sortFilterDisable"))},_reSizeHandler:function(i){t.isNullOrUndefined(this)||(this._parentHeight=n(i.target).height(),this.element.height(this._parentHeight),this._calculateHeight(),this._parentElwidth=n("#"+this._id).parent().width(),(this._parentElwidth<850||this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this._parentElwidth<910)&&this._rwdToggleCollapse(),(this._parentElwidth>850||this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this._parentElwidth>910)&&this._rwdToggleExpand(),this.model.isResponsive&&this.model.enableSplitter&&this.element.find(".splitresponsive").data("ejSplitter").refresh(),this._overflow(),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),n("#"+this._pivotChart._id+"Container").height(this._chartHeight),t.isNullOrUndefined(this.chartObj)||(this.chartObj.model.size.height=this._chartHeight),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw())))},_chartDrillSuccess:function(r){var h,e,f,s,u;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(this._isGridDrillAction)this._isGridDrillAction=!1;else{this._isGridDrillAction=!1;this._isChartDrillAction=!0;h=this._pivotChart._selectedItem;e=this._pivotChart._drillAction;e=="drilldown"?t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers)||this._drillParams.indexOf(this._pivotChart._labelCurrentTags.expandedMembers.join(">#>"))!=-1||this._drillParams.push(this._pivotChart._labelCurrentTags.expandedMembers.join(">#>")):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(h)<0});var o=this._pivotChart.model.enableMultiLevelLabels?r.drilledMember.split(">#>"):e=="drilldown"?this._pivotChart._labelCurrentTags.expandedMembers:this._pivotChart._currentDrillInfo,c=0,l=this._pivotGrid._rowCount;for(f=0;f<o.length;f++)s=f==o.length-1&&e=="drilldown"?this.element.find(".e-pivotgrid .pivotGridTable th.summary[p^='"+f+"']"):this.element.find(".e-pivotgrid .pivotGridTable th.rowheader[p^='"+f+"']"),u=n.grep(s,function(t){return n(t).clone().children().remove().end().text()==o[f]}),u=n.grep(u,function(t){return parseInt(n(t).attr("p").split(",")[1])>=c&&parseInt(n(t).attr("p").split(",")[1])<=l}),f==o.length-1?n(u).find("."+(e=="drilldown"?"expand":"collapse")).trigger("click"):(c=parseInt(n(u).attr("p").split(",")[1]),l=c+(t.isNullOrUndefined(n(u).find("span").attr("tag"))?0:parseInt(n(u).find("span").attr("tag")))+u[0].rowSpan);o.length==0&&(s=this.element.find(".e-pivotgrid .pivotGridTable th.rowheader[p^='0']"),u=n.grep(s,function(t){return n(t).clone().children().remove().end().text()==h}),n(u).find(".collapse").trigger("click"))}else this.currentReport!=i&&(currentReport=this.currentReport),this.reports!=i&&(reports=this.reports),this._pivotChart._startDrilldown&&this._pivotGrid!=null&&this._pivotGrid!=i?this._renderPivotGrid(this._pivotChart._selectedTagInfo):this._pivotGrid!=i&&this._pivotGrid.element.find("table")=="block"&&(this._isTimeOut=!1,this._waitingPopup.hide())},_treemapDrillSuccess:function(){this.currentReport!=i&&(currentReport=this.currentReport);this.reports!=i&&(reports=this.reports);this.otreemapObj._startDrilldown&&this._pivotGrid!=null&&this._pivotGrid!=i?this._renderPivotGrid(this.otreemapObj._selectedTagInfo):this._pivotGrid!=i&&this._pivotGrid.element.find("table")=="block"&&(this._isTimeOut=!1,this._waitingPopup.hide());t.isNullOrUndefined(this.chartObj)||(this.model.displaySettings.enableFullScreen||this.enableTogglePanel()&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap")&&(n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"}),this.otreemapObj._treeMap.refresh())},_gridDrillSuccess:function(r){var s,c,l,a,f,o,e,u,h;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(this._isChartDrillAction)this._isChartDrillAction=!1;else{if(this._isGridDrillAction=!0,this._isChartDrillAction=!1,r.axis=="rowheader"&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly){r.drillAction=="drilldown"?this._drillParams.push(r.drilledMember):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(r.drilledMember)<0});s=r.drilledMember.split(">#>");this._pivotChart._labelCurrentTags.expandedMembers=s;r.drillAction=="drillup"&&(this._pivotChart._labelCurrentTags.expandedMembers=[],this._drillParams.length>0&&this._getDrilledMember(r.drillAction),s=this._pivotChart._labelCurrentTags.expandedMembers);s=this._pivotChart.model.enableMultiLevelLabels?r.drillAction=="drillup"?r.drilledMember.split(">#>").slice(0,-1):r.drilledMember.split(">#>"):s;this._pivotChart._drillAction=r.drillAction;this._pivotChart._drillParams=this._drillParams;try{c=JSON.parse(this.currentReport).Report}catch(v){c=this.currentReport}this._pivotChart.model.enableMultiLevelLabels?this._pivotChart._generateData({JsonRecords:this.getJSONRecords(),PivotReport:this.getOlapReport()}):(l=JSON.stringify(this.model.customObject),a={action:r.drillAction,currentReport:c,drilledSeries:JSON.stringify(s),clientReports:this.reports,customObject:l},this._pivotChart.doAjaxPost("POST",this.model.url+"/"+this._pivotChart.model.serviceMethodSettings.drillDown,JSON.stringify(a),this._pivotChart.renderControlSuccess))}else this._isGridDrillAction=!1;return}if(this.currentReport!=i&&(currentReport=this.currentReport),this.reports!=i&&(reports=this.reports),this._pivotGrid._startDrilldown&&!t.isNullOrUndefined(this._pivotChart)){if(o=this._pivotGrid._drillCaption,this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.model.displaySettings.enableFullScreen&&n("#"+this._id+"_maxView").length>0?n("#"+this._id+"_maxView").find("#"+this._pivotChart._id+"Container").data("ejChart"):this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),u=this,!t.isNullOrUndefined(this.chartObj))if(this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap")jQuery.each(this._pivotChart._labelCurrentTags,function(n,t){t!=i&&t.name==o&&(e=t.tag,f=t)}),this._pivotChart._drillAction=this._pivotGrid._drillAction,this._pivotChart._selectedItem=o,this._pivotGrid._drillAction!="drilldown"||t.isNullOrUndefined(f)?t.isNullOrUndefined(f)||(jQuery.each(this.element.find(".rowAxis").find("button"),function(n,t){t.innerHTML==f.tag.split("[")[1].split("]")[0]&&(u._pivotChart._dimensionIndex=n)}),jQuery.each(this._pivotChart._tagCollection,function(n,t){if(t!=i&&t.name==o)return u._pivotChart._selectedIndex=n+u._pivotChart._dimensionIndex,u._pivotChart._tagCollection.splice(n,u._pivotChart._tagCollection.length),!1})):this._pivotChart._tagCollection.push(f),e!=null&&e!=i?this._renderPivotChart(e,this._pivotGrid._drillAction):(this._isTimeOut=!1,this._waitingPopup.hide());else{for(h=0;h<this.otreemapObj.getJsonRecords().labelTags.length;h++)if(this.otreemapObj.getJsonRecords().labelTags[h].split("::")[2]==o){e=this.otreemapObj.getJsonRecords().labelTags[h];break}this.otreemapObj_currentAction=this._pivotGrid._drillAction;this.otreemapObj._selectedItem=o;this._pivotGrid._drillAction!="drilldown"||t.isNullOrUndefined(f)?t.isNullOrUndefined(f)||(jQuery.each(this.element.find(".rowAxis").find("button"),function(n,t){t.innerHTML==f.tag.split("[")[1].split("]")[0]&&(u.otreemapObj._dimensionIndex=n)}),jQuery.each(this.otreemapObj._tagCollection,function(n,t){if(t!=i&&t.name==o)return u.otreemapObj._selectedIndex=n+u.otreemapObj._dimensionIndex,u.otreemapObj._tagCollection.splice(n,u.otreemapObj._tagCollection.length),!1})):this.otreemapObj._tagCollection.push(f);e!=null&&e!=i?this._renderPivotTreeMap(e,this._pivotGrid._drillAction):(this._isTimeOut=!1,this._waitingPopup.hide())}}else n("#"+this._waitingPopup._id+"_WaitingPopup")[0].style.display=="block"&&(this._isTimeOut=!1,this._waitingPopup.hide())},_nodeDropped:function(r){var f=n(r.dropTarget).hasClass("pvtBtn")&&n(r.dropTarget).parent("div.splitBtn").length>0?n(r.dropTarget).parent("div.splitBtn"):n(r.dropTarget),s,u,o,e,h,c;if(pivotClientObj=this,f.prevObject!=i?f.prevObject.removeClass("targetAxis"):n(f).removeClass("targetAxis"),isDragging=!1,s=this._setSplitBtnTargetPos(r.event),f.prevObject!=i?f.prevObject.parents().find(".e-dialog").hide():n(f).parents().find(".e-dialog").hide(),u=null,n(f).hasClass("splitBtn"))u=n(f).parents("div:eq(0)").attr("class");else if(r.event.type=="touchend")u=f[0].className;else if(r.event.target!=i){if(r.event.target.className==i||r.event.target.className==null||n(r.event.target).parents(".chartContainer").length>0)return!1;u=r.event.target.className.toLowerCase().indexOf("splitbtn")>-1||n(r.event.target).hasClass("e-button")?n(f).attr("class"):r.event.target.className}else u=r.event.originalEvent.srcElement.className.toLowerCase().indexOf("splitbtn")>-1?f[0].className:r.event.originalEvent.srcElement.className;if(delete pivotClientObj._fieldMembers[pivotClientObj._dialogTitle],delete pivotClientObj._fieldSelectedMembers[pivotClientObj._dialogTitle],o=u.indexOf("categoricalAxis")>u.indexOf("rowAxis")?u.indexOf("categoricalAxis")>u.indexOf("slicerAxis")?"Categorical":"Slicer":u.indexOf("rowAxis")>u.indexOf("slicerAxis")?"Series":u.indexOf("slicerAxis")>=0?"Slicer":null,e=n(r.droppedElement).attr("tag"),o=="Slicer"&&e!=null&&e.indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1||o=="Slicer"&&e.indexOf("Measure")>-1&&n(r.droppedElement).find(".calcMemberCDB").length>0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1&&n(r.droppedElement).attr("tag").replace(/\[/g,"").replace(/\]/g,"")!=this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").attr("tag").split(":")[1].split("::")[0]||o=="Slicer"&&e.indexOf("Measure")>-1&&n(r.droppedElement).find(".calcMemberCDB").length==0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1||o=="Slicer"&&e.indexOf("Measure")>-1&&n(r.droppedElement).find(".calcMemberCDB").length==1&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==0&&this.element.find(".splitBtn[tag*=Measure]").length==1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;o!=null&&e!="Measures"&&e.lastIndexOf(".DF")!=e.length-3&&(o=="Slicer"&&(e.indexOf("Measures")>=0||n(r.droppedElement[0].childNodes[0]).find(".namedSetCDB").length>0)||(this._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),h=JSON.stringify(this.model.customObject),c=pivotClientObj.currentCubeName+"--"+n(r.droppedElement).attr("tag")+"--"+o+"--"+s,pivotClientObj.doAjaxPost("POST",pivotClientObj.model.url+"/"+pivotClientObj.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:c,olapReport:pivotClientObj.currentReport,clientReports:pivotClientObj.reports,customObject:h}),pivotClientObj._nodeDroppedSuccess)));pivotClientObj._isRemoved=!0;pivotClientObj._isNodeOrButtonDropped=!0},_setSplitBtnTargetPos:function(t){var o="",e,r,u,f;if(t.event!=i&&t.event.type=="touchend"?(r=t.event.originalEvent.target!=null?n(t.event.originalEvent.target).parents(".splitBtn"):n(t.event.originalEvent.srcElement).parents(".splitBtn"),u=t.event.originalEvent.target!=null?t.event.originalEvent.target.className:t.event.originalEvent.srcElement.className):(r=t.originalEvent.target!=null?n(t.originalEvent.target).parents(".splitBtn"):n(t.originalEvent.srcElement).parents(".splitBtn"),u=t.originalEvent.target!=null?t.originalEvent.target.className:t.originalEvent.srcElement.className),r[0]||u!=i&&u!=null&&jQuery.type(u)=="string"&&u.indexOf("splitBtn")>-1)if(r=r[0]?r[0]:t.originalEvent.target!=null?t.originalEvent.target:t.originalEvent.srcElement,e=t.event!=i&&t.event.type=="touchend"?t.target:this._dropAxisClassName!=null&&this._dropAxisClassName!=i&&this._dropAxisClassName!=""?this.element.find("."+this._dropAxisClassName)[0]:r.parentNode,e!=i)for(f=0;f<n(e).find(".splitBtn").length;f++)n(e).find(".splitBtn")[f]==r&&(o=f);else this._dropAxisClassName="";return o},_cubeChanged:function(n){if(pivotClientObj=this,this._currentRecordName="",this._fieldMembers={},this._fieldSelectedMembers={},this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),this.currentCubeName==n.text)return!1;this.currentCubeName=n.text;pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"cubeChanged",element:this.element,customObject:this.model.customObject});var i=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.cubeChanged,JSON.stringify({action:"cubeChanged",cubeName:this.currentCubeName,customObject:i,clientParams:JSON.stringify(this.model.enableMeasureGroups)}),this._cubeChangedSuccess)},_measureGroupChanged:function(n){var t,i;this._isTimeOut=!0;t=this;setTimeout(function(){t._isTimeOut&&t._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"cubeChanged",element:this.element,customObject:this.model.customObject});i=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.measureGroupChanged,JSON.stringify({action:"measureGroupChanged",measureGroupName:n.text,olapReport:this.currentReport,clientReports:this.reports,customObject:i}),this._measureGroupChangedSuccess)},_reportChanged:function(i){var u,r,f;if(this._fieldMembers={},this._fieldSelectedMembers={},pivotClientObj=this,u=this.element.find("#reportList").data("ejDropDownList"),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode)r=n.map(this._clientReportCollection,function(n){if(n.reportName==u.getValue())return n}),this.model.dataSource=r[0],this._currentItem!="Rename Report"&&(this.refreshControl(),this._pivotSchemaDesigner._refreshPivotButtons()),this._isTimeOut=!1,this._waitingPopup.hide();else if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(!this._isReportListAction)return;pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);r=n.map(this._clientReportCollection,function(n){if(n.name==u.getValue())return n});this._currentReportName=r[0].name;this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:this.model.customObject});f=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"Change Report",args:JSON.stringify({currentReport:r[0].report}),customObject:f}),this._toolbarOperationSuccess)}else i.selectedText!=this._selectedReport&&(pivotClientObj._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:this.model.customObject}),f=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:"Report Change",clientInfo:i.text,olapReport:null,clientReports:this.reports,customObject:f}),this._toolbarOperationSuccess));this._selectedReport=u._currentText},_onDropped:function(n){if(n.target.className.indexOf("e-button")>-1){var t=this._getAxisPosition(this.element.find(".categoricalAxis")),r=this._getAxisPosition(this.element.find(".rowAxis")),u=this._getAxisPosition(this.element.find(".slicerAxis"));this._dropAxisClassName;n.pageX!=i&&n.pageY!=i&&(this._dropAxisClassName=n.pageX>t.left&&n.pageX<t.right&&n.pageY>t.top&&n.pageY<t.bottom?"categoricalAxis":n.pageX>r.left&&n.pageX<r.right&&n.pageY>r.top&&n.pageY<r.bottom?"rowAxis":n.pageX>u.left&&n.pageX<u.right&&n.pageY>u.top&&n.pageY<u.bottom?"slicerAxis":"outOfAxis")}},_getAxisPosition:function(t){var r=t.position(),i={};return i.top=r.top,i.right=r.left+n(t).width(),i.bottom=r.top+n(t).height(),i.left=r.left,i},_onTabClick:function(i){this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this._currentTab="chart";n(i.activeHeader).find("a").text()==this._getLocalizedLabels("Grid")?(this._currentTab="grid",this.element.find(".chartTypesImg").addClass("chartTypesOnGridView"),this.element.find(".gridPanel").css("display","inline")):t.isNullOrUndefined(this.chartObj)||(this._currentTab="chart",this.element.find(".chartTypesImg").removeClass("chartTypesOnGridView"),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()),this.model.enableToolBar&&(this._unWireEvents(),this._wireEvents()))},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,dataType:c,async:a,data:f,success:l,complete:t.proxy(function(){var n={action:!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(s.action)?s.action:JSON.parse(f).action,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",n)},this),error:t.proxy(function(t){this._waitingPopup=n("#"+this._id).data("ejWaitingPopup");this._isTimeOut=!1;this._waitingPopup.hide();var i={customObject:this.model.customObject,element:this.element,Message:t};this._trigger("renderFailure",i);this._renderControlSuccess("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotClient.Locale={};t.PivotClient.Locale["en-US"]={NoReports:"No Reports Found in DB",Sort:"Sort",Search:"Search",SelectField:"Select field",LabelFilterLabel:"Show the items for which the label",ValueFilterLabel:"Show the items for which",ClearSorting:"Clear Sorting",ClearFilterFrom:"Clear Filter From",SortAtoZ:"Sort A to Z",SortZtoA:"Sort Z to A",LabelFilters:"Label Filters ",BeginsWith:"Begins With",DoesNotBeginsWith:"Does Not Begins With",EndsWith:"Ends With",NotEndsWith:"Not Ends With",DoesNotEndsWith:"Does Not Ends With",Contains:"Contains",DoesNotContains:"Does Not Contains",ValueFilters:"Value Filters",ClearFilter:"Clear Filter",Equals:"Equals",DoesNotEquals:"Does Not Equals",NotEquals:"Not Equals",GreaterThan:"Greater Than",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between",Top10:"Top Count",GreaterThan:"Greater Than",IsGreaterThan:"Is Greater Than",IsGreaterThanOrEqualTo:"Is Greater Than Or Equal To",IsLessThan:"Is Less Than",IsLessThanOrEqualTo:"Is Less Than Or Equal To",DeferUpdate:"Defer Update",MDXQuery:"MDX Query",Column:"Column",Row:"Row",Slicer:"Slicer",CubeSelector:"Cube Selector",ReportName:"Report Name",NewReport:"New Report",CubeDimensionBrowser:"Cube Dimension Browser",AddReport:"Add Report",RemoveReport:"Remove Report",CannotRemoveSingleReport:"Can not remove single report",AreYouSureToDeleteTheReport:"Are you sure to delete the Report",RenameReport:"Rename Report",ChartTypes:"Chart Types",ToggleAxis:"Toggle Axis",Load:"Load",ExportToExcel:"Export To Excel",ExportToWord:"Export To Word",ExportToPdf:"Export To Pdf",FullScreen:"Full Screen",Grid:"Grid",Chart:"Chart",OK:"<u>O<\/u>K",Cancel:"<u>C<\/u>ancel",Close:"Close",AddToColumn:"Add to Column",AddToRow:"Add to Row",AddToSlicer:"Add to Slicer",MeasureEditor:"Measure Editor",MemberEditor:"Member Editor",Measures:"Measures",SortOrFilterColumn:"Sort/Filter (Column)",SortOrFilterRow:"Sort/Filter (Row)",SortingAndFiltering:"Sorting And Filtering",Sorting:"Sorting",Measure:"<u>M<\/u>easure",Order:"Order",Filtering:"Filtering",Condition:"C<u>o<\/u>ndition",Value:"Val<u>u<\/u>e",PreserveHierarchy:"P<u>r<\/u>eserve Hierarchy",Ascending:"<u>A<\/u>scending",Descending:"D<u>e<\/u>scending",Enable:"E<u>n<\/u>able",Disable:"D<u>i<\/u>sable",and:"<u>a<\/u>nd",EqualTo:"EqualTo",NotEquals:"NotEquals",GreaterThan:"GreaterThan",GreaterThanOrEqualTo:"GreaterThanOrEqualTo",LessThan:"LessThan",LessThanOrEqualTo:"LessThanOrEqualTo",Between:"Between",NotBetween:"NotBetween",ReportList:"Report List",Line:"Line",Spline:"Spline",Column:"Column",Area:"Area",SplineArea:"Spline Area",StepLine:"Step Line",StepArea:"Step Area",Pie:"Pie",Bar:"Bar",StackingArea:"Stacking Area",StackingColumn:"Stacking Column",StackingBar:"Stacking Bar",Pyramid:"Pyramid",Funnel:"Funnel",Doughnut:"Doughnut",Scatter:"Scatter",Bubble:"Bubble",WaterFall:"WaterFall",TreeMap:"TreeMap",Alert:"Alert",MDXAlertMsg:"Please add a measure, dimension or hierarchy in an appropriate axis to view the MDX Query.",FilterSortRowAlertMsg:"Dimension not found in row axis. Please add Dimension element in row axis for sorting/filtering.",FilterSortColumnAlertMsg:"Dimension not found in column axis. Please add Dimension element in column axis for sorting/filtering.",FilterSortcolMeasureAlertMsg:"Please add measure to the Column axis",FilterSortrowMeasureAlertMsg:"Please add measure to the Row axis",FilterSortElementAlertMsg:"Element not found in column axis. Please add an element in column axis for sorting/filtering.",SelectRecordAlertMsg:"Please select a valid report.",FilterMeasureSelectionAlertMsg:"Please select a valid measure.",FilterConditionAlertMsg:"Please set a valid condition.",FilterStartValueAlertMsg:"Please set a start value.",FilterEndValueAlertMsg:"Please set a end value.",FilterInvalidAlertMsg:"Invalid operation !",Remove:"Remove",Save:"Save",SaveAs:"Save As",SelectReport:"Select Report",DBReport:"Report Manipulation in DB",Rename:"Rename",Remove:"Remove",SetReportNameAlertMsg:"Please set report name.",MultipleItems:"Multiple items",All:"All",CalculatedMember:"Calculated Member",Caption:"Caption:",Expression:"Expression:",MemberType:"MemberType:",FormatString:"Format String:",MultipleMeasure:"More than one measure cannot be sliced.",DuplicateCalcMeasure:"Calculated Member with same name already exist.",EmptyField:"Calculated Member name or Expression cannot be empty.",EmptyFormat:"Format String for Calculated Member is empty.",Warning:"Warning",Confirm:"Calculated Member with the same name already exists. Due to want to Replace ?"};t.PivotClient.ControlPlacement={Tab:"tab",Tile:"tile"};t.PivotClient.DisplayMode={ChartOnly:"chartonly",GridOnly:"gridonly",ChartAndGrid:"chartandgrid"};t.PivotClient.ClientExportMode={ChartAndGrid:"chartandgrid",ChartOnly:"chartonly",GridOnly:"gridonly"};t.PivotClient.ExportMode={JSON:"json",PivotEngine:"pivotengine"};t.PivotClient.DefaultView={Chart:"chart",Grid:"grid"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotChart","ej.PivotChart",{_rootCSS:"e-pivotchart",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:n.extend(t.datavisualization.Chart.prototype.defaults,{url:"",analysisMode:"pivot",operationalMode:"clientmode",cssClass:"",currentReport:"",customObject:{},enableRTL:!1,isResponsive:!1,enable3D:!1,enableContextMenu:!1,enableMultiLevelLabels:!1,rotation:0,serviceMethodSettings:{initialize:"InitializeChart",drillDown:"DrillChart",exportPivotChart:"Export",paging:"paging"},dataSource:{data:null,sourceInfo:"",providerName:"ssas",isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},locale:null,drillSuccess:null,load:null,beforeServiceInvoke:null,afterServiceInvoke:null,renderComplete:null,renderFailure:null,renderSuccess:null,beforeExport:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},marker:"data",crossHair:"data",size:"data",serviceMethodSettings:{initialize:"enum",drillDown:"enum",exportPivotChart:"enum",paging:"enum"},zooming:"data",customObject:"data"},observables:["title.text","commonSeriesOptions.type","locale"],titleText:t.util.valueFunction("title.text"),seriesType:t.util.valueFunction("commonSeriesOptions.type"),locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(t){this._JSONRecords=n.parseJSON(t)},getPivotEngine:function(){return this._pivotEngine},setPivotEngine:function(n){this._pivotEngine=n},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this._pivotEngine=null;this.element.empty().removeClass("e-pivotchart"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._currentAction="initialize";this._selectedItem="";this._selectedIndex=-1;this._selectedTagInfo=null;this._tagCollection=[];this._selectedTags=[];this._labelCurrentTags=[];this._startDrilldown=!1;this._drillAction="";this._initZooming=!1;this._dimensionIndex=-1;this._selectedMenuItem="";this._pivotEngine=null;this._curFocus=null;this._drillParams=[];this._currentDrillInfo=[];this._selectedSeriesInfo=[];this._waitingPopup=null;this._pivotClientObj=null},_load:function(){var r,u;if(this.model.locale=this.model.locale||"en-US",r={action:"initialize",element:this.element,customObject:this.model.customObject},this._trigger("load",r),this.element.addClass(this.model.cssClass),n(this.element).parents(".e-pivotclient").length>0?(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+this._pivotClientObj._id+"_maxView")[0]?n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):(this.element.ejWaitingPopup({showOnInit:!0}),this._waitingPopup=this.element.data("ejWaitingPopup"),this._waitingPopup.show()),this.model.zooming!=""&&(this._initZooming=!0),this.model.dataSource.data==null&&this.model.url!=""||this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){if(this.model.operationalMode=t.PivotChart.OperationalMode.ServerMode,this.model.url==""){this.renderChartFromJSON("");return}this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._currentAction,element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize",currentReport:this.model.currentReport,customObject:u}),this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._generateData:this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize"}),this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._generateData:this.renderControlSuccess)}else this.model.operationalMode=t.PivotChart.OperationalMode.ClientMode,this.model.analysisMode=this.model.dataSource.cube!=""?t.PivotChart.AnalysisMode.Olap:t.PivotChart.AnalysisMode.Pivot,this.refreshControl()},refreshControl:function(){var r,u,f,i;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(t.PivotAnalysis.setFieldCaptions(this.model.dataSource),r=t.PivotAnalysis.pivotEnginePopulate(this.model),u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this._pivotEngine=r.pivotEngine,r.pivotEngine.length>0)if(t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)||this.model.enableMultiLevelLabels)this._generateData(this._pivotEngine);else{for(f=this._cloneEngine(this._pivotEngine),i=0;i<this._labelCurrentTags.expandedMembers.length;i++)this._cropData(f,this._labelCurrentTags.expandedMembers[i],0,!0);this._generateData(f)}else t.isNullOrUndefined(this._waitingPopup)||(t.isNullOrUndefined(u)||(u._isTimeOut=!1),this._waitingPopup.hide());else t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)},_setFirst:!0,_setModel:function(t){var r=this.element.find("#"+this._id+"Container").data("ejChart"),i,u;for(i in t)switch(i){case"olapReport":this.setOlapReport(t[i]);break;case"jsonData":this.setJSONRecords(t[i]);break;case"refreshPivotChart":this.element.renderChartFromJSON(t[i]);break;case"customObject":this.model.customObject=t[i];break;case"height":this.model.size.height=t[i];break;case"width":this.model.size.width=t[i];break;case"commonSeriesOptions":if(r)for(r.model.commonSeriesOptions=t[i],r.model.type=r.model.commonSeriesOptions.type=this.seriesType(),u=0;u<r.model.series.length;u++)r.model.series[u].type=r.model.type;break;case"title":r&&(r.model.title.text=this.titleText());break;case"animation":this.model.animation=t[i];break;case"crossHair":this.model.crossHair=t[i];break;case"marker":this.model.marker=t[i];break;case"zooming":this.model.zooming=t[i];break;case"legend":this.model.legend=t[i];break;case"primaryXAxis":this.model.primaryXAxis=t[i];break;case"primaryYAxis":this.model.primaryYAxis=t[i];break;case"locale":this.locale();break;default:n.extend(!0,this.model,{},t[i])}r&&this.renderControlSuccess({JsonRecords:JSON.stringify(this.getJSONRecords()),OlapReport:this.getOlapReport()})},_keyDownPress:function(n){var u,r,i;n.which!==13||t.isNullOrUndefined(this._curFocus)||this._curFocus.click();(n.which===39||n.which===37||n.which===38||n.which===40)&&this.element.find(".e-dialog").length>0&&(n.preventDefault(),u=this.element.find(".e-dialog"),u.tabindex=-1,u.focus(),r=u.find("li"),n.which===39||n.which===40?(t.isNullOrUndefined(this._curFocus)?this._curFocus=r.eq(0):(this._curFocus.removeClass("hoverCell"),i=this._curFocus.next(),this._curFocus=i.length>0?i:r.eq(0)),this._curFocus.addClass("hoverCell")):(n.which===37||n.which===38)&&(t.isNullOrUndefined(this._curFocus)?this._curFocus=r.last():(this._curFocus.removeClass("hoverCell"),i=this._curFocus.prev(),this._curFocus=i.length>0?i:r.last()),this._curFocus.addClass("hoverCell")))},_wireEvents:function(){if(this._on(n(document),"keydown",this._keyDownPress),!this.model.enableContextMenu||this.element.parents(".e-pivotclient").length>0||this._on(this.element,"contextmenu","#"+this._id+"Container",t.proxy(function(){var u="<li class='chartTypes'><a>"+this._getLocalizedLabels("ChartTypes")+"<\/a><ul><li class='line'><a>"+this._getLocalizedLabels("Line")+"<\/a><\/li><li class='spline'><a>"+this._getLocalizedLabels("Spline")+"<\/a><\/li><li class='column'><a>"+this._getLocalizedLabels("Column")+"<\/a><\/li><li class='area'><a>"+this._getLocalizedLabels("Area")+"<\/a><\/li><li class='splinearea'><a>"+this._getLocalizedLabels("SplineArea")+"<\/a><\/li><li class='stepline'><a>"+this._getLocalizedLabels("StepLine")+"<\/a><\/li><li class='steparea'><a>Step Area<\/a><\/li><li class='pie'><a>Pie<\/a><\/li><li class='bar'><a>Bar<\/a><\/li><li class='stackingarea'><a>Stacking Area<\/a><\/li><li class='stackingcolumn'><a>"+this._getLocalizedLabels("StackingColumn")+"<\/a><\/li><li class='stackingbar'><a>"+this._getLocalizedLabels("StackingBar")+"<\/a><\/li><li class='funnel'><a>"+this._getLocalizedLabels("Funnel")+"<\/a><\/li><li class='pyramid'><a>"+this._getLocalizedLabels("Pyramid")+"<\/a><\/li><li class='doughnut'><a>"+this._getLocalizedLabels("Doughnut")+"<\/a><\/li><li class='scatter'><a>"+this._getLocalizedLabels("Scatter")+"<\/a><\/li><li class='bubble'><a>"+this._getLocalizedLabels("Bubble")+"<\/a><\/li><\/ul><\/li>",f="<li class='chart3DTypes'><a>"+this._getLocalizedLabels("TDCharts")+"<\/a><ul><li class='column'><a>"+this._getLocalizedLabels("ColumnTD")+"<\/a><\/li><li class='pie'><a>"+this._getLocalizedLabels("PieTD")+"<\/a><\/li><li class='bar'><a>"+this._getLocalizedLabels("BarTD")+"<\/a><\/li><li class='stackingbar'><a>"+this._getLocalizedLabels("StackingBarTD")+"<\/a><\/li><li class='stackingcolumn'><a>"+this._getLocalizedLabels("StackingColumnTD")+"<\/a><\/li><li class='disable3D'><a>"+this._getLocalizedLabels("DisableTD")+"<\/a><\/li><\/ul><\/li>",e="<li class='exportTypes'><a>"+this._getLocalizedLabels("Exporting")+"<\/a><ul><li class='excel'><a>"+this._getLocalizedLabels("Excel")+"<\/a><\/li><li class='word'><a>"+this._getLocalizedLabels("Word")+"<\/a><\/li><li class='pdf'><a>"+this._getLocalizedLabels("Pdf")+"<\/a><\/li><li class='png'><a>"+this._getLocalizedLabels("PNG")+"<\/a><\/li><li class='emf'><a>"+this._getLocalizedLabels("EMF")+"<\/a><\/li><li class='gif'><a>"+this._getLocalizedLabels("GIF")+"<\/a><\/li><li class='jpg'><a>"+this._getLocalizedLabels("JPG")+"<\/a><\/li><li class='bmf'><a>"+this._getLocalizedLabels("BMP")+"<\/a><\/li><\/ul><\/li>",o="<li class='smartLabels'><a>"+this._getLocalizedLabels("SmartLabels")+"<\/a><ul><li class='rotate45'><a>"+this._getLocalizedLabels("Rotate45")+"<\/a><\/li><li class='rotate90'><a>"+this._getLocalizedLabels("Rotate90")+"<\/a><\/li><li class='trim'><a>"+this._getLocalizedLabels("Trim")+"<\/a><\/li><li class='multipleRows'><a>"+this._getLocalizedLabels("MultipleRows")+"<\/a><\/li><li class='wrap'><a>"+this._getLocalizedLabels("Wrap")+"<\/a><\/li><li class='hiding'><a>"+this._getLocalizedLabels("Hide")+"<\/a><\/li><li class='wrapByWord'><a>"+this._getLocalizedLabels("WrapByWord")+"<\/a><\/li><\/ul><\/li>",s="<li class='interaction'><a>"+this._getLocalizedLabels("Interactions")+"<\/a><ul><li class='crossHair'><a>"+this._getLocalizedLabels("CrossHair")+"<\/a><\/li><li class='trackBall'><a>"+this._getLocalizedLabels("TrackBall")+"<\/a><\/li><li class='none'><a>"+this._getLocalizedLabels("None")+"<\/a><\/li><\/ul><\/li>",h=t.buildTag("ul#"+this._id+"_ContextMenu",t.buildTag("li.toolTip",t.buildTag("a",this._getLocalizedLabels("Tooltip"))[0].outerHTML)[0].outerHTML+t.buildTag("li.legend",t.buildTag("a",this._getLocalizedLabels("Legend"))[0].outerHTML)[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.zooming",t.buildTag("a",this._getLocalizedLabels("Zooming"))[0].outerHTML)[0].outerHTML)+u+f+e+(this.model.enable3D?"":s+o))[0].outerHTML,r,i;n("#"+this._id).append(h);r=this.element.find("#"+this._id+"Container");this.element.find("#"+this._id+"_ContextMenu").ejMenu({width:"150px",menuType:t.MenuType.ContextMenu,contextMenuTarget:r,enableRTL:this.model.enableRTL,click:t.proxy(this._contextMenuClick,this)});i=t.buildTag("span.enabledState").addClass("e-icon").attr("aria-label",this._getLocalizedLabels("EnabledState"))[0].outerHTML;this.model.enable3D?n("#"+this._id+"_ContextMenu").find(".chart3DTypes ."+this.model.commonSeriesOptions.type+" a:eq(0)").append(i):n("#"+this._id+"_ContextMenu").find(".chartTypes ."+this.model.commonSeriesOptions.type+" a:eq(0)").append(i);this.model.commonSeriesOptions.tooltip.visible&&n("#"+this._id+"_ContextMenu").find(".toolTip a:eq(0)").append(i);this.model.zooming.enable&&n("#"+this._id+"_ContextMenu").find(".zooming a:eq(0)").append(i);this.model.legend.visible&&n("#"+this._id+"_ContextMenu").find(".legend a:eq(0)").append(i);this.model.primaryXAxis.labelIntersectAction!="none"&&(n("#"+this._id+"_ContextMenu").find(".smartLabels a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".smartLabels ."+this.model.primaryXAxis.labelIntersectAction+" a:eq(0)").append(i),this.model.primaryXAxis.labelIntersectAction=="hide"&&n("#"+this._id+"_ContextMenu").find(".smartLabels .hiding a:eq(0)").append(i));this.model.crosshair.type=="crosshair"&&this.model.crosshair.visible&&(n("#"+this._id+"_ContextMenu").find(".interaction a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".interaction .crossHair a:eq(0)").append(i),this.mode.enable3D||n("#"+this._id+"_ContextMenu").ejMenu("disableItem",this._getLocalizedLabels("Tooltip")));this.model.crosshair.type=="trackBall"&&this.model.crosshair.visible&&(n("#"+this._id+"_ContextMenu").find(".interaction a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".interaction .trackBall a:eq(0)").append(i),this.mode.enable3D||n("#"+this._id+"_ContextMenu").ejMenu("disableItem",this._getLocalizedLabels("Tooltip")));this.model.crosshair.visible||n("#"+this._id+"_ContextMenu").find(".interaction .none a:eq(0)").append(i)})),this._on(this.element,"click",".menuList",function(r){var h,c,f,s,e,o,u;if(this._curFocus=null,r.target.innerHTML==this._getLocalizedLabels("Exit"))this.element.find("#"+this._id+"ExpandMenu, .expandMenu, .e-dialog").remove();else if(r.target.innerHTML.indexOf(this._getLocalizedLabels("Expand"))>-1)this._drillAction="drilldown",n(this.element).parents(".e-pivotclient").length>0?(e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+e._id+"_maxView")[0]?n("#"+e._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?(f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._getChartDrillDown("",f,r):(this._labelCurrentTags.collapsedMembers=n.grep(this._labelCurrentTags.collapsedMembers,function(n){return n!=f}),h=n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==f})[0],c=t.olap._mdxParser._splitCellInfo(h),this._getChartDrillDown(h,c,r))):(s=JSON.stringify(this.model.customObject),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this._selectedItem=f,t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),this._labelCurrentTags.expandedMembers.push(f),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),customObject:s,currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess)):(u=this,this._isDrilled||(this._isDrilled=!0,jQuery.each(r.target.parentElement.children,function(n,t){t.innerHTML==r.target.innerHTML&&(u._dimensionIndex=n)})),o=this.getOlapReport(),this._drillAction="drilldown",this._selectedItem=this.model.enableRTL?n.trim(r.target.innerHTML.replace(" - "+this._getLocalizedLabels("Expand"),"")):n.trim(r.target.innerHTML.replace(this._getLocalizedLabels("Expand")+" - ","")),jQuery.each(this._labelCurrentTags,function(n,t){if(t.name==u._selectedItem)return u._tagCollection=[],u._tagCollection=u._selectedTags.slice(),u._selectedTagInfo=t.tag,u._selectedMenuItem=t.name,!1}),this._startDrilldown=!0,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,customObject:s}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports,customObject:s}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports}),this.renderControlSuccess)));else if(this._drillAction="drillup",n(this.element).parents(".e-pivotclient").length>0?(e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+e._id+"_maxView")[0]?n("#"+e._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode)f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this._getChartDrillDown("",f,r);else if(s=JSON.stringify(this.model.customObject),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){var f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],l=!1,a=[];jQuery.map(this._labelCurrentTags.expandedMembers,function(n){n==f&&(l=!0);l||a.push(n)});this._selectedItem=f;this._labelCurrentTags.expandedMembers=a;this._currentDrillInfo=n.extend([],this._labelCurrentTags.expandedMembers,!0).concat([f]);n(this.element).parents(".e-pivotclient").length>0&&(this._labelCurrentTags.expandedMembers=[],e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),e._drillParams.length>0&&(e._drillParams=n.grep(e._drillParams,function(n){return n.indexOf(f)<0}),e._getDrilledMember()));this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),customObject:s,currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess)}else o=this.getOlapReport(),this._drillAction="drillup",this._selectedItem=this.model.enableRTL?n.trim(r.target.innerHTML.replace(" - "+this._getLocalizedLabels("Collapse"),"")):n.trim(r.target.innerHTML.replace(this._getLocalizedLabels("Collapse")+" - ","")),this._tagCollection=[],this._tagCollection=this._selectedTags.slice(),u=this,jQuery.each(this._tagCollection,function(n,t){if(t.name==u._selectedItem)return u._selectedIndex=n,u._selectedTagInfo=t.tag,u._tagCollection.splice(n,u._tagCollection.length),!1}),this._tagCollection.length==0&&(this._isDrilled=!1),this._startDrilldown=!0,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,customObject:s}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:reports,customObject:s}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:reports}),this.renderControlSuccess)}),t.isNullOrUndefined(this._pivotClientObj))n(window).on("resize",n.proxy(this._reSizeHandler,this));this._on(this.element,"click",".chart3DImg",function(i){var r=this;r._createDialog(i);n(".chart3DTypesIcon").click(function(n){r._contextMenuClick(n);t.isNullOrUndefined(this._pivotClientObj)||(r._pivotClientObj._unWireEvents(),r._pivotClientObj._wireEvents())})});this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(this._on(this.element,"click",".toolTipImg",function(){var n=this;this.model.commonSeriesOptions.tooltip.visible=!this.model.commonSeriesOptions.tooltip.visible;this.renderChartFromJSON(this.getJSONRecords());this.model.commonSeriesOptions.tooltip.visible?this.element.find(".toolTipImg").addClass("enabled"):this.element.find(".toolTipImg").removeClass("enabled")}),this._on(this.element,"click",".exportImg",function(t){var i=this;i._createDialog(t);n(".exportTypesIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".smartLabels",function(t){var i=this;i._createDialog(t);n(".smartLabelsIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".interaction",function(t){var i=this;i._createDialog(t);n(".interactionsIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".legend",function(n){var t=this;t._contextMenuClick(n)}),this._on(this.element,"click",".zooming",function(n){var t=this;t._contextMenuClick(n)}))},_unWireEvents:function(){this._off(n(document),"keydown",this._keyDownPress);n(document.body).off("click");this._off(this.element,"click",".menuList");n(window).off("resize",n.proxy(this._reSizeHandler,this));this._off(this.element,"contextmenu");this._off(this.element,"click",".chartTypesImg");this._off(this.element,"click",".toolTipImg");this._off(this.element,"click",".chart3DImg");this._off(this.element,"click",".exportImg");this._off(this.element,"click",".legend");this._off(this.element,"click",".zooming");this._off(this.element,"click",".smartLabels");this._off(this.element,"click",".interaction")},_createDialog:function(r){var u=this,f,e,o,s;n(r.target).hasClass("exportImg")?(f=t.buildTag("div.exportTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.excel exportTypesIcon").attr({title:this._getLocalizedLabels("Excel"),"aria-label":this._getLocalizedLabels("Excel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.word exportTypesIcon").attr({title:this._getLocalizedLabels("Word"),"aria-label":this._getLocalizedLabels("Word"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pdf exportTypesIcon").attr({title:this._getLocalizedLabels("Pdf"),"aria-label":this._getLocalizedLabels("Pdf"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.png exportTypesIcon").attr({title:this._getLocalizedLabels("PNG"),"aria-label":this._getLocalizedLabels("PNG"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.emf exportTypesIcon").attr({title:this._getLocalizedLabels("EMF"),"aria-label":this._getLocalizedLabels("EMF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.gif exportTypesIcon").attr({title:this._getLocalizedLabels("GIF"),"aria-label":this._getLocalizedLabels("GIF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.jpg exportTypesIcon").attr({title:this._getLocalizedLabels("JPG"),"aria-label":this._getLocalizedLabels("JPG"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.bmp exportTypesIcon").attr({title:this._getLocalizedLabels("BMF"),"aria-label":this._getLocalizedLabels("BMF"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.exportTypesDialog").length==0&&(n(f).appendTo(this.element),n(f).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),this.model.enableRTL&&n(f).addClass("e-rtl"))):n(r.target).hasClass("chart3DImg")?(e=t.buildTag("div.chart3DTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.column3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("ColumnTD"),"aria-label":this._getLocalizedLabels("ColumnTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pie3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("PieTD"),"aria-label":this._getLocalizedLabels("PieTD"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.bar3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("BarTD"),"aria-label":this._getLocalizedLabels("BarTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.stackingbar3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("StackingBarTD"),"aria-label":this._getLocalizedLabels("StackingBarTD"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.stackingcolumn3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("StackingColumnTD"),"aria-label":this._getLocalizedLabels("StackingColumnTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.disable3D chart3DTypesIcon")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.chart3DTypesDialog").length==0&&(n(e).appendTo(this.element),n(e).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),u.model.enable3D&&n("."+this.model.type+"3D").addClass("enabled"),this.model.enableRTL&&n(e).addClass("e-rtl"))):n(r.target).hasClass("smartLabels")?(o=t.buildTag("div.smartLabelsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.rotate45 smartLabelsIcon").attr({title:this._getLocalizedLabels("Rotate45"),"aria-label":this._getLocalizedLabels("Rotate45"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.rotate90 smartLabelsIcon").attr({title:this._getLocalizedLabels("Rotate90"),"aria-label":this._getLocalizedLabels("Rotate90"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.trim smartLabelsIcon").attr({title:this._getLocalizedLabels("Trim"),"aria-label":this._getLocalizedLabels("Trim"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.multipleRows smartLabelsIcon").attr({title:this._getLocalizedLabels("MultipleRows"),"aria-label":this._getLocalizedLabels("MultipleRows"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.wrap smartLabelsIcon").attr({title:this._getLocalizedLabels("Wrap"),"aria-label":this._getLocalizedLabels("Wrap"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.hiding smartLabelsIcon").attr({title:this._getLocalizedLabels("Hide"),"aria-label":this._getLocalizedLabels("Hide"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.wrapByWord smartLabelsIcon").attr({title:this._getLocalizedLabels("WrapByWord"),"aria-label":this._getLocalizedLabels("WrapByWord"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.smartLabelsDialog").length==0&&(n(o).appendTo(this.element),n(o).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),u.model.primaryXAxis.labelIntersectAction!="none"&&u.model.primaryXAxis.labelIntersectAction!="hide"&&u.model.primaryXAxis.labelIntersectAction!=i&&n("."+u.model.primaryXAxis.labelIntersectAction).addClass("enabled"),u.model.primaryXAxis.labelIntersectAction=="hide"&&n(".hiding").addClass("enabled"),this.model.enableRTL&&n(o).addClass("e-rtl"))):n(r.target).hasClass("interaction")&&(s=t.buildTag("div.interactionsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.crossHair interactionsIcon").attr({title:this._getLocalizedLabels("CrossHair"),"aria-label":this._getLocalizedLabels("CrossHair"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.trackBall interactionsIcon").attr({title:this._getLocalizedLabels("TrackBall"),"aria-label":this._getLocalizedLabels("TrackBall"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.none interactionsIcon").attr({title:this._getLocalizedLabels("None"),"aria-label":this._getLocalizedLabels("None"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.interactionsDialog").length==0&&(n(s).appendTo(this.element),n(s).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),this.model.crosshair.type=="crosshair"&&this.model.crosshair.visible&&this.element.find(".crossHair").addClass("enabled"),this.model.crosshair.type=="trackBall"&&this.model.crosshair.visible&&this.element.find(".trackBall").addClass("enabled"),this.model.crosshair.visible||this.element.find(".none").addClass("enabled"),this.model.enableRTL&&n(s).addClass("e-rtl")))},_contextMenuClick:function(i){chrtObj=n("#"+this._id).data("ejPivotChart");var r=n(this.element).parents(".e-pivotclient").length>0?n(i.target).attr("class").split(" ")[0]:n(i.element).attr("class").split(" ")[0];if(n(i.element).parents().hasClass("chartTypes"))chrtObj.model.enable3D=!1,chrtObj.model.type=chrtObj.model.commonSeriesOptions.type=r,chrtObj.model.type=="funnel"&&(chrtObj.model.commonSeriesOptions.marker={dataLabel:{visible:!0,shape:"none",font:{color:"white",size:"12px",fontWeight:"lighter"}}}),(chrtObj.model.type=="pie"||chrtObj.model.type=="doughnut")&&(chrtObj.model.commonSeriesOptions.explode=!0),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("toolTip"))chrtObj.model.commonSeriesOptions.tooltip.visible=!chrtObj.model.commonSeriesOptions.tooltip.visible,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("legend")||n(i.target).hasClass("legend"))chrtObj.model.legend.visible=!chrtObj.model.legend.visible,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("zooming")||n(i.target).hasClass("zooming"))chrtObj.model.zooming.enable=!chrtObj.model.zooming.enable,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("smartLabels")||n(i.target).hasClass("smartLabelsIcon"))chrtObj.model.primaryXAxis.labelIntersectAction=r=="hiding"?"hide":r,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("interaction")||n(i.target).hasClass("interactionsIcon"))r=="crossHair"&&(chrtObj.model.crosshair.type=t.datavisualization.Chart.CrosshairType.Crosshair,chrtObj.model.crosshair.visible=!0),r=="trackBall"&&(chrtObj.model.crosshair.type=t.datavisualization.Chart.CrosshairType.TrackBall,chrtObj.model.crosshair.visible=!0),r=="none"&&(chrtObj.model.crosshair.visible=!1),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("chart3DTypes")||n(i.target).hasClass("chart3DTypesIcon"))chrtObj.model.enable3D=!0,r!="disable3D"&&(r=r.split("3")[0]),r=="disable3D"&&(chrtObj.model.enable3D=!1,r=chrtObj.model.commonSeriesOptions.type),chrtObj.model.type=chrtObj.model.commonSeriesOptions.type=r,r=="pie"&&(chrtObj.model.rotation=24),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else{n(this.element).parents(".e-pivotclient").length>0&&!t.isNullOrUndefined(this._pivotClientObj)&&(this.model.beforeExport=this._pivotClientObj.model.beforeExport);switch(r){case"excel":case"word":case"pdf":chrtObj.exportPivotChart(r,"Sample");break;case"png":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.PNG);break;case"emf":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.EMF);break;case"gif":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.GIF);break;case"jpg":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.JPG);break;case"bmp":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.BMP)}}},generateJSON:function(n,i){var u,r,f;if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&this._labelCurrentTags.expandedMembers.length>0&&!this.model.enableMultiLevelLabels)for(u=0,r=0;r<this._labelCurrentTags.expandedMembers.length;r++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[r])&&this._labelCurrentTags.expandedMembers[r].length>0)for(r>0&&!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[r-1])&&this._labelCurrentTags.expandedMembers[r-1].length>0&&this._cropData(i,this._selectedSeriesInfo[r-1].split("::")[2],r-1+u,!1),f=0;f<this._labelCurrentTags.expandedMembers[r].length;f++)this._cropData(i,this._labelCurrentTags.expandedMembers[r][f].split("::")[2],r+u,!0),u++;this._generateData(i)},_jsonToEngine:function(n){for(var u,f=JSON.parse(n),i=[],r=0;r<f.length;r++)u=parseInt(f[r].Index.split(",")[0]),t.isNullOrUndefined(i[u])?(i[u]=[],i[u].push(f[r])):i[u].push(f[r]);return i},_generateData:function(r){var ht=!1,s,k,o,a,rt,ut,d,v,w,g,b,ct,p,f,ot,u;if(ht=r[2]!=i?r[2].Value=="Olap"||r[2]=="Olap"?!0:!1:r.d!=i?!t.isNullOrUndefined(r.d[2])&&r.d[2].Value=="Olap"?!0:!1:r.AnalysisMode=="Olap"?!0:!1,ht)this.renderControlSuccess(r);else{var e={seriesNames:[],chartLables:[],labelTags:[],multiLevelLabels:[],multiLevelLabelTags:[],seriesTags:[],points_Y:[],labelFormat:[],measureNames:""},tt="",st=[];if(this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&(s={},r[0]!=i?(n(this.element).parents(".e-pivotclient").length>0?s.JsonRecords=t.isNullOrUndefined(r[0].Value)?r[0]:r[0].Value:(s.JsonRecords={},s.JsonRecords.ChartJSON=t.isNullOrUndefined(r[0].Value)?r[0]:r[0].Value,s.JsonRecords.GridJSON=t.isNullOrUndefined(r[3].Value)?r[3]:r[3].Value),s.PivotReport=t.isNullOrUndefined(r[1].Value)?r[1]:r[1].Value,r=s):r.d!=i&&(n(this.element).parents(".e-pivotclient").length>0?s.JsonRecords=!t.isNullOrUndefined(r.d[0])&&r.d[0].Key=="JsonRecords"?r.d[0].Value:[]:(s.JsonRecords={},s.JsonRecords.ChartJSON=!t.isNullOrUndefined(r.d[0])&&r.d[0].Key=="JsonRecords"?r.d[0].Value:[],s.JsonRecords.GridJSON=!t.isNullOrUndefined(r.d[3])&&r.d[3].Key=="GridJSON"?r.d[3].Value:[]),s.PivotReport=!t.isNullOrUndefined(r.d[1])&&(r.d[1].Key=="PivotReport"||r.d[1].Key=="OlapReport")?r.d[1].Value:[],r=s),tt=r.PivotReport||r.OlapReport,r=t.isNullOrUndefined(r.JsonRecords.GridJSON)?t.isNullOrUndefined(r.GridJSON)?r.JsonRecords:this._jsonToEngine(r.GridJSON):this._jsonToEngine(r.JsonRecords.GridJSON),this._pivotEngine=r,st=t.isNullOrUndefined(JSON.parse(tt).values)?JSON.parse(tt).PivotCalculations:JSON.parse(JSON.parse(tt).values),e.labelFormat=n.map(st,function(n){return n.Format.toLowerCase()})),k=r.length,k>0&&r[0].length>0){var et=r[0].length,it=[],nt=[];for(o=this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&!this.model.enableMultiLevelLabels?this.model.dataSource.rows.length-this._labelCurrentTags.expandedMembers.length:this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?r[0][0].ColSpan:this.model.dataSource.rows.length:r[0][0].ColSpan,this.model.enableMultiLevelLabels&&(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode||this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)?a=r[0][0].RowSpan:(a=this.model.dataSource.columns.length,this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?a+=this.model.dataSource.values.length>0?1:0:a=r[0][0].RowSpan),rt="",u=o;u<k;u++){for(ut="",d=!1,f=0;f<a;f++)if(!t.isNullOrUndefined(r[u][f])){if(r[u][f].CSS.indexOf("summary")>=0){d=!0;it.push(u);break}r[u][f].Info.indexOf("Measure")>=0&&rt.indexOf(r[u][f].Value)<0&&(rt+=rt==""?r[u][f].Value:"~~"+r[u][f].Value);ut+=(ut==""?"":r[u][f].Value==""?"":"~~")+r[u][f].Value}d||ut==""||e.seriesNames.push(ut)}for(u=a;u<et;u++)if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){if(this.model.enableMultiLevelLabels&&o>1){this._drillParams=this._drillAction!=""?this._drillParams:[];var c=n.extend(!0,[],this._drillParams.sort()),l=c.length>0?-1:0,ft="";for(u=a;u<et;u++)for(v=c[0],w="",f=0;f<o;f++)w+=w==""?r[f][u].Value:">#>"+r[f][u].Value,(l==-1||ft==""||w==c[1])&&(w==v||w==c[1])&&(w==c[1]&&(v=c[1],c.splice(0,1)),l=f+1,ft=w),!t.isNullOrUndefined(v)&&l>0&&l==o-1&&f==o-1?(nt.push(u),e.chartLables.push(v.split(">#>").join("~~")+"~~"+r[f][u].Value)):!t.isNullOrUndefined(v)&&l>0&&l==f&&r[f][u].CSS.indexOf("summary")>-1?(nt.push(u),e.chartLables.push(v.split(">#>").join("~~")+"~~"+r[f][u].Value.split(" Total")[0])):l-1==f&&r[f][u].CSS.indexOf("summary")>-1?(ft!=""&&(c[0]=c[0].split(">#>").slice(0,c[0].split(">#>").length-1).join(">#>"),c[0]==""&&(c.splice(0,1),ft="")),l=l-1):(l==0||ft=="")&&f==0&&r[0][u].CSS.indexOf("summary")>-1&&(t.isNullOrUndefined(v)?!0:v.split(">#>")[0]!=r[0][u].Value.split(" Total")[0])&&r[f][u].Value!="Grand Total"&&(nt.push(u),e.chartLables.push(r[f][u].Value.split(" Total")[0]))}else o>1?r[0][u].CSS=="summary rstot"&&r[0][u].Value!="Grand Total"&&e.chartLables.push(r[0][u].Value.replace(" Total","")):r[0][u].CSS=="rowheader"&&e.chartLables.push(r[0][u].Value);this.model.enableMultiLevelLabels&&(e.multiLevelLabels=n.extend(!0,[],e.chartLables))}else if(t.isNullOrUndefined(this._labelCurrentTags.collapsedMembers)&&(this._labelCurrentTags.collapsedMembers=[]),o>1){var h="",d=!1,y="";for(f=0;f<o;f++)if(r[f][u].CSS=="rowheader")h+=h==""?r[f][u].Value:(r[f][u].Info!=""&&r[f-1][u].Info!=""&&r[f][u].Info.split("::")[3]==r[f-1][u].Info.split("::")[0]?"#":"~~")+r[f][u].Value,r[f][u].Info.indexOf("[Measures]")==-1&&(y+=y==""?r[f][u].Info:(r[f][u].Info!=""&&r[f-1][u].Info!=""&&r[f][u].Info.split("::")[3]==r[f-1][u].Info.split("::")[0]?"#":"~~")+r[f][u].Info),n.inArray(r[f][u].Value,this._labelCurrentTags.collapsedMembers)<0&&r[f][u].State==2&&this._labelCurrentTags.collapsedMembers.push(r[f][u].Value),n.inArray(r[f][u].Info,e.seriesTags)<0&&r[f][u].Info.indexOf("[Measures]")==-1&&e.seriesTags.push(r[f][u].Info);else if((!this.model.enableMultiLevelLabels||h==""||r[f][u].CSS.indexOf("summary")>=0)&&(this.model.enableMultiLevelLabels?!0:r[f][u].CSS.indexOf("none")==-1&&r[f][u].CSS.indexOf("value")==-1)){d=!0;nt.push(u);break}d||(e.chartLables.push(h),e.labelTags.push(y))}else r[0][u].CSS=="rowheader"&&(e.chartLables.push(r[0][u].Value),e.labelTags.push(r[0][u].Info),e.seriesTags.push(r[0][u].Info)),r[0][u].State==2&&this._labelCurrentTags.collapsedMembers.push(r[0][u].Value);if(this.model.enableMultiLevelLabels)if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){for(g=0,f=0;f<e.multiLevelLabels.length;f++)e.multiLevelLabels[f]=n.map(e.multiLevelLabels[f].split("~~"),function(n){return n+"#1"}).join("~~"),g=e.multiLevelLabels[f].split("~~").length>g?e.multiLevelLabels[f].split("~~").length:g;for(b=0;b<e.multiLevelLabels.length;b++)if(g>1&&e.multiLevelLabels[b].split("~~").length<g){ct=e.multiLevelLabels[b].split("~~")[e.multiLevelLabels[b].split("~~").length-1].split("#1")[0];do e.multiLevelLabels[b]+="~~"+ct+"#0";while(e.multiLevelLabels[b].split("~~").length<g)}}else for(u=a;u<et;u++)if(o>1){var h="",y="",d=!1;for(f=0;f<o;f++)if(r[f][u].CSS=="rowheader")h+=h==""?r[f][u].Value+"#"+r[f][u].Expander:"~~"+(r[f][u].Value+"#"+r[f][u].Expander),y+=y==""?r[f][u].Info+"::"+r[f][u].State:"~~"+(r[f][u].Info+"::"+r[f][u].State);else if(r[f][u].CSS.indexOf("none")>=0&&h!="")h+="~~"+h.split("~~")[h.split("~~").length-1].split("#")[0]+"#"+r[f][u].Expander,y+="~~"+y.split("~~")[y.split("~~").length-1];else if(h==""||r[f][u].CSS.indexOf("summary")>=0||r[f][u].CSS.indexOf("value")>=0){d=r[f][u].CSS.indexOf("summary")>=0?!0:!1;break}d||h==""||(e.multiLevelLabels.push(h),e.multiLevelLabelTags.push(y))}else r[0][u].CSS=="rowheader"&&(e.multiLevelLabels.push(r[0][u].Value+"#"+r[0][u].Expander),e.multiLevelLabelTags.push(r[0][u].Info+"::"+r[0][u].State));for(u=a;u<et;u++)if(p=[],o>1){if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){if(this.model.enableMultiLevelLabels){if(n.inArray(u,nt)>-1){for(f=o;f<k;f++)n.inArray(f,it)<0&&p.push(r[f][u].Value);e.points_Y.push(p)}}else if(r[0][u].CSS=="summary rstot"&&r[0][u].Value!="Grand Total"){for(f=o;f<k;f++)n.inArray(f,it)<0&&p.push(r[f][u].Value);e.points_Y.push(p)}}else if(n.inArray(u,nt)<0){for(f=o;f<k;f++)n.inArray(f,it)<0&&r[f][u].CSS.indexOf("value")>-1&&p.push(r[f][u].Value==""?0:t.parseFloat(r[f][u].Value,this.locale()));e.points_Y.push(p)}}else if(r[0][u].CSS=="rowheader"){for(f=r[0][0].ColSpan;f<k;f++)n.inArray(f,it)<0&&p.push(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?r[f][u].Value==""?0:t.parseFloat(r[f][u].Value,this.locale()):r[f][u].Value);e.points_Y.push(p)}}if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)e.measureNames=rt;else for(ot=this.model.enableMultiLevelLabels&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?n(st).map(function(n,t){return t.FieldHeader}):n(this.model.dataSource.values).map(function(n,t){return t.fieldCaption}),u=0;u<ot.length;u++)e.measureNames+=e.measureNames==""?ot[u]:"~"+ot[u];this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?this.renderControlSuccess({JsonRecords:JSON.stringify(e),OlapReport:tt}):this.renderControlSuccess({JsonRecords:JSON.stringify(e),OlapReport:JSON.stringify(this.model.dataSource)});e={}}},_cloneEngine:function(t){for(var r=n.extend([],t),i=0;i<t.length;i++)r[i]=n.extend([],t[i]);return r},_cropData:function(n,i,r,u){for(var f=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?n[0][0].RowSpan:this.model.dataSource.columns.length+(this.model.dataSource.values.length==0||this.model.dataSource.values[0].axis=="rows"?0:1),e;f<n[r].length;)if(n[r][f].Value!=i)for(e=0;e<n.length;e++)n[e].splice(f,1);else f+=n[r][f].RowSpan;this.model.analysisMode!=t.PivotChart.AnalysisMode.Olap&&u&&n.splice(r,1)},refreshPagedPivotChart:function(n,t){typeof ochartWaitingPopup!="undefined"&&ochartWaitingPopup!=null&&ochartWaitingPopup.show();n=n.indexOf("categ")!=-1?"categorical":"series";var i;try{i=JSON.parse(this.getOlapReport())}catch(r){i=this.getOlapReport()}this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:n+":"+t,currentReport:i,customObject:JSON.stringify(this.model.customObject)}),this.renderControlSuccess)},_updatePageSettings:function(t,i){var r=n.map(t,function(n){if(n.Key=="PageSettings")return n}),u=n.map(t,function(n){if(n.Key=="HeaderCounts")return n});r.length>0&&i._pagerObj!=null&&(i._pagerObj.element.css("opacity","1"),i._pagerObj.element.find(".pagerTextBox").removeAttr("disabled"),i._pagerObj._unwireEvents(),i._pagerObj._wireEvents(),i._pagerObj.initPagerProperties(JSON.parse(u[0].Value),JSON.parse(r[0].Value)))},renderControlSuccess:function(r){var h,e,o,c,l,f,u,s;typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&(n("#"+this._pivotClientObj._id+"_maxView")[0]?n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show());try{if(r[0]!=i?(this.setJSONRecords(r[0].Value),this.setOlapReport(r[1].Value),t.isNullOrUndefined(r[2])||r[2].Key!="AnalysisMode"||r[2].Value!="Olap"||(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r[1].Value,r[2]!=null&&r[2]!=i&&r[2].Key=="ClientReports"&&(this._pivotClientObj.reports=r[2].Value),this._updatePageSettings(r,this._pivotClientObj)),r[2]!=null&&r[2]!=i&&!r[2].Key=="ClientReports"&&r[2].Key!="AnalysisMode"&&(this.model.customObject=r[2].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this._pagerObj!=null&&r[2]!=null&&r.d[2]!=i&&this._pagerObj.initPagerProperties(JSON.parse(r.d[3].Value),JSON.parse(r.d[2].Value))):r.d!=i?(this.setJSONRecords(r.d[0].Value),this.setOlapReport(r.d[1].Value),r.d[2].Key=="AnalysisMode"&&r.d[2].Value=="Olap"&&(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r.d[1].Value,r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="ClientReports"&&(this._pivotClientObj.reports=r.d[2].Value),this._updatePageSettings(r.d,this._pivotClientObj)),r.d[2]==null||r.d[2]==i||r.d[2].Key=="ClientReports"||(this.model.customObject=r.d[2].Value),this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&(r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="PageSettings"&&this._pagerObj.initPagerProperties(JSON.parse(r.d[3].Value),JSON.parse(r.d[2].Value)),r.d[3]!=null&&r.d[3]!=i&&r.d[3].Key=="PageSettings"&&this._pagerObj.initPagerProperties(JSON.parse(r.d[4].Value),JSON.parse(r.d[3].Value)))):(this.setJSONRecords(r.JsonRecords),this.setOlapReport(r.OlapReport),r.AnalysisMode=="Olap"&&(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),r.customObject!=null&&r.customObject!=null&&(this.model.customObject=r.customObject),t.isNullOrUndefined(this._pivotClientObj)||(typeof this._pivotClientObj.currentReport!="undefined"&&(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r.OlapReport),typeof this._pivotClientObj.reports!="undefined"&&r.reports!=i&&r.reports!="undefined"&&(this._pivotClientObj.reports=r.reports))),this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&(h=this._drillAction!=""?{action:this._drillAction,element:this.element,customObject:this.model.customObject}:{action:this._currentAction,element:this.element,customObject:this.model.customObject},this._trigger("afterServiceInvoke",h)),e=t.buildTag("div#"+this._id+"Container","",{height:t.isNullOrUndefined(this._pivotClientObj)?this.element.height():this._pivotClientObj._chartHeight,width:t.isNullOrUndefined(this._pivotClientObj)?this.element.width():this._pivotClientObj.model.enableSplitter?this._pivotClientObj.element.find(".controlPanelTD").width():this._pivotClientObj._toggleExpand?this._pivotClientObj.element.find(".controlPanelTD").width()-15:n("#"+this._pivotClientObj._id+"_maxView").length>0&&this._pivotClientObj._pivotChart?n("#"+this._pivotClientObj._pivotChart._id+"Container").width():this._pivotClientObj._chartWidth})[0].outerHTML,n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen?(o=this._pivotClientObj.model.enableSplitter?n("<div id="+this._id+"toolBar style='width:"+this._pivotClientObj._chartWidth+";height:"+this._pivotClientObj._chartHeight+";margin-top:35px;margin-left:5px'><\/div>"):n("<div id="+this._id+"toolBar style='width:"+this._pivotClientObj._chartWidth+";height:"+this._pivotClientObj._chartHeight+";overflow:auto;margin-top:35px;margin-left:5px'><\/div>"),n(o).html(e),this.element.html(o)):this.element.html(e),this.model.legend.toggleSeriesVisibility=this.model.commonSeriesOptions.type==t.PivotChart.ChartTypes.Funnel||this.model.commonSeriesOptions.type==t.PivotChart.ChartTypes.Pyramid?!1:!0,this.renderChartFromJSON(this.getJSONRecords()),n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(n("#"+this._id).prepend("<div class='chartToolBar' style='height:40px;width:"+this._pivotClientObj.element.find(".chartContainer").width()+"px'><\/div>"),c=t.buildTag("ul",t.buildTag("li.chart3DImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("TDCharts")).attr({title:this._getLocalizedLabels("TDCharts"),tabindex:0})[0].outerHTML+t.buildTag("li.exportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Exporting")).attr({title:this._getLocalizedLabels("Exporting"),tabindex:0})[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.smartLabels e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SmartLabels")).attr({title:this._getLocalizedLabels("SmartLabels"),tabindex:0})[0].outerHTML)+(this.model.enable3D?"":t.buildTag("li.interaction e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Interactions")).attr({title:this._getLocalizedLabels("Interactions"),tabindex:0})[0].outerHTML))[0].outerHTML+t.buildTag("ul",t.buildTag("li#"+this._id+"_toolTipImg.toolTipImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Tooltip")).attr({title:this._getLocalizedLabels("Tooltip"),tabindex:0})[0].outerHTML+t.buildTag("li.legend e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Legend")).attr({title:this._getLocalizedLabels("Legend"),tabindex:0})[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.zooming e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Zooming")).attr({title:this._getLocalizedLabels("Zooming"),tabindex:0})[0].outerHTML))[0].outerHTML,n(".chartToolBar").append(n(c)),n(".chartToolBar").ejToolbar({enableRTL:this.model.enableRTL,enableSeparator:!0,height:"35px"}),this.model.enable3D&&this.element.find(".chart3DImg").addClass("enabled"),this.model.zooming.enable&&this.element.find(".zooming").addClass("enabled"),this.model.legend.visible&&this.element.find(".legend").addClass("enabled"),t.isNullOrUndefined(this.model.primaryXAxis.labelIntersectAction)||this.element.find(".smartLabels").addClass("enabled"),this.model.commonSeriesOptions.tooltip.visible&&this.element.find(".toolTipImg").addClass("enabled"),this.model.crosshair.visible&&this.element.find(".interaction").addClass("enabled"),this.model.crosshair.type=="trackball"&&this.element.find(".trackBall").addClass("enabled"),this.model.crosshair.type=="crosshair"&&this.element.find(".crossHair").addClass("enabled"),this.model.crosshair.visible||this.element.find(".none").addClass("enabled"),this._pivotClientObj._unWireEvents(),this._pivotClientObj._wireEvents()),this._unWireEvents(),this._wireEvents(),this._drillAction!=""){if(this.model.currentReport=this.getOlapReport(),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&!this.model.enableMultiLevelLabels)if(this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode){if(f=this.getJSONRecords(),this.model.dataSource.rows.length-this._labelCurrentTags.expandedMembers.length>1)for(this._labelCurrentTags.collapsedMembers=[],u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u])}else if(f=this.getJSONRecords(),l=t.isNullOrUndefined(JSON.parse(this.getOlapReport()).rows)?JSON.parse(this.getOlapReport()).PivotRows:JSON.parse(JSON.parse(this.getOlapReport()).rows),this._labelCurrentTags.collapsedMembers=[],l.length-this._labelCurrentTags.expandedMembers.length>1)for(u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u]);this._trigger("drillSuccess",this.element)}else if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot)if(this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode){if(f=this.getJSONRecords(),this._labelCurrentTags={collapsedMembers:[]},this.model.dataSource.rows.length>1)for(u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u])}else if(f=this.getJSONRecords(),this.model.currentReport=JSON.parse(this.getOlapReport()),this._labelCurrentTags={collapsedMembers:[]},n(this.element).parents(".e-pivotclient").length>0?this.model.currentReport.PivotRows.length>1:JSON.parse(this.model.currentReport.rows).length>1)for(u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u]);s=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(s)||(s._isTimeOut=!1);typeof this._pivotClientObj!="undefined"&&this._pivotClientObj._waitingPopup!=null?(n("#"+this._pivotClientObj._id+"_maxView")[0]?(n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!1}),this._pivotClientObj._waitingPopup.hide()):t.isNullOrUndefined(this._pivotClientObj._pivotGrid)||(this._pivotClientObj&&this._pivotClientObj._pivotGrid._drillAction&&!this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._drillAction&&!this._pivotClientObj._pivotChart._startDrilldown?this._pivotClientObj._waitingPopup.hide():!this._pivotClientObj||this._pivotClientObj._pivotGrid._drillAction!=""||this._pivotClientObj._pivotChart._drillAction!=""||this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._startDrilldown||this._pivotClientObj._pivotGrid._JSONRecords==null&&this._pivotClientObj._pivotChart._JSONRecords!=null?!this._pivotClientObj._pivotChart._startDrilldown||this._pivotClientObj._pivotGrid._startDrilldown||n("#"+this._pivotClientObj._id+"_maxView")[0]?this._pivotClientObj._pivotChart._startDrilldown||this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._drillAction!=""||this._pivotClientObj._pivotGrid._drillAction!=""||this._pivotClientObj._pivotGrid._JSONRecords==null&&this._pivotClientObj._pivotChart._JSONRecords!=null||this._pivotClientObj._waitingPopup.hide():this._pivotClientObj._waitingPopup.show():this._pivotClientObj._waitingPopup.hide()),this._pivotClientObj.model.displaySettings.mode=="chartonly"&&this._pivotClientObj._waitingPopup.hide()):this._waitingPopup.hide();t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj._pivotChart._startDrilldown=!1)}catch(a){}t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this);this._trigger("renderSuccess",this)},renderChartFromJSON:function(r){var d,vt,h,et,rt,e,g,ot,a,nt,st,tt,ut,it,b,y,ht,ct,u,f,lt,p,yt,pt,s,at;if(this.setJSONRecords(JSON.stringify(r)),d=[],r==null||r=="")r==""&&(vt=t.buildTag("div#"+this._id+"Container")[0].outerHTML,this.element.html(vt)),d=[],this.model.primaryXAxis.multiLevelLabels=[];else if(r!=null&&r.chartLables.length>0&&r.points_Y.length>0){s=this;this.model.enableRTL&&(r.chartLables=n.map(r.chartLables,function(n){return n.split("~~").map(function(n){return n.split("#").reverse().join("#")}).reverse().join("~~")}),r.seriesNames=n.map(r.seriesNames,function(n){return n.split("~~").map(function(n){return n.split("#").reverse().join("#")}).reverse().join("~~")}));h=[];h=s.model.analysisMode==t.PivotChart.AnalysisMode.Olap?n.map(n.extend([],r.chartLables,!0),function(n){return n.split("#").join("~~")}):n.map(n.extend([],r.chartLables,!0),function(n){return!t.isNullOrUndefined(s._labelCurrentTags.expandedMembers)&&s._labelCurrentTags.expandedMembers.length>0?s._labelCurrentTags.expandedMembers.join("~~")+"~~"+n:n});var ft=[],dt=h,w=[],v=pCnt=0,y=0,o,c=0;if(c=r.measureInfo!=""?parseInt(r.measureInfo):0,jQuery.each(h,function(n){var l=[],e,f,u;if(c>1&&r.addInfo.action!="DrillChart"||c>1&&r.addInfo.levelHash=="1"){for(e=(n+1)*c-c,f=0;f<c;f++)if(r.points_Y[e+f]!=i&&h[n].split("~~")[0]==r.points_Y[e+f][0].Item1)for(u=0;u<r.points_Y[n].length;u++)o={xValues:h[n],yValues:r.points_Y[e+f][u].Item2.indexOf(",")>-1?t.globalize.parseFloat(t.globalize.format(r.points_Y[e+f][u].Item2,"c",s.model.locale),s.model.locale):r.points_Y[e+f][u].Item2==""?0:t.globalize.parseFloat(r.points_Y[e+f][u].Item2),text:r.points_Y[e+f][u].Item2==""?0:r.points_Y[e+f][u].Item2},o.yValues=t.isNullOrUndefined(o.yValues)?o.yValues:jQuery.isNumeric(o.yValues)?o.yValues:t.globalize.parseFloat(r.points_Y[e+f][u].Item2.toString().replace(/[^\d.,-]/g,"")),l.push(o)}else for(u=0;u<r.points_Y[n].length;u++)s.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&s.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?(o=s.seriesType()=="bubble"?{xValues:h[n],yValues:r.points_Y[n][u].Item2==""?0:r.points_Y[n][u].Item2,size:r.points_Y[n][u].Item2==""?0:r.points_Y[n][u].Item2}:{xValues:h[n],yValues:r.points_Y[n][u].Item2==""?0:t.globalize.parseFloat(r.points_Y[n][u].Item2),text:r.points_Y[n][u].Item2==""?0:r.points_Y[n][u].Item2},o.yValues=t.isNullOrUndefined(o.yValues)?o.yValues:jQuery.isNumeric(o.yValues)?o.yValues:t.globalize.parseFloat(r.points_Y[n][u].Item2.toString().replace(/[^\d.,-]/g,""))):(o=s.seriesType()=="bubble"?{xValues:h[n].toString().split("#")[h[n].toString().split("#").length-1],yValues:r.points_Y[n][u]==""?0:r.points_Y[n][u],size:r.points_Y[n][u]==""?0:r.points_Y[n][u]}:{xValues:h[n].toString().split("#")[h[n].toString().split("#").length-1],yValues:r.points_Y[n][u]==""?0:r.points_Y[n][u],text:r.points_Y[n][u]==""?0:r.points_Y[n][u]},o.yValues=t.isNullOrUndefined(o.yValues)?o.yValues:jQuery.isNumeric(o.yValues)?o.yValues:t.globalize.parseFloat(r.points_Y[n][u].toString().replace(/[^\d.,-]/g,""))),l.push(o);ft.push(l)}),c>1&&r.addInfo.action!="DrillChart"||c>1&&r.addInfo.levelHash=="1")for(et=0;et<c*r.seriesNames.length;et++)w.push([]);else jQuery.each(r.seriesNames,function(){w.push([])});if(jQuery.each(h,function(n){for(var i=0;i<ft[n].length;i++)t.isNullOrUndefined(w[i])&&(w[i]=[]),w[i].push(ft[n][i])}),c>1&&r.addInfo.action!="DrillChart"||c>1&&r.addInfo.levelHash=="1")for(rt=0;rt<c*r.seriesNames.length;rt++)d[pCnt]={dataSource:w[rt],xName:"xValues",yName:"yValues",name:r.seriesNames[v]},v++,pCnt++,v==r.seriesNames.length&&(v=0);else this.seriesType()=="bubble"?(jQuery.each(r.seriesNames,function(n){d[v]={dataSource:w[n],xName:"xValues",yName:"yValues",size:"size",name:r.seriesNames[v]};v++}),this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1)):(jQuery.each(r.seriesNames,function(n){d[v]={dataSource:w[n],xName:"xValues",yName:"yValues",name:r.seriesNames[v],marker:{dataLabel:{textMappingName:"text"}}};v++}),this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1));if(this.model.enableMultiLevelLabels&&!t.isNullOrUndefined(r.multiLevelLabels)){for(this.model.primaryXAxis.majorTickLines={size:0},e=[],g=[],u=0;u<r.multiLevelLabels.length;u++)g.push(r.multiLevelLabels[u].split("~~"));for(u=r.multiLevelLabels[0].split("~~").length-1;u>=0;u--){for(ot=[],f=0;f<r.multiLevelLabels.length;f++){if(a={},a.name=r.multiLevelLabels[f].split("~~")[u].split("#")[0],this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode)a.rowSpan=parseInt(r.multiLevelLabels[f].split("~~")[u].split("#")[1]),a.colSpan=parseInt(r.multiLevelLabels[f].split("~~")[u].split("#")[2]),a.tag=r.multiLevelLabelTags[f].split("~~")[u];else{if(u==r.multiLevelLabels[0].split("~~").length-1)a.colSpan=1;else{for(nt="",st=0,k=f;k<g.length;k++){for(tt="",l=u;l>=0;l--)tt+=tt==""?g[k][l]:"$"+g[k][l];if(st+=nt==""||nt==tt?1:0,nt!=tt&&nt!="")break;else nt=tt}a.colSpan=st}if(parseInt(r.multiLevelLabels[f].split("~~")[u].split("#")[1])==0){for(b=0,ut=u;ut>=0;ut--)if(b++,parseInt(g[f][ut].split("#")[1])>0)break;a.rowSpan=b}else a.rowSpan=1;a.tag=t.isNullOrUndefined(r.multiLevelLabelTags[f])?"":r.multiLevelLabelTags[f].split("~~")[u]}ot.push(a)}e.push(ot)}if(it=[],this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){for(f=0;f<e[0].length;f++)for(u=e.length-1;u>=0;u--)if(!t.isNullOrUndefined(e[u][f])&&e[u][f].rowSpan>1&&it.indexOf(u+"-"+f)==-1){b=e[u][f].rowSpan;y=1;do delete e[u-y][f],y++;while(b>y);it.push(u+"-"+f)}}else for(f=0;f<e[0].length;f++)for(u=0;u<e.length;u++)if(!t.isNullOrUndefined(e[u][f])&&e[u][f].rowSpan>1&&it.indexOf(u+"-"+f)==-1){b=e[u][f].rowSpan;y=0;do delete e[u+y][f],y++;while(b>y+1);e[u+y][f].rowSpan=b;it.push(u+y+"-"+f)}for(ht=[],ct=this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotRows)?JSON.parse(JSON.parse(this.getOlapReport()).rows).length:JSON.parse(this.getOlapReport()).PivotRows.length:this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?this.model.dataSource.rows.length:0,u=0;u<e.length;u++)for(f=0;f<e[u].length;f++)t.isNullOrUndefined(e[u][f])||(lt=f-.5,p={},p.visible=!0,p.text=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?e[u][f].tag.endsWith("2")?"+ "+e[u][f].name:e[u][f].tag.endsWith("1")?"- "+e[u][f].name:e[u][f].name:ct==e.length&&u==0?e[u][f].name:u==0||e[u][f].rowSpan>1?"+ "+e[u][f].name:"- "+e[u][f].name,p.tag=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?e[u][f].tag:ct==e.length&&u==0?e[u][f].name+"#0":u==0||e[u][f].rowSpan>1?e[u][f].name+"#1":e[u][f].name+"#2",p.start=lt,p.end=lt+e[u][f].colSpan,p.level=u,p.span=e[u][f].rowSpan>1?!0:!1,ht.push(p),f+=e[u][f].colSpan-1);this.model.primaryXAxis.multiLevelLabels=ht;this.model.zooming.enableScrollbar=!0}else r.chartLables.length>10&&this.model.zooming==""?this.model.zooming={enable:!0,type:"x,y",enableMouseWheel:!0}:r.chartLables.length<10&&this._initZooming==""&&(this.model.zooming=this._initZooming);if(jQuery.inArray(this.seriesType(),["line","spline","area","splinearea","stepline","steparea","stackingarea","scatter"])>-1&&!this.model.commonSeriesOptions.marker.visible?this.model.commonSeriesOptions.marker={shape:t.PivotChart.SymbolShapes.Circle,size:{height:12,width:12},visible:!0,connectorLine:{height:30,type:"line"},dataLabel:{visible:!1},border:{width:3,color:"white"}}:this.seriesType()=="pie"||this.seriesType()=="doughnut"?(this.model.commonSeriesOptions.marker.visible=!1,this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1)):this.seriesType()=="pyramid"||this.seriesType()=="funnel"?this.model.commonSeriesOptions.marker={dataLabel:{visible:!0}}:jQuery.inArray(this.seriesType(),["column","stackingcolumn","bar","stackingbar"])>-1&&this.model.commonSeriesOptions.marker&&(this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1),this.model.commonSeriesOptions.marker.visible=!1),this.model.crosshair.visible?this.model.commonSeriesOptions.tooltip.format="#point.x# : #point.y#":this.model.enableRTL?this.model.commonSeriesOptions.tooltip={visible:!0,template:"e-toolTip"}:this.model.commonSeriesOptions.tooltip.format=this._getLocalizedLabels("Measure")+" : "+r.measureNames+" <br/>"+this._getLocalizedLabels("Column")+" : #series.name# <br/>"+this._getLocalizedLabels("Row")+" : #point.x# <br/>"+this._getLocalizedLabels("Value")+" : #point.y#",this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:r.labelFormat.indexOf("#")>-1&&r.measureNames.indexOf("~")<0?r.labelFormat=="#,#"?"Number":"{value}"+r.labelFormat.split("##")[r.labelFormat.split("##").length-1]:r.labelFormat.toLowerCase().indexOf("percent")>-1&&r.measureNames.indexOf("~")<0?"{value}%":r.labelFormat.toLowerCase().indexOf("currency")>-1&&r.measureNames.indexOf("~")<0?"Currency":"":this.model.dataSource.values[0].measures.length==1&&(t.isNullOrUndefined(this.model.dataSource.values[0].measures[0].format)||(this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:this.model.dataSource.values[0].measures[0].format.toLowerCase()=="decimal"?"n2":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="number"?"Number":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="percent"?"p2":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="currency"?"Currency":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="date"?"MM/dd/yyyy":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="time"?"hh:mm:ss":"")):this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&(this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?this.model.dataSource.values.length==1&&(t.isNullOrUndefined(this.model.dataSource.values[0].format)||(this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:this.model.dataSource.values[0].format.toLowerCase()=="decimal"?"n2":this.model.dataSource.values[0].format.toLowerCase()=="number"?"Number":this.model.dataSource.values[0].format.toLowerCase()=="percentage"?"p2":this.model.dataSource.values[0].format.toLowerCase()=="currency"?"Currency":this.model.dataSource.values[0].format.toLowerCase()=="date"?t.isNullOrUndefined(this.model.dataSource.values[0].formatString)?"dd/MMMM/yyyy":this.model.dataSource.values[0].formatString:this.model.dataSource.values[0].format.toLowerCase()=="time"?"hh:mm:ss":"")):(yt=t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotCalculations)?JSON.parse(JSON.parse(this.getOlapReport()).values):JSON.parse(this.getOlapReport()).PivotCalculations,r.labelFormat.length==1&&yt.length==1&&(this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:r.labelFormat[0].toLowerCase()=="#.##"?"n2":r.labelFormat[0].toLowerCase()=="###"?"Number":r.labelFormat[0].toLowerCase()=="p"?"p2":r.labelFormat[0].toLowerCase()=="c"?"Currency":""))),this.model.zooming.enableScrollbar){t.isNullOrUndefined(this.model.size.width)&&(this.model.size.width="800px");t.isNullOrUndefined(this.model.size.height)&&(this.model.size.height="400px");var wt=this.model.size.width.indexOf("%")>-1?this.element.width()*this.model.size.width.split("%")[0]/100:this.model.size.width.split("px")[0],bt=this.model.size.height.indexOf("%")>-1?this.element.height()*this.model.size.height.split("%")[0]/100:this.model.size.height.split("px")[0],kt=this.seriesType()=="bar"||this.seriesType()=="stackingbar"?bt/100*6:wt/100*3;this.model.primaryXAxis.zoomFactor=kt/(r.chartLables.length*r.seriesNames.length)}else this.model.primaryXAxis.zoomFactor=1;this.model.primaryXAxis.labelRotation=t.isNullOrUndefined(this.model.primaryXAxis.labelRotation)?270:this.model.primaryXAxis.labelRotation}else this.model.primaryXAxis.multiLevelLabels=[];n("#"+this._id+"Container").ejChart({border:this.model.border,backGroundImageUrl:this.model.backGroundImageUrl,palette:this.model.palette,chartArea:this.model.chartArea,primaryXAxis:this.model.primaryXAxis,primaryYAxis:this.model.primaryYAxis,secondaryX:this.model.secondaryX,secondaryY:this.model.secondaryY,striplineDefault:this.model.striplineDefault,title:{text:this.titleText(),textAlignment:this.model.title.textAlignment,font:{color:this.model.title.color,fontFamily:this.model.title.fontFamily,fontWeight:this.model.title.fontWeight,opacity:this.model.title.opacity,size:this.model.title.size,fontStyle:this.model.title.fontStyle}},locale:this.model.locale,lineCap:this.model.lineCap,lineJoin:this.model.lineJoin,legendAlignment:this.model.legendAlignment,legendPosition:this.model.legendPosition,legend:this.model.legend,animation:this.model.animation,crosshair:this.model.crosshair,commonSeriesOptions:{doughnutCoefficient:this.model.commonSeriesOptions.doughnutCoefficient,explodeOffset:this.model.commonSeriesOptions.explodeOffset,pyramidMode:this.model.commonSeriesOptions.pyramidMode,gapRatio:this.model.commonSeriesOptions.gapRatio,pieCoefficient:this.model.commonSeriesOptions.pieCoefficient,doughnutSize:this.model.commonSeriesOptions.doughnutSize,startAngle:this.model.commonSeriesOptions.startAngle,xAxisName:this.model.commonSeriesOptions.xAxisName,yAxisName:this.model.commonSeriesOptions.yAxisName,explodeAll:this.model.commonSeriesOptions.explodeAll,explodeIndex:this.model.commonSeriesOptions.explodeIndex,tooltipOptions:this.model.commonSeriesOptions.tooltipOptions,marker:this.model.commonSeriesOptions.marker||this.model.marker,font:this.model.commonSeriesOptions.font,type:this.seriesType(),enableAnimation:this.model.commonSeriesOptions.enableAnimation,style:this.model.commonSeriesOptions.style,explode:this.model.commonSeriesOptions.explode,labelPosition:this.model.commonSeriesOptions.labelPosition,tooltip:this.model.commonSeriesOptions.tooltip,zOrder:this.model.commonSeriesOptions.zOrder,drawType:this.model.commonSeriesOptions.drawType,isStacking:this.model.commonSeriesOptions.isStacking,enableSmartLabels:this.model.commonSeriesOptions.enableSmartLabels},seriesStyle:this.model.seriesStyle,pointStyle:this.model.pointStyle,textStyle:this.model.textStyle,initSeriesRender:this.model.initSeriesRender,theme:this.model.theme,canResize:this.model.isResponsive,rotation:this.model.rotation,enable3D:this.model.enable3D,zooming:this.model.zooming,margin:this.model.margin,elementSpacing:this.model.elementSpacing,seriesColors:this.model.seriesColors,seriesBorderColors:this.model.seriesBorderColors,pointColors:this.model.pointColors,pointBorderColors:this.model.pointBorderColors,series:d,size:this.model.size,load:this._onChartLoad(this),loaded:this.model.enableMultiLevelLabels?t.proxy(this._onChartLoaded,this):null,axesRangeCalculate:this.model.axesRangeCalculate,axesTitleRendering:this.model.axesTitleRendering,chartAreaBoundsCalculate:this.model.chartAreaBoundsCalculate,legendItemRendering:this.model.legendItemRendering,lengendBoundsCalculate:this.model.lengendBoundsCalculate,preRender:this.model.preRender,seriesRendering:this.model.seriesRendering,symbolRendering:this.model.symbolRendering,titleRendering:this.model.titleRendering,axesLabelsInitialize:this.model.axesLabelsInitialize,pointRegionMouseMove:this.model.pointRegionMouseMove,legendItemClick:this.model.legendItemClick,legendItemMouseMove:this.model.legendItemMouseMove,displayTextRendering:this.model.displayTextRendering,toolTipInitialize:this.model.toolTipInitialize,trackAxisToolTip:this.model.trackAxisToolTip,trackToolTip:this.model.trackToolTip,animationComplete:this.model.animationComplete,destroy:this.model.destroy,create:this.model.create,axesLabelRendering:t.proxy(this._labelRenders,this),multiLevelLabelClick:t.isNullOrUndefined(this._pivotClientObj)?t.proxy(this._multiLevelLabelClick,this):this._pivotClientObj.model.enableDeferUpdate?null:t.proxy(this._multiLevelLabelClick,this),pointRegionClick:this.model.enableMultiLevelLabels?null:t.isNullOrUndefined(this._pivotClientObj)?t.proxy(this._seriesClick,this):this._pivotClientObj.model.enableDeferUpdate?null:t.proxy(this._seriesClick,this)});this.model.enableRTL&&r!=null&&(pt=t.buildTag("div#e-toolTip.e-toolTip",t.buildTag("div.toolTipInfo",t.buildTag("div",r.measureNames+" : "+this._getLocalizedLabels("Measure")+" <br/>")[0].outerHTML+t.buildTag("div","#series.name#: "+this._getLocalizedLabels("Row")+" <br/>")[0].outerHTML+t.buildTag("div","#point.x# : "+this._getLocalizedLabels("Column")+" <br/>")[0].outerHTML+t.buildTag("div","#point.y# : "+this._getLocalizedLabels("Value"))[0].outerHTML).addClass("e-rtl")[0].outerHTML,{display:"none",width:"auto","min-width":"200px","font-size":"12px",padding:"2px 5px","background-color":"rgb(255, 255, 255)",border:"1px solid rgb(0, 0, 0)"})[0].outerHTML,n("#"+this._id).append(pt));n("#"+this._id+"progressContainer").hide();this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&r!=null&&r!=""&&(this._labelCurrentTags.splice(0,this._labelCurrentTags.length),s=this,jQuery.each(r.labelTags,function(n,t){var r={},i=t.split("::");r={name:i[2],state:i[i.length-1],tag:t};s._labelCurrentTags.push(r)}),t.isNullOrUndefined(s._selectedTagInfo)||jQuery.each(this._labelCurrentTags,function(n,t){if(t.tag.split("::")[0]==s._selectedTagInfo.split("::")[0]&&s._drillAction=="drillup")return s._selectedTagInfo=s._labelCurrentTags[n].tag,!1}));at=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(at)||(at._isTimeOut=!1);this._waitingPopup!=null&&this._waitingPopup.hide();n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&this.model.commonSeriesOptions.tooltip.visible&&this.element.find(".toolTipImg").addClass("enabled");t.isNullOrUndefined(this._pivotClientObj)||t.isNullOrUndefined(this._pivotClientObj)||!this._pivotClientObj.model.isResponsive||n("#"+this._id+"Container").width("100%")},_onChartLoad:function(n){for(var u,i=t.isNullOrUndefined(n.model.primaryXAxis.multiLevelLabels)?[]:n.model.primaryXAxis.multiLevelLabels,r=0;r<i.length;r++)if(i[r].span)for(i[r].border={type:"withouttopborder"},u=0;u<i[r].level;u++)i.push({start:i[r].start,end:i[r].end,visible:!0,text:" ",tag:i[r].tag,level:u,border:{type:"withouttopandbottomborder"}});return this.model.load},_onChartLoaded:function(){this.element.find("#"+this._id+"Container_svg_XAxisMultiLevelLabels_0").attr("cursor","pointer")},_setDrillParams:function(t,i){for(var e,o,f=this.getJSONRecords().chartLables[i.start+.5].split("~~"),r="",u=0;u<f.length;u++)if(r+=r==""?f[u]:">#>"+f[u],t==f[u])break;return e=r,this._drillAction=="drilldown"?this._drillParams.push(r):this._drillParams=n.map(this._drillParams,function(n){if(n.indexOf(r)==-1)return n}),n(this.element).parents(".e-pivotclient").length>0&&(o=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),o._drillParams=this._drillParams),e},_getChartDrillDown:function(i,r,u){var ut=this.model.dataSource.providerName==t.olap.Providers.Mondrian,y,v,o,h,it,c,s,p,l,e,tt,k,b,f;if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){for(e=[],f=0;f<this.model.dataSource.rows.length;f++){if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers))for(o=0;o<this._labelCurrentTags.expandedMembers.length;o++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[o]))for(y=0;y<this._labelCurrentTags.expandedMembers[o].length;y++)this._labelCurrentTags.expandedMembers[o][y].indexOf(this.model.dataSource.rows[f].fieldName)>=0&&e.indexOf(this._labelCurrentTags.expandedMembers[o][y].replace("&","&"))<0&&e.indexOf(this._labelCurrentTags.expandedMembers[o][y])<0&&e.push(this._labelCurrentTags.expandedMembers[o][y]);for(o=0;o<this._selectedSeriesInfo.length;o++)this._selectedSeriesInfo[o].indexOf(this.model.dataSource.rows[f].fieldName)>=0&&e.indexOf(this._selectedSeriesInfo[o])<0&&e.indexOf(this._selectedSeriesInfo[o].replace(/&/g,"&"))<0&&e.push(this._selectedSeriesInfo[o].replace(/&/g,"&"))}for(f=0;f<this._selectedSeriesInfo.length;f++)this._selectedSeriesInfo[f]=this._selectedSeriesInfo[f].replace(/&/g,"&");if(v=e,this._drillAction=="drillup"){for(f=0;f<this._labelCurrentTags.expandedMembers.length;f++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[f]))for(o=0;o<this._labelCurrentTags.expandedMembers[f].length;o++)this.model.enableMultiLevelLabels&&i!=""?this._labelCurrentTags.expandedMembers[f][o]==i&&(e=[],jQuery.map(this._labelCurrentTags.expandedMembers[f],function(n){n==i&&(l=!0);l||e.push(n)}),this._labelCurrentTags.expandedMembers[f]=e):this._labelCurrentTags.expandedMembers[f][o].split("::")[2]==r&&(i=this._labelCurrentTags.expandedMembers[f][o],e=[],jQuery.map(this._labelCurrentTags.expandedMembers[f],function(n){n.split("::")[2]==r&&(l=!0);l||e.push(n)}),this._labelCurrentTags.expandedMembers[f]=e);r=t.olap._mdxParser._splitCellInfo(i)}else i=i.indexOf("&")==-1?i.replace(/&/g,"&"):i;for(h=-1,f=0;f<this.model.dataSource.rows.length;f++)if(this.model.dataSource.rows[f].fieldName==r.hierarchyUniqueName){h=f;break}for(ut&&this._drillAction=="drillup"&&!t.isNullOrUndefined(this._selectedSeriesInfo[h])&&(this._selectedSeriesInfo[h]=i),c=n.inArray(i,this._selectedSeriesInfo),e=[],f=0;f<=c;f++)e.push(this._selectedSeriesInfo[f]);for(it=e,this._selectedSeriesInfo=e.length>0?e:this._selectedSeriesInfo,c=n.inArray(i,v),e=[],f=0;f<=c;f++)e.push(v[f]);if(v=e,s=n(this.element).parents(".e-pivotclient").length>0?this.element.parents(".e-pivotclient").data("ejPivotClient"):this,this._drillAction=="drilldown")t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[h])&&(this._labelCurrentTags.expandedMembers[h]=[]),this._labelCurrentTags.expandedMembers[h].push(i),this.element.parents(".e-pivotclient").length>0&&(s=this.element.parents(".e-pivotclient").data("ejPivotClient"),s._drillParams.push(n.map(v,function(n){return n.split("&").join("&")}).join(">#>")));else if(this.element.parents(".e-pivotclient").length>0){s=this.element.parents(".e-pivotclient").data("ejPivotClient");var rt=[],g="",w=[];for(n.each(v,function(n,t){(g==""||g.split("::")[0]!=t.split("::")[3])&&rt.push(t);g=t}),n.each(rt,function(n,t){n<h&&t.length>0&&w.push(t.split("&").join("&"))}),s._drillParams=n.grep(s._drillParams,function(t){return h<1?t.indexOf(i.split("&").join("&"))==-1:!(t.indexOf(i.split("&").join("&"))>-1&&n.map(t.split(">#>"),function(n){if(w.indexOf(n)>-1)return n}).length==w.length)}),l=!1,f=0;f<this._labelCurrentTags.expandedMembers.length;f++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[f])&&this._labelCurrentTags.expandedMembers[f].length>0){l=!0;break}if(s._drillParams.length>0&&this._drilledCellSet.length>0&&!l&&!t.isNullOrUndefined(s._drillParams[s._drillParams.length-1])){var c=0,d="",a="",nt=!1;for(f=0;f<s._drillParams[s._drillParams.length-1].split(">#>").length;f++)a=s._drillParams[s._drillParams.length-1].split(">#>")[f],a.indexOf("undefined")==-1&&(c=d==""?0:a.split("::")[0].split(".")[0]+"."+a.split("::")[0].split(".")[1]==d.split("::")[0].split(".")[0]+"."+d.split("::")[0].split(".")[1]?c:c+1,n.each(this._drilledCellSet,function(t,i){(n.map(i[0].key.split("][").join("]>#>[").split(">#>"),function(n){if(w.indexOf(n)>-1)return n}).length!=w.length||w.length==0)&&n.each(i[0].key.split("][").join("]>#>[").split(">#>"),function(n,t){a.split("::")[0]+" !#rowheader"==t&&(nt=!0)})}),nt&&(a=a.split("&").join("&"),t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[c])?this._labelCurrentTags.expandedMembers[c]=a:this._labelCurrentTags.expandedMembers[c].push(a),nt=!1),d=a)}}for(f=h+1;f<this._labelCurrentTags.expandedMembers.length;f++)this._labelCurrentTags.expandedMembers[f]=[];this._drillAction=="drilldown"?t.olap._mdxParser.updateDrilledReport({uniqueName:i,seriesInfo:this._selectedSeriesInfo,uniqueNameArray:v},"rowheader",s):t.olap._mdxParser.updateDrilledReport({uniqueName:i,seriesInfo:it,uniqueNameArray:v,action:"collapse"},"rowheader",s)}else{if(p="",this._drillAction==""&&this.model.enableMultiLevelLabels)return this._waitingPopup.hide(),!1;if(this._drillAction=="drilldown"){if(this.model.enableMultiLevelLabels)p=this._setDrillParams(r,i),this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?(this._selectedItem=r,this._generateData({JsonRecords:this._pivotEngine,PivotReport:this.getOlapReport()})):this._generateData(this._pivotEngine);else{for(t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),this._labelCurrentTags.expandedMembers.push(r),b=this._cloneEngine(this._pivotEngine),f=0;f<this._labelCurrentTags.expandedMembers.length;f++)this._cropData(b,this._labelCurrentTags.expandedMembers[f],0,!0);this._generateData(b)}this._trigger("drillSuccess",{chartObj:this,drillAction:"drilldown",drilledMember:this.model.enableMultiLevelLabels?p:this._labelCurrentTags.expandedMembers.join(">#>"),event:u})}else{if(this.model.enableMultiLevelLabels)p=this._setDrillParams(r,i),this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?(this._selectedItem=r,this._generateData({JsonRecords:this._pivotEngine,PivotReport:this.getOlapReport()})):this._generateData(this._pivotEngine);else{for(l=!1,e=[],jQuery.map(this._labelCurrentTags.expandedMembers,function(n){n==r&&(l=!0);l||e.push(n)}),this._labelCurrentTags.expandedMembers=e,p=this._labelCurrentTags.expandedMembers.length==0?r:this._labelCurrentTags.expandedMembers.join(">#>")+">#>"+r,tt=this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode,(this._labelCurrentTags.expandedMembers.length==0||tt)&&n(this.element).parents(".e-pivotclient").length>0&&(k=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),k._drillParams.length>0&&(k._drillParams=n.grep(k._drillParams,function(n){return n.indexOf(tt?p:r)<0}),k._getDrilledMember())),b=this._cloneEngine(this._pivotEngine),f=0;f<this._labelCurrentTags.expandedMembers.length;f++)this._cropData(b,this._labelCurrentTags.expandedMembers[f],0,!0);this._generateData(b)}this._trigger("drillSuccess",{chartObj:this,drillAction:"drillup",drilledMember:p,event:u})}}},_multiLevelLabelClick:function(r){var h,c,e,o,u,s,l;if(n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejWaitingPopup").show():t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)if(this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){if(h=parseInt(r.data.multiLevelLabel.tag.split("::")[r.data.multiLevelLabel.tag.split("::").length-1]),r.data.multiLevelLabel.tag.startsWith("[Measures]")||h==0)return n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejWaitingPopup").hide():t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide(),!1;this._selectedTagInfo=r.data.multiLevelLabel.tag;this._drillAction=h==2?"drilldown":"drillup";this._startDrilldown=!0;c=JSON.stringify(this.model.customObject);e=this.getOlapReport();this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject});this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e,customObject:c}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e,clientReports:this._pivotClientObj.reports,customObject:c}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e,clientReports:reports}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e}),this.renderControlSuccess)}else{if(r.data.multiLevelLabel.tag.endsWith("0"))return t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide(),!1;var f=r.data.multiLevelLabel.tag.split("::").splice(0,r.data.multiLevelLabel.tag.split("::").length-1).join("::"),l=t.olap._mdxParser._splitCellInfo(f),a=this.getJSONRecords().labelTags[r.data.multiLevelLabel.start+.5].split("~~");for(this._selectedSeriesInfo=[],o=0;o<a.length;o++)this._selectedSeriesInfo.push(a[o].split("#")[a[o].split("#").length-1]);if(this._labelCurrentTags.collapsedMembers=n.grep(this._labelCurrentTags.collapsedMembers,function(n){return n!=r.data.multiLevelLabel.text.slice(2,r.data.multiLevelLabel.text.length)}),this._drillAction=r.data.multiLevelLabel.tag.split("::")[r.data.multiLevelLabel.tag.split("::").length-1]=="2"?"drilldown":r.data.multiLevelLabel.tag.split("::")[r.data.multiLevelLabel.tag.split("::").length-1]=="1"?"drillup":"",!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers))for(u=0;u<this._labelCurrentTags.expandedMembers.length;u++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[u]))for(s=0;s<this._labelCurrentTags.expandedMembers[u].length;s++)if(this._labelCurrentTags.expandedMembers[u][s].indexOf(f.replace(/&/g,"&"))>=0||this._labelCurrentTags.expandedMembers[u][s].indexOf(f)>=0){f=f.replace(/&/g,"&");break}this._getChartDrillDown(f,l,r)}else l=r.data.multiLevelLabel.tag.split("#")[0],this._drillAction=r.data.multiLevelLabel.tag.endsWith("1")?"drilldown":r.data.multiLevelLabel.tag.endsWith("2")?"drillup":"",this._getChartDrillDown(r.data.multiLevelLabel,l,r)},_labelRenders:function(r){if(this.model.enableMultiLevelLabels&&(this.seriesType()=="bar"||this.seriesType()=="stackingbar"?r.data.axis.orientation.toLowerCase()=="vertical":r.data.axis.orientation.toLowerCase()=="horizontal"))r.data.label.Text="";else if(this._trigger("axesLabelRendering",r),(r.data.axis.orientation.toLowerCase()=="horizontal"&&r.data.label.Text!=i||(this.seriesType()=="bar"||this.seriesType()=="stackingbar")&&r.data.axis.orientation.toLowerCase()=="vertical"&&r.data.label.Text!=i)&&this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){var f=this.model.enableRTL?r.data.label.Text.toString().split("~~").reverse():r.data.label.Text.toString().split("~~"),u=this;t.isNullOrUndefined(u.getJSONRecords())||n.each(n.extend([],u.getJSONRecords().chartLables,!0),function(n,t){if(t.toString().split("#").join("~~")==f.join("~~"))return r.data.label.Text=t.toString().split("~~").map(function(n){return n.split("#")[n.split("#").length-1]}).join("~~"),!1})}},_reSizeHandler:function(){var n=this.element.find("#"+this._id+"Container").height(this.element.height()).width(this.element.width()).data("ejChart");t.isNullOrUndefined(n)||n.redraw()},_getLocalizedLabels:function(n){return t.PivotChart.Locale[this.locale()][n]===i?t.PivotChart.Locale["en-US"][n]:t.PivotChart.Locale[this.locale()][n]},_onPreventPanelClose:function(i){n("body").find("#preventDiv").remove();!n(".e-pivotgrid").data("ejWaitingPopup")||!t.isNullOrUndefined(i)&&(n(i.target).hasClass("pivotTree")||n(i.target).hasClass("pivotTreeContext")||n(i.target).hasClass("pivotTreeContextMenu"))||n(".e-pivotgrid").data("ejWaitingPopup").hide()},_seriesClick:function(r){var s,e,p,v,b,h,k,y,c,f,d;this.element.find("#"+this._id+"ExpandMenu, .expandMenu, .e-dialog").remove();var o,u=[],w=this.element.position(),l=this,a=this;if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode)this._selectedTags=[],r.data.region!=null&&r.data.region!=i?(p=this.model.enableRTL?n.map(r.model.primaryXAxis.labels,function(n){return n.split("~~").reverse().join("~~")}):r.model.primaryXAxis.labels,o=p[r.data.region.Region.PointIndex],e=r.data.region.Region.PointIndex):r.data.point.x!=null&&r.data.point.x!=i&&r.data.point.x!=""&&(p=this.model.enableRTL?n.map(r.data.series.xAxis.labels,function(n){return n.split("~~").reverse().join("~~")}):r.data.series.xAxis.labels,o=p[r.data.point.X],e=r.data.point.X),this.model.enableMultiLevelLabels?s=r.model.primaryXAxis.labels[e].split("~~")[r.model.primaryXAxis.labels[e].split("~~").length-1]:n(n("#"+this._id+"Container_vml_XAxisLabels_0")[0]).children()[e]!=i?s=n(n("#"+this._id+"Container_vml_XAxisLabels_0")[0]).children()[e].innerHTML:n("#"+this._id+"Container_svg_XAxisLabels_0").children()[e]?s=n("#"+this._id+"Container_svg_XAxisLabels_0").children()[e].textContent:this.seriesType()=="bar"||this.seriesType()=="stackingbar"?n(n("#"+this._id+"Container_vml_YAxisLabels_0")[0]).children()[e]!=i?s=n(n("#"+this._id+"Container_vml_YAxisLabels_0")[0]).children()[e].innerHTML:n("#"+this._id+"Container_svg_YAxisLabels_0").children()[e]?s=n("#"+this._id+"Container_svg_YAxisLabels_0").children()[e].textContent:(v=r.model.primaryXAxis.labels[e].split("~~"),s=v[v.length-1]):(v=r.model.primaryXAxis.labels[e].split("~~"),s=v[v.length-1]),s&&(n("#"+this._id).find("#"+this._id+"ExpandMenu, .expandMenu, .e-dialog").remove(),b=o.split("~~"),jQuery.each(b,function(t,i){jQuery.each(a._labelCurrentTags,function(t,r){if(n.trim(i)==r.name)return a._selectedTags.push(r),!1})}),jQuery.each(this._selectedTags,function(i,r){r.state>1&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",r.name+" - "+a._getLocalizedLabels("Expand"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",a._getLocalizedLabels("Expand")+" - "+r.name)[0]).attr("role","presentation")[0].outerHTML))}),jQuery.each(this._selectedTags,function(i,r){for(var f=0;f<o.split("~~").length-1;f++)o.split("~~")[f]==r.name&&r.state==1&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",r.name+" - "+a._getLocalizedLabels("Collapse"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",a._getLocalizedLabels("Collapse")+" - "+o.split("~~")[f])[0]).attr("role","presentation")[0].outerHTML))}));else{if(o=r.data.region!=null&&r.data.region!=i?this.getJSONRecords().chartLables[r.data.region.Region.PointIndex]:r.data.series.xAxis.labels[r.data.point.X],this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&(o=o.split("~~").map(function(n){return n.split("#")[n.split("#").length-1]}).join("~~")),!t.isNullOrUndefined(this._labelCurrentTags.collapsedMembers))if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)for(h=o.split("~~"),this.model.dataSource.values[0].axis==t.olap.AxisName.Row&&(k=n.map(this.model.dataSource.values[0].measures,function(n){return n.fieldName}),n.inArray(h[h.length-1],k)>=0&&h.splice(h.length-1,1)),this._selectedSeriesInfo=[],f=0;f<h.length;f++)y=h[f].split("#")[h[f].split("#").length-1],n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==y}).length>0&&this._selectedSeriesInfo.push(n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==y})[0]),n.inArray(y,this._labelCurrentTags.collapsedMembers)>=0&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",y+" - "+this._getLocalizedLabels("Expand"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Expand")+" - "+y)[0]).attr("role","presentation")[0].outerHTML));else n.inArray(o,this._labelCurrentTags.collapsedMembers)>=0&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",o+" - "+this._getLocalizedLabels("Expand"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Expand")+" - "+o)[0]).attr("role","presentation")[0].outerHTML));if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers))if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){for(c=0;c<this._labelCurrentTags.expandedMembers.length;c++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[c]))for(f=0;f<this._labelCurrentTags.expandedMembers[c].length;f++)l.model.enableRTL?u.push(n(t.buildTag("li.menuList",this._labelCurrentTags.expandedMembers[c][f].split("::")[2]+" - "+this._getLocalizedLabels("Collapse"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Collapse")+" - "+this._labelCurrentTags.expandedMembers[c][f].split("::")[2])[0]).attr("role","presentation")[0].outerHTML)}else for(f=0;f<this._labelCurrentTags.expandedMembers.length;f++)l.model.enableRTL?u.push(n(t.buildTag("li.menuList",this._labelCurrentTags.expandedMembers[f]+" - "+this._getLocalizedLabels("Collapse"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Collapse")+" - "+this._labelCurrentTags.expandedMembers[f])[0]).attr("role","presentation")[0].outerHTML)}u.length>0&&(u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Exit"))[0]).attr("role","presentation")[0].outerHTML),d=n(t.buildTag("div#"+this._id+"ExpandMenu.expandMenu",u)[0]).attr("role","presentation")[0].outerHTML,n(d).ejDialog({width:"auto",target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL}),n("#"+this._id+"ExpandMenu_wrapper").appendTo(this.element).css({left:r.data.location.x+8+w.left,top:r.data.location.y+8+w.top,"min-height":navigator.userAgent.toLowerCase().indexOf("webkit")>0?"initial":"auto"}),n("#"+this._id+"ExpandMenu").css({"min-height":navigator.userAgent.toLowerCase().indexOf("webkit")>0?"initial":"auto"}));this.element.find(".e-titlebar, .e-header").remove();this._trigger("pointRegionClick",r)},exportPivotChart:function(i,r,u){var e,c,l,s,h,f,a,v,o;t.browserInfo().name=="msie"&&t.browserInfo().version<=8||((t.isNullOrUndefined(r)||r=="")&&(r="Sample"),e=n("#"+this._id+"Container").data("ejChart"),c=e.model.primaryXAxis.zoomFactor,e.model.primaryXAxis.zoomFactor=1,e.model.enableCanvasRendering=!0,e.redraw(),l=e["export"](),s=l.toDataURL("image/png"),e.model.primaryXAxis.zoomFactor=c,e.model.enableCanvasRendering=!1,e.redraw(),h=n(this.element).css("background-color")!=""?n(this.element).css("background-color"):"rgb(255, 255, 255)",f={url:"",fileName:"PivotChart",exportMode:t.PivotChart.ExportMode.ClientMode,title:"",description:"",exportType:i,controlName:this},this._trigger("beforeExport",f),f.exportMode==t.PivotChart.ExportMode.ClientMode?(o={args:JSON.stringify({fileName:t.isNullOrUndefined(r)?t.isNullOrUndefined(f.fileName)?"PivotChart":f.fileName:r,chartdata:s.split(",")[1],bgColor:h,exportFormat:u,title:f.title,description:f.description})},t.raiseWebFormsServerEvents&&(i=="excelExport"||i=="pdfExport"||i=="wordExport"||i=="imageExport")&&f.exportMode==t.PivotChart.ExportMode.ClientMode&&n.trim(f.url)==""?(a={model:this.model,originalEventType:i},v=o,t.raiseWebFormsServerEvents(i,a,v),setTimeout(function(){t.isOnWebForms=!0},1e3)):this.doPostBack(n.trim(f.url)!=""?f.url:i,o)):(o={args:JSON.stringify({exportOption:i,chartdata:s.split(",")[1],bgColor:h,title:f.title,description:f.description})},this.doPostBack(n.trim(f.url)!=""?f.url:this.model.url+"/"+this.model.serviceMethodSettings.exportPivotChart,o)))},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!0);n.ajax({type:r,url:u,data:f,async:a,contentType:h,dataType:c,success:l,complete:t.proxy(function(){var n={action:!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(s.action)?s.action:JSON.parse(f).action,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",n)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide();var t={action:this._currentAction,customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",t);this.renderChartFromJSON("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotChart.Locale={};t.PivotChart.Locale["en-US"]={Measure:"Measure",Row:"Row",Column:"Column",Value:"Value",Expand:"Expand",Collapse:"Collapse",Exit:"Exit",ChartTypes:"Chart Types",TDCharts:"3D Charts",Tooltip:"Tooltip",Exporting:"Exporting",Line:"Line",Spline:"Spline",Column:"Column",Area:"Area",SplineArea:"Spline Area",StepLine:"Step Line",StepArea:"Step Area",Pie:"Pie",Bar:"Bar",StackingArea:"Stacking Area",StackingColumn:"Stacking Column",StackingBar:"Stacking Bar",Pyramid:"Pyramid",Funnel:"Funnel",Doughnut:"Doughnut",Scatter:"Scatter",Bubble:"Bubble",TreeMap:"TreeMap",ColumnTD:"Column 3D",PieTD:"Pie 3D",BarTD:"Bar 3D",StackingBarTD:"StackingBar 3D",StackingColumnTD:"StackingColumn 3D",Excel:"Excel",Word:"Word",Pdf:"PDF",PNG:"PNG",EMF:"EMF",GIF:"GIF",JPG:"JPG",BMP:"BMP",ZoomIn:"Zoom In",ZoomOut:"Zoom Out",Legend:"Legend",SmartLabels:"Smart Labels",Interactions:"Interactions",Zooming:"Zooming",Rotate45:"Rotate45",Rotate90:"Rotate90",Trim:"Trim",MultipleRows:"Multiple Rows",Wrap:"Wrap",Hide:"Hide",WrapByWord:"Wrap By word",CrossHair:"Cross Hair",TrackBall:"Track Ball",DisableTD:"Disable 3D Charts",None:"None"};t.PivotChart.ChartTypes={Line:"line",Spline:"spline",Column:"column",Area:"area",SplineArea:"splinearea",StepLine:"stepline",StepArea:"steparea",Pie:"pie",Bar:"bar",StackingArea:"stackingarea",StackingColumn:"stackingcolumn",StackingBar:"stackingbar",Pyramid:"pyramid",Funnel:"funnel",Doughnut:"doughnut",Scatter:"scatter",Bubble:"bubble",WaterFall:"waterfall"};t.PivotChart.ExportOptions={Excel:"excel",Word:"word",PDF:"pdf",CSV:"csv",PNG:"png",JPG:"jpg",EMF:"emf",GIF:"gif",BMP:"bmp"};t.PivotChart.SymbolShapes={None:"none",LeftArrow:"leftarrow",RightArrow:"rightarrow",Circle:"circle",Cross:"cross",HorizLine:"horizline",VertLine:"vertline",Diamond:"diamond",Rectangle:"rectangle",Triangle:"triangle",InvertedTriangle:"invertedtriangle",Hexagon:"hexagon",Pentagon:"pentagon",Star:"star",Ellipse:"ellipse",Wedge:"wedge",Trapezoid:"trapezoid",UpArrow:"uparrow",DownArrow:"downarrow",Image:"image"};t.PivotChart.AnalysisMode={Olap:"olap",Pivot:"pivot"};t.PivotChart.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"};t.PivotChart.ExportMode={ClientMode:"clientmode",ServerMode:"servermode"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotTreeMap","ej.PivotTreeMap",{_rootCSS:"e-pivottreemap",element:null,model:null,validTags:["div","span"],defaults:n.extend(t.datavisualization.TreeMap.prototype.defaults,{url:"",cssClass:"",currentReport:"",operationalMode:"clientmode",customObject:{},isResponsive:!1,dataSource:{data:null,isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},serviceMethodSettings:{initialize:"InitializeTreeMap",drillDown:"DrillTreeMap"},locale:"en-US",drillSuccess:null,beforeServiceInvoke:null,afterServiceInvoke:null,load:null,renderComplete:null,renderFailure:null,renderSuccess:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum",drillDown:"enum"},customObject:"data"},locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJsonRecords:function(){return this._JSONRecords},setJsonRecords:function(n){this._JSONRecords=JSON.parse(n)},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this.element.empty().removeClass("e-pivottreemap"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");ptreemapProxy=this;this._olapReport="";this._JSONRecords=null;this._treeMapDatasource=[];this._currentAction="initialize";this._selectedItem="";this._selectedTagInfo=null;this._tagCollection=[];this._drilledMembers=[];this._startDrilldown=!1;this._isDrilled=!1;this._treeMap=null;this._waitingPopup=null;this._drillText="";this._showDrillText=""},_load:function(){var r,u;if(this.element.addClass(this.model.cssClass),n(this.element).parents(".e-pivotclient").length>0?(r=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),this.model.customObject=oclientProxy.model.customObject,n("#"+r._id+"_maxView")[0]?n("#"+r._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(r._waitingPopup)||r._waitingPopup.show()):(this.element.ejWaitingPopup({showOnInit:!0}),this._waitingPopup=this.element.data("ejWaitingPopup"),this._waitingPopup.show()),u=JSON.stringify(this.model.customObject),this.model.dataSource.data==null&&this.model.url==""&&this.model.dataSource.cube==""){this.renderTreeMapFromJSON(null);this._waitingPopup.hide();return}this.model.dataSource.data==null&&this.model.url!=""||this.model.dataSource.data!=null&&this.model.url!=""&&this.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(this.model.operationalMode=t.PivotTreeMap.OperationalMode.ServerMode,this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:this._currentAction,element:this.element,customObject:u}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize",currentReport:this.model.currentReport,customObject:u}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize"}),this.renderControlSuccess)):(this.model.operationalMode=t.PivotTreeMap.OperationalMode.ClientMode,this.model.dataSource.rows.length>1&&(this.model.dataSource.rows=[this.model.dataSource.rows[this.model.dataSource.rows.length-1]]),this.model.dataSource.cube!=""&&(this._trigger("beforePivotEnginePopulate",{treeMapObject:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)))},generateJSON:function(n,i){for(var g,a,c,ut,v,nt,e,u,f,o,tt=[],it=[],p="",k=[],y=[],s=[],w=[],l={},r=0;r<this.model.dataSource.values[0].measures.length;r++)p+=p==""?this.model.dataSource.values[0].measures[r].fieldCaption:"~"+this.model.dataSource.values[0].measures[r].fieldCaption;var rt=this.model.dataSource.values[0].axis,d=this.model.dataSource.rows.length,h=i[0][0].ColSpan,b=0;for(h-d<=0?(h=0,b=d,rowElementCount=d):(b=rt=="rows"?h-1:h,h=b-1),u=[],r=0;r<i.length;r++)for(f=0;f<i[r].length;f++)if(g=null,i[r][f].CSS==" value"&&w.push(i[r][f].Value),i[r][f].CSS=="rowheader"&&i[r][f].Value!=""){if(o={},g=i[r][f].Info+"::"+i[r][f].State,it.push(i[r][f].Info.replace(/&/g,"&")),tt.push(g),u.length==0&&i[r][f].Info.split(".")[0].indexOf("Measures")<0&&(o.level=r,o.index=f,o.label=i[r][f].Value,u.push(o)),u.length!=0&&i[r][f].Info.split(".")[0].indexOf("Measures")<0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e]))if(u[e].index==f&&u[e].level!=r){u[e].level=r;u[e].label=u[e].label+"~~"+i[r][f].Value;break}else if(u[e].level==r){for(a=!1,c=0;c<u.length;c++)if(!t.isNullOrUndefined(u[c])&&u[c].index==f){a=!0;break}if(!a&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){o.level=r;o.index=f;o.label=i[r][f].Value;u.push(o);break}}}else if(i[r][f].CSS=="summary"&&u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e])&&u[e].index==f){delete u[e];break}for(e=0;e<u.length;e++)t.isNullOrUndefined(u[e])||b==u[e].label.split("~~").length&&s.push(u[e].label);for(u=[],r=0;r<i.length;r++)for(f=0;f<i[r].length;f++)if(i[r][f].CSS=="colheader"&&i[r][f].Value!=""){if(o={},u.length==0&&(o.level=f,o.index=r,o.label=i[r][f].Value,u.push(o)),u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e]))if(u[e].index==r&&u[e].level!=f&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){u[e].index=r;u[e].label=u[e].label+"~~"+i[r][f].Value;break}else if(u[e].level==f&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){for(a=!0,c=0;c<u.length;c++)if(!t.isNullOrUndefined(u[c])&&(a=!1,u[c].index==r)){a=!0;break}if(!a&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){o.level=f;o.index=r;o.label=i[r][f].Value;u.push(o);break}}}else if(i[r][f].CSS=="summary"&&u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e])&&u[e].index==r){delete u[e];break}for(e=0;e<u.length;e++)t.isNullOrUndefined(u[e])||y.push(u[e].label);if(p!=""&&rt==t.olap.AxisName.Column)for(r=0;r<y.length;r++)y[r]=y[r]+"~"+p;if(h==0)for(ut=w.length/y.length,r=0;r<s.length;r++){for(u=[],f=r;f<w.length;f=f+ut)o={},o.Item1=s[r].indexOf("~~")>=0?s[r].split("~~")[0]:s[r],o.Item2=w[f],u.push(o);k.push(u)}else{for(v=[],nt=null,r=0;r<s.length;r++)for(u=[],f=0;f<i[h].length;f++)if(i[h][f].CSS=="rowheader"&&i[h][f].Value!=""&&s[r].split("~~")[s[r].split("~~").length-1]==i[h][f].Value){nt=f;u.push(nt);u.push(s[r]);v.push(u);break}for(e=0;e<v.length;e++){for(u=[],r=0;r<i.length;r++)for(f=v[e][0];f<i[r].length;f++){i[r][f].CSS==" value"&&(o={},o.Item1=v[e][1].indexOf("~~")>=0?v[e][1].split("~~")[0]:v[e][1],o.Item2=i[r][f].Value,u.push(o));break}u.length!=0&&k.push(u)}}l.labelTags=tt;l.drillTags=it;l.measureNames=p;l.points_Y=k;l.seriesNames=y;l.treemapLabels=s;ptreemapProxy._JSONRecords=l;this.renderTreeMapFromJSON(l);this._unWireEvents();this._wireEvents()},_wireEvents:function(){if(typeof oclientProxy=="undefined")n(window).on("resize",n.proxy(this._reSizeHandler,this));this._on(this.element,"click",".drillItem",this._drillTreeMap)},_drillTreeMap:function(r){var u=null,e,f,o,s;if(r.type=="treeMapGroupSelected"){if(ptreemapProxy._treemapWaitingPopup({show:!0}),r.selectedGroups.length==0){ptreemapProxy._treemapWaitingPopup({show:!1});return}for(ptreemapProxy._currentAction="drilldown",ptreemapProxy._selectedItem=r.selectedGroups[0].header,e=0;e<ptreemapProxy._treeMapDatasource.length;e++)if(ptreemapProxy._treeMapDatasource[e].Tag.split("::")[2]==ptreemapProxy._selectedItem){if(ptreemapProxy._selectedTagInfo=ptreemapProxy._treeMapDatasource[e].Tag,ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(u=ptreemapProxy._treeMapDatasource[e].drillTag),ptreemapProxy._selectedTagInfo.split("::")[ptreemapProxy._selectedTagInfo.split("::").length-1]!=2){ptreemapProxy._treeMap.refresh();ptreemapProxy._treemapWaitingPopup({show:!1});return}break}ptreemapProxy._startDrilldown=!0;ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(ptreemapProxy.model.beforeServiceInvoke!=null&&ptreemapProxy._trigger("beforeServiceInvoke",{action:ptreemapProxy._currentAction,element:ptreemapProxy.element,customObject:ptreemapProxy.model.customObject}),o=JSON.stringify(ptreemapProxy.model.customObject),ptreemapProxy.model.customObject!=""&&ptreemapProxy.model.customObject!=null&&ptreemapProxy.model.customObject!=i?typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports,customObject:o}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),customObject:o}),ptreemapProxy.renderControlSuccess):!typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport()}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports}),ptreemapProxy.renderControlSuccess)):(ptreemapProxy._drilledMembers.push(u),t.olap._mdxParser.updateDrilledReport({uniqueName:u,seriesInfo:[u],uniqueNameArray:ptreemapProxy._drilledMembers},"rowheader",ptreemapProxy))}else{if(ptreemapProxy._treemapWaitingPopup({show:!0}),ptreemapProxy._currentAction="drillup",n(r.target).hasClass("drillItem"))if(ptreemapProxy.getJsonRecords().treemapLabels[0].indexOf("~~")>=0){for(ptreemapProxy._selectedItem=n(r.target).text(),f=0;f<ptreemapProxy.getJsonRecords().labelTags.length;f++)if(ptreemapProxy.getJsonRecords().labelTags[f].split("::")[2]==ptreemapProxy._selectedItem&&ptreemapProxy.getJsonRecords().labelTags[f].split("::")[ptreemapProxy.getJsonRecords().labelTags[f].split("::").length-1]==1){if(ptreemapProxy._selectedTagInfo=ptreemapProxy.getJsonRecords().labelTags[f],ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(u=ptreemapProxy.getJsonRecords().drillTags[f]),ptreemapProxy._selectedTagInfo.split("::")[ptreemapProxy._selectedTagInfo.split("::").length-1]!=1){ptreemapProxy._treemapWaitingPopup({show:!1});return}break}}else{ptreemapProxy._treemapWaitingPopup({show:!1});return}ptreemapProxy._tagCollection.length==0&&(ptreemapProxy._isDrilled=!1);ptreemapProxy._startDrilldown=!0;ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(ptreemapProxy.model.beforeServiceInvoke!=null&&ptreemapProxy._trigger("beforeServiceInvoke",{action:ptreemapProxy._currentAction,element:ptreemapProxy.element,customObject:ptreemapProxy.model.customObject}),o=JSON.stringify(ptreemapProxy.model.customObject),ptreemapProxy.model.customObject!=""&&ptreemapProxy.model.customObject!=null&&ptreemapProxy.model.customObject!=i?typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports,customObject:o}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),customObject:o}),ptreemapProxy.renderControlSuccess):!typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport()}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports}),ptreemapProxy.renderControlSuccess)):(s=ptreemapProxy._drilledMembers.slice(0,n.inArray(u,ptreemapProxy._drilledMembers)+1),ptreemapProxy._drilledMembers=ptreemapProxy._drilledMembers.slice(0,n.inArray(u,ptreemapProxy._drilledMembers)),t.olap._mdxParser.updateDrilledReport({uniqueName:u,seriesInfo:[u],uniqueNameArray:s,action:"collapse"},"rowheader",ptreemapProxy))}},_unWireEvents:function(){n(window).off("resize",n.proxy(this._reSizeHandler,this));this._off(this.element,"click",".drillItem",this._drillTreeMap)},renderControlSuccess:function(r){var f,u;ptreemapProxy=this;ptreemapProxy._treemapWaitingPopup({show:!0});try{r[0]!=i?(this.setJsonRecords(r[0].Value),this.setOlapReport(r[1].Value),typeof oclientProxy!="undefined"&&(oclientProxy.currentReport=r[1].Value,r[2]!=null&&r[2]!=i&&r[2].Key=="ClientReports"&&(oclientProxy.reports=r[2].Value)),r[2]!=null&&r[2]!=i&&!r[2].Key=="ClientReports"&&(this.model.customObject=r[2].Value)):r.d!=i?(this.setJsonRecords(r.d[0].Value),this.setOlapReport(r.d[1].Value),typeof oclientProxy!="undefined"&&(oclientProxy.currentReport=r.d[1].Value,r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="ClientReports"&&(oclientProxy.reports=r.d[2].Value)),r.d[2]==null||r.d[2]==i||r.d[2].Key=="ClientReports"||(this.model.customObject=r.d[2].Value)):(this.setJsonRecords(r.JsonRecords),this.setOlapReport(r.OlapReport),r.customObject!=null&&r.customObject!=null&&(this.model.customObject=r.customObject),typeof oclientProxy!="undefined"&&(typeof oclientProxy.currentReport!="undefined"&&(oclientProxy.currentReport=r.OlapReport),typeof oclientProxy.reports!="undefined"&&r.reports!=i&&r.reports!="undefined"&&(oclientProxy.reports=r.reports)));this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode&&(f=this._currentAction!="initialize"?{action:this._currentAction,element:this.element,customObject:this.model.customObject}:{action:this._currentAction,element:this.element,customObject:this.model.customObject},this._trigger("afterServiceInvoke",f));this.renderTreeMapFromJSON(this.getJsonRecords());this._unWireEvents();this._wireEvents();this._currentAction!="initialize"&&(this.model.currentReport=this.getOlapReport(),this._trigger("drillSuccess",this.element));u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(u)||(u._isTimeOut=!1);typeof u!="undefined"&&u._waitingPopup!=null?(n("#"+u._id+"_maxView")[0]?n("#"+u._id+"_maxView").ejWaitingPopup({showOnInit:!1}):typeof u._pivotGrid!="undefined"&&(u&&u._pivotGrid._drillAction&&!u._pivotGrid._startDrilldown||u.otreemapObj._currentAction&&!u.otreemapObj._startDrilldown?u._waitingPopup.hide():!u||u._pivotGrid._drillAction!=""||u.otreemapObj._currentAction!=""||u._pivotGrid._startDrilldown||u.otreemapObj._startDrilldown||u._pivotGrid._JSONRecords==null&&u.otreemapObj._JSONRecords!=null?!u.otreemapObj._startDrilldown||u._pivotGrid._startDrilldown||n("#"+u._id+"_maxView")[0]?u.otreemapObj._startDrilldown||u._pivotGrid._startDrilldown||u.otreemapObj._currentAction!=""||u._pivotGrid._drillAction!=""||u._pivotGrid._JSONRecords==null&&u.otreemapObj._JSONRecords!=null||u._waitingPopup.hide():u._waitingPopup.hide():u._waitingPopup.hide()),u.model.displaySettings.mode=="chartonly"&&u._waitingPopup.hide()):this._waitingPopup.hide();typeof u!="undefined"&&(u.otreemapObj._startDrilldown=!1)}catch(e){}t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this)},renderTreeMapFromJSON:function(i){var s,f,y,l,e,o,v,h,u,a,c,p,r,w,b;if(this._treeMapDatasource=[],s="",t.isNullOrUndefined(i)||i.length<=0||i.labelTags.length==0||i.points_Y.length==0){ptreemapProxy._treemapWaitingPopup({show:!1});return}if(t.isNullOrUndefined(i.chartLables)?i.treemapLabels:i.treemapLabels=i.chartLables,i.points_Y.length!=i.treemapLabels.length)for(oclientProxy._onFiltered=!1,f=[],r=0;r<JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y)).length-1;r++)f.push(JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y))[r]);else f=JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y));for(typeof oclientProxy!="undefined"&&oclientProxy.model.enableDeferUpdate&&oclientProxy._ischartTypesChanged&&(oclientProxy._ischartTypesChanged=!1),r=0;r<f.length;r++)for(y=ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length-1],u=0;u<f[r].length;u++)f[r][u].Item1=f[r][u].Item1.replace(f[r][u].Item1,y),f[r][u].Column=ptreemapProxy.getJsonRecords().seriesNames[u].split("~")[0],f[r][u].Measures=ptreemapProxy.getJsonRecords().measureNames,f[r][u].Tag=n.grep(ptreemapProxy.getJsonRecords().labelTags,function(n){return n.split("::")[2]==f[r][u].Item1})[0],this.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(f[r][u].drillTag=n.grep(ptreemapProxy.getJsonRecords().drillTags,function(n){return n.split("::")[2]==f[r][u].Item1})[0]),f[r][u][f[r][u].Tag.split("::")[1].split(".")[0].replace("[","").replace("]","")]=f[r][u].Item1,f[r][u].RowItem=f[r][u].Item1,f[r][u].Value=f[r][u].Item2!=""?f[r][u].Item2:"0",f[r][u].Index=u,delete f[r][u].Item1,delete f[r][u].Item2,s+=(s==""?"":";")+f[r][u].Tag.split("::")[1].split(".")[0].replace("[","").replace("]","");if(t.isNullOrUndefined(ptreemapProxy.getJsonRecords().measureNames)||(l=ptreemapProxy.getJsonRecords().measureNames.split("~")),l.length!=2)for(r=0;r<f.length;r++)for(u=0;u<f[r].length;u++)f[r][u].Value=t.isNullOrUndefined(f[r][u].Value)?0:(f[r][u].Value.indexOf(",")||f[r][u].Value.indexOf(".")||f[r][u].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(f[r][u].Value,"c",this.model.locale),this.model.locale):t.globalize.parseFloat(f[r][u].Value),this._treeMapDatasource.push(f[r][u]),(t.isNullOrUndefined(e)||e>=f[r][u].Value)&&(e=f[r][u].Value),(t.isNullOrUndefined(o)||o<=f[r][u].Value)&&(o=f[r][u].Value);else l.length==2&&(v=[],n.each(f,function(i,r){for(var u=0;u<r.length;u++)t.isNullOrUndefined(r[u].Value)||(r[u].Value=t.isNullOrUndefined(r[u].Value)?0:(r[u].Value.indexOf(",")||r[u].Value.indexOf(".")||r[u].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(r[u].Value,"c",ptreemapProxy.model.locale),ptreemapProxy.model.locale):t.globalize.parseFloat(r[u].Value),r[u].Color=r[u].Value,t.isNullOrUndefined(r[u+1])?r[u].Value=0:r[u].Column==r[u+1].Column&&(r[u].Value=t.isNullOrUndefined(r[u+1].Value)?0:(r[u+1].Value.indexOf(",")||r[u+1].Value.indexOf(".")||r[u+1].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(r[u+1].Value,"c",ptreemapProxy.model.locale),ptreemapProxy.model.locale):t.globalize.parseFloat(r[u+1].Value),u=u+1));n.each(r,function(n,i){t.isNullOrUndefined(i)||t.isNullOrUndefined(i.Value)||!t.isNullOrUndefined(i.Color)||r.splice(n,1)});n.each(r,function(n,i){t.isNullOrUndefined(i)||(i.Index=n,v.push(i))})}),this._treeMapDatasource=v,n.each(this._treeMapDatasource,function(n,i){t.isNullOrUndefined(i.Color)||((t.isNullOrUndefined(e)||e>=i.Color)&&(e=i.Color),(t.isNullOrUndefined(o)||o<=i.Color)&&(o=i.Color))}));if(ptreemapProxy.getJsonRecords().treemapLabels.length>0){for(ptreemapProxy._drillText="",h=[],r=0;r<ptreemapProxy.getJsonRecords().treemapLabels.length;r++)if(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length>1)for(u=0;u<ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length-1;u++){for(a=0,c=0;c<ptreemapProxy.getJsonRecords().labelTags.length;c++)if(ptreemapProxy.getJsonRecords().labelTags[c].split("::")[2]==ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]&&ptreemapProxy.getJsonRecords().labelTags[c].split("::")[ptreemapProxy.getJsonRecords().labelTags[c].split("::").length-1]==1){a=1;break}h.length==0&&a==1?h.push(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]):h.length>0&&(p=jQuery.inArray(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u],h),p==-1&&a==1&&h.push(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]))}for(r=0;r<h.length;r++)ptreemapProxy._drillText+=ptreemapProxy._drillText==""?t.buildTag("a.drillItem",h[r])[0].outerHTML:" > "+t.buildTag("a.drillItem",h[r])[0].outerHTML}this._showDrillText=ptreemapProxy._drillText==""?t.buildTag("span.drillup",s.split(";")[0],{"margin-left":"5px"})[0].outerHTML:t.buildTag("span.drillup",s.split(";")[0],{"margin-left":"5px"})[0].outerHTML+": "+ptreemapProxy._drillText;w=t.buildTag("div#"+this._id+"TreeMapContainer","",{height:typeof oclientProxy!="undefined"?(parseInt(oclientProxy._chartHeight)-50).toString()+"px":this.element.height(),width:typeof oclientProxy!="undefined"?oclientProxy._chartWidth:this.element.width(),"margin-top":"50px"})[0].outerHTML;this.element.html(w);e=e-1;o=o+1;s=s.split(";")[0];n("#"+this._id+"TreeMapContainer").ejTreeMap({dataSource:this._treeMapDatasource,showTooltip:!0,colorValuePath:l.length==2?"Color":"Value",tooltipTemplate:"tooltipTemplate",enableDrillDown:!1,enableGradient:!0,highlightGroupOnSelection:typeof oclientProxy!="undefined"?oclientProxy.model.enableDeferUpdate?!1:!0:!0,treeMapGroupSelected:this._drillTreeMap,refreshed:this._treeMapRenderSuccess,showLegend:!0,legendSettings:{leftLabel:e.toString(),width:150,height:20,title:this._treeMapDatasource[0].Measures,rightLabel:o.toString(),mode:"interactive",dockPosition:"bottom",alignment:"center"},rangeColorMapping:[{from:e,to:o,gradientColors:["#fde6cc","#fab665"]}],weightValuePath:"Value",leafItemSettings:{showLabels:!0,labelPath:"Column",labelVisibilityMode:"hideonexceededlength"},levels:[{groupPath:s,groupGap:2,showHeader:!0,headerHeight:25,labelPosition:"topleft",headerVisibilityMode:"hideonexceededlength"}]});this._treeMap=n("#"+this._id+"TreeMapContainer").data("ejTreeMap");this._treeMap.rowItem=s;n.views.helpers({Measures:function(n){return n.Measures},Row:function(n){return n.Column},Column:function(n){return n.RowItem},Value:function(n){return n.Value},Color:function(n){return t.isNullOrUndefined(n.Color)?n.Value:n.Color}});b={action:this._currentAction,customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",b);typeof oclientProxy!="undefined"&&n("#"+this._id+"TreeMapContainer").css({width:"100%"});this._treeMap.refresh();ptreemapProxy=this;ptreemapProxy._JSONRecords=i;ptreemapProxy._treemapWaitingPopup({show:!1})},_treemapWaitingPopup:function(i){if(ptreemapProxy=n(this.element).hasClass("e-pivottreemap")?n(this.element).data("ejPivotTreeMap"):n(this.element).parents(".e-pivottreemap").data("ejPivotTreeMap"),n(ptreemapProxy.element).parents(".e-pivotclient").length>0){var r=n(ptreemapProxy.element).parents(".e-pivotclient").data("ejPivotClient");t.isNullOrUndefined(r)||i.show||(r._isTimeOut=!1);n("#"+r._id+"_maxView")[0]?n("#"+r._id+"_maxView").ejWaitingPopup({showOnInit:i.show}):t.isNullOrUndefined(r._waitingPopup)||(i.show?r._waitingPopup.show():r._waitingPopup.hide())}else!t.isNullOrUndefined(ptreemapProxy._waitingPopup)&&i.show?ptreemapProxy._waitingPopup.show():ptreemapProxy._waitingPopup.hide()},_treeMapRenderSuccess:function(){ptreemapProxy._treeMap=n("#"+ptreemapProxy._id+"TreeMapContainer").data("ejTreeMap");t.isNullOrUndefined(ptreemapProxy._treeMap)||(ptreemapProxy._treeMap.model.legendSettings.dockPosition=="top"?ptreemapProxy.element.find("#"+ptreemapProxy._id+"TreeMapContainer").children().hasClass("drillupAction")||n(t.buildTag("div#drillHeader .drillupAction",ptreemapProxy._showDrillText,{height:"25px",width:"99.8%","z-index":"10",position:"absolute","margin-top":"33px"})[0].outerHTML).insertAfter(n("#"+ptreemapProxy._id+"TreeMapContainer").find(".LegendDiv").css("margin-top","-50px").css("font-size","12px")):(n("#"+ptreemapProxy._id+"TreeMapContainer").find(".LegendDiv").css("font-size","12px").insertAfter(n("#"+ptreemapProxy._id+"TreeMapContainer").find("._templateDiv")),n(t.buildTag("div#drillHeader .drillupAction",ptreemapProxy._showDrillText,{height:"25px",width:"99.8%",position:"absolute","margin-top":"-32px"})[0].outerHTML).insertBefore(n("#"+ptreemapProxy._id+"TreeMapContainer").find("#backgroundTile"))))},_reSizeHandler:function(){var n=ptreemapProxy.element.find("#"+ptreemapProxy._id+"TreeMapContainer").width(ptreemapProxy.element.width()).data("ejTreeMap");t.isNullOrUndefined(n)||n.refresh()},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(t){n.proxy(t,this);var i={action:this._currentAction,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",i)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();ptreemapProxy._treemapWaitingPopup({show:!1});var t={action:this._currentAction,customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",t);this.renderTreeMapFromJSON("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotTreeMap.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotGauge","ej.PivotGauge",{_rootCSS:"e-pivotgauge",element:null,model:null,validTags:["div","span"],defaults:n.extend({},t.datavisualization.CircularGauge.prototype.defaults,{url:"",analysisMode:"pivot",operationalMode:"clientmode",cssClass:"",rowsCount:0,columnsCount:0,enableTooltip:!1,enableAnimation:!1,isResponsive:!1,enableRTL:!1,labelFormatSettings:{numberFormat:"default",decimalPlaces:5,prefixText:"",suffixText:""},showHeaderLabel:!0,scales:t.datavisualization.CircularGauge.prototype._defaultScaleValues(),customObject:{},dataSource:{data:null,sourceInfo:"",providerName:"ssas",isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},locale:"en-US",serviceMethodSettings:{initialize:"InitializeGauge"},renderSuccess:null,renderComplete:null,renderFailure:null,beforeServiceInvoke:null,afterServiceInvoke:null,load:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum"},customObject:"data",scales:"data"},observables:["rowsCount","columnsCount","showHeaderLabel","locale","radius","frameType"],rowsCount:t.util.valueFunction("rowsCount"),columnsCount:t.util.valueFunction("columnsCount"),showHeaderLabel:t.util.valueFunction("showHeaderLabel"),locale:t.util.valueFunction("locale"),radius:t.util.valueFunction("radius"),frameType:t.util.valueFunction("frameType"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(n){this._JSONRecords=JSON.parse(n)},_init:function(){this.model=n.extend(t.datavisualization.CircularGauge.prototype.defaults,this.model);this._scalesInitialize();this._initPrivateProperties();this._load()},_scalesInitialize:function(){this.model.scales!=null?n.each(this.model.scales,t.proxy(function(i,r){var u=t.datavisualization.CircularGauge.prototype._defaultScaleValues();n.extend(u,r);n.extend(r,u)},this)):this.model.scales=[t.datavisualization.CircularGauge.prototype._defaultScaleValues()];this.model.enableRTL&&n.each(this.model.scales,function(n,t){t.direction="counterClockwise"})},_destroy:function(){this._unWireEvents();this.element.empty().removeClass("e-pivotgauge"+this.model.cssClass);this._ogaugeWaitingPopup!=i&&this._ogaugeWaitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._maximum=[];this._maxValue=0;this._pointerValue_0=0;this._pointerValue_1=0;this._currentLayout="";this._defaultArea=0;this._defaultWidth=0;this._gaugeObj={};this._ogaugeWaitingPopup=null;this._ogaugeProgressBar=null;this._ogaugeProgressText=null;this._notationStr=null;this._ogaugeTimer=null},_load:function(){var r,u;this.element.addClass(this.model.cssClass);n("#"+this._id).ejWaitingPopup({showOnInit:!0});this._ogaugeWaitingPopup=n("#"+this._id).data("ejWaitingPopup");this.model.load!=null&&this._trigger("load",{action:"initialize",model:this.model,element:this.element,customObject:this.model.customObject});r=JSON.stringify(this.model.customObject);this.model.dataSource&&typeof this.model.dataSource.data=="string"?(this._trigger("beforePivotEnginePopulate",{gaugeObject:this}),this.model.operationalMode=t.PivotGauge.OperationalMode.ClientMode,t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)):this.model.dataSource&&typeof this.model.dataSource.data=="object"&&this.model.dataSource.data!=null?(this._trigger("beforePivotEnginePopulate",{gaugeObject:this}),u=t.PivotAnalysis.pivotEnginePopulate(this.model),this._dataModel="Pivot",this.generateJSON({baseObj:this},u.pivotEngine)):this.model.customObject!=null&&this.model.customObject!=i&&this.model.customObject!={}&&(this.model.operationalMode=t.PivotGauge.OperationalMode.ServerMode,this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{element:this.element,customObject:this.model.customObject}),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initializeGauge",customObject:r}),this._renderControlSuccess))},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"OlapReport":this.setOlapReport(n[t]);break;case"JsonData":this.setOlapReport(n[t]);break;case"RefreshPivotGauge":this.element.renderControlFromJSON(n[t]);break;case"customObject":this.model.customObject=n[t];break;case"locale":this.locale();break;case"rowsCount":this.rowsCount();break;case"columnsCount":this.columnsCount();break;case"showHeaderLabel":this.showHeaderLabel();break;case"locale":this.locale();break;case"radius":this.radius();break;case"frameType":this.frameType()}this._gaugeObj.obj0&&this._renderControlSuccess({PivotRecords:JSON.stringify(this.getJSONRecords()),OlapReport:this.getOlapReport()})},_wireEvents:function(){this.element.find(".e-circulargauge").mouseenter(t.proxy(function(n){this.model.enableTooltip&&this._showTooltip(n)},this)).mouseout(t.proxy(function(){n(this._tooltip).fadeOut("slow")},this)).mousemove(t.proxy(function(n){this.model.enableTooltip&&(this._showTooltip(n),this._hideTooltip())},this))},_getLocalizedLabels:function(n){return t.PivotGauge.Locale[this.locale()][n]===i?t.PivotGauge.Locale["en-US"][n]:t.PivotGauge.Locale[this.locale()][n]},_unWireEvents:function(){},_showTooltip:function(r){var e,o,f,l;if(t.browserInfo().name!="msie"||!(t.browserInfo().version<=8)){n(this._tooltip).remove();var c=r.target.id.split("_")==""?r.target.parentNode.id.split("_"):r.target.id.split("_"),u=c[c.length-1],s=this._numberFormatConversion(this._JSONRecords[u].GoalValue||0,this.model.labelFormatSettings.numberFormat,this.model.labelFormatSettings.decimalPlaces),h=this._numberFormatConversion(this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value,this.model.labelFormatSettings.numberFormat,this.model.labelFormatSettings.decimalPlaces),a=this._setMaxScaleValue(this._JSONRecords[u].GoalValue||0,this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value,u);if(this.model.labelFormatSettings.numberFormat==t.PivotGauge.NumberFormat.Notation){for(e=this._JSONRecords[u].GoalValue||0,o=this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value;e>=10;)e=parseInt(e)/10;while(o>=10)o=parseInt(o)/10;s=e.toFixed(1)+s;h=o.toFixed(1)+h}f=this._JSONRecords[u].MemberName||this._JSONRecords[u].Measure;(f==i||f=="undefined")&&(f=this._JSONRecords[u].MeasureCaption);l=this.model.enableRTL||this._gaugeObj["obj"+u].model.scales[0].direction=="counterClockwise"?f.split(" - ").reverse().join(" - ")+"<br/>"+s+" :"+this._getLocalizedLabels("RevenueGoal")+"<br/>"+h+" :"+this._getLocalizedLabels("RevenueValue"):f+"<br/>"+this._getLocalizedLabels("RevenueGoal")+": "+s+"<br/>"+this._getLocalizedLabels("RevenueValue")+": "+h;this._tooltip=t.buildTag("div.e-pivotgauge-tooltip",l);n(this._tooltip).appendTo("body");n(this._tooltip).addClass(".e-pivotgauge-active");this._changeTooltipPos(r);this.model.enableRTL||this._gaugeObj["obj"+u].model.scales[0].direction=="counterClockwise"?n(this._tooltip).css("text-align","right"):n(this._tooltip).css("text-align","left")}},_changeTooltipPos:function(t){var i=t.pageX-8,r=t.pageY+8;n(this._tooltip).css({top:r,left:i})},_hideTooltip:function(){window.setTimeout(t.proxy(function(){n(this._tooltip).fadeOut(1500,"linear")},this),3e3)},_renderControlSuccess:function(n){var u,f,c,l,e;try{this.model.analysisMode=n.DataModel=="Olap"?t.PivotGauge.AnalysisMode.Olap:t.PivotGauge.AnalysisMode.Pivot;var r="",o="",s="",a="",h=0;if(n[0]!=i&&n.length>0?(this.setJSONRecords(n[0].Value),this.setOlapReport(n[1].Value),n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value)):n.d!=i&&n.d.length>0?(this.setJSONRecords(n.d[0].Value),this.setOlapReport(n.d[1].Value),n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value)):n.PivotRecords&&n.OlapReport&&(this.setJSONRecords(n.PivotRecords),this.setOlapReport(n.OlapReport),n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject)),this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGauge.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{element:this.element,customObject:this.model.customObject}),u=this.getJSONRecords(),u!=null&&u.length>0){if(this.rowsCount()<1&&this.columnsCount()<1){for(this._currentLayout="WrapPanel",f=0;f<u.length;f++)o=t.buildTag("img#statusIndicator_"+f+".kpiiconvalue")[0].outerHTML,s=t.buildTag("img#trendIndicator_"+f+".kpiiconvalue")[0].outerHTML,a+=t.buildTag("li",t.buildTag("div#"+this._id+"_"+f,o+s)[0].outerHTML)[0].outerHTML;r=t.buildTag("ul.wrapLayout",a)[0].outerHTML}else{for(this._currentLayout="Table",(this.columnsCount()==i||this.columnsCount()<1)&&this.columnsCount((u.length/this.rowsCount()).toFixed()),(this.rowsCount()==i||this.rowsCount()<1)&&this.rowsCount((u.length/this.columnsCount()).toFixed()),r="<table><tbody>",c=0;c<this.rowsCount();c++){for(r+="<tr>",l=0;l<this.columnsCount();l++)o=t.buildTag("img#statusIndicator_"+h+".kpiiconvalue")[0].outerHTML,s=t.buildTag("img#trendIndicator_"+h+".kpiiconvalue")[0].outerHTML,r+="<td>"+t.buildTag("div#"+this._id+"_"+h,o+s)[0].outerHTML+"<\/td>",h++;r+="<\/tr>"}r+="<\/tbody><\/table>"}this.element.html(r);e=this;setTimeout(function(){e.renderControlFromJSON(u);var n={element:e.element,customObject:e.model.customObject};e._trigger("renderSuccess",n)},0);this._defaultWidth=this.element.find("canvas").width();this._defaultArea=this.element.find("table").height()*this.element.find("table").width()}}catch(v){}t.isNullOrUndefined(n.Exception)||t.Pivot._createErrorDialog(n,"Exception",this)},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,async:!1,dataType:c,data:f,success:l,complete:t.proxy(function(){var n={element:this.element,customObject:this.model.customObject};this._trigger("renderComplete",n)},this),error:t.proxy(function(n){this._ogaugeWaitingPopup.hide();var t={element:this.element,Message:n,customObject:this.model.customObject};this._trigger("renderFailure",t)},this)})},_getCalculatedValue:function(n){var t=n.toString(),r=1,f,i,u;for(f=t.indexOf(".")>-1?t.split(".")[0].length:t.length,i=parseInt(t),u=0;u<f;u++)i>this._maxValue&&(i=i/10,r=r*10);return r},_findNearestUpperLimit:function(n,t){var r=n.toString(),i=parseInt(r),u=i%t;return i+(t-u)},_setMaxScaleValue:function(n,t,i){var r;return t>n?(r=this._getCalculatedValue(t),this._maximum[i]=this._findNearestUpperLimit(t/r,10)):(r=this._getCalculatedValue(n),this._maximum[i]=this._findNearestUpperLimit(n/r*4/3,10)),r},_numberFormatConversion:function(n,i,r){function s(n,t){for(var i=n,r=t;;){if(!(i%=r))return r;if(!(r%=i))return i}}var e,n,r,o,u,f;switch(i){case t.PivotGauge.NumberFormat.Default:return parseFloat(n).toFixed(r);case t.PivotGauge.NumberFormat.Text:return n.toString();case t.PivotGauge.NumberFormat.Currency:return t.format(parseInt(n),"c",this.model.locale);case t.PivotGauge.NumberFormat.Percentage:return n*=100,parseFloat(n).toFixed(2)+"%";case t.PivotGauge.NumberFormat.Fraction:for(n||(n=this),e=String(n).split(".")[0],n=parseFloat("."+String(n).split(".")[1]),n=n.toFixed(4),r="1",z=0;z<String(n).length-2;z++)r+="0";for(n=n*r,r=parseInt(r),z=2;z<n+1;z++)n%z==0&&r%z==0&&(n=n/z,r=r/z,z=2);return n.toString().length==2&&r.toString().length==3?(n=Math.round(Math.round(n)/10),r=Math.round(Math.round(r)/10)):n.toString().length==2&&r.toString().length==2&&(n=Math.round(n/10),r=Math.round(r/10)),o=s(n,r),(e==0?"":e+" ")+n/o+"/"+r/o;case t.PivotGauge.NumberFormat.Scientific:return parseFloat(n).toExponential();case t.PivotGauge.NumberFormat.Notation:for(u=0,f=parseInt(n);f>=1;)f=parseInt(f)/10,u++;return this._notationStr=u==1?"da":u==2?"h":u==3?"k":u==4?"k*da":u==5?"k*h":u==6?"M":u==7?"M*da":u==8?"M*h":u==9?"G":u==10?"G*da":u==11?"G*h":u==12?"T":""}},removeImg:function(){this.element.find("img").remove()},renderControlFromJSON:function(r){var b,u,c,ot,l,st,ht,f;for(this._maxValue=99,maxGaugeCount=0,b=this.radius()/22,this._currentLayout=="Table"&&this.rowsCount()*this.columnsCount()<=r.length?maxGaugeCount=this.rowsCount()*this.columnsCount():(this._currentLayout=="WrapPanel"||this.rowsCount()*this.columnsCount()>r.length)&&(maxGaugeCount=r.length),u=0;u<maxGaugeCount;u++){var a=0,v=0,nt=0,h=0,tt=0,y=0,p=0,k=0,e="",o,it=[],rt=[],d=[],ut=[],ft=[],et=[],g=[],s="",w="";if(r[u].MeasureValue!=null&&r[u].MeasureValue!=i?(v=parseFloat(r[u].MeasureValue)||0,a=parseFloat(r[u].GoalValue)||0,e=this.model.labelFormatSettings.prefixText+" "+r[u].MeasureCaption+(n.trim(r[u].MemberName)?" - ":"")+r[u].MemberName+" "+this.model.labelFormatSettings.suffixText):(v=parseFloat(r[u].Value),a=0,e=r[u].Measure,this.model.scales[0].showIndicators=!1),e=this.model.enableRTL||this.model.scales[0].direction=="counterClockwise"?e.split(" - ").reverse().join(" - "):e,y=this._setMaxScaleValue(a,v,u),tt=v,p=a/y,k=tt/y,this._pointerValue_0=h+k,this._pointerValue_1=p+h,nt=h,h=h+k,r[u].StatusGraphic=="Traffic Signals"?r[u].StatusValue==-1?s="kpiredroad":r[u].StatusValue==0?s="kpiallcolor":r[u].StatusValue==1&&(s="kpigreenroad"):r[u].StatusValue==-1?s="kpidiamond":r[u].StatusValue==0?s="kpitriangle":r[u].StatusValue==1&&(s="kpicircle"),o=this.element.find("#statusIndicator_"+[u]).addClass(s),o!=null&&o!=i&&(c=n(o).css("background-image"),ot={height:15,width:15,type:"image",imageUrl:!t.isNullOrUndefined(c)&&c!="none"&&c!=""?c.split("(")[1].split(")")[0].replace('"',"").replace('"',""):"",position:{x:this.radius()-20,y:260},location:{x:this.radius()-20,y:260}}),r[u].TrendGraphic!=null&&r[u].TrendGraphic!=i&&r[u].TrendGraphic!=""&&r[u].TrendGraphic.toLowerCase()=="standard arrow"&&(r[u].TrendValue==-1?w="kpidownarrow":r[u].TrendValue==0?w="kpirightarrow":r[u].TrendValue==1&&(w="kpiuparrow"),o=this.element.find("#trendIndicator_"+[u]).toggleClass(w)),t.isNullOrUndefined(o)||(l=n(o).css("background-image"),st={height:15,width:15,type:"image",imageUrl:!t.isNullOrUndefined(l)&&l!="none"&&l!=""?l.split("(")[1].split(")")[0].replace('"',"").replace('"',""):"",position:{x:this.radius(),y:260},location:{x:this.radius(),y:260}}),!t.isNullOrUndefined(this.model.scales[0])){for(this.frameType()=="fullcircle"?(this.model.scales[0].startAngle=122,this.model.scales[0].sweepAngle=296):this.frameType()=="halfcircle"&&(this.model.scales[0].startAngle=180,this.model.scales[0].sweepAngle=180),this.model.scales[0].indicators=this.model.scales[0].showIndicators?[ot,st]:this.model.scales[0].indicators,t.isNullOrUndefined(this.model.scales[0].pointers[0])||(ht=t.datavisualization.CircularGauge.prototype._defaultScaleValues().pointerCap,this.model.scales[0].pointers[0].value=this._pointerValue_0,this.model.scales[0].pointers[0].pointerCap=ht,this.model.scales[0].pointers[0].pointerCap.radius=b),t.isNullOrUndefined(this.model.scales[0].pointers[1])||(this.model.scales[0].pointers[1].value=this._pointerValue_1,this.model.scales[0].pointers[1].type=this.model.scales[0].pointers[1].type||"marker",this.model.scales[0].pointers[1].markerType=this.model.scales[0].pointers[1].markerType||"diamond",this.model.scales[0].pointers[1].placement=this.model.scales[0].pointers[1].placement||"center"),t.isNullOrUndefined(this.model.scales[0].ranges[0])||(this.model.scales[0].ranges[0].startValue=nt,this.model.scales[0].ranges[0].endValue=p),t.isNullOrUndefined(this.model.scales[0].ranges[1])||(this.model.scales[0].ranges[1].startValue=p,this.model.scales[0].ranges[1].endValue=this._maximum[u]),t.isNullOrUndefined(this.model.scales[0].customLabels[0])||(this.model.scales[0].customLabels[0].value=this.showHeaderLabel()?"X "+y:""),t.isNullOrUndefined(this.model.scales[0].customLabels[1])||(this.model.scales[0].customLabels[1].value=this.showHeaderLabel()?e:""),t.isNullOrUndefined(this.model.scales[0].customLabels[2])||(this.model.scales[0].customLabels[2].value=this.showHeaderLabel()?e:""),f=0;f<this.model.scales[0].ranges.length;f++)it.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().ranges[0],this.model.scales[0].ranges[f]));for(f=0;f<this.model.scales[0].pointers.length;f++)rt.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().pointers[0],this.model.scales[0].pointers[f]));for(f=0;f<this.model.scales[0].labels.length;f++)this.model.labelFormatSettings.numberFormat!=t.PivotGauge.NumberFormat.Notation||t.isNullOrUndefined(t.datavisualization.CircularGauge.prototype._defaultScaleValues().labels[0])||(this._numberFormatConversion(this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value,this.model.labelFormatSettings.numberFormat,this.model.labelFormatSettings.decimalPlaces),this.model.scales[0].labels[f].unitText=this._notationStr),d.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().labels[0],this.model.scales[0].labels[f]));for(f=0;f<this.model.scales[0].labels.length;f++)d.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().labels[0],this.model.scales[0].labels[f]));for(f=0;f<this.model.scales[0].customLabels.length;f++)ut.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().customLabels[0],this.model.scales[0].customLabels[f]));for(f=0;f<this.model.scales[0].ticks.length;f++)ft.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().ticks[0],this.model.scales[0].ticks[f]));if(this.model.scales[0].indicators)for(f=0;f<this.model.scales[0].indicators.length;f++)et.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().indicators[0],this.model.scales[0].indicators[f]));for(newScale={pointerCap:{radius:b||this.model.scales[0].pointerCap.radius,borderWidth:this.model.scales[0].pointerCap.borderWidth,interiorGradient:this.model.scales[0].pointerCap.interiorGradient,borderColor:this.model.scales[0].pointerCap.borderColor,backgroundColor:this.model.scales[0].pointerCap.backgroundColor},border:{color:this.model.scales[0].border.color,width:this.model.scales[0].border.width},majorIntervalValue:this.model.scales[0].majorIntervalValue,minorIntervalValue:this.model.scales[0].minorIntervalValue,minimum:this.model.scales[0].minimum,backgroundColor:this.model.scales[0].backgroundColor,direction:this.model.scales[0].direction,showPointers:this.model.scales[0].showPointers,showTicks:this.model.scales[0].showTicks,showLabels:this.model.scales[0].showLabels,showIndicators:this.model.scales[0].showIndicators,showRanges:this.model.scales[0].showRanges,showScaleBar:this.model.scales[0].showScaleBar,startAngle:this.model.scales[0].startAngle,sweepAngle:this.model.scales[0].sweepAngle,radius:this.model.scales[0].radius,size:this.model.scales[0].size,maximum:this.model.scales[0].maximum||this._maximum[u],pointers:rt,ticks:ft,labels:d,ranges:it,customLabels:ut,indicators:et},f=0;f<this.model.scales.length;f++)f==0?g.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues(),newScale)):g.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues(),this.model.scales[f]))}n("#"+this._id+"_"+u).ejCircularGauge({backgroundColor:this.model.backgroundColor,frame:{frameType:this.model.frame.frameType,halfCircleFrameStartAngle:this.model.halfCircleFrameStartAngle,halfCircleFrameEndAngle:this.model.halfCircleFrameEndAngle},radius:this.radius(),width:this.model.width,height:this.model.height,interiorGradient:this.model.interiorGradient,readOnly:this.model.readOnly,enableResize:this.model.isResponsive,enableAnimation:t.isMobile()?!1:this.model.enableAnimation,animationSpeed:this.model.animationSpeed,theme:this.model.theme,isRadialGradient:this.model.isRadialGradient,load:this.model.load,drawTicks:this.model.drawTicks,drawLabels:this.model.drawLabels,drawPointers:this.model.drawPointers,drawRange:this.model.drawRange,drawCustomLabel:this.model.drawCustomLabel,drawIndicators:this.model.drawIndicators,drawPointerCap:this.model.drawPointerCap,renderComplete:this.model.renderComplete,mouseClick:this.model.mouseClick,mouseClickMove:this.model.mouseClickMove,mouseClickUp:this.model.mouseClickUp,scales:g});this._gaugeObj["obj"+u]=n("#"+this._id+"_"+u).data("ejCircularGauge")}this.removeImg();this._wireEvents();t.isNullOrUndefined(this._ogaugeWaitingPopup)||this._ogaugeWaitingPopup.hide()},refresh:function(){if(this._gaugeObj==null||this._gaugeObj==i)for(var t=0;t<this._JSONRecords.length;t++)this._gaugeObj["obj"+t]=n("#"+this._id+"_"+t).data("ejCircularGauge"),this._gaugeObj["obj"+t].refresh();else for(key in this._gaugeObj)this._gaugeObj[key].refresh()},getJSONData:function(n,i){t.olap.base.getJSONData({action:n.action},i,n.activeObject)},generateJSON:function(n,t){var i,r,u;return this.baseObj=n.baseObj,this.pivotEngine=t,this.kpiInfo=[],pivotRecords="",this.baseObj._measureDt&&this.baseObj._measureDt.isKpiExist?(u=this.baseObj._measureDt.axis,t&&(u=="colheader"?(i=t.length,r=i?t[0].length:0):(r=t.length,i=r?t[0].length:0)),this._getKpiHeadersCollection(i,r,u)):this._getSummaryInfo(),pivotRecords=JSON.stringify(this.kpiInfo),this._renderControlSuccess({PivotRecords:pivotRecords,OlapReport:"null"}),this.kpiInfo},_getKpiHeadersCollection:function(t,i,r){var k=this.pivotEngine,o={},v,y,p,w,h,s,l,b,a,u,f,e,c;for(r=="rowheader"?(v=t,y=i,p=i,w=t,h="rowheader",s="colheader"):r=="colheader"&&(v=i,y=t,s="rowheader",h="colheader",p=t,w=i),u=0;u<y;u++){for(f=0;f<v;f++)if(e=null,e=r=="rowheader"?this.pivotEngine[f][u]:this.pivotEngine[u][f],e.CSS==h)o=this._fillKpiInfo_kpiAxis(e,h,u,o);else break;c=0;(c=this._isKpiExist(o))?this._copyKpi(parseInt(c),o):n.isEmptyObject(o)||this.kpiInfo.push(o);o={}}for(l={},b=this.kpiInfo,this.kpiInfo=[],u=0;u<w;u++){for(f=0;f<p;f++)if(e=null,r=="rowheader"?(e=this.pivotEngine[u][f],this.pivotEngine[f][u-1]&&(a=this.pivotEngine[f][u-1])):(e=this.pivotEngine[f][u],this.pivotEngine[f-1]&&(a=this.pivotEngine[f-1][u])),e&&e.CSS==s&&e.Value!="")l=this._fillKpiInfo_kpiAxis(e,s,u,o);else break;c=0;a&&a.CSS==s&&e.CSS.indexOf("summary")==-1&&this._mergeValues(l,b,r,u,f);l={}}},_mergeValues:function(t,i,r,u,f){for(var s={},h=i.length,e={},o=0;o<h;o++)e=i[o],t.MemberRowIndex?e.MemberRowIndex=t.MemberRowIndex:t.MemberColIndex&&(e.MemberColIndex=t.MemberColIndex),e.MemberName?t.MemberName&&(e.MemberName+="-"+t.MemberName):e.MemberName=t.MemberName,r=="rowheader"?(e.ValueIndex>0&&(e.MeasureValue=this.pivotEngine[f][e.ValueIndex].ActualValue,e.ActualMeasureValue=this.pivotEngine[f][e.ValueIndex].Value),e.TrendIndex>0&&(e.TrendValue=this.pivotEngine[f][e.TrendIndex].Value),e.StatusIndex>0&&(e.StatusValue=this.pivotEngine[f][e.StatusIndex].Value),e.GoalIndex>0):r=="colheader"&&(e.ValueIndex>0&&(e.MeasureValue=this.pivotEngine[e.ValueIndex][u].ActualValue,e.ActualMeasureValue=this.pivotEngine[e.ValueIndex][u].Value),e.TrendIndex>0&&(e.TrendValue=this.pivotEngine[e.TrendIndex][u].Value),e.StatusIndex>0&&(e.StatusValue=this.pivotEngine[e.StatusIndex][u].Value),e.GoalIndex>0&&(e.GoalValue=this.pivotEngine[e.GoalIndex][u].Value,e.ActualGoalValue=this.pivotEngine[e.GoalIndex][u].ActualValue)),e.IsValidKpi=!0,s={ActualMeasureValue:0,GoalCaption:"",Kpi_Name:"",MeasureCaption:"",GoalValue:"",ActualGoalValue:0,MeasureValue:"",MemberName:"",StatusValue:-2,TrendValue:-2,TrendGraphic:null,StatusGraphic:null,ValueIndex:"",TrendIndex:-1,GoalIndex:"",StatusIndex:-1,MemberRowIndex:null,MemberColIndex:null,IsValidKpi:!0},this.kpiInfo.push(n.extend(s,e))},_isKpiExist:function(n){for(var t=0;t<this.kpiInfo.length;t++)if(this.kpiInfo[t].MemberName==n.MemberName&&this.kpiInfo[t].Kpi_Name==n.Kpi_Name)return t+"";return!1},_copyKpi:function(t,i){this.kpiInfo[t]=n.extend(this.kpiInfo[t],i)},_fillKpiInfo_kpiAxis:function(n,t,i,r){var u=n.Info.split("::")[0],f;if(!n.kpiInfo&&n.CSS==t&&u.indexOf("[Measures]")>-1&&!n.kpiInfo)r.Kpi_Name=this._getKpiName(u),r.MeasureCaption=n.Value,r.ValueIndex=i;else if(n.CSS==t){n.kpiInfo?r.Kpi_Name=n.kpiInfo.Value:(!r.MemberName&&n.Value?r.MemberName=n.Value:n.Value&&(r.MemberName+=" - "+n.Value),t=="colheader"?r.MemberColIndex=i:r.MemberRowIndex=i);f=n.kpi?n.kpi:"none";switch(f){case"status":r.StatusGraphic=n.kpiInfo.Graphic;r.StatusIndex=i;break;case"goal":r.GoalCaption=n.Value;r.GoalIndex=i;break;case"trend":r.TrendGraphic=n.kpiInfo.Graphic;r.TrendIndex=i}}return r},_getSummaryInfo:function(){for(var e,i={},r=this,f=n.map(this.pivotEngine,function(u){var o=!1,e,f;if(i.Measure="",i.Value="",i.DoubleValue=0,t.browserInfo().name=="msie"&&t.browserInfo().version<=8){for(f=0;f<u.length;f++)(u[f].CSS.indexOf("summary col")>-1||u[f].CSS.indexOf("summary cgtot calc")>-1)&&(o=!0),(o&&u[f].Info.indexOf("[Measures]")>-1||u[f].CSS.indexOf("summary cgtot calc")>-1)&&(i.Measure=u[f].Value);if(!o||r._dataModel=="Pivot"){if(o&&r._dataModel=="Pivot")return i.Value=u[f-1].Value.toString(),i.DoubleValue=u[f-1].Value,n.extend({},i)}else return i.Value=u[f-1].ActualValue,i.DoubleValue=parseFloat(u[f-1].ActualValue),n.extend({},i)}else{for(e in u)(u[parseInt(e)].CSS.indexOf("summary col")>-1||u[parseInt(e)].CSS.indexOf("summary cgtot calc")>-1)&&(o=!0),(o&&u[parseInt(e)].Info.indexOf("[Measures]")>-1||u[parseInt(e)].CSS.indexOf("summary cgtot calc")>-1)&&(i.Measure=u[parseInt(e)].Value);if(!o||r._dataModel=="Pivot"){if(o&&r._dataModel=="Pivot")return i.Value=u[parseInt(e)].Value.toString(),i.DoubleValue=u[parseInt(e)].Value,n.extend({},i)}else return i.Value=u[parseInt(e)].ActualValue,i.DoubleValue=parseFloat(u[parseInt(e)].ActualValue),n.extend({},i)}}),u=0;u<f.length;u++)e={Caption:null,Object:null,CellIndex:-1,Type:-1,Measure:"",ClassName:"",DoubleValue:0,ExpandState:0,HasChildren:!1,Level:-1,RowIndex:3,Range:null,Span:null,Tag:null,UniqueName:"",Value:""},this.kpiInfo.push(n.extend(e,f[u]))},_getKpiName:function(t){var r=this.baseObj._kpi,i="";return(i=n(r).find("row:contains('"+t+"')"),i)?n(i).find("KPI_NAME").text():""}});t.PivotGauge.Locale={};t.PivotGauge.Locale["en-US"]={RevenueGoal:"Revenue Goal",RevenueValue:"Revenue Value"};t.PivotGauge.NumberFormat={Default:"default",Currency:"currency",Percentage:"percentage",Fraction:"fraction",Scientific:"scientific",Text:"text",Notation:"notation"};t.PivotGauge.AxisName={Rows:"rows",Columns:"columns"};t.PivotGauge.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"};t.PivotGauge.AnalysisMode={Olap:"olap",Pivot:"pivot"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotPager","ej.PivotPager",{_rootCSS:"e-pivotpager",element:null,model:null,_getModel:function(){return this.model},_setModel:function(n){this.model=n},defaults:{targetControlID:"",categoricalCurrentPage:1,seriesCurrentPage:1,seriesPageCount:0,categoricalPageCount:0,locale:"en-US",mode:"both"},_init:function(){n("#"+this.model.targetControlID).hasClass("e-pivotgrid")?(this.targetControlName="PivotGrid",this.targetControl=n("#"+this.model.targetControlID).data("ejPivotGrid"),this.targetControl._pagerObj=this):n("#"+this.model.targetControlID).hasClass("e-pivotchart")?(this.targetControlName="PivotChart",this.targetControl=n("#"+this.model.targetControlID).data("ejPivotChart"),this.targetControl._pagerObj=this):n("#"+this.model.targetControlID).hasClass("e-pivotclient")&&(this.targetControlName="PivotClient",this.targetControl=n("#"+this.model.targetControlID).data("ejPivotClient"),this.targetControl._pagerObj=this);this._load();this._unwireEvents();this._wireEvents()},_destroy:function(){this.element.empty().removeClass("e-pivotpager")},_wireEvents:function(){this._on(this.element,"keydown",".pagerTextBox",this._pagerTextBoxClick);this._on(this.element,"click",".moveNext",this._moveNextPage);this._on(this.element,"click",".moveLast",this._moveLastPage);this._on(this.element,"click",".moveFirst",this._moveFirstPage);this._on(this.element,"blur",".pagerTextBox",this._restorePageNo);this._on(this.element,"click",".movePrevious",this._movePreviousPage)},_unwireEvents:function(){this._off(this.element,"click",".moveNext",this._moveNextPage);this._off(this.element,"blur",".pagerTextBox",this._restorePageNo);this._off(this.element,"click",".moveLast",this._moveLastPage);this._off(this.element,"click",".moveFirst",this._moveFirstPage);this._off(this.element,"click",".movePrevious",this._movePreviousPage);this._off(this.element,"keydown",".pagerTextBox",this._pagerTextBoxClick)},_getLocalizedLabels:function(n){return t.PivotPager.Locale[this.model.locale][n]===i?t.PivotPager.Locale["en-US"][n]:t.PivotPager.Locale[this.model.locale][n]},_load:function(){var i,r,u,f;n(this.element).addClass("pivotPager").attr("targetControlID",this.model.targetControlID);i="";this.targetControl.model.enableRTL&&this.element.addClass("e-rtl");this.model.mode!="series"&&(r=t.buildTag("td.categPagerTd",""),n(r).html(t.buildTag("div.pagerDiv",t.buildTag("span.moveFirst e-icon").attr("role","button").attr("aria-label","move first")[0].outerHTML+t.buildTag("span.movePrevious e-icon").attr("role","button").attr("aria-label","move previous")[0].outerHTML+t.buildTag("span.pagerLabel",this._getLocalizedLabels("CategoricalPage"))[0].outerHTML+t.buildTag("input#"+this._id+"_CategCurrentPage.pagerTextBox")[0].outerHTML+t.buildTag("span.categPageCount")[0].outerHTML+t.buildTag("span.moveNext e-icon").attr("role","button").attr("aria-label","move next")[0].outerHTML+t.buildTag("span.moveLast e-icon").attr("role","button").attr("aria-label","move last")[0].outerHTML)),i=r[0].outerHTML);this.model.mode!="categorical"&&(u=t.buildTag("td.seriesPagerTd",""),n(u).html(t.buildTag("div.pagerDiv",t.buildTag("span.moveFirst e-icon").attr("role","button").attr("aria-label","move first")[0].outerHTML+t.buildTag("span.movePrevious e-icon").attr("role","button").attr("aria-label","move previous")[0].outerHTML+t.buildTag("span.pagerLabel",this._getLocalizedLabels("SeriesPage"))[0].outerHTML+t.buildTag("input#"+this._id+"_SeriesCurrentPage.pagerTextBox")[0].outerHTML+t.buildTag("span.seriesPageCount")[0].outerHTML+t.buildTag("span.moveNext e-icon").attr("role","button").attr("aria-label","move next")[0].outerHTML+t.buildTag("span.moveLast e-icon").attr("role","button").attr("aria-label","move last")[0].outerHTML)),i+=u[0].outerHTML);f=t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",i)))[0];n(this.element).html(f)},initPagerProperties:function(t,i){t.Row<=i.SeriesPageSize?(n("#"+this._id+"_SeriesCurrentPage").attr("disabled",!0),n(".seriesPagerTd").fadeTo(0,.5)):(n("#"+this._id+"_SeriesCurrentPage").attr("disabled",!1),n(".seriesPagerTd").fadeTo(0,1));t.Column<=i.CategorialPageSize?(n("#"+this._id+"_CategCurrentPage").attr("disabled",!0),n(".categPagerTd").fadeTo(0,.5)):(n("#"+this._id+"_CategCurrentPage").attr("disabled",!1),n(".categPagerTd").fadeTo(0,1));this.model.categoricalPageCount=i.CategorialPageSize==0?1:Math.ceil(t.Column/i.CategorialPageSize);this.model.seriesPageCount=i.SeriesPageSize==0?1:Math.ceil(t.Row/i.SeriesPageSize);this.model.categoricalCurrentPage=i.CategorialCurrentPage;this.model.seriesCurrentPage=i.SeriesCurrentPage;this._initPagerControl()},_initPagerControl:function(){this.model.mode!="series"&&(n(this.element.find(".categPageCount")[0]).html("/ "+this.model.categoricalPageCount),n("#"+this._id+"_CategCurrentPage")[0].value=this.model.categoricalCurrentPage,this._setNavigators(this.model.categoricalCurrentPage,this.model.categoricalPageCount,this.element.find(".categPagerTd")[0]));this.model.mode!="categorical"&&(n(this.element.find(".seriesPageCount")[0]).html("/ "+this.model.seriesPageCount),n("#"+this._id+"_SeriesCurrentPage")[0].value=this.model.seriesCurrentPage,this._setNavigators(this.model.seriesCurrentPage,this.model.seriesPageCount,this.element.find(".seriesPagerTd")[0]))},_moveNextPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".movePrevious")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).removeClass("disabled");i.value=parseInt(i.value)+1;i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value,this.targetControlName=="PivotGrid"&&this.targetControl.refreshPagedPivotGrid("categorical",i.value),this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value),i.value==this.model.categoricalPageCount&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).addClass("disabled"))):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("series",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value),i.value==this.model.seriesPageCount&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).addClass("disabled")))}},_movePreviousPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".moveNext")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).removeClass("disabled");i.value=parseInt(i.value)-1;i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("categorical",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value),i.value=="1"&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).addClass("disabled"))):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"&&this.targetControl.refreshPagedPivotChart("series",i.value),this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value),i.value=="1"&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).addClass("disabled")))}},_moveLastPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".movePrevious")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).removeClass("disabled");n(t.target).addClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveNext")[0]).addClass("disabled");i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value=this.model.categoricalPageCount,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("categorical",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value)):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value=this.model.seriesPageCount,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("series",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value))}},_moveFirstPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".moveNext")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).removeClass("disabled");n(t.target).addClass("disabled");n(n(n(t.target).parents("td")[0]).find(".movePrevious")[0]).addClass("disabled");i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value=1,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("categorical",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value)):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value=1,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("series",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value))}},_pagerTextBoxClick:function(i){if(i.which==13){i.preventDefault();var r=n(i.target).parents("td")[0],u=r.className.indexOf("categ")!=-1?this.model.categoricalPageCount:this.model.seriesPageCount;parseInt(i.target.value)>u||parseInt(i.target.value)<1||i.target.value==""?(this._restorePageNo(i),t.Pivot._createErrorDialog(this._getLocalizedLabels("PageCountErrorMsg"),"Error",this)):(r.className.indexOf("categ")!=-1&&this.model.categoricalCurrentPage!=parseInt(i.target.value)?(this.model.categoricalCurrentPage=i.target.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid(r.className,i.target.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart(r.className,i.target.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient(r.className,i.target.value)):r.className.indexOf("series")!=-1&&this.model.seriesCurrentPage!=parseInt(i.target.value)&&(this.model.seriesCurrentPage=i.target.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid(r.className,i.target.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart(r.className,i.target.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient(r.className,i.target.value)),this._setNavigators(i.target.value,u,r),i.target.blur())}else{if(n.inArray(i.keyCode,[46,8,9,27,13,190])!==-1||i.keyCode==65&&i.ctrlKey===!0||i.keyCode>=35&&i.keyCode<=39)return;(i.shiftKey||i.keyCode<48||i.keyCode>57)&&(i.keyCode<96||i.keyCode>105)&&i.preventDefault()}},_restorePageNo:function(n){n.target.value=n.target.id.indexOf("Categ")!=-1?this.model.categoricalCurrentPage:this.model.seriesCurrentPage},_setNavigators:function(t,i,r){t==i&&(n(n(r).find(".moveNext")[0]).addClass("disabled"),n(n(r).find(".moveLast")[0]).addClass("disabled"));t=="1"&&(n(n(r).find(".movePrevious")[0]).addClass("disabled"),n(n(r).find(".moveFirst")[0]).addClass("disabled"));t>1&&(n(n(r).find(".movePrevious")[0]).removeClass("disabled"),n(n(r).find(".moveFirst")[0]).removeClass("disabled"));t<i&&(n(n(r).find(".moveNext")[0]).removeClass("disabled"),n(n(r).find(".moveLast")[0]).removeClass("disabled"))}});t.PivotPager.Locale={};t.PivotPager.Locale["en-US"]={SeriesPage:"Series Page",CategoricalPage:"Categorical Page",Error:"Error",OK:"OK",Close:"Close",PageCountErrorMsg:"Enter valid page number"};t.PivotPager.Mode={Both:"both",Categorical:"categorical",Series:"series"}}(jQuery,Syncfusion); +var LookupCachingMode,CalcQuickBase,FormulaInfoSetAction,FormulaInfoHashtable,HashTable,ejDateRangePicker,ejTooltip,Print,clipboardCleaner,documentManager,Heatmap,HeatmapLegend,RecurrenceEditor,InternalAdaptive,InternalScroller,InternalSelection,InternalFilter,InternalDragAndDrop,InternalEdit,InternalContext,InternalSwimlane,InternalCommon,Kanban,ejSignature,SpellCheck,_sideBySeriesPadding,ejSparkline,__extends,ejSunburstChart;window.ej=window.Syncfusion=window.Syncfusion||{},function(n,t,i){"use strict";var o,u,f,e;t.version="13.3.0.8";t.consts={NamespaceJoin:"-"};t.TextAlign={Center:"center",Justify:"justify",Left:"left",Right:"right"};t.Orientation={Horizontal:"horizontal",Vertical:"vertical"};t.serverTimezoneOffset=0;t.persistStateVersion=null;Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(n,t){return n[t]!==i});Date.prototype.toISOString||function(){function n(n){var t=String(n);return t.length===1&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+n(this.getUTCMonth()+1)+"-"+n(this.getUTCDate())+"T"+n(this.getUTCHours())+":"+n(this.getUTCMinutes())+":"+n(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();String.format=function(){for(var t=arguments[0],n=0;n<arguments.length-1;n++)t=t.replace(new RegExp("\\{"+n+"\\}","gm"),arguments[n+1]);return t.replace(/\{[0-9]\}/g,"")};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}};t.defineClass=function(n,r,u,f){if(!n||!u)return i;for(var o=n.split("."),s=window,e=0;e<o.length-1;e++)t.isNullOrUndefined(s[o[e]])&&(s[o[e]]={}),s=s[o[e]];return(f||t.isNullOrUndefined(s[o[e]]))&&(r=typeof r=="function"?r:function(){},s[o[e]]=r,s[o[e]].prototype=u),s[o[e]]};t.util={getNameSpace:function(n){var i=n.toLowerCase().split(".");return i[0]==="ej"&&(i[0]="e"),i.join(t.consts.NamespaceJoin)},getObject:function(n,r){var u,e,f;if(!r)return i;for(u=r,e=n.split("."),f=0;f<e.length;f++){if(t.util.isNullOrUndefined(u))break;u=u[e[f]]}return u},createObject:function(n,r,u){for(var s=n.split("."),h=u||window,f=h,o,c=s.length,e=0;e<c;e++)o=s[e],e+1==c?f[o]=r===i?{}:r:t.isNullOrUndefined(f[o])&&(f[o]={}),f=f[o];return h},isNullOrUndefined:function(n){return n===i||n===null},print:function(i,r){var f=t.buildTag("div"),o=i.clone(),r,e,u;f.append(o);r||(r=window.open("","print","height=452,width=1024,tabbar=no"));r.document.write("<!DOCTYPE html>");e=n("head").find("link").add("style");t.browserInfo().name==="msie"?(u="",e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.write("<html><head><\/head><body>"+u+f[0].innerHTML+"<\/body><\/html>")):(u="",r.document.write("<html><head>"),e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.writeln(u+"<\/head><body>"),r.document.writeln(f[0].innerHTML+"<\/body><\/html>"));r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},1e3))},1e3)},ieClearRemover:function(t){var i=n(t).height();t.style.paddingTop=parseFloat(i/2)+"px";t.style.paddingBottom=parseFloat(i/2)+"px";t.style.height="1px";t.style.lineHeight="1px"},sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.successHandler,error:t.errorHandler,beforeSend:t.beforeSendHandler,complete:t.completeHandler})},buildTag:function(t,r,u,f){var s=/^[a-z]*[0-9a-z]+/ig.exec(t)[0],e=/#([_a-z]+[-_0-9a-z]+)/ig.exec(t),o;return e=e?e[e.length-1]:i,o=/\.([a-z]+[-_0-9a-z ]+)/ig.exec(t),o=o?o[o.length-1]:i,n(document.createElement(s)).attr(e?{id:e}:{}).addClass(o||"").css(u||{}).attr(f||{}).html(r||"")},_preventDefaultException:function(n,t){if(n)for(var i in t)if(t[i].test(n[i]))return!0;return!1},getMaxZindex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute"||n(t).css("position")=="fixed")return parseInt(n(t).css("z-index"))||1})),(t==i||t==null)&&(t=1),t},blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},getDimension:function(t,i){var e,u=n(t).parents().andSelf().filter(":hidden"),r,f;return u&&(r={visibility:"hidden",display:"block"},f=[],u.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];f.push(t)}),e=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),u.each(function(n){var i=f[n];for(var t in r)this.style[t]=i[t]})),e},transitionEndEvent:function(){return{"":"transitionend",webkit:"webkitTransitionEnd",Moz:"transitionend",O:"otransitionend",ms:"MSTransitionEnd"}[t.userAgent()]},animationEndEvent:function(){return{"":"animationend",webkit:"webkitAnimationEnd",Moz:"animationend",O:"webkitAnimationEnd",ms:"animationend"}[t.userAgent()]},startEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchstart":"mousedown"},endEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchend":"mouseup"},moveEvent:function(){return t.isTouchDevice()||n.support.hasPointer?n.support.hasPointer&&!t.isMobile()?"ejtouchmove":"touchmove":"mousemove"},cancelEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchcancel":"mousecancel"},tapEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"tap":"click"},tapHoldEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"taphold":"click"},isDevice:function(){return t.getBooleanVal(n("head"),"data-ej-forceset",!1)?t.getBooleanVal(n("head"),"data-ej-device",this._device()):this._device()},isPortrait:function(){var n=document.documentElement;return n&&n.clientWidth/n.clientHeight<1.1},isLowerResolution:function(){return window.innerWidth<=640&&t.isPortrait()&&t.isDevice()||window.innerWidth<=800&&!t.isDevice()||window.innerWidth<=800&&!t.isPortrait()&&t.isWindows()&&t.isDevice()||t.isMobile()},isIOSWebView:function(){return/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)},isAndroidWebView:function(){return!(typeof Android=="undefined")},isWindowsWebView:function(){return location.href.indexOf("x-wmapp")!=-1},_device:function(){return/Android|BlackBerry|iPhone|iPad|iPod|IEMobile|kindle|windows\sce|palm|smartphone|iemobile|mobile|pad|xoom|sch-i800|playbook/i.test(navigator.userAgent.toLowerCase())},isMobile:function(){return/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(navigator.userAgent.toLowerCase())&&/mobile/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-mobile",!1)===!0},isTablet:function(){return/ipad|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-tablet",!1)===!0||!t.isMobile()&&t.isDevice()},isTouchDevice:function(){return("ontouchstart"in window||window.navigator.msPointerEnabled&&t.isMobile())&&this.isDevice()},getClearString:function(t){return n.trim(t.replace(/\s+/g," ").replace(/(\r\n|\n|\r)/gm,"").replace(new RegExp(">[\n\t ]+<","g"),"><"))},getBooleanVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u.toLowerCase()=="true":r},_getSkewClass:function(n,t,i){var h=n.width(),c=n.height(),f=n.offset().left,e=n.offset().left+h,o=n.offset().top,s=n.offset().top+c,r=h*.3,u=c*.3;return t<f+r&&i<o+u?"e-m-skew-topleft":t>e-r&&i<o+u?"e-m-skew-topright":t>e-r&&i>s-u?"e-m-skew-bottomright":t<f+r&&i>s-u?"e-m-skew-bottomleft":t>f+r&&i<o+u&&t<e-r?"e-m-skew-top":t<f+r?"e-m-skew-left":t>e-r?"e-m-skew-right":i>s-u?"e-m-skew-bottom":"e-m-skew-center"},_removeSkewClass:function(t){n(t).removeClass("e-m-skew-top e-m-skew-bottom e-m-skew-left e-m-skew-right e-m-skew-topleft e-m-skew-topright e-m-skew-bottomleft e-m-skew-bottomright e-m-skew-center e-skew-top e-skew-bottom e-skew-left e-skew-right e-skew-topleft e-skew-topright e-skew-bottomleft e-skew-bottomright e-skew-center")},_getObjectKeys:function(n){var t,i=[];if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},!Object.keys){for(t in n)n.hasOwnProperty(t)&&i.push(t);return i}if(Object.keys)return Object.keys(n)},_touchStartPoints:function(n,t){if(n){var i=n.touches?n.touches[0]:n;t._distX=0;t._distY=0;t._moved=!1;t._pointX=i.pageX;t._pointY=i.pageY}},_isTouchMoved:function(n,t){if(n){var i=n.touches?n.touches[0]:n,f=i.pageX-t._pointX,e=i.pageY-t._pointY,o=Date.now(),r,u;return t._pointX=i.pageX,t._pointY=i.pageY,t._distX+=f,t._distY+=e,r=Math.abs(t._distX),u=Math.abs(t._distY),!(r<5&&u<5)}},listenEvents:function(n,i,r,u,f,e){for(var o=0;o<n.length;o++)t.listenTouchEvent(n[o],i[o],r[o],u,f,e)},listenTouchEvent:function(i,r,u,f,e,o){for(var s,h=f?"removeEventListener":"addEventListener",a=f?"off":"on",l=n(i),c=0;c<l.length;c++){s=l[c];switch(r){case"touchstart":t._bindEvent(s,h,r,u,"mousedown","MSPointerDown","pointerdown",o);break;case"touchmove":t._bindEvent(s,h,r,u,"mousemove","MSPointerMove","pointermove",o);break;case"touchend":t._bindEvent(s,h,r,u,"mouseup","MSPointerUp","pointerup",o);break;case"touchcancel":t._bindEvent(s,h,r,u,"mousecancel","MSPointerCancel","pointercancel",o);break;case"tap":case"taphold":case"ejtouchmove":case"click":n(s)[a](r,u);break;default:t.browserInfo().name=="msie"&&t.browserInfo().version<9?e._on(n(s),r,u):s[h](r,u,!0)}}},_bindEvent:function(t,i,r,u,f,e,o){n.support.hasPointer?t[i](window.navigator.pointerEnabled?o:e,u,!0):t[i](r,u,!0)},_browser:function(){return/webkit/i.test(navigator.appVersion)?"webkit":/firefox/i.test(navigator.userAgent)?"Moz":/trident/i.test(navigator.userAgent)?"ms":"opera"in window?"O":""},styles:document.createElement("div").style,userAgent:function(){for(var i="webkitT,t,MozT,msT,OT".split(","),r,n=0,u=i.length;n<u;n++)if(r=i[n]+"ransform",r in t.styles)return i[n].substr(0,i[n].length-1);return!1},addPrefix:function(n){return t.userAgent()===""?n:(n=n.charAt(0).toUpperCase()+n.substr(1),t.userAgent()+n)},destroyWidgets:function(t){var i=n(t).find("[data-role *= ejm]");i.each(function(t,i){var r=n(i),u=r.data("ejWidgets");u&&r[u]("destroy")})},getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},getOffset:function(t){var i={},u=t.offset()||{left:0,top:0},r;return n.extend(!0,i,u),n("body").css("position")!="static"&&(r=n("body").offset(),i.left-=r.left,i.top-=r.top),i},getZindexPartial:function(i,r){var e,f,u;if(!t.isNullOrUndefined(i)&&i.length>0)return e=i.parents(),f=n("body").children(),!t.isNullOrUndefined(i)&&i.length>0&&f.splice(f.index(r),1),n(f).each(function(n,t){e.push(t)}),u=Math.max.apply(u,n.map(e,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!u||u<1e4?u=1e4:u+=1,u},isValidAttr:function(t,i){var t=n(t)[0],r;return typeof t[i]!="undefined"?!0:(r=!1,n.each(t,function(n){if(n.toLowerCase()==i.toLowerCase())return r=!0,!1}),r)}};n.extend(t,t.util);t.widgetBase={droppables:{"default":[]},resizables:{"default":[]},_renderEjTemplate:function(i,r,u,f){var e=null;return((typeof i=="object"||i.startsWith("#")||i.startsWith("."))&&(e=n(i).attr("type")),e&&(e=e.toLowerCase(),t.template[e]))?t.template[e](this,i,r,u,f):t.template.render(this,i,r,u,f)},destroy:function(){var u,r,f,i;if(!this._trigger("destroy")){this.model.enablePersistence&&(this.persistState(),n(window).off("unload",this._persistHandler));try{this._destroy()}catch(e){}for(u=this.element.data("ejWidgets")||[],i=0;i<u.length;i++)u[i]==this.pluginName&&u.splice(i,1);for(u.length||this.element.removeData("ejWidgets");this._events;){if(r=this._events.pop(),f=[],!r)break;for(i=0;i<r[1].length;i++)n.isPlainObject(r[1][i])||f.push(r[1][i]);n.fn.off.apply(r[0],f)}this._events=null;this.element.removeClass(t.util.getNameSpace(this.sfType)).removeClass("e-js").removeData(this.pluginName);this.element=null;this.model=null}},_on:function(i){this._events||(this._events=[]);for(var r=[].splice.call(arguments,1,arguments.length-1),u={},f=r.length;u&&typeof u!="function";)u=r[--f];return r[f]=t.proxy(r[f],this),this._events.push([i,r,u,r[f]]),n.fn.on.apply(i,r),this},_off:function(t,i,r,u){var e=this._events,s,h,o,f,c;if(!e||!e.length)return this;for(typeof r=="function"&&(s=u,u=r,r=s),h=i.match(/\S+/g)||[""],o=0;o<e.length;o++)if(f=e[o],c=f[0].length&&(!u||f[2]===u)&&(f[1][0]===i||h[0])&&(!r||f[1][1]===r)&&n.inArray(t[0],f[0])>-1,c){n.fn.off.apply(t,u?[i,r,f[3]]:[i,r]);e.splice(o,1);break}return this},_trigger:function(i,r){var f=null,e,u,s={},o,h;return(n.extend(s,r),i in this.model&&(f=this.model[i]),f&&(typeof f=="string"&&(f=t.util.getObject(f,window)),n.isFunction(f)&&(u=t.event(i,this.model,r),o=this.model._applyScope,e=f.call(this,u),o&&o.call(),r&&n.extend(r,u),u.cancel||!t.isNullOrUndefined(e))))?e===!1||u.cancel:(h=Boolean(r),r=r||{},r.originalEventType=i,r.type=this.pluginName+i,u=n.Event(r.type,t.event(r.type,this.model,r)),this.element&&this.element.trigger(u),h&&n.extend(r,u),t.isOnWebForms&&u.cancel==!1&&this.model.serverEvents&&this.model.serverEvents.length&&t.raiseWebFormsServerEvents(i,r,s),u.cancel)},setModel:function(t,i){var r,f,e,u;if(!this._trigger("modelChange",{changes:t})){for(r in t){if(!i){if(this.model[r]===t[r]){delete t[r];continue}if(n.isPlainObject(t[r])&&(o(this.model[r],t[r]),n.isEmptyObject(t[r]))){delete t[r];continue}}if(this.dataTypes&&(f=this._isValidModelValue(r,this.dataTypes,t),f!==!0))throw"setModel - Invalid input for property :"+r+" - "+f;this.model.notifyOnEachPropertyChanges&&this.model[r]!==t[r]&&(e={oldValue:this.model[r],newValue:t[r]},t[r]=this._trigger(r+"Change",e)?this.model[r]:e.newValue)}n.isEmptyObject(t)||(this._setFirst?(u=t.dataSource,u&&delete t.dataSource,n.extend(!0,this.model,t),u&&(this.model.dataSource=u instanceof Array?u.slice():u,t.dataSource=this.model.dataSource),this._setModel&&this._setModel(t)):this._setModel&&this._setModel(t)===!1||n.extend(!0,this.model,t),"enablePersistence"in t&&this._setState(t.enablePersistence))}},option:function(r,u,f){if(!r)return this.model;if(n.isPlainObject(r))return this.setModel(r,f);if(typeof r=="string"){r=r.replace(/^model\./,"");var e=t.getObject(r,this.model);if(u===i&&!f)return e;if(r==="enablePersistence")return this._setState(u);if(f&&u===t.extensions.modelGUID)return this._setModel(t.createObject(r,t.getObject(r,this.model),{}));if(f||t.getObject(r,this.model)!==u)return this.setModel(t.createObject(r,u,{}),f)}return i},_isValidModelValue:function(n,t,i){var r=t[n],u=i[n],f,e,o;if(!r)return!0;if(typeof r=="string"){if(r=="enum"&&(i[n]=u?u.toString().toLowerCase():u,r="string"),r==="array"){if(Object.prototype.toString.call(u)==="[object Array]")return!0}else if(r==="data"||r==="parent"||typeof u===r)return!0;return"Expected type - "+r}if(u instanceof Array){for(e=0;e<u.length;e++)if(f=this._isValidModelValue(n,t,u[e]),f!==!0)return" ["+e+"] - "+f;return!0}for(o in u)if(f=this._isValidModelValue(o,r,u),f!==!0)return o+" : "+f;return!0},_returnFn:function(n,t){t.indexOf(".")!=-1?this._returnFn(n[t.split(".")[0]],t.split(".").slice(1).join(".")):n[t]=n[t].call(n.propName)},_removeCircularRef:function(n){function i(n,r,u){if(typeof n=="object"){if(Array.prototype.indexOf||(Array.prototype.indexOf=function(n){return jQuery.inArray(n,this)}),t.indexOf(n)>=0){delete u[r];return}t.push(n);for(var f in n)n.hasOwnProperty(f)&&i(n[f],f,n);t.pop();return}}var t=[];return i(n,"obj",null),n},stringify:function(n,i){for(var f,u=this.observables,r=0;r<u.length;r++)f=t.getObject(u[r],n),t.isNullOrUndefined(f)||typeof f!="function"||this._returnFn(n,u[r]);return i&&(n=this._removeCircularRef(n)),JSON.stringify(n)},_setState:function(i){if(i===!0){this._persistHandler=t.proxy(this.persistState,this);n(window).on("unload",this._persistHandler)}else this.deleteState(),n(window).off("unload",this._persistHandler)},_removeProp:function(n,i){t.isNullOrUndefined(n)||(i.indexOf(".")!=-1?this._removeProp(n[i.split(".")[0]],i.split(".").slice(1).join(".")):delete n[i])},persistState:function(){var n,i;if(this._ignoreOnPersist){for(n=r({},this.model),i=0;i<this._ignoreOnPersist.length;i++)this._removeProp(n,this._ignoreOnPersist[i]);n.ignoreOnPersist=this._ignoreOnPersist}else if(this._addToPersist){for(n={},i=0;i<this._addToPersist.length;i++)t.createObject(this._addToPersist[i],t.getObject(this._addToPersist[i],this.model),n);n.addToPersist=this._addToPersist}else n=r({},this.model);this._persistState&&(n.customPersists={},this._persistState(n.customPersists));window.localStorage?(t.isNullOrUndefined(t.persistStateVersion)||window.localStorage.getItem("persistKey")!=null||window.localStorage.setItem("persistKey",t.persistStateVersion),window.localStorage.setItem("$ej$"+this.pluginName+this._id,JSON.stringify(n))):document.cookie&&(t.isNullOrUndefined(t.persistStateVersion)||t.cookie.get("persistKey")!=null||t.cookie.set("persistKey",t.persistStateVersion),t.cookie.set("$ej$"+this.pluginName+this._id,n))},deleteState:function(){window.localStorage?window.localStorage.removeItem("$ej$"+this.pluginName+this._id):document.cookie&&t.cookie.set("$ej$"+this.pluginName+this._id,model,new Date)},restoreState:function(i){var f=null,r,u;if(window.localStorage?f=window.localStorage.getItem("$ej$"+this.pluginName+this._id):document.cookie&&(f=t.cookie.get("$ej$"+this.pluginName+this._id)),f&&(r=JSON.parse(f),this._restoreState&&(this._restoreState(r.customPersists),delete r.customPersists),t.isNullOrUndefined(r)===!1&&(t.isNullOrUndefined(r.ignoreOnPersist)?t.isNullOrUndefined(r.addToPersist)||(this._addToPersist=r.addToPersist,delete r.addToPersist):(this._ignoreOnPersist=r.ignoreOnPersist,delete r.ignoreOnPersist))),t.isNullOrUndefined(r)||t.isNullOrUndefined(this._ignoreOnPersist))this.model=n.extend(!0,this.model,r);else{for(u in this._ignoreOnPersist)this._ignoreOnPersist[u].indexOf(".")!==-1?t.createObject(this._ignoreOnPersist[u],t.getObject(this._ignoreOnPersist[u],this.model),r):r[this._ignoreOnPersist[u]]=this.model[this._ignoreOnPersist[u]];this.model=r}!i&&f&&this._setModel&&this._setModel(this.model)},ignoreOnPersist:function(n){var r=[],t,u;if(typeof n=="object"?r=n:typeof n=="string"&&r.push(n),this._addToPersist===i)for(this._ignoreOnPersist=this._ignoreOnPersist||[],t=0;t<r.length;t++)this._ignoreOnPersist.push(r[t]);else for(t=0;t<r.length;t++)u=this._addToPersist.indexOf(r[t]),this._addToPersist.splice(u,1)},addToPersist:function(t){var u=[],f,r;if(typeof t=="object"?u=t:typeof t=="string"&&u.push(t),this._addToPersist===i)for(this._ignoreOnPersist=this._ignoreOnPersist||[],r=0;r<u.length;r++)f=this._ignoreOnPersist.indexOf(u[r]),this._ignoreOnPersist.splice(f,1);else for(r=0;r<u.length;r++)n.inArray(u[r],this._addToPersist)===-1&&this._addToPersist.push(u[r])},formatting:function(i,r,u){var f,l,h,c,a,v,s,e,y;if(i=i.replace(/%280/g,'"').replace(/</g,"<").replace(/>/g,">"),u=t.preferredCulture(u)?u:"en-US",f=i,l=i.split("{0:"),a=i.split("}"),h=l[0],c=a[1],typeof r=="string"&&n.isNumeric(r)&&(r=Number(r)),i.indexOf("{0:")!=-1)return v=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),s=v.exec(i),s!=null&&r!=null?h!=null&&c!=null?h+t.format(r,s[2],u)+c:t.format(r,s[2],u):r!=null?r:"";if(f.startsWith("{")&&!f.startsWith("{0:")){var o=f.split(""),r=(r||"")+"",p=r.split(""),w=/[0aA\*CN<>\?]/gm;for(e=0,y=0;e<o.length;e++)o[e]=w.test(o[e])?"{"+y+++"}":o[e];return String.format.apply(String,[o.join("")].concat(p)).replace("{","").replace("}","")}return this.data!=null&&this.data.Value==null?(n.each(this.data,function(n,t){f=f.replace(new RegExp("\\{"+n+"\\}","gm"),t)}),f):this.data.Value}};t.WidgetBase=function(){};o=function(t,i){for(var r in t)t[r]===i[r]&&delete i[r],n.isPlainObject(i[r])&&n.isPlainObject(t[r])&&o(t[r],i[r])};t.widget=function(f,o,h){var a,l,v;if(typeof f=="object"){h=o;for(a in f)l=f[a],l instanceof Array&&(h._rootCSS=l[1],l=l[0]),t.widget(a,l,h),f[a]instanceof Array&&(h._rootCSS="");return}v=h._rootCSS||t.getNameSpace(o);h=t.defineClass(o,function(i,e){var y,p,w,b,c,g,k,d,nt,l,a;if(this.sfType=o,this.pluginName=f,this.instance=s,t.isNullOrUndefined(this._setFirst)&&(this._setFirst=!0),this["ob.values"]={},n.extend(this,t.widgetBase),this.dataTypes)for(y in e)if(p=this._isValidModelValue(y,this.dataTypes,e),p!==!0)throw"setModel - Invalid input for property :"+y+" - "+p;for(w=i.data("ejWidgets")||[],w.push(f),i.data("ejWidgets",w),c=0;t.widget.observables&&this.observables&&c<this.observables.length;c++)b=t.getObject(this.observables[c],e),b&&t.createObject(this.observables[c],t.widget.observables.register(b,this.observables[c],this,i),e);if(this.element=i.jquery?i:n(i),this.model=r(!0,{},h.prototype.defaults,e),this.model.keyConfigs=r(this.keyConfigs),this.element.addClass(v+" e-js").data(f,this),this._id=i[0].id,this.element.attr("tabIndex")||this.element.attr("tabIndex",""),this.model.enablePersistence){if(window.localStorage&&!t.isNullOrUndefined(t.persistStateVersion)&&window.localStorage.getItem("persistKey")!=t.persistStateVersion)for(c in window.localStorage)c.indexOf("$ej$")!=-1&&window.localStorage.removeItem(c);else if(document.cookie&&!t.isNullOrUndefined(t.persistStateVersion)&&t.cookie.get("persistKey")!=t.persistStateVersion){g=document.cookie.split(/; */);for(k in g)k.indexOf("$ej$")!=-1&&t.cookie.set(k.split("=")[0],model,new Date)}this._persistHandler=t.proxy(this.persistState,this);n(window).on("unload",this._persistHandler);this.restoreState(!0)}if(this._init(e),typeof this.model.keyConfigs=="object"&&!(this.model.keyConfigs instanceof Array)){d=!1;this.model.keyConfigs.focus&&this.element.attr("accesskey",this.model.keyConfigs.focus);for(nt in this.model.keyConfigs)if(nt!=="focus"){d=!0;break}d&&this._keyPressed&&(l=i,a="keydown",this.keySettings&&(l=this.keySettings.getElement?this.keySettings.getElement()||l:l,a=this.keySettings.event||a),this._on(l,a,function(n){if(this.model.keyConfigs){var t=u.getActionFromCode(this.model.keyConfigs,n.which,n.ctrlKey,n.shiftKey,n.altKey),i={code:n.which,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey};t&&this._keyPressed(t,n.target,i,n)===!1&&n.preventDefault()}}))}this._trigger("create")},h);n.fn[f]=function(r){for(var w,p=r,u,y=0;y<this.length;y++){var s=n(this[y]),l=s.data(f),b=l&&s.hasClass(v),a=null;if(this.length>0&&n.isPlainObject(p)&&(r=t.copyObject({},p)),!b){h.prototype._requiresID!==!0||n(this[y]).attr("id")||s.attr("id",c("ejControl_"));r&&typeof r!="object"?e(f+": methods/properties can be accessed only after plugin creation"):(h.prototype.defaults&&!t.isNullOrUndefined(t.setCulture)&&"locale"in h.prototype.defaults&&f!="ejChart"&&(!r||"locale"in r?t.isNullOrUndefined(r)&&(r={},r.locale=t.setCulture().name):r.locale=t.setCulture().name),new h(s,r));continue}if(r)if(u=[].slice.call(arguments,1),this.length>0&&u[0]&&p==="option"&&n.isPlainObject(u[0])&&(u[0]=t.copyObject({},u[0])),n.isPlainObject(r))l.setModel(r);else if((r.indexOf("_")===0||t.isNullOrUndefined(a=t.getObject(r,l)))&&r.indexOf("model.")!==0)e(o+": function/property - "+r+" does not exist");else{if(!a||!n.isFunction(a)){if(arguments.length==1)return a;l.option(r,arguments[1]);continue}if(w=a.apply(l,u),w!==i)return w}}return f.indexOf("ejm")!=-1&&t.widget.registerInstance(s,f,o,h.prototype),this};t.widget.register(f,o,h.prototype)};n.extend(t.widget,function(){var n={},i=[],r=function(i,r,u){t.isNullOrUndefined(n[i])||e("ej.widget : The widget named "+i+" is trying to register twice.");n[i]={name:i,className:r,proto:u};t.widget.extensions&&t.widget.extensions.registerWidget(i)},u=function(n,t,r,u){i.push({element:n,pluginName:t,className:r,proto:u})};return{register:r,registerInstance:u,registeredWidgets:n,registeredInstances:i}}());t.widget.destroyAll=function(n){var u,r,t,i;if(n&&n.length)for(u=0;u<n.length;u++)if(r=n.eq(u).data(),t=r.ejWidgets,t&&t.length)for(i=0;i<t.length;i++)r[t[i]]&&r[t[i]].destroy&&r[t[i]].destroy()};t.cookie={get:function(n){var t=RegExp(n+"=([^;]+)").exec(document.cookie);return t&&t.length>1?t[1]:i},set:function(n,t,i){typeof t=="object"&&(t=JSON.stringify(t));t=escape(t)+(i==null?"":"; expires="+i.toUTCString());document.cookie=n+"="+t}};u={getActionFromCode:function(n,t,i,r,f){var s,o,e;i=i||!1;r=r||!1;f=f||!1;for(s in n)if(s!=="focus")for(o=u.getKeyObject(n[s]),e=0;e<o.length;e++)if(t===o[e].code&&i==o[e].isCtrl&&r==o[e].isShift&&f==o[e].isAlt)return s;return null},getKeyObject:function(t){for(var f,o,e,s={isCtrl:!1,isShift:!1,isAlt:!1},c=n.extend(!0,{},s),r=t.split(","),h=[],i=0;i<r.length;i++){if(f=null,r[i].indexOf("+")!=-1)for(o=r[i].split("+"),e=0;e<o.length;e++)f=u.getResult(n.trim(o[e]),s);else f=u.getResult(n.trim(r[i]),n.extend(!0,{},c));h.push(f)}return h},getResult:function(n,t){return n==="ctrl"?t.isCtrl=!0:n==="shift"?t.isShift=!0:n==="alt"?t.isAlt=!0:t.code=parseInt(n,10),t}};t.getScrollableParents=function(t){return n(t).parentsUntil("html").filter(function(){return n(this).css("overflow")!="visible"}).add(n(window))};t.browserInfo=function(){var i={},r=[],e={opera:/(opera|opr)(?:.*version|)[ \/]([\w.]+)/i,edge:/(edge)(?:.*version|)[ \/]([\w.]+)/i,webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie|trident) ([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i},o,s,f,u;for(o in e)if(e.hasOwnProperty(o)&&(r=navigator.userAgent.match(e[o]),r)){if(i.name=r[1].toLowerCase()=="opr"?"opera":r[1].toLowerCase(),i.version=r[2],i.culture={},i.culture.name=i.culture.language=navigator.language||navigator.userLanguage,typeof t.globalize!="undefined"){for(s=t.preferredCulture().name,f=navigator.language||navigator.userLanguage?t.preferredCulture(navigator.language||navigator.userLanguage):t.preferredCulture("en-US"),u=0;navigator.languages&&u<navigator.languages.length;u++)if(f=t.preferredCulture(navigator.languages[u]),f.language==navigator.languages[u])break;t.preferredCulture(s);n.extend(!0,i.culture,f)}!navigator.userAgent.match(/Trident\/7\./)||(i.name="msie");break}return i.isMSPointerEnabled=i.name=="msie"&&i.version>9&&window.navigator.msPointerEnabled,i.pointerEnabled=window.navigator.pointerEnabled,i};t.eventType={mouseDown:"mousedown touchstart",mouseMove:"mousemove touchmove",mouseUp:"mouseup touchend",mouseLeave:"mouseleave touchcancel",click:"click touchend"};t.event=function(t,i,r){return n.extend(r||{},{type:t,model:i,cancel:!1})};t.proxy=function(n,t,i){return!n||typeof n!="function"?null:"on"in n&&t?i?n.on(t,i):n.on(t):function(){var r=i?[i]:[];return r.push.apply(r,arguments),n.apply(t||this,r)}};t.hasStyle=function(n){var r=document.documentElement.style,i,t;if(n in r)return!0;for(i=["ms","Moz","Webkit","O","Khtml"],n=n[0].toUpperCase()+n.slice(1),t=0;t<i.length;t++)if(i[t]+n in r)return!0;return!1};Array.prototype.indexOf=Array.prototype.indexOf||function(n){var i=this.length,t;if(i===0)return-1;for(t=0;t<i;t++)if(t in this&&this[t]===n)return t;return-1};String.prototype.startsWith=String.prototype.startsWith||function(n){return this.slice(0,n.length)===n};var r=t.copyObject=function(n,u){var h=2,c,f,s,o,e,l;for(typeof n!="boolean"&&(h=1),s=[].slice.call(arguments,h),h===1&&(u=n,n=i),o=0;o<s.length;o++)for(e in s[o])if(c=u[e],f=s[o][e],f!==i&&c!==f&&s[o]!==f&&u!==f)if(f instanceof Array)if(o===0&&n)for(u[e]=[],l=0;l<f.length;l++)r(!0,u[e],f);else u[e]=f.slice();else t.isPlainObject(f)?(u[e]=c||{},n?r(n,u[e],f):r(u[e],f)):u[e]=f;return u},s=function(){return this},h=0,c=function(n){return n+h++};t.template={};t.template.render=t.template["text/x-jsrender"]=function(t,i,r,u,f){i.slice(0,1)!=="#"&&(i=["<div>",i,"<\/div>"].join(""));var e={prop:f,index:u};return n(i).render(r,e)};t.isPlainObject=function(n){if(!n||t.DataManager!==i&&n instanceof t.DataManager||typeof n!="object"||n.nodeType||jQuery.isWindow(n))return!1;try{if(n.constructor&&!n.constructor.prototype.hasOwnProperty("isPrototypeOf"))return!1}catch(f){return!1}var r,u=t.support.isOwnLast;for(r in n)if(u)break;return r===i||n.hasOwnProperty(r)};f=!1;t.util.valueFunction=function(n){return function(r,u){var e=t.getObject(n,this.model);if(f===!1&&(f=t.getObject("observables.getValue",t.widget)),r===i)return t.isNullOrUndefined(f)?typeof e=="function"?e.call(this):e:f(e,u);typeof e=="function"?(this["ob.values"][n]=r,e.call(this,r)):t.createObject(n,r,this.model)}};t.util.getVal=function(n){return typeof n=="function"?n():n};t.support={isOwnLast:function(){var n=function(){this.a=1},t;n.prototype.b=1;for(t in new n)return t==="b"}(),outerHTML:function(){return document.createElement("div").outerHTML!==i}()};e=t.throwError=function(n){try{throw new Error(n);}catch(t){throw t.message+"\n"+t.stack;}};t.getRandomValue=function(n,r){var u,f;return n===i||r===i?t.throwError("Min and Max values are required for generating a random number"):("crypto"in window&&"getRandomValues"in crypto?(f=new Uint16Array(1),window.crypto.getRandomValues(f),u=f[0]%(r-n)+n):u=Math.random()*(r-n)+n,u|0)};t.extensions={};t.extensions.modelGUID="{0B1051BA-1CCB-42C2-A3B5-635389B92A50}"}(window.jQuery,window.Syncfusion),function(){$.fn.addEleAttrs=function(n){var t=$(this);$.each(n,function(n,i){i&&i.specified&&t.attr(i.name,i.value)})};$.fn.removeEleAttrs=function(n){return this.each(function(){var t=$(this),i=$(this.attributes).clone();$.each(i,function(i,r){r&&r.specified&&n.test(r.name)&&t.removeAttr(r.name)})})};$.fn.attrNotStartsWith=function(n){var u=this,r=[],t;for(this.each(function(){t=$(this.attributes).clone()}),i=0;i<t.length;i++)if(t[i]&&t[i].specified&&n.test(t[i].name))continue;else r.push(t[i]);return r};$.fn.removeEleEmptyAttrs=function(){return this.each(function(){var n=$(this),t=$(this.attributes).clone();$.each(t,function(t,i){i&&i.specified&&i.value===""&&n.removeAttr(i.name)})})};$.extend($.support,{has3d:ej.addPrefix("perspective")in ej.styles,hasTouch:"ontouchstart"in window,hasPointer:navigator.msPointerEnabled,hasTransform:ej.userAgent()!==!1,pushstate:"pushState"in history&&"replaceState"in history,hasTransition:ej.addPrefix("transition")in ej.styles});$.extend($.expr[":"],{attrNotStartsWith:function(n,t,i){for(var u=n.attributes,r=0;r<u.length;r++)if(u[r].nodeName.indexOf(i[3])===0)return!1;return!0}});var n=$.fn.andSelf||$.fn.addBack;$.fn.andSelf=$.fn.addBack=function(){return n.apply(this,arguments)}}();window.ej=window.Syncfusion=window.Syncfusion||{},function(n,t,i,r){"use strict";var e,nt,tt,y,d,w,h,c,f;t.DataManager=function(i,u,f){if(!(this instanceof t.DataManager))return new t.DataManager(i,u,f);i||(i=[]);f=f||i.adaptor;typeof f=="string"&&(f=new t[f]);var e=[],o=this;return i instanceof Array?e={json:i,offline:!0}:typeof i=="object"?n.isPlainObject(i)?(i.json||(i.json=[]),i.table&&(i.json=this._getJsonFromElement(i.table,i.headerOption)),e={url:i.url,insertUrl:i.insertUrl,removeUrl:i.removeUrl,updateUrl:i.updateUrl,crudUrl:i.crudUrl,batchUrl:i.batchUrl,json:i.json,headers:i.headers,accept:i.accept,data:i.data,async:i.async,timeTillExpiration:i.timeTillExpiration,cachingPageSize:i.cachingPageSize,enableCaching:i.enableCaching,requestType:i.requestType,key:i.key,crossDomain:i.crossDomain,jsonp:i.jsonp,dataType:i.dataType,offline:i.offline!==r?i.offline:i.adaptor=="remoteSaveAdaptor"||i.adaptor instanceof t.remoteSaveAdaptor?!1:i.url?!1:!0,requiresFormat:i.requiresFormat}):(i.jquery||pt(i))&&(e={json:this._getJsonFromElement(i),offline:!0,table:i}):typeof i=="string"&&(e={url:i,offline:!1,dataType:"json",json:[]}),e.requiresFormat!==r||t.support.cors||(e.requiresFormat=c(e.crossDomain)?!0:e.crossDomain),e.dataType===r&&(e.dataType="json"),this.dataSource=e,this.defaultQuery=u,e.url&&e.offline&&!e.json.length?(this.isDataAvailable=!1,this.adaptor=f||new t.ODataAdaptor,this.dataSource.offline=!1,this.ready=this.executeQuery(u||t.Query()).done(function(n){o.dataSource.offline=!0;o.isDataAvailable=!0;e.json=n.result;o.adaptor=new t.JsonAdaptor})):this.adaptor=e.offline?new t.JsonAdaptor:new t.ODataAdaptor,!e.jsonp&&this.adaptor instanceof t.ODataAdaptor&&(e.jsonp="callback"),this.adaptor=f||this.adaptor,e.enableCaching&&(this.adaptor=new t.CacheAdaptor(this.adaptor,e.timeTillExpiration,e.cachingPageSize)),this};t.DataManager.prototype={setDefaultQuery:function(n){this.defaultQuery=n},executeQuery:function(i,u,e,o){var s,h,c;return typeof i=="function"&&(o=e,e=u,u=i,i=null),i||(i=this.defaultQuery),i instanceof t.Query||f("DataManager - executeQuery() : A query is required to execute"),s=n.Deferred(),s.then(u,e,o),h={query:i},this.dataSource.offline||this.dataSource.url==r?t.isNullOrUndefined(this.dataSource.async)||this.dataSource.async!=!1?d(function(){this._localQueryProcess(i,h,s)},this):this._localQueryProcess(i,h,s):(c=this.adaptor.processQuery(this,i),t.isNullOrUndefined(c.url)?d(function(){h=this._getDeferedArgs(i,c,h);s.resolveWith(this,[h])},this):this._makeRequest(c,s,h,i)),s.promise()},_localQueryProcess:function(n,t,i){var r=this.executeLocal(n);t=this._getDeferedArgs(n,r,t);i.resolveWith(this,[t])},_getDeferedArgs:function(n,t,i){return n._requiresCount?(i.result=t.result,i.count=t.count):i.result=t,i.getTableModel=rt(n._fromTable,i.result,this),i.getKnockoutModel=ut(i.result),i},executeLocal:function(i){var e,r;if(this.defaultQuery||i instanceof t.Query||f("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||f("DataManager - executeLocal() : Json data is required to execute"),i=i||this.defaultQuery,e=this.adaptor.processQuery(this,i),i._subQuery){var o=i._subQuery._fromTable,s=i._subQuery._lookup,u=i._requiresCount?e.result:e;for(s&&s instanceof Array&&k(i._subQuery._fKey,o,u,s,i._subQuery._key),r=0;r<u.length;r++)u[r][o]instanceof Array&&(u[r]=n.extend({},u[r]),u[r][o]=this.adaptor.processResponse(i._subQuery.using(t.DataManager(u[r][o].slice(0))).executeLocal(),this,i))}return this.adaptor.processResponse(e,this,i)},_makeRequest:function(i,r,u,f){var o=!!f._subQuerySelector,c=h(function(n){u.error=n;r.rejectWith(this,[u])},this),l=h(function(n,t,i,e,s,h,c){o||(u.xhr=i,u.count=parseInt(t,10),u.result=n,u.request=e,u.aggregates=h,u.getTableModel=rt(f._fromTable,n,this),u.getKnockoutModel=ut(n),u.actual=s,u.virtualSelectRecords=c,r.resolveWith(this,[u]))},this),a=h(function(t,i){var r=n.Deferred(),h={parent:u},e,s;return f._subQuery._isChild=!0,e=this.adaptor.processQuery(this,f._subQuery,t?this.adaptor.processResponse(t):i),s=this._makeRequest(e,r,h,f._subQuery),o||r.then(function(n){t&&(k(f._subQuery._fKey,f._subQuery._fromTable,t,n,f._subQuery._key),l(t))},c),s},this),v=w(function(n,i,r,u){r.getResponseHeader("Content-Type").indexOf("xml")==-1&&t.dateParse&&(n=t.parseJSON(n));var e=this.adaptor.processResponse(n,this,f,r,u),s=0,h=null,c=n.virtualSelectRecords;if(f._requiresCount&&(s=e.count,h=e.aggregates,e=e.result),!f._subQuery){l(e,s,r,u,n,h,c);return}o||a(e)},this),e=n.extend({type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,beforeSend:h(this._beforeSend,this),processData:!1,success:v,error:c},i),s;return"async"in this.dataSource&&(e.async=this.dataSource.async),e=n.ajax(e),o&&(s=f._subQuerySelector.call(this,{query:f._subQuery,parent:f}),s&&s.length?(e=n.when(e,a(null,s)),e.then(w(function(n,t,i){var r=this.adaptor.processResponse(n[0],this,f,n[2],i[0]),e=0,u;f._requiresCount&&(e=r.count,r=r.result);u=this.adaptor.processResponse(t[0],this,f._subQuery,t[2],i[1]);e=0;f._subQuery._requiresCount&&(e=u.count,u=u.result);k(f._subQuery._fKey,f._subQuery._fromTable,r,u,f._subQuery._key);o=!1;l(r,e,n[2])},this),c)):o=!1),e},_beforeSend:function(n,t){var i,f,r,u;for(this.adaptor.beforeSend(this,n,t),i=this.dataSource.headers,r=0;i&&r<i.length;r++){f=[];for(u in i[r])f.push(u),n.setRequestHeader(u,i[r][u])}},saveChanges:function(i,r,u,f){var s,o,e;return(u instanceof t.Query&&(f=u,u=null),s={url:u,key:r||this.dataSource.key},o=this.adaptor.batchRequest(this,i,s,f),this.dataSource.offline)?o:(e=n.Deferred(),n.ajax(n.extend({beforeSend:h(this._beforeSend,this),success:w(function(n,t,r,u){e.resolveWith(this,[this.adaptor.processResponse(n,this,null,r,u,i)])},this),error:function(n){e.rejectWith(this,[{error:n}])}},o)),e.promise())},insert:function(i,r,f){var o,e;return(i=u.replacer(i),r instanceof t.Query&&(f=r,r=null),o=this.adaptor.insert(this,i,r,f),this.dataSource.offline)?o:(e=n.Deferred(),n.ajax(n.extend({type:"POST",contentType:"application/json; charset=utf-8",processData:!1,beforeSend:h(this._beforeSend,this),success:w(function(n,i,r,f){try{t.isNullOrUndefined(n)?n=[]:u.parseJson(n)}catch(o){n=[]}n=this.adaptor.processResponse(u.parseJson(n),this,null,r,f);e.resolveWith(this,[{record:n,dataManager:this}])},this),error:function(n){e.rejectWith(this,[{error:n,dataManager:this}])}},o)),e.promise())},remove:function(i,r,f,e){var s,o;return(typeof r=="object"&&(r=r[i]),f instanceof t.Query&&(e=f,f=null),s=this.adaptor.remove(this,i,r,f,e),this.dataSource.offline)?s:(o=n.Deferred(),n.ajax(n.extend({type:"POST",contentType:"application/json; charset=utf-8",beforeSend:h(this._beforeSend,this),success:w(function(n,i,r,f){try{t.isNullOrUndefined(n)?n=[]:u.parseJson(n)}catch(e){n=[]}n=this.adaptor.processResponse(u.parseJson(n),this,null,r,f);o.resolveWith(this,[{record:n,dataManager:this}])},this),error:function(n){o.rejectWith(this,[{error:n,dataManager:this}])}},s)),o.promise())},update:function(i,r,f,e){var s,o;return(r=u.replacer(r),f instanceof t.Query&&(e=f,f=null),s=this.adaptor.update(this,i,r,f,e),this.dataSource.offline)?s:(o=n.Deferred(),n.ajax(n.extend({contentType:"application/json; charset=utf-8",beforeSend:h(this._beforeSend,this),success:w(function(n,i,r,f){try{t.isNullOrUndefined(n)?n=[]:u.parseJson(n)}catch(e){n=[]}n=this.adaptor.processResponse(u.parseJson(n),this,null,r,f);o.resolveWith(this,[{record:n,dataManager:this}])},this),error:function(n){o.rejectWith(this,[{error:n,dataManager:this}])}},s)),o.promise())},_getJsonFromElement:function(i){typeof i=="string"&&(i=n(n(i).html()));i=i.jquery?i[0]:i;var r=i.tagName.toLowerCase();return r!=="table"&&f("ej.DataManager : Unsupported htmlElement : "+r),t.parseTable(i)}};var k=function(n,i,r,u,e){var o,s={},c,h;for(u.result&&(u=u.result),u.GROUPGUID&&f("ej.DataManager: Do not have support Grouping in hierarchy"),o=0;o<u.length;o++)h=t.getObject(n,u[o]),c=s[h]||(s[h]=[]),c.push(u[o]);for(o=0;o<r.length;o++)r[o][i]=s[t.getObject(e||n,r[o])]},a={accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "},u={parseJson:function(n){var t=typeof n;return t==="string"?n=JSON.parse(n,u.jsonReviver):n instanceof Array?u.iterateAndReviveArray(n):t==="object"&&u.iterateAndReviveJson(n),n},iterateAndReviveArray:function(n){for(var t=0;t<n.length;t++)typeof n[t]=="object"?u.iterateAndReviveJson(n[t]):n[t]=typeof n[t]!="string"||/^[\s]*\[|^[\s]*\{|\"/g.test(n[t])?u.parseJson(n[t]):u.jsonReviver("",n[t])},iterateAndReviveJson:function(n){var t;for(var i in n)i.startsWith("__")||(t=n[i],typeof t=="object"?t instanceof Array?u.iterateAndReviveArray(t):u.iterateAndReviveJson(t):n[i]=u.jsonReviver(i,t))},jsonReviver:function(n,t){var f=t,r,i;if(typeof t=="string"){if(r=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(t),r)return u.replacer(new Date(parseInt(r[1])));/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(t)&&(t=u.replacer(new Date(t)),isNaN(t)&&(i=f.split(/[^0-9]/),t=u.replacer(new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5]))))}return t},isJson:function(n){return typeof n[0]=="string"?n:t.parseJSON(n)},isGuid:function(n){var t=/[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i.exec(n);return t!=null},replacer:function(n){return t.isPlainObject(n)?u.jsonReplacer(n):n instanceof Array?u.arrayReplacer(n):n instanceof Date?u.jsonReplacer({val:n}).val:n},jsonReplacer:function(n){var i;for(var r in n)(i=n[r],i instanceof Date)&&(n[r]=new Date(+i+t.serverTimezoneOffset*36e5));return n},arrayReplacer:function(n){for(var i=0;i<n.length;i++)t.isPlainObject(n[i])?n[i]=u.jsonReplacer(n[i]):n[i]instanceof Date&&(n[i]=u.jsonReplacer({date:n[i]}).date);return n}};t.isJSON=u.isJson;t.parseJSON=u.parseJson;t.dateParse=!0;t.isGUID=u.isGuid;t.Query=function(n){return(this instanceof t.Query)?(this.queries=[],this._key="",this._fKey="",typeof n=="string"?this._fromTable=n||"":n&&n instanceof Array&&(this._lookup=n),this._expands=[],this._sortedColumns=[],this._groupedColumns=[],this._subQuery=null,this._isChild=!1,this._params=[],this):new t.Query(n)};t.Query.prototype={key:function(n){return typeof n=="string"&&(this._key=n),this},using:function(n){return n instanceof t.DataManager?(this.dataManagar=n,this):f("Query - using() : 'using' function should be called with parameter of instance ej.DataManager")},execute:function(n,i,r,u){return(n=n||this.dataManagar,n&&n instanceof t.DataManager)?n.executeQuery(this,i,r,u):f("Query - execute() : dataManager needs to be is set using 'using' function or should be passed as argument")},executeLocal:function(n){return(n=n||this.dataManagar,n&&n instanceof t.DataManager)?n.executeLocal(this):f("Query - executeLocal() : dataManager needs to be is set using 'using' function or should be passed as argument")},clone:function(){var n=new t.Query;return n.queries=this.queries.slice(0),n._key=this._key,n._isChild=this._isChild,n.dataManagar=this.dataManager,n._fromTable=this._fromTable,n._params=this._params.slice(0),n._expands=this._expands.slice(0),n._sortedColumns=this._sortedColumns.slice(0),n._groupedColumns=this._groupedColumns.slice(0),n._subQuerySelector=this._subQuerySelector,n._subQuery=this._subQuery,n._fKey=this._fKey,n._requiresCount=this._requiresCount,n},from:function(n){return typeof n=="string"&&(this._fromTable=n),this},addParams:function(n,i){return typeof i=="function"||t.isPlainObject(i)?typeof i=="function"&&this._params.push({key:n,fn:i}):this._params.push({key:n,value:i}),this},expand:function(n){return this._expands=typeof n=="string"?[].slice.call(arguments,0):n.slice(0),this},where:function(n,i,r,u){i=(i||t.FilterOperators.equal).toLowerCase();var e=null;return typeof n=="string"?e=new t.Predicate(n,i,r,u):n instanceof t.Predicate?e=n:f("Query - where : Invalid arguments"),this.queries.push({fn:"onWhere",e:e}),this},search:function(n,i,r,u){i&&typeof i!="boolean"?typeof i=="string"&&(i=[i]):(i=[],u=i);typeof r=="boolean"&&(u=r,r=null);r=r||t.FilterOperators.contains;r.length<3&&(r=t.data.operatorSymbols[r]);var f=t.data.fnOperators[r]||t.data.fnOperators.processSymbols(r);return this.queries.push({fn:"onSearch",e:{fieldNames:i,operator:r,searchKey:n,ignoreCase:u,comparer:f}}),this},sortBy:function(n,i,r){var o=t.sortOrder.Ascending,s,f,u,e;if(typeof n=="string"&&n.toLowerCase().endsWith(" desc")&&(n=n.replace(/ desc$/i,""),i=t.sortOrder.Descending),n instanceof Array){for(u=0;u<n.length;u++)this.sortBy(n[u],i,r);return this}if(typeof i=="boolean"?i=i?t.sortOrder.Descending:t.sortOrder.Ascending:typeof i=="function"&&(o="custom"),i&&typeof i!="string"||(o=i?i.toLowerCase():t.sortOrder.Ascending,i=t.pvt.fnSort(i)),r)for(s=l(this.queries,"onSortBy"),u=0;u<s.length;u++)if(f=s[u].e.fieldName,typeof f=="string"){if(f===n)return this}else if(f instanceof Array)for(e=0;e<f.length;e++)if(f[e]===n||n.toLowerCase()===f[e]+" desc")return this;return this.queries.push({fn:"onSortBy",e:{fieldName:n,comparer:i,direction:o}}),this},sortByDesc:function(n){return this.sortBy(n,t.sortOrder.Descending)},group:function(n,t){return this.sortBy(n,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:n,fn:t}}),this},page:function(n,t){return this.queries.push({fn:"onPage",e:{pageIndex:n,pageSize:t}}),this},range:function(n,t){return(typeof n!="number"||typeof t!="number")&&f("Query() - range : Arguments type should be a number"),this.queries.push({fn:"onRange",e:{start:n,end:t}}),this},take:function(n){return typeof n!="number"&&f("Query() - Take : Argument type should be a number"),this.queries.push({fn:"onTake",e:{nos:n}}),this},skip:function(n){return typeof n!="number"&&f("Query() - Skip : Argument type should be a number"),this.queries.push({fn:"onSkip",e:{nos:n}}),this},select:function(n){return typeof n=="string"&&(n=[].slice.call(arguments,0)),n instanceof Array||f("Query() - Select : Argument type should be String or Array"),this.queries.push({fn:"onSelect",e:{fieldNames:n}}),this},hierarchy:function(n,i){return n&&n instanceof t.Query||f("Query() - hierarchy : query must be instance of ej.Query"),typeof i=="function"&&(this._subQuerySelector=i),this._subQuery=n,this},foreignKey:function(n){return typeof n=="string"&&(this._fKey=n),this},requiresCount:function(){return this._requiresCount=!0,this},aggregate:function(n,t){this.queries.push({fn:"onAggregates",e:{field:t,type:n}})}};t.Adaptor=function(n){this.dataSource=n;this.pvt={};this.init.apply(this,[].slice.call(arguments,1))};t.Adaptor.prototype={options:{from:"table",requestType:"json",sortBy:"sorted",select:"select",skip:"skip",group:"group",take:"take",search:"search",count:"requiresCounts",where:"where",aggregates:"aggregates"},init:function(){},extend:function(t){var i=function(t){this.dataSource=t;this.options&&(this.options=n.extend({},this.options));this.init.apply(this,[].slice.call(arguments,0));this.pvt={}},u,r;i.prototype=new this.type;i.prototype.type=i;u=i.prototype.base={};for(r in t)i.prototype[r]&&(u[r]=i.prototype[r]);return n.extend(!0,i.prototype,t),i},processQuery:function(){},processResponse:function(n){return n.d?n.d:n},convertToQueryString:function(t){return n.param(t)},type:t.Adaptor};t.UrlAdaptor=(new t.Adaptor).extend({processQuery:function(n,t,i){var w=l(t.queries,"onSortBy"),d=l(t.queries,"onGroup"),nt=l(t.queries,"onWhere"),tt=l(t.queries,"onSearch"),it=l(t.queries,"onAggregates"),a=g(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),rt=t._params,b=n.dataSource.url,r,y,p=null,h=this.options,s={sorted:[],grouped:[],filters:[],searches:[],aggregates:[]},f,u,v,k;for(a.onPage?(r=a.onPage,y=e(r.pageIndex,t),p=e(r.pageSize,t),y=(y-1)*p):a.onRange&&(r=a.onRange,y=r.start,p=r.end-r.start),f=0;f<w.length;f++)r=e(w[f].e.fieldName,t),s.sorted.push(o(this,"onEachSort",{name:r,direction:w[f].e.direction},t));for(i&&(r=this.getFiltersFrom(i,t),r&&s.filters.push(o(this,"onEachWhere",r.toJSON(),t))),f=0;f<nt.length;f++){s.filters.push(o(this,"onEachWhere",nt[f].e.toJSON(),t));for(v in s.filters[f])c(s[v])&&delete s[v]}for(f=0;f<tt.length;f++)r=tt[f].e,s.searches.push(o(this,"onEachSearch",{fields:r.fieldNames,operator:r.operator,key:r.searchKey,ignoreCase:r.ignoreCase},t));for(f=0;f<d.length;f++)s.grouped.push(e(d[f].e.fieldName,t));for(f=0;f<it.length;f++)r=it[f].e,s.aggregates.push({type:r.type,field:e(r.field,t)});u={};u[h.from]=t._fromTable;h.expand&&(u[h.expand]=t._expands);u[h.select]=a.onSelect?o(this,"onSelect",e(a.onSelect.fieldNames,t),t):"";u[h.count]=t._requiresCount?o(this,"onCount",t._requiresCount,t):"";u[h.search]=s.searches.length?o(this,"onSearch",s.searches,t):"";u[h.skip]=a.onSkip?o(this,"onSkip",e(a.onSkip.nos,t),t):"";u[h.take]=a.onTake?o(this,"onTake",e(a.onTake.nos,t),t):"";u[h.where]=s.filters.length||s.searches.length?o(this,"onWhere",s.filters,t):"";u[h.sortBy]=s.sorted.length?o(this,"onSortBy",s.sorted,t):"";u[h.group]=s.grouped.length?o(this,"onGroup",s.grouped,t):"";u[h.aggregates]=s.aggregates.length?o(this,"onAggregates",s.aggregates,t):"";u.param=[];o(this,"addParams",{dm:n,query:t,params:rt,reqParams:u});for(v in u)(c(u[v])||u[v]===""||u[v].length===0||v==="params")&&delete u[v];return(h.skip in u&&h.take in u||p===null||(u[h.skip]=o(this,"onSkip",y,t),u[h.take]=o(this,"onTake",p,t)),k=this.pvt,this.pvt={},this.options.requestType==="json")?{data:JSON.stringify(u),url:b,ejPvtData:k,type:"POST",contentType:"application/json; charset=utf-8"}:(r=this.convertToQueryString(u,t,n),r=(n.dataSource.url.indexOf("?")!==-1?"&":"/")+r,{type:"GET",url:r.length?b.replace(/\/*$/,r):b,ejPvtData:k})},convertToQueryString:function(t,i,r){return r.dataSource.url&&r.dataSource.url.indexOf("?")!==-1?n.param(t):"?"+n.param(t)},processResponse:function(n,i,u,f,e,o){var c=e.ejPvtData||{},v=n.groupDs,y,a,h,s,d,w;if(f&&f.getResponseHeader("Content-Type")&&f.getResponseHeader("Content-Type").indexOf("xml")!=-1&&n.nodeType==9)return u._requiresCount?{result:[],count:0}:[];if(y=JSON.parse(e.data),y&&y.action==="batch"&&n.added)return o.added=n.added,o;if(n.d&&(n=n.d),c&&c.aggregates&&c.aggregates.length){var l=c.aggregates,h={},p,k={};for(("count"in n)&&(h.count=n.count),n.result&&(h.result=n.result),n.aggregate&&(n=n.aggregate),s=0;s<l.length;s++)p=t.aggregates[l[s].type],p&&(k[l[s].field+" - "+l[s].type]=p(n,l[s].field));h.aggregates=k;n=h}if(c&&c.groups&&c.groups.length){for(a=c.groups,h={},("count"in n)&&(h.count=n.count),n.aggregates&&(h.aggregates=n.aggregates),n.result&&(n=n.result),s=0;s<a.length;s++)d=null,w=b(a[s],u.queries),t.isNullOrUndefined(v)||(v=t.group(v,a[s],null,w)),n=t.group(n,a[s],c.aggregates,w,d,v);return h.count!=r?h.result=n:h=n,h}return n},onGroup:function(n){this.pvt.groups=n},onAggregates:function(n){this.pvt.aggregates=n},batchRequest:function(n,t,i,r){var u={changed:t.changed,added:t.added,deleted:t.deleted,action:"batch",table:i.url,key:i.key};return r&&this.addParams({dm:n,query:r,params:r._params,reqParams:u}),{type:"POST",url:n.dataSource.batchUrl||n.dataSource.crudUrl||n.dataSource.removeUrl||n.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(u)}},beforeSend:function(){},insert:function(n,t,i,r){var u={value:t,table:i,action:"insert"};return r&&this.addParams({dm:n,query:r,params:r._params,reqParams:u}),{url:n.dataSource.insertUrl||n.dataSource.crudUrl||n.dataSource.url,data:JSON.stringify(u)}},remove:function(n,t,i,r,u){var f={key:i,keyColumn:t,table:r,action:"remove"};return u&&this.addParams({dm:n,query:u,params:u._params,reqParams:f}),{type:"POST",url:n.dataSource.removeUrl||n.dataSource.crudUrl||n.dataSource.url,data:JSON.stringify(f)}},update:function(n,t,i,r,u){var f={value:i,action:"update",keyColumn:t,key:i[t],table:r};return u&&this.addParams({dm:n,query:u,params:u._params,reqParams:f}),{type:"POST",url:n.dataSource.updateUrl||n.dataSource.crudUrl||n.dataSource.url,data:JSON.stringify(f)}},getFiltersFrom:function(n,i){var r;n instanceof Array&&n.length||f("ej.SubQuery: Array of key values required");var u=i._fKey,e,o=u,h=i._key,s=[],c=typeof n[0]!="object";for(typeof n[0]!="object"&&(o=null),r=0;r<n.length;r++)e=c?n[r]:t.pvt.getObject(h||o,n[r]),s.push(new t.Predicate(u,"==",e));return t.Predicate.or(s)},addParams:function(n){var e=n.dm,u=n.query,o=n.params,i=n.reqParams,r,t;for(i.params={},r=0;t=o[r];r++)i[t.key]&&f("ej.Query: Custom Param is conflicting other request arguments"),i[t.key]=t.value,t.fn&&(i[t.key]=t.fn.call(u,t.key,u,e)),i.params[t.key]=i[t.key]}});t.WebMethodAdaptor=(new t.UrlAdaptor).extend({processQuery:function(n,i,r){var u=t.UrlAdaptor.prototype.processQuery(n,i,r),e=t.parseJSON(u.data),f={};return f.value=e,o(this,"addParams",{dm:n,query:i,params:i._params,reqParams:f}),{data:JSON.stringify(f),url:u.url,ejPvtData:u.ejPvtData,type:"POST",contentType:"application/json; charset=utf-8"}},addParams:function(n){var s=n.dm,o=n.query,h=n.params,i=n.reqParams,u,t,r,e;for(i.params={},u=0;t=h[u];u++)i[t.key]&&f("ej.Query: Custom Param is conflicting other request arguments"),r=t.key,e=t.value,t.fn&&(e=t.fn.call(o,t.key,o,s)),i[r]=e,i.params[r]=i[r]}});t.CacheAdaptor=(new t.UrlAdaptor).extend({init:function(n,i,r){var f,u;t.isNullOrUndefined(n)||(this.cacheAdaptor=n);this.pageSize=r;this.guidId=t.getGuid("cacheAdaptor");f={keys:[],results:[]};window.localStorage&&window.localStorage.setItem(this.guidId,JSON.stringify(f));u=this.guidId;t.isNullOrUndefined(i)||setInterval(function(){for(var e,r=t.parseJSON(window.localStorage.getItem(u)),f=[],n=0;n<r.results.length;n++)r.results[n].timeStamp=new Date-new Date(r.results[n].timeStamp),new Date-new Date(r.results[n].timeStamp)>i&&f.push(n);for(e=f,n=0;n<f.length;n++)r.results.splice(f[n],1),r.keys.splice(f[n],1);window.localStorage.removeItem(u);window.localStorage.setItem(u,JSON.stringify(r))},i)},generateKey:function(n,t){var h=l(t.queries,"onSortBy"),c=l(t.queries,"onGroup"),o=l(t.queries,"onWhere"),a=l(t.queries,"onSearch"),v=l(t.queries,"onPage"),s=g(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),y=t._params,r=n,u,i,f,e;for(s.onPage&&(r+=s.onPage.pageIndex),h.forEach(function(n){r+=n.e.direction+n.e.fieldName}),c.forEach(function(n){r+=n.e.fieldName}),a.forEach(function(n){r+=n.e.searchKey}),u=0;u<o.length;u++)if(i=o[u],i.e.isComplex){for(f=t.clone(),f.queries=[],e=0;e<i.e.predicates.length;e++)f.queries.push({fn:"onWhere",e:i.e.predicates[e],filter:t.queries.filter});r+=i.e.condition+this.generateKey(n,f)}else r+=i.e.field+i.e.operator+i.e.value;return r},processQuery:function(n,i){var f=this.generateKey(n.dataSource.url,i),r,u;return(window.localStorage&&(r=t.parseJSON(window.localStorage.getItem(this.guidId))),u=r?r.results[r.keys.indexOf(f)]:null,u!=null&&!this._crudAction&&!this._insertAction)?u:(this._crudAction=null,this._insertAction=null,this.cacheAdaptor.processQuery.apply(this.cacheAdaptor,[].slice.call(arguments,0)))},processResponse:function(i,r,u,f,e,o){var h;if(this._insertAction||e&&this.cacheAdaptor.options.batch&&e.url.endsWith(this.cacheAdaptor.options.batch)&&e.type.toLowerCase()==="post")return this.cacheAdaptor.processResponse(i,r,u,f,e,o);var i=this.cacheAdaptor.processResponse.apply(this,[].slice.call(arguments,0)),c=this.generateKey(r.dataSource.url,u),s={};for(window.localStorage&&(s=t.parseJSON(window.localStorage.getItem(this.guidId))),h=n.inArray(c,s.keys),h!=-1&&(s.results.splice(h,1),s.keys.splice(h,1)),s.results[s.keys.push(c)-1]={keys:c,result:i.result,timeStamp:new Date,count:i.count};s.results.length>this.pageSize;)s.results.splice(0,1),s.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(s)),i},update:function(n,t,i,r){return this._crudAction=!0,this.cacheAdaptor.update(n,t,i,r)},insert:function(n,t,i){return this._insertAction=!0,this.cacheAdaptor.insert(n,t,i)},remove:function(n,t,i,r){return this._crudAction=!0,this.cacheAdaptor.remove(n,t,i,r)},batchRequest:function(n,t,i){return this.cacheAdaptor.batchRequest(n,t,i)}});var l=function(n,t){return n.filter(function(n){return n.fn===t})||[]},g=function(n,t){for(var r=n.filter(function(n){return t.indexOf(n.fn)!==-1}),u={},i=0;i<r.length;i++)u[r[i].fn]||(u[r[i].fn]=r[i].e);return u},o=function(n,t,i,r){if(n[t]){var u=n[t](i,r);c(u)||(i=u)}return i};t.ODataAdaptor=(new t.UrlAdaptor).extend({options:{requestType:"get",accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$inlinecount",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "},onEachWhere:function(n,t){return n.isComplex?this.onComplexPredicate(n,t):this.onPredicate(n,t)},onPredicate:function(n,i,r){var o="",s,h,f=n.value,c=typeof f,e=this._p(n.field),l;return(f instanceof Date&&(f="datetime'"+u.replacer(f).toJSON()+"'"),c==="string"&&(f.indexOf("'")!=-1&&(f=f.replace(new RegExp(/'/g),"''")),f="'"+f+"'",r&&(e="cast("+e+", 'Edm.String')"),t.isGUID(f)&&(h="guid"),n.ignoreCase&&(h?e:e="tolower("+e+")",f=f.toLowerCase())),s=t.data.odBiOperator[n.operator],s)?(o+=e,o+=s,h&&(o+=h),o+f):(s=t.data.odUniOperator[n.operator],!s||c!=="string")?"":(s==="substringof"&&(l=f,f=e,e=l),o+=s+"(",o+=e+",",h&&(o+=h),o+(f+")"))},onComplexPredicate:function(n,t){for(var r=[],i=0;i<n.predicates.length;i++)r.push("("+this.onEachWhere(n.predicates[i],t)+")");return r.join(" "+n.condition+" ")},onWhere:function(n){return this.pvt.searches&&n.push(this.onEachWhere(this.pvt.searches,null,!0)),n.join(" and ")},onEachSearch:function(n){var r,i;for(n.fields.length===0&&f("Query() - Search : oData search requires list of field names to search"),r=this.pvt.searches||[],i=0;i<n.fields.length;i++)r.push(new t.Predicate(n.fields[i],n.operator,n.key,n.ignoreCase));this.pvt.searches=r},onSearch:function(){return this.pvt.searches=t.Predicate.or(this.pvt.searches),""},onEachSort:function(n){var i=[],t;if(n.name instanceof Array)for(t=0;t<n.name.length;t++)i.push(this._p(n.name[t]));else i.push(this._p(n.name)+(n.direction==="descending"?" desc":""));return i.join(",")},onSortBy:function(n){return n.reverse().join(",")},onGroup:function(n){return this.pvt.groups=n,""},onSelect:function(n){for(var t=0;t<n.length;t++)n[t]=this._p(n[t]);return n.join(",")},onAggregates:function(n){return this.pvt.aggregates=n,""},onCount:function(n){return n===!0?"allpages":""},beforeSend:function(n,t,i){i.url.endsWith(this.options.batch)&&i.type.toLowerCase()==="post"&&(t.setRequestHeader("Accept",a.multipartAccept),t.setRequestHeader("DataServiceVersion","2.0"),t.overrideMimeType("text/plain; charset=x-user-defined"));n.dataSource.crossDomain||(t.setRequestHeader("DataServiceVersion","2.0"),t.setRequestHeader("MaxDataServiceVersion","2.0"))},processResponse:function(i,r,f,e,o,s){var a,l,v,d,tt,g,it,k,h,ft;if(!t.isNullOrUndefined(i.d)&&(a=f&&f._requiresCount?i.d.results:i.d,!t.isNullOrUndefined(a)))for(h=0;h<a.length;h++)t.isNullOrUndefined(a[h].__metadata)||delete a[h].__metadata;if(l=o&&o.ejPvtData,e&&e.getResponseHeader("Content-Type")&&e.getResponseHeader("Content-Type").indexOf("xml")!=-1&&i.nodeType==9)return f._requiresCount?{result:[],count:0}:[];if(o&&this.options.batch&&o.url.endsWith(this.options.batch)&&o.type.toLowerCase()==="post"){if(v=e.getResponseHeader("Content-Type"),v=v.substring(v.indexOf("=batchresponse")+1),i=i.split(v),i.length<2)return;for(i=i[1],g=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(i),i.replace(g[0],""),it=g[1],i=i.split(it),h=i.length;h>-1;h--)/\bContent-ID:/i.test(i[h])&&/\bHTTP.+201/.test(i[h])&&(d=parseInt(/\bContent-ID: (\d+)/i.exec(i[h])[1]),s.added[d]&&(tt=u.parseJson(/^\{.+\}/m.exec(i[h])[0]),n.extend(s.added[d],this.processResponse(tt))));return s}var y=e&&e.getResponseHeader("DataServiceVersion"),w=null,rt={};if(y=y&&parseInt(y,10)||2,f&&f._requiresCount&&((i.__count||i["odata.count"])&&(w=i.__count||i["odata.count"]),i.d&&(i=i.d),(i.__count||i["odata.count"])&&(w=i.__count||i["odata.count"])),y===3&&i.value&&(i=i.value),i.d&&(i=i.d),y<3&&i.results&&(i=i.results),l&&l.aggregates&&l.aggregates.length){var p=l.aggregates,nt,ut={};for(h=0;h<p.length;h++)nt=t.aggregates[p[h].type],nt&&(ut[p[h].field+" - "+p[h].type]=nt(i,p[h].field));rt=ut}if(l&&l.groups&&l.groups.length)for(k=l.groups,h=0;h<k.length;h++)ft=b(k[h],f.queries),i=t.group(i,k[h],l.aggregates,ft);return c(w)?i:{result:i,count:w,aggregates:rt}},convertToQueryString:function(n,t,i){var r=[],u=n.table||"",f;delete n.table;i.dataSource.requiresFormat&&(n.$format="json");for(f in n)r.push(f+"="+n[f]);return(r=r.join("&"),i.dataSource.url&&i.dataSource.url.indexOf("?")!==-1&&!u)?r:r.length?u+"?"+r:u||""},insert:function(n,t,i){return{url:n.dataSource.url.replace(/\/*$/,i?"/"+i:""),data:JSON.stringify(t)}},remove:function(n,t,i,r){return{type:"DELETE",url:n.dataSource.url.replace(/\/*$/,r?"/"+r:"")+"("+i+")"}},update:function(n,t,i,r){return{type:"PUT",url:n.dataSource.url.replace(/\/*$/,r?"/"+r:"")+"("+i[t]+")",data:JSON.stringify(i),accept:this.options.accept}},batchRequest:function(n,i,r){var e=r.guid=t.getGuid(a.batchPre),o=n.dataSource.url.replace(/\/*$/,"/"+this.options.batch),f={url:r.url,key:r.key,cid:1,cSet:t.getGuid(a.changeSet)},u="--"+e+"\n";return u+="Content-Type: multipart/mixed; boundary="+f.cSet.replace("--","")+"\n",this.pvt.changeSet=0,u+=this.generateInsertRequest(i.added,f),u+=this.generateUpdateRequest(i.changed,f),u+=this.generateDeleteRequest(i.deleted,f),u+=f.cSet+"--\n",u+="--"+e+"--",{type:"POST",url:o,contentType:"multipart/mixed; charset=UTF-8;boundary="+e,data:u}},generateDeleteRequest:function(n,t){var i,r;if(!n)return"";for(i="",r=0;r<n.length;r++)i+="\n"+t.cSet+"\n",i+=a.changeSetContent+"\n\n",i+="DELETE ",i+=t.url+"("+n[r][t.key]+") HTTP/1.1\n",i+="If-Match : * \n",i+="Accept: "+a.accept+"\n",i+="Content-Id: "+this.pvt.changeSet+++"\n",i+=a.batchChangeSetContentType+"\n";return i+"\n"},generateInsertRequest:function(n,t){var i,r;if(!n)return"";for(i="",r=0;r<n.length;r++)i+="\n"+t.cSet+"\n",i+=a.changeSetContent+"\n\n",i+="POST ",i+=t.url+" HTTP/1.1\n",i+="Accept: "+a.accept+"\n",i+="Content-Id: "+this.pvt.changeSet+++"\n",i+=a.batchChangeSetContentType+"\n\n",i+=JSON.stringify(n[r])+"\n";return i},generateUpdateRequest:function(n,t){var i,r;if(!n)return"";for(i="",r=0;r<n.length;r++)i+="\n"+t.cSet+"\n",i+=a.changeSetContent+"\n\n",i+="PUT ",i+=t.url+"("+n[r][t.key]+") HTTP/1.1\n",i+="If-Match : * \n",i+="Accept: "+a.accept+"\n",i+="Content-Id: "+this.pvt.changeSet+++"\n",i+=a.batchChangeSetContentType+"\n\n",i+=JSON.stringify(n[r])+"\n\n";return i},_p:function(n){return n.replace(/\./g,"/")}});t.ODataV4Adaptor=(new t.ODataAdaptor).extend({options:{requestType:"get",accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$count",search:"$search",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "},onCount:function(n){return n===!0?"true":""},onPredicate:function(n,i,r){var u="",f=n.value,e=f instanceof Date;return t.data.odUniOperator.contains="contains",u=t.ODataAdaptor.prototype.onPredicate.call(this,n,i,r),t.data.odUniOperator.contains="substringof",e&&(u=u.replace(/datetime'(.*)'$/,"$1")),u},onEachSearch:function(n){var t=this.pvt.search||[];t.push(n.key);this.pvt.search=t},onSearch:function(){return this.pvt.search.join(" OR ")},beforeSend:function(){},processQuery:function(n,i){for(var f,o,e=/\/[\d*\/]*/g,u="",r=i._expands.length-1;r>0;r--)if(u.indexOf(i._expands[r])>=0)i._expands.pop();else if(e.test(i._expands[r])){for(u=i._expands.pop(),f=u.replace(e,"($expand="),o=0;o<u.split(e).length-1;o++)f=f+")";i._expands.unshift(f);r++}return t.ODataAdaptor.prototype.processQuery.apply(this,[n,i])},processResponse:function(i,r,f,e,o,s){var l=o&&o.ejPvtData,a,w,nt,k,tt,y,d,p,h,rt;if(e&&e.getResponseHeader("Content-Type")&&e.getResponseHeader("Content-Type").indexOf("xml")!=-1&&i.nodeType==9)return f._requiresCount?{result:[],count:0}:[];if(o&&this.options.batch&&o.url.endsWith(this.options.batch)&&o.type.toLowerCase()==="post"){if(a=e.getResponseHeader("Content-Type"),a=a.substring(a.indexOf("=batchresponse")+1),i=i.split(a),i.length<2)return;for(i=i[1],k=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(i),i.replace(k[0],""),tt=k[1],i=i.split(tt),h=i.length;h>-1;h--)/\bContent-ID:/i.test(i[h])&&/\bHTTP.+201/.test(i[h])&&(w=parseInt(/\bContent-ID: (\d+)/i.exec(i[h])[1]),s.added[w]&&(nt=u.parseJson(/^\{.+\}/m.exec(i[h])[0]),n.extend(s.added[w],this.processResponse(nt))));return s}if(y=null,d={},f&&f._requiresCount&&"@odata.count"in i&&(y=i["@odata.count"]),i=t.isNullOrUndefined(i.value)?i:i.value,l&&l.aggregates&&l.aggregates.length){var v=l.aggregates,g,it={};for(h=0;h<v.length;h++)g=t.aggregates[v[h].type],g&&(it[v[h].field+" - "+v[h].type]=g(i,v[h].field));d=it}if(l&&l.groups&&l.groups.length)for(p=l.groups,h=0;h<p.length;h++)rt=b(p[h],f.queries),i=t.group(i,p[h],l.aggregates,rt);return c(y)?i:{result:i,count:y,aggregates:d}}});t.JsonAdaptor=(new t.Adaptor).extend({processQuery:function(n,t){for(var u=n.dataSource.json.slice(0),o=u.length,s=!0,f,i,h={},e=0;e<t.queries.length;e++)i=t.queries[e],f=this[i.fn].call(this,u,i.e,t),i.fn=="onAggregates"?h[i.e.field+" - "+i.e.type]=f:u=f!==r?f:u,(i.fn==="onPage"||i.fn==="onSkip"||i.fn==="onTake"||i.fn==="onRange")&&(s=!1),s&&(o=u.length);return t._requiresCount&&(u={result:u,count:o,aggregates:h}),u},batchRequest:function(n,t,i){for(var r=0;r<t.added.length;r++)this.insert(n,t.added[r]);for(r=0;r<t.changed.length;r++)this.update(n,i.key,t.changed[r]);for(r=0;r<t.deleted.length;r++)this.remove(n,i.key,t.deleted[r]);return t},onWhere:function(n,t){return n?n.filter(function(n){return t.validate(n)}):n},onAggregates:function(n,i){var r=t.aggregates[i.type];return!n||!r||n.length==0?null:r(n,i.field)},onSearch:function(n,i){return!n||!n.length?n:(i.fieldNames.length===0&&t.pvt.getFieldList(n[0],i.fieldNames),n.filter(function(n){for(var r=0;r<i.fieldNames.length;r++)if(i.comparer.call(n,t.pvt.getObject(i.fieldNames[r],n),i.searchKey,i.ignoreCase))return!0;return!1}))},onSortBy:function(n,i,r){var o,u,f;if(!n)return n;if(u=e(i.fieldName,r),!u)return n.sort(i.comparer);if(u instanceof Array){for(u=u.slice(0),f=u.length-1;f>=0;f--)u[f]&&(o=i.comparer,u[f].endsWith(" desc")&&(o=t.pvt.fnSort(t.sortOrder.Descending),u[f]=u[f].replace(" desc","")),n=it(n,u[f],o,[]));return n}return it(n,u,i.comparer,r?r.queries:[])},onGroup:function(n,i,r){var u,o,s,f,h;if(!n)return n;if(u=l(r.queries,"onAggregates"),o=[],u.length)for(f=0;f<u.length;f++)s=u[f].e,o.push({type:s.type,field:e(s.field,r)});return h=b(i.fieldName,r.queries),t.group(n,e(i.fieldName,r),o,h)},onPage:function(n,t,i){var r=e(t.pageSize,i),u=(e(t.pageIndex,i)-1)*r,f=u+r;return n?n.slice(u,f):n},onRange:function(n,t){return n?n.slice(e(t.start),e(t.end)):n},onTake:function(n,t){return n?n.slice(0,e(t.nos)):n},onSkip:function(n,t){return n?n.slice(e(t.nos)):n},onSelect:function(n,i){return n?t.select(n,e(i.fieldNames)):n},insert:function(n,t){return n.dataSource.json.push(t)},remove:function(n,i,r){var f=n.dataSource.json,u;for(typeof r=="object"&&(r=t.getObject(i,r)),u=0;u<f.length;u++)if(t.getObject(i,f[u])===r)break;return u!==f.length?f.splice(u,1):null},update:function(i,r,u){for(var e=i.dataSource.json,o=t.getObject(r,u),f=0;f<e.length;f++)if(t.getObject(r,e[f])===o)break;return f<e.length?n.extend(e[f],u):null}});t.ForeignKeyAdaptor=function(i,u){var f=(new t[u||"JsonAdaptor"]).extend({init:function(){var r,n;for(this.foreignData=[],this.key=[],this.adaptorType=u,this.value=[],this.fValue=[],this.keyField=[],r=i,n=0;n<r.length;n++)this.foreignData[n]=r[n].dataSource,this.key[n]=r[n].foreignKeyField,this.fValue[n]=t.isNullOrUndefined(r[n].field)?r[n].foreignKeyValue:r[n].field+"_"+r[n].foreignKeyValue,this.value[n]=r[n].foreignKeyValue,this.keyField[n]=r[n].field||r[n].foreignKeyField,this.initial=!0},processQuery:function(n,i){var e=n.dataSource.json,u,f,r;if(this.initial){for(u=0;u<e.length;u++)for(f=this,r=0;r<this.foreignData.length;r++)this.foreignData[r].filter(function(n){t.getObject(f.key[r],n)==t.getObject(f.keyField[r],e[u])&&(e[u][f.fValue[r]]=t.getObject(f.value[r],n))});this.initial=!1}return this.base.processQuery.apply(this,[n,i])},setValue:function(i){for(var o,f,e,u=0;u<this.foreignData.length;u++)o=this,f=i[this.fValue[u]],typeof f!="string"||isNaN(f)||(f=t.parseFloat(f)),e=n.grep(o.foreignData[u],function(n){return n[o.value[u]]==f})[0],t.isNullOrUndefined(e)&&(e=n.grep(o.foreignData[u],function(n){return n[o.key[u]]==f})[0],t.getObject(this.value[u],e)!=r&&t.createObject(o.value[u],t.getObject(this.value[u],e),i)),t.getObject(this.value[u],e)!=r&&t.createObject(this.keyField[u],t.getObject(this.key[u],e),i)},insert:function(n,t,i){return this.setValue(t),{url:n.dataSource.insertUrl||n.dataSource.crudUrl||n.dataSource.url,data:JSON.stringify({value:t,table:i,action:"insert"})}},update:function(n,i,r,u){return this.setValue(r),t.JsonAdaptor.prototype.update(n,i,r,u),{type:"POST",url:n.dataSource.updateUrl||n.dataSource.crudUrl||n.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:i,key:r[i],table:u})}}});return n.extend(this,new f),this};t.remoteSaveAdaptor=(new t.JsonAdaptor).extend({beforeSend:t.UrlAdaptor.prototype.beforeSend,insert:t.UrlAdaptor.prototype.insert,update:t.UrlAdaptor.prototype.update,remove:t.UrlAdaptor.prototype.remove,addParams:t.UrlAdaptor.prototype.addParams,batchRequest:function(n,i,r,u){for(var e,f=0;f<i.added.length;f++)t.JsonAdaptor.prototype.insert(n,i.added[f]);for(f=0;f<i.changed.length;f++)t.JsonAdaptor.prototype.update(n,r.key,i.changed[f]);for(f=0;f<i.deleted.length;f++)t.JsonAdaptor.prototype.remove(n,r.key,i.deleted[f]);return e={changed:i.changed,added:i.added,deleted:i.deleted,action:"batch",table:r.url,key:r.key},u&&this.addParams({dm:n,query:u,params:u._params,reqParams:e}),{type:"POST",url:n.dataSource.batchUrl||n.dataSource.crudUrl||n.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(e)}}});t.WebApiAdaptor=(new t.ODataAdaptor).extend({insert:function(n,t){return{type:"POST",url:n.dataSource.url,data:JSON.stringify(t)}},remove:function(n,t,i){return{type:"DELETE",url:n.dataSource.url+"/"+i,data:JSON.stringify(i)}},update:function(n,t,i){return{type:"PUT",url:n.dataSource.url,data:JSON.stringify(i)}},processResponse:function(n,i,r,u,f){var o=f&&f.ejPvtData,l,e,w;if(f&&f.type.toLowerCase()!="post"){var h=u&&u.getResponseHeader("DataServiceVersion"),a=null,y={};if(h=h&&parseInt(h,10)||2,r&&r._requiresCount&&(c(n.Count)||(a=n.Count)),h<3&&n.Items&&(n=n.Items),o&&o.aggregates&&o.aggregates.length){var s=o.aggregates,v,p={};for(e=0;e<s.length;e++)v=t.aggregates[s[e].type],v&&(p[s[e].field+" - "+s[e].type]=v(n,s[e].field));y=p}if(o&&o.groups&&o.groups.length)for(l=o.groups,e=0;e<l.length;e++)w=b(l[e],r.queries),n=t.group(n,l[e],o.aggregates,w);return c(a)?n:{result:n,count:a,aggregates:y}}}});e=function(n,t){return typeof n=="function"?n.call(t||{}):n};t.TableModel=function(i,r,u,e){var c,o,l,s;if(!p(this,t.TableModel))return new t.TableModel(r);for(p(r,Array)||f("ej.TableModel - Json Array is required"),c=[],l=h(ht,this),s=0;s<r.length;s++){o=new t.Model(r[s],this);o.state="unchanged";o.on("stateChange",l);e&&o.computes(e);c.push(o)}return this.name=i||"table1",this.rows=t.NotifierArray(c),this._deleted=[],this._events=n({}),this.dataManager=u,this._isDirty=!1,this};t.TableModel.prototype={on:function(n,t){this._events.on(n,t)},off:function(n,t){this._events.off(n,t)},setDataManager:function(n){this.dataManagar=n},saveChanges:function(){if(this.dataManager&&p(this.dataManager,t.DataManager)||f("ej.TableModel - saveChanges : Set the dataManager using setDataManager function"),this.isDirty()){var n=this.dataManager.saveChanges(this.getChanges(),this.key,this.name);n.done(h(function(n){for(var t=this.toArray(),i=0;i<t.length;i++)t.state==="added"&&t.set(this.key,n.added.filter(function(n){return n[this.key]===t.get(this.key)})[0][this.key]),t[i].markCommit();this._events.triggerHandler({type:"save",table:this})},this));n.fail(h(function(n){this.rejectChanges();this._events.triggerHandler({type:"reject",table:this,error:n})},this));this._isDirty=!1}},rejectChanges:function(){for(var t=this.toArray(),n=0;n<t.length;n++)t[n].revert(!0);this._isDirty=!1;this._events.triggerHandler({type:"reject",table:this})},insert:function(n){var i=new t.Model(n);i._isDirty=this._isDirty=!0;this.rows.push(i);this._events.triggerHandler({type:"insert",model:i,table:this})},update:function(n){var r;this.key||f("TableModel - update : Primary key should be assigned to TableModel.key");var i=n,t,u=this.key,e=i[u];t=this.rows.array.filter(function(n){return n.get(u)===e});t=t[0];for(r in i)t.set(r,i[r]);this._isDirty=!0;this._events.triggerHandler({type:"update",model:t,table:this})},remove:function(n){var t,i,e,u;for(this.key||f("TableModel - update : Primary key should be assigned to TableModel.key"),t=this.key,i=-1,n&&typeof n=="object"&&(n=n[t]!==r?n[t]:n.get(t)),u=0;u<this.rows.length();u++)if(this.rows.array[u].get(t)===n){i=u;break}i>-1&&(e=this.rows.removeAt(i),e.markDelete(),this._deleted.push({model:e,position:i}),this._isDirty=!0,this._events.triggerHandler({type:"remove",model:e,table:this}))},isDirty:function(){return this._isDirty},getChanges:function(){for(var i={added:[],changed:[]},r=this.toArray(),n=0;n<r.length;n++)i[r[n].state]&&i[r[n].state].push(r[n].json);return i.deleted=t.select(this._deleted,["model"]),i},toArray:function(){return this.rows.toArray()},setDirty:function(n,t){this._isDirty!==!!n&&(this._isDirty=!!n,this._events.triggerHandler({type:"dirty",table:this,model:t}))},get:function(n){return this.rows.array[n]},length:function(){return this.rows.array.length},bindTo:function(t){var i=nt,e=n(t.html()),f=this.toArray(),u,r;for(n.inArray(t.prop("tagName").toLowerCase(),["table","tbody"])&&(i=tt),i.insertBefore(t),t.detach().empty(),r=0;r<f.length;r++)u=e.clone(),f[r].bindTo(u),t.append(u);t.insertAfter(i);i.remove()}};nt=i?n(document.createElement("div")):{};tt=i?n(document.createElement("tr")):{};t.Model=function(i,r,u){typeof r=="string"&&(u=r,r=null);this.$id=et("m");this.json=i;this.table=r instanceof t.TableModel?r:null;this.name=u||this.table&&this.table.name;this.dataManager=r instanceof t.DataManager?r:r.dataManagar;this.actual={};this._events=n({});this.isDirty=!1;this.state="added";this._props=[];this._computeEls={};this._fields={};this._attrEls={};this._updates={};this.computed={}};t.Model.prototype={computes:function(t){n.extend(this.computed,t)},on:function(n,t){this._events.on(n,t)},off:function(n,t){this._events.off(n,t)},set:function(n,t){var i=this.json,e=n,f,u;for(n=n.split("."),u=0;u<n.length-1;u++)n=n[0],i=i[n[0]];this.isDirty=!0;this.changeState("changed",{from:"set"});f=i[n];this.actual[n]!==r||n in this.actual||(this.actual[n]=t);i[n]=t;this._updateValues(n,t);this._events.triggerHandler({type:e,current:t,previous:f,model:this})},get:function(n){return t.pvt.getObject(n,this.json)},revert:function(n){for(var t in this.actual)this.json[t]=this.actual[t];this.isDirty=!1;n?this.state="unchanged":this.changeState("unchanged",{from:"revert"})},save:function(i,r){return(i=i||this.dataManagar,r=r||i.dataSource.key,i||f("ej.Model - DataManager is required to commit the changes"),this.state==="added")?i.insert(this.json,this.name).done(t.proxy(function(t){n.extend(this.json,t.record)},this)):this.state==="changed"?i.update(r,this.json,this.name):this.state==="deleted"?i.remove(r,this.json,this.name):void 0},markCommit:function(){this.isDirty=!1;this.changeState("unchanged",{from:"commit"})},markDelete:function(){this.changeState("deleted",{from:"delete"})},changeState:function(t,i){if(this.state!==t){if(this.state==="added")if(t==="deleted")t="unchanged";else return;var r=t;i=i||{};this.state=t;this._events.triggerHandler(n.extend({type:"stateChange",current:t,previous:r,model:this},i))}},properties:function(){if(this._props.length)return this._props;for(var n in this.json)this._props.push(n),this._updates[n]={read:[],input:[]};return this._props},bindTo:function(t){var e=n(t),r,i,o=e.find("[ej-observe], [ej-computed], [ej-prop]"),s=o.length,u,f;for(e.data("ejModel",this),u={fields:[],props:[],computes:[]},f=0;f<s;f++){if(r=o.eq(f),i=r.attr("ej-prop"),i&&this._processAttrib(i,r,u),i=r.attr("ej-observe"),i&&this._props.indexOf(i)!==-1){this._processField(r,i,u);continue}if(i=r.attr("ej-computed"),i){this._processComputed(i,r,u);continue}}e.data("ejModelBinding"+this.$id,u)},unbind:function(t){var u,r={props:this._attrEls,computes:this._computeEls},f=!1,i,c,e,s,h,o;t&&(r=n(t).removeData("ejModel").data("ejModelBinding"+this.$id)||r,f=!0);for(i in this.computed)u=r.computes[i],i=this.computed[i],u&&i.deps&&(this.off(i.deps.join(" "),u.handle),f&&delete this._computeEls[i]);f||(this._computeEls={});for(i in r.props)u=r.props[i],u&&(this.off(u.deps.join(" "),u.handle),delete r.props[i],f&&delete this._attrEls[i]);if(f||(this._attrEls={}),r.fields&&r.fields.length)for(c=r.fields.length,o=0;o<c;o++)e=r.fields[o],n(e).off("change",null,this._changeHandler),h=this.formElements.indexOf(e.tagName.toLowerCase())!==-1?"input":"read",s=this._updates[h].indexOf(e),s!==-1&&this._updates[h].splice(s,1)},_processComputed:function(n,t,i){if(n){var r,u,f=st(n),e=this.formElements.indexOf(t[0].tagName.toLowerCase())!==-1?"val":"html";this.computed[n]&&this.computed[f]||(this.computed[f]={value:new Function("var e = this; return "+n),deps:this._generateDeps(n)},n=f);r=this.computed[n];r.get||(r.get=function(){r.value.call(this.json)});u=r.deps;r=r.value;this._updateDeps(u);this._updateElement(t,e,r);r={el:t,handle:h(this._computeHandle,this,{value:n,type:e})};this._computeEls[n]=r;i.computes[n]=r;this.on(u.join(" "),r.handle)}},_computeHandle:function(n){var t=this._computeEls[n.value];t&&this.computed[n.value]&&this._updateElement(t.el,n.type,this.computed[n.value].value)},_updateElement:function(t,i,r){t[i](r.call(n.extend({},this.json,this.computed)))},_updateDeps:function(n){for(var i=0;i<n.length;i++)!(n[i]in this.json)&&n[i]in this.computed&&t.merge(n,this.computed[n[i]].deps)},_generateDeps:function(n){for(var r=n.replace(/(^e\.)|( e\.)/g,"#%^*##ej.#").split("#%^*#"),t,u=[],i=0;i<r.length;i++)r[i].startsWith("#ej.#")&&(t=r[i].replace("#ej.#","").split(" ")[0],t&&this._props.indexOf(t)!==-1&&u.push(t));return u},_processAttrib:function(n,t,i){var e,o,u={},r,f;for(n=n.replace(/^ +| +$/g,"").split(";"),r=0;r<n.length;r++)(n[r]=n[r].split(":"),n[r].length<2)||(e=n[r][0].replace(/^ +| +$/g,"").replace(/^'|^"|'$|"$/g,""),u[e]=n[r][1].replace(/^ +| +$/g,"").replace(/^'|^"|'$|"$/g,""));n=u;f=[];for(e in n)f.push(n[e]);this._updateDeps(f);this._updateProps(t,n);u=et("emak");o={el:t,handle:h(this._attrHandle,this,u),value:n,deps:f};t.prop("ejmodelattrkey",u);i.props[u]=o;this._attrEls[u]=o;this.on(f.join(" "),o.handle)},_attrHandle:function(n){var t=this._attrEls[n];t&&this._updateProps(t.el,t.value)},_updateProps:function(t,i){var f=this.json,r,u=this.computed;for(var e in i)r=i[e],r in f?r=f[r]:r in u&&(r=u[r],r&&(r=r.value.call(n.extend({},this.json,u)))),c(r)||t.prop(e,r)},_updateValues:function(n,t){var i=this._updates[n];i&&(i.read||i.input)&&(this._ensureItems(i.read,"html",t),this._ensureItems(i.input,"val",t))},_ensureItems:function(t,i,r){if(t)for(var u=t.length-1;u>-1;u--){if(!t[u].offsetParent){t.splice(u,1);continue}n(t[u])[i](r)}},_changeHandler:function(t){t.data.self.set(t.data.prop,n(this).val())},_processField:function(n,t,i){var u={self:this,prop:t},r=this.get(t);if(i.fields.push(n[0]),this.formElements.indexOf(n[0].tagName.toLowerCase())===-1)return n.html(r),this._updates[t].read.push(n[0]);n.val(r).off("change",null,this._changeHandler).on("change",null,u,this._changeHandler);return this._updates[t].input.push(n[0])},formElements:["input","select","textarea"]};var ot=/[^\w]+/g,st=function(n){return n.replace(ot,"_")},ht=function(n){this.setDirty(!0,n.model)};if(t.Predicate=function(n,i,r,u){return(this instanceof t.Predicate)?(typeof n=="string"?(this.field=n,this.operator=i,this.value=r,this.ignoreCase=u,this.isComplex=!1,this._comparer=t.data.fnOperators.processOperator(this.operator)):(n instanceof t.Predicate&&r instanceof t.Predicate||r instanceof Array)&&(this.isComplex=!0,this.condition=i.toLowerCase(),this.predicates=[n],r instanceof Array?[].push.apply(this.predicates,r):this.predicates.push(r)),this):new t.Predicate(n,i,r,u)},t.Predicate.and=function(){return y._combinePredicates([].slice.call(arguments,0),"and")},t.Predicate.or=function(){return y._combinePredicates([].slice.call(arguments,0),"or")},t.Predicate.fromJSON=function(n){var i,t,r;if(p(n,Array)){for(i=[],t=0,r=n.length;t<r;t++)i.push(y._fromJSON(n[t]));return i}return y._fromJSON(n)},y={_combinePredicates:function(n,i){if(!n.length)return r;if(n.length===1){if(!p(n[0],Array))return n[0];n=n[0]}return new t.Predicate(n[0],i,n.slice(1))},_combine:function(n,i,r,u,e,o){return i instanceof t.Predicate?t.Predicate[e](n,i):typeof i=="string"?t.Predicate[e](n,new t.Predicate(i,r,u,o)):f("Predicate - "+e+" : invalid arguments")},_fromJSON:function(n){var i;if(!n||p(n,t.Predicate))return n;var u=n.predicates||[],f=u.length,r=[];for(i=0;i<f;i++)r.push(y._fromJSON(u[i]));return n.isComplex?new t.Predicate(r[0],n.condition,r.slice(1)):new t.Predicate(n.field,n.operator,t.parseJSON({val:n.value}).val,n.ignoreCase)}},t.Predicate.prototype={and:function(n,t,i,r){return y._combine(this,n,t,i,"and",r)},or:function(n,t,i,r){return y._combine(this,n,t,i,"or",r)},validate:function(n){var f=this.predicates,r,u,i;if(!this.isComplex)return this._comparer.call(this,t.pvt.getObject(this.field,n),this.value,this.ignoreCase);for(r=this.condition==="and",i=0;i<f.length;i++)if(u=f[i].validate(n),r){if(!u)return!1}else if(u)return!0;return r},toJSON:function(){var t,i,n;if(this.isComplex)for(t=[],i=this.predicates,n=0;n<i.length;n++)t.push(i[n].toJSON());return{isComplex:this.isComplex,field:this.field,operator:this.operator,value:this.value,ignoreCase:this.ignoreCase,condition:this.condition,predicates:t}}},t.dataUtil={swap:function(n,t,i){if(t!=i){var r=n[t];n[t]=n[i];n[i]=r}},mergeSort:function(n,i,r){return r&&typeof r!="string"||(r=t.pvt.fnSort(r,!0)),typeof i=="function"&&(r=i,i=null),t.pvt.mergeSort(n,i,r)},max:function(n,i,r){return typeof i=="function"&&(r=i,i=null),t.pvt.getItemFromComparer(n,i,r||t.pvt.fnDescending)},min:function(n,i,r){return typeof i=="function"&&(r=i,i=null),t.pvt.getItemFromComparer(n,i,r||t.pvt.fnAscending)},distinct:function(n,t,i){for(var f=[],r,e={},u=0;u<n.length;u++)r=v(n,t,u),r in e||(f.push(i?n[u]:r),e[r]=1);return f},sum:function(n,t){for(var u=0,i,f=typeof v(n,t,0)!="number",r=0;r<n.length;r++)i=v(n,t,r),isNaN(i)||i===null||(f&&(i=+i),u+=i);return u},avg:function(n,i){return t.sum(n,i)/n.length},select:function(n,i){for(var u=[],r=0;r<n.length;r++)u.push(t.pvt.extractFields(n[r],i));return u},group:function(i,r,u,f,e,o){var p,a,c,h,k,l,b,y,s,w;if(e=e||1,i.GROUPGUID==t.pvt.consts.GROUPGUID){for(s=0;s<i.length;s++)t.isNullOrUndefined(o)?(i[s].items=t.group(i[s].items,r,u,f,i.level+1),i[s].count=i[s].items.length):(p=-1,w=n.grep(o,function(n){return n.key==i[s].key}),p=o.indexOf(w[0]),i[s].items=t.group(i[s].items,r,u,f,i.level+1,o[p].items),i[s].count=o[p].count);return i.childLevels+=1,i}for(a={},c=[],c.GROUPGUID=t.pvt.consts.GROUPGUID,c.level=e,c.childLevels=0,c.records=i,l=0;l<i.length;l++)h=v(i,r,l),t.isNullOrUndefined(f)||(h=f(h,r)),a[h]||(a[h]={key:h,count:0,items:[],aggregates:{},field:r},c.push(a[h]),t.isNullOrUndefined(o)||(k=n.grep(o,function(n){return n.key==a[h].key}),a[h].count=k[0].count)),a[h].count=t.isNullOrUndefined(o)?a[h].count+=1:a[h].count,a[h].items.push(i[l]);if(u&&u.length)for(l=0;l<c.length;l++){for(b={},s=0;s<u.length;s++)y=t.aggregates[u[s].type],t.isNullOrUndefined(o)?y&&(b[u[s].field+" - "+u[s].type]=y(c[l].items,u[s].field)):(w=n.grep(o,function(n){return n.key==c[l].key}),y&&(b[u[s].field+" - "+u[s].type]=y(w[0].items,u[s].field)));c[l].aggregates=b}return c},parseTable:function(i,r,u){var s=i.rows,h,v=[],y=[],f,c,l,a,e,o;if(!s.length)return[];u=u||0;switch((r||"").toLowerCase()){case t.headerOption.tHead:h=i.tHead.rows[u];break;case t.headerOption.row:default:h=i.rows[u]}for(c=h.cells,f=0;f<c.length;f++)v.push(n.trim(c[f].innerHTML));for(f=u+1;f<s.length;f++){for(l={},a=s[f].cells,e=0;e<a.length;e++)o=a[e].innerHTML,l[v[e]]=typeof o=="string"&&n.isNumeric(o)?Number(o):o;y.push(l)}return y}},t.headerOption={tHead:"thead",row:"row"},t.aggregates={sum:function(n,i){return t.sum(n,i)},average:function(n,i){return t.avg(n,i)},minimum:function(n,i){return t.getObject(i,t.min(n,i))},maximum:function(n,i){return t.getObject(i,t.max(n,i))},truecount:function(n,i){var r=t.Predicate(i,"equal",!0);return t.DataManager(n).executeLocal(t.Query().where(r)).length},falsecount:function(n,i){var r=t.Predicate(i,"equal",!1);return t.DataManager(n).executeLocal(t.Query().where(r)).length},count:function(n){return n.length}},t.pvt={filterQueries:l,mergeSort:function(n,i,r){if(n.length<=1)return n;var e=parseInt(n.length/2,10),u=n.slice(0,e),f=n.slice(e);return u=t.pvt.mergeSort(u,i,r),f=t.pvt.mergeSort(f,i,r),t.pvt.merge(u,f,i,r)},getItemFromComparer:function(n,i,r){var f,e,o,u=0,s=typeof v(n,i,0)=="string";if(n.length)while(t.isNullOrUndefined(f)&&u<n.length)f=v(n,i,u),o=n[u++];for(;u<n.length;u++)(e=v(n,i,u),t.isNullOrUndefined(e))||(s&&(f=+f,e=+e),r(f,e)>0&&(f=e,o=n[u]));return o},quickSelect:function(n,i,r,u,f,e){if(r==u)return n[r];var o=t.pvt.partition(n,i,r,u,e),s=o-r+1;return s==f?n[o]:f<s?t.pvt.quickSelect(n,i,r,o-1,f,e):t.pvt.quickSelect(n,i,o+1,u,f-s,e)},extractFields:function(n,i){var u={},r;if(i.length==1)return t.pvt.getObject(i[0],n);for(r=0;r<i.length;r++)u[i[r].replace(".",t.pvt.consts.complexPropertyMerge)]=t.pvt.getObject(i[r],n);return u},partition:function(n,i,r,u,f){var e=parseInt((r+u)/2,10),s=v(n,i,e),o;for(t.swap(n,e,u),e=r,o=r;o<u;o++)f(v(n,i,o),s)&&(t.swap(n,o,e),e++);return t.swap(n,e,u),e},fnSort:function(n){return(n=n?n.toLowerCase():t.sortOrder.Ascending,n==t.sortOrder.Ascending)?t.pvt.fnAscending:t.pvt.fnDescending},fnGetComparer:function(n,i){return function(r,u){return i(t.pvt.getObject(n,r),t.pvt.getObject(n,u))}},fnAscending:function(n,t){return t===null||t===r?-1:typeof n=="string"?n.localeCompare(t):n===null||n===r?1:n-t},fnDescending:function(n,t){return t===null||t===r?1:typeof n=="string"?n.localeCompare(t)*-1:n===null||n===r?-1:t-n},merge:function(n,t,i,r){for(var u=[],f;n.length>0||t.length>0;)f=n.length>0&&t.length>0?r?r(v(n,i,0),v(t,i,0))<=0?n:t:n[0][i]<n[0][i]?n:t:n.length>0?n:t,u.push(f.shift());return u},getObject:function(n,t){var i,f,u;if(!t)return r;if(!n)return t;if(n.indexOf(".")===-1)return t[n];for(i=t,f=n.split("."),u=0;u<f.length;u++){if(i==null)break;i=i[f[u]]}return i},createObject:function(n,t,i){for(var f=n.split("."),o=i||window,e=o,u=0;u<f.length;u++)u+1==f.length?e[f[u]]=t===r?{}:t:e[f[u]]==null&&(e[f[u]]={}),e=e[f[u]];return o},getFieldList:function(n,i,u){if(u===r&&(u=""),i===r||i===null)return t.pvt.getFieldList(n,[],u);for(var f in n)typeof n[f]!="object"||n[f]instanceof Array?i.push(u+f):t.pvt.getFieldList(n[f],i,u+f+".");return i}},t.FilterOperators={lessThan:"lessthan",greaterThan:"greaterthan",lessThanOrEqual:"lessthanorequal",greaterThanOrEqual:"greaterthanorequal",equal:"equal",contains:"contains",startsWith:"startswith",endsWith:"endswith",notEqual:"notequal"},t.data={},t.data.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},t.data.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},t.data.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},t.data.fnOperators={equal:function(n,t,i){return i?s(n)==s(t):n==t},notequal:function(n,i,r){return!t.data.fnOperators.equal(n,i,r)},lessthan:function(n,t,i){return i?s(n)<s(t):n<t},greaterthan:function(n,t,i){return i?s(n)>s(t):n>t},lessthanorequal:function(n,t,i){return i?s(n)<=s(t):n<=t},greaterthanorequal:function(n,t,i){return i?s(n)>=s(t):n>=t},contains:function(n,t,i){return i?!c(n)&&!c(t)&&s(n).indexOf(s(t))!=-1:!c(n)&&!c(t)&&n.toString().indexOf(t)!=-1},notnull:function(n){return n!==null},isnull:function(n){return n===null},startswith:function(n,t,i){return i?n&&t&&s(n).startsWith(s(t)):n&&t&&n.startsWith(t)},endswith:function(n,t,i){return i?n&&t&&s(n).endsWith(s(t)):n&&t&&n.endsWith(t)},processSymbols:function(n){var r=t.data.operatorSymbols[n],i;return r&&(i=t.data.fnOperators[r],i)?i:f("Query - Process Operator : Invalid operator")},processOperator:function(n){var i=t.data.fnOperators[n];return i?i:t.data.fnOperators.processSymbols(n)}},t.NotifierArray=function(i){return p(this,t.NotifierArray)?(this.array=i,this._events=n({}),this._isDirty=!1,this):new t.NotifierArray(i)},t.NotifierArray.prototype={on:function(n,t){this._events.on(n,t)},off:function(n,t){this._events.off(n,t)},push:function(n){var t;return t=p(n,Array)?[].push.apply(this.array,n):this.array.push(n),this._raise("add",{item:n,index:this.length()-1}),t},pop:function(){var n=this.array.pop();return this._raise("remove",{item:n,index:this.length()-1}),n},addAt:function(n,t){return this.array.splice(n,0,t),this._raise("add",{item:t,index:n}),t},removeAt:function(n){var t=this.array.splice(n,1)[0];return this._raise("remove",{item:t,index:n}),t},remove:function(n){var t=this.array.indexOf(n);return t>-1&&(this.array.splice(t,1),this._raise("remove",{item:n,index:t})),t},length:function(){return this.array.length},_raise:function(t,i){this._events.triggerHandler(n.extend({type:t},i));this._events.triggerHandler({type:"all",name:t,args:i})},toArray:function(){return this.array}},n.extend(t,t.dataUtil),Array.prototype.forEach=Array.prototype.forEach||function(n,t){for(var i=0,r=this.length;i<r;++i)n.call(t,this[i],i,this)},Array.prototype.indexOf=Array.prototype.indexOf||function(n){var i=this.length,t;if(i===0)return-1;for(t=0;t<i;t++)if(t in this&&this[t]===n)return t;return-1},Array.prototype.filter=Array.prototype.filter||function(n){var i,u,t,r;if(typeof n!="function")throw new TypeError;for(i=[],u=arguments[1]||this,t=0;t<this.length;t++)r=this[t],n.call(u,r,t,this)&&i.push(r);return i},String.prototype.endsWith=String.prototype.endsWith||function(n){return this.slice(-n.length)===n},String.prototype.startsWith=String.prototype.startsWith||function(n){return this.slice(0,n.length)===n},t.support||(t.support={}),t.support.stableSort=function(){for(var t=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16].sort(function(){return 0}),n=0;n<17;n++)if(n!==t[n])return!1;return!0}(),t.support.cors=n.support.cors,!n.support.cors&&window.XDomainRequest){var ct=/^https?:\/\//i,lt=/^get|post$/i,at=new RegExp("^"+location.protocol,"i"),vt=/\/xml/i;n.ajaxTransport("text html xml json",function(n,t){if(n.crossDomain&&n.async&<.test(n.type)&&ct.test(t.url)&&at.test(t.url)){var i=null,u=(t.dataType||"").toLowerCase();return{send:function(f,e){i=new XDomainRequest;/^\d+$/.test(t.timeout)&&(i.timeout=t.timeout);i.ontimeout=function(){e(500,"timeout")};i.onload=function(){var o="Content-Length: "+i.responseText.length+"\r\nContent-Type: "+i.contentType,t={code:200,message:"success"},f={text:i.responseText},n;try{if(u==="json")try{f.json=JSON.parse(i.responseText)}catch(h){t.code=500;t.message="parseerror"}else if(u==="xml"||u!=="text"&&vt.test(i.contentType)){n=new ActiveXObject("Microsoft.XMLDOM");n.async=!1;try{n.loadXML(i.responseText)}catch(h){n=r}if(!n||!n.documentElement||n.getElementsByTagName("parsererror").length){t.code=500;t.message="parseerror";throw"Invalid XML: "+i.responseText;}f.xml=n}}catch(s){throw s;}finally{e(t.code,t.message,f,o)}};i.onerror=function(){e(500,"error",{text:i.responseText})};navigator.userAgent.indexOf("MSIE 9.0")!=-1&&(i.onprogress=function(){});i.open(n.type,n.url);i.send(t.data)},abort:function(){i&&i.abort()}}}})}n.support.cors=!0;t.sortOrder={Ascending:"ascending",Descending:"descending"};t.pvt.consts={GROUPGUID:"{271bbba0-1ee7}",complexPropertyMerge:"_"};d=function(n,t){t&&(n=h(n,t));(window.setImmediate||window.setTimeout)(n,0)};t.support.enableLocalizedSort=!1;var it=function(n,i,r,u){return t.support.stableSort?!t.support.enableLocalizedSort&&typeof t.pvt.getObject(i,n[0]||{})=="string"&&(r===t.pvt.fnAscending||r===t.pvt.fnDescending)&&u.filter(function(n){return n.fn==="onSortBy"}).length===1?yt(n,i,r===t.pvt.fnDescending):n.sort(t.pvt.fnGetComparer(i,r)):t.mergeSort(n,i,r)},b=function(i,r){for(var f=n.grep(r,function(n){return n.fn=="onGroup"}),u=0;u<f.length;u++)if(t.getObject("fieldName",f[u].e)==i)return t.getObject("fn",f[u].e)},yt=function(n,i,r){var u=Object.prototype.toString;Object.prototype.toString=i.indexOf(".")===-1?function(){return this[i]}:function(){return t.pvt.getObject(i,this)};n=n.sort();Object.prototype.toString=u;r&&n.reverse()},s=function(n){return n?n.toLowerCase?n.toLowerCase():n.toString().toLowerCase():n===0||n===!1?n.toString():""},v=function(n,i,r){return i?t.pvt.getObject(i,n[r]):n[r]},pt=function(n){return typeof HTMLElement=="object"?n instanceof HTMLElement:n&&n.nodeType===1&&typeof n=="object"&&typeof n.nodeName=="string"},p=function(n,t){return n instanceof t},rt=function(n,i,r,u){return function(f){return typeof f=="object"&&(u=f,f=null),new t.TableModel(f||n,i,r,u)}},ut=function(t){return function(i,r){var o,h,e,u,s;for(r=r||window.ko,r||f("Knockout is undefined"),h=[],s=0;s<t.length;s++){o={};for(e in t[s])e.startsWith("_")||(o[e]=r.observable(t[s][e]));for(e in i)u=i[e],n.isPlainObject(u)?(u.owner||(u.owner=o),u=r.computed(u)):u=r.computed(u,o),o[e]=u;h.push(o)}return r.observableArray(h)}},ft=0,et=function(n){return ft+=1,n+ft};t.getGuid=function(n){var i="0123456789abcdef",t;return(n||"")+"00000000-0000-4000-0000-000000000000".replace(/0/g,function(n,r){if("crypto"in window&&"getRandomValues"in crypto){var u=new Uint8Array(1);window.crypto.getRandomValues(u);t=u[0]%16|0}else t=Math.random()*16|0;return i[r===19?t&3|8:t]})};w=function(n,t){return function(){var i=[].slice.call(arguments,0);return i.push(this),n.apply(t||this,i)}};h=function(n,t,i){return"bind"in n?i?n.bind(t,i):n.bind(t):function(){var r=i?[i]:[];return r.push.apply(r,arguments),n.apply(t||this,r)}};t.merge=function(n,t){n&&t&&Array.prototype.push.apply(n,t)};c=function(n){return n===r||n===null};f=function(n){try{throw new Error(n);}catch(t){throw t.message+"\n"+t.stack;}}}(window.jQuery,window.Syncfusion,window.document),function(n,t){function k(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n}function c(t,i,r){var u=r.type;r.type=i;n.event.dispatch.call(t,r);r.type=u}function it(n,t){if(t)for(prop in t)prop in n||(n[prop]=t[prop])}function e(n){return n.originalEvent.touches?n.originalEvent.touches[0]:i?n.originalEvent:n}function d(n){var r=i?n.originalEvent.pointerType:n.originalEvent.touches?"touch":"mouse",u=i&&h==t?r==4?"mouse":"touch":r;return n.pointerType=u,n.type!="mousedown"&&n.type!="mouseup"&&it(n,n.originalEvent),n}function o(t,i,r){var o,s,h,u={},e,f;return r&&(f=r.originalEvent.touches?[r.originalEvent.touches[0],t.originalEvent.changedTouches[0]]:[r.originalEvent,t.originalEvent],i._isSwipe||i._isdrag?(o=n.event.special.pinch._getdistance(f[0],f[1]),s=i.time,e={pageX:i.stopPoint.pageX,pageY:i.stopPoint.pageY}):i._isPinch&&(o=n.event.special.pinch.distance(t),s=t.timeStamp-r.timeStamp,h=i._pinchDistance),i._isDelta&&(u._dTime=t.timeStamp-r.timeStamp,u._x=f[1].pageX-f[0].pageX,u._y=f[1].pageY-f[0].pageY)),{options:t,delta:{time:u._dTime||null,X:u._x||null,Y:u._y||null},distance:o,scale:i._isPinch?h:null,time:s,velocity:{XY:o/u._dTime||null,X:u._x/u._dTime||null,Y:u._y/u._dTime||null},currentPosition:{pageX:e?e.pageX:null,pageY:e?e.pageY:null}}}function s(){var n=new Date;return n.getTime()}function l(n){i&&n.css("-ms-touch-action","pinch-zoom").css("touch-action","pinch-zoom")}var y=n(document);n.each("touchstart touchmove touchend tap doubletap taphold swipe swipeleft swiperight pinch pinchin pinchout pinchstop scrollstart scrollstop".split(" "),function(t,i){n.fn[i]=function(n){return n?this.on(i,n):this.trigger(i)};n.attrFn&&(n.attrFn[i]=!0)});var i=k().isMSPointerEnabled,h=k().pointerEnabled,a="ontouchstart"in window,rt="scroll",p=typeof orientation=="undefined",g=navigator.userAgent.match(/iPhone|iPad|iPod/i),u=i?h?"pointerdown":"MSPointerDown":a?"touchstart":"mousedown",f=i?h?"pointerup":"MSPointerUp":g?"touchend":a?"touchend":"mouseup",r=i?h?"pointermove":"MSPointerMove":a?"touchmove":"mousemove",w=i?h?"pointercancel":"MSPointerCancel":a?"touchcancel":"mouseleave",ut=i||!p?u:g?"touchstart":"touchstart mousedown",v=i||!p?f:"touchend mouseup",b=i||!p?r:"touchmove mousemove",nt=k(),tt=nt.name=="msie"&&nt.version=="9.0"?!0:!1;n.event.special.ejtouchmove={setup:function(){function s(){}function h(n){if(!(n.which&&n.which!==1)){var f=n.target,u=n.originalEvent;i&&(t={x:u.x,y:u.y});o.on(r,l)}}function l(n){if(!(n.which&&n.which!==1)){var u=n.target,r=n.originalEvent;it(n,n.originalEvent);(!i||!t||Math.abs(t.x-r.x)>10||Math.abs(t.y-r.y)>10&&i)&&c(e,"ejtouchmove",n)}}var e=this,o=n(e),t;o.on(u,h);y.on(f,s);t={}}};n.event.special.swipeupdown={setup:function(){var s=this,i=n(s);l(i);i.on(u,function(u){function l(n){if(n.preventDefault(),s){var t=e(n);h={time:(new Date).getTime(),coords:[t.pageX,t.pageY]};Math.abs(s.coords[1]-h.coords[1])>10&&n.preventDefault()}}var a=u,c=e(u),s={time:(new Date).getTime(),coords:[c.pageX,c.pageY],origin:n(u.target)},h;i.on(r,l).one(f,function(u){if(i.off(r,l),s&&h&&h.time-s.time<1e3&&Math.abs(s.coords[1]-h.coords[1])>30&&Math.abs(s.coords[0]-h.coords[0])<75){var e={time:h.time-s.time,_isSwipe:!0,_isDelta:!0,stopPoint:h},f=o(u,e,a);s.origin.trigger(n.extend(!0,{type:"swipeupdown"},f)).trigger(n.extend(!0,{type:s.coords[1]>h.coords[1]?"swipeup":"swipedown"},f))}s=h=t})})}};n.event.special.scrollstart={isEnabled:!0,setup:function(){function u(n,r){t=r;c(i,t?"scrollstart":"scrollstop",n)}var i=this,f=n(i),t,r;f.on(rt,function(i){n.event.special.scrollstart.isEnabled&&(t||u(i,!0),clearTimeout(r),r=setTimeout(function(){u(i,!1)},250))})}};n.event.special.tap={doubleTapThreshold:500,tapholdThreshold:650,canDoubleTap:function(t){return s()-t.doubleTapStartTime<=n.event.special.tap.doubleTapThreshold},setup:function(){var u=this,i=n(u),t=i.data(),r;l(i);t.isDoubleTapWait=!1;t.stopProcess=!1;t.preTouchend=null;t.preTouchstart=null;i.on(ut,function(f){function e(){clearTimeout(l);i.off(v,o);tt&&y.off(v,o);i.off(w,e);i.off(b,a);i.off("dragstart",it)}function a(n){var t=n.originalEvent.changedTouches?n.originalEvent.changedTouches[0]:n.originalEvent,r=f.originalEvent.changedTouches?f.originalEvent.changedTouches[0]:f.originalEvent;t.pageX==r.pageX&&t.pageY==r.pageY||(n.type=="mousemove"||n.type=="pointermove"&&n.originalEvent.pointerType=="mouse"||n.type=="MSPointerMove"&&n.originalEvent.pointerType==4?(clearTimeout(l),i.off(w,e),i.off(b,a)):e())}function o(i){var o,h;i.type=="touchend"&&(t.preTouchend=s());e();r!=i.target&&(i.type=="mouseup"||f.type=="pointerup"||"MSPointerUp")&&(o=i.target,jQuery.contains(r,o)?nt(i,r):jQuery.contains(o,r)||(h=n(r).parents().has(n(o)).first()[0],ej.isNullOrUndefined(h)||nt(i,h)));g===i.currentTarget&&(c(u,"tap",n.extend(d(i),{time:s()-t.startTime})),t.isDoubleTapWait&&n.event.special.tap.canDoubleTap(t)?(t.isDoubleTapWait=!1,c(u,"doubletap",n.extend(d(i),{time:s()-t.doubleTapStartTime}))):(t.isDoubleTapWait&&(t.isDoubleTapWait=!1,t.doubleTapStartTime=t.startTime),n.event.special.tap.canDoubleTap(t)&&(t.isDoubleTapWait=!0)))}function nt(n,t){n.target=t;n.toElement=t}function it(){e()}var g,h,l,p,k;if((f.type=="mousedown"||f.type=="pointerdown"||"MSPointerDown")&&(r=f.target),t=i.data(),t.startTime=s(),t.isDoubleTapWait||(t.doubleTapStartTime=t.startTime),f.type=="touchstart"&&(t.preTouchstart=t.startTime),t.stopProcess=f.type=="mousedown"&&(t.startTime-t.preTouchend<300||t.startTime-t.preTouchstart<30)?!0:!1,g=f.currentTarget,h=f.originalEvent,f.which&&f.which!==1||t.stopProcess)t.stopProcess&&(t.stopProcess=!1);else{i.on(v,o);if(tt)y.on(v,o);i.on(w,e);i.on(b,a);i.on("dragstart",it);p={};for(k in h)p[k]=h[k];l=setTimeout(function(){t.isDoubleTapWait&&(t.isDoubleTapWait=!1);c(u,"taphold",n.extend(d(f),{options:p,time:s()-t.startTime}))},n.event.special.tap.tapholdThreshold)}})}};n.event.special.swipe={scrollSupression:10,duration:1e3,horizontalDistance:30,verticalDistance:75,pointers:window.navigator.msPointerEnabled,startPoint:function(t){var i=e(t);return{time:(new Date).getTime(),coords:[i.pageX,i.pageY],origin:n(t.target)}},stopPoint:function(n){var t=e(n);return{time:(new Date).getTime(),coords:[t.pageX,t.pageY]}},handleSwipe:function(t,i,r,u){if(i.time-t.time<n.event.special.swipe.duration&&Math.abs(t.coords[0]-i.coords[0])>n.event.special.swipe.horizontalDistance&&Math.abs(t.coords[1]-i.coords[1])<n.event.special.swipe.verticalDistance){var e={time:i.time-t.time,_isSwipe:!0,_isDelta:!0,stopPoint:i},f=o(r,e,u);t.origin.trigger(n.extend(!0,{type:"swipe"},f)).trigger(n.extend(!0,{type:t.coords[0]>i.coords[0]?"swipeleft":"swiperight"},f))}},setup:function(){var e=this,i=n(e);l(i);i.on(u,function(u){function s(t){e&&(o=n.event.special.swipe.stopPoint(t),Math.abs(e.coords[0]-o.coords[0])>n.event.special.swipe.scrollSupression&&t.preventDefault())}var e=n.event.special.swipe.startPoint(u),o,h=u;n(u.target).data("_dataTouchStart",{event:u,_now:(new Date).getTime()});i.on(r,s).one(f,function(u){i.off(r,s);e&&o&&n.event.special.swipe.handleSwipe(e,o,u,h);e=o=t})})}};n.event.special.pinch={distance:function(t){return t.originalEvent.touches.length<2?null:n.event.special.pinch._getdistance(t.originalEvent.touches[0],t.originalEvent.touches[1])},_getdistance:function(n,t){return Math.sqrt((n.pageX-t.pageX)*(n.pageX-t.pageX)+(n.pageY-t.pageY)*(n.pageY-t.pageY))},setup:function(){var e=this,i=n(e);l(i);i.on(u,function(u){var h=u;if(u.originalEvent.touches&&u.originalEvent.touches.length>=2){var s=n.event.special.pinch.distance(u),e,v=5,c=s,l,y=o(u,{_isPinch:!0,_pinchDistance:c},h);n(u.target).trigger(n.extend(!0,{type:"pinch"},y));function a(t){l=t;e=n.event.special.pinch.distance(t)||null;s&&e&&Math.abs(s-e)>v&&(n(t.target).trigger(n.extend(!0,{type:s>e?"pinchin":"pinchout"},o(t,{_isPinch:!0,_pinchDistance:c},h))),s=e)}i.on(r,a).one(f,function(){i.off(r,a);n(u.target).trigger(n.extend(!0,{type:"pinchstop"},o(l,{_isPinch:!0,_pinchDistance:e},h)));s=e=t})}})}};n.event.special.touchdrag={setup:function(){var s=this,i=n(s);l(i);i.on(u,function(u){function c(t){h&&(s=e(t),n.event.special.pinch._getdistance(h,s)>5&&n(t.target).trigger(n.extend(!0,{type:"touchdrag"},o(t,{_isdrag:!0,stopPoint:s,_isDelta:!0},l))))}var h=e(u),s,l=u;n(u.target).data("_dataTouchStart",{event:u,_now:(new Date).getTime()});i.on(r,c).one(f,function(){i.off(r,c);h=s=t})})}};n.each({scrollstop:"scrollstart",doubletap:"tap",taphold:"tap",swipeleft:"swipe",swiperight:"swipe",swipedown:"swipeupdown",swipeup:"swipeupdown",pinchin:"pinch",pinchout:"pinch",pinchstop:"pinch"},function(t,i){n.event.special[t]={setup:function(){n(this).on(i,n.noop)}}})}(jQuery),function(n,t){t.widget("ejDraggable","ej.Draggable",{element:null,model:null,validTags:["div","span","a"],defaults:{scope:"default",handle:null,dragArea:null,clone:!1,distance:1,dragOnTaphold:!1,cursorAt:{top:-1,left:-2},dragStart:null,drag:null,dragStop:null,create:null,destroy:null,helper:function(){return n('<div class="e-drag-helper" />').html("draggable").appendTo(document.body)}},_init:function(){this.handler=function(){};this.resizables={};helpers={};this._wireEvents();this._browser=t.browserInfo();this._isIE8=this._browser.name=="msie"&&this._browser.version=="8.0";this._isIE9=this._browser.name=="msie"&&this._browser.version=="9.0";this._browser.name=="msie"&&this.element.addClass("e-pinch")},_setModel:function(n){for(var t in n)switch(t){case"dragArea":this.model.dragArea=n[t];break;case"dragOnTaphold":this.model.dragOnTaphold=n[t]}},_destroy:function(){n(document).off(t.eventType.mouseUp,this._destroyHandler).off(t.eventType.mouseUp,this._dragStopHandler).off(t.eventType.mouseMove,this._dragStartHandler).off(t.eventType.mouseMove,this._dragHandler).off("mouseleave",this._dragMouseOutHandler).off("selectstart",!1);t.widgetBase.droppables[this.scope]=null},_initialize:function(i){var r,u;if(i.target&&i.target.nodeName&&n(i.target).closest("input[type='text'], textarea, select, option").length)return!0;r=i;i.preventDefault();i=this._getCoordinate(i);this.target=n(r.currentTarget);this._initPosition={x:i.pageX,y:i.pageY};n(document).on(t.eventType.mouseMove,this._dragStartHandler).on(t.eventType.mouseUp,this._destroyHandler);this.model.clone||(u=this.element.offset(),this._relXposition=i.pageX-u.left,this._relYposition=i.pageY-u.top);n(document.documentElement).trigger(t.eventType.mouseDown,r)},_setDragArea:function(){var o=n(this.model.dragArea)[0],s,h,u,r,f,e,i;if(o){if(r=["left","right","bottom","top"],t.isNullOrUndefined(o.getBoundingClientRect)){for(s=n(this.model.dragArea).outerWidth(),h=n(this.model.dragArea).outerHeight(),i=0;i<r.length;i++)this["border-"+r[i]+"-width"]=0,this["padding-"+r[i]]=0;f=e=0}else{for(u=o.getBoundingClientRect(),s=u.width?u.width:u.right-u.left,h=u.height?u.height:u.bottom-u.top,i=0;i<r.length;i++)this["border-"+r[i]+"-width"]=isNaN(parseFloat(n(n(this.model.dragArea)[0]).css("border-"+r[i]+"-width")))?0:parseFloat(n(n(this.model.dragArea)[0]).css("border-"+r[i]+"-width")),this["padding-"+r[i]]=isNaN(parseFloat(n(n(this.model.dragArea)[0]).css("padding-"+r[i])))?0:parseFloat(n(n(this.model.dragArea)[0]).css("padding-"+r[i]));f=n(this.model.dragArea).offset().top;e=n(this.model.dragArea).offset().left}this._left=t.isNullOrUndefined(n(this.model.dragArea).offset())?0+this["border-left-width"]+this["padding-left"]:e+this["border-left-width"]+this["padding-left"];this._top=t.isNullOrUndefined(n(this.model.dragArea).offset())?0+this["border-top-width"]+this["padding-top"]:f+this["border-top-width"]+this["padding-top"];this._right=e+s-[this["border-right-width"]+this["padding-right"]];this._bottom=f+h-[this["border-bottom-width"]+this["padding-bottom"]]}},_dragStart:function(i){var r=i,f,e,u,o,s;i=this._getCoordinate(i);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};this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.position=this._getMousePosition(r);var h=this._initPosition.x-i.pageX,c=this._initPosition.y-i.pageY,l=Math.sqrt(h*h+c*c);if(l>=this.model.distance){if(f=this.model.helper({sender:r,element:this.target}),!f||t.isNullOrUndefined(f))return;if(e=this.model.handle=this.helper=f,this.model.dragStart&&(u=null,r.type=="touchmove"?(o=r.originalEvent.changedTouches[0],u=document.elementFromPoint(o.clientX,o.clientY)):u=r.originalEvent.target||r.target,this.model.cursorAt.top==0&&this.model.cursorAt.left==0&&(u=this._checkTargetElement(i)||u),this._trigger("dragStart",{event:r,element:this.element,target:u})))return this._destroy(),!1;this.model.dragArea?this._setDragArea():(this._left=this._top=this._right=this._bottom=0,this["border-top-width"]=this["border-left-width"]=0);s=e.offsetParent().offset();n(document).off(t.eventType.mouseMove,this._dragStartHandler).off(t.eventType.mouseUp,this._destroyHandler).on(t.eventType.mouseMove,this._dragHandler).on(t.eventType.mouseUp,this._dragStopHandler).on("mouseleave",this._dragMouseOutHandler).on("selectstart",!1);t.widgetBase.droppables[this.model.scope]={draggable:this.element,helper:e.css({position:"absolute",left:this.position.left-s.left,top:this.position.top-s.top}),destroy:this._destroyHandler}}},_drag:function(i){var u,f,h,c,o,l,s,r,e;i.preventDefault();this.position=this._getMousePosition(i);this.position.top<0&&(this.position.top=0);n(document).height()<this.position.top&&(this.position.top=n(document).height());n(document).width()<this.position.left&&(this.position.left=n(document).width());r=t.widgetBase.droppables[this.model.scope].helper;this.model.drag&&(o=null,i.type=="touchmove"?(l=i.originalEvent.changedTouches[0],o=document.elementFromPoint(l.clientX,l.clientY)):o=i.originalEvent.target||i.target,this.model.cursorAt.top==0&&this.model.cursorAt.left==0&&(o=this._checkTargetElement(i)||o),this._trigger("drag",{event:i,element:this.target,target:o}));s=this._checkTargetElement(i);t.isNullOrUndefined(s)?this._hoverTarget&&(i.target=i.toElement=this._hoverTarget,this._hoverTarget.object._out(i),this._hoverTarget=null):(i.target=i.toElement=s,s.object._over(i),this._hoverTarget=s);r=t.widgetBase.droppables[this.model.scope].helper;e=r.offsetParent().offset();h=t.isNullOrUndefined(i.pageX)?i.originalEvent.changedTouches[0].pageX:i.pageX;c=t.isNullOrUndefined(i.pageY)?i.originalEvent.changedTouches[0].pageY:i.pageY;this.model.dragArea?(this._pageX!=h&&(u=this._left>this.position.left?this._left:this._right<this.position.left+r.outerWidth(!0)?this._right-r.outerWidth(!0):this.position.left),this._pageY!=c&&(f=this._top>this.position.top?this._top:this._bottom<this.position.top+r.outerHeight(!0)?this._bottom-r.outerHeight(!0):this.position.top)):(u=this.position.left,f=this.position.top);(f<0||f-[e.top+this["border-top-width"]]<0)&&(f=[e.top+this["border-top-width"]]);(u<0||u-[e.left+this["border-left-width"]]<0)&&(u=[e.left+this["border-left-width"]]);r.css({left:u-[e.left+this["border-left-width"]],top:f-[e.top+this["border-top-width"]]});this.position.left=u;this.position.top=f;this._pageX=h;this._pageY=c},_dragStop:function(n){var t,i;(n.type=="mouseup"||n.type=="touchend")&&this._destroy(n);this.model.dragStop&&(t=null,n.type=="touchend"?(i=n.originalEvent.changedTouches[0],t=document.elementFromPoint(i.clientX,i.clientY)):t=n.originalEvent.target||n.target,this.model.cursorAt.top==0&&this.model.cursorAt.left==0&&(t=this._checkTargetElement(n)||t),this._trigger("dragStop",{event:n,element:this.target,target:t}));this._dragEnd(n)},_dragEnd:function(n){var i=this._checkTargetElement(n);t.isNullOrUndefined(i)||(n.target=n.toElement=i,i.object._drop(n,this.element))},_dragMouseEnter:function(t){n(document).off("mouseenter",this._dragMouseEnterHandler);this._isIE9?this._dragManualStop(t):this._isIE8?t.button==0&&this._dragManualStop(t):t.buttons==0&&this._dragManualStop(t)},_dragManualStop:function(n){this.model.dragStop!=null&&this._trigger("dragStop",{event:n,element:this.target,target:n.originalEvent.target||n.target});this._destroy(n)},_dragMouseOut:function(){n(document).on("mouseenter",this._dragMouseEnterHandler)},_checkTargetElement:function(n){var t,i;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"?(i=n.originalEvent.changedTouches[0],t=document.elementFromPoint(i.clientX,i.clientY)):t=n.target,this.helper&&this._contains(this.helper[0],t))?(this.helper.hide(),t=this._elementUnderCursor(n),this.helper.show(),this._withDropElement(t)):this._withDropElement(t)},_withDropElement:function(i){if(i&&(dropObj=n(i).data("ejDroppable"),t.isNullOrUndefined(dropObj)&&(dropObj=this._checkParentElement(n(i))),!t.isNullOrUndefined(dropObj)))return n.extend(i,{object:dropObj})},_checkParentElement:function(i){var r=n(i).closest(".e-droppable");if(r.length>0&&(dropObj=n(r).data("ejDroppable"),!t.isNullOrUndefined(dropObj)))return dropObj},_elementUnderCursor:function(n){return n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"?document.elementFromPoint(n.originalEvent.changedTouches[0].clientX,n.originalEvent.changedTouches[0].clientY):document.elementFromPoint(n.clientX,n.clientY)},_contains:function(t,i){try{return n.contains(t,i)||t==i}catch(r){return!1}},_wireEvents:function(){t.isDevice()==!0&&this.model.dragOnTaphold==!0?this._on(this.element,"taphold",this._initialize):this._on(this.element,t.eventType.mouseDown,this._initialize);this._dragStartHandler=n.proxy(this._dragStart,this);this._destroyHandler=n.proxy(this._destroy,this);this._dragStopHandler=n.proxy(this._dragStop,this);this._dragHandler=n.proxy(this._drag,this);this._dragMouseEnterHandler=n.proxy(this._dragMouseEnter,this);this._dragMouseOutHandler=n.proxy(this._dragMouseOut,this)},_getMousePosition:function(n){n=this._getCoordinate(n);var t=this.model.clone?n.pageX:n.pageX-this._relXposition,i=this.model.clone?n.pageY:n.pageY-this._relYposition;return{left:t-[this.margins.left+this.model.cursorAt.left],top:i-[this.margins.top+this.model.cursorAt.top]}},_getCoordinate:function(n){var i=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"&&t.browserInfo().name!="msie")&&(i=n.originalEvent.changedTouches[0]),i}})}(jQuery,Syncfusion),function(n,t){t.widget("ejDroppable","ej.Droppable",{element:null,model:null,validTags:["div","span","a"],dropElements:[],defaults:{accept:null,scope:"default",drop:null,over:null,out:null,create:null,destroy:null},_init:function(){this._mouseOver=!1;this.dropElements.push(this)},_setModel:function(){},_destroy:function(){n(this.element).off("mouseup",n.proxy(this._drop,this))},_over:function(n){this._mouseOver||(this._trigger("over",n),this._mouseOver=!0)},_out:function(n){this._mouseOver&&(this._trigger("out",n),this._mouseOver=!1)},_drop:function(t,i){var u=t.target,f,e,r;for(t.type=="touchend"&&(f=t.originalEvent.changedTouches[0],u=document.elementFromPoint(f.clientX,f.clientY)),e=n(u).parents(".e-droppable"),n(u).hasClass("e-droppable")&&e.push(u),r=0;r<this.dropElements.length;r++)n(e).is(n(this.dropElements[r].element))&&this.dropElements[r]._dropEvent.call(this.dropElements[r],t,i)},_dropEvent:function(i,r){var u=t.widgetBase.droppables[this.model.scope],f=!t.isNullOrUndefined(u.helper)&&u.helper.is(":visible"),e;f&&i.type=="touchend"&&n(u.helper).hide();e=this._isDropArea(i);f&&i.type=="touchend"&&n(u.helper).show();u&&!t.isNullOrUndefined(this.model.drop)&&f&&e.canDrop&&this.model.drop(n.extend(i,{dropTarget:e.target,dragElement:r},!0),u)},_isDropArea:function(t){var i={canDrop:!0,target:n(t.target)},e,r,o,u,f;if(t.type=="touchend")for(e=t.originalEvent.changedTouches[0],r=document.elementFromPoint(e.clientX,e.clientY),i.canDrop=!1,o=n(r).parents(),u=0;u<this.element.length;u++){if(n(r).is(n(this.element[u])))i={canDrop:!0,target:n(r)};else for(f=0;f<o.length;f++)if(n(this.element[u]).is(n(o[f]))){i={canDrop:!0,target:n(r)};break}if(i.canDrop)break}return i}})}(jQuery,Syncfusion),function(n,t){t.widget("ejResizable","ej.resizable",{element:null,model:null,validTags:["div","span","a"],defaults:{scope:"default",handle:null,distance:1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,cursorAt:{top:1,left:1},resizeStart:null,resize:null,resizeStop:null,create:null,destroy:null,helper:function(){return n('<div class="e-resize-helper" />').html("resizable").appendTo(document.body)}},_init:function(){if(this.target=this.element,this._browser=t.browserInfo(),this._isIE8=this._browser.name=="msie"&&this._browser.version=="8.0",this._isIE9=this._browser.name=="msie"&&this._browser.version=="9.0",this.handle!=null)n(this.target).delegate(this.handle,t.eventType.mouseDown,n.proxy(this._mousedown,this)).delegate(this.handle,"resizestart",this._blockDefaultActions);else n(this.target).on("mousedown",n.proxy(this._mousedown,this));this._resizeStartHandler=n.proxy(this._resizeStart,this);this._destroyHandler=n.proxy(this._destroy,this);this._resizeStopHandler=n.proxy(this._resizeStop,this);this._resizeHandler=n.proxy(this._resize,this);this._resizeMouseEnterHandler=n.proxy(this._resizeMouseEnter,this)},_mouseover:function(i){if(n(i.target).hasClass("e-resizable")){n(i.target).css({cursor:"se-resize"});n(this.target).on(t.eventType.mouseDown,n.proxy(this._mousedown,this))}else n(this.target).off(t.eventType.mouseDown),n(this.target).css({cursor:""})},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_setModel:function(){},_mousedown:function(i){var r=i;i=this._getCoordinate(i);this.target=n(r.currentTarget);this._initPosition={x:i.pageX,y:i.pageY};this._pageX=i.pageX;this._pageY=i.pageY;n(document).on(t.eventType.mouseMove,this._resizeStartHandler).on(t.eventType.mouseUp,this._destroyHandler);return n(document.documentElement).trigger(t.eventType.mouseDown,r),!1},_resizeStart:function(i){var r,h;if(n(i.target).hasClass("e-resizable")){i=this._getCoordinate(i);var u=this._initPosition.x-i.pageX,f=this._initPosition.y-i.pageY,e,o,s=Math.sqrt(u*u+f*f);if(s>=this.model.distance){if(this.model.resizeStart!=null&&this._trigger("resizeStart",{event:i,element:this.target}))return;r=this.model.helper({element:this.target});e=i.pageX-this._pageX+r.outerWidth();o=i.pageY-this._pageY+r.outerHeight();this._pageX=i.pageX;this._pageY=i.pageY;h=this.getElementPosition(r);n(document).off(t.eventType.mouseMove,this._resizeStartHandler).off(t.eventType.mouseUp,this._destroyHandler).on(t.eventType.mouseMove,this._resizeHandler).on(t.eventType.mouseUp,this._resizeStopHandler).on("mouseenter",this._resizeMouseEnterHandler).on("selectstart",!1);t.widgetBase.resizables[this.scope]={resizable:this.target,helper:r.css({width:e,height:o}),destroy:this._destroyHandler}}}},_resize:function(n){var i,r,u,e,f;n=this._getCoordinate(n);e=this.getElementPosition(t.widgetBase.resizables[this.scope].helper);f=this.model.helper({element:this.target});i=n.pageX-this._pageX+f.outerWidth();r=n.pageY-this._pageY+f.outerHeight();this._pageX=n.pageX;this._pageY=n.pageY;i<this.model.minWidth&&(u=this.model.minWidth-i,i=this.model.minWidth,this._pageX=n.pageX+u);r<this.model.minHeight&&(u=this.model.minHeight-r,r=this.model.minHeight,this._pageY=n.pageY+u);this.model.maxHeight!=null&&r>this.model.maxHeight&&(u=r-this.model.maxHeight,r=this.model.maxHeight,this._pageY=n.pageY-u);this.model.maxWidth!=null&&i>this.model.maxWidth&&(u=i-this.model.maxWidth,i=this.model.maxWidth,this._pageX=n.pageX-u);t.widgetBase.resizables[this.scope].helper.css({width:i,height:r});this._trigger("resize",{element:this.target})},_resizeStop:function(n){this.model.resizeStop!=null&&this._trigger("resizeStop",{element:this.target});(n.type=="mouseup"||n.type=="touchend")&&this._destroy(n)},_resizeMouseEnter:function(n){this._isIE9?this._resizeManualStop(n):this._isIE8?n.button==0&&this._resizeManualStop(n):n.buttons==0&&this._resizeManualStop(n)},_resizeManualStop:function(n){this.model.resizeStop!=null&&this._trigger("resizeStop",{element:this.target});this._destroy(n)},_destroy:function(){n(document).off(t.eventType.mouseUp,this._destroyHandler).off(t.eventType.mouseUp,this._resizeStopHandler).off(t.eventType.mouseMove,this._resizeStartHandler).off(t.eventType.mouseMove,this._resizeHandler).off("mouseenter",this._resizeMouseEnterHandler).off("selectstart",!1);t.widgetBase.resizables[this.scope]=null},getElementPosition:function(n){return n!=null&&n.length>0?{left:n[0].offsetLeft,top:n[0].offsetTop}:null},_getCoordinate:function(n){var t=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend")&&(t=n.originalEvent.changedTouches[0]),t}})}(jQuery,Syncfusion),function(n,t,i,r){"use strict";t.widget("ejScrollBar","ej.ScrollBar",{defaults:{orientation:"horizontal",viewportSize:0,height:18,width:18,smallChange:57,largeChange:57,value:0,maximum:0,minimum:0,buttonSize:18,infiniteScrolling:!1},validTags:["div"],type:"transclude",dataTypes:{buttonSize:"number",smallChange:"number",largeChange:"number"},observables:["value"],value:t.util.valueFunction("value"),_enabled:!0,content:function(){return this._content&&this._content.length||(this._content=this.model.orientation==="horizontal"?this.element.find(".e-hhandle"):this.element.find(".e-vhandle")),this._content},_init:function(){this.element.addClass("e-widget");this._ensureScrollers();this.content();this._setInitialValues()},_setInitialValues:function(){var n="X";this.model.orientation===t.ScrollBar.Orientation.Horizontal?this.element.addClass("e-hscrollbar"):(this.element.addClass("e-vscrollbar"),n="Y");(this.value()!==0||this.model.minimum!==0)&&(this.value()<this.model.minimum&&this.value(this.model.minimum),this.scroll(this.value(),"none"))},_ensureScrollers:function(){var t=n.fn.jquery;this.model.height&&this.element.height(this.model.height);this.model.width&&this.element.width(this.model.width);this._scrollData||(this._scrollData=this.model.orientation==="vertical"?this._createScroller("Height","Y","Top","e-v"):this._createScroller("Width","X","Left","e-h"))},_setModel:function(n){for(var t in n)if(t==="value")this.value()&&this.scroll(this.value(),"none");else{this.refresh();break}},_createScroller:function(t,i,r,u){var f={},o=n.fn.jquery,e;return f.dimension=t,f.xy=i,f.position=r,f.css=u,f.uDimension=t,this._calculateLayout(f),this._createLayout(f),e=this[f.main].find(".e-button"),this._off(e,"mousedown")._on(e,"mousedown",{d:f,step:1},this._spaceMouseDown),this._off(this[f.scroll],"mousedown")._on(this[f.scroll],"mousedown",{d:f},this._spaceMouseDown),this._off(this[f.handler],"mousedown touchstart")._on(this[f.handler],"mousedown touchstart",{d:f},this._mouseDown),f},_createLayout:function(i){var r="<div class='"+i.css+"{0}' style='"+i.dimension+":{1}px'>{2}<\/div>",u=n.fn.jquery,f={},o,e;f[i.dimension]=i.modelDim;e=t.buildTag("div."+i.css+"scroll e-box",String.format(r,"up e-chevron-up_01 e-icon e-box e-button",i.buttonSize)+String.format(r,"handlespace",i.handleSpace,String.format(r,"handle e-box e-pinch",i.handle))+String.format(r,"down e-chevron-down_01 e-icon e-box e-button",i.buttonSize),f);this.element.append(e);this.element.find(".e-vhandle").addClass("e-v-line e-icon");this.element.find(".e-hhandle").addClass("e-h-line e-icon");o=u==="1.7.1"||u==="1.7.2"?i.uDimension.toLowerCase():"outer"+i.uDimension;this[i.handler]=this.element.find("."+i.handler);this[i.handler].css("transition","none");this[i.scroll]=this[i.handler].parent();this[i.main]=this[i.scroll].parent();this[i.main].find(".e-button")["outer"+i.uDimension](i.buttonSize)},_calculateLayout:function(n){var i,u;n.scrollDim="scroll"+n.dimension;n.lPosition=n.position.toLowerCase();n.clientXy="page"+n.xy;n.scrollVal="scroll"+n.position;n.scrollOneStepBy=this.model.smallChange;n.modelDim=this.model[n.dimension=n.dimension.toLowerCase()];n.handler=n.css+"handle";n.buttonSize=this.model.buttonSize;n.main=n.css+"scroll";n.scroll=n.css+"ScrollSpace";n.handleSpace=n.modelDim-2*n.buttonSize;n.scrollable=this.model.maximum-this.model.minimum;i=this.model.height;this.model.orientation==="horizontal"&&(i=this.model.width);n.handle=this.model.viewportSize/(this.model.maximum-this.model.minimum+this.model.viewportSize)*(i-2*this.model.buttonSize);u=!t.isNullOrUndefined(this.model.elementHeight)&&typeof this.model.elementHeight=="string"&&this.model.elementHeight.indexOf("%")!=-1?!0:!1;n.handle<20&&!u&&(n.handle=20);n.onePx=n.scrollable/(n.handleSpace-n.handle);n.fromScroller=!1;n.up=!0;n.vInterval=r},_updateLayout:function(n){this.element.height(this.model.height);this.element.width(this.model.width);var t=this.element.find("."+n.css+"handle"),f=this.element.find("."+n.css+"handlespace"),u=n.dimension=="width"?t.css("left"):t.css("top"),i=n.dimension=="width"?f.outerWidth():f.outerHeight();u!==r&&u!=="auto"&&(i>=n.handle+parseFloat(u)||(this.model.enableRTL?t.css(n.dimension==="width"?"left":"top",parseFloat(i)-n.handle):t.css(n.dimension==="width"?"left":"top",parseFloat(i)-n.handle>0?parseFloat(i)-n.handle:0)));this.element.find("."+n.css+"scroll").css(n.dimension,n.modelDim+"px").find(".e-button").css(n.dimension,this.model.buttonSize).end().find("."+n.css+"handlespace").css(n.dimension,n.handleSpace+"px").find("."+n.css+"handle").css(n.dimension,n.handle+"px")},refresh:function(){this._ensureScrollers();this.value()&&this.scroll(this.value(),"none");this._scrollData&&(this._calculateLayout(this._scrollData),this._updateLayout(this._scrollData))},scroll:function(n,i,r,u){var o=this._scrollData,f,e;if(!r)if(this.model.orientation===t.ScrollBar.Orientation.Horizontal){if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollLeft:n,originalEvent:u}))return}else if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollTop:n,originalEvent:u}))return;this._scrollData&&(this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name!="msie"?this.value(-o.scrollable+n):this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name=="msie"?this.value(-1*n):this.value(n),this.content().length>0&&(this.model.orientation===t.ScrollBar.Orientation.Horizontal?(f=this.element.find(".e-hhandlespace").width()-this.element.find(".e-hhandle").outerWidth(),n=f<(n-this.model.minimum)/this._scrollData.onePx?f:(n-this.model.minimum)/this._scrollData.onePx,this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name!="msie"&&(n=f-n,n>0?n=n*-1:n),this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name=="msie"&&(n=-n),this._scrollData.enableRTL&&n>0&&!this._scrollData._scrollleftflag?n=0:n,this._scrollData._scrollleftflag&&(n>0?n=n*-1:n,this.value(n)),this.content()[0].style.left=n+"px",this._scrollData._scrollleftflag=!1):(e=this.element.find(".e-vhandlespace").height()-this.element.find(".e-vhandle").outerHeight(),n=e<(n-this.model.minimum)/this._scrollData.onePx?e:(n-this.model.minimum)/this._scrollData.onePx,this.content()[0].style.top=n+"px")))},_changeTop:function(n,t,i){var u,r;return u=n.dimension==="height"?this.value():this.value(),r=u+t,n.step=t,n.enableRTL&&t<0||t>0&&!n.enableRTL?n.enableRTL?r<this.model.maximum*-1&&(r=this.model.maximum*-1):r>this.model.maximum&&(r=this.model.maximum):n.enableRTL?r>this.model.minimum&&(r=this.model.minimum):r<this.model.minimum&&(r=this.model.minimum),(r!==u||this.model.infiniteScrolling)&&this.scroll(r,i),r!==u},_mouseUp:function(i){if(i.data){var r=i.data.d;clearInterval(r.vInterval);i.type=="touchend"&&n(i.target).removeClass("e-touch");i.type!=="mouseup"&&i.type!=="touchend"&&(i.toElement||i.relatedTarget||i.target)||(this._prevY=this._d=this._data=null,this._off(n(document),"mousemove touchmove",this._mouseMove),n(document).off("mouseup touchend",t.proxy(this._mouseUp,this)),r.fromScroller=!1,this[r.scroll].off("mousemove"),this[r.handler].off("mousemove").css("transition",""),i.data.source!=="thumb"||t.isNullOrUndefined(this.model)||n.when(this.content()).done(t.proxy(function(){this._trigger("thumbEnd",{originalEvent:i,scrollData:r})},this)));r.up=!0}},_mouseDown:function(i){if(this._enabled){this._d=i;this._data=this._d.data.d;this._data.target=this._d.target;this._data.fromScroller=!0;this[this._data.handler].css("transition","none");this._on(n(document),"mousemove touchmove",{d:this._data,source:"thumb"},this._mouseMove);this._trigger("thumbStart",{originalEvent:this._d,scrollData:this._data});n(document).one("mouseup touchend",{d:this._data,source:"thumb"},t.proxy(this._mouseUp,this));i.type=="touchstart"&&n(i.target).addClass("e-touch")}},_mouseCall:function(n){n.type="mouseup";this._mouseUp(n)},_mouseMove:function(i){var u,f=0,r=parseInt(this[this._data.handler].css(this._data.lPosition))||0,o,e;if(i.preventDefault(),o=1,t.isNullOrUndefined(i.target.tagName)){if(n(i.target).is(document)){this._mouseCall(i);return}}else if(i.target.tagName.toLowerCase()==="iframe"){this._mouseCall(i);return}e=i.type=="mousemove"?i[this._data.clientXy]:i.originalEvent.changedTouches[0][this._data.clientXy];this._prevY&&e!==this._prevY&&(f=e-this._prevY,this.model.infiniteScrolling?(r=r+f,this._data.step=f,(this._data.enableRTL?r>0:r<0)&&(r=0),r*(this._data.enableRTL?-1:1)+this._data.handle>=this._data.handleSpace&&(r=(this._data.handleSpace-this._data.handle)*(this._data.enableRTL?-1:1)),u=Math.ceil(r*this._data.onePx),this.scroll(u,"thumb")):(u=f*this._data.onePx,this._changeTop(this._data,u,"thumb",this._d)),this._trigger("thumbMove",{originalEvent:i,scrollData:this._data}));o===1&&(this._prevY=e)},_spaceMouseDown:function(i){var r,u,f;if(i.data&&this._enabled&&(r=i.data.d,i.which===1&&i.target!==this[r.handler][0])){u=i.data.step?this.model.smallChange:this.model.largeChange;f=i.data.top||this[r.handler].offset()[r.lPosition];i[r.clientXy]=i[r.clientXy]||0;i[r.clientXy]<f&&(u*=-1);r.target=i.target;this._changeTop(r,u,u===3?"track":"button",i);i.data.step!==1&&this[r.scroll].mousemove(function(){r.up=!0});r.up=!1;r.vInterval=setInterval(t.proxy(function(){if((u<0?f+u/r.onePx<i[r.clientXy]:f+r.handle+u/r.onePx>i[r.clientXy])&&(r.up=!0),r.up){clearInterval(r.vInterval);return}this._changeTop(r,u,u===3?"track":"button",i);f=i.data?i.data.top||this[r.handler].offset()[r.lPosition]:this[r.handler].offset()[r.lPosition]},this),150);n(document).one("mouseup",{d:r},t.proxy(this._mouseUp,this));n(document).mouseout({d:r},t.proxy(this._mouseUp,this))}},_remove:function(){this.model.orientation===t.ScrollBar.Orientation.Horizontal&&this.element.find(".e-hscroll").remove();this.model.orientation===t.ScrollBar.Orientation.Vertical&&this.element.find(".e-vscroll").remove();this._scrollData=null;this._content=null},_destroy:function(){this.element.remove()}});t.ScrollBar.Orientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion,window),function(n,t,i,r){"use strict";t.widget("ejScroller","ej.Scroller",{_addToPersist:["scrollLeft","scrollTop"],defaults:{height:250,autoHide:!1,animationSpeed:600,width:0,scrollOneStepBy:57,buttonSize:18,scrollLeft:0,scrollTop:0,targetPane:null,scrollerSize:18,enablePersistence:!1,enableRTL:r,enableTouchScroll:!0,enabled:!0,create:null,destroy:null,wheelStart:null,wheelMove:null,wheelStop:null},validTags:["div"],type:"transclude",dataTypes:{buttonSize:"number",scrollOneStepBy:"number"},observables:["scrollTop","scrollLeft"],scrollTop:t.util.valueFunction("scrollTop"),scrollLeft:t.util.valueFunction("scrollLeft"),keyConfigs:{up:"38",down:"40",left:"37",right:"39",pageUp:"33",pageDown:"34",pageLeft:"ctrl+37",pageRight:"ctrl+39"},content:function(){return this._content&&this._content.length&&this._content[0].offsetParent||(this._content=this.element.children().first().addClass("e-content")),this._content},_setFirst:!0,_updateScroll:!1,_init:function(){t.isNullOrUndefined(this.content()[0])||(this._prevScrollWidth=this.content()[0].scrollWidth,this._prevScrollHeight=this.content()[0].scrollHeight,this.element.addClass("e-widget"),this.content(),this._browser=t.browserInfo().name,this._wheelStart=!0,this._eleHeight=this.model.height,this._eleWidth=this.model.width,this.model.enableRTL===r&&(this.model.enableRTL=this.element.css("direction")==="rtl"),this._ensureScrollers(),this.model.enableRTL&&(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft()),this._on(this.content(),"scroll",this._scroll),this.model.targetPane!=null&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll),this.scrollLeft()&&this._setScrollLeftValue(this.scrollLeft()),this.scrollTop()&&this.content().scrollTop(this.scrollTop()),this.model.autoHide&&this._autohide(),this.model.enabled?this.enable():this.disable(),this._setDimension(),(this._prevScrollWidth!==this.content()[0].scrollWidth||this._prevScrollHeight!==this.content()[0].scrollHeight)&&this.refresh());this._addActionClass()},_addActionClass:function(){this._browser=="msie"&&(this.content().removeClass("e-pinch e-pan-x e-pan-y"),this._vScrollbar&&this._hScrollbar?this.content().addClass("e-pinch"):this._vScrollbar&&!this._hScrollbar?this.content().addClass("e-pan-x"):this._hScrollbar&&!this._vScrollbar&&this.content().addClass("e-pan-y"))},_setDimension:function(){t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1||(this._vScroll?this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),this.element.parent().height()):n(this.content()[0]).height(""));t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1||(this._hScroll?this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),this.element.parent().width()):n(this.content()[0]).width(""))},_setScrollLeftValue:function(n){this.model.enableRTL&&(n=t.browserInfo().name=="mozilla"?n<0?n:n*-1:!t.isNullOrUndefined(this._rtlScrollLeftValue)&&(t.browserInfo().name=="chrome"||this._rtlScrollLeftValue>0)?n<0?this._rtlScrollLeftValue+n:this._rtlScrollLeftValue-n:Math.abs(n));this.content().scrollLeft(n)},_ensureScrollers:function(){var u=n.fn.jquery,r;if(this.model.height=typeof this.model.height=="string"&&this.model.height.indexOf("px")!=-1?parseInt(this.model.height):this.model.height,this.model.width=typeof this.model.width=="string"&&this.model.width.indexOf("px")!=-1?parseInt(this.model.width):this.model.width,this.model.height&&this.element.height(this.model.height),this.model.width&&this.element.width(this.model.width),this._off(this.content(),"mousedown touchstart"),this.content().length>0){if(this.isVScroll()?(this._vScrollbar||(this._vScrollbar=this._createScrollbar(t.ScrollBar.Orientation.Vertical,this.isHScroll())),this.model.enableTouchScroll&&this._on(this.content(),"mousedown touchstart",{d:this._vScrollbar._scrollData},this._mouseDownOnContent)):(this._vScrollbar=null,this.element.children(".e-vscrollbar").remove()),this.isHScroll()?(this._hScrollbar||(this._hScrollbar=this._createScrollbar(t.ScrollBar.Orientation.Horizontal,this.isVScroll())),this.model.enableTouchScroll&&this._on(this.content(),"mousedown touchstart",{d:this._hScrollbar._scrollData},this._mouseDownOnContent)):(this._hScrollbar=null,this.element.children(".e-hscrollbar").remove()),this._vScrollbar||this._hScrollbar||this.content().css({width:"auto",height:"auto"}),this.element.find(".e-hscroll").length>0||this._vScrollbar&&this.content().outerHeight(this.content().outerHeight()-1),this._hScroll=this.isHScroll(),this._vScroll=this.isVScroll(),this._hScroll||this._vScroll){if(this.content().addClass("e-content"),u==="1.7.1"||u==="1.7.2"?(this._contentHeight="height",this._contentWidth="width"):(this._contentHeight="outerHeight",this._contentWidth="outerWidth"),r=this._exactElementDimension(this.element),this._ElementHeight=r.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.content()[this._contentHeight](this._ElementHeight-(this._hScroll&&!this.model.autoHide?this.model.scrollerSize:0)),this._ElementWidth=r.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.content()[this._contentWidth](this._ElementWidth-(this._vScroll&&!this.model.autoHide?this.model.scrollerSize:0)),isNaN(this._eleWidth)&&this._eleWidth.indexOf("%")>0&&isNaN(this._eleHeight)&&this._eleHeight.indexOf("%")>0)n(i).on("resize",n.proxy(this._resetScroller,this))}else this.content().removeClass("e-content");this._setDimension();this._parentHeight=n(this.element).parent().height();this._parentWidth=n(this.element).parent().width()}},_convertPercentageToPixel:function(n,t){return Math.floor(n*t/100)},isHScroll:function(){if(t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1){if(this.model.width>0){var i=this.content().find(this.model.targetPane);return this.model.targetPane!=null&&i.length?i[0].scrollWidth+i.siblings().width()>this.model.width:this.content()[0].scrollWidth>this.model.width?!0:this.content()[0].scrollWidth==this.model.width&&n(this.content()[0]).find("> *").length>0?n(this.content()[0]).find("> *")[0].scrollWidth>this.model.width:!1}return!1}return this.content()[0].scrollWidth>this.element.width()},isVScroll:function(){if(t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1){if(this.model.height>0&&(this.content()[0].scrollHeight>this.model.height||this.isHScroll()&&(this.content()[0].scrollHeight==this.model.height||this.content()[0].scrollHeight>this.model.height-(this.model.scrollerSize-2))))return!0}else return this.content()[0].scrollHeight>this.element.outerHeight();return!1},_setModel:function(n){for(var i in n)switch(i){case"enableRTL":n[i]?(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),t.isNullOrUndefined(this._hScrollbar)||(this._hScrollbar._scrollData.enableRTL=!0)):(this.element.removeClass("e-rtl"),t.isNullOrUndefined(this._hScrollbar)||(this._hScrollbar._scrollData.enableRTL=!1));this._hScrollbar&&(this.element.find(".e-hhandle").css("left",0),this._hScrollbar.value(0));break;case"scrollLeft":(parseFloat(t.util.getVal(n[i]))<0||!this._hScroll)&&(n[i]=0);this._externalCall=!0;this._hScrollbar&&(n[i]=parseFloat(t.util.getVal(n[i]))>this._hScrollbar._scrollData.scrollable?this._hScrollbar._scrollData.scrollable:parseFloat(t.util.getVal(n[i])));this._setScrollLeftValue(parseFloat(n[i]));this.scrollLeft(n[i]);!this._hScrollbar||this._hScrollbar._scrollData._scrollleftflag&&this.model.enableRTL||this.scrollX(n[i]);break;case"scrollTop":this._vScrollbar&&(n[i]=parseFloat(t.util.getVal(n[i]))>this._vScrollbar._scrollData.scrollable?this._vScrollbar._scrollData.scrollable:parseFloat(t.util.getVal(n[i])));(parseFloat(n[i])<0||!this._vScroll)&&(n[i]=0);this._externalCall=!0;this.content().scrollTop(parseFloat(n[i]));this.scrollTop(n[i]);this.scrollY(n[i]);break;case"touchScroll":this.model.enableTouchScroll?(this._vScrollbar&&this._on(this.content(),"mousedown touchstart",{d:this._vScrollbar._scrollData},this._mouseDownOnContent),this._hScrollbar&&this._on(this.content(),"mousedown touchstart",{d:this._hScrollbar._scrollData},this._mouseDownOnContent)):this._off(this.content(),"mousedown touchstart");break;case"scrollOneStepBy":this._vScrollbar&&(this._vScrollbar._scrollData.scrollOneStepBy=n[i],this._vScrollbar.model.smallChange=n[i]);this._hScrollbar&&(this._hScrollbar._scrollData.scrollOneStepBy=n[i],this._hScrollbar.model.smallChange=n[i]);break;case"buttonSize":this._vScrollbar&&(this._vScrollbar.model.buttonSize=this.model.buttonSize);this._hScrollbar&&(this._hScrollbar.model.buttonSize=this.model.buttonSize);this.refresh();break;case"height":this._eleHeight=n[i];this.refresh();break;case"width":this._eleWidth=n[i];this.refresh();break;default:this.refresh()}},_createScrollbar:function(i,r){var c=this,f,o,l,s,a,h=document.createElement("div"),e,u;return i===t.ScrollBar.Orientation.Vertical?(o=this.model.scrollerSize,l=t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1?f=this.model.height-(r?this.model.scrollerSize:0):f=this.element.height()-(r?this.model.scrollerSize:0),s=this.content()[0].scrollHeight,a=this.scrollTop()):(o=f=this.model.width-(r?this.model.scrollerSize:0),l=this.model.scrollerSize,t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1?(e=this.content().find(this.model.targetPane),s=this.model.targetPane!=null&&e.length?e[0].scrollWidth+e.parent().width()-e.width():this.content()[0].scrollWidth):(o=f=this.element.width()-(r?this.model.scrollerSize:0),s=this.content()[0].scrollWidth),a=this.scrollLeft()),this.element.children(".e-hscrollbar").length>0?n(this.element.children(".e-hscrollbar")).before(h):this.element.append(h),n(h).ejScrollBar({elementHeight:c._eleHeight,elementWidth:c._eleWidth,buttonSize:c.model.buttonSize,orientation:i,viewportSize:f,height:l,width:o,maximum:s-f,value:a,smallChange:this.model.scrollOneStepBy,largeChange:3*this.model.scrollOneStepBy,scroll:t.proxy(this._scrollChanged,this),thumbEnd:t.proxy(this._thumbEnd,this),thumbStart:t.proxy(this._thumbStart,this),thumbMove:t.proxy(this._thumbMove,this)}),u=n(h).ejScrollBar("instance"),i!==t.ScrollBar.Orientation.Vertical&&r||this._off(this.element,this._browser=="msie"?"wheel mousewheel":"mousewheel DOMMouseScroll",this._mouseWheel)._on(this.element,this._browser=="msie"?"wheel mousewheel":"mousewheel DOMMouseScroll",{d:u._scrollData},this._mouseWheel),i===t.ScrollBar.Orientation.Horizontal?this._scrollXdata=u._scrollData:this._scrollYdata=u._scrollData,i===t.ScrollBar.Orientation.Horizontal&&this.model.enableRTL&&(u._scrollData.enableRTL=!0),u._enabled=this.model.enabled,u},_updateScrollbar:function(i,r){var u=i===t.ScrollBar.Orientation.Vertical?this._vScrollbar:this._hScrollbar;u&&(i===t.ScrollBar.Orientation.Vertical?(u.model.width=this.model.scrollerSize,u.model.height=u.model.viewportSize=this.model.height-(r?this.model.scrollerSize:0),u.model.maximum=this.content()[0].scrollHeight-u.model.viewportSize,u.model.value=this.scrollTop()):(u.model.width=u.model.viewportSize=this.model.width-(r?this.model.scrollerSize:0),u.model.height=this.model.scrollerSize,u.model.maximum=(this.model.targetPane!=null&&this.content().find(this.model.targetPane).length>0?this.content().find(this.model.targetPane)[0].scrollWidth+(this.content().width()-n(this.model.targetPane).outerWidth()):this.content()[0].scrollWidth)-u.model.viewportSize,this.model.enableRTL||(u.model.value=this.scrollLeft())))},_autohide:function(){this.model.autoHide?(this.element.addClass("e-autohide"),this._on(this.element,"mouseenter mouseleave touchstart touchend",this._scrollerHover),this.content().siblings(".e-scrollbar.e-js").hide()):(this.element.removeClass("e-autohide"),this._off(this.element,"mouseenter mouseleave touchstart touchend",this._scrollerHover),this.content().siblings(".e-scrollbar.e-js").show())},_scrollChanged:function(i){this._updateScroll=!0;i.scrollTop!==r?this.scrollY(i.scrollTop,!0,"",i.source):i.scrollLeft!==r&&this.scrollX(i.scrollLeft,!0,"",i.source);this._updateScroll=!1;var u=this;n.when(this.content()).done(t.proxy(function(){u._trigger("scrollEnd",{scrollData:i})}))},_bindBlurEvent:function(r,u){this._scrollEle=n(r).data("ejScrollBar");this._event=u;var f=this;this._listener=function(){this._scrollEle._off(n(document),"mousemove touchmove",this._scrollEle._mouseMove);n(document).off("mouseup touchend",t.proxy(this._scrollEle._mouseUp,this._scrollEle));this._scrollEle._prevY=null;this._off(n(document),"mousemove touchmove",this._mouseMove);this._off(n(document),"mouseup touchend",this._mouseUp);this._off(n(i),"blur");this._evtData.handler==="e-vhandle"?this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData}):this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData})};this._on(n(i),"blur",this._listener)},_thumbStart:function(n){this._evtData=n.scrollData;var t=n.scrollData.handler==="e-vhandle"?this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"),t=n.scrollData.handler==="e-vhandle"?this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+n.scrollData.handler).closest(".e-scrollbar");this._bindBlurEvent(t,n);this._trigger("thumbStart",n)},_thumbMove:function(n){this._trigger("thumbMove",n)},_thumbEnd:function(t){this._trigger("thumbEnd",t);this._off(n(i),"blur")},refresh:function(i){var r,u;i||this.element.find(">.e-content").removeAttr("style");t.isNullOrUndefined(this._eleHeight)||typeof this._eleHeight!="string"||this._eleHeight.indexOf("%")==-1||this._parentHeight==n(this.element).parent().height()||(r=this._exactElementDimension(this.element.parent()),r=r.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),r));t.isNullOrUndefined(this._eleWidth)||typeof this._eleWidth!="string"||this._eleWidth.indexOf("%")==-1||this._parentWidth==n(this.element).parent().width()||(r=this._exactElementDimension(this.element.parent()),r=r.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),r));this._ensureScrollers();u=this.scrollLeft();this.model.enableRTL?(this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),u>0?this.content().scrollLeft(u):this._setScrollLeftValue(u)):this.content().scrollLeft(u);(this.scrollTop()&&this._vScrollbar==null||this._vScrollbar!==null&&this._vScrollbar&&this._vScrollbar._scrollData!=null&&!this._vScrollbar._scrollData.skipChange)&&this.content().scrollTop(this.scrollTop());this._vScrollbar&&(this._vScrollbar._scrollData.dimension="Height",this._updateScrollbar(t.ScrollBar.Orientation.Vertical,this._hScroll),this._vScroll&&!this._vScrollbar._calculateLayout(this._vScrollbar._scrollData)&&this._vScrollbar._updateLayout(this._vScrollbar._scrollData));this._hScrollbar&&(this._hScrollbar._scrollData.dimension="Width",this._updateScrollbar(t.ScrollBar.Orientation.Horizontal,this._vScroll),this._hScroll&&!this._hScrollbar._calculateLayout(this._hScrollbar._scrollData)&&this._hScrollbar._updateLayout(this._hScrollbar._scrollData));t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?this.element.find(".e-hhandle").css("left","0px"):this.model.targetPane!=null&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll);this._addActionClass();this._autohide()},_exactElementDimension:function(n){var i=n.get(0).getBoundingClientRect(),r=["left","right","top","bottom"],u,f,t;for(u=i.width?i.width:i.right-i.left,f=i.height?i.height:i.bottom-i.top,t=0;t<r.length;t++)this["border_"+r[t]]=isNaN(parseFloat(n.css("border-"+r[t]+"-width")))?0:parseFloat(n.css("border-"+r[t]+"-width")),this["padding_"+r[t]]=isNaN(parseFloat(n.css("padding-"+r[t])))?0:parseFloat(n.css("padding-"+r[t]));return{width:u,height:f}},_keyPressed:function(n,i){if(this.model.enabled){if(["input","select","textarea"].indexOf(i.tagName.toLowerCase())!==-1)return!0;var r,u;if(["up","down","pageUp","pageDown"].indexOf(n)!==-1)this._vScrollbar&&(t.browserInfo().name=="msie"&&this.model.allowVirtualScrolling&&this._content.focus(),r=this._vScrollbar._scrollData),u="o";else if(["left","right","pageLeft","pageRight"].indexOf(n)!==-1)this._hScrollbar&&(r=this._hScrollbar._scrollData),u="i";else return!0;return r?!this._changeTop(r,(n.indexOf(u)<0?-1:1)*(n[0]!=="p"?1:3)*r.scrollOneStepBy,"key"):!0}},scrollY:function(n,i,r,u,f){var e=this,f;if(n!==""){if(i){if(f={source:u||"custom",scrollData:this._vScrollbar?this._vScrollbar._scrollData:null,scrollTop:n,originalEvent:f},n=f.scrollTop,this.scrollTop(n),this._trigger("scroll",f))return;this.content().scrollTop(n);return}(t.isNullOrUndefined(r)||r==="")&&(r=100);this._vScrollbar&&(n=parseFloat(n)>this._vScrollbar._scrollData.scrollable?this._vScrollbar._scrollData.scrollable:parseFloat(n));this.scrollTop(n);this.content().stop().animate({scrollTop:n},r,"linear",function(){e._trigger("scroll",{source:u||"custom",scrollData:e._vScrollbar?e._vScrollbar._scrollData:null,scrollTop:n,originalEvent:f})})}},scrollX:function(n,i,r,u,f){var o=this,e,s;if(n!==""){if(this._hScrollbar&&(n=parseFloat(n)>this._hScrollbar._scrollData.scrollable?this._hScrollbar._scrollData.scrollable:parseFloat(n)),this._externalCall=!0,e=t.browserInfo().name,this.model.enableRTL&&e!="mozilla"&&(n<0&&(n=Math.abs(n)),s=this.model.targetPane!=null?this.content().find(this.model.targetPane)[0]:this.content()[0],f!="mousemove"&&f!="touchmove"&&e!="msie"&&e!="msie"&&(n=this._hScrollbar._scrollData.scrollable-n)),this.scrollLeft(n),i){if(this._trigger("scroll",{source:u||"custom",scrollData:this._hScrollbar?this._hScrollbar._scrollData:null,scrollLeft:n,originalEvent:f}))return;this.model.targetPane!=null&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane).scrollLeft(n):this.content().scrollLeft(n);return}(t.isNullOrUndefined(r)||r==="")&&(r=100);this.model.targetPane!=null&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane).stop().animate({scrollLeft:n},r,"linear"):this.content().stop().animate({scrollLeft:n},r,"linear",function(){o._trigger("scroll",{source:u||"custom",scrollData:o._hScrollbar?o._hScrollbar._scrollData:null,scrollLeft:n,originalEvent:f})})}},enable:function(){var n=this.element.find(".e-vscrollbar,.e-hscrollbar,.e-vscroll,.e-hscroll,.e-vhandle,.e-hhandle,.e-vscroll .e-icon,.e-hscroll .e-icon");n.hasClass("e-disable")&&(n.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.enabled=!0);this._vScrollbar&&(this._vScrollbar._enabled=this.model.enabled);this._hScrollbar&&(this._hScrollbar._enabled=this.model.enabled)},disable:function(){var n=this.element.find(".e-vscrollbar,.e-hscrollbar,.e-vscroll,.e-hscroll,.e-vhandle,.e-hhandle,.e-vscroll .e-icon,.e-hscroll .e-icon");n.addClass("e-disable").attr({"aria-disabled":!0});this.model.enabled=!1;this._vScrollbar&&(this._vScrollbar._enabled=this.model.enabled);this._hScrollbar&&(this._hScrollbar._enabled=this.model.enabled)},_changeTop:function(n,i,r,u){var e=Math.ceil(this.model.targetPane!=null&&n.dimension!="height"?this.content().find(this.model.targetPane)[n.scrollVal]():this.content()[n.scrollVal]()),f;return n.dimension=="height"&&e==0&&(e=this.scrollTop()!=0?this.scrollTop():0),f=e+i,(n.enableRTL?f<n.scrollable:f>n.scrollable)&&(f=Math.round(n.scrollable)),(n.enableRTL?f>0:f<0)&&(f=0),f!==e&&(this["scroll"+n.xy](f,!0,"",r,u),n.xy!=="X"||t.isNullOrUndefined(this._hScrollbar)?t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(f,r,!0,u):this._hScrollbar.scroll(f,r,!0,u)),f!==e},_mouseWheel:function(t){var o;if((!this._vScrollbar||!t.ctrlKey)&&(this._vScrollbar||t.shiftKey)&&t.data&&this.model.enabled){var u=0,f=t.data.d,r=t,e;if(t=t.originalEvent,this._wheelStart&&this._trigger("wheelStart",{originalEvent:t,scrollData:r.data.d}),this._wheelStart=!1,clearTimeout(n.data(this,"timer")),this._wheelx!=1&&(t.wheelDeltaX==0||t.wheelDeltaY==0)&&(this._wheelx=1),navigator.platform.indexOf("Mac")==0&&this._wheelx==0&&(this._browser=="webkit"||this._browser=="chrome"))return!0;(this._browser=="mozilla"?t.axis==t.HORIZONTAL_AXIS?f=this._scrollXdata:this._scrollYdata:this._browser=="msie"?(t.type=="wheel"&&(u=t.deltaX/120),t.type=="mousewheel"&&t.shiftKey&&(f=this._scrollXdata,t.preventDefault?t.preventDefault():t.returnValue=!1)):this._wheelx&&t.wheelDeltaX!=0&&t.wheelDeltaY==0&&this._scrollXdata&&(f=this._scrollXdata),t.wheelDeltaX==0&&(this._wheelx=t.wheelDeltaX),t.wheelDelta?(u=navigator.platform.indexOf("Mac")==0?-t.wheelDelta/3:-t.wheelDelta/120,i.opera&&parseFloat(i.opera.version,10)<10&&(u=-u)):t.detail&&(u=t.detail/3),u)&&(r.originalEvent&&(e=r.originalEvent.wheelDelta&&r.originalEvent.wheelDelta>0||r.originalEvent.detail&&r.originalEvent.detail<0?-1:1),this._changeTop(f,u*f.scrollOneStepBy,"wheel",t)?(t.preventDefault?t.preventDefault():r.preventDefault(),r.stopImmediatePropagation(),r.stopPropagation(),this._trigger("wheelMove",{originalEvent:t,scrollData:r.data.d,direction:e})):(this._trigger("scrollEnd",{originalEvent:t,scrollData:r}),this._wheelx=0),o=this,n.data(this,"timer",setTimeout(function(){o._wheelStart=!0;o._trigger("wheelStop",{originalEvent:t,scrollData:r.data.d,direction:e})},250)))}},_contentHeightWidth:function(){this.content().siblings().css("display")=="block"&&this.model.autoHide&&this._hScroll?(this.content()[this._contentHeight](this._ElementHeight-this.model.scrollerSize),this.content()[this._contentWidth](this._ElementWidth-this.model.scrollerSize)):this.content().siblings().css("display")=="none"&&this.model.autoHide&&this._vScroll&&(this.content()[this._contentHeight](this._ElementHeight),this.content()[this._contentWidth](this._ElementWidth))},_scrollerHover:function(n){this.model.enabled&&(n.type!="mouseenter"&&n.type!="touchstart"||this.content().siblings().is(":visible")?(n.type=="mouseleave"||n.type=="touchend")&&(this.content().siblings().hide(),this._contentHeightWidth(),this._trigger("scrollHide",{originalEvent:n})):(this.content().siblings().css("display","block"),this._contentHeightWidth(),this._trigger("scrollVisible",{originalEvent:n})))},_mouseUp:function(r){if(r.data){var u=r.data.d;r.type!=="mouseup"&&r.type!=="touchend"&&(r.toElement||r.relatedTarget)||(this.content().css("cursor","default"),this._off(n(document),"mousemove touchmove"),this._off(n(document),"mouseup touchend",this._mouseUp),u.fromScroller=!1,this._mouseMoved!==!0||r.data.source!=="thumb"||t.isNullOrUndefined(this.model)||(n.when(this.content()).done(t.proxy(function(){this._trigger("thumbEnd",{originalEvent:r,scrollData:u})},this)),this._off(n(i),"blur")));u.up=!0}},_mouseDownOnContent:function(u){var f,s;if((this._startX=u.clientX!=r?u.clientX:u.originalEvent.changedTouches[0].clientX,this._startY=u.clientY!=r?u.clientY:u.originalEvent.changedTouches[0].clientY,this._timeStart=u.timeStamp||Date.now(),this.model.enabled)&&(f=u.data.d,this._evtData=u.data,s=f.handler==="e-vhandle"?this.element.find("."+f.handler).closest(".e-scrollbar"):this.element.find("."+f.handler).closest(".e-scrollbar"),this._bindBlurEvent(s,u),!this._trigger("thumbStart",{originalEvent:u,scrollData:f}))&&(u.which!=3||u.button!=2)){f.fromScroller=!0;var e=null,o=1,c=5,h;this._document=n(document);this._window=n(i);this._mouseMove=function(n){var s,l,u;if(this._relDisX=(this._startx=n.clientX!=r?n.clientX:n.originalEvent.changedTouches[0].clientX)-this._startX,this._relDisY=(this._starty=n.clientY!=r?n.clientY:n.originalEvent.changedTouches[0].clientY)-this._startY,this._duration=(n.timeStamp||Date.now())-this._timeStart,this._velocityY=Math.abs(this._relDisY)/this._duration,this._velocityX=Math.abs(this._relDisX)/this._duration,n.preventDefault(),!t.isNullOrUndefined(n.target.tagName)&&n.target.tagName.toLowerCase()==="iframe"){n.type="mouseup";this._mouseUp(n);return}if(s=n.type=="mousemove"?n[f.clientXy]:n.originalEvent.changedTouches[0][f.clientXy],e&&s!==e&&(this._mouseMoved=!0,l=s-e,u=this.model[f.scrollVal]-l,o==1&&Math.abs(l)>c&&(h=f.position,o=0),o==0&&(e=s),u>=0&&u<=f.scrollable&&h===f.position)){var a=this._velocityY>.5&&this._duration<50&&f.position=="Top",v=this._velocityX>.5&&this._duration<50&&f.position=="Left",y=(this._velocityY>.5||this._velocityX>.5)&&this._duration<50;y?a?(u=Math.abs(this._relDisY)+this._duration*this._velocityY,this._startY>this._starty?(u+=this.scrollTop(),u>f.scrollable&&(u=f.scrollable)):(u<this.scrollTop()&&(u=Math.abs(u-this.scrollTop())),u>this.scrollTop()&&(u=0)),this.scrollTop()<=f.scrollable&&this.scrollY(u,!1,this.model.animationSpeed,"thumb")):v&&(u=Math.abs(this._relDisX),this._startX>this._startx?(u+=this.scrollLeft(),u>f.scrollable&&(u=f.scrollable)):(u-=this.scrollLeft(),u=Math.abs(u),(u>f.scrollable||u>=this.scrollLeft())&&(u=0)),this.scrollLeft()<=f.scrollable&&this.scrollX(u,!1,this.model.animationSpeed,"thumb")):(this["scroll"+f.xy](u,!0,"","thumb",n.type),f.xy==="X"?this._hScrollbar.scroll(u,"thumb",!0,n.type):t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(u,"thumb",!0,n.type),this.content().css("cursor","pointer"),this._trigger("thumbMove",{originalEvent:n,scrollData:f}))}e==null&&(e=s);this._swipe=Math.abs(this._relDisX)>Math.abs(this._relDisY)?this._relDisX<0?"left":"right":this._relDisY<0?"up":"down";Math.round(this._content.scrollTop())==0&&this._swipe=="down"||Math.ceil(this._content.scrollTop())==f.scrollable&&this._swipe=="up"?(this._trigger("scrollEnd",{originalEvent:n.originalEvent,scrollData:n}),i.removeEventListener&&i.removeEventListener("DOMMouseScroll",this._preventDefault,!1),i.ontouchmove=null):n.data.d.clientXy=="pageY"&&(i.addEventListener&&i.addEventListener("DOMMouseScroll",this._preventDefault,!1),i.ontouchmove=this._preventDefault)};this._on(n(document),"mousemove touchmove",{d:f,source:"thumb"},this._mouseMove);this._mouseMoved=!1;this._on(n(document),"mouseup touchend",{d:f,source:"thumb"},this._mouseUp)}},_scroll:function(n){for(var i,u,f=[this._vScrollbar?this._vScrollbar._scrollData:null,this._hScrollbar?this._hScrollbar._scrollData:null],r=0;r<2;r++)if(i=f[r],i&&!i.skipChange){if(this._externalCall||(i.dimension==="height"?this.scrollTop(n.target[i.scrollVal]):this.scrollLeft(n.target[i.scrollVal])),i.sTop=this.model&&this.model.targetPane!=null&&r==1&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane)[0][i.scrollVal]:i.scrollVal=="scrollTop"?this.scrollTop():this.scrollLeft(),this[i.scrollVal](i.sTop),i.fromScroller)return;r===1?(u=this.content()[0],this._rtlScrollLeftValue&&u.scrollWidth-u.clientWidth!=this._rtlScrollLeftValue&&(this._rtlScrollLeftValue=u.scrollWidth-u.clientWidth),i.sTop=this.model&&t.browserInfo().name!="mozilla"&&this.model.enableRTL&&!this._hScrollbar._scrollData._scrollleftflag?this._rtlScrollLeftValue==0?i.sTop*-1:i.sTop-this._rtlScrollLeftValue:i.sTop,this._hScrollbar.scroll(i.sTop,"",!0)):this._vScrollbar.scroll(i.sTop,"",!0);(f.length==2&&r==1||f.length==1&&r==0)&&(this._externalScroller=!1)}},_changevHandlerPosition:function(n){var t=this._vScrollbar;t&&(n=t._scrollData!=null&&n>=t._scrollData.scrollable?t._scrollData.scrollable:n,t!=null&&n>=0&&n<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,n/t._scrollData.onePx+"px"))},_changehHandlerPosition:function(n){var t=this._hScrollbar;t&&(n=t._scrollData!=null&&n>=t._scrollData.scrollable?t._scrollData.scrollable:n,t!=null&&top>=0&&n<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,n/t._scrollData.onePx+"px"))},_destroy:function(){this.element.css({width:"",height:""}).find(".e-vscrollbar,.e-hscrollbar").remove();this.content().removeClass("e-content").css({width:"",height:""})},_preventDefault:function(n){n=n||i.event;n.preventDefault&&n.preventDefault();n.returnValue=!1}})}(jQuery,Syncfusion,window),function(n,t,i){t.widget("ejNavigationDrawerBase","ej.NavigationDrawerBase",{defaults:{contentId:null,cssClass:"",direction:"left",targetId:null,position:"normal",enableListView:!1,listViewSettings:{},type:"overlay",width:"auto",swipe:null,open:null,beforeClose:null,items:[],ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},ajaxSuccess:null,ajaxError:null,ajaxComplete:null},dataTypes:{direction:"enum",type:"enum",ajaxSettings:"data"},loadContent:function(i,r){var f=this,u,e,o;r.indexOf("#")==0?(u=n(r)[0]&&n(r)[0].nodeName&&n(r)[0].nodeName.toLowerCase()=="script"?t.getClearString(n(r)[0].innerHTML):r,u!=n(r)&&(n(u).length!=0?this._scriptTemplate.push({id:r,data:n(u)}):(e=n.grep(this._scriptTemplate,function(n){if(n.id==u)return n.data}),u=e.length>0?e[0].data[0]:u)),n(i).html(n(u)),this._hide()):(o={url:r,success:function(t){try{n(i).html(t);f._trigger("ajaxSuccess",{data:t,url:r,content:i});f._hide()}catch(u){}},error:function(n){try{f._trigger("ajaxError",{data:{status:n.status,responseText:n.responseText,statusText:n.statusText},content:i,url:r});f._hide()}catch(n){}},complete:function(n){try{f._trigger("ajaxComplete",{data:n,content:i,url:r})}catch(n){}}},this._sendAjaxRequest(o))},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_shadowWrapper:function(){this.model.isPaneOpen||(this._elementOverlay=t.buildTag("div#"+this._id+"_Overlay",{},{},{"class":this._rootCSS+" "+this._prefixClass+"nb-layout "+this._prefixClass+"nb-overlay"}),this._elementShadow=t.buildTag("div#"+this._id+"_shadow",{},{},{"class":this._rootCSS+" "+this._prefixClass+"nb-shadow "+this._prefixClass+"nb-type-"+(this.model.type=="slide"?"slide":"overlay")}),this._nbHome.append(this._elementOverlay),this._elementOverlay.hide(),this.element.hide(),this.element.prepend(this._elementShadow))},_renderControl:function(){this.model.position.toLowerCase()=="fixed"&&this.element.appendTo(this._nbHome);this._shadowWrapper();this.element.addClass(this._prefixClass+"user-select "+this.model.cssClass);this.element.addClass(this._prefixClass+"nb-layout "+(this.model.direction.toLowerCase()=="left"?this._prefixClass+"nb-left":this._prefixClass+"nb-right"));this.element.addClass(this._prefixClass+"nb-type-"+(this.model.type=="slide"?"slide":"overlay"));this._maxIndex=this._getMaxZindex();this._parentWidth=this._nbHome.width();this._setWidth();this._setLayout()},_getMaxZindex:function(){return Math.max.apply(null,n.map(n("body *"),function(t){return parseInt(n(t).css("z-index"))+1||1}))},_transform:function(t,i,r){var s="-"+this._browser+"-transform",u="translateX("+t+"px) translateZ(0px)",h="-"+this._browser+"-transition-property",f="transform",c="-"+this._browser+"-transition-duration",e=i+"ms",o;r?(o=this.model.position=="fixed"?"e-nb-fixed":"",this.model.position=="normal"&&this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").addClass("e-nb-normal"),this.element.addClass(""+this._prefixClass+"nb-animate "+o),this.element.css(h,f).css(c,e).css(s,u),this.element.css("transition-property",f).css("transition-duration",e).css("transform",u)):(o=this.model.position=="fixed"?"e-nb-fixed":"",this.model.position=="normal"&&this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").addClass("e-nb-normal"),this._nbHome.addClass(this._rootCSS+" "+this._prefixClass+"nb-animate "+o),this._nbHome.css(h,f).css(c,e).css(s,u),this._nbHome.css("transition-property",f).css("transition-duration",e).css("transform",u))},_show:function(){t.isNullOrUndefined(this.element.css("left").match(/\d/g))||Number(this.element.css("left").match(/\d/g)[0]<this.element.width())||this._setLayout();n("."+this._prefixClass+"nb-opened").length&&n("."+this._prefixClass+"nb-opened")[0]!=this.element[0]&&n("."+this._prefixClass+"nb-opened").ejNavigationDrawer("close");this.element.show();t.listenTouchEvent(this._isTransitionElement()?this.element:this._nbHome,t.transitionEndEvent(),this._transitionOpenHandler,!1,this);this.element.addClass(""+this._prefixClass+"nb-opened");this._elementOverlay.css("z-index",this._maxIndex*2);this.element.css("z-index",this._maxIndex*3);t.browserInfo().name=="msie"&&t.browserInfo().version<=9?n(this.element).show().animate({left:this.model.direction=="left"?"0px":this._parentWidth-n(this.element).width()},400,n.proxy(this._transitionOpenEnd,this)):this.model.direction=="left"?this._transform(n(this.element).width(),400,this._isTransitionElement()):this._transform(-n(this.element).width(),400,this._isTransitionElement());this._data={element:this.element};this.model.enableListView?n.extend(this._data,{listview:this._lb}):null;this._elementOverlay.show();this._trigger("open",this._data)},_hide:function(){this._elementOverlay.hide();t.listenTouchEvent(this._isTransitionElement()?this.element:this._nbHome,t.transitionEndEvent(),this._transitionCloseHandler,!1,this);this.element.removeClass(""+this._prefixClass+"nb-opened");t.browserInfo().name=="msie"&&t.browserInfo().version<=9?n(this.element).animate({left:this.model.direction=="left"?-n(this.element).width():this._nbHome.width()},400,n.proxy(this._transitionCloseEnd,this)):this._transform(0,400,this._isTransitionElement())},_clearHomeElement:function(){var n="",t;this._browser!=""&&(n="-"+this._browser+"-");var i=n+"transform",r=n+"transition-property",u=n+"transition-duration";this._nbHome.css(i,"").css(u,"").css(r,"");t=this.model.position=="fixed"?"e-nb-fixed":"";this._nbHome.removeClass(this._rootCSS+" "+this._prefixClass+"nb-animate "+t)},_isOpened:function(){return this.element.hasClass(""+this._prefixClass+"nb-opened")},_isOtherOpened:function(){return n("."+this._prefixClass+"nb-opened").length},_isTransitionElement:function(){return this.model.type=="overlay"?!0:!1},_isOrientationSupported:function(){return"orientation"in window&&"onorientationchange"in window},_setWidth:function(){n(this._nbHome).width()<500?this.element.css("maxwidth","80%"):this.element.css("maxwidth","40%");this.model.width!="auto"&&Number(this.model.width)!=0&&this.element.width(Number(this.model.width));this.element.height("100%")},_setLayout:function(){var i;this.element.show();this.element.find("."+this._prefixClass+"list-container").removeClass("e-scroller");this.model.position=="fixed"&&this.element.css("min-height",window.innerHeight);this.model.direction.toLowerCase()=="left"?(n("#"+this._id+"_WrapContainer").css({right:""}).removeClass("e-nb-right").addClass("e-nb-left"),this.element.removeClass("e-nb-right").addClass("e-nb-left"),this.model.isPaneOpen?(i=this.model.position=="fixed"?"e-nb-fixed":"",this.element.css({right:"",left:this.model.position=="fixed"?-t.getDimension(this.element,"width"):0}),this._nbHome.css({width:this._nbHome.parent().width()-t.getDimension(this.element,"width"),left:t.getDimension(this.element,"width"),position:"absolute"}).addClass(i)):(this.model.position=="normal"?this.element.css({right:"",left:this.model.type=="overlay"?-t.getDimension(this.element,"width"):"0px"}):this.element.css({right:"",left:-t.getDimension(this.element,"width")}),this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").removeAttr("style").css({left:-t.getDimension(this.element,"width")}))):(n("#"+this._id+"_WrapContainer").css({left:""}).removeClass("e-nb-left").addClass("e-nb-right"),this.element.css({left:""}).removeClass("e-nb-left").addClass("e-nb-right"),this.model.isPaneOpen?(i=this.model.position=="fixed"?"e-nb-fixed":"",this._nbHome.css({left:"",position:"",width:t.getDimension(this._nbHome.parent(),"width")-t.getDimension(this.element,"width")}).addClass(i),this.element.css({left:"",right:"0px"})):(i=this.model.position=="fixed"?"e-nb-fixed":"",this._nbHome.removeClass("e-nb-fixed-slide "+i),n("#"+this._id+"_WrapContainer").removeClass("e-nb-left").addClass("e-nb-right"),this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").removeAttr("style").css({right:"0px"}),this.model.position.toLowerCase()=="fixed"&&this.model.type=="slide"&&this._nbHome.addClass("e-nb-fixed-slide"),this.model.position.toLowerCase()=="fixed"&&this.model.type=="overlay"&&this.element.addClass(i),this.model.position.toLowerCase()=="normal"?this.element.css({left:t.getDimension(this.element,"width")}):this.element.css({right:-t.getDimension(this.element,"width")})));this._isOpened()||this.model.isPaneOpen||this.element.hide()},_destroy:function(n){this._wireEvents(!0);this._elementOverlay&&this._elementOverlay.remove();this._elementShadow&&this._elementShadow.remove();this._elementWrapper&&this.element.unwrap();this.element.removeAttr("style");this.element.css("left","");this._destroyEJMPlugin();n||this.element.removeClass("e-nb e-user-select e-nb-layout e-nb-left e-nb-type-overlay e-nb-animate e-nb-opened")},_refresh:function(){this._destroy(!0);this._load();this._renderControl();this._renderEJMControls();this._createDelegate();this._wireEvents()},_createDelegate:function(){this._swipeStartHandler=n.proxy(this._swipeStart,this);this._swipeEndHandler=n.proxy(this._swipeEnd,this);this._swipeMoveHandler=n.proxy(this._swipeMove,this);this._touchMoveHandler=n.proxy(this._touchMove,this);this._touchEndHandler=n.proxy(this._touchEnd,this);this._transitionOpenHandler=n.proxy(this._transitionOpenEnd,this);this._transitionCloseHandler=n.proxy(this._transitionCloseEnd,this);this._overlayTapHandler=n.proxy(this._elementOverlayTap,this);this._targetButtonTapHandler=n.proxy(this._targetButtonTap,this);this._onOrientationChangeHandler=n.proxy(this._onOrientationChangeEvent,this);this._onResizeEventHandler=n.proxy(this._onResizeEvent,this)},_wireEvents:function(i){var r;(!this.model.isPaneOpen||i)&&(this.model.targetId?(r=t.getCurrentPage?t.getCurrentPage():n("body"),t.listenTouchEvent(r.find("#"+this.model.targetId),this._prefixClass=="e-"?"click":t.endEvent(),this._targetButtonTapHandler,i,this)):t.browserInfo().name=="msie"&&t.browserInfo().version<=8||t.listenTouchEvent(this._nbHome,t.startEvent(),this._swipeStartHandler,i,this),t.listenTouchEvent(this._elementOverlay,t.endEvent(),this._overlayTapHandler,i,this));this.model.isPaneOpen&&(t.isTouchDevice()&&this._isOrientationSupported()?t.listenTouchEvent(window,"orientationchange",this._onOrientationChangeHandler,i,this):t.listenTouchEvent(window,"resize",this._onResizeEventHandler,i,this))},_onResizeEvent:function(){var n;this.element.show();n=this._isOpened()&&this.element.is(":visible")&&!this.model.isPaneOpen?"opened ":"closed";this._transform(0,0,this._isTransitionElement());this.element.hide();this.element.removeClass(""+this._prefixClass+"nb-opened");this._clearHomeElement();this._parentWidth=this._nbHome.width();this._setWidth();this._setLayout();n=="opened "&&this._show()},_onOrientationChangeEvent:function(){var t,n;this.element.show();t=this._isOpened()&&this.element.is(":visible")?"opened ":"closed";(window.orientation==0||window.orientation==180||window.orientation==90)&&window.scrollTo(0,0);this._transform(0,0,this._isTransitionElement());this.element.hide();this.element.removeClass(""+this._prefixClass+"nb-opened");this._parentWidth=this._nbHome.width();this._clearHomeElement();n=this;setTimeout(function(){n._setWidth();n._setLayout();t=="opened "&&n._show()},300)},_transitionCloseEnd:function(){t.isNullOrUndefined(this.element)||this.element.hide();this._clearHomeElement();t.listenTouchEvent(this._isTransitionElement()?this.element:this._nbHome,t.transitionEndEvent(),this._transitionCloseHandler,!0,this);this._lbObj&&(this.model.listViewSettings.selectedItemIndex=this._lbObj.model.selectedItemIndex)},_transitionOpenEnd:function(){t.isNullOrUndefined(this.element)||this.element.show();this._scrollbar&&this._scrollbar.ejmScrollPanel("refresh");this._lbscrollbar&&this._lbscrollbar.ejmScrollPanel("refresh");t.listenTouchEvent(this._isTransitionElement()?this.element:this._nbHome,t.transitionEndEvent(),this._transitionOpenHandler,!0,this)},_targetButtonTap:function(n){n.preventDefault();this._isOtherOpened()||this._show()},_elementOverlayTap:function(r){t.blockDefaultActions(r);this._data={element:this.element};this.model.enableListView?n.extend(this._data,{listview:this._lb}):i;this._trigger("beforeclose",this._data);this._hide()},_swipeStart:function(n){var i=n.changedTouches?n.changedTouches[0]:n;this._startSwipeOffsetX=i.clientX-this._nbHome.offset().left;this._startSwipeOffsetActualX=i.clientX;this._startSwipeOffsetY=i.clientY;this._containerX=this._isTransitionElement()?this.element.offset().left:this._nbHome.offset().left;t.listenTouchEvent(this._nbHome,t.moveEvent(),this._swipeMoveHandler,!1,this);t.listenTouchEvent(this._nbHome,t.endEvent(),this._swipeEndHandler,!1,this)},_swipeMove:function(i){var r=i.changedTouches?i.changedTouches[0]:i,u,f;!t.isNullOrUndefined(this.element.css("left").match(/\d/g))&&Number(this.element.css("left").match(/\d/g)[0])<this.element.width()&&this._setLayout();this._swipeDirection=this._startSwipeOffsetActualX&&this._startSwipeOffsetActualX>r.clientX?"right":"left";u=this._isOpened()?this._swipeDirection!=this.model.direction.toLowerCase()?!0:!1:!1;u?this._startSwipeOffsetX&&this._isOpened()&&(this._relativeX=r.clientX-this._startSwipeOffsetActualX,this._relativeY=r.clientY-this._startSwipeOffsetY,f=this.element.width()+this._relativeX-(this.model.type.toLowerCase()=="overlay"?this._nbHome.offset().left:0),n(r.target).hasClass(""+this._prefixClass+"nb-overlay")&&(this.model.direction=="left"?-this._relativeX<this.element.width():this._relativeX<this.element.width())&&this._transform(this.model.direction=="left"?f:-(this.element.width()-this._relativeX),0,this._isTransitionElement())):this._swipeDirection!=this.model.direction.toLowerCase()||this._isOtherOpened()?t.listenEvents([this._nbHome,this._nbHome,this._nbHome],[t.moveEvent(),t.endEvent()],[this._touchMoveHandler,this._touchEndHandler],!0,this):t.listenEvents([this._nbHome,this._nbHome,this._nbHome],[t.moveEvent(),t.endEvent()],[this._touchMoveHandler,this._touchEndHandler],!1,this)},_swipeEnd:function(n){var i=n.changedTouches?n.changedTouches[0]:n;t.listenTouchEvent(this._nbHome,t.moveEvent(),this._swipeMoveHandler,!0,this);t.listenTouchEvent(this._nbHome,t.endEvent(),this._swipeEndHandler,!0,this)},_touchMove:function(n){var u=n.changedTouches?n.changedTouches[0]:n,r;t.listenTouchEvent(this._nbHome,t.moveEvent(),this._swipeMoveHandler,!0,this);this._isTransitionElement()&&(this._containerX=0);this._startSwipeOffsetX&&!this._isOpened()&&(this._relativeX=u.clientX-this._startSwipeOffsetX,this._relativeY=u.clientY-this._startSwipeOffsetY,(this.model.direction=="left"?this._startSwipeOffsetX<50:this._startSwipeOffsetX>this._nbHome.width()-50)&&(this.element.show(),r=this.model.type.toLowerCase()=="slide"?0:this._nbHome.offset().left,(this.model.direction=="left"?this._relativeX-r<this.element.width():this._relativeX-r>-this.element.width())&&(!this._containerX||this.model.targetHome?this._transform(this._containerX+this._relativeX-r,0,this._isTransitionElement()):i)))},_touchEnd:function(r){var u=r.changedTouches?r.changedTouches[0]:r;t.listenTouchEvent(this._nbHome,t.moveEvent(),this._touchMoveHandler,!0,this);this._isOpened()||(n.isFunction(t.isIOS7)?t.isIOS7():!1)||(this._containerX?this._hide():(this._relativeX=u.clientX-this._startSwipeOffsetX,this._relativeY=u.clientY-this._startSwipeOffsetY,(this.model.direction=="left"?this._startSwipeOffsetX<50:this._startSwipeOffsetX>this._nbHome.width()-50)&&(this._relativeX>30||this._relativeX<-30?this._show():this._hide())));this._data={targetElement:this._nbHome,element:this.element,direction:this._swipeDirection};this.model.enableListView?n.extend(this._data,{listview:this._lb}):i;this._trigger("swipe",this._data);t.listenTouchEvent(this._nbHome,t.endEvent(),this._touchEndHandler,!0,this);t.listenTouchEvent(this._nbHome,"mouseleave",this._touchEndHandler,!0,this)},open:function(){this.model.isPaneOpen||this._show()},close:function(){this.model.isPaneOpen||(this._data={element:this.element},this.model.enableListView?n.extend(this._data,{listview:this._lb}):i,this._trigger("beforeClose",this._data),this._hide())},toggle:function(){this.model.isPaneOpen||(this._isOpened()?this.close():this.open())}})}(jQuery,Syncfusion),function($,ej,undefined){ej.widget("ejListViewBase","ej.ListViewBase",{_addToPersist:["selectedItemIndex","checkedIndices"],defaults:{height:null,width:null,selectedItemIndex:-1,enableGroupList:!1,enableAjax:!1,enableCache:!1,enablePersistence:!1,ready:null,load:null,itemRequestCount:5,totalItemsCount:null,loadComplete:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,ajaxComplete:null,ajaxSettings:{type:"GET",cache:!1,async:!0,dataType:"html",contentType:"html",url:"",data:{}},renderTemplate:!1,templateId:null,persistSelection:!1,preventSelection:!1,dataSource:[],query:null,allowVirtualScrolling:!1,virtualScrollMode:"normal",showHeader:!1,showHeaderBackButton:!1,cssClass:"",headerTitle:"Title",headerBackButtonText:null,enableFiltering:!1,enableCheckMark:!1,checkedIndices:[],locale:"en-US"},observables:["selectedItemIndex","dataSource"],selectedItemIndex:ej.util.valueFunction("selectedItemIndex"),dataSource:ej.util.valueFunction("dataSource"),checkedIndices:ej.util.valueFunction("checkedIndices"),_updateModelItems:function(){var ang_attr,ang_li,ele,ul,groupid,element,groupTitle,element1,primaryKey,parentPrimaryKey;if(this.model.items=eval(this.model.items),ang_attr=this.model.items,ang_attr.length){for(ul=ej.buildTag("ul.e-m-clearall"),i=0;i<ang_attr.length;i++)ang_attr[i].items=[],ang_li=ej.buildTag("li"),this.model.items[i].template&&ang_li.html(this.model.items[i].template),!this.model.items[i].childId&&this.model.items[i].href&&(this.model.items[i].childId="page_"+parseInt(Math.random().toFixed(3)*1e3)),this.model.items[i].renderTemplate&&(this._storedTemplate[i]||(this.model.items[i].templateId?(ele=this._tempContent.find("#"+this.model.items[i].templateId).remove(),this._storedTemplate[i]=ele[0].nodeName&&ele[0].nodeName.toLowerCase()=="script"?ej.getClearString(ele[0].innerHTML):ele[0].outerHTML):this._storedTemplate[i]=this.model.items[i].template,this.model.items[i].templateId=this._storedTemplate[i])),this.model.fieldSettings&&(this.model.fieldSettings=$.extend(this.defaults.fieldSettings,this.model.fieldSettings)),ul.append(ang_li);this.element.append(ul)}else for(ul=this.element.find(">ul"),groupid=1,ulindex=0;ulindex<ul.length;ulindex++){for(this._listitems=$(ul[ulindex]).find(">li"),index=0;index<this._listitems.length;index++)for(element=this._listitems[index],ej.getAttrVal(element,"data-ej-primarykey")==null&&$(element).find("ul").length?(primaryKey=Math.round(Math.random()*100),$(element).attr("data-ej-primarykey",primaryKey)):primaryKey="",groupTitle=ej.getAttrVal($(ul[ulindex]),"data-ej-grouplistitle")?ej.getAttrVal($(ul[ulindex]),"data-ej-grouplistitle"):"GroupList"+groupid,this.model.items.push(this._itemsObjectCollection($(this._listitems[index]),primaryKey,null,groupTitle)),this._nestedListitems=$(this._listitems[index]).find("ul >li"),index1=0;index1<this._nestedListitems.length;index1++)element1=this._nestedListitems[index1],ej.getAttrVal(element1,"data-ej-primarykey")==null&&$(element1).find("ul").length?(primaryKey=Math.round(Math.random()*100),$(element1).attr("data-ej-primarykey",primaryKey)):primaryKey="",parentPrimaryKey=ej.getAttrVal($($(element1).parent()).closest("li"),"data-ej-primarykey"),this.model.items.push(this._itemsObjectCollection($(this._nestedListitems[index1]),primaryKey,parentPrimaryKey,groupTitle));groupid++}},_load:function(){if(this._orgEle=this.element.clone(),this.tempcount=0,this._index=0,this._items=[],this._checkedValues=[],this._checkedValues=this.model.checkedIndices,this.model.id=this.element[0].id,this.model.load&&this._trigger("load"),this.model.fieldSettings=eval(this.model.fieldSettings),this.model.fieldSettings&&this.model.query!=null){this._dataUrl=this.model.dataSource;var proxy=this;this.dataSource().executeQuery(eval(this.model.query)).done(function(n){proxy.model.dataSource=n.result;proxy._renderControl()})}else this.model.allowVirtualScrolling||this._renderControl()},_loadVirtualData:function(n){var f=this._renderLists(),u,r,i,s,c,t,e,h,o;if($.views.helpers({_checkAjaxUrls:this._checkAjaxUrl,_checkImgUrls:this._checkImgUrl,_checkIsChecked:this._checkIsCheck,Object:this,ej:ej}),this.jsRender=ej.buildTag("script#"+this.model.id+"_Template","",{},{type:"text/x-jsrender"}),this.jsRender[0].text=ej.browserInfo().name=="msie"&&ej.browserInfo().version<10?f[0].outerHTML.replace(/>/g,">"):f[0].outerHTML.replace(/>/g,">"),this.jsChildRender=ej.buildTag("script#"+this.model.id+"_ChildTemplate","",{},{type:"text/x-jsrender"}),u=ej.buildTag("ul."+this._prefixClass+"childcontainer "+this._prefixClass+"list-hdr "+this._prefixClass+"clearall"),f.addClass(this._prefixClass+"childli"),u[0].innerHTML="{{for items}}"+f[0].outerHTML+"{{/for}}",r=n,r)for(u.empty().html($(this.jsRender).render(r)),i=u.clone().find("li"),s="",this._initEJCheckBox&&this._initEJCheckBox(u),c=this,t=0;t<r.length;t++)r[t]&&r[t].attributes&&$.each(r[t].attributes,function(n,r){r&&r.name.toLowerCase()=="class"&&(s=$(i[t]).attr("class"))}),this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal"?(e=this.realUllength,this.model.enableCheckMark&&($(this.element.find("li").eq(e).find(".e-chkbox-wrap")).length!=0?(h=$(this.element.find("li").eq(e).find(".e-chkbox-wrap"))[0],o=h.getAttribute("aria-checked")=="true"?!0:!1,$($(i[t]).find(".e-lv-check")).ejCheckBox({checked:o})):(o=!1,this._removeIndex!=t?$($(i[t]).find(".e-lv-check")).ejCheckBox({checked:o}):$(i[t]).find(".e-lv-check").remove())),$(i[t]).find(".e-lv-check").length!=0&&$(i[t]).find(".e-lv-check").parent().addClass("e-lv-checkdiv"),this.element.find("li").eq(e).replaceWith(i[t]),this._removeEmptyElements(),this.scrollerObj.refresh()):this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="continuous"&&(this.model.enableCheckMark&&$($(i[t]).find(".e-lv-check")).ejCheckBox(),$(i[t]).find(".e-lv-check").parent().addClass("e-lv-checkdiv"),this._lContainer.find("ul").append(i[t]),this._removeEmptyElements(),this.scrollerObj.refresh()),this.realUllength+=1},_removeEmptyElements:function(){this.eLi=this.element.find("li."+this._prefixClass+"list");this.eLi.removeEleEmptyAttrs();this.eLi.find("."+this._prefixClass+"chevron-right_01").removeEleEmptyAttrs()},_itemStyle:function(){var n=ej.isNullOrUndefined(this.model.itemHeight)?this.model.itemHeight:this.model.itemHeight.toString().replace("px",""),t=ej.isNullOrUndefined(this.model.itemHeight)?"min-height:20px;":"min-height:"+n+"px;height:"+n+"px";return{style:t}},_initDataSource:function(n){var t=this._savedQueries;this._savedQueries=this.model.query.clone();t=t.range(0,parseInt(this.model.height/20));var i=ej.DataManager(n),r=i.executeLocal(t);return{parent:r,child:[]}},_renderControl:function(){var proxy=this,hdr,innerDiv,group,length,title,groupdiv,ul,i,dmycount,$listEle,eLi,ulItems;if(this.element.addClass(this._prefixClass+"parentlv "+this.model.cssClass),this._lbEle=ej.buildTag("div."+this._rootCSS),this._lbEle.addClass("subpage"),this._lContainer=ej.buildTag("div."+this._prefixClass+"list-container#"+this.model.id+"_container"),ul=this._hasDataSource()?this.element.find(">ul"):this.element.find("ul:first"),this.model.showHeader&&(hdr=this._renderHeader(this.model.id,!1,this.model.headerTitle,this.model.headerBackButtonText),this._lbEle.prepend(hdr)),this._hasDataSource()&&!this.model.renderTemplate&&this.element.empty(),this.model.renderTemplate&&(this.model.templateId?this._tempContent.find("#"+this.model.templateId).length&&(this._template=this._tempContent.find("#"+this.model.templateId),ej.destroyWidgets(this._template),this._template[0].nodeName.toLowerCase()!="script"&&this._template.remove(),this._template=this._template[0].nodeName&&this._template[0].nodeName.toLowerCase()=="script"?ej.getClearString(this._template[0].innerHTML):this._template[0].outerHTML):(ej.destroyWidgets(this.element),this._template=this.element.html(),this.element.empty()),this._lContainer.addClass(this._prefixClass+"template-list")),!this.model.renderTemplate||this._hasDataSource()||this.model.enableGroupList){if(!this.model.renderTemplate||this.model.renderTemplate&&this._hasDataSource()||this.model.renderTemplate&&this.model.enableGroupList){if(this._model_index=0,this.model.enableGroupList){if(this._lContainer.addClass(this._prefixClass+"grouped"),innerDiv=ej.buildTag("div."+this._prefixClass+"grouplist"),ul=this.element.children(),ul.length||this.dataSource().length)for(group=this.dataSource().length?ej.DataManager(this.dataSource()).executeLocal(ej.Query().from(this.dataSource()).group(this.model.fieldSettings.groupID)):ej.DataManager(this.model.items).executeLocal(ej.Query().from(this.model.items).group(this.model.fieldSettings.groupID)),length=group.length,i=0;i<length;i++)this._items=group[i].items,this._hasDataSource()?(ulItem=ej.buildTag("ul","",{},{"data-ej-grouplisttitle":group[i].key}),this._lbEle.append(ulItem)):ulItem=ul[i],title=this._hasDataSource()?group[i].key:ej.getAttrVal($(ulItem),"data-ej-grouplisttitle","GroupList"+(i+1)),$(ulItem).attr("data-ej-grouplisttitle",title),groupdiv=ej.buildTag("div."+this._prefixClass+"groupdiv",ej.buildTag("div."+this._prefixClass+"grouptitle",title)),innerDiv.append(groupdiv.append(this._renderListItems($(ulItem).addClass(this._prefixClass+"grouped"))));else this._template&&(ej.destroyWidgets(this._template),innerDiv[0].innerHTML=this._template);this._lContainer.append(innerDiv);ej.widget.init&&ej.widget.init(innerDiv)}else{if(this._hasDataSource())for(ul=ej.buildTag("ul"),this._items=this.dataSource(),this._items=eval(this._items),j=0;j<this._items.length;j++)this._items[j].href&&!this._items[j].childId&&(this._items[j].childId="page_"+parseInt(Math.random().toFixed(3)*1e3));if(ul.length){if(ej.destroyWidgets(ul),this._lContainer.append(this._renderListItems(ul)),this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal")for(dmycount=Math.round(this.model.height/20),i=0;i<=this._items.length-dmycount;i++)$listEle=ej.buildTag("li",null,null,this._itemStyle()),this.dummyUl.push($listEle[0]),this._lContainer.find("ul").append(this.dummyUl)}else this._template&&(ej.destroyWidgets(this._template),this._lContainer[0].innerHTML=this._template)}this.element.prepend(this._lbEle);this.model.enableFiltering&&this._createFilterWrapper(this._lbEle);this._setHeightWidth();this._lContainer.ejScroller({height:this._lContainer.outerHeight(),width:0,scrollerSize:20,scroll:function(n){(n.source=="key"||n.source=="wheel"||n.source!="button"&&n.source!="thumb"&&n.source!="custom")&&proxy.model!=null&&proxy._onScroll(n)},thumbEnd:function(n){proxy.model!=null&&proxy._onScroll(n)},scrollEnd:function(n){n.scrollData.source=="button"&&proxy.model!=null&&proxy._onScroll(n)}});this.scrollerObj=this._lContainer.ejScroller("instance");this._lbEle.append(this._lContainer);ej.widget.init&&ej.widget.init(this._lContainer);eLi=this.element.find("li."+this._prefixClass+"list");eLi.removeEleEmptyAttrs();eLi.find("."+this._prefixClass+"chevron-right_01").removeEleEmptyAttrs();ej.widget.init&&ej.widget.init(this._lbEle);ulItems=this.element.find("ul");ulItems.find("li:first").addClass(this._prefixClass+"firstitem");ulItems.find("li:last").addClass(this._prefixClass+"lastitem");this._liEl=this.element.find("li");this.selectedItemIndex()>=0&&!this.model.preventSelection&&this.model.persistSelection&&!ej.getBooleanVal(ulItems[this.selectedItemIndex()],"data-preventselection",this.model.preventSelection)&&ej.getBooleanVal(ulItems[this.selectedItemIndex()],"data-persistselection",this.model.persistSelection)&&(this._currentItem=$(this._liEl[this.selectedItemIndex()]),this._prevItem=this._currentItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"));$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"lv-checkdiv");this.model.renderTemplate&&$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark");$(this.element.find("."+this._prefixClass+"lv-check").closest("li."+this._prefixClass+"list")).addClass(this._prefixClass+"list-check");$(this.element.find("."+this._prefixClass+"lv-input").closest("."+this._prefixClass+"lv-filter")).addClass(this._prefixClass+"lv-inputdiv");this._wireEvents()}}else this.element.append(this._lbEle.append(this._lContainer)),$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark"),this._template&&(this._lContainer.append(this._template),ej.widget.init&&ej.widget.init(this._lContainer));this._setHeightWidth();this.model.height!==null&&this._lContainer.height()>this.model.height&&this._refreshScroller(this._lContainer,!1);this.scrollerObj&&(this.scrollerObj.refresh(),$(this.scrollerObj.element).find(".e-vhandlespace").css("height",$(this.scrollerObj.element).find(".e-vhandlespace").height()-1));this.model.loadComplete&&this._trigger("loadComplete")},_createFilterWrapper:function(n){var t=this._createFilterDiv(),i=ej.buildTag("a."+this._prefixClass+"lv-anchor",ej.buildTag("span."+this._prefixClass+"input-btn"),{},{Title:"Clear text","data-role":"none"});$(t).append(i);n.append(t)},_refreshScroller:function(n,t){this.model.virtualScrollMode=="continuous"&&(this._lContainer.find(".e-content, .e-vhandle,.e-vhandle div").removeAttr("style"),this._lContainer.css({display:"block"}),this.scrollerObj&&(this.scrollerObj.model.height=this._lContainer.height(),this.scrollerObj.refresh(),this.scrollerObj.option("scrollTop",0)));n.find(".e-vhandle div").removeAttr("style");hgt=t?this.model.showHeader&&this.model.enableFiltering?this.model.height-(ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")+ej.getDimension($(id).find("."+this._prefixClass+"lv-filter"),"outerHeight"))-2:this.model.showHeader?this.model.height-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")-2:this.model.enableFiltering?this.model.height-ej.getDimension($(id).find("."+this._prefixClass+"lv-filter"),"outerHeight")-2:this.model.height-2:this.model.showHeader&&this.model.enableFiltering?this.model.height-(ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")+$("."+this._prefixClass+"lv-filter").height())-2:this.model.showHeader?this.model.height-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")-2:this.model.enableFiltering?this.model.height-$("."+this._prefixClass+"lv-filter").height()-2:this.model.height-2;this.scrollerObj&&(this.scrollerObj.model.height=hgt)},_renderListItems:function(n){var u,e,i,r,f,t;if(n.addClass(this._prefixClass+"list-hdr "+this._prefixClass+"clearall"),this._liItems=n.find("li"),(this._liItems.length&&!this._hasDataSource()||this._hasDataSource())&&(this._renderParentChildTemplate(),this._hasDataSource()||this.model.enableGroupList||(this._items=this.model.items),u=this._items,e=this,i=this.model.allowVirtualScrolling?this._initDataSource(u):this._filterParentChild(u),i.child.length&&this._childRendering(i.child),i.parent))for(n.empty().html($(this.jsRender).render(i.parent)),r=n.find(">li"),f="",t=0;t<r.length;t++)i.parent[t]&&i.parent[t].attributes&&($.each(i.parent[t].attributes,function(n,i){i&&i.name.toLowerCase()=="class"&&(f=$(r[t]).attr("class"))}),$(r[t]).addEleAttrs(i.parent[t].attributes),$(r[t]).addClass(f));return this._initEJCheckBox&&this._initEJCheckBox(n),n},_onScroll:function(n){var i=this,u,o,s,t,h,r;value=this.model.query;this._temp=this._dataUrl;this.model.actionBegin&&this._trigger("actionBegin",{});var i=this,f=this.element.find("li")[0],e=Math.round(this.model.height/20);if(this.realUllength=e,this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal")u=$(f).outerHeight(),this.itemIndex=Math.round(this.scrollerObj.scrollTop()/u),this.realUllength=this.itemIndex,t=this.itemIndex,this.itemIndex>this._lContainer.outerHeight()/$(f).outerHeight()&&(t=Math.round(t),r=Math.round(this.itemIndex+e)),this.itemIndex<=t<=0&&(t=0),this._dataUrl.length==undefined&&this._temp==this._dataUrl?ej.DataManager&&this._dataUrl instanceof ej.DataManager&&(o=t==0?t:t-1,s=t==this.element.find("li").length?t:t+1,this._queryPromise(o,i,s+Math.ceil(this.model.height/u),n)):this._temp!=this._dataUrl?this._queryPromise(t,i,this._listitems.length,n):this._dataUrl.length>0&&this._loadQueryData(t,r,i);else if(this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="continuous"&&this.element.find("li").length-2<=(this.scrollerObj.scrollTop()+this.model.height)/this.element.find("li").outerHeight()&&(this.lastScrollPosition=this.scrollerObj.scrollTop(),t=this.element.children().length,t<=0&&(t=0),this._oldStartValue&&(t=this._oldStartValue),h=this.model.totalItemsCount?this.model.totalItemsCount:this._items.length,this.element.find("li").length<h-1)){if(this._dataUrl.length==undefined){if(r=t+this.model.itemRequestCount,ej.DataManager&&this._dataUrl)if(t<=r)this._queryPromise(t,i,r,n);else return!1;this._oldStartValue=t+this.model.itemRequestCount}if(this._dataUrl.length>0){if(this._isScrollComplete)return;this._loadQueryData(i.realUllength,i.realUllength+this.model.itemRequestCount,i)}}},_loadQueryData:function(n,t,i){this._isScrollComplete=t>=this._items.length?!0:!1;this._updateLoadingClass(!0);var r=this.dataSource();this._loadVirtualData(r.slice(n,t))._updateLoadingClass();i.model.virtualScrollMode=="continuous"&&(i.scrollerObj.option("scrollTop",i.lastScrollPosition),i.scrollerObj.refresh())},_updateLoadingClass:function(n){var t=this.element.attr("id");return n?($("#"+t+" .e-list-container.e-scroller >ul").addClass("e-load"),$(".e-lv .e-list.e-state-default").css("opacity","0.5")):($("#"+t+" .e-list-container.e-scroller >ul").removeClass("e-load"),$(".e-lv .e-list.e-state-default").css("opacity","1")),this},_queryPromise:function(n,t,i,r){this._trigger("itemRequest",{event:r,isInteraction:!0});var u=this._savedQueries.clone(),f=this._dataUrl.executeQuery(u.range(n,i));this._updateLoadingClass(!0);f.done(function(i){t._trigger("actionBeforeSuccess",i);t.realUllength=n;t._loadVirtualData(i.result);t.model.virtualScrollMode=="continuous"&&(t.scrollerObj.refresh(),t.scrollerObj.option("scrollTop",t.lastScrollPosition),t._updateLoadingClass(!1));t._trigger("actionSuccess",i)}).fail(function(n){t._trigger("actionFailure",n)}).always(function(n){t._trigger("actionComplete",n)})},_filterParentChild:function(n){var t=ej.DataManager(n),i=t.executeLocal(ej.Query().from(n).where(ej.Predicate(this.model.fieldSettings.parentPrimaryKey,ej.FilterOperators.notEqual,null)).group(this.model.fieldSettings.parentPrimaryKey)),r=t.executeLocal(ej.Query().from(n).where(ej.Predicate(this.model.fieldSettings.parentPrimaryKey,ej.FilterOperators.equal,null)));return{parent:r,child:i}},_childRendering:function(n){var t=this;n.length&&(t.element.append($(t.jsChildRender).render(n)),$.each(n,function(i,r){var e,f,u;for(ej.widget.init&&ej.widget.init(t.element.find("#child"+r.key)),e=t.element.find("#child"+r.key).find("ul"),f=e.find("li"),k=0,u=0;u<f.length;u++)n[k].items[u]&&n[k].items[u].attributes&&$(f[u]).addEleAttrs(n[k].items[u].attributes);k++}))},_renderParentChildTemplate:function(){var t=this._renderLists(),i,n,r;$.views.helpers({_checkAjaxUrls:this._checkAjaxUrl,_checkImgUrls:this._checkImgUrl,_checkIsChecked:this._checkIsCheck,Object:this,ej:ej});this.jsRender=ej.buildTag("script#"+this.model.id+"_Template","",{},{type:"text/x-jsrender"});this.jsRender[0].text=ej.browserInfo().name=="msie"&&ej.browserInfo().version<10?t[0].outerHTML.replace(/>/g,">"):t[0].outerHTML.replace(/>/g,">");this.jsChildRender=ej.buildTag("script#"+this.model.id+"_ChildTemplate","",{},{type:"text/x-jsrender"});i=ej.buildTag("ul."+this._prefixClass+"childcontainer "+this._prefixClass+"list-hdr "+this._prefixClass+"clearall");t.addClass(this._prefixClass+"childli");i[0].innerHTML="{{for items}}"+t[0].outerHTML+"{{/for}}";n=ej.buildTag("div."+this._rootCSS+" subpage "+this._prefixClass+"childitem","",{},{id:"{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}",style:"display:none"});r=ej.buildTag("div."+this._prefixClass+"list-container","",{},{id:"{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}_container"});this.model.showHeader&&n.append(this._renderHeader("{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}",!0,"Title"));this.model.enableFiltering&&this._createFilterWrapper(n);n.append(r.append(i));ej.browserInfo().name=="msie"&&ej.browserInfo().version<10?this.jsChildRender[0].text=n[0].outerHTML.replace(/>/g,">"):this.jsChildRender[0].innerHTML=n[0].outerHTML.replace(/>/g,">")},_renderChild:function(n){this._currentItem.attr("data-childid",n);this._currentItem.attr("data-childtitle")||this._currentItem.attr("data-childtitle",this._currentItem.text());this._createListDiv(n);this._div.hide();this._container=ej.buildTag("div."+this._prefixClass+"list-container#"+n+"_container");this.element.append(this._div)},_getText:function(n){return $(n).clone().children().remove().end().text()},_checkImgUrl:function(){var n=this.getRsc("helpers","Object"),t=this.data[n.model.fieldSettings.imageUrl];return $.support.pushstate||(t=typeof App=="object"?App.route.makeUrlAbsolute(t,!0):t),"<img src = "+t+" class='"+n._prefixClass+"list-img "+n._prefixClass+"rel "+n._prefixClass+"user-select'/>"},_checkAjaxUrl:function(){var t=this.data.href,u=this.data.childId,e=this.data.renderTemplate,o=this.data.templateId,n=this.getRsc("helpers","Object"),f=this.getRsc("helpers","ej"),r=n._currentPage(n),i;t&&t.indexOf("#")!=-1&&t!="#"?n._storedContent[u]||(r.find(t).show(),i=r.find(t).clone(),r.find(t).hide(),n._storedContent[u]=i[0].nodeName&&i[0].nodeName.toLowerCase()=="script"?f.getClearString(i[0].innerHTML):i[0].outerHTML):n._storedContent[this.index]&&(n._storedContent=f._pushValue(n._storedContent,"",this.index))},_currentPage:function(n){return n._prefixClass=="e-m-"?ej.getCurrentPage():$("body")},_checkIsCheck:function(){return this.data[this.getRsc("helpers","Object").model.fieldSettings.checked]?!0:!1},_onTouchStartHandler:function(n){if(this._mouseDown={x:ej.isNullOrUndefined(n.clientX)?n.touches[0].clientX:n.clientX,y:ej.isNullOrUndefined(n.clientY)?n.touches[0].clientY:n.clientY},$(n.target.parentElement).hasClass(this._prefixClass+"disable")||$(n.currentTarget).hasClass(this._prefixClass+"disable"))return!1;ej.isDevice()||ej._preventDefaultException(n.target,this._preventDefaultException)||n.preventDefault&&n.preventDefault();ej.isWindows&&ej.isWindows()&&ej._touchStartPoints(n,this);this._currentItem=$(n.currentTarget);this._scroll=!1;ej.getBooleanVal(this._currentItem,"data-preventSelection",this.model.preventSelection)||this._addSelection();this.model.renderMode!="windows"||this.model.windows.preventSkew||this._currentItem.addClass(this._prefixClass+"m-skew-center");this._triggerStartEvent(this._returnData());ej.listenEvents([this._liEl,this._liEl],[ej.endEvent(),ej.moveEvent(),ej.cancelEvent()],[this._touchEndDelegate,this._touchMoveDelegate,this._touchMoveDelegate],!1,this);$(window).on(ej.endEvent()+" MSPointerUp pointerup",this._docClickDelegate)},_onTouchMoveHandler:function(n){(ej.browserInfo().name=="msie"&&ej.browserInfo().version>8||ej.browserInfo().name!="msie")&&((ej.isNullOrUndefined(n.clientX)?n.changedTouches[0].clientX!==this._mouseDown.x:n.clientX)||(ej.isNullOrUndefined(n.clientY)?n.changedTouches[0].clientY!==this._mouseDown.y:n.clientY))&&(this._isMoved=!0,ej.isMobile()&&(!ej.isWindows||ej.isWindows&&!ej.isWindows()||ej.isWindows&&ej.isWindows()&&ej._isTouchMoved(n,this))&&(this._scroll=!0,ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)?this._prevItem&&this._prevItem[0]!=this._currentItem[0]&&this._removeSelection():this._removeSelection(),this.model.renderMode!="windows"||this.model.windows.preventSkew?!ej.getBooleanVal(this._currentItem,"data-preventselection",this.model.preventSelection)&&this._prevItem&&ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)&&this._prevItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"):ej._removeSkewClass(this._currentItem)))},_onTouchEndHandler:function(n){var u,r,t,i,f,e;if(this._isFromAjax=!1,ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)||this._removeSelection(),this.model.renderMode!="windows"||this.model.windows.preventSkew||ej._removeSkewClass(this._currentItem),this._scroll)return this._setCurrent(),this._unbindEvents(n),!1;if(!this._scroll){if(this._currentItem.find("."+this._prefixClass+"lv-check").length&&(u=this._currentItem.find("."+this._prefixClass+"lv-check"),this._prefixClass!="e-"||ej.isNullOrUndefined(n)||$(n.target).closest(".e-lv-checkdiv").length||this._toggleCheckboxValue(u)),r=this._currentItem.attr("data-childheaderbackbuttontext")==undefined?this._currentItem.closest("."+this._rootCSS+"").find("."+this._prefixClass+"header").length&&!this.model.showHeaderBackButton?this._currentItem.closest("."+this._rootCSS+"").find("."+this._prefixClass+"header ."+this._prefixClass+"htitle").text():"Back":ej.getAttrVal(this._currentItem,"data-childheaderbackbuttontext"),t=this._currentItem.attr("data-href"),this._currentItem.attr("data-navigateUrl"))this._touchEndEventHandler();else{if(i=this._isInsideNavigation?this._tempContent.find("[data-ajaxurl='"+this._convertToRelativeUrl(t)+"']"):this.element.find("[data-ajaxurl='"+this._convertToRelativeUrl(t)+"']"),ej.getBooleanVal(this._currentItem,"data-loadajax",this.model.enableAjax&&typeof t!="undefined"||!typeof t)&&(!this.model.enableCache||i.length==0)){i.length&&i.remove();(this._prefixClass=="e-"&&this._currentItem.hasClass("e-arrow")||this._prefixClass!="e-")&&this.loadAjaxContent(t,r);this._unbindEvents(n);this._isInsideNavigation&&this._nearestND.model.contentId&&this._closeNavigation();return}t&&t.indexOf("#")!=-1&&this._currentPage(this).find("#"+t.replace("#","")).length&&(this._renderChild(ej.getAttrVal(this._currentItem,"data-childid","page_"+parseInt(Math.random().toFixed(3)*1e3))),f=ej.buildTag("div."+this._prefixClass+"content",this._storedContent[this._currentItem.attr("data-childid")]),this._div.append(this._container.append(f)),ej.widget.init&&ej.widget.init(this._div));this._updateContent(this._currentItem,r);this.model.ready&&this._trigger("ready");this._isInsideNavigation&&(e=this._nearestND.model.contentId?!this._currentItem.attr("data-childid")||this._currentItem.attr("data-href"):!(this._currentItem.attr("data-childid")||this._currentItem.attr("data-href")));this._isInsideNavigation&&e&&this._closeNavigation();this._touchEndEventHandler(n)}this._prevItem=this._currentItem}this._unbindEvents(n)},_hasValue:function(n,t){for(var i=0;i<n.length;i++)if(n[i]==t)return!0},_generateData:function(n,t){var i=ej.DataManager(n).executeLocal(ej.Query().from(this.model.dataSource).where(ej.Predicate(typeof ej.getAttrVal(this._currentItem,"data-id")=="undefined"?this.model.fieldSettings.text:this.model.fieldSettings.id,ej.FilterOperators.equal,t)).group(t))[0];return i?i.items[0]:[]},_closeNavigation:function(){this.element.closest("."+this._prefixClass+"nb").ejNavigationDrawer("close")},_setCurrent:function(){this._prevItem&&ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)&&(this._currentItem=this._prevItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"))},_unbindEvents:function(n){n&&n.target.nodeName&&n.target.nodeName.toLowerCase()!="a"&&(this._scroll=!1);ej.listenEvents([this._liEl,this._liEl],[ej.endEvent(),ej.moveEvent(),ej.cancelEvent()],[this._touchEndDelegate,this._touchMoveDelegate,this._touchMoveDelegate],!0,this)},_addSelection:function(){this._scroll||(this._currentItem.closest("."+this._prefixClass+"list-container").find("."+this._prefixClass+"state-active").removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default"),this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"))},_removeSelection:function(){var n=this;n._currentItem.removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default")},_setHeightWidth:function(){if(this.model.autoAdjustHeight)this.element.height(window.innerHeight);else if(this.model.height)this.element.height(this.model.height);else{var n=this.element[0].scrollHeight?this.element[0].scrollHeight:ej.getDimension(this._lbEle.find("."+this._prefixClass+"list-container"),"outerHeight");this.element.height(n)}this.model.width&&this.element.width(this.model.width)},_touchEndEventHandler:function(n){this._triggerEndEvent(this._returnData(),n)},_docClick:function(){this._scroll&&(this._setCurrent(),$(document).off(ej.endEvent()+" MSPointerUp pointerup",this._docClickDelegate),ej.listenEvents([this._liEl,this._liEl],[ej.endEvent(),ej.moveEvent()],[this._touchEndDelegate,this._touchMoveDelegate],!0,this),$(window).off(ej.endEvent()+" MSPointerUp pointerup",this._docClickDelegate))},_popStateNavigation:function(n,t){t.pageUrl&&this.model.enableFiltering&&this._initializeFiltering($("div[data-url='"+t.pageUrl.replace("#","")+"']"))},_anchorClickHandler:function(n){if(this._scroll)return ej.blockDefaultActions(n),!1},_onResize:function(){var n=this;setTimeout(function(){n._setHeightWidth()},ej.isAndroid()?200:0)},_onScrollStop:function(n){ej.blockDefaultActions(n)},_createDelegates:function(){this._anchorClickDelegate=$.proxy(this._anchorClickHandler,this);this._keyup=$.proxy(this._onKeyUp,this);this._touchStartDelegate=$.proxy(this._onTouchStartHandler,this);this._touchEndDelegate=$.proxy(this._onTouchEndHandler,this);this._touchMoveDelegate=$.proxy(this._onTouchMoveHandler,this);this._resizeDelegate=$.proxy(this._onResize,this);this._popStateDelegate=$.proxy(this._popStateNavigation,this);this._docClickDelegate=$.proxy(this._docClick,this)},_wireEvents:function(n,t){var i=this._liEl||t,r,u;if(i){this._createDelegates();r=n?"unbind":"bind";this.model.autoAdjustHeight&&(u=!ej.isDevice()&&"onorientationchange"in window?"orientationchange":"resize",ej.listenEvents([window],[u],[this._resizeDelegate],n,this));ej.listenEvents([i.find("a"),this.element.find("."+this._prefixClass+"lv-input"),i,i],["click","keyup",ej.startEvent(),ej.cancelEvent()],[this._anchorClickDelegate,this._keyup,this._touchStartDelegate,this._touchMoveDelegate],n,this);this._lContainer.on("scrollstop",$.proxy(this._onScrollStop,this));$("body")[r]("viewpopstate",this._popStateDelegate);this.model.enableFiltering&&this._initializeFiltering(this._lbEle)}},_initializeFiltering:function(n){this._searchItems=$(n).find("."+this._prefixClass+"list");this._emptyFilterTextValue(n);n.find("."+this._prefixClass+'list[style*="display: none"]').show();this._elementText=[];for(var t=0;t<this._searchItems.length;t++)$(this._searchItems[t])?this._elementText.push($.trim($(this._searchItems[t]).html().replace(new RegExp("<[^<]+>","g"),"").toLowerCase())):this._elementText.push("")},_onKeyUp:function(n){for(var t=0;t<this._searchItems.length;t++)this._elementText[t].indexOf(n.target.value.toLowerCase())==-1?$(this._searchItems[t]).css("display","none"):$(this._searchItems[t]).css("display","")},_setModel:function(n){var r=!1,t,i;for(t in n)if(i="_set"+t.charAt(0).toUpperCase()+t.slice(1),this[i]||t=="locale")switch(t){case"locale":ej.ListView.Locale[n[t]]&&(this.model.locale=n[t],this._setCulture(),this._setHeaderVal(this.model.id,this.model.headerTitle,this.model.headerBackButtonText));break;default:this[i](n[t])}else r=!0;r&&this._refresh()},_setTheme:function(n){if(n&&(this.model.theme=n,this._lbEle.removeClass("e-m-dark e-m-light e-default").addClass("e-m-"+this.model.theme),this.model.enableFiltering&&this.element.find("."+this._prefixClass+"text-input").ejmTextBox("model.theme",this.model.theme),this.model.showHeader&&this._lbEle.find("#"+this.model.id+"_header").ejmHeader("model.theme",this.model.theme),this.element.find("."+this._prefixClass+"childitem").length)){$(this.element.find("."+this._prefixClass+"childitem")).removeClass("e-m-dark e-m-light e-default").addClass("e-m-"+this.model.theme);var t=this.element.find("."+this._prefixClass+"childitem ."+this._prefixClass+"header"),i=this;t.each(function(n,t){$(t).ejmHeader("model.theme",i.model.theme)})}},_setDataSource:function(n,t){this._hasDataSource()&&n&&(t&&(this.model.fieldSettings=t),this._refresh())},_hasDataSource:function(){return this.dataSource()&&this.dataSource().length},_getElement:function(n){return n?this.element.find("#"+n):this._lbEle},_isEnable:function(n){return n.hasClass(this._prefixClass+"state-disabled")?!1:!0},_refresh:function(){this._destroy();this.element.addClass(this._rootCSS);this._load()},_clearElement:function(){this.element.removeAttr("class style");this.element.empty().html(this._orgEle.html())},_destroy:function(){this._prefixClass=="e-"&&ej.listenEvents([window],["resize"],[this._resizeDelegate],!0,this);this._wireEvents(!0);this._clearElement()},loadAjaxContent:function(n,t){var i=this,r,u;this._isFromAjax=!0;this._renderChild(ej.getAttrVal(this._currentItem,"data-childid","page_"+parseInt(Math.random().toFixed(3)*1e3)));(!$.support.pushstate||ej.isWindowsWebView())&&(r={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n});this.model.ajaxBeforeLoad&&this._trigger("ajaxBeforeLoad",r);u={cache:i.model.ajaxSettings.cache,async:i.model.ajaxSettings.async,type:i.model.ajaxSettings.type,contentType:i.model.ajaxSettings.contentType,url:ej.isWindowsWebView()?n:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n,dataType:i.model.ajaxSettings.dataType,data:i.model.ajaxSettings.data,successHandler:function(r){var u=ej.buildTag("div."+this._prefixClass+"content",/<\/?body[^>]*>/gmi.test(r)?r.split(/<\/?body[^>]*>/gmi)[1]:r||""),f;i._div.append(i._container.append(u));i._updateContent(i._currentItem,t);(App.angularAppName||ej.angular.defaultAppName)&&ej.angular.compile(u);f={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxSuccess&&i._trigger("ajaxSuccess",f)},errorHandler:function(t,r,u){var f={xhr:t,textStatus:r,errorThrown:u,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxError&&i._trigger("ajaxError",f)},completeHandler:function(){var t={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxComplete&&i._trigger("ajaxComplete",t)}};ej.sendAjaxRequest(u)},selectItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&(this.setActive(n,t),this._currentItem=$(this._getElement(t).find("li."+this._prefixClass+"list")[n]),this._prevItem=this._currentItem,this._onTouchEndHandler())},setActive:function(n,t){n>=0&&(element=this._getElement(t),this._isEnable($(element.find("li."+this._prefixClass+"list")[n]))&&ej.getBooleanVal($(element.find("li."+this._prefixClass+"list")[n]),"data-persistSelection",this.model.persistSelection)&&(element.find("li."+this._prefixClass+"list."+this._prefixClass+"state-active").removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default"),this._currentItem=$(element.find("li."+this._prefixClass+"list")[n]),this._prevItem=this._currentItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active")))},deActive:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default")},enableItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).removeClass(this._prefixClass+"disable").addClass(this._prefixClass+"state-default").find("a").removeClass(this._prefixClass+"disable").find("."+this._prefixClass+"lv-check").ejCheckBox("enable")},disableItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).addClass(this._prefixClass+"disable").removeClass(this._prefixClass+"state-default").find("a").addClass(this._prefixClass+"disable").find("."+this._prefixClass+"lv-check").ejCheckBox("disable")},removeCheckMark:function(n,t){this._removeIndex=n;element=this._getElement(t);n>=0&&this._isEnable($(element.find("li."+this._prefixClass+"list")[n]))?$(element.find("li."+this._prefixClass+"list")[n]).find("."+this._prefixClass+"lv-checkdiv").remove():element.find("."+this._prefixClass+"lv-checkdiv").remove()},checkItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&this._setCheckboxValue($(this._getElement(t).find("."+this._prefixClass+"lv-check")[n]),!0)},unCheckItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&this._setCheckboxValue($(this._getElement(t).find("."+this._prefixClass+"lv-check")[n]),!1)},checkAllItem:function(n){var t=this;this._getElement(n).find("."+this._prefixClass+"lv-check").each(function(i,r){t._isEnable($(t._getElement(n).find("li."+t._prefixClass+"list")[i]))&&t._setCheckboxValue($(r),!0)})},unCheckAllItem:function(n){var t=this;this._getElement(n).find("."+this._prefixClass+"lv-check").each(function(i,r){t._isEnable($(t._getElement(n).find("li."+t._prefixClass+"list")[i]))&&t._setCheckboxValue($(r),!1)})},getActiveItem:function(n){return this._getElement(n).find("li."+this._prefixClass+"list."+this._prefixClass+"state-active")},getActiveItemText:function(n){return this._getElement(n).find("li."+this._prefixClass+"list."+this._prefixClass+"state-active").text()},getItemText:function(n,t){if(n>=0)return $(this._getElement(t).find("li."+this._prefixClass+"list")[n]).text()},getCheckedItems:function(n){return n!=undefined?this._getElement(n).find("input."+this._prefixClass+"lv-check:checked").closest("li."+this._prefixClass+"list"):this.element.find("input."+this._prefixClass+"lv-check:checked").closest("li."+this._prefixClass+"list")},getCheckedItemsText:function(n){return $(this.getCheckedItems(n)).map(function(){return $(this).text()}).get()},hasChild:function(n,t){if(n>=0)return this.element.find("#"+$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).attr("data-childid")).length?!0:!1},isChecked:function(n,t){if(n>=0)return $(this._getElement(t).find("li."+this._prefixClass+"list")[n]).find("input."+this._prefixClass+"lv-check").prop("checked")},showItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).css("visibility","")},hideItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).css("visibility","hidden")},show:function(n){this._getElement(n).css("visibility","")},hide:function(n){this._getElement(n).css("visibility","hidden")},_objectSplice:function(n,t){for(var i=0;i<n.length;i++)this.model.items.splice(t,0,n[i])},addItem:function(n,t,i){var o,s,f,u,e,r;if(t>=0)if(this._hasDataSource()){if(typeof n=="object")for(r=0;r<n.length;r++)this.dataSource().splice(t,0,n[r]);else this.dataSource().splice(t,0,this._itemsObjectCollection($(n),null,null,i));f=this.dataSource()}else $(".e-list-container").find("ul").length==0&&(o=ej.buildTag("ul"),s=ej.buildTag("li"),$(".e-list-container").find("div:first").append(o),$(".e-list-container > div > ul").append(s)),typeof n=="object"?this._objectSplice(n,t):this.model.items.splice(t,0,this._getLiAttributes(n,null,null,i)),f=this.model.items;else this._orgEle.children().append(n);if(u=this.model.enableGroupList?$(this.element.find("ul[data-ej-grouplisttitle= "+i+"]")):$(this.element.find("ul:visible")),ej.isNullOrUndefined(this.jsRender))this._renderControl(),$(this.element).find(".subpage").length>1&&$(this.element).find(".subpage:nth-child(2)").remove();else{if(typeof n=="object")for(r=0;r<n.length;r++)e=$($(this.jsRender).render(f[t+r])).insertBefore(u.children()[t]);else e=$($(this.jsRender).render(f[t])).insertBefore(u.children()[t]);ej.widget.init&&ej.widget.init(e);$(n).attrNotStartsWith(/^data-ej-/).length>0&&$(e).addEleAttrs($($(n).attrNotStartsWith(/^data-ej-/)))}this._processing(u);this._liEl=this.element.find("li."+this._prefixClass+"list");this._initEJCheckBox&&(this._initEJCheckBox(u),this.model.renderTemplate&&$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark"));this._setHeightWidth();this._wireEvents()},_processing:function(n){n.find("li."+this._prefixClass+"firstitem").removeClass(this._prefixClass+"firstitem");n.find("li:first").addClass(this._prefixClass+"firstitem");n.find("li."+this._prefixClass+"lastitem").removeClass(this._prefixClass+"lastitem");n.find("li:last").addClass(this._prefixClass+"lastitem");eLi=n.find("li."+this._prefixClass+"list");eLi.removeEleEmptyAttrs();eLi.find("."+this._prefixClass+"chevron-right_01").removeEleEmptyAttrs();n.find("."+this._prefixClass+"lv-check").parent().addClass(this._prefixClass+"lv-checkdiv");n.find("."+this._prefixClass+"lv-check").closest("li."+this._prefixClass+"list").addClass(this._prefixClass+"list-check");n.find("."+this._prefixClass+"lv-input").closest("."+this._prefixClass+"lv-filter").addClass(this._prefixClass+"lv-inputdiv")},removeItem:function(n,t){if(n>=0){element=this._getElement(t);var i=$(element.find("li."+this._prefixClass+"list")[n]).attr("data-childid");this.element.find($("#"+i).length)&&this.element.find($("#"+i)).remove();$(element.find("li."+this._prefixClass+"list")[n]).remove()}},clear:function(){this.element.empty().html();this._liEl=this.element.find("li."+this._prefixClass+"list")},getItemsCount:function(n){return this._getElement(n).find("li."+this._prefixClass+"list").length},getActiveItemData:function(){if(this.getActiveItem().attr("data-id"))return this._generateData(this.dataSource().length?typeof this.dataSource()=="string"?eval(this.dataSource()):this.dataSource():this.model.items,this.getActiveItem().attr("data-id"))}});ej.VirtualScrollMode={Normal:"normal",Continuous:"continuous"}}(jQuery,Syncfusion),function(n){function e(n,t){return n.indexOf(t)===0}function s(n,t){return n.substr(n.length-t.length)===t}function u(n){return(n+"").replace(w,"")}function g(n){return isNaN(n)?NaN:Math[n<0?"ceil":"floor"](n)}function o(n,t,i){for(var r=n.length;r<t;r++)n=i?"0"+n:n+"0";return n}function h(n,t,i){var r=t["-"],u=t["+"],f;switch(i){case"n -":r=" "+r;u=" "+u;case"n-":s(n,r)?f=["-",n.substr(0,n.length-r.length)]:s(n,u)&&(f=["+",n.substr(0,n.length-u.length)]);break;case"- n":r+=" ";u+=" ";case"-n":e(n,r)?f=["-",n.substr(r.length)]:e(n,u)&&(f=["+",n.substr(u.length)]);break;case"(n)":e(n,"(")&&s(n,")")&&(f=["-",n.substr(1,n.length-2)])}return f||["",n]}function nt(n,t,i){var l=i.groupSizes||[3],c=l[0],a=1,p=Math.pow(10,t),v=Math.round(n*p)/p,w;isFinite(v)||(v=n);n=v;var r=n+"",u="",e=r.split(/e/i),f=e.length>1?parseInt(e[1],10):0;r=e[0];e=r.split(".");r=e[0];u=e.length>1?e[1]:"";f>0?(u=o(u,f,!1),r+=u.slice(0,f),u=u.substr(f)):f<0&&(f=-f,r=o(r,f+1),u=r.slice(-f,r.length)+u,r=r.slice(0,-f));w=i["."]||".";u=t>0?w+(u.length>t?u.slice(0,t):o(u,t)):"";for(var s=r.length-1,y=i[","]||",",h="";s>=0;){if(c===0||c>s)return r.slice(0,s+1)+(h.length?y+h+u:u);h=r.slice(s-c+1,s+1)+(h.length?y+h:"");s-=c;a<l.length&&(c=l[a],a++)}return r.slice(0,s+1)+y+h+u}function tt(n,t,i){var s,r;if(!t||t==="i")return i.name.length?n.toLocaleString():n.toString();t=t||"D";var e=i.numberFormat,u=Math.abs(n),f=-1,h;t.length>1&&(f=parseInt(t.slice(1),10));s=t.charAt(0).toUpperCase();switch(s){case"D":h="n";u=g(u);f!==-1&&(u=o(""+u,f,!0));n<0&&(u=-u);break;case"N":r=e;r.pattern=r.pattern||["-n"];case"C":r=r||e.currency;r.pattern=r.pattern||["-$n","$n"];case"P":r=r||e.percent;r.pattern=r.pattern||["-n %","n %"];h=n<0?r.pattern[0]||"-n":r.pattern[1]||"n";f===-1&&(f=r.decimals);u=nt(u*(s==="P"?100:1),f,r);break;default:throw"Bad number format specifier: "+s;}return it(u,h,e)}function it(n,t,i){for(var f=/n|\$|-|%/g,r="",e,u;;){if(e=f.lastIndex,u=f.exec(t),r+=t.slice(e,u?u.index:t.length),!u)break;switch(u[0]){case"n":r+=n;break;case"$":r+=i.currency.symbol||"$";break;case"-":/[1-9]/.test(n)&&(r+=i["-"]||"-");break;case"%":r+=i.percent.symbol||"%"}}return r}function i(n,t,i){return n<t||n>i}function rt(n,t){var u=new Date,i,r;return t<100&&(i=n.twoDigitYearMax,i=typeof i=="string"?(new Date).getFullYear()%100+parseInt(i,10):i,r=u.getFullYear(),t+=r-r%100,t>i&&(t-=100)),t}function f(n,t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;i<r;i++)if(n[i]===t)return i;return-1}function c(n){return n.split(" ").join(" ").toUpperCase()}function r(n){for(var i=[],t=0,r=n.length;t<r;t++)i[t]=c(n[t]);return i}function ut(n,t,i){var u,o=n.days,e=n._upperDays;return e||(n._upperDays=e=[r(o.names),r(o.namesAbbr),r(o.namesShort)]),t=c(t),i?(u=f(e[1],t),u===-1&&(u=f(e[2],t))):u=f(e[0],t),u}function ft(n,t,i){var s=n.months,h=n.monthsGenitive||n.months,u=n._upperMonths,o=n._upperMonthsGen,e;return u||(n._upperMonths=u=[r(s.names),r(s.namesAbbr)],n._upperMonthsGen=o=[r(h.names),r(h.namesAbbr)]),t=c(t),e=f(i?u[1]:u[0],t),e<0&&(e=f(i?o[1]:o[0],t)),e}function l(n,t){for(var r,f=0,i=!1,u=0,e=n.length;u<e;u++)r=n.charAt(u),r=="'"?(i?t.push("'"):f++,i=!1):r=="\\"?(i&&t.push("\\"),i=!i):(t.push(r),i=!1);return f}function et(n,t,i,r){if(!n)return null;var u=0,f=0,e=null;t=t.split("");length=t.length;for(var o=function(n){for(var i=0;t[u]===n;)i++,u++;return i>0&&(u-=1),i},s=function(t){var r=new RegExp("^\\d{1,"+t+"}"),i=n.substr(f,t).match(r);return i?(i=i[0],f+=i.length,parseInt(i,10)):null},h=function(t,i){for(var r=0,s=t.length,e,o,u;r<s;r++)if(e=t[r],o=e.length,u=n.substr(f,o),i&&(u=u.toLowerCase()),u==e)return f+=o,r+1;return null},c=function(n){for(var t=0,r=n.length,i=[];t<r;t++)i[t]=(n[t]+"").toLowerCase();return i},l=function(n){var t={};for(var i in n)t[i]=c(n[i]);return t};u<length;u++)ch=t[u],ch==="d"&&(count=o("d"),r._lowerDays||(r._lowerDays=l(r.days)),e=count<3?s(2):h(r._lowerDays[count==3?"namesAbbr":"names"],!0));return e}function a(n,t){t=t||"F";var i,u=n.patterns,r=t.length;if(r===1){if(i=u[t],!i)throw"Invalid date format string '"+t+"'.";t=i}else r===2&&t.charAt(0)==="%"&&(t=t.charAt(1));return t}function v(n,r,f){var w,yt,h,g,nt,s,wt,b,ct;n=u(n);r=u(r);var o=f.calendar,lt=ej.globalize._getDateParseRegExp(o,r),at=new RegExp(lt.regExp).exec(n);if(at===null)return null;var vt=lt.groups,y=null,a=null,v=null,tt=null,l=0,p,it=0,ot=0,st=0,k=null,ht=!1;for(w=0,yt=vt.length;w<yt;w++)if(h=at[w+1],h){var pt=vt[w],d=pt.length,c=parseInt(h,10);switch(pt){case t.DAY_OF_MONTH_DOUBLE_DIGIT:case t.DAY_OF_MONTH_SINGLE_DIGIT:if(v=c,i(v,1,31))return null;break;case t.MONTH_THREE_LETTER:case t.MONTH_FULL_NAME:if(a=ft(o,h,d===3),i(a,0,11))return null;break;case t.MONTH_SINGLE_DIGIT:case t.MONTH_DOUBLE_DIGIT:if(a=c-1,i(a,0,11))return null;break;case t.YEAR_SINGLE_DIGIT:case t.YEAR_DOUBLE_DIGIT:case t.YEAR_FULL:if(y=d<4?rt(o,c):c,i(y,0,9999))return null;break;case t.HOURS_SINGLE_DIGIT_12_HOUR_CLOCK:case t.HOURS_DOUBLE_DIGIT_12_HOUR_CLOCK:if(l=c,l===12&&(l=0),i(l,0,11))return null;break;case t.HOURS_SINGLE_DIGIT_24_HOUR_CLOCK:case t.HOURS_DOUBLE_DIGIT_24_HOUR_CLOCK:if(l=c,i(l,0,23))return null;break;case t.MINUTES_SINGLE_DIGIT:case t.MINUTES_DOUBLE_DIGIT:if(it=c,i(it,0,59))return null;break;case t.SECONDS_SINGLE_DIGIT:case t.SECONDS_DOUBLE_DIGIT:if(ot=c,i(ot,0,59))return null;break;case t.MERIDIAN_INDICATOR_FULL:case t.MERIDIAN_INDICATOR_SINGLE:if(ht=o.PM&&(h===o.PM[0]||h===o.PM[1]||h===o.PM[2]),!ht&&(!o.AM||h!==o.AM[0]&&h!==o.AM[1]&&h!==o.AM[2]))return null;break;case t.DECISECONDS:case t.CENTISECONDS:case t.MILLISECONDS:if(st=c*Math.pow(10,3-d),i(st,0,999))return null;break;case t.DAY_OF_WEEK_THREE_LETTER:v=et(n,r,f,o);break;case t.DAY_OF_WEEK_FULL_NAME:if(ut(o,h,d===3),i(tt,0,6))return null;break;case t.TIME_ZONE_OFFSET_FULL:if((g=h.split(/:/),g.length!==2)||(p=parseInt(g[0],10),i(p,-12,13))||(nt=parseInt(g[1],10),i(nt,0,59)))return null;k=p*60+(e(h,"-")?-nt:nt);break;case t.TIME_ZONE_OFFSET_SINGLE_DIGIT:case t.TIME_ZONE_OFFSET_DOUBLE_DIGIT:if(p=c,i(p,-12,13))return null;k=p*60}}if(s=new Date,b=o.convert,wt=b?b.fromGregorian(s)[0]:s.getFullYear(),y===null&&(y=wt),a===null&&(a=0),v===null&&(v=1),b){if(s=b.toGregorian(y,a,v),s===null)return null}else if((s.setFullYear(y,a,v),s.getDate()!==v)||tt!==null&&s.getDay()!==tt)return null;return ht&&l<12&&(l+=12),s.setHours(l,it,ot,st),k!==null&&(ct=s.getMinutes()-(k+s.getTimezoneOffset()),s.setHours(s.getHours()+parseInt(ct/60,10),ct%60)),s}function y(n,i,r){function o(n,t){var i,r=n+"";return t>1&&r.length<t?(i=it[t-2]+r,i.substr(i.length-t,t)):r}function ut(){return v||d?v:(v=rt.test(i),d=!0,v)}var e=r.calendar,b=e.convert,u,k,w,f,tt,h;if(!i||!i.length||i==="i")return r&&r.name.length?b?y(n,e.patterns.F,r):n.toLocaleString():n.toString();k=i==="s";i=a(e,i);u=[];var s,it=["0","00","000"],v,d,rt=/([^d]|^)(d|dd)([^d]|$)/g,g=0,nt=/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g,c;for(!k&&b&&(c=b.fromGregorian(n));;){var ft=nt.lastIndex,p=nt.exec(i),et=i.slice(ft,p?p.index:i.length);if(g+=l(et,u),!p)break;if(g%2){u.push(p[0]);continue}w=p[0];f=w.length;switch(w){case t.DAY_OF_WEEK_THREE_LETTER:case t.DAY_OF_WEEK_FULL_NAME:tt=f===3?e.days.namesAbbr:e.days.names;u.push(tt[n.getDay()]);break;case t.DAY_OF_MONTH_SINGLE_DIGIT:case t.DAY_OF_MONTH_DOUBLE_DIGIT:v=!0;u.push(o(c?c[2]:n.getDate(),f));break;case t.MONTH_THREE_LETTER:case t.MONTH_FULL_NAME:h=c?c[1]:n.getMonth();u.push(e.monthsGenitive&&ut()?e.monthsGenitive[f===3?"namesAbbr":"names"][h]:e.months[f===3?"namesAbbr":"names"][h]);break;case t.MONTH_SINGLE_DIGIT:case t.MONTH_DOUBLE_DIGIT:u.push(o((c?c[1]:n.getMonth())+1,f));break;case t.YEAR_SINGLE_DIGIT:case t.YEAR_DOUBLE_DIGIT:case t.YEAR_FULL:h=c?c[0]:n.getFullYear();f<4&&(h=h%100);u.push(o(h,f));break;case t.HOURS_SINGLE_DIGIT_12_HOUR_CLOCK:case t.HOURS_DOUBLE_DIGIT_12_HOUR_CLOCK:s=n.getHours()%12;s===0&&(s=12);u.push(o(s,f));break;case t.HOURS_SINGLE_DIGIT_24_HOUR_CLOCK:case t.HOURS_DOUBLE_DIGIT_24_HOUR_CLOCK:u.push(o(n.getHours(),f));break;case t.MINUTES_SINGLE_DIGIT:case t.MINUTES_DOUBLE_DIGIT:u.push(o(n.getMinutes(),f));break;case t.SECONDS_SINGLE_DIGIT:case t.SECONDS_DOUBLE_DIGIT:u.push(o(n.getSeconds(),f));break;case t.MERIDIAN_INDICATOR_SINGLE:case t.MERIDIAN_INDICATOR_FULL:h=n.getHours()<12?e.AM?e.AM[0]:" ":e.PM?e.PM[0]:" ";u.push(f===1?h.charAt(0):h);break;case t.DECISECONDS:case t.CENTISECONDS:case t.MILLISECONDS:u.push(o(n.getMilliseconds(),3).substr(0,f));break;case t.TIME_ZONE_OFFSET_SINGLE_DIGIT:case t.TIME_ZONE_OFFSET_DOUBLE_DIGIT:s=n.getTimezoneOffset()/60;u.push((s<=0?"+":"-")+o(Math.floor(Math.abs(s)),f));break;case t.TIME_ZONE_OFFSET_FULL:s=n.getTimezoneOffset()/60;u.push((s<=0?"+":"-")+o(Math.floor(Math.abs(s)),2)+":"+o(Math.abs(n.getTimezoneOffset()%60),2));break;case t.DATE_SEPARATOR:u.push(e["/"]||"/");break;default:throw"Invalid date format pattern '"+w+"'.";}}return u.join("")}function p(n,t){return t.length?p(n[t[0]],t.slice(1)):n}var t;ej.globalize={};ej.cultures={};ej.cultures["default"]=ej.cultures["en-US"]=n.extend(!0,{name:"en-US",englishName:"English",nativeName:"English",language:"en",isRTL:!1,numberFormat:{pattern:["-n"],decimals:2,",":",",".":".",groupSizes:[3],"+":"+","-":"-",percent:{pattern:["-n %","n %"],decimals:2,groupSizes:[3],",":",",".":".",symbol:"%"},currency:{pattern:["($n)","$n"],decimals:2,groupSizes:[3],",":",",".":".",symbol:"$"}},calendars:{standard:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss"}}}},ej.cultures["en-US"]);ej.cultures["en-US"].calendar=ej.cultures["en-US"].calendar||ej.cultures["en-US"].calendars.standard;var w=/^\s+|\s+$/g,b=/^[+-]?infinity$/i,k=/^0x[a-f0-9]+$/i,d=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/;t={DAY_OF_WEEK_THREE_LETTER:"ddd",DAY_OF_WEEK_FULL_NAME:"dddd",DAY_OF_MONTH_SINGLE_DIGIT:"d",DAY_OF_MONTH_DOUBLE_DIGIT:"dd",MONTH_THREE_LETTER:"MMM",MONTH_FULL_NAME:"MMMM",MONTH_SINGLE_DIGIT:"M",MONTH_DOUBLE_DIGIT:"MM",YEAR_SINGLE_DIGIT:"y",YEAR_DOUBLE_DIGIT:"yy",YEAR_FULL:"yyyy",HOURS_SINGLE_DIGIT_12_HOUR_CLOCK:"h",HOURS_DOUBLE_DIGIT_12_HOUR_CLOCK:"hh",HOURS_SINGLE_DIGIT_24_HOUR_CLOCK:"H",HOURS_DOUBLE_DIGIT_24_HOUR_CLOCK:"HH",MINUTES_SINGLE_DIGIT:"m",MINUTES_DOUBLE_DIGIT:"mm",SECONDS_SINGLE_DIGIT:"s",SECONDS_DOUBLE_DIGIT:"ss",MERIDIAN_INDICATOR_SINGLE:"t",MERIDIAN_INDICATOR_FULL:"tt",DECISECONDS:"f",CENTISECONDS:"ff",MILLISECONDS:"fff",TIME_ZONE_OFFSET_SINGLE_DIGIT:"z",TIME_ZONE_OFFSET_DOUBLE_DIGIT:"zz",TIME_ZONE_OFFSET_FULL:"zzz",DATE_SEPARATOR:"/"};ej.globalize._getDateParseRegExp=function(n,i){var e=n._parseRegExp,s,w,o,b,r,k,d;if(e){if(s=e[i],s)return s}else n._parseRegExp=e={};for(var h=a(n,i).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),u=["^"],v=[],c=0,y=0,p=/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g,f;(f=p.exec(h))!==null;){if(w=h.slice(c,f.index),c=p.lastIndex,y+=l(w,u),y%2){u.push(f[0]);continue}o=f[0];b=o.length;switch(o){case t.DAY_OF_WEEK_THREE_LETTER:case t.DAY_OF_WEEK_FULL_NAME:case t.MONTH_FULL_NAME:case t.MONTH_THREE_LETTER:r="(\\D+)";break;case t.MERIDIAN_INDICATOR_FULL:case t.MERIDIAN_INDICATOR_SINGLE:r="(\\D*)";break;case t.YEAR_FULL:case t.MILLISECONDS:case t.CENTISECONDS:case t.DECISECONDS:r="(\\d{"+b+"})";break;case t.DAY_OF_MONTH_DOUBLE_DIGIT:case t.DAY_OF_MONTH_SINGLE_DIGIT:case t.MONTH_DOUBLE_DIGIT:case t.MONTH_SINGLE_DIGIT:case t.YEAR_DOUBLE_DIGIT:case t.YEAR_SINGLE_DIGIT:case t.HOURS_DOUBLE_DIGIT_24_HOUR_CLOCK:case t.HOURS_SINGLE_DIGIT_24_HOUR_CLOCK:case t.HOURS_DOUBLE_DIGIT_12_HOUR_CLOCK:case t.HOURS_SINGLE_DIGIT_12_HOUR_CLOCK:case t.MINUTES_DOUBLE_DIGIT:case t.MINUTES_SINGLE_DIGIT:case t.SECONDS_DOUBLE_DIGIT:case t.SECONDS_SINGLE_DIGIT:r="(\\d\\d?)";break;case t.TIME_ZONE_OFFSET_FULL:r="([+-]?\\d\\d?:\\d{2})";break;case t.TIME_ZONE_OFFSET_DOUBLE_DIGIT:case t.TIME_ZONE_OFFSET_SINGLE_DIGIT:r="([+-]?\\d\\d?)";break;case t.DATE_SEPARATOR:r="(\\"+n["/"]+")";break;default:throw"Invalid date format pattern '"+o+"'.";}r&&u.push(r);v.push(f[0])}return l(h.slice(c),u),u.push("$"),k=u.join("").replace(/\s+/g,"\\s+"),d={regExp:k,groups:v},e[i]=d};ej.globalize.addCulture=function(t,i){ej.cultures[t]=n.extend(!0,n.extend(!0,{},ej.cultures["default"],i),ej.cultures[t]);ej.cultures[t].calendar=ej.cultures[t].calendars.standard};ej.globalize.preferredCulture=function(n){return n=typeof n!="undefined"&&typeof n==typeof this.cultureObject?n.name:n,this.cultureObject=ej.globalize.findCulture(n),this.cultureObject};ej.globalize.setCulture=function(n){return ej.isNullOrUndefined(this.globalCultureObject)&&(this.globalCultureObject=ej.globalize.findCulture(n)),n=typeof n!="undefined"&&typeof n==typeof this.globalCultureObject?n.name:n,n&&(this.globalCultureObject=ej.globalize.findCulture(n)),ej.cultures.current=this.globalCultureObject,this.globalCultureObject};ej.globalize.culture=function(n){ej.cultures.current=ej.globalize.findCulture(n)};ej.globalize.findCulture=function(t){var f,i,e,u,r,o;if(t){if(n.isPlainObject(t)&&t.numberFormat&&(f=t),typeof t=="string"){if(i=ej.cultures,i[t])return i[t];if(t.indexOf("-")>-1){if(e=t.split("-")[0],i[e])return i[e]}else for(u=n.map(i,function(n){return n}),r=0;r<u.length;r++)if(o=u[r].name.split("-")[0],o===t)return u[r];return ej.cultures["default"]}}else f=ej.cultures.current||ej.cultures["default"];return f};ej.globalize.format=function(n,t,i){var r=ej.globalize.findCulture(i);return typeof n=="number"?n=tt(n,t,r):n instanceof Date&&(n=y(n,t,r)),n};ej.globalize.parseInt=function(n,t,i){return Math.floor(this.parseFloat(n,t,i))};ej.globalize.getISODate=function(n){if(n instanceof Date)return n.toISOString()};ej.globalize.parseFloat=function(n,t,i){var p,o,s,r,w,tt,g,nt,it,a,rt;typeof t=="string"&&(i=t,t=10);i=ej.globalize.findCulture(i);var v=NaN,f=i.numberFormat,y=i.numberFormat.pattern[0];if(n=n.replace(/ /g,""),n.indexOf(i.numberFormat.currency.symbol)>-1?(n=n.replace(i.numberFormat.currency.symbol||"$",""),n=n.replace(i.numberFormat.currency["."]||".",i.numberFormat["."]||"."),y=u(i.numberFormat.currency.pattern[0].replace("$",""))):n.indexOf(i.numberFormat.percent.symbol)>-1&&(n=n.replace(i.numberFormat.percent.symbol||"%",""),n=n.replace(i.numberFormat.percent["."]||".",i.numberFormat["."]||"."),y=u(i.numberFormat.percent.pattern[0].replace("%",""))),n=u(n),b.test(n))v=parseFloat(n,t);else if(!t&&k.test(n))v=parseInt(n,16);else{var c=h(n,f,y),l=c[0],e=c[1];l===""&&f.pattern[0]!=="-n"&&(c=h(n,f,"-n"),l=c[0],e=c[1]);l=l||"+";s=e.indexOf("e");s<0&&(s=e.indexOf("E"));s<0?(o=e,p=null):(o=e.substr(0,s),p=e.substr(s+1));tt=f["."]||".";g=o.indexOf(tt);g<0?(r=o,w=null):(r=o.substr(0,g),w=o.substr(g+tt.length));nt=f[","]||",";r=r.split(nt).join("");it=nt.replace(/\u00A0/g," ");nt!==it&&(r=r.split(it).join(""));a=l+r;w!==null&&(a+="."+w);p!==null&&(rt=h(p,f,y),a+="e"+(rt[0]||"+")+rt[1]);d.test(a)&&(v=parseFloat(a))}return v};ej.globalize.parseDate=function(n,t,i){var r,o,f,u,s,e;if(i=ej.globalize.findCulture(i),t){if(typeof t=="string"&&(t=[t]),t.length)for(u=0,s=t.length;u<s;u++)if(e=t[u],e&&(r=v(n,e,i),r))break}else{f=i.calendar.patterns;for(o in f)if(r=v(n,f[o],i),r)break}return r||null};ej.globalize.getLocalizedConstants=function(t,i){var r,u=t.replace("ej.","").split(".");return r=p(ej,u),n.extend(!0,{},r.Locale["default"],r.Locale[i?i:this.cultureObject.name])};n.extend(ej,ej.globalize)}(jQuery),function(n,t){t.widget("ejWaitingPopup","ej.WaitingPopup",{element:null,model:null,validTags:["div","span"],_setFirst:!1,_rootCSS:"e-waitingpopup",defaults:{showOnInit:!1,target:null,appendTo:null,showImage:!0,htmlAttributes:{},cssClass:"",text:null,template:null,create:null,destroy:null},dataTypes:{showOnInit:"boolean",showImage:"boolean",cssClass:"string"},_isTargetVisible:function(){return this.element.css("display")!="none"},show:function(){this._isTargetVisible()&&(this._refreshPanel(),this.maindiv.css("display","block"),this.model.showOnInit=!0)},hide:function(){this.maindiv.css("display","none");this.model.showOnInit=!1},refresh:function(){this._isTargetVisible()&&this._refreshPanel()},_setText:function(n){n?this.popupText?this.popupText.html(n):(this._generateTextTag(n),this._setContentPosition()):this.popupText&&(this.popupText.remove(),this.popupText=null)},_showImage:function(n){n?(this.popupImage=t.buildTag("span.e-image"),this.popupText?this.popupImage.insertBefore(this.popupText):this.maindiv.append(this.popupImage)):this.popupImage&&(this.popupImage.remove(),this.popupImage=null)},_setTemplate:function(){var i=this.model.template;typeof i=="string"&&(i=n(i));this.templateObj=typeof i=="object"&&typeof i.css=="function"?i:t.buildTag("div","",{"text-align":"center"}).append(i);this.templateObj.css({visibility:"visible",display:"block"});this.maindiv.append(this.templateObj)},_setTheme:function(n){this.maindiv.removeClass(this.model.cssClass).addClass(n)},_init:function(){this._initialize();this._render();this._wireEvents()},_wireEvents:function(){n(window).on("resize",n.proxy(this._resizeHandler,this))},_unwireEvents:function(){n(window).off("resize",n.proxy(this._resizeHandler,this))},_resizeHandler:function(){this.refresh()},_setModel:function(i){for(var r in i)switch(r){case"text":this._setText(i[r]);break;case"cssClass":this._setTheme(i[r]);break;case"htmlAttributes ":this._addAttr(i[r]);break;case"showOnInit":this._setVisibility(i[r]);break;case"showImage":this._showImage(i[r]);this._setContentPosition();break;case"target":this.model.target=i[r];this._setTarget();this.refresh();break;case"appendTo":this.model.appendTo=i[r];this._setTarget();t.isNullOrUndefined(this.model.appendTo)||this.model.appendTo=="document"||this.model.appendTo=="window"?n("body").append(this.maindiv):this.maindiv.appendTo(n(this.model.appendTo));this.refresh();break;case"template":this.maindiv.empty();i[r]?(this.model.template=i[r],this._setTemplate()):(this.model.template=i[r]=null,this._showImage(this.model.showImage),this.model.text&&this._generateTextTag(this.model.text));this._setContentPosition()}},_setTarget:function(){this.targetElement=this.model.target=="document"?n(document):this.model.target=="window"?n(window):this.model.target?n(this.model.target):this.element},_destroy:function(){this.maindiv.remove();this._unwireEvents()},_initialize:function(){this.maindiv=null;this.popupText=null;this.popupImage=null;this.templateObj=null;this.targetElement=null},_render:function(){this._setTarget();var i=n("#"+this.element[0].id+"_WaitingPopup").get(0);i&&n(i).remove();this.maindiv=t.buildTag("div.e-waitpopup-pane e-widget "+this.model.cssClass+"#"+this.element[0].id+"_WaitingPopup");this.model.template?this._setTemplate():(this._showImage(this.model.showImage),this.model.text&&this._generateTextTag(this.model.text));t.isNullOrUndefined(this.model.appendTo)||this.model.appendTo=="document"||this.model.appendTo=="window"?n("body").append(this.maindiv):this.maindiv.appendTo(n(this.model.appendTo));this._setVisibility(this.model.showOnInit);this._addAttr(this.model.htmlAttributes)},_refreshPanel:function(){this.maindiv.width(this.targetElement.outerWidth());this.maindiv.height(this.targetElement.outerHeight());this._setPanelPosition();this._setContentPosition()},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.maindiv.addClass(n):i.maindiv.attr(t,n)})},_setPanelPosition:function(){var i=t.util.getOffset(this.targetElement);this.model.appendTo!=null&&n(this.model.appendTo).length>0&&((this.targetElement.css("position")=="relative"||this.targetElement.css("position")=="absolute")&&this.targetElement[0]===n(this.model.appendTo)[0]?i={left:0,top:0}:(i.left-=this.targetElement.offsetParent().offset().left,i.top-=this.targetElement.offsetParent().offset().top));this.maindiv.css({position:"absolute",left:Math.ceil(i.left)+"px",top:Math.ceil(i.top)+"px","z-index":this._maxZindex()+1})},_setContentPosition:function(){if(this.model.template==null){var t=0,r=0,i,n=null;i=this.targetElement.outerHeight();this.popupText&&(t=this.popupText.outerHeight());this.popupImage&&(r=this.popupImage.outerHeight());this.popupImage&&(n=Math.ceil((i-(r+t))/2),this.popupImage.css("top",n+"px"));this.popupText&&(n||(n=Math.ceil((i-t)/2)),this.popupText.css("top",n+"px"))}else this.templateObj.css({position:"relative",left:Math.ceil((this.targetElement.outerWidth()-this.templateObj.outerWidth())/2),top:Math.ceil((this.targetElement.outerHeight()-this.templateObj.outerHeight())/2)})},_generateTextTag:function(n){this.popupText=t.buildTag("div.e-text",n);this.maindiv.append(this.popupText)},_setVisibility:function(n){n&&this._isTargetVisible()?this.show():this.hide()},_maxZindex:function(){return t.util.getZindexPartial(this.element)}})}(jQuery,Syncfusion),function(n,t){t.widget("ejButton","ej.Button",{element:null,model:null,validTags:["button","input"],_setFirst:!1,_rootCSS:"e-button",_requiresID:!0,defaults:{size:"normal",type:"submit",height:"",width:"",enabled:!0,htmlAttributes:{},text:null,contentType:"textonly",imagePosition:"imageleft",showRoundedCorner:!1,cssClass:"",prefixIcon:null,suffixIcon:null,enableRTL:!1,repeatButton:!1,timeInterval:"150",create:null,click:null,destroy:null},dataTypes:{size:"enum",enabled:"boolean",type:"enum",showRoundedCorner:"boolean",text:"string",contentType:"enum",imagePosition:"enum",prefixIcon:"string",suffixIcon:"string",cssClass:"string",repeatButton:"boolean",enableRTL:"boolean",timeInterval:"string",htmlAttributes:"data"},disable:function(){this.element.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1},enable:function(){this.element.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0},_init:function(){this._cloneElement=this.element.clone();this._initialize();this._render();this._controlStatus(this.model.enabled);this._wireEvents(this.model.repeatButton);this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n);t=="disabled"&&n=="disabled"&&i.disable()})},_destroy:function(){this._off(this.element,"blur",this._btnBlur);this.element.removeClass(this.model.cssClass+"e-ntouch e-btn e-select e-disable e-corner e-widget").removeAttr("role aria-describedby aria-disabled");this.element.removeClass("e-btn-"+this.model.size);this.model.contentType&&this.model.contentType!="textonly"?this.element.append(this._cloneElement.text())&&this.imgtxtwrap[0].remove():""},_setModel:function(n){for(var t in n)switch(t){case"size":this._setSize(n[t]);break;case"height":this._setHeight(n[t]);break;case"width":this._setWidth(n[t]);break;case"contentType":this._setContentType(n[t]);break;case"imagePosition":this._setImagePosition(n[t]);break;case"text":this._setText(n[t]);break;case"prefixIcon":this._setMajorIcon(n[t]);break;case"suffixIcon":this._setMinorIcon(n[t]);break;case"enabled":this._controlStatus(n[t]);break;case"showRoundedCorner":this._roundedCorner(n[t]);break;case"cssClass":this._setSkin(n[t]);break;case"enableRTL":this._setRTL(n[t]);break;case"timeInterval":this.model.timeInterval=n[t];break;case"htmlAttributes":this._addAttr(n[t])}},_setSize:function(n){this.element.removeClass("e-btn-mini e-btn-medium e-btn-small e-btn-large e-btn-normal");this.element.addClass("e-btn-"+n)},_setType:function(n){this.element.prop({type:n})},_setHeight:function(n){this.element.css("height",n)},_setWidth:function(n){this.element.css("width",n)},_setText:function(n){this.buttonType=="inputButton"?this.element.val(n):this.model.contentType==t.ContentType.TextOnly?this.element.html(n):this.textspan.html(n);this.model.text=n},_setMajorIcon:function(n){this.majorimgtag.removeClass(this.model.prefixIcon);this.majorimgtag.addClass(n);this.model.prefixIcon=n},_setMinorIcon:function(n){this.minorimgtag.removeClass(this.model.suffixIcon);this.minorimgtag.addClass(n);this.model.suffixIcon=n},_setContentType:function(n){n!=this.model.contentType&&(this.element.empty(),this.model.contentType=n,this._renderButtonNormal())},_setImagePosition:function(n){this.model.contentType==t.ContentType.TextAndImage&&n!=this.model.imagePosition&&(this.element.empty(),this.model.imagePosition=n,this._renderButtonNormal())},_setRTL:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_controlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(n){this.model.cssClass!=n&&(this.element.removeClass(this.model.cssClass),this.element.addClass(n))},_initialize:function(){t.isTouchDevice()||this.element.addClass("e-ntouch");this.element.is("input")?this.buttonType="inputButton":this.element.is("a")||this.element.is("button")?this.buttonType="tagButton":this.element.removeClass("e-button");this.element.attr("type")?this.model.type=this.element.attr("type"):this._setType(this.model.type);this._timeout=null},_render:function(){this._setSize(this.model.size);this._setHeight(this.model.height);this._setWidth(this.model.width);this._setRTL(this.model.enableRTL);this.element.addClass(this.model.cssClass+" e-btn e-select e-widget").attr("role","button");this.buttonType=="inputButton"?(this.element.addClass("e-txt"),this.model.text!=null&&this.model.text!=""?this.element.val(this.model.text):this.model.text=this.element.val()):this._renderButtonNormal();this._roundedCorner(this.model.showRoundedCorner);this.model.text&&this.element.attr("aria-describedby",this.model.text)},_renderButtonNormal:function(){if((this.model.text==null||this.model.text=="")&&(this.model.text=this.element.html()),this.element.empty(),this.textspan=t.buildTag("span.e-btntxt",this.model.text),this.model.contentType.indexOf("image")>-1&&(this.majorimgtag=t.buildTag("span").addClass(this.model.prefixIcon),this.minorimgtag=t.buildTag("span").addClass(this.model.suffixIcon),this.imgtxtwrap=t.buildTag("div")),this.model.contentType==t.ContentType.TextAndImage){switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.majorimgtag,this.textspan);break;case t.ImagePosition.ImageBottom:this.majorimgtag.attr("style","display:inherit");this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageTop:this.majorimgtag.attr("style","display:inherit");this.imgtxtwrap.append(this.majorimgtag,this.textspan)}this.element.append(this.imgtxtwrap)}else this.model.contentType==t.ContentType.ImageTextImage?(this.imgtxtwrap.append(this.majorimgtag,this.textspan,this.minorimgtag),this.element.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageBoth?(this.imgtxtwrap.append(this.majorimgtag,this.minorimgtag),this.element.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageOnly?(this.imgtxtwrap.append(this.majorimgtag),this.element.append(this.imgtxtwrap)):(this.element.addClass("e-txt"),this.element.html(this.model.text))},_roundedCorner:function(n){n==!0?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},_wireEvents:function(t){t&&(this._on(this.element,"mousedown",this._btnRepatMouseClickEvent),this._on(n(document),"mouseup",this._mouseUpClick),this._on(this.element,"keyup",this._btnRepatKeyUpEvent),this._on(n(document),"keypress",this._btnRepatKeyDownEvent));this._on(this.element,"click",this._btnMouseClickEvent);this._on(this.element,"blur",this._btnBlur)},_btnBlur:function(){this.element.removeClass("e-animate")},_btnMouseClickEvent:function(n){var t=this,i;if(this.element.addClass("e-animate"),!t.model.enabled)return!1;t.element.hasClass("e-disable")||(i={target:n.currentTarget,e:n,status:t.model.enabled},t._trigger("click",i))},_btnRepatMouseClickEvent:function(n){var t=this,i;if(!t.model.enabled)return!1;t.element.hasClass("e-disable")||(i={status:t.model.enabled},(n.button==0||n.which==1)&&(t._timeout=setInterval(function(){t._trigger("click",{target:n.currentTarget,status:t.model.enabled})},this.model.timeInterval)))},_mouseUpClick:function(){clearTimeout(this._timeout)},_btnRepatKeyDownEvent:function(n){var t=this,i;t.element.hasClass("e-disable")||(i={status:t.model.enabled},(n.keyCode==32||n.keyCode==13)&&t._trigger("click",i))},_btnRepatKeyUpEvent:function(n){(n.keyCode==32||n.keyCode==13)&&clearTimeout(this._timeout)}});t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"};t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.ButtonType={Button:"button",Reset:"reset",Submit:"submit"}}(jQuery,Syncfusion),function($,ej,undefined){return this.__calcQuickextends=function(n,t){function r(){this.constructor=n}for(var i=0;i<t.length;i++)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},CalcEngine=function(parentObject){var _weekEndType,FormulaArgumentType;this.parentObject=parentObject;this._useFormulaValues=!1;this._multiTick=!1;this._isErrorString=!1;this._ignoreBracet=!1;this._libraryFunctions=new HashTable;this._customlibraryFunctions=new HashTable;this._refreshedCells=new HashTable;this._treatStringsAsZero=!0;this._supportLogicalOperators=!1;this._isRangeOperand=!1;this._uniqueStringMarker=String.fromCharCode(127);this._isParseArgumentSeparator=!1;this._isParseDecimalSeparatorChanged=!1;this._enableFormulaErrorValidation=!1;this._validPrecedingChars=" (+-*/^&<>=";this._validFunctionNameChars="_";this.bMARKER=String.fromCharCode(146);this.bMARKER2=this.bMARKER+this.bMARKER;this.tic='"';this._parseDecimalSeparator=".";this.parseDateTimeSeparator="/";this._parseArgumentSeparator=",";this._rightBracket=String.fromCharCode(131);this._leftBracket=String.fromCharCode(130);this.iFMarker="qIF"+String.fromCharCode(130);this.braceLeft="{";this.braceRight="}";this._braceRightNLeft=")(";this.computedValueLevel=0;this._circCheckList=[];this._maximumRecursiveCalls=100;this._sortedSheetNames=null;this.trueValueStr="TRUE";this.falseValueStr="FALSE";this.useDatesInCalcs=!1;this.sheetToken="!";this.namedRanges=null;this.undefinednamedRange=null;this.undefinedsheetNamedRnages=null;this.namerangecellcollection=null;this.sheetNamedRangesOriginalNames=null;this.sheetNamedRangeCellCollection=null;this.sheetDependentNamedRangeCells=null;this.namedRangesOriginalNames=null;this.namedRangeValues=null;this.rangeValues=null;this.dependentNamedRangeCells=null;this.namedRangesSized=null;this._namedRangesNonScoped=null;this.char_add="+";this.char_and="i";this.char_ANDop=String.fromCharCode(140);this.char_divide="/";this.char_ELSEop=String.fromCharCode(144);this.char_EM="r";this.char_EP="x";this.char_equal="=";this.char_greater=">";this.char_greatereq="h";this.char_IFop=String.fromCharCode(142);this.char_less="<";this.char_lesseq="f";this.char_multiply="*";this.char_noequal="p";this.char_NOTop=String.fromCharCode(145);this.char_or="w";this.char_ORop=String.fromCharCode(139);this.char_subtract="-";this.char_THENop=String.fromCharCode(143);this.char_XORop=String.fromCharCode(141);this.chartic="'"[0];this._string_and="&";this._string_E="E";this._string_EM="E-";this._string_empty="";this._string_EP="E+";this._string_fixedreference="$";this._string_greatereq=">=";this._string_lesseq="<=";this._string_noequal="<>";this._string_or="^";this.token_add="a";this.token_and="c";this.token_ANDop=String.fromCharCode(133);this.token_divide="d";this.token_ELSEop=String.fromCharCode(137);this.token_EM="v";this.token_EP="t";this.token_equal="e";this.token_greater="g";this.token_greatereq="j";this.token_IFop=String.fromCharCode(135);this.token_less="l";this.token_lesseq="k";this.token_multiply="m";this.token_noequal="o";this.token_NOTop=String.fromCharCode(138);this.token_or=String.fromCharCode(126);this.token_ORop=String.fromCharCode(132);this.token_subtract="s";this.token_THENop=String.fromCharCode(136);this.token_XORop=String.fromCharCode(134);this.tokens=[this.token_add,this.token_subtract,this.token_multiply,this.token_divide,this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal,this.token_and,this.token_or];this._dateTime1900=new Date(1900,0,1,0,0,0);this._preserveLeadingZeros=!1;this._ignoreCellValue=!1;this._errorStrings=null;this._cell="";this._iterationMaxCount=0;this._supportRangeOperands=!1;this._allowShortCircuitIFs=!1;this._processUpperCaseFormula="";this._processUpperCaseIvalue=0;this._processUpperCaseSheet="";this._markerChar="`";this._rowMaxCount=-1;this._columnMaxCount=-1;this._isInteriorFunction=!1;this._tempSheetPlaceHolder=String.fromCharCode(133);this.sheetFamilyID=0;this._supportsSheetRanges=!0;this._markers="()+-*/=><.,!";this._formulaInfoTable=null;this._dependentFormulaCells=null;this._dependentCells=new HashTable;this._calculatingSuspended=!1;this._inAPull=!1;this._useDatesInCalcs=!1;this._excelLikeComputations=!1;this._rethrowLibraryComputationExceptions=!1;this.formulaErrorStrings=["binary operators cannot start an expression","cannot parse","bad library","invalid char in front of","number contains 2 decimal points","expression cannot end with an operator","invalid characters following an operator","invalid character in number","mismatched parentheses","unknown formula name","requires a single argument","requires 3 arguments","invalid Math argument","requires 2 arguments","#NAME?","too complex","circular reference: ","missing formula","improper formula","invalid expression","cell empty","bad formula","empty expression","","mismatched string quotes","wrong number of arguments","invalid arguments","iterations do not converge","Control named '{0}' is already registered","Calculation overflow","Missing sheet"];this._parseDateTimeSeparator="/";this._millisecondsOfaDay=864e5;this.treat1900AsLeapYear=!1;this._oaDate=new Date(1899,11,30);this._saveStringsText="";this._processedCells=[];this.ignoreValueChanged=!1;this._breakedFormulaCells=[];this._tempBreakedFormulaCells=[];this._lockDependencies=!1;this._useDependencies=!1;this._inHandleIterations=!1;this._inRecalculateRange=!1;this._useNoAmpersandQuotes=!1;this._calcID=0;this._operators_cannot_start_an_expression=0;this._reservedWord_AND=1;this._reservedWord_XOR=2;this._reservedWord_IF=3;this._number_contains_2_decimal_points=4;this._reservedWord_ELSE=5;this._reservedWord_NOT=6;this._invalid_char_in_number=7;this._invalid_characters_following_an_operator=6;this._mismatched_parentheses=8;this._unknown_formula_name=9;this._requires_a_single_argument=10;this._requires_3_args=11;this._invalid_Math_argument=12;this._requires_2_args=13;this._bad_index=14;this._too_complex=15;this._circular_reference_=16;this._missing_formula=17;this._improper_formula=18;this._invalid_expression=19;this._cell_empty=20;this._bad_formula=21;this._empty_expression=22;this._virtual_mode_required=23;this._mismatched_tics=24;this._wrong_number_arguments=25;this._invalid_arguments=26;this._iterations_dont_converge=27;this._calculation_overflow=29;this._already_registered=28;this._missing_sheet=30;this._alwaysComputeDuringRefresh=!0;this._libraryComputationException=null;this._dependencyLevel=0;this._isDisposed=undefined;this._forceRefreshCall=!1;this.grid=this.parentObject;this._enableLookupTableCaching=0;this._lookupTables=new HashTable;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1;this._addFunction=function(n,t){return(n=n.toUpperCase(),this._libraryFunctions.getItem(n)==undefined)?(this._libraryFunctions.add(n,t),!0):!1};this._addToFormulaDependentCells=function(n){var t=this.cell,i=CalcEngine.getSheetFamilyItem(this.grid),r;i.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(r=i.parentObjectToToken.getItem(this.grid),t=r+t);this.getDependentFormulaCells().containsKey(t)?this.getDependentFormulaCells().getItem(t).containsKey(n)||this.getDependentFormulaCells().getItem(t).add(n,n):(this.getDependentFormulaCells().add(t,new HashTable),this.getDependentFormulaCells().getItem(t).add(n,n))};this._arrayRemove=function(n,t){for(var i=null;(i=n.indexOf(t))!==-1;)n.splice(i,1);return n};this._canGetRowIndex=function(n){var t=0;if(t<n.length&&n[t]==this.sheetToken){for(t++;t<n.length&&n[t]!=this.sheetToken;)t++;t++}while(t<n.length&&this._isLetter(n[t]))t++;return t<n.length?this._isDigit(n[t])?!0:!1:!1};this._checkAddNonScopedNamedRange=function(n){var i=-1,t;(i=n.indexOf("!"))>-1&&(t=n.substring(i+1),this._namedRangesNonScoped.containsKey(t)||this._namedRangesNonScoped.add(t,this.namedRanges.getItem(n)))};this._checkHasCharBeforeNumber=function(n){for(var i=!1,t=n.length-1;t>0;t--)if(this._isLetter(n[t])){i=!0;break}return i};this._checkIfScopedRange=function(n,t){var r,s,u,i,o;t="";var f="NaN",h=this.getSheetID(this.grid),e=CalcEngine.getSheetFamilyItem(this.grid);if(n[0]==this.sheetToken.toString()&&(r=n.indexOf(this.sheetToken,1),r>1&&!isNaN(parseInt(n.substring(1,r-1)))&&(n=n.substring(r+1))),s="!"+h.toString()+"!",e.sheetNameToToken==null)return f;for(u=e.sheetNameToToken.keys(),i=0;i<u.length;i++)e.sheetNameToToken.getItem(u[i]).toString()==s&&(o=(u[i]+"!"+n).toUpperCase(),this.getNamedRanges().containsKey(o)&&(t=this.getNamedRanges().getItem(o).toUpperCase(),f=t));return f};this._checkUnderTolerance=function(n,t){return Math.abs(t)>this._absoluteZero?Math.abs((n-t)/t)<this._iterationMaxTolerance:Math.abs(n-t)<this._iterationMaxTolerance};this._combineStack=function(n,t,i){var r="",f,u,e;if(i.length==2){for(f=3,u=n.substring(t);f>1;)e=i.pop().toString(),r=e==this.tic+this.tic?r+this.tic:e+r,u=f==3?e:u,f--;i[0]==this.tic+this.tic&&i.pop();r=n.length==t&&this._isTextEmpty(u.split(this.tic).join(""))?r+u:r;i.push(r)}return i};this._computeMath=function(n,t){var u=0,r,l=!1,a,i,f,e,s,y,h,c,o;if(n.length>0&&(n=this.splitArgsPreservingQuotedCommas(n)[0]),a=[this.getParseArgumentSeparator(),":"],n.length>0&&(!this._isLetter(n[0])&&n[0]!=this.sheetToken&&n[0]!=this.bMARKER||n[0]=="u"&&this._isDigit(n[1]))&&this._indexOfAny(n,a)==-1){if(n=n.split("u").join("-").split("n").join(""),i=this._parseDouble(n),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}else if(n.length>0&&(n[0]==this.bMARKER||n[0]=="u"||n[0]=="n"||this._indexOfAny(n,this.tokens)>-1)){n=n.split("{").join("(");n=n.split("}").join(")");f="";e=Math.PI.toString();try{n.indexOf(e)>-1?(r=this._substring(n,1,n.indexOf(e)-2),r=this._isTextEmpty(r)?"1":r,f=this._indexOfAny(n,this.tokens)>-1?n.split(e.toString())[1]:"1",l=!0):r=this.computedValue(n)}catch(v){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(l)if(s=this.computedValue(r.toString()),f.indexOf("180")>-1)if(i=this._parseDouble(s),i)u=t(i*(Math.PI/180));else return this.getErrorStrings()[1].toString();else{if(y=this.computedValue(s+f),h=this._parseDouble(y),isNaN(h))return this.getErrorStrings()[1].toString();u=t(h*Math.PI)}else{if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}}else for(n=n.split("u").join("-"),c=this.getCellsFromArgs(n),o=0;o<c.length;o++){try{r=this.getValueFromArg(c[o])}catch(v){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(r.length>0){if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}break}return this.computeIsErr(u.toString())==this.trueValueStr?this.getErrorStrings()[4].toString():u.toString()};this._computeInteriorFunctions=function(n){var i,r,t,u;try{if(this._isTextEmpty(n))return n;for(this.computeFunctionLevel++,i=this._findLastqNotInBrackets(n);i>0;){if(r=n.substring(i).indexOf(this._rightBracket),r==-1)throw this.formulaErrorStrings[this._bad_formula];this._isInteriorFunction=!0;t=this._substring(n,i,r+1);t=this.computedValue(t);t==""||t[0]!=this.tic[0]||t[t.length-1]!=this.tic[0]||(u=this._substring(t,1,t.length-2),u.indexOf(this.tic)!=-1&&(this._multiTick=!0,u=u.split(this.tic).join("|")),t=this.tic+u+this.tic);t=this._markupResultToIncludeInFormula(t);n=this._isInteriorFunction?n.substring(0,i)+t+n.substring(i+r+1):n.substring(0,i)+t.split(this.tic).join("")+n.substring(i+r+1);this._isInteriorFunction=!1;i=this._findLastqNotInBrackets(n)}}catch(f){return f}finally{this.computeFunctionLevel--}return n};this._findAndCheckPrecedingChar=function(n,t,i){var r=n.indexOf(t,i);if(r>0)while(r>-1&&this.getValidPrecedingChars().indexOf(n[r-1])==-1)r=n.indexOf(t,r+1);return this._findAndCheckPrecedingCharCopy=n,r};this._findLastNonQB=function(n){var r=-1,i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>=0;--t)if(n[t]==this._rightBracket)i--;else if(n[t]==this._leftBracket)i++;else if(n[t]==this.bMARKER&&i==0){r=t;break}return r};this._findLastqNotInBrackets=function(n){for(var r=-1,i=!1,t=n.length-1;t>-1;){if(n[t]=="q"&&i){r=t;break}n[t]==this._leftBracket?i=!0:n[t]==this._rightBracket&&(i=!1);t--}return r};this._findNextSeparator=function(n,t){for(var i=0,r=!1;!r&&t<n.length;)n[t]=="q"?i++:n[t]==this._rightBracket?i--:i==0&&n[t]==this.getParseArgumentSeparator()&&(r=!0,t--),t++;return t.toString()};this._findNextEndIndex=function(n,t){for(var i=0,u=t,r=!1;!r&&t<n.Length;)n[t]=="["?i++:n[t]=="]"&&(i--,i==0&&(r=!0)),t++;return t-u};this._findNonQB=function(n){var r=-1,i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=0;t<n.length;++t)if(n[t]==this._rightBracket)i--;else if(n[t]==this._leftBracket)i++;else if(n[t]==this.bMARKER&&i==0){r=t;break}return r};this._findRightBracket=function(n,t){for(var i=0,r=!1;!r&&t<n.length;)n[t]=="q"?i++:i==0&&n[t]==this._rightBracket?(r=!0,t--):n[t]==this._rightBracket&&i--,t++;return r?t.toString():"NaN"};this._fromOADate=function(n){var t=new Date;return t.setTime(n*this._millisecondsOfaDay+Date.parse(this._oaDate)),t};this._getDateFromSerialDate=function(n){return this.treat1900AsLeapYear&&n>59&&(n-=1),new Date(this._oaDate.setDate(this._oaDate.getDate()+n))};_weekEndType=["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"];this._getDoubleArray=function(n){var i,t="",u=[],f,r,o,e;for(n=this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),r=0;r<f.length;r++)if(f[r].indexOf(":")>-1)for(o=this.getCellsFromArgs(f[r]),e=0;e<o.length;e++)t=this.getValueFromArg(o[e]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t.length>0&&(i=this._parseDouble(t),isNaN(i)?u.push(0):u.push(Number(i)));else t=this.getValueFromArg(f[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(Number(i))?u.push(0):u.push(i);return u};this._getDoubleArrayA=function(n){var t,i="",e=[],u,r,o,f;for(n=this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),r=0;r<u.length;r++)if(u[r].indexOf(":")>-1)for(o=this.getCellsFromArgs(u[r]),f=0;f<o.length;f++)i=this.getValueFromArg(o[f]),i.length>0&&(i==this.trueValueStr?t=1:(t=this._parseDouble(i),isNaN(Number(t))&&t==0),e.push(t));else i=this.getValueFromArg(u[r]),i==this.trueValueStr?t=1:(t=this._parseDouble(i.toString()),isNaN(t)&&(t=0)),e.push(t);return e};this._getFormulaArrayBounds=function(n,t,i){var o=this.colIndex(this.cell),r=this.rowIndex(this.cell),s="",v=this.getFormulaInfoTable().containsKey(this.cell)?this.getFormulaInfoTable().getItem(this.cell):null,h,u,f,e;for(s=v!=null?v.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o),h=1,u=1,f=1;f<=t;f++)if(o-f>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(o-f)+r.toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f),u=o-f,s!=null&&l!=s){u++;break}}for(e=1;e<=i;e++)if(r-e>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(u)+(r-e).toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u),h=r-e,s!=null&&l!=s){h++;break}}return this._getFormulaArrayBoundsfirstRowIndex=h,this._getFormulaArrayBoundsfirstColIndex=u,this._getFormulaArrayBoundslastRowIndex=h+t,this._getFormulaArrayBoundslastColIndex=u+i,!0};FormulaArgumentType={None:{},Range:{},CellReference:{},TwoTextWithNumber:{},TextWithNumber:{},Numbers:{},Text:{},Date:{}};this.formulaErrorStringCheck=function(n,t){var arguments=this.splitArgsPreservingQuotedCommas(n),e,b,c,o,u,v,y,p,w,h,l,s,r,d,f,i;switch(t){case FormulaArgumentType.None:if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}break;case FormulaArgumentType.Range:if(e="",o=arguments,o!=null)for(i=0;i<o.length;i++)if(u=o[i],u.indexOf(":")>-1){if(u[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}for(b=this.getCellsFromArgs(u),c=0;c<b.length;c++){try{e=this.getValueFromArg(c)}catch(nt){}if(e.length>0&&this.getErrorStrings().indexOf(e)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return e}}}else{try{e=this.getValueFromArg(u)}catch(nt){}if(e.length>0&&(h=this.formulaErrorStringCheck(e,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h}break;case FormulaArgumentType.CellReference:if(o=arguments,o!=null)for(i=0;i<o.length;i++)if(u=o[i],this._isCellReference(u)||u[0]!=this.tic){if(!this._isCellReference(u))return this.getErrorStrings()[5].toString()}else return this.getErrorStrings()[1].toString();break;case FormulaArgumentType.TwoTextWithNumber:if(v=this.formulaErrorStringCheck(arguments[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(v)>-1)return v;if(y=this.formulaErrorStringCheck(arguments[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(y)>-1)return y;if(arguments.length==3&&(p=this.formulaErrorStringCheck(arguments[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(p)>-1))return p;break;case FormulaArgumentType.TextWithNumber:l=0;w=0;var a=this.getValueFromArg(arguments[0].split(this.tic).join("")),k=Boolean(a),tt=arguments.length==2&&isNaN(typeof this.getValueFromArg(arguments[1])=="boolean"),l=isNaN(this._parseDouble(arguments[0].split(this.tic).join("")));if(l&&(r=this.getValueFromArg(arguments[0]),this.getErrorStrings().indexOf(r)>-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}if(w=isNaN(this._parseDouble(arguments[1].split(this.tic).join(""))),arguments.length==2&&w&&(h=this.formulaErrorStringCheck(arguments[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;break;case FormulaArgumentType.Text:for(f=arguments,i=0;i<f.length;i++){var a=this.getValueFromArg(f[i]),k=Boolean(a),l=isNaN(this._parseDouble(f[i].split(this.tic).join("")));if(l&&(r=this.getValueFromArg(f[i]),this.getErrorStrings().indexOf(r)>-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}}break;case FormulaArgumentType.Numbers:for(s=arguments,i=0;i<s.length;i++){var a=this.getValueFromArg(s[i].split(this.tic).join("")),k=Boolean(a),l=this._parseDouble(s[i].split(this.tic).join(""));if(isNaN(l)){if(r=this.getValueFromArg(s[i]),this.getErrorStrings().indexOf(r)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}if(!k&&isNaN(this._parseDouble(r))&&r!=""||s[i].includes(":")&&this._isCellReference(s[i])||r.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}break;case FormulaArgumentType.Date:for(d=0,f=arguments,i=0;i<f.length;i++){var a=this.getValueFromArg(f[i].split(this.tic).join("")),g=Boolean(a),r=this.getValueFromArg(f[i]);if(this.getErrorStrings().indexOf(r)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return r}if(!g&&isNaN(Date.parse(this._stripTics0(r)))&&isNaN(this._parseDouble(this._stripTics0(r)))&&r!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}return n};this._getSerialDateFromDate=function(n,t,i){var u=0,f,r,e;for(n<1900&&(n+=1900),f=!1;!f;){while(t>12)n++,t-=12;for(f=!0,r=new Date(n,t,1,-1).getDate();i>r;)r=new Date(n,t,1,-1).getDate(),t++,i-=r,f=!1;i<1&&(t--,r=new Date(n,t,1,-1).getDate(),i=r-i)}return e=Date.parse(n.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+i.toString()),isNaN(e)||(u=this._toOADate(new Date(e))),this.treat1900AsLeapYear&&u>59&&(u+=1),u};this._getSerialDateTimeFromDate=function(n){var t=this._toOADate(n);return this.treat1900AsLeapYear&&t>59&&(t+=1),t};this._getSheetTokenFromReference=function(n){var i="",t;if(n.length>2&&n[0]==this.sheetToken){for(t=1,i=this.sheetToken;t<n.length&&n[t]!=this.sheetToken;)i+=n[t],t++;i+=this.sheetToken}return i};this._getValueComputeFormulaIfNecessary=function(n,t,i){var e=!1,u=this.getFormulaInfoTable().getItem(this.cell),f,r,o,s;if(f=this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(i)+1,n,t):this.parentObject.getValueRowCol(this.getSheetID(i)+1,n,t),r=f!=null&&!(f.Length===0)?f:"",r[r.length-1]=="}"&&r[0]=="{"&&(r=this._substring(r,1,r.length-2)),r==""&&(u==null||u==undefined)||r!=""&&r[0]!=this.getFormulaCharacter()&&r[r.length-1]!="%")return u!=null&&r==u.getFormulaValue()?u.getFormulaValue():r;if(r.length>0&&r[0]==this.getFormulaCharacter()&&u==null){u=new FormulaInfo;u.setFormulaText(f.toString());this.getDependentFormulaCells().containsKey(this.cell)||this.getDependentFormulaCells().add(this.cell,new HashTable);o=!0;try{u.setParsedFormula(this.parseFormula(r))}catch(h){this._inAPull?(r=h,u=null):u.setFormulaValue(h);o=!1}o&&(u.setFormulaValue(this.computeFormula(u.getParsedFormula())),e=!0);u!=null&&(u.calcID=this._calcID,this.getFormulaInfoTable().containsKey(this.cell)||this.getFormulaInfoTable().add(this.cell,u),r=u.getFormulaValue()!=null?u.getFormulaValue():"")}return u!=null&&(this.getUseFormulaValues()||this.getCalculatingSuspended()&&(!this._inAPull||e)?r=u.getFormulaValue()!=null?u.getFormulaValue():"":e||(this._calcID==u.calcID?r=u.getFormulaValue():(r=this.computeFormula(u.getParsedFormula()),u.setFormulaValue(r),u.calcID=this._calcID))),(r==""||r==undefined)&&(r=""),s=this._parseDouble(r.substring(0,r.length-1)),r[r.length-1]!="%"||isNaN(s)||(r=(Number(s)/100).toString()),r};this._handleEmbeddedEs=function(n){for(var t=0,i,r;t>-1&&(t=n.indexOf(this._string_EP,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EP.length;r<n.length&&this._isDigit(n[r]);)r++;r!=t+this._string_EP.length&&(n=n.substring(0,t)+this.char_EP+this._substring(n,t+this._string_EP.length))}}t+=1}for(t=0;t>-1&&(t=n.indexOf(this._string_EM,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EM.length;r<n.length&&this._isDigit(n[r]);)r++;r!=t+this._string_EM.length&&(n=n.substring(0,t)+this.char_EM+this._substring(n,t+this._string_EM.length))}}t+=1}for(t=0;t>-1&&(t=n.indexOf(this._string_E,t))>-1&&n[0]!=this.bMARKER;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_E.length;r<n.length&&this._isDigit(n[r]);)r++;r==t+this._string_E.length||i!=-1&&this._isUpperChar(n[i])||(n=n.substring(0,t)+this.char_EP+this._substring(n,t+this._string_E.length))}}t+=1}return n};this._handleIterations=function(n){this._inHandleIterations=!0;for(var i=0,t=0,r=1,u=!0;r<this._iterationMaxCount-1&&(u||!this._checkUnderTolerance(t,i));)u=!1,this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().add(this.cell,n.getFormulaValue()==""?"0":n.getFormulaValue()),n.setFormulaValue(this.computeFormula(n.getParsedFormula())),i=t,t=this._parseDouble(n.getFormulaValue()),isNaN(t)&&(t=0),r++;this.getIterationValues.getItem(this.cell,n.getFormulaValue()==""?"0":n.getFormulaValue());this._inHandleIterations=!1};this._indexOfAny=function(n,t){for(var i=0;i<n.length;i++)if(t.indexOf(n[i])>-1)return i;return-1};this._initLibraryFunctions=function(){this._libraryFunctions=new HashTable;this._addFunction("SUM","computeSum");this._addFunction("EncodeURL","computeEncodeURL");this._addFunction("CHAR","computeChar");this._addFunction("CODE","computeCode");this._addFunction("UNICODE","computeUniCode");this._addFunction("UNICHAR","computeUniChar");this._addFunction("UPPER","computeUpper");this._addFunction("LOWER","computeLower");this._addFunction("LEN","computeLen");this._addFunction("MID","computeMid");this._addFunction("LEFT","computeLeft");this._addFunction("CLEAN","computeClean");this._addFunction("REPT","computeRept");this._addFunction("RIGHT","computeRight");this._addFunction("REPLACE","computeReplace");this._addFunction("EXACT","computeExact");this._addFunction("FIND","computeFind");this._addFunction("TRIM","computeTrim");this._addFunction("SEARCH","computeSearch");this._addFunction("SUBSTITUTE","computeSubstitute");this._addFunction("PROPER","computeProper");this._addFunction("T","computeT");this._addFunction("NUMBERVALUE","computeNumberValue");this._addFunction("CONCATENATE","computeConcatenate");this._addFunction("VALUE","computeValue");this._addFunction("DOLLAR","computeDollar");this._addFunction("FIXED","computeFixed");this._addFunction("BIN2DEC","computeBin2Dec");this._addFunction("BIN2OCT","computeBin2Oct");this._addFunction("BIN2HEX","computeBin2Hex");this._addFunction("DEC2BIN","computeDec2Bin");this._addFunction("DEC2OCT","computeDec2Oct");this._addFunction("HEX2BIN","computeHex2Bin");this._addFunction("HEX2OCT","computeHex2Oct");this._addFunction("BITAND","computeBitAnd");this._addFunction("BITOR","computeBitOr");this._addFunction("BITLSHIFT","computeBitLShift");this._addFunction("BITRSHIFT","computeBitRShift");this._addFunction("BITXOR","computeBitXor");this._addFunction("DATE","computeDate");this._addFunction("DATEVALUE","computeDatevalue");this._addFunction("DAY","computeDay");this._addFunction("DAYS","computeDays");this._addFunction("DAYS360","computeDays360");this._addFunction("EDATE","computeEDate");this._addFunction("EOMONTH","computeEOMonth");this._addFunction("HOUR","computeHour");this._addFunction("ISOWEEKNUM","computeISOWeeknum");this._addFunction("MINUTE","computeMinute");this._addFunction("MONTH","computeMonth");this._addFunction("NETWORKDAYS","computeNetworkDays");this._addFunction("NETWORKDAYS.INTL","computeNetworkDaysOintl");this._addFunction("NOW","computeNow");this._addFunction("SECOND","computeSecond");this._addFunction("TIME","computeTime");this._addFunction("TIMEVALUE","computeTimevalue");this._addFunction("TODAY","computeToday");this._addFunction("WEEKDAY","computeWeekday");this._addFunction("WEEKNUM","computeWeeknum");this._addFunction("WORKDAY","computeWorkDay");this._addFunction("WORKDAY.INTL","computeWorkDayOintl");this._addFunction("YEAR","computeYear");this._addFunction("ADDRESS","computeAddress");this._addFunction("AREAS","computeAreas");this._addFunction("CHOOSE","computeChoose");this._addFunction("COLUMN","computeColumn");this._addFunction("COLUMNS","computeColumns");this._addFunction("FORMULATEXT","computeFormulaText");this._addFunction("HYPERLINK","computeHyperlink");this._addFunction("HLOOKUP","computeHLookUp");this._addFunction("INDEX","computeIndex");this._addFunction("INDIRECT","computeIndirect");this._addFunction("LOOKUP","computeLookUp");this._addFunction("OFFSET","computeOffSet");this._addFunction("TRANSPOSE","computeTranspose");this._addFunction("LOGNORM.INV","computeLognormOinv");this._addFunction("NORM.INV","computeNormOinv");this._addFunction("NORM.DIST","computeNormOdist");this._addFunction("NORM.S.DIST","computeNormOsODist");this._addFunction("NORM.S.INV","computeNormOsOInv");this._addFunction("PERMUT","computePermut");this._addFunction("PERMUTATIONA","computePermutationA");this._addFunction("STANDARDIZE","computeStandardize");this._addFunction("BINOM.DIST","computeBinomOdist");this._addFunction("BINOM.INV","computeBinomOInv");this._addFunction("CHISQ.INV.RT","computeChisqOinvOrt");this._addFunction("CHISQ.INV","computeChisqOinv");this._addFunction("CHISQ.DIST.RT","computeChisqOdistOrt");this._addFunction("F.DIST","computeFOdist");this._addFunction("GAMMALN","computeGammaln");this._addFunction("CONFIDENCE.NORM","computeConfidenceOnorm");this._addFunction("EXPON.DIST","computeExponOdist");this._addFunction("FISHER","computeFisher");this._addFunction("FISHERINV","computeFisherInv");this._addFunction("GAMMALN.PRECISE","computeGammalnOPrecise");this._addFunction("AVERAGE","computeAverage");this._addFunction("AVERAGEA","computeAverageA");this._addFunction("POISSON.DIST","computePoissonODist");this._addFunction("WEIBULL.DIST","computeWeiBullODist");this._addFunction("F.INV.RT","computeFOinvOrt");this._addFunction("T.DIST","computeTOdist");this._addFunction("MAX","computeMax");this._addFunction("MAXA","computeMaxa");this._addFunction("MEDIAN","computeMedian");this._addFunction("MIN","computeMin");this._addFunction("MINA","computeMina");this._addFunction("PERCENTRANK.INC","computePercentrankInc");this._addFunction("PERCENTILE","computePercentile");this._addFunction("RANK.EQ","computeRankOEq");this._addFunction("COUNT","computeCount");this._addFunction("COUNTA","computeCounta");this._addFunction("DEVSQ","computeDevsq");this._addFunction("F.DIST.RT","computeFOdistORt");this._addFunction("FORECAST","computeForecast");this._addFunction("GEOMEAN","computeGeomean");this._addFunction("HARMEAN","computeHarmean");this._addFunction("INTERCEPT","computeIntercept");this._addFunction("LARGE","computeLarge");this._addFunction("SMALL","computeSmall");this._addFunction("LOGNORM.DIST","computeLognormOdist");this._addFunction("AVEDEV","computeAvedev");this._addFunction("COUNTBLANK","computeCountblank");this._addFunction("STDEV.P","computeStdevOp");this._addFunction("STDEV.S","computeStdevOS");this._addFunction("STDEVA","computeStdeva");this._addFunction("STDEVPA","computeStdevpa");this._addFunction("T.INV","computeTOinv");this._addFunction("VAR.P","computeVarp");this._addFunction("VARA","computeVara");this._addFunction("VARPA","computeVarpa");this._addFunction("CORREL","computeCorrel");this._addFunction("PERCENTILE.EXC","computePercentileExc");this._addFunction("PERCENTILE.INC","computePercentileOInc");this._addFunction("TRIMMEAN","computeTrimmean");this._addFunction("RSQ","computeRsq");this._addFunction("PEARSON","computePearson");this._addFunction("CHIDIST","computeChidist");this._addFunction("ABS","computeAbs");this._addFunction("ACOS","computeAcos");this._addFunction("ACOSH","computeAcosh");this._addFunction("ACOT","computeAcot");this._addFunction("ACOTH","computeAcoth");this._addFunction("ARABIC","computeArabic");this._addFunction("ASIN","computeAsin");this._addFunction("ATAN","computeAtan");this._addFunction("ATAN2","computeAtan2");this._addFunction("CEILING.MATH","computeCeilingMath");this._addFunction("CEILING","computeCeiling");this._addFunction("COMBIN","computeCombin");this._addFunction("COMBINA","computeCombinA");this._addFunction("COS","computeCos");this._addFunction("COSH","computeCosh");this._addFunction("COT","computeCot");this._addFunction("CSC","computeCsc");this._addFunction("CSCH","computeCsch");this._addFunction("DECIMAL","computeDecimal");this._addFunction("DEGREES","computeDegrees");this._addFunction("ISTEXT","computeIsText");this._addFunction("EXP","computeExp");this._addFunction("EVEN","computeEven");this._addFunction("FACT","computeFact");this._addFunction("FACTDOUBLE","computeFactdouble");this._addFunction("FLOOR","computeFloor");this._addFunction("INT","computeInt");this._addFunction("LN","computeLn");this._addFunction("LOG","computeLog");this._addFunction("PI","computePI");this._addFunction("PRODUCT","computeProduct");this._addFunction("SEC","computeSecant");this._addFunction("SERIESSUM","computeSeriessum");this._addFunction("SIN","computeSin");this._addFunction("SINH","computeSinh");this._addFunction("SQRT","computeSqrt");this._addFunction("SUBTOTAL","computeSubTotal");this._addFunction("SUMIF","computeSumif");this._addFunction("TRUNC","computeTrunc");this._addFunction("TAN","computeTan");this._addFunction("LOG10","computeLogTen");this._addFunction("COTH","computeCoth");this._addFunction("AND","computeAnd");this._addFunction("FALSE","computeFalse");this._addFunction("IF","computeIf");this._addFunction("IFERROR","computeIfError");this._addFunction("NOT","computeNot");this._addFunction("OR","computeOr");this._addFunction("TRUE","computeTrue");this._addFunction("XOR","computeXor");this._addFunction("CELL","computeCell");this._addFunction("ERROR.TYPE","computeErrorType");this._addFunction("INFO","computeInfo");this._addFunction("ISBLANK","computeIsBlank");this._addFunction("ISERR","computeIsErr");this._addFunction("ISERROR","computeIsError");this._addFunction("ISEVEN","computeIsEven");this._addFunction("ISFORMULA","computeIsFormula");this._addFunction("ISLOGICAL","computeIsLogical");this._addFunction("ISNA","computeIsNA");this._addFunction("ISNONTEXT","computeIsNonText");this._addFunction("ISNUMBER","computeIsNumber");this._addFunction("ISODD","computeIsOdd");this._addFunction("ISREF","computeIsRef");this._addFunction("ISTEXT","computeIsText");this._addFunction("N","computeN");this._addFunction("NA","computeNA");this._addFunction("SHEET","computeSheet");this._addFunction("SHEETS","computeSheets");this._addFunction("TYPE","computeType");this._addFunction("ROW","computeRow");this._addFunction("ROWS","computeRows");this._addFunction("MATCH","computeMatch");this._addFunction("PMT","computePmt")};this._comb=function(n,t){for(var r,u=1,i=n+1;i<=t;++i)u=u*i;for(r=1,i=2;i<=t-n;++i)r=r*i;return u/r};this._finv=function(n,t,i){for(var o=Math.exp(this._gammaln((t+i)/2)-this._gammaln(t/2)-this._gammaln(i/2)+t/2*Math.log(t/i)),r=o,u=r/2,e=0,f=100,s=3,h=0;f==100&&s>0;)for(s--,r=r/2,u=r/2,f=0;f<100;++f){if(h++,e=1-o*this._fdist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e>n?r=r+u:(u=u/2,r-u<0&&(u=r/2),r=r-u)}return f==100&&(r=-1),r};this._tProbabilityDensity=function(n,t){var i=this._gammaFunction(.5*t+.5),r=Math.pow(1+n*n/t,-.5*t-.5),u=Math.sqrt(t*Math.PI)*this._gammaFunction(.5*t);return i*r/u};this._tCumulativeDensity=function(n,t){if(isNaN(n))return NaN;if(n==0)return.5;if(n>0){var i=t/(n*n+t);return 1-.5*this._rIBetaFunction(i,.5*t,.5)}return 1-this._tCumulativeDensity(-n,t)};this._sign=function(n){return n===0||isNaN(n)?n:n>0?1:-1};this._var=function(n){for(var u,f,i=0,r=n.length,t=0;t<r;++t)i+=n[t];for(i=i/r,u=0,t=0;t<r;++t)f=n[t]-i,u+=f*f;return u/(r-1)};this._tCumulativeDistributionInverse=function(n,t){var r,i,u,f,o,s;if(n<0||n>1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;switch(t){case 1:return Math.tan(Math.PI*(n-.5));case 2:return r=4*n*(1-n),2*(n-.5)*Math.sqrt(2/r);case 4:var r=4*n*(1-n),e=Math.sqrt(r),h=Math.cos(1/3*Math.acos(e))/e;return this._sign(n-.5)*2*Math.sqrt(h-1);default:for(i=t>6?this._standardNormalCumulativeDistributionFunctionInverse(n):this._tCumulativeDistributionInverse(n,4),u=0;u<50;u++){if(f=this._tCumulativeDensity(i,t),o=Math.abs(n-f),o<.0001)return i;s=this._tProbabilityDensity(i,t);i=i+(n-f)/s}throw"Solution did not converge";}};this._fdist=function(n,t,i){for(var s,p,f=32,e=0,c=n,o=(c-e)/f,l=o/3,y=this._fdensity(e,t,i)+this._fdensity(c,t,i),u=0,r=1;r<f;r+=2)u=u+4*this._fdensity(e+r*o,t,i);for(s=0,r=2;r<f;r+=2)s=s+2*this._fdensity(e+r*o,t,i);for(var h=l*(y+s+u),a=h,v=0,v=0;v<10;++v){for(f=f*2,s+=u/2,u=0,o=(c-e)/f,r=0;r<f;++r)r%2==1&&(p=this._fdensity(e+o*r,t,i),u=u+p);if(u=4*u,l=o/3,h=l*(y+s+u),Math.abs((h-a)/a)<1e-7)break;a=h}return h};this._fdensity=function(n,t,i){return Math.pow(n,(t-2)/2)/Math.pow(1+t*n/i,(t+i)/2)};this._normaldist=function(n,t,i){var h=32,f,c,o,r,p;n>t?(f=t-(n-t),c=n):(f=n,c=t+(t-n));var e=(c-f)/h,l=e/3,y=this._normaldensity(f,t,i)+this._normaldensity(c,t,i),u=0;for(r=1;r<h;r+=2)u=u+4*this._normaldensity(f+r*e,t,i);for(o=0,r=2;r<h;r+=2)o=o+2*this._normaldensity(f+r*e,t,i);for(var s=l*(y+o+u),a=s,v=0,v=0;v<10;++v){for(h*=2,o=o+u/2,u=0,e=e=(c-f)/h,r=0;r<h;++r)r%2==1&&(p=this._normaldensity(f+e*r,t,i),u+=p);if(u=4*u,l=e/3,s=l*(y+o+u),Math.abs((s-a)/a)<1e-7)break;a=s}return n>t?s+(1-s)/2:(1-s)/2};this._normaldensity=function(n,t,i){return 1/(Math.sqrt(2*Math.PI)*i)*Math.exp(-(n-t)*(n-t)/(2*i*i))};this._standardNormalCumulativeDistribution=function(n){if(n<0)return 1-this._standardNormalCumulativeDistribution(-n);var i=this._standardNormalProbabilityDensityFunction(n),t=1/(1+.2316419*n);return 1-i*(.31938153*t+-.356563782*Math.pow(t,2)+1.781477937*Math.pow(t,3)+-1.821255978*Math.pow(t,4)+1.330274429*Math.pow(t,5))};this._normalinv=function(n,t,i){var r=t;r=n<.05?t-2*i:n<.5?t:n<.95?t+2*i:t+5*i;for(var u=r/2,e=0,f=100,o=3,s=0;f==100&&o>0;)for(o--,r=r/2,u=r/2,f=0;f<100;++f){if(s++,e=this._normaldist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e<n?r=r+u:(u=u/2,r-u<0&&(u=r/2),r=r-u)}return f==100&&(r=-1),r};this._normalCumulativeDistributionFunctionInverse=function(n,t,i){var r=this._standardNormalCumulativeDistributionInverse(n);return i*r+t};this._standardNormalCumulativeDistributionInverse=function(n){var i;if(n<0||n>1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 0<n&&n<r?(t=Math.sqrt(-2*Math.log(n)),(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1)):r<=n&&n<=y?(t=n-.5,i=t*t,(((((-39.696830286653757*i+220.9460984245205)*i+-275.92851044696869)*i+138.357751867269)*i+-30.66479806614716)*i+2.5066282774592392)*t/(((((-54.476098798224058*i+161.58583685804089)*i+-155.69897985988661)*i+66.80131188771972)*i+-13.280681552885721)*i+1)):(t=Math.sqrt(-2*Math.log(1-n)),-(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1))};this._normalProbabilityDensity=function(n,t,i){var r=(n-t)/i;return.398942280401433*Math.exp(-.5*r*r)/i};this._standardNormalProbabilityDensityFunction=function(n){return.398942280401433*Math.exp(-.5*n*n)};this._standardNormalCumulativeDistributionFunction=function(n){if(n<0)return 1-this._standardNormalCumulativeDistributionFunction(-n);var i=this._standardNormalProbabilityDensityFunction(n),t=1/(1+.2316419*n);return 1-i*(.31938153*t+-.356563782*Math.pow(t,2)+1.781477937*Math.pow(t,3)+-1.821255978*Math.pow(t,4)+1.330274429*Math.pow(t,5))};this._standardNormalCumulativeDistributionFunctionInverse=function(n){var i;if(n<0||n>1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 0<n&&n<r?(t=Math.sqrt(-2*Math.log(n)),(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1)):r<=n&&n<=y?(t=n-.5,i=t*t,(((((-39.696830286653757*i+220.9460984245205)*i+-275.92851044696869)*i+138.357751867269)*i+-30.66479806614716)*i+2.5066282774592392)*t/(((((-54.476098798224058*i+161.58583685804089)*i+-155.69897985988661)*i+66.80131188771972)*i+-13.280681552885721)*i+1)):(t=Math.sqrt(-2*Math.log(1-n)),-(((((u*t+f)*t+e)*t+o)*t+s)*t+h)/((((c*t+l)*t+a)*t+v)*t+1))};this._chiSquaredProbabilityDensityFunction=function(n,t){var i=this._gammaFunction(.5*t),r=1/(Math.pow(2,.5*t)*i);return r*Math.pow(n,.5*t-1)*Math.exp(-.5*n)};this._binomdist=function(n,t,i){var f=1-i,o=Math.pow(f,n),e=0,r=1*Math.pow(f,n),u;if(r==0)return NaN;for(u=0;u<=t;++u)if(e+=r,r=r*i/f*(n-u)/(u+1),!isFinite(r)||isNaN(r)){e=NaN;break}return e};this._gammadensity=function(n,t,i){return Math.pow(i/t,n-1)*Math.exp(-i/t)/(t*Math.exp(this._gammaln(n)))};this.minValue=-179769e303;this.maxValue=2147483647;this._charTable=[this._string_empty,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];this._stdevdotP=function(n){for(var r=n.length,i=0,u=0,f=0,t=0;t<r;++t)i=i+n[t];for(i=i/r,t=0;t<r;t++)u=u+Math.pow(n[t]-i,2),f++;return Math.sqrt(u/f)};this._determinant=function(n,t){var o=1,e=0,c=parseInt(t.toString()),s=[c,c],i,r,h,u,f;if(t==1)return n[0];for(e=0,f=0;f<t;f++){for(h=0,u=0,i=0;i<t;i++)for(r=0;r<t;r++)s[(i,r)]=0,i!=0&&r!=f&&(s[(h,u)]=n[(i,r)],u<t-2?u++:(u=0,h++));e=e+o*n[f]*this._determinant(s,t-1);o=-1*o}return e};this._factorialTable=[1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600];this._mean=function(n){return this._mean(n,1)};this._negbinomdensity=function(n,t,i){return this._comb(t-1,n+t-1)*Math.pow(i,t)*Math.pow(1-i,n)};this._sd=function(n,t){var r=n.length,f,u,i;for(t=0,i=0;i<r;++i)t+=n[i];for(t=t/r,f=0,u=0,i=0;i<r;++i)u=n[i]-t,f+=u*u;return r==1?0:Math.sqrt(f/(r-1))};this._betaCumulativeDist=function(n,t,i){if(n<0||n>1)throw"x must be between 0 and 1";return this._rIBetaFunction(n,t,i)};this._betaProbabilityDens=function(n,t,i){if(n<0||n>1)throw"x must be between 0 and 1";var r=this._betaFunction(t,i);return Math.pow(n,t-1)*Math.pow(1-n,i-1)/r};this._critbinom=function(n,t,i){var r=n,f=n,e=1,u=1;do{if(f=Math.floor(f/2)+1,e>=i){if(u=this._binomdist(n,r-1,t),isNaN(u))return this.maxValue;if(u<i&&u>0)break;r=r-f}else{if(u=this._binomdist(n,r+1,t),u>=i){r=r+1;break}r=r+f}e=this._binomdist(n,r,t)}while(r<n&&r>0);return r};this._newnormalinv=function(n){var f=[-39.696830286653757,220.9460984245205,-275.92851044696869,138.357751867269,-30.66479806614716,2.5066282774592392],e=[-54.476098798224058,161.58583685804089,-155.69897985988661,66.80131188771972,-13.280681552885721],i=[-.0077848940024302926,-.32239645804113648,-2.4007582771618381,-2.5497325393437338,4.3746641414649678,2.9381639826987831],u=[.0077846957090414622,.32246712907003983,2.445134137142996,3.7544086619074162],o=.02425,s=1-o,t=0,r=0;return n<o?(t=Math.sqrt(-2*Math.log(n)),(((((i[0]*t+i[1])*t+i[2])*t+i[3])*t+i[4])*t+i[5])/((((u[0]*t+u[1])*t+u[2])*t+u[3])*t+1)):s<n?(t=Math.sqrt(-2*Math.log(1-n)),-(((((i[0]*t+i[1])*t+i[2])*t+i[3])*t+i[4])*t+i[5])/((((u[0]*t+u[1])*t+u[2])*t+u[3])*t+1)):(t=n-.5,r=t*t,(((((f[0]*r+f[1])*r+f[2])*r+f[3])*r+f[4])*r+f[5])*t/(((((e[0]*r+e[1])*r+e[2])*r+e[3])*r+e[4])*r+1))};this._chiinv=function(n,t){for(var i=n,r=Number(i/2),f=0,u=100,e=3;u==100&&e>0;)for(e--,i=i/2,r=i/2,u=0;u<100;++u){if(f=1-this._chidist(i,t),Math.abs((f-n)/n)<1e-7)break;f>n?i=i+r:(r=r/2,i-r<0&&(r=i/2),i=i-r)}return u==100&&(i=-1),i};this._chidist=function(n,t){var c=[.09654008851,.09563872008,.09384439908,.0911738787,.087652093,.08331192423,.07819389579,.07234579411,.06582222278,.05868409348,.05099805926,.04283589802,.03427386291,.02539206531,.01627439473,.00701861001],l=[.04830766569,.14447196158,.23928736225,.33186860228,.42135127613,.50689990893,.58771575724,.66304426693,.73218211874,.79448379597,.84936761373,.89632115577,.93490607594,.96476225559,.98561151155,.99726386185],i=t/2,a=1/(Math.pow(2,i)*Math.exp(this._gammaln(i))),u;i=i-1;var o=0,s=n,f=(o+s)/2,h=(s-o)/2,e=0,r;for(u=0;u<16;++u)r=l[u]*h,e=Number(e)+Number(c[u]*(Math.pow(f+r,i)*Math.exp(-(f+r)/2)+Math.pow(f-r,i)*Math.exp(-(f-r)/2)));return Number(a)*Number(e)*Number(h)};this._gammaln=function(n){var r=[.918938533204673,.000595238095238,.000793650793651,.002777777777778,.083333333333333],t=n,i=0,u;if(t<7){for(i=t,t++;t<7;)i=i*t,t<7&&t++;i=-Math.log(i)}return u=this._parseDouble((1/(t*t)).toString()),i+(t-this._parseDouble("0.5"))*Math.log(t)-t+r[0]+(((-r[1]*u+r[2])*u-r[3])*u+r[4])/t};this._pearson=function(n,t,i){for(var u=0,f=0,r=0;r<i;++r)u+=n[r],f+=t[r];u=u/i;f=f/i;var s=0,h=0,c=0,e,o;for(r=0;r<i;++r)o=n[r]-u,e=t[r]-f,s+=o*e,h+=o*o,c+=e*e;return s/Math.sqrt(h*c)};this._fProbabilityDensity=function(n,t,i){if(t<=0||i<=0)throw"k1 and k2 must be greater than 0.";if(n==0)return 0;var r=Math.pow(t*n,.5*t),u=Math.pow(i,.5*i),f=Math.pow(t*n+i,.5*(t+i)),e=r*u/f,o=this._betaFunction(.5*t,.5*i),s=n*o;return e/s};this._fCumulativeDensity=function(n,t,i){if(t<=0||i<=0)throw"k1 and k2 must be greater than 0.";if(n<0)throw"x must be greater than 0.";if(n==0)return 0;var r=t*n/(t*n+i),u=this._rIBetaFunction(r,.5*t,.5*i);return Math.min(1,u)};this._rIBetaFunction=function(n,t,i){var s,r,h,c;if(n<=0)return 0;if(n>=1)return 1;if(t%1==0&&i%1==0&&t+i>0)return this._rIBetaFunction1(n,t,i);if(i%1==0&&t+i<172)return this._rIBetaFunction2(n,t,i);if(t%1==0&&t+i<172)return 1-this._rIBetaFunction2(1-n,i,t);if(t==.5&&i==.5)return 2/Math.PI*Math.atan(Math.sqrt(n/(1-n)));if(t==.5&&i%.5==0)return 1-this._rIBetaFunction(1-n,i,.5);if(t%.5==0&&i==.5){if(t<45){var u=0,e=Math.round(t-.5),l=this._parseDouble(this.computeGammaln("0.5".toString()));for(r=0;r<e;r++)u=u+Math.exp(this._gammaln(r+1)-this._gammaln(r+1.5)-l)*Math.pow(n,r);return this._rIBetaFunction(n,.5,.5)-Math.sqrt(n*(1-n))*u}var a=this._betaFunction(t,.5),o=Math.sqrt(1-Math.pow(a*Math.sqrt((t-1)/Math.PI)*this._epsilon,1/(t-1))),v=[.066671344308688,.14945134915058,.21908636251598,.26926671931,.29552422471475,.29552422471475,.26926671931,.21908636251598,.14945134915058,.066671344308688],y=[.013046735791414,.067468316655507,.16029521585049,.28330230293538,.42556283050918,.57443716949081,.71669769706462,.83970478414951,.93253168334449,.98695326420859],f=Math.sqrt(1-n),u=0;for(r=0;r<10;r++)u=u+v[r]*Math.pow(1-Math.pow((o-f)*y[r]+f,2),t-1);return s=Math.exp(this._gammaln(t+.5)-this._gammaln(t)-this._gammaln(.5)),(o-f)*s*u}if(t%.5==0&&i%.5==0){var u=0,e=Math.round(i-.5),p=this._gammaln(t),w=Math.pow(n,t);for(r=0;r<e;r++)u=u+Math.exp(this._gammaln(t+r+.5)-p-this._gammaln(r+1.5))*Math.pow(1-n,r)*w;return h=this._rIBetaFunction(n,t,.5)+Math.sqrt(1-n)*u,Math.max(0,Math.min(1,h))}return n>.5?1-this._rIBetaFunction(1-n,i,t):(c=this._iBetaFunction(n,t,i)/this._betaFunction(t,i),Math.max(0,Math.min(1,c)))};this._rIBetaFunction1=function(n,t,i){var u=0,f=t+i-1,r;if(f<21){for(r=t;r<t+i;r++)u=u+Math.pow(n,r)*Math.pow(1-n,f-r)/(this._factorial(r)*this._factorial(f-r));u=u*this._factorial(f)}else for(r=t;r<t+i;r++)u=u+Math.pow(n,r)*Math.pow(1-n,f-r)*this._combinations(f,r);return Math.max(0,Math.min(1,u))};this._rIBetaFunction2=function(n,t,i){var u,r;if(t+i>172)throw"Cannot currently compute RegularizedIncompleteBetaFunction for a + b > 172";for(u=0,r=1;r<i+1;r++)u=u+Math.pow(1-n,r-1)*Math.exp(this._gammaln(t+r-1)-this._gammaln(r));return u*Math.pow(n,t)*Math.exp(-this._gammaln(t))};this._iBetaFunction=function(n,t,i){var r,u;if(n==0)return 0;if(n==1)return this._betaFunction(t,i);if(n<=.9)return this._pIBetaFunction(0,n,t,i);if(n<=.99)return r=this._pIBetaFunction(0,.9,t,i),u=this._pIBetaFunction(.9,n,t,i),r+u;var r=this._pIBetaFunction(0,.9,t,i),u=this._pIBetaFunction(.9,.99,t,i),f=this._pIBetaFunction(.99,n,t,i);return r+u+f};this._pIBetaFunction=function(n,t,i,r){var u,s;if(t==n)return 0;if(t<n)return NaN;u=1e3;i<1&&(u=8e4);var e=(t-n)/u,f=n+.5*e,o=0;for(s=0;s<u;s++)o=o+Math.pow(f,i-1)*Math.pow(1-f,r-1)*e,f=f+e;return o};this._betaFunction=function(n,t){return n+t>143?t>20?2.5066282746310002*Math.pow(n,n-.5)*Math.pow(t,t-.5)/Math.pow(n+t,n+t-.5):this._gammaFunction(t)*Math.pow(n,-t):this._gammaFunction(n)*this._gammaFunction(t)/this._gammaFunction(n+t)};this._gammaFunction=function(n){var t,i;if(n>143)throw"Cannot currently compute gamma function for z > 143";if(n>0&&n<21&&n%1==0)return this._factorial(Math.round(n-1));if(n>0&&n<11&&n%.5==0)return t=n,i=1.77245385090552,i*this._factorial(2*t)/(Math.pow(4,t)*this._factorial(t));var r=1+1/(12*n)+1/(288*n*n)-139/(51840*Math.pow(n,3))-571/(2488320*Math.pow(n,4))+163879/(209018880*Math.pow(n,5))+5246819/(75246796800*Math.pow(n,6));return Math.pow(n,n-.5)*Math.exp(-n)*2.5066282746310002*r};this._epsilon=494065645841247e-338;this._factorial=function(n){var t,i;if(n<0)throw"Factorial not defined for negative n";if(n>20)throw"Answer will exceed max long";for(t=1,i=n;i>0;i--)t=t*i;return t};this._combinations=function(n,t){var i=this._logCombin(n,t),r=Math.exp(i);return Math.round(r)};this._logCombin=function(n,t){return this._logFactorial(n)-this._logFactorial(t)-this._logFactorial(n-t)};this._logFactorial=function(n){for(var t=0,i=2;i<=n;i++)t=t+Math.log(i);return t};this._isCellReference=function(n){var e,f,t,i,u,r;if(n==""||(n=this.setTokensForSheets(n),e=this._sheetToken(n),f=!1,e!=""&&(n=n.split(this.sheetToken).join("")),t=!1,i=!1,n.indexOf(":")!=n.lastIndexOf(":")))return!1;for(u=n.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),r=0;r<u.length;r++)if(this._isLetter(u[r]))t=!0;else if(this._isDigit(u[r])){if(u[r]===0)return!1;i=!0}else if(u[r]==":")t&&i&&(f=!0),t=!1,i=!1;else return!1;return n.indexOf(":")>-1&&n.indexOf(this.tic)==-1?f&&t&&i?!0:(!t||i)&&(t||!i)||f?!1:!0:t&&i&&n.indexOf(this.tic)==-1?!0:!1};this._isDate=function(n){if(typeof n=="object"||ej.parseDate(n)!=null){var t=new Date(Date.parse(n));return t>=this._dateTime1900?t:"NaN"}return"NaN"};this._isDigit=function(n){var t=n.charCodeAt(0);return t>47&&t<58?!0:!1};this._isHLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&2)!=0};this._isLetter=function(n){var t=n.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122?!0:!1};this._isLetterOrDigit=function(n){var t=n.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?!0:!1};this._isLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0||(this._enableLookupTableCaching&2)!=0};this._isOptimizedMatchesEnabled=function(){return(this._enableLookupTableCaching&4)!=0};this._isRange=function(n){var u=!1,r=n.indexOf(":"),t,i;if(r>1&&r<n.length-2&&(t=r-1,this._isDigit(n[t]))){for(i=!1,t--;t>0&&this._isDigit(n[t]);)t--;if(this._isLetter(n[t])){for(t--;t>=0&&this._isLetter(n[t]);)t--;t>-1&&n[t]==this._string_fixedreference[0]&&t--;t<0?i=!0:n[t]==this.sheetToken&&(t-->1&&n[t]==this.tic[0]?i=n.substring(0,t-1).lastIndexOf(this.tic[0])==0:t>0&&this._isDigit(n[t])&&(i=n.substring(0,t).lastIndexOf(this.sheetToken)==0))}if(i&&(t=r+1,t<n.length-6&&n[t]==this.tic[0]&&(t=n.indexOf(this.sheetToken,t+1),t<n.length-2&&t++),t<n.length-2&&n[t]==this._string_fixedreference[0]&&t++,this._isLetter(n[t]))){for(t++;t<n.length-1&&this._isLetter(n[t]);)t++;if(this._isDigit(n[t])){for(t++;t<n.length&&this._isDigit(n[t]);)t++;u=t==n.length}}}return u};this._isUpperChar=function(n){var t=n.charCodeAt(0);return t>64&&t<91};this._iisVLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0};this._mark=function(n,t,i,r,u){var f=0,e;for(u?(f=this._findAndCheckPrecedingChar(n,i,f),n=this._findAndCheckPrecedingCharCopy):f=n.indexOf(i),e=i.length;f>-1;)n=n.substring(0,f)+r+n.substring(f+e),t=t.substring(0,f)+r+t.substring(f+e),u?(f=this._findAndCheckPrecedingChar(n,i,f),n=this._findAndCheckPrecedingCharCopy):f=n.indexOf(i,f);return this._markCopy="",t};this._markColonsInQuotes=function(n){for(var i=!1,t=0;t<n.length;++t)n[t]==this.tic[0]?i=!i:n[t]==":"&&i&&(n=n.split(":").join(this._markerChar));return n};this._markIF=function(n,t){var c=n.indexOf(this.getReservedWordOperators()[this._reservedWord_IF]),i=n.indexOf(this.getReservedWordOperators()[this._reservedWord_THEN]),u=n.indexOf(this.getReservedWordOperators()[this._reservedWord_ELSE]);if(u>-1&&i>-1){var f=this.getReservedWordOperators()[this._reservedWord_IF].length,e=i-f,r=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,o=u-r,s=u+this.getReservedWordOperators()[this._reservedWord_ELSE].length,h=t.length-s;t="IF(("+this._substring(t,f,e)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,r,o)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,s,h)+"))";n=t}else if(i>-1){var f=0,e=i,r=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,o=t.length-r+1;t="IF(("+this._substring(t,f,e)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,r,o)+"))";n=t}return this._markIFCopy=t,t};this._markLibraryFormulas=function(n){var u=n.indexOf(")"),o,i,r,f,s,e,h,t;if(u==-1)n=this._markNamedRanges(n);else while(u>-1){for(o=0,i=u-1;i>-1&&(n[i]!="("||o!=0);)n[i]==")"?o++:n[i]==")"&&o--,i--;if(i==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];for(r=i-1;r>-1&&(this._isLetterOrDigit(n[r])||this._validFunctionNameChars.indexOf(n[r])>-1||n[r]==this.getParseDecimalSeparator());)r--;if(f=i-r-1,f>0&&this.getLibraryFunctions().getItem(this._substring(n,r+1,f))!=undefined)this._ignoreBracet=this._substring(n,r+1,f)=="AREAS"?!0:!1,t=this._substring(n,i,u-i+1),t=this._markNamedRanges(t),n=n.substring(0,r+1)+"q"+this._substring(n,r+1,f)+t.split("(").join(this._leftBracket).split(")").join(this._rightBracket)+n.substring(u+1);else{if(f>0){if(this.unknownFunction!=null){var c=CalcEngine.getSheetFamilyItem(this.grid),l=this.grid,a=this._sheetToken(this.cell),t=this.cell;for(a.length>0&&(l=c.tokenToParentObject.getItem(a),t=t.substring(t.lastIndexOf(this.sheetToken)+1)),s=c.sheetNameToParentObject.keys(),e=0;e<s.length;e++)if(c.sheetNameToParentObject.getItem(s[e])==l){t=s[e]+this.sheetToken+t;break}h=new UnknownFunctionEventArgs;h.setMissingFunctionName(this._substring(n,r+1,f));h.setCellLocation(t);this.unknownFunction(this,h);this._ignoreBracet=n.substring(r+1,f)=="AREAS"?!0:!1}if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._unknown_formula_name]+" "+this._substring(n,r+1,f);return this.getErrorStrings()[5].toString()}t="";i>0&&(t=n.substring(0,i));t=t+"{"+this._substring(n,i+1,u-i-1)+"}";u<n.length&&(t=t+n.substring(u+1));t=this._markNamedRanges(t);n=t}u=n.indexOf(")")}return n.split("{").join("(").split("}").join(")")};this._markNamedRanges=function(n){var o=n.indexOf(")"),u=[")",this.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&"],t=n.length>0&&(n[0]=="("||n[0]=="{")?1:0,r,f,i,e;for(n.indexOf("#N/A")>-1&&(n=n.split("#N/A").join("#N~A")),n.indexOf("#DIV/0!")>-1&&(n=n.split("#DIV/0!").join("#DIV~0!")),r=t,r=n.indexOf("[")==-1||n.indexOf("[")>this._indexOfAny(n.substring(t),u)?this._indexOfAny(n.substring(t),u):this._findNextEndIndex(n,r);r>-1&&r+t<n.length;){if(f="",i=null,i=this._substring(n,t,r).indexOf("[")>-1?this._getTableRange(this._substring(n,t,r)):this.getNamedRanges().getItem(this._substring(n,t,r)),i==undefined||typeof i=="string"||(i=i.getItem(this._substring(n,t,r))),i==null&&(f=this._checkIfScopedRange(this._substring(n,t,r)),isNaN(f)?this._substring(n,t,r).startsWith(this.sheetToken.toString())&&(e=this._substring(n,t,r).indexOf(this.sheetToken,1),e>1&&(i=this.getNamedRanges().getItem(this._substring(n.substring(t),e+1,r-e-1)))):i=f),i!=null&&(i=i.toUpperCase(),i=this.setTokensForSheets(i),i=this._markLibraryFormulas(i)),i!=null)n=n.substring(0,t)+i+n.substring(t+r),t+=i.length+1;else for(t+=r+1;t<n.length&&!this._isUpperChar(n[t])&&n[t]!=this.sheetToken;)t++;for(r=t,r=n.indexOf("[")==-1||n.indexOf("[")>this._indexOfAny(n.substring(t),u)?this._indexOfAny(n.substring(t),u):this._findNextEndIndex(n,r),r=this._indexOfAny(n.substring(t),u);r==0&&t<n.length-1;)t++,r=this._indexOfAny(n.substring(t),u);(r==-1||n.substring(t).indexOf("[")>-1)&&t<n.length&&(i=n.substring(t).indexOf("[")>-1?this._getTableRange(n.substring(t)):this.getNamedRanges().length>0?this.getNamedRanges().getItem(n.substring(t)):i,i==null&&(f=this._checkIfScopedRange(n.substring(t)),isNaN(f)||(i=f)),i!=null&&(i=i.toUpperCase(),i=this.setTokensForSheets(i),i=this._markLibraryFormulas(i),i!=null&&(n=n.substring(0,t)+i,t+=i.toString().length+1)),r=t<n.length?this._indexOfAny(n.substring(t),u):-1)}return n.indexOf("#N~A")>-1&&(n=n.split("#N~A").join("#N/A")),n.indexOf("#DIV~0!")>-1&&(n=n.split("#DIV~0!").join("#DIV/0!")),n};this._markReserveWords=function(n){var t=n.toLowerCase(),i=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim();return i[0]==this.getReservedWordOperators()[this._reservedWord_IF]&&(n=this._markIF(t,n),t=this._markIFCopy),n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_NOT],this.char_NOTop,!0),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_OR],this.char_ORop,!1),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_AND],this.char_ANDop,!1),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_XOR],this.char_XORop,!1),t=this._markCopy,n};this._markupResultToIncludeInFormula=function(n){return n.length>0&&n[0]=="-"&&!isNaN(this._parseDouble(n))?n="nu"+n.substring(1):n.length>0&&(n[0]==this.tic[0]||n[0]==this.bMARKER||n[0]=="#")||n.startsWith(this.trueValueStr)||n.startsWith(this.falseValueStr)||(isNaN(this._parseDouble(n))?this._isRange(n)||(n=this.tic+n+this.tic):(n=n.split(this.getParseArgumentSeparator()).join(String.fromCharCode(32)),n="n"+n)),n};this._matchCompare=function(n,t){var i=n.toString(),r=t.toString(),u=this._parseDouble(i),f=this._parseDouble(r);return isNaN(u)||isNaN(f)?i==r?0:i>r?1:-1:u==f?0:u>f?1:-1};this._matchingRightBracket=function(n){for(var i=-1,t=1,r=0,e=this._sheetToken(n),u,f;i==-1&&t<n.length;)n[t]==this._rightBracket?r==0?i=t:(r--,r==0&&t==n.length-1&&(i=t)):n[t]=="q"&&(u=t+1,u<n.length&&(f=this._processUpperCase(n,u,e),n=this._processUpperCaseFormula,u=this._processUpperCaseIvalue,e=this._processUpperCaseSheet,f!=""&&this.getLibraryFunctions().containsKey(f)&&r++)),t++;return i};this._notInBlock=function(n,t){for(var i=n.indexOf(this.bMARKER),r=!1;i>-1&&i<t;)r=!r,i=n.indexOf(this.bMARKER,i+1);return!r};this._getTopRowIndexFromRange=function(n){var i,r,t,u;return(n=this._markColonsInQuotes(n),i=n.indexOf(":"),i==-1)?this.rowIndex(n):(r="",t=n.indexOf(this.sheetToken),t>-1&&(u=n.indexOf(this.sheetToken,t+1),u>-1&&(r=this._substring(n,t,u-t+1),n=n.replace(r,""),i=n.indexOf(":"))),this.rowIndex(n.substring(0,i)))};this._getTableRange=function(n){var t,f,r,i,e,s,u,o;if(n=n.replace(" ","").toUpperCase(),t=n.replace("]","").replace("#DATA",""),f=t,t.indexOf(this.getParseArgumentSeparator())>-1&&(f=t.substring(0,t.indexOf(this.getParseArgumentSeparator())).replace("[",""),t=t.replace("[","").replace(this.getParseArgumentSeparator(),"_")),r="",n.indexOf("#THISROW")>-1){if(i=this.getNamedRanges().getItem(t.replace("#THISROW","")),i==undefined||typeof i=="string"||(i=i.getItem(t.replace("#THISROW",""))),i==null)return i;i=i.toUpperCase();e=this.rowIndex(this.cell);i=i.replace(this._string_fixedreference,"");i=this.setTokensForSheets(i);s=0;u=this.getNamedRanges().getItem(f.Replace("#THISROW",""));u==undefined||typeof u=="string"||(u=u.getItem(f.Replace("#THISROW","")));u=u.replace(this._string_fixedreference,"").toUpperCase();u=this.setTokensForSheets(u);o=this._getTopRowIndexFromRange(i);r=this.getCellsFromArgs(i)[e-o]}else if(t=t[t.length-1]=="["?t.replace("[",""):t.replace("[","_"),(t.indexOf("#TOTALS")>-1||t.indexOf("#ALL")>-1||t.indexOf("#HEADERS")>-1||t.indexOf("#DATA")>-1)&&(t=t.replace("#","")),r=this.getNamedRanges().getItem(t),r==undefined||typeof r=="string"||(r=r.getItem(t)),r==null)return null;return r.toUpperCase()};this._parse=function(n){var t=n,s,u,f,r,h,i,c,o;if(this._isTextEmpty(t))return t;if(t=this.getFormulaText(t),this.getSupportLogicalOperators()&&(t=this._markReserveWords(t)),this.getFormulaCharacter()!=String.fromCharCode(0)&&this.getFormulaCharacter()==t[0]&&(t=t.substring(1)),this.getNamedRanges().length>0&&(t.indexOf("[")>-1&&(s=this._getTableRange(t),s!=null&&(t=s)),this.getNamedRanges().getItem(t.toUpperCase())!=undefined?t=this.getNamedRanges().getItem(t.toUpperCase()).toUpperCase():(u="",u=this._checkIfScopedRange(t.toUpperCase()),isNaN(u)||(t=u.toUpperCase()))),f=this._saveStrings(t),t=this._saveStringsText,t=t.split(this.braceLeft).join(this.tic),t=t.split(this.braceRight).join(this.tic),t=t.split("-+").join("-"),r=0,(t[t.length-1]!=this.bMARKER||this._indexOfAny(t,this.tokens)!=t.length-2)&&(t=t.toUpperCase()),t.indexOf(this.sheetToken)>-1&&(h=CalcEngine.getSheetFamilyItem(this.grid),h.sheetNameToParentObject!=null&&h.sheetNameToParentObject.length>0))try{t=this.setTokensForSheets(t)}catch(e){if(this._rethrowExceptions)throw e;else return e}if(this._isRangeOperand)return this._isRangeOperand=!1,this._getCellFrom(this._parseSimple(t));t=t.split(" ").join("");t=t.split("=>").join(">=");t=t.split("=<").join("<=");try{t=this._markLibraryFormulas(t)}catch(e){if(this._rethrowExceptions)throw e;else return e}if(!this._ignoreBracet)while((r=t.indexOf(")"))>-1){if(i=t.substring(0,r).lastIndexOf("("),i==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];if(i==r-1)throw this.formulaErrorStrings[this._empty_expression];c="";c=this._ignoreBracet?this._substring(t,i,r-i+1):this._substring(t,i+1,r-i-1);t=t.substring(0,i)+this._parseSimple(c)+t.substring(r+1)}if(!this._ignoreBracet&&t.indexOf("(")>-1)throw this.formulaErrorStrings[this._mismatched_parentheses];return o=this._parseSimple(t),f!=null&&f.length>0&&(o=this._setStrings(o,f)),o};this._parseDouble=function(n){return isNaN(parseInt(n))?NaN:Number(n.toString().replace(/[^0-9\.]-+/g,""))*1};this._parseSimple=function(n){var t=n;if(t.length>0&&t[0]=="+"&&(t=t.substring(1)),t=="#N/A"||t=="#N~A")return"#N/A";if(t.indexOf("#N/A")>-1&&(t=t.split("#N/A").join("#N~A")),t=="#DIV/0!"||t=="#DIV~0!")return"#DIV/0!";if(t.indexOf("#DIV/0!")>-1&&(t=t.split("#DIV/0!").join("#DIV~0!")),t=this._handleEmbeddedEs(t),t=t.split(this._string_lesseq).join(this.char_lesseq),t=t.split(this._string_greatereq).join(this.char_greatereq),t=t.split(this._string_noequal).join(this.char_noequal),t=t.split(this._string_fixedreference).join(this._string_empty),t=t.split(this._string_or).join(this.char_or),t=t.split(this._string_and).join(this.char_and),t=="")return t;var i=!0,r=[this.token_EP,this.token_EM],u=[this.token_or],f=[this.token_multiply,this.token_divide],e=[this.token_add,this.token_subtract],o=[this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal],s=[this.token_NOTop],h=[this.token_ORop,this.token_ANDop,this.token_XORop],c=[this.token_and],l=[this.char_EP,this.char_EM],a=[this.char_or],v=[this.char_multiply,this.char_divide],y=[this.char_add,this.char_subtract],p=[this.char_less,this.char_greater,this.char_equal,this.char_lesseq,this.char_greatereq,this.char_noequal],w=[this.char_NOTop],b=[this.char_ORop,this.char_ANDop,this.char_XORop],k=[this.char_and];return t=this._parseSimpleOperators(t,r,l),t=this._parseSimpleOperators(t,u,a),i&&(t=this._parseSimpleOperators(t,f,v)),i&&(t=this._parseSimpleOperators(t,e,y)),i&&(t=this._parseSimpleOperators(t,o,p)),i&&(t=this._parseSimpleOperators(t,s,w)),i&&(t=this._parseSimpleOperators(t,h,b)),i&&(t=this._parseSimpleOperators(t,c,k)),t.indexOf("#N~A")>-1&&(t=t.split("#N~A").join("#N/A")),t.indexOf("#DIV~0!")>-1&&(t=t.split("#DIV~0!").join("#DIV/0!")),t};this._parseSimpleOperators=function(n,t,i){for(var w,g,nt,a,tt,v,r,h,c,p,f,u=n,o,k="",d=0;d<i.length;d++)k=k+i[d];if(u=u.split("---").join("-").split("--").join("+").split(this.getParseArgumentSeparator()+"-").join(this.getParseArgumentSeparator()+"u").split(this._leftBracket+"-").join(this._leftBracket+"u").split("=-").join("=u"),u=u.split(">-").join(">u").split("<-").join("<u").split("/-").join("/u").split("*-").join("*u").split("+-").join("-").split("--").join("-u").split("w-").join("wu").split(this.tic+"-").join(this.tic+"u").toString(),u=u.split(",+").join(",").split(this._leftBracket+"+").join(this._leftBracket).split("=+").join("=").split(">+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").toString(),u.length>0&&u[0]=="-"?u="0"+u:u.length>0&&u[0]=="+"&&(u=u.substring(1)),this._indexOfAny(u,i)>-1)while((o=this._indexOfAny(u,i))>-1){var s="",e="",l=0,y=0,ut=this._supportLogicalOperators&&u[o]==this.char_NOTop,r=0;if(ut)l=o;else{if(o<1&&u[o]!="-")throw this.formulaErrorStrings[this._operators_cannot_start_an_expression];if(r=o-1,o==0&&u[o]=="-"){u=this.bMARKER+"nu"+u.substring(1)+this.bMARKER;continue}else if(u[r]==this.tic[0]){if(f=u.substring(0,r-1).lastIndexOf(this.tic),f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,f,r-f+1);l=f}else if(u[r]==this.bMARKER){if(f=this._findLastNonQB(u.substring(0,r-1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,f+1,r-f-1);l=f+1}else if(u[r]==this._rightBracket){for(h=0,f=r-1;f>0&&(u[f]!="q"||h!=0);)u[f]=="q"?h--:u[f]==this._rightBracket&&h++,f--;if(f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,f,r-f+1);l=f}else if(this._isDigit(u[r])||u[r]=="%"){for(c=!1,p=!1;r>-1&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator()||!p&&u[r]=="%"||u[r]=="u");)u[r]==this.getParseDecimalSeparator()?c=!0:u[r]=="%"&&(p=!0),r=r-1;if(r>-1&&c&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];if(r=r+1,r==0||r>0&&!this._isUpperChar(u[r-1]))s="n"+this._substring(u,r,o-r),l=r;else{for(r=r-1;r>-1&&this._isUpperChar(u[r]);)r=r-1;if(r>-1&&u[r]=="u"&&(r=r-1),r>-1&&u[r]==this.sheetToken){for(r=r-1;r>-1&&u[r]!=this.sheetToken;)r=r-1;r>-1&&u[r]==this.sheetToken&&(r=r-1)}if(r>-1&&u[r]==":"){for(r=r-1;r>-1&&this._isDigit(u[r]);)r=r-1;while(r>-1&&this._isUpperChar(u[r]))r=r-1;if(r>-1&&u[r]==this.sheetToken){for(r--;r>-1&&u[r]!=this.sheetToken;)r--;r>-1&&u[r]==this.sheetToken&&r--}r=r+1;s=this._substring(u,r,o-r);s=this._getCellFrom(s)}else r=r+1,s=this._substring(u,r,o-r);this.updateDependencies(s);l=r}}else{while(r>=0&&(this._isUpperChar(u[r])||u[r]=="_"||u[r]=="."))r--;if(s=this._substring(u,r+1,o-r-1),l=r+1,a="",this.getNamedRanges().containsKey(s)>-1)s=this._parse(this.getNamedRanges()[s]);else if(isNaN(a=this._checkIfScopedRange(s,a)))if(s==this.trueValueStr)s="n"+this.trueValueStr;else if(s==this.falseValueStr)s="n"+this.falseValueStr;else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_char_in_front_of]+" "+u[o];return this.getErrorStrings()[5].toString()}else s=this._parse(a)}}if(o==u.length-1)throw this.formulaErrorStrings[this._expression_cannot_end_with_an_operator];else if(r=o+1,w=u[r]=="u",w&&r++,u[r]==this.tic[0]){if(f=u.substring(r+1).indexOf(this.tic),f<0)throw this.formulaErrorStrings[this._cannot_parse];e=this._substring(u,r,f+2);y=f+r+2}else if(u[r]==this.bMARKER){if(f=this._findNonQB(u.substring(r+1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];e=this._substring(u,r+1,f);w&&(e=e+"nu1m");y=f+r+2}else if(u[r]=="q"){for(h=0,f=r+1;f<u.length&&(u[f]!=this._rightBracket||h!=0);)u[f]==this._rightBracket?h++:u[f]=="q"&&h--,f++;if(f==u.length)throw this.formulaErrorStrings[this._cannot_parse];e=this._substring(u,r,f-r+1);w&&(e="u"+e);y=f+1}else if(this._isDigit(u[r])||u[r]==this.getParseDecimalSeparator()){for(c=u[r]==this.getParseDecimalSeparator(),r=r+1;r<u.length&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator());)u[r]==this.getParseDecimalSeparator()&&(c=!0),r=r+1;if(r<u.length&&u[r]=="%"&&(r+=1),c&&r<u.length&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];e="n"+this._substring(u,o+1,r-o-1);y=r}else if(this._isUpperChar(u[r])||u[r]==this.sheetToken||u[r]=="u"){if(u[r]==this.sheetToken)for(r++;r<u.length&&u[r]!=this.sheetToken;)r++;for(r=r+1,g=0;r<u.length&&(this._isUpperChar(u[r])||u[r]=="_"||u[r]==".");)r++,g++;if(nt=r==u.length||!this._isDigit(u[r]),g>4){while(r<u.length&&(this._isUpperChar(u[r])||this._isDigit(u[r])))r++;nt=!0}while(r<u.length&&this._isDigit(u[r]))r=r+1;if(r<u.length&&u[r]==":"){if(r=r+1,r<u.length&&u[r]==this.sheetToken){for(r++;r<u.length&&u[r]!=this.sheetToken;)r=r+1;r<u.length&&u[r]==this.sheetToken&&r++}while(r<u.length&&this._isUpperChar(u[r]))r=r+1;while(r<u.length&&this._isDigit(u[r]))r=r+1;r=r-1;e=this._substring(u,o+1,r-o);e=this._getCellFrom(e)}else r=r-1,e=this._substring(u,o+1,r-o),w=u[r]=="u",w&&(e="u"+e);if(nt)if(a="",this.getNamedRanges().getItem(e)>-1)e=this._parse(this.getNamedRanges()[e]);else if(isNaN(a=this._checkIfScopedRange(e,a)))if(e==this.trueValueStr)e="n"+this.trueValueStr;else if(e==this.falseValueStr)e="n"+this.falseValueStr;else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_characters_following_an_operator];return this.getErrorStrings()[5].toString()}else e=this._parse(a);else this.updateDependencies(e);y=r+1}else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_characters_following_an_operator];return this.getErrorStrings()[5].toString()}tt=k.indexOf(u[o]);v=this.bMARKER+this._zapBlocks(s)+this._zapBlocks(e)+t[tt]+this.bMARKER;l>0&&(v=u.substring(0,l)+v);y<u.length&&(v=v+u.substring(y));v=v.split(this.bMARKER2).join(this.bMARKER.toString());u=v}else{if(r=u.length-1,u[r]==this.bMARKER){if(f=this._findLastNonQB(u.substring(0,r-1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];}else if(u[r]==this._rightBracket){for(h=0,f=r-1;f>0&&(u[f]!="q"||h!=0);)u[f]=="q"?h--:u[f]==this._rightBracket&&h++,f--;if(f<0)throw this.formulaErrorStrings[this._bad_library];}else if(this._isDigit(u[r])){for(c=!1,p=!1;r>-1&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator()||!p&&u[r]=="%");)u[r]==this.getParseDecimalSeparator()?c=!0:u[r]=="%"&&(p=!0),r=r-1;if(r>-1&&c&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];}if(u.length>0&&(this._isUpperChar(u[0])||u[0]==this.sheetToken)){var b=!0,it=!0,rt=!1;for(f=0;f<u.length;++f)if(u[f]==this.sheetToken){if(f>0&&!rt)throw this.formulaErrorStrings[this._missing_sheet];for(rt=!0,f++;f<u.length&&this._isDigit(u[f]);)f++;if(f==u.length||u[f]!=this.sheetToken){b=!1;break}}else{if(!it&&this._isLetter(u[f])){b=!1;break}if(this._isLetterOrDigit(u[f])||u[f]==this.sheetToken)it=this._isUpperChar(u[f]);else{b=!1;break}}b&&this.updateDependencies(u)}}return u};this._pop=function(n){var i=n.pop(),t,r,u;if(i!=null){if(i.toString()==this.tic+this.tic)return NaN;if(t=i.toString().split(this.tic).join(""),this.getErrorStrings().indexOf(t)>-1)return this._isErrorString=!0,this.getErrorStrings().indexOf(t);if(t[0]=="#"||t=="")return 0;if(t==this.trueValueStr)return 1;if(t==this.falseValueStr)return 0;if(r=this._parseDouble(t),isNaN(r)){if(this.getUseDatesInCalculations()&&isNaN(this._parseDouble(i)))return u=this._isDate(t),isNaN(u)?0:this._getSerialDateTimeFromDate(u)}else return r}return t==""&&this.getTreatStringsAsZero()?0:i!=null&&i.toString().length>0?Number.NaN:0};this._popString=function(n){var t=n.pop(),r=this._parseDouble(t),i;if(t==null)t="";else if(isNaN(r)){if(this.getUseDatesInCalculations()&&isNaN(this._parseDouble(t.split(this.tic).join("")))&&(i=this._isDate(t.split(this.tic).join("")),!isNaN(i)))return this._getSerialDateTimeFromDate(i).toString()}else return r.toString();return this.removeTics(t.toString())};this._populateNamedRangesNonScoped=function(){this._namedRangesNonScoped==null&&(this._namedRangesNonScoped=new HashTable);this._namedRangesNonScoped.clear();for(var n=0;n<this.namedRanges.keys().length;n++)this._checkAddNonScopedNamedRange(this.namedRanges.keys()[n])};this._processUpperCase=function(n,t,i){for(var r="",u,f;t<n.length&&this._isUpperChar(n[t]);)r=r+n[t],t=t+1;while(t<n.length&&this._isDigit(n[t]))r=r+n[t],t=t+1;if(u=r,f=t,t<n.length&&n[t]==":"){if(r="",t=t+1,t<n.length&&n[t]==this.sheetToken)for(r=r+n[t],t=t+1;t<n.length&&n[t]!=this.sheetToken;)r=r+n[t],t=t+1;while(t<n.length&&this._isUpperChar(n[t]))r=r+n[t],t=t+1;while(t<n.length&&this._isDigit(n[t]))r=r+n[t],t=t+1}return this._supportRangeOperands&&u!=r?r=i+this._getCellFrom(u+":"+r):(t=u!=r?f:t,r=i+u),i="",this._processUpperCaseFormula=n,this._processUpperCaseIvalue=t,this._processUpperCaseSheet=i,r};this._saveStrings=function(n){var f=null,h=this.tic+this.tic,s=0,t=-1,r,e,o,i,u;if((t=n.indexOf(this.tic))>-1)while(t>-1&&t<n.length)if(f==null&&(f=new HashTable),r=t+1<n.length?n.indexOf(this.tic,t+1):-1,r>-1){if(e=this.tic+this._uniqueStringMarker+s.toString()+this.tic,r<n.length-2&&n[r+1]==this.tic[0]&&(r=n.indexOf(this.tic,r+2),r==-1))throw this.formulaErrorStrings[this._mismatched_tics];o=this._substring(n,t,r-t+1);f.add(e,o);o=o.split(h).join(this.tic);s++;n=n.substring(0,t)+e+n.substring(r+1);t=t+e.length;t<n.length&&(t=n.indexOf(this.tic,t))}else if(r==-1&&n.indexOf(this.sheetToken)>-1&&t<n.indexOf(this.sheetToken,t)){for(i="",u=n.indexOf(this.sheetToken,t)-1;u>-1;u--)if(this.getValidPrecedingChars().indexOf(n[u].toString())==-1)i=n[u]+i;else break;if(!(i[0]=="'"&&i[i.length-1]=="'"))throw this.formulaErrorStrings[this._mismatched_tics];if(i[0]=="'"&&(i=i.substring(1)),i[i.length-1]=="'"&&(i=i.substring(0,i.length-1)),this.getSortedSheetNames().indexOf(i.toUpperCase())==-1)throw this.formulaErrorStrings[this._missing_sheet];t+1<n.length&&(t=n.indexOf(this.tic,t+1))}else throw this.formulaErrorStrings[this._mismatched_tics];return this._saveStringsText=n,f};this._setStrings=function(n,t){for(var r=t.keys(),i=0;i<r.length;i++)n=n.split(r[i]).join(t.getItem(r[i]));return n};this._sheetToken=function(n){var t=0,i="";if(t<n.length&&n[t]==this.sheetToken){for(t++;t<n.length&&n[t]!=this.sheetToken;)t++;i=n.substring(0,t+1)}if(t<n.length)return i;throw this.formulaErrorStrings[this._bad_index];};this._splitArguments=function(n,t){return n.split(t)};this._stripTics0=function(n){return n.length>1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(n=this._substring(n,1,n.length-2)),n};this._substring=function(n,t,i){return n.substring(t,i+t)};this._isTextEmpty=function(n){return n==null||n==""};this._toOADate=function(n){return(n.getTime()-Date.parse(this._oaDate))/this._millisecondsOfaDay};this._zapBlocks=function(n){var i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>0;--t)n[t]==this._rightBracket?i--:n[t]==this._leftBracket?i++:n[t]==this.bMARKER&&i==0&&(n=n.substring(0,t-1)+n.substring(t+1));return n};this.addCustomFunction=function(n,t){return(n=n.toUpperCase(),this._addFunction(n,t),this._customlibraryFunctions.getItem(n)==undefined)?(this._customlibraryFunctions.add(n,t),!0):!1};this.UpdateDependentNamedRangeCell=function(n){var i,r,o;if(this.getDependentNamedRangeCells()!=null&&this.getDependentNamedRangeCells().containsKey(n)&&(i=this.getDependentNamedRangeCells().keys(),i!=null&&i.length>0))for(r=0;r<i.length;r++){var t=this.getDependentNamedRangeCells().getItem(i[r]),e=t.indexOf(this.sheetToken),u,f,s=this.grid;e>-1?(o=CalcEngine.getSheetFamilyItem(this.grid),this.grid=o.tokenToParentObject.getItem(t.substring(0,e+3)),u=this.rowIndex(t),f=this.colIndex(t)):(u=this.rowIndex(t),f=this.colIndex(t));this.recalculateRange(RangeInfo.cells(u,f,u,f),this.grid);this.grid=s}};this.RemoveNamedRangeDependency=function(n){if(this.getDependentNamedRangeCells().containsKey(n)){var t=Hashtable(this.getDependentNamedRangeCells()[n]);t.Clear();this.getDependentNamedRangeCells().remove(n)}};this.SetNamedRangeDependency=function(n,t){var r=CalcEngine.getSheetFamilyItem(this.grid),u,i,f;r.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(u=r.GridModelToToken[this.grid],t=u+t);this.getDependentNamedRangeCells()!=null&&this.getDependentNamedRangeCells().containsKey(n)?(i=this.getDependentNamedRangeCells()[n],i.containsKey(t)||i.add(t,"0")):(f=new HashTable,f.add(t,"0"),this.getDependentNamedRangeCells().add(n,t.toString()))};this.addNamedRange=function(n,t){return(n=n.toUpperCase(),this.getNamedRanges().getItem(n)==null)?(this.getNamedRanges().add(n,t),this.getNameRangeValues().containsKey(n)||this.getNameRangeValues().add(n,t.toString()),(this.getUndefinedNamedRanges().containsKey(n)||this.getUndefinedNamedRanges().containsKey(n.toUpperCase())||this.getUndefinedNamedRanges().containsKey(n.toLowerCase()))&&(this.SetNamedRangeDependency(n.toUpperCase(),this.cell),this.UpdateDependentNamedRangeCell(n.toUpperCase())),namedRangesSized=null,this._checkAddNonScopedNamedRange(n),!0):!1};this.adjustRangeArg=function(n){return n.length>1&&n[0]==this.bMARKER&&n[n.length-1]==this.bMARKER&&this._substring(n,1,n.length-2).indexOf(this.bMARKER)==-1&&(n=this.computedValue(n)),n.length>1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(n=this._substring(n,1,n.length-2)),n};this.clearFormulaDependentCells=function(n){var f=this.getDependentFormulaCells().getItem(n),i,t,r,u;if(f!=null){for(i=f.keys(),t=0;t<i.length;t++)r=i[t],u=this.getDependentCells().getItem(r),this._arrayRemove(u,n),u.length==0&&this.getDependentCells().remove(r);this.getDependentFormulaCells().remove(n)}};this.clearLibraryComputationException=function(){this._libraryComputationException=null};this.colIndex=function(n){var t=0,i=0,r;if(n=n.toUpperCase(),t<n.length&&n[t]==this.sheetToken){for(t++;t<n.length&&n[t]!=this.sheetToken;)t++;t++}while(t<n.length&&this._isLetter(n[t]))r=n[t].charCodeAt(0),i=i*26+r-64,t++;return i==0?-1:i};this.computedValue=function(formula){var _stack,i,sheet,loc,nextIfLoc,sepLoc,ifResult,rightPiece,uFound,d3,family,token,ii,t,name,j,args,functionName,result,errIndex,o,x,s2,d1,s1,val,s,d,cc;if(this._isTextEmpty(formula))return formula;try{if(this.computedValueLevel++,this.computedValueLevel>this._maximumRecursiveCalls){this.computedValueLevel=0;throw this.formulaErrorStrings[this._too_complex];}if(_stack=[],i=0,_stack.length=0,sheet="",this.getAllowShortCircuitIFs()){loc=-1;do if(i<formula.length&&(i=formula.indexOf(this.iFMarker,i))>-1&&(loc=this._matchingRightBracket(formula.substring(i)),loc>-1)){result="";nextIfLoc=formula.indexOf(this.iFMarker,loc);do{loc=i;sepLoc=this._findNextSeparator(formula,loc);isNaN(sepLoc)||(loc=sepLoc);for(var funcArgs=this._substring(formula,i+this.iFMarker.length,loc-this.iFMarker.length-1),ifArguments=[],argLoc=0,argNo=0;argLoc<funcArgs.length;)sepLoc=this._findNextSeparator(funcArgs,argLoc),isNaN(sepLoc)?argLoc>0&&arguments.push(funcArgs.substring(0,argLoc)):(argLoc=sepLoc,ifArguments.push(funcArgs.substring(0,argLoc)),funcArgs=funcArgs.substring(Number(argLoc)+1),argLoc=0);ifResult=this.getValueFromArg(ifArguments[0]);result=ifResult==this.trueValueStr?this.getValueFromArg(ifArguments[1]):this.getValueFromArg(ifArguments[2]);nextIfLoc=formula.indexOf(this.iFMarker,loc)}while(formula.indexOf(this.iFMarker)>-1&&nextIfLoc>-1);result=this._markupResultToIncludeInFormula(result);rightPiece="";i+loc+1<formula.length&&(rightPiece=formula.substring(i+loc+1));formula=formula.substring(0,i)+result+rightPiece}while(formula.indexOf(this.iFMarker)>-1&&loc>-1)}for(i=0;i<formula.length;){if(formula[i]==this.bMARKER){i=i+1;continue}if(uFound=formula[i]=="u",uFound){if(i++,i>=formula.length)continue;if(formula[i]==this.bMARKER&&i++,i>=formula.length)continue}if(formula[i]=="%"&&_stack.length>0){o=_stack[0];d=this._parseDouble(o);isNaN(d)||(_stack.pop(),_stack.push(Number(d)/100));i=i+1;continue}if(formula[i]==this.sheetToken){for(sheet=formula[i].toString(),i++;i<formula.length&&formula[i]!=this.sheetToken;)sheet+=formula[i],i++;if(i<formula.length)sheet+=formula[i],i++;else continue}if(formula.substring(i).indexOf(this.trueValueStr)==0)_stack.push(this.trueValueStr),i+=this.trueValueStr.length;else if(formula.substring(i).indexOf(this.falseValueStr)==0)_stack.push(this.falseValueStr),i+=this.falseValueStr.length;else if(formula[i]==this.tic[0]||formula[i]=="|"){for(_stack.length==3&&(_stack=this._combineStack(formula,i-2,_stack)),s=formula[i].toString(),i++;i<formula.length&&formula[i]!=this.tic[0];)s=s+formula[i],i=i+1;this._multiTick&&(s=s.split("|").join(this.tic));_stack.push(s+this.tic);i+=1}else if(this._isUpperChar(formula[i]))if(s=this._processUpperCase(formula,i,sheet),formula=this._processUpperCaseFormula,i=this._processUpperCaseIvalue,sheet=this._processUpperCaseSheet,uFound)s=this.getValueFromParentObjectCell(s),isNaN(this._parseDouble(s))?_stack.push(s):(d3=-d3,_stack.push(d3.toString()));else if(this.getUseFormulaValues()&&this.computedValueLevel>50){if(this._breakedFormulaCells.indexOf(s)==-1&&this.getUseFormulaValues()){family=CalcEngine.getSheetFamilyItem(this.grid);token=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken;s=token+s;this._breakedFormulaCells.add(s);this._tempBreakedFormulaCells.add(s);break}_stack.push("FALSE")}else _stack.push(this.getValueFromParentObjectCell(s));else if(formula[i]=="q")if(formula=this._computeInteriorFunctions(formula),ii=formula.substring(i+1).indexOf(this._leftBracket),ii>0){for(var bracketCount=0,bracketFound=!1,start=ii+i+2,k=start;k<formula.length&&(formula[k]!=this._rightBracket||bracketCount>0);)formula[k]==this._leftBracket?(bracketCount++,bracketFound=!0):formula[k]==this._leftBracket&&bracketCount--,k++;if(bracketFound){var s=this._substring(formula,start,k-start-2),s1="",splits=this.splitArgsPreservingQuotedCommas(s);for(t=0;t<splits.length;t++)s1.length>0&&(s1+=","),j=this._findLastqNotInBrackets(t),s1+=j>0?splits[t].substring(0,j)+this.computedValue(splits[t].substring(j)):this.computedValue(splits[t]);formula=formula.substring(0,start)+s1+formula.substring(k-2)}if(name=this._substring(formula,i+1,ii),name=="AVG"&&this._excelLikeComputations)throw this.formulaErrorStrings[this._bad_index];if(this.getLibraryFunctions().getItem(name)!=undefined){j=formula.substring(i+ii+1).indexOf(this._rightBracket);args=this._substring(formula,i+ii+2,j-1);try{functionName=this.getLibraryFunctions().getItem(name);result=this.getCustomLibraryFunctions().getItem(name)!=undefined?eval(functionName)(args):this[functionName](args);_stack.push(result)}catch(ex){if(this.getRethrowLibraryComputationExceptions()){this._libraryComputationException=ex;throw ex;}return ex}i+=j+ii+2}else if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._missing_formula];}else if(formula[0]==this.bMARKER){i=0;_stack.length==0;continue}else throw this.formulaErrorStrings[this._improper_formula];else if(this._isDigit(formula[i])||formula[i]=="u"){if(s="",(formula[i]=="u"||uFound)&&(s="-",uFound?uFound=!1:i++),i<formula.length&&this._isUpperChar(formula[i]))s=s+this.getValueFromParentObjectCell(this._processUpperCase(formula,i,sheet)),formula=this._processUpperCaseFormula,i=this._processUpperCaseIvalue,sheet=this._processUpperCaseSheet;else while(i<formula.length&&(this._isDigit(formula[i])||formula[i]==this.getParseDecimalSeparator()))s=s+formula[i],i=i+1;_stack.push(s)}else switch(formula[i]){case"#":errIndex=0;errIndex=formula.indexOf("!")==-1?formula.indexOf("?")+1:formula.indexOf("!")+1;_stack.push(this._substring(formula,i,errIndex-i));i=errIndex;break;case"n":if(i=i+1,s="",formula.substring(i).indexOf("Infinity")==0)s="Infinity",i+=s.length;else if(formula.substring(i).indexOf("uInfinity")==0)s="Infinity",i+=s.length+1;else if(formula.substring(i).indexOf(this.trueValueStr)==0)s=this.trueValueStr,i+=s.length;else if(formula.substring(i).indexOf(this.falseValueStr)==0)s=this.falseValueStr,i+=s.length;else if(i<=formula.length-3&&formula.substring(i,3)=="NaN")i+=3,s="0";else{for((formula[i]=="u"||uFound)&&(s="-",uFound?uFound=!1:i=i+1);i<formula.length&&(this._isDigit(formula[i])||formula[i]==this.getParseDecimalSeparator());)s=s+formula[i],i=i+1;i<formula.length&&formula[i]=="%"?(i=i+1,s==""?_stack.length>0&&(o=_stack[0],d=this._parseDouble(o.toString()),isNaN(d)||(_stack.pop(),s=(d/100).toString())):s=(Number(s)/100).toString()):i<formula.length-2&&formula[i]=="E"&&(formula[i+1]=="+"||formula[i+1]=="-")&&(s+=this._substring(formula,i,4),i+=4)}_stack.push(s);break;case this.token_add:if((d=this._pop(_stack),x=parseInt(d.toString()),!isNaN(x)&&this._isErrorString)||(d1=this._pop(_stack),x=parseInt(d1.toString()),!isNaN(x)&&this._isErrorString))return this._isErrorString=!1,this.getErrorStrings()[x].toString();isNaN(d)||isNaN(d1)?_stack.push("#VALUE!"):_stack.push((Number(d1)+Number(d)).toString());i=i+1;break;case this.token_subtract:if((d=this._pop(_stack),x=parseInt(d.toString()),!isNaN(x)&&this._isErrorString)||(d1=this._pop(_stack),x=parseInt(d1.toString()),!isNaN(x)&&this._isErrorString))return this._isErrorString=!1,this.getErrorStrings()[x].toString();isNaN(d)||isNaN(d1)?_stack.push("#VALUE!"):_stack.push((d1-d).toString());i=i+1;break;case this.token_multiply:if((d=this._pop(_stack),x=parseInt(d.toString()),!isNaN(x)&&this._isErrorString)||(d1=this._pop(_stack),x=parseInt(d1.toString()),!isNaN(x)&&this._isErrorString))return this._isErrorString=!1,this.getErrorStrings()[x].toString();isNaN(d)||isNaN(d1)?_stack.push("#VALUE!"):_stack.push((d1*d).toString());i=i+1;break;case this.token_divide:if((d=this._pop(_stack),x=parseInt(d.toString()),!isNaN(x)&&this._isErrorString)||(d1=this._pop(_stack),x=parseInt(d1.toString()),!isNaN(x)&&this._isErrorString))return this._isErrorString=!1,this.getErrorStrings()[x].toString();isNaN(d)||isNaN(d1)?_stack.push("#VALUE!"):d==0?_stack.push(this.getErrorStrings()[3]):_stack.push((d1/d).toString());i=i+1;break;case this.token_EP:d=this._pop(_stack);d1=this._pop(_stack);_stack.push((d1*Math.pow(10,d)).toString());i=i+1;break;case this.token_EM:d=this._pop(_stack);d1=this._pop(_stack);_stack.push((Number(d1)*Math.pow(10,-Number(d))).toString());i=i+1;break;case this.token_less:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s2.toUpperCase().split(this.tic).join("").localeCompare(s1.toUpperCase().split(this.tic).join(""))<0?this.trueValueStr:this.falseValueStr:d1<d?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_greater:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&s1!=""&&(s2=this.getTreatStringsAsZero()?"0":s1+1);d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s2.toUpperCase().split(this.tic).join("").localeCompare(s1.toUpperCase().split(this.tic).join(""))>0?this.trueValueStr:this.falseValueStr:Number(d1)>Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_equal:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("")==s2.toUpperCase().split(this.tic).join("")?this.trueValueStr:this.falseValueStr:Number(d1)==Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_lesseq:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s2!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("").localeCompare(s2.toUpperCase().split(this.tic).join(""))<=0?this.trueValueStr:this.falseValueStr:Number(d1)<=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_greatereq:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("").localeCompare(s2.toUpperCase().split(this.tic).join(""))>=0?this.trueValueStr:this.falseValueStr:Number(d1)>=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_noequal:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("")!=s2.toUpperCase().split(this.tic).join("")?this.trueValueStr:this.falseValueStr:Number(d1)!=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_and:s1=this._popString(_stack);s2="";_stack.length>0&&(s2=this._popString(_stack));this.getUseNoAmpersandQuotes()?_stack.push(s2+s1):_stack.push(this.tic+s2+s1+this.tic);i=i+1;break;case this.token_or:d=this._pop(_stack);d1=this._pop(_stack);_stack.push(Math.pow(d1,d).toString());i=i+1;break;case this.token_ORop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr||s2.toUpperCase().split(this.tic).join("")==this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_ANDop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s2.toUpperCase().split(this.tic).join("")==this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_XORop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s2.toUpperCase().split(this.tic).join("")!=this.trueValueStr||s2.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s1.toUpperCase().split(this.tic).join("")!=this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_NOTop:s1=this._popString(_stack);d=this._parseDouble(s1);s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.falseValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;default:if(this.computedValueLevel=0,this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_expression];else return this.getErrorStrings()[1].toString()}}if(this._checkDanglingStack&&_stack.length>1&&formula.length>1&&(formula.indexOf(this.bmarker.toString())!=0||formula.indexOf(this.bmarker)!=formula.length-1||formula.indexOf(this.bmarker2)>-1))return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];if(_stack.length==0)return"";s="";cc=_stack.length;do return(s=_stack.pop().toString()+s,s==""&&!this.getUseNoAmpersandQuotes()&&this._isCellReference(formula)&&this.getTreatStringsAsZero())?"0":s;while(cc>0&&!(s.indexOf(this.FALSEVALUESTR)>-1||s.indexOf(this.tRUEVALUESTR)>1));return s}catch(ex){if(this.computedValueLevel=0,ex.toString().indexOf(this.formulaErrorStrings[this._circular_reference_])>-1||this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();throw ex;}if(ex.toString().indexOf(this.formulaErrorStrings[this._cell_empty])>-1)return"";if(this.getRethrowLibraryComputationExceptions()){this._libraryComputationException=ex;throw ex;}return ex}finally{this.computedValueLevel--;this.computedValueLevel<0&&(this.computedValueLevel=0)}};this.computeFormula=function(n){if(this.getThrowCircularException())if(this._iterationMaxCount>0){if(this.computedValueLevel==0)this._circCheckList.length=0,this._circCheckList.push(this.cell);else if(this._circCheckList.indexOf(this.cell)>-1)return this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().getItem(this.cell).toString()}else{if(this.computedValueLevel==0)this._circCheckList.length=0;else if(this._circCheckList.indexOf(this.cell)>-1){this.computedValueLevel=0;this._circCheckList.length=0;throw this.formulaErrorStrings[this._circular_reference_];}this._circCheckList.push(this.cell)}var t=this.computedValue(n);return this.getUseNoAmpersandQuotes()&&t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]&&(t=this._substring(t,1,t.length-2)),t};this.dispose=function(){if(!this._isDisposed){var n=0;this.grid!=null&&(n=this.getSheetID(this.grid));CalcEngine._tokenCount--;CalcEngine.sheetFamilyID--;CalcEngine._sheetFamiliesList!=null&&CalcEngine._sheetFamiliesList.length>0&&(CalcEngine._sheetFamiliesList[n]=null,CalcEngine._sheetFamiliesList.remove(n));CalcEngine.modelToSheetID!=null&&CalcEngine.modelToSheetID.length>0&&(CalcEngine.modelToSheetID[n]=null,CalcEngine._sheetFamiliesList.remove(n));this._formulaInfoTable!=null&&(this._formulaInfoTable.clear(),this._formulaInfoTable=null);this._circCheckList!=null&&(this._circCheckList.length=0,this._circCheckList=null);this._dependentCells!=null&&(this._dependentCells.clear(),this._dependentCells=null);this._dependentFormulaCells!=null&&(this._dependentFormulaCells.clear(),this._dependentFormulaCells=null);this.getIterationValues()!=null&&(this.getIterationValues().clear(),this.getIterationValues(null));this._libraryFunctions!=null&&(this._libraryFunctions.clear(),this._libraryFunctions=null);this._lookupTables!=null&&(this._lookupTables.clear(),this._lookupTables=null);this.grid=null;this.getLibraryFunctions()!=null&&(this.getLibraryFunctions().clear(),this.setLibraryFunctions(null));this._isDisposed=!0}};this.getCalcID=function(){return this._calcID};this._getCellFrom=function(n){var u="",t=this.getCellsFromArgs(n),i=t.length-1,f=this.rowIndex(t[0]),o,s,r;if(f==this.rowIndex(t[i])){var h=this.colIndex(t[0]),c=this.colIndex(t[i]),e=this.colIndex(this.cell);e>=h&&e<=c&&(u=RangeInfo.getAlphaLabel(e).toString()+f.toString())}else(o=this.colIndex(t[0]))==this.colIndex(t[i])&&(s=this.rowIndex(t[i]),r=this.rowIndex(this.cell),r>=f&&r<=s&&(u=RangeInfo.getAlphaLabel(o).toString()+r.toString()));return u};this.getCellsFromArgs=function(n){var i,f,t,h,l,e,s,a,u,o;if(n=this._markColonsInQuotes(n),t=n.indexOf(":"),t==-1)return n=n.split(this._markerChar).join(":"),t=n.indexOf(this.getParseArgumentSeparator()),t==-1?(i=this.rowIndex(n),f=this.colIndex(n),h=[],h.push(n),h):this.splitArgsPreservingQuotedCommas(n);this.getRowIndexFromName=function(n){var i,t;if(n.indexOf(":")==-1){for(i="",t=0;t<n.length;t++)this._isDigit(n[t])&&(i+=n[t]);return i}};var c="",y=n,r=n.indexOf(this.sheetToken);if(r>-1&&(l=n.indexOf(this.sheetToken,r+1),l>-1&&(c=this._substring(n,r,l-r+1),n=n.split(c).join(""),t=n.indexOf(":"))),t>0&&this._isLetter(n[t-1]))s=this._rowMaxCount>0?this._rowMaxCount:50,n=n.substring(0,t)+"1:"+n.substring(t+1)+s.toString(),t=n.indexOf(":");else if(t>0&&this._isDigit(n[t-1])){for(e=t-2;e>=0&&this._isDigit(n[e]);)e--;e!=-1&&this._isLetter(n[e])||(s=this._columnMaxCount>0?this._columnMaxCount:50,n="A"+n.substring(0,t)+":"+RangeInfo.getAlphaLabel(s)+n.substring(t+1),t=n.indexOf(":"))}if(a=this._canGetRowIndex(n.substring(0,t)),!a)return this._ignoreCellValue=!0,n=y,this.splitArgsPreservingQuotedCommas(n);if(i=this.rowIndex(n.substring(0,t)),u=this.rowIndex(this._substring(n,t+1,n.length-t-1)),!(!(i==-1)||u==-1)==(i==-1||!(u==-1)))throw this.getErrorStrings()[5].toString();f=this.colIndex(n.substring(0,t));o=this.colIndex(this._substring(n,t+1,n.length-t-1));i>u&&(t=u,u=i,i=t);f>o&&(t=o,o=f,f=t);var w=(u-i+1)*(o-f+1),v=[],p=0;for(t=i;t<=u;++t)for(r=f;r<=o;++r)try{v[p++]=c+RangeInfo.getAlphaLabel(r)+t.toString()}catch(b){continue}return v};this.getFormulaRowCol=function(n,t,i){var f=CalcEngine.getSheetFamilyItem(n),r=RangeInfo.getAlphaLabel(i)+t.toString(),e,o,u;return(f.sheetNameToParentObject!=null&&(e=f.parentObjectToToken.getItem(n),r=e+r),this.getFormulaInfoTable().containsKey(r))?(o=this.getFormulaInfoTable.getItem(r),u=o.getFormulaText(),this.getFormulaText(u),u):""};this.getFormulaText=function(n){var t=new FormulaParsing(n);return t.getText()};this.getSheetID=function(n){var i=CalcEngine.getSheetFamilyItem(n),t,r;return i.sheetNameToParentObject!=null&&i.sheetNameToParentObject.length>0&&(t=i.parentObjectToToken.getItem(n),t=t.split("!").join(""),r=this._parseDouble(t),!isNaN(r))?r:-1};this.getStringArray=function(n){for(var f,r=[],i=0,u=!1,t=0;t<n.length;t++)f=n[t],f==this.tic[0]?u=!u:u||f!=this.getParseArgumentSeparator()||(r.push(this._substring(n,i,t-i)),i=t+1);return r.push(n.substring(i)),r};this.getValueFromArg=function(n){var r,i=this._dateTime1900,f,u,s,o,h,e,t,c;if(isNaN(n)||(n=n.toString()),this._isTextEmpty(n))return n;if(n[0]==this.tic[0])return(i=this._isDate(n.split(this.tic).join("")),this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&isNaN(this._parseDouble(n.split(this.tic).join("")))&&!isNaN(i)&&!isNaN(i.getDate())&&this._dateTime1900<=i)?this._toOADate(i).toString():n;if(n[0]==this.bMARKER||n[0]=="q")return n=n.split("{").join("("),n=n.split("}").join(")"),this.computedValue(n);if(n.length>1&&n.substring(0,2)=="ub")return(n=n.split("{").join("("),n=n.split("}").join(")"),f=n.substring(1),f=this.computedValue(f),u=this._parseDouble(f),!isNaN(u))?(u=-u,u.toString()):this.computedValue(n);if(n.indexOf("unu")==0?n="n"+n.substring(3):n.indexOf("un")==0&&(n="-"+n.substring(2)),n=n.split("u").join("-"),!this._isUpperChar(n[0])&&(this._isDigit(n[0])||n[0]==this.getParseDecimalSeparator()||n[0]=="-"||n[0]=="n"))if(n[0]=="n"&&(n=n.substring(1)),r=this._parseDouble(n),isNaN(r)){if(n.indexOf(this.trueValueStr)==0||n.indexOf(this.falseValueStr)==0)return n}else return this._preserveLeadingZeros?n:r.toString();if(this._ignoreCellValue&&!(n.indexOf(this.trueValueStr)==0||n.indexOf(this.falseValueStr)==0))return this._ignoreCellValue=!1,n;if(s=["+","-","/","*",")",")","{"],this._indexOfAny(n,s)==-1&&this._isUpperChar(n[0])||n[0]==this.sheetToken){if(n!=this.trueValueStr&&n!=this.falseValueStr&&this._isCellReference(n)&&(o=CalcEngine.getSheetFamilyItem(this.grid),o.sheetNameToParentObject!=null&&n.indexOf(this.sheetToken)==-1&&(h=o.parentObjectToToken.getItem(this.grid),n=h+n)),n==this.cell){e=this.getDependentCells().getItem(n);e!=null&&e.indexOf(n)>-1&&this._arrayRemove(e,n);this.getDependentFormulaCells().containsKey(this.cell)||this.clearFormulaDependentCells(this.cell);throw this.formulaErrorStrings[this._circular_reference_]+n;}return(t=this.getValueFromParentObjectCell(n),i=this._isDate(t),t=t.toString(),n!=this.trueValueStr&&n!=this.falseValueStr&&(r=this._parseDouble(t.split(this.tic).join("")),!this._preserveLeadingZeros&&t.length>0&&!isNaN(r)&&(t=r.toString()),this.updateDependencies(n)),t==this.tic+this.tic)?"NaN":(this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&!isNaN(i)&&isNaN(this._parseDouble(t))&&!isNaN(i.getDate())&&this._dateTime1900<=i&&(t=this._toOADate(i).toString()),t)}return(n=n.split("{").join("("),n=n.split("}").join(")"),n=this._parse(n),r=this._parseDouble(n.substring(0,n.length-1)),n.indexOf("%")!=n.length-1||isNaN(r)||(n=(Number(r)/100).toString()),this.getErrorStrings().indexOf(n)>-1)?n:this.computedValue(n)};this.getValueFromParentObjectCell=function(n){var t,e,s;if(n==this.trueValueStr||n==this.falseValueStr)return n;var r=n.lastIndexOf(this.sheetToken),u=0,f=0,o=this.grid,i=CalcEngine.getSheetFamilyItem(this.grid);if(r>-1&&i.tokenToParentObject!=null)this.grid=i.tokenToParentObject.getItem(n.substring(0,r+1)),u=this.rowIndex(n),f=this.colIndex(n);else if(r==-1){for(t=0;t<n.length&&this._isLetter(n[t]);)t++;if(t==n.length){if(n=n.toLowerCase(),this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}u=this.rowIndex(n);f=this.colIndex(n);this.isSheetMember()&&i.parentObjectToToken!=null&&(n=i.parentObjectToToken.getItem(this.grid)+n)}if(e=this.cell==""||this.cell==null?"":this.cell,this.cell=n,this._iterationMaxCount>0){if(this._circCheckList.indexOf(this.cell)>-1&&this.computedValueLevel>0)return this.grid=o,this.cell=e,this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().getItem(this.cell).toString();if(this.getIterationValues().containsKey(this.cell)&&this.computedValueLevel>0)return this.getIterationValues.getItem(this.cell).toString()}return s=this._getValueComputeFormulaIfNecessary(u,f,this.grid),this.grid=o,this.cell=e,s};this.getValueFromParentObject=function(n,t,i){var u=CalcEngine.getSheetFamilyItem(n),f=u.parentObjectToToken==null||u.parentObjectToToken.length==0?"":u.parentObjectToToken.getItem(n).toString(),o,s;f=f+RangeInfo.getAlphaLabel(i)+t.toString();o=this.grid;s=this.cell;this.cell=f;this.grid=n;var r=this._getValueComputeFormulaIfNecessary(t,i,n),e=new Date(Date.parse(r)),h=this._parseDouble(r);return this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&isNaN(h)&&!isNaN(e.getDate())&&this._dateTime1900<=e&&(r=this._toOADate(e).toString()),this.grid=o,this.cell=s,r};this.getValueFromParentObjectRowCol=function(n,t){return this._getValueComputeFormulaIfNecessary(n,t,this.grid)};this.handleIteration=function(n,t){return this.getFormulaInfoTable().containsKey(n)?this.getFormulaInfoTable.add(n,t):this.getFormulaInfoTable.add(n,t),this._iterationMaxCount>0&&n==this.cell&&this._handleIterations(t),t.getFormulaValue()};this.handleSheetRanges=function(n,t){for(var r=n.indexOf(this.sheetToken),i=0,o,s,e,u,v,f,y,h,c;r>0;){if(o=this._substring(n,i,r).lastIndexOf(":"),o>-1)if(s=this._substring(n,i+o+1,r-o-1).toUpperCase().split("'").join(""),e=this._isIE8?s.replace(/^\s+|\s+$/g,""):s.trim(),t.sheetNameToToken.containsKey(e)){if(u=i+o-1,this._sortedSheetNames.contains(s))u=u-s.length-1;else while(u>0&&this._markers.indexOf(n[u])==-1)u--;if(v=this._substring(n,u+1,o-u+i-1).toUpperCase().split("'").join(""),e=this._isIE8?v.replace(/^\s+|\s+$/g,""):v.trim(),t.sheetNameToToken.containsKey(e)){if(f=r+i+1,this._sortedSheetNames.contains(e))f=n.length-1;else while(f<n.length&&this._markers.indexOf(n[f])==-1)f++;var w=this._substring(n,i+r+1,f-i-r-1),l=t.sheetNameToToken.getItem(e).toString(),a=t.sheetNameToToken.getItem(e).toString();for(a<l&&(y=l,l=a,a=y),h="",c=0;c<_sortedSheetNames.length;c++){var y=t.sheetNameToToken.getItem(this._sortedSheetNames[c]).toString(),p=parseInt(y.split("!").join("")),b=parseInt(l.split("!").join("")),k=parseInt(a.split("!").join(""));p>b&&p<k&&(h.length>0&&(h+=this.getParseArgumentSeparator()),h+=c+String.fromCharCode(131)+w)}n=n.substring(0,u+1)+h+n.substring(f);i=n.length-f}else i=r+i}else i=r+i;else i=r+i;r=n.substring(i+1).indexOf(this.sheetToken)+1}return n.split(String.fromCharCode(131)).join(this.sheetToken)};this.isSheetMember=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n==null||n==undefined?!1:n.isSheetMember};this.parseAndComputeFormula=function(n){var i=n,r,t,u,f;for(i.length>0&&i[0]==this.getFormulaCharacter()&&(i=i.substring(1)),i.length>0&&i[0]=="+"&&(i=i.substring(1)),i.length>1&&i[0]==","&&i[1]>="0"&&i[1]<="9"&&(i="0,"+i.substring(1)),r=i.split(" ").join(""),t=r.indexOf("(");t!=-1&&t<r.length;t++)if(t>0){if(this._isDigit(r[t-1])&&!this._checkHasCharBeforeNumber(r.substring(0,t)))throw this.formulaErrorStrings[this._bad_formula]+" "+r.substring(0,t+1);if(u=r.substring(t+1).indexOf("("),u==-1)break;else t+=u}for(t=r.indexOf(")");t!=-1&&t<r.length-1;t++){if(this._isDigit(r[t+1]))throw this.formulaErrorStrings[this._bad_formula]+" "+r.substring(0,t+2);if(u=r.substring(t+1).indexOf(")"),u==-1)break;else t+=u}return this._multiTick=!1,f=this._parse(i),this.computedValue(f)};this.parseFormula=function(n){if(n.length>0&&n[0]==this.getFormulaCharacter()&&(n=n.substring(1)),n.length>0&&n[0]=="+"&&(n=n.substring(1)),this._isRangeOperand=this._supportRangeOperands&&this._isRange(n),this.getCheckDanglingStack()&&n.split(" ").join("").indexOf(this._braceRightNLeft)>-1)return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];var t=this._isIE8?n.replace(/^\s+|\s+$/g,""):n.trim();return this._parse(t)};this.getUpdatedValueCell=function(n){var i,h,c,f,e,u,s;this._inAPull=!0;var l=this.grid,a=this.cell,o=CalcEngine.getSheetFamilyItem(this.grid),t=n.toUpperCase(),r;if((r=t.indexOf(this.sheetToken))==-1&&this.cell!=""&&this.cell!=undefined?(r=this.cell.indexOf(this.sheetToken,1),r>-1&&o.tokenToParentObject!=null&&(t=this.cell.substring(0,r+1)+t,this.grid=o.tokenToParentObject.getItem(this.cell.substring(0,r+1)))):r>0&&o.sheetNameToToken!=null&&o.tokenToParentObject!=null&&(u=o.sheetNameToToken.getItem(t.substring(0,r)),t=u+t.substring(r+1),this.grid=o.tokenToParentObject.getItem(u),this.cell=t),this.updateCalcID(),this.getDependentFormulaCells().containsKey(t)||this.getFormulaInfoTable().containsKey(t))this._processedCells.clear(),this.updateDependenciesAndCell(t),this._processedCells.clear(),i=this.getValueFromParentObject(t);else{for(i=this.getValueFromParentObjectCell(t);this._breakedFormulaCells.length==1;)this.updateCalcID(),i=this.getValueFromParentObjectCell(this._breakedFormulaCells[0].toString()),this._breakedFormulaCells.removeAt(0),this.setUseFormulaValues(!0);if(this.getUseFormulaValues()&&(this.isUseFormulaValueChanged=!0,this.setUseFormulaValue(!1)),this._tempBreakedFormulaCells.length>0){for(h=1;h<=this._tempBreakedFormulaCells.length;h++)i=this.getValueFromParentObjectCell(this._tempBreakedFormulaCells[this._tempBreakedFormulaCells.length-h].toString());this._tempBreakedFormulaCells.length=0;i=this.getValueFromParentObjectCell(t)}this.setUseFormulaValues(this.isUseFormulaValueChanged);c=this.ignoreValueChanged;this.ignoreValueChanged=!0;f=this.rowIndex(t);e=this.colIndex(t);this.getPreserveFormula()?(u=this._sheetToken(n),u==""?(u="!"+this.getSheetID(this.grid)+"!",s=this.getFormulaInfoTable().getItem(u+t),s!=null&&s!=undefined&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,s.getFormulaText(),f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,s.getFormulaText(),f,e))):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e)):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e);this.ignoreValueChanged=c}return this.grid=l,this.cell=a,this._inAPull=!1,i};this.getUpdatedValueRowCol=function(n,t,i){var o=this.grid,s=CalcEngine.getSheetFamilyItem(this.grid),f=this.sheetToken+n.toString()+this.sheetToken,r,u,e;this.grid=s.tokenToParentObject.getItem(f);this._inAPull=!0;r=f+RangeInfo.getAlphaLabel(i)+t.toString();this.updateCalcID();this.getDependentFormulaCells().containsKey(r)||this.formulaInfoTable.containsKey(r)?(this._processedCells.clear(),this.updateDependenciesAndCell(r),this._processedCells.clear()):(u=this.getValueFromParentObjectCell(r),e=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,u,t,i):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,u,t,i),this.ignoreValueChanged=e);this.grid=o;this._inAPull=!1};this.setTokensForSheets=function(n){var f=CalcEngine.getSheetFamilyItem(this.grid),t,i,u,r;if(this.getSupportsSheetRanges()&&(n=this.handleSheetRanges(n,f)),t=this.getSortedSheetNames(),t!=null)for(i=0;i<t.length;i++)u=f.sheetNameToToken.getItem(t[i]),u=u.split(this.sheetToken).join(this._tempSheetPlaceHolder),r="'"+t[i].toUpperCase()+"'"+this.sheetToken,n.indexOf(r)==-1&&(r=t[i].toUpperCase()+this.sheetToken),n=n.split(r).join(u),r=t[i].toUpperCase()+this.sheetToken,n=n.split(r).join(u);return n.split(this._tempSheetPlaceHolder).join(this.sheetToken)};this.recalculateRange=function(n,t){var i,r;for(this._inRecalculateRange=!0,i=n.getTop();i<=n.getBottom();++i)for(r=n.getLeft();r<=n.getRight();++r)this.parentObject.getValueRowCol!=undefined?this.parentObject.setValueRowCol(this.getSheetID(t)+1,this.parentObject.getValueRowCol(this.getSheetID(t)+1,i,r),i,r):t.setValueRowCol(this.getSheetID(t)+1,t.getValueRowCol(this.getSheetID(t)+1,i,r),i,r);this._inRecalculateRange=!1};this.refresh=function(n){var r,t,e,u,h,c;if(!this.getCalculatingSuspended()&&(this._dependencyLevel==0&&this._refreshedCells.clear(),this.getDependentCells().containsKey(n)&&this.getDependentCells().getItem(n)!=null)){this._dependencyLevel++;try{var l=CalcEngine.getSheetFamilyItem(this.grid),f=this.getDependentCells().getItem(n),a=this._lockDependencies;for(this._lockDependencies=!0,r=0;r<f.length;r++)if(t=f[r],t!=null){e=this.grid;u=this._sheetToken(t);u.length>0&&(this.grid=l.tokenToParentObject.getItem(u));try{var o=this.rowIndex(t),s=this.colIndex(t),i=this.getFormulaInfoTable().getItem(t);i!=null&&(h=this.cell,this.cell=t,(this.getAlwaysComputeDuringRefresh()||i.calcID!=this._calcID||i.getFormulaValue()=="")&&i.setFormulaValue(this.computeFormula(i.getParsedFormula())),i.calcID=this._calcID,this.cell=h,c=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i.getFormulaValue(),o,s):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i.getFormulaValue(),o,s),this.ignoreValueChanged=c,this._refreshedCells.containsKey(t)||(this._refreshedCells.add(t,0),this.refresh(t)))}catch(v){continue}this.grid=e}this._lockDependencies=a}finally{this._refreshedCells.containsKey(n)||this._refreshedCells.add(n,0);this._dependencyLevel--;this._dependencyLevel==0&&this._refreshedCells.clear()}}};this.refreshRange=function(n){for(var i,r,u,f,t=n.getTop();t<=n.getBottom();t++)for(i=n.getLeft();i<=n.getRight();i++)r=RangeInfo.getAlphaLabel(i)+t.toString(),this._dependencyLevel=0,u=CalcEngine.getSheetFamilyItem(this.grid),f=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken,u.tokenToParentObject!=null&&u.tokenToParentObject.contains(f)&&(this.grid=u.tokenToParentObject.getItem(f)),r=f+r,this.refresh(r)};this.registerGridAsSheet=function(n,t,i){var r,f,u;return CalcEngine.modelToSheetID!=null,CalcEngine.modelToSheetID==null&&(CalcEngine.modelToSheetID=new HashTable),(CalcEngine.modelToSheetID.getItem(t)==null||CalcEngine.modelToSheetID.getItem(t)==undefined)&&CalcEngine.modelToSheetID.add(t,i),r=CalcEngine.getSheetFamilyItem(t),r.isSheetMember=!0,f=n.toUpperCase(),r.sheetNameToParentObject==null&&(r.sheetNameToParentObject=new HashTable),r.tokenToParentObject==null&&(r.tokenToParentObject=new HashTable),r.sheetNameToToken==null&&(r.sheetNameToToken=new HashTable),r.parentObjectToToken==null&&(r.parentObjectToToken=new HashTable),r.sheetNameToParentObject.getItem(f)!=undefined?(u=r.sheetNameToToken.getItem(f),r.tokenToParentObject.add(u,t),r.parentObjectToToken.add(t,u)):(u=this.sheetToken+CalcEngine._tokenCount.toString()+this.sheetToken,CalcEngine._tokenCount++,r.tokenToParentObject.add(u,t),r.sheetNameToToken.add(f,u),r.sheetNameToParentObject.add(f,t),r.parentObjectToToken.add(t,u),this.sortedSheetNames=null),n};this.renameSheet=function(n,t){var i=CalcEngine.getSheetFamilyItem(t),r="",u;if(n.includes("/")||n.includes("?")||n.includes("*")||n.includes("[")||n.includes("]")||n.includes(":")||n.includes("\\"))throw"The name does not contain any of following characters: / ? * [ ] : \\";r=t.toString();r=r.toUpperCase();currentSheetName=n.toUpperCase();u=i.sheetNameToToken.getItem(r);CalcEngine.modelToSheetID.containsKey(t)&&(CalcEngine.modelToSheetID.remove(t),CalcEngine.modelToSheetID.add(n,this._calcID));i.sheetNameToParentObject.containsKey(r)&&(i.sheetNameToParentObject.remove(r),i.sheetNameToParentObject.add(currentSheetName,n));i.tokenToParentObject.containsKey(u)&&(i.tokenToParentObject.remove(u),i.tokenToParentObject.add(u,n));i.sheetNameToToken.containsKey(r)&&(i.sheetNameToToken.remove(r),i.sheetNameToToken.add(currentSheetName,u));i.parentObjectToToken.containsKey(r)&&(i.parentObjectToToken.remove(r),i.parentObjectToToken.add(n,u))};this.removeFunction=function(n){return(this._customlibraryFunctions.getItem(n)!=undefined&&this._customlibraryFunctions.remove(n),this._libraryFunctions.getItem(n)!=null)?(this._libraryFunctions.remove(n),!0):!1};this.removeNamedRange=function(n){return(n=n.toUpperCase(),this.getNamedRanges().getItem(n)!=null)?(this.getNamedRanges().remove(n),this._populateNamedRangesNonScoped(),!0):!1};this.rowIndex=function(n){var t=0,i,r=!1;if(t<n.length&&n[t]==this.sheetToken){for(t++;t<n.length&&n[t]!=this.sheetToken;)t++;t++}while(t<n.length&&this._isLetter(n[t]))r=!0,t++;if(i=parseInt(n.substring(t)),t<n.length&&!isNaN(i))return i;if(r)return-1;throw this.formulaErrorStrings[this._bad_index];};this.splitArgsPreservingQuotedCommas=function(n){var f,r,u,t,i;if(n.toString().indexOf(this.tic)==-1)return n.toString().split(this._parseArgumentSeparator);for(f=this._saveStrings(n),n=this._saveStringsText,r=n.split(this._parseArgumentSeparator),u=[],t=0;t<r.length;t++)i=r[t],i=this._setStrings(i,f),u.push(i);return u};this.removeTics=function(n){return n.length>1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(this._substring(n,1,n.length-2).indexOf(this.tic)==-1?n=this._substring(n,1,n.length-2):this._multiTick&&(n=this._substring(n,1,n.length-2))),n};this.updateCalcID=function(){this._calcID++;this._calcID==Number.MAX_SAFE_INTEGER&&(this._calcID=Number.MIN_SAFE_INTEGER+1)};this.updateDependencies=function(n){var s,t,c,h,u,e,o,i,f,r;if(!this._lockDependencies&&this.getUseDependencies())if(s=CalcEngine.getSheetFamilyItem(this.grid),t=this.cell,s.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(c=s.parentObjectToToken.getItem(this.grid),t=c+t),s.sheetNameToParentObject!=null&&n.indexOf(this.sheetToken)==-1&&(c=s.parentObjectToToken.getItem(this.grid),n=c+n),this.getDependentCells().containsKey(n)){if(u=this.getDependentCells().getItem(n),u.indexOf(t)==-1&&u.push(t),this._addToFormulaDependentCells(n),this.getDependentFormulaCells().containsKey(n)&&(e=this.getDependentFormulaCells().getItem(n),e!=null))for(o=e.keys(),i=0;i<o.length;i++)f=o[i],r=this.getDependentCells().getItem(f),r==null&&(r=[],this.getDependentCells().add(f,r)),r.indexOf(t)==-1&&r.push(t)}else{if(u=[],this.getDependentCells().add(n,u),u.push(t),this.getDependentFormulaCells().containsKey(n)&&(e=this.getDependentFormulaCells()[n],e!=null))for(o=e.keys(),i=0;i<o.length;i++)f=o[i],r=this.getDependentCells().getItem(f),r==null&&(r=[],this.getDependentCells().add(f,r)),r.indexOf(t)==-1&&r.push(t);if(this._addToFormulaDependentCells(n),this.getDependentCells().containsKey(t)&&(h=this.getDependentCells().getItem(t),h!=null&&h!=u))for(i=0;i<h.length;i++)f=h[i],u.push(f)}};this.updateDependenciesAndCell=function(n){var v=this.grid,y=CalcEngine.getSheetFamilyItem(this.grid),h=this._sheetToken(n),t,c,o,u,f,l,i,r,a,s,e;if(h.length>0&&(this.grid=y.tokenToParentObject.getItem(h)),this.formulaInfoTable.containsKey(n)){if(t=this.formulaInfoTable[n],t.calcID!=this._calcID){if(c=this.cell,this.cell=n,this._iterationMaxCount>0&&this._circCheckList.indexOf(this.cell)>-1?this._handleIterations(t):t.setFormulaValue(this.computeFormula(t.getParsedFormula())),this.getDependentCells().containsKey(n))for(o=this.getDependentCells().getItem(n),u=0;u<o.length;u++)f=this.FormulaInfoTable.getItem(o[u]),f!=null&&f!=undefined&&(f.calcID=Number.MIN_SAFE_INTEGER);t.calcID=this._calcID;this.cell=c}if(l=this.ignoreValueChanged,this.ignoreValueChanged=!0,i=this.rowIndex(n),r=this.colIndex(n),this.getPreserveFormula()&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,t.getFormulaText(),i,r):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,t.getFormulaText(),i,r)),this.ignoreValueChanged=l,this.grid=v,this._processedCells.contains(n))return;if(this._processedCells.add(n),this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,t.getFormulaValue(),i,r):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,t.getFormulaValue(),i,r),this.getDependentFormulaCells().containsKey(n))for(a=this.getDependentFormulaCells().getItem(n),s=a.keys(),e=0;e<s.length;e++)this.updateDependenciesAndCell(s[e])}};this.valueChanged=function(n,t){var f,h,i,u,o,l;if(!this.ignoreValueChanged){f=n;this.grid=n;var s=!0,e=CalcEngine.getSheetFamilyItem(f),r=RangeInfo.getAlphaLabel(t.getColIndex())+t.getRowIndex().toString();if(e.sheetNameToParentObject!=null&&e.sheetNameToParentObject.length>0&&(h=e.parentObjectToToken.getItem(f),r=h+r),t.getValue().length>0&&t.getValue()[0]==this.getFormulaCharacter()){if(this.cell=r,u=!0,this.getFormulaInfoTable().containsKey(r)){if(i=this.getFormulaInfoTable().getItem(r),t.getValue()!=i.getFormulaText()||i.getParsedFormula()==null){i.setFormulaText(t.getValue());this.getDependentFormulaCells().containsKey(this.cell)&&this.clearFormulaDependentCells(this.cell);try{i.setParsedFormula(this.parseFormula(t.getValue()))}catch(c){i.setFormulaValue(c);u=!1}}u&&(o=this.computeFormula(i.getParsedFormula()),s=o!=i.getFormulaValue()||this.getForceRefreshCall(),i.setFormulaValue(o));i.calcID=this._calcID}else{i=new FormulaInfo;i.setFormulaText(t.getValue());this.getDependentFormulaCells().containsKey(r)||this.getDependentFormulaCells().add(r,new HashTable);try{i.setParsedFormula(this.parseFormula(t.getValue()))}catch(c){i.setFormulaValue(c);u=!1}u&&(i.setFormulaValue(this.computeFormula(i.getParsedFormula())),this.computeIsFormula(i).toString()!="#NAME?"||this.getNamedRanges().containsKey(i.getFormulaText().split("=")[1].toUpperCase())||this.getUndefinedNamedRanges().add(i.getFormulaText().split("=")[1].toUpperCase()));i.calcID=this._calcID;this.getFormulaInfoTable().containsKey(r)?this.getFormulaInfoTable().add(r,i):this.getFormulaInfoTable().add(r,i)}this._iterationMaxCount>0&&u&&!this._inHandleIterations&&r==this.cell&&this._handleIterations(i);l=this.ignoreValueChanged;this.ignoreValueChanged=!0;this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(f)+1,i.getFormulaValue(),t.getRowIndex(),t.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(f)+1,i.getFormulaValue(),t.getRowIndex(),t.getColIndex());this.ignoreValueChanged=l}else!this._inRecalculateRange&&this.getFormulaInfoTable().containsKey(r)&&(this.getFormulaInfoTable().remove(r),this.getDependentFormulaCells().containsKey(r)&&this.clearFormulaDependentCells(r));s&&this.getDependentCells().containsKey(r)&&(this._dependencyLevel=0,this.refresh(r))}};this.getActiveCell=function(){return this.cell};this.getAllowShortCircuitIFs=function(){return this._allowShortCircuitIFs};this.setAllowShortCircuitIFs=function(n){this._allowShortCircuitIFs=n};this.getAlwaysComputeDuringRefresh=function(){return this._alwaysComputeDuringRefresh};this.setAlwaysComputeDuringRefresh=function(n){this._alwaysComputeDuringRefresh=n};this.getCalculatingSuspended=function(){return this._calculatingSuspended};this.setCalculatingSuspended=function(n){this._calculatingSuspended=n};this.getCheckDanglingStack=function(){return this._checkDanglingStack};this.setCheckDanglingStack=function(n){this._checkDanglingStack=n};this.getCustomLibraryFunctions=function(){return this._customlibraryFunctions};this.getDependentCells=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetDependentCells==null&&(n.sheetDependentCells=new HashTable),n.sheetDependentCells}return this._dependentCells==null&&(this._dependentCells=new HashTable),this._dependentCells};this.getDependentFormulaCells=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetDependentFormulaCells==null&&(n.sheetDependentFormulaCells=new HashTable),n.sheetDependentFormulaCells}return this._dependentFormulaCells==null&&(this._dependentFormulaCells=new HashTable),this._dependentFormulaCells};this.getEnableLookupTableCaching=function(){return this._enableLookupTableCaching};this.setEnableLookupTableCaching=function(n){this._enableLookupTableCaching=n};this.getErrorStrings=function(){return this._errorStrings==null&&(this._errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!"]),this._errorStrings};this.setErrorStrings=function(n){this._errorStrings=n};this.getExcelLikeComputations=function(){return this._excelLikeComputations};this.setExcelLikeComputations=function(n){this._excelLikeComputations=n};this.getForceRefreshCall=function(){return this._forceRefreshCall};this.setForceRefreshCall=function(n){this._forceRefreshCall=n};this.getFormulaCharacter=function(){return CalcEngine._formulaChar=='\0'&&(CalcEngine._formulaChar="="),CalcEngine._formulaChar};this.setFormulaCharacter=function(n){CalcEngine._formulaChar=n};this.getFormulaInfoTable=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetFormulaInfoTable==null&&(n.sheetFormulaInfoTable=new HashTable),n.sheetFormulaInfoTable}return this._formulaInfoTable==null&&(this._formulaInfoTable=new HashTable),this._formulaInfoTable};this.getPreserveLeadingZeros=function(){return this._preserveLeadingZeros};this.setPreserveLeadingZeros=function(n){this._preserveLeadingZeros=n};this.getIterationMaxCount=function(){return this._iterationMaxCount};this.setIterationMaxCount=function(n){this._iterationMaxCount=n;this._iterationMaxCount>0&&this.setThrowCircularException(!0)};this.getIterationMaxTolerance=function(){return this._iterationMaxTolerance};this.setIterationMaxTolerance=function(n){this._iterationMaxTolerance=n};this.getIterationValues=function(){return this._iterationValues==null&&(this._iterationValues=new HashTable),this._iterationValues};this.getLibraryComputationException=function(){return this._libraryComputationException};this.getLibraryFunctions=function(){return this._libraryFunctions};this.getLockDependencies=function(){return this._lockDependencies};this.setLockDependencies=function(n){this._lockDependencies=n};this.getMaximumRecursiveCalls=function(){return this._maximumRecursiveCalls};this.setMaximumRecursiveCalls=function(n){this._maximumRecursiveCalls=n};this.getNamedRanges=function(){return this.namedRanges==null&&(this.namedRanges=new HashTable,this._namedRangesNonScoped=new HashTable),this.namedRanges};this.setNamedRanges=function(n){this.namedRanges=n;this._populateNamedRangesNonScoped()};this.getUndefinedNamedRanges=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.undefinedsheetNamedRnages==null&&(this.undefinedsheetNamedRnages=new HashTable),this.undefinedsheetNamedRnages):(this.undefinednamedRange==null&&(this.undefinednamedRange=new HashTable),this.undefinednamedRange)};this.getNameRangeValues=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.namedRangeValues==null&&(this.namedRangeValues=new HashTable),this.namedRangeValues):(this.rangeValues==null&&(this.rangeValues=new HashTable),this.rangeValues)};this.getNamedRangesOriginalNames=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetNamedRangesOriginalNames==null&&(this.sheetNamedRangesOriginalNames=new HashTable),this.sheetNamedRangesOriginalNames):(this.namedRangesOriginalNames==null&&(this.namedRangesOriginalNames=new HashTable),this.namedRangesOriginalNames)};this.getNamedRangeCellCollection=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetNamedRangeCellCollection==null&&(this.sheetNamedRangeCellCollection=new HashTable),this.sheetNamedRangeCellCollection):(this.namerangecellcollection==null&&(this.namerangecellcollection=new HashTable),this.namerangecellcollection)};this.getDependentNamedRangeCells=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetDependentNamedRangeCells==null&&(this.sheetDependentNamedRangeCells=new HashTable),this.sheetDependentNamedRangeCells):(this.dependentNamedRangeCells==null&&(this.dependentNamedRangeCells=new HashTable),this.dependentNamedRangeCells)};this.getParseArgumentSeparator=function(){this._parseArgumentSeparator=='\0'&&(this._parseArgumentSeparator=",");var n=",";return this._isParseArgumentSeparator||n==this._parseArgumentSeparator||(this._parseArgumentSeparator=n),this._parseArgumentSeparator};this.setParseArgumentSeparator=function(n){this._parseArgumentSeparator=n;this._isParseArgumentSeparator=!0};this.getParseDateTimeSeparator=function(){return this._parseDateTimeSeparator};this.setParseDateTimeSeparator=function(n){this._parseDateTimeSeparator=n};this.getParseDecimalSeparator=function(){this._parseDecimalSeparator=='\0'&&(this._parseDecimalSeparator=".");var n=".";return this._isParseDecimalSeparatorChanged||n==this._parseDecimalSeparator||(this._parseDecimalSeparator=n),this._parseDecimalSeparator};this.setParseDecimalSeparator=function(n){this._parseDecimalSeparator=n;this._parseDecimalSeparator=!0};this.getPreserveFormula=function(){return this._preserveFormula};this.setPreserveFormula=function(n){this._preserveFormula=n};this.getReservedWordOperators=function(){return this._reservedWordOperators==null&&(this._reservedWordOperators=[" or "," and "," xor ","if "," then "," else ","not "]),this._reservedWordOperators};this.setReservedWordOperators=function(n){this._reservedWordOperators=n};this.getRethrowLibraryComputationExceptions=function(){return this._rethrowLibraryComputationExceptions};this.setRethrowLibraryComputationExceptions=function(n){this._rethrowLibraryComputationExceptions=n};this.getRethrowParseExceptions=function(){return this._rethrowExceptions};this.setRethrowParseExceptions=function(n){this._rethrowExceptions=n};this.getRowMaxCount=function(){return this._rowMaxCount};this.setRowMaxCount=function(n){this._rowMaxCount=n};this.getSortedSheetNames=function(){if(this._sortedSheetNames==null){var n=CalcEngine.getSheetFamilyItem(this.grid);n!=null&&n.sheetNameToToken!=null&&(this._sortedSheetNames=n.sheetNameToToken.keys(),this._sortedSheetNames.sort())}return this._sortedSheetNames};this.getSupportLogicalOperators=function(){return this._supportLogicalOperators};this.setSupportLogicalOperators=function(n){this._supportLogicalOperators=n};this.getSupportRangeOperands=function(){return this._supportRangeOperands};this.setSupportRangeOperands=function(n){this._supportRangeOperands=n};this.getSupportsSheetRanges=function(){return this._supportsSheetRanges};this.setSupportsSheetRanges=function(n){this._supportsSheetRanges=n};this.getThrowCircularException=function(){return this._throwCircularException};this.setThrowCircularException=function(n){this._throwCircularException=n};this.getTreatStringsAsZero=function(){return this._treatStringsAsZero};this.setTreatStringsAsZero=function(n){this._treatStringsAsZero=n};this.getUseDatesInCalculations=function(){return this._useDatesInCalcs};this.setUseDatesInCalculations=function(n){this._useDatesInCalcs=n};this.getUseDependencies=function(){return this._useDependencies};this.setUseDependencies=function(n){this._useDependencies=n};this.getUseFormulaValues=function(){return this._useFormulaValues};this.setUseFormulaValues=function(n){this._useFormulaValues=n};this.getUseNoAmpersandQuotes=function(){return this._useNoAmpersandQuotes};this.setUseNoAmpersandQuotes=function(n){this._useNoAmpersandQuotes=n};this.getValidPrecedingChars=function(){return this._validPrecedingChar+this.getParseArgumentSeparator()};this.setValidPrecedingChars=function(n){this._validPrecedingChars=n};this.getEnableFormulaErrorValidation=function(){return this._enableFormulaErrorValidation};this.setEnableFormulaErrorValidation=function(n){this._enableFormulaErrorValidation=n};this.getWeekEndType=function(){return["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"]};this.computeSum=function(n){var e=0,t,f,r,l=this.splitArgsPreservingQuotedCommas(n),s,o,u,i,h,a,c;if(!n||n.length==0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(s)>-1))return s;for(o=0;o<l.length;o++)if(r=l[o],r.indexOf(":")>-1){if(r.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}for(u=this.getCellsFromArgs(r),i=0;i<u.length;i++){try{if(u[i].startsWith(this.tic)&&isNaN(this._parseDouble(u[i]))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(h=CalcEngine.getSheetFamilyItem(this.grid),ej.isNullOrUndefined(h.parentObjectToToken)?t=this.getValueFromArg(u[i]).split(this.tic).join(""):(a=h.parentObjectToToken.getItem(this.grid)+u[i],c=this.getFormulaInfoTable().getItem(a),t=ej.isNullOrUndefined(c)||ej.isNullOrUndefined(c._formulaText.toUpperCase().match("SUBTOTAL"))?this.getValueFromArg(u[i]).split(this.tic).join(""):"0"),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}}catch(v){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(t!=""){if(f=t==this.trueValueStr?!0:t==this.falseValueStr?!1:this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}isNaN(f)?t="":e=e+f}}}else{try{if(r.startsWith(this.tic)&&isNaN(this._parseDouble(r))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=this.getValueFromArg(r).split(this.tic).join(""),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}}catch(v){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(t.length>0){if(f=t==this.trueValueStr?!0:t==this.falseValueStr?!1:this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1)return t;isNaN(f)||(e=e+f)}}return e.toString()};this.computeDate=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,i,o;if(s!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]);t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0];t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1];t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2];var r=this._parseDouble(t[0]),u=this._parseDouble(t[1]),h=this._parseDouble(t[2]),f=0;if(!isNaN(r)&&!isNaN(u)&&!isNaN(h)){if(r<0){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}while(u>12)u-=12,r++;f=this._getSerialDateFromDate(r,u,h)}if(f==0){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return this._excelLikeComputations&&(o=this._fromOADate(f),o.toString()!="Invalid Date")?o.toLocaleDateString():f.toString()};this.computeDatevalue=function(n){var f=this.splitArgsPreservingQuotedCommas(n),s=f.length,h,i,e,t,u;if(s!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(h)>-1))return h;if(this._isCellReference(n)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=new Date(Date.parse(f[0]));e=this._parseDouble(f[0]);try{if(!isNaN(e)||i.toString()=="Invalid Date")if(e>0)i=this._fromOADate(e);else{var r=n.split(this.getParseDateTimeSeparator()),s=r.length,o="";for(t=0;t<s;++t)r[t]=this.computedValue(r[t]),o+=t<s-1?r[t]+this.getParseDateTimeSeparator():r[t];o=o.split(this.tic).join(this._string_empty);i=new Date(Date.parse(o))}}catch(c){return this.formulaErrorStrings[this.invalid_arguments]}if(f[0].indexOf("2001")==-1&&i.getFullYear()==2001&&i.setFullYear(new Date(Date.now()).getFullYear()),u=this._toOADate(i),isNaN(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}return this.treat1900AsLeapYear&&u>59&&(u+=1),Math.round(u).toString()};this.computeDay=function(n){var e=this.splitArgsPreservingQuotedCommas(n),i,t;if(e.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;var r=1,f=this.getValueFromArg(n).split(this.tic).join(""),u=this._parseDouble(f);if(isNaN(u))if(t=new Date(Date.parse(f)),t.toString()!="Invalid Date")r=t.getDate();else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}else{if(u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}t=this._getDateFromSerialDate(u);r=t.getDate()}return r.toString()};this.computeDays=function(n){var l=n,r=this.splitArgsPreservingQuotedCommas(n),u,t,i,o,s,f,e,h,c;if(r.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)?u:(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=t==""||t==null?new Date(Date.parse("1899-12-31")).toDateString():t,i=i==""||i==null?new Date(Date.parse("1899-12-31")).toDateString():i,f=this._parseDouble(t.split(this.tic).join("")),e=this._parseDouble(i.split(this.tic).join("")),o=isNaN(f)?new Date(Date.parse(t)):this._getDateFromSerialDate(f),s=isNaN(e)?new Date(Date.parse(i)):this._getDateFromSerialDate(e),h=s.getTime()-o.getTime(),c=Math.ceil(h/864e5),c.toString())};this.computeDays360=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,s,l,a,y;if(o!=2&&o!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(s)>-1))return s;var v=!1,u=0,i=new Date(Date.parse(this.getValueFromArg(r[0]).split(this.tic).join(""))),t=new Date(Date.parse(this.getValueFromArg(r[1]).split(this.tic).join(""))),h=this.getValueFromArg(r[0]),c=this.getValueFromArg(r[1]),f=h.split(this.tic).join("")=="TRUE"?"1":h.split(this.tic).join("")=="FALSE"?"0":h,e=c.split(this.tic).join("")=="TRUE"?"1":c.split(this.tic).join("")=="FALSE"?"0":c;if(f=this._parseDouble(f.split(this.tic).join("")),e=this._parseDouble(e.split(this.tic).join("")),isNaN(f)&&isNaN(this._isDate(i))||isNaN(e)&&isNaN(this._isDate(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}return i=f>0?this._getDateFromSerialDate(f):i,t=e>0?this._getDateFromSerialDate(e):t,l=!1,a=this.falseValueStr,o==3&&(a=this.getValueFromArg(r[2])),v=a==this.trueValueStr?!0:!1,i.getDate()==31&&(i=new Date(i.setDate(i.getDate()-1))),t.getDate()==31&&!v&&i.getDate()<30?t=new Date(t.setDate(t.getDate()+1)):t.getDate()==31&&(t=new Date(t.setDate(t.getDate()-1))),t<i&&(l=!0,y=i,i=t,t=y),u=t.getDate()-i.getDate(),u+=30*(t.getMonth()-i.getMonth()),u+=360*(t.getFullYear()-i.getFullYear()),l&&(u=-u),u.toString()};this.computeEDate=function(n){var v=n,i=this.splitArgsPreservingQuotedCommas(n),l=i.length,r,e;if(l!=2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i[0]==""||i[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()&&((r=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;var u=this.getValueFromArg(i[0]).split(this.tic).join(""),y=parseInt(u),t=isNaN(u)?new Date(Date.parse(u)):this._fromOADate(parseInt(u)),h=this.getValueFromArg(i[1]).split(this.tic).join(""),c=parseInt(h);if(t.toString()=="Invalid Date"&&isNaN(c))try{var o=new Date(Date.now()),s=this._parseDouble(u),f=parseInt(h);if(f<0&&f<s){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(s!=0)e=this.dateTime1900,e=this._fromOADate(s),t=new Date(e.setMonth(e.getMonth()+f));else return t=new Date(o.setMonth(o.getMonth()+f)),this.computeDays(o.toLocaleDateString()+this.getParseArgumentSeparator()+t.toLocaleDateString())}catch(a){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula]+a;return this.getErrorStrings()[1].toString()}return t=new Date(t.setMonth(t.getMonth()+c)),this.getExcelLikeComputations()?t.toLocaleDateString():parseInt(this._toOADate(t)).toString()};this.computeEOMonth=function(n){var l=n,i=this.splitArgsPreservingQuotedCommas(n),h=i.length,r,c,e,o,s;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i[0]==""||i[1]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()&&((r=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;var f=this.getValueFromArg(i[0]).split(this.tic).join(""),t=new Date(f),u=this._parseDouble(this.getValueFromArg(i[1]).split(this.TIC).join(""));if(t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(isNaN(u))try{if(c=new Date(Date.now()),e=parseInt(f),u=this._parseDouble(this.getValueFromArg(i[1]).split(this.tic).join("")),u<0&&e<=0&&u<e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}}catch(a){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return o=parseInt(f),!isNaN(o)&&t.getFullYear()>9999&&(t=this._fromOADate(o)),t=new Date(t.setMonth(t.getMonth()+u)),s=new Date(t.getFullYear(),t.getMonth()+1,1,-1).getDate(),t=new Date(t.getFullYear(),t.getMonth(),s),this.getExcelLikeComputations()?t.toLocaleDateString():this._getSerialDateTimeFromDate(t).toString()};this.computeHour=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t,i,r,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=new Date(Date.now()),this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n=="TRUE"?"1":n=="FALSE"?"0":n,t=new Date(Date.parse(n)),r=parseInt(n),r<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(u=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(u))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getHours().toString()};this.computeISOWeeknum=function(n){var i=this.splitArgsPreservingQuotedCommas(n),c=i.length,u,r,t,o,s,h;if(c!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1))return u;if(r=this.getValueFromArg(i[0]),r[0]==this.tic&&this._isTextEmpty(r.split(this.tic).join(""))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}this._isTextEmpty(r)&&(n=this.computeDatevalue(new Date(1990,12,28).toLocaleDateString()));(n.indexOf(":")>-1||!this._isCellReference(this.getValueFromArg(i[0]))&&this.getValueFromArg(this.DateFormatter(i[0])).indexOf(":")>-1)&&(n="0");t=this.getValueFromArg(i[0]).split(this.tic).join("");t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;var l=new Date(t),e=this.DateFormatter(t),f=new Date(Date.parse(e)),a=this.dateTime1900;if(f.toString()=="Invalid Date")try{o=parseInt(e);f=this.fromOADate(o);t=f.toLocaleDateString()}catch(v){if(this.getRethrowLibraryComputationExceptions())throw"Bad Cell reference";return this.getErrorStrings()[1].toString()}return s=t+this.getParseArgumentSeparator()+"21",h=parseInt(this.computeWeeknum(s)),h.toString()};this.DateFormatter=function(n){var r=new Date(n),t=r.getDate(),i=r.getMonth()+1,u=r.getFullYear(),n;return t<10&&(t=+t),i<10&&(i=i),i+"/"+t+"/"+u};this.computeMinute=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,t,r;if(u.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(t=new Date(Date.now()),n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=new Date(Date.parse(n)),n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(r=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(r))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getMinutes().toString()};this.computeMonth=function(n){var r=1,o=this.splitArgsPreservingQuotedCommas(n),f,i,t,e,u;if(o.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(f)>-1))return f;if(i=this.getValueFromArg(n),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=new Date(Date.parse(i.split(this.tic).join(""))),e=parseInt(i),!isNaN(e)&&t.getFullYear()>9999&&(t=this._fromOADate(e)),i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(n=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(n))),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(t.toString()!="Invalid Date")r=t.getMonth()+1;else{if(u=this._parseDouble(this.getValueFromArg(n)),isNaN(u))return this.formulaErrorStrings[this._invalid_arguments];u<1?r=1:(t=this._getDateFromSerialDate(u),r=t.getMonth()+1)}return r.toString()};this.computeNetworkDays=function(n){var h=this.splitArgsPreservingQuotedCommas(n),y=h.length,c,f,t,e=[],p,o,s,u,k,l,w,a,rt;if(y!=2&&y!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(p=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(p)>-1))return p;if(o=this.getValueFromArg(h[0]).split(this.tic).join(""),s=this.getValueFromArg(h[1]).split(this.tic).join(""),o==""||s==""){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}var i=new Date(Date.parse(o)),r=new Date(Date.parse(s)),u=this._parseDouble(o);if(!isNaN(u)&&i.getFullYear()>9999&&(i=this._fromOADate(u)),i.toString()=="Invalid Date"&&(i=this._fromOADate(u)),i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(u=this._parseDouble(s),!isNaN(u)&&r.getFullYear()>9999&&(r=this._fromOADate(u)),r.toString()=="Invalid Date"&&(r=this._fromOADate(u)),r.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(y==3)if(c=h[2],c.indexOf(":")>-1)for(k=this.getCellsFromArgs(c),l=0;l<k.length;l++){try{f=this.getValueFromArg(l).split(this.tic).join("")}catch(d){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return d}f!=""&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&e.indexOf(t)==-1&&t>i&&t<r&&t.getDay()!=0&&t.getDay()!=6&&e.push(t))}else for(w=this.splitArgsPreservingQuotedCommas(c.split(this.tic).join("")),a=0;a<w.length;a++){try{f=this.getValueFromArg(w[a])}catch(d){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return d}f.length>0&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&e.indexOf(t)==-1&&t>i&&t<r&&t.getDay()!=0&&t.getDay()!=6&&e.push(t))}var b=0,v=parseInt(this.computeDatevalue(s))-parseInt(this.computeDatevalue(o)),g=i.getDay(),nt=r.getDay(),tt=g-1,it=7-nt;return v=v+tt+it,rt=parseInt(v/7)*2,b=v-tt-it-rt+1-e.length,(nt==6||g==0)&&b--,b.toString()};this.computeNetworkDaysOintl=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=i.length,r,f,t,h=[],c,e,l,a,o,v,s,b,w,y,tt;if(u!=2&&u>4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(c=0;c<u;c++)if(c!=2&&(e=this.formulaErrorStringCheck(i[c],FormulaArgumentType.Date),this.getErrorStrings().indexOf(e)>-1))return e;if(u>=3&&(e=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e}if(l=this.getValueFromArg(i[0]).split(this.tic).join(""),a=this.getValueFromArg(i[1]).split(this.tic).join(""),l==""||a==""){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(o=new Date(Date.parse(this._fromOADate(l))),v=new Date(Date.parse(this._fromOADate(a))),o.toString()=="Invalid Date"){if(s=this._parseDouble(l),isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}o=this.fromOADate(s)}if(v.toString()=="Invalid Date"){if(s=this._parseDouble(a),isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}v=this._fromOADate(s)}if(u==4)if(r=i[3],r=this.adjustRangeArg(r),r.indexOf(":")>-1||r.indexOf(",")>-1)for(b=this.getCellsFromArgs(r),w=0;w<b.length;w++){try{f=this.getValueFromArg(b[w]).toString().split(this.tic).join("")}catch(d){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return d}f!=""&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&h.indexOf(t)==-1&&t>o&&t>v&&t.getDay()!=0&&t.getDay()!=6&&h.push(t))}else{try{f=this.getValueFromArg(r).split(this.tic).join("")}catch(d){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return d}f.length>0&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&h.indexOf(t)==-1&&t>o&&t<v&&t.getDay()!=0&&t.getDay()!=6&&h.push(t))}if(y=parseInt(i[2]),u>2&&!isNaN(y)){if(isNaN(i[2])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}y=parseInt(i[2])}else y=1;for(var it=this._splitArguments(this.getWeekEndType()[y].toString(),","),g=parseInt(this.computeDatevalue(a))-parseInt(this.computeDatevalue(l))+1,k=g,nt=1,p=o;nt<g;)tt=p.getDay(),it.indexOf(tt.toString())>=0?k--:h.indexOf(p)>=0&&k--,p=new Date(p.setDate(p.getDate()+1)),nt++;return k.toString()};this.computeNow=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return new Date(Date.now()).toString()};this.computeSecond=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,t,r;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(t=new Date(Date.now()),n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=new Date(Date.parse(n)),n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(r=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(r))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getSeconds().toString()};this.computeTime=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,r,o;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;t[0]=this.getValueFromArg(t[0]);t[1]=this.getValueFromArg(t[1]);t[2]=this.getValueFromArg(t[2]);t[0]=t[0]==""?"0":t[0];t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0];t[1]=t[1]==""?"0":t[1];t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1];t[2]=t[2]==""?"0":t[2];t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2];var u=this._parseDouble(t[0]),f=this._parseDouble(t[1]),e=this._parseDouble(t[2]),i=0;if(isNaN(u)||isNaN(f)||isNaN(e)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(i=(3600*u+60*f+e)/86400,o=new Date(Date.now()).toLocaleDateString()+" "+i,dt=new Date(Date.parse(o)),i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}return i.toString()};this.computeTimevalue=function(n){var u=this.splitArgsPreservingQuotedCommas(n),o=u.length,r,f,t,i,e;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]).split(this.tic).join(""),t=t.split(this.tic).join(""),t.indexOf(":")>-1&&(f=new Date,t=f.toLocaleDateString()+" "+t),i=new Date(Date.parse(t)),i.toString()=="Invalid Date"&&(n=new Date(Date.now()).toLocaleDateString()+" "+n,i=new Date(Date.parse(n))),i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return e=(3600*i.getHours()+60*i.getMinutes()+i.getSeconds())/86400,e.toString()};this.computeToday=function(n){if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var t=new Date(Date.now());return this.getExcelLikeComputations()?t.toLocaleDateString():this._toOADate(t).toString()};this.computeWeekday=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,o,s,i,r,f,h,u;if(e!=1&&e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(o)>-1)?o:t.length==2&&this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)?s:(i=this.getValueFromArg(t[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,r=new Date(Date.parse(i.split(this.tic).join(""))),f=parseInt(i),!isNaN(f)&&r.getFullYear()>9999&&(r=this._fromOADate(f)),t[1]=e==2?t[1]:"1",r.toString()=="Invalid Date"&&(r=this._fromOADate(f)),h=parseInt(this.getValueFromArg(t[1])),u=r.getDay(),h==1?u+=1:(u==0&&(u=7),h==3&&(u-=1)),u.toString())};this.computeWeeknum=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,r,u,h,i;if(e>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((r=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(r)>-1)||e==2&&(r=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;if(t[0]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}u=this._fromOADate(this.DateFormatter(this.getValueFromArg(t[0]).split(this.tic).join("")))=="Invalid Date"?this.getValueFromArg(t[0]).split(this.tic).join(""):this.DateFormatter(this.getValueFromArg(t[0]).split(this.tic).join(""));var p=parseInt(u),w=new Date(u),o=new Date(Date.parse(u));if(o.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(h=["","0","1","","","","","","","","","1","2","3","4","5","6","0","","","","1"],e!=2?i=1:(i=this.getValueFromArg(t[1]),i==""&&(i=1)),Boolean(i=="TRUE"||i=="FALSE")){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}!isNaN(i);var f=parseInt(h[i]),c=new Date(o.getFullYear(),0,1),s=c.getDate(),l=s<f?f-s+1:s-f,a=this._fromOADate(this._toOADate(c)-l),v=this._toOADate(o)-this._toOADate(a),y=Math.floor(v/7)+1+f;return y.toString()};this.computeWorkDay=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,r,i,o,s,u,e;if(f!=2&&f>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(r=0;r<f;r++)if(r!=1&&(i=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(i=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)return i}if(t[0]==""||t[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(o="",s=0,o=f==3?t[0]+this.getParseArgumentSeparator()+t[1]+this.getParseArgumentSeparator()+"1"+this.getParseArgumentSeparator()+t[2]:t[0]+this.getParseArgumentSeparator()+t[1]+this.getParseArgumentSeparator()+"1",u=this.computeWorkDayOintl(o),e=new Date(Date.parse(this._fromOADate(u).toString())),isNaN(Date.parse(u))&&parseInt(u)&&(e=this._fromOADate(u)),e.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return this._toOADate(e).toString()};this.computeWorkDayOintl=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,u,a,b,v,i,l,p;if(o>4||o<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t[0]==""||t[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)||(u=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)||o>=3&&(u=this.formulaErrorStringCheck(t[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)||o==4&&(u=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)))return u;var e,f,s=[],c=this.getValueFromArg(t[0]).split(this.tic).join(""),h=new Date(Date.parse(c)),w=this.getValueFromArg(t[1]).split(this.tic).join(""),d;if(!isNaN(Date.parse(c))&&parseInt(c)&&(h=this._fromOADate(c)),isNaN(w)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(d=this._toOADate(h)+w,c.split(this.tic).join("")==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if(h.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(a=parseInt(w.toString()),o==4)if(e=t[3],e=this.adjustRangeArg(e),e.indexOf(":")>-1||e.indexOf(",")>-1)for(b=this.getCellsFromArgs(e),v=0;v<b.length;v++){try{f=this.getValueFromArg(b[v]).split(this.tic).join("")}catch(g){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}f!=""&&(i=new Date(Date.parse(f)),i.toString()!="Invalid Date"&&s.indexOf(i)==-1&&i>h&&s.push(i.toString()))}else{try{f=this.getValueFromArg(e).split(this.tic).join("")}catch(nt){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}f!=""&&(i=new Date(Date.parse(f)),isNaN(Date.parse(f))&&parseInt(f)&&(i=this._fromOADate(f)),i.toString()!="Invalid Date"&&s.indexOf(i)==-1&&i>h&&s.push(i))}if(l=parseInt(t[2]),o>2&&!isNaN(l)||(l=1),l==0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}var k=this._splitArguments(_weekEndType[l].toString(),","),y=0,r=h;if(a<0)while(y>a)r=new Date(r.setDate(r.getDate()-1)),p=r.getDay(),k.indexOf(p.toString())<0&&s.indexOf(r)<0&&y--;else while(y<a)r=new Date(r.setDate(r.getDate()+1)),p=r.getDay(),k.indexOf(p.toString())<0&&s.indexOf(r.toString())<0&&y++;return this._toOADate(r).toString()};this.computeYear=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e=f.length,u,t,i,r;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(f[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=new Date(Date.parse(t)),r=parseInt(t),!isNaN(r)&&i.getFullYear()>9999&&(i=this._fromOADate(r)),r==0)return"1900";if(r<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}if(t.split(this.tic).join("")==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if(i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return i.getFullYear().toString()};this.computeChar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,r,t,i;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),!isNaN(i)&&i>0&&i<256)return String.fromCharCode(t);if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()};this.computeCode=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e=i.length,r,t,u,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]).split(this.tic).join(""),u=parseInt(t),!isNaN(u))return t.charCodeAt(0).toString();if(t==null||t==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return i[0].length>4?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return f=t,f.charCodeAt(0).toString()};this.computeUniCode=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,r,t,e,u;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),this._isCellReference(i[0])){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(e=this._parseDouble(t),t=="invalid expression"||t==null||t==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return u=t.split(this.tic).join("").charCodeAt(0),u.toString()};this.computeUpper=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(t)>-1)?t:this._stripTics0(this.getValueFromArg(n)).toUpperCase()};this.computeLower=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(t)>-1)?t:this._stripTics0(this.getValueFromArg(n)).toLowerCase()};this.computeLen=function(n){var r=this.splitArgsPreservingQuotedCommas(n),e=r.length,i,t,u,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1)?i:(t=this._stripTics0(this.getValueFromArg(r[0])),isNaN(parseInt(t))&&(u=new Date(Date.parse(t)),u!="Invalid Date"&&(t=this.DateFormatter(t))),f=t[0]==this.tic&&t[t.length-1]==this.tic,(f?t.length-2:t.length).toString())};this.computeMid=function(n){var i=this.splitArgsPreservingQuotedCommas(n),s=i.length,r,t,u;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((r=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;t=i[0];t=this.getValueFromArg(t);var f=t[0]==this.tic&&t[t.length-1]==this.tic,e=this.getValueFromArg(i[1]),o=this._parseDouble(i[2]);if(e=this.getValueFromArg(i[1]),u=Number(e)+Number(f?0:-1),e==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return i[1].indexOf("#VALUE!")>-1?"#VALUE!":Number(u)>t.length?"":(t=u+o>t.length?t.substring(u):this._substring(t,u,o),f&&t[0]!=this.tic&&(t=this.tic+t),f&&t&&(t=t+this.tic),this._stripTics0(t))};this.computeLeft=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,e,t,o,r,i;if(f!=1&&f!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this._stripTics0(this.getValueFromArg(u[0])),!this._isCellReference(u[0])&&u[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return(o=t[0]==this.tic&&t[t.length-1]==this.tic,r=f==2?u[1]:"1",r=this.computedValue(r),r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,i=Number(r)+Number(o?1:0),i=t.length>=i?i:t.length,i=t.length>=i?i:t.length,i<0)?this.getErrorStrings()[1].toString():(i==0?t="":(t=t.substring(0,i),o&&t[t.length-1]!=this.tic&&(t=t+this.tic)),this.getUseNoAmpersandQuotes()&&t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]&&(t=this._substring(t,1,t.length-2)),t)};this.computeRight=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,f,e,t,i,o;if(u!=1&&u!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(f)>-1))return f;if(s1=this._stripTics0(this.getValueFromArg(r[0])),!this._isCellReference(r[0])&&r[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return(e=s1[0]==this.tic&&s1[s1.length-1]==this.tic,t=u==2?this.getValueFromArg(r[1]):"1",t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=parseInt(t),isNaN(i)||i<0||t.indexOf("#VALUE!")>-1)?"#VALUE!":i==0?"":(i=Number(t)+Number(e?1:0),o=s1.length>=i?s1.length-i:0,s1=s1.substring(o),e&&s1[0]!=this.tic&&(s1=this.tic+s1),s1)};this.computeReplace=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,s,h,i,o;if(c!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1)return s;if(h=this.formulaErrorStringCheck(r[3],FormulaArgumentType.Text),this.getErrorStrings().indexOf(h)>-1)return h}var u=this._stripTics0(this.getValueFromArg(r[0])),f=this._stripTics0(this.getValueFromArg(r[3])),e="",t=this.getValueFromArg(r[1]);if(t=t=="TRUE"?"1":t=="FALSE"?"0":t,t=this._parseDouble(t),i=this.getValueFromArg(r[2]),i=i=="TRUE"?"1":i=="FALSE"?"0":i,i=this._parseDouble(i),!this._isCellReference(r[0])&&r[0][0]!=this.tic||!this._isCellReference(r[3])&&r[3][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(t==0&&i==0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();if(isNaN(t)||isNaN(i))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();else try{if(o="",u==null||u=="")return f;u.length<=t&&t>i?e=u+f:u.length<=t?(o=u,e=u.split(o).join(f)):i==0?e=f+u:(o=this._substring(u,t-1,i),e=u.split(o).join(f))}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString()}return e};this.computeExact=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u,t,i,f,e;if(r.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)?u:(t=this.getValueFromArg(r[0]),i=this.getValueFromArg(r[1]),f=this._parseDouble(t),e=this._parseDouble(i),isNaN(f)||(t=f.toString()),isNaN(e)||(i=e.toString()),t.split(this.tic).join("")==i.split(this.tic).join("")?"TRUE":"FALSE")};this.computeFind=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r,e,u;if(t.length!=2&&t.length!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.TwoTextWithNumber),this.getErrorStrings().indexOf(r)>-1))return r;var o=this._stripTics0(this.getValueFromArg(t[0])),f=this._stripTics0(this.getValueFromArg(t[1])),i=1;return(t.length==3&&(e=this.getValueFromArg(t[2]),i=this._parseDouble(e),isNaN(i)&&(i=1)),i<=0||i>f.length)?"#VALUE!":(u=f.indexOf(o,i-1),u<0)?"#VALUE!":(Number(u)+Number(1)).toString()};this.computeSearch=function(n){var u=this.splitArgsPreservingQuotedCommas(n),s=u.length,o,e=1,h,t,r,i,c,f;if(s!=2&&s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.TwoTextWithNumber),this.getErrorStrings().indexOf(h)>-1))return h;if(t=this._stripTics0(this.getValueFromArg(u[0])).toUpperCase(),r=this._stripTics0(this.getValueFromArg(u[1])).toUpperCase(),!this._isCellReference(u[0])&&u[0][0]!=this.tic||!this._isCellReference(u[1])&&u[1][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(i=t,t.indexOf("*")>-1)t=t.split("*").join("")[0].toString();else if(t.indexOf("?")>-1){for(c=i.substring(0,i.indexOf("?")),f=Number(r.indexOf(c));r.indexOf(i)==-1;)for(f=Number(r.substring(f).indexOf(c))+Number(f)+1,i=t;i.indexOf("?")!=-1;){if(r.length<=f)return this.getErrorStrings()[1].toString();i=i.substring(0,i.indexOf("?"))+r[f]+t.substring(i.indexOf("?")+1);f++}t=i}if(o=Number(r.indexOf(t))+1,s==3){if(e=parseInt(this.getValueFromArg(u[2])),e==1&&t[0]==r[0])return e;if(!isNaN(e))try{o=Number(r.indexOf(t,e))+1}catch(l){return this.getErrorStrings()[1].toString()}}return o==0?this.getErrorStrings()[1].toString():o.toString()};this.computeSubstitute=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e,r,c,s,o,f;if(t.length!=3&&t.length!=4){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation())for(e=0;e<3;e++)if(r=this.formulaErrorStringCheck(t[e],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)return r;if(t.length==4&&this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;var i=this._stripTics0(this.getValueFromArg(t[0])),u=this._stripTics0(this.getValueFromArg(t[1])),h=this._stripTics0(this.getValueFromArg(t[2]));if(t.length==3){if(u==""||u==null)return i;i=i.split(u).join(h)}else{if(c=this.getValueFromArg(t[3]),!this._isCellReference(t[3])&&t[3][0]==this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(s=parseInt(c),!isNaN(s)){for(o=s,f=-1;o>0&&(f=i.indexOf(u,Number(f)+1))>-1;)o--;o==0&&(i=i.substring(0,f)+h+i.substring(Number(f)+Number(u.length)))}}return i};this.computeUniChar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,i,t,r,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(u[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(this._stripTics0(t)),isNaN(r)||r<=0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t[0]==this.tic?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return f=String.fromCharCode(t),f.toString()};this.computeClean=function(n){var f=this.splitArgsPreservingQuotedCommas(n),r,i,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments].toString()}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;var t=this.getValueFromArg(f[0]),e=t=="TRUE"||t=="FALSE"?!0:!1;if(this.getErrorStrings().indexOf(t)>-1)return t;if(t.indexOf(this.tic)==-1&&!this._isCellReference(n)&&isNaN(this._parseDouble(t))&&!e)return this.getErrorStrings()[5].toString();for(i=0;i<=31;i++)u=this.computeChar(i.toString()),t.indexOf(u)>-1&&(t=t.replace(u,""));return t[0]==this.tic&&t[t.length-1]==this.tic&&(t=this._substring(t,1,t.length-1)),t};this.computeTrim=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,t,f,r;if(u.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;for(t=this._stripTics0(this.getValueFromArg(n)),f=[this.tic,""],t=t.split(this.tic).join(""),r=0;t.length!=r;)r=t.length,t=t.split(" ").join(" ");return t};this.computeRept=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,s,u,i,e;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(f)>-1))return f;if(r=this._stripTics0(this.getValueFromArg(t[0])),s=1,t[1]=this.getValueFromArg(t[1].split(this.tic).join("")),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],r==null||r==""||t[1]==null||t[1]=="")return"";if(u=parseInt(t[1].split(this.tic).join("")),u<0||isNaN(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}for(i="",e=0;e<u;e++){if(i.length>32767){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}i=i.concat(r)}return i};this.computeProper=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,u,t,r;if(f!=1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(u=this.getValueFromArg(i[0]),!this._isCellReference(i[0])&&i[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return t=this._stripTics0(u),r=t.indexOf("'"),r>=0&&r<t.length-1&&(t=t.replace(/[']/," '")),/[^a - zA - Z]/.test(t)?t=t.replace(/\w\S*/g,function(n){for(var t=0,i=n[t].toString().toUpperCase().charCodeAt(0);!(i>64&&i<91);)t++,n[t]!=undefined?i=n[t].toUpperCase().charCodeAt(0):(t--,i=0);return n.substr(0,t)+n.charAt(t).toUpperCase()+n.substr(t+1).toLowerCase()}):/[a - zA - Z0 - 9] + $/.test(t)&&(t=t.replace(/[^a-zA-Z0-9_\\]/,"")),t};this.computeT=function(n){var r=0,u=this.splitArgsPreservingQuotedCommas(n),i,o,f,e;if(u.length>1)for(i=0;i<u.length;i++)if(r++,u[i].indexOf(":")>-1)for(--r,o=this.getCellsFromArgs(i),f=0;f<o.length;f++)r++;if(r>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;var t=this.getValueFromArg(n),s=t=="TRUE"||t=="FALSE"?!0:!1;return isNaN(this._parseDouble(t))&&!s&&isNaN(this._isDate(t))?/[a-zA-Z0-9!#$%&'()*+,/:;<=>?@\^_`{|}~-]/.test(t)?this._stripTics0(t):" ":" "};this.computeNumberValue=function(n){var i=this.splitArgsPreservingQuotedCommas(n),l=i.length,f=this._parseDecimalSeparator,e=this._parseArgumentSeparator,o,t,r,u,s,h,c;if(l>3||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this._stripTics0(this.getValueFromArg(i[0])),l>1)try{if(r=i.length>1&&i[2]!=null?this._stripTics0(this.getValueFromArg(i[1])):e,u=i.length>1&&i[2]!=null?this._stripTics0(this.getValueFromArg(i[2])):f,r=="invalid expression"||u=="invalid expression"||(r==null||r=="")&&(u==null||u=="")){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}f=this._stripTics0(r)[0];e=this._stripTics0(u)[0]}catch(a){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==""||t==null)return"0";if(s=t.indexOf(f),h=t.indexOf(e),h>=s&&(s!=-1||h!=-1)&&i.length>2){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=t.replace(this.tic,""),t=t.replace(" ",""),t=t.replace(e.toString(),""),t=t.replace(f,this._parseDecimalSeparator),c=this.computeValue(t),isNaN(c)||t[t.length-1]=="$"){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return c};this.computeConcatenate=function(n){var i="",r=this.splitArgsPreservingQuotedCommas(n),u,t,f;if(!n||n.length==0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1))return u;for(t=0;t<r.length;t++){if(this._isCellReference(r[t])&&r[t].indexOf(":")!=-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}f=r[t];i=i.concat(this._stripTics0(this.getValueFromArg(r[t])))}return i.indexOf("#N/A")>-1&&(i="#N/A"),i};this.computeValue=function(n){var i="",r,h,f,e,o,s;try{if(r=this.splitArgsPreservingQuotedCommas(n),h=r.length,h!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(f)>-1))return f;var t=r[0],u=!1,c=!1;if(t.indexOf(this.tic)>-1&&(u=!0),t=this._stripTics0(this.getValueFromArg(t)),(t!=null||t!="")&&!this._isCellReference(t)&&u&&isNaN(this._parseDouble(t.split(",").join("").split("$").join("")))&&(t=t.split(this.tic).join(""),c=!0),!this._isCellReference(r[0])&&r[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((t==null||t=="")&&u){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if((t==null||t=="")&&!u){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}if(t.indexOf(":")>-1)return i=this.computeTimevalue(t),i.toString();if(t[0]=="$"&&(t=t.split("$").join("")),t.indexOf(",")>-1&&(t=t.split(",").join("")),(t[0]=="%"||t[t.length-1]=="%")&&(t=t.split("%").join(""),e=this._parseDouble(t),isNaN(e)||(t=(e/100).toString())),o=new Date(Date.parse(t)),s=this._parseDouble(t),isNaN(s))if(o.toString()!="Invalid Date")i=this._toOADate(o);else{if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}else i=s.toString()}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return i.toString()};this.computeDollar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),t=u[0],i="2",e,f,o,r,s,h;if(u.length==2&&(i=u[1]),u.length>2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(t),t=t==""||t==null?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(i),i=i==""||i==null?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f=this._parseDouble(t),o=!1,isNaN(this._parseDouble(i))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((t==null||t=="")&&this._isCellReference(u[0])&&t[0]!=this.tic&&t[t.length-1]!=this.tic&&(f=0,o=!0),isNaN(f)&&!o){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return r=this._parseDouble(i),s=0,isNaN(r)&&(r=i==""?0:2),r>0?ej.format(f,"c"+r):(h=Math.pow(10,-r),s=Math.round(f/h)*h,ej.format(s,"c0"))};this.computeFixed=function(n){var f=this.splitArgsPreservingQuotedCommas(n),r=f[0],i="2",t="FALSE",s,h,e,u,c,o,l;if(f.length>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;if(h=f.length,h>1&&(i=f[1]),h>2&&(t=f[2]),r=this.getValueFromArg(r),i=this.getValueFromArg(i),t=this.getValueFromArg(t),r=r==""||r==null?"0":r,i=i==""||i==null?"0":i,t=t==""||t==null?"0":t,e=this._parseDouble(r),u=this._parseDouble(i),isNaN(u)&&(u=2),c=this._parseDouble(t),isNaN(c))if(t.toUpperCase()==this.falseValueStr)o=!1;else if(t.toUpperCase()==this.trueValueStr)o=!0;else return"#NAME?";else o=c==0?!1:!0;return o&&(ej.preferredCulture().numberFormat[","]=""),u>0?ej.format(e,"n"+u):(l=Math.pow(10,-u),e=Math.round(e/l)*l,ej.format(e,"n0"))};this.computeBin2Dec=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t,u;if(r.length>1||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(r[0]).replace(this.tic,""),!/^[01]{1,10}$/.test(t))return this.getErrorStrings()[4].toString();try{return t==""&&(t="0"),u=parseInt(t,2),t.length==10&&t.substring(0,1)=="1"?(parseInt(t.substring(1),2)-512).toString():u.toString()}catch(f){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}};this.computeBin2Oct=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=this.getValueFromArg(i[0]).replace(this.tic,""),t="",s,f,e,o,h,r;if(!/^[01]{1,10}$/.test(u))return this.getErrorStrings()[4].toString();if(i.length>2||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];else i.length>1&&(places=parseInt(this.getValueFromArg(i[1]).replace(this.tic,"")));if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;if(f=i.toString(),f.length==10&&f.substring(0,1)=="1"){for(e=10,o="",h=0;h<3;h++){e=e-3;var l=this._substring(f,e,3),a=this._parseDouble(parseInt(l,2).toString(8)),c=0;for(r=a;r>0;c+=parseInt(r%10),r=parseInt(r/10));o=c.toString()+o}return"7777777"+o}if(u<0)return(1073741824+u).toString(8);if(t=parseInt(u,10).toString(8),typeof places=="undefined")return t;if(isNaN(places))return"#VALUE!";if(places<0)return"#NUM!";if(places=Math.floor(places),places>=t.length&&places<=10)while(places-t.length>0)t="0"+t,places--;else if(this.getRethrowLibraryComputationExceptions())throw(new this.getErrorStrings)[4].toString();return t};this.computeBin2Hex=function(n){var u=0,r=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(r[0]).replace(this.tic,""),i="",f;if(r.length>2||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];else r.length>1&&(u=this._parseDouble(r[1]));if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(t=="1111111111")return t.replace("1","F");if(t.length==10&&t.substring(0,1)=="1")return(1073741312+parseInt(t,2).toString(8)).toString();try{if(t.length>10||this._parseDouble(t)<0||isNaN(t))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(i=parseInt(t,2).toString(16),i=="NaN"&&(i=this.getErrorStrings()[4].toString()),r.length>1)if(u>=i.length&&u<=10)i=this._padLeft("0",u,i);else if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else i=this.getErrorStrings()[4].toString()}catch(e){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else if(this.computeIsText(t)==this.trueValueStr)i=this.getErrorStrings()[5].toString();else return t==""?"0":this.getErrorStrings()[4].toString()}return i.toUpperCase()};this.computeDec2Bin=function(n){var f=0,i=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(i[0]).replace(this.tic,""),r=i.length>1?this.getValueFromArg(i[1]).replace(this.tic,""):"10",u="",e,o;if(n==null||n==""||i.length>2||i.length<1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(isNaN(this._parseDouble(t))&&isNaN(this._parseDouble(r))){if((t!=null||t!="")&&this.computeIsText(t)==this.trueValueStr||(r!=null||r!="")&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t!=null&&t!=""&&this.computeIsText(t)==this.falseValueStr||t!=null&&t!=""&&this.computeIsText(r)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==null&&t==""||r==null||r==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}}try{if(i.length>1&&(o=this.getValueFromArg(i[1]).replace(this.tic,""),f=this._parseDouble(o)),isNaN(o)){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this._parseDouble(t)<-512||this._parseDouble(t)>511)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(u=(t>>>0).toString(2),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(u=u.substring(u.length-10)),i.length>1){if(f>10){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}f<=10&&(u=this._padLeft("0",f,u))}}catch(s){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}return u};this.computeDec2Oct=function(n){var f=0,u=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(u[0]).replace(this.tic,""),r=u.length>1?this.getValueFromArg(u[1]).replace(this.tic,""):"10",i="",e,o;if(n==null||n==""||u.length>2||u.length<1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(!(!isNaN(this._parseDouble(t))&&!isNaN(this._parseDouble(r)))){if((t!=null||t!="")&&this.computeIsText(t)==this.trueValueStr||(r!=null||r!="")&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(t)>-1)return t;if(this.getErrorStrings().indexOf(r)>-1)return r;if(t!=null&&t!=""&&this.computeIsText(t)==this.falseValueStr||t!=null&&t!=""&&this.computeIsText(r)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==null&&t==""||r==null||r==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[0].toString()}}try{if(u.length>1&&(o=this.getValueFromArg(u[1]).replace(this.tic,""),f=this._parseDouble(o)),this._parseDouble(t)<-536870912||this._parseDouble(t)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(this._parseDouble(t)<0)i=parseInt(t>>>0,10).toString(8),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(i=i.substring(i.length-10));else if(i=parseInt(t,10).toString(8),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(i=i.substring(i.length-10)),u.length>1){if(f>10){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}f<=10&&(i=this._padLeft("0",f,i))}}catch(s){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}return i};this.computeHex2Bin=function(n){var u=0,r=this.splitArgsPreservingQuotedCommas(n),s,h,i,o,c;if(r.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n==this._parseArgumentSeparator.toString())if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[0].toString();if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s;if(r.length==2&&this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var t=this.getValueFromArg(r[0]),f=r.length==2?this.getValueFromArg(r[1]):"0",e=0;if(e=this._parseDouble(f),!isNaN(e)&&(e<0||e>10)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(Boolean(t=="TRUE"||t=="FALSE")||r.length==2&&Boolean(f=="TRUE"||f=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t!=""){if(t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t)))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString()}else if(this._isCellReference(r[0])&&t=="")return"0";if(t[0]==this.tic&&(t.split(this.tic).join("")==null||t.split(this.tic).join("")==""))return"0";if(f[0]==this.tic)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();else if(isNaN(this._parseDouble(f.split(this.tic).join(""))))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString();if(u=this._parseDouble(f),u<0||t[0]=="-")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();i="";t=t.split(this.tic).join("");try{for(o=0;o<t.length;o++)c=this._padLeft("0",4,parseInt(t.charAt(o),16).toString(2)),i+=c;if(t.split(this.tic).join("")=="FFFFFFFFFF")return this._parseDouble(t.split("F").join("1"));if(i.length>10||u>10||u<i.length&&u!=0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(u>=i.length)i=this._padLeft("0",u,i);else if(u!=0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(!isNaN(this._parseDouble(i))&&this._parseDouble(i)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}return i};this.computeHex2Oct=function(n){var u=0,i=this.splitArgsPreservingQuotedCommas(n),e,o,t,f,s,r;if(i.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n==this._parseArgumentSeparator.toString())if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[0].toString();if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(i.length==2&&this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this.getValueFromArg(i[0]),i[0]=i[0].split(this.TIC).join(""),f=i.length==2?this.getValueFromArg(i[1]):"0",t!=""&&t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5].toString()}if(Boolean(t=="TRUE"||t=="FALSE")||i.length==2&&Boolean(f=="TRUE"||f=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t[0]==this.tic&&(t.split(this.tic).join("")==null||t.split(this.tic).join("")==""))return"0";if(t.indexOf(this._parseArgumentSeparator.toString())>-1&&(s=t.indexOf(this._parseArgumentSeparator),t=t.split(this.tic).join("").substring(0,s-1)),r="",isNaN(this._parseDouble(f.split(this.tic).join(""))))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString();if(u=this._parseDouble(f),u<0||t[0]=="-")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(i.length>2)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();i.length>1&&(u=this._parseDouble(i[1]));try{if(t=t.split(this.tic).join(""),r=parseInt(t,16).toString(8),!isNaN(this._parseDouble(r))&&r.length>10&&(r=r.substring(r.length-10)),i.length>1){if(u>=r.length&&u<=10)r=this._padLeft("0",u,r);else if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(!isNaN(this._parseDouble(r))&&this._parseDouble(r)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}}catch(h){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.computeIsText(t)==this.trueValueStr?this.getErrorStrings()[4].toString():t==""?"0":this.getErrorStrings()[4].toString()}return r};this._padLeft=function(n,t,i){var u=i.length,r;if(i.length<t&&n.toString().length>0)for(r=0;r<t-u;r++)i=n.toString().charAt(0).concat(i);return i};this.computeAddress=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,c,s,t,r,e,o,u,a,h;if(f>5||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(c=0;c<f-1;c++)if(s=this.formulaErrorStringCheck(i[c],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)return s;if(f==5&&(s=this.formulaErrorStringCheck(i[4],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s}if(t=this._string_empty,r=this.getValueFromArg(i[0].split(this.tic).join(this._string_empty)),r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,e=this.getValueFromArg(i[1].split(this.tic).join(this._string_empty)),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,r==""||e==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(o=this._parseDouble(r),u=this._parseDouble(e),o<1||u<1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}var v=f>2?this.getValueFromArg(i[2].split(this.tic).join(this._string_empty)):"1",l=u,y=l%26;if(l=parseInt(l/26),t=t+this._charTable[y],t=t+this._charTable[parseInt(l)],a=t.split("").join(",").split(this.getParseArgumentSeparator()),a.reverse(),h=a.join(""),t="$"+h+"$"+r,f>2)switch(v){case"2":t=h+"$"+r;break;case"3":t="$"+h+r;break;case"4":t=h+r}if(f>3&&(this.getValueFromArg(i[3].split(this.tic).join(this._string_empty))=="FALSE"||this.getValueFromArg(i[3].split(this.tic).join(this._string_empty))=="0"))switch(v){case"":t="R"+o+"C"+u;break;case"1":t="R"+o+"C"+u;break;case"2":t="R"+o+"C["+u+"]";break;case"3":t="R["+o+"]C"+u;break;case"4":t="R["+o+"]C["+u+"]"}return f>4&&this.getValueFromArg(i[4].split(this.tic).join(this._string_empty))==this._string_empty&&(i[4]=this.getValueFromArg(i[4]),t=i[4].split(this.tic).join(this._string_empty)+"!"+t),t};this.computeAreas=function(n){var r,u,f,t,e,i;if(n.indexOf(" ")>0&&(n=n.substring(0,n.indexOf(" "))),!this._isCellReference(n)&&!this.getNamedRanges().containsKey(n)&&!n.indexOf(")")){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(r)>-1))return r;if(u=this._splitArguments(n,")"),u.length>2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[1].toString()}for(f=u[0].split("(").join(this._string_empty),t=this.splitArgsPreservingQuotedCommas(f),e=t.length,i=0;i<t.length;i++)if(!this._isCellReference(t[i])){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5].toString()}return t.length.toString()};this.computeChoose=function(n){var t,i,e,r,u,f;if(t=this.splitArgsPreservingQuotedCommas(n),t.length<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(i=this.getValueFromArg(t[0]).split(this.tic).join(""),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,e=this.splitArgsPreservingQuotedCommas(i),i=e[0],r=parseInt(i),isNaN(r)||r>t.length-1||r<1)return"#VALUE!";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,t[r];if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1))return u;if(f=this.getValueFromArg(t[r]),f==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return f};this.computeColumn=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,r,t;if(u.length!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(n==null||n==this._string_empty)return t=this.colIndex(this.cell).toString(),r=this.rowIndex(this.cell).toString(),t;if(t=this.colIndex(n).toString(),r=this.rowIndex(n).toString(),r<=0||!isNaN(this._parseDouble(n))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return t};this.computeColumns=function(n){var t,e,o,s,h,i,u,f,r;if(t=this.splitArgsPreservingQuotedCommas(n),t.length!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1))return e;if(o=-1,this._parseDouble(t[0],o))return"1";if(t[0].indexOf(this.tic)&&!t[0].indexOf(";")&&!t[0].indexOf(this.getParseArgumentSeparator().toString())||!this._isCellReference(t[0])&&!this.getNamedRanges().containsValue(t[0])&&!n.indexOf(";")&&!n.indexOf(this.getParseArgumentSeparator().toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(i=1,n.indexOf(":")>-1)u=this.getCellsFromArgs(n),s=this.colIndex(u[0].toString()),h=this.colIndex(u[u.length-1].toString()),i=h-s+1,i=i>0?i:1;else if(n.indexOf(";")>-1)for(r=this._splitArguments(n.split(this.tic).join(this._string_empty),";"),f=1;f<r.length;f++){if(this.splitArgsPreservingQuotedCommas(r[f-1]).length!=this.splitArgsPreservingQuotedCommas(r[1]).length){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}i=this.splitArgsPreservingQuotedCommas(r[0]).length}else r=this.splitArgsPreservingQuotedCommas(t[0].split(this.tic).join(this._string_empty)),i=r.length;return i.toString()};this.computeFormulaText=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,t=this._string_empty,r,u;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getNamedRanges().containsValue(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(r=CalcEngine.getSheetFamilyItem(this.grid),i[0].indexOf(this.sheetToken)==-1&&this.isSheetMember()&&r.parentObjectToToken!=null&&(i[0]=r.parentObjectToToken.getItem(this.grid)+i[0]),this.getFormulaInfoTable().containsKey(i[0]))u=this.getFormulaInfoTable().getItem(i[0]),t=u.getFormulaText(),this.getFormulaText(t);else{if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.rowIndex(i[0])<=0?this.getErrorStrings()[5].toString():this.getErrorStrings()[0].toString()}return t};this.computeHyperlink=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=i.length,r,f,t;if(u>2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)?r:(f=this._stripTics0(this.getValueFromArg(i[0])),u==2)?(t=this._stripTics0(this.getValueFromArg(i[1])),t==null)?"0":t==this._string_empty?"0":t:f};this.computeAbs=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,r,t,u;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.abs(u).toString()};this.computeAcos=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>1||i<-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return Math.acos(i).toString()};this.computeAcosh=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(z=Math.log(i+Math.sqrt(i*i-1)),i<=0||z==Infinity){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return z.toString()};this.computeAcot=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,e,t,r;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(e=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(n),r=0,isNaN(t)||(r=t<=0?Math.PI/2-Math.atan(t):Math.atan(1/t)),r.toString())};this.computeAcoth=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,r,t,i,f;if(e!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(i<1&&i>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(f=(Math.log((i+1)/(i-1))/2).toString(),this.computeIsErr(f)==this.trueValueStr&&this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()};this.computeArabic=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,o,s;if(u.length!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(u[0]),this.getErrorStrings().indexOf(i)!=-1)return i;if(o=parseInt(i.split(this.tic).join("").toUpperCase()),!isNaN(o)||!this._isCellReference(u[0])&&u[0][0]!=this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return isNaN(o)?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}i=i.split(this.tic).join("").toUpperCase();var f=0,h=null,r=0,t=0,e=0;for(e=1e3,s=!1,f=1;f<=i.length;f++){h=this._substring(i,f-1,1);switch(h){case"-":s=!0;break;case"I":t=1;break;case"V":t=5;break;case"X":t=10;break;case"L":t=50;break;case"C":t=100;break;case"D":t=500;break;case"M":t=1e3;break;default:if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}r=t>e?r+t-2*e:r+t;e=t}return s&&(r=-r),r.toString()};this.computeAsin=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,u,t,i,f,e;if(o!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>1||i<-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=0,isNaN(f)||(e=Math.asin(f)),e.toString()};this.computeAtan=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.atan).toString())};this.computeAtan2=function(n){var f=this.splitArgsPreservingQuotedCommas(n),c=f.length,e,u,r,o,t,i,s,h;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(r=0,o=0,t=this.getValueFromArg(f[0]),i=this.getValueFromArg(f[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,s=t=="true"?!0:!1,h=i=="true"?!0:!1,s?t=s.toString():t==this._string_empty&&(t="0"),h?i=h.toString():i==this._string_empty&&(i="0"),this.getErrorStrings().indexOf(t)>-1)return t;if(this.getErrorStrings().indexOf(i)>-1)return i;if(u=this._parseDouble(t),r=this._parseDouble(i),isNaN(u)||isNaN(r))if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();else if(r==0&&u==0)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();else return this.getErrorStrings()[3].toString();return o=Math.atan2(r,u),o.toString()};this.computeCeilingMath=function(n){var e=this.splitArgsPreservingQuotedCommas(n),s=e.length,h,r,t,u,y;if(this._isTextEmpty(n)||s>3||s<1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;r=this.getValueFromArg(e[0]);r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r;t=s>1&&e[1].length!=0?this.getValueFromArg(e[1]):"1";t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;u=s==3&&e[2].length!=0?this.getValueFromArg(e[2]):"1";u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u;var i,f=-1,o=-1,c,l=!1,a=!1,v=!1;if(l=r.split(this.tic).join(this._string_empty)=="true"?!0:!1,a=t.split(this.tic).join(this._string_empty)=="true"?!0:!1,v=u.split(this.tic).join(this._string_empty)=="true"?!0:!1,r=l?l.toString():r,t=a?a.toString():t,u=v?v.toString():u,this.getErrorStrings().indexOf(r)!=-1)return r;if(this.getErrorStrings().indexOf(t)!=-1)return t;if(this.getErrorStrings().indexOf(u)!=-1)return u;if(t.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(t.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(i=this._parseDouble(r),f=this._parseDouble(t),o=this._parseDouble(u),isNaN(i)&&!isNaN(f)&&!isNaN(o)){if(i==0&&!this._isTextEmpty(r)&&this.computeIsText(r)==this.falseValueStr||f==0&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr||o==0&&!this._isTextEmpty(u)&&this.computeIsText(u)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(r.split(this.tic).join(this._string_empty))&&r[0]==this.tic||this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[1]==this.tic||this._isTextEmpty(u.split(this.tic).join(this._string_empty))&&u[2]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(r.split(this.tic).join(this._string_empty))||this._isTextEmpty(t.split(this.tic).join(this._string_empty))||this._isTextEmpty(u.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return(i<0&&o<0&&(f=-1),i==0||f==0)?"0":(y=0,i=this._parseDouble(i.toString()),i>0&&(i+=.4999999999),i<0&&-.5>=i-parseInt(i)&&(i-=.4999999999),i=Math.round(i),y=Math.floor(i/f),c=y*f,i<0&&i%2!=0&&o==0&&(c+=f),c.toString())};this.computeCeiling=function(n){var f=this.splitArgsPreservingQuotedCommas(n),h=f.length,c,i,t,o,s,u,r,e;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c;if(f[0]=this.getValueFromArg(f[0]),i=h>1?f[0]:"1",i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f[1]=this.getValueFromArg(f[1]),t=h>1&&f[1].length!=0?f[1]:"0",t=t==""||t==null?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,o=!1,s=!1,o=i.split(this.tic).join(this._string_empty)=="true"?!0:!1,s=t.split(this.tic).join(this._string_empty)=="true"?!0:!1,i=o?o.toString():i,t=s?s.toString():t,t==this.trueValueStr)return"1";if(t==this.falseValueStr)return"0";if(t.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(i)!=-1)return i;if(this.getErrorStrings().indexOf(t)!=-1)return t;if(r=-1,e=-1,u=this._parseDouble(i),r=this._parseDouble(t),isNaN(u)&&!isNaN(r)){if(u==0&&!this._isTextEmpty(i)&&this.computeIsText(i)==this.falseValueStr||r==0&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(i.split(this.tic).join(this._string_empty))&&i[0]==this.tic||this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[0]==this.TIC){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(i.split(this.tic).join(this._string_empty))||this._isTextEmpty(t.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(u=this._parseDouble(i),r=this._parseDouble(t),!isNaN(u)&&!isNaN(r)){if(u>0&&r<0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(u==0||r==0)return"0";if(e=Math.floor(u/r)*r,r>0)while(e<u)e+=r;else while(e>u)e+=r}return e.toString()};this.computeDecimal2=function(n){var r=this.splitArgsPreservingQuotedCommas(n),h=r.length,o,t,i,f,u,s,e;if(h>3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/",!this.getValueFromArg(r[0]).indexOf(this.tic)&&!this._isCellReference(r[0])){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=0;try{t=this.getValueFromArg(r[0]).split(this.tic).join("");i=parseInt(this.getValueFromArg(r[1]).split(this.tic).join(""))}catch(c){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+c;return this.getErrorStrings()[1].toString()}if(i<2||i>o.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),i<=36&&(t=t.toUpperCase()),u=0,f=0;u<t.length&&!this._isWhiteSpace(t[u]);)if(s=t.substring(u,1),e=o.indexOf(s),e>=0&&e<i)f*=i,f+=e,u++;else{if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}return f.toString()};this.computeCombin=function(n){var e=this.splitArgsPreservingQuotedCommas(n),c=e.length,o,s,r,h,t,i,u,f;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(h=0,t=this.getValueFromArg(e[0]).split(this.tic).join(""),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(e[1]).split(this.tic).join(""),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t.split(this.tic).join("")==this._string_empty||i.split(this.tic).join("")==this._string_empty)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();if(s=this._parseDouble(t),r=this._parseDouble(i),isNaN(s)||isNaN(r)){if(this._rethrowLibraryComputationExceptions)return this.formulaErrorStrings[this._invalid_arguments];throw this.getErrorStrings()[1].toString();}else{if(u=parseInt((r+.1).toString()),f=parseInt((s+.1).toString()),f<u||u<0||f<0||r<0)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[4].toString();h=this._comb(u,f)}return h.toString()};this.computeCombinA=function(n){var r=this.splitArgsPreservingQuotedCommas(n),s=r.length,u,t,i,f,e,o;if(n.indexOf("u")>-1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(s!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(n.length>15){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return t=this.getValueFromArg(r[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t==""||t==0?"0":t,t=parseInt(t.split(this.tic).join("")),i=this.getValueFromArg(r[1]).split(this.tic).join(""),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i==""||i==0?"0":i,i=parseInt(i.split(this.tic).join("")),t==0&&i==0?f="1":(e=t+i-1,o=e+","+(t-1),f=this.computeCombin(o)),f};this.computeCos=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.cos).toString())};this.computeCosh=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),e=i.length,r,t,u,f;if(e>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.exp(u),(f+1/f)/2};this.computeCot=function(n){var u=this.splitArgsPreservingQuotedCommas(n),o=u.length,o=u.length,r,f,t,e,i;if(o!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(f=this.computeIsNumber(n),f==this.trueValueStr){if(t=n,t=t.indexOf("u")?t.split("u").join(this._string_empty):t,e=this._parseDouble(t),e>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}}else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}if(n=="0"){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return i=this._computeMath(n,Math.tan),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeCsc=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(1/parseFloat(Math.sin(i))).toString()};this.computeCsch=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i,e;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),e=this.computeIsNumber(n),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i==0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[3].toString()}return i>709?"0":(2/(Math.exp(i)-Math.exp(-i))).toString()};this.computeDecimal=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,o,s,t,i,u,f,h,e;if(c>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(o)>-1))return o;if(r[1]==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";i=0;try{t=this.getValueFromArg(r[0]).split(this.tic).join("");i=parseInt(this.getValueFromArg(r[1]).split(this.tic).join(""))}catch(l){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+l;return this.getErrorStrings()[1].toString()}if(i<2||i>s.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),i<=36&&(t=t.toUpperCase()),f=0,u=0;f<t.length;)if(h=this._substring(t,f,1),e=s.indexOf(h),e>=0&&e<i)u*=i,u+=e,f++;else{if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}return u.toString()};this.computeDegrees=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e=i.length,r,t,u,f;if(e!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=0,f=180*u/Math.PI,f.toString()};this.computeExp=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,i,t,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t==""&&(n="0"),u=this._parseDouble(t),u>709){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return this._computeMath(n,Math.exp).toString()};this.computeEven=function(n){var e=0,r=this.splitArgsPreservingQuotedCommas(n),o=r.length,u,i,t,f;if(o>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(i=this.getValueFromArg(r[0]),t=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(t.split(this.tic).join("")),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.sign(t),t=Math.abs(t),t=Math.ceil(t),e=t%2==1?f*(t+1):f*t,e.toString()};this.computeFact=function(n){var i=0,o=this.splitArgsPreservingQuotedCommas(n),e,r,t,u,f;if(o.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(r=this.getValueFromArg(n),t=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,t=this._parseDouble(t.split(this.tic).join("")),isNaN(t))return this.getErrorStrings()[1].toString();if(t<0)return this.getErrorStrings()[4].toString();if(u=t,u>12)for(i=this._factorialTable[12],f=13;f<=u;f++)i*=f;else i=this._factorialTable[u];return i.toString()};this.computeFactdouble=function(n){var r,u=1,e=this.splitArgsPreservingQuotedCommas(n),f,t,i;if(e.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(r=parseInt(this.getValueFromArg(n)),isNaN(r))return this.getErrorStrings()[1].toString();if(r<0)return this.getErrorStrings()[4].toString();if(t=r,i=t,t>3)while(i>0)u=u*i,i=i-2;else u=t==0?1:t;return u.toString()};this.computeFloor=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,f;if(e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;var t=this._parseDouble(this.getValueFromArg(u[0])),i=this._parseDouble(this.getValueFromArg(u[1])),r=0;if(!isNaN(t)&&!isNaN(i)){if(t==0)return r.toString();if(t*i<=0&&!(t<0))return this.formulaErrorStrings[this._invalid_arguments];if(r=Math.ceil(t/i)*i,i>0)while(r>t)r-=i;else while(r<t)r-=i;i==.1&&(r=t)}return r.toString()};this.computeInt=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,t,r,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(i[0]),this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=Math.floor(t).toString(),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return u};this.computeLn=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=i.length,r,t;if(u>1)return this.formulaErrorStrings[this.invalid_arguments];if(r=this.getValueFromArg(i[0]),t=this._parseDouble(r),t<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return r[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.log(t).toString()};this.computeLog=function(n){var f=this.splitArgsPreservingQuotedCommas(n),o=f.length,e,t,i,r,u;if(o>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),i=o==2?this.getValueFromArg(f[1]):"10",t==""||t==null||i==""||i==null){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(t),u=this._parseDouble(i),r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(r)||isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||i[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return(Math.log(r)/Math.LN10/(Math.log(u)/Math.LN10)).toString()};this.computeLogTen=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),f=i.length,r,t,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(this._computeMath(t,Math.log)/Math.LN10).toString()};this.computePI=function(n){if(this.getEnableFormulaErrorValidation()){var t=this.formulaErrorStringCheck(n,FormulaArgumentType.None);return this.formulaErrorStrings[this._invalid_arguments]==t?t:Math.PI.toString()}return Math.PI.toString()};this.computeProduct=function(n){var f=1,r,t,o=!0,u,s,i,c,h,e;if(this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(s)>-1))return s;for(i=0;i<u.length;i++)if(c=u[i],u[i].indexOf(":")>-1)for(h=this.getCellsFromArgs(c),e=0;e<h.length;e++){try{t=this.getValueFromArg(h[e]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(l){return l}if(t.length>0){if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}f=f*r;o=!1}}else{try{t=this.getValueFromArg(u[i]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(l){return l}if(t.length>0){if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t==this.tic||this._isCellReference(u[i])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}f=f*r;o=!1}}return o?"0":f.toString()};this.computeSecant=function(n){var e=this.splitArgsPreservingQuotedCommas(n),r,u,t,f,i;if(n=this.getValueFromArg(n),r=e.length,r!=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(u=this.computeIsNumber(n),u==this.trueValueStr){if(t=n,t=t.indexOf("u")?t.split("u").join(""):t,f=parseFloat(t),f>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}}else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}return i=this._computeMath(n,Math.cos),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeSeriessum=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r,f,e,i;if(t.length!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(r=0;r<=2;r++)if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;var h=0,c=0,l=0,o=0,u=0,s;if(s=t[3].indexOf(";")>-1?this._splitArguments(t[3].split(this.tic).join(""),";"):this.getCellsFromArgs(t[3].split(this.tic).join("")),t[0]==""||t[1]==""||t[2]==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}for(h=this._parseDouble(this.getValueFromArg(t[0])),c=this._parseDouble(this.getValueFromArg(t[1])),l=this._parseDouble(this.getValueFromArg(t[2])),i=0;i<s.length;i++){if(o=this._parseDouble(this.getValueFromArg(s[i])),isNaN(o)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}u=u+o*Math.pow(h,c+i*l)}if(isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return u.toString()};this.computeSin=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.sin).toString())};this.computeSinh=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),e=i.length,r,t,u,f;if(e>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.exp(u),(f-1/f)/2};this.computeSqrt=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),r=i.length,t;if(r>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.sqrt).toString())};this.computeSubTotal=function(n){var f=!1,t=this._string_empty,e,r=0,u=this._splitArguments(n,this.getParseArgumentSeparator().toString()),s=u.length,o,i;if(s<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(u[0],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this._isCellReference(u[0])?this.getValueFromArg(u[0]):u[0].toString(),e=this._parseDouble(t),isNaN(e)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(r=parseInt(e.toString()),(r<1||r>11)&&(r<101||r>111))return this.getErrorStrings()[1].toString();if(f)return"0";t=n.substring(u[0].toString().length+1);f=!0;i=this._string_empty;switch(r){case 1:case 101:i=this.computeAverage(t);break;case 2:case 102:i=this.computeCount(t);break;case 3:case 103:i=this.computeCounta(t);break;case 4:case 104:i=this.computeMax(t);break;case 5:case 105:i=this.computeMin(t);break;case 6:case 106:i=this.computeProduct(t);break;case 7:case 107:i=this.computeStdev(t);break;case 8:case 108:i=this.computeStdevp(t);break;case 9:case 109:i=this.computeSum(t);break;case 10:case 110:i=this.computeVar(t);break;case 11:case 111:i=this.ComputeVarp(t);break;default:i=this.getErrorStrings()[1].toString()}return f=!1,i};this.computeSumif=function(n){var l=this.splitArgsPreservingQuotedCommas(n),w=l.length,p,b,t,a,f,v,h,c,r,i,u;if(w!=2&&w!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((p=this.formulaErrorStringCheck(l[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(p)>-1)||w==3&&(p=this.formulaErrorStringCheck(l[2],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(p)>-1)))return p;if(b=l[0],t=l[1],t.length<1)return"0";a=this.token_equal;t[0]!=this.tic[0]&&"=><".indexOf(t[0])==-1&&(t=this.getValueFromArg(t));f=t.length>0&&t[0]==this.tic[0]?1:0;v=this.minValue;t.substring(f)[0]==">="?(t=this._substring(t,f+2,t.length-2-2*f),a=this.token_greatereq):t.substring(f)[0]=="<="?(t=this._substring(t,f+2,t.length-2-2*f),a=this.token_lesseq):t.substring(f)[0]=="<"?(t=this._substring(t,f+1,t.length-1-2*f),a=this.token_less):t.substring(f)[0]==">"?(t=this._substring(t,f+1,t.length-1-2*f),a=this.token_greater):t.substring(f)[0]=="="&&(t=this._substring(t,f+1,t.length-1-2*f));t=t.split(this.tic).join("");var tt=this._parseDouble(t,v),e=w==2?b:l[2],y=this.getCellsFromArgs(b),o=this.getCellsFromArgs(e),s=y.length;if(s>o.length&&(h=e.indexOf(":"),h>-1)){var g=this.rowIndex(this._substring(e,0,h)),nt=this.colIndex(this._substring(e,0,h)),k=this.rowIndex(this._substring(e,h+1)),d=this.colIndex(this._substring(e,h+1));g!=k?k+=s-o.length:nt!=d&&(d+=s-o.length);e=this._substring(e,0,h+1)+RangeInfo.getAlphaLabel(d)+k.toString();o=this.getCellsFromArgs(e)}c=0;switch(a){case this.token_equal:for(u=0;u<s;++u)i=this.getValueFromArg(y[u]),i.split(this.tic).join("")==t&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i.split(this.tic).join("").split("$").join("")),isNaN(r)||(c+=r));break;case this.token_greatereq:for(u=0;u<s;++u)i=this.getValueFromArg(y[u]),r=this._parseDouble(i.split(this.tic).join("").split("$").join("")),isNaN(r)||r>=v&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r));break;case this.token_greater:for(u=0;u<s;++u)i=this.getValueFromArg(y[u]),r=this._parseDouble(i.split(this.tic).join("").split("$").join("")),isNaN(r)||r>v&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r));break;case this.token_less:for(u=0;u<s;++u)i=this.getValueFromArg(y[u]),r=this._parseDouble(i.split(this.tic).join("").split("$").join("")),isNaN(r)||r<v&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r));break;case this.token_lesseq:for(u=0;u<s;++u)i=this.getValueFromArg(y[u]),r=this._parseDouble(i.split(this.tic).join("").split("$").join("")),isNaN(r)||r<=v&&(i=o[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r))}return c.toString()};this.computeTan=function(n){return this._computeMath(n,Math.tan).toString()};this.computeTrunc=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,t=0,f,i,u,e,s;if(o>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(o==2&&(t=this.getValueFromArg(r[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=this._parseDouble(t)),i=this.getValueFromArg(r[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,u=this._parseDouble(i.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return e=Math.pow(10,t),s=u<0?-1:1,(s*Math.floor(e*Math.abs(u))/e).toString()};this.computeLognormOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,e,u,f,i,h,c;if(s!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(f=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(this._string_empty),t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),e=this._parseDouble(t[1]),u=this._parseDouble(t[2]),isNaN(r)||isNaN(e)||isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw"#Value! Passsed value is non - numeric";return this.getErrorStrings()[1].toString()}if(r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw"#Num! Passsed value is incorrect";return this.getErrorStrings()[4].toString()}return t[3]==this.falseValueStr?(h=0,c=0,f=Math.exp(-(Math.pow(Math.log(r)-e,2)/(2*Math.pow(u,2)))),f=f/(r*u*Math.sqrt(2*Math.PI))):f=this._standardNormalCumulativeDistribution((Math.log(r)-e)/u),f.toString()};this.computeLognormOinv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,f,r,e,u,o,i;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(o=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),e=this._parseDouble(t[1]),u=this._parseDouble(t[2]),!isNaN(r)&&!isNaN(e)&&!isNaN(u)){if(r<=0||r>=1||u<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}o=Math.exp(this._normalinv(r,e,u))}return o.toString()};this.computeNormOinv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,r,o,u,f,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(this._string_empty),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),o=this._parseDouble(t[1]),u=this._parseDouble(t[2]),!isNaN(r)&&!isNaN(o)&&!isNaN(u)){if(r>=0&&r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments]+this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=this._normalCumulativeDistributionFunctionInverse(r,o,u)}return f<=0?this.formulaErrorStrings[this._iterations_dont_converge]:f.toString()};this.computeNormOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,s,u,f,r,e,h,i,c;if(o!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;for(e=0,h=0,i=0;i<o;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(u=this._parseDouble(t[0]),f=this._parseDouble(t[1]),r=this._parseDouble(t[2]),!isNaN(u)&&!isNaN(f)&&!isNaN(r)){if(r<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}o!=3&&(e=t[3]==this.trueValueStr?1:0,c=0,c=this._parseDouble(t[3]),isNaN(c)||(e=1));h=e==0?this._normalProbabilityDensity(u,f,r):this._normaldist(u,f,r)}return h.toString()};this.computeNormOsODist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r=t.length,u,f,e,i,o;if(r!=1&&r!=2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(f=0,e=0,i=0;i<r;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(this._string_empty);if(u=this._parseDouble(t[0]),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw"#VALUE! Passed argument value is non numeric";return this.getErrorStrings()[1].toString()}return r==2&&(f=t[1]==this.trueValueStr?1:0,o=0,o=this._parseDouble(t[1]),isNaN(o)||(f=1)),e=f==0?this._standardNormalProbabilityDensityFunction(u):this._standardNormalCumulativeDistributionFunction(u),e.toString()};this.computeNormOsOInv=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,t,u,i;if(f!=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(u=0,i=0;i<f;++i)r[i]=this.getValueFromArg(r[i]).split(this.tic).join(this._string_empty);if(t=this._parseDouble(r[0]),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw"#VALUE! Passed argument value is non numeric";return this.getErrorStrings()[1].toString()}if(t<=0||t>=1){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value doesnot match with in range level";return this.getErrorStrings()[4].toString()}return u=this._standardNormalCumulativeDistributionFunctionInverse(t),u.toString()};this.computePermut=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,r,u,f,e,i;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(e=0,t[0]=this.getValueFromArg(t[0]),t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=this.getValueFromArg(t[1]),t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],u=this._parseDouble(this.getValueFromArg(t[0])),f=this._parseDouble(this.getValueFromArg(t[1])),isNaN(u)||isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];var c=f+.1,s=u+.1,o=1;for(i=s-c+1;i<=s;++i)o=o*i;return e=o,e.toString()};this.computePermutationA=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,u,i,r,e,o,s;if(f!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)?u:(e=0,t[0]=this.getValueFromArg(t[0]),t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=this.getValueFromArg(t[1]),t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],i=this._parseDouble(t[0]),r=this._parseDouble(t[1]),isNaN(i)||isNaN(r))?this.formulaErrorStrings[this._invalid_arguments]:(o=r+.1,s=i+.1,Math.pow(i,r).toString())};this.computeStandardize=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,u,f,e,r,o,i;if(s!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;for(r=0,o=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==""||t[i]==null?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(f=this._parseDouble(t[0]),e=this._parseDouble(t[1]),r=this._parseDouble(t[2]),!isNaN(f)&&!isNaN(e)&&!isNaN(r)){if(r<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}o=(f-e)/r}return o.toString()};this.computeBinomOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,e,r,f,u,o,s,i;if(h!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(o=0,s=0,i=0;i<h;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(this._string_empty),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),f=this._parseDouble(t[1]),u=this._parseDouble(t[2]),isNaN(r)||isNaN(f)||isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw"#VALUE! Passed value is nonnumeric";return this.getErrorStrings()[1].toString()}if(r<0||r>f||u<0||u>1){if(this._rethrowLibraryComputationExceptions)throw"#NAME! Passed argument value is not equal to minimum par value";return this.getErrorStrings()[4].toString()}return o=t[3]==this.trueValueStr?1:0,s=o==0?this._comb(r,f)*Math.pow(u,r)*Math.pow(1-u,f-r):this._binomdist(f,r,u),s.toString()};this.computeChisqOinvOrt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,u,e,i;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i<o;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),u=this._parseDouble(t[1]),!isNaN(r)&&!isNaN(u)){if(r<=0||r>1||u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(r==1)return"0";e=this._chiinv(r,u)}return e.toString()};this.computeChisqOdistOrt=function(n){var i=this.splitArgsPreservingQuotedCommas(n),o=i.length,e,u,r,f,t,s;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,t=0;t<o;++t)i[t]=this.getValueFromArg(i[t]),i[t]=i[t]==null||i[t]==""?"0":i[t],i[t]=i[t].split(this.tic).join("")=="TRUE"?"1":i[t].split(this.tic).join("")=="FALSE"?"0":i[t];if(u=this._parseDouble(i[0]),r=this._parseDouble(i[1]),!isNaN(u)&&!isNaN(r)){if(u<0||r<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(u==0)return r.toString();for(r==1&&this._excelLikeComputations,f=1-this._chidist(u,r),t=0;t<f.toString().length;t++);s=Math.round(f)}return f.toString()};this.computeFOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,i;if(s!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;var r,u=0,f=0,o=0;for(i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(this._string_empty),t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),u=this._parseDouble(t[1]),f=this._parseDouble(t[2]),isNaN(r)||isNaN(u)||isNaN(f)){if(this._rethrowLibraryComputationExceptions)throw"#VALUE! Passed argument value is incorrect";return this.getErrorStrings()[1].toString()}if(u<1||f<1||r[0]=="-"){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value is incorrect";return this.getErrorStrings()[4].toString()}return t[3]==1?o=this._fCumulativeDensity(r,u,f):t[3]==0&&(o=this._fProbabilityDensity(r,u,f)),o.toString()};this.computeGammaln=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t;if(r.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=0,t=this._parseDouble(n),!isNaN(t)&&t>1)t=this._gammaln(t);else{if(t==1)return"0";if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return t.toString()};this.computeConfidenceOnorm=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,f,e,u,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw"Wrong number of arguments";return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(u=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(this._string_empty),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),f=this._parseDouble(t[1]),e=this._parseDouble(t[2]),!isNaN(r)&&!isNaN(f)&&!isNaN(e)){if(r<=0||r>=1||f<=0||e<1){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is different from minimum par";return this.getErrorStrings()[4].toString()}u=this._excelLikeComputations?this._normalinv(1-r+r/2,0,1):this._newnormalinv(1-r+r/2);u=u*f/Math.sqrt(e)}return u.toString()};this.computeExponOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,u,r,f,o,i,h;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,o=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==null||t[i]==null?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(u=this._parseDouble(t[0]),r=this._parseDouble(t[1]),isNaN(u)||isNaN(r)){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is non-numerical";return this.getErrorStrings()[1].toString()}if(u<0||r<=0){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is below or equal to 0";return this.getErrorStrings()[4].toString()}return f=t[2]==this.trueValueStr?1:0,h=this._parseDouble(t[2]),isNaN(h)||(f=0),o=f==0?r*Math.exp(-r*u):1-Math.exp(-r*u),o.toString()};this.computeFisher=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e=f.length,r,t,u,i;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(u=0,i=this.getValueFromArg(f[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(i),!isNaN(t)&&t>-1&&t<1)u=.5*Math.log((1+t)/(1-t));else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return u.toString()};this.computeFisherInv=function(n){var e=this.splitArgsPreservingQuotedCommas(n),o=e.length,i,r,u,t,f;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(u=0,t=this.getValueFromArg(e[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(t),isNaN(r)||(f=Math.exp(2*r),u=(f-1)/(f+1)),u.toString())};this.computeGammalnOPrecise=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,i,t;if(u!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=0,t=this._parseDouble(n.toString()),!isNaN(t)&&t>1)t=this._gammaln(t);else{if(t==1)return"0";if(t<=0){if(this._rethrowLibraryComputationExceptions)throw"Passed Argument value is less than or equal to minimum value 0";return this.getErrorStrings()[4].toString()}}return t.toString()};this.computeLarge=function(n){var i=this.splitArgsPreservingQuotedCommas(n),h=i.length,r,u,f,t;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(r=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)return r;if(u=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)return u}if(t=this.getValueFromArg(i[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,f=this._parseDouble(t),isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];var e=f,o=this._getDoubleArray(i[0]),s=o.length;return e<1||e>s?this.formulaErrorStrings[this._invalid_arguments]:(o.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),o[s-e].toString())};this.computeSmall=function(n){var i=this.splitArgsPreservingQuotedCommas(n),s=i.length,u,f,t,e;if(s!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(u=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)return u;if(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)return f}if(t=this.getValueFromArg(i[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,e=this._parseDouble(t),isNaN(e))return this.formulaErrorStrings[this._invalid_arguments];var o=e,r=this._getDoubleArray(i[0]),h=r.length;return o<1||o>r.length?this.formulaErrorStrings[this._invalid_arguments]:(r.sort(function(n,t){return isNaN(n)||isNaN(t)?n<t?1:-1:t-n}),r[h-o].toString())};this.computeCounta=function(n){var r=0,f,h=this.splitArgsPreservingQuotedCommas(n),t,u,o,e,s,i;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(u=0;u<h.length;u++)if(t=h[u],t.indexOf(":")>-1)for(o=this.getCellsFromArgs(t),e=0;e<o.length;e++){try{f=this.getValueFromArg(o[e]).split(this.tic).join(this._string_empty)}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}f.length>0&&r++}else if(t=="")r++;else if(this._isLetter(t[0]))f=this.getValueFromArg(t),f.length>0&&r++;else if(t.indexOf(this.getParseArgumentSeparator())>-1)for(s=this.splitArgsPreservingQuotedCommas(t.split(this.tic).join("")),i=0;i<s.length;i++){if(i[0]!=this.tic&&this._isCellReference(s[i]))if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_arguments];else return this.formulaErrorStrings[this.invalid_arguments];(i.length>0||i=="")&&r++}else u.length>0&&r++;return r.toString()};this.computeAverage=function(n){var i=0,e=0,r,t,f=[],h=this.splitArgsPreservingQuotedCommas(n),c,o,l,s,u;if(h.length<1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(c)>-1))return c;for(o=0;o<h.length;o++)if(f=h[o],f.indexOf(":")>-1)for(l=this.getCellsFromArgs(f),s=0;s<l.length;s++){try{t=this.getValueFromArg(l[s]).split(this.tic).join("");t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(a){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();else return this.getErrorStrings()[4].toString()}if(t.length>0&&!isNaN(t))if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)==-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString()}else i=Number(i)+Number(r),e++}else{try{t=this.getValueFromArg(f).split(this.tic).join(this._string_empty);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;u=this.getValueFromArg(f);u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u}catch(a){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();else return this.getErrorStrings()[4].toString()}if(t.length>0)if(r=this._parseDouble(t),isNaN(r))if(u[0]==this.tic)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();else if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString();else i=Number(i)+Number(r),e++}return e>0&&(i=Number(i)/Number(e)),i.toString()};this.computeAverageA=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e,t,h,u,r,o,c,f,s;if(i.length<1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this._string_empty,h=0,i==this.trueValueStr||i==this.falseValueStr)return u=i==this.trueValueStr,u?+u:+u;for(r=0;r<i.length;r++)if(i[r].indexOf(this.getParseArgumentSeparator().toString())>-1)for(o=this.splitArgsPreservingQuotedCommas(i[r].split(this.tic).join(this._string_empty)),c=0,f=0;f<o.length;f++)s=o[f],t=t+s+this.getParseArgumentSeparator().toString(),i[c]=s;else this._isCellReference(i[r])?t+=i[r]+this.getParseArgumentSeparator().toString():t=this._parseDouble(i[r],h)?t+i[r]+this.getParseArgumentSeparator().toString():t+"0"+this.getParseArgumentSeparator().toString();return t[t.length-1]==","&&(t=t.substring(0,t.length-1)),this.computeAverage(t)};this.computeMax=function(n){var r=this.minValue,u,t,i,f,e,s,o;if(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),f==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(e=0;e<f.length;e++)if(i=f[e],i.indexOf(":")>-1)for(s=this.getCellsFromArgs(i),o=0;o<s.length;o++){try{t=this.getValueFromArg(s[o]).split(this.tic).join(this._string_empty)}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return h}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.max(r,u)}else{try{if(!this._isCellReference(i)&&i[0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}t=i==this._string_empty?"0":this.getValueFromArg(i);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return h}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.max(r,u)}return r!=this.minValue?r.toString():this._string_empty};this.computeMaxa=function(n){var f=this.minValue,i,t,u,o,r,s,e;if(this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(o)>-1))return o;for(r=0;r<u.length;r++)if(u[r].indexOf(":")>-1)for(s=this.getCellsFromArgs(u[r]),e=0;e<s.length;e++){try{t=this.getValueFromArg(s[e]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}f=Math.max(f,i)}}else{try{if(u[r].startsWith(this.tic)||u[r]!=""){if(t=this.getValueFromArg(u[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return t}t==""&&(t="0")}else t="0"}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)==-1)return t;i=this._parseDouble(t)}f=Math.max(f,i)}}return f!=this.minValue?f.toString():this._string_empty};this.computeMedian=function(n){var r,t,i,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(r)>-1)?r:(t=this._getDoubleArray(n),t.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),i=parseInt((t.length/2).toString()),u="",t.length%2==1?t[i].toString():((t[i]+t[i-1])/2).toString())};this.computeMin=function(n){var r=this.maxValue,u,t,f,s,h,e,i,c,o;if(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(s=n.split(";"),s.length>1){for(i=0;i<s.length;i++)for(h=this.splitArgsPreservingQuotedCommas(s[i]),o=0;o<h.length;o++)if(e=this.getValueFromArg(h[o]),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,e.length>0)if(u=this._parseDouble(e),isNaN(u)){if(this.getErrorStrings().indexOf(e)==-1)return e}else r=Math.min(r,u);if(r!=this.maxValue)return r.toString()}for(i=0;i<f.length;i++)if(f[i].indexOf(":")>-1)for(c=this.getCellsFromArgs(f[i]),o=0;o<c.length;o++){try{t=this.getValueFromArg(c[o])}catch(l){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return l}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.min(r,u)}else{try{if(!this._isCellReference(f[i])&&f[i][0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}t=f[i]==this._string_empty?"0":this.getValueFromArg(f[i]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;t==""&&this._isCellReference(f[i])&&(t="0")}catch(l){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return l}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.min(r,u)}return r!=this.maxValue?r.toString():this._string_empty};this.computeMina=function(n){var u=this.maxValue,i,t,o,s,h,c,f,r,l,e;if(this.adjustRangeArg(n),o=this.splitArgsPreservingQuotedCommas(n),s=n.split(";"),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(h)>-1))return h;if(s.length>1){for(r=0;r<s.length;r++)for(c=this.splitArgsPreservingQuotedCommas(s[r]),e=0;e<c.length;e++)if(f=this.getValueFromArg(c[e]),f.length>0){if(i=0,f.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(f)==-1)return f;f=f.split(this.tic).join("")=="TRUE"?"1":f.split(this.tic).join("")=="FALSE"?"0":f;i=this._parseDouble(f)}u=Math.min(u,i)}if(u!=this.maxValue)return u.toString()}for(r=0;r<o.length;r++)if(o[r].indexOf(":")>-1)for(l=this.getCellsFromArgs(o[r]),e=0;e<l.length;e++){try{t=this.getValueFromArg(l[e]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else if(t.toUpperCase()==this.falseValueStr)i=0;else{if(this.getErrorStrings().indexOf(t)!=-1)return t;i=this._parseDouble(t)}u=Math.min(u,i)}}else{try{o[r].startsWith(this.tic)||o[r]!=""?(t=this.getValueFromArg(o[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t==""&&(t="0")):t="0"}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}u=Math.min(u,i)}}return u!=this.maxValue?u.toString():this._string_empty};this.computePercentrankInc=function(n){var i=this.splitArgsPreservingQuotedCommas(n),l=i.length,f,u,o,e,r,s,h,t,c,a,v;if(l!=2&&l!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i[0]!=""&&i[1]==""||i[1]!=""&&i[0]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()){if(f=this.formulaErrorStringCheck(i[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)return f;for(t=1;t<l;t++)if(f=this.formulaErrorStringCheck(i[t],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)return f}if(o=3,e=this.getValueFromArg(i[1]),e==""&&(e="0"),u=this._parseDouble(e),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(u==0,l==3&&(i[2]=i[2].split(this.tic).join("")=="TRUE"?"1":i[2].split(this.tic).join("")=="FALSE"?"0":i[2],e=this.getValueFromArg(i[2]),o=this._parseDouble(e),isNaN(o)||o<1)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}for(r=this._getDoubleArray(i[0]),s=r.length,r.sort(),h=1,t=0;t<s;++t)if(r[t]==u){for(c=0;c+t<s&&r[c+t]==u;)c++;h=(t-1)/(t+s-t-c-1);t>0&&r[t-1]<u&&(a=t/(s-1),h=a+(h-a)*(1-(u-r[t-1])/(r[t]-r[t-1])));break}return v="0."+parseInt(o.toString()),h.toString()};this.computeRankOEq=function(n){var i=this.splitArgsPreservingQuotedCommas(n),s=i.length,f,e,r,t,h,c,v,o;if(s!=2&&s!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&((f=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)||(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)))return f;if(e=0,t=this.getValueFromArg(i[0]),i[0]==this._string_empty||i[1]==this._string_empty||!this._isCellReference(i[1]))return this.getErrorStrings()[4].toString();if(r=this._parseDouble(t),!isNaN(r)){if(h=0,s==3){if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c;t=this.getValueFromArg(i[2]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;t==this._string_empty?t="0":this._parseDouble(t)>1&&(t="1");h=this._parseDouble(t)}var l=i[1],u=0,a=!1;if(l.indexOf(":")==-1)return this.getErrorStrings()[4].toString();if(l.indexOf(":")>-1){for(v=this.getCellsFromArgs(l),o=0;o<v.length;o++){try{t=this._getDoubleArray(v[o])}catch(y){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return y}u=this._parseDouble(t.toString());isNaN(u)||(h==1?u<r?e+=1:u==r&&(a=!0):u>r?e+=1:u==r&&(a=!0))}a&&(e+=1)}}return e.toString()};this.computePercentile=function(n){var u=this.splitArgsPreservingQuotedCommas(n),c=u.length,f,t,h,r,e,o,s,i;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((f=this.formulaErrorStringCheck(u[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)||(f=this.formulaErrorStringCheck(u[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)))return f;if(h=this.getValueFromArg(u[1]),t=this._parseDouble(h),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];for(r=this._getDoubleArray(u[0]),e=r.length,r.sort(function(n,t){return isNaN(n)||isNaN(t)?n<t?1:-1:n-t}),o=1/(e-1),s=r[e-1],i=0;i<e-1;++i)if((i+1)*o>t){t=(t-i*o)/o;s=r[i]+t*(r[i+1]-r[i]);break}return s.toString()};this.computePoissonODist=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,o,u,s,i,e,f,h,t;if(c!=3)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,i=0,t=0;t<c;++t)r[t]=this.getValueFromArg(r[t]);if(o=this._parseDouble(r[0]),u=this._parseDouble(r[1]),!isNaN(o)&&!isNaN(u))if(s=r[2]==this.trueValueStr?1:0,e=o,s==0){for(f=1,t=2;t<=e;++t)f*=t;i=Math.exp(-u)*Math.pow(u,e)/f}else{for(f=1,i=0,h=1,t=0;t<=e;++t)i+=h/f,f*=t+1,h*=u;i=Math.exp(-u)*i}return i.toString()};this.computeWeiBullODist=function(n){var i=this.splitArgsPreservingQuotedCommas(n),o=i.length,s,u,t,r,f,h,e,c;if(o!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;for(f=0,h=!0,e=0;e<o;++e)i[e]=this.getValueFromArg(i[e]).split(this.tic).join(this._string_empty);if(u=this._parseDouble(i[0]),t=this._parseDouble(i[1]),r=this._parseDouble(i[2]),isNaN(u)||isNaN(t)||isNaN(r)){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is non-numerical";return this.getErrorStrings()[1].toString()}if(u<0||t<=0||r<=0){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is below 0";return this.getErrorStrings()[4].toString()}if(t.toString().length>=5&&r.toString().length>=3){if(this._rethrowLibraryComputationExceptions)throw"Passed argument length exceeded the minimum length";return this.getErrorStrings()[4].toString()}return o!=3&&(f=i[3]==this.trueValueStr?1:0,c=0,c=this._parseDouble(i[3]),isNaN(c)||(f=1)),h=f==1?!0:!1,f=h?1-Math.exp(-Math.pow(u/r,t)):Math.pow(u,t-1)*Math.exp(-Math.pow(u/r,t))*t/Math.pow(r,t),f.toString()};this.computeFOinvOrt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,u,f,e,i;if(s!=3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(e=0,i=0;i<s;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),u=this._parseDouble(t[1]),f=this._parseDouble(t[2]),!isNaN(r)&&r>0&&r<1&&!isNaN(u)&&!isNaN(f)){if((r<0||r>1||u<1||f<1)&&this.getRethrowLibraryComputationExceptions())throw"#NUM! Passed Argument value is less than or equal to minimum value";e=this._finv(r,u,f)}if(e<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[4].toString()}return e.toString()};this.computeTOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,e,r,i,f,u;if(o!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(i=0,f=0,u=0;u<o;++u)t[u]=this.getValueFromArg(t[u]).split(this.tic).join(this._string_empty);if(t[0]=t[0]==null||t[0]==""?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=t[1]==null||t[1]==""?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],r=this._parseDouble(t[0]),i=this._parseDouble(t[1]),isNaN(r)||isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw"#VALUE! Passed argument value is incorrect";return this.getErrorStrings()[1].toString()}if(i<1||r[0]=="-"){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value is incorrect";return this.getErrorStrings()[4].toString()}return t[2]==this.trueValueStr?f=this._tCumulativeDensity(r,i):t[2]==this.falseValueStr&&(f=this._tProbabilityDensity(r,i)),f.toString()};this.computeAvedev=function(n){var i=0,t,r,h,u=[],f,e,c,o,l,v,s;if(h=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(e=0;e<h.length;e++)if(f=h[e],f.indexOf(":")>-1)for(c=this.getCellsFromArgs(f),o=0;o<c.length;o++){try{t=this.getValueFromArg(c[o]).split(this.tic).join(this._string_empty);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0)if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>0)return t}else i=i+r,u.push(r)}else{try{if(t=this.getValueFromArg(f).split(this.tic).join(this._string_empty),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getEnableFormulaErrorValidation()&&(l=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1))return l}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0)if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)==-1)return t}else i=i+r,u.push(r)}if(u.length>0){for(v=i/u.length,i=0,s=0;s<u.length;++s)i=i+Math.abs(u[s]-v);i=i/u.length}return i.toString()};this.computeTOinv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,i,r,e,u;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(r=0,e=0,u=0;u<o;++u)t[u]=this.getValueFromArg(t[u]).split(this.tic).join(this._string_empty);if(t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],i=this._parseDouble(t[0]),r=this._parseDouble(t[1]),isNaN(i)||isNaN(r)){if(this._rethrowLibraryComputationExceptions)throw"#VALUE! Passed argument value is incorrect";return this.getErrorStrings()[1].toString()}if(r<1||i<0||i[0]=="-"){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value is incorrect";return this.getErrorStrings()[4].toString()}return e=this._tCumulativeDistributionInverse(i,r),e.toString()};this.computeChisqOinv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,u,e,i;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i<o;++i)t[i]=this.getValueFromArg(t[i]),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),u=this._parseDouble(t[1]),!isNaN(r)&&!isNaN(u)){if(r<0||r>=1||u<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return r==0?"0":(e=this._chiinv(r,u),e.toString())}};this.computeCount=function(n){var u=0,t,f,e=new Date,r,i,s,o;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(r=this.splitArgsPreservingQuotedCommas(n),i=0;i<r.length;i++)if(r[i].indexOf(":")>-1)for(s=this.getCellsFromArgs(r[i].split(this.tic).join("")),o=0;o<s.length;o++){try{t=this.getValueFromArg(s[o]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this._rethrowLibraryComputationExceptions)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(t.length>0){if(t==this.formulaErrorStrings[19]){if(this.geLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}f=this._parseDouble(t);e=new Date(Date.parse(t));isNaN(f)&&e.toString()=="Invalid Date"||this.getErrorStrings().indexOf(t)!=-1||u++}}else{try{r[i]!=this._string_empty||r[i][0]==this.tic||u++;t=this.getValueFromArg(r[i].split(this.tic).join(""));t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();throw this.getErrorStrings()[4].toString();}if(t.length>0){if(t[0]==this.formulaErrorStrings[19]){if(this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}f=this._parseDouble(t);e=new Date(Date.parse(t));isNaN(f)&&e.toString()=="Invalid Date"||this.getErrorStrings().indexOf(t)!=-1||u++}}return u.toString()};this.computeFOdistORt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,e,i,h;if(o!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;var f,r=0,u=0,s=0;for(i=0;i<o;++i)t[i]=this.getValueFromArg(t[i]).split(this.tic).join(""),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(f=this._parseDouble(t[0]),r=this._parseDouble(t[1]),u=this._parseDouble(t[2]),isNaN(f)||isNaN(r)||isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_Math_argument];return this._formulaErrorStrings[this._invalid_Math_argument]}if(f<0||r<1||u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this._errorStrings[4].toString()}return h=Math.exp(this._gammaln((r+u)/2)-this._gammaln(r/2)-this._gammaln(u/2)+r/2*Math.log(r/u)),s=1-h*this._fdist(f,parseInt(r.toString()),parseInt(u.toString())),s.toString()};this.computeGeomean=function(n){var i=1,t,u,e=0,f,r,s,o,h;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),r=0;r<f.length;r++)if(f[r].indexOf(":")>-1){if(r[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}for(s=this.getCellsFromArgs(f[r]),o=0;o<s.length;o++){try{t=this.getValueFromArg(s[o])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,i=i*u}}else{try{t=this.getValueFromArg(f[r])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0){if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,i=i*u}}return e>0&&(i=Math.pow(i,1/e)),i.toString()};this.computeHarmean=function(n){var r=0,t,i,e=0,f,u,s,o,h;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),u=0;u<f.length;u++)if(f[u].indexOf(":")>-1){if(u[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}for(s=this.getCellsFromArgs(f[u]),o=0;o<s.length;o++){try{t=this.getValueFromArg(s[o])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0)if(i=this._parseDouble(t),isNaN(i)||i==0){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,r=r+1/i}}else{try{t=this.getValueFromArg(f[u])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0){if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;if(i=this._parseDouble(t),isNaN(i)||i==0){if(this.getErrorStrings().indexOf(t))return t}else e++,r=r+1/i}}return e>0&&(r=e/r),r.toString()};this.computeIntercept=function(n){var f=this.splitArgsPreservingQuotedCommas(n),a=f.length,o,r,u,c,l,e,t;if(a!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1))return o;if(value1=this.getValueFromArg(f[0]),value2=this.getValueFromArg(f[1]),Boolean(value1)||Boolean(value2)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}var s=this._getDoubleArray(f[0]),h=this._getDoubleArray(f[1]),i=h.length;if(i<=0||i!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(r=0,u=0,t=0;t<i;++t)r+=h[t],u+=s[t];for(r=r/i,u=u/i,c=0,l=0,t=0;t<i;++t)e=h[t]-r,c+=e*(s[t]-u),l+=e*e;return(u-c/l*r).toString()};this.computeCountblank=function(n){var e=0,t,i,r,o,u,s,f,h;if(this.adjustRangeArg(n),i=this.splitArgsPreservingQuotedCommas(n),n==""||i.length>1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(o)>-1))return o;for(u=0;u<i.length;u++)if(r=i[u],r.indexOf(":")>-1)for(s=this.getCellsFromArgs(r),f=0;f<s.length;f++){try{t=this.getValueFromArg(s[f])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}t==this._string_empty&&e++}else{try{t=this.getValueFromArg(i)}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}if(!this._isCellReference(r)){if(h=this._parseDouble(t),!isNaN(h)||this.getErrorStrings.indexOf(t))if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments].toString();else return this.formulaErrorStrings[this._invalid_arguments].toString();if(t.split(this.tic).join(this._string_empty)==this._string_empty)if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments].toString();else return this.formulaErrorStrings[this._invalid_arguments].toString();else if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString()}t==this._string_empty&&e++}return e.toString()};this.computeDevsq=function(n){var f,s=this.splitArgsPreservingQuotedCommas(n),r=this._getDoubleArray(n),e=r.length,o,i,u,t;if(n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(o)>-1))return o;if(r.length<=0){if(this.getLibraryComputationException()!=null)throw this.formulaErrorStrings[this._bad_formula];throw this.getErrorStrings()[4].toString();}for(i=0,t=0;t<e;++t)i=i+r[t];for(i=i/e,u=0,t=0;t<e;++t)f=r[t]-i,u=u+f*f;return u.toString()};this.computeForecast=function(n){var f=this.splitArgsPreservingQuotedCommas(n),b=f.length,a,v,y,o,e,s,h,i,r,u,c,l,t,p,w;if(b!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(a=this.formulaErrorStringCheck(f[0],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(a)>-1))return a;for(t=1;t<=2;t++)if(this.getEnableFormulaErrorValidation()&&(v=this.formulaErrorStringCheck(f[t],FormulaArgumentType.Text),this.getErrorStrings().indexOf(v)>-1))return v;if(e=this.getValueFromArg(f[0]),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,y=this._parseDouble(e),isNaN(y)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(s=this._getDoubleArray(f[1]),h=this._getDoubleArray(f[2]),i=h.length,i<=0||i!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(r=0,u=0,t=0;t<i;++t)r=r+h[t],u=u+s[t];for(r=r/i,u=u/i,c=0,l=0,t=0;t<i;++t)o=h[t]-r,c=c+o*(s[t]-u),l=l+o*o;return p=c/l,w=u-p*r,(w+p*y).toString()};this.computeStdevOp=function(n){var t,i,r;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1))return t;if(i=this._getDoubleArrayA(n),r=i.length,r<2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}return this._stdevdotP(i).toString()};this.computeStdevOS=function(n){var t,i,r,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1))return t;if(i=this._getDoubleArrayA(n),r=i.length,r<2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}return u=0,this._sd(i,u).toString()};this.computeStdeva=function(n){var t,i,r,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1)?t:(i=this._getDoubleArrayA(n),r=i.length,r<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,this._sd(i,u).toString())};this.computeStdevpa=function(n){var i,r,t,u,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(i)>-1)?i:(r=this._getDoubleArrayA(n),t=r.length,t<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,f=this._sd(r,u),(f*Math.sqrt(t-1)/Math.sqrt(t)).toString())};this.computeVarp=function(n){var t=this._getDoubleArray(n),i=t.length;return((i-1)*this._var(t)/i).toString()};this.computeVara=function(n){var t=this._getDoubleArrayA(n);return this._var(t).toString()};this.computeVarpa=function(n){var t=this._getDoubleArrayA(n),i=t.length;return((i-1)*this._var(t)/i).toString()};this.computeCorrel=function(n){var f=this.splitArgsPreservingQuotedCommas(n),b=f.length,v,y,p,e,o,i,r,u,t,w;if(b!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(v=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(v)>-1))return v;if(y=this.getValueFromArg(f[0]),p=this.getValueFromArg(f[1]),y==null||y==""||p==null||p==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[1].toString()}if(e=this._getDoubleArray(f[0]),o=this._getDoubleArray(f[1]),i=o.length,i<=0||i!=e.length){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[0].toString()}for(r=0,u=0,t=0;t<i;++t)r=r+o[t],u=u+e[t];r=r/i;u=u/i;var s=0,h=0,c=0,l=0,a=0;for(t=0;t<i;++t)l=o[t]-r,a=e[t]-u,s=s+l*a,h=h+l*l,c=c+a*a;if(w=(s/Math.sqrt(h*c)).toString(),this.computeIsError(w)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this._errorStrings[3].toString()}return(s/Math.sqrt(h*c)).toString()};this.computeNegbinomODist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,r,u,f,e,i;if(o!=4)return this.formulaErrorStrings[this._wrong_number_arguments];for(e=0,i=0;i<o;++i)t[i]=this.getValueFromArg(t[i]);return u=this._parseDouble(t[0]),r=this._parseDouble(t[1]),f=this._parseDouble(t[2]),isNaN(u)||isNaN(r)||isNaN(f)||(e=this._negbinomdensity(parseInt(u.toString()),parseInt(r.toString()),f)),e.toString()};this.computePercentileExc=function(n){var r=this.splitArgsPreservingQuotedCommas(n),l=r.length,s,h,t,i,u,e,o,a,f,c;if(l!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(s)>-1)return s;if(h=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1)return h}if(i=this.getValueFromArg(r[1]),u=this.getValueFromArg(r[0]),i==null||i==""||u==""||u==null||Boolean(i=="TRUE"||i=="FALSE")||Boolean(u=="TRUE"||u=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=this._parseDouble(i),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(e=this._parseDouble(i),e==0||e<=0||e>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(o=this._getDoubleArray(r[0]),a=o.length,o.sort(function(n,t){return isNaN(n)||isNaN(t)?n<t?1:-1:n-t}),f=o.length,t<=this._parseDouble((1/(f+1)).toString())||t>=this._parseDouble((f/(f+1)).toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return c=t*(f+1),c.toString()};this.computePercentileOInc=function(n){var f=this.splitArgsPreservingQuotedCommas(n),a=f.length,e,t,r,o,s,u,h,c,l,i;if(a!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((e=this.formulaErrorStringCheck(f[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)||(e=this.formulaErrorStringCheck(f[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1)))return e;if(r=this.getValueFromArg(f[1]),o=this.getValueFromArg(f[0]),r==null||r==""||o==null||o==""||Boolean(r=="TRUE"||r=="FALSE")||Boolean(o=="TRUE"||o=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=this._parseDouble(r),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(s=this._parseDouble(r),s==0||s<=0||s>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}for(u=this._getDoubleArray(f[0]),h=u.length,u.sort(),c=1/(h-1),l=u[h-1],i=0;i<h-1;++i)if((i+1)*c>t){t=(t-i*c)/c;l=u[i]+t*(u[i+1]-u[i]);break}return l.toString()};this.computeTrimmean=function(n){var r=this.splitArgsPreservingQuotedCommas(n),l=r.length,o,s,t,i,c,e;if(l!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(o=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1)return o;if(s=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)return s}if(i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(i),isNaN(t)&&(t="1"),t>1||t==0||t<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}var h=this._getDoubleArray(r[0]),u=h.length,f=parseInt((t*u).toString());for(f=parseInt(f/2),h.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),c=0,u=u-f,e=f;e<u;++e)c+=h[e];return(c/(u-f)).toString()};this.computePearson=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,i,u;if(e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(t[0]==null||t[0]==""||t[1]==null||t[1]==""||Boolean(t[0]=="TRUE"||t[0]=="FALSE")||Boolean(t[1]=="TRUE"||t[1]=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}var r=this._getDoubleArray(t[0]),o=this._getDoubleArray(t[1]),f=r.length;if(f<=0||!isNaN(r)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}if(u=this._pearson(o,r,f).toString(),this.computeIsErr(u)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[3].toString()}return u};this.computeRsq=function(n){var u=this.splitArgsPreservingQuotedCommas(n),r,i,t;if(u.length!=2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(r)>-1))return r;if(i=this.computePearson(n).toString(),t=0,t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)!=-1)return i}else t=t*t;return t.toString()};this.computeHLookUp=function(n){var v=this._isHLookupCachingEnabled(),w=this._isOptimizedMatchesEnabled(),r,s,u,rt,h,b,t,c,k,p,o;if(v&&this._lookupTables==null&&(this.lookupTables=new HashTable),r=this.splitArgsPreservingQuotedCommas(n),r.length>4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if((s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1)||(s=this.formulaErrorStringCheck(r[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(s)>-1))return s;for(t=2;t<r.length;t++)if(s=this.formulaErrorStringCheck(r[t],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)return s}u=this.getValueFromArg(r[0]);u=u.split(this.tic).join("").toUpperCase();var f=r[1].split('"').join(""),ut=this.getValueFromArg(r[2]).split(this.tic).join(""),l=this._parseDouble(ut);if(isNaN(l))return"#N/A";rt=parseInt(ut);h=!0;r.length==4&&(h=this.getValueFromArg(r[3])==this.trueValueStr);l=this._parseDouble(u);b=h?!isNaN(l):!1;t=f.indexOf(":");t==-1&&(f=f+":"+f,t=f.indexOf(":"));var ft=f.substring(0,t).lastIndexOf(this.sheetToken),et=this.grid,ct=CalcEngine.getSheetFamilyItem(this.grid);if(ft>-1&&(this.grid=ct.tokenToParentObject.getItem(f.substring(0,ft+1))),c=this.rowIndex(f.substring(0,t)),k=this.rowIndex(f.substring(t+1)),!(c!=-1||k==-1)==(c==-1||k!=-1))return this.getErrorStrings()[5].toString();var y=this.colIndex(f.substring(0,t)),ot=this.colIndex(f.substring(t+1)),d=!1,a="",g=null,nt=null;v&&(a=c.toString()+"_"+y.toString()+"_"+ot.toString()+"_"+this.grid.GetHashCode(),this._lookupTables.containsKey(a)||(w?(p=new LookUps,p.setMatchLookUpList(new HashTable),this._lookupTables.add(a,p)):(p=new LookUps,this._lookupTables.add(a,p)),d=!0),g=this._lookupTables.getItem(a).getLinearLookUpList(),w&&(nt=this._lookupTables.getItem(a).getMatchLookUpList()));var i="",tt=y,e="",it=0,st=!0,ht=!1;if(v&&w&&nt.containsKey(u))tt=nt.getItem(u),e=u;else for(o=y;o<=ot;++o){if(!v||o-y>=g.length||d?(e=this.getValueFromParentObject(this.grid,c,o).toString().toUpperCase().split('"').join(""),v&&(g.push(e),w&&nt.add(e,o))):e=g[o-y],it=b?this._parseDouble(e):it,e==u||h&&(b?!isNaN(it)&&it>l:e>u))if(e==u&&(tt=o,h=!0,ht=!0),d)st=!1;else break;st&&(tt=o);h=d=!0}if(h||e==u){if(!ht&&!b)return this.grid=et,"#N/A";if(rt+c-1>k)return"#REF!";i=this.getValueFromParentObject(this.grid,rt+c-1,tt).toString();i.length>0&&i[0]==this.getFormulaCharacter()&&(i=this.parseFormula(i));l=this._parseDouble(i);i.length>0&&i[0]!=this.tic[0]&&isNaN(l)&&(i=i)}else i="#N/A";return this.grid=et,i};this.computeIndex=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,f,i,r,p,l,w,e,o,s,a,v,b,k,d,y;if(h<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((f=this.formulaErrorStringCheck(t[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)||(f=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)||h==3&&(f=this.formulaErrorStringCheck(t[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)))return f;if(i=t[0],i=i.split(this.tic).join(""),r=i.indexOf(":"),r==-1)if(this._isCellReference(i))i=i+":"+i;else{if(i.indexOf(";")>-1){var u=parseInt(this.getValueFromArg(t[1])),g=this._splitArguments(i,";"),c=h==3?parseInt(this.getValueFromArg(t[2])):1;try{return u=u==0?1:u,c=c==0?1:c,p=this.splitArgsPreservingQuotedCommas(g[u-1]),p[c-1]}catch(nt){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[2].toString()}}if(l=this.splitArgsPreservingQuotedCommas(i),!isNaN(u)&&u>0){if(l.length>=u)return parseInt(u.toString())==0?l[0]:l[parseInt(u.toString())-1];if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return"#REF"}if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return(r=i.indexOf(":"),n.indexOf("#N/A")>-1||n.indexOf("#N~A")>-1)?"#N/A":n.indexOf("#DIV/0!")>-1||n.indexOf("#DIV~0!")>-1?"#DIV/0!":(w=this._getSheetTokenFromReference(i),t[1]=h==1||t[1]==""?"1":t[1],t[2]=h<=2||t[2]==""?"1":t[2],t[1]=this.getValueFromArg(t[1]),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],e=parseInt(t[1]),o=isNaN(e)?-1:e,t[2]=this.getValueFromArg(t[2]),t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2],e=parseInt(t[2]),s=isNaN(e)?-1:e,o==-1||s==-1)?"#REF":(a=this.rowIndex(i.substring(0,r)),v=this.rowIndex(i.substring(r+1)),!(a!=-1||v==-1)==(a==-1||v!=-1))?this.getErrorStrings()[5].toString():(b=this.colIndex(i.substring(0,r)),k=this.colIndex(i.substring(r+1)),o>v-a+1||s>k-b+1)?"#REF":(o=this.rowIndex(i.substring(0,r))+o-1,s=this.colIndex(i.substring(0,r))+s-1,d=w+RangeInfo.getAlphaLabel(s)+o,y=this.getValueFromArg(d),this._isTextEmpty(y))?"0":y};this.computeIndirect=function(n){var i=this.splitArgsPreservingQuotedCommas(n),h=i.length,o,r,s,t,f;if(h>2||h==0||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((o=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1)||h==2&&(o=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1)))return o;if(i[0]=i[0].toUpperCase(),i[0]=this.setTokensForSheets(i[0]),r=this._sheetToken(i[0].split(this.tic).join("")),r!=""&&(i[0]=i[0].split(r).join("")),i.length==2&&i[1]==this.falseValueStr){var l=i[0][0]==this.tic&&i[0][n[0].length-1]==this.tic,a=i[0].toUpperCase().split(this.tic).join(""),e=a.split(":"),u=e[0].split("R").join("C").split("C"),c=u.indexOf("");if(c>-1&&u.splice(c,1),u.length>2)return this.getErrorStrings()[2].toString();i[0]=RangeInfo.getAlphaLabel(parseInt(u[1]))+u[0];e.length==2&&(s=this._sheetToken(e[1]),(s!=null||s!="")&&(e[1]=e[1].split(s).join("")),u=e[0].split("R").join("C").split("C"),i[0]+=":"+RangeInfo.getAlphaLabel(parseInt(u[1]))+u[0]);l&&(i[0]=this.tic+i[0]+this.tic)}if(t="",i[0][0]==this.tic)t=r+i[0].split(this.tic).join("");else if(this._isCellReference(i[0])){if(f="",t=this.getValueFromArg(r+i[0]),t==null||t=="")return"0";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,i[0].split(this._string_fixedreference).join("");if(f=this._checkIfScopedRange(t.toUpperCase()),this.getNamedRanges().containsKey(t.toUpperCase()))t=this.getNamedRanges().getItem(t.toUpperCase()),t=t.toUpperCase(),t=t.split(this._string_fixedreference).join(""),t=this.setTokensForSheets(t),t[0]!=this.sheetToken&&(t=r+t);else if(f!="NaN")t=f,t=t.toUpperCase(),t=t.split(this._string_fixedreference).join(""),t=this.setTokensForSheets(t),t[0]!=this.sheetToken&&(t=r+t);else return this._isCellReference(t)?this.getValueFromArg(t):t.indexOf(!1)?this.getErrorStrings()[2].toString():t}else t=i[0];if(!this._isCellReference(t.split(this._string_fixedreference).join("")))if(f="",f=this._checkIfScopedRange(t.toUpperCase()),this.getNamedRanges().containsKey(t.toUpperCase()))t=this.getNamedRanges().getItem(t.toUpperCase()),t[0]!=this.sheetToken&&(t=r+t);else if(f!="NaN")t=f,t[0]!=this.sheetToken&&(t=r+t);else return this.getErrorStrings()[2].toString();return t.indexOf(":")>-1&&this._isInteriorFunction||this.computedValueLevel>1?(this._isInteriorFunction=!this._isInteriorFunction,t.split(this._string_fixedreference).join("")):this.getValueFromArg(t)};this.computeLookUp=function(n){var et=this._isHLookupCachingEnabled(),at=this._isOptimizedMatchesEnabled(),t,y,g,f,nt,it,ot,st,l,rt,p,a,u,o,w,r,k,tt,c,v,d,e;if(et&&this._lookupTables==null&&(this.lookupTables=new HashTable),t=this.splitArgsPreservingQuotedCommas(n),t.length>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(y=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(y)>-1)return y;for(g=1;g<t.length;g++)if(y=this.formulaErrorStringCheck(t[g],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(y)>-1)return y}f=this.getValueFromArg(t[0]);f=f.split(this.tic).join("").toUpperCase();nt="";it=t[1].split('"').join("");t[2]=(t.length=3)?t[2].split(this.tic).join(""):t[2];var vt=this.getValueFromArg(t[0]),i=[],s=[],yt=this.getValueFromArg(t[2]).split(this.tic).join("");if(t.length==2)if(ot=t[1],st=this.splitArgsPreservingQuotedCommas(t[1]),t[1].indexOf(";")>-1)if(l=this._splitArguments(t[1],";"),l.length==1)for(a=this.splitArgsPreservingQuotedCommas(l[0].toUpperCase()),u=0;u<a.length;u++)i.push(this.getValueFromArg(a[u]).toUpperCase()),s.push(this.getValueFromArg(a[u]).toUpperCase());else if(l.length==2){for(p=this.splitArgsPreservingQuotedCommas(l[0].toUpperCase()),rt=this.splitArgsPreservingQuotedCommas(l[1].toUpperCase()),u=0;u<p.length;u++)i.push(this.getValueFromArg(p[u]).toUpperCase());for(u=0;u<rt.length;u++)s.push(this.getValueFromArg(rt[u]).toUpperCase())}else for(e=0;e<l.length;e++)p=this.splitArgsPreservingQuotedCommas(l[e].toUpperCase()),i.push(this.getValueFromArg(p[0]).toUpperCase()),s.push(this.getValueFromArg(p[1]).toUpperCase());else if(t[1].indexOf(":")>-1)for(o=this.getCellsFromArgs(t[1]),r=0;r<o.length;r++)i.push(this.getValueFromArg(o[r]).toUpperCase()),s.push(this.getValueFromArg(o[r]).toUpperCase());else for(a=this.splitArgsPreservingQuotedCommas(t[1].toUpperCase()),u=0;u<a.length;u++)i.push(this.getValueFromArg(a[u]).toUpperCase()),s.push(this.getValueFromArg(a[u]).toUpperCase());else if(t.length==3){if(it.indexOf(":")>-1)for(o=this.getCellsFromArgs(it),r=0;r<o.length;r++)try{i.push(this.getValueFromArg(o[r]).toUpperCase())}catch(pt){return this.getErrorStrings()[0].toString()}else for(w=this.splitArgsPreservingQuotedCommas(t[1]),r=0;r<w.length;r++)try{i.push(this.getValueFromArg(w[r]).toUpperCase())}catch(pt){return this.getErrorStrings()[0].toString()}var b=t[2],h=t[2].split(":"),ut=this.getRowIndexFromName(h[0]),ft=this.getRowIndexFromName(h[h.length-1]);if(ut!=ft)h[h.length-1]=h[h.length-1].replace(ft,+ut+i.length-1),b=h.join(":");else{var ht=this.computeColumn(b),ct=+ht+i.length-1,lt=this.computeAddress(ut+","+ct+",4");b=h[0]+":"+lt}if(!this._isCellReference(b))return this.getErrorStrings()[0].toString();if(b.indexOf(":")>-1)for(o=this.getCellsFromArgs(b),r=0;r<o.length;r++)try{s.push(this.getValueFromArg(o[r]).toUpperCase())}catch(pt){return this.getErrorStrings()[0].toString()}else for(w=this.splitArgsPreservingQuotedCommas(t[1]),r=0;r<w.length;r++)try{s.push(this.getValueFromArg(w[r]).toUpperCase())}catch(pt){return this.getErrorStrings()[0].toString()}}if(i.indexOf(f)==-1){for(k=i[0],tt=0,c=0;c<i.length;c++)if(i[c]>k&&f>i[c]&&k>f||f>i[c])k=f>i[c]?i[c]:i[c+1],tt++;else if(tt!=0)break;if(tt==0)return this.getErrorStrings()[0].toString();f=k}if(v=0,d=0,t.length==3&&t[2].indexOf(":")>-1){for(e=0;e<i.length;e++)if(i[e]==f)d=i.indexOf(f),v++;else if(v!=0)break;nt=s[d+v-1]}else{for(e=0;e<i.length;e++)if(i[e]==f)d=i.indexOf(f),v++;else if(v!=0)break;nt=s[d+v-1]}return nt};this.computeOffSet=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,e,s,v,w,h,b,a,k,y;if(f<3||f>5||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(e=this.formulaErrorStringCheck(u[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)return e;for(s=1;s<f;s++)if(s<=f&&(e=this.formulaErrorStringCheck(u[s],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e}var t=u[0],i=this._parseDouble(this.getValueFromArg(u[1])),p=isNaN(i)?-1:parseInt(i.toString());i=this._parseDouble(this.getValueFromArg(u[2]));v=isNaN(i)?-1:parseInt(i.toString());w=f>=4?u[3]:"-1";i=parseInt(this.getValueFromArg(w));h=isNaN(i)?1:i;b=f==5?u[4]:"-1";i=parseInt(this.getValueFromArg(b));var c=isNaN(i)?1:i,r=t.indexOf(":"),o=r==-1;o&&(t=t+":"+t,r=t.indexOf(":"));o=o&&c<=1&&h<=1;c==-1&&(o=!0);var d=this._getSheetTokenFromReference(t),l=this.rowIndex(t.substring(0,r))+p,g=this.rowIndex(t.substring(r+1))+p;return!(this.rowIndex(t.substring(0,r))!=-1||this.rowIndex(t.substring(r+1))!=-1)==(this.rowIndex(t.substring(0,r))==-1||this.rowIndex(t.substring(r+1))!=-1)?this.getErrorStrings()[5].toString():(a=this.colIndex(t.substring(0,r))+v,k=this.colIndex(t.substring(r+1))+v,l<=0||a<=0)?this.getErrorStrings()[2].toString():((h>0&&c<0||h<1&&c>1)&&(l=this.rowIndex(this.cell)),k==parseInt(this.computeColumn(t))-1&&(o=!0),y=d+RangeInfo.getAlphaLabel(a)+l,o?this.computedValue(y):y+":"+RangeInfo.getAlphaLabel(a+c-1)+(l+h-1))};this.computeTranspose=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e,c,o,l,s,a,i,t,u,r;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(!this._isCellReference(n)&&!this.getNamedRanges().containsKey(n)&&n.indexOf(";")==-1){if(t=this._splitArguments(n.split(this.tic).join(""),";"),t.length==1)return this.getValueFromArg(this.splitArgsPreservingQuotedCommas(t[0])[0]);if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(f=this.splitArgsPreservingQuotedCommas(n),c=f.length,c!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i="",n.indexOf(";")>-1){for(t=this._splitArguments(n.split(this.tic).join(""),";"),u=1;u<t.length;u++)if(this.splitArgsPreservingQuotedCommas(t[u-1]).length!=this.splitArgsPreservingQuotedCommas(t[1]).length){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}i=this.splitArgsPreservingQuotedCommas(t[0])[0]}else{r=this.getCellsFromArgs(n);o=this.rowIndex(r[0].toString());l=this.rowIndex(r[r.length-1].toString());s=this.colIndex(r[0].toString());a=this.colIndex(r[r.length-1].toString());var v=this.cell,b=this.colIndex(v),k=this.rowIndex(v),d=l-o+1,g=a-s+1,y,p,nt,tt;this._getFormulaArrayBounds(this.cell,d,g);y=this._getFormulaArrayBoundsfirstRowIndex;p=this._getFormulaArrayBoundsfirstColIndex;nt=this._getFormulaArrayBoundslastRowIndex;tt=this._getFormulaArrayBoundslastColIndex;var it=k-y,rt=b-p,h=n.indexOf(":");h==-1&&(n=n+":"+n,h=n.indexOf(":"));var w=n.substring(0,h).lastIndexOf(this.sheetToken),ut=this.grid,ft=CalcEngine.getSheetFamilyItem(this.grid);w>-1&&(this.grid=ft.tokenToParentObject[n.substring(0,w+1)]);i=this._getValueComputeFormulaIfNecessary(o+rt,s+it,this.grid);this.grid=ut}return(i==null||i=="")&&(i="0"),i};this.computeEncodeURL=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i,r;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(!this._isCellReference(t[0])&&!this.getNamedRanges().containsKey(t[0])&&t[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(t[0]))&&!Boolean(t[0]=="TRUE"||t[0]=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5]}return r=this._stripTics0(this.getValueFromArg(t[0])),encodeURIComponent(r)};this.computeAnd=function(n){var f=!0,t,e,r,i,u,o,s;if(n==null||n=="")if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];else return this.formulaErrorStrings[this._bad_formula];for(r=this.splitArgsPreservingQuotedCommas(n),i=0;i<r.length;i++){if(r[i]==this.tic)if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();if(r[i].indexOf(":")>-1)for(cells=this.getCellsFromArgs(r[i]),u=0;u<cells.length;u++){if(this.getErrorStrings().indexOf(cells[u])>-1)return cells[u];if(cells[u][0]==this.tic)if(this.getRethrowLibraryComputationExceptions)throw(new this.getErrorStrings)[5].toString();else return this.getErrorStrings()[5].toString();try{if(t=this.getValueFromArg(cells[u]),this.getErrorStrings().indexOf(t)>-1)return t}catch(h){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=f&(t==""?!0:t.split(this.tic).join("").toUpperCase()==this.trueValueStr||(e=this._parseDouble(t))&&e!=0)}else{try{if(t=this.getValueFromArg(r[i]),this.getErrorStrings().indexOf(t)>-1)return t;if(o=Date.parse(t.split(this.tic).join("")),e=this._parseDouble(t.split(this.tic).join("")),isNaN(o)){if(isNaN(e)&&!(t==this._string_empty)&&!(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||t.split(this.tic).join("").toUpperCase()==this.falseValueStr))if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();else return this._isCellReference(r[i])||t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}else return this.trueValueStr}catch(c){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}s=this._parseDouble(t);f=f&(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||!isNaN(s)&&e!=0)}}return f?this.trueValueStr:this.falseValueStr};this.computeFalse=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>0&&t!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.falseValueStr};this.computeIf=function(n){var t=this._string_empty,e=this.splitArgsPreservingQuotedCommas(n),i,u,f,r;if(e.length==1||e.length>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getCellsFromArgs(n),i.length>=2)try{if(t=this.getValueFromArg(i[0]),this.getErrorStrings().indexOf(t)!=-1)return t;if(!this._isCellReference(i[0])&&!isNaN(typeof t=="boolean")&&t.startsWith(this.tic)||this._isCellReference(i[0])&&t.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t.split(this.tic).join("")==this.trueValueStr||(u=this._parseDouble(t))&&u!=0){if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(f)>-1))return f;if(t=this.getValueFromArg(i[1]),t==""&&this.getTreatStringsAsZero())return"0"}else if(t.split(this.tic).join("")==this.falseValueStr||t==""||(u=this._parseDouble(t))&&u==0){if(t=i.length==3?this.getValueFromArg(i[2]):!1,t==""&&this.getTreatStringsAsZero())return"0";if(this.getErrorStrings().indexOf(t)!=-1)return t}else{if(i.indexOf(this.tic)>-1){var o=i[0].indexOf(this.tic)+1,s=i[0].lastIndexOf(this.tic)-1,h=i[0].substring(o,s-o+1);for(r=0;r<this.getFormulaErrorStrings().length;r++)if(h===r)return r}t="NaN"}}catch(c){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return c}else return this.getFormulaErrorStrings();return t};this.computeIfError=function(n){var i=n.split(this.getParseArgumentSeparator()),t=i[0],r;if(i.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t[0]==this.tic)return this.getValueFromArg(i[0]);try{if(t[0]==this.bMARKER&&(t=t.replace(this.bMARKER," "),t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),t[0]=="NAN"||t[0]=="-NAN"||t[0]=="INFINITY"||t[0]=="-INFINITY"||t[0]=="#"||t[0]=="n#"))return this.getValueFromArg(i[1]);t=i[0];t=this.getValueFromArg(t).toUpperCase().split(this.tic).join(this._string_empty)}catch(u){t=t.toUpperCase()}return t[0]=="NAN"||t[0]=="-NAN"||t[0]=="INFINITY"||t[0]=="-INFINITY"||t[0]=="#"||t[0]=="n#"?this.getValueFromArg(i[1]):this.getValueFromArg(i[0])};this.computeIfNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i=this._string_empty,r;if(u!=2)return this.getFormulaErrorStrings();if(this.computeIsNA(t[0])==this.trueValueStr){if(this.tic.indexOf(t[1])==-1&&!this._isCellReference(t[1])&&!(r=this._parseDouble(t[0]))&&!this.namedRanges.containsKey(t[1]))return this.getErrorStrings()[5].toString();i=this.getValueFromArg(t[1])}else if(this._isRange(t[0]))i=this.getErrorStrings()[1].toString();else{if(this.tic.indexOf(t[0])==-1&&!this._isCellReference(t[0])&&!(r=this._parseDouble(t[0]))&&!this.NamedRanges.ContainsKey(t[0]))return this.getErrorStrings()[5].toString();i=this.getValueFromArg(t[0])}return i[0]==this.tic&&i[length-1]==this.tic&&(i=this.substring(i,1,i.length-2)),i};this.computeNot=function(n){var t=n,i,r=[this.getParseArgumentSeparator(),":"];if(n.length>0&&this._indexOfAny(n,r)>-1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{if(t=this.getValueFromArg(t),this.getErrorStrings().indexOf(t)!=-1)return t;if(t==this.trueValueStr)t=this.falseValueStr;else if(t==this.falseValueStr)t=this.trueValueStr;else{if(isNaN(i=this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}t=Math.abs(i)>1e-10?this.falseValueStr:this.trueValueStr}}catch(u){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return u}return t};this.computeOr=function(n){var e=this.falseValueStr,t,r,u=this.splitArgsPreservingQuotedCommas(n),i,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(i=0;i<u.length;i++)if(u[i].indexOf(":")>-1&&this._isCellReference(i))for(cells=this.getCellsFromArgs(u[i]),f=0;f<cells.length;f++){try{if(t=this.getValueFromArg(cells[f]),this.getErrorStrings().indexOf(t)!=-1)return t}catch(o){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return o}e|=t==this.trueValueStr||r==this._parseDouble(t)&&r!=0}else{try{if(t=this.getValueFromArg(u[i]),this.getErrorStrings().indexOf(t)!=-1)return t;if(r=this._parseDouble(t.split(this.tic).join("")),isNaN(r)&&!(t==this._string_empty)&&!(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||t.split(this.tic).join("").toUpperCase()==this.falseValueStr))if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();else return this._isCellReference(u[i])||t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}catch(o){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return o}e|=t==this.trueValueStr||r==this._parseDouble(t)&&r!=0}return e?this.trueValueStr:this.falseValueStr};this.computeTrue=function(){return this.trueValueStr};this.computeXor=function(n){var e=!1,t,r,u=this.splitArgsPreservingQuotedCommas(n),i,o,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(i=0;i<u.length;i++)if(u[i].indexOf(":")>-1&&this._isCellReference(i))for(o=this.getCellsFromArgs(u[i]),f=0;f<o.length;f++){try{if(t=this.getValueFromArg(o[f]),this.getErrorStrings().indexOf(t)!=-1)return t}catch(s){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return s}r=this._parseDouble(t);e^=t==this.trueValueStr^(!isNaN(r)&&r!=0)}else{try{if(t=this.getValueFromArg(u[i]),this.getErrorStrings().indexOf(t)!=-1)return t;if(d=this._parseDouble(t.split(this.tic).join("")),isNaN(d)&&!(t==this._string_empty)&&!(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||t.split(this.tic).join("").toUpperCase()==this.falseValueStr))if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();else return this._isCellReference(u[i])||t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}catch(s){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return s}r=this._parseDouble(t);e^=t==this.trueValueStr^(!isNaN(r)&&r!=0)}return e?this.trueValueStr:this.falseValueStr};this.computeCell=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u,i,f,t;if(r.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)||r.length==2&&(u=this.formulaErrorStringCheck(r[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(u)>-1)))return u;if(i="",r.length==2){if(!this._isCellReference(r[1])&&!this.namedRanges.containsKey(r[1])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}i=r[1]}else i=this.cell;f=r[0].split(this.tic).join(this._string_empty).toLowerCase();t="";switch(f){case"address":t=this.rowIndex(i).toString()+this.getParseArgumentSeparator()+this.colIndex(i).toString();t=this.computeAddress(t);break;case"col":t=this.computeColumn(i);break;case"contents":t=this.getValueFromArg(i);break;case"filename":t="Not Supported";break;case"row":t=this.computeRow(i);break;case"type":t=this.computeIsBlank(i)==this.trueValueStr?"b":this.computeIsText(i)==this.trueValueStr?"l":"v"}if(t==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return t.toString()};this.computeErrorType=function(n){var t=this._string_empty,r=this._splitArguments(n,this.getParseArgumentSeparator()),u=r.length,i;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1)?i:(t=this._isCellReference(n)?this.getValueFromArg(n):n,t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0])?"#N/A":t=="#NULL!"?"1":t=="#DIV/0!"?"2":t=="#VALUE!"?"3":t=="#REF!"?"4":t=="#NAME?"?"5":t=="#NUM!"?"6":t=="#N/A"?"7":t=="#GETTING_DATA"?"8":"#N/A"};this.computeInfo=function(n){var r=this.splitArgsPreservingQuotedCommas(n),e=r.length,i,u,t,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;u=this._stripTics0(this.getValueFromArg(r[0])).toLowerCase();t=this._string_empty;switch(u){case"directory":t=window.location.toString();break;case"numfile":t=this.getSortedSheetNames()!=null&&CalcEngine._sheetFamiliesList.length==0?this.getSortedSheetNames().length.toString():"1";break;case"origin":f=this.rowIndex(this.cell).toString()+this.getParseArgumentSeparator()+this.colIndex(this.cell).toString();t="$A: "+this.computeAddress(f);break;case"osversion":t=navigator.platform.toString();break;case"recalc":t=this._alwaysComputeDuringRefresh?"Automatic":"Manual";break;case"release":t=this.System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.toString();break;case"system":switch(navigator.appVersion.indexOf()){case navigator.platform:t="unix";break;case navigator.platform:t="mac";break;default:t="pcdos"}break;default:if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return t};this.computeIsBlank=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getValueFromArg(n)==""?this.trueValueStr:this.falseValueStr};this.computeIsErr=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return n=this.getValueFromArg(n).toUpperCase().split(this.tic).join(this._string_empty),n.count>1,(n.startsWith("NAN")||n.startsWith("-NAN")||n.startsWith("INFINITY")||n.startsWith("-INFINITY")||n.startsWith("#")||n.startsWith("n#"))&&!n.startsWith("#N/A")?this.trueValueStr:this.falseValueStr};this.computeIsError=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{n=this.getValueFromArg(n).toUpperCase().split(this.tic).join(this._string_empty)}catch(r){return this.trueValueStr}return n.indexOf("NAN")==0||n.indexOf("-NAN")==0||n.indexOf("INFINITY")==0||n.indexOf("-INFINITY")==1||n.indexOf("#")==0||n.indexOf("n#")==0?this.trueValueStr:this.falseValueStr};this.computeIsEven=function(n){var s=this._string_empty,f=this.splitArgsPreservingQuotedCommas(n),o=f.length,i,t,r,u,e;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(f[0]),t=parseInt(i.split(this.tic).join("")),this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(u=new Date(Date.parse(i)),isNaN(t)&&u.toString()!="invalid Date"&&(t=this._toOADate(u)),e=t,isNaN(t)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return e%2==0?this.trueValueStr:this.falseValueStr};this.computeIsFormula=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,u=this._string_empty,i,r;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(u=this.getValueFromArg(t[0]),this.namedRanges.containsValue(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return r=CalcEngine.getSheetFamilyItem(this.grid),this.isSheetMember()&&r.parentObjectToToken!=null&&(t[0]=r.parentObjectToToken.getItem(this.grid)+t[0]),this.getFormulaInfoTable().containsKey(t[0])?this.trueValueStr:this.falseValueStr};this.computeIsLogical=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return(n=this.getValueFromArg(n),n==this.falseValueStr||n==this.trueValueStr)?this.trueValueStr:this.falseValueStr};this.computeIsNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n=this.getValueFromArg(n),this.getErrorStrings().indexOf(n.toUpperCase())!=-1)return n.toUpperCase()=="#N/A"?this.trueValueStr:this.falseValueStr;try{n=this.getValueFromArg(n).toUpperCase()}catch(i){return this.falseValueStr}return n[0]=="#N/A"?this.trueValueStr:this.falseValueStr};this.computeIsNonText=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.computeIsText(n)==this.trueValueStr?this.falseValueStr:this.trueValueStr};this.computeIsNumber=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return n=this.getValueFromArg(n),isNaN(this._parseDouble(n))?this.falseValueStr:this.trueValueStr};this.computeIsRef=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t.length!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return((this.namedRanges.containsKey(n)||this._isCellReference(n))&&n[0]!=this.tic&&n[length-1]!=this.tic).toString().toUpperCase()};this.computeIsOdd=function(n){var r=this._string_empty,t=0,u=this._splitArguments(n,this.getParseArgumentSeparator()),f=u.length,e=[this.getParseArgumentSeparator(),":"],i;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n!=this._string_empty){if(this._indexOfAny(n,e)!=-1)return"#VALUE!";if(r=this.getValueFromArg(u[0]),t=parseInt(r.split(this.tic).join(this._string_empty)),isNaN(t)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return t%2!=0?this.trueValueStr:this.falseValueStr}return this.trueValueStr};this.computeIsText=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t;if(r>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return i=this._isCellReference(n),t=i?this.getValueFromArg(n):n,(i||t[0]==this.tic)&&t.length>0&&isNaN(this._parseDouble(t))?this.trueValueStr:this.falseValueStr};this.computeN=function(n){var t=this._string_empty,i=0,u,f=this._splitArguments(n,this.getParseArgumentSeparator()),e=f.length,r;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(n),u=new Date(Date.parse(t)),this._parseDouble(t))return i=this._parseDouble(t),i.toString();if(new Date(Date.parse(t))&&(i=this._getSerialDateTimeFromDate(u)),t==this.trueValueStr)i=1;else if(t==this.falseValueStr)i=0;else return this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1?t:isNaN(i)?"0":i.toString();return i.toString()};this.computeNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>0&&t!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return"#N/A"};this.computeSheet=function(n){var o=this.splitArgsPreservingQuotedCommas(n),h=o.length,c=this._string_empty,e,t,i,s;if(h>1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(t=o[0].toUpperCase(),t=t==null||t==this._string_empty?this.cell:t,t==null||t==this._string_empty)return"1";if(this.getErrorStrings().indexOf(t)>-1)return t;if(!this._isCellReference(t)&&!this.namedRanges.containsKey(t)&&this.getSortedSheetNames().indexOf(t)==-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}var r=CalcEngine.getSheetFamilyItem(this.grid),u=this._getSheetTokenFromReference(t),f=0;if(u!=null&&u!=this._string_empty||this.getSortedSheetNames().indexOf(t)!=-1||t.indexOf(this.sheetToken.toString()))if(u.length>0)f=parseInt(u.split(this.sheetToken).join(this._string_empty))+1;else try{for(i=0;i<r.tokenToParentObject.length;i++)if(r.sheetNameToParentObject.getItem(t.split(this.tic).join(this._string_empty))==r.tokenToParentObject.values()[i]){s=r.tokenToParentObject.values()[i];f=this.getSheetID(s)+1;break}}catch(l){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[2].toString()}else f=this.getSheetID(this.grid)+1;return f.toString()};this.computeSheets=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,o=this._string_empty,i,t,r,f;if(e>1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=0,t=u[0].toUpperCase(),this.getErrorStrings().indexOf(t)>-1)return t;if(t==null||t==this._string_empty)return this.getSortedSheetNames().length.toString();if(this.getEnableFormulaErrorValidation()){if(r=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(r)>-1)return r}else{if(t.split(this.tic).join(this._string_empty)==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(!this._isCellReference(t)&&!this.namedRanges.containsKey(t)&&this.getSortedSheetNames().indexOf(t)==-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}}try{f=this._splitArguments(t,"!");i=(f.length-1)/2}catch(s){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[2].toString();return this.getErrorStrings()[2].toString()}return i.toString()};this.computeType=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,i=0,t;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(r[0]),t==null||t==this._string_empty){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return n.indexOf(this.getParseArgumentSeparator())>-1?i=64:this.computeIsNumber(t)==this.trueValueStr?i=1:this.computeIsLogical(t)==this.trueValueStr?i=4:this.getErrorStrings().indexOf(t)>-1?i=16:this.computeIsText(t)==this.trueValueStr&&(i=2),i.toString()};this.computeRow=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r=t.length,i;if(r!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(t[0]==this._string_empty)return this.rowIndex(this.cell).toString();if(!this._isCellReference(t[0])&&!this.namedRanges.containsKey(t[0])){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return n.indexOf(":")>-1&&(n=this.getCellsFromArgs(n)[0]),this.rowIndex(n).toString()};this.computeRows=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e,o,s,t,r,i,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1))return e;if(t=1,f[0].indexOf(":")>-1)r=this.getCellsFromArgs(n),o=this.rowIndex(r[0].toString()),s=this.rowIndex(r[r.length-1].toString()),t=s-o+1,t=t>0?t:1;else if(f[0].indexOf(";")>-1)for(i=this._splitArguments(n.split(this.tic).join(this._string_empty),";"),u=1;u<i.length;u++){if(this.splitArgsPreservingQuotedCommas(i[u-1]).length!=this.splitArgsPreservingQuotedCommas(i[1]).length){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}t=i.length}return t.toString()};this.computePmt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,h,i,l;if(f<3||f>5||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var r,e=0,o=0,s=0,u=0,c=0;for(i=0;i<f;i++)t[i]=this.getValueFromArg(t[i].split(this.tic).join(this._string_empty)),t[i]=t[i]==null||t[i]==""?"0":t[i],t[i]=t[i].split(this.tic).join("")=="TRUE"?"1":t[i].split(this.tic).join("")=="FALSE"?"0":t[i];if(r=this._parseDouble(t[0]),e=this._parseDouble(t[1]),o=this._parseDouble(t[2]),f==4&&(s=this._parseDouble(t[3])),f==5&&(u=this._parseDouble(t[4])),isNaN(r)&&isNaN(e)&&isNaN(o)&&isNaN(s)&&isNaN(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(e==0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return u=Math.abs(u)>.5?1:0,r==0?c=1*(s+o)/((1+r*u)*(1-(e+1))):(l=Math.pow(1+r,e),c=r*(s+o*l)/((1+r*u)*(1-l))),this.computeDollar(c.toString())};this.computeMatch=function(n){var f=this.splitArgsPreservingQuotedCommas(n),v=f.length,e,l,a,r,c,p,u;if(v>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((e=this.formulaErrorStringCheck(f[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1)||(e=this.formulaErrorStringCheck(f[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)))return e;var y=f[1].split(this.tic).join(this._string_empty),w=y.indexOf(":"),t=1;if(v==3){if(this.getEnableFormulaErrorValidation()&&(l=this.formulaErrorStringCheck(f[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1))return l;if(r=this.getValueFromArg(f[2]),r=r.split(this.tic).join(this._string_empty),a=this._parseDouble(r),t=isNaN(a)?1:a,r==this.falseValueStr)t=0;else if(r==this.trueValueStr)t=1;else if(r.includes(this.tic)&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}}var s=this.getValueFromArg(f[0].split(this.tic).join(this._string_empty)).toUpperCase(),o=this.getCellsFromArgs(this._stripTics0(y)),i=1,h="",u;for(c=0;c<o.length;c++){if(p=o[c],u=this.getValueFromArg(p).split(this.tic).join(this._string_empty).toUpperCase(),h!="")if(t==1){if(this._matchCompare(u,h)<0&&u==s){i--;break}}else if(t==-1&&this._matchCompare(u,h)>0){i=-1;break}if((t==0||t==1)&&u==s)break;else if(t==1&&this._matchCompare(s,u)<0){i--;break}else if(t==-1&&this._matchCompare(s,u)>0){i--;break}i++;h==u}return t!=0&&i==o.length+1&&(i=o.length),i>0&&i<=o.length?i.toString():this.getErrorStrings()[0].toString()};this.computeBitAnd=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,f,e,u;try{if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(r[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),t<0||i<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=this._parseDouble(i),(f&e).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBitOr=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,f,e,u;try{if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(r[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),t<0||i<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=this._parseDouble(i),(f|e).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBitLShift=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||Math.abs(u)>53||r<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(u>=0?r<<u:r>>-u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this._parseDouble(t)<0||this._parseDouble(i)<0?this.getErrorStrings()[4].toString():this.getErrorStrings()[1].toString()}};this.computeBitRShift=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||Math.abs(u)>53||r<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(u>=0?r>>u:r<<-u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this._parseDouble(t)<0||this._parseDouble(i)<0?this.getErrorStrings()[4].toString():this.getErrorStrings()[1].toString()}};this.computeBitXor=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||u>0xffffffffffff||r<0||u<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(r^u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[1].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBinomOInv=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,f;if(c!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;var u,t,i=0,e=0,o=this.getValueFromArg(r[0]),s=this.getValueFromArg(r[1]),h=this.getValueFromArg(r[2]);if(o==""&&(r[0]=o="0"),s==""||h==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(u=this._parseDouble(o.split(this.tic).join("")),t=this._parseDouble(s.split(this.tic).join("")),i=this._parseDouble(h.split(this.tic).join("")),u==0)return"0";if(u<0||t<=0||t>=1||i<=0||i>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(t>0&&t<1&&i>=0&&i<1){if(e=this._critbinom(u,t,i),e==this.maxValue){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._calculation_overflow];return this.formulaErrorStrings[this._calculation_overflow]}}else{if(u<=0||t<=0||t>=1||i<0||i>1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return e.toString()};this.computeChidist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,e,i,r,u;if(o!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i<o;++i)t[i]=this.getValueFromArg(t[i]),t[i]=this._stripTics0(t[i]);if(t[0]=t[0]==null||t[0]==""?"0":t[0],t[1]=t[1]==null||t[1]==""?"0":t[1],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],r=this._parseDouble(t[0]),u=this._parseDouble(t[1]),!isNaN(r)&&!isNaN(u)){if(r<0||u<1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(r==0)return"1";if(u<1)return this._excelLikeComputations?this.getErrorStrings()[4].toString():this.formulaErrorStrings[this._invalid_arguments];e=1-this._chidist(r,u)}return e.toString()};this.computeCoth=function(n){var o=this.splitArgsPreservingQuotedCommas(n),s=o.length,r,u,f,i,e,t;if(s!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n=this.getValueFromArg(n),u=!1,n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,f=this.computeIsNumber(n),f==this.trueValueStr&&(i=n,i.includes("-")&&(u=!0),i=i.includes("u")?i.replace("u",""):i,e=this._parseDouble(i),e>=134217728)){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(n=="0"){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return n=n.includes("-")?n.replace("-",""):n,t=this._computeMath(n,Math.tanh),(t!="#NUM!"||t!="#VALUE!")&&(t=(1/parseFloat(t)).toString()),u&&(t="-"+t),t};this._initLibraryFunctions()},CalcEngine.CalcEngine=function(){},CalcEngine.getFormulaCharacter=function(){return this._formulaChar=='\0'&&(this._formulaChar="="),this._formulaChar},CalcEngine._formulaChar="=",CalcEngine.sheetFamilyID=0,CalcEngine._tokenCount=0,CalcEngine.modelToSheetID=null,CalcEngine._sheetFamiliesList=null,CalcEngine._defaultFamilyItem=null,CalcEngine.createSheetFamilyID=function(){return this.sheetFamilyID==Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},CalcEngine.getSheetFamilyItem=function(n){if(this.sheetFamilyID==0)return CalcEngine._defaultFamilyItem==null&&(CalcEngine._defaultFamilyItem=new GridSheetFamilyItem),CalcEngine._defaultFamilyItem;CalcEngine._sheetFamiliesList==null&&(CalcEngine._sheetFamiliesList=new HashTable);var t=CalcEngine.modelToSheetID.getItem(n);return CalcEngine._sheetFamiliesList.containsKey(t)||CalcEngine._sheetFamiliesList.add(t,new GridSheetFamilyItem),CalcEngine._sheetFamiliesList.getItem(t)},CalcEngine.resetSheetFamilyID=function(){this.sheetFamilyID=0;CalcEngine.modelToSheetID!=null&&(CalcEngine.modelToSheetID.clear(),CalcEngine.modelToSheetID=null);CalcEngine._sheetFamiliesList!=null&&(CalcEngine._sheetFamiliesList.clear(),CalcEngine._sheetFamiliesList=null,this.resetSheetIDs())},CalcEngine.resetSheetIDs=function(){this._tokenCount=0},CalcEngine.unregisterGridAsSheet=function(n,t){var i=CalcEngine.getSheetFamilyItem(t),r=n.toUpperCase(),u;i.sheetNameToParentObject!=null&&i.sheetNameToParentObject.containsKey(r)&&(i.sheetNameToParentObject.remove(r),u=i.sheetNameToToken.getItem(r),i.sheetNameToToken.remove(r),i.tokenToParentObject.remove(u),i.parentObjectToToken.remove(t))},CalcEngine}(jQuery,Syncfusion),function(n){n[n.None=0]="None";n[n.VLOOKUP=1]="VLOOKUP";n[n.HLOOKUP=2]="HLOOKUP";n[n.Both=3]="Both";n[n.OptimizeForMatches=4]="OptimizeForMatches"}(LookupCachingMode||(LookupCachingMode={})),function(n){n[n.FormulaSet=0]="FormulaSet";n[n.NonFormulaSet=1]="NonFormulaSet";n[n.CalculatedValueSet=2]="CalculatedValueSet"}(FormulaInfoSetAction||(FormulaInfoSetAction={}));CalcQuickBase=function(){function n(n){this.resetStaticMembers=n;this._calcQuickID=0;this._controlModifiedFlags=null;this._dataStore=null;this._engine={};this._keyToRowsMap=null;this._keyToVectors=null;this._nameToControlMap=null;this._rowsToKeyMap=null;this._isValueSetEventChanged=!1;this._autoCalc=!1;this._isIE8=!1;this._cellPrefix="!0!A";this._checkKeys=!0;this._disposeEngineResource=!0;this._ignoreChanges=!1;this._leftBrace="{";this._tic='"';this._leftBracket="[";this._rightBracket="]";this._validLeftChars="+-*/><=^(&,";this._validRightChars="+-*/><=^)&,";this.getKeyValue=function(n){if(n=n.toUpperCase(),this.getDataStore().containsKey(n)){var t=this.getDataStore().getItem(n),i=t.getFormulaText();if(i.length>0&&i[0]==CalcEngine.getFormulaCharacter()&&t.calcID!=this.getEngine().getCalcID()){this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString();i=i.substring(1);try{t.setParsedFormula(this.getEngine().parseFormula(this._markKeys(i)))}catch(r){if(this.getCheckKeys())return t.setFormulaValue(r.Message),t.calcID=this.getEngine().getCalcID(),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,t.getFormulaValue(),2)),this.getDataStore().getItem(n).getFormulaValue()}try{t.setFormulaValue(this.getEngine().computeFormula(t.getParsedFormula()))}catch(r){if(this.getThrowCircularException()&&r.toString().indexOf(this.getEngine().formulaErrorStrings[this.getEngine().circular_reference_])==0)throw r;}t.calcID=this.getEngine().getCalcID();this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,t.getFormulaValue(),2))}return this.getEngine().getThrowCircularException()&&this.getEngine().getIterationMaxCount()>0&&t.setFormulaValue(this.getEngine().handleIteration(this.getEngine().cell,t)),this.getDataStore().getItem(n).getFormulaValue()}return this.getKeyToVectors().containsKey(n)?this.getKeyToVectors().getItem(n).toString():""};this.setKeyValue=function(n,t){var i,f,u,e,r,s,c;if(n=n.toUpperCase(),i=this._isIE8?t.toString().replace(/^\s+|\s+$/g,""):t.toString().trim(),!this.getDataStore().containsKey(n)||i.indexOf(this._leftBrace)==0){if(i.indexOf(this._leftBrace)==0){this.getKeyToVectors().containsKey(n)||this.getKeyToVectors().add(n,"");i=i.substring(1,i.length-2);var h=this.getKeyToRowsMap().length+1,o=i.split(this.getEngine().getParseArgumentSeparator()),l="A"+h+":A"+(h+o.length-1);for(this.getKeyToVectors()[n]=l,f=0;f<o.length;f++)u="Q_"+(this.getKeyToRowsMap().length+1),this.getDataStore().add(u,new FormulaInfo),this.getKeyToRowsMap().add(u,this.getKeyToRowsMap().length+1),this.getRowsToKeyMap().add(this.getRowsToKeyMap().length+1,u),e=this.getDataStore().getItem(u),e.setFormulaText(""),e.setParsedFormula(""),e.setFormulaValue(this.parseAndCompute(o[f]));return}this.getDataStore().add(n,new FormulaInfo);this.getKeyToRowsMap().add(n,this.getKeyToRowsMap().length+1);this.getRowsToKeyMap().add(this.getRowsToKeyMap().length+1,n)}this.getKeyToVectors().containsKey(n)&&this.getKeyToVectors().remove(n);r=this.getDataStore().getItem(n);!this.ignoreChanges&&r.getFormulaText()!=null&&r.getFormulaText().length>0&&r.getFormulaText()!=i&&(s=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString(),c=this.getEngine().getDependentFormulaCells().getItem(s),c!=null&&this.getEngine().clearFormulaDependentCells(s));i.length>0&&i[0]==CalcEngine.getFormulaCharacter()?(r.setFormulaText(i),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,r.getFormulaValue(),2))):r.getFormulaValue()!=i&&(r.setFormulaText(""),r.setParsedFormula(""),r.setFormulaValue(i),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,r.getFormulaValue(),2)));this.getAutoCalc()&&this.updateDependencies(n)};this.resetKeys=function(){this.getDataStore().clear();this.getKeyToRowsMap().clear();this.getRowsToKeyMap().clear();this.getKeyToVectors().clear();this.getNameToControlMap().clear()};this._checkAdjacentPiece=function(n,t,i){var r=!0;return n=this._isIE8?n.replace(/^\s+|\s+$/g,""):n.trim(),n.length>0&&(r=t.indexOf(n[i?0:n.length-1])>-1),r};this.createEngine=function(){return new CalcEngine(this)};this.dispose=function(){this._dataStore=null;this._rowsToKeyMap=null;this._keyToRowsMap=null;this._keyToVectors=null;this._controlModifiedFlags=null;this._nameToControlMap=null;this.getDisposeEngineResource()&&(this._engine.getDependentFormulaCells().clear(),this._engine.getDependentCells().clear(),this._engine!=null&&this._engine.dispose(),this._engine=null)};this.tryParseAndCompute=function(n){var t="";try{t=this.parseAndCompute(n)}catch(i){t=i.message}return t};this.getFormula=function(n){return(n=n.toUpperCase(),this.getDataStore().containsKey(n))?this.getDataStore().getItem(n).getFormulaText():""};this.getValueRowCol=function(n,t){var u=this.getRowsToKeyMap().getItem(t).toString(),i=this.getKeyValue(u).toString(),r;return i!=null&&i[i.length-1]=="%"&&i.length>1&&(r=this.parseDouble(i.substring(0,i.length-1)),isNaN(r)&&(i=(Number(r)/100).toString())),i};this.initCalcQuick=function(n){this._dataStore=new HashTable;this._rowsToKeyMap=new HashTable;this._keyToRowsMap=new HashTable;this._keyToVectors=new HashTable;this._controlModifiedFlags=new HashTable;this._nameToControlMap=new HashTable;var t=CalcEngine.createSheetFamilyID();this._engine=this.createEngine();n&&(CalcEngine.resetSheetFamilyID(),this._engine.getDependentFormulaCells().clear(),this._engine.getDependentCells().clear());this._cellPrefix="!"+t+"!A";this._engine.registerGridAsSheet(RangeInfo.getAlphaLabel(this.getCalcQuickID()),this,t);this._engine.setCalculatingSuspended(!0);this._engine.ignoreValueChanged=!0;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1};this._markKeys=function(n){for(var t=n.indexOf(this._leftBracket),r,i,u,f;t>-1;)if(r=n.substring(t).indexOf(this._rightBracket)-1,i="",r>0)if(i=n.substring(t+1,r+t+1).toUpperCase(),this.getKeyToVectors().containsKey(i)){if(u=t+r+2<n.length?n.substring(t+r+2):"",this.getCheckKeys()&&!this._checkAdjacentPiece(u,this._validRightChars,!0))throw"not followed properly"+i;if(f=t>0?n.substring(0,t):"",this.getCheckKeys()&&!this._checkAdjacentPiece(f,this._validLeftChars,!1))throw"not followed properly"+i;n=f+this.getKeyToVectors().getItem(i).toString()+u;t=n.indexOf(this._leftbraket)}else if(this.getKeyToRowsMap().containsKey(i)){if(u=t+r+2<n.length?n.substring(t+r+2):"",this.getCheckKeys()&&!this._checkAdjacentPiece(u,this._validRightChars,!0))throw"not followed properly"+i;if(f=t>0?n.substring(0,t):"",this.getCheckKeys()&&!this._checkAdjacentPiece(f,this._validLeftChars,!1))throw"not followed properly"+i;n=f+"A"+this.getKeyToRowsMap().getItem(i).toString()+u;t=n.indexOf(this._leftBracket)}else if(n.toUpperCase().indexOf(this._tic+this._leftBracket+i+this._rightBracket+this.tic)>0)break;else throw"Unknown key: "+i;else t=-1;return n};this.parseAndCompute=function(n){return n.length>0&&n[0]==this.getEngine().getFormulaCharacter()&&(n=n.substring(1)),this.getEngine().parseAndComputeFormula(this._markKeys(n))};this.refreshAllCalculations=function(){var i,u;if(this.getAutoCalc()){for(this.setDirty(),this.ignoreChanges=!0,i=0;i<this.getDataStore().keys().length;i++){var r=this.getDataStore().keys()[i],n=this.getDataStore().getItem(r),t=n.getFormulaText();t.length>0&&t[0]==this.getEngine().getFormulaCharacter()&&n.calcID!=this.getEngine().getCalcID()&&(t=t.substring(1),this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(r).toString(),n.setParsedFormula(this.getEngine().parseFormula(this._markKeys(t))),n.setFormulaValue(this.getEngine().computeFormula(n.getParsedFormula())),n.calcID=this.getEngine().getCalcID(),u=parseInt(this.getKeyToRowsMap().getItem(r)),this.getEngine().valueChanged(this,new ValueChangedArgs(u,1,n.getFormulaValue())));this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(r,n.getFormulaValue(),2))}this.ignoreChanges=!1}};this.setDirty=function(){this.getEngine().updateCalcID()};this.setValueRowCol=function(){};this.updateDependencies=function(n){var u,t,i,r;if(this.getAutoCalc()&&(u=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString(),t=this.getEngine().getDependentCells().getItem(u),this.setDirty(),t!=null))for(i=0;i<t.length;i++)r=t[i].indexOf("A"),r>-1&&(r=parseInt(t[i].substring(r+1)),n=this.getRowsToKeyMap().getItem(r).toString(),this.ignoreChanges=!0,this.setKeyValue(n,this.getKeyValue(n)),this.ignoreChanges=!1)};this.initCalcQuick(n)}return n.prototype.getAutoCalc=function(){return this._autoCalc},n.prototype.setAutoCalc=function(n){this._autoCalc=n;this.getEngine().setCalculatingSuspended(!n);this.getEngine().setUseDependencies(n);n&&this.setDirty()},n.prototype.getCalcQuickID=function(){return this._calcQuickID++,this._calcQuickID==Number.MAX_VALUE&&(this._calcQuickID=1),this._calcQuickID},n.prototype.getCheckKeys=function(){return this._checkKeys},n.prototype.setCheckKeys=function(n){this._checkKeys=n},n.prototype.getControlModifiedFlags=function(){return this._controlModifiedFlags},n.prototype.getDataStore=function(){return this._dataStore},n.prototype.getDisposeEngineResource=function(){return this._disposeEngineResource},n.prototype.setDisposeEngineResource=function(n){this._disposeEngineResource=n},n.prototype.getEngine=function(){return this._engine},n.prototype.getFormulaCharacter=function(){return this.getEngine().getFormulaCharacter()},n.prototype.setFormulaCharacter=function(n){this.getEngine().setFormulaCharacter(n)},n.prototype.getKeyToRowsMap=function(){return this._keyToRowsMap},n.prototype.getKeyToVectors=function(){return this._keyToVectors},n.prototype.getNameToControlMap=function(){return this._nameToControlMap},n.prototype.getRowsToKeyMap=function(){return this._rowsToKeyMap},n.prototype.getThrowCircularException=function(){return this.getEngine().getThrowCircularException()},n.prototype.setThrowCircularException=function(n){this.getEngine().setThrowCircularException(n)},n.prototype.getValueSetEventHandler=function(){return this._valueSetEvent==null&&(this._valueSetEvent=new ValueSetEvent),this._valueSetEvent.getValueSet()},n.prototype.setValueSetEventHandler=function(n){this._valueSetEvent==null&&(this._valueSetEvent=new ValueSetEvent);this._valueSetEvent.setValueSet(n)},n}();window.CalcQuick=function(n){function t(){n.apply(this,arguments);this.registerControlArray=function(n){for(var t=0;t<n.length;t++)this.registerControl(n[t]);this.setAutoCalc(!0)};this.registerControl=function(n){var t;if(this.getNameToControlMap().length==0&&this.setValueSetEventHandler(this.calcQuickValueSet),this.getControlModifiedFlags().containsKey(n.id)||this.getNameToControlMap().containsKey(n.id))throw"error";this.getControlModifiedFlags().add(n.id,!1);this.getNameToControlMap().add(n.id.toUpperCase(),n.id);this.setKeyValue(n.id,n.value);n.type=="select-one"?(t=$.proxy(this.controlTextChanged,this,this),n.onchange=t):(t=$.proxy(this.controlTextChanged,this,this),this._isIE8?n.onpropertychange=t:n.oninput=t);t=$.proxy(this.controlLeave,this,this);n.onblur=t};this.calcQuickValueSet=function(n,t){if(n.getNameToControlMap().containsKey(t.getKey())){var i=n.getNameToControlMap().getItem(t.getKey());document.getElementById(i).value=t.getValue()}};this.controlTextChanged=function(n,t){var i=n._isIE8?event.srcElement:t.target;i!=null&&!n.ignoreChanges&&n.getControlModifiedFlags().containsKey(i.id)&&(n.getControlModifiedFlags().items[i.id]=!0)};this.controlLeave=function(n,t){var i=n._isIE8?event.srcElement:t.target;i!=null&&this.getControlModifiedFlags().containsKey(i.id)&&n.getControlModifiedFlags().getItem(i.id)&&(n.setKeyValue(i.id,i.value),n.getControlModifiedFlags().items[i.id]=!1)}}return this.__calcQuickextends(t,n),t}(CalcQuickBase);window.ValueSetEventArgs=function(){function n(n,t,i){this._id=n;this._val=t;this._action=i}return n.prototype.getAction=function(){return this._action},n.prototype.setAction=function(n){this._action=n},n.prototype.getKey=function(){return this._id},n.prototype.setKey=function(n){this._id=n},n.prototype.getValue=function(){return this._val},n.prototype.setValue=function(n){this._val=n},n}(),function(n){n[n.FormulaSet=0]="FormulaSet";n[n.NonFormulaSet=1]="NonFormulaSet";n[n.CalculatedValueSet=2]="CalculatedValueSet"}(FormulaInfoSetAction||(FormulaInfoSetAction={}));FormulaInfoHashtable=function(){function n(){this.get=function(){return new FormulaInfo};this.set=function(){return new FormulaInfo}}return n}();HashTable=function(){function n(){this.length=0;this.items=[];this.add=function(n,t){return this.previous=undefined,this.containsKey(n)?this.previous=this.items[n]:this.length++,this.items[n]=t,this.previous};this.clear=function(){this.items={};this.length=0};this.contains=function(n){return this.items.hasOwnProperty(n)};this.containsKey=function(n){return this.items.hasOwnProperty(n)};this.containsValue=function(n){return this.items.hasOwnProperty(n)&&this.items[n]!=undefined?!0:!1};this.getItem=function(n){return this.containsKey(n)?this.items[n]:undefined};this.keys=function(){var n=[];for(var t in this.items)this.containsKey(t)&&n.push(t);return n};this.remove=function(n){return this.containsKey(n)?(this.previous=this.items[n],this.length--,delete this.items[n],this.previous):undefined};this.values=function(){var n=[];for(var t in this.items)this.containsKey(t)&&n.push(this.items[t]);return n};this.each=function(n){for(var t in this.items)this.containsKey(t)&&n(t,this.items[t])};var n=undefined}return n}();window.RangeInfo=function(){function n(n,t,i,r){this.top=n;this.bottom=i;this.left=t;this.right=r;this.getBottom=function(){return this.bottom};this.setBottom=function(n){this.bottom=n};this.getTop=function(){return this.top};this.setTop=function(n){this.top=n};this.getLeft=function(){return this.left};this.setLeft=function(n){this.left=n};this.getRight=function(){return this.right};this.setRight=function(n){this.right=n}}return n.cells=function(t,i,r,u){return new n(t,i,r,u)},n.getAlphaLabel=function(n){for(var u=[],t=0,f,r,i;n>0&&t<9;)n--,f="A".charCodeAt(0),u[t]=String.fromCharCode(n%26+f),n=parseInt((n/26).toString()),t++;for(r=[],i=0;i<t;i++)r[t-i-1]=u[i];return r.join("")},n}();window.GridSheetFamilyItem=function(){function n(){this.isSheetMember=!1;this.parentObjectToToken=null;this.sheetDependentCells=null;this.sheetDependentFormulaCells=null;this.sheetFormulaInfoTable=null;this.sheetNameToParentObject=null;this.sheetNameToToken=null;this.tokenToParentObject=null}return n}();window.FormulaInfo=function(){function n(){this.calcID=Number.MIN_SAFE_INTEGER+1;this.getFormulaText=function(){return this._formulaText};this.setFormulaText=function(n){this._formulaText=n};this.getFormulaValue=function(){return this._formulaValue};this.setFormulaValue=function(n){this._formulaValue=n};this.getParsedFormula=function(){return this._parsedFormula};this.setParsedFormula=function(n){this._parsedFormula=n};var n=Number.MIN_SAFE_INTEGER+1}return n}();window.ValueChangedArgs=function(){function n(n,t,i){this.row=n;this.col=t;this.value=i;this.getRowIndex=function(){return this.row};this.setRowIndex=function(n){this.row=n};this.getColIndex=function(){return this.col};this.setColIndex=function(n){this.col=n};this.getValue=function(){return this.value};this.setValue=function(n){this.value=n}}return n}();window.FormulaParsing=function(){function n(n){this._text=n;this.getText=function(){return this._text};this.setText=function(n){this._text=n}}return n}();window.UnknownFunctionEventArgs=function(){function n(){this.getMissingFunctionName=function(){return this.m_missingFunctionName};this.setMissingFunctionName=function(n){this.m_missingFunctionName=n};this.getCellLocation=function(){return this.m_cellLocation};this.setCellLocation=function(n){this.m_cellLocation=n}}return n}();window.LookUps=function(){function n(){this.getLinearLookUpList=function(){return this._linearLookUpList};this.setLinearLookUpList=function(n){this._linearLookUpList=n};this.getMatchLookUpList=function(){return this._matchLookUpList};this.setMatchLookUpList=function(n){this._matchLookUpList=n}}return n}();window.ValueSetEvent=function(){function n(){}return n.prototype.getValueSet=function(){return this.eventFn},n.prototype.setValueSet=function(n){this.eventFn=n},n.prototype.trigger=function(){for(var i,t=[],n=0;n<arguments.length-0;n++)t[n]=arguments[n+0];i={};this.getValueSet().apply(i,t||[])},n}(),function(n,t,i){t.widget("ejCheckBox","ej.CheckBox",{_rootCSS:"e-checkbox",element:null,model:null,validTags:["input"],_addToPersist:["checked","checkState"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{id:null,name:null,value:null,htmlAttributes:{},checked:!1,enabled:!0,enableTriState:!1,showRoundedCorner:!1,enablePersistence:!1,cssClass:"",text:"",enableRTL:!1,idPrefix:"ej",size:"small",checkState:"uncheck",validationRules:null,validationMessage:null,validationMessages:null,beforeChange:null,change:null,create:null,destroy:null},dataTypes:{id:"string",name:"string",enablePersistence:"boolean",enableTriState:"boolean",size:"enum",enabled:"boolean",idPrefix:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data"},observables:["checked","checkState"],checked:t.util.valueFunction("checked"),checkState:t.util.valueFunction("checkState"),_init:function(n){var i=t.browserInfo();this._isIE8=i.name=="msie"&&i.version=="8.0"?!0:!1;this._isDevice=this._checkDevice();this._setValue();this._renderControl();this.model.enableRTL&&this._setRTL();this.model.enabled&&this._wireEvents();this._setEnabled(this.model.enabled);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());this._addAttr(this.model.htmlAttributes)},_checkDevice:function(){return t.isDevice()&&t.isTouchDevice()},_setRTL:function(){n(this.maindiv).addClass("e-rtl")},_initValidator:function(){this.wrapper.closest("form").data("validator")||this.wrapper.closest("form").validate()},_setValidation:function(){var r,i,u,f;this.wrapper.find("input").rules("add",this.model.validationRules);r=this.wrapper.closest("form").data("validator");r=r?r:this.wrapper.closest("form").validate();name=this.wrapper.find("input").attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="name"?i.element.attr(t,n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._setEnabled(!1):t=="checked"&&n=="checked"?i.checked()instanceof Array?i._updateCheckedItem():i._checked(!0):i.wrapper.attr(t,n)})},_triggerBeforeChange:function(){var n={isChecked:this._isChecked,isInteraction:!1};if(!0==this._trigger("beforeChange",n))return!1},_triggerChange:function(){var n={isChecked:this._isChecked,checkState:this.checkState(),isInteraction:!1};this._trigger("change",n)},_setModel:function(i){var r,u,f;for(r in i)switch(r){case"checked":n(this.maindiv).removeClass("e-material-animate");this.model.beforeChange&&this._triggerBeforeChange();this.checked()instanceof Array?(u=t.util.getVal(i[r]),f=u[u.length-1],this.model.value==f&&(this._isChecked=!0)):(this._isChecked=t.util.getVal(i[r]),this.checked(this._isChecked));this._isChecked?this._checked():this._unChecked();this.model.change&&this._triggerChange();break;case"enableTriState":i[r]&&(this.model.enableTriState=i[r],this._indeterminateState=i[r]);break;case"checkState":this.model.enableTriState&&(this.model.beforeChange&&this._triggerBeforeChange(),this._isChecked=t.util.getVal(i[r]),this.checkState(this._isChecked),this._changeState(this._isChecked),this.checked()instanceof Array?this._updateCheckedItem():i[r]=="check"?this._hiddenInput.removeAttribute("name"):this._hiddenInput.setAttribute("name",this.model.name),this.model.change&&(this.checked()instanceof Array||(this._isChecked=this.checkState()=="uncheck"?!1:!0),this._triggerChange()));break;case"cssClass":this._changeSkin(i[r]);break;case"enableRTL":i[r]?this._setRTL():n(this.maindiv).removeClass("e-rtl");break;case"text":this._setText(i[r]);break;case"validationRules":this.model.validationRules!=null&&(this.wrapper.find("input").rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"id":this._setIdAttr(i[r]);break;case"name":this.element.attr("name",i[r]);(!this._isChecked||this.spanImg.hasClass("e-chk-indeter"))&&this._hiddenInput.setAttribute("name",i[r]);this.model.name=i[r];break;case"value":this.element.attr("value",i[r]);break;case"size":this._setSize(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enabled":this._setEnabled(i[r]);break;case"htmlAttributes":this._addAttr(i[r])}},_destroy:function(){this.element.removeClass("e-checkbox e-input");this.element.insertBefore(this.wrapper);this.wrapper.remove()},_changeSkin:function(t){this.model.cssClass!=t&&(this.wrapper.removeClass(this.model.cssClass).addClass(t),n("#"+this.model.idPrefix+this.model.id+"_wrapper").removeClass(this.model.cssClass).addClass(t))},_setValue:function(){this._indeterminateState=!1;this._isChecked=!1;var i=this.element[0].getAttribute("id"),r=this.element[0].getAttribute("name"),n=this.element[0].getAttribute("value");t.isNullOrUndefined(i)||(this.model.id=i);t.isNullOrUndefined(r)||(this.model.name=r);t.isNullOrUndefined(n)||n==""||(this.model.value=n);this.checked()||t.isNullOrUndefined(this.element.attr("checked"))||(this._isChecked=!0);t.isNullOrUndefined(this.model.name)&&(this.model.name=this.model.id);this.model.enabled=this.model.enabled&&!this.element.attr("disabled")},_setSize:function(i){i==t.CheckboxSize.Medium?(n(this.innerdiv).removeClass("e-chkbox-small").addClass("e-chkbox-medium"),n(this.maindiv).removeClass("e-check-small").addClass("e-check-medium")):(n(this.innerdiv).removeClass("e-chkbox-medium").addClass("e-chkbox-small"),n(this.maindiv).removeClass("e-check-medium").addClass("e-check-small"))},_setRoundedCorner:function(n){n?this.span.addClass("e-corner"):this.span.removeClass("e-corner")},_setEnabled:function(n){n?this.enable():this.disable()},_setCheckBoxState:function(){this.model.enableTriState?this.checkState()=="indeterminate"?this._indeterminateState=!0:this.checkState()=="check"?this._isChecked=!0:this.checkState()=="uncheck"&&(this._isChecked=!1):this.checkState()=="indeterminate"&&this.checkState("uncheck")},_createElement:function(n,t){var i=document.createElement(n);return this._setAttributes(i,t),i},_setAttributes:function(n,t){for(var i in t)n.setAttribute(i,t[i])},_renderControl:function(){this._setCheckBoxState();this.maindiv=this._createElement("span",{"class":"e-chkbox-wrap e-widget "+this.model.cssClass,role:"checkbox",tabindex:0});this._isValid(this.model.id)&&(this.maindiv.setAttribute("id",this.model.idPrefix+this.model.id),this.element[0].setAttribute("id",this.model.id));this.innerdiv=document.createElement("div");this._setSize(this.model.size);this.span=document.createElement("span");this.span=n(this.span);this.spanImg=this._createElement("span",{"class":"e-chk-image e-icon",role:"presentation"});this.spanImg=n(this.spanImg);this.element.addClass("e-input");this.model.name=t.isNullOrUndefined(this.model.name)?this.model.id:this.model.name;this.model.value=t.isNullOrUndefined(this.model.value)?!0:this.model.value;this._setAttributes(this.element[0],{name:this.model.name,value:this.model.value});var i=n("#"+this._id+"_hidden");this._hiddenInput=i.length?i[0]:this._createElement("input",{type:"checkbox",value:!1,style:"display:none"});this._isValid(this.model.name)&&this._hiddenInput.setAttribute("id",this.model.name+"_hidden");this._setRoundedCorner(this.model.showRoundedCorner);this.checked()&&this._setCheckedItem(this.checked());this._isChecked?(this.spanImg.addClass("e-checkmark"),this.span.addClass("e-chk-act"),this.maindiv.setAttribute("aria-checked",!0),this.element.attr("checked","checked")):(this.span.addClass("e-chk-inact"),this.maindiv.setAttribute("aria-checked",!1),this._hiddenInput.setAttribute("name",this.model.name));this.checked()instanceof Array||this.checked(this._isChecked);this.span[0].appendChild(this.spanImg[0]);this.innerdiv.appendChild(this.span[0]);this.element[0].parentNode&&this.element[0].parentNode.insertBefore(this.maindiv,this.element[0]);this.maindiv.appendChild(this.element[0]);this.maindiv.appendChild(this._hiddenInput);this.maindiv.appendChild(this.innerdiv);this.wrapper=n(this.maindiv);this._setTextWrapper(this.model.text);this.chkbx=this.element;this.model.enableTriState==!0&&this._indeterminateState==!0&&this._setIndeterminate(this._indeterminateState);this.checked()instanceof Array&&this._updateCheckedItem()},_changeState:function(n){n=="indeterminate"?(this.spanImg.removeClass("e-checkmark").addClass("e-stop"),this.span.removeClass("e-chk-act e-chk-inact").addClass("e-chk-indeter"),this.wrapper[0].setAttribute("aria-checked","mixed"),this.wrapper.find("input").prop("enableTriState",!0),this.checked()instanceof Array||this.checked(null)):n=="check"?(this.spanImg.removeClass("e-stop").addClass("e-checkmark"),this.span.removeClass("e-chk-act e-chk-inact e-chk-indeter").addClass("e-chk-act"),this.wrapper[0].setAttribute("aria-checked",!0)):n=="uncheck"&&(this.spanImg.removeClass("e-checkmark e-stop"),this.span.removeClass("e-chk-act e-chk-indeter").addClass("e-chk-inact"),this.wrapper[0].setAttribute("aria-checked",!1))},_setIndeterminate:function(n){n?(this.spanImg.removeClass("e-checkmark").addClass("e-stop"),this.span.removeClass("e-chk-act e-chk-inact").addClass("e-chk-indeter"),this.wrapper[0].setAttribute("aria-checked","mixed"),this.wrapper.find("input").prop("enableTriState",!0),this.checkState("indeterminate"),this.checked()instanceof Array||this.checked(null),this._hiddenInput.setAttribute("name",this.model.name)):(this.span.removeClass("e-chk-indeter"),this.spanImg.removeClass("e-stop"),this.wrapper.find("input").removeAttr("enableTriState"),this.wrapper.find("input").prop("enableTriState",!1),this.checked()?this._checked():this._unChecked())},_setTextWrapper:function(n){n!=""&&(this.txtSpan=t.buildTag("div.e-text",n),this.wrapper.append(this.txtSpan),this.model.enableRTL&&this._setRTL())},_setText:function(n){this.model.text==""&&n!=""?this._setTextWrapper(n):this.txtSpan.html(n)},_setIdAttr:function(t){n("#"+this.model.idPrefix+this.model.id+"_wrapper").attr("id",this.model.idPrefix+t+"_wrapper");this.element[0].setAttribute("id",t)},_isValid:function(n){return!t.isNullOrUndefined(n)&&n!=""?!0:!1},_wireEvents:function(){this._on(this.wrapper,"click",this._checkedHandler);this._isIE8&&this._isValid(this.model.id)&&this._on(n("label[for="+this.model.id+"]"),"click",function(){this.wrapper.click()});this._on(this.wrapper,"focus",this._focusIn);this._on(this.wrapper,"focusout",this._focusOut)},_unWireEvents:function(){this._off(this.wrapper,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click");this._isIE8&&this._isValid(this.model.id)&&this._off(n("label[for="+this.model.id+"]"),"click");this._off(this.wrapper,"focus");this._off(this.wrapper,"focusout")},_focusIn:function(){n(this.wrapper).addClass("e-focus");n(this.wrapper).on("keydown",n.proxy(this._checkUnCheck,this))},_focusOut:function(){n(this.wrapper).removeClass("e-focus");n(this.wrapper).off("keydown",n.proxy(this._checkUnCheck,this))},_checkUnCheck:function(n){n.keyCode==32&&(n.preventDefault(),this._checkedHandler())},_checkedHandler:function(t){var i={isChecked:this._isChecked,isInteraction:!0,event:t};return!0==this._trigger("beforeChange",i)?!1:(this.span.hasClass("e-chk-inact")?(this._checked(),this.checked()instanceof Array||this.checked(!0),this.model.enableTriState&&(this._indeterminateState=!0,this.checkState("check"))):this.span.hasClass("e-chk-act")?this.model.enableTriState==!0&&this._indeterminateState==!0?(this._setIndeterminate(!0),this.checked()instanceof Array||(this.checked(!0),this.checkState("indeterminate"))):(this._unChecked(),this.checked()instanceof Array||(this.checked(!1),this.checkState("uncheck"))):this.span.hasClass("e-chk-indeter")&&(this.checked()instanceof Array?this._isChecked=!1:this.checked(!1),this._setIndeterminate(!1),this._indeterminateState=!1),this.checked()instanceof Array?this._updateCheckedItem():this._isChecked=this.checked(),n(this.maindiv).addClass("e-material-animate"),i={isChecked:this._isChecked,checkState:this.checkState(),isInteraction:!0,event:t},this._trigger("change",i),!0)},_checked:function(){this.span.removeClass("e-chk-inact").addClass("e-chk-act");this.spanImg.removeClass("e-stop").addClass("e-checkmark");this.wrapper[0].setAttribute("aria-checked",!0);this.wrapper.find("input[type=checkbox]").prop("checked",!0);this.checkState("check");this._hiddenInput.removeAttribute("name")},_unChecked:function(){this.span.removeClass("e-chk-act e-chk-indeter").addClass("e-chk-inact");this.wrapper[0].setAttribute("aria-checked",!1);this.spanImg.removeClass("e-checkmark e-stop");this.wrapper.find("input[type=checkbox]").prop("checked",!1);this.checkState("uncheck");this._hiddenInput.setAttribute("name",this.model.name)},_setCheckedItem:function(n){if(t.isNullOrUndefined(n)||n==""||n instanceof Array){if(n instanceof Array&&!t.isNullOrUndefined(this.model.value)&&this.model.value!="")for(var i=0;i<n.length;i++)n[i]==this.model.value&&(this._isChecked=!0)}else this._isChecked=!0},_updateCheckedItem:function(){t.isNullOrUndefined(this.model.value)||this.model.value==""||this.wrapper.find("span:first").hasClass("e-chk-indeter")||(n.inArray(this.model.value,this.checked())<0&&this.wrapper.find("span:first").hasClass("e-chk-act")?(this.checked().push(this.model.value),this._isChecked=!0,this._hiddenInput.removeAttribute("name")):n.inArray(this.model.value,this.checked())>-1&&this.wrapper.find("span:first").hasClass("e-chk-inact")&&(this.checked().splice(n.inArray(this.model.value,this.checked()),1),this._isChecked=!1,this._hiddenInput.setAttribute("name",this.model.name)))},disable:function(){this.wrapper.hasClass("e-disable")||(this.wrapper.addClass("e-disable"),this.wrapper[0].setAttribute("aria-disabled",!0),this.element[0].setAttribute("disabled","disabled"),this._isIE8&&this.span.addClass("e-disable"),this._unWireEvents(),this.model.enabled=!1)},enable:function(){this.wrapper.hasClass("e-disable")&&(this.wrapper.removeClass("e-disable"),this.wrapper[0].setAttribute("aria-disabled",!1),this.element.prop("disabled",!1),this._isIE8&&this.span.removeClass("e-disable"),this._wireEvents(),this.model.enabled=!0)},isChecked:function(){if(this._isChecked!=null&&this._isChecked!=i)return this._isChecked}});t.CheckboxSize={Small:"small",Medium:"medium"};t.CheckState={Check:"check",Uncheck:"uncheck",Indeterminate:"indeterminate"}}(jQuery,Syncfusion),function(n,t){t.widget("ejRadioButton","ej.RadioButton",{_rootCSS:"e-radiobtn",element:null,_requiresID:!0,model:null,validTags:["input"],_addToPersist:["checked"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{id:null,name:null,value:null,checked:!1,cssClass:"",text:"",enableRTL:!1,htmlAttributes:{},enablePersistence:!1,idPrefix:"ej",size:"small",enabled:!0,validationRules:null,validationMessage:null,validationMessages:null,beforeChange:null,change:null,create:null,destroy:null},dataTypes:{id:"string",name:"string",enablePersistence:"boolean",size:"enum",enabled:"boolean",idPrefix:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data"},observables:["checked"],checked:t.util.valueFunction("checked"),_init:function(n){var i=t.browserInfo();this._cloneElement=this.element.clone();this._isIE8=i.name=="msie"&&i.version=="8.0"?!0:!1;this._setValue();this._renderControl();this.isChecked&&this._checkedHandler();t.isNullOrUndefined(this.radbtn.attr("disabled"))||(this.model.enabled=!1);this._setEnabled(this.model.enabled);this._addAttr(this.model.htmlAttributes);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());this._wireEvents();this.initialRender=!1},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.div.addClass(n):t=="name"?i.radbtn.attr(t,n):t=="required"?i.radbtn.attr(t,n):t=="disabled"&&n=="disabled"?i.disable():t=="checked"&&n=="checked"?i._checkedChange(!0,!0):i.div.attr(t,n)})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,i,u,f;this.element.find("input").rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.find("input").attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_setModel:function(t){for(var i in t)switch(i){case"cssClass":this._changeSkin(t[i]);break;case"enableRTL":this.model.text?t[i]?this.div.addClass("e-rtl"):this.div.removeClass("e-rtl")&&this.element.closest(".e-radiobtn-wrap").hasClass("e-rtl")?this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl"):"":t[i]?this.element.closest(".e-radiobtn-wrap").addClass("e-rtl"):this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl");break;case"text":this._setText(t[i]);break;case"size":this._setSize(t[i]);break;case"validationRules":this.model.validationRules!=null&&(this.element.find("input").rules("remove"),this.model.validationMessages=null);this.model.validationRules=t[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=t[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=t[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"checked":n(this.div).removeClass("e-material-animate");typeof this.checked()=="boolean"?(this.model.checked=t[i],this._checkedChange(this.model.checked)):t[i]()!=null&&t[i]()==this.element.find(".e-input").attr("value")&&this._checkedChange(t[i]());break;case"enabled":this._setEnabled(t[i]);break;case"id":this._setIdAttr(t[i]);break;case"name":this.radbtn.attr("name",t[i]);break;case"value":this.radbtn.attr("value",t[i]);break;case"htmlAttributes":this._addAttr(t[i])}},_destroy:function(){this.radbtn.remove();this._cloneElement.removeClass("e-js e-input e-radiobtn");this._cloneElement.insertBefore(this.element);this.element.remove()},_changeSkin:function(n){this.model.cssClass!=n&&(this.element.removeClass(this.model.cssClass).addClass(n),this.div.removeClass(this.model.cssClass).addClass(n))},_setValue:function(){t.isNullOrUndefined(this.element.attr("type"))&&this.element.attr("type","radio");t.isNullOrUndefined(this.element.attr("id"))||(this.model.id=this.element.attr("id"));t.isNullOrUndefined(this.element.attr("name"))||(this.model.name=this.element.attr("name"));t.isNullOrUndefined(this.element.attr("value"))||(this.model.value=this.element.attr("value"));this.element.attr({id:this.model.id,name:this.model.name,value:this.model.value});typeof this.checked()=="boolean"?this.model.checked=this.isChecked=this.model.checked||this.element.attr("checked")=="checked":this.isChecked=this.element.attr("value")==this.checked();this.isChecked&&this.element.attr("checked","checked");this._hiddenValue=this.element.attr("value");this._isAngularbind=!1},_setIdAttr:function(t){n("#"+this.model.idPrefix+this.model.id+"_wrapper").attr("id",this.model.idPrefix+t+"_wrapper");n("#"+this.model.idPrefix+this.model.id).attr("id",this.model.idPrefix+t);this.radbtn.attr("id",t)},_setSize:function(n){n==t.RadioButtonSize.Medium?(this.span.removeClass("e-radsmaller").addClass("e-radmedium"),this.div.removeClass("e-radsmall").addClass("e-radmed")):(this.span.removeClass("e-radmedium").addClass("e-radsmaller"),this.div.removeClass("e-radmed").addClass("e-radsmall"))},_setEnabled:function(n){n?this.enable():this.disable()},_renderControl:function(){this.initialRender=!0;var i=t.browserInfo();this.div=i.name=="msie"&&i.version=="8.0"?n('<div class="e-radiobtn-wrap e-widget e-rad-outer" ><\/div>'):n('<div class="e-radiobtn-wrap e-widget" ><\/div>');this.div.attr({id:this.model.idPrefix+this.model.id,role:"radio",tabindex:0,"aria-checked":!1});this.span=n("<span><\/span>");this.span.addClass("e-spanicon");this._setSize(this.model.size);this.spanImg=n('<span class="e-rad-icon e-icon e-rad-select"><\/span>',"",{},{role:"presentation"});this.element.addClass("e-input");this.div.addClass(this.model.cssClass);this.span.append(this.spanImg);this.div.insertBefore(this.element);this.div.append(this.element);this.div.append(this.span);this._setTextWrapper(this.model.text);this.radbtn=this.element;this.element=this.div},_setTextWrapper:function(n){n!=""?(this.txtSpan=t.buildTag("div.e-text",n),this.div.append(this.txtSpan),this.model.enableRTL&&this.div.addClass("e-rtl")):this.model.enableRTL&&this.element.closest(".e-radiobtn-wrap").addClass("e-rtl")},_setText:function(n){this.model.text==""&&n!=""?this._setTextWrapper(n):this.txtSpan.html(n)},_wireEvents:function(){this._on(this.element,"click",this._checkedHandler);this._on(this.element,"focus",this._focusIn);this._on(this.element,"focusout",this._focusOut)},_focusIn:function(){n(this.element).addClass("e-focus");n(this.element).on("keydown",n.proxy(this._checkUnCheck,this))},_focusOut:function(){n(this.element).removeClass("e-focus");n(this.element).off("keydown",n.proxy(this._checkUnCheck,this))},_checkUnCheck:function(n){(n.keyCode==32||n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40)&&(n.preventDefault(),this._checkedHandler())},_checkedHandler:function(t){t&&(this._interacted=!0);this.element.hasClass("e-disable")||(this.isChecked=typeof this.checked()=="boolean"?this.radbtn.attr("checked")=="checked"?!0:!1:this.checked()==this.radbtn.attr("value"),n(this.element).find(".e-rad-icon").hasClass("e-circle_01")||this._changeEvent(!0),t&&n(this.div).addClass("e-material-animate"))},_checkedChange:function(n,t){this.isChecked=n;this._changeEvent(t)},_changeEvent:function(t){var r={isChecked:this.isChecked,isInteraction:!!t};if(!this.initialRender&&!0==this._trigger("beforeChange",r))return!1;if(n(this.element).find(".e-rad-icon").hasClass("e-circle_01"))this.spanImg.removeClass("e-circle_01").addClass("e-rad-select"),this.span.removeClass("e-rad-active"),this.div.attr({tabindex:0,"aria-checked":!1}),this.radbtn.removeAttr("checked");else{var u=this.element.find(".e-input").attr("name"),f=n('input.e-radiobtn[name="'+u+'"]:radio'),e=this,o=this.element.find(".e-input"),i=n(o).data("ejRadioButton");r.isChecked&&(this.spanImg.addClass("e-circle_01").removeClass("e-rad-select"),this.span.addClass("e-rad-active"),this.div.attr({tabindex:0,"aria-checked":!0}),this.radbtn.attr("checked","checked"));n.each(f,function(t,i){e._interacted&&n(n(i).closest(".e-widget")).find("span.e-spanicon").hasClass("e-rad-active")&&n(i).closest(".e-radiobtn-wrap").addClass("e-material-animate");n(i).closest(".e-radiobtn-wrap").find(".e-rad-icon").removeClass("e-circle_01").addClass("e-rad-select");n(i).closest(".e-radiobtn-wrap").find(".e-spanicon").removeClass("e-rad-active");n(i).closest(".e-radiobtn-wrap").attr({tabindex:0,"aria-checked":!1});var r=n(i).data("ejRadioButton");r!=null&&r.checked()!=null&&typeof r.checked()=="boolean"&&(r.model.checked=!1)});i!=null&&i.checked()!=null&&typeof i.checked()=="boolean"?i.model.checked=!0:i.checked(i.radbtn.attr("value"));this.element.find(".e-rad-icon").addClass("e-circle_01").removeClass("e-rad-select");this.span.addClass("e-rad-active");this.div.attr({tabindex:0,"aria-checked":!0});this._isAngularbind||this.element.find(".e-input").click();this.isChecked=!0}r={isChecked:this.isChecked,isInteraction:!!t};this.initialRender||this._trigger("change",r);t&&this._trigger("_change",{value:this._hiddenValue})},disable:function(){this.element.hasClass("e-disable")||(this.element.addClass("e-disable"),this.radbtn.attr("disabled","disabled"));this._isIE8&&this.span.addClass("e-disable");this.div.attr("aria-disabled",!0);this.model.enabled=!1},enable:function(){this.element.hasClass("e-disable")&&(this.element.removeClass("e-disable"),this.radbtn.prop("disabled",!1));this._isIE8&&this.span.removeClass("e-disable");this.div.attr("aria-disabled",!1);this.model.enabled=!0}});t.RadioButtonSize={Small:"small",Medium:"medium"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejAutocomplete","ej.Autocomplete",{element:null,model:null,validTags:["input"],_ignoreOnPersist:["fields","dataSource","query","focusIn","focusOut","change","select","create","destroy","open","close","actionComplete","actionSuccess","actionFailure"],_setFirst:!1,_rootCSS:"e-autocomplete",type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"]},_requiresID:!0,defaults:{dataSource:null,query:null,fields:{text:null,key:null,category:null,groupBy:null,htmlAttributes:null},locale:"en-US",name:null,template:null,allowGrouping:!1,enableDistinct:!1,allowSorting:!0,sortOrder:"ascending",htmlAttributes:{},multiSelectMode:"none",delimiterChar:",",allowAddNew:!1,addNewText:"Add New",showRoundedCorner:!1,readOnly:!1,cssClass:"",watermarkText:null,value:"",selectValueByKey:null,filterType:"startswith",caseSensitiveSearch:!1,showLoadingIcon:!0,showResetIcon:!1,itemsCount:0,minCharacter:1,delaySuggestionTimeout:200,showPopupButton:!1,highlightSearch:!1,enableAutoFill:!1,enableRTL:!1,enabled:!0,visible:!0,height:"",width:"",emptyResultText:"No suggestions",animateType:"slide",showEmptyResultText:!0,enablePersistence:!1,popupHeight:"152px",popupWidth:"auto",autoFocus:!1,multiColumnSettings:{enable:!1,showHeader:!0,stringFormat:"{0}",columns:[{field:null,headerText:null,textAlign:"left",headerTextAlign:"left",cssClass:"",type:"string",filterType:"startswith"}]},validationRules:null,validationMessage:null,focusIn:null,focusOut:null,change:null,select:null,create:null,open:null,close:null,destroy:null,actionBegin:null,actionComplete:null,actionSuccess:null,actionFailure:null},dataTypes:{autoFocus:"boolean",watermarkText:"string",locale:"string",cssClass:"string",filterType:"enum",caseSensitiveSearch:"boolean",showLoadingIcon:"boolean",template:"string",allowGrouping:"boolean",enableDistinct:"boolean",allowSorting:"boolean",sortOrder:"enum",allowAddNew:"boolean",addNewText:"string",showRoundedCorner:"boolean",showResetIcon:"boolean",readOnly:"boolean",itemsCount:"number",animateType:"enum",minCharacter:"number",showPopupButton:"boolean",highlightSearch:"boolean",enableAutoFill:"boolean",enableRTL:"boolean",multiSelectMode:"enum",delimiterChar:"string",emptyResultText:"string",showEmptyResultText:"boolean",enabled:"boolean",visible:"boolean",enablePersistence:"boolean",dataSource:"data",query:"data",fields:"data",validationRules:"data",validationMessage:"data",htmlAttributes:"data",multiColumnSettings:"data"},observables:["value","selectValueByKey"],value:t.util.valueFunction("value"),_selectValueByKey:t.util.valueFunction("selectValueByKey"),enable:function(){this.model.enabled||(this.model.enabled=!0,this.target.disabled=!1,this.element.removeClass("e-disable").attr({"aria-disabled":!1}),this.element.removeAttr("disabled"),this.model.showPopupButton&&this.dropdownbutton.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.multiSelectMode=="visualmode"&&this._ulBox.removeClass("e-disable").attr({"aria-disabled":!1}),this.wrapper.removeClass("e-disable-wrap"))},disable:function(){this.model.enabled&&(this._hideResult(),this.model.enabled=!1,this.target.disabled=!0,this.element.attr("disabled","disabled"),this.element.addClass("e-disable").attr({"aria-disabled":!0}),this.model.showPopupButton&&this.dropdownbutton.addClass("e-disable").attr({"aria-disabled":!0}),this.model.multiSelectMode=="visualmode"&&this._ulBox&&this._ulBox.addClass("e-disable").attr({"aria-disabled":!0}),this.wrapper.addClass("e-disable-wrap"))},clearText:function(){this.model.multiSelectMode=="visualmode"&&this._deleteBox(this._ulBox.children("li"));this.element.val("");this._valueChange();this._isFocused?this.element.blur():this._focusOutAction();this._hideResult()},getValue:function(){var n=this.value();return n==null?"":n},getSelectedItems:function(){return this._isFocused&&this.model.multiSelectMode!="visualmode"&&this._updateSelectedItemArray(this.getValue()),this._selectedItems},_setValue:function(i){var r,u,f;if(this._isWatermark||this._hiddenSpan.css("display","none"),(typeof i=="object"||typeof i=="number"&&isNaN(i)||n.trim(i)=="")&&(i=""),this.model.multiSelectMode=="visualmode"&&this._hiddenInput.val(""),this.element.val(""),i)if(this.model.multiSelectMode=="visualmode")if(this._selectedItems=[],this._modelValue=i,this._deleteBox(this._ulBox.children("li")),r=i.split(this.model.delimiterChar),this.element.width(1).val("").removeAttr("placeholder"),this._hiddenInput||(this._hiddenInput=t.buildTag("input#"+this.target.id+"_hidden","",{},{type:"hidden",name:this.element.attr("name")}).insertBefore(this.element)),t.DataManager&&this.model.dataSource instanceof t.DataManager)this._createBoxForObjectType(r);else if(this.suggestionListItems=this.model.dataSource,this.suggestionListItems&&typeof this.suggestionListItems[0]!="object")for(this._hiddenInput.val(i),u=0,f=r.length;u<f;u++)r[u]&&(this._ulBox.append(this._createBox(r[u])),this._selectedItems.push(r[u]));else this._createBoxForObjectType(r);else this.element.val(i),this._updateSelectedItemArray(i);return this.model.multiSelectMode!="visualmode"&&this.value(this.element.val()),this._preVal=this.element.val(),this._isWatermark||this._setWatermarkTxt(),i},_createBoxForObjectType:function(i){for(var r,u=this,f=this._declareVariable(),e=0,o=i.length;e<o;e++)r=n.trim(i[e]),r!=""&&(t.DataManager&&this.model.dataSource instanceof t.DataManager?(this._dataQuery=this._getQuery().where(f[0],"equal",r,!1),this._promise=this.model.dataSource.executeQuery(this._dataQuery),this._promise.done(function(n){var i=n.result;u._strData=i instanceof Array&&i.length?i[0]:r;t.isNullOrUndefined(u._strData[f[1]])||u._selectKeyInit();u._selectedItems.push(u._strData)}).fail(function(){u._selectedItems.push(r)})):(this._dataQuery=t.Query().where(f[0],"equal",r,!1),this._promise=t.DataManager(this.suggestionListItems).executeLocal(this._dataQuery),this._strData=this._promise instanceof Array&&this._promise.length?this._promise[0]:r,t.isNullOrUndefined(this._strData[f[1]])||this._selectKeyInit(),this._selectedItems.push(this._strData)),this.model.multiSelectMode=="visualmode"&&this._ulBox.append(this._createBox(r)))},_selectKeyInit:function(){var n=this._declareVariable(),i;delimiterChar=this._delimiterChar();this.model.multiSelectMode=="visualmode"&&this._hiddenInput.val(this._hiddenInput.val()+(t.isNullOrUndefined(this._strData[n[1]]||this._strData[n[0]])?"":(this._strData[n[1]]||this._strData[n[0]])+this.model.delimiterChar));t.isNullOrUndefined(this._strData[n[1]])||(this.model.multiSelectMode!="none"?(i=this._selectValueByKey()!=null?this._selectValueByKey()+this._strData[n[1]]+delimiterChar:this._strData[n[1]]+delimiterChar,i=i.split(delimiterChar).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]),this._selectValueByKey(i.join(delimiterChar))):this._selectValueByKey(this._strData[n[1]]))},_declareVariable:function(){var n=this.model.fields,i={_key:null,_text:null,_attr:null},r=[];if(!t.isNullOrUndefined(n))return i._text=n&&n.text?n.text:"text",i._key=n&&n.key?n.key:"key",r.push(i._text,i._key),r},selectValueByKey:function(i){var u,r;t.isNullOrUndefined(i)||(u=this,i=i.toString(),r=this.model.multiSelectMode!="none"?i.split(this.model.delimiterChar):i.split(","),Object.prototype.toString.call(r)==="[object Array]"&&n.each(r,function(t,i){u._setOperation(n.trim(i),"key")}))},selectValueByText:function(n){this._setOperation(n,"text")},setValue:function(n){this._setText(n)},_setOperation:function(n,i){var o="",u,f,s=this,r=this.model.dataSource,e;if(t.isNullOrUndefined(r))return!1;if(typeof r[0]=="object"||r instanceof t.DataManager)e=this.model.fields,o=e&&e[i]?e[i]:i;else if(i=="key")return!1;if(t.DataManager&&r instanceof t.DataManager)f=this._getQuery().where(o,"equal",n,!this.model.caseSensitiveSearch),u=r.executeQuery(f),u.done(function(n){s._setText(n.result[0])});else{if(!r||!r.length||r.length<1)return!1;f=t.Query().where(o,"equal",n,!this.model.caseSensitiveSearch);u=t.DataManager(r).executeLocal(f);this._setText(u[0])}},_setText:function(n){var i,t,r;if(!n)return!1;if(t=this.model.fields,i=typeof this.model.dataSource[0]=="object"||typeof n=="object"?typeof n=="string"?n:t&&t.text?n[t.text]:n.text:n,i){if(this.model.multiSelectMode=="visualmode"&&this._removeDuplicates(n))return!1;this._valueToTextBox(i,n,!0);r=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val();this.value(r);this.model.showResetIcon&&this._showReset()}},_textFormateString:function(n){var i=this.model.multiColumnSettings.stringFormat,r,u;if(this._columnsIndex(),t.isNullOrUndefined(n)||typeof n!="object")i=t.isNullOrUndefined(n)||typeof n=="object"?this._currList[this._activeItem-1]:i.replace("{"+this._columnIndex[0]+"}",n);else for(r=0,u=this._columnIndex.length;r<u;r++)i=i.replace("{"+this._columnIndex[r]+"}",n[this.model.multiColumnSettings.columns[parseInt(this._columnIndex[r])].field]);return i},_columnsIndex:function(){var t=this;this._columnIndex=[];n.each(this.model.multiColumnSettings.stringFormat.match(/\{.+?\}/g),function(n,i){t._columnIndex[n]=i.slice(1,-1)})},_valueToTextBox:function(i,r,u){var o,f,e;!this._addNewTemplate&&this.model.multiColumnSettings.enable&&typeof r!="string"&&(i=this._textFormateString(r));this.model.multiSelectMode=="visualmode"?(r=typeof r=="string"&&this._addNewTemplate&&r.substr(r.length-this._addNewTemplate.length)==this._addNewTemplate?r.replace(this._addNewTemplate,""):r,o=i.indexOf(this._addNewTemplate),this._addNewTemplate&&(i=i.substr(0,i.length-this._addNewTemplate.length)),e=this.model.delimiterChar,f=this._getUniqueKey(),f=f?f:this.model.fields&&this.model.fields.key?r[this.model.fields.key]:t.isNullOrUndefined(r.key)?f:r.key,(!(this._selectValueByKey()==f||f==null)||o>-1)&&this._selectValueByKey(this._selectValueByKey()!=null?this._selectValueByKey()+(o>-1?i:f)+e:(o>-1?i:f)+e),(!(this._hiddenInput.val()==f||f==null)||o>-1)&&this._hiddenInput.val(this._hiddenInput.val()+(f||i)+e),this._modelValue=t.isNullOrUndefined(this.value())?i+e:this.value()+i+e,this.element.val("").removeAttr("placeholder").width(1),this._ulBox.append(this._createBox(i)),this.model.height!=""&&(n(this._ulBox).parent().css("overflow","auto"),this.model.showPopupButton&&this._ulBox.parent()[0].scrollHeight!=0&&this.dropdownbutton.css("height",this._ulBox.parent()[0].scrollHeight)),this._addNewTemplate=null):this.model.multiSelectMode=="delimiter"?(e=this.target.value.lastIndexOf(this.model.delimiterChar),this._typed||this.element.val()==""||u||!this.model.showPopupButton?u?this.element.val(this.element.val()==""?i+this.model.delimiterChar:this.element.val()+i+this.model.delimiterChar):e==-1?this.element.val(this._queryString.substr(0,e+1)+i+this.model.delimiterChar):this.element.val(this._queryString.substr(0,e+this.model.delimiterChar.length)+i+this.model.delimiterChar):!this.model.enableAutoFill||this.showSuggestionBox?this._checkDeli()?this.element.val(this._queryString.substr(0,e)+this.model.delimiterChar+i+this.model.delimiterChar):this.element.val(this.element.val()+this.model.delimiterChar):this._checkDeli()||this.element.val(this.element.val()+this.model.delimiterChar),this._typed=!1):(this.element.val(i),this._selectedItems=[]);this._selectedItems.push(r);this._originalval.push(i);this._moveCaretToEnd(this.element[0])},_removeDuplicates:function(n){return this._selectedItems.length==0?!1:this._selectedItems.indexOf(n)!=-1?!0:void 0},search:function(){this.model.enabled&&this._checkDelimiter()&&(this._hideResult(),this._autoFill=!1,this._queryString=n.trim(this._queryString),this._queryString.length>0&&this._OnTextEnter())},setVisible:function(n){n?this.wrapper.show():this.wrapper.hide()},hide:function(){this._hideResult()},open:function(){this._showFullList()},_changeWatermark:function(n){this._isWatermark?this.element.attr("placeholder",n):this._hiddenSpan.text(n)},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.suggestionList.removeClass(this.model.cssClass).addClass(n)},_setDropdown:function(n){this.model.showPopupButton=n;n?this._renderDropdown():this._destroyDropdown()},_changeHeight:function(n){this.wrapper.height(n)},_changeWidth:function(n){this.wrapper.width(n);this._setListWidth()},_setCulture:function(){this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.addNewText)||(this._localizedLabels.addNewText=this._options.addNewText),t.isNullOrUndefined(this._options.emptyResultText)||(this._localizedLabels.emptyResultText=this._options.emptyResultText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this.model.addNewText=this._localizedLabels.addNewText;this.model.emptyResultText=this._localizedLabels.emptyResultText;this.model.watermarkText=this._localizedLabels.watermarkText},_init:function(n){if(this._options=n,this._setCulture(),!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this.model.fields.groupBy=this.model.fields.groupBy?this.model.fields.groupBy:this.model.fields.category;this._initialize();this._render();this._wireEvents();this.initialRender=!1;this.model.validationRules!=null&&(this._initValidator(),this._setValidation())},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var f,r,i,u,e;if(this.model.validationRules){f=this.model.multiSelectMode=="visualmode"?this._hiddenInput:this.element;f.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=f.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(e in this.model.validationMessage)i==e?u=this.model.validationMessage[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}}},_removeDuplicateValue:function(n){return n.split(this.model.delimiterChar).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]).join(this.model.delimiterChar)},_delimiterChar:function(){return this.model.multiSelectMode!="none"?this.model.delimiterChar:""},_setModel:function(n){var i,o,s,e,f,r,u;for(i in n){switch(i){case"dataSource":this.model.dataSource=null;break;case"watermarkText":this._changeWatermark(n[i]);break;case"delaySuggestionTimeout":this.model.delaySuggestionTimeout=parseInt(n[i]);break;case"value":deli=this._delimiterChar();this.model.multiSelectMode!="none"&&(u=n[i].substr(n[i].length-deli.length)==deli?n[i]:n[i]+deli,n[i]=n[i]==""?this.value():(this.value()?this.value():"")+u,this.model.multiSelectMode=="visualmode"&&(n[i]=n[i].split(deli).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]),n[i]=n[i].join(deli)));this.value(this._setValue(n[i]));this._modelValue=this.value();o=this.model.multiSelectMode=="visualmode"?this._hiddenInput.val():this.element.val();this._changeEvtTrigger(o);this.model.showResetIcon&&this._showReset();break;case"showPopupButton":this._setDropdown(n[i]);break;case"enableRTL":this._RightToLeft(n[i]);break;case"showRoundedCorner":this._setRoundedCorner(n[i]);break;case"readOnly":this._checkReadOnly(n[i]);break;case"delimiterChar":s=this.model.delimiterChar;n[i]=this._validateDelimiter(n[i]);this.model.delimiterChar=n[i];this.element.val(this.value().replace(new RegExp(s,"g"),this.model.delimiterChar));this.value(this.element.val());break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=n[i];this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation());break;case"locale":t.Autocomplete.Locale[n[i]]?(this.model.locale=n[i],this._setCulture(),this._setWatermark()):n[i]=this.model.locale;break;case"filterType":e=[];for(r in t.filterType)t.filterType.hasOwnProperty(r)&&e.push(t.filterType[r]);e.indexOf(n[i])>-1?this.model.filterType=n[i]:n[i]=this.model.filterType;break;case"multiSelectMode":this.model.multiSelectMode=n[i];f=this._delimiterChar();this.model.multiSelectMode!="none"&&(r=this._selectValueByKey(),u=this.value(),u&&(u=u.substr(u.length-f.length)==f?u:u+f,this.value(u),this.model.multiSelectMode=="visualmode"&&this.value(this._removeDuplicateValue(this.value()))),r&&(this._selectValueByKey(r.substr(r.length-f.length)==f?r:r+f),this.model.multiSelectMode=="visualmode"&&this._selectValueByKey(this._removeDuplicateValue(this._selectValueByKey()))));n[i]=="visualmode"?(this.model.validationRules!=null&&this.element.rules("remove"),this.element.val()!=""&&this._isWatermark&&this.element.removeAttr("placeholder"),this._renderBoxModel()):this.element.hasClass("e-visual-mode")&&this._destroyBoxModel();this._setValue(this.value());this._setValidation();t.isNullOrUndefined(this.element.attr("placeholder"))&&this._isWatermark&&this._setWatermark();break;case"enabled":this._disabled(!n[i]);break;case"visible":this.setVisible(n[i]);break;case"height":this._changeHeight(n[i]);break;case"width":this._changeWidth(n[i]);break;case"cssClass":this._changeSkin(n[i]);break;case"itemsCount ":(n[i]<=0||isNaN(n[i]))&&(n[i]=0);break;case"popupHeight":this.suggestionList.css({"max-height":isNaN(n[i])?n[i]:n[i]+"px"});break;case"popupWidth":this.model.popupWidth=n[i];this._setListWidth();break;case"selectValueByKey":deli=this._delimiterChar();r=t.util.getVal(n[i]);this.selectValueByKey(r);keyValue=this.model.multiSelectMode!="none"?this._selectValueByKey()+n[i]:n[i];keyValue=keyValue.split(deli).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]);keyValue=keyValue.join(deli);n[i]=keyValue.substr(keyValue.length-deli.length)==deli?keyValue:keyValue+deli;break;case"htmlAttributes":this._addAttr(n[i]);break;case"emptyResultText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.emptyResultText=this.model.emptyResultText=n[i];this._setCulture();break;case"addNewText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.addNewText=this.model.emptyResultText=n[i];this._setCulture();break;case"multiColumnSettings":t.isNullOrUndefined(n[i].enable)||(this.model.multiColumnSettings.enable=n[i].enable);t.isNullOrUndefined(n[i].showHeader)||(this.model.multiColumnSettings.showHeader=n[i].showHeader);t.isNullOrUndefined(n[i].stringFormat)||(this.model.multiColumnSettings.stringFormat=n[i].stringFormat);t.isNullOrUndefined(n[i].columns)||(this.model.multiColumnSettings.columns=n[i].columns);this.suggestionList.remove();this._renderSuggestionList();break;case"showResetIcon":this.model.showResetIcon=n[i];n[i]&&!t.isNullOrUndefined(this.value())&&this.value()!=""?this._showReset():this._removeReset()}this._hideResult()}},_destroy:function(){this.element.width("").removeAttr("role aria-label aria-expanded aria-haspopup aria-autocomplete autocomplete placeholder aria-owns aria-disabled disabled");this.element.insertAfter(this.wrapper);this.model.multiSelectMode=="visualmode"&&this.element.removeClass("e-visual-mode").attr("name",this._hiddenInput.attr("name"));this.model.enabled||this.element.removeClass("e-disable");this.wrapper.remove();this.element.removeClass("e-input").val("");this._isWatermark&&this.element.removeAttr("placeholder");this._hideResult();this.suggestionList.remove()},_initialize:function(){this.value(this.value()===""?this.element[0].value:this.value());this.element.attr("role","combobox").attr("aria-label","Autocomplete textbox").attr("aria-expanded",!1).attr("tabindex",0).attr("aria-autocomplete","list");/Edge\/12./i.test(navigator.userAgent)&&this.element.addClass("edge-browser");this.target=this.element[0];this.dropdownbutton=null;this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this.showSuggestionBox=!1;this.noresult=!0;this._queryString=null;this.suggLen=0;this._selectedItems=[];this._modelValue="";this._activeItem=0;this._originalval=[];this.ctrlKeyPressed=!1;this._isFocused=!1;this._isOpened=!1;this._typed=!1;this._cancelEvent=!1;this._isWatermark=this._checkWatermarkSupport();this._selectedObj=[]},_render:function(){this._renderWrapper();this._addAttr(this.model.htmlAttributes);this._setDimentions();this._renderDropdown();this._checkProperties();this._isWatermark?this._setWatermark():this._setWatermarkTxt();this._renderSuggestionList();this._RightToLeft(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner);this.setVisible(this.model.visible);this._setListPosition()},_renderWrapper:function(){var n,i;this.element.addClass("e-input").attr("autocomplete","off");this.wrapper=t.buildTag("span.e-atc e-widget "+this.model.cssClass+"#"+this.target.id+"_wrapper").insertAfter(this.element);document.activeElement==this.element[0]&&(n=!0);this.container=t.buildTag("span.e-in-wrap e-box").append(this.element);this.wrapper.append(this.container);this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this.model.watermarkText),this._hiddenSpan.css("display","none"),i=this,this._hiddenSpan.click(function(){this._isFocused||i.element.focus()}));n&&this.element.focus()},_renderDropdown:function(){if(this.model.showPopupButton){var i=t.buildTag("span.e-icon e-search").attr(this._isIE8?{unselectable:"on"}:{});this.dropdownbutton=t.buildTag("span.e-select#"+this.target.id+"_dropdown").attr(this._isIE8?{unselectable:"on"}:{}).append(i);this.container.append(this.dropdownbutton).addClass("e-padding");this.model.enabled||this.dropdownbutton.addClass("e-disable").attr({"aria-disabled":!0});this.dropdownbutton.on("mousedown",n.proxy(this._OnDropdownClick,this))}},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="required"&&i.element.attr(t,n);t=="class"?i.wrapper.addClass(n):t=="name"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._disabled(!0):t=="readOnly"&&n===!0?i._checkReadOnly(!0):i.wrapper.attr(t,n)})},_setDimentions:function(){this.model.height&&this.wrapper.height(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_renderBoxModel:function(){this._ulBox=t.buildTag("ul.e-ul e-boxes");var i=this.model.enabled?"":"e-disable";this._ulBox.addClass(i);this._hiddenInput=t.buildTag("input#"+this.target.id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element);this._hiddenInput.attr("name",this.element.attr("name"));this.element.val("").removeAttr("name").addClass("e-visual-mode");this._isWatermark||this.element.width(1);this.container.prepend(this._hiddenInput,this._ulBox);this.model.height!=""?this.wrapper.height(this.model.height):this.wrapper.height("auto");this._on(this.container,"mousedown",function(t){if(!this.model.enabled)return!1;var i=n(t.target);i.is(this.element)||(t.preventDefault(),this._isFocused||this.element.focus(),i.hasClass("e-options")?(!t.ctrlKey&&i.siblings().hasClass("e-active")&&this._removeActive(),i.hasClass("e-active")?i.removeClass("e-active"):i.addClass("e-active")):this._moveCaretToEnd(this.element[0]));!t.ctrlKey&&(i.hasClass("e-boxes")||i.hasClass("e-input"))&&this._removeActive()})},_destroyBoxModel:function(){this.container.prepend(this.element);this.element.attr({name:this._hiddenInput.attr("name")}).removeAttr("style").removeClass("e-visual-mode");this.wrapper.height(this.model.height);this._hiddenInput.remove();this._hiddenInput=null;this._ulBox.remove();this._off(this.container,"mousedown")},_deleteLastBox:function(){var t=this._ulBox.children(),n=t.last(),i=n.hasClass("e-active");this._removeActive();i?this._deleteBox(n):n.addClass("e-active")},_deleteBox:function(t){for(var s,u,i,f,e,r=0,o=t.length;r<o;r++)s=this._ulBox.children(),u=s.index(t[r]),this._selectedItems.splice(u,1),i=this.model.delimiterChar,f=this._hiddenInput.val().split(i),f.splice(u,1),this._hiddenInput.val(f.join(i)),this._selectValueByKey(f.join(i)),e=this._modelValue.split(i),e.splice(u,1),this._modelValue=e.join(i),n(t[r]).remove();this.showSuggestionBox&&this._refreshPopup();this._valueChange();this._hiddenInput.val()==""&&this._setWatermark()},_removeActive:function(){this._ulBox.children("li.e-active").removeClass("e-active")},_adjustWidth:function(){var n=t.buildTag("span",this.element.val()),i,r;this.container.append(n);r=30;i=n.width()+r;this.element.width()!=i&&this.element.width(i);this._hiddenInput.val()==""&&this._setWatermark();n.remove()},_checkProperties:function(){var r,i;this._checkReadOnly(this.model.readOnly);this.model.delimiterChar=this._validateDelimiter(this.model.delimiterChar);this.model.enabled?this.model.enabled&&n(this.element).hasClass("e-disable")&&(this.model.enabled=!1,this._disabled(!1)):(this.model.enabled=!0,this._disabled(!0));this._checkNameAttr();this.model.multiSelectMode=="visualmode"&&this._renderBoxModel();this._selectValueByKey()!=null&&this.value()==""?(r=this._selectValueByKey().toString(),this.model.multiSelectMode!="none"&&(r=r.substr(r.length-this.model.delimiterChar.length)==this.model.delimiterChar?r:r+this.model.delimiterChar,this.model.multiSelectMode=="visualmode"?this._selectValueByKey(null):this._selectValueByKey(r)),this.selectValueByKey(r),this.model.showResetIcon&&this._showReset()):(i=this.value(),this.model.multiSelectMode=="none"||t.isNullOrUndefined(i)||i==""||(i=i.substr(i.length-this.model.delimiterChar.length)==this.model.delimiterChar?i:i+this.model.delimiterChar),this.value(this._setValue(i)),this.model.showResetIcon&&this.value()!=""&&this._showReset())},_checkNameAttr:function(){this.model.name=this.element.attr("name")!=null?this.element.attr("name"):this.model.name!=null?this.model.name:this.element[0].id;this.element.attr("name",this.model.name)},_disabled:function(n){n?this.disable():this.enable()},_destroyDropdown:function(){this.dropdownbutton.off("mousedown",n.proxy(this._OnDropdownClick,this));this.dropdownbutton.remove();this.dropdownbutton=null;this.container.removeClass("e-padding")},_validateDelimiter:function(t){if(n.trim(t).length==t.length||t.length!=null)if(!/^[a-zA-Z0-9]+$/.test(t))return t;return","},_checkWatermarkSupport:function(){return"placeholder"in document.createElement("input")},_setWatermark:function(){(this.model.watermarkText&&(this.value()==""||t.isNullOrUndefined(this.value()))||this.model.multiSelectMode!="visualmode")&&this.element.attr("placeholder",this.model.watermarkText).width("")},_setWatermarkTxt:function(){if(this.model.watermarkText!=null&&n.trim(this.element.val())==""&&(this.model.multiSelectMode!="visualmode"||n.trim(this._hiddenInput.val())=="")){var t=this.model.watermarkText!=null?this.model.watermarkText:this._localizedLabels.watermarkText;this._hiddenSpan.css("display","block").text(t)}},_renderSuggestionList:function(){var o=n("#"+this.element[0].id+"_suggestion").get(0),r,s,f,i,u,e;if(o&&n(o).remove(),this.suggestionList=t.buildTag("div.e-atc-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.target.id+"_suggestion","",{display:"none"}).attr("role","listbox"),this.element.attr("aria-owns",this.target.id+"_suggestion"),this.popup=this.suggestionList,r=t.buildTag("div"),this.model.multiColumnSettings.enable){if(this._tableColumn=t.buildTag("table","",{},{role:"listbox","border-collapse":"separate",border:0,cellspacing:0,cellpadding:0,"class":"e-atc-tableContent"}),this._listEventBind(this._tableColumn,"tr"),this._headerColGroup=document.createElement("colgroup"),this.model.multiColumnSettings.showHeader){for(this._tableHeaderDiv=t.buildTag("div",{},{},{"class":"e-atc-tableHeader "+(this.model.enableRTL?"e-atc-tableHeaderRTL":"e-atc-tableHeaderScroll")}),s=t.buildTag("div",{},{},{"class":"e-atc-tableHeaderContent e-atc-tableHeaderBorder"}),f=document.createElement("tr"),this._tableHeader=t.buildTag("table","",{},{cellspacing:"0.25px"}),i=0,u=this.model.multiColumnSettings.columns.length;i<u;i++)n(f).append(t.buildTag("th",this.model.multiColumnSettings.columns[i].headerText?this.model.multiColumnSettings.columns[i].headerText:"column"+i,{"text-align":this.model.multiColumnSettings.columns[i].headerTextAlign?this.model.multiColumnSettings.columns[i].headerTextAlign:"left"},{"class":i==this.model.multiColumnSettings.columns.length-1?"":this.model.enableRTL?"e-atc-thleft":"e-atc-thright"})),n(this._headerColGroup).append(document.createElement("col"));n(this._tableHeaderDiv).append(n(s).append(n(this._tableHeader).append(f).append(this._headerColGroup)));this.suggestionList.append(this._tableHeaderDiv)}else{for(i=0,u=this.model.multiColumnSettings.columns.length;i<u;i++)n(this._headerColGroup).append(document.createElement("col"));this._tableColumn.append(this._headerColGroup)}e=t.buildTag("div");e.append(this._tableColumn);r.append(e)}else this.ul=t.buildTag("ul.e-ul").attr("role","listbox"),this._listEventBind(this.ul,"li:not('.e-category')"),r.append(this.ul);this.suggestionList.append(r);n("body").append(this.suggestionList);this._setListWidth();this._setListHeight();this.model.multiColumnSettings.enable?(r.ejScroller({height:0,width:0,scrollerSize:20}),this.scrollerObj=r.ejScroller("instance")):(this.suggestionList.ejScroller({height:0,width:0,scrollerSize:20}),this.scrollerObj=this.suggestionList.ejScroller("instance"))},_listEventBind:function(t,i){t.on({mouseenter:n.proxy(this._OnMouseEnter,this),mouseleave:n.proxy(this._OnMouseLeave,this),click:n.proxy(this._OnMouseClick,this)},i)},_checkEmptyList:function(){this.model.multiSelectMode=="visualmode"&&this._removeRepeated();this.suggestionListItems.length==0?(this.suggestionListItems.push(this.model.emptyResultText),this.noresult=!0):this.noresult=!1},_showSuggestionList:function(n){this.suggestionListItems=this.model.enableDistinct?t.dataUtil.distinct(this.suggestionListItems,typeof this.suggestionListItems[0]!="object"?"":this.model.fields&&this.model.fields.text?this.model.fields.text:"text",!0):this.suggestionListItems;this.model.itemsCount>0&&(this.suggestionListItems=t.DataManager(this.suggestionListItems).executeLocal(t.Query().take(this.model.itemsCount)));this._checkEmptyList();this._addNewTemplate=null;this.noresult&&this.model.multiSelectMode=="visualmode"&&this.model.allowAddNew&&this.element.val()!=""&&!this._repeatRemove&&(this.noresult=!1,this.suggestionListItems.pop(),this._addNewTemplate=" ("+this.model.addNewText+")",this.suggestionListItems.push(this.element.val()+this._addNewTemplate),this._checkEmptyList());(!this.noresult||this.model.showEmptyResultText)&&this._generateSuggestionList(n)},_generateSuggestionList:function(i){var u=this.suggestionListItems,r,s,b,e,h,c,a,f,o,k,v,y;if(this.model.multiColumnSettings.enable?this._tableColumn.empty()&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv.css("display",""):this.ul.empty(),r=this,s=document.createDocumentFragment(),typeof u[0]!="object"){if(r.model.multiColumnSettings.enable){var p=t.buildTag("tbody"),d=t.buildTag("tr").attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}),g=t.buildTag("td",{},{},{role:"option"});for(e=0,h=u.length;h>e;e++){var c=r.model.highlightSearch&&!r.noresult?r._highlightSuggestion(u[e]):u[e],w=d.clone(),l=g.clone();n(l).attr(r._isIE8?{unselectable:"on"}:{}).attr(u[e]!=u.length-1?{"class":"e-atc-tdbottom"}:{}).html(c);w[0].appendChild(l[0]);p[0].appendChild(w[0]);s.appendChild(p[0]);r.model.showEmptyResultText&&r.model.emptyResultText==c&&r.model.multiColumnSettings.showHeader&&r._tableHeaderDiv.css("display","none")&&n(l).removeClass("e-atc-tdbottom");r._addNewTemplate&&!t.isNullOrUndefined(r._tableHeaderDiv)&&r._tableHeaderDiv.css("display","none")}r._tableColumn[0].appendChild(s)}else{for(b=t.buildTag("li",{},{},{role:"option"}).attr(r._isIE8?{unselectable:"on"}:{}),e=0,h=u.length;h>e;e++)c=r.model.highlightSearch&&!r.noresult?r._highlightSuggestion(u[e]):u[e],a=b.clone(),a[0].innerHTML=c,s.appendChild(a[0]);r.ul[0].appendChild(s)}this._currList=u;this._mapper={txt:null,key:null}}else f=this.model.fields,o={_key:null,_text:null,_attr:null},o._key=f&&f.key?f.key:"key",o._text=f&&f.text?f.text:"text",o._attr=f&&f.htmlAttributes?f.htmlAttributes:"htmlAttributes",this._mapper={txt:o._text,key:o._key},this._currList=[],this.model.fields.groupBy?(k=f&&f.groupBy?f.groupBy:"groupBy",y=t.Query().group(k),this._addSortingQuery(y,"key"),v=t.DataManager(u).executeLocal(y),this._swapUnCategorized(v),v.forEach(function(n,i){if(n.key)if(r.model.multiColumnSettings.enable){var f=t.buildTag("tr.e-category").attr("role","option").attr(r._isIE8?{unselectable:"on"}:{});f.append(t.buildTag("td",n.key).attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}).attr(i!=u.length-1?{"class":"e-atc-tdbottom"}:{}));r._tableColumn.append(f)}else r.ul.append(t.buildTag("li.e-category",n.key).attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}));r._generateLi(n.items,o)})):this._generateLi(u,o);this._getLiTags().length>0&&this._showResult(i)},_swapUnCategorized:function(n){for(var t,r=n.length,i=0;i<r;i++)if(!n[i].key){for(t=i;t>0;t--)n[t]=n[t-1];return n[t]=n[i],!1}},_generateLi:function(i,r){var u=this,a=document.createDocumentFragment(),y=document.createDocumentFragment(),p,w,b,k,h,e,c,f,v,o,s,l;if(u.model.multiColumnSettings.enable){for(p=u.model.multiColumnSettings.columns.length,this._tableColumn.append(t.buildTag("tbody")),w=t.buildTag("tr"),b=t.buildTag("td"),f=0,v=i.length;v>f;f++)if(o=i[f][r._text],s=i[f][r._key],!t.isNullOrUndefined(o)||u.model.multiColumnSettings.enable){for(k=u._getField(i[f]),h=w.clone(),h[0].className=f%2?"e-atc-trbgcolor":"",e=0;e<p;e++)c=b.clone(),c[0].innerHTML=u.model.highlightSearch&&n.inArray(e.toString(),u._columnIndex)>-1?u._highlightSuggestion(u._getField(i[f],u.model.multiColumnSettings.columns[e].field).toString()):u._getField(i[f],u.model.multiColumnSettings.columns[e].field),c[0].className=(f!=i.length-1?"e-atc-tdbottom ":"")+(e!=u.model.multiColumnSettings.columns.length-1?u.model.enableRTL?"e-atc-tdleft ":"e-atc-tdright ":"")+(u.model.multiColumnSettings.columns[e].cssClass?u.model.multiColumnSettings.columns[e].cssClass:""),c[0].style.textAlign=u.model.multiColumnSettings.columns[e].textAlign?u.model.multiColumnSettings.columns[e].textAlign:"left",y.appendChild(c[0]);h[0].appendChild(y);s&&h.attr("id",s);u._setAttributes(u._getField(i[f],r._attr),h[0]);a.appendChild(h[0]);u._currList=u._currList.concat([i[f]])}n(u._tableColumn).find("tbody")[0].appendChild(a)}else{for(f=0,v=i.length;v>f;f++)o=i[f][r._text],s=i[f][r._key],t.isNullOrUndefined(o)||(u.model.highlightSearch&&(o=u._highlightSuggestion(o)),u.model.template&&(o=u._getTemplatedString(i[f],r._text,o)),l=document.createElement("li"),l.innerHTML+=o,s&&l.setAttribute("id",s),u._setAttributes(u._getField(i[f],r._attr),l),a.appendChild(l),u._currList=u._currList.concat([i[f]]));u.ul[0].appendChild(a)}},_getLiTags:function(){return this.model.multiColumnSettings.enable?this._tableColumn.find("tbody tr:not('.e-category')"):this.ul.children("li:not('.e-category')")},_getTemplatedString:function(n,t,i){for(var r=this.model.template,f=r.indexOf("${"),e=r.indexOf("}");f!=-1&&e!=-1;){var o=r.substring(f,e+1),s=o.replace("${","").replace("}",""),u=this._getField(n,s);t==s&&(u=i);u||(u="");r=r.split(o).join(u);f=r.indexOf("${");e=r.indexOf("}")}return r},_getField:function(n,i){return t.pvt.getObject(i,n)},_setAttributes:function(t,i){if(t){typeof t=="string"&&(t=n.parseJSON(t));for(var r in t)i.setAttribute(r,t[r])}},_setListWidth:function(){var n=this.model.popupWidth;n&&n!="auto"?this.suggestionList.css({width:n}):this.suggestionList.css({width:this.wrapper.width()})},_setListHeight:function(){this.suggestionList.css({"max-height":this.model.popupHeight})},_refreshPopup:function(){this.model.popupWidth=="auto"&&this.wrapper.outerWidth()!=this.suggestionList.outerWidth()&&(this.suggestionList.css({width:this.wrapper.width()}),this._refreshScroller());this._setListPosition()},_showResult:function(r){var u,e,o,f;if(this._refreshScroller(),this._refreshPopup(),this._isOpened)n(document).on("mousedown",n.proxy(this._OnDocumentClick,this));else this.suggestionList.css("display","none"),u=this,clearTimeout(this._typing),this._typing=setTimeout(function(){u.suggestionList[u.model.animateType=="slide"?"slideDown":"fadeIn"](u.model.animateType=="none"?0:300,function(){n(document).on("mousedown",n.proxy(u._OnDocumentClick,u))})},this.model.delaySuggestionTimeout),e=r!=i?{event:r,isInteraction:!0}:{isInteraction:!1},this._trigger("open",e),this.wrapper.addClass("e-active");this._isOpened=!0;this.showSuggestionBox=!0;o=this._getLiTags();this._listSize=o.length;n(window).on("resize",n.proxy(this._OnWindowResize,this));f=t.getScrollableParents(this.wrapper);f[0]!=window&&this._on(f,"scroll",this._hideResult)},_hideResult:function(r){var u,f;this.showSuggestionBox&&(this.showSuggestionBox=!1,this._activeItem=0,clearTimeout(this._hiding),this.element.attr("aria-expanded",!1),u=this,this._isOpened?(this.suggestionList.css("display","none"),f=r!=i?{event:r,isInteraction:!0}:{isInteraction:!1},this._trigger("close",f)):this._hiding=setTimeout(function(){u.model&&u.suggestionList[u.model.animateType=="slide"?"slideUp":"fadeOut"](u.model.animateType=="none"?0:100);u._activeItem=0},this.model.delaySuggestionTimeout),n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this.wrapper.removeClass("e-active"))},_refreshScroller:function(){this.suggestionList.css("height","auto");this.suggestionList.find(".e-content , .e-scroller").removeAttr("style");this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&(n(this._tableColumn).attr("width","auto"),n(this._tableHeader).attr("width","auto"));this.suggestionList.css("display","block");this.model.multiColumnSettings.enable&&(this.scrollerObj.option("height","auto"),this._columnBorderAlign());var i=this.suggestionList.height()>parseInt(n.isNumeric(this.model.popupHeight)?this.model.popupHeight:this.model.popupHeight.replace("px",""))-4;i||this.model.multiColumnSettings.enable&&(this.suggestionList.height()<=this._tableColumn.height()||this.suggestionList.width()<=this._tableColumn.width()||this.model.multiColumnSettings.showHeader&&this.suggestionList.width()<=this._tableHeader.width())?(i&&(this.scrollerObj.model.height=this.model.multiColumnSettings.showHeader&&this._tableHeader?parseInt(this.suggestionList.height())-parseInt(this._tableHeader.height()):this.suggestionList.height()),!this.model.multiColumnSettings.enable&&this.suggestionList.width()<this.suggestionList.find(".e-ul").width()&&this.suggestionList.find(".e-ul").width(this.suggestionList.find(".e-ul").width()),this.scrollerObj.model.width=this.suggestionList.width(),this.scrollerObj.refresh(),this.scrollerObj.option({enableRTL:this.model.enableRTL,scrollTop:0,scrollLeft:0}),this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._addThBorder(),this.suggestionList.addClass("e-scroller"),!this.scrollerObj._vScroll&&this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._removeThBorder()):(this.suggestionList.removeClass("e-scroller"),this.scrollerObj.refresh(),this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._removeThBorder());this.suggestionList.css("height","auto");this._isIE8&&this.suggestionList.find(".e-vscroll div, .e-hscroll div").attr("unselectable","on");this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&(this.suggestionList.find(".e-content").scroll(t.proxy(function(t){this._tableHeader.parent(".e-atc-tableHeaderContent").scrollLeft(n(t.currentTarget).scrollLeft())},this)),this.suggestionList.find(".e-content").length>0&&this._tableHeader.parent(".e-atc-tableHeaderContent").scrollLeft(this.model.enableRTL?this.suggestionList.find(".e-content")[0].scrollWidth-this.suggestionList.find(".e-content")[0].clientWidth:0))},_columnBorderAlign:function(){var i,t,r;if(this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv.css("display")!="none"){for(this._tableWid=this._tableHeader.outerWidth()>this._tableColumn.outerWidth()?this._tableHeader.outerWidth():this._tableColumn.outerWidth(),this._tableColumn.find("colgroup").remove(),n(this._headerColGroup.children).removeAttr("style"),t=0,r=this._headerColGroup.children.length;t<r;t++)n(this._headerColGroup.children[t]).css({width:parseInt(n(this._tableColumn).find("tr:first td").eq(t).outerWidth())>parseInt(this._tableHeader.find("tr:first th").eq(t).outerWidth())?n(this._tableColumn).find("tr:first td").eq(t).outerWidth():this._tableHeader.find("tr:first th").eq(t).outerWidth()});this._tableColumn.append(n(this._headerColGroup).clone());i=this._tableWid>this.suggestionList.width()?this._tableWid:"100%";n(this._tableColumn).attr("width",i);n(this._tableHeader).attr("width",i)}else if(this.model.multiColumnSettings.enable&&!this.model.multiColumnSettings.showHeader){if(n(this._tableColumn).attr("width","auto"),this._tableWid=this._tableColumn.outerWidth(),n(this._headerColGroup.children).removeAttr("style"),i=this._tableWid>this.suggestionList.width()?this._tableWid:"100%",i!="100%"){for(t=0,r=this._headerColGroup.children.length;t<r;t++)n(this._headerColGroup.children[t]).css({width:n(this._tableColumn).find("tr:first td").eq(t).outerWidth()});this._tableColumn.append(this._headerColGroup)}n(this._tableColumn).attr("width",i)}else n(this._tableColumn).attr("width","100%")},_removeThBorder:function(){this._tableHeader.parents(".e-atc-tableHeader").removeClass(this.model.enableRTL?"e-atc-tableHeaderRTL":"e-atc-tableHeaderScroll");this._tableHeader.parent(".e-atc-tableHeaderContent").removeClass("e-atc-tableHeaderBorder")},_addThBorder:function(){this._tableHeader.parents(".e-atc-tableHeader").addClass(this.model.enableRTL?"e-atc-tableHeaderRTL":"e-atc-tableHeaderScroll").removeClass(this.model.enableRTL?"e-atc-tableHeaderScroll":"e-atc-tableHeaderRTL");this._tableHeader.parent(".e-atc-tableHeaderContent").addClass("e-atc-tableHeaderBorder")},_setListPosition:function(){var t=this.wrapper,i=this._getOffset(t),f,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),u=this.suggestionList.outerHeight(),e=this.suggestionList.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(u<h||u>c?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e<r+t.outerWidth())&&(r-=this.suggestionList.outerWidth()-t.outerWidth());this.suggestionList.css({left:r+"px",top:v+"px","z-index":a})},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.suggestionList)},_targetFocus:function(n){this.model.multiSelectMode=="visualmode"&&this._setWatermarkWidth(30);this._isWatermark||this._hiddenSpan.css("display","none");this.wrapper.addClass("e-focus");this._focusValue=this.model.value;this._isFocused=!0;this._trigger("focusIn",{event:n,isInteraction:!0,value:this.value()})},_focusOutAction:function(n){var u=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val(),i,r;if(this._isFocused=!1,this.wrapper.removeClass("e-focus"),this._focusValue!=this.model.value)this._changeEvtTrigger(u,n);else return!1;this.model.showPopupButton&&this.dropdownbutton.removeClass("e-active");this._isWatermark||this._setWatermarkTxt();this._removeSelection();this.model.multiSelectMode=="visualmode"&&this.model.showResetIcon&&this.element.val()!=""&&this._removeReset();this.model.multiSelectMode=="visualmode"?(this._removeActive(),this.element.val(""),this._setWatermarkWidth(1),this._preVal="",this._addNewTemplate=null):(this.model.multiSelectMode=="delimiter"&&this._valueChange(n),this._updateSelectedItemArray(this.getValue()));t.isNullOrUndefined(this.value())||this.value()==""||(i=this.value().split(this.model.delimiterChar),(this.model.multiSelectMode=="delimiter"||this.model.multiSelectMode=="none")&&(r=this._removeDuplicateVal(i),this._keyProcess(r)));this.element.val()==""&&(this.value()==""||this.value()==null)&&this._selectValueByKey(null)},_targetBlur:function(n){this._focusOutAction(n);this._trigger("focusOut",{event:n,isInteraction:!0,value:this.value()})},_setWatermarkWidth:function(n){this.model.watermarkText&&this.element.attr("placeholder")?this.element.width(""):this.element.val("").width(n)},_checkDeli:function(){var n=this.element.val(),t=this.model.delimiterChar,i=n.substr(n.length-t.length,n.length);return i==t?(this.element.val(n.substr(0,n.length-t.length)),!0):!1},_removeSelection:function(){if(this.model.enableAutoFill){this.element.attr("aria-autocomplete","both");var n=this._getCaretSelection();n.end-n.start!=0&&n.end-n.start!=this.element.val().length&&(this.target.value=this.target.value.substr(0,n.start))}},_removeListHover:function(){this._getLiTags().removeClass("e-hover")},_addListHover:function(){var t=n(this._getLiTags()[this._activeItem-1]);t.addClass("e-hover");this.scrollerObj.setModel({scrollTop:this._calcScrollTop()});t.focus()},_calcScrollTop:function(){var r=this.model.multiColumnSettings.enable?this.model.multiColumnSettings.showHeader?this._tableColumn.outerHeight()+this._tableHeader.outerHeight():this._tableColumn.outerHeight():this.ul.outerHeight(),t=this.model.multiColumnSettings.enable?this._tableColumn.find("tr"):this.ul.find("li"),i=0,n;return n=this.model.multiColumnSettings.enable?this._tableColumn.find("tr.e-hover").index():this.ul.find("li.e-hover").index(),i=t.eq(1).outerHeight()*n,i-((this.model.multiColumnSettings.enable?this._tableColumn.parent().outerHeight():this.suggestionList.outerHeight())-t.eq(n).outerHeight())/2},getActiveText:function(){if(this._activeItem>0)return this.model.multiColumnSettings.enable?this._textFormateString(this._currList[this._activeItem-1]):!t.isNullOrUndefined(this._mapper)&&this._mapper.txt?this._getField(this._currList[this._activeItem-1],this._mapper.txt):this._currList[this._activeItem-1]},_getUniqueKey:function(){var n=null;return t.isNullOrUndefined(this._mapper)||(this._mapper.key&&(n=this._getField(this._currList[this._activeItem-1],this._mapper.key)),t.isNullOrUndefined(n)&&(n=null)),n},_setTextBoxValue:function(){var t,f,i,e,r,u;this._activeItem&&!this.noresult&&(t=this.model.multiColumnSettings.enable?this._textFormateString(this._currList[this._activeItem-1]):this.getActiveText(),f=this._getCaretSelection(),this.suggLen=f.start,i=this.target.value.substr(0,this.suggLen),r=this.target.value.lastIndexOf(this.model.delimiterChar),u=r==-1?n.trim(i.substr(r+1,this.suggLen)):n.trim(i.substr(r+this.model.delimiterChar.length,this.suggLen)),i&&(i.toLowerCase()==t.substr(0,this.suggLen).toLowerCase()||u.toLowerCase()==t.substr(0,this.suggLen-(r+this.model.delimiterChar.length)).toLowerCase())?(e=this.model.multiSelectMode=="delimiter"?i+t.substr(u.length,t.length):i+t.substr(i.length,t.length),this.element.val(e),this._autofilSelection(),this.model.multiSelectMode=="visualmode"&&(this._adjustWidth(),this.model.enableAutoFill&&this._refreshPopup()),this.model.autoFocus&&!this.noresult&&this._addListHover()):(this.model.multiSelectMode=="delimiter"&&t&&u?this.element.val(this.element.val().replace(u,t)):t&&this.element.val(t),this._removeSelection()))},_enterTextBoxValue:function(n){var t,i,r;!this._activeItem||this.noresult||this.model.readOnly||(t=this.getActiveText(),i=this._currList[this._activeItem-1],this._preVal=t+(this.model.multiSelectMode=="delimiter"?this.model.delimiterChar:""),this._valueToTextBox(t,i,!1),r=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val()==""?null:this.element.val(),this._trigger("select",{event:n,isInteraction:!0,value:r,text:t,key:this._getUniqueKey(),item:i}),this._valueChange(n),this.model.showResetIcon&&this._showReset());this._isOpened&&this._trigger("close",{event:n,isInteraction:!0})},_createBox:function(i){var r=t.buildTag("span.e-icon e-close"),u=t.buildTag("li.e-options",i).append(r);return this._on(r,"click",function(t){if(!this.model.enabled)return!1;this._deleteBox(n(t.target).parent())}),u},_addLoadingClass:function(){this.model.showLoadingIcon&&this.element.addClass("e-load")},_removeLoadingClass:function(){this.element.removeClass("e-load")},_highlightSuggestion:function(t){var o,s,u,e,f,i,h,r,c;if(n.trim(this._queryString)!=""&&(o=this.model.caseSensitiveSearch?"g":"gi",i=n.trim(this._queryString),i=/^[a-zA-Z0-9- ]*$/.test(i)?i:i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),s=this.model.filterType=="startswith"?"^"+i:this.model.filterType=="endswith"?i+"$":i,u=new RegExp(s,o),u.test(t)))for(e=t.match(u),h=t.replace(u,"~^"),f=h.split("~^"),t="",r=0,c=f.length;c>r;r++)t+=e[r]?f[r]+"<span class='e-hilight-txt'>"+e[r]+"<\/span>":f[r];return t},_RightToLeft:function(n){n?(this.wrapper.addClass("e-rtl"),this.suggestionList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.suggestionList.removeClass("e-rtl"));this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&(this._tableHeaderDiv.removeClass(n?"e-atc-tableHeaderRTL":"e-atc-tableHeaderScroll"),this._tableHeader.find("tr :not(th:last)").addClass(n?"e-atc-thleft":"e-atc-thright").removeClass(n?"e-atc-thright":"e-atc-thleft"))},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.suggestionList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.suggestionList.removeClass("e-corner"))},_checkReadOnly:function(n){this.model.readOnly=n;this.model.readOnly?(this.element.attr({readonly:"readonly","aria-readonly":!0}),this._off(this.element,"keydown",this._OnKeyDown),this._off(this.element,"keyup",this._OnKeyUp),this._off(this.element,"paste",this._OnPaste),this._off(this.element,"keypress",this._onkeyPress)):(this.element.removeAttr("readonly aria-readonly"),this._on(this.element,"keydown",this._OnKeyDown),this._on(this.element,"keyup",this._OnKeyUp),this._on(this.element,"paste",this._OnPaste),this._on(this.element,"keypress",this._onkeyPress))},_onkeyPress:function(n){n.keyCode==13&&this._PreventDefaultAction(n)},_OnPaste:function(n){var t=this;setTimeout(function(){t._OnKeyUp(n)},0)},_OnKeyDown:function(t){var f;this.model.filterType!="startswith"&&(this.model.enableAutoFill=!1);switch(t.keyCode){case 37:case 35:case 36:this._removeSelection();break;case 38:this.showSuggestionBox&&this.suggestionList&&(this._removeListHover(),this._activeItem>1?this._activeItem-=1:this._activeItem=this._listSize,this._navigationHover());this._PreventDefaultAction(t);break;case 40:this.showSuggestionBox&&this.suggestionList?(this._removeListHover(),this._activeItem<this._listSize?this._activeItem+=1:this._activeItem=1,this._navigationHover()):t.ctrlKey&&this.element.val()==""?this._showFullList(t):t.ctrlKey&&this._showSuggestionList(t);this._PreventDefaultAction(t);break;case 33:case 34:if(this.showSuggestionBox&&this.suggestionList){this._removeListHover();var i=this.model.multiColumnSettings.enable?this._tableColumn.parent().height():this.suggestionList.height(),r=this.model.multiColumnSettings.enable?this._tableColumn.find("tr").outerHeight():this.ul.children("li").outerHeight(),u=Math.round(i/r)!=0?Math.round(i/r):this._listSize;this._activeItem=t.keyCode==33?this._activeItem-u:this._activeItem+u;this._activeItem<1&&(this._activeItem=1);this._activeItem>this._listSize&&(this._activeItem=this._listSize);this._navigationHover()}this._PreventDefaultAction(t);break;case 8:n.trim(this.element.val())==""&&(this._isOpened=!1);this.model.multiSelectMode=="visualmode"&&this.element.val()==""&&this._deleteLastBox();break;case 17:this.ctrlKeyPressed=!0;break;case 9:this.showSuggestionBox&&(this._queryString=this.element.val(),this._enterTextBoxValue(t),this._hideResult(t),this._isOpened=!1,this._PreventDefaultAction(t));break;case 27:this._isOpened=!1;f=this.showSuggestionBox;this._hideResult(t);this._PreventDefaultAction(t);f&&this._trigger("close",{event:t,isInteraction:!0})}this.model.multiSelectMode=="visualmode"&&(t.keyCode!=17&&t.keyCode!=8&&t.keyCode!=46&&this._removeActive(),this._adjustWidth())},_PreventDefaultAction:function(n){n.preventDefault();this._cancelEvent||(n.stopPropagation(),n.cancelBubble=!0,n.returnValue=!0)},_bubbleEvent:function(n){return typeof n=="boolean"&&(this._cancelEvent=n),this._cancelEvent},_navigationHover:function(){this._addListHover();this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this._queryString=this.target.value,this._setTextBoxValue())},_OnKeyUp:function(t){if(this._keyDownComplete(t),this.ctrlKeyPressed&&t.type!="paste")return t.keyCode==17&&(this.ctrlKeyPressed=!1),!1;if(n.trim(this.element.val())==""&&t.keyCode==38&&t.keyCode==40)return this._hideResult(t),!1;if(!this._checkDelimiter())return!1;this._queryString=n.trim(this._queryString);switch(t.keyCode){case 34:case 33:case 38:case 40:case 37:case 39:case 20:case 16:case 17:case 18:case 35:case 36:case 144:case 9:case 27:break;case 13:t.preventDefault();this._queryString=this.element.val();this._enterTextBoxValue(t);this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this.suggLen=this.element.val().length,this._autofilSelection());this._isOpened=!1;this._hideResult(t);break;case 46:if(this.model.multiSelectMode=="visualmode"&&this.element.val()==""){this._deleteBox(this._ulBox.children("li.e-active"));break}case 8:this._queryString.length>=this.model.minCharacter?(this._autoFill=!1,this._OnTextEnter(t)):(this.noresult=!0,this._hideResult(t),n.trim(this.element.val())==""&&(this._isOpened=!1));this._typed=!0;break;default:this._queryString.length>=this.model.minCharacter?(this._autoFill=!0,this._OnTextEnter(t)):this.noresult=!0;this._typed=!0}},_getFilteredList:function(n,i){var u,r;clearTimeout(this.timeDelay);t.isNullOrUndefined(n)||typeof n[0]!="object"||(u=this.model.fields.text?this.model.fields.text:"text",this.model.actionFailure&&t.isNullOrUndefined(t.DataManager(n).executeLocal(t.Query().select(u))[0])&&this._trigger("actionFailure",{error:this._localizedLabels.actionFailure}));!n||!n.length||n.length<1?(this.suggestionListItems=[],this.model.actionFailure&&this._trigger("actionFailure",{error:this._localizedLabels.actionFailure})):(r=t.Query(),this._addQuery(r,typeof n[0]=="object"),this.suggestionListItems=t.DataManager(n).executeLocal(r),this.model.actionSuccess&&this._trigger("actionSuccess"));this._doneRemaining(i);this.model.actionComplete&&this._trigger("actionComplete")},_performSearch:function(n){var i,r;this.model.actionBegin&&this._trigger("actionBegin");i=this.model.dataSource;t.DataManager&&i instanceof t.DataManager?i.dataSource.offline||i.dataSource.json&&i.dataSource.json.length>0?(this._getFilteredList(i.dataSource.json,n),this._selectedObj.push(i.dataSource.json)):(window.clearTimeout(this.timer),r=this,this.timer=window.setTimeout(function(){r._fetchRemoteDat(i)},700)):this._getFilteredList(i,n)},_fetchRemoteDat:function(n){var t=this,i,r=this._getQuery();this._addQuery(r,!0);i=n.executeQuery(r);i.fail(function(n){t.suggestionListItems=null;t._removeLoadingClass();t._trigger("actionFailure",n)}).done(function(n){t.suggestionListItems=n.result;t.model.multiSelectMode=="none"?t._selectedObj=n.result:t.model.multiSelectMode=="delimiter"&&(t._selectedObj=t._selectedObj.concat(n.result));t._doneRemaining(n);t._trigger("actionSuccess",n)}).always(function(n){t._trigger("actionComplete",n)})},_addSortingQuery:function(n,t){if(this.model.allowSorting){var i=this.model.sortOrder=="descending"?!0:!1;n.sortBy(t,i)}},_addQuery:function(n,i){var u="",f,o,e,s,r;if(i&&(e=this.model.fields,u=e&&e.text?e.text:"text"),this._queryString)if(this.model.multiColumnSettings.enable)if(this._columnsIndex(),i){for(u=[],r=0,s=this._columnIndex.length;r<s;r++)u.push(this.model.multiColumnSettings.columns[this._columnIndex[r]].field),f=this._predicateConvertion(f,this.model.multiColumnSettings.columns[this._columnIndex[r]].field,this.model.multiColumnSettings.columns[this._columnIndex[r]].filterType?this.model.multiColumnSettings.columns[this._columnIndex[r]].filterType:this.model.filterType,this._queryString,!this.model.caseSensitiveSearch,this.model.multiColumnSettings.columns[this._columnIndex[r]].type?this.model.multiColumnSettings.columns[this._columnIndex[r]].type:"string");for(r=0;r<n.queries.length;r++)n.queries[r].fn=="onWhere"&&(o=n.queries.slice(r)[0].e);t.isNullOrUndefined(o)?n.where(f):n.where(o.and(f))}else n.where(u,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch);else n.where(u,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch);this._addSortingQuery(n,u)},_predicateConvertion:function(n,r,u,f,e,o){var s;return o=="number"?s=Number(f):o=="boolean"?f=="true"||f=="yes"||f=="1"?s=!0:(f=="false"||f=="no"||f=="0")&&(s=!1):s=o=="date"?new Date(f):f,o=="number"&&isNaN(s)||o=="boolean"&&s==i?n:n!=i?n.or(r,u,s,e):t.Predicate(r,u,s,e)},_getQuery:function(){var r;if(t.isNullOrUndefined(this.model.query)){var u=[],i=t.Query(),n=this.model.fields;for(r in n)r!=="tableName"&&n[r]&&u.push(n[r]);u.length>0&&i.select(u);t.isNullOrUndefined(this.model.dataSource.dataSource.url)||this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query.clone();return i},_OnTextEnter:function(n){var i=this;t.isDevice()?(clearTimeout(this.timeDelay),this.timeDelay=setTimeout(function(){i._onTextProcess(n)},i.model.delaySuggestionTimeout)):i._onTextProcess(n)},_onTextProcess:function(n){this._addLoadingClass();this.element.attr("aria-expanded",!1);this._performSearch(n);this.model.showResetIcon&&this._showReset()},_showReset:function(){t.isNullOrUndefined(this.resetSpan)&&(this.resetSpan=t.buildTag("span.e-icon e-iclose"),this.model.showPopupButton?(this.dropdownbutton.before(this.resetSpan),this.container.addClass("e-popup e-reset")):this.container.append(this.resetSpan).addClass("e-reset"));this._on(this.resetSpan,"mousedown",this._refreshSearch)},_refreshSearch:function(){this.resetSpan=null;this.clearText();this._refreshPopup()},_removeReset:function(){this.resetSpan=this.resetSpan&&this.resetSpan[0].remove();this._refreshPopup()},_doneRemaining:function(n){this._showSuggestionList(n);this.element.attr({"aria-expanded":!0,"aria-haspopup":!0});(this.model.enableAutoFill&&this._autoFill&&!this.noresult||this.model.autoFocus)&&(this.element.attr("aria-autocomplete","both"),this._activeItem=1,this._queryString=this.target.value);this.model.enableAutoFill&&this._autoFill&&!this.noresult&&this._setTextBoxValue();this.model.autoFocus&&!this.noresult&&this._addListHover();this._removeLoadingClass();this.noresult&&!this.model.showEmptyResultText&&this._hideResult(n)},_removeRepeated:function(){var r=this.suggestionListItems,i,e,u,n,f;if(!r||r.length==0||this._selectedItems.length==0||this.suggestionListItems.length==1&&this.suggestionListItems[0]==this.element.val()+this._addNewTemplate)return!1;for(this._repeatRemove=!1,i=0,e=this._selectedItems.length;i<e;i++)t.DataManager&&this.model.dataSource instanceof t.DataManager?(n=this,f=0,r.forEach(function(r){(t.isNullOrUndefined(r[n.model.fields.text])?!0&&!t.isNullOrUndefined(r[n.model.fields.key])?r[n.model.fields.key]==n._selectedItems[i][n.model.fields.key]:!0&&!t.isNullOrUndefined(r[n.model.fields.htmlAttributes])?r[n.model.fields.htmlAttributes]==n._selectedItems[i][n.model.fields.htmlAttributes]:!0&&!t.isNullOrUndefined(r[n.model.fields.groupBy])?r[n.model.fields.groupBy]==n._selectedItems[i][n.model.fields.groupBy]:!0:r[n.model.fields.text]==n._selectedItems[i][n.model.fields.text])&&(u=f);f++})):u=r.indexOf(this._selectedItems[i]),u!=-1&&this.suggestionListItems.splice(u,1),this.element.val()==this._selectedItems[i]&&(this._repeatRemove=!0)},_checkDelimiter:function(){this._queryString=this.element.val();var n=this.model.multiSelectMode!="delimiter"?-1:this._queryString.lastIndexOf(this.model.delimiterChar);return n==-1?!0:(this._queryString=this._queryString.substr(n+this.model.delimiterChar.length,this._queryString.length),!0)},_autofilSelection:function(){var n=this.element[0],t=this.element.val().length;n.setSelectionRange?n.setSelectionRange(this.suggLen,t):n.createTextRange&&(n=n.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",this.suggLen),n.select())},_OnDropdownClick:function(n){this.model.enabled&&!this.model.readOnly&&(n.preventDefault(),this.dropdownbutton.addClass("e-active"),this._iconEventBind(this.dropdownbutton,"span"),(n.which&&n.which==1||n.button&&n.button==0)&&(this._addLoadingClass(),this.showSuggestionBox?(this._hideResult(n),this._isOpened=!1,this._removeLoadingClass()):this._showFullList(n)))},_iconEventBind:function(t,i){t.on({mouseleave:n.proxy(this._OnMouseIconClick,this)},i)},_OnMouseIconClick:function(){this.dropdownbutton.removeClass("e-active")},_showFullList:function(n){this._isFocused||this.element.focus();this._queryString=null;this._autoFill=!1;this._performSearch(n)},_OnMouseEnter:function(n){this._getActiveItemIndex(n);this.model.showPopupButton&&this.dropdownbutton.removeClass("e-active")},_getActiveItemIndex:function(t){var i=t.target;this.model.multiColumnSettings.enable&&t.target.tagName.toLowerCase()!="tr"?i=n(t.target).parents("tr"):t.target.tagName.toLowerCase()!="li"&&(i=n(t.target).parents("li"));this._getLiTags().removeClass("e-hover");n(i).addClass("e-hover");this._queryString=this.element.val();this._activeItem=this._getLiTags().index(n(i))+1},_OnMouseLeave:function(){this._getLiTags().removeClass("e-hover");this.model.showPopupButton&&this.dropdownbutton.removeClass("e-active");this.model.highlightSearch&&this._getLiTags().find(".e-hilight-txt").removeClass("e-hover")},_OnMouseClick:function(n){this._getActiveItemIndex(n);this.noresult||(this._enterTextBoxValue(n),this._isOpened=!1,this._hideResult(n))},_OnDocumentClick:function(t){n(t.target).is(this.suggestionList)||n(t.target).parents(".e-atc-popup").is(this.suggestionList)||n(t.target).is(this.element)||n(t.target).parents(".e-atc").is(this.wrapper)?(n(t.target).is(this.suggestionList)||n(t.target).parents(".e-atc-popup").is(this.suggestionList))&&t.preventDefault():(this._isOpened=!1,this._hideResult(t),this._trigger("close",{event:t,isInteraction:!0}))},_OnWindowResize:function(){this._refreshPopup()},_keyProcess:function(n){var r=this._declareVariable(),o=this,u,i,f,e;if(u=this._delimiterChar(),!t.isNullOrUndefined(n))for(i=0,f=n.length;i<f;i++)e=n[i],t.DataManager&&this.model.dataSource instanceof t.DataManager?o._selectValueByKey(null):(this._dataQuery=this.model.multiColumnSettings.enable?t.Query():t.Query().where(r[0],this.model.filterType,e,!1),this._promise=t.DataManager(this.model.dataSource).executeLocal(this._dataQuery),this.model.multiColumnSettings.enable?this._formatStringKey(n,r,u):this._promise instanceof Array&&this._promise.length==0?this._selectValueByKey()!=null?this._selectValueByKey():null:this._getFieldKey(this._promise[0],r[1],u))},_formatStringKey:function(n,t,i){var r,e,o,f,u,s;for(this._selectValueByKey(null),r=0,e=n.length;r<e;r++)if(n[r]!=""){for(o=n[r],u=0,s=this._promise.length;u<s;u++)o==this._textFormateString(this._promise[u])&&(f=u);f?this._getFieldKey(this._promise[f],t[1],i):this._selectValueByKey()!=null?this._selectValueByKey():null}},_getFieldKey:function(i,r,u){if((t.isNullOrUndefined(this.model.template)||!t.isNullOrUndefined(this._getField(i,r)))&&!t.isNullOrUndefined(this._getField(i,r))){if(f=this._getField(i,r).toString(),this.model.multiSelectMode!="none"){var e,o,f=this._selectValueByKey();delimiterChar=this.model.delimiterChar;e=this._getField(i,r).toString();f!=null?(o=f.toString().split(u).filter(function(n){return n!==""}),n.inArray(e,o)==-1?(o.push(e),f=o.join(delimiterChar)+delimiterChar):f=e+delimiterChar):f=e+delimiterChar}this._selectValueByKey(f)}},_removeDuplicateVal:function(i){var r=[];return n.each(i,function(t,i){n.inArray(i,r)==-1&&r.push(i)}),i.length!=1||t.isNullOrUndefined(this._originalval)||n.inArray(i[0],this._originalval)==-1&&this._selectValueByKey(null),r},_valueChange:function(n){var t=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val();(this.value()!=t||t==""&&this.element.val()!="")&&(this.value(t),this._changeEvtTrigger(t,n));this.model.showResetIcon&&!t&&(this.wrapper.find("span.e-iclose").remove(),this.resetSpan=null)},_changeEvtTrigger:function(n,t){var r=t!=i?{event:t,isInteraction:!0,value:n}:{isInteraction:!1,value:n};this.initialRender||(this._trigger("_change",{value:n}),this._trigger("change",r))},_updateSelectedItemArray:function(i){var r=[],u,s,e,o,f;if(this._selectedItems=[],this.suggestionListItems=this.model.dataSource,this.model.multiSelectMode=="delimiter"&&i)if(r=i.split(this.model.delimiterChar),t.DataManager&&this.model.dataSource instanceof t.DataManager||!t.isNullOrUndefined(this.suggestionListItems)&&typeof this.suggestionListItems[0]!="object"){for(u=0,s=r.length;u<s;u++)if(r[u]){var o=this,h=this._selectedObj.length,f={};for(e=0;e<h;e++)this._selectedObj[e][o.model.fields.text]==r[u]&&(f=this._selectedObj[e],e=h);this._selectedItems.push(n.isEmptyObject(f)?r[u]:f)}}else this._createBoxForObjectType(r);else this.model.multiSelectMode=="none"&&i&&(r.push(i),t.DataManager&&this.model.dataSource instanceof t.DataManager||!t.isNullOrUndefined(this.suggestionListItems)&&typeof this.suggestionListItems[0]!="object"?(o=this,f=n.grep(this._selectedObj,function(n){if(n[o.model.fields.text]==i)return n}),this._selectedItems.push(f.length>0?f:i)):this._createBoxForObjectType(r))},_keyDownComplete:function(n){var t=this.element.val();this._preVal!=t&&(this._preVal=t,this.model.multiSelectMode=="visualmode"&&this._adjustWidth(),this._valueChange(n))},_moveCaretToEnd:function(n){var t,i;n.scrollLeft=n.scrollWidth;n.createTextRange&&(t=n.createTextRange(),t.moveEnd("textedit"),t.moveStart("textedit"),t.select());typeof n.selectionStart=="number"?n.selectionStart=n.selectionEnd=n.value.length:typeof n.createTextRange!="undefined"&&(i=n.createTextRange(),i.collapse(!1),i.select())},_getCaretSelection:function(){var n=this.element[0],u=0,f=0,e,t,i,r,o;return isNaN(n.selectionStart)?(e=document.selection.createRange().getBookmark(),t=n.createTextRange(),t.moveToBookmark(e),i=n.createTextRange(),i.collapse(!0),i.setEndPoint("EndToStart",t),r=i.text.length,o=t.text.length,{start:r,end:r+o}):(u=n.selectionStart,f=n.selectionEnd,{start:Math.abs(u),end:Math.abs(f)})},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_wireEvents:function(){this._on(this.element,"focus",this._targetFocus);this._on(this.element,"blur",this._targetBlur)}});t.Autocomplete.Locale=t.Autocomplete.Locale||{};t.Autocomplete.Locale["default"]=t.Autocomplete.Locale["en-US"]={addNewText:"Add New",emptyResultText:"No suggestions",actionFailure:"The specified field doesn't exist in given data source",watermarkText:""};t.filterType={StartsWith:"startswith",Contains:"contains",EndsWith:"endswith",LessThan:"lessthan",GreaterThan:"greaterthan",LessThanOrEqual:"lessthanorequal",GreaterThanOrEqual:"greaterthanorequal",Equal:"equal",NotEqual:"notequal"};t.SortOrder={Ascending:"ascending",Descending:"descending"};t.MultiSelectMode={None:"none",Delimiter:"delimiter",VisualMode:"visualmode"};t.Animation={None:"none",Slide:"slide",Fade:"fade"};t.Type={Number:"number",String:"string",Boolean:"boolean",Date:"date"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejDatePicker","ej.DatePicker",{element:null,_rootCss:"e-datepicker",model:null,validTags:["input","div","span"],_setFirst:!1,_addToPersist:["value"],_cancelValue:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{dayHeaderFormat:"min",showPopupButton:!0,enableAnimation:!0,showFooter:!0,displayInline:!1,htmlAttributes:{},dateFormat:"",watermarkText:"Select date",value:null,minDate:new Date("01/01/1900"),maxDate:new Date("12/31/2099"),startLevel:"month",depthLevel:"",cssClass:"",startDay:-1,stepMonths:1,locale:"en-US",showOtherMonths:!0,enableStrictMode:!1,enablePersistence:!1,enabled:!0,width:"",height:"",enableRTL:!1,showRoundedCorner:!1,headerFormat:"MMMM yyyy",buttonText:"Today",readOnly:!1,specialDates:null,fields:{date:"date",tooltip:"tooltip",iconClass:"iconClass",cssClass:"cssClass"},showTooltip:!0,showDisabledRange:!0,highlightSection:"none",highlightWeekend:!1,validationRules:null,validationMessage:null,validationMessages:null,allowEdit:!0,tooltipFormat:"ddd MMM dd yyyy",allowDrillDown:!0,blackoutDates:[],beforeDateCreate:null,open:null,close:null,select:null,change:null,focusIn:null,focusOut:null,beforeOpen:null,beforeClose:null,navigate:null,create:null,destroy:null},dataTypes:{startDay:"number",stepMonths:"number",showOtherMonths:"boolean",enableStrictMode:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",displayInline:"boolean",showPopupButton:"boolean",locale:"string",readOnly:"boolean",cssClass:"string",dateFormat:"string",watermarkText:"string",headerFormat:"string",buttonText:"string",specialDates:"data",showTooltip:"boolean",highlightSection:"enum",highlightWeekend:"boolean",enableAnimation:"boolean",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data",tooltipFormat:"string",allowEdit:"boolean",allowDrillDown:"boolean"},_renderPopup:function(){this.sfCalendar=t.buildTag("div.e-datepicker e-popup e-widget "+this.model.cssClass+" e-calendar "+(this.model.specialDates?this.model.specialDates[0][this._mapField._icon]?"e-icons ":"":""),"",{},{id:this._id?"e-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{}).insertBefore(this.element);this.model.displayInline&&!this.element.is("input")&&this.sfCalendar.addClass("e-inline");this.popup=this.sfCalendar;t.isTouchDevice()||this.sfCalendar.addClass("e-ntouch");this._setRestrictDateState(this.model.showDisabledRange);this._createCalender();this._setDisplayInline(this.model.displayInline);this._resizeCalender();this._setRTL(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner);this._wireCalendarEvents()},_setModel:function(i){var r,o;t.isNullOrUndefined(this.sfCalendar)&&this._renderPopup();var u=!1,f=!1,e=!1;for(r in i)switch(r){case"dayHeaderFormat":this.model.dayHeaderFormat=i[r];u=f=!0;break;case"showPopupButton":this._renderDateIcon(i[r],!0);break;case"displayInline":if(i[r]||this._bindDateButton(),this._setDisplayInline(i[r]),!this.model.allowEdit&&!i[r]&&this._isInputBox)this.element.on("mousedown",n.proxy(this._showDatePopUp,this));break;case"value":t.isPlainObject(i[r])&&(i[r]=null);t.isNullOrUndefined(i.minDate)&&t.isNullOrUndefined(i.maxDate)?(this._setDateValue(i[r]),this._specificFormat()&&(this._stopRefresh=!0),i[r]=this.model.value):this._updateDateValue(i[r]);e=u=f=!0;break;case"specialDates":this.model.specialDates=i[r];this._createSpecialDateObject();u=f=!0;break;case"fields":this.model.fields=i[r];this._mapField=this._getMapper();u=f=!0;break;case"showTooltip":this.model.showTooltip=i[r];u=f=!0;break;case"highlightWeekend":this.model.highlightWeekend=i[r];u=f=!0;break;case"highlightSection":this.model.highlightSection=i[r];u=f=!0;break;case"dateFormat":this.model.dateFormat=i[r];this._ensureValue();break;case"minDate":this._setMinDate(i[r]);i[r]=this.model.minDate;this._ensureValue();e=u=f=!0;break;case"maxDate":this._setMaxDate(i[r]);i[r]=this.model.maxDate;this._ensureValue();e=u=f=!0;break;case"locale":this.model.locale=i[r];this.model.startDay=t.isNullOrUndefined(this._options.startDay)&&this.model.startDay===this.culture.calendar.firstDay?-1:this._options.startDay===this.defaults.startDay?-1:this.model.startDay;this.model.dateFormat=t.isNullOrUndefined(this._options.dateFormat)&&this.model.dateFormat===this.culture.calendar.patterns.d?"":this.model.dateFormat;this._setCulture(i[r]);this.model.value&&this._setDateValue(this.model.value);i[r]=this.model.locale;u=f=!0;break;case"showOtherMonths":this.model.showOtherMonths=i[r];this._otherMonthsVisibility();break;case"enableStrictMode":this.model.enableStrictMode=i[r];e=u=f=!0;break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"readOnly":this.model.readOnly=i[r];this._disbleMaualInput();break;case"width":this._setWidth(i[r]);break;case"height":this._setHeight(i[r]);break;case"cssClass":this._setSkin(i[r]);break;case"enableRTL":this._setRTL(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enabled":i[r]?this.enable():this.disable();break;case"buttonText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.buttonText=this.model.buttonText=i[r];this._localizedLabels.buttonText=this.model.buttonText;this._setFooterText(i[r]);break;case"showFooter":this._enableFooter(i[r]);break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.watermarkText=this.model.watermarkText=i[r];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"startDay":o=i[r];(parseInt(i[r])<0||parseInt(i[r])>6)&&(i[r]=this.culture.calendar.firstDay,o=-1);this.model.startDay=i[r];t.isNullOrUndefined(this._options)&&(this._options={});this._options.startDay=o;u=f=!0;break;case"startLevel":this.model.startLevel=i[r];u=f=!0;break;case"headerFormat":this.model.headerFormat=i[r];u=f=!0;break;case"depthLevel":this.model.depthLevel=i[r];u=f=!0;break;case"htmlAttributes":this._addAttr(i[r]);break;case"allowEdit":this._changeEditable(i[r]);break;case"tooltipFormat":this.model.tooltipFormat=i[r];u=f=!0;break;case"allowDrillDown":this._allowQuickPick(i[r]);u=f=!0;break;case"showDisabledRange":this._setRestrictDateState(i[r]);break;case"blackoutDates":this.model.blackoutDates=i[r];this._initDisableObj(this.model.blackoutDates);u=f=!0}e&&(this._validateMinMaxDate(),i.value=this.model.value,i.maxDate=this.model.maxDate,i.minDate=this.model.minDate);this._setWaterMark();u&&(this.isValidState||this.model.displayInline)&&this._refreshDatepicker();f&&this._startLevel(this.model.startLevel);this._triggerChangeEvent();this._checkErrorClass()},observables:["value"],_destroy:function(){this.model.displayInline&&n(window).off("resize",n.proxy(this._OnWindowResize,this));this._isOpen&&this.hide();this.sfCalendar&&this.sfCalendar.remove();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove());this._cloneElement.removeClass("e-js e-input").removeClass(t.util.getNameSpace(this.sfType));this._cloneElement.insertAfter(this.element);this.element.remove()},_init:function(n){this._options=n;this._cloneElement=this.element.clone();this._dt_drilldown=!1;this._ISORegex();this._initDisableObj(this.model.blackoutDates);this.animation={open:{duration:200},close:{duration:100}};this._animating=!1;this._isInputBox=this._isInputBox();this._isSupport=document.createElement("input").placeholder==r?!1:!0;this._checkAttribute();this._setValues();this._createDatePicker();t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());n&&n.value!=r&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,i,u,f;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_checkAttribute:function(){for(var u=["min","max","readonly","disabled"],f=["minDate","maxDate","readOnly","enabled"],i,n,r=0;r<u.length;r++)i=this.element.attr(u[r]),n=f[r],t.isNullOrUndefined(i)||(t.isNullOrUndefined(this._options)?this.model[n]=n!="enabled"&&n!="readOnly"?new Date(i):n=="readOnly"?this.element.is("[readonly]"):!this.element.is("[disabled]"):t.isNullOrUndefined(this._options[n])&&(this.model[n]=n!="enabled"&&n!="readOnly"?new Date(i):n=="readOnly"?this.element.is("[readonly]"):!this.element.is("[disabled]")))},_updateDateValue:function(n){var t=this._checkDateObject(n);t!=null?(this.isValidState=!0,t==""?(this.element.val(""),this.model.value=null):(this.model.value=t,this._preTxtValue=this.element.val(this._formatter(this.model.value,this.model.dateFormat)))):(typeof t=="string"&&this.model.enableStrictMode?this.element.val(n):this.element.val(""),this.model.value=null,this.isValidState=this.element.val()==""?!0:!1);this._removeWatermark()},_ensureValue:function(){var n=this._parseDate(this.element.val(),this.model.dateFormat);this.model.value?this._setDateValue(this.model.value):n&&this._setDateValue(n)},_changeEditable:function(t){var i=t?"_on":"_off";if(this.element.is(":input")){if(t)this.model.readOnly||this.element.attr("readonly",!1),this.element.off("mousedown",n.proxy(this._showDatePopUp,this));else if(this.model.readOnly||this.element.attr("readonly","readonly"),!this.model.displayInline)this.element.on("mousedown",n.proxy(this._showDatePopUp,this));this[i](this.element,"blur",this._onFocusOut);this[i](this.element,"focus",this._onFocusIn);this[i](this.element,"keydown",this._onKeyDown)}},_allowQuickPick:function(t){n(".e-datepicker-headertext",this.sfCalendar)[t?"on":"off"]("click",n.proxy(this._forwardNavHandler,this))},_setRestrictDateState:function(n){var t=n?"addClass":"removeClass";this.sfCalendar[t]("e-dp-restrict-show")},_setValues:function(){this.Date=new Date;this._id=this.element[0].id;this.isValidState=!0;this._setCulture(this.model.locale);this._setMinDate(this.model.minDate);this._setMaxDate(this.model.maxDate);this._calendarDate=this._zeroTime(new Date);(this.model.startDay<0||this.model.startDay>6)&&(this.model.startDay=0);this.Date.firstDayOfWeek=this.model.startDay;this.Date.fullYearStart="20";this._showHeader=!0;t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value);this._validateMinMaxDate();this._dateValue=new Date(this._calendarDate.toString());this._isIE7=this._checkIE7();this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._isIE9=t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0"?!0:!1;this._getInternalEvents=!1;this._flag=!0;this._ejHLWeekEnd=!1;this._isOpen=!1;this._prevDate=null;this._preValue=null;this._isFocused=!1},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r.disable():u=="readOnly"&&n=="readOnly"?r.model.readOnly=!0:u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_createDatePicker:function(){this._createWrapper();this._wireEvents();this.model.displayInline&&this.show();this.model.enableRTL&&this._setRTL(!0);this.model.showRoundedCorner&&this._setRoundedCorner(!0)},_checkNameAttr:function(){!this.element.attr("name")&&this._isInputBox&&this.element.attr("name",this.element[0].id);this.model.displayInline&&!this._isInputBox&&this._hiddenInput.attr("name",this.element[0].id)},_createWrapper:function(){if(this._getMapper(),this.model.specialDates&&this._createSpecialDateObject(),this._isInputBox&&(this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0"}),this.wrapper=t.buildTag("span.e-datewidget e-widget "+this.model.cssClass),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.innerWrapper=t.buildTag("span.e-in-wrap e-box e-padding"),this.wrapper.append(this.innerWrapper).insertBefore(this.element),this.innerWrapper.append(this.element),this.dateIcon=t.buildTag("span.e-select#"+this._id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-icon e-calendar","",{},{"aria-label":"Select"}).attr(this._isIE8?{unselectable:"on"}:{})).insertAfter(this.element)),!this._isSupport||this.model.displayInline&&!this._isInputBox){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._isInputBox&&this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}this._checkNameAttr();this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this._setHeight(this.model.height);this._setWidth(this.model.width);this._id&&n("#e-"+this._id).remove();this._setDateValue(this.model.value);this._preValue=this._parseDate(this.element.val(),this.model.dateFormat);this._setWaterMark();this._dateValue=new Date(this._calendarDate.toString());this.model.displayInline?this._renderPopup():this._isInputBox&&this._renderDateIcon(this.model.showPopupButton,!1);this.model.readOnly&&this._disbleMaualInput();this.model.enabled?this.model.enabled&&n(this.element).hasClass("e-disable")&&this.enable():this.disable();this._layoutChanged();this._checkErrorClass();this._addAttr(this.model.htmlAttributes)},_isInputBox:function(){return this.element.is("input")&&(this.element.is("input[type=text]")||!this.element.attr("type"))},_renderDateIcon:function(n,t){t&&this.model.showPopupButton==n||(!n&&this.dateIcon?(this._bindInputEvent(),this.dateIcon.css("display","none"),this.innerWrapper.removeClass("e-padding")):(this.innerWrapper&&(this.innerWrapper.addClass("e-padding"),this.dateIcon.css("display","block")),this.model.displayInline||this._bindDateButton()),this.model.showPopupButton=n)},_resizeCalender:function(){this.model.dayHeaderFormat=="short"||this.model.dayHeaderFormat=="min"||this.model.dayHeaderFormat=="none"?this.sfCalendar.removeClass("e-headerlong"):this.model.dayHeaderFormat=="long"&&this.sfCalendar.addClass("e-headerlong")},_setWidth:function(n){n?this.wrapper?this.wrapper.width(n):this.element.width(n):this.model.width=this.wrapper?this.wrapper.outerWidth():this.element.width()},_setHeight:function(n){n?this.wrapper?this.wrapper.height(n):this.element.height(n):this.model.height=this.wrapper?this.wrapper.outerHeight():this.element.height();this._isIE7&&this.element.height(this.innerWrapper.height())},_setRTL:function(n){n?(this.wrapper&&this.wrapper.addClass("e-rtl"),this.sfCalendar&&this.sfCalendar.addClass("e-rtl")):(this.wrapper&&this.wrapper.removeClass("e-rtl"),this.sfCalendar&&this.sfCalendar.removeClass("e-rtl"))},_setRoundedCorner:function(n){n?(this.innerWrapper&&this.innerWrapper.addClass("e-corner"),this.sfCalendar&&this.sfCalendar.addClass("e-corner")):(this.innerWrapper&&this.innerWrapper.removeClass("e-corner"),this.sfCalendar&&this.sfCalendar.removeClass("e-corner"))},_refreshDatepicker:function(){var t,i;if(this._stopRefresh){this._stopRefresh=!1;return}t=this.element.val();i=this._specificFormat()&&this._formatter(this._preValue,this.model.dateFormat,this.model.locale)!=t?this._parseDate(t,!0):this._parseDate(t);i=this._validateYearValue(i);this._setDateValue(i);this._specificFormat()&&this._compareDate(this.model.value,this._calendarDate)&&this.element.val(t);n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._calendarDate,this.model.headerFormat));this._resizeCalender();this._dateValue=new Date(this._calendarDate.toString());this._hoverDate=this._calendarDate.getDate()-1;this._renderCalendar(this,this._dateValue);this._setFooterText(this._localizedLabels.buttonText);this._enableFooter(this.model.showFooter);this._layoutChanged()},_validateYearValue:function(n){if(n!=null){var i=t.preferredCulture(this.model.locale).calendars.standard.twoDigitYearMax;i=typeof i=="string"?(new Date).getFullYear()%100+parseInt(i,10):i;this._calendarDate.getFullYear()-n.getFullYear()==100&&this._calendarDate.getFullYear()>i&&n.setFullYear(this._calendarDate.getFullYear())}return n},_setFooterText:function(t){n(".e-footer-text",this.sfCalendar).html(t)},_setSkin:function(n){this.wrapper?(this.wrapper.removeClass(this.model.cssClass),this.wrapper.addClass(n)):(this.element.removeClass(this.model.cssClass),this.element.addClass(n));this.sfCalendar.removeClass(this.model.cssClass);this.sfCalendar.addClass(n)},_setDisplayInline:function(t){this.model.displayInline=t;t&&this._isInputBox?(this.sfCalendar.insertAfter(this.wrapper),this._setDatePickerPosition()):t?(this.element.append(this.sfCalendar),this._isSupport&&this._isInputBox||this._hiddenInput.css("display","none")):(this.sfCalendar.css("display","none"),n("body").append(this.sfCalendar),this._isOpen=!1);t&&(this.show(),this._off(this.dateIcon,"mousedown",this._showDatePopUp),this.element.off("mousedown",n.proxy(this._showDatePopUp,this)))},_disbleMaualInput:function(){this.model.readOnly?(n(this.element).attr("readonly","readonly"),this.model.displayInline||this.hide()):this.model.allowEdit&&n(this.element).prop("readonly",!1)},_checkDateObject:function(n,t){var t;if(n&&(typeof JSON!="object"||JSON.stringify(n)!=="{}"))n instanceof Date||(t=this._specificFormat()?this._parseDate(n,!0):this._parseDate(n,t),n=t?t:(t=this._checkJSONString(n))?t:null);else return null;return!isNaN(Date.parse(n))&&(this._dateValue=this._calendarDate=this._zeroTime(n),this._validateDate(n))?this._dateValue:null},_checkJSONString:function(n){if(isNaN(Date.parse(n))){if(this._extISORegex.exec(n)||this._basicISORegex.exec(n))return this._dateFromISO(n)}else{if(new Date(n).toJSON()===n||new Date(n).toDateString()===n||new Date(n).toGMTString()===n||new Date(n).toISOString()===n||new Date(n).toLocaleString()===n||new Date(n).toString()===n||new Date(n).toUTCString()===n)return new Date(n);if(typeof n=="string")return this._dateFromISO(n)}},_dateFromISO:function(n){var i=this._extISORegex.exec(n)||this._basicISORegex.exec(n),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e<this._dates.length;e++)if(this._dates[e][1].exec(i[1])){c=this._dates[e][0];break}if(i[3])for(o=0;o<this._times.length;o++)if(this._times[o][1].exec(i[3])){l=(i[2]||" ")+this._times[o][0];break}for(i[4]&&this._zeroRegex.exec(i[4])&&(a="Z"),v=c+l+a,f=v.match(this._tokens),t=[],u=0;u<f.length;u++)h=f[u],s=this._checkLiteral(f[u]),y=this._numberRegex[s?f[u].toLowerCase():h.length]||new RegExp("^\\d{1,"+h.length+"}"),r=n.match(y),r&&(n.substr(0,n.indexOf(r))>=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){return char=n.toLowerCase(),char=="t"||char=="z"||char==":"||char=="-"?!0:!1},_checkInstanceType:function(n){if(n=this._stringToObject(n),n)n instanceof Date||(n=this._parseDate(n));else return null;return isNaN(Date.parse(n))?null:this._zeroTime(n)},_stringToObject:function(n){if(typeof n=="string"){var i=t.parseDate(n,this.model.dateFormat,this.model.locale);n=i!=null?i:new Date(n)}return n},_validateMinMaxDate:function(){var n=!1,t=!1;this.model.maxDate<this.model.minDate&&(this.model.minDate=this.model.maxDate);this.model.enableStrictMode?this.model.value?this.model.value<this.model.minDate?(this._calendarDate=this.model.minDate,this.isValidState=!1,t=!0):this.model.value>this.model.maxDate?(this._calendarDate=this.model.maxDate,this.isValidState=!1,t=!0):this.isValidState=!0:this._calendarDate<this.model.minDate?this._calendarDate=this.model.minDate:this._calendarDate>this.model.maxDate&&(this._calendarDate=this.model.maxDate):(this.model.value?this.model.value<this.model.minDate?(this._calendarDate=this.model.value=this.model.minDate,n=!0):this.model.value>this.model.maxDate&&(this._calendarDate=this.model.value=this.model.maxDate,n=!0):(this.element.val(""),this._calendarDate<this.model.minDate?this._calendarDate=this.model.minDate:this._calendarDate>this.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0);n&&this.element.val(this._formatter(this.model.value,this.model.dateFormat));t&&this._getInternalEvents&&this._trigger("outOfRange")},_setCulture:function(n){this.culture=t.preferredCulture(n);this.culture&&(this.model.locale=this.culture.name=="en"?"en-US":this.culture.name,this.Date.dayNames=this.culture.calendar.days.names,this.Date.dayNamesMin=this.culture.calendar.days.namesShort,this.Date.abbrDayNames=this.culture.calendar.days.namesAbbr,this.Date.monthNames=this.culture.calendar.months.names,this.Date.abbrMonthNames=this.culture.calendar.months.namesAbbr,this.Date.format=this.culture.calendar.patterns.d,this.model.dateFormat==""&&(this.model.dateFormat=this.culture.calendar.patterns.d),this.model.startDay==-1&&(this.model.startDay=this.culture.calendar.firstDay));this._separator=this._getSeparator();this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText),t.isNullOrUndefined(this._options.buttonText)||(this._localizedLabels.buttonText=this._options.buttonText));this._localizedLabelToModel()},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_setDatePickerPosition:function(){if(!this.model.displayInline||this._isInputBox){var i=this.element.is("input")?this.wrapper:this.element,r=this._getOffset(i),o,s,l=n(document).scrollTop()+n(window).height()-(r.top+n(i).outerHeight()),a=r.top-n(document).scrollTop(),f=this.sfCalendar.outerHeight(),e=this.sfCalendar.outerWidth(),u=r.left,h=i.outerHeight(),p=(h-i.height())/2,v=this._getZindexPartial(),c=3,y=f<l||f>a?r.top+h+c:r.top-f-c;o=n(document).scrollLeft()+n(window).width()-u;s=n(document).scrollLeft()+u+i.width();(this.model.enableRTL||e>o&&e<u+i.outerWidth()&&!t.isNullOrUndefined(this.wrapper))&&(u+=this.wrapper.width()-this.sfCalendar.width());e>s&&(u=r.left);this.sfCalendar.css({left:u+"px",top:y+"px","z-index":v})}},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.sfCalendar)},_setMinDate:function(n){this.model.minDate=this._checkInstanceType(n);this.model.minDate||(this.model.minDate=new Date("11/31/1899"))},_setMaxDate:function(n){this.model.maxDate=this._checkInstanceType(n);this.model.maxDate||(this.model.maxDate=new Date("12/31/2099"))},_setDateValue:function(n,i){var r=this._checkDateObject(n,i);r!=null?(this.isValidState=!0,this.model.value=new Date(r.toString()),this.model.displayInline||this.wrapper.addClass("e-valid"),this._validateMinMaxDate(),this._preTxtValue=this.element.val(this._formatter(this.model.value,this.model.dateFormat))):(n instanceof Date&&(this._validateMinMaxDate(),n=this._formatter(n,this.model.dateFormat)),this.model.enableStrictMode?this.element.val(n):this.element.val(null),this.model.value=null,this.model.displayInline||this.wrapper.removeClass("e-valid"),this._triggerChangeEvent(),this.isValidState=this.element.val()==""||t.isNullOrUndefined(this.element.val())?!0:!1);this._removeWatermark()},_updateInputVal:function(){var n=this._validateValue();(n!=null||!this.model.enableStrictMode)&&this.sfCalendar&&this.sfCalendar.find(".e-datepicker-days").is(":visible")&&this._refreshDatepicker()},_validateInputVal:function(){var n=this._validateValue();n!=null&&(this.model.enableStrictMode||(n<=this.model.maxDate&&n>=this.model.minDate?this.isValidState=!0:(this.model.value=null,this.isValidState=!0)))},_validateValue:function(){var n;return n=this._specificFormat()&&this.element.val()!=this._formatter(this._preValue,this.model.dateFormat,this.model.locale)?this._parseDate(this.element.val(),!0):this._parseDate(this.element.val()),this._validateYearValue(n)},_getSeparator:function(){var t,n;for(formats=this.culture?this.culture.calendar.patterns.d:this.model.dateFormat,t=new RegExp("^[a-zA-Z0-9]+$"),n=0;n<formats.length;n++)if(!t.test(formats[n]))return formats[n]},_checkIE7:function(){if(navigator.appName=="Microsoft Internet Explorer"){var t=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),n=-1;if(t.exec(navigator.userAgent)!=null&&(n=parseFloat(RegExp.$1)),n>=7&&n<8)return!0}return!1},_isValidDate:function(n){return n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_formatter:function(n,i){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)},_parseDate:function(n,i){var u=this._checkFormat(this.model.dateFormat);return DateValue=n,!this._specificFormat()||DateValue==r||n==""||i==!0||t.format(t.parseDate(DateValue,u,this.model.locale),this.model.dateFormat,this.model.locale)==DateValue?t.parseDate(n,u,this.model.locale):this._dateValue},_checkFormat:function(n){var i=this,r=this._regExp();return n.replace(r,function(n){return n==="/"?t.preferredCulture(i.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},_regExp:function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},isLeapYear:function(n){return n%4==0&&n%100!=0||n%400==0},_zeroTime:function(n){var t=typeof n=="string"?this._parseDate(n):new Date(n);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_getDaysInMonth:function(n){return[31,this.isLeapYear(n)?29:28,31,30,31,30,31,31,30,31,30,31][n.getMonth()]},_addDays:function(n,t){return n.setDate(n.getDate()+t),n},_addYears:function(n,t){return n.setFullYear(n.getFullYear()+t),n},_addMonths:function(n,t){var i=n.getDate();return n.setMonth(n.getMonth()+t),i>n.getDate()&&this._addDays(n,-n.getDate()),n},_isWeekend:function(n){return n.getDay()==0||n.getDay()==6},_isSpecialDates:function(n){if(this.model.specialDates)for(var t=0;t<this.model.specialDates.length;t++)if(this.model.specialDates[t]&&this.model.specialDates[t][this._mapField._date]&&n.getDate()==this.model.specialDates[t][this._mapField._date].getDate()&&n.getMonth()==this.model.specialDates[t][this._mapField._date].getMonth()&&n.getFullYear()==this.model.specialDates[t][this._mapField._date].getFullYear())return this._getIndex=t,!0;return!1},_getMapper:function(){var n=this.model.fields;this._mapField={};this._mapField._date=n&&n.date?n.date:"date";this._mapField._tooltip=n&&n.tooltip?n.tooltip:"tooltip";this._mapField._icon=n&&n.iconClass?n.iconClass:"iconClass";this._mapField._custom=n&&n.cssClass?n.cssClass:"cssClass"},_createSpecialDateObject:function(){for(var n=0;n<this.model.specialDates.length;n++)this.model.specialDates[n][this._mapField._date]=this._checkInstanceType(this.model.specialDates[n][this._mapField._date])},_getMonthName:function(n,t){return n?this.Date.abbrMonthNames[t.getMonth()]:this.Date.monthNames[t.getMonth()]},_displayNewMonth:function(n,t){return this._setDisplayedMonth(this.displayedMonth+n,this.displayedYear+t,!0),!1},_setDisplayedMonth:function(n,t,i){var f,e,u,s,h,o;this.model.minDate!=r&&this.model.maxDate!=r&&(f=new Date(this.model.minDate.getTime()),f.setDate(1),e=new Date(this.model.maxDate.getTime()),e.setDate(1),!n&&!t||isNaN(n)&&isNaN(t)?(u=this._zeroTime(new Date),u.setDate(1)):u=isNaN(n)?new Date(t,this.displayedMonth,1):isNaN(t)?new Date(this.displayedYear,n,1):new Date(t,n,1),u.getTime()<f.getTime()?u=f:u.getTime()>e.getTime()&&(u=e),s=this.displayedMonth,h=this.displayedYear,this.displayedMonth=u.getMonth(),this.displayedYear=u.getFullYear(),o=u,i&&(this.displayedMonth!=s||this.displayedYear!=h)&&(this._renderCalendar(this,o),this._dateValue=o,this._trigger("monthChanged",[this.displayedMonth,this.displayedYear])))},_clearSelected:function(){this.numSelected=0;this.model.highlightSection=="week"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().removeClass("e-selected-week"):this.model.highlightSection=="month"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().parent().removeClass("e-selected-month"):this.model.highlightSection=="workdays"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().removeClass("e-work-week"):n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1)},_addSelected:function(){this.model.highlightSection=="week"?n("td.e-active",this.sfCalendar).parent().addClass("e-selected-week"):this.model.highlightSection=="month"?n("td.e-active, this.sfCalendar").parent().parent().addClass("e-selected-month"):this.model.highlightSection=="workdays"&&n("td.e-active",this.sfCalendar).parent().addClass("e-work-week")},_hideOtherMonths:function(t){n("td.other-month",t).css("visibility","hidden")},_showOtherMonths:function(t){n("td.other-month",t).css({visibility:"visible"})},_otherMonthsVisibility:function(){this.model.showOtherMonths?this._showOtherMonths(this.sfCalendar):this._hideOtherMonths(this.sfCalendar)},_createCalender:function(){t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-datepicker-headertext").text(this._formatter(this._calendarDate,this.model.headerFormat)).attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this.sfCalendar);this._enableHeader(this._showHeader);var i=t.buildTag("table.e-dp-viewdays","",{},{cellspacing:2}).data("e-table","data").attr({role:"grid","aria-activedescendant":""}).attr(this._isIE8?{unselectable:"on"}:{});this.sfCalendar.append(i);this._renderCalendar(this);this._startLevel(this.model.startLevel);t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this.sfCalendar);n(".e-footer-text",this.sfCalendar).html(this._localizedLabels.buttonText);this._enableFooter(this.model.showFooter)},_enableHeader:function(t){t?n(".e-header",this.sfCalendar).show():n(".e-header",this.sfCalendar).hide()},_enableFooter:function(t){t?n(".e-footer",this.sfCalendar).show():n(".e-footer",this.sfCalendar).hide();this._todayBtnDisable()},_todayBtnDisable:function(){var t=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate(),0,0,0);+this.model.minDate<=+t&&+this.model.maxDate>=+t?n(".e-footer",this.sfCalendar).removeClass("e-footer-disable"):n(".e-footer",this.sfCalendar).addClass("e-footer-disable")},_checkArrows:function(n,t){this._preArrowCondition(n,this.model.minDate.getFullYear());this._nextArrowCondition(t,this.model.maxDate.getFullYear())},_checkDateArrows:function(){this._preArrowCondition(this._tempMinDate,this.model.minDate);this._nextArrowCondition(this._tempMaxDate,this.model.maxDate)},_preArrowCondition:function(n,t){n<=t?this.sfCalendar.find(".e-arrow-sans-left").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-arrow-sans-left").removeClass("e-disable").attr({"aria-disabled":!1})},_nextArrowCondition:function(n,t){n>=t?this.sfCalendar.find(".e-arrow-sans-right").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-arrow-sans-right").removeClass("e-disable").attr({"aria-disabled":!1})},_previousNextHandler:function(t){var r,u,f,e,o,s,i;if(this.model.readOnly||!this.model.enabled||n(t.target).hasClass("e-disable"))return!1;t.preventDefault();r=n("table",this.sfCalendar);u=this._navigateFrom(r);f=n(t.target).is("a")?n(t.target.parentNode):n(t.target);e=f.hasClass("e-prev")?!0:!1;this._processNextPrevDate(e);o=n("table",this.sfCalendar);s=o.get(0).className;switch(s){case"e-dp-viewdays":i="month";break;case"e-dp-viewmonths":i="year";break;case"e-dp-viewyears":i="decade";break;case"e-dp-viewallyears":i="century"}this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:i,navigateFrom:u})},_processNextPrevDate:function(t){var i,u,l,h,c,f,e,o,r;if((this._DRPdisableFade&&(s=new Date(this.sfCalendar.find("td.current-month").attr("date")),this._dateValue=s),t&&this.sfCalendar.find(".e-arrow-sans-left").hasClass("e-disable"))||!t&&this.sfCalendar.find(".e-arrow-sans-right").hasClass("e-disable"))return!1;i=n("table",this.sfCalendar);l=i.get(0).className;switch(l){case"e-dp-viewdays":if(h=this.model.stepMonths,t){if(this._dateValue<=this.model.minDate)return this._flag=!1,!1}else if(this._dateValue>=this.model.maxDate)return this._flag=!1,!1;this._flag=!0;this._addMonths(this._dateValue,t?-h:h);this._clickedDate&&(this._calendarDate=this._clickedDate);this._dateValue=this._dateValue<this.model.minDate?new Date(this.model.minDate.toString()):this._dateValue;this._dateValue=this._dateValue>this.model.maxDate?new Date(this.model.maxDate.toString()):this._dateValue;this._renderCalendar(this,this._dateValue);n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));this._addFocus("day",this._hoverDate);c=this._findFirstLastDay(new Date(this._dateValue.toString()));this._preArrowCondition(c.firstDay,this.model.minDate);this._nextArrowCondition(c.lastDay,this.model.maxDate);break;case"e-dp-viewmonths":if(f=this._dateValue,f.setFullYear(n(".e-datepicker-headertext",this.sfCalendar).text()),t){if(f.getFullYear()<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(f.getFullYear()>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0;this._addYears(f,t?-1:1);this._renderCalendar(this,f);u=f.getFullYear();n(".e-datepicker-headertext",this.sfCalendar).text(u);n("tbody,tr.e-week-header",i).not(".e-datepicker-months").hide();n(n(i).find(".e-datepicker-months")).show();this._addFocus("month",this._hoverMonth);this._checkArrows(u,u);break;case"e-dp-viewyears":if(e=this._dateValue,e.setFullYear(n(i).find(".e-state-hover").text()),t){if(parseInt(n("td.e-year-first:first").text())<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(parseInt(n("td.e-year-last:first").prev().text())>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0;n(i).find(".e-state-hover").hasClass("e-year-first")&&t||n(i).find(".e-state-hover").hasClass("e-year-last")&&!t?this._dateValue.setFullYear(e.getFullYear()):n(i).find(".e-state-hover").hasClass("e-year-first")&&!t?this._dateValue.setFullYear(e.getFullYear()+11):n(i).find(".e-state-hover").hasClass("e-year-last")&&t?this._dateValue.setFullYear(e.getFullYear()-11):this._dateValue.setFullYear(e.getFullYear()+(t?-10:10));this._renderCalendar(this,this._dateValue);r=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1);n(".e-datepicker-headertext",this.sfCalendar).text(r+1+" - "+(r+10));n("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide();n(n(i).find(".e-datepicker-years")).show();this._addFocus("year",this._hoverYear+(n(".e-year-first.e-hidedate").length?-1:0));this._checkArrows(r+1,r+10);break;case"e-dp-viewallyears":if(t){if(o=parseFloat(n("td.e-allyear-first",i.get(0)).text().split("-")[1]),o<=this.model.minDate.getFullYear())return this._flag=!1,!1;this._flag=!0}else{if(o=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]),o>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0}this._dateValue.setFullYear((this._lastHoveredYear?this._lastHoveredYear:this._dateValue.getFullYear())+(t?-100:100));this._lastHoveredYear=this._dateValue.getFullYear();this._renderCalendar(this,this._dateValue);r=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%100+1);u=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]);n(".e-datepicker-headertext",this.sfCalendar).text(r+1+" - "+u);n("tbody,tr.e-week-header",i).not(".e-datepicker-allyears").hide();n(n(i).find(".e-datepicker-allyears")).show();this._addFocus("allyear",this._hoverAllYear+(n(".e-allyear-first.e-hidedate").length?-1:0));this._checkArrows(r+1,u)}this._layoutChanged()},_addFocus:function(t,i){var f="e-current-"+t,r,u;return t=="day"&&(f="current-month"),r=this.sfCalendar.find("tbody tr td."+f),t=="month"&&n(r).each(function(t,r){if(parseInt(n(r).attr("index"))==parseInt(i)){i=t;return}}),u=r[i],u||(u=r.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),n(u).addClass("e-state-hover"),this._setActiveState(t),i},_setActiveState:function(t){var e,f,o;if(this.model.value instanceof Date){var i=this.sfCalendar.find("tbody tr td.e-current-"+t),r,s=this,u=-1;switch(t){case"month":this.model.value.getFullYear()===parseInt(n(".e-text",this.sfCalendar).text())&&n(i).each(function(t,i){if(parseInt(n(i).attr("index"))==parseInt(s.model.value.getMonth())){u=t;return}});break;case"year":e=this.model.value.getFullYear();n(i).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(e)){u=n;return}});break;case"allyear":f=parseInt(this.model.value.getFullYear())-(parseInt(this.model.value.getFullYear())%10+1);o=f+1+" - "+(f+10);n(i).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(o)){u=n;return}})}r=i[u];r&&(this.sfCalendar.find("table td").removeClass("e-active"),n(r).hasClass("e-hidedate")||n(r).addClass("e-active"))}},_setFocusByName:function(t,i){var u=this.sfCalendar.find("tbody tr td.e-current-"+t),f,r;return n(u).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(i)){f=n;return}}),r=u[f],r||(r=u.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),n(r).addClass("e-state-hover"),this._setActiveState(t),f},_getHeaderTxt:function(){return this.sfCalendar.find(".e-datepicker-headertext").text()},_findFirstLastDay:function(n){y=n.getFullYear();m=n.getMonth();var t=new Date(y,m,1),i=new Date(y,m+1,0);return{firstDay:t,lastDay:i}},_forwardNavHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t&&t.preventDefault();var u=n("table",this.sfCalendar),f=n("table",this.sfCalendar).get(0).className,e=this,i,r;navFrom=this._navigateFrom(u);switch(f){case"e-dp-viewdays":this._hoverMonth=this._getDateObj(u.find(".e-state-hover")).getMonth()||this._getDateObj(u.find(".e-active")).getMonth()||0;this._DRPdisableFade&&(this._renderCalendar(this,this._calendarDate),n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat)));this._startLevel("year");r="year";this._addFocus("month",this._hoverMonth);break;case"e-dp-viewmonths":i=this._getHeaderTxt();this._startLevel("decade");r="decade";this._hoverYear=this._setFocusByName("year",i);break;case"e-dp-viewyears":i=this._getHeaderTxt();this._startLevel("century");r="century";this._hoverAllYear=this._setFocusByName("allyear",i)}navFrom!="century"&&this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:r,navigateFrom:navFrom});this._layoutChanged()},_cellSelection:function(){var u=n("table",this.sfCalendar),r=n("table",this.sfCalendar).get(0).className,t,i;switch(r){case"e-dp-viewmonths":this._hoverMonth=this._addFocus("month",this._dateValue.getMonth());break;case"e-dp-viewyears":t=new Date(this._dateValue.toString());this._navigationToPrevNext("year");this._dateValue=t;this._hoverYear=this._setFocusByName("year",this._dateValue.getFullYear());break;case"e-dp-viewallyears":t=new Date(this._dateValue.toString());this._navigationToPrevNext("allyear");this._dateValue=t;i=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1);this._hoverAllYear=this._setFocusByName("allyear",i+1+" - "+i+10)}this._layoutChanged()},_navigationToPrevNext:function(t){var r=this.sfCalendar.find("tbody tr td.e-current-"+t),u,i,f=this._dateValue.getFullYear();n(r).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(f)){u=n;return}});i=r[u];i&&(n(i).hasClass("e-"+t+"-last")?this._processNextPrevDate(!1):n(i).hasClass("e-"+t+"-first")&&this._processNextPrevDate(!0))},_navigateFrom:function(n){var i=n.get(0).className,t;switch(i){case"e-dp-viewdays":t="month";break;case"e-dp-viewmonths":t="year";break;case"e-dp-viewyears":t="decade";break;case"e-dp-viewallyears":t="century"}return t},_backwardNavHandler:function(i){var u,r;if(this._animating=!0,this.model.readOnly||!this.model.enabled)return!1;i.type?(i.preventDefault(),u=n(i.currentTarget)):u=i;var f=n("table",this.sfCalendar),o,h=n("table",this.sfCalendar).get(0).className,e=this,s;navFrom=this._navigateFrom(f);switch(h){case"e-dp-viewmonths":f.removeClass("e-dp-viewmonths").addClass("e-dp-viewdays");this._lastHoveredMonth=parseInt(n(u).attr("index"));this._dateValue=new Date(this._dateValue.getFullYear(),this._lastHoveredMonth,1);this._DRPdisableFade&&this._trigger("_month_Loaded",{currentTarget:i.currentTarget});this._renderCalendar(this,this._dateValue);n("tbody",f).not(".e-datepicker-days,.e-week-header").hide();n(n(f).find(".e-datepicker-days,.e-week-header")).fadeIn("fast",function(){e._addFocus("day",e._hoverDate||0);e._animating=!1});n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));s="month";break;case"e-dp-viewyears":f.removeClass("e-dp-viewyears").addClass("e-dp-viewmonths");this._lastHoveredYear=parseInt(u.text());this._dateValue.setFullYear(this._lastHoveredYear);this._renderCalendar(this,this._dateValue);n("tbody,tr.e-week-header",f).not(".e-datepicker-months").hide();t.isNullOrUndefined(this._hoverMonth)&&!t.isNullOrUndefined(this._dateValue)&&(this._hoverMonth=this._dateValue.getMonth());n(n(f).find(".e-datepicker-months")).fadeIn("fast",function(){e._addFocus("month",e._hoverMonth||0);e._animating=!1});o=u.text();n(".e-datepicker-headertext",this.sfCalendar).text(o);this._checkArrows(o,o);s="year";break;case"e-dp-viewallyears":r=u.text().split("-");f.removeClass("e-dp-viewallyears").addClass("e-dp-viewyears");r[0]<this.model.minDate.getFullYear()?r[0]=this.model.minDate.getFullYear().toString():r[0]>this.model.maxDate.getFullYear()&&(r[0]=this.model.maxDate.getFullYear().toString());this._renderCalendar(this,new Date(r[0],0,1));n("tbody,tr.e-week-header",f).not(".e-datepicker-years").hide();n(n(f).find(".e-datepicker-years")).fadeIn("fast",function(){e._addFocus("year",e._hoverYear||0);e._animating=!1});n(".e-datepicker-headertext",this.sfCalendar).text(r[0]+" - "+r[1]);this._checkArrows(r[0],r[1]);s="decade";this._dateValue=new Date(this._dateValue.setFullYear(parseInt(n.trim(r[0]))+(this._lastHoveredYear?this._lastHoveredYear%10:this._dateValue.getFullYear()%10)));break;default:this._clearSelected();this.sfCalendar.find("table td").removeClass("e-state-hover");u.not("td.other-month.e-hidedate").addClass("e-active").attr("aria-selected",!0);this._addSelected();this._hoverDate=this._getDateObj(u).getDate()-1;this._dateValue=new Date(u.attr("date"));this._clickedDate=new Date(u.attr("date"));this._animating=!1}navFrom!="month"&&this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:s,navigateFrom:navFrom});this._layoutChanged()},_startLevel:function(t){var i=n("table",this.sfCalendar),o=n(".e-datepicker-headertext",this.sfCalendar),r,f,u=this._dateValue,s,e;switch(t){case"decade":i.removeClass("e-dp-viewallyears e-dp-viewmonths e-dp-viewdays").addClass("e-dp-viewyears");n("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide();n(n(i).find(".e-datepicker-years")).show();u=this.model.enableStrictMode&&this._calendarDate<this._dateValue?this._calendarDate:u;e=parseInt(u.getFullYear())-(parseInt(u.getFullYear())%10+1);r=e+1;f=e+10;o.text(r+" - "+f);this._checkArrows(r,f);this._hoverYear=this._setFocusByName("year",u.getFullYear());break;case"century":this._calendarDate<this._dateValue||this._renderCalendar(this,u);i.removeClass("e-dp-viewyears e-dp-viewdays e-dp-viewmonths").addClass("e-dp-viewallyears");n("tbody,tr.e-week-header",i).not(".e-datepicker-allyears").hide();n(n(i).find(".e-datepicker-allyears")).show();r=parseFloat(n("td.e-allyear-first",i.get(0)).text().split("-")[1])+1;f=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]);s=r+" - "+f;o.text(s);this._checkArrows(r,f);e=parseInt(u.getFullYear())-(parseInt(u.getFullYear())%10+1);this._hoverAllYear=this._setFocusByName("allyear",e+1+" - "+(e+10));break;case"year":i.removeClass("e-dp-viewyears e-dp-viewallyears e-dp-viewdays").addClass("e-dp-viewmonths");n("tbody,tr.e-week-header",i).hide();n(n(i).find(".e-datepicker-months")).show();r=this.model.enableStrictMode&&this._calendarDate<this._dateValue?this._calendarDate.getFullYear():u.getFullYear();o.text(r);this._checkArrows(r,r);this._hoverMonth=u.getMonth();this._addFocus("month",this._hoverMonth);break;case"month":i.removeClass("e-dp-viewyears e-dp-viewallyears e-dp-viewmonths").addClass("e-dp-viewdays ")}},_depthLevel:function(t){var i=this.sfCalendar;switch(t){case"year":n(i.find(".e-current-year,.e-current-allyear")).on("click",n.proxy(this._backwardNavHandler,this));this._on(n(".e-current-month",this.sfCalendar),"click",n.proxy(this._onDepthSelectHandler,this));break;case"decade":n(i.find(".e-current-allyear")).on("click",n.proxy(this._backwardNavHandler,this));n(".e-current-year",this.sfCalendar).on("click",n.proxy(this._onDepthSelectHandler,this));break;case"century":n(i.find(".e-current-allyear")).on("click",n.proxy(this._onDepthSelectHandler,this));break;case"month":this._on(i.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this));this._on(i.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this))}},_onDepthSelectHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;n(t.target).hasClass("e-current-month")?this._dateValue=new Date(this._dateValue.setMonth(parseInt(t.target.attributes.index.value))):n(t.target).hasClass("e-current-year")?this._dateValue=new Date(this._dateValue.setFullYear(parseInt(t.target.innerHTML))):n(t.target).hasClass("e-current-allyear")&&(this._dateValue=new Date(this._dateValue.setFullYear(parseInt(t.target.innerHTML))));this._onSetCancelDateHandler(t)},_datepickerMonths:function(t,i,r){for(var e,o,u,s,h=function(n){return document.createElement(n)},f=0,c=0;c<3;c++){for(e=n(h("tr")),o=0;o<4;o++)u=n(h("td")).addClass("e-current-month e-state-default").attr({index:f}).attr(this._isIE8?{unselectable:"on"}:{}).html(this.Date.abbrMonthNames[f++]),r.getFullYear()<this.model.minDate.getFullYear()||r.getFullYear()>this.model.maxDate.getFullYear()?(u.addClass("e-hidedate"),u.removeClass("e-current-month")):(r.getFullYear()<=this.model.minDate.getFullYear()&&f<this.model.minDate.getMonth()+1||r.getFullYear()>=this.model.maxDate.getFullYear()&&f>this.model.maxDate.getMonth()+1)&&(u.addClass("e-hidedate"),u.removeClass("e-current-month")),e.append(u);t.append(e)}i.append(t);s=r.getFullYear();this._checkArrows(s,s)},_datepickerYears:function(t,i,r){for(var o,s,h,u,c=function(n){return document.createElement(n)},l=parseInt(r)-(parseInt(r)%10+1),f=[],e=0;e<12;e++)f.push(l+e);for(o=0,s=0;s<3;s++){for(h=n(c("tr")),e=0;e<4;e++)u=n(c("td")),u.attr(this._isIE8?{unselectable:"on"}:{}),o==0?u.addClass("e-year-first e-current-year "):o==11?u.addClass("e-year-last e-current-year "):u.addClass("e-current-year e-state-default"),(f[o]<this.model.minDate.getFullYear()||f[o]>this.model.maxDate.getFullYear())&&(u.addClass("e-hidedate"),u.removeClass("e-current-year")),u.html(f[o++]),h.append(u);t.append(h)}i.append(t);this._checkArrows(f[0],f[f.length])},_datepickerAllYears:function(t,i,r){for(var f,h,c,u,e=parseInt(r)-(parseInt(r)%100+10),a=e,s=[],l=this._isIE8||this._isIE9?"":"\n",o=0;o<12;o++)s.push(parseInt(e)+" -"+l+parseInt(e+9)),e=e+10;for(f=0,h=0;h<3;h++){for(c=n(document.createElement("tr")),o=0;o<4;o++)u=n(document.createElement("td")),u.attr(this._isIE8?{unselectable:"on"}:{}),f==0?u.addClass("e-allyear-first e-current-allyear "):f==11?u.addClass("e-allyear-last e-current-allyear "):u.addClass("e-current-allyear e-state-default"),(parseInt(s[f].split("-\n")[1])<this.model.minDate.getFullYear()||parseInt(s[f].split("-\n")[0])>this.model.maxDate.getFullYear())&&(u.addClass("e-hidedate"),u.removeClass("e-current-allyear")),u.html(s[f++]),c.append(u);t.append(c)}i.append(t)},_renderHeader:function(i){var c=n(document.createElement("thead")),e=t.preferredCulture(this.model.locale).calendars.standard.days,o,f,r,u,s,h;if(i.model.dayHeaderFormat!="none")for(o=t.buildTag("tr.e-week-header").attr({role:"columnheader"}).attr(this._isIE8?{unselectable:"on"}:{}),f=this.Date.firstDayOfWeek;f<this.Date.firstDayOfWeek+7;f++)r=f%7,u=e.names[r],s=i.model.dayHeaderFormat=="short"?e.namesAbbr[r]:i.model.dayHeaderFormat=="long"?u:e.namesShort[r],h=t.buildTag("th","",{},{scope:"col",abbr:u,date:u,title:this._formatter(u,"dddd"),"class":r==0||r==6?"e-week-end":"e-week-day"}).attr(this._isIE8?{unselectable:"on"}:{}).html(s),o.append(h);return c.append(o)},_renderCalendar:function(i,u){var k=this,h,s,e,g,nt,tt,l,w,b;i=n.extend({},t.DatePicker.prototype.defaults,i);this.Date.firstDayOfWeek=this.model.startDay;h=u?u:this._calendarDate?this._calendarDate:k._zeroTime(new Date);s=n("table",this.sfCalendar);s.empty();s.append(this._renderHeader(i));e=t.buildTag("tbody.e-datepicker-allyears","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});this._datepickerAllYears(e,s,h.getFullYear());e=t.buildTag("tbody.e-datepicker-years","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});this._datepickerYears(e,s,h.getFullYear());var d=i.model.month==r?h.getMonth():i.model.month,rt=i.model.year||h.getFullYear(),f=new Date(rt,d,1,0,0,0),a=this.Date.firstDayOfWeek-f.getDay()+1;a>1&&(a-=7);g=Math.ceil((-1*a+1+this._getDaysInMonth(f))/7);this._addDays(f,a-1);nt=k._zeroTime(new Date);tt=this._calendarDate;e=t.buildTag("tbody.e-datepicker-months","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});this._datepickerMonths(e,s,h);e=t.buildTag("tbody.e-datepicker-days","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});for(var ut=0,it=!0,p=!0;ut++<g;){for(l=jQuery(document.createElement("tr")),w=0;w<7;w++){var v=f.getMonth()==d,y=this._isSpecialDates(f),ft=this._checkDisableRange(f),c=this._getIndex,o=n(document.createElement("td")).html(y?"<span><\/span>"+f.getDate():f.getDate()+"").attr({date:f.toDateString(),title:this.model.showTooltip?y&&this.model.specialDates[c][this._mapField._tooltip]?this.model.specialDates[c][this._mapField._tooltip]:this._formatter(f,this.model.tooltipFormat):"","aria-selected":!1,role:"gridcell"}).attr(this._isIE8?{unselectable:"on"}:{}).addClass((v?"current-month e-state-default ":"other-month e-state-default ")+(this._isWeekend(f)?this._ejHLWeekEnd?"e-dp-weekend e-week-end ":this.model.highlightWeekend?"e-week-end ":"":"e-week-day ")+(v&&f.getTime()==nt.getTime()?"today ":""));o.find("span:first-of-type").addClass(y?this.model.specialDates[c][this._mapField._icon]?"e-special-date-icon "+this.model.specialDates[c][this._mapField._icon]+" ":"e-special-day":"");o.addClass(y?this.model.specialDates[c][this._mapField._custom]?this.model.specialDates[c][this._mapField._custom]:"":"");ft&&this._disableDates({date:f,element:o});tt.getTime()==f.getTime()&&v&&(o.hasClass("e-hidedate")||(this.model.value?(o.addClass("e-active").attr({"aria-selected":!0}),this.model.highlightSection=="week"&&l.addClass("e-selected-week"),this.model.highlightSection=="month"&&e.addClass("e-selected-month"),this.model.highlightSection=="workdays"&&l.addClass("e-work-week")):o.addClass("e-state-hover").attr({"aria-selected":!1})),this._hoverDate||(o.hasClass("e-hidedate")||o.addClass("e-state-hover"),this._hoverDate=f.getDate()-1));b=!0;(f<this.model.minDate||f>this.model.maxDate)&&(o.addClass("e-hidedate"),o.removeClass("current-month"),this.model.showOtherMonths&&o.removeClass("other-month"),b=p=!1);v&&(b&&it&&(this._tempMinDate=f,it=!1,p=!0),p&&(this._tempMaxDate=f));this._trigger("beforeDateCreate",{date:f,value:this._formatter(f,this.model.dateFormat),element:o});l.append(o);f=new Date(f.getFullYear(),f.getMonth(),f.getDate()+1,0,0,0)}e.append(l)}s.append(e);this._DRPdisableFade?(n(e).css("display","block"),n(e).css({display:"table-row-group","vertical-align":"middle","border-color":"inherit"})):this._isIE8||this._isIE7?n(e).css("display","block"):n(e).fadeIn("fast");this.model.startLevel===this.model.depthLevel?this._depthLevel(this.model.depthLevel):this.model.depthLevel!="month"&&this.model.depthLevel!=""?this.model.startLevel=="century"?this._depthLevel(this.model.depthLevel):this.model.startLevel=="decade"&&this.model.depthLevel!="century"?this._depthLevel(this.model.depthLevel):this.model.startLevel=="year"&&this.model.depthLevel!="decade"&&this.model.depthLevel!="century"?this._depthLevel(this.model.depthLevel):(this._on(s.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this)),this._on(s.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this))):(this._on(s.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this)),this._on(s.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this)));this._otherMonthsVisibility();this._checkDateArrows()},_checkDisableRange:function(n){return!t.isNullOrUndefined(this._disableCollection[n.getFullYear()])&&jQuery.inArray(n.getMonth(),this._disableCollection[n.getFullYear()])!==-1?!0:!1},_initDisableObj:function(){var r,n,u;for(this._disableCollection={},i=0;i<this.model.blackoutDates.length;i++)r=this._checkInstanceType(this.model.blackoutDates[i]),r&&(n=r.getFullYear(),u=r.getMonth(),t.isNullOrUndefined(this._disableCollection[n])&&(this._disableCollection[n]=[]),jQuery.inArray(u,this._disableCollection[n])==-1&&this._disableCollection[n].push(u))},_disableDates:function(n){for(i=0;i<this.model.blackoutDates.length;i++){var t=this._checkInstanceType(this.model.blackoutDates[i]);t&&+n.date==+t&&n.element.removeClass("current-month").addClass("e-hidedate")}},_keyboardNavigation:function(n){var t;if(this._animating)return!1;if(this._isOpen&&(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35)){if(n.preventDefault&&n.preventDefault(),n.altKey)return n.keyCode==13?(this._setCurrDate(n),!1):void 0;t={row:null,col:null};t.col=this.sfCalendar.find("tbody tr td.e-state-hover").index();t.row=this.sfCalendar.find("tbody tr td.e-state-hover").parent().index();t.col=t.col!=-1?t.col+1:this.sfCalendar.find("tbody tr td.e-active").index()+1;t.row=t.row!=-1?t.row+1:this.sfCalendar.find("tbody tr td.e-active").parent().index()+1;var f=this.sfCalendar.find("table")[0].className,i,r=3,u=4;switch(f){case"e-dp-viewallyears":i=this._changeRowCol(t,n.keyCode,r,u,"yearall",n.ctrlKey);n.ctrlKey||(this._hoverAllYear=this.sfCalendar.find("tbody.e-datepicker-allyears tr td").index(i));break;case"e-dp-viewyears":i=this._changeRowCol(t,n.keyCode,r,u,"year",n.ctrlKey);n.ctrlKey||(this._hoverYear=this.sfCalendar.find("tbody.e-datepicker-years tr td").index(i));break;case"e-dp-viewmonths":i=this._changeRowCol(t,n.keyCode,r,u,"month",n.ctrlKey);n.ctrlKey||(this._hoverMonth=this.sfCalendar.find("tbody.e-datepicker-months tr td").index(i));break;case"e-dp-viewdays":r=this.sfCalendar.find("tbody.e-datepicker-days tr").length;u=7;i=this._changeRowCol(t,n.keyCode,r,u,"day",n.ctrlKey);n.ctrlKey||(this._hoverDate=this._getDateObj(i).getDate()-1)}n.ctrlKey||(this.sfCalendar.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover"))}else if(this.model.displayInline||n.keyCode!=27&&n.keyCode!=9){if(n.altKey&&n.keyCode==40)return this.show(),!1}else this.hide()},_changeRowCol:function(t,i,r,u,f,e){var h,s={parent:null,child:null},o,v,l,c,a;switch(f){case"day":h="tbody.e-datepicker-days tr td.current-month";s.parent=".e-datepicker-days";s.child=".current-month";break;case"month":h="tbody.e-datepicker-months tr td.e-current-month";s.parent=".e-datepicker-months";s.child=".e-current-month";break;case"year":h="tbody.e-datepicker-years tr td.e-current-year";s.parent=".e-datepicker-years";s.child=".e-current-year";break;case"yearall":h="tbody.e-datepicker-allyears tr td.e-current-allyear";s.parent=".e-datepicker-allyears";s.child=".e-current-allyear"}if(t.row<=0&&t.col<=0)return this.sfCalendar.find(h+":first");v=this;switch(i){case 36:return this.sfCalendar.find(h+":first");case 35:return this.sfCalendar.find(h+":last");case 38:if(e&&this.model.allowDrillDown)this._forwardNavHandler();else if(t.row>1)t.row-=1;else return this._processNextPrevDate(!0),this.sfCalendar.find(h+":nth-child("+t.col+"):last");if(o=this._getCell(t,s),o.length<=0){if(o=this._findVisible(t,s,"up"),o!==null)return o;this._processNextPrevDate(!0);o=this.sfCalendar.find(h+":nth-child("+t.col+"):last")}return o;case 37:if(e)return this._processNextPrevDate(!0),this.sfCalendar.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else if(t.row>1)t={row:t.row-1,col:u};else return this._processNextPrevDate(!0),this.sfCalendar.find(h+":last");if(o=this._getCell(t,s),o.length<=0){if(o=this._findVisible(t,s,"left"),o!==null)return o;this._processNextPrevDate(!0);o=this.sfCalendar.find(h+":last")}return o;case 39:if(e)return this._processNextPrevDate(!1),this.sfCalendar.find("tbody tr td.e-state-hover");if(t.col<u)t.col+=1;else if(t.row<r)t={row:t.row+1,col:1};else return this._processNextPrevDate(!1),this.sfCalendar.find(h+":first");if(o=this._getCell(t,s),o.length<=0){if(o=this._findVisible(t,s,"right"),o!==null)return o;this._processNextPrevDate(!1);o=this.sfCalendar.find(h+":first")}return o;case 40:if(!e){if(t.row<r)t.row+=1;else return this._processNextPrevDate(!1),this.sfCalendar.find(h+":nth-child("+t.col+"):first");if(o=this._getCell(t,s),o.length<=0){if(o=this._findVisible(t,s,"down"),o!==null)return o;this._processNextPrevDate(!1);o=this.sfCalendar.find(h+":nth-child("+t.col+"):first")}return o}case 13:l=n("table",this.sfCalendar).get(0).className;c=this._getCell(t,s);a=n(c)[0];l=="e-dp-viewmonths"&&this.model.startLevel=="year"&&this.model.depthLevel=="year"?(this._dateValue=new Date(this._dateValue.setMonth(parseInt(a.attributes.index.value))),this._onSetCancelDateHandler({type:null,target:c})):l=="e-dp-viewyears"&&this.model.startLevel=="decade"&&this.model.depthLevel=="decade"||l=="e-dp-viewallyears"&&this.model.startLevel=="century"&&this.model.depthLevel=="century"?(this._dateValue=new Date(this._dateValue.setFullYear(parseInt(a.innerHTML))),this._onSetCancelDateHandler({type:null,target:c})):l=="e-dp-viewdays"?(this._backwardNavHandler(c),this._onSetCancelDateHandler({type:null,target:c})):this._backwardNavHandler(c)}return this._getCell(t,s)},_findVisible:function(n,t,r){var f=n.col,u=n.row,e=t.child.slice(1,t.child.length);for(i=0;i>=0;i++){if(nextElement=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+u+") td:nth-child("+f+")"),nextElement.length<=0)return null;if(nextElement.hasClass("e-hidedate")||!nextElement.is(":visible")){if((r=="right"||r=="left"?r=="right"?f++:f--:r=="down"?u++:u--,u<=0||u>this.sfCalendar.find("tbody"+t.parent+" tr").length)||(f>this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+u+") td").length&&(u++,f=1),f<=0&&(u--,f=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+u+") td").length),u<=0||u>this.sfCalendar.find("tbody"+t.parent+" tr").length))return null}else{if(nextElement.hasClass("other-month"))return null;if(nextElement.hasClass(e))return n.col=f,n.row=u,nextElement}}},_getCell:function(n,t){return this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+n.row+") td"+t.child+":nth-child("+n.col+")")},_getDateObj:function(n){return new Date(n.attr("date"))},_touchCalendar:function(n){var t=this.sfCalendar.find("table")[0].className;switch(n.type){case"pinchin":t!="e-dp-viewdays"&&this._keyboardNavigation({keyCode:13});break;case"pinchout":t!="e-dp-viewallyears"&&this.model.allowDrillDown&&this._forwardNavHandler();break;case"swipeleft":this._processNextPrevDate(!1);break;case"swiperight":this._processNextPrevDate(!0)}},show:function(i){var r,u;if(t.isNullOrUndefined(this.sfCalendar)&&this._renderPopup(),this._isOpen)return!1;if(r=this,this._popupOpen=!0,u=this._preValue!=null?new Date(this._preValue.toString()):this._preValue,this.model.enabled){if(this.model.displayInline||this._setDatePickerPosition(),this._trigger("beforeOpen",{element:this.sfCalendar,events:i}))return!1;this.sfCalendar.attr({"aria-hidden":"false"});r._isOpen=!0;this.sfCalendar.slideDown(this.model.enableAnimation?this.animation.open.duration:0,function(){if(r.model&&!r.model.displayInline)n(document).on("mousedown",n.proxy(r._onDocumentClick,r))});this._isIE8?this.element.val()&&this._compareDate(new Date(this.element.val()),u)&&this._updateInputVal():this._updateInputVal();this._refreshLevel(u);this._trigger("open",{prevDate:u,date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)});this._on(t.getScrollableParents(this.wrapper),"scroll",this.hide);n(window).on("resize",n.proxy(this._OnWindowResize,this));this.model.displayInline||this._on(t.getScrollableParents(this.wrapper),"touchmove",this.hide);this._isInputBox&&this.wrapper.addClass("e-active")}},hide:function(i){if(!this._isOpen||this._getInternalEvents||this._trigger("beforeClose",{element:this.sfCalendar,events:i}))return!1;var u=this;(this._popupOpen=!1,this.sfCalendar.attr({"aria-hidden":"true"}),this._popClose&&i!=r&&i.type!="click")||(this.sfCalendar.slideUp(this.model.enableAnimation?this.animation.close.duration:0,function(){u._isOpen=!1;n(document).off("mousedown",n.proxy(u._onDocumentClick,u));u._setWaterMark()}),this.element.val()!=""&&this._validateInputVal(),this._trigger("close",{prevDate:this._prevDate,date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)}),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"touchmove",this.hide),this._isInputBox&&this.wrapper.removeClass("e-active"))},enable:function(){this.model.enabled=!0;this.wrapper&&this.wrapper.removeClass("e-disable");this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.dateIcon&&this.dateIcon.removeClass("e-disable").attr({"aria-disabled":!1});this._isIE8&&this.dateIcon&&this.dateIcon.children().removeClass("e-disable");this.element.prop("disabled",!1);this._isSupport||this._hiddenInput.prop("disabled",!1);this.sfCalendar&&this.sfCalendar.removeClass("e-disable").attr({"aria-disabled":!1})},disable:function(){this.model.enabled=!1;this.wrapper&&this.wrapper.addClass("e-disable");this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.attr("disabled","disabled");this.dateIcon&&this.dateIcon.addClass("e-disable").attr({"aria-disabled":!0});this._isIE8&&this.dateIcon&&this.dateIcon.children().addClass("e-disable");this.element.attr("disabled","disabled");this._isSupport||this._hiddenInput.attr("disabled","disabled");this.sfCalendar&&this.sfCalendar.addClass("e-disable").attr({"aria-disabled":!0});this._isOpen&&(this.element.is(":input")&&this.element.blur(),this.model.displayInline||this.hide())},getValue:function(){return this._formatter(this.model.value,this.model.dateFormat)},_wireCalendarEvents:function(){if(this._allowQuickPick(this.model.allowDrillDown),this._on(n(".e-next",this.sfCalendar),"click",n.proxy(this._previousNextHandler,this)),this._on(n(".e-prev",this.sfCalendar),"click",n.proxy(this._previousNextHandler,this)),!this.model.displayInline){this.sfCalendar.on("mouseenter touchstart",n.proxy(function(){this._popClose=!0},this));this.sfCalendar.on("mouseleave touchend",n.proxy(function(){this._popClose=!1},this))}this.model.showFooter&&this._on(n(".e-footer",this.sfCalendar),"click",this._setCurrDate);this.sfCalendar&&this._on(this.sfCalendar,"pinchin pinchout swipeleft swiperight",n.proxy(this._touchCalendar,this))},_wireEvents:function(){if(this.element.is(":input")&&this.model.allowEdit&&(this._on(this.element,"blur",this._onFocusOut),this._on(this.element,"focus",this._onFocusIn),this._on(this.element,"keydown",this._onKeyDown)),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showDatePopUp,this))}},_bindDateButton:function(){this._on(this.dateIcon,"mousedown",this._showDatePopUp);this.model.allowEdit&&this.element.off("mousedown",n.proxy(this._showDatePopUp,this))},_bindInputEvent:function(){this._off(this.dateIcon,"mousedown",this._showDatePopUp)},_specificFormat:function(){var i=t.globalize._getDateParseRegExp(t.globalize.findCulture(this.model.locale).calendar,this.model.dateFormat);return n.inArray("dddd",i.groups)>-1||n.inArray("ddd",i.groups)>-1},_onFocusOut:function(i){var u,r,f;this._isFocused=!1;u=this._preValue!=null?new Date(this._preValue.toString()):this._preValue;this._validateOnFocusOut(this._validateValue(),i);this.wrapper.removeClass("e-focus");t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid");this._isOpen&&!this.model.displayInline||this._setWaterMark()||this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._updateInputVal();(!this._isOpen||this.model.displayInline)&&this._refreshLevel(u);this.element.val()!=""&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal();this.element.off("keydown",n.proxy(this._keyboardNavigation,this));this.model.showPopupButton||this._off(this.element,"click",this._elementClick);r=this.element.val();f={prevDate:this._prevDate,value:r};this._specificFormat()?this._prevDate!=r&&this._setDateValue(r,!0):this._setDateValue(r);this.model.value||this._clearSelected();this._trigger("focusOut",f);this._checkErrorClass()},_onFocusIn:function(t){if(this._isSupport&&(t.preventDefault(),this._isFocused=!0),this.wrapper.removeClass("e-error").attr("aria-invalid","false"),this.isValidState=!0,this.wrapper.addClass("e-focus"),this.wrapper.addClass("e-valid"),!this.model.readOnly){this._isSupport||this._hiddenInput.css("display","none");this.element.on("keydown",n.proxy(this._keyboardNavigation,this));this.model.showPopupButton||this.model.readOnly||this.show(t);this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this._trigger("focusIn",{date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)})}},_elementClick:function(n){this._popupOpen||this.show(n)},_removeWatermark:function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},_refreshPopup:function(){this._refreshDatepicker();this._startLevel(this.model.startLevel)},_refreshLevel:function(n){if(this.model.startLevel==this.model.depthLevel&&this.model.startLevel!="month"){var t=this._stringToObject(this.element.val());t=this._validateYearValue(t);t&&(this._compareDate(n,t)||this._refreshPopup())}},_validateOnFocusOut:function(n,i){var f=this._preValue!=null?this._calendarDate:this._preValue,o=this._formatter(f,this.model.dateFormat),e,r,u;this._specificFormat()&&n>this.model.minDate&&n<this.model.maxDate?n==null?this.model.value=f:(this.model.value=n,e=this._formatter(n,this.model.dateFormat,this.model.locale)):e=this._formatter(this._parseDate(this._formatter(new Date,"MM/dd/yyyy")),this.model.dateFormat);r=!1;u=!1;n==null||this.model.enableStrictMode?n!=null||this.model.enableStrictMode?n?(n<this.model.minDate||n>this.model.maxDate?(this.isValidState=!1,u=!0,this._calendarDate=n<this.model.minDate?this.model.minDate:this.model.maxDate):this.isValidState=!0,this._triggerChangeEvent(i),u&&this._getInternalEvents&&this._trigger("outOfRange")):(this.isValidState=!1,this._calendarDate<this.model.minDate?this._calendarDate=this.model.minDate:this._calendarDate>this.model.maxDate&&(this._calendarDate=this.model.maxDate)):(this._preTxtValue==null||this.element.val()==""?(this.element.val(""),this._isSupport||this._hiddenInput.css("display","block")):this.element.val(o),this._triggerChangeEvent(i)):(t.isNullOrUndefined(this.model.value)&&(this.model.value=this._parseDate(this.element.val())),this.model.maxDate<this.model.minDate&&(this.model.minDate=this.model.maxDate),this.model.enableStrictMode||(n?(n<this.model.minDate||n>this.model.maxDate)&&(r=!0,this._calendarDate=n=n<this.model.minDate?this.model.minDate:this.model.maxDate):(this.element.val(""),this._calendarDate<this.model.minDate?this._calendarDate=this.model.minDate:this._calendarDate>this.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0),r&&this.element.val(this._formatter(n,this.model.dateFormat)),this._compareDate(this._preValue,this._parseDate(this.element.val(),!0))||this._triggerChangeEvent(i))},_onKeyDown:function(n){if(n.keyCode===13){var t=this._preValue!=null?new Date(this._preValue.toString()):this._preValue;this._validateOnFocusOut(this._validateValue(),n);this._isOpen&&!this.model.displayInline||this._setWaterMark()||this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._updateInputVal();(!this._isOpen||this.model.displayInline)&&this._refreshLevel(t);this.element.val()!=""&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal();this._checkErrorClass()}},_showhidePopup:function(n){if(!this.model.enabled)return!1;this._isOpen?(this._isFocused||!this.element.is(":input")||t.isTouchDevice()||this.element.focus(),this._cancelValue||this.hide(n)):(this._isFocused||!this.element.is(":input")||t.isTouchDevice()||this.element.focus(),this.show(n))},_compareDate:function(n,t){return+n==+t?!0:!1},_validateDate:function(n){var t=!0,r;if(n!=null){for(i=0;i<this.model.blackoutDates.length;i++)r=this._checkInstanceType(this.model.blackoutDates[i]),r&&+n==+r&&(t=!1);(n<this.model.minDate||n>this.model.maxDate)&&this.model.enableStrictMode&&(t=!1,this.isValidState=!1)}return t},_triggerChangeEvent:function(n){var i,u=this.element.val()==""?null:this.element.val(),t;this._prevDate=this._formatter(this._preValue,this.model.dateFormat);t={prevDate:this._prevDate,value:u,isInteraction:!!n};i=this._specificFormat()&&n!=r&&n.type=="keydown"&&this._formatter(this._preValue,this.model.dateFormat,this.model.locale)!=this.element.val()?this._parseDate(this.element.val(),!0):this._specificFormat()&&n!=r&&n.type=="blur"?this.model.value:this._parseDate(u);i=this._validateYearValue(i);this._validateDate(i)||(i=null);this._compareDate(this._preValue,i)?this.element.val()==""&&this._prevDate==null||this.element.val()==this._prevDate||(t.value=this.element.val(),this._trigger("_change",t)):(this._preValue=this.model.value=i,t.value=this._formatter(this.model.value,this.model.dateFormat),this.model.value&&(this._clickedDate=this._calendarDate=this.model.value),this.model.displayInline&&!this._isInputBox&&this._hiddenInput.attr("value",u),this.model.value||this.model.enableStrictMode||this._setDateValue(this.model.value),t.value=u,this._trigger("_change",t),t.value=this._formatter(this.model.value,this.model.dateFormat),this._trigger("change",t),this._checkErrorClass())},_triggerSelectEvent:function(){var t=this.element.val(),n;this._parseDate(t)&&(n={prevDate:this._prevDate,date:this.model.value,value:t,isSpecialDay:this._isSpecialDates(this.model.value)},this._prevDate!=t&&this._parseDate(n.value)&&this.model.value>=this.model.minDate&&this.model.value<=this.model.maxDate&&(this._cancelValue=this._trigger("select",n)),this._dt_drilldown&&this._trigger("dt_drilldown",n))},_onDocumentClick:function(t){this.model&&(n(t.target).is(this.popup)||n(t.target).parents(".e-popup").is(this.popup)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-datewidget").is(this.wrapper)?(n(t.target).is(this.popup)||n(t.target).parents(".e-popup").is(this.popup))&&t.preventDefault():this.hide(t))},_OnWindowResize:function(){this.sfCalendar&&this._setDatePickerPosition()},_showDatePopUp:function(n){var t=!1;if((n.button?t=n.button==2:n.which&&(t=n.which==3),!t)&&(this._isSupport||this.model.showPopupButton||(n.preventDefault(),this._onFocusIn()),!this.model.readOnly)){if(n.preventDefault(),!this.model.enabled&&this.model.displayInline)return!1;this._showhidePopup(n)}},_layoutChanged:function(){this._getInternalEvents&&this._trigger("layoutChange")},_setCurrDate:function(n){if(this.model.readOnly||!this.model.enabled)return!1;n&&n.preventDefault();var t=this;this._prevDate=this._formatter(this.model.value,this.model.dateFormat);this._dateValue=this._zeroTime(new Date);this.model.value=this._calendarDate=new Date(this._dateValue.toString());this._setDateValue(this.model.value);this._triggerSelectEvent(n);this._triggerChangeEvent(n);this._refreshDatepicker();this._changeDayClass();this._startLevel(this.model.startLevel);this._onSetCancelDateHandler(n);this._layoutChanged()},_changeDayClass:function(){var n=this.popup.children("table")[0].className;n!="e-dp-viewdays"&&this.popup.children("table").removeClass(n).addClass("e-dp-viewdays")},_onSetCancelDateHandler:function(t){if(this.model.readOnly||!this.model.enabled||t&&(n(t.target).hasClass("e-disable")||n(t.target).hasClass("e-hidedate")))return!1;t&&t.type&&t.preventDefault();this._specificFormat()?this._prevDate=this.element.val():this.model.value=this._parseDate(this.element.val());this._prevDate=this._formatter(this.model.value,this.model.dateFormat);this._setDateValue(this._dateValue);this._triggerSelectEvent(t);this._triggerChangeEvent(t);this._dateValue=new Date(this.model.value.toString());this.element.is(":input")&&!this.model.displayInline&&this._showhidePopup(t);t&&n(t.currentTarget).hasClass("other-month")&&this._refreshDatepicker();this._cellSelection()},_closeCalendar:function(n){n&&n!=this.element||this.sfCalendar.empty().remove()},_checkErrorClass:function(){this.wrapper&&(this.isValidState?this.wrapper.removeClass("e-error").attr("aria-invalid","false"):this.wrapper.addClass("e-error").attr("aria-invalid","true"))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.DatePicker.Locale=t.DatePicker.Locale||{};t.DatePicker.Locale["default"]=t.DatePicker.Locale["en-US"]={watermarkText:"Select date",buttonText:"Today"};t.DatePicker.Header={None:"none",Short:"short",Min:"min",Long:"long"};t.DatePicker.HighlightSection={Month:"month",Week:"week",WorkDays:"workdays",None:"none"};t.DatePicker.Level={Month:"month",Year:"year",Decade:"decade",Century:"century"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejTimePicker","ej.TimePicker",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_rootCSS:"e-timepicker",_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{cssClass:"",timeFormat:"",value:null,enableAnimation:!0,locale:"en-US",htmlAttributes:{},readOnly:!1,showPopupButton:!0,enableStrictMode:!1,interval:30,hourInterval:1,minutesInterval:1,secondsInterval:1,height:"",width:"",minTime:"12:00 AM",maxTime:"11:59 PM",showRoundedCorner:!1,enableRTL:!1,popupHeight:"191px",popupWidth:"auto",enabled:!0,enablePersistence:!1,disableTimeRanges:null,validationRules:null,validationMessages:null,focusIn:null,focusOut:null,beforeChange:null,change:null,select:null,create:null,destroy:null,beforeOpen:null,open:null,close:null},dataTypes:{timeFormat:"string",minTime:"string",maxTime:"string",readOnly:"boolean",interval:"number",showPopupButton:"boolean",locale:"string",hourInterval:"number",minutesInterval:"number",secondsInterval:"number",enabled:"boolean",enablePersistence:"boolean",enableAnimation:"boolean",enableStrictMode:"boolean",disableTimeRanges:"data",htmlAttributes:"data",validationRules:"data",validationMessages:"data"},observables:["value"],enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.element.prop("disabled",!1),this.model.enabled=!0,this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable").attr("aria-disabled",!1),this.model.showPopupButton&&(this.timeIcon.removeClass("e-disable").attr("aria-disabled",!1),this.popupList.removeClass("e-disable").attr("aria-disabled",!1)),this._isIE8&&this.timeIcon.children().removeClass("e-disable"))},disable:function(){this.model.enabled&&(this.element[0].disabled=!0,this.model.enabled=!1,this.element.attr("disabled","disabled"),this.wrapper.addClass("e-disable"),this.element.addClass("e-disable").attr("aria-disabled",!0),this.model.showPopupButton&&(this.timeIcon.addClass("e-disable").attr("aria-disabled",!0),this.popupList.addClass("e-disable").attr("aria-disabled",!0)),this._isIE8&&this.timeIcon.children().addClass("e-disable"),this._hideResult())},getValue:function(){return this.element.val()},setCurrentTime:function(){this.model.readOnly||this._setMask()},show:function(){this.showDropdown||this._getInternalEvents||this._showResult()},hide:function(){this.showDropdown&&this._hideResult()},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_timeFormat:function(n){var r,i;return n||(n=t.preferredCulture(this.model.locale).calendars.standard.patterns.t),r=this._validateTimeFormat(n),r&&(this.model.timeFormat=r,this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale),this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale),this.model.value?(this._setModelOption=!0,this.model.value=this._localizeTime(this.model.value),this.element.val(this.model.value)):(this._setModelOption=!1,i=this._localizeTime(this.element.val()),i&&this._checkMinMax(i)&&(this.model.value=i,this.element.val(i)))),r},_getTimeFormat:function(){this.model.timeFormat=t.preferredCulture(this.model.locale).calendar.patterns.t||"h:mm tt";this.seperator=this._getSeperator()},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popupList&&this.popupList.removeClass(this.model.cssClass).addClass(n)},_localize:function(n){var i=this._createObject(this.model.value,!0);this.model.locale=n;this._getTimeFormat();this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale);this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale);i?(this.model.value=this._localizeTime(i),this.element.val(this.model.value)):(i=this._localizeTime(this.element.val()),i&&this._checkMinMax(i)&&(this.model.value=i,this.element.val(i)));this._getAmPm()},_setLocalize:function(n){var n=t.preferredCulture(n);n&&(this.model.locale=n.name=="en"?"en-US":n.name,t.isNullOrUndefined(this._options)||!t.isNullOrUndefined(this._options.timeFormat)&&this._options.timeFormat||(this.model.timeFormat=t.preferredCulture(this.model.locale).calendars.standard.patterns.t))},_updateInput:function(){if(!t.isNullOrUndefined(this._options)){var n=this._localizeTime(this._options.value);t.isNullOrUndefined(n)||typeof n=="string"&&this.model.enableStrictMode&&!this.model.value&&(this.element.val(this._options.value),this.isValidState=this.element.val()==""?!0:!1,this._checkErrorClass())}},_createMinMaxObj:function(){this._minTimeObj=this._createObject(this.model.minTime);this._minTimeObj||(this.model.minTime=t.format(this._createObject((new Date).setHours(0,0,0,0)),this.model.timeFormat,this.model.locale));this._maxTimeObj=this._createObject(this.model.maxTime);this._maxTimeObj||(this.model.maxTime=t.format(this._createObject((new Date).setHours(23,59,59,59)),this.model.timeFormat,this.model.locale))},_setMinMax:function(){var n=(new Date).setHours(0,0,0,0),i=(new Date).setHours(23,59,59,59);!t.isNullOrUndefined(this._options)&&t.isNullOrUndefined(this._options.minTime)&&(this.model.minTime=t.format(this._createObject(n),this.model.timeFormat,this.model.locale));!t.isNullOrUndefined(this._options)&&t.isNullOrUndefined(this._options.maxTime)&&(this.model.maxTime=t.format(this._createObject(i),this.model.timeFormat,this.model.locale));this._createMinMaxObj()},_init:function(n){if(this._options=n,this._cloneElement=this.element.clone(),this._ISORegex(),!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this._initialize();this._render();this._wireEvents();n&&n.value!=r&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()});this._updateInput();this._updateTextbox();this.model.validationRules!=null&&(this._initTimeValidator(),this._setTimeValidation())},_updateTextbox:function(){this._options!==r&&(this._options.value!==r||this.model.value)||this._setTime(this._localizeTime(this.model.minTime))},_setMinMaxTime:function(i,r){!t.isNullOrUndefined(r.minTime)&&n.trim(r.minTime)&&this._isValid(r.minTime)&&(this.model.minTime=r.minTime,this._minTimeObj=this._createObject(this.model.minTime),this._validateTimes());!t.isNullOrUndefined(r.maxTime)&&n.trim(r.maxTime)&&this._isValid(r.maxTime)&&(this.model.maxTime=r.maxTime,this._maxTimeObj=this._createObject(this.model.maxTime),this._validateTimes());this._validateMinMax();this._createMinMaxObj();t.isNullOrUndefined(r.minTime)||(r.minTime=this.model.minTime);t.isNullOrUndefined(r.maxTime)||(r.maxTime=this.model.maxTime);this._checkMinMax(this.model.value)||(this.model.enableStrictMode?(this.isValidState=!1,this.model.value=null):(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime)));i!==this.model.value&&this._isValid(this.model.value,!0)&&this.element.val(this.model.value)},_setModel:function(n){var r=!1,o=this.model.value,i,e,u,f,s;for(i in n)switch(i){case"timeFormat":u=this._createObject(this.model.value);this._preTimeformat=this.model.timeFormat;e=this._timeFormat(n[i]);n[i]=this.model.timeFormat;e&&(this.seperator=this._getSeperator());f=this._createObject(this.model.value);r=+u==+f?!1:!0;break;case"locale":u=this._createObject(this.model.value);this._localize(n[i]);this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale);this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale);f=this._createObject(this.model.value);r=+u==+f?!1:!0;break;case"interval":this.model.interval=n[i];break;case"cssClass":this._changeSkin(n[i]);break;case"showRoundedCorner":this._setRoundedCorner(n[i]);break;case"enableRTL":this._setRtl(n[i]);break;case"height":this._setHeight(n[i]);break;case"width":this.wrapper.width(n[i]);this._setListWidth();break;case"value":t.isPlainObject(n[i])&&(n[i]=null);this.model.value=t.format(this._createObject(n[i],!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(n[i],!0)&&(s=this._isValid(n[i])?this._localizeTime(n[i]):n[i],this.element.val(s));n[i]=this.model.value;r=!0;break;case"enableStrictMode":this.model.enableStrictMode=n[i];break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initTimeValidator(),this._setTimeValidation());break;case"validationMessages":this.model.validationMessages=n[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initTimeValidator(),this._setTimeValidation());break;case"popupHeight":this.model.popupHeight=n[i];this._setListHeight();break;case"popupWidth":this.model.popupWidth=n[i];this._setListWidth();break;case"enabled":n[i]?this.enable():this.disable();break;case"htmlAttributes":this._addAttr(n[i]);break;case"disableTimeRanges":this.model.disableTimeRanges=n[i];this._initStartEnd();this.model.value=t.format(this._createObject(this.element.val(),!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(this.element.val(),!0)&&this.element.val(this.element.val());r=!0}t.isNullOrUndefined(n.minTime)&&t.isNullOrUndefined(n.maxTime)||(this._setMinMaxTime(o,n),r=!0);t.isNullOrUndefined(n.showPopupButton)?!this.model.showPopupButton||!e&&t.isNullOrUndefined(n.minTime)&&t.isNullOrUndefined(n.maxTime)&&t.isNullOrUndefined(n.locale)&&t.isNullOrUndefined(n.interval)&&t.isNullOrUndefined(n.disableTimeRanges)||this._reRenderDropdown():this._showButton(n[i]);r&&(this._raiseChangeEvent(o,!0),n.value=this.model.value);this._checkErrorClass()},_destroy:function(){this.element.insertAfter(this.wrapper);this.wrapper.remove();this.element.removeClass("e-input").removeAttr("ondragstart draggable aria-atomic aria-live aria-readonly").val(this.element.attr("value"));this._cloneElement.attr("name")||this.element.removeAttr("name");this.popupList&&this.popupList.remove()},_initialize:function(){this.target=this.element[0];this.timeIcon=null;this._disabledItems=[];this.popupList=null;this.focused=!1;this.start=0;this.end=0;this.min=null;this.max=null;this.incomplete=!1;this.downPosition=0;this._setLocalize(this.model.locale);this._setMinMax();this._getAmPm();this.showDropdown=!1;this._activeItem=0;this.isValidState=!0;this._manualFocus=!1;this._isIE7=this._checkIE7();this._initStartEnd();t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value);this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._getInternalEvents=!1;this._dateTimeInternal=!1;this.model.timeFormat?this.seperator=this._getSeperator():this._getTimeFormat()},_render:function(){this._renderWrapper();this._setDimentions();this._renderTimeIcon();this._validateTimes();this._createMinMaxObj();this._renderDropdown();this._addAttr(this.model.htmlAttributes);this._checkProperties();this._enableMask();this._checkErrorClass();this.element.attr({"aria-atomic":"true","aria-live":"assertive","aria-readonly":this.model.readOnly,value:this.model.value});(this.model.showPopupButton||!t.isNullOrUndefined(this.popupList))&&this.ul.find("li").attr({tabindex:-1,"aria-selected":!1});t.isNullOrUndefined(this.model.value)?this.wrapper.addClass("e-valid"):this.wrapper.removeClass("e-valid")},_renderWrapper:function(){this.element.addClass("e-input").attr("tabindex","0");this.wrapper=t.buildTag("span.e-timewidget e-widget "+this.model.cssClass+"#"+this.target.id+"_timewidget").insertAfter(this.element);this.wrapper.attr("style",this.element.attr("style"));this.element.removeAttr("style");t.isTouchDevice()||this.wrapper.addClass("e-ntouch");this.container=t.buildTag("span.e-in-wrap e-box").append(this.element);this.wrapper.append(this.container)},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r.disable():u=="readOnly"&&n=="readOnly"?r.model.readOnly=!0:u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_initTimeValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setTimeValidation:function(){var r,i,u,f;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_renderTimeIcon:function(){if(this.model.showPopupButton){this.timeIcon=t.buildTag("span.e-select").attr({role:"button","aria-label":"select"});var n=t.buildTag("span.e-icon e-clock").attr("role","presentation");this._isIE8&&(this.timeIcon.attr("unselectable","on"),n.attr("unselectable","on"));this.timeIcon.append(n);this.container.append(this.timeIcon).addClass("e-padding");this._on(this.timeIcon,"mousedown",this._timeIconClick)}},_elementClick:function(){this.showDropdown||this._showResult()},_renderDropdown:function(){var i=n("#"+this.element[0].id+"_popup").get(0),r;if(i&&n(i).remove(),!this.model.showPopupButton||this.popupList)return!1;this.popupList=t.buildTag("div.e-time-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.target.id+"_popup","",{},{tabindex:0,"aria-activedescendant":""});t.isTouchDevice()||this.popupList.addClass("e-ntouch");this.popup=this.popupList;this.ul=t.buildTag("ul.e-ul");this._isIE8&&this.ul.attr("unselectable","on");r=t.buildTag("div").append(this.ul);n("body").append(this.popupList.append(r));this._renderLiTags();this._setListHeight();this._setListWidth();this.popupList.ejScroller({height:this.popupList.height(),width:0,scrollerSize:20});this.scrollerObj=this.popupList.ejScroller("instance");this.popupList.css("display","none");this._listSize=this.ul.find("li").length},_renderLiTags:function(){var r,o,f,s,h,e,i,u;for(this._disabledItems=[],s=this.model.interval*6e4,h=!t.isNullOrUndefined(this.model.disableTimeRanges)&&this.model.disableTimeRanges.length>0?!0:!1,r=this._minTimeObj,o=this._maxTimeObj,e=0;this._compareTime(o,r,!0);)f=this._localizeTime(r),i=n(document.createElement("li")),i[0].appendChild(document.createTextNode(f)),this._isIE8&&i.attr("unselectable","on"),h&&(this._ensureTimeRange(f)?(i.addClass("e-disable"),this._disabledItems.push(e)):i.removeClass("e-disable")),this.ul[0].appendChild(i[0]),r=new Date(r).getTime()+s,e++;u=this.ul.find("li");t.isTouchDevice()||(this._on(u,"mouseenter",n.proxy(this._OnMouseEnter,this)),this._on(u,"mouseleave",n.proxy(this._OnMouseLeave,this)));this._on(u,"click",n.proxy(this._OnMouseClick,this))},_ensureTimeRange:function(n){if(!t.isNullOrUndefined(this.model.disableTimeRanges)){var r=this._makeDateTimeObj(n);for(i=0;i<this.model.disableTimeRanges.length;i++)if(+r>=+this._makeDateTimeObj(this.model.disableTimeRanges[i].startTime)&&+r<=+this._makeDateTimeObj(this.model.disableTimeRanges[i].endTime))return!0}return!1},_initStartEnd:function(){if(this._startTime=[],this._endTime=[],!t.isNullOrUndefined(this.model.disableTimeRanges))for(i=0;i<this.model.disableTimeRanges.length;i++)this._startTime[i]=this._makeDateTimeObj(this.model.disableTimeRanges[i].startTime),this._endTime[i]=this._makeDateTimeObj(this.model.disableTimeRanges[i].endTime)},_makeDateTimeObj:function(n){var u;if(typeof n=="string"){var r=t.preferredCulture(this.model.locale).calendar.patterns.d,f=t.format(new Date("1/1/2000"),r,this.model.locale),i=t.parseDate(f+" "+n,r+" "+this.model.timeFormat);if(!i)if(u=new Date(n),isNaN(Date.parse(u))||t.isNullOrUndefined(n))i=new Date("1/1/2000 "+n);else return this._setEmptyDate(n);return i}return n instanceof Date?this._setEmptyDate(n):null},_reRenderDropdown:function(){this.ul.empty();this._renderLiTags();this._refreshScroller();this._changeActiveEle()},_refreshScroller:function(){var t=this.popupList.css("display")=="none"?!0:!1;this.popupList.css("height","auto");this.popupList.find(".e-content, .e-vscroll").removeAttr("style");this.popupList.find(".e-vscroll div").removeAttr("style");t&&this.popupList.css("display","block");this.scrollerObj.model.height=this.popupList.height();this.scrollerObj.model.scrollTop=0;this.scrollerObj.refresh();this._isIE8&&(n("#"+this.scrollerObj._id).children(".e-vscroll").children().attr("unselectable","on"),n("#"+this.scrollerObj._id).find(".e-vhandle").attr("unselectable","on"));t&&this.popupList.css("display","none")},_setListWidth:function(){if(this.popupList){var n=this.model.popupWidth;n&&n!="auto"?this.popupList.css({width:n}):this.popupList.css({width:this.wrapper.width()})}this.scrollerObj&&(this._refreshScroller(),this._updateScrollTop())},_setListHeight:function(){this.popupList&&this.popupList.css({"max-height":this.model.popupHeight||"191px"});this.scrollerObj&&(this._refreshScroller(),this._updateScrollTop())},_updateScrollTop:function(){this.scrollerObj.setModel({scrollTop:this._calcScrollTop()})},_refreshPopup:function(){this.model.popupWidth=="auto"&&this.popupList.css({width:this.wrapper.width()});this._setListPosition();this._refreshScroller()},_setListPosition:function(){var t=this.wrapper,i=this._getOffset(t),f,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),u=this.popupList.outerHeight(),e=this.popupList.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(u<h||u>c?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e<r+t.outerWidth())&&(r-=this.popupList.outerWidth()-t.outerWidth());this.popupList.css({left:r+"px",top:v+"px","z-index":a})},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popupList)},_enableMask:function(){this.isValidState=this.model.minTime&&this._compareTime(this.model.minTime,this.model.value)||this.model.maxTime&&this._compareTime(this.model.value,this.model.maxTime)?!1:!0;this._setTime(this.model.value);t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid");this._getInternalEvents&&!this.isValidState&&this._trigger("outOfRange");this._changeActiveEle();this._preVal=this.element.val()},_setTime:function(n){var t=this._localizeTime(n);this.element.val(t);this.model.value=this.model.enableStrictMode?this._compareTime(this.model.value,this.model.minTime)&&this._compareTime(this.model.maxTime,this.model.value)?t:null:t},_timeFromISO:function(n){var i=this._extISORegex.exec(n)||this._basicISORegex.exec(n),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e<this._dates.length;e++)if(this._dates[e][1].exec(i[1])){c=this._dates[e][0];break}if(i[3])for(o=0;o<this._times.length;o++)if(this._times[o][1].exec(i[3])){l=(i[2]||" ")+this._times[o][0];break}for(i[4]&&this._zeroRegex.exec(i[4])&&(a="Z"),v=c+l+a,f=v.match(this._tokens),t=[],u=0;u<f.length;u++)h=f[u],s=this._checkLiteral(f[u]),y=this._numberRegex[s?f[u].toLowerCase():h.length]||new RegExp("^\\d{1,"+h.length+"}"),r=n.match(y),r&&(n.substr(0,n.indexOf(r))>=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){return char=n.toLowerCase(),char=="t"||char=="z"||char==":"||char=="-"?!0:!1},_setMask:function(){this.model.value=new Date;this._enableMask()},_validateTimes:function(){var n=this._validateTimeFormat(this.model.timeFormat);this.model.timeFormat=n?n:"h:mm tt";this._isValid(this.model.minTime)||(this.model.minTime="12:00 AM");this._isValid(this.model.maxTime)||(this.model.maxTime="11:59 PM");this._isValid(this.model.value,!0)||(this.model.value=null);this._checkMinMax(this.model.value)||this.model.enableStrictMode||(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime));this._validateMinMax()},_ensureValue:function(){!this._checkMinMax(this.model.value)&&this._isValid(this.model.value,!0)&&(this.model.enableStrictMode?this.isValidState=!1:(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime)))},_validateMinMax:function(){this.model.minTime&&this.model.maxTime&&this._compareTime(this.model.minTime,this.model.maxTime)&&(this.model.minTime=this.model.maxTime)},_checkProperties:function(){this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable());this._addProperty();this._checkAttributes()},_addProperty:function(){this._setRtl(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner)},_setRtl:function(n){n?(this.wrapper.addClass("e-rtl"),this.popupList&&this.popupList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popupList&&this.popupList.removeClass("e-rtl"))},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popupList&&this.popupList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popupList&&this.popupList.removeClass("e-corner"))},_showButton:function(t){this.model.showPopupButton=t;t?(this.container.addClass("e-padding"),this._renderTimeIcon(),this._renderDropdown(),this._addProperty()):(this.container.removeClass("e-padding"),this.timeIcon.remove(),this.popupList.remove(),this.timeIcon=this.popupList=null,n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)))},_checkAttributes:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id});"ondragstart"in document.createElement("input")&&this.element.attr({ondragstart:"return false"});"draggable"in document.createElement("input")&&this.element.attr({draggable:"false"})},_getAmPm:function(){var t=new Date;t.setHours(0);this.ttAM=n.trim(this._localizeMeridian(t));t.setHours(23);this.ttPM=n.trim(this._localizeMeridian(t))},_setDimentions:function(){this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this._setHeight(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_setHeight:function(n){n&&this.wrapper.height(n);this._isIE7&&this.element.height(this.container.height())},_validateTimeFormat:function(t){var i=t.split(" "),r="";return i.length==1||i.length==2?(n(i).each(function(t,i){r+=n.trim(i)+" "}),n.trim(r)):null},_getSeperator:function(){for(var i=this._getElePlace(),t=this.model.timeFormat.split(" ")[i.time],r=new RegExp("^[a-zA-Z0-9]+$"),n=0;n<t.length;n++)if(!r.test(t.charAt(n)))return t.charAt(n)},_checkInComplete:function(){var i=this._getCaretSelection(),r=this._getStartEnd(i),u="00",t=this._getSelectedValue(r),n=this._getCategory(r);i.end-i.start==this.element.val().length&&this._checkAll();n&&n!="tt"&&(this._findCategoryPosition(n),t=="__"?((n=="h"||n=="hh")&&(u="12"),this._changeToDefault(u)):n.length!=1&&t.length==1&&(t=this._changeWhole(t),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t))))},_checkAll:function(){for(var r=this._getElePlace(),i=this.model.timeFormat.split(" ")[r.time].split(this.seperator),t,n=0;n<i.length;n++)this._findCategoryPosition(i[n]),t=this._getSelectedValue({start:this.start,end:this.end}),i[n].length!=1&&t.length==1&&(t=this._changeWhole(t),this.element.val(this._replaceAt(this.element.val(),this.start,this.end,t)))},_changeToDefault:function(n){var i,t;this.incomplete=!0;i=this.element[0].value;this.element[0].value=this._replaceAt(this.target.value,this.start,this.end,n);t=this._checkExceedRange(this.target.value);!t||this._setTime(this.model[t]);this._setSelection(this.start,this.end);this._raiseChangeEvent(i)},_setSelection:function(n,t){var i=this.element[0];i.setSelectionRange?i.setSelectionRange(n,t):i.createTextRange&&(i=i.createTextRange(),i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",n),i.select())},_getSelectedValue:function(n){return this.target.value.substring(n.start,n.end)},_getMinMax:function(n,t){n=="hh"||n=="h"?(this.min=1,this.max=11,t&&(this.max=12)):n=="HH"||n=="H"?(this.min=0,this.max=23):(n=="mm"||n=="m"||n=="ss"||n=="s")&&(this.min=0,this.max=59)},_focusElement:function(){this._manualFocus=!0;this.element.focus()},_targetFocus:function(t){this._clearRange();t.preventDefault();this.focused=!0;this.element.on("mousewheel DOMMouseScroll",n.proxy(this._mouseWheel,this));this.wrapper.addClass("e-focus").removeClass("e-error").attr("aria-invalid","false");this._manualFocus||(this._findCategoryPosition(this._getLeast(!1)),this._setSelection(this.start,this.end));this._manualFocus=!1;this._prevTimeVal=this.element.val();this._raiseEvent("focusIn");this.wrapper.addClass("e-valid")},_targetBlur:function(){this.focused=!1;this.element.off("mousewheel DOMMouseScroll",n.proxy(this._mouseWheel,this));this.wrapper.removeClass("e-focus");this.model.enableStrictMode||this.target.value.indexOf("_")>-1&&this.element.val("");!this._checkMinMax(this.target.value)&&this._isValid(this.target.value,!0)?this.model.enableStrictMode?this.isValidState=!1:(this.model.minTime&&!this._compareTime(this._createObject(this.target.value),this.model.minTime,!0)&&this.element.val(this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this._createObject(this.target.value),!0)&&this.element.val(this.model.maxTime),this._isValid(this.model.value,!0)||this.element.val(null),this.isValidState=!0,t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")):this.isValidState=!0;this._ensureValue();this._raiseChangeEvent();this._checkErrorClass();this._raiseEvent("focusOut");this.model.enableStrictMode||this._checkInComplete();t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")},_clearRange:function(){var n=this.element[0];isNaN(n.selectionStart)||(n.selectionStart=0,n.selectionEnd=0)},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error").attr("aria-invalid","false"):this.wrapper.addClass("e-error").attr("aria-invalid","true")},_getCaretSelection:function(){var n=this.element[0],u=0,f=0,e,t,i,r,o;return isNaN(n.selectionStart)?(e=document.selection.createRange().getBookmark(),t=n.createTextRange(),t.moveToBookmark(e),i=n.createTextRange(),i.collapse(!0),i.setEndPoint("EndToStart",t),r=i.text.length,o=t.text.length,{start:r,end:r+o}):(u=n.selectionStart,f=n.selectionEnd,{start:Math.abs(u),end:Math.abs(f)})},_mouseDownOnInput:function(){this.focused||t.isTouchDevice()||this._focusElement();this.downPosition=this._getCaretSelection();n(document).on("mouseup",n.proxy(this._mouseUpOnInput,this))},_mouseUpOnInput:function(t){t.preventDefault();n(document).off("mouseup",n.proxy(this._mouseUpOnInput,this));var i=this._getCaretSelection();this.incomplete&&(this.incomplete=!1,i=this.downPosition);this.target.value!=this._getSelectedText()&&(i=this._getStartEnd(i),this._setSelection(i.start,i.end))},_getCategoryPosition:function(n){var i=0,r=0,u=this.target.value.split(" "),t=this._getElePlace(),h=this.seperator,e=!1,o=this.model.timeFormat.split(" ")[t.time].split(h),c=u[t.time].split(h),s,f;if(o.length>c.length)return{start:i,end:r,isValid:e};if(n=="tt")(u[t.tt]==this.ttAM||u[t.tt]==this.ttPM)&&(i=t.tt==0?0:u[t.time].length+1,r=i+u[t.tt].length,e=!0);else if(i=t.time==0?0:u[t.tt].length+1,s=o.indexOf(n),s!=-1){for(f=0;f<o.length;f++)if(r=c[f].length+1,f==s)break;else i+=r;r+=i-1;e=!0}return{start:i,end:r,isValid:e}},_getCategory:function(n){var t=this.model.timeFormat.split(" "),r=this.seperator,i=this._getElePlace();return n.isTT?t[i.tt]:t[i.time].split(r)[n.index]},_getStartEnd:function(n){for(var s=this.seperator,h=this.element.val(),i=h.split(" "),r=0,f=0,e=tt=null,u,t=0;t<i.length;t++)if(i[t]!=this.ttAM&&i[t]!=this.ttPM){var o=i[t].split(s),c=r,l=r+o[0].length;for(u=0;u<o.length;u++)if(f=o[u].length+r,n.start<=f){e=u;tt=!1;t=i.length;break}else r+=o[u].length+1}else if(n.start<=r+i[t].length){f=i[t].length+r;e=0;tt=!0;t=i.length;break}else r+=i[t].length+1;return e==null&&(r=c,f=l,e=0,tt=!1),{start:r,end:f,index:e,isTT:tt}},_modifyValue:function(n){var i,t,r,u;this._isValid(this.target.value)&&(this.model.enableStrictMode||this._checkInComplete(),i=this._getCaretSelection(),i.start==i.end?(r=this._getLeast(!0),u=this._getCategoryPosition(r),t=this._getStartEnd(u)):t=this._getStartEnd(i),this.start=t.start,this.end=t.end,this._changeValue(t,n))},_keyUpOnInput:function(n){n.preventDefault();this._preVal!=this.element.val()&&(this._preVal=this.element.val())},_getNextCategory:function(t,i){var r=[],e=this.seperator,o=this.model.timeFormat.split(" "),u,f;return(n(o).each(function(n,t){if(t=="tt")r.push(t);else{var i=t.split(e);r=i.concat(r)}}),u=r.indexOf(t),u!=-1)?(f=i?u==0?r.length-1:u-1:u==r.length-1?0:u+1,r[f]):t},_getElePlace:function(){var i=this.model.timeFormat.split(" "),n,t;return i[0]=="tt"?(n=1,t=0):(n=0,t=1),{time:n,tt:t}},_movePosition:function(n,t){var i=this._getStartEnd(n),r=this._getCategory(i),u;r||(r=this._getLeast(t));u=this._getNextCategory(r,t);i=this._getCategoryPosition(u);i.isValid&&this._setSelection(i.start,i.end)},_findActiveIndex:function(){var t=this.ul.find("li"),i=this.element.val(),r=t.first().html(),n;n=(this._parse(i)-this._parse(r))/(this.model.interval*6e4);n=Math.round(n);this._activeItem=n==t.length?n:n+1;(this._activeItem<0||this._activeItem>t.length||isNaN(this._activeItem))&&(this._activeItem=0)},_keyDownOnInput:function(n){var t,u,i,b,h,k,c,e,v,y,d,l,o,g,a,p,f,w,s,r;if(this.model.readOnly&&!this._readOnlyKeys(n)||(i=n.keyCode,this._getInternalEvents&&i!=38&&i!=40&&i!=36&&i!=35&&i!=9))return!1;if(!this.model.enableStrictMode){if(this.showDropdown&&i!=38&&i!=40&&i!=27&&!this._readOnlyKeys(n))return!1;this.showDropdown&&(i==37||i==39)&&(n.keyCode=i==37?38:40)}t=this._getCaretSelection();r=this._getStartEnd(t);u=this._getCategory(r);switch(n.keyCode){case 38:n.preventDefault();this.showDropdown?this.showDropdown&&(n.preventDefault(),this._findActiveIndex(),prevActiveItem=this._activeItem,this._activeItem=this._disableItemSelectUp(this._activeItem-1),this._activeItem==0&&(this._activeItem=prevActiveItem),this._addListHover(),activeItem=this._getActiveItem(),activeItem.length&&this._selectTimeItem(activeItem)):this._isValid(this.target.value)&&this._modifyValue(!0);break;case 40:n.preventDefault();n.altKey&&this.model.showPopupButton?this._showhidePopup():this.showDropdown?this.showDropdown&&(n.preventDefault(),this._findActiveIndex(),prevActiveItem=this._activeItem,this._activeItem=this._disableItemSelectDown(this._activeItem),this._activeItem<this._listSize?this._activeItem+=1:this._activeItem=prevActiveItem,this._addListHover(),this._selectTimeItem(this._getActiveItem())):this._isValid(this.target.value)&&this._modifyValue(!1);break;case 37:n.preventDefault();t.start==t.end?this._setSelection(t.start-1,t.start-1):this._movePosition(t,!0);break;case 39:n.preventDefault();t.start==t.end?this._setSelection(t.start+1,t.start+1):this._movePosition(t,!1);break;case 36:n.preventDefault();this.showDropdown?(this._activeItem=0,prevActiveItem=this._activeItem,this._activeItem=this._disableItemSelectDown(this._activeItem),this._activeItem<this._listSize?this._activeItem+=1:this._activeItem=prevActiveItem,this._addListHover(),this._selectTimeItem(this._getActiveItem())):(b=this._firstlastVal(!0),h=this._getCategoryPosition(b),h.isValid&&this._setSelection(h.start,h.end));break;case 35:n.preventDefault();this.showDropdown?(this._activeItem=this._listSize+1,prevActiveItem=this._activeItem,this._activeItem=this._disableItemSelectUp(this._activeItem-1),this._activeItem==0&&(this._activeItem=prevActiveItem),this._addListHover(),this._selectTimeItem(this._getActiveItem())):(k=this._firstlastVal(!1),c=this._getCategoryPosition(k),c.isValid&&this._setSelection(c.start,c.end));break;case 9:if(this._getInternalEvents)break;this._hideResult();e=null;n.shiftKey&&t.start>0?e=!0:!n.shiftKey&&t.end<this.element.val().length&&(e=!1);e!=null&&(n.preventDefault(),this._checkInComplete(),this._movePosition(t,e));break;case 13:if(!this.showDropdown){this._raiseChangeEvent();break}case 27:n.preventDefault();this._hideResult();break;case 8:case 46:if(this.model.enableStrictMode)return;this.target.value!=this._getSelectedText()&&(n.preventDefault(),u&&u!="tt"&&(this._findCategoryPosition(u),v=i==8&&t.start!=this.start,y=i==46&&t.end!=this.end,d=this.end-this.start,(t.start!=t.end||d==1)&&(v||y||t.start!=t.end)?(l=this.start,o=this.end,this.element[0].value=this._replaceAt(this.target.value,l,o,"__"),g=o-l!=2?o+1:o,this._setSelection(l,g)):v?(this.element[0].value=this._replaceAt(this.target.value,t.start-1,t.start,""),this._setSelection(t.start-1,t.start-1)):y&&(this.element[0].value=this._replaceAt(this.target.value,t.end,t.end+1,""),this._setSelection(t.end,t.end))))}a=this._getSelectedValue(r);p=n.keyCode?n.keyCode:n.charCode;n.keyCode>47&&n.keyCode<58?f=String.fromCharCode(p):n.keyCode>95&&n.keyCode<106&&(f=String.fromCharCode(p-48));u=="tt"&&(!n.shiftKey&&!n.ctrlKey&&!n.altKey&&n.keyCode>64&&n.keyCode<91||n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106)&&(n.preventDefault(),w=this._getCategoryPosition(u),this.start=w.start,this.end=w.end,this._changeAmPm(a),this._raiseChangeEvent());this.target.value!=this._getSelectedText()||n.shiftKey||n.ctrlKey||n.altKey||(n.keyCode>64&&n.keyCode<91&&!this.model.enableStrictMode&&n.preventDefault(),(n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106)&&(r=this._getStartEnd(t),this._setSelection(r.start,r.end)));!n.shiftKey&&!n.ctrlKey&&!n.altKey&&n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106?u!="tt"&&(this._getMinMax(u,!0),t.start==t.end?(this._findCategoryPosition(u),t.start==this.start?(s=f+a,this.element.val(this.model.minTime),r=this._getStartEnd(t),this._setSelection(r.start,r.end)):s=a+f,(s.length>2||!(Number(s)>=this.min&&this.max>=Number(s)))&&(this.model.enableStrictMode||n.preventDefault())):Number(f)>=this.min&&this.max>=Number(f)||this.model.enableStrictMode||n.preventDefault()):this._allowKeyCodes(n)||(this.model.enableStrictMode?n.stopPropagation():n.keyCode==8||n.keyCode==46?n.stopPropagation():n.preventDefault())},_getSelectedText:function(){if(window.getSelection){var t=n("#"+this.element[0].id).get(0);return t.value.substring(t.selectionStart,t.selectionEnd)}return document.selection.createRange().text},_allowKeyCodes:function(n){return n.ctrlKey&&(n.keyCode==65||n.keyCode==67||n.keyCode==90||n.keyCode==89)||n.keyCode==9||n.keyCode==116||n.keyCode==13?!0:!1},_readOnlyKeys:function(n){return n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39||this._allowKeyCodes(n)?!0:!1},_firstlastVal:function(n){var t=this.model.timeFormat.split(" "),r=this.seperator,i;return n?t[0]!="tt"?t[0].split(r)[0]:"tt":t[0]!="tt"?"tt":t[1]?(i=t[1].split(r),i.length?i[i.length-1]:"tt"):"tt"},_mouseWheel:function(n){if(n.preventDefault(),this.model.readOnly)return!1;var t,i=n.originalEvent;i.wheelDelta?t=i.wheelDelta/120:i.detail&&(t=-i.detail/3);t>0?this._modifyValue(!0):t<0&&this._modifyValue(!1)},_addListHover:function(){this._addSelected();this._updateScrollTop()},_addSelected:function(){this.ul.find("li").removeClass("e-active e-hover");var n=this._getActiveItem();n.length&&!n.hasClass("e-disable")&&n.addClass("e-active")},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t<this._listSize?n.inArray(t,this._disabledItems)<0?t:this._disableItemSelectDown(t+1):this._listSize},_disableItemSelectUp:function(t){if(t=t-1,(t==null||t<0)&&(t=0),t<this._listSize){if(n.inArray(t,this._disabledItems)<0)return t+1;if(t>0)return this._disableItemSelectUp(t)}return 0},_getActiveItem:function(){return n(this.ul.find("li")[this._activeItem-1])},_timeIconClick:function(n){var i=!1,r;if(n.button?i=n.button==2:n.which&&(i=n.which==3),!i){if(n.preventDefault(),!this.model.enabled||this.model.readOnly||this.ul.find("li").length<1)return!1;this._showhidePopup();r=this.element.val().length;t.isTouchDevice()||this._setSelection(r,r)}},_showhidePopup:function(){if(this._getInternalEvents)return!1;this.showDropdown?this._hideResult():this._showResult()},_showResult:function(){this._raiseEvent("beforeOpen");this._refreshPopup();this.focused||t.isTouchDevice()||this._focusElement();this.model.value?this._changeActiveEle():this.ul.find("li").removeClass("e-active");var i=this,r=this._vissibleAndCalculateTop();this.popupList.slideDown(this.model.enableAnimation?200:0,function(){n(document).on("mousedown",n.proxy(i._OnDocumentClick,i))});this.scrollerObj.setModel({scrollTop:r});this.showDropdown=!0;this._listSize=this.ul.find("li").length;n(window).on("resize",n.proxy(this._OnWindowResize,this));this._on(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._on(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult);this._raiseEvent("open");this.wrapper.addClass("e-active")},_hideResult:function(){this.showDropdown&&!this._getInternalEvents&&(this.showDropdown=!1,this.popupList.slideUp(this.model.enableAnimation?100:0),n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this._off(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult),this._raiseEvent("close"),this.wrapper.removeClass("e-active"))},_vissibleAndCalculateTop:function(){this.popupList.css({display:"block"});var n=this._calcScrollTop();return this.popupList.css({display:"none"}),n},_calcScrollTop:function(){var i=this.ul.outerHeight(),n=this.ul.find("li").outerHeight(),t;return t=this.ul.find("li.e-active").index(),n*t-(this.popupList.outerHeight()-n)/2},_changeActiveEle:function(){if(!this.model.showPopupButton||!this.popupList)return!1;var t=this.ul.find("li"),i=this.element.val(),r=t.first().html(),n;n=(this._parse(i)-this._parse(r))/(this.model.interval*6e4);n=Math.round(n);this._activeItem=n==t.length?n:n+1;(this._activeItem<0||this._activeItem>t.length||isNaN(this._activeItem)||this._ensureTimeRange(i))&&(this._activeItem=0);this._addListHover()},_OnDocumentClick:function(t){n(t.target).is(this.popupList)||n(t.target).parents(".e-time-popup").is(this.popupList)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-timewidget").is(this.wrapper)?(n(t.target).is(this.popupList)||n(t.target).parents(".e-time-popup").is(this.popupList))&&t.preventDefault():this._hideResult()},_OnWindowResize:function(){this._refreshPopup()},_OnMouseEnter:function(t){var i=t.target;this.ul.find("li").removeClass("e-hover");n(i).hasClass("e-disable")||n(i).addClass("e-hover")},_OnMouseLeave:function(){(!this._dateTimeInternal||this.model.value)&&this.ul.find("li").removeClass("e-hover")},_OnMouseClick:function(t){(t.preventDefault(),n(t.target).hasClass("e-disable"))||(this.model.enabled&&!this.model.readOnly&&(this._activeItem=n(t.target).index()+1,this.ul.find("li").attr({tabindex:-1,"aria-selected":!1}),n(t.target).attr({"aria-selected":!0,tabindex:0}),this._addSelected(),this._selectTimeItem(n(t.target))),this._showhidePopup())},_selectTimeItem:function(n){this._beforeChange(n);var t=this._raiseChangeEvent();t&&this._trigger("select",{value:this.model.value,prevTime:this._previousValue})},_findCategoryPosition:function(n){n=="least"&&(n=this._getLeast(!0));var t=this._getCategoryPosition(n);this.start=t.start;this.end=t.end},_getLeast:function(t){var r=this.model.timeFormat.split(" "),u=this.seperator,i=null;return n(r).each(function(n,r){if(r!="tt"){var f=r.split(u);i=t?f[f.length-1]:f[0]}}),i},_changeValue:function(n,r){var l=this.target.value,u,f=this._getCategory(n),o;if(!f)return!1;if(this._setSelection(this.start,this.end),u=this.target.value.substring(this.start,this.end),this._checkMinMax(this.target.value))if(u!=this.ttAM&&u!=this.ttPM){if(u=this._changeCurrentValue(u,f,r),f.length!=1&&(u=this._changeWhole(u)),this._findCategoryPosition(f),this.element.val(this._replaceAt(this.target.value,this.start,this.end,u)),this.end=this.start+u.toString().length,this._setSelection(this.start,this.end),this._ensureTimeRange(this.target.value)&&this._checkMinMax(this.target.value)){var e=this._createObject(this.target.value),s=e.getHours(),h=r?this._startTime:this._endTime,c=r?this._endTime:this._startTime;if(!t.isNullOrUndefined(this.model.disableTimeRanges))for(i=0;i<this.model.disableTimeRanges.length;i++)(h[i].getHours()===s||+e>=+this._startTime[i]&&+e<=+this._endTime[i])&&(this.target.value=this._localizeTime(c[i]),this._setSelection(this.start,this.end),this._changeValue(n,r))}}else this._changeAmPm(u);else o=this._checkExceedRange(this.target.value),this._setTime(this.model[o]),this._findCategoryPosition(f),this._setSelection(this.start,this.end);this._checkMinMax(this.target.value)?this._raiseChangeEvent():(this.element.val(this.model.value),this._findCategoryPosition(f),this._setSelection(this.start,this.end))},_checkMinMax:function(n){var t=this._checkExceedRange(n);return t==null&&(t=!1),!t},_checkExceedRange:function(n){if(n){if(this.model.minTime&&!this._compareTime(n,this.model.minTime,!0))return"minTime";if(this.model.maxTime&&!this._compareTime(this.model.maxTime,n,!0))return"maxTime"}return null},_changeWhole:function(n){return n>9?""+n:"0"+n},_changeAmPm:function(n){n=n==this.ttAM?this.ttPM:this.ttAM;this.element.val(this._replaceAt(this.target.value,this.start,this.end,n));this._setSelection(this.start,this.end)},_changeMinute:function(n){var i=this._getExactFormat(["mm","m"]),t;i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),n?t==this.max?(t=this.min,this._changeHour(n)):t+=1:t==this.min?(t=this.max,this._changeHour(n)):t-=1,this._findCategoryPosition(i),i.length!=1&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_changeHour:function(n){var i=this._getExactFormat(["hh","h","HH","H"]),t;i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),n?t==this.max?(t+=1,this._changeMeridian()):t>this.max?t=this.min:t+=1:t==this.min?t=this.max+1:t>this.max?(t=this.max,this._changeMeridian()):t-=1,this._findCategoryPosition(i),i.length!=1&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_getExactFormat:function(n){for(var i=this.model.timeFormat,t=0;t<n.length;t++)if(i.indexOf(n[t])!=-1)return n[t];return null},_changeMeridian:function(){var t=this.model.timeFormat.indexOf("tt"),n;t!=-1&&(this._findCategoryPosition("tt"),n=this.target.value.substring(this.start,this.end),n=n==this.ttAM?this.ttPM:this.ttAM,this.element.val(this._replaceAt(this.target.value,this.start,this.end,n)))},_changeCurrentValue:function(n,t,i){n=Number(n);var r=t,u=1,f=!0;return(this._getMinMax(r),r=="hh"||r=="h"||r=="HH"||r=="H"?u=this.model.hourInterval:r=="mm"||r=="m"?u=this.model.minutesInterval:(r=="ss"||r=="s")&&(u=this.model.secondsInterval),u<=0)?n:(i?((r=="hh"||r=="h")&&n>this.max?n=this.min-1+u:n<this.max?n+=u:(f=!1,r!="hh"&&r!="h"?n=this.min-1+u:n+=u,this._changeAdjacent(r,i)),(r=="hh"||r=="h")&&n==this.max+1?f&&this._changeAdjacent(r,i):n>this.max+1&&(n=n-(this.max+1),f&&this._changeAdjacent(r,i)),r!="hh"&&r!="h"&&n==this.max+1&&(n=this.min,f&&this._changeAdjacent(r,i))):(r!="hh"&&r!="h"&&n>this.min?n-=u:(r=="hh"||r=="h")&&n>this.min&&n<=this.max?n-=u:(r=="hh"||r=="h")&&n==this.min?n=this.max+2-u:(f=!1,n=this.max+1-u,this._changeAdjacent(r,i)),n<this.min&&(n=n+(this.max+1),f&&this._changeAdjacent(r,i))),n)},_changeAdjacent:function(n,t){n=="ss"||n=="s"?this._changeMinute(t):n=="mm"||n=="m"?this._changeHour(t):(n=="hh"||n=="h"||n=="HH"||n=="H")&&this._changeMeridian()},_valueChange:function(){this._raiseChangeEvent()},_beforeChange:function(n){return this._raiseEvent("beforeChange")||this.element.val(n.text()),!0},_raiseChangeEvent:function(n,t){return(n=n===r?this.model.value:n,this._previousValue=n,current=this.target.value?this.target.value:null,n==current)?!1:(this.isValidState=this._checkMinMax(this.target.value)&&this._isValid(this.target.value,this.model.enableStrictMode)||!this.target.value?!0:!1,this.model.value=this._isValid(this.target.value,!0)&&this._checkMinMax(this.target.value)?this.target.value:null,this.model.value||this.model.enableStrictMode||this._setTime(this.model.value),this.model.value==this._previousValue)?!1:(this._raiseEvent("change",t),this._raiseEvent("_change",t),!0)},_raiseEvent:function(n,t){var i={value:this.model.value,prevTime:this._previousValue};return n=="change"&&(i.isInteraction=!t),this._trigger(n,i)},_checkIE7:function(){if(navigator.appName=="Microsoft Internet Explorer"){var t=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),n=-1;if(t.exec(navigator.userAgent)!=null&&(n=parseFloat(RegExp.$1)),n>=7&&n<8)return!0}return!1},_replaceAt:function(n,t,i,r){return n.substring(0,t)+r+n.substring(i)},_localizeTime:function(i){return i?n.trim(t.format(this._createObject(i),this.model.timeFormat,this.model.locale)):null},_localizeMeridian:function(i){return n.trim(t.format(i,"tt",this.model.locale))},_compareTime:function(n,t,i){return i=i?!0:!1,i?this._parse(n)>=this._parse(t):this._parse(n)>this._parse(t)},_isValid:function(n,t){return n=this._createObject(n,t),n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_parse:function(n){return Date.parse(this._createObject(n))},_setEmptyDate:function(n){var t=new Date(n);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_createObject:function(n,i){var r=null,f,e;if(typeof n=="string"){var o=this._setModelOption?this._preTimeformat:this.model.timeFormat,u=t.preferredCulture(this.model.locale).calendar.patterns.d,s=t.format(new Date("1/1/2000"),u,this.model.locale);r=t.parseDate(s+" "+n,u+" "+o,this.model.locale);(this._extISORegex.exec(n)||this._basicISORegex.exec(n))&&(this.model.value=r=this._timeFromISO(n));this._setModelOption=!1;r||(f=new Date(n),r=isNaN(Date.parse(f))||t.isNullOrUndefined(n)?!this._dateTimeInternal||n==""?null:new Date("1/1/2000 "+n):this._setEmptyDate(n))}else typeof n=="number"?r=new Date(n):n instanceof Date&&(r=this._setEmptyDate(n));return r&&!this._dateTimeInternal&&i&&(e=this._localizeTime(r),this._ensureTimeRange(e)&&(r=null)),r},_wireEvents:function(){this._on(this.element,"focus",this._targetFocus);this._on(this.element,"blur",this._targetBlur);this._on(this.element,"mousedown",this._mouseDownOnInput);this._on(this.element,"keydown",this._keyDownOnInput);this._on(this.element,"keyup",this._keyUpOnInput)}})}(jQuery,Syncfusion),function(n,t,r){t.widget("ejDateTimePicker","ej.DateTimePicker",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,_rootCSS:"e-datetimepicker",type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{cssClass:"",locale:"en-US",readOnly:!1,showRoundedCorner:!1,enableRTL:!1,htmlAttributes:{},allowEdit:!0,enabled:!0,value:"",name:null,minDateTime:new Date("1/1/1900 12:00:00 AM"),maxDateTime:new Date("12/31/2099 11:59:59 PM"),height:"",width:"",dateTimeFormat:"",showPopupButton:!0,enableStrictMode:!1,buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"},watermarkText:"Select datetime",enablePersistence:!1,interval:30,timeDisplayFormat:"",timePopupWidth:105,popupPosition:"bottom",dayHeaderFormat:"short",startLevel:"month",depthLevel:"",startDay:-1,stepMonths:1,showOtherMonths:!0,enableAnimation:!0,headerFormat:"MMMM yyyy",validationRules:null,validationMessage:null,validationMessages:null,timeDrillDown:{enabled:!1,interval:5,showMeridian:!1,autoClose:!0,showFooter:!0},beforeOpen:null,beforeClose:null,open:null,close:null,change:null,create:null,destroy:null,focusIn:null,focusOut:null},dataTypes:{allowEdit:"boolean",cssClass:"string",locale:"string",readOnly:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",enabled:"boolean",enableAnimation:"boolean",dateTimeFormat:"string",showPopupButton:"boolean",buttonText:"data",watermarkText:"string",enablePersistence:"boolean",enableStrictMode:"boolean",interval:"number",timeDrillDown:"data",timeDisplayFormat:"string",dayHeaderFormat:"string",startLevel:"string",depthLevel:"string",startDay:"number",stepMonths:"number",showOtherMonths:"boolean",headerFormat:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data"},_setModel:function(i){var r,f=!1,e,u,o;for(r in i)switch(r){case"allowEdit":this._changeEditable(i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"locale":this._localize(i[r]);break;case"readOnly":this._readOnly(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enableRTL":this._setRtl(i[r]);break;case"enabled":this._enabled(i[r]);break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"value":i[r]=this._setValue(i[r]);this._specificFormat()&&(this._stopRefresh=!0);f=!0;break;case"enableStrictMode":this.model.enableStrictMode=i[r];f=!0;break;case"minDateTime":u=this._stringToObject(i[r]);e=this._getFormat(u,this.timePicker.model.timeFormat);this._isValidDate(u)?(this.datePicker.option("minDate",u),this.timePicker.option("minTime",e),i[r]=u,this.model.minDateTime=u):i[r]=this.model[r];f=!0;break;case"maxDateTime":u=this._stringToObject(i[r]);o=this._getFormat(i[r],this.timePicker.model.timeFormat);this._isValidDate(u)?(this.datePicker.option("maxDate",u),this.timePicker.option("maxTime",o),i[r]=u,this.model.maxDateTime=u):i[r]=this.model[r];f=!0;break;case"height":this.wrapper.height(i[r]);break;case"width":this.wrapper.width(i[r]);break;case"dateTimeFormat":this.model.dateTimeFormat=i[r];this.isValidState&&this._setValue(this.model.value);break;case"showPopupButton":this._showButton(i[r]);break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options[r]=this.model.watermarkText=i[r];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"buttonText":t.isNullOrUndefined(this._options)||(this._options=[]);this._options.buttonText=this.model.buttonText=i[r];this._localizedLabels.buttonText=this.model.buttonText;this._buttonText(i[r]);break;case"interval":this._updateTimeHeight();this.timePicker.option("interval",i[r]);break;case"timeDisplayFormat":this._updateTimeHeight();this.timePicker.option("timeFormat",i[r]);break;case"timePopupWidth":this._updateTimeHeight();this.timePicker.option("popupWidth",i[r]);break;case"dayHeaderFormat":this.datePicker.option("dayHeaderFormat",i[r]);break;case"startLevel":this.datePicker.option("startLevel",i[r]);break;case"depthLevel":this.datePicker.option("depthLevel",i[r]);break;case"startDay":this.datePicker.option("startDay",i[r]);this.model.startDay=this.datePicker.model.startDay;i[r]=this.model.startDay;break;case"stepMonths":this.datePicker.option("stepMonths",i[r]);break;case"showOtherMonths":this.datePicker.option("showOtherMonths",i[r]);break;case"headerFormat":this.datePicker.option("headerFormat",i[r]);break;case"htmlAttributes":this._addAttr(i[r]);break;case"popupPosition":this.model.popupPosition=i[r];this._setListPosition();break;case"timeDrillDown":t.isNullOrUndefined(i[r].enabled)||(this.model.timeDrillDown.enabled=i[r].enabled,this._changeDesign());t.isNullOrUndefined(i[r].interval)||(this.model.timeDrillDown.interval=i[r].interval,this._generateMins(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale))));t.isNullOrUndefined(i[r].showMeridian)||(this.model.timeDrillDown.showMeridian=i[r].showMeridian,this._sfTimeHour.empty(),this._renderHourTable());t.isNullOrUndefined(i[r].showFooter)||(this.model.timeDrillDown.showFooter=i[r].showFooter,this._changeDesign())}f&&this._validateMinMax();this._valueChange(!0);r=="value"&&(i[r]=this.model.value);this._updateTimeHeight();this._checkErrorClass()},observables:["value"],_destroy:function(){this.isPopupOpen&&this._hideResult();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove());this._cloneElement.removeClass("e-js e-input").removeClass(t.util.getNameSpace(this.sfType));this._cloneElement.insertAfter(this.element);this.element.remove();t.isNullOrUndefined(this.datePicker)||this.datePicker.destroy();t.isNullOrUndefined(this.timePicker)||this.timePicker.destroy();this.popup.remove()},_init:function(n){if(!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this._options=n;this._cloneElement=this.element.clone();this._ISORegex();this._isSupport=document.createElement("input").placeholder==r?!1:!0;this._validateMeridian();this._checkAttribute();this._initialize();this._initial=!0;this._interval=60;this._render();this._wireEvents();this._addAttr(this.model.htmlAttributes);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());this._changeDesign();n&&n.value!=r&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_changeDesign:function(){if(this.model.timeDrillDown.enabled){var t=this.model.timeDrillDown.showFooter?"block":"none";this.popup.addClass("e-drill-down");this._timeContainer.css("display","none");this._buttonContainer.css("display","none");this.datePicker.option("showFooter",this.model.timeDrillDown.showFooter);n(".e-footer",this._sfTimeHour).css("display",t);n(".e-footer",this._sfTimeMins).css("display",t)}else this.popup.removeClass("e-drill-down"),this._sfTimeHour.hide(),this._sfTimeMins.hide(),this._updateTimeHeight(),this._dateContainer.show(),this._timeContainer.show(),this._buttonContainer.show(),this.datePicker.option("showFooter",!1),this.timePicker._refreshScroller(),this.timePicker._changeActiveEle()},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_checkAttribute:function(){this.model.value=this.model.value===""?this.element[0].value:this.model.value;this._options.minDateTime||(this.model.minDateTime=this.element[0].min);this._options.maxDateTime||(this.model.maxDateTime=this.element[0].max);t.isNullOrUndefined(this._options.readOnly)&&(this.model.readOnly=this.element.is("[readonly]"));t.isNullOrUndefined(this._options.enabled)&&(this.model.enabled=!this.element.is("[disabled]"))},_setValidation:function(){var r,i,u,f;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessages)i==f?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r._enabled(!1):u=="readOnly"&&n=="readOnly"?r._readOnly(!0):u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],u)?r.element.attr(u,n):r.wrapper.attr(u,n)})},_validateMeridian:function(){var n=t.preferredCulture(this.model.locale);n&&(this.model.locale=n.name=="en"?"en-US":n.name);t.isNullOrUndefined(this._options)?this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0:t.isNullOrUndefined(this._options.timeDrillDown)?this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0:t.isNullOrUndefined(this._options.timeDrillDown.showMeridian)&&(this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0)},_initialize:function(){var i,r,u,f;this.popup=null;this.isPopupOpen=!1;this.isValidState=!0;this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.buttonText)||n.extend(this._localizedLabels.buttonText,this._options.buttonText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this._localizedLabelToModel();this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._isIE9=t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0"?!0:!1;this.model.dateTimeFormat&&this.model.timeDisplayFormat||this._getDateTimeFormat();this.model.value&&(typeof JSON!="object"||JSON.stringify(this.model.value)!=="{}")?this.model.value instanceof Date?i=this.model.value:(r=t.parseDate(this.model.value,this.model.dateTimeFormat,this.model.locale),i=r?r:(r=this._checkJSONString(this.model.value))?r:null):i=null;i&&(this.model.value=i);u=this.model.minDateTime=this._stringToObject(this.model.minDateTime);u&&this._isValidDate(u)||(this.model.minDateTime=this.defaults.minDateTime);f=this.model.maxDateTime=this._stringToObject(this.model.maxDateTime);f&&this._isValidDate(f)||(this.model.maxDateTime=this.defaults.maxDateTime)},_checkJSONString:function(n){var t=new Date(n);if(isNaN(Date.parse(t))){if(this._extISORegex.exec(n)||this._basicISORegex.exec(n))return this._dateFromISO(n)}else{if(t.toJSON()===this.model.value||t.toGMTString()===this.model.value||t.toISOString()===this.model.value||t.toLocaleString()===this.model.value||t.toString()===this.model.value||t.toUTCString()===this.model.value)return t;if(typeof n=="string")return this._dateFromISO(n)}},_render:function(){this._renderWrapper();this._renderIcon();this._setDimentions();this._renderDropdown();this._checkProperties()},_renderWrapper:function(){if(this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0",value:this.model.value}),this.wrapper=t.buildTag("span.e-datetime-wrap e-widget "+this.model.cssClass+"#"+this.element[0].id+"_wrapper").insertAfter(this.element),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.container=t.buildTag("span.e-in-wrap e-box").append(this.element),this.wrapper.append(this.container),!this._isSupport){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}},_removeWatermark:function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},_renderIcon:function(){if(!this.model.showPopupButton)return!1;this.datetimeIcon=t.buildTag("span.e-select","",{}).attr(this._isIE8?{unselectable:"on"}:{});var n=t.buildTag("span.e-icon e-datetime","",{},{"aria-label":"select"}).attr(this._isIE8?{unselectable:"on"}:{});this.datetimeIcon.append(n);this.container.append(this.datetimeIcon).addClass("e-padding");this._on(this.datetimeIcon,"click",this._iconClick);this._on(this.datetimeIcon,"mousedown",function(n){n.preventDefault()})},_setDimentions:function(){this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this.wrapper.height(this.model.height);this.wrapper.width(this.model.width)},_renderDropdown:function(){var f=n("#"+this.element[0].id+"_popup").get(0),e,o,i,r,u;f&&n(f).remove();this.popup=t.buildTag("div.e-datetime-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.element[0].id+"_popup").css("visibility","hidden");t.isTouchDevice()||this.popup.addClass("e-ntouch");n("body").append(this.popup);this._renderControls();e=t.buildTag("div.e-header",this._localizedLabels.buttonText.timeTitle).attr(this._isIE8?{unselectable:"on"}:{});this._dateContainer=t.buildTag("div.e-datecontainer").append(this.datePicker.popup).attr(this._isIE8?{unselectable:"on"}:{});this._timeContainer=t.buildTag("div.e-timecontainer").append(e,this.timePicker.popup).attr(this._isIE8?{unselectable:"on"}:{});this._drillDownContainer=t.buildTag("div.e-drillDowncontainer").append().attr(this._isIE8?{unselectable:"on"}:{});o=t.buildTag("div.e-popup-container").append(this._dateContainer,this._timeContainer,this._drillDownContainer).attr(this._isIE8?{unselectable:"on"}:{});i=t.buildTag("div.e-dt-button e-dt-today e-btn e-select e-flat",this._localizedLabels.buttonText.today).attr(this._isIE8?{unselectable:"on"}:{});r=t.buildTag("div.e-dt-button e-dt-now e-btn e-select e-flat",this._localizedLabels.buttonText.timeNow).attr(this._isIE8?{unselectable:"on"}:{});u=t.buildTag("div.e-dt-button e-dt-done e-btn e-select e-flat",this._localizedLabels.buttonText.done).attr(this._isIE8?{unselectable:"on"}:{});this._buttonContainer=t.buildTag("div.e-button-container").append(i,r,u).attr(this._isIE8?{unselectable:"on"}:{});this._renderDrillDown();this.popup.append(o,this._buttonContainer);this._checkForResponsive();this._updateTimeHeight();this._bindOperations();this._updateValues();this.popup.css({visibility:"visible",display:"none"});this._on(i,"click",this._todayClick);this._on(r,"click",this._nowClick);this._on(u,"click",this._doneClick)},_renderControls:function(){this._renderDateControl();this._renderTimeControl();var n=t.buildTag("span").append(this.datePicker.wrapper,this.timePicker.wrapper);n.find("span").css("display","none");this.popup.append(n)},_renderDrillDown:function(){this._renderHourPopup();this._renderMinsPopup()},_renderHourPopup:function(){this._sfTimeHour=t.buildTag("div.e-timepicker e-popup e-widget "+this.model.cssClass+" e-time-hours ","",{},{id:this._id?"e-hours-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{});t.isTouchDevice()||this._sfTimeHour.addClass("e-ntouch");this._drillDownContainer.append(this._sfTimeHour);this._renderHourTable()},_renderHourTable:function(){var r,e,h,c,l,a,f;if(t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-hours-headertext").text("October 2015").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeHour),this._interval<1)return!1;c=this._interval*6e4;l=this.model.timeDrillDown.showMeridian?2:1;rowCount=this.model.timeDrillDown.showMeridian?6:4;var v=this.model.timeDrillDown.showMeridian?"hh":"HH:00",o=["AM","PM"],s=0,u="";for(r=this.timePicker._createObject("12:00:00 AM"),e=this.model.timeDrillDown.showMeridian?this.timePicker._createObject("11:59:59 AM"):this.timePicker._createObject("11:59:59 PM"),i=0;i<l;i++){for(this.model.timeDrillDown.showMeridian&&(u=o[i].toLowerCase(),a=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard[o[i]])?"":t.preferredCulture(this.model.locale).calendars.standard[o[i]][0],t.buildTag("div.e-header-"+u).attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-text").append(t.buildTag("span.e-hours-meridiantxt-"+u).text(a).attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeHour)),table=t.buildTag("table.e-dp-viewhours","",{},{cellspacing:2}).data("e-table","data").attr({role:"grid","aria-activedescendant":""}).attr(this._isIE8?{unselectable:"on"}:{}),this._sfTimeHour.append(table),tbody=t.buildTag("tbody.e-timepicker-hours").attr(this._isIE8?{unselectable:"on"}:{}),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{});this.timePicker._compareTime(e,r,!0);)h=this._localizeTime(r,v),f=t.buildTag("td.e-hour e-state-default",h),this.model.timeDrillDown.showMeridian&&f.addClass("e-hour-"+u),this._isIE8&&f.attr("unselectable","on"),tr.append(f),s++,s>=rowCount&&(s=0,tbody.append(tr),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),r=this.timePicker._createObject(r).getTime()+c;table.append(tbody);this.model.timeDrillDown.showMeridian&&(r=this.timePicker._createObject("12:00:00 PM"),e=this.timePicker._createObject("11:59:59 PM"))}t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this._sfTimeHour);n(".e-footer-text",this._sfTimeHour).html(this._localizedLabels.buttonText.timeNow);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this.datePicker.model.value,"dd MMM yyyy"));this._on(this._sfTimeHour.find(".e-hour"),"click",n.proxy(this._hourNavHandler,this));this._on(n(".e-next",this._sfTimeHour),"click",n.proxy(this._prevNextHourHandler,this));this._on(n(".e-prev",this._sfTimeHour),"click",n.proxy(this._prevNextHourHandler,this));this._on(n(".e-footer",this._sfTimeHour),"click",this._todayBtn);n(".e-hours-headertext",this._sfTimeHour).on("click",n.proxy(this._forwardNavHandler,this));this._sfTimeHour.hide()},_localizeTime:function(i,r){return n.trim(t.format(this.timePicker._createObject(i),r,this.model.locale))},_renderMinsPopup:function(){var r,i,e,o,s,u,f;if(this._sfTimeMins=t.buildTag("div.e-timepicker e-popup e-widget "+this.model.cssClass+" e-time-minitues ","",{},{id:this._id?"e-time-minitues-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{}),t.isTouchDevice()||this._sfTimeMins.addClass("e-ntouch"),this._drillDownContainer.append(this._sfTimeMins),t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-minitues-headertext").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeMins),t.buildTag("div.e-mins-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-text").append(t.buildTag("span.e-minitues-meridiantxt").text("AM").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeMins),r=t.buildTag("table.e-dp-viewmins","",{},{cellspacing:2}).data("e-table","data").attr({role:"grid","aria-activedescendant":""}).attr(this._isIE8?{unselectable:"on"}:{}),this._sfTimeMins.append(r),tbody=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),this._intervall<1)return!1;for(s=this._interval*6e4,i=this.timePicker._createObject("12:00:00 AM"),e=this.timePicker._createObject("11:59:59 PM"),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),u=0;this.timePicker._compareTime(e,i,!0);)o=this._localizeTime(i,"HH:00"),f=t.buildTag("td.e-mins e-state-default",o),this._isIE8&&f.attr("unselectable","on"),tr.append(f),u++,u>=4&&(u=0,tbody.append(tr),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),i=this.timePicker._createObject(i).getTime()+s;r.append(tbody);n(".e-minitues-headertext",this._sfTimeMins).text(n(".e-hours-headertext",this._sfTimeHour).text());t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this._sfTimeMins);n(".e-footer-text",this._sfTimeMins).html(this._localizedLabels.buttonText.timeNow);n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this.datePicker.model.value,"dd MMM yyyy"));this.model.timeDrillDown.showMeridian||n(".e-mins-header",this._sfTimeMins).css("display","none");this._on(r.find(".e-mins"),"click",n.proxy(this._minsNavHandler,this));this._on(n(".e-next",this._sfTimeMins),"click",n.proxy(this._prevNextMinsHandler,this));this._on(n(".e-prev",this._sfTimeMins),"click",n.proxy(this._prevNextMinsHandler,this));this._on(n(".e-footer",this._sfTimeMins),"click",this._todayBtn);n(".e-minitues-headertext",this._sfTimeMins).on("click",n.proxy(this._forwardNavHandler,this));this._sfTimeMins.hide()},_todayBtn:function(){this._nowClick();this._hideResult()},_hourNavHandler:function(i){var r,u;if(this.model.readOnly||!this.model.enabled||i&&n(i.target).hasClass("e-disable"))return!1;i&&i.type&&i.preventDefault();n("table",this._sfTimeHour).find("td").removeClass("e-active");n(i.target).addClass("e-active");this._sfTimeHour.hide();this._sfTimeMins.show();this._addFocus(this._sfTimeMins);this.model.timeDrillDown.showMeridian?(u=n(i.target).hasClass("e-hour-am")?"AM":"PM",r=n(i.target).text()+":00 "+u):r=n(i.target).text();this._generateMins(r);var f=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),e=n.trim(t.format(this.timePicker._createObject(f),"HH:mm",this.model.locale)),o=n.trim(t.format(this.timePicker._createObject(f),"HH:00",this.model.locale));index=(this.timePicker._parse(e)-this.timePicker._parse(o))/(this.model.timeDrillDown.interval*6e4);index=Math.ceil(index);this._hoverMins=this._setFocusByIndex("mins",index,this._sfTimeMins)},_minsNavHandler:function(i){if(this.model.readOnly||!this.model.enabled||i&&n(i.target).hasClass("e-disable"))return!1;i&&i.type&&i.preventDefault();n("table",this._sfTimeMins).find("td").removeClass("e-active").removeClass("e-state-hover");n(i.target).addClass("e-active");this.model.timeDrillDown.showMeridian?(value=n(i.target).text()+" "+t.format(this._datetimeValue,"tt","en-US"),value=this.timePicker._localizeTime(value)):value=n(i.target).text();this.timePicker.option("value",value);this.datePicker.option("value",this._datetimeValue);this._datetimeValue=new Date(this.model.value.toString());this.model.timeDrillDown.autoClose&&this._hideResult(i);this._updateInput()},_generateMins:function(i){var f=n("table",this._sfTimeMins),o,r,s,h,u,c,e;for(f.empty(),this.model.timeDrillDown.showMeridian?n(".e-mins-header",this._sfTimeMins).show():n(".e-mins-header",this._sfTimeMins).hide(),o=this.model.timeDrillDown.showMeridian?"hh:mm":"HH:mm",n(".e-minitues-headertext",this._sfTimeMins).text(n(".e-hours-headertext",this._sfTimeHour).text()),tbody=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),u=0,c=this.model.timeDrillDown.interval*6e4,r=this.timePicker._createObject(i),this._datetimeValue.setHours(r.getHours()),s=this.timePicker._createObject(r).getTime()+354e4,tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),tbody.append(tr);this.timePicker._compareTime(s,r,!0);)u>=4&&(u=0,tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),tbody.append(tr)),h=this._localizeTime(r,o),e=t.buildTag("td.e-mins e-state-default",h),this._isIE8&&e.attr("unselectable","on"),tr.append(e),u++,r=this.timePicker._createObject(r).getTime()+c;f.append(tbody);n(".e-mins-header",this._sfTimeMins).find(".e-minitues-meridiantxt").text(t.format(this._datetimeValue,"tt",this.model.locale));this._disableRange("mins");this._on(f.find(".e-mins"),"click",n.proxy(this._minsNavHandler,this))},_prevNextHourHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=n(t.target).is("a")?n(t.target.parentNode):n(t.target),r=i.hasClass("e-prev")?!0:!1;this._processNextPrev(r,this._sfTimeHour)},_prevNextMinsHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=n(t.target).is("a")?n(t.target.parentNode):n(t.target),r=i.hasClass("e-prev")?!0:!1;this._processNextPrev(r,this._sfTimeMins)},_processNextPrev:function(i,r){var u,f,e;if(i&&r.find(".e-arrow-sans-left").hasClass("e-disable")||!i&&r.find(".e-arrow-sans-right").hasClass("e-disable"))return!1;u=n("table",r);e=u.get(0).className;switch(e){case"e-dp-viewhours":incVal=i?-1:1;this._datetimeValue.setDate(this._datetimeValue.getDate()+incVal);this._disableRange("hour");this._hoverHour=this._setFocusByIndex("hour",this._hoverHour,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"));break;case"e-dp-viewmins":incVal=i?-1:1;this._datetimeValue.setHours(this._datetimeValue.getHours()+incVal);this._generateMins(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)));var f=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),o=n.trim(t.format(this.timePicker._createObject(f),"HH:mm",this.model.locale)),s=n.trim(t.format(this.timePicker._createObject(f),"HH:00",this.model.locale));index=(this.timePicker._parse(o)-this.timePicker._parse(s))/(this.model.timeDrillDown.interval*6e4);index=Math.ceil(index);this._disableRange("mins");this._hoverMins=this._setFocusByIndex("mins",index,this._sfTimeMins);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))}},_forwardNavHandler:function(i,r){var u,e,f;if(this.model.readOnly||!this.model.enabled)return!1;e=this;i&&i.preventDefault();u=i?n(i.currentTarget).get(0).className:r.find(".e-text>span").get(0).className;switch(u){case"e-hours-headertext":this._sfTimeHour.css("display","none");this._dateContainer.css("display","block");this._addFocus(this._dateContainer.find(".e-datepicker"));break;case"e-minitues-headertext":this._sfTimeMins.css("display","none");this._disableRange("hour");start=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00");f=n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale));indx=(this.timePicker._parse(f)-this.timePicker._parse(start))/(this._interval*6e4);indx=Math.floor(indx);this._hoverHour=this._setFocusByIndex("hour",indx,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"));this._sfTimeHour.css("display","block");this._addFocus(this._sfTimeHour)}},_renderDateControl:function(){var n=t.buildTag("input#"+this.element[0].id+"_date","",{},{type:"text"});this.popup.append(n);n.ejDatePicker({height:"0px",width:"0px",displayInline:!0,showDateIcon:!1,showFooter:this.model.timeDrillDown.enabled?this.model.timeDrillDown.showFooter:!1,enableStrictMode:!0,buttonText:this._localizedLabels.buttonText.today,minDate:this._stringToObject(this.model.minDateTime),maxDate:this._stringToObject(this.model.maxDateTime),dayHeaderFormat:this.model.dayHeaderFormat,startLevel:this.model.startLevel,depthLevel:this.model.depthLevel,startDay:this.model.startDay,stepMonths:this.model.stepMonths,showOtherMonths:this.model.showOtherMonths,headerFormat:this.model.headerFormat,enabled:this.model.enabled,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,readOnly:this.model.readOnly,cssClass:this.model.cssClass,locale:this.model.locale});this.datePicker=n.data("ejDatePicker");this.model.startDay=this.datePicker.model.startDay;this.datePicker._getInternalEvents=!0;this.datePicker._dt_drilldown=!0;this.datePicker.popup.css({position:"static",display:"block"})},_renderTimeControl:function(){var n=t.buildTag("input#"+this.element[0].id+"_time","",{},{type:"text"}),i,r;this.popup.append(n);n.ejTimePicker({height:"0px",width:"0px",interval:this.model.interval,timeFormat:this.model.timeDisplayFormat,popupWidth:this.model.timePopupWidth,enabled:this.model.enabled,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,readOnly:this.model.readOnly,cssClass:this.model.cssClass,locale:this.model.locale});this.timePicker=n.data("ejTimePicker");this.timePicker._getInternalEvents=!0;this.timePicker.showDropdown=!0;this.timePicker._dateTimeInternal=!0;this.timePicker.popup.css({position:"static",display:"block"});i=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime;r=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime},_updateTimeHeight:function(){var n=this.popup.find(".e-timecontainer .e-header").is(":visible")?this.datePicker.popup.height()-this.popup.find(".e-header").height():this.datePicker.popup.height();n=this.popup.hasClass("e-dt-responsive")?"98px":n;this.timePicker.option("popupHeight",n)},_bindOperations:function(){var n=this;this.datePicker.option("layoutChange",function(){n._updateTimeHeight()});this.datePicker.option("outOfRange",function(){n.isValidState=!1});this.timePicker.option("outOfRange",function(){n.isValidState=!1});this.datePicker.option("change",function(t){n._refreshTimes(t)});this.datePicker.option("select",function(t){n._updateInput(t)});this.datePicker.option("dt_drilldown",function(t){n.model.timeDrillDown.enabled&&(n._updateInput(t),n._switchToDrilDown(t))});this.timePicker.option("select",function(){n._updateInput()})},_switchToDrilDown:function(){var i,r;this._dateContainer.hide();this._sfTimeHour.show();this._addFocus(this._sfTimeHour);i=new Date(this.model.value.toString());this._datetimeValue=new Date(i.setHours(this._datetimeValue.getHours(),this._datetimeValue.getMinutes(),this._datetimeValue.getSeconds(),this._datetimeValue.getMilliseconds()));this._disableRange("hour");start=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00");r=n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale));indx=(this.timePicker._parse(r)-this.timePicker._parse(start))/(this._interval*6e4);indx=Math.floor(indx);this._hoverHour=this._setFocusByIndex("hour",indx,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))},_disableRange:function(r){var h=r=="hour"?this._interval:this.model.timeDrillDown.interval,u=r=="hour"?this._sfTimeHour:this._sfTimeMins,s=r=="hour"?"e-hide-hour e-disable":"e-hide-mins e-disable",f,c,e,o;if(u.find("tbody tr td.e-"+r).removeClass(s),u.find(".e-arrow-sans-left").removeClass("e-disable"),u.find(".e-arrow-sans-right").removeClass("e-disable"),start=r=="hour"?this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"):this._localizeTime(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),"HH:00"),this._compareDate(this.model.minDateTime,this._datetimeValue)){if(r=="mins"&&!(this.model.minDateTime.getHours()===this._datetimeValue.getHours()))return!1;for(f=n.trim(t.format(this.timePicker._createObject(this.model.minDateTime),"HH:mm",this.model.locale)),indx=(this.timePicker._parse(f)-this.timePicker._parse(start))/(h*6e4),indx=r=="hour"?Math.floor(indx):Math.ceil(indx),i=0;i<indx;i++)e=u.find("tbody tr td.e-"+r),o=e[i],n(o).addClass(s);u.find(".e-arrow-sans-left").addClass("e-disable")}if(this._compareDate(this.model.maxDateTime,this._datetimeValue)){if(r=="mins"&&!(this.model.maxDateTime.getHours()===this._datetimeValue.getHours()))return!1;for(f=n.trim(t.format(this.timePicker._createObject(this.model.maxDateTime),"HH:mm",this.model.locale)),indx=(this.timePicker._parse(f)-this.timePicker._parse(start))/(h*6e4),indx=Math.floor(indx)+1,c=u.find("tbody tr td.e-"+r).length,i=indx;i<c;i++)e=u.find("tbody tr td.e-"+r),o=e[i],n(o).addClass(s);u.find(".e-arrow-sans-right").addClass("e-disable")}},_setFocusByName:function(t,i,r){var f=r.find("tbody tr td.e-"+t),e,u;return n(f).each(function(n,t){if(t.innerHTML==i){e=n;return}}),u=f[e],u||(u=f.last()),r.find("table td").removeClass("e-state-hover").removeClass("e-active"),n(u).hasClass("e-hide-"+t)||n(u).addClass("e-state-hover"),this._setActiveState(t,r),e},_setFocusByIndex:function(t,i,r){var f=r.find("tbody tr td.e-"+t),u;return u=f[i],u||(u=f.last()),r.find("table td").removeClass("e-state-hover").removeClass("e-active"),n(u).hasClass("e-hide-"+t)||n(u).addClass("e-state-hover"),this._setActiveState(t,r),i},_setActiveState:function(i,r){var s=r.find("tbody tr td.e-"+i),f,c=this,u=-1,e;switch(i){case"hour":this._compareDate(this.model.value,this._datetimeValue)&&(start=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"),e=n.trim(t.format(this.timePicker._createObject(this.model.value),"HH:00",this.model.locale)),u=(this.timePicker._parse(e)-this.timePicker._parse(start))/(this._interval*6e4),u=Math.floor(u));break;case"mins":if(this._compareDate(this.model.value,this._datetimeValue)&&this.model.value.getHours()===this._datetimeValue.getHours()){var o=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),e=n.trim(t.format(this.timePicker._createObject(o),"HH:mm",this.model.locale)),h=n.trim(t.format(this.timePicker._createObject(o),"HH:00",this.model.locale));u=(this.timePicker._parse(e)-this.timePicker._parse(h))/(this.model.timeDrillDown.interval*6e4);u=Math.ceil(u)}}f=s[u];f&&(r.find("table td").removeClass("e-active"),n(f).removeClass("e-state-hover").addClass("e-active"))},_compareDate:function(n,t){var i=new Date(n.toString()).setHours(0,0,0,0),r=new Date(t.toString()).setHours(0,0,0,0);return+i==+r?!0:!1},_updateInput:function(n){var r=(new Date).setHours(0,0,0,0),t=this._getDate()||new Date,i=this._getTime()||this.timePicker._createObject(r);this.model.value=new Date(t.getFullYear(),t.getMonth(),t.getDate(),i.getHours(),i.getMinutes(),i.getSeconds());this._updateDateTime();this._raiseChangeEvent();this._updateModel(n,!0);n&&(n.cancel=!0)},_updateDateTime:function(){this.isValidState=!0;var n=this._objectToString(this.model.value);this.element.val(n);this._removeWatermark()},_refreshTimes:function(n){var t=this._getDateObj(n.value,this.datePicker.model.dateFormat),i,u,r;if(!t)return!1;this.isValidState=!0;this._compare(t,this._setEmptyTime(this.model.minDateTime))?(i=this._getFormat(this.model.minDateTime,this.timePicker.model.timeFormat),r=this._getTime(),this.timePicker.option("minTime",i),this.model.enableStrictMode||this._updateInput()):this.timePicker.option("minTime",this._defaultMinVal());this._compare(t,this._setEmptyTime(this.model.maxDateTime))?(u=this._getFormat(this.model.maxDateTime,this.timePicker.model.timeFormat),r=this._getTime(),this.timePicker.option("maxTime",u),this.model.enableStrictMode||this._updateInput()):this.timePicker.option("maxTime",this._defaultMaxVal());this.timePicker._changeActiveEle()},_defaultMinVal:function(){var n=(new Date).setHours(0,0,0,0);return t.format(this.timePicker._createObject(n),this.timePicker.model.timeFormat,this.timePicker.model.locale)},_defaultMaxVal:function(){var n=(new Date).setHours(23,59,59,59);return t.format(this.timePicker._createObject(n),this.timePicker.model.timeFormat,this.timePicker.model.locale)},_updateValues:function(){var n=this.model.value;this.model.value!=null&&(this.datePicker.option("value",this.model.value),this.timePicker.option("value",this.model.value));this._setValue(n);this._validateMinMax();this._preVal=this.element.val();this._checkErrorClass()},_specificFormat:function(){var i=t.globalize._getDateParseRegExp(t.globalize.findCulture(this.model.locale).calendar,this.model.dateFormat);return n.inArray("dddd",i.groups)>-1||n.inArray("ddd",i.groups)>-1},_changeEditable:function(t){var i=t?"_on":"_off";if(this.element.is(":input")){if(t)this.model.readOnly||this.element.attr("readonly",!1),this.element.off("mousedown",n.proxy(this._showhidePopup,this));else{this.model.readOnly||this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showhidePopup,this))}this[i](this.element,"blur",this._targetBlur);this[i](this.element,"focus",this._targetFocus);this[i](this.element,"keydown",this._keyDownOnInput)}this._change("allowEdit",t)},_setValue:function(n){return n&&(typeof JSON!="object"||JSON.stringify(n)!=="{}")?typeof n=="string"?this._extISORegex.exec(n)||this._basicISORegex.exec(n)?this._checkObject(this._dateFromISO(n)):(this.element.val(n),this._updateModel(),this._validateMinMax(),this._checkStrictMode(),this.wrapper.addClass("e-valid")):n instanceof Date&&this._isValidDate(n)&&this._checkObject(n):(this.element.val(""),this.model.value=null,this.isValidState=!0,this.wrapper.removeClass("e-valid")),this._checkErrorClass(),this.model.value},_checkObject:function(n){n instanceof Date&&this._isValidDate(n)&&(this.model.value=n,this._updateDateTime(),this._validateMinMax(),this._checkStrictMode())},_dateFromISO:function(n){var i=this._extISORegex.exec(n)||this._basicISORegex.exec(n),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e<this._dates.length;e++)if(this._dates[e][1].exec(i[1])){c=this._dates[e][0];break}if(i[3])for(o=0;o<this._times.length;o++)if(this._times[o][1].exec(i[3])){l=(i[2]||" ")+this._times[o][0];break}for(i[4]&&this._zeroRegex.exec(i[4])&&(a="Z"),v=c+l+a,f=v.match(this._tokens),t=[],u=0;u<f.length;u++)h=f[u],s=this._checkLiteral(f[u]),y=this._numberRegex[s?f[u].toLowerCase():h.length]||new RegExp("^\\d{1,"+h.length+"}"),r=n.match(y),r&&(n.substr(0,n.indexOf(r))>=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){return char=n.toLowerCase(),char=="t"||char=="z"||char==":"||char=="-"?!0:!1},_validateValue:function(n){var i=t.parseDate(n,this.model.dateTimeFormat);!i||i<this.model.minDateTime||i>this.model.maxDateTime?(this.model.value=null,this._change("value",this.model.value),this.isValidState=!1):(this._change("value",this.model.value),this.isValidState=!0)},_validateMinMax:function(){var i,n,t;if(i=this.model.value?this._stringToObject(this.model.value):null,n=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime,t=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime,!i||!n||!t)return!1;n>t&&(this.model.minDateTime=this.model.maxDateTime);i<n&&(this.model.enableStrictMode?this.model.enableStrictMode&&(this.datePicker.option("minDate",this._getFormat(n,this.datePicker.model.dateFormat)),this.timePicker.option("minTime",this._getFormat(n,this.timePicker.model.timeFormat)),this.isValidState=!1):(this._setValue(n),this.isValidState=!0));i>t&&(this.model.enableStrictMode?this.model.enableStrictMode&&(this.datePicker.option("maxDate",this._getFormat(t,this.datePicker.model.dateFormat)),this.timePicker.option("maxTime",this._getFormat(t,this.timePicker.model.timeFormat)),this.isValidState=!1):(this._setValue(t),this.isValidState=!0));i<n||i>t||(this.isValidState=!0)},_checkProperties:function(){this.model.readOnly&&this._readOnly(!0);this.model.showRoundedCorner&&this._setRoundedCorner(!0);this.model.enableRTL&&this._setRtl(!0);this.model.enabled&&this._enabled(!0);this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&this._enabled(!0):this._enabled(!1);this.model.name=this._options.name?this.model.name:this.element.attr("name")?this.element.attr("name"):this.element[0].id;this.element.attr("name",this.model.name);this._checkStrictMode();this._checkErrorClass();this._datetimeValue=new Date(this.datePicker._dateValue.toString());t.isNullOrUndefined(this.model.value)||(this._datetimeValue=new Date(this.model.value.toString()));this._setWaterMark()},_checkStrictMode:function(){this.model.enableStrictMode?this.model.enableStrictMode&&(this.isValidState||(this.model.value=null,this.isValidState=!1)):this.isValidState||(this.model.value<this.model.minDateTime?(this.element.val(this._objectToString(this.model.minDateTime)),this.model.value=this.model.minDateTime,this.isValidState=!0):this.model.value>this.model.maxDateTime?(this.element.val(this._objectToString(this.model.maxDateTime)),this.model.value=this.model.maxDateTime,this.isValidState=!0):(this.model.value="",this.element.val(""),this.isValidState=!0))},_targetFocus:function(n){n.preventDefault();this.isFocused=!0;this.wrapper.addClass("e-focus");this.wrapper.removeClass("e-error");this._isSupport||this._hiddenInput.css("display","none");this._prevDateTimeVal=this.element.val();this.model.showPopupButton||this.model.readOnly||this._showResult();this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this._trigger("focusIn",{value:this.model.value});this.wrapper.addClass("e-valid")},_targetBlur:function(){var n,i;this.isFocused=!1;this.wrapper.removeClass("e-focus");this.model.showPopupButton||this._hideResult();n=t.parseDate(this.element.val(),this.model.dateTimeFormat);n&&!this.model.enableStrictMode&&(n<this.model.minDateTime||n>this.model.maxDateTime)&&(n=n<this.model.minDateTime?this.model.minDateTime:this.model.maxDateTime,this.element.val(this._objectToString(n)));i=t.parseDate(this.element.val(),this.model.dateTimeFormat);i!=null||this.model.enableStrictMode||(this._prevDateTimeVal==null||this.element.val()==""?this.element.val(""):this.element.val(this._preVal));this._valueChange();this.model.enableStrictMode?this.element.val()!=""&&this._validateValue(this.element.val()):this.isValidState?this._prevDateTimeVal=this.element.val():(this.element.val(this._prevDateTimeVal),this._preVal=this._prevDateTimeVal,this.model.value=this._stringToObject(this._prevDateTimeVal),this.isValidState=!0);this._isSupport||this.element.val()!=""||this._hiddenInput.css("display","block");this._checkErrorClass();this.model.showPopupButton||this._off(this.element,"click",this._elementClick);this._trigger("focusOut",{value:this.model.value});t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")},_elementClick:function(){this.isPopupOpen||this._showResult()},_keyDownOnInput:function(n){switch(n.keyCode){case 40:n.altKey&&this._showhidePopup();break;case 37:case 39:this.model.timeDrillDown.enabled||n.altKey&&this.isPopupOpen&&(n.preventDefault(),this._addPrevNextFocus(n.keyCode==37));break;case 27:n.preventDefault();case 9:this._hideResult();break;case 13:var i=t.parseDate(this.element.val(),this.model.dateTimeFormat);if(i!=null||this.model.enableStrictMode||(this._prevDateTimeVal==null||this.element.val()==""?this.element.val(""):this.element.val(this._preVal)),this._valueChange(),!this.model.timeDrillDown.enabled){this._valueChange();this.model.enableStrictMode&&this._checkErrorClass();break}}},_addFocus:function(t){if(!t.hasClass("e-focus"))if(this._removeFocus(),t.addClass("e-focus"),t.hasClass("e-datepicker e-popup"))n(document).on("keydown",n.proxy(this.datePicker._keyboardNavigation,this.datePicker));else if(t.hasClass("e-timecontainer"))n(document).on("keydown",n.proxy(this.timePicker._keyDownOnInput,this.timePicker));else if(t.hasClass("e-time-hours"))n(document).on("keydown",n.proxy(this._keyDownOnHours,this));else if(t.hasClass("e-time-minitues"))n(document).on("keydown",n.proxy(this._keyDownOnMinutes,this));else if(t.hasClass("e-dt-button"))n(document).on("keydown",n.proxy(this._buttonClick,this))},_removeFocus:function(){var t=this._getFocusedElement();t.length>0&&(t.removeClass("e-focus"),t.hasClass("e-datepicker e-popup")?n(document).off("keydown",n.proxy(this.datePicker._keyboardNavigation,this.datePicker)):t.hasClass("e-timecontainer")?n(document).off("keydown",n.proxy(this.timePicker._keyDownOnInput,this.timePicker)):t.hasClass("e-time-hours")?n(document).off("keydown",n.proxy(this._keyDownOnHours,this)):t.hasClass("e-time-minitues")?n(document).off("keydown",n.proxy(this._keyDownOnMinutes,this)):t.hasClass("e-dt-button")&&n(document).off("keydown",n.proxy(this._buttonClick,this)))},_addPrevNextFocus:function(n){var i=this._getFocusedElement(),t;i.length>0?i.hasClass("e-datepicker e-popup")?t=n?this.popup.find(".e-dt-done"):this.popup.find(".e-timecontainer"):i.hasClass("e-timecontainer")?t=n?this.popup.find(".e-datecontainer >.e-datepicker.e-popup"):this.popup.find(".e-dt-today"):i.hasClass("e-dt-today")?t=n?this.popup.find(".e-timecontainer"):this.popup.find(".e-dt-now"):i.hasClass("e-dt-now")?t=n?this.popup.find(".e-dt-today"):this.popup.find(".e-dt-done"):i.hasClass("e-dt-done")&&(t=n?this.popup.find(".e-dt-now"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup")):t=n?this.popup.find(".e-dt-done"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup");this._addFocus(t)},_getFocusedElement:function(){return this.popup.children("div").find("div.e-focus")},_keyDownOnHours:function(n){var t,r,i;(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35)&&(n.preventDefault&&n.preventDefault(),t={row:null,col:null},t.col=this._sfTimeHour.find("tbody tr td.e-state-hover").index(),t.row=this._sfTimeHour.find("tbody tr td.e-state-hover").parent().index(),t.col=t.col!=-1?t.col+1:this._sfTimeHour.find("tbody tr td.e-active").index()+1,t.row!=-1?(t.row=t.row+1,this.model.timeDrillDown.showMeridian&&this._sfTimeHour.find("tbody tr td.e-state-hover").hasClass("e-hour-pm")&&(t.row=t.row+2)):(t.row=this._sfTimeHour.find("tbody tr td.e-active").parent().index()+1,this.model.timeDrillDown.showMeridian&&this._sfTimeHour.find("tbody tr td.e-active").hasClass("e-hour-pm")&&(t.row=t.row+2)),r=this._sfTimeHour.find("table")[0].className,rowLength=this._sfTimeHour.find("tbody.e-timepicker-hours tr").length,colLength=this.model.timeDrillDown.showMeridian?6:4,i=this._changeRowCol(t,n.keyCode,rowLength,colLength,"hours",n.ctrlKey),n.ctrlKey||(this._hoverHour=this._sfTimeHour.find("tbody.e-timepicker-hours tr td").index(i)),n.ctrlKey||(this._sfTimeHour.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover")))},_changeRowCol:function(t,i,r,u,f,e){var c,o,h={parent:null,child:null},s,a,l,v;switch(f){case"hours":c="tbody.e-timepicker-hours tr td.e-hour";h.parent=".e-timepicker-hours";h.child=".e-hour";hiddenClass=".e-hide-hour";o=this._sfTimeHour;break;case"mins":c="tbody.e-timepicker-mins tr td.e-mins";h.parent=".e-timepicker-mins";h.child=".e-mins";hiddenClass=".e-hide-mins";o=this._sfTimeMins;u=o.find("tbody"+h.parent+" tr:nth-child("+t.row+") td"+h.child).length}if(t.row<=0&&t.col<=0)return o.find(c+":not(.e-disable):first");a=this;switch(i){case 36:return o.find(c+":not(.e-disable):first");case 35:return o.find(c+":not(.e-disable):last");case 38:if(e)this._forwardNavHandler(null,o);else if(t.row>1)t.row-=1;else return this._processNextPrev(!0,o),o.find(c+":nth-child("+t.col+"):last");if(s=this._getCell(t,h,o).not(hiddenClass),s.length<=0){if(s=this._findVisible(t,h,"up",o),s!==null)return s;this._processNextPrev(!0,o);s=o.find(c+":nth-child("+t.col+"):last")}return s;case 37:if(e)return this._processNextPrev(!0,o),o.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else if(t.row>1)t={row:t.row-1,col:u},f=="mins"&&(t.col=u=o.find("tbody"+h.parent+" tr:nth-child("+t.row+") td"+h.child).length);else return this._processNextPrev(!0,o),o.find(c+":not(.e-disable):last");if(s=this._getCell(t,h,o).not(hiddenClass),s.length<=0){if(s=this._findVisible(t,h,"left",o),s!==null)return s;this._processNextPrev(!0,o);s=o.find(c+":not(.e-disable):last")}return s;case 39:if(e)return this._processNextPrev(!1,o),o.find("tbody tr td.e-state-hover");if(t.col<u)t.col+=1;else if(t.row<r)t={row:t.row+1,col:1};else return this._processNextPrev(!1,o),o.find(c+":not(.e-disable):first");if(s=this._getCell(t,h,o).not(hiddenClass),s.length<=0){if(s=this._findVisible(t,h,"right",o),s!==null)return s;this._processNextPrev(!1,o);s=o.find(c+":not(.e-disable):first")}return s;case 40:if(!e){if(t.row<r)t.row+=1;else return this._processNextPrev(!1,o),o.find(c+":nth-child("+t.col+"):first");if(s=this._getCell(t,h,o).not(hiddenClass),s.length<=0){if(s=this._findVisible(t,h,"down",o),s!==null)return s;this._processNextPrev(!1,o);s=o.find(c+":nth-child("+t.col+"):first")}return s}case 13:l=this._getCell(t,h,o);v=n(l)[0];args={type:null,target:l};f=="hours"&&this._hourNavHandler(args);f=="mins"&&this._minsNavHandler(args)}return this._getCell(t,h,o).not(hiddenClass)},_getCell:function(t,i,r){var f=t.row,u;return this.model.timeDrillDown.showMeridian&&t.row>2&&r.hasClass("e-time-hours")&&(f=f-2),u=r.find("tbody"+i.parent+" tr:nth-child("+f+") td"+i.child+":nth-child("+t.col+")"),this.model.timeDrillDown.showMeridian&&u.length>0&&r.hasClass("e-time-hours")&&(u=t.row<=2?n(u[0]):n(u[1])),u},_findVisible:function(n,t,r,u){var e=n.col,f=n.row,o=t.child.slice(1,t.child.length);for(i=0;i>=0;i++){if(nextElement=this._getCell({row:f,col:e},t,u),nextElement.length<=0)return null;if(nextElement.hasClass("e-disable")||!nextElement.is(":visible")){if((r=="right"||r=="left"?r=="right"?e++:e--:r=="down"?f++:f--,f<=0||f>u.find("tbody"+t.parent+" tr").length)||(e>u.find("tbody"+t.parent+" tr:nth-child("+f+") td").length&&(f++,e=1),e<=0&&(f--,e=u.find("tbody"+t.parent+" tr:nth-child("+f+") td").length),f<=0||f>u.find("tbody"+t.parent+" tr").length))return null}else if(nextElement.hasClass(o))return n.col=e,n.row=f,nextElement=this._getCell(n,t,u)}},_keyDownOnMinutes:function(n){var t,r,i;(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35)&&(n.preventDefault&&n.preventDefault(),t={row:null,col:null},t.col=this._sfTimeMins.find("tbody tr td.e-state-hover").index(),t.row=this._sfTimeMins.find("tbody tr td.e-state-hover").parent().index(),t.col=t.col!=-1?t.col+1:this._sfTimeMins.find("tbody tr td.e-active").index()+1,t.row=t.row!=-1?t.row+1:this._sfTimeMins.find("tbody tr td.e-active").parent().index()+1,r=this._sfTimeMins.find("table")[0].className,rowLength=this._sfTimeMins.find("tbody.e-timepicker-mins tr").length,colLength=4,i=this._changeRowCol(t,n.keyCode,rowLength,colLength,"mins",n.ctrlKey),n.ctrlKey||(this._hoverHour=this._sfTimeMins.find("tbody.e-timepicker-mins tr td").index(i)),n.ctrlKey||(this._sfTimeMins.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover")))},_valueChange:function(n){this.model.enableStrictMode?this.model.enableStrictMode&&(this._preVal!=this.element.val()||this.model.value<this.model.minDateTime||this.model.value>this.model.maxDateTime)&&(this._updateModel(),this._raiseChangeEvent(n)):(this._preVal!=this.element.val()&&(this._preVal=this.element.val(),this._updateModel(),this._validateMinMax(),this._raiseChangeEvent(n)),this._setWaterMark())},_updateModel:function(n,i){var u,f;if(this._stopRefresh){this._stopRefresh=!1;return}u=this.element.val();u==""?(this.model.value=null,this._change("value",this.model.value),this.isValidState=!0):(f=n!=r&&n.type=="select"||this._prevDateTimeVal==this.element.val()?this.model.value:t.parseDate(u,this.model.dateTimeFormat,this.model.locale),f?(this.model.value=f,this.isValidState=!0,i||this._refreshPopup(),this._specificFormat()&&this._prevDateTimeVal!=this.element.val()&&this.element.val(this._objectToString(this.model.value))):(this.model.value=null,this._change("value",this.model.value),this.isValidState=!1,this.model.enableStrictMode||this.element.val(this._objectToString(this.model.value))))},_refreshPopup:function(){if(this.isValidState&&this.isPopupOpen){var n=this._setEmptyTime(this.model.value),t=this._setEmptyDate(this.model.value),i=this._getDate(),r=this._getTime();i&&this._compare(i,n)||this.datePicker.option("value",n);r&&this._compare(r,t)||this.timePicker.option("value",t)}},_buttonClick:function(n){if(n.keyCode==13){n.preventDefault();var t=this._getFocusedElement();t.hasClass("e-dt-today")?this._todayClick():t.hasClass("e-dt-now")?this._nowClick():t.hasClass("e-dt-done")&&this._doneClick()}},_todayClick:function(){if(!this.model.enabled||this.model.readOnly)return!1;this.datePicker.popup.find(".today").hasClass("e-active")&&this.datePicker.popup.children("table").hasClass("e-dp-viewdays")&&this.element.val()!=""&&this.isValidState||(this.datePicker._setCurrDate(),this._updateInput())},_nowClick:function(){var r;if(!this.model.enabled||this.model.readOnly)return!1;this.timePicker.setCurrentTime();var u=this.model.minDateTime,f=this.model.maxDateTime,n=this.datePicker.model.value,i=new Date;n=t.isNullOrUndefined(n)?new Date:n;r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),i.getHours(),i.getMinutes(),i.getSeconds());r<u?this.timePicker.option("value",this.timePicker._localizeTime(u)):r>f&&this.timePicker.option("value",this.timePicker._localizeTime(f));this._updateInput()},_doneClick:function(){this._hideResult()},_iconClick:function(n){n.preventDefault();this.isFocused||t.isTouchDevice()||this.element.focus();this._showhidePopup();this._isIE9&&this.popup.find(".e-popup-container").css("display","inline-block")},_setInitialSelection:function(){var i=this.timePicker.ul.find("li"),r,u,f,t,e;i.hasClass("e-hover")||(r=this.timePicker._setEmptyDate(new Date),u=r,this.timePicker.minTime&&!this._compareTime(this._createObject(r),this.timePicker.minTime,!0)&&(u=this.timePicker.minTime),this.timePicker.maxTime&&!this._compareTime(this.timePicker.maxTime,this._createObject(r),!0)&&(u=this.timePicker.maxTime),f=i.first().html(),t=(this.timePicker._parse(u)-this.timePicker._parse(f))/(this.timePicker.model.interval*6e4),t=Math.round(t),activeItem=t==i.length?t:t+1,(activeItem<0||activeItem>i.length||isNaN(activeItem))&&(activeItem=1),e=n(this.timePicker.ul.find("li")[activeItem-1]),e.addClass("e-hover"),this._calcScrollTop())},_calcScrollTop:function(){var r=this.timePicker.ul.outerHeight(),n=this.timePicker.ul.find("li").outerHeight(),t,i;t=this.timePicker.ul.find("li.e-hover").index();i=n*t-(this.timePicker.popupList.outerHeight()-n)/2;this.timePicker.scrollerObj.setModel({scrollTop:i})},_showhidePopup:function(){if(this.model.readOnly)return!1;this.isPopupOpen?this._hideResult():this._showResult()},_showResult:function(){if(this.isPopupOpen||!this.model.enabled||this._trigger("beforeOpen",{element:this.popup}))return!1;this.isPopupOpen=!0;this._setListPosition();this._checkForResponsive();var i=this;this.popup.slideDown(this.model.enableAnimation?200:0,function(){i._on(n(document),"mousedown",i._OnDocumentClick);i.model.timeDrillDown.enabled&&i._addFocus(i._dateContainer.find(".e-datepicker"));i.timePicker.model.value||i._setInitialSelection()});this._updateModel();this._updateTimeHeight();this._validateMinMax();this._on(n(window),"resize",this._OnWindowResize);this._on(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._raiseEvent("open");this._initial&&(this.timePicker._refreshScroller(),this.timePicker._changeActiveEle(),this._initial=!1);this.wrapper.addClass("e-active")},_hideResult:function(i){var r=this;if(!this.isPopupOpen||this._trigger("beforeClose",{element:this.popup}))return!1;if(this.isPopupOpen=!1,this._removeFocus(),this._popClose&&i&&i.type!="click"){this.isPopupOpen=!0;return}this.popup.slideUp(this.model.enableAnimation?100:0,function(){r.model&&(r.model.timeDrillDown.enabled&&(r._sfTimeHour.hide(),r._sfTimeMins.hide(),r._dateContainer.show()),t.isNullOrUndefined(r.model.value)||(r._datetimeValue=new Date(r.model.value.toString())))});this._raiseEvent("close");this._off(n(document),"mousedown",this._OnDocumentClick);this._off(n(window),"resize",this._OnWindowResize);this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this.wrapper.removeClass("e-active")},_setListPosition:function(){var r=this.wrapper,i=this._getOffset(r),s,v=n(document).scrollTop()+n(window).height()-(i.top+n(r).outerHeight()),h=i.top-n(document).scrollTop(),u=this.popup.outerHeight(),c=this.popup.outerWidth(),f=i.left,o=r.outerHeight(),l=(o-r.height())/2,y=this._getZindexPartial(),e=3,p=this.model.popupPosition,a;a=this.model.popupPosition==t.PopupPosition.Bottom?(u<v||u>h?i.top+o+e:i.top-u-e)-l:(u>h?i.top+o+e:i.top-u-e)-l;s=n(document).scrollLeft()+n(window).width()-f;(this.model.enableRTL||c>s&&c<f+r.outerWidth())&&(f-=this.popup.outerWidth()-r.outerWidth());this.popup.css({left:f+"px",top:a+"px","z-index":y})},_getOffset:function(n){return t.util.getOffset(n)},_OnDocumentClick:function(t){this.model&&(n(t.target).is(this.popup)||n(t.target).parents(".e-datetime-popup").is(this.popup)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-datetime-wrap").is(this.wrapper)?(n(t.target).is(this.popup)||n(t.target).parents(".e-datetime-popup").is(this.popup))&&(t.preventDefault(),n(t.target).parents(".e-datepicker").length>0?this._addFocus(n(t.target).parents(".e-datepicker")):n(t.target).parents(".e-timecontainer").length>0?this._addFocus(n(t.target).parents(".e-timecontainer")):n(t.target).hasClass("e-dt-button")?this._addFocus(n(t.target)):n(t.target).parents(".e-time-hours").length>0?this._addFocus(n(t.target).parents(".e-time-hours")):n(t.target).parents(".e-time-minitues").length>0?this._addFocus(n(t.target).parents(".e-time-minitues")):this._removeFocus()):this._hideResult())},_OnWindowResize:function(){this._setListPosition();this._checkForResponsive();this._updateTimeHeight()},_raiseChangeEvent:function(i){var u=t.parseDate(this._prevDateTimeVal,this.model.dateTimeFormat),f=t.parseDate(this.element.val(),this.model.dateTimeFormat),r;+u==+f?this._prevDateTimeVal!=this.element.val()&&(r={prevDateTime:this._prevDateTimeVal,value:this.element.val(),isValidState:this.isValidState},this._prevDateTimeVal=this.element.val(),this._trigger("_change",r)):(this._preVal=this._prevDateTimeVal,r={prevDateTime:this._prevDateTimeVal,value:this.element.val(),isInteraction:!i,isValidState:this.isValidState},this._trigger("_change",r),r.value=n.trim(this.element.val())==""?null:this.element.val(),this._trigger("change",r),this._prevDateTimeVal=this.element.val())},_raiseEvent:function(n){return this.element!=null&&this.model[n]?this._trigger(n,{prevDateTime:this._preVal,value:this.element.val()}):!1},_getDateTimeFormat:function(){var n=t.preferredCulture(this.model.locale).calendar.patterns;this.model.dateTimeFormat||(this.model.dateTimeFormat=n.d+" "+n.t);this.model.timeDisplayFormat||(this.model.timeDisplayFormat=n.t)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popup)},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error"):this.wrapper.addClass("e-error")},_getDate:function(){return this.datePicker.model.value},_getTime:function(){return this._getDateObj(this.timePicker.model.value,this.timePicker.model.timeFormat)},_setEmptyTime:function(n){var t=new Date(n);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_setEmptyDate:function(n){var t=new Date(n);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_objectToString:function(n){return this._getFormat(n,this.model.dateTimeFormat)},_stringToObject:function(n){return this._getDateObj(n,this.model.dateTimeFormat)},_getFormat:function(n,i){if(n instanceof Date){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)}return n},_checkFormat:function(n){var i=this,r=this._regExp();return n.replace(r,function(n){return n==="/"?t.preferredCulture(i.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},_regExp:function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},_getDateObj:function(n,i){var o,f;if(typeof n=="string"){if(o=this._checkFormat(i),f=t.parseDate(n,o,this.model.locale),f!=null)return f;if(n!=""&&n!=null){var e,r=/^\s*(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).*Z\s*$/.exec(n),u=new Date;if(r&&(u=new Date,e=+r[2],u.setUTCFullYear(r[1],e-1,r[3]),u.setUTCHours(r[4],r[5],r[6]),e!=u.getUTCMonth()+1&&u.setTime()),this._isValidDate(u))return u}else return null}else return n},_compare:function(n,t){return n&&t&&n.getTime()==t.getTime()},_isValidDate:function(n){return n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_change:function(n,t){this.datePicker.option(n,t);this.timePicker.option(n,t)},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popup.removeClass(this.model.cssClass).addClass(n);this._change("cssClass",n)},_localize:function(r){var u,f;if(this.model.locale=r,this.model.dateTimeFormat=this.model.timeDisplayFormat="",u=["AM","PM"],this._getDateTimeFormat(),this._localizedLabels=this._getLocalizedLabels(),t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.buttonText)||n.extend(this._localizedLabels.buttonText,this._options.buttonText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText)),this._localizedLabelToModel(),this._buttonText(this._localizedLabels.buttonText),(this.isValidState||this.model.value instanceof Date&&this._isValidDate(this.model.value))&&this.element.val(this._objectToString(this.model.value)),this._preVal=this.element.val(),this._change("locale",r),this.model.startDay=this.datePicker.model.startDay,this._validateMeridian(),this._sfTimeHour.empty(),this._renderHourTable(),this.model.timeDrillDown.showMeridian)for(i=0;i<2;i++)f=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard[u[i]])?"":t.preferredCulture(this.model.locale).calendars.standard[u[i]][0],n("span.e-hours-meridiantxt-"+u[i].toLowerCase(),this._sfTimeHour).text(f)},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_readOnly:function(n){this.model.readOnly=n;n?this.element.attr("readonly","readonly"):this.element.prop("readonly",!1);this._change("readOnly",n)},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popup.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popup.removeClass("e-corner"));this.datePicker.option("showRoundedCorner",n)},_setRtl:function(n){n?(this.wrapper.addClass("e-rtl"),this.popup.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popup.removeClass("e-rtl"));this._change("enableRTL",n)},_enabled:function(n){n?(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable())},_showButton:function(n){this.model.showPopupButton=n;n?(this.container.addClass("e-padding"),this._renderIcon()):(this.container.removeClass("e-padding"),this.datetimeIcon.remove(),this.datetimeIcon=null)},_buttonText:function(t){n.extend(this.model.buttonText,t);this.popup.find(".e-dt-today").html(this.model.buttonText.today);this.popup.find(".e-dt-now").html(this.model.buttonText.timeNow);this.popup.find(".e-dt-done").html(this.model.buttonText.done);this.popup.find(".e-timecontainer").find(".e-header").html(this.model.buttonText.timeTitle)},_checkForResponsive:function(){if(n(window).outerWidth()>200&&n(window).outerWidth()<=500)this.popup.hasClass("e-dt-responsive")||(this.popup.addClass("e-dt-responsive"),this.timePicker.option("popupWidth",this.datePicker.popup.outerWidth()),this.timePicker.option("popupHeight",98),this.timePicker._refreshScroller(),this.timePicker._changeActiveEle());else if(this.popup.hasClass("e-dt-responsive")){this.popup.removeClass("e-dt-responsive");this.timePicker.option("popupWidth",this.model.timePopupWidth);var t=this.datePicker.popup.height()-this.popup.find(".e-header").height();this.timePicker.option("popupHeight",t);this.timePicker._refreshScroller();this.timePicker._changeActiveEle()}},enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.model.enabled=!0,this.element.prop("disabled",!1),this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable").attr("aria-disabled",!1),this._isSupport||this._hiddenInput.prop("disabled",!1),this.datetimeIcon&&this.datetimeIcon.removeClass("e-disable").attr("aria-disabled",!1),this._isIE8&&this.datetimeIcon&&this.datetimeIcon.children().removeClass("e-disable"),this.popup.children("div").removeClass("e-disable").attr("aria-disabled",!1),this._change("enabled",!0))},disable:function(){this.model.enabled&&(this.element[0].disabled=!0,this.model.enabled=!1,this.wrapper.addClass("e-disable"),this.element.addClass("e-disable").attr("aria-disabled",!0),this.element.attr("disabled","disabled"),this._isSupport||this._hiddenInput.attr("disabled","disabled"),this.datetimeIcon&&this.datetimeIcon.addClass("e-disable").attr("aria-disabled",!0),this._isIE8&&this.datetimeIcon&&this.datetimeIcon.children().addClass("e-disable"),this.popup.children("div").addClass("e-disable").attr("aria-disabled",!0),this._hideResult(),this._change("enabled",!1),this.datePicker.popup.removeClass("e-disable").attr("aria-disabled",!1),this.timePicker.popup.removeClass("e-disable").attr("aria-disabled",!1))},getValue:function(){return this._objectToString(this.model.value)},setCurrentDateTime:function(){this.model.readOnly||this._setValue(new Date)},show:function(){this._showResult()},hide:function(){this._hideResult()},_wireEvents:function(){if(this.model.allowEdit&&(this._on(this.element,"focus",this._targetFocus),this._on(this.element,"blur",this._targetBlur),this._on(this.element,"keydown",this._keyDownOnInput)),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showhidePopup,this))}this.popup.on("mouseenter touchstart",n.proxy(function(){this._popClose=!0},this));this.popup.on("mouseleave touchend",n.proxy(function(){this._popClose=!1},this))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.DateTimePicker.Locale=t.DateTimePicker.Locale||{};t.DateTimePicker.Locale["default"]=t.DateTimePicker.Locale["en-US"]={watermarkText:"Select datetime",buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"}};t.PopupPosition={Bottom:"bottom",Top:"top"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r};ejDateRangePicker=function(n){function t(i){return n.call(this),this._rootCSS="e-daterangepicker",this._setFirst=!1,this.PluginName="ejDateRangePicker",this.id="myDateRange",this._addToPersist=["value"],this.type="editor",this.angular={require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},this.model=null,this.validTags=["input"],this.defaults={height:"",width:"",value:"",cssClass:"",enabled:!0,startDate:null,endDate:null,enableTimePicker:!1,ranges:null,locale:"en-US",separator:"-",watermarkText:"Select Range",dateFormat:"",timeFormat:"",showPopupButton:!0,showRoundedCorner:!1,allowEdit:!0,enablePersistence:!1,create:null,change:null,beforeClose:null,beforeOpen:null,close:null,open:null,hover:null,click:null,clear:null,destroy:null,select:null},this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1,this._prevValue=null,this._validState=null,t.prototype.observables=["value"],i&&(i.jquery||(i=$("#"+i)),i.length)?$(i).ejDateRangePicker().data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype._setModel=function(n){var t,i;for(t in n)switch(t){case"allowEdit":if(!n[t]){this.element.attr("readonly","readonly");this.element.on("mousedown",$.proxy(this._showDatePopUp,this));this.element.off("blur",$.proxy(this._onMainFocusOut,this))}break;case"startDate":i=this._validateValues(n[t],"left");i==!1?n[t]=null:(this._startEndValidation()||this.model.endDate==null||(this._resetValues(),this.model.endDate=null),this._updateValues(),this._selectedStartDate=this.model.startDate,n[t]=this.model.startDate);break;case"endDate":i=this._validateValues(n[t],"right");i==!1?n[t]=null:(this._startEndValidation()||(this._rightDP.element.parents(".e-datewidget").addClass("e-val-error"),this.model.endDate=null),this._updateValues(),n[t]=this.model.endDate);break;case"enableTimePicker":this.model.enableTimePicker=n[t];n[t]?this._renderTimePicker():this._removeTimePicker();this._scrollerObj&&(this._scrollerObj.model.height=this.datePopup.height(),this._scrollerObj.refresh());break;case"locale":this._setCulture(n[t]);n[t]=this.model.locale;break;case"separator":this.model.separator=n[t];this._mainValue();break;case"dateFormat":this._leftDP&&this._leftDP.option(t,n[t]);this._rightDP&&this._rightDP.option(t,n[t]);this.model.dateFormat=n[t];this._getDateTimeFormat();this._updateInput();break;case"timeFormat":this._leftTP&&this._leftTP.option(t,n[t]);this._rightTP&&this._rightTP.option(t,n[t]);this.model.timeFormat=n[t];this._getDateTimeFormat();this._updateInput();break;case"watermarkText":ej.isNullOrUndefined(this._options)&&(this._options={});this._options.watermarkText=this.model.watermarkText=n[t];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"cssClass":this._changeSkin(n[t]);break;case"showRoundedCorner":this._setRoundedCorner(n[t]);break;case"showPopupButton":this._renderDateIcon(n[t]);break;case"value":this.element.val(n[t]);this._onMainFocusOut();n[t]=this.model.value;break;case"height":this.wrapper.height(n[t]);break;case"width":this.wrapper.width(n[t]);break;case"enabled":n[t]?this.enable():this.disable()}},t.prototype._init=function(n){this._options=n;this._flagevents=!1;this._id=this.element.attr("id");this._isSupport=document.createElement("input").placeholder==undefined?!1:!0;this.element.val()==""&&this.model.value&&this.element.val(this.model.value);this.element.val()&&this._setInitValue();this._createDateRangePicker();this._validState==!1&&this.element.val()&&this.wrapper.addClass("e-error");this._popupOpen=!1;this._isPopScroll=!1;this.model.enabled||this.disable();this._wireEvents()},t.prototype._setInitValue=function(){var n=this.element.val().split(this.model.separator),t=ej.parseDate(n[0],this._dateTimeFormat,this.model.locale),i=ej.parseDate(n[1],this._dateTimeFormat,this.model.locale);t&&i&&(this.model.startDate=t,this.model.endDate=i)},t.prototype._getNextMonth=function(n){var i=n,r,u,t;return(i instanceof Date)?(r=i.getMonth(),r==11?(u=i.getFullYear()+1,r=-1):u=i.getFullYear(),t=new Date,t=new Date(t.setFullYear(u)),t=new Date(t.setMonth(r+1)),new Date(t.setDate(1))):new Date},t.prototype._getDateTimeFormat=function(){var n=ej.preferredCulture(this.model.locale).calendars.standard.patterns;this.model.dateFormat||(this.model.dateFormat=n.d);this.model.enableTimePicker?(this.model.timeFormat||(this.model.timeFormat=n.t),this._dateTimeFormat=this.model.dateFormat+" "+this.model.timeFormat):this._dateTimeFormat=this.model.dateFormat},t.prototype._setValues=function(){this._leftDP.option("value",this.model.startDate);this._rightDP.option("value",this.model.endDate||null);this.model.startDate&&this._setStartDate(this.model.startDate,$('.current-month[date="'+this.model.startDate.toDateString()+'"]'),!0);this.model.endDate&&this._setEndDate(this.model.endDate,$('.current-month[date="'+this.model.endDate.toDateString()+'"]'),!0);this._rangeRefresh(this._setArgs(this._leftDP.popup));this._rangeRefresh(this._setArgs(this._rightDP.popup));this._rightDP.element.parents(".e-datewidget").removeClass("e-error");this.model.enableTimePicker&&(this._leftTP.option("value",this.model.startDate),this._rightTP.option("value",this.model.endDate));this._updateRanges("left");this._updateRanges("right")},t.prototype._customSet=function(){this._selectedStartDate=this.model.startDate;this._selectedEndDate=this.model.endDate;this._resetValues();this._setValues();this._popupOpen||this._mainValue();this._refreshMinMax();this._setWaterMark()},t.prototype._setCulture=function(n){n=ej.preferredCulture(n).name;this.model.locale=n;this._setOption("locale",n);this._localizedLabels=this._getLocalizedLabels();this._setLocalizedText();this._updateInput()},t.prototype._setRoundedCorner=function(n){n?(this._input_innerWrapper.addClass("e-corner"),this.popup.addClass("e-corner")):(this._input_innerWrapper.removeClass("e-corner"),this.popup.removeClass("e-corner"));this._setOption("showRoundedCorner",n)},t.prototype._renderDateIcon=function(n){n?(this.dateRangeIcon=ej.buildTag("span.e-select#"+this.id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(ej.buildTag("span.e-icon e-calendar","",{},{"aria-label":"Select"}).attr(this._isIE8?{unselectable:"on"}:{})).insertAfter(this.element),this._input_innerWrapper.addClass("e-padding"),this._on(this.dateRangeIcon,"mousedown",this._showDatePopUp),this._off(this.dateRangeIcon,"click",this._showDatePopUp)):(this.dateRangeIcon&&this.dateRangeIcon.remove(),this._input_innerWrapper.removeClass("e-padding"),this._bindDateButton(),this._off(this.dateRangeIcon,"click",this._showDatePopUp))},t.prototype._validateValues=function(n,t){var r=t=="right"?this._rightDP:this._leftDP,i=n;if(i!=null&&typeof i=="string")t=="left"?(this.model.startDate=ej.parseDate(n,this.model.dateFormat,this.model.locale)||null,this.model.startDate=this.model.startDate!=null?this.model.startDate:new Date(i)):(this.model.endDate=ej.parseDate(n,this.model.dateFormat,this.model.locale)||null,this.model.endDate=this.model.endDate!=null?this.model.endDate:new Date(i));else if(n instanceof Date){if(t=="left"){if(this.model.startDate=n,isNaN(n.getDate()))return!1;typeof this._formatter(this.model.startDate,this.model.locale)!="string"&&(this.model.startDate=ej.parseDate(this._formatter(this.model.startDate,this.model.locale),this.model.dateFormat))}else if(t=="right"){if(this.model.endDate=n,isNaN(n.getDate()))return!1;typeof this._formatter(this.model.endDate,this.model.locale)!="string"&&(this.model.endDate=ej.parseDate(this._formatter(this.model.endDate,this.model.locale),this.model.dateFormat))}}else return!1;return!0},t.prototype._formatter=function(n,t){var i=this._checkFormat(t);return ej.format(n,i,this.model.locale)},t.prototype._checkFormat=function(n){var t=this,i=this._regExp();return n.replace(i,function(n){return n==="/"?ej.preferredCulture(t.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},t.prototype._regExp=function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},t.prototype._setArgs=function(n){var t=new Date($(n.find(".current-month")[0]).attr("date"));return this.args={},this.args.element=n,this.args.month=t.getMonth(),this.args.year=t.getFullYear(),this.args},t.prototype._changeSkin=function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popup.removeClass(this.model.cssClass).addClass(n);this._setOption("cssClass",n)},t.prototype._createDateRangePicker=function(){var n;this._localizedLabels=this._getLocalizedLabels();this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0"});this.wrapper=ej.buildTag("span.e-daterangewidget e-widget "+this.model.cssClass);ej.isTouchDevice()||this.wrapper.addClass("e-ntouch");this._input_innerWrapper=ej.buildTag("span.e-in-wrap e-box");this.wrapper.append(this._input_innerWrapper).insertBefore(this.element);this._input_innerWrapper.append(this.element);this._input_innerWrapper.addClass("e-padding");this.popup=ej.buildTag("div.e-daterangepicker-popup e-popup e-widget e-box"+this.model.cssClass+"#"+this.element[0].id+"_popup").css("display","none");this._isSupport||(this._hiddenInput=ej.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element),this._hiddenInput.val(this._localizedLabels.watermarkText),this._hiddenInput.css("display","block"),n=this,$(this._hiddenInput).focus(function(){n.element.focus()}));$("body").append(this.popup);this.datePopup=ej.buildTag("div.e-datepickers-popup");this.popup.append(this.datePopup);this._leftDiv=ej.buildTag("div.e-left-datepicker");this._rightDiv=ej.buildTag("div.e-right-datepicker");this.datePopup.append(this._leftDiv);this.datePopup.append(this._rightDiv);this.calendar_left=ej.buildTag("input.leftDate_wrapper#"+this.element[0].id+"leftDate_wrapper","",{},{type:"text"});this._leftDiv.append(this.calendar_left);this.calendar_right=ej.buildTag("input.rightDate_wrapper#"+this.element[0].id+"rightDate_wrapper","",{},{type:"text"});this._rightDiv.append(this.calendar_right);n=this;this.culture=ej.preferredCulture(this.model.locale);this._getDateTimeFormat();this._setRoundedCorner(this.model.showRoundedCorner);this._renderDateIcon(this.model.showPopupButton);this.calendar_left.ejDatePicker({displayInline:!0,showFooter:!1,watermarkText:"",enableStrictMode:!0,layoutChange:function(){n._refreshEvents("left");n._updateRanges("left");n._scrollerObj&&(n._scrollerObj.model.height=n.datePopup.height(),n._scrollerObj.refresh())},showTooltip:!1,locale:this.model.locale,dateFormat:this.model.dateFormat,_month_Loaded:function(t){n._previousNextHandler(t)},enablePersistence:this.model.enablePersistence});this._leftDP=this.calendar_left.data("ejDatePicker");this._leftDP._getInternalEvents=!0;this._leftDP._DRPdisableFade=!0;this._leftDP.option("showPopupButton",!1);this._leftDP.popup.css({position:"static",visibility:"inherit"});this.calendar_right.ejDatePicker({displayInline:!0,showFooter:!1,watermarkText:"",enableStrictMode:!0,locale:this.model.locale,create:$.proxy(this._updateOnRender,this),layoutChange:function(){n._refreshEvents("right");n._updateRanges("right");n._scrollerObj&&(n._scrollerObj.model.height=n.datePopup.height(),n._scrollerObj.refresh())},dateFormat:this.model.dateFormat,_month_Loaded:function(t){n._previousNextHandler(t)},enablePersistence:this.model.enablePersistence});this._rightDP=this.calendar_right.data("ejDatePicker");this._rightDP._getInternalEvents=!0;this._rightDP._DRPdisableFade=!0;this._rightDP.option("showPopupButton",!1);this._rightDP.popup.css({position:"static",visibility:"inherit"});this.model.ranges&&this._renderRanges();this.model.enableTimePicker&&this._renderTimePicker();this._renderButton();this._bindDateButton();this._refreshEvents("left");this._refreshEvents("right");this._updateRanges("left");this._updateRanges("right");this.wrapper&&(this.model.width&&this.wrapper.width(this.model.width),this.model.height&&this.wrapper.height(this.model.height))},t.prototype._updateOnRender=function(){this.model.enableTimePicker?this._rightTime&&(this._rightTP=this._rightTime.ejTimePicker("instance"),this._updateValues()):this.calendar_right&&(this._rightDP=this.calendar_right.ejDatePicker("instance"),this._updateValues())},t.prototype._updateRangesList=function(){$(".e-dateranges-ul").find(".rangeItem.e-active").removeClass("e-active");$(".e-dateranges-ul").find(".rangeItem.e-custompic").addClass("e-active")},t.prototype._updateValues=function(){this._updateRangesList();this._getDateTimeFormat();this._startEndValidation()||this.model.startDate!=null&&this.model.endDate==null?(this._validateValues(this.model.startDate,"left"),this._validateValues(this.model.endDate,"right"),this._setValues(),this._mainValue()):(this._clearRanges(),this.element.val(""));this._refreshMinMax();this._setWaterMark()},t.prototype._startEndValidation=function(){if(this.model.startDate&&this.model.endDate){var t=this.model.startDate,n=this.model.endDate;return n&&t>n?!1:!0}return!1},t.prototype._renderButton=function(){this._buttonDiv=ej.buildTag("div.e-drpbuttons");var n=ej.buildTag("div.e-drp-button e-drp-reset e-btn e-select e-flat").attr({tabindex:"0"}),t=ej.buildTag("div.e-drp-button e-drp-apply e-disable e-btn e-select e-flat").attr({tabindex:"0"}),i=ej.buildTag("div.e-drp-button e-drp-cancel e-btn e-select e-flat").attr({tabindex:"0"});this._buttonDiv.append(n);this._buttonDiv.append(t);this._buttonDiv.append(i);this.popup.append(this._buttonDiv);this._setLocalizedText()},t.prototype._setLocalizedText=function(){ej.isNullOrUndefined(this._options)||(ej.isNullOrUndefined(this._options.buttonText)||$.extend(this._localizedLabels.ButtonText,this._options.buttonText),ej.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this.model.buttonText=this._localizedLabels.ButtonText;$(this._buttonDiv.find("div.e-drp-reset")).text(this.model.buttonText.reset);$(this._buttonDiv.find("div.e-drp-apply")).text(this.model.buttonText.apply);$(this._buttonDiv.find("div.e-drp-cancel")).text(this.model.buttonText.cancel);this._customRangePicker&&this._customRangePicker.find("ul li.e-custompic").length>0&&this._customRangePicker.find("ul li.e-custompic").text(this._localizedLabels.customPicker);this._setWaterMark()},t.prototype._renderRanges=function(){var f,i,t,n,r,u;if(this._renderRangesWrapper(),this.popup.append(this._customRangePicker),this._ranges_li="",f=this,this.model.ranges)for(i=0;i<this.model.ranges.length;i++)t=this.model.ranges[i],n=t.range,n.length===2&&(r=new Date(n[0]),u=new Date(n[1]),ej.isNullOrUndefined(r)&&(r=new Date(n[0])),ej.isNullOrUndefined(u)&&(u=new Date(n[1])),r<=u&&(f._ranges_li+="<li aria-selected='false' title='"+t.label+"' class='rangeItem' e-date-range='"+JSON.stringify(n)+"' e-data-value='"+t.range+"'>"+t.label+"<\/li>"));this._ranges_li+="<li aria-selected='false' class='rangeItem e-active e-custompic' e-date-range='customPicker'>"+this._localizedLabels.customPicker+"<\/li>";this.popup.find("div.e-custom-dateranges ul").append(this._ranges_li);this._on(this._customRangePicker.find("ul li.rangeItem"),"click",this._customSelection);this._customRangePicker.ejScroller({height:this.datePopup.height(),width:0,scrollerSize:15});f._scrollerObj=this._customRangePicker.ejScroller("instance")},t.prototype._removeTimePicker=function(){this._leftDiv.removeClass("e-left-timepicker");this._rightDiv.removeClass("e-right-timepicker");this._leftTP.destroy();this._rightTP.destroy();this._rightTP=null;this._leftTP=null;this._leftTime.remove();this._rightTime.remove();this._setOption("width","");this._setOption("width","100%");this._updateValues()},t.prototype._setOption=function(n,t){this._leftDP&&this._leftDP.option(n,t);this._rightDP&&this._rightDP.option(n,t);this.model.enableTimePicker&&(this._leftTP&&this._leftTP.option(n,t),this._rightTP&&this._rightTP.option(n,t))},t.prototype._renderTimePicker=function(){this.model.timeFormat==""&&(this.model.timeFormat=this.culture.calendar.patterns.t);this._leftTime=ej.buildTag("input.leftTime#"+this._id+"_lTime");this._leftDiv.append(this._leftTime);this._leftDiv.addClass("e-left-timepicker");var n=this;this._leftTime.ejTimePicker({popupWidth:"115px",locale:this.model.locale,timeFormat:this.model.timeFormat,select:function(t){n.model.startDate&&n.model.endDate&&(n._rightTP&&n.model.startDate.toLocaleDateString()==n.model.endDate.toLocaleDateString()&&n._rightTP.option("minTime",t.value),n._buttonDiv.find(".e-drp-apply").removeClass("e-disable"))}});this._leftTP=this._leftTime.ejTimePicker("instance");this._leftTP.popup.addClass("e-daterange-timepopup");this._rightTime=ej.buildTag("input.rightTime#"+this._id+"_rTime");this._rightDiv.append(this._rightTime);this._rightDiv.addClass("e-right-timepicker");this._rightTime.ejTimePicker({popupWidth:"115px",locale:this.model.locale,create:$.proxy(this._updateOnRender,this),timeFormat:this.model.timeFormat,select:function(){n.model.startDate&&n.model.endDate&&n._buttonDiv.find(".e-drp-apply").removeClass("e-disable")}});this._rightTP=this._rightTime.ejTimePicker("instance");this._rightTP.popup.addClass("e-daterange-timepopup");this._on(this._leftTP.element,"keydown",this._onKeyDown);this._on(this._rightTP.element,"keydown",this._onKeyDown);this._setTimePickerPos()},t.prototype._setTimePickerPos=function(){$("#"+this._id+"_lTime_timewidget").css({position:"absolute",top:0,left:this._leftDP.popup.width()+this._leftDP.popup.position().left-this.popup.find($("#"+this._id+"_lTime_timewidget")).outerWidth()});$("#"+this._id+"_rTime_timewidget").css({position:"absolute",top:this.popup.hasClass("e-daterange-responsive")?this._rightDP.wrapper.position().top:0,left:this._rightDP.popup.width()+this._rightDP.popup.position().left-this.popup.find($("#"+this._id+"_rTime_timewidget")).outerWidth()})},t.prototype._updateInput=function(){if(!(this.model.startDate&&this.model.endDate)){this.model.value&&this.element.val(this.model.value);this._popupOpen&&this.popupHide();return}this._resetValues();this.wrapper.removeClass("e-error");this._mainValue();this._refreshMinMax()},t.prototype._removeWatermark=function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},t.prototype._mainValue=function(){var i="",r="",u=this.model.startDate,f=this.model.endDate,n=ej.format(u,this.model.dateFormat,this.model.locale),t=ej.format(f,this.model.dateFormat,this.model.locale);this.model.enableTimePicker&&this._leftTP&&this._rightTP&&this._leftTP.model.value&&this._rightTP.model.value?(i=this._leftTP.model.value,r=this._rightTP.model.value,n=ej.format(n+" "+i,this._dateTimeFormat,this.model.locale),t=ej.format(t+" "+r,this._dateTimeFormat,this.model.locale),this.model.startDate=ej.parseDate(n,this._dateTimeFormat,this.model.locale),this.model.endDate=ej.parseDate(t,this._dateTimeFormat,this.model.locale)):(this.model.startDate=ej.parseDate(n,this._leftDP.model.dateFormat,this.model.locale),this.model.endDate=ej.parseDate(t,this._rightDP.model.dateFormat,this.model.locale));n!=null&&t!=null?(this.model.value=n+" "+this.model.separator+" "+t,this.element.val(this.model.value),this._hiddenInput&&this._hiddenInput.attr("value",this.model.value),this._removeWatermark(),this._validState=!0):(this.model.value=null,this._setWaterMark(),this._validState=!1);this._prevValue=this.model.value;this._buttonDiv&&this._buttonDiv.find(".e-drp-apply").addClass("e-disable");this._trigger("_change",{value:this.model.value})},t.prototype._bindDateButton=function(){if(this.dateRangeicon&&this._on(this.dateRangeIcon,"click",this._showDatePopUp),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",$.proxy(this._showDatePopUp,this));this.element.off("blur",$.proxy(this._onMainFocusOut,this))}this.model.allowEdit&&this.element.off("mousedown",$.proxy(this._showDatePopUp,this))},t.prototype._showDatePopUp=function(n){if(!this.model.enabled)return!1;var t=!1;(n.button?t=n.button==2:n.which&&(t=n.which==3),t)||this._showhidePopup(n)},t.prototype._showhidePopup=function(n){this._popupOpen?(this._isFocused||!this.element.is(":input")||ej.isTouchDevice()||this.wrapper.addClass("e-focus"),this.popupHide(n)):(this._isFocused||!this.element.is(":input")||ej.isTouchDevice()||this.wrapper.addClass("e-focus"),this.popupShow(n))},t.prototype.popupHide=function(n){if(!this._popupOpen||this._isPopScroll)return!1;var t=this;this._trigger("beforeClose",{element:this.popup,events:n});this.popup.attr({"aria-hidden":"true"});this._leftTP&&!this._leftTP._popupOpen&&this._leftTP.hide();this._rightTP&&!this._rightTP._popupOpen&&this._rightTP.hide();this.popup.css("visibility","visible").slideUp(100,function(){t._popupOpen=!1});this._off(ej.getScrollableParents(this.wrapper),"scroll",$.proxy(this.popupHide,this));this._trigger("close",{element:this.popup,events:n});this.wrapper.removeClass("e-active")},t.prototype.popupShow=function(n){if(!this.model.enabled||this._popupOpen)return!1;var t=this;this._trigger("beforeOpen",{element:this.popup,events:n});this.wrapper.addClass("e-focus");this.popup.attr({"aria-hidden":"false"});t._popupOpen=!0;this.popup.css({visibility:"hidden",display:"block"});this._resizePopup();this.popup.css({display:"none",visibility:"visible"}).slideDown(100,function(){});this._on(ej.getScrollableParents(this.wrapper),"scroll",$.proxy(this.popupHide,this));this._trigger("open",{element:this.popup,events:n});this.wrapper.addClass("e-active")},t.prototype._resizePopup=function(){var n=this,i=0,t=0,u=n.datePopup.find(".e-popup.e-calendar").outerWidth(),r=n.datePopup.find(".e-popup.e-calendar").height();if(this._customRangePicker&&this._customRangePicker.height()<=0&&this._customRangePicker.height(this.datePopup.height()),this.model.ranges&&this.model.ranges.length>0&&(t=this._customRangePicker.find("ul").height(),i=n._customRangePicker.outerWidth()),$(window).width()-this.wrapper.position().left<u*2+i+25){if(n.popup.addClass("e-daterange-responsive"),n._setOption("width","95%"),this.model.enableTimePicker){this._setOption("width","47%");this._setDatePickerPosition();$("#"+this._id+"_lTime_timewidget").css({left:this._leftDP.wrapper.outerWidth()+5});$("#"+this._id+"_rTime_timewidget").css({left:this._rightDP.wrapper.outerWidth()+5});n._scrollerObj&&(n._scrollerObj.model.height=t<r?t+10:r,n._scrollerObj.refresh());return}}else n.popup.removeClass("e-daterange-responsive"),this.model.enableTimePicker&&(this._leftTP.option("width","115px"),this._rightTP.option("width","115px"),this._setTimePickerPos()),n._scrollerObj&&(n._scrollerObj.model.height=this.datePopup.height(),n._scrollerObj.refresh());this._setDatePickerPosition()},t.prototype._onDocumentClick=function(n){this.model&&($(n.target).is(this.popup)||$(n.target).parents(".e-popup").is(this.popup)||$(n.target).is(this.wrapper)||$(n.target).parents(".e-daterangewidget").is(this.wrapper)||(!this.model.enableTimePicker||$(n.target).is(this._leftTP.popup)||$(n.target).parents(".e-popup").is(this._leftTP.popup)||$(n.target).is(this._rightTP.popup)||$(n.target).parents(".e-popup").is(this._rightTP.popup)||(this._popupOpen&&this.popupHide(n),this.wrapper.removeClass("e-focus")),this.model.enableTimePicker||(this._popupOpen&&this.popupHide(n),this.wrapper.removeClass("e-focus"))))},t.prototype._getOffset=function(n){var t=n.offset()||{left:0,top:0},i;return $("body").css("position")!="static"&&(i=$("body").offset(),t.left-=i.left,t.top-=i.top),t},t.prototype._getZindexPartial=function(n,t){var u,r,i;if(!ej.isNullOrUndefined(n)&&n.length>0)return u=n.parents(),r=$("body").children(),!ej.isNullOrUndefined(n)&&n.length>0&&r.splice(r.index(t),1),$(r).each(function(n,t){u.push(t)}),i=Math.max.apply(i,$.map(u,function(n){if($(n).css("position")!="static")return parseInt($(n).css("z-index"))||1})),!i||i<1e4?i=1e4:i+=1,i},t.prototype._setDatePickerPosition=function(){var n=this.element.is("input")?this.wrapper:this.element,t=this._getOffset(n),u,s=$(document).scrollTop()+$(window).height()-(t.top+$(n).outerHeight()),h=t.top-$(document).scrollTop(),r=this.popup.outerHeight(),f=this.popup.outerWidth(),i=t.left,e=n.outerHeight(),a=(e-n.height())/2,c=this._getZindexPartial(this.element,this.popup),o=3,l=r<s||r>h?t.top+e+o:t.top-r-o;u=$(document).scrollLeft()+$(window).width()-i;f>u&&f<i+n.outerWidth()&&(i-=this.popup.outerWidth()-n.outerWidth());this.popup.css({left:i+"px",top:l+"px","z-index":c});this.model.enableTimePicker&&($("#"+this._id+"_lTime_timewidget").css({position:"absolute",top:0,left:this._leftDP.popup.width()+this._leftDP.popup.position().left-$("#"+this._id+"_lTime_timewidget").width()}),$("#"+this._id+"_rTime_timewidget").css({position:"absolute",top:this.popup.hasClass("e-daterange-responsive")?this._rightDP.wrapper.position().top:0,left:this._rightDP.popup.width()+this._rightDP.popup.position().left-$("#"+this._id+"_rTime_timewidget").width()}))},t.prototype._dateEleClicked=function(n){var r,i,u,e,t,f;if(this._updateRangesList(),this._activeItem=$(n.currentTarget),this._activeItem.hasClass("e-hidedate")){n.stopPropagation();return}(this._activeItem.hasClass("other-month")&&this._refreshMinMax(),t=this._activeItem.attr("date"),r=$(n.currentTarget).parents(".e-left-datepicker").length>0?"left":"right",ej.isNullOrUndefined(t)||t==="")||(i=new Date(t),this._selectedStartDate!=null&&this._selectedEndDate!=null&&(this._selectedStartDate=null),this._selectedStartDate==null?(this._selectedStartDate=i,this._selectedEndDate=null,this._startDate&&(this._startDate.date=null),this._rightDP.element.val(null),r=="right"&&(this._leftDP._stopRefresh=!0,this._leftDP.option("value",this._selectedStartDate),this._leftDP.element.val(this._selectedStartDate.toLocaleDateString())),this._rightTP&&this._rightTP.option("value",""),this.popup.find(".in-range").removeClass("in-range"),this.datePopup.find("td.e-state-default.e-active").removeClass("e-active"),this._rightDP.element.parents(".e-datewidget").removeClass("e-error"),u=$(this.datePopup.find('.current-month[date="'+t+'"]')),this._selectedStartDate=new Date(u.attr("date")),this._setStartDate(this._selectedStartDate,u,!0)):this._selectedStartDate===null||this._selectedEndDate!=null||i<this._selectedStartDate?(this._selectedStartDate=i,this._selectedEndDate=null,this._endDate&&(this._endDate.date=null),this.popup.find(".in-range").removeClass("in-range"),this._rightDP.option("value",null),this._rightTP&&this._rightTP.option("value",""),r=="right"&&(this._leftDP._stopRefresh=!0,this._leftDP.option("value",this._selectedStartDate),this._leftDP.element.val(this._selectedStartDate.toLocaleDateString())),this._setStartDate(this._selectedStartDate,this._activeItem,!0),this._updateRanges("left"),this._updateRanges("right")):(e=i,t=$(n.currentTarget).attr("date"),this._rightDP._stopRefresh=!0,this._rightDP.option("value",new Date(t)),this._rightDP._stopRefresh=!1,this._rightTP&&this._rightTP.option("value",new Date(t)),this._rightDP.element.parents(".e-datewidget").removeClass("e-error"),f=$(this.datePopup.find('.current-month[date="'+t+'"]')),this._selectedStartDate=this.model.startDate,this._selectedEndDate=new Date(t),this._setEndDate(this._selectedEndDate,f,!0),this._startDate={},this._startDate.date=this._selectedStartDate,this._updateRanges("left"),this._updateRanges("right"),r=="left"&&(this._leftDP._stopRefresh=!0,this._leftDP.option("value",this.model.startDate),this._leftDP.element.val(this.model.startDate.toLocaleDateString()))),this._trigger("click",{element:$(n.currentTarget),startDate:this.model.startDate,endDate:this.model.endDate,value:new Date($(n.currentTarget).attr("date"))}))},t.prototype._setStartDate=function(n,t,i){if(this._startDate={},this._startDate.date=n,i&&(this._endDate={},this._endDate.date=null),this._leftDP._checkDateArrows(),this.datePopup.find("td.e-state-default").removeClass("e-select e-start-date e-active showrange e-end-date e-state-hover"),this.popup.find(".in-range").removeClass("in-range"),t.addClass("e-start-date"),this.model.startDate=n,this._buttonDiv&&this._buttonDiv.find(".e-drp-apply").addClass("e-disable"),this.model.enableTimePicker){var u=this._leftTP,r=ej.format(this._leftTP.model.value||this._leftDP.model.value,u.model.timeFormat,this.model.locale);r&&this._rightTP.option("minTime",r);r&&this._leftTP.option("value",r)}},t.prototype._setEndDate=function(n,t){if((this._rightDP.element.parents(".e-datewidget").removeClass("e-val-error"),this._endDate={},this._endDate.date=n,this.popup.find("td.e-end-date").removeClass("e-select e-end-date"),t.addClass("e-end-date"),this._buttonDiv&&this._buttonDiv.find(".e-disable").removeClass("e-disable"),this.model.endDate=n,this._startDate.date.getFullYear()!=this._endDate.date.getFullYear()||this._startDate.date.getMonth()!=this._endDate.date.getMonth())&&this.model.enableTimePicker)if(this.model.startDate.getDate()==this.model.endDate.getDate())this._rightTP.option("minTime",this._leftTP.option("value")||""),this._rightTP.option("value",this._leftTP.option("value")||"");else{var r=this._rightTP,i=ej.format(this._rightTP.model.value,r.model.timeFormat,this.model.locale);i&&this._rightTP.option("minTime",i);i&&this._rightTP.option("value",i)}},t.prototype._rangeRefresh=function(n){var t,r,i,f,u;this._rightDP&&(i=n.element.parent().hasClass("e-left-datepicker")?this._leftDP.popup:this._rightDP.popup);this._startDate&&this._startDate.date&&this._startDate.date.getMonth()==n.month&&this._startDate.date.getFullYear()==n.year&&(t=$(i.find('.current-month[date="'+this._startDate.date.toDateString()+'"]')),this._setStartDate(this._startDate.date,t,!1),this._startDate.date.getDate()+1==t.next("td").text()&&$(t).addClass("showrange"));this._endDate&&this._endDate.date&&this._endDate.date.getMonth()==n.month&&this._endDate.date.getFullYear()==n.year&&(r=$(i.find('.current-month[date="'+this._endDate.date.toDateString()+'"]')),this._setEndDate(this._endDate.date,r,!1));t==r&&$(t).removeClass("showrange");this._rightDP&&this._startDate&&this._startDate.date&&this._endDate&&this._endDate.date&&this._startDate.date.getFullYear()<=n.year&&this._endDate.date.getFullYear()>=n.year&&(f=n.element.parent().hasClass("e-left-datepicker")?$(i.find("td.current-month")[0]):$(i.find("td.current-month")[0]),u=n.element.parent().hasClass("e-left-datepicker")?"left":"right",this._updateRanges(u))},t.prototype._renderRangesWrapper=function(){ej.isNullOrUndefined(this._customRangePicker)&&(this._customRangePicker=ej.buildTag("div.e-custom-dateranges").css("height",this.datePopup.height()),this.popup.append(this._customRangePicker),this._customRangePicker.insertBefore(this._buttonDiv),this._ranges_li="<ul class='e-dateranges-ul'><\/ul>",this._customRangePicker.append(this._ranges_li))},t.prototype.setRange=function(n){var t,i;if(this._clearRanges(),typeof n=="string"){for(i=0;i<this.model.ranges.length;i++)if(t=this.model.ranges[i],t.label==n){this.model.startDate=t.range[0];this.model.endDate=t.range[1];this._updatePreRanges();return}}else if(typeof n=="object"&&n.length==2){this.model.startDate=n[0];this.model.endDate=n[1];this._updatePreRanges();return}},t.prototype._updatePreRanges=function(){this._selectedStartDate=this.model.startDate;this._selectedEndDate=this.model.endDate;this._resetValues();this._setValues();this._refreshMinMax();this._popupOpen||this._mainValue();this._setWaterMark()},t.prototype.destroy=function(){this.destroy()},t.prototype._destroy=function(){this._popupOpen&&this._showhidePopup();this.wrapper&&(this.element.removeClass("e-input"),this.element.insertAfter(this.wrapper),this.wrapper.remove());ej.isNullOrUndefined(this._leftDP)||this._leftDP.destroy();ej.isNullOrUndefined(this._rightDP)||this._rightDP.destroy();ej.isNullOrUndefined(this._rightTP)||this._rightTP.destroy();ej.isNullOrUndefined(this._leftTP)||this._leftTP.destroy();ej.isNullOrUndefined(this._scrollerObj)||this._scrollerObj.destroy();this.popup.remove()},t.prototype.addRanges=function(n){var o=this,e="",r,t,i,u,f;if(n)for(r=0;r<n.length;r++)t=n[r],i=t.range,i.length===2&&(u=new Date(i[0]),f=new Date(i[1]),ej.isNullOrUndefined(u)&&(u=new Date(i[0])),ej.isNullOrUndefined(f)&&(f=new Date(i[1])),u<=f&&(t.label||(t.label="PreDefined Ranges"),e+="<li aria-selected='false' title='"+t.label+"'class='rangeItem' e-date-range='"+JSON.stringify(i)+"' e-data-value='"+t.range+"'>"+t.label+"<\/li>"));this._renderRangesWrapper();this._customRangePicker.find(".e-dateranges-ul").append(e);this._off(this._customRangePicker.find("ul li.rangeItem"),"click",this._customSelection);this._on(this._customRangePicker.find("ul li.rangeItem"),"click",this._customSelection);this._scrollerObj&&this._scrollerObj.refresh()},t.prototype._righthoverRange=function(n){var r,i,t;if(this._activeItem=$(n.currentTarget),this._activeItem.hasClass("e-hidedate")){n.stopPropagation();return}this.popup.find(".range-hover").removeClass("range-hover");this._activeItem.hasClass("in-range")&&this._activeItem.addClass("range-hover");r=this._activeItem.attr("date");i=new Date(r);this._trigger("hover",{element:n.currentTarget,events:n,value:new Date(this._activeItem.attr("date"))});t=this;!ej.isNullOrUndefined(t._selectedStartDate)&&ej.isNullOrUndefined(t._selectedEndDate)&&this.popup.find(".current-month").each(function(n,r){var u=$(r),e=u.attr("date"),f;ej.isNullOrUndefined(e)||e===""||(f=new Date(e),f>t._startDate.date&&f<i?u.addClass("in-range"):u.removeClass("in-range"),f.getTime()===t._selectedStartDate.getTime()&&u.next().length!==0&&u.next("td.current-month").length!==0&&i>t._selectedStartDate&&new Date(new Date(t._selectedStartDate.getTime()).setDate(t._selectedStartDate.getDate()+1)).getTime()!==i.getTime()?u.addClass("showrange"):u.removeClass("showrange"))})},t.prototype._customSelection=function(n){if(this._customRangePicker.find(".e-active").removeClass("e-active"),$(n.currentTarget).attr("e-date-range")!="customPicker"){var t=$(n.currentTarget).attr("e-data-value").split(",");this.model.startDate=new Date(t[0]);this.model.endDate=new Date(t[1]);this._rightDP.element.parents(".e-datewidget").removeClass("e-error");this._customSet()}else this.model.startDate=null,this.model.endDate=null,this._clearRanges();$(n.currentTarget).addClass("e-active")},t.prototype._setWaterMark=function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._isSupport||this.element.val()!=""?$(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},t.prototype._clearRanges=function(){this._updateRangesList();this._setOption("value","");this._rightDP.element.parents(".e-datewidget").removeClass("e-val-error");this._selectedStartDate=null;this._selectedEndDate=null;this._startDate&&(this._startDate.date=null);this._endDate&&(this._endDate.date=null);this.popup.find("td").removeClass("e-start-date e-end-date in-range e-active e-state-hover today");this.model.value=null;this.model.startDate=null;this.model.endDate=null;this._buttonDiv&&this._buttonDiv.find(".e-drp-apply").addClass("e-disable")},t.prototype.clearRanges=function(){this._clearRanges();this._refreshMinMax();this.element.val("");this._trigger("_change",{value:this.model.value});this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate});this._trigger("clear",{})},t.prototype._getLocalizedLabels=function(){return ej.getLocalizedConstants("ej.DateRangePicker",this.model.locale)},t.prototype._unWireEvents=function(){this._off($(".e-next",this.popup),"click",$.proxy(this._previousNextHandler,this));this._off($(".e-prev",this.popup),"click",$.proxy(this._previousNextHandler,this));this._off($(this._buttonDiv.find("div.e-drp-cancel")),"click",this._cancelButton);this._off($(this._buttonDiv.find("div.e-drp-reset")),"click",this.clearRanges);this._off(this.popup.find(".leftDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._off(this.popup.find(".rightDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this.model.allowEdit&&(this._off(this.element,"blur",this._onMainFocusOut),this._off(this.element,"focus",this._onFocusIn),this._off(this.element,"keydown",this._onKeyDown))},t.prototype._onDocumentKeyDown=function(n){n.keyCode=="13"&&!this._buttonDiv.find(".e-drp-apply").hasClass("e-disable")&&this.wrapper.hasClass("e-focus")&&this._buttonDiv.find(".e-drp-apply").click()},t.prototype._wireEvents=function(){this._on($(".e-next",this.popup),"click",$.proxy(this._previousNextHandler,this));this._on($(".e-prev",this.popup),"click",$.proxy(this._previousNextHandler,this));this._on($(this._leftDP.sfCalendar.find("table .e-datepicker-months td")),"click",$.proxy(this._previousNextHandler,this));var n=this;this._on($(this._buttonDiv.find("div.e-drp-reset")),"click",this.clearRanges);this._on($(this._buttonDiv.find("div.e-drp-apply")),"click",function(){n._buttonDiv.find(".e-drp-apply").hasClass("e-disable")||(n._isPopScroll=!1,n._updateInput(),n._showhidePopup(),n._buttonDiv.find(".e-drp-apply").addClass("e-disable"),this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate}),this._trigger("select",{startDate:this.model.startDate,endDate:this.model.endDate,value:this.model.value}))});this._on($(window),"resize",this._resizePopup);$(document).on("mousedown",$.proxy(this._onDocumentClick,this));$(document).on("keydown",$.proxy(this._onDocumentKeyDown,this));this._on($(this._buttonDiv.find("div.e-drp-cancel")),"click",this._cancelButton);this._on(this.popup.find(".leftDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".rightDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".leftDate_wrapper.e-timepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".rightDate_wrapper.e-timepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this.model.allowEdit&&(this._on(this.element,"blur",this._onMainFocusOut),this._on(this.element,"focus",this._onFocusIn),this._on(this.element,"keydown",this._onKeyDown));this._on(this._leftDP.element,"keydown",this._onKeyDown);this._on(this._rightDP.element,"keydown",this._onKeyDown);this.popup.on("mouseenter touchstart",$.proxy(function(){this._isPopScroll=!0},this));this.popup.on("mouseleave touchend",$.proxy(function(){this._isPopScroll=!1},this))},t.prototype._onFocusIn=function(n){this._isSupport&&(n.preventDefault(),this._isFocused=!0);this.wrapper.hasClass("e-error")&&(this._validState=!1,this.wrapper.removeClass("e-error"));this.model.showPopupButton||this.model.readOnly||this.popupShow(n);this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this.wrapper.addClass("e-focus")},t.prototype._onKeyDown=function(n){n.keyCode==13&&($(n.currentTarget).hasClass("e-datepicker")?(this._validateValues($(n.currentTarget).val(),$(n.currentTarget).parents(".e-left-datepicker").length>0?"left":"right"),$(n.currentTarget).parents(".e-left-datepicker").length>0?this._leftDP.model.value=this.model.startDate:this._rightDP.model.value=this.model.endDate,this._onPopupFocusOut(n)):$(n.currentTarget).hasClass("leftTime")?this._leftTP._trigger("select"):this._rightTP._trigger("select"));n.stopImmediatePropagation()},t.prototype._cancelButton=function(){this._prevValue=null;this._isPopScroll=!1;this._clearRanges();this._onMainFocusOut();this._showhidePopup()},t.prototype._updateRanges=function(n){var i=n=="left"?this._leftDP:this._rightDP,t=this;if(i.popup.find("td.current-month").each(function(n,i){var r=$(i),f=r.attr("date"),u;ej.isNullOrUndefined(f)||f===""||(u=new Date(f),ej.isNullOrUndefined(t._startDate)||ej.isNullOrUndefined(t._startDate.date)||ej.isNullOrUndefined(t._endDate.date)||(u>t._startDate.date&&u<t._endDate.date?r.addClass("in-range"):r.removeClass("in-range")),ej.isNullOrUndefined(t._startDate)||ej.isNullOrUndefined(t._startDate.date)||u.toDateString()!=t._startDate.date.toDateString()||(r.addClass("e-start-date"),ej.isNullOrUndefined(t._endDate)||ej.isNullOrUndefined(t._endDate.date)||t._startDate.date.toDateString()==t._endDate.date.toDateString()||r.addClass("showrange"),r.removeClass("in-range")),ej.isNullOrUndefined(t._endDate)||ej.isNullOrUndefined(t._endDate.date)||ej.isNullOrUndefined(t._endDate)||u.toDateString()!=t._endDate.date.toDateString()||(r.addClass("e-end-date"),r.removeClass("in-range")))}),i.popup.find(".e-start-date").length>0){if($(i.popup.find(".e-start-date")).next("td.in-range").length>0)return;$(i.popup.find(".e-start-date")).removeClass("showrange")}},t.prototype.getSelectedRange=function(){return{startDate:this.model.startDate,endDate:this.model.endDate}},t.prototype.enable=function(){this.element[0].disabled=!1;this.model.enabled=!0;this.wrapper.removeClass("e-disable");this.element.removeClass("e-disable");this.element.attr("aria-enabled","false");this.element.attr("enabled","enabled");this._isSupport||this._hiddenInput.attr("enabled","enabled");this.dateRangeIcon&&this.dateRangeIcon.removeClass("e-disable").attr("aria-disabled","false");this.popup.children("div").removeClass("e-disable").attr("aria-disabled","false");this._setOption("enabled",!0)},t.prototype.disable=function(){this.element[0].disabled=!0;this.model.enabled=!1;this.wrapper.addClass("e-disable");this.element.addClass("e-disable");this.element.attr("aria-disabled","true");this.element.attr("disabled","disabled");this._isSupport||this._hiddenInput.attr("disabled","disabled");this.dateRangeIcon&&this.dateRangeIcon.addClass("e-disable").attr("aria-disabled","true");this.popup.children("div").addClass("e-disable").attr("aria-disabled","true");this.popupHide();this._setOption("enabled",!1)},t.prototype._onMainFocusOut=function(){var n=this.element.val(),t;if(this.wrapper.removeClass("e-focus"),this.element.val()!=""||this._prevValue!=null){if(this._prevValue&&this._prevValue==this.element.val()){this._validState?this.wrapper.removeClass("e-error").removeClass("e-focus"):this.wrapper.addClass("e-error").removeClass("e-focus");return}if(this._updateRangesList(),this.element.val()==""){this.wrapper.removeClass("e-error");this._clearRanges();this._setWaterMark();this._refreshMinMax();this._trigger("change",{value:this.model.value,startDate:null,endDate:null});this._trigger("_change",{value:this.model.value});return}this.wrapper.removeClass("e-error");var i=this.element.val().split(this.model.separator),r=ej.parseDate(i[0],this._dateTimeFormat,this.model.locale),u=ej.parseDate(i[1],this._dateTimeFormat,this.model.locale);if(this._resetValues(),this._validState=!0,this._validateValues(r,"left")&&this._validateValues(u,"right")||(this._clearRanges(),this._refreshMinMax(),t=!0),this._startEndValidation()||(this._clearRanges(),this._refreshMinMax(),t=!0),n!=""&&t){this.element.val(n);this.wrapper.addClass("e-error");this.model.value=null;this._validState=!1;this._trigger("_change",{value:this.element.val()});this._trigger("change",{value:this.model.value,startDate:null,endDate:null});return}this._resetValues();this._setValues();this._refreshMinMax();this.model.value=this._validState&&n!=""?n:null;this._popupOpen||this._mainValue();this._prevValue=this.model.value;this._validState?this.wrapper.removeClass("e-error").removeClass("e-focus"):this.wrapper.addClass("e-error").removeClass("e-focus");this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate})}},t.prototype._onPopupFocusOut=function(n){var r;(ej.format(this._selectedStartDate,"M/d/yyyy")!=$("#daterangeleftDate_wrapper").val()||ej.format(this._selectedEndDate,"M/d/yyyy")!=$("#daterangerightDate_wrapper").val())&&this._updateRangesList();r=$(n.currentTarget).parents(".e-left-datepicker").length>0?this._leftDP:this._rightDP;this._validateValues($(n.currentTarget).val(),$(n.currentTarget).parents(".e-left-datepicker").length>0?"left":"right");$(n.currentTarget).parents(".e-left-datepicker").length>0?this._leftDP.model.value=this.model.startDate:this._rightDP.model.value=this.model.endDate;var t=this.model.startDate,u=this.model.endDate,i=!1;if(this._rightDP.element.parents(".e-datewidget").removeClass("e-val-error"),this._startEndValidation()||($(n.currentTarget).parents(".e-left-datepicker").length>0?(this._clearRanges(),this.model.startDate=t,this._selectedStartDate=this.model.startDate):(this._rightDP.element.parents(".e-datewidget").addClass("e-val-error"),this.model.endDate=null,i=!0)),t==null){this._clearRanges();return}this._selectedStartDate=this.model.startDate;this._selectedEndDate=this.model.endDate;this._resetValues();this._setValues();this.model.showPopupButton||this._off(this.element,"click",this._elementClick);this._refreshMinMax();this._popupOpen||this._mainValue();i&&this._rightDP.element.val(u.toLocaleDateString());this._setWaterMark()},t.prototype._resetValues=function(){this._leftDP.option("maxDate",null);this._rightDP.option("minDate",null);this._leftDP.option("value",this._leftDP.model.value);this._rightDP.option("value",this._rightDP.model.value)},t.prototype._refreshMinMax=function(){var n=this._getNextMonth(this._leftDP._calendarDate),t;n.toDateString()>this._rightDP._calendarDate.toDateString()&&(t=this._rightDP.model.value,this._rightDP._calendarDate=n,this._rightDP._dateValue=n,this._rightDP.option("value",n));this._rightDP.option("minDate",n);this._rightDP.option("value",t);var t=this._rightDP._calendarDate,i=t.getFullYear(),r=t.getMonth();this._leftDP.option("maxDate",new Date(i,r,0))},t.prototype._refreshEvents=function(){this._off(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._off(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._off(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._off(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._on(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._on(this._leftDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._on(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"mouseover",this._righthoverRange);this._on(this._rightDP.sfCalendar.find("table .e-datepicker-days td.e-state-default"),"click",this._dateEleClicked);this._on($(this._leftDP.sfCalendar.find("table .e-datepicker-months td")),"click",$.proxy(this._previousNextHandler,this))},t.prototype._previousNextHandler=function(n){var s=$(n.currentTarget).closest(".e-calendar").parent(),u=s.hasClass("e-left-datepicker")?"left":"right",i,r,f,e,h,t;if(n.type=="_month_Loaded"?u=="left"?(r=$(this._rightDP.popup.find("td.current-month")[0]).attr("date"),i=this._leftDP._dateValue.toDateString()):u=="right"&&(i=$(this._leftDP.popup.find("td.current-month")[0]).attr("date"),r=this._rightDP._dateValue.toDateString()):(r=$(this._rightDP.popup.find("td.current-month")[0]).attr("date"),i=$(this._leftDP.popup.find("td.current-month")[0]).attr("date")),f=new Date(i),e=new Date(r),f.setHours(0,0,0,0),e.setHours(0,0,0,0),h=!0,u=="right"){t=$("table",this._leftDP.sfCalendar).get(0).className;t=="e-dp-viewdays"&&(this._leftDP._stopRefresh=!0);this._rightDP._stopRefresh=!1;var o=e,c=o.getFullYear(),l=o.getMonth();this._leftDP.option("maxDate",new Date(c,l,0));t=="e-dp-viewmonths"&&this._leftDP._startLevel("year");this._leftDP._checkDateArrows()}else t=$("table",this._rightDP.sfCalendar).get(0).className,$("table",this._rightDP.sfCalendar).get(0).className=="e-dp-viewdays"&&(this._rightDP._stopRefresh=!0),this._leftDP._stopRefresh=!1,this._rightDP.option("minDate",this._getNextMonth(f)),t=="e-dp-viewmonths"&&this._rightDP._startLevel("year"),this._rightDP._checkDateArrows();this._rightDP.element.parents(".e-datewidget").removeClass("e-error")},t}(ej.WidgetBase);window.ej.widget("ejDateRangePicker","ej.DateRangePicker",new ejDateRangePicker);window.ejDateRangePicker=null;ej.DateRangePicker.Locale={};ej.DateRangePicker.Locale=ej.DateRangePicker.Locale||{};ej.DateRangePicker.Locale["default"]=ej.DateRangePicker.Locale["en-US"]={ButtonText:{apply:"Apply",cancel:"Cancel",reset:"Reset"},watermarkText:"Select Range",customPicker:"Custom Picker"},function(n,t,i){t.widget("ejDialog","ej.Dialog",{_rootCSS:"e-dialog",element:null,_ignoreOnPersist:["drag","dragStart","dragStop","resizeStop","resizeStart","resize","beforeClose","beforeOpen","collapse","expand","close","open","destroy","create","ajaxSuccess","ajaxError","contentLoad","actionButtonClick","enableResize"],model:null,validTags:["div","span"],_setFirst:!1,angular:{terminal:!1},defaults:{showOnInit:!0,closeOnEscape:!0,closeIconTooltip:"close",enableAnimation:!0,allowDraggable:!0,backgroundScroll:!0,height:"auto",minHeight:120,minWidth:200,maxHeight:null,maxWidth:null,enableModal:!1,position:{X:"",Y:""},containment:null,enableResize:!0,htmlAttributes:{},showHeader:!0,showFooter:!1,contentType:null,contentUrl:null,ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},title:"",width:400,zIndex:1e3,cssClass:"",enableRTL:!1,allowKeyboardNavigation:!0,showRoundedCorner:!1,actionButtons:["close"],animation:{show:{effect:"fade",duration:400},hide:{effect:"fade",duration:400}},tooltip:{close:"Close",collapse:"Collapse",restore:"Restore",maximize:"Maximize",minimize:"Minimize",expand:"Expand",unPin:"UnPin",pin:"Pin"},footerTemplateId:null,locale:"en-US",faviconCSS:null,content:null,target:null,enablePersistence:!1,enabled:!0,isResponsive:!1,actionButtonClick:null,beforeClose:null,close:null,expand:null,collapse:null,beforeOpen:null,open:null,drag:null,dragStart:null,dragStop:null,resize:null,resizeStart:null,resizeStop:null,contentLoad:null,ajaxSuccess:null,ajaxError:null,create:null,destroy:null,Close:null},dataTypes:{showOnInit:"boolean",closeOnEscape:"boolean",enableAnimation:"boolean",backgroundScroll:"boolean",position:"data",animation:"data",closeIconTooltip:"string",tooltip:"data",allowDraggable:"boolean",enableModal:"boolean",enableResize:"boolean",isResponsive:"boolean",showHeader:"boolean",showFooter:"boolean",title:"string",faviconCSS:"string",zIndex:"number",cssClass:"string",enablePersistence:"boolean",contentUrl:"string",contentType:"string",enableRTL:"boolean",enabled:"boolean",allowKeyboardNavigation:"boolean",showRoundedCorner:"boolean",locale:"string",htmlAttributes:"data",ajaxSettings:"data",actionButtons:"array",footerTemplateId:"string"},_setModel:function(i){var r,u;for(r in i)switch(r){case"closeIconTooltip":this._dialogClose.attr("title",i[r]);break;case"tooltip":this._tooltipText(i[r]);break;case"title":this.model.title=i[r];this._ejDialog.find("span.e-title").length<=0?this._addTitleText():this._ejDialog.find("span.e-title").html(i[r]);this._updateCaptionWidth();break;case"width":this.model.width=i[r];this._changeSize();this._updateCaptionWidth();i[r]=this.model.width;break;case"height":this.model.height=i[r];this._changeSize();i[r]=this.model.height;break;case"position":this.model.position=i[r];this._dialogPosition();break;case"cssClass":this._changeSkin(i[r]);break;case"showRoundedCorner":this.model.showRoundedCorner=i[r];this._roundedCorner(i[r]);break;case"contentType":this.model.contentType=i[r];this._appendContent(i[r]);break;case"enabled":this.model.enabled=i[r];this._enabledAction(i[r]);break;case"contentUrl":this.model.contentUrl=i[r];this._appendContent(this.model.contentType);break;case"backgroundScroll":this.model.backgroundScroll=i[r];!this.model.backgroundScroll&&this.model.enableModal?n("body").addClass("e-dialog-modal"):n("body").removeClass("e-dialog-modal");break;case"content":case"target":this._ejDialog.appendTo(n(i[r]));this.model.target=this.model.content=i[r];this._dialogPosition();break;case"containment":this._setDragArea(i[r]);t.isNullOrUndefined(this._target)?this._ejDialog.appendTo(document.body):this._ejDialog.appendTo(this._target);this.model.position.X=this.model.position.Y="";this._dialogPosition();this.model.containment=i[r]=this._target;this.model.enableModal&&this._createOverlay();this._dialogTitlebar.ejDraggable({dragArea:this._target});break;case"locale":this.model.locale=i[r];this.localizedLabels=this._getLocalizedLabels();this._setLocaleCulture(this.localizedLabels,!0);this._tooltipText(this.model.tooltip);this._ejDialog.find("span.e-title").length<=0?this._addTitleText():this._ejDialog.find("span.e-title").html(this.model.title);this._updateCaptionWidth();break;case"minHeight":this.model.minHeight=i[r];this._ejDialog.css("minHeight",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"minWidth":this.model.minWidth=i[r];this._ejDialog.css("minWidth",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"maxHeight":this.model.maxHeight=i[r];this._ejDialog.css("maxHeight",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"maxWidth":this.model.maxWidth=i[r];this._ejDialog.css("maxWidth",i[r]);this._minMaxValidation();this._resetScroller();this._resizeDialog();break;case"zIndex":this._ejDialog.css("z-index",i[r]);break;case"faviconCSS":this.model.faviconCSS=i[r];this._favIcon();this._updateCaptionWidth();break;case"isResponsive":this.model.isResponsive=i[r];this.model.isResponsive?this._ejDialog.addClass("e-dialog-resize"):this._ejDialog.removeClass("e-dialog-resize");this._wireResizing();break;case"allowDraggable":this.model.allowDraggable=i[r];i[r]?this._enableDrag():this._dialogTitlebar.removeClass("e-draggable");break;case"enableResize":this.model.enableResize=i[r];i[r]?this._enableResize():(this._ejDialog.removeClass("e-resizable"),this._ejDialog.find(".e-resize-handle").remove());this._reRenderScroller();break;case"showHeader":this.model.showHeader=i[r];i[r]?(this._renderTitleBar(),this._iconsRender(this.model.actionButtons),this.model.faviconCSS&&(this._dialogFavIcon=!1,this._favIcon()),this._enableDrag(),this._maximize||this._updateScroller(t.isNullOrUndefined(this.contentDiv)?this._ejDialog.outerHeight(!0)-1-this._dialogTitlebar.outerHeight(!0):this.contentDiv.css("border-width")=="0px",t.isNullOrUndefined(this.contentDiv)?this._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px")):(this._ejDialog.find(".e-titlebar").remove(),this._maximize?this.refresh():this._updateScroller(t.isNullOrUndefined(this.contentDiv)?this._ejDialog.outerHeight(!0)-1:this.contentDiv.css("border-width")=="0px",t.isNullOrUndefined(this.contentDiv)?this._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px"));this._roundedCorner(this.model.showRoundedCorner);this.model.showFooter&&this._setContainerSize()._resetScroller();break;case"showFooter":this.model.showFooter=i[r];i[r]?(this._appendContent(),this._ejDialog.find(".e-resizable").remove()):this._ejDialog.find(".e-footerbar").remove();this._enableResize()._enableDrag()._sizeInPercent();this._reRenderScroller();this._setContainerSize()._resetScroller();this._roundedCorner(this.model.showRoundedCorner);break;case"footerTemplateId":this.model.footerTemplateId=i[r];this.model.showFooter&&(n(".e-footerbar").empty(),u=n("body").find("#"+this.model.footerTemplateId).html(),this._dialogFooterbar.append(u),this._enableResize());break;case"enableRTL":this.model.enableRTL=i[r];this.model.faviconCSS&&this._favIcon();i[r]?(this._ejDialog.addClass("e-rtl"),this.iframe&&this.iframe.contents().find("body").css("direction","rtl"),this.scroller&&this._resetScroller()):(this._ejDialog.removeClass("e-rtl"),this.iframe&&this.iframe.contents().find("body").css("direction","ltr"),this.scroller&&this._resetScroller());break;case"actionButtons":t.isNullOrUndefined(this._dialogTitlebar)||(this._removeAllIcons(),this._iconsRender(i[r]));this.model.actionButtons=i[r];this._updateCaptionWidth();break;case"enableModal":this._enableModal(i[r]);break;case"htmlAttributes":this._addAttr(i[r])}},_destroy:function(){this._overLay&&this._overLay.remove();this._cloneElement.appendTo(this._ejDialog.parent());this._ejDialog.remove();this._cloneElement.removeClass("e-dialog");this.element=this._cloneElement;this._isOpen=!1},keyConfigs:[37,38,39,40],_init:function(){this._init=!0;this._widthPercent=null;this._heightPercent=null;this._windowSize={outerWidth:n(window).outerWidth(),outerHeight:n(window).outerHeight()};this._initSize={width:this.model.width,height:this.model.height};this._sizeType={width:isNaN(this.model.width)?this.model.width.match(/px|%|auto/g)[0]:null,height:isNaN(this.model.height)?this.model.height.match(/px|%|auto/g)[0]:null};this._isOpen=this._maximize=this._minimize=!1;this.localizedLabels=this._getLocalizedLabels();this._setLocaleCulture(this.localizedLabels);this._setDimension();this.model.close||(this.model.close=this.model.Close);this.model.target||(this.model.target=this.model.content);this._responsive();this._renderControl();this._wireEvents();scrObj=this._ejDialog.closest(".e-dialog.e-js").data("ejDialog");scrObj&&scrObj._resetScroller();this.hidden=!1;this._init=!1;this._keyNavigation=!1},_responsive:function(){this.width=this.model.width;n(this.element).width(this.width);this.height=this.model.height;n(this.element).height(this.height);n(window).on("resize",n.proxy(this._resizeHandler,this))},_resizeHandler:function(){this._maximize&&(this.width=n(this._dialogTitlebar).outerWidth(),n(this.contentDiv).width(this.width),n(this.contentDiv).children().width(this.width),this.model.height=this.height=n(window).height(),this._ejDialog.css({height:this.height}),this.contentDiv.height(this._ejDialog.height()-n(this._dialogTitlebar).outerHeight()-n(this._dialogFooterbar).outerHeight()),this.element.height(this.contentDiv.height()));t.isNullOrUndefined(this.element)||this._resetScroller()},_setLocaleCulture:function(n,t){this.defaults.closeIconTooltip===this.model.closeIconTooltip&&(this.model.closeIconTooltip=n.closeIconTooltip);t&&(this.model.tooltip=this.localizedLabels.tooltip,this.model.title=this.localizedLabels.title);JSON.stringify(this.model.tooltip)===JSON.stringify(this.defaults.tooltip)&&(this.model.tooltip=n.tooltip);this.model.title===this.defaults.title&&(this.model.title=n.title)},_setDragArea:function(i){t.isNullOrUndefined(i)?this._target=null:typeof i=="string"?(i=="parent"&&(this._target=n(this.element).parent()),i.toLowerCase()=="document"&&(this._target=n(document)),i.toLowerCase()=="window"?this._target=n(window):n(i).length>0&&(this._target=n(i))):typeof i=="object"?i.length>0&&(this._target=i):this._target=null},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i._ejDialog.addClass(n):t=="disabled"&&n=="disabled"?(i.model.enabled=!1,i._enabledAction(!1)):i._ejDialog.attr(t,n)})},_tooltipText:function(i){n.extend(this.model.tooltip,i);!t.isNullOrUndefined(this._dialogClose)&&this._dialogClose.hasClass("e-close")&&this._dialogClose.attr("title",this.model.tooltip.close);!t.isNullOrUndefined(this._dialogCollapsible)&&(i.collapse||i.expand)&&(this._dialogCollapsible.hasClass("e-arrowhead-up")&&this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._dialogCollapsible.hasClass("e-arrowhead-down")&&this._dialogCollapsible.attr("title",this.model.tooltip.expand));!t.isNullOrUndefined(this._dialogMaximize)&&(i.maximize||i.restore)&&(this._dialogMaximize.hasClass("e-maximize")&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this._dialogMaximize.hasClass("e-restore")&&this._dialogMaximize.attr("title",this.model.tooltip.restore));!t.isNullOrUndefined(this._dialogMinimize)&&(i.minimize||i.restore)&&(this._dialogMinimize.hasClass("e-minus")&&this._dialogMinimize.attr("title",this.model.tooltip.minimize),this._dialogMinimize.hasClass("e-restore")&&this._dialogMinimize.attr("title",this.model.tooltip.restore));!t.isNullOrUndefined(this._dialogPin)&&(i.pin||i.unPin)&&(this._dialogPin.hasClass("e-unpin")&&this._dialogPin.attr("title",this.model.tooltip.pin),this._dialogPin.hasClass("e-pin")&&this._dialogPin.attr("title",this.model.tooltip.unPin))},_renderControl:function(){var i,r,u;this._cloneElement=this.element.clone();this.element.attr("tabindex",0).attr({role:"dialog","aria-labelledby":this.element.prop("id")+"_title"});this._ejDialog=t.buildTag("div.e-dialog e-widget e-box "+this.model.cssClass+" e-dialog-wrap e-shadow#"+(this.element.prop("id")==""?"":this.element.prop("id")+"_wrapper"),"",{display:"none",zIndex:this.model.zIndex},{tabindex:0});this.model.isResponsive&&this._ejDialog.addClass("e-dialog-resize");this.wrapper=this._ejDialog;this._addAttr(this.model.htmlAttributes);this._setDragArea(this.model.containment);t.isNullOrUndefined(this.model.containment)||t.isNullOrUndefined(this._target)?t.isNullOrUndefined(this.model.target)||(i=this.model.target):i=this._target;r=t.isNullOrUndefined(i)?document.body:i;u=n(r).find("#"+this._id+"_wrapper").get(0);u&&n(u).remove();this._ejDialog.appendTo(r);this.model.enableRTL&&this._ejDialog.addClass("e-rtl");this.model.showHeader&&(this._renderTitleBar(),this._iconsRender(this.model.actionButtons),this.model.faviconCSS&&this._favIcon());this._appendContent(this.model.contentType);this._enableResize()._enableDrag()._setSize();this.model.height!="auto"&&this._sizeInPercent();this.model.contentType!="ajax"&&(this.model.showOnInit&&this.open()?this._setContainerSize()._resetScroller():this._setHiddenDialogSize());this._roundedCorner(this.model.showRoundedCorner);this._enabledAction(this.model.enabled);this._sizeType.width=="auto"&&(this._maxWidth=this.model.width);this._sizeType.height=="auto"&&(this._maxHeight=this.model.height)},_setContainerSize:function(){if(this.model.height!="auto"){var t=this._ejDialog.outerHeight()-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0)+(this.model.showFooter?n(this._ejDialog.find("div.e-footerbar")).outerHeight(!0):0)-1;this.contentDiv.height(t);this.element.outerHeight(t)}return this},_changeSize:function(){this._initSize={width:this.model.width,height:this.model.height};this._sizeType.width=isNaN(this.model.width)?this.model.width.match(/px|%|auto/g):null;this._sizeType.height=isNaN(this.model.height)?this.model.height.match(/px|%|auto/g):null;this._setSize()._sizeInPercent()._setContainerSize()._resetScroller()},_enableDrag:function(){return this.model.allowDraggable&&this.model.showHeader&&(this._dialogTitlebar.addClass("e-draggable"),this._dragDialog()),this},_enableResize:function(){if(this.model.enableResize){this._ejDialog.addClass("e-resizable");var n=t.buildTag("div.e-icon e-resize-handle");this.model.showFooter?n.appendTo(this._dialogFooterbar):n.appendTo(this._ejDialog);this._resizeDialog()}return this},_changeSkin:function(n){this.model.cssClass!=n&&this._ejDialog.removeClass(this.model.cssClass).addClass(n)},_enableModal:function(n){n?this._isOpen&&this._createOverlay():this._overLay&&this._overLay.remove()},_enabledAction:function(n){n?(this._ejDialog.removeClass("e-disable"),this.wrapper.children(".e-disable-overlay").remove(),t.isNullOrUndefined(this.scroller)||this.scroller.enable()):(this._ejDialog.addClass("e-disable"),t.buildTag("div.e-disable-overlay").appendTo(this.wrapper),t.isNullOrUndefined(this.scroller)||this.scroller.disable())},_renderTitleBar:function(){this._elementTitle=this.element.attr("title");typeof this._elementTitle!="string"&&(this._elementTitle="");this.model.title=this.model.title||this._elementTitle;this._dialogTitlebar=t.buildTag("div#"+this.element.prop("id")+"_title.e-titlebar e-header e-dialog").prependTo(this._ejDialog);this._addTitleText()},_renderFooterBar:function(){this._dialogFooterbar=t.buildTag("div#"+this.element.prop("id")+"_foot.e-footerbar e-dialog e-js").appendTo(this._ejDialog)},_addTitleText:function(){return this.model.title&&(this._titleText=t.buildTag("span.e-title",this.model.title).prependTo(this._dialogTitlebar)),this},_updateCaptionWidth:function(){var n=this.model.faviconCSS&&!t.isNullOrUndefined(this._dialogFavIcon)?this._dialogFavIcon.outerWidth():0;return this._titleText&&this._titleText.css("max-width",this._dialogTitlebar.width()-20-this._dialogTitlebar.find(".e-dialog-icon").width()*this._dialogTitlebar.find(".e-dialog-icon").length-n),this},_iconsRender:function(i){for(var r=0;r<i.length;r++)switch(t.browserInfo().name=="msie"&&t.browserInfo().version<=8?n.trim(i[r]):i[r].trim()){case"close":this._closeIcon();break;case"collapse":case"collapsible":this._collapsibleIcon();break;case"maximize":this._maximizeIcon();break;case"minimize":this._minimizeIcon();break;case"pin":this._pinIcon();break;default:this._customIconsRender(i[r])}},_customIconsRender:function(n){this._customIcon=t.util.buildTag("div#"+this.element[0].id+"_"+n+"button.e-dialog-icon e-icon e-"+n,null,null).attr("tabIndex","0").attr("title",n);this._customIcon.appendTo(this._dialogTitlebar);this._on(this._customIcon,"touchstart click",this._iconClick)},_iconClick:function(){if(!this.element.hasClass("e-disable")){var t={cancel:!1,buttonID:n(event.target).attr("id"),event:event.type,model:this.model,currentTarget:event.currentTarget.title};this._trigger("actionButtonClick",t)}},_removeAllIcons:function(){this._dialogTitlebar.find("div.e-dialog-icon").remove()},_appendContent:function(i){var f,e,u,r,o;if(this.contentDiv=t.isNullOrUndefined(this.contentDiv)?t.buildTag("div.e-dialog-scroller"):this.contentDiv,this.element.removeAttr("title").addClass("e-widget-content e-box"),f=this,t.isNullOrUndefined(this.model.contentUrl)||t.isNullOrUndefined(i))this.dialogIframeContent=this.element.children().find("iframe").contents()[0],t.isNullOrUndefined(this.dialogIframeContent)?this.element.show().appendTo(this.contentDiv):this.element.show().appendTo(this.contentDiv).find("iframe").append(this.dialogIframeContent.lastChild);else if(i=="ajax")this.model.ajaxSettings.url=this.model.contentUrl,this._sendAjaxOptions(this.element,this.model.ajaxSettings.url);else if(i=="iframe")this.element.children(".e-iframe").length>0?(this.iframe=this.element.find("iframe.e-iframe"),this.iframe.attr("src",this.model.contentUrl)):(this.iframe=t.buildTag("iframe.e-iframe","",{width:"100%",height:"100%"},{scrolling:"auto",frameborder:0,src:this.model.contentUrl}),this.element.appendTo(this.contentDiv).append(this.iframe).show()),this.model.enableRTL&&n(this.iframe).load(function(){f.iframe.contents().find("body").css("direction","rtl")}),this._trigger("contentLoad",{contentType:i,url:this.model.contentUrl});else if(i=="image"){e=t.buildTag("img.e-images","","",{src:this.model.contentUrl});this.element.append(e).show().appendTo(this.contentDiv);n(e).on("load",function(){f._dialogPosition()});this._trigger("contentLoad",{contentType:i,url:this.model.contentUrl})}else this.element.show().appendTo(this.contentDiv);this._ejDialog.find("div.e-resize-handle").length>0?this._ejDialog.find(".e-footerbar").length==0&&this.contentDiv.insertBefore(this._ejDialog.find("div.e-resize-handle")):(u=this.element.children().find("iframe").contents()[0],t.isNullOrUndefined(u)?this._ejDialog.find(".e-footerbar").length==0?this.contentDiv.appendTo(this._ejDialog):this.contentDiv.insertBefore(this._dialogFooterbar):(this.contentDiv.appendTo(this._ejDialog),r=n("#"+this.contentDiv.find("iframe").attr("id")),n(r[0].contentDocument.lastChild).remove(),r[0].contentDocument.appendChild(u),t.browserInfo().name=="mozilla"&&setTimeout(function(){n(r[0].contentDocument.lastChild).remove();r[0].contentDocument.appendChild(u)},500)));this.model.showFooter&&this._ejDialog.find(".e-footerbar").length==0&&(this._renderFooterBar(),this.model.footerTemplateId!=null&&(o=n("body").find("#"+this.model.footerTemplateId).html(),this._dialogFooterbar.append(o)))},_roundedCorner:function(n){this._ejDialog[n?"addClass":"removeClass"]("e-corner");this.contentDiv.removeClass("e-dialog-top e-dialog-bottom e-dialog-content");this.model.showRoundedCorner&&(this.model.showHeader&&!this.model.showFooter?this.contentDiv.addClass("e-dialog-bottom"):!this.model.showHeader&&this.model.showFooter?this.contentDiv.addClass("e-dialog-top"):!this.model.showHeader&&!this.model.showFooter?this.contentDiv.addClass("e-dialog-content"):!0)},_reRenderScroller:function(){if(this.scroller!=i&&(this.scroller.refresh(!0),!this.model.enableRTL)){if(this.scroller._vScrollbar&&this.scroller._vScrollbar._scrollData&&this.model.enableResize){if(this.model.showFooter)var r=this.scroller._vScrollbar.element.find("> div.e-vscroll").height(),t=0,n=0;else var r=this.scroller._vScrollbar.element.find("> div.e-vscroll").height(),t=2,n=this._ejDialog.find("div.e-resize-handle").outerHeight();Math.floor(this.contentDiv.outerHeight())===Math.floor(this.scroller._vScrollbar.model.height+1)&&(this.scroller._vScrollbar.model.height-=n+t,this.scroller._vScrollbar._scrollData.handle-=n,this.scroller._vScrollbar._scrollData.handleSpace-=n+t,this.scroller._vScrollbar._updateLayout(this.scroller._vScrollbar._scrollData),this.scroller._vScrollbar.element.find("> div.e-vscroll").height(r-n-t))}if(!(this.scroller._vScrollbar&&this.scroller._vScrollbar._scrollData)&&this.scroller._hScrollbar&&this.scroller._hScrollbar._scrollData&&this.model.enableResize){if(this.model.showFooter)var u=this.scroller._hScrollbar.element.find("> div.e-hscroll").width(),t=0,n=0;else var u=this.scroller._hScrollbar.element.find("> div.e-hscroll").width(),t=2,n=this._ejDialog.find("div.e-resize-handle").outerWidth();this.scroller._hScrollbar.model.width-=n+t;this.scroller._hScrollbar._scrollData.handle-=n+t;this.scroller._hScrollbar._scrollData.handleSpace-=n+t;this.scroller._hScrollbar._updateLayout(this.scroller._hScrollbar._scrollData);this.scroller._hScrollbar.element.find("> div.e-hscroll").width(u-n-t)}}},_dialogMaxZindex:function(){var u=this.element.parents(),i,r,t;return i=n("body").children(),index=i.index(this.popup),i.splice(index,1),n(i).each(function(n,t){u.push(t)}),r=n(this.model.target).children(),cindex=r.index(this.popup),r.splice(cindex,1),n(r).each(function(n,t){u.push(t)}),t=Math.max.apply(t,n.map(u,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_setZindex:function(){var n=this._dialogMaxZindex();this.model.zIndex<=n&&this._ejDialog.css({zIndex:n+1})},_createOverlay:function(){var u=this._ejDialog.css("zIndex"),i,r;t.isNullOrUndefined(this._overLay)||this._overLay.remove();this.model.backgroundScroll||n("body").addClass("e-dialog-modal");this._overLay=t.buildTag("div#"+this.element.attr("id")+"_overLay.e-overlay","",{zIndex:u-1});t.isNullOrUndefined(this.model.containment)||t.isNullOrUndefined(this._target)?t.isNullOrUndefined(this.model.target)||(i=this.model.target):i=this._target;this._overLay.appendTo(t.isNullOrUndefined(i)?document.body:i);var r=!t.isNullOrUndefined(this.model.containment)&&!t.isNullOrUndefined(this._target)?"absolute":"fixed",f=t.isNullOrUndefined(i)||r=="fixed"?0:n(i).css("position").toLowerCase()!="static"?0:n(i).offset().left,e=t.isNullOrUndefined(i)||r=="fixed"?0:n(i).css("position").toLowerCase()!="static"?0:n(i).offset().top;this._overLay.css({top:e,left:f,position:r})},_sendAjaxOptions:function(t,i){t.addClass("e-load");var r=this,u=this.model.title,e=i,f={success:function(n){try{r._ajaxSuccessHandler(n,t,i,u)}catch(f){}},error:function(n){try{r._ajaxErrorHandler({status:n.status,responseText:n.responseText,statusText:n.statusText},t,i,u)}catch(n){}},complete:function(){try{r._setContainerSize();r._resetScroller();r.model.showOnInit||r._setHiddenDialogSize()}catch(n){}}};n.extend(!0,f,this.model.ajaxSettings);this._sendAjaxRequest(f)},_setHiddenDialogSize:function(){this._isOpen||(this._ejDialog.css({display:"block",visibility:"hidden"}),this._setContainerSize()._resetScroller(),this._ejDialog.css({display:"none",visibility:""}))},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_ajaxSuccessHandler:function(n,t,i){t.removeClass("e-load");t.html(n).addClass("e-dialog-loaded").appendTo(this._ejDialog);t.appendTo(this.contentDiv);this._dialogPosition();this.model.showOnInit&&this.open();this._trigger("ajaxSuccess",{data:n,url:i})},_ajaxErrorHandler:function(n,t,i){t.addClass("e-dialog-loaded").appendTo(this.contentDiv);this._dialogPosition().open();this._trigger("ajaxError",{data:n,url:i})},_closeIcon:function(){this._dialogClose=t.util.buildTag("div#"+this.element[0].id+"_closebutton.e-dialog-icon e-icon e-close",null,null).attr("tabIndex","0");this.model.closeIconTooltip=="close"&&this.model.tooltip.close=="Close"?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close):this.model.closeIconTooltip!="close"&&this.model.tooltip.close=="Close"?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.closeIconTooltip):this.model.closeIconTooltip=="close"&&this.model.tooltip.close!="Close"?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close):this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close);this._on(this._dialogClose,"touchstart click",this._closeClick)},_collapsibleIcon:function(){this._dialogCollapsible=t.util.buildTag("div#"+this.element[0].id+"_collapsbutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._collapsible?this._dialogCollapsible.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.expand).addClass("e-arrowhead-down").removeClass("e-arrowhead-up"):this._dialogCollapsible.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.collapse).addClass("e-arrowhead-up").removeClass("e-arrowhead-down");this._on(this._dialogCollapsible,"touchstart click",this._collapsibleClick)},_maximizeIcon:function(){this._dialogMaximize=t.util.buildTag("div#"+this.element[0].id+"_maximizebutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._maximize?this._dialogMaximize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.restore).addClass("e-restore").removeClass("e-maximize"):this._dialogMaximize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.maximize).addClass("e-maximize").removeClass("e-restore");this._on(this._dialogMaximize,"touchstart click",this._maximizeClick)},_minimizeIcon:function(){this._dialogMinimize=t.util.buildTag("div#"+this.element[0].id+"_minimizebutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._minimize?this._dialogMinimize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.restore).addClass("e-restore").removeClass("e-minus"):this._dialogMinimize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.minimize).addClass("e-minus").removeClass("e-restore");this._on(this._dialogMinimize,"touchstart click",this._minimizeClick)},_pinIcon:function(){this._dialogPin=t.util.buildTag("div#"+this.element[0].id+"_pinbutton.e-dialog-icon e-icon",null,null).attr("tabIndex","0");this._dialogPin.appendTo(this._dialogTitlebar).attr("title",this.dialogPin?this.model.tooltip.unPin:this.model.tooltip.pin).addClass(this.dialogPin?"e-pin":"e-unpin").removeClass(this.dialogPin?"e-unpin":"e-pin");this._on(this._dialogPin,"touchstart click",this._pinClick)},_favIcon:function(){if(this._dialogFavIcon)n=this._dialogFavIcon.find("span").removeClass().addClass("e-dialog-custom");else{this._dialogFavIcon=t.util.buildTag("div.e-dialog-favicon","",{},{style:"float:"+(this.model.enableRTL?"right":"left")});var n=t.util.buildTag("span.e-dialog-custom","",{},{role:"presentation"});n.appendTo(this._dialogFavIcon);this._dialogFavIcon.appendTo(this._dialogTitlebar)}this.model.faviconCSS?n.addClass(this.model.faviconCSS):this._dialogFavIcon.remove();this._dialogFavIcon.css("float",this.model.enableRTL?"right":"left")},_minMaxValidation:function(){var r=parseInt(this.model.minWidth),u=parseInt(this.model.minHeight),n=parseInt(this.model.maxWidth),t=parseInt(this.model.maxHeight),f=parseInt(this.model.width),e=parseInt(this.model.height),i=this._getParentObj();isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(r=this._convertPercentageToPixel(i.outerWidth(),r));isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(u=this._convertPercentageToPixel(i.outerHeight(),u));isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(n=this._convertPercentageToPixel(i.innerWidth(),n));isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(t=this._convertPercentageToPixel(i.innerHeight(),t));isNaN(this.model.width)&&this.model.width.indexOf("%")>0&&(f=this._convertPercentageToPixel(i.innerWidth(),f));isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&(e=this._convertPercentageToPixel(i.innerHeight(),e));(n&&f>n||r&&f<r)&&(this.model.width=f>n?n:r);(t&&e>t||u&&e<u)&&(this.model.height=e>t?t:u)},_setSize:function(){var n=this.model;return this._minMaxValidation(),this._ejDialog.css({width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth}),this._ejDialog.css({height:n.height,minHeight:n.minHeight,maxHeight:n.maxHeight}),this._dialogPosition(),this},_resetScroller:function(){this.element.css({height:"auto","max-width":"","max-height":"",width:""});var r=this._ejDialog.outerHeight(!0)-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0)-(this.model.showFooter?n(this._ejDialog.find("div.e-footerbar")).outerHeight(!0):0),u,i={width:this.contentDiv.css("border-width")=="0px"||this.contentDiv.css("border-left-width")=="0px"?this._ejDialog.width():Math.round(this._ejDialog.width()-2),enableRTL:this.model.enableRTL,height:this.contentDiv.css("border-width")=="0px"?r:r-1,enableTouchScroll:!1};this.model.height=="auto"&&(this.element.height()<this.model.maxHeight||!this.model.maxHeight)&&!this._maximize&&(i.height="auto");this.model.width!="auto"||this._maximize||(i.width=this.model.width);this.contentDiv.ejScroller(i);this.scroller=this.contentDiv.data("ejScroller");this._reRenderScroller();this._padding=parseInt(n(this.element).css("padding-top"))+parseInt(n(this.element).css("padding-bottom"));n(this._ejDialog).css("display")=="none"&&(this.hidden=!0,this._ejDialog.css({display:"block"}));!t.isNullOrUndefined(this.contentDiv.height())&&this.contentDiv.height()>0&&(u=t.isNullOrUndefined(this.scroller)?this.contentDiv.outerHeight()-this._padding:!this.scroller._hScrollbar&&this.scroller._vScrollbar?this.contentDiv.outerHeight():this.scroller._hScrollbar?this.contentDiv.outerHeight()-this.scroller.model.buttonSize:this.contentDiv.outerHeight(),this.model.height!="auto"&&this.model.height!="100%"?this.element.css({height:u}):this.element.css("height",this.model.height),this.model.height!="auto"&&this.model.height!="100%"||this.scroller._vScrollbar||this.element.css({"min-height":this.model.minHeight-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0)}),this.scroller._vScrollbar||this.model.width=="auto"||this.model.width=="100%"?this.scroller._vScrollbar||this.element.css("width",this.model.width):this.element.outerWidth(this.contentDiv.css("border-width")=="0px"||this.contentDiv.css("border-left-width")=="0px"?this._ejDialog.width():this._ejDialog.width()-2),this.element.css({"max-width":this.model.maxWidth,"max-height":this.model.maxHeight}));this.hidden&&this._ejDialog.css({display:"none"});this.hidden=!1},_updateScroller:function(n,t){this.contentDiv.ejScroller({width:t,height:n,enableRTL:this.model.enableRTL,enableTouchScroll:!1});this.scroller=this.contentDiv.data("ejScroller");this._reRenderScroller();this._changeSize()},_dragDialog:function(){var i=this,r=this._ejDialog.parents(".e-dialog-scroller");return this._dialogTitlebar.ejDraggable({handle:".e-titlebar",cursorAt:{top:0,left:0},dragArea:i._target,dragStart:function(n){return(n.element.attr("aria-grabbed",!0),i._clickHandler(),i.dialogPin||!i.model.allowDraggable||!i.model.enabled)?(n.cancel=!0,!1):i._trigger("dragStart",{event:n})?(n.cancel=!0,!1):void 0},drag:function(n){i._trigger("drag",{event:n})},dragStop:function(r){i._ejDialog.focus();r.element.attr("aria-grabbed",!1);i.element.find("> .e-draggable.e-titlebar")&&(dragobject=n("#"+i.element.find("> .e-draggable.e-titlebar").attr("id")).data("ejDraggable"),dragobject&&dragobject.option("cursorAt",i.element.offset()));var u=this.helper.offsetParent().offset();i._trigger("dragStop",{event:r});i.model.position.X=t.isNullOrUndefined(this.position.left)?parseInt(this.helper.css("left")):this.position.left-[u.left+parseFloat(this.helper.offsetParent().css("border-left-width"))];i.model.position.Y=t.isNullOrUndefined(this.position.top)?parseInt(this.helper.css("top")):this.position.top-[u.top+parseFloat(this.helper.offsetParent().css("border-top-width"))];i._positionChanged=!0},helper:function(){return n(i._ejDialog).addClass("dragClone")}}),this},_resizeDialog:function(){if(this.model.enableResize){var t=this,r=!1,i,u=parseInt(this.model.minWidth),f=parseInt(this.model.minHeight),e=parseInt(this.model.maxWidth),o=parseInt(this.model.maxHeight);return i=this._getParentObj(),isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(u=this._convertPercentageToPixel(i.outerWidth(),u)),isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(f=this._convertPercentageToPixel(i.outerHeight(),f)),isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(e=this._convertPercentageToPixel(i.innerWidth(),e)),isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(o=this._convertPercentageToPixel(i.innerHeight(),o)),this._ejDialog.find("div.e-resize-handle").ejResizable({minHeight:f,minWidth:u,maxHeight:o,maxWidth:e,handle:"e-widget-content",resizeStart:function(n){if(t.dlgresized=!0,!t.model.enabled)return!1;r||t._trigger("resizeStart",{event:n});r=!0;t.model.position={X:t._ejDialog.css("left"),Y:t._ejDialog.css("top")};t._dialogPosition()},resize:function(i){t.dlgresized=!0;var r=n(i.element).parents("div.e-dialog-wrap");t.model.height=n(r).outerHeight();t.model.width=n(r).outerWidth();t._setSize();t._setContainerSize();t._resetScroller();t._updateCaptionWidth();t._trigger("resize",{event:i});t._sizeType={width:"px",height:"px"};scrObj=t._ejDialog.closest(".e-dialog.e-js").data("ejDialog");scrObj&&scrObj._resetScroller()},resizeStop:function(i){t.dlgresized=!0;t._ejDialog.focus();t._sizeInPercent();var u=n(i.element).parents("div.e-dialog-wrap");t.model.height=n(u).outerHeight();t.model.width=n(u).outerWidth();t._setSize();t._setContainerSize();t._resetScroller();r&&t._trigger("resizeStop",{event:i});r=!1;t._setDimension();t.dlgresized=!1},helper:function(){return n(t._ejDialog)}}),this}},_dialogPosition:function(){if(this._ejDialog.parents("form").length>0&&t.isNullOrUndefined(this.model.containment)&&t.isNullOrUndefined(this.model.target)&&this._ejDialog.appendTo(this._ejDialog.parents("form")),this.model.position.X!=""||this.model.position.Y!="")if(this._ejDialog.css("position","absolute"),t.isNullOrUndefined(this.model.target)&&t.isNullOrUndefined(this.model.containment))this._ejDialog.css("left",this.model.position.X),this._ejDialog.css("top",this.model.position.Y);else{var i=t.isNullOrUndefined(this.model.containment)?this.model.target:this.model.containment;this.dlgresized||this._keyNavigation?(this._ejDialog.css("left",this.model.position.X),this._ejDialog.css("top",this.model.position.Y)):(this._ejDialog.css("left",n(i).offset().left+parseInt(this.model.position.X)),this._ejDialog.css("top",n(i).offset().top+parseInt(this.model.position.Y)))}else this._centerPosition();return this},_centerPosition:function(){var r=0,u=0,i,f,e,o;t.isNullOrUndefined(this.model.target)&&(t.isNullOrUndefined(this._target)||n(this._target).is(n(document))||n(this._target).is(n(window)))?(o=document.documentElement,r=(n(window).outerWidth()>this._ejDialog.width()?(n(window).outerWidth()-this._ejDialog.outerWidth())/2:0)+(window.pageXOffset||o.scrollLeft),u=(n(window).outerHeight()>this._ejDialog.height()?(n(window).outerHeight()-this._ejDialog.outerHeight())/2:0)+(window.pageYOffset||o.scrollTop)):(i=t.isNullOrUndefined(this._target)?n(this.model.target):n(this._target),i.css("position")=="static"&&(f=i.offsetParent().offset(),e=i.offset(),r=e.left-f.left,u=e.top-f.top),i.outerWidth()>this._ejDialog.width()&&(r+=(i.outerWidth()-this._ejDialog.width())/2),i.outerHeight()>this._ejDialog.height()&&(u+=(i.outerHeight()-this._ejDialog.height())/2));this._ejDialog.css({top:u,left:r});this._ejDialog.css("position","absolute")},_closeClick:function(n){this.model.enabled&&(n.stopPropagation(),this.close(n))},_collapsibleClick:function(t){this.model.enabled&&(n(t.target).hasClass("e-arrowhead-up")?this._actionCollapse(t):n(t.target).hasClass("e-arrowhead-down")&&this._actionExpand(t))},_actionCollapse:function(n){this._minimize||(this._dialogCollapsible&&this._dialogCollapsible.removeClass("e-arrowhead-up").addClass("e-arrowhead-down"),this._dialogCollapsible&&this._dialogCollapsible.attr("title",this.model.tooltip.expand),this._ejDialog.find("div.e-resize-handle").hide(),this._ejDialog.find(".e-widget-content").parent().slideUp("fast"),this.model.showFooter&&this._dialogFooterbar.slideUp("fast"),this._ejDialog.removeClass("e-shadow"),this._ejDialog.css("minHeight","0"),this._ejDialog.height("auto"),this._trigger("collapse",{isInteraction:n?!0:!1}),this._collapsible=!0)},_actionExpand:function(n){this._minimize||(this._dialogCollapsible&&this._dialogCollapsible.removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogCollapsible&&this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._ejDialog.addClass("e-shadow"),this._ejDialog.find(".e-widget-content").parent().slideDown("fast"),this.model.showFooter&&this._dialogFooterbar.slideDown("fast"),this._maximize?(this._ejDialog.css({width:"100%",height:"100%"}),this.element.css({width:"100%",height:"100%"}),this.contentDiv.css({width:"100%",height:"100%"})):this._ejDialog.height(this.model.height),this._ejDialog.find("div.e-resize-handle").show(),this._trigger("expand",{isInteraction:n?!0:!1}),this._collapsible=!1)},_maximizeClick:function(i){if(this.model.enabled){var r=n(i.target),u=this._dialogMaximize;r.hasClass("e-maximize")?(this._actionMaximize(),this._dialogTitlebar&&(this._dialogTitlebar.find(".e-restore").removeClass("e-restore").addClass("e-minus"),this._dialogMinimize&&this._dialogMinimize.attr("title",this.model.tooltip.minimize)),r.removeClass("e-maximize").addClass("e-restore"),this._dialogMaximize.attr("title",this.model.tooltip.restore),this._hideIcon(!0)):r.hasClass("e-restore")&&(this._actionRestore(),r.removeClass("e-restore").addClass("e-maximize"),this._dialogMaximize.attr("title",this.model.tooltip.maximize),!t.isNullOrUndefined(u)&&n(u).hasClass("e-arrowhead-down")&&(n(u).removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogMaximize.attr("title",this.model.tooltip.collapse)),this._hideIcon(!0))}this._resetScroller()},_actionMaximize:function(){this._ejDialog.css("top","0px").css("left","0px").css("overflow","hidden").css("position",this.model.containment?"absolute":this.model.target?"absolute":"fixed");this._ejDialog.css({width:"100%",height:"100%"});this.element.css({width:"100%",height:"100%"});this.contentDiv.css({width:"100%",height:"100%"});this._maximize=!0;this._minimize=!1;var n=this;this._dialogCollapsible&&!t.isNullOrUndefined(this._dialogCollapsible.hasClass("e-arrowhead-down"))&&(this._dialogCollapsible.removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._collapseValue=!0);this._collapseValue==!0&&this._ejDialog.find(".e-widget-content").parent().slideDown("fast",function(){n.refresh();n._reRenderScroller()});this._resetScroller()},_actionRestore:function(){this.element.height("").width("");this.contentDiv.height("").width("");this._restoreDialog();this._maximize=this._minimize=!1},_minimizeClick:function(i){if(this.model.enabled){var r=n(i.target),u=this._dialogMinimize.hasClass("e-icon")&&this._dialogMinimize;r.hasClass("e-minus")?(this._maximize&&this._setSize(),this._actionMinimize()):r.hasClass("e-restore")&&(this._actionRestore(),r.removeClass("e-restore").addClass("e-minus"),this._dialogMinimize.attr("title",this.model.tooltip.minimize),!t.isNullOrUndefined(u)&&n(u).hasClass("e-arrowhead-down")&&(n(u).removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogMinimize.attr("title",this.model.tooltip.collapse)),this._hideIcon(!0))}},_actionMinimize:function(){var i=n(window).height()-this._ejDialog.height()+this.element.height()+14,t;this._ejDialog.css("top","").css("bottom","0").css("left","0").css("position",this.model.containment?"absolute":this.model.target?"absolute":"fixed");this._ejDialog.css("minHeight","0");this._dialogTitlebar?(this._dialogTitlebar.find(".e-restore").removeClass("e-restore").addClass("e-maximize"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this._dialogTitlebar.find(".e-minus").removeClass("e-minus").addClass("e-restore"),this._dialogMinimize&&this._dialogMinimize.attr("title",this.model.tooltip.restore),this._isOpen?t=this._dialogTitlebar.outerHeight():(this._ejDialog.css({display:"block",visibility:"hidden"}),t=this._dialogTitlebar.outerHeight(),this._ejDialog.css({display:"none",visibility:""})),this._ejDialog.css("height",t+2),this._hideIcon(!1)):this._ejDialog.css("height","");this.contentDiv.hide();this.model.showFooter&&this._dialogFooterbar.hide();this._maximize=!1;this._minimize=!0},_hideIcon:function(i){var r=this._dialogCollapsible?this._dialogCollapsible:null;i?(t.isNullOrUndefined(r)||n(r).parent(".e-dialog-icon").show(),this._ejDialog.find("div.e-resize-handle").show()):(t.isNullOrUndefined(r)||n(r).parent(".e-dialog-icon").hide(),this._ejDialog.find("div.e-resize-handle").hide())},_pinClick:function(t){if(this.model.enabled){var i=n(t.target);i.hasClass("e-unpin")?(this.dialogPin=!0,i.removeClass("e-unpin").addClass("e-pin"),this._dialogPin.attr("title",this.model.tooltip.unPin)):i.hasClass("e-pin")&&(this.dialogPin=!1,i.removeClass("e-pin").addClass("e-unpin"),this._dialogPin.attr("title",this.model.tooltip.pin))}},_restoreDialog:function(){this.contentDiv.show();this.model.showFooter&&this._dialogFooterbar.show();this._ejDialog.css({position:"absolute",bottom:""}).addClass("e-shadow");this._setSize()._resetScroller();this._dialogTitlebar&&(this._dialogTitlebar.find(".e-minus").parent().show(),this._dialogCollapsible&&(this._dialogCollapsible.removeClass("e-arrowhead-down").addClass("e-arrowhead-up"),this._dialogCollapsible.attr("title",this.model.tooltip.collapse)))},_clickHandler:function(){var n=this._dialogMaxZindex();parseInt(this._ejDialog.css("zIndex"))<n&&this._ejDialog.css({zIndex:n+1})},_mouseClick:function(t){t.currentTarget==this._id&&(n(t.target).hasClass("e-dialog")||n(t.target).hasClass("e-icon e-resize-handle"))&&(this._setZindex(),n(t.target).closest(".e-dialog.e-widget").focus())},_keyDown:function(t){code=t.keyCode?t.keyCode:t.which?t.which:t.charCode;this.model.allowKeyboardNavigation&&this.model.enabled&&n(t.target).hasClass("e-dialog")&&n.inArray(code,this.keyConfigs)>-1&&this.model.allowDraggable&&!this.dialogPin&&(this._keyPressed(code,t.ctrlKey),t.preventDefault());this.model.closeOnEscape&&code===27&&this.model.enabled&&(this.element.find(".e-js.e-dialog").first().is(":visible")||(this.close(t),t.preventDefault()));code===13&&this.model.enabled&&(n(t.target).hasClass("e-close")?this.close(t):(n(t.target).hasClass("e-arrowhead-up")||n(t.target).hasClass("e-arrowhead-down"))&&this._collapsibleClick(t),n(t.target).hasClass("e-maximize")||n(t.target).hasClass("e-restore")&&n(t.target).is(this._dialogMaximize)?this._maximizeClick(t):(n(t.target).hasClass("e-minus")||n(t.target).hasClass("e-restore")&&n(t.target).is(this._dialogMinimize))&&this._minimizeClick(t),(n(t.target).hasClass("e-pin")||n(t.target).hasClass("e-unpin"))&&this._pinClick(t));code==9&&this.model.enableModal&&this._focusOnTab(t)},_focusOnTab:function(t){var i=this._ejDialog.find("a, button, :input, select, [tabindex]:not('-1')");i=n(i).find("a, button, :input, select, [tabindex]:not('')");t.shiftKey?i[i.index(t.target)-1]||(t.preventDefault(),i.last().focus()):i[i.index(t.target)+1]||(t.preventDefault(),i[0].focus())},_keyPressed:function(n,t){this._keyNavigation=!0;switch(n){case 40:t?this._resizing("height",this._ejDialog.outerHeight()+3):this.option("position",{X:this._ejDialog.position().left,Y:this._ejDialog.position().top+3});break;case 39:t?this._resizing("width",this._ejDialog.outerWidth()+3):this.option("position",{X:this._ejDialog.position().left+3,Y:this._ejDialog.position().top});break;case 38:t?this._resizing("height",this._ejDialog.outerHeight()-3):this.option("position",{X:this._ejDialog.position().left==0?0:this._ejDialog.position().left,Y:this._ejDialog.position().top>3?this._ejDialog.position().top-3:0});break;case 37:t?this._resizing("width",this._ejDialog.outerWidth()-3):this.option("position",{X:this._ejDialog.position().left>3?this._ejDialog.position().left-3:0,Y:this._ejDialog.position().top==0?0:this._ejDialog.position().top})}},_resizing:function(n,t){this.model.enableResize&&this.option(n,t)},_sizeInPercent:function(){if(!this._enableWindowResize())return this;var n=this._getParentObj();return this._widthPercent=this._sizeType.width=="%"?parseFloat(this.model.width):this._convertPixelToPercentage(n.outerWidth(),this._ejDialog.outerWidth()),this._heightPercent=this._sizeType.height=="%"?parseFloat(this.model.height):this._convertPixelToPercentage(n.outerHeight(),this._ejDialog.outerHeight()),this._widthPercent>=100&&(this._widthPercent=100,this._ejDialog.outerWidth(n.outerWidth()),this.model.width=this._ejDialog.width()),this._heightPercent>=100&&(this._heightPercent=100,this._ejDialog.outerHeight(n.outerHeight()),this.model.height=this._ejDialog.height()),this},_getParentObj:function(){return t.isNullOrUndefined(this.model.containment)?t.isNullOrUndefined(this.model.target)?n(document):n(this.model.target):n(this.model.containment)},_convertPercentageToPixel:function(n,t){return Math.round(t*n/100)},_convertPixelToPercentage:function(n,t){return Math.round(t/n*100)},_reSizeHandler:function(){var t;if(this._maximize){this._resetScroller();return}this.model.position.X!=""&&(this.model.position.Y!=""||this._minimize)||this._centerPosition();t=this._getParentObj();this._change=!1;this._windowSize.outerWidth!=n(window).outerWidth()?this._sizeType.width=="%"?this._percentageWidthDimension(t):this._pixelsWidthDimension(t):this._windowSize.outerHeight!=n(window).outerHeight()&&(this._sizeType.height=="%"?this._percentageHeightDimension(t):this._pixelsHeightDimension(t));this._change&&this._resizeContainer(t);this._windowSize={outerWidth:n(window).outerWidth(),outerHeight:n(window).outerHeight()};this._centerPosition()},_setDimension:function(){t.isNullOrUndefined(this.model.maxWidth)?t.isNullOrUndefined(this._sizeType.width)?this._maxWidth=+this.model.width:(this._sizeType.width=="px"||this._sizeType.width=="auto")&&(this._maxWidth=this.model.width):this._maxWidth=this.model.maxWidth;t.isNullOrUndefined(this.model.maxHeight)?t.isNullOrUndefined(this._sizeType.height)?this._maxHeight=+this.model.height:(this._sizeType.height=="px"||this._sizeType.height=="auto")&&(this._maxHeight=this.model.height):this._maxHeight=this.model.maxHeight},_percentageWidthDimension:function(n){this._ejDialog.outerWidth(this._convertPercentageToPixel(n.outerWidth(),this._widthPercent));this._change=!0},_percentageHeightDimension:function(n){this._ejDialog.outerHeight(this._convertPercentageToPixel(n.outerHeight(),this._heightPercent));this._change=!0},_pixelsWidthDimension:function(t){n(t).outerWidth()<=this._ejDialog.outerWidth()&&this._setWidth(t);n(t).outerHeight()<=this._ejDialog.outerHeight()&&!this.model.isResponsive&&this._setHeight(t);parseInt(this._ejDialog.css("width"))<parseInt(this._maxWidth)&&(parseInt(this._maxWidth)<n(t).outerWidth()?this._ejDialog.outerWidth(parseInt(this._maxWidth)):this._ejDialog.outerWidth(t.outerWidth()),this._change=!0)},_pixelsHeightDimension:function(t){n(t).outerHeight()<=this._ejDialog.outerHeight()&&!this.model.isResponsive&&this._setHeight(t);n(t).outerWidth()<=this._ejDialog.outerWidth()&&this._setWidth(t);parseInt(this._ejDialog.css("height"))<parseInt(this._maxHeight)&&(parseInt(this._maxHeight)<n(t).outerHeight()?this._ejDialog.outerWidth(parseInt(this._maxHeight)):this._ejDialog.outerHeight(t.outerHeight()),this._change=!0)},_setWidth:function(n){this._ejDialog.outerWidth(n.outerWidth());this._change=!0},_setHeight:function(n){this._ejDialog.outerHeight(n.outerHeight());this._change=!0},_resizeContainer:function(){this.contentDiv.width(this._ejDialog.width());this.element.outerWidth(this.contentDiv.width());var i=this._ejDialog.height()-(this.model.showHeader?n(this._ejDialog.find("div.e-titlebar")).outerHeight(!0):0);this.contentDiv.height(t.isNullOrUndefined(this.contentDiv)?i-1:this.contentDiv.css("border-width")=="0px");this.element.outerHeight(t.isNullOrUndefined(this.contentDiv)?i-1:this.contentDiv.css("border-width")=="0px");this.scroller=this.contentDiv.ejScroller({width:t.isNullOrUndefined(this.contentDiv)?this._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px",height:t.isNullOrUndefined(this.contentDiv)?this.element.outerHeight()-2:this.contentDiv.css("border-width")=="0px",rtl:this.model.rtl,enableTouchScroll:!1});this.scroller=this.contentDiv.data("ejScroller");this._reRenderScroller();this.model.position.X==""||this.model.position.Y==""&&!this._minimize||this._positionChanged?this._centerPosition():this._ejDialog.css("height",this._dialogTitlebar.outerHeight());this._updateCaptionWidth();this._change=!1},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_enableWindowResize:function(){return this.model.isResponsive||isNaN(this.model.width)&&this.model.width.indexOf("%")>0&&isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&this.model.height!="auto"?!0:!1},_wireResizing:function(){n(window)[this._enableWindowResize()?"on":"off"]("resize",n.proxy(this._reSizeHandler,this))},_wireEvents:function(){this._on(this._ejDialog,"keydown",this._keyDown);this._on(this._ejDialog,"click",this._mouseClick);this._wireResizing()},refresh:function(){this._resetScroller()},open:function(){var i,r,u,f;return this._isOpen?!0:!0==this._trigger("beforeOpen")?!1:(this.element.css("display","block"),this._setZindex(),this._minimize||this._maximize||this._init||this._dialogPosition(),i=this,r={},this._ejDialog.show(),this.model.enableAnimation&&(this._ejDialog.css({opacity:0}),this.model.animation.show.effect=="slide"?(f=this._ejDialog.css("left"),this._ejDialog.css({left:-this._ejDialog.width()}),r={left:f,opacity:1}):r={opacity:1}),this._ejDialog.animate(r,this.model.enableAnimation?Number(this.model.animation.show.duration):0,function(){i.model&&(i._ejDialog.css("display")=="none"&&i._ejDialog.show(),i._ejDialog.eq(0).focus(),i._ejDialog.css({opacity:""}),i.contentDiv.find("a:visible:enabled, button:visible:enabled, :input:visible:enabled, select:visible:enabled, .e-input").first().focus(),i._trigger("open"),i._updateCaptionWidth(),i.model.enableModal&&!i.model.backgroundScroll&&(i._ejDialog.height()>n(window).height()&&i._ejDialog.css("height",n(window).height()),i.model.height=n(window).height(),i._overLay.css("position","fixed"),i.scroller.refresh(!0),i.refresh()),(i.model.maxHeight||i.model.maxWidth)&&(u=i._ejDialog.outerHeight(!0)-(i._dialogTitlebar?i._dialogTitlebar.outerHeight(!0):0),(i.model.height=="auto"||i.model.height=="100%")&&(u=i.model.height),i._updateScroller(t.isNullOrUndefined(this.contentDiv)?u-2:this.contentDiv.css("border-width")=="0px",t.isNullOrUndefined(this.contentDiv)?i._ejDialog.width()-2:this.contentDiv.css("border-width")=="0px")))}),this.model.enableModal==!0&&this._createOverlay(),this._isOpen=!0,this.element.find("> .e-draggable.e-titlebar")&&(dragobject=n("#"+this.element.find("> .e-draggable.e-titlebar").attr("id")).data("ejDraggable"),dragobject&&dragobject.option("cursorAt",this.element.offset())),this)},close:function(t){var i,r,u;return!this._isOpen||!this.model.enabled?!0:(i=t?!0:!1,!0==this._trigger("beforeClose",{event:t,isInteraction:i}))?!1:(this._isOpen=!1,r=this,u={},this.model.enableAnimation&&(u=this.model.animation.hide.effect=="slide"?{left:-this._ejDialog.width(),opacity:0}:{opacity:0}),this._ejDialog.animate(u,this.model.enableAnimation?Number(this.model.animation.hide.duration):0,function(){r._trigger("close",{event:t,isInteraction:i});r._ejDialog.hide()}),this.model.enableModal&&(this._overLay&&this._overLay.remove(),this.model.backgroundScroll||n("body").removeClass("e-dialog-modal")),this)},isOpened:function(){return this.isOpen()},isOpen:function(){return this._isOpen},setTitle:function(n){return this.model.title=n,this._titleText.text(n),this._updateCaptionWidth(),this},setContent:function(n){return this.model.enabled?(this.element.html(n),this._resetScroller(),this):!1},focus:function(){return this._setZindex(),this.element.focus(),this},minimize:function(){if(this.model.showHeader)return this._actionMinimize(),n(this.wrapper.find(".e-minus")[0]).parent().hide(),this},maximize:function(){if(this.model.showHeader)return this._actionMaximize(),n(this.wrapper.find(".e-maximize")[0]).removeClass("e-maximize").addClass("e-restore"),n(this.wrapper.find(".e-restore")[1]).removeClass("e-restore").addClass("e-minus"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.restore),this.contentDiv.show(),this._dialogTitlebar&&this._dialogTitlebar.find(".e-minus").parent().show(),this._hideIcon(!0),this},restore:function(){if(this.model.showHeader){var t=this._minimize;return this._actionRestore(),n(this.wrapper.find(".e-restore")[0]).removeClass("e-restore").addClass(t?"e-minus":"e-maximize"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this._hideIcon(!0),this}},pin:function(){if(this.model.showHeader)return this.dialogPin=!0,n(this.wrapper.find(".e-unpin")[0]).removeClass("e-unpin").addClass("e-pin"),this._dialogPin&&this._dialogPin.attr("title",this.model.tooltip.unPin),this},unpin:function(){if(this.model.showHeader)return this.dialogPin=!1,n(this.wrapper.find(".e-pin")[0]).removeClass("e-pin").addClass("e-unpin"),this._dialogPin&&this._dialogPin.attr("title",this.model.tooltip.pin),this},collapse:function(){if(this.model.showHeader)return this._actionCollapse(),this._collapseValue=!0,this},expand:function(){if(this.model.showHeader)return this._actionExpand(),this}});t.Dialog.Locale=t.Dialog.Locale||{};t.Dialog.Locale["default"]=t.Dialog.Locale["en-US"]={tooltip:{close:"Close",collapse:"Collapse",restore:"Restore",maximize:"Maximize",minimize:"Minimize",expand:"Expand",unPin:"UnPin",pin:"Pin"},title:"",closeIconTooltip:"close"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejDropDownList","ej.DropDownList",{element:null,model:null,validTags:["select","input"],_addToPersist:["value","text","selectedIndex","selectedItemIndex","selectedItems","selectedIndices","popupWidth","popupHeight","itemValue"],_setFirst:!1,_rootCSS:"e-dropdownlist",angular:{require:["?ngModel","^?form","^?ngModelOptions"]},_requiresID:!0,defaults:{cssClass:"",value:null,htmlAttributes:{},text:null,itemValue:"",itemsCount:0,dataSource:null,delimiterChar:",",query:null,fields:{id:null,text:null,value:null,category:null,groupBy:null,imageUrl:null,imageAttributes:null,spriteCssClass:null,htmlAttributes:null,selected:null,tableName:null},locale:"en-US",watermarkText:null,height:"",width:"",popupHeight:"152px",popupWidth:"auto",maxPopupHeight:null,minPopupHeight:"20",maxPopupWidth:null,minPopupWidth:"0",targetID:null,template:null,headerTemplate:null,selectedItemIndex:-1,selectedIndex:-1,disableItemsByIndex:null,enableItemsByIndex:null,selectedItems:[],selectedIndices:[],cascadeTo:null,enablePopupResize:!1,allowVirtualScrolling:!1,virtualScrollMode:"normal",showRoundedCorner:!1,showPopupOnLoad:!1,enableRTL:!1,enabled:!0,filterType:"contains",sortOrder:"ascending",caseSensitiveSearch:!1,showCheckbox:!1,checkAll:!1,uncheckAll:!1,enablePersistence:!1,enableFilterSearch:!1,enableIncrementalSearch:!0,readOnly:!1,enableAnimation:!1,multiSelectMode:"none",allowGrouping:!1,enableSorting:!1,validationRules:null,validationMessage:null,actionBegin:null,actionComplete:null,actionFailure:null,actionSuccess:null,create:null,popupHide:null,popupShown:null,beforePopupShown:null,beforePopupHide:null,popupResizeStart:null,popupResize:null,popupResizeStop:null,change:null,select:null,dataBound:null,search:null,checkChange:null,cascade:null,destroy:null},dataTypes:{cssClass:"string",itemsCount:"number",watermarkText:"string",template:"string",disableItemsByIndex:"string",enableItemsByIndex:"string",enableIncrementalSearch:"boolean",cascadeTo:"string",delimiterChar:"string",showRoundedCorner:"boolean",showPopupOnLoad:"boolean",enableRTL:"boolean",enablePersistence:"boolean",allowVirtualScrolling:"boolean",virtualScrollMode:"enum",enabled:"boolean",readOnly:"boolean",multiSelectMode:"enum",dataSource:"data",query:"data",fields:"data",selectedItems:"array",enableAnimation:"boolean",allowGrouping:"boolean",enableSorting:"boolean",validationRules:"data",validationMessage:"data",htmlAttributes:"data",locale:"string"},observables:["value","selectedItemIndex","selectedIndex"],value:t.util.valueFunction("value"),selectedItemIndex:t.util.valueFunction("selectedItemIndex"),selectedIndex:t.util.valueFunction("selectedIndex"),enable:function(){if(this._visibleInput.hasClass("e-disable")){this.target.disabled=!1;this.model.enabled=!0;this.container.removeClass("e-disable");this._visibleInput.removeClass("e-disable");this.dropdownbutton.removeClass("e-disable");this.popupListWrapper.removeClass("e-disable");this._isIE8&&this.drpbtnspan.removeClass("e-disable");this.container.on("mousedown",n.proxy(this._OnDropdownClick,this));this.model.multiSelectMode=="visualmode"&&this._ulBox.removeClass("e-disable");this.wrapper.attr("tabindex","0")}this._wireEvents()},disable:function(){this._visibleInput.hasClass("e-disable")||(this.target.disabled=!0,this.model.enabled=!1,this.container.addClass("e-disable"),this._visibleInput.addClass("e-disable"),this.popupListWrapper.addClass("e-disable"),this.dropdownbutton.addClass("e-disable"),this._isIE8&&this.drpbtnspan.addClass("e-disable"),this.model.multiSelectMode=="visualmode"&&this._ulBox.addClass("e-disable"),this.container.off("mousedown",n.proxy(this._OnDropdownClick,this)),this._unwireEvents(),this.wrapper.removeAttr("tabindex"),this._isPopupShown()&&this._hideResult())},getValue:function(){return this._visibleInput.val()},_setValue:function(n){t.isNullOrUndefined(n)||(this._raiseEvents=!1,t.isNullOrUndefined(this.model.text)||this.unselectItemByText(this.model.text),this._raiseEvents=!0,this.selectItemByValue(n))},_setText:function(n){n&&(this._raiseEvents=!1,this.unselectItemByText(this.model.text),this._raiseEvents=!0,this.selectItemByText(n))},_setItemValue:function(n){this.model.itemValue=n},_changeWatermark:function(n){if(!this.model.enabled)return!1;this._isWatermark?this._visibleInput.attr("placeholder",n):this._hiddenSpan.text(n)},hidePopup:function(){if(!this.model.enabled)return!1;this.ultag.find("li").length>0&&this._hideResult()},showPopup:function(){if(!this.model.enabled)return!1;this.ultag.find("li").length>0&&this._showResult()},clearText:function(){this._clearTextboxValue();this._isWatermark||this._setWatermark()},addItem:function(t){var r,i,u,e,f,o;if(!this.model.enabled||!t||(this._mapFields(),r=n.isArray(t)?t:[t],r.length<1))return!1;for(i=this.mapFld,u={_id:null,_imageUrl:null,_imageAttributes:null,_spriteCSS:null,_text:null,_value:null,_htmlAttributes:null,_selected:null,_category:null},u._id=r[0][i._id]?i._id:"id",u._imageUrl=r[0][i._imageUrl]?i._imageUrl:"imageUrl",u._imageAttributes=r[0][i._imageAttributes]?i._imageAttributes:"imageAttributes",u._spriteCSS=r[0][i._spriteCSS]?i._spriteCSS:"spriteCssClass",u._text=r[0][i._text]?i._text:"text",u._value=r[0][i._value]?i._value:"value",u._htmlAttributes=r[0][i._htmlAttributes]?i._htmlAttributes:"htmlAttributes",u._selected=r[0][i._selected]?i._selected:"selected",u._category=r[0][i._category]?i._category:"groupBy",this._generateLi(r,u),e=this.dummyUl,f=0;f<r.length;f++)this._listItem(r[f],"add");this.model.showCheckbox?this._appendCheckbox(e,!0):this._isSingleSelect()||this._multiItemSelection(e,!0);this._virtualUl.append(n(this.dummyUl).clone(!0));this.ultag.append(this.dummyUl);this._isPopupShown()&&(o=this.scrollerObj?this.scrollerObj.scrollTop():0,this._refreshScroller(),this.scrollerObj&&this.scrollerObj.option("scrollTop",o))},_toArray:function(i,r){var u;return typeof i=="function"&&(i=t.util.getVal(i)),n.isArray(i)?u=i:typeof i=="string"?r&&(this.model.multiSelectMode=="visualmode"||this.model.multiSelectMode=="delimiter"||this.model.showCheckbox)?(u=i.split(this.model.delimiterChar),u.length==0&&(u=[i])):r?u=[i]:(u=i.split(this.model.delimiterChar),u.length==0&&(u=[i])):u=[i],u},_trim:function(t){return typeof t=="string"?n.trim(t):t},selectItemByIndex:function(n){this._selectItemByIndex(n)},selectItemsByIndices:function(n){this._selectItemByIndex(n)},_selectItemByIndex:function(t){var f,i,u,r;if(this.listitems=this._getLi(),this._selectedIndices=n.map(this._selectedIndices,function(n){return parseInt(n)}),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices,parseInt(t)==-1&&this.model.selectedItems.length>0)this._clearTextboxValue(),this._trigger("change",{text:this._visibleInput[0].value,selectedText:"",selectedValue:"",value:""});else for(f=this._toArray(t,!0),u=0;u<f.length;u++)if(i=parseInt(f[u]),i!=null&&i>=0){if(n.inArray(i,this._selectedIndices)==-1)for(r=0;r<this.listitems.length;r++)n(this.listitems[r]).hasClass("e-disable")||r==i&&(this.selectedIndexValue=r,this._activeItem=i,this._enterTextBoxValue())}else!this.model.showCheckbox&&this.model.multiSelectMode=="none"&&this.model.selectedItems.length>0&&(this._clearTextboxValue(),this._trigger("change",{text:this._visibleInput[0].value,selectedText:"",selectedValue:"",value:""}))},unselectItemsByIndices:function(n){this._unselectItemByIndex(n)},unselectItemByIndex:function(n){this._unselectItemByIndex(n)},_unselectItemByIndex:function(t){var i,u,f,r;for(this._selectedIndices=n.map(this._selectedIndices,function(n){return parseInt(n)}),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices,u=this._toArray(t,!0),this.listitems=this._getLi(),r=0;r<u.length;r++)for(f=parseInt(u[r]),i=0;i<this.listitems.length;i++)i==f&&(this.selectedIndexValue=i,this._activeItem=f,this._activeItem==this._aselectedItem&&(this._aselectedItem=null),this._removeTextBoxValue())},setSelectedValue:function(n){this.selectItemByValue(n)},selectItemByValue:function(i){var r,f,u,e;if(this.listitems=this._getLi(),t.isNullOrUndefined(i)||i==="")this._clearTextboxValue();else for(f=this._toArray(i,!0),u=0;u<f.length;u++)for(r=0;r<this.listitems.length;r++)if(!n(this.listitems[r]).hasClass("e-disable")&&(e=this._getAttributeValue(this.listitems[r])||n(this.listitems[r]).text(),e&&(this._selectedValue=e,this._selectedValue==f[u]))){this._activeItem=r;this._aselectedItem=this._activeItem;this._enterTextBoxValue();break}},unselectItemByValue:function(n){var t,r=this._toArray(n,!0),i;for(this.listitems=this._getLi(),i=0;i<r.length;i++)for(t=0;t<this.listitems.length;t++)if(this._getAttributeValue(this.listitems[t])&&(this._selectedValue=this._getAttributeValue(this.listitems[t]),this._selectedValue==r[i])){this._activeItem=t;this._activeItem==this._aselectedItem&&(this._aselectedItem=null);this._removeTextBoxValue();break}},setSelectedText:function(n){this.selectItemByText(n)},selectItemByText:function(i){var r,f,u;if(this.listitems=this._getLi(),this._mapFields(),t.isNullOrUndefined(i)||i==="")this._clearTextboxValue();else for(f=this._toArray(i,!0),u=0;u<f.length;u++)for(r=0;r<this.listitems.length;r++)if(!n(this.listitems[r]).hasClass("e-disable")&&(this.selectedTextValue=this._isPlainType(this.popupListItems)?this.popupListItems[r]:this._getField(this.popupListItems[r],this.mapFld._text),this.selectedTextValue==f[u])){this._activeItem=r;this._aselectedItem=this._activeItem;this._enterTextBoxValue();break}},unselectItemByText:function(n){var t,r=this._toArray(n,!0),i;for(this.listitems=this._getLi(),this._mapFields(),i=0;i<r.length;i++)for(t=0;t<this.listitems.length;t++)if(this.unselectedTextValue=this._isPlainType(this.popupListItems)?this.popupListItems[t]:this._getField(this.popupListItems[t],this.mapFld._text),this.unselectedTextValue==r[i]){this._activeItem=t;this._activeItem==this._aselectedItem&&(this._aselectedItem=null);this._removeTextBoxValue();break}},getSelectedValue:function(){return this.element.val()},getSelectedItem:function(){var n,t=[];for(this.listitems=this._getLi(),n=0;n<this._selectedIndices.length;n++)t.push(this.listitems[this._selectedIndices[n]]);return t},getItemDataByValue:function(n){for(var r=this._toArray(n,!1),t,u=[],f=this.model.fields&&this.model.fields.value?this.model.fields.value:"value",i=0;i<r.length;i++)for(t=0;t<this._rawList.length;t++)this._rawList[t][f]==r[i]&&u.push(this._rawList[t]);return u},getListData:function(){return this._rawList},getSelectedItemsID:function(){return this._selectedItemsID},disableItemsByIndices:function(n){this._disableItemByIndex(n)},disableItemByIndex:function(n){this._disableItemByIndex(n)},_disableItemByIndex:function(t){var i,r;if(!this.model.enabled)return!1;for(i=this._toArray(t,!1),r=0;r<i.length;r++)i[r]==null||isNaN(parseInt(i[r]))||i.length>0&&!(n.inArray(parseInt(i[r]),this._disabledItems)>-1)&&(index=n.inArray(i[r],this._disabledItems),this._setClass(this._getLi()[parseInt(i[r])],"e-disable"),this._disabledItems.push(parseInt(i[r])),this.model.disableItemsByIndex=String(this._disabledItems.join(",")))},enableItemsByIndices:function(n){this._enableItemByIndex(n)},enableItemByIndex:function(n){this._enableItemByIndex(n)},_enableItemByIndex:function(t){var r=this._toArray(t,!1),u,i;for(this.model.enableItemsByIndex=t,i=0;i<r.length;i++)r.length>0&&n.inArray(parseInt(r[i]),this._disabledItems)>-1&&!isNaN(parseInt(r[i]))&&(u=n.inArray(parseInt(r[i]),this._disabledItems),this._removeClass(this._getLi()[parseInt(r[i])],"e-disable"),this._disabledItems.splice(u,1));this.model.enableItemsByIndex=null;this.model.disableItemsByIndex=this._disabledItems.join(this.model.delimiterChar)},_validateDelimiter:function(n){if(this._trim(n).length==1)if(!/^[a-zA-Z0-9]+$/.test(n))return n;return","},_removeText:function(t){var i=this.element[0].value.split(this.model.delimiterChar),u=this._visibleInput[0].value.split(this.model.delimiterChar),r=n.inArray(t,i);r>=0&&(i.splice(r,1),u.splice(r,1));this.element[0].value=i.join(this.model.delimiterChar);this._visibleInput[0].value=u.join(this.model.delimiterChar)},_addText:function(n){var i,r,t,u;if(this._checkContains(this._hiddenValue))return!1;for(i=["element","_visibleInput"],t=0;t<i.length;t++)r=i[t]=="element"?this._hiddenValue:n,this[i[t]][0].value&&this[i[t]][0].value!=""?(u=this[i[t]][0].value.split(this.model.delimiterChar),u.push(r),this[i[t]][0].value=u.join(this.model.delimiterChar)):this[i[t]][0].value=r},_checkContains:function(n){var i=this.element[0].value.split(this.model.delimiterChar),t;for(this.contains=!1,t=0;t<i.length;t++)if(i[t]===n){this.contains=!0;break}return this.contains},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.DropDownList",this.model.locale)},_init:function(){var i=t.browserInfo();this._updateLocalConstant();this._isIE8=i.name=="msie"&&i.version=="8.0";this._textContent=this._isIE8?"innerText":"textContent";(this.element.is("input")&&(this.element.is("input[type=text]")||!this.element.attr("type"))||this.element.is("select"))&&(this._isWatermark="placeholder"in n(document.createElement("input")).attr("placeholder","")[0],this._id=this.element[0].id,this._initialize(),this._render(),this._addAttr(this.model.htmlAttributes),this._enabled(this.model.enabled),this._initValue=!1,this._checkboxValue=!1,this.model.validationRules!=null&&(this._initValidator(),this._setValidation()))},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,f,i,u,e;if(this.element.closest("form").length!=0){this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r||(r=this.element.closest("form").validate());f=this.element.attr("name");r.settings.messages[f]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[f][i]=n.validator.messages[i];for(e in this.model.validationMessage)i==e?u=this.model.validationMessage[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[f][i]=u!=null?u:n.validator.messages[i]}}},_setInitialPopup:function(n){this.model.enabled&&!this.model.readOnly&&(n==!1?this._hideResult():this._showResult())},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popupListWrapper.removeClass(this.model.cssClass).addClass(n)},_setRTL:function(n){this.model.enableRTL!=n&&(this.model.enableRTL=n,this._RightToLeft(),this._dropbtnRTL())},_changeHeight:function(n){this.wrapper.height(n);this._setListHeight()},_changeWidth:function(n){this.wrapper.width(n);this._setListWidth()},_setModel:function(i){var r,e,o,f,u;for(r in i)switch(r){case"dataSource":this._isEqualDataSource(i[r])||this._checkModelDataBinding(i[r],this.model.query);break;case"query":this._checkModelDataBinding(this.model.dataSource,i[r]);break;case"fields":this.model.fields=n.extend(this.model.fields,i[r]);this._checkModelDataBinding(this.model.dataSource,this.model.query);break;case"itemsCount":this.model.itemsCount=i[r];this._checkModelDataBinding(this.model.dataSource,this.model.query);break;case"template":this.model.template=i[r];this._checkModelDataBinding(this.model.dataSource,this.model.query);break;case"value":e=t.util.getVal(i[r]);t.isNullOrUndefined(e)||e===""?this._clearTextboxValue():(this._setValue(t.util.getVal(i[r])),i[r]=this.model.value);break;case"delimiterChar":o=this.model.delimiterChar;i[r]=this._validateDelimiter(i[r]);this.model.delimiterChar=i[r];this.model.text&&(this.model.text=this.model.text.split(o).join(this.model.delimiterChar),this._visibleInput.val(this.model.text));this.model.value&&(this.model.value=this.model.value.split(o).join(this.model.delimiterChar),this.element.val(this.model.value));break;case"text":t.isNullOrUndefined(i[r])||i[r]===""?this._clearTextboxValue():(this._setText(i[r]),i[r]=this.model.text);break;case"itemValue":this._setItemValue(i[r]);break;case"enableRTL":this._setRTL(i[r]);break;case"enabled":this._enabled(i[r]);break;case"height":this._changeHeight(i[r]);break;case"width":this._changeWidth(i[r]);break;case"popupHeight":this.model.popupHeight=i[r];this._setListHeight(i[r]);break;case"popupWidth":this.model.popupWidth=i[r];this._setListWidth();break;case"minPopupHeight":this.model.minPopupHeight=i[r];this._setListHeight(i[r]);break;case"minPopupWidth":this.model.minPopupWidth=i[r];this._setListWidth();break;case"maxPopupHeight":this.model.maxPopupHeight=i[r];this._setListHeight(i[r]);break;case"maxPopupWidth":this.model.maxPopupWidth=i[r];this._setListWidth();break;case"cssClass":this._changeSkin(i[r]);break;case"showCheckbox":this.model.showCheckbox=i[r];f=this.model.text;u=this.model.text?this.model.text.split(this.model.delimiterChar):this.model.text;this._raiseEvents=!1;this._clearTextboxValue();this._raiseEvents=!0;this._checkboxHideShow(i[r]);this.model.showCheckbox||this.model.multiSelectMode!="none"?(this.model.multiSelectMode=="visualmode"&&this._renderBoxModel(),this._setText(f)):u&&u.length&&this._setText(u[0]);this._isPopupShown()&&this._setListPosition();break;case"checkAll":return this._setCheckAll(i[r]),!1;case"uncheckAll":return this._setUncheckAll(i[r]),!1;case"watermarkText":this._changeWatermark(i[r]);break;case"validationRules":this.element.closest("form").length!=0&&(this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null),this.model.validationRules=i[r],this.model.validationRules!=null&&(this._initValidator(),this._setValidation()));break;case"locale":this.model.locale=i[r];this._updateLocalConstant();break;case"validationMessage":this.element.closest("form").length!=0&&(this.model.validationMessage=i[r],this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation()));break;case"showRoundedCorner":this._roundedCorner(i[r]);this.model.showRoundedCorner=i[r];break;case"showPopupOnLoad":this._setInitialPopup(i[r]);break;case"targetID":this.model.targetID=i[r];this._showFullList();break;case"selectedItemIndex":case"selectedIndex":this._selectItemByIndex(i[r]);this.model.selectedItemIndex=this.model.selectedIndex=i[r];break;case"unselectItemByIndex":this._unselectItemByIndex(i[r]);break;case"disableItemsByIndex":this._disableItemByIndex(i[r]);break;case"enableItemsByIndex":this._enableItemByIndex(i[r]);break;case"selectedItems":case"selectedIndices":this._selectCheckedItem(i[r]);i[r]=this.model.selectedItems=this.model.selectedIndices=this._selectedIndices;break;case"multiSelectMode":this.model.multiSelectMode=="visualmode"&&(this._swapUlandInput(!1),this._ulBox.remove(),this._ulBox=null);this.model.multiSelectMode=i[r];f=this.model.text;u=this.model.text?this.model.text.split(this.model.delimiterChar):this.model.text;this._raiseEvents=!1;this._clearTextboxValue();this._raiseEvents=!0;this.model.showCheckbox||this.model.multiSelectMode!="none"?(this.model.multiSelectMode=="visualmode"&&this._renderBoxModel(),this._setText(f)):(this._setText(u[0]),this.wrapper.find("input[name="+this._name+"]").remove());this._isPopupShown()&&this._setListPosition();break;case"allowGrouping":this._setGroupingAndSorting("allowGrouping",i[r]);break;case"enableSorting":this._setGroupingAndSorting("enableSorting",i[r]);break;case"htmlAttributes":this._addAttr(i[r]);break;case"enablePopupResize":this.model.enablePopupResize=i[r];i[r]?this._enablePopupResize():this.popupListWrapper.removeClass("e-resizable").find(".e-resizebar").remove()&&this._hideResult();break;case"enableFilterSearch":if(i[r]){this.model.enableFilterSearch=!0;this._enableSearch();break}else this._removeSearch()}},_clearTextboxValue:function(){this.element.val("");this._visibleInput.val("");this._updateValue("");this.selectedTextValue=this._selectedValue=this._hiddenValue=this.model.itemValue="";this._updateText();this.selectedIndexValue=this._hiddenDelimiterIndex=this._activeItem=-1;this._selectedItemsID=[];this._selectedIndices=[];this.model.selectedItems=[];this.model.selectedIndices=[];this.selectedIndex(null);this.ultag.children("li").removeClass("e-hover").removeClass("e-active");this.model.showCheckbox&&this._resetCheck();this.wrapper.find("ul.e-ul.e-boxes").length!=0&&(this._ulBox.children("li").remove(),this._name===""?this.wrapper.find("input:hidden[id^='#']").remove():this.wrapper.find("input:hidden[id^='#'][name="+this._name+"]").remove(),n(this.element).attr("name",this._name))},_destroy:function(){this._destroyDropdown();this._visibleInput.removeClass("e-input ");this._setAttr(this.element[0],{accesskey:this.wrapper.attr("accesskey"),type:"text"});this._isWatermark&&this._visibleInput.removeAttr("placeholder");this.element[0].value="";this.model.dataSource||(this.selectOptions?this.docbdy&&this.docbdy.append(this.selectOptions.show()).show()&&this.element.remove()&&this.selectOptions&&this.selectOptions.removeClass("e-dropdownlist e-js"):this.docbdy&&this.ultag.find("li").removeClass("e-active")&&this.docbdy.append(this.ultag.html()).show());this._hideResult();this.popupPanelWrapper.remove();this.element.removeAttr("aria-expanded aria-autocomplete aria-haspopup aria-owns accesskey role").css({width:"",display:"block"});this._unwireEvents()},_finalize:function(){this.value()==""&&this._visibleInput[0].value!==""&&this._updateValue(this.element[0].value);this.value()!==this.element.val()&&this._setValue(this.value());this.model.text!=this._visibleInput.val()&&this._setText(this.model.text);this.selectedIndex(this.selectedIndex()!=-1?this.selectedIndex():this.selectedItemIndex());this.selectedIndex()!=-1?this._selectItemByIndex(this.selectedIndex()):this._selectedIndices.length>0&&this._selectCheckedItem(this._selectedIndices);this.model.disableItemsByIndex!=null&&this._disableItemByIndex(this.model.disableItemsByIndex);this.model.enableItemsByIndex!=null&&this._enableItemByIndex(this.model.enableItemsByIndex)},_initialize:function(){this._selectedIndices=this.model.selectedIndices.length>0?this.model.selectedIndices:this.model.selectedItems;this.model.selectedItems=this.model.selectedIndices=this._selectedIndices;this.model.selectedIndex=this.model.selectedIndex!=-1?this.model.selectedIndex:this.model.selectedItemIndex;this.element.is("select")&&(this.selectelement=!0,this._renderSelectToDropdown());this._selectedItemsID=[];this.target=this.element[0];this._disabledItems=[];this._queryString=null;this.suggLen=0;this._itemId=null;this.checkedStatus=!1;this._incqueryString="";this._activeItem=null;this.ddWidth=0;this._initValue=!0;this._virtualCount=0;this._raiseEvents=!0},_renderSelectToDropdown:function(){var i,f,u,r;if(this.inputElement=t.buildTag("input.e-dropdownlist#"+this._id+"_input","",{},{type:"text","data-role":"none"}),this.inputElement.insertAfter(this.element),this.element.attr("name")&&(this.inputElement.attr("name",this.element.attr("name")),this.element.removeAttr("name")),this.selectOptions=this.element,this.selectOptions.attr("id",this._id),this.model.dataSource==null){for(this.optionDiv=t.buildTag("div#"+this._id+"_list"),this.optionDiv.insertAfter(this.inputElement),this.optionUl=t.buildTag("ul"),this.optionDiv.append(this.optionUl),this.selectOptionItems=this.element.children("option"),f=this.selectOptionItems.length,this.optionDummyUl=n(),i=0;i<f;i++)r=this.selectOptionItems[i],u=n(r).attr("label")?n(r).attr("label"):r.innerHTML,u!=null&&(this.optionLi=t.buildTag("li",u,{},{"data-value":r.value,unselectable:"on"}),this.optionDummyUl.push(this.optionLi[0]),n(r).attr("selected")&&this.model.showCheckbox&&(n.inArray(i,this._selectedIndices)==-1?(this._selectedIndices.push(i),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices):t.isNullOrUndefined(this.selectedIndex())&&this.selectedIndex(i)));this.optionUl.append(this.optionDummyUl)}this.element.css("display","none");this.element=this.inputElement},_render:function(){var i,r;this._renderDropdown();this._setWatermark();this._renderPopupPanelWrapper();this._showFullList();this._roundedCorner(this.model.showRoundedCorner);i=this.model.dataSource;t.DataManager&&i instanceof t.DataManager?i.dataSource.offline&&i.dataSource.json&&i.dataSource.json.length>0&&(r=this,r._finalize()):this._finalize();t.DataManager&&this.model.dataSource instanceof t.DataManager||this._finalize();this._setCheckAll(this.model.checkAll);(this.element.attr("disabled")||n(this.selectOptions).attr("disabled"))&&this.disable()},_isEqualDataSource:function(n){var i,t,r;if(!this.model.dataSource||!n||!(this.model.dataSource.length===n.length))return!1;for(i=!0,t=0,r=this.model.dataSource.length;t<r;t++)if(this.model.dataSource[t]!==n[t]){i=!1;break}return i},_checkModelDataBinding:function(n,t){this.element.val("");this._visibleInput.val("");this._updateValue("");this.selectedTextValue=this._selectedValue=this._hiddenValue="";this._updateText();this.selectedIndexValue=this._hiddenDelimiterIndex=this._activeItem=-1;this._selectedItemsID=[];this.model.selectedItems=this.model.selectedIndices=this._selectedIndices=[];this.model.selectedIndex=this.model.selectedItemIndex=-1;this.model.multiSelectMode=="visualmode"&&this._destroyBoxModel();this.model.dataSource=n;this.model.query=t;this.ultag.empty();this._showFullList()},_initDataSource:function(n){var i=this,r;t.DataManager&&n instanceof t.DataManager&&(i._addLoadingClass(),i._trigger("actionBegin",{requestFrom:"default"})||(r=n.executeQuery(this._getQuery()),r.done(function(n){i._trigger("actionSuccess",{e:n,requestFrom:"default"});i._totalCount=n.count;i._listItem(n.result);i._removeLoadingClass();i._renderPopupList();i._finalize()}).fail(function(n){i.model.dataSource=null;i._addLoadingClass();i._trigger("actionFailure",{e:n,requestFrom:"default"})}).always(function(n){i._trigger("actionComplete",{e:n,requestFrom:"default"})})))},_listItem:function(t,i){i=="add"?(this.popupListItems.push(t),this._rawList.push(t)):n.isArray(t)&&(this.popupListItems=t.slice(0),this._rawList=t.slice(0))},_getQuery:function(n){var i,r=this.model.fields,u=t.Query(),f,e;if(!t.isNullOrUndefined(this.model.query)||this.model.template||n)this.model.query&&(u=this.model.query.clone());else{f=[];for(e in r)e!=="tableName"&&r[e]&&f.push(r[e]);f.length>0&&u.select(f)}return this.model.allowVirtualScrolling&&u.requiresCount(),this.model.itemsCount>0&&u.take(this.model.itemsCount),i=this.model.dataSource.dataSource,r&&(i&&i.url&&!i.url.match(r.tableName+"$")||i&&!i.url||!i)&&(t.isNullOrUndefined(r.tableName)||u.from(r.tableName)),u},_addLoadingClass:function(){this._isPopupShown()?this.popupListWrapper.addClass("e-load"):(this.dropdownbutton.addClass("e-load"),this.drpbtnspan.removeClass("e-icon e-arrow-sans-down"));this._readOnly=!0},_removeLoadingClass:function(){this.dropdownbutton.removeClass("e-load");this.drpbtnspan.addClass("e-icon e-arrow-sans-down");this._readOnly=!1;this.popupListWrapper.removeClass("e-load")},_renderDropdown:function(){if(this.wrapper=t.buildTag("span.e-ddl e-widget "+this.model.cssClass+"#"+this._id+"_wrapper","",{},{tabindex:"0",accesskey:this.element.attr("accesskey")}),this.container=t.buildTag("span.e-in-wrap e-box #"+this._id+"_container"),this.element.removeAttr("accesskey"),this.model.value==null&&this.element.attr("value")!=null&&(this.model.value=this.element.attr("value")),this.element.attr("value","").val(""),this._isIE8?this._setAttr(this.element[0],{role:"combobox","aria-expanded":!1,"aria-autocomplete":"list","aria-haspopup":!0,"aria-owns":this._id+"_popup"}).element.hide():this._setAttr(this.element[0],{type:"hidden",role:"combobox","aria-expanded":!1,"aria-autocomplete":"list","aria-haspopup":!0,"aria-owns":this._id+"_popup"}).element.hide(),this.drpbtnspan=t.buildTag("span.e-icon e-arrow-sans-down","",{},{"aria-label":"select",unselectable:"on"}),this.dropdownbutton=t.buildTag("span.e-select#"+this._id+"_dropdown","",{},{role:"button",unselectable:"on"}).append(this.drpbtnspan),this.container.insertAfter(this.element),this.container.append(this.element),this.container.append(this.dropdownbutton),this.wrapper.insertBefore(this.container),this.wrapper.append(this.container),this.selectelement&&this.selectOptions.insertBefore(this.element),this._visibleInput=t.buildTag("input#"+this._id+"_hidden","",{}).insertAfter(this.element),this._visibleInput.addClass("e-input "),this._setAttr(this._visibleInput[0],{readonly:!0,tabindex:-1,"data-role":"none"}),!this._isWatermark){var i=this.model.watermarkText!=null?this.model.watermarkText:this._localizedLabels.watermarkText;this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element);this._hiddenSpan.text(i);this._hiddenSpan.css("display","none");this._hiddenSpan.on("mousedown",n.proxy(this._OnDropdownClick,this))}this._checkNameAttr();this._setDimentions();this._RightToLeft();this.ddWidth=this.dropdownbutton.outerWidth()>0?this.dropdownbutton.outerWidth():24;this.container.on("mousedown",n.proxy(this._OnDropdownClick,this))},_checkNameAttr:function(){this._name=t.isNullOrUndefined(this.element.attr("name"))?this._id:this.element.attr("name");this.element.attr("name",this._name)},_addAttr:function(i){var r=this;n.map(i,function(i,u){var f=u.toLowerCase();f=="class"?r.wrapper.addClass(i):f=="disabled"&&i=="disabled"?r.disable():f=="readOnly"&&i=="readOnly"?r.model.readOnly=!0:f=="style"?r.wrapper.attr(u,i):t.isValidAttr(r._visibleInput[0],u)?n(r._visibleInput).attr(u,i):r.wrapper.attr(u,i)})},_renderBoxModel:function(){if(!t.isNullOrUndefined(this._ulBox)||this.model.multiSelectMode!="visualmode")return!1;this._ulBox=t.buildTag("ul.e-ul e-boxes");this.container.prepend(this._ulBox);this._ulBox.css("min-height","30px");this._ulBox.css("display","none");this._on(this.container,"click",function(t){if(!this.model.enabled)return!1;var i=n(t.target);i.hasClass("e-options")&&(!t.ctrlKey&&i.siblings().hasClass("e-active")&&this._removeActive(),i.hasClass("e-active")?i.removeClass("e-active"):i.addClass("e-active"));!t.ctrlKey&&i.hasClass("e-boxes")&&this._removeActive()})},_renderPopupPanelWrapper:function(){var i=n("#"+this.element[0].id+"_popup_wrapper").get(0);i&&n(i).remove();this.popupPanelWrapper=t.buildTag("div#"+this._id+"_popup_wrapper");n("body").append(this.popupPanelWrapper);this.popupListWrapper=t.buildTag("div.e-ddl-popup e-box e-widget e-popup#"+this._id+"_popup_list_wrapper","",{display:"none",overflow:"hidden"});this.popupList=t.buildTag("div#"+this._id+"_popup",{tabIndex:0});this.popupListWrapper.addClass(this.model.cssClass);this.popup=this.popupList;this.popupScroller=t.buildTag("div");this.ultag=t.buildTag("ul.e-ul","",{},{role:"listbox"});this.popupScroller.append(this.ultag);this.popupList.append(this.popupScroller);this.model.headerTemplate&&(this.headerTemplate=n("<div>").append(this.model.headerTemplate),this.popupListWrapper.append(this.headerTemplate));this.popupListWrapper.append(this.popupList);this.popupPanelWrapper.append(this.popupListWrapper);this.ultag.on({mouseenter:n.proxy(this._OnMouseEnter,this),mouseleave:n.proxy(this._OnMouseLeave,this),click:n.proxy(this._OnMouseClick,this)},"li:not('.e-category')");if(t.isTouchDevice())this.ultag.on({tap:n.proxy(this._OnMouseEnter,this)},"li:not('.e-category')");n(window).on("resize",n.proxy(this._OnWindowResize,this))},_updateText:function(){this.model.text=this._visibleInput.val()==""?null:this._visibleInput.val()},_updateValue:function(n){this.value(n==""?null:n)},_setGroupingAndSorting:function(n,t){var i,u,r;if(this.model[n]=t,i=this.model.text,this._updateValue(""),this._selectedIndices=[],this.ultag.empty(),this._showFullList(),this.model.showCheckbox&&i)for(u=i.split(this.model.delimiterChar),r=0;r<u.length;r++)this.selectItemByText(u[r]);else this.selectItemByText(i)},_setSortingList:function(){var t=document.createElement("ul"),r,i;if(n(t).append(this.itemsContainer.children()),this.model.allowGrouping||n(t).find(">.e-category").length>0)for(this.popupListWrapper.addClass("e-atc-popup"),r=0;r<n(t).find(">.e-category").length;r++)i=n(t).find(">.e-category").eq(0).first().nextUntil(".e-category").get(),this._setSortList(t,i);else n(t).children(">.e-category").remove(),i=n(t).children("li").get(),this._setSortList(t,i);this.itemsContainer=n(t)},_setSortList:function(t,i){i.sort(function(t,i){var r=n(t).text().toUpperCase(),u=n(i).text().toUpperCase();return r<u?-1:r>u?1:0});this.model.sortOrder=="descending"&&i.reverse();(this.model.allowGrouping||n(t).find(">.e-category").length>0)&&(n(t).append(n("<li>").text(n(t).find(">.e-category").eq(0).text()).addClass("e-category")),n(t).find(">.e-category").eq(0).remove());n.each(i,function(i,r){n(t).append(r)})},_renderPopupList:function(){this._doDataBind();this._renderRemaining()},_renderRemaining:function(){var t=this;this._dropbtnRTL();this.model.enableFilterSearch&&this._enableSearch();this.model.enablePopupResize&&this._enablePopupResize();this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal"&&this._totalCount&&this._totalCount>0&&(this._totalHeight=this._totalCount*29,this._totalPages=this._totalCount/(this.model.itemsCount*29),this._loadedItemHeight=this._getLi().length*29,this._getLi().attr("page",0),this._virtualPages=[0],this.ultag.append(n("<span>").addClass("e-virtual").css({height:this._totalHeight-this._loadedItemHeight,display:"block"})));this._virtualUl=this.ultag.clone(!0);this._setListWidth();this._setListHeight();this._isSingleSelect()||(this.model.showCheckbox?this._checkboxHideShow(this.model.showCheckbox):this._multiItemSelection(this._getLi()));this._setUncheckAll(this.model.uncheckAll);this.popupScroller.css({height:"",width:""});this.popupList.ejScroller({height:this._getPopupHeight(),width:0,scrollerSize:20,scroll:function(n){t.model.allowVirtualScrolling&&t._onScroll(n)}});this.scrollerObj=this.popupList.ejScroller("instance");this.popupList.find("div.e-scrollbar div").attr("unselectable","on");this._setListPosition();this.popupListWrapper.css({display:"none",visibility:"visible"});this._changeSkin(this.model.cssClass);this.model.showPopupOnLoad&&this._showResult()},_enableSearch:function(){this.model.enableFilterSearch&&(this.inputSearch||(this.inputSearch=t.buildTag("input#"+this._id+"_inputSearch.e-input","",{},{type:"text","data-role":"none"}),this.popupListWrapper.prepend(n("<span>").addClass("e-atc e-search").append(n("<span>").addClass("e-in-wrap ").append(this.inputSearch).append(n("<span>").addClass(" e-icon e-search")))),this._on(this.inputSearch,"keyup",this._OnSearchEnter)))},_removeSearch:function(){this.model.enableFilterSearch=!1;this.popupListWrapper.find(".e-atc.e-search").remove();this._isPopupShown()&&this.hidePopup();this.inputSearch=null},_OnSearchEnter:function(i){var f=this,u,r;n.inArray(i.keyCode,[38,40,13])!=-1&&this.ultag.find("li.e-nosuggestion").length<=0?i.keyCode==13?this._OnKeyUp(i):this._OnKeyDown(i):(this._activeItem=-1,this._queryString=this.inputSearch.val(),this._queryString==""&&this._virtualUl?(r={searchString:this._queryString,searchQuery:null,items:this._rawList},this._trigger("search",r),this._resetList(),this._updateSelectedIndexByValue(this.value()),this._refreshScroller(),this._setListPosition()):(this._mapFields(),u=this._addSearchQuery(t.Query(),!this._isPlainType(this._rawList)),r={searchString:this._queryString,items:this._rawList,searchQuery:u},this.popupListWrapper.find(".e-atc.e-search .e-search").addClass("e-cross-circle").removeClass("e-search"),this._on(this.popupListWrapper.find(".e-atc.e-search .e-cross-circle"),"mousedown",this._refreshSearch),this._trigger("search",r)||f._filterSearch(u,r)))},_refreshSearch:function(){this._resetSearch();this._refreshPopup()},_filterSearch:function(n,i){var u=!1,r=i.result?i.result:t.DataManager(this._rawList).executeLocal(n);r.length==0&&(u=!0,r.push(this._getLocalizedLabels("emptyResultText")));this.popupListItems=r;this.ultag.empty();this._isPlainType(this.popupListItems)?this._plainArrayTypeBinding(r):this._objectArrayTypeBinding(r,"search");u&&this.ultag.find("li").length==1&&this.ultag.find("li").eq(0).addClass("e-nosuggestion");this.model.showCheckbox&&!u&&this._appendCheckbox(this._getLi());this._onSearch=!0;this._setValue(this.value());this._onSearch=!1;this._updateSelectedIndexByValue(this.value());this._refreshScroller();this._setListPosition()},_updateSelectedIndexByValue:function(n){var r,i,t;if(n&&this.model.enableFilterSearch){for(this._selectedIndices=this.model.selectedItems=this.model.selectedIndices=[],this._virtualList=this._virtualUl.children("li:not('.e-category')"),r=this._toArray(n),i=0;i<r.length;i++)for(t=0;t<this._virtualList.length;t++)if(r[i]==this._getIndexedValue(this._virtualList[t])){this._selectedIndices.push(t);break}this.model.selectedItems=this.model.selectedIndices=this._selectedIndices}},_getIndexedValue:function(n){return this._getAttributeValue(n)?this._getAttributeValue(n):n.innerText},_resetSearch:function(){this.inputSearch&&this.model&&this.model.enableFilterSearch&&this.inputSearch.val()!=""&&this._virtualUl&&(this.inputSearch.val(""),this._resetList())},_resetList:function(){this.popupListWrapper.find(".e-atc.e-search .e-cross-circle").length==1&&(this.popupListWrapper.find(".e-atc.e-search .e-cross-circle").addClass("e-search").removeClass("e-cross-circle"),this._off(this.popupListWrapper.find(".e-atc.e-search .e-cross-circle"),"mousedown",this._refreshSearch));this._listItem(this._rawList);this.ultag.empty().append(this._virtualUl.children().clone(!0));this._onSearch=!0;this._setValue(this.value());this._onSearch=!1},_addSearchQuery:function(n,t){var r="",i;return t&&(i=this.model.fields,r=i&&i.text?i.text:"text"),this._queryString&&n.where(r,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch),this.model.itemsCount>0&&n.take(this.model.itemsCount),n},_targetElementBinding:function(){var e=this.element.parents().last(),r,f,t,u,i;if(this.docbdy=this.model.targetID?e.find("#"+this.model.targetID):this.optionDiv?this.optionDiv:null,!this.docbdy)return!1;if(this.itemsContainer=this.docbdy[0].nodeName=="UL"?this.docbdy:this.docbdy.children("ol,ul"),(this.model.allowGrouping||this.itemsContainer.find(">.e-category").length>0)&&!this.model.enableSorting)for(this.popupListWrapper.addClass("e-atc-popup"),r=0;r<this.itemsContainer.find(">.e-category").length;r++)f=this.itemsContainer.find(">.e-category").eq(r),f.replaceWith(n("<li>").text(f.text()).addClass("e-category"));else this.model.enableSorting&&this._setSortingList();for(this.itemsContainer.children("ol,ul").remove(),this.items=this.itemsContainer.children("li"),this.items.children("img,div").addClass("e-align"),this._listItem([]),t=0;t<this.items.length;t++)u=n(this.items[t]).text(),i=this._getAttributeValue(this.items[t]),n(this.items[t]).attr("data-value")||n(this.items[t]).attr("data-value",i?i:u),this._listItem({text:u,value:i?i:u},"add");this.ultag.empty().append(this.itemsContainer.children());this.ultag.children("li").attr("role","option").attr("unselectable","on");this.docbdy.css({display:"none"}).children("ol,ul").remove()},_plainArrayTypeBinding:function(i){var r,u;if(this.dummyUl=n(),this.model.enableSorting&&(i.sort(),this.model.sortOrder=="descending"&&i.reverse()),i.length>0){for(r=0;r<i.length;r++)t.isNullOrUndefined(i[r])||(u=t.buildTag("li",i[r],{},{"data-value":i[r],unselectable:"on"}),this.dummyUl.push(u[0]));this.ultag.append(this.dummyUl);this._trigger("dataBound",{data:i})}},_mapFields:function(){this.model.fields.groupBy=this.model.fields.groupBy?this.model.fields.groupBy:this.model.fields.category;var n=this.model.fields;this.mapFld={_id:null,_imageUrl:null,_imageAttributes:null,_spriteCSS:null,_text:null,_value:null,_htmlAttributes:null,_selected:null};this.mapFld._id=n&&n.id?n.id:"id";this.mapFld._imageUrl=n&&n.imageUrl?n.imageUrl:"imageUrl";this.mapFld._imageAttributes=n&&n.imageAttributes?n.imageAttributes:"imageAttributes";this.mapFld._spriteCSS=n&&n.spriteCssClass?n.spriteCssClass:"spriteCssClass";this.mapFld._text=n&&n.text?n.text:"text";this.mapFld._value=n&&n.value?n.value:"value";this.mapFld._htmlAttributes=n&&n.htmlAttributes?n.htmlAttributes:"htmlAttributes";this.mapFld._selected=n&&n.selected?n.selected:"selected";this.mapFld._category=n&&n.groupBy?n.groupBy:"groupBy"},_doDataBind:function(){var t=this.model.dataSource,n=this.popupListItems;!t||!n||!n.length||n.length<1?this._targetElementBinding():this._isPlainType(n)?this._plainArrayTypeBinding(n):this._objectArrayTypeBinding(n)},_isPlainType:function(n){return typeof n[0]!="object"},_objectArrayTypeBinding:function(i,r){var s,h,u,o,f,e;if(this.dummyUl=n(),this._mapFields(),this.model.enableSorting&&(s=t.Query().sortBy(this.mapFld._text,this.model.sortOrder,!0),i=t.DataManager(i).executeLocal(s),this.popupListItems=i),this.model.allowGrouping||this.model.fields.groupBy)for(this.popupListWrapper.addClass("e-atc-popup"),h=this.mapFld._category,o=t.Query().group(h),this.model.enableSorting||o.queries.splice(0,1),u=t.DataManager(i).executeLocal(o),this._swapUnCategorized(u),r=="search"?this.popupListItems=[]:this._listItem([]),f=0;f<u.length;f++)for(u[f].key&&this.ultag.append(t.buildTag("li.e-category",u[f].key).attr("role","option")[0]),this._generateLi(u[f].items,this.mapFld),this.ultag.append(this.dummyUl),e=0;e<u[f].items.length;e++)r=="search"?this.popupListItems.push(u[f].items[e]):this._listItem(u[f].items[e],"add");else this._generateLi(i,this.mapFld),this.ultag.append(this.dummyUl);this._trigger("dataBound",{data:i})},_onScroll:function(i){var f,r,e,o,u;i.scrollTop&&(f=i.scrollTop,r=this,r.model.allowVirtualScrolling&&r.model.virtualScrollMode=="continuous"?(u=t.Query().skip(r._rawList.length).take(r.model.itemsCount).clone(),f>=Math.round(n(r.popupList).find("ul,ol").height()-n(r.popupList).height())&&r._rawList.length<r._totalCount&&(r._addLoadingClass(),t.DataManager&&r.model.dataSource instanceof t.DataManager?(u=r._getQuery().skip(r._rawList.length).take(r.model.itemsCount).clone(),r._trigger("actionBegin",{requestFrom:"scroll"})||(o=r.model.dataSource.executeQuery(u),o.done(function(n){r.addItem(n.result);r._removeLoadingClass();r._trigger("actionSuccess",{e:n,requestFrom:"scroll"})}).fail(function(){r.model.dataSource=null;r._removeLoadingClass();r._trigger("actionFailure",{e:i,requestFrom:"scroll"})}).always(function(n){r._trigger("actionComplete",{e:n,requestFrom:"scroll"})}))):(e=t.DataManager(r.model.dataSource).executeLocal(u),r.addItem(e),r._removeLoadingClass()))):r.model.allowVirtualScrolling&&r.model.virtualScrollMode=="normal"&&window.setTimeout(function(){r._virtualCount==0&&r._loadList()},300))},_loadList:function(){var r,h,u,c,l,a;this._virtualCount++;var v=this.scrollerObj.scrollTop(),i=this,o=0,f,s=null;if(this._currentPage=Math.round(v/(29*this.model.itemsCount)),n.inArray(this._currentPage,this._virtualPages.sort(function(n,t){return n-t}))!=-1)if(this._currentPage==0){if(n.inArray(this._currentPage+1,this._virtualPages)!=-1)return this._virtualCount--,!1;this._currentPage=this._currentPage+1}else if(n.inArray(this._currentPage-1,this._virtualPages)!=-1){if(n.inArray(this._currentPage+1,this._virtualPages)!=-1)return this._virtualCount--,!1;this._currentPage=this._currentPage+1}else this._currentPage=this._currentPage-1;for(f=!(n.inArray(this._currentPage-1,this._virtualPages)!=-1),this._addLoadingClass(),r=this._virtualPages.length-1;r>=0;r--)if(this._virtualPages[r]<this._currentPage){o=this._virtualPages[r];r+1==this._virtualPages.length||(s=this._virtualPages[r+1]);break}if(h=f?(this._currentPage-1)*this.model.itemsCount:this._currentPage*this.model.itemsCount,u=t.Query().range(h,this._currentPage*this.model.itemsCount+this.model.itemsCount),t.DataManager&&i.model.dataSource instanceof t.DataManager){if(a=f?(this._currentPage-1)*this.model.itemsCount:this._currentPage*this.model.itemsCount,u=this._getQuery().skip(a),f){for(r=0;r<u.queries.length;r++)if(u.queries[r].fn=="onTake"){u.queries.splice(r,1);break}u.take(2*this.model.itemsCount)}i._trigger("actionBegin",{requestFrom:"scroll"})||(c=i.model.dataSource.executeQuery(u),c.done(function(n){i._appendVirtualList(n.result,o,i._currentPage,s,f);i._removeLoadingClass();i._trigger("actionSuccess",{e:n,requestFrom:"scroll"})}).fail(function(){i._virtualCount--;i._removeLoadingClass();i._trigger("actionFailure",{e:e,requestFrom:"scroll"})}).always(function(n){i._trigger("actionComplete",{e:n,requestFrom:"scroll"})}))}else l=t.DataManager(i.model.dataSource).executeLocal(u),this._appendVirtualList(l,o,this._currentPage,s,f),i._removeLoadingClass()},_appendVirtualList:function(t,i,r,u,f){var e,s,c,o,l,h;if(this._virtualCount--,n.inArray(r,this._virtualPages.sort(function(n,t){return n-t}))!=-1)return!1;for(f&&n.inArray(r-1,this._virtualPages.sort())!=-1&&(t.splice(0,this.model.itemsCount),f=!1),e=this.model.itemsCount,s=n("<ul>"),c=f?(r-1)*e*29-(i*e+e)*29:r*e*29-(i*e+e)*29,c!=0&&s.append(n("<span>").addClass("e-virtual").css({display:"block",height:c})),this._mapFields(),this._generateLi(t,this.mapFld),n(this.dummyUl).attr("page",r),f&&n(this.dummyUl).slice(0,e).attr("page",r-1),this.model.showCheckbox&&this._appendCheckbox(this.dummyUl),s.append(this.dummyUl),o=(r*e+e)*29,o=u!=null?u*e*29-o:this.ultag.height()-o,o!=0&&s.append(n("<span>").addClass("e-virtual").css({display:"block",height:o})),l=this.ultag.find("li[page="+i+"]").last(),l.next().remove(),s.children().insertAfter(l),this._virtualPages.push(r),f&&this._virtualPages.push(r-1),h=0;h<t.length;h++)this._listItem(t[h],"add");this._virtualUl=this.ultag.clone(!0);this._renderBoxModel()},_generateLi:function(i,r){var u,s,p,h;if(this.mapFld=r,this.dummyUl=[],!i||!i.length||i.length<1)return!1;for(u=0;u<i.length;u++){var c=this._getField(i[u],this.mapFld._id),l=this._getField(i[u],this.mapFld._imageUrl),a=this._getField(i[u],this.mapFld._imageAttributes),v=this._getField(i[u],this.mapFld._spriteCSS),e=this._getField(i[u],this.mapFld._text),o=this._getField(i[u],this.mapFld._value),y=this._getField(i[u],this.mapFld._htmlAttributes),w=this._getField(i[u],this.mapFld._selected),f=document.createElement("li");!t.isNullOrUndefined(o)&&o.toString().length>0?f.setAttribute("data-value",typeof o=="object"?JSON.stringify(o):o):f.setAttribute("data-value",e);t.isNullOrUndefined(c)||c===""||f.setAttribute("id",c);t.isNullOrUndefined(y)||y==""||this._setAttr(f,y);this.model.template?n(f).append(this._getTemplatedString(i[u])):(t.isNullOrUndefined(l)||l==""||(s=document.createElement("img"),this._setClass(s,"e-align")._setAttr(s,{src:l,alt:e}),a&&a!=""&&this._setAttr(s,a),f.appendChild(s)),t.isNullOrUndefined(v)||v==""||(p=document.createElement("div"),this._setClass(p,"div.e-align "+v+" sprite-image"),f.appendChild(p)),w&&this._setClass(f,"chkselect"),t.isNullOrUndefined(e)&&(e=String(e)),h=document.createElement("span"),h.innerHTML=e,this._setClass(h,"e-ddltxt"),f.innerHTML+=h.outerHTML);this._setAttr(f,{role:"option",unselectable:"on"});this.dummyUl.push(f)}},_setAttr:function(n,t){var r,i,u;if(typeof t=="string")r=t.replace(/['"]/g,"").split("="),r.length==2&&n.setAttribute(r[0],r[1]);else for(i in t)if((i=="styles"||i=="style")&&typeof t[i]=="object")for(u in t[i])n.style[u]=t[i][u];else n.setAttribute(i,t[i]);return this},_setClass:function(n,t){return n.className+=" "+t,this},_removeClass:function(n,t){var i=n.className.indexOf(t);return i>=0&&(n.className=i!=0&&n.className[i-1]===" "?n.className.replace(" "+t,""):n.className.replace(t,"")),this},_hasClass:function(n,t){return n.className.indexOf(t)>=0},_swapUnCategorized:function(t){n(t).each(function(n,i){if(!i.key){for(var r=n;r>0;r--)t[r]=t[r-1];return t[r]=i,!1}})},_getField:function(n,i){return t.pvt.getObject(i,n)},_getTemplatedString:function(n){for(var t=this.model.template,i=t.indexOf("${"),r=t.indexOf("}"),u,f;i!=-1&&r!=-1;)u=t.substring(i,r+1),f=u.replace("${","").replace("}",""),t=t.replace(u,this._getField(n,f)),i=t.indexOf("${"),r=t.indexOf("}");return t},_setWatermark:function(){if(this.element.val()==""&&this._trim(this._visibleInput.val())==""){var n=this.model.watermarkText!=null?this.model.watermarkText:this._localizedLabels.watermarkText;this._isWatermark?this._visibleInput.attr("placeholder",n):this._hiddenSpan.css("display","block").text(n);this.model.multiSelectMode=="visualmode"&&this._ulBox&&this._ulBox.find("li").length==0&&this._swapUlandInput(!1)}},_checkboxHideShow:function(n){if(n){this.listitems=this._getLi();var t=this.listitems.find("input[type=checkbox]");t.length==0&&this._appendCheckbox(this.listitems)}else this._removeCheck(this.popupList);this.model.showCheckbox=n;this._virtualUl=this.ultag.clone(!0)},_setCheckAll:function(n){!this._isSingleSelect()&&n?this.checkAll():this.model.checkAll=!1},_setUncheckAll:function(n){!this._isSingleSelect()&&n?this.uncheckAll():this.model.uncheckAll=!1},checkAll:function(){var f=this._selectedIndices,u=!1,i,r;if(this._mapFields(),this.listitems=this._getLi(),this._isWatermark||this._hiddenSpan.css("display","none"),!this._isSingleSelect()){for(i=0;i<this.listitems.length;i++)this._currentText=this._isPlainType(this.popupListItems)?this.popupListItems[i]:this._getField(this.popupListItems[i],this.mapFld._text),this._hiddenValue=this._getAttributeValue(this.listitems[i])||this._currentText,this._checkContains(this._hiddenValue)?u=!0:this.model.showCheckbox?(r=n(this.listitems[i]).children(".e-checkwrap")[0],r&&!this._isChecked(r)?(this._setClass(r,"e-check-act"),this._setAttr(r,{"aria-checked":!0}),r.firstChild.checked=!0,u=!1):u=!0):(u=!1,n(this.listitems[i]).addClass("e-active")),u||(this.checkedStatus=!0,this._itemID=n(this.listitems[i]).attr("id"),t.isNullOrUndefined(this._itemID)||this._itemID==""||this._selectedItemsID.push(this._itemID),this._createListHidden(this._hiddenValue),this.model.multiSelectMode=="visualmode"&&(this._ulBox.append(this._createBox(this._currentText,this._hiddenValue)),this._isPopupShown()&&this._setListPosition()),this._addText(this._currentText),n.inArray(i,f)==-1&&(this._selectedIndices.push(i),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),this._selectedValue=this._getAttributeValue(this.listitems[i])||"",this._initValue||this._trigger("checkChange",{isChecked:this.checkedStatus,data:this.model}),args={text:this._visibleInput[0].value,selectedText:this._currentText,itemId:i,selectedValue:this._selectedValue,value:this._selectedValue,isChecked:this.checkedStatus},this._updateValue(this.element.val()),this._updateText(),this._initValue||this._trigger("change",args),this._activeItem=i,this.activeItem=this._getActiveItem(),this._cascadeAction());this.model.itemValue=this._selectedValue;this.model.uncheckAll=!1;this.model.checkAll=!0;this._activeItem=-1;this._setWatermark()}},_createListHidden:function(t){var i=document.createElement("input");this._setAttr(i,{type:"hidden",name:this._name,value:t,id:"#"+t});this.container.append(i);n(this.element).attr("name","hiddenEle")},_removeListHidden:function(t){var i=this.container.find("[id='#"+t+"']");n(i).remove()},_getAttributeValue:function(n){return n?n.getAttribute("data-value")||n.getAttribute("value"):null},_selectCheckedItem:function(n){for(var t=0;t<n.length;t++)this._activeItem=n[t],this._enterTextBoxValue()},unCheckAll:function(){this.uncheckAll()},uncheckAll:function(){var u=!1,i,r,f;if(this.listitems=this._getLi(),this._mapFields(),!this._isSingleSelect()){for(i=0;i<this.listitems.length;i++)this._currentText=this._isPlainType(this.popupListItems)?this.popupListItems[i]:this._getField(this.popupListItems[i],this.mapFld._text),this._hiddenValue=this._getAttributeValue(this.listitems[i])||this._currentText,this._checkContains(this._hiddenValue)?this.model.showCheckbox?(r=n(this.listitems[i]).children(".e-checkwrap")[0],r&&this._isChecked(r)?(this._removeClass(r,"e-check-act"),this._setAttr(r,{"aria-checked":!1}),r.firstChild.checked=!1,u=!0):u=!1):(n(this.listitems[i]).removeClass("e-active"),u=!0):u=!1,u&&(this.checkedStatus=!1,this._activeItem=i,this.activeItem=this._getActiveItem(),this._removeText(this._hiddenValue),this._removeListHidden(this._hiddenValue),f=this._selectedIndices,n.inArray(i,f)>-1&&(this._selectedIndices.splice(n.inArray(i,f),1),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),this._selectedValue=this._getAttributeValue(this.listitems[i])||"",this._itemID=n(this.listitems[i]).attr("id"),t.isNullOrUndefined(this._itemID)||this._itemID==""||this._removeSelectedItemsID(),this._initValue||this._trigger("checkChange",{isChecked:this.checkedStatus,data:this.model}),args={text:this._visibleInput[0].value,selectedText:this._currentText,itemId:i,selectedValue:this._selectedValue,value:this._selectedValue,isChecked:this.checkedStatus},this._updateValue(this.element.val()),this._updateText(),this._initValue||this._trigger("change",args),this._cascadeAction(),this.model.multiSelectMode=="visualmode"&&(this._deleteBoxCheck(this._hiddenValue),this._isPopupShown()&&this._setListPosition()));this.model.itemValue=this._selectedValue;this.model.checkAll=!1;this.model.uncheckAll=!0;this._setWatermark();this._activeItem=-1}},_removeSelectedItemsID:function(){var n;n=this._selectedItemsID.indexOf(this._itemID);this._selectedItemsID.splice(n,1);this._itemID=""},_refreshScroller:function(){this.model.enablePopupResize||(this.popupList.css("height","auto"),this.popupListWrapper.css("height","auto"));this.popupList.find(".e-content, .e-vhandle").removeAttr("style");this.popupList.find(".e-vhandle div").removeAttr("style");this.popupList.children(".e-content").removeClass("e-content");var n=this._isPopupShown();this.popupListWrapper.css("display","block");this.popupList.css({display:"block"});this.scrollerObj.model.height=Math.ceil(this._getPopupHeight());this.scrollerObj.refresh();this.model.enablePopupResize||(this.popupList.css("height","auto"),this.popupListWrapper.css("height","auto"));this.scrollerObj.option("scrollTop",0);n||this.popupListWrapper.css("display","none")},_enablePopupResize:function(){this.model.enablePopupResize&&(this.popupListWrapper.addClass("e-resizable").append(t.buildTag("div.e-resizebar").append(t.buildTag("div.e-icon e-resize-handle"))).find(".e-resize-handle").addClass(this.model.enableRTL?"e-rtl-resize":""),this._resizePopup())},_resizePopup:function(){var t=this,i=!1;this.popupListWrapper.find("div.e-resize-handle").ejResizable({minHeight:t._validatePixelData(t.model.minPopupHeight),minWidth:t._validatePixelData(t.model.minPopupWidth),maxHeight:t._validatePixelData(t.model.maxPopupHeight),maxWidth:t._validatePixelData(t.model.maxPopupWidth),handle:"e-ddl-popup",resizeStart:function(n){if(!t.model.enabled)return!1;i||t._trigger("popupResizeStart",{event:n});i=!0},resize:function(i){var r=n(i.element).parents("div.e-ddl-popup");t._refreshPopupOnResize(n(r).outerHeight(),n(r).outerWidth());t._trigger("popupResize",{event:i})},resizeStop:function(n){i&&(t._refreshPopupOnResize(t.model.popupHeight,t.model.popupWidth),i&&t._trigger("popupResizeStop",{event:n}),i=!1)},helper:function(i){var r=n(i.element).parents("div.e-ddl-popup");return t._refreshPopupOnResize(n(r).outerHeight(),n(r).outerWidth()),n(t.popupListWrapper)}})},_refreshPopupOnResize:function(n,t){n&&(this.model.popupHeight=n);t&&(this.model.popupWidth=t);this.popupListWrapper.css({height:this._validatePixelData(this.model.popupHeight),"min-height":this._validatePixelData(this.model.minPopupHeight),"max-height":this._validatePixelData(this.model.maxPopupHeight)});this._setListWidth();this._refreshScroller()},_setListWidth:function(){var n=this.model.popupWidth;n!="auto"?this.popupListWrapper.css({width:n}):this.popupListWrapper.css({"min-width":this._validatePixelData(this.model.minPopupWidth)});this.popupListWrapper.css({"max-width":this._validatePixelData(this.model.maxPopupWidth)})},_setListHeight:function(){this.model.enablePopupResize&&this.model.enableFilterSearch&&this.model.minPopupHeight&&this.model.minPopupHeight.toString().indexOf("%")<0&&this._validatePixelData(this.model.minPopupHeight)==20&&(this.model.minPopupHeight="65");this.model.enablePopupResize?this.popupListWrapper.css({"min-height":this._validatePixelData(this.model.minPopupHeight),"max-height":this._validatePixelData(this.model.maxPopupHeight),height:this._validatePixelData(this.model.popupHeight)}):this.popupListWrapper.css({"max-height":this._validatePixelData(this.model.popupHeight),"min-height":this._validatePixelData(this.model.minPopupHeight)})},_validatePixelData:function(n){return n&&!isNaN(n)?Number(n):n},_getPopupHeight:function(){var n=this.popupListWrapper.height(),t;return this.model.enablePopupResize&&(n-=this.popupListWrapper.find(">div.e-resizebar").height()),this.model.headerTemplate&&this.headerTemplate&&(n-=this.headerTemplate.height()),this.model.enableFilterSearch&&this.inputSearch&&(t=this.inputSearch.parent(".e-in-wrap"),n-=parseInt(t.css("height"))+parseInt(t.css("margin-top"))+parseInt(t.css("margin-bottom"))),n},_refreshPopup:function(){this.model.popupWidth!="auto"||this._validatePixelData(this.model.minPopupWidth)?this._validatePixelData(this.model.minPopupWidth)&&this.popupListWrapper.css({"min-width":this._validatePixelData(this.model.minPopupWidth)}):this.popupListWrapper.css({"min-width":this.wrapper.width()});this.scrollerObj!=i&&this._refreshScroller();this._setListPosition()},_setListPosition:function(){var t=this.wrapper,i=this._getOffset(t),f,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),u=this.popupListWrapper.outerHeight(),e=this.popupListWrapper.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(u<h||u>c?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e<r+t.outerWidth())&&(r-=this.popupListWrapper.outerWidth()-t.outerWidth());this.popupListWrapper.css({left:r+"px",top:v+"px","z-index":a})},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popupListWrapper)},_showResult:function(){var i=this,r={text:this._visibleInput[0].value,value:this._selectedValue,refreshPopup:!0};this._trigger("beforePopupShown",r)||(r.refreshPopup&&this._refreshPopup(),n(this.popupListWrapper).slideDown(this.model.enableAnimation?200:1,function(){n(document).on("mousedown",n.proxy(i._OnDocumentClick,i));i._on(t.getScrollableParents(i.wrapper),"scroll",i._hideResult)}),this.element[0].setAttribute("aria-expanded",!0),this._listSize=this._getLi().length,this.wrapper.addClass("e-popactive"),this._trigger("popupShown",{text:this._visibleInput[0].value,value:this._selectedValue}),this.scrollerObj.setModel({scrollTop:this._calcScrollTop("active")}))},_OnWindowResize:function(){!t.isNullOrUndefined(this.model)&&this._isPopupShown()&&this._refreshPopup()},_hideResult:function(i){if(this.model&&this._isPopupShown()){if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.inputSearch)&&n(this.inputSearch).is(":focus")&&i.type=="scroll"&&t.isTouchDevice())return!1;var r=this;if(this._trigger("beforePopupHide",{text:this._visibleInput[0].value,value:this._selectedValue}))return;n(this.popupListWrapper).slideUp(this.model.enableAnimation?100:0,function(){n(document).off("mousedown",n.proxy(r._OnDocumentClick,r))});this.element!=null&&this.element.attr("aria-expanded",!1);this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._visibleInput!=null&&this.wrapper.removeClass("e-popactive");this._trigger("popupHide",{text:this._visibleInput[0].value,value:this._selectedValue});setTimeout(function(){r._resetSearch()},100);this._getLi().find(".e-ddl-anim").removeClass("e-ddl-anim")}},_isPopupShown:function(){return this.popupListWrapper.css("display")=="block"},_enterTextBoxValue:function(){var i,r=!0,t;if(this.removeID=!1,this.checkedStatus=!1,this._isWatermark||this._hiddenSpan.css("display","none"),this._chooseSelectionType(),(this._activeItem>=0||this._activeItem!=null)&&(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],n(t).removeClass("e-check-inact"),this.checkedStatus=this._isChecked(t)):this.checkedStatus=this.activeItem.hasClass("e-active")),i={text:this._currentText,selectedText:this._currentText,itemId:this.selectedIndexValue,value:this._selectedValue,isChecked:this.checkedStatus,isInteraction:!!this._uiInteract},!this._initValue&&!this._onSearch&&this._raiseEvents&&this._trigger("select",i)){this._setWatermark();return}(this._activeItem>=0||this._activeItem!=null)&&(this._isSingleSelect()||this._checkContains(this._selectedValue)?this._isSingleSelect()?(this.ultag.children("li").removeClass("e-hover").removeClass("e-active"),this.activeItem.addClass("e-active"),this._maintainHiddenValue(),this._visibleInput.val(this._currentText),this.element.val(this._hiddenValue),this.selectedItemIndex(this.selectedIndexValue),this.selectedIndex(this.selectedIndexValue),this._selectedIndices[0]=this.selectedIndexValue):r=!1:(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],this._isChecked(t)||(this._removeClass(t,"e-ddl-anim"),this._setClass(t,"e-check-act e-ddl-anim"),this._setAttr(t,{"aria-checked":!0}),n(t).find(".e-check-input")[0].checked=!0)):this.activeItem.addClass("e-active"),this.model.multiSelectMode=="visualmode"&&(this._ulBox.append(this._createBox(this._currentText,this._selectedValue)),this._isPopupShown()&&this._setListPosition()),this._maintainHiddenValue(),this._addText(this._currentText),this._createListHidden(this._hiddenValue),n.inArray(this.selectedIndexValue,this._selectedIndices)==-1&&(this._selectedIndices.push(this.selectedIndexValue),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices)),r&&(this.checkedStatus=!0,this._onValueChange(),this._cascadeAction(),this.selectelement&&n("#"+this._id).children().length>this.selectedIndexValue&&(n("#"+this._id).children()[this.selectedIndexValue].selected=!0)));this.model.uncheckAll=!1;this._setWatermark();this._uiInteract=!1},_onValueChange:function(){this.model.itemValue=this._selectedValue;this._updateText();this.value()==this.element.val()||this.value()==null&&this.element.val()==""||(this._updateSelectedIndexByValue(this.element.val()),this._updateValue(this.element.val()),this.model.showCheckbox||this.model.multiSelectMode!="none"||this.model.value!=null&&this.model.value!=""||(this.model.itemValue=""),args={text:this._visibleInput[0].value,selectedText:this._currentText,itemId:this.selectedIndexValue,selectedValue:this._selectedValue,value:this._selectedValue,isChecked:this.checkedStatus,isInteraction:!!this._uiInteract},this._initValue||this._onSearch||!this._raiseEvents||(this._trigger("change",args),this.model.showCheckbox&&this._trigger("checkChange",{isChecked:this.checkedStatus,text:this._visibleInput.val(),itemId:this.selectedIndexValue,selectedText:this._currentText,selectedValue:this._selectedValue,value:this._selectedValue,data:this.model})),this._uiInteract=!1)},_decode:function(t){return n("<span>").html(t).text()},_chooseSelectionType:function(){this.activeItem=this._getActiveItem();this.selectedIndexValue=this._activeItem;this._mapFields();this.model.dataSource==null||this._isPlainType(this.model.dataSource)?(this._currentText=this.activeItem.text(),this._getAttributeValue(this.activeItem[0])?this._selectedValue=this._getAttributeValue(this.activeItem[0]):this._currentText!=null?(this.activeItem[0].setAttribute("value",this._currentText),this._selectedValue=this._currentText):this._selectedValue="",this._itemID=n(this.activeItem).attr("id")):(this._currentText=this._decode(this._getField(this.popupListItems[this._activeItem],this.mapFld._text)),this._currentText=this._currentText===""||this._currentText==null?this.activeItem.text():this._currentText,this._selectedValue=this._getField(this.popupListItems[this._activeItem],this.mapFld._value),this._selectedValue=this._selectedValue!=null?this._selectedValue:this._currentText,this._itemID=this._getField(this.popupListItems[this._activeItem],this.mapFld._id));t.isNullOrUndefined(this._itemID)||this._itemID==""||(this.model.showCheckbox?this.removeID?this._removeSelectedItemsID():this._selectedItemsID.push(this._itemID):(this._selectedItemsID=[],this.removeID||this._selectedItemsID.push(this._itemID)));this.selectedTextValue=this._currentText},_maintainHiddenValue:function(){this._hiddenValue=this._getAttributeValue(this.activeItem[0])||this._currentText},_removeTextBoxValue:function(){var i,t;if(this._uiInteract=!0,this.removeID=!0,this.checkedStatus=!0,this._chooseSelectionType(),(this._activeItem>=0||this._activeItem!=null)&&(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],n(t).removeClass("e-ddl-anim").addClass("e-check-inact e-ddl-anim"),this.checkedStatus=this._isChecked(t)):this.checkedStatus=this.activeItem.hasClass("e-active")),i={text:this._currentText,selectedText:this._currentText,itemId:this.selectedIndexValue,value:this._selectedValue,isChecked:this.checkedStatus},!this._initValue&&!this._onSearch&&this._raiseEvents&&this._trigger("select",i)){this._setWatermark();return}this._maintainHiddenValue();this._removeText(this._hiddenValue);this._removeListHidden(this._hiddenValue);this.activeItem.removeClass("e-active");this._isSingleSelect()||(this.model.showCheckbox?(t=this.activeItem.find(".e-checkwrap")[0],this._isChecked(t)&&(this._removeClass(t,"e-check-act"),this._setAttr(t,{"aria-checked":!1}),n(t).find(".e-check-input")[0].checked=!0)):this.activeItem.removeClass("e-active"),n.inArray(this.selectedIndexValue,this._selectedIndices)>-1&&(this._selectedIndices.splice(n.inArray(this.selectedIndexValue,this._selectedIndices),1),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),this.model.multiSelectMode=="visualmode"&&(this._deleteBoxCheck(this._hiddenValue),this._isPopupShown()&&this._setListPosition()));this.checkedStatus=!1;this._onValueChange();this.model.cascadeTo==null||this._isSingleSelect()||this._initValue||this._cascadeAction();this.model.checkAll=!1;this._setWatermark()},_createBox:function(i,r){if(!this._checkContains(r)){this._ulBox.css("display")=="none"&&this._visibleInput.css("display")!="none"&&this._swapUlandInput(!0);var u=t.buildTag("span.e-icon e-close","",{},{unselectable:"on"}),f=t.buildTag("li.e-options").text(i).attr("data-value",r).append(u);return this._on(u,"click",function(t){if(!this.model.enabled)return!1;this._deleteBox(n(t.target).parent())}),f}},_deleteBoxCheck:function(t){for(var r=this._ulBox.children("li"),i=0;i<r.length;i++)n(r[i]).attr("data-value")==t&&n(r[i]).remove()},_deleteLastBox:function(){var t=this._ulBox.children("li:not(.e-search-box)"),n=t.last();n.hasClass("e-active")?this._deleteBox(n):(this._removeActive(),n.addClass("e-active"))},_deleteBox:function(t){for(var f,u,i,r=0;r<t.length;r++)for(f=n(t[r]).attr("data-value"),u=this._getLi(),i=0;i<u.length;i++)if(n(u[i]).attr("data-value")==f){this._activeItem=i;this._removeTextBoxValue();break}this._isFocused||this._isPopupShown()||this._setWatermark()},_swapUlandInput:function(n){n?(this._visibleInput.css("display","none"),this._ulBox.css("display","block"),this.wrapper.css({height:"auto"})):(this._visibleInput.css("display","block"),this._ulBox.css("display","none"),this.wrapper.css({height:this.model.height}))},_removeActive:function(){this._ulBox.children("li").removeClass("e-active")},_adjustWidth:function(){var n=t.buildTag("span",this._visibleInput.val());this.container.append(n);this._visibleInput.width(n.width()+30);n.remove()},_destroyBoxModel:function(){this._visibleInput.css("display","block");this.wrapper.height(this.model.height);this._ulBox.remove();this._ulBox=null;this._off(this.container,"click")},_removeListHover:function(){this.ultag.children("li").removeClass("e-hover")},_addListHover:function(){var n=this._getActiveItem();n.addClass("e-hover");this.scrollerObj.setModel({scrollTop:this._calcScrollTop("hover")});n.focus()},_getLi:function(){return this.ultag.children("li:not('.e-category'):not('.e-nosuggestion')")},_calcScrollTop:function(t){var s=this.ultag.outerHeight(),u=this.ultag.find("li"),o=0,i,f,r,e;for(this._selectedIndices&&this._selectedIndices.length>0&&t=="active"?(e=this._getLi(),i=this._selectedIndices.length==e.length?0:this._selectedIndices[this._selectedIndices.length-1],(this.model.fields.groupBy!=null||this.ultag.find("li.e-category").length>0)&&(i=n.inArray(e.eq(i)[0],u))):i=this.ultag.find("li.e-"+t).index(),r=0;r<i;r++)o+=u.eq(r).outerHeight(!0);return f=o-(this.popupList.outerHeight()-u.eq(i).outerHeight(!0))/2,f<0?0:f},_getActiveItem:function(){return this._getLi().eq(this._activeItem)},_setDimentions:function(){this.model.height&&this.wrapper.height(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_roundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popupListWrapper.addClass("e-corner"),this.inputSearch&&this.inputSearch.parent(".e-in-wrap").addClass("e-corner")):(this.container.removeClass("e-corner"),this.popupListWrapper.removeClass("e-corner"),this.inputSearch&&this.inputSearch.parent(".e-in-wrap").removeClass("e-corner"))},_enabled:function(n){n?this.enable():this.disable()},_destroyDropdown:function(){this.element.insertAfter(this.wrapper);this.element.width(this.element.width()+this.dropdownbutton.outerWidth());this.wrapper.remove();this.container.off("mousedown",n.proxy(this._OnDropdownClick,this))},_RightToLeft:function(){this.model.enableRTL?this.wrapper.addClass("e-rtl"):this.wrapper.removeClass("e-rtl")},_dropbtnRTL:function(){this.model.enableRTL?(this.popupListWrapper.addClass("e-rtl").find(".e-resize-handle").addClass("e-rtl-resize"),this.popupList.addClass("e-rtl")):(this.popupListWrapper.removeClass("e-rtl").find(".e-resize-handle").removeClass("e-rtl-resize"),this.popupList.removeClass("e-rtl"))},_OnDropdownClick:function(t){if((this._preventDefaultAction(t),n(t.target).is("li")&&n(t.target).parent().hasClass("e-boxes")||n(t.target).parents("ul").hasClass("e-boxes")&&n(t.target).hasClass("e-icon e-close"))||this.model.readOnly||this._readOnly)return!1;this.ultag.find("li").length>0&&(t.which&&t.which==1||t.button&&t.button==0)&&this._OnPopupHideShow()},_OnPopupHideShow:function(){if(this._isPopupShown())this._hideResult();else if(this._showResult(),this.model.enableFilterSearch){if(this.getSelectedItem().length==0)this.ultag.find("li:first").addClass("e-hover");else{var t=this.getSelectedItem().length;n(this.getSelectedItem()[t-1]).addClass("e-hover")}this.inputSearch.focus()}else this.wrapper.focus()},_showFullList:function(){var n=this.model.dataSource,i;t.DataManager&&n instanceof t.DataManager?n.dataSource.offline||n.dataSource.json&&n.dataSource.json.length>0?this._getFilteredList(n.dataSource.json):(i=this,i._initDataSource(n)):this._getFilteredList(n)},_getFilteredList:function(n){if(!n||!n.length||n.length<1)this._targetElementBinding(),this._renderRemaining();else{var i=t.DataManager(n).executeLocal(this._isPlainType(n)?t.Query():this._getQuery(!0));this._totalCount=i.count;this._listItem(i.result?i.result:i);this._renderPopupList();this._rawList=this.popupListItems.slice()}},_cascadeAction:function(){if(this.model.cascadeTo)for(var r=this.model.cascadeTo.split(","),i=0;i<r.length;i++)if(n("#"+r[i]).hasClass("e-dropdownlist"))this._doCascadeAction(r[i],this,this.checkedStatus);else n("#"+r[i]).on("ejDropDownListcreate",{Obj:this,status:this.checkedStatus},function(n){t.isNullOrUndefined(n.data.Obj.getValue())||n.data.Obj.getValue()==""||n.data.Obj._doCascadeAction(this.id,n.data.Obj,n.data.status)})},_doCascadeAction:function(i,r,u){r._currentValue=r._getField(r.popupListItems[r._activeItem],r.mapFld._value);r.selectDropObj=n("#"+i).ejDropDownList("instance");var f={cascadeModel:r.selectDropObj.model,cascadeValue:r._currentValue,setCascadeModel:{},requiresDefaultFilter:!0};this._trigger("cascade",f);r.selectDropObj._setCascadeModel=f.setCascadeModel;t.isNullOrUndefined(r[i])&&(r[i]=r.selectDropObj.model.dataSource);t.DataManager&&r[i]instanceof t.DataManager?r._cascadeOdataInit(r[i],f.requiresDefaultFilter,u,f.cascadeQuery):r._cascadeJsonInit(r.selectDropObj,r[i],r.mapFld._value,f.requiresDefaultFilter,u,f.cascadeQuery)},_cascadeOdataInit:function(n,t,i,r){var u=this,e,f;u._dQuery=this.selectDropObj._getQuery().clone();f=u._dQuery.clone();t?f.where(u.mapFld._value,"equal",u._currentValue):f=r;u.selectDropObj._addLoadingClass();u._trigger("actionBegin",{requestFrom:"cascade"})||(e=n.executeQuery(f),e.fail(function(n){u._changedSource=null;u.selectDropObj.setModel({dataSource:u._changedSource,enabled:!1});u._trigger("actionFailure",{e:n,requestFrom:"cascade"})}).done(function(n){u._trigger("actionSuccess",{e:n,requestFrom:"cascade"});u._cascadeDataBind(u.selectDropObj,n.result,i);u.selectDropObj._removeLoadingClass()}).always(function(n){u._trigger("actionComplete",{e:n,requestFrom:"cascade"})}))},_cascadeJsonInit:function(n,i,r,u,f,e){var o=u?t.Query().where(r,"==",this._currentValue):e,s=t.DataManager(i).executeLocal(o);this._cascadeDataBind(n,s,f)},_cascadeDataBind:function(i,r,u){var c=i.value(),f,e,h,s,o;if(this.model.showCheckbox&&u||this.model.multiSelectMode!="none"&&this.activeItem.hasClass("e-active"))this._changedSource=t.isNullOrUndefined(this._changedSource)?r:this._changedSource.concat(r);else if(this.model.showCheckbox||this.model.multiSelectMode!="none"){for(f=0;f<r.length;f++)if(this._isPlainType(r)&&this._isPlainType(this._changedSource))this._changedSource.splice(this._changedSource.indexOf(r[f]),1);else for(e=0;e<this._changedSource.length;e++)JSON.stringify(this._changedSource[e])==JSON.stringify(r[f])&&this._changedSource.splice(e,1);i.setModel({dataSource:null})}else this._changedSource=r;if(h=JSON.parse(JSON.stringify(i.model)),i.setModel({dataSource:this._changedSource,enabled:this._changedSource.length>0}),this._isSingleSelect()||i.selectItemByValue(c),(i.model.showCheckbox||i.model.multiSelectMode!="none")&&n("input:hidden[id^='#'][name="+i._id+"]").remove(),i._setSelectedItem)i.setModel(i._setCascadeModel);else{for(s=["value","text","selectedIndex","selectedIndices"],o=0;o<s.length;o++)i.model[s[o]]=h[s[o]];i._finalize()}i._setSelectedItem=!0},_OnMouseEnter:function(t){var i,r;if(!this.model.enabled||this.model.readOnly||this._readOnly)return!1;this.ultag.children("li").removeClass("e-hover");n(t.target).is("li:not('.e-category')")&&n(t.target).addClass("e-hover");n(t.target).hasClass("e-disable")?n(t.target).removeClass("e-hover"):t.target.tagName!="li"&&(i=n(t.target).parents("li:not('.e-category')"),n(i).addClass("e-hover"));this.ultag.children("li:not('.e-category')").each(function(t){if(n(this).hasClass("e-hover"))return r=t,!1});this._activeItem=r},_OnMouseLeave:function(){if(!this.model.enabled||this.model.readOnly||this._readOnly)return!1;this.ultag.children("li").removeClass("e-hover")},_OnMouseClick:function(t){var r,u,i;if((this._uiInteract=!0,!this.model.enabled||this.model.readOnly||this._readOnly)||this.model.enableFilterSearch&&n(t.target).is("li")&&n(t.target).hasClass("e-nosuggestion"))return!1;(!n(t.target).is("li")||n(t.target).hasClass("e-disable"))&&(n(t.target).is("li")||n(t.target).closest("li").hasClass("e-disable"))||(this._isSingleSelect()?(this._enterTextBoxValue(),this._hideResult()):this.model.showCheckbox?(r=t.target.nodeName==="LI"?t.target:n(t.target).parents("li.e-hover"),u=n(r).find(".e-checkwrap")[0],this._onCheckChange({target:u})):(i=n(t.target).is("li")?t.target:n(t.target).closest("li")[0],this._activeItem=n.inArray(i,this._getLi()),n(i).hasClass("e-active")?this._removeTextBoxValue():this._enterTextBoxValue()))},_OnDocumentClick:function(t){if(this.model&&(!this.model.enabled||this.model.readOnly||this._readOnly))return!1;n(t.target).is(this.popupList)||n(t.target).parents(".e-ddl-popup").is(this.popupListWrapper)||n(t.target).is(this._visibleInput)||n(t.target).parents(".e-ddl").is(this.wrapper)?n(t.target).is(this.inputSearch)?this.inputSearch.focus():(n(t.target).is(this.popupList)||n(t.target).parents(".e-ddl-popup").is(this.popupListWrapper))&&this._preventDefaultAction(t):this._hideResult()},_OnKeyPress:function(n){this.model.enableIncrementalSearch&&n.keyCode!=13&&this._OnTextEnter(t.browserInfo().name=="mozilla"?n.charCode:n.keyCode);n.keyCode==32&&this._preventDefaultAction(n)},_OnTextEnter:function(t){var s=this;this._incqueryString+=String.fromCharCode(t);this._incqueryString.length>0&&setTimeout(function(){s._incqueryString=""},1e3);var f=this._getLi(),i,e=this.model.caseSensitiveSearch,r,u=this._incqueryString,h=this._incqueryString.length,o=!1;for(e||(u=u.toLowerCase()),i=0;i<f.length;i++)if(r=n(f[i]).text(),r=e?r:r.toLowerCase(),r.substr(0,h)==u&&(this._activeItem=i,this._isSingleSelect()?(this._enterTextBoxValue(),this.scrollerObj.setModel({scrollTop:this._calcScrollTop("active")})):this._isPopupShown()&&(this._removeListHover(),this._addListHover()),o=!0),o)break},_selectItem:function(n){this._isSingle||this._clearTextboxValue();this._activeItem=n;this._addListHover();this._enterTextBoxValue()},_focusItem:function(n){this._removeListHover();this._activeItem=n;this._addListHover()},_selectFocusedItem:function(n){this._focusItem(n);this._enterTextBoxValue()},_selectShiftDown:function(t,i,r){r||this._clearTextboxValue();for(var u=t;u<=i;u++)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&this._selectFocusedItem(u)},_selectShiftUp:function(t,i,r){r||this._clearTextboxValue();for(var u=i;u>=t;u--)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&this._selectFocusedItem(u)},_selectShiftHome:function(t,i,r){if(r||this._clearTextboxValue(),t>=0&&t<=this._listSize-1){if(t==0)this._clearTextboxValue();else for(var u=t;u>=i;u--)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&(this._activeItem=u,this._enterTextBoxValue());this._activeItem=t;t==0&&this._enterTextBoxValue();this.scrollerObj.setModel({scrollTop:0})}},_selectShiftEnd:function(t,i,r){if(r||this._clearTextboxValue(),t<=this._listSize-1){if(t==i)this._clearTextboxValue();else for(var u=t;u<=i;u++)n.inArray(u,this._disabledItems)<0&&n.inArray(u,this.model.selectedIndices)<0&&(this._activeItem=u,this._enterTextBoxValue());this._activeItem=t;t==i&&this._enterTextBoxValue();this.scrollerObj.setModel({scrollTop:this.ultag.outerHeight()})}},_getLastFocusedLi:function(){return this._selectedIndices&&this._selectedIndices.length>0?this._selectedIndices[this._selectedIndices.length-1]:null},_getLastShiftFocusedLi:function(t,i){var r=i?t-1:t+1;return n.inArray(r,this._selectedIndices)<0?t:this._getLastShiftFocusedLi(r,i)},_shiftUp:function(n,t,i){var u,r,f;if(n==null||n<0)this._checkDisableStep(0,t,!1,!1,!0);else if(n>0&&n<=this._listSize-1&&(u=this._disableItemSelectUp(n-t),u!=null))if(this._getLastFocusedLi()!=null)if(this._selectedIndices.length>1&&n-1==this._selectedIndices[this._selectedIndices.length-2])for(r=1;r<=t;r++)if(n-r==this._selectedIndices[this._selectedIndices.length-2])this._activeItem=n+1-r,this._removeTextBoxValue(),this._focusItem(n-r);else break;else f=this._getLastShiftFocusedLi(this._getLastFocusedLi(),!1),this._selectShiftUp(u,f,i);else this._moveUp(n,t,!1)},_shiftDown:function(n,t,i){var u,r,f;if(n==null||n<0)this._checkDisableStep(-1,t,!0,!1,!0);else if(n<this._listSize-1&&(u=this._disableItemSelectDown(n+t),u!=null))if(this._getLastFocusedLi()!=null)if(this._selectedIndices.length>1&&n+1==this._selectedIndices[this._selectedIndices.length-2])for(r=1;r<=t;r++)if(n+r==this._selectedIndices[this._selectedIndices.length-2])this._activeItem=n-1+r,this._removeTextBoxValue(),this._focusItem(n+r);else break;else f=this._getLastShiftFocusedLi(this._getLastFocusedLi(),!0),this._selectShiftDown(f,u,i);else this._moveDown(n,t,!1)},_moveUp:function(n,t,i){n==null||n<=0?this._checkDisableStep(0,t,!1,i):n>this._listSize-1?this._checkDisableStep(this._listSize-1,t,!1,i):n>0&&n<=this._listSize-1&&this._checkDisableStep(n,t,!1,i)},_moveDown:function(n,t,i){n==null||n<0?this._checkDisableStep(-1,t,!0,i):n==0?this._checkDisableStep(0,t,!0,i):n>=this._listSize-1?this._checkDisableStep(this._listSize-1,t,!0,i):n<this._listSize-1&&this._checkDisableStep(n,t,!0,i)},_checkDisableStep:function(n,t,i,r,u){var s=i?"_disableItemSelectDown":"_disableItemSelectUp",o=i?n+t:n-t,f=this[s](o),e;if(f==null)for(e=t;e>=0;e--)if(o=i?n+e:n-e,f=this[s](o),f!=null)break;f!=null&&(r?this._focusItem(f):this._selectItem(f),u&&r&&this._enterTextBoxValue())},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t<this._listSize?n.inArray(t,this._disabledItems)<0?t:this._disableItemSelectDown(t+1):this._listSize-1},_disableItemSelectUp:function(t){if((t==null||t<0)&&(t=0),t<this._listSize){if(n.inArray(t,this._disabledItems)<0)return t;if(t>0)return this._disableItemSelectUp(t-1)}},_preventDefaultAction:function(n,t){n.preventDefault?n.preventDefault():n.returnValue=!1;t&&(n.stopPropagation?n.stopPropagation():n.cancelBubble=!0)},_OnKeyDown:function(n){var f,r,u,i,t;if(this._uiInteract=!0,this.model.enabled)if(this._itemId=null,f=this._getLi(),this._listSize=f.length,u=this.popupList.height(),r=this.ultag.children("li").outerHeight(),i=Math.round(u/r)!=0?Math.round(u/r):5,this._isSingle=this._isSingleSelect(),this._isSingle)switch(n.keyCode){case 38:if(n.altKey){this.ultag.find("li").length>0&&this._hideResult();break}case 33:t=n.keyCode==33?i:1;this._moveUp(this._activeItem,t);this._preventDefaultAction(n,!0);break;case 8:this._preventDefaultAction(n);break;case 40:if(n.altKey){this.ultag.find("li").length>0&&this._showResult();break}case 34:t=n.keyCode==34?i:1;this._moveDown(this._activeItem,t);this._preventDefaultAction(n,!0);break;case 37:this.model.enableRTL?this._moveDown(this._activeItem,1):this._moveUp(this._activeItem,1);this._preventDefaultAction(n);break;case 39:this.model.enableRTL?this._moveUp(this._activeItem,1):this._moveDown(this._activeItem,1);this._preventDefaultAction(n);break;case 9:case 27:this._isPopupShown()&&this._hideResult();break;case 35:this._moveDown(this._listSize-1,0);this._preventDefaultAction(n);break;case 36:t=this._activeItem!=null?this._activeItem:this._listSize-1;this._moveUp(t,t);this._preventDefaultAction(n)}else switch(n.keyCode){case 38:n.altKey?this.ultag.find("li").length>0&&this._hideResult():n.shiftKey?this._shiftUp(this._activeItem,1,n.ctrlKey):this._moveUp(this._activeItem,1,n.ctrlKey);this._preventDefaultAction(n);break;case 33:n.shiftKey?this._shiftUp(this._activeItem,i,n.ctrlKey):this._moveUp(this._activeItem,i,n.ctrlKey);this._preventDefaultAction(n);break;case 8:this._preventDefaultAction(n);break;case 40:n.altKey?this.ultag.find("li").length>0&&this._showResult():n.shiftKey?this._shiftDown(this._activeItem,1,n.ctrlKey):this._moveDown(this._activeItem,1,n.ctrlKey);this._preventDefaultAction(n);break;case 34:n.shiftKey?this._shiftDown(this._activeItem,i,n.ctrlKey):this._moveDown(this._activeItem,i,n.ctrlKey);this._preventDefaultAction(n);break;case 37:this.model.enableRTL?this._moveDown(this._activeItem,1,!1):this._moveUp(this._activeItem,1,!1);this._preventDefaultAction(n);break;case 39:this.model.enableRTL?this._moveUp(this._activeItem,1,!1):this._moveDown(this._activeItem,1,!1);this._preventDefaultAction(n);break;case 9:case 27:this._isPopupShown()&&this._hideResult();break;case 35:n.shiftKey?this._selectShiftEnd(this._activeItem,this._listSize-1,n.ctrlKey):this._moveDown(this._activeItem,this._listSize,n.ctrlKey);this._preventDefaultAction(n);break;case 36:t=this._activeItem!=null?this._activeItem:this._listSize-1;n.shiftKey?this._selectShiftHome(this._activeItem,0,n.ctrlKey):this._moveUp(this._activeItem,t,n.ctrlKey);this._preventDefaultAction(n)}},_OnKeyUp:function(i){var u,r;if(this.model.enabled){if(this._preventDefaultAction(i),u=i.target,this._activeItem==null&&(this._activeItem=this._getLi().index(this.popupList.find("ol,ul").children("li.e-hover"))),this._trim(this._visibleInput.val())==""&&i.keyCode==38&&i.keyCode==40)return this._hideResult(),!1;switch(i.keyCode){case 13:!this._isSingle&&this._isPopupShown()&&(i.ctrlKey||i.shiftKey)&&this._activeItem>=0?this._selectAndUnselect():!this._isPopupShown()||i.ctrlKey||i.shiftKey?this._isPopupShown()&&this._hideResult():(t.isNullOrUndefined(this.inputSearch)||(this.getSelectedItem().length==0?(this.selectItemByIndex(0),n(this.listitems[0]).removeClass("e-hover")):(r=this._getLastFocusedLi(),(this.model.multiSelectMode!="none"||this.model.showCheckbox)&&(this.unselectItemByIndex(r),n(this.listitems[r]).removeClass("e-hover")))),this._hideResult());this._preventDefaultAction(i);break;case 32:this._isPopupShown()&&this._isSingle&&this._hideResult();!this._isSingle&&this._isPopupShown()&&this._activeItem>=0&&this._selectAndUnselect();this._preventDefaultAction(i);break;case 8:this.model.multiSelectMode=="visualmode"&&this._deleteLastBox();this._preventDefaultAction(i);break;case 46:if(this.model.multiSelectMode=="visualmode"||this.model.showCheckbox){this._deleteBox(this._ulBox.children("li.e-active"));break}}}},_isSingleSelect:function(){return!this.model.showCheckbox&&this.model.multiSelectMode=="none"},_selectAndUnselect:function(){this.model.showCheckbox?this._isChecked(this._getActiveItem().find(".e-checkwrap")[0])?this._removeTextBoxValue():this._enterTextBoxValue():this.model.MultiSelectMode!="none"&&(this._getActiveItem().hasClass("e-active")?this._removeTextBoxValue():this._enterTextBoxValue())},_targetFocus:function(){this.model.enabled&&!this._isFocused&&(this._isWatermark||this._hiddenSpan.css("display","none"),this.wrapper.addClass("e-focus e-popactive"),this._isFocused=!0,this._trigger("focusIn"))},_targetBlur:function(){this.model.enabled&&(this._isFocused=!1,this.wrapper.removeClass("e-focus e-popactive"),this._setWatermark(),this._trigger("focusOut"))},_getLocalizedLabels:function(n){return this._localizedLabels[n]===i?t.DropDownList.Locale["en-US"][n]:this._localizedLabels[n]},_wireEvents:function(){this._on(this.wrapper,"focus",this._targetFocus);this._on(this.wrapper,"blur",this._targetBlur);this._on(this.wrapper,"keydown",this._OnKeyDown);this._on(this.popupList,"keydown",this._OnKeyDown);this._on(this.popupList,"keyup",this._OnKeyUp);this._on(this.wrapper,"keyup",this._OnKeyUp);this._on(this.popupList,"keypress",this._OnKeyPress);this._on(this.wrapper,"keypress",this._OnKeyPress)},_unwireEvents:function(){this._off(this.wrapper,"focus",this._targetFocus);this._off(this.wrapper,"blur",this._targetBlur);this._off(this.wrapper,"keydown",this._OnKeyDown);this._off(this.popupList,"keydown",this._OnKeyDown);this._off(this.popupList,"keyup",this._OnKeyUp);this._off(this.wrapper,"keyup",this._OnKeyUp);this._off(this.popupList,"keypress",this._OnKeyPress);this._off(this.wrapper,"keypress",this._OnKeyPress);n(window).off("resize",n.proxy(this._OnWindowResize,this))},_multiItemSelection:function(n,t){var i,r;for(this._ulBox||this.model.multiSelectMode!="visualmode"||this._renderBoxModel(),i=0;i<n.length;i++)r=t?this._rawList.length-(n.length-i):i,this._hasClass(n[i],"chkselect")&&(this._activeItem=r,this._enterTextBoxValue(),this._removeClass(n[i],"chkselect"));this._setWatermark()},_appendCheckbox:function(n,t){var i;for(this._ulBox||this.model.multiSelectMode!="visualmode"||this._renderBoxModel(),i=0;i<n.length;i++){var r=t?this._rawList.length-(n.length-i):i,f=document.createElement("input"),u=document.createElement("span");this._setAttr(f,{type:"checkbox",name:"list"+r,"data-role":"none",id:this._id+"_check"+r})._setClass(f,"e-check-input")._setAttr(u,{name:"list"+r+"_wrap","data-role":"none",id:this._id+"_check"+r+"wrap",unselectable:"on"})._setClass(u,"e-checkwrap e-icon ");u.appendChild(f);n[i].insertBefore(u,n[i].childNodes[0]);this._hasClass(n[i],"chkselect")&&(this._activeItem=r,this._enterTextBoxValue(),this._removeClass(n[i],"chkselect"))}this._setWatermark()},_onCheckChange:function(t){var i=t.target.nodeName==="INPUT"?t.target.parentElement:t.target;this._activeItem=n.inArray(n(i).parents("li")[0],this._getLi());this._hasClass(i,"e-check-act")?this._removeTextBoxValue():this._enterTextBoxValue()},_isChecked:function(t){return this._hasClass(t,"e-check-act")&&n(t).children(".e-check-input")[0].checked==!0},_removeCheck:function(){this._getLi().find(".e-checkwrap").remove()},_resetCheck:function(){var i=this._getLi(),t,n;for(i.find(".e-check-act").removeClass("e-check-act").attr("aria-checked",!1),t=i.find(".e-check-input:checked"),n=0;n<t.length;n++)t[n].checked=!1}});t.DropDownList.Locale=t.DropDownList.Locale||{};t.DropDownList.Locale["default"]=t.DropDownList.Locale["en-US"]={emptyResultText:"No suggestions",watermarkText:""};t.MultiSelectMode={None:"none",Delimiter:"delimiter",VisualMode:"visualmode"};t.VirtualScrollMode={Normal:"normal",Continuous:"continuous"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};ejTooltip=function(n){function t(t,i){return n.call(this),this._rootCSS="e-tooltip",this._setFirst=!1,this.PluginName="ejTooltip",this.id="null",this.model=null,this.defaults={height:"auto",width:"auto",enabled:!0,content:null,containment:"body",target:null,title:null,closeMode:"none",autoCloseTimeout:4e3,position:{stem:{horizontal:"center",vertical:"bottom"},target:{horizontal:"center",vertical:"top"}},associate:"target",collision:"flipfit",showShadow:!1,cssClass:null,animation:{effect:"none",speed:0},isBalloon:!0,showRoundedCorner:!1,enableRTL:!1,allowKeyboardNavigation:!0,tip:{size:{width:20,height:10},adjust:{xValue:0,yValue:0}},trigger:"hover",create:null,click:null,destroy:null,hover:null,tracking:null,beforeOpen:null,beforeClose:null,open:null,close:null},this.dataTypes={enabled:"boolean",closeMode:"enum",autoCloseTimeout:"number",trigger:"enum",position:{stem:"data",target:"data"},associate:"enum",collision:"enum",showShadow:"boolean",animation:{effect:"enum",speed:"number"},isBalloon:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",allowKeyboardNavigation:"boolean",tip:{size:{width:"number",height:"number"},adjust:{xValue:"number",yValue:"number"}}},this.isTrack=!0,this._isCancel=!1,this._isHidden=!0,this.arrowValue={left:0,top:0,width:0,height:0,display:null},this.tooltipPos={width:0,height:0,left:0,top:0,bottom:0,right:0,position:"absolute"},this.targetPos={width:0,height:0,left:0,top:0,bottom:0,right:0,position:"absolute"},this.mouseTimer=null,this.positionTarget=null,this.positionTooltip=null,this.containerSize=null,this._createTitle=function(){this.tooltipTitle=ej.buildTag("div.e-def e-header"," ",{},{});this.tooltipHeader=ej.buildTag("div"," ",{},{});$(this.tooltipTitle).html(this.model.title).appendTo(this.tooltipHeader)},t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejTooltip(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype.triggerEvents=function(n,t){var i,r,u,f,e,o,s;switch(n){case"click":r=t;i=this._trigger(n,r);break;case"hover":u=t;i=this._trigger(n,u);break;case"tracking":f=t;i=this._trigger(n,f);break;case"beforeOpen":e=t;i=this._trigger(n,e);break;case"open":o=t;i=this._trigger(n,o);break;case"beforeClose":case"close":s=t;i=this._trigger(n,s)}return i},t.prototype.enable=function(){this.tooltip.hasClass("e-disable")&&(this.model.enabled=!0,this.tooltip.removeClass("e-disable"))},t.prototype.disable=function(){this.tooltip.hasClass("e-disable")||(this.model.enabled=!1,this.tooltip.addClass("e-disable"))},t.prototype.show=function(n,t){if(this.model.enabled){if(ej.isNullOrUndefined(n)){var i=this.model.target==null?this.element:$(this.element).find(this.model.target+":first");this._positionElement(i)}else this._positionElement(n);ej.isNullOrUndefined(t)?this._showTooltip():typeof t=="string"?$(this.tooltip).show(t):typeof t=="function"&&t.call.apply(this.tooltip)}},t.prototype.hide=function(n){this.model.enabled&&(ej.isNullOrUndefined(n)?this._hideTooltip():typeof n=="string"?$(this.tooltip).hide(n):typeof n=="function"&&n.call.apply(this.tooltip))},t.prototype._destroy=function(){$(this.tooltip).remove();this.tooltip=null},t.prototype._setModel=function(n){var t,i;for(t in n)switch(t){case"height":this._setHeight(n[t]);break;case"width":this._setWidth(n[t]);break;case"enabled":this._enabled(n[t]);break;case"content":this._setContent(n[t]);break;case"title":this.model.title=n[t];this.model.title==null?($(this.tooltipHeader).remove(),this.tooltipHeader=null,this.tooltipTitle=null,this.model.closeMode===ej.Tooltip.CloseMode.Sticky&&this._iconRender()):ej.isNullOrUndefined(this.tooltipHeader)?this._createHeader():$(this.tooltipTitle).html(this.model.title);this.tooltipPos.height=$(this.tooltip).outerHeight();break;case"associate":this.model.associate=n[t];this._wireMouseEvents(!1);this._wireMouseEvents(!0);break;case"position":this._setPosition(n[t]);break;case"collision":this.model.collision=n[t];break;case"closeMode":typeof n[t]!="undefined"&&(this.model.closeMode=n[t],this.model.closeMode==ej.Tooltip.CloseMode.Sticky?this._iconRender():($(this.tooltipClose).remove(),this.tooltipClose=null),this.tooltipPos.height=$(this.tooltip).outerHeight());break;case"cssClass":this._setSkin(n[t]);break;case"showShadow":this._shadowEffect(n[t],this.model.position);break;case"isBalloon":ej.isNullOrUndefined(n[t])||(this.model.isBalloon=n[t],this.model.isBalloon?this._renderArrow():($(this.tip).remove(),this.tip=null));break;case"animation":i=n[t];this.model.animation=$.extend(!0,this.model.animation,i);this.model.animation.effect!=ej.Tooltip.Effect.None?(this._off($(this.tooltip),"mouseenter",this._onTooltipMouseEnter),this._off($(this.tooltip),"mouseleave",this._onTooltipMouseLeave)):this.model.animation.effect==ej.Tooltip.Effect.None&&(this._on($(this.tooltip),"mouseenter",this._onTooltipMouseEnter),this._on($(this.tooltip),"mouseleave",this._onTooltipMouseLeave));break;case"enableRTL":this._setRTL(n[t]);break;case"target":this._wireTriggerEvents(!1);this.model.target=n[t];this._wireTriggerEvents(!0);this._renderTarget();break;case"trigger":this._setTrigger(n[t]);break;case"showRoundedCorner":this.model.showRoundedCorner=n[t];this._roundedCorner(n[t]);break;case"allowKeyboardNavigation":this.model.allowKeyboardNavigation=n[t];this.model.allowKeyboardNavigation?this._on($(window),"keydown",this._keyDown):this._off($(window),"keydown",this._keyDown)}},t.prototype._enabled=function(n){n?this.enable(n):this.disable(n);this.model.enabled=n},t.prototype._shadowEffect=function(n,t){this.model.showShadow=n;var i=null;if($(this.tooltip).removeClass("e-tooltipShadowLeft e-tooltipShadowRight"),this.model.showShadow){if(this.model.isBalloon)switch(t.stem.horizontal){case"center":i=t.stem.vertical=="top"?"e-tooltipShadowLeft":t.stem.vertical=="bottom"?"e-tooltipShadowRight":"e-tooltipShadowLeft";break;case"right":i=t.target.horizontal=="center"&&t.stem.vertical=="top"?"e-tooltipShadowLeft":"e-tooltipShadowRight";break;case"left":i=t.target.horizontal=="center"&&t.stem.vertical=="bottom"?"e-tooltipShadowRight":"e-tooltipShadowLeft"}else i="e-tooltipShadowLeft";$(this.tooltip).addClass(i)}},t.prototype._setContent=function(n){this.model.content=n;$(this.tooltipContent).html(this.model.content);this.tooltipPos.height=$(this.tooltip).outerHeight();this.tooltipPos.width=$(this.tooltip).outerWidth()},t.prototype._setPosition=function(n){this.model.position.stem=$.extend(!0,this.model.position.stem,n.stem);this.model.position.target=$.extend(!0,this.model.position.target,n.target)},t.prototype._setTrigger=function(n){this._wireTriggerEvents(!1);this.model.trigger=n;this._wireTriggerEvents(!0)},t.prototype._init=function(){this.id=this.element[0].id;this.positionTarget=$.extend(!0,{},this.model.position.target);this.positionTooltip=$.extend(!0,{},this.model.position.stem);this.tipSize=$.extend(!0,{},this.model.tip.size);this._initialize();this._render();this.enable(this.model.enabled);this._wireEvents(!0)},t.prototype._initialize=function(){ej.isNullOrUndefined(this.model.target)?ej.isNullOrUndefined(this.model.content)&&!ej.isNullOrUndefined(this.element.attr("title"))&&(this.model.content=this.element.attr("title"),this.element.attr("data-content",this.model.content),this.element.removeAttr("title")):this._renderTarget()},t.prototype._wireEvents=function(n){var t=n?"_on":"_off";this._wireTriggerEvents(n);this.model.allowKeyboardNavigation&&this[t]($(window),"keydown",this._keyDown);this.model.target!=null?this[t](this.element,"scroll",this.model.target,this._hideTooltip):this[t](this.element,"scroll",this._hideTooltip);this[t]($(this.tooltip),"mouseenter",this._onTooltipMouseEnter);this[t]($(this.tooltip),"mouseleave",this._onTooltipMouseLeave);this[t]($(window),"resize",this._hideTooltip);this[t]($(window),"touchend",this._docTouchEndHandler)},t.prototype._wireTriggerEvents=function(n){var t=n?"_on":"_off",i;this._wireMouseEvents(n);i=this.model.trigger==ej.Tooltip.Trigger.Click?"click touchstart":this.model.trigger==ej.Tooltip.Trigger.Focus?"focus touchstart":"mouseenter touchstart";this.model.target!=null?this[t](this.element,i,this.model.target,this._targetHover):this[t](this.element,i,this._targetHover);this.model.trigger==ej.Tooltip.Trigger.Focus?this.model.target!=null?this[t](this.element,"blur",this.model.target,this._hideTooltip):this[t](this.element,"blur",this._hideTooltip):this.model.target!=null?this[t](this.element,"mouseleave",this.model.target,this._onMouseOut):this[t](this.element,"mouseleave",this._onMouseOut)},t.prototype._wireMouseEvents=function(n){var t=n?"_on":"_off";(this.model.associate==ej.Tooltip.Associate.MouseEnter||this.model.associate==ej.Tooltip.Associate.MouseFollow)&&(this.model.target!=null?this[t](this.element,"mousemove touchstart",this.model.target,this._tooltipMove):this[t](this.element,"mousemove touchstart",this._tooltipMove))},t.prototype._render=function(){this.tooltip=ej.buildTag("div.e-tooltip-wrap e-widget","",{},{role:"tooltip","aria-readonly":"true","aria-hidden":"true","aria-describedby":this.id+"_content",id:this.id+"_Main"});this.tooltipInter=ej.buildTag("div.e-tipContainer","",{},{});this.tooltip.append(this.tooltipInter);this.model.isBalloon&&this._renderArrow();$(this.model.containment).append(this.tooltip);this._setHeight(this.model.height);this._setWidth(this.model.width);this._createHeader();this._tooltipContent();this.model.cssClass&&this.tooltip.addClass(this.model.cssClass);this.model.showRoundedCorner&&this._roundedCorner(this.model.showRoundedCorner);this.model.enableRTL&&this._setRTL(this.model.enableRTL);$(this.tooltip).css({top:"auto",left:"auto"});this.tooltipPos={width:$(this.tooltip).outerWidth(),height:$(this.tooltip).outerHeight(),left:$(this.tooltip).offset().left,top:$(this.tooltip).offset().top,position:"absolute"};ej.isNullOrUndefined(this.model.target)&&(this._containerCalc(this.element),this._positionElement(this.element))},t.prototype._containerCalc=function(n){ej.isNullOrUndefined(n)&&(n=this.element);var t=$(n).offset();this.containerSize={height:this.model.containment=="body"?$(window).innerHeight()||document.documentElement.clientHeight||document.body.clientHeight:$(this.model.containment).innerHeight(),width:this.model.containment=="body"?$(window).innerWidth()||document.documentElement.clientWidth||document.body.clientWidth:$(this.model.containment).innerWidth()};this.containerSize.left=this.model.containment!="body"?$(this.model.containment).css("position")=="static"?$(this.model.containment).offset().left-$(this.model.containment).offsetParent().offset().left:0:0;this.containerSize.top=this.model.containment!="body"?$(this.model.containment).css("position")=="static"?$(this.model.containment).offset().top-$(this.model.containment).offsetParent().offset().top:0:0;t.left-=this.model.containment!="body"?$(this.model.containment).css("position")=="static"?$(this.model.containment).offsetParent().offset().left:$(this.model.containment).offset().left:0;t.top-=this.model.containment!="body"?$(this.model.containment).css("position")=="static"?$(this.model.containment).offsetParent().offset().top:$(this.model.containment).offset().top:0;this.targetPos.left=t.left;this.targetPos.top=t.top},t.prototype._setHeight=function(n){this.model.height=n;!isNaN(+n)&&isFinite(n)?$(this.tooltip).css("height",n+"px"):$(this.tooltip).css("height",n);this.tooltipPos.height=$(this.tooltip).outerHeight()},t.prototype._setWidth=function(n){this.model.width=n;this.model.width!="auto"&&(n=!isNaN(+n)&&isFinite(n)?n+"px":n,$(this.tooltip).css("max-width",n),$(this.tooltip).css("min-width","0px"));$(this.tooltip).css("width",n);this.tooltipPos.height=$(this.tooltip).outerHeight()},t.prototype._setRTL=function(n){this.model.enableRTL=n;n?this.tooltip.addClass("e-rtl"):this.tooltip.removeClass("e-rtl")},t.prototype._setSkin=function(n){this.model.cssClass!=n&&(this.tooltip.removeClass(this.model.cssClass).addClass(n),this.model.cssClass=n)},t.prototype._roundedCorner=function(){this.model.showRoundedCorner?this.tooltip.addClass("e-corner"):this.tooltip.removeClass("e-corner")},t.prototype._renderArrow=function(){ej.isNullOrUndefined(this.tip)&&(this.tip=ej.buildTag("div.e-arrowTip"," ",{id:this.id+"_eTip"},{}),$(this.tip).append("<div class='e-arrowTipOuter'><\/div>").append("<div class='e-arrowTipInner'><\/div>"),$(this.tip).insertBefore(this.tooltipInter))},t.prototype._adjustArrow=function(n){var r,u,f=$(this.tooltip).width(),i=$(this.tooltip).height(),t=n.stem,o=n.target,e={tipHeight:0,tipWidth:0};o.horizontal=="right"||o.horizontal=="left"?(r=t.horizontal=="left"?-this.model.tip.size.height:t.horizontal=="right"?f:f/2-this.tipSize.width/2,u=t.horizontal!="center"?t.vertical=="top"?5:t.vertical=="center"?i/2-this.tipSize.width/2:i-5-this.tipSize.width:t.vertical=="top"?-this.tipSize.height:t.vertical=="bottom"?i:this.tooltipPos.height/2-this.tipSize.width/2,e=this._arrowBinding(n,"horizontal")):(u=t.vertical=="top"?-this.tipSize.height:t.vertical=="bottom"?i:i/2-this.tipSize.width/2,r=t.vertical=="center"?t.horizontal=="left"?-this.model.tip.size.height:f:t.horizontal=="left"?10:t.horizontal=="center"?this.tooltipPos.width/2-this.tipSize.width/2:f-10-this.tipSize.width,e=this._arrowBinding(n,"vertical"));this.arrowValue.left=r;this.arrowValue.top=u;$(this.tip).css({height:e.tipHeight+"px",width:e.tipWidth+"px",left:r+"px",top:u+"px",display:t.horizontal=="center"&&t.vertical=="center"?"none":"block"})},t.prototype._arrowBinding=function(n,t){var f=n.stem,c=t=="horizontal"?f.horizontal!="center":f.vertical=="center",r,u,e=$(this.tooltip).css("border-top-color"),o=$(this.tooltip).css("background-color"),s=this.model.tip.size.height,h=this.model.tip.size.height-1,i={"border-top":"none","border-bottom":"none","border-right":"none","border-left":"none"};return c?(r=this.model.tip.size.height,u=this.model.tip.size.width,$(this.tip).find(".e-arrowTipOuter").css(this._arrow(n,s,e,i,"horizontal")),$(this.tip).find(".e-arrowTipInner").css(this._arrow(n,h,o,i,"horizontal"))):(r=this.model.tip.size.width,u=this.model.tip.size.height,$(this.tip).find(".e-arrowTipOuter").css(this._arrow(n,s,e,i,"vertical")),$(this.tip).find(".e-arrowTipInner").css(this._arrow(n,h,o,i,"vertical"))),{tipHeight:u,tipWidth:r}},t.prototype._arrow=function(n,t,i,r,u){var f=n.stem,e=u=="horizontal"?f.horizontal=="right"?"0px":"1px":"1px",o=u=="horizontal"?"1px":f.vertical=="bottom"?"0px":"1px";return r["border-top"]=u=="horizontal"?t+"px solid transparent":f.vertical=="bottom"?t+"px solid "+i:"none",r["border-bottom"]=u=="horizontal"?t+"px solid transparent":f.vertical=="top"?t+"px solid "+i:"none",r["border-right"]=u=="horizontal"?f.horizontal=="left"?t+"px solid "+i:"none":t+"px solid transparent",r["border-left"]=u=="horizontal"?f.horizontal=="right"?t+"px solid "+i:"none":t+"px solid transparent",t==this.model.tip.size.height-1&&(r.left=e,r.top=o),r},t.prototype._iconRender=function(){this.model.closeMode==ej.Tooltip.CloseMode.Sticky&&(ej.isNullOrUndefined(this.tooltipClose)||$(this.tooltipClose).remove(),this.tooltipClose=ej.buildTag("div .e-icon"," ",{},{id:"_closeIcon"}),this.model.title!=null?$(this.tooltipClose).insertAfter(this.tooltipTitle).addClass("e-close"):$(this.tooltipClose).insertBefore(this.tooltipInter).addClass("e-cross-circle"),this._on($(this.tooltipClose),"click",this._hideTooltip))},t.prototype._renderTarget=function(){this.targetElement=$(this.element).find(this.model.target);for(var n=0;n<this.targetElement.length;n++)ej.isNullOrUndefined($(this.targetElement[n]).attr("title"))||(this.targetElement[n].setAttribute("data-content",this.targetElement[n].title),this.targetElement[n].removeAttribute("title"))},t.prototype._tooltipContent=function(){this.tooltipContent=ej.buildTag("div.e-tipcontent e-def","",{},{id:this.id+"_content"});$(this.tooltipContent).html(this.model.content).addClass("e-def");this.model.title!=null?$(this.tooltipContent).insertAfter(this.tooltipHeader):$(this.tooltipContent).appendTo(this.tooltipInter)},t.prototype._positionElement=function(n){this.tooltipPos.width=$(this.tooltip).outerWidth();this.tooltipPos.height=$(this.tooltip).outerHeight();this.targetPos.width=$(n).outerWidth();this.targetPos.height=$(n).outerHeight();this._containerCalc(n);this.model.associate==ej.Tooltip.Associate.Window?this._browserPosition():this.model.associate==ej.Tooltip.Associate.Axis?this._axisPosition():this.model.associate==ej.Tooltip.Associate.Target&&this._tooltipPosition(this.model.position);this.model.collision!=ej.Tooltip.Collision.None&&this.model.associate==ej.Tooltip.Associate.Target&&this._calcCollision(this.model.position,n)},t.prototype._browserPosition=function(){if(this.model.containment=="body"){this.containerSize={height:$(window).innerHeight()||document.documentElement.clientHeight||document.body.clientHeight,width:$(window).innerWidth()||document.documentElement.clientWidth||document.body.clientWidth};var t=$.extend(!0,{},this.model.position),n={position:"absolute",left:"auto",top:"auto",bottom:"auto",right:"auto"};ej.isNullOrUndefined(this.tip)||$(this.tip).css({display:"none"});this.model.position.target.horizontal=="right"?n.right=0:n.left=this.model.position.target.horizontal=="left"?0:this.containerSize.width/2-this.tooltipPos.width/2;this.model.position.target.vertical=="top"?n.top=0:this.model.position.target.vertical=="center"?n.top=this.containerSize.height/2-this.tooltipPos.height/2:n.bottom=0;this.model.showShadow&&this._shadowEffect(this.model.showShadow,t);$(this.tooltip).css(n)}},t.prototype._tooltipMove=function(n){if(this.model.closeMode==ej.Tooltip.CloseMode.None&&this.model.enabled){var t=this;if(this._isCancel)return;this.model.associate==ej.Tooltip.Associate.MouseFollow?this._mousePosition(n):this.model.associate==ej.Tooltip.Associate.MouseEnter&&(clearTimeout(this.mouseTimer),this.mouseTimer=setTimeout(function(){t.isTrack&&t._mousePosition(n)},300))}},t.prototype._mousePosition=function(n){var r,u,w,h;n.type=="touchstart"?(n.preventDefault(),r=n.touches[0].pageX,u=n.touches[0].pageY):n.type=="mousemove"&&(r=n.pageX,u=n.pageY);this.isCollision=!0;this._containerCalc(n.currentTarget);var c=0,l=0,f=0,t=$.extend(!0,{},this.model.position.stem),e=$.extend(!0,{},this.model.position),o={left:0,top:0},i={left:r,top:u},s={left:r,top:u},a=this.containerSize.left,v=this.containerSize.top,y=this.model.containment!="body"?r-$(this.model.containment).offset().left:r,p=this.model.containment!="body"?u-$(this.model.containment).offset().top:u;for(e.target.horizontal=e.target.vertical="center",this.model.containment!="body"&&(o=$(this.model.containment).css("position")=="static"?$(this.model.containment).offsetParent().offset():$(this.model.containment).offset()),s.left-=o.left,s.top-=o.top;this.isCollision;)if(i=$.extend(!0,{},s),w=this.model.isBalloon?t.vertical=="top"||t.vertical=="bottom"?5+this.tipSize.height/2:0:0,h=this.model.isBalloon?t.horizontal=="right"||t.horizontal=="left"?10+this.tipSize.width/2:0:0,c=this.model.tip.adjust.xValue!=0?this.model.tip.adjust.xValue:7,l=this.model.tip.adjust.yValue!=0?this.model.tip.adjust.yValue:10,f=this.model.isBalloon?t.horizontal!="center"?this.model.tip.size.height:t.vertical!="center"?this.model.tip.size.height:0:2,i.left+=t.horizontal=="right"?-this.tooltipPos.width:t.horizontal=="left"?0:-(this.tooltipPos.width/2),i.top+=t.vertical=="bottom"?-this.tooltipPos.height:t.vertical=="top"?0:-(this.tooltipPos.height/2),i.left+=t.vertical!="center"?t.horizontal=="right"?h:t.horizontal=="left"?-h:0:0,i.left+=t.vertical=="center"?t.horizontal=="right"?-f:t.horizontal=="left"?+(f+c):0:0,i.top+=t.vertical=="top"?+(f+l):t.vertical=="bottom"?-f:0,this.targetElement!=n.currentTarget&&(this.targetElement=n.currentTarget,(i.left<a||i.left+this.tooltipPos.width>a+this.containerSize.width)&&(this.positionTooltip.horizontal=y>=this.tooltipPos.width?"right":this.containerSize.width-y>=this.tooltipPos.width?"left":"center"),(i.top<v||i.top+this.tooltipPos.height>this.containerSize.height+v)&&(this.positionTooltip.vertical=p>=this.tooltipPos.height?"bottom":this.containerSize.height-p>=this.tooltipPos.height?"top":"center")),this.positionTooltip.horizontal!=t.horizontal||this.positionTooltip.vertical!=t.vertical)this.isCollision=!0,t=$.extend(!0,{},this.positionTooltip);else if(this.isCollision=!1,$(this.tooltip).css({top:i.top+"px",left:i.left+"px",position:"absolute",right:"auto",bottom:"auto"}),e.stem=$.extend(!0,{},this.positionTooltip),this.model.showShadow&&this._shadowEffect(this.model.showShadow,e),this.model.isBalloon&&this._adjustArrow(e),this._showTooltip(),this.model.associate==ej.Tooltip.Associate.MouseEnter&&(this.isTrack=!1),this.model.associate==ej.Tooltip.Associate.MouseFollow&&this.triggerEvents("tracking",{position:this.model.position,event:n}))return},t.prototype._axisPosition=function(){var i=$.extend(!0,{},this.model.position),r,u,n,t;typeof this.model.position.target.horizontal=="number"&&(r=this.model.position.target.horizontal.toString());typeof this.model.position.target.vertical=="number"&&(u=this.model.position.target.vertical.toString());n=parseInt(r);t=parseInt(u);ej.isNullOrUndefined(this.tip)||$(this.tip).css({display:"none"});this.model.showShadow&&this._shadowEffect(this.model.showShadow,i);this.model.isBalloon&&this._adjustArrow(i);isFinite(n)&&isFinite(t)&&$(this.tooltip).css({top:t,left:n,position:"absolute"})},t.prototype._tooltipPosition=function(n){var u=0,t=$.extend(!0,{},n.stem),r=$.extend(!0,{},n.target),i=$.extend(!0,{},this.targetPos),o=t.vertical==="top"||t.vertical==="bottom"?5+this.tipSize.width/2:0,s=t.horizontal==="right"||t.horizontal==="left"?10+this.tipSize.width/2:0,u=this.model.isBalloon?t.horizontal!=="center"?this.model.tip.size.height:t.vertical!=="center"?this.model.tip.size.height:0:0,f=this.model.tip.adjust.xValue!=0?this.model.tip.adjust.xValue:this.model.isBalloon?0:2,e=this.model.tip.adjust.yValue!=0?this.model.tip.adjust.yValue:this.model.isBalloon?0:2;i.left+=r.horizontal==="right"?this.targetPos.width:r.horizontal==="left"?0:this.targetPos.width/2;i.top+=r.vertical==="bottom"?this.targetPos.height:r.vertical==="top"?0:this.targetPos.height/2;i.left+=t.horizontal==="right"?-this.tooltipPos.width:t.horizontal==="left"?0:-(this.tooltipPos.width/2);i.top+=t.vertical==="bottom"?-this.tooltipPos.height:t.vertical==="top"?0:-(this.tooltipPos.height/2);i.left+=r.horizontal!=="center"?t.horizontal==="right"?-u:t.horizontal==="left"?u:0:t.vertical==="center"?t.horizontal==="right"?-u:t.horizontal==="left"?u:0:0;i.top+=r.horizontal==="center"?t.vertical==="bottom"?-u:t.vertical==="top"?u:0:t.horizontal==="center"?t.vertical==="bottom"?-u:t.vertical==="top"?u:0:0;i.left+=r.horizontal==="center"&&t.vertical!=="center"?t.horizontal==="right"?s:t.horizontal==="left"?-s:0:0;i.top+=r.horizontal!=="center"&&t.horizontal!=="center"?t.vertical==="top"?-o:t.vertical==="bottom"?o:0:0;i.left+=r.horizontal!=="center"?t.horizontal==="right"?-f:t.horizontal==="left"?f:0:t.vertical==="center"?t.horizontal==="right"?-f:t.horizontal==="left"?f:0:0;i.top+=r.horizontal==="center"?t.vertical==="bottom"?-e:t.vertical==="top"?e:0:t.horizontal==="center"?t.vertical==="bottom"?-e:t.vertical==="top"?e:0:0;this.tooltipPos.left=i.left;this.tooltipPos.top=i.top;this.model.collision===ej.Tooltip.Collision.None&&(this.model.isBalloon&&this._adjustArrow(n),this._shadowEffect(this.model.showShadow,n),$(this.tooltip).css({top:i.top+"px",left:i.left+"px",position:"absolute"}))},t.prototype._calcCollision=function(n,t){var n=$.extend(!0,{},n),i=$.extend(!0,{},n),o=this.model.tip.size.height,f=!0,r=this.model.containment!="body"?$(t).offset().left-$(this.model.containment).offset().left:$(t).offset().left,u=this.model.containment!="body"?$(t).offset().top-$(this.model.containment).offset().top:$(t).offset().top,e={topSpace:u,rightSpace:this.containerSize.width-(r+this.targetPos.width),bottomSpace:this.containerSize.height-(u+this.targetPos.height),leftSpace:r,centerRight:this.containerSize.width-(r+this.targetPos.width/2),centerLeft:r+this.targetPos.width/2,centerTop:u+this.targetPos.height/2,centerBottom:this.containerSize.height-(u+this.targetPos.height/2),tooltipWidth:this.tooltipPos.width+o,tooltipHeight:this.tooltipPos.height+o};if(this.model.collision===ej.Tooltip.Collision.Fit)this._collisionFit(n,e);else{while(f)i=this._collisionFlip(i,e),i.target.horizontal!=n.target.horizontal||i.target.vertical!=n.target.vertical||i.stem.horizontal!=n.stem.horizontal||i.stem.vertical!=n.stem.vertical?(this._tooltipPosition(i),n=$.extend(!0,{},i)):f=!1;f||(this.model.collision==ej.Tooltip.Collision.FlipFit?this._collisionFit(i,e):(this._adjustArrow(i),this._shadowEffect(this.model.showShadow,i),$(this.tooltip).css({top:this.tooltipPos.top+"px",left:this.tooltipPos.left+"px",position:"absolute"})))}},t.prototype._collisionFlip=function(n,t){var r=$.extend(!0,{},this.tooltipPos),i=$.extend(!0,{},n),e=$(this.model.containment).scrollLeft(),o=$(this.model.containment).scrollTop(),u=this.containerSize.left,f=this.containerSize.top;return(r.left+r.width>u+this.containerSize.width+e||r.left<u)&&(n.target.horizontal!="center"?i.target.horizontal=t.leftSpace>=t.tooltipWidth?"left":t.rightSpace>=t.tooltipWidth?"right":"center":i.stem.horizontal=t.centerLeft>=t.tooltipWidth?"right":t.centerRight>=t.tooltipWidth?"left":"center"),r.top<f&&(i.target.vertical=t.bottomSpace>=t.tooltipHeight?"bottom":"center"),r.top+r.height>this.containerSize.height+o+f&&(i.target.vertical=t.topSpace>=t.tooltipHeight?"top":"center"),(i.target.horizontal!=n.target.horizontal||i.target.vertical!=n.target.vertical)&&(i.stem.horizontal=i.target.horizontal=="center"?t.centerLeft>=t.tooltipWidth?"right":t.centerRight>=t.tooltipWidth?"left":"center":i.target.horizontal=="right"?"left":"right"),(i.target.vertical!=n.target.vertical||i.target.horizontal!=n.target.horizontal)&&(i.stem.vertical=i.target.vertical=="center"?t.centerTop>=t.tooltipHeight?"bottom":t.centerBottom>=t.tooltipHeight?"top":t.centerTop>t.centerBottom?"bottom":"top":i.target.vertical=="top"?"bottom":"top"),i},t.prototype._collisionFit=function(n,t){var i=$.extend(!0,{},this.tooltipPos),o=!1,s=!1,r=1,u=1,h=null,c=$(this.model.containment).scrollLeft(),l=$(this.model.containment).scrollTop(),f=this.containerSize.left,e=this.containerSize.top,a,v;(i.left<f||i.left+i.width>this.containerSize.width+c+f)&&(r=i.left<f?f:i.left+i.width>this.containerSize.width+c+f?i.left-(i.left+i.width-(this.containerSize.width+f)):1,o=!0);(i.top<e||i.top+i.height>this.containerSize.height+l+e)&&(u=i.top<e?e:i.top+i.height>this.containerSize.height+l+e?i.top-(i.top+i.height-(this.containerSize.height+e)):1,s=!0);$(this.tooltip).css({top:u!=1?u+"px":i.top+"px",left:r!=1?r+"px":i.left+"px",position:"absolute"});this._adjustArrow(n);h={left:this.arrowValue.left,top:this.arrowValue.top,height:this.model.tip.size.height,width:this.model.tip.size.width,display:$(this.tip).css("display")};this.tooltipPos.top=u=u!=1?u:i.top;this.tooltipPos.left=r=r!=1?r:i.left;a=$(this.tooltip).width();v=$(this.tooltip).height();(o||s&&h.display!="none")&&(this.model.isBalloon&&(o&&(this.arrowValue.left=this._horizontalAdjustment(n,t)),s&&(this.arrowValue.top=this._verticalAdjustment(n,t))),this.arrowValue.left==-this.model.tip.size.height||this.arrowValue.left==a?$(this.tip).css({left:this.arrowValue.left+"px",top:this.arrowValue.top+"px",display:"block"}):this.arrowValue.top==-this.model.tip.size.height||this.arrowValue.top==v?$(this.tip).css({left:this.arrowValue.left+"px",top:this.arrowValue.top+"px",display:"block"}):$(this.tip).css({left:this.arrowValue.left+"px",top:this.arrowValue.top+"px",display:"none"}));this._shadowEffect(this.model.showShadow,n)},t.prototype._horizontalAdjustment=function(n,t){var r={left:this.arrowValue.left,top:this.arrowValue.top},u,i;return $(this.tooltip).css({display:"block"}),u=n.target.horizontal!="center"?this.model.tip.size.height:this.model.tip.size.height,i=n.target.horizontal!="center"&&n.stem.horizontal=="left"?$(this.tip).offset().left:n.target.horizontal!="center"&&n.stem.horizontal=="right"?$(this.tip).offset().left+u:$(this.tip).offset().left,$(this.tooltip).css({display:"none"}),i>t.leftSpace&&i+u<t.leftSpace+this.targetPos.width?r.left:((i>t.leftSpace+this.targetPos.width||i<t.leftSpace)&&(r.left=t.leftSpace+this.targetPos.width/2-parseInt(this.tooltipPos.left.toString())),r.left)},t.prototype._verticalAdjustment=function(n,t){var r={left:this.arrowValue.left,top:this.arrowValue.top,height:this.model.tip.size.height,width:this.model.tip.size.width,display:this.arrowValue.display},u,i;return $(this.tooltip).css({display:"block"}),u=n.target.horizontal!="center"?this.model.tip.size.height:this.model.tip.size.height,i=n.target.horizontal=="center"&&n.stem.vertical=="top"?$(this.tip).offset().top:$(this.tip).offset().top+u,$(this.tooltip).css({display:"none"}),i>t.topSpace&&i<t.topSpace+this.targetPos.height?r.top:((i<t.topSpace||i+u>t.topSpace+this.targetPos.height)&&(r.top=t.topSpace+this.targetPos.height/2-parseInt(this.tooltipPos.top.toString())),r.top)},t.prototype._createHeader=function(){this.model.title!=null&&(ej.isNullOrUndefined(this.tooltipTitle)&&this._createTitle(),ej.isNullOrUndefined(this.tooltipContent)?$(this.tooltipHeader).appendTo(this.tooltipInter).addClass("e-tooltipHeader"):$(this.tooltipHeader).insertBefore(this.tooltipContent).addClass("e-tooltipHeader"));this.model.closeMode==ej.Tooltip.CloseMode.Sticky&&this._iconRender()},t.prototype._hideTooltip=function(){var n;if(this._isHidden=!0,n=this.model.animation.speed!=0?this.model.animation.speed:this.model.animation.effect==ej.Tooltip.Effect.Slide?200:this.model.animation.effect==ej.Tooltip.Effect.Fade?800:0,this.model.enabled==!0&&$(this.tooltip).css("display")=="block"){if(this.triggerEvents("beforeClose",{}))return;if(this.model.animation.effect==ej.Tooltip.Effect.Fade?$(this.tooltip).fadeOut(n):this.model.animation.effect==ej.Tooltip.Effect.Slide?$(this.tooltip).slideUp(n):$(this.tooltip).css({display:"none"}),$(this.tooltip).css("display")=="none"&&$(this.tooltip).attr("aria-hidden","true").removeClass("e-customAnimation"),this.triggerEvents("close",{}))return}},t.prototype._showTooltip=function(){if(this._isHidden){var n=this.model.animation.speed!=0?this.model.animation.speed:this.model.animation.effect==ej.Tooltip.Effect.Slide?200:this.model.animation.effect==ej.Tooltip.Effect.Fade?800:0;if(this._isHidden=!1,$(this.tooltip).css("display")=="none"&&this.model.enabled==!0&&(this.model.animation.effect==ej.Tooltip.Effect.Fade?$(this.tooltip).fadeIn(n):this.model.animation.effect==ej.Tooltip.Effect.Slide?$(this.tooltip).slideDown(n):$(this.tooltip).css({display:"block"}),$(this.tooltip).css("display")=="block"&&($(this.tooltip).attr("aria-hidden","false").css({zIndex:ej.getMaxZindex()+1}),this.model.animation.effect==ej.Tooltip.Effect.None&&$(this.tooltip).addClass("e-customAnimation"),this._getScrollableParents()),this.triggerEvents("open",{})))return}},t.prototype._getScrollableParents=function(){var n=$(this.element).parentsUntil("html").filter(function(){$(this).css("overflow")!="visible"}).add($(window));this._on(n,"scroll",this._hideTooltip)},t.prototype._tooltipAuto=function(){var n=this;this.timer=setTimeout(function(){n._hideTooltip()},n.model.autoCloseTimeout)},t.prototype._beforeOpenTooltip=function(n){this.positionTooltip=$.extend(!0,{},this.model.position.stem);this.positionTarget=$.extend(!0,{},this.model.position.target);this.targetElement=this.element;ej.isNullOrUndefined(this.model.target)||ej.isNullOrUndefined($(n.currentTarget).attr("data-content"))||(this.model.content=$(n.currentTarget).attr("data-content"),this._setContent(this.model.content))},t.prototype._targetHover=function(n){if(this.isTrack=!0,this.model.enabled)if(this._isHidden||(ej.browserInfo().name=="msie"||ej.browserInfo().name=="edge")&&this.model.associate==ej.Tooltip.Associate.MouseFollow){if(this.tooltip.stop(!0,!0),this.triggerEvents("beforeOpen",{event:n})){this._isCancel=!0;return}this._isCancel=!1;this._beforeOpenTooltip(n);this.model.associate!=ej.Tooltip.Associate.MouseEnter&&this.model.associate!=ej.Tooltip.Associate.MouseFollow?(ej.isNullOrUndefined(this.model.target)?this._positionElement(this.element):this._positionElement(n.currentTarget),clearTimeout(this.timer),this._showTooltip(),this.model.closeMode==ej.Tooltip.CloseMode.Auto&&this._tooltipAuto(),n.type=="click"?this.triggerEvents("click",{event:n}):this.triggerEvents("hover",{event:n})):this.isTrack=!0}else ej.isNullOrUndefined(this.model.target)||this._positionElement(n.currentTarget)},t.prototype._onMouseOut=function(){this.model.enabled&&!this._isHidden&&(this.model.closeMode==ej.Tooltip.CloseMode.None&&this._hideTooltip(),clearTimeout(this.mouseTimer));this.isTrack=!1},t.prototype._onTooltipMouseEnter=function(){var n=this;this.model.enabled&&this.model.animation.effect==ej.Tooltip.Effect.None&&$(n.tooltip).css({display:"block"})},t.prototype._onTooltipMouseLeave=function(){var n=this;this.model.enabled&&this.model.animation.effect==ej.Tooltip.Effect.None&&n.model.closeMode==ej.Tooltip.CloseMode.None&&$(n.tooltip).css({display:"none"})},t.prototype._docTouchEndHandler=function(n){$(n.target).closest(".e-tooltip").length||this.model.closeMode!=ej.Tooltip.CloseMode.None||this._hideTooltip()},t.prototype._keyDown=function(n){var t=n.keyCode?n.keyCode:n.which?n.which:n.charCode;if(this.model.enabled)switch(t){case 27:n.preventDefault();this._hideTooltip()}},t}(ej.WidgetBase);window.ej.widget("ejTooltip","ej.Tooltip",new ejTooltip);window.ejTooltip=null;ej.Tooltip.CloseMode={Auto:"auto",None:"none",Sticky:"sticky"};ej.Tooltip.Effect={Slide:"slide",Fade:"fade",None:"none"};ej.Tooltip.Trigger={Hover:"hover",Click:"click",Focus:"focus"};ej.Tooltip.Collision={Flip:"flip",FlipFit:"flipfit",None:"none",Fit:"fit"};ej.Tooltip.Associate={Window:"window",MouseFollow:"mousefollow",MouseEnter:"mouseenter",Target:"target",Axis:"axis"},function($,ej,undefined){ej.widget("ejListView","ej.ListView",{_rootCSS:"e-lv",validTags:["div"],_prefixClass:"e-",defaults:{fieldSettings:{navigateUrl:"navigateUrl",href:"href",enableAjax:"enableAjax",preventSelection:"preventSelection",persistSelection:"persistSelection",text:"text",enableCheckMark:"enableCheckMark",checked:"checked",primaryKey:"primaryKey",parentPrimaryKey:"parentPrimaryKey",imageClass:"imageClass",imageUrl:"imageUrl",childHeaderTitle:"childHeaderTitle",childId:"childId",childHeaderBackButtonText:"childHeaderBackButtonText",renderTemplate:"renderTemplate",templateId:"templateId",attributes:"attributes",mouseUp:"mouseUp",mouseDown:"mouseDown",groupID:"groupID",id:"id"},mouseDown:null,mouseUp:null,items:[],dataSource:null,query:null},dataTypes:{dataSource:"data",query:"data",itemRequestCount:"number",fieldSettings:"data",renderMode:"enum",theme:"enum",enablePersistence:"boolean"},observables:["selectedItemIndex","dataSource"],selectedItemIndex:ej.util.valueFunction("selectedItemIndex"),dataSource:ej.util.valueFunction("dataSource"),checkedIndices:ej.util.valueFunction("checkedIndices"),_tags:[{tag:"items",attr:["navigateUrl","href","text","checked","primaryKey","parentPrimaryKey","imageClass","imageUrl","childHeaderTitle","childId","childHeaderBackButtonText","mouseUP","mouseDown","attributes","renderTemplate","templateId","enableAjax","preventSelection","persistSelection","enableCheckMark","attributes"],content:"template"}],_init:function(n){var t;this._options=n;this._preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/};this._storedContent=[];this._storedTemplate=[];this._tempContent=$("body");this._touchStart=this.model.mouseDown;this._touchEnd=this.model.mouseUp;this._oldEle=this.element.clone();this._oldEle.find("ul").length&&(this.model.items=[]);this._indexVal=0;this._setCulture();this._updateModelItems();this.model.allowVirtualScrolling&&(this.dummyUl=$(),this._savedQueries=this.model.query.clone());this._load();t=this.element.closest(".e-nb.e-js");this._isInsideNavigation=t.length;this._isInsideNavigation&&(this._nearestND=t.ejNavigationDrawer("instance"));this._responsive()},_responsive:function(){$(window).on("resize",$.proxy(this._resizeHandler,this))},_resizeHandler:function(){$(this.element).parent().width()==null&&this.model==null?$(this.element).width(this.width):$(this.element).parent().width()<=this.model.width?(this.width=$(this.element).parent().width(),$(this.element).width(this.width)):$(this.element).width(this.model.width)},_itemsObjectCollection:function(n,t,i,r){var f,u;return ej.getAttrVal(n,"data-ej-rendertemplate")&&(f=this._tempContent.find("#"+ej.getAttrVal(n,"data-ej-templateid")),f.length?(u=f.remove(),this._storedTemplate[this._indexVal]=u[0].nodeName&&u[0].nodeName.toLowerCase()=="script"?ej.getClearString(u[0].innerHTML):u[0].outerHTML):this._storedTemplate[this._indexVal]||($(n)[0].innerHTML?this._storedTemplate[this._indexVal]=$(n)[0].innerHTML:this._storedTemplate[this._indexVal]&&this._tempContent.find("#"+template).length&&(u=this._tempContent.find("#"+template).remove(),u=u[0].nodeName&&u[0].nodeName.toLowerCase()=="script"?ej.getClearString(u[0].innerHTML):u[0].outerHTML,this._storedTemplate=ej._pushValue(this._storedTemplate,u,this._indexVal))),this._indexVal++),this._getLiAttributes(n,t,i,r)},_getLiAttributes:function(n,t,i,r){var u={};return u.groupID=r?r:"",u.text=ej.getAttrVal(n,"data-ej-text")?ej.getAttrVal(n,"data-ej-text"):this._getText(n),u.preventSelection=ej.getAttrVal(n,"data-ej-preventselection"),u.persistSelection=ej.getAttrVal(n,"data-ej-persistselection"),u.navigateUrl=ej.getAttrVal(n,"data-ej-navigateurl"),u.href=ej.getAttrVal(n,"data-ej-href"),u.checked=ej.getAttrVal(n,"data-ej-checked"),u.primaryKey=ej.getAttrVal(n,"data-ej-primarykey",t),u.parentPrimaryKey=ej.getAttrVal(n,"data-ej-parentprimarykey",i),u.imageClass=ej.getAttrVal(n,"data-ej-imageclass"),u.imageUrl=ej.getAttrVal(n,"data-ej-imageurl"),u.childHeaderTitle=ej.getAttrVal(n,"data-ej-childheadertitle"),u.childId=u.href?ej.getAttrVal(n,"data-ej-childid")?ej.getAttrVal(n,"data-ej-childid"):"page_"+parseInt(Math.random().toFixed(3)*1e3):"",u.childHeaderBackButtonText=ej.getAttrVal(n,"data-ej-childheaderbackbuttontext"),u.mouseUp=ej.getAttrVal(n,"data-ej-mouseUp"),u.mouseDown=ej.getAttrVal(n,"data-ej-mouseDown"),this.element.find("li").length>0&&(u.attributes=typeof n=="object"?n.attrNotStartsWith(/^data-ej-/):$(n).attrNotStartsWith(/^data-ej-/)),u.renderTemplate=ej.getAttrVal(n,"data-ej-rendertemplate"),u.templateId=this._storedTemplate[this._indexVal-1],u.enableAjax=ej.getAttrVal(n,"data-ej-enableajax"),u.enableCheckMark=ej.getAttrVal(n,"data-ej-enablecheckmark"),u},_renderLists:function(){var t=ej.buildTag("li","",{},{"class":this._prefixClass+"user-select "+this._prefixClass+"list "+this._prefixClass+"state-default{{if "+this.model.fieldSettings.primaryKey+" || "+this.model.fieldSettings.enableAjax+" || "+this.model.enableAjax+"}} "+this._prefixClass+"arrow{{/if}}{{if "+this.model.fieldSettings.imageClass+"}} "+this._prefixClass+"margin{{else}}{{if "+this.model.fieldSettings.imageUrl+"}} "+this._prefixClass+"margin{{/if}}{{/if}}","data-childid":"{{if "+this.model.fieldSettings.primaryKey+"}}child{{>"+this.model.fieldSettings.primaryKey+"}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}","data-childheadertitle":"{{>"+this.model.fieldSettings.childHeaderTitle+"}}","data-childheaderbackbuttontext":"{{>"+this.model.fieldSettings.childHeaderBackButtonText+"}}","data-preventSelection":"{{>"+this.model.fieldSettings.preventSelection+"}}","data-persistSelection":"{{>"+this.model.fieldSettings.persistSelection+"}}","data-navigateUrl":"{{>"+this.model.fieldSettings.navigateUrl+"}}","data-loadajax":"{{>"+this.model.fieldSettings.enableAjax+"}}","data-href":"{{>"+this.model.fieldSettings.href+"}}{{:~_checkAjaxUrls()}}","data-checked":"{{>"+this.model.fieldSettings.checked+"}}","data-templateid":"{{>"+this.model.fieldSettings.renderTemplate+"}}","data-mouseup":"{{>"+this.model.fieldSettings.mouseUp+"}}","data-mousedown":"{{>"+this.model.fieldSettings.mouseDown+"}}","data-id":"{{>"+this.model.fieldSettings.id+"}}"}),n,i,r;if(this.model.renderTemplate)this._hasDataSource()&&this._template&&(n=this._createCheckBox(),t[0].innerHTML=this._template+"{{if "+this.model.fieldSettings.enableCheckMark+" !== undefined}}{{if "+this.model.fieldSettings.enableCheckMark+".toString() == 'false' ? "+this.model.fieldSettings.enableCheckMark+" : "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{else}}{{if "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{/if}}");else{i=ej.buildTag("a","",{},{"class":this._prefixClass+"chevron-right_01 "+this._prefixClass+"remove-shadow{{if "+this.model.fieldSettings.imageClass+"}} "+this._prefixClass+"margin{{else}}{{if "+this.model.fieldSettings.imageUrl+"}} "+this._prefixClass+"margin{{/if}}{{/if}}{{if "+this.model.fieldSettings.primaryKey+" || "+this.model.fieldSettings.enableAjax+" || "+this.model.enableAjax+"}} "+this._prefixClass+"fontimage e-icon{{/if}}",href:ej.browserInfo().name=="msie"&&ej.browserInfo().version<9?"":"{{if "+this.model.fieldSettings.navigateUrl+" == '' || "+this.model.fieldSettings.navigateUrl+" == undefined }}{{else}}{{:"+this.model.fieldSettings.navigateUrl+"}}{{/if}}"});ej.browserInfo().name=="msie"&&ej.browserInfo().version<9&&i.removeAttr("href");var u=ej.buildTag("span","{{>"+this.model.fieldSettings.text+"}}",{},{"class":this._prefixClass+"list-text "+this._prefixClass+"rel "+this._prefixClass+"user-select{{if "+this.model.fieldSettings.imageClass+"}} "+this._prefixClass+"text{{else}}{{if "+this.model.fieldSettings.imageUrl+"}} "+this._prefixClass+"text{{/if}}{{/if}}"}),f=ej.buildTag("div","",{},{"class":this._prefixClass+"list-img "+this._prefixClass+"rel "+this._prefixClass+"user-select {{>"+this.model.fieldSettings.imageClass+"}}"}),n=this._createCheckBox();i[0].innerHTML=this.model.renderMode=="windows"&&ej.isMobile()?"{{if !"+this.model.fieldSettings.primaryKey+"}}{{if "+this.model.fieldSettings.enableAjax+" == undefined || "+this.model.fieldSettings.enableAjax+".toString() == 'false'}}{{if !"+this.model.fieldSettings.navigateUrl+"}}{{if "+this.model.fieldSettings.enableCheckMark+" !== undefined}}{{if "+this.model.fieldSettings.enableCheckMark+".toString() == 'false' ? "+this.model.fieldSettings.enableCheckMark+" : "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{else}}{{if "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{/if}}{{/if}}{{/if}}{{/if}}{{if "+this.model.fieldSettings.imageClass+"}}"+f[0].outerHTML+"{{else}}{{if "+this.model.fieldSettings.imageUrl+"}}{{:~_checkImgUrls()}}{{/if}}{{/if}}"+u[0].outerHTML:"{{if "+this.model.fieldSettings.imageClass+"}}"+f[0].outerHTML+"{{else}}{{if "+this.model.fieldSettings.imageUrl+"}}{{:~_checkImgUrls()}}{{/if}}{{/if}}"+u[0].outerHTML+"{{if !"+this.model.fieldSettings.primaryKey+"}}{{if "+this.model.fieldSettings.enableAjax+" == undefined || "+this.model.fieldSettings.enableAjax+".toString() == 'false'}}{{if !"+this.model.fieldSettings.navigateUrl+"}}{{if "+this.model.fieldSettings.enableCheckMark+" !== undefined}}{{if "+this.model.fieldSettings.enableCheckMark+".toString() == 'false' ? "+this.model.fieldSettings.enableCheckMark+" : "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{else}}{{if "+this.model.enableCheckMark+"}}"+n[0].outerHTML+"{{/if}}{{/if}}{{/if}}{{/if}}{{/if}}";t[0].innerHTML="{{if "+this.model.fieldSettings.renderTemplate+" == undefined || "+this.model.fieldSettings.renderTemplate+".toString() == 'false'}}"+i[0].outerHTML+"{{else}}{{:templateId}}{{/if}}"}return this.model.renderMode=="ios7"&&(r=ej.buildTag("div."+this._prefixClass+"list-div"),r[0].innerHTML=t[0].innerHTML,t.empty().append(r)),t},_updateContent:function(n,t){var e=this,i=$(n),r=i.attr("data-childid"),f,u;id=this._isInsideNavigation&&n.attr("data-href")?$("body").find($("#"+r)):this.element.find($("#"+r));id.length&&(f=this.element.find("#"+r+"_header"),this.model.enableFiltering&&this._initializeFiltering($(id)),u=i.attr("data-childheadertitle")==undefined?n.text():i.attr("data-childheadertitle"),f.hasClass("e-header")&&this._setHeaderVal(r,u,t),id.attr("data-hdr-title",u).attr("data-hdr-bckbtn",t),this._initEJCheckBox(id),this._isInsideNavigation&&n.attr("data-href")&&this._nearestND.model.contentId?$("body").find(".e-lv.subpage.e-childitem")&&$("#"+this._nearestND.model.contentId).empty().append(id.show()):(i.closest(".subpage").hide(),id.show(),this._childContainer=id.find("."+this._prefixClass+"list-container"),this._childContainer.ejScroller({height:this._childContainer.height(),width:0,scrollerSize:20}),this.scrollerObj=this._childContainer.ejScroller("instance"),this._containerHeight=this.element.height()-ej.getDimension(this._lbEle.find("."+this._prefixClass+"lv-inputdiv"),"outerHeight")-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight"),this.model.height!==null&&this._childContainer.height()>this._containerHeight&&this._refreshScroller(this._childContainer,!0),this.scrollerObj&&(this.scrollerObj.refresh(),$(this.scrollerObj.element).find(".e-vhandlespace").css("height",$(this.scrollerObj.element).find(".e-vhandlespace").height()-1)),$(this.element.children()[0]).removeClass("e-slideright"),id.addClass("e-slideleft")))},_renderHeader:function(n,t,i,r){var u=ej.buildTag("div","",{},{id:n+"_header","class":"e-header e-box"});return t?(u.append("<span class='e-hicon e-icon e-chevron-left_01'><\/span>"),u.append("<div class='e-btn-text'>"+(r?r:"Back")+"<\/div>")):u.append("<div class='e-htitle'>"+i+"<\/div>"),u},_setHeaderVal:function(n,t,i){this._onBackButtonDelegate=$.proxy(this._onBackButtonClick,this);ej.listenTouchEvent($("#"+n+"_header"),ej.endEvent(),this._onBackButtonDelegate,!1,this);var r=this.model.showHeaderBackButton?this.model.headerBackButtonText?this.model.headerBackButtonText:i:i;$("#"+n+"_header").find(".e-btn-text").text(i?r:"Back");$("#"+n+"_header").find(".e-htitle").text(t)},_onBackButtonClick:function(){this.element.find(".e-slideleft").removeClass("e-slideleft");this.element.children(":visible").hide();$(this.element.children()[0]).show();$(this.element.children()[0]).addClass("e-slideright");this.model.enableFiltering&&this._initializeFiltering($(this.element.children()[0]))},_returnData:function(){var checkedItem=this._currentItem.closest("ul.e-list-hdr").find('.e-chkbox-wrap[aria-checked="true"]').closest("li"),elementId=ej.getAttrVal(this._currentItem,"data-id",this._currentItem.text()),items=this.dataSource().length?typeof this.dataSource()=="string"?eval(this.dataSource()):this.dataSource():this.model.items;return{hasChild:this._currentItem.attr("data-childid")&&this._currentItem.attr("data-childid").length>0?this.element.find("#"+this._currentItem.attr("data-childid")).length?!0:!1:!1,item:this._currentItem,text:this._currentItem.text(),index:this._currentItem.index(),isChecked:this._currentItem.find("input.e-lv-check").closest(".e-chkbox-wrap").attr("aria-checked")=="true"?!0:!1,checkedItems:checkedItem.length?checkedItem:null,checkedItemsText:$(checkedItem).map(function(){return $(this).text()}).get(),itemData:this._generateData(items,elementId),checkedValues:this.checkedIndices()}},_initEJCheckBox:function(n){var r=n.find("li"),f=r.length,u,t;for(i=0;i<f;i++)this.model.enablePersistence||this.model.checkedIndices.length>0?(u=this.model.checkedIndices,t=this._hasValue(u,i)):(t=ej.getAttrVal($(r[i]),"data-checked"),t=t=="true"?!0:!1),$($(r[i]).find(".e-lv-check")).ejCheckBox({checked:t});n.find(".e-lv-checkdiv").removeClass("e-lv-checkdiv");n.find(".e-lv-check").parent().addClass("e-lv-checkdiv")},_triggerStartEvent:function(n){this.model.mouseDown=ej.browserInfo().name=="msie"&&ej.browserInfo().version==8?this._touchStart:ej.getAttrVal(this._currentItem,"data-mousedown",this._touchStart);this._trigger("mouseDown",n)},_triggerEndEvent:function(n,t){if(this.model.mouseUp=ej.browserInfo().name=="msie"&&ej.browserInfo().version==8?this._touchEnd:ej.getAttrVal(this._currentItem,"data-mouseup",this._touchEnd),this.selectedItemIndex(this._currentItem.index()),this.model.enablePersistence||this.model.enableCheckMark){var r=this._currentItem.find(".e-chkbox-wrap"),i=this._currentItem.index();r.attr("aria-checked")=="true"||i||$(t.target).parent().hasClass("e-chk-inact")?this._hasValue(this._checkedValues,i)?this._checkedValues.splice(this._checkedValues.indexOf(i),1):this._checkedValues.push(i):this._checkedValues.splice(this._checkedValues.indexOf(i),1)}this.checkedIndices(this._checkedValues);this.model.mouseUp&&this._trigger("mouseUp",n)},_createFilterDiv:function(){return ej.buildTag("div.e-lv-filter",ej.buildTag("input.e-lv-input","",{},{type:"text",placeholder:"search"}))},_emptyFilterTextValue:function(n){n.find(".e-lv-input").val("")},_createListDiv:function(n){this._div=ej.buildTag("div#"+n+"."+this._rootCSS+" subpage e-childitem e-ajaxchild",this.model.showHeader&&this._isInsideNavigation&&!this._nearestND.model.contentId?this._renderHeader(n,!0,this._currentItem.text()):"")},_createCheckBox:function(){return ej.buildTag("input.e-lv-check","",{},{type:"checkbox"})},_toggleCheckboxValue:function(n){n.ejCheckBox({checked:$(n.closest(".e-chkbox-wrap")).attr("aria-checked")=="true"?!1:!0})},_setCheckboxValue:function(n,t){n.ejCheckBox({checked:t})},_convertToRelativeUrl:function(n){return n},_setCulture:function(){this._localizedLabels=this._getLocalizedLabels();ej.isNullOrUndefined(this._options)||(ej.isNullOrUndefined(this._options.headerTitle)||(this._localizedLabels.headerTitle=this._options.headerTitle),ej.isNullOrUndefined(this._options.headerBackButtonText)||(this._localizedLabels.headerBackButtonText=this._options.headerBackButtonText));this.model.headerTitle=this._localizedLabels.headerTitle;this.model.headerBackButtonText=this._localizedLabels.headerBackButtonText},_getLocalizedLabels:function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)}});ej.ListView.Locale=ej.ListView.Locale||{};ej.ListView.Locale["default"]=ej.ListView.Locale["en-US"]={headerTitle:"Title",headerBackButtonText:""};$.extend(!0,ej.ListView.prototype,ej.ListViewBase.prototype)}(jQuery,Syncfusion),function(n,t){t.widget("ejNavigationDrawer","ej.NavigationDrawer",{_setFirst:!0,validTags:["div"],_rootCSS:"e-nb",_prefixClass:"e-",defaults:{isPaneOpen:!1},dataTypes:{isPaneOpen:"boolean"},_init:function(){this._load();this._renderControl();this._renderEJMControls();this._createDelegate();this._wireEvents()},_load:function(){this._browser=this._getBrowserAgent();this.model.position=="normal"?this.model.isPaneOpen?(this.element.siblings().wrapAll("<div id='"+this._id+"_PageContainer' class='e-nb-container e-nb-pageContainer'><\/div>"),this._pageContainer=this._nbHome=this.element.siblings()):(this._elementWrapper=t.buildTag("div#"+this._id+"_WrapContainer",{},{},{"class":this._rootCSS+" e-nb-container e-nb-"+this.model.direction.toLowerCase()}),this.element.wrapAll(this._elementWrapper),this._nbHome=n("#"+this._id+"_WrapContainer").parent()):(this._nbHome=n("body"),this.element.appendTo(this._nbHome));this._nbHomeCss=this._nbHome.clone(!0)[0].style},_renderEJMControls:function(){this.model.enableListView?(this._lb=t.buildTag("div#"+this._id+"_listview",{},{},{"class":"e-nb-listview"}),this.model.items.length||this.model.listViewSettings.dataSource.length?this._lb.appendTo(this.element):this.element.find(">ul").wrapAll(this._lb),this._lb=n("#"+this._id+"_listview"),this.model.listViewSettings.width||(this.model.listViewSettings.width=240),this.model.listViewSettings.items=this.model.items,this._lb.ejListView(n.extend({},this.model.listViewSettings,{loadComplete:n.proxy(this._setLayout,this)})),this._lbObj=this._lb.data("ejListView"),this._lb.ejListView("selectItem",this.model.listViewSettings.selectedItemIndex)):this.element.find(".e-nb-listview").empty()},_setModel:function(t){var r=!1;for(var i in t){switch(i){case"width":this._setWidth();this._setLayout();break;case"direction":this._setLayout();break;case"type":this._transform(0,0,!0);this._transform(0,0,!1);break;case"isPaneOpen":this.model[i]=t[i];this.element.hide();t[i]?(n(this._elementWrapper,this._elementShadow,this._elementOverlay).remove(),this.element.removeAttr("style").height("100%"),this.element.unwrap()):(this._pageContainer.children().unwrap(),this._pageContainer.remove());this._load();this._shadowWrapper();this.model.enableListView&&this._renderEJMControls();this._wireEvents();break;case"enableListView":this._renderEJMControls();break;default:r=!0}r&&this._refresh()}},_destroyEJMPlugin:function(){this._lb&&(this._lb.ejListView("destroy"),this._lb.children().unwrap());this.model.contentId&&n("#"+this.model.contentId).empty();this._id&&n("#"+this._id).hide()},_getBrowserAgent:function(){return/webkit/i.test(navigator.appVersion)?"webkit":/firefox/i.test(navigator.userAgent)?"Moz":/trident/i.test(navigator.userAgent)?"ms":"opera"in window?"O":""}});n.extend(!0,t.NavigationDrawer.prototype,t.NavigationDrawerBase.prototype);n.extend(!0,t.NavigationDrawer.prototype.defaults.listViewSettings,t.ListView.prototype.defaults);t.NavigationDrawer.prototype._tags=t.ListView.prototype._tags}(jQuery,Syncfusion),function(n,t,r){t.widget("ejListBox","ej.ListBox",{element:null,_ignoreOnPersist:["dataSource","query","itemRequestCount","fields","create","change","select","unselect","itemDragStart","itemDrag","itemDragStop","itemDrop","checkChange","destroy","actionComplete","actionFailure","actionSuccess","actionBegin","itemDropped","selected"],model:null,validTags:["ul"],_setFirst:!1,_rootCSS:"e-listbox",defaults:{itemsCount:null,totalItemsCount:null,dataSource:null,query:t.Query(),itemRequestCount:5,itemHeight:null,fields:{id:null,text:null,imageUrl:null,imageAttributes:null,spriteCssClass:null,htmlAttributes:null,tooltipText:null,selectBy:null,checkBy:null,groupBy:null,tableName:null,selected:null,category:null,toolTipText:null},height:"auto",width:"200",template:null,text:"",selectedIndex:null,checkedIndices:[],selectedIndices:[],cascadeTo:null,value:"",cssClass:"",targetID:null,htmlAttributes:{},showRoundedCorner:!1,enableRTL:!1,enabled:!0,showCheckbox:!1,allowVirtualScrolling:!1,virtualScrollMode:"normal",enablePersistence:!1,allowMultiSelection:!1,allowDrag:!1,allowDrop:!1,enableIncrementalSearch:!1,enableWordWrap:!0,caseSensitiveSearch:!1,loadDataOnInit:!0,create:null,change:null,select:null,unselect:null,itemDragStart:null,itemDrag:null,itemDragStop:null,itemDrop:null,checkChange:null,destroy:null,actionComplete:null,actionSuccess:null,actionBeforeSuccess:null,focusIn:null,focusOut:null,actionFailure:null,actionBegin:null,cascade:null,sortOrder:"none",enableVirtualScrolling:!1,checkAll:!1,uncheckAll:!1,enableLoadOnDemand:!1,itemRequest:null,allowDragAndDrop:r,selectedItemIndex:null,enableItemsByIndex:null,checkItemsByIndex:null,disableItemsByIndex:null,uncheckItemsByIndex:null,itemDropped:null,selected:null,selectIndexChanged:null,selectedItems:[],checkedItems:[],checkedItemlist:[],selectedItemlist:[]},dataTypes:{cssClass:"string",itemsCount:"number",itemRequestCount:"number",allowDrag:"boolean",allowDrop:"boolean",enableWordWrap:"boolean",enableIncrementalSearch:"boolean",caseSensitiveSearch:"boolean",template:"string",targetID:"string",cascadeTo:"string",showRoundedCorner:"boolean",enableRTL:"boolean",enablePersistence:"boolean",enabled:"boolean",allowMultiSelection:"boolean",dataSource:"data",query:"data",checkedIndices:"data",selectedIndices:"data",htmlAttributes:"data",loadDataOnInit:"boolean",showCheckbox:"boolean",sortOrder:"enum"},observables:["value","dataSource"],value:t.util.valueFunction("value"),dataSource:t.util.valueFunction("dataSource"),enable:function(){var n,t;this.listContainer.hasClass("e-disable")&&(this.target.disabled=!1,this.model.enabled=this.model.enabled=!0,this.element.removeAttr("disabled"),this.listContainer.removeClass("e-disable"),this.model.allowMultiSelection&&this.listContainer.removeClass("e-disable"),n=this.listContainer.find(".e-vscrollbar,.e-hscrollbar"),this.model.showCheckbox&&(t=this.listContainer.find("li:not(.e-disable)"),t.find(".listcheckbox").ejCheckBox("enable")),n.length>0&&this.scrollerObj.enable())},disable:function(){if(!this.listContainer.hasClass("e-disable")){this.target.disabled=!0;this.model.enabled=this.model.enabled=!1;this.element.attr("disabled","disabled");this.listContainer.addClass("e-disable");this.model.allowMultiSelection&&this.listContainer.addClass("e-disable");var n=this.listContainer.find(".e-vscrollbar,.e-hscrollbar");this.model.showCheckbox&&this.element.find(".listcheckbox").ejCheckBox("disable");n.length>0&&this.scrollerObj.disable()}},selectItemByIndex:function(t){var u=this.model.selectedIndex,f=this.listitems?this.listitems:this.listitem,i,r;t!=0&&(t=parseInt(t));t==null||this.model.showCheckbox||((t>this.element.find("li:not('.e-ghead')").length||t<0||1/t==-Infinity)&&(t=this.model.selectedIndex),i=n(this.element.find("li:not('.e-ghead')")[t]),i.hasClass("e-select")||(this._activeItem=t,this.element.children("li").removeClass("e-select"),this._selectedItems=[],this.model.selectedIndices=[],i.addClass("e-select"),this._selectedItems.push(i),this.model.selectedIndices.push(t),r=this._getItemObject(i,null),r.isInteraction=!1,this.model.select&&this._trigger("select",r)));this.model.cascadeTo&&(this._activeItem=t,this._cascadeAction());this._setSelectionValues()._OnListSelect(u,this._activeItem)},checkItemByIndex:function(n){typeof n=="number"&&this.checkItemsByIndices(n.toString())},uncheckItemByIndex:function(n){typeof n=="number"&&this.uncheckItemsByIndices(n.toString())},checkItemsByIndices:function(i){var r,u,f,e;if(t.isNullOrUndefined(i))return!1;if(r=i.toString().split(","),r.length>0)for(u=0;u<r.length;u++)r[u]!=null&&(this._activeItem=parseInt(r[u]),this._activeItem<0&&(this._activeItem=0),f=n(this.element.children("li:not('.e-ghead')")[this._activeItem]),this.model.showCheckbox&&(n(f).find(".listcheckbox").ejCheckBox("isChecked")||(n(f).find(".listcheckbox").ejCheckBox("option","checked",!0),this.checkedStatus=!0,n.inArray(this._activeItem,this._checkedItems)>-1||this._checkedItems.push(this._activeItem),n.inArray(f[0],this.model.checkedIndices)>-1||this.model.checkedIndices.push(this._activeItem),e=this._getItemObject(f,null),e.isInteraction=!1,this.model.checkChange&&this._trigger("checkChange",e))));this._setSelectionValues()},uncheckItemsByIndices:function(i){var r,u,f,e,o,s;if(t.isNullOrUndefined(i))return!1;if(r=i.toString().split(","),r.length>0)for(u=0;u<r.length;u++)r[u]!=null&&(f=parseInt(r[u]),e=n(this.element.children("li:not('.e-ghead')")[parseInt(f)]),this.model.showCheckbox&&n(e).find(".listcheckbox").ejCheckBox("isChecked")&&(n(e).find(".listcheckbox").ejCheckBox("option","checked",!1),this.checkedStatus=!1,o=n.inArray(f,this.model.checkedIndices),n.inArray(f,this._checkedItems)>-1&&this._checkedItems.splice(o,1),o>-1&&this.model.checkedIndices.splice(o,1),s=this._getItemObject(e,null),s.isInteraction=!1,this.model.checkChange&&this._trigger("checkChange",s)));this._setSelectionValues()},selectAll:function(){var i,t,r;if(!this.model.showCheckbox&&this.model.allowMultiSelection)for(i=this.element.children("li:not('.e-ghead')"),t=0;t<i.length;t++)n(i[t]).hasClass("e-select")||n(i[t]).hasClass("e-disable")||(n(i[t]).addClass("e-select"),this._selectedItems.push(n(i[t])),this.model.selectedIndices.push(t),r=this._getItemObject(i,null),r.isInteraction=!1,this.model.select&&this._trigger("select",r));this._setSelectionValues()},unSelectAll:function(){this.unselectAll()},unselectAll:function(){return this.model.showCheckbox||this._removeListHover(),this._setSelectionValues(),this},selectItemsByIndex:function(n){this.selectItemsByIndices(n)},selectItemsByIndices:function(i){var u,r,e,f,o;if(t.isNullOrUndefined(i))return!1;if(u=i.toString().split(","),!this.model.showCheckbox&&this.model.allowMultiSelection)for(r=0;r<u.length;r++)u[r]!=null&&!isNaN(parseInt(u[r]))&&u[r]<this.element.children("li").length&&(e=parseInt(u[r]),this._activeItem=e,f=n(this.element.children("li:not('.e-ghead')")[this._activeItem]),f.hasClass("e-select")||(f.addClass("e-select"),this._selectedItems.push(f),this.model.selectedIndices.push(e),o=this._getItemObject(f,null),o.isInteraction=!1,this.model.select&&this._trigger("select",o)));this._setSelectionValues()},unselectItemsByIndex:function(n){this.unselectItemsByIndices(n)},unselectItemsByIndices:function(t){var r,i,u,f,e,o;if(this.model.showCheckbox)return!1;for(r=t.toString().split(","),i=0;i<r.length;i++)r[i]!=null&&(u=parseInt(r[i]),f=n(this.listItemsElement[u]),this._activeItem=u,f.removeClass("e-active e-select"),this.model.selectedIndex==u&&(this.model.selectedIndex=this._activeItem=null),e=this._selectedItems.indexOf(f[0]),this._selectedItems.splice(this.model.selectedIndices.indexOf(e),1),this.model.selectedIndices.splice(this.model.selectedIndices.indexOf(e),1),o=this._getItemObject(f,null),o.isInteraction=!1,this.model.unselect&&this._trigger("unselect",o));this._setSelectionValues()},unselectItemByIndex:function(t){var i,r,u;if(this.model.showCheckbox)return!1;t=parseInt(t);i=n(this.element.children("li:not('.e-ghead')")[t]);i.hasClass("e-select")&&(i.removeClass("e-active e-select"),this.model.selectedIndex==t&&(this.model.selectedIndex=this._activeItem=null),r=this._selectedItems.indexOf(i[0]),this._selectedItems.splice(this.model.selectedIndices.indexOf(r),1),this.model.selectedIndices.splice(this.model.selectedIndices.indexOf(r),1),u=this._getItemObject(i,null),u.isInteraction=!1,this.model.unselect&&this._trigger("unselect",u));this._setSelectionValues()},selectItemByText:function(n){t.isNullOrUndefined(n)||this[this.model.allowMultiSelection?"selectItemsByIndices":"selectItemByIndex"](this.getIndexByText(n))},selectItemByValue:function(n){this[this.model.allowMultiSelection?"selectItemsByIndices":"selectItemByIndex"](this.getIndexByValue(n))},unselectItemByText:function(n){this[this.model.allowMultiSelection?"unselectItemsByIndices":"unselectItemByIndex"](this.getIndexByText(n))},unselectItemByValue:function(n){this[this.model.allowMultiSelection?"unselectItemsByIndices":"unselectItemByIndex"](this.getIndexByValue(n))},getSelectedItems:function(){var t=[],i=this;return n(i.model.selectedIndices).each(function(n,r){t.push(i.getItemByIndex(r))}),t},getCheckedItems:function(){var t=[],i=this;return n(i.model.checkedIndices).each(function(n,r){t.push(i.getItemByIndex(r))}),t},removeItem:function(){return this.removeSelectedItems()},removeItemByText:function(n){return t.isNullOrUndefined(this.getItemByText(n))?!1:this.removeItemByIndex(this.getItemByText(n).index)},hideSelectedItems:function(){var n=this.getSelectedItems();this._hideOrShowItemsByIndex(n,"hide")},hideCheckedItems:function(){var n=this.getCheckedItems();this._hideOrShowItemsByIndex(n,"hide")},_hideOrShowItemsByIndex:function(t,i){if(n.type(t)=="number")i=="hide"?(n(this.listItemsElement[t]).hide(),n(this.listItemsElement[t]).next().hasClass("e-ghead")&&n(this.listItemsElement[t]).prev().hide()):(n(this.listItemsElement[t]).show(),n(this.listItemsElement[t]).prev().hasClass("e-ghead")&&n(this.listItemsElement[t]).prev().show());else for(var r=0;r<t.length;r++)i=="hide"?t[r].item?t[r].item.hide():n(this.listItemsElement[t[r]]).hide():t[r].item?t[r].item.show():n(this.listItemsElement[t[r]]).show();this._refreshScroller()},showItemsByIndices:function(n){this._hideOrShowItemsByIndex(n,"show")},hideItemsByIndices:function(n){this._hideOrShowItemsByIndex(n,"hide")},_hideOrShowItemsByValue:function(t,i){var u,r;if(n.type(t)=="array")for(r=0;r<this.listItemsElement.length;r++)for(u=0;u<=t.length;u++)n(this.listItemsElement[r]).text()==t[u]&&(i=="hide"?n(this.listItemsElement[r]).hide():n(this.listItemsElement[r]).show());else for(r=0;r<this.listItemsElement.length;r++)n(this.listItemsElement[r]).text()==t&&(i=="hide"?n(this.listItemsElement[r]).hide():n(this.listItemsElement[r]).show());this._refreshScroller()},showItemsByValues:function(n){this._hideOrShowItemsByValue(n,"show")},hideItemsByValues:function(n){this._hideOrShowItemsByValue(n,"hide")},showItemByValue:function(n){this._hideOrShowItemsByValue(n,"show")},hideItemByValue:function(n){this._hideOrShowItemsByValue(n,"hide")},showItemByIndex:function(n){this._hideOrShowItemsByIndex(n,"show")},hideItemByIndex:function(n){this._hideOrShowItemsByIndex(n,"hide")},hide:function(){this.listContainer.hide()},show:function(){this.listContainer.show()},hideAllItems:function(){this.element.find("li:visible").hide();this._refreshScroller()},showAllItems:function(){this.element.find("li:hidden").show();this._refreshScroller()},_stateMaintained:function(t){var e,f,r,u;if(this.model.disableItemsByIndex=[],this.model.selectedIndices=[],this.model.checkedIndices=[],this.model.selectedIndex>=t&&this.model.selectedIndex!=null&&(this.model.selectedIndex==t||n(this.element.children()[t-1]).hasClass("e-disable")?this.model.selectedIndex=null:this.model.selectedIndex!=t&&(this.model.selectedIndex-=1)),f=n(t).length,f>1){for(i=f;i>=0;i--)n(this.element.children()[t[i]]).remove();for(e=this.element.children().length,u=0;u<e;u++)n(this.element.children()[u]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(u)}else{for(r=t-1,r;r>=0;r--)n(this.element.children()[r]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(r),n(this.element.children()[r]).hasClass("e-select")&&this.model.selectedIndices.push(r),n(this.element.children()[r]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(r);for(t=parseInt(t)+1,t;t<this._listSize;t++)n(this.element.children()[t]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(t-1),n(this.element.children()[t]).hasClass("e-select")&&this.model.selectedIndices.push(t-1),n(this.element.children()[t]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(t-1)}},removeAll:function(){var i,r,f,u;if(t.isNullOrUndefined(this.dataSource()))return i=[],n(this.listItemsElement).each(function(t,r){i.push(n(this).text());r.remove()}),this._refreshItems(),i;if(!(this.dataSource()instanceof t.DataManager)){for(r=[],f=n(this.listItemsElement).length,u=0;u<f;u++)r.push(this._getRemovedItems([parseInt(0)]));return r}},removeItemByIndex:function(i){var u,r=this.model.selectedIndex;return t.isNullOrUndefined(this.dataSource())?(u=n(this.listItemsElement[i]).remove().text(),this._stateMaintained(i),this._refreshItems()):this.dataSource()instanceof t.DataManager||(u=this._getRemovedItems([parseInt(i)])),this.model.selectedIndex=i==r?null:i<r?r-1:r,u},removeSelectedItems:function(){if(this.model.showCheckbox)return!1;if(t.isNullOrUndefined(this.dataSource())){var i=this.value();return n(this.getSelectedItems()).each(function(n,t){t.item.remove()}),this._refreshItems(),i}if(!(this.dataSource()instanceof t.DataManager))return this.model.selectedIndex=null,this._getRemovedItems(this.model.selectedIndices)},_getRemovedItems:function(n){var t=[];return this._stateMaintained(n),this.value(null),this._activeItem=null,this.dataSource(this.dataSource().filter(function(i,r){if(n.indexOf(r)!=-1)t.push(i);else return!0})),this.refresh(!0),t},getIndexByValue:function(t){for(var r,i=0;i<this.listItemsElement.length;i++)if(n(this.listItemsElement[i]).text()==t){r=i;break}return r},getIndexByText:function(t){var r,t,i,u;for(this.model.allowMultiSelection&&(t=t.split(","),r=[]),i=0;i<this.listItemsElement.length;i++)if(typeof t=="object"){for(u=0;u<t.length;u++)if(n(this.listItemsElement[i]).text()==t[u]){r.push(i);break}}else if(n(this.listItemsElement[i]).text()==t){r=i;break}return r},getTextByIndex:function(t){return n(this.element.find("li:not('.e-ghead')")[t]).text()},getItemByText:function(t){var r=this,i;return this.listItemsElement.each(function(){if(n(this).text()==t)return i=r._getItemObject(n(this)),!1}),i},getItemByIndex:function(t){return this._getItemObject(n(this.element.children("li:not('.e-ghead')")[t]))},getListData:function(){return t.DataManager&&this.dataSource()instanceof t.DataManager?this.listitems:this.dataSource()?this.dataSource():void 0},enableItem:function(t){var i=this;this.listItemsElement.each(function(){if(n(this).text()==t)return n(this).removeClass("e-disable"),i.model.showCheckbox&&n(this).find(".listcheckbox").ejCheckBox("enable"),i._disabledItems.splice(n(this).index().toString()),!1})},disableItem:function(t){var i=this;this.listItemsElement.each(function(){if(n(this).text()==t)return n(this).addClass("e-disable"),i.model.showCheckbox&&n(this).find(".listcheckbox").ejCheckBox("disable"),i._disabledItems.push(n(this).index().toString()),!1})},moveUp:function(){if(!t.isNullOrUndefined(this.model.selectedIndex)){var n=this._getItem(this.model.selectedIndex).prev();this._moveItem(n,"up")}},moveDown:function(){if(!t.isNullOrUndefined(this.model.selectedIndex)){var n=this._getItem(this.model.selectedIndex).next();this._moveItem(n,"down")}},_moveItem:function(t,i){var f=this._getItem(this.model.selectedIndex),r=t.index(),e=this.element.children().length,o=i=="up"&&0<this.model.selectedIndex,s=i=="down"&&e-1>this.model.selectedIndex,u;if(this._addListHover(),this._getItem(this._selectedItem).removeClass("e-hover"),o?(t.insertAfter(f),this.model.selectedIndex-=1,t.hasClass("e-disable")&&n.inArray(r.toString(),this._disabledItems)>-1&&(this._disabledItems.splice(n.inArray(r.toString(),this._disabledItems),1),this._disabledItems.push((r+1).toString())),this._selectedItem-=1):s&&(t.insertBefore(f),this.model.selectedIndex+=1,t.hasClass("e-disable")&&n.inArray(r.toString(),this._disabledItems)>-1&&(this._disabledItems.splice(n.inArray(r.toString(),this._disabledItems),1),this._disabledItems.push((r-1).toString())),this._selectedItem+=1),o||s)for(this.model.selectedIndices=[],u=0;u<e;u++)n(this.element.children()[u]).hasClass("e-select")&&this.model.selectedIndices.push(u)},checkAll:function(){if(!this.model.showCheckbox)return!1;var t=this.element.find("li:not('.e-ghead')");for(i=0;i<t.length;i++)n(t[i].firstChild).find(".listcheckbox").ejCheckBox("isChecked")||(n(t[i].firstChild).find(".listcheckbox").ejCheckBox("option","checked",!0),this._checkedItems.push(t[i]),this.model.checkedIndices.push(i));this._setSelectionValues();this.model.uncheckAll=!1},unCheckAll:function(){this.uncheckAll()},uncheckAll:function(){if(!this.model.showCheckbox)return!1;var t=this.element.find("li:not('.e-ghead')");for(i=0;i<t.length;i++)n(t[i].firstChild).find(".listcheckbox").ejCheckBox("isChecked")&&n(t[i].firstChild).find(".listcheckbox").ejCheckBox("option","checked",!1);this._checkedItems=[];this.model.checkedIndices=[];this._setSelectionValues();this.model.checkAll=!1},addItem:function(r,u){var u=!t.isNullOrUndefined(u)&&u<=this.element.find("li:not('.e-ghead')").length?u:this.element.find("li:not('.e-ghead')").length,o=this,f=u,e;if(t.isNullOrUndefined(this.dataSource()))if(r instanceof Array)n(r).each(function(n,t){o.addItem(t,u);u=u+1});else{if(this.model.fields.groupBy&&typeof r=="object")for(_query=t.Query().group(this.model.fields.groupBy),groupedList=t.DataManager([r]).executeLocal(_query),this.dataSource([]),i=0;i<groupedList.length;i++)this._setMapFields(),this.dummyUl.push(t.buildTag("li.e-ghead",groupedList[i].key)[0]),this._loadlist(groupedList[i].items),this.dataSource(this.dataSource().concat(groupedList[i].items));else this.listitem=this.element.find("li:not('.e-ghead')").length?u-1<0?n(this.element.find("li:not('.e-ghead')")[0]).before('<li role="option">'+r+"<\/li>"):n(this.element.find("li:not('.e-ghead')")[u-1]).after('<li role="option">'+r+"<\/li>"):n(this.element).html('<li role="option">'+r+"<\/li>");this.listitems=this.element.find("li");this._addItemIndex=u;this.model.showCheckbox&&($checkbox=t.buildTag("input.listcheckbox e-align#popuplist"+(this.listitems.length-1)+"_"+this._id,"",{},{type:"checkbox",name:"list"+(this.listitems.length-1)}),n(this.listitems[u]).prepend($checkbox),n(n(this.listitems[u]).find(".listcheckbox")).ejCheckBox({change:n.proxy(this._onClickCheckList,this)}));(this.model.allowDrag||this.model.allowDrop)&&this._enableDragDrop();this._addItemIndex=null;this._refreshItems()}else if(!(this.dataSource()instanceof t.DataManager)){for(o.dataSource()instanceof Object?(dup={},r instanceof Object||(dup[o.model.fields.text]=r,r=dup)):r instanceof Array||(r=[r]),n(r).each(function(n,t){o.dataSource().splice(u,0,t);u=u+1}),this.model.disableItemsByIndex=[],this.model.selectedIndices=[],this.model.checkedIndices=[],this.model.selectedIndex>=f&&(this.model.selectedIndex+=1),e=f-1,e;e>=0;e--)n(this.element.children()[e]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(e),n(this.element.children()[e]).hasClass("e-select")&&this.model.selectedIndices.push(e),n(this.element.children()[e]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(e);for(f;f<this._listSize;f++)n(this.element.children()[f]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(f+1),n(this.element.children()[f]).hasClass("e-select")&&this.model.selectedIndices.push(f+1),n(this.element.children()[f]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(f+1);this.refresh(!0)}},enableItemByIndex:function(n){typeof n=="number"&&this.enableItemsByIndices(n.toString())},disableItemByIndex:function(n){typeof n=="number"&&this.disableItemsByIndices(n.toString())},disableItemsByIndices:function(i){var r,u,f;if(t.isNullOrUndefined(i))return!1;for(r=i.toString().split(","),u=0;u<r.length;u++)r.length>0&&!(n.inArray(r[u],this._disabledItems)>-1)&&(f=n(this.element.children("li:not('.e-ghead')")[parseInt(r[u])]).addClass("e-disable"),f.find(".listcheckbox").ejCheckBox("disable"),this._disabledItems.push(r[u]))},enableItemsByIndices:function(t){for(var f,i=t.toString().split(","),u,r=0;r<i.length;r++)i.length>0&&n.inArray(i[r],this._disabledItems)>-1&&(u=n.inArray(i[r],this._disabledItems),f=n(this.element.children("li:not('.e-ghead')")[parseInt(i[r])]).removeClass("e-disable"),f.find(".listcheckbox").ejCheckBox("enable"),this._disabledItems.splice(u,1))},_init:function(){this._id=this.element[0].id;this._isMozilla=t.browserInfo().name=="mozilla"?!0:!1;this._cloneElement=this.element.clone();this._deprecatedValue()._initialize()._render()._wireEvents();this._initValue=this.focused=!1;this._typeInterval=null;this._typingThreshold=2e3;this.model.checkAll&&this.checkAll();this.model.uncheckAll&&this.uncheckAll();this.model.disableItemsByIndex&&this.disableItemsByIndices(this.model.disableItemsByIndex.toString());this.model.enableItemsByIndex&&this.enableItemsByIndices(this.model.enableItemsByIndex.toString());this.model.uncheckItemsByIndex&&this.uncheckItemsByIndices(this.model.uncheckItemsByIndex.toString());this._deprecatedValue()._enabled(this.model.enabled)},_deprecatedValue:function(){return this.model.itemDrop=this.model.itemDrop||this.model.itemDropped,this.model.change=this.model.change||this.model.selectIndexChanged,this.model.fields.checkBy=this.model.fields.selected||this.model.fields.checkBy,this.model.fields.tooltipText=this.model.fields.toolTipText||this.model.fields.tooltipText,this.model.fields.groupBy=this.model.fields.category||this.model.fields.groupBy,this.model.select=this.model.select||this.model.selected,this.model.allowDragAndDrop!=r&&(this.model.allowDrag=this.model.allowDrop=!0),this.model.selectedIndex=this.model.selectedIndex!=null?this.model.selectedIndex:this.model.selectedItemIndex,this.model.checkedIndices=(this.model.checkedIndices.length?this.model.checkedIndices:null)||(this.model.checkItemsByIndex?this.model.checkItemsByIndex:null)||(this.model.checkedItems.length?this.model.checkedItems:null)||(this.model.checkedItemlist.length?this.model.checkedItemlist:[]),this.model.selectedIndices=(this.model.selectedIndices.length?this.model.selectedIndices:null)||(this.model.selectedItems.length?this.model.selectedItems:null)||(this.model.selectedItemlist.length?this.model.selectedItemlist:[]),this},_setModel:function(i){var r,f=!1,o,u,c,e;for(r in i)switch(r){case"value":this._setText(t.util.getVal(i[r]));break;case"dataSource":t.isNullOrUndefined(this._isCasCadeTarget)||(this.model.selectedIndex=null);i[r]=t.util.getVal(i[r]);this._checkModelDataBinding(i[r]);break;case"query":this._queryCheck(i[r]);break;case"fields":this.model.fields=n.extend(this.model.fields,i[r]);this._checkModelDataBinding(this.dataSource());break;case"template":this.model.template=i[r];this.refresh(!0);break;case"loadDataOnInit":this._loadContent=i[r];this._checkModelDataBinding(this.dataSource());break;case"enableRTL":this.model.enableRTL=i[r];this.model.enableRTL?this.listContainer.addClass("e-rtl"):this.listContainer.removeClass("e-rtl");break;case"enabled":this.model.enabled=i[r];this._enabled(i[r]);break;case"enableWordWrap":this.model.enableWordWrap=i[r];this._wordWrapItems(i[r]);break;case"height":case"width":this.model[r]=i[r];this._setDimensions();break;case"cssClass":this.model.cssClass=i[r];this.listContainer.addClass(this.model.cssClass);break;case"showCheckbox":this._checkboxHideShow(i[r]);i[r]&&this._removeListHover();break;case"showRoundedCorner":this.model.showRoundedCorner=i[r];this._roundedCorner();break;case"selectedItemIndex":case"selectedIndex":this.listitem[i[r]]||i[r]==null||this.listitems[i[r]]?(this.selectItemByIndex(i[r]),this.model.selectedIndex=this.model.selectedItemIndex=i[r]):i[r]=this.model.selectedIndex;break;case"sortOrder":this.model.sortOrder=i[r];this.dataSource()!=null?this._showFullList():this._renderlistContainer();break;case"checkItemsByIndex":case"checkedItemlist":case"checkedItems":case"checkedIndices":this.uncheckAll();this.checkItemsByIndices(i[r].toString());i[r]=this.model[r]=this.model.checkedIndices;break;case"uncheckItemsByIndex":this.uncheckItemsByIndices(i[r].toString());this.model[r]=i[r];break;case"selectedItemlist":case"selectedItems":case"selectedIndices":this.unselectAll();this.selectItemsByIndices(i[r].toString());i[r]=this.model.selectedIndices;break;case"enableItemsByIndex":this.model[r]=i[r];this.enableItemsByIndices(i[r].toString());break;case"disableItemsByIndex":this.model[r]=i[r];this.disableItemsByIndices(i[r].toString());break;case"enableVirtualScrolling":this.model.allowVirtualScrolling=i[r];f=!0;break;case"allowDrag":case"allowDrop":case"allowDragAndDrop":case"allowVirtualScrolling":case"virtualScrollMode":this.model[r]=i[r];f=!0;break;case"checkAll":this.model[r]=i[r];i[r]?this.checkAll():this.uncheckAll();break;case"uncheckAll":this.model[r]=i[r];i[r]?this.uncheckAll():this.checkAll();break;case"htmlAttributes":this._addAttr(i[r]);break;case"itemsCount":o=this.model.itemsCount;this.model.height?(this.model.itemsCount=i[r],this._setItemsCount()._setDimensions()):i[r]=o;break;case"itemHeight":var s=this.listItemsElement,h=t.isNullOrUndefined(i[r])?i[r]:i[r].toString().replace("px",""),l=t.isNullOrUndefined(this.model.itemHeight)?this.model.itemHeight:this.model.itemHeight.toString().replace("px","");for(u=0;u<s.length;u++)c=t.isNullOrUndefined(i[r])?{"min-height":t.isNullOrUndefined(this.model.itemHeight)?"20px":l}:{"min-height":h+"px",height:h+"px"},s.eq(u).css(c);this.refresh();break;case"allowMultiSelection":this.model.allowMultiSelection=i[r];i[r]||(e=this.model.selectedIndex,this._removeListHover(),t.isNullOrUndefined(e)?"":this.selectItemByIndex(e));break;case"totalItemsCount":t.isNullOrUndefined(this.dataSource())||(this.model.totalItemsCount=i[r],this.model.query&&this._queryCheck(this.model.query))}f&&this._refresh()},_destroy:function(){return t.isNullOrUndefined(this._lilist)||n(this._lilist).ejDraggable("destroy"),this.element.insertAfter(this.listContainer),this.element.find(".e-chkbox-wrap").remove(),this.listContainer.remove(),this._isList||this.element.empty(),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._ListEventUnbind(this.element.children("li")),this},_ListEventUnbind:function(t){t.off("contextmenu",n.proxy(this._OnMouseContext,this));t.off("click",n.proxy(this._OnMouseClick,this));t.off("touchstart mouseenter",n.proxy(this._OnMouseEnter,this));t.off("touchend mouseleave",n.proxy(this._OnMouseLeave,this))},_refresh:function(){this._destroy()._init()},_finalize:function(){return this.model.selectedIndex!=null?this.selectItemByIndex(this.model.selectedIndex):this.model.showCheckbox==!0&&this._selectedItems.length>0&&this._selectCheckedItem(this._selectedItems),this.model.checkedIndices!=null&&this.checkItemsByIndices(this.model.checkedIndices.toString()),this},_initialize:function(){return this._isList=this.element.children().length?!0:!1,this.target=this.element[0],this._queryString=null,this._disabledItems=[],this._itemId=null,this._up=this._down=this._ctrlClick=!1,this.checkedStatus=this._isScrollComplete=!1,this._incqueryString="",this._activeItem=null,this._initValue=!0,this.model.allowVirtualScrolling=this.model.allowVirtualScrolling?this.model.allowVirtualScrolling:this.model.enableLoadOnDemand,this.model.virtualScrollMode=this.model.enableVirtualScrolling?"continuous":this.model.virtualScrollMode,this._selectedItems=[],this._checkedItems=[],this._loadContent=this.model.loadDataOnInit,this._loadInitialRemoteData=!0,this._skipInitialRemoteData=!1,this.model.enableVirtualScrolling&&(this.model.allowVirtualScrolling=!0),this._setItemsCount(),this},_render:function(){return this._savedQueries=this.model.query.clone(),this.model.totalItemsCount&&this._savedQueries.take(this.model.totalItemsCount),this._renderContainer()._addAttr(this.model.htmlAttributes),t.DataManager&&this.dataSource()instanceof t.DataManager?(this.model.actionBegin&&this._trigger("actionBegin",{}),this._loadInitialRemoteData&&this._initDataSource(this.dataSource())):this._showFullList(),this.dataSource()||this._finalize(),this.listItemsElement=this.element.find("li:not('.e-ghead')"),this.model.showRoundedCorner&&this._roundedCorner(),this},_queryCheck:function(n){this._savedQueries=n.clone();this.element.empty();this.dataSource()&&this._checkModelDataBinding(this.dataSource())},_checkModelDataBinding:function(n){this.mergeValue=null;this.dataSource(n);n!=null&&n.length!=0?t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._showFullList():(this.element.empty(),this._refreshScroller())},_initDataSource:function(n){var t=this,i;t.listitems=t.dataSource();t._updateLoadingClass(!0);i=n.executeQuery(this._getQuery());i.done(function(n){t.listitems=n.result;t._updateLoadingClass()._showFullList()._trigger("actionSuccess",n);t._finalize()}).fail(function(n){t.dataSource(null);t._updateLoadingClass(!0)._trigger("actionFailure",n)}).always(function(n){t.model.checkAll&&t.checkAll();t.model.uncheckAll&&t.uncheckAll();t._trigger("actionComplete",n)})},_getQuery:function(){var i,r,n,u;if(t.isNullOrUndefined(this.model.query)){r=[];n=this.model.fields;i=t.Query();for(u in n)u!=="tableName"&&r.push(n[u]);r.length>0&&i.select(r);this.dataSource().dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this._savedQueries;return i},_addDragableClass:function(){if(this.model.allowDrag||this.model.allowDrop){this.element.css("cursor","pointer");this.model.allowDrop&&(this.listContainer.addClass("e-droppable"),this.listBoxScroller.addClass("e-droppable"));var t=this;this.element.children("li").each(function(){t.model.allowDrag&&n(this).addClass("e-draggable");t.model.allowDrop&&n(this).addClass("e-droppable")})}return this},_enableDragDrop:function(){(this.model.allowDrag||this.model.allowDrop)&&this._drag()},_updateLoadingClass:function(n){return this.listContainer[n?"addClass":"removeClass"]("e-load"),this},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.listContainer.addClass(n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._enabled(!1):i.listContainer.attr(t,n)})},_renderContainer:function(){return this.listContainer=t.buildTag("div.e-ddl-popup e-box e-popup e-widget "+this.model.cssClass,"",{visibility:"hidden"},{tabIndex:0,id:this._id+"_container"}),this.listBoxScroller=t.buildTag("div"),this.ultag=t.buildTag("ul.e-ul","",{},{role:"listbox"}),this.element=this.element.addClass("e-ul"),this.listContainer.append(this.listBoxScroller).insertAfter(this.element),this.listBoxScroller.append(this.element),this.element.attr("unselectable","on").css("user-select","none"),this._hiddenInput=t.buildTag("input#"+this._id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element),this._hiddenInput.attr("name",this._id),this},_setMapFields:function(){mapper=this.model.fields;this.mapFld={_id:null,_imageUrl:null,_imageAttributes:null,_tooltipText:null,_spriteCSS:null,_text:null,_value:null,_htmlAttributes:null,_selectBy:null,_checkBy:null};this.mapFld._id=mapper&&mapper.id?mapper.id:"id";this.mapFld._imageUrl=mapper&&mapper.imageUrl?mapper.imageUrl:"imageUrl";this.mapFld._tooltipText=mapper&&mapper.tooltipText?mapper.tooltipText:"tooltipText";this.mapFld._imageAttributes=mapper&&mapper.imageAttributes?mapper.imageAttributes:"imageAttributes";this.mapFld._spriteCSS=mapper&&mapper.spriteCssClass?mapper.spriteCssClass:"spriteCssClass";this.mapFld._text=mapper&&mapper.text?mapper.text:this.listitems[0].text?"text":this._getObjectKey(this.listitems[0])[0];this.mapFld._value=mapper&&mapper.value?mapper.value:"value";this.mapFld._htmlAttributes=mapper&&mapper.htmlAttributes?mapper.htmlAttributes:"htmlAttributes";this.mapFld._checkBy=mapper&&mapper.checkBy?mapper.checkBy:"checkBy";this.mapFld._selectBy=mapper&&mapper.selectBy?mapper.selectBy:"selectBy";this.mapCateg=mapper&&mapper.groupBy?mapper.groupBy:""},_getObjectKey:function(n){var t,i;if(Object.keys)return Object.keys(n);t=[];for(i in n)n.hasOwnProperty(i)&&t.push(i);return t},_itemStyle:function(){var n=t.isNullOrUndefined(this.model.itemHeight)?this.model.itemHeight:this.model.itemHeight.toString().replace("px",""),i=t.isNullOrUndefined(this.model.itemHeight)?"min-height:20px;":"min-height:"+n+"px;height:"+n+"px";return{style:i}},sort:function(){var t=document.createElement("ul"),o,r,s,u,i,f;if(n(t).append(this.itemsContainer.children()),this.model.fields.groupBy!=null||n(t).find(">.e-ghead").length>0){for(o=0;o<n(t).find(">.e-ghead").length;o++)r=n(t).find(">.e-ghead").eq(0).first().nextUntil(".e-ghead").get(),this._setSortList(t,r);for(s=document.createElement("ul"),u=n(t).clone().find(">.e-ghead").get(),f=0;f<u.length;f++)s.append(u[f]);var e=this._customSort(s,u),h=document.createElement("ul"),c,a=n(t).find("li.e-ghead").get();for(this.model.sortOrder.toLowerCase()=="descending"&&e.reverse(),i=0;i<e.length;i++)for(h.append(e[i]),l=0;l<a.length;l++)if(e[i].textContent==a[l].textContent)for(c=n(t).find(">.e-ghead").eq(l).first().nextUntil(".e-ghead").get(),m=0;m<c.length;m++)h.append(c[m]);this.itemsContainer=n(h)}else r=n(t).children("li").get(),this._setSortList(t,r),this.itemsContainer=n(t)},_customSort:function(t,i){return i.sort(function(t,i){var r=n(t).text().toUpperCase(),u=n(i).text().toUpperCase();return r<u?-1:r>u?1:0}),i},_setSortList:function(t,i){this._customSort(t,i);this.model.sortOrder.toLowerCase()=="descending"&&i.reverse();(this.model.fields.groupBy!=null||n(t).find(">.e-ghead").length>0)&&(n(t).append(n("<li>").text(n(t).find(">.e-ghead").eq(0).text()).addClass("e-ghead")),n(t).find(">.e-ghead").eq(0).remove());n.each(i,function(i,r){n(t).append(r)})},_renderlistContainer:function(){var e,s,d,c,l,u,o,y,a,p,i,w,b,h,v,k,f;if(this.hold=this.touchhold=!1,this.item="",this.startime=0,this.listitemheight=24,e=this.listitems,d=this.model.fields,this.lastScrollTop=-1,this.dummyUl=n(),this.model.enableRTL&&this.listContainer.addClass("e-rtl"),this._wordWrapItems(),this.dataSource()==null||this.dataSource().length<1)c=this.element.parents().last(),this.docbdy=this.model.targetID?c.find("#"+this.model.targetID):c.find("#"+this._id),this.itemsContainer=this.docbdy,this.model.sortOrder!="none"&&this.sort(),this.itemsContainer.children("ol,ul").remove(),this.items=this.itemsContainer.children("li"),this.items.children("img").addClass("e-align"),this.items.children("div").addClass("e-align"),l=parseInt(this.model.itemHeight)+"px",this.model.itemHeight&&n("li").css({"min-height":l,height:l}),this.element.append(this.itemsContainer.children());else if(this.dataSource()!=null&&typeof e[0]!="object")if(this._loadInitialRemoteData&&this.mergeValue&&this.model.virtualScrollMode=="continuous"&&this.model.totalItemsCount)this._loadlist(this.mergeValue);else if(this._loadInitialRemoteData&&this.mergeValue&&this.model.virtualScrollMode=="normal"&&this.model.totalItemsCount){for(this.realUllength=0,this.mergeUl=[],i=0;i<this.mergeValue.length;i++)this.mergeUl.push(t.buildTag("li",this.mergeValue[i][this.model.fields.text],null,this._itemStyle())[0]);for(this.element.append(this.mergeUl),i=0;i<this.model.totalItemsCount-this.mergeValue.length;i++)this.dummyUl.push(t.buildTag("li",null,null,this._itemStyle())[0]);this.element.append(this.dummyUl);this._refreshScroller()}else this._loadInitialRemoteData&&this.mergeValue&&!this.model.totalItemsCount&&this._initDataSource(this.dataSource());else if(this._setMapFields(),o=this._savedQueries,this.listContainer.height(this.model.height),this.listitemheight=24,this.model.allowVirtualScrolling){if(this.model.virtualScrollMode=="normal"){if(this.realUllength=0,this.dataSource().length<0&&(query=this._savedQueries.take(parseInt(this.listContainer.height()/this.listitemheight)),f=this,t.DataManager&&this.dataSource()instanceof t.DataManager&&(f.listitems=f.dataSource(),y=this.dataSource().executeQuery(query),y.done(function(n){f._trigger("actionBeforeSuccess",n);f.listitems=n.result;f._trigger("actionSuccess",n)}).fail(function(n){f._trigger("actionFailure",n)}).always(function(n){f._trigger("actionComplete",n)}))),this.mergeValue&&this.mergeValue!=u&&this.mergeValue!=r){for(this.mergeUl=[],i=0;i<this.mergeValue.length;i++)a=t.buildTag("li",this.model.template?"":this.mergeValue[i][this.model.fields.text],null,this._itemStyle())[0],this.model.template&&a.append(this._getTemplatedString(e[i])),this.mergeUl.push(a[0]);this.element.append(this.mergeUl)}for(p=this.model.totalItemsCount?this.mergeValue?this.model.totalItemsCount-this.mergeValue.length:this.model.totalItemsCount:this.listitems.length,i=0;i<p;i++)w=t.buildTag("li",null,null,this._itemStyle()),this.dummyUl.push(w[0]);this.element.append(this.dummyUl)}this._loadInitialData(o,e)}else if(this.mapCateg&&this.mapCateg!="")for(o=t.Query().group(this.mapCateg),this.model.sortOrder.toLowerCase()=="none"&&o.queries.splice(0,1),u=t.DataManager(e).executeLocal(o),this.model.sortOrder.toLowerCase()!="none"&&(b=t.Query().sortBy(this.mapFld._text,this.model.sortOrder,!0),u=t.DataManager(u).executeLocal(b)),this.dataSource([]),i=0;i<u.length;i++)this.dummyUl.push(t.buildTag("li.e-ghead",u[i].key)[0]),this._loadlist(u[i].items),this.dataSource(this.dataSource().concat(u[i].items));else if(u=t.DataManager(e).executeLocal(o),u.length>0){if(this.mergeValue&&this.mergeValue!=u&&this.mergeValue!=r)for(this.mergeUl=[],i=0;i<this.mergeValue.length;i++)this.mergeUl.push(t.buildTag("li",this.mergeValue[i][this.model.fields.text],null,this._itemStyle())[0]),u.push(this.mergeValue[i]);if(this.model.template!=null&&this._loadContent){for(i=0;i<e.length;i++)h=this._getField(e[i],this.mapFld._htmlAttributes),v=this._getField(e[i],this.mapFld._id),s=t.buildTag("li"),h&&h!=""&&s.attr(h),v&&s.attr("id",v),this.model.template&&s.append(this._getTemplatedString(e[i])),this.dummyUl.push(s[0]);this.model.allowVirtualScrolling||this.element.children().remove();k=this.model.virtualScrollMode=="continuous"&&this.mergeValue?this.realUllength+this.mergeValue.length:this.realUllength;this.element.children()[k]==null&&(!this.model.allowVirtualScrolling||this.model.virtualScrollMode==t.VirtualScrollMode.Continuous)&&this._loadContent&&this.element.append(this.dummyUl)}else this.realUllength=0,this._loadlist(u)}f=this;u&&(this.listitems=u);this._setDimensions();this.listContainer.css({position:"relative",height:""});this.listBoxScroller.css({height:"",width:""});this.listContainer.ejScroller({height:this.listContainer.height(),width:0,scrollerSize:20,scroll:function(n){(n.source=="key"||n.source=="wheel"||n.source!="button"&&n.source!="thumb"&&n.source!="custom")&&f.model!=null&&f._onScroll(n)},thumbEnd:function(n){f.model!=null&&f._onScroll(n)},scrollEnd:function(n){n.scrollData.source=="button"&&f.model!=null&&f._onScroll(n)}});this.scrollerObj=this.listContainer.ejScroller("instance");this._setDimensions();this.listContainer.css({display:"none",visibility:"visible"});this._checkboxHideShow(this.model.showCheckbox)._checkitems()._showResult();this.model.totalItemsCount&&this._setTotalItemsCount()},_wordWrapItems:function(){this.model.enableWordWrap?this.listContainer.addClass("e-wrap").removeClass("e-nowrap"):this.listContainer.addClass("e-nowrap").removeClass("e-wrap")},_loadInitialData:function(n,u){var f=n.clone();if(this.realUllength=0,f=t.DataManager&&this.dataSource()instanceof t.DataManager?f.range(0,parseInt(this.listContainer.height()/this.listitemheight)):f.range(0,this.listitems.length),groupedList=t.DataManager(u).executeLocal(f),this.mergeValue&&this.mergeValue!=groupedList&&this.mergeValue!=r&&this.model.virtualScrollMode=="continuous"){for(this.mergeUl=[],i=0;i<this.mergeValue.length;i++)this.mergeUl.push(t.buildTag("li",this.mergeValue[i][this.model.fields.text],null,this._itemStyle())[0]);this.element.append(this.mergeUl)}(!this.mergeValue||this.mergeValue&&this._loadInitialRemoteData)&&this._loadlist(groupedList)},_loadlist:function(i){var o,w,r,s,u,f;if(this.element!=null){for(o=[],this.model.sortOrder.toLowerCase()!="none"&&(w=t.Query().sortBy(this.mapFld._text,this.model.sortOrder,!0),i=t.DataManager(i).executeLocal(w)),r=0;r<i.length;r++){var b=this._getField(i[r],this.mapFld._id),c=this._getField(i[r],this.mapFld._imageUrl),l=this._getField(i[r],this.mapFld._imageAttributes),a=this._getField(i[r],this.mapFld._spriteCSS),h=this._getField(i[r],this.mapFld._text),v=this._getField(i[r],this.mapFld._value),y=this._getField(i[r],this.mapFld._htmlAttributes),k=this._getField(i[r],this.mapFld._selectBy),d=this._getField(i[r],this.mapFld._checkBy),p=this._getField(i[r],this.mapFld._tooltipText),e=this.model.virtualScrollMode=="continuous"&&this.mergeValue?this.realUllength+this.mergeValue.length:this.realUllength;litag=v&&v!=""?t.buildTag("li","","",n.extend(this._itemStyle(),{value:v})):t.buildTag("li",null,null,this._itemStyle());b&&litag.attr("id",b);c&&c!=""&&(imgtag=t.buildTag("img.e-align","",{},{src:c,alt:h}),l&&l!=""&&imgtag.attr(l),litag.append(imgtag));a&&a!=""&&(divtag=t.buildTag("div.e-align "+a+" sprite-image"),litag.append(divtag));h&&h!=""&&(this.model.template?litag.append(this._getTemplatedString(i[r])):litag.append(h));y&&y!=""&&litag.attr(y);p&&p!=""&&litag.attr("data-content",p).addClass("e-tooltip");(d||this.model.checkAll)&&litag.addClass("checkItem");(k||this.model.selectAll)&&litag.addClass("selectItem");this.element.children()[e]!=null&&this.model.allowVirtualScrolling&&n(this.element.children()[e]).text()==""?n(this.element.children()[e]).replaceWith(litag[0]):this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal"?this.model.template?n(this.dummyUl[e]).replaceWith(litag[0]):n(this.dummyUl[e]).text(n(litag[0]).text()):this.dummyUl.push(litag[0]);this.realUllength+=1}if(this.model.allowVirtualScrolling||this.element.children().remove(),this.element.children()[e]==null&&(!this.model.allowVirtualScrolling||this.model.virtualScrollMode==t.VirtualScrollMode.Continuous)&&this._loadContent&&this.element.append(this.dummyUl),s=this.element.find("li:not('.e-ghead')"),this.listItemsElement=this.element.find("li:not('.e-ghead')"),this.model.showCheckbox&&this.model.checkedIndices)for(u=0;u<s.length;u++)this.model.checkedIndices.indexOf(u)!=-1&&n(s[u]).addClass("checkItem");else if(!this.model.showCheckbox)for(this.value()==""||this.mapCateg||!this.mapCateg==""||this.selectItemByText(this.value()),u=0;u<s.length;u++)(this.model.selectedIndices.indexOf(u)!=-1||this.model.selectedIndex==u)&&n(s[u]).addClass("selectItem");this.element.find(".selectItem").each(function(t,i){o.push(n(i).parent().find("li").index(n(i)))});f=this;f.model.showCheckbox||this.mapCateg||!this.mapCateg==""||f._selectListItems();this.element.find(".checkItem").each(function(n,t){f.model.checkedIndices.push(f._elementIndex(t))});this.mapCateg||!this.mapCateg==""||(o.length&&(this.model.allowMultiSelection?this.model.selectedIndices=o:this.model.selectedIndex=o[0]),this.model.checkedIndices?this.model.checkedIndices=n.grep(f.model.checkedIndices,function(t,i){return i==n.inArray(t,f.model.checkedIndices)}):this.model.selectedIndices&&(this.model.selectedIndices=n.grep(f.model.selectedIndices,function(t,i){return i==n.inArray(t,f.model.selectedIndices)})));this._loadContent=!0}return this},_applySelection:function(){if(!(this.model.fields.checkBy||this.model.fields.selectBy))return!1;this.model.showCheckbox?(this.uncheckAll(),this.checkItemsByIndices(this.model.checkedIndices)):this.model.allowMultiSelection?this.selectItemsByIndices(this.model.selectedIndices):(this.unselectAll(),this.selectItemByIndex(this.model.selectedIndex))},_getField:function(n,i){return t.pvt.getObject(i,n)},_getTemplatedString:function(n){for(var t=this.model.template,i=t.indexOf("${"),r=t.indexOf("}"),u,f;i!=-1&&r!=-1;)u=t.substring(i,r+1),f=u.replace("${","").replace("}",""),t=t.replace(u,this._getField(n,f)),i=t.indexOf("${"),r=t.indexOf("}");return t},_checkboxHideShow:function(n){return this.model.showCheckbox=n,n?this._createCheckbox():this._removeCheckbox(),this},_createCheckbox:function(){var i,f,e=this,r,u;for(this._listitems=this.listContainer.find("ol,ul").length>0?this.listContainer.find("ol,ul").children("li:not('.e-ghead')"):this.element.children("li:not('.e-ghead')"),f=this._listitems.find("input[type=checkbox]"),i=0;i<this._listitems.length;i++)n(this._listitems[i]).text()!=""&&($checkbox=t.buildTag("input.listcheckbox e-align#popuplist"+i+"_"+this._id,"",{},{type:"checkbox",name:"list"+i}),n(this._listitems[i]).find("input[type=checkbox]").length||n(this._listitems[i]).prepend($checkbox));for(this.listContainer.find(".listcheckbox").ejCheckBox({cssClass:this.model.cssClass,change:n.proxy(this._onClickCheckList,this)}),i=0;i<this._listitems.length;i++)r=n(this._listitems[i]).find(".listcheckbox"),n(this._listitems[i]).hasClass("e-disable")?r.ejCheckBox("disable"):n(this._listitems[i]).hasClass("checkItem")&&!r.ejCheckBox("isChecked")&&(r.ejCheckBox({checked:!0}),this._activeItem=i,this.checkedStatus=!0,u=this._getItemObject(n(this._listitems[i]),null),u.isInteraction=!0,this._initValue||this._trigger("checkChange",u),n(this._listitems[i]).removeClass("checkItem"));for(i=0;i<this.model.selectedIndices.length;i++)this.checkItemsByIndices(this.model.selectedIndices)},_removeCheckbox:function(){var n,t;if(this.listitem=this.listContainer.find("ol,ul").children("li"),t=this.listitem.find(".listcheckbox"),t.length>0){if(this.listitem.find(".listcheckbox").ejCheckBox("destroy"),this.listitem.find("input[type=checkbox]").remove(),this.model.allowMultiSelection)for(n=0;n<this.model.checkedIndices.length;n++)this.selectItemsByIndices(this.model.checkedIndices);else this.selectItemByIndex(this.model.checkedIndices[0]);this._checkedItems=this.model.checkedIndices=[]}},_selectCheckedItem:function(n){if(n.length>0)for(i=0;i<n.length;i++)this._selectedItems.push(n[i])},_refreshScroller:function(){if(this.model.virtualScrollMode=="continuous")this.listContainer.find(".e-content, .e-vhandle,.e-vhandle div").removeAttr("style"),this.listContainer.css({display:"block"}),this.scrollerObj&&(this.scrollerObj.model.height=this.listContainer.height(),this.scrollerObj.refresh(),this.scrollerObj.option("scrollTop",0));else{this.listContainer.find(".e-vhandle div").removeAttr("style");var n=this.listBoxScroller.height();this.listContainer.css({display:"block"});this.scrollerObj&&(this.scrollerObj.model.height=this.listContainer.css("height"),this.scrollerObj.refresh());this.listBoxScroller.css("height","100%")}this.model.enabled||this.scrollerObj&&this.scrollerObj.disable();this.listContainer.css("height",this.model.height)},_setDimensions:function(){return this.listContainer.css({width:this.model.width,height:this.model.height}),this._refreshScroller(),this},_setItemsCount:function(){return this.model.height=="auto"?this.model.height=this.model.itemsCount&&this.model.itemsCount!=0&&this.model.height=="auto"?this.model.itemsCount*30:this.model.height=="auto"?"220":this.model.height:this.model.height!="auto"&&this.model.itemsCount?this.model.height=this.model.itemHeight?this.model.height=="auto"?"220":this.model.itemsCount*this.model.itemHeight.replace(/[^-\d\.]/g,""):this.model.height=="auto"?"220":this.model.itemsCount*30:this.model.height!="auto"&&this.model.itemsCount!=0&&this.model.height,this},_setTotalItemsCount:function(){this.model.virtualScrollMode!="continuous"&&(this.element.height(this.element.find("li").outerHeight()*this.model.totalItemsCount),this.scrollerObj.refresh())},_refreshContainer:function(){this.listContainer.css({position:"relative"});this._setDimensions()._roundedCorner()._refreshScroller()},_drag:function(){var i=this,u=!1,r=null;this._listitem=this.element.parent();this._lilist=this._addItemIndex?n(n(this._listitem).find("li")[this._addItemIndex]):n(this._listitem).find("li");this._lilist.not(".e-js").ejDraggable({dragArea:null,clone:!0,dragStart:function(t){var f,u;if(i.model.allowDrag||i.model.allowDragAndDrop){if(n(t.element.closest(".e-ddl-popup.e-js")).hasClass("e-disable")||t.element.hasClass("e-disable"))return r&&r.remove(),!1;if(f=n("#"+this.element.parent()[0].id).data("ejListBox"),f._refreshItems(),u=i.getSelectedItems(),u.length>1?i._onDragStarts(u,t.target):i._onDragStarts([i._getItemObject(t.element,t)],t.target))return t.cancel=!0,r&&r.remove(),!1}else return!1},drag:function(t){var r=t.target,u=i.getSelectedItems();if(u.length>1?i._onDrag(u,r):i._onDrag([i._getItemObject(t.element,t)],r))return!1;(n(r).hasClass("e-droppable")||n(r).parent().hasClass("e-droppable"))&&n(r).addClass("allowDrop")},dragStop:function(t){t.element.dropped||r&&r.remove();var f=t.target,o=i,s=u?"Before":"After",e=i.getSelectedItems();if((e.length>1?i._onDragStop(e,f):i._onDragStop([i._getItemObject(t.element,t)],f))||(n(t.element).removeClass("e-active"),f.nodeName=="UL"&&(f=n(f).children()[0]),n(f).closest("li").length?f=n(t.target).closest("li")[0]:f.nodeName!="LI"&&(f=n(f).closest(".e-ddl-popup.e-droppable")[0]),f&&f.nodeName=="LI"&&n(f).hasClass("e-droppable")&&n(f).closest(".e-ddl-popup.e-droppable").length?i._dropItem(f,t.element,u,t.event):n(f).hasClass("e-droppable")&&n(f).closest(".e-ddl-popup.e-droppable").length&&i._dropItemContainer(f,t.element,t.event),n(".allowDrop").removeClass("allowDrop"),t.target!=i.element[0]&&t.element.parent().length&&n(t.element.parent()[0]).data().ejWidgets[0]=="ejListBox"&&(i=n("#"+t.element.parent()[0].id).data(n(t.element.parent()[0]).data().ejWidgets[0]),e.length>1?i._onDropped(e,f):i._onDropped([i._getItemObject(t.element),t],t.target))))return!1;i.model.allowDrag||i.model.allowDragAndDrop||i.element.children().removeClass("e-draggable")},helper:function(u){if(!t.isNullOrUndefined(u.element)&&!n(u.element.closest(".e-ddl-popup.e-js")).hasClass("e-disable")&&n(u.element).hasClass("e-draggable")&&(i=n(u.element).closest(".e-listbox.e-js").data("ejListBox"),i._tempTarget=n(u.element).text(),(i.model.allowDrag||i.model.allowDragAndDrop)&&i))return r=n(u.sender.target).clone().addClass("dragClone dragClonelist"),r.addClass(i.model.cssClass+(i.model.enableRTL?" e-rtl":"")),r.css({width:i.element.width(),padding:"5px 5px 5px 0.857em","list-style":"none","text-align":i.model.enableRTL?"right":"left",opacity:"1"}),r.appendTo(n("body"))}})},_dropItem:function(t,i,r,u){var o;i.addClass("e-droppable");var h=n(t).closest(".e-ddl-popup.e-droppable")[0].id.replace("_container",""),s=[],f=[],e=n("#"+h).data("ejListBox"),c=e.model.showCheckbox?!this.model.showCheckbox:this.model.showCheckbox;c||(o=this._getDropObject(t,i,u),s=o.dataIndex,f=o.dataObj,r?n(li).insertBefore(t):n(li).insertAfter(t),this._refreshItems(),f&&this.dataSource()&&this._dropDataSource(e,s,f,li.index()),e._refreshItems())},_dropItemContainer:function(t,i,r){i.addClass("e-droppable");var s=n(t)[0].id.replace("_container",""),u=n("#"+s).data("ejListBox"),h=u.model.showCheckbox?!this.model.showCheckbox:this.model.showCheckbox;if(!h){var e=[],f=[],o=this._getDropObject(t,i,r);e=o.dataIndex;f=o.dataObj;li.insertAfter(n(n(t).find("li")).last());n(t).find("ul").length>0?n(t).find("ul").append(li):n(t).find("ej-listbox").append(li);this._refreshItems();f&&this.dataSource()&&this._dropDataSource(u,e,f,u.dataSource()?u.dataSource().length:0);u.model.allowDrag||n(li).ejDraggable("instance")._destroy();u._refreshItems()}},_dropDataSource:function(i,r,u,f){var o=t.DataManager&&this.dataSource()instanceof t.DataManager,e;o||(r instanceof Array?(e=this,n.each(u,function(n){indx=e.dataSource().indexOf(u[n]);e.dataSource().splice(indx,1)})):this.dataSource().splice(r,1),i.dataSource()instanceof Array?i.dataSource().splice.apply(i.dataSource(),[f,0].concat(u)):i.dataSource(u))},_getDropObject:function(t,i){var r=[],u=[];return this.model.allowMultiSelection?(li=n(i).parent().find(".e-select").removeClass("e-select e-hover"),li.length||(li=i.removeClass("e-select e-hover"))):li=i.removeClass("e-select e-hover"),li.length?(proxy=this,n.each(li,function(){r.push(n(this).index());u.push(proxy.dataSource()?proxy.dataSource()[n(this).index()]:null)})):(r=li.index(),u=this.dataSource()?this.dataSource()[r]:null),{dataIndex:r,dataObj:u}},_showResult:function(){var i=this,t;this._refreshContainer();this.element.attr({"aria-expanded":!0});t=this.element.children("li:not('.e-ghead')");this._listSize=t.length;this._ListEventUnbind(t);t.on("touchstart mouseenter",n.proxy(this._OnMouseEnter,this));t.on("touchend mouseleave",n.proxy(this._OnMouseLeave,this));t.on("click",n.proxy(this._OnMouseClick,this));t.on("contextmenu",n.proxy(this._OnMouseContext,this));return i.model.showCheckbox&&i.element.find(".listcheckbox").ejCheckBox({enabled:i.model.enabled}),this},_OnWindowResize:function(){this._refreshContainer();this.listContainer.css("display","block")},refresh:function(){t.isNullOrUndefined(this.model.query)||(this._savedQueries=this.model.query);this.model.dataSource?(this.model.template&&this.element.empty(),this._checkModelDataBinding(this.dataSource())):(this.listContainer.css({height:this.model.height,width:this.model.width}),this._refreshScroller())},_removeListHover:function(){return this._selectedItems=[],this.model.selectedIndices=[],this.model.selectedIndex=null,this.element.children("li").removeClass("e-hover e-select selectItem"),this},_addListHover:function(){this._activeItem=this._selectedItem;var n=this._getItem(this._selectedItem);n.addClass("e-select e-hover");this.scrollerObj.setModel({scrollTop:this._calcScrollTop()});n.focus();this._OnListSelect(this.prevselectedItem,this._selectedItem)},_calcScrollTop:function(n){for(var f=this.element.outerHeight(),r=this.element.find("li"),u=0,i=n?n:this.element.find("li.e-select").index(),t=0;t<i;t++)u+=r.eq(t).outerHeight();return u-(this.listContainer.outerHeight()-r.eq(i).outerHeight())/2},_refreshItems:function(){this.listBoxScroller.append(this.element);this.listContainer.append(this.listBoxScroller);this._refreshContainer();this._showResult();this._setSelectionValues();this._setDisableValues()},_selectedIndices:function(){var t;return this.element.children("li:not('.e-ghead')").each(function(i){if(n(this).hasClass("e-select"))return t=i,!1}),this._selectedItem=t,t},_addSelectedItem:function(t){(!n.isArray(this.model.disableItemsByIndex)&&this.model.disableItemsByIndex!=null||n.isArray(this.model.disableItemsByIndex)&&this.model.disableItemsByIndex.length>0)&&(t.keyCode==40||t.keyCode==39?this._disableItemSelectDown():this._disableItemSelectUp(),this._selectedItem=this._activeItem);var i=this._getItem(this._selectedItem);this._selectedItems.push(i)},_getItem:function(t){return n(this.element.children("li:not('.e-ghead')")[t])},_getItemObject:function(n,t){var i=this._elementIndex(n);return{item:n,index:i,text:n.text(),value:n.attr("value")?n.attr("value"):n.text(),isEnabled:!n.hasClass("e-disable"),isSelected:n.hasClass("e-select"),isChecked:n.find(".e-chk-image").hasClass("e-checkmark"),data:this.dataSource()?this.getListData()[i]:null,event:t?t:null}},_roundedCorner:function(){return this.listContainer[this.model.showRoundedCorner?"addClass":"removeClass"]("e-corner-all"),this},_enabled:function(n){return n?this.enable():this.disable(),this},_showFullList:function(){return this.dataSource()!=null&&(t.DataManager&&this.dataSource()instanceof t.DataManager||(this.listitems=this.dataSource()),!this._savedQueries.queries.length||t.DataManager&&this.dataSource()instanceof t.DataManager||(this.listitems=t.DataManager(this.dataSource()).executeLocal(this._savedQueries))),this._renderlistContainer(),this.dataSource()instanceof t.DataManager||this._trigger("actionComplete"),this._addDragableClass()._enableDragDrop(),this._disabledItems=[],this.disableItemsByIndices(this.model.disableItemsByIndex),this.model.selectedIndex==0?this.selectItemByIndex(this.model.selectedIndex):this.model.selectedIndex&&this.selectItemByIndex(this.model.selectedIndex),this.selectItemsByIndices(this.model.selectedIndices),this.checkItemsByIndices(this.model.checkedIndices),this._tooltipList(),this},_tooltipList:function(){this.listContainer.find("li").hasClass("e-tooltip")&&n(this.listContainer).ejTooltip({target:".e-tooltip",isBalloon:!1,position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}}})},_cascadeAction:function(){if(this.model.cascadeTo){this._currentValue=this._getField(this.listitems[this._activeItem],this.mapFld._value);this.selectDropObj=n("#"+this.model.cascadeTo).ejListBox("instance");n.extend(!0,this.selectDropObj,{_isCasCadeTarget:!0});t.isNullOrUndefined(this._dSource)&&(this._dSource=this.selectDropObj.dataSource());this._performJsonDataInit();var i={cascadeModel:this.selectDropObj.model,cascadeValue:this._currentValue,setCascadeModel:{},requiresDefaultFilter:!0};this._trigger("cascade",i);this.selectDropObj._setCascadeModel=i.setCascadeModel}},_performJsonDataInit:function(){this._changedSource=t.DataManager(this._dSource).executeLocal(t.Query().where(this.mapFld._value,"==",this._currentValue));this.selectDropObj.setModel({dataSource:this._changedSource,enable:!0,value:"",selectedIndex:-1})},_OnMouseContext:function(n){return n.preventDefault(),!1},_OnMouseEnter:function(t){var i,r,u;this.startime=0;this.item="";t.type=="touchstart"&&(this.item=n(t.target).text(),this.startime=(new Date).getTime());this.model.enabled&&(this.element.children("li").removeClass("e-hover"),n(t.target).is("li")&&n(t.target).addClass("e-hover"),n(t.target).hasClass("e-disable")?n(t.target).removeClass("e-hover"):t.target.tagName!="li"&&(i=n(t.target).parents("li"),n(i).addClass("e-hover")),u=0,this.element.children("li:not('.e-ghead')").each(function(t){if(n(this).hasClass("e-hover"))return r=t,!1}),this._hoverItem=r)},_OnMouseLeave:function(t){this.element.children("li").removeClass("e-hover");this.endtime=(new Date).getTime();(this.endtime-this.startime)/200>2&&this.item==n(t.target).text()&&(this.hold=(this.endtime-this.startime)/200>2?!this.hold:!1)},_OnMouseClick:function(i){var u,o,s,e,f,c,h;if(n(i.currentTarget).hasClass("e-disable"))return!1;if(i.which==3&&(this.hold=!0),this.endtime=(new Date).getTime(),(this.endtime-this.startime)/200>2&&(this.model.template||this.item!=n(i.target).text()||this.hold||(this.hold=(this.endtime-this.startime)/200>2)),i.shiftKey&&this._shiftkey&&(this._shiftkey=!1,this.prevselectedItem=this._activeItem),t.isNullOrUndefined(this._hoverItem)||(this._activeItem=this._hoverItem),this.model.enabled&&this._activeItem!=r){if((!i.shiftKey||isNaN(this.prevselectedItem))&&(this._shiftkey=!0,this.prevselectedItem=this._lastEleSelect?this._lastEleSelect:this._activeItem),this.model.showCheckbox){if(n(i.currentTarget).is("li")&&n(i.target).is("li"))n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("isChecked")?(n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("option","checked",!1),f=this.model.checkedIndices.indexOf(n(i.currentTarget).index()),this._checkedItems.splice(f,1),this.model.checkedIndices.splice(f,1),this.checkedStatus=!1):(n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("option","checked",!0),this._checkedItems.push(this._activeItem),this.model.checkedIndices.push(this._elementIndex(i.currentTarget)),this.checkedStatus=!0);else if(n(i.currentTarget).is("li")&&n(i.target).is("li"))n(i.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("isChecked")?(this._checkedItems.push(this._activeItem),this.model.checkedIndices.push(n(i.currentTarget).index()),this.checkedStatus=!0):(f=this.model.checkedIndices.indexOf(n(i.currentTarget).index()),this._checkedItems.splice(f,1),this.model.checkedIndices.splice(f,1),this.checkedStatus=!1);else return!1;this.selectedTextValue=n(i.currentTarget).text();!this.element.hasClass("e-disable")&&n(i.target).is("li")&&(c={status:this.model.enabled,isChecked:this.checkedStatus,selectedTextValue:this.selectedTextValue},h=this._getItemObject(n(i.target),i),h.isInteraction=!0,this._trigger("checkChange",h));this._lastEleSelect=n(i.currentTarget).index()}else u=n(this.element.children("li:not('.e-ghead')")[this._hoverItem]),this.model.allowMultiSelection&&(i.ctrlKey||this.touchhold||this.hold||i.shiftKey)||this._removeListHover(),this.element.children("li").removeClass("e-hover"),!u.hasClass("e-select")||i.shiftKey&&this.model.allowMultiSelection?(u.addClass("e-select"),this._selectedItems.push(u),this.model.selectedIndices.push(this._activeItem),i.shiftKey&&this.model.allowMultiSelection&&(i.ctrlKey||this._removeListHover(),this.prevselectedItem<this._activeItem?(o=this.prevselectedItem,s=this._activeItem):(o=this._activeItem,s=this.prevselectedItem),this._activeItemLoop(o,s))):(u.removeClass("e-select"),this._selectedItems.splice(this.model.selectedIndices.indexOf(this._activeItem),1),this.model.selectedIndices.splice(this.model.selectedIndices.indexOf(this._activeItem),1)),this._selectedItem=this._selectedIndices(),this.model.selectedIndex=this._activeItem,this._cascadeAction(),e=n(this.element.children("li:not('.e-ghead')")[this._selectedItem]),n(e).text()!=""&&(this.element.val(n(e).text()),this.element.attr({value:this.element.val()})),this.model.selectedText=u.text(),this._selectedData=this._getItemObject(n(e),i),this._selectedData.isInteraction=!0,this._prevSelectedData&&this._selectedData.text!=this._prevSelectedData.text&&this._trigger("unselect",this._prevSelectedData),this._trigger("select",this._selectedData),this._prevSelectedData=this._selectedData,this._lastEleSelect=this._activeItem,this._selectedItems&&this._selectedItems.length!=1&&(this._ctrlClick=!0);i.ctrlKey||i.shiftKey?i.shiftKey?(this._shiftSelectItem=this._activeItem,this._ctrlSelectItem=null):(this._ctrlSelectItem=this._activeItem,this._shiftSelectItem=null):(this._shiftSelectItem=null,this._ctrlSelectItem=null);this._setSelectionValues()._OnListSelect(this.prevselectedItem,this._activeItem)}i.target.nodeName!="INPUT"&&this.listContainer.focus();this._pageUpStep=this._pageDownStep=null},_activeItemLoop:function(t,i){var u,r;for(this.model.showCheckbox&&(u=this.listContainer.find("li:not(.e-disable)"),u.find(".listcheckbox").ejCheckBox("option","checked",!1),this._checkedItems=[],this.model.checkedIndices=[]),r=t;r<=i;r++)this.model.showCheckbox&&!this.listContainer.find("li").eq(r).hasClass("e-disable")?(this.element.find(".listcheckbox").eq(r).ejCheckBox("option","checked",!0),this._checkedItems.push(r),this.model.checkedIndices.push(r),this.checkedStatus=!0):(activeitem=n(this.element.children("li")[r]),activeitem.hasClass("e-disable")||(activeitem.hasClass("e-select")||activeitem.addClass("e-select"),this._selectedItems.push(activeitem),this.model.selectedIndices.push(r)))},_setSelectionValues:function(){var u=[],f=this.model.selectedIndices,e=this.model.checkedIndices,i,o,r;if(this.model.selectedIndices=[],this.model.checkedIndices=[],i=this,this.model.showCheckbox?this.element.find("li:not('.e-ghead') .listcheckbox:checked").closest("li").each(function(r,f){u.push(n(f).attr("value")?n(f).attr("value"):!t.isNullOrUndefined(i.model.fields.text)&&i.dataSource()?i.getListData()[i._elementIndex(f)][i.model.fields.text]:n(f).text());i.model.checkedIndices.push(i._elementIndex(f))}):(!t.isNullOrUndefined(this._activeItem)&&this._activeItem>=0&&(this.model.selectedIndex=this._activeItem),o=this.element.children("li:not('.e-ghead')"),this.element.children("li:not('.e-ghead').e-select").each(function(r,f){u.push(n(f).attr("value")?n(f).attr("value"):!t.isNullOrUndefined(i.model.fields.text)&&i.dataSource()?i.getListData()[i._elementIndex(f)][i.model.fields.text]:n(f).text());i.model.selectedIndices.push(o.index(f))})),t.DataManager&&t.DataManager&&this.dataSource()instanceof t.DataManager&&this.model.allowVirtualScrolling)if(this.model.showCheckbox)for(r=0;r<e.length;r++)this.model.checkedIndices.indexOf(e[r])==-1&&this.model.checkedIndices.push(e[r]);else for(r=0;r<f.length;r++)this.model.selectedIndices.indexOf(f[r])==-1&&this.model.selectedIndices.push(f[r]);return this.model.selectedItemIndex=this.model.selectedIndex,this.model.selectedItems=this.model.selectedItemlist=this.model.selectedIndices,this.model.checkedItems=this.model.checkedItemlist=this.model.checkItemsByIndex=this.model.checkedIndices,this.value(u.toString()),this._hiddenInput.val(this.value()),this},_setDisableValues:function(){this._disabledItems=[];this.model.disableItemsByIndex=[];for(var i=this.element.children().length,t=0;t<i;t++)n(this.element.children()[t]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(t);this.disableItemsByIndices(this.model.disableItemsByIndex)},_onClickCheckList:function(t){if(t.isChecked||n("#"+t.model.id).closest("li").removeClass("checkItem"),t.isInteraction&&(this.checkedStatus=t.isChecked?!0:!1,!this._initValue)){this.checkedStatus?this.model.checkedIndices.push(n(t.event.target).closest('li:not(".e-ghead")').index()):this.model.checkedIndices.splice(n.inArray(n(t.event.target).closest('li:not(".e-ghead")').index(),this.model.checkedIndices),1);var i=this._getItemObject(n(t.event.target).closest("li"),t);i.isInteraction=!0;this._trigger("checkChange",i)}},_elementIndex:function(t){return n(t).parent().children("li:not('.e-ghead')").index(t)},_disableItemSelectCommon:function(){this.listitems=this.element.find("li");this._activeItem=this.listitems.index(this.element.find(".e-select"))},_disableItemSelectUp:function(){var t,i;for(this._disableItemSelectCommon(),t=typeof this.model.disableItemsByIndex!="object"?this.model.disableItemsByIndex.split(",").sort().reverse():this.model.disableItemsByIndex,this._activeItem==0?this._activeItem=this.listitems.length-1:this._activeItem--,i=0;n.inArray(this._activeItem.toString(),t.toString())>-1;i++)this._activeItem--,this._activeItem<0&&(this._activeItem=this.listitems.length-1);n(this.element.children("li")[this._activeItem]).addClass("e-select")},_disableItemSelectDown:function(){var t,i;for(this._disableItemSelectCommon(),t=typeof this.model.disableItemsByIndex!="object"?this.model.disableItemsByIndex.split(",").sort():this.model.disableItemsByIndex,this.listitems.length-1==this._activeItem?this._activeItem=0:this._activeItem++,i=0;n.inArray(this._activeItem.toString(),t.toString())>-1;i++)this._activeItem++,this.listitems.length==this._activeItem&&(this._activeItem=0);n(this.element.children("li")[this._activeItem]).addClass("e-select")},_checkitems:function(){var r,t;if(this.model.showCheckbox)for(r=this.element.find("li:not('.e-ghead')"),i=0;i<this.model.checkedIndices.length;i++)t=this.model.checkedIndices[i],n(r[t]).find(".listcheckbox").ejCheckBox("option","checked",!0),this._checkedItems.push(r[t]);else if(this.model.allowMultiSelection)for(i=0;i<this.model.selectedIndices.length;i++)t=this.model.selectedIndices[i],n(this.listitem[t]).hasClass("e-select")||(n(this.listitem[t]).addClass("e-select"),this._selectedItems.push(n(this.listitem[t])));else n(this.listitem[this.model.selectedIndex]).hasClass("e-select")||n(this.listitem[this.model.selectedIndex]).addClass("e-select"),this._selectedItems.push(n(this.listitem[this.model.selectedIndex]));return this._setSelectionValues(),this},_OnListSelect:function(i,r,u){if(!t.isNullOrUndefined(i)&&i!=r&&!this.model.showCheckbox){var f=this._getItemObject(n(this.element.find("li:not('.e-ghead')")[r]),u);f.isInteraction=!0;this._trigger("change",f)}},_OnKeyDown:function(t){var u,a,h,c,l,o,r,e,s,f,i;if(this.model.enabled){this._selectedItems&&this._selectedItems.length==1&&!this.model.showCheckbox&&(this._lastEleSelect=n(this.element.children("li.e-select")).index());this._itemId=null;u=this.element.children("li");a=this;c=this.listContainer.height();h=u.outerHeight();l=Math.round(c/h)!=0?Math.floor(c/h):7;this._listSize=this.element.children("li").length;t.shiftKey||(this._up=this._down);t.keyCode!=33&&t.keyCode!=34&&(this._pageUpStep=this._pageDownStep=null);switch(t.keyCode){case 37:case 38:if(o=this.listItemsElement,r=this._shiftSelectItem?this._shiftSelectItem:this._ctrlSelectItem?this._ctrlSelectItem:this.model.showCheckbox?this._lastEleSelect||0:o.index(this.element.find("li.e-select")),t.shiftKey&&this.model.allowMultiSelection&&!this.model.showCheckbox){if(this._lastEleSelect==0)return!1;for(this._lastEleSelect=this._ctrlClick?this._lastEleSelect-1:this._lastEleSelect,r=this._lastEleSelect,this._selectedItem=r||r==0?r==0?this._listSize-1:this._down?r:r-1:0,i=this._selectedItem;n(u[i]).hasClass("e-disable");i--)this._selectedItem-=1;if(n(u[this._selectedItem]).hasClass("e-select")&&this.element.find("li.e-select").length==1&&(this._selectedItem-=1),e=n(u[this._selectedItem]),e.hasClass("e-select")){if(this._selectedItem==0)return;e.removeClass("e-select");this._selectedItems.pop()}else e.addClass("e-select"),this._selectedItems.push(e);this.scrollerObj.setModel({scrollTop:this._calcScrollTop(this._selectedItem)});this._up=!0;this._down=!1;this._ctrlClick=!1}else{for(this._selectedItem=r||r==0?r==0?this._listSize-1:r-1:0,i=this._selectedItem;n(u[i]).hasClass("e-disable");i--)this._selectedItem-=1;this._selectedItem==-1&&(this._selectedItem=this._listSize-1);this._addSelectedItem(t);n(u).removeClass("e-hover e-select");s=this.model.showCheckbox?"e-hover":"e-select";n(u[this._selectedItem]).addClass(s);this.scrollerObj.setModel({scrollTop:this._calcScrollTop(this._selectedItem)})}return this._activeItem=this.prevselectedItem=this._selectedItem,this._OnListSelect(this._selectedItem+1,this._selectedItem,t),this._lastEleSelect=this._selectedItem,this._keyCascade(u[this._selectedItem]),this._setSelectionValues(),this._shiftSelectItem=this._ctrlSelectItem=null,t.preventDefault(),!1;case 39:case 40:if(o=this.listItemsElement,r=this._shiftSelectItem?this._shiftSelectItem:this._ctrlSelectItem?this._ctrlSelectItem:this.model.showCheckbox?this._lastEleSelect||0:o.index(this.element.find("li.e-select")),t.shiftKey&&this.model.allowMultiSelection&&!this.model.showCheckbox){if(this._lastEleSelect==this._listSize-1)return!1;for(this._lastEleSelect=this._ctrlClick?this._lastEleSelect+1:this._lastEleSelect,r=this._lastEleSelect,this._selectedItem=r||r==0?r==this._listSize-1?0:this._up||this._ctrlClick?r:r+1:0,i=this._selectedItem;n(u[i]).hasClass("e-disable");i++)this._selectedItem+=1;n(u[this._selectedItem]).hasClass("e-select")&&this.element.find("li.e-select").length==1&&(this._selectedItem+=1);e=n(u[this._selectedItem]);e.hasClass("e-select")?(e.removeClass("e-select"),this._selectedItems.pop()):(e.addClass("e-select"),this._selectedItems.push(e));this.scrollerObj.setModel({scrollTop:this._calcScrollTop(this._selectedItem)});this._up=!1;this._down=!0;this._ctrlClick=!1}else{for(this._selectedItem=r||r==0?r==this._listSize-1?0:r+1:0,i=this._selectedItem;n(u[i]).hasClass("e-disable");i++)this._selectedItem+=1;this._selectedItem==this._listSize&&(this._selectedItem=0);this._addSelectedItem(t);n(u).removeClass("e-hover e-select");s=this.model.showCheckbox?"e-hover":"e-select";n(u[this._selectedItem]).addClass(s);this.scrollerObj.setModel({scrollTop:this._calcScrollTop(this._selectedItem)});this.element.find("li").removeClass("selectItem");this.model.selectedIndices.length=0;this.model.selectedIndices.push(this._selectedItem)}return this._activeItem=this.prevselectedItem=this._selectedItem,this._OnListSelect(this._selectedItem-1,this._selectedItem),this._lastEleSelect=this._selectedItem,this._keyCascade(u[this._selectedItem]),this._setSelectionValues(),this._shiftSelectItem=this._ctrlSelectItem=null,!1;case 8:case 9:case 13:this.model.showCheckbox&&(this.model.checkedIndices.indexOf(this._selectedItem)<0?this.checkItemByIndex(this._selectedItem):this.uncheckItemByIndex(this._selectedItem));break;case 18:case 33:f=t.keyCode==33?l:1;t.shiftKey&&this.model.allowMultiSelection?(this._pageUpStep==null&&(this._pageUpStep=this.prevselectedItem),this._pageDownStep==null&&(this._pageDownStep=this.prevselectedItem),this._pageDownStep<=this.prevselectedItem?(start=this._pageUpStep-f>0?this._pageUpStep-f:0,end=this._pageDownStep):(start=this.prevselectedItem,end=this._pageDownStep-f>this.prevselectedItem?this._pageDownStep-f:this.prevselectedItem),this._shiftHomeAndEndKeyProcess(start,end,end>this.prevselectedItem?end:start),this._pageUpStep=start,this._pageDownStep=end):this._moveUp(this._activeItem,f);this._preventDefaultAction(t);break;case 34:f=t.keyCode==34?l:1;t.shiftKey&&this.model.allowMultiSelection?(this._pageUpStep==null&&(this._pageUpStep=this.prevselectedItem),this._pageDownStep==null&&(this._pageDownStep=this.prevselectedItem),this._pageUpStep==0&&this.prevselectedItem!=0?this._pageUpStep+f>=this.prevselectedItem?start=end=this.prevselectedItem:(start=this._pageUpStep+f,end=this._pageDownStep+f<this.element.children("li").length?this._pageDownStep+f:this.element.children("li").length-1):this._pageUpStep!=this.prevselectedItem&&this._pageUpStep+f>=this.prevselectedItem?start=end=this.prevselectedItem:(start=this._pageUpStep,end=this._pageDownStep+f<this.element.children("li").length?this._pageDownStep+f:this.element.children("li").length-1),start<this.prevselectedItem&&end>this.prevselectedItem&&(end=this.prevselectedItem),this._shiftHomeAndEndKeyProcess(start,end,start<this.prevselectedItem?start:end),this._pageUpStep=start,this._pageDownStep=end):this._moveDown(this._activeItem,f);this._preventDefaultAction(t);break;case 35:for(t.shiftKey&&this.model.allowMultiSelection?this._shiftHomeAndEndKeyProcess(this._activeItem,this._listSize-1,this._listSize-1):this._homeAndEndKeyProcess(t,u,this._listSize-1),i=this._listSize-1;i>0;i--)if(!n(this.element.find("li")[i]).hasClass("e-disable"))return this.model.selectedIndex=i,this._shiftSelectItem=i,!1;break;case 36:for(t.shiftKey&&this.model.allowMultiSelection?this._shiftHomeAndEndKeyProcess(0,this._activeItem,0):this._homeAndEndKeyProcess(t,u,0),i=0;i<this._listSize;i++)if(!n(this.element.find("li")[i]).hasClass("e-disable"))return this.model.selectedIndex=i,!1}}},_moveUp:function(n,t){n==null||n<=0?this._checkDisableStep(0,t,!1):n>this._listSize-1?this._checkDisableStep(this._listSize-1,t,!1):n>0&&n<=this._listSize-1&&this._checkDisableStep(n,t,!1)},_moveDown:function(n,t){n==null||n<0?this._checkDisableStep(-1,t,!0):n==0?this._checkDisableStep(0,t,!0):n>=this._listSize-1?this._checkDisableStep(this._listSize-1,t,!0):n<this._listSize-1&&this._checkDisableStep(n,t,!0)},_checkDisableStep:function(n,t,i){var e=i?"_disableItemSelectDown":"_disableItemSelectUp",f=i?n+t:n-t,r=this[e](f),u;if(r==null)for(u=t;u>=0;u--)if(f=i?n+u:n-u,r=this[e](f),r!=null)break;r!=null&&this.selectItemByIndex(r)},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t<this._listSize?n.inArray(t,this._disabledItems)<0?t:this._disableItemSelectDown(t+1):this._listSize-1},_disableItemSelectUp:function(t){if((t==null||t<0)&&(t=0),t<this._listSize){if(n.inArray(t,this._disabledItems)<0)return t;if(t>0)return this._disableItemSelectUp(t-1)}},_preventDefaultAction:function(n,t){n.preventDefault?n.preventDefault():n.returnValue=!1;t&&(n.stopPropagation?n.stopPropagation():n.cancelBubble=!0)},_homeAndEndKeyProcess:function(t,i,r){if(n(":focus").length&&n(":focus")[0].nodeName!="INPUT")return this._OnListSelect(this._selectedItem,r),this.selectItemByIndex(r),this._selectedItem=r,this.scrollerObj.setModel({scrollTop:this._calcScrollTop(r)}),this.model.showCheckbox&&(this._removeListHover(),n(i[r]).addClass("e-hover"),this._lastEleSelect=this._selectedItem=r),this._keyCascade(i[r],t),t.preventDefault(),!1},_shiftHomeAndEndKeyProcess:function(n,t,i){return this._removeListHover(),this._activeItemLoop(n,t),this.scrollerObj.setModel({scrollTop:this._calcScrollTop(i)}),!1},_keyCascade:function(t,i){var r=this._getItemObject(n(t),i);this.model.selectedText=r.text;r.isInteraction=!0;this._trigger("select",r);this.model.cascadeTo&&(this._activeItem=this._selectedItem,this._cascadeAction())},mergeData:function(i,r){var u,f;this.mergeUl=n();this._setMapFields();u=this;this._skipInitialRemoteData=r?r:!1;t.DataManager&&i instanceof t.DataManager?(f=i.executeQuery(this._getQuery()),f.done(function(n){u.mergeValue=n.result;u._renderlistContainer()})):(this.mergeValue=i,this.listitems=this.listitems?this.listitems:this.dataSource(),this._renderlistContainer());this._loadInitialRemoteData=!1},_onScroll:function(i){var f,o,s,h,c,u,l,e;if(this._temp=this.dataSource(),this.model.actionBegin&&this._trigger("actionBegin",{}),this._temp!=this.dataSource()&&(t.DataManager&&this.dataSource()instanceof t.DataManager?this._initDataSource(this.dataSource()):this._showFullList()),f=this,o=this.element.find("li")[0],this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal")s=n(o).outerHeight(),this.itemIndex=Math.round(this.scrollerObj.scrollTop()/s),this.realUllength=this.itemIndex,u=this.itemIndex,this.itemIndex>this.listContainer.outerHeight()/n(o).outerHeight()&&(u=this.mergeValue&&u>=this.mergeValue.length?u-this.mergeValue.length:u,e=this.itemIndex+this._getLiCount()),(this.mergeValue&&this.itemIndex<=this.mergeValue.length||u<=0)&&(u=0),this.dataSource().length==r&&this._temp==this.dataSource()?t.DataManager&&this.dataSource()instanceof t.DataManager&&(h=u==0?u:u-1,c=u==this.element.find("li").length?u:u+1,this._queryPromise(h,f,c+Math.ceil(this.model.height/s),i)):this._temp!=this.dataSource()?this._queryPromise(u,f,this._listitems.length,i):this.dataSource().length>0&&this._loadQueryData(u,e,f);else if(this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="continuous"&&this.listItemsElement.length-2<=(this.scrollerObj.scrollTop()+this.listContainer.height())/this.element.find("li").outerHeight()&&(this.lastScrollPosition=this.scrollerObj.scrollTop(),u=this.mergeValue&&!this._skipInitialRemoteData?this.element.children().length-this.mergeValue.length:this.element.children().length,u<=0&&(u=0),this._oldStartValue&&(u=this._oldStartValue),l=this.model.totalItemsCount?this.model.totalItemsCount:this.listitems.length,this.listItemsElement.length<l))if(this.dataSource().length==r){if(e=this.mergeValue&&!this._skipInitialRemoteData?this.model.totalItemsCount&&u+this.model.itemRequestCount+this.mergeValue.length>this.model.totalItemsCount?this.model.totalItemsCount-this.mergeValue.length:u+this.model.itemRequestCount:this.model.totalItemsCount&&u+this.model.itemRequestCount>this.model.totalItemsCount?this.model.totalItemsCount:u+this.model.itemRequestCount,t.DataManager&&this.dataSource()instanceof t.DataManager)if(u<=e)this._queryPromise(u,f,e,i);else return!1;this._oldStartValue=u+this.model.itemRequestCount}else if(this.dataSource().length>0){if(this._isScrollComplete)return;this._loadQueryData(f.realUllength,f.realUllength+this.model.itemRequestCount,f)}},_queryPromise:function(n,t,i,r){this._trigger("itemRequest",{event:r,isInteraction:!0});this._setMapFields();var u=this._savedQueries.clone(),f=this.dataSource().executeQuery(u.range(n,i));this._updateLoadingClass(!0);f.done(function(i){t._trigger("actionBeforeSuccess",i);t.realUllength=r.source!="wheel"?t.mergeValue?t.mergeValue.length+n:n:n;t._loadlist(i.result)._checkboxHideShow(t.model.showCheckbox)._showResult()._updateLoadingClass();t._applySelection();t.model.virtualScrollMode=="continuous"&&(t.scrollerObj.refresh(),t.scrollerObj.option("scrollTop",t.lastScrollPosition));t._trigger("actionSuccess",i)}).fail(function(n){t._trigger("actionFailure",n)}).always(function(n){t._trigger("actionComplete",n)})},_selectListItems:function(){var t=this.element.find("li:not('.e-ghead')");for(i=0;i<t.length;i++)n(t[i]).hasClass("selectItem")&&!n(t[i]).hasClass("e-select")&&n(t[i]).addClass("e-select").removeClass("selectItem")},_loadQueryData:function(n,t,i){this._isScrollComplete=t>=this.listitems.length?!0:!1;this._updateLoadingClass(!0);var r=this.dataSource();this._loadlist(r.slice(n,t))._showResult()._updateLoadingClass();i._applySelection();i.model.virtualScrollMode=="continuous"&&(i.scrollerObj.option("scrollTop",i.lastScrollPosition),i.scrollerObj.refresh())},_setText:function(t){for(i=0;i<this.listitems.length;i++)n(this.element.children("li")[i]).text()==t&&this.unselectAll().selectItemByIndex(i)},_getLiCount:function(){return parseInt(this.listContainer.height()/this.listItemsElement.height())},_onDragStarts:function(n,t){return this._trigger("itemDragStart",{items:n,target:t})},_onDrag:function(n,t){return this._trigger("itemDrag",{items:n,target:t})},_onDragStop:function(n,t){return this._trigger("itemDragStop",{items:n,target:t})},_onDropped:function(n,t){return this._trigger("itemDrop",{items:n,target:t})},_OnKeyPress:function(n){this.model.enableIncrementalSearch&&this.model.enabled&&this._incrementalSearch(this._isMozilla?n.charCode:n.keyCode)},_incrementalSearch:function(t){var u,o,s,i;_proxy=this;u=String.fromCharCode(t);this._incqueryString!=u?this._incqueryString+=u:this._incqueryString=u;this._incqueryString.length>0&&this._typeInterval==null&&(this._typeInterval=setTimeout(function(){_proxy._incqueryString="";_proxy._typeInterval=null},_proxy._typingThreshold));var f=this.listContainer.find("ol,ul").children("li:not('.e-category')"),i,c=this.model.caseSensitiveSearch,r,h=this._incqueryString,l=this._incqueryString.length,e=!1;for(c||(h=h.toLowerCase()),o=this._activeItem,--o,s=this._activeItem!=f.length-1?this._activeItem+1:0,this._incqueryString.length>1&&(s=this._activeItem),i=s;i<f.length&&o!=i;i++)if(r=n.trim(n(f[i]).text()),r=c?r:r.toLowerCase(),r.substr(0,l)===h?(this._removeListHover(),this.element.children("li").removeClass("e-active"),this._selectedItem=i,this._addListHover(),e=!0):i==f.length-1&&e==!1&&(s!=0?(i=-1,++o):e=!0),e)break},_wireEvents:function(){this._on(this.listContainer,"focus",this._OnFocusIn);this._on(this.listContainer,"blur",this._OnFocusOut);n(window).on("resize",n.proxy(this._OnWindowResize,this))},_OnFocusIn:function(){this._focused||(this._trigger("focusIn"),this._on(this.listContainer,"keydown",this._OnKeyDown),this._on(this.listContainer,"keypress",this._OnKeyPress),this._focused=!0)},_OnFocusOut:function(){this._focused&&(this._trigger("focusOut"),this._off(this.listContainer,"keydown",this._OnKeyDown),this._off(this.listContainer,"keypress",this._OnKeyPress),this._focused=!1)}});t.VirtualScrollMode={Normal:"normal",Continuous:"continuous"};t.SortOrder={Ascending:"ascending",Descending:"descending",None:"none"}}(jQuery,Syncfusion),function(n,t,i){t.widget({ejNumericTextbox:["ej.NumericTextbox","e-numerictextbox"],ejPercentageTextbox:["ej.PercentageTextbox","e-percentagetextbox"],ejCurrencyTextbox:["ej.CurrencyTextbox","e-currencytextbox"]},{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0,requireParser:!0},defaults:{width:"",height:"",value:null,name:null,htmlAttributes:{},minValue:-Number.MAX_VALUE,maxValue:Number.MAX_VALUE,incrementStep:1,decimalPlaces:0,validateOnType:!1,cssClass:"",enablePersistence:!1,showSpinButton:!0,locale:"en-US",enableStrictMode:!1,showRoundedCorner:!1,readOnly:!1,enabled:!0,enableRTL:!1,watermarkText:"",validationRules:null,validationMessage:null,groupSeparator:null,groupSize:null,positivePattern:null,currencySymbol:null,negativePattern:null,change:null,focusIn:null,focusOut:null,create:null,destroy:null},dataTypes:{minValue:"number",maxValue:"number",incrementStep:"number",decimalPlaces:"number",showSpinButton:"boolean",enableStrictMode:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",locale:"string",watermarkText:"string",cssClass:"string",readOnly:"boolean",enabled:"boolean",validationRules:"data",validationMessage:"data",htmlAttributes:"data",validateOnType:"boolean",groupSeparator:"string"},observables:["value"],_setModel:function(n){var r=!1;for(var i in n)switch(i){case"value":t.isNullOrUndefined(n.minValue)&&t.isNullOrUndefined(n.maxValue)?(this._setValue(n[i],!0),n[i]=this.model.value):(this.model.value=this._checkNumValue(n[i]),this._localizedFormat(),this._raiseChangeEvent(!0),r=!0);break;case"enableRTL":this._enableRTL(n[i]);break;case"width":this._setWidth(n[i]);break;case"height":this._setHeight(n[i]);break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=n[i];this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation());break;case"minValue":if(isNaN(n[i]))return;this.model.minValue=parseFloat(n[i].toFixed(this.model.decimalPlaces));r=!0;break;case"maxValue":if(isNaN(n[i]))return;this.model.maxValue=parseFloat(n[i].toFixed(this.model.decimalPlaces));r=!0;break;case"incrementStep":if(isNaN(n[i]))return;this.model.incrementStep=parseFloat(n[i].toFixed(this.model.decimalPlaces));break;case"enableStrictMode":this.model.enableStrictMode=n[i];break;case"showSpinButton":this._showSpin(n[i]);break;case"showRoundedCorner":this._roundedCorner(n[i]);break;case"locale":this.model.decimalPlaces=t.isNullOrUndefined(this._options.decimalPlaces)&&this.model.decimalPlaces===this.culture.numberFormat.decimals?-1:this._options.decimalPlaces===-1?-1:this.model.decimalPlaces;this._setLocalize(n[i]);this._options.decimalPlaces=this.model.decimalPlaces;n[i]=this.model.locale;break;case"decimalPlaces":this._setDecimal(n[i]);t.isNullOrUndefined(this._options)&&(this._options={});this._options.decimalPlaces=n[i];break;case"cssClass":this._setSkin(n[i]);break;case"readOnly":this._setReadOnly(n[i]);break;case"enabled":n[i]?this.enable():this.disable();break;case"watermarkText":t.isNullOrUndefined(this._options)||(this._options=[]);this._options.watermarkText=this.model.watermarkText=n[i];this._localizedLabels.watermarkText=this.model.watermarkText;this._changeWatermark(n[i]);break;case"htmlAttributes":this._addAttr(n[i]);break;case"groupSeparator":this._checkSeparator(n[i]);n[i]=this.model.groupSeparator;break;case"positivePattern":case"negativePattern":case"groupSize":case"currencySymbol":this.model[i]=n[i];this._options[i]=n[i];this._initCustomValue();n[i]=this.model[i];this._setValue(this.model.value,!0)}r&&(this._validateMinMaxValue(!0,!0),n.value=this.model.value,n.maxValue=this.model.maxValue,n.minValue=this.model.minValue,this.model.minValue!=-Number.MAX_VALUE&&(this._startValue=this.model.minValue),this.element.attr({"aria-valuemin":this.model.minValue,"aria-valuemax":this.model.maxValue,"aria-valuenow":this.model.value}));this._checkSeparator(this.model.groupSeparator);this.element.val(this._removeSeparator(this.model.value));this._updateSeparator();this._checkErrorClass()},_destroy:function(){this.wrapper&&(this.element.insertBefore(this.wrapper),this.wrapper.remove());this._isWatermark&&this.element.removeAttr("placeholder");this.element.val("").removeClass("e-input e-disable").empty();this.element.removeAttr("disabled aria-disabled aria-valuemin aria-valuemax aria-valuenow aria-live");this._cloneElement.attr("role")||this.element.removeAttr("role");this.element.css("display","block")},_init:function(n){if(this._cloneElement=this.element.clone(),this._options=t.isNullOrUndefined(n)?{}:n,this.element.is("input")&&(this.element.is("input[type=text]")||this.element.is("input[type=number]")||!this.element.attr("type")))this.model.decimalPlaces>0&&(this.element[0].type="text"),this._isWatermark="placeholder"in document.createElement("input"),this.model.locale=t.preferredCulture(this.model.locale).name=="en"?"en-US":t.preferredCulture(this.model.locale).name,this._localizedLabels=this._getLocalizedLabels(),this.culture=t.preferredCulture(this.model.locale),this._browsername=t.browserInfo().name,this._initCustomValue(),this._prevSeparator=null,this._checkSeparator(this.model.groupSeparator),this._checkAttribute(),this._renderControl(),this._setValues(),this._wireEvents(),this._initObjects(),this._addAttr(this.model.htmlAttributes),this.model.validationRules!=null&&(this._initValidator(),this._setValidation()),this._updateSeparator(),n&&n.value!=i&&this._trigger("_change",{value:this.model.value});else return this._destroy(),!1},_checkAttribute:function(){for(var u=["min","max","step","readonly","disabled","placeholder"],f=["minValue","maxValue","incrementStep","readOnly","enabled","watermarkText"],i,n,r=0;r<u.length;r++)i=this.element.attr(u[r]),n=f[r],t.isNullOrUndefined(i)||t.isNullOrUndefined(this._options)||!t.isNullOrUndefined(this._options[n])||(n=="watermarkText"?this._options[n]=i:this.model[n]=n!="disabled"&&n!="readOnly"?t.parseFloat(i,this.model.locale):n=="readOnly"?this.element.is("[readonly]"):!this.element.is("[disabled]"))},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="accesskey"?r._hiddenInput.attr(i,n):u=="disabled"&&n=="disabled"?r.disable():u=="readonly"&&n=="readOnly"?r._setReadOnly(!0):u=="tabindex"?(r._hiddenInput.attr(i,n),r.element.attr(i,n)):u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_setValues:function(){this._id=this.element[0].id;this._textBox=this._hiddenInput[0];this._error=!1;this._timeout=null;this.isValidState=!0;this._allowkeyboard=!0;this._validateOnType=!1;this._focused=!1;this._startValue=0;this.sfType==="ej.CurrencyTextbox"&&this.model.minValue==-Number.MAX_VALUE&&(this.model.minValue=0);(t.isNullOrUndefined(this.model.decimalPlaces)||this.model.decimalPlaces<0)&&(this.model.decimalPlaces=this.sfType==="ej.CurrencyTextbox"?t.preferredCulture(this.model.locale).numberFormat.currency.decimals:t.preferredCulture(this.model.locale).numberFormat.decimals);this.model.minValue=parseFloat(this.model.minValue.toFixed(this.model.decimalPlaces));this.model.maxValue=parseFloat(this.model.maxValue.toFixed(this.model.decimalPlaces));this.model.minValue!=-Number.MAX_VALUE&&(this._startValue=this.model.minValue);t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText);this._localizedLabelToModel();this._localizedFormat();this._validateMinMaxValue(!0);this._updateSymbol(this.model.locale);t.isNullOrUndefined(this.model.value)?(value=this.model.value,this.wrapper.removeClass("e-valid")):(value=this.model.value.toString().indexOf("e")==-1?this._removeSeparator(this.model.value):this._convertToExponetial(this.model.value).unformattedValue,this.wrapper.addClass("e-valid"));this.element.val(value)},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var u=this.model.validationRules,r,i,f,e;this.element.rules("add",u);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this.element.attr("name");r.settings.messages[name]={};for(i in u)if(f=null,!t.isNullOrUndefined(u[i])){if(t.isNullOrUndefined(u.messages&&u.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(e in this.model.validationMessage)i==e?f=this.model.validationMessage[i]:""}else f=u.messages[i];r.settings.messages[name][i]=f!=null?f:n.validator.messages[i]}},_renderControl:function(){this.wrapper=t.buildTag("span.e-widget e-pinch");this.innerWrap=t.buildTag("span.e-in-wrap e-box ");this.wrapper.attr("style",this.element.attr("style"));this.sfType==="ej.NumericTextbox"?this.wrapper.addClass("e-numeric"):this.sfType==="ej.PercentageTextbox"?this.wrapper.addClass("e-percent"):this.sfType==="ej.CurrencyTextbox"&&this.wrapper.addClass("e-currency");this.wrapper.append(this.innerWrap).insertAfter(this.element);this.innerWrap.append(this.element);this._hiddenInput=t.buildTag("input","",{},{type:"text"}).insertBefore(this.element);this._hiddenInput.attr("data-role","none");this._hiddenInput[0].tabIndex=this.element[0].tabIndex;this._hiddenInput.attr("accesskey",this.element[0].accessKey);this.element[0].accessKey="";this._hiddenInput.css("display","block");this.element.css("display","none");this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this._localizedLabels.watermarkText),this._hiddenSpan.css("display","none"),this._on(this._hiddenSpan,"mousedown",this._focusIn),this._on(this._hiddenSpan,"mousewheel",this._mouseWheel),this._on(this._hiddenSpan,"DOMMouseScroll",this._mouseWheel));this.model.name=this.element.attr("name")!=null?this.element.attr("name"):this.model.name!=null?this.model.name:this.element[0].id;this.element.attr("name")==null?this.element.attr("name",this.model.name):"";this.element.addClass("e-input");t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""?(t.preferredCulture(this.model.locale).numberFormat[","]=="."&&(this.element[0].value=this.element[0].value.replace(".",",")),this.model.value=this._checkNumValue(this.element[0].value)):(typeof this.model.value=="string"&&t.preferredCulture(this.model.locale).numberFormat[","]=="."&&(this.model.value=this.model.value.replace(".",",")),this.model.value=this._checkNumValue(this.model.value));this._hiddenInput.attr({value:this.model.value}).addClass("e-input");this.element.attr({role:"spinbutton","aria-valuemin":this.model.minValue,"aria-valuemax":this.model.maxValue,"aria-valuenow":this.model.value,"aria-live":"assertive",value:this.model.value});var i=n('<span class="e-select"><span class="e-spin e-spin-up " role="button" "aria-label"="Increase Value" unselectable="on" /><span class="e-spin e-spin-down" role="button" "aria-label"="Decrease Value" unselectable="on" /><\/span>');i.find(".e-spin-up").append(t.buildTag("span.e-icon e-arrow e-arrow-sans-up").attr({role:"presentation",unselectable:"on"}));i.find(".e-spin-down").append(t.buildTag("span.e-icon e-arrow e-arrow-sans-down").attr({role:"presentation",unselectable:"on"}));this.innerWrap.append(i);this.spin=this.wrapper.find(".e-select");this.spinUp=this.wrapper.find(".e-spin-up");this.spinDown=this.wrapper.find(".e-spin-down");this._setWidth(this.model.width);this._setHeight(this.model.height);this.model.cssClass!=""&&this._setSkin(this.model.cssClass);this._showSpin(this.model.showSpinButton);this.model.showRoundedCorner&&this._roundedCorner(this.model.showRoundedCorner);this.model.enableRTL&&this._enableRTL(this.model.enableRTL);this.model.readOnly&&this._setReadOnly(this.model.readOnly);this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&this.enable():this.disable()},_initObjects:function(){this._preVal=this.model.value;this.model.value===null?(this.isValidState=!0,this._hiddenInput.val(null)):(this.model.value<this.model.minValue||this.model.value>this.model.maxValue)&&(this.isValidState=!1);this._checkErrorClass();this._setWaterMark()},_showSpin:function(n){n?(this.spin&&(this.spin.show(),this.innerWrap.addClass("e-padding")),this._spinEvents("_on")):(this.spin&&(this.spin.hide(),this.innerWrap.removeClass("e-padding")),this._spinEvents("_off"))},_roundedCorner:function(n){n&&!this.innerWrap.hasClass("e-corner")?this.innerWrap.addClass("e-corner"):this.innerWrap.hasClass("e-corner")&&this.innerWrap.removeClass("e-corner")},_enableRTL:function(n){n?this.spin?this.wrapper.addClass("e-rtl"):this.element.addClass("e-rtl"):this.spin?this.wrapper.removeClass("e-rtl"):this.element.removeClass("e-rtl")},_setWidth:function(n){n!=""?this.wrapper.width(n):this.model.width=this.wrapper.outerWidth()},_setHeight:function(n){n!=""?this.wrapper.height(n):this.model.height=this.wrapper.outerHeight()},_setSkin:function(n){this.wrapper.removeClass(this.model.cssClass);this.wrapper.addClass(n)},_setValue:function(n,t){this._isWatermark||this._hiddenSpan.css("display","none");this.model.value=this._checkNumValue(n);this._validateMinMaxValue(!1);this._checkErrorClass();this._localizedFormat();this._raiseChangeEvent(t);this._setWaterMark()},_setLocalize:function(n){var i=t.preferredCulture(this.model.locale).numberFormat[","];this.model.locale=t.preferredCulture(n).name=="en"?"en-US":t.preferredCulture(n).name;this.model.groupSeparator=t.isNullOrUndefined(this._options.groupSeparator)&&i===this.model.groupSeparator?t.preferredCulture(this.model.locale).numberFormat[","]:this.model.groupSeparator;this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText);this._localizedLabelToModel();this.culture=t.preferredCulture(this.model.locale);this._initCustomValue();this._updateSymbol(this.model.locale);this._localizedFormat();this._changeWatermark(this.model.watermarkText);value=t.isNullOrUndefined(this.model.value)?this.model.value:this.model.value.toString().indexOf("e")==-1?this._formatValue(this.model.value,"n",!0):this._convertToExponetial(this.model.value).unformattedValue;this.element.val(value)},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText},_updateSymbol:function(n){this._percentSymbol=t.preferredCulture(n).numberFormat.percent.symbol;this._currencySymbol=t.preferredCulture(n).numberFormat.currency.symbol},_setDecimal:function(n){this.model.decimalPlaces=n;this._localizedFormat()},_validateMinMaxValue:function(n,i){var u=!1,r;this.model.minValue>this.model.maxValue&&(this.model.minValue=this.model.maxValue);!t.isNullOrUndefined(this.model.value)&&this.model.minValue>this.model.value?(this.model.enableStrictMode!=!0?(this.isValidState=!0,this._startValue=this.model.value=this.model.minValue):this.isValidState=!1,u=!0):!t.isNullOrUndefined(this.model.value)&&this.model.maxValue<this.model.value?(this.model.enableStrictMode!=!0?(this.isValidState=!0,this.model.value=this.model.maxValue):this.isValidState=!1,u=!0):this.isValidState=!0;this.model.minValue==this.model.maxValue&&(this._startValue=this.model.minValue);u&&n&&(r=this._formatValue(this.model.value,"n",!0),this._hiddenInput.val(r),r=t.isNullOrUndefined(this.model.value)?this.model.value:this.model.value.toString().indexOf("e")==-1?this._formatValue(this.model.value,"n",!0):this._convertToExponetial(this.model.value).unformattedValue,this.element.val(r),this._localizedFormat(),this._raiseChangeEvent(i))},_convertToExponetial:function(n){var e="",u,i,r=n<0?!0:!1,f;for(n=n.toString(),i=t.preferredCulture(this.model.locale).numberFormat,n=n.replace(".",i["."]),unformattedValue=n,f=null,this.sfType==="ej.NumericTextbox"?(u=r?i.pattern[0]:"n",n=r?n.replace("-",""):n,symbol=""):this.sfType==="ej.PercentageTextbox"?(u=r?i.percent.pattern[0]:i.percent.pattern[1],n=r?n.replace("-",""):n,symbol=i.percent.symbol):this.sfType==="ej.CurrencyTextbox"&&(u=r?i.currency.pattern[0]:i.currency.pattern[1],n=r?n.replace("-",""):n,symbol=i.currency.symbol),idx=0,f=u.length;idx<f;idx++)ch=u.charAt(idx),e+=ch==="n"?n:ch==="$"||ch==="%"?symbol:ch;return{formattedValue:e,unformattedValue:unformattedValue}},_localizedFormat:function(){if(this.culture=t.preferredCulture(this.model.locale),t.isNullOrUndefined(this.model.value)){this._textBox.value="";return}if(this.model.value.toString().indexOf("e")==-1)this._textBox.value=this._removeSeparator(this.model.value),this._focused||this._textBox.value==""||(this._textBox.value=this._formatValue(this.model.value,"n",!0),this.sfType==="ej.PercentageTextbox"?this._appendPercentSymbol(this._textBox.value):this.sfType==="ej.CurrencyTextbox"&&this._appendCurrencySymbol(this._textBox.value));else{var n=this._convertToExponetial(this.model.value);this._textBox.value=n.unformattedValue;this._focused||this._textBox.value==""||(this._textBox.value=n.formattedValue)}},_checkNumValue:function(n){return typeof n=="string"&&(n=this._changeSeparator?this._replaceSeparator(n,this.model.groupSeparator,t.preferredCulture(this.model.locale).numberFormat[","]):n),typeof n!="string"||isNaN(this._parseValue(n))?typeof n!="number"||isNaN(n)?null:n:(n=this._parseValue(n),parseFloat(n))},_setReadOnly:function(n){this.model.readOnly=n;n?(this.element.attr("readonly",!0),this._hiddenInput.attr("readonly",!0)):(this.element.prop("readonly",!1),this._hiddenInput.prop("readonly",!1))},_setWaterMark:function(){this._localizedLabels.watermarkText!=null&&this._textBox.value===""&&n.trim(this._hiddenInput.val())===""&&(this._isWatermark?(this._hiddenInput.attr("placeholder",this._localizedLabels.watermarkText),this.element.attr("placeholder",this._localizedLabels.watermarkText)):this._hiddenSpan.css("display","block").text(this._localizedLabels.watermarkText))},_changeWatermark:function(n){if(!this.model.enabled)return!1;this._isWatermark?(this._hiddenInput.attr("placeholder",n),this.element.attr("placeholder",n)):this._hiddenSpan.text(n)},_setSelectionRange:function(n,t){function f(i){i.collapse(!0);i.moveEnd("character",t);i.moveStart("character",n);i.select()}var i=this._textBox,r,u;try{i.setSelectionRange?this._browsername=="edge"?setTimeout(function(){i.setSelectionRange(n,t)}):i.setSelectionRange(n,t):i.createTextRange&&(r=i.createTextRange(),f(r))}catch(e){u=this;window.setTimeout(function(){if(document.body.focus(),u._textBox.select(),document.selection){var n=document.selection.createRange();f(n)}},1)}},_getSelection:function(n){if(this._textBox.type!="number"){var t=null;return document.selection?(t=document.selection.createRange(),t.text===""?t.text:this._removeFormats(t.text)):n==null?this.model.value:this._removeFormats(n.substring(this._textBox.selectionStart,this._textBox.selectionEnd))}},_caretPosition:function(){var n=this._textBox,t=0,i;if(n.type!="number")return document.selection?(n.focus(),i=document.selection.createRange(),i.moveStart("character",-n.value.length),t=i.text.length):(n.selectionStart||n.selectionStart=="0")&&(t=n.selectionEnd),t},_appendPercentSymbol:function(n){this._percentSymbol&&(n=n.replace(this._percentSymbol,""));n.indexOf(t.preferredCulture(this.model.locale).numberFormat.percent.symbol)<0&&(this._textBox.value=this._formatValue(this._parseValue(n)/100,"p",!0));this._percentSymbol=t.preferredCulture(this.model.locale).numberFormat.percent.symbol},_appendCurrencySymbol:function(n){this._currencySymbol&&(n=n.replace(this._currencySymbol,""));n.indexOf(t.preferredCulture(this.model.locale).numberFormat.currency.symbol)<0&&(this._textBox.value=this._formatValue(this._parseValue(n),"c",!0));this._currencySymbol=t.preferredCulture(this.model.locale).numberFormat.currency.symbol},_removeFormats:function(n){var i=t.preferredCulture(this.model.locale).numberFormat[","];return n!=null?i=="."?n.toString().replace(/["."]/g,""):n.toString().match(new RegExp(i,"g"))?n.toString().replace(new RegExp(i,"g"),""):n:null},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error"):this.wrapper.addClass("e-error")},enable:function(){this.model.enabled=!0;this.element[0].disabled=!1;this.element.prop("disabled",!1);this._hiddenInput.prop("disabled",!1);this.element.removeClass("e-disable").attr({"aria-disabled":!1});this._hiddenInput.removeClass("e-disable").attr({"aria-disabled":!1});this.wrapper.find(".e-select").removeClass("e-disable").attr({"aria-disabled":!1});this.wrapper.find(".e-select span.e-icon.e-arrow").removeClass("e-disable");this.wrapper.removeClass("e-disable-wrap")},disable:function(){this.model.enabled=!1;this.element[0].disabled=!0;this.element.attr("disabled","disabled");this._hiddenInput.attr("disabled","disabled");this.element.addClass("e-disable").attr({"aria-disabled":!0});this._hiddenInput.addClass("e-disable").attr({"aria-disabled":!0});this.wrapper.find(".e-select").addClass("e-disable").attr({"aria-disabled":!0});this.wrapper.find(".e-select span.e-icon.e-arrow").addClass("e-disable");this.wrapper.addClass("e-disable-wrap")},getValue:function(){return this.model.value},_wireEvents:function(){this._on(this._hiddenInput,"focus",this._focusIn);this._on(this.element,"paste",this._paste);this._on(this.element,"blur",this._focusOut);this._on(this.element,"keydown",this._keyDown);this._on(this.element,"keypress",this._keyPress);this._on(this.element,"mousewheel",this._mouseWheel);this._on(this.element,"DOMMouseScroll",this._mouseWheel)},_spinEvents:function(n){this[n](this.spinUp,"mousedown mouseup touchstart touchend",this._spinUpClick);this[n](this.spinDown,"mousedown mouseup touchstart touchend",this._spinDownClick)},_isIE8:function(){var n=!1,i=t.browserInfo();return i.name=="msie"&&i.version=="8.0"&&(n=!0),n},_spinUpClick:function(t){var i=!1,r;(t.button?i=this._isIE8()?t.button!=1:t.button!=0:t.which&&(i=t.which==3),i)||(r=this,t.preventDefault(),clearTimeout(this._timeout),this.model.enabled&&!this.model.readOnly)&&(this.wrapper.find(".e-animate").removeClass("e-animate"),this.spinUp.addClass("e-animate"),this._on(this.spinUp,"mouseleave",this._mouseUpClick),this.spinUp.addClass("e-active"),r=this,t.type=="mouseup"||t.type=="touchend"?(this._updateInputField("increment"),this.spinUp.removeClass("e-active"),this._off(n(document),"mouseup",this._mouseUpClick)):(t.type=="mousedown"||t.type=="touchstart")&&(this._focused||this._hiddenInput[0].focus(),this._timeout=setInterval(function(){r._updateInputField("increment")},150),this._on(n(document),"mouseup",this._mouseUpClick)))},_spinDownClick:function(t){var i=!1,r;(t.button?i=this._isIE8()?t.button!=1:t.button!=0:t.which&&(i=t.which==3),i)||(r=this,t.preventDefault(),clearTimeout(this._timeout),this.model.enabled&&!this.model.readOnly)&&(this.wrapper.find(".e-animate").removeClass("e-animate"),this.spinDown.addClass("e-animate"),this._on(this.spinDown,"mouseleave",this._mouseUpClick),this.spinDown.addClass("e-active"),t.type=="mouseup"||t.type=="touchend"?(this._updateInputField("decrement"),this.spinDown.removeClass("e-active"),this._off(n(document),"mouseup",this._mouseUpClick)):(t.type=="mousedown"||t.type=="touchstart")&&(this._focused||this._hiddenInput[0].focus(),this._timeout=setInterval(function(){r._updateInputField("decrement")},150),this._on(n(document),"mouseup",this._mouseUpClick)))},_mouseUpClick:function(n){n.stopPropagation();clearTimeout(this._timeout);this._off(this.spinUp,"mouseleave",this._mouseUpClick);this._off(this.spinDown,"mouseleave",this._mouseUpClick);this.spinDown.removeClass("e-active");this.spinUp.removeClass("e-active")},_mouseWheel:function(n){if(n.preventDefault(),this._focused||this.element[0].focus(),this.model.enabled&&!this.model.readOnly){var t,i=n.originalEvent;i.wheelDelta?t=i.wheelDelta/120:i.detail&&(t=-i.detail/3);t>0?this._updateInputField("increment"):t<0&&this._updateInputField("decrement");this._cancelEvent(n)}},_numberValue:function(){var n=this._textBox.value;return this.sfType==="ej.NumericTextbox"&&(n=this._formatValue(this.model.value,"n",!0)),this.sfType==="ej.PercentageTextbox"?n=this._formatValue(this.model.value,"n",!0):this.sfType==="ej.CurrencyTextbox"&&(n=this._formatValue(this.model.value,"n",!0)),typeof n=="string"&&!isNaN(this._parseValue(n))?n:""},_formatValue:function(n,i,r){r&&this._updateCultureInfo();var n=t.format(n,i+this.model.decimalPlaces,this.model.locale);return r&&this._restCultureInfo(),n},_parseValue:function(n){this._updateCultureInfo();var n=t.parseFloat(n,this.model.locale);return this._restCultureInfo(),n},_initCustomValue:function(){var n,i=this.sfType=="ej.PercentageTextbox"?"percent":this.sfType=="ej.CurrencyTextbox"?"currency":"numeric";switch(i){case"percent":case"currency":n=this.culture.numberFormat[i];t.isNullOrUndefined(this._options.negativePattern)&&(this.model.negativePattern=n.pattern[0]);t.isNullOrUndefined(this._options.positivePattern)&&(this.model.positivePattern=n.pattern[1]);t.isNullOrUndefined(this._options.currencySymbol)&&i=="currency"&&(this.model.currencySymbol=n.symbol);t.isNullOrUndefined(this._options.groupSize)&&(this.model.groupSize=n.groupSizes[0]);break;case"numeric":n=this.culture.numberFormat;t.isNullOrUndefined(this._options.negativePattern)&&(this.model.negativePattern=n.pattern[0]);t.isNullOrUndefined(this._options.groupSize)&&(this.model.groupSize=n.groupSizes[0])}},_updateCultureInfo:function(){var n,t=this.sfType=="ej.PercentageTextbox"?"percent":this.sfType=="ej.CurrencyTextbox"?"currency":"numeric";n=t=="numeric"?this.culture.numberFormat:this.culture.numberFormat[t];this._oldNegativePattern=n.pattern[0];this._oldGroupSize=n.groupSizes[0];n.pattern[0]=this.model.negativePattern;n.groupSizes[0]=this.model.groupSize;t!="numeric"&&(this._oldPositivePattern=n.pattern[1],n.pattern[1]=this.model.positivePattern);t=="currency"&&(this._oldcurrencySymbol=n.symbol,n.symbol=this.model.currencySymbol)},_restCultureInfo:function(){var n,t=this.sfType=="ej.PercentageTextbox"?"percent":this.sfType=="ej.CurrencyTextbox"?"currency":"numeric";n=t=="numeric"?this.culture.numberFormat:this.culture.numberFormat[t];n.pattern[0]=this._oldNegativePattern;n.groupSizes[0]=this._oldGroupSize;t!="numeric"&&(n.pattern[1]=this._oldPositivePattern);t=="currency"&&(n.symbol=this._oldcurrencySymbol)},_toggleTextbox:function(n){var t=this;t._hiddenInput.toggle(n);t.element.toggle(!n)},_paste:function(n){var i,r;window.clipboardData&&window.clipboardData.getData?i=window.clipboardData.getData("Text"):n.originalEvent.clipboardData&&n.originalEvent.clipboardData.getData&&(i=n.originalEvent.clipboardData.getData("text/plain"));r=t.parseFloat(i,this.model.locale);isNaN(r)?this._cancelEvent(n):(this.element.val(r),this._cancelEvent(n))},_focusIn:function(){if(!this.model.readOnly){if(this._focused=!0,t.isNullOrUndefined(this.model.value)||this.element.val(this._removeSeparator(this.model.value)),this._toggleTextbox(!1),this._textBox=this.element[0],this.element[0].focus(),this._preVal=this.model.value,this._isWatermark||this._hiddenSpan.css("display","none"),this.wrapper.addClass("e-focus"),this.wrapper.removeClass("e-error"),!this._error){if(this._textBox.value!=""){var n=this._formatValue(this._textBox.value,"n",!0);this._textBox.value=n;this._hiddenInput.val(n)}this._setSelectionRange(0,this._textBox.value.length)}this._trigger("focusIn",{value:this.model.value})}},_focusOut:function(){var n;this._focused=!1;this.wrapper.removeClass("e-focus");this._error||(this._textBox.value!=""?(n=t.parseFloat(this._textBox.value,this.model.locale),n<this.model.minValue?this.model.enableStrictMode?this.isValidState=!1:this._textBox.value=this._formatValue(this.model.minValue,"n",!0):n>this.model.maxValue&&(this.model.enableStrictMode?this.isValidState=!1:this._textBox.value=this._formatValue(this.model.maxValue,"n",!0)),this.model.value=t.parseFloat(this._textBox.value,this.model.locale),isNaN(this.model.value)&&!this.model.value&&(this.model.value=null,this.isValidState=!1),this._toggleTextbox(!0),this._textBox=this._hiddenInput[0],this._localizedFormat(),this._checkErrorClass()):(n=this._textBox.value==""?null:this._textBox.value,this.model.value=n,this._hiddenInput.val(n),this._toggleTextbox(!0),this._textBox=this._hiddenInput[0]),this.model.value===null||this.model.value>=this.model.minValue&&this.model.value<=this.model.maxValue?this.isValidState=!0:this.model.enableStrictMode&&(this.isValidState=!1),this._raiseChangeEvent(),this._setWaterMark(),n=t.isNullOrUndefined(this.model.value)?this.model.value:this.model.value.toString().indexOf("e")==-1?this._removeSeparator(this.model.value):this._convertToExponetial(this.model.value).unformattedValue,this.element.val(n),this._updateSeparator(),this._trigger("focusOut",{value:this.model.value}));this._checkErrorClass()},_cancelEvent:function(n){return n.cancelBubble=!0,n.returnValue=!1,n.stopPropagation(),n.preventDefault(),!1},_updateInputField:function(i){var f,e,u,r;this.isValidState=!0;this._focused||n(this._hiddenInput[0]).focus();f=this.model.incrementStep;e=this.model.value;this._textBox.value===""?(this._textBox.value=this._formatValue(this._startValue,"n",!0),f=0):this._textBox.value.indexOf(" ")>=0&&(this._textBox.value=this._textBox.value.replace(" ",""));this.sfType==="ej.PercentageTextbox"||this.sfType==="ej.CurrencyTextbox"?(u=this._textBox.value,r=u,u.indexOf(t.preferredCulture(this.model.locale).numberFormat.percent.symbol)>-1&&(r=u.substring(0,u.length-1)),this.model.value=this._parseValue(r)):this.sfType=="ej.NumericTextbox"&&(this.model.value=t.parseFloat(this._textBox.value,this.model.locale));isNaN(this.model.value)&&!this.model.value&&(this.model.value=this._startValue);this.model.value>=this.model.minValue&&this.model.value>this.model.maxValue?(this.model.value=this.model.maxValue,this._setValue(this.model.value)):this.model.value<this.model.minValue&&this.model.value<=this.model.maxValue?(this.model.value=this.model.minValue,this._setValue(this.model.value)):this.model.value>=this.model.minValue&&this.model.value<=this.model.maxValue&&(r=i=="increment"?this.model.value+f:this.model.value-f,r>=this.model.minValue&&r<=this.model.maxValue&&this._setValue(r));this._checkErrorClass()},_validateDecimal:function(n){var i=String.fromCharCode(n.keyCode);return(i=n.keyCode==188?",":n.keyCode==190?".":n.keyCode==110?t.preferredCulture(this.model.locale).numberFormat["."]:i,t.preferredCulture(this.model.locale).numberFormat["."].charCodeAt(0)==i.charCodeAt(0))?!0:!1},_allowKeyCodes:function(n){for(var i=[38,40,35,36,109,189,46,8,127,37,39,190,9,13,16,17,18,20,110,173,86,88,67],t=0;t<i.length;t++)if(n.keyCode==i[t]||this._validateDecimal(n)&&this.model.decimalPlaces!=0)return!0;return!1},_raiseChangeEvent:function(n){var r=this.model.value,i;this._checkNumValue(this._preVal)!==this._checkNumValue(r)&&(this._preVal=r,this.model.value=this._checkNumValue(this._formatValue(this._preVal,"n",!1)),this._updateHiddenField(),t.isNullOrUndefined(this.model.value)?(i=this.model.value,this.wrapper.removeClass("e-valid")):(i=this.model.value.toString().indexOf("e")==-1?this._removeSeparator(this.model.value):this._convertToExponetial(this.model.value).unformattedValue,this.wrapper.addClass("e-valid")),this.element.val(i),this.element.attr("aria-valuenow",i),this._updateSeparator(),this.element.trigger("change"),this._trigger("_change",{value:this.model.value,isInteraction:!n}),this._trigger("change",{value:this.model.value,isInteraction:!n}))},_updateHiddenField:function(){var n=this._textBox;this._textBox=this._hiddenInput[0];this._localizedFormat();this._textBox=n},_removeSeparator:function(n){if(!t.isNullOrUndefined(n)){var i,r;return n=this._checkNumValue(this._formatValue(n,"n",!1)),i=n.toString(),r=t.preferredCulture(this.model.locale).numberFormat,i.replace(".",r["."])}},_updateSeparator:function(){if(this._changeSeparator&&this.model.value){var n;this.sfType==="ej.NumericTextbox"?n=this._formatValue(this.model.value,"n",!0):this.sfType==="ej.PercentageTextbox"?n=this._formatValue(this.model.value/100,"p",!0):this.sfType==="ej.CurrencyTextbox"&&(n=this._formatValue(this.model.value,"c",!0));this._hiddenInput.val(this._replaceSeparator(n,t.preferredCulture(this.model.locale).numberFormat[","],this.model.groupSeparator))}},_replaceSeparator:function(n,i,r){var f=i===""?new RegExp("\\s","g"):new RegExp("\\"+i,"g"),e,u;return this.model.groupSeparator==t.preferredCulture(this.model.locale).numberFormat["."]?(e=this.model.decimalPlaces,u=n.length-e-1,n.substring(0,u).replace(f,r)+n.substring(u,n.length)):n.replace(f,r)},_checkSeparator:function(n){this.model.groupSeparator=n!=null?this._validateSeparator(n):t.preferredCulture(this.model.locale).numberFormat[","];this._changeSeparator=t.preferredCulture(this.model.locale).numberFormat[","]!=this.model.groupSeparator?!0:!1;this._prevSeparator=this.model.groupSeparator},_validateSeparator:function(n){var i=n.toString(),r=new RegExp("[a-zA-Z0-9]");return i=i.length>1?i[0]:i,r.test(i)?this._prevSeparator!=null?this._prevSeparator:t.preferredCulture(this.model.locale).numberFormat[","]:i},_keyPress:function(n){var f,i;if(n.which!==0&&!n.metaKey&&!n.ctrlKey&&n.keyCode!==8&&n.keyCode!==13){var e=this,r=null,u=".";return cursor=this._caretPosition(),beforeCursor=this._textBox.value.toString().substring(0,cursor),afterCursor=this._textBox.value.toString().substring(cursor),numberFormat=t.preferredCulture(this.model.locale).numberFormat,f=String.fromCharCode(n.which),value=beforeCursor+f+afterCursor,i=numberFormat[u],i=i===u?"\\"+i:i,r=e.model.decimalPlaces===0?/^(-)?(\d*)$/:new RegExp("^(-)?(((\\d+("+i+"\\d*)?)|("+i+"\\d*)))?$"),r.test(value)?void 0:!1}},_validateDecimalOnType:function(n){var r,e,s,h,o,u,i,f;return r=this._caretPosition(),s=this._textBox.value.toString().substring(0,r),h=this._textBox.value.toString().substring(r),o=this._getSelection(this._textBox.value),i=t.preferredCulture(this.model.locale).numberFormat["."],u=t.isNullOrUndefined(this.model.value)?"":this.model.value.toString(),this.model.decimalPlaces!=0?(f=this._textBox.value.split(i)[1],e=u.indexOf(i)>0?u.substring(u.indexOf(i)+1,u.length).length>this.model.decimalPlaces?!0:o.length==0&&r>this._textBox.value.indexOf(i)&&f&&f.length>=this.model.decimalPlaces?!0:!1:o.length==0&&r>this._textBox.value.indexOf(i)&&f&&f.length>=this.model.decimalPlaces?!0:!1):e=!1,e?(this._keypressFlag=!1,this._cancelEvent(n),!1):void 0},_keyDown:function(r){var s,a,k,d,v,y,l,h,c,w;if(!this.model.readOnly)if(this._CurrentCultureInfo=JSON.parse(JSON.stringify(t.preferredCulture())),r.keyCode>=48&&r.keyCode<=57||r.keyCode>=96&&r.keyCode<=105||this._allowKeyCodes(r)){if(r.shiftKey&&(r.keyCode==35||r.keyCode==36||r.keyCode==37||r.keyCode==39||r.keyCode==46||r.keyCode==127)||r.ctrlKey&&(r.keyCode==86||r.keyCode==118||r.keyCode==67||r.keyCode==88))return!0;if(r.ctrlKey==!0&&r.keyCode!=9&&r.keyCode!=17&&r.keyCode!=86&&r.keyCode!=67||r.keyCode==67||r.keyCode==86||r.keyCode==88)return this._keypressFlag=!1,this._cancelEvent(r),!1;if((r.keyCode>=48&&r.keyCode<=57||r.keyCode>=96&&r.keyCode<=105||r.keyCode==110)&&(s=this._caretPosition(),k=this._textBox.value.toString().substring(0,s),d=this._textBox.value.toString().substring(s),v=this._getSelection(this._textBox.value),r.keyCode>=96&&r.keyCode<=105&&(r.keyCode-=48),this.model.validateOnType&&this._validateDecimalOnType(r),this._validateOnType)){var u=t.preferredCulture(this.model.locale).numberFormat["."],f=this.model.value.toString(),it=f.indexOf(u),g=this.model.value,e=this.model.minValue.toFixed(this.model.decimalPlaces),o=this.model.maxValue.toFixed(this.model.decimalPlaces),p=!1;if((e.toString().indexOf("e")>0||o.toString().indexOf("e")>0)&&(p=!0),p)this.model.decimalPlaces!=0?(y=this._textBox.value.split(".")[1],a=f.indexOf(u)>0||Number(f)<Number(e)||Number(f)>Number(o)?f.substring(f.indexOf(u)+1,f.length).length>this.model.decimalPlaces?!0:v.length==0&&s>this._textBox.value.indexOf(u)&&y&&y.length>=this.model.decimalPlaces?!0:!1:v.length==0&&s>this._textBox.value.indexOf(u)&&y&&y.length>=this.model.decimalPlaces?!0:!1):a=!1;else if(u!="."&&(f=this._textBox.value.toString(),this.model.minValue.toString().match(new RegExp(".","g"))&&(e=this.model.minValue.toString().replace(/["."]/g,u)),this.model.maxValue.toString().match(new RegExp(".","g"))&&(o=this.model.maxValue.toString().replace(/["."]/g,u))),h=e.toString().indexOf(u)>0?Number(e.toString().substring(0,e.toString().indexOf(u))):this.model.minValue,c=o.toString().indexOf(u)>0?Number(o.toString().toString().substring(0,o.toString().indexOf(u))):this.model.maxValue,it>0){g=Number(f.substring(f.indexOf(u)+1,f.toString().length));h=e.toString().indexOf(u)>0?Number(e.toString().substring(e.toString().indexOf(u)+1,e.toString().length)):0;c=o.toString().indexOf(u)>0?Number(o.toString().substring(o.toString().indexOf(u)+1,o.toString().length)):0;var rt=Number(f.substring(0,f.indexOf(u))),ut=Number(e.toString().substring(0,e.toString().indexOf(u))),ft=Number(o.toString().substring(0,o.toString().indexOf(u)));a=this._validateValue(g,h,c,!0,rt,ut,ft)?!1:!0}else a=this._validateValue(g,h,c,!1)?!1:!0;if(a)return this._keypressFlag=!1,this._cancelEvent(r),!1}if(r.keyCode==38&&this._allowkeyboard&&(this._updateInputField("increment"),this._cancelEvent(r)),r.keyCode==40&&this._allowkeyboard&&(this._updateInputField("decrement"),this._cancelEvent(r)),r.keyCode==8&&(s=this._caretPosition(),k=this._textBox.value.substring(0,s),d=this._textBox.value.substring(s),v=this._getSelection(this._textBox.value)),(r.keyCode==46||r.keyCode==127)&&(s=this._caretPosition(),k=this._textBox.value.substring(0,s),d=this._textBox.value.substring(s),v=this._getSelection(this._textBox.value)),this._validateDecimal(r)&&this.model.decimalPlaces!=0&&r.keyCode!=46){if(l=t.preferredCulture(this.model.locale).numberFormat["."],w=this._textBox.value.split(l),w[1]==i){var b=this._caretPosition(),tt=w[0].substring(0,b),nt=w[0].substring(b);if((this.model.minValue.toString().indexOf("e")>0||this.model.maxValue.toString().indexOf("e")>0)&&(p=!0),nt.length>this.model.decimalPlaces&&this.model.validateOnType==!0)return this._keypressFlag=!1,this._cancelEvent(r),!1;if(this._validateOnType&&!p)if(this.model.minValue.toString().match(new RegExp(".","g"))&&(h=this.model.minValue.toString().replace(/["."]/g,l)),this.model.maxValue.toString().match(new RegExp(".","g"))&&(c=this.model.maxValue.toString().replace(/["."]/g,l)),h=h.indexOf(l)>0?Number(h.substring(0,h.indexOf(l))):Number(h),c=c.indexOf(l)>0?Number(c.substring(0,c.indexOf(l))):Number(c),this._validateValue(this.model.value,h,c,"DecimalKeyPressed"))this._textBox.value=tt+l+nt;else return this._keypressFlag=!1,this._cancelEvent(r),!1;else this._textBox.value=tt+l+nt;this._setSelectionRange(b+1,b+1)}this._cancelEvent(r)}else(r.keyCode==190||r.keyCode==110)&&this._cancelEvent(r);(r.keyCode==109||r.keyCode==189||r.keyCode==173)&&(this._caretPosition()!=0&&this._getSelection(this._removeFormats(this._textBox.value))!=this.model.value||this.model.minValue>=0&&!this.model.enableStrictMode||this._textBox.value.toString().match(new RegExp("-","g"))&&this._getSelection(this._textBox.value)===""?this._cancelEvent(r):this._getSelection()==this.model.value&&(this.model.value=null));r.keyCode==13&&this._checkNumValue(this._preVal)!==this._checkNumValue(this._textBox.value)&&this._setValue(this._textBox.value)}else(r.keyCode!=27&&!r.ctrlKey||r.ctrlKey&&r.keyCode==90&&n.trim(this._textBox.value)==="")&&(this._keypressFlag=!1,this._cancelEvent(r))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.NumericTextbox.Locale=t.NumericTextbox.Locale||{};t.NumericTextbox.Locale["default"]=t.NumericTextbox.Locale["en-US"]={watermarkText:"Enter value"};t.PercentageTextbox.Locale=t.PercentageTextbox.Locale||{};t.PercentageTextbox.Locale["default"]=t.PercentageTextbox.Locale["en-US"]={watermarkText:"Enter value"};t.CurrencyTextbox.Locale=t.CurrencyTextbox.Locale||{};t.CurrencyTextbox.Locale["default"]=t.CurrencyTextbox.Locale["en-US"]={watermarkText:"Enter value"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejMaskEdit","ej.MaskEdit",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{maskFormat:"",value:null,watermarkText:"",name:null,height:"",width:"",showError:!1,htmlAttributes:{},cssClass:"",customCharacter:null,inputMode:"text",readOnly:!1,textAlign:t.TextAlign.Left,hidePromptOnLeave:!1,showRoundedCorner:!1,enablePersistence:!1,enabled:!0,showPromptChar:!0,validationRules:null,validationMessage:null,keydown:null,keyup:null,keyPress:null,change:null,mouseover:null,mouseout:null,focusIn:null,focusOut:null,create:null,destroy:null},dataTypes:{maskFormat:"string",showError:"boolean",enabled:"boolean",customCharacter:"string",cssClass:"string",watermarkText:"string",showRoundedCorner:"boolean",showPromptChar:"boolean",inputMode:"enum",textAlign:"enum",hidePromptOnLeave:"boolean",readOnly:"boolean",validationRules:"data",validationMessage:"data",htmlAttributes:"data"},_setModel:function(n){for(var i in n)switch(i){case"value":t.isPlainObject(n[i])&&(n[i]=null);this._setValue(n[i]);n[i]=this.get_UnstrippedValue();this._raiseEvents("change",!0);break;case"width":this._setWidth(n[i]);break;case"height":this._setHeight(n[i]);break;case"watermarkText":this.model.watermarkText=n[i];this._changeWatermark(n[i]);break;case"showRoundedCorner":this._roundedCorner(n[i]);break;case"showPromptChar":this._setShowPrompt(n[i]);break;case"validationRules":this.model.validationRules!=null&&(this._hiddenInput.rules("remove"),this.model.validationMessage=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=n[i];this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation());break;case"textAlign":this._setTextAlign(n[i]);break;case"inputMode":this._setInputMode(n[i]);break;case"maskFormat":this.model.maskFormat=n[i];this._valueMapper();this._setMask(n[i]);n[i]=this.model.maskFormat;break;case"cssClass":this._setSkin(n[i]);break;case"readOnly":this._setReadOnly(n[i]);break;case"enabled":this.model.enabled=n[i];this._controlStatus(n[i]);break;case"htmlAttributes":this._addAttr(n[i]);break;case"hidePromptOnLeave":this.model.hidePromptOnLeave=n[i];this._textbox.value!=""&&(this.model.hidePromptOnLeave?(this._unStrippedMask=this._textbox.value,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=this._textbox.value.replace(/[ ]/g,"_"),this.model.value=this._textbox.value)}},observables:["value"],_destroy:function(){t.isNullOrUndefined(this._hiddenInput)||this.element.attr("name",this._hiddenInput.attr("name"));this._isWatermark&&this.element.removeAttr("placeholder");this.element.insertAfter(this.wrapper);t.isNullOrUndefined(this.wrapper)||this.wrapper.remove();this.model.textAlign&&this.element.css("text-align","");this.element.val("").removeClass(" e-mask e-input e-disable").empty()},_init:function(n){if(this._options=n,this._tempMask=this.model.maskFormat,this.element.is("input")&&(this.element.is("input[type=text]")||this.element.is("input[type=password]")||!this.element.attr("type")))this._isWatermark="placeholder"in document.createElement("input"),this._setValues(),this._valueMapper(),this._renderControl(),this._initObjects(),this._wireEvents(),this._addAttr(this.model.htmlAttributes),this.model.validationRules!=null&&(this._initValidator(),this._setValidation());else return this._destroy(),!1;n&&n.value!=r&&this.model.value!==n.value&&this._trigger("_change",{value:this.get_UnstrippedValue(),unmaskedValue:this.get_StrippedValue()})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="name"?r._hiddenInput.attr(i,n):u=="disabled"&&n=="disabled"?r.disable():u=="readonly"&&n=="readOnly"?r._setReadOnly(!0):u=="style"||u=="id"?r.wrapper.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_setValidation:function(){var r,i,u,f;this._hiddenInput.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();name=this._hiddenInput.attr("name");r.settings.messages[name]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[name][i]=n.validator.messages[i];for(f in this.model.validationMessage)i==f?u=this.model.validationMessage[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[name][i]=u!=null?u:n.validator.messages[i]}},_setShowPrompt:function(n){this.model.showPromptChar=n;this._textbox.value=this.model.showPromptChar?this._unStrippedMask:this.get_UnstrippedValue()},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_setValues:function(){this._unStrippedMask=null;this._charMap={"9":"[0-9 ]",a:"[A-Za-z0-9 ]",A:"[A-Za-z0-9]",N:"[0-9]","#":"[0-9]","&":"[^]+","<":"",">":"",C:this.model.customCharacter!=null?"["+this.model.customCharacter+"]":"[A-Za-z ]","?":"[A-Za-z]"}},_renderControl:function(){if(this.model.name=this.element.attr("name")!=null?this.element.attr("name"):this.model.name!=null?this.model.name:this.element[0].id,this.element.attr("name")!=null&&this.element.removeAttr("name"),this.wrapper=t.buildTag("span.e-mask e-widget "+this.model.cssClass),this.innerWrapper=t.buildTag("span.e-in-wrap e-box"),this.wrapper.append(this.innerWrapper).insertBefore(this.element),this.innerWrapper.append(this.element),this._hiddenInput=t.buildTag("input#"+this._id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element),this._isWatermark||this.model.inputMode=="password"||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this.model.watermarkText),this._hiddenSpan.css("display","none"),this._hiddenSpan.bind("mousedown",n.proxy(this._OnFocusHandler,this))),t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value),t.isNullOrUndefined(this.model.value)||this.wrapper.addClass("e-valid"),this._hiddenInput.attr({name:this.model.name,value:this.model.value}),this.element.attr({"aria-invalid":!1}).addClass("e-input"),this.model.maskFormat==""&&this.model.value==null){var i=this;setTimeout(function(){i.element.val()!=""&&(i.option("value",i.element.val()),i.previousValue=i.model.value,i._initObjects())},500)}else this.element.attr({value:this.model.value});t.isNullOrUndefined(this._options.inputMode)&&!t.isNullOrUndefined(this.element.attr("type"))?this.model.inputMode=this.element.attr("type"):this._setInputMode(this.model.inputMode);this._setWidth(this.model.width);this._setHeight(this.model.height);this._roundedCorner(this.model.showRoundedCorner);this._setTextAlign(this.model.textAlign);this._setReadOnly(this.model.readOnly);this._controlStatus(this.model.enabled);this.previousValue=this.model.value},_initObjects:function(){var t,n;if(this._textbox=this.element[0],this._keypressFlag=0,this._selectedTextKeyDown=0,this._keydownFlag=0,this.model.maskFormat.indexOf("\\")>=0){for(t=0,n=0;n<this.model.maskFormat.length;n++)this.model.maskFormat[n]=="\\"&&(t+=1);this._maskLength=this.model.maskFormat.length-t}else this._maskLength=this.model.maskFormat.length;this._maskModel=this.model.maskFormat.indexOf("\\")>=0?this.model.maskFormat:this.model.maskFormat.replace(/[9?CANa#&]/g,"_");(this._maskModel.indexOf("<")>=0||this._maskModel.indexOf(">")>=0)&&(this._maskModel=this._maskModel.replace(/[<>]/g,""),this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,""),this._valueMapper());this._validatedValue=this._maskModel;this.model.inputMode!="password"&&(this._setValue(this.model.value),this._setWaterMark());this.model.showError&&this.element.addClass("e-error").attr("aria-invalid","true")},_setWidth:function(n){this.wrapper.width(n)},_setHeight:function(n){this.wrapper.height(n)},_roundedCorner:function(n){n&&!this.innerWrapper.hasClass("e-corner")?this.innerWrapper.addClass("e-corner"):this.innerWrapper.hasClass("e-corner")&&this.innerWrapper.removeClass("e-corner")},_setTextAlign:function(n){n=="right"?(this.element.css("text-align",""),this.wrapper.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.element.css("text-align",n))},_setInputMode:function(n){this.element.attr("type",n)},_setReadOnly:function(n){this.model.readOnly=n;n?this.element.attr("readonly",!0):this.element.removeAttr("readonly")},_setSkin:function(n){this.wrapper.removeClass(this.model.cssClass);this.wrapper.addClass(n)},_setWaterMark:function(){var i=this.model.showPromptChar?this._maskModel:this._maskModel!=""&&this._maskModel!=null?this._maskModel.replace(/[_]/g," "):this._maskModel;this._maskModel=this.model.maskFormat.indexOf("\\")>=0?this.model.maskFormat===""?null:this.model.maskFormat:n.trim(this.model.maskFormat.replace(/[9?CANa#&]/g,"_"))===""?null:this.model.maskFormat.replace(/[9?CANa#&]/g,"_");(this._maskModel!=""&&this._maskModel!=null&&this._textbox.value==i||i==""&&this._textbox.value==""&&this.model.inputMode!="password")&&(this._textbox.value="");this.model.watermarkText.length!=0||t.isNullOrUndefined(this.element.attr("placeholder"))||(this.model.watermarkText=this.element.attr("placeholder"));this.model.watermarkText&&(this._isWatermark?this.element.attr("placeholder",this.model.watermarkText):this._textbox.value?this._hiddenSpan.css("display","none").text(this.model.watermarkText):this._hiddenSpan.css("display","block").text(this.model.watermarkText));this.model.watermarkText||this._textbox.value||!this.model.maskFormat||(this.model.hidePromptOnLeave?(this._unStrippedMask=this._maskModel,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=i)},_changeWatermark:function(t){if(!this.model.enabled)return!1;var i=this.model.showPromptChar?this._maskModel:this._maskModel!=""&&this._maskModel!=null?this._maskModel.replace(/[_]/g," "):this._maskModel;(this._textbox.value==i||this._textbox.value==""||n.trim(this.get_StrippedValue())=="")&&this.model.inputMode!="password"&&(this._textbox.value="");this._isWatermark?this.element.attr("placeholder",t):this._hiddenSpan.text(t);!this.model.watermarkText&&n.trim(this.get_StrippedValue())==""&&this.model.maskFormat&&(this.model.hidePromptOnLeave?(this._unStrippedMask=this._maskModel,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=i)},_showAlert:function(){var t=this;this.element.addClass("e-error").attr("aria-invalid","true").animate({Opacity:1},700,null,function(){n(t._textbox).removeClass("e-error").attr("aria-invalid","false")})},_unMask:function(){for(var u=this.model.value,f="",n=i=0,t,o="_",s,e;n<this._rules.length;){if(t=u[i],s=this._rules[n],t==r)break;if(t===s||t===o?(f+=t===o?o:"",i+=1,n+=1):this._rules[n].rule!=r&&t.match(this._rules[n].rule)?(e=u.charCodeAt(i),this._validateChars(e,n)?(f+=u.charAt(i),n++,i++):n++):typeof s!="string"?t.match(this._rules[n].rule)?(e=u.charCodeAt(i),this._validateChars(e,n)&&(f+=u.charAt(i),n++,i++)):(i++,n++):n++,i>u.length)break}return f},_validateValue:function(){var b,v,o,e,w,c,n,f,y;if(!t.isNullOrUndefined(this.model.value)){var h=this.model.value,u=this._maskModel,i=f=0,s,a="_",p,l=this._unMask();if(this._isWatermark||this.model.inputMode=="password"||this._hiddenSpan.css("display","none"),this._maskLength==0)return this._textbox.value=h,this._setWaterMark(),!0;for(b=this.model.value.toString(),h=this.model.maskFormat.indexOf("\\")>=0||this.model.customCharacter!=null?this.model.value:this.model.value=b.replace(/[\(\)-]/g,"");i<this._rules.length;){if(s=l[f],p=this._rules[i],s==r)break;if(s===p||s===a?(s===a?a:"",o=u.substring(0,i),e=u.substring(i),u=o+s+e.substr(1,e.length),f+=1,i+=1):this._rules[i].rule!=r?(v=l.charCodeAt(f),this._validateChars(v,i)?(o=u.substring(0,i),e=u.substring(i),u=o+l.charAt(f)+e.substr(1,e.length),i++,f++):i++):typeof p!="string"?s.match(this._rules[i].rule)?(v=l.charCodeAt(f),this._validateChars(v,i)?(o=u.substring(0,i),e=u.substring(i),u=o+l.charAt(f)+e.substr(1,e.length),i++,f++):i++):(o=u.substring(0,i),e=u.substring(i),u=o+a+e.substr(1,e.length),f++,i++):i++,f>h.length)break}if(this.model.value)if(this._textbox.value=u,this.model.value=this.get_UnstrippedValue(),this.model.maskFormat.indexOf("\\")>=0||this.model.maskFormat.indexOf("&")>=0){for(this._textbox.value="",w=0,_pos=0;_pos<this.model.maskFormat.length;_pos++)this.model.maskFormat[_pos]=="\\"&&(w+=1);if(c=0,this.model.value.length==u.length-w)for(n=0;n<this.model.maskFormat.length;++n)this.model.maskFormat[n]=="\\"?c=c+1:this.model.maskFormat[n-1]=="\\"?this._textbox.value+=h[n-c]:this.model.maskFormat[n]=="\\"||(this._textbox.value+=h.length<=n-c?u[n].replace(/[9?CANa#&]/g,"_"):h[n-c].replace(/[9?CANa#&]/g,"_"));else for(this._textbox.value="",n=0;n<this.model.maskFormat.length;++n)this.model.maskFormat[n-1]=="\\"?this._textbox.value+=u[n]:this.model.maskFormat[n]=="\\"||(this._textbox.value+=u[n].replace(/[9?CANa#&]/g,"_"))}else this.model.hidePromptOnLeave?(this._unStrippedMask=u.replace(/[ ]/g,"_"),this._textbox.value=u):this._textbox.value=u;else if(this.model.maskFormat.indexOf("\\")>=0)for(n=0;n<this.model.maskFormat.length;++n)this.model.maskFormat[n-1]=="\\"?this._textbox.value+=this.model.maskFormat[n]:this.model.maskFormat[n]=="\\"||(this._textbox.value+=this.model.maskFormat[n].replace(/[9?CANa#&]/g,"_"));else this._textbox.value=this.model.maskFormat.replace(/[9?CANa#&]/g,"_");if(this._textbox.value!=r&&this.model.hidePromptOnLeave&&(this._unStrippedMask=this._textbox.value.replace(/[ ]/g,"_"),this._textbox.value=this.get_UnstrippedValue()),this._maskModel!=null&&(this._textbox.value.indexOf(">")>=0||this._textbox.value.indexOf("<")>=0)&&(this._textbox.value=this._textbox.value.replace(/[<>]/g,""),this._tempMask=this.model.maskFormat,this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,"")),this.model.showPromptChar||(this._textbox.value=this.get_UnstrippedValue()),this._tempMask!=null)for(f=0;f<this._textbox.value.length;f++)y=this._updateCasing(this._textbox.value[f],f),t.isNullOrUndefined(y)||(this._textbox.value=this._textbox.value.substring(0,f)+y+this._textbox.value.substring(f+y.length));this._setWaterMark()}},_selectionText:function(n,i){var r=t.isNullOrUndefined(this._maskModel)?"":this._maskModel.substring(n,i);return(this._textbox.value=this._textbox.value.substring(0,n)+r+this._textbox.value.substring(i),this._keydownFlag==1)?(this._setCaretPosition(n),n):this._keydownFlag==2?(this._setCaretPosition(i),i):n},_caretPosition:function(n){var t=0,i,r;return document.selection?(i=document.selection.createRange(),r=i.text.length,i.moveStart("character",-n.value.length),t=i.text.length-r,r!=0&&(t=this._selectionText(t,i.text.length),this._selectedTextKeyDown=1)):(n.selectionStart||n.selectionStart=="0")&&(t=n.selectionStart,n.selectionStart!=n.selectionEnd&&(this._keydownFlag&&(t=this._selectionText(n.selectionStart,n.selectionEnd)),this._selectedTextKeyDown=1)),t},_setCaretPosition:function(n){var t=this._textbox,i;window.navigator.appName=="Microsoft Internet Explorer"?t.createTextRange&&(i=t.createTextRange(),i.move("character",n),i.select()):t.selectionStart||t.selectionStart=="0"?(t.focus(),t.setSelectionRange(n,n)):t.focus()},_validateChars:function(t,i){var o=this._charMap,u=!1,f,r,e;return this.model.maskFormat.indexOf("\\")>=0?(_position=this._getCunrrentPos(i),f=this.model.maskFormat.substr(i+_position,1)):f=this.model.maskFormat.substr(i,1),r=this.model.customCharacter,e=String.fromCharCode(t),n.each(o,function(n,t){f==n&&(r!=null&&(n=="C"?t="["+r+"]":(n=="A"||n=="N"||n=="#")&&(t=t.replace("]","")+r+"]")),u=e.match(new RegExp(t))?!0:!1)}),u},_seekNext:function(){for(var n=this._caretPosition(this._textbox),r=n,u=!0,t,i;u;){if(n>=0&&n<this._maskLength){for(t=0,i=0;i<=n;i++)this.model.maskFormat[i]=="\\"&&(t+=1);if(this.model.maskFormat.charAt(n)!="C"&&(this.model.maskFormat.indexOf("\\")>=0?this.model.maskFormat.charAt(n+t)!="\\"&&this.model.maskFormat.charAt(n+t-1)!="\\"&&(this._charMap[this.model.maskFormat.charAt(n+t)]||(this._setCaretPosition(n),n++)):this._charMap[this.model.maskFormat.charAt(n)]||(this._setCaretPosition(n),n++),n!=r)){r=n;continue}}u=!1}return n},_seekBefore:function(){var n=this._caretPosition(this._textbox),i=--n,t=!0;for(this._selectedTextKeyDown==1&&(t=!1);t;){if(n>=0&&n<this._maskLength&&(this.model.maskFormat.charAt(n)!="C"&&(this._charMap[this.model.maskFormat.charAt(n)]||this._setCaretPosition(--n)),n!=i)){i=n;continue}t=!1}return n},_writeBuffer:function(n,t){var u,o,f,i,s,e;if(t<=this._maskLength){if(u=this._textbox.value,this._tempMask!=null&&(o=this._updateCasing(n,t)),n=o==r?n:o,f=u.substring(0,t),i=u.substring(t),this.model.maskFormat.indexOf("\\")>=0){for(s=0,e=0;e<=t;e++)this.model.maskFormat[e].indexOf("\\")>=0&&t!=0&&(s+=1);this._textbox.value=this.model.maskFormat[t+s].indexOf("\\")>=0?f+u[t]+i.substr(1,i.length):f+n+i.substr(1,i.length)}else this._textbox.value=f+n+i.substr(1,i.length);this._setCaretPosition(t+1)}},_updateCasing:function(n,t){for(var r,i=0;i<t+1;i++)(this._tempMask.substr(i,1)=="<"||this._tempMask.substr(i,1)==">")&&t++;for(r=t;r>-1;r--){if(this._tempMask.substr(r,1)=="<")return n.toLowerCase();if(this._tempMask.substr(r,1)==">")return n.toUpperCase()}},get_StrippedValue:function(){var u,o=this.model.maskFormat,f=null,e,i,t,r;if(u=this._textbox.value==""&&this.model.inputMode!="password"?this._maskModel:this._textbox.value,o.length==0)return u;for(e=0,i=0;i<o.length;i++)f=n.trim(f),this.model.maskFormat.indexOf("\\")>=0?this.model.maskFormat[i]=="\\"?e+=1:this.model.maskFormat[i-1]=="\\"?f+=this._textbox.value[i-e]:(t=o[i],r=null,"9?$a*".indexOf(t)!=-1?r=this._charMap[t]:t=="A"||t=="N"||t=="#"?r=this._charMap[t].replace("]","")+this.model.customCharacter+"]":t=="C"?r="["+this.model.customCharacter+"]":t=="&"&&(f+=u[i-e]),r&&u[i-e]&&u[i-e].match(new RegExp(r))&&(f+=u[i-e])):(t=o[i],r=null,"9?$a*".indexOf(t)!=-1?r=this._charMap[t]:t=="A"||t=="N"||t=="#"?r=this._charMap[t].replace("]","")+this.model.customCharacter+"]":t=="C"?r="["+this.model.customCharacter+"]":t=="&"&&(f+=u[i-e]),r&&u[i]&&u[i].match(new RegExp(r))&&(f+=u[i]));return f},get_UnstrippedValue:function(){var t=this._textbox.value==""&&this.model.inputMode!="password"?this._maskModel:this._textbox.value,i=null;return this.model.maskFormat.length==0?t:(t!=r&&(i=n.trim(t.replace(/[_]/g," "))==""?null:t.replace(/[_]/g," ")),i)},_setValue:function(i){(t.isNullOrUndefined(i)||n.trim(i)=="")&&(i=null);this.model.value=i;this._isWatermark||this.model.inputMode=="password"||this._hiddenSpan.css("display","none");t.isNullOrUndefined(this.model.maskFormat)||this.model.maskFormat==""?(this._textbox.value=t.isNullOrUndefined(i)?"":i,this._unStrippedMask=this._textbox.value):(this._validateValue(),t.isNullOrUndefined(this.model.value)&&(this._textbox.value=t.isNullOrUndefined(i)?"":i,this._unStrippedMask=this._maskModel));this._setWaterMark()},_valueMapper:function(){for(var u=[],i=0,o=this.model.maskFormat||"",s=o.split(""),f=0,n,r="",e,h=this._charMap,t;f<o.length;f++)if(n=s[f],e=h[n],e)u[i]={rule:e},r+="_",i+=1;else for(n==="\\"&&(idx+=1,n=s[idx]),n=n.split(""),t=0;t<n.length;t++)u[i]=n[t],r+=n[t],i+=1;this._rules=u;this._emptyMask=r;this._maskLength=r.length},_setMask:function(i){this._maskLength=i.length;this.model.maskFormat=i;this._tempMask=this.model.maskFormat;this._maskModel=i.replace(/[9?CANa]/g,"_");(this._maskModel.indexOf("<")>=0||this._maskModel.indexOf(">")>=0)&&(this._maskModel=this._maskModel.replace(/[<>]/g,""),this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,""));t.isNullOrUndefined(this.model.maskFormat)||this.model.maskFormat==""?this.model.watermarkText||this._textbox.value==this._maskModel||(this.model.maskFormat?this.model.hidePromptOnLeave?(this._textbox.value=this._maskModel,this._unStrippedMask=this._textbox.value,this._textbox.value=this.get_UnstrippedValue()):this._textbox.value=this._maskModel:(unstripVal=this._unStrippedMask.replace(/[_]/g," "),this._textbox.value=this.model.customCharacter==null?n.trim(unstripVal.replace(/[\(\)-]/g,"")):n.trim(unstripVal),this._unStrippedMask=this._textbox.value)):this._validateValue()},enable:function(){this.element.disabled=!1;this.element.removeAttr("disabled").removeClass("e-disable").attr({"aria-disabled":!1});this.wrapper.removeClass("e-disable-wrap");this.model.enabled=!0},disable:function(){this.element.disabled=!0;this.element.attr("disabled","disabled").addClass("e-disable").attr({"aria-disabled":!0});this.wrapper.addClass("e-disable-wrap");this.model.enabled=!1},clear:function(){this._textbox.value=this.model.maskFormat.replace(/[9?aCAN]/g,"_");this.model.value=this.get_StrippedValue()},_wireEvents:function(){this._on(this.element,"focus",this._OnFocusHandler);this._on(this.element,"blur",this._OnBlurHandler);this._on(this.element,"keydown",this._OnKeyDownHandler);this._on(this.element,"keypress",this._OnKeyPressHandler);this._on(this.element,"keyup",this._OnKeyUpHandler);this._on(this.element,"mouseover",this._OnMouseOverHandler);this._on(this.element,"mouseout",this._OnMouseOutHandler);this._on(this.element,"paste",this._OnPasteHandler);this._on(this.element,"cut",this._OnCutHandler)},_OnCutHandler:function(){var i=t.isNullOrUndefined(this._maskModel)?"":this._maskModel.substring(this._textbox.selectionStart,this._textbox.selectionEnd),r=this._textbox.value.substring(0,this._textbox.selectionStart),u=this._textbox.value.substring(this._textbox.selectionEnd),f=this._textbox.selectionStart,n=this;setTimeout(function(){n._textbox.value=r+i+u;n._setCaretPosition(f);n._raiseEvents("change")},0)},_OnPasteHandler:function(){var t=this;return setTimeout(function(){var i=n(t._textbox).val();t._setValue(i);t._raiseEvents("change")},0),!0},_OnFocusHandler:function(){this.wrapper.addClass("e-focus");var i=this.model.showPromptChar?this._maskModel:this._maskModel!=""&&this._maskModel!=null?this._maskModel.replace(/[_]/g," "):this._maskModel;this.model.readOnly||(this._focusValue=this.model.value,this._isWatermark||this.model.inputMode=="password"||this._hiddenSpan.css("display","none"),this._textbox.value==""&&this._maskModel!=""&&this.model.inputMode!="password"&&(this._textbox.value=this.model.maskFormat.indexOf("\\")>=0?this.model.watermarkText:t.isNullOrUndefined(this._maskModel)?"":i),this._maskModel!=null&&(this._textbox.value.indexOf("<")>=0||this._textbox.value.indexOf(">")>=0)&&(this._textbox.value=this._textbox.value.replace(/[<>]/g,""),this._maskModel=this._textbox.value,this._tempMask=this.model.maskFormat,this.model.maskFormat=this.model.maskFormat.replace(/[<>]/g,"")),this._textbox.value!=i&&this._unStrippedMask!=null&&this.model.hidePromptOnLeave&&(this._textbox.value=this._unStrippedMask),this.model.showPromptChar||(this._textbox.value=this.get_UnstrippedValue()),n.fn.selectRange=function(n,t){return this.each(function(){if(this.setSelectionRange)this.focus(),this.setSelectionRange(n,t);else if(this.createTextRange){var i=this.createTextRange();i.collapse(!0);i.moveEnd("character",t);i.moveStart("character",n);i.select()}})},this.model.maskFormat&&n(this.element).selectRange(0,0),this._raiseEvents("focusIn"))},_OnBlurHandler:function(){var f,i,n,u;if(this.wrapper.removeClass("e-focus"),this.model.value=this.get_StrippedValue(),f=[],i=[],(this._textbox.value.indexOf("_")!=-1||this._textbox.value.indexOf(" ")!=-1)&&!t.isNullOrUndefined(this.model.value)){for(n=0;n<this.model.maskFormat.length;n++)this.model.maskFormat[n]=="A"||this.model.maskFormat[n]=="?"?f.push(n):(this.model.maskFormat[n]=="9"||this.model.maskFormat[n]=="a"||this.model.maskFormat[n]=="C")&&i.push(n);for(n=0;n<f.length;n++)this._textbox.value[f[n]]==="_"&&(this._showAlert(),this.model.value=this._textbox.value);for(n=0;n<i.length;n++)if(this.model.value[i[n]]=="_"||this.model.value[i[n]]==" ")for(this.model.value=this.model.value.substr(0,i[n])+this.model.value.substr(i[n]+1,this.model.value.length),u=n;u<i.length;u++)i[u]=i[u]-1}this.model.value=this.model.value!=null?this.model.value.replace(/\s+/g,""):this.model.value;this._textbox.value!=r&&(this.model.watermarkText==""||this.model.watermarkText!=""&&this.model.value!="")&&(this.model.hidePromptOnLeave?(this._unStrippedMask=this._textbox.value,this._textbox.value=this.get_UnstrippedValue()):this._unStrippedMask=this._textbox.value);this.model.inputMode!="password"&&this._setWaterMark();this._raiseEvents("change");this._raiseEvents("focusOut")},_OnKeyDownHandler:function(n){var r,e,i;if(!this.model.readOnly){if(this._keypressFlag=0,this._raiseEvents("onKeyDown",null,{keyCode:n.keyCode,altKey:n.altKey,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,originalArgs:n}),this.element.removeClass("error"),this._maskLength==0)return!0;var u=n.keyCode?n.keyCode:n.charCode,o=String.fromCharCode(u),i=this._seekNext(),f=this.model.showPromptChar?"_":" ",e=t.browserInfo().name;if(e=="msie"&&this._textbox.value==""){if(this.model.maskFormat.indexOf("\\")>=0)for(r=0;r<this.model.maskFormat.length;++r)this.model.maskFormat[r-1]=="\\"?this._textbox.value+=this.model.maskFormat[r]:this.model.maskFormat[r]=="\\"||(this._textbox.value+=this.model.maskFormat[r].replace(/[9?CANa#&]/g,"_"));else this._textbox.value=this.model.maskFormat.replace(/[9?CANa#&]/g,"_");this._setCaretPosition(i)}if(u>=35&&u<=41&&(window.navigator.appCodeName=="Mozilla"||window.navigator.appCodeName=="opera")&&(this._keypressFlag=1),n.shiftKey&&(n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39||n.keyCode==46||n.keyCode==127)||n.ctrlKey&&(n.keyCode==86||n.keyCode==65||n.keyCode==67||n.keyCode==88)){this._keypressFlag=1;return}return u==8?this.model.inputMode!="password"?(this._keydownFlag=1,i=this._seekBefore(),this._selectedTextKeyDown?!this.model.showPromptChar&&this._selectedTextKeyDown&&(this._textbox.value=this.get_UnstrippedValue(),this._setCaretPosition(i+1)):(i>=0&&i<this._maskLength&&this._writeBuffer(f,i),this._setCaretPosition(i)),this._keydownFlag=0,this._selectedTextKeyDown=0,n.preventDefault(),!1):(this._keypressFlag=1,!0):n.keyCode==46||n.keyCode==127?this.model.inputMode!="password"?(this._keydownFlag=2,i=this._seekNext(),this._selectedTextKeyDown?!this.model.showPromptChar&&this._selectedTextKeyDown&&(this._textbox.value=this.get_UnstrippedValue(),this._setCaretPosition(i)):i>=0&&i<this._maskLength&&(_position=this._getCunrrentPos(i),this.model.maskFormat[i+_position]=="&"||this._writeBuffer(f,i)),this._keydownFlag=0,this._selectedTextKeyDown=0,n.preventDefault(),!1):(this._keypressFlag=1,!0):void 0}},_ErrorHandler:function(n){var t=this.model.showPromptChar?"_":" ";this._textbox.value==""&&(this._textbox.value=this.model.maskFormat.replace(/[9?$CANa*]/g,t));this._setCaretPosition(n);this._showAlert()},_getCunrrentPos:function(n){for(var t=0,i=0;i<=n+t;i++)this.model.maskFormat[i]=="\\"&&(t+=1);return t},_OnKeyPressHandler:function(n){if(!this.model.readOnly){if(this._raiseEvents("keyPress",null,{keyCode:n.keyCode,altKey:n.altKey,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,originalArgs:n}),this._maskLength==0)return!0;var r=n.keyCode?n.keyCode:n.charCode,f=String.fromCharCode(r),e=this.model.showPromptChar?"_":" ",i=this._seekNext(),u=t.browserInfo().name;if(this._validateChars(r,i)?(u=="mozilla"||u=="opera")&&(n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39)||(u=="mozilla"||u=="opera")&&n.ctrlKey&&(r==97||r==99||r==118||r==120)||(this._textbox.value==""&&(this._textbox.value=this.model.maskFormat.replace(/[9?$CANa*]/g,e)),this.model.maskFormat.indexOf("\\")>=0?i<this._maskLength&&this._writeBuffer(f,i):this._writeBuffer(f,i)):(u=="mozilla"||u=="opera")&&(n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39)||(u=="mozilla"||u=="opera")&&n.ctrlKey&&(r==97||r==99||r==118||r==120)||(this.model.maskFormat.indexOf("&")>=0||this.model.maskFormat.indexOf("\\")>=0?(_position=this._getCunrrentPos(i),this.model.maskFormat[i+_position]=="&"&&r==127||(this.model.maskFormat.indexOf("\\")>=0?i<this._maskLength&&(this._validateChars(r,i+_position)||this.model.maskFormat[i+_position-1]=="\\"?this._writeBuffer(f,i):this._ErrorHandler(i)):this._validateChars(r,i+_position)?this._writeBuffer(f,i):this._ErrorHandler(i))):this._ErrorHandler(i)),!this._keypressFlag&&r!=9)return this._keypressFlag=0,n.preventDefault(),!1;this._keypressFlag=0}},_OnKeyUpHandler:function(n){this._maskLength==0&&this._raiseEvents("change");this._raiseEvents("keyUp",null,{keyCode:n.keyCode,altKey:n.altKey,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,originalArgs:n});t.isNullOrUndefined(this.model.validationRules)||this._hiddenInput.valid()},_OnMouseOverHandler:function(){this._raiseEvents("mouseOver")},_OnMouseOutHandler:function(){this._raiseEvents("mouseOut")},_raiseEvents:function(i,r,u){var f,o=this.get_StrippedValue(),e=this.get_UnstrippedValue();if(this.model.value=e!==null?this.model.customCharacter==null&&n.trim(e.replace(/[\(\)-]/g,""))==""?null:e:null,i=="change")if(this.previousValue!=this.model.value)this.previousValue=this.model.value;else if(this._focusValue==this.model.value)return!1;f={value:e,unmaskedValue:o};i=="change"&&(f.isInteraction=!r);i=="change"&&(this._trigger("_change",f),t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid"));u&&n.extend(!0,f,u);this._trigger(i,f);this._hiddenInput.val(o)},_OnValueChange:function(){this._textbox.value==""&&this._maskModel!=""&&(this._textbox.value=this._maskModel);this._setValue(this._textbox.value)}});t.InputMode={Password:"password",Text:"text"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejMenu","ej.Menu",{element:null,model:null,validTags:["ul"],_setFirst:!1,_rootCss:"e-menu",angular:{terminal:!1},defaults:{height:"",width:"",animationType:"default",orientation:t.Orientation.Horizontal,menuType:"normalmenu",isResponsive:!0,contextMenuTarget:null,htmlAttributes:{},cssClass:"",openOnClick:!1,subMenuDirection:"none",enableCenterAlign:!1,showRootLevelArrows:!0,showSubLevelArrows:!0,enableAnimation:!0,container:null,enableSeparator:!0,enabled:!0,overflowHeight:"auto",overflowWidth:"auto",fields:{child:null,dataSource:null,query:null,tableName:null,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass",url:"url",imageAttribute:"imageAttribute",htmlAttribute:"htmlAttribute",linkAttribute:"linkAttribute",imageUrl:"imageUrl"},enableRTL:!1,titleText:"Menu",locale:"en-US",excludeTarget:null,beforeOpen:null,open:null,close:null,mouseover:null,mouseout:null,click:null,keydown:null,overflowOpen:null,overflowClose:null,create:null,destroy:null},dataTypes:{animationType:"enum",cssClass:"string",titleText:"string",locale:"string",openOnClick:"boolean",enabled:"boolean",enableCenterAlign:"boolean",showArrow:"boolean",showRootLevelArrows:"boolean",showSubLevelArrows:"boolean",enableSeparator:"boolean",isResponsive:"boolean",enableRTL:"boolean",enableAnimation:"boolean",fields:{dataSource:"data",query:"data",child:"data"},excludeTarget:"string",htmlAttributes:"data"},_setModel:function(t){for(var i in t)switch(i){case"menuType":t[i]=this.model.menuType;break;case"fields":this._wireEvents("_off");this.element.empty().insertBefore(this.wrapper);this.wrapper.remove();n.extend(this.model.fields,t[i]);this._intializeData();this.model.enabled||this._wireEvents("_off");break;case"orientation":this._setOrientation(t[i]);break;case"showRootLevelArrows":this._addArrow(t[i],this.model.showSubLevelArrows);break;case"showSubLevelArrows":this._addArrow(this.model.showRootLevelArrows,t[i]);break;case"enableSeparator":this._setSeparator(t[i]);break;case"height":this._setHeight(t[i]);break;case"width":this._setWidth(t[i]);break;case"cssClass":this._setSkin(t[i]);break;case"isResponsive":this.model.isResponsive?this._responsiveLayout():(n(this.resWrap).remove(),n(this.wrapper).removeClass("e-menu-responsive"),n(this.element).removeClass("e-menu-responsive"),this.resWrap=null);break;case"htmlAttributes":this._addAttr(t[i]);break;case"enableRTL":this._setRTL(t[i]);break;case"enableCenterAlign":this._centerAlign(t[i]);break;case"excludeTarget":this.model.excludeTarget=t[i];break;case"enabled":this.model.enabled=t[i];this._controlStatus(t[i]);break;case"animationType":this._setAnimation(t[i]);break;case"enableAnimation":this.model.enableAnimation=t[i];break;case"openOnClick":this._hoverOpen=!t[i];this._hoverClose=!t[i];break;case"subMenuDirection":this._setSubMenuDirection(this.model.subMenuDirection);break;case"titleText":this._titleText(t[i]);break;case"locale":this.model.locale=t[i];this._updateLocalConstant();this._setLocale();break;case"overflowHeight":this._setOverflowDimensions("height",t[i]);break;case"overflowWidth":this._setOverflowDimensions("width",t[i])}},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.Menu",this.model.locale)},_setLocale:function(){this._titleText(this._localizedLabels.titleText)},_titleText:function(i){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&n(this.label).text(i)},_destroy:function(){this.model.menuType==t.MenuType.ContextMenu?this._referenceElement.append(this._cloneElement):this._cloneElement.insertBefore(this.wrapper);this._cloneElement.removeClass("e-menu e-js");this.wrapper.remove()},_init:function(){this._cloneElement=this.element.clone();this.element.css("visibility","hidden");this._setValues();this._intializeData();this.element.css("visibility","visible")},_setValues:function(){this._mouseOver=!0;this._hoverOpen=!0;this._hoverClose=!0;this._isMenuOpen=!1;this._hideSpeed=100;this._showSpeed=100;this._isSubMenuOpen=!1;this._isContextMenuOpen=!1;this._disabledMenuItems=[];this._hiddenMenuItems=[];this._delayMenuHover=0;this._delaySubMenuHover=0;this._delaySubMenuShow=0;this._preventContextOpen=!0;this._setAnimation(this.model.animationType);this._isFocused=!0;this._menuOverflowItems=[];this._menuHeaderItems=[];this._menuCloneItems=[];this._itemWidth=0},_intializeData:function(){t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?(this._renderMenu(),this._wireEvents("_on"),this._calculateOverflowItems()):(this._generateTemplate(this.model.fields.dataSource),this._renderMenu())},_renderMenu:function(){this._renderControl();this._addArrow(this.model.showRootLevelArrows,this.model.showSubLevelArrows);this._renderArrow();this._intializeMenu();this._itemWidth=this.element.width();this.model.isResponsive&&this._ensureResponsiveClasses(n(window).width()<767);this.model.orientation=="horizontal"&&(this._on(this.element.parent().find("span.e-check-wrap.e-icon"),"click",this._mobileResponsiveMenu),this.model.fields.dataSource!=null&&this._calculateOverflowItems())},_renderControl:function(){this.model.menuType=="normalmenu"?(this.wrapper=t.buildTag("div"),this.wrapper.addClass(this.model.cssClass+" e-menu-wrap")):this.wrapper=t.buildTag("div.e-menu-wrap");this.model.isResponsive&&this._responsiveLayout();this.model.menuType!=t.MenuType.ContextMenu&&(this.wrapper.insertBefore(this.element),this.wrapper.append(this.element));this.element.addClass("e-menu e-widget e-box").attr({role:"menu",tabindex:0});this._addAttr(this.model.htmlAttributes);this.model.enableRTL&&this._setRTL(this.model.enableRTL);this._setSubMenuDirection(this.model.subMenuDirection);this.model.menuType=="normalmenu"?this.model.orientation=="horizontal"?this.element.addClass("e-horizontal"):this.element.addClass("e-vertical"):this._contextMenu_Template();this._addClass();this.model.enableCenterAlign&&this._centerAlign(this.model.enableCenterAlign);this.model.enableSeparator&&this._setSeparator(!0);this.model.enabled||this.disable()},_renderPopupWrapper:function(){if(this._ensureOverflowPopup()){this.popupWrapper=t.buildTag("div.e-menu-popwrap");this.popupWrapper.insertAfter(this.element);var n=typeof value=="number"?this.model.overflowHeight+"px":this.model.overflowHeight,i=typeof value=="number"?this.model.overflowWidth+"px":this.model.overflowWidth;this.popupWrapper.css({height:n,width:i});this.popupWrapper.hide();this._addOverflowItems()}},_calculateOverflowItems:function(){var f,i,u;if(this._ensureOverflowPopup()){this.element.find("li.e-list").removeClass("e-menu-show");n(this.lastelement).removeClass("e-last");this._menuHeaderItems=[];f=this.element.outerWidth();this.element.find("li.e-ham-wrap").length>0&&(this._itemWidth<=this.element.width()||this._itemWidth>=this.element.width()&&!this._isOverflowPopupOpen())&&(t.isNullOrUndefined(this.popupWrapper)||this.popupWrapper.hide());this._renderHamburgerIcon();this.element.find("li.e-ham-wrap").css({display:"list-item"});var o=this.element.find("li.e-ham-wrap").outerWidth(),r=0,e=!0;for(this.element.find("li.e-ham-wrap").hide(),this._menuHeaderItems=this.element.find(">li.e-list"),this._menuOverflowItems=[],i=0;i<this._menuHeaderItems.length;i++)if(u=n(this._menuHeaderItems[i]),r=r+u.outerWidth(),r<f)u.removeClass("e-menu-hide"),this.element.find(">li.e-list.e-haschild>ul").find("li.e-haschild").find("span.e-icon.e-arrowhead-down").removeClass("e-arrowhead-down").addClass("e-arrowhead-right"),this.model.enableSeparator&&this._setSeparator(!0);else{if(e){e=!1;this.element.find("li.e-ham-wrap").css({display:"list-item"});r=r-u.outerWidth()+o;i>1&&(r=r-n(this._menuHeaderItems[i-1]).outerWidth(),i=i-2);continue}this._menuOverflowItems.push(n(u).clone(!0));u.addClass("e-menu-hide")}this._menuOverflowItems.length>0?(this._renderHamburgerIcon(),n(".e-menu-popwrap").length?this._addOverflowItems():this._renderPopupWrapper(),this.lastelement=this.element.find(">li.e-list:visible").last().addClass("e-last"),this.element.find(">li.e-list.e-haschild>ul").find("li.e-haschild").find("span.e-icon.e-arrowhead-down").removeClass("e-arrowhead-down").addClass("e-arrowhead-right")):this._menuOverflowItems.length==0&&n("li.e-ham-wrap").length>0&&this.element.find("li.e-ham-wrap").remove()}(this.model.orientation=="vertical"||this.model.menuType==t.MenuType.ContextMenu&&n(window).width()>=768&&this.model.isResponsive)&&this.element.find("span.e-icon.e-arrowhead-down").removeClass("e-arrowhead-down").addClass("e-arrowhead-right")},_renderHamburgerIcon:function(){if(this._ensureOverflowPopup()&&this.element.find("li.e-ham-wrap").length==0){var i=t.buildTag("li.e-ham-wrap"),r=t.buildTag("div");this.hamburgerspan=t.buildTag("span.e-hamburger");r.append(this.hamburgerspan);i.append(r);this.element.append(i);this.model.height!=0?this._setHeight(this.model.height):n("li.e-ham-wrap").css({height:this.element.find("li.e-list").first().height()});this._on(this.element.find("li.e-ham-wrap"),"click",this._overflowOpen)}},_addOverflowItems:function(){var i,r,u;if(this._ensureOverflowPopup()&&n(".e-menu-popwrap").length>0&&!t.isNullOrUndefined(this.popupWrapper)){for(this.popupWrapper.empty(),this._menuCloneItems.length=0,i=0;i<this._menuOverflowItems.length;i++)this._menuCloneItems.push(n(this._menuOverflowItems[i]).clone(!0));for(this.ulTag=t.buildTag("ul"),this.ulTag.addClass("e-menu e-js e-responsive e-widget e-box e-vertical"),this.popupWrapper.append(this.ulTag),i=0;i<this._menuCloneItems.length;i++)n(this._menuCloneItems[i]).hasClass("e-haschild")&&(n(this._menuCloneItems[i]).find("span.e-icon").removeClass("e-arrowhead-down e-arrowhead-right").addClass("e-arrowhead-down"),n(this._menuCloneItems[i]).children("span.e-menu-arrow.e-menu-left").remove()),this.ulTag.append(this._menuCloneItems[i]);n(this.ulTag).children("li").removeClass("e-menu-hide");r=Math.round(this.popupWrapper.width());r>0&&(u=this.popupWrapper.innerWidth(),this.popupWrapper.find("ul.e-menu").css({width:u+"px"}));this.model.enableSeparator&&this._setSeparator(!0)}},_overflowOpen:function(n){if(this._isOverflowPopupOpen()){var i=t.util.getOffset(this.element),r=i.left+(this.model.enableRTL?0:this.element.outerWidth()-this.popupWrapper.outerWidth()),u=i.top+this.element.outerHeight();this.wrapper.parent().length&&(this.wrapper.parent().css("position")=="absolute"||this.wrapper.parent().css("position")=="relative")&&(i=t.util.getOffset(this.wrapper.parent()),r=r-i.left,u=u-i.top);this.popupWrapper.css({left:r,top:u});this.popupWrapper.show();this._trigger("overflowOpen",{e:n})}else this._overflowClose(n)},_overflowClose:function(n){this._ensureOverflowPopup()&&!t.isNullOrUndefined(this.popupWrapper)&&(this.popupWrapper.find("li.e-list").removeClass(".e-mhover.e-active.e-mfocused"),this._hideAnimation(this.popupWrapper.find('li.e-list:has("> ul")').find("> ul:visible"),this._hideAnim),this.popupWrapper.hide(),this._trigger("overflowClose",{e:n}))},_isOverflowPopupOpen:function(){if(n(this.popupWrapper).length>0)return this.popupWrapper.css("display")=="none"},_removePopup:function(){n(window).width()<767&&this.model.isResponsive&&(this._ensureResponsiveClasses(n(window).width()),this.element.find("li.e-ham-wrap").length>0&&this.popupWrapper.length>0&&(this.element.find("li.e-ham-wrap").remove(),n(".e-menu-popwrap").remove(),this.element.find("li.e-list").addClass("e-menu-show")))},_mobileResponsiveMenu:function(){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&this.element.css("display")=="none"?this.element.removeClass("e-res-hide").addClass("e-res-show"):this.model.menuType==t.MenuType.ContextMenu||this.model.orientation=="vertical"||this.element.css("display")=="none"||this.element.removeClass("e-res-show").addClass("e-res-hide")},_ensureOverflowPopup:function(){return this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&n(window).width()>=768&&this.model.isResponsive},_onResize:function(){this.element.find("li.e-ham-wrap").hide();n(window).width()>=768?this._calculateOverflowItems():this._removePopup()},_ensureResponsiveClasses:function(n){n&&this.element.find("span.e-icon").hasClass("e-arrowhead-right")&&this.element.find("span.e-icon.e-arrowhead-right").removeClass("e-arrowhead-right").addClass("e-arrowhead-down")},_responsiveLayout:function(){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&(this.wrapper.addClass("e-menu-responsive"),this.element.addClass("e-menu-responsive"),this.resWrap=t.buildTag("span.e-menu-res-wrap e-menu-responsive"),this.inResWrap=t.buildTag("span.e-in-wrap e-box e-menu-res-in-wrap"),this.label=t.buildTag("span.e-res-title").html(this.model.locale=="en-US"?this.model.titleText:t.Menu.Locale[this.model.locale]&&t.Menu.Locale[this.model.locale].titleText?t.Menu.Locale[this.model.locale].titleText:this.model.titleText),this.check=t.buildTag("span.e-check-wrap e-icon"),this.wrapper.append(this.resWrap),this.resWrap.append(this.inResWrap),this.inResWrap.append(this.label).append(this.check))},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i.disable():i.element.attr(t,n)})},_oncheck:function(n){var t=this.element.parents(".e-menu-wrap").children(".e-menu");n.isChecked?t.removeClass("e-res-hide").addClass("e-res-show"):t.removeClass("e-res-show").addClass("e-res-hide")},_addClass:function(){var u,f,i,r,t;for(this.element.find('li:has("> ul")').find("> a,> span").addClass("aschild"),this.element.find(">li").addClass("e-list").attr({role:"menuitem"}),this.element.find("li").find(">a, >span").addClass("e-menulink"),u=this.element.find(".e-list a.aschild"),f=this.element.find(".e-list span.aschild"),t=0;t<u.length;t++)i=n(u[t]),i.siblings().attr({"aria-hidden":!0}),i.parent().attr({"aria-haspopup":!0,role:"menu"}).addClass("e-haschild"),i.siblings("ul").children("li").addClass("e-list").attr("role","menuitem");for(t=0;t<f.length;t++)r=n(f[t]),r.siblings().attr({"aria-hidden":!0}),r.parent().attr({"aria-haspopup":!0,role:"menu"}).addClass("e-haschild"),r.siblings("ul").children("li").addClass("e-list").attr("role","menuitem")},_renderArrow:function(){if(this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&n(n(this.element).find("span.e-menu-arrow")).length==0){var i=t.buildTag("span.e-menu-arrow e-menu-left");n(i).append("<span class='e-arrowMenuOuter'><\/span>").append("<span class='e-arrowMenuInner'><\/span>");this.element.find(">li.e-list.e-haschild").append(i)}},_generateTemplate:function(n){var i=this,r;n instanceof t.DataManager?(r=n.executeQuery(this._columnToSelect(this.model.fields)),r.done(function(n){i._odataFlag=!0;i._generateItemTemplate(n.result);i._wireEvents("_on")})):(i._odataFlag=!1,this._generateItemTemplate(i.model.fields.dataSource),this._wireEvents("_on"))},_generateItemTemplate:function(n){for(var i,t=0;t<n.length;t++)(n[t][this.model.fields.parentId]==null||n[t][this.model.fields.parentId]==0)&&(i=this._menuTemplate(n[t],n,this.model.fields),this.element.append(i))},_menuTemplate:function(i,r,u){var f,o,l,y,c,a,p,e,h,s,v;if(f=n(document.createElement("li")),f.attr("class","e-list"),i[u.htmlAttribute]&&this._setAttributes(i[u.htmlAttribute],f),o=n(document.createElement("a")),o.attr("class","e-menulink"),i[u.imageUrl]&&i[u.imageUrl]!=""?(l=n(document.createElement("img")),l.attr("src",i[u.imageUrl]),i[u.imageAttribute]&&this._setAttributes(i[u.imageAttribute],l),o.append(l)):i[u.spriteCssClass]&&i[u.spriteCssClass]!=""&&(y=n(document.createElement("span")),y.addClass(i[u.spriteCssClass]),o.append(y)),o.append(i[u.text]),i[u.linkAttribute]&&this._setAttributes(i[u.linkAttribute],o),i[u.url]&&o.attr("href",i[u.url]),f.append(o),i[u.id]&&f.prop("id",i[u.id]),t.isNullOrUndefined(u.child)){if(!this._odataFlag&&(e=t.DataManager(u.dataSource).executeLocal(t.Query().where(u.parentId,t.FilterOperators.equal,i[u.id])),e&&e.length>0)){for(h=t.buildTag("ul"),s=0;s<e.length;s++)v=this._menuTemplate(e[s],u.dataSource,u),h.append(v);f.append(h)}}else if(this._odataFlag=!0,u.child.dataSource instanceof t.DataManager)c=this,a=t.Query(),n(f).attr({"aria-haspopup":!0,role:"menu"}).addClass("e-haschild"),a=this._columnToSelect(u.child),a.where(u.child.parentId,t.FilterOperators.equal,i[u.id]),p=u.child.dataSource.executeQuery(a),p.done(function(t){var i=t.result,e,r,o;if(i&&i.length>0){for(e=n(document.createElement("ul")),r=0;r<i.length;r++)o=c._menuTemplate(i[r],u.child.dataSource,u.child),e.append(o);f.append(e);n(f).children("a").addClass("aschild");n(f).parent().hasClass("e-menu")&&c.model.showRootLevelArrows?n(f).children("a.aschild").append(n("<span>").addClass("e-icon e-arrowhead-down")).addClass("e-arrow-space"):c.model.showSubLevelArrows&&n(f).children("a.aschild").append(n("<span>").addClass("e-icon e-arrowhead-right")).addClass("e-arrow-space")}}),p.then(function(){c._renderArrow()});else if(t.isNullOrUndefined(i.child)||(t.isPlainObject(i.child)?e=t.DataManager(u.child.dataSource).executeLocal(t.Query().where(u.child.parentId,t.FilterOperators.equal,i[u.id])):i.child instanceof Array&&(e=i.child)),e&&e.length>0){for(h=n(document.createElement("ul")),s=0;s<e.length;s++)v=this._menuTemplate(e[s],u.child.dataSource,u.child),h.append(v);f.append(h)}return f},_setAttributes:function(n,t){for(var i in n)i=="class"?t.addClass(n[i]):t.attr(i,n[i])},_addArrow:function(t,i){if(t){var r=this.model.orientation=="horizontal"?"e-arrowhead-down":"e-arrowhead-right";this.element.find('>li.e-list:has("> ul")').children("a").append(n("<span>").addClass("e-icon "+r)).addClass("e-arrow-space")}else this.element.find('>li.e-list:has("> ul")').children("a").removeClass("e-arrow-space").children("span.e-icon").remove();i?this.element.find(">li.e-list > ul li.e-list:has(>ul)").children("a").append(n("<span>").addClass("e-icon e-arrowhead-right")).addClass("e-arrow-space"):this.element.find(">li.e-list > ul li.e-list:has(>ul)").children("a").removeClass("e-arrow-space").children("span.e-icon").remove()},_intializeMenu:function(){this.model.height!=0&&this._setHeight(this.model.height);this.model.width!=0&&this._setWidth(this.model.width);this.model.menuType=="contextmenu"&&(this.model.openOnClick=!1);this.model.openOnClick&&(this._hoverOpen=!1,this._hoverClose=!1)},_setOrientation:function(n){n=="horizontal"?this.element.removeClass("e-vertical e-horizontal").addClass("e-horizontal"):this.element.removeClass("e-horizontal e-vertical").addClass("e-vertical");n=="vertical"&&this._removePopup()},_setHeight:function(i){this.model.orientation=="horizontal"&&i!=="auto"?(i=typeof i=="number"?i+"px":i,this.element.find("> li").find(">a:first").css("line-height",i),this.model.showRootLevelArrows&&this.element.find("> li").find(">a:first").find("> span:first").css({"line-height":i,top:"0px"}),this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&n("li.e-ham-wrap").length>0&&(this.element.find("li.e-ham-wrap").children("div").css({"line-height":i}),this.element.find("li.e-ham-wrap").css({height:i}),n(".e-menu-popwrap").length>0&&this.popupWrapper.find("a.e-menulink").css({"line-height":i}))):this.element.height(i)},_setWidth:function(n){this.element.css("width",n);this.model.orientation==="horizontal"&&n!=="auto"&&this.model.isResponsive&&this.resWrap.css("width",n);this.model.orientation=="horizontal"&&this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&this._calculateOverflowItems()},_setOverflowDimensions:function(n,i){this.model.menuType!=t.MenuType.ContextMenu&&this.model.orientation!="vertical"&&(i=typeof i=="number"?i+"px":i);n=="height"?this.popupWrapper.css({height:i}):n=="width"&&this.popupWrapper.css({width:i});this._addOverflowItems()},_setRTL:function(n){n?this.element.removeClass("e-rtl").addClass("e-rtl"):this.element.removeClass("e-rtl");n&&this.model.orientation==="horizontal"?this.wrapper.removeClass("e-menu-rtl").addClass("e-menu-rtl"):this.wrapper.removeClass("e-menu-rtl");this.model.subMenuDirection=n?"left":"right"},_setSubMenuDirection:function(n){n!="left"&&n!="right"&&(this.model.subMenuDirection=this.model.enableRTL?"left":"right")},_setAnimation:function(n){n==="none"?(this._showAnim="none",this._hideAnim="none"):(this._showAnim="slideDown",this._hideAnim="slideUp")},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_centerAlign:function(n){this.model.orientation=="horizontal"&&n?this.element.css("text-align","center"):this.element.css("text-align","inherit")},_columnToSelect:function(n){var u=[],r=t.Query(),i;if(t.isNullOrUndefined(n.query)){for(i in n)i!=="tableName"&&i!=="child"&&i!=="dataSource"&&n[i]&&u.push(n[i]);u.length>0&&r.select(u);this.model.fields.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||r.from(n.tableName)}else r=n.query;return r},_max_zindex:function(){var i,r,t;return this.model.menuType=="contextmenu"?(i=n(this._targetElement).parents(),i.push(this._targetElement)):i=n(this.element).parents(),r=n("body").children(),index=r.index(this.popup),r.splice(index,1),n(r).each(function(n,t){i.push(t)}),t=Math.max.apply(t,n.map(i,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_recursiveFunction:function(t,i){var r=this,u=!1;n.each(t,function(n,t){return t.Text==i?(r.selectedItem=t,u=!0,!1):(t.ChildItems!=null&&r._recursiveFunction(t.ChildItems,i),u?!1:void 0)})},_contextMenu_Template:function(){if(this.element[0].id!="")var t=n(".e-menu-wrap #"+this.element[0].id).get(0);t&&n(t.parentElement).remove();this.model.orientation="vertical";this.element.addClass(this.model.cssClass+" e-context");this.element.css("display","none");this._referenceElement=this.element.parent();n("body").append(this.element);this.wrapper.insertBefore(this.element);this.wrapper.append(this.element)},_closeMenu:function(){this._hideAnimation(this.element.find('li.e-list:has("> ul")').find("> ul:visible"),this._hideAnim)},_onMenuIntent:function(n,t,i){t._delayMenuHover=window.setTimeout(function(){if(t._mouseOver==!0&&i){var r=t._showAnim,u=t._hideAnim,f=t._showSpeed,e=t._hideSpeed;t._show(n,r,u)}},this._showSpeed)},_onHide:function(n,t,i){t._delaySubMenuHover=window.setTimeout(function(){if(t._mouseOver==!1&&i){var n=t._id,r=t._hideAnim,u=t._hideSpeed;t._closeAll()}},t._hideSpeed)},_subMenuPos:function(t,r){var e=n(t).offset(),a,v,o=e.left,u=n("ul:first",t),c=n(t).outerWidth(),f,h,l,w,s,b;if(e==null||e==i)return!1;if(f=u.outerWidth()+1,h=this.model.container?n(this.model.container).width()+n(document).scrollLeft():document.documentElement.clientWidth+n(document).scrollLeft(),this.model.menuType=="normalmenu")if(n(t.parentNode).is(this.element))this.model.orientation=="horizontal"?(u.css("top",n(t).outerHeight()+"px"),this.model.enableRTL?(v=o+c-f<0?o+c-f:1,u.css({left:"auto",right:v+"px"})):(a=h<o+f?o+f-h:1,u.css("left",a*-1+"px"))):r=="left"&&o>f||r=="right"&&h<=e.left+c+f&&o>f?u.css("left",-(f+4)+"px"):u.css("left",n(t).outerWidth()+4+"px");else if(r=="left"&&o>f||r=="right"&&h<=e.left+c+f&&o>f)u.css("left",-(f+4)+"px");else{u.css("left",n(t).outerWidth()+4+"px");var s=u.outerHeight(),y=n(window).height(),p=y-(e.top-n(window).scrollTop());y<s?(l=e.top-n(window).scrollTop(),u.css("top",-l+4+"px")):p<s?(l=p-s,u.css("top",l-2+"px")):u.css("top","")}else h-=e.left+2*f+4,h<0?(w=f==null?"-206.5px":"-"+(f+5)+"px",u.css("left",w)):u.parent("li.e-list").parent("ul").width()&&r=="right"?u.css("left",u.parent("li.e-list").parent("ul").width()+4+"px"):e.left>f&&u.css("left",-(f+4)+"px"),s=u.outerHeight(),e.top+s>n(window).height()?(b=-s+n(t).outerHeight(),s>e.top+n(t).outerHeight()/2?u.css("top",-(s/2)+"px"):u.css("top",b+"px")):u.css("top","0px")},_setSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n+" e-menu-wrap")},_setSeparator:function(i){i?(this.element.addClass("e-separator"),n(".e-menu-popwrap").length>0&&!t.isNullOrUndefined(this.ulTag)&&this.ulTag.addClass("e-separator")):this.element.removeClass("e-separator")},_contextMenuEvents:function(t){this[t](n(this.model.contextMenuTarget),"mouseup taphold",this._ContextMenuHandler);this[t](this.element,"contextmenu",this._onDefaultPreventer);this[t](n(this.model.contextMenuTarget),"contextmenu",this._onDefaultPreventer);this[t](n(document),"mousedown",this._onContextClose)},_show:function(t,i,r){var f,u=n("> ul",t),e=this._max_zindex();u.attr({"aria-hidden":!1});this._hideAnimation(n(t).siblings().find(" > ul:visible"),r);n.inArray(this._disabledMenuItems,t)>-1||(u.css("display")!="none"?(f=this.model.openOnClick?n(u):u.children().find("> ul"),this._hideAnimation(f,r)):n("> ul",t).children().find("> ul").hide(),this._subMenuPos(t,this.model.subMenuDirection),u.css({"z-index":e+1}),n(t).children("span.e-menu-arrow").css({"z-index":e+2}),n("> ul",t).css("display")=="block"||n(t).hasClass("e-disable-item")||(this._showAnimation(u,i),u.closest("li").addClass("e-active e-mfocused")),n(t).siblings("li.e-active").length>0&&n(t).siblings("li.e-active").removeClass("e-active e-mfocused"))},_closeAll:function(){this._hideAnimation(this.element.find('li.e-list:has("> ul")').find("> ul:visible"),this._hideAnim);this._hideAnimation(this.element.find("> ul:visible"),this._hideAnim)},_showAnimation:function(n,t){switch(t){case"slideDown":n.slideDown(this.model.enableAnimation?200:0);break;case"none":n.css("display","block")}},_hideAnimation:function(t,i){switch(i){case"slideUp":n(t).attr({"aria-hidden":!0});t.slideUp(this.model.enableAnimation?100:0);break;case"none":t.css("display","none")}t.closest("li").removeClass("e-active e-mfocused")},_removeValue:function(i,r){for(var f=t.browserInfo(),e=f.version==="8.0"&&f.name==="msie"?i[0].outerText:i[0].textContent,o=n(r).length,u=0,s=n(r).children("a").length==0?n(r).children("span"):n(r).children("a");u<=o;){if(n(s[u]).text()===e)return u;u++}},_createSubLevelItem:function(t,i){var r;r=n(document.createElement("ul"));r.append(i);t.append(r);t.attr({role:"menu","aria-haspopup":"true"});t.addClass("e-haschild");this.element.find('li:has("> ul")').find("> a,>span").addClass("aschild e-arrow-space");this._insertArrows(r)},_insertArrows:function(t){this.model.showRootLevelArrows?t.find(">a,>span").append(n("<span>").addClass("e-icon e-arrowhead-down")).addClass("e-arrow-space"):t.find(">a,>span").removeClass("e-arrow-space").find(">span.e-icon").remove();this.model.showSubLevelArrows?t.parent("li.e-list:has(>ul)").children("a,span").append(n("<span>").addClass("e-icon e-arrowhead-right")).addClass("e-arrow-space"):t.parent("li.e-list:has(>ul)").children("a,span").removeClass("e-arrow-space").find(">span.e-icon").remove()},_createMenuItem:function(t){var r,i,u,f;return r=n(document.createElement("li")),r.attr({"class":"e-list",role:"menuitem"}),t.htmlAttribute&&this._setAttributes(t.htmlAttribute,r),t.text&&t.text!=""&&(i=n(document.createElement("a")),i.attr({"class":"e-menulink"}),t.imageUrl&&t.imageUrl!=""?(u=n(document.createElement("img")),u.attr("src",t.imageUrl),t.imageAttribute&&this._setAttributes(t.imageAttribute,u),i.append(u)):t.spriteCssClass&&t.spriteCssClass!=""&&(f=n(document.createElement("span")),f.addClass(t.spriteCssClass),i.append(f)),i.append(t.text),t.linkAttribute&&this._setAttributes(t.linkAttribute,i),t.url&&i.attr("href",t.url),r.append(i)),t.id&&r.prop("id",t.id),this.model.enabled||r.addClass("e-disable-item"),r},_insertNode:function(i,r,u){var e=0,o=0,s=0,f=[];for(n(r).is(this.element)?f.push(this.element):typeof r=="string"?f.push(this.element.find(r)):typeof r=="undefined"?f.push(this.element):f.push(r),o=0;o<f.length;o++)for(s=0;s<f[o].length;s++)for(e=0;e<i.length&&!t.isNullOrUndefined(i[e]);e++)this._addItem(i[e],f[o][s],u)},_addItem:function(t,i,r){var u,f;this._wireEvents("_off");u=this._createMenuItem(t);i=i==="default"?n("#"+t.parentId):n(i);switch(r){case"insert":f=n(i).is(this.element)?i:i.children("ul");f.length!=0?f.append(u):this._createSubLevelItem(i,u);break;case"insertBefore":n(i).is(this.element)?i.prepend(u):u.insertBefore(i);break;case"insertAfter":n(i).is(this.element)?i.append(u):u.insertAfter(i)}this._wireEvents("_on")},_removeItem:function(n){n.siblings("li").length==0?(n.closest("ul").siblings("a.aschild").removeClass("aschild e-arrow-space").children("span.e-icon").remove(),n.closest("ul").hasClass("e-menu")?n.remove():n.closest("ul").remove()):n.remove()},_hiddenElement:function(t){t.length>0&&n.inArray(t[0],this._hiddenMenuItems)==-1&&(t.addClass("e-hidden-item"),this._hiddenMenuItems.push(t[0]))},_showElement:function(t){t.length>0&&n.inArray(t[0],this._hiddenMenuItems)>-1&&(t.removeClass("e-hidden-item"),this._hiddenMenuItems.splice(this._hiddenMenuItems.indexOf(t[0]),1))},_getNodeByID:function(t){return typeof t!="object"&&t!=""&&(t=this.element.find(".e-list"+t)),n(t)},_processItems:function(t,i){for(var u=this._getNodeByID(t),r=0;r<u.length;r++)i?this._showElement(n(u[r])):this._hiddenElement(n(u[r]))},insert:function(n,t){this._insertNode(n,t,"insert")},insertBefore:function(n,t){this._insertNode(n,t,"insertBefore")},insertAfter:function(n,t){this._insertNode(n,t,"insertAfter")},remove:function(t){for(var i=0,r=0,i=0;i<t.length;i++)for(t[i]=typeof t[i]=="string"?this.element.find(t[i]):t[i],r=0;r<t[i].length;r++)t[i][r].tagName==="LI"||t[i][r].tagName==="UL"?this._removeItem(n(t[i][r])):t[i][r].remove()},showContextMenu:function(i,r,u,f,e){if(this._closeMenu(),this._eventArgs=f,t.isNullOrUndefined(f)||!this._checkForExclusion(f.target)){if(this._trigger("beforeOpen",{target:u,events:f}))return!1;if(this._preventContextOpen){if(this._targetElement=t.isNullOrUndefined(u)?t.isNullOrUndefined(target)?this.element:target:u,e){var o=this._calculateContextMenuPosition(f);i=o.X;r=o.Y}this.element.css({left:i,top:r});this.element.css({"z-index":this._max_zindex()+1});this._showAnimation(this.element,this._showAnim);this._isContextMenuOpen=!0;this.element.focus();this._trigger("open",{target:u});this._on(t.getScrollableParents(n(this.model.contextMenuTarget)),"scroll",this.hideContextMenu)}return!1}},_checkForExclusion:function(i){var u,r;if(!t.isNullOrUndefined(this.model.excludeTarget))for(u=this.model.excludeTarget.split(","),r=0;r<u.length;r++)if(n(i).closest(this.model.excludeTarget).is(n.trim(u[r])))return!0},hideContextMenu:function(i){this._closeMenu();this.element.find(".e-mhover").removeClass("e-mhover");this.element.find(".e-mfocused").removeClass("e-mfocused");this._hideAnimation(this.element,this._hideAnim);this._isContextMenuOpen=!1;this._trigger("close",n.extend({events:i},i));this._off(t.getScrollableParents(n(this.model.contextMenuTarget)),"scroll",this.hideContextMenu)},disableItem:function(t){var i=n(this.element.find("li.e-list >a ,li.e-list >span")).filter(function(){return n.trim(n(this).text())===t});i.length>0&&!(n.inArray(i.parent()[0],this._disabledMenuItems)>-1)&&(i.parent().addClass("e-disable-item").attr({"aria-disabled":!0}),i.parent().find(">a.aschild span.e-icon").addClass("e-disable"),this._disabledMenuItems.push(i.parent()[0]))},disableItemByID:function(t){if(t&&t!=""){var r=this.element.find("#"+t)?this.element.find("#"+t)[0]:i;!r||n.inArray(r,this._disabledMenuItems)>-1||(n(r).addClass("e-disable-item").attr({"aria-disabled":!0}),n(r).find(">a.aschild span.e-icon").addClass("e-disable"),this._disabledMenuItems.push(r))}},getHiddenItems:function(){return this._hiddenMenuItems},hideItems:function(n){if(typeof n=="object"&&n.length!==i)for(var t=0;t<n.length;t++)this._processItems(n[t],!1);else this._processItems(n,!1)},showItems:function(n){if(typeof n=="object"&&n.length!==i)for(var t=0;t<n.length;t++)this._processItems(n[t],!0);else this._processItems(n,!0)},enableItem:function(t){var i=n(this.element.find("li.e-list >a ,li.e-list >span")).filter(function(){return n.trim(n(this).text())===t}),r;i.length>0&&n.inArray(i.parent()[0],this._disabledMenuItems)>-1&&(i.parent().removeClass("e-disable-item").attr({"aria-disabled":!1}),i.parent().find(">a.aschild span.e-icon").removeClass("e-disable"),r=this._removeValue(i,this._disabledMenuItems),this._disabledMenuItems.splice(r,1))},enableItemByID:function(t){var i,r;if(t&&t!=""&&(i=this.element.find("#"+t)[0],i&&n.inArray(i,this._disabledMenuItems)>-1))for(n(i).removeClass("e-disable-item").attr({"aria-disabled":!1}),n(i).find(">a.aschild span.e-icon").removeClass("e-disable"),r=this._disabledMenuItems.length-1;r>=0;r--)this._disabledMenuItems[r].id==t&&this._disabledMenuItems.splice(r,1)},disable:function(){this.model.enabled=!1;var i=this.element.find(">li[class~=e-list]"),t=this;n.each(i,function(i,r){n.inArray(r,t._disabledMenuItems)>-1||(n(r).addClass("e-disable-item").attr({"aria-disabled":!0}),n(r).find(">a.aschild span.e-icon").addClass("e-disable"),t._disabledMenuItems.push(r))})},enable:function(){var i=this,t;this.model.enabled=!0;t=this.element.find("li.e-disable-item");n.each(t,function(t,r){n(r).removeClass("e-disable-item").attr({"aria-disabled":!1});n(r).find(">a.aschild span.e-icon").removeClass("e-disable");i._disabledMenuItems.pop(r)})},show:function(n,t,i,r){if(!this.model.enabled)return!1;this.model.menuType=="contextmenu"?this.showContextMenu(n,t,i,r,!1):this.element.css("display","block")},hide:function(n){if(!this.model.enabled)return!1;this.model.menuType=="contextmenu"?this.hideContextMenu(n):(this._closeMenu(),this.element.css("display","none"))},_wireEvents:function(t){this[t](this.element.find("li.e-list"),"mouseout",this._mouseOutHandler);this[t](this.element.find("li.e-list"),"mouseover",this._mouseOverHandler);this[t](this.element.children(),"click",this._onClickHandler);this[t](this.element,"keydown",this._onKeyDownHandler);this[t](this.element,"focus",this._OnFocusHandler);this[t](this.element,"blur",this._OnFocusOutHandler);this.model.menuType=="contextmenu"&&n(this.model.contextMenuTarget)[0]!=null&&this._contextMenuEvents(t);this.model.menuType!="contextmenu"&&(this[t](n(document),"click",this._onDocumentClick),this[t](this.element,"mousedown",this._onMouseDownHandler));this[t](n(window),"resize",n.proxy(this._onResize,this))},_mouseOverHandler:function(i){var r,f="",e,u;if(this.element.find(".e-mhover").removeClass("e-mhover"),i.currentTarget=n(i.target).closest("li")[0],n(i.currentTarget).hasClass("e-disable-item")?this._isFocused=!1:n(i.currentTarget).addClass("e-mhover"),i.stopPropagation&&i.stopPropagation(),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delaySubMenuHover),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delayMenuHover),this._mouseOver=!0,this._isMenuOpen=!0,this._isSubMenuOpen=n(i.currentTarget.parentNode.parentNode).is(this.element)?!1:!0,i.currentTarget.nodeName=="LI")r=i.currentTarget;else if(i.currentTarget.parentNode)if(i.currentTarget.parentNode.nodeName=="LI")r=i.currentTarget.parentNode;else return!1;else return i.preventDefault(),!1;n(i.currentTarget).hasClass("e-disable-item")||this._onMenuIntent(r,this,this._hoverOpen);n.inArray(r,this._disabledMenuItems)>-1||(e=n(r).children("a,span").text(),f=t.isNullOrUndefined(r)?"":n(r)[0].id,u={text:e,element:r,event:i,ID:f},this._trigger("mouseover",n.extend({events:u},u)))},_onMouseDownHandler:function(t){n(t.target).hasClass("e-menu")&&(this._isFocused=!1)},_mouseOutHandler:function(i){var r,f="",e,u;if(n(i.currentTarget).removeClass("e-mhover"),i.stopPropagation&&i.stopPropagation(),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delaySubMenuHover),typeof this._delaySubMenuHover!="undefined"&&clearTimeout(this._delayMenuHover),this._mouseOver=!1,this._isMenuOpen=!1,i.currentTarget.nodeName=="LI")r=i.currentTarget;else if(i.currentTarget.parentNode)if(i.currentTarget.parentNode.nodeName=="LI")r=i.currentTarget.parentNode;else return!1;else return i.preventDefault(),!1;this._onHide(r,this,this._hoverClose);n.inArray(r,this._disabledMenuItems)>-1||(e=n(r).children("a,span").text(),f=t.isNullOrUndefined(r)?"":n(r)[0].id,u={text:e,element:r,event:i,ID:f},this._trigger("mouseout",n.extend({events:u},u)))},_onClickHandler:function(i){var r,o="",f,s,u,e;if(this._isFocused=!0,f=!1,!n(i.target).closest("li.e-list").hasClass("e-disable-item")&&n(i.target).closest("li.e-list").length>0)r=n(i.target).closest("li.e-list")[0],n(r).is(this.element.find(">li.e-list"))&&(this._activeElement=r);else{n(i.target).is(this.element)&&(this._activeElement=this.element.find(">li:first"));return}n(i.target).is("a")&&n(r).find(">a,>span").hasClass("aschild")&&this.model.openOnClick&&(this._isFocused=!1);!this._hoverOpen&&n(r).find(">a,>span").hasClass("aschild")&&(this._show(r,this._showAnim,this._hideAnim),this._hoverOpen=!1,f=!0);n.inArray(r,this._disabledMenuItems)>-1||(this.model.menuType=="contextmenu"&&this._isContextMenuOpen&&!n(r).hasClass("e-haschild")&&(this._hideAnimation(this.element,this._hideAnim),this._isContextMenuOpen=!1,this._trigger("close",n.extend({events:i},i)),this._off(t.getScrollableParents(n(this.model.contextMenuTarget)),"scroll",this.hideContextMenu)),f||n(r).find(">a,>span").hasClass("aschild")||(this._closeMenu(),this.model.openOnClick&&(this._hoverOpen=!1)),s=n(r).children("a,span").text(),u=n(r).closest("ul").parent("li"),u.length!=0?(parentId=t.isNullOrUndefined(u.attr("id"))?null:u.attr("id"),parentText=u.children("a,span").text()):(parentId=null,parentText=null),o=t.isNullOrUndefined(r)?"":n(r)[0].id,e={text:s,element:r,event:i,selectedItem:this.selectedItem,ID:o,parentId:parentId,parentText:parentText},this._trigger("click",n.extend({events:e},e)),this.selectedItem=null,this.model.openOnClick&&this.model.menuType!="contextmenu"&&this.element.focus())},_onKeyDownHandler:function(i){var c,h,e;if(this.model.menuType!="contextmenu"||this._isContextMenuOpen){var o,f,s="",r=this.element.find(".e-mhover"),u=this.element.find(".e-mfocused"),l;if(!n(r).length>0&&n(this._activeElement).length>0&&(r=u=n(this._activeElement)),i.keyCode==9?(this._isFocused=!1,this._OnFocusOutHandler()):(i.keyCode==37||i.keyCode==38||i.keyCode==39||i.keyCode==40)&&i.preventDefault(),i.keyCode==40&&(this.model.orientation=="horizontal"?this.element.find(">li.e-mhover").children("ul").length>0||n(this._activeElement).length>0?(n(r).children("ul").css("display")==="none"&&this._show(r[r.length-1],this._showAnim,this._hideAnim),r.removeClass("e-mhover e-mfocused").children("ul:first").find("li:first").addClass("e-mhover"),this._activeElement==null?r.addClass("e-mfocused"):n(this._activeElement).addClass("e-mfocused")):(liVisible=r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),n(r[r.length-1]).removeClass("e-mfocused e-mhover"),f=n(liVisible[liVisible.index(r)+1]).length>0?n(liVisible[liVisible.index(r[r.length-1])+1]):liVisible.first(),f.addClass("e-mhover")):this.model.orientation!="horizontal"&&(liVisible=r.length==0?this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"):r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r.removeClass("e-mfocused e-mfocused"),r.length>0?(r.removeClass("e-mhover"),f=n(liVisible[liVisible.index(r[r.length-1])+1]).length>0?n(liVisible[liVisible.index(r[r.length-1])+1]):liVisible.first()):f=liVisible.first(),f.addClass("e-mhover"))),i.keyCode==39&&(this.model.orientation=="horizontal"&&(this.element.find(">li.e-list").hasClass("e-mhover")||n(this._activeElement).length>0)?(r.removeClass("e-mfocused e-mhover"),liVisible=this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(r[r.length-1])+1]).length>0?n(liVisible[liVisible.index(r[r.length-1])+1]):liVisible.first(),f.addClass("e-mhover")):n(r).children("ul").length>0?(r.removeClass("e-mfocused e-mhover"),c=r.children("ul:first").find("li:first"),this._show(r[r.length-1],this._showAnim,this._hideAnim),liVisible=r.addClass("e-mfocused").children("ul:first").children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(c)]).length>0?n(liVisible[liVisible.index(c)]):liVisible.first(),f.addClass("e-mhover")):r.children("ul").length<=0&&this.model.orientation=="horizontal"&&r.parent().closest(".e-list").parent().hasClass("e-menu")&&(this._hideAnimation(r.parent(),this._hideAnim),r.removeClass("e-mfocused e-mhover"),n(u[u.length-1]).removeClass("e-mfocused"),liVisible=r.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(u[u.length-1])+1]).length>0?n(liVisible[liVisible.index(u[u.length-1])+1]):n(liVisible[liVisible.index(u.first())]),f.addClass("e-mhover"))),i.keyCode==38&&(this.model.orientation=="horizontal"?(liVisible=r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r.removeClass("e-mfocused e-mhover"),f=n(liVisible[liVisible.index(r[r.length-1])-1]).length>0?n(liVisible[liVisible.index(r[r.length-1])-1]):liVisible.last()):this.model.orientation!="horizontal"&&(liVisible=r.length==0?this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"):r.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r.length>0?(r.removeClass("e-mfocused e-mhover"),f=n(liVisible[liVisible.index(r[r.length-1])-1]).length>0?n(liVisible[liVisible.index(r[r.length-1])-1]):liVisible.last()):f=liVisible.last()),f.addClass("e-mhover")),i.keyCode==37&&(this.model.orientation=="horizontal"?this.element.find(">li.e-list").hasClass("e-mhover")||n(this._activeElement).length>0?(r.removeClass("e-mfocused e-mhover"),liVisible=this.element.find("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(r[r.length-1])-1]).length>0?n(liVisible[liVisible.index(r[r.length-1])-1]):liVisible.last(),f.addClass("e-mhover")):(this._hideAnimation(r.parent(),this._hideAnim),r.removeClass("e-mfocused e-mhover"),n(u[u.length-1]).removeClass("e-mfocused e-active"),liVisible=r.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=r.parent().closest(".e-list").parent(".e-menu").length>0?n(liVisible[liVisible.index(u[u.length-1])-1]).length>0?n(liVisible[liVisible.index(u[u.length-1])-1]):liVisible.last():n(liVisible[liVisible.index(u[u.length-1])]).length>0?n(liVisible[liVisible.index(u[u.length-1])]):liVisible.last(),f.addClass("e-mhover")):(r.parent("ul.e-menu").length==0||this.model.menuType=="contextmenu"&&r.parent("ul.e-context").length==0)&&(this._hideAnimation(r.parent(),this._hideAnim),r.removeClass("e-mfocused e-mhover"),n(u[u.length-1]).removeClass("e-mfocused"),liVisible=r.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),f=n(liVisible[liVisible.index(u[u.length-1])]).length>0?n(liVisible[liVisible.index(u[u.length-1])]):n(liVisible[liVisible.index(u.last())]),f.addClass("e-mhover"))),i.keyCode==13&&(h=n(r).children("a,span").text(),s=t.isNullOrUndefined(n(r)[0])?"":n(r)[0].id,e={menuId:this.element[0].id,text:h,selectedItem:u,ID:s},this.model.menuType=="contextmenu"?this._isContextMenuOpen&&r.length>0&&!u.hasClass("e-disable-item")&&(this.model.click&&this._trigger("click",n.extend({events:e},e)),this.selectedItem=null,this.hideContextMenu(i)):r.length>0&&!r.hasClass("e-disable-item")&&(n(r).find(">a,>span").hasClass("aschild")&&n(r).children("ul").css("display")==="none"?(this._show(r[0],this._showAnim,this._hideAnim),r.removeClass("e-mhover").children("ul:first").find("li:first").addClass("e-mhover")):(this.element.find(".e-mhover >a,.e-mhover >span ").focus(),this.element.find("li.e-list").removeClass("e-mhover e-mfocused"),this._closeAll()),t.isNullOrUndefined(n(r).find(">a").attr("href"))&&this._trigger("click",n.extend({events:e},e)))),i.keyCode==27&&(this.model.menuType=="contextmenu"?this.hideContextMenu(i):this.element.find("li.e-list").removeClass("e-mhover"),this.element.find('li.e-list:has("> ul")').find("> ul:visible").parents("li.e-list").addClass("e-mhover"),this._closeAll()),n(i.target).is(this.element)&&i.target.parentNode)r.length&&(o=r);else return!1;n.inArray(o,this._disabledMenuItems)>-1||(h=n(o).children("a,span").text(),s=t.isNullOrUndefined(o)?"":n(o)[0].id,(this.element.find("li.e-mfocused.e-mhover").length||i.keyCode==13)&&(l=i.keyCode==13?r:this.element.find("li.e-mfocused.e-mhover")),e={text:h,element:o,targetElement:l,event:i,ID:s},this._trigger("keydown",n.extend({events:e},e)));this._activeElement=null;u=this.element.find(".e-mfocused")}},_OnFocusHandler:function(){this.model.menuType!="contextmenu"&&!this.element.find(">li:first").hasClass("e-disable-item")&&this._isFocused&&this.element.find(".e-mhover").length==0&&n("li.e-ham-wrap").length==0?this.element.find(">li:first").addClass("e-mhover"):this._isFocused=!0;this.model.menuType!="contextmenu"&&(this._activeElement=this.element.find(">li:first"))},_OnFocusOutHandler:function(){this._isFocused||(this.element.find("li.e-list").removeClass("e-mhover e-mfocused"),this._closeAll());this._isFocused=!1},_onDocumentClick:function(t){this.model.openOnClick&&(this._hoverOpen=!1);n(t.target).parents("ul.e-menu").is(this.element)||(this.element.find("li.e-list").removeClass("e-mhover e-mfocused"),this._closeAll(),this._isFocused=!0);n(t.target).parents("ul.e-menu").is(this.popupWrapper)||n(t.target).hasClass("e-ham-wrap")||n(t.target).parent().hasClass("e-ham-wrap")||n(t.target).hasClass("e-hamburger")||n(t.target).parent("li").hasClass("e-haschild")||n(t.target).is("span.e-icon.e-arrowhead-down")||this._isOverflowPopupOpen()||this.model.menuType=="contextmenu"||!(n("li.e-ham-wrap").length>0)||this._overflowClose()},_ContextMenuHandler:function(n){var t=!1,r,i,e,u,f;n.type=="taphold"?t=!0:n.button?t=n.button==2:n.which&&(t=n.which==3);r=n.target;t?(i=n,n.type=="taphold"&&(i=n.options.type=="touchstart"?n.options.touches[0]:n.options),e=this._showSpeed,this.showContextMenu(null,null,r,i,!0)):this._isContextMenuOpen&&(u=this._hideAnim,f=this._hideSpeed,this.hideContextMenu(n,u,f))},_calculateContextMenuPosition:function(t){locationX=t.clientX+this.element.width()<n(window).width()?t.pageX:t.pageX-this.element.width();locationY=t.clientY+this.element.height()<n(window).height()?t.pageY:t.clientY>this.element.height()?t.pageY-this.element.height():n(window).height()-this.element.outerHeight();var i=n("body").css("position")!="static"?n("body").offset():{left:0,top:0};return locationX-=i.left,locationY-=i.top,{X:locationX,Y:locationY}},_onDefaultPreventer:function(n){return n.preventDefault(),n.stopPropagation(),!1},_onContextClose:function(t){var e=this,i,r,u,f;this._isContextMenuOpen&&(i=!1,(n(t.target).is(this.element)||n(t.target).parents(".e-context").is(this.element))&&(i=!0),i||(r=this._hideAnim,u=this._hideSpeed,this.hideContextMenu(t,r,u),f=n(t.target).parents(),n.each(f,function(n,t){t.id==e._ContextTargetId})))}});t.Menu.Locale=t.Menu.Locale||{};t.Menu.Locale["default"]=t.Menu.Locale["en-US"]={titleText:"Menu"};t.MenuType={NormalMenu:"normalmenu",ContextMenu:"contextmenu"};t.Direction={Left:"left",Right:"right",None:"none"};t.AnimationType={None:"none",Default:"default"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPager","ej.Pager",{_rootCSS:"e-pager",validTags:["div"],defaults:{pageSize:12,pageCount:10,currentPage:1,enableExternalMessage:!1,externalMessage:"",pageSizeMessage:"",enableQueryString:!1,locale:"en-US",masterObject:null,click:null,enableRTL:!1,totalRecordsCount:null,totalPages:null,customText:"",showPageInfo:!0,cssClass:"",enabled:!0,showGoToPage:!1,isResponsive:!1},_init:function(){this._initPrivateProperties();this.model.enableQueryString&&this._queryStringValue();this.renderPager();this.model.isResponsive&&this._reSizeHandler();this._wireResizing();this._wireEvents();this.refreshPager()},_initPrivateProperties:function(){this._pageSize=this.model.pageSize.length>0?this.model.pageSize[0]:this.model.pageSize;this._links=[];this._$prev=null;this._$first=null;this._$PP=null;this._$NP=null;this._lastNP=!1;this._lastpageCount=null;this._$last=null;this._$next=null;this._prevPageNo=null;this.localizedLabels=this._getLocalizedLabels();this._intervalWid=0;this._msgWidth=0;this._gotoWid=0},_wireEvents:function(){var n=this;this._on(this.element,"click",this._pagerClickHandler)},_hidedrop:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_wireResizing:function(){this._refreshDropandTextItems();n(window).bind("resize",this.model.isResponsive?n.proxy(this._reSizeHandler,this):n.proxy(this._unWireResizing,this))},_unWireResizing:function(){this._refreshDropandTextItems();this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();n(window).unbind("resize",n.proxy(this._reSizeHandler,this))},_reSizeHandler:function(){this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide();controlwidth=this._intervalWid+this._gotoWid+this.element.find(".e-pagercontainer").outerWidth()+this._msgWidth;controlwidth>this.element.outerWidth()-20?this._msgWidth>0&&this.element.find(".e-parentmsgbar").addClass("e-msg-res"):this._msgWidth>0&&this.element.find(".e-parentmsgbar").removeClass("e-msg-res");this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen());this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()>40&&(this.option("pageCount",this._maxPageCount),this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(this._flag=!0,this._fillScreen()));this._refreshDropandTextItems()},_refreshDropandTextItems:function(){this.numTextbox&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-parentmsgbar").position().top?this.numTextbox.addClass("e-pager-goto-res"):this.numTextbox.removeClass("e-pager-goto-res"));this.pageInterval_wrap&&(this.element.find(".e-pagercontainer").position().top!=this.element.find(".e-pager-itemsinterval").position().top?this.element.find(".e-pager-itemsinterval").addClass("e-pager-goto-res"):this.element.find(".e-pager-itemsinterval").removeClass("e-pager-goto-res"))},renderPager:function(){var n=t.buildTag("div.e-pagercontainer","",{},{unselectable:"on"});this._renderPagerContainer(n);this.element[0].appendChild(n[0]);this._pageInfo();this.model.showGoToPage&&this._renderTextboxItem();this.model.pageSize.length>0&&this._renderDropdownlist();this.model.enableExternalMessage&&this._renderPagerMessage();this.model.enableRTL&&this.element.addClass("e-rtl");this.model.enabled||this._disable();this._cssClass=this.model.cssClass;this.element.addClass(this.model.cssClass)},_removeDropdownlist:function(){this.pageInterval_wrap.remove();this.$textspan=null;this.$dropItem=null},_renderDropdownlist:function(){var i=this,r;this.pageInterval_wrap=t.buildTag("div.e-pager-itemsinterval","",{},{unselectable:"on"});r=t.buildTag("div.e-drpdwndiv e-icon e-arrow-sans-down","",{},{unselectable:"on"});this.$textspan=t.buildTag("span.e-text");this.sizeIntervals=this.model.pageSize;r.appendTo(this.pageInterval_wrap);this.pageInterval_wrap.appendTo(this.element);this.pageInterval_wrap.insertBefore(this._parentMsgBar);this.$textspan.appendTo(r);i.$textspan.text(this.model.pageSize[0]);this.$dropItem=t.buildTag("ul.e-drpdwn e-ul");this._renderItems();this.$dropItem.appendTo(r);this._renderPageSizeMessage();r.on("click",function(){i.$dropItem.css("display")!="none"?i.$dropItem.hide():i.model.enabled&&i.$dropItem.show()});this.$dropItem.hide();this.$dropItem.find("li").on("click",function(){i.$dropItem.find("li.e-active").removeClass("e-active");n(this).addClass("e-active");i._pageSize=n(this).text();i.$textspan.text(n(this).text());i.refreshPager();i._trigger("pageSizeSelected",{pageSize:i._pageSize})});this._intervalWid=this.element.find(".e-pager-itemsinterval").outerWidth()},_renderPageSizeMessage:function(){var n=t.buildTag("div.e-interval-msg");n.appendTo(this.pageInterval_wrap);this.model.pageSizeMessage.toString().length?n.html(this.model.pageSizeMessage):n.hide()},_renderItems:function(){var i=this;n(this.model.pageSize).each(function(){li=t.buildTag("li");li.text(this);i.$dropItem.append(li)});this.$dropItem.find("li").first().addClass("e-active")},_queryStringValue:function(){var n=new RegExp("[\\?&]page=([^&#]*)").exec(window.location.href);this.model.currentPage=n?parseInt(n[1]||1):1},_renderPagerMessage:function(){var n=t.buildTag("div.e-pagermessage");this.model.externalMessage.toString().length?n.html(this.model.externalMessage):n.hide();this.element.append(n)},_removePagerMessage:function(){this.element.find("div.e-pagermessage").remove()},_mouseScroll:function(n){n.keyCode=="38"?this._updateField("increment"):n.keyCode=="40"&&this._updateField("decrement")},_updateField:function(n){var i=1;this.numTextbox.val()==""?this.numTextbox.val(1):this.numTextbox.val().indexOf(" ")>=1&&this.numTextbox.val(this._textBox.val().replace(" ",""));this.model.currentPage=t.parseFloat(this.numTextbox.val(),this.model.locale);isNaN(this.model.currentPage)&&!this.model.currentPage&&(this.model.currentPage=1);this.model.currentPage>=1&&this.model.currentPage>this.model.totalPages?(this.model.currentPage=this.model.totalPages,this.numTextbox.val(this.model.currentPage)):this.model.currentPage<1&&this.model.currentPage<=this.model.totalPages?(this.model.currentPage=1,this.numTextbox.val(this.model.currentPage)):this.model.currentPage>=1&&this.model.currentPage<=this.model.totalPages&&(value=n=="increment"?this.model.currentPage+i:this.model.currentPage-i,value>=1&&value<=this.model.totalPages&&(this.numTextbox.val(value),this.model.currentPage=value));this.refreshPager()},_renderTextboxItem:function(){proxy=this;var i=t.buildTag("input#"+this.element[0].id+"_numtext","",{},{type:"textbox"});n(i).appendTo(this._parentMsgBar).insertBefore(n(this._parentMsgBar).find("span"));this.numTextbox=i;this.numTextbox.height(this.element.find(".e-pagercontainer .e-numericcontainer a").outerHeight());this.numTextbox.width(35);this.numTextbox.addClass("e-gototextbox e-textbox");this.model.showGoToPage||this.numTextbox.hide();this._gotoWid=n(this.numTextbox).outerWidth();this._on(n(this.numTextbox),"keydown",this._mouseScroll);this._on(this.numTextbox,"focusout",function(n){n.currentTarget.value=parseInt(n.currentTarget.value);var t=/^[0-9]*$/.test(parseInt(n.currentTarget.value));if(!t)return proxy.numTextbox.val(proxy.model.currentPage),!1;proxy.model.currentPage!=parseInt(n.currentTarget.value)&&(parseInt(n.currentTarget.value)>1&&parseInt(n.currentTarget.value)<=proxy.model.totalPages?(proxy.model.currentPage=parseInt(n.currentTarget.value),proxy.refreshPager()):proxy.numTextbox.val(this.model.currentPage))})},_renderPagerContainer:function(n){this._renderBackwardButton(n);this._renderpreviousPager(n);this._renderNumericItem(n);this._renderForwardPager(n);this._renderForwardButton(n)},_renderMsgBar:function(){var n=t.buildTag("span.e-pagermsg",String.format(this.localizedLabels.pagerInfo,this.model.currentPage,this.model.totalPages||0,this.model.totalRecordsCount||0));this._parentMsgBar.appendChild(n[0]);this._parentMsgBar.style.textAlign=t.TextAlign.Right},_renderpreviousPager:function(n){this._$PP=t.buildTag("a.e-link e-nextprevitemdisabled e-disable e-spacing e-PP","...",{},{title:this.localizedLabels.previousPagerTooltip,role:"link"});n.append(this._$PP)},_renderForwardPager:function(n){this._$NP=t.buildTag("a.e-link e-NP e-numericitem e-spacing e-default","...",{},{title:this.localizedLabels.nextPagerTooltip,role:"link"});n.append(this._$NP)},_renderBackwardButton:function(n){this._$first=t.buildTag("div.e-firstpage e-icon e-mediaback e-firstpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.firstPageTooltip});this._$prev=t.buildTag("div.e-prevpage e-icon e-arrowheadleft-2x e-prevpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.previousPageTooltip});n.append(this._$first);n.append(this._$prev)},_renderNumericItem:function(n){var i=t.buildTag("div.e-numericcontainer e-default","",{},{unselectable:"on"});this._renderNumericLinks(i,this.model.pageCount);n.append(i);this._maxPageCount=this.model.pageCount},_renderNumericLinks:function(n){var i,r;for(n.empty(),this.model.pageCount=Math.round(this.model.pageCount),i=1;i<=this.model.pageCount;i++)r=t.buildTag("a.e-link",this.model.customText+i,{},{role:"link"}).addClass("e-numericitem e-spacing e-default").data("index",i),i==this.model.currentPage&&r.removeClass("e-default").addClass("e-currentitem e-active"),n.append(r);this._links=n.children()},_renderForwardButton:function(n){this._$next=t.buildTag("div.e-nextpage e-icon e-arrowheadright-2x e-default","",{},{unselectable:"on",title:this.localizedLabels.nextPageTooltip});this._$last=t.buildTag("div.e-lastpage e-icon e-mediaforward e-default","",{},{unselectable:"on",title:this.localizedLabels.lastPageTooltip});n.append(this._$next);n.append(this._$last)},_setLocale:function(){this.localizedLabels=this._getLocalizedLabels();this._$first.attr("title",this.localizedLabels.firstPageTooltip);this._$prev.attr("title",this.localizedLabels.previousPageTooltip);this._$next.attr("title",this.localizedLabels.nextPageTooltip);this._$last.attr("title",this.localizedLabels.lastPageTooltip);this._$NP.attr("title",this.localizedLabels.nextPagerTooltip);this._$NP.attr("title",this.localizedLabels.previousPagerTooltip)},_applyCss:function(){this.model.currentPage>1?(this._$prev.removeClass("e-prevpagedisabled").removeClass("e-disable").addClass("e-prevpage e-default"),this._$first.removeClass("e-firstpagedisabled").removeClass("e-disable").addClass("e-firstpage e-default")):(this._$prev.addClass("e-prevpagedisabled e-disable").removeClass("e-prevpage").removeClass("e-default"),this._$first.addClass("e-firstpagedisabled e-disable").removeClass("e-firstpage").removeClass("e-default"));this.model.currentPage>this.model.pageCount?this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastNP=this._links.length&&parseInt(this._links[0].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>this.model.totalPages?!0:!1;this._lastNP==!1?this._$NP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"):this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default");this._lastpageCount=this.model.totalPages%this.model.pageCount;this._lastpageCount==0&&(this._lastpageCount=this.model.pageCount);this.model.currentPage>this.model.totalPages-this._LastpageCount&&(this._$PP.removeClass("e-nextprevitemdisabled").removeClass("e-disable").addClass("e-numericitem e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"));this.model.currentPage==this.model.totalPages||this.model.totalRecordsCount==0?(this._$last.addClass("e-lastpagedisabled e-disable").removeClass("e-lastpage").removeClass("e-default"),this._$next.addClass("e-nextpagedisabled e-disable").removeClass("e-nextpage").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default")):(this._$last.addClass("e-lastpage e-default").removeClass("e-lastpagedisabled").removeClass("e-disable"),this._$next.addClass("e-nextpage e-default").removeClass("e-nextpagedisabled").removeClass("e-disable"));this._links.length&&(this._links.removeClass("e-currentitem").removeClass("e-active").addClass("e-default"),n(this._links[(this.model.currentPage-1)%this.model.pageCount]).removeClass("e-default").addClass("e-currentitem e-active"),n(this._links[(this._prevPageNo-1)%this.model.pageCount]).removeClass("e-default").addClass("e-numericitem"));this._pageSize>=this.model.totalRecordsCount/this.model.pageCount&&this._$PP!=null&&this._$PP.length!=0&&(this._$PP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"),this._$NP.addClass("e-nextprevitemdisabled e-disable").removeClass("e-numericitem").removeClass("e-default"))},_SetTotalPages:function(){this.model.totalPages=this.model.totalRecordsCount%this._pageSize==0?this.model.totalRecordsCount/this._pageSize:parseInt(this.model.totalRecordsCount/this._pageSize,10)+1},_refreshNumericItem:function(){var i,t,r;if(this._links.length!=0&&this._links!=null)for(this.model.currentPage=this.model.totalPages==1?1:this.model.currentPage,this.model.currentPage>this.model.totalPages&&this.model.totalPages!=0&&(this.model.currentPage=this.model.totalPages),i=parseInt(this.model.currentPage/this.model.pageCount,10),this.model.currentPage%this.model.pageCount==0&&i>0&&(i=i-1),this._links.css("display","none"),t=0;t<this.model.pageCount;t++)r=i*this.model.pageCount+1+t,r<=this.model.totalPages&&(this._links[t].style.display="",n(this._links[t]).data("index",r),n(this._links[t]).html(this.model.customText+r))},_refreshPagerInfo:function(){this.model.totalRecordsCount==0&&(this.model.currentPage=0);this.element.find(".e-pagermsg").text(String.format(this.localizedLabels.pagerInfo,this.model.currentPage,this.model.totalPages||0,this.model.totalRecordsCount||0))},_refreshExternalMessage:function(){this.model.externalMessage.toString().length?this.element.find(".e-pagermessage").empty().html(this.model.externalMessage).show():this.element.find(".e-pagermessage").hide()},refreshPager:function(){this._SetTotalPages();this._refreshNumericItem();this._refreshPagerInfo();this._applyCss();this.model.enableExternalMessage&&this._refreshExternalMessage();this.model.enableRTL?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_kDownHandler:function(n){var t;if(t=n.keyCode?n.keyCode:n.which?n.which:n.charCode,n.target=null,this.model.masterObject.checkKey("firstPage",t,n))n.target=this._$first;else if(this.model.masterObject.checkKey("previousPager",t,n))n.target=this._$PP;else if(this.model.masterObject.checkKey("previousPage",t,n))n.target=this._$prev;else if(this.model.masterObject.checkKey("lastPage",t,n))n.target=this._$last;else if(this.model.masterObject.checkKey("nextPager",t,n))n.target=this._$NP;else if(this.model.masterObject.checkKey("nextPage",t,n))n.target=this._$next;else return!1;this._pagerClickHandler(n)},_pageInfo:function(){this.model.showPageInfo&&!this._parentMsgBar?(this._parentMsgBar=document.createElement("div"),this._parentMsgBar.className+="e-parentmsgbar",this._renderMsgBar(),this.element[0].appendChild(this._parentMsgBar),this.element[0].className+=this.model.enableRTL?" e-pager e-rtl":" e-pager"):(this._parentMsgBar&&this._parentMsgBar.remove(),this._parentMsgBar=null);this._msgWidth=n(this._parentMsgBar).outerWidth()},_doClickAnimation:function(t){var r=n(t.target);r!=i&&t.type!=i&&r.addClass("e-animate")},_pagerClickHandler:function(t){if(!this.model.enabled)return!1;this._prevPageNo=this.model.currentPage;var r=n(t.target);return this.element.find(".e-animate").removeClass("e-animate"),this._doClickAnimation(t),n.inArray(t.target,this._links)!=-1?this.model.currentPage=parseInt(n(t.target).data("index"),10):r.hasClass("e-nextpage")&&r.hasClass("e-nextpagedisabled")!=!0?this.model.currentPage%this.model.pageCount==0?(this.model.currentPage++,this._links!=i&&this._links.length!=0&&(this.model.currentPage=parseInt(n(this._links[0]).data("index"),10)+this.model.pageCount),parseInt(this._links[this.model.pageCount-1].innerHTML,10)+this.model.pageCount>=this.model.totalPages&&(this._lastNP=!0)):this.model.currentPage++:r.hasClass("e-prevpage")&&r.hasClass("e-prevpagedisabled")!=!0?(this.model.currentPage%this.model.pageCount==1&&(this._lastNP=!1),this.model.currentPage--,this.model.currentPage<0&&(this.model.currentPage=0)):r.hasClass("e-lastpage")&&r.hasClass("e-lastpagedisabled")!=!0?(this._LastpageCount=this.model.totalPages%this.model.pageCount,this._LastpageCount==0?this._LastpageCount=this.model.pageCount:null,this.model.currentPage=this.model.totalPages,this._lastNP=!0):r.hasClass("e-firstpage")&&r.hasClass("e-firstpagedisabled")!=!0?(this.model.currentPage=1,this._lastNP=!1):r.hasClass("e-NP")&&r.hasClass("e-nextprevitemdisabled")!=!0?(this._links!=i&&(this.model.currentPage=parseInt(n(this._links[0]).data("index"),10)+this.model.pageCount),parseInt(this._links[this.model.pageCount-1].innerHTML.replace(this.model.customText,""),10)+this.model.pageCount>=this.model.totalPages&&(this._lastNP=!0,this._LastpageCount=this.model.totalRecordsCount-this._pageSize<this._pageSize?this.model.totalRecordsCount-this._pageSize:this.model.totalRecordsCount/this._pageSize%this.model.pageCount,this._LastpageCount==0?this._LastpageCount=this.model.pageCount:null,this._links!=i&&(this.model.currentPage=parseInt(n(this._links[this.model.pageCount-1]).data("index"),10)+1))):r.hasClass("e-PP")&&r.hasClass("e-nextprevitemdisabled")!=!0&&(this._links!=i&&(this.model.currentPage=parseInt(n(this._links[0]).data("index"),10)-this.model.pageCount),this._lastNP=!1),this.goToPage(this.model.currentPage,t),this.numTextbox&&this.numTextbox.val(this.model.currentPage),!1},goToPage:function(n,t){n!=this.model.currentPage&&(this._prevPageNo=this.model.currentPage);this._prevPageNo!==n&&n>=1&&n<=this.model.totalPages?(this.model.currentPage=n,this.model.enableQueryString&&this._updateQueryString(this.model.currentPage),this._trigger("click",{currentPage:n,event:t})):this._trigger("click",{currentPage:n,event:t})},_updateQueryString:function(n){var t=this._getUpdatedURL(window.location.href,"page",n);history.pushState?window.history.pushState({path:t},"",t):window.location.href=t},_getUpdatedURL:function(n,t,i){var u=new RegExp("([?|&])"+t+"=.*?(&|#|$)","i"),r,f;return n.match(u)?n.replace(u,"$1"+t+"="+i+"$2"):(r="",f=n.indexOf("?")!==-1?"&":"?",n.indexOf("#")!==-1&&(r=n.replace(/.*#/,"#"),n=n.replace(/#.*/,"")),n+f+t+"="+i+r)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_fillScreen:function(){var t=this.element.find(".e-pagercontainer").outerWidth()-(this._$first.outerWidth()+this._$last.outerWidth()+this._$next.outerWidth()+this._$prev.outerWidth());t-=this._$NP.hasClass("e-disable")?0:this._$NP.outerWidth();t-=this._$PP.hasClass("e-disable")?0:this._$PP.outerWidth();this.element.outerWidth()-n(this.element.contents()[0]).outerWidth()<40&&(Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1<1?this._flag?this.option("pageCount",1):this.model.pageCount=1:this._flag?this.option("pageCount",Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1):this.model.pageCount=Math.floor(t/this.element.find(".e-numericcontainer .e-numericitem.e-spacing.e-default").outerWidth())-1)},_enable:function(){this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.numTextbox&&this.numTextbox.addClass("e-disable")},_disable:function(){this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.prop("disabled","disabled");this.numTextbox&&this.numTextbox.removeClass("e-disable");this.$dropItem&&this.$dropItem.css("display")!="none"&&this.$dropItem.hide()},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"pageCount":this._renderNumericLinks(this.element.find(".e-numericcontainer"));this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen());this._flag=!1;break;case"enableExternalMessage":n[t]?this._renderPagerMessage():this._removePagerMessage();break;case"showPageInfo":this._pageInfo();break;case"pageSizeMessage":n[t]!=null&&this._renderPageSizeMessage();break;case"pageSize":this._pageSize=this.model.pageSize;n[t].length>0?(this._pageSize=this.model.pageSize[0],this.$dropItem?(this.$dropItem.find("li").remove(),this._renderItems()):this._renderDropdownlist()):this.$dropItem&&this._removeDropdownlist();break;case"enabled":n[t]?this._enable():this._disable();break;case"cssClass":this.element.removeClass(this._cssClass).addClass(n[t]);this._cssClass=this.model.cssClass;case"isResponsive":this._wireResizing();n[t]?this.model.isResponsive&&!this._flag&&(this._maxPageCount=this.model.pageCount,this._fillScreen()):this.option("pageCount",this._maxPageCount);this._flag=!1;break;case"showGoToPage":n[t]?this._renderTextboxItem():this.numTextbox&&this.numTextbox.remove();break;case"locale":this._setLocale()}this.refreshPager()},_destroy:function(){this.element.empty().removeClass("e-pager");this._unWireResizing()}});t.Pager.Locale=t.Pager.Locale||{};t.Pager.Locale["default"]=t.Pager.Locale["en-US"]={pagerInfo:"{0} of {1} pages ({2} items)",firstPageTooltip:"Go to first page",lastPageTooltip:"Go to last page",nextPageTooltip:"Go to next page",previousPageTooltip:"Go to previous page",nextPagerTooltip:"Go to next pager",previousPagerTooltip:"Go to previous pager"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejSlider","ej.Slider",{element:null,model:null,validTags:["div","span"],_addToPersist:["value","values"],_rootCSS:"e-slider",_setFirst:!1,_requiresID:!0,defaults:{orientation:"horizontal",enableAnimation:!0,animationSpeed:500,showTooltip:!0,cssClass:"",showRoundedCorner:!1,readOnly:!1,enableRTL:!1,htmlAttributes:{},minValue:0,maxValue:100,sliderType:"default",value:null,values:null,incrementStep:1,height:null,width:null,enabled:!0,showScale:!1,largeStep:10,smallStep:1,showSmallTicks:!0,enablePersistence:!1,allowMouseWheel:!1,start:null,stop:null,slide:null,change:null,create:null,destroy:null,tooltipChange:null},dataTypes:{orientation:"enum",enableAnimation:"boolean",animationSpeed:"number",cssClass:"string",showRoundedCorner:"boolean",readOnly:"boolean",enableRTL:"boolean",minValue:"number",maxValue:"number",sliderType:"enum",incrementStep:"number",enabled:"boolean",showScale:"boolean",largeStep:"number",smallStep:"number",showSmallTicks:"boolean",enablePersistence:"boolean",htmlAttributes:"data",allowMouseWheel:"boolean"},observables:["value","values"],value:t.util.valueFunction("value"),values:t.util.valueFunction("values"),enable:function(){this.model.enabled||(this.model.enabled=!0,this.wrapper&&this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable"),this._wireEvents())},disable:function(){this.model.enabled&&(this.model.enabled=!1,this.wrapper&&this.wrapper.addClass("e-disable"),this.element.addClass("e-disable"),this._unWireEvents())},_validateValue:function(n,t){t=typeof t=="undefined"?!1:t;n==null||n===""?n=this.model.minValue:typeof n=="string"&&(n=parseFloat(n));this._isNumber(n)?this.value(n):this._isNumber(this.value())||this.value(this.model.minValue);this.model.sliderType!="range"&&this._setValue(t)},_validateRangeValue:function(n,t){if(t=typeof t=="undefined"?!1:t,n==null)n=[this.model.minValue,this.model.maxValue];else if(typeof n=="string"){var i=n.split(",");i.length>1&&(n=[parseFloat(i[0]),parseFloat(i[1])])}typeof n=="object"&&this._isNumber(n[0])&&this._isNumber(n[1])?this.values([n[0],n[1]]):typeof this.values()=="object"&&this._isNumber(this.values()[0])&&this._isNumber(this.values()[1])||this.values([this.model.minValue,this.model.maxValue]);this.model.sliderType=="range"&&this._setRangeValue(t)},_validateStartEnd:function(){isNaN(this.model.minValue)&&(this.model.minValue=0);isNaN(this.model.maxValue)&&(this.model.maxValue=100)},_isNumber:function(n){return typeof n=="number"&&!isNaN(n)},_outerCorner:function(n){n?this._roundedCorner():this._sharpedCorner()},_changeSkin:function(n){this.element.removeClass(this.model.cssClass).addClass(n);this.model.showScale&&this.ul.removeClass(this.model.cssClass).addClass(n)},getValue:function(){return this._getHandleValue()},setValue:function(n,t){this.model.sliderType=="range"?this._validateRangeValue(n,t):this._validateValue(n,t)},_init:function(){this._isInteraction=!0;this._initialize();this._render()},_setModel:function(n){var r,u;this._isInteraction=!1;t.isNullOrUndefined(n.minValue)&&t.isNullOrUndefined(n.maxValue)||(this._isNumber(n.minValue)?this.model.minValue=n.minValue:n.minValue=this.model.minValue,this._isNumber(n.maxValue)?this.model.maxValue=n.maxValue:n.maxValue=this.model.maxValue,this.model.sliderType=="range"&&n.values==i?this._setRangeValue():this.model.sliderType!="range"&&n.value==i&&this._setValue());for(r in n)switch(r){case"value":this._validateValue(t.util.getVal(n[r]));n[r]=this.model.value;break;case"values":this._validateRangeValue(t.util.getVal(n[r]));n[r]=this.model.values;break;case"height":this.model.height=n[r];this._setDimension();this.model.showScale&&this._scaleAlignment();break;case"width":this.model.width=n[r];this._setDimension();this.model.showScale&&this._scaleAlignment();break;case"enabled":this._disabled(!n[r]);break;case"showRoundedCorner":this._outerCorner(n[r]);break;case"enableRTL":this.model.enableRTL=n[r];this._checkRTL();n[r]=this.model.enableRTL;break;case"cssClass":this._changeSkin(n[r]);break;case"showScale":this._renderScale(n[r]);break;case"orientation":u=this.model.height;this.model.height=this.model.width;this.model.width=u;case"sliderType":this._sliderOptions(r,n[r]);break;case"smallStep":case"largeStep":case"showSmallTicks":case"minValue":case"maxValue":this._scaleOptions(r,n[r]);break;case"htmlAttributes":this._addAttr(n[r]);break;case"tooltipChange":this.model.tooltipChange=n[r];break;case"allowMouseWheel":this.model.allowMouseWheel=n[r]}},_destroy:function(){this.model.showScale&&this._destroyScale();this.element.insertAfter(this.wrapper);this.wrapper.remove();this.element.removeClass("e-widget e-box "+this.model.cssClass).empty()},_initialize:function(){this.target=this.element[0];this.horDir="left";this.verDir="bottom";this._isFocused=!1},_render:function(){this.initialRender=!0;this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this.wrapper=t.buildTag("div.e-slider-wrap e-widget"+this.model.cssClass+"#"+this.target.id+"_wrapper",{tabindex:"0",role:"slider"}).insertAfter(this.element);this.wrapper.append(this.element);this.element.addClass("e-widget e-box "+this.model.cssClass);this.model.sliderType!="default"&&(this.header=t.buildTag("div.e-range"),this.element.append(this.header),this.model.sliderType=="range"&&(this.secondHandle=this._createHandle()));this.firstHandle=this._createHandle();this._setOrientation();this._setDimension();this._insertHiddenField();this._checkProperties();this._addAttr(this.model.htmlAttributes);this._setSliderValue()},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i._disabled(!0):i.element.attr(t,n)})},_renderScale:function(n){var u,f,i,o,h,c;if(n){this.wrapper.addClass("e-scale-wrap");u="width";f="h";this.model.orientation=="vertical"&&(u="height",f="v");i=this.model.smallStep;this.model.showSmallTicks?i<=0&&(i=this.model.incrementStep):i=this.model.largeStep>0?this.model.largeStep:this.model.maxValue-this.model.minValue;o=Math.abs(this.model.maxValue-this.model.minValue)/i;this.ul=t.buildTag("ul.e-scale e-"+f+"-scale "+this.model.cssClass);this._isIE8&&this.ul.addClass("e-ie8");this.wrapper.append(this.ul);var e,r=this.model.minValue,l=0,s=100/o;for(f=="v"&&(r=this.model.maxValue),h=0;h<=o;h++)e=t.buildTag("li.e-tick","",{},{title:r}),e.css(u,s+"%"),r%this.model.largeStep==0&&(c=t.buildTag("span.e-tick-value",""+r),e.addClass("e-large").append(c)),this.ul.append(e),f=="h"?r+=i:r-=i,l+=i;this.ul.children().first().addClass("e-first-tick").css(u,s/2+"%");this.ul.children().last().addClass("e-last-tick").css(u,s/2+"%");this._scaleAlignment()}else this._destroyScale();this._setWrapperHeight()},_destroyScale:function(){this.wrapper.removeClass("e-scale-wrap");this.ul.remove();this.ul=null},_tickValuePosition:function(){var n=this.model.orientation=="vertical"?"height":"width",t=this.model.orientation=="vertical"?"top":"left",i=this.ul.find(".e-tick.e-first-tick"),r=i.find(".e-tick-value"),u=this.ul.find(".e-tick.e-large:not(.e-first-tick)").find(".e-tick-value");tickWidth=i[n]()*2;r.css(t,-r[n]()/2);u.css(t,(tickWidth-u[n]())/2)},_scaleAlignment:function(){var u;this._tickValuePosition();var f=12,t=20,e=t/2,n="height",i="top",r="h";this.model.orientation=="vertical"?(n="width",i="right",r="v",this.element.width()<=15?this.wrapper.addClass("e-small-size"):this.wrapper.removeClass("e-small-size")):this.element.height()<=15?this.wrapper.addClass("e-small-size"):this.wrapper.removeClass("e-small-size");this.ul.css(i,-(this.wrapper[n]()+e));r=="v"&&this.ul.css("top",-this.wrapper.height()).css(i,e);this.ul[n](this.wrapper[n]()+t);u=-(t-f)/2;this.model.largeStep==null&&r!="v"&&(u=-u);this.ul.find(".e-tick:not(.e-large)").css(n,this.wrapper[n]()+f).css(i,u);r=="v"&&this.ul.children(".e-large").find(".e-tick-value").css("right",this.wrapper.width()+t+4)},_setWrapperHeight:function(){var i,r,n,t;this.model.orientation=="horizontal"?(i=this.ul?this.firstHandle.outerHeight()>this.ul.height()?this.firstHandle.outerHeight():this.ul.height():this.firstHandle.outerHeight(),n=(i-this.element.outerHeight())/2,n<0&&(n=0),this.wrapper.css({padding:n+"px 0px"})):(r=this.ul?this.firstHandle.outerWidth()>this.ul.width()?this.firstHandle.outerWidth():this.ul.width():this.firstHandle.outerWidth(),t=(r-this.element.outerWidth())/2,t<0&&(t=0),this.wrapper.css({padding:"0px "+t+"px"}))},_createHandle:function(){return handle=t.buildTag("a.e-handle e-select","",{},{"aria-label":"drag",tabindex:0,role:"slider","aria-valuemin":this.model.minValue,"aria-valuemax":this.model.maxValue}),t.browserInfo().name=="msie"&&handle.addClass("e-pinch"),this.element.append(handle),handle},_setDimension:function(){this.model.height&&this.wrapper.height(this.model.height);this.model.width&&this.wrapper.width(this.model.width);this._setHandleSize();this._handleAlignment(this.model.enableRTL)},_insertHiddenField:function(){this._hidden=t.buildTag("input","",{},{type:"hidden",name:this.element[0].id});this._hidden.val(this._getHandleValue());this.element.append(this._hidden)},_checkProperties:function(){this.model.enabled?this._wireEvents():this.wrapper?this.wrapper.addClass("e-disable"):this.element.addClass("e-disable");this.model.showScale?this._renderScale(!0):this._setWrapperHeight();this.model.enableRTL&&this._checkRTL();this.model.showRoundedCorner&&this._roundedCorner()},_roundedCorner:function(){this.element.addClass("e-corner")},_sharpedCorner:function(){this.element.removeClass("e-corner")},_handleAlignment:function(n){var t=-(this.firstHandle.outerWidth()/2)+"px",i;i=this.model.orientation!="vertical"?n?"0 "+t+" 0 0":"0 0 0 "+t:n?t+" 0 0 0":"0 0 "+t+" 0";this.element.children(".e-handle").css("margin",i)},_checkRTL:function(){var i,n,t;this.model.showScale&&this.model.orientation=="vertical"&&this.model.enableRTL&&(this.model.enableRTL=!1);i=this.model.enableRTL;n=this.model.orientation!="vertical"?this.horDir:this.verDir;i?(this.wrapper.addClass("e-rtl"),this.horDir="right",this.verDir="top"):(this.wrapper.removeClass("e-rtl"),this.horDir="left",this.verDir="bottom");t=this.model.orientation!="vertical"?this.horDir:this.verDir;n!=t&&(this.firstHandle.css(t,this.firstHandle.css(n)).css(n,"auto"),this.model.sliderType!="default"&&(this.header.css(t,this.header.css(n)).css(n,"auto"),this.model.sliderType=="range"&&this.secondHandle.css(t,this.secondHandle.css(n)).css(n,"auto")));this._handleAlignment(i)},_setOrientation:function(){this.model.orientation!="vertical"?this.wrapper.addClass("e-horizontal"):(this.wrapper.addClass("e-vertical"),this.firstHandle.css(this.verDir,"0"))},_setHandleSize:function(){if(this.model.height!=null&&this.model.orientation=="horizontal"||this.model.width!=null&&this.model.orientation=="vertical"){var n;n=this.model.orientation!="vertical"?this.wrapper.height()+2:this.wrapper.width()+2;this.element.find(".e-handle").height(n).width(n)}else this.wrapper.addClass("e-default-wrap"),this.element.find(".e-handle").addClass("e-default")},_disabled:function(n){n?this.disable():this.enable()},_sliderOptions:function(n,t){this._unWireEvents();this._destroy();this.model[n]=t;this._init()},_scaleOptions:function(n,t){this.model.showScale&&(this._destroyScale(),this.model[n]=t,this._renderScale(!0))},_showTooltip:function(){if(this.model.showTooltip){this._timeOut&&clearTimeout(this._timeOut);var i=this.tooltip?n("body .e-tooltipbox").text().replace(/\s+/g,"").replace("-",","):"";if(this.tooltip&&this.tooltip.length&&this.tooltip.css("display")!="none"&&this._getHandle()[0]==this._oldHandle&&i==this.preValue){this._getHandleValue().toString()!=this.preValue&&this._setTooltipPosition();return}this._oldHandle=this._getHandle()[0];n("body .e-tooltipbox").remove();this.tooltip=t.buildTag("div.e-tooltipbox"+this.model.cssClass+" e-corner",{role:"tooltip"}).css(this._getOffset(this._getHandle()));n("body").append(this.tooltip);this.model.orientation=="vertical"&&this.tooltip.addClass("e-vertical");this._setTooltipPosition()}},_hideTooltip:function(){if(this.model.showTooltip){var n=this;this._timeOut=setTimeout(function(){n.tooltip.fadeOut(800)},1500)}},_showhideTooltip:function(n){this.model.showTooltip&&n&&(this._showTooltip(),this._timeOut&&clearTimeout(this._timeOut),this._hideTooltip())},_setTooltipPosition:function(){var i,r,o,f,u,t,e,s,h,c;this.model.showTooltip&&(this._updateTooltipValue(),e=5,u=this._getHandle(),t=this._getOffset(u),tooltipPos=this._getOffset(this.tooltip),border=n(u).outerHeight()-n(u).height(),this.model.orientation=="vertical"?(f=(this.tooltip.outerHeight()-u.outerHeight())/2,o=u.outerWidth()+e,i=t.top-f,r=t.left+o,s=n(window).height(),window.pageYOffset>0&&(s+=window.pageYOffset),i<0?i=0:s<i+this.tooltip.outerHeight()&&(i=s-this.tooltip.outerHeight()-border),n(window).width()<r+this.tooltip.outerWidth()&&(r=t.left-this.tooltip.outerWidth()-border)):(tooltipPos.left+this.tooltip.outerWidth()>n(window).width()&&this.tooltip.css({left:"0px"}),o=(this.tooltip.outerWidth()-u.outerWidth())/2,f=this.tooltip.outerHeight()+e,i=t.top-f,r=t.left-o,h=n(window).width(),window.pageXOffset>0&&(h+=window.pageXOffset),r<0?r=0:h<r+this.tooltip.outerWidth()&&(r=h-this.tooltip.outerWidth()-border),(i<0||t.top<f)&&(t.top+u.outerHeight()+border+this.tooltip.outerHeight()>n(window).height()?(i=t.top,r=t.left>this.tooltip.outerWidth()+e+border?t.left-(this.tooltip.outerWidth()+border):t.left+(u.outerWidth()+e+border)):i=t.top+u.outerHeight()+border)),c=this._maxZindex(),this.tooltip.css({top:i,left:r,zIndex:c+1}))},_getOffset:function(n){return t.util.getOffset(n)},_maxZindex:function(){return t.util.getZindexPartial(this.element,this.popup)},_updateTooltipValue:function(){var t=0,i=1,n;this.model.enableRTL&&(t=1,i=0);n=this.model.tooltipChange?this._raiseEvent("tooltipChange"):this._getHandleValue();this.tooltip[0].innerHTML=this.model.sliderType!="range"?n:n[t]+" - "+n[i]},_increaseHeaderWidth:function(n){if(this.model.sliderType!="default"){var i="width",r=this.horDir,t={};this.model.orientation=="vertical"&&(i="height",r=this.verDir);this.model.sliderType=="range"?(t[i]=this.handlePos-this.handlePos2+"%",t[r]=this.handlePos2+"%"):(t[i]=this.handlePos+"%",t[r]=0);n?this.header.animate(t,this.model.animationSpeed):this.header.css(t)}},_setSliderValue:function(){this._validateStartEnd();this.model.sliderType=="range"?this._validateRangeValue(this.values()):this._validateValue(this.value());this.preValue=this.getValue().toString()},_hoverOnHandle:function(t){n(t.currentTarget).addClass("e-hover")},_leaveFromHandle:function(t){n(t.currentTarget).removeClass("e-hover")},_firstHandleClick:function(i){if(i.preventDefault(),this.firstHandle.focus().addClass("e-no-tab"),this._raiseEvent("start"))return!1;this.mouseDownPos=this.handlePos;this.model.readOnly||this._on(n(document),t.eventType.mouseMove,this._firstHandleMove);this._on(n(document),t.eventType.mouseUp,this._firstHandleUp);this._on(n(document),"mouseleave",this._firstHandleUp);this._showTooltip()},_firstHandleMove:function(n){n.preventDefault();n=n.type=="touchmove"?n.originalEvent.changedTouches[0]:n;var t={x:n.pageX,y:n.pageY};this.handlePos=this._xyToPosition(t);this.model.sliderType=="range"&&this.handlePos<this.handlePos2&&(this.handlePos=this.handlePos2);this.handlePos!=this.preHandlePos&&(this.preHandlePos=this.handlePos,this.handleVal=this._positionToValue(this.handlePos),this._increaseHeaderWidth(!1),this._setHandlePosition(!1,!1,!1),this._setTooltipPosition(),this._updateModelValue(),this._raiseEvent("slide"))},_firstHandleUp:function(i){i.preventDefault();this._off(n(document),t.eventType.mouseMove,this._firstHandleMove);this._off(n(document),t.eventType.mouseUp,this._firstHandleUp);this._off(n(document),"mouseleave",this._firstHandleUp);this._timeOut&&clearTimeout(this._timeOut);this._hideTooltip();this.mouseDownPos!=this.handlePos&&this._raiseChangeEvent()},_secondHandleClick:function(i){if(i.preventDefault(),this.secondHandle.focus().addClass("e-no-tab"),this._raiseEvent("start"))return!1;this.mouseDownPos2=this.handlePos2;this.model.readOnly||this._on(n(document),t.eventType.mouseMove,this._secondHandleMove);this._on(n(document),t.eventType.mouseUp,this._secondHandleUp);this._on(n(document),"mouseleave",this._secondHandleUp);this._showTooltip()},_secondHandleMove:function(n){n.preventDefault();n=n.type=="touchmove"?n.originalEvent.changedTouches[0]:n;var t={x:n.pageX,y:n.pageY};this.handlePos2=this._xyToPosition(t);this.handlePos2>this.handlePos&&(this.handlePos2=this.handlePos);this.handlePos2!=this.preHandlePos2&&(this.preHandlePos2=this.handlePos2,this.handleVal2=this._positionToValue(this.handlePos2),this._increaseHeaderWidth(!1),this._setHandlePosition(!1,!1,!1),this._setTooltipPosition(),this._updateModelValue(),this._raiseEvent("slide"))},_secondHandleUp:function(i){i.preventDefault();this._off(n(document),t.eventType.mouseMove,this._secondHandleMove);this._off(n(document),t.eventType.mouseUp,this._secondHandleUp);this._off(n(document),"mouseleave",this._secondHandleUp);this._timeOut&&clearTimeout(this._timeOut);this._hideTooltip();this.mouseDownPos2!=this.handlePos2&&this._raiseChangeEvent()},_focusInHandle:function(t){this._isFocused||(this._isFocused=!0,n(t.currentTarget).addClass("e-focus"),this.model.readOnly||this._on(n(document),"keydown",this._moveHandle),this.model.allowMouseWheel&&!this.model.readOnly&&this._on(this.element,"mousewheel DOMMouseScroll",this._moveHandle),this.activeHandle=n(t.currentTarget).is(this.firstHandle)?1:2,this._setZindex())},_focusOutHandle:function(t){this._isFocused=!1;this.model.showTooltip&&this.tooltip&&this.tooltip.fadeOut(800);this.element.find(".e-no-tab").removeClass("e-no-tab");n(t.currentTarget).removeClass("e-focus");this._off(n(document),"keydown",this._moveHandle);this._off(this.element,"mousewheel DOMMouseScroll",this._moveHandle)},_moveHandle:function(n){var t,i,r,f,u,e;(n.type=="mousewheel"||n.type=="DOMMouseScroll")&&n.preventDefault();r=this._getHandleIndex(this.activeHandle)-1;n.originalEvent.detail&&(f=-n.originalEvent.detail/3,t=f>0?"add":"sub");switch(n.keyCode||n.originalEvent.wheelDelta){case-120:case 37:case 40:this._getHandle().addClass("e-no-tab");n.preventDefault();t="sub";break;case 120:case 38:case 39:this._getHandle().addClass("e-no-tab");n.preventDefault();t="add";break;case 36:if(this._getHandle().addClass("e-no-tab"),n.preventDefault(),this._raiseEvent("start"))return!1;this.model.sliderType!="range"&&this.value()!=this.model.minValue?this._changeHandleValue(this.model.minValue,this.model.enableAnimation):this.model.sliderType=="range"&&(i=this.activeHandle==2?this.model.minValue:this.handleVal2,this.values()[r]!=i&&this._changeHandleValue(i,this.model.enableAnimation));break;case 35:if(this._getHandle().addClass("e-no-tab"),n.preventDefault(),this._raiseEvent("start"))return!1;this.model.sliderType!="range"&&this.value()!=this.model.maxValue?this._changeHandleValue(this.model.maxValue,this.model.enableAnimation):this.model.sliderType=="range"&&(i=this.activeHandle==1?this.model.maxValue:this.handleVal,this.values()[r]!=i&&this._changeHandleValue(i,this.model.enableAnimation));break;case 27:this._getHandle().addClass("e-no-tab");n.preventDefault();this._getHandle().focusout()}if(t=="add"||t=="sub"){if(this._raiseEvent("start"))return!1;u=this.activeHandle==1?this.handleVal:this.handleVal2;e=t=="add"?this._add(u,this.model.incrementStep,!0):this._add(u,this.model.incrementStep,!1);this._changeHandleValue(e,!1)}},_changeHandleValue:function(n,t){var i=null;this.activeHandle==1?(this.handleVal=this._checkHandleValue(n),this.handlePos=this._checkHandlePosition(this.handleVal),this.model.sliderType=="range"&&this.handlePos<this.handlePos2&&(this.handlePos=this.handlePos2,this.handleVal=this.handleVal2),this.handlePos!=this.preHandlePos&&(i=this.preHandlePos=this.handlePos)):(this.handleVal2=this._checkHandleValue(n),this.handlePos2=this._checkHandlePosition(this.handleVal2),this.model.sliderType=="range"&&this.handlePos<this.handlePos2&&(this.handlePos2=this.handlePos,this.handleVal2=this.handleVal),this.handlePos2!=this.preHandlePos2&&(i=this.preHandlePos2=this.handlePos2));i!=null&&(this._increaseHeaderWidth(t),this._setHandlePosition(t,!0,!0))},_sliderBarClick:function(t){if(this.model.readOnly)return!1;if(t.target==this.target||this.model.sliderType!="default"&&t.target==this.header[0]||n(t.target).hasClass("e-tick")||n(t.target).hasClass("e-scale")||t.target==this.wrapper[0]){if(t.preventDefault(),this._raiseEvent("start"))return!1;var u={x:t.pageX,y:t.pageY},i=this._xyToPosition(u),r=this._positionToValue(i);this.model.sliderType=="range"&&this.handlePos-i>i-this.handlePos2?(this.handlePos2=this.preHandlePos2=i,this.handleVal2=r,this.activeHandle=2):(this.handlePos=this.preHandlePos=i,this.handleVal=r,this.activeHandle=1);this._getHandle().focus().addClass("e-no-tab");this.model.sliderType!="default"&&this._increaseHeaderWidth(this.model.enableAnimation);this._setHandlePosition(this.model.enableAnimation,!0,!0)}},_setHandlePosition:function(n,t,i){var r=this._getHandle(),e=this,u={},f,o,s;f=this.activeHandle==1?this.handlePos:this.handlePos2;o=this.activeHandle==1?this.handleVal:this.handleVal2;r.attr("aria-label",o);s=this.model.orientation=="vertical"?this.verDir:this.horDir;u[s]=f+"%";f==0?this.model.sliderType!="range"&&this._getHandle().addClass("e-handle-start"):this._getHandle().removeClass("e-handle-start");n?r.animate(u,this.model.animationSpeed,function(){e._showhideTooltip(t);i&&e._raiseChangeEvent()}):(r.css(u),this._showhideTooltip(t),i&&this._raiseChangeEvent())},_xyToPosition:function(n){if(this.model.minValue==this.model.maxValue)return 100;if(this.model.orientation!="vertical")var r=n.x-this.element.offset().left,i=this.element.width()/100,t=r/i;else var u=n.y-this.element.offset().top,i=this.element.height()/100,t=100-u/i;return(t=this._stepValueCalculation(t),t<0?t=0:t>100&&(t=100),this.model.enableRTL)?100-t:t},_updateValue:function(){this.handleVal=this._checkHandleValue(this.value());this.handlePos=this._checkHandlePosition(this.handleVal);this.preHandlePos=this.handlePos;this.activeHandle=1},_setValue:function(n){this._updateValue();this._increaseHeaderWidth(n);this._setHandlePosition(n,!1,!0)},_updateRangeValue:function(){var n=this.values();this.handleVal=this._checkHandleValue(n[1]);this.handleVal2=this._checkHandleValue(n[0]);this.handlePos=this._checkHandlePosition(this.handleVal);this.handlePos2=this._checkHandlePosition(this.handleVal2);this.handlePos<this.handlePos2&&(this.handlePos=this.handlePos2,this.handleVal=this.handleVal2);this.preHandlePos=this.handlePos;this.preHandlePos2=this.handlePos2},_setRangeValue:function(n){this._updateRangeValue();this._increaseHeaderWidth(n);this.activeHandle=1;this._setHandlePosition(n,!1,!1);this.activeHandle=2;this._setHandlePosition(n,!1,!0)},_checkHandlePosition:function(n){if(this.model.minValue==this.model.maxValue)return 100;var t=this._tempStartEnd();return n>=t.start&&n<=t.end?100*(n-this.model.minValue)/(this.model.maxValue-this.model.minValue):n<t.start?0:100},_checkHandleValue:function(n){if(this.model.minValue==this.model.maxValue)return this.model.minValue;var t=this._tempStartEnd();return n<t.start?n=t.start:n>t.end&&(n=t.end),n},_tempStartEnd:function(){return this.model.minValue>this.model.maxValue?{start:this.model.maxValue,end:this.model.minValue}:{start:this.model.minValue,end:this.model.maxValue}},_positionToValue:function(n){var t=this.model.maxValue-this.model.minValue,i=this._round(t*n/100);return this._add(i,this.model.minValue,!0)},_getHandle:function(){return this.activeHandle==1?this.firstHandle:this.secondHandle},_getHandleIndex:function(n){return this.model.sliderType=="range"&&n==1?2:1},_getHandleValue:function(){return this.model.sliderType=="range"?[this.handleVal2,this.handleVal]:this.handleVal},_updateModelValue:function(){var n=this._getHandleValue();this.model.sliderType=="range"?this.values(n):this.value(n);this._hidden.val(n)},_add:function(n,t,i,r){var u=Math.pow(10,r||3);return i?(Math.round(n*u)+Math.round(t*u))/u:(Math.round(n*u)-Math.round(t*u))/u},_round:function(n){var t=this.model.incrementStep.toString().split(".");return t[1]?parseFloat(n.toFixed(t[1].length)):Math.round(n)},_raiseChangeEvent:function(){this._updateModelValue();this.initialRender?this.initialRender=!1:this.getValue().toString()!=this.preValue.toString()&&(this._raiseEvent("change"),this._raiseEvent("stop"),this.preValue=this.getValue().toString(),this._isInteraction=!0)},_raiseEvent:function(n){var t={id:this.target.id,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)},i;return(n=="change"&&(t={id:this.target.id,isInteraction:this._isInteraction,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)}),n=="tooltipChange"&&(t={id:this.target.id,isInteraction:this._isInteraction,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)}),i=this._trigger(n,t),n=="tooltipChange")?t.value:i},_setZindex:function(){this.model.sliderType=="range"&&(this.activeHandle==1?(this.firstHandle.css("z-index",2),this.secondHandle.css("z-index",1)):(this.firstHandle.css("z-index",1),this.secondHandle.css("z-index",2)))},_stepValueCalculation:function(n){this.model.incrementStep==0&&(this.model.incrementStep=1);var i=this.model.incrementStep/((this.model.maxValue-this.model.minValue)/100),t=n%Math.abs(i);return t!=0&&(i/2>t?n-=t:n+=Math.abs(i)-t),n},_wireEvents:function(){this._on(this.wrapper,"mousedown",this._sliderBarClick);this._on(this.firstHandle,t.eventType.mouseDown,this._firstHandleClick);this._on(this.firstHandle,"mouseenter",this._hoverOnHandle);this._on(this.firstHandle,"mouseleave",this._leaveFromHandle);this._on(this.firstHandle,"focusin",this._focusInHandle);this._on(this.firstHandle,"focusout",this._focusOutHandle);this.model.sliderType=="range"&&(this._on(this.secondHandle,t.eventType.mouseDown,this._secondHandleClick),this._on(this.secondHandle,"mouseenter",this._hoverOnHandle),this._on(this.secondHandle,"mouseleave",this._leaveFromHandle),this._on(this.secondHandle,"focusin",this._focusInHandle),this._on(this.secondHandle,"focusout",this._focusOutHandle))},_unWireEvents:function(){this._off(this.wrapper,"mousedown");this._off(this.firstHandle,t.eventType.mouseDown);this._off(this.firstHandle,"mouseenter");this._off(this.firstHandle,"mouseleave");this._off(this.firstHandle,"focusin");this._off(this.firstHandle,"focusout");this.model.sliderType=="range"&&(this._off(this.secondHandle,t.eventType.mouseDown),this._off(this.secondHandle,"mouseenter"),this._off(this.secondHandle,"mouseleave"),this._off(this.secondHandle,"focusin"),this._off(this.secondHandle,"focusout"))}});t.SliderType={Default:"default",MinRange:"minrange",Range:"range"}}(jQuery,Syncfusion),function(n,t){t.widget("ejSplitButton","ej.SplitButton",{element:null,model:null,validTags:["button"],_setFirst:!1,_rootCSS:"e-splitbutton",defaults:{size:"normal",width:"",height:"",enabled:!0,htmlAttributes:{},text:null,contentType:"textonly",imagePosition:"imageleft",buttonMode:"split",arrowPosition:"right",targetID:null,target:null,showRoundedCorner:!1,prefixIcon:null,suffixIcon:null,cssClass:"",enableRTL:!1,create:null,beforeOpen:null,click:null,itemMouseOver:null,itemMouseOut:null,itemSelected:null,open:null,close:null,destroy:null},dataTypes:{size:"string",enabled:"boolean",showRoundedCorner:"boolean",text:"string",contentType:"enum",imagePosition:"enum",buttonMode:"enum",arrowPosition:"enum",target:"string",targetID:"string",prefixIcon:"string",suffixIcon:"string",cssClass:"string",enableRTL:"boolean",htmlAttributes:"data"},disable:function(){this.element.addClass("e-disable");this.wrapper.addClass("e-disable");this.contstatus&&this._hidePopup();this.model.buttonMode==t.ButtonMode.Split&&this.dropbutton.addClass("e-disable").attr("aria-disabled",!0);this.model.buttonMode==t.ButtonMode.Dropdown&&this.btnimgwrap.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1},visible:function(n){n?(this.wrapper.removeClass("e-split-btn-hide"),this.wrapper.find(".e-icon").css("visibility","")):(this.wrapper.addClass("e-split-btn-hide"),this.wrapper.find(".e-icon").css("visibility","hidden"))},enable:function(){this.element.removeClass("e-disable");this.wrapper.removeClass("e-disable");this.model.buttonMode==t.ButtonMode.Split&&this.dropbutton.removeClass("e-disable").attr("aria-disabled",!1);this.model.buttonMode==t.ButtonMode.Dropdown&&this.btnimgwrap.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0},hide:function(){this.contstatus&&this._hidePopup()},show:function(){this.contstatus||(this.model.buttonMode==t.ButtonMode.Dropdown?this.element.click():this.model.buttonMode==t.ButtonMode.Split&&this.dropbutton.click())},_init:function(){this._cloneElement=this.element.clone();this._initialize();this._controlStatus(this.model.enabled);this._documentClickHandler=n.proxy(this._documentClick,this);this._wireEvents()},_destroy:function(){this.splitwrap.removeClass("e-drop");this.splitwrap.removeClass("e-btn-"+this.model.size);this.innerWrap.removeClass("e-splitarrowright e-splitarrowleft e-splitarrowbottom e-splitarrowtop");this.element.removeClass(this.model.cssClass+" e-select e-corner e-btn e-disable e-split-btn e-droparrowright e-droparrowleft e-droparrowbottom e-droparrowtop e-left-btn e-txt").empty();this.element.append(this._cloneElement.text());this.element.insertAfter(this.wrapper);this.wrapper.remove();n(this.model.target).ejMenu("destroy");n(this.model.target).insertAfter(this.element);this._off(this.element,"click",this._btnMouseClick)},_setModel:function(t){for(var i in t)switch(i){case"size":this._setSize(t[i]);break;case"width":this._splitbtnWidth(t[i]);break;case"height":this._splitbtnHeight(t[i]);break;case"contentType":this._setContentType(t[i]);break;case"imagePosition":this._setImagePosition(t[i]);break;case"buttonMode":this._setButtonMode(t[i]);break;case"arrowPosition":this._setArrowPosition(t[i]);break;case"text":this._setText(t[i]);break;case"prefixIcon":this._setMajorIcon(t[i]);break;case"suffixIcon":this._setMinorIcon(t[i]);break;case"enabled":this._controlStatus(t[i]);break;case"targetID":case"target":this._setTarget(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"cssClass":this._setSkin(t[i]);break;case"enableRTL":this._setRTL(t[i]);n(this.model.target).ejMenu({enableRTL:t[i]});break;case"htmlAttributes":this._addAttr(t[i])}},_setText:function(n){this.model.contentType==t.ContentType.TextOnly?this.model.buttonMode==t.ButtonMode.Split?this.element.html(n):(this.element.empty(),this.imgtxtwrap=n,this.model.arrowPosition==t.ArrowPosition.Left||this.model.arrowPosition==t.ArrowPosition.Top?this.element.append(this.btnimgwrap,this.imgtxtwrap):this.element.append(this.imgtxtwrap,this.btnimgwrap)):this.textspan.html(n)},_setMajorIcon:function(n){this.majorimgtag.removeClass(this.model.prefixIcon);this.majorimgtag.addClass(n)},_setMinorIcon:function(n){this.minorimgtag.removeClass(this.model.suffixIcon);this.minorimgtag.addClass(n)},_setTarget:function(n){n.substring(0,1)=="."||n.substring(0,1)=="#"?this.model.target=n:(this.model.targetID=n,this.model.target="#"+n);this._renderContxtMenu()},_setContentType:function(n){n!=this.model.contentType&&(this.element.empty(),this.model.contentType=n,this._renderButtonContent())},_setImagePosition:function(n){(n==t.ImagePosition.ImageRight||n==t.ImagePosition.ImageLeft||n==t.ImagePosition.ImageBottom||n==t.ImagePosition.ImageTop)&&this.model.contentType==t.ContentType.TextAndImage&&n!=this.model.imagePosition&&(this.element.empty(),this.model.imagePosition=n,this._renderButtonContent())},_setButtonMode:function(n){(n==t.ButtonMode.Split||n==t.ButtonMode.Dropdown)&&n!=this.model.buttonMode&&(this._destroy(),this.model.buttonMode=n,this._init())},_setArrowPosition:function(n){(n==t.ArrowPosition.Right||n==t.ArrowPosition.Left||n==t.ArrowPosition.Bottom||n==t.ArrowPosition.Top)&&(this.model.buttonMode==t.ButtonMode.Dropdown&&n!=this.model.arrowPosition?(this.model.arrowPosition=n,this.element.empty(),this._setSize(this.model.size),this.element.removeClass("e-droparrowright e-droparrowleft e-droparrowbottom e-droparrowtop"),this._renderButtonContent()):this.model.buttonMode==t.ButtonMode.Split&&n!=this.model.arrowPosition&&(this.model.arrowPosition=n,this._setSize(this.model.size),this.innerWrap.removeClass("e-splitarrowright e-splitarrowleft e-splitarrowbottom e-splitarrowtop"),this._setRTL(this.model.enableRTL)))},_setRTL:function(n){if(this.model.buttonMode==t.ButtonMode.Split){this.dropdownimg.removeClass("e-arrow-sans-up").addClass("e-arrow-sans-down");switch(this.model.arrowPosition){case t.ArrowPosition.Right:this.innerWrap.addClass("e-splitarrowright");break;case t.ArrowPosition.Left:this.innerWrap.addClass("e-splitarrowleft");break;case t.ArrowPosition.Bottom:this.innerWrap.addClass("e-splitarrowbottom");break;case t.ArrowPosition.Top:this.innerWrap.addClass("e-splitarrowtop");this.dropdownimg.addClass("e-arrow-sans-up").removeClass("e-arrow-sans-down")}n==!0?this.splitwrap.addClass("e-rtl e-btnrtl"):this.splitwrap.removeClass("e-rtl e-btnrtl")}else n==!0?this.splitwrap.addClass("e-rtl"):this.splitwrap.removeClass("e-rtl");this.model.enableRTL=n;this._roundedCorner(this.model.showRoundedCorner)},_roundedCorner:function(t){t?(this.element.addClass("e-corner"),n(this.model.target).length>0&&n(this.model.target).addClass("e-corner")):(this.element.removeClass("e-corner"),n(this.model.target).length>0&&n(this.model.target).removeClass("e-corner"))},_controlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(i){this.element.removeClass(this.model.cssClass);this.model.buttonMode==t.ButtonMode.Split&&(this.dropbutton.removeClass(this.model.cssClass),this.dropbutton.addClass(i));this.element.addClass(i);n(this.model.target).ejMenu("option","cssClass",i)},_initialize:function(){this.element.is("button")?this._render():this.element.removeClass("e-splitbutton");this._timeout=null},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i._controlStatus(!1):i.wrapper.attr(t,n)})},_render:function(){this.element.addClass(this.model.cssClass+" e-btn e-select e-split-btn "+(t.isTouchDevice()?"":"e-ntouch")).attr("role","button");this.model.text==null||this.model.text==""?this.model.text=this.element.text():this.element.attr("aria-describedby",this.model.text);this.model.buttonMode!=t.ButtonMode.Split&&this.model.buttonMode!=t.ButtonMode.Dropdown&&(this.model.buttonMode=t.ButtonMode.Split);this.model.arrowPosition!=t.ArrowPosition.Right&&this.model.arrowPosition!=t.ArrowPosition.Left&&this.model.arrowPosition!=t.ArrowPosition.Bottom&&this.model.arrowPosition!=t.ArrowPosition.Top&&(this.model.arrowPosition=t.ArrowPosition.Right);this.element.empty();this.splitwrap=this.model.buttonMode==t.ButtonMode.Split?t.buildTag("span.e-split e-widget","",{},{"tab-index":0}):t.buildTag("span.e-split e-drop e-widget");this.splitwrap.insertBefore(this.element);this.innerWrap=t.buildTag("span.e-in-wrap e-box e-padding");this.splitwrap.append(this.innerWrap);this.wrapper=this.splitwrap;this.dropdownimg=t.buildTag("span.e-icon e-arrow-sans-down");this.btnimgwrap=t.buildTag("div.e-split-btn-div");this.btnimgwrap.append(this.dropdownimg);this.model.buttonMode==t.ButtonMode.Split&&(this.dropbutton=t.buildTag("button.e-split-btn e-btn e-select "+this.model.cssClass+" e-drp-btn"+(t.isTouchDevice()?"":" e-ntouch"),"",{},{type:"button","data-role":"none",id:this.element[0].id+"drpbtn"}),this.dropbutton.append(this.btnimgwrap),this.dropbutton.insertAfter(this.element),this.model.contentType==t.ContentType.TextOnly?this.dropbutton.addClass("e-btn-txt"):this.dropbutton.addClass("e-rht-btn"));this._setSize(this.model.size);this.element.addClass("e-left-btn");this._renderButtonContent();this.model.buttonMode==t.ButtonMode.Dropdown?this.innerWrap.append(this.element):this.innerWrap.append(this.element,this.dropbutton);this.model.target==null&&this.model.targetID!=null&&(this.model.target="#"+this.model.targetID);this._renderContxtMenu();this._roundedCorner(this.model.showRoundedCorner);this._setRTL(this.model.enableRTL);this._addAttr(this.model.htmlAttributes)},_renderButtonContent:function(){if(this.textspan=t.buildTag("span.e-btntxt",this.model.text),this.majorimgtag=t.buildTag("span").addClass(this.model.prefixIcon),this.minorimgtag=t.buildTag("span").addClass(this.model.suffixIcon),this.imgtxtwrap=t.buildTag("div"),this.model.contentType==t.ContentType.TextAndImage)switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.majorimgtag,this.textspan);break;case t.ImagePosition.ImageBottom:this.majorimgtag.css("display","inline-table");this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageTop:this.majorimgtag.css("display","inline-table");this.imgtxtwrap.append(this.majorimgtag,this.textspan)}else this.model.contentType==t.ContentType.ImageTextImage?this.imgtxtwrap.append(this.majorimgtag,this.textspan,this.minorimgtag):this.model.contentType==t.ContentType.ImageBoth?this.imgtxtwrap.append(this.majorimgtag,this.minorimgtag):this.model.contentType==t.ContentType.ImageOnly?this.imgtxtwrap.append(this.majorimgtag):(this.element.addClass("e-txt"),this.imgtxtwrap=this.model.text);this.model.buttonMode==t.ButtonMode.Dropdown?this._renderDropdownArrow():this.element.append(this.imgtxtwrap)},_renderDropdownArrow:function(){this.btnimgwrap.css("position","absolute");this.dropdownimg.removeClass("e-arrow-sans-up").addClass("e-arrow-sans-down");switch(this.model.arrowPosition){case t.ArrowPosition.Right:this.element.addClass("e-droparrowright");this.element.append(this.imgtxtwrap,this.btnimgwrap);break;case t.ArrowPosition.Left:this.element.addClass("e-droparrowleft");this.element.append(this.btnimgwrap,this.imgtxtwrap);break;case t.ArrowPosition.Bottom:this.element.addClass("e-droparrowbottom");this.element.append(this.imgtxtwrap,this.btnimgwrap);break;case t.ArrowPosition.Top:this.element.addClass("e-droparrowtop");this.dropdownimg.addClass("e-arrow-sans-up").removeClass("e-arrow-sans-down");this.element.append(this.btnimgwrap,this.imgtxtwrap)}},_setSize:function(n){this.wrapper.css({height:"",width:""});switch(n){case"mini":this._splitbtnSize(n);break;case"small":this._splitbtnSize(n);break;case"medium":this._splitbtnSize(n);break;case"large":this._splitbtnSize(n);break;default:this._splitbtnSize(n)}(this.model.arrowPosition==t.ArrowPosition.Bottom||this.model.arrowPosition==t.ArrowPosition.Top)&&this.model.height==""&&this.splitwrap.addClass("e-btn-arrowsplit-"+n);var i=this.model.height===""?this.wrapper.outerHeight()+"px":this.model.height;this._splitbtnHeight(i);this.model.size!=="normal"?(wd=this.model.width===""?this.wrapper.outerWidth()+"px":this.model.width,this._splitbtnWidth(wd)):this.model.width!==""&&(wd=this.model.width,this._splitbtnWidth(wd))},_splitbtnSize:function(n){this.splitwrap.removeClass("e-btn-mini e-btn-medium e-btn-small e-btn-large e-btn-normal e-btn-arrowsplit-large e-btn-arrowsplit-small e-btn-arrowsplit-mini e-btn-arrowsplit-medium e-btn-arrowsplit-normal");(this.model.arrowPosition==t.ArrowPosition.Left||this.model.arrowPosition==t.ArrowPosition.Right)&&this.splitwrap.addClass("e-btn-"+n)},_splitbtnHeight:function(n){(n==""||n==null)&&(n="30px");this.splitwrap.css("height",n)},_splitbtnWidth:function(n){this.splitwrap.css("width",n)},_renderContxtMenu:function(){this.model.target!=null&&n(this.model.target).attr("id")==null&&this.model.target.substring(0,1)=="."&&n(this.model.target).attr("id",this.element.attr("id")+"_"+this.model.target.replace(".",""));n(this.model.target).ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"",fields:this.model.fields,showArrow:!0,cssClass:"e-split "+this.model.cssClass,enableRTL:this.model.enableRTL}).on("ejMenuclose",n.proxy(this._onKeyDown,this))},_onKeyDown:function(n){n.keyCode==27&&this._hide()},_itemClick:function(t){t={status:this.model.enabled,ID:t.ID,text:t.text};this._trigger("itemSelected",t);n(t.element).hasClass("e-haschild")||this._hide()},_itemMouseOver:function(n){this._trigger("itemMouseOver",n)},_itemMouseOut:function(n){this._trigger("itemMouseOut",n)},_wireEvents:function(){this._on(this.element,"click",this._btnMouseClick);this._on(this.element,"mousedown",this._btnMouseDown);this.model.buttonMode==t.ButtonMode.Split&&this._on(this.dropbutton,"click",this._btnMouseClick);this._on(n(document),"mousedown",this._docrhtclk)},_btnMouseClick:function(i){var r;if(!this.model.enabled)return!1;if(!n(i.currentTarget).hasClass("e-disable"))if(i.currentTarget.id!=this.element[0].id+"drpbtn"&&this.model.buttonMode==t.ButtonMode.Split)r={status:this.model.enabled},this._trigger("click",r);else if(this.contstatus||this._trigger("beforeOpen"),this.wrapper.addClass("e-active"),this.contstatus)this._hidecontext(i);else{this._contextPosition(i);this._trigger("open");this._on(n(window),"resize",this._OnWindowResize);this.contstatus=!0;this.element.on("click",n.proxy(this._hidecontext,this));t.listenTouchEvent(n(document),t.startEvent(),this._documentClickHandler,!1,this);this._on(t.getScrollableParents(this.wrapper),"scroll",this._hidePopup)}},_OnWindowResize:function(n){this._contextPosition(n)},_contextPosition:function(i){var r=this._getXYpos(i),u,e,f;e=this.model.buttonMode==t.ButtonMode.Split?this.dropbutton:this.element;f=n(this.model.target).ejMenu("instance");u=r.x-(n(this.model.target).outerWidth()-(this.model.buttonMode==t.ButtonMode.Split?this.dropbutton.outerWidth():this.element.outerWidth()));r.x=this.model.enableRTL?u<n(this.model.target).outerWidth()?r.x:u:r.x+n(this.model.target).outerWidth()<n(window).width()?r.x:u;f.option({click:n.proxy(this._itemClick,this),mouseover:n.proxy(this._itemMouseOver,this),mouseout:n.proxy(this._itemMouseOut,this)});f.show(r.x,r.y,e,i)},_getXYpos:function(){var i,u,f,e=1,r;return i=this._getOffset(this.model.buttonMode==t.ButtonMode.Split?this.dropbutton:this.element),u=i.left,r=this.model.arrowPosition==t.ArrowPosition.Top?i.top-n(this.model.target).outerHeight()+1:(this.model.buttonMode==t.ButtonMode.Split?i.top+this.dropbutton.outerHeight():i.top+this.element.outerHeight())-e,f=r<0?i.top+(this.model.buttonMode==t.ButtonMode.Split?this.dropbutton.outerHeight()+this.element.outerHeight():this.element.outerHeight())-e:r,{x:u,y:f}},_getOffset:function(t){var i=t.offset(),r;return n("body").css("position")!="static"&&(r=n("body").offset(),i.left-=r.left,i.top-=r.top),i},_btnMouseDown:function(t){n(t.currentTarget).hasClass("e-disable")||this._docrhtclk(t)},_hidePopup:function(i){n(this.model.target).ejMenu("hide",i);this._hide();this._off(t.getScrollableParents(this.wrapper),"scroll",this._hidePopup)},_hide:function(){this.contstatus=!1;this.wrapper.removeClass("e-active");this.element.off("click",n.proxy(this._hidecontext,this));t.listenTouchEvent(n(document),t.startEvent(),this._documentClickHandler,!0,this);this._off(n(window),"resize",this._OnWindowResize);this._off(t.getScrollableParents(this.wrapper),"scroll",this._hide);this._closeEvent()},_closeEvent:function(){this._trigger("close")},_hidecontext:function(t){((n(t.target).is(this.element)||n(t.target).is(this.dropbutton)||n(t.target).is(this.textspan)||n(t.target).is(this.dropdownimg)||n(t.target).is(this.btnimgwrap)||!n(t.target).is(this.majorimgtag)||!n(t.target).is(this.minorimgtag))&&!n(t.target).is(this.splitwrap)&&!n(t.target).parents().is(n(this.model.target))||this.element.hasClass("e-txt")||n(t.target).is(this.imgtxtwrap))&&this._hidePopup(t)},_documentClick:function(t){n(t.target).is(this.element)||n(t.target).is(this.dropbutton)||n(t.target).is(this.textspan)||n(t.target).is(this.dropdownimg)||n(t.target).is(this.btnimgwrap)||n(t.target).is(this.majorimgtag)||n(t.target).is(this.minorimgtag)||n(t.target).is(this.splitwrap)||n(t.target).parents().is(n(this.model.target))||!this.element.hasClass("e-txt")&&n(t.target).is(this.imgtxtwrap)||this._hidePopup(t)},_docrhtclk:function(n){var t,i;t=!1;n.button?t=n.button==2:n.which&&(t=n.which==3);i=n.target;t&&n.preventDefault()}});t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"};t.ButtonSize={Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.ButtonMode={Split:"split",Dropdown:"dropdown"};t.ArrowPosition={Right:"right",Left:"left",Top:"top",Bottom:"bottom"}}(jQuery,Syncfusion),function(n,t){t.widget("ejToggleButton","ej.ToggleButton",{element:null,model:null,validTags:["input"],_addToPersist:["toggleState"],_setFirst:!1,_rootCSS:"e-togglebutton",defaults:{size:"normal",type:"button",width:"",height:"",enabled:!0,toggleState:!1,defaultText:null,preventToggle:!1,activeText:null,contentType:"textonly",htmlAttributes:{},imagePosition:"imageleft",showRoundedCorner:!1,enablePersistence:!1,cssClass:"",defaultPrefixIcon:null,defaultSuffixIcon:null,activePrefixIcon:null,activeSuffixIcon:null,enableRTL:!1,create:null,click:null,change:null,destroy:null},dataTypes:{size:"string",type:"enum",enabled:"boolean",showRoundedCorner:"boolean",preventToggle:"boolean",defaultText:"string",activeText:"string",contentType:"enum",imagePosition:"enum",defaultPrefixIcon:"string",defaultSuffixIcon:"string",activePrefixIcon:"string",activeSuffixIcon:"string",cssClass:"string",enableRTL:"boolean",enablePersistence:"boolean",htmlAttributes:"data"},observables:["toggleState"],toggleState:t.util.valueFunction("toggleState"),disable:function(){this.buttontag.addClass("e-disable").attr({"aria-disabled":!0});this.model.enabled=!1},enable:function(){this.buttontag.hasClass("e-disable")&&(this.buttontag.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.enabled=!0)},_init:function(){this._initialize();this._controlStatus(this.model.enabled);this._wireEvents();this.initialRender=!1},_destroy:function(){this._off(this.buttontag,"blur",this._tglebtnblur);this.element.unwrap();this.element.removeClass("e-chkbx-hidden");this.labelFinder.empty();this.labelFinder.text(this.model.defaultText);this.buttontag.remove();this.element.unwrap();this.defaultLabel.insertAfter(this.element)},_setModel:function(n){for(var i in n)switch(i){case"size":this._setSize(n[i]);break;case"type":this._settype(n[i]);break;case"height":this._setHeight(n[i]);break;case"width":this._setWidth(n[i]);break;case"contentType":this._setContentType(n[i]);break;case"imagePosition":this._setImagePosition(n[i]);break;case"defaultText":this._setDefaultText(n[i]);break;case"activeText":this._setActiveText(n[i]);break;case"defaultPrefixIcon":this._setDefaultMajorIcon(n[i]);break;case"defaultSuffixIcon":this._setDefaultMinorIcon(n[i]);break;case"activePrefixIcon":this._setActiveMajorIcon(n[i]);break;case"activeSuffixIcon":this._setActiveMinorIcon(n[i]);break;case"enabled":this._controlStatus(n[i]);break;case"toggleState":this._tglevaluestatus(t.util.getVal(n[i]));break;case"showRoundedCorner":this._roundedCorner(n[i]);break;case"cssClass":this._setSkin(n[i]);break;case"enableRTL":this._setRTL(n[i]);break;case"htmlAttributes":this._addAttr(n[i])}},_setSize:function(n){this.buttontag.removeClass("e-btn-mini e-btn-medium e-btn-small e-btn-large e-btn-normal");this.buttontag.addClass("e-btn-"+n)},_settype:function(n){this.model.type=n},_setHeight:function(n){this.buttontag.css("height",n)},_setWidth:function(n){this.buttontag.css("width",n)},_setDefaultText:function(n){this.toggleState()||(this.model.contentType==t.ContentType.TextOnly?this.buttontag.html(n):this.defaulttxtspan.html(n))},_setActiveText:function(n){this.toggleState()&&(this.model.contentType==t.ContentType.TextOnly?this.buttontag.html(n):this.defaulttxtspan.html(n))},_setDefaultMajorIcon:function(n){this.defMainIcon.removeClass(this.model.defaultPrefixIcon);this.defMainIcon.addClass(n)},_setDefaultMinorIcon:function(n){this.defMiniIcon.removeClass(this.model.defaultSuffixIcon);this.defMiniIcon.addClass(n)},_setActiveMajorIcon:function(n){this.toggleState()&&(this.defMainIcon.removeClass(this.model.activePrefixIcon),this.defMainIcon.addClass(n))},_setActiveMinorIcon:function(n){this.toggleState()&&(this.defMiniIcon.removeClass(this.model.activeSuffixIcon),this.defMiniIcon.addClass(n))},_setContentType:function(n){n!=this.model.contentType&&(this.buttontag.empty(),this.model.contentType=n,this._renderButtonContent())},_setImagePosition:function(n){this.model.contentType==t.ContentType.TextAndImage&&n!=this.model.imagePosition&&(this.buttontag.empty(),this.model.imagePosition=n,this._renderButtonContent())},_setRTL:function(n){n?this.buttontag.addClass("e-rtl"):this.buttontag.removeClass("e-rtl")},_controlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(n){this.model.cssClass!=n&&(this.buttontag.removeClass(this.model.cssClass),this.buttontag.addClass(n))},_initialize:function(){this.element.is('[type = "checkbox"]')?this._render():this.element.removeClass("e-togglebutton")},_render:function(){this.initialRender=!0;var i,r;this.element.addClass("e-chkbx-hidden e-tbtn");this.element.attr("name")||this.element.attr("name",this.element[0].id);i=this.element.parents().last();r="label[for='"+this.element[0].id+"']";this.labelFinder=i.find(r);this.defaultLabel=i.find(r).clone();this.labelFinder.length||(this.labelFinder=t.buildTag("label","Button",{},{"for":this.element[0].id}),this.labelFinder.insertAfter(this.element));(this.model.defaultText==null||this.model.defaultText=="")&&(this.model.defaultText=this.labelFinder.text());this.labelFinder.empty();this.wrapper=n('<span id="'+this.element[0].id+'-wrapper" class="e-tbtn-wrap e-widget"><\/span>');this.labelFinder.append(this.element);this.buttontag=t.buildTag("button.e-togglebutton e-btn e-tbtn "+this.model.cssClass+" e-select","",{},{role:"button",tabindex:0,type:this.model.type,"data-role":"none"});t.isTouchDevice()||this.buttontag.addClass("e-ntouch");n(this.labelFinder).wrap(this.wrapper);this.buttontag.insertAfter(this.labelFinder);t.util.isNullOrUndefined(this.model.activeText)&&(this.model.activeText=this.model.defaultText);t.util.isNullOrUndefined(this.model.activePrefixIcon)&&(this.model.activePrefixIcon=this.model.defaultPrefixIcon);t.util.isNullOrUndefined(this.model.activeSuffixIcon)&&(this.model.activeSuffixIcon=this.model.defaultSuffixIcon);this._setSize(this.model.size);this._setHeight(this.model.height);this._setWidth(this.model.width);this._setRTL(this.model.enableRTL);this._renderButtonContent();this.toggleState()||t.isNullOrUndefined(this.element.attr("checked"))||this.toggleState(!0);this._tglevaluestatus(this.toggleState());this._roundedCorner(this.model.showRoundedCorner);this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="disabled"&&n=="disabled"?i.disable():t=="checked"&&n=="checked"?i._tglevaluestatus(this.toggleState()):i.wrapper.attr(t,n)})},_renderButtonContent:function(){if(this.imgtxtwrap=t.buildTag("div"),this.defaulttxtspan=t.buildTag("span.e-btntxt#"+this.element[0].id+"textstatic",this.toggleState()?this.model.activeText:this.model.defaultText),this.model.contentType.indexOf("image")>-1&&(this.defMainIcon=t.buildTag("span #"+this.element[0].id+"mainiconstatic"),this.defMiniIcon=t.buildTag("span #"+this.element[0].id+"miniconstatic"),this.toggleState()?this.defMainIcon.addClass(this.model.activePrefixIcon):this.defMainIcon.addClass(this.model.defaultPrefixIcon),this.toggleState()?this.defMiniIcon.addClass(this.model.activeSuffixIcon):this.defMiniIcon.addClass(this.model.defaultSuffixIcon)),this.model.contentType==t.ContentType.TextAndImage){switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.defaulttxtspan,this.defMainIcon);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.defMainIcon,this.defaulttxtspan);break;case t.ImagePosition.ImageBottom:this.defMainIcon.attr("style","display:inherit");this.imgtxtwrap.append(this.defaulttxtspan,this.defMainIcon);break;case t.ImagePosition.ImageTop:this.defMainIcon.attr("style","display:inherit");this.imgtxtwrap.append(this.defMainIcon,this.defaulttxtspan)}this.buttontag.append(this.imgtxtwrap)}else this.model.contentType==t.ContentType.ImageTextImage?(this.imgtxtwrap.append(this.defMainIcon,this.defaulttxtspan,this.defMiniIcon),this.buttontag.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageOnly?(this.imgtxtwrap.append(this.defMainIcon),this.buttontag.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageBoth?(this.imgtxtwrap.append(this.defMainIcon,this.defMiniIcon),this.buttontag.append(this.imgtxtwrap)):(this.buttontag.addClass("e-txt"),this.buttontag.text(this.model.defaultText))},_tglevaluestatus:function(n){n?(this._toggleButtonStatus(n),this.element.attr("checked","checked")):(this._toggleButtonStatus(n),this.element.prop("checked",!1))},_roundedCorner:function(n){n==!0?this.buttontag.addClass("e-corner"):this.buttontag.removeClass("e-corner")},_wireEvents:function(){this._on(this.buttontag,"click",this._tglebtnclicked);this._on(this.buttontag,"blur",this._tglebtnblur)},_tglebtnblur:function(){this.buttontag.removeClass("e-animate")},_tglebtnclicked:function(i){if(this.model.preventToggle&&!this.model.enabled)return!1;this.model.preventToggle||this.buttontag.hasClass("e-disable")||(this.toggleState(this.toggleState()?!1:!0),t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?this._tglevaluestatus(this.toggleState()):this._toggleButtonStatus(this.toggleState()),n(this.element).prop("checked",this.toggleState()),i.preventDefault(),this.buttontag.addClass("e-animate"),this._trigger("click",{isChecked:this.toggleState(),status:this.model.enabled}))},_toggleButtonStatus:function(n){n?(this.model.contentType==t.ContentType.TextOnly?this.buttontag.html(this.model.activeText):(this.defaulttxtspan.html(this.model.activeText),this.defMainIcon.removeClass(this.model.defaultPrefixIcon).addClass(this.model.activePrefixIcon),this.defMiniIcon.removeClass(this.model.defaultSuffixIcon).addClass(this.model.activeSuffixIcon)),this.buttontag.addClass("e-active").attr("aria-pressed",!0)):(this.model.contentType==t.ContentType.TextOnly?this.buttontag.html(this.model.defaultText):(this.defaulttxtspan.html(this.model.defaultText),this.defMainIcon.removeClass(this.model.activePrefixIcon).addClass(this.model.defaultPrefixIcon),this.defMiniIcon.removeClass(this.model.activeSuffixIcon).addClass(this.model.defaultSuffixIcon)),this.buttontag.removeClass("e-active").attr("aria-pressed",!1));this.toggleState(n);this.initialRender||this._trigger("change",{isChecked:this.toggleState()})}});t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"};t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.ButtonType={Button:"button",Reset:"reset",Submit:"submit"}}(jQuery,Syncfusion),function(n,t){t.widget("ejGroupButton","ej.GroupButton",{element:null,model:null,validTags:["div","span"],_addToPersist:["selectedItemIndex"],_setFirst:!1,_rootCSS:"e-groupbutton",defaults:{height:"",width:"",cssClass:"",enabled:!0,enableRTL:!1,showRoundedCorner:!1,size:"normal",groupButtonMode:"radiobutton",orientation:t.Orientation.Horizontal,selectedItemIndex:[],htmlAttributes:{},dataSource:null,query:null,fields:{text:"text",prefixIcon:"prefixIcon",suffixIcon:"suffixIcon",contentType:"contentType",imagePosition:"imagePosition",selected:"selected",url:"url",htmlAttribute:"htmlAttribute",linkAttribute:"linkAttribute"},create:null,beforeSelect:null,select:null,keyPress:null,destroy:null},dataTypes:{cssClass:"string",enabled:"boolean",dataSource:"data",query:"data",fields:"data",showRoundedCorner:"boolean",enableRTL:"boolean",size:"enum",groupButtonMode:"enum",orientation:"enum",selectedItemIndex:"array"},_setModel:function(t){var f,i,u,r,e;for(f in t){i=t[f];switch(f){case"size":this._setSize(i);break;case"height":this._setDimension("height",i);break;case"width":this._setDimension("width",i);break;case"enabled":this._setControlStatus(i);break;case"showRoundedCorner":this._setRoundedCorner(i);break;case"cssClass":this._setSkin(i);break;case"enableRTL":this._setRTL(i);break;case"htmlAttributes":this._setAttr(i);break;case"dataSource":this.element.html("");this.model.dataSource=i;this._initialize();break;case"groupButtonMode":this.model.groupButtonMode!=i&&this.itemsContainer.children(".e-grp-btn-item.e-active").removeClass("e-active").attr({"aria-selected":!1});break;case"orientation":this._setOrientation(i);this._setDimension("width",this.model.width);this._setDimension("height",this.model.height);break;case"selectedItemIndex":for(u=JSON.parse(JSON.stringify(this.model.selectedItemIndex)),r=0,e=u.length;r<e;r++)i.indexOf(u[r])==-1&&this._removeSelection(n(this.items[u[r]]));this.model.selectedItemIndex=i;this._handleSeletedItem()}}},_destroy:function(){this.element.html("");this._cloneElement.removeClass("e-groupbutton e-js e-widget e-box");this.element.replaceWith(this._cloneElement)},_init:function(){this._cloneElement=n(this.element).clone();this._isRender=!1;this._initialize();this._isRender=!0},_initialize:function(){this.element.addClass("e-widget e-box e-widget").attr({role:"group",tabindex:"0","aria-disabled":!1});this.model.dataSource!=null&&this._checkDataBinding();this.element.hasClass("onloading")||this._render()},_render:function(){this._renderItems();this._setSize(this.model.size);this._setOrientation(this.model.orientation);this._setDimension("width",this.model.width);this._setDimension("height",this.model.height);this._setRoundedCorner(this.model.showRoundedCorner);this._setAttr(this.model.htmlAttributes);this.model.enableRTL&&this._setRTL(this.model.enableRTL);this._handleSeletedItem();this._setControlStatus(this.model.enabled)},_checkDataBinding:function(){var n=this.model.dataSource;n!=null&&(this.element.addClass("onloading"),t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._createItems(n))},_initDataSource:function(n){var t=this,i;i=n.executeQuery(this._getQuery());i.done(function(n){t._createItems(n.result);t._render()}).fail(function(){t.element.removeClass("onloading")})},_getQuery:function(){var r;if(t.isNullOrUndefined(this.model.query)){var u=[],i=t.Query(),n=this.model.fields;for(r in n)r!=="tableName"&&n[r]&&u.push(n[r]);u.length>0&&i.select(u);this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query;return i},_createItems:function(n){this.list=n;var i;for(this.mapField=this._getMapper(),this.ultag=t.buildTag("ul"),this.element.append(this.ultag),i=0;i<n.length;i++)this._generateTagItems(n[i],this.mapField,i);this.element.removeClass("onloading")},_getMapper:function(){var n=this.model.fields,t={_text:null};return t._text=n&&n.text?n.text:"text",t._prefixIcon=n&&n.prefixIcon?n.prefixIcon:"prefixIcon",t._suffixIcon=n&&n.suffixIcon?n.suffixIcon:"suffixIcon",t._contentType=n&&n.contentType?n.contentType:"contentType",t._imagePosition=n&&n.imagePosition?n.imagePosition:"imagePosition",t._selected=n&&n.selected?n.selected:"selected",t._url=n&&n.url?n.url:"url",t._htmlAttribute=n&&n.htmlAttribute?n.htmlAttribute:"htmlAttribute",t._linkAttribute=n&&n.linkAttribute?n.linkAttribute:"linkAttribute",t},_generateTagItems:function(i,r,u){var o=i[r._text]?t.buildTag("span.e-btntxt",i[r._text]):null,f,s,e=t.buildTag("li"),c,h;i[r._htmlAttribute]&&this._setAttributes(i[r._htmlAttribute],e);c=i[r._imagePosition]?i[r._imagePosition]:"imageleft";h=i[r._contentType]?i[r._contentType]:"textonly";h.indexOf("image")>-1&&(i[r._prefixIcon]&&(f=t.buildTag("span"),f.addClass(i[r._prefixIcon])),i[r._suffixIcon]&&(s=t.buildTag("span"),s.addClass(i[r._suffixIcon])));switch(h){case t.ContentType.TextAndImage:switch(c){case t.ImagePosition.ImageRight:e.append(o,f);break;case t.ImagePosition.ImageLeft:e.append(f,o);break;case t.ImagePosition.ImageBottom:f.attr("style","display:inherit");e.append(o,f);break;case t.ImagePosition.ImageTop:f.attr("style","display:inherit");e.append(f,o)}break;case t.ContentType.ImageTextImage:e.append(f,o,s);break;case t.ContentType.ImageBoth:e.append(f,s);break;case t.ContentType.ImageOnly:e.append(f);break;case t.ContentType.TextOnly:e.append(o)}i[r._url]&&(aTag=t.buildTag("a.e-grp-btn-link").attr("href",i[r._url]),i[r._linkAttribute]&&this._setAttributes(i[r._linkAttribute],aTag),e.wrapInner(aTag));this.ultag.append(e);i[r._selected]&&n.inArray(u,this.model.selectedItemIndex)<=-1&&this.model.selectedItemIndex.push(u)},_setAttributes:function(n,t){for(var i in n)i=="class"?t.addClass(n[i]):t.attr(i,n[i])},_renderItems:function(){var r;this.itemsContainer=this.element.children("ol, ul, div").addClass("e-ul");this.itemsContainer.children("ol, ul").remove();this.items=this.itemsContainer.children("li, div").addClass("e-grp-btn-item").attr({"aria-selected":!1,"aria-disabled":!1});for(var u=0,t=[],e=this.items.length,i,f;u<e;u++)t=n(this.items[u]),i=document.createElement("div"),i.className="e-btn-content",t.children().length==0?(f=document.createElement("span"),n(f).text(t.text()).addClass("e-btntxt"),t.text(""),i.appendChild(f)):(r=t.children("a").length>0?t.children("a").children():t.children(),r.appendTo(i)),r=t.children("a").length>0?t.children("a"):t,r.append(i);this.items.filter(":last").addClass("last")},_handleSeletedItem:function(){var i=this.model.selectedItemIndex,r,u;if(this.model.groupButtonMode==t.GroupButtonMode.RadioButton)this._setSeletedItem(n(this.items[i[i.length-1]]));else for(r=0,u=i.length;r<u;r++)this._setSeletedItem(n(this.items[i[r]]))},_setSeletedItem:function(n,i){var r;this.isSelected(n)||(r=this._getDetails(n),r.element=n,r.event=i,this._triggerEvent("beforeSelect",r))||(this.model.groupButtonMode==t.GroupButtonMode.RadioButton&&this._removeSelection(this.items.filter(".e-active")),n.addClass("e-active").attr("aria-selected",!0).siblings(".e-grp-btn-item").removeClass("e-hover"),this._addSelectedIndex(this.items.index(n)),r=this._getDetails(n),r.element=n,r.event=i,this._triggerEvent("select",r))},_removeSelection:function(n){n.removeClass("e-active").attr("aria-selected",!1);this._removeSelectedIndex(this.items.index(n))},_getDetails:function(n){if(n[0]!=null&&n.hasClass("e-grp-btn-item")){var t,i,r,u;return t=n.attr("id"),r=this.isSelected(n),i=this.isDisabled(n),u=this.getIndex(n),{id:t,selected:r,disabled:i,index:u}}return{id:"",selected:"",disabled:"",index:""}},_setAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n);t=="disabled"&&n=="disabled"&&i.disable()})},_setSize:function(n){this.element.removeClass("e-grp-btn-mini e-grp-btn-medium e-grp-btn-small e-grp-btn-large e-grp-btn-normal");this.element.addClass("e-grp-btn-"+n)},_setDimension:function(t,i){var u=26,e,o=0,s=t=="width"?"outerWidth":"outerHeight",r,h,c,f,l;if(i=="auto"){for(e=this.element[s]()-this.element[t](),r=0,h=this.items.length;r<h;r++)o+=n(this.items[r])[s]();this.element.css(t,o+e)}else this.element.css(t,i);t!="height"||this._vertical?t=="height"&&(this.element.css("min-height","").find("div.e-btn-content").removeClass("e-groupBtn-padding"),this.element.find(".e-grp-btn-item").css("height","").find("div.e-btn-content").css("margin-top","").find(".e-btntxt").css("line-height",""),c=this.element.height()/this.items.length,c<u?(this.element.css("min-height",this.items.length*u).find("div.e-btn-content").addClass("e-groupBtn-padding"),this.element.find(".e-grp-btn-item").css({height:Math.ceil(this.element.height()/this.items.length)})):(f=this.element.height()/this.items.length,l=(f-this.element.find("div.e-btn-content").outerHeight())/2,this.element.find(".e-grp-btn-item").css({height:f}).find("div.e-btn-content").css("margin-top",l+"px").find(".e-btntxt").css("line-height",this.element.find("div.e-btn-content").height()+"px"))):(this.element.css("min-height","").find("div.e-btn-content").removeClass("e-groupBtn-padding"),this.element.find(".e-grp-btn-item").css("height","").find("div.e-btn-content").css("margin-top","").find(".e-btntxt").css("line-height",""),t=="height"&&parseInt(this.element.height())<u?this.element.addClass("e-groupbutton-hSmall").find("div.e-btn-content").addClass("e-groupBtn-padding"):parseInt(this.element.height())<35?this.element.find("div.e-btn-content").addClass("e-groupBtn-padding"):this.element.removeClass("e-groupbutton-hSmall").find("div.e-btn-content").removeClass("e-groupBtn-padding"))},_setRTL:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_setControlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},_setOrientation:function(n){n!=t.Orientation.Vertical?this.itemsContainer.removeClass("e-vertical").addClass("e-horizontal")&&(this._vertical=!1):this.itemsContainer.removeClass("e-horizontal").addClass("e-vertical")&&(this._vertical=!0)},_setRoundedCorner:function(n){n?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},_updateCss:function(){this.items.filter(".last").removeClass("last");this.items.filter(".e-grp-btn-item:visible:not(.e-hidden)").last().addClass("last");this.items.filter(".e-hidden").length==this.items.length?this.element.addClass("e-no-border"):this.element.removeClass("e-no-border")},_selectDeselect:function(n,t){this.isSelected(n)?(this._removeSelection(n),this._focusedItem=null):(this._focusedItem=n,this._setSeletedItem(n,t))},_getVisibleItems:function(){return this.items.filter(".e-grp-btn-item:visible:not(.e-hidden, .e-disable)")},_getNodeByID:function(t){return typeof t=="number"?t=this.items[t]:typeof t!="object"&&t!=""&&(t=this.itemsContainer.find(".e-grp-btn-item#"+t)),t=n(t),t=n(t[0]),t},_addSelectedIndex:function(n){var t=this.model.selectedItemIndex;this._removeNullInArray(t);!t instanceof Array&&(t=[]);t.indexOf(n)==-1&&t.push(n)},_removeSelectedIndex:function(n){var t=this.model.selectedItemIndex,i;!t instanceof Array&&(t=[]);i=t.indexOf(n);i!=-1&&(t.splice(i,1),t.length==0&&t.push(-1))},_removeNullInArray:function(n){var t=n.indexOf(-1);t!=-1&&n.splice(t,1)},_onKeyPress:function(i){var u,r,e,f,o;if(u=i.keyCode?i.keyCode:i.which?i.which:i.charCode,r=this._getVisibleItems(),this._focusedItem?(e=this._focusedItem,this._focusedItem=null):e=r.filter(".e-hover"),i.type=="keydown"){if((u==38||u==39)&&this.model.orientation!=t.Orientation.Vertical||(u==39||u==40)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),f=n(r[r.index(e)+1]).length>0?n(r[r.index(e)+1]):r.first()):(u==37||u==40)&&this.model.orientation!=t.Orientation.Vertical||(u==37||u==38)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),f=n(r[r.index(e)-1]).length>0?n(r[r.index(e)-1]):r.last()):u==36?(i.preventDefault(),f=r.first()):u==35?(i.preventDefault(),f=r.last()):u==32&&i.preventDefault(),f){if(o=this._getDetails(f),o.element=f,o.event=i,this._triggerEvent("keyPress",o))return;f.addClass("e-hover").siblings(".e-hover").removeClass("e-hover")}}else switch(u){case 13:case 32:i.preventDefault();this._selectDeselect(e,i);break;case 27:i.preventDefault();this.element.blur()}},_onfocusIn:function(){this.element.addClass("e-focus");this._clicked||this._getVisibleItems().first().addClass("e-hover").siblings(".e-hover").removeClass("e-hover");this._on(this.element,"keyup keydown",this._onKeyPress)},_onfocusOut:function(){this.element.removeClass("e-focus").find(".e-grp-btn-item.e-hover").removeClass("e-hover");this._off(this.element,"keyup keydown",this._onKeyPress)},_onBtnHover:function(t){var i=n(t.currentTarget);i.hasClass("e-disable")||i.addClass("e-hover")},_onBtnLeave:function(t){var i=n(t.currentTarget);i.hasClass("e-disable")||i.removeClass("e-hover")},_onBtnClick:function(t){var i=n(t.currentTarget);i.hasClass("e-disable")||this._selectDeselect(i,t)},_onMouseDown:function(){this._clicked=!0},_triggerEvent:function(n,t){if(this._isRender)return this._trigger(n,t)},_wireUnwireEvents:function(n){this[n](this.element,"mousedown",this._onMouseDown)[n](this.element,"focus",this._onfocusIn)[n](this.element,"blur",this._onfocusOut);this[n](this.items,"click",this._onBtnClick);t.isTouchDevice()||(this[n](this.items,"mouseenter",this._onBtnHover),this[n](this.items,"mouseleave",this._onBtnLeave))},isSelected:function(n){return n=this._getNodeByID(n),n[0]!=null&&n.hasClass("e-grp-btn-item")?n.hasClass("e-active"):void 0},isDisabled:function(n){return n=this._getNodeByID(n),n[0]!=null&&n.hasClass("e-grp-btn-item")?n.attr("aria-disabled")=="true"?!0:!1:void 0},disable:function(){this.element.addClass("e-disable").attr("aria-disabled",!0);this.items.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1;this._wireUnwireEvents("_off")},enable:function(){this.element.removeClass("e-disable").attr("aria-disabled",!1);this.items.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0;this._wireUnwireEvents("_on")},show:function(){this.element.removeClass("e-hidden")},hide:function(){this.element.addClass("e-hidden")},getSelectedItem:function(){return this.element.find(".e-grp-btn-item.e-active")},getIndex:function(n){return n=this._getNodeByID(n),n[0]!=null&&n.hasClass("e-grp-btn-item")?this.items.index(n):void 0},enableItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&(n.removeClass("e-disable").attr("aria-disabled",!1),n.next(".e-grp-btn-item").removeClass("e-border-left e-border-bottom"))},disableItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&!n.hasClass("e-disable")&&(n.addClass("e-disable").attr("aria-disabled",!0),this.model.orientation==t.Orientation.Horizontal?(this._setDimension("width",this.model.width),n.next(".e-grp-btn-item").addClass("e-border-left")):(n.next(".e-grp-btn-item").addClass("e-border-bottom"),this._setDimension("height",this.model.height)))},selectItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&this._setSeletedItem(n)},deselectItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&this._removeSelection(n)},showItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&(n.removeClass("e-hidden"),this._updateCss())},hideItem:function(n){n=this._getNodeByID(n);n[0]!=null&&n.hasClass("e-grp-btn-item")&&(n.addClass("e-hidden"),this._updateCss())}});t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.GroupButtonMode={CheckBox:"checkbox",RadioButton:"radiobutton"};t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"}}(jQuery,Syncfusion),function(n,t){t.widget("ejToolbar","ej.Toolbar",{element:null,model:null,validTags:["div","span"],_setFirst:!1,_rootCSS:"e-toolbar",angular:{terminal:!1},defaults:{height:"",width:"",enabled:!0,hide:!1,disabledItemIndices:[],enabledItemIndices:[],enableSeparator:!1,orientation:"horizontal",enableRTL:!1,isResponsive:!1,showRoundedCorner:!1,htmlAttributes:{},dataSource:null,Items:{id:"id",tooltipText:"tooltipText",imageUrl:"imageUrl",text:"text",imageAttributes:"imageAttributes",spriteCssClass:"spriteCssClass",htmlAttributes:"htmlAttributes",group:"group",template:"template"},query:null,responsiveType:"popup",fields:{id:"id",tooltipText:"tooltipText",imageUrl:"imageUrl",text:"text",imageAttributes:"imageAttributes",spriteCssClass:"spriteCssClass",htmlAttributes:"htmlAttributes",group:"group",template:"template"},tooltipSettings:{associate:"mouseenter",showShadow:!0,position:{stem:{horizontal:"left",vertical:"top"}},tip:{size:{width:5,height:5},adjust:{xValue:17,yValue:17}},isBalloon:!1},cssClass:"",targetID:null,create:null,click:null,itemHover:null,itemLeave:null,overflowOpen:null,overflowClose:null,destroy:null},dataTypes:{enabled:"boolean",hide:"boolean",enableSeparator:"boolean",disabledItemIndices:"data",enabledItemIndices:"data",orientation:"enum",enableRTL:"boolean",showRoundedCorner:"boolean",isResponsive:"boolean",dataSource:"data",query:"data",fields:"data",cssClass:"string",htmlAttributes:"data",targetID:"string",responsiveType:"enum"},hide:function(){if(!this.model.enabled&&this.element.css("display")=="none")return!1;this.element.css("display","none");this.model.hide=!0},show:function(){if(!this.model.enabled&&this.element.css("display")!="none")return!1;this.element.css("display","block");this.model.hide=!1},_init:function(){this.model.targetID!=null&&this.element.html(n("#"+this.model.targetID).find("ul,ol"));this._cloneElement=n(this.element).clone();this._localDataSource=null;this.model.dataSource!=null?this._generateTemplate():this.model.Items!=null&&this._generateTemplate();this.model.dataSource instanceof t.DataManager||this._initialize();this._renderTooltip(this.model.tooltipSettings)},_setModel:function(t){for(var i in t)switch(i){case"height":this._setHeight(t[i]);break;case"width":this.model.width=t[i];this._setWidth();this._bindUnbindWidth();break;case"enabled":this._controlStatus(t[i]);break;case"disabledItemIndices":this._disableItemByIndex(t[i]);t[i]=this.model.disabledItemIndices;break;case"enabledItemIndices":this._enableItemByIndex(t[i]);break;case"isResponsive":this.model.isResponsive=t[i];this.model.isResponsive?(this._responsiveLayout(),this._renderTooltip(this.model.tooltipSettings)):this._removeResponsive();break;case"hide":this._controlVisibleOptions(t[i]);break;case"orientation":this._setOrientation(t[i]);this.model.orientation=t[i];this._wireResizing();break;case"tooltipSettings":this.model.tooltipSettings=n.extend(!0,this.model.tooltipSettings,t[i]);this._renderTooltip(this.model.tooltipSettings);break;case"enableRTL":this._enableRTL(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"cssClass":this._setSkin(t[i]);break;case"htmlAttributes":this._addAttr(t[i]);break;case"enableSeparator":this.model.enableSeparator=t[i];this._renderToolbarSeparator();break;case"fields":n.extend(this.model.fields,t[i]);break;case"query":this.model.query=t[i];break;case"dataSource":for(optio in t)optio=="fields"&&n.extend(this.model.fields,t[optio]),optio=="query"&&(this.model.query=t[optio]);this._refreshTagItems(i,t[i]);break;case"Items":n.extend(this.model.Items,t[i]);this._refreshTagItems(i,t[i]);break;case"targetID":this.model.targetID=t[i];this._setTargetID()}},_setTargetID:function(){this.element.removeAttr("role tabindex aria-disabled style");n(this._spantag).remove();n(this._liTemplte).remove();this._liTemplte=this._tipRes=null;this.element.removeClass("e-widget e-box e-toolbarspan e-rtl");this.element.find("ul,ol").removeClass("e-ul e-horizontal e-vertical e-separator e-comnrtl");this.element.find("li").removeClass("e-tooltxt e-comnrtl");this.element.find("li").removeAttr("aria-label");this._init()},_refreshTagItems:function(n,t){this.model[n]=t;this.element.empty();this._generateTemplate();this._initialize()},_setHeight:function(n){this.element.css("height",n)},_setWidth:function(){var t,u;if(this.model.width=="auto"){var r=parseFloat(this.element.css("border-left-width"))+parseFloat(this.element.css("border-right-width")),f=this.element.find("ul").children("li"),i=this.element.find("ul"),e;for(e=this.model.responsiveType=="inline"?this.element.find(".e-arrow-sans-down"):this.element.find(".e-toolbar-res-arrow"),t=0,u=i.length;t<u;t++)i[t]!=null&&n(i[t]).hasClass("e-separator")&&(r+=parseFloat(i.eq(t).css("border-right-width"))+parseFloat(i.eq(t).css("border-left-width")));for(e[0]!=null&&(r+=this.model.responsiveType=="inline"?Math.round(this.element.find(".e-arrow-sans-down").outerWidth())+8:Math.round(this.element.find(".e-toolbar-res-arrow").outerWidth())+8),t=0,u=f.length;t<u;t++)f[t]!=null&&(r+=Math.round(f.eq(t).outerWidth()));this.element.css("width",Math.ceil(r))}else this.element.css("width",this.model.width)},_bindUnbindWidth:function(){this.model.width!="auto"?this._off(n(window),"resize",this._widthHandler):this._on(n(window),"resize",this._widthHandler)},_widthHandler:function(){this._setWidth(this.model.width)},_setOrientation:function(n){n!=t.Orientation.Vertical?(this.element.removeClass(this.model.cssClass).addClass("e-toolbarspan "+this.model.cssClass),this.itemsContainer.removeClass("e-ul e-vertical").addClass("e-ul e-horizontal")):(this.element.removeClass("e-toolbarspan "+this.model.cssClass).addClass(this.model.cssClass),this.itemsContainer.removeClass("e-ul e-horizontal").addClass("e-ul e-vertical"));this.items.addClass("e-tooltxt")},_reSizeHandler:function(){this._isResized&&this._liTemplte.children().length>0&&(n(this._liTemplte.children()).insertBefore(n(this.element).find("span.e-res-pos")),this._renderToolbarSeparator(),this.model.responsiveType!="inline"&&this._liTemplte.addClass("e-display-none"),this._contstatus=!1);this._elementWidth=typeof getComputedStyle=="function"?parseFloat(window.getComputedStyle(this.element[0]).width):this.element.width()-1;this._liWidth=this._spanWidth;this._spantag.removeClass("e-display-block").addClass("e-display-none");for(var t=0;t<this.itemsContainer.length;t++)this._liWidth+=n(this.itemsContainer[t]).outerWidth(!0)+8,this._liWidth>this._elementWidth&&(this._spantag.hasClass("e-display-block")||this._spantag.removeClass("e-display-none").addClass("e-display-block"),this._spantag.addClass("e-res-pos"),this._liTemplte.addClass("e-normal"),this._liTemplte.append(this.itemsContainer[t]));this.model.responsiveType=="inline"&&(this._liTemplte.removeClass("e-normal"),this._liTemplte.css("width",this.element.width()));this._isResized=!0},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popup)},_getOffset:function(n){return t.util.getOffset(n)},_btnMouseClick:function(i){var u,f,r,h,o=1,l=this.element.outerWidth(),a=this.element.outerHeight(),s=n(this._liTemplte).outerWidth(),c=n(window).width(),e=n(window).scrollLeft();n(i.currentTarget).hasClass("e-disable")||(maxZ=this._getZindexPartial(),f=this._getOffset(this.element),r=this.model.enableRTL?f.left:f.left+l-s,h=f.top+a-o+2,r=r<e?e+o:r+s>c+e?c-s+e-o:r,this._contstatus?(this._liTemplte.addClass("e-display-none"),this.model.responsiveType=="inline"&&this._spantag.removeClass("e-active"),this._contstatus=!1,u={currentTarget:i.currentTarget,clientX:i.clientX,clientY:i.clientY,cancel:i.cancellable},this._trigger("overflowClose",u)):(this._liTemplte.removeClass("e-display-none"),this.model.responsiveType!="inline"&&this._liTemplte.css({top:h+"px",left:r+"px","z-index":maxZ}),this.model.responsiveType=="inline"&&this._spantag.addClass("e-active"),this._contstatus=!0,u={currentTarget:i.currentTarget,clientX:i.clientX,clientY:i.clientY,cancel:i.cancellable},this._trigger("overflowOpen",u),this.model.responsiveType!="inline"&&this._on(t.getScrollableParents(this.element),"scroll",this._hidecontext),this.element.bind("click",n.proxy(this._hidecontext,this))),this._contstatus&&this.model.responsiveType!="inline"&&this._on(n(document),"mouseup",this._documentClick),this._contstatus||this._off(n(document),"mouseup",this._documentClick),this._removeListHover())},_hidecontext:function(i){n(i.target).is(n("#"+this.element[0].id+"_target"))||this.model.responsiveType=="inline"||(this._liTemplte.addClass("e-display-none"),this._contstatus=!1,this.element.unbind("click",n.proxy(this._hidecontext,this)),this._off(t.getScrollableParents(this.element),"scroll",this._hidecontext),this._off(n(document),"mouseup",this._documentClick))},_documentClick:function(t){if(!n(t.target).is(n("#"+this.element[0].id+"_target"))&&!(n(t.target).closest("div#"+this.element[0].id+"_hiddenlist").length!=0||n(t.target).parents().hasClass("e-ddl-popup"))){this._liTemplte.addClass("e-display-none");this._contstatus=!1;var i={currentTarget:t.currentTarget,clientX:t.clientX,clientY:t.clientY,cancel:t.cancellable};this._trigger("overflowClose",i);this._off(n(document),"mouseup",this._documentClick)}},_setSkin:function(n){this.element.removeClass(this.model.cssClass).addClass(n);var t="e-toolbarTooltip "+n;this._subControlsSetModel("cssClass",t)},_subControlsSetModel:function(i,r){t.isNullOrUndefined(this._tipToolbar)||n(this.target).ejTooltip("option",i,r);t.isNullOrUndefined(this._tipRes)||n(this._liTemplte).ejTooltip("option",i,r)},_destroy:function(){this.element.html("");t.isNullOrUndefined(this._tipToolbar)||n(this.target).ejTooltip("destroy");t.isNullOrUndefined(this._tipRes)||n(this._liTemplte).ejTooltip("destroy");this._cloneElement.removeClass("e-toolbar e-js");this.element.replaceWith(this._cloneElement);this._liTemplte&&this._liTemplte.remove();this._unWireResizing()},_initialize:function(){this.element.attr({role:"toolbar",tabindex:"0"});var n=this.element.children().find("li");this._focusEnable=!0;this._renderControl();this._responsiveLayout();this._wireEvents()},_responsiveLayout:function(){if(this._roundedCorner(this.model.showRoundedCorner),this.model.isResponsive&&this.model.orientation=="horizontal"){t.isNullOrUndefined(this._liTemplte)||(t.isNullOrUndefined(this._tipRes)||this._tipRes.destroy(),n(this._liTemplte).remove());this._spantag=n("<span id='"+this.element[0].id+"_target' class='e-icon e-toolbar-res-arrow e-rel-position e-display-block' unselectable='on'><\/span>");this.model.responsiveType=="inline"&&this._spantag.removeClass("e-toolbar-res-arrow").addClass("e-inlinearrow e-arrow-sans-down");this._spantag.appendTo(this.element);this._liTemplte=n("<div id='"+this.element[0].id+"_hiddenlist' class='e-responsive-toolbar e-display-none e-abs-position "+n(this.element)[0].className+"'><\/div>");this.model.responsiveType=="inline"&&this._liTemplte.removeClass("e-abs-position").addClass("e-inline");this._spantag.appendTo(this.element);this._spanWidth=this._spantag.outerWidth(!0)+8;this.model.enableRTL&&this._liTemplte.addClass("e-rtl");this._isResized=!1;this._elementWidth=typeof getComputedStyle=="function"?parseFloat(window.getComputedStyle(this.element[0]).width):this.element.width()-1;this._liWidth=this._spanWidth;for(var i=0;i<this.itemsContainer.length;i++)this._liWidth+=n(this.itemsContainer[i]).outerWidth(!0);this._liWidth>this._elementWidth?this._reSizeHandler():this._spantag.removeClass("e-display-block").addClass("e-display-none");this.model.responsiveType=="inline"?n(this.element[0]).append(this._liTemplte):n("body").append(this._liTemplte);this._renderTooltip(this.model.tooltipSettings)}this._on(n("#"+this.element[0].id+"_target"),"mousedown",this._btnMouseClick);this._wireResizing();this._controlVisibleOptions(this.model.hide);this._enableRTL(this.model.enableRTL);this._disabledItems=this.model.disabledItemIndices;this._controlStatus(this.model.enabled);this.model.disabledItemIndices=this._disabledItems;this.model.disabledItemIndices.length!=0&&this._disableItemByIndex(this.model.disabledItemIndices);this.model.enabledItemIndices.length!=0&&this._enableItemByIndex(this.model.enabledItemIndices);this._setWidth()},_removeResponsive:function(){n(this._spantag).remove();t.isNullOrUndefined(this._tipRes)||n(this._liTemplte).ejTooltip("destroy");var i=n(this._liTemplte).children("ul");n(this._liTemplte).detach();n(this.element).append(i);this.itemsContainer=this.element.children("ol,ul");this.items=this.itemsContainer.children("li");this._off(this.items,"mouseup");this._off(this.items,"mousedown");this._off(this.element,"mousedown");this._wireEvents();this._wireResizing();this._setWidth()},_controlVisibleOptions:function(n){n!=!1?this.hide():this.show()},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_roundedCorner:function(n){n?(this.element.addClass("e-corner"),this._liTemplte&&this._liTemplte.addClass("e-corner")):(this.element.removeClass("e-corner"),this._liTemplte&&this._liTemplte.removeClass("e-corner"));this._subControlsSetModel("showRoundedCorner",n)},_generateTemplate:function(){var n=this,i;this.element.css("visibility","hidden");this.model.dataSource instanceof t.DataManager?(i=this.model.dataSource.executeQuery(this.model.query),i.done(function(t){n._generateGroup(t.result);n._initialize();n.element.css("visibility","")})):this.model.dataSource!=null?(n._generateGroup(n.model.dataSource),n.element.css("visibility","")):(n._generateGroup(n.model.Items),n.element.css("visibility",""))},_generateGroup:function(n){var r=this,f,u,t,e,i;for(this._localDataSource=n,f=-1,u=[],t=0;t<n.length;t++)if(this._isNewGroup(n[t][this.model.fields.group],u)){for(u[++f]=n[t][this.model.fields.group],e=-1,r.itemsSource=[],i=t;i<n.length;i++)n[t][this.model.fields.group]==n[i][this.model.fields.group]&&(r.itemsSource[++e]=n[i]);r.element.append(r._generateTagitems())}},_isNewGroup:function(n,t){if(!t)return!0;for(var i=0;i<t.length;i++)if(n==t[i])return!1;return!0},_renderControl:function(){this.element.addClass("e-widget e-box");this._renderToolbarItems();this._addAttr(this.model.htmlAttributes);this._setOrientation(this.model.orientation);this._renderToolbarSeparator();this._setHeight(this.model.height);this._bindUnbindWidth()},_renderToolbarItems:function(){this.target=this.element[0];this.itemsContainer=this.element.children("ol,ul");this.itemsContainer.children("ol,ul").remove();this.items=this.itemsContainer.children("li");for(var i=0;i<this.items.length;i++)t.isNullOrUndefined(n(this.items[i]).attr("title"))&&n(this.items[i]).attr("aria-label",this.items[i].id);this._liCount=this.items.length},_generateTagitems:function(){var i,n;for(i=this.itemsSource,this.ultag=t.buildTag("ul"),n=0;n<i.length;n++)this.ultag.append(this._generateLi(i[n]));return this.ultag},_generateLi:function(n){var i,u,r;return i=t.buildTag("li"),n[this.model.fields.id]?i.attr("id",n[this.model.fields.id]):n[this.model.fields.text]&&i.attr("id",n[this.model.fields.text]),n[this.model.fields.tooltipText]&&i.attr("title",n[this.model.fields.tooltipText]),n[this.model.fields.imageUrl]&&n[this.model.fields.imageUrl]!=""&&(u=t.buildTag("img.e-align","",{},{src:n[this.model.fields.imageUrl],alt:n[this.model.fields.text]}),n[this.model.fields.imageAttributes]&&this._setAttributes(n[this.model.fields.imageAttributes],u),i.append(u)),n[this.model.fields.spriteCssClass]&&n[this.model.fields.spriteCssClass]!=""&&(r=t.buildTag("div.e-align "+n[this.model.fields.spriteCssClass]+" e-spriteimg"),i.append(r)),n[this.model.fields.text]&&n[this.model.fields.text]!=""&&i.append(n[this.model.fields.text]),n[this.model.fields.htmlAttributes]&&this._setAttributes(n[this.model.fields.htmlAttributes],i),n[this.model.fields.template]&&(r=t.buildTag("div .e-align",n[this.model.fields.template]),i.append(r)),i},_setAttributes:function(t,i){for(var r in t)n(i).attr(r,t[r])},_renderToolbarSeparator:function(){var t,i;if(this.model.enableSeparator){for(t=0,i=this.itemsContainer.length-1;t<i;t++)n(this.itemsContainer[t]).addClass("e-separator");if(this.itemsContainer.length==1)for(t=0,i=this.itemsContainer[0].children.length;t<i;t++)t==i-1?n(this.itemsContainer[0].children[t]).removeClass("e-separator"):n(this.itemsContainer[0].children[t]).addClass("e-separator")}else this.itemsContainer.removeClass("e-separator").find(".e-separator").removeClass("e-separator");this._setWidth()},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?i.disable():i.element.attr(t,n)})},_enableRTL:function(n){n?(this.element.addClass("e-rtl"),this.items.addClass("e-comnrtl"),this.model.orientation==t.Orientation.Horizontal&&this.itemsContainer.addClass("e-comnrtl"),this._liTemplte&&this._liTemplte.addClass("e-rtl")):(this.element.removeClass("e-rtl"),this.items.removeClass("e-comnrtl"),this.model.orientation==t.Orientation.Horizontal&&this.itemsContainer.removeClass("e-comnrtl"),this._liTemplte&&this._liTemplte.removeClass("e-rtl"));this.model.enableRTL=n;this._subControlsSetModel("enableRTL",n);this._renderToolbarSeparator()},_renderTooltip:function(i){var r=n.extend(!0,{},i);r.cssClass=t.isNullOrUndefined(r.cssClass)?"e-toolbarTooltip "+this.model.cssClass:r.cssClass+" e-toolbarTooltip "+this.model.cssClass;r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.target="li[data-content], li[title]";r.beforeOpen=this._showTooltip;this._tipToolbar=n(this.target).ejTooltip(r).data("ejTooltip");this.model.isResponsive&&!t.isNullOrUndefined(this._liTemplte)&&(this._tipRes=n(this._liTemplte).ejTooltip(r).data("ejTooltip"))},_showTooltip:function(t){var i=n(t.event.currentTarget),r=t.event.target;i.hasClass("e-disable")&&(t.cancel=!0)},_hideTooltip:function(){t.isNullOrUndefined(this._tipToolbar)||(this._tipToolbar.hide(),this._tipToolbar._isHidden=!1);t.isNullOrUndefined(this._tipRes)||(this._tipRes.hide(),this._tipRes._isHidden=!1)},_addOverlay:function(i){for(var u,r=0;r<i.length;r++)n(i[r]).hasClass("e-disable")||(n(i[r]).addClass("e-disable"),u=t.buildTag("div.e-item-overlay"),n(i[r]).append(u))},_removeOverlay:function(t){for(var i=0;i<t.length;i++)n(t[i]).children(".e-item-overlay").remove()},disableItem:function(t){var i=n(t);i==null||i.length<=0||(i.hasClass("e-disable")||(i.attr("aria-disabled",!0).removeAttr("aria-label"),this._addOverlay(i)),i.removeClass("e-hover e-active").attr("aria-selected",!1))},enableItem:function(t){var i=n(t);i==null||i.length<=0||(i.removeClass("e-disable").attr("aria-disabled",!1).removeClass("e-disable"),this._removeOverlay(i))},disableItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.disableItem(t)},enableItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.enableItem(t)},_enableItemByIndex:function(t){var r,i;if(!this.model.enabled)return!1;if(t.length!=0)for(i=0;i<t.length;i++)n.inArray(t[i],this.model.disabledItemIndices)>-1&&(r=n.inArray(t[i],this.model.disabledItemIndices),this.enableItem(this.items[this.model.disabledItemIndices[r]]),this.model.disabledItemIndices.splice(r,1))},_disableItemByIndex:function(t){var i;if(!this.model.enabled)return!1;for(this._disabledItems=this.model.disabledItemIndices,i=0;i<t.length;i++)n.inArray(t[i],this.model.disabledItemIndices)<0&&this._disabledItems.push(parseInt(t[i]));for(i=0;i<this.items.length;i++)n.inArray(i,this.model.disabledItemIndices)>-1&&this.disableItem(this.items[i]);this.model.disabledItemIndices=this._disabledItems},disable:function(){if(this.element.attr("aria-disabled")=="true")return!1;this.element.attr("aria-disabled",!0).removeAttr("aria-label");this._addOverlay(this.items);this.model.isResponsive&&this.model.orientation=="horizontal"&&this._spantag.addClass("e-disable");this.model.enabled=!1;this._subControlsSetModel("enabled",!1)},enable:function(){if(this.model.disabledItemIndices=[],this.element.attr("aria-disabled")=="false")return!1;this.items.removeClass("e-disable");this._removeOverlay(this.items);this.element.attr("aria-disabled",!1);this.model.isResponsive&&this.model.orientation=="horizontal"&&this._spantag.removeClass("e-disable");this.model.enabled=!0;this._subControlsSetModel("enabled",!0)},selectItem:function(t){var i=n(t);i==null||i.length<=0||(i.addClass("e-active").attr("aria-selected",!0),this._activeItem=n(this.items).index(i))},deselectItem:function(t){var i=n(t);i==null||i.length<=0||i.removeClass("e-active").attr("aria-selected",!1)},selectItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.selectItem(t)},deselectItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.deselectItem(t)},removeItem:function(t){var r,u,i;if(this.model.disabledItemIndices=[],r=n(t),u=0,r!=null&&!(r.length<=0))for(r.remove(),this.items=this.itemsContainer.children("li"),i=0;i<this.items.length;i++)n(this.items[i]).hasClass("e-disable")&&(this.model.disabledItemIndices[u++]=i)},removeItemByID:function(n){var t=this.itemsContainer.find("li#"+n);t==null||t.length<=0||this.removeItem(t)},_wireResizing:function(){this.model.isResponsive&&this.model.orientation=="horizontal"?n(window).bind("resize",n.proxy(this._reSizeHandler,this)):this._unWireResizing()},_unWireResizing:function(){n(window).unbind("resize",n.proxy(this._reSizeHandler,this))},_wireEvents:function(){this._on(this.element,"mousedown",this._clickEventHandler);this._on(this.element,"focus",this._focusElement);this._on(this.element,"blur",this._targetBlur);this._on(this.items,"mouseenter",this._onItemHover);this._on(this.items,"mouseleave",this._onItemLeave);this._on(this.items,"mousedown",this._onItemClick);this._on(this.items,"mouseup",this._onItemClick)},_onItemHover:function(t){var i=n(t.currentTarget),r=t.target;i.hasClass("e-disable")||(this.items.removeClass("e-hover"),i.addClass("e-hover"),args={currentTarget:i,target:r,status:this.model.enabled},this._trigger("itemHover",args))},_onItemClick:function(t){if(n(t.currentTarget).hasClass("e-disable")||t.which!=1)return!1;var i=t.currentTarget,r=t.target;this._hideTooltip();t.type=="mousedown"?(this._focusEnable=!1,n(i).addClass("e-active"),this._focusedItem=this._currentItem=n(i)):t.type=="mouseup"&&(this._removeSelection(),n(i).hasClass("e-disable")||(args={currentTarget:i,text:n(i).attr("data-content"),target:r,status:this.model.enabled,event:t},this._activeItem=this.model.isResponsive&&this._contstatus&&n(i).closest(".e-responsive-toolbar").length>0?this._liTemplte.find(".e-tooltxt").index(i):n(this.items).index(i),this._trigger("click",args)))},_onItemLeave:function(t){var i=n(t.currentTarget),r=t.target;i.hasClass("e-disable")||(this._removeSelection(),i.removeClass("e-hover"),args={currentTarget:i,target:r,status:this.model.enabled},this._trigger("itemLeave",args))},_onKeyPress:function(i){var u,r,f,e;if(u=i.keyCode?i.keyCode:i.which?i.which:i.charCode,this.model.isResponsive&&this._liTemplte.find(".e-tooltxt").length>0?(this._keyPressed=!0,this._items=this._contstatus?this._liTemplte.find(".e-tooltxt"):this.element.find(".e-tooltxt"),r=this._items.filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)")):(this._keyPressed=!1,r=this.items.filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)")),this._focusedItem?(f=this._focusedItem,this._focusedItem=null):f=r.filter(".e-hover"),i.type=="keydown")(u==38||u==39)&&this.model.orientation!=t.Orientation.Vertical||(u==39||u==40)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),e=n(r[r.index(f)+1]).length>0?n(r[r.index(f)+1]):r.first()):(u==37||u==40)&&this.model.orientation!=t.Orientation.Vertical||(u==37||u==38)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),e=n(r[r.index(f)-1]).length>0?n(r[r.index(f)-1]):r.last()):u==33||u==36?(i.preventDefault(),e=r.first()):(u==34||u==35)&&(i.preventDefault(),e=r.last()),e&&(this._removeListHover(),e.addClass("e-hover"));else switch(u){case 13:case 32:if(i.preventDefault(),!f[0])break;args={currentTarget:f[0],target:n(f)[0],status:this.model.enabled,event:i};this._trigger("click",args);this._removeListHover();break;case 27:i.preventDefault();this.element.blur();break;case 9:i.preventDefault();this._activeItem=n(this.items).filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)").first().index();this._addListHover()}},_removeListHover:function(){n(this.items).removeClass("e-hover")},_addListHover:function(){var n=this._getActiveItem();n.hasClass("e-disable")||n.addClass("e-hover").focus()},_getActiveItem:function(){return this.model.isResponsive&&this._keyPressed?n(this._items[this._activeItem]):n(this.items[this._activeItem])},_targetBlur:function(n){n.preventDefault();this.element.focusout().removeClass("e-focus");this._removeListHover();this._off(this.element,"keyup",this._onKeyPress)._off(this.element,"keydown",this._onKeyPress);this._trigger("focusOut")},_clickEventHandler:function(){this._clicked=!0},_removeSelection:function(){this._currentItem&&this._currentItem.attr("aria-selected")!="true"&&this._currentItem.removeClass("e-active")},_focusElement:function(){if(!this.element.hasClass("e-focus")&&(this.element.addClass("e-focus"),this._on(this.element,"keyup",this._onKeyPress)._on(this.element,"keydown",this._onKeyPress),!this._focusEnable)){this._focusEnable=!0;return}this._removeListHover();this._activeItem=this._clicked?-1:0;(this._getActiveItem().hasClass("e-disable")||this._getActiveItem().is(":hidden"))&&(this._activeItem=n(this.items).filter('li:not([class*="e-disable"])').first().index());this._addListHover()}});t.Toolbar.ResponsiveType={Popup:"popup",Inline:"inline"}}(jQuery,Syncfusion),function(n,t){t.widget("ejAccordion","ej.Accordion",{_rootCSS:"e-acrdn",element:null,model:null,validTags:["div","span"],_addToPersist:["selectedItemIndex","selectedItems"],_setFirst:!1,angular:{terminal:!1},defaults:{collapsible:!1,ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},events:"click",customIcon:{header:"e-plus",selectedHeader:"e-minus"},heightAdjustMode:"content",height:null,width:null,headerSize:null,enableAnimation:!0,selectedItemIndex:0,cssClass:"",enableRTL:!1,showCloseButton:!1,showRoundedCorner:!1,allowKeyboardNavigation:!0,enableMultipleOpen:!1,expandSpeed:"300",collapseSpeed:"300",selectedItems:[],disabledItems:[],enabledItems:[],enablePersistence:!1,enabled:!0,htmlAttributes:{},ajaxLoad:null,ajaxBeforeLoad:null,activate:null,beforeActivate:null,inActivate:null,beforeInactivate:null,ajaxSuccess:null,ajaxError:null,create:null,destroy:null},dataTypes:{cssClass:"string",collapsible:"boolean",enabled:"boolean",events:"string",heightAdjustMode:"enum",ajaxSettings:"data",customIcon:"data",selectedItems:"array",disabledItems:"array",enabledItems:"array",enableAnimation:"boolean",htmlAttributes:"data"},_setModel:function(t){var i,r,e,s,u,o,f;for(i in t)switch(i){case"events":this._off(this._headers,this.model.events);this._on(this._headers,t[i],this._headerEventHandler);break;case"disabledItems":this.disableItems(t[i]);break;case"enabledItems":this.enableItems(t[i]);break;case"enabled":this._enabledAction(t[i]);break;case"selectedItemIndex":n(this._contentPanels[t[i]]).hasClass("e-disable")||t[i]>this._headers.length||this.model.enableMultipleOpen?t[i]=this.model.selectedItemIndex:(this._isInteraction=!0,this.model.enableMultipleOpen||this._activeTab(t[i],!1,!0),this._isInteraction=!1);break;case"heightAdjustMode":this._setHeightStyle(t[i]);break;case"cssClass":this._changeSkin(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"customIcon":r=this.model.customIcon;e=t[i];this._headers.find("span."+r.header).removeClass(r.header).addClass(e.header);this._headers.find("span."+r.selectedHeader).removeClass(r.selectedHeader).addClass(e.selectedHeader);break;case"height":this.element.height(t[i]);this.model.height=t[i];this.model.heightAdjustMode!="fill"?this._getHeight()>this.element.height()&&(this._scrollerObj?this._scrollerObj.option({height:this.element.height()}):this._setScoller()):this._setHeight();break;case"width":if(this.element.width(t[i]),this._scrollerObj&&this._scrollerObj.option("width",t[i]),t[i].toString().indexOf("%"))n(window).on("resize",n.proxy(this._scrollerRefresh,this));else n(window).off("resize",n.proxy(this._scrollerRefresh,this));this._scrollerObj&&this._scrollerObj.refresh();break;case"headerSize":this.model.headerSize=t[i];this._setHeaderSize();break;case"showCloseButton":this.model.showCloseButton=t[i];this._addDeleteIcon();break;case"allowKeyboardNavigation":t[i]?(this._off(this.element,"keydown"),this._on(this.element,"keydown",this._keyPress)):this._off(this.element,"keydown");break;case"enableRTL":t[i]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this._scrollerObj&&this._scrollerObj.option("enableRTL",t[i]);break;case"selectedItems":this._showHideSelectedItems(t[i]);t[i]=this.model.selectedItems;break;case"expandSpeed":this.model.expandSpeed=t[i];break;case"collapseSpeed":this.model.collapseSpeed=t[i];break;case"htmlAttributes":this._addAttr(t[i]);break;case"enableMultipleOpen":if(this.model.enableMultipleOpen=t[i],this.model.selectedItems.length<=0)s=n.extend(!0,[],this.model.enabledItems),this._activeTab(this.model.enabledItems[0]);else if(this.model.selectedItemIndex>0&&this.model.selectedItemIndex<=this._headers.length)for(u=n.extend(!0,[],this.model.selectedItems),u.sort(function(n,t){return n-t}),this.model.selectedItemIndex=u[0],o=u,f=1;f<o.length;f++)this._hideTab(o[f])}},_destroy:function(){this._removeBaseClass();this.element.children(".e-disable").removeClass("e-disable");this.element.removeClass("e-acrdn e-corner e-widget");this._headers.removeClass("e-active e-state-disabled");this._contentPanels.removeClass("e-content-active e-disable e-acrdn-content-active");n(this._headers.find(".e-icon")).remove();this.model.height&&this._contentPanels.height("auto");this.model.width&&this._contentPanels.width("auto");this._scrollerObj&&this._scrollerObj.destroy();this._unWireEvents()},_init:function(){this._renderControl();this._prevSize=this._getDimension(n(this.element).parent(),"height")},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&(n=="disabled"||n=="true")?i.disable():i.element.attr(t,n)})},_renderControl:function(){this._headers=this.element.find("> :even");this.element.attr("tabindex",0).attr("role","tablist");this._contentPanels=this._headers.next();this._nagativeIndexCheck(this.model.selectedItemIndex);this._addBaseClass();this._addAttr(this.model.htmlAttributes);t.buildTag("span.e-icon "+this.model.customIcon.header).prependTo(this._headers);this.model.showCloseButton&&this._addDeleteIcon();this._setHeightStyle(this.model.heightAdjustMode);this.model.height&&this.element.css("height",this.model.height);this.model.width&&this.element.css("width",this.model.width);this.model.enableMultipleOpen||this._renderHeaderIcon();t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize();this._wireEvents();this._roundedCorner(this.model.showRoundedCorner);this.model.enabled||this._enabledAction(this.model.enabled);this._selectedItemsAction(this.model.enableMultipleOpen?this.model.selectedItems:this.model.selectedItemIndex);this._disableItems(this.model.disabledItems);this._setEnabledItems()},_setHeight:function(){var t=this,r=0,u=0,i;this.element.css("height",this.model.height);maxHeight=this.element.height();this._contentPanels.css("height","auto");this._scrollerObj&&this._scrollerObj.option("height",this.element.height());this._headers.each(function(i){maxHeight-=n(this).outerHeight();r+=n(this).outerHeight();n(t._contentPanels[i]).hasClass("e-acrdn-content-active")&&(u+=n(t._contentPanels[i]).outerHeight())});maxPadding=0;i=this.element.height()-(u+r);i>0?this._contentPanels.each(function(){n(this).height(n(this).height()+i/t.element.find(".e-select.e-active").length)}):this._setScoller();this._scrollerObj&&this._scrollerObj.refresh()},_setScoller:function(){if(this.element.parent(".e-acrdn-scroller.e-scroller").length<1){this.scroller=t.buildTag("div.e-acrdn-scroller");this.element.wrap(this.scroller);var n=this.element.css("width");this.element.parent(".e-acrdn-scroller").ejScroller({height:this.element.height(),width:this.model.width});this.element.css("width",n);this._scrollerObj=this.element.parent(".e-js").data("ejScroller");this.model.showRoundedCorner&&this.element.parent(".e-acrdn-scroller").addClass("e-corner");this.model.enableRTL&&this._scrollerObj.option("enableRTL",!0)}},_setHeaderSize:function(){var t=this;this._headers.each(function(){n(this).css({"padding-top":0,"padding-bottom":0});n(this).css("height",t.model.headerSize);var i=typeof t.model.headerSize=="string"&&t.model.headerSize.indexOf("px")!=-1?t.model.headerSize:t.model.headerSize+"px";n(n(this).find("a[href]")).css("line-height",i);n(this).find(".e-icon").length>0&&n(this).find(".e-icon").css("margin-top",n(this).height()/2-5)});this.model.height&&(this.model.heightAdjustMode!="fill"?this._getHeight()>this.element.height()&&(this._scrollerObj?this._scrollerObj.refresh():this._setScoller()):this._setHeight(),this._scrollerObj&&this._scrollerObj.refresh())},_addDeleteIcon:function(){this.model.showCloseButton?(this.getItemsCount()>0&&this._headers.append(this._createDeleteIcon()),this._on(this._headers.children("div.e-close"),"click",this._panelDeleteClick)):(this._headers.children("div.e-close").remove(),this._off(this._headers.children("div.e-close"),"click",this._panelDeleteClick))},_createDeleteIcon:function(){return t.buildTag("div.e-icon e-close")},_getHeight:function(){var t=0,i=0,r=this;return this._headers.each(function(u){t+=n(this).outerHeight();n(r._contentPanels[u]).hasClass("e-acrdn-content-active")&&(i+=n(r._contentPanels[u]).outerHeight())}),t+i},_setEnabledItems:function(){for(var t=0;t<this.getItemsCount();t++)n.inArray(t,this.model.disabledItems)<0&&n.inArray(t,this.model.enabledItems)<0&&this.model.enabledItems.push(t)},_changeSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},_panelDeleteClick:function(t){var i,r;this.model.enabled&&(i=n(t.target),i.hasClass("e-close")&&(r=n(this._headers).index(n(t.target).parent())),this.removeItem(r))},_showHideSelectedItems:function(n){var r,i,t;if(this.model.enableMultipleOpen&&n instanceof Array){for(t=0;t<n.length;t++)n[t]>=0&&n[t]<this._headers.length&&this.model.selectedItems.indexOf(n[t])==-1&&this._activeTab(n[t],!0);for(r=this.model.selectedItems.length,i=JSON.parse(JSON.stringify(this.model.selectedItems)),t=0;t<r;t++)n.indexOf(i[t])==-1&&this._hideTab(i[t])}},_selectedItemsAction:function(n){if(this.model.enableMultipleOpen&&n instanceof Array&&n.length>0)for(var t=0;t<n.length;t++)n[t]>=0&&this._activeTab(n[t],!0);else!(this.collapseALL&&this.model.collapsible)&&this.model.selectedItemIndex>=0&&this._activeTab(this.model.selectedItemIndex,!0)},_enabledAction:function(n){n?this.enable():this.disable()},_addBaseClass:function(){this.element.addClass(this.model.cssClass+" e-widget");this.model.enableRTL&&this.element.addClass("e-rtl");this._headers.addClass(" e-select").attr("role","tab").attr("tabindex",0);this._contentPanels.addClass("e-content").attr("role","tabpanel").attr("aria-hidden",!0).hide();this.model.enableMultipleOpen||n(this._contentPanels[this.model.selectedItemIndex]).show()},_removeBaseClass:function(){this._headers.removeClass(" e-select");this._contentPanels.removeClass("e-content").show()},_roundedCorner:function(n){n?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_nagativeIndexCheck:function(n){var i,t;if(n<0&&this.model.collapsible)for(this.collapseALL=!0,i=this.getItemsCount(),t=0;t<i;t++)this._hideTab(t);else(n<0||n>=this._headers.length)&&(this.model.selectedItemIndex=0)},collapsePanel:function(n){this._expandcollapsepanel(!1,n)},expandPanel:function(n){this._expandcollapsepanel(!0,n)},_expandcollapsepanel:function(t,i){proxy=this;i instanceof Array?n.each(i,function(n,i){proxy._activehideIndex(t,i)}):typeof i=="number"&&proxy._activehideIndex(t,i)},_activehideIndex:function(n,t){t>=0&&t<=proxy._headers.length&&(n?this._activeTab(t,!1,!0):(this._hideTab(t,!1,!0),this._deleteSelectedItems(t),this.model.selectedItemIndex==t&&(this.model.selectedItemIndex=null)))},_activeTab:function(i,r,u){var e,o,f;if(n.inArray(i,this.model.disabledItems)<0){if(e={activeIndex:i,isInteraction:!u},!0===(!r&&this._trigger("beforeActivate",e)))return!1;this.model.enableMultipleOpen||this._hideTab(this.model.selectedItemIndex,r,u);this.model.selectedItemIndex=i;t.isNullOrUndefined(this.model.selectedItemIndex)||(o=this.model.customIcon,this._headers.attr("tabindex",0).removeAttr("aria-expanded"),this._activeHeader=this._headers.eq(i).addClass("e-active ").attr("aria-selected",!0).attr("tabindex",0).attr("aria-expanded",!0),this._activeHeader.find("span.e-icon").removeClass(o.header).addClass(o.selectedHeader),this._addSelectedItems(i),this._ajaxLoad(),this._roundedCorner(this.model.showRoundedCorner),e={activeHeader:this._activeHeader,activeIndex:this.model.selectedItemIndex,isInteraction:!u},f=this,this._activeHeader.next().addClass("e-acrdn-content-active").removeAttr("aria-hidden",!1),this._paneAdjustSize(),this._activeContent=this._activeHeader.next().slideDown(this.model.enableAnimation?this._validateSpeed(this.model.expandSpeed):0,function(){r||f._trigger("activate",e);f.model.height&&(f.model.heightAdjustMode!="fill"?f._getHeight()>f.element.height()&&(f._scrollerObj?f._scrollerObj.refresh():f._setScoller()):f._setHeight(),f._scrollerObj&&f._scrollerObj.refresh())}))}},_paneAdjustSize:function(){var i=this,t;this.model.heightAdjustMode==="fill"&&this.model.enableMultipleOpen&&(maxHeight=this._getDimension(n(this.element).parent(),"height"),n(this.element).parent().css({overflow:"auto"}),this._headers.each(function(){maxHeight-=i._getDimension(n(this),"outerHeight")}),t=0,t=Math.max(t,i._getDimension(n(this._activeHeader.next()),"outerHeight")-i._getDimension(n(this._activeHeader.next()),"height")),maxHeight=maxHeight/this.model.selectedItems.length-t,this._headers.next().animate({height:maxHeight},300))},_validateSpeed:function(t){return t&&(t=n.trim(t.toString().toLowerCase()))&&(t=="fast"||t=="slow")?t:Number(t)},_hideTab:function(n,t,i){var f=this.model.customIcon,u,r;if(n>=0){if(u={inActiveIndex:n,isInteraction:!i},!0===(!t&&this._trigger("beforeInactivate",u)))return!1;this._activeHeader=this._headers.eq(n).removeClass("e-active ").removeAttr("aria-selected").attr("tabindex",0).attr("aria-expanded",!1);this._activeHeader.find("span.e-icon").removeClass(f.selectedHeader).addClass(f.header);u={inActiveHeader:this._activeHeader,inActiveIndex:n,isInteraction:!i};r=this;r.raiseEvent=t;this._activeHeader.next().removeClass("e-acrdn-content-active").attr("aria-hidden",!0).slideUp(this.model.enableAnimation?this._validateSpeed(this.model.collapseSpeed):0,function(){r.raiseEvent||r._trigger("inActivate",u);r.model.height&&(r.model.heightAdjustMode!="fill"?r._getHeight()>r.element.height()&&(r._scrollerObj?r._scrollerObj.refresh():r._setScoller()):r._setHeight());r._scrollerObj&&r._scrollerObj.refresh();r._paneAdjustSize()});this._deleteSelectedItems(n)}},_renderHeaderIcon:function(){if(this._headers.find(".e-icon").length<=0){var n=this.model.customIcon;n&&(this.collapseALL&&this.model.collapsible||this._headers.eq(this.model.selectedItemIndex).find("span.e-icon").removeClass(n.header).addClass(n.selectedHeader))}},_ajaxLoad:function(){var t=this._activeHeader.find("a[href]"),r,i;t.length>0&&(r=n(this._contentPanels[this.model.selectedItemIndex]),i=n(t).attr("href"),i&&i!=="#"&&this._sendAjaxOptions(r,t[0]))},_sendAjaxOptions:function(t,i){if(!0===this._trigger("ajaxBeforeLoad",{url:i}))return!1;t.addClass("e-load");var r=this,u=n(i).html(),f=i.href.replace("#",""),e={type:this.model.ajaxSettings.type,cache:this.model.ajaxSettings.cache,url:f,data:this.model.ajaxSettings.data,dataType:this.model.ajaxSettings.dataType,contentType:this.model.ajaxSettings.contentType,async:this.model.ajaxSettings.async,success:function(n){try{r._ajaxSuccessHandler(n,t,i,u)}catch(f){}},error:function(){try{r._ajaxErrorHandler(data,i,r.model.selectedItemIndex,u)}catch(n){}}};this._sendAjaxRequest(e)},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_ajaxSuccessHandler:function(t,i,r,u){u!=null&&n(r).html(u);i.removeClass("e-load");i.html(t).addClass("e-acrdn-loaded");var f={data:t,url:r,content:i};this._trigger("ajaxSuccess",f);this._trigger("ajaxLoad",{url:r})},_ajaxErrorHandler:function(n,t){this._trigger("ajaxError",{data:n,url:t});this._trigger("ajaxLoad",{url:t})},_setHeightStyle:function(i){var u=this,r,f;t.Accordion.HeightAdjustMode.Fill==i?this.model.height!=null?this._setHeight():(r=this._getDimension(n(this.element).parent(),"height"),n(this.element).parent().css({overflow:"auto"}),u._headers.each(function(){r-=u._getDimension(n(this),"outerHeight")}),f=0,u._headers.next().each(function(){f=Math.max(f,u._getDimension(n(this),"outerHeight")-u._getDimension(n(this),"height"))}).height(r-f).css({overflow:"auto"})):t.Accordion.HeightAdjustMode.Auto==i&&(r=0,u._headers.next().each(function(){r=Math.max(r,u._getDimension(n(this),"outerHeight"))}).height(r),this.maxAutoHeight=r);t.Accordion.HeightAdjustMode.Fill!=i&&this.model.height&&this._getHeight()>this.element.height()&&this._setScoller()},_getDimension:function(t,i){var u,f=n(t).parents().addBack().filter(":hidden"),r={visibility:"hidden",display:"block"},e=[];return f.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];e.push(t)}),u=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),f.each(function(n){var i=e[n];for(var t in r)this.style[t]=i[t]}),u},_headerEventHandler:function(t){if(this.model.enabled){t.preventDefault();var r=n(t.currentTarget),i=this._headers.index(r);this.model.enableMultipleOpen&&this._headers.eq(i).hasClass("e-active")?this._hideTab(i):this.model.enableMultipleOpen&&this.model.collapsible?this._activeTab(i):this.model.selectedItemIndex==i&&this.model.collapsible?(this._hideTab(this.model.selectedItemIndex),this.model.selectedItemIndex=-1):this._headers.eq(i).hasClass("e-active")||this._activeTab(i)}},_addSelectedItems:function(t){var i=this.model.selectedItems;this._removeNullInArray(i);n.inArray(t,i)==-1&&this.model.selectedItems.push(t)},_deleteSelectedItems:function(t){var i=this.model.selectedItems;n.inArray(t,i)>-1&&(this.model.selectedItems.splice(n.inArray(t,i),1),i.length==0&&i.push(-1))},_removeNullInArray:function(n){var t=n.indexOf(-1);t!=-1&&n.splice(t,1)},_deleteDisabledItems:function(t){n.inArray(t,this.model.disabledItems)>-1&&(position=n.inArray(t,this.model.disabledItems),this.model.disabledItems.splice(position,1))},_addEnabledItems:function(t){n.inArray(t,this.model.enabledItems)<0&&this.model.enabledItems.push(t)},_deleteEnabledItems:function(t){n.inArray(t,this.model.enabledItems)>-1&&(position=n.inArray(t,this.model.enabledItems),this.model.enabledItems.splice(position,1))},_keyPress:function(i){if(this.model.enabled){var r,u,f=n(i.target);if((f.hasClass("e-select")||f.hasClass("e-acrdn"))&&(r=this.model.selectedItemIndex),code=i.keyCode?i.keyCode:i.which?i.which:i.charCode,f.hasClass("e-select")||f.hasClass("e-acrdn"))switch(code){case 39:case 40:i.preventDefault();r=r==this.getItemsCount()-1?0:r+1;this._activeTab(r);u=n(this._headers[r]);break;case 38:case 37:i.preventDefault();r=r==0?this.getItemsCount()-1:r-1;this._activeTab(r);u=n(this._headers[r]);break;case 35:i.preventDefault();u=n(this._headers[this.getItemsCount()-1]);this._activeTab(this.getItemsCount()-1);break;case 36:i.preventDefault();u=n(this._headers[0]);this._activeTab(0);break;case 32:case 13:i.preventDefault();n(this._headers[r]).hasClass("e-active")&&(this.model.enableMultipleOpen||this.model.collapsible)?this._hideTab(r):this._activeTab(r)}else if(i.ctrlKey&&!f.hasClass("e-acrdn"))switch(code){case 38:i.preventDefault();r=this._contentPanels.index(f.parent(".e-content"));u=n(this._headers[r]);this._activeTab(r);break;case 33:i.preventDefault();u=n(this._headers[0]);this._activeTab(0);break;case 34:i.preventDefault();u=n(this._headers[this.getItemsCount()-1]);this._activeTab(this.getItemsCount()-1)}t.isNullOrUndefined(u)||(u.addClass("e-focus"),u.focus())}},_wireEvents:function(){this._on(this._headers,this.model.events,this._headerEventHandler);this.model.allowKeyboardNavigation&&this._on(this.element,"keydown",this._keyPress);n(window).on("resize",n.proxy(this._contentPaneSize,this));if(this.model.height&&this.model.width&&this.model.width.toString().indexOf("%")!=-1)n(window).on("resize",n.proxy(this._scrollerRefresh,this))},_scrollerRefresh:function(){this.model.height&&(this.model.heightAdjustMode!="fill"?this._getHeight()>this.model.height&&(this._scrollerObj?this._scrollerObj.refresh():this._setScoller()):this._setHeight())},_unWireEvents:function(){this._off(this._headers,this.model.events);n(window).off("resize",n.proxy(this._contentPaneSize,this));n(window).off("resize",n.proxy(this._scrollerRefresh,this));this.model.allowKeyboardNavigation&&this._off(this.element,"keydown")},_contentPaneSize:function(){var i=this._getDimension(n(this.element).parent(),"height");this._prevSize!=i&&(t.Accordion.HeightAdjustMode.Fill==this.model.heightAdjustMode&&(this.model.enableMultipleOpen?this._paneAdjustSize():this._setHeightStyle(this.model.heightAdjustMode)),this._prevSize=i)},_disableItems:function(t){var i,r,u;if(n.isArray(t))for(i=0;i<t.length;i++)n(this._headers[t[i]]).addClass("e-disable"),n(this._contentPanels[t[i]]).addClass("e-disable"),n(this._headers[t[i]]).off(this.model.events),this.model.disabledItems.indexOf(t[i])==-1&&this.model.disabledItems.push(t[i]),this._hideTab(t[i],!0),this._deleteEnabledItems(t[i]);else n(this._headers[t]).addClass("e-disable"),n(this._contentPanels[t]).addClass("e-disable"),n(this._headers[t]).off(this.model.events),n(this.model.disabledItems).index(t[i])==-1&&this.model.disabledItems!=t&&this.model.disabledItems.push(t),this._hideTab(t,!0),this._deleteEnabledItems(t[i]);if(!this.model.enableMultipleOpen){for(u=this.model.selectedItemIndex,i=0;i<this.model.disabledItems.length;i++)r=this.model.selectedItemIndex,n.inArray(r,this.model.disabledItems)>=0&&(r++,this.model.selectedItemIndex=r);if(r==this._headers.length)for(r=r-1,i=0;i<this.model.disabledItems.length;i++)n.inArray(r,this.model.disabledItems)>=0&&(r--,this.model.selectedItemIndex=r);u!==this.model.selectedItemIndex&&this._selectedItemsAction(r)}},enableItems:function(t){if(!this.model.enabled)return!1;if(n.isArray(t))for(var i=0;i<t.length;i++)n(this._headers[t[i]]).removeClass("e-disable"),n(this._contentPanels[t[i]]).removeClass("e-disable"),this._on(n(this._headers[t[i]]),this.model.events,this._headerEventHandler),this.model.enabledItems.indexOf(t[i])==-1&&this.model.enabledItems.push(t[i]),this._deleteDisabledItems(t[i]);else n(this._headers[t]).removeClass("e-disable"),n(this._contentPanels[t]).removeClass("e-disable"),this._on(n(this._headers[t]),this.model.events,this._headerEventHandler),this.model.enabledItems.indexOf(t[i])==-1&&this.model.enabledItems.push(t[i]),this._deleteDisabledItems(t)},disableItems:function(n){if(!this.model.enabled)return!1;this._disableItems(n)},addItem:function(i,r,u,f){var h,c,o,e,a,l,s;if(t.isNullOrUndefined(f)&&(f=!1),t.isNullOrUndefined(u)||u>this._headers.length)this._addItemIndex=this._headers.length;else if(u>=0&&u<=this._headers.length)this._addItemIndex=u;else return!1;for(c=this.model.enableAnimation,c&&(this.model.enableAnimation=!1),this.model.heightAdjustMode=="fill"&&this._headers.next().height("auto"),o=0;o<this.model.disabledItems.length;o++)this.model.disabledItems[o]>=this._addItemIndex&&this.model.disabledItems[o]++;if(e=t.buildTag("h3").addClass("e-select").attr("role","tab").attr("tabindex",0),this._addItemIndex==0?e.insertBefore(n(this._headers[this._addItemIndex])):e.insertAfter(n(this._headers[this._addItemIndex-1]).next()),this._addItemIndex<=this.model.selectedItemIndex&&(this.model.selectedItemIndex+=1),this._headers.length||(this._headers=e,this.element.append(this._headers),this.model.selectedItemIndex=0),a=t.buildTag("a").attr("href",f?r:"#").text(i),a.appendTo(e),f&&(r=""),h=n(r).length>0?n(r):t.buildTag("div").text(r),h.addClass("e-content").attr("role","tabpanel").attr("aria-hidden",!0).hide(),h.insertAfter(e),this._headers=this.element.find("> :even"),this._contentPanels=this._headers.next(),t.buildTag("span.e-icon "+this.model.customIcon.header).prependTo(e),this.model.showCloseButton&&(l=this._createDeleteIcon(),e.append(l),this._on(l,"click",this._panelDeleteClick)),this.model.enableMultipleOpen){for(this.model.selectedItems=[],s=0;s<this._headers.length;s++)n(this._headers[s]).hasClass("e-active")&&this.model.selectedItems.push(s);this._selectedItemsAction(this.model.selectedItems)}else this.model.selectedItems=[],this.model.selectedItems.push(this.model.selectedItemIndex),this._selectedItemsAction(this.model.selectedItems);this.model.width=this.model.width||this.element.css("width");this.model.height&&this.element.css("height",this.model.height);this.model.enableRTL&&(e.addClass("e-rtl"),h.addClass("e-rtl"));this.model.enableMultipleOpen||this._renderHeaderIcon();t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize();this._on(e,this.model.events,this._headerEventHandler);this._roundedCorner(this.model.showRoundedCorner);this.model.heightAdjustMode!="fill"||this.model.enableMultipleOpen||this._setHeightStyle(this.model.heightAdjustMode);this.disableItems(this.model.disabledItems);this._setEnabledItems();c&&(this.model.enableAnimation=!0)},removeItem:function(t){var u,f,i,r;if(!this.model.enabled)return!1;if(t!=null&&t>-1&&t<this._headers.length){for(u=this.model.enableAnimation,u&&(this.model.enableAnimation=!1),f=n(this._headers[t]).remove(),i=0;i<n(this.model.disabledItems).length;i++)this.model.disabledItems[i]>t?this.model.disabledItems[i]--:this.model.disabledItems[i]==t&&this.model.disabledItems.splice(i,1);if(n(this.element.find(">div.e-content")[t]).remove(),this._contentPanels.splice(t,1),this._headers.splice(t,1),this.model.enableMultipleOpen&&this.model.selectedItemIndex==t?this.model.selectedItemIndex=null:this.model.enableMultipleOpen||(t==this.model.selectedItemIndex&&this.model.collapsible?this.model.selectedItemIndex=null:t==0&&this.model.selectedItemIndex==0?this.model.selectedItemIndex=0:t<=this.model.selectedItemIndex&&(this.model.selectedItemIndex-=1)),this._unWireEvents(),this._wireEvents(),this.model.heightAdjustMode!="fill"||this.model.enableMultipleOpen||this._setHeightStyle(this.model.heightAdjustMode),this.model.enableMultipleOpen){for(this.model.selectedItems=[],r=0;r<this._headers.length;r++)n(this._headers[r]).hasClass("e-active")&&this.model.selectedItems.push(r);this._selectedItemsAction(this.model.selectedItems)}else this.model.selectedItems=[],this.model.selectedItems.push(this.model.selectedItemIndex),this._selectedItemsAction(this.model.selectedItems);this.disableItems(this.model.disabledItems);this._setEnabledItems();u&&(this.model.enableAnimation=!0)}},collapseAll:function(){if(this.model.enableMultipleOpen||this.model.collapsible){this.model.selectedItemIndex=null;for(var n=0;n<this.getItemsCount();n++)this._hideTab(n,!1,!0)}},expandAll:function(){if(this.model.enableMultipleOpen)for(var n=0;n<this.getItemsCount();n++)this._activeTab(n,!1,!0),this.model.selectedItemIndex=n},disable:function(){var t,i;for(this.model.enabled=!1,t=0;t<this._headers.length;t++)this._disableItems([t]);n(this.element.parent(".e-scroller")).addClass(".e-disable");this._scrollerObj&&(i=n(this.element.parent(".e-scroller")).find(".e-vscrollbar"),i.length>0&&this._scrollerObj.disable());this._unWireEvents()},enable:function(){this.model.enabled=!0;for(var n=0;n<this._headers.length;n++)this.enableItems([n]);this._scrollerObj&&this._scrollerObj.enable();this._unWireEvents();this._wireEvents()},refresh:function(){this._contentPaneSize()},_selected:function(n){if(!this.model.enabled)return!1;n!=null&&this.model.selectedItemIndex!=n&&this._activeTab(n)},show:function(){if(!this.model.enabled)return!1;this.element.css("visibility","visible")},hide:function(){if(!this.model.enabled)return!1;this.element.css("visibility","hidden")},getItemsCount:function(){if(this._headers)return this._headers.length}});t.Accordion.HeightAdjustMode={Content:"content",Auto:"auto",Fill:"fill"}}(jQuery,Syncfusion),function(n,t){t.widget("ejProgressBar","ej.ProgressBar",{element:null,model:null,validTags:["div","span"],_addToPersist:["value","percentage"],_setFirst:!1,_rootCSS:"e-progressbar",defaults:{text:"",cssClass:"",minValue:0,maxValue:100,value:0,percentage:0,height:null,htmlAttributes:{},width:null,enabled:!0,enableRTL:!1,showRoundedCorner:!1,enablePersistence:!1,start:null,complete:null,change:null,create:null,destroy:null},dataTypes:{cssClass:"string",minValue:"number",maxValue:"number",enabled:"boolean",enableRTL:"boolean",showRoundedCorner:"boolean",htmlAttributes:"data"},_setValue:function(n){n==null?n=this.model.minValue:typeof n=="string"&&(n=parseFloat(n));this._isNumber(n)?this.model.value=n:this._isNumber(this.model.value)||(this.model.value=this.model.minValue);this.model.value=this._validateRange(this.model.value,this.model.minValue,this.model.maxValue);this._setProgressValue()},_setPercent:function(n){this.initial=this.model.percentage;this.initial==100&&(this.initial=0);n==null?n=0:typeof n=="string"&&(n=parseFloat(n));this._isNumber(n)?this.model.percentage=n:this._isNumber(this.model.percentage)||(this.model.percentage=0);this.model.percentage=this._validateRange(this.model.percentage,0,100);this.model.value=this._percentToValue(this.model.percentage);this._increaseProgressWidth()},_validateMinMax:function(){isNaN(this.model.minValue)&&(this.model.minValue=0);isNaN(this.model.maxValue)&&(this.model.maxValue=100)},_setText:function(n){n?this.text?this.text.html(n):(this.text=t.buildTag("div.e-progress-txt",n),this.element.append(this.text),this._setTop()):this.text&&(this.text.remove(),this.text=null)},_changeSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},enable:function(){this.element.removeClass("e-disable");this.model.enabled=!0},disable:function(){this.element.addClass("e-disable");this.model.enabled=!1},getValue:function(){return this.model.value},getPercentage:function(){return this.model.percentage},_init:function(){this._initialize();this._render()},_setModel:function(n){for(var t in n)switch(t){case"value":this._setValue(n[t]);n[t]=this.model.value;break;case"percentage":this._setPercent(n[t]);n[t]=this.model.percentage;break;case"minValue":isNaN(n[t])||this._minValidation(n[t]);n[t]=this.model.minValue;break;case"maxValue":isNaN(n[t])||this._maxValidation(n[t]);n[t]=this.model.maxValue;break;case"text":this._setText(n[t]);break;case"height":this._setHeight(n[t]);this.text&&this._setTop();break;case"width":this._setWidth(n[t]);break;case"enabled":this._disabled(!n[t]);break;case"cssClass":this._changeSkin(n[t]);break;case"enableRTL":this._rtl(n[t]);break;case"showRoundedCorner":this._roundedCorner(n[t]);break;case"htmlAttributes":this._addAttr(n[t])}},_destroy:function(){this.element.empty();this.element.removeClass("e-widget e-box e-corner "+this.model.cssClass).css("height","")},_initialize:function(){this.text=null;this.header=null;this._preVal=null},_render:function(){this.initialRender=!0;this.element.addClass("e-widget e-box "+this.model.cssClass).attr("role","ProgressBar");this._setDimention();this.header=t.buildTag("div.e-progress");this.element.append(this.header);this._setText(this.model.text);this._setInitialValue();this._addAttr(this.model.htmlAttributes);this._checkProperties();this._roundedCorner(this.model.showRoundedCorner)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?i._disabled(!1):i.element.attr(t,n)})},_setDimention:function(){this._setHeight(this.model.height);this._setWidth(this.model.width)},_setHeight:function(n){n&&this.element.height(n)},_setWidth:function(n){n&&this.element.css("width",n)},_setInitialValue:function(){this._validateMinMax();this.model.percentage?this._setPercent(this.model.percentage):this._setValue(this.model.value)},_disabled:function(n){n?this.disable():this.enable()},_checkProperties:function(){this.model.enableRTL&&this._rtl(this.model.enableRTL);this._minValidation(this.model.minValue);this._maxValidation(this.model.maxValue);this.model.enabled||this._disabled(!0)},_rtl:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_roundedCorner:function(n){n&&!this.element.hasClass("e-corner")?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_minValidation:function(n){this.model.maxValue&&this.model.maxValue<n&&(this.model.maxValue=n);this.model.value<n&&(this.model.value=n);this.model.minValue=n;this._setProgressValue()},_maxValidation:function(n){this.model.minValue&&this.model.minValue>n&&(this.model.minValue=n);this.model.value>n&&(this.model.value=n);this.model.maxValue=n;this._setProgressValue()},_setTop:function(){var n=(this.element.height()-this.text.height())/2;this.text.css("top",Math.floor(n))},_increaseProgressWidth:function(){this.header.css("width",this.model.percentage+"%");this.initial==0&&this.model.percentage!=this.initial&&this._raiseEvent("start");this._preVal!=this.model.value&&(this._preVal=this.model.value,n(this.header).attr("aria-label",this.model.percentage),this.header.hasClass("e-complete")&&this.header.removeClass("e-complete"),this.initialRender?this.initialRender=!1:this._raiseEvent("change"),this.model.percentage==100&&(this.header.addClass("e-complete"),this._raiseEvent("complete")))},_raiseEvent:function(n){this._trigger(n,{value:this.model.value,percentage:this.model.percentage})},_setProgressValue:function(){this.initial=this.model.percentage;this.model.percentage=this._valueToPercent(this.model.value);this._increaseProgressWidth()},_isNumber:function(n){return typeof n=="number"&&!isNaN(n)},_validateRange:function(n,t,i){return n<t?t:n>i?i:n},_valueToPercent:function(n){return this.model.maxValue<=this.model.minValue?100:(n=this._validateRange(n,this.model.minValue,this.model.maxValue),100*(n-this.model.minValue)/(this.model.maxValue-this.model.minValue))},_percentToValue:function(n){if(this.model.maxValue<=this.model.minValue)return this.model.minValue;if(n>=0&&n<=100){var t=this.model.maxValue-this.model.minValue,i=t*n/100;n=i+this.model.minValue}else n<0?n=this.model.minValue:n>100&&(n=this.model.maxValue);return n}})}(jQuery,Syncfusion),function(n,t){t.widget("ejRating","ej.Rating",{_rootCSS:"e-rating",element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{maxValue:5,minValue:0,value:1,allowReset:!0,shapeWidth:23,shapeHeight:23,orientation:"horizontal",incrementStep:1,readOnly:!1,htmlAttributes:{},enabled:!0,showTooltip:!0,precision:"full",cssClass:"",width:null,height:null,enablePersistence:!1,create:null,click:null,mouseover:null,mouseout:null,change:null,destroy:null},dataTypes:{maxValue:"number",minValue:"number",allowReset:"boolean",shapeWidth:"number",shapeHeight:"number",orientation:"enum",incrementStep:"number",readOnly:"boolean",precision:"enum",enabled:"boolean",htmlAttributes:"data"},observables:["value"],value:t.util.valueFunction("value"),_setModel:function(n){for(var i in n)switch(i){case"allowReset":n[i]?this._showResetButton():this._hideResetButton();break;case"value":this.setValue(t.util.getVal(n[i]));n[i]=this.value();break;case"enabled":this._enabledAction(n[i]);break;case"cssClass":this._changeSkin(n[i]);break;case"height":this._mainDiv.height(n[i]);break;case"width":this._mainDiv.width(n[i]);break;case"readOnly":this.model.readOnly=n[i];n[i]?(this._unWireEvents(),this._on(this._mainDiv.find("li"),"mouseleave touchend",this._MouseOutHandler)):this.refresh();break;case"orientation":this.model.orientation=n[i];this.refresh();break;case"maxValue":this.model.maxValue=n[i];this.refresh();break;case"minValue":this.model.minValue=n[i];this.refresh();break;case"incrementStep":this.model.incrementStep=n[i];this.refresh();break;case"shapeWidth":this.model.shapeWidth=n[i];this.refresh();break;case"shapeHeight":this.model.shapeHeight=n[i];this.refresh();break;case"htmlAttributes":this._addAttr(n[i])}},_destroy:function(){this.element.show();this.element.val(this.element.attr("value"));this._unWireEvents();this._mainDiv.remove()},_init:function(){this._initialize()},_initialize:function(){this.element.hide();this._mainDiv=t.buildTag("div.e-rating e-widget "+this.model.cssClass,"",{},{tabindex:"0",role:"group","aria-label":"Rating"});t.isNullOrUndefined(this.model.width)||this._mainDiv.width(this.model.width);t.isNullOrUndefined(this.model.height)||this._mainDiv.height(this.model.height);this._mainDiv.insertBefore(this.element);this.model.orientation==t.Orientation.Horizontal?this._mainDiv.addClass("e-horizontal"):this._mainDiv.addClass("e-vertical");this.model.allowReset&&!this.model.readOnly&&this._createReset();this._validation();this.value()==1&&this.element[0].value!=""&&this.value(this.element[0].value);this._renderShape();this._shapes=this._mainDiv.find("div.e-shape");this._wireEvents();this._CurrentIndex=0;this._initCurrentValue();this.element.val(this.value());this._enabledAction(this.model.enabled);this._checkNameAttr();this._addAttr(this.model.htmlAttributes);this.model.showTooltip&&this._renderTooltip()},_checkNameAttr:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id})},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r._mainDiv.addClass(n):u=="readonly"?r.model.readOnly=n:u=="disabled"&&n=="disabled"?r._enabledAction(!1):u=="style"?r._mainDiv.attr(i,n):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r._mainDiv.attr(i,n)})},_changeSkin:function(n){this.model.cssClass!=n&&this._mainDiv.removeClass(this.model.cssClass).addClass(n)},_enabledAction:function(n){n?(this._mainDiv.removeClass("e-disable"),this.element.removeAttr("disabled")):(this._mainDiv.addClass("e-disable"),this.element.attr("disabled","disabled"))},_validation:function(){this.model.incrementStep<1?this.model.incrementStep=1:this.model.incrementStep>this.model.maxValue&&(this.model.incrementStep=this.model.maxValue)},_createReset:function(){this._mainDiv.find("div.e-reset").length<=0?t.buildTag("div.e-reset","",{width:this.model.shapeWidth+"px",height:this.model.shapeHeight,title:"Reset"},{role:"button","aria-label":"reset","aria-hidden":!1}).appendTo(this._mainDiv):this._mainDiv.find("div.e-reset").show()},_renderShape:function(){var n=Math.round(this.model.maxValue/this.model.incrementStep),o=Math.round(this.model.minValue/this.model.incrementStep),i,r,u,f,e;if(this.model.orientation==t.Rating.Orientation.Horizontal?(i=(n+1)*this.model.shapeWidth,r=this.model.shapeHeight):this.model.orientation==t.Rating.Orientation.Vertical&&(i=this.model.shapeWidth,r=this.model.shapeHeight*n),n>0){for(u=t.buildTag("ul.e-ul","",{width:i+"px",height:r},{}),f=o;f<n;f++)e=t.buildTag("li.e-shape-list","",{width:this.model.shapeWidth+"px",height:this.model.shapeHeight},{tabindex:-1,"aria-describedby":this.element.prop("id")+"_tooltip"}),t.buildTag("div.e-shape inactive","",{width:this.model.shapeWidth+"px",height:this.model.shapeHeight}).appendTo(e),e.appendTo(u);u.appendTo(this._mainDiv)}},_initCurrentValue:function(){var r,i;if(t.isNullOrUndefined(this.value())||this.value()==""||this.value()==0)this._CurrentIndex=0;else if(this.value()>this.model.minValue)for(r=this.value()/this.model.incrementStep-this.model.minValue/this.model.incrementStep,this._CurrentIndex=r,this._valueRefresh(this._CurrentIndex),i=0;i<r;i++)if(this._shapes[i])n(this._shapes[i]).removeClass("inactive").removeClass("active").addClass("selected");else{this._CurrentIndex=i;break}this.value(this._CurrentIndex*this.model.incrementStep+this.model.minValue)},_valueRefresh:function(i){var r,f,u;if(i=Math.ceil(i),r=(this.value()/this.model.incrementStep).toFixed(1),this.model.orientation==t.Rating.Orientation.Horizontal){for(f=this.model.precision=="exact"?(r%1).toFixed(1):this.model.precision=="half"?r%1>.5?1:.5:1,r=((r%1).toFixed(1)!=0?f:r/this._CurrentIndex)*this.model.shapeWidth,u=0;u<i;u++)n(this._shapes[u]).css({width:this.model.shapeWidth+"px"});this._shapes!=null&&n(this._shapes[i-1]).css({width:r+"px"})}else{for(r=((r%1).toFixed(1)!=0?(r%1).toFixed(1):r/this._CurrentIndex)*this.model.shapeHeight,u=0;u<i;u++)n(this._shapes[u]).css({height:this.model.shapeHeight+"px"});this._shapes!=null&&n(this._shapes[i-1]).css({height:r+"px"})}},_reset:function(){if(!this.model.enabled)return!1;n(this._shapes).removeClass("active").removeClass("selected").addClass("inactive");this._prevValue=this.value();this.value(0);this._CurrentIndex=0;this._currValue=this.value();this.element.value=this._currValue;this._valueChanged()},_fillExactPrecision:function(i,r){var e=this._shapes.index(i)+this.model.minValue/this.model.incrementStep+1,f=this.model,u;if(f.orientation==t.Rating.Orientation.Horizontal){for(u=0;u<this._shapes.length;u++)u<e?n(this._shapes[u]).css({width:f.shapeWidth+"px"}):n(this._shapes[u]).css({width:"0px"});n(i).css({width:r+"px"});this.toolTipValue=((e-1)*f.incrementStep+r/f.shapeWidth*f.incrementStep).toFixed(1)}else{for(u=0;u<e;u++)n(this._shapes[u]).css({height:f.shapeHeight+"px"});for(u=e;u<this._shapes.length;u++)n(this._shapes[u]).css({height:"0px"});n(i).css({height:r+"px"});this.toolTipValue=((e-1)*f.incrementStep+r/f.shapeHeight*f.incrementStep).toFixed(1)}},_fillHalfPrecision:function(i,r){var e=this._shapes.index(i)+this.model.minValue/this.model.incrementStep+1,u=this.model,f;if(u.orientation==t.Rating.Orientation.Horizontal){for(f=0;f<this._shapes.length;f++)f<e?n(this._shapes[f]).css({width:u.shapeWidth+"px"}):n(this._shapes[f]).css({width:"0px"});r<this.model.shapeWidth/2?(r=u.shapeWidth/2,n(i).css({width:r+"px"}),this.toolTipValue=((e-1)*u.incrementStep+r/u.shapeWidth*u.incrementStep).toFixed(1)):(r=u.shapeWidth,n(i).css({width:r+"px"}),this.toolTipValue=((e-1)*u.incrementStep+r/u.shapeWidth*u.incrementStep).toFixed(1))}else{for(f=0;f<this._shapes.length;f++)f<e?n(this._shapes[f]).css({height:this._starHeight+"px"}):n(this._shapes[f]).css({height:"0px"});r<=u.shapeHeight/2?(r=u.shapeHeight/2,n(i).css({height:r+"px"}),this.toolTipValue=((e-1)*u.incrementStep+r/u.shapeHeight*u.incrementStep).toFixed(1)):(r=u.shapeHeight,n(i).css({height:r+"px"}),this.toolTipValue=((e-1)*u.incrementStep+r/u.shapeHeight*u.incrementStep).toFixed(1))}},_fillFullPrecision:function(i){var f=this._shapes.index(i)+this.model.minValue/this.model.incrementStep+1,u=this.model,r;if(u.orientation==t.Rating.Orientation.Horizontal){for(r=0;r<this._shapes.length;r++)r<f?n(this._shapes[r]).css({width:u.shapeWidth+"px"}):n(this._shapes[r]).css({width:"0px"});n(i).css({width:u.shapeWidth+"px"});this.toolTipValue=(this.model.minValue+(this._shapes.index(i)+1))*this.model.incrementStep}else{for(r=0;r<this._shapes.length;r++)r<f?n(this._shapes[r]).css({height:u.shapeHeight+"px"}):n(this._shapes[r]).css({height:"0px"});n(i).css({height:u.shapeHeight+"px"});this.toolTipValue=(this.model.minValue+(this._shapes.index(i)+1))*this.model.incrementStep}},_ClickHandler:function(i){var u,r,f,e;if(this.model.enabled){if(i.target.tagName=="LI"?u=i.target.firstChild:i.target.parentNode.tagName=="LI"&&(u=i.target),u){for(r=this._shapes.index(u)+1,f=0;f<r;f++)this._shapes[f]&&n(this._shapes[f]).removeClass("inactive").removeClass("active").addClass("selected");this._prevValue=this.value();this._CurrentIndex=r;r=r+this.model.minValue/this.model.incrementStep;e=this.model.incrementStep;this._currValue=this.model.orientation==t.Rating.Orientation.Horizontal?((r-1)*e+u.clientWidth/this.model.shapeWidth*e).toFixed(1):((r-1)*e+u.clientHeight/this.model.shapeHeight*e).toFixed(1);this.element.value=this._currValue;this.value(parseFloat(this._currValue));this._trigger("click",{event:i,value:this.value(),prevValue:this._prevValue});this._valueChanged()}n(i.target).hasClass("e-reset")&&this._reset()}},_MouseOverHandler:function(t){var u,r,f,e,i;if(this.model.enabled){if(r=t.target,t.type=="touchmove"&&(f=t.originalEvent.changedTouches[0],r=document.elementFromPoint(f.pageX,f.pageY)),r.tagName=="LI")u=r.firstChild;else if(r.parentNode.tagName=="LI")u=r;else return!1;for(e=this._shapes.index(u)+1,i=0;i<=this._shapes.length;i++)this._shapes[i]&&(i<e?n(this._shapes[i]).removeClass("inactive").removeClass("selected").addClass("active"):n(this._shapes[i]).removeClass("active").removeClass("selected").addClass("inactive"));this._trigger("mouseover",{event:t,index:e,value:this.value()})}},_MouseOutHandler:function(t){var r,i;if(!this.model.readOnly&&this.model.enabled){if(r=this._CurrentIndex,r!=0)for(i=0;i<this._shapes.length;i++)this._shapes[i]&&(i<r?n(this._shapes[i]).removeClass("active").removeClass("inactive").addClass("selected"):n(this._shapes[i]).removeClass("active").addClass("inactive"));else n(this._shapes).removeClass("active").addClass("inactive");this._valueRefresh(r);this._trigger("mouseout",{event:t,value:this.value()})}},_MouseMoveHandler:function(i){var u,f,r,e,o;if(!this.model.readOnly&&this.model.enabled){if(r=i.target,i.type=="touchmove"&&(e=i.originalEvent.changedTouches[0],r=document.elementFromPoint(e.pageX,e.pageY)),r.tagName=="LI")u=r.firstChild;else if(r.parentNode.tagName=="LI")u=r;else return!1;f=this.model.orientation==t.Rating.Orientation.Horizontal?t.isNullOrUndefined(i.offsetX)?i.pageX-n(r).offset().left:i.offsetX+1:t.isNullOrUndefined(i.offsetY)?i.pageY-n(r).offset().top:i.offsetY+1;this.model.precision==t.Rating.Precision.Exact?this._fillExactPrecision(u,f):this.model.precision==t.Rating.Precision.Half?this._fillHalfPrecision(u,Math.round(f)):this._fillFullPrecision(u)}else this.toolTipValue=(this.value()==null||this.value()==""?0:this.value())+" / "+this.model.maxValue;n(i.target).attr("aria-label",this.toolTipValue);this.model.showTooltip&&parseFloat(this.model.maxValue)>=parseFloat(this.toolTipValue)&&(o=n(this._mainDiv).data("ejTooltip"),o._setModel({content:this.toolTipValue}))},_renderTooltip:function(){var u=this,i,r;this.model.showTooltip&&(i={target:{horizontal:"center",vertical:"top"},stem:{horizontal:"center",vertical:"bottom"}},this.model.orientation==t.Rating.Orientation.Vertical&&(i={target:{horizontal:"right",vertical:"center"},stem:{horizontal:"left",vertical:"center"}}),r=n(this._mainDiv).ejTooltip({target:".e-shape-list",content:this.value(),isBalloon:!1,collision:"flip",position:i,showRoundedCorner:!0,cssClass:this.model.cssClass,beforeOpen:function(n){u._updateTooltipValue(n)}}).data("ejTooltip"),n(r.tooltip).css({"min-width":"auto"}))},_updateTooltipValue:function(t){var i=n(this._mainDiv).data("ejTooltip");i._setModel({content:this.toolTipValue});i.show(t.event.target);t.cancel=!0},_wireEvents:function(){this.model.readOnly||(this._on(this._mainDiv,"mousedown",this._ClickHandler),this._on(this._mainDiv.find("li"),"mouseenter touchmove",this._MouseOverHandler));this._on(this._mainDiv.find("li"),"mouseleave touchend",this._MouseOutHandler);this._on(this._mainDiv.find("li"),t.eventType.mouseMove,this._MouseMoveHandler)},_unWireEvents:function(){this._mainDiv.find("li").off("mouseenter touchmove");this._mainDiv.find("li").off("mouseleave touchend");this._mainDiv.off("mousedown");this.model.precision!==t.Rating.Precision.Full&&this._mainDiv.find("li").off(t.eventType.mouseMove)},_valueChanged:function(){this.element.val(this.value());this._prevValue!=this._currValue&&this._trigger("change",{value:this.value(),prevValue:this._prevValue})},reset:function(){this._reset()},show:function(){if(!this.model.enabled)return!1;this._mainDiv.css("visibility","visible")},hide:function(){if(!this.model.enabled)return!1;this._mainDiv.css("visibility","hidden")},_showResetButton:function(){if(!this.model.enabled)return!1;this._createReset()},_hideResetButton:function(){if(!this.model.enabled)return!1;this._mainDiv.find("div.e-reset").hide()},getValue:function(){return this.value()==null||this.value()===""?"":this.value()},setValue:function(t){t!=null&&t!="null"&&(this.model.maxValue<t?t=this.model.maxValue:this.model.minValue>t&&(t=this.model.minValue),this.value(t),n(this._shapes).removeClass("selected").addClass("inactive"),this._initCurrentValue(),this.element.val(this.value()))},refresh:function(){this._destroy();this._unWireEvents();this._initialize()}});t.Rating.Precision={Full:"full",Half:"half",Exact:"exact"};t.Rating.Orientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion),function(n,t){t.widget("ejRotator","ej.Rotator",{element:null,model:null,_setFirst:!1,validTags:["ul"],defaults:{cssClass:"",dataSource:null,query:null,fields:{text:"text",url:"url",linkAttribute:"linkAttribute",targetAttribute:"targetAttribute",thumbnailText:"text",thumbnailUrl:"url"},enabled:!0,displayItemsCount:"1",navigateSteps:"1",animationSpeed:600,startIndex:"0",enableTouch:!0,showPlayButton:!1,enableAutoPlay:!1,showNavigateButton:!0,slideWidth:"",slideHeight:"",frameSpace:"",isResponsive:!1,orientation:"horizontal",pagerPosition:"outside",showThumbnail:!1,showPager:!0,stopOnHover:!1,htmlAttributes:{},thumbnailSourceID:null,template:null,templateId:null,showCaption:!1,allowKeyboardNavigation:!0,enableRTL:!1,animationType:"slide",delay:500,circularMode:!0,create:null,change:null,start:null,stop:null,thumbItemClick:null,pagerClick:null,destroy:null},dataTypes:{cssClass:"string",dataSource:"data",query:"data",fields:"data",template:"string",templateId:"array",enabled:"boolean",displayItemsCount:"",navigateSteps:"",animationSpeed:"",transitionDelay:"",startIndex:"",showPlayButton:"boolean",enableAutoPlay:"boolean",slideWidth:"",slideHeight:"",frameSpace:"",isResponsive:"boolean",orientation:"enum",pagerPosition:"enum",showThumbnail:"boolean",thumbnailSourceID:"",showPager:"boolean",showCaption:"boolean",enableRTL:"boolean",allowKeyboardNavigation:"boolean",circularMode:"boolean",animationType:"string",delay:"",htmlAttributes:"data"},_init:function(){this._rtlDirection=!0;this._initialize();this.model.dataSource==null&&this._setValues();this._render();this._wireEvent();this.model.enableAutoPlay&&this.play();this.model.enabled||t.browserInfo().name!="msie"||t.browserInfo().version!="8.0"||(this._outerWrapper.addClass("e-disable").attr({"aria-disabled":!0}),this._ieEnable("addClass"))},_initialize:function(){this.element.attr("tabindex",0);this._liCount=null;this.transitionDelay=null;this._animating=!1;this._isPlaying=!1;this._interval=null;this._thumbCount=null;this._captionChange=!1;this._liSize=null;this._containerSize=null;this._thumbVal=this.model.showThumbnail;this.containerCss=this.model.orientation==t.Orientation.Horizontal?"outerWidth":"outerHeight";this.displayCss=this.model.orientation==t.Orientation.Horizontal?"left":"top";n.extend(jQuery.easing,{slowSlide:function(n,t,i,r,u){var f=(t/=u)*t;return i+r*f*f},fastSlide:function(n,t,i,r,u){var f=(t/=u)*t,e=f*t;return i+r*(e*f+-5*f*f+10*e+-10*f+5*t)},slide:function(n,t,i,r,u){var f=(t/=u)*t,e=f*t;return i+r*(6*e*f+-15*f*f+10*e)}})},_setValues:function(){this._setLicount();this._setSpeed(this.model.animationSpeed);this._setVisibleItemCount(this.model.displayItemsCount);this._setItemMove(this.model.navigateSteps);this._setFrameSpace(this.model.frameSpace);this._setSlideWidth(this.model.slideWidth);this._setSlideHeight(this.model.slideHeight);this._changeProperty();this._setInitial()},_refresh:function(){this._setValues();this._setDimension();this._changeSkin()},_reRenderControl:function(){this._undoClone();this._setLicount();this._setSpeed(this.model.animationSpeed);this._setVisibleItemCount(this.model.displayItemsCount);this._setItemMove(this.model.navigateSteps);this._setFrameSpace(this.model.frameSpace);this._setSlideWidth(this.model.slideWidth);this._setSlideHeight(this.model.slideHeight);this._changeProperty();this._cloneItem();this._createCaption();this._changeSkin();this._setRTL(!1)},_refreshControl:function(){this._setShowPager();this.model.showCaption?(this.element.siblings().hasClass("e-caption")&&this._caption.remove(),this._createCaption()):this.element.siblings().hasClass("e-caption")&&this._caption.remove();this.model.showThumbnail||this._thumbVal&&this.model.displayItemsCount==1&&this.model.navigateSteps==1?(this.element.parents(".e-in-wrap").siblings().hasClass("e-thumb")&&(this._thumb.remove(),t.isNullOrUndefined(this._thumbControl)||this._thumbControl.remove()),this._createThumb(),this.model.showThumbnail=!0):this.element.parents(".e-in-wrap").siblings().hasClass("e-thumb")&&(this._thumb.remove(),t.isNullOrUndefined(this._thumbControl)||this._thumbControl.remove());this._changeSkin();this._setRTL(!1)},_checkDataBinding:function(){var n=this.model.dataSource;n!=null&&(this.element.addClass("onloading"),t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._renderItems(n));this._setValues()},_initDataSource:function(n){var t=this,i;i=n.executeQuery(this._getQuery());i.done(function(n){t._renderItems(n.result)}).fail(function(){t.element.removeClass("onloading")})},_getQuery:function(){var n;if(t.isNullOrUndefined(this.model.query)){n=[];queryManager=t.Query();mapper=this.model.fields;col;for(col in mapper)col!=="tableName"&&mapper[col]&&n.push(mapper[col]);n.length>0&&queryManager.select(n);this.model.dataSource.dataSource.url.match(mapper.tableName+"$")||t.isNullOrUndefined(mapper.tableName)||queryManager.from(mapper.tableName)}else queryManager=this.model.query;return queryManager},_renderItems:function(n){this.list=n;this._generateTagItems(this.list);this.element.removeClass("onloading")},_generateTagItems:function(n){var t;for(this.mapField=this._getMapper(),t=0;t<n.length;t++)this.element.append(this._generateLi(n[t],this.mapField))},_getTemplatedItems:function(){var e=this.model.templateId,u,r,f;for(i=0;i<e.length;i++)u=t.buildTag("li"),r=n("#"+this.model.templateId[i]),f=r[0]&&r[0].nodeName&&r[0].nodeName.toLowerCase()=="script"?t.getClearString(r[0].innerHTML):r,this.element.append(n(u).append(f))},_getMapper:function(){var n=this.model.fields,t={_text:null,_url:null};return t._text=n&&n.text?n.text:"text",t._url=n&&n.url?n.url:"url",t._attr=n&&n.htmlAttr?n.htmlAttr:"htmlAttr",t._linkAttribute=n&&n.linkAttribute?n.linkAttribute:"linkAttribute",t._targetAttribute=n&&n.targetAttribute?n.targetAttribute:"targetAttribute",t._thumbnailText=n&&n.thumbnailText?n.thumbnailText:"text",t._thumbnailUrl=n&&n.thumbnailUrl?n.thumbnailUrl:"url",t},_generateLi:function(i,r){var f=t.buildTag("li"),u,e;return u=t.buildTag("img"),t.isNullOrUndefined(i[r._url])||u.attr("src",i[r._url]),t.isNullOrUndefined(i[r._text])||u.attr("title",i[r._text]),t.isNullOrUndefined(i[r._linkAttribute])?this.model.template||f.append(u):(e=t.buildTag("a").attr({href:i[r._linkAttribute]}).append(u),t.isNullOrUndefined(i[r._targetAttribute])||e.attr("target","_"+i[r._targetAttribute]),f.append(e)),this.model.template&&n(f).append(this._getTemplatedString(i)),this._setAttributes(i[r._attr],u),f},_getTemplatedString:function(n){for(var t=this.model.template,i=t.indexOf("${"),r=t.indexOf("}"),u,f;i!=-1&&r!=-1;)u=t.substring(i,r+1),f=u.replace("${","").replace("}",""),t=t.replace(u,this._getField(n,f)),i=t.indexOf("${"),r=t.indexOf("}");return t},_getField:function(n,i){return t.pvt.getObject(i,n)},_generateThumbnailLi:function(n,i){var u=t.buildTag("li"),r;return r=t.buildTag("img"),t.isNullOrUndefined(n[i._thumbnailUrl])||r.attr("src",n[i._thumbnailUrl]),t.isNullOrUndefined(n[i._thumbnailText])||r.attr("title",n[i._thumbnailText]),u.append(r),u},_setAttributes:function(n,t){if(n)for(var i in n)t.attr(i,n[i])},_createWrapper:function(){this._wrapper=t.buildTag("div.e-inner e-box e-"+this.model.orientation).insertBefore(this.element);this.model.dataSource!=null&&this._checkDataBinding();this.model.templateId!=null&&(this._getTemplatedItems(),this._setValues());this._wrapper.append(this.element);this._innerWrapper=t.buildTag("div.e-in-wrap").insertBefore(this._wrapper);this._innerWrapper.append(this._wrapper);this._outerWrapper=t.buildTag("div.e-rotator-wrap e-widget "+this.model.cssClass).insertBefore(this._innerWrapper);this._outerWrapper.append(this._innerWrapper);this.model.enabled||this._outerWrapper.addClass("e-disable").attr({"aria-disabled":!0})},_refreshTagItems:function(n,t){this.model[n]=t;this.element.children("li").remove();this._checkDataBinding();this._cloneItem();this._refreshControl()},_createButtonControl:function(){this._buttonWrapper=t.buildTag("div.e-nav").insertAfter(this._wrapper);this.model.showNavigateButton&&(this._prevButton=t.buildTag("span.e-nav-btn e-icon e-previous").attr({role:"button"}).appendTo(this._buttonWrapper),this._nextButton=t.buildTag("span.e-nav-btn e-icon e-next").attr({role:"button"}).appendTo(this._buttonWrapper));this._buttonWrapper.appendTo(this._wrapper);this._createAutoPlay();this.model.showNavigateButton&&this._wireBtnEvents()},_createAutoPlay:function(){var n;if(!this.model.showPlayButton)return!1;n=this._interval!=null?"pause":"play";this._autoButton=t.buildTag("span.e-nav-btn e-icon "+n,"",{},{role:"button"}).appendTo(this._buttonWrapper);this._wireAutoPlayEvents()},_createBulletControl:function(){var n;for(this._bulletWrapper=t.buildTag("div.e-pager-wrap","",{},{role:"group","aria-label":"showPager",tabindex:"0"}).insertAfter(this._innerWrapper),this._bullet=t.buildTag("ul.e-bullet e-default"),this.model.circularMode?(n=(this._liCount-this.model.displayItemsCount*2)/this.model.navigateSteps,(this._liCount-this.model.displayItemsCount*2)%this.model.navigateSteps!=0&&n++):(n=(this._liCount-this.model.displayItemsCount)/this.model.navigateSteps+1,(this._liCount-this.model.displayItemsCount)%this.model.navigateSteps!=0&&n++),i=1;i<=n;i++)t.buildTag("li.e-icon","",{},{tabindex:"-1","aria-selected":"false"}).appendTo(this._bullet);this._bullet.appendTo(this._bulletWrapper);this._setActiveBullet();this._setPagerposition(this.model.pagerPosition);this._wireBulletEvents()},_createCaption:function(){var i;if(!this.model.showCaption)return!1;this._caption=t.buildTag("div.e-caption").append(n("<span>")).insertAfter(this._buttonWrapper);this.model.circularMode?(i=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),i--):i=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize);this._setCaptionText(i)},_createThumb:function(){var r,i;if(this.model.dataSource!=null||this.model.thumbnailSourceID!=null){if(this._thumb=this.model.showPager?t.buildTag("div.e-thumb","",{},{tabindex:"0",role:"group"}).insertAfter(this._bulletWrapper):t.buildTag("div.e-thumb","",{},{tabindex:"0",role:"group"}).insertAfter(this._innerWrapper),this._thumbItems=t.buildTag("ul.e-thumb-items e-ul"),this.model.dataSource!=null)this._thumbItems.addClass("onloading"),this._generateThumbnailTagItems(this.list);else{for(i=0;i<n("#"+this.model.thumbnailSourceID).children("li").length;i++)r=n("#"+this.model.thumbnailSourceID).children("li").eq(i).clone(),r.addClass("e-thumb-ele").attr("tabindex",-1).removeAttr("style").appendTo(this._thumbItems);n("#"+this.model.thumbnailSourceID).css("display","none")}this._thumbItems.appendTo(this._thumb);this._setThumbProperty();this._setActiveThumb()}},_createThumbControl:function(){this._thumbControl=t.buildTag("div.e-thumb-nav").insertAfter(this._thumb);this._previous=t.buildTag("span.e-thumb-btn e-icon e-previous "+(this.model.enableRTL?"e-enable":"e-disable"),"",{},{"aria-disabled":this.model.enableRTL?!1:!0}).appendTo(this._thumbControl);this._next=t.buildTag("span.e-thumb-btn e-icon e-next "+(this.model.enableRTL?"e-disable":"e-enable"),"",{},{"aria-disabled":this.model.enableRTL?!0:!1}).appendTo(this._thumbControl);this._thumbControl.appendTo(this._outerWrapper);this._wireThumbEvents()},_generateThumbnailTagItems:function(n){for(var t=0;t<n.length;t++)this._thumbItems.append(this._generateThumbnailLi(n[t],this.mapField).addClass("e-thumb-ele").attr("tabindex",-1));this._thumbItems.removeClass("onloading")},_setSkin:function(n){this._outerWrapper.removeClass(this.model.cssClass).addClass(n)},_cloneItem:function(){if(this.model.circularMode){for(var n=0,i=t.buildTag("ul"),n=0;n<this.model.displayItemsCount;n++)this.element.children("li").eq(n).clone().addClass("clone").appendTo(this.element);for(n=this._liCount-this.model.displayItemsCount;n<this._liCount;n++)this.element.children("li").eq(n).clone().addClass("clone").prependTo(i);for(n=0;n<i.children("li").length;n++)i.children("li").eq(n).clone().prependTo(this.element)}this._setDimension()},_undoClone:function(){for(i=0;i<this._liCount;i++)this.element.children("li").eq(i).hasClass("clone")&&(this.element.children("li").eq(i).remove(),this._setLicount(),i--)},_setModel:function(n){var t,i=!1,r=!1;for(t in n)switch(t){case"enableAutoPlay":(this.model.enableAutoPlay=n[t])?this._autoPlay():this._setPause(!0);break;case"enableTouch":this.model.enableTouch=n[t];this._wireTouchEvents();break;case"fields":case"query":case"dataSource":case"template":this._refreshTagItems(t,n[t]);break;case"enabled":this._changeState(n[t]);break;case"slideWidth":this._setSlideWidth(n[t]);i=!0;r=!0;break;case"slideHeight":this._setSlideHeight(n[t]);i=!0;r=!0;break;case"displayItemsCount":this._undoClone();this._setVisibleItemCount(n[t]);this._cloneItem();this.model.displayItemsCount==1&&this._captionChange&&(this.model.showCaption=!0,this._captionChange=!1);i=!0;r=!0;break;case"navigateSteps":n[t]=this._validateItemMove(n[t]);this.model.navigateSteps=n[t];i=!0;r=!0;break;case"pagerPosition":this._setPagerposition(n[t]);break;case"showPager":this.model.showPager=n[t];this._setShowPager();break;case"showThumbnail":this._thumbVal=this.model.showThumbnail=n[t];i=!0;r=!0;break;case"thumbnailSourceID":this.model.thumbnailSourceID=n[t];this.model.dataSource==null&&(i=!0,r=!0);break;case"showCaption":this.model.showCaption=n[t];i=!0;r=!0;break;case"isResponsive":this.model.isResponsive=n[t];this._wireResizeEvents();break;case"orientation":this.model.orientation=n[t];this._setOrientation(n[t]);break;case"animationSpeed":this._setSpeed(n[t]);break;case"frameSpace":this._setFrameSpace(n[t]);i=!0;r=!0;break;case"showPlayButton":this.model.showPlayButton=n[t];this._setAutoplay(n[t]);this._changeSkin();break;case"startIndex":this.model.startIndex=n[t];i=!0;r=!0;break;case"allowKeyboardNavigation":this.model.allowKeyboardNavigation=n[t];this._wireKeyboardEvents();break;case"showNavigateButton":this.model.showNavigateButton=n[t];this._setSlideButton(n[t]);this._changeSkin();break;case"animationType":this.model.animationType=n[t];this._setSpeed(this.model.animationSpeed);break;case"cssClass":this._setSkin(n[t]);break;case"enableRTL":this._setRTL(!0,n[t]);break;case"circularMode":this.model.circularMode=n[t];this._reRenderControl();this._refresh();break;case"delay":this.model.delay=n[t];this._setSpeed(this.model.animationSpeed);break;case"htmlAttributes":this._addAttr(n[t])}i&&this._refresh();r&&this._refreshControl()},_setShowPager:function(){this.model.showPager?(t.isNullOrUndefined(this._bulletWrapper)||this._bulletWrapper.remove(),this._createBulletControl()):this.element.parents(".e-in-wrap").siblings().hasClass("e-pager-wrap")&&this._bulletWrapper.remove()},_setDimension:function(){this._setLicount();this._setUlInitial();this._setWidth();this._setHeight();this._setContainerPercent();this._changeProperty()},_render:function(){this._createWrapper();this._addAttr(this.model.htmlAttributes);this._cloneItem();this._createButtonControl();this._createCaption();this.model.showPager&&this._createBulletControl();this.model.showThumbnail&&this._createThumb();this._outerWrapper.find(this.element).addClass("e-ul");this._changeSkin();this._setRTL(!1)},_setWidth:function(){this._containerWidth=this.model.orientation=="horizontal"?parseInt(this.model.slideWidth)*this.model.displayItemsCount+parseInt(this.model.frameSpace)*(parseInt(this.model.displayItemsCount)-1):this.model.slideWidth;this.element.parent().css("width",this._containerWidth);this.element.parents(".e-in-wrap").css("width",this._containerWidth);this.element.parents(".e-rotator-wrap").css("width",this._containerWidth);this._changeProperty()},_setHeight:function(){this._containerHeight=this.model.orientation=="vertical"?parseInt(this.model.slideHeight)*this.model.displayItemsCount+parseInt(this.model.frameSpace)*(parseInt(this.model.displayItemsCount)-1):this.model.slideHeight;this.element.parent().css("height",this._containerHeight);this._changeProperty()},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i._outerWrapper.addClass(n):i._outerWrapper.attr(t,n);t=="disabled"&&n=="disabled"&&i.disable()})},_setUlInitial:function(){this.model.orientation==t.Orientation.Horizontal?this.element.css({width:this._liCount*this._liWidth,height:this._liHeight}):this.element.css({height:this._liCount*this._liHeight,width:this._liWidth})},_setInitial:function(){this.model.circularMode?this.element.css(this.displayCss,-(this._liSize*this.model.displayItemsCount)-(this.model.startIndex>0&&this.element.children("li").length>this.model.startIndex?this.model.startIndex:0)*this.model.navigateSteps*this._liSize):this.element.css(this.displayCss,"0")},_setBegin:function(){this.model.circularMode?this.element.css(this.displayCss,-(this._liSize*this.model.displayItemsCount)):this.element.css(this.displayCss,"0")},_setSlideWidth:function(n){isNaN(parseInt(n))?this.model.slideWidth=this._getMaxSize("width"):(n=n.toString(),this.model.slideWidth=this._checkValue(n,"width"));this.element.children("li").css("width",this.model.slideWidth);this._liWidth=this.element.children("li").outerWidth(!0)},_setSlideHeight:function(n){isNaN(parseInt(n))?this.model.slideHeight=this._getMaxSize("height"):(n=n.toString(),this.model.slideHeight=this._checkValue(n,"height"));this.element.children("li").css("height",this.model.slideHeight);this._liHeight=this.element.children("li").outerHeight(!0)},_setPagerposition:function(n){this.model.showPager&&(this._bullet.removeClass("e-default e-thumb-pos e-topleft e-topright e-bottomleft e-bottomright e-topCenter e-outside"),this._bullet.addClass("e-"+n),(n=="bottomleft"||n=="bottomright")&&this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&this._bullet.addClass("e-thumb-pos"))},_setCaptionText:function(n){if(this.model.showCaption){var t=this.model.circularMode?++n:n;this._caption.children().html(this.element.children("li").eq(t).children("img").attr("title"))}},_setAutoplay:function(n){n?this._createAutoPlay():this._autoButton!=null&&(this._setPause(),this._autoButton.remove())},_setSlideButton:function(n){n?this._createButtonControl():(this._prevButton.remove(),this._nextButton.remove())},_setOrientation:function(n){this._wrapper.removeClass("e-"+this.model.orientation).addClass("e-"+n);this._setFrameSpace(this.model.frameSpace);this._refresh();this.model.orientation==t.Orientation.Horizontal?this.element.css({left:-(Math.round(-this.element.position().top/this._liHeight)*this._liSize),top:0}):this.element.css({top:-(Math.round(-this.element.position().left/this._liWidth)*this._liSize),left:0});this._unwireTouchEvents();this._wireTouchEvents()},_setRTL:function(n,i){n&&this.model.showNavigateButton&&(this._unwireBtnEvents(),this.model.enableRTL=i);var r=this.model.enableRTL?"addClass":"removeClass";this.model.showPager&&this._bullet[r]("e-rtl");this.model.showCaption&&this._caption[r]("e-rtl");t.isNullOrUndefined(this._thumbItems)||this._thumbItems[r]("e-rtl");n&&this.model.showNavigateButton&&this._wireBtnEvents()},_setActiveBullet:function(){var n;this.model.circularMode?(n=Math.round(-Math.round(this.element.position()[this.displayCss])/(this._liSize*this.model.displayItemsCount)),this.model.navigateSteps<this.model.displayItemsCount&&(n=-(Math.round(this.element.position()[this.displayCss])+this._liSize*this.model.displayItemsCount)/(this._liSize*this.model.navigateSteps)),n=this.model.navigateSteps==this.model.displayItemsCount?n-1:n):n=Math.round(-Math.round(this.element.position()[this.displayCss])/(this._liSize*this.model.navigateSteps));n=n<0?-n:n;this._bullet.children().eq(Math.round(n)).addClass("e-active").attr({tabindex:0,"aria-selected":"true"})},_setActiveThumb:function(){var n;this.model.circularMode?(n=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),n--):(n=Math.round(Math.round(this.element.position()[this.displayCss])/this._liSize),n=n==0?n:-n);this._thumbItems.children().eq(n).addClass("e-active").attr({tabindex:0,"aria-selected":"true"});this._transferThumb(n)},_checkValue:function(t,i){return t.indexOf("%")>0&&(Math.round(parseInt(t))=="100"&&(this.model.displayItemsCount=1,this._setVisibleItemCount(this.model.displayItemsCount)),t=this._convertPercentageToPixel(n(this.element[0]).parent()[i](),parseInt(t))),t},_convertPercentageToPixel:function(n,t){return Math.round(t*n/100)},_convertPixelToPercentage:function(n,t){return Math.round(t/n*100)},_changeProperty:function(){this.containerCss=this.model.orientation==t.Orientation.Horizontal?"outerWidth":"outerHeight";this.displayCss=this.model.orientation==t.Orientation.Horizontal?"left":"top";this.model.orientation==t.Orientation.Horizontal?(this._liSize=this._liWidth,this._containerSize=this._containerWidth):(this._liSize=this._liHeight,this._containerSize=this._containerHeight)},_setFrameSpace:function(n){isNaN(parseInt(n))?this.model.frameSpace="0px":(this.model.frameSpace=n,this.model.orientation==t.Orientation.Horizontal?this.element.children("li").css({"margin-right":n,"margin-bottom":0}):this.element.children("li").css({"margin-bottom":n,"margin-right":0}))},_setLicount:function(){this._liCount=this.element.children("li").length},_setVisibleItemCount:function(n){this.model.displayItemsCount=n;this.model.navigateSteps=this.model.navigateSteps<=this.model.displayItemsCount?this.model.navigateSteps:this.model.displayItemsCount;this._checkAndSet()},_checkAndSet:function(){(this.model.displayItemsCount>1||this.model.navigateSteps>1)&&(this.model.showThumbnail&&(this.model.showThumbnail=!1),this.model.showCaption&&(this.model.showCaption=!1,this._captionChange=!0))},_changeSkin:function(){var n;this.model.displayItemsCount>1||this.model.navigateSteps>1?(this._innerWrapper.addClass("e-multiple"),this._wrapper.removeClass("e-single"),this._outerWrapper.css("width",this._innerWrapper.outerWidth(!0))):(this._innerWrapper.removeClass("e-multiple"),this._wrapper.addClass("e-single"));this.model.showPlayButton&&this._autoButton.css({left:(this._innerWrapper.outerWidth(!0)/2-this._autoButton.width()/2)/this._innerWrapper.outerWidth(!0)*100+"%",top:(this._wrapper.outerHeight(!0)/2-this._autoButton.height()/2)/this._wrapper.outerHeight(!0)*100+"%"});this.model.showNavigateButton&&(n=(this._wrapper.outerHeight(!0)/2-this._prevButton.height()/2)/this._wrapper.outerHeight(!0)*100+"%",this._prevButton.css("top",n),this._nextButton.css("top",n));this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&this._previous!=null&&this._next!=null&&(n=this._outerWrapper.outerHeight(!0)+this._thumbItems.children("li").outerHeight(!0)/2-this._thumbItems.children("li").outerHeight(!0)-this._previous.height()/2,n=n/this._outerWrapper.outerHeight(!0)*100+"%",this._previous.css("top",n),this._next.css("top",n))},_setItemMove:function(n){this.model.navigateSteps=this._validateItemMove(n);this._checkAndSet()},_validateItemMove:function(n){return n<=this.model.displayItemsCount?n:this.model.displayItemsCount},_setPlay:function(){this.model.showPlayButton&&this._autoButton.hasClass("play")&&this._autoButton.removeClass("play").addClass("pause");this._animate=!0;this._raiseEvent("start")},_setPause:function(n){this._interval!=null&&(this.model.showPlayButton&&this._autoButton.hasClass("pause")&&this._autoButton.removeClass("pause").addClass("play"),clearInterval(this._interval),this._isInteraction=!n,this._animate=this.model.stopOnHover?!0:!1,this._interval=null,this._raiseEvent("stop"))},_setContainerPercent:function(){this._containerPercent=this._convertPixelToPercentage(this.element.parents(".e-rotator-wrap").parent().width(),this.element.parent().width())},_setSpeed:function(n){this.transitionDelay=this.model.animationType!="slideshow"?n+this.model.delay:n*2+this.model.delay},_setThumbProperty:function(){var e,u=0,f,i=this._thumbItems.children("li"),r;if(t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&parseFloat(n(i[0]).width())<0)return!1;for(r=0;r<i.length;r++)i[r]!=null&&(u=u+(parseFloat(i.eq(r).width())+parseFloat(i.eq(r).css("padding-left"))+Math.ceil(parseFloat(i.eq(r).css("border-left-width")))+parseFloat(i.eq(r).css("margin-left"))+parseFloat(i.eq(r).css("padding-right"))+Math.ceil(parseFloat(i.eq(r).css("border-right-width")))+parseFloat(i.eq(r).css("margin-right"))));e=Math.round(this.element.parent().outerWidth(!0)-this.element.parent().outerWidth(!0)*12/100);this._thumb.css("width",e);this._thumbCount=Math.floor(this._thumb.outerWidth()/(u/i.length));f=Math.round(this.element.parent().outerWidth(!0)*6/100+(e-this._thumbCount*(u/i.length))/2);this._thumb.css({"margin-left":f,"margin-right":f,width:Math.ceil(this._thumbCount*Math.ceil(u/i.length))});this._thumbItems.css({width:Math.ceil(u),height:this._thumbItems.children("li").outerHeight(!0)});this._checkState();this._previous.css({left:(f-this._previous.width())/2});this._next.css({right:(f-this._next.width())/2})},_checkState:function(){this._thumbCount<=this._liCount-this.model.displayItemsCount*2?this.element.parents(".e-in-wrap").siblings().hasClass("e-thumb-nav")||this._createThumbControl():this.element.parents(".e-in-wrap").siblings().hasClass("e-thumb-nav")&&this._thumbControl.remove()},_removeActiveItem:function(){this.model.showPager&&this._bullet.children().removeClass("e-active").attr({tabindex:-1,"aria-selected":"false"});this.model.showThumbnail&&this._thumbItems.children().removeClass("e-active").attr({tabindex:-1,"aria-selected":"false"})},_setActiveItem:function(n){if(this.model.showPager&&this._bullet.children().eq(n).addClass("e-active").attr({tabindex:0,"aria-selected":"true"}),this.model.showThumbnail)for(this._thumbItems.children().eq(n).addClass("e-active").attr({tabindex:0,"aria-selected":"true"}),this._transferThumb(n),i=0;i<this._thumbItems.children("li").length;i++)this._thumbItems.children("li").eq(i).hasClass("e-thumbhover")&&this._thumbItems.children("li").eq(i).removeClass("e-thumbhover")},_transferThumb:function(n){var t,i;this.model.showThumbnail&&(t=n*this._thumbItems.children("li").outerWidth(!0)- -this._thumbItems.position().left,i=-this._thumbItems.position().left+this._thumb.width(),this._thumbItems.width()-i>t?this._thumbMove(t):this._thumbMove(this._thumbItems.width()-i))},_changeThumbControl:function(n){var t;this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&(t=this._thumbItems.children("li").length,n*this._thumbItems.children("li").outerWidth(!0)>0?this._previous!=null&&this._previous.hasClass("e-disable")&&this._previous.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}):this._previous!=null&&this._previous.hasClass("e-enable")&&this._previous.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0}),n*this._thumbItems.children("li").outerWidth(!0)<(t-this._thumbCount)*this._thumbItems.children("li").outerWidth(!0)?this._next!=null&&this._next.hasClass("e-disable")&&this._next.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}):this._next!=null&&this._next.hasClass("e-enable")&&this._next.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0}))},_getMaxSize:function(n){for(var t=0,r=0,i=0,u=this,i=0;i<this._liCount;i++)r=this.element.children("li").eq(i)[n](),t=r>t?r:t;return t},_calculateValue:function(){return this._convertPercentageToPixel(this._containerWidth-(this.model.displayItemsCount-1)*parseInt(this.model.frameSpace),100/this.model.displayItemsCount)},_changeState:function(n){n?this.enable():this.disable()},_findActive:function(){var t,n;if(this.model.showPager){for(n=0;n<this._bullet.children("li").length;n++)if(this._bullet.children("li").eq(n).hasClass("e-active"))return n}else if(this.model.showThumbnail){for(n=0;n<this._thumbItems.children("li").length;n++)if(this._thumbItems.children("li").eq(n).hasClass("e-active"))return n}else this.model.showPager||this.model.showThumbnail||(t=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),t=this.model.circularMode?t-1:t);return t},_wireEvent:function(){if(!this.model.enabled)return!1;this._wrapper.on("mouseenter",n.proxy(this._showControl,this));this._wrapper.on("mouseleave",n.proxy(this._hideControl,this));this._wireKeyboardEvents();this._wireResizeEvents();this._wireTouchEvents()},_wireTouchEvents:function(){this.model.enableTouch&&this.model.orientation=="horizontal"?this._on(this._wrapper,"swiperight swipeleft",{control:!0},this._touchOperations):this.model.enableTouch&&this.model.orientation=="vertical"?this._on(this._wrapper,"swipeup swipedown",{control:!0},this._touchOperations):this._off(this._wrapper,"swiperight swipeleft swipeup swipedown",this._touchOperations);this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&this._on(this._thumb,"swiperight swipeleft",{control:!1},this._touchOperations)},_unwireTouchEvents:function(){this._off(this._wrapper,"swiperight swipeleft swipeup swipedown",this._touchOperations)},_wireKeyboardEvents:function(){if(this.model.allowKeyboardNavigation){this._outerWrapper.on("focusin",n.proxy(this._onFocusIn,this));this._outerWrapper.on("focusout",n.proxy(this._onFocusOut,this))}else this._outerWrapper.off("focusin",n.proxy(this._onFocusIn,this)),this._outerWrapper.off("focusout",n.proxy(this._onFocusOut,this))},_wireBtnEvents:function(){if(this.model.showNavigateButton){this._prevButton.on("click",n.proxy(this.model.enableRTL?this._nextAction:this._prevAction,this));this._nextButton.on("click",n.proxy(this.model.enableRTL?this._prevAction:this._nextAction,this))}else this._unwireBtnEvents()},_unwireBtnEvents:function(){this._prevButton.off("click",n.proxy(this.model.enableRTL?this._nextAction:this._prevAction,this));this._nextButton.off("click",n.proxy(this.model.enableRTL?this._prevAction:this._nextAction,this))},_wireAutoPlayEvents:function(){this.model.showPlayButton?this._on(this._autoButton,"click",this._autoPlay):this._off(this._autoButton,"click",this._autoPlay)},_wireResizeEvents:function(){if(this.model.isResponsive)n(window).on("resize",n.proxy(this._resizeEvent,this));else n(window).off("resize",n.proxy(this._resizeEvent,this))},_wireThumbEvents:function(){this.model.showThumbnail?(this._on(this._thumbItems.children(),"click",this._thumbClick),this._on(this._next,"click",this.model.enableRTL?this._thumbPrev:this._thumbNext),this._on(this._previous,"click",this.model.enableRTL?this._thumbNext:this._thumbPrev)):(this._off(this._thumbItems.children(),"click",this._thumbClick),this._off(this._next,"click",this.model.enableRTL?this._thumbPrev:this._thumbNext),this._off(this._previous,"click",this.model.enableRTL?this._thumbNext:this._thumbPrev))},_wireBulletEvents:function(){this.model.showPager?this._on(this._bullet.children(),"click",this._bulletClick):this._off(this._bullet.children(),"click",this._bulletClick)},_thumbNext:function(){var t=this,n;if(!this.model.enabled)return!1;this[this.model.enableRTL?"_next":"_previous"].hasClass("e-disable")&&this[this.model.enableRTL?"_next":"_previous"].removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1});n=-Math.round(this._thumbItems.position().left)+this._thumb.width();this._thumbItems.width()-n>=this._thumbItems.children("li").outerWidth(!0)&&this._thumbMove(this._thumbItems.children("li").outerWidth(!0));this._thumbItems.width()-n<=this._thumbItems.children("li").outerWidth(!0)&&this[this.model.enableRTL?"_previous":"_next"].removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0})},_thumbMove:function(n){var t=this;t._thumbItems.animate({left:"-="+n+"px"},600,function(){t._thumbItems.stop(!0,!0)})},_thumbPrev:function(){var i=this,t,n;if(!this.model.enabled)return!1;this[this.model.enableRTL?"_previous":"_next"].hasClass("e-disable")&&this[this.model.enableRTL?"_previous":"_next"].removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1});t=Math.round(this._thumbItems.position().left);n=this._thumbItems.children("li").outerWidth(!0);-t>=n&&this._thumbMove(-n);-t<=n&&this[this.model.enableRTL?"_next":"_previous"].removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0})},_findLength:function(){var t=this,n;return this.model.showThumbnail&&(n=t._thumbItems.children("li").length-1),this.model.showPager&&(n=t._bullet.children("li").length-1),this.model.showPager||this.model.showThumbnail||(n=this.model.circularMode?this.element[this.containerCss]()/this._liSize-this.model.displayItemsCount*2:this.element[this.containerCss]()/this._liSize-1),n},_changeActiveState:function(n){var t=this,i,r;i=t._findActive();r=t._findLength();t._removeActiveItem();n=="prev"?i>0?(t._setActiveItem(i-1),this.model.animationType!="slideshow"&&this._setCaptionText(i-1)):(t._setActiveItem(r),this.model.animationType!="slideshow"&&this._setCaptionText(r)):i<r?(t._setActiveItem(i+1),this.model.animationType!="slideshow"&&this._setCaptionText(i+1)):(t._setActiveItem(0),this.model.animationType!="slideshow"&&this._setCaptionText(0))},_moveSlide:function(n,t){var i=this,e,o,r,u,f={};e=this.model.animationType!="slideshow"?this.model.animationType:"slideshow";o=this.model.animationType!="slideshow"?i.model.animationSpeed:0;r=i._findActive();u=i._findLength();f[this.displayCss]=i.element.position()[i.displayCss];f[this.displayCss]-=n;r=t=="next"?r<u?r+1:0:t=="prev"?r>0?r-1:u:0;this._prevIndex=r;this.model.animationType=="slideshow"&&(i.element.fadeOut(i.model.animationSpeed/2),i.model.showCaption&&i._caption.fadeOut(i.model.animationSpeed/2));i.element.animate(f,o,e,function(){t=="end"&&i._setBegin();i._animating=!1;i._setCaptionText(r);i._raiseEvent("change")});this.model.animationType=="slideshow"&&(i.element.fadeIn(i.model.animationSpeed/2),i.model.showCaption&&i._caption.fadeIn(i.model.animationSpeed/2))},_moveNext:function(){var n=this,i,r,t,u;if(n._animating=!0,this.model.circularMode){if(i=Math.round(n.element.position()[n.displayCss]),r=n.model.displayItemsCount*n._liSize-n._liCount*n._liSize,t=Math.round(n.element.position()[n.displayCss])+n.element[n.containerCss](),n._calculateItemMove(),i>r&&t-n._containerSize>n._move+parseInt(n.model.frameSpace))return{move:n._move,action:"next"};if(t-n._containerSize<=n._move+parseInt(n.model.frameSpace))return u=t-n._containerSize-parseInt(n.model.frameSpace),{move:u,action:"end"}}else{if(i=Math.round(n.element.position()[n.displayCss]),r=-(n._liCount*n._liSize),t=Math.round(n.element.position()[n.displayCss])+n.element[n.containerCss](),n._calculateItemMove(),i-n._liSize!=r)return t-n._containerSize<=n._move+parseInt(n.model.frameSpace)&&(n._move=t-n._containerSize-parseInt(n.model.frameSpace),n._move=n._move==0?i:n._move),{move:n._move,action:"next"};if(t-n._containerSize<=n._move+parseInt(n.model.frameSpace))return{move:i,action:"end"}}},_movePrev:function(){var n=this,i,u,f,r;return i=Math.round(n.element.position()[n.displayCss]),u=n.element.position()[n.displayCss],+n.element[n.containerCss](),f=n.element[n.containerCss](),n._calculateItemMove(),this.model.circularMode?u<f&&-i>n.model.displayItemsCount*n._liSize?{move:-n._move,action:"prev"}:(r=n.model.displayItemsCount*n._liSize*2+i-n._liCount*n._liSize,n._move=(n._liCount-n.model.displayItemsCount*2)%n.model.navigateSteps*n._liSize,n._move==0&&n._calculateItemMove(),n.model.orientation==t.Orientation.Horizontal?n.element.css("left",r):n.element.css("top",r),{move:-n._move,action:"prev"}):u<f&&-i>=n._liSize*n.model.navigateSteps?{move:-n._move,action:"prev"}:(r=n.model.displayItemsCount*n._liSize+i-n._liCount*n._liSize,n._move=-i<n._move&&i!=0?-i:r,{move:-n._move,action:"prev"})},_autoPlay:function(n){var t=this,i,r;if(this._isInteraction=!!n,this._interval==null){this._setPlay();r=function(){t._animating=!0;i=t._rtlDirection?t._moveNext():t._movePrev();t._moveSlide(i.move,i.action);t._changeActiveState(i.action);t._changeThumbControl(t._findActive())};function u(n,t){return setInterval(n,t)}this._animating||(this._interval=u(r,this.transitionDelay))}else this._setPause()},_nextAction:function(n){var t=this,r,u,i;this._isInteraction=!!n;u=function(){i=t._moveNext();t._moveSlide(i.move,i.action);clearInterval(r);t._changeActiveState("next");t._changeThumbControl(t._findActive())};this._interval!=null&&this._setPause();this._animating||(this._animating=!0,r=setInterval(u,""));this._prevIndex=this.getIndex()},_prevAction:function(n){var t=this,r,u,i;this._isInteraction=!!n;u=function(){i=t._movePrev();t._moveSlide(i.move,i.action);clearInterval(r);t._changeActiveState("prev");t._changeThumbControl(t._findActive())};this._interval!=null&&this._setPause();this._animating||(this._animating=!0,r=setInterval(u,""));this._prevIndex=this.getIndex()},_touchOperations:function(n){var r=!n.data.control,t,i=this.model.orientation;r?t=n.type=="swipeleft"?"left":"right":i=="horizontal"&&n.type=="swipeleft"||i=="vertical"&&n.type=="swipeup"?t="left":(i=="horizontal"&&n.type=="swiperight"||i=="vertical"&&n.type=="swipedown")&&(t="right");t=="left"?r?this._thumbNext():this.slideNext():t=="right"&&(r?this._thumbPrev():this.slidePrevious())},_resizeEvent:function(){var n,t;if(!this.model.enabled)return!1;n=Math.round(-Math.round(this.element.position().left)/this._liSize);t=Math.round(this.element.parents(".e-rotator-wrap").parent().width());this._containerWidth=this._convertPercentageToPixel(t,this._containerPercent);this._setSlideWidth(this._calculateValue().toString());this._setWidth();this.element.css("left",-(n*this._liSize));this._setUlInitial();this.model.showThumbnail&&(this.model.dataSource!=null||this.model.thumbnailSourceID!=null)&&this._setThumbProperty()},_calculateItemMove:function(){isNaN(this.model.navigateSteps)?(this.model.navigateSteps=1,this._move=this._liSize*this.model.navigateSteps):this._move=this._liSize*this.model.navigateSteps},_thumbClick:function(t){var i,r;if(this._isInteraction=!0,r=this._autoButton!=null?this._autoButton.hasClass("play")?!1:!0:this.model.enableAutoPlay?!0:!1,!this.model.enabled)return!1;this._interval!=null&&this._setPause();this._removeActiveItem();i=t.target.className=="e-thumb-ele e-thumbhover"||t.target.className=="e-thumb-ele"?this._thumbItems.children("li").index(n(t.target)):this._thumbItems.children("li").index(n(t.target).parents(".e-thumb-ele"));this._changeThumbControl(i);this._setActiveItem(i);this._raiseEvent("thumbItemClick");this.model.circularMode?this._moveSlideContent(this.element.position()[this.displayCss],-(this.model.displayItemsCount*this._liSize+i*this.model.navigateSteps*this._liSize),i,r):this._moveSlideContent(this.element.position()[this.displayCss],-(i*this.model.navigateSteps*this._liSize),i,r)},_bulletClick:function(n){var t,i,r;if(this._isInteraction=!0,r=this._autoButton!=null?this._autoButton.hasClass("play")?!1:!0:this.model.enableAutoPlay?!0:!1,!this.model.enabled)return!1;this._interval!=null&&this._setPause();this._removeActiveItem();this._eventIndex=t=this._bullet.children("").index(n.target);this._changeThumbControl(t);this._setActiveItem(t);this._raiseEvent("pagerClick");this.model.circularMode?this._moveSlideContent(this.element.position()[this.displayCss],-(this.model.displayItemsCount*this._liSize+t*this.model.navigateSteps*this._liSize),t,r):(i=t*this.model.navigateSteps*this._liSize,this.element[this.containerCss]()-this.model.displayItemsCount*this._liSize<i&&(i=this.element[this.containerCss]()-this.model.displayItemsCount*this._liSize),this._moveSlideContent(this.element.position()[this.displayCss],-i,t,r))},_moveSlideContent:function(n,t,i,r,u){var f=this,o,s,e={};s=this.model.animationType!="slideshow"?this.model.animationType:"slideshow";o=this.model.animationType!="slideshow"?f.model.animationSpeed:0;e[this.displayCss]=f.element.position()[f.displayCss];e[this.displayCss]+=t-n;this.model.animationType=="slideshow"&&(f.element.fadeOut(f.model.animationSpeed/2),f.model.showCaption&&f._caption.fadeOut(f.model.animationSpeed/2));f.element.animate(e,o,s,function(){f._setCaptionText(i);r&&setTimeout(function(){f.play()},f.model.animationSpeed)});this.model.animationType=="slideshow"&&(f.element.fadeIn(f.model.animationSpeed/2),f.model.showCaption&&f._caption.fadeIn(f.model.animationSpeed/2));this._isInteraction=!u;this._prevIndex!=i&&f._raiseEvent("change");this._prevIndex=i},_destroy:function(){this._interval!=null?this.pause():"";this._undoClone();this.element.removeAttr("style").insertAfter(this._outerWrapper).removeClass();this.element.children().removeAttr("style");this._outerWrapper.remove();n(window).off("resize",n.proxy(this._resizeEvent,this));this.element.stop()},_raiseEvent:function(n){this.eventType=n;var t={activeItemIndex:this.getIndex(),itemID:this.element.attr("id")};return(n=="start"||n=="change"||n=="stop")&&(t={activeItemIndex:this.getIndex(),itemID:this.element.attr("id"),isInteraction:this._isInteraction}),this._trigger(n,t)},_showControl:function(n){if(!this.model.enabled)return!1;this.model.showNavigateButton&&(this._prevButton.stop(!0,!0).fadeIn("slow"),this._nextButton.stop(!0,!0).fadeIn("slow"));this.model.showPlayButton&&this._autoButton.stop(!0,!0).fadeIn("slow");this.model.showCaption&&this._caption!=null&&this._caption.stop(!0,!0).fadeIn("slow");this.model.stopOnHover&&this._animate&&this.pause();n.stopPropagation()},_hideControl:function(n){if(!this.model.enabled)return!1;this.model.showNavigateButton&&(this._prevButton.stop(!0,!0).fadeOut("slow"),this._nextButton.stop(!0,!0).fadeOut("slow"));this.model.showPlayButton&&this._autoButton.stop(!0,!0).fadeOut("slow");this.model.showCaption&&this._caption!=null&&this._caption.stop(!0,!0).fadeOut("slow");this.model.stopOnHover&&this._animate&&this.play();n.stopPropagation()},_onFocusIn:function(){if(!this.model.enabled)return!1;this._outerWrapper.addClass("e-Focused");this._innerWrapper.addClass("e-shadow");n(this._outerWrapper).on("keydown",n.proxy(this._focuseHandle,this))},_onFocusOut:function(){this._outerWrapper.removeClass("e-Focused");this._innerWrapper.removeClass("e-shadow");n(this._outerWrapper).off("keydown",n.proxy(this._focuseHandle,this))},_focuseHandle:function(n){if(!this.model.enabled)return!1;if(this._outerWrapper.hasClass("e-Focused")){n.keyCode=n.altKey&&(n.keyCode==37||n.keyCode==40)?1e3:n.keyCode;n.keyCode=n.altKey&&(n.keyCode==38||n.keyCode==39)?1001:n.keyCode;switch(n.keyCode){case 37:case 40:n.preventDefault();this._prevAction();break;case 38:case 39:n.preventDefault();this._nextAction();break;case 32:n.preventDefault();this._autoPlay(!0);break;case 1e3:n.preventDefault();this._thumbPrev();this._thumbHover("prev");break;case 1001:n.preventDefault();this._thumbNext();this._thumbHover("next");break;case 13:for(n.preventDefault(),i=0;i<this._thumbItems.children("li").length;i++)this._thumbItems.children("li").eq(i).hasClass("e-thumbhover")&&this.gotoIndex(i)}}},_thumbHover:function(n){var u=this,t=null,r;for(i=0;i<this._thumbItems.children("li").length;i++)if(this._thumbItems.children("li").eq(i).hasClass("e-thumbhover")){t=i;this._thumbItems.children("li").eq(i).removeClass("e-thumbhover");break}t==null&&(t=this._findActive());r=u._findLength();n=="prev"?t>0?this._thumbItems.children().eq(--t).addClass("e-thumbhover"):this._thumbItems.children().eq(0).addClass("e-thumbhover"):t<r?this._thumbItems.children().eq(++t).addClass("e-thumbhover"):this._thumbItems.children().eq(r).addClass("e-thumbhover")},_ieEnable:function(n){this.element[n]("e-disable");this.model.showPager&&this._bulletWrapper.children("ul.e-bullet")[n]("e-disable");this.model.showThumbnail&&this._thumbItems.children("li.e-thumb-ele")[n]("e-disable");this.model.showThumbnail&&(this._next[n]("e-disable"),this._previous[n]("e-disable"))},enable:function(){this.model.enabled||(this.model.enabled=!0,this._outerWrapper.removeClass("e-disable").attr({"aria-disabled":!1}),t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this._ieEnable("removeClass"),this._isPlaying&&this.play())},disable:function(){this.model.enabled&&(this.model.enabled=!1,this._outerWrapper.addClass("e-disable").attr({"aria-disabled":!0}),t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this._ieEnable("addClass"),this._isPlaying=this._interval!=null?!0:!1,this._interval!=null&&this._setPause())},updateTemplateById:function(i,r){var u,e,f;this.model.templateId!=null&&(n(this.element.children()[r]).empty(),u=n("#"+i),f=u[0]&&u[0].nodeName&&u[0].nodeName.toLowerCase()=="script"?t.getClearString(u[0].innerHTML):u,n(this.element.children()[r]).append(f),this.model.circularMode&&this.element.children("li").eq(r-1).hasClass("clone")&&(n(this.element.children()[this._liCount-1]).empty(),e=u[0].nodeName.toLowerCase()=="script"?f:f.clone(),n(this.element.children()[this._liCount-1]).append(e)))},slideNext:function(){this._nextAction(!1)},slidePrevious:function(){this._prevAction(!1)},play:function(){this._interval==null&&this._autoPlay()},pause:function(){this._interval!=null&&this._setPause(!0)},getIndex:function(){var n,i,r=[];if(this.model.displayItemsCount>1){if(this.model.circularMode)for(n=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),n=this.eventType!="pagerClick"&&t.isNullOrUndefined(this._prevIndex)?n-this.model.displayItemsCount:this._eventIndex?this._eventIndex:n,i=0;i<this.model.displayItemsCount;i++)n<this._liCount-this.model.displayItemsCount*2?r.push(n++):(n=0,i--);else for(n=Math.round(Math.round(this.element.position()[this.displayCss])/this._liSize),n=this._eventIndex?this._eventIndex:n,n=n<0?n*-1:n,i=0;i<this.model.displayItemsCount;i++)r.push(n++);return r}return this._findActive()},gotoIndex:function(n){var t=this._autoButton!=null?this._autoButton.hasClass("play")?!1:!0:this.model.enableAutoPlay?!0:!1;this._interval!=null&&this._setPause();this._removeActiveItem();this.model.showThumbnail&&this._changeThumbControl(n);this._setActiveItem(n);this.model.circularMode?this._moveSlideContent(this.element.position()[this.displayCss],-(this.model.displayItemsCount*this._liSize+n*this.model.navigateSteps*this._liSize),n,t,!0):(target=n*this.model.navigateSteps*this._liSize,this.element[this.containerCss]()-this.model.displayItemsCount*this._liSize<target&&(target=this.element[this.containerCss]()-this.model.displayItemsCount*this._liSize),this._moveSlideContent(this.element.position()[this.displayCss],-target,n,t,!0))}});t.Rotator.PagerPosition={TopLeft:"topleft",TopRight:"topright",BottomLeft:"bottomleft",BottomRight:"bottomright",TopCenter:"topCenter",Outside:"outside"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejSplitter","ej.Splitter",{element:null,model:null,validTags:["div","span"],_rootCSS:"e-splitter",_setFirst:!1,angular:{terminal:!1},defaults:{cssClass:"",orientation:"horizontal",enableAnimation:!0,properties:[],height:null,width:null,enableAutoResize:!1,isResponsive:!1,enableRTL:!1,allowKeyboardNavigation:!0,htmlAttributes:{},animationSpeed:300,beforeExpandCollapse:null,expandCollapse:null,resize:null,create:null,destroy:null},dataTypes:{cssClass:"string",orientation:"enum",properties:"data",enableAutoResize:"boolean",isResponsive:"boolean",enableRTL:"boolean",allowKeyboardNavigation:"boolean",animationSpeed:"number",enableAnimation:"boolean",htmlAttributes:"data"},_init:function(){this._initialize();this._render();this.model.isResponsive||this.model.enableAutoResize?this._wireEvents(!0):this._wireEvents(!1)},_setModel:function(n){for(var t in n)switch(t){case"cssClass":this._changeSkin(n[t]);break;case"enableAutoResize":this._windowResizing(n[t]);break;case"isResponsive":this._windowResizing(n[t]);break;case"enableRTL":this._rtl(n[t]);break;case"htmlAttributes":this._addAttr(n[t]);break;case"orientation":this._refreshSplitter("orientation",n[t]);break;case"properties":this._refreshSplitter("properties",n[t]);break;case"width":this.model.width=n[t];this._setHeightWidth();break;case"height":this.model.height=n[t];this._setHeightWidth()}},refresh:function(){this._setPanesSize();this._getPanesPercent()},collapse:function(n){this._clickArrow(n,!0,!0)},expand:function(n){this._clickArrow(n,!1,!0)},_clickArrow:function(t,i,r){if(this._inMovement||t<0||t>this.panes.length||this.panes.length<=1)return!1;var u,e=i?"e-collapse":"e-expand",f=this.element.children(".e-splitbar:not(.e-shadowbar)");if(u=t==f.length?this._clickArrow(t-1,!i,!1):n(f[t]).children("."+e),r)u.css("display")!="none"&&u.mousedown();else return u},addItem:function(i,r,u){var e=this.panes.length,d,r,f,g,a,k,it;if(u=this._getNumber(u),d=this.element[this.containerCss](),t.isNullOrUndefined(u)&&(u=e),u<0||u>e)return"";r=this._getPaneProperty(r);r=this._checkMinMaxSize(r);f=t.buildTag("div.e-pane e-"+this.model.orientation.substr(0,1)+"-pane");this.element.append(f[this.containerCss](r.paneSize));g=r.paneSize=f[this.containerCss]();e==0&&this.panes.push(f);f.remove();var v=u,nt=e>0?e:this.panes.length,o,y,p,w,s={},c=0,l=!1;for(a=g+this._bar,y=0;y<2;y++){for(o=v;o<nt;o++){var tt=n(this.panes[o])[this.containerCss](),b=t.isNullOrUndefined(this.model.properties[o])?r.minSize:this.model.properties[o].minSize,h=tt-b;if(h>=a-c){s[o]=tt-(a-c);l=!0;break}else e==0&&h>=0?(s[o]=b,c+=h,l=!0):h>0&&(s[o]=b,c+=h)}if(l)break;else nt=v,v=0}if(!l)return"";for(k in s)n(this.panes[k])[this.containerCss](s[k]);return e<=0?f.append(n(this.panes[u])):u==e?(p="insertBefore",w=1,f.insertAfter(n(this.panes[u-1]))):(p="insertAfter",w=0,f.insertBefore(n(this.panes[u]))),this.model.properties.splice(u,0,r),e==0&&this.element.append(f[this.containerCss](d)),e>0&&(this.panes.splice(u,0,f),it=this._createSplitBar(u-w),it[p](f)),f.append(i),this._updateModel(),f},removeItem:function(i){var r=this.panes.length-1,f,u,e,o;if(i=this._getNumber(i),t.isNullOrUndefined(i)&&(i=r),i<0||i>r||r<0)return null;f=n(this.panes[i]);o=f[this.containerCss]()+this._bar;f.remove();e=this.element.children(".e-splitbar:not(.e-shadowbar)");i==r?(u=n(this.panes[i-1]),n(e[i-1]).remove()):(u=n(this.panes[i+1]),n(e[i]).remove());u[this.containerCss](u[this.containerCss]()+o);this._removeArrays(i);this._updateModel()},_checkMinMaxSize:function(n){return!t.isNullOrUndefined(n.minSize)&&n.paneSize<n.minSize&&(n.paneSize=n.minSize),!t.isNullOrUndefined(n.maxSize)&&n.paneSize>n.maxSize&&(n.paneSize=n.maxSize),n},_removeArrays:function(n){this.model.properties.splice(n,1);this.panes.splice(n,1);this.oldPaneSize.splice(n,1);this.oldPanePercent.splice(n,1);this._sizePercent.splice(n,1)},_getNumber:function(n){return n=parseFloat(n),isNaN(n)?null:n},_updateModel:function(){for(var t=0;t<this.panes.length;t++)this.model.properties[t].paneSize=n(this.panes[t])[this.containerCss]();this._getPanesPercent()},_getPaneProperty:function(t){return n.extend({paneSize:10,minSize:10,maxSize:null,collapsible:!0,resizable:!0,expandable:!0},t)},_changeSkin:function(n){this.element.removeClass(this.model.cssClass).addClass(n)},_windowResizing:function(n){n?this._wireEvents(n):this._unWireEvents()},_refreshSplitter:function(n,t){this._unWireEvents();this._refreshDestroy();this.model[n]=t;this._init()},_destroy:function(){this.element.removeClass("e-splitter");this._refreshDestroy();this._unWireEvents()},_refreshDestroy:function(){this.element.removeClass("e-widget e-box e-rtl"+this.model.cssClass+" e-"+this.model.orientation);this.element.children(".e-splitbar").remove();this.element.children(".e-pane").removeClass("e-pane e-"+this.model.orientation.substr(0,1)+"-pane").height("").width("")},_initialize:function(){this.panes=[];this.oldPaneSize=[];this.oldPanePercent=[];this.shadowBar=null;this._inMovement=!1;this.containerCss=this.model.orientation=="horizontal"?"width":"height";this.displayCss=this.model.orientation=="horizontal"?"left":"top";this.borderCss=this.model.orientation=="horizontal"?"right":"bottom";this._bar=9},_render:function(){this.element.addClass("e-widget e-box "+this.model.cssClass+" e-"+this.model.orientation).attr("data-role","splitter");for(var i=this.element[0],t=0,r=0;t<i.children.length;t++)n(i.children[t]).addClass("e-pane"),this.panes.push(i.children[t]);this._setPanesProperty();this._insertSplitBar();this._setDimentions();this._setPanesSize();this._getPanesPercent();this._addAttr(this.model.htmlAttributes);this._checkProperties();this.element.find(".e-pane").addClass("e-"+this.model.orientation.substr(0,1)+"-pane");this.model.isResponsive&&(isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&this.element.css("height",this.model.height),isNaN(this.model.width)&&this.model.width.indexOf("%")>0&&this.element.css("width",this.model.width))},_setPanesProperty:function(){for(var n=0;n<this.panes.length;n++)this.model.properties[n]!=i?(this.model.properties[n].paneSize=this.model.properties[n].paneSize==i?"0px":this.model.properties[n].paneSize,this.model.properties[n].minSize=isNaN(parseFloat(this.model.properties[n].minSize))?10:parseFloat(this.model.properties[n].minSize),this.model.properties[n].maxSize=isNaN(parseFloat(this.model.properties[n].maxSize))?null:parseFloat(this.model.properties[n].maxSize),this.model.properties[n].collapsible=this.model.properties[n].collapsible!=!1?!0:!1,this.model.properties[n].resizable=this.model.properties[n].resizable!=!1?!0:!1,this.model.properties[n].expandable=this.model.properties[n].expandable!=!1?!0:!1):this.model.properties.push({paneSize:"0px",minSize:10,maxSize:null,collapsible:!0,resizable:!0,expandable:!0})},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n)})},_insertSplitBar:function(){if(this.panes.length>1)for(var t,n=0;n<this.panes.length-1;n++)t=this._createSplitBar(n),t.insertAfter(this.panes[n])},_createSplitBar:function(n){var r=this.model.orientation.substr(0,1),f,u,e,i,o=!1;return i=t.buildTag("span.e-box e-splitbar e-split-divider e-"+r+"-bar").attr("aria-expanded",!0),t.browserInfo().name=="msie"&&i.addClass("e-pinch"),f=t.buildTag("span.e-icon e-collapse e-"+r+"-arrow "+(r=="h"?"e-arrow-sans-left":"e-arrow-sans-up")),i.append(f),e=t.buildTag("span.e-activebar e-"+r+"-arrow "),i.append(e),u=t.buildTag("span.e-icon e-expand e-"+r+"-arrow "+(r=="h"?"e-arrow-sans-right":"e-arrow-sans-down")),i.append(u),o=!0,this._on(f,"mousedown",this._collapseArrowClick),this._on(u,"mousedown",this._expandArrowClick),this.model.properties[n].collapsible||f.css("display","none"),this.model.properties[n].expandable||u.css("display","none"),this.model.properties[n+1].collapsible&&u.css("display","block"),this.model.properties[n].resizable&&this.model.properties[n+1].resizable&&(i.addClass("e-resize").removeClass("e-icon-hide"),o=!0,this._on(i,t.eventType.mouseDown,this._mouseDownOnDivider),this._on(e,t.eventType.mouseDown,this._mouseDownOnDivider)),o?(i.attr({role:"separator",tabindex:"0"}),this._on(i,"focus focusout",this._focusOnDivider)):i.attr({role:"presentation"}),i},_getPanesPercent:function(){this._sizePercent=[];for(var r=this.element[this.containerCss](),i=r-(this.panes.length-1)*this._bar,t=0;t<this.panes.length;t++)n(this.panes[t]).hasClass("collapsed")||(this.oldPaneSize[t]=n(this.panes[t])[this.containerCss]()),this.oldPanePercent[t]=this._convertToPercent(i,this.oldPaneSize[t]),this._sizePercent.push(this._convertToPercent(i,n(this.panes[t])[this.containerCss]()))},_setDimentions:function(){var i=this._getParentObj(),n=parseInt(this.model.width),t=parseInt(this.model.height);isNaN(this.model.width)&&this.model.width.indexOf("%")>0&&(n=this.model.isResponsive?this._convertToPixel(i.innerWidth(),n):this.model.width);isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&(t=this.model.isResponsive?this._convertToPixel(i.innerHeight(),t):this.model.height);this.model.height&&this.element.css("height",t);this.model.width&&this.element.css("width",n)},_setHeightWidth:function(){this._setDimentions();this._setPanesSize();this._getPanesPercent()},_getParentObj:function(){return this.element.parent()},_checkProperties:function(){this.model.enableRTL&&this._rtl(this.model.enableRTL);this._prevSize=this.element[this.containerCss]()},_getExactInnerWidth:function(){var i=t.browserInfo();return i.name=="msie"?i.version==8?n(this.element)[this.containerCss]():parseFloat(window.getComputedStyle(this.element[0])[this.containerCss]):parseFloat(window.getComputedStyle(this.element[0])[this.containerCss])-(parseFloat(this.element.css("border-"+this.displayCss+"-width"))+parseFloat(this.element.css("border-"+this.borderCss+"-width"))+parseFloat(this.element.css("padding-"+this.displayCss))+parseFloat(this.element.css("padding-"+this.borderCss)))},_rtl:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_setPanesSize:function(){var r=this.containerCss,v=0,u=0,o=this.element[r](),b=!1,s=this._bar=n(this.element).find(">.e-splitbar").length>0?parseFloat(n(this.element).find(">.e-splitbar").css(r)):this._bar,p=[],e,i,f=this.panes.length,y,k,c,h,l,w,a;if(f>1)for(i=0;i<f;i++)n(this.panes[i]).css(r,this.model.properties[i].paneSize),s=i==f-1?0:s,e=parseFloat(n(this.panes[i])[r]()),t.isNullOrUndefined(this.model.properties[i].maxSize)||(e=e>this.model.properties[i].maxSize?this.model.properties[i].maxSize:e),n(this.panes[i]).css(r,e),e<=0?(v++,p.push(i),u+=s):b?(n(this.panes[i]).css(r,0),u+=e+s,this.model.properties[i].paneSize=0):(u+=e+s,u>o&&(y=u-o+s,k=f-i-1,y+=k*s,n(this.panes[i]).css(r,y),b=!0,u+=y+s),this.model.properties[i].paneSize=e);else f==1&&(n(this.panes[0]).css(r,"100%"),u=o);if(f>1&&u!=o)if(h=n(this.panes[f-1]),u>o)c=u-o,h.css(r,c);else if(u<o)if(c=o-u,v>0)for(w=parseFloat(c/v),l=0;l<v;l++)n(this.panes[p[l]]).css(r,w),this.model.properties[p[l]].paneSize=w;else{for(a=f;a>0;a--)if(t.isNullOrUndefined(this.model.properties[a-1].maxSize)){h=n(this.panes[a-1]);break}h.css(r,parseFloat(h[r]()+c));this.model.properties[f-1].paneSize=h[r]()}f>1&&this._checkPaneSize()},_getUnit:function(n){return n=="px"?"px":n=="pt"?"pt":n.substr(1)=="%"?"%":"px"},_getNormalValue:function(n){var i,t,r,u;return this.model.orientation=="vertical"?(i=n.y-this.element.offset().top,t=i/this.element.outerHeight(),r=this.element.height()):(i=n.x-this.element.offset().left,t=i/this.element.outerWidth(),r=this.element.width()),t>1&&(t=1),t<0&&(t=0),u=t*r,this._trimValue(u)},_trimValue:function(n){var t,i,r;return t=1,i=n%t,r=n-i,Math.abs(i)*2>=t&&(r+=i>0?t:-t),parseFloat(r.toFixed(5))},_getSplitbarIndex:function(){return this.element.children(".e-splitbar:not(.e-shadowbar)").index(this.currentSplitBar)},_paneResize:function(){var t,i,r,u,f,e,o,s;if(this.shadowBar==null)return!1;this.currentSplitBar=this.shadowBar.next();e=this._getSplitbarIndex();i=this.shadowBar.prev();r=this.currentSplitBar.next();u=e;f=e+1;t=this.shadowBar.offset()[this.displayCss];t=t-this.currentSplitBar.offset()[this.displayCss];n(i).css(this.containerCss,t+n(i)[this.containerCss]()+"px");n(r).css(this.containerCss,n(r)[this.containerCss]()-t+"px");this.oldPaneSize[u]=n(i)[this.containerCss]();this.oldPaneSize[f]=n(r)[this.containerCss]();this.shadowBar.remove();this._checkPaneSize();o={item:i,index:u,size:this.oldPaneSize[u]};s={item:r,index:f,size:this.oldPaneSize[f]};this._updateModelValue(o,s);this._trigger("resize",{prevPane:o,nextPane:s,splitbarIndex:e})},_checkPaneSize:function(){for(var r=0,e,f,i=this.panes.length,t=0;t<i;t++)e=this.containerCss=="width"?n(this.panes[t]).outerWidth():n(this.panes[t]).outerHeight(),r+=e+this._bar;if(r-=this._bar,f=this._getExactInnerWidth(),r!=f){var o=f-r,u=n(this.panes[i-1])[this.containerCss](),s=parseFloat(n(this.panes[i-1]).css("border-left-width"))+parseFloat(n(this.panes[i-1]).css("border-right-width")),h=s>0?s:1;if(u==0){for(t=i-1;t>=0;t--)if(n(this.panes[t]).hasClass("expanded")&&!n(this.panes[t]).hasClass("collapsed")){u=n(this.panes[t])[this.containerCss]();n(this.panes[t]).css(this.containerCss,parseFloat(u+o));break}}else n(this.panes[i-1]).css(this.containerCss,parseFloat(u+o-h))}},_maxminDraggableRange:function(n){var l,a,v,y,o,r,u,f,e,t,i,s,h,c;l=this.shadowBar.prev();this.currentSplitBar=this.shadowBar.next();a=this.currentSplitBar.next();v=l[this.containerCss]();y=a[this.containerCss]();o=this.displayCss=="left"?this.currentSplitBar[0].offsetLeft:this.currentSplitBar[0].offsetTop;r=o-v;u=y+o;c=this._getSplitbarIndex();f=c;e=c+1;t=this.model.properties[f].maxSize;i=this.model.properties[e].maxSize;t=t!=null?parseInt(t,10):null;i=i!=null?parseInt(i,10):null;this.model.properties[f].minSize=parseInt(this.model.properties[f].minSize,10);this.model.properties[e].minSize=parseInt(this.model.properties[e].minSize,10);s=this.model.properties[f].minSize;h=this.model.properties[e].minSize;this.shadowBar.removeClass("e-end-indicaton");n>u-h?(this.resizedPosition=u-h,this.shadowBar.addClass("e-end-indicaton")):n<r+s&&(this.resizedPosition=r+s,this.shadowBar.addClass("e-end-indicaton"));t!=null?n>r+t&&(this.resizedPosition=r+t,this.shadowBar.addClass("e-end-indicaton")):i!=null&&n<u-i&&(this.resizedPosition=u-i,this.shadowBar.addClass("e-end-indicaton"))},_collapseArrowClick:function(t){var i,o,r,u,s,e,h,y,f,w,p,l,a,v,c;if(this.shadowBar==null){if(i=n(t.target),this._inMovement=!0,this.currentSplitBar=i.parent(),f={},w=this.panes.length,o=this._getSplitbarIndex(),r=this.currentSplitBar.prev(),u=this.currentSplitBar.next(),s=o,e=o+1,h=r[this.containerCss](),y=u[this.containerCss](),p=this,l={item:r,index:s,size:h},a={item:u,index:e,size:y},this._raiseEvent("beforeExpandCollapse",l,a,o))return!1;if(u.hasClass("collapsed")){if(h<this.oldPaneSize[e]){i.addClass("e-end-indicaton");this._inMovement=!1;n(document).on("mouseup",n.proxy(this._mouseUpOnArrow,this));return!1}r.removeClass("expanded");u.removeClass("collapsed");i.parent().addClass("e-resize").removeClass("e-icon-hide");n(i.siblings()).not(".e-activebar").css("display","block");this.model.properties[s].collapsible||i.css("display","none");e!=w-1&&(c=u.next(),this.model.properties[e+1].collapsible||c.find(".e-expand").css("display","none"),c.find(".e-collapse").css("display","block"),c.next().hasClass("collapsed")||(c.addClass("e-resize").removeClass("e-icon-hide"),c.attr("aria-expanded",!0)));f[this.containerCss]=this.oldPaneSize[e];u.animate(f,this.model.enableAnimation?this.model.animationSpeed:0);f[this.containerCss]=h-this.oldPaneSize[e];r.animate(f,this.model.enableAnimation?this.model.animationSpeed:0,function(){p._raiseEvent("expandCollapse",l,a,o)})}else this.oldPaneSize[s]=h,r.addClass("collapsed"),u.addClass("expanded"),this.currentSplitBar.attr("aria-expanded",!1),i.parent().removeClass("e-resize").addClass("e-icon-hide"),i.css("display","none"),this.model.properties[e].collapsible||n(i.siblings()).not(".e-activebar").css("display","block"),s!=0&&(v=r.prev(),v.find(".e-expand").css("display","none"),!this.model.properties[s-1].collapsible&&n(r.prev().prev()[0]).hasClass("expanded")&&v.find(".e-collapse").css("display","block"),v.removeClass("e-resize").addClass("e-icon-hide")),f[this.containerCss]=0,r.animate(f,this.model.enableAnimation?this.model.animationSpeed:0),f[this.containerCss]=h+y,u.animate(f,this.model.enableAnimation?this.model.animationSpeed:0,function(){p._raiseEvent("expandCollapse",l,a,o)})}},_expandArrowClick:function(t){var i,e,r,u,o,s,y,h,f,w,p,a,v,c,l;if(this.shadowBar==null){if(i=n(t.target),this._inMovement=!0,this.currentSplitBar=i.parent(),f={},w=this.panes.length,e=this._getSplitbarIndex(),r=this.currentSplitBar.prev(),u=this.currentSplitBar.next(),o=e,s=e+1,y=r[this.containerCss](),h=u[this.containerCss](),p=this,a={item:u,index:s,size:h},v={item:r,index:o,size:y},this._raiseEvent("beforeExpandCollapse",a,v,e))return!1;if(r.hasClass("collapsed")){if(h<this.oldPaneSize[o]){i.addClass("e-end-indicaton");this._inMovement=!1;n(document).on("mouseup",n.proxy(this._mouseUpOnArrow,this));return!1}r.removeClass("collapsed");u.removeClass("expanded");this.currentSplitBar.attr("aria-expanded",!0);i.parent().addClass("e-resize").removeClass("e-icon-hide");n(i.siblings()).not(".e-activebar").css("display","block");this.model.properties[s].collapsible||i.css("display","none");o!=0&&(l=r.prev(),this.model.properties[e-1].collapsible||l.find(".e-collapse").css("display","none"),l.find(".e-expand").css("display","block"),l.prev().hasClass("collapsed")||l.addClass("e-resize").removeClass("e-icon-hide"));f[this.containerCss]=this.oldPaneSize[o];r.animate(f,this.model.enableAnimation?this.model.animationSpeed:0);f[this.containerCss]=h-this.oldPaneSize[o];u.animate(f,this.model.enableAnimation?this.model.animationSpeed:0,function(){p._raiseEvent("expandCollapse",a,v,e)})}else this.oldPaneSize[s]=h,r.addClass("expanded"),u.addClass("collapsed"),i.parent().removeClass("e-resize").addClass("e-icon-hide"),i.css("display","none"),this.model.properties[o].collapsible||n(i.siblings()).not(".e-activebar").css("display","block"),s!=w-1&&(c=u.next(),c.find(".e-collapse").css("display","none"),!this.model.properties[s+1].collapsible&&n(u.next().next()[0]).hasClass("collapsed")&&c.find(".e-expand").css("display","block"),c.removeClass("e-resize").addClass("e-icon-hide"),c.attr("aria-expanded",!1)),f[this.containerCss]=y+h,r.animate(f,this.model.enableAnimation?this.model.animationSpeed:0),f[this.containerCss]=0,u.animate(f,this.model.enableAnimation?this.model.animationSpeed:0,function(){p._raiseEvent("expandCollapse",a,v,e)})}},_raiseEvent:function(n,t,i,r){return n=="expandCollapse"&&(this._inMovement=!1,this._updateModelValue(t,i)),this._trigger(n,{collapsed:t,expanded:i,splitbarIndex:r})},_updateModelValue:function(n,t){this.model.properties[n.index].paneSize=n.item[this.containerCss]();this.model.properties[t.index].paneSize=t.item[this.containerCss]();this._getPanesPercent()},_mouseUpOnArrow:function(){this.element.find(".e-end-indicaton").removeClass("e-end-indicaton");n(document).off("mouseup",n.proxy(this._mouseUpOnArrow,this))},_keydownOnDivider:function(t){var i=t.keyCode,u,r;if(i==37||i==38||i==39||i==40){if(t.preventDefault(),u=n(t.data.target),t.ctrlKey)this.shadowBar==null&&(this.currentSplitBar=u,r=this._getSplitbarIndex(),this.model.orientation=="vertical"?t.keyCode==38?this.collapse(r):t.keyCode==40&&this.expand(r):t.keyCode==37?this.collapse(r):t.keyCode==39&&this.expand(r));else if(u.hasClass("e-resize")){var e=this.shadowBar!=null?this.shadowBar:u,f=e.offset(),o={pageX:f.left,pageY:f.top};n.extend(!0,t,o);(this.model.orientation=="vertical"&&(t.keyCode==38||t.keyCode==40)||this.model.orientation=="horizontal"&&(t.keyCode==37||t.keyCode==39))&&(t.keyCode==38?t.pageY-=5:t.keyCode==40?t.pageY+=5:t.keyCode==37?t.pageX-=5:t.keyCode==39&&(t.pageX+=5),this._mouseMoveOnDivider(t))}}else i==13?(t.preventDefault(),this._mouseUpOnDivider()):i==27&&(t.preventDefault(),this.shadowBar!=null&&this.shadowBar.remove(),this.shadowBar=null,this._mouseUpOnDivider(),this.element.children(".e-splitbar.e-hover").focusout())},_focusOnDivider:function(t){if(t.type=="focus"){if(!n(t.target).hasClass("e-hover")&&(n(t.target).addClass("e-hover"),this.model.allowKeyboardNavigation))n(document).on("keydown",{target:t.target},n.proxy(this._keydownOnDivider,this))}else this.element.children(".e-splitbar.e-hover").removeClass("e-hover"),this._mouseUpOnDivider(),n(document).off("keydown",n.proxy(this._keydownOnDivider,this))},_mouseDownOnDivider:function(i){i.preventDefault();var r;if(r=n(i.target).hasClass("e-activebar")?n(i.target.parentElement):n(i.target),r.hasClass("e-splitbar")&&r.hasClass("e-resize")){this._overlayElement=t.buildTag("div.e-pane-overlay");r.hasClass("e-hover")||r.focus();this.element.find(".e-pane").not(".e-splitter").append(this._overlayElement);n(document).on(t.eventType.mouseMove,{target:n(i.target).hasClass("e-activebar")?i.target.parentElement:i.target},n.proxy(this._mouseMoveOnDivider,this));n(document).on(t.eventType.mouseUp,n.proxy(this._mouseUpOnDivider,this));n(document).on("mouseleave",n.proxy(this._mouseUpOnDivider,this))}else(r.hasClass("e-expand")||r.hasClass("e-collapse"))&&r.parent().focus()},_mouseMoveOnDivider:function(t){var i=t.data,u,r;t=t.type=="touchmove"?t.originalEvent.changedTouches[0]:t;u={x:t.pageX,y:t.pageY};this.resizedPosition=this._getNormalValue(u);this.shadowBar==null&&(r=n(i.target).hasClass("e-activebar")?n(i.target.parentElement):n(i.target),this.shadowBar=r.clone().addClass("e-shadowbar").removeClass("e-hover").removeClass("e-split-divider").insertBefore(r),this.shadowBar.children().remove());this._maxminDraggableRange(this.resizedPosition);this.shadowBar.css(this.displayCss,this.resizedPosition)},_mouseUpOnDivider:function(){this._paneResize();this.element.find(".e-pane").not(".e-splitter").find(".e-pane-overlay").remove();n(document).off(t.eventType.mouseMove,n.proxy(this._mouseMoveOnDivider,this));n(document).off(t.eventType.mouseUp,n.proxy(this._mouseUpOnDivider,this));n(document).off("mouseleave",n.proxy(this._mouseUpOnDivider,this));this.shadowBar=null},_windowResized:function(){var i=this._getExactInnerWidth(),r,u,t,f;if(this._prevSize==i)return!1;for(r=this.panes.length,u=i-(r-1)*this._bar,this._prevSize=i,t=0;t<r;t++)f=this._convertToPixel(u,this._sizePercent[t]),n(this.panes[t]).css(this.containerCss,f+"px");for(t=0;t<this.oldPaneSize.length;t++)this.oldPaneSize[t]=this._convertToPixel(u,this.oldPanePercent[t]);this._checkPaneSize()},_convertToPercent:function(n,t){return t*100/n},_convertToPixel:function(n,t){return parseFloat(n*t/100)},_wireEvents:function(t){if(t)n(window).on("resize",n.proxy(this._windowResized,this))},_unWireEvents:function(){n(window).off("resize",n.proxy(this._windowResized,this))}})}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};Print=function(n){function t(t,i){return n.call(this),this._rootCSS="e-print",this.PluginName="ejPrint",this.id="null",this.defaults={globalStyles:!0,externalStyles:null,excludeSelector:null,append:null,printInNewWindow:!1,prepend:null,timeOutPeriod:1e3,title:null,height:454,width:1024,docType:"<!doctype html>",beforeStart:null},t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejPrint(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype._init=function(){this.id=this.element[0].id;this._initialize(this.element,undefined)},t.prototype._initialize=function(n,t){var o,f,i,r,u,e;if(this.styles=$(""),this.title=$("title"),this.model.globalStyles&&this._addglobalStyles(this.model.globalStyles),this.model.externalStyles&&this._addStylesToElement(this.model.externalStyles),this.model.title&&this._addTitleToElement(this.model.title),o=$("<html/>"),f=$("<head/>").append(this.title),f.append(this.styles.clone()),i=$("<body/>"),r=$("<div/>"),t){if(typeof n=="string")n=$(n),r.append(n.clone());else if(typeof n=="object")for(u=0;u<n.length;u++)r.append($(n[u]).clone())}else r.append(n.clone());return(this.copy=r,i.append(this.copy),this.model.append&&i.append(this._getjQueryObject(this.model.append)),this.model.prepend&&i.prepend(this._getjQueryObject(this.model.prepend)),this.copy=o.append(f).append(i),this.model.excludeSelector!=null&&this._removeContentFromPrint(this.model.excludeSelector),e=this.copy,this.copy.remove(),t===undefined)?(this._printContent(e,null,!1),!0):e},t.prototype._getjQueryObject=function(n){return $(n).clone().length===0?$("<div />").html(n):$(n).clone()},t.prototype._addglobalStyles=function(){this.model.globalStyles&&(this.styles=$("style, link, meta, title"))},t.prototype._addStylesToElement=function(n){var i,t,r;if(this.model.externalStyles)for(i=$.isArray(n)?n:n.split(","),t=0;t<i.length;t++)r=$("<link rel='stylesheet' href='"+i[t]+"'>"),this.styles=$.merge(this.styles,r)},t.prototype._addTitleToElement=function(){this.model.title&&(this.title.length===0&&(this.title=$("<title />")),this.title.text(this.model.title))},t.prototype._removeContentFromPrint=function(n){var i,t;if(this.model.excludeSelector)for(i=$.isArray(n)?n:n.split(","),t=0;t<i.length;t++)this.copy.find(i[t]).remove()},t.prototype._printContent=function(n,t,i){var e=this,r,u,f;if(i){if(u=[],this.element.attr("id")!==undefined?u.push("#"+this.element.attr("id")):u.push("."+this.element.attr("class").replace(/ /g,".")),n!==undefined)if($.isArray(n))for(f=0;f<n.length;f++)u.push(n[f]);else u.push(n);n=this._initialize(u,!0)}this._trigger("beforeStart",{content:n});t||(r=this.model.printInNewWindow?window.open():window.open(" ","print","height="+this.model.height+",width="+this.model.width+",tabbar=no"));r.document.write(this.model.docType);r.document.write(n[0].outerHTML);r.document.close();r.focus();setTimeout(function(){ej.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},e.model.timeOutPeriod))},this.model.timeOutPeriod)},t.prototype.print=function(n,t){this._printContent(n,t,!0)},t}(ej.WidgetBase);window.ej.widget("ejPrint","ej.Print",new Print),function(n,t,i){t.widget("ejTab","ej.Tab",{_rootCSS:"e-tab",element:null,model:null,validTags:["div","span"],_addToPersist:["selectedItemIndex"],_setFirst:!1,angular:{terminal:!1},defaults:{collapsible:!1,enableAnimation:!0,ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},disabledItemIndex:[],enabledItemIndex:[],hiddenItemIndex:[],events:"click",idPrefix:"ej-tab-",heightAdjustMode:"content",selectedItemIndex:0,cssClass:"",showCloseButton:!1,htmlAttributes:{},enableTabScroll:!1,showReloadIcon:!1,headerPosition:"top",width:null,height:null,headerSize:null,enableRTL:!1,allowKeyboardNavigation:!0,showRoundedCorner:!1,enablePersistence:!1,enabled:!0,ajaxLoad:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,itemActive:null,beforeActive:null,itemAdd:null,itemRemove:null,beforeItemRemove:null,create:null,destroy:null},dataTypes:{cssClass:"string",collapsible:"boolean",events:"string",heightAdjustMode:"enum",enabled:"boolean",ajaxSettings:"data",disabledItemIndex:"data",enabledItemIndex:"data",enableAnimation:"boolean",htmlAttributes:"data"},observables:["selectedItemIndex"],selectedItemIndex:t.util.valueFunction("selectedItemIndex"),_destroy:function(){this._unWireEvents();this._removeBaseClass()},_setModel:function(i){for(var r in i)switch(r){case"events":this._off(this.items,this.model.events);this._on(this.items,i[r],this._tabItemClick);break;case"disabledItemIndex":this._disableItems(i[r]);i[r]=this.model.disabledItemIndex;break;case"enabledItemIndex":this._enableItems(i[r]);break;case"enabled":this._enabledAction(i[r]);break;case"selectedItemIndex":this._isInteraction=!1;this.showItem(t.util.getVal(i[r]));i[r]=this.model.selectedItemIndex;break;case"heightAdjustMode":this.model.heightAdjustMode=i[r];this._setTabsHeightStyle(i[r]);this._resizeEvents(i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"height":this.model.height=i[r];this._setTabsHeightStyle(this.model.heightAdjustMode);break;case"width":this.element.width(i[r]);n(this.contentPanels).width(Number(i[r]));this.refreshTabScroll();break;case"headerSize":this._setHeaderSize(i[r]);break;case"allowKeyboardNavigation":i[r]?this._on(this.element,"keydown",this._keyPress):this._off(this.element,"keydown");break;case"headerPosition":this.model.headerPosition=i[r];this.model.headerPosition==t.Tab.Position.Top?(this._removeVerticalClass(),this._removeScroll(),this.itemsContainer.remove(),this.itemsContainer.insertBefore(this.element.find(">div").first()),this.element.find("div.e-active-content").removeClass("e-activebottom"),n(this.contentPanels).css("margin-top","0")):this.model.headerPosition==t.Tab.Position.Bottom?(this._removeVerticalClass(),this._removeScroll(),this.element.find("div.e-active-content").removeClass("e-activetop"),this.model.enableTabScroll?n(this.contentPanels).css("margin-top","0"):n(this.contentPanels).css("position","relative")):(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._removeHeaderClass(),n(this.items).css("display",""),this._removeScroll());this._refresh();this.model.headerPosition==t.Tab.Position.Right&&this.element.css("position","");(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick),this.model.height&&this.model.enableTabScroll&&(n(this.contentPanels).height(Number(this.model.height)-2),this.element.find("div.e-active-content").height(Number(this.model.height)-32)));this.scrollstep=30;break;case"showCloseButton":i[r]?(this._addDeleteIcon(),this._on(this.element.find("div.e-close"),"click",this._tabDeleteClick)):this.element.find("div.e-close").remove();break;case"enableTabScroll":this.model.enableTabScroll=i[r];i[r]?(this._removeScroll(),this._addScroll(),this.model.headerPosition=="left"&&(this._refresh(),this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick))):(this._removeScroll(),this.itemsContainer.removeAttr("style"),n(this.contentPanels).css("margin-top","0"));(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._refresh(),this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick),this.model.headerPosition!=t.Tab.Position.Right||this.model.enableTabScroll||this.element.css("margin-left",""));break;case"showReloadIcon":i[r]?this._addReloadIcon():this.element.find("div.e-reload").remove();break;case"enableRTL":this.model.enableRTL=i[r];this._removeScroll();this.itemsContainer.removeAttr("style");n(this.contentPanels).css("margin-top","0");this.element.find("ul").removeAttr("style");i[r]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this.model.enableTabScroll&&this._addScroll();this._refresh();this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick);this.model.headerPosition==t.Tab.Position.Right&&this.model.enableRTL&&this.element.css("margin-left","");break;case"htmlAttributes":this._addAttr(i[r]);break;case"hiddenItemIndex":this.model.headerPosition==t.Tab.Position.Top||this.model.headerPosition==t.Tab.Position.Bottom?n(this.items).css("display","inline-block"):n(this.items).css("display","");this.model.hiddenItemIndex=i[r];this.model.hiddenItemIndex.length>0&&this._hiddenIndexItem(this.model.hiddenItemIndex)}},_removeScroll:function(){this.itemsContainer.removeAttr("style");this.element.find("div.e-chevron-circle-right").remove();this.element.find("div.e-chevron-circle-left").remove()},_addScroll:function(){(this.model.headerPosition=="left"||this.model.headerPosition=="right"&&this._tabContentsHeight()>(this.element.width()||Number(this.model.height))||this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this._checkScroll();this._addScrollIcon();this.refreshTabScroll()},_init:function(){this._addItemIndex=null;this.tabId=0;this._hiddenIndex=this.model.hiddenItemIndex;this._initialize();this._prevSize=this._getDimension(n(this.element).parent(),"height")},_changeSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},_tabContentsWidth:function(){for(var r=this.element.find("li").length,t=0,i=0;i<r;i++)t=t+n(this.element.find("li")[i]).width();return t},_tabContentsHeight:function(){for(var r=this.element.find("li").length,t=0,i=0;i<r;i++)t=t+n(this.element.find("li")[i]).height();return t},_initialize:function(){this.initialRender=!0;this.element.attr("tabindex",0).attr("role","tablist");this._itemsRefreshing();n(this.anchors).addClass("e-link");this._preTabSelectedIndex=this._preTabIndex=-1;t.isNullOrUndefined(this.model.width)||this.element.width(this.model.width);t.isNullOrUndefined(this.model.height)||this.element.height(this.model.height);this._setTabPosition(this.model.headerPosition);this.model.showCloseButton&&this._addDeleteIcon();this.model.showReloadIcon&&this._addReloadIcon();this.model.showRoundedCorner&&this._roundedCorner(this.model.showRoundedCorner);this._enabledAction(this.model.enabled);this.contentPanels=[];this._addAttr(this.model.htmlAttributes);this._reinitialize();this._addBaseClass();t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize(this.model.headerSize);this._disableTabs();this._roundedCorner(this.model.showRoundedCorner);this.model.enableTabScroll&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom"?this.itemsContainer.width()>this.element.width()&&this._addScrollIcon():this.element.height()<this.items.height()*this.items.length&&this._addScrollIcon());this._wireEvents(this.model.events);this.showItem(this.selectedItemIndex());this._setTabsHeightStyle(this.model.heightAdjustMode);this._enabledAction(this.model.enabled);this._resizeEvents(this.model.heightAdjustMode);this.model.hiddenItemIndex.length>0&&this._hiddenIndexItem(this.model.hiddenItemIndex)},_reinitialize:function(t){for(var f,r,u=this._addItemIndex!=null?this._addItemIndex:0;u<this.anchors.length;u++)if(f=this.anchors[u],r=this.divId==i?n(f).attr("href"):this.divId,this.divId=i,hrefBase=r.split("#")[0],hrefBase&&hrefBase===location.toString().split("#")[0]&&(r=a.hash,f.href=r),r&&r!=="#"?(this._addContentTag(r,u),t&&this._addContentBaseClass(n(this.contentPanels[u]))):this.model.enablePersistence||this.model.disabledItemIndex.push(u),this._addItemIndex!=null){this._unWireEvents();this._wireEvents(this.model.events);this.items.length==1&&this.showItem(this.selectedItemIndex());break}},_itemsRefreshing:function(){this.itemsContainer=this.element.find("ol,ul").eq(0);this.items=this.itemsContainer.find(" > li:has(a[href])");this.anchors=this.items.find("a[href]")},_setHeaderSize:function(n){this.element.find(">ul li.e-item").css("height","auto");this.element.find(">ul li.e-item").children("a.e-link").css("margin-top","0px");this.model.headerPosition=="left"?this.element.find(">ul.e-left").css({width:n,"text-align":"center"}):this.model.headerPosition=="right"?this.element.find(">ul.e-right").css({width:n,"text-align":"center"}):(this.element.find(">ul.e-header li.e-item").css("height",n),this.element.find(">ul.e-header li.e-item a.e-link").css("margin-top",(this.element.find(">ul.e-header").outerHeight()/2-this.element.find(">.e-header li.e-item a.e-link").outerHeight()).toString()+"px"))},_enabledAction:function(n){n?this.element.removeClass("e-disable"):this.element.addClass("e-disable")},_hiddenIndexItem:function(t){for(var r,i=0;i<t.length;i++)!n.inArray(parseInt(t[i]),this._hiddenIndex)>-1&&(r=n(this.items[parseInt(t[i])]).children("a").attr("href"),this._hidePanel(r));this._hideContentPanel(this.selectedItemIndex(),this.model.hiddenItemIndex);this._hiddenIndex=this.model.hiddenItemIndex},_hidePanel:function(t){for(var r,i=0;i<this.contentPanels.length;i++)if("#"+n(this.contentPanels[i]).attr("id")==t){n(this.contentPanels[i]).css("display","none");break}for(r=0;r<this.items.length;r++)if(n(this.items.children("a")[r]).attr("href")==t){n(this.items[r]).css("display","none");break}},_hideContentPanel:function(t,i){n.inArray(t,i)>-1?(t+=1,t<=this.items.length-1?this._hideContentPanel(t,i):t>this.items.length-1&&i.length!=this.items.length&&this._hideContentPanel(0,i)):this.showItem(t)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?(i.model.enabled=!1,i._enabledAction(!1)):i.element.attr(t,n)})},_setTabPosition:function(i){i==t.Tab.Position.Bottom?(this.itemsContainer.appendTo(this.element),this.items.removeClass("e-bottom-line"),this.items.addClass("e-top-line")):i==t.Tab.Position.Top?(this.items.removeClass("e-top-line"),this.itemsContainer.prependTo(this.element),this.model.enableRTL?this.items.addClass("e-rtl-top-line e-top-hover"):this.items.addClass("e-bottom-line")):(i==t.Tab.Position.Left||i==t.Tab.Position.Right)&&this.items.length>=0&&(this.model.height?this.itemsContainer.css("height",this.model.height):!1&&n(this.itemsContainer).css("height",""),this.element.addClass("e-vertical"))},_addDeleteIcon:function(){var n,i;this.element.find("div.e-close.e-tabdelete").length<=0&&this.items.length>0&&(n=t.buildTag("div.e-icon e-close e-tabdelete","",{},{role:"presentation"}).css("visibility","hidden"),this.model.headerPosition=="left"||this.model.headerPosition=="right"?(i=this.items.find("a"),n.insertBefore(i)):this.items.append(n))},_addScrollIcon:function(){if(this.element.addClass("e-tabscroll"),this.element.find("div.e-chevron-circle-right").length<=0&&this.items.length>0){this._rightScrollIcon=t.buildTag("div.e-icon e-chevron-circle-right","",{},{role:"presentation"}).css("visibility","hidden");this.itemsContainer.append(this._rightScrollIcon);this.scrollstep=30;this._rightScrollIcon.css("position","relative");this.model.enableRTL||(this.model.headerPosition=="left"?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()/2+"px"):this.model.headerPosition=="right"?this._rightScrollIcon.css("margin-left",this.itemsContainer.width()/2-this.scrollstep+"px"):this.model.enablePersistence==!0&&this._beforeWidth!=0&&this._beforeWidth>this.scrollPanelWidth?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-this.scrollPanelWidth+20-(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)*2+"px"):this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-this.scrollPanelWidth+20+"px"));this.model.headerPosition=="left"||this.model.headerPosition=="right"?(this._rightScrollIcon.css("transform","rotate(270deg)"),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)<11?this.model.headerPosition=="top"||this.model.headerPosition=="bottom"?this._rightScrollIcon.css("margin-top","-"+(this.itemsContainer.height()+this.scrollPanelWidth-3)+"px"):this.model.enableRTL?this._rightScrollIcon.css("margin-top","-"+this.items.height()*this.items.length+"px"):this._rightScrollIcon.css("margin-top","-"+(this.items.height()*this.items.length-20)+"px"):this.model.enablePersistence==!0&&this._beforeWidth!=0&&this._beforeWidth>this.scrollPanelHeight?this._rightScrollIcon.css("margin-top","-"+(this.items[this.selectedItemIndex()].offsetTop*3-this.scrollPanelHeight*2)+"px"):this.model.enableRTL?this._rightScrollIcon.css("margin-top","-"+this.items.height()*this.items.length+"px"):this._rightScrollIcon.css("margin-top","-"+(this.items.height()*this.items.length-20)+"px")):this.model.enableRTL?(this._rightScrollIcon.css("margin-top","-"+this.itemsContainer.height()+"px"),this._rightScrollIcon.css("margin-left",this.itemsContainer.width()-14+"px")):this._rightScrollIcon.css("margin-top","-"+(this.itemsContainer.height()/2+10)+"px");t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)<11&&(this.model.headerPosition=="top"?parseInt(this._rightScrollIcon.prev().offset().top)-parseInt(this._rightScrollIcon.offset().top)==-parseInt(this._rightScrollIcon.css("margin-top"))&&this._rightScrollIcon.css("top",this.itemsContainer.height()/2+27+"px"):this.model.headerPosition=="bottom"&&(this.model.enableRTL?this._rightScrollIcon.css("top",this.itemsContainer.height()/2+20+"px"):this._rightScrollIcon.css("top",this.itemsContainer.height()/2+27+"px")));this.model.headerPosition=="left"?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()/2+"px"):this.model.headerPosition=="right"&&this._rightScrollIcon.css("margin-left",this.itemsContainer.width()/2-this.scrollstep+"px");this.element.attr("unselectable","on");this.element.css("user-select","none");this.element.on("selectstart",!1);this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick)}},_addScrollBackIcon:function(){if(this.element.find("div.e-chevron-circle-left").length<=0){this._leftScrollIcon=t.buildTag("div.e-icon e-chevron-circle-left","",{},{role:"presentation"}).css("visibility","hidden");this.itemsContainer.prepend(this._leftScrollIcon);this.rightscrollstep=30;this.element.attr("unselectable","on");this.element.css("user-select","none");this.element.on("selectstart",!1);this._leftScrollIcon.css("position","absolute").css("z-index","10");(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&(this.model.enableRTL?this._leftScrollIcon.css("margin-right",this.element.width()-20+"px"):this._leftScrollIcon.css("margin-left","20px"));this.model.headerPosition=="left"||this.model.headerPosition=="right"?(this.model.enableRTL?(this._leftScrollIcon.css("margin-top",+(this.scrollPanelHeight-4)+"px"),this.model.headerPosition=="right"?this._leftScrollIcon.css("margin-right",this.itemsContainer.width()/2+14+"px"):this._leftScrollIcon.css("margin-right",this.itemsContainer.width()/2+"px")):(this.model.headerPosition=="right"?this._leftScrollIcon.css("margin-left",this.itemsContainer.width()/2-30+"px"):this.model.headerPosition=="left"&&this._leftScrollIcon.css("margin-left",this.itemsContainer.width()/2-15+"px"),this._leftScrollIcon.css("margin-top",+this.scrollPanelHeight+20+"px")),this._leftScrollIcon.css("transform","rotate(270deg)")):t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)<11?this._leftScrollIcon.css("margin-top","0px"):this.model.enableRTL?this._leftScrollIcon.css("margin-top","0px"):this._leftScrollIcon.css("margin-top","-5px");this._on(this._leftScrollIcon,"click",this._tabScrollBackClick)}},_addReloadIcon:function(){var n,i;this.element.find("div.e-reload").length<=0&&this.items.length>0&&(n=t.buildTag("div.e-icon e-reload","",{},{role:"presentation"}).css("visibility","hidden"),this.model.headerPosition=="left"||this.model.headerPosition=="right"?(i=this.items.find("a"),n.insertBefore(i)):this.items.append(n))},_addBaseClass:function(){this.element.addClass("e-widget "+this.model.cssClass);this.itemsContainer.addClass("e-box");this.model.enableRTL&&this.element.addClass("e-rtl");this.model.headerPosition=="top"&&(n(this.contentPanels).addClass("e-hidebottom e-addborderbottom"),n(this.itemsContainer).addClass("e-addborderbottom"),n(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hideright e-addborderright e-hideleft e-addborderleft"),n(this.itemsContainer).removeClass("e-addbordertop e-addborderright e-addborderleft"),this.items.length>0&&this.itemsContainer.addClass("e-header"),this.model.enableRTL&&(this.items.addClass("e-rtl-top-line"),this.items.removeClass("e-rtl-bottom-line")));this.model.headerPosition=="bottom"&&(n(this.contentPanels).removeClass("e-hidebottom e-addborderbottom e-hideright e-addborderright e-hideleft e-addborderleft"),n(this.itemsContainer).removeClass("e-addborderbottom e-addborderright e-addborderleft"),n(this.contentPanels).addClass("e-hidetop e-addbordertop"),n(this.itemsContainer).addClass("e-addbordertop"),this.items.length>0&&this.itemsContainer.addClass("e-header"),this.model.enableRTL&&(this.items.addClass("e-rtl-bottom-line"),this.items.removeClass("e-rtl-top-line e-top-line")));this.model.headerPosition=="left"&&(this.items.length>0&&this.itemsContainer.addClass("e-left"),n(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideright e-addborderright"),n(this.itemsContainer).removeClass("e-addbordertop e-addborderbottom e-addborderright"),n(this.contentPanels).addClass("e-hideleft e-addborderleft"),n(this.itemsContainer).addClass("e-addborderleft"),n(this.items).removeClass("e-rtl-bottom-line e-rtl-top-line"));this.model.headerPosition=="right"&&(this.items.length>0&&this.itemsContainer.addClass("e-right"),n(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideleft e-addborderleft"),n(this.itemsContainer).removeClass("e-addbordertop e-addborderbottom e-addborderleft"),n(this.contentPanels).addClass("e-hideright e-addborderright"),n(this.itemsContainer).addClass("e-addborderright"),this.model.enableTabScroll&&this._tabContentsHeight()>(this.element.height||Number(this.model.height))&&n(this.itemsContainer).css("z-index","12").css("margin-left","-"+this.itemsContainer.find("li").width()+"px"),n(this.items).removeClass("e-rtl-bottom-line e-rtl-top-line"));this.items.addClass("e-select e-item").attr("role","tab").attr("tabindex",-1).attr("aria-expanded",!0).attr("aria-selected",!1);n(this.contentPanels).addClass("e-content e-content-item e-box").attr("role","tabpanel").attr("aria-hidden",!0);((this.model.headerPosition=="left"||this.model.headerPosition=="right")&&this._tabContentsHeight()>(this.element.height()||Number(this.model.height))||(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this._tabContentsWidth()>(t.getDimension(this.element,"width")||this.model.width))&&this._checkScroll()},_addContentBaseClass:function(n){this.model.headerPosition=="top"&&(n.addClass("e-hidebottom e-addborderbottom"),n.removeClass("e-hidetop e-addbordertop e-hideright e-addborderright e-hideleft e-addborderleft"));this.model.headerPosition=="bottom"&&(n.removeClass("e-hidebottom e-addborderbottom e-hideright e-addborderright e-hideleft e-addborderleft"),n.addClass("e-hidetop e-addbordertop"));this.model.headerPosition=="left"&&(n.removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideright e-addborderright"),n.addClass("e-hideleft e-addborderleft"));this.model.headerPosition=="right"&&(n.removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideleft e-addborderleft"),n.addClass("e-hideright e-addborderright"));n.addClass("e-content e-content-item e-box").attr("role","tabpanel").attr("aria-hidden",!0)},_checkScroll:function(){var i,r,u,f;if(this.scrollPanelWidth=t.getDimension(this.element,"width"),this.scrollPanelHeight=t.getDimension(this.element,"height"),this.model.enableTabScroll==!0&&this._tabContentsHeight()>this.items.height()){if(this.scrollstep=0,this.model.enableTabScroll=!0,(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this.itemsContainer.css({width:t.getDimension(this.element,"width")+parseInt(this.items.css("width"))*this.items.length+"px",position:"absolute"}),this._beforeWidth=0,this.model.enablePersistence==!0)if(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")for(i=0;i<this.selectedItemIndex();i++)this._beforeWidth+=this.items[i].offsetWidth;else for(i=0;i<this.selectedItemIndex();i++)this._beforeWidth+=this.items[i].offsetHeight;r=parseInt(this.itemsContainer.css("width"));this.model.headerPosition=="top"&&(u=n(this.contentPanels),u.css("padding-top",this.itemsContainer.outerHeight()+(u.hasClass("e-activetop")?0:this.model.enableRTL?4:3)+"px"),n(this.contentPanels).css({"border-top":"none",width:t.getDimension(this.element,"width")-1+"px"}),this.itemsContainer.css("border-bottom","1px solid #bbbcbb"));this.model.headerPosition=="bottom"&&(n(this.contentPanels).css({position:"relative",width:t.getDimension(this.element,"width")-1+"px","border-bottom":"none"}),this.itemsContainer.css("border-top","1px solid #bbbcbb"),n(this.contentPanels).css({"border-top":""}));f=parseInt(r-(this.scrollPanelWidth+this.scrollstep-1));this.model.enableRTL&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")?this.itemsContainer.css("clip","rect(0px,"+r+"px,100px,"+f+"px)"):this.model.headerPosition=="left"?this._tabContentsHeight()>Number(this.model.height)&&(this.itemsContainer.css({height:parseInt(this.itemsContainer.css("height"))+parseInt(this.items.css("height"))*this.items.length+30+"px",position:"absolute","border-right":"1px solid #bbbcbb",background:"white"}),n(this.contentPanels).css("padding-left",this.itemsContainer.width()+5+"px"),this.model.enableRTL&&this.itemsContainer.css("margin-right",t.getDimension(this.element,"width")-this.itemsContainer.width()),this._beforeWidth==0||this._beforeWidth<this.scrollPanelHeight?this.itemsContainer.css("clip","rect(0px,"+(this.itemsContainer.width()+4)+"px,"+this.scrollPanelHeight+"px,"+this.scrollstep+"px)"):this._beforeWidth>this.scrollPanelHeight&&this.itemsContainer.css({clip:"rect("+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px,"+(this.itemsContainer.width()+2)+"px,"+(this.items[this.selectedItemIndex()].offsetTop*2-this.scrollPanelHeight)+"px,0px)","margin-top":"-"+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px"}),this.element.removeClass("e-scrolltab")):this.model.headerPosition=="right"?this._tabContentsHeight()>Number(this.model.height)&&(this.itemsContainer.css({height:parseInt(this.itemsContainer.css("height"))+parseInt(this.items.css("height"))*this.items.length+30+"px",position:"absolute","margin-left":"-1px"}).css("z-index","12"),n(this.contentPanels).css({position:"absolute",width:parseInt(this.element.width()-1)+"px",height:t.getDimension(this.element,"height")+"px","margin-left":"-"+t.getDimension(this.element,"width")+"px","border-right":"none"}),this.model.enableRTL||n(this.element).css("margin-left",t.getDimension(this.element,"width")+"px"),this.itemsContainer.css("border-left","1px solid #bbbcbb"),this.model.enableRTL&&this.itemsContainer.css("margin-right","-"+(this.itemsContainer.width()+1)+"px"),this._beforeWidth==0||this._beforeWidth<this.scrollPanelHeight?this.itemsContainer.css("clip","rect(0px,"+this.itemsContainer.width()+2+"px,"+this.scrollPanelHeight+"px,"+this.scrollstep+"px)"):this._beforeWidth>this.scrollPanelHeight&&this.itemsContainer.css({clip:"rect("+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px,"+(this.itemsContainer.width()+2)+"px,"+(this.items[this.selectedItemIndex()].offsetTop*2-this.scrollPanelHeight)+"px,0px)","margin-top":"-"+(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)*2+"px"}),this.element.removeClass("e-scrolltab")):this._beforeWidth==0||this._beforeWidth<this.scrollPanelWidth?this.itemsContainer.css({clip:"rect(0px,"+(this.scrollPanelWidth+this.scrollstep)+"px,100px,"+this.scrollstep+"px)","margin-left":"-"+this.scrollstep+"px"}):this._beforeWidth>this.scrollPanelWidth&&this.itemsContainer.css({clip:"rect(0px,"+(this.items[this.selectedItemIndex()].offsetLeft*2-this.scrollPanelWidth)+"px,100px,"+(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)*2+"px)","margin-left":"-"+(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)*2+"px"});this.itemsContainer.find(".e-icon.e-chevron-circle-left").length&&this.itemsContainer.find(".e-icon.e-chevron-circle-left").css("display","none");this._initialClip=this.itemsContainer.css("clip")}},_executeForwardScrolling:function(n,i){var r;if(this._rightScrollIcon.css("position","relative"),r=i?i:n.type=="swiperight"||n.type=="swipeleft"?50:30,this.model.headerPosition=="top"||this.model.headerPosition=="bottom")if(this.model.enableRTL){var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),o=this.itemsContainer.css("margin-right")?Number(this.itemsContainer.css("margin-right").split("px")[0].replace(",","")):0,e=Number(this._rightScrollIcon.css("margin-left").split("px")[0]),s=this._leftScrollIcon&&this._leftScrollIcon.css("margin-right")?Number(this._leftScrollIcon.css("margin-right").split("px")[0]):"";this.itemsContainer.css({clip:"rect(0px,"+(f-r)+"px,100px,"+(u-r)+"px)","margin-right":"-"+(-o+r)+"px"});this._rightScrollIcon.css("margin-left",e-r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-right",s+r+"px"):"";n.type=="swipeleft"&&Math.abs(Number(this.itemsContainer.css("margin-right").split("px")[0]))>=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._off(this.items,"swipeleft",this._tabSwipe);this._leftScrollIcon&&this._leftScrollIcon.css("margin-right")&&Number(this._leftScrollIcon.css("margin-right").split("px")[0])>=this._tabContentsWidth()-40&&this._rightScrollIcon.css("display","none")}else{var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),e=Number(this._rightScrollIcon.css("margin-right").split("px")[0]);this.itemsContainer.css({clip:"rect(0px,"+(f+r)+"px,100px,"+(u+r)+"px)","margin-left":"-"+(u+r)+"px"});this._rightScrollIcon.css("margin-right",e-r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-left",u+r+"px"):"";n.type=="swipeleft"&&Math.abs(Number(this.itemsContainer.css("margin-left").split("px")[0]))>=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._off(this.items,"swipeleft",this._tabSwipe);this._leftScrollIcon&&this._leftScrollIcon.css("margin-left")&&Number(this._leftScrollIcon.css("margin-left").split("px")[0])>=this._tabContentsWidth()-t.getDimension(this.element,"width")&&(this._rightScrollIcon.css("display","none"),this._off(this.items,"swipeleft",this._tabSwipe))}else if(this.model.headerPosition=="left"||this.model.headerPosition=="right"){var f=Number(this.itemsContainer.css("clip").split("px")[0].replace(",","").split("(")[1]),u=Number(this.itemsContainer.css("clip").split("px")[2].replace(",","")),e=Number(this._rightScrollIcon.css("margin-top").split("px")[0].replace(",","")),h=this._leftScrollIcon&&this._leftScrollIcon.css("margin-top")?Number(this._leftScrollIcon.css("margin-top").split("px")[0]):0,c=this.itemsContainer.css("margin-top")?Number(this.itemsContainer.css("margin-top").split("px")[0]):0;this.itemsContainer.css({clip:"rect("+(f+r)+"px, "+(this.itemsContainer.width()+4)+"px,"+(u+r)+"px, 0px)","margin-top":"-"+(-c+r)+"px"});this._rightScrollIcon.css("margin-top",e+r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-top",h+r+"px"):"";u>this._tabContentsHeight()-20&&(this.itemsContainer.css({clip:"rect("+(this._tabContentsHeight()-Number(this.model.height)+2)+"px, "+(this.itemsContainer.width()+4)+"px, "+(this._tabContentsHeight()+2)+"px, 0px","margin-top":"-"+(this._tabContentsHeight()-Number(this.model.height)+2)+"px"}),this._leftScrollIcon.css("margin-top",this._tabContentsHeight()-12+"px"),this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-(this._tabContentsHeight()-Number(this.model.height))-22)+"px"),this._rightScrollIcon.css("display","none"))}},_executeBackwardScrolling:function(n,i){var r;if(this._rightScrollIcon!=""&&this._rightScrollIcon.css("display","block"),r=i?i:n.type=="swiperight"||n.type=="swipeleft"?50:30,this.model.headerPosition=="top"||this.model.headerPosition=="bottom")if(this.model.enableRTL){var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),o=Number(this.itemsContainer.css("margin-right").split("px")[0])?Number(this.itemsContainer.css("margin-right").split("px")[0]):0,s=this._leftScrollIcon&&this._leftScrollIcon.css("margin-right")?Number(this._leftScrollIcon.css("margin-right").split("px")[0]):"",e=Number(this._rightScrollIcon.css("margin-left").split("px")[0]);this.itemsContainer.css({clip:"rect(0px,"+(f+r)+"px,100px,"+(u+r)+"px)","margin-right":"-"+(-o-r)+"px"});this._rightScrollIcon.css("margin-left",e+r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-right",s-r+"px"):"";n.type=="swiperight"&&Math.abs(Number(this.itemsContainer.css("margin-right").split("px")[0]))<=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._on(this.items,"swipeleft",this._tabSwipe);o>=-r&&this._leftScrollIcon&&this._leftScrollIcon.css("display","none")}else{var f=Number(this.itemsContainer.css("clip").split("px")[1].replace(",","")),u=Number(this.itemsContainer.css("clip").split("px")[3].replace(",","")),e=Number(this._rightScrollIcon.css("margin-right").split("px")[0]);this.itemsContainer.css({clip:"rect(0px,"+(f-r)+"px,100px,"+(u-r)+"px)","margin-left":"-"+(u-r)+"px"});this._rightScrollIcon.css("margin-right",e+r+"px");this._leftScrollIcon?this._leftScrollIcon.css("margin-left",u-r+"px"):"";u-r<0&&(this.itemsContainer.css({clip:"rect(0px,"+t.getDimension(this.element,"width")+"px,100px, 0px","margin-left":"0px"}),this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-t.getDimension(this.element,"width")+20+"px"));n.type=="swiperight"&&Math.abs(Number(this.itemsContainer.css("margin-left").split("px")[0]))<=this._tabContentsWidth()-t.getDimension(this.element,"width")&&this._on(this.items,"swipeleft",this._tabSwipe);u<=r&&this._leftScrollIcon&&this._leftScrollIcon.css("display","none")}else if(this.model.headerPosition=="left"||this.model.headerPosition=="right"){var f=Number(this.itemsContainer.css("clip").split("px")[0].replace(",","").split("(")[1]),u=Number(this.itemsContainer.css("clip").split("px")[2].replace(",","")),e=Number(this._rightScrollIcon.css("margin-top").split("px")[0]),h=this._leftScrollIcon.css("margin-top")?Number(this._leftScrollIcon.css("margin-top").split("px")[0]):0,c=this.itemsContainer.css("margin-top")?Number(this.itemsContainer.css("margin-top").split("px")[0]):0;this.itemsContainer.css({clip:"rect("+(f-r)+"px, "+this.itemsContainer.width()+"px,"+(u-r)+"px, 0px)","margin-top":"-"+(-c-r)+"px"});this._rightScrollIcon.css("margin-top",e-r+"px").css("display","block");this._leftScrollIcon.css("margin-top",h-r+"px");Number(this.itemsContainer.css("clip").split("px")[0].split("(")[1])<=0&&(this.itemsContainer.css({clip:"rect( 0px, "+this.itemsContainer.width()+"px,"+Number(this.model.height)+"px, 0px)","margin-top":"0px"}),this._leftScrollIcon.css("display","none"),this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-22)+"px"))}},_removeHeaderClass:function(){this.itemsContainer.remove();this.itemsContainer.insertBefore(this.element.find(">div").first());this.items.removeClass("e-bottom-line e-top-line");n(this.contentPanels).removeClass("e-content-bottom e-activetop e-activebottom");this.itemsContainer.removeClass("e-header e-left e-right")},_removeVerticalClass:function(){this.element.removeClass("e-vertical");this.itemsContainer.removeClass("e-left e-right").removeAttr("style")},_removeBaseClass:function(){this.element.removeClass("e-tab e-widget e-corner");(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&this._removeVerticalClass();this.itemsContainer.removeClass("e-header e-box e-clearall e-select");this.anchors.removeClass("e-link");this.items.removeClass("e-select e-item e-active e-bottom-line e-top-line");n(this.contentPanels).removeClass("e-content e-content-item e-box");n(this.contentPanels).removeClass("e-content e-content-item e-box e-content-bottom e-activetop e-activebottom e-active-content");n(this.contentPanels).css("display","")},_addContentTag:function(n,i){var u=this._getTabId(n),r=this.element.find("#"+u);r.length||(r=t.buildTag("div.e-content e-content-item e-box e-content-bottom #"+u).insertAfter(this.contentPanels[i-1]||this.itemsContainer));this.contentPanels.splice(i,0,r[0])},_roundedCorner:function(n){n?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_setTabsHeightStyle:function(i){var r,u;if(t.Tab.HeightAdjustMode.Content!=i&&n(this.contentPanels).height(""),t.Tab.HeightAdjustMode.Fill==i)(t.Tab.Position.Left===this.model.headerPosition||t.Tab.Position.Right===this.model.headerPosition)&&n(this.contentPanels).css("height","100vh"),this._contentPaneSize();else if(t.Tab.HeightAdjustMode.Auto==i){for(r=0,n(this.contentPanels).css({display:"none"}).addClass("e-active-content"),u=0;u<this.contentPanels.length;u++)r=Math.max(r,this._getDimension(n(this.contentPanels[u]),"outerHeight"));n(this.contentPanels).removeClass("e-active-content");n(this.contentPanels).height(r);this.maxAutoHeight=r;this.showItem(this.selectedItemIndex())}else t.Tab.HeightAdjustMode.None==i&&this.model.height!=null&&this._contentPaneSize();t.Tab.HeightAdjustMode.Fill!==i&&n(this.itemsContainer).height("");t.Tab.HeightAdjustMode.Content==i&&n(this.contentPanels).height("auto");this.model.enableTabScroll&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&n(this.contentPanels).css("height",this.model.height+"px")},_getDimension:function(t,i){var u,f=n(t).parents().addBack().filter(":hidden"),r={visibility:"hidden",display:"block"},e=[];return f.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];e.push(t)}),u=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),f.each(function(n){var i=e[n];for(var t in r)this.style[t]=i[t]}),u},showItem:function(i){var f,e,u,r;if(n.inArray(i,this.model.disabledItemIndex)<0){if(f=this,this._isInteraction!=!1&&(this._isInteraction=!0),this._preTabSelectedIndex=this.selectedItemIndex(),this.selectedItemIndex(i),this.selectedItemIndex()>=this.contentPanels.length&&(this.selectedItemIndex(0),i=this.selectedItemIndex()),i>=0&&!this.initialRender&&!0===this._onBeforeActive(i))return this.selectedItemIndex(this._preTabSelectedIndex),!1;if(this._preTabIndex=this._preTabSelectedIndex,n(this.items[this.selectedItemIndex()]).attr("aria-expanded",!0).attr("aria-selected",!0).attr("tabindex",0),this.selectedItemIndex()!=null&&this.selectedItemIndex()<this.contentPanels.length){for(this._ajaxLoad(),this.hideItem(this._preTabIndex),n(this.contentPanels[this.selectedItemIndex()]).fadeIn(this.model.enableAnimation?20:0,function(){if(!f.initialRender&&f._onActive())return!0;f.initialRender=!1}),this.model.headerPosition=="left"||this.model.headerPosition=="right"?n(this.contentPanels[this.selectedItemIndex()]).addClass("e-active-content "):(e=this.model.headerPosition==t.Tab.Position.Top?"e-activetop":"e-activebottom",n(this.contentPanels[this.selectedItemIndex()]).addClass(e)),n(this.items[this.selectedItemIndex()]).addClass("e-active").removeClass("e-select"),n(this.items[this.selectedItemIndex()]).removeClass("e-margine-top e-margine-bottom"),u=0;u<=n(this.items).length;u++)n(this.items[u]).hasClass("e-select")&&(this.model.headerPosition=="right"&&n(this.items[u]).removeClass("e-margine-top e-margine-bottom"),this.model.headerPosition=="left"&&n(this.items[u]).removeClass("e-margine-top e-margine-bottom"),this.model.headerPosition=="top"&&(this.element.hasClass("e-tab-collapsed")?n(this.items[u]).removeClass("e-margine-top"):n(this.items[u]).addClass("e-margine-top"),n(this.items[u]).removeClass("e-margine-bottom")),this.model.headerPosition=="bottom"&&(n(this.items[u]).removeClass("e-margine-top"),n(this.items[u]).addClass("e-margine-bottom")));n(this.contentPanels[this.selectedItemIndex()]).addClass("e-active-content").removeAttr("aria-hidden",!1)}}this.model.enableTabScroll&&this._tabContentsWidth()>(this.model.width||this.element.width())&&this.itemsContainer.find("li").length&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")?this.model.enableRTL||(r=Number(this.itemsContainer.find("li.e-active").position().left.toFixed(0))+this.itemsContainer.find("li.e-active").width()-t.getDimension(this.element,"width"),r>0&&(Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))+this.itemsContainer.find("li.e-active").width()>t.getDimension(this.element,"width")||Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))-this.itemsContainer.find("li.e-active").width()<0)?(this.itemsContainer.css("clip","rect(0 ,"+(t.getDimension(this.element,"width")+(r+10))+"px, 100px,"+(r+10)+"px)").css("margin-left","-"+(r+10)+"px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-t.getDimension(this.element,"width")+10-r+"px").css("display","block"):"",this._addScrollBackIcon(),this._leftScrollIcon?this._leftScrollIcon.css("display","block").css("margin-left",r+10+"px"):""):r<0&&(Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))+this.itemsContainer.find("li.e-active").width()>t.getDimension(this.element,"width")||Number(this.itemsContainer.find("li.e-active").offset().left.toFixed(0))-this.itemsContainer.find("li.e-active").width()<0)&&(this.itemsContainer.css("clip","rect(0 ,"+t.getDimension(this.element,"width")+"px, 100px, 0px)").css("margin-left","0px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-right",this.itemsContainer.width()-t.getDimension(this.element,"width")+20+"px").css("display","block"):"",this._leftScrollIcon?this._leftScrollIcon.css("display","none"):"")):this.model.enableTabScroll&&this.model.height&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&!this.model.enableRTL&&(r=Number(this.itemsContainer.find("li.e-active").position().top.toFixed(0))+this.itemsContainer.find("li.e-active").height()-Number(this.model.height),r>0&&(Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))+this.itemsContainer.find("li.e-active").height()>Number(this.model.height)||Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))-this.itemsContainer.find("li.e-active").height()<0)?(this.itemsContainer.css("clip","rect("+r+"px,"+(this.itemsContainer.outerWidth()+2)+"px, "+(Number(this.model.height)+r)+"px, 0px").css("margin-top","-"+r+"px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-r-22)+"px").css("display","block"):"",this._addScrollBackIcon(),this._leftScrollIcon?this._leftScrollIcon.css("margin-top",Number(this.model.height)+r-10+"px").css("display","block"):""):r<0&&(Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))+this.itemsContainer.find("li.e-active").height()>Number(this.model.height)||Number(this.itemsContainer.find("li.e-active").offset().top.toFixed(0))-this.itemsContainer.find("li.e-active").height()<0)&&(this.itemsContainer.css("clip","rect(0px ,"+(this.itemsContainer.outerWidth()+2)+"px, "+Number(this.model.height)+"px, 0px").css("margin-top","0px"),this._rightScrollIcon?this._rightScrollIcon.css("margin-top","-"+(this._tabContentsHeight()-22)+"px").css("display","block"):"",this._leftScrollIcon?this._leftScrollIcon.css("display","none").css("margin-top",Number(this.model.height)-10+"px"):""))},hideItem:function(i){if(n(this.contentPanels[i]).fadeOut(0),!(this.model.headerPosition=="left"||this.model.headerPosition=="right"))var r=this.model.headerPosition==t.Tab.Position.Top?"e-activetop":"e-activebottom";n(this.items[i]).removeClass("e-active").addClass("e-select");n(this.contentPanels[i]).removeClass("e-active-content "+r).attr("aria-hidden",!0)},_ajaxLoad:function(){var t=n(this.contentPanels[this.selectedItemIndex()]),i=this.anchors[this.selectedItemIndex()],r=n(i).attr("href");t.is(":empty")&&r.indexOf("#")!==0&&this._sendAjaxOptions(t,i)},_getTabId:function(n){return n.indexOf("#")?this.model.idPrefix+this._getNextTabId():n.replace("#","")},_getNextTabId:function(){return++this.tabId},_disableTabs:function(){for(var t=0,i;i=this.items[t];t++)n.inArray(t,this.model.disabledItemIndex)>-1&&(n(i).find("a").off(this.model.events),n(i).find("div.e-close").off("click")),n(i)[n.inArray(t,this.model.disabledItemIndex)!=-1&&!n(i).hasClass("e-tab-selected")?"addClass":"removeClass"]("e-disable"),n(this.contentPanels[t])[n.inArray(t,this.model.disabledItemIndex)!=-1&&!n(this.contentPanels[t]).hasClass("e-tab-selected")?"addClass":"removeClass"]("e-disable")},_tabItemClick:function(t){if(this.model.enabled){t.preventDefault();var i;this.selectedItemIndex()==n(this.items).index(n(t.currentTarget))&&this.model.collapsible?(i=-1,n(this.element).addClass("e-tab-collapsed")):i=n(this.items).index(n(t.currentTarget));i!=this.selectedItemIndex()&&this.showItem(i);n(this.element).removeClass("e-tab-collapsed")}},_tabDeleteClick:function(t){var u,r,i,f;this.model.enabled&&(u=n(t.target),r=n(t.target).parent().width(),u.hasClass("e-close")&&(i=n(this.items).index(n(t.target).parent())),i==this.selectedItemIndex()&&this.items.length>i&&this.selectedItemIndex(this.selectedItemIndex()+1),f=Number(this.itemsContainer.css("margin-right").split("px")[0])?Number(this.itemsContainer.css("margin-right").split("px")[0]):0,this.model.enableTabScroll&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&(!this.model.enableRTL||this.model.enableRTL&&f<-r?this._executeBackwardScrolling(t,r):(this.itemsContainer.css({"margin-right":"0px",clip:this._initialClip}),this._leftScrollIcon&&this._leftScrollIcon.css("display","none"),this._rightScrollIcon&&this._rightScrollIcon.css("display","none"))),this.removeItem(i))},_tabScrollClick:function(n){this.model.enabled&&this._rightScrollIcon[0]==n.target&&(this._executeForwardScrolling(n),this._addScrollBackIcon(),this._leftScrollIcon.css("display","block"))},_tabSwipe:function(n){n.type=="swipeleft"?this._executeForwardScrolling(n):this._executeBackwardScrolling(n)},_tabScrollBackClick:function(n){this.model.enabled&&this._leftScrollIcon[0]==n.target&&this._executeBackwardScrolling(n)},_tabReloadClick:function(t){var i;if(this.model.enabled&&(i=n(t.target),i.hasClass("e-reload"))){var r=this.anchors[this.selectedItemIndex()],u=n(r).attr("href"),f=n(this.contentPanels[this.selectedItemIndex()]);u.indexOf("#")!==0?this._sendAjaxOptions(f,r):this.showItem(this.selectedItemIndex())}},_sendAjaxOptions:function(t,i){if(this._onBeforeLoad(i))return!0;t.addClass("e-load");var r=this,u=n(i).html(),f=i.href.replace("#",""),e={type:this.model.ajaxSettings.type,cache:this.model.ajaxSettings.cache,url:f,data:this.model.ajaxSettings.data,dataType:this.model.ajaxSettings.dataType,contentType:this.model.ajaxSettings.contentType,async:this.model.ajaxSettings.async,success:function(n){try{r._ajaxSuccessHandler(n,t,i,u)}catch(f){}},error:function(){try{r._ajaxErrorHandler(i,r.selectedItemIndex(),u)}catch(n){}}};this._sendAjaxRequest(e)},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_ajaxSuccessHandler:function(t,i,r,u){u!=null&&n(r).html(u);i.removeClass("e-load");i.html(t).addClass("e-tab-loaded");var f={data:t,url:r,content:i};return this._trigger("ajaxSuccess",f),this._onLoad(r)?!0:void 0},_ajaxErrorHandler:function(n,t){this._trigger("ajaxError",{data:n,url:t});this._onLoad(t)},_createContentPanel:function(t){return n("<div><\/div>").attr("id",t).addClass("e-content e-content-item e-content-bottom e-box")},_refresh:function(){this._unWireEvents();this.itemsContainer.removeAttr("style class");n(this.contentPanels).removeAttr("style class");this.element.css("margin-left","");this._removeVerticalClass();this._removeHeaderClass();this._initialize()},_keyPress:function(i){if(this.model.enabled){var f,r,u=n(i.target);if(code=i.keyCode?i.keyCode:i.which?i.which:i.charCode,u.hasClass("e-link")||u.hasClass("e-item"))switch(code){case 39:case 40:i.preventDefault();this.showItem(this.selectedItemIndex()+1);break;case 37:case 38:i.preventDefault();this.selectedItemIndex()!=0?this.showItem(this.selectedItemIndex()-1):this.selectedItemIndex()==0&&this.showItem(this.getItemsCount()-1);break;case 35:i.preventDefault();this.showItem(this.getItemsCount()-1);break;case 36:i.preventDefault();this.showItem(0);break;case 13:i.preventDefault();this.showItem(this.selectedItemIndex())}else if(i.ctrlKey&&!u.hasClass("e-tab"))switch(code){case 38:i.preventDefault();f=n(this.contentPanels).index(u.parent(".e-content"));r=n(this.items[f]);break;case 33:i.preventDefault();r=n(this.items[0]);this.showItem(0);break;case 34:i.preventDefault();r=n(this._headers[this.getItemsCount()-1]);this.showItem(this.getItemsCount()-1)}t.isNullOrUndefined(r)||(r.addClass("e-focus"),r.focus())}},_hoverHandler:function(t){if(t.preventDefault(),this.model.enabled){var i=n(this.items).index(n(t.target).parent());i==-1&&(i=n(this.items).index(n(t.target)));n(this.items[i]).hasClass("e-disable")||(t.type==="mouseout"?n(this.element.find("div.e-tabdelete")[i]).css("visibility","hidden"):n(this.element.find("div.e-tabdelete")[i]).css("visibility","visible"),t.type==="mouseout"?n(this.element.find("div.e-reload")[i]).css("visibility","hidden"):n(this.element.find("div.e-reload")[i]).css("visibility","visible"));t.type==="mouseout"?n(this.element.find("div.e-chevron-circle-right")).css("visibility","hidden"):n(this.element.find("div.e-chevron-circle-right")).css("visibility","visible");t.type==="mouseout"?n(this.element.find("div.e-chevron-circle-left")).css("visibility","hidden"):n(this.element.find("div.e-chevron-circle-left")).css("visibility","visible")}},_wireEvents:function(t){this._on(this.items,t,this._tabItemClick);this._on(this.itemsContainer,"mouseover",this._hoverHandler);this._on(this.itemsContainer,"mouseout",this._hoverHandler);this._on(this.element.find(">ul").eq(0).find(">li div.e-close"),"click",this._tabDeleteClick);this._on(this.element.find(">ul").eq(0).find("div.e-chevron-circle-left"),"click",this._tabScrollBackClick);this.model.enableTabScroll&&this._on(this.items,"swipeleft swiperight",this._tabSwipe);this._on(this.itemsContainer,"focusin",this._focusIn);this._on(this.itemsContainer,"focusout",this._focusOut);n(window).on("resize",n.proxy(this._resize,this));this._on(this.element.find(">ul").eq(0).find(">li div.e-reload"),"click",this._tabReloadClick)},_resize:function(){this.model&&this.model.width==null&&this.model.enableTabScroll&&(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&(this._removeScroll(),this._addScroll())},_unWireEvents:function(){this._off(this.items,this.model.events);this._off(this.element.find(">ul").eq(0).find(">li div.e-close"),"click");this._off(this.element.find(">ul").eq(0).find("div.e-chevron-circle-right"),"click");this._off(this.element.find(">ul").eq(0).find("div.e-chevron-circle-left"),"click");this.model.enableTabScroll&&this._off(this.items,"swipeleft swiperight",this._tabSwipe);this._off(this.itemsContainer,"mouseover",this._hoverHandler);this._off(this.itemsContainer,"mouseout",this._hoverHandler);this._off(this.itemsContainer,"focusin",this._focusIn);this._off(this.itemsContainer,"focusout",this._focusOut);this._off(this.element.find(">ul").eq(0).find(">li div.e-reload"),"click");this._resizeEvents()},_resizeEvents:function(t){if(t==="fill")n(window).on("resize",n.proxy(this._windowResized,this));else n(window).off("resize",n.proxy(this._windowResized,this))},_windowResized:function(){var t=this._getDimension(n(this.element).parent(),"height");this._prevSize!=t&&(this._contentPaneSize(),this._prevSize=t,!this.model.width&&this.model.enableTabScroll&&this._addScroll())},_contentPaneSize:function(){var i,r,t;for(this.model.height!=null&&this.model.heightAdjustMode=="none"?(n(this.element).height(this.model.height),i=this._getDimension(n(this.element),"height")):i=this._getDimension(n(this.element).parent(),"height"),n(this.contentPanels).height(""),n(this.element).parent().css({overflow:"auto"}),(this.model.headerPosition==="top"||this.model.headerPosition==="bottom")&&(i-=this._getDimension(n(this.itemsContainer),"outerHeight")),r=0,t=0;t<this.contentPanels.length;t++)n(this.contentPanels[t]).hasClass("e-active-content")?(padding=Math.max(r,this._getDimension(n(this.contentPanels[t]),"outerHeight")-this._getDimension(n(this.contentPanels[t]),"height")),this.model.height!=null&&this.model.heightAdjustMode=="none"?n(this.contentPanels[t]).outerHeight(i).css({overflow:"auto"}):n(this.contentPanels[t]).height(i-padding).css({overflow:"auto"})):(r=Math.max(r,this._getDimension(n(this.contentPanels[t]),"outerHeight")-this._getDimension(n(this.contentPanels[t]),"height")),this.model.height!=null&&this.model.heightAdjustMode=="none"?n(this.contentPanels[t]).outerHeight(i).css({overflow:"auto"}):n(this.contentPanels[t]).height(i-r).css({overflow:"auto"}))},_disableItems:function(t){if(!this.model.enabled)return!1;if(t!=null){for(var i=0;i<t.length;i++)n.inArray(t[i],this.model.disabledItemIndex)==-1&&this.model.disabledItemIndex.push(t[i]);this.model.disabledItemIndex.sort();this._disableTabs()}},_enableItems:function(t){var i,r;if(!this.model.enabled)return!1;for(i=0;i<t.length;i++)r=t[i],this.model.disabledItemIndex=n.grep(this.model.disabledItemIndex,function(n){return n!=r});this._disableTabs()},disable:function(){for(var t=[],n=0;n<this.getItemsCount();n++)t.push(n);this._disableItems(t);this.model.enabledItemIndex=[];this._unWireEvents()},enable:function(){for(var i=[],t=0;t<this.getItemsCount();t++)n.inArray(t,this.model.enabledItemIndex)<0&&(this.model.enabledItemIndex.push(t),i.push(t)),this._enableItems(t);this.model.disabledItemIndex=[]},getItemsCount:function(){if(this.items)return this.items.length},addItem:function(r,u,f,e,o){var h,s,a,c,l,v,y,p;for(this._addItemIndex=f>=0&&f<this.items.length?f:this.items.length,h=0;h<this.model.disabledItemIndex.length;h++)this.model.disabledItemIndex[h]>=f&&this.model.disabledItemIndex[h]++;this.model.headerPosition=="left"?this.items.length>=0&&this.itemsContainer.addClass("e-left"):this.model.headerPosition=="right"?this.items.length>=0&&this.itemsContainer.addClass("e-right"):this.items.length==0&&this.itemsContainer.addClass("e-header");s=t.buildTag("li.e-select e-item");this.model.headerPosition=="top"&&(this.model.enableRTL?n(s).addClass("e-rtl-top-line e-top-hover"):n(s).addClass("e-bottom-line"));t.isNullOrUndefined(e)||(a=t.buildTag("span").addClass(e),s.append(a));f===i&&u===i&&r!=null&&(u="Item");f===i&&u===i&&o===i&&(r="#Item"+this.items.length,u="Item");o!=i?(o.indexOf("#")!=0&&(o="#"+o),this.divId=o):r!=i&&(o=r);c=t.buildTag("a",u,{},{href:r});(this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&c.appendTo(s);this.model.showCloseButton&&(l=t.buildTag("div.e-icon e-close e-tabdelete","",{},{}).css("visibility","hidden"),s.append(l),this._on(l,"click",this._tabDeleteClick));(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&c.appendTo(s);f===i&&(f=this.anchors.length);v=f>=this.items.length;v?s.appendTo(this.itemsContainer):s.insertBefore(this.items[f]);t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize(this.model.headerSize);this.selectedItemIndex()==f?(this.hideItem[f],this.selectedItemIndex(this.selectedItemIndex()+1)):(this.hideItem[f],f<this.selectedItemIndex()&&this.selectedItemIndex(this.selectedItemIndex()+1));this._itemsRefreshing();this._reinitialize(!0);this.model.headerPosition=="top"&&n(this.contentPanels[f]).addClass("e-hidebottom");this.model.headerPosition=="bottom"&&(n(this.contentPanels[f]).addClass("e-hidetop"),s.addClass("e-top-line e-item e-select e-margine-bottom"));this.model.headerPosition=="left"&&n(this.contentPanels[f]).addClass("e-hideleft");this.model.headerPosition=="right"&&n(this.contentPanels[f]).addClass("e-hideright");y={tabHeader:this.anchors[f],tabContent:this.contentPanels[f]};this.refreshTabScroll();this._addItemIndex=null;this._onAdd(y);this.model.showReloadIcon&&(p=t.buildTag("div.e-icon e-reload","",{},{role:"presentation"}).css("visibility","hidden"),n(this.element.find("li")[f]).append(p));this.model.enableTabScroll&&this.model.headerPosition=="right"&&n(this.contentPanels).css("height",this.model.height+"px")},_isSizeExceeded:function(){for(var r,u=this.element.width(),i=0,f=this.items.length,t=0;t<f;t++)r=n(this.items[t]).width(),i+=r;return i>u?!0:!1},refreshTabScroll:function(){this._isSizeExceeded()?(this.element.find("div.e-chevron-circle-right").length>=1&&this.element.find("div.e-chevron-circle-right").remove(),this.model.enableTabScroll&&(this._checkScroll(),this._addScrollIcon())):(this.model.headerPosition=="left"||this.model.headerPosition=="right"&&this._tabContentsHeight()>(this.element.width()||Number(this.model.height))||this.model.headerPosition=="top"||this.model.headerPosition=="bottom")&&this._checkScroll()},removeItem:function(t){var i,r;if(!this.model.enabled)return!1;if(t!=null&&t>-1&&t<this.items.length){if(this._onBrforeRemove({index:t})===!0)return!1;for(i=n(this.items[t]).remove(),this.model.disabledItemIndex=[],i.hasClass("e-active")&&(t==0?this.selectedItemIndex(t+1):this.selectedItemIndex(t-1),this.showItem(this.selectedItemIndex())),n(this.element.find(">div.e-content")[t]).remove(),this.contentPanels.splice(t,1),t<this.selectedItemIndex()?this.selectedItemIndex(this.selectedItemIndex()-1):this.selectedItemIndex(),(t<0||t>=this.anchors.length)&&this.selectedItemIndex(0),(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&this.items.length==1?this._removeVerticalClass():this.items.length==1&&this.itemsContainer.removeClass("e-header"),this._unWireEvents(),this._itemsRefreshing(),this._wireEvents(this.model.events),this.model.enableTabScroll&&this._on(this.element.find("div.e-chevron-circle-right"),"click",this._tabScrollClick),indx=0;indx<this.items.length;indx++)n(this.items[indx]).hasClass("e-disable")&&this.model.disabledItemIndex.push(indx);this._disableTabs();r={removedTab:i};this._onRemove(r)}this.getItemsCount()==0&&(this.itemsContainer.removeAttr("style"),this.itemsContainer.find("div").remove());this._tabContentsHeight()<Number(this.model.height)&&this.itemsContainer.css("clip").split("px").length&&this.model.enableTabScroll&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")?(this._refresh(),this.itemsContainer.removeAttr("style"),this._leftScrollIcon?this._leftScrollIcon.remove():"",this._rightScrollIcon?this._rightScrollIcon.remove():""):this.model.enableTabScroll&&(this.model.headerPosition=="left"||this.model.headerPosition=="right")&&(this._leftScrollIcon&&Number(this.itemsContainer.css("clip").split("px")[0].replace(",","").split("(")[1])!=-Number(this._leftScrollIcon.css("margin-top").split("px")[0])?(this._removeScroll(),this._addScroll()):this.refreshTabScroll(),this.showItem(this.selectedItemIndex()))},show:function(){if(!this.model.enabled)return!1;this.element.css("visibility","visible")},hide:function(){if(!this.model.enabled)return!1;this.element.css("visibility","hidden")},_onBeforeLoad:function(n){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,url:n,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),url:n,isInteraction:this._isInteraction},this._trigger("ajaxBeforeLoad",t)},_focusIn:function(){if(!this.model.readOnly&&this.model.allowKeyboardNavigation)n(this.element).on("keydown",n.proxy(this._keyPress,this))},_focusOut:function(){n(this.element).off("keydown",n.proxy(this._keyPress,this))},_onLoad:function(n){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,url:n,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),url:n,isInteraction:this._isInteraction},this._trigger("ajaxLoad",t)},_onActive:function(){var n;return n=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),isInteraction:this._isInteraction},this._isInteraction=!0,this._trigger("itemActive",n)},_onBeforeActive:function(n){if(this.model.beforeActive!=null){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabSelectedIndex],prevActiveIndex:this._preTabSelectedIndex,activeHeader:null,activeIndex:null,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabSelectedIndex],prevActiveIndex:this._preTabSelectedIndex,activeHeader:this.items[n],activeIndex:n,isInteraction:this._isInteraction},this._trigger("beforeActive",t)}},_onAdd:function(n){return this._trigger("itemAdd",n)},_onRemove:function(n){return this._trigger("itemRemove",n)},_onBrforeRemove:function(n){return this._trigger("beforeItemRemove",n)}});t.Tab.HeightAdjustMode={Content:"content",Auto:"auto",Fill:"fill",None:"none"};t.Tab.Position={Top:"top",Bottom:"bottom",Left:"left",Right:"right"}}(jQuery,Syncfusion),function(n,t){t.widget("ejTagCloud","ej.TagCloud",{element:null,model:null,validTags:["div","span"],_rootCSS:"e-tagcloud",_setFirst:!1,defaults:{cssClass:"",htmlAttributes:{},dataSource:null,query:null,fields:{text:"text",url:"url",frequency:"frequency",htmlAttributes:"htmlAttributes"},showTitle:!0,titleText:"Title",titleImage:null,format:"cloud",enableRTL:!1,minFontSize:"10px",maxFontSize:"40px",mouseover:null,mouseout:null,click:null,create:null,destroy:null},dataTypes:{cssClass:"string",showTitle:"boolean",titleText:"string",titleImage:"string",format:"enum",enableRTL:"boolean",dataSource:"data",query:"data",fields:"data",htmlAttributes:"data"},_init:function(){this._initialize();this._render()},_setModel:function(n){for(var t in n)switch(t){case"fields":case"query":case"dataSource":case"minFontSize":case"maxFontSize":this._refreshTagItems(t,n[t]);break;case"showTitle":this._showTitle(n[t]);break;case"titleText":this._title(n[t]);break;case"titleImage":this._titleImage(n[t]);break;case"cssClass":this._changeSkin(n[t]);break;case"format":this._format(n[t]);break;case"enableRTL":this._rtl(n[t]);break;case"htmlAttributes":this._addAttr(n[t])}},_refreshTagItems:function(n,t){this.model[n]=t;this.ul.empty();this._checkDataBinding()},_showTitle:function(n){n?(this._generateTitle(),this.ul.removeClass("e-notitle")):(this.titleText.remove(),this.ul.addClass("e-notitle"),this.titleText=null)},_title:function(n){this.titleText&&(n?this.text?this.text.html(n):this._generateTextTag(n):this.text&&(this.text.remove(),this.text=null))},_titleImage:function(n){this.titleText&&(n?this.image?this.image.attr("src",n):this._generateImageTag(n):this.image&&(this.image.remove(),this.image=null))},_changeSkin:function(n){this.model.cssClass!=n&&this.element.removeClass(this.model.cssClass).addClass(n)},insert:function(t){n.trim(t.text)&&this.ul.append(this._generateLi(t,this._getMapper()))},insertAt:function(t,i){n.trim(t.text)&&n(this.ul.children()[i-1]).before(this._generateLi(t,this._getMapper()))},remove:function(t){for(var u=this.ul.children(),r,i=0;i<u.length;i++)r=n(u[i]),r.children()[0].innerHTML==t&&r.remove()},removeAt:function(t){var i=this.ul.children();n(i[t-1]).remove()},_format:function(n){n=="cloud"?(this.ul.removeClass("e-list"),this.ul.addClass("e-cloud")):n=="list"&&(this.ul.removeClass("e-cloud"),this.ul.addClass("e-list"))},_destroy:function(){this.element.removeClass("e-widget "+this.model.cssClass);this.element.empty()},_initialize:function(){this.minFreq=0;this.maxFreq=30;this.ul=null;this.titleText=null;this.image=null;this.text=null},_render:function(){this.element.addClass("e-widget "+this.model.cssClass);this.model.showTitle&&this._generateTitle();this._renderWrapper();this._checkDataBinding();this._addAttr(this.model.htmlAttributes);this._checkProperties()},_generateTitle:function(){this.titleText=t.buildTag("div.e-header e-title");this.model.titleImage&&this._generateImageTag(this.model.titleImage);this.model.titleText&&this._generateTextTag(this.model.titleText);this.ul?this.titleText.insertBefore(this.ul):this.element.append(this.titleText)},_generateImageTag:function(t){this.image||(this.image=n('<img class="e-title-img" src="'+t+'" />'));this.text&&!this.model.titleImage?this.image.insertBefore(this.text):this.titleText.append(this.image)},_generateTextTag:function(n){this.text||(this.text=t.buildTag("span",n));this.titleText.append(this.text)},_renderWrapper:function(){var n;n=this.model.format=="list"?"list":"cloud";this.ul=t.buildTag("ul.e-ul e-box e-"+n);this.element.append(this.ul);this.model.showTitle||this.ul.addClass("e-notitle")},_renderItems:function(n){this._generateTagItems(n);this.ul.removeClass("e-load")},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n)})},_checkProperties:function(){this.model.enableRTL&&this._rtl(this.model.enableRTL)},_rtl:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_checkDataBinding:function(){var n=this.model.dataSource;n!=null&&(this.ul.addClass("e-load"),t.DataManager&&n instanceof t.DataManager?this._initDataSource(n):this._renderItems(n))},_initDataSource:function(n){var t=this,i=n.executeQuery(this._getQuery());i.done(function(n){t._renderItems(n.result)}).fail(function(){t.ul.removeClass("e-load")})},_setAttributes:function(n,t){if(n)for(var i in n)i=="class"?t.addClass(n[i]):t.attr(i,(i=="style"?t.attr("style")+";":"")+n[i])},_getQuery:function(){var r;if(t.isNullOrUndefined(this.model.query)){var u=[],i=t.Query(),n=this.model.fields;for(r in n)r!=="tableName"&&n[r]&&u.push(n[r]);u.length>0&&i.select(u);this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query;return i},_generateTagItems:function(t){var i,r=this._getMapper(),u=function(n){return n[r._freq]},f=t.map?t.map(u):n.map(t,u);for(this.minFreq=Math.min.apply(Math,f),this.maxFreq=Math.max.apply(Math,f),i=0;i<t.length;i++)this.ul.append(this._generateLi(t[i],r))},_getMapper:function(){var n=this.model.fields,t={_text:null,_freq:null,_url:null};return t._text=n&&n.text?n.text:"text",t._freq=n&&n.frequency?n.frequency:"frequency",t._url=n&&n.url?n.url:"url",t._attr=n&&n.htmlAttributes?n.htmlAttributes:"htmlAttributes",t},_generateLi:function(n,i){var u=t.buildTag("li.e-tagitems"),r;return r=t.buildTag("a.e-txt",n[i._text]||n[i._url],{"font-size":this._calculateFontSize(n[i._freq])},{role:"link"}),n[i._url]&&r.attr({href:n[i._url],target:"blank"}),this._setAttributes(n[i._attr],r),u.append(r),this._on(r,"mouseenter",this._mouseEnter),this._on(r,"mouseleave",this._mouseLeave),this._on(r,"click",this._mouseClick),u},_mouseEnter:function(t){n(t.target).addClass("hover");this._raiseEvent(t,"mouseover")},_mouseLeave:function(t){n(t.target).removeClass("hover");this._raiseEvent(t,"mouseout")},_mouseClick:function(t){n(t.target).removeClass("hover");this._raiseEvent(t,"click")},_raiseEvent:function(t,i){this._trigger(i,{value:n(t.target).html(),url:n(t.target).attr("href"),eventType:i,target:n(t.target)})},_calculateFontSize:function(n){if(n){var t=2,i,r,u=parseInt(this.model.minFontSize,10),f=parseInt(this.model.maxFontSize,10);return i=(n-this.minFreq)/(this.maxFreq-this.minFreq),r=f-u,u+t*Math.floor(i*(r/t))}return this.model.minFontSize}});t.Format={Cloud:"cloud",List:"list"}}(jQuery,Syncfusion),function(n,t){t.widget("ejTileBase","ej.TileBase",{defaults:{badge:{enabled:!1,value:1,text:null,maxValue:100,minValue:1,position:"bottomright"},caption:{enabled:!0,text:"text",icon:null,position:"innerbottom",alignment:"normal"},enablePersistence:!1,imageClass:null,imagePosition:"center",imageTemplateId:null,imageUrl:null,liveTile:{text:null,enabled:!1,imageClass:null,imageTemplateId:null,imageUrl:null,type:"flip",updateInterval:2e3},cssClass:"",tileSize:"small",width:null,height:null,showRoundedCorner:!1,backgroundColor:null,allowSelection:!1,locale:"en-US",showText:!0,text:"text",textAlignment:"normal"},dataTypes:{imagePosition:"enum",liveTile:{text:"array",type:"enum",enabled:"boolean",updateInterval:"number",imageUrl:"array",imageClass:"array",imageTemplateId:"array"},alignment:"enum",tileSize:"enum",locale:"string"},observables:["badge.value","badge.enabled","badge.text","badge.position","text","caption.text"],_badgeValue:t.util.valueFunction("badge.value"),_badgeEnabled:t.util.valueFunction("badge.enabled"),_badgeText:t.util.valueFunction("badge.text"),_badgePosition:t.util.valueFunction("badge.position"),_captionText:t.util.valueFunction("caption.text"),text:t.util.valueFunction("text"),_setDeprecatedProperties:function(){this.model.caption.enabled=this.defaults.caption.enabled==this.model.caption.enabled&&this.defaults.showText==this.model.showText?this.defaults.caption.enabled:this.model.caption.enabled!=this.defaults.caption.enabled?this.model.caption.enabled:this.model.showText;this._captionText(this.defaults.caption.text==this._captionText()&&this.defaults.text==this.text()?this.defaults.caption.text:this._captionText()!=this.defaults.caption.text?this._captionText():this.text());this.model.caption.alignment=this.defaults.caption.alignment==this.model.caption.alignment&&this.defaults.textAlignment==this.model.textAlignment?this.defaults.caption.alignment:this.model.caption.alignment!=this.defaults.caption.alignment?this.model.caption.alignment:this.model.textAlignment},_tileRender:function(){var f,r,u,i,e;if(this._setDeprecatedProperties(),this._imagePosition=this.model.imagePosition,this._cssClass=this.model.cssClass,this.element.addClass(this.model.cssClass+" "+this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"tile-"+this.model.tileSize),this.model.showRoundedCorner&&this.element.addClass(this._prefix+"tile-round-corner"),this._isLiveTile()?this._liveTile():(this._image=t.buildTag("div").addClass(this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"image-parent"),this._innerImage=t.buildTag("span").addClass(this._prefix+"tile-image "+this._prefix+"tile-image"+this.model.imagePosition),this.model.imageTemplateId?(f=this._isMobile()?t.getCurrentPage().find("#"+this.model.imageTemplateId):n("#"+this.model.imageTemplateId),this._innerImage.addClass(this._prefix+"tile-template").append(f)):this.model.imageClass?this._innerImage.addClass(this.model.imageClass):this.model.imageUrl&&(r=this._isMobile()&&this.model.imagePath?this._getAbsolutePath(this.model.imagePath)+"/"+this.model.renderMode.toLowerCase()+"/"+this.model.imageUrl:this._getAbsolutePath(this.model.imageUrl),this._innerImage.css({"background-image":"url('"+r+"')"}),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&this.model.imagePosition=="fill"&&this._innerImage.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+r+"',sizingMethod='scale')","-ms-filter":"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+r+"',sizingMethod='scale')"})),this._image.append(this._innerImage),this.element.append(this._image),this._setBackgroundColor(this.model.backgroundColor),this.model.imageTemplateId&&this._prefix=="e-m-"&&t.angular.defaultAppName&&t.angular.compile(this._image)),this._isCaptionEnable())if(this.model.liveTile.text&&this._isLiveTile())for(u=this.element.find("."+this._prefix+"image-parent"),i=0,e=u.length;i<e;i++)this._setCaptionClass(n(u[i])),n(u[i]).addClass(this._prefix+"tile-caption-text ").attr("text",this.model.liveTile.text[i]);else this._setCaptionClass(this.element),this.model.caption.icon?(this._captionIcon=this.model.caption.icon,this.element.addClass(this._prefix+"tile-caption-icon "+this._prefix+"icon-"+this._captionIcon)):this.element.addClass(this._prefix+"tile-caption-text ").attr("text",this._captionText());this._badgeEnabled()&&this._setBadgeEnabled();this._selectElement=t.buildTag("span."+this._prefix+"tile-overlay");this.element.append(this._selectElement);this.model.height||(this.model.height=this.model.caption.position=="outer"?this.element.height()-50:this.element.height());this.model.width||(this.model.width=this.element.width());this._isCustomizeSize()&&this._setCustomizSize()},_liveTile:function(){var r,e,o,u,i,s,f;if(this.element.addClass(this._prefix+"livetile-enable"),this.model.liveTile.imageTemplateId)for(i=0;i<this.model.liveTile.imageTemplateId.length;i++)e=t.buildTag("div").addClass(this._prefix+"tile-template "+this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"image-parent "+this._prefix+"tile-"+this.model.liveTile.type),o=this._isMobile()?t.getCurrentPage().find("#"+this.model.liveTile.imageTemplateId[i]):n("#"+this.model.liveTile.imageTemplateId[i]),this.element.append(e.append(o));else if(this.model.liveTile.imageClass)for(i=0;i<this.model.liveTile.imageClass.length;i++)r=t.buildTag("span").addClass(this.model.liveTile.imageClass[i]+" "+this._prefix+"tile-image "+this._prefix+"tile-image"+this.model.imagePosition),u=t.buildTag("div").addClass(this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"tile-"+this.model.liveTile.type+" "+this._prefix+"image-parent"),r.appendTo(u),this.element.append(u);else for(i=0;i<this.model.liveTile.imageUrl.length;i++)s=this._isMobile()&&this.model.imagePath?this._getAbsolutePath(this.model.imagePath)+"/windows/"+this.model.liveTile.imageUrl[i]:this._getAbsolutePath(this.model.liveTile.imageUrl[i]),r=t.buildTag("span").addClass(this._prefix+"tile-image "+this._prefix+"tile-image"+this.model.imagePosition).css({"background-image":"url('"+s+"')"}),f=t.buildTag("div."+this._prefix+"tile-image"+this.model.imagePosition+" "+this._prefix+"tile-"+this.model.liveTile.type+" "+this._prefix+"image-parent"),r.appendTo(f),this.element.append(f);this._setBackgroundColor(this.model.backgroundColor);n(this.element.children()[0]).addClass(this._prefix+"tile-"+this.model.liveTile.type+"back").removeClass(this._prefix+"tile-"+this.model.liveTile.type);this.model.imageTemplateId&&this._prefix=="e-m-"&&(App.angularAppName||t.angular.defaultAppName)&&t.angular.compile(this.element)},_setCustomizSize:function(){var i=(this._isLiveTileMode()||this.model.renderMode=="flat")&&parseInt(this.model.width)<=70?"70":this._isMobile()&&this.model.renderMode=="android"&&this._isBelowSmallSize()?"85":this._isMobile()&&this.model.renderMode=="ios7"&&this._isBelowSmallSize()?"74":this.model.width,n=(this._isLiveTileMode()||this.model.renderMode=="flat")&&parseInt(this.model.height)<=70?"70":this._isMobile()&&(this.model.renderMode=="android"||this.model.renderMode=="ios7")&&this._isBelowSmallSize()?"70":this._isMobile()&&this.model.renderMode=="ios7"&&this._isBelowSmallSize()?"70":this.model.height,t=(this._isLiveTileMode()||this.model.renderMode=="flat")&&!this._isBelowSmallSize()?50:(this._isLiveTileMode()||this.model.renderMode=="flat")&&this._isBelowSmallSize()?0:this._isMobile()&&this.model.renderMode=="android"&&this._isBelowSmallSize()?30:30,r=this.model.caption.enabled&&this.model.caption.position=="outer"&&this.model.height?n?parseInt(n)+t:parseInt(n)+t:this.model.height;this.element.css({width:this.model.width?this.model.width:"70",height:this.model.height?r:this.element.height()+t});this.element.find("."+this._prefix+"image-parent").css({width:this.element.css("width"),height:this.model.height?n:this.element.height()-t});!this._isBelowSmallSize()&&this.model.caption.enabled&&this.model.caption.position=="outer"&&(this.element.find(".e-m-tile-image").css({width:this.model.width?i:"",height:this.model.height?n:""}),this._selectElement.css({width:this.model.width?i:"",height:this.model.height?n:""}));this._isBelowSmallSize()&&(this.element.addClass(this._prefix+"tile-small"),this._isMobile()&&(this.model.renderMode=="android"||this.model.renderMode=="ios7")&&this.model.caption.position=="outer"||this.element.removeAttr("text"))},_isLiveTile:function(){return this._isLiveTileMode()&&this.model.liveTile.enabled},_isLiveTileMode:function(){return!this._isMobile()||this.model.renderMode=="windows"},_setCaptionClass:function(n){n.addClass(this._prefix+"tile-caption "+this._prefix+"caption-"+this.model.caption.position+" "+this._prefix+"caption-align-"+this.model.caption.alignment)},_isCaptionEnable:function(){return this.model.caption.enabled&&!(this.model.tileSize=="small"||this._isBelowSmallSize()&&this.model.tileSize=="small")||this._isMobile()&&(this.model.renderMode=="ios7"||this.model.renderMode=="android")&&this.model.caption.position=="outer"||this._isMobile()&&(this.model.renderMode=="android"||this.model.renderMode=="ios7")&&this.model.caption.position=="outer"&&this._isCustomizeSize()&&this._isBelowSmallSize()},_isBelowSmallSize:function(){var n=this.model.width?parseInt(this.model.width):this.model.width,t=this.model.height?parseInt(this.model.height):this.model.height,i=!this._isMobile()||this._isMobile()&&(this.model.renderMode=="windows"||this.model.renderMode=="flat")?70:this._isMobile()&&this.model.renderMode=="android"?85:74;return n<=i&&n!=null||t<=i&&t!=null},_isCustomizeSize:function(){return this.model.height||this.model.width},_createDelegates:function(){this._onStartDelegate=n.proxy(this._isMobile()?this._onTouchStartHandler:this._onMouseDownHandler,this);this._onEndDelegate=n.proxy(this._isMobile()?this._onTouchEndHandler:this._onMouseUpHandler,this);this._onMoveDelegate=n.proxy(this._isMobile()?this._onTouchMoveHandler:this._onMouseMoveHandler,this);this._onDocClickDelegate=n.proxy(this._onDocClickHandler,this);this._startAnimationDelegate=n.proxy(this["_"+this.model.liveTile.type+"Tile"],this)},_wireEvents:function(i){this._createDelegates();t.listenEvents([this.element,n(document)],[t.startEvent(),t.endEvent()],[this._onStartDelegate,this._onDocClickDelegate],i,this);this._isLiveTile()&&(i?this._stopTileAnimation():this._startTileAnimation())},_onDocClickHandler:function(){this._removeActiveClass()},_removeActiveClass:function(){this._isLiveTileMode()?t._removeSkewClass(this.element):n(this.element).removeClass(this._prefix+"state-active")},_startTileAnimation:function(){this._intervalCounter=setInterval(this._startAnimationDelegate,this.model.liveTile.updateInterval)},_stopTileAnimation:function(){clearInterval(this._intervalCounter)},_flipTile:function(){var n=this.element.find("."+this._prefix+"tile-flipback"),t=this.element.find("."+this._prefix+"tile-flip").first();n.addClass(this._prefix+"tile-flip").removeClass(this._prefix+"tile-flipback");t.addClass(this._prefix+"tile-flipback").removeClass(this._prefix+"tile-flip")},_slideTile:function(){this._animateEffect()},_carouselTile:function(){this._animateEffect()},_animateEffect:function(){var i=this.model.liveTile.type.toLowerCase(),r=this.element.find("."+this._prefix+"image-parent"),t=this.element.find("."+this._prefix+"tile-"+i+"back"),e=t.next()[0]==null?r.first():t.next(),o=t.prev()[0]==null?r.last():t.prev(),u,f;(n(t.next()[0]).hasClass(this._prefix+"tile-overlay")||n(t.prev()[0]).hasClass(this._prefix+"tile-overlay"))&&(u=n(t.next()[0]).next(),f=n(t.next()[0]).prev(),e=u.next()[0]==null?r.first():u.next(),o=f.prev()[0]==null?r.last():f.prev());o.addClass(this._prefix+"tile-"+i).removeClass(this._prefix+"tile-"+i+"up");t.addClass(this._prefix+"tile-"+i+"up").removeClass(this._prefix+"tile-"+i+"back");e.removeClass(this._prefix+"tile-"+i).addClass(this._prefix+"tile-"+i+"back")},_getAbsolutePath:function(n){return this._isMobile()?this._makeUrlAbsolute(n).toString():n},_makeUrlAbsolute:function(i){var r=n("<a href ='"+i+"'><\/a>")[0],u;n("body").append(r);u=r.pathname.indexOf("/")!=0?"/"+r.pathname:r.pathname;var f=t.browserInfo(),e=f.name=="msie"&&f.version=="9.0",o=r.protocol+"//"+(e&&r.port=="80"?r.host.replace(":80",""):r.host)+u+r.search+r.hash;return n(r).remove(),o},_isMobile:function(){return this._prefix=="e-m-"?!0:!1},updateTemplate:function(i,r){var u,f;this._isLiveTile()?(n(this.element.children()[r]).empty(),u=this._isMobile()?t.getCurrentPage().find("#"+i):n("#"+i),n(this.element.children()[r]).append(u)):(f=this._isMobile()?t.getCurrentPage().find("#"+i):n("#"+i),this._image.addClass(this._prefix+"tile-template").empty().append(f))},_setModel:function(n){var u=!1,i,r;for(i in n)if(r="_set"+i.charAt(0).toUpperCase()+i.slice(1),this[r]||i=="locale")switch(i){case"text":this[r](t.util.getVal(n[i]));n[i]=this.text(t.util.getVal(n[i]));t.isNullOrUndefined(this._options)&&(this._options={});this._options.caption=this.model.caption;break;case"locale":t.Tile.Locale[n[i]]&&(this.model.locale=n[i],this._setCulture(),this._setCaptionText(this._captionText()));break;default:this[r](n[i])}else u=!0;u&&this._refresh()},_setCaption:function(n){var u=!1,i,r;for(i in n)if(r="_setCaption"+i.charAt(0).toUpperCase()+i.slice(1),this[r])switch(i){case"text":this[r](t.util.getVal(n[i]));n[i]=this._captionText(t.util.getVal(n[i]));break;default:this[r](n[i])}else u=!0;u&&this._refresh()},_setText:function(n){this._captionText(n);this._setCaptionText(n)},_setCaptionText:function(n){this._isCaptionEnable()?this.element.attr("text",n):this.element.removeAttr("text")},_setCaptionEnabled:function(){this._isCaptionEnable()?this.element.attr("text",this._captionText()):this.element.removeAttr("text")},_setCaptionIcon:function(n){this._isCaptionEnable()&&(this.element.removeClass(this._prefix+"caption-text "+this._prefix+"icon-"+this._captionIcon).addClass(this._prefix+"caption-icon "+this._prefix+"icon-"+n).removeAttr("text"),this._captionIcon=n)},_setCaptionAlignment:function(n){this._isCaptionEnable()&&this.element.removeClass(this._prefix+"caption-align-normal "+this._prefix+"caption-align-left "+this._prefix+"caption-align-center "+this._prefix+"caption-align-right").addClass(this._prefix+"caption-align-"+n)},_setShowRoundedCorner:function(n){n?this.element.addClass(this._prefix+"tile-round-corner"):this.element.removeClass(this._prefix+"tile-round-corner")},_setCssClass:function(n){this.element.removeClass(this._cssClass).addClass(n);this._cssClass=n},_setBackgroundColor:function(n){!this._isMobile()||this._isMobile()&&this.model.renderMode=="windows"||this.model.caption.position=="outer"?this.element.find("."+this._prefix+"tile-image").css("background-color",n):this.element.css("background-color",n)},_setTileSize:function(n){this._isCaptionEnable()?this._isCaptionEnable()&&this.element.attr("text",this._captionText()):this.element.removeAttr("text");this.element.css({width:"",height:""});this.element.find("."+this._prefix+"image-parent").css({width:"",height:""});this.element.removeClass(this._prefix+"tile-small "+this._prefix+"tile-medium "+this._prefix+"tile-wide "+this._prefix+"tile-large").addClass(this._prefix+"tile-"+n);this.model.height=this.element.height();this.model.width=this.element.width()},_setImagePosition:function(t){this.element.removeClass(this._prefix+"tile-image"+this._imagePosition).addClass(this._prefix+"tile-image"+t);n(this.element.find("."+this._prefix+"tile-image")).removeClass(this._prefix+"tile-image"+this._imagePosition).addClass(this._prefix+"tile-image"+t);this._imagePosition=this.model.imagePosition},_setBadge:function(n){var i,r;for(i in n)if(r="_setBadge"+i.charAt(0).toUpperCase()+i.slice(1),this[r])switch(i){case"value":case"enabled":case"text":this[r](t.util.getVal(n[i]));typeof n[i]=="function"?n[i](this["_badge"+i.charAt(0).toUpperCase()+i.slice(1)]()):n[i]=this["_badge"+i.charAt(0).toUpperCase()+i.slice(1)]();break;default:this[r](n[i])}},_setBadgeValue:function(n){if(this._badgeEnabled()){n=t.isNullOrUndefined(n)?this._badgeValue():n;var i;this._badgeText()?i=this._badgeText():n<=this.model.badge.maxValue&&n>=this.model.badge.minValue?(i=n.toString(),this._badgeValue(n)):n>this.model.badge.maxValue?(i=this.model.badge.maxValue.toString()+"+",this._badgeValue(this.model.badge.maxValue)):(i=this.model.badge.minValue.toString(),this._badgeValue(this.model.badge.minValue));this.element.addClass(this._prefix+"tile-badge "+this._prefix+"badge-position-"+this._badgePosition());this.element.addClass(this._prefix+"tile-badge-value").attr("badgeValue",i)}else this.element.removeClass(this._prefix+"tile-badge "+this._prefix+"badge-position-"+this._badgePosition()+" "+this._prefix+"tile-badge-value")},_setBadgePosition:function(n){this._badgePosition(n);this._badgeEnabled()&&this.element.removeClass(this._prefix+"badge-position-bottomright "+this._prefix+"badge-position-topright").addClass(this._prefix+"badge-position-"+this._badgePosition())},_setBadgeEnabled:function(n){this._badgeEnabled(n);this._setBadgeValue()},_setBadgeMaxValue:function(n){this.model.badge.maxValue=n;this._setBadgeValue()},_setBadgeMinValue:function(n){this.model.badge.minValue=n;this._badgeEnabled()&&this._setBadgeValue()},_setBadgeText:function(n){this._badgeText(n);this._badgeEnabled()&&this._setBadgeValue()},_clearElement:function(){this.element.removeAttr("class");this.element.html(this._orgEle.html())},_destroy:function(){this._wireEvents(!0);this._clearElement()}})}(jQuery,Syncfusion),function(n,t){t.widget("ejTile","ej.Tile",{_setFirst:!0,validTags:["div"],_rootCSS:"e-tile",defaults:{mouseDown:null,mouseUp:null},_init:function(n){this._options=n;this._setCulture();this._orgEle=this.element.clone();this._liveTileimageTemplateParent=[];this._cloneLiveTileImageTemplateElement=[];this._renderEJControl()},_renderEJControl:function(){if(this.model.captionTemplateId&&(this._captionTemplateParent=n("#"+this.model.captionTemplateId).parent(),this._cloneCaptionTemplateElement=n("#"+this.model.captionTemplateId).clone()),this.model.imageTemplateId&&(this._imageTemplateParent=n("#"+this.model.imageTemplateId).parent(),this._cloneImageTemplateElement=n("#"+this.model.imageTemplateId).clone()),this.model.liveTile.enabled&&this.model.liveTile.imageTemplateId)for(i=0;i<this.model.liveTile.imageTemplateId.length;i++)this._liveTileimageTemplateParent[i]=n("#"+this.model.liveTile.imageTemplateId[i]).parent(),this._cloneLiveTileImageTemplateElement[i]=n("#"+this.model.liveTile.imageTemplateId[i]).clone();this.element.addClass("e-tile-web");this._prefix="e-";this._tileRender();this._wireEvents()},_onMouseDownHandler:function(i){var r=this.element;r.addClass(t._getSkewClass(r,i.pageX,i.pageY).replace("e-m-","e-"));this._trigger("mouseDown",{text:r.attr("text"),index:n(i.target).index()});t.listenTouchEvent(this.element,t.moveEvent(),this._onMoveDelegate,!1,this);t.listenTouchEvent(this.element,t.endEvent(),this._onEndDelegate,!1,this);this._isMoved=!1},_onMouseMoveHandler:function(){this._isMoved=!0;this._removeActiveClass()},_onMouseUpHandler:function(i){this.model.allowSelection&&(this._selected?this._selected&&(this._selected=!1,this._selectElement.removeClass("e-tile-selected")):(this._selected=!0,this._selectElement.addClass("e-tile-selected")));!this._isMoved&&this.model.mouseUp&&this._trigger("mouseUp",{text:this.element.attr("text"),index:n(i.target).index(),select:this._selected});this._removeActiveClass();this._isMoved=!1;t.listenTouchEvent(this.element,t.moveEvent(),this._onMoveDelegate,!0,this);t.listenTouchEvent(this.element,t.endEvent(),this._onEndDelegate,!0,this)},_refresh:function(){if(this._destroy(),this.element.addClass("e-tile e-js"),this.model.captionTemplateId&&n(this._captionTemplateParent).append(this._cloneCaptionTemplateElement),this.model.imageTemplateId&&n(this._imageTemplateParent).append(this._cloneImageTemplateElement),this.model.liveTile.enabled&&this.model.liveTile.imageTemplateId)for(i=0;i<this.model.liveTile.imageTemplateId.length;i++)n(this._liveTileimageTemplateParent[i]).append(this._cloneLiveTileImageTemplateElement[i]);this._renderEJControl()},_setCulture:function(){this.model.locale!="en-US"&&(t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.caption)||t.isNullOrUndefined(this._options.caption.text))&&t.isNullOrUndefined(this._options.text))&&this._captionText(this._getLocalizedLabels().captionText)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.Tile.Locale=t.Tile.Locale||{};t.Tile.Locale["default"]=t.Tile.Locale["en-US"]={captionText:"text"};t.Tile.ImagePosition={Center:"center",TopCenter:"topcenter",BottomCenter:"bottomcenter",RightCenter:"rightcenter",LeftCenter:"leftcenter",TopLeft:"topleft",TopRight:"topright",BottomRight:"bottomright",BottomLeft:"bottomleft",Fill:"fill"};t.Tile.BadgePosition={TopRight:"topright",BottomRight:"bottomright"};t.Tile.CaptionAlignment={Normal:"normal",Left:"left",Right:"right",Center:"center"};t.Tile.CaptionPosition={InnerTop:"innertop",InnerBottom:"innerbottom",Outer:"outer"};t.Tile.TileSize={Medium:"medium",Small:"small",Large:"large",Wide:"wide"};t.Tile.LiveTileType={Flip:"flip",Slide:"slide",Carousel:"carousel"};n.extend(!0,t.Tile.prototype,t.TileBase.prototype)}(jQuery,Syncfusion),function(n,t){t.widget("ejRadialSliderBase","ej.RadialSliderBase",{defaults:{radius:200,ticks:[0,10,20,30,40,50,60,70,80,90,100],enableRoundOff:!0,value:10,autoOpen:!0,enableAnimation:!0,cssClass:null,labelSpace:30,stop:null,slide:null,start:null,change:null,create:null,destroy:null},dataTypes:{radius:"number",enableRoundOff:"boolean",enableAnimation:"boolean",cssClass:"string"},observables:["value"],observableArray:["ticks"],value:t.util.valueFunction("value"),ticks:t.util.valueFunction("ticks"),_outerTextCalculation:function(n,t,i){var e=this._isMobile()?this.model.radius-this.model.labelSpace:this.model.radius+this.model.labelSpace,f,s,o,r,u;for(this._point=(i-t)/(n-1),i=t+(i-t)/(n-1),f=i,s=f,this._textPoints=[],o=0;o<n;o++)r={},u=t,t=t*Math.PI/180,i=i*Math.PI/180,r.X2=this._startXY+e*Math.cos(t),r.Y2=this._startXY+e*Math.sin(t),r.textAlignment=u<=270&&90<=u?"middle":"start",t=f,i=f+this._point,f+=this._point,this._textPoints.push(r);return r={},u=this._startValueAngle,this._startValueAngle=this._startValueAngle*Math.PI/180,r.X2=this._startXY+e*Math.cos(this._startValueAngle),r.Y2=this._startXY+e*Math.sin(this._startValueAngle),r.textAlignment=u<=270&&90<=u?"middle":"start",this._textPoints.push(r),this._textPoints},_polarToCartesian:function(n,t,i,r,u){var f=r*Math.PI/180;return{x:n+i*Math.cos(f),y:t+i*Math.sin(u?-f:f)}},_tapHandlerEvent:function(t){var e=n("#"+this._prefix+this._elementID+"-radial-slider-svg").offset(),o=t.clientY,s=t.clientX,h=e.top+this._radialWidth/2-n(window).scrollTop(),c=e.left+this._radialWidth/2,u,f,l,r,i;if(this._dynamicAngleCalculation(c,s,h,o),u=this._isMobile()&&this.model.renderMode=="ios7"?6.5:this._isMobile()&&this.model.renderMode=="windows"?2.5:5,!this._isMobile()&&this._angle>=360-this._endAngle&&this._angle<=360-this._startAngle||this._isMobile()&&this._angle>=360-(this._endAngle-u)&&this._angle<=360-(this._startAngle+u)||this._isMobile()&&this.model.position.charAt(0).toLowerCase()=="l"&&(this._angle>270+u||this._angle<90-u)){if(this._lineAngleCalculation(!0),this._previousAngle=this._angle,this._isMobile()||(n(this._overLine).remove(),this._pathBeforeAddlength=this._tickCount+1,this._pathAfterAddLength=this._directionLine.toString().replace(/[^M]/g,"").length,this._pathBeforeAddlength<this._pathAfterAddLength?(f=this._isTapSelected?2:1,this._directionLine.remove(this._tickCount,f,f)):this._directionLine.remove(this._tickCount,1),this._dynamicLineCalculation(this._angle,!1,!0,!0,this._tickCount,this._tickCount+1,!0),n(this._pathLineElement).attr("d",this._directionLine.toString())),n(this._textGroupElement).find("[id="+this._prefix+this._elementID+"-dynamic-text]").length>0&&this._textGroupElement.find("[id="+this._prefix+this._elementID+"-dynamic-text]").remove(),l=this._selectPart(),r=l.select,this._isTicksControl()){if(i=this._ticksCalculation(),this._isMobile()&&this.model.position.charAt(0).toLowerCase()=="l"?this.line.textAlignment="end":this._isMobile()&&this.model.position.charAt(0).toLowerCase()=="r"?this.line.textAlignment="start":this._isMobile()&&(this.model.position.charAt(0).toLowerCase()=="b"||this.model.position.charAt(0).toLowerCase()=="t")&&(this.line.textAlignment="middle"),(this._isMobile()&&this.ticks().indexOf(i)==0||this.ticks().indexOf(i)==this._tickCount-1)&&(this.line.textAlignment="middle"),this.ticks().indexOf(i)<0){this._outerTextElement=this._createSVGElements("text",{"stroke-width":.5,x:this.line.X2,y:this.line.Y2,"class":this._prefix+"dynamic-text",id:this._prefix+this._elementID+"-dynamic-text",textContent:i,"text-anchor":this.line.textAlignment});this._textGroupElement.append(this._outerTextElement);var a=document.getElementById(this._prefix+this._elementID+"-dynamic-text").getBoundingClientRect(),c=this._textPoints[r.toFixed()].X2,h=this._textPoints[r.toFixed()].Y2,s=this.line.X2,o=this.line.Y2,b=Math.sqrt(Math.pow(s-c,2)+Math.pow(o-h,2));if(b<a.width*72/96){this.line={};var v=i.toString().length,y=a.width*72/96-(this._isMobile()?v*2:v*4),k=parseFloat(r.toFixed(3).substr(0,1))==r.toFixed()?this._degPoint[r.toFixed()]+y:this._degPoint[r.toFixed()]-y,p=(360-k)*(Math.PI/180),w=this._isMobile()?this.model.radius-this.model.labelSpace:this.model.radius+this.model.labelSpace;this.line.X2=this._startXY+w*Math.cos(p);this.line.Y2=this._startXY+w*Math.sin(-p);n("#"+this._prefix+this._elementID+"-dynamic-text").attr({x:this.line.X2,y:this.line.Y2})}}}else i=this.ticks()[r.toFixed()];this._trigger("change",{value:i,oldValue:this.value()});this._needleStop&&this.model.stop&&this._trigger("stop",{value:i});this.value(i);this._needleStop=!0;this._needleMove=!1;this._isMobile()&&(this.model.renderMode=="windows"||this.model.renderMode=="flat"?this._dynamicWindowsRadial():this._dynamicIOSandAndroidRadial())}},_selectPart:function(){var t=this._dynamicAngle,i=this._startAngle,u=this._endAngle,n;this._isMobile()&&(n=this.model.renderMode=="ios7"?5:this.model.renderMode=="windows"?2.5:5,i=this._startAngle+n,u=this._endAngle-n,this.model.position.charAt(0).toLowerCase()=="l"&&this._dynamicAngle<180&&(t=this._dynamicAngle+360));var r=(t-i)/((u-i)/(this.ticks().length-1)),f=this.ticks()[parseInt(r)],e=this.ticks()[parseInt(r)+1],o=e-f;return{select:r,firstValue:f,space:n,difference:o,dynamicAngle:t}},_lineAngleCalculation:function(n){var t=this._selectPart(),i,f,r,u;this._degPoint.splice(this.ticks().length,this.ticks().length+1);this._degPoint.push(this._degPoint[this._degPoint.length-1]+this._point);i=(this._degPoint[parseInt(t.select)+1]-this._degPoint[parseInt(t.select)]-(this._degPoint[parseInt(t.select)+1]-t.dynamicAngle))/(this._point/t.difference);f=parseInt(t.select)!=0?this._degPoint[parseInt(t.select)]:this._degPoint[parseInt(t.select)];this.model.enableRoundOff&&n?(u=parseFloat(i.toFixed(2)),i=parseInt(i.toFixed()),r=t.difference==.5&&u>=.25?this._point*1:this._point/t.difference*i):r=this._point/t.difference*parseFloat(i.toFixed(2));this._angle=360-this._degPoint[parseInt(t.select)]-Math.abs(r)},_isTicksControl:function(){var t=this._selectPart(),i,r;return this._degPoint.splice(this.ticks().length,this.ticks().length+1),this._degPoint.push(this._degPoint[this._degPoint.length-1]+this._point),i=(this._degPoint[parseInt(t.select)+1]-this._degPoint[parseInt(t.select)]-(this._degPoint[parseInt(t.select)+1]-this._dynamicAngle))/(this._point/t.difference),r=this.model.enableRoundOff?parseInt(i.toFixed())==0||parseInt(i.toFixed())==t.difference?!1:!0:n.inArray(this._angle,this._degPoint)>-1?!1:!0,r},_ticksCalculation:function(){var t=this._selectPart(),r=t.select,s=t.dynamicAngle,h=t.difference,e=t.firstValue,l=t.space,e=this.ticks()[parseInt(r)],u,f,o,n,i,c;return this.line={},u=this._angle*(Math.PI/180),f=this._isMobile()?this.model.radius-this.model.labelSpace:this.model.radius+this.model.labelSpace,this.line.X2=this._startXY+f*Math.cos(u),this.line.Y2=this._startXY+f*Math.sin(-u),this.line.textAlignment=this._angle<=270&&90<=this._angle?"middle":"start",o=parseInt(r)!=0?this._degPoint[parseInt(r)]:this._degPoint[parseInt(r)],n=(s-o)/(this._point/h),this.model.enableRoundOff?(c=parseFloat(n.toFixed(1).substr(1,3)),n=parseInt(n.toFixed()),i=e+Math.abs(n)):(i=e+Math.abs(parseFloat(n.toFixed(2))),i=parseFloat(i.toFixed(2))),i},_dynamicAngleCalculation:function(n,t,i,r){var u=Math.atan2(r-i,t-n);this._angle=(360-u*180/Math.PI)%360;this._dynamicAngle=(360+u*180/Math.PI)%360},_createSVGElements:function(t,i){var r=document.createElementNS(this._svgLink,t);return n.each(i,function(n,t){n=="xlink:href"&&r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t);n!="textContent"?r.setAttribute(n,t):r.textContent=t}),r},show:function(){this.model.enableAnimation&&(this.element.removeClass(this._prefix+"slider-hide").addClass(this._prefix+"slider-show"),this._radialSVG.attr("class","").attr("class",this._prefix+"radialslider-svg-show "+this._prefix+"rs-svg"));this.element.css("display","block");this.model.autoOpen=!0},hide:function(){var n=this;this.model.enableAnimation?(this.element.removeClass(this._prefix+"slider-show").addClass(this._prefix+"slider-hide"),this._radialSVG.attr("class","").attr("class",this._prefix+"radialslider-svg-hide "+this._prefix+"rs-svg"),this.model.autoOpen?setTimeout(function(){n.element.css("display","none")},this._isMobile?150:400):n.element.css("display","none")):n.element.css("display","none");this.model.autoOpen=!1},_setModel:function(n){t.isNullOrUndefined(n.inline)||n.inline||(this.model.radius+=50);n.ticks&&(this.model.ticks=n.ticks);this._refresh()},_clearElement:function(){this.element.removeAttr("class");this.element.html(this._orgEle.html())},_destroy:function(){this._wireEvents(!0);this._clearElement()},_isMobile:function(){return this._prefix=="e-m-"?!0:!1}})}(jQuery,Syncfusion),function(n,t,i){t.widget("ejRadialSlider","ej.RadialSlider",{_setFirst:!0,validTags:["div"],_rootCSS:"e-radialslider",defaults:{mouseover:null,strokeWidth:2,inline:!1,endAngle:360,startAngle:0,innerCircleImageClass:null,innerCircleImageUrl:null,showInnerCircle:!0,inline:!1},dataTypes:{innerCircleImageClass:"string",innerCircleImageUrl:"string",showInnerCircle:"boolean",inline:"boolean",strokeWidth:"number",endAngle:"number",startAngle:"number"},_init:function(){this._orgEle=this.element.clone();this._renderEJControl()},_renderEJControl:function(){this._prefix="e-";this._directionLine=this._getStringBuilder();this._initialization();this._renderControl();this._wireEvents(!1)},_initialization:function(){this.element.addClass(this.model.cssClass);this._svgLink="http://www.w3.org/2000/svg";this._startXY=this.model.radius-(this.model.inline?50:0);this._startAngle=this.model.startAngle;this._endAngle=this.model.endAngle;this._diameter=2*this.model.radius;this._elementID=this.element.attr("id");this.model.radius=this._startXY;this._tickCount=this.ticks().length;this._labelSpacing=this.model.inline?0:200;this._radialWidth=this._diameter+this._labelSpacing;this.element.css({width:this._diameter+this._labelSpacing,height:this._diameter+this._labelSpacing});this._radialSliderWrapper=t.buildTag("div",{},{},{"class":this._prefix+"radail-slider-wrapper"}).css({width:this._radialWidth,height:this._radialWidth});this.model.showInnerCircle&&(this._innerCircle=t.buildTag("div",{},{},{"class":this._prefix+"inner-circle"}).css({left:this._radialWidth/2-(20+this.model.strokeWidth+1),top:this._radialWidth/2-(20+this.model.strokeWidth+1),"border-width":this.model.strokeWidth+1}),this.model.innerCircleImageClass?this._innerCircle.addClass(this.model.innerCircleImageClass):this._innerCircle.css({"background-image":"url('"+this.model.innerCircleImageUrl+"')"}),this._radialSliderWrapper.append(this._innerCircle));this.element.append(this._radialSliderWrapper)},_renderControl:function(){var t,r;this._radialSVG=n(this._createSVGElements("svg",{id:this._prefix+this._elementID+"-radial-slider-svg","class":this._prefix+"rs-svg",width:this._diameter+this._labelSpacing,height:this._diameter+this._labelSpacing}));var i=this.model.inline?50:100,u=this.model.inline?45:95,f=this.model.inline?55:105;for(this._pathLineGroupElement=n(this._createSVGElements("g",{id:"outerLineCircle",transform:"translate("+i+","+i+")"})),this._lineDirection=this._outerLineCalculation(50,40,this._tickCount,!0,!0,"path"),this._textGroupElement=n(this._createSVGElements("g",{id:"outerTextCircle",transform:"translate("+u+","+f+")"})),this._circleGroupElement=n(this._createSVGElements("g",{id:"circlegroup",transform:"translate("+i+","+i+")"})),this._circlePath=this._createSVGElements("path",{id:"circlepath",d:this._circleArcDirection(this._startAngle,this._endAngle),"class":this._prefix+"radialarcdefault",fill:"none","stroke-width":this.model.strokeWidth}),this._circleGroupElement.append(this._circlePath),this._circleGroupElement.append(this._radialCircle),this._outerTextDirection=this._outerTextCalculation(this._tickCount,this._startAngle,this._endAngle),t=0;t<this._tickCount+1;t++){if(r=t==0&&this._startAngle==0&&this._endAngle==360?this._tickCount-1:t,this._outerTextElement,t==this._tickCount)if(this.ticks()[0]==this.value())continue;else this._outerTextElement=this._createSVGElements("text",{"stroke-width":.5,x:this._outerTextDirection[t].X2,y:this._outerTextDirection[t].Y2,id:this._prefix+this._elementID+"-dynamic-text","class":this._prefix+"dynamic-text",textContent:this.value(),"text-anchor":this._outerTextDirection[t].textAlignment});else this._outerTextElement=this._createSVGElements("text",{"stroke-width":.5,x:this._outerTextDirection[t].X2,y:this._outerTextDirection[t].Y2,"class":this._prefix+"ticks-text",textContent:this.ticks()[r],"text-anchor":this._outerTextDirection[t].textAlignment});this._textGroupElement.append(this._outerTextElement)}this._pathLineElement=this._createSVGElements("path",{"class":this._prefix+"radial-needle",d:this._lineDirection,fill:"none","stroke-width":this.model.strokeWidth});this._pathLineGroupElement.append(this._pathLineElement);this._radialSliderWrapper.append(this._radialSVG.append(this._pathLineGroupElement).append(this._textGroupElement).append(this._circleGroupElement));this.model.autoOpen?this.show():this.hide()},_circleArcDirection:function(n,t){var i=.5*Math.min(this._diameter-(this.model.inline?100:0),this._diameter-(this.model.inline?100:0)),r=this._polarToCartesian(this._startXY,this._startXY,i,n),u=this._polarToCartesian(this._startXY,this._startXY,i,t);return ArcSweep=t-n<=180?"0":"1",["M",r.x,r.y,"A",i,i,0,ArcSweep,1,u.x,u.y-1].join(" ")},_overNeedleMoveHandler:function(t){var r,f,e,o;t.preventDefault();var u=n("#"+this._prefix+this._elementID+"-radial-slider-svg").offset(),s=t.clientY,h=t.clientX,c=u.top+this._radialWidth/2-n(window).scrollTop(),l=u.left+this._radialWidth/2;this._dynamicAngleCalculation(l,h,c,s);this._angle>360-this._endAngle&&this._angle<360-this._startAngle&&(this.line={},r=this.model.radius,this.line.X1=this._startXY,this.line.Y1=this._startXY,f=Math.cos(this._angle*Math.PI/180),e=-Math.sin(this._angle*Math.PI/180),this.line.X2=this._startXY+(r-5)*f,this.line.Y2=this._startXY+(r-5)*e,this._overLine!=i?n(this._overLine).attr({d:[" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" "),"stroke-width":this.model.strokeWidth==1?this.model.strokeWidth-.5:this.model.strokeWidth-1}):this._overLine=this._createSVGElements("path",{"class":this._prefix+"needle-over",d:[" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" "),"stroke-width":this.model.strokeWidth==1?this.model.strokeWidth-.5:this.model.strokeWidth-1}),this._pathLineGroupElement.append(this._overLine),this._isNeedleOver=!0,o=this._ticksCalculation(),this.model.mouseover&&this._trigger("mouseover",{value:o,selectedValue:this.value()}))},_needleMoveHandler:function(i){var u,f;t.blockDefaultActions(i);t.isTouchDevice()&&(i=i.touches?i.touches[0]:i);var r=n("#"+this._prefix+this._elementID+"-radial-slider-svg").offset(),e=i.clientY,o=i.clientX,s=r.top+this._radialWidth/2-n(window).scrollTop(),h=r.left+this._radialWidth/2;this._dynamicAngleCalculation(h,o,s,e);this._angle>360-this._endAngle&&this._angle<360-this._startAngle&&(n(this._overLine).remove(),this._lineAngleCalculation(),u=this._isTapSelected?this._tickCount+1:this._tickCount,this._directionLine.remove(u,1,1),this._dynamicLineCalculation(this._angle,!1,!0,!0,this._tickCount,this._tickCount+1,!1),n(this._pathLineElement).attr("d",this._directionLine.toString()),this.model.slide&&(f=this._ticksCalculation(),this._trigger("slide",{value:f,selectedValue:this.value()})),this._needleMove=!0)},_dynamicLineDirection:function(n,t,i){var r={},u=this._polarToCartesian(this._startXY,this._startXY,this.model.radius,n,i),f=this._polarToCartesian(this._startXY,this._startXY,this.model.radius+10,n,i);return r.X1=u.x,r.Y1=u.y,r.X2=f.x,r.Y2=f.y,this._isTapSelected=!0,this._directionLine.insert(t+2,[" M",r.X1,r.Y1,"L",r.X2,r.Y2].join(" ")),this._directionLine.toString()},_inLineCalculation:function(n,t){var i={},r=this._polarToCartesian(this._startXY,this._startXY,this.model.radius-5,n,t);return i.X1=this._startXY,i.Y1=this._startXY,i.X2=r.x,i.Y2=r.y,this._directionLine.append([" M",i.X1,i.Y1,"L",i.X2,i.Y2].join(" ")),this._directionLine.toString()},_dynamicLineCalculation:function(n,t,i,r,u,f,e){var o,s,h;return this.line={},o=this.model.radius,this.line.X1=this._startXY,this.line.Y1=this._startXY,s=Math.cos(n*Math.PI/180),h=-Math.sin(n*Math.PI/180),this.line.X2=this._startXY+(o-5)*s,this.line.Y2=this._startXY+(o-5)*h,e&&this._dynamicLineDirection(n,u,!0),t&&this._directionLine.append([" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" ")),r&&this._directionLine.insert(u+3,[" M",this.line.X1,this.line.Y1,"L",this.line.X2,this.line.Y2].join(" ")),this._directionLine.toString()},_getStringBuilder:function(){var n=[],t=0;return{append:function(i){return n[t++]=i,this},remove:function(i,r,u){return t=t-(u||1),n.splice(i,r||1),this},insert:function(i,r){return n.splice(i,0,r),t++,this},toString:function(t){return n.join(t||"")}}},_outerLineCalculation:function(n,t,i,r,u,f){var c=this.model.radius,s=this._startAngle,l=s+(this._endAngle-this._startAngle)/(i-1),v,o,e,b,k;this._point=(this._endAngle-this._startAngle)/(i-1);var h=l,tt=h,w=[];if(this._degPoint=[],this._degPoint.push(s),r)for(v=0;v<i;v++)o={},s=s*Math.PI/180,l=l*Math.PI/180,this._degPoint.push(h),f!="text"&&(o.X1=this._startXY+c*Math.cos(s),o.Y1=this._startXY+c*Math.sin(s)),o.X2=this._startXY+(c+10)*Math.cos(s),o.Y2=this._startXY+(c+10)*Math.sin(s),s=h,l=h+this._point,h+=this._point,f=="path"?this._directionLine.append([" M",o.X1,o.Y1,"L",o.X2,o.Y2].join(" ")):w.push(o);if(u)for(e=0;e<this.ticks().length;e++){var a=e+1,y=e==this.ticks().length-1?this.ticks()[this.ticks().length-1]+.5:this.ticks()[a],p=e==0?this.ticks()[e]-.5:this.ticks()[e],d=p<=0&&p>=this.value()?!0:!1,g=y<=0&&y<=this.value()?!0:!1,nt=d&&g?!0:p<=this.value()&&this.value()<y;nt&&(this.ticks()[e]!=this.value()?(b=this._point/(this.ticks()[a]-this.ticks()[e]),k=this.ticks()[a]-this.value(),this._startValueAngle=this._degPoint[a]-b*k,this._dynamicLineDirection(this._startValueAngle,this._tickCount-2,!1),this._inLineCalculation(this._startValueAngle,!1)):(this._startValueAngle=this._degPoint[e],this._inLineCalculation(this._startValueAngle,!1)))}return this._path=f=="path"?this._directionLine.toString():w,this._path},_refresh:function(){this._destroy();this.model.enableRoundOff&&(this.model.value=Math.round(this.model.value));this.element.addClass("e-radialslider e-js");this._renderEJControl()},_createDelegates:function(){this._touchStartDelegate=n.proxy(this._touchStartHandler,this);this._needleMoveDelegate=n.proxy(this._needleMoveHandler,this);this._touchEndDelegate=n.proxy(this._touchEndHandler,this);this._overNeedleMoveDelegate=n.proxy(this._overNeedleMoveHandler,this);this._mouseOutDelegate=n.proxy(this._mouseOutHandler,this);this._enterMouseDelegates=n.proxy(this._entermouse,this)},_wireEvents:function(n){var i=n?"off":"on";this._createDelegates();t.listenEvents([this._radialSVG,this._radialSVG,this._radialSVG,this._radialSVG],[t.endEvent(),t.startEvent(),"mouseenter","mouseleave"],[this._touchEndDelegate,this._touchStartDelegate,this._enterMouseDelegates,this._mouseOutDelegate],!1)},_entermouse:function(){t.listenEvents([this._radialSVG],[t.moveEvent()],[this._overNeedleMoveDelegate],!1)},_mouseOutHandler:function(r){if(r.preventDefault(),this._radialSVG.has(r.target).length==0&&this._needleMove){t.listenEvents([this._radialSVG],[t.moveEvent()],[this._needleMoveDelegate],!0);var u=this._previousAngle!=i?this._previousAngle:this._startValueAngle;this._pathAfterAddLength=this._directionLine.toString().replace(/[^M]/g,"").length;this._directionLine.remove(this._pathAfterAddLength-1,1);this._inLineCalculation(u,!0);n(this._pathLineElement).attr("d",this._directionLine.toString());this._needleMove=!1}n(this._overLine).remove()},_touchEndHandler:function(n){n=n.touches?n.changedTouches[0]:n;t.listenEvents([this._radialSVG],[t.moveEvent()],[this._needleMoveDelegate],!0);this._tapHandlerEvent(n)},_touchStartHandler:function(n){t.blockDefaultActions(n);t.isTouchDevice()&&(n=n.touches?n.touches[0]:n);this._needleStop=!1;this.model.start&&this._trigger("start",{value:this.value()});t.listenEvents([this._radialSVG],[t.moveEvent()],[this._needleMoveDelegate],!1)}});n.extend(!0,t.RadialSlider.prototype,t.RadialSliderBase.prototype)}(jQuery,Syncfusion),function(n,t,r){t.widget("ejTreeView","ej.TreeView",{_rootCSS:"e-treeview",element:null,model:null,validTags:["ul","div"],_addToPersist:["expandedNodes","checkedNodes","selectedNodes"],_setFirst:!1,_requiresID:!0,defaults:{allowMultiSelection:!1,showCheckbox:!1,enableAnimation:!0,allowDragAndDrop:!1,htmlAttributes:{},allowDropChild:!0,allowDropSibling:!0,allowDragAndDropAcrossControl:!0,allowEditing:!1,allowKeyboardNavigation:!0,items:null,fields:{dataSource:null,query:null,tableName:null,child:null,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass",expanded:"expanded",hasChild:"hasChild",selected:"selected",linkAttribute:"linkAttribute",imageAttribute:"imageAttribute",htmlAttribute:"htmlAttribute",imageUrl:"imageUrl",isChecked:"isChecked"},autoCheckParentNode:!1,loadOnDemand:!1,cssClass:"",template:null,enableRTL:!1,expandOn:"dblclick",enablePersistence:!1,enabled:!0,expandedNodes:[],checkedNodes:[],selectedNode:-1,selectedNodes:[],width:null,height:null,autoCheck:!0,enableMultipleExpand:!0,fullRowSelect:!1,sortSettings:{allowSorting:!1,sortOrder:"ascending"},nodeClick:null,beforeExpand:null,nodeExpand:null,beforeCollapse:null,nodeCollapse:null,beforeSelect:null,nodeSelect:null,nodeUnselect:null,nodeCheck:null,nodeUncheck:null,inlineEditValidation:null,beforeEdit:null,nodeEdit:null,keyPress:null,nodeDragStart:null,nodeDrag:null,nodeDragStop:null,nodeDropped:null,beforeAdd:null,nodeAdd:null,beforeDelete:null,nodeDelete:null,beforeCut:null,nodeCut:null,beforePaste:null,nodePaste:null,beforeLoad:null,loadSuccess:null,loadError:null,ready:null,create:null,destroy:null},dataTypes:{allowMultiSelection:"boolean",cssClass:"string",showCheckbox:"boolean",enableAnimation:"boolean",allowDragAndDrop:"boolean",allowDropChild:"boolean",allowDragAndDropAcrossControl:"boolean",allowEditing:"boolean",allowKeyboardNavigation:"boolean",autoCheckParentNode:"boolean",loadOnDemand:"boolean",enableRTL:"boolean",expandOn:"string",enablePersistence:"boolean",enableMultipleExpand:"boolean",fullRowSelect:"boolean",items:"data",fields:{dataSource:"data",query:"data",child:"data"},expandedNodes:"array",checkedNodes:"array",selectedNode:"number",selectedNodes:"array",htmlAttributes:"data",sortSettings:{allowSorting:"boolean",sortOrder:"enum"}},observables:["fields.dataSource"],dataSource:t.util.valueFunction("fields.dataSource"),_setModel:function(i){var r,l,s,h,c,e,f,u,o,a;for(r in i)switch(r){case"allowMultiSelection":this.model.allowMultiSelection=i[r];this.model.allowMultiSelection||(l=n(this._liList[this.model.selectedNodes[0]]),this._unselectAll(),this._isRender=!1,this._nodeSelectionAction(l),this._isRender=!0);break;case"cssClass":this._changeSkin(i[r]);break;case"fields":if(this._deepWatch&&!t.isNullOrUndefined(i[r].dataSource)&&JSON.stringify(this._oldDataSource)==JSON.stringify(typeof i[r].dataSource=="function"?i[r].dataSource():i[r].dataSource))return;this._unWireEvents();h=this.element.hasClass("e-js")?!1:!0;c=h?this.element.children("ul"):this.element;c.empty();this.model.fields==null||i[r]==null?this.model.fields=i[r]:this._extendFields(this.model.fields,i[r]);this.model.expandedNodes=[];this.model.checkedNodes=[];this.model.selectedNodes=[];this.model.selectedNode=-1;this._persistValues(this.model.expandedNodes,"expandedNodes");this._persistValues(this.model.checkedNodes,"checkedNodes");this._persistValues(this.model.selectedNodes,"selectedNodes");this._newDataSource=this.dataSource();!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null?this._checkDataBinding():this._initialize();h&&(s=this.element.children(".e-treeview-ul"),c.append(s.children()),s.remove());break;case"allowDragAndDropAcrossControl":this.model.allowDragAndDropAcrossControl=i[r];this._enableDragDrop();break;case"enabled":this._enabledAction(i[r]);break;case"showCheckbox":i[r]?(this.model.showCheckbox=i[r],this._showCheckBox(),this.model.enabled||this.element.find(".nodecheckbox").ejCheckBox("disable")):(this.element.find(".e-item > div > .e-chkbox-wrap").remove(),this._updateCheckedNodes());break;case"autoCheck":this.model.autoCheck=i[r];break;case"autoCheckParentNode":this.model.autoCheckParentNode=i[r];break;case"expandedNodes":if(u=i[r].length,e=JSON.parse(JSON.stringify(this.model.expandedNodes)),u>0)for(this._expandNodes(i[r]),f=0,u=e.length;f<u;f++)i[r].indexOf(e[f])==-1&&this._collpaseNode(n(this._liList[e[f]]));else u==0&&this._collapseAll();i[r]=this.model.expandedNodes;break;case"checkedNodes":if(this.model.showCheckbox)if(u=i[r].length,e=JSON.parse(JSON.stringify(this.model.checkedNodes)),u>0)for(this._checkedNodes(i[r]),f=0,u=e.length;f<u;f++)i[r].indexOf(e[f])==-1&&this._nodeUncheck(n(this._liList[e[f]]).find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]);else u==0&&this._uncheckAll();i[r]=this.model.checkedNodes;break;case"expandOn":this._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:this.model.expandOn,this._expandEventHandler);this._assignTouchExpandOn(i[r]);this._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:i[r],this._expandEventHandler);break;case"allowEditing":this._preventEditable();i[r]&&this._allowEditable();break;case"allowKeyboardNavigation":o=i[r]?"_on":"_off";this[o](this.element,"keydown",this._KeyPress);break;case"allowDragAndDrop":this.model.allowDragAndDrop=i[r];i[r]?this._addDragableClass():this._preventDraggable();break;case"allowDropChild":this.model.allowDropChild=i[r];i[r]?this._addDragableClass():this._preventDropChild();break;case"allowDropSibling":this.model.allowDropSibling=i[r];i[r]?this._addDragableClass():this._preventDropSibling();break;case"enableRTL":this.model.enableRTL=i[r];a=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;o=this.model.enableRTL?"addClass":"removeClass";a[o]("e-rtl");break;case"height":this.element.is("ul")?this.element.parent().height(i[r]):this.element.height(i[r]);break;case"width":this.element.is("ul")?this.element.parent().width(i[r]):this.element.width(i[r]);break;case"selectedNode":case"selectedNodes":this.model.selectedNodes=r=="selectedNode"?[i[r]]:i[r];this.element.find("a.e-text.e-active").removeClass("e-node-focus e-active").closest("li").attr("aria-selected",!1);this._doSelectNodes(this.model.selectedNodes,!1);r!="selectedNode"&&(i[r]=this.model.selectedNodes);break;case"htmlAttributes":this._addAttr(i[r]);break;case"enableMultipleExpand":i[r]||this.collapseAll();this.model.enableMultipleExpand=i[r];break;case"sortSettings":n.extend(this.model.sortSettings,i[r]);t.isNullOrUndefined(this.model.fields)||this.dataSource()==null||(this.model.expandedNodes=[],this.model.checkedNodes=[],this.model.selectedNodes=[],this._checkDataBinding());break;case"fullRowSelect":this._wholeRowEvents("_off");this.model.fullRowSelect=i[r];this.model.fullRowSelect?this._addWholeRowWrap():this._removeWholeRowWrap();this._doWholeRowAction();this._wholeRowEvents("_on")}},_destroy:function(){this.element.html("");this._cloneElement.removeClass("e-treeview e-js e-treeview-wrap");var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;t.replaceWith(this._cloneElement);n("#"+this._id+"_WaitingPopup").remove();window.localStorage?(window.localStorage.removeItem(this._id+"_childNodes"),window.localStorage.removeItem(this._id+"_persistedValues")):window.cookie&&(document.cookie=this._id+"_childNodes=; expires=Thu, 01 Jan 1970 00:00:00 UTC",document.cookie=this._id+"_persistedValues=; expires=Thu, 01 Jan 1970 00:00:00 UTC")},_init:function(){var i,r,n;this._cloneElement=this.element.clone();this._dataSource=[];this._fragment=[];this._templateType="";this._indexID=0;this._newDataSource=this.dataSource();this._id=this.element.prop("id");this._treeList=[];this._isTextbox=!1;this._isDevice=this._checkDevice();this._deepWatch=this.element.attr("e-deepwatch")==="true";i=t.browserInfo();this._isIE8=i.name=="msie"&&i.version=="8.0"?!0:!1;this._oldDataSource=JSON.parse(JSON.stringify(this.dataSource()));this._assignTouchExpandOn(this.model.expandOn);this.model.enablePersistence&&(r=this._getCookies("_persistedValues"),r||(n={selectedNodes:[],expandedNodes:[],checkedNodes:[]},n=this._updatePersistAttr(n),this._setCookies("_persistedValues",JSON.stringify(n))));t.isNullOrUndefined(this.model.fields)||this.dataSource()==null?(this._initialize(),this._completeRendering()):this._checkDataBinding()},_initialize:function(){this._cutNode=null;this._beforeEditText=null;this._CurrenctSelectedNodes=[];this._isLoaded=!1;this._renderMultiTouchDialog();this.element.is("ul")?this._createWrapper():(this.element.addClass("e-treeview-wrap e-widget").attr("tabindex",0).children("ul:first").addClass("e-ul e-box"),this.model.width!=null&&this.element.width(this.model.width),this.model.height!=null&&this.element.height(this.model.height),this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),this._addAttr(this.model.htmlAttributes));this._elementSettings();this._beforeBaseClass();this.dataSource()==null&&(this._addBaseClass(),this._controlRender());this._addWholeRowWrap();this._isIE8&&(this.element.is("UL")?this.element.parent(".e-treeview-wrap").addClass("e-ie8"):this.element.addClass("e-ie8"));this._finalize()},_completeRendering:function(){this._treeList.length!=0||this._isLoaded||(this._finalizeNode(),this._enabledAction(this.model.enabled),this._triggerEvent("ready",{element:this.element[0]}),this._isLoaded=!0)},_addWholeRowWrap:function(){this.model.fullRowSelect&&(this.element.is("UL")?this.element.parent(".e-treeview-wrap").addClass("e-fullrow-wrap"):this.element.addClass("e-fullrow-wrap"))},_removeWholeRowWrap:function(){this.element.is("UL")?this.element.parent(".e-treeview-wrap").removeClass("e-fullrow-wrap"):this.element.removeClass("e-fullrow-wrap")},_doWholeRowAction:function(){var t,r,i,u;if(this.model.fullRowSelect)for(t=0,r=this._liList.length;t<r;t++)i=n(this._liList[t]),i[0]!=null&&(u=i.find("> .e-text-wrap"),this._renderWholeRow(i,u));else this.element.find(".e-fullrow").remove()},_renderWholeRow:function(t,i){if(t&&this.model.fullRowSelect){var r=document.createElement("div");r.setAttribute("class","e-fullrow");i?n(r).insertAfter(i):t[0].appendChild(r)}},_extendFields:function(t,i){if(t==null||i==null)t=i;else if(t.child==null||i.child==null)n.extend(t,i);else{this._extendFields(t.child,i.child);var r=t.child;n.extend(t,i);n.extend(t.child,r)}},_checkDevice:function(){return t.isDevice()&&t.isTouchDevice()},_assignTouchExpandOn:function(n){this._touchExpandOn=n=="dblclick"?"doubletap":n=="click"?"tap":n},_renderMultiTouchDialog:function(){var i,r,u;this._customPop=t.buildTag("div.e-fe-popup","",{display:"none"});i=t.buildTag("div.e-content");r=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSelection&&(u=t.buildTag("span.e-rowselect e-icon"),i.append(u));this._customPop.append(i);this._customPop.append(r);this.element.append(this._customPop);this._on(i,this._isDevice&&n.isFunction(n.fn.tap)?"touchstart":"mousedown",this._popupClick)},_popupClick:function(){var n=this._customPop.find(".e-rowselect");n.hasClass("e-spanclicked")?this._hidePopup():(this._isPopup=!0,n.addClass("e-spanclicked"))},_hidePopup:function(){this._customPop!=null&&this._customPop.is(":visible")&&(this._customPop.find(".e-rowselect").removeClass("e-spanclicked"),this._customPop.hide(),this._isPopup=!1)},_elementSettings:function(){var n=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;this.element.is("ul")?n.attr("role","tree"):n.attr("aria-activedescendant",this._id+"_active").children("ul:first").attr("role","tree")},_beforeBaseClass:function(){var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap")[0]:this.element[0];this._ulList=n(t.querySelectorAll("ul"));this._liList=n(t.querySelectorAll("li"))},_createWrapper:function(){var n=t.buildTag("div.e-treeview-wrap e-widget "+this.model.cssClass,"","",{tabindex:0,"aria-activedescendant":this._id+"_active"});this.model.width!=null&&n.width(this.model.width);this.model.height!=null&&n.height(this.model.height);this.model.enableRTL&&n.addClass("e-rtl");n.insertAfter(this.element);n.append(this.element.addClass("e-ul e-box").attr("tabindex",0));this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?i._enabledAction(!1):i.element.attr(t,n)})},_changeSkin:function(n){if(this.model.cssClass!=n){var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;t.removeClass(this.model.cssClass).addClass(n);t.find(".e-item > div > .e-chkbox-wrap").removeClass(this.model.cssClass).addClass(n);this._waitingPopup&&this._waitingPopup.option("cssClass",n)}},_enabledAction:function(n){this.model.enabled=n;n?(this.element.removeClass("e-disable"),this._wireEvents()):(this.element.addClass("e-disable"),this._unWireEvents())},_checkDataBinding:function(){this.dataSource()instanceof t.DataManager?this._initDataSource():(this._ensureDataSource(this.dataSource()),this._initialize(),this._completeRendering())},_initDataSource:function(){this.element.ejWaitingPopup({cssClass:this.model.cssClass});this._waitingPopup=this.element.ejWaitingPopup("instance");this._waitingPopup.maindiv.addClass("e-tree-popup");var n=this,i,r;this.element.ejWaitingPopup("refresh");this.element.ejWaitingPopup("show");r=this._columnToSelect(this.model.fields);i=this.dataSource().executeQuery(r);i.done(function(i){n.element.ejWaitingPopup("hide");n.retriveData=i.xhr&&i.xhr.responseJSON&&i.xhr.responseJSON.d?i.xhr.responseJSON.d:i.result?i.result:[];n._typeOfFieldId=n.retriveData[0]?(typeof n.retriveData[0][n.model.fields.id]).toLowerCase():"";n._ensureDataSource(n.retriveData);n._initialize();(n.model.loadOnDemand||t.isNullOrUndefined(n.model.fields.child))&&n._completeRendering()})},_columnToSelect:function(n){var u=[],r=t.Query(),i;if(n.query||t.isNullOrUndefined(n.tableName))r=n.query?n.query:r;else{for(i in n)i!=="tableName"&&i!=="child"&&i!=="dataSource"&&n[i]&&u.push(n[i]);u.length>0&&r.select(u);this.dataSource().dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||r.from(n.tableName)}return r},_ensureDataSource:function(n){n=this._getSortAndFilterList(this.model.fields,n);this.currentSelectedData=n;this._renderTemplate(n);this.element.is("ul")?this.element.html(this._fragment.firstChild.children):this.element.html(this._fragment)},_getTemplateType:function(n,t){for(var i=0,r=n.length;i<r;i++){if(n[i].hasOwnProperty(t.parentId)||n[i].hasOwnProperty(t.hasChild))return 1;if(n[i].hasOwnProperty("child"))return 2}return 1},_groupingObjects:function(n,t){for(var u,r={},f=[],i=0,e=n.length;i<e;i++)u=JSON.stringify(t(n[i])),r[u]=r[u]||[],r[u].push(n[i]);for(i in r)f.push(r[i]);return f},_renderTemplate:function(n){this._onlineData=!1;this._loadOnDemandNodes=!1;var i=this;this._templateType=this._getTemplateType(n,this.model.fields);this._dataSource=this._templateType==1?this._groupingObjects(n,function(n){return[!t.isNullOrUndefined(n)&&[n[i.model.fields.parentId]].toString()]}):n;this._templateNodeCreation(n,this.model.fields)},_templateNodeCreation:function(i,r){var e,u,f,o;if(this._fragment=document.createDocumentFragment(),e=document.createElement("ul"),this._fragment.appendChild(e),u=this._fragment.firstChild,(this._onlineData||this._loadOnDemandNodes)&&(u.className="e-treeview-ul",u.setAttribute("role","group"),n(u).attr("style","display:none")),this.dataSource()!=null){for(f=0,o=i.length;f<o;f++)i[f]&&(t.isNullOrUndefined(i[f][this.model.fields.parentId])||i[f][this.model.fields.parentId]==0||this._loadOnDemandNodes)&&u.appendChild(this._genTemplate(i[f],r));n(u).find(".e-item:first-child:not(:last-child)").addClass("first");n(u).find(".e-item:last-child").addClass("last")}},_onlineDataSource:function(t,i,r){this._loadOnDemandNodes=!0;this._templateNodeCreation(t,r);var u=this.element.find(".e-item#"+i);u[0]!=null&&(n(u[0]).append(this._fragment),u.children().find("> div:first").addClass("e-icon e-plus"),this._finalizeLoadOnDemand(u));this._onlineData=!1},_genTemplate:function(i,r){var v=document.createDocumentFragment(),u,y,f,e,s,o,p,w,h,l,a,c,b;if(y=document.createElement("li"),v.appendChild(y),u=v.firstChild,u.id=i[r.id]?i[r.id]:"",u.setAttribute("role","treeitem"),i[r.htmlAttribute]&&this._setAttributes(i[r.htmlAttribute],u),u.className+=" e-item",e=document.createElement("a"),i[r.imageUrl]?(f=document.createElement("img"),f.className="e-align",f.src=i[r.imageUrl],i[r.imageAttribute]&&this._setAttributes(i[r.imageAttribute],f)):i[r.spriteCssClass]&&(f=document.createElement("span"),f.className=i[r.spriteCssClass]),this.model.template){if(f&&e.appendChild(f),typeof n.fn.render!="function")throw"Error : JsRender dependecy script missing";e.innerHTML+=this._renderEjTemplate(this.model.template,i)}else i[r.text]?n(e).text(i[r.text]):n(e).text("undefined"),f&&e.insertBefore(f,e.lastChild);if(i[r.linkAttribute]&&(typeof i[r.linkAttribute]=="object"?this._setAttributes(i[r.linkAttribute],e):e.href=i[r.linkAttribute]),u.appendChild(e),i[r.expanded]&&(u.className+=" expanded"),i[r.selected]&&(u.className+=" selected"),t.isNullOrUndefined(i[r.isChecked])||(u.className+=i[r.isChecked]?" checked":" unchecked"),u.setAttribute("aria-selected",!1),u.setAttribute("aria-expanded",!1),this.dataSource()instanceof t.DataManager)this._updateElement(u,!0),this.model.showCheckbox&&this._checkboxOnTemplate(u.children[0]),this.model.loadOnDemand?(i[r.hasChild]||i.hasOwnProperty("child"))&&(u.children[0].firstChild.className="e-icon e-plus"):!t.isNullOrUndefined(r.child)&&r.child.dataSource instanceof t.DataManager?(o=this,w=r.child.parentId?r.child.parentId:o.model.fields.parentId,h,h=r.id?r.id:this.model.fields.id,this._treeList.push("false"),p=this._executeDataQuery(r.child,w,this._typeOfFieldId=="number"?parseInt(i[h]):i[h]),p.done(function(n){o._treeList.pop();s=n.xhr&&n.xhr.responseJSON&&n.xhr.responseJSON.d?n.xhr.responseJSON.d:n.result?n.result:[];s=o._getSortAndFilterList(r.child,s);s&&s.length>0&&(o._onlineData=!0,o._onlineDataSource(s,s[0][r.child.parentId],r.child));o._treeList.length==0&&o._completeRendering()})):t.isNullOrUndefined(this.model.fields.child)&&this._childNodeCreation(i,u,r);else if(this.model.loadOnDemand){if(this._updateElement(u,!0),(i[r.hasChild]||i.hasOwnProperty("child"))&&(u.children[0].firstChild.className="e-icon e-plus"),this.model.showCheckbox&&this._checkboxOnTemplate(u.children[0]),i[r.expanded]&&this._childNodeCreation(i,u,r),this.model.enablePersistence&&(l=this._getCookies("_childNodes"),l))for(a=JSON.parse(l),c=0,b=a.length;c<b;c++)if(a[c].toString()==i[r.id].toString()){this._childNodeCreation(i,u,r);break}}else this._onlineData||(this._updateElement(u,!0),this.model.showCheckbox&&this._checkboxOnTemplate(u.children[0]),this._childNodeCreation(i,u,r));return u},_childNodeCreation:function(i,r,u){var f,s,h,e,o,c;if(f=this._templateType==2?!t.isNullOrUndefined(i.child)&&i.child.length>0&&i.child:this._getChildNodes(this._dataSource,{id:i[u.id]}),!t.isNullOrUndefined(f)&&f.length>0){for(r.children[0].firstChild.className="e-icon e-plus",s=document.createDocumentFragment(),h=document.createElement("ul"),s.appendChild(h),e=s.firstChild,e.className="e-treeview-ul",e.setAttribute("role","group"),n(e).attr("style","display:none"),o=0,c=f.length;o<c;o++)f[o]&&e.appendChild(this._genTemplate(f[o],u));r.appendChild(h)}},_checkboxOnTemplate:function(n){n.parentElement.id==""&&(n.parentElement.id=this._id+"_"+this._indexID,this._indexID++);var t=document.createElement("input");t.setAttribute("type","checkbox");t.setAttribute("class","nodecheckbox");t.setAttribute("name",this._id+"_Checkbox_"+n.parentElement.id);t.setAttribute("value",n.parentElement.id);n.insertBefore(t,n.children[1])},_updateElement:function(t,i){var f,e,u,o,s=t.firstChild,h,c,l;s&&(h=s.nodeName,h=="SPAN"||h=="IMG"?(o=s,u=t.lastChild):u=t.lastChild,u&&(l=u.lastChild!=null?u.lastChild.nodeValue:"",c=n.trim(u.innerHTML),textElement=n(u).clone()[0],n(u).remove(),textElement.className+=" e-text CanSelect",textElement.innerHTML=c,t.innerHTML=""),f=document.createElement("div"),f.setAttribute("class","e-text-wrap"),f.setAttribute("role","presentation"),i&&(e=document.createElement("div"),e.setAttribute("role","presentation"),f.appendChild(e)),o&&f.appendChild(o),f.appendChild(textElement),n(t).prop("name")==r&&n(t).prop("name",n.trim(l)),t.appendChild(f),this._renderWholeRow(n(t)))},_setAttributes:function(t,i){for(var r in t)n(i).attr(r,t[r])},_addDragableClass:function(){this.model.allowDragAndDrop&&(this._anchors=this._liList.map(function(){return n("a.e-text",this)[0]}),this._anchors.addClass("e-draggable e-droppable"),this._enableDragDrop(),this._on(this.element,"mouseup touchstart pointerdown MSPointerDown",this._anchors,this._focusElement))},_addBaseClass:function(){this._ulList.addClass("e-treeview-ul").attr("role","group");this._liList.addClass("e-item").attr("role","treeitem");this.element.is("ul")||this.element.find("ul:first").removeClass("e-treeview-ul").addClass("e-ul")},_controlRender:function(){var s=this.element,h,e,i,f,c,l,a,o,y,v,u,p;if(s!=null){for(h=s.find(".e-item"),e=0;e<h.length;e++)i=n(h[e]),a=i.children("ul")[0],a&&n(i.children("ul")[0]).remove(),o=i.children("a")[0],o?(l=n.trim(n(o).text()),f=n(o).clone(),n(o).remove(),c=i.clone(),n(f).prepend(c.children()),n(f).addClass("e-text CanSelect"),i.html("")):(l=n.trim(this._getText(i)),c=i.clone(),i.html(""),f=t.buildTag("a.e-text CanSelect","","",{alt:""}),f.append(c.children()),f[0].innerHTML+=l),y=t.buildTag("div","",{},{role:"presentation"}),v=t.buildTag("div.e-text-wrap","",{},{role:"presentation"}),n(v).append(y).append(f),i.prepend(v),this._renderWholeRow(i),a&&i.append(a),i.prop("name")==r&&i.prop("name",l),this.model.showCheckbox&&this._checkboxOnTemplate(h[e].children[0]);this.model.showCheckbox&&s.find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange})}u=s.find(".e-item");u.find(">ul").hide();p=u.find(".e-text");p.focus(function(){n(this).blur()});u.filter(".e-item:last-child").addClass("last");n(u[0]).addClass("first");n(u[0]).hasClass("first")&&n(u[0]).hasClass("last")&&n(u[0]).removeClass("first");n(u.filter(":has(ul)")).each(function(){n(this).attr("aria-expanded",!1).attr("aria-selected",!1);var t=n(this).children("ul:first");n(t).is(":hidden")?n(this).find("> div > div:first").removeClass("e-icon e-minus").addClass("e-icon e-plus"):n(this.childNodes[1]).removeClass("e-icon e-plus").addClass("e-icon e-minus")})},_getText:function(t){return n(t).clone().children().remove().end().text()},_expandNodes:function(i,r){for(var e,o=i.length,u=[],f=0;f<o;f++)(u=r?this._getNodeByID(i[f]):n(this._liList[i[f]]),t.isNullOrUndefined(u))||!this.model.enableMultipleExpand&&(e=u.siblings().find(">div>.e-minus").closest(".e-item"),e.length>0)||this.isExpanded(u)||(!this.model.loadOnDemand||this.dataSource()instanceof t.DataManager?this._expandNode(u):this._createChildNodesWhenExpand(u))},_checkedNodes:function(t){var r,i,u;for(t.length>0&&this._removeField(this._newDataSource,this.model.fields.isChecked),i=0,u=t.length;i<u;i++)r=n(this._liList[t[i]]),r[0]!=null&&this._nodeCheck(r.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},_finalize:function(){this.model.showCheckbox&&this.element.find(".e-item > div .nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange});this.model.allowEditing&&this._allowEditable()},_finalizeNode:function(){var a,h,r,o,c,y;this._isRender=!1;this._allowOnDemand=!0;var v=this.element,f=this._getCookies("_persistedValues"),i=[],u=[],l,e,s;if(!(this.model.expandedNodes instanceof Array&&this.model.expandedNodes.length>0))for(l=v.find("li.expanded"),o=l.length,r=0;r<o;r++)(a=n(l[r]),!this.model.enableMultipleExpand&&(h=a.siblings().find(">div>.e-minus").closest(".e-item"),h.length>0))||this._expandNode(a);if(f&&(e=JSON.parse(f),i=e.expandedNodes,u=[]),i&&i.length>0&&!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null){for(r=0,o=i.length;r<o;r++)if(u=this.element.find(".e-item#"+i[r]),u[0]!=null){if(!this.model.enableMultipleExpand&&(h=u.siblings().find(">div>.e-minus").closest(".e-item"),h.length>0))continue;!this.model.loadOnDemand||this.dataSource()instanceof t.DataManager?this._expandNode(u):this._createChildNodesWhenExpand(u)}}else s=JSON.parse(JSON.stringify(this.model.expandedNodes)),this._expandNodes(s);if(this.model.showCheckbox)if(f&&(e=JSON.parse(f),i=e.checkedNodes,u=[]),i&&i.length>0&&!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null)for(this._removeField(this._newDataSource,this.model.fields.isChecked),r=0,o=i.length;r<o;r++)u=this.element.find(".e-item#"+i[r]),u[0]!=null&&this._nodeCheck(u.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]);else s=JSON.parse(JSON.stringify(this.model.checkedNodes)),this._checkedNodes(s);this.model.checkedNodes instanceof Array&&this.model.checkedNodes.length>0||this.model.showCheckbox&&this._isCheckedAction();c=!1;f&&(e=JSON.parse(f),i=e.selectedNodes,c=!0);(!f||i&&i.length==0)&&(i=this.model.selectedNodes.length>0?this.model.selectedNodes:this.model.selectedNode==-1?[]:[this.model.selectedNode],c=!1);y={ctrlKey:!0};i&&i.length>0?this._doSelectNodes(i,c):this._isSelectedAction(y);this._isRender=!0;this._allowOnDemand=!1;v.find(".e-item.checked, .e-item.expanded, .e-item.selected").removeClass("checked expanded selected")},_doSelectNodes:function(t,i){for(var u,f={ctrlKey:!0},r=0,e=t.length;r<e;r++)if(u=i?this._getNodeByID(t[r]):n(this._liList[t[r]]),u[0]!=null&&this._nodeSelectionAction(u,f),!this.model.allowMultiSelection)break},_doUnselectNodes:function(n){for(var i,t=0,r=n.length;t<r;t++)if(i=this._getNodeByID(n[t]),i[0]!=null&&this._nodeUnSelectionAction(i),!this.model.allowMultiSelection)break},_updateSelectedNode:function(){var t=n(this._liList).find(".e-text.e-active").closest(".e-item"),i,u,f;if(this.model.selectedNodes=[],this.model.allowMultiSelection||(this.model.selectedNode=null),t[0]==r||t.length<=0){this._persistValues(this.model.selectedNodes,"selectedNodes");return}if(this.model.allowMultiSelection){for(i=0,u=t.length;i<u;i++)f=n(this._liList).index(t[i]),this.model.selectedNodes.push(f);this._persistValues(this.model.selectedNodes,"selectedNodes")}else this._isRender=!1,this._nodeSelectionAction(n(t[0])),this._isRender=!0},_setCookies:function(n,i){window.localStorage?window.localStorage.setItem(this._id+n,i):document.cookie&&t.cookie.set(this._id+n,i)},_getCookies:function(n){return window.localStorage?window.localStorage.getItem(this._id+n):window.cookie?t.cookie.get(this._id+n):void 0},_updateCheckedNodes:function(){for(var r=[],t=this.element.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox.checked").closest(".e-item"),i=0;i<t.length;i++)r.push(n(this._liList).index(t[i]));(r.length>0||t.length==0)&&(this.model.checkedNodes=r);t.length==0&&this.model.checkedNodes.push(-1);this._persistValues(this.model.checkedNodes,"checkedNodes")},_updateExpandedNodes:function(){var t,r=[],i,u;for(t=this.element.find(".e-item > div > .e-minus").closest(".e-item").addClass("e-collapse"),i=0,u=t.length;i<u;i++)r.push(n(this._liList).index(t[i]));(r.length>0||t.length==0)&&(this.model.expandedNodes=r);t.length==0&&this.model.expandedNodes.push(-1);this._persistValues(this.model.expandedNodes,"expandedNodes")},_isCheckedAction:function(){for(var r,u,f,i=this.element.find(".e-item.checked"),t=0;t<i.length;t++)if(r=n(i[t]).find(".e-item"),u=n(i[t]).find(".e-item.unchecked"),r.length==0||!(r.length>0&&u.length==r.length)||!this.model.autoCheck)for(this._nodeCheck(n(i[t]).find("> div > .e-chkbox-wrap > input.nodecheckbox:first")[0]),f=0;f<u.length;f++)this._nodeUncheck(n(u[f]).find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]);this.element.find(".e-item.checked, .e-item.unchecked").removeClass("checked unchecked")},_isExpandedAction:function(){for(var i,u,r=this.element.find("li.expanded"),f=r.length,t=0;t<f;t++)(i=n(r[t]),!this.model.enableMultipleExpand&&(u=i.siblings().find(" > div > .e-minus").closest(".e-item"),u.length>0))||this._expandNode(i);this.element.find(".e-item.expanded").removeClass("expanded")},_isSelectedAction:function(t){for(var r=this.element.find(".e-item.selected"),i=0,u=r.length;i<u;i++)if(r[i]!=null&&this._nodeSelectionAction(n(r[i]),t),!this.model.allowMultiSelection)break;this.element.find(".e-item.selected").removeClass("selected")},_checkedChange:function(t){if(t.isInteraction){var i=this.element.closest(".e-treeview.e-js").data("ejTreeView");action=t.isChecked?"_nodeCheck":"_nodeUncheck";i[action](n(this.element)[0],t)}},_doClickAnimation:function(t){var i=n(t.target);i!=r&&t.type!=r&&(i.addClass("e-animate"),i.is("A")&&i.hasClass("e-text")&&i.closest(".e-text-wrap").addClass("e-animate"))},_ClickEventHandler:function(i){var v=this,u,r=n(i.target),h=r.closest(".e-item").find("> div > div:first"),c,l,e,f,o,a,s;if(this._isPopup=!1,h&&!h.hasClass("e-process")&&(u=r.closest(".e-item"),!u.hasClass("e-node-disable"))){if(this.element.find(".e-animate").removeClass("e-animate"),this._doClickAnimation(i),c=u[0]!=null?u[0].getAttribute("id"):"",this._triggerEvent("nodeClick",{event:i,currentElement:r[0],id:c,parentId:u.closest("ul").closest(".e-item").attr("id")}),!t.isNullOrUndefined(r)&&r.is("DIV"))if(r.hasClass("e-plus")||r.hasClass("e-minus"))if(l=null,r.is("SPAN")&&(r=r.parent("div").find("div:first")),l=u.children("ul:first"),o=this.isChildLoaded(u),!o&&this.model.loadOnDemand){if(r.removeClass("e-plus").addClass("e-load"),this._checkboxChecked=r.parent().find(".nodecheckbox").hasClass("checked"),f=this._getNodeDetails(u),e={currentElement:u,targetElement:r[0],id:f.id,value:f.text,parentId:f.parentId,isChildLoaded:o,hasParent:!0,async:!0},this._isEventTriggered=!0,this._triggerEvent("beforeExpand",e))return!1;this._loadOnDemand(e,r[0])}else r.hasClass("e-plus")?this._expandNode(u):this._collpaseNode(u);else this.model.fullRowSelect&&(r.hasClass("e-fullrow")||r.hasClass("e-text-wrap"))&&(r=r.closest(".e-item").find("> .e-text-wrap .e-text"));r.is("A")||r.hasClass("input-text")||(r=r.closest(".e-text"));!t.isNullOrUndefined(r)&&r.is("A")&&r.hasClass("CanSelect")&&(i&&i.pointerType=="touch"&&this._customPop!=null&&this.model.allowMultiSelection?(a=n(i.target),this._customPop.is(":visible")||this._customPop.show(),this._customPop.is(":visible")&&!this._customPop.find(".e-rowselect").hasClass("e-spanclicked")?(s=a.offset(),this._customPop.offset({left:s.left,top:s.top-40})):i.ctrlKey=!0):this._hidePopup(),r.hasClass("e-active")?this.model.allowMultiSelection&&this._nodeUnSelectionAction(r.closest(".e-item"),i):this._nodeSelectionAction(r.closest(".e-item"),i))}},_getChildTables:function(n,i,r){if(!t.isNullOrUndefined(n.child))return i==r?n.child:this._getChildTables(n.child,i,r+1)},_loadOnDemand:function(i){var u,e,r,f=this,o;if(this.dataSource()instanceof t.DataManager){if(e=i.currentElement.parents("ul").length,r=this._getChildTables(f.model.fields,e,1),t.isNullOrUndefined(r)&&t.isNullOrUndefined(this.model.fields.child)&&(r=this.model.fields),!r){n(i.targetElement).hasClass("e-load")&&n(i.targetElement).removeClass(n(i.targetElement).hasClass("e-plus")||n(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load");return}r.query&&r.query.queries.length>0&&(r.query.queries=[]);o=this._executeDataQuery(r,r.parentId,this._typeOfFieldId=="number"?parseInt(i.currentElement[0].id):i.currentElement[0].id);o.done(function(t){u=t.xhr&&t.xhr.responseJSON&&t.xhr.responseJSON.d?t.xhr.responseJSON.d:t.result?t.result:[];u=f._getSortAndFilterList(r,u);u.length>0?(f._onlineData=!0,f._loadChildNodeWhenOnDemand(u,i,r)):n(i.targetElement).hasClass("e-load")&&n(i.targetElement).removeClass(n(i.targetElement).hasClass("e-plus")||n(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load")})}else u=this._getChildNodes(this._dataSource,i),!t.isNullOrUndefined(u)&&u.length>0?setTimeout(function(){f._createSubNodesWhenLoadOnDemand(u,i.targetElement,f.model.fields)},400):n(i.targetElement).hasClass("e-load")&&n(i.targetElement).removeClass(n(i.targetElement).hasClass("e-plus")||n(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load")},_loadChildNodeWhenOnDemand:function(n,i,r){var u=this;!t.isNullOrUndefined(n)&&n.length>0&&setTimeout(function(){u._createSubNodesWhenLoadOnDemand(n,i.targetElement,r)},100)},_createSubNodesWhenLoadOnDemand:function(t,i,r){this._loadOnDemandNodes=!0;this._templateNodeCreation(t,r);n(this._fragment.firstChild).attr("style","display:none");this._fragment.firstChild.className="e-treeview-ul";this._fragment.firstChild.setAttribute("role","group");i.parentNode.parentNode.appendChild(this._fragment);var u=n(i).closest(".e-item");u.attr({"aria-expanded":!1,"aria-expanded":!0});n(i).removeClass("e-load").addClass("e-plus");this._expandNode(u);this._finalizeLoadOnDemand(u)},_finalizeLoadOnDemand:function(n){var r,u,i,f;this._beforeBaseClass();this._isRender=!1;this.model.showCheckbox&&(n.children("ul").find("li > div > input.nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),r=n.children("ul").find(".e-item"),u=n.children("ul").find(".e-item.unchecked"),u.length>=0&&u.length!=r.length&&this._checkboxChecked?r.not(".unchecked").addClass("checked"):u.length==r.length&&this.isNodeChecked(n)&&this._nodeUncheck(n.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]),this._isLoaded&&(this._isCheckedAction(),this._updateCheckedNodes()));this._isRender=!0;this._addDragableClass();this._preventEditable();this.model.allowEditing&&this._allowEditable();this._isLoaded&&(this._isSelectedAction(),this._updateSelectedNode(),this._allowOnDemand=!0,this._isExpandedAction(),this._updateExpandedNodes(),this._allowOnDemand=!1);!this.model.loadOnDemand||!this.model.enablePersistence||this.dataSource()instanceof t.DataManager||(f=this._getCookies("_childNodes"),f&&(i=JSON.parse(f)),!t.isNullOrUndefined(i)&&i.indexOf(n[0].id)==-1?i.push(n[0].id):i=[n[0].id],this._setCookies("_childNodes",JSON.stringify(i)))},_getChildNodes:function(n,i){var u=[],r,f;if(this._templateType==1){for(r=0,f=n.length;r<f;r++)if(!t.isNullOrUndefined(n[r][0])&&!t.isNullOrUndefined(n[r][0][this.model.fields.parentId])&&n[r][0][this.model.fields.parentId]==i.id)return n[r]}else{for(r=0,f=n.length;r<f;r++){if(n[r][this.model.fields.id]==i.id)return n[r].child;if(n[r].hasOwnProperty("child")&&(u=this._getChildNodes(n[r].child,i),!t.isNullOrUndefined(u)&&u.length>0))break}return u}},_getPath:function(n){for(var i=n.prop("name"),t=n.parents(".e-item:first");t[0]!=null&&t[0].parentNode.id!=this._id;)i=t.prop("name")+"/"+i,t=t.parents(".e-item:first");return this._id+"/"+i},_nodeSelectionAction:function(t,i){var v,e,r,h,c;if(t[0]!=null||t.length!=0){var l=n(t.find("> div > .e-text")[0]),a=!1,y=this.model.selectedNodes.slice(),o=this._liList.index(t[0]);if(this._currNode=t,!this._triggerEvent("beforeSelect",{target:t,nodeDetails:this._getNodeDetails(t)})){if(this.model.allowMultiSelection&&i&&(!i||i.ctrlKey)||(this.element.find("a.e-text.e-active").removeClass("e-node-focus e-active"),this.element.find("[aria-selected=true]").attr("aria-selected",!1),this.element.find(".e-li-active").removeClass("e-li-active"),this.model.fullRowSelect&&(this.element.find(".e-li-focus").removeClass("e-li-focus"),this.element.find(".e-node-focus").removeClass("e-node-focus")),this.element.find("#"+this._id+"_active").removeAttr("id"),this.model.selectedNodes=[],this._deepWatch&&this._removeField(this._newDataSource,this.model.fields.selected)),this.model.allowMultiSelection&&i&&i.shiftKey){this._startNode||(this._startNode=this._currNode);var s=this.getVisibleNodes(),u=s.index(this._startNode),f=s.index(t[0]);for(u>f&&(v=u,u=f,f=v),e=u;e<=f;e++)r=n(s.get(e)),h=this._liList.index(r[0]),n.inArray(h,this.model.selectedNodes)==-1&&(this.model.selectedNodes.push(h),c=r.find("> div > a.e-text"),c.removeClass("e-node-focus"),r.attr("aria-selected",!0),r.addClass("e-li-active"),c.addClass("e-active"),a=!0,this._deepWatch&&this._updateField(this._newDataSource,r.attr("id"),this.model.fields.selected,!0))}else this._startNode=t;this.model.allowMultiSelection||(this.model.selectedNode=o);a||(this.element.find("a.e-text.e-node-focus").removeClass("e-node-focus"),t.attr("aria-selected",!0),t.addClass("e-li-active"),l.addClass("e-active"),this.model.allowMultiSelection||l.attr("id",this._id+"_active"),n.inArray(o,this.model.selectedNodes)==-1&&this.model.selectedNodes.push(o),this._deepWatch&&this._updateField(this._newDataSource,t.attr("id"),this.model.fields.selected,!0));this.model.enablePersistence&&this._persistValues(this.model.selectedNodes,"selectedNodes");this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerGivenEvent("nodeSelect",t)}}},_nodeUnSelectionAction:function(n,t){if(this.model.allowMultiSelection&&t&&!t.ctrlKey){this._nodeSelectionAction(n,t);return}n.removeClass("e-li-active");n.attr("aria-selected",!1).find("> div > .e-text").removeClass("e-active").attr("id","");this._updateUnselectModel(n[0]);this._deepWatch&&(this._updateField(this._newDataSource,n.attr("id"),this.model.fields.selected,!1),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerGivenEvent("nodeUnselect",n)},_updateUnselectModel:function(t){var r=this._liList.index(t),u=this.model.selectedNodes,i;this.model.allowMultiSelection||(this.model.selectedNode=null);i=n.inArray(r,u);i>-1&&this.model.selectedNodes.splice(i,1);this._persistValues(this.model.selectedNodes,"selectedNodes")},_triggerGivenEvent:function(n,t){if(this._isRender){var i={currentElement:t,value:t.find("> div > a.e-text").eq(0).text(),id:t[0].getAttribute("id"),parentId:t.closest("ul").closest(".e-item").attr("id"),selectedNodes:this.model.selectedNodes};this._triggerEvent(n,i)}},_getNodesIndex:function(n){for(var i=[],t=0,r=n.length;t<r;t++)i.push(this._liList.index(n[t]));return i},_nodeEnableAction:function(n){var t=this.getParent(n);t[0]!=null&&t.hasClass("e-node-disable")||(this.model.showCheckbox&&n.find("div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("enable").prop("disabled",!1),n.find(".e-text").removeClass("e-node-disable").closest(".e-item").removeClass("e-node-disable").removeProp("disabled"))},_nodeDisableAction:function(n){var i,t,r;for(this._collpaseNode(n),this.model.showCheckbox&&n.find("div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("disable").prop("disabled",!0),i=n.find(".e-text.e-active").closest(".e-item"),n.find(".e-text").addClass("e-node-disable").removeClass("e-active").attr("id","").closest(".e-item").addClass("e-node-disable").prop("disabled",!0),t=0,r=i.length;t<r;t++)this._updateUnselectModel(i[t])},_getNodeDetails:function(n){if(n[0]!=null&&n.is("LI")&&n.hasClass("e-item")){var i,r,t,u,f,e,o,s,h;return i=n[0].getAttribute("id"),r=n.children("div").find(".e-text:first").text(),t=n.closest("ul").closest(".e-item").attr("id"),u=n.parents("ul").length,f=n.find(".e-item").length,e=this._isNodeExpanded(n),o=this._isChecked(n),s=n.find("> div > .e-text").hasClass("e-active"),h=this._liList.index(n),{id:i,text:r,parentId:t?t:"",level:u,count:f,expanded:e,checked:o,selected:s,index:h}}return{id:"",text:"",parentId:"",level:"",count:"",expanded:"",checked:"",selected:"",index:""}},_denyMultipleExpand:function(t){for(var r=t.siblings().find(">div>.e-minus").closest(".e-item"),i=0,u=r.length;i<u;i++)this._collpaseNode(n(r[i]))},_expandCollapseAction:function(t){if(t&&!t.hasClass("e-process")){var f,o=this,i,r,u,e;if(i=t.closest(".e-item"),t.is("SPAN")&&(t=n(t).parent("div").find("div:first")),f=i.children("ul:first"),f.find("> .e-item").length>0){if(this.model.enableAnimation&&t.addClass("e-process"),r=this._getNodeDetails(i),e=this.isChildLoaded(i),u={currentElement:i,value:r.text,isChildLoaded:e,id:r.id,parentId:r.parentId,async:!1},!this._isNodeExpanded(i)&&e){if(!this._isEventTriggered&&this._triggerEvent("beforeExpand",u))return!1;this._isEventTriggered=!1;i.attr("aria-expanded",!0);this._addExpandedNodes(this._liList.index(i));n(t).removeClass("e-icon e-plus").addClass("e-icon e-minus");i.addClass("e-collapse");this._deepWatch&&this._updateField(this._newDataSource,r.id,this.model.fields.expanded,!0);this._doAnimation(f,t,"nodeExpand",u,350)}else{if(this.element.find(".e-material-animate").removeClass("e-material-animate"),i.attr("aria-expanded",!1),this._triggerEvent("beforeCollapse",u)===!0)return!1;this._removeExpandedNodes(this._liList.index(u.currentElement));n(t).removeClass("e-icon e-minus").addClass("e-icon e-plus");i.removeClass("e-collapse");this._deepWatch&&this._updateField(this._newDataSource,r.id,this.model.fields.expanded,!1);this._doAnimation(f,t,"nodeCollapse",u,200)}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))}}},_doAnimation:function(n,i,r,u,f){var e=this;this.model.enableAnimation?n.animate({height:"toggle"},f,"linear",function(){t.isNullOrUndefined(e.model)||e._doAnimateAction(i,r,u)}):(n.css("display",f==200?"none":"block"),this._doAnimateAction(i,r,u))},_doAnimateAction:function(n,t,i){n.removeClass("e-process");this._triggerEvent(t,i)},_isChecked:function(n){return n.find("> div > .e-chkbox-wrap:first").attr("aria-checked")==="true"?!0:!1},_doRecursiveCheck:function(t,i){var o,r,f,t,u,s,e;u=this._getChildUl(t);o=u?u.querySelectorAll('.e-chkbox-wrap[aria-checked="true"]').length:0;s=u?u.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[];r=t.firstChild.querySelector(".nodecheckbox");r&&r.nodeName.toUpperCase()=="INPUT"&&(e=n(r).data("ejCheckBox"),o==s.length||this.model.autoCheckParentNode?(e.setModel({enableTriState:!1,checked:!0}),r.className+=" checked",f=t.firstChild.getElementsByTagName("a")[0].innerHTML,i.push({id:t.id,text:f}),this._deepWatch&&!this.model.autoCheckParentNode&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(r,f),this._addCheckNodes(this._liList.index(t))):e.setModel({enableTriState:!0,checkState:"indeterminate"}),t=t.parentNode.parentNode,t.nodeName.toUpperCase()=="LI"&&this._doRecursiveCheck(t,i))},_nodeCheck:function(t,i){var s,r,u,h,e,o,c,f,l;if(n(t)[0]!=null){if(this._CurrenctSelectedNodes=[],this._checkedArray=[],t.className+=" checked",s=n(t).data("ejCheckBox"),s){if(s.setModel({enableTriState:!1,checked:!0}),r=t.parentNode.parentNode.parentNode,u=r.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._checkedArray.push({id:r.id,text:u}),this._deepWatch&&this._updateField(this._newDataSource,r.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(t,u),this._addCheckNodes(this._liList.index(r)),this.model.autoCheck){for(c=this._getChildUl(r),e=c?c.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],f=0,l=e.length;f<l;f++)n(e[f]).ejCheckBox({checked:!0,enableTriState:!1})[0].className+=" checked",o=e[f].parentNode.parentNode.parentNode,u=o.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._checkedArray.push({id:o.id,text:u}),this._deepWatch&&this._updateField(this._newDataSource,o.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(e[f],u),this._addCheckNodes(this._liList.index(o));h=r.parentNode.parentNode;h.nodeName.toUpperCase()=="LI"&&this._doRecursiveCheck(h,this._checkedArray)}i&&(i.checknode=this._checkedArray);this._onChecked(n(t),i)}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._persistValues(this.model.checkedNodes,"checkedNodes")}},_addHiddenInputElement:function(n,t){if(n.firstChild==null){var i=document.createElement("input");i.setAttribute("type","hidden");i.setAttribute("name",this._id+"_Checkbox_"+n.value+".Text");i.setAttribute("value",t);try{n.appendChild(i)}catch(r){}}},_doRecursiveUncheck:function(t,i){var e,r,o,t,u,s,f;u=this._getChildUl(t);e=u?u.querySelectorAll('.e-chkbox-wrap[aria-checked="true"]').length:0;s=u?u.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[];r=t.firstChild.querySelector(".nodecheckbox");r&&r.nodeName.toUpperCase()=="INPUT"&&(f=n(r).data("ejCheckBox"),e<=0&&(f.setModel({enableTriState:!1,checked:!1}),n(r).removeClass("checked").removeClass("checked").children().remove(),o=t.firstChild.getElementsByTagName("a")[0].innerHTML,this._removeCheckNodes(this._liList.index(t)),i.push({id:t.id,text:o}),this._deepWatch&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)),e>0&&this.model.autoCheckParentNode?(f.setModel({checked:!0}),r.className+=" checked",o=t.firstChild.getElementsByTagName("a")[0].innerHTML,this._addHiddenInputElement(t,o),this._deepWatch&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)):e>0&&!this.model.autoCheckParentNode&&(s.length>1?f.setModel({enableTriState:!0,checkState:"indeterminate"}):f.setModel({checked:!1}),n(r).removeClass("checked").removeClass("checked").children().remove(),this._removeCheckNodes(this._liList.index(t)),this._deepWatch&&this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)),t=t.parentNode.parentNode,t.nodeName.toUpperCase()=="LI"&&this._doRecursiveUncheck(t,i))},_nodeUncheck:function(t,i){var e,u,r,f;if(n(t)[0]!=null){if(e=this,this._uncheckedArray=[],currentLi=t.parentNode.parentNode.parentNode,n(currentLi).find("div > .e-chkbox-wrap > .nodecheckbox").removeClass("checked").children().remove(),chkObj=n(t).data("ejCheckBox"),this._removeCheckNodes(this._liList.index(currentLi)),chkObj){if(chkObj.setModel({enableTriState:!1,checked:!1}),textvalue=currentLi.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._uncheckedArray.push({id:currentLi.id,text:textvalue}),this._deepWatch&&this._updateField(this._newDataSource,currentLi.id,this.model.fields.isChecked,!1),this.model.autoCheck){for(childUl=this._getChildUl(currentLi),u=childUl?childUl.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],r=0,f=u.length;r<f;r++)n(u[r]).ejCheckBox({enableTriState:!1,checked:!1}),liElement=u[r].parentNode.parentNode.parentNode,textvalue=liElement.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._uncheckedArray.push({id:liElement.id,text:textvalue}),this._deepWatch&&this._updateField(this._newDataSource,liElement.id,this.model.fields.isChecked,!1),this._removeCheckNodes(this._liList.index(liElement));parentLi=currentLi.parentNode.parentNode;parentLi.nodeName.toUpperCase()=="LI"&&this._doRecursiveUncheck(parentLi,this._uncheckedArray)}i&&(i.unchecknode=this._uncheckedArray);this._onUnChecked(n(t),i)}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._persistValues(this.model.checkedNodes,"checkedNodes")}},_executeDataQuery:function(i,r,u){var f,o,e;if(f=t.Query(),f=this._columnToSelect(i),!t.isNullOrUndefined(r)&&r!=""){for(o=n.extend(!0,[],f._params),f._params=[],f.addParams(r,u),e=0;e<o.length;e++)o[e].key!=r&&f.addParams(o[e].key,o[e].value);f.where(r,t.FilterOperators.equal,u)}return i.dataSource.executeQuery(f)},_createChildNodesWhenExpand:function(i,r,u,f,e,o){var a,v,h,y,p,s,c,w,l;if(i.length>0&&i.find("ul .e-item").length==0){if(a=i.attr("id"),v=i.children("div").find(".e-text:first").text(),y=i.children("div").find("div.e-plus:first"),h={currentElement:i,targetElement:y[0],id:a,value:v,isChildLoaded:!1,hasParent:!0,async:!1},c=this,this._isEventTriggered=!0,this._triggerEvent("beforeExpand",h))return!1;if(this.dataSource()instanceof t.DataManager){if(p=h.currentElement.parents("ul").length,s=this._getChildTables(this.model.fields,p,1),t.isNullOrUndefined(s)&&t.isNullOrUndefined(this.model.fields.child)&&(s=this.model.fields),!s){n(h.targetElement).hasClass("e-load")&&n(h.targetElement).removeClass(n(h.targetElement).hasClass("e-plus")||n(h.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load");return}s.query&&s.query.queries.length>0&&(s.query.queries=[]);this._treeList.push("false");w=this._executeDataQuery(s,s.parentId,this._typeOfFieldId=="number"?parseInt(h.currentElement[0].id):h.currentElement[0].id);w.done(function(n){c._treeList.pop();l=n.xhr&&n.xhr.responseJSON&&n.xhr.responseJSON.d?n.xhr.responseJSON.d:n.result?n.result:[];l=c._getSortAndFilterList(s,l);c._appendChild(l,i,s,r,u,f);u&&c._expandByLevel(i.find("> ul"),u-1,f);c._treeList.length==0&&(e&&c._doAfterExpand(i,e,o),c._completeRendering())})}else l=this._getChildNodes(this._dataSource,{id:i[0].id}),this._appendChild(l,i,this.model.fields,r,u,f)}else this._expandNode(i)},_appendChild:function(i,r,u,f,e,o){var h,s,c;if(!t.isNullOrUndefined(i)&&i.length>0){if(this._checkboxChecked=r.find("> div > .e-chkbox-wrap > .nodecheckbox").hasClass("checked"),this._loadOnDemandNodes=!0,r.find("ul .e-item").length==0&&(this._templateNodeCreation(i,u),r.append(this._fragment)),this._finalizeLoadOnDemand(r),this._expandNode(r),f&&!e&&!o)for(h=r.find(".e-item > div > .e-plus").closest(".e-item"),s=0,c=h.length;s<c;s++)this._createChildNodesWhenExpand(n(h[s]),!0,null,o)}else f&&r.find("> div > .e-plus").removeClass("e-plus e-icon")},_getSortAndFilterList:function(n,i){var r,u;return!i||!i.length||i.length<1?r=[]:(u=t.Query(),this._addSortingQuery(u,n),r=t.DataManager(i).executeLocal(u)),r},_addSortingQuery:function(n,i){if(this.model.sortSettings.allowSorting){var r=i&&i.text?i.text:"text",u=this.model.sortSettings.sortOrder==t.sortOrder.Descending?!0:!1;n.sortBy(r,u)}},_expandNode:function(n){var t,i;return n[0]!=null&&n.length>0&&(t=n.find("> div > div:first"),this.model.loadOnDemand&&!this.model.enablePersistence?n.find("> ul > .e-item").length>0&&t.hasClass("e-plus")?(this.model.enableMultipleExpand||this._denyMultipleExpand(n),this._expandCollapseAction(n.find("> div > div.e-plus:first"))):t.hasClass("e-icon")&&!t.hasClass("e-minus")&&this._allowOnDemand&&this._createChildNodesWhenExpand(n):t.hasClass("e-plus")&&(i=n.find("> ul > .e-item").length>0?!0:!1,i&&(this.model.enableMultipleExpand||this._denyMultipleExpand(n),this._expandCollapseAction(t)))),!0},_collpaseNode:function(n){if(n[0]!=null&&n.length>0&&n.find("> ul > .e-item").length>0){var t=n.find("> div > div:first");t.hasClass("e-minus")&&this._expandCollapseAction(t)}},_getElement:function(){return this.element.is("UL")?this.element:this.element.find("> ul")},_getImmediateChild:function(n,t){return t?n.find("> .e-item:not(:hidden)"):n.find("> .e-item")},_expandByLevel:function(n,t,i){t>0&&this._expandByNode(this._getImmediateChild(n,i),t,i)},_expandByNode:function(t,i,r){for(var u=0,f=t.length;u<f;u++)n(t[u]).find("> div > div").hasClass("e-plus")&&(this.model.loadOnDemand?this._createChildNodesWhenExpand(n(t[u]),!0,i,r):this._expandNode(n(t[u]))),this._expandByLevel(n(t[u]).find("> ul"),i-1,r)},_expandAll:function(t){var u=this.element,i,r;if(r=u.find(t?".e-item > div > .e-plus:not(:hidden)":".e-item > div > .e-plus").closest(".e-item"),this.model.loadOnDemand)for(i=0,len=r.length;i<len;i++)this._createChildNodesWhenExpand(n(r[i]),!0,null,t);else for(i=0,len=r.length;i<len;i++)this._expandNode(n(r[i]))},_collapseByLevel:function(n,t,i){t>0&&this._collapseByNode(this._getImmediateChild(n,i),t,i)},_collapseByNode:function(t,i,r){for(var u=0,f=t.length;u<f;u++)n(t[u]).find("> div > div").hasClass("e-minus")&&this._collpaseNode(n(t[u])),this._collapseByLevel(n(t[u]).find("> ul"),i-1,r)},_collapseAll:function(t){var u=this.element,i,r;if(r=u.find(t?".e-item > div > .e-minus:not(:hidden)":".e-item > div > .e-minus").closest(".e-item"),r.length>0)for(i=0,len=r.length;i<len;i++)this._collpaseNode(n(r[i]))},_checkAll:function(){this._CurrenctSelectedNodes=[];var r=this.element,t;for(t=r.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox"),t.addClass("checked"),i=0,len=t.length;i<len;i++)n(t[i]).ejCheckBox("setModel",{checked:!0}),this._addHiddenInputElement(t[i],n(t[i]).parent().siblings(".e-text")[0].lastChild.nodeValue);this.model.checkedNodes=this.getCheckedNodesIndex()},_uncheckAll:function(){var r=this.element,t;for(t=r.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox"),t.removeClass("checked").children().remove(),i=0,len=t.length;i<len;i++)n(t[i]).ejCheckBox("setModel",{checked:!1});this.model.checkedNodes=[];this.model.checkedNodes.push(-1)},_selectAll:function(){var r,t,u,i;for(this._isRender=!1,r={ctrlKey:!0},t=0,u=this._liList.length;t<u;t++)if(i=n(this._liList[t]),i[0]!=null&&this._nodeSelectionAction(i,r),!this.model.allowMultiSelection)break;this._isRender=!0},_unselectAll:function(){this.element.find("a.e-text.e-active").removeClass("e-node-focus e-active");this.element.find("[aria-selected=true]").attr("aria-selected",!1);this.element.find(".e-li-active").removeClass("e-li-active");this.element.find(".e-li-focus").removeClass("e-li-focus");this.element.find(".e-node-focus").removeClass("e-node-focus");this.model.selectedNodes=[];this.model.enablePersistence&&this._persistValues(this.model.selectedNodes,"selectedNodes")},_isNodeExpanded:function(n){if(n[0]!=null)return n.children("ul:first").length>0&&n.find("> div > div.e-minus").length>0},_showCheckBox:function(){for(var t=this.element,i=t.find("li"),n=0;n<i.length;n++)this._checkboxOnTemplate(i[n].children[0]);t.find(".e-item > div > .nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange});t.find(".e-item.e-node-disable > div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("disable")},_drag:function(){var i,u=!1,o=t.browserInfo(),r=null,s=null,f=null,e;e=o.name=="msie"&&o.version=="8.0"?!0:!1;this.element.is("ul")?(this._treeView=this.element.parent(),this.model.allowDragAndDropAcrossControl||(f=this.element.parent())):(this._treeView=this.element,this.model.allowDragAndDropAcrossControl||(f=this.element));n(this._treeView).find("ul li div a").not(".e-js").ejDraggable({dragArea:f,clone:!0,dragStart:function(u){if(!i||t.isNullOrUndefined(u.target)||n(u.target).hasClass("e-node-disable")||i.element.find(".e-item > div > .e-text.e-editable").length!=0||(u.element.attr("aria-grabbed",!0),i.element.closest(".e-treeview-wrap").addClass("e-dragging"),n(u.target).is("A")&&!n(u.target).hasClass("e-draggable")))return!1;e&&(document.ondragstart=function(){return!1});var f={target:n(u.target).closest(".e-item"),targetElementData:i._getNodeDetails(n(u.target).closest(".e-item")),dragTarget:u.target,parentElement:n(u.target).closest("ul").closest(".e-item"),parentElementData:i._getNodeDetails(n(u.target).closest("ul").closest(".e-item")),event:u.event};if(i._triggerEvent("nodeDragStart",f))return u.cancel=!0,r&&r.remove(),!1},drag:function(f){var e,o,h,s,c;return u=!1,n(".e-sibling").remove(),e=f.target,o=i._findTarget(n(e)),n(e).closest(".e-treeview-wrap").addClass("e-dragging"),n(r).css({"margin-left":"20px","margin-top":f.event.clientY-20<0?"0px":"10px",display:"table"}),n(r).find("> a.e-text").css({display:"table-cell","white-space":"nowrap",margin:"0 0 1px"}),n(r).find(">.e-dropedStatus").css({display:"table-cell"}),h={draggedElement:n(f.element).closest(".e-item"),draggedElementData:i._getNodeDetails(n(f.element).closest(".e-item")),dragTarget:e,target:o,targetElementData:i._getNodeDetails(o),event:f.event},(n(f.element).parent().parent().has(n(e)).length==0||i.model.allowMultiSelection&&i.model.selectedNodes.length>1)&&(n(e).hasClass("e-droppable")||n(e).parent().hasClass("e-droppable"))&&n(e).hasClass("e-dropchild")&&!n(e).hasClass("e-node-disable")&&(i.model.allowDragAndDropAcrossControl||!i.model.allowDragAndDropAcrossControl&&n(e).parents(".e-treeview").is(i.element))?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"),n(e).addClass("allowDrop")):n(e).hasClass("e-droppable")&&!n(e).hasClass("e-item")&&!n(e).hasClass("e-text")||n(e).is("UL")&&n(e).hasClass("e-ul")&&n(e).find(".e-item").length==0&&n(e).parent(".e-treeview-wrap").length>0?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus")):(n(e).hasClass("e-sibling")||n(e).find("a").hasClass("e-text"))&&(n(e).hasClass("e-sibling")||n(e).parent().parent().hasClass("e-item")||n(e).parent().hasClass("e-item")||n(e).hasClass("e-item")||n(e).hasClass("e-text"))&&(e.nodeName.toUpperCase()!="LI"&&(e.parentElement===null||e.parentElement.nodeName.toUpperCase()!="LI")||this.model.allowDropSibling)&&(i.model.allowDragAndDropAcrossControl||n(e).parents(".e-treeview").is(i.element))||(document.body.style.cursor="not-allowed",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-minus"),n(e).removeClass("showline-hover"),n(e).removeClass("noline-hover")),e.nodeName!="A"&&(n(f.element).parent().parent().has(n(e)).length==0||i.model.allowMultiSelection&&i.model.selectedNodes.length>1)&&n(f.element).parent().parent()[0]!=n(e)[0]?(e.nodeName=="UL"&&n(e).children()[0]!=null&&(e=n(e).children()[0],u=!0),e.nodeName!="LI"&&(e=n(e).closest(".e-droppable")[0]||n(e).parent()),e.nodeName=="LI"&&n(e).hasClass("e-droppable")&&n(e).hasClass("e-dropsibling")&&(i.model.allowDragAndDropAcrossControl||!i.model.allowDragAndDropAcrossControl&&n(e).parents(".e-treeview").is(i.element))?(s=t.buildTag("div.e-sibling"),c=n(e).offset().top+n(e).find("a").height()||-1,u=f.event.pageY>c?!1:!0,u?s.insertBefore(n(e).find("> div > a").parent()):s.insertAfter(n(e).find("> div > a").parent()),n(e).parents().hasClass("e-rtl")?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-insertInbetween-rtl")):(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-insertInbetween"))):e.nodeName=="A"&&n(e)&&n(e).hasClass("e-droppable")&&n(e).hasClass("e-dropchild")?(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"),n(e).addClass("allowDrop")):!n(e).hasClass("e-droppable")||n(e).hasClass("e-item")||n(e).hasClass("e-text")||(document.body.style.cursor="",n(r).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"))):n(".e-sibling").remove(),i._triggerEvent("nodeDrag",h)?!1:void 0},dragStop:function(t){var f,o,s,c,h,l;if((e&&(document.ondragstart=function(){return!0}),t.element.dropped||(r&&r.remove(),document.body.style.cursor=""),f=t.target,n(f).closest(".e-treeview-wrap").removeClass("e-dragging"),i.element.closest(".e-treeview-wrap").removeClass("e-dragging"),f.className=="e-sibling"&&(f=n(f).closest(".e-item")[0]),n(".e-sibling").remove(),n(f).hasClass("e-node-disable"))||(o=u?"Before":"After",trgtEle=i._findTarget(n(f)),o=f.nodeName=="A"?"Over":o,s={draggedElementData:i._getNodeDetails(n(t.element).closest(".e-item")),draggedElement:n(t.element).closest(".e-item"),dropTarget:n(f),target:trgtEle,targetElementData:i._getNodeDetails(trgtEle),position:o,event:t.event},i._triggerEvent("nodeDragStop",s)))return!1;if(i.model.allowMultiSelection&&n(t.element).hasClass("e-active"))for(c=i.element.find(".e-item > div > .e-active"),h=0,l=c.length;h<l;h++)t.element=c[h],o=i._dropNode(f,t,o,u);else o=i._dropNode(f,t,o,u);if(n(".allowDrop").removeClass("allowDrop"),n(t.element).attr("aria-grabbed",!1),n(f).hasClass("e-dropchild")||r&&r.remove(),trgtEle=i._findTarget(n(f)),s={droppedElementData:i._getNodeDetails(n(t.element).closest(".e-item")),droppedElement:n(t.element).closest(".e-item"),dropTarget:n(f),target:trgtEle,targetElementData:i._getNodeDetails(trgtEle),position:o,event:t.event},i._triggerEvent("nodeDropped",s))return!1;document.body.style.cursor=""},helper:function(u){var e,o,f,h;if(!t.isNullOrUndefined(u.element)&&!n(u.element).hasClass("e-node-disable")&&n(u.element).hasClass("e-draggable")&&(i=n(u.element).closest(".e-treeview.e-js").data("ejTreeView"),i))return r=t.buildTag("div.e-dragedNode e-widget"),e=t.util.getZindexPartial(i.element),r.css({"z-index":e}),r.addClass(i.model.cssClass+(i.model.enableRTL?" e-rtl":"")),o=i.element.find(".e-item > div > .e-active"),f=o.length,s=n(u.element).clone().addClass("dragClone"),this.spanEle=t.buildTag("span.e-icon e-plus e-dropedStatus"),r.append(this.spanEle),r.append(s),h=t.buildTag("span.e-drop-count",f),f>1&&i.model.allowMultiSelection&&n(u.element).hasClass("e-active")&&r.append(h),r.appendTo(n("body"))}})},_dropNode:function(t,i,r,u){return t.nodeName=="A"&&n(t).hasClass("e-dropchild")&&n(t).hasClass("e-droppable")||t.nodeName=="UL"&&n(t).children().length==0?(r="Over",n(t).is("UL")&&n(t).hasClass("e-ul")&&n(t).find(".e-item").length==0&&n(t).parent(".e-treeview-wrap").length>0?this._dropAsChildNode(n(t),n(i.element),i.event):n(i.element).parent().parent().has(n(t)).length==0&&(n(t).parent().parent().has(n(i.element)).length==0||this._isDescendant(n(t).parents("li:last").find(">ul>li"),n(i.element).parents("li:first")[0]))&&(this.model.allowDragAndDropAcrossControl||!this.model.allowDragAndDropAcrossControl&&n(t).parents(".e-treeview").is(this.element))&&this._dropAsChildNode(n(t).closest(".e-item"),n(i.element),i.event)):(t.nodeName=="UL"&&(t=n(t).children()[0]),t.nodeName!="LI"&&(t=n(t).closest(".e-droppable")[0]||n(t).parent()),t.nodeName=="LI"&&n(t).hasClass("e-dropsibling")&&n(t).hasClass("e-droppable")?n(i.element).parent().parent().has(n(t)).length<1&&n(i.element).parent().parent()[0]!=n(t)[0]&&(this.model.allowDragAndDropAcrossControl||!this.model.allowDragAndDropAcrossControl&&n(t).parents(".e-treeview").is(this.element))&&this._dropAsSiblingNode(n(t),n(i.element),u,i.event):t.nodeName=="A"&&n(t).hasClass("e-dropchild")&&n(t).hasClass("e-droppable")&&(r="Over",n(i.element).parent().parent().has(n(t)).length==0&&(n(t).parent().parent().has(n(i.element)).length==0||this._isDescendant(n(t).parents("li:last").find(">ul>li"),n(i.element).parents("li:first")[0]))&&this._dropAsChildNode(n(t).closest(".e-item"),n(i.element),i.event))),r},_findTarget:function(n){return n.hasClass("e-text")?n.closest(".e-item"):n.closest("ul").closest(".e-item").length>0?n.closest("ul").closest(".e-item"):this.element.find(n).length>0&&!this.model.template?n.parents("ul").first():this.element.find(n).length>0&&this.model.template?n.closest(".e-item"):n},_isDescendant:function(t,i){var r=!0;return n(t).each(function(n,t){if(t==i)return r=!1,!1;r=!0}),r},_childDrop:function(){n(this._treeView).find("ul .e-item div .e-text").ejDroppable({accept:n(this._treeView).find("ul .e-item div .e-text").addClass("e-dropchild"),drop:function(t,i){n(i.helper).hide()}})},_siblingDrop:function(){n(this._treeView).find("ul .e-item").addClass("e-dropsibling").ejDroppable({drop:function(t,i){n(i.helper).hide()}})},_dropAsSiblingNode:function(i,r,u){var f=r.parent().parent(),f=n(f),e;e=n(r.parents(".e-item")[1]);t.isNullOrUndefined(this.model.fields)||this.dataSource()==null||this.dataSource()instanceof t.DataManager||this._updateDataSource(r.parents(".e-item:first"),n(i),u,this);u?f.insertBefore(i):f.insertAfter(i);this.model.template||this._autoGenerateNodes(r.parents(".e-item:first"));this._modifyCss(e);this._isRender=!1;this._updateCheckState(f);this._updateCheckState(e);this._isRender=!0;f.find("> div > .e-minus").length>0&&!this.model.enableMultipleExpand&&this._denyMultipleExpand(f);this._updateChanges(n(i))},_dropAsChildNode:function(i,r){var u=r.parent().parent(),u=n(u),f;f=n(r.parents(".e-item")[1]);n(i).is("UL")?n(i).append(u):this._appendNode(i,u);t.isNullOrUndefined(this.model.fields)||this.dataSource()==null||this.dataSource()instanceof t.DataManager||this._updateDataSource(r.parents(".e-item:first"),n(i).find("> div > .e-text").first(),"",this);this.model.template||this._autoGenerateNodes(r.parents(".e-item:first"));this._modifyCss(f);this._isRender=!1;this._updateCheckState(u);this._updateCheckState(f);this._isRender=!0;i.find("> div > .e-icon.e-plus:first").length>0&&this._expandNode(i);this._updateChanges(n(i))},_updateChanges:function(t){if(n(t)[0]!=null){var i=this,r=0;do i._updateNodes(),r++,i=t.closest(".e-treeview.e-js").data("ejTreeView");while(i&&this._id!=i._id&&r==1)}},_updatePersistProb:function(){var r,t,f,u,i,e;for(this._removeField(this._newDataSource,this.model.fields.selected),this._removeField(this._newDataSource,this.model.fields.expanded),r=this.getSelectedNodes(),t=0,f=r.length;t<f;t++)this._updateField(this._newDataSource,n(r[t]).attr("id"),this.model.fields.selected,!0);for(u=this.getExpandedNodes(),i=0,e=u.length;i<e;i++)this._updateField(this._newDataSource,n(u[i]).attr("id"),this.model.fields.expanded,!0)},_orderDataSource:function(){var f,r,u,e,i,o;for(this._beforeBaseClass(),f=[],r=this._newDataSource,this._updatePersistProb(),u=0,e=this._liList.length;u<e;u++)for(i=0,o=r.length;i<o;i++)if(!t.isNullOrUndefined(r[i])&&!t.isNullOrUndefined(r[i][this.model.fields.id])&&r[i][this.model.fields.id].toString()==n(this._liList[u]).attr("id")){n(this._liList[u]).find("> ul .e-item").length==0?delete r[i][this.model.fields.hasChild]:this._templateType==1&&(r[i][this.model.fields.hasChild]=!0);f.push(r[i]);break}return f},_updateDataSource:function(i,r,u,f){var o,e,c,s,l,h,a;n(i)[0]!=null&&n(r)[0]!=null&&(o=f,e=r.closest(".e-treeview.e-js").data("ejTreeView"),!o||!e||t.isNullOrUndefined(e.model.fields)||e.dataSource()==null||e.dataSource()instanceof t.DataManager||(r.is("A")?(c=r.closest(".e-item").attr("id"),l=r.closest(".e-item").find("> ul > .e-item"),s=l.length>0?l.length:r.closest(".e-item").index()):(c=r.parents(".e-item:first").attr("id"),h=r.next(".e-item"),a=r.prev(".e-item"),s=h.length>0?s=a.length>0?h.index()-1:u?r.index():h.index():u?r.index():r.index()+1),e&&o._findAndUpdate(i.attr("id"),c,o._newDataSource,s,e,r,u)))},_removeObject:function(n,i,r){for(var u=0,f=n.length;u<f;u++)if(!t.isNullOrUndefined(n[u])&&!t.isNullOrUndefined(n[u][r])&&n[u][r].toString()==i){n.splice(u,1);break}},_getObjectPosition:function(n,i,r){for(var f,u=0,e=n.length;u<e;u++){if(!t.isNullOrUndefined(n[u])&&!t.isNullOrUndefined(n[u][r])&&n[u][r].toString()==i)return u;if(n[u].hasOwnProperty("child")&&(f=this._getObjectPosition(n[u].child,i,r),f>=0))return f}return-1},_convertDataSourceTypes:function(n,t){for(var i=0;i<n.child.length;i++)n.child[i][this.model.fields.parentId]=n[this.model.fields.id],t.push(n.child[i]),n.child[i].hasOwnProperty("child")&&n.child[i].child.length>0&&this._convertDataSourceTypes(n.child[i],t);return n.child&&(delete n.child,n[this.model.fields.hasChild]=!0),t},_childObjectCollection:function(n,t,i,r){for(var f,u=0,e=n.length;u<e;u++)f=this._getChildNodes(t,{id:n[u][this.model.fields.id]}),f&&(r==2?(i[u].hasOwnProperty("child")||(i[u].child=[]),i[u].child=this._childObjectCollection(f,t,f,r)):(i=i.concat(f),i=this._childObjectCollection(f,t,i,r)));return i},_updateCopyData:function(t,i,u){var f=i.model.fields,e;return temp=u,arr=JSON.parse(JSON.stringify(u[t])),proxy=this,n.each(this.model.fields,function(n){(n!=="dataSource"||n!=="query")&&temp[t][proxy.model.fields[n]]!==r&&(delete arr[proxy.model.fields[n]],arr[f[n]]=temp[t][proxy.model.fields[n]])}),n.extend(e,arr,!1)},_updateDataFields:function(n,t,i,r,u){for(var e=[],f=0,o=t.length;f<o;f++)u==1&&(this._removeObject(n,i,this.model.fields.parentId),delete t[f][this.model.fields.parentId],delete t[f][this.model.fields.hasChild]),t[f].hasOwnProperty("child")&&(t[f].child=this._updateDataFields(n,t[f].child,t[f][this.model.fields.id],r,u)),e.push(this._updateCopyData(f,r,t));return e},_findAndUpdate:function(n,i,r,u,f,e,o){var a,w,k,b,tt,y,g,c,p,s,v,h;if(!t.isNullOrUndefined(r))if(this._templateType==1){for(c=0,p=r.length;c<p;c++)if(!t.isNullOrUndefined(r[c])&&!t.isNullOrUndefined(r[c][this.model.fields.id])&&r[c][this.model.fields.id].toString()==n){if(this._id==f._id)t.isNullOrUndefined(i)?delete r[c][this.model.fields.parentId]:r[c][this.model.fields.parentId]=i,a=this.dataSource(),w=this,this._deepWatch&&(k=r.splice(c,1),h=this._getObjectPosition(a,e.attr("id"),this.model.fields.id),h>=0&&!e.is("A")?r.splice(o?h:h+1,0,k[0]):r.push(k[0]),this._oldDataSource=JSON.parse(JSON.stringify(r)),this.dataSource(r)),this._templateType=this._getTemplateType(a,this.model.fields),this._dataSource=this._templateType==1?this._groupingObjects(a,function(n){return[!t.isNullOrUndefined(n)&&[n[w.model.fields.parentId]].toString()]}):a;else{var s=[],l,w=this,d,v=[],nt=[];if(d=this._groupingObjects(r,function(n){return[!t.isNullOrUndefined(n)&&[n[w.model.fields.parentId]].toString()]}),nt=r.splice(c,1),s.push(this._updateCopyData(0,f,nt)),l=this._getChildNodes(d,{id:n}),l&&l.length>0&&(l=this._childObjectCollection(l,d,l,f._templateType)),f._templateType==2)l&&l.length>0&&(y=this._updateDataFields(r,l,n,f,this._templateType),s[0].hasOwnProperty("child")||(s[0].child=[]),s[0].child=y),delete s[0][f.model.fields.parentId],delete s[0][f.model.fields.hasChild],f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h=h>=0&&!e.is("A")?o?h:h+1:u,i?f._changeObjectPos(i,s,f._newDataSource,h):f._newDataSource.splice(h,0,s[0])):i?f._changeObjectPos(i,s,f._newDataSource,u):f._newDataSource.splice(u,0,s[0]);else{if(l&&l.length>0){for(b=0,tt=l.length;b<tt;b++)this._removeObject(r,l[b][this.model.fields.id],this.model.fields.id);this._dataSource=this._templateType==1?this._groupingObjects(r,function(n){return[!t.isNullOrUndefined(n)&&[n[w.model.fields.parentId]].toString()]}):r}if(i?s[0][f.model.fields.parentId]=i:delete s[0][f.model.fields.parentId],f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h>=0&&!e.is("A")?f._newDataSource.splice(o?h:h+1,0,s[0]):f._newDataSource.push(s[0])):f._newDataSource.push(s[0]),y=[],l&&l.length>0){if(!(this.dataSource()instanceof t.DataManager)){for(c=0;c<l.length;c++)y.push(this._updateCopyData(c,f,l));l=y}g=f._newDataSource=f._newDataSource.concat(l);f._dataSource=f._templateType==1?f._groupingObjects(g,function(n){return[!t.isNullOrUndefined(n)&&[n[f.model.fields.parentId]].toString()]}):g}}f._deepWatch&&(f.dataSource(f._newDataSource),f._oldDataSource=JSON.parse(JSON.stringify(f._newDataSource)));this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))}break}}else for(c=0,p=r.length;c<p;c++){if(r[c][this.model.fields.id].toString()==n)return s=r.splice(c,1),this._id==f._id?this._deepWatch?(h=this._getObjectPosition(this._newDataSource,e.attr("id"),this.model.fields.id),h=h>=0&&!e.is("A")?o?h:h+1:u,i?this._changeObjectPos(i,s,this._newDataSource,h):this._newDataSource.splice(h,0,s[0]),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource)):i?this._changeObjectPos(i,s,this._newDataSource,u):this._newDataSource.splice(u,0,s[0]):(s=this._updateDataFields(r,s,n,f,this._templateType),f._templateType==1?(v=[],s[0].hasOwnProperty("child")?(v=f._convertDataSourceTypes(s[0],v),s[0]=s.concat(v)):s[0]=s.concat(),i?s[0][0][f.model.fields.parentId]=i:delete s[0][0][f.model.fields.parentId],f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h>=0&&!e.is("A")?f._newDataSource.splice(o?h:h+1,0,s[0][0]):f._newDataSource.push(s[0][0]),f._newDataSource=f._newDataSource.concat(v)):f._newDataSource=f._newDataSource.concat(s[0])):f._deepWatch?(h=this._getObjectPosition(f._newDataSource,e.attr("id"),f.model.fields.id),h=h>=0&&!e.is("A")?o?h:h+1:u,i?f._changeObjectPos(i,s,f._newDataSource,h):f._newDataSource.splice(h,0,s[0])):i?f._changeObjectPos(i,s,f._newDataSource,u):f._newDataSource.splice(u,0,s[0]),f._deepWatch&&(f.dataSource(f._newDataSource),f._oldDataSource=JSON.parse(JSON.stringify(f._newDataSource))),this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))),!0;if(r[c].hasOwnProperty("child")&&this._findAndUpdate(n,i,r[c].child,u,f,e,o))break}},_changeObjectPos:function(n,t,i,r){for(var u=0,f=i.length;u<f;u++){if(i[u][this.model.fields.id].toString()==n)return i[u].hasOwnProperty("child")?i[u].child.splice(r,0,t[0]):(i[u].child=[],i[u].child.push(t[0])),!0;if(i[u].hasOwnProperty("child")&&this._changeObjectPos(n,t,i[u].child,r))break}},_finalizeEditing:function(t){if(n(t)[0]!=null){var i=t.closest(".e-treeview.e-js").data("ejTreeView");i&&(i._preventEditable(),i.model.allowEditing&&i._allowEditable())}},_updateCheckState:function(n){var t,i,r;this._isTreeElement(n)&&(t=n.closest(".e-treeview.e-js").data("ejTreeView"),t&&t.model.showCheckbox&&(i=n.children("ul").find(".e-item > div > .e-chkbox-wrap > .checked").closest(".e-item").addClass("checked"),i.length>0?t._isCheckedAction():(r=t.isNodeChecked(n)?"_nodeCheck":"_nodeUncheck",t[r](n.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]))))},_autoGenerateNodes:function(t){var i,u,r,f;if(n(t)[0]!=null)if(i=t.closest(".e-treeview.e-js").data("ejTreeView"),i&&i.model.showCheckbox){if(t.find(".e-chkbox-wrap").length==0){for(this._checkboxOnTemplate(t[0].children[0]),u=t.find(".e-item"),r=0,f=u.length;r<f;r++)this._checkboxOnTemplate(u[r].children[0]);t.find(".nodecheckbox").ejCheckBox({cssClass:i.model.cssClass,change:i._checkedChange})}}else t.find(".e-chkbox-wrap").remove()},_appendNode:function(i,r){var u,o,f,s,e;for(this._isTreeElement(i)?(i.find("ul")[0]==null?(u=i.closest(".e-treeview.e-js").data("ejTreeView"),u&&(s=this._isNodeExpanded(i),!s&&u.model.loadOnDemand&&i.find("> div > div").first().hasClass("e-plus")&&u._createChildNodesWhenExpand(i,null,null,null,r,u)),this.dataSource()instanceof t.DataManager&&u.model.loadOnDemand&&i.find("> div > div").first().hasClass("e-plus")||this._doAfterExpand(i,r,u),this._deepWatch&&this._templateType==1&&(this._updateField(this._newDataSource,i.attr("id"),this.model.fields.hasChild,!0),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource))):n(i.find("ul")[0]).append(r),this.isDisabled(i)||this._expandNode(i)):this.element.is("UL")?this.element.append(r):this.element.children("ul:first").length>0?this.element.children("ul:first").append(r):(o=t.buildTag("ul.e-treeview-ul","",{},{role:"group"}),o.append(r),this.element.append(o)),f=this.element.find(".e-item.expanded"),e=0;e<f.length;e++)this.model.loadOnDemand&&!(this.dataSource()instanceof t.DataManager)?this._createChildNodesWhenExpand(n(f[e])):this._expandNode(n(f[e]));f.removeClass("expanded");this.model.showCheckbox&&this._isCheckedAction()},_doAfterExpand:function(i,r,u){var e=t.buildTag("ul.e-treeview-ul","",{},{role:"group",style:"display:none"}),f;n(e).append(n(r));n(i.find("div")[1]).length==0?(f=document.createElement("div"),f.setAttribute("role","presentation"),f.className="e-icon e-minus",n(i.find("div")).append(n(f))):n(i.find("div")[1]).hasClass("e-minus")||n(i.find("div")[1]).addClass("e-icon e-plus");u&&u.model.loadOnDemand&&i.find("ul").length>0?i.children("ul").append(n(r)):i.append(n(e))},_modifyCss:function(t){t=n(t);t[0]!=null&&t.find(".e-item").length==0&&(t.removeClass("e-collapse").attr("aria-expanded",!1).find("> div > .e-icon").removeClass("e-icon e-minus").closest(".e-item").find("ul").remove(),this._deepWatch&&(this._updateField(this._newDataSource,t.attr("id"),this.model.fields.expanded,!1),this._templateType==1&&this._updateField(this._newDataSource,t.attr("id"),this.model.fields.hasChild,!1),this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource)))},_applyFirstLastChildClass:function(){n(this._liList).removeClass("first last").filter(":first-child:not(:last-child)").addClass("first");n(this._liList).filter(":last-child").addClass("last")},_expandEventHandler:function(t){var i=n(t.target),r,u;i.hasClass("e-icon")||i.closest(".e-item").hasClass("e-node-disable")||t.type==="dblclick"&&this.model.allowEditing||(t.preventDefault(),r=i.is("A")?n(i.siblings("div")):n(i.parent().siblings("div")),this.model.fullRowSelect&&(i.is("div.e-text-wrap")||i.is("div.e-fullrow"))&&(r=i.closest(".e-item").find("> .e-text-wrap > div")),u=i.closest(".e-item"),r.hasClass("e-minus")?this._collpaseNode(u):this.model.loadOnDemand&&r.find(".e-item").length==0?this._ClickEventHandler({target:r[0]}):this._expandNode(u))},_inlineEdit:function(t){t.preventDefault();var i=n(t.target);return i.hasClass("input-text")||i.hasClass("e-node-disable")||(i.is("A")||(i=i.closest(".e-text")),i.is("A")&&!i.hasClass("e-node-disable")&&this._inlineEditAction(i)),!1},_inlineEditAction:function(n){var t=this.element.find(".e-item > div > .e-text > #Edit_Input");t[0]==null&&this._createEditTextBox(n)},_createEditTextBox:function(i){var f={currentElement:i},r,e,u;return this._triggerEvent("beforeEdit",f)?!1:(r=this.element.find(".e-item > div > .e-text > #Edit_Input"),r[0]==null&&(u=t.buildTag("Input.input-text#Edit_Input","","",{type:"text",value:n.trim(i.text()).replace(/\n\s+/g," "),name:"inplace_value"}),u.width(i.outerWidth()+5),u.height(i.outerHeight()),u.addClass("e-tree-input e-textbox"),this._beforeEditText=i.text(),i[0].lastChild.nodeValue="",i.addClass("e-editable").append(u),r=u,e=r.val().length==""?3:i.outerWidth()+20,this._mousePositionAtEnd(r),this._currentEditableNode=i,this._on(r,"keypress",this._editTextBoxKeyPress)._on(r,"keydown",this,this._pressEscKey)._on(r,"mousedown pointerdown MSPointerDown",this,this._preventPropagation)._on(r,this.model.expandOn,this,this._preventPropagation)._on(r,"blur",this._focusout)),r)},_preventPropagation:function(n){n.stopImmediatePropagation();this._isTextbox=!0},_editTextBoxKeyPress:function(n){n.target.size=n.target.value.length+1},_mousePositionAtEnd:function(n){return n.focus&&n.focus(),n.select&&n.select(),!0},_focusElement:function(t){if(!this._isTextbox){if(t&&(t.type=="touchstart"||t.type=="pointerdown"||t.type=="MSPointerDown")){var i=n(t.currentTarget);i.hasClass("e-text")&&this.selectNode(i.closest(".e-item"))}this.element.focus()}},_focusout:function(t){var i=n(t.currentTarget),r;this._isTextbox=!1;r={id:i.closest(".e-item").attr("id"),oldText:this._beforeEditText,newText:i.val()};this._triggerEvent("inlineEditValidation",r)?this._cancelAction(i):this._saveAction(i,t)},_pressEscKey:function(i){var r,u,f;i.cancelBubble=!0;i.returnValue=!1;r=n(i.currentTarget);r[0]!=null&&(i.keyCode==13&&(i.stopPropagation(),this._focusout(i)),i.keyCode==27&&this._cancelAction(r),(i.keyCode==13||i.keyCode==27)&&(u=t.browserInfo(),f=u.name=="msie"&&u.version=="8.0"?!0:!1,f&&this.element.focus()))},_onFocusHandler:function(n){n.preventDefault()},_onKeyDown:function(n,t){n.find("> div > .e-text:first").removeClass("e-node-focus");t.find("> div > .e-text:first").addClass("e-node-focus");this.model.fullRowSelect&&(n.removeClass("e-li-focus"),t.addClass("e-li-focus"))},_KeyPress:function(t){var f,r=this,o,e,i,p,s,h,w,l,a,v,k,b,y,u,c,d;if(c=this.element.is("ul")?this.element:this.element.find("> ul"),f=t.keyCode?t.keyCode:t.which?t.which:t.charCode,r.model.allowKeyboardNavigation&&r.element.find("#Edit_Input").length<1&&r.element.find(".e-chkbox-wrap.e-focus").length<1)if(this.element.find(".e-animate").removeClass("e-animate"),o=n(c.find(".e-item > div > .e-text.e-active").closest(".e-item")[0]),e=c.find(".e-item:visible"),r._focusedNode?(i=r._focusedNode,r._focusedNode=null):i=c.find(".e-text.e-node-focus").closest(".e-item"),f==113&&(t.preventDefault(),c=i.length>0?i:o,c.length>0&&r.model.allowEditing&&!this.model.template&&(t.target=c.find("> div > .e-text:first"),r._inlineEdit(t))),f!=40||t.altKey)if(f!=38||t.altKey)if((f!=39||this.model.enableRTL||t.altKey)&&(f!=37||!this.model.enableRTL))if((f!=37||this.model.enableRTL||t.altKey)&&(f!=39||!this.model.enableRTL)){if(f!=36||t.altKey){if(f!=35||t.altKey){if(f==13)t.preventDefault(),u=i.length>0?i:o,k=u.find("> div > .e-text"),k.removeClass("e-node-focus"),this.model.fullRowSelect&&u.removeClass("e-li-focus"),k.hasClass("e-active")?r.model.allowMultiSelection&&r._nodeUnSelectionAction(u,event):r._nodeSelectionAction(u,t),r._focusedNode=u;else if(f==32)t.preventDefault(),u=i.length>0?i:o,u.length>0&&this.model.showCheckbox&&(b=u.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0],b.checked?this._nodeUncheck(b):this._nodeCheck(b),r._focusedNode=u);else if(f==46)t.preventDefault(),u=i.length>0?i:this.model.allowMultiSelection?c.find(".e-item > div > .e-text.e-active").closest(".e-item"):o,u.length>0&&this._removeNode(u,t);else if(t&&t.ctrlKey==!0)if(f==88&&this.model.allowDragAndDrop&&this.model.allowDropChild){if(t.preventDefault(),u=i.length>0?i:o,u.length>0){if(y=u.parents(".e-item:first"),this._triggerEvent("beforeCut",{target:u,nodeDetails:this._getNodeDetails(u),keyCode:f,event:t}))return;this._cutNode=n(e[e.index(u)]).detach();n(this._cutNode)[0]!=null&&(this._isRender=!1,this.unselectNode(u),y.find("> ul > .e-item").length==0&&(this.collapseNode(y),this._modifyCss(y)),this._isRender=!0,this._triggerEvent("nodeCut",{parentElement:y,parentDetails:this._getNodeDetails(y),keyCode:f,event:t}))}}else if(f==86&&this._cutNode!=null&&this.model.allowDragAndDrop&&this.model.allowDropChild){if(t.preventDefault(),u=i.length>0?i:o,u=n(e[e.index(u)]),u.length===0&&(u=this.element),c=this._cutNode.find(" > div > .e-text").first(),n(e).length>0){if(this._triggerEvent("beforePaste",{target:u,nodeDetails:this._getNodeDetails(u),keyCode:f,event:t}))return;this._isRender=!1;this._dropAsChildNode(u,c,t);this._isRender=!0;this._cutNode=null;d=c.closest(".e-item");this._triggerEvent("nodePaste",{target:d,nodeDetails:this._getNodeDetails(d),keyCode:f,event:t})}}else r.model.allowMultiSelection&&(r._focusedNode=i)}else if(t.preventDefault(),v=i.length>0?i:o,a=n(e).last(),(a.hasClass("e-node-disable")||a.hasClass("hidden"))&&(a=this._getPrevEle(e,a)),o.length>0&&i.length==0&&o[0]!=a[0]||i.length>0&&i[0]!=a[0]){if(r._KeyPressEventHandler(a,r,f,t))return;r._onKeyDown(v,a)}}else if(t.preventDefault(),v=i.length>0?i:o,l=n(e).first(),(l.hasClass("e-node-disable")||l.hasClass("hidden"))&&(l=this._getNextEle(e,l)),o.length>0&&i.length==0&&o[0]!=l[0]||i.length>0&&i[0]!=l[0]){if(r._KeyPressEventHandler(l,r,f,t))return;r._onKeyDown(v,l)}}else if(t.preventDefault(),w=i.length>0?i.find("> div > div").first():o.find("> div > div").first(),h=w.closest(".e-item"),w.hasClass("e-minus"))this._collpaseNode(n(e[e.index(w.closest(".e-item"))]));else{if(h=n(e[e.index(h)]).closest("ul").closest(".e-item"),r._KeyPressEventHandler(h.length>0?h:"",r,f,t))return;h.length>0&&r._onKeyDown(i,h)}else if(t.preventDefault(),p=i.length>0?i.find("> div > div").first():o.find("> div > div").first(),s=p.closest(".e-item"),p.hasClass("e-plus"))this.model.loadOnDemand&&s.find("> ul .e-item").length==0?this._ClickEventHandler({target:p[0]}):this._expandNode(n(e[e.index(s)]));else{if(s=this._getNextEle(e,s),r._KeyPressEventHandler(s.length>0?s:"",r,f,t))return;(s.length>0&&s[0]==p.closest(".e-item").find("ul > .e-item:first")[0]||s.find("ul > .e-item").first().hasClass("e-node-disable"))&&r._onKeyDown(i,s)}else{if(t.preventDefault(),v=i.length>0?i:o,h=this._getPrevEle(e,v),r._KeyPressEventHandler(h.length>0?h:null,r,f,t))return;h.length>0&&r._onKeyDown(i,h)}else{if(t.preventDefault(),v=i.length>0?i:o,s=this._getNextEle(e,v),r._KeyPressEventHandler(s.length>0?s:null,r,f,t))return;s.length>0&&r._onKeyDown(i,s)}},_getNextEle:function(t,i){var u=t.index(i),r;do u++,r=n(t[u]);while(r.hasClass("e-node-disable")||r.hasClass("hidden"));return r},_getPrevEle:function(t,i){var u=t.index(i),r;do u--,r=n(t[u]);while(r.hasClass("e-node-disable")||r.hasClass("hidden"));return r},_removeChildNodes:function(n,i,r){for(var f,e=0,o,u=0;u<i.length;u++)if(!t.isNullOrUndefined(i[u][0][this.model.fields.parentId])&&i[u][0][this.model.fields.parentId].toString()==r){e=i[u].length;break}for(u=0;u<e;u++)for(f=0;f<n.length;f++)if(!t.isNullOrUndefined(n[f][this.model.fields.parentId])&&n[f][this.model.fields.parentId].toString()==r){t.isNullOrUndefined(n[f])||(o=n[f][this.model.fields.id].toString());n.splice(f,1);this._removeChildNodes(n,i,o);break}},_removeNode:function(i,r){var f,c,l,h,a,o,s,e,u;if(i[0]!=null&&i[0]!=null&&i.length>0){if(e=this,f=n(i[0]).closest("ul").closest(".e-item"),o=n(i[0]),this._triggerEvent("beforeDelete",{target:o,nodeDetails:this._getNodeDetails(o),parentElement:f[0]!=null?f:null,parentDetails:this._getNodeDetails(f),event:r,removedNodes:i}))return;if(this._isRender=!1,!t.isNullOrUndefined(this.dataSource())&&this.dataSource().length>0){for(u=this.dataSource(),h=0,a=i.length;h<a;h++)for(o=n(i[h]),s=0;s<u.length;s++)if(c=o.attr("id"),u[s][this.model.fields.id].toString()==c){l=this._groupingObjects(u,function(n){return[!t.isNullOrUndefined(n)&&[n[e.model.fields.parentId]].toString()]});u.splice(s,1);this._removeChildNodes(u,l,c);break}this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(u)),this.dataSource(u))}if(i.remove(),this._modifyCss(f),this._updateNodes(),this._updateCheckState(f),this._isRender=!0,this._triggerEvent("nodeDelete",{parentElement:f[0]!=null?f:null,parentDetails:this._getNodeDetails(f),event:r,removedNodes:i}))return;e=this;u=this.dataSource();setTimeout(function(){e.dataSource()==null||e.dataSource()instanceof t.DataManager||(e._dataSource=e._groupingObjects(u,function(n){return[!t.isNullOrUndefined(n)&&[n[e.model.fields.parentId]].toString()]}))},300)}},_updateNodes:function(){this._beforeBaseClass();this._applyFirstLastChildClass();this._updateExpandedNodes();this._updateCheckedNodes();this._updateSelectedNode()},_updateField:function(n,i,r,u){var f,e,o;if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)&&!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(r))if(this._templateType==1){for(f=0,e=n.length;f<e;f++)if(!t.isNullOrUndefined(n[f])&&!t.isNullOrUndefined(n[f][this.model.fields.id])&&n[f][this.model.fields.id].toString()==i){n[f][r]=u;u==!1&&delete n[f][r];o=n[f];n.splice(f,1,o);break}}else for(f=0,e=n.length;f<e;f++){if(n[f][this.model.fields.id].toString()==i){n[f][r]=u;u==!1&&delete n[f][r];o=n[f];n.splice(f,1,o);break}n[f].hasOwnProperty("child")&&this._updateField(n[f].child,i,r,u)}},_removeField:function(n,i){if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)&&!t.isNullOrUndefined(n))for(var u=0;u<n.length;u++)n[u][i]!=r&&delete n[u][i],n[u].hasOwnProperty("child")&&this._removeField(n[u].child,i)},_KeyPressEventHandler:function(t,i,r,u){var f,e,o,s;return n(t)[0]!=null?(s=this._isNodeExpanded(t),f=this._getNodeDetails(t),o=i._getPath(t),e={keyCode:r,currentElement:t,value:f.text,isExpanded:s,path:o,event:u,id:f.id,parentId:f.parentId}):e={keyCode:r,currentElement:t,value:"",isExpanded:"",path:"",event:u,id:"",parentId:""},this._triggerEvent("keyPress",e)},_documentClick:function(t){var i,e,u,f;if(t.target.id!="Edit_Input"&&(i=n("#Edit_Input")[0]),i!=null){var e=n(i).closest(".e-text")[0],u=i.value,r=n(i).closest(".e-item");n(i).remove();e.lastChild.nodeValue=u;n(e).removeClass("e-editable").removeAttr("style");this._updateField(this._newDataSource,r.attr("id"),this.model.fields.text,u);this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerEvent("nodeEdit",{id:r.attr("id"),oldText:this._beforeEditText,newText:u,target:r,nodeDetails:this._getNodeDetails(r),event:t})}this.element.find(t.target).length==0?(f=this.element.find(".e-item > div > .e-text.e-node-focus"),this._focusedNode=f.closest(".e-item"),f.removeClass("e-node-focus")):n(t.target).hasClass("e-active")&&(this._focusedNode=this.element.find(t.target).closest(".e-item"))},_saveAction:function(t,i){var u=t.val(),r=t.closest(".e-item"),f=t.closest(".e-text")[0];t.remove();f!=null&&(f.lastChild.nodeValue=u,n(f).removeClass("e-editable"),this._updateField(this._newDataSource,r.attr("id"),this.model.fields.text,u),this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource)),this._triggerEvent("nodeEdit",{id:r.attr("id"),oldText:this._beforeEditText,newText:u,target:r,nodeDetails:this._getNodeDetails(r),event:i}),this.element.focus(),this._focusedNode=r)},_cancelAction:function(t){var i=t.closest(".e-text")[0];t.remove();i.lastChild.nodeValue=this._beforeEditText;n(i).removeClass("e-node-hover e-editable");this.element.focus()},_mouseEnterEvent:function(t){this.element.find(".e-node-hover").removeClass("e-node-hover");n(t.currentTarget).hasClass("e-text")&&!n(t.currentTarget).hasClass("e-node-disable")&&n(t.currentTarget).addClass("e-node-hover")},_mouseLeaveEvent:function(t){n(t.currentTarget).removeClass("e-node-hover")},_liMouseEnterEvent:function(t){this.element.find(".e-node-hover").removeClass("e-node-hover");this.element.find(".e-li-hover").removeClass("e-li-hover");var r=n(t.currentTarget).closest(".e-item"),i=r.find("> div .e-text");i.length>0&&!i.hasClass("e-node-disable")&&(i.addClass("e-node-hover"),r.addClass("e-li-hover"))},_liMouseLeaveEvent:function(t){var i=n(t.currentTarget).closest(".e-item");i.find("> div .e-text").removeClass("e-node-hover");i.removeClass("e-li-hover")},_onFocusOutHandler:function(){this._isPopup||this._hidePopup();this._isPopup=!1},_createObjectByText:function(t,i){if(typeof t=="string"){var r={};return r[this.model.fields.text]=t,n(i)[0]!=null&&(r[this.model.fields.parentId]=i[0].getAttribute("id")),r}},_addNodesWhenObject:function(i,r){var l=JSON.stringify(this._dataSource),f=this.dataSource(),e,h,u,o,s,c;if(this._dataSource=[],this.dataSource()!=null&&this.dataSource()instanceof t.DataManager&&(f=[]),r[0]!=null&&r.length>0&&(e=r[0].getAttribute("id")),t.isNullOrUndefined(i.length))this._dataSource.push(i),t.isNullOrUndefined(this.dataSource())||(this._setNodeId(i,this.model.fields),t.isNullOrUndefined(e)||(i[this.model.fields.parentId]=e),f.push(i));else if(this._dataSource=i,!t.isNullOrUndefined(this.dataSource()))for(u=0;u<i.length;u++)this._setNodeId(i[u],this.model.fields),e?i[u][this.model.fields.parentId]=e:delete i[u][this.model.fields.parentId],f.push(i[u]);for(h=this._templateType,this._templateType=2,this._liList||(this._liList=n("li",this.element)),o=document.createDocumentFragment(),s=0,c=this._dataSource.length;s<c;s++)o.appendChild(this._genTemplate(this._dataSource[s],this.model.fields)),this._liList.push(n(o).children()[0]);return this._templateType=h,this.dataSource()==null||this.dataSource()instanceof t.DataManager||(this._dataSource=JSON.parse(l),this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(f)),this.dataSource(f))),o},_setNodeId:function(n,i){var u=i&&i.id?i.id:this.model.fields.id,f,r,e;if((t.isNullOrUndefined(n[u])||n[u]=="")&&(n[u]=this._id+"_"+this._indexID,this._indexID++),n.hasOwnProperty("child"))for(f=n.child,r=0,e=f.length;r<e;r++)this._setNodeId(f[r],i.child)},_addExpandedNodes:function(t){var i=this.model.expandedNodes;this._removeNullInArray(i);n.inArray(t,i)==-1&&this.model.expandedNodes.push(t);this._persistValues(this.model.expandedNodes,"expandedNodes")},_removeExpandedNodes:function(t){var i=this.model.expandedNodes;n.inArray(t,i)>-1&&(this.model.expandedNodes.splice(n.inArray(t,i),1),i.length==0&&i.push(-1));this._persistValues(this.model.expandedNodes,"expandedNodes")},_persistValues:function(i,r){var f,o,c,s,u,l,h,e;if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null){for(f=i,o=[],u=0,l=f.length;u<l;u++)!t.isNullOrUndefined(f[u])&&f[u]>=0&&(c=this._liList[f[u]],s=n(c).attr("id"),s&&o.push(s));h=this._getCookies("_persistedValues");h&&(e=JSON.parse(h),e[r]=o,e=this._updatePersistAttr(e),this._setCookies("_persistedValues",JSON.stringify(e)))}},_updatePersistAttr:function(i){return t.isNullOrUndefined(this._ignoreOnPersist)?(n.inArray("selectedNodes",this._addToPersist)==-1&&delete i.selectedNodes,n.inArray("expandedNodes",this._addToPersist)==-1&&delete i.expandedNodes,n.inArray("checkedNodes",this._addToPersist)==-1&&delete i.checkedNodes):(n.inArray("selectedNodes",this._ignoreOnPersist)>-1&&delete i.selectedNodes,n.inArray("expandedNodes",this._ignoreOnPersist)>-1&&delete i.expandedNodes,n.inArray("checkedNodes",this._ignoreOnPersist)>-1&&delete i.checkedNodes),i},_onChecked:function(n,i){var r=n.closest(".e-item"),u,f,e;nodeDetails=this._getNodeDetails(r);this._CurrenctSelectedNodes.push(nodeDetails.text);u=this._isChecked(r);f=t.isNullOrUndefined(i)?"":t.isNullOrUndefined(i.event)?"":i.event;e={currentElement:r,id:nodeDetails.id,parentId:nodeDetails.parentId,value:nodeDetails.text,currentNode:this._CurrenctSelectedNodes,currentCheckedNodes:this._checkedArray,isChecked:u,event:f};this._isRender&&this._triggerEvent("nodeCheck",e)},_onUnChecked:function(n,i){var r=n.closest(".e-item"),u,f,e;nodeDetails=this._getNodeDetails(r);this._CurrenctSelectedNodes.push(nodeDetails.text);u=this._isChecked(r);f=t.isNullOrUndefined(i)?"":t.isNullOrUndefined(i.event)?"":i.event;e={currentElement:r,id:nodeDetails.id,parentId:nodeDetails.parentId,value:nodeDetails.text,currentNode:nodeDetails.text,currentUncheckedNodes:this._uncheckedArray,isChecked:u,event:f};this._triggerEvent("nodeUncheck",e)},_addCheckNodes:function(n){var t=this.model.checkedNodes;this._removeNullInArray(t);!t instanceof Array&&(t=[]);t.indexOf(n)==-1&&t.push(n)},_removeCheckNodes:function(n){var t=this.model.checkedNodes,i;!t instanceof Array&&(t=[]);i=t.indexOf(n);i!=-1&&(t.splice(i,1),t.length==0&&t.push(-1))},_removeNullInArray:function(n){var t=n.indexOf(-1);t!=-1&&n.splice(t,1)},_afterInsertingNode:function(n){this._addDragableClass();this._finalizeEditing(n);var t=n.closest("ul").closest(".e-item");this._modifyCss(t);this._updateCheckState(t);this._isSelectedAction();t.length>0&&t.hasClass("e-node-disable")&&this._nodeDisableAction(t);this._updateSelectedNode()},_insertBeforeOrAfter:function(i,r,u){if(r=this._getNodeByID(r),r[0]!=null&&r.is("LI")&&r.hasClass("e-item")){if(this._triggerEvent("beforeAdd",{data:i,targetParent:r[0]!=null?r:null,parentDetails:this._getNodeDetails(r)}))return;if(this._isRender=!1,typeof i!="object"&&(i=this._createObjectByText(i)),typeof i!="object")return;i[this.model.parentId]&&delete i[this.model.parentId];outerLi=this._addNodesWhenObject(i,r);temp=document.createElement("ul");n(temp).append(outerLi);outerLi=n(temp.children);this.model.showCheckbox&&outerLi.children().find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange});r.parents(".e-item:first").length>0?r.parents(".e-item:first").append(outerLi):this.element.append(outerLi);this.model.showCheckbox&&this._isCheckedAction();this._dropAsSiblingNode(r,outerLi.find("> div > .e-text"),u,"");this._afterInsertingNode(outerLi);this._isRender=!0;this._triggerEvent("nodeAdd",{data:i,nodes:outerLi,parentElement:r[0]!=null?r:null,parentDetails:this._getNodeDetails(r)});var f=this,e=this.dataSource();setTimeout(function(){f.dataSource()==null||f.dataSource()instanceof t.DataManager||(f._dataSource=f._groupingObjects(e,function(n){return[!t.isNullOrUndefined(n)&&[n[f.model.fields.parentId]].toString()]}))},300)}},_getNodeByID:function(t){return typeof t!="object"&&t!=""&&t!=r?this.element.find(this._checkValidId(t.toString())):(t=n(t),t.is("A")&&t.hasClass("e-text")&&(t=t.closest(".e-item")),t)},_checkValidId:function(n){return n[0]=="#"?n.replace(/(:|\.|\[|\]|,)/g,"\\$1"):"#"+n.replace(/(:|\.|\[|\]|,)/g,"\\$1")},_isTreeElement:function(t){return n(t)[0]!=null&&t.is("LI")&&t.hasClass("e-item")},_isUrl:function(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)},_getChildUl:function(n){return this.model.fullRowSelect?n.children[2]:n.children[1]},_sendAjaxOptions:function(n,t){var r=this,i,u;i=this._getNodeDetails(t);i.mapper=this.model.fields;i.model=this.model;u={url:n,data:i,type:"POST",async:!0,crossDomain:!0,dataType:"JSON",contentType:"application/json; charset=utf-8",success:function(n){try{r._ajaxSuccessHandler(n,t)}catch(i){}},error:function(n){try{r._ajaxErrorHandler(n)}catch(t){}}};this._sendAjaxRequest(u)},_sendAjaxRequest:function(t){var i=JSON.parse(JSON.stringify(t));(delete i.success,delete i.error,this._triggerEvent("beforeLoad",{ajaxOptions:i}))||(delete i.success,delete i.error,n.extend(t,i),n.ajax({type:t.type,url:t.url,dataType:t.dataType,data:t.data,async:t.async,contentType:t.contentType,crossDomain:t.crossDomain,success:t.success,error:t.error}))},_ajaxSuccessHandler:function(n,t){this._isRender=!1;typeof n=="object"&&this.addNode(n,t);this._isRender=!0;this._triggerEvent("loadSuccess",{data:n,targetParent:t,parentDetails:this._getNodeDetails(t)})},_ajaxErrorHandler:function(n){this._triggerEvent("loadError",{error:n})},_wireEvents:function(){this._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click",this._ClickEventHandler)._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:this.model.expandOn,this._expandEventHandler)._on(this.element,"focus",this._onFocusHandler)._on(this.element,"blur",this._onFocusOutHandler);this._wholeRowEvents("_on");this.model.allowEditing&&this._allowEditable();this.model.allowDragAndDrop&&this._addDragableClass();this.model.showCheckbox&&this.element.find(".nodecheckbox").ejCheckBox("enable");this.model.allowKeyboardNavigation&&this._on(this.element,"keydown",this._KeyPress)},_unWireEvents:function(){this._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click")._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?this._touchExpandOn:this.model.expandOn)._off(this.element,"focus")._off(this.element,"blur");this._wholeRowEvents("_off");this._preventEditable();this._preventDraggable();this.model.allowKeyboardNavigation&&this._off(this.element,"keydown");this.model.showCheckbox&&this.element.find(".nodecheckbox").ejCheckBox("disable")},_wholeRowEvents:function(t){this.model.fullRowSelect?(this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchstart)?"touchstart":"mouseenter",".e-text-wrap",this._liMouseEnterEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchend)?"touchend":"mouseleave",".e-text-wrap",this._liMouseLeaveEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchstart)?"touchstart":"mouseenter",".e-fullrow",this._liMouseEnterEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchend)?"touchend":"mouseleave",".e-fullrow",this._liMouseLeaveEvent)):(this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchstart)?"touchstart":"mouseenter",".e-text",this._mouseEnterEvent),this[t](this.element,this._isDevice&&n.isFunction(n.fn.touchend)?"touchend":"mouseleave",".e-text",this._mouseLeaveEvent))},_enableDragDrop:function(){this.model.allowDragAndDrop&&(this._drag(),this.model.allowDropChild&&this._childDrop(),this.model.allowDropSibling&&this._siblingDrop())},_allowEditable:function(){this.model.template||(this.element.find(".e-item").addClass("AllowEdit"),this._on(n(document),"click",this._documentClick)._on(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"doubletap":"dblclick","a.e-text",this._inlineEdit))},_preventEditable:function(){this.element.find(".e-item").removeClass("AllowEdit");this._off(n(document),"click")._off(this.element,this._isDevice&&n.isFunction(n.fn.tap)?"doubletap":"dblclick","a.e-text")},_preventDraggable:function(){this.element.find(".e-draggable, .e-droppable").removeClass("e-draggable e-droppable");this._preventDropSibling();this._preventDropChild();this._off(this.element,"mouseup touchstart pointerdown MSPointerDown",this._anchors,this._focusElement)},_preventDropSibling:function(){this.element.find(".e-dropsibling").removeClass("e-dropsibling")},_preventDropChild:function(){this.element.find(".e-item > div > .e-dropchild").removeClass("e-dropchild")},_getNodeData:function(i){var u,e,c,l,f,a;if(!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)&&i!=r){if(this._updatePersistProb(),u=[],this._templateType==2)u=t.DataManager(this._newDataSource).executeLocal(t.Query().where(this.model.fields.id,"equal",i,!1));else{var s=[],o=this._newDataSource,v=t.Query().where(this.model.fields.id,"equal",i,!1),y=t.DataManager(o).executeLocal(v),h=this._getFilterItems(y[0],o);for(e=0,c=h.length;e<c;e++)s.push(new t.Predicate(this.model.fields.id,"equal",h[e],!1));l=t.Query().where(t.Predicate.or(s));u=t.DataManager(o).executeLocal(l)}for(f=0,a=u.length;f<a;f++)n(document.getElementById(u[f][this.model.fields.id])).find("> ul .e-item").length==0?delete u[f][this.model.fields.hasChild]:this._templateType==1&&(u[f][this.model.fields.hasChild]=!0);return u}},_getFilterItems:function(n,i){var f=[],s,e,r,h,o,u,c;for(f.push(n.id),s=t.Query().where(this.model.fields.parentId,"equal",n.id,!1),e=t.DataManager(i).executeLocal(s),r=0,h=e.length;r<h;r++)for(o=this._getFilterItems(e[r],i),u=0,c=o.length;u<c;u++)f.push(o[u]);return f},refresh:function(){this._unWireEvents();this.element.html("");this._init()},expandAll:function(n,t){this.model.enableMultipleExpand&&(n>0?this._expandByLevel(this._getElement(),n,t):this._expandAll(t))},collapseAll:function(n,t){this.model.enableMultipleExpand&&(n>0?this._collapseByLevel(this._getElement(),n,t):this._collapseAll(t))},checkAll:function(){this.model.showCheckbox&&this._checkAll()},unCheckAll:function(){this.model.showCheckbox&&this._uncheckAll()},selectNode:function(n){n&&typeof n=="object"&&n.length>0?(this._unselectAll(),this._doSelectNodes(n,!0)):(n=this._getNodeByID(n),this._isTreeElement(n)&&this._nodeSelectionAction(n))},unselectNode:function(n){n&&typeof n=="object"&&n.length>0?this._doUnselectNodes(n):(n=this._getNodeByID(n),this._isTreeElement(n)&&this._nodeUnSelectionAction(n))},selectAll:function(){this.model.allowMultiSelection&&this._selectAll()},unselectAll:function(){this.model.allowMultiSelection&&this._unselectAll()},enableNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.enableNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeEnableAction(i)},disableNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.disableNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeDisableAction(i)},addNodes:function(n,t){if(n&&typeof n=="object"&&t==r&&n.length>0)for(var i=0;i<n.length;i++)this.addNode(n[i],t);else this.addNode(n,t)},addNode:function(i,r){var f,l,h,s,u,o,e,c;t.isNullOrUndefined(i)||(f=null,l=null,u=r?this._getNodeByID(r):this.model.allowMultiSelection?this.getSelectedNodes():this.getSelectedNode(),typeof i=="object"&&(t.isNullOrUndefined(i.length)&&!t.isNullOrUndefined(i[this.model.fields.parentId])?s=i[this.model.fields.parentId]:t.isNullOrUndefined(i.length)||i.length!=1||(s=i[0][this.model.fields.parentId]),s&&(u=this._getNodeByID(s))),u=this._isTreeElement(u)?n(u[0]):[],this._triggerEvent("beforeAdd",{data:i,targetParent:u[0]!=null?u:null,parentDetails:this._getNodeDetails(u)}))||(u.length==0||u.hasClass("e-node-disable")||this._expandNode(u),typeof i!="object"&&(i=this._createObjectByText(i,u)),typeof i!="object"||t.isNullOrUndefined(i.length)&&i.length==0)||(f=this._addNodesWhenObject(i,u),h=document.createElement("ul"),n(h).append(f),f=n(h.children),this.model.showCheckbox&&f.children().find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),this._appendNode(u,f),u[0]!=null&&(o=n(u[0].childNodes[0].childNodes[0]),o.hasClass("e-plus")||o.hasClass("e-minus")?o.removeClass("e-load"):o.removeClass("e-icon e-load")),u[0]!=null&&u.find("> div > .e-minus").length>0&&!this.model.enableMultipleExpand&&this._denyMultipleExpand(u),this._updateNodes(),this._afterInsertingNode(f),this._triggerEvent("nodeAdd",{data:i,nodes:f,parentElement:u[0]!=null?u:null,parentDetails:this._getNodeDetails(u)}),e=this,c=this.dataSource(),setTimeout(function(){e.dataSource()==null||e.dataSource()instanceof t.DataManager||(e._dataSource=e._groupingObjects(c,function(n){return[!t.isNullOrUndefined(n)&&[n[e.model.fields.parentId]].toString()]}))},300))},removeNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.removeNode(n[t]);else i=n?this._getNodeByID(n):this.model.allowMultiSelection?this.getSelectedNodes():this.getSelectedNode(),this._isTreeElement(i)&&this._removeNode(i)},removeAll:function(){this._liList.remove();this._updateNodes()},checkNode:function(n){var t,i;if(this.model.showCheckbox)if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.checkNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeCheck(i.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},uncheckNode:function(n){var t,i;if(this.model.showCheckbox)if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.uncheckNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._nodeUncheck(i.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},expandNode:function(n){n&&typeof n=="object"&&n.length>0?(this._allowOnDemand=!0,this._expandNodes(n,!0),this._allowOnDemand=!1):(n=this._getNodeByID(n),this._isTreeElement(n)&&(this._allowOnDemand=!0,this._expandNode(n),this._allowOnDemand=!1))},collapseNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.collapseNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&this._collpaseNode(i)},showNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.showNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&i.css("visibility","").removeClass("hidden")},hideNode:function(n){var t,i;if(n&&typeof n=="object"&&n.length>0)for(t=0;t<n.length;t++)this.hideNode(n[t]);else i=this._getNodeByID(n),this._isTreeElement(i)&&i.css("visibility","hidden").addClass("hidden")},show:function(){this.element.css("visibility","").find(".e-item").removeClass("hidden")},hide:function(){this.element.css("visibility","hidden").find(".e-item").addClass("hidden")},hasChildNode:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?n.find("> ul > .e-item").length>0?!0:!1:void 0},isChildLoaded:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&n.find("ul > .e-item").length>0?!0:!1},isNodeChecked:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._isChecked(n):void 0},isExpanded:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._isNodeExpanded(n):void 0},isVisible:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&n.css("visibility")!="hidden"?!0:!1},isExist:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&this._liList.index(n)!=-1?!0:!1},isSelected:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?n.find("> div > .e-text").hasClass("e-active"):void 0},isDisabled:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)&&n.hasClass("e-node-disable")?!0:!1},getTreeData:function(n){return n!=r?this._getNodeData(n):!t.isNullOrUndefined(this.model.fields)&&this.dataSource()!=null&&!(this.dataSource()instanceof t.DataManager)?this._orderDataSource():void 0},getText:function(t){return t=this._getNodeByID(t),this._isTreeElement(t)?n.trim(this.element.find(t).find("> div > .e-text").text()):void 0},getSelectedNode:function(){return this.model.allowMultiSelection?null:this.element.find(".e-item > div > .e-active").closest(".e-item")},getSelectedNodes:function(){return this.element.find(".e-item > div > .e-active").closest(".e-item")},getCheckedNodes:function(){if(this.model.showCheckbox)return this._liList.find('> div > .e-chkbox-wrap[aria-checked="true"]').closest(".e-item")},getExpandedNodes:function(){return this.element.find(".e-item > div > .e-minus").closest(".e-item")},getExpandedNodesIndex:function(){return this._getNodesIndex(this.getExpandedNodes())},getCheckedNodesIndex:function(){return this._getNodesIndex(this.getCheckedNodes())},getSelectedNodeIndex:function(){return this.model.allowMultiSelection?null:this._getNodesIndex(this.getSelectedNode())},getSelectedNodesIndex:function(){return this._getNodesIndex(this.getSelectedNodes())},getVisibleNodes:function(){return this.element.find(".e-item:visible:not(.hidden, .e-node-disable)")},getNodeCount:function(){return this.element.find(".e-item").length},getNode:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._getNodeDetails(n):null},getNodeIndex:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?this._liList.index(n):void 0},getNodeByIndex:function(t){if(typeof t=="number")return n(this._liList[t])},getParent:function(n){return n=this._getNodeByID(n),this._isTreeElement(n)?n.parents(".e-item:first"):void 0},getChildren:function(n,t){return n=this._getNodeByID(n),this._isTreeElement(n)?t?n.find(".e-item"):n.find("> ul > .e-item"):void 0},updateText:function(i,r){if(i=this._getNodeByID(i),this._isTreeElement(i)&&!t.isNullOrUndefined(r)){var u=this.element.find(i).children("div").find("> .e-text")[0],f,e;if(u!=null){if(e={currentElement:n(u)},this._triggerEvent("beforeEdit",e))return!1;f=u.lastChild.nodeValue}u.lastChild.nodeValue=r;this._updateField(this._newDataSource,i.attr("id"),this.model.fields.text,r);this._deepWatch&&(this._oldDataSource=JSON.parse(JSON.stringify(this._newDataSource)),this.dataSource(this._newDataSource));this._triggerEvent("nodeEdit",{id:i.attr("id"),oldText:f,newText:r,target:i,nodeDetails:this._getNodeDetails(i),event:null})}},insertAfter:function(n,t){this._insertBeforeOrAfter(n,t,!1)},insertBefore:function(n,t){this._insertBeforeOrAfter(n,t,!0)},moveNode:function(n,i,r){if(n=this._getNodeByID(n),i=this._getNodeByID(i),this._isTreeElement(n)){if(n.parents(".e-item")[0]==i[0]&&t.isNullOrUndefined(r)||i.find(n).index()==r||i[0]==null&&this._liList.index(n)==r)return;var u=i[0]!=null&&r>=0?i.find("> ul > .e-item").eq(r):this.getNodeByIndex(r);this._isRender=!1;this._isTreeElement(u)?u.parents(".e-item:first")[0]==n.parents(".e-item:first")[0]&&u.next(".e-item")[0]==null?this._dropAsSiblingNode(u,n.find(" > div > .e-text"),!1,""):this._dropAsSiblingNode(u,n.find(" > div > .e-text"),!0,""):this._dropAsChildNode(i,n.find(" > div > .e-text"),"");i.length>0&&i.hasClass("e-node-disable")&&this._nodeDisableAction(i);this._isRender=!0}},loadData:function(n,t){t=this._getNodeByID(t);this._isUrl(n)&&(t[0]==null||this._isTreeElement(t))&&this._sendAjaxOptions(n,t)},ensureVisible:function(t){var r,u,i,f;if(t=this._getNodeByID(t),this._isTreeElement(t)&&!this.isDisabled(t)&&this.isVisible(t)){for(r=t.parents(".e-item"),i=0,f=r.length;i<f;i++)this._expandNode(n(r[i]));return u=t.offset(),t.animate({scrollTop:u.top},this.model.enableAnimation?350:0,"linear",function(){t.find("> div > a.e-text")[0].scrollIntoView(!1)}),!0}return!1},_triggerEvent:function(n,t){if(this._isRender)return this._trigger(n,t)}})}(jQuery,Syncfusion),function(n,t,r){t.widget("ejUploadbox","ej.Uploadbox",{element:null,_addToPersist:[""],model:null,validTags:["div","span"],_setFirst:!1,_rootCSS:"e-uploadbox",defaults:{buttonText:{browse:"Browse",upload:"Upload",cancel:"Cancel",close:"Close"},width:"100px",height:"35px",htmlAttributes:{},dialogPosition:{X:"",Y:""},dialogText:{title:"Upload Box",name:"Name",size:"Size",status:"Status"},customFileDetails:{title:!0,name:!0,size:!0,status:!0,action:!0},dialogAction:{modal:!1,closeOnComplete:!1,drag:!0,content:null},locale:"en-US",asyncUpload:!0,pushFile:null,enabled:!0,multipleFilesSelection:!0,autoUpload:!1,showFileDetails:!0,fileSize:31457280,extensionsAllow:"",extensionsDeny:"",saveUrl:"",removeUrl:"",uploadName:"",cssClass:"",dropAreaText:"Drop files or click to upload",allowDragAndDrop:!1,showBrowseButton:!0,showRoundedCorner:!0,dropAreaHeight:"100%",dropAreaWidth:"100%",enableRTL:!1,create:null,fileSelect:null,begin:null,beforeSend:null,cancel:null,inProgress:null,success:null,complete:null,remove:null,error:null,destroy:null},dataTypes:{buttonText:"data",dialogText:"data",disbled:"boolean",customFileDetails:"data",pushFile:"data",dialogAction:"data",multipleFilesSelection:"boolean",autoUpload:"boolean",showFileDetails:"boolean",allowDragAndDrop:"boolean",showBrowseButton:"boolean",showRoundedCorner:"boolean",fileSize:"number",extensionsAllow:"string",extensionsDeny:"string",saveUrl:"string",removeUrl:"string",cssClass:"string",enableRTL:"boolean",htmlAttributes:"data"},disable:function(){this._changeState(!1)},enable:function(){this._changeState(!0)},_changeState:function(t){t?n(this.control).removeClass("e-disable"):n(this.control).addClass("e-disable");this.model.enabled=t;n(this._currentElement).find(".e-uploadinput")[0].disabled=!t;this.diaObj&&(this.diaObj.option("beforeClose",this._onBeforeClose),this.diaObj.setModel({enabled:t,allowDraggable:t}))},refresh:function(){this.diaObj&&(this.diaObj.isOpened()?this.diaObj.close():this._uploadFileListDelete())},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.Uploadbox",this.model.locale)},_init:function(){this.s=t.browserInfo();this._updateLocalConstant();this._initialize();this._wireEvents();this.model.asyncUpload||this._initObjectsSyncUpload();this._controlStatus(this.model.enabled);this.model.locale=="en-US"?this._buttonText(this.model.buttonText):this._setLocale();this._roundedCorner(this.model.showRoundedCorner)},_setModel:function(n){for(var t in n){switch(t){case"buttonText":this._buttonText(n[t]);break;case"htmlAttributes":this._addAttr(n[t]);break;case"dialogText":this._dialogText(n[t]);break;case"cssClass":this._setSkin(n[t]);break;case"enableRTL":this._setRTL(n[t]);break;case"enabled":this._controlStatus(n[t]);break;case"locale":this.model.locale=n[t];this._updateLocalConstant();this._setLocale();break;case"height":this.model.height=n[t];this._setHeight(this.model.height);break;case"width":this.model.width=n[t];this._setWidth(this.model.width);break;case"dialogPosition":this.model.dialogPosition=n[t];this._dialogPosition();break;case"allowDragAndDrop":this.model.allowDragAndDrop=n[t];this._dragAndDrop();break;case"dropAreaText":this.model.dropAreaText=n[t];this._dropAreaText(this.model.dropAreaText);break;case"showBrowseButton":this.model.showBrowseButton=n[t];this._hideBrowseButton();this._refreshUploadDialogParent();break;case"showRoundedCorner":this._roundedCorner(n[t]);break;case"dropAreaHeight":this.model.dropAreaHeight=n[t];this._setSize();break;case"dropAreaWidth":this.model.dropAreaWidth=n[t];this._setSize();break;case"pushFile":this.model.pushFile=n[t];this.model.pushFile!=null&&this.UploadType=="Xhr"&&this.model.asyncUpload&&(this._files=this.model.pushFile);this._onXhrSelect();break;case"multipleFilesSelection":this.model.multipleFilesSelection=n[t];(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1)==!1&&(this.model.multipleFilesSelection?this._currentElement.find(".e-uploadinput").attr("multiple","multiple"):this._currentElement.find(".e-uploadinput").removeAttr("multiple"));break;case"uploadName":this.model.uploadName=n[t];this.inputupload.attr("name",this.model.uploadName);this.refresh();break;case"autoUpload":this.model.autoUpload=n[t];break;case"showFileDetails":this.model.showFileDetails=n[t];this.refresh();break;case"fileSize":this.model.fileSize=n[t];break;case"extensionsAllow":this.model.extensionsAllow=n[t];this._currentElement.find(".e-uploadinput").attr("accept",n[t]);break;case"extensionsDeny":this.model.extensionsDeny=n[t];break;case"saveUrl":this.model.saveUrl=n[t];break;case"removeUrl":this.model.removeUrl=n[t]}this._currentElement=this.model.allowDragAndDrop&&!this.model.showBrowseButton?this.dragWrapper:this.element}},_controlStatus:function(n){n!=!0?this.disable():this.enable()},_setRTL:function(n){n?this._currentElement.addClass("e-rtl"):this._currentElement.removeClass("e-rtl");this.updialog&&this.updialog.ejDialog({enableRTL:n})},_getLocalizedLabels:function(n){var i,r="";return i=n=="browse"||n=="upload"||n=="cancel"||n=="close"?"buttonText":"dialogText",this._localizedLabels[n]?r=this._localizedLabels[n]:this._localizedLabels[i][n]?r=this._localizedLabels[i][n]:t.Uploadbox.Locale["en-US"][n]?r=t.Uploadbox.Locale["en-US"][n]:t.Uploadbox.Locale["en-US"][i][n]&&(r=t.Uploadbox.Locale["en-US"][i][n]),r},_setLocale:function(){this._buttonText(this._localizedLabels.buttonText);this._dialogText(this._localizedLabels.dialogText);this._dropAreaText(this._localizedLabels.dropAreaText)},_buttonText:function(t){n.extend(this.model.buttonText,t);this.buttondiv.val(this.model.buttonText.browse);this.updialog&&(this.updialog.find(".e-action-container .e-uploadbtn").html(this.model.buttonText.upload),this.updialog.find(".e-action-container .e-uploadclosebtn").html(this.model.buttonText.cancel))},_dialogText:function(t){n.extend(this.model.dialogText,t);this.diaObj==r||this.diaObj.option("title",this.model.dialogText.title);this.updialog&&(this.updialog.find(".e-head-name").html(this.model.dialogText.name),this.updialog.find(".e-head-size").html(this.model.dialogText.size),this.updialog.find(".e-head-status").html(this.model.dialogText.status))},_destroy:function(){this._currentElement.hasClass("e-uploadbox")&&(this._currentElement.removeClass("e-uploadbox e-widget"),this._currentElement.empty(),n(this.dragWrapper).after(this._currentElement),this.element.css({width:"",height:""}),this._bindResizeHandler(!1),this.dragWrapper.remove())},_setSkin:function(n){this._currentElement.removeClass(this.model.cssClass);this._currentElement.addClass(n);this.diaObj&&this.diaObj.setModel({cssClass:this.model.cssClass});this.model.allowDragAndDrop&&this.dragWrapper.addClass(n)},_initialize:function(){this.control=this.element[0];this.element.addClass("e-widget "+this.model.cssClass);this.innerdiv=t.buildTag("div.e-selectpart e-select e-box");this.element.append(this.innerdiv);this.buttondiv=t.buildTag("input.e-inputbtn e-btn#"+this.control.id+"_SelectButton","",{},{type:"button","data-role":"none",value:this._getLocalizedLabels("browse")});this.inputupload=t.buildTag("input.e-uploadinput","",{},{type:"file","data-role":"none",name:this.model.uploadName!=""?this.model.uploadName:this.control.id}).attr("accept",this.model.extensionsAllow);this.model.multipleFilesSelection&&(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1)==!1&&this.inputupload.attr("multiple","multiple");this.innerdiv.append(this.buttondiv);this.innerdiv.append(this.inputupload);this.model.allowDragAndDrop&&this._dragAndDrop(!0);this._Selector=this.buttondiv[0];this._currentElement=this.model.allowDragAndDrop&&!this.model.showBrowseButton?this.dragWrapper:this.element;this._setRTL(this.model.enableRTL);this._addAttr(this.model.htmlAttributes);this.Uploadframes=[];this.UploadForms=[];this._successFiles=[];this._errorFiles=[];this.UploadType=this._isXhrSupported()?"Xhr":"IFrame";this.model.width!=""&&this._setWidth(this.model.width);this.model.height!=""&&this._setHeight(this.model.height);this._hideBrowseButton()},_refreshUploadDialogParent:function(){this.diaObj&&this.diaObj.setModel({target:this.model.dialogAction.content!=null&&this.model.dialogAction.content!=""?this.model.dialogAction.content:!this.model.showBrowseButton&&this.model.allowDragAndDrop?"#"+this.control.id+"_dragWrapper":"#"+this.control.id})},_hideBrowseButton:function(){!this.model.showBrowseButton&&this.model.allowDragAndDrop?(this.element.addClass("e-browse-hide"),this._dropAreaSize()):this.element.hasClass("e-browse-hide")&&(this.element.removeClass("e-browse-hide"),this.element.width(this.model.width),this.element.height(this.model.height))},_setSize:function(){this.model.allowDragAndDrop&&(this.model.dropAreaWidth!=""&&this.dragWrapper.outerWidth(this.model.dropAreaWidth),this.model.dropAreaHeight!=""&&this.dragWrapper.outerHeight(this.model.dropAreaHeight),this.model.showBrowseButton||this._dropAreaSize())},_dropAreaSize:function(){this.model.dropAreaWidth!=""&&this.element.width(this.model.dropAreaWidth);this.model.dropAreaHeight!=""&&this.element.height(this.model.dropAreaHeight)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):t=="disabled"&&n=="disabled"?i.disable():i.element.attr(t,n)})},_dragAndDrop:function(){this.model.allowDragAndDrop?(this.dragWrapper=t.buildTag("div.e-drag-wrapper e-widget-wrapper e-upload-box "+this.model.cssClass+"#"+this.control.id+"_dragWrapper"),this.innerWrapper=t.buildTag("div.e-drag-container"),this._spanTag=t.buildTag("span.e-drag-text").html(this.model.locale=="en-US"?this.model.dropAreaText:t.Uploadbox.Locale[this.model.locale].dropAreaText),this.innerWrapper.append(this._spanTag),this.innerWrapper.insertBefore(this.element),this.dragWrapper.insertBefore(this.element),this.innerWrapper.append(this.element),this.dragWrapper.append(this.innerWrapper),this._bindDragEvents(),this._refreshUploadDialogParent(),this._setSize()):(this._refreshUploadDialogParent(),this.element.insertBefore(this.dragWrapper),this.dragWrapper.remove(),this._unBindDragEvents());this._hideBrowseButton()},_resizeHandler:function(){this.diaObj&&(n(window).width()>750?(n(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),this.diaObj.setModel({width:this._getDialogContentWidth(),height:"auto"})):(n(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"),this.diaObj.setModel({width:250,height:"auto"})),this.diaObj.scroller&&this.diaObj.scroller.setModel({height:"auto"}))},_getDialogContentWidth:function(){var n=0;return this.model.customFileDetails.name&&(n=n+200),this.model.customFileDetails.size&&(n=n+100),this.model.customFileDetails.status?n=n+200:this.model.customFileDetails.action&&(n=n+45),n+5},_dropAreaText:function(n){this.model.allowDragAndDrop&&this._spanTag.html(n)},_bindDragEvents:function(){this._on(this.dragWrapper,"dragover",this._onDragOverHandler);this._on(this.dragWrapper,"drop",this._onDropHandler)},_unBindDragEvents:function(){this._off(this.dragWrapper,"dragover",this._onDragOverHandler);this._off(this.dragWrapper,"drop",this._onDropHandler)},_setWidth:function(n){this.element.css("width",n)},_setHeight:function(n){this.element.height(n)},_dialogPosition:function(){if(this.diaObj){if((this.diaObj.model.content=="#"+this.control.id||this.diaObj.model.content=="#"+this.control.id+"_dragWrapper")&&this.model.dialogPosition.X==""&&this.model.dialogPosition.Y==""){var t=parseInt(this.diaObj.wrapper.css("left"))-(this.diaObj.wrapper.outerWidth()-n(this.diaObj.model.content).outerWidth())/2;this.model.dialogPosition.X=parseInt(t)>0?t:parseInt(this.diaObj.wrapper.css("left"));this.model.dialogPosition.Y=parseInt(this.diaObj.wrapper.css("top"))+n(this.diaObj.model.content).outerHeight()}this.model.dialogPosition.X!=""&&this.model.dialogPosition.Y!=""&&this.diaObj.setModel({position:this.model.dialogPosition})}},_roundedCorner:function(n){n?this.innerdiv.addClass("e-corner"):this.innerdiv.hasClass("e-corner")&&this.innerdiv.removeClass("e-corner")},_wireEvents:function(){this._on(this.element,"click",this._disableclickselect);this._on(this.element,"keydown",this._keydownselect);this._bindInputChangeEvent();this._bindResizeHandler(!0)},_bindResizeHandler:function(t){t?n(window).on("resize",n.proxy(this._resizeHandler,this)):n(window).off("resize",n.proxy(this._resizeHandler,this))},_keydownselect:function(n){this.element.hasClass("e-disable")||n.keyCode!=13||this.diaObj&&this.diaObj.isOpened()||this.element.find(".e-uploadinput").click()},_onDropHandler:function(n){if(t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"||t.browserInfo().version==="9.0"||this._currentElement.hasClass("e-disable"))return!1;n.stopPropagation();n.preventDefault();this._files=this._getAllFileInfo(n.originalEvent.dataTransfer.files);this._fileSelect(n)},_onDragOverHandler:function(n){if(this._currentElement.hasClass("e-disable"))return!1;n.stopPropagation();n.preventDefault()},_disableclickselect:function(n){this._currentElement.hasClass("e-disable")&&n.preventDefault()},_bindInputChangeEvent:function(){this._on(this.inputupload,"change",this._inputValueChange)},_inputValueChange:function(t){return this._files=this._getInputFileInfo(n(t.target)),this._fileSelect(t)},_fileSelect:function(n){if(this._trigger("fileSelect",{files:this._files}))return this._resetFileInput(this._currentElement.find(".e-uploadinput")),!1;this._fileUpload(n)},_fileUpload:function(n){var t=this._isAllowed(this._files);this._files=t.files;this.model.asyncUpload?t.files!=null&&t.files.length>0&&(this.UploadType=="Xhr"?this._onXhrSelect(n):this._onSelectIFrame(n),this._resetFileInput(this._currentElement.find(".e-uploadinput"))):t.status&&this._onSelectSyncUpload(n);this._renderTooltip()},__uploadButtonClick:function(t){if(!this._currentElement.hasClass("e-disable")){var i=this._currentElement.find(".e-uploadbtn");this._currentElement.find(".e-uploadbtn").hasClass("e-disable")?t.preventDefault():this.UploadType=="Xhr"?this._xhrOnUploadButtonClick(t):this._onUploadButtonClickIFrame(t);n(t.target).attr("disabled","disabled").addClass("e-disable")}},_actionClick:function(t){var r,i,u;this._currentElement.hasClass("e-disable")||(r=n(t.target),i=r.closest(".e-upload-file"),this._file=n(i).data("file"),r.hasClass("e-delete")?this.UploadType=="Xhr"?this._xhrOnRemove(t,i):this._onRemoveIFrame(t,i):r.hasClass("e-file-cancel")?(this._trigger("cancel",{fileStatus:this._file}),u=this.updialog.find(".e-file-cancel"),u.hasClass("e-disable")?t.preventDefault():this.model.asyncUpload?(this._removeFile(n(i).data("file")),this.UploadType=="Xhr"?this._xhrOnCancel(t,i):this._onCancelIFrame(t,i)):this._onCancelSyncUpload(t,i)):r.hasClass("e-reload")&&(this.UploadType=="Xhr"?this._xhrOnRetry(t,i):this._onRetryIFrame(t,i)))},_removeFileEntry:function(n){n.remove()},_removeFile:function(n){for(var i=[],t=0;t<this._files.length;t++)this._files[t]!=n&&i.push(this._files[t]);this._files=i},_isFileUpload:function(t){if(this.model.customFileDetails.action){var i=n(t).find("div.e-icon");return i.is(".e-file-cancel")}return!0},_isXhrSupported:function(){return this.s.name=="msie"&&parseInt(this.s.version)<9||this.s.name=="safari"&&this.s.name=="chrome"&&this.s.version=="536"?!1:typeof FormData!="undefined"&&typeof File!="undefined"},_getFileName:function(t){return n.map(this._getAllFileInfo(t),function(n){return n.name}).join(", ")},_getFileSize:function(t){var i=this;return n.map(this._getAllFileInfo(t),function(n){return i._formatSize(n.size)}).join(", ")},_pushFile:function(i,r){var s,h,e,u,o,f,c,l,a,v,y;for(f=n("<div class='e-head-content'><\/div>"),l=n("<div class='e-file-head e-head-name'>"+this._getLocalizedLabels("name")+"<\/div>"),a=n("<div class='e-file-head e-head-size'>"+this._getLocalizedLabels("size")+"<\/div>"),v=n("<div class='e-file-head e-head-status'>"+this._getLocalizedLabels("status")+"<\/div>"),this.model.customFileDetails.name&&n(l).appendTo(f),this.model.customFileDetails.size&&n(a).appendTo(f),this.model.customFileDetails.status&&n(v).appendTo(f),filedialog=this.updialog,filedialog&&filedialog.length!=0?this.model.showFileDetails&&(this.updialog&&this.updialog.find(".e-uploadbtn").removeAttr("disabled").removeClass("e-disable"),this.diaObj.open()):(this.updialog=t.buildTag("div.uploaddialog#"+this.element[0].id+"_dialog","",{},{title:this._getLocalizedLabels("title")}),this.model.allowDragAndDrop&&!this.model.showBrowseButton?(this.dragWrapper.append(this.updialog),DialogContentContainer="#"+this.control.id+"_dragWrapper"):(this.element.append(this.updialog),DialogContentContainer="#"+this.control.id)),s=this.updialog.find(".e-ul"),n(this.updialog.find(".e-head-content"))&&n(this.updialog.find(".e-head-content")).replaceWith(f),s.length==0&&(f.appendTo(this.updialog),s=t.buildTag("ul.e-ul").appendTo(this.updialog)),n(this.updialog).find(".e-file-upload").length>0&&n(this.updialog).find(".e-file-upload").remove(),fileListActions=t.buildTag("div.e-file-upload").appendTo(this.updialog).append(this.model.autoUpload||!this.model.asyncUpload?n(t.buildTag("div.e-action-container")).addClass("sync"):t.buildTag("div.e-action-container")),dialogActions=t.buildTag("button.e-uploadclosebtn e-btn e-select",this._getLocalizedLabels("cancel"),{},{type:"button","data-role":"none"}).appendTo(n(this.updialog).find(".e-action-container")),this.model.showRoundedCorner&&dialogActions.addClass("e-corner"),this._on(dialogActions,"click",this._dialogclose),this._on(dialogActions,"keydown",this._keydownDialogClose),y=this.model.dialogAction.content!=null&&this.model.dialogAction.content!=""?this.model.dialogAction.content:DialogContentContainer,this.updialog.ejDialog({showOnInit:!1,closeIconTooltip:this._getLocalizedLabels("closeToolTip"),minWidth:240,width:n(window).width()<750?250:this._getDialogContentWidth(),height:"auto",cssClass:"e-uploadbox "+this.model.cssClass,close:n.proxy(this._uploadFileListDelete,this),enableRTL:this.model.enableRTL,target:y,enableResize:!1,allowDraggable:this.model.dialogAction.drag,enableModal:this.model.asyncUpload?this.model.dialogAction.modal:!1,showHeader:this.model.customFileDetails.title,showRoundedCorner:this.model.showRoundedCorner}),n(window).width()<750?n(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"):n(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),this.diaObj=this.updialog.data("ejDialog"),this.model.cssClass!=""&&this.diaObj.setModel({cssClass:this.model.cssClass}),this._dialogPosition(),this.model.multipleFilesSelection||this.updialog.find(".e-ul>.e-upload-file").remove(),u=0;u<i.length;u++)h=n("<li class='e-upload-file'><\/li>").appendTo(s).data(r),addedlist=n("<div class='e-file-list'><\/div>"),addedfilename=n("<div class='e-file-progress e-file-view'><div class='e-file-name e-file-view'><span class='e-file-name-txt'>"+i[u].name+"<\/span><\/div>"),c="<div class='e-file-size e-file-view'><span class='e-file-name-txt'>"+this._formatSize(i[u].size)+"<\/span><\/div>",addedfilestatus=n("<div class='e-file-percentage e-file-view'><div class='e-file-progress-bar'><div class='e-file-progress-status'><\/div><\/div><\/div>"),addedfileaction=n("<div class='e-action-perform'><div class='e-icon e-file-view'><\/div><\/div>"),this.model.customFileDetails.name&&n(addedfilename).appendTo(addedlist),this.model.customFileDetails.size&&(this._getFileSize(i[u]).toString().toLowerCase().match("0.0kb").length==0||i[u].size!=null?n(c).appendTo(addedlist):n(this.updialog).find(".e-head-size").remove()),this.model.customFileDetails.status&&n(addedfilestatus).appendTo(addedlist),this.model.customFileDetails.action&&(n(addedfileaction).appendTo(addedlist),o="cancel",addedlist.find(".e-icon").remove().addClass(o.toString()),o=="cancel"?e=t.buildTag("div.e-icon e-file-cancel","",{},{"data-content":this._getLocalizedLabels("cancelToolTip")}):o=="remove"?e=t.buildTag("div.e-icon e-delete","",{},{"data-content":this._getLocalizedLabels("removeToolTip")}):o=="retry"&&(e=t.buildTag("div.e-icon e-reload","",{},{"data-content":this._getLocalizedLabels("retryToolTip")})),addedlist.find(".e-action-perform").append(e),this._on(e,"click",this._actionClick)),n(addedlist).appendTo(h);return this.model.showFileDetails&&this.diaObj.open(),this._buttonText(this.model.buttonText),this._dialogText(this.model.dialogText),h},_keydownDialogClose:function(n){this._currentElement.hasClass("e-disable")||n.keyCode==13&&this._dialogclose()},_pushFileDetails:function(i){var r,u,f,s,h,c,l,a,v,y,e,o,p;return f=n("<div class='e-head-content'><\/div>"),s=n("<div class='e-file-head e-head-name'>"+this._getLocalizedLabels("name")+"<\/div>"),h=n("<div class='e-file-head e-head-size'>"+this._getLocalizedLabels("size")+"<\/div>"),c=n("<\/div><div class='e-file-head e-head-status'>"+this._getLocalizedLabels("status")+"<\/div>"),this.model.customFileDetails.name&&n(s).appendTo(f),this.model.customFileDetails.size&&n(h).appendTo(f),this.model.customFileDetails.status&&n(c).appendTo(f),r=this,filedialog=this.updialog,filedialog&&filedialog.length!=0?this.model.showFileDetails&&(DialogContentContainer="#"+this.control.id,this.updialog&&this.updialog.find(".e-uploadbtn").removeAttr("disabled").removeClass("e-disable"),r.diaObj.open()):(this.updialog=t.buildTag("div.uploaddialog#"+this.element[0].id+"_dialog","",{},{title:this._getLocalizedLabels("title")}),this.model.allowDragAndDrop&&!this.model.showBrowseButton?(this.dragWrapper.append(this.updialog),DialogContentContainer="#"+this.control.id+"_dragWrapper"):(this.element.append(this.updialog),DialogContentContainer="#"+this.control.id)),e=this.updialog.find(".e-ul"),n(this.updialog.find(".e-head-content"))&&n(this.updialog.find(".e-head-content")).replaceWith(f),e.length==0&&(f.appendTo(this.updialog),e=t.buildTag("ul.e-ul").appendTo(this.updialog)),n(this.updialog).find(".e-file-upload").length>0&&n(this.updialog).find(".e-file-upload").remove(),fileListActions=t.buildTag("div.e-file-upload").appendTo(this.updialog).append(this.model.autoUpload||!this.model.asyncUpload?n(t.buildTag("div.e-action-container")).addClass("sync"):t.buildTag("div.e-action-container")),dialogActions=t.buildTag("button.e-uploadclosebtn e-btn e-select",this._getLocalizedLabels("cancel"),{},{type:"button","data-role":"none"}).appendTo(n(this.updialog).find(".e-action-container")),this.model.showRoundedCorner&&dialogActions.addClass("e-corner"),this._on(dialogActions,"click",this._dialogclose),this.model.multipleFilesSelection||this.updialog.find(".e-ul>.e-upload-file").remove(),o=n("<li class='e-upload-file'><\/li>").appendTo(e).data("file",i),u=n("<div class='e-file-list'><\/div>"),l=n("<div class='e-file-progress e-file-view'><div class='e-file-name e-file-view'><span class='e-file-name-txt'>"+i.name+"<\/span><\/div>"),v=n("<div class='e-file-size e-file-view'><span class='e-file-name-txt'>"+this._formatSize(0)+"\\"+this._formatSize(i.size)+"<\/span><\/div>"),a=n("<div class='e-file-percentage e-file-view'><div class='e-file-progress-bar'><div class='e-file-progress-status'><\/div><\/div><\/div>"),y=n("<div class='e-action-perform'><div class='e-icon e-file-view'><\/div><\/div><\/div>"),this.model.customFileDetails.name&&n(l).appendTo(u),this.model.customFileDetails.size&&n(v).appendTo(u),this.model.customFileDetails.status&&n(a).appendTo(u),this.model.customFileDetails.action&&n(y).appendTo(u),n(u).appendTo(o),p=this.model.dialogAction.content!=null&&this.model.dialogAction.content!=""?this.model.dialogAction.content:DialogContentContainer,this.updialog.ejDialog({showOnInit:!1,closeIconTooltip:this._getLocalizedLabels("closeToolTip"),minWidth:240,width:n(window).width()<750?250:this._getDialogContentWidth(),height:"auto",cssClass:"e-uploadbox "+this.model.cssClass,close:n.proxy(this._uploadFileListDelete,this),enableRTL:this.model.enableRTL,target:p,enableResize:!1,allowDraggable:this.model.dialogAction.drag,enableModal:this.model.asyncUpload?this.model.dialogAction.modal:!1,showHeader:this.model.customFileDetails.title,showRoundedCorner:this.model.showRoundedCorner}),n(window).width()<750?n(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"):n(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),r.diaObj=this.updialog.data("ejDialog"),r.model.cssClass!=""&&r.diaObj.setModel({cssClass:this.model.cssClass}),r._dialogPosition(),this.model.showFileDetails&&r.diaObj.open(),this._buttonText(this.model.buttonText),this._dialogText(this.model.dialogText),o},_setProgress:function(t,i,r){var u,f,e,o;this.model.customFileDetails.status&&(u=n(t).find(".e-file-progress-status"),u.width(i+"%"));this.model.customFileDetails.size&&(f=n(t).find(".e-file-size .e-file-name-txt"),e=this._formatSize(r.loaded),o=this._formatSize(r.total),f.html(e+"\\"+o))},_setAction:function(n,i){if(this.model.customFileDetails.action){var r;n.find(".e-action-perform .e-icon,.e-file-percentage .e-icon").remove().addClass(i.toString());i=="cancel"?r=t.buildTag("div.e-icon e-file-cancel","",{},{"data-content":this._getLocalizedLabels("cancelToolTip")}):i=="remove"?r=t.buildTag("div.e-icon e-delete","",{},{"data-content":this._getLocalizedLabels("removeToolTip")}):i=="retry"&&(r=t.buildTag("div.e-icon e-reload","",{},{"data-content":this._getLocalizedLabels("retryToolTip")}));n.find(".e-action-perform").append(r);this._on(r,"click",this._actionClick)}},_setStatus:function(n,i){if(this.model.customFileDetails.status){var u,r=t.buildTag("div");i=="success"&&(n.find(".file-status").addClass("e-file-status-success").html("Completed"),n.find(".e-file-percentage").html(""),r.addClass("e-icon e-checkmark").attr("data-content",this._getLocalizedLabels("completedToolTip")),n.find(".e-file-percentage").append(r));i=="failed"&&(n.find(".file-status").addClass("e-file-status-failed").html("Failed"),n.find(".e-file-percentage").html(""),r.addClass("e-icon e-file-percentage-failed").attr("data-content",this._getLocalizedLabels("failedToolTip")),n.find(".e-file-percentage").append(r));i=="progress"&&n.find(".file-status").addClass("file-status-inprogress").html("in progress");i=="uploading"&&(n.find(".file-status").addClass("file-status-inprogress").html("uploading"),u=n.find(".e-file-percentage"),u.html(""))}},_renderTooltip:function(){var i=this;t.isNullOrUndefined(this.updialog)||(this.upTooltip=n(this.updialog).ejTooltip({target:".e-file-cancel, .e-delete, .e-reload, .e-checkmark, .e-close, .e-file-percentage-failed",content:" ",isBalloon:!1,showRoundedCorner:this.model.showRoundedCorner,enableRTL:this.model.enableRTL,position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}}}).data("ejTooltip"),n(this.upTooltip.tooltip).css({"min-width":"auto"}))},_createInputandBind:function(){var n=t.buildTag("input","",{},{type:"file","data-role":"none"});n.attr("name",this.model.uploadName!=""?this.model.uploadName:this.control.id).attr("autocomplete","off").attr("class","e-uploadinput").attr("accept",this.model.extensionsAllow);this.model.multipleFilesSelection&&(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1)==!1&&n.attr("multiple","multiple");n.appendTo(this.element.find(".e-selectpart"));this.inputupload=n;this._bindInputChangeEvent()},_showUploadButton:function(){var i=this.updialog.find(".e-uploadbtn");i.length==0&&(i=t.buildTag("button.e-uploadbtn e-btn e-select",this._getLocalizedLabels("upload"),{},{type:"button","data-role":"none"}),this.model.showRoundedCorner&&i.addClass("e-corner"),this.updialog.find(".e-action-container").append(i),this._on(i,"click",this.__uploadButtonClick),this._on(i,"keydown",this._keydownUpload),n(i).focus());this._buttonText(this.model.buttonText)},_keydownUpload:function(n){n.keyCode==13&&this.__uploadButtonClick(n)},_resetFileInput:function(n){var t=n.clone(!1,!1);this._on(t,"change",this._inputValueChange);n.replaceWith(t)},_isAllowed:function(t){var f,e,i,s,h,c,r=this,u=[],l=[],o=!0;return f=this.element.find(".e-uploadinput"),e=this,this.model.extensionsAllow!=""?(s=this.model.extensionsAllow.replace(/\s/g,"").toLowerCase().split(","),n(t).each(function(){n.inArray(this.extension.toLowerCase(),s)==-1?(i={action:"Files Processing",error:r._getLocalizedLabels("allowError").replace("#Extension",s.join(", ")),files:this},e._trigger("error",i),r._resetFileInput(f),o=!1):this.extension!=""&&u.push(this)})):this.model.extensionsDeny!=""?(c=this.model.extensionsDeny.replace(/\s/g,"").toLowerCase().split(","),n(t).each(function(){n.inArray(this.extension.toLowerCase(),c)!=-1?(i={action:"Files Processing",error:r._getLocalizedLabels("denyError").replace("#Extension",c.join(", ")),files:this},e._trigger("error",i),r._resetFileInput(f),o=!1):this.extension!=""&&u.push(this)})):n(t).each(function(){this.extension!=""&&u.push(this)}),this.model.fileSize!=""?(h=this.model.fileSize,n(u).each(function(){this.size>h?(i={action:"Files Processing",error:r._getLocalizedLabels("filedetail").replace("#fileSize",h),files:this},e._trigger("error",i),r._resetFileInput(f),o=!1):l.push(this)})):l=u,{files:l,status:o}},_fileListRemove:function(){fileList=this.updialog.find(".e-upload-file .e-delete");fileList.length==0&&(this.updialog.find(".e-uploadbtn").attr("disabled","disabled").addClass("e-disable"),this.updialog.ejDialog("close"))},_uploadHide:function(){fileList=this.updialog.find(".e-upload-file .e-file-cancel");fileList.length==0&&(this.updialog.find(".e-ul").empty(),this.updialog.find(".e-uploadbtn").attr("disabled","disabled").addClass("e-disable"),this.updialog.ejDialog("close"),this.upTooltip.hide())},_onBeforeClose:function(i){t.isNullOrUndefined(i.event)||(i.cancel=n(i.event.currentTarget).hasClass("e-disable")?!0:!1)},_dialogclose:function(t){if(!this._currentElement.hasClass("e-disable")){var u=this.updialog.find(".e-uploadclosebtn"),i,r;r=this.updialog.find(".e-ul").children().first();i=n(r).data("file");u.hasClass("e-disable")?t.preventDefault():(this._uploadFileListDelete(),this.updialog.ejDialog("close"));this._trigger("cancel",{fileStatus:i})}},_uploadFileListDelete:function(){this.updialog.find(".e-ul").empty();this._currentElement.find(".e-uploadinput").val("");this._resetFileInput(this._currentElement.find(".e-uploadinput"));this.model.asyncUpload||this._formResetSyncUpload()},_onXhrSelect:function(){var t,i;this._xhrBeforeUpload(this._files);t=this;n.each(t._files,function(r,u){i=n(u).data("filelist");t._setAction(i,"cancel");t.model.autoUpload?t._xhrPerformUpload(u):t._showUploadButton()})},_xhrBeforeUpload:function(t){var i,r,u,f;return i=t,r=this,n.each(i,function(t,i){u=r._createFormObjectXhr(i);n(i).data("formobject",u);f=r._pushFileDetails(i);n(i).data("filelist",f)}),i},_xhrPerformUpload:function(t){var o,i,e,u,f;if(u=new XMLHttpRequest,i=this,f={files:t},this._trigger("begin",f)){n(t).data("xhr",u);i._onRequestError(i,r,t);return}if(o=this.model.saveUrl,e=n(t).data("formobject"),e.append((this.model.uploadName&&this.model.uploadName!=""?this.model.uploadName:this.control.id)+"_data",JSON.stringify(f.data)),n(t).data("xhr",u),u.addEventListener("load",function(n){i._onRequestSuccess(i,n,t)},!1),u.addEventListener("error",function(n){i._onRequestError(i,n,t)},!1),u.upload.addEventListener("progress",function(n){i._onRequestProgress(i,n,t)},!1),u.open("POST",o),f={files:t,xhr:u},this._trigger("beforeSend",f)){n(t).data("xhr",u);i._onRequestError(i,r,t);return}u.send(e)},_xhrOnUploadButtonClick:function(){var r,f,u,t;for(r=this.model.showBrowseButton?this.diaObj.wrapper:this.dragWrapper,t=r.find(".e-ul li.e-upload-file"),i=0;i<t.length;i++)f=n(this),u=this._isFileUpload(t[i]),u&&this._xhrPerformUpload(n(t[i]).data("file"))},_xhrOnRemove:function(t,i){var u=n(i).find(".e-file-name").text().toString().split(","),r=this;n.ajax({url:this.model.removeUrl,type:"POST",data:"fileNames="+u,success:function(){n(i).remove();r._fileListRemove();r._trigger("remove",{fileStatus:r._file})}});this.upTooltip.hide()},_xhrOnCancel:function(t,i){var r,u;r=n(i).data("file");u=n(r).data("xhr");u&&n(r).data("xhr").abort();n(r).data("xhr",null);n(i).data("file",null);n(i).remove();this._uploadHide()},_xhrOnRetry:function(t,i){if(!this._currentElement.hasClass("e-disable")){var r=n(i).data("file");this._xhrPerformUpload(r)}},_onRequestSuccess:function(t,i,r){var u=n(r).data("xhr");u.status>=200&&u.status<=299?t._onXhrUploadSuccess(t,i,r):t._onRequestError(t,i,r);t._files.length==this._successFiles.length+this._errorFiles.length&&(t._trigger("complete",{files:r,responseText:u.responseText,success:this._successFiles,error:this._errorFiles,xhr:u,e:i}),this._onClearCompletedFiles())},_onClearCompletedFiles:function(){this._successFiles.length=this._errorFiles.length=0;this.model.dialogAction.closeOnComplete&&this._dialogclose()},_onXhrUploadSuccess:function(t,i,r){var u,f,o,s,e,h,c;u=n(r).data("filelist");f=n(r).data("xhr");t.model.removeUrl?(t._setAction(u,"remove"),t._setStatus(u,"success")):(u.find(".e-action-perform .e-icon,.e-file-percentage .e-icon").remove(),t._setStatus(u,"success"));n(r).length>0&&(o=n(u).find(".e-file-progress-status"),o.width("100%"),s=n(r)[0].size,e=this._formatSize(s),h=n(u).find(".e-file-size .e-file-name-txt"),h.html(e+"\\"+e));c={files:r,responseText:f.responseText,xhr:f,e:i};this.updialog.find(".e-file-upload .e-uploadclosebtn").html(this.model.buttonText.close).focus();t._trigger("success",c);this._successFiles.push(r)},_onRequestError:function(t,i,r){var f,u,e;f=n(r).data("filelist");u=n(r).data("xhr");t._setAction(f,"retry");t._setStatus(f,"failed");e={action:"File Processing",error:u.status?u.status+" "+u.statusText:"Unable to reach the server.",files:r,xhr:u,e:i};t._trigger("error",e);this._errorFiles.push(r)},_onRequestProgress:function(t,i,r){var u,f,e;u=Math.round(i.loaded*100/i.total);f=n(r).data("filelist");t._setProgress(f,u,i);t._setStatus(f,"progress");e={file:r,percentage:u,e:i};this._trigger("inProgress",e)},_createFormObjectXhr:function(n){var t=new FormData;return t.append(this.model.uploadName!=""?this.model.uploadName:this.control.id,n.rawFile),t},_getInputFileInfo:function(n){var t=n[0];return t.files?this._getAllFileInfo(t.files):[{name:this._GetName(t.value),extension:this._getFileExtensionType(t.value),size:this._getFileSizeinIE(t.value)}]},_getFileSizeinIE:function(n){var t,i;t=null;i=null;try{t=new ActiveXObject("Scripting.FileSystemObject")}catch(r){i=null}return t&&(i=t.getFile(n).size),i},_getFileExtensionType:function(n){return n.match?n.match(/\.([^\.]+)$/)?n.match(/\.([^\.]+)$/)[0]:"":""},_getAllFileInfo:function(t){var i=this;return n.map(t,function(n){return i._getFileInfo(n||t)})},_GetName:function(n){var t=n.lastIndexOf("\\");return t!=-1?n.substr(t+1):n},_getFileInfo:function(n){var t=n.name||n.fileName||n;return{name:t,extension:this._getFileExtensionType(t),size:n.size||n.fileSize,rawFile:n}},_formatSize:function(n){var t=-1;if(!n)return"0.0KB";do n=n/1024,t++;while(n>99);return Math.max(n,0).toFixed(1)+["KB","MB","GB","TB","PB","EB"][t]},_onSelectIFrame:function(t){var r,u,i,f;r=n(t.target);u=this._getInputFileInfo(r);i=this._beforeUploadIFrame(u);f=i.data("iframe");this.model.autoUpload?this._performUploadIFrame(i):this._showUploadButton();this._off(this.inputupload,"change");this._bindInputChangeEvent()},_onRemoveIFrame:function(t,i){var u,f,r,e;u=i.data("iframe");e=n(i).data("file");f=e[0].name;r=this;u?(this._removeFileEntry(i),this.model.removeUrl&&n.ajax({url:this.model.removeUrl,type:"POST",data:"fileNames="+f,success:function(){r._fileListRemove();r._trigger("remove",{fileStatus:r._file})}})):(this._removeFileEntry(i),this._trigger("remove",{fileStatus:this._file}))},_onCancelIFrame:function(n,t){var i;this._trigger("cancel",{Status:t});i=t.data("iframe");i&&(this._removeFileEntry(t),typeof i.stop!="undefined"?i.stop():i.document&&(i.document.execCommand("Stop"),i.contentWindow.location.href=i.contentWindow.location.href),this._processServerResponse(i,""));this._uploadHide()},_onRetryIFrame:function(n,t){this._performUploadIFrame(t)},_beforeUploadIFrame:function(n){var t,r,i;return t=this._createFrame(this.control.id+"_Iframe"+this.Uploadframes.length),this.Uploadframes.push(t),r=this._createForm(this.model.saveUrl,t[0].id),this._currentElement.find("input.e-uploadinput").removeClass("e-uploadinput").css("display","none").appendTo(r),this._createInputandBind(),i=this._pushFile(n,{iframe:t,form:r,file:n}),t.data({filelist:i}),this._setAction(i,"cancel"),i},_performUploadIFrame:function(t){var e,r,i,u,f;if(u={files:t},this._trigger("begin",u)){this._failureIframeUpload(t,"File upload has been denied");return}e=t.data("file");this._setStatus(t,"uploading");r=t.data("iframe");i=t.data("form");f=n("<input>").attr("name",(this.model.uploadName&&this.model.uploadName!=""?this.model.uploadName:this.control.id)+"_data").attr("type","hidden").val(JSON.stringify(u.data));i.append(f);r.appendTo(document.body);i.appendTo(document.body);this._on(r,"load",this._removeFramesIFrame);i.submit()},_onUploadButtonClickIFrame:function(){var t,i,r;t=this;n(".e-ul li.e-upload-file",t.updialog).each(function(){i=n(this);r=t._isFileUpload(i);r&&t._performUploadIFrame(i)})},_removeFramesIFrame:function(t){var u,i,r,f;u=n(t.target);f=this._files;r=u.data("filelist");try{i=n.trim(t.target.contentDocument.body.innerText.replace(/\n|\r/g," "))}catch(t){i="Server Error trying to get server response: "+t}i.substring(0,12)!="Server Error"&&i.indexOf("HTTP Error")!=0?(this._processServerResponse(u,i),this._setIframeProgress(r,100,t),this._setStatus(r,"progress"),this._successIframeUpload(r,i)):this._failureIframeUpload(r,i);r.length==this._successFiles.length+this._errorFiles.length&&(this._trigger("complete",{files:f,responseText:i,success:this._successFiles,error:this._errorFiles}),this._onClearCompletedFiles())},_setIframeProgress:function(t,i){var r;r=n(t).find(".e-file-progress-status");r.width(i+"%")},_successIframeUpload:function(n,t){fileEntry=n.data("file");this.model.removeUrl?(this._setAction(n,"remove"),this._setStatus(n,"success")):(n.find(".file-action").remove(),this._setStatus(n,"success"));args={files:fileEntry,responseText:t};this.updialog.find(".e-file-upload .e-uploadclosebtn").html(this.model.buttonText.close).focus();this._trigger("success",args);this._successFiles.push(fileEntry)},_failureIframeUpload:function(n,t){fileEntry=n.data("file");this.model.saveUrl&&t!="File upload has been denied"?(this._setAction(n,"retry"),this._setStatus(n,"failed")):(n.find(".file-action").remove(),this._setStatus(n,"failed"));args=t.indexOf("HTTP Error")==0?{files:fileEntry,responseText:t,status:t.match(/\d+/).toString()}:{files:fileEntry,responseText:t};this._trigger("error",args);this._errorFiles.push(fileEntry)},_processServerResponse:function(t){var i;i=n(document.body).find("form[target='"+n(t).attr("id")+"']");setTimeout(function(){i.remove();t.remove()},0)},_createDivBlock:function(n){return t.buildTag("div."+n)},_createForm:function(n,i){return t.buildTag("form","",{},{enctype:"multipart/form-data",method:"POST",action:n,target:i})},_createFrame:function(n){return t.buildTag("iframe#"+n,"",{display:"none"},{name:n})},_createInput:function(n){return t.buildTag("input","",{},{type:"file",name:n,"data-role":"none"})},_initObjectsSyncUpload:function(){this._currentElement.closest("form").attr("enctype","multipart/form-data").attr("encoding","multipart/form-data");this._wireEventsSyncUpload()},_wireEventsSyncUpload:function(){var t=this._currentElement.closest("form")[0];this._on(n(t),"submit",this._formSubmitSyncUpload);this._on(n(t),"reset",this._formResetSyncUpload)},_onSelectSyncUpload:function(t){var i,r,u;i=n(t.target);r=n(".e-selectpart",this.control);this._currentElement.find("input.e-uploadinput").removeClass("e-uploadinput").css("display","none").appendTo(r);this._createInputandBind();u=this._pushFile(this._files,{file:this._files,Input:i})},_onCancelSyncUpload:function(n,t){var i=t.data("Input");t.data("file",null);t.data("Input",null);t.remove();i.remove();this._uploadHide()},_formSubmitSyncUpload:function(){var t,i;t=n(".e-uploadinput",this.control);t.attr("name","");i=this.model.uploadName!=""?this.model.uploadName:this.control.id;setTimeout(function(){t.attr("name",i)},0)},_formResetSyncUpload:function(){n(".e-selectpart",this.control).children('input[type="file"]').each(function(){n(this).hasClass("e-uploadinput")||n(this).remove()})}});t.Uploadbox.Locale=t.Uploadbox.Locale||{};t.Uploadbox.Locale["default"]=t.Uploadbox.Locale["en-US"]={buttonText:{upload:"Upload",browse:"Browse",cancel:"Cancel",close:"Close"},dialogText:{title:"Upload Box",name:"Name",size:"Size",status:"Status"},dropAreaText:"Drop files or click to upload",filedetail:"The selected file size is too large. Please select a file within #fileSize",denyError:"Files with #Extension extensions are not allowed.",allowError:"Only files with #Extension extensions are allowed.",cancelToolTip:"Cancel",removeToolTip:"Remove",retryToolTip:"Retry",completedToolTip:"Completed",failedToolTip:"Failed",closeToolTip:"Close"}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejRTE","ej.RTE",{element:null,model:null,_rootCSS:"e-rte",validTags:["textarea"],_addOnPersist:["value","height","width"],_setFirst:!1,_requiresID:!0,_operationHandler:null,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{allowEditing:!0,isResponsive:!1,allowKeyboardNavigation:!0,enableTabKeyNavigation:!0,cssClass:"",height:"370",width:"786",enabled:!0,htmlAttributes:null,externalCSS:null,enableXHTML:!1,importSettings:{url:""},exportToPdfSettings:{url:"",fileName:"PdfExport"},exportToWordSettings:{url:"",fileName:"WordExport"},validationRules:null,validationMessage:null,maxLength:7e3,minWidth:"400",maxWidth:null,minHeight:"280",maxHeight:null,showToolbar:!0,showFooter:!1,showHtmlSource:!1,showWordCount:!0,showCharCount:!0,showHtmlTagInfo:!0,showClearAll:!1,iframeAttributes:null,showClearFormat:!0,showContextMenu:!0,showFontOption:!0,autoFocus:!1,enableHtmlEncode:!1,showDimensions:!1,showRoundedCorner:!1,locale:"en-US",name:"",pasteCleanupSettings:{listConversion:!1,cleanCSS:!1,removeStyles:!1,cleanElements:!1},toolbarOverflowMode:"popup",tools:{formatStyle:["format"],edit:[],style:["bold","italic","underline","strikethrough"],alignment:["justifyLeft","justifyCenter","justifyRight","justifyFull"],lists:["unorderedList","orderedList"],indenting:["outdent","indent"],doAction:["undo","redo"],links:["createLink","removeLink"],images:["image"],media:["video"],tables:["createTable","addRowAbove","addRowBelow","addColumnLeft","addColumnRight","deleteRow","deleteColumn","deleteTable"],view:["fullScreen"],customTools:[],print:[],customOrderList:[],customUnOrderList:[],font:[],clipboard:[],clear:[],effects:[],casing:[],importExport:[]},tooltipSettings:{associate:"mouseenter",showShadow:!0,position:{stem:{horizontal:"left",vertical:"top"}},tip:{size:{width:5,height:5}},isBalloon:!1},toolsList:["formatStyle","font","style","effects","alignment","lists","indenting","clipboard","doAction","clear","links","images","media","tables","casing","customTools","view","print","edit","importExport"],colorCode:["000000","FFFFFF","C4C4C4","ADADAD","595959","262626","4f81bd","dbe5f1","b8cce4","95b3d7","366092","244061","c0504d","f2dcdb","e5b9b7","d99694","953734","632423","9bbb59","ebf1dd","d7e3bc","c3d69b","76923c","4f6128","8064a2","e5e0ec","ccc1d9","b2a2c7","5f497a","3f3151","f79646","fdeada","fbd5b5","fac08f","e36c09","974806"],format:[{text:"Paragraph",value:"<p>",spriteCssClass:"e-paragraph"},{text:"Quotation",value:"<blockquote>",spriteCssClass:"e-quotation"},{text:"Heading 1",value:"<h1>",spriteCssClass:"e-h1"},{text:"Heading 2",value:"<h2>",spriteCssClass:"e-h2"},{text:"Heading 3",value:"<h3>",spriteCssClass:"e-h3"},{text:"Heading 4",value:"<h4>",spriteCssClass:"e-h4"},{text:"Heading 5",value:"<h5>",spriteCssClass:"e-h5"},{text:"Heading 6",value:"<h6>",spriteCssClass:"e-h6"}],fontName:[{text:"Segoe UI",value:"Segoe UI"},{text:"Arial",value:"Arial,Helvetica,sans-serif"},{text:"Courier New",value:"Courier New,Courier,monospace"},{text:"Georgia",value:"Georgia,serif"},{text:"Impact",value:"Impact,Charcoal,sans-serif"},{text:"Lucida Console",value:"Lucida Console,Monaco,monospace"},{text:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{text:"Times New Roman",value:"Times New Roman,Times,serif"},{text:"Trebuchet MS",value:"Trebuchet MS,Helvetica,sans-serif"},{text:"Verdana",value:"Verdana,Geneva,sans-serif"}],fontSize:[{text:"1 (8pt)",value:"8pt"},{text:"2 (10pt)",value:"10pt"},{text:"3 (12pt)",value:"12pt"},{text:"4 (14pt)",value:"14pt"},{text:"5 (18pt)",value:"18pt"},{text:"6 (24pt)",value:"24pt"},{text:"7 (36pt)",value:"36pt"}],tableRows:8,tableColumns:10,colorPaletteRows:6,colorPaletteColumns:6,showCustomTable:!0,value:null,undoStackLimit:50,enableResize:!0,enablePersistence:!1,enableRTL:!1,autoHeight:!1,zoomStep:"0.05",imageBrowser:{filePath:"",extensionAllow:"*.png,*.gif,*.jpg,*.jpeg",ajaxAction:"",ajaxSettings:""},fileBrowser:{filePath:"",extensionAllow:"*.doc,*.docx,*.pdf,*.txt",ajaxAction:""},change:null,execute:null,keydown:null,keyup:null,create:null,destroy:null,contextMenuClick:null,preRender:null,select:null},dataTypes:{enabled:"boolean",autoFocus:"boolean",enableHtmlEncode:"boolean",autoHeight:"boolean",enableXHTML:"boolean",isResponsive:"boolean",enablePersistence:"boolean",showRoundedCorner:"boolean",showCustomTable:"boolean",enableResize:"boolean",importSettings:{url:"string"},exportToPdfSettings:{url:"string",fileName:"string"},exportToWordSettings:{url:"string",fileName:"string"},pasteCleanupSettings:{listConversion:"boolean",cleanCSS:"boolean",removeStyles:"boolean",cleanElements:"boolean"},showDimensions:"boolean",showFontOption:"boolean",showClearFormat:"boolean",showClearAll:"boolean",showHtmlTagInfo:"boolean",showWordCount:"boolean",showCharCount:"boolean",showHtmlSource:"boolean",allowKeyboardNavigation:"boolean",enableTabKeyNavigation:"boolean",allowEditing:"boolean",showToolbar:"boolean",showFooter:"boolean",showContextMenu:"boolean",enableRTL:"boolean",toolsList:"array",colorCode:"array",toolbarOverflowMode:"enum",format:"data",fontName:"data",fontSize:"data",htmlAttributes:"data",iframeAttributes:"data",tools:{formatStyle:"array",font:"array",edit:"array",style:"array",effects:"array",alignment:"array",lists:"array",indenting:"array",clipboard:"array",doAction:"array",clear:"array",links:"array",media:"array",images:"array",tables:"array",casing:"array",customTools:"array",view:"array",print:"array",importExport:"array",customOrderList:"array",customUnOrderList:"array"}},_rteIconsList:{format:"format",bold:"e-bold_01",italic:"e-italic_01",underline:"e-underline_01",strikethrough:"e-strikethrough_01",justifyLeft:"e-align-left_01",justifyCenter:"e-align-center_01",justifyRight:"e-align-right_01",justifyFull:"e-align-justify_01",unorderedList:"e-bullets_01",orderedList:"orderedList",outdent:"outdent",indent:"indent",undo:"undo",redo:"redo",createLink:"e-link_01",removeLink:"e-unlink_01",image:"e-image",video:"e-video",createTable:"e-table_02",addRowAbove:"e-insert-row-above_02",addRowBelow:"e-insert-row-below_02",addColumnLeft:"e-insert-column-left_02",addColumnRight:"e-insert-column-right_02",deleteRow:"e-delete-row_01",deleteColumn:"e-delete-column_01",deleteTable:"deleteTable",fullScreen:"fullScreen",superscript:"e-superscript_01",subscript:"e-subscript_01",upperCase:"e-uppercase_01",lowerCase:"e-lowercase_01",zoomIn:"e-zoom-in",zoomOut:"e-zoom-out",print:"print","import":"e-upload",wordExport:"e-icon e-word-export",pdfExport:"e-icon e-pdf-export",findAndReplace:"findAndReplace",cut:"e-cut_01",copy:"e-copy_02",paste:"e-paste_01",clearFormat:"clearFormat",clearAll:"e-delete_05",fontName:"fontName",fontSize:"fontSize",fontColor:"e-font",backgroundColor:"e-background-color",rteResize:"e-resize-handle",rteSource:"e-file-code",customTableImage:"e-table",resize:"e-full-screen-collapse_01",maximize:"e-full-screen-expand_01",openLink:"",deleteTables:"",insertTable:"",tableProperties:"",imageProperties:""},observables:["value"],value:t.util.valueFunction("value"),_setModel:function(i){var r,f,e,s,c,h,u,o;this._isInteraction=!1;for(r in i){switch(r){case"allowEditing":this._enableEdit(i[r]);break;case"autoFocus ":this.model.autoFocus=i[r];i[r]&&this._focus();break;case"showToolbar":i[r]?t.isNullOrUndefined(this._rteToolbar)?this._renderToolBar():(this._rteToolbar.show(),this.model.isResponsive&&this._toolBarObj._reSizeHandler()):this._rteToolbar.hide();break;case"showFooter":this.model.showFooter=i[r];i[r]?t.isNullOrUndefined(this._rteFooter)?this._renderFooter():this._rteFooter.show():this._rteFooter.hide();break;case"pasteCleanupSettings":this.model.pasteCleanupSettings=i[r];t.clipboardCleaner&&(this._pasteCleaner||this._enableContentCleaner(),this._pasteCleaner&&(this._pasteCleaner.filterOptions=i[r]));case"isResponsive":this.model.isResponsive=i[r];this._renderToolBarList();f=n(this._rteIframe).outerHeight();e=n(this._rteToolbar).outerHeight();n(this._rteWapper).height(f+e);t.isNullOrUndefined(n(this._rteFooter))||(s=n(this._rteFooter).outerHeight(),n(this._rteWapper).height(f+s+e));break;case"enabled":this._disabled(i[r]);break;case"height":this.model.height=i[r];this._rteWapper.height(i[r]);break;case"width":this.model.height=i[r];this._rteWapper.css("width",i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"showHtmlSource":this._footerElement("div.e-rte-source",i[r]);break;case"showHtmlTagInfo":this._footerElement("div.e-rte-htmltaginfo",i[r]);break;case"showWordCount":this.model.showWordCount=i[r];this._createCountElement(i[r],this._wordCount);break;case"showCharCount":this.model.showCharCount=i[r];this._createCountElement(i[r],this._charCount);break;case"tooltipSettings":this.model.tooltipSettings=n.extend(!0,this.model.tooltipSettings,i[r]);this.model.showToolbar&&this._toolBarItems.ejToolbar("option","tooltipSettings",i[r]);this._renderTooltip(this.model.tooltipSettings);break;case"showClearAll":this._footerElement("div.clearAll",i[r]);break;case"showClearFormat":this._footerElement("div.clearFormat",i[r]);break;case"enableResize":this._footerElement("div.e-rte-resize",i[r]);break;case"fontName":this._fontStyleDDL.ejDropDownList({dataSource:i[r]});break;case"fontSize":this._fontSizeDDL.ejDropDownList({dataSource:i[r]});break;case"format":this._formatDDL.ejDropDownList({dataSource:i[r]});break;case"value":t.isPlainObject(i[r])&&(i[r]=null);this._getDocument().body.innerHTML=t.util.getVal(i[r]);c={text:this._getText(),htmlText:this.getHtml()};this._onChange();break;case"showDimensions":i[r]?(this._imgDialog.find("div.e-rte-imgdimensions").show(),this._imgDialog.find("div.e-rte-videoDimensions").show()):(this._imgDialog.find("div.e-rte-imgdimensions").hide(),this._imgDialog.find("div.e-rte-videoDimensions").hide());break;case"showFontOption":i[r]?this._rteWapper.find("ul.e-rte-fontgroup").show():this._rteWapper.find("ul.e-rte-fontgroup").hide();break;case"locale":this.model.locale=i[r];h=this.model;this.element.ejRTE("destroy").ejRTE(h);break;case"importSettings":this.model.importSettings=n.extend(!0,this.model.importSettings,i[r]);break;case"exportToPdfSettings":this.model.exportToPdfSettings=n.extend(!0,this.model.exportToPdfSettings,i[r]);break;case"exportToWordSettings":this.model.exportToWordSettings=n.extend(!0,this.model.exportToWordSettings,i[r]);break;case"tableRows":this.model.tableRows=i[r];u=this._createTable.find("div.e-rte-table").html("");this._drawTable(u);break;case"iframeAttributes":this._updateIframeSkin(i[r]);break;case"tableColumns":this.model.tableColumns=i[r];u=this._createTable.find("div.e-rte-table").html("");this._drawTable(u);break;case"showCustomTable":o=this._createTable.find("div.customtable-group");i[r]?t.isNullOrUndefined(this._customTableDialog)?this._createCustomTable():o.show():o.hide();break;case"colorPaletteRows":this.model.colorPaletteRows=i[r];this._updateColorPalette();break;case"colorPaletteColumns":this.model.colorPaletteColumns=i[r];this._updateColorPalette();break;case"colorCode":this.model.colorCode=i[r];this._updateColorPalette();break;case"name":this.model.name=i[r];this._checkNameAttr();break;case"showContextMenu":this.model.showContextMenu=i[r];this._showHideContextMenu();break;case"enableRTL":this._enableRTL(i[r]);break;case"htmlAttributes":this._addAttr(i[r]);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"validationRules":this.element.closest("form").length!=0&&(this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null),this.model.validationRules=i[r],this.model.validationRules!=null&&(this._initValidator(),this._setValidation()));break;case"validationMessage":this.element.closest("form").length!=0&&(this.model.validationMessage=i[r],this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation()));break;case"autoHeight":this.model.autoHeight=i[r];this._setAutoHeight()}r!="locale"&&this._setIframeHeight()}this._updateCount()},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.RTE",this.model.locale)},_enableContentCleaner:function(){t.clipboardCleaner&&!this._isIE8()&&(this._pasteCleaner||(this._pasteCleaner=new t.clipboardCleaner(this._getDocument(),this._iframePaste,this)),this._pasteCleaner.filterOptions=this.model.pasteCleanupSettings)},_init:function(){t.isNullOrUndefined(this.element)||this.element[0].type!="textarea"||(this._updateLocalConstant(),this.element.hide(),this._initialize()._render(),this.model.allowEditing&&this._wireEvents(),this.model.pasteCleanupSettings&&(this.model.pasteCleanupSettings.cleanElements||this.model.pasteCleanupSettings.removeStyles||this.model.pasteCleanupSettings.cleanCSS||this.model.pasteCleanupSettings.listConversion)&&this._enableContentCleaner(),this._updateIframeSkin(this.model.iframeAttributes),this.model.enabled==!1&&this._disabled(this.model.enabled),this._addAttr(this.model.htmlAttributes),this.model.autoFocus&&(this._focus(),this._updateToolbarStatus(),this._updateFontOptionStatus(),this._updateFormat()),this.model.enableHtmlEncode&&this.value(this._encode(this._decode(this.value()))),this.model.showToolbar&&(this.disableToolbarItem("removeLink"),t.isNullOrUndefined(this._getWindow())||this._updateIndentStatus()),this.model.enableRTL&&this._enableRTL(!0),this.model.externalCSS&&this._addCssToIframe(this.model.externalCSS),this.wrapper=this._rteWapper,this.model.validationRules!=null&&(this._initValidator(),this._setValidation()),this.model.showContextMenu&&this._showHideContextMenu(),this._isInteraction=!0)},_hideContextMenuByItem:function(t){for(index1=0;index1<n(this._textMenuObj.element).children("li").length;index1++)n.inArray(n(n(this._textMenuObj.element).children("li")[index1]).attr("id"),t)!=-1?n(n(this._textMenuObj.element).children("li")[index1]).show():n(n(this._textMenuObj.element).children("li")[index1]).hide()},_filterMenuItems:function(i){var r=this._isIE()?this._currentSelNode:this._getSelectedNode(),u=this._saveSelection().commonAncestorContainer;t.isNullOrUndefined(r)||t.isNullOrUndefined(r.tagName)||r.tagName.toLowerCase()!=="img"&&i.target.tagName.toLowerCase()!="img"?!t.isNullOrUndefined(r)&&n(r).closest("table").length?(this._hideContextMenuByItem(n(r).closest("a").length?this._contextType.table_hyper:this._contextType.table),this._contextValidation(u,i)):!t.isNullOrUndefined(r)&&n(r).closest("a").length?(this._hideContextMenuByItem(this._contextType.hyperlink),this._contextValidation(u,i)):this._isIE8()?(this._hideContextMenuByItem(this._contextType.text),this._updateContextMenuItemState(this._getRange().text!=="")):(this._hideContextMenuByItem(this._contextType.text),this._contextValidation(u,i)):(this._hideContextMenuByItem(this._contextType.image),this._updateContextMenuItemState(!0));this._rteIframe.contents().find("body").addClass("e-cursor")},_contextmenuPosition:function(t){var u=(t.clientX==r?0:t.clientX)+this._rteWapper.offset().left,i=(t.clientY==r?0:t.clientY)+this._rteWapper.offset().top+(this._rteToolbar?this._rteToolbar.outerHeight():0),f=n(this._textMenuObj.element).attr("style","visibility: visible;display:block;").height(),e=n(this._textMenuObj.element).width();i=i+f<n(document).scrollTop()+n(window).height()?i:i-f<0?i:i-f;u=u+e<n(document).scrollLeft()+n(window).width()?u:u-e;n(this._textMenuObj.element).attr("style","width:auto;left:"+u+"px;top:"+i+"px;z-index:"+(this._onGetMaxZindex()+1)).focus()},_contextValidation:function(n){this._updateContextMenuItemState(n&&(data=n.nodeValue?n.nodeValue:n.textContent)&&(this._saveSelection().endContainer==this._saveSelection().startContainer?data.substring(this._saveSelection().startOffset,this._saveSelection().endOffset)!=="":!0))},_updateContextMenuItemState:function(n){n?(this._textMenuObj.enableItemByID("cut"),this._textMenuObj.enableItemByID("copy")):(this._textMenuObj.disableItemByID("cut"),this._textMenuObj.disableItemByID("copy"))},_contextMenuClick:function(i){var f=i.ID?i.ID.toLowerCase():n(i.element).attr("id").toLowerCase(),u;this._isIE()&&this._ieSelectionRange&&this.selectRange(this._ieSelectionRange);switch(f){case"cut":!this._isIE()&&this._getValidbrowser(t.browserInfo().name)?this._openAlert(this._getLocalizedLabels("cutAlert")):this._getDocument().execCommand(f,!1,r);this._imgOrg&&this._imgDupDiv&&this._imgBoxMouseMove&&(n(this._imgOrg).css("outline",""),n(this._imgDupDiv).remove(),this._off(n(this._getDocument()),"mousemove",this._imgBoxMouseMove));this._updateCursor();break;case"copy":!this._isIE()&&this._getValidbrowser(t.browserInfo().name)?this._openAlert(this._getLocalizedLabels("copyAlert")):this._getDocument().execCommand(f,!1,r);this.selectRange(this._getRange());break;case"paste":this._isIE()?this._getDocument().execCommand(f,!1,r):this._openAlert(this._getLocalizedLabels("pasteAlert"));break;case"openlink":this._onOpen();break;case"createlink":this._linkDialog||this._renderLinkDialog();this._hyperLinkManager(!1);break;case"imageproperties":this._imgDialog||this._renderImageDialog();this._imageManager();break;case"addcolumnleft":u=this.insertColumn(!0,this._currentSelNode);this._updateCursor(u);break;case"addcolumnright":u=this.insertColumn(!1,this._currentSelNode);this._updateCursor(u);break;case"addrowabove":u=this.insertRow(!0,this._currentSelNode);this._updateCursor(u);break;case"addrowbelow":u=this.insertRow(!1,this._currentSelNode);this._updateCursor(u);break;case"deleterow":this.removeRow(this._currentSelNode);break;case"deletecolumn":this.removeColumn(this._currentSelNode);break;case"deletetable":this.removeTable(n(this._currentSelNode).closest("table"));break;case"tableproperties":this._eTblDialog||this._renderEditTableDialog();this._eTblManager();this._eTblDialog.ejDialog("open");break;case"removelink":this._onUnlink()}this._trigger("contextMenuClick",{event:i});this._onChange()},_updateCursor:function(n,t){if(!this._isIE8()){var i=this._getDocument().createRange(),r=this._getRange();n?this._setRange(n,r,!0):t?(i.setStart(t.startContainer,t.startOffset),i.setEnd(t.endContainer,t.endOffset),this.selectRange(i)):(i.setStart(r.startContainer,r.startOffset),i.setEnd(r.startContainer,r.startOffset),this.selectRange(i))}},_loadRules:function(){jQuery.validator.addMethod("contentRequired",function(t,i){return n.trim(n(i).data("ejRTE")._getText())},"Please specify the value.");jQuery.validator.addMethod("maxWordCount",function(t,i,r){return n.trim(n(i).data("ejRTE")._getText()).split(/\W+/).length<=r},"Please enter the content with in max word count.");jQuery.validator.addMethod("minWordCount",function(t,i,r){return n.trim(n(i).data("ejRTE")._getText()).split(/\W+/).length>=r},"Please enter the content with min word count.");jQuery.validator.addMethod("minCharCount",function(t,i,r){return n(i).data("ejRTE")._getText().length>=r},"Please enter the content with min length.");jQuery.validator.addMethod("maxCharCount",function(t,i,r){return n(i).data("ejRTE")._getText().length<=r},"Please enter the content with in max length.");this._customRules={required:"contentRequired",maxWordCount:"maxWordCount",minWordCount:"minWordCount",maxlength:"maxCharCount",minlength:"minCharCount",equalTo:"equalTo"}},_initValidator:function(){this._loadRules();this.element.closest("form").data("validator")||this.element.closest("form").validate()},_getRuleData:function(n,t){var i=null;switch(n){case"contentRequired":i={contentRequired:t};break;case"minCharCount":i={minCharCount:t};break;case"maxCharCount":i={maxCharCount:t};break;case"maxWordCount":i={maxWordCount:t};break;case"minWordCount":i={minWordCount:t};break;case"equalTo":i={equalTo:t}}return i},_setValidation:function(){var f,i,o,e,r,u,s;if(this.element.closest("form").length!=0){f=this.element.closest("form").validate();e=this.element.attr("name");f.settings.messages[e]={};for(r in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[r])&&this._customRules[r]){if(i=this._customRules[r],o=this.model.validationRules[r],this.element.rules("add",this._getRuleData(i,o)),t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){f.settings.messages[e][i]=n.validator.messages[i];for(s in this.model.validationMessage)r==s?u=this.model.validationMessage[r]:""}else u=this.model.validationRules.messages[i];f.settings.messages[e][i]=u!=null?u:n.validator.messages[i]}}},_addAttr:function(t){if(t!=null){var i=this;n.map(t,function(n,t){t=="class"?i._rteWapper.addClass(n):t=="name"?i.element.attr(t,n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i.disable():t=="readOnly"&&n=="readOnly"?i._enableEdit(!1):i._rteWapper.attr(t,n)})}},_addCssToIframe:function(t){for(var i,u=n.isArray(t)?t:t.split(","),r=0;r<u.length;r++)i=document.createElement("link"),i.href=u[r],i.rel="stylesheet",i.type="text/css",this._rteIframe.contents().find("head").append(i)},_disabled:function(n){n!=!0?this.disable():this.enable()},_destroy:function(){this.element.insertBefore(this._rteWapper);t.isNullOrUndefined(this._tooltip)||n(this._rteFooter).ejTooltip("destroy");t.isNullOrUndefined(this._formatDDL)||this._formatDDL.ejDropDownList("destroy");t.isNullOrUndefined(this._fontStyleDDL)||this._fontStyleDDL.ejDropDownList("destroy");t.isNullOrUndefined(this._fontSizeDDL)||this._fontSizeDDL.ejDropDownList("destroy");t.isNullOrUndefined(this._fontColorSplit)||this._fontColorSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._bgColorSplit)||this._bgColorSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._unOrderSplit)||this._unOrderSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._orderSplit)||this._orderSplit.ejSplitButton("destroy");t.isNullOrUndefined(this._customTableDialog)||(t.isNullOrUndefined(this._customTableDialog.find(".e-rte-ddlAlignment"))||this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("destroy"),t.isNullOrUndefined(this._customTableDialog.find(".e-rte-txtBorder"))||this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("destroy"));t.isNullOrUndefined(this._linkDialog)||n(this._linkDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._imgDialog)||(this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList("destroy"),n(this._imgDialog).closest("div.e-rte.e-dialog-wrap").remove());t.isNullOrUndefined(this._videoDialog)||n(this._videoDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._createTable)||n(this._createTable).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._sourceDialog)||n(this._sourceDialog).closest("div.e-dialog-wrap").remove();t.isNullOrUndefined(this._customColor)||n(this._customColor).closest("div.e-dialog-wrap").remove();t.isNullOrUndefined(this._customTableDialog)||n(this._customTableDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._customTableDialog)||n(this._customTableDialog).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._alertWindow)||n(this._alertWindow).closest("div.e-rte.e-dialog-wrap").remove();t.isNullOrUndefined(this._eTblDialog)||(this._eTblDialog.find(".e-rte-dropdown").ejDropDownList("destroy"),n(this._eTblDialog).closest("div.e-rte.e-dialog-wrap").remove());t.isNullOrUndefined(this._explorerObj)||this._explorerObj.destroy();t.isNullOrUndefined(this._imgPicker)||this._imgPicker.destroy();t.isNullOrUndefined(this._tblborderPicker)||this._tblborderPicker.destroy();t.isNullOrUndefined(this._fileDialog)||n(this._fileDialog).closest("div.e-rte.e-dialog-wrap").remove();this._textMenuObj&&this._textMenuObj.destroy();this._toolBarObj&&this._toolBarObj.destroy();this._rteWapper.remove();n("#"+this._rteId+"customcolor_popup").length>0&&n("#"+this._rteId+"customcolor_popup").remove();n("#"+this._rteId+"customcolor_Presets").length>0&&n("#"+this._rteId+"customcolor_Presets").remove();this.element.show();this.element.focus();this._createTable=null;this._unwireEvents()},_initialize:function(){return this._toolsList=this.model.toolsList,this._rteId=this.element[0].id,this._rteId=this._rteId?this._rteId:"",this._backupArray=[],this._undoRedoPosition=0,this._fontColor="#000000",this._bgColor="#ffffff",this._imgWidth=0,this._imgHeight=0,this._videoWidth=0,this._videoHeight=0,this._keypressFlag=!0,this._styleItems=t.isNullOrUndefined(this.model.tools.style)?[]:this.model.tools.style,this._alignItems=t.isNullOrUndefined(this.model.tools.alignment)?[]:this.model.tools.alignment,this._listItems=t.isNullOrUndefined(this.model.tools.lists)?[]:this.model.tools.lists,this._scriptsItems=t.isNullOrUndefined(this.model.tools.effects)?[]:this.model.tools.effects,this._contextMenu=["cut","copy","paste","|","insertTable",["addColumnLeft","addColumnRight","addRowAbove","addRowBelow"],"|","deleteTables",["deleteRow","deleteColumn","deleteTable"],"|","tableProperties","|","createLink","openLink","removeLink","imageProperties"],this._contextType={text:["cut","copy","paste","createLink"],image:["cut","copy","paste","imageProperties"],hyperlink:["cut","copy","paste","createLink","openLink","removeLink"],table:["cut","copy","paste","insertTable","deleteTables","tableProperties","createLink"],table_hyper:["cut","copy","paste","insertTable","deleteTables","tableProperties","createLink","openLink","removeLink"]},this},_render:function(){this._renderWrapper()._checkNameAttr();this.model.showToolbar&&this._renderToolBar();this._trigger("preRender",this.element);this._renderEditArea();this.model.showFooter&&this._renderFooter();this._setIframeHeight();this._rteWidth=this.model.width;this._rteHeight=this.model.height;this._renderAlertDialog();this._roundedCorner(this.model.showRoundedCorner)},_initContextMenu:function(){for(var r,t,i=[],n=0;n<this._contextMenu.length;n++)if(this._contextMenu[n]!="|")if(typeof this._contextMenu[n]=="object")for(r=n+1,t=0;t<this._contextMenu[n].length;t++)this._contextMenu[n][t]!="|"&&i.push({id:this._contextMenu[n][t],parentId:this._contextMenu[n-1],text:this._getLocalizedLabels(this._contextMenu[n][t]),sprite:"e-rte-toolbar-icon "+this._contextMenu[n][t]+" "+this._rteIconsList[this._contextMenu[n][t]],htmlAttr:this._contextMenu[n+1][t+1]=="|"?{"class":"e-rte-separator",id:this._contextMenu[n][t]}:{id:this._contextMenu[n][t]}});else i.push({id:this._contextMenu[n],parentId:null,text:this._getLocalizedLabels(this._contextMenu[n]),sprite:"e-rte-toolbar-icon "+this._contextMenu[n]+" "+this._rteIconsList[this._contextMenu[n]],htmlAttr:this._contextMenu[n+1]=="|"?{"class":"e-rte-separator",id:this._contextMenu[n]}:{id:this._contextMenu[n]}});return i},_createContextMenu:function(){var r=t.buildTag("ul.e-rte-context-menu #"+this._id+"_contextmenu"),i=this;return r.ejMenu({menuType:t.MenuType.ContextMenu,enableSeparator:!0,width:"auto",enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,contextMenuTarget:this._getDocument(),click:n.proxy(this._contextMenuClick,this),fields:{dataSource:this._initContextMenu(),id:"id",parentId:"parentId",text:"text",htmlAttribute:"htmlAttr",spriteCssClass:"sprite"},beforeOpen:function(t){i._isIE()&&i._ieSelectionRange&&i.selectRange(i._ieSelectionRange);i.model.enabled?this.enable():this.disable();i._filterMenuItems(i._contextMenuEventArgs=t.events);n(this.element).parent().hide()},open:function(){n(this.element).attr("style","visibility:visible;width:auto;display:block;left:0px;top:0px;");n(this.element).parent().show();i._contextmenuPosition(i._contextMenuEventArgs);this._showAnimation(this.element,this._showAnim);n(this.element).focus()},close:function(){n(i._getDocument()).find("body").removeClass("e-cursor")}}),r},_showHideContextMenu:function(){this.model.allowEditing&&this.model.enabled&&this.model.showContextMenu&&this._getDocument()?(this._textMenuObj=this._createContextMenu().data("ejMenu"),this._textMenuObj._off(n(this._textMenuObj.model.contextMenuTarget),"mouseup taphold",this._textMenuObj._ContextMenuHandler),this._textMenuObj._on(n(this._textMenuObj.model.contextMenuTarget),"mouseup",this._textMenuObj._ContextMenuHandler)):this._textMenuObj&&this._textMenuObj.destroy()},_checkNameAttr:function(){this.model.name?this.element.attr({name:this.model.name}):t.isNullOrUndefined(this.element.attr("name"))&&this.element.attr({name:this.element[0].id})},_enableEdit:function(n){this.model.allowEditing=n;n?(this._wireEvents(),this.model.showToolbar&&this._toolBarItems.ejToolbar("option","click",this._toolBarClick),this._rteIframe.contents().find("body").attr("contenteditable",!0)):(this._unwireEvents(),this.model.showToolbar&&this._toolBarItems.ejToolbar("option","click",null),this._rteIframe.contents().find("body").attr("contenteditable",!1));this._showHideContextMenu();this._disableResizeObj(n)},_disableResizeObj:function(i){i?this.model.enableRTL||this._on(n(this._getDocument()).find("table.e-rte-table"),"mouseover",this._tableMouseOver):(t.browserInfo().name==="mozilla"&&(this._getDocument().designMode="off"),this._off(n(this._getDocument()).find("table.e-rte-table"),"mouseover",this._tableMouseOver),this._removeResizeObject())},_changeSkin:function(n){this._rteWapper.removeClass(this.model.cssClass).addClass(n);this._subControlsSetModel("cssClass",n)},_updateIframeSkin:function(t){try{var i=this._rteIframe.contents().find("body");t&&(proxy=this,n.map(t,function(n,t){t=="class"?i.addClass(n):t=="required"?i.attr(t,n):t=="disabled"&&n=="disabled"?proxy.disable():t=="readOnly"&&n=="readOnly"?proxy._enableEdit(!1):i.attr(t,n)}))}catch(r){return!1}},_renderWrapper:function(){return this.model.minHeight.toString().indexOf("%")>0&&(this.model.minHeight=parseInt(this.model.height)*parseInt(this.model.minHeight)/100),!t.isNullOrUndefined(this.model.maxHeight)&&this.model.maxHeight.toString().indexOf("%")>0&&(this.model.maxHeight=parseInt(this.model.height)+parseInt(this.model.height)*parseInt(this.model.maxHeight)/100),this.model.minWidth.toString().indexOf("%")>0&&(this.model.minWidth=parseInt(this.model.width)*parseInt(this.model.minWidth)/100),!t.isNullOrUndefined(this.model.maxWidth)&&this.model.maxWidth.toString().indexOf("%")>0&&(this.model.maxWidth=parseInt(this.model.width)+parseInt(this.model.width)*parseInt(this.model.maxWidth)/100),this._rteWapper=t.buildTag("div.e-rte e-rte-wrapper e-widget e-box "+this.model.cssClass+"#"+this._rteId+"_wrapper","",{},{role:"presentation"}).insertBefore(this.element),this._rteWapper.css("height",this.model.height).css("width",this.model.width).css("min-height",this.model.minHeight).css("min-width",this.model.minWidth).css("max-height",this.model.maxHeight).css("max-width",this.model.maxWidth),this._rteWapper.append(this.element.hide()),this},_renderToolBar:function(){this._rteToolbar=t.buildTag("div.e-rte-toolbar #"+this._rteId+"_tools").insertAfter(this.element);this._crateToolbarTemplate()._initToolBarItems()._renderToolBarList();this._renderToolBarItems();t.isNullOrUndefined(this._explorerObj)||this._rteToolbar.find("li.e-rteItem-image").length>0&&this._explorerObj.setModel({showFooter:!1,showTreeview:!1});t.isNullOrUndefined(this._fileBrowserObj)||this._rteToolbar.find("li.e-rteItem-fileBrowser").length>0&&this._fileBrowserObj.setModel({showFooter:!1,showTreeview:!1});t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"&&this._toolBarObj.disableItemByID(this._rteId+"_video")},_renderToolBarList:function(){var t={};t.click=this.model.allowEditing?this._toolBarClick:null;t.cssClass=this.model.cssClass;t.enableRTL=this.model.enableRTL;t.enableSeparator=!0;this.model.toolbarOverflowMode=="inline"&&(t.responsiveType="inline");t.isResponsive=this.model.isResponsive;t.height=t.isResponsive?"":"auto";t.showRoundedCorner=this.model.showRoundedCorner;t.tooltipSettings=this.model.tooltipSettings;t.create=function(){var t=n(this.element).find(".e-ddl.e-widget .e-dropdownlist"),i=n(this.element).find(".e-split.e-widget .e-splitbutton");t.length&&t.ejDropDownList({height:"30px"});i.length&&i.ejSplitButton({height:"30px"})};this._toolBarItems.ejToolbar(t);this._disableTabkeyNavigation(this._toolBarItems)._disableTabkeyNavigation(this._toolBarItems.find("[tabindex],.e-split-btn"));this._toolBarObj=this._toolBarItems.ejToolbar("instance");this._on(n(document),"mouseup touchend",this._zoomUp);this._on(n(this._toolBarObj.itemsContainer).find(".e-rteItem-zoomIn , .e-rteItem-zoomOut"),"mousedown touchstart",this._zoomDown)},_disableTabkeyNavigation:function(t){return n(t).attr("tabindex","-1"),this},_crateToolbarTemplate:function(){var i,r,u;this._toolBarItems=t.buildTag("div#"+this._rteId+"_toolbar").appendTo(this._rteToolbar).height(30);for(i in this._toolsList)i=this._toolsList[i],t.isNullOrUndefined(this.model.tools[i])||(i=="customTools"?t.isNullOrUndefined(this.model.tools[i])||this._customTools(this.model.tools[i]):this.model.tools[i].length>0&&this._createToolsItems(this.model.tools[i],i));return this.model.fileBrowser.filePath!=""&&(r=t.buildTag("ul#"+this._rteId+"-file-exporer"),u=n("<li id='"+this._rteId+"_fileBrowser' class='e-rte-explorer e-rteItem-fileBrowser' title='"+this._getLocalizedLabels("fileBrowser")+"' ><div class='e-rte-toolbar-icon fileBrowser e-fileBrowser' unselectable = 'on'><\/div><\/li>"),u.appendTo(r),r.appendTo(this._toolBarItems)),this},_createToolsItems:function(i,r){var f=t.buildTag("ul#"+(this._rteId+"_"+r)),e,u;for(r=="font"&&f.addClass("e-rte-fontgroup"),r=="formatStyle"&&f.addClass("e-rte-format"),r=="lists"&&f.addClass("e-rte-lists"),u=0;u<i.length;u++)e=n("<li id='"+(this._rteId+"_"+i[u].replace(/ /g,""))+"' class='e-rteItem-"+i[u]+"' ><div class='e-rte-toolbar-icon "+i[u]+" "+this._rteIconsList[i[u]]+"' unselectable = 'on'><\/div><\/li>"),i[u]==="video"&&t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"?e.attr("title",this._getLocalizedLabels("html5Support")):e.attr("title",this._getLocalizedLabels(i[u].replace(/ /g,""))),i[u]==="fullScreen"?e.attr("data-content",this._getLocalizedLabels("maximize")).children(".e-rte-toolbar-icon").addClass(this._rteIconsList.maximize):i[u]==="findAndReplace"&&e.attr("title",this._getLocalizedLabels("FindAndReplace")),e.appendTo(f);f.appendTo(this._toolBarItems);r!="font"||this.model.showFontOption||f.hide()},_customTools:function(i){for(var e,f,u,r=0;r<i.length;r++)e=t.buildTag("ul"),f=n("<li id='"+i[r].name+"' title='"+i[r].tooltip+"' ><div class='"+(t.isNullOrUndefined(i[r].css)?"":i[r].css)+"'>"+(t.isNullOrUndefined(i[r].text)?"":i[r].text)+"<\/div><\/li>"),u=i[r].action,typeof u=="string"&&(u=t.util.getObject(u,window)),t.isNullOrUndefined(i[r].action)||this._on(f,"click",u),n(i[r].template).appendTo(f.find("div")),f.appendTo(e),e.appendTo(this._toolBarItems)},_initToolBarItems:function(){return this._rteToolbar.find("li.e-rteItem-format").length>0&&this._renderFormat(),this._rteToolbar.find("li.e-rteItem-createLink").length>0&&this._renderLinkDialog(),this._rteToolbar.find("li.e-rteItem-video").length>0&&this._renderVideoDialog(),this._rteToolbar.find("li.e-rteItem-image").length>0&&this._renderImageDialog(),this._rteToolbar.find("li.e-rteItem-createTable").length>0&&this._renderTableDialog(),this._rteToolbar.find("li.e-rteItem-fontName").length>0&&this._renderFontStyle(),this._rteToolbar.find("li.e-rteItem-fontSize").length>0&&this._renderFontSize(),this._rteToolbar.find("li.e-rteItem-fontColor").length>0&&this._renderFontColor(),this._rteToolbar.find("li.e-rteItem-backgroundColor").length>0&&this._renderBGColor(),this._rteToolbar.find("li.e-rteItem-createTable").length>0&&this._renderEditTableDialog(),this._rteToolbar.find("li.e-rteItem-fileBrowser").length>0&&this._renderFileBrowserDialog(),this._rteToolbar.find("li.e-rteItem-unorderedList").length>0&&this._renderUnOrderList(),this._rteToolbar.find("li.e-rteItem-orderedList").length>0&&this._renderOrderList(),this._rteToolbar.find("li.e-rteItem-import").length>0&&this._renderimport(),this.model.showClearAll||this._rteToolbar.find("li.e-rteItem-clearAll").hide(),this},_renderToolBarItems:function(){this._toolBarObj.disableItemByID(this._rteId+"_undo");this._toolBarObj.disableItemByID(this._rteId+"_redo");this.model.enableRTL?this._toolBarObj.selectItemByID(this._rteId+"_justifyRight"):this._toolBarObj.selectItemByID(this._rteId+"_justifyLeft");var n=this._rteToolbar.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable");return this.model.isResponsive&&n.length==0?this._toolBarObj._liTemplte.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable").hide():this._rteToolbar.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable").hide(),this},_renderEditArea:function(){this._rteEditor=t.buildTag("div.editarea #"+this._rteId+"_editor").appendTo(this._rteWapper);this._rteIframe=t.buildTag("iframe.content-iframe #"+this._rteId+"_Iframe","",{},{frameborder:"0"}).appendTo(this._rteEditor);this._setIFrames();navigator.userAgent.match(/iPad/i)!=null&&this._rteEditor.addClass("e-ipadscroll")},_xhtmlTagValidation:function(){var n,o,s,e,u,i;if(this.value()!=null){if(n=this.value(),n=n.replace(/\r/gi," ").replace(/\n/gi,"<br/> ").replace(/\r\n/gi," ").replace(/( )+/gi," ").replace(/ /gi," ").replace(/•/gi,"*").replace(/<quo;/gi,"<").replace(/&rtquo;/gi,">").replace(/&trze;/gi,"(tm)").replace(/©/gi,"(c)").replace(/®/gi,"(r)"),n.indexOf("<body>")!=-1&&(o=n.indexOf("<body>"),s=n.slice(0,o+6),n=n.replace(s,"").replace("<\/body><\/html>","")),n=n.replace(/<br>/g,"<br/>").replace(/<hr>/g,"<hr/>"),n=this._imageXhtml(n),n=this._styleXhtml(n),n=this._startXhtml(n),n.indexOf("alt=")!=-1){for(var v=/alt=\"(.*?)\"/ig,f=[],h,c=0;(h=v.exec(n))!=null;)f[c]=h[0],c++;for(i=0;i<f.length;i++)n=n.replace(f[i],'alt=""')}if(!t.isNullOrUndefined(this._fontXhtml(n))){if(n=this._fontXhtml(n),n.indexOf("ol")!=-1){for(var y=/<ol(.*)<\/ol>/ig,l,a=0,r=[];(l=y.exec(n))!==null;)r[a]=l[0].toString(),a++;for(e=[],u=0;u<r.length;u++)e[u]=r[u];for(i=0;i<r.length;i++)r[i]=r[i].replace(/<br\/>/gi,"");for(i=0;i<r.length;i++)n=n.replace(e[i],r[i])}n=n.replace(/<o:p>/gi,"").replace(/<\/o:p>/gi,"")}this.value(n)}},_setIFrames:function(){var r=null,f,u,i;this.value()!=null&&this.value()!=""&&(r=this.value().replace(/'/g,'"'));r==null&&this.value(n.trim(this.element[0].value));f=t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version)==8;u="<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <style>html, body{height: 100%;margin: 0;}body.e-cursor{cursor:default} span.e-selected-node\t{background-color: #939393;color: white;}span.e-selected-node.e-highlight{background-color: #1d9dd8;}body{font-family:Times New Roman,Times,serif;color:#5C5C5C;word-wrap:break-word;padding: 8px;box-sizing: border-box;}.e-rte-table caption{border: 1px solid;border-bottom:none}td{word-wrap:break-word;word-break:break-all;}.e-rteColumnResizer{position: absolute;bottom:0;overflow: visible;cursor: col-resize;background-repeat:repeat;background-color:transparent}.e-rteRowResizer{position: absolute;bottom:0;overflow: visible;margin-left: -4px;cursor: row-resize;background-repeat:repeat;background-color:transparent} span.e-rte-imageboxmark{width:5px;height:5px;position:absolute;display:block;background:#fff;border:1px solid #000;}<\/style><\/head><body spellcheck='false' autocorrect='off' contenteditable="+(this.model.allowEditing?"true":"false")+">"+(this.value()!=""&&this.value()!="<br>"?n.trim(this.value()):"<p><span><\/span><\/p>")+"<\/body><\/html>";this._rteIframe.css({width:"100%"});(this.element[0].value=="<div><\/div>"||this.element[0].value=="")&&(this.element[0].innerHTML=this.value());this._setContent(u);this._isIE8()&&this.value(this._getDocument().body.innerHTML);i=n(this._getDocument()).find("table");!this.model.enableRTL&&i.length>0&&this._on(i,"mouseover",this._tableMouseOver);this.model.enableXHTML&&this._updateValue();this._setAutoHeight();(!t.isNullOrUndefined(this.model.undoStackLimit)||this.model.undoStackLimit!==""||this.model.undoStackLimit>0)&&(this._backupArray[0]=this.getHtml())},_setIframeHeight:function(){var i=(!t.isNullOrUndefined(this._rteToolbar)&&this._rteToolbar.is(":visible")?this._rteToolbar.outerHeight():6)+(!t.isNullOrUndefined(this._rteFooter)&&this._rteFooter.is(":visible")?this._rteFooter.outerHeight():0);this._rteIframe.css("height",i==0?this.model.height:this._rteWapper.outerHeight()-i-(parseInt(this._rteEditor.css("padding-top"))+parseInt(n(".e-rte-wrapper").css("border-bottom-width"))+parseInt(this.model.showFooter?n(".e-rte-footer").css("margin-top"):0)))},_renderFooter:function(){var r=this.model,i,n;this._rteFooter=t.buildTag("div.e-rte-footer #"+this._rteId+"_footer").appendTo(this._rteWapper);i=t.buildTag("div.e-rte-footer-left");this._htmlSource=t.buildTag("div.e-rte-icons e-rte-footeritems e-rte-footericon e-rte-source "+this._rteIconsList.rteSource,"",{},{title:this._getLocalizedLabels("viewHtml")}).appendTo(i);this._htmlInfo=t.buildTag("div.e-rte-htmltaginfo e-rte-footeritems").appendTo(i);i.appendTo(this._rteFooter);n=t.buildTag("div.e-rte-footer-right");this._wordCount=t.buildTag("div.e-rte-wordcount e-rte-footeritems").appendTo(n);this._charCount=t.buildTag("div.e-rte-charcount e-rte-footeritems").appendTo(n);this._clearFormat=t.buildTag("div.e-rte-icons "+this._rteIconsList.clearFormat+" e-rte-footericon e-rte-footeritems","",{},{title:this._getLocalizedLabels("clearFormat"),unselectable:"on"}).appendTo(n);this._clearAll=t.buildTag("div.e-rte-icons clearAll "+this._rteIconsList.clearAll+" e-rte-footericon e-rte-footeritems","",{},{title:this._getLocalizedLabels("clearAll")}).appendTo(n);this._resize=t.buildTag("div.e-icons e-rte-resize "+this._rteIconsList.rteResize+" e-rte-footeritems").appendTo(n);n.appendTo(this._rteFooter);this._footerEvents("_on");this.model.showHtmlSource||this._htmlSource.hide().removeClass("e-rte-footeritems");this.model.showHtmlTagInfo||this._htmlInfo.hide().removeClass("e-rte-footeritems");this.model.showWordCount||this._wordCount.hide().removeClass("e-rte-footeritems");this.model.showCharCount||this._charCount.hide().removeClass("e-rte-footeritems");this.model.showClearAll||this._clearAll.hide().removeClass("e-rte-footeritems");this.model.showClearFormat||this._clearFormat.hide().removeClass("e-rte-footeritems");r.enableResize?this._enableResize():this._resize.hide().removeClass("e-rte-footeritems");this._updateCount();this.model.showWordCount&&this._on(this._wordCount,"click",this._wordCharClick);this.model.showCharCount&&this._on(this._charCount,"click",this._wordCharClick);this._renderTooltip(this.model.tooltipSettings)},_renderTooltip:function(i){var r=n.extend(!0,{},i);r.cssClass=t.isNullOrUndefined(r.cssClass)?"e-rteTooltip "+this.model.cssClass:r.cssClass+" e-rteTooltip "+this.model.cssClass;r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.target=".e-rte-icons";this.model.showFooter&&(this._tooltip=n(this._rteFooter).ejTooltip(r).data("ejTooltip"))},_hideTooltip:function(){t.isNullOrUndefined(this._tooltip)||this._tooltip.hide()},_footerElement:function(n,t){if(this.model.showFooter){var i=this._rteFooter.find(n);t?i.show().addClass("e-rte-footeritems"):i.hide().addClass("e-rte-footeritems")}},_wordCharClick:function(){this._alertWindow.ejDialog("option",{showHeader:!0,title:"<span style='padding-left:0.4em;'>"+this._getLocalizedLabels("wordCount")+"<\/span>"});this.model.enableRTL&&this._alertWindow.find(".e-alert-ok").removeClass("e-rte-alertBtnRTL");this._alertWindow.find(".e-rte-button").removeClass("e-fieldseparate").css({"text-align":"center","padding-bottom":"1em","padding-top":"0.5em"});this._alertWindow.ejDialog("instance").refresh();this._openAlert("<div style='padding-left:0.3em;padding-right:0.3em;'><div style='"+(this.model.enableRTL?"float:right":"float:left")+"'>"+this._getLocalizedLabels("words")+"<p style='margin:0.875em 0em;'>"+this._getLocalizedLabels("charSpace")+"<\/p><p style='margin:0.875em 0em;'>"+this._getLocalizedLabels("charNoSpace")+"<\/p><\/div><div style='"+(this.model.enableRTL?"float:left;padding-right:2em;":"float:right;padding-left:2em;")+"'>"+(n.trim(this._getText())!=""?n.trim(this._getText()).split(/\W+/).length:0)+"<p style='margin:0.875em 0em;'>"+this._getText().length+"<\/p><p style='margin:0.875em 0em;'>"+this._getText().replace(/\s/g,"").length+"<\/p><\/div><\/div><br/>")},_updateColorPalette:function(){var t=n("ul#"+this._rteId+"_colorTable"),i=n("ul#"+this._rteId+"_colorBGTable");t.find("div.e-rte-table").remove();t.find("li").append(this._colorTable());i.find("div.e-rte-table").remove();i.find("li").append(this._colorTable())},_enableRTL:function(n){try{n?this._rteIframe.contents().find("body").css("direction","rtl"):this._rteIframe.contents().find("body").css("direction","ltr")}catch(t){}this._subControlsSetModel("enableRTL",n)},_roundedCorner:function(n){n&&this._rteWapper.toggleClass("e-corner-all");this._subControlsSetModel("showRoundedCorner",n)},_subControlsSetModel:function(i,r){t.isNullOrUndefined(this._tooltip)||(i=="cssClass"?n(this._rteFooter).ejTooltip("option",i,"e-rteTooltip "+r):n(this._rteFooter).ejTooltip("option",i,r));t.isNullOrUndefined(this._formatDDL)||this._formatDDL.ejDropDownList("option",i,r);t.isNullOrUndefined(this._fontStyleDDL)||this._fontStyleDDL.ejDropDownList("option",i,r);t.isNullOrUndefined(this._fontSizeDDL)||this._fontSizeDDL.ejDropDownList("option",i,r);t.isNullOrUndefined(this._fontColorSplit)||this._fontColorSplit.ejSplitButton("option",i,r);t.isNullOrUndefined(this._bgColorSplit)||this._bgColorSplit.ejSplitButton("option",i,r);t.isNullOrUndefined(this._toolBarItems)||(i=="showRoundedCorner"&&this._toolBarItems.hasClass("e-corner-top")&&this._toolBarItems.removeClass("e-corner-top").addClass("e-corner-all"),this._toolBarItems.ejToolbar("option",i,r),i=="showRoundedCorner"&&this._toolBarItems.hasClass("e-corner-all")&&this._toolBarItems.removeClass("e-corner-all").addClass("e-corner-top"));t.isNullOrUndefined(this._linkDialog)||(this._linkDialog.ejDialog("option",i,r),this._linkDialog.find(".e-rte-btn").ejButton("option",i,r),this._chkTarget.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._linkDialog.find(".e-inputtext").addClass("e-corner-all"):this._linkDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._imgDialog)||(this._imgDialog.ejDialog("option",i,r),this._imgDialog.find("div.e-rte-imageTab").ejTab("option",i,r),this._imgDialog.find(".e-rte-imgBorderPx").ejNumericTextbox("option",i,r),this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList("option",i,r),this._chkImgDimensions.ejCheckBox("option",i,r),this._dialogchkTarget.ejCheckBox("option",i,r),this._imgDialog.find(".e-rte-btn").ejButton("option",i,r),i=="showRoundedCorner"&&(r==!0?this._imgDialog.find(".e-inputtext").addClass("e-corner-all"):this._imgDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._videoDialog)||(this._videoDialog.ejDialog("option",i,r),this._videoDialog.find(".e-rte-btn").ejButton("option",i,r),this._chkvideoDimensions.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._videoDialog.find(".e-inputtext").addClass("e-corner-all"):this._videoDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._createTable)||this._createTable.ejDialog("option",i,r);t.isNullOrUndefined(this._sourceDialog)||(this._sourceDialog.ejDialog("option",i,r),this._sourceDialog.find(".e-rte-btn").ejButton("option",i,r),i=="showRoundedCorner"&&(r==!0?this._sourceDialog.find(".e-inputtext").addClass("e-corner-all"):this._sourceDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._alertWindow)||(this._alertWindow.ejDialog("option",i,r),this._alertWindow.find(".e-rte-btn").ejButton("option",i,r));t.isNullOrUndefined(this._customTableDialog)||(this._customTableDialog.ejDialog("option",i,r),this._customTableDialog.find(".e-rte-btn").ejButton("option",i,r),this._customTableDialog.find(".numerictextbox").ejNumericTextbox("option",i,r),this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("option",i,r),this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("option",i,r),this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("option",i,r),this._chkTblCaption.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._customTableDialog.find(".e-inputtext").addClass("e-corner-all"):this._customTableDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._eTblDialog)||(this._eTblDialog.ejDialog("option",i,r),this._eTblDialog.find(".e-numerictextbox").ejNumericTextbox("option",i,r),this._eTblDialog.find(".e-rte-dropdown").ejDropDownList("option",i,r),this._getTableObj("_Tab").ejTab("option",i,r),this._eTblDialog.find(".e-rte-btn").ejButton("option",i,r),this._eTblCaption.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._eTblDialog.find(".e-inputtext").addClass("e-corner-all"):this._eTblDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._fileDialog)||(this._fileDialog.ejDialog("option",i,r),this._fileDialog.find(".e-rte-btn").ejButton("option",i,r),this._chkFileTarget.ejCheckBox("option",i,r),i=="showRoundedCorner"&&(r==!0?this._fileDialog.find(".e-inputtext").addClass("e-corner-all"):this._fileDialog.find(".e-inputtext").removeClass("e-corner-all")));t.isNullOrUndefined(this._explorerObj)||this._explorerObj.option(i,r);t.isNullOrUndefined(this._fileBrowserObj)||this._fileBrowserObj.option(i,r)},_createCountElement:function(n,t){n?t.show():t.hide();t.toggleClass("e-rte-footeritems")},_enableResize:function(){this.model.enableResize&&this.model.enabled&&(this._rteWapper.addClass("e-resizable"),this._resizeRTE())},_resizeRTE:function(){var i=this;this._overlayElement=t.buildTag("div.e-rte-overlay");this._rteEditor.css("position","relative");this._rteWapper.find("div.e-rte-resize").ejResizable({minHeight:parseInt(i.model.minHeight),minWidth:parseInt(i.model.minWidth),maxHeight:parseInt(i.model.maxHeight),maxWidth:parseInt(i.model.maxWidth),resizeStart:function(n){i._rteEditor.append(i._overlayElement);i._trigger("resizeStart",{event:n})},resize:function(n){i._updateCount();i._resizeHeight(n.element);i._trigger("resize",{event:n});i.model.isResponsive&&i.model.showToolbar&&i._toolBarObj._reSizeHandler()},resizeStop:function(n){i._overlayElement.remove();i._trigger("resizeStop",{event:n})},helper:function(t){return i._resizeHeight(t.element),n(i._rteWapper)}})},_getDocumentHandler:function(){return this._operationHandler||(this._operationHandler=new t.editorManager(this.getDocument(),this._getWindow())),this._operationHandler},_resizeHeight:function(t){var i=n(t).parents("div.e-rte-wrapper");this._rteWidth=n(i).width();this._rteHeight=n(i).height();this._rteWapper.height(this._rteHeight);this._rteWapper.width(this._rteWidth);this._setIframeHeight()},_getDialogModel:function(){var n=this._rteWapper;return dialogModel={enableResize:!1,showOnInit:!1,enableModal:!0,cssClass:this.model.cssClass,target:n,isResponsive:!0,enableRTL:this.model.enableRTL}},_labelFor:function(n){return this._rteId?" for="+this._rteId+n+" ":""},_TagId:function(n){return this._rteId?" id="+this._rteId+n+" ":""},_renderLinkDialog:function(){var f=this,i=this.model.enableRTL?"e-rtlrte":"",u=this._linkDialog=t.buildTag("div#"+this._rteId+"_link"),e=n("<div class='e-rte-label "+i+"'><label "+this._labelFor("_link_url")+">"+this._getLocalizedLabels("linkWebUrl")+"<\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-linkUrl' "+this._TagId("_link_url")+"/><\/div><div class='e-rte-label "+i+"'><label "+this._labelFor("_link_text")+">"+this._getLocalizedLabels("linkText")+"<\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-linkText' "+this._TagId("_link_text")+"><\/div><div class='e-rte-label "+i+"'><label "+this._labelFor("_link_title")+">"+this._getLocalizedLabels("linkTooltipLabel")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-linkTitle' "+this._TagId("_link_title")+"><\/div><div class='e-rte-label "+i+"'><\/div><div class='e-rte-field "+i+"'><input type='checkbox' class='e-rte-linkTarget' data-role ='none' "+this._TagId("_link_target")+"><label "+this._labelFor("_link_target")+" style='padding: 5px;'>"+this._getLocalizedLabels("linkOpenInNewWindow")+"<\/label><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+i+"' type='button' data-role ='none' id='link_insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+i+"'type='button' data-role ='none' id='link_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>"),r;e.appendTo(u);u.appendTo(this._rteWapper);r=this._getDialogModel();r.minWidth="340px";r.width="auto";r.title=this._getLocalizedLabels("createLink");r.target=null;r.closeIconTooltip=this._getLocalizedLabels("closeIcon");r.showRoundedCorner=this.model.showRoundedCorner;r.close=function(){f._ieCursorMaintainance()};u.ejDialog(r);u.closest(".e-dialog-wrap").addClass("e-rte");this.model.showRoundedCorner&&u.find(".e-inputtext").addClass("e-corner-all");this._chkTarget=u.find(".e-rte-linkTarget");this._chkTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});u.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(u.find(".e-rte-btn"),"click",this._linkBtnClick)._on(this._linkDialog.find(".e-rte-linkUrl"),"keypress",this._urlValidation)},_renderImageDialog:function(){var u=this,o="",i,f,r,e;this._imgDialog=t.buildTag("div#"+this._rteId+"_Image");i=this.model.enableRTL?"e-rtlrte":"";f="<div "+this._TagId("_img_Tab")+" class='e-rte-imageTab'><ul><li class='e-first'><a href='#"+this._rteId+"_general'>"+this._getLocalizedLabels("general")+" <\/a><\/li><li class='e-nofirst'><a href='#"+this._rteId+"_advanced'>"+this._getLocalizedLabels("advanced")+" <\/a><\/li><\/ul><div id='"+this._rteId+"_general'><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_url")+">"+this._getLocalizedLabels("imageWebUrl")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgUrl' "+this._TagId("_img_url")+"><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_text")+">"+this._getLocalizedLabels("imageAltText")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgText' "+this._TagId("_img_text")+"><\/div><\/div><div class='e-rte-imgdimensions' "+this._TagId("_imgdimensions")+"><div class='e-rte-label "+i+"'><label>"+this._getLocalizedLabels("dimensions")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' data-role ='none' class='e-inputtext e-dimensions e-rte-imgX' maxlength='3' "+this._TagId("_imgX")+"><label style='padding: 5px;'>X<\/label><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' style='margin-right: 5px;' class='e-inputtext e-dimensions e-rte-imgY' maxlength='3' "+this._TagId("_imgY")+"><\/div><input type='checkbox' class='e-rte-imgConsrn' data-role ='none'"+this._TagId("_img_consrn")+"<label "+this._labelFor("_img_consrn")+" style='padding: 5px;'>"+this._getLocalizedLabels("constrainProportions")+"<\/label><\/div><\/div><div id='"+this._rteId+"_advanced'><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_link")+">"+this._getLocalizedLabels("imageLink")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgLink' "+this._TagId("_img_link")+"><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_border_px")+">"+this._getLocalizedLabels("imageBorder")+"<\/label><\/div><div class='e-rte-field "+i+"'><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("imageBorder")+"' class='e-rte-imgBorderPx' maxlength='3' "+this._TagId("_img_border_px")+"><\/div><div class='e-img-border-field'><select class='e-rte-imgBorderStyle' data-role ='none' "+this._TagId("_img_border_style")+"><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input data-role ='none' type='text' title='"+this._getLocalizedLabels("imageBorder")+"' class='e-inputtext e-rte-imgBorderColor' "+this._TagId("_img_border_color")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><label "+this._labelFor("_img_style")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-field "+i+"'><input type='text' data-role ='none' class='e-inputtext e-rte-imgStyle' "+this._TagId("_img_style")+"><\/div><\/div><div class='e-img-field-group'><div class='e-rte-label "+i+"'><\/div><div class='e-rte-field "+i+"'><input type='checkbox' class='e-rte-imgLinkTarget' data-role ='none' "+this._TagId("_img_link_target")+"><label "+this._labelFor("_img_link_target")+" style='padding: 5px;'>"+this._getLocalizedLabels("linkOpenInNewWindow")+"<\/label><\/div><\/div><\/div><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+i+"' data-role ='none' type='button' id='"+this._rteId+"_img_insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+i+"' type='button' data-role ='none' id='"+this._rteId+"_img_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>";this.model.imageBrowser.filePath!=""&&(o="<div "+this._TagId("_img_explorer")+" class='e-rte-explorer e-rte-imgBrowser'><\/div>");f=n(o+f);f.appendTo(this._imgDialog);this._imgDialog.appendTo(this._rteWapper);this.model.showDimensions||this._rteWapper.find("div.e-rte-imgdimensions").hide();r=this._getDialogModel();r.maxWidth=this.model.imageBrowser.filePath==""?"470px":"720px";r.width="auto";r.title=this._getLocalizedLabels("image");r.target=null;r.closeIconTooltip=this._getLocalizedLabels("closeIcon");r.showRoundedCorner=this.model.showRoundedCorner;r.open=function(){u._explorerObj&&u._explorerObj.adjustSize();t.isNullOrUndefined(u._imgSplitObj)||u._imgSplitObj.option("enableAutoResize",!0)};r.close=function(){u._ieCursorMaintainance();t.isNullOrUndefined(u._imgSplitObj)||u._imgSplitObj.option("enableAutoResize",!1)};this._imgDialog.ejDialog(r);this._imgDialog.closest(".e-dialog-wrap").css({visibility:"hidden",display:"block"}).addClass("e-rte");this.model.imageBrowser.filePath!=""&&(e={upload:{url:this.model.imageBrowser.uploadAction}},this.model.imageBrowser.ajaxSettings&&n.extend(!0,e,this.model.imageBrowser.ajaxSettings),this._explorerObj=this._imgDialog.find("div.e-rte-imgBrowser").ejFileExplorer({allowMultiSelection:!1,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,cssClass:this.model.cssClass,maxWidth:"690px",isResponsive:!0,minWidth:"330px",height:"300px",path:this.model.imageBrowser.filePath,fileTypes:this.model.imageBrowser.extensionAllow,layout:t.FileExplorer.layoutType.LargeIcons,select:function(n){u._UpdateImgDetails(n)},tools:{creation:["NewFolder","Open"],navigation:["Back","Forward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete"],searchBar:["Searchbar"]},toolsList:["creation","navigation","addressBar","editing","searchBar"],enableResize:!1,showContextMenu:!1,ajaxAction:this.model.imageBrowser.ajaxAction,locale:this.model.locale,ajaxSettings:e}).data("ejFileExplorer"),this._imgSplitObj=this._imgDialog.find(".e-splitter").data("ejSplitter"),this._imgSplitObj.option("enableAutoResize",!1));this.model.showRoundedCorner&&this._imgDialog.find(".e-inputtext").addClass("e-corner-all");this._imgDialog.find("div.e-rte-imageTab").ejTab({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._imgDialog.find(".e-rte-imgBorderPx").ejNumericTextbox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",minValue:0,value:0,showRoundedCorner:this.model.showRoundedCorner});this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._chkImgDimensions=this._imgDialog.find(".e-rte-imgConsrn");this._chkImgDimensions.ejCheckBox({check:!0,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._imgDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._imgPicker=this._imgDialog.find(".e-rte-imgBorderColor").ejColorPicker({cssClass:this.model.cssClass,modelType:"palette",buttonText:{apply:this._getLocalizedLabels("buttonApply"),cancel:this._getLocalizedLabels("buttonCancel"),swatches:this._getLocalizedLabels("swatches")}}).data("ejColorPicker");this._imgDialog.parents("#"+this._rteId+"_Image_wrapper").css({visibility:"visible",display:"none"});this._dialogchkTarget=this._imgDialog.find(".e-rte-imgLinkTarget");this._dialogchkTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._imgDialog.find(".e-rte-btn"),"click",this._imageBtnClick);this._on(this._imgDialog.find(".e-rte-imgUrl , .e-rte-imgLink"),"keypress",this._urlValidation);this._on(this._imgDialog.find("input.e-dimensions"),"change",this._recalcImgSize)},_renderFileBrowserDialog:function(){var r=this,o="",u=this.model.enableRTL?"e-rtlrte":"",f,i,e;this._fileDialog=t.buildTag("div#"+this._rteId+"_fileDialog");f="<div class='e-rte-elements'><div class='e-rte-label "+u+"'><label "+this._labelFor("_file_url")+">"+this._getLocalizedLabels("linkWebUrl")+"<\/label><\/div><div class='e-rte-field "+u+"'><input type='text' data-role ='none' class='e-inputtext e-rte-fileUrl' "+this._TagId("_file_url")+"/><\/div><div class='e-rte-label "+u+"'><label "+this._labelFor("_file_text")+">"+this._getLocalizedLabels("linkText")+"<\/label><\/div><div class='e-rte-field "+u+"'><input type='text' data-role ='none' class='e-inputtext e-rte-fileText' "+this._TagId("_file_text")+"><\/div> <\/div><div class='e-rte-field'><input type='checkbox' class='e-rte-fileTarget' data-role ='none' "+this._TagId("_file_target")+"><label "+this._labelFor("_link_target")+" style='padding: 5px;'>"+this._getLocalizedLabels("linkOpenInNewWindow")+"<\/label><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+u+"' type='button' data-role ='none' id='"+this._rteId+"_file_insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+u+"'type='button' data-role ='none' id='"+this._rteId+"_file_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>";o="<div "+this._TagId("_file_explorer")+" class='e-rte-explorer e-rte-fileBrowser'><\/div>";f=n(o+f);f.appendTo(this._fileDialog);this._fileDialog.appendTo(this._rteWapper);i=this._getDialogModel();i.width="auto";i.title=this._getLocalizedLabels("fileBrowser");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.open=function(){r._fileBrowserObj.adjustSize();t.isNullOrUndefined(r._fileSplitObj)||r._fileSplitObj.option("enableAutoResize",!0)};i.close=function(){r._ieCursorMaintainance();t.isNullOrUndefined(r._fileSplitObj)||r._fileSplitObj.option("enableAutoResize",!1)};this._fileDialog.ejDialog(i);this._fileDialog.closest(".e-dialog-wrap").css({visibility:"hidden",display:"block"}).addClass("e-rte");e={upload:{url:this.model.fileBrowser.uploadAction}};this.model.fileBrowser.ajaxSettings&&n.extend(!0,e,this.model.fileBrowser.ajaxSettings);this._fileBrowserObj=this._fileDialog.find("div.e-rte-fileBrowser").ejFileExplorer({allowMultiSelection:!1,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,cssClass:this.model.cssClass,maxWidth:"690px",height:"300px",isResponsive:!0,minWidth:"330px",path:this.model.fileBrowser.filePath,fileTypes:this.model.fileBrowser.extensionAllow,layout:"list",select:function(n){r._UpdateFileDetails(n)},tools:{creation:["NewFolder","Open"],navigation:["Back","Forward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete"],searchBar:["Searchbar"]},toolsList:["creation","navigation","addressBar","editing","searchBar"],enableResize:!1,showContextMenu:!1,ajaxAction:this.model.fileBrowser.ajaxAction,locale:this.model.locale,ajaxSettings:e}).data("ejFileExplorer");this._fileSplitObj=this._fileDialog.find(".e-splitter").data("ejSplitter");this._fileSplitObj.option("enableAutoResize",!1);this.model.showRoundedCorner&&this._fileDialog.find(".e-inputtext").addClass("e-corner-all");this._fileDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._fileDialog.parents("#"+this._rteId+"_fileDialog_wrapper").css({visibility:"visible",display:"none"});this._chkFileTarget=f.find(".e-rte-fileTarget");this._chkFileTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._fileDialog.find(".e-rte-btn"),"click",this._fileBtnClick)},_UpdateImgDetails:function(t){n(this._imgURL).hasClass("e-error")&&this._imgURL.removeClass("e-error");t.path===""?this._imgURL.val("http://"):this._imgDialog.find("div.e-rte-imageTab").find(".e-rte-imgUrl").val(t.path+(t.name[0]?t.name[0]:""))},_UpdateFileDetails:function(t){n(this._fileURL).hasClass("e-error")&&this._fileURL.removeClass("e-error");t.path===""?this._fileURL.val("http://"):this._fileDialog.find(".e-rte-fileUrl").val(t.path+(t.name[0]?t.name[0]:""))},_fileBtnClick:function(n){n.target.id===this._rteId+"_file_cancel"?(this._clearFileFields(),this._fileDialog.ejDialog("close"),this._ieCursorMaintainance()):n.target.id===this._rteId+"_file_insert"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._restoreSelection(this._selectionRange),this._fileDialog.find("e-rte-fileUrl").val()!=""?this._onInsertFileLink():this._linkDialog.ejDialog("close"),this._trigger("execute",{commandName:"hyperlink"}),this._onChange(),this._setBackupData())},_clearFileFields:function(){this._fileURL=this._fileDialog.find(".e-rte-fileUrl");this._fileURL.val("http://");this._fileLinkText=this._fileDialog.find(".e-rte-fileText");this._fileLinkText.val("");this._chkFileTarget.ejCheckBox({check:!1})},_onGetInsertFileContent:function(n){this._selectedHTML=this._fileLinkText.val()===""?n:this._fileLinkText.val()},_onInsertFileLink:function(){var i,f,o=this._fileURL.val().match(/(ftp:|http:|https:)\/\//g),u=this._fileURL.val().startsWith("~")?this._fileURL.val().replace(this._fileURL.val().substr("0","1"),".."):this._fileURL.val(),r,e;if(t.isNullOrUndefined(o)&&u!==""||!t.isNullOrUndefined(o)&&o[0].length<u.length)r=this._isIE()&&n(this._currentSelNode).parents("body").length>0?this._currentSelNode:this._getSelectedNode(),t.isNullOrUndefined(r)||r.tagName.toUpperCase()!="A"?t.isNullOrUndefined(r)||r.tagName.toUpperCase()!="IMG"?(i=t.buildTag("a","",{},{href:u}),i[0].target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self",this._focus(),this._isIE()?(t.isNullOrUndefined(this._selectedHTML)?this._onGetInsertFileContent(u):this._selectedHTML.length==0&&this._onGetInsertFileContent(u),i[0].innerHTML=this._selectedHTML,f=i[0].outerHTML):(this._fileLinkText.val()===""?i.html(u):i.html(this._fileLinkText.val()),f=n("<div>").append(n(i).clone()).html()),f&&this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length&&(this._isIE()?this._pasteHtml(f):this._getDocument().execCommand("inserthtml",!1,f),this._focus())):(e=n(r).parent("a")[0],t.isNullOrUndefined(e)?(i=t.buildTag("a","",{},{href:u}),n(r.outerHTML).appendTo(n(i)),n(r).replaceWith(n(i)),i[0].target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self"):(e.href=u,e.target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self")):(r.href=u,r.innerHTML=this._fileLinkText.val(),r.target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self"),this._fileDialog.ejDialog("close");else return this._fileURL.addClass("e-error"),!1;this.enableToolbarItem("removeLink");this._updateCount()},_renderVideoDialog:function(){var f=this,r,u,i;this._videoDialog=t.buildTag("div#"+this._rteId+"_video");r=this.model.enableRTL?"e-rtlrte":"";u=n("<div><label>"+this._getLocalizedLabels("embedVideo")+"<\/label><\/div><textarea class='e-rte-video e-inputtext' aria-label="+this._getLocalizedLabels("embedVideo")+"><\/textarea><div class='e-rte-videoDimensions'"+this._TagId("_videodimensions")+" style='margin-top:7px'><div class='e-rte-label'><label>"+this._getLocalizedLabels("dimensions")+" <\/label><\/div><div><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' class='e-inputtext e-dimensions e-rte-videoX' maxlength='3' "+this._TagId("_videoX")+"><label style='padding: 5px;'>X<\/label><input type='text' data-role ='none' title='"+this._getLocalizedLabels("dimensions")+"' style='margin-right: 5px;' class='e-inputtext e-dimensions e-rte-videoY' maxlength='3'"+this._TagId("_videoY")+"><input type='checkbox' class='e-rte-videoConsrn' data-role ='none'"+this._TagId("_video_consrn")+"<label "+this._labelFor("_video_consrn")+"style='padding: 5px;'>"+this._getLocalizedLabels("constrainProportions")+"<\/label><\/div><\/div><div class='e-rte-button e-fieldseparate'><button id='video_insert'type='button' data-role ='none' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button id='video_cancel' type='button' data-role ='none' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");u.appendTo(this._videoDialog);this._videoDialog.appendTo(this._rteWapper);this.model.showDimensions||this._rteWapper.find(".e-rte-videoDimensions").hide();i=this._getDialogModel();i.width="auto";i.closeIconTooltip=this._getLocalizedLabels("closeIcon");i.title=this._getLocalizedLabels("video");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.close=function(){f._ieCursorMaintainance()};this._videoDialog.ejDialog(i);this._videoDialog.closest(".e-dialog-wrap").addClass("e-rte");this.model.showRoundedCorner&&this._videoDialog.find(".e-inputtext").addClass("e-corner-all");this._chkvideoDimensions=this._videoDialog.find(".e-rte-videoConsrn");this._chkvideoDimensions.ejCheckBox({checked:!0,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._videoDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._videoDialog.find(".e-rte-btn"),"click",this._insertVideo);this._on(this._videoDialog.find("input.e-dimensions"),"change",this._recalcVideoSize)},_renderTableDialog:function(){var r=this,i,n;this._createTable=t.buildTag("div.e-rte-table-picker#"+this._rteId+"_table");this._tblheaderDiv=t.buildTag("div.e-rte-tableheader");this._tblheaderDiv.html(this._getLocalizedLabels("createTable"));this._tblheaderDiv.appendTo(this._createTable);i=t.buildTag("div.e-rte-table");this._drawTable(i);i.appendTo(this._createTable);this._createCustomTable();this._createTable.appendTo(this._rteWapper);n=this._getDialogModel();n.enableModal=!1;n.showHeader=!1;n.width="auto";n.minWidth="270px";n.maxWidth="270px";n.showRoundedCorner=this.model.showRoundedCorner;n.close=function(n){n.event&&n.event.clickAction&&r._ieCursorMaintainance()};this._createTable.ejDialog(n)},_createCustomTable:function(){var u=n("<div class='customtable-group e-rte-createCustomTableLink' "+this._TagId("_createCustomTableLink")+"><span class='e-rte-toolbar-icon "+this._rteIconsList.customTableImage+"'><\/span><a class='customtable-link' role='button' title='"+this._getLocalizedLabels("customTable")+"'>"+this._getLocalizedLabels("customTable")+"<\/a><\/div><div class='customtable-group e-rte-eTblProperties' "+this._TagId("_eTblProperties")+"><span class='e-rte-toolbar-icon "+this._rteIconsList.customTableImage+"'><\/span><a class='customtable-link' role='button' title='"+this._getLocalizedLabels("editTable")+"'>"+this._getLocalizedLabels("editTable")+"<\/a><\/div>"),r,f,i;this._on(u,"click",this._openCustomTable);u.appendTo(this._createTable);this.model.showCustomTable||this._createTable.find("#"+this._rteId+"_createCustomTableLink").hide();r=this.model.enableRTL?"e-rtlrte":"";this._customTableDialog=t.buildTag("div.e-rte-customtable#"+this._rteId+"_customTable");f=n("<div class='e-fieldgroup'><div class='e-rte-tablefields'><label "+this._labelFor("_txtColumns")+">"+this._getLocalizedLabels("tableColumns")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='numerictextbox e-rte-txtColumns' "+this._TagId("_txtColumns")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtRows")+">"+this._getLocalizedLabels("tableRows")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='numerictextbox e-rte-txtRows' "+this._TagId("_txtRows")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtWidth")+">"+this._getLocalizedLabels("tableWidth")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtWidth'"+this._TagId("_txtWidth")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtHeight")+">"+this._getLocalizedLabels("tableHeight")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtHeight'"+this._TagId("_txtHeight")+"><\/div><\/div><div class='e-fieldseparate'><div class='e-rte-tablefields'><label "+this._labelFor("_txtSpacing")+">"+this._getLocalizedLabels("tableCellSpacing")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtSpacing' "+this._TagId("_txtSpacing")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtPadding")+">"+this._getLocalizedLabels("tableCellPadding")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-rte-txtPadding'"+this._TagId("_txtPadding")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_txtBorder")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-tablefields'><select class='e-rte-txtBorder' data-role ='none' "+this._TagId("_txtBorder")+"><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_chkCaption")+">"+this._getLocalizedLabels("tableCaption")+"<\/label><\/div><div class='e-rte-tablefields'><input type='checkbox' class='e-rte-chkCaption' data-role ='none'"+this._TagId("_chkCaption")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_ddlAlignment")+">"+this._getLocalizedLabels("tableAlignment")+"<\/label><\/div><div class='e-rte-tablefields'><select class='e-rte-ddlAlignment' data-role ='none' "+this._TagId("_ddlAlignment")+"><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+r+"' data-role ='none' id='insert'>"+this._getLocalizedLabels("dialogInsert")+"<\/button><button class='e-rte-btn "+r+"' data-role ='none' id='cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");f.appendTo(this._customTableDialog);i=this._getDialogModel();i.width="auto";i.maxWidth="480px";i.title=this._getLocalizedLabels("customTable");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.closeIconTooltip=this._getLocalizedLabels("closeIcon");this._customTableDialog.ejDialog(i);this._customTableDialog.closest(".e-dialog-wrap").addClass("e-rte");this.model.showRoundedCorner&&this._customTableDialog.find(".e-inputtext").addClass("e-corner-all");this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable");this._customTableDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".numerictextbox").ejNumericTextbox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",minValue:1,value:3,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox({maxValue:63,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!1,showRoundedCorner:this.model.showRoundedCorner});this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._chkTblCaption=this._customTableDialog.find(".e-rte-chkCaption");this._chkTblCaption.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._customTableDialog.find(".e-rte-btn"),"click",this._insertCustomTable)},_renderEditTableDialog:function(){var f=this,i;this._eTblDialog=t.buildTag("div.e-rte-edittable#"+this._rteId+"_eTbl");var r=this._rteId,u=this.model.enableRTL?"e-rtlrte":"",e=n("<div id='"+this._rteId+"_eTbl_Tab'><ul><li class='e-first'><a href='#"+this._rteId+"_eTblTable'>"+this._getLocalizedLabels("table")+" <\/a><\/li><li class='e-nofirst'><a href='#"+this._rteId+"_eTblRow'>"+this._getLocalizedLabels("row")+" <\/a><\/li><li class='e-nofirst'><a href='#"+this._rteId+"_eTblCell'>"+this._getLocalizedLabels("cell")+" <\/a><\/li><\/ul><div id='"+this._rteId+"_eTblTable'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblWidth")+">"+this._getLocalizedLabels("tableWidth")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblWidth")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblHeight")+">"+this._getLocalizedLabels("tableHeight")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblHeight")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblCellSpace")+">"+this._getLocalizedLabels("tableCellSpacing")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-numerictextbox' "+this._TagId("_eTblCellSpace")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblCellPad")+">"+this._getLocalizedLabels("tableCellPadding")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext e-numerictextbox' "+this._TagId("_eTblCellPad")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblAlign")+">"+this._getLocalizedLabels("tableAlignment")+"<\/label><\/div><div class='e-rte-tablefields'><select id='"+r+"_eTblAlign' data-role ='none' class='e-rte-dropdown'><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblCaption")+">"+this._getLocalizedLabels("tableCaption")+"<\/label><\/div><div class='e-rte-tablefields'><input type='checkbox' data-role ='none' "+this._TagId("_eTblCaption")+"><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblBrdrPx")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-stylefield'><div class='e-img-border-field'><input data-role ='none' type='text' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext e-numerictextbox' maxlength='3' "+this._TagId("_eTblBrdrPx")+"><\/div><div class='e-img-border-field'><select "+this._TagId("_eTbl_border_style")+" class='e-rte-dropdown' data-role ='none' ><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext' "+this._TagId("_eTbl_border_color")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblStyle")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-stylefield'><input data-role ='none' type='text' class='e-inputtext' "+this._TagId("_eTblStyle")+"><\/div><\/div><\/div><div id='"+r+"_eTblRow'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRHeight")+">"+this._getLocalizedLabels("tableHeight")+"<\/label><\/div><div class='e-rte-tablefields'><input data-role ='none' type='text' class='e-inputtext' "+this._TagId("_eTblRHeight")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRAlign")+">"+this._getLocalizedLabels("textAlign")+"<\/label><\/div><div class='e-rte-tablefields'><select "+this._TagId("_eTblRAlign")+" data-role ='none' class='e-rte-dropdown'><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRBrdrPx")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-stylefield'><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext e-numerictextbox' maxlength='3' "+this._TagId("_eTblRBrdrPx")+"><\/div><div class='e-img-border-field'><select "+this._TagId("_eTblRBrdrStyle")+" data-role ='none' class='e-rte-dropdown'><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext' "+this._TagId("_eTblRBrdrColor")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblRStyle")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-stylefield'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblRStyle")+"><\/div><\/div><\/div><div id='"+r+"_eTblCell'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClWidth")+">"+this._getLocalizedLabels("tableWidth")+"<\/label><\/div><div class='e-rte-tablefields'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblClWidth")+"><\/div><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClAlign")+">"+this._getLocalizedLabels("textAlign")+"<\/label><\/div><div class='e-rte-tablefields'><select "+this._TagId("_eTblClAlign")+" data-role ='none' class='e-rte-dropdown'><option value='left'>"+this._getLocalizedLabels("left")+"<\/option><option value='right'>"+this._getLocalizedLabels("right")+"<\/option><option value='center'>"+this._getLocalizedLabels("center")+"<\/option><\/select><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClBrdrPx")+">"+this._getLocalizedLabels("tableBorder")+"<\/label><\/div><div class='e-rte-stylefield'><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext e-numerictextbox' maxlength='3' "+this._TagId("_eTblClBrdrPx")+" ><\/div><div class='e-img-border-field'><select "+this._TagId("_eTblClBrdrStyle")+" data-role ='none' class='e-rte-dropdown'><option value='solid'>"+this._getLocalizedLabels("solid")+"<\/option><option value='dotted'>"+this._getLocalizedLabels("dotted")+"<\/option><option value='dashed'>"+this._getLocalizedLabels("dashed")+"<\/option><option value='double'>"+this._getLocalizedLabels("doubled")+"<\/option><\/select><\/div><div class='e-img-border-field'><input type='text' data-role ='none' title='"+this._getLocalizedLabels("tableBorder")+"' class='e-inputtext' "+this._TagId("_eTblClBrdrColor")+"><\/div><\/div><\/div><div class='e-img-field-group'><div class='e-rte-tablefields'><label "+this._labelFor("_eTblClStyle")+">"+this._getLocalizedLabels("imageStyle")+" <\/label><\/div><div class='e-rte-stylefield'><input type='text' data-role ='none' class='e-inputtext' "+this._TagId("_eTblClStyle")+"><\/div><\/div><\/div><\/div><div class='e-rte-button e-fieldseparate'><button class='e-rte-btn "+u+"' data-role ='none' id='"+r+"_eTbl_apply'>"+this._getLocalizedLabels("dialogApply")+"<\/button><button class='e-rte-btn "+u+"' data-role ='none' id='"+r+"_eTbl_cancel'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");e.appendTo(this._eTblDialog);this._tblborderPicker=this._eTblDialog.find("#"+this._rteId+"_eTbl_border_color").ejColorPicker({cssClass:this.model.cssClass,modelType:"palette",buttonText:{apply:this._getLocalizedLabels("buttonApply"),cancel:this._getLocalizedLabels("buttonCancel"),swatches:this._getLocalizedLabels("swatches")}}).data("ejColorPicker");this._eTblDialog.appendTo(this._rteWapper);i=this._getDialogModel();i.width="auto";i.title=this._getLocalizedLabels("editTable");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.closeIconTooltip=this._getLocalizedLabels("closeIcon");i.close=function(){f._ieCursorMaintainance()};this._eTblDialog.ejDialog(i);this._eTblDialog.closest(".e-dialog-wrap").addClass("e-rte e-edittable");this.model.showRoundedCorner&&this._eTblDialog.find(".e-inputtext").addClass("e-corner-all");this._eTblDialog.find(".e-numerictextbox").ejNumericTextbox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",minValue:0,value:0,showRoundedCorner:this.model.showRoundedCorner});this._eTblDialog.find(".e-rte-dropdown").ejDropDownList({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",showRoundedCorner:this.model.showRoundedCorner});this._eTblAlign=this._getTableObj("Align").data("ejDropDownList");this._eTblAlign.option("enabled",!1);this._getTableObj("_Tab").ejTab({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,width:"100%",enabled:!0,showRoundedCorner:this.model.showRoundedCorner});this._eTblCaption=this._getTableObj("Caption");this._eTblCaption.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._eTblDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._eTblDialog.find(".e-rte-btn"),"click",this._eTblBtnClick)},_drawTable:function(n){for(var r,i=0;i<this.model.tableRows;i++){for(rowDiv=t.buildTag("div.e-rtetablerow"),r=0;r<this.model.tableColumns;r++)tableCell=t.buildTag("div.e-rte-tablecell e-default"),tableCell.appendTo(rowDiv);rowDiv.appendTo(n)}},_renderSourceDialog:function(){var f=this,r,u,i;this._sourceDialog=t.buildTag("div.e-rte-source#"+this._rteId+"_Source");r=this.model.enableRTL?"e-rtlrte":"";u=n("<textarea class='e-rte-srctextarea e-inputtext'><\/textarea><div class='e-rte-button e-fieldseparate'><button id='src_update' data-role ='none' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogUpdate")+"<\/button><button id='src_cancel' class='e-rte-btn "+r+"'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");u.appendTo(this._sourceDialog);i=this._getDialogModel();i.title=this._getLocalizedLabels("viewHtml");i.width="auto";i.minWidth="330px";i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.close=function(){f._ieCursorMaintainance()};i.closeIconTooltip=this._getLocalizedLabels("closeIcon");this._sourceDialog.ejDialog(i);this._sourceDialog.closest(".e-dialog-wrap").addClass("e-rte e-sourcedialog");this.model.showRoundedCorner&&this._sourceDialog.find(".e-inputtext").addClass("e-corner-all");this._sourceDialog.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._sourceDialog.find(".e-rte-btn"),"click",this._srcBtnClick)},_renderAlertDialog:function(){var u=this,r,i;this._alertWindow=t.buildTag("div#"+this._rteId+"_Alert");r=n("<p class='e-alerttext' style='margin:0.875em 0em;'><\/p><div class='e-rte-button e-fieldseparate'><button data-role ='none' class='e-rte-btn e-alert-ok' type='button'>"+this._getLocalizedLabels("dialogOk")+"<\/button><button class='e-rte-btn e-alert-cancel' data-role='none'>"+this._getLocalizedLabels("dialogCancel")+"<\/button><\/div>");r.appendTo(this._alertWindow);i=this._getDialogModel();i.showHeader=!1;i.width="auto";i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.close=function(){u._ieCursorMaintainance()};i.minHeight="50px";this._alertWindow.ejDialog(i);this._alertWindow.closest(".e-dialog-wrap").addClass("e-rte");this._alertWindow.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner});this._on(this._alertWindow.find(".e-rte-btn"),"click",this._alertBtnClick);this._alertWindow.find(".e-alert-cancel").hide()},_alertBtnClick:function(t){if(n.trim(this._alertWindow.find(".e-alerttext").html())==this._getLocalizedLabels("deleteAlert")&&n(t.target).hasClass("e-alert-ok")){this._getDocument().body.innerHTML=" ";this._emptyContent();this.model.showToolbar&&this._toolBarObj.selectItemByID(this._rteId+"_justifyLeft");this._setBackupData();this._updateCount();var i=this._isIE()?this._currentSelNode:this._getSelectedNode();this._updateTagInfo(i);this._onChange()}this._alertWindow.ejDialog("close");this._alertWindow.find(".e-alert-cancel").hide()},_emptyContent:function(){var r,n=document.createElement("span"),t,i;n.innerHTML="";t=this._getDocument().createRange();i=this._getDocument().getSelection();this._getDocument().body.firstChild&&this._getDocument().body.firstChild.remove();this._getDocument().body.appendChild(r=this._getDocument().createElement("p"));r.appendChild(n);i.removeAllRanges();t.setStart(n.firstChild,0);t.setEnd(n.firstChild,0);i.addRange(t)},_openAlert:function(t){this._alertWindow.find(".e-alerttext").html(t);this._alertWindow.ejDialog("instance")._centerPosition();n("#"+this._rteId+"_Alert_wrapper").css({"z-index":this._onGetMaxZindex()});this._alertWindow.ejDialog("open")},_renderFormat:function(){this._formatDDL=t.buildTag("input#"+this._rteId+"_formatDDL","","",{type:"text",title:this._getLocalizedLabels("format"),"data-role":"none"});var n={};n.dataSource=this._formatText(this.model.format,[{text:"paragraph",value:"<p>"},{text:"quotation",value:"<blockquote>"},{text:"heading1",value:"<h1>"},{text:"heading2",value:"<h2>"},{text:"heading3",value:"<h3>"},{text:"heading4",value:"<h4>"},{text:"heading5",value:"<h5>"},{text:"heading6",value:"<h6>"}]);n.width="105px";n.enableRTL=this.model.enableRTL;n.popupWidth="175px";n.popupHeight="auto";n.selectedItemIndex=0;n.select=this._formatChange;n.cssClass="e-rte-format-ddl";n.showRoundedCorner=this.model.showRoundedCorner;n.fields={text:"text",value:"value",spriteCssClass:"spriteCssClass"};this._formatDDL.appendTo(this._rteToolbar.find("li.e-rteItem-format").html(""));this._formatDDL.ejDropDownList(n);this._formatPopupStyle()},_formatText:function(n,t){for(var r,i=0;i<n.length;i++)for(r=0;r<t.length;r++)if(n[i].value==t[r].value){n[i].text=this._getLocalizedLabels(t[r].text)?this._getLocalizedLabels(t[r].text):n[i].text;break}return n},_formatPopupStyle:function(){for(var i=this._formatDDL.data("ejDropDownList").popupPanelWrapper.find("li"),t=0;t<i.length;t++)n(i[t]).addClass(this.model.format[t].spriteCssClass)},_renderFontStyle:function(){this._fontStyleDDL=t.buildTag("input#"+this._rteId+"_fontNameDDL","","",{type:"text",title:this._getLocalizedLabels("fontName"),"data-role":"none"});var n={};n.dataSource=this._formatText(this.model.fontName,[{text:"timesnewroman",value:"Times New Roman,Times,serif"},{text:"segoeui",value:"Segoe UI"},{text:"arial",value:"Arial,Helvetica,sans-serif"},{text:"couriernew",value:"Courier New,Courier,monospace"},{text:"georgia",value:"Georgia,serif"},{text:"impact",value:"Impact,Charcoal,sans-serif"},{text:"lucidaconsole",value:"Lucida Console,Monaco,monospace"},{text:"tahoma",value:"Tahoma,Geneva,sans-serif"},{text:"trebuchetms",value:"Trebuchet MS,Helvetica,sans-serif"},{text:"verdana",value:"Verdana,Geneva,sans-serif"}]);n.enableRTL=this.model.enableRTL;n.selectedItemIndex=0;n.htmlAttributes={datafontid:""+this._rteId};n.select=this._fontStyleChange;n.showRoundedCorner=this.model.showRoundedCorner;n.fields={text:"text",value:"value"};this._fontStyleDDL.appendTo(this._rteToolbar.find("li.e-rteItem-fontName").html(""));this._fontStyleDDL.ejDropDownList(n)},_renderFontSize:function(){this._fontSizeDDL=t.buildTag("input#"+this._rteId+"_fontSizeDDL","","",{type:"text",title:this._getLocalizedLabels("fontSize"),"data-role":"none"});var n={};n.dataSource=this.model.fontSize;n.width="100px";n.enableRTL=this.model.enableRTL;n.selectedItemIndex=2;n.htmlAttributes={datafontid:""+this._rteId};n.select=this._fontSizeChange;n.showRoundedCorner=this.model.showRoundedCorner;n.fields={text:"text",value:"value"};this._fontSizeDDL.appendTo(this._rteToolbar.find("li.e-rteItem-fontSize").html(""));this._fontSizeDDL.ejDropDownList(n)},_renderFontColor:function(){var e=this,u,i,r,f;this._fontColorSplit=t.buildTag("button#"+this._rteId+"_fontColorbtn","",{},{type:"button","data-role":"none"});u=n("<ul id='"+this._rteId+"_colorTable' class='e-rte-colorpalette'><li><\/li><\/ul>");u.find("li").append(this._colorTable());i={};i.width="42px";i.contentType="textandimage";i.targetID=this._rteId+"_colorTable";i.enableRTL=this.model.enableRTL;i.prefixIcon=this._rteIconsList.fontColor;i.showRoundedCorner=this.model.showRoundedCorner;this._fontColorSplit.appendTo(this._rteToolbar.find("li.e-rteItem-fontColor").html(""));r=n("#"+this._rteId+"_colorTable").get(0);r&&(n(r).parent().hasClass("e-menu-wrap")?n(r).parent().remove():n(r).remove());f=n("<div class='customcolor e-rte-customcolor' "+this._TagId("_customcolor")+"><a class='customcolor-link' role='button' title='"+this._getLocalizedLabels("customColor")+"'>"+this._getLocalizedLabels("customFontColor")+"<\/a><\/div>");u.append(f);u.appendTo(this._rteToolbar.find("li.e-rteItem-fontColor"));this._on(f,"click",this._openColorpalette);this._fontColorSplit.ejSplitButton(i);this._splitObj=this._fontColorSplit.ejSplitButton("instance");this._splitObj.option("beforeOpen",function(){e._bindClickOperation("FontColor")});this._on(this._fontColorSplit,"click",this._fontColorClick);this._fontColorSplit.find("span."+this._rteIconsList.fontColor).removeClass("e-icon");this._fontColorSplit.find("span.e-btntxt").css("background-color",this._fontColor)},_renderUnOrderList:function(){var u=this,i,r;this._unOrderSplit=t.buildTag("button#"+this._rteId+"_unorder","",{},{type:"button","data-role":"none"});this._unorderLiTemplate=t.buildTag("ul#"+this._rteId+"_unorderlist","",{height:"auto",width:"84px"},{"class":"e-rte-unorderlistname"});n("<li id='none' title='"+this._getLocalizedLabels("none")+"' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-nonelist-icon'><\/span><\/li><li id='disc' title='"+this._getLocalizedLabels("disc")+"' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-disclist-icon'><\/span><\/li><li id='square' title='"+this._getLocalizedLabels("square")+"' class='square' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-squarelist-icon'><\/span><\/li><li id='circle' title='"+this._getLocalizedLabels("circle")+"' style='float:left;width:50%;'><span class='e-rte-toolbar-icon e-rte-unlistitems e-circlelist-icon'><\/span><\/li>").appendTo(this._unorderLiTemplate);t.isNullOrUndefined(u.model.tools.customUnorderedList)||n.each(u.model.tools.customUnorderedList,function(t,i){t==0&&n(u._unorderLiTemplate).find("#circle,#square").attr("class","e-liseparator");n("<li id='"+(i.name?i.name:"ulcustom"+t)+"' class='"+(i.css?i.css:"")+"' title='"+(i.tooltip?i.tooltip:"")+"' style='float:left;width:100%;'>"+(i.text?i.text:"")+"<\/li>").appendTo(u._unorderLiTemplate)});i={};i.width="42px";i.contentType="imageonly";i.targetID=this._rteId+"_unorderlist";i.enableRTL=this.model.enableRTL;i.prefixIcon="e-icon e-rte-toolbar-icon "+this._rteIconsList.unorderedList;i.showRoundedCorner=this.model.showRoundedCorner;i.itemSelected=n.proxy(this._onUnorderList,this);this._unOrderSplit.appendTo(this._rteToolbar.find("li.e-rteItem-unorderedList").html(""));r=n("#"+this._rteId+"_unorderlist").get(0);r&&(n(r).parent().hasClass("e-menu-wrap")?n(r).parent().remove():n(r).remove());this._unorderLiTemplate.appendTo(this._rteToolbar.parents("body").length>0?this._rteToolbar.find("li.e-rteItem-unorderedList"):n("body"));this._unOrderSplit.ejSplitButton(i);this._unOrderSplitObj=this._unOrderSplit.ejSplitButton("instance");this._unOrderSplit.find("span.e-unorderedList-icon").removeClass("e-icon");this._on(this._unOrderSplit,"click",this._onUnorderList)},_renderOrderList:function(){var u=this,i,r;this._orderSplit=t.buildTag("button#"+this._rteId+"_order","",{},{type:"button","data-role":"none"});this._orderLiTemplate=t.buildTag("ul#"+this._rteId+"_orderlist","",{height:"auto",width:"124.05px"},{"class":"e-rte-orderlistname"});n("<li id='none' title='"+this._getLocalizedLabels("none")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-nonelist-icon'><\/span><\/li><li id='decimal' title='"+this._getLocalizedLabels("number")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-numbering-icon'><\/span><\/li><li id='lower-alpha' title='"+this._getLocalizedLabels("loweralpha")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-loweralpha-icon'><\/span><\/li><li id='lower-roman' title='"+this._getLocalizedLabels("lowerroman")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-lowerroman-icon'><\/span><\/li><li id='upper-alpha' title='"+this._getLocalizedLabels("upperalpha")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-upperalpha-icon'><\/span><\/li><li id='upper-roman' title='"+this._getLocalizedLabels("upperroman")+"' style='float:left;width:33.33%;'><span class='e-rte-toolbar-icon e-rte-listitems e-upperroman-icon'><\/span><\/li>").appendTo(this._orderLiTemplate);t.isNullOrUndefined(u.model.tools.customOrderedList)||n.each(u.model.tools.customOrderedList,function(t,i){t==0&&n(u._orderLiTemplate).find("#upper-roman,#upper-alpha,#lower-roman").attr("class","e-liseparator");n("<li id='"+(i.name?i.name:"olcustom"+t)+"' class='"+(i.css?i.css:"")+"' title='"+(i.tooltip?i.tooltip:"")+"' style='float:left;width:100%;'>"+(i.text?i.text:"")+"<\/li>").appendTo(u._orderLiTemplate)});i={};i.width="42px";i.contentType="imageonly";i.enableRTL=this.model.enableRTL;i.showRoundedCorner=this.model.showRoundedCorner;i.targetID=this._rteId+"_orderlist";i.prefixIcon="e-icon e-rte-toolbar-icon "+this._rteIconsList.orderedList;i.itemSelected=n.proxy(this._onOrderList,this);this._orderSplit.appendTo(this._rteToolbar.find("li.e-rteItem-orderedList").html(""));r=n("#"+this._rteId+"_orderlist").get(0);r&&(n(r).parent().hasClass("e-menu-wrap")?n(r).parent().remove():n(r).remove());this._orderLiTemplate.appendTo(this._rteToolbar.parents("body").length>0?this._rteToolbar.find("li.e-rteItem-orderedList"):n("body"));this._orderSplit.ejSplitButton(i);this._orderSplitObj=this._orderSplit.ejSplitButton("instance");this._on(this._orderSplit,"click",this._onOrderList)},_renderBGColor:function(){var o=this,r,u,i,e,f;this._bgColorSplit=t.buildTag("button#"+this._rteId+"_backgroundColorbtn","",{},{type:"button","data-role":"none"});r=n("<ul id='"+this._rteId+"_colorBGTable' class='e-rte-colorpalette'><li><\/li><\/ul>");r.find("li").append(this._colorTable());u=n("<button id='"+this._rteId+"_backgroundtransparentbtn'class='e-rte-transbtn' role='button' title='"+this._getLocalizedLabels("TransBGColor")+"'>"+this._getLocalizedLabels("TransBGColor")+"<\/button>");i={};i.width="42px";i.contentType="textandimage";i.targetID=this._rteId+"_colorBGTable";i.enableRTL=this.model.enableRTL;i.prefixIcon=this._rteIconsList.backgroundColor;i.showRoundedCorner=this.model.showRoundedCorner;e=n("<div class='customBGcolor e-rte-customcolor' "+this._TagId("_customBGcolor")+"><a class='customcolor-link ' role='button' title='"+this._getLocalizedLabels("customBGColor")+"'>"+this._getLocalizedLabels("customBGColor")+"<\/a><\/div>");r.append(e);this._on(e,"click",this._openColorpalette);u.prependTo(r);this._bgColorSplit.appendTo(this._rteToolbar.find("li.e-rteItem-backgroundColor").html(""));f=n("#"+this._rteId+"_colorBGTable").get(0);f&&(n(f).parent().hasClass("e-menu-wrap")?n(f).parent().remove():n(f).remove());r.appendTo(this._rteToolbar.find("li.e-rteItem-backgroundColor"));this._bgColorSplit.ejSplitButton(i);u.ejButton({width:"100%",contentType:"text",targetID:this._rteId+"_colorBGTable",showRoundercorner:this.model.showRounderCorner});this._bgObj=u.ejButton("instance");this._on(u,"click",this._bgTransClick);this._bgSplitObj=this._bgColorSplit.ejSplitButton("instance");this._bgSplitObj.option("beforeOpen",function(){o._bindClickOperation("BGColor")});this._on(this._bgColorSplit,"click",this._bgColorClick);this._bgColorSplit.find("span."+this._rteIconsList.backgroundColor).removeClass("e-icon");this._bgColorSplit.find("span.e-btntxt").css("background-color",this._bgColor)},_bindClickOperation:function(t){var i=this,u=t=="BGColor"?i._bgSplitObj:i._splitObj,f=t=="BGColor"?"_backgroundColorbtn":"_fontColorbtn",r=t=="BGColor"?"_colorBGTable":"_colorTable";SplitMenu=n("#"+i._rteId+f).ejSplitButton("instance");t=="BGColor"?i._bgSplitMenu=SplitMenu:i._splitMenu=SplitMenu;SplitMenu.model.close=function(){u.contstatus=!1;i._off(n("#"+i._rteId+r).find("div.e-rte-palettetable"),"click",t=="BGColor"?i._bgColorPaletteClick:i._colorPaletteClick)};i._on(n("#"+i._rteId+r).find("div.e-rte-palettetable"),"click",t=="BGColor"?i._bgColorPaletteClick:i._colorPaletteClick)},_colorTable:function(){for(var u,f=t.buildTag("div.e-rte-table"),i=0,n,r,e=0;e<this.model.colorPaletteRows;e++){for(r=t.buildTag("div.e-rtetablerow"),u=0;u<this.model.colorPaletteColumns;u++)i<this.model.colorCode.length&&(n="#"+this.model.colorCode[i],tableCell=t.buildTag("div.e-rte-palettetable","",{"background-color":n},{title:n,"color-code":n}),tableCell.appendTo(r),i++);r.appendTo(f)}return f},_recalcVideoSize:function(n){var r,u,t,i;r=this._videoDialog.find(".e-rte-videoX");u=this._videoDialog.find(".e-rte-videoY");t=r.val();i=u.val();!this._chkvideoDimensions.ejCheckBox("isChecked")||!this._videoWidth||!this._videoHeight||!t||!i||(n.target.id==r[0].id?(i=Math.round(t/this._videoWidth*i),u.val(i)):(t=Math.round(i/this._videoHeight*t),r.val(t)));this._videoWidth=t;this._videoHeight=i},_recalcImgSize:function(n){var r,u,t,i;r=this._imgDialog.find(".e-rte-imgX");u=this._imgDialog.find(".e-rte-imgY");t=r.val();i=u.val();!this._chkImgDimensions.ejCheckBox("isChecked")||!this._imgWidth||!this._imgHeight||!t||!i||(n.target.id==r[0].id?(i=Math.round(t/this._imgWidth*i),u.val(i)):(t=Math.round(i/this._imgHeight*t),r.val(t)));this._imgWidth=t;this._imgHeight=i},_urlValidation:function(t){var i=n(t.target);i.hasClass("e-error")&&i.removeClass("e-error")},_ieLinkRange:function(){var n=this._getRange();this._isIE()||this._isIE8()?(t.isNullOrUndefined(this._currentSelNode)||this._currentSelNode.nodeName.toLowerCase()=="html"||n.setStart(this._currentSelNode,this._currentSelNode.childNodes.length),this._selectionRange=n):(t.isNullOrUndefined(this._currentSelNode)||this._currentSelNode.nodeName.toLowerCase()!="html",this._selectionRange=n)},_ieCursorMaintainance:function(){this._isIE8()?this._setRange(this._currentSelNode,this._getDocument().body.createTextRange(),!0):(this._ieLinkRange(),this._focus())},_linkBtnClick:function(n){n.target.id==="link_cancel"?(this._clearLinkFields(),this._linkDialog.ejDialog("close"),this._ieCursorMaintainance()):n.target.id==="link_insert"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._restoreSelection(this._selectionRange),this._txtURL.val()!=""?this._onInsertLink():(this._onUnlink(),this._linkDialog.ejDialog("close")),this._trigger("execute",{commandName:"hyperlink"}),this._onChange(),this._setBackupData())},_imageBtnClick:function(i){if(i.target.id===this._rteId+"_img_cancel")this._imgDialog.ejDialog("close"),this._ieCursorMaintainance();else if(i.target.id===this._rteId+"_img_insert"){var r=this._imgURL.val().match(/(ftp:|http:|https:)\/\//g);if(t.isNullOrUndefined(r)&&this._imgURL.val()!==""||!t.isNullOrUndefined(r)&&r[0].length<this._imgURL.val().length)this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length?this._onInsertImage():this._imgDialog.ejDialog("close"),this._onChange(),this._setBackupData();else return this._imgURL.addClass("e-error"),this._isUrl(n.trim(this._imageLink.val()))||this._imageLink.addClass("e-error"),!1}},_srcBtnClick:function(i){var r,u,f;if(i.target.id==="src_update"){r=n.trim(this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value);this.model.enableHtmlEncode&&(r=this._decode(r));try{this._getDocument().documentElement.innerHTML=r.replace("<html>","").replace("<\/html>","");this.model.enableXHTML&&(this._getDocument().documentElement.innerHTML=this._updateXhtml())}catch(e){u=/<body[^>]*>((.|[\n\r])*)<\/body>/i;t.isNullOrUndefined(u.exec(r))||(r=u.exec(r)[1],this._getDocument().body.innerHTML=r)}this._onChange();this._updateCount()}this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value="";f=n(this._getDocument()).find("table.e-rte-table");this.model.enableRTL||this._on(f,"mouseover",this._tableMouseOver);this._sourceDialog.ejDialog("close");this._showHideContextMenu()},_eTblBtnClick:function(n){n.target.id===this._rteId+"_eTbl_cancel"?(this._eTblDialog.ejDialog("close"),this._ieCursorMaintainance()):n.target.id===this._rteId+"_eTbl_apply"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._oneditTable(),this._onChange(),this._setBackupData())},_insertCustomTable:function(i){var f,r,u;if(this._customTableValidation=!1,i.target.id==="insert"){var e=this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("getValue"),o=this._customTableDialog.find(".e-rte-txtRows").ejNumericTextbox("getValue"),s=this._customInputValidation(this._customTableDialog.find(".e-rte-txtHeight")),h=this._customInputValidation(this._customTableDialog.find(".e-rte-txtWidth")),c=this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("getSelectedValue"),l=this._customInputValidation(this._customTableDialog.find(".e-rte-txtSpacing")),a=this._customInputValidation(this._customTableDialog.find(".e-rte-txtPadding")),v=this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("getSelectedValue"),y=this._chkTblCaption.ejCheckBox("isChecked");this._customTableValidation||(t.isNullOrUndefined(this._tableInsertAt)||t.isNullOrUndefined(this._tableInsertAt.startContainer)||this._restoreSelection(this._tableInsertAt),f=this._tableGenerator(o,e,!1,h,s,l,a,c,v,y),this.executeCommand("inserthtml",f),r=n(this._getDocument()).find("table.e-rte-table"),u=this._customTableDialog.find(".e-rte-ddlAlignment").data("ejDropDownList"),u.option("value")=="Center"&&r.attr("style","margin: 0 auto"),this.model.enableRTL||this._on(r,"mouseover",this._tableMouseOver),this._onChange(),u.option({value:"",enabled:!1}));this._on(this._customTableDialog.find(".e-rte-txtHeight"),"keypress",this._urlValidation)._on(this._customTableDialog.find(".e-rte-txtWidth"),"keypress",this._urlValidation)._on(this._customTableDialog.find(".e-rte-txtSpacing"),"keypress",this._urlValidation)._on(this._customTableDialog.find(".e-rte-txtPadding"),"keypress",this._urlValidation)}this._customTableValidation||(this._customTableDialog.ejDialog("close"),this._clearTableFields(),this._ieCursorMaintainance())},_customInputValidation:function(n){var t=n.val().toLowerCase(),i=t.substr(t.length-2,2),r=t.match(/[!@#$%^&*()_+\-=\[\]{};':"\\|,<>\/?]/gi),u=t.match(/[a-z]/gi);return!isNaN(t)&&(r==null||r.length==0)||t.length>1&&t.substr(t.length-1,1)=="%"&&r.length==1&&(u==null||u.length==0)||t.length>2&&(r==null||r.length==0)&&u!=null&&u.length==2&&(i=="px"||i=="in"||i=="cm"||i=="mm"||i=="em"||i=="ex"||i=="pt"||i=="pc")?t:(n.addClass("e-error"),this._customTableValidation=!0,0)},_clearTableFields:function(){this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("option","value",3);this._customTableDialog.find(".e-rte-txtRows").ejNumericTextbox("option","value",3);this._customTableDialog.find(".e-rte-txtHeight").val("");this._customTableDialog.find(".e-rte-txtWidth").val("");this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("clearText");this._customTableDialog.find(".e-rte-txtSpacing").val("");this._customTableDialog.find(".e-rte-txtPadding").val("");var n=this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("clearText"),t=this._chkTblCaption.ejCheckBox({check:!1})},_clearEditTableFields:function(){this._eTblHeight=this._eTblDialog.find("input").val("");this._eTblDialog.find(".e-numerictextbox").data("ejNumericTextbox").option("value","");this._eTblDialog.find(".e-rte-dropdown").data("ejDropDownList").option("value","");this._eTblAlign.disable();this._eTblCaption.ejCheckBox({check:!1})},_clearLinkFields:function(){this._txtURL=this._linkDialog.find(".e-rte-linkUrl");this._txtURL.removeClass("e-error");this._txtURL.val("http://");this._txtLinkText=this._linkDialog.find(".e-rte-linkText");this._txtLinkText.val("");this._txtLinkTitle=this._linkDialog.find(".e-rte-linkTitle");this._txtLinkTitle.val("");this._chkTarget.ejCheckBox({check:!1});this._txtURL.focus()},_textFieldFocus:function(n,t,i){if(this._isIE8()){var r=n.createTextRange();r.collapse(!0);r.moveEnd("character",t);r.moveStart("character",i);r.select()}else n.setSelectionRange(t,i)},_clearImgFields:function(){this._imgURL=this._imgDialog.find(".e-rte-imgUrl").val("http://").removeClass("e-error");this._imgDialog.find(".e-rte-imgText").val("");this._chkImgDimensions.ejCheckBox({checked:!0});this._imageLink=this._imgDialog.find(".e-rte-imgLink");this._imageLink.removeClass("e-error");this._imageLink.val("");this._imageBorderPx=this._imgDialog.find(".e-rte-imgBorderPx").data("ejNumericTextbox");this._imageBorderPx.option("value",0);this._imageBorderStyle=this._imgDialog.find(".e-rte-imgBorderStyle").data("ejDropDownList");this._imageBorderStyle.option("value","");this._imgPicker.option("value",null);this._imgDialog.find(".e-selected-color").removeAttr("style");this._imageStyle=this._imgDialog.find(".e-rte-imgStyle");this._imageStyle.val("");this._dialogchkTarget.ejCheckBox({check:!1})},_videoManager:function(){var i=this._getSelectedNode();this._editVideo=null;this._getPasteRangeVal();i&&!t.isNullOrUndefined(i.tagName)&&(this._editVideo=i,this._videoWidth=parseInt(n(i).width()),this._videoHeight=parseInt(n(i).width()),this.model.showDimensions&&(this._videoDialog.find(".e-rte-videoX").val(this._videoWidth),this._videoDialog.find(".e-rte-videoY").val(this._videoHeight)));n("#"+this._rteId+"_video_wrapper").css({"z-index":this._onGetMaxZindex()});this._videoDialog.ejDialog("open");this._videoDialog.find("textarea.e-rte-video").focus()},_sourceCodeManager:function(){t.isNullOrUndefined(this._sourceDialog)&&this._renderSourceDialog();this._updateTagInfo("body");this._hideTooltip();t.isNullOrUndefined(this._getDocument().documentElement)?this._htmlSource.addClass("e-disable"):(this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value=this.model.enableHtmlEncode?this._encode(this._getDocument().documentElement.outerHTML):this._getDocument().documentElement.outerHTML,n("#"+this._rteId+"_Source_wrapper").css({"z-index":this._onGetMaxZindex()}),this._sourceDialog.ejDialog("open"),this._sourceDialog.find("textarea.e-rte-srctextarea").focus())},_getPasteRangeVal:function(){this._isIE()&&(this._pasteRangeVal=this._getRange(),this._pasteFlag=!0)},_hyperLinkManager:function(i){this._getPasteRangeVal();var r=this._isIE()?this._currentSelNode:this._getSelectedNode();this._selectedHTML=t.browserInfo().name==="msie"&&t.browserInfo().version==="11.0"?this._pasteRangeVal.toString():this._getSelText();i?(this._clearFileFields(),!t.isNullOrUndefined(r)&&r.tagName.toUpperCase()=="A"?this._fileLinkText.val(n(r).html()):this._fileLinkText.val(this._selectedHTML),n("#"+this._rteId+"_fileDialog_wrapper").css({"z-index":this._onGetMaxZindex()}),this._fileDialog.ejDialog("open")):(this._clearLinkFields(),!t.isNullOrUndefined(r)&&r.tagName.toUpperCase()=="A"?this._txtLinkText.val(n(r).html()):this._txtLinkText.val(this._selectedHTML),n("#"+this._rteId+"_link_wrapper").css({"z-index":this._onGetMaxZindex()}),this._linkDialog.ejDialog("open"),this._textFieldFocus(this._txtURL[0],this._txtURL.val().length,this._txtURL.val().length));r&&!/^(A)$/.test(r.nodeName)&&r.tagName.toUpperCase()=="IMG"&&(r=n(r).parent("a")[0]);i?r&&/^(A)$/.test(r.nodeName)&&this._fileURL.val(r.href):r&&/^(A)$/.test(r.nodeName)&&(this._txtURL.val(r.href),this._txtLinkTitle.val(r.title))},_tableManager:function(){var r=this._rteToolbar.find("li.e-rteItem-createTable"),i,u,o,f,e;this._getPasteRangeVal();this._getSelectedNode().nodeName.toLowerCase()=="td"&&this._createTable.find("div.e-rte-eTblProperties").removeClass("e-disable");this.model.isResponsive&&r.length==0?(o=n(this._toolBarObj._liTemplte).outerHeight()-n(this._toolBarObj._liTemplte).height(),r=this._toolBarObj._liTemplte.find("li.e-rteItem-createTable"),n("#"+this._rteId+"_table_wrapper").css({visibility:"hidden",display:"block"}),u=n(this._toolBarObj._liTemplte).offset().top+n(this._toolBarObj._liTemplte).outerHeight()+o-n("#"+this._rteId+"_table_wrapper").offsetParent().offset().top,i=n(r).offset().left>230?n(r).offset().left-n("#"+this._rteId+"_table_wrapper").offsetParent().offset().left:n("#"+this._rteId+"_table_wrapper").offsetParent().offset().left,n("#"+this._rteId+"_table_wrapper").css({visibility:"visible"})):(i=n(r).position().left,u=n(r).position().top+r.height()+7);(parseInt(i)+parseInt(n("#"+this._id+"_table_wrapper").css("width"))>document.body.clientWidth||parseInt(i)+parseInt(n("#"+this._id+"_table_wrapper").css("width"))>parseInt(n("#"+this._id+"_wrapper").css("width"))+n("#"+this._id+"_wrapper").position().left)&&(i=parseInt(i)-(parseInt(n("#"+this._id+"_table_wrapper").css("width"))-n(r).width())+"px");f=document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop;f<u&&n(window).height()<u-f+parseInt(n("#"+this._id+"_table_wrapper").css("height"))&&(u=parseInt(n("#"+this._id+"_table_wrapper").css("height"))>n(window).height()?f:n(window).height()-parseInt(n("#"+this._id+"_table_wrapper").css("height"))>0?n(window).height()-parseInt(n("#"+this._id+"_table_wrapper").css("height"))+f:f);e=this._rteWapper.offset();i=parseInt(i)-parseInt(e.left);u=parseInt(u)-parseInt(e.top);this._createTable.ejDialog("option","position",{X:i,Y:u});this._createTable.ejDialog("open");this._on(t.getScrollableParents(this._createTable),"scroll",function(){this._createTable.ejDialog("close")})},_eTblManager:function(){var i,e,s,f,u;this._clearEditTableFields();var h=this._rteId,o=n(this._getSelectedNode()).closest("td"),r=o.length>0?o[0]:this._currentSelNode;t.isNullOrUndefined(r)||r.tagName.toLowerCase()!=="td"||(i=n(r).closest("tbody").closest("table"),this._getTableObj("Height").val(n(i).height()),this._getTableObj("Width").val(n(i).width()),t.isNullOrUndefined(i[0])||(this._getTableObj("CellSpace").data("ejNumericTextbox").option("value",i[0].cellSpacing),this._getTableObj("CellPad").data("ejNumericTextbox").option("value",i[0].cellPadding),e=i[0].align),t.isNullOrUndefined(e)||e==""||(this._eTblAlign.enable(),this._eTblAlign.option("value",e)),s=n(n(r).closest("tbody")).prev("caption"),s.length>0&&this._eTblCaption.ejCheckBox({checked:!0}),t.isNullOrUndefined(i[0])||i[0].style==""||(this._getTableObj("BrdrPx").data("ejNumericTextbox").option("value",i[0].style.borderWidth.split("px")[0]),u=this._getTableObj("_border_style").data("ejDropDownList"),i[0].style.borderStyle!=""?u.selectItemByValue(i[0].style.borderStyle):u.option({selectedItemIndex:0}),this._getTableObj("_border_color").val(i[0].style.borderColor)),this._getTableObj("Style").val(i.attr("style")),f=n(r).closest("tr"),this._getTableObj("RHeight").val(n(f).height()),this._getTableObj("RAlign").data("ejDropDownList").option("value",f[0].style.textAlign),f[0].style!=""&&(this._getTableObj("RBrdrPx").data("ejNumericTextbox").option("value",f[0].style.borderWidth.split("px")[0]),u=this._getTableObj("RBrdrStyle").data("ejDropDownList"),f[0].style.borderStyle!=""?u.selectItemByValue(f[0].style.borderStyle):u.option({selectedItemIndex:0}),this._getTableObj("RBrdrColor").val(f[0].style.borderColor)),this._getTableObj("RStyle").val(f.attr("style")),this._getTableObj("ClWidth").val(n(r).width()),this._getTableObj("ClAlign").data("ejDropDownList").option("value",r.style.textAlign),r.style!=""&&(this._getTableObj("ClBrdrPx").data("ejNumericTextbox").option("value",r.style.borderLeftWidth.split("px")[0]),u=this._getTableObj("ClBrdrStyle").data("ejDropDownList"),r.style.borderStyle!=""?u.selectItemByValue(r.style.borderStyle):u.option({selectedItemIndex:0}),this._getTableObj("ClBrdrColor").val(r.style.borderColor)),this._getTableObj("ClStyle").val(n(r).attr("style")))},_getTableObj:function(n){return this._eTblDialog.find("#"+this._rteId+"_eTbl"+n)},_imageManager:function(){var i,u,r;this._clearImgFields();i=this._isIE()?this._currentSelNode:this._getSelectedNode();this._getPasteRangeVal();i&&!t.isNullOrUndefined(i)&&(this._imgWidth=parseInt(n(i).width()),this._imgHeight=parseInt(n(i).height()),this.model.showDimensions&&(this._imgDialog.find(".e-rte-imgX").val(this._imgWidth),this._imgDialog.find(".e-rte-imgY").val(this._imgHeight)),u=n(i).parent("a"),u.length>0&&this._imageLink.val(u.attr("href")),i.tagName.toLowerCase()==="img"&&(this._imgDialog.find(".e-rte-imgUrl").val(i.src),this._imgDialog.find(".e-rte-imgText").val(i.alt),i.style!=""&&(this._imageBorderPx.option("value",i.style.borderWidth.split("px")[0]),this._imageBorderStyle.option("value",i.style.borderStyle),i.style.borderColor.length>0&&(t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0"?this._imgPicker.option("value",i.style.borderColor):(r=i.style.borderColor.split("(")[1].split(")")[0],r=r.split(","),r={r:n.trim(r[0]),g:n.trim(r[1]),b:n.trim(r[2])},this._imgPicker.option("value",this._imgPicker.RGBToHEX(r))))),this._imageStyle.val(n(i).attr("style"))));n("#"+this._rteId+"_Image_wrapper").css({"z-index":this._onGetMaxZindex()});this._imgDialog.ejDialog("open");this._textFieldFocus(this._imgURL[0],this._imgURL.val().length,this._imgURL.val().length);t.isNullOrUndefined(this._explorerObj)&&this._imgDialog.find(".e-rte-imgUrl").focus()},_getValidbrowser:function(n){switch(n){case"chrome":return t.browserInfo().version<42;case"mozilla":return t.browserInfo().version<41;case"opera":return t.browserInfo().version<29;default:return!0}},_alertHeader:function(n){n._alertWindow.ejDialog("option","showHeader",!1);this.model.enableRTL&&!this._alertWindow.find(".e-alert-ok").hasClass("e-rte-alertBtnRTL")&&this._alertWindow.find(".e-alert-ok").addClass("e-rte-alertBtnRTL");n._alertWindow.find(".e-rte-button").css({"text-align":"","padding-bottom":"","padding-top":""}).addClass("e-fieldseparate");n._alertWindow.ejDialog("instance").refresh()},_toolBarClick:function(i){var o,s,f;if(!i.event||!(i.event.which&&i.event.which==3||i.event.button&&i.event.button==2)){var h=n(this.itemsContainer).closest("div.e-rte").find("textarea.e-rte"),r=h.ejRTE("instance"),e=h.attr("id"),u=t.isNullOrUndefined(e)?i.currentTarget.id.replace("_",""):i.currentTarget.id.replace(e+"_","");if(r._alertHeader(r),t.browserInfo().name==="mozilla"&&(r._getDocument().designMode="off"),n(i.currentTarget).hasClass("e-rteItem-copy")&&!r._isIE()&&r._getValidbrowser(t.browserInfo().name)?r._openAlert(r._getLocalizedLabels("copyAlert")):n(i.currentTarget).hasClass("e-rteItem-cut")&&!r._isIE()&&r._getValidbrowser(t.browserInfo().name)?r._openAlert(r._getLocalizedLabels("cutAlert")):n(i.currentTarget).hasClass("e-rteItem-paste")&&!r._isIE()?r._openAlert(r._getLocalizedLabels("pasteAlert")):(t.browserInfo().name!="chrome"&&(f=r._scriptsItems.indexOf(u),r._scriptsItems.indexOf(u)>=0&&n("#"+e+"_"+r._scriptsItems[f==0?1:0]).hasClass("e-active")&&r._selectCommand(e+"_"+r._scriptsItems[f==0?1:0])),o=n.grep(i.currentTarget.children[0].className.split(/\s+/),function(n){return!/^e-(rteItem|rte-toolbar-icon)$/i.test(n)}),(o.indexOf("e-split")>=0||o.indexOf("e-ddl")>=0)&&(o[0]=u),r._selectCommand(o[0])),r._styleItems.indexOf(u)>=0||r._scriptsItems.indexOf(u)>=0)n(i.currentTarget).hasClass("e-isactive")?this.deselectItemByID(i.currentTarget.id):this.selectItemByID(i.currentTarget.id),n(i.currentTarget).hasClass("e-isactive")?n(i.currentTarget).removeClass("e-isactive"):n(i.currentTarget).addClass("e-isactive"),r._scriptsItems.indexOf(u)>=0&&(f=r._scriptsItems.indexOf(u),n("#"+e+"_"+r._scriptsItems[f==0?1:0]).removeClass("e-isactive"),this.deselectItemByID(e+"_"+r._scriptsItems[f==0?1:0]));else if(r._alignItems.indexOf(u)>=0)for(this.selectItemByID(i.currentTarget.id),f=r._alignItems.indexOf(u),s=0;s<r._alignItems.length;s++)s!=f&&this.deselectItemByID(e+"_"+r._alignItems[s]);else r._listItems.indexOf(u)>=0&&(n(i.currentTarget).hasClass("e-isactive")?this.deselectItemByID(i.currentTarget.id):this.selectItemByID(i.currentTarget.id),n(i.currentTarget).hasClass("e-isactive")?n(i.currentTarget).removeClass("e-isactive"):n(i.currentTarget).addClass("e-isactive"),f=r._listItems.indexOf(u),n("#"+e+"_"+r._listItems[f==0?1:0]).removeClass("e-isactive"),f==0?this.deselectItemByID(e+"_"+r._listItems[1]):this.deselectItemByID(e+"_"+r._listItems[0]))}},_toggleEditTable:function(){var r,i,u,f;if(this._isIE8()&&this._getRange().parentElement&&(this._currentSelNode=this._getRange().parentElement()),r=n(this._getSelectedNode()).closest("table"),i=r.length>0?r[0]:this._getSelectedNode(),t.isNullOrUndefined(i))return!1;t.isNullOrUndefined(this._toolBarItems)||(f=this._rteToolbar.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable"),u=this.model.isResponsive&&f.length==0?this._toolBarObj._liTemplte.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable"):this._toolBarItems.find("li.e-rteItem-addColumnLeft,li.e-rteItem-addColumnRight,li.e-rteItem-addRowAbove,li.e-rteItem-addRowBelow,li.e-rteItem-deleteRow,li.e-rteItem-deleteColumn,li.e-rteItem-deleteTable"),t.isNullOrUndefined(i.tagName)||(i&&i.tagName&&i.tagName.toLowerCase()=="td"||i.tagName.toLowerCase()=="table"||i.tagName.toLowerCase()=="tr"?(u.show(),this._createTable&&this._createTable.find("div.e-rte-eTblProperties").removeClass("e-disable")):t.isNullOrUndefined(this._createTable)||(u.hide(),this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable"))));this.model.isResponsive&&this.model.showToolbar&&this._toolBarObj._reSizeHandler();(!this.model.autoHeight||this._toolBarObj&&n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.resize)).length)&&this._setIframeHeight()},_formatChange:function(t){if(t.isInteraction){var r=n(this.element).closest("div.e-rte").find("textarea.e-rte"),i=r.ejRTE("instance"),u=r.attr("id");t.value!==""&&i._onFormatBlock(t.value);i._isIE()&&i._focus();i._onChange();i._setBackupData()}},_fontStyleChange:function(t){var r,i,u;t.isInteraction&&(r=n(this.element).closest("div").hasClass("e-normal")?n("textarea#"+t.model.htmlAttributes.datafontid):n(this.element).closest("div.e-rte").find("textarea.e-rte"),i=r.ejRTE("instance"),u=r.attr("id"),i._focus(),t.value!==""&&i._onFontName(t.value),i._onChange(),i._setBackupData())},_fontSizeChange:function(t){var r,i,u;t.isInteraction&&(r=n(this.element).closest("div").hasClass("e-normal")?n("textarea#"+t.model.htmlAttributes.datafontid):n(this.element).closest("div.e-rte").find("textarea.e-rte"),i=r.ejRTE("instance"),u=r.attr("id"),i._focus(),t.value!==""&&i._onFontSize(t.value),i._onChange(),i._setBackupData())},_colorPaletteClick:function(n){var t;(t=n.target.getAttribute("color-code"))&&(this._focus(),this._onFontColor(t),this._splitMenu.hide(n),this._fontColor=t,this._fontColorSplit.find("span.e-btntxt").css("background-color",t),this._onChange(),this._setBackupData())},_bgColorPaletteClick:function(n){var t;(t=n.target.getAttribute("color-code"))&&(this._focus(),this._onBGColor(t),this._bgSplitMenu.hide(n),this._bgColor=t,this._bgColorSplit.find("span.e-btntxt").css("background-color",t),this._onChange(),this._setBackupData())},_fontColorClick:function(n){if(this._onFontColor(this._fontColor),t.isNullOrUndefined(this._splitMenu))return!1;this._splitMenu.hide(n)},_bgTransClick:function(n){this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.backcolor,"transparent");this._trigger("execute",{commandName:"backColor"});this._bgColorSplit.find("span.e-btntxt").css("background-color","transparent");!t.isNullOrUndefined(this._bgSplitMenu);this._bgSplitMenu.hide(n);this._bgColor="transparent"},_bgColorClick:function(n){if(this._onBGColor(this._bgColor),t.isNullOrUndefined(this._bgSplitMenu))return!1;this._bgSplitMenu.hide(n)},_selectCommand:function(i){n(this._imgDupDiv).remove();n(this._imgOrg).css("outline","");t.browserInfo().name=="edge"||i=="format"||i=="fontName"||i=="fontSize"||i=="fontColor"||i=="backgroundColor"||i=="createTable"||this._focus();switch(i){case"fullScreen":this._onFullScreen();break;case"print":this._onPrint();break;case"import":this._onImport();break;case"wordExport":this._onExportToWord();break;case"pdfExport":this._onExportToPdf();break;case"findAndReplace":t.RTE.FindAndReplace&&this._showFindAndReplace();break;case"bold":this._onBold();break;case"italic":this._onItalics();break;case"underline":this._onUnderLine();break;case"strikethrough":this._onStrikeThrough();break;case"justifyLeft":this._onJustifyLeft();break;case"justifyRight":this._onJustifyRight();break;case"justifyCenter":this._onJustifyCenter();break;case"justifyFull":this._onJustifyFull();break;case"cut":this._onCut();break;case"copy":this._onCopy();break;case"paste":this._onPaste();break;case"clearFormat":this._onClearFormat();break;case"clearAll":this._clearAllManager();break;case"orderedList":case"unorderedList":this._getPasteRangeVal();break;case"undo":this._undo();break;case"redo":this._redo();break;case"indent":this._onIndent();this._indentdepth++;break;case"outdent":this._onOutdent();this._indentdepth>0&&this._indentdepth--;break;case"createLink":this._hyperLinkManager(!1);break;case"removeLink":this._onUnlink();break;case"image":this._imageManager();break;case"createTable":this._createTable.ejDialog("isOpen")?this._createTable.ejDialog("close"):this._tableManager();break;case"addRowAbove":this.insertRow(!0);break;case"addRowBelow":this.insertRow(!1);break;case"addColumnLeft":this.insertColumn(!0);break;case"addColumnRight":this.insertColumn(!1);break;case"deleteRow":this.removeRow();break;case"deleteColumn":this.removeColumn();break;case"deleteTable":this.removeTable();break;case"superscript":this._onSuperScript();break;case"subscript":this._onSubScript();break;case"upperCase":this._onUpperCase();break;case"lowerCase":this._onLowerCase();break;case"video":this._videoManager();break;case"fileBrowser":this._hyperLinkManager(!0);break;default:this._onChange()}i!="createLink"&&i!="image"&&i!="video"&&i!="createTable"&&this._onChange();i!="undo"&&i!="redo"&&this._setBackupData();var r=this._isIE()?this._currentSelNode:this._getSelectedNode();this._updateTagInfo(r)},_focus:function(){browserInfo=t.browserInfo();browserInfo.name=="webkit"?this._getWindow().focus():this._getWindow().document.body.focus();this._restoreSelection(this._selectionRange)},_getWindow:function(){return n(n(this._rteWapper.find(".content-iframe"))[0].contentWindow)[0]},_getDocument:function(){var n=this._rteWapper.find(".content-iframe");try{return n.contents()[0]}catch(t){return""}},_onFullScreen:function(){n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.resize)).length?(n(this._rteWapper).css({top:this._rteOffset.top,left:this._rteOffset.left,width:this._rteWidth,height:this._rteHeight,position:this._rtePosition,"z-index":""}),n("body").css("overflow",""),n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.resize)).addClass(this._rteIconsList.maximize).removeClass(this._rteIconsList.resize).parent("li").attr("data-content",this._getLocalizedLabels("maximize"))):(this._rteOffset=n(this._rteWapper).position(),this._rtePosition=n(this._rteWapper).css("position"),n(this._rteWapper).css({top:"0px",left:"0px",width:"100%",height:"100%",position:"fixed","z-index":this._onGetMaxZindex()}),n("body").css("overflow","hidden"),n(this._toolBarObj.itemsContainer.find("."+this._rteIconsList.maximize)).removeClass(this._rteIconsList.maximize).addClass(this._rteIconsList.resize).parent("li").attr("data-content",this._getLocalizedLabels("resize")));n(this._getDocument()).find("table.e-rte-table").length>0&&this._removeResizeObject();this._setAutoHeight();this.model.showToolbar&&this.model.isResponsive&&this._toolBarObj._reSizeHandler();this._setIframeHeight();t.isNullOrUndefined(this._createTable)||this._createTableClose()},_onGetMaxZindex:function(){return Math.max.apply(null,n.map(n("body *"),function(t){return parseInt(n(t).css("z-index"))+1||1}))},_onZooming:function(i){i._zoomValue=0;var r=Number(i.getDocument().body.style.zoom==""||t.isNullOrUndefined(i.getDocument().body.style.zoom)?1:i.getDocument().body.style.zoom),u=isNaN(i.model.zoomStep)&&i.model.zoomStep.indexOf("%")!=-1?parseInt(i.model.zoomStep)/100:Number(i.model.zoomStep);return i._zoomValue=i._zoomArgs=="IN"?r+u:r-u>.1?r-u:.1,n(i.getDocument().body).css({zoom:i._zoomValue,transform:"scale("+i._zoomValue+")","transform-origin":"0 0","-o-transform":"scale("+i._zoomValue+")","-o-transform-origin":"0 0","-webkit-transform":"scale("+i._zoomValue+")","-webkit-transform-origin":"0 0"}),n(i._toolBarObj.itemsContainer.find(".e-rteItem-zoomIn")).attr("title",i._getLocalizedLabels("zoomIn")+" "+Math.round(i._zoomValue*100)+"%"),n(i._toolBarObj.itemsContainer.find(".e-rteItem-zoomOut")).attr("title",i._getLocalizedLabels("zoomOut")+" "+Math.round(i._zoomValue*100)+"%"),i._isIE()?i:void 0},_onKeyZoom:function(n){var t=this;this._mouseStillDown=!0;this._zoomArgs=n;this._setInterval=setInterval(t._onZooming(t),100)},_onPrint:function(){var i=this;this._isIE()||t.browserInfo().name==="mozilla"?this._getWindow().onafterprint=function(){n(i.getDocument().body).css({zoom:i._zoomValue?i._zoomValue:1,transform:"scale("+(i._zoomValue?i._zoomValue:1)+")","transform-origin":"0 0","-o-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-o-transform-origin":"0 0","-webkit-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-webkit-transform-origin":"0 0"})}:i._getWindow().matchMedia("print").addListener(function(t){t.matches||n(i.getDocument().body).css({zoom:i._zoomValue?i._zoomValue:1,transform:"scale("+(i._zoomValue?i._zoomValue:1)+")","transform-origin":"0 0","-o-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-o-transform-origin":"0 0","-webkit-transform":"scale("+(i._zoomValue?i._zoomValue:1)+")","-webkit-transform-origin":"0 0"})});n(i.getDocument().body).css({zoom:"",transform:"","-o-transform":"","-webkit-transform":""});this._getWindow().print()},_renderimport:function(){var i=t.buildTag("div#"+this._id+"_importUpload","","",""),r=this.model.importSettings.url+"?rteid="+this._id;this._rteToolbar.find("li.e-rteItem-import").append(i);i.ejUploadbox({multipleFilesSelection:!1,width:"0px",height:"0px",autoUpload:!0,extensionsAllow:".docx,.doc",showBrowseButton:!1,buttonText:{browse:this._id},showFileDetails:!1,saveUrl:r,success:function(t){var u=t.model.buttonText.browse,f=n("#"+u).data("ejRTE"),i=t.responseText,r=n(f._getDocument().body);i=i.replace('<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">',"").replace("<\/string>","").replace(/"/gi,"");r.children().remove();r.append(n.parseHTML(i))}});i.addClass("e-browse-hide")},_onImport:function(){this._toolBarItems.find("div#"+this._id+"_importUpload").find("input[type=file]").trigger("click")},_onExportToWord:function(){var r=this._getDocument().body,u=this.model.exportToWordSettings.url,f=r.innerHTML,e={action:u+"?rteid="+this._id,method:"post"},i=t.buildTag("form","",null,e),o={name:this._id+"_inputVal",type:"hidden",value:f},s=t.buildTag("input","",null,o),h={name:this._id+"_inputFile",type:"hidden",value:this.model.exportToWordSettings.fileName},c=t.buildTag("input","",null,h);n("body").append(i.append(s).append(c));i.submit();i.remove()},_onExportToPdf:function(){var r=this._getDocument().body,u=this.model.exportToPdfSettings.url,f=r.innerHTML,e={action:u+"?rteid="+this._id,method:"post"},i=t.buildTag("form","",null,e),o={name:this._id+"_inputVal",type:"hidden",value:f},s=t.buildTag("input","",null,o),h={name:this._id+"_inputFile",type:"hidden",value:this.model.exportToPdfSettings.fileName},c=t.buildTag("input","",null,h);n("body").append(i.append(s).append(c));i.submit();i.remove()},_zoomUp:function(n){n&&(n.which&&n.which==3||n.button&&n.button==2)||this._setInterval&&(this._mouseStillDown=!1,clearInterval(this._setInterval),this._setInterval=null)},_zoomDown:function(t){if(!t||!(t.which&&t.which==3||t.button&&t.button==2)){var i=this;i._mouseStillDown=!0;i._zoomArgs=n(t.target).hasClass("e-rte-toolbar-icon zoomIn "+this._rteIconsList.zoomIn)||n(t.target).hasClass("e-rteItem-zoomIn")?"IN":"OUT";i._setInterval=t.type=="mousedown"?setInterval(function(){i._onZooming(i)},100):setInterval(i._onZooming(i),100)}},_onBold:function(){var n;this._isIE8()?this.executeCommand("bold",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.bold,null),this._trigger("execute",{commandName:"bold"}))},_onItalics:function(){var n;this._isIE8()?this.executeCommand("italic",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.italic,null),this._trigger("execute",{commandName:"italic"}))},_onStrikeThrough:function(){var n;this._isIE8()?this.executeCommand("strikethrough",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.strikethrough,null),this._trigger("execute",{commandName:"strikethrough"}))},_onUnderLine:function(){var n;this._isIE8()?this.executeCommand("underline",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.underline,null),this._trigger("execute",{commandName:"underline"}))},_onJustifyLeft:function(){var n;this._isIE8()?this.executeCommand("JustifyLeft",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifyleft,null),this._trigger("execute",{commandName:"JustifyLeft"}))},_onJustifyRight:function(){var n;this._isIE8()?this.executeCommand("JustifyRight",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifyright,null),this._trigger("execute",{commandName:"JustifyRight"}))},_onJustifyCenter:function(){var n;this._isIE8()?this.executeCommand("JustifyCenter",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifycenter,null),this._trigger("execute",{commandName:"JustifyCenter"}))},_onJustifyFull:function(){this._alignFlag=!0;this._isIE8()?this.executeCommand("justifyfull"):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.justifyfull,null),this._trigger("execute",{commandName:"justifyfull"}))},_onCut:function(){var n;this.executeCommand("cut",n)},_onCopy:function(){var n;this.executeCommand("copy",n)},_onOpen:function(){var t=this._isIE()?this._currentSelNode:this._getSelectedNode();window.open(n(t).attr("href"))},_onPaste:function(){var n;this.executeCommand("paste",n)},_onOrderList:function(i){var r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode(),u;(n(r).prop("tagName")=="OL"||n(r).parents("ol").length!=0||i.ID=="none")&&i.type!="click"&&(!(n(r).prop("tagName")=="OL"||n(r).parents("ol").length>0)||i.ID!="none")||t.isNullOrUndefined(i.ID)&&this._listOrderType=="none"||this.executeCommand("insertorderedlist","listItem");r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode();i.type=="click"&&n(r).parents("ol").length>=0&&(i.ID=this._listOrderType);t.isNullOrUndefined(i.ID)||(u=n(r).prop("tagName")=="OL"?r:n(r).parents("ol"));this._generateListItems(i,u,t.isNullOrUndefined(this.model.tools.customOrderedList)?[]:this.model.tools.customOrderedList);this._listOrderType=i.ID;this._updateIndent(r)},_onUnorderList:function(i){var r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode(),u;(n(r).prop("tagName")=="UL"||n(r).parents("ul").length!=0||i.ID=="none")&&i.type!="click"&&(!(n(r).prop("tagName")=="UL"||n(r).parents("ul").length>0)||i.ID!="none")||t.isNullOrUndefined(i.ID)&&this._listType=="none"||this.executeCommand("insertunorderedlist","listItem");r=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode();i.type=="click"&&n(r).parents("ul").length>=0&&(i.ID=this._listType);t.isNullOrUndefined(i.ID)||(u=n(r).prop("tagName")=="UL"?r:n(r).parents("ul"));this._generateListItems(i,u,t.isNullOrUndefined(this.model.tools.customUnorderedList)?[]:this.model.tools.customUnorderedList);this._listType=i.ID;this._updateIndent(r)},_generateListItems:function(t,i,r){n(i).css({"list-style-type":t.ID,"list-style-image":""});var u=this;["none","disc","circle","square","decimal","upper-roman","lower-roman","upper-alpha","lower-alpha"].indexOf(t.ID)==-1&&n.each(r,function(r,u){u.name==t.ID&&n(i).css({"list-style-type":u.listStyle,"list-style-image":u.listImage})});this._setBackupData();this._isIE()?this.selectRange(this._pasteRangeVal):this.selectRange(this._getRange());this._updateTagInfo(this._isIE()?this._currentSelNode:this._getSelectedNode())},_onUndo:function(){this._isIE8()?this.executeCommand("undo",null):this._undo()},_onDelete:function(){this.executeCommand("delete",null)},_onRedo:function(){this._isIE8()?this.executeCommand("redo",null):this._redo()},_onClearFormat:function(){var n;this.executeCommand("removeformat",n);this._hideTooltip();this._setBackupData();this._onChange();this._updateIframeSkin(this.model.iframeAttributes);this._updateToolbarStatus()},_onFormatBlock:function(n){if(this._focus(),this._isIE8()){var i;i=document.getSelection?this._getSelectedNode():this._getWindow().document.selection.createRange().parentElement();this._onClearFormat();this.executeCommand("formatBlock",n)}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.formatblock,n),this._trigger("execute",{commandName:"formatBlock"});this._updateToolbarStatus();this._updateFontOptionStatus()},_onFontName:function(n){this._isIE8()?this.executeCommand("fontName",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.fontname,n),this._trigger("execute",{commandName:"fontName"}))},_onFontSize:function(n){this._isIE8()?this.executeCommand("fontSize",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.fontsize,n),this._trigger("execute",{commandName:"fontSize"}))},_onFontColor:function(n){this._customDialogobj.isOpen()&&(this._fontColorSplit.find("span.e-btntxt").css("background-color",n),this._customColor.ejDialog("close"));this._isIE8()?this.executeCommand("foreColor",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.forecolor,n),this._trigger("execute",{commandName:"foreColor"}));this._onChange();this._updateIframeSkin(this.model.iframeAttributes)},_onBGColor:function(n){this._customDialogobj.isOpen()&&(this._bgColorSplit.find("span.e-btntxt").css("background-color",n),this._customColor.ejDialog("close"));this._isIE8()?this.executeCommand("backColor",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.backcolor,n),this._trigger("execute",{commandName:"backColor"}));this._onChange()},_onIndent:function(){if(this._isIE8()){this._getWindow().document.body.style.wordWrap="break-word";var i=document.getSelection?this._getWindow().document.getSelection().focusNode:this._getWindow().document.selection.createRange().parentElement();i&&/^(OL|UL|LI)$/.test(i.nodeName)?this._listIndent(i):i&&/^(#text)$/.test(i.nodeName)&&/^(OL|UL|LI)$/.test(n(i).parent()[0].nodeName)?this._listIndent(n(i).parents("li")[0],i):this.executeCommand("indent",!1);i&&n(i).focus()}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.indent,null),this._trigger("execute",{commandName:"indent"});this._updateIframeSkin(this.model.iframeAttributes);this._updateIndentStatus()},_onOutdent:function(){if(this._isIE8()){var i=document.getSelection?this._getWindow().document.getSelection().focusNode:this._getWindow().document.selection.createRange().parentElement();i&&/^(OL|UL|LI)$/.test(i.nodeName)?this._listOutdent(i):i&&/^(#text)$/.test(i.nodeName)&&/^(OL|UL|LI)$/.test(n(i).parent()[0].nodeName)?this._listOutdent(n(i).parents("li")[0],i):this.executeCommand("outdent",!1)}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.outdent,null),this._trigger("execute",{commandName:"outdent"});this._updateIndentStatus()},_onSelectAll:function(){this.executeCommand("selectall")},selectAll:function(){this._onSelectAll()},_onHyperLink:function(n){this.executeCommand("createlink",n)},_onInsertLink:function(){var r,u,i,f;if(!this._isUrl(n.trim(this._txtURL.val())))return this._txtURL.addClass("e-error"),!1;i=(t.browserInfo().name=="msie"||t.browserInfo().name=="chrome")&&n(this._currentSelNode).parents("body").length>0?this._currentSelNode:this._getSelectedNode();t.isNullOrUndefined(i)||i.tagName.toUpperCase()!="A"?t.isNullOrUndefined(i)||i.tagName.toUpperCase()!="IMG"?(r=t.buildTag("a","",{},{href:this._txtURL.val(),title:this._txtLinkTitle.val()==""?this._txtURL.val()+"\n"+this._getLocalizedLabels("linkTooltip"):this._txtLinkTitle.val()}),r[0].target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"",this._focus(),this._isIE()?(this._selectedHTML.length==0&&(this._selectedHTML=this._txtLinkText.val()===""?this._txtURL.val():this._txtLinkText.val()),r[0].innerHTML=this._selectedHTML,u=r[0].outerHTML):(this._txtLinkText.val()===""?r.html(this._txtURL.val()):r.html(this._txtLinkText.val()),u=n("<div>").append(n(r).clone()).html()),u&&this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length&&(this._isIE()?this._pasteHtml(u):this._getDocument().execCommand("inserthtml",!1,u),this.selectRange(this._getRange()))):(f=n(i).parent("a")[0],t.isNullOrUndefined(f)?(r=t.buildTag("a","",{},{href:this._txtURL.val(),title:this._txtLinkTitle.val()==""?this._txtURL.val()+"\n"+this._getLocalizedLabels("linkTooltip"):this._txtLinkTitle.val()}),r[0].target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"",n(i.outerHTML).appendTo(n(r)),n(i).replaceWith(n(r))):(f.href=this._txtURL.val(),f.title=this._txtLinkTitle.val(),f.target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"")):(i.href=this._txtURL.val(),i.title=this._txtLinkTitle.val(),i.innerHTML=this._txtLinkText.val(),i.target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"");this._linkDialog.ejDialog("close");this.enableToolbarItem("removeLink");this._updateCount()},_setImageProperties:function(i,r,u,f,e,o,s){this.model.showDimensions&&(r!=""&&(i[0].width=r),u!=""&&(i[0].height=u));i=n(i).attr("style",f);border=e+"px ";border+=!t.isNullOrUndefined(o)&&o!=""?o+" ":"solid ";border+=!t.isNullOrUndefined(s)&&s!=""?s:"#000000";i=i.css("border",border)},_onInsertImage:function(){var o=this._imgDialog.find(".e-rte-imgUrl"),h=this._imgDialog.find(".e-rte-imgText"),c=this._imgDialog.find(".e-rte-imgX").val(),l=this._imgDialog.find(".e-rte-imgY").val(),i=this,s,w,r;this._restoreSelection(this._selectionRange);var a="",f=i._imageLink.val(),v=i._imageBorderPx.getValue(),y=i._imageBorderStyle.getSelectedValue(),e=i._imgPicker.getValue(),p=i._imageStyle.val(),u=i._isIE()?i._currentSelNode:i._getSelectedNode();if(t.isNullOrUndefined(u)||(a=u.nodeName.toUpperCase()),e=!t.isNullOrUndefined(e)&&e.length>0?e:"",s=o.val().startsWith("~")?o.val().replace(o.val().substr("0","1"),".."):o.val(),a!="IMG")w=n("<img>",{src:s,error:function(){o.addClass("e-error")},success:function(){var r=t.buildTag("img","",{},{alt:h.val(),src:s}),u,o;if(i._setImageProperties(r,c,l,p,v,y,e),f!="")if(i._isUrl(n.trim(f)))u=t.buildTag("a","",{},{href:f}),u[0].target=i._dialogchkTarget.ejCheckBox("isChecked")?"_blank":"_self",n(r[0].outerHTML).appendTo(u),r=u;else return i._imageLink.addClass("e-error"),!1;o=r[0].outerHTML;i.executeCommand("inserthtml",o)}});else{if(u.src=s,u.alt=h.val(),i._setImageProperties(n(u),c,l,p,v,y,e),r=n(u).parent("a"),f!="")if(i._isUrl(n.trim(f)))r.length>0?r.attr("href",f):(r=t.buildTag("a","",{},{href:f}),n(u.outerHTML).appendTo(r),n(u).replaceWith(r));else return i._imageLink.addClass("e-error"),!1;else r.length>0&&r.attr("href","");!t.isNullOrUndefined(r)&&r.length>0&&(r[0].target=this._dialogchkTarget.ejCheckBox("isChecked")?"_blank":"_self")}i._setAutoHeight();i._imageLink.hasClass("e-error")||i._imgDialog.ejDialog("close");i._on(i._imageLink,"keypress",i._urlValidation)._on(i._imageLink,"blur",i._urlValidation)},_insertVideo:function(i){var u=n.trim(this._videoDialog.find("textarea.e-rte-video")[0].value),f=this._videoDialog.find(".e-rte-videoX").val(),e=this._videoDialog.find(".e-rte-videoY").val(),r;this._restoreSelection(this._selectionRange);this._alertHeader(this);i.target.id==="video_insert"&&u!==""?(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),r=n(u)[0],this.model.showDimensions&&!t.isNullOrUndefined(r)&&(f!=""&&(r.width=f),e!=""&&(r.height=e)),!t.isNullOrUndefined(r)&&this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length&&this.executeCommand("inserthtml",r.outerHTML+"<br/>"),this._onChange(),this._setBackupData(),this._videoDialog.ejDialog("close")):i.target.id==="video_cancel"?(this._videoDialog.ejDialog("close"),this._ieCursorMaintainance()):this._openAlert(this._getLocalizedLabels("videoError"));this._videoDialog.find("textarea.e-rte-video")[0].value="";this._videoDialog.find(".e-rte-videoX").val("");this._videoDialog.find(".e-rte-videoY").val("");this._chkvideoDimensions.ejCheckBox({check:!0});this._setAutoHeight()},_oneditTable:function(){var e=n(this._getSelectedNode()).closest("td"),i=e.length>0?e[0]:this._currentSelNode,o=n(i).closest("tbody").closest("table"),u=n(n(i).closest("tbody")).prev("caption"),f,r,s;this._eTblCaption.ejCheckBox("isChecked")?u.length==0&&t.buildTag("caption").append(n('<br type="_moz">')).insertBefore(n(n(i).closest("tbody"))):u.length>0&&u.remove();f=this._eTblAlign.getSelectedValue();r=this._getTableObj("Style").val();f=="center"&&(r+=";margin: 0 auto;");r&&o.attr("style",r);this._customTableValidation=!1;var h=this._customInputValidation(this._getTableObj("Width")),c=this._customInputValidation(this._getTableObj("Height")),l=this._customInputValidation(this._getTableObj("RHeight")),a=this._customInputValidation(this._getTableObj("ClWidth"));this._customTableValidation||(o.css({width:h,height:c,cellPadding:this._getTableObj("CellPad").data("ejNumericTextbox").getValue(),cellSpacing:this._getTableObj("CellSpace").data("ejNumericTextbox").getValue(),float:f,"border-width":this._getTableObj("BrdrPx").data("ejNumericTextbox").getValue()+"px","border-style":this._getTableObj("_border_style").data("ejDropDownList").getSelectedValue(),"border-color":this._getTableObj("_border_color").val()}),s=n(i).closest("tr"),s.attr({style:this._getTableObj("RStyle").val()}).css({height:l,"text-align":this._getTableObj("RAlign").data("ejDropDownList").getSelectedValue(),"border-width":this._getTableObj("RBrdrPx").data("ejNumericTextbox").getValue()+"px","border-style":this._getTableObj("RBrdrStyle").data("ejDropDownList").getSelectedValue(),"border-color":this._getTableObj("RBrdrColor").val()}),n(i).attr({style:this._getTableObj("ClStyle").val()}).css({width:a,"text-align":this._getTableObj("ClAlign").data("ejDropDownList").getSelectedValue(),"border-width":this._getTableObj("ClBrdrPx").data("ejNumericTextbox").getValue()+"px","border-style":this._getTableObj("ClBrdrStyle").data("ejDropDownList").getSelectedValue(),"border-color":this._getTableObj("ClBrdrColor").val()}),this._eTblDialog.ejDialog("close"));this._on(this._getTableObj("Width"),"keypress",this._urlValidation)._on(this._getTableObj("Height"),"keypress",this._urlValidation)._on(this._getTableObj("RHeight"),"keypress",this._urlValidation)._on(this._getTableObj("ClWidth"),"keypress",this._urlValidation)},_clearAllManager:function(){this._hideTooltip();this._alertWindow.find(".e-alert-cancel").show();this._alertHeader(this);this._openAlert(this._getLocalizedLabels("deleteAlert"))},_onUnlink:function(){var n;this.executeCommand("unlink",n);this.disableToolbarItem("removeLink")},_onSuperScript:function(){var n;this._isIE8()?this.executeCommand("SuperScript",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.superscript,null),this._trigger("execute",{commandName:"SuperScript"}))},_onSubScript:function(){var n;this._isIE8()?this.executeCommand("SubScript",n):(this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.subscript,null),this._trigger("execute",{commandName:"SubScript"}))},_onInsertTable:function(i,r,u){if(this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length){n(this._getDocument().body).css("display","inline-block");var f=this._tableGenerator(i,r,u);this.executeCommand("inserthtml",f);(t.isNullOrUndefined(n(this._getDocument().body).find("table:last")[0].nextSibling)||n(this._getDocument().body).find("table:last")[0].nextSibling.nodeName.toLowerCase()=="#text"&&n.trim(n(this._getDocument().body).find("table:last")[0].nextSibling.nodeValue)=="\n")&&n("<p><br/><\/p>").insertAfter(n(this._getDocument().body).find("table"));n(this._getDocument().body).css("display","");this._setAutoHeight()}},_onUpperCase:function(){if(this._isIE8())if(document.getSelection){var a=this._getWindow().getSelection(),i=this._saveSelection(),r=i.commonAncestorContainer,f=i.commonAncestorContainer.children;if(f!=null){var e=i.cloneContents(),o=this._changeCase(e,"Upper"),s=n(o).clone(),u=document.createElement("div");n(u).append(n(s));u.innerHTML!=null&&u.innerHTML!=""&&this._getWindow().document.execCommand("inserthtml",!1,u.innerHTML)}else{var h=r.nodeValue.substring(i.startOffset,i.endOffset).toUpperCase(),c=r.nodeValue.substr(0,i.startOffset),l=r.nodeValue.substring(i.endOffset);r.nodeValue=c+h+l}}else{if(this._getWindow().document.selection.type.toLowerCase()=="control")return;this._seleText=t.isNullOrUndefined(this._seleText)?"":this._seleText;this._getDocument().selection.createRange().pasteHTML(this._seleText.toUpperCase())}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.uppercase,null);this._trigger("execute",{commandName:"uppercase"})},_changeCase:function(n,t){var i=n.childNodes,r;if(i.length>0)for(r=0;r<i.length;r++)i[r].nodeType==3?i[r].nodeValue=t=="Upper"?i[r].nodeValue.toUpperCase():i[r].nodeValue.toLowerCase():i[r].nodeType==1&&i[r].tagName.toUpperCase()!="FONT"&&this._changeCase(i[r],t);return i},_onLowerCase:function(){if(this._isIE8())if(document.getSelection){var a=this._getWindow().getSelection(),i=this._saveSelection(),r=i.commonAncestorContainer,f=i.commonAncestorContainer.children;if(f!=null){var e=i.cloneContents(),o=this._changeCase(e,"Lower"),s=n(o).clone(),u=document.createElement("div");n(u).append(n(s));u.innerHTML!=null&&u.innerHTML!=""&&this._getWindow().document.execCommand("inserthtml",!1,u.innerHTML)}else{var h=r.nodeValue.substring(i.startOffset,i.endOffset).toLowerCase(),c=r.nodeValue.substr(0,i.startOffset),l=r.nodeValue.substring(i.endOffset);r.nodeValue=c+h+l}}else{if(this._getWindow().document.selection.type.toUpperCase()=="control")return;this._seleText=t.isNullOrUndefined(this._seleText)?"":this._seleText;this._getDocument().selection.createRange().pasteHTML(this._seleText.toLowerCase())}else this._getDocumentHandler()&&this._operationHandler.execCommand(t.execCommand.lowercase,null);this._trigger("execute",{commandName:"lowercase"})},_listIndent:function(n){var i,r;return(i=n.previousSibling,i&&this._isListNode(i))?(i.appendChild(n),!0):i&&i.nodeName=="LI"&&this._isListNode(i.lastChild)?(i.lastChild.appendChild(n),this._combineLists(n.lastChild,i.lastChild,n),!0):(i=n.nextSibling,i&&this._isListNode(i))?(i.insertBefore(n,i.firstChild),!0):i&&i.nodeName=="LI"&&this._isListNode(n.lastChild)?!1:(i=n.previousSibling,i&&i.nodeName=="LI")?(r=t.buildTag(n.parentNode.nodeName)[0],i.appendChild(r),r.appendChild(n),this._combineLists(n.lastChild,r,n),!0):!0},_combineLists:function(t,i,r){var u;if(this._isListNode(t)){while(u=r.lastChild.firstChild)i.appendChild(u);n(t).remove()}},_isListNode:function(n){return n&&/^(OL|UL)$/.test(n.nodeName)},_isFirstChild:function(n){return n.parentNode.firstChild==n},_isLastChild:function(n){return n.parentNode.lastChild==n},_removeEmptyList:function(t){t&&n(t).children().length===0&&n(t).remove()},_listOutdent:function(t){var r=n(t.parentNode),i=r[0].parentNode;return(t=n(t),this._isFirstChild(t[0])&&this._isLastChild(t[0]))?(i.nodeName=="LI"?(t.insertAfter(i),this._removeEmptyList(i),r.remove()):this._isListNode(i)?r.remove():this.executeCommand("outdent",!1),!0):this._isFirstChild(t[0])?(i.nodeName=="LI"?(t.insertAfter(i),t[0].appendChild(r[0]),this._removeEmptyList(i)):this._isListNode(i)?i.insertBefore(t[0],r[0]):this.executeCommand("outdent",!1),!0):this._isLastChild(t[0])?(i.nodeName=="LI"?t.insertAfter(i):this._isListNode(i)?t.insertAfter(r[0]):this.executeCommand("outdent",!1),!0):(this.executeCommand("outdent",!1),!1)},_updateIndent:function(i){t.isNullOrUndefined(this._toolBarObj)||(n("#"+this._rteId+"_indent").hasClass("e-disable")&&this._toolBarObj.enableItemByID(this._rteId+"_indent"),i&&/^(LI)$/.test(i.nodeName)&&n(i).parents(i.parentNode.nodeName).last().find("li").index(i)===0&&this._toolBarObj.disableItemByID(this._rteId+"_indent"))},_updateCount:function(){t.isNullOrUndefined(this.model)||(this.model.showFooter&&this.model.showWordCount&&(this._wordCount.html(this._getLocalizedLabels("words")+" : "+(n.trim(this._getText())!=""?n.trim(this._getText()).split(/\W+/).length:0)),this._rteFooter.width()<400&&this._wordCount.html(this._getLocalizedLabels("w")+" : "+(n.trim(this._getText())!=""?n.trim(this._getText()).split(/\W+/).length:0))),this.model.showFooter&&this.model.showCharCount&&(this._charCount.html(this._getLocalizedLabels("characters")+" : "+this._getText().length),this._rteFooter.width()<400&&this._charCount.html(this._getLocalizedLabels("c")+" : "+this._getText().length)))},_updateTagInfo:function(i){var f="",e,o=1,r,u;if(t.isNullOrUndefined(i)||(i.localName=="body"||i.localName=="html")&&(i=this._getSelectedNode()),this._curNode=t.isNullOrUndefined(i)?"":i.tagName?i.tagName.toLowerCase():"html",this.model.showFooter&&this.model.showHtmlTagInfo){if(this._curNode!="html"&&this._curNode!==""){for(r=n(i).parents(),u=r.length-1;u>=0;u--)e=r[u].tagName.toLowerCase(),e!="html"?f+=" » "+e:o++;f+=" » "+this._curNode;n(i).parents().length>0&&(t.isNullOrUndefined(r[r.length-o])||(this._pTag=r[r.length-o].tagName.toLowerCase()))}this._tags=f;this._responsiveTagList()}},_responsiveTagList:function(){n(this._htmlInfo).html(this._tags);n(this._rteWapper).outerWidth()<n(this._rteWapper).find(".e-rte-footer-left").outerWidth()+n(this._rteWapper).find(".e-rte-footer-right").outerWidth()?n(this._htmlInfo).html(" » "+this._pTag+" » ... ... » "+this._curNode):n(this._htmlInfo).html(this._tags)},_removeNoSpaceChar:function(n){return n&&(n=n.replace(/[\uFEFF]/g,"")),n},_updateValue:function(){var n=this._removeNoSpaceChar(this._updateXhtml());this.model.enableHtmlEncode&&(n=this._encode(this._decode(n)));this.value(n);this.element.val(n)},_imageXhtml:function(n){for(var v=/<img(.*?)>/ig,c,u=0,i=[],o,r,f;(c=v.exec(n))!==null;)i.push(c[0].toString());for(o=[],o=i.slice(0),r=0;r<i.length;r++)i[r].indexOf("/")==-1?i[r]=i[r].substr(0,i[r].length)+"/"+i[r].substr(i[r].length-1,i[r].length):i[r].lastIndexOf("/")!=i[r].length-2&&(i[r]=i[r].substr(0,i[r].length-1)+"/"+i[r].substr(i[r].length-1,i[r].length));var l=/(alt)=("[^"]*")/i,e=/(src)=("[^"]*")/g,a=/(src)=('[^"]*')/g;for(r=0;r<i.length;r++){var y=t.isNullOrUndefined(l.exec(i[r]))?/(alt)=('[^"]*')/i.exec(i[r]):l.exec(i[r]),p=t.isNullOrUndefined(e.exec(i[r]))?a.exec(i[r]):e.exec(i[r]),s=t.isNullOrUndefined(i[r].match(e))?i[r].match(a):i[r].match(e),h=t.isNullOrUndefined(i[r].match(/(alt)=("[^"]*")/g))?i[r].match(/(alt)=('[^"]*')/g):i[r].match(/(alt)=("[^"]*")/g);if(y==null&&h==null)i[r]=i[r].substr(0,i[r].length-2)+' alt=""'+i[r].substr(i[r].length-2,i[r].length);else for(u=h.length-1;u>0;u--)i[r]=i[r].replace(h[u],"");if(p==null&&s==null)i[r]=i[r].substr(0,i[r].length-2)+' src=""'+i[r].substr(i[r].length-2,i[r].length);else for(u=s.length-1;u>0;u--)i[r]=i[r].replace(s[u],"")}for(f=0;f<i.length;f++)n=n.replace(o[f],i[f]);return n},_tagCssReplace:function(n,i,r){var f=/(style)=("[^"]*")/i.exec(i),u;if(f!=null)return u=f[0],n!=""&&(u=u.substr(0,u.length-1)+n+';"'),t.isNullOrUndefined(n)||(i=i.replace(r[0],"").replace(f[0],u)),i},_updateIndentStatus:function(){this._isIE8()?n(this._getSelectedNode()).closest("BLOCKQUOTE").length>0?this.enableToolbarItem("outdent"):this.disableToolbarItem("outdent"):this._getDocumentHandler()&&this._operationHandler._validateIndent(this._getRange().startContainer)?this.enableToolbarItem("outdent"):this.disableToolbarItem("outdent")},_replaceHeightWidth:function(n,i){var u=n.exec(i),r;return t.isNullOrUndefined(u)||(r=u[0],r=r.replace(/\"/gi,"").replace("=",":")),this._tagCssReplace(r,i,u)},_typeXhtmlValidation:function(){var n=styleRegval[0];n=n=='type="a"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("a","lower-alpha"):n=='type="A"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("A","upper-alpha"):n=='type="1"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("1","decimal"):n=='type="i"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("i","lower-roman"):n=='type="I"'?n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("I","upper-roman"):n.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type")},_getCssXhtml:function(n,i){var u=n.exec(i),r;return t.isNullOrUndefined(u)||(r=u[0],r=r.replace(/\"/gi,"").replace("=",":").replace("valign","text-align").replace("align","text-align"),i=i.replace(u[0],'style="'+r+';"')),i},_styleXhtml:function(n){for(var v=/<((?:(?!\/)).)*?>/ig,a,r=[],c,u,f,e,o,s,l,h,i;(a=v.exec(n))!==null;)r.push(a[0].toString());for(c=[],c=r.slice(0),i=0;i<r.length;i++){if(r[i].indexOf("style=")!=-1){if(r[i].indexOf("height=")!=-1&&(e=/( height)=("[^"]*")/i,r[i]=this._replaceHeightWidth(e,r[i])),r[i].indexOf("width=")!=-1&&(o=/( width)=("[^"]*")/i,r[i]=this._replaceHeightWidth(o,r[i])),r[i].indexOf("type=")!=-1&&(s=/( type)=("[^"]*")/i,u=s.exec(r[i]),t.isNullOrUndefined(u)||(f=this._typeXhtmlValidation(r[i])),r[i]=this._tagCssReplace(f,r[i],u)),r[i].indexOf("valign=")!=-1){var l=/( valign)=("[^"]*")/i,u=l.exec(r[i]),f=u[0];f=r[i].indexOf("vertical-align:")!=-1?"":f.replace(/\"/gi,"").replace("=",":").replace("valign","vertical-align");r[i]=this._tagCssReplace(f,r[i],u)}r[i].indexOf("align=")!=-1&&(h=/( align)=("[^"]*")/i,u=h.exec(r[i]),t.isNullOrUndefined(u)||(f=u[0],f=r[i].indexOf("text-align:")!=-1?"":f.replace(/\"/gi,"").replace("=",":").replace("align","text-align")),r[i]=this._tagCssReplace(f,r[i],u))}r[i].indexOf("style=")==-1&&(r[i].indexOf("height=")!=-1&&(e=/(height)=("[^"]*")/i,r[i]=this._getCssXhtml(e,r[i])),r[i].indexOf("width=")!=-1&&(o=/(width)=("[^"]*")/i,r[i]=this._getCssXhtml(o,r[i])),r[i].indexOf("type=")!=-1&&(s=/( type)=("[^"]*")/i,r[i]=this._getCssXhtml(s,r[i])),r[i].indexOf("valign=")!=-1&&(l=/(valign)=("[^"]*")/i,r[i]=this._getCssXhtml(l,r[i])),r[i].indexOf("align=")!=-1&&(h=/(align)=("[^"]*")/i,r[i]=this._getCssXhtml(h,r[i])))}for(i=0;i<r.length;i++)n=n.replace(c[i],r[i]);return n},_getFormatXhtml:function(n,t){for(var r=[],u,i;(u=n.exec(t))!=null;)r.push(u[0]);for(i=0;i<r.length;i++)t=t.replace(r[i],"")},_startXhtml:function(n){if(n.indexOf("start=")!=-1)n=this._getFormatXhtml(/start=\"(.*?)\"/ig,n);return n},_fontXhtml:function(n){if(n.indexOf("<font")!=-1)n=this._getFormatXhtml(/<font(.*?)>/ig,n);return n},_filerXhtmlNode:function(n,t){for(var i=[],r;(r=n.exec(t))!=null;)i.push(r[0]);return i},_replaceXhtmlNode:function(n,t,i){for(var r=0;r<n.length;r++)t=t.replace(i[r],n[r]);return t},_tdXhtml:function(n){var t=[],r,i,u;for(t=this._filerXhtmlNode(/<td((?:(?!<\/td>).))*?<td/ig,n),r=[],r=t.slice(0),i=0;i<t.length;i++)u=t[i].lastIndexOf("<td"),t[i]=t[i].substr(0,u)+"<\/td>"+t[i].substr(u,t[i].length);return this._replaceXhtmlNode(t,n,r)},_ptagXhtml:function(n){var f=/<\/p>((?:(?!<p).))*<\/p>/ig,r,i=[],u,t;if((r=f.exec(n))!=null)while((r=f.exec(n))!=null)i.push(r[0]);for(u=[],u=i.slice(0),t=0;t<i.length;t++)i[t].indexOf("<p")==-1&&(i[t]=i[t].substr(0,i[t].length-4));for(t=0;t<i.length;t++)n=n.replace(u[t],i[t]);return n},_getUpdaeNodeXhtml:function(n,t,i){for(var r;(r=n.exec(t))!=null;)i.push(r[0]);return i},_replaceUpdateXhtml:function(n,t,i){for(var r=[],r=this._getUpdaeNodeXhtml(n,t,r),u=0;u<r.length;u++)t=t.replace(r[u],i);return t},_replaceXhtmlVal:function(n,t,i){for(var r=0;r<n.length;r++)t=t.replace(i[r],n[r]);return t},_replaceTagUpdateXhtml:function(n,t,i,r){var u=[],f;return u=this._getUpdaeNodeXhtml(n,t,u),f=[],f=u.slice(0),u[0]=i+u[0]+r,t.replace(f[0],u[0])},_replaceTagXHTML:function(n,t){var i=[],u,r;for(i=this._getUpdaeNodeXhtml(n,t,i),u=[],u=i.slice(0),r=0;r<i.length;r++)i[r]=i[r].replace(/<br\/>/gi,"");return this._replaceXhtmlVal(i,t,u)},_replaceInputParams:function(n,t){var i=[],u,r,f;for(i=this._getUpdaeNodeXhtml(n,t,i),u=[],u=i.slice(0),r=0;r<i.length;r++)f=i[r].indexOf(">"),i[r]=i[r].substr(0,f)+"/"+i[r].substr(f,i[r].length-1);return this._replaceXhtmlVal(i,t,u)},_updateXhtml:function(){var w=this._getDocument().body.innerHTML,n,b,et,ct,pt,p,lt,ft,u,k,st,wt,d,at,rt,i,s,l,ot,g,v,ht,nt,o,h,bt,kt,a,vt,dt,c,gt,f,y,tt,it,e,yt,r;if(this.model.enableXHTML){if(w=w.replace(/hhh/g,"").replace(/<br>/g,"<br/>").replace(/contenteditable="false"/g,"").replace(/contenteditable="true"/g,"").replace(/ /g," ").replace(/<hr>/g,"<hr/>").replace(/cellspacing =[0-9]/g,"").replace(/cellpadding =[0-9]/g,""),this.value(w),this._xhtmlTagValidation(),w=this.value(),n=w.replace(/\s+/g," ").replace(/> </gi,"><"),n.indexOf("<?xml")!=-1)for(var ni=/<?xml:(.*?)>/ig,ut=[],b=0;(xmlTemp=ni.exec(n))!=null;)f=n.indexOf("<?xml"),ut[b]=xmlTemp[0],ut[b]=n.substr(f,ut[b].length+2),n=n.replace(ut[b],""),b++;if(n.indexOf("<table")!=-1){for(ft=/<table(.*?)<\/table>/ig,u=[],u=this._getUpdaeNodeXhtml(ft,n,u),k=[],k=u.slice(0),r=0;r<u.length;r++)if(u[r]=u[r].replace(/<p>/gi,"").replace(/<\/p>/gi,""),u[r].indexOf("<p")!=-1)for(b=0;b<u[r].length;b++)if(et=u[r].indexOf("<p"),ct=0,et!=-1)for(f=et+4;f<u[r].length-7;f++)u[r].charAt(f)==">"&&ct==0&&(u[r]=u[r].substr(0,et)+u[r].substr(f+1,u[r].length-1),ct++);n=this._replaceXhtmlVal(u,n,k)}if(n.indexOf("<td")!=-1)for(r=0;r<2;r++)n=this._tdXhtml(n);if(n.indexOf("<tr")!=-1){for(pt=/<tr(.*?)>(?!<\/td>)/ig,p=[],p=this._getUpdaeNodeXhtml(pt,n,p),lt=[],lt=p.slice(0),r=0;r<p.length;r++)p[r].indexOf("<\/td>")!=-1&&(p[r]=p[r].replace("<\/td>",""));for(n=this._replaceXhtmlVal(p,n,lt),ft=/<tr(.*?)<\/tr>/ig,u=[],u=this._getUpdaeNodeXhtml(ft,n,u),k=[],k=u.slice(0),r=0;r<u.length;r++)h=u[r].lastIndexOf("<\/tr>"),ot=u[r].charAt(h-5)+u[r].charAt(h-4)+u[r].charAt(h-3)+u[r].charAt(h-2)+u[r].charAt(h-1),ot!="<\/td>"&&(u[r]=u[r].substr(0,h)+"<\/td>"+u[r].substr(h,u[r].length));n=this._replaceXhtmlVal(u,n,k)}if(n.indexOf("<input")!=-1&&(st=/<input((?:(?!\/).))*?>/ig,n=this._replaceInputParams(st,n),n=n.replace(/<\/input>/gi,"")),n.indexOf("<param")!=-1&&(st=/<param((?:(?!\/).))*?>/ig,n=this._replaceInputParams(st,n),n=n.replace(/<\/param>/gi,"")),n.indexOf("<p ")!=-1||n.indexOf("<p>")!=-1){if(wt=/<p(.*)<\/p>/ig,d=[],d=this._getUpdaeNodeXhtml(wt,n,d),at=[],at.slice(0),rt=d[0].length-1,i=d[0],i.indexOf("<p")!=-1)for(s=i.indexOf("<p");s<=rt;s++)if(h="",r=0,s<rt-3&&(h=i.charAt(s)+i.charAt(s+1)),h=="<p")for(l=s+1;l<=rt;l++)if((ot=i.charAt(l)+i.charAt(l+1)+i.charAt(l+2)+i.charAt(l+3))=="<\/p>"&&r++,(ot=i.charAt(l)+i.charAt(l+1))=="<p"){if(r==0&&i.indexOf("<div")!=-1&&(g=i.substr(s,l-s),g.indexOf("<div")!=-1)){for(v=g.indexOf("<div"),ht=0,o=s+v+1;o<i.length-1;o++)h=i.charAt(o)+i.charAt(o+1)+i.charAt(o+2)+i.charAt(o+3)+i.charAt(o+4)+i.charAt(o+5),h=="<\/div>"&&ht==0&&(nt=o);i=i.substr(0,s+v)+"<\/span><\/p>"+i.substr(s+v,-(s+v)+nt+6)+"<p><span>"+i.substr(nt+6,i.length-1);r++}if(r==0){if(i.indexOf("<table")!=-1&&(g=i.substr(s,l-s),g.indexOf("<table")!=-1)){for(v=g.indexOf("<table"),ht=0,o=s+v+1;o<i.length-1;o++)h=i.charAt(o)+i.charAt(o+1)+i.charAt(o+2)+i.charAt(o+3)+i.charAt(o+4)+i.charAt(o+5)+i.charAt(o+6)+i.charAt(o+7),h=="<\/table>"&&ht==0&&(nt=o);i=i.substr(0,s+v)+"<\/span><\/p>"+i.substr(s+v,-(s+v)+nt+8)+"<p><span>"+i.substr(nt+8,i.length-1);r++}r==0&&(i=i.substr(0,l-1)+"<\/p>"+i.substr(l,i.length-1),rt++,r++)}}for(i=i.replace(/<\/p><\/p>/gi,"<\/p>"),bt=[],bt=d.slice(0),r=0;r<2;r++)i=this._ptagXhtml(i);for(kt=/<p(.*?)<\/p>/ig,a=[],a=this._getUpdaeNodeXhtml(kt,i,a),vt=[],vt.slice(0),f=0;f<a.length;f++)a[f].indexOf("<table")!=-1&&(y=/<table(.*)<\/table>/ig,a[f]=this._replaceTagUpdateXhtml(y,a[f],"<\/span><\/p>","<p><span>")),a[f].indexOf("<div")!=-1&&(y=/<div(.*)<\/div>/ig,a[f]=this._replaceTagUpdateXhtml(y,a[f],"<\/span><\/p>","<p><span>"));i=this._replaceXhtmlVal(a,i,vt);n=n.replace(at[0],i)}if(n.indexOf("<span")!=-1){for(dt=/<span(.*?)<\/span>/ig,c=[],c=this._getUpdaeNodeXhtml(dt,n,c),gt=[],sapnEX=c.slice(0),f=0;f<c.length;f++)c[f].indexOf("<table")!=-1&&(y=/<table(.*)<\/table>/ig,c[f]=this._replaceTagUpdateXhtml(y,c[f],"<\/span>","<span>")),c[f].indexOf("<div")!=-1&&(y=/<div(.*)<\/div>/ig,c[f]=this._replaceTagUpdateXhtml(y,c[f],"<\/span>","<span>")),c[f].indexOf("<p")!=-1&&(y=/<p(.*)<\/p>/ig,c[f]=this._replaceTagUpdateXhtml(y,c[f],"<\/span>","<span>"));n=this._replaceXhtmlVal(c,n,gt)}if(n.indexOf("<ol")!=-1&&(tt=/<ol(.*?)<\/ol>/ig,n=this._replaceTagXHTML(tt,n)),n.indexOf("<table")!=-1&&(tt=/<table(.*?)><\/table>/ig,n=this._replaceTagXHTML(tt,n)),n.indexOf("style")!=-1&&(tt=/style="(.*?)"/ig,n=this._replaceTagXHTML(tt,n)),t.isNullOrUndefined(this._fontXhtml(n))||(n=this._fontXhtml(n)),(n.indexOf("<br ")!=-1||n.indexOf("<br>")!=-1)&&(e=/<br(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"<br/>")),(n.indexOf("<strong ")!=-1||n.indexOf("<strong>")!=-1)&&(e=/<strong((?:(?!r).))*?>/ig,n=this._replaceUpdateXhtml(e,n,"<b>").replace(/<\/strong>/gi,"<\/b>")),n.indexOf("<strong ")!=-1&&(e=/<strong (.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"<b>").replace(/<\/strong>/gi,"<\/b>")),n.indexOf("<u")!=-1&&(e=/<u((?:(?!l).))*?>/ig,n=this._replaceUpdateXhtml(e,n,'<span style="text-decoration: underline;">').replace(/<\/u>/gi,"<\/span>")),n.indexOf("<hr")!=-1&&(e=/<hr(.*?)>/ig,it=[],n=this._replaceUpdateXhtml(e,n,"<hr/>")),t.isNullOrUndefined(this._startXhtml(n))||(n=this._startXhtml(n)),n.indexOf("v:shapes=")!=-1&&(e=/v:shapes=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("v:")!=-1&&(e=/<v:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("/v:")!=-1&&(e=/<\/v:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("o:")!=-1&&(e=/<o:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("/o:")!=-1&&(e=/<\/o:(.*?)>/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("role=")!=-1&&(e=/role=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("target=")!=-1&&(e=/target=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("language=")!=-1&&(e=/language=\"(.*?)\"/ig,n=this._replaceUpdateXhtml(e,n,"")),n.indexOf("lang=")!=-1)for(e=/lang=\"(.*?)\"/ig,it=this._getUpdaeNodeXhtml(e,n,it),yt=[],yt=it.slice(0),r=0;r<it.length;r++)n=n.replace(yt[r],it[r].toLowerCase());n=n.replace(/<\/td><\/td>/gi,"<\/td>").replace(/<\/th><\/td>/gi,"<\/th>");n=n==""||/<div class="e-xhtml">/ig.test(n)?n:"<div class='e-xhtml'>"+n+"<\/div>";w=n.replace(/"/g,"'").replace(/cellspacing=("[0-9]")/g,"").replace(/cellSpacing=("[0-9]")/g,"").replace(/cellpadding=("[0-9]")/g,"").replace(/cellPadding=("[0-9]")/g,"").replace(/border=("[^"]")/g,"").replace(/<!--(.*?)-->/gm,"").replace(/(vAlign)=("[^"]*")/g,"").replace(/(valign)=("[^"]*")/g,"").replace(/(colspan)=("[^"]*")/g,"").replace(/(colSpan)=("[^"]*")/g,"");this.value(w)}return w},_setClearFormat:function(){var n=this._rteToolbar.find(".e-active").length},_updateToolbarStatus:function(){var i,t;try{if(i=!1,this.model.showToolbar){for(t=0;t<this._styleItems.length;t++)this._getCommandStatus(n.trim(this._styleItems[t].toLowerCase()))?(this._toolBarObj.selectItemByID(this._rteId+"_"+this._styleItems[t]),n("#"+this._rteId+"_"+this._styleItems[t]).addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_"+this._styleItems[t]),n("#"+this._rteId+"_"+this._styleItems[t]).removeClass("e-isactive"));for(t=0;t<this._alignItems.length;t++)this._getCommandStatus(n.trim(this._alignItems[t].toLowerCase()))?(this._toolBarObj.selectItemByID(this._rteId+"_"+this._alignItems[t]),i=!0):this._toolBarObj.deselectItemByID(this._rteId+"_"+this._alignItems[t]);for(i||this._toolBarObj.selectItemByID(this._rteId+"_justifyLeft"),t=0;t<this._scriptsItems.length;t++)this._getCommandStatus(n.trim(this._scriptsItems[t].toLowerCase()))?(this._toolBarObj.selectItemByID(this._rteId+"_"+this._scriptsItems[t]),n("#"+this._rteId+"_"+this._scriptsItems[t]).addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_"+this._scriptsItems[t]),n("#"+this._rteId+"_"+this._scriptsItems[t]).removeClass("e-isactive"));this._getCommandStatus("InsertOrderedList")?(this._toolBarObj.selectItemByID(this._rteId+"_orderedList"),n("#"+this._rteId+"_orderedList").addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_orderedList"),n("#"+this._rteId+"_orderedList").removeClass("e-isactive"));this._getCommandStatus("InsertUnorderedList")?(this._toolBarObj.selectItemByID(this._rteId+"_unorderedList"),n("#"+this._rteId+"_unorderedList").addClass("e-isactive")):(this._toolBarObj.deselectItemByID(this._rteId+"_unorderedList"),n("#"+this._rteId+"_unorderedList").removeClass("e-isactive"));this._updateIndentStatus()}}catch(r){}},_updateFormat:function(){try{if(this._formatDDL&&this.model.showToolbar&&!t.isNullOrUndefined(this.model.tools.formatStyle)){var i=n.trim(this._getCommandValue("formatblock").replace(/'/g,""));if(this._isIE())switch(i){case"Heading 6":i="<h6>";break;case"Heading 5":i="<h5>";break;case"Heading 4":i="<h4>";break;case"Heading 3":i="<h3>";break;case"Heading 2":i="<h2>";break;case"Heading 1":i="<h1>"}else i="<"+i+">";this._formatDDL.hasClass("e-dropdownlist")&&(t.isNullOrUndefined(i)||i==""?this._formatDDL.ejDropDownList({value:this._getLocalizedLabels("format")}):!n(this._formatDDL).parents("ul.e-rte-format").length==0&&this._formatDDL.ejDropDownList("setSelectedValue",i))}}catch(r){}},_updateFontOptionStatus:function(){var i,r;try{this.model.showFontOption&&this.model.showToolbar&&!t.isNullOrUndefined(this.model.tools.font)&&(i=n.trim(this._getCommandValue("fontname").replace(/"/g,"").replace(/'/g,"").replace(/, /g,",")),(t.isNullOrUndefined(i)||i=="")&&(i="Segoe UI"),!t.isNullOrUndefined(this._fontStyleDDL)&&this._fontStyleDDL.hasClass("e-dropdownlist")&&!n(this._fontStyleDDL).parents("ul.e-rte-fontgroup").length==0&&this._fontStyleDDL.ejDropDownList("setSelectedValue",i),r=this._isIE8()?this._getCommandValue("fontsize"):this._getDocumentHandler()&&this._operationHandler._validateFontSize(this._getRange().startContainer),(t.isNullOrUndefined(r)||r=="")&&(r=2),!t.isNullOrUndefined(this._fontSizeDDL)&&this._fontSizeDDL.hasClass("e-dropdownlist")&&!n(this._fontSizeDDL).parents("ul.e-rte-fontgroup").length==0&&this._fontSizeDDL.ejDropDownList("setSelectedValue",r))}catch(u){}},_getSelText:function(){var n="",r,t,i;return this._isIE()?n=this._seleText:window.getSelection?(r=this._getWindow().getSelection(),i=this._saveSelection(),t=document.createTextNode(i.toString()),n=t.nodeValue):document.getSelection&&(n=this._getWindow().document.getSelection()),n},_isIE:function(){var n=!1,i=t.browserInfo();return i.name=="msie"&&(n=!0),n},_isIE8:function(){var n=!1,i=t.browserInfo();return i.name=="msie"&&i.version=="8.0"&&(n=!0),n},_isUrl:function(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)},_pasteHtml:function(t,i){var e,r,l,h,o,a,c,f,v,s,u,y,p;if(this._pasteAPIFlag?this._isIE()&&this._focus():this._focus(),window.getSelection){if(e=this._getWindow().getSelection(),e.getRangeAt&&e.rangeCount){for(r=this._pasteFlag?this._pasteRangeVal:e.getRangeAt(0),l=r.commonAncestorContainer,h=l.nodeType==3?n(l).parentsUntil("body"):n(l).children(),u=h.length-1;u>=0;u--)if(h[u].textContent==r.toString()&&h[u].nodeName.toLowerCase()!="li"){r.selectNode(h[u]);break}if(r.deleteContents(),o=document.createElement("div"),o.innerHTML=t,a=this._getDocument().createDocumentFragment(),v=o.firstChild,this._pasteFlag||this._pasteAPIFlag){while(c=o.firstChild)v!=c?f=v.appendChild(c):o.removeChild(o.firstChild);f=a.appendChild(v)}else while(c=o.firstChild)f=a.appendChild(c);r.insertNode(a);f&&!i?(r=r.cloneRange(),r.setStartAfter(f),r.collapse(!0),e.removeAllRanges(),e.addRange(r)):(r=this.createRange(),r.setStart(f,f.data.length),r.setEnd(f,f.data.length),e.removeAllRanges(),e.addRange(r))}}else if(this._getDocument().selection&&this._getDocument().selection.type!="Control")if(!this._ieSelectionRange||this._ieSelectionRange.offsetLeft==0&&this._ieSelectionRange.offsetTop==0&&this._ieSelectionRange.boundingHeight==0)this._getDocument().body.insertAdjacentHTML("afterBegin",t);else if(this._pasteFlag&&this.selectRange(this._pasteRangeVal),s=this._ieParents(this._getRange()),y=!1,this._pasteAPIFlag)this._getRange().pasteHTML(t);else{for(p=this._getRange().text,u=s.length-1;u>=0;u--)if(s[u].innerText==p&&s[u].nodeName.toLowerCase()!="li"){s[u].nodeName=="BODY"?s[u].innerHTML=t:s[u].outerHTML=t;y=!0;break}y||this._getRange().pasteHTML(t)}this._pasteAPIFlag=this._pasteFlag=!1},_ieParents:function(n){var t=[];for(rangeval=this._isIE8()?n.duplicate():n.cloneRange(),n.parentElement=rangeval.parentElement();n.parentElement.nodeName!="HTML";){if(n.parentElement.nodeName=="TD"||n.parentElement.nodeName=="TH")break;t.push(n.parentElement);n=n.parentElement}return t},_getLocalizedLabels:function(n){return this._localizedLabels[n]===r?t.RTE.Locale["en-US"][n]:this._localizedLabels[n]},_getSelectedNode:function(){var u=this._getRange(),i,n=this._ieSelectionRange&&u.offsetLeft==0&&u.offsetTop==0&&u.boundingHeight==0?this._ieSelectionRange:u,t=n.startContainer,r=n.endContainer,f=n.startOffset,e=n.endOffset;return n?n.setStart?(i=n.commonAncestorContainer,!n.collapsed&&(t==r&&e-f<2&&t.hasChildNodes()&&(i=t.childNodes[f]),t.nodeType===3&&r.nodeType===3&&(t=t.length===f?this._skipEmptyNode(t.nextSibling,!0):t.parentNode,r=e===0?this._skipEmptyNode(r.previousSibling,!1):r.parentNode,t&&t===r)))?t:i&&i.nodeType==3?i.parentNode:i:n.item?n.item(0):n.parentElement():this._getDocument().selection},_skipEmptyNode:function(n,t){for(var i=n;n&&n.nodeType===3&&n.length===0;)n=t?n.nextSibling:n.previousSibling;return n||i},_getSelection:function(){var n;return this._isIE()?(n=this._getDocument().selection.createRange(),n.type=this._getDocument().selection.type):(n=window.getSelection(),n.rangeCount&&(sText=n.getRangeAt(0)),n.type=this._getWindow().getSelection().type),n},_saveSelection:function(){var i=this._getWindow(),r=i.document,n=i.getSelection?i.getSelection():r.selection,t,u;return n&&(n.createRange?t=n.createRange():n.rangeCount>0&&n.getRangeAt(0)?t=n.getRangeAt(0):n.anchorNode&&n.focusNode&&r.createRange?(t=r.createRange(),t.setStart(n.anchorNode,n.anchorOffset),t.setEnd(n.focusNode,n.focusOffset),t.collapsed!==n.isCollapsed&&(t.setStart(n.focusNode,n.focusOffset),t.setEnd(n.anchorNode,n.anchorOffset))):r.createRange()?(t=r.createRange(),t.setStart(i.document.body,0),t.setEnd(i.document.body,0)):(u=document.getElementsByTagName("iframe")[0],i=u.contentWindow,t=i.document.createRange(),t.setStart(i.document.body,0),t.setEnd(i.document.body,0))),t},_restoreSelection:function(n){var i=this._getWindow(),r=i.document,t=i.getSelection?i.getSelection():r.selection;t&&n&&(n.select?n.select():t.removeAllRanges&&t.addRange&&(t.removeAllRanges(),t.addRange(n)))},_getRange:function(){var i,u,f,r,n;if(this._isIE8())return i=this._saveSelection(),u=this._ieSelectionRange&&i.offsetLeft==0&&i.offsetTop==0&&i.boundingHeight==0?this._ieSelectionRange:i,u;if(this._isIE())return this._ieSelection=window.getSelection&&(t.isNullOrUndefined(this._selectionRange)?!1:this._selectionRange.length>0)?this._selectionRange:this._saveSelection();if(this._getWindow().getSelection()&&this._getWindow().getSelection().rangeCount>0)return this._getWindow().getSelection().getRangeAt(0);f=document.getElementsByTagName("iframe")[0];r=f.contentWindow;try{n=r.document.createRange();n.setStart(r.document.body,0);n.setEnd(r.document.body,0)}catch(e){n=this._getDocument().createRange();n.setStart(this._getDocument().body,0);n.setEnd(this._getDocument().body,0)}return n},_setBackupData:function(){var t=this.getHtml(),i=this._backupArray.length;i==this.model.undoStackLimit+1&&this._backupArray.splice(0,1);t!=this._backupArray[i-1]&&this.model.undoStackLimit>0&&this._backupArray.push(t);this._undoRedoPosition=this._backupArray.length-1;this.model.showToolbar&&this._rteToolbar.find("li.e-rteItem-undo")&&this._backupArray.length>1&&!n("#"+this._rteId+"_undo").hasClass("e-rteTooldisable")&&this._toolBarObj.enableItemByID(this._rteId+"_undo")},_getSelectedHtmlString:function(){var i,e,o,r,f,u,t,s;if(typeof document.selection!="undefined"&&this._isIE8()){for(i=this._ieParents(this._getRange()),e=!1,t=i.length-1;t>=0;t--)if(i[t].innerText==this._getRange().text){o=i[t].nodeName=="BODY"?i[t].innerHTML:i[t].outerHTML;e=!0;break}return e||(o=this._getRange().htmlText.substring(0,1)=="<"?this._getRange().text:this._getRange().htmlText),o}for(r=this._getRange(),f=r.commonAncestorContainer,u=f.nodeType==3?n(f).parentsUntil("body"):n(f).children(),t=u.length-1;t>=0;t--)if(u[t].textContent!=""&&u[t].textContent==r.toString()){r.selectNode(u[t]);break}return s=document.createElement("div"),s.appendChild(r.cloneContents()),s.innerHTML},_getText:function(){var n=this._getDocument().body;if(n!=null)return this._isIE()?n.innerText:n.textContent},_validateMaxLength:function(n){if(this.model.maxLength!=null){var t=this.model.maxLength,i=this._getText();t<=i.length&&(n.keyCode<47||n.ctrlKey&&n.keyCode==65||n.ctrlKey&&n.keyCode==67||n.ctrlKey&&n.keyCode==86||n.ctrlKey&&n.keyCode==88||(this._keypressFlag=!1,this._cancelEvent(n)))}},_cancelEvent:function(n){return n.returnValue=!1,n.stopPropagation(),n.preventDefault(),!1},_alignToolUpdate:function(n){for(var t=0;t<this._alignItems.length;t++)this._alignItems[t]===n?this._toolBarObj.selectItemByID(this._rteId+"_"+n):this._toolBarObj.deselectItemByID(this._rteId+"_"+this._alignItems[t])},_getCommandStatus:function(n){return this._getDocument().queryCommandState(n)},_getCommandValue:function(n){var i=this._getDocument().queryCommandValue(n),r;if(this._isIE()){if(n=="fontname"){for(r=0;r<this.model.fontName.length;r++)if(i==this.model.fontName[r].text){i=this.model.fontName[r].value;break}(t.isNullOrUndefined(i)||i=="")&&(i=this.model.fontName[0].value)}if(n=="formatblock"){for(r=2;r<this.model.format.length;r++)if(i==this.model.format[r].text){i=this.model.format[r].value;break}i=="Normal"&&(i=this.model.format[0].value)}}return i},_undo:function(){this._undoRedoPosition>0&&(this.model.enableHtmlEncode?this.setHtml(this._decode(this._backupArray[this._undoRedoPosition-1])):this.setHtml(this._backupArray[this._undoRedoPosition-1]),this._undoRedoPosition--,this._focus(),this._updateFontOptionStatus(),this._updateFormat(),this._updateCount(),this._toggleEditTable(),this.model.isResponsive&&this._toolBarObj._liTemplte.removeClass("e-display-none"),this._toolBarObj.enableItemByID(this._rteId+"_redo"));this._undoRedoPosition==0&&(this._toolBarObj.disableItemByID(this._rteId+"_undo"),this._toolBarObj.enableItemByID(this._rteId+"_redo"));this._updateToolbarStatus();this._trigger("execute",{commandName:"undo"})},_getRedoContent:function(){return this.model.enableHtmlEncode?this._decode(this._backupArray[this._undoRedoPosition+1]):this._backupArray[this._undoRedoPosition+1]},_redo:function(){var i,n;this._undoRedoPosition!=this._backupArray.length&&(this._backupArray[this._undoRedoPosition+1]!=null?(i=this._getRedoContent(),this.setHtml(i),this._undoRedoPosition++):(n=this._getRedoContent(),t.isNullOrUndefined(n)||this.setHtml(n),this._undoRedoPosition=this._backupArray.length-2),this._focus(),this._updateToolbarStatus(),this._updateFontOptionStatus(),this._updateFormat(),this._updateCount(),t.isNullOrUndefined(this._toolBarObj)||(this._backupArray.length-1>0&&this._toolBarObj.enableItemByID(this._rteId+"_undo"),this._undoRedoPosition==this._backupArray.length-1&&this._toolBarObj.disableItemByID(this._rteId+"_redo")));this._trigger("execute",{commandName:"redo"})},_setContent:function(n){var i=this._getDocument();i==""||t.isNullOrUndefined(i)||(i.open(),i.write(n),i.close(),i.EditMode=!0)},_removeResizeObject:function(){n(this._getDocument()).find(".e-rteColumnResizer , .e-rteRowResizer , .e-rteLastcolumn").remove()},_tableMouseOver:function(i){(i.target.nodeName=="TABLE"||t.browserInfo().name==="mozilla"&&i.target.nodeName=="TD")&&(this._curTable=i.target.nodeName=="TD"?n(i.target).closest("table")[0]:i.target,this._removeResizeObject(),n(this._getDocument()).find(".e-rte-tablebox").remove(),this._tableResizeObject(n(this._curTable)))},_preventDefaultResize:function(){var n=this._getDocument();t.browserInfo().name==="msie"&&t.browserInfo().version==="11.0"?n.body.addEventListener("mscontrolselect",this._ieDefaultTableHandler):this._isIE()&&n.body.attachEvent("oncontrolselect",this._ieTableHandler);t.browserInfo().name==="mozilla"&&(n.designMode="on",n.execCommand("enableObjectResizing",!1,"false"),n.execCommand("enableInlineTableEditing",!1,"false"))},_tableResizeObject:function(i){var f,r,u;for(this.model.allowEditing&&this._preventDefaultResize(),f=parseInt(n(i).attr("cellspacing")?n(i).attr("cellspacing"):0),this._newcol=i.find("tr:first td").not(":first"),this._newRow=i.find("tr td:nth-child(1)"),this._newlas=i.find("tr:first td:last"),r=0;this._newcol.length>r;r++)n(this._getDocument().body).after('<div class ="e-rteColumnResizer" unselectable="on" contenteditable="false" data-col ='+(r+1)+' style="top:'+n(this._newcol[r]).closest("table").offset().top+"px;left:"+n(this._newcol[r]).offset().left+"px;height:"+n(this._newcol[r]).closest("table").outerHeight()+"px;width:"+(5+f)+"px;margin-left: "+(-4-f)+'px;"><\/div>');for(r=0;this._newRow.length>r;r++)n(this._getDocument().body).after('<div class ="e-rteRowResizer" unselectable="on" contenteditable="false" data-row ='+r+' style="top:'+(n(this._newRow[r]).offset().top+n(this._newRow[r]).height())+"px;left:"+n(this._newRow[r]).offset().left+"px;width:"+n(this._newRow[r]).closest("table").width()+"px;height:"+(5+f)+'px;"><\/div>');n(this._getDocument().body).after('<div class ="e-rteColumnResizer e-rtelastcol" data-col ='+this._newcol.length+' contenteditable="false" style="top:'+n(this._newlas).closest("table").offset().top+"px;left:"+(n(this._newlas).offset().left+n(this._newlas).width())+"px;height:"+n(this._newlas).closest("table").outerHeight()+"px;width:"+(5+f)+'px;margin-left:3px;"><\/div>');this._botRigTab=t.buildTag("span.e-rte-tablebox e-rte-botrig","",{cursor:"nwse-resize",width:"5px",height:"5px",position:"absolute",display:"block",background:"#fff",border:"1px solid #000"},{});u=i.find("tr:last td:last:not(:has(>span.e-rte-tablebox))");u.length>0&&n(this._getDocument().body).after(n(this._botRigTab).css({left:parseInt(u.closest("table").width())+u.closest("table").offset().left+"px",top:parseInt(u.closest("table").height())+u.closest("table").offset().top+"px"}))},_ieDefaultTableHandler:function(n){n.preventDefault()},_ieTableHandler:function(){return!1},_tableCellStart:function(){this._tableInsertAt=this._saveSelection()},_tableCellSelect:function(i){var r,u=n(i.target),f=u.parent().index(),e=u.index();this._createTable.find("div.e-rte-tablecell").each(function(){r=n(this);r.index()<=e&&r.parent().index()<=f?r.addClass("e-active"):r.removeClass("e-active")});this._tblheaderDiv.html(e+1+"x"+(f+1)+this._getLocalizedLabels("table"));n(this._getDocument()).find("table.e-rte-tableremove").remove();t.isNullOrUndefined(this._tableInsertAt)||this._restoreSelection(this._tableInsertAt)},_tableCellLeave:function(){this._createTable.find("div.e-rte-tablecell").removeClass("e-active");n(this._getDocument()).find("table.e-rte-tableremove").remove();this._tblheaderDiv.html(this._getLocalizedLabels("createTable"))},_tableCellDown:function(i){var r=n(i.target),f=r.parent().index()+1,e=r.index()+1,u;this._focus();n(this._getDocument()).find("table.e-rte-tableremove").remove();t.isNullOrUndefined(this._tableInsertAt)||(this._restoreSelection(this._tableInsertAt),this._onInsertTable(f,e,!1));u=n(this._getDocument()).find("table.e-rte-table");this.model.enableRTL||this._on(u,"mouseover",this._tableMouseOver);this._createTable.ejDialog("close",{clickAction:!0});this._setBackupData();this._onChange();this.model.isResponsive&&!n(this._toolBarObj._liTemplte).hasClass("e-inline")&&(this._toolBarObj._liTemplte.addClass("e-display-none"),this._toolBarObj.contstatus=!1)},_tableGenerator:function(n,i,r,u,f,e,o,s,h,c){var l="e-rte-table";r&&(l+=" e-rte-tableremove");u=t.isNullOrUndefined(u)||u==""?"width:99%;":"width:"+u+";";f=t.isNullOrUndefined(f)||f==""?"":"height:"+f+";";e=t.isNullOrUndefined(e)||e==""?"":"cellspacing:"+e+";";o=t.isNullOrUndefined(o)||o==""?"":"cellpadding:"+o+";";s=t.isNullOrUndefined(s)?"":" float:"+s+";";switch(h){case"dotted":borderstyle="dotted";break;case"double":return this._border="style='border:3px double #5C5C5C;'",borderstyle="double","<table border='1' class='"+l+"' style='"+u+" "+f+" "+this._border+" "+e+" "+o+" "+s+"' >"+(c?"<caption><\/caption>":"")+Array(n+1).join("<tr>"+Array(i+1).join("<td><br _moz_dirty=''/><\/td>")+"<\/tr>")+"<\/table>";case"dashed":borderstyle="dashed";break;case"solid":borderstyle="solid";break;default:borderstyle="solid"}return borderstyle!="double"?(this._border="border:1px "+borderstyle+"#5C5C5C;","<table border='1' class='"+l+"' style='"+u+f+this._border+e+o+s+"' >"+(c?'<caption><br type="_moz"><\/caption>':"")+Array(n+1).join("<tr>"+Array(i+1).join("<td><br _moz_dirty=''/><\/td>")+"<\/tr>")+"<\/table>"):"<table border='1' class='"+l+"' style='border:1px solid #5C5C5C; "+u+f+e+o+s+"' >"+(c?'<caption><br type="_moz"><\/caption>':"")+Array(n+1).join("<tr>"+Array(i+1).join("<td><br _moz_dirty=''/><\/td>")+"<\/tr>")+"<\/table>"},_openCustomTable:function(t){t.currentTarget.id==this._rteId+"_createCustomTableLink"?(n("#"+this._rteId+"_customTable_wrapper").css({"z-index":this._onGetMaxZindex()}),this._customTableDialog.ejDialog("open"),this._createTable.ejDialog("close"),this._widthFocusOut()):this._createTable.find("div.e-rte-eTblProperties").hasClass("e-disable")||(this._eTblManager(),n("#"+this._rteId+"_eTbl_wrapper").css({"z-index":this._onGetMaxZindex()}),this._eTblDialog.ejDialog("open"),this._createTable.ejDialog("close"),this._on(this._getTableObj("Width"),"focusout",this._widthFocusOut),this._widthFocusOut())},_createcustomColorpalette:function(){var f=n("#"+this._rteId).data("ejRTE"),r=t.buildTag("div.e-custom-palette"),u,i;this._customColor=t.buildTag("div.e-rte-customColor#"+this._rteId+"_customColorDialog");u=t.buildTag("input.e-custom-palette#"+this._rteId+"customcolor");u.appendTo(this._customColor);this.colorobj=this._customColor.find(".e-custom-palette").ejColorPicker({enableRTL:this.model.enableRTL,enableOpacity:!0,showRecentColors:!0,modelType:"picker",cssClass:this.model.cssClass,showSwitcher:!1,select:function(n){f._checkColor(n.value)}}).data("ejColorPicker");i=this._getDialogModel();i.width="auto";i.height="auto";i.minWidth="220px";i.htmlAttributes={"class":"e-custom-Dialog"};i.title=this._getLocalizedLabels("customFontColor");i.target=null;i.showRoundedCorner=this.model.showRoundedCorner;i.closeIconTooltip=this._getLocalizedLabels("closeIcon");this._customColor.ejDialog(i);this._customDialogobj=this._customColor.ejDialog("instance");this._customColor.closest(".e-dialog-wrap").addClass("e-rte");this.colorobj.popupContainer.appendTo(r);this.colorobj.popupContainer.css({display:"block","border-style":"none"});n("#"+this._rteId+"_customColorDialog").find("span.e-colorwidget.e-picker").remove();n("#"+this._rteId+"_customColorDialog").prepend(r);this.colorobj._hidePopup=function(){n("#"+this._rteId+"_customColorDialog").ejDialog("isOpen")&&n("#"+this._rteId+"_customColorDialog").ejDialog("close");this.colorobj.model.displayInline||this.colorobj.hide()};this._on(this.colorobj._cancelTag,"click",this.colorobj._hidePopup)},_openColorpalette:function(n){this._customColor||this._createcustomColorpalette();n.currentTarget.id==this._rteId+"_customcolor"?(this._fontclick=!0,!t.isNullOrUndefined(this._splitMenu),this._splitMenu.hide(n)):n.currentTarget.id==this._rteId+"_customBGcolor"&&(this._fontclick=!1,!t.isNullOrUndefined(this._bgSplitMenu),this._bgSplitMenu.hide(n));this._customColor.ejDialog("open")},_checkColor:function(n){this._fontclick?(this._onFontColor(n),this._fontColor=n):(this._onBGColor(n),this._bgColor=n)},_createTableClose:function(i){!t.isNullOrUndefined(this._createTable)&&(!t.isNullOrUndefined(i)&&n(i.target).parents("#"+this._rteId+"_tables").length<=0||t.isNullOrUndefined(i))?t.isNullOrUndefined(this._createTable.data("ejDialog"))||((t.isNullOrUndefined(i)||i.target!=this._createTable[0]&&n(i.target).parents(".e-rte-table-picker").length<=0)&&(this._createTable.ejDialog("isOpened")&&this._createTable.ejDialog("close"),this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable")),this._createTable.ejDialog("isOpened")&&this.model.isResponsive&&!n(i.target).find("div#"+this._toolBarObj.element[0].id+"_hiddenlist").hasClass("e-inline")?this._toolBarObj._liTemplte.removeClass("e-display-none"):!this.model.isResponsive||t.isNullOrUndefined(i)||n(i.target).is(n("#"+this._toolBarObj.element[0].id+"_target"))||n(i.target).closest("div#"+this._toolBarObj.element[0].id+"_hiddenlist").length!=0||n(i.target).parents().hasClass("e-ddl-popup")||this._toolBarObj._liTemplte.addClass("e-display-none")):n(this._createTable.find("div.e-rte-eTblProperties").hasClass("e-disable")).addClass("e-disable")},_documentClick:function(t){if(n(t.target).hasClass("e-inlinearrow")&&this._setIframeHeight(),this.model.toolbarOverflowMode!="inline"&&this._createTableClose(t),this._isIE()&&!window.getSelection){var i=t.target.id;i==""&&(i=t.target.parentNode.id);(i==this._rteId+"_fontSizeDDL"||i==this._rteId+"_fontNameDDL"||i==this._rteId+"_formatDDL"||i==this._rteId+"_fontSizeDDL_dropdown"||i==this._rteId+"_fontNameDDL_dropdown"||i==this._rteId+"_formatDDL_dropdown")&&this._restoreSelection(this._selectionRange)}},_iframeFocus:function(i){!t.isNullOrUndefined(this._createTable)&&this._createTable.ejDialog("isOpened")&&this._createTable.ejDialog("close");!n(this._fontSizeDDL).parents("ul.e-rte-fontgroup").length==0&&!t.isNullOrUndefined(this._fontSizeDDL)&&this._fontSizeDDL.hasClass("e-dropdownlist")&&this._fontSizeDDL.ejDropDownList("hidePopup");!n(this._fontStyleDDL).parents("ul.e-rte-fontgroup").length==0&&!t.isNullOrUndefined(this._fontStyleDDL)&&this._fontStyleDDL.hasClass("e-dropdownlist")&&this._fontStyleDDL.ejDropDownList("hidePopup");!n(this._formatDDL).parents("ul.e-rte-format").length==0&&!t.isNullOrUndefined(this._formatDDL)&&this._formatDDL.hasClass("e-dropdownlist")&&this._formatDDL.ejDropDownList("hidePopup");t.isNullOrUndefined(this._createTable)||this._createTable.ejDialog("close");t.isNullOrUndefined(this._splitMenu)||this._splitMenu.hide(i);t.isNullOrUndefined(this._bgSplitMenu)||this._bgSplitMenu.hide(i);t.isNullOrUndefined(this._orderSplitObj)||this._orderSplitObj.hide(i);t.isNullOrUndefined(this._unOrderSplitObj)||this._unOrderSplitObj.hide(i)},_updateKeyDownSelectStatus:function(n,t){n.hasClass("e-active")?this._toolBarObj.deselectItemByID(this._rteId+"_"+t):this._toolBarObj.selectItemByID(this._rteId+"_"+t)},_iframeKeyDown:function(i){var r,u;if(this.model.showToolbar&&this.model.allowKeyboardNavigation&&i)if(i.ctrlKey){i.keyCode==65?this._contolAKeyfalg=!0:t.isNullOrUndefined(this._contolAKeyfalg)?this._contolAKeyfalg:this._contolAKeyfalg=!1;u=this;switch(i.keyCode){case 48:return i.preventDefault(),n(this.getDocument().body).css({zoom:1,transform:"scale(1)","transform-origin":"0 0","-o-transform":"scale(1)","-o-transform-origin":"0 0","-webkit-transform":"scale(1)","-webkit-transform-origin":"0 0"}),n(u._toolBarObj.itemsContainer.find(".e-rteItem-zoomIn")).attr("title",u._getLocalizedLabels("zoomIn")+" 100%"),n(u._toolBarObj.itemsContainer.find(".e-rteItem-zoomOut")).attr("title",u._getLocalizedLabels("zoomOut")+" 100%"),u._zoomValue=1,!1;case 57:return i.preventDefault(),this._onKeyZoom("IN"),!1;case 173:case 189:return i.preventDefault(),this._onKeyZoom("OUT"),!1;case 80:return i.preventDefault(),this._onPrint(),!1;case 66:if(!i.shiftKey)return i.preventDefault(),r=this._toolBarItems.find("li.e-rteItem-bold"),r.hasClass("e-disable")||(this._onBold(),this._updateKeyDownSelectStatus(r,"bold"),this._onChange(),this._setBackupData()),!1;break;case 72:if(i.shiftKey)return i.preventDefault(),this._getPasteRangeVal(),this._sourceCodeManager(),!1;break;case 73:return i.preventDefault(),i.shiftKey?this._imageManager():(r=this._toolBarItems.find("li.e-rteItem-italic"),r.hasClass("e-disable")||(this._onItalics(),this._setBackupData(),this._updateKeyDownSelectStatus(r,"italic"),this._onChange())),!1;case 85:return i.preventDefault(),i.shiftKey?this._onUpperCase():(r=this._toolBarItems.find("li.e-rteItem-underline"),r.hasClass("e-disable")||(this._onUnderLine(),this._updateKeyDownSelectStatus(r,"underline"))),this._setBackupData(),this._onChange(),!1;case 76:return i.preventDefault(),i.shiftKey?this._onLowerCase():this._toolBarItems.find("li.e-rteItem-justifyLeft").hasClass("e-disable")||(this._onJustifyLeft(),this._alignToolUpdate("justifyLeft")),this._setBackupData(),this._onChange(),!1;case 82:return i.preventDefault(),i.altKey?this.removeRow():i.shiftKey?this._onClearFormat():(r=this._toolBarItems.find("li.e-rteItem-justifyRight"),r.hasClass("e-disable")||(this._onJustifyRight(),this._alignToolUpdate("justifyRight"))),this._setBackupData(),this._onChange(),!1;case 69:if(i.shiftKey)return i.preventDefault(),this._openCustomTable(i),this._setBackupData(),this._onChange(),!1;if(!this._toolBarItems.find("li.e-rteItem-justifyCenter").hasClass("e-disable"))return i.preventDefault(),this._onJustifyCenter(),this._setBackupData(),this._alignToolUpdate("justifyCenter"),this._onChange(),!1;break;case 74:if(!this._toolBarItems.find("li.e-rteItem-justifyFull").hasClass("e-disable"))return i.preventDefault(),this._onJustifyFull(),this._alignToolUpdate("justifyFull"),this._setBackupData(),this._onChange(),!1;break;case 90:if(!this._toolBarItems.find("li.e-rteItem-undo").hasClass("e-disable"))return i.preventDefault(),this._onUndo(),!1;break;case 89:if(!this._toolBarItems.find("li.e-rteItem-redo").hasClass("e-disable"))return i.preventDefault(),this._onRedo(),!1;break;case 67:if(i.altKey)return i.preventDefault(),this.removeColumn(),!1;if(i.shiftKey)return i.preventDefault(),this._getPasteRangeVal(),this._customTableDialog&&this._renderTableDialog(),this._customTableDialog.ejDialog("open"),!1;if(this._toolBarItems.find("li.e-rteItem-copy").hasClass("e-disable"))return i.preventDefault(),this._keypressFlag=!1,!1;break;case 88:if(this._toolBarItems.find("li.e-rteItem-cut").hasClass("e-disable"))return i.preventDefault(),this._keypressFlag=!1,!1;this._onChange();break;case 86:if(this._toolBarItems.find("li.e-rteItem-paste").hasClass("e-disable")||this.model.maxLength<=n.trim(this._getText()).length&&(t.isNullOrUndefined(this._contolAKeyfalg)?!0:this._contolAKeyfalg))return i.preventDefault(),this._keypressFlag=!1,!1;if(i.shiftKey)return i.preventDefault(),this._keypressFlag=!1,this._selectCommand("video"),!1;break;case 77:return i.preventDefault(),i.shiftKey?this._toolBarItems.find("li.e-rteItem-outdent").hasClass("e-disable")||(this._onOutdent(),this._indentdepth>0&&this._indentdepth--):this._toolBarItems.find("li.e-rteItem-indent").hasClass("e-disable")||(this._onIndent(),this._indentdepth++),this._setBackupData(),this._onChange(),!1;case 75:return i.preventDefault(),i.shiftKey?this._onUnlink():this._toolBarItems.find("li.e-rteItem-createLink").hasClass("e-disable")||this._hyperLinkManager(!1),!1;case 188:if(i.shiftKey)return i.preventDefault(),this._changeFontsize(!1),this._onChange(),!1;this._setBackupData();this._onChange();break;case 190:if(i.shiftKey)return i.preventDefault(),this._changeFontsize(!0),this._onChange(),!1;this._setBackupData();break;case 61:case 187:return i.preventDefault(),i.shiftKey?this._onSuperScript():this._onSubScript(),this._onChange(),this._setBackupData(),!1;case 79:if(i.shiftKey)return i.preventDefault(),this.executeCommand("insertorderedlist","listItem"),this._onChange(),this._setBackupData(),!1;if(i.altKey)return i.preventDefault(),this.executeCommand("insertunorderedlist","listItem"),this._onChange(),this._setBackupData(),!1;break;case 83:if(i.shiftKey)return i.preventDefault(),this._onStrikeThrough(),this._onChange(),this._setBackupData(),!1;break;case 70:if(i.shiftKey)return i.preventDefault(),this._selectCommand("fullScreen"),!1;if(!i.altKey)return i.preventDefault(),t.RTE.FindAndReplace&&this._showFindAndReplace(),!1;break;case 37:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertColumn(!0),this._onChange(),!1;break;case 39:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertColumn(!1),this._onChange(),!1;break;case 38:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertRow(!0),this._onChange(),!1;break;case 40:if(i.shiftKey&&n(this._currentSelNode).closest("table").length)return i.preventDefault(),this.insertRow(!1),this._onChange(),!1;break;case 65:if(i.altKey)return i.preventDefault(),this.removeTable(),!1;break;case 121:return i.preventDefault(),this._clearAllManager(),!1;case 84:if(i.altKey&&this._toolBarItems){this._toolBarItems.focus();break}}}else if(i.keyCode!=9||!this.model.enableTabKeyNavigation||(this._isIE8()?this._currentSelNode.nodeName.toLowerCase()=="td":this._getSelectedNode().nodeName.toLowerCase()=="td"))i.keyCode==8&&(ele=this._getSelectedNode(),n(ele).find("span#RTE_imgDupDiv").length>0&&n(this._imgDupDiv).remove(),n(ele).parents("BLOCKQUOTE").length>0&&(this._onOutdent(),i.preventDefault()));else return this._keypressFlag=!0,this.executeCommand("inserthtml","     ",!0),!1;else i.ctrlKey!=!0||i.keyCode!=66&&i.keyCode!=73&&i.keyCode!=85&&i.keyCode!=76&&i.keyCode!=82&&i.keyCode!=69&&i.keyCode!=74&&i.keyCode!=90&&i.keyCode!=89&&i.keyCode!=67&&i.keyCode!=88&&i.keyCode!=86&&i.keyCode!=8&&i.keyCode!=46||this.model.allowKeyboardNavigation||i.preventDefault();if(this.model.maxLength!=null&&(t.isNullOrUndefined(this._contolAKeyfalg)?!0:!this._contolAKeyfalg))try{!this._isIE8()||i.keyCode!=86||this.model.maxLength>=window.clipboardData.getData("Text").length+n.trim(this._getText()).length?this._validateMaxLength(i):i.preventDefault()}catch(f){}(this._isIE8()?this._currentSelNode&&this._currentSelNode.nodeName.toLowerCase()=="td":this._getSelectedNode().nodeName.toLowerCase()=="td")&&(ele=this._isIE8()?this._currentSelNode:this._getSelectedNode(),_newElementIndex=n(ele).parent().children().index(n(ele)),i.keyCode!=9||i.shiftKey||(_newElement=t.isNullOrUndefined(ele.nextSibling)?t.isNullOrUndefined(n(ele).parents("tr")[0].nextSibling)?t.isNullOrUndefined(n(ele).parents("table")[0].nextSibling)?ele:n(ele).parents("table")[0].nextSibling.nodeName.toLowerCase()=="td"?n(ele).parents("table")[0].nextSibling:ele:n(ele).parents("tr")[0].nextSibling.childNodes[0]:ele.nextSibling,this._setTableSelection(_newElement,i)),i.keyCode==9&&i.shiftKey?(_newElement=t.isNullOrUndefined(ele.previousSibling)?t.isNullOrUndefined(n(ele).parents("tr")[0].previousSibling)?t.isNullOrUndefined(n(ele).parents("table")[0].previousSibling)?ele:n(ele).parents("table")[0].previousSibling.nodeName.toLowerCase()=="td"?n(ele).parents("table")[0].previousSibling:ele:n(ele).parents("tr")[0].previousSibling.childNodes[n(ele).parents("tr")[0].previousSibling.childNodes.length-1]:ele.previousSibling,this._setTableSelection(_newElement,i)):i.keyCode==40?_newElement=t.isNullOrUndefined(n(ele).parents("tr")[0].nextSibling)?!t.isNullOrUndefined(n(ele).parents("table")[0].nextSibling)&&!this._isIE8()?n(ele).parents("table")[0].nextSibling:ele:n(ele).parents("tr")[0].nextSibling.children[_newElementIndex]:i.keyCode==38&&(_newElement=t.isNullOrUndefined(n(ele).parents("tr")[0].previousSibling)?!t.isNullOrUndefined(n(ele).parents("table")[0].previousSibling)&&!this._isIE8()?n(ele).parents("table")[0].previousSibling:ele:n(ele).parents("tr")[0].previousSibling.children[_newElementIndex]),i.keyCode!=9||ele!=_newElement||t.isNullOrUndefined(n(ele).parents("tr")[0].previousSibling)?(i.keyCode==9&&this._isIE8()||i.keyCode==40||i.keyCode==38)&&(this._setRange(_newElement,this._getRange(),!0),i.preventDefault()):(this.insertRow(!1),this._setRange(this._isIE8()?n(this._getRange().parentElement()).parents("tr").next().children().first()[0]:n(this._getRange().startContainer).parents("tr").next().children().first()[0],this._getRange(),!0),i.preventDefault()),this._isIE8()&&this._getRange().parentElement&&(this._currentSelNode=this._getRange().parentElement()));n(i.target).parents("table").length==0&&n(this._getDocument()).find(".e-rte-tablebox").remove();this._setAutoHeight();this._trigger("keydown",{keyCode:i.keyCode})},_changeFontsize:function(n){var t=parseInt(this._getCommandValue("fontsize"))?parseInt(this._getCommandValue("fontsize")):2;(!n&&t>this.model.fontSize[0].value||n&&t<this.model.fontSize[this.model.fontSize.length-1].value)&&(this._onFontSize(n?t+1:t-1),this._updateFontOptionStatus())},_iframeKeypress:function(n){if(!this._keypressFlag)return n.preventDefault(),this._keypressFlag=!0,!1},_setTableSelection:function(n,t){this._isIE8()||n.childNodes.length==1&&n.childNodes[0].nodeName=="BR"||n.childNodes.length==0?this._setRange(n,this._getRange(),!0):(range=this._getDocument().createRange(),range.selectNodeContents(n),this.selectRange(range));t.preventDefault()},_setAutoHeightValue:function(t){return t.nodeName=="#text"&&(t.parentNode.nodeName=="BODY"&&(n(t).wrap("<div><\/div>"),this.selectRange(this._getRange())),range=n(t.parentNode).position().top+parseInt(n(t.parentNode).css("height"))),t.nodeName=="DIV"&&(range=n(t).position().top+parseInt(n(t).css("height"))),range},_setAutoHeight:function(){this.model.autoHeight?this._autoHeight():t.isNullOrUndefined(this._getDocument())||n(this._getDocument().body).css("overflow","")},_autoHeight:function(){var i=this._toolBarItems?this._toolBarItems.outerHeight():0,r;t.isNullOrUndefined(this._getDocument().body)||(n(this._getDocument().body).css("overflow","hidden"),r=t.isNullOrUndefined(this._getDocument().body.lastChild)?0:this._getDocument().body.lastChild.clientHeight+this._getDocument().body.lastChild.offsetTop,parseInt(n(this._rteWapper[0]).css("min-height"))-i<=r?n(this._rteIframe[0]).css("height",r+30+"px"):n(this._rteIframe[0]).css("height",parseInt(n(this._rteWapper[0]).css("min-height"))-i+"px"),range=0,range=window.getSelection&&!t.isNullOrUndefined(this._getRange().startContainer)?this._setAutoHeightValue(this._getRange().startContainer):this._getDocument().selection&&!t.isNullOrUndefined(this._ieParents(this._getRange())[0])?this._setAutoHeightValue(this._ieParents(this._getRange())[0]):0,range>=this._rteIframe.height()-30&&(this._rteIframe[0].contentDocument?n(this._rteIframe[0]).css("height",this._rteIframe[0].contentDocument.documentElement.scrollHeight+20+"px"):n(this._rteIframe[0]).css("height",this._rteIframe[0].contentWindow.document.body.scrollHeight+20+"px")),this._rteWapper.outerHeight(this._rteEditor.outerHeight()+i+parseInt(this.model.showFooter?19:0)))},_ieSelRange:function(){this._isIE()?(this._selectionRange="",this._ieSelectionRange=this._getRange(),this._seleText=t.isNullOrUndefined(this._getWindow().document.selection)?this._selectionRange.toString():this._getWindow().document.selection.createRange().text):this._ieSelectionRange=this._ieSelection},_iframeSelectionChange:function(n){this._trigger("select",{event:n,model:this.model})},_ignorekeyArray:[13,32,8,46],_iframeKeyUp:function(t){n(this._imgDupDiv).remove();n(this._imgOrg).css("outline","");this._toggleEditTable();n.inArray(t.which,this._ignorekeyArray)!=-1&&this._setBackupData();t.ctrlKey&&(t.keyCode==57||t.keyCode==189)&&this._zoomUp();this._updateToolbarStatus();this._updateFontOptionStatus();this._updateFormat();this._updateCount();var i=this._isIE8()?this._currentSelNode:this._getSelectedNode();if(this.model.showToolbar&&(this._isIE8()?i.nodeName.toLowerCase():i.nodeName.toLowerCase()!="a"?this.disableToolbarItem("removeLink"):this.enableToolbarItem("removeLink")),this._updateTagInfo(i),this._setAutoHeight(),this._ieSelRange(),this._trigger("keyup",{keyCode:t.keyCode}),this._iframeSelectionChange(t),t.ctrlKey)switch(t.keyCode){case 88:case 86:this._onChange()}(t.keyCode==46||t.keyCode==8)&&(this._getDocument().body.innerHTML==""||this._getDocument().body.innerHTML=="<br>")&&this._emptyContent()},_iframeMouseUp:function(i){if(this._tableResizeUp(i),this._zoomUp(i),this._resizeBtnInit(),!t.isNullOrUndefined(this._imgDup)&&n(this._imgOrg).parents("body").length>0&&(n(this._imgOrg).css({width:n(this._imgDup).css("width"),height:n(this._imgDup).css("height")}),n(this._imgOrg).position({left:n(this._imgDup).position().left,top:n(this._imgDup).position().top}),n(this._imgDup).css("display","none"),this._resizeImgPos(),this._setAutoHeight()),i.target.nodeName=="IMG"||n(i.target).hasClass("e-rte-imageboxmark")||(n(this._imgOrg).css("outline",""),n(this._imgDupDiv).remove(),this._off(n(this._getDocument()),"mousemove",this._imgBoxMouseMove)),i.target.nodeName=="IMG"&&n(i.target).parents("body").length>0){var r=this._isIE8()?this._getDocument().body.createTextRange():this._getDocument().createRange();this._isIE8()?r.moveToElementText(i.target):r.selectNode(i.target);this.selectRange(r)}this._currentSelNode=i.target;i.currentTarget&&i.target.nodeName&&i.target.nodeName.toLowerCase()=="html"&&this._getDocument()&&this._getDocument().body&&(this._isIE8()?!0:this._getRange().startOffset==this._getRange().endOffset)&&(this._isIE()&&i.currentTarget.createRange&&this._setRange(this._isIE8()?this._getDocument().body:this._getRange().startContainer,i.currentTarget.createRange(),!0),this._getDocument().body.focus());this._toggleEditTable();this._updateToolbarStatus();i.button?isRightClick=i.button==2:i.which&&(isRightClick=i.which==3);isRightClick||(this._updateFormat(),this._updateFontOptionStatus());this._ieSelRange();this._iframeSelectionChange(i);this._fontStyleDDL&&!t.isNullOrUndefined(this._fontStyleDDL.data("ejDropDownList"))&&this._fontStyleDDL.ejDropDownList("instance")._isPopupShown()&&n(this._fontStyleDDL.ejDropDownList("instance").popupList.ejScroller("instance").element).trigger("mouseup");this._fontSizeDDL&&!t.isNullOrUndefined(this._fontSizeDDL.data("ejDropDownList"))&&this._fontSizeDDL.ejDropDownList("instance")._isPopupShown()&&n(this._fontSizeDDL.ejDropDownList("instance").popupList.ejScroller("instance").element).trigger("mouseup")},_iframeMouseDown:function(i){if(t.browserInfo().name==="mozilla"&&(this._getDocument().designMode="off"),t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this._focus(),this._contolAKeyfalg=!1,this._updateTagInfo(i.target),this._updateIndent(i.target),this.model.showToolbar&&(i.target.nodeName!="A"?this.disableToolbarItem("removeLink"):this.enableToolbarItem("removeLink")),i.target.nodeName=="VIDEO"&&this.model.allowEditing&&this._preventDefaultResize(),i.target.nodeName=="IMG"&&this.model.allowEditing&&(this._preventDefaultResize(),this._imageClick(i.target)),n(i.target).hasClass("e-rte-imageboxmark"))return this._resizeBtnInit(),this._commonBoxDown=!0,n(i.target).hasClass("e-rte-rigmed")&&(this._rigMidBox=!0),n(i.target).hasClass("e-rte-toplef")&&(this._topLefBox=!0),n(i.target).hasClass("e-rte-topmed")&&(this._topMidBox=!0),n(i.target).hasClass("e-rte-toprig")&&(this._topRigBox=!0),n(i.target).hasClass("e-rte-lefmed")&&(this._lefMidBox=!0),n(i.target).hasClass("e-rte-botlef")&&(this._botLefBox=!0),n(i.target).hasClass("e-rte-botmid")&&(this._botMidBox=!0),n(i.target).hasClass("e-rte-botrig")&&(this._botRigBox=!0),!1;n(i.target).hasClass("e-rteColumnResizer")&&(this._lastCol=n(i.target).hasClass("e-rtelastcol")?!0:!1,this._columnEle=n(this._curTable).find("tr:first td").eq(parseInt(n(i.target).attr("data-col")))[0],this._columnDown=!0,this._columnIndex=this._columnEle.cellIndex,n(this._getDocument().body).after("<span class='colresizerline'style='cursor:col-resize;position:absolute;width:0px;border-left: 1px dashed #787878;height:"+n(this._columnEle).closest("table").height()+"px;left:"+i.pageX+"px;top:"+n(this._columnEle).offset().top+"px;'><\/span>"));n(i.target).hasClass("e-rteRowResizer")&&(this._rowEle=n(this._curTable).find("tr").eq(parseInt(n(i.target).attr("data-row")))[0],this._rowDown=!0);n(i.target).hasClass("e-rte-tablebox")&&(this._boxDown=!0,this._boxElement=this._curTable);(n(i.target).hasClass("e-rte-tablebox")||n(i.target).hasClass("e-rteRowResizer")||n(i.target).hasClass("e-rteColumnResizer"))&&this._on(n(this._getDocument()),"mousemove",this._imgBoxMouseMove);(t.browserInfo().name=="msie"||t.browserInfo().name=="chrome")&&i.ctrlKey==!0&&i.which==1&&(i.target.tagName.toUpperCase()!="A"||t.isNullOrUndefined(n(i.target).attr("href"))||window.open(n(i.target).attr("href"),"_blank"));this.model.isResponsive&&!t.isNullOrUndefined(this._toolBarObj)&&this._toolBarObj._liTemplte.children("ul").length>0&&!n(this._toolBarObj._liTemplte).hasClass("e-inline")&&(this._toolBarObj.contstatus=!0,this._toolBarObj._liTemplte.addClass("e-display-none"),this._toolBarObj.contstatus=!1);this._iframeFocus();this._onChange()},_iframeFocusOut:function(n){n.data&&(n.data._proxy._onChange(),n.data._proxy._selectionRange=n.data._proxy._isIE8()?n.data._proxy._getRange():n.data._proxy._saveSelection(),n.data._proxy._seleText=t.isNullOrUndefined(n.data._proxy._getWindow().document.selection)?n.data._proxy._selectionRange.toString():n.data._proxy._isIE8()?n.data._proxy._getWindow().document.selection.createRange().text:n.data._proxy._getWindow().getSelection().toString())},_widthFocusOut:function(){var i,r,u;this._customTableDialog.ejDialog("isOpen")?(i=this._customTableDialog,r="#"+this._rteId+"_ddlAlignment",u="#"+this._rteId+"_txtWidth"):(i=this._eTblDialog,r="#"+this._rteId+"_eTblAlign",u="#"+this._rteId+"_eTblWidth");var t=i.find(u).val(),f=n(r).data("ejDropDownList"),e=t&&t!=""&&!isNaN(t)||t.slice(-2)=="px"||t.slice(-2)=="em"||t.slice(-2)=="pt"||t.slice(-1)=="%"?!0:!1;f.option("enabled",e)},_windowResize:function(){this._setAutoHeight();this._setIframeHeight();this._updateCount()},_tableResizeUp:function(){n(this._getDocument()).find("table.e-rte-table").length&&(this._columnDown||this._rowDown||this._boxDown)?(this._currentTable&&this._columnDown&&this._columnDownClick&&(this._lastCol?(this._currentTable.closest("table").find("tr:first td").each(function(){this.style.width==""&&n(this).width(parseInt(n(this).closest("table").width()/(n(this).siblings().length+1)))}),this._currentTable.eq(this._columnIndex).width(this.lasColIndexWid),this._currentTable.closest("table").attr({width:""}),n(this._getDocument()).find(".e-rte-tablebox").css({left:this._currentTable.eq(this._columnIndex).offset().left+this._currentTable.eq(this._columnIndex).outerWidth()+"px"})):(this._currentTable.eq(this._columnIndex-1).width(this.nexColIndexWid),this._currentTable.eq(this._columnIndex).width(this._columnIndexWid))),this._removeResizeObject(),n(this._getDocument()).find(".colresizerline").remove(),n(this._getDocument()).find(".e-rte-tablebox").css("display","none"),this._restoreSelection(this._tableSelection),this._columnDown=!1,this._rowDown=!1,this._boxDown=!1,this._columnDownClick=!1):(n(this._getDocument()).find(".e-rte-tablebox").remove(),this._tableSelection=this._getRange())},_resizeBtnInit:function(){this._commonBoxDown=!1;this._rigMidBox=!1;this._topLefBox=!1;this._topMidBox=!1;this._topRigBox=!1;this._lefMidBox=!1;this._botLefBox=!1;this._botMidBox=!1;this._botRigBox=!1},_imgSpanBox:function(i){this._resizeBtnInit();this._imgOrg=i;this._imgDupDiv=t.buildTag("span#RTE_imgDupDiv");this._imgDup=t.buildTag("img#RTE_imgdivspan","",{display:"none",position:"absolute","background-size":"100% 100%",outline:"1px dashed #000",opacity:".64"},{}).appendTo(this._imgDupDiv);this._topLef=t.buildTag("span.e-rte-imageboxmark e-rte-toplef#RTE_toplef","",{cursor:"nwse-resize"},{}).appendTo(this._imgDupDiv);this._topMid=t.buildTag("span.e-rte-imageboxmark e-rte-topmed#RTE_topmed","",{cursor:"ns-resize"},{}).appendTo(this._imgDupDiv);this._topRig=t.buildTag("span.e-rte-imageboxmark e-rte-toprig#RTE_toprig","",{cursor:"nesw-resize"},{}).appendTo(this._imgDupDiv);this._leftMid=t.buildTag("span.e-rte-imageboxmark e-rte-lefmed#RTE_lefmed","",{cursor:"ew-resize"},{}).appendTo(this._imgDupDiv);this._rigMid=t.buildTag("span.e-rte-imageboxmark e-rte-rigmed#RTE_rigmed","",{cursor:"ew-resize"},{}).appendTo(this._imgDupDiv);this._botLef=t.buildTag("span.e-rte-imageboxmark e-rte-botlef#RTE_botlef","",{cursor:"nesw-resize"},{}).appendTo(this._imgDupDiv);this._botMid=t.buildTag("span.e-rte-imageboxmark e-rte-botmid#RTE_botmid","",{cursor:"ns-resize"},{}).appendTo(this._imgDupDiv);this._botRig=t.buildTag("span.e-rte-imageboxmark e-rte-botrig#RTE_botrig","",{cursor:"nwse-resize"},{}).appendTo(this._imgDupDiv);this._resizeImgPos();this._resizeImgDupPos();n(this._getDocument().body).after(this._imgDupDiv);n(i).css({outline:"1px dashed #5C5C5C"});this._on(n(this._getDocument()),"mousemove",this._imgBoxMouseMove)},_resizeImgPos:function(){this._ltPos=n(this._imgOrg).position();this._imgWid=n(this._imgOrg).css("width");this._imgHgt=n(this._imgOrg).css("height");this._imgDup.css({width:this._imgWid,height:this._imgHgt,left:this._ltPos.left+"px",top:this._ltPos.top+"px",border:n(this._imgOrg).css("border")});this._imgDup.attr({src:n(this._imgOrg).attr("src")});var i=parseInt(n(this._imgOrg).css("width"))-2+this._ltPos.left,u=(parseInt(n(this._imgOrg).css("width"))-2)/2+this._ltPos.left,r=parseInt(n(this._imgOrg).css("height"))-2+this._ltPos.top,f=(parseInt(n(this._imgOrg).css("height"))-2)/2+this._ltPos.top,t=parseInt(n(this._imgOrg).css("border-width")==""?0:n(this._imgOrg).css("border-width"));n(this._rigMid).css({left:i+2*t+"px",top:f+"px"});n(this._botLef).css({left:this._ltPos.left-3+"px",top:r+2*t+"px"});n(this._botRig).css({left:i+2*t+"px",top:r+2*t+"px"});n(this._botMid).css({left:u+"px",top:r+2*t+"px"});n(this._topRig).css({left:i+2*t+"px",top:this._ltPos.top-3+"px"});n(this._topLef).css({left:this._ltPos.left-3+"px",top:this._ltPos.top-3+"px"});n(this._topMid).css({left:u+"px",top:this._ltPos.top-3+"px"});n(this._leftMid).css({left:this._ltPos.left-3+"px",top:f+"px"})},_resizeImgDupPos:function(){this._ltDupPos=n(this._imgOrg).position();this._imgMidWid=n(this._imgOrg).css("width");this._imgDupHgt=n(this._imgOrg).css("height")},_imgBoxMouseMove:function(i){var s,h;if(this._commonBoxDown)this._rigMidBox?this._imgDupMouseMove(parseInt(i.pageX)-this._ltDupPos.left+"px",this._imgDupHgt,i):this._lefMidBox?(this._imgDupMouseMove(parseInt(this._imgMidWid)+this._ltDupPos.left-i.pageX+"px",this._imgDupHgt,i),n(this._imgDup).offset({left:i.pageX})):this._topMidBox?(this._imgDupMouseMove(this._img_wid,parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),n(this._imgDup).offset({top:i.pageY})):this._botMidBox?this._imgDupMouseMove(this._img_wid,i.pageY-this._ltDupPos.top+"px",i):this._botRigBox?this._imgDupMouseMove(i.pageX-this._ltDupPos.left+"px",i.pageY-this._ltDupPos.top+"px",i):this._botLefBox?(this._imgDupMouseMove(parseInt(this._imgMidWid)+this._ltDupPos.left-i.pageX+"px",i.pageY-this._ltDupPos.top+"px",i),n(this._imgDup).offset({left:i.pageX})):this._topRigBox?(this._imgDupMouseMove(i.pageX-this._ltDupPos.left+"px",parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),n(this._imgDup).offset({top:i.pageY})):this._topLefBox&&(this._imgDupMouseMove(parseInt(this._imgMidWid)+this._ltDupPos.left-i.pageX+"px",parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),n(this._imgDup).offset({top:i.pageY,left:i.pageX}));else if(this._columnDown){this._columnDownClick=!0;this._currentTable=n(this._columnEle).closest("table").find("tr:first td");var o=this._columnEle.style.width==""?n(this._columnEle).width():parseInt(this._columnEle.style.width),r=n(this._columnEle).offset().left,f=r>i.pageX?o+(r-i.pageX):o-(i.pageX-r),y=n(this._currentTable).eq(this._columnIndex-1)[0].style.width==""?n(n(this._currentTable).eq(this._columnIndex-1)).width():parseInt(n(this._currentTable).eq(this._columnIndex-1)[0].style.width),c=o+y;!this._lastCol&&f>15&&c-f>15?(this.nexColIndexWid=c-f,this._columnIndexWid=f,n(this._getDocument()).find(".colresizerline").css({left:i.pageX+"px"})):this._lastCol&&r<i.pageX&&i.pageX-r>15&&(this.lasColIndexWid=i.pageX-r,n(this._getDocument()).find(".colresizerline").css({left:i.pageX+"px"}));this._removeMouseSelection(i);n(this._columnEle).closest("table").find("tr:last td:last span.e-rte-tablebox").css({display:"none"})}else if(this._rowDown)(t.browserInfo().name==="chrome"||t.browserInfo().name==="mozilla")&&(select=this._getDocument().getSelection().removeAllRanges()),s=this._rowEle.offsetTop,h=this._rowEle.parentElement.parentElement.offsetTop,i.pageY-(s+h)>20&&(this._rowEle.style.height=i.pageY-(s+h)+"px"),this._removeMouseSelection(i),n(this._getDocument()).find(".e-rte-tablebox").css({left:n(this._rowEle).closest("table").width()+n(this._rowEle).closest("table").offset().left+"px",top:n(this._rowEle).closest("table").height()+n(this._rowEle).closest("table").offset().top+"px"});else if(this._boxDown){var u=n(this._boxElement),l=u.parent(),e=u.offset(),a=(i.pageX-e.left)/l.width()*100,v=(i.pageY-e.top)/l.height()*100;(t.browserInfo().name==="chrome"||t.browserInfo().name==="mozilla")&&this._getDocument().getSelection().removeAllRanges();i.pageX>0&&a>10&&v>0&&(u.attr({width:a+"%",height:v+"%"}),n(this._getDocument()).find(".e-rte-tablebox").css({left:u.width()+e.left+"px",top:u.height()+e.top+"px"}),u.find("tr:first td").each(function(){var t=n(this);t.width(parseInt(t.closest("table").width()/(t.siblings().length+1)))}));this._removeMouseSelection(i)}},_removeMouseSelection:function(n){return t.browserInfo().name==="mozilla"&&this._getDocument().getSelection().removeAllRanges(),n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault(),n.cancelBubble=!0,n.returnValue=!1,!1},_imgDupMouseMove:function(t,i,r){n(this._imgDup).css({display:"block",width:t,height:i});this._resizeImgDupPos();this._isIE8()&&this._removeMouseSelection(r)},_imageClick:function(t){n(this._getDocument().body).find("img").css("outline","");this._imgDupDiv&&this._imgDupDiv.remove();this._imgSpanBox(t)},_iframePaste:function(i){var r=this,o=t,u,e,f;if(i)try{u=t.isNullOrUndefined(window.clipboardData)?i.originalEvent.clipboardData.getData("text/plain"):window.clipboardData.getData("Text");u.length!=0?r.model.maxLength>=u.length+n.trim(r._getText()).length||i.preventDefault():(e=i.originalEvent.clipboardData.items[0].getAsFile(),f=new FileReader,f.onload=function(n){r.executeCommand("inserthtml","<img src="+n.target.result+" alt />")},f.readAsDataURL(e))}catch(s){}setTimeout(function(){r._setBackupData();r._onChange();r._setAutoHeight();r._updateCount();r._pasteTableResize();o.browserInfo().name=="webkit"?r._getWindow().focus():r._getWindow().document.body.focus()},0)},_pasteTableResize:function(){for(var r=n(this._getDocument()).find("table").not(".e-rte-table"),t,i=0;i<r.length;i++)t=n(r[i]),t.addClass("e-rte-table").removeAttr("style cellspacing").attr({border:1,cellspacing:1,width:t.width()}).css({border:"1px solid#5C5C5C","border-collapse":"separate","border-spacing":"2px"}),t.find("table tr,td").removeAttr("style width"),this._on(t,"mouseover",this._tableMouseOver)},_wireEvents:function(){var i=n(this._getDocument());if(this._getDocument()!=""){if(t.isNullOrUndefined(this._createTable)||this._on(this._createTable,"mouseenter","div.e-rte-tablecell",this._tableCellStart)._on(this._createTable,"mousemove","div.e-rte-tablecell",this._tableCellSelect)._on(this._createTable,"mouseleave","div.e-rte-table",this._tableCellLeave)._on(this._createTable,"mousedown","div.e-rte-tablecell",this._tableCellDown)._on(n(document),"click",this._documentClick),this._on(i,"focus",this._iframeFocus)._on(i,"keydown",this._iframeKeyDown)._on(i,"keypress",this._iframeKeypress)._on(i,"keyup",this._iframeKeyUp)._on(i,"mouseup",this._iframeMouseUp)._on(i,"mousedown",this._iframeMouseDown)._on(n(window),"resize",this._windowResize),!this._isIE8()&&this.model.pasteCleanupSettings&&(this.model.pasteCleanupSettings.cleanElements||this.model.pasteCleanupSettings.removeStyles||this.model.pasteCleanupSettings.cleanCSS||this.model.pasteCleanupSettings.listConversion)||this._on(i,"paste",this._iframePaste),!t.isNullOrUndefined(document.getElementById(this._id+"_Iframe")))n(document.getElementById(this._id+"_Iframe").contentWindow).on("blur",{_proxy:this},this._iframeFocusOut);t.isNullOrUndefined(this._customTableDialog)||this._on(this._customTableDialog.find(".e-rte-txtWidth"),"focusout",this._widthFocusOut)}},_unwireEvents:function(){var i=n(this._getDocument());t.isNullOrUndefined(this._createTable)||this._off(this._createTable,"mousemove","div.e-rte-tablecell")._off(this._createTable,"mouseleave","div.e-rte-table")._off(this._createTable,"mousedown","div.e-rte-tablecell")._off(n(document),"click",this._documentClick);this._off(i,"focus")._off(i,"keydown")._off(i,"keyup")._off(i,"mouseup")._off(i,"mousedown")._off(n(window),"resize",this._windowResize);n(document.getElementById(this._id+"_Iframe").contentWindow).off("blur",this._iframeFocusOut);t.isNullOrUndefined(this._customTableDialog)||this._off(this._customTableDialog.find(".e-rte-txtWidth"),"focusout")},_footerEvents:function(n){this[n](this._htmlSource,"click",this._sourceCodeManager);this[n](this._clearFormat,"click",this._onClearFormat);this[n](this._clearAll,"click",this._clearAllManager)},_onChange:function(){if(_prevhtml=n.trim(this.value()),this.model.enableXHTML&&(this._updateXhtml(),this.model.enableHtmlEncode&&this.value(this._encode(this._removeNoSpaceChar(this.value())))),_prevhtml!==this._removeNoSpaceChar(this.getHtml())){this._updateValue();var t={text:this._getText(),htmlText:this.getHtml(),isInteraction:this._isInteraction};this._trigger("change",t);this._isInteraction=!0}},_disableIframeContent:function(){try{this._rteIframe.contents().find("body,[contenteditable='true']").attr("contenteditable",!1)}catch(n){}},disable:function(){this.model.enabled=!1;this._showHideContextMenu();this.element.attr("disabled","disabled");this._unwireEvents();this.model.showToolbar&&this._toolBarObj.disable();n(this._rteFooter).ejTooltip("option","enabled",!1);this._disableIframeContent();this._rteEditor.addClass("e-disable");this.model.showFooter&&(this._rteFooter.addClass("e-disable"),this._resize.removeClass("e-resizable"),this._footerEvents("_off"));this._disableResizeObj(!1)},enable:function(){this.model.enabled=!0;this._showHideContextMenu();this.element.removeAttr("disabled");this._wireEvents();this.model.showToolbar&&this._toolBarObj.enable();n(this._rteFooter).ejTooltip("option","enabled",!0);this._rteIframe.contents().find("body,[contenteditable='false']").attr("contenteditable",!0);this._rteEditor.removeClass("e-disable");this.model.showFooter&&(this._rteFooter.removeClass("e-disable"),this._resize.addClass("e-resizable"),this._footerEvents("_on"));this._disableResizeObj(!0)},disableToolbarItem:function(i){!t.isNullOrUndefined(i)&&(n(this._toolBarObj.target).find("#"+this._rteId+"_"+i).length!=0||n(this._toolBarObj._liTemplte).find("#"+this._rteId+"_"+i).length!=0)?this._toolBarObj.disableItemByID(this._rteId+"_"+i):this._toolBarObj.disableItemByID(i);i=="undo"&&n("#"+this._rteId+"_"+i).addClass("e-rteTooldisable")},enableToolbarItem:function(i){!t.isNullOrUndefined(i)&&(n(this._toolBarObj.target).find("#"+this._rteId+"_"+i).length!=0||n(this._toolBarObj._liTemplte).find("#"+this._rteId+"_"+i).length!=0)?this._toolBarObj.enableItemByID(this._rteId+"_"+i):this._toolBarObj.enableItemByID(i);i=="undo"&&n("#"+this._rteId+"_"+i).hasClass("e-rteTooldisable");n("#"+i).removeClass("e-rteTooldisable")},removeToolbarItem:function(n){t.isNullOrUndefined(n)||this._toolBarObj.removeItemByID(this._rteId+"_"+n);this._setIframeHeight()},refresh:function(){this._unwireEvents();this._setIFrames();this._setIframeHeight();this.model.enabled?this._wireEvents():this._disableIframeContent();this.model.enableRTL&&this._rteIframe.contents().find("body").css("direction","rtl");this._showHideContextMenu()},show:function(){this._rteWapper.show();this._setIFrames()},hide:function(){this._rteWapper.hide()},setColorPickerType:function(n){n=="palette"||n==="picker"?this._imgPicker.option("modelType",n):this._imgPicker.option("modelType","default")},pasteContent:function(n){this._pasteAPIFlag=!0;this._pasteHtml(n);this._onChange()},getDocument:function(){return this._getDocument()},getHtml:function(t){if(this.model.enableXHTML)return this.model.enableHtmlEncode?t==!1?this._removeNoSpaceChar(n.trim(this._decode(this.value()))):this._removeNoSpaceChar(n.trim(this.value())):this._removeNoSpaceChar(n.trim(this.value()));try{return this.model.enableHtmlEncode?t==!1?this._removeNoSpaceChar(n.trim(this._getDocument().body.innerHTML)):this._removeNoSpaceChar(this._encode(n.trim(this._getDocument().body.innerHTML))):this._removeNoSpaceChar(n.trim(this._getDocument().body.innerHTML))}catch(i){return""}},setHtml:function(t){this._getDocument().body.innerHTML="";this._getDocument().body.innerHTML=n.trim(t);this._onChange();var i=n(this._getDocument()).find("table");!this.model.enableRTL&&i.length>0&&this._on(i,"mouseover",this._tableMouseOver)},getText:function(){return this._getText()},executeCommand:function(i,r,u){if(this._isIE8()&&t.isNullOrUndefined(this._ieSelectionRange)?this._ieSelectionRange=this._getRange():this._isIE()&&i.toLowerCase()=="inserthtml"&&!this._isIE8()&&(this._getRange().startContainer.nodeName.toLowerCase()!="body"?this._currentSelNode=this._getRange().startContainer:this._ieLinkRange()),this._trigger("execute",{commandName:i}))return!1;var f="";if(t.browserInfo().name=="chrome"&&this._getWindow().getSelection().rangeCount==0&&this._restoreSelection(this._saveSelection()),i=="underline"){if(window.getSelection&&(f=n(this._getWindow().getSelection().anchorNode).parents("a"),f.length>0)){n(f).css("text-decoration",n(f).css("text-decoration")=="none"?"underline":"none");return}}else{if(i.toLowerCase()=="inserthtml"){this._isIE()?this._pasteHtml(r,u):this._getDocument().execCommand(i,!1,r);return}i.toLowerCase()=="formatblock"&&this._isIE()&&r.charAt(0)!="<"&&r.charAt(r.length-1)!=">"&&(r="<"+r+">")}t.browserInfo().name=="msie"&&this._focus();this._isIE()&&i=="fontName"&&(r=r.substring(0,r.indexOf(",")));this._getDocument().execCommand(i,!1,r);this._onChange();i=="fontName"||i=="fontSize"||i=="indent"||i=="cut"||i=="copy"||i=="paste"||i=="undo"||i=="redo"||i=="outdent"||t.isNullOrUndefined(this._toolBarObj)||(this._toolBarObj.itemsContainer.find("li#"+this._rteId+"_"+i).hasClass("e-active")?this._toolBarObj.deselectItemByID(this._rteId+"_"+i):this._toolBarObj.selectItemByID(this._rteId+"_"+i));r!="listItem"&&this._setBackupData()},focus:function(){this._focus()},getCommandStatus:function(n){if(t.isNullOrUndefined(n)||n!="")return this._getCommandStatus(n)},getSelectedHtml:function(){return this._getSelectedHtmlString()},insertMenuOption:function(t){if(t.newItem&&t.targetItem&&t.insertType&&t.menuType){var u=this._textMenuObj,f,r=t.newItem,e=t.spriteCssClass?[{text:t.newItem,id:r,spriteCssClass:t.spriteCssClass}]:[{text:t.newItem,id:r}];for(i=0;i<u.element.find("li a").length;i++)if(n(u.element.find("li a")[i]).text()==t.targetItem){f=n(u.element.find("li")[i]).attr("id");break}t.insertType=="insert"?u.insert(e,f?"#"+f:f):t.insertType=="insertAfter"?u.insertAfter(e,"#"+f):t.insertType=="insertBefore"&&u.insertBefore(e,"#"+f);t.menuType.text&&this._contextType.text.push(r);t.menuType.image&&this._contextType.image.push(r);t.menuType.hyperlink&&this._contextType.hyperlink.push(r);t.menuType.table&&(this._contextType.table.push(r),this._contextType.table_hyper.push(r))}},removeMenuOption:function(t){var i=this._textMenuObj;i.remove(["#"+t]);(index=n.inArray(t,this._contextType.text))!=-1&&(this._contextType.text=this._removeContextData(index,this._contextType.text));(index=n.inArray(t,this._contextType.image))!=-1&&(this._contextType.image=this._removeContextData(index,this._contextType.image));(index=n.inArray(t,this._contextType.hyperlink))!=-1&&(this._contextType.hyperlink=this._removeContextData(index,this._contextType.hyperlink));(index=n.inArray(t,this._contextType.table))!=-1&&(this._contextType.textablet=this._removeContextData(index,this._contextType.table));(index=n.inArray(t,this._contextType.table_hyper))!=-1&&(this._contextType.textablet=this._removeContextData(index,this._contextType.table_hyper))},_removeContextData:function(t,i){var r=[];return n(i).each(function(n,i){t!=n&&r.push(i)}),r},insertRow:function(i,r){if(this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length){var e=t.isNullOrUndefined(r)?this._getSelectedNode():r,o="<td "+this._border+"contentEditable='true'><br _moz_dirty=''/><\/td>",u=n(e).closest("tr"),s=u.find("td").length,f=n("<tr>"+Array(s+1).join(o)+"<\/tr>");return i?f.insertBefore(u):f.insertAfter(u),f.find("td:first").focus(),this._setAutoHeight(),e}},insertColumn:function(i,r){var u;if(this.model.maxLength!=null&&this.model.maxLength>n.trim(this._getText()).length){var o=n(this._getSelectedNode()).closest("td"),f=t.isNullOrUndefined(r)?o.length>0?o[0]:this._getSelectedNode():r,s="<td "+this._border+"contentEditable='true'><br _moz_dirty=''/><\/td>",h=n(f).closest("tr"),e,c=h.closest("table").find("tr"),l=h.find("td").index(f);for(u=0;u<c.length;u++)e=n(c[u]).find("td")[l],i?n(s).insertBefore(e):n(s).insertAfter(e);return f}},removeRow:function(i){var r=t.isNullOrUndefined(i)?this._getSelectedNode():i,f=this._getRange(),u=null,e=n(r).closest("table");e.find("tr").length==1?(u=n(r).parent("tr").closest("table").next()[0]||n(r).parent("tr").closest("table").prev()[0],n(r).parent("tr").closest("table").remove()):(u=n(r).parent("tr").prev("tr").length!=0?n(r).parent("tr").prev("tr").find("td:last")[0]:n(r).parent("tr").next("tr").find("td:first")[0],curRow=n(r).closest("tr").remove());t.isNullOrUndefined(u)||this._setRange(u,f);this._setAutoHeight()},selectRange:function(n){this._focus();this._isIE8()?n.select():(select=this._getDocument().getSelection(),select.removeAllRanges(),select.addRange(n))},_encode:function(t){return n("<div/>").text(t).html()},_decode:function(n){return n.replace(/&/g,"&").replace(/&lt;/g,"<").replace(/</g,"<").replace(/&gt;/g,">").replace(/>/g,">").replace(/ /g," ").replace(/&nbsp;/g," ").replace(/"/g)},createRange:function(){return this._isIE8()?this.getDocument().body.createTextRange():this._getRange()},_setRange:function(n,i,r){this._isIE8()?t.isNullOrUndefined(n)||(i.collapse(!0),i.moveToElementText(n),i.moveStart("character",1),i.select()):(i.setStart(n,0),i.collapse(!0),t.browserInfo().name=="msie"&&t.browserInfo().version!="11.0"&&t.isNullOrUndefined(r)?t.isNullOrUndefined(r)&&(selection=this._getDocument().body.createTextRange(),selection.moveToElementText(n)):this.selectRange(i))},removeColumn:function(i){var e=n(this._getSelectedNode()).closest("td"),r=t.isNullOrUndefined(i)?e.length>0?e[0]:this._getSelectedNode():i,h=this._getRange(),o=n(r).closest("tr"),s=o.closest("table").find("tr"),c=o.find("td").index(r),f=t.isNullOrUndefined(r.nextElementSibling)?n(r.previousSibling)[0]:n(r.nextElementSibling)[0],u;if(t.isNullOrUndefined(f))n(r).parent("tr").parents("table").remove();else for(u=0;u<s.length;u++)n(n(s[u]).find("td")[c]).remove();t.isNullOrUndefined(f)||this._setRange(f,h)},removeTable:function(i){var r=t.isNullOrUndefined(i)?n(this._getSelectedNode()).closest("table"):i,u=n(r).parent().closest("table").length<1;this._currentSelNode=n(r).parent()[0];n(r).remove();u&&this._toggleEditTable();this._setAutoHeight();this._removeResizeObject();n(this._getDocument()).find(".e-rte-tablebox").remove()}});t.RTE.Locale=t.RTE.Locale||{};t.RTE.Locale["default"]=t.RTE.Locale["en-US"]={bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",justifyCenter:"Align text center",justifyLeft:"Align text left",justifyRight:"Align text right",justifyFull:"Justify",unorderedList:"Insert unordered list",orderedList:"Insert ordered list",indent:"Increase Indent",fileBrowser:"File Browser",outdent:"Decrease Indent",cut:"Cut",copy:"Copy",paste:"Paste",paragraph:"Paragraph",undo:"Undo",redo:"Redo",upperCase:"Upper Case",lowerCase:"Lower Case",clearAll:"Clear All",clearFormat:"Clear Format",createLink:"Insert/Edit Hyperlink",removeLink:"Remove Hyperlink",tableProperties:"Table Properties",insertTable:"Insert",deleteTables:"Delete",imageProperties:"Image Properties",openLink:"Open Hyperlink",image:"Insert image",video:"Insert video",editTable:"Edit Table Properties",embedVideo:"Paste your embed code below",viewHtml:"View HTML",fontName:"Select font family",fontSize:"Select font size",fontColor:"Select color",customFontColor:"More Colors...",customBGColor:"More Colors...",format:"Format",backgroundColor:"Background color",TransBGColor:"Transparent",style:"Styles",deleteAlert:"Are you sure you want to clear all the contents?",copyAlert:"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+C keyboard shortcut instead of copy operation.",pasteAlert:"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+V keyboard shortcut instead of paste operation.",cutAlert:"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X keyboard shortcut instead of cut operation.",videoError:"The text area can not be empty",imageWebUrl:"Web Address",imageAltText:"Alternate text",dimensions:"Dimensions",constrainProportions:"Constrain Proportions",linkWebUrl:"Web Address",imageLink:"Image as Link",imageBorder:"Image Border",imageStyle:"Style",linkText:"Text",linkTooltipLabel:"Tooltip",html5Support:"This tool icon only enabled in HTML5 supported browsers",linkOpenInNewWindow:"Open link in new window",tableColumns:"No.of Columns",tableRows:"No.of Rows",tableWidth:"Width",tableHeight:"Height",tableCellSpacing:"Cell spacing",tableCellPadding:"Cell padding",tableBorder:"Border",tableCaption:"Caption",tableAlignment:"Alignment",textAlign:"Text align",dialogUpdate:"Update",dialogInsert:"Insert",dialogCancel:"Cancel",dialogApply:"Apply",dialogOk:"Ok",createTable:"Insert Table",insertTable:"Insert",addColumnLeft:"Insert Columns to the Left",addColumnRight:"Insert Columns to the Right",addRowAbove:"Insert Rows Above",addRowBelow:"Insert Rows Below",deleteRow:"Delete entire row",deleteColumn:"Delete entire column",deleteTable:"Delete Table",customTable:"Create custom table...",characters:"Characters",words:"Words",w:"W",c:"C",general:"General",advanced:"Advanced",table:"Table",row:"Row",column:"Column",cell:"Cell",solid:"Solid",dotted:"Dotted",dashed:"Dashed",doubled:"Double",maximize:"Maximize",resize:"Minimize",swatches:"Swatches",paragraph:"Paragraph",quotation:"Quotation",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",segoeui:"Segoe UI",arial:"Arial",couriernew:"Courier New",georgia:"Georgia",impact:"Impact",lucidaconsole:"Lucida Console",tahoma:"Tahoma",timesnewroman:"Times New Roman",trebuchetms:"Trebuchet MS",verdana:"Verdana",disc:"Disc",circle:"Circle",square:"Square",number:"Number",loweralpha:"Lower Alpha",upperalpha:"Upper Alpha",lowerroman:"Lower Roman",upperroman:"Upper Roman",none:"None",linkTooltip:"ctrl + click to follow link",charSpace:"Characters (with spaces)",charNoSpace:"Characters (no spaces)",wordCount:"Word Count",left:"Left",right:"Right",center:"Center",zoomIn:"Zoom In",zoomOut:"Zoom Out",print:"Print","import":"Import a Document",wordExport:"Export as Word Document",pdfExport:"Export as Pdf File",FindAndReplace:"Find and Replace",Find:"Find",MatchCase:"Match Case",WholeWord:"Whole Word",ReplaceWith:"Replace with",Replace:"Replace",ReplaceAll:"Replace All",FindErrorMsg:"Couldn't find specified word.",FindOf:" of ",ReplaceCount:" occurrences were replaced."};t.RTE.ToolbarOverflowMode={Popup:"popup",Inline:"inline"}}(jQuery,Syncfusion),function(n,t){t.RTE=t.RTE||{};t.RTE.FindAndReplace={_findObject:null,_selectedIndex:-1,_findAndReplaceClick:function(t){var r=this._findDialog.element,e=n.trim(n(r).find("[ej-function='findtxt']").val()),o=t.target.tagName=="SPAN"||t.target.tagName=="DIV"?n(t.target).closest("button")[0]:t.target,s=n(r).find("[ej-function='replacetxt']").val(),u=this.getDocument().body,f=n(r).find("[ej-function='replace'],[ej-function='replaceAll']"),i=n(r).find("[ej-function='prev'],[ej-function='next']"),h;if(n(this._findDialog.element).children("span").html(""),!n(o).hasClass("e-disable"))switch(o.getAttribute("ej-function")){case"find":e?(this._findObject.find(e,u,!n(r).find("[ej-function='matchCase']")[0].checked,n(r).find("[ej-function='wholeWords']")[0].checked),this._selectedIndex=-1,this._findObject.nodeCollection.length?(n("#"+this._id+"_rtefindcount").html(""),this._findObject.nodeCollection.length>0?f.ejButton("enable"):f.ejButton("disable"),this._highlightNode(++this._selectedIndex,u),this._updateBtnStatus(this._selectedIndex,i)):(n.merge(i,f).ejButton("disable"),this._findObject.revertAll(),n(this._findDialog.element).children("span").html(this._getLocalizedLabels("FindErrorMsg")))):this._findObject.nodeCollection.length&&this._findObject.revertAll();break;case"next":this._selectedIndex<this._findObject.nodeCollection.length&&(n("#"+this._id+"_rtefindcount").html(""),this._highlightNode(++this._selectedIndex,u));this._updateBtnStatus(this._selectedIndex,i);break;case"prev":this._selectedIndex>0&&(n("#"+this._id+"_rtefindcount").html(""),this._highlightNode(--this._selectedIndex,u));this._updateBtnStatus(this._selectedIndex,i);break;case"replace":this._findObject.replaceByIndex(this._selectedIndex,s);this._findObject.nodeCollection.length?this._selectedIndex>this._findObject.nodeCollection.length-1&&--this._selectedIndex:(n("#"+this._id+"_rtefindcount").html(""),this._selectedIndex=-1);this._selectedIndex>-1?(n("#"+this._id+"_rtefindcount").html(""),this._highlightNode(this._selectedIndex,u),this._updateBtnStatus(this._selectedIndex,i)):n.merge(i,f).ejButton("disable");this._setBackupData();break;case"replaceAll":h=this._findObject.replaceAll(s);this._selectedIndex=-1;n("#"+this._id+"_rteReplaceCount").append(h+this._getLocalizedLabels("ReplaceCount"));n.merge(i,f).ejButton("disable");this._setBackupData()}this._updateCount()},_updateBtnStatus:function(t,i){t<this._findObject.nodeCollection.length-1?n(i[1]).ejButton("enable"):n(i[1]).ejButton("disable");t>0?n(i[0]).ejButton("enable"):n(i[0]).ejButton("disable")},_highlightNode:function(i,r){var u,f;for(n(r).find(".e-highlight").removeClass("e-highlight"),u=0;u<this._findObject.nodeCollection.length;u++)if(i==u)for(f=0;f<this._findObject.nodeCollection[u].length;f++)n(this._findObject.nodeCollection[u][f].node).addClass("e-highlight"),n(t.browserInfo().name=="msie"||t.browserInfo().name=="mozilla"?r.parentElement:r).scrollTop(n(this._findObject.nodeCollection[u][f].node).offset().top-25);n("#"+this._id+"_rtefindcount").append(i+this._getLocalizedLabels("FindOf")+this._findObject.nodeCollection.length)},_renderFindDialog:function(i){var r="<div id='"+this._id+"_basicDialog' title='"+this._getLocalizedLabels("FindAndReplace")+"'><div class='e-maincontent'><div class='e-fd-findcontent'><div class='e-fd-lable'><span>"+this._getLocalizedLabels("Find")+"<\/span><\/div><div class='e-txtbox'><input type='text' ej-function='findtxt' id='"+this._id+"_findtxt' class='e-js e-input'><\/div><div id='"+this._id+"_rtefindcount' class='e-rtefindcount'><\/div><\/div><div class='e-fd-InnerContent'><div><input type='checkbox' ej-function='matchCase' id='"+this._id+"_matchCase' value='true'><label for='"+this._id+"_matchCase' class='e-fd-checkboxlable' style=''>"+this._getLocalizedLabels("MatchCase")+"<\/label><\/div><div class='e-checkbx'><input type='checkbox' ej-function='wholeWords' id='"+this._id+"_wholeWords' value='true'><label for='"+this._id+"_wholeWords' class='e-fd-checkboxlable'>"+this._getLocalizedLabels("WholeWord")+"<\/label><\/div><\/div><div class='e-fd-replacecontent'><div class='e-fd-lable'><span>"+this._getLocalizedLabels("ReplaceWith")+"<\/span><\/div><div class='e-txtbox'><input type='text' ej-function='replacetxt' id='"+this._id+"_replacetxt' class='e-js e-input'><\/div><\/div><\/div><div id='"+this._id+"_rteReplaceCount' class='e-rteReplaceCount'><\/div><span style='text-align: center;'><\/span><div class='e-fd-btncol'><div class='e-btn-left'><button id='"+this._id+"_find' ej-function='find'>"+this._getLocalizedLabels("Find")+"<\/button><button id='"+this._id+"_replace' ej-function='replace'>"+this._getLocalizedLabels("Replace")+"<\/button><button id='"+this._id+"_replaceAll' class='ejRTE-replaceAll' ej-function='replaceAll'>"+this._getLocalizedLabels("ReplaceAll")+"<\/button><\/div><div class='e-btn-right'><button id='"+this._id+"_prev' ej-function='prev'><\/button><button id='"+this._id+"_next' ej-function='next'><\/button><\/div><\/div><\/div>";i._findDialog=n(r).ejDialog({width:"auto",minWidth:"300px",maxWidth:"380px",isResponsive:!0,close:this._onCloseFindAndReplace,cssClass:"e-rte e-findandreplace",enableRTL:i.model.enableRTL,enableResize:!1,enableModal:!0}).data("ejDialog");n(i._findDialog.element).find("input[type=text]").val("");n(i._findDialog.element).find("button").ejButton({height:30});n(i._findDialog.element).find("[ej-function='replace'],[ej-function='replaceAll'],[ej-function='prev'],[ej-function='next']").ejButton("disable");n(i._findDialog.element).find("[ej-function='prev'],[ej-function='next']").ejButton({height:30,width:30,contentType:"imageonly"});n(i._findDialog.element).find("[ej-function='prev']").ejButton({prefixIcon:"e-icon e-chevron-left_02"}).next().ejButton({prefixIcon:"e-icon e-chevron-right_02"});n(i._findDialog.element).find("[ej-function='wholeWords'],[ej-function='matchCase']").ejCheckBox({enableRTL:i.model.enableRTL,checked:!1});this._findObject=new t.FindAndReplace;this._on(i._findDialog.element.find("button"),"click",this._findAndReplaceClick)},_onCloseFindAndReplace:function(){n("#"+this._id.replace("_basicDialog","")).data("ejRTE")._findObject.revertAll();this.element.find("[ej-function='replace'],[ej-function='replaceAll'],[ej-function='prev'],[ej-function='next']").ejButton("disable");this.element.find("input[type=text]").val("");this.element.find("[ej-function='wholeWords'],[ej-function='matchCase']").ejCheckBox({checked:!1});this.element.children("span").html("");n(".e-rteReplaceCount").html("");n(".e-rtefindcount").html("")},_showFindAndReplace:function(){this._findDialog?this._findDialog.open():this._renderFindDialog(this)}}}(jQuery,Syncfusion),function(){ej.FindAndReplace=function(){this.indexLength=0;this.elements=[];this.matches=[];this.nodeCollection=[];this.specialChar=/([{}()|[\]\/\\.*+?^=!:$])/g;this.escapeContent="\\$1"};ej.FindAndReplace.prototype._addContentEscape=function(n){return String(n).replace(this.specialChar,this.escapeContent)};ej.FindAndReplace.prototype.find=function(n,t,i,r){return this.nodeCollection.length&&this.revertAll(),this._validateTextContent(n,this._getFormatedText(t),i,r),this.matches.length?(this._iterateNodes(t),this.matches=[],!0):!1};ej.FindAndReplace.prototype._replace=function(n,t){for(var i=0;i<n.length;i++)!i||!t?this._elementDefragment(n[i].node,t):$(n[i].node).remove()};ej.FindAndReplace.prototype.replaceByIndex=function(n,t){for(var r=[],i=0;i<this.nodeCollection.length;i++)i==n?this._replace(this.nodeCollection[i],t):r.push(this.nodeCollection[i]);this.nodeCollection=r};ej.FindAndReplace.prototype.replaceAll=function(n){for(var t=0;t<this.nodeCollection.length;t++)this._replace(this.nodeCollection[t],n);return this.nodeCollection=[],t};ej.FindAndReplace.prototype.revertAll=function(){for(var n=0;n<this.nodeCollection.length;n++)this._replace(this.nodeCollection[n]);this.nodeCollection=[]};ej.FindAndReplace.prototype._elementDefragment=function(n,t){var i=n.nextSibling,r=n.previousSibling;i&&r&&i.nodeType==3&&r.nodeType==3?(i=n.previousSibling,i.data=i.data+(t!=undefined?t:n.firstChild.data)+n.nextSibling.data,$(n.nextSibling).remove(),$(n).remove()):i&&i.nodeType==3?(i=n.nextSibling,i.data=(t!=undefined?t:n.firstChild.data)+i.data,$(n).remove()):r&&r.nodeType==3?(i=n.previousSibling,i.data=i.data+(t!=undefined?t:n.firstChild.data),$(n).remove()):(i=t!=undefined?document.createTextNode(t):n.firstChild,$(n).replaceWith(i))};ej.FindAndReplace.prototype._validateTextContent=function(n,t,i,r){for(var u=this._addContentEscape(n),f=new RegExp(r?"\\b"+u+"\\b":u,i?"gi":"g");data=f.exec(t);)this.matches.push({startIndex:data.index,endIndex:data.index+n.length});return this.matches};ej.FindAndReplace.prototype._traverseNode=function(n,t){if(n.nodeType===3&&(out=this._validateData(n,t),out.curNode&&(n=out.curNode),out.status))return!0;if(n=n.firstChild)do if(n.nodeType===3){if(out=this._validateData(n,t),out.curNode&&(n=out.curNode),out.status)return!0}else if(this._traverseNode(n,t))return!0;while(n=n.nextSibling);return!1};ej.FindAndReplace.prototype._validateData=function(n,t){var i=this.indexLength,r=this.indexLength+n.length;return this.indexLength=this.indexLength+n.length,i>=t.startIndex||t.startIndex<r?this._elementFragment(t,{startIndex:i,endIndex:r},n):{status:!1}};ej.FindAndReplace.prototype._elementFragment=function(n,t,i){var u=i.data,r=i,f,e;if(n.startIndex<=t.startIndex&&n.endIndex>=t.endIndex)r=ej.buildTag("span.e-selected-node").append(document.createTextNode(i.data))[0],$(i).replaceWith(r),this.elements.push({node:r});else if(n.startIndex<=t.startIndex&&n.endIndex<t.endIndex)f=n.endIndex-n.startIndex,e=ej.buildTag("span.e-selected-node").append(document.createTextNode(u.substr(0,f)))[0],$(e).insertBefore(i),i.data=u.substr(f),this.elements.push({node:e});else if(n.startIndex>t.startIndex&&n.endIndex>=t.endIndex)f=n.startIndex-t.startIndex,r=ej.buildTag("span.e-selected-node").append(document.createTextNode(u.substr(f)))[0],$(r).insertAfter(i),i.data=u.substr(0,f),this.elements.push({node:r});else if(n.startIndex>t.startIndex&&n.endIndex<t.endIndex){var o=n.startIndex-t.startIndex,s=o+(n.endIndex-n.startIndex),e=ej.buildTag("span.e-selected-node").append(document.createTextNode(u.substring(o,s)))[0];r=document.createTextNode(u.substring(s));i.data=u.substr(0,o);$(r).insertAfter(i);$(e).insertAfter(i);this.elements.push({node:e})}return{status:n.endIndex>t.startIndex&&n.endIndex<=t.endIndex,curNode:r}};ej.FindAndReplace.prototype._getFormatedText=function(n){var t="";if(n.nodeType===3)return n.data.replace(/\n/g," ");if(n=n.firstChild)do t+=n.nodeType===3?n.data.replace(/\n/g," "):this._getFormatedText(n);while(n=n.nextSibling);return t};ej.FindAndReplace.prototype._iterateNodes=function(n){temp=this;$(this.matches).each(function(t,i){temp._traverseNode(n,i);temp.nodeCollection.push(temp.elements);temp.indexLength=0;temp.elements=[]})}}();ej.RTE.FindAndReplace&&$.extend(ej.RTE.prototype,ej.RTE.FindAndReplace);clipboardCleaner=function(){function n(n,t,i){function u(n){if(r.CleanerState&&(r._pasteHandler(n),r.syncLoad))return n.preventDefault(),n.stopPropagation(),!1}function f(n){r.CleanerState&&r._keydownHandler(n)}this.CleanerState=!0;this.syncLoad=!1;this.listContents=[];this.blockNode=["div","p","h1","h2","h3","h4","h5","h6","address","blockquote","button","center","dd","dir","dl","dt","fieldset","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this.flagState=!0;this.content=null;this.htmlContent="";this.insertCleanedContent=!0;this.filterOptions={listConversion:!0,cleanCSS:!0,removeStyles:!1,cleanElements:!0};this.Collection=[];this.blockqouteNodes=[];this.tempCleaner=[];this.ignorableNodes=["A","APPLET","B","BLOCKQUOTE","BR","BUTTON","CENTER","CODE","COL","COLGROUP","DD","DEL","DFN","DIR","DIV","DL","DT","EM","FIELDSET","FONT","FORM","FRAME","FRAMESET","H1","H2","H3","H4","H5","H6","HR","I","IMG","IFRAME","INPUT","INS","LABEL","LI","OL","OPTION","P","PARAM","PRE","Q","S","SELECT","SPAN","STRIKE","STRONG","SUB","SUP","TABLE","TBODY","TD","TEXTAREA","TFOOT","TH","THEAD","TITLE","TR","TT","U","UL"];this.listNodes=[];this.ulData=["disc","square","circle","disc","square","circle"];this.olData=["decimal","lower-alpha","lower-roman","upper-alpha","upper-roman","lower-greek"];var r=this;this.callback=t;this.env=i;this.currentDocument=n;this._isIE()&&(this.currentDocument.body.addEventListener?this.currentDocument.body.addEventListener("keydown",f):this.currentDocument.body.attachEvent("onkeydown",f));this.currentDocument.body.addEventListener?this.currentDocument.body.addEventListener("paste",u):this.currentDocument.body.attachEvent("onpaste",u)}return n.prototype._keydownHandler=function(n,t){t===void 0&&(t=!1);(this._isIE()&&n.ctrlKey&&!n.shiftKey&&n.keyCode==86&&this.flagState||t)&&(this.flagState=!1,this._setContent())},n.prototype._setContent=function(){var u=this,n,i,r,t;this.content=this.currentDocument.createElement("div");i=this.currentDocument.createElement("P");this.content.id="ClipboardData";this.content.style.position="absolute";this.content.style.height="10px";this.content.style.width="10px";this.content.style.overflow="hidden";this.content.style.top="-3000px";n=this.currentDocument.createTextNode("PastedContent");ej.browserInfo().name=="chrome"?(i.appendChild(n),this.content.appendChild(i)):this.content.appendChild(n);window.getSelection&&(r=this.currentDocument.getSelection(),r.rangeCount>0&&(t=r.getRangeAt(0),t.deleteContents(),t.collapse(!0),t.insertNode(this.content),this._updateRange(n,0,n.textContent.length),this.content.focus(),this.syncLoad=!1))},n.prototype._insertContent=function(n){var t;n===void 0&&(n=!0);var r=this.currentDocument.createElement("span"),i=[],u,f=this.currentDocument.createElement("p");if(r.appendChild(u=this.currentDocument.createTextNode(String.fromCharCode(65279))),f.appendChild(r),this._finalCleanup(this.Container),this.Container.appendChild(f),this._isIE()&&n){for(i=[],t=this.Container.childNodes.length-1;t>-1;t--)i.push(this.Container.childNodes.item(t));for(t=0;t<i.length;t++)this._insertAfter(this.content,i[t]);this.content.removeNode(!0)}else this._contentPositionHandler();$(ej.browserInfo().name=="msie"||ej.browserInfo().name=="mozilla"?this.currentDocument.body.parentNode:this.currentDocument.body).scrollTop($(r).offset().top-25);this.callback.call(this.env);this._updateRange(u,0,u.textContent.length)},n.prototype._insertAfter=function(n,t){n.nextSibling?n.parentElement.insertBefore(t,n.nextSibling):n.parentElement.appendChild(t)},n.prototype._findValidListType=function(n){if(n.nodeType==3&&n.textContent.trim().length>0&&this.listContents.push(n.textContent),n=n.firstChild)do this._findValidListType(n);while(n=n.nextSibling)},n.prototype._createNodeCollection=function(n){for(var t=this.currentDocument.createElement(n.shift()),r,i=t;r=n.shift();)t=this.currentDocument.createElement(r).appendChild(t);return{leaf:i,root:t}},n.prototype._contentPositionHandler=function(){var s=this.currentDocument.getSelection(),n,r,h=[],u=[],f,e,o,t,i;if(s.rangeCount>0)if(this.content&&(e=this.currentDocument.createRange(),o=this.currentDocument.getSelection(),e.selectNode(this.content),o.removeAllRanges(),o.addRange(e)),t=s.getRangeAt(0),t.startContainer==t.endContainer){if(t.startOffset!=t.endOffset&&t.deleteContents(),t.insertNode(this.Container),n=this.Container.parentNode,n.nodeName.toLowerCase()!="body"){do h.push(n.nodeName.toLowerCase());while(this.blockNode.indexOf(n.nodeName.toLowerCase())==-1&&(n=n.parentElement));for(f=this._createNodeCollection(h),n&&(n.nextSibling?n.parentElement.insertBefore(f.root,n.nextSibling):n.parentElement.appendChild(f.root)),n=this.Container;n=n.nextSibling;)f.leaf.appendChild(n);this._insertAfter(this.Container.parentElement,this.Container)}for(i=0;i<this.Container.childNodes.length;i++)u.push(this.Container.childNodes[i]);while(r=u.shift())this.Container.parentElement.insertBefore(r,this.Container)}else{for(t.deleteContents(),t.insertNode(this.Container),i=0;i<this.Container.childNodes.length;i++)u.push(this.Container.childNodes[i]);while(r=u.shift())this.Container.parentElement.insertBefore(r,this.Container)}this._remove(this.Container);this._remove(this.content);this.content=null},n.prototype._updateRange=function(n,t,i){var r=this.currentDocument.createRange(),u=this.currentDocument.getSelection();r.setStart(n,t);r.setEnd(n,i);u.removeAllRanges();u.addRange(r)},n.prototype._pasteHandler=function(n){this.clipboardData={plain:null,rtf:null,html:null};this.syncLoad=!1;this._isIE()?this._extractClipboardIE(n):(this._fillClipboard(n),this._extractClipboardNonIE(n))},n.prototype._isIE=function(){return navigator.userAgent.match(/Trident|msie/i)!=null},n.prototype._extractClipboardNonIE=function(n){if(this.clipboardData.html)this.content=null,this.htmlContent=this.clipboardData.html,this._processContent(n);else if(ej.browserInfo().name=="chrome"&&this.clipboardData.plain){var u=this.currentDocument.createElement("div"),r,i=this.clipboardData.plain.split("\n"),t=this.currentDocument.createElement("p");if(i.length)while(r=i.shift())t.appendChild(this.currentDocument.createTextNode(r)),i.length&&t.appendChild(this.currentDocument.createElement("br"));else t.appendChild(this.currentDocument.createTextNode(this.clipboardData.plain));this.htmlContent=t.innerHTML;this._processContent(n,!1)}else n&&n.clipboardData&&n.clipboardData.items.length?this.callback.call(this.env,n):(this._setContent(),this._contentUpdater())},n.prototype._extractClipboardIE=function(){this._contentUpdater()},n.prototype._contentUpdater=function(){var n=this;setTimeout(function(){n.content&&(n.clipboardData.html=n.htmlContent=n.content.innerHTML);n.flagState||(n.flagState=!0);n._processContent()},0)},n.prototype._fillClipboard=function(n){this.clipboardData.html=n.clipboardData.getData("text/html")?n.clipboardData.getData("text/html"):null;this.clipboardData.plain=n.clipboardData.getData("text/plain")?n.clipboardData.getData("text/plain"):null;this.clipboardData.rtf=n.clipboardData.getData("text/rtf")?n.clipboardData.getData("text/rtf"):null},n.prototype._processContent=function(n,t){var r;n===void 0&&(n=null);t===void 0&&(t=!0);var i=this.currentDocument.createElement("p"),e=this,u=!0,f=this.currentDocument.createElement("p");if(/class="?Mso|style="[^ ]*\bmso-/i.test(this.htmlContent)&&t)this.htmlContent=this.htmlContent.replace(/<img[^>]+>/i,""),i.innerHTML=this.htmlContent,this.syncLoad=!0,this.Collection=[],this.blockqouteNodes=[],this.listNodes=[],this._cleanup(i),this._flush(),this.filterOptions.listConversion&&this._listConverter(),this.filterOptions.cleanElements&&(this._blockquoteConvert(),this._cleanElement(i),this._flush()),this.filterOptions.cleanCSS&&(this._cleanStyles(i),this._flush(!1)),this.Container=i,this.insertCleanedContent&&this._insertContent();else{if(this.syncLoad=!0,i.innerHTML=this.htmlContent,this.filterOptions.cleanCSS&&(this._cleanStyles(i),this._flush(!1)),i.childNodes.length){for(r=0;r<i.childNodes.length;r++)this.blockNode.indexOf(i.childNodes[r].nodeName.toLowerCase())!=-1&&(u=!1);u&&(f.appendChild(i),i=f)}this.Container=i;this.insertCleanedContent&&this._insertContent(!u)}},n.prototype._flush=function(n){var t,r,i;if(n===void 0&&(n=!0),r=[],n)while(t=this.tempCleaner.shift())this._remove(t);else while(t=this.tempCleaner.shift()){if(t.childNodes.length){for(r=[],i=0;i<t.childNodes.length;i++)r.push(t.childNodes[i]);for(i=0;i<r.length;i++)t.parentElement.insertBefore(r[i],t)}this._remove(t)}},n.prototype._makeConvertion=function(){for(var u=this.currentDocument.createElement("div"),i,f=1,t,e=0,r,n=0;n<this.Collection.length;n++){if(this.Collection[n].level==1&&e==0)this.Collection[n].content&&(u.appendChild(i=this.currentDocument.createElement(this.Collection[n].type)),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level));else if(this.Collection[n].level==f)t.parentElement.tagName.toLowerCase()==this.Collection[n].type?(t.parentElement.appendChild(t=this.currentDocument.createElement("li")),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent))):(i=this.currentDocument.createElement(this.Collection[n].type),this._insertAfter(t.parentElement,i),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()));else if(this.Collection[n].level>f)t.appendChild(i=this.currentDocument.createElement(this.Collection[n].type)),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),t.style.marginLeft=(this.Collection[n].level-f-1)*40+"px",i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level);else if(this.Collection[n].level==1)u.lastChild.tagName.toLowerCase()==this.Collection[n].type?i=u.lastChild:u.appendChild(i=this.currentDocument.createElement(this.Collection[n].type)),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level);else for(r=t;r=r.parentElement;){if(r.attributes.getNamedItem("level"))if(parseInt(r.attributes.getNamedItem("level").textContent)==this.Collection[n].level){r.tagName.toLowerCase()==this.Collection[n].type?(t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),r.appendChild(t)):(i=this.currentDocument.createElement(this.Collection[n].type),this._insertAfter(t.parentElement,i),t=this.currentDocument.createElement("li"),t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent)),i.appendChild(t),i.setAttribute("level",this.Collection[n].level.toString()),i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level));break}else if(this.Collection[n].level>parseInt(r.attributes.getNamedItem("level").textContent)){r.appendChild(i=this.currentDocument.createElement(this.Collection[n].type));t=this.currentDocument.createElement("li");t.appendChild(this.currentDocument.createTextNode(this.Collection[n].content.textContent));i.appendChild(t);t.style.marginLeft=(this.Collection[n].level-parseInt(r.attributes.getNamedItem("level").textContent)-1)*40+"px";i.setAttribute("level",this.Collection[n].level.toString());i.style.listStyle=this._getlistStyle(this.Collection[n].type,this.Collection[n].level);break}continue}f=this.Collection[n].level;e++}return u},n.prototype._listConverter=function(){for(var i,r,e,o,t,s,u=[],f=[],n=0;n<this.listNodes.length;n++){if(this.listNodes[n]==null){u.push({content:this._makeConvertion(),node:this.listNodes[n-1]});this.Collection=[];continue}r=this.listNodes[n].attributes.getNamedItem("style").textContent;e=r&&r.indexOf("level")!=-1?parseInt(r.charAt(r.indexOf("level")+5)):1;this.listContents=[];this._findValidListType(this.listNodes[n]);o=this.listContents[0].length>1?"ol":"ul";s=this.listContents[1]?this.currentDocument.createTextNode(this.listContents[1]):this.currentDocument.createTextNode("");this.Collection.push({type:o,content:s,level:e})}while((t=this.listNodes.shift())?t:t=this.listNodes.shift()){for(f=[],i=0;i<u.length;i++)if(u[i].node==t){for(n=0;n<u[i].content.childNodes.length;n++)f.push(u[i].content.childNodes[n]);for(n=0;n<f.length;n++)t.parentElement.insertBefore(f[n],t);break}t.remove&&t.remove();t.removeNode&&t.removeNode(!0)}},n.prototype._blockquoteConvert=function(){for(var t,r,i=[],n=0;n<this.blockqouteNodes.length;n++){if(r=this.currentDocument.createElement("blockquote"),i=[],this.blockqouteNodes[n].childNodes&&this.blockqouteNodes[n].childNodes.length){for(t=0;t<this.blockqouteNodes[n].childNodes.length;t++)i.push(this.blockqouteNodes[n].childNodes.item(t));for(t=0;t<i.length;t++)r.appendChild(i[t])}this.blockqouteNodes[n].parentElement.insertBefore(r,this.blockqouteNodes[n]);this.blockqouteNodes[n].remove&&this.blockqouteNodes[n].remove();this.blockqouteNodes[n].removeNode&&this.blockqouteNodes[n].removeNode(!0)}},n.prototype._cleanup=function(n){for(var i,t=0;t<n.childNodes.length;t++){if(this.ignorableNodes.indexOf(n.childNodes[t].nodeName)==-1||n.childNodes[t].nodeType==3&&n.childNodes[t].textContent.trim()==""){this.tempCleaner.push(n.childNodes[t]);continue}else n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msoquote")!=-1?this.blockqouteNodes.push(n.childNodes[t]):n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msolistparagraph")!=-1&&this.listNodes.push(n.childNodes[t]);!i||this.blockNode.indexOf(n.childNodes[t].nodeName.toLowerCase())==-1||n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msolistparagraph")!=-1||this.listNodes.push(null);this.blockNode.indexOf(n.childNodes[t].nodeName.toLowerCase())!=-1&&(i=n.childNodes[t].className&&n.childNodes[t].className.toLowerCase().indexOf("msolistparagraph")!=-1?!0:!1)}this.listNodes.length&&this.listNodes[this.listNodes.length-1]!=null&&this.listNodes.push(null)},n.prototype._finalCleanup=function(n){for(var i,r=[],t=0;t<n.childNodes.length;t++)n.childNodes[t]&&n.childNodes[t].nodeType!=3&&this.blockNode.indexOf(n.childNodes[t].nodeName.toLowerCase())!=-1&&n.childNodes[t].innerHTML&&n.childNodes[t].innerHTML.trim()==""&&r.push(n.childNodes[t]);while(i=r.shift())this._remove(i)},n.prototype._getlistStyle=function(n,t){return t=t>0?t-1:t,n=="ol"?t<this.olData.length?this.olData[t]:this.olData[0]:t<this.ulData.length?this.ulData[t]:this.ulData[0]},n.prototype._cleanElement=function(n){if(n.nodeType==3?n.textContent.trim()==""&&this.tempCleaner.push(n):n&&this.ignorableNodes.indexOf(n.nodeName)==-1&&this.tempCleaner.push(n),n=n.firstChild)do this._cleanElement(n);while(n=n.nextSibling)},n.prototype._cleanStyles=function(n){if(n&&n.nodeType!=3&&(this._cleanCSSClass(n),this._cleanCSSStyle(n),n.nodeName!="SPAN"||n.attributes.getNamedItem("style")||n.attributes.getNamedItem("class")?n.nodeName=="FONT"&&this.filterOptions.removeStyles&&this.tempCleaner.push(n):this.tempCleaner.push(n)),n=n.firstChild)do this._cleanStyles(n);while(n=n.nextSibling)},n.prototype._cleanCSSClass=function(n){var t;if(n.attributes&&n.attributes.getNamedItem("class")&&(this.filterOptions.cleanCSS||this.filterOptions.removeStyles)){var i=n.className.split(" "),r="",u=void 0;for(t=0;t<i.length;t++)i[t].toLowerCase().indexOf("mso")==-1&&this.filterOptions.cleanCSS&&(r+=i[t]+" ");r.length&&!this.filterOptions.removeStyles?(u=this.currentDocument.createAttribute("class"),u.value=r,n.attributes.setNamedItem(u)):n.attributes.removeNamedItem("class")}},n.prototype._cleanCSSStyle=function(n){var t;if(n.attributes&&n.attributes.getNamedItem("style")&&(this.filterOptions.cleanCSS||this.filterOptions.removeStyles)){var i=n.attributes.getNamedItem("style").textContent.split(";"),r="",u=void 0;for(t=0;t<i.length;t++)i[t].toLowerCase().indexOf("mso")==-1&&(r+=i[t]+";");r.length&&!this.filterOptions.removeStyles?(u=this.currentDocument.createAttribute("style"),u.value=r,n.attributes.setNamedItem(u)):n.attributes.removeNamedItem("style");!n.attributes.getNamedItem("align")||n.tagName==="FONT"||n.attributes.removeNamedItem("align")}},n.prototype._remove=function(n){n&&(n.remove?n.remove():n.removeNode?n.removeNode(!0):n.textContent&&(n.textContent=""))},n}();$.extend(ej,{clipboardCleaner:clipboardCleaner});window.ClipboardCleaner=undefined,function(n){var u=function(){function n(n,t){this.formatInfo=new o;this._nodeCollection=[];this._iterationStatus=!1;this.filterNode=["div","p","h1","h2","h3","h4","h5","h6","address","applet","blockquote","button","center","dd","dir","dl","dt","fieldset","form","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","script","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this.advanceFilterNode=["img","video","table","tbody","tr","td","th"];this.indentFilter=["img","video"];this._junkSpanNodes=[];this.currentDocument=n;this.currentWindow=t;this._rangeExtract=new s(this.currentDocument);this._bindEvent()}return n.prototype._bindEvent=function(){$(this.currentDocument.body).on("keydown",$.proxy(this._editorKeyUpEvent,this))},n.prototype._editorKeyUpEvent=function(n){if(this._junkContentStatus){var t=this._getRangy(this.currentWindow,this.currentDocument),i=t.startContainer,r=t.startOffset;!n.shiftKey&&n.which>=37&&n.which<=40&&i.nodeType==3&&(this._junkContentStatus=!1,this._iterateCompleteNode(i,n,r))}},n.prototype._iterateCompleteNode=function(n,t,i){var r=n.data.length;this._junkSpanNodes=[];this._removeJunkContent(this.currentDocument.body);this._collectJunkSpanNodes(this.currentDocument.body);this._removeJunkSpanNodes();r>n.data.length&&i--;n.data||$(n).remove();n.data.trim()&&this._updateCursor(n,i)},n.prototype._collectJunkSpanNodes=function(n){var t=n;if($(t).is("span")&&!$(t).attr("style")&&this._junkSpanNodes.push(t),t=t.firstChild)do $(t).is("span")&&!$(t).attr("style")&&this._junkSpanNodes.push(t),this._collectJunkSpanNodes(t);while(t=t.nextSibling)},n.prototype._removeJunkSpanNodes=function(){for(var n;n=this._junkSpanNodes.shift();)n.childNodes.length?$(n).replaceWith(n.childNodes):$(n).remove()},n.prototype._removeJunkContent=function(n){var t=n;if(t.nodeType==3&&this._removeCursorText(t),t=t.firstChild)do t.nodeType==3?this._removeCursorText(t):this._removeJunkContent(t);while(t=t.nextSibling)},n.prototype._removeCursorText=function(n){n.data=n.data.replace(String.fromCharCode(65279),"")},n.prototype.focus=function(){var n=this;setTimeout(function(){var t=ej.browserInfo();t.name=="webkit"?n.currentWindow.focus():n.currentWindow.document.body.focus()},100)},n.prototype._justifyContent=function(n){this._backUpRange(this.currentDocument,this.currentWindow);this._getModifedRange(this._getRangy(this.currentWindow,this.currentDocument));this._onApplyjustify(n,this.currentDocument,this.currentWindow);this._resetRange(this.currentDocument,this.currentWindow)},n.prototype._applyFormateBlock=function(n){var t=this._getRangy(this.currentWindow,this.currentDocument);this._backUpRange(this.currentDocument,this.currentWindow);this._applyChanges(n,this.currentDocument,this.currentWindow);this._resetRange(this.currentDocument,this.currentWindow);this._selectionRange=this._getRangy(this.currentWindow,this.currentDocument)},n.prototype._applyList=function(n,t){this._backUpRange(this.currentDocument,this.currentWindow);this._getModifedRange(this._getRangy(this.currentWindow,this.currentDocument));this._applyOrderedList(n.toLowerCase()=="orderlist"?"ol":"ul",this.currentDocument,this.currentWindow,t);this._resetRange(this.currentDocument,this.currentWindow)},n.prototype._applyIndent=function(n){this._backUpRange(this.currentDocument,this.currentWindow);this._getModifedRange(this._getRangy(this.currentWindow,this.currentDocument));n?this._onApplyIndent(this.currentDocument,this.currentWindow):this._onApplyDecreaseIndent(this.currentDocument,this.currentWindow);this._resetRange(this.currentDocument,this.currentWindow)},n.prototype._getRangy=function(n,t){if(n.getSelection()&&n.getSelection().rangeCount>0)return n.getSelection().getRangeAt(0);var i;try{i=n.document.createRange();i.setStart(n.document.body,0);i.setEnd(n.document.body,0)}catch(r){i=t.createRange();i.setStart(t.body,0);i.setEnd(t.body,0)}return i},n.prototype._getexactSelectedNode=function(n,t){function e(n){if(n.nodeType==3&&($.trim(n.nodeValue)!=""||n.nodeValue==""||$.trim(n.nodeValue)==""&&n.nextSibling==f[0]))i.push(n);else if(n.nodeValue&&n.nodeName!="#comment"&&n.nodeValue.trim()==""&&r.range.endContainer.parentNode.nextSibling!=r._next)$.inArray(n.previousElementSibling,u)<0&&u.push(n.previousElementSibling);else if((n.nodeName.toLowerCase()=="br"||$.inArray(n.nodeName.toLowerCase(),r.filterNode)<0)&&$.inArray(n.parentNode,i)<0&&n.nodeName.toLowerCase()!="body"&&$.inArray(n.nodeName.toLowerCase(),r.advanceFilterNode)<0&&!ej.isNullOrUndefined(i[i.length-1])&&i[i.length-1].parentNode!=n.parentNode&&n.previousSibling&&n.previousSibling.parentNode!=n.parentNode)i.push(n.parentNode);else if($.inArray(n.nodeName.toLowerCase(),r.advanceFilterNode)>=0&&ej.isNullOrUndefined(n.firstChild))i.push(n);else for(n=n.firstChild;n;)e(n),n=n.nextSibling}var i=[],u=[],f,r;return this._parentDoc=t,f=$(this._parentDoc.body).find("span#startRange"),r=this,this._generateRange(n),this._traverse(e),i},n.prototype._getStartEndElement=function(n,t){if(this._isAncestor(t,n))while(n&&n.parentNode!=t)n=n.parentNode;return n},n.prototype._generateRange=function(n){var t=n.commonAncestorContainer;this._next=n.startContainer==t&&!this._isTextNode(n.startContainer)?n.startContainer.childNodes[n.startOffset]:this._getStartEndElement(n.startContainer,t);this._end=n.endContainer==t&&!this._isTextNode(n.endContainer)?n.endContainer.childNodes[n.endOffset]:this._getStartEndElement(n.endContainer,t).nodeName.toLowerCase()!="body"&&this._getStartEndElement(n.endContainer,t).nextSibling},n.prototype._traverse=function(n){function u(){return t._next!=(t._isTextNode(t.range.endContainer)?t.range.endContainer.parentNode.nextSibling:t.range.endContainer.nextElementSibling)&&t.range.endContainer.parentNode.nextSibling!=t._next?(t._current=t._next,t._next=t._current&&t._current.nextSibling!=$(t._parentDoc.body).find("span#endRange")[0]&&t._current.nextSibling!=(ej.isNullOrUndefined(t._end)?t.range.endContainer.nextSibling:t._end)?t._current.nextSibling:null,t._current):null}for(var t=this,r,i;r=u();)if(t._hasSubNodes())t._getSubtree(t._getRangy(t.currentWindow,t.currentDocument)),t._traverse(n);else{if(i=r,t.range.startContainer.nodeName.toLowerCase()!="body"&&t._next==null&&i!=t.range.endContainer)while(ej.isNullOrUndefined(t._next)&&!ej.isNullOrUndefined(i))i=i.parentNode,ej.isNullOrUndefined(i)||t._current.nextSibling==$(t._parentDoc.body).find("span#endRange")[0]||(t._next=i.nextSibling);n(r)}return r},n.prototype._hasSubNodes=function(){return!this._isTextNode(this._current)&&(this._isAncestorItself(this._current,this.range.startContainer)||this._isAncestorItself(this._current,this.range.endContainer))},n.prototype._isTextNode=function(n){return n&&n.nodeValue!==null&&n.data!==null},n.prototype._isAncestor=function(n,t){try{return!this._isTextNode(n)&&($.contains(n,this._isTextNode(t)?t.parentNode:t)||t.parentNode==n)}catch(i){return!1}},n.prototype._isAncestorItself=function(n,t){return this._isAncestor(n,t)||n==t},n.prototype._getSubtree=function(){var n=this,t=n.range.cloneRange();return t.selectNodeContents(n._current),n._isAncestorItself(n._current,n.range.startContainer)&&t.setStart(n.range.startContainer,n.range.startOffset),n._isAncestorItself(n._current,n.range.endContainer)&&t.setEnd(n.range.endContainer,n.range.endOffset),this._generateRange(t)},n.prototype._getModifedRange=function(n){if(n.endOffset==0&&n.startContainer!=n.endContainer){var t=n.endContainer;do t=ej.isNullOrUndefined(n.endContainer.previousSibling)?t.parentNode:t;while(ej.isNullOrUndefined(t.previousSibling));this._isTextNode(t.previousSibling)&&$.trim(t.previousSibling.textContent).length!=0?n.setEnd(t.previousSibling,t.previousSibling.childNodes.length):n.setEnd(t.previousSibling,t.previousSibling.childNodes.length)}},n.prototype._getSelectedParent=function(n){for(var r=[],i=n,t=0;t<i.length;t++){if(this._isTextNode(i[t])){while(i[t]&&i[t].parentNode&&i[t].parentNode.nodeName.toLowerCase()!="body"&&$.inArray(i[t].parentNode.nodeName.toLowerCase(),this.filterNode)<0)i[t]=i[t].parentNode;i[t].parentNode.nodeName.toLowerCase()=="body"&&r.push(this._updateParent(i[t]))}i[t]&&i[t].parentNode&&i[t].parentNode.nodeName.toLowerCase()!="body"&&$.inArray(i[t].parentNode,r)<0&&(i[t].parentNode.nodeName.toLowerCase()!="body"&&i[t].nodeName.toLowerCase()!="img"&&i[t].nodeName.toLowerCase()!="video"?r.push(i[t].parentNode):r.push(i[t]))}return r},n.prototype._updateParent=function(n){for(var i=[n],t=n,u,f,r=document.createElement("div");t=t.previousSibling;)if($.inArray(t.nodeName.toLowerCase(),this.filterNode)!=-1){u=t;break}else i.push(t);for(i=i.reverse(),t=n;t=t.nextSibling;)if($.inArray(t.nodeName.toLowerCase(),this.filterNode)!=-1){f=t;break}else i.push(t);return $(i).appendTo(r),u?$(r).insertAfter(u):f?$(r).insertBefore(f):$(r).appendTo(this.currentDocument.body),r},n.prototype._applyChanges=function(n,t,i){var h,o;this.range=this._getRangy(i,t);var y=this._getexactSelectedNode(this.range,t),l=y.slice(),u=document.createElement(n.substring(n.indexOf("<")+1,n.indexOf(">")));if(l.length==0&&this.range.startContainer.nodeName.toLowerCase()=="body"&&this.range.endContainer.nodeName.toLowerCase()=="body"&&this.range.commonAncestorContainer.nodeName.toLowerCase()=="body"&&this._parentDoc.body.innerHTML=="")this.focus(),u.innerHTML=" ",this._parentDoc.body.innerHTML=u.outerHTML;else{h=this._getSelectedParent(l);o=[];o.push(l[0]);for(var a=this._getSelectedParent(o)[0],f=[],e=0,c=document.createElement("div"),d=document.createElement("div"),g=this._getSelectedParent(o)[0],p,r,w,b,v,k,s=0;s<h.length;s++){if(o=[],o.push(h[s]),a=this._getSelectedParent(o)[0],$(h[s]).attr("style")&&$(u).attr("style",$(h[s]).attr("style")),$.inArray(a,f)>=0||(f.push(a),u.innerHTML.length!=0&&(f[e].nodeName.toLowerCase()!="td"&&f[e].nodeName.toLowerCase()!="tr"&&f[e].nodeName.toLowerCase()!="tbody"&&f[e].nodeName.toLowerCase()!="li"&&f[e].nodeName.toLowerCase()!="body"?$(f[e]).replaceWith(u.outerHTML):f[e].nodeName.toLowerCase()!="tr"&&f[e].nodeName.toLowerCase()!="tbody"&&($(f[e]).prepend("<div><\/div>"),c.innerHTML=u.outerHTML,f[e].replaceChild(c.firstChild,f[e].firstChild)),e++),u.innerHTML="",c.innerHTML=""),r=h[s],b=!1,ej.isNullOrUndefined(r.parentNode)||(w=r.nodeName.toLowerCase()=="li"),!ej.isNullOrUndefined(r)){for(v=r;v.childNodes.length!=0;)if($.inArray(r.firstChild.nodeName.toLowerCase(),this.filterNode)<0)while(r.firstChild&&$.inArray(r.firstChild.nodeName.toLowerCase(),this.filterNode)<0)$(u).append(v.childNodes[0]);else break;k=r.previousSibling}p=r.parentNode;u.innerHTML.length!=0&&(r.nodeName.toLowerCase()!="td"&&r.nodeName.toLowerCase()!="tr"&&r.nodeName.toLowerCase()!="tbody"&&r.nodeName.toLowerCase()!="li"&&r.nodeName.toLowerCase()!="body"?$(r).replaceWith(u.outerHTML):r.nodeName.toLowerCase()!="tr"&&r.nodeName.toLowerCase()!="tbody"&&($(r).prepend("<div><\/div>"),c.innerHTML=u.outerHTML,r.replaceChild(c.firstChild,r.firstChild)),e++);u.innerHTML="";c.innerHTML="";$(u).removeAttr("style")}}},n.prototype._validateIndent=function(n){var t=!1;do $(n).attr("style")&&parseInt($(n).css("margin-left"))>0&&(t=!0);while((n=n.parentNode)&&!$(n).is("body"));return t},n.prototype._validateFontSize=function(n){var t=parseInt($(n.nodeType==3?n.parentNode:n).css("font-size"));return Math.round(t*(3/4))+"pt"},n.prototype._onApplyIndent=function(n,t){var i;this.range=this._getRangy(t,n);var e=this._getexactSelectedNode(this.range,n),u,f=e.slice(),r=this._getSelectedParent(f);if(f.length!=0||this.range.startContainer.nodeName.toLowerCase()!="body"||this.range.endContainer.nodeName.toLowerCase()!="body"||this.range.commonAncestorContainer.nodeName.toLowerCase()!="body"||this._parentDoc.body.innerHTML!="")for(i=0;i<=r.length-1;i++)r[i].nodeName.toLowerCase()=="td"&&($(r[i]).append($(u=document.createElement("p")).append(r[i].childNodes)),r[i]=u),r[i].nodeName.toLowerCase()!="li"?$(r[i]).css("margin-left",40+parseInt($(r[i]).css("margin-left"))+"px"):$(r[i]).prev().length==0?$(r[i].parentNode).css("margin-left",parseInt($(r[i].parentNode).css("margin-left"))+40+"px"):$(r[i]).css("margin-left",parseInt($(r[i]).css("margin-left"))+40+"px")},n.prototype._onApplyDecreaseIndent=function(n,t){var i;this.range=this._getRangy(t,n);var u=this._getexactSelectedNode(this.range,n),f=u.slice(),r=this._getSelectedParent(f);for(i=0;i<=r.length-1;i++)parseInt($(r[i]).css("margin-left"))>=40&&r[i].nodeName.toLowerCase()!="li"?$(r[i]).css("margin-left",parseInt($(r[i]).css("margin-left"))-40):$(r[i]).prev().length==0&&parseInt($(r[i].parentNode).css("margin-left"))>=40?$(r[i].parentNode).css("margin-left",parseInt($(r[i].parentNode).css("margin-left"))-40):parseInt($(r[i]).css("margin-left"))>=40&&$(r[i]).css("margin-left",parseInt($(r[i]).css("margin-left"))-40)},n.prototype._getNodeName=function(n){return this._isTextNode(n)?"#text":n.nodeName.toLowerCase()},n.prototype._onApplyjustify=function(n,t,i){var h,u,r,f,s,e,o;for(this.range=this._getRangy(i,t),h=this._getexactSelectedNode(this.range,t),u=this._getSelectedParent(h),r=0;r<u.length;r++)if(f=document.createElement("div"),u[r].nodeName.toLowerCase()=="li"){for(s=$(u[r]).children(),e=0,o=0;o<s.length;o++)$.inArray(this._getNodeName(s[o]),this.filterNode)>0&&e++;if(e>0)while(u[r].childNodes.length>0)if(this._isTextNode(u[r].childNodes[0])||$.inArray(this._getNodeName(u[r].childNodes[0]),this.filterNode)<0)f.appendChild(u[r].childNodes[0]);else break;else $(u[r]).css("text-align",n);f.childNodes.length>0&&($(f).css("text-align",n),u[r].insertBefore(f,u[r].childNodes[0]),e=0)}else $(u[r]).css("text-align",n)},n.prototype._getParentNodeCollection=function(n){var t=n,i=t.parentNode.nodeName.toLowerCase(),r=[];for(r.push(t);i!="body"&&(i=="li"||i=="ol"||i=="ul");)t=t.parentNode,i=t.parentNode.nodeName.toLowerCase(),r.push(t);return r},n.prototype._generateListParentTag=function(n,t,i){var r=document.createElement(n);return $(r).css("list-style-type",i),t.nodeName.toLowerCase()!="li"?$(r).insertBefore(t):$(r).insertBefore(t.parentNode),r},n.prototype._applyOrderedList=function(n,t,i,r){var e,w,at,l,d,g,nt,ot,a,rt;this.range=this._getRangy(i,t);var ut=this._getexactSelectedNode(this.range,t),st=document.createElement(n),tt=document.createElement(n),f=this._getSelectedParent(ut),ft=this._getParentNodeCollection(f[0]),vt=document.createElement("p"),s,y,c,h,o,v,u,p=ft[ft.length-1];for(r!="none"&&(h=this._generateListParentTag(n,f[0],r)),e=0;e<=f.length-1;e++)if(c=document.createElement("li"),f[e].parentNode.nodeName.toLowerCase()=="li"&&(f[e]=f[e].parentNode),r=="none"){if($(f[e]).closest("ul,ol").length<1)continue;if($(f[e]).find("ol").length!=0||$(f[e]).find("ul").length!=0){s=$(f[e]).parents(n).first();var ht=s.parents("li:last"),ct=s.parents("li:last").prevAll(),lt=s.parents("li:last").nextAll();u=$(f[e]).parents("li:last")[0]}else{s=$(f[e]);var ht=s,ct=s.prevAll(),lt=s.nextAll();u=$(f[e])[0]}y=$(f[e]).parents(n).last();w=0;ct.length!=0&&($(tt).append(ht),$(tt).append(lt),$(tt).insertAfter(y));at=document.createElement("p");l=o=document.createElement("li");st.appendChild(l);for(var b=y,it=[],et=!1,k;u;){if($.inArray(u,f)>=0||$.inArray(u.firstChild,f)>=0||$.inArray(u.firstChild,ut)>=0){for(w==0&&l.firstChild&&l.firstChild.innerHTML!=""&&(y.append(l),l=o=document.createElement("li")),k=document.createElement("p");u.firstChild&&$.inArray(u.firstChild.nodeName.toLowerCase(),this.filterNode)<0;)k.appendChild(u.firstChild),et=!0;if(et&&(w++,$(k).insertAfter(b),b=$(k),$(u).children().length==0&&it.push(u)),w==f.length){for(d=document.createElement(n),$(u).children().length!=0?$(d).append($(u).parents("li:last").nextAll()):$(d).append($(u).nextAll()),u.nodeName.toLowerCase()=="ol"||u.nodeName.toLowerCase()=="ul"?$(u).insertAfter(b):u.nodeName.toLowerCase()=="li"&&(g=document.createElement(n),$(g).append(u),$(g).insertAfter(b),u=g),$(d).insertAfter(u),nt=0;nt<it.length;nt++)for(v=it[nt];v.nodeName.toLowerCase()!="body";)ot=v.parentNode,$(v).remove(),v=ot;e=f.length;break}}if(this._isTextNode(u.firstChild)||u.firstChild&&$.inArray(u.firstChild.nodeName.toLowerCase(),this.filterNode)<0)o.appendChild(u.firstChild),ej.isNullOrUndefined(u.firstChild)&&(u=u.nextSibling);else if(this._isTextNode(u)){if(a=0,rt=u,u=u.nextSibling,ej.isNullOrUndefined(u)){for(u=rt;$(u.parentNode).next().length==0;)u=u.parentNode,a++;a>0&&(u=$(u.parentNode).next()[0])}o.appendChild(rt);o=a!=0||this._isTextNode(u)?this._createElement(u.nodeName.toLowerCase(),this._getParentnodeName(a,o),"after"):this._createElement(u.nodeName.toLowerCase(),o.parentNode,null);a=0}else u.firstChild?(o=this._createElement(u.firstChild.nodeName.toLowerCase(),o,null),u=u.firstChild):u=u.nextSibling}}else f[e].nodeName.toLowerCase()!="li"?$(f[e]).is("h1,h2,h3,h4,h5,h6,p,blockquote")?($(c).append(f[e]),h.appendChild(c)):($(f[e]).attr("style")&&$(c).attr("style",$(f[e]).attr("style")),$(c).append(f[e].childNodes),h.appendChild(c),$(f[e]).remove()):(f[e]=$(f[e]).closest("li"))&&(h=document.createElement(n),$(h).css("list-style-type",r),$(h).append(f[e].parentNode.childNodes),$(f[e].parentNode).replaceWith(h));r!="none"&&p.childNodes.length==0&&(p.nodeName.toLowerCase()=="ol"||p.nodeName.toLowerCase()=="ul")&&$(p).remove()},n.prototype._getParentnodeName=function(n,t){for(var i=t,r=0;r<=n;r++)i=i.parentNode;return i},n.prototype._createElement=function(n,t,i){var r=document.createElement(n);return i!="after"?t.appendChild(r):$(r).insertAfter(t),r},n.prototype._backUpRange=function(n,t){var u=n.createElement("span"),r,i;u.id="startRange";r=n.createElement("span");r.id="endRange";i=this._getRangy(t,n).cloneRange();i.collapse(!1);i.insertNode(r);i=this._getRangy(t,n).cloneRange();i.collapse(!0);i.insertNode(u)},n.prototype._resetRange=function(n,t){var u=$(n.body).find("span#startRange"),i=$(n.body).find("span#endRange"),f=ej.isNullOrUndefined(i[0].previousSibling)?0:this._isTextNode(i[0].previousSibling)?i[0].previousSibling.length:i[0].previousSibling.childNodes.length>0?i[0].previousSibling.childNodes.length:0,r=this._getRangy(t,n);u[0].nextSibling!=i[0]?r.setStart(u[0].nextSibling,0):r.setStart(u[0].nextSibling.nextSibling,0);i[0].previousSibling!=u[0]?ej.isNullOrUndefined(i[0].previousSibling)?r.setEnd(i[0].parentNode,f):r.setEnd(i[0].previousSibling,f):r.setEnd(i[0].nextSibling,0);u.remove();i.remove();this._selectRange(r,n)},n.prototype._selectRange=function(n,t){var i=t.getSelection();i.removeAllRanges();i.addRange(n)},n.prototype._validateFormatData=function(n,t){var r=[],i=n.parentNode,u=n,s=[],e,o;if(i)do s.push(u),((e=this._tagCheck(i,t))||(o=this._styleCheck(i,t)))&&r.push(new f(i,n,e,o));while(!$(i).is("body")&&(u=i)&&(i=i.parentNode));return r},n.prototype._tagCheck=function(n,t){return this.formatInfo.getFormatData(t).Value.tag?$(n).is(this.formatInfo.getFormatData(t).Value.tag):!1},n.prototype._styleCheck=function(n,t){var r,i;return!$(n).is(this.formatInfo.filterNode)&&this.formatInfo.getFormatData(t).Value.css&&n.getAttribute("style")?(i=!0,r=this.formatInfo.getFormatData(t).Value.css.split(";"),$(r).each(function(t,r){r&&n.getAttribute("style").replace(/\s/g,"").indexOf(r)==-1&&(i=!1)}),i):!1},n.prototype._validateFormat=function(n,t){var i=[],r={Info:null,status:null};return t=t.toLowerCase(),$.inArray(t,this.formatInfo.actionList)!=-1&&((i=this._validateFormatData(n,t))&&i.length&&(r.Info=i),r.status=i.length>0),r},n.prototype._CurrentformateStatus=function(n,t){for(var r={Info:null,status:null},u=!0,i=0;i<n.length;i++)r=this._validateFormat(n[i],t),r.status||(u=!1);return u},n.prototype._getSelectNode=function(){return this._rangeExtract.ProcessRange()},n.prototype._getFormatedTagOrder=function(n,t){return n[t].currentNode=this._getNodeOrder(n[t].textNode,n[t].node),t?n.slice(t,t+1):n},n.prototype._getNodeOrder=function(n,t){var i=n,r=[];do r.push(i);while((i=i.parentNode)&&i!=t);return r},n.prototype._splitNode=function(n){for(var t=n,i={rightSide:[],leftSide:[]};t=t.nextSibling;)this._validateCommentNode(t)&&i.rightSide.push(t);for(t=n;t=t.previousSibling;)this._validateCommentNode(t)&&i.leftSide.push(t);return i},n.prototype._validateCommentNode=function(n){return n.nodeType!=8},n.prototype._validateTextNode=function(n){return n.nodeType==3},n.prototype._validateType=function(n){return this._validateTextNode(n)&&n.data.length},n.prototype._formatechildNodes=function(n,t,i){for(var r={rightSide:[],leftSide:[]},f,u=n.length-1;u>=0;u--)r=this._splitNode(n[u]),r.rightSide.length&&$($(i.cloneNode(!1)).append(r.rightSide)).insertAfter(n[u]),f=i,r.leftSide.length&&$($(i.cloneNode(!1)).append(r.leftSide.reverse())).insertBefore(n[u])},n.prototype._removeFormat=function(n,t,i){var r=this._getFormatedTagOrder(n.Info,i),u,f=r[0].currentNode.slice(r[0].currentNode.length-1),o=document.createElement("span"),e;return r[0].currentNode=r[0].currentNode.slice(0,r[0].currentNode.length-1),e=this._splitNode(f[0]),e.rightSide.length&&$($(r[0].node.cloneNode(!1)).append(e.rightSide)).insertAfter(r[0].node),r[0].tag?(this._rangeExtract.cursorBasedCollection&&!r[0].textNode.data.trim().length?$(o).append(f).insertAfter($(r[0].node)):$(f).insertAfter(r[0].node),u=r[0].textNode,this._rangeExtract.cursorBasedCollection&&this._setCursorOnNode(u,r[0].textNode)):(u=$(r[0].node.cloneNode(!1)),u.css(this.formatInfo.getFormatData(t).Value.removeCSS),u[0].getAttribute("style")?$(u.append(f)).insertAfter(r[0].node):$(f).insertAfter(r[0].node),u=f),r[0].currentNode.length&&this._formatechildNodes(r[0].currentNode,t,r[0].node),e.leftSide.length||$(r[0].node).remove(),u[0]?u[0]:u},n.prototype._applyFormat=function(n,t,i){var r=this._splitNode(n),u,e=n,f=document.createElement("span");return r.leftSide.length&&r.leftSide[0].nodeType!=3&&(this._tagCheck(r.leftSide[0],t)||this._compareCSS(r.leftSide[0],i?this.formatInfo.getFormatData(t).Value.css+":"+i+";":this.formatInfo.getFormatData(t).Value.css))?$(r.leftSide[0]).append(n):r.rightSide.length&&r.rightSide[0].nodeType!=3&&(this._tagCheck(r.rightSide[0],t)||this._compareCSS(r.rightSide[0],i?this.formatInfo.getFormatData(t).Value.css+":"+i+";":this.formatInfo.getFormatData(t).Value.css))?$(r.rightSide[0]).prepend(n):r.leftSide.length||r.rightSide.length||!$(n.parentNode).is(this.formatInfo.getFormatData(t).Value.styleParent)?(u=document.createElement(this.formatInfo.getFormatData(t).Value.result),this._rangeExtract.cursorBasedCollection?this._validateTextNode(n)?(!$(u).is("span")&&this._rangeExtract._noContent?$(f).append(u):f=u,u.appendChild(e=document.createTextNode(n.data)),this._rangeExtract.cursorBasedCollection&&this._setCursorOnNode(n,e),$(n).replaceWith(f)):(u.innerHTML="",$(f).append(u),n.firstChild&&$(n.firstChild).is("br")?$(f).insertBefore(n.firstChild):$(n).append(f),this._rangeExtract.cursorBasedCollection&&this._setCursorOnNode(n,u.firstChild),e=u):(u.appendChild(e=document.createTextNode(n.data)),$(n).replaceWith(u)),i&&$(u).css(this.formatInfo.getFormatData(t).Value.css,i)):i?$(n.parentNode).css(this.formatInfo.getFormatData(t).Value.css,i):$(n.parentNode).css(this._collectStyleData(this.formatInfo.getFormatData(t).Value.css)),e},n.prototype._setCursorOnNode=function(n,t){this._rangeExtract._cursorData.node==n&&(this._rangeExtract._cursorData.node=t)},n.prototype._compareCSS=function(n,t){return n.getAttribute("style")&&n.getAttribute("style").toLowerCase().trim().replace(/\s/g,"")==t.toLowerCase().trim().replace(/\s/g,"")},n.prototype._collectStyleData=function(n){var i=n.replace(/\s/g,"").split(";"),r={},t;return $(i).each(function(n){var u=i[n];t=u.split(":");t.length>1&&(r[t[0].toLowerCase().trim()]=t[1].toLowerCase().trim())}),r},n.prototype._validateStyleData=function(n,t,i){var r=n.getAttribute("style").split(";"),u=!1;return $(r).each(function(n){var e=r[n],f=e.split(":");if(f[0].toLowerCase().trim()==t.toLowerCase().trim()&&f[1].toLowerCase().trim()==i.toLowerCase().trim())return u=!0,!1}),u},n.prototype._caseConvert=function(n){var i=this._getSelectNode(),u,f,e,t,r;if(i.length&&(i.length!=1||i[0].data.length)){for(r=0;r<i.length;r++)u=i[r],t=document.createTextNode(u.data[this.formatInfo.captionConvert[n]]()),this._rangeExtract._cursorData.node==u&&(this._rangeExtract._cursorData.node=t),u.data&&$(u).replaceWith(t),t&&i.length==1?(f=t)&&(e=t):r==0?f=t:r==i.length-1?e=t:null;f&&e&&this._refreshRange(f,e)}},n.prototype._validateSelectedNode=function(n){return!n.length||n.length==1&&n[0].data&&!n[0].data.length},n.prototype._tagFormatProcess=function(n,t){var u=this._getSelectNode(),c,e,r,i,o,s,f,h;if(!this._validateSelectedNode(u)){for(c=this._CurrentformateStatus(u,n),r={Info:null,status:null},f=0;f<u.length;f++){if(e=u[f],r=this._validateFormat(e,n),i=null,(t||c)&&r.status)for(h=0;h<r.Info.length;h++)i=this._removeFormat(r,n,h);else i=r.status||t?e:this._applyFormat(e,n,null);i&&(u.length==1?(o=i)&&(s=i):f==0?o=i:f==u.length-1?s=i:null)}return o&&s&&this._refreshRange(o,s),this.focus(),{data:r,nodeStatus:c}}},n.prototype._refreshRange=function(n,t){var u=this.currentDocument.createRange(),f=this.currentDocument.getSelection(),i,r;this._rangeExtract&&(i=this._rangeExtract._cursorData.node)&&(r=this._rangeExtract._cursorData.offSet);this._rangeExtract.cursorBasedCollection&&i&&r>-1?(r=this._validateTextNode(i)?r>i.data.length?i.data.length:r:0,i.nodeType!=3||i.data.trim()||(i.data=String.fromCharCode(65279)+i.data,r++),this._updateCursor(i,r)):n&&t&&(n.data&&!n.data.trim()&&n.data.indexOf(String.fromCharCode(65279))==-1&&(n.data=String.fromCharCode(65279)+n.data),t.data&&!t.data.trim()&&t.data.indexOf(String.fromCharCode(65279))==-1&&(t.data=String.fromCharCode(65279)),f.removeAllRanges(),u.setStart(n,0),u.setEnd(t,t.data?t.data.length:0),f.addRange(u));$(this.currentWindow).focus()},n.prototype._updateCursor=function(n,t){var i=this.currentDocument.createRange(),r=this.currentDocument.getSelection();i.setStart(n,t);i.setEnd(n,t);r.removeAllRanges();r.addRange(i)},n.prototype._cssFormatProcess=function(n,t,i){var f=this._getSelectNode(),s,e={Info:null,status:null},r,h,c,u,o;if(!this._validateSelectedNode(f)){for(u=0;u<f.length;u++){if(s=f[u],e=this._validateFormat(s,n),e.status)for(o=0;o<e.Info.length;o++)(i||!this._validateStyleData(e.Info[o].node,this.formatInfo.getFormatData(n).Value.css,t))&&(r=this._removeFormat(e,n,o));i||(r=this._applyFormat(s,n,t));r&&(f.length==1?(h=r)&&(c=r):u==0?h=r:u==f.length-1?c=r:null)}this._refreshRange(h,c);this.focus()}},n.prototype.execCommand=function(n,i){try{switch(n){case t.bold:this._tagFormatProcess("bold",!1);break;case t.italic:this._tagFormatProcess("italic",!1);break;case t.underline:this._tagFormatProcess("underline",!1);break;case t.strikethrough:this._tagFormatProcess("strikethrough",!1);break;case t.superscript:this._tagFormatProcess("subscript",!0);this._tagFormatProcess("superscript",!1);break;case t.subscript:this._tagFormatProcess("superscript",!0);this._tagFormatProcess("subscript",!1);break;case t.fontsize:this._cssFormatProcess("fontsize",i,!1);break;case t.fontname:this._cssFormatProcess("fontname",i,!1);break;case t.forecolor:this._cssFormatProcess("forecolor",i,!1);break;case t.backcolor:this._cssFormatProcess("backcolor",i,!1);break;case t.uppercase:this._caseConvert("uppercase");break;case t.lowercase:this._caseConvert("lowercase");break;case t.indent:this._applyIndent(!0);break;case t.outdent:this._applyIndent(!1);break;case t.justifyleft:this._justifyContent("left");break;case t.justifycenter:this._justifyContent("center");break;case t.justifyright:this._justifyContent("right");break;case t.justifyfull:this._justifyContent("justify");break;case t.formatblock:this._applyFormateBlock(i)}this._junkContentStatus=!0}catch(r){}},n}();n.editorManager=u,function(n){n[n.bold=0]="bold";n[n.italic=1]="italic";n[n.underline=2]="underline";n[n.strikethrough=3]="strikethrough";n[n.superscript=4]="superscript";n[n.subscript=5]="subscript";n[n.fontsize=6]="fontsize";n[n.fontname=7]="fontname";n[n.forecolor=8]="forecolor";n[n.backcolor=9]="backcolor";n[n.uppercase=10]="uppercase";n[n.lowercase=11]="lowercase";n[n.indent=12]="indent";n[n.outdent=13]="outdent";n[n.justifyleft=14]="justifyleft";n[n.justifycenter=15]="justifycenter";n[n.justifyright=16]="justifyright";n[n.justifyfull=17]="justifyfull";n[n.formatblock=18]="formatblock"}(n.execCommand||(n.execCommand={}));var t=n.execCommand,f=function(){function n(n,t,i,r){this.textNode=t;this.node=n;this.css=r;this.tag=i}return n}(),i=function(){function n(n,t,i,r,u){this.tag=n;this.css=t;this.result=i;this.removeCSS=r;this.styleParent=u}return n}(),e=function(){function n(){this.uppercase="toUpperCase";this.lowercase="toLowerCase"}return n}(),r=function(){function n(n,t){this.Key=n;this.Value=t}return n}(),o=function(){function n(){this.filterNode=["div","p","h1","h2","h3","h4","h5","h6","address","applet","blockquote","button","center","dd","dir","dl","dt","fieldset","form","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","script","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this.actionList=["bold","italic","underline","strikethrough","superscript","subscript","fontsize","fontname","forecolor","backcolor"];this.captionConvert=new e;this._updateData()}return n.prototype._updateData=function(){var n=Array();n.push(new r("bold",new i("b,strong","font-weight:bold;","b",{"font-weight":""},"span")));n.push(new r("italic",new i("i, cite, em, var, address, dfn","font-style:italic","i",{"font-style":""},"span")));n.push(new r("underline",new i("u,ins","text-decoration:underline;","u",{"text-decoration":""},"span")));n.push(new r("strikethrough",new i("s, strike, del","text-decoration:line-through;","s",{"text-decoration":""},"span")));n.push(new r("superscript",new i("sup","vertical-align:super;font-size:smaller;","sup",{"vertical-align":"","font-size":""},"span")));n.push(new r("subscript",new i("sub","vertical-align:sub;font-size:smaller;","sub",{"vertical-align":"","font-size":""},"span")));n.push(new r("fontsize",new i(null,"font-size","span",{"font-size":""},"span")));n.push(new r("fontname",new i(null,"font-family","span",{"font-family":""},"span")));n.push(new r("forecolor",new i(null,"color","span",{color:""},"span")));n.push(new r("backcolor",new i(null,"background-color","span",{"background-color":""},"span")));this.tempCollection=n},n.prototype.getFormatData=function(n){for(var i,t=0;t<this.tempCollection.length;t++)if(i=this.tempCollection[t],i.Key==n)return this.tempCollection[t]},n}(),s=function(){function n(n){this.exp=/\s/g;this._findStatus={leftSide:null,rightSide:null};this._iterationStatus=!1;this._cursorData={node:null,offSet:null};this._nodeCollection=[];this._traverseData={leftSide:{childNode:"lastChild",sibling:"previousSibling"},rightSide:{childNode:"firstChild",sibling:"nextSibling"}};this._blockNodes=["div","p","h1","h2","h3","h4","h5","h6","address","applet","blockquote","button","center","dd","dir","dl","dt","fieldset","form","frameset","hr","iframe","isindex","li","map","menu","noframes","noscript","object","ol","pre","script","table","tbody","td","tfoot","th","thead","tr","ul","header","article","nav","footer","section","aside","main","figure","figcaption"];this._noContent=!1;this.nodeCollection={leftSide:[],rightSide:[]};this.currentDocument=n}return n.prototype.ProcessRange=function(){var n=this._getRange();return $(this.currentDocument.body).attr("contenteditable")=="true"&&n&&(this._nodeCollection=[],this._noContent=!1,this._iterationStatus=!1,this._cursorData={node:null,offSet:null},n.startContainer==n.endContainer&&n.startOffset==n.endOffset?(this._collectCursorBasedTextNode(n.startContainer,n.startOffset),this.cursorBasedCollection=!0):(this._collectSelectionBasedTextNode(n),this.cursorBasedCollection=!1)),this._nodeCollection},n.prototype._insertCursor=function(n,t){var r=n.data.substring(0,t),u=n.data.substr(t),i;r.replace(String.fromCharCode(65279),"")&&$(document.createTextNode(r)).insertBefore(n);u.replace(String.fromCharCode(65279),"")&&$(document.createTextNode(u)).insertAfter(n);$(n).replaceWith(i=document.createTextNode(""));this._cursorData={node:i,offSet:0};this._nodeCollection.push(i);this._noContent=!0},n.prototype._collectCursorBasedTextNode=function(n,t){for(var r,f,i,u,c=new RegExp(this.exp),s,h,e,o;f=c.exec(n.data);)n.data.substring(f.index,f.index+1).indexOf(" ")!=-1&&(f.index<t&&(r=f),!u&&t<=f.index&&(u=f));return r&&u?t-(r.index+1)==0||t-(r.index+1)==n.data.substring(r.index+1,u.index).replace("\n","").length?this._insertCursor(n,t):(s=n.data.substring(0,r.index+1),h=n.data.substring(u.index),$(document.createTextNode(s)).insertBefore(n),$(document.createTextNode(h)).insertAfter(n),$(n).replaceWith(i=document.createTextNode(n.data.substring(r.index+1,u.index))),this._cursorData={node:i,offSet:t-(r.index+1)},this._nodeCollection.push(i)):r?(this._collectNodeData(n,!1),e=this._nodeCollection,this._nodeCollection=[],e.length==0&&(t-(r.index+1)==0||t-(r.index+1)==n.data.substring(r.index+1).replace("\n","").length)?this._insertCursor(n,t):(s=n.data.substring(0,r.index+1),$(document.createTextNode(s)).insertBefore(n),$(n).replaceWith(i=document.createTextNode(n.data.substring(r.index+1))),this._cursorData={node:i,offSet:t-(r.index+1)},this._nodeCollection.push(i),this._nodeCollection.concat(e))):u?(this._collectNodeData(n,!0),o=this._nodeCollection,this._nodeCollection=[],o.length==0&&(t==n.data.substring(0,u.index).replace("\n","").length||t==0)?this._insertCursor(n,t):(h=n.data.substring(u.index),$(document.createTextNode(h)).insertAfter(n),$(n).replaceWith(i=document.createTextNode(n.data.substring(0,u.index))),this._cursorData={node:i,offSet:t},this._nodeCollection=o.reverse(),this._nodeCollection.push(i))):n.nodeType!=3?(i=document.createTextNode(""),n.firstChild?$(i).insertBefore(n.firstChild):$(i).appendTo(n),this._nodeCollection.push(i),this._cursorData={node:i,offSet:t},this._noContent=!0):(this._collectNodeData(i=n,!1),e=this._nodeCollection,this._nodeCollection=[],this._collectNodeData(i,!0),o=this._nodeCollection,this._nodeCollection=[],i.data==String.fromCharCode(65279)||o.length==0&&t==0||e.length==0&&i.data.replace(String.fromCharCode(65279),"").replace("\n","").length==t?this._insertCursor(n,t):(this._nodeCollection=o.reverse(),this._nodeCollection.push(i),this._nodeCollection=this._nodeCollection.concat(e),this._cursorData={node:i,offSet:t})),this._nodeCollection},n.prototype._validateContent=function(n,t){for(var e=new RegExp(this.exp),i,r=[],u,f;i=e.exec(n.data);)r.push(i);r.length?(i=r[t=="leftSide"?r.length-1:0],f=t=="leftSide"?i.index+1:i.index,$(u=document.createTextNode(n.data.substring(f))).insertAfter(n),n.data=n.data.substring(0,f),t=="rightSide"&&$.trim(n.data)?this._nodeCollection.push(n):t=="leftSide"&&$.trim(u.data)&&this._nodeCollection.push(u),this._findStatus[t]=!0):this._nodeCollection.push(n)},n.prototype._iterateNodes=function(n,t){if(!this._findStatus[t])if(n.nodeType==3&&n.data)this._validateContent(n,t);else if((n=n[this._traverseData[t].childNode])&&!this._findStatus[t])do n.nodeType==3&&n.data?this._validateContent(n,t):this._iterateNodes(n,t);while((n=n[this._traverseData[t].sibling])&&!this._findStatus[t])},n.prototype._collectNodeData=function(n,t){this._findStatus={leftSide:undefined,rightSide:undefined};var r=this,i=t?"leftSide":"rightSide";do this.nodeCollection=this._splitSiblingNode(n),$(this.nodeCollection[i]).each(function(n,t){r._iterateNodes(t,i)});while(!this._validateBlockType(n.parentNode)&&(n=n.parentNode)&&!this._findStatus[i])},n.prototype._validateBlockType=function(n){return $.inArray(n.tagName.toLowerCase(),this._blockNodes.concat("body"))!=-1},n.prototype._validateTextNode=function(n){return n.nodeType==3},n.prototype._splitSiblingNode=function(n){for(var t=n,i={leftSide:[],rightSide:[]};t=t.nextSibling;)t.tagName&&this._validateBlockType(t)||i.rightSide.push(t);for(t=n;t=t.previousSibling;)t.tagName&&this._validateBlockType(t)||i.leftSide.push(t);return i},n.prototype._getRange=function(){var n=this.currentDocument.getSelection(),t=null;return n.rangeCount&&(t=n.getRangeAt(0)),t},n.prototype._collectSelectionBasedTextNode=function(n){var t,i,f,o,s,e,r=n.startContainer,u=n.endContainer;this._nodeCollection=[];n.startContainer==n.endContainer?this._validateTextNode(n.endContainer)?(n.startOffset&&(t=n.startContainer.data.substr(0,n.startOffset)),n.startContainer.data.length!=n.endOffset&&(i=n.startContainer.data.substr(n.endOffset)),f=n.startContainer.data.substr(n.startOffset,n.endOffset-n.startOffset),t&&$(o=document.createTextNode(t)).insertBefore(n.startContainer),i&&$(s=document.createTextNode(i)).insertAfter(n.startContainer),f&&$(n.startContainer).replaceWith(e=document.createTextNode(f))&&this._nodeCollection.push(e)):this._updateNodeCollection(n.startContainer.nodeName.toLowerCase()=="html"?$(n.startContainer).find("body")[0]:n.startContainer,r,null):(n.startContainer.nodeType==3&&n.startOffset&&(t=n.startContainer.data.substr(0,n.startOffset),i=n.startContainer.data.substr(n.startOffset),$(document.createTextNode(t)).insertBefore(n.startContainer),$(r).replaceWith(r=document.createTextNode(i))),n.endContainer.nodeType==3&&n.endContainer.data.length!=n.endOffset?(i=n.endContainer.data.substr(n.endOffset),t=n.endContainer.data.substr(0,n.endOffset),$(document.createTextNode(i)).insertAfter(n.endContainer),$(u).replaceWith(u=document.createTextNode(t))):n.endOffset&&n.endContainer.lastChild&&(u=n.endContainer.lastChild),this._updateNodeCollection(n.commonAncestorContainer,r,u))},n.prototype._updateNodeCollection=function(n,t,i){if(this._updateIterationStatus(n,t,i),n=n.firstChild)do this._updateNodeCollection(n,t,i);while(n=n.nextSibling)},n.prototype._updateIterationStatus=function(n,t,i){n!=t||this._iterationStatus||(this._iterationStatus=!0);n.nodeType==3&&this._iterationStatus&&this._nodeCollection.push(n);n==i&&this._iterationStatus&&(this._iterationStatus=!1)},n}()}(documentManager||(documentManager={}));$.extend(ej,documentManager);window.documentManager=null,function(n,t,i){t.widget("ejColorPicker","ej.ColorPicker",{_rootCSS:"e-colorpicker",element:null,model:null,validTags:["input","div"],_addToPersist:["value","opacityValue"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{enableOpacity:!0,opacityValue:100,columns:10,palette:"basicpalette",htmlAttributes:{},buttonMode:"split",custom:[],presetType:"basic",modelType:"picker",locale:"en-US",showPreview:!0,showTooltip:!1,showClearButton:!1,showSwitcher:!0,value:null,displayInline:!1,buttonText:{apply:"Apply",cancel:"Cancel",swatches:"Swatches"},tooltipText:{switcher:"Switcher",addButton:"Add Color",basic:"Basic",monoChrome:"Mono Chrome",flatColors:"Flat Colors",seaWolf:"Sea Wolf",webColors:"Web Colors",sandy:"Sandy",pinkShades:"Pink Shades",misty:"Misty",citrus:"Citrus",vintage:"Vintage",moonLight:"Moon Light",candyCrush:"Candy Crush",currentColor:"Current Color",selectedColor:"Selected Color"},showApplyCancel:!0,showRecentColors:!1,toolIcon:null,cssClass:"",enabled:!0,change:null,select:null,open:null,close:null,create:null,destroy:null},dataTypes:{modelType:"enum",palette:"enum",presetType:"enum",cssClass:"string",displayInline:"boolean",locale:"string",showSwitcher:"boolean",showRecentColors:"boolean",enabled:"boolean",showPreview:"boolean",enableOpacity:"boolean",buttonText:"data",custom:"array",htmlAttributs:"data"},observables:["value","opacityValue"],value:t.util.valueFunction("value"),opacityValue:t.util.valueFunction("opacityValue"),_setModel:function(n){for(var i in n)switch(i){case"enableOpacity":this.model.enableOpacity=n[i];this._previewSlider(this.model.enableOpacity);this._valueOperation();break;case"opacityValue":if(this.model.enableOpacity){this._tempOpacity=parseFloat(t.util.getVal(n[i]));this._opacity.option("value",this._tempOpacity);this._switch||this._changeOpacity();this._updateValue();this.opacityValue(this._tempOpacity);typeof n[i]=="function"?n[i](this.opacityValue()):n[i]=this.opacityValue();break}else return!1;case"custom":this.model.custom=n[i];this._reInitialize();break;case"palette":this.model.palette=n[i];this._reInitialize();break;case"columns":this.model.columns=parseFloat(n[i]);this._reInitialize();n[i]=this.model.columns;break;case"presetType":if(this.model.presetType=n[i],t.isNullOrUndefined(r[this.model.presetType]))return!1;this._reInitialize();break;case"buttonMode":this._unBindIconClick();this._buttonElement=t.ColorPicker.ButtonMode.Split==n[i]?this.dropdownbutton:this.wrapper;t.ColorPicker.ButtonMode.Split==n[i]?this.wrapper.addClass("e-split"):this.wrapper.removeClass("e-split");this._bindIconClick();break;case"showTooltip":this._colorSlider.option("showTooltip",n[i]);this._opacity.option("showTooltip",n[i]);break;case"value":this._setValue(t.util.getVal(n[i]),!0);typeof n[i]=="function"?n[i](this.value()):n[i]=this.value();break;case"modelType":this.model.modelType=n[i];this._reInitialize();break;case"showSwitcher":this.model.showSwitcher=n[i];this._showSwitcher();break;case"tooltipText":this._toolTipText(n[i]);break;case"locale":this.model.locale=n[i];this._localize(n[i]);break;case"showPreview":this.model.showPreview=n[i];this._previewPane(this.model.showPreview);break;case"buttonText":this._buttonText(n[i]);break;case"displayInline":this._setDisplayInline(n[i]);break;case"cssClass":this._setSkin(n[i]);this.model.cssClass=n[i];break;case"enabled":this._enabled(n[i]);break;case"showRecentColors":this.model.showRecentColors=n[i];this._previewColor(this.model.showRecentColors);break;case"htmlAttributes":this._addAttr(n[i]);break;case"showClearButton":this._showClearIcon(n[i]);break;case"showApplyCancel":this.model.showApplyCancel=n[i];this._buttonContainer()}},_setSkin:function(n){this.wrapper?this.wrapper.removeClass(this.model.cssClass).addClass(n):this.element.removeClass(this.model.cssClass).addClass(n)},_showSwitcher:function(){this.model.showSwitcher?(this._changeTag.removeClass("e-hide"),this.model.modelType=="picker"?this._switcher.addClass("e-paletteModel").removeClass("e-pickerModel"):this._switcher.addClass("e-pickerModel").removeClass("e-paletteModel")):this._changeTag.addClass("e-hide")},_pickerType:function(){this._modelType="picker";this.PaletteWrapper.removeAttr("style");this.PaletteWrapper.addClass("e-hide");this._gradient.removeClass("e-hide");this._gradient.fadeIn(200);this._presetTag.parents(".e-split.e-widget").addClass("e-hide");this._switcher.removeAttr("class");this._switcher.addClass("e-color-image e-paletteModel");this._switch=!0;this._rgbValue();this._hueGradient();this._updateUI();this._alphaGradient(this.RGBToHEX(this.rgb));this._hsva.ejButton("enable");this._switchEvents();this._unSwitchEvents();this._hideUnBindEvents();this.isPopupOpen&&this._showBindEvents();this.model.modelType=="default"?this._changeTag.removeClass("e-hide"):this._changeTag.addClass("e-hide");this.popupList.prepend(this._gradient);this._showSwitcher()},_paletteType:function(){this._gradient.removeAttr("style");this._presetTag.parents(".e-split.e-widget").removeClass("e-hide");this.PaletteWrapper.removeClass("e-hide");this.PaletteWrapper.fadeIn(200);this._switch=!1;this._disableHSVButton();this._cellSelect();this._switchEvents();this._unSwitchEvents();this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType);this.popupList.prepend(this.PaletteWrapper);this._showSwitcher()},_reInitialize:function(){this._destroyPalette(!1)},_destroyPalette:function(n){this.PaletteWrapper.remove();(n||this._columns!=this.model.columns&&this.model.palette!=="custompalette")&&(this.PaletteWrapper=this._presetType(this._presetsId));this._temp!==this.model.presetType&&(this.PaletteWrapper=this._layoutType(this.model.palette));this.model.modelType=="palette"&&(this._modelType="palette",this.PaletteWrapper=this._layoutType(this.model.palette),this._hideUnBindEvents(),this.isPopupOpen&&this._showBindEvents(),this._gradient.addClass("e-hide"),this._paletteType(),n||this.model.palette=="custompalette"?"":this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType));this.model.modelType=="picker"&&(this._pickerType(),this.model.displayInline&&!this.element.is("input")&&this._footer.addClass("e-hide"));this._temp=this.model.presetType;this._columns=this.model.columns;this._modelType=="picker"?this._presetTag.parents(".e-split.e-widget").addClass("e-hide"):this._presetTag.parents(".e-split.e-widget").removeClass("e-hide");this.refresh()},_previewColor:function(n){n?(this._swatchesArea.fadeIn(200),this._bindRecentEvent()):(this._swatchesArea.fadeOut(200),this._unBindRecentEvent())},_buttonText:function(i){n.extend(this.model.buttonText,i);t.isNullOrUndefined(this._buttonTag)||this._buttonTag.html(this.model.buttonText.apply);t.isNullOrUndefined(this._cancelTag)||this._cancelTag.html(this.model.buttonText.cancel);this._spnTag.html(this.model.buttonText.swatches)},_toolTipText:function(t){n.extend(this.model.tooltipText,t);this._addTitleText()},_previewPane:function(n){n?this._previewTag.removeClass("e-hide"):this._previewTag.addClass("e-hide")},_previewSlider:function(n){n?this._opacity.enable():this._opacity.disable()},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_localize:function(){this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._localizedLabels)||(t.isNullOrUndefined(this._localizedLabels.buttonText)||this._buttonText(this._localizedLabels.buttonText),t.isNullOrUndefined(this._localizedLabels.tooltipText)||this._toolTipText(this._localizedLabels.tooltipText))},_destroy:function(){this.isPopupOpen&&this.hide();this.popupContainer.remove();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove(),this._presetContainer.parent(".e-menu-wrap").remove());this.element.removeClass("e-colorpicker e-input e-widget").removeAttr("style name").val(this.element.attr("value"))},_init:function(){this._browser=t.browserInfo();this._isFocused=!1;this.isPopupOpen=!1;this._dataBind=!1;this._modelType="picker";this._id&&n("#"+this._id+"_popup").remove();"#"+this._id+"_Presets"&&n("#"+this._id+"_Presets").parent(".e-menu-wrap").remove();this.model.palette==="basicpalette"?this._presetsId="e-presets30":"";this._tempValue=t.isNullOrUndefined(this.value())&&this.element[0].value!==""?this.element[0].value:this.value();this._previousValue=this._previousColor=this._tempValue;this._renderControl();this._tempOpacity=this.opacityValue();this.model.palette==="custompalette"&&this._presetTag.parents(".e-split.e-widget").addClass("e-hide");this.popupContainer.find("button.e-presets").ejSplitButton({targetID:this._presetContainer.attr("id")});this._tempValue&&(this._setValue(this._tempValue),this._switch&&this._rgbValue());this._hsvValue();this._hueGradient();this._addTitleText();this._showClearIcon(this.model.showClearButton);this._columns=this.model.columns;this._temp=this.model.presetType;this._tempValue||(this._colorSlider.option("value",parseInt(this._hsv.h)),this._opacity.option("value",this._tempOpacity),this._alphaGradient("#fff"),this._previousValue="");this.model.enabled||this._enabled(this.model.enabled)},_renderControl:function(){this._createWrapper();this._renderPopupPanelWrapper();this._selectedButton=this._groupTag.find(".e-click");this._buttonContainer();this._renderPopupElement();this._buttonElement=t.ColorPicker.ButtonMode.Split==this.model.buttonMode?this.dropdownbutton:this.wrapper;this.model.buttonMode==t.ColorPicker.ButtonMode.Split&&this.element.is("input")&&this.wrapper.addClass("e-split");this._addAttr(this.model.htmlAttributes);this._setDisplayInline(this.model.displayInline);this._previewPane(this.model.showPreview);this._previewColor(this.model.showRecentColors);this._localize();this._switch&&this._previewSlider(this.model.enableOpacity);this._wireEvents();this._switchEvents()},_createWrapper:function(){this.element.is("input")&&(this.element.addClass("e-input e-widget"),this.spanElement=t.buildTag("span.e-selected-color"),this.wrapper=t.buildTag("span.e-colorwidget e-picker e-widget "+this.model.cssClass).attr({tabindex:"0","aria-expanded":!1,"aria-haspopup":!0,"aria-owns":"popup"}),this._id&&this.wrapper.attr("id",this._id+"Wrapper"),this.container=t.buildTag("span.e-in-wrap e-box e-splitarrowright"),this.drpbtnspan=t.buildTag("span.e-icon e-arrow-sans-down","",{},{"aria-label":"select"}),this.dropdownbutton=t.buildTag("span.e-select","",{},{role:"button"}).append(this.drpbtnspan),this.iconWrapper=t.buildTag("span.e-tool-icon "+this.model.toolIcon),this.colorContainer=t.buildTag("span.e-color-container"),this.colorContainer.append(this.spanElement),this.container.insertAfter(this.element),t.isNullOrUndefined(this.model.toolIcon)?this.container.append(this.colorContainer):(this.colorContainer.prepend(this.iconWrapper),this.container.addClass("e-tool"),this.container.append(this.colorContainer)),this.container.append(this.element,this.dropdownbutton),this.wrapper.insertBefore(this.container),this.wrapper.append(this.container),this.element.css("display","none").val(this.value()));this._checkNameAttr()},_addTitleText:function(){this._switcher.attr("title",this.model.tooltipText.switcher);this._spanTag.attr("title",this.model.tooltipText.addButton);this._presetLi.find("#e-presets00").attr("title",this.model.tooltipText.webColors);this._presetLi.find("#e-presets01").attr("title",this.model.tooltipText.vintage);this._presetLi.find("#e-presets02").attr("title",this.model.tooltipText.seaWolf);this._presetLi.find("#e-presets10").attr("title",this.model.tooltipText.sandy);this._presetLi.find("#e-presets11").attr("title",this.model.tooltipText.pinkShades);this._presetLi.find("#e-presets12").attr("title",this.model.tooltipText.moonLight);this._presetLi.find("#e-presets20").attr("title",this.model.tooltipText.monoChrome);this._presetLi.find("#e-presets21").attr("title",this.model.tooltipText.misty);this._presetLi.find("#e-presets22").attr("title",this.model.tooltipText.flatColors);this._presetLi.find("#e-presets30").attr("title",this.model.tooltipText.basic);this._presetLi.find("#e-presets31").attr("title",this.model.tooltipText.candyCrush);this._presetLi.find("#e-presets32").attr("title",this.model.tooltipText.citrus);this._currentTag.attr("title",this.model.tooltipText.currentColor);this._previousTag.attr("title",this.model.tooltipText.selectedColor)},_renderPopupPanelWrapper:function(){var u,r,f,i;for(this.popupContainer=t.buildTag("div.e-colorpicker e-box e-popup e-widget "+this.model.cssClass,"",{},{role:"grid","aria-readonly":"true",tabindex:"0",style:"visibility:hidden"}),this._id&&this.popupContainer.attr("id",this._id+"_popup"),n("body").append(this.popupContainer),this.popupList=t.buildTag("div.e-popupWrapper"),this._gradient=t.buildTag("div.e-container"),this._colorArea=t.buildTag("div.e-hsv-color"),this._gradientArea=t.buildTag("div.e-hsv-gradient"),this._handleArea=t.buildTag("div.e-draghandle e-color-image"),this._browser=="msie"&&this._handleArea.addClass("e-pinch"),this._colorArea.append(this._gradientArea,this._handleArea),this._picker=t.buildTag("div.e-gradient"),this._hueSlider=t.buildTag("div.e-widget e-hue e-state-default"),this._alphaSlider=t.buildTag("div.e-widget e-opacity e-state-default"),this._picker.append(this._hueSlider,this._alphaSlider),this._gradient.append(this._colorArea,this._picker),this.popupList.append(this._gradient),this._footerBlock=t.buildTag("div.e-footerContainer"),this._templateWrapper=t.buildTag("div.e-buttons"),this._groupTag=t.buildTag("div.e-grpbtn"),this._formEle=t.buildTag("div.e-form"),this._rgb=t.buildTag("button.e-rgbButton e-click","",{},{type:"button"}),this._hexCode=t.buildTag("button.e-hexButton","",{},{type:"button"}),this._hsva=t.buildTag("button.e-hsvButton","",{},{type:"button"}),this._groupTag.append(this._rgb,this._hexCode,this._hsva),this._codeEditor=t.buildTag("div.e-codeeditor"),this._inputTag=t.buildTag("input.e-color-code","",{},{type:"text",tabindex:"0",maxLength:"22"}),this._codeEditor.append(this._inputTag),this._formEle.append(this._groupTag,this._codeEditor),this._previewTag=t.buildTag("div.e-preview").attr({tabindex:"0"}),this._currentTag=t.buildTag("div.e-current"),this._previousTag=t.buildTag("div.e-previous"),this._previewTag.append(this._currentTag,this._previousTag),this._templateWrapper.append(this._formEle,this._previewTag),this._swatchesArea=t.buildTag("div.e-color-labels"),u=11,this._divTag=t.buildTag("div.e-recent-color"),this._addTag=t.buildTag("div.e-colorblock e-block"),this._spanTag=t.buildTag("div.e-color e-color-image e-add"),this._addTag.append(this._spanTag),this._divTag.append(this._addTag),r=0;r<u;r++)this._liTag=t.buildTag("div.e-colorblock e-block"),f=t.buildTag("div.e-color e-color-image e-empty"),this._liTag.append(f),this._divTag.prepend(this._liTag);this._swatchesArea.append(this._divTag);this._footer=t.buildTag("div.e-footer");this._swatches=t.buildTag("div.e-element");this._changeTag=t.buildTag("div.e-switcher").attr("tabindex","0");this._switcher=t.buildTag("div.e-color-image");this._presetTag=t.buildTag("button.e-presets e-colorSplit");this._presets=t.buildTag("div");this._changeTag.append(this._switcher);this._presetTag.append(this._presets);this._swatches.append(this._changeTag,this._presetTag);this._footer.append(this._swatches);this._footerBlock.append(this._templateWrapper,this._swatchesArea,this._footer);this.PaletteWrapper=this._layoutType(this.model.palette);this.popupList.append(this.PaletteWrapper,this._footerBlock);i=n("#"+this._id+"_Presets").get(0);i&&(n(i).parent().hasClass("e-menu-wrap")?n(i).parent().remove():n(i).remove());this._presetContainer=n("<ul id='"+this._id+"_Presets' class='e-presetWrapper' style: top:87px ><\/ul>");this._presetLi=t.buildTag("li.e-item");this._presetLi.append(this._renderPresets());this._presetContainer.append(this._presetLi);this.popupList.append(this._presetContainer);this.popupContainer.append(this.popupList);(this._browser.name="msie"&&(this._browser.version=="9.0"||this._browser.version=="8.0"))?this._hueSlider.addClass("e-color-image e-filter"):this._hueSlider.addClass("e-common");this._width=this._gradientArea.width();this._height=this._gradientArea.height()},_buttonContainer:function(){this.model.displayInline||(this.model.showApplyCancel?(this._buttonTag=t.buildTag("button.e-applyButton","",{},{type:"button"}),this._cancelTag=t.buildTag("button.e-cancelButton","",{},{type:"button"}),this._footer.append(this._buttonTag,this._cancelTag),this._applyObj=this.popupContainer.find("button.e-applyButton").ejButton({text:this.model.buttonText.apply,type:"button",cssClass:"e-flat"}).data("ejButton"),this._cancelObj=this.popupContainer.find("button.e-cancelButton").ejButton({text:this.model.buttonText.cancel,type:"button",cssClass:"e-flat"}).data("ejButton"),this._on(this._cancelTag,"click",this._hidePopup),this._on(this._buttonTag,"click",this._buttonClick)):this._buttonTag!==i&&this._cancelTag!==i&&(this._buttonTag.remove(),this._cancelTag.remove(),this._off(this._cancelTag,"click",this._hidePopup),this._off(this._buttonTag,"click",this._buttonClick)))},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.wrapper.addClass(n):t=="required"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._enabled(!1):i.wrapper.attr(t,n)})},_showClearIcon:function(n){n?(this._clearIcon=t.buildTag("div",{},{},{"class":"e-icon e-close_01"}).hide(),this._codeEditor.append(this._clearIcon),this._on(this._clearIcon,"mousedown",this._clearColor),this._on(this._clearIcon,"click",this._clearColor)):(this._clearIcon&&this._clearIcon.remove(),this._off(this._clearIcon,"mousedown",this._clearColor),this._off(this._clearIcon,"click",this._clearColor))},_colorPresetsClick:function(t){this._presetsId=t.currentTarget.id;this._presetsId==="e-presets00"?this.model.presetType="webcolors":this._presetsId==="e-presets01"?this.model.presetType="vintage":this._presetsId==="e-presets02"?this.model.presetType="seawolf":this._presetsId==="e-presets10"?this.model.presetType="sandy":this._presetsId==="e-presets11"?this.model.presetType="pinkshades":this._presetsId==="e-presets12"?this.model.presetType="moonlight":this._presetsId==="e-presets20"?this.model.presetType="monochrome":this._presetsId==="e-presets21"?this.model.presetType="misty":this._presetsId==="e-presets22"?this.model.presetType="flatcolors":this._presetsId==="e-presets30"?this.model.presetType="basic":this._presetsId==="e-presets31"?this.model.presetType="candycrush":this._presetsId==="e-presets32"&&(this.model.presetType="citrus");this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType);n("#"+this._id+"_Presets").find("li.e-preset-row").removeClass("e-presetsactive");n("#"+this._presetsId).addClass("e-presetsactive");this.PaletteWrapper.remove();this._modelType=="palette"&&(this.PaletteWrapper=this._layoutType(this.model.palette),this._gradient.addClass("e-hide"),this._paletteType(),this._switcher.addClass("e-pickerModel").removeClass("e-paletteModel"))},_renderPresets:function(){var r=t.buildTag("div.e-presets-table"),f,u,n,i;for(this._spnTag=t.buildTag("span.e-presetHeader"),this._spnTag.html(this.model.buttonText.swatches),r.append(this._spnTag),f=0,n=0;n<4;n++){for(u=t.buildTag("ul.e-tablerow"),i=0;i<3;i++)tableCell=t.buildTag("li.e-color-image e-preset-row#e-presets"+[n]+[i]),tableCell.appendTo(u);u.appendTo(r)}return r},_renderPopupElement:function(){var i=this;this._hsv={h:360,s:0,v:100};this._rgb.ejButton({text:"RGBA",type:"button"});this._hexCode.ejButton({text:"HEX",type:"button"});this._hsva.ejButton({text:"HSVA",type:"button"});this._splitObj=this._presetTag.ejSplitButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly"}).data("ejSplitButton");this._splitObj.option("beforeOpen",function(n){i._bindClickOperation(n)});this._presetTag.parents(".e-split.e-widget").css({height:"27px"});this.model.custom.length==0?this._splitObj.option("prefixIcon","e-icon e-color-image e-"+this.model.presetType):"";n("#"+this._presetsId).addClass("e-presetsactive");this._splitObj._getXYpos=function(){return n("#"+this.model.targetID).ejMenu({animationType:"none"}),btnpos=this.dropbutton.offset(),btnposx=btnpos.left-this.dropbutton.prev().outerWidth()-1,btnposy=btnpos.top-n("#"+this.model.targetID).outerHeight()-1,{x:btnposx,y:btnposy}};this._colorSlider=this._hueSlider.ejSlider({orientation:"Vertical",showTooltip:this.model.showTooltip,minValue:0,maxValue:360,change:function(n){i._changeHue(n)},slide:function(n){i._changeHue(n)}}).data("ejSlider");this._opacity=this._alphaSlider.ejSlider({value:this.opacityValue(),showTooltip:this.model.showTooltip,orientation:"Vertical",incrementStep:5,value:100,change:function(n){i._changeAlpha(n)},slide:function(n){i._changeAlpha(n)}}).data("ejSlider");(this._browser.name="msie"&&this._browser.version=="8.0")&&(this._handleTag=t.buildTag("div.e-handle-wrapper"),this._handleTag.appendTo(this._opacity.element.find("a.e-handle")));this._colorSlider.firstHandle.css({height:"13px",width:"13px"});this._opacity.firstHandle.css({height:"13px",width:"13px"});this.popupContainer.css({visibility:"visible",display:"none"});this.model.modelType=="picker"?(this._modelType="picker",this._gradient.removeClass("e-hide"),this.PaletteWrapper.addClass("e-hide"),this._presetTag.parents(".e-split.e-widget").addClass("e-hide"),this._showSwitcher(),this._switch=!0):this.model.modelType=="palette"&&(this._modelType="palette",this._presetTag.parents(".e-split.e-widget").removeClass("e-hide"),this.PaletteWrapper.removeClass("e-hide"),this._gradient.addClass("e-hide"),this._hsva.ejButton("disable"),this._showSwitcher(),this._switch=!1)},_layoutType:function(n){return typeof n=="string"&&n=="basicpalette"?this._collection=this._paletteGenerate(r[this.model.presetType],this.model.columns):typeof n=="string"&&n=="custompalette"&&this.model.modelType=="palette"&&(this._collection=this._paletteGenerate(this.model.custom,this.model.columns)),n=="custompalette"?this._collection.addClass("e-custom"):"",this._collection},_presetType:function(n){return n==="e-presets00"?this._collection=this._paletteGenerate(r.webcolors,this.model.columns):n==="e-presets01"?this._collection=this._paletteGenerate(r.vintage,this.model.columns):n==="e-presets02"?this._collection=this._paletteGenerate(r.seawolf,this.model.columns):n==="e-presets10"?this._collection=this._paletteGenerate(r.sandy,this.model.columns):n==="e-presets11"?this._collection=this._paletteGenerate(r.pinkshades,this.model.columns):n==="e-presets12"?this._collection=this._paletteGenerate(r.moonlight,this.model.columns):n==="e-presets20"?this._collection=this._paletteGenerate(r.monochrome,this.model.columns):n==="e-presets21"?this._collection=this._paletteGenerate(r.misty,this.model.columns):n==="e-presets22"?this._collection=this._paletteGenerate(r.flatcolors,this.model.columns):n==="e-presets30"?this._collection=this._paletteGenerate(r.basic,this.model.columns):n==="e-presets31"?this._collection=this._paletteGenerate(r.candycrush,this.model.columns):n==="e-presets32"&&(this._collection=this._paletteGenerate(r.citrus,this.model.columns)),this._collection},_paletteGenerate:function(i,r){var u;for(this._PresetTable=t.buildTag("div.e-palette-color").attr({role:"presentation"}),this._tag=t.buildTag("div.e-row"),u=0;u<i.length;u++)u&&u%r==0&&(this._tag=t.buildTag("div.e-row")),this._td=t.buildTag("div.e-item").attr({role:"gridcell","aria-label":"#"+n.trim(i[u]),value:"#"+n.trim(i[u]),style:"background-color:#"+n.trim(i[u])}),this._tag.append(this._td),this._PresetTable.append(this._tag);return this._PresetTable},_checkNameAttr:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id})},_enabled:function(n){n?this.enable():(this.model.enabled=!0,this.disable())},_setDisplayInline:function(i){this.model.displayInline=i;i&&this.element.is("input")?(this.popupContainer.insertAfter(this.wrapper),this._footer.css({display:"none"}),this._setPopupPosition()):i?(this.element.append(this.popupContainer),this.popupContainer.find("button.e-applyButton").css({display:"none"}),this.popupContainer.find("button.e-cancelButton").css({display:"none"}),this._footer.css({display:"none"})):(this.popupContainer.css("display","none"),n("body").append(this.popupContainer),this._isOpen=!1,this.element.is("input")&&(this._bindIconClick(),this.popupContainer.find("button.e-applyButton").length==0&&this._buttonContainer(),this._footer.css({display:"block"}),this.wrapper.removeClass("e-focus"),this._off(n(document),"mousedown",this._onDocumentClick)),this._isFocused=this.isPopupOpen=!1);i&&(this.show(),this.element.is("input")&&this._off(n(this._buttonElement),"mousedown",this._iconClick),this._off(t.getScrollableParents(this.wrapper),"scroll",this.hide))},_bindIconClick:function(){var i=n._data(n(this._buttonElement)[0],"events");t.isNullOrUndefined(i)||t.isNullOrUndefined(i.mousedown)?this._on(this._buttonElement,"mousedown",this._iconClick):i.mousedown.length==0&&this._on(this._buttonElement,"mousedown",this._iconClick)},_unBindIconClick:function(){this._off(this._buttonElement,"mousedown",this._iconClick)},_setPopupPosition:function(){var t=this.element.is("input")?this.wrapper:this.element,i=this._getOffset(t),e,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),f=this.popupContainer.outerHeight(),u=this.popupContainer.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(f<h||f>c?i.top+o+s:i.top-f-s)-l;e=n(document).scrollLeft()+n(window).width()-r;u>e&&u<r+t.outerWidth()&&(r-=this.popupContainer.outerWidth()-t.outerWidth());u+t.offset().left>n(window).width()&&(r=Math.abs(u-n(window).width()));this.popupContainer.css({left:r+"px",position:"absolute",top:v+"px","z-index":a})},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popupContainer)},_setValue:function(n,i){(typeof n=="object"||typeof n=="number"||t.isNullOrUndefined(n.match("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$")))&&(n=null);this.value(n);this._tempValue=n;t.isNullOrUndefined(n)?this._setEmptyValue():this._renderModelValue(n);this._changeEvent(!1,i);this._selectEvent();this.element.is("input")&&this._updateValue()},_renderModelValue:function(n){var t;n&&typeof n=="string"&&(t=this._HexToHSV(n),this._oldValue=this.rgb,this._switch&&(this._valueOperation(),this._colorSlider.option("value",parseInt(this._hsv.h))),this._inputTagValue(this._selectedButton),this._switch||(this._updateUI(),this.element.val(this.value())),this._hueGradient())},setValue:function(n){this._setValue(n)},enable:function(){if(this.model.enabled)return!1;this.wrapper&&this.wrapper.hasClass("e-disable")?(this.wrapper.removeClass("e-disable"),this.element.prop("disabled",!1),this.container.hasClass("e-disable")&&this.container.removeClass("e-disable"),this.popupList.removeClass("e-disable"),this.dropdownbutton.removeClass("e-disable")):this.model.displayInline&&this.element.removeClass("e-disable");var t=this._switch;this._switch=!0;this._cancelObj.enable();this._colorSlider.enable();this.model.enableOpacity?this._opacity.enable():this._opacity.disable();this._splitObj.enable();this._applyObj.enable();this._wireEvents();this._switchEvents();this._switch=t;n(this._inputTag).prop("readonly",!1);this._buttonElement&&this._on(this._buttonElement,"mousedown",this._iconClick);this.model.enabled=!0},disable:function(){if(!this.model.enabled)return!1;this.wrapper&&!this.wrapper.hasClass("e-disable")?(this.wrapper.addClass("e-disable"),this.element.attr("disabled","disabled"),this.container.hasClass("e-disable")||this.container.addClass("e-disable"),this.popupList.addClass("e-disable"),this.dropdownbutton.addClass("e-disable")):this.model.displayInline&&this.element.addClass("e-disable");var t=this._switch;this._switch=!1;this._cancelObj.disable();this._colorSlider.disable();this._opacity.disable();this._splitObj.disable();this._applyObj.disable();this._unWireEvents();this._unSwitchEvents();this._switch=t;this._unBindIconClick();n(this._inputTag).attr("readonly","readonly");this.isPopupOpen&&!this.model.displayInline&&this.hide();this.model.enabled=!1},getColor:function(){return this.rgb},getValue:function(){return this.value()},_alphaGradient:function(n){var i=t.browserInfo(),n=t.isNullOrUndefined(n)?"#000000":n;i.name=="mozilla"?this._alphaSlider.attr({style:"background:-moz-linear-gradient(center top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"}):i.name=="msie"||i.name=="edge"?this._alphaSlider.attr({style:"background:-ms-linear-gradient(top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"}):i.name=="opera"&&i.version<="11.61"?this._alphaSlider.attr({style:"background:-o-linear-gradient(top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"}):(i.name=="chrome"||i.name=="safari"||i.name=="opera")&&this._alphaSlider.attr({style:"background:-webkit-linear-gradient(top,"+n+",#fff) repeat scroll 0 0 rgba(0, 0, 0, 0);"});i.name=="msie"&&(i.version=="8.0"||i.version=="9.0")&&this._alphaSlider.attr({style:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+n+", endColorstr=#ffffff)"});i.name=="msie"&&i.version=="8.0"&&this._handleTag.css({background:this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"})},_hueGradient:function(){var n=this._hsv,t={h:this._hsv.h,s:100,v:100};this._hueSlider.children(".e-handle").css({background:this._formRGB(this.HSVToRGB(t))});this._hsv=n},_updateColor:function(){(this.model.displayInline||!this.model.showApplyCancel)&&(this.value(this._tempValue),this.element.is("input")&&this._updateValue(),this._trigger("select",{value:this.value()}),this._previousColor=this._tempValue)},_changeEvent:function(n,t){this._change&&this._previousValue!==this._tempValue&&(this._alphaGradient(this._tempValue),this._previousValue=this._tempValue,this._trigger("change",{value:this._tempValue,changeFrom:n?"slider":"picker",isInteraction:!t}),this._updateColor(n))},_selectEvent:function(){(this._previousColor!==this._tempValue||this._tempOpacity!==this.opacityValue())&&(this.value(this._tempValue),this.element.is("input")&&this._updateValue(),this.element.val(this.value()),this._trigger("select",{value:this.value()}),this._previousColor=this._tempValue)},_changeHue:function(n){this._handleArea.css("visibility","visible");parseInt(this._hsv.h)!==parseInt(n.value)&&this._switch&&(this._hsv.h=Math.round(n.value),this._hueGradient(),this._hsvValue(),this._tempValue=this.RGBToHEX(this.rgb),this._changeEvent(!0))},_changeAlpha:function(n){this._handleArea.css("visibility","visible");this._switch&&(this.rgb.a=n.value/100,this._tempOpacity=parseInt(this.rgb.a*100),this._changeOpacity(n))},_changeOpacity:function(n){this.rgb.a=this._tempOpacity/100;(this._browser.name="msie"&&this._browser.version=="8.0")?(this._currentTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}),this._handleTag.css({background:this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"})):(this._currentTag.css("background-color",this._formRGBA(this.rgb)),this._alphaSlider.children(".e-handle").css({background:this._formRGBA(this.rgb)}));this._inputTagValue(this._selectedButton);this.model.displayInline?(this._trigger("change",{value:this._tempValue,changeFrom:"slider",isInteraction:t.isNullOrUndefined(n)?!1:n.isInteraction}),this._trigger("select",{value:this.value()})):this._trigger("change",{value:this._tempValue,changeFrom:"slider",isInteraction:t.isNullOrUndefined(n)?!1:n.isInteraction})},_updateValue:function(){this.value()?(this._browser.name="msie"&&this._browser.version=="8.0")?this.spanElement.css({"background-color":this._formRGB(this._HexToRGB(this.value())),filter:"alpha(opacity="+this.rgb.a*100+")"}):this.spanElement.css({"background-color":this._formRGBA(this._HexToRGB(this.value()))}):this.spanElement.removeAttr("style")},_bindClickOperation:function(){var t=this;t._on(n("#"+this._id+"_Presets").find("li.e-preset-row"),"mousedown",t._colorPresetsClick);SplitMenu=n("#"+t._presetContainer.attr("id")).ejMenu("instance");SplitMenu.model.close=function(){t._splitObj.contstatus=!1;t._off(n("#"+this._id+"_Presets").find("li.e-preset-row"),"mousedown",t._colorPresetsClick)}},_wireEvents:function(){this.element.is("input")&&(this._on(this.wrapper,"blur",this._targetBlur),this._on(this.wrapper,"focus",this._targetFocus),this._on(this.wrapper,"keydown",this._popupShown),this._on(this.colorContainer,"click",this._containerClick));this._on(this._changeTag,"click",this._switchModel);this._on(this._groupTag,"click",this._groupButton);this._on(this._addTag,"click",this._addColor);this._on(this._codeEditor,"mouseenter",this._inputEvent);this._on(this._codeEditor,"mouseleave",this._inputEvent);this._on(this._inputTag,"blur",this._inputEvent);this._on(this._inputTag,"focus",this._inputEvent);this._on(this._inputTag,"keyup",this._inputEvent);this._on(this.popupContainer,"focus",this._targetFocus);this._on(this.popupContainer,"blur",this._targetBlur)},_unWireEvents:function(){!this.model.displayInline&&this.element.is("input")&&(this._off(this.wrapper,"blur",this._targetBlur),this._off(this.wrapper,"focus",this._targetFocus),this._off(this.wrapper,"keydown",this._popupShown),this._off(this.colorContainer,"click",this._containerClick));this._off(this._changeTag,"click",this._switchModel);this._off(this._groupTag,"click",this._groupButton);this._off(this._addTag,"click",this._addColor);this._off(this._codeEditor,"mouseenter",this._inputEvent);this._off(this._codeEditor,"mouseleave",this._inputEvent);this._off(this._inputTag,"blur",this._inputEvent);this._off(this._inputTag,"focus",this._inputEvent);this._off(this._inputTag,"keyup",this._inputEvent);this._off(this.popupContainer,"focus",this._targetFocus);this._off(this.popupContainer,"blur",this._targetBlur)},_inputEvent:function(n){this._clearIcon&&(n.type==="focus"&&this._off(this._codeEditor,"mouseleave",this._inputEvent),n.type==="blur"&&this._on(this._codeEditor,"mouseleave",this._inputEvent),n.type==="keyup"&&(this._inputTag.val()!==""?(this._clearIcon.show(),this._handleArea.css("visibility","visible")):(this._clearIcon.hide(),this._handleArea.css("visibility","hidden"))),n.type==="mouseleave"||n.type==="blur"||this._inputTag.val()==""?this._clearIcon.hide():this._clearIcon.show())},_clearColor:function(n){this._tempValue="";this._inputTag.val("");this._setEmptyValue();n.type=="click"&&(this._clearIcon.hide(),this._inputTag.focus())},_containerClick:function(){this.model.buttonMode=="split"&&this._trigger("select",{value:this.value()})},_popupShown:function(n){if(n.keyCode==13)return this._showHidePopup(),this.isPopupOpen||this._buttonClick(n),!1},_recentColor:function(i){var f,e,r,u;if(this._divTag.find(".e-select").removeClass("e-select").addClass("e-block"),f=i.target.attributes.value,r=i.target.attributes.style,t.isNullOrUndefined(f)||t.isNullOrUndefined(r))return this._change=!1,!1;n(i.target.parentNode).addClass("e-select").removeClass("e-block");u=r.value.replace(/^(background-color:rgb|background-color:rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(",");t.isNullOrUndefined(u[3])?(this._browser.name="msie"&&this._browser.version=="8.0")?(e=parseInt(r.nodeValue.replace(/^(FILTER: alpha)\(/,"").split("=")[1].split(")")[0]),this._opacity.option("value",e),this.rgb.a=e/100):(this._opacity.option("value",100),this.rgb.a=1):(this._opacity.option("value",parseInt((parseFloat(u[3])*100).toFixed(2))),this.rgb.a=parseFloat(parseFloat(u[3]).toFixed(2)));this._HexToHSV(f.value);this._inputTagValue(this._selectedButton);this._tempValue=this.RGBToHEX(this.rgb);this._valueOperation();this._colorSlider.option("value",parseInt(this._hsv.h));this._hueGradient();this._changeEvent(!1);(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus()},_handleClick:function(t){t.preventDefault();this._width=this._gradientArea.width();this._height=this._gradientArea.height();this.model.displayInline&&(this._isFocused=!0);this._handleArea.css("visibility","visible");this.mouseDownPos=this._handlePos;n(document).on("mousemove touchmove",n.proxy(this._handleMovement,this));n(document).on("mouseup touchend",n.proxy(this._handleUp,this))},_handleMove:function(n){this._handleArea.css("visibility","visible");this._handleMovement(n);this._focusWrapper(n)},_handleMovement:function(n){if(!this.model.enabled)return!1;var t=n.pageX,i=n.pageY;this.element.is("input")&&this.wrapper.focus();(n.type=="touchstart"||n.type=="touchmove")&&(t=n.originalEvent.changedTouches[0].pageX,i=n.originalEvent.changedTouches[0].pageY);this._hsv.v=parseInt(100*(this._gradientArea.height()-Math.max(0,Math.min(this._gradientArea.height(),i-this._gradientArea.offset().top)))/this._gradientArea.height(),10);this._hsv.s=parseInt(100*Math.max(0,Math.min(this._gradientArea.width(),t-this._gradientArea.offset().left))/this._gradientArea.width(),10);this._hsvValue();this._tempValue=this.RGBToHEX(this.rgb);this._change=!0;this._changeEvent(!1)},_handleUp:function(t){return n(document).off("mouseup touchend",this._handleUp),n(document).off("mousemove touchmove",this._handleMovement),this._focusWrapper(t),!1},_handlePosition:function(){this._handlePos=this._handleArea?{left:parseInt(parseInt(this._width)*this._hsv.s/100,10)+"px",top:parseInt(parseInt(this._height)*(100-this._hsv.v)/100,10)+"px"}:"";this._handleArea.css({left:this._handlePos.left,top:this._handlePos.top})},_addColor:function(){var t=this._divTag.find("> div");value=this._selectedButton.html()!="HSVA"?this._inputTag.val():this._formRGBA(this.HSVToRGB(this._hsv));value!==""&&this._change&&this.model.showRecentColors&&t.length<=12&&(n(n(t)[t.length-2]).remove(),this._generateLi());(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus()},_buttonClick:function(){this._change=!0;var n=this._inputTag.val(),t=this._divTag.find("div");if(this._opacity.option("value",this._tempOpacity),this._tempValue=this.RGBToHEX(this.rgb),this._updatePreviewColor(),this._inputTag.val()==="")if(this._tempValue="",this.model.showClearButton)this._setValue("");else return this._inputTag.addClass("e-error"),!1;this._selectEvent();this.element.is("input")&&(this._updateValue(),this.wrapper.focus());this.model.displayInline||this.hide();this._tempOpacity!==this.opacityValue()&&this.opacityValue(this._tempOpacity)},_generateLi:function(){this._liTag=t.buildTag("div.e-colorblock e-block e-colorset").attr({value:this.RGBToHEX(this.rgb),tabindex:"0"});var n=t.buildTag("div.e-color e-set").attr({value:this.RGBToHEX(this.rgb),title:this.RGBToHEX(this.rgb)});(this._browser.name="msie"&&this._browser.version=="8.0")?n.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}):n.css({"background-color":this._formRGBA(this.rgb)});this._liTag.append(n);this._divTag.prepend(this._liTag)},_colorCodeValue:function(i){var e="",c=this._inputTag.val(),u,r,f,o,s,h;if(u=n.trim(c),u.length==5?this._inputTag.removeClass("e-error"):"",this._keyPressFlag=i.shiftKey&&i.keyCode>=35&&i.keyCode<=40||i.keyCode>=65&&i.keyCode<71||i.keyCode==51||i.ctrlKey&&(i.keyCode==88||i.keyCode==86)||i.keyCode==190?1:i.crtlKey||i.shiftKey||!(i.keyCode>=65&&i.keyCode<71||i.keyCode>=35&&i.keyCode<=40||i.keyCode>=96&&i.keyCode<=105||i.keyCode>=48&&i.keyCode<=57||i.keyCode==13||i.keyCode==8||i.keyCode==46||i.type==="blur")?0:1,(this.model.enableOpacity&&(i.keyCode==188||i.keyCode==71||i.keyCode==72||i.keyCode==82||i.keyCode==83||i.keyCode==86)||i.shiftKey&&(i.keyCode==57||i.keyCode==48))&&(this._keyPressFlag=1),this._keyPressFlag==1){if(this._inputTag.removeClass("e-error"),i.keyCode===13||i.type==="blur"){if(u===""&&(this.model.showClearButton?this._setEmptyValue():this._inputTag.addClass("e-error")),o=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,r=u.match(o),t.isNullOrUndefined(r))if(s=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/,r=u.match(s),t.isNullOrUndefined(r)){if(h=/^hsva?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/,r=u.match(h),t.isNullOrUndefined(r))return u!=""&&this._inputTag.addClass("e-error"),this._change=!1,!1;this._hsvColor(r)}else this._rgbaColor(r);else{if(r[1].length===3)for(f=0;f<r[1].length;f++)e+=r[1][f]+r[1][f];else r[1].length===6&&(e=r[1]);u=this.hexCodeToRGB("#"+e);this._inputTag.val("#"+e);this.rgb=this.HSVToRGB(this.RGBToHSV(u));this._tempValue=this.RGBToHEX(this.rgb);this._change=!0}this._change&&(this._valueOperation(),this._colorSlider.option("value",parseInt(this._hsv.h)),this._hueGradient(),this._changeEvent(!1),this.element.is("input")||this._selectEvent(),this._inputTag.val()!==""&&this._inputTag.removeClass("e-error"))}}else i.keyCode!=9&&i.preventDefault(),i.shiftKey||i.ctrlKey||i.keyCode===27||i.keyCode==20||this._inputTag.addClass("e-error")},_setEmptyValue:function(){this._handleArea.css("visibility","hidden");this._currentTag.css({"background-color":""});this._removeClass();this._tempValue=null;this._inputTag.val(null);this._previousValue!==this._tempValue&&(this._trigger("change",{value:null}),this._previousValue=this._tempValue)},_rgbaColor:function(n){var i={};if(n[0].split("(")[0]!="rgba"||t.isNullOrUndefined(n[4]))if(n[0].split("(")[0]=="rgb"&&t.isNullOrUndefined(n[4]))i.r=n[1],i.g=n[2],i.b=n[3],i.a=this.rgb.a,this._inputTag.val("rgba("+i.r+","+i.g+","+i.b+","+i.a+")");else return this._inputTag.addClass("e-error"),this._change=!1,!1;else i.r=n[1],i.g=n[2],i.b=n[3],i.a=n[4];this.rgb.a=parseFloat(i.a);this._tempOpacity=this.rgb.a*100;this._opacity.option("value",this._tempOpacity);this.opacityValue(this._tempOpacity);this._tempValue=this.RGBToHEX(i);this._HexToHSV(this._tempValue);this._inputTag.removeClass("e-error");this._change=!0},_hsvColor:function(n){var i={};if(t.isNullOrUndefined(n[4]))return this._inputTag.addClass("e-error"),this._change=!1,!1;i.h=n[1];i.s=n[2];i.v=n[3];i.a=n[4];this.rgb.a=parseFloat(i.a);this._tempOpacity=this.rgb.a*100;this._opacity.option("value",this._tempOpacity);this.opacityValue(this._tempOpacity);this.rgb=this.HSVToRGB(i);this._tempValue=this.RGBToHEX(this.rgb);this._inputTag.removeClass("e-error");this._change=!0},_iconClick:function(n){n.preventDefault();this._showHidePopup();this.wrapper.focus()},_showHidePopup:function(){if(this.model.displayInline)return!1;this.isPopupOpen?(this.hide(),this.wrapper.focus()):this.show()},hide:function(){var i=this;if(!this.isPopupOpen||this.model.displayInline)return!1;this.isPopupOpen=this._dataBind=!1;this.element.is("input")&&(this.wrapper.focus(),this.wrapper.removeClass("e-active"));this._width=this._gradientArea.width();this._height=this._gradientArea.height();this.popupContainer.slideUp(200,function(){i.model&&(i._tempOpacity=i.opacityValue(),i.rgb.a=i._tempOpacity/100,i._tempValue=i.value(),i._renderModelValue(i.value()),i._opacity.option("value",parseInt(i.opacityValue())),i.model.displayInline||i._off(n(document),"mousedown",i._onDocumentClick),i._trigger("close"))});this.model.displayInline||this._off(n(document),"mousedown",this._onDocumentClick);this._off(this._inputTag,"keydown",this._colorCodeValue);this._off(this._inputTag,"blur",this._colorCodeValue);this._modelType=="palette"?this._off(n(document),"keydown",this._keyDown):this._off(n(document),"keydown",this._onKeyDown);this._off(t.getScrollableParents(this.wrapper),"scroll",this.hide);n(window).off("resize",n.proxy(this._OnWindowResize,this))},_hidePopup:function(){this.model.displayInline||this.hide()},show:function(){if(this.element.is("input")&&(this.wrapper.focus(),this.wrapper.addClass("e-active")),this.isPopupOpen||!this.model.enabled)return!1;this.isPopupOpen=!0;this.model.modelType=="palette"&&this._cellSelect();!this.model.displayInline&&(this.value()===""||t.isNullOrUndefined(this.value()))?this._setEmptyValue():this._handleArea.css("visibility","visible");this._previousColor=this._previousValue=this.value();this.popupContainer.children().find(".e-focus").removeClass("e-focus");this.model.displayInline||this._setPopupPosition();var i=this;this.popupContainer.slideDown(200,function(){i.isFocused=!0;i._on(n(document),"mousedown",i._onDocumentClick);i._trigger("open")});this._dataBind||(this._modelType=="palette"?this._on(n(document),"keydown",this._keyDown):this._on(n(document),"keydown",this._onKeyDown));this._on(this._inputTag,"keydown",this._colorCodeValue);this._on(this._inputTag,"blur",this._colorCodeValue);this._dataBind=!0;n(window).on("resize",n.proxy(this._OnWindowResize,this));this.model.displayInline||this._on(t.getScrollableParents(this.wrapper),"scroll",this.hide);this._prevSize!==n(window).width()&&this.refresh()},_showBindEvents:function(){this._modelType=="palette"?this._on(n(document),"keydown",this._keyDown):this._on(n(document),"keydown",this._onKeyDown)},_hideUnBindEvents:function(){this._modelType=="palette"?this._off(n(document),"keydown",this._onKeyDown):this._off(n(document),"keydown",this._keyDown)},_switchEvents:function(){this._switch?(this._on(this._gradientArea,"mousedown touchstart",this._handleMove),this._on(this._handleArea,"mousedown touchstart",this._handleClick),this._on(this._gradientArea,"mousedown touchstart",this._handleClick)):this._on(this._collection,"mousedown",this._onSelect)},_unSwitchEvents:function(){this._switch?this._off(this._collection,"mousedown",this._onSelect):(this._off(this._gradientArea,"mousedown touchstart",this._handleMove),this._off(this._handleArea,"mousedown touchstart",this._handleClick),this._off(this._gradientArea,"mousedown touchstart",this._handleClick))},_groupButton:function(t){if(n(t.target).hasClass("e-disable"))return!1;if(n(t.target).hasClass("e-button")){var i=this._groupTag.find(".e-btn.e-select");this._inputTag.val()!==""?this._inputTagValue(n(t.target)):this._selectedButton=n(t.target);this._selectedButton.html()!=="HEX"?this._inputTag.attr("maxLength","22"):this._inputTag.attr("maxLength","7");this._groupTag.find(".e-click").removeClass("e-click");n(t.target).addClass("e-click");this._inputTag.removeClass("e-error")}},_inputTagValue:function(n){n.html()=="RGBA"?this._inputTag.val(this._formRGBA(this.rgb)):n.html()=="HEX"?this._inputTag.val(this.RGBToHEX(this.rgb)):n.html()=="HSVA"&&this._modelType!="palette"&&this._inputTag.val("hsva("+Math.round(this._hsv.h)+","+Math.round(this._hsv.s)+","+Math.round(this._hsv.v)+","+this.rgb.a+")");this._selectedButton=n},_bindRecentEvent:function(){this._on(this._divTag,"click",this._recentColor)},_unBindRecentEvent:function(){this._off(this._divTag,"click",this._recentColor)},_handlePlacement:function(n,t,i){this._handleArea.css("visibility","visible");var r=this._hsv;r[n]+=t*(i?1:3);r[n]<0&&(r[n]=0);n==="s"?this._hsv.s=r[n]:this._hsv.v=r[n];this._hsvValue();this._tempValue=this.RGBToHEX(this.rgb);this._changeEvent(!1)},_onKeyDown:function(t){var i=t.keyCode;if(this.model.enabled&&(t.shiftKey&&i==9&&n(this._hueSlider).find(".e-handle").hasClass("e-focus")&&this._focusWrapper(t),this._isFocused||i!=9||i===27)&&(this._change=!0,!t.altKey&&!t.shiftKey))switch(i){case 39:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("s",1,t.ctrlKey));break;case 38:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("v",1,t.ctrlKey));break;case 37:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("s",-1,t.ctrlKey));break;case 40:this.element.is("input")&&n(t.target).is(this.wrapper)&&(t.preventDefault(),this._handlePlacement("v",-1,t.ctrlKey));break;case 13:t.preventDefault();n(t.target).hasClass("e-switcher")?(this._switchModel(),n(t.target).focus()):n(t.target).hasClass("e-applyButton")&&this._buttonClick(t);break;case 27:t.preventDefault();this.model.displayInline||this.hide();this._tempValue=this.value();break;case 9:active=document.activeElement;n(active).is(this.wrapper)&&this._focusPopup(t)}},_focusPopup:function(t){n(this._hueSlider).find(".e-handle").focus();t.preventDefault()},_focusWrapper:function(t){this.element.is("input")&&n(this.wrapper).focus();t.preventDefault()},_onDocumentClick:function(t){n(t.target).is(this.popupContainer)||n(t.target).parents(".e-colorpicker").is(this.popupContainer)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-colorpickerwidget").is(this.wrapper)||n(t.target).parents(".e-presetWrapper").is("#"+this._id+"_Presets")||(this.model.displayInline||(this.hide(),this.element.is("input")&&this.wrapper.removeClass("e-focus")),this._isFocused=!1)},_OnWindowResize:function(){this.element.is("input")&&this._setPopupPosition();this.refresh()},refresh:function(){var t=n(this._PresetTable.find(".e-item")[1]),i=10,u,r;this.isPopupOpen?this._modelType=="picker"&&this.PaletteWrapper.css({display:"block",visibility:"hidden"}):(this.popupContainer.css({display:"block",visibility:"hidden"}),this._modelType=="palette"&&this.PaletteWrapper.css({display:"block",visibility:"hidden"}));(parseFloat(this._tag.outerHeight())>t.outerHeight(!0)||n(this._tag).outerWidth()-n(t).outerWidth(!0)*i>t.outerWidth()||n(this._tag).outerWidth()==0)&&(u=parseFloat(n(this._tag).outerWidth())-36,r=u/i-(t.outerWidth()-t.width()),this._PresetTable.find(".e-item").css("width",r),t.outerWidth(!0)*i>this._tag.outerWidth()&&this._PresetTable.find(".e-item").css("width",r-1));this.isPopupOpen?this._modelType=="picker"&&this.PaletteWrapper.css({display:"none",visibility:"visible"}):(this.popupContainer.css({display:"none",visibility:"visible"}),this._modelType=="palette"&&this.PaletteWrapper.css({visibility:"visible"}));this._prevSize=n(window).width();this._width=this._gradientArea.width();this._height=this._gradientArea.height()},_range:function(n,t){return t===""?0:t>n?n:t},_hsvValue:function(){this._change=!0;this._hsv.v=this._hsv.v>=100?100:this._hsv.v;this._hsv.s=this._hsv.s>=100?100:this._hsv.s;this.hsv=this._hsv;this.rgb=this.HSVToRGB(this.hsv);this._valueOperation();this._inputTagValue(this._selectedButton)},_formRGB:function(n){if(!t.isNullOrUndefined(n))return"rgb("+n.r+","+n.g+","+n.b+")"},_formRGBA:function(n){if(!t.isNullOrUndefined(n))return"rgba("+n.r+","+n.g+","+n.b+","+n.a+")"},_rgbValue:function(){value=this._HexToRGB(this._tempValue);t.isNullOrUndefined(value)||(this.rgb=value,this._change=!0,this.HSVToRGB(this.RGBToHSV(this.rgb)),this._colorSlider.option("value",parseInt(this._hsv.h)),this._opacity.option("value",this.rgb.a*100));this._valueOperation();this._inputTagValue(this._selectedButton)},_valueOperation:function(){this._handlePosition();this._alphaGradient(this._tempValue);this._inputTag.removeClass("e-error");this._updateUI()},_HexToHSV:function(n){return this.HSVToRGB(this.RGBToHSV(this._HexToRGB(n)))},_HexToRGB:function(n){if(!t.isNullOrUndefined(n)){var n,i=n.match("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");return t.isNullOrUndefined(i)?(this._change=!1,!1):(i[1].length==3&&(n="#"+i[1][0]+i[1][0]+i[1][1]+i[1][1]+i[1][2]+i[1][2]),this._change=!0,n=parseInt(n.indexOf("#")>-1?n.substring(1):n,16),value=t.isNullOrUndefined(this.rgb)?parseFloat(this._tempOpacity)/100:this.rgb.a,this.rgb={r:n>>16,g:(n&65280)>>8,b:n&255,a:value})}},RGBToHSV:function(n){var t={h:0,s:0,v:0},u=Math.min(n.r,n.g,n.b),i=Math.max(n.r,n.g,n.b),r=i-u;return(t.v=i,t.v*=100/255,r===0)?(this._hsv=t,t):(t.s=i!=0?255*r/i:0,t.h=t.s!=0?n.r==i?(n.g-n.b)/r:n.g==i?2+(n.b-n.r)/r:4+(n.r-n.g)/r:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,this._hsv=t,t)},HSVToRGB:function(n){var i={},f=Math.round(n.h),s=Math.round(n.s*255/100),o=Math.round(n.v*255/100),h;if(s==0)i.r=i.g=i.b=o;else{var r=o,u=(255-s)*o/255,e=(r-u)*(f%60)/60;f==360&&(f=0);f<60?(i.r=r,i.b=u,i.g=u+e):f<120?(i.g=r,i.b=u,i.r=r-e):f<180?(i.g=r,i.r=u,i.b=u+e):f<240?(i.b=r,i.r=u,i.g=r-e):f<300?(i.b=r,i.g=u,i.r=u+e):f<360?(i.r=r,i.g=u,i.b=r-e):(i.r=0,i.g=0,i.b=0)}return this._hsv=n,h=t.isNullOrUndefined(this.rgb)?parseFloat(this._tempOpacity)/100:this.rgb.a,{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b),a:h}},_HSVToHex:function(n){return this.RGBToHEX(this.HSVToRGB(n))},_toHEX:function(n){return n.indexOf("#")!==-1?n:(n=n.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+this._hex(n[1])+this._hex(n[2])+this._hex(n[3]))},RGBToHEX:function(n){if(!t.isNullOrUndefined(n))return"#"+this._hex(n.r)+this._hex(n.g)+this._hex(n.b)},_hex:function(n){return("0"+parseInt(n).toString(16)).slice(-2)},_colorValue:function(n){return this._color=n.indexOf("#")!=-1?this.hexCodeToRGB(n):"","rgb("+this._color.r+", "+this._color.g+", "+this._color.b+")"},hexCodeToRGB:function(n){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:this.rgb.a}:null},_updatePreviewColor:function(){(this._browser.name="msie"&&this._browser.version=="8.0")?this._previousTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}):this._previousTag.css({"background-color":this._formRGBA(this.rgb)});this._oldValue=this.rgb},_updateUI:function(){var t=this._hsv,n;this._switch?(n={h:this._hsv.h,s:100,v:100},this._gradientArea.css({"background-color":this._colorValue(this._HSVToHex(n))})):this._cellSelect();(this._browser.name="msie"&&this._browser.version=="8.0")?(this._currentTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+this.rgb.a*100+")"}),this._previousTag.css({"background-color":this._formRGB(this._oldValue),filter:"alpha(opacity="+this.rgb.a*100+")"})):(this._currentTag.css({"background-color":this._formRGBA(this.rgb)}),this._previousTag.css({"background-color":this._formRGBA(this._oldValue)}),this._alphaSlider.children(".e-handle").css({background:this._formRGBA(this.rgb)}));this._hsv=t},_targetFocus:function(n){n.preventDefault();this._isFocused||(this._isFocused=!0,this.element.is("input")&&this.wrapper.addClass("e-focus"))},_targetBlur:function(){this._isFocused=!1;!this.isPopupOpen&&this.element.is("input")&&this.wrapper.removeClass("e-focus")},_switchModel:function(){this._tempValue=this.RGBToHEX(this.rgb);this.refresh();var n=this;this._off(this._changeTag,"click",this._switchModel);this._modelType=="palette"?(this._modelType="picker",this._switcher.removeClass("e-pickerModel").addClass("e-paletteModel"),this.PaletteWrapper.fadeOut(300,function(){n._presetTag.parents(".e-split.e-widget").addClass("e-hide");n._gradient.fadeIn(300);n._on(n._changeTag,"click",n._switchModel)}),this._switch=!0,this._rgbValue(),this._hueGradient(),this._hsva.ejButton("enable")):(this.PaletteWrapper.remove(),this._modelType="palette",this.PaletteWrapper=this._layoutType(this.model.palette),this._gradient.addClass("e-hide"),this._paletteType(),this._switcher.removeClass("e-paletteModel").addClass("e-pickerModel"),this._gradient.fadeOut(300,function(){n._presetTag.parents(".e-split.e-widget").removeClass("e-hide");t.isNullOrUndefined(n.PaletteWrapper)&&(n.PaletteWrapper=n._layoutType(n.model.palette),n._splitObj.option("prefixIcon","e-color-image e-"+n.model.presetType),n.popupList.prepend(n.PaletteWrapper));n.PaletteWrapper.fadeIn(300);n._on(n._changeTag,"click",n._switchModel)}),this.value()!==""&&this._cellSelect(),this._disableHSVButton());this.model.palette==="custompalette"&&this._presetTag.parents(".e-split.e-widget").addClass("e-hide");(!this.model.displayInline||this.element.is(":input"))&&this.wrapper.focus();this._switchEvents();this._unSwitchEvents();this.isPopupOpen&&(this._hideUnBindEvents(),this._showBindEvents())},_disableHSVButton:function(){n(this._groupTag.find(".e-click")).hasClass("e-hsvButton")&&(this._inputTagValue(this._rgb),this._rgb.addClass("e-click"),this._hsva.removeClass("e-click"));this._hsva.ejButton("disable")},_cellSelect:function(){var i,r,t=this;this._removeClass();this._collection.find(".e-item").each(function(){i=n(this).css("background-color");(t._browser.name="msie"&&t._browser.version=="8.0")?i&&i.replace(/ /g,"")===t.RGBToHEX(t.rgb)&&(r=this,n(r).addClass("e-filter")):i&&i.replace(/ /g,"")===t._formRGB(t.rgb)&&(r=this)});n(r).addClass("e-state-selected").attr("aria-selected",!0)},_removeClass:function(){this._collection.find(".e-item").removeClass("e-state-selected").removeClass("e-filter").removeAttr("aria-selected")},_position:function(n,t,i){n=Array.prototype.slice.call(n);var u=n.length,r=n.indexOf(t);return r<0?i<0?n[u-1]:n[0]:(r+=i,n[r<0?r+=u:r%=u])},_onSelect:function(n){if(!this.model.enabled)return!1;this._isFocused=!0;this._handleArea.css("visibility","visible");n.target.style.backgroundColor!=""&&(this._collection.find(".e-item").removeClass("e-state-selected").removeAttr("aria-selected"),this._HexToRGB(this._toHEX(n.target.style.backgroundColor)),this._updateUI(),this._inputTagValue(this._selectedButton),(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus(),this._tempValue=this.RGBToHEX(this.rgb),this._changeEvent(!1));n.preventDefault()},_keyDown:function(t){if(this._isFocused){if(this._change=!0,!this.model.enabled)return!1;var i="",r=t.keyCode,u=this._collection.find(".e-item"),f=u.filter(".e-state-selected").get(0),e=this.model.columns;t.altKey||r!=37&&r!=38&&r!=39&&r!=40||t.target.className==="e-color-code"||this._removeClass();switch(!t.altKey&&r){case 40:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,e));break;case 37:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,-1));break;case 38:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,-e));break;case 39:t.target.className!=="e-color-code"&&(t.preventDefault(),i=this._position(u,f,1));break;case 13:this._collection.find(".e-item").removeClass("e-state-selected").removeAttr("aria-selected");n(t.target).hasClass("e-switcher")?(this._switchModel(),n(t.target).focus()):n(t.target).hasClass("e-applyButton")&&(this._buttonClick(t),this._updateUI(),this.model.displayInline||this.hide(),this.element.is("input")&&this.wrapper.focus());break;case 27:this.model.displayInline||this.hide();n(this._presetContainer).hide();this.element.is("input")&&this.wrapper.focus();break;case 9:active=document.activeElement;n(active).is(this.wrapper)&&this._focusPalettePopup(t,!0)}i&&(n(i).addClass("e-state-selected").attr("aria-selected",!0),this._currentTag.css({"background-color":this._formRGB(this._HexToRGB(i.attributes.value.value))}),this._inputTagValue(this._selectedButton),this._tempValue=this.RGBToHEX(this.rgb),this._changeEvent(!1))}else t.keyCode==27&&(this.hide(),n(this._presetContainer).hide())},_focusPalettePopup:function(t){n(this.popupContainer).focus();t.preventDefault()}});t.ColorPicker.Locale=t.ColorPicker.Locale||{};t.ColorPicker.Locale["default"]=t.ColorPicker.Locale["en-US"]={buttonText:{apply:"Apply",cancel:"Cancel",swatches:"Swatches"},tooltipText:{switcher:"Switcher",addButton:"Add Color",basic:"Basic",monoChrome:"Mono Chrome",flatColors:"Flat Colors",seaWolf:"Sea Wolf",webColors:"Web Colors",sandy:"Sandy",pinkShades:"Pink Shades",misty:"Misty",citrus:"Citrus",vintage:"Vintage",moonLight:"Moon Light",candyCrush:"Candy Crush",currentColor:"Current Color",selectedColor:"Selected Color"}};t.ColorPicker.Palette={BasicPalette:"basicpalette",CustomPalette:"custompalette"};t.ColorPicker.ModelType={Palette:"palette",Picker:"picker"};t.ColorPicker.ButtonMode={Default:"dropdown",Split:"split"};t.ColorPicker.PresetType={Basic:"basic",MonoChrome:"monochrome",FlatColors:"flatcolors",SeaWolf:"seawolf",WebColors:"webcolors",Sandy:"sandy",PinkShades:"pinkshades",Misty:"misty",Citrus:"citrus",Vintage:"vintage",MoonLight:"moonlight",CandyCrush:"candycrush"};var r={basic:["ffffff","facbcb","fccb98","faf39a","fbf8cd","a6d38b","aadee8","d1ecf2","cdcae5","eecde1","cccbcb","f16667","f69668","f8ee6b","f7ec37","89c987","75cddd","8bd3e1","7f7fcc","9494c8","b3b2b3","ec2024","f7971d","ffcb67","f5ea14","74bf44","69c8c9","46c7f4","6666ad","b76cab","676767","971b1e","ca6828","ca9732","979937","0d9948","339898","4857a6","62449a","973794","000000","2f1110","973620","663433","343416","183319","023334","22205f","3b2f8d","310e31"],monochrome:["ffffff","e3e3e3","c6c6c6","aaaaaa","8e8e8e","717171","555555","393939","1c1c1c","000000","f9e6e7","f4d0d2","efbabc","e9a4a7","e48e92","df787c","da6267","d44c52","cf363c","ca2027","fff4ca","ffeb9e","fff0b4","ffefb1","ffe788","ffe272","ffd947","ffd531","ffd01b","ffcc05","e4f4eb","ccead9","b4e0c7","9cd6b5","84cca3","6dc190","55b77e","3dad6c","25a35a","0d9948","e8f4f4","d6e3eb","c4d1e3","b3c0da","a1aed1","8f9dc9","7d8bc0","6c7ab7","5a68af","4857a6"],flatcolors:["7477b8","488bca","18b1d4","1db369","78c162","acc063","ffe84e","f6b757","f79853","ed6346","E87F3D","E4C45D","B7A575","999999","67809F","002228","00A578","F9A41F","F3770B","D7401B","FFCB36","82CC2C","36B595","6370AD","D4264E","004D8E","22A04B","F3A414","C77405","F3420B","1ABC9C","3498DB","9B59B6","E67E22","E74C3C","3A738A","EBD9A7","89AD78","FF766D","C76160","BF3542","CDC5BA","EBE3D6","3C3C3C","2E2E2E","77A7FB","E57368","FBCB43","34B67A","FFFFFF"],seawolf:["0EEAFF","15A9FA","1B76FF","1C3FFD","2C1DFF","0B3C4C","0E5066","13647F","127899","1A8BB2","74B8E8","659EBB","3C9FFF","26466F","2472FF","0069A4","009BF2","004165","49A0B4","274C5F","000000","7A5848","E0A088","F9DEC6","3A2A22","DC3522","D9CB9E","374140","2A2C2B","1E1E20","CB3937","FE6B2C","654E44","6DD16F","70FE2C","275673","4681A6","FDDEC9","F22816","400101","071C2F","388494","E6A934","F3DB5F","534329","206956","47683B","E1BFA6","BF7950","903932"],webcolors:["0066aa","00bbdd","338800","77bb00","ffcc99","990c0c","0303c9","336699","669933","cccccc","EEEEEE","E7C36F","F7B230","E35B20","000033","7D7A74","BD524A","FCB200","8CFCC2","2ACD6B","666666","666553","FFFEEC","B2B2A4","AAA4B2","9CA5E3","5A668C","BBA469","CFC295","FFFFFF","DBBF56","2E94B3","808080","E96656","14A168","DE185B","D8806F","DBE186","D8CC63","DCC527","4E6C89","E2BDAD","EC6053","81BBAD","DFCDA5","453394","66398A","313E7D","336694","788E91"],sandy:["c0a986","ecd9c3","dfc79b","f6d58e","ecdaad","fff3e0","7f6b4a","ffd694","7f7a70","ccac76","E6E2AF","A79A71","EFECCA","806F4C","2F2F2E","997F1A","CCB65F","FFD291","6B674A","635F3A","7F693A","FFEBC1","FFD275","7F7561","CCA85E","D29854","4A4034","C9AD8D","4A351D","968169","E6E39F","9A9757","FFFDC9","94909A","E2E0E6","960010","EB1517","CD7C29","9A571C","1F7A94","7F6826","7F724C","FFE499","FFD04C","CCA63D","FFA669","92FFB6","FFF352","E8C269","D7E8CB"],pinkshades:["F6B1C3","F0788C","DE264C","BC0D35","A20D1E","E12256","BB1C48","7B132F","3B0917","FA2660","FFB7B5","9A423F","FF6D68","BB5855","CC5753","E88161","D66C60","C2646E","996072","705262","FFA1BD","FF8FB7","FF82AE","E9719B","CC6882","F250C7","BF1774","BF2696","AC60AA","BB90C5","BF1553","F20775","F2F2F2","e5566d","f2afc1","f43fa5","fc8c99","FF6887","7F3443","CC536C","D06AA9","E65F41","650017","BC1620","FA427E","3B1132","84476E","B83D65","E6E0E8","FF6EE8"],misty:["5C7A84","3D5372","7C9196","50748A","ADBFBF","010735","052159","194073","376B8C","FFFFFF","985999","C811CC","892EFF","FF6852","DBA211","0A0D0C","85A67C","46593E","BBD9AD","202616","BF8E63","734327","A66C4B","593A2F","BFBFBF","8DB0B6","1B778A","F46C1B","881801","192129","81808C","ABAABF","0C0E09","6A7366","37402F","5D6663","84867B","A4A66A","BABBB1","20211C","6B9695","646E8C","6B8196","61787F","648C80","8E9FBA","89A8C8","799ED1","7FAEE7","849EBD"],citrus:["FAEA41","E7F03E","E3C647","FAC541","F0AB3E","CCCA1F","FFF300","FFCB0D","FF9500","804A00","6A692A","FFFCA0","FFFFFF","CF664E","EFAC66","EFF299","F2DC6D","F29727","F2600C","592202","214001","4F7302","1A2601","BCD97E","C0D904","AAFEFF","359D6D","E5FF45","65FCCF","ABDC4B","42B200","C6FF00","F2E304","FFB200","FF8600","52EC04","04E206","94D507","ECE404","E2C904","DA321C","FF7913","FBD028","C0D725","9FC131","547312","ADBF26","DEB329","F1DB47","E08214"],vintage:["684132","fdbe30","eaac21","87783c","3e4028","ffc706","cd5648","5bafa9","828282","363636","424862","fb9a63","bfc4d5","f6fbf4","febc98","657050","FCF082","D8D98B","A2AB80","4D584A","5ADED4","4DAAAB","26596A","163342","6C98A1","010A26","28403B","557359","AEBF8A","C7D9AD","AFFCCB","CB4243","D2997E","36857E","4AC6BB","28394B","191313","AF0A18","DC373D","122438","43734A","A6A26D","D9B448","BF8C2C","734002","26010F","866F53","ACBD91","7BAB87","546859"],moonlight:["241D37","2A233D","322B45","362F49","D4BA73","261225","592040","8C3063","A64985","73345D","A3C8FF","85B6FF","000040","213190","050859","FFFFFF","6AAED9","4184BF","224573","2e4154","bcad7e","955351","c36a57","9a8556","7e6029","dbd78e","beae3b","c3a04c","58504d","967644","CFC496","B3B391","889486","61797B","366577","123340","436E73","7B8C61","D7D996","F0EBB4","341F36","D9B5E0","9889AB","4D4E66","1B2129","5CBBE3","FCF1BC","5C8182","383A47","B4F257"],candycrush:["0779f4","30da00","fb8006","f9d802","a71df7","f70200","fd49ae","682e07","9b2424","5e7693","F9AB3B","EF5627","FF0000","00A398","803C2C","DE5711","FFF026","FF0048","14A0CC","00B229","FFFFBE","F7CD99","FF77A1","9886E8","97CACB","EAEDE5","FFD127","FF870C","EC4610","9A1900","993460","CC1464","C300FF","FFFFBC","CCB914","FFFEE2","B24C5F","FF274F","0A94CC","679DB2","C2FFE6","16B271","5FFFBC","B2442F","FFA190","E89359","FFFB75","F36EFF","5999E8","73EB86"]}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejFileExplorer","ej.FileExplorer",{element:null,model:null,validTags:["div"],_addToPersist:["layout","selectedFolder","selectedItems","height","width"],_rootCSS:"e-fileexplorer",_requiresID:!0,defaults:{fileTypes:"*.*",filterSettings:{caseSensitiveSearch:!1,filterType:"contains",allowSearchOnTyping:!0},showToolbar:!0,showCheckbox:!0,showNavigationPane:!0,allowDragAndDrop:!0,showContextMenu:!0,showFooter:!0,layout:"grid",locale:"en-US",selectedFolder:"",selectedItems:"",gridSettings:{allowSorting:!0,columns:[{field:"name",headerText:"Name",width:"30%"},{field:"dateModified",headerText:"Date Modified",width:"30%"},{field:"type",headerText:"Type",width:"15%"},{field:"size",headerText:"Size",width:"12%",textAlign:"right",headerTextAlign:"left"}],allowResizing:!0},tools:{creation:["NewFolder"],navigation:["Back","Forward","Upward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete","Rename","Download"],copyPaste:["Cut","Copy","Paste"],getProperties:["Details"],searchBar:["Searchbar"],layout:["Layout"],sortBy:["SortBy"]},toolsList:["layout","creation","navigation","addressBar","editing","copyPaste","sortBy","getProperties","searchBar"],path:"",height:"400px",width:"850px",minWidth:"400px",maxWidth:null,minHeight:"250px",maxHeight:null,isResponsive:!1,uploadSettings:{allowMultipleFile:!0,maxFileSize:31457280,autoUpload:!1},enableResize:!1,cssClass:"",enableRTL:!1,allowKeyboardNavigation:!0,showThumbnail:!0,enableThumbnailCompress:!1,showRoundedCorner:!1,ajaxAction:"",ajaxDataType:"json",ajaxSettings:{read:{},createFolder:{},remove:{},rename:{},paste:{},getDetails:{},download:{},upload:{},getImage:{},search:{}},allowMultiSelection:!0,contextMenuSettings:{items:{navbar:["NewFolder","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","Getinfo"],cwd:["Refresh","Paste","|","SortBy","|","NewFolder","Upload","|","Getinfo"],files:["Open","Download","|","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","OpenFolderLocation","Getinfo"]},customMenuFields:[]},enablePersistence:!1,layoutChange:null,getImage:null,select:null,unselect:null,createFolder:null,remove:null,cut:null,copy:null,paste:null,open:null,beforeOpen:null,beforeUpload:null,beforeDownload:null,beforeGetImage:null,beforeAjaxRequest:null,resizeStart:null,resize:null,resizeStop:null,templateRefresh:null,dragStart:null,drag:null,dragStop:null,drop:null,menuClick:null,menuBeforeOpen:null,menuOpen:null,create:null,destroy:null},dataTypes:{filterSettings:"data",showToolbar:"boolean",showNavigationPane:"boolean",showContextMenu:"boolean",allowDragAndDrop:"boolean",allowKeyboardNavigation:"boolean",showRoundedCorner:"boolean",showFooter:"boolean",layout:"enum",gridSettings:"data",tools:{creation:"array",navigation:"array",addressBar:"array",editing:"array",layout:"array",copyPaste:"array",getProperties:"array",searchBar:"array"},toolsList:"array",uploadSettings:"data",ajaxSettings:"data"},_setModel:function(i){var f=this,r,e,o,u;for(r in i)switch(r){case"showToolbar":i[r]?t.isNullOrUndefined(this._toolBarItems)?this._updateToolbar():this._toolBarItems.show():this._toolBarItems.hide();this.adjustSize();break;case"showNavigationPane":case"showTreeview":this.model.showNavigationPane=this.model.showTreeview=i[r];this._showHideSplitBar(this.model.showNavigationPane);break;case"showContextMenu":this._showHideContextMenu();break;case"height":this.element.css("height",this._getProperValue(this.model.height));this.adjustSize();break;case"width":this.element.css("width",this._getProperValue(this.model.width));this.adjustSize();break;case"layout":this._switchLayoutView(!0);break;case"allowDragAndDrop":this.model.allowDragAndDrop=i[r];this._draggableOption(i[r]?"_on":"_off");i[r]?this._allowDrag():this._preventDrag();break;case"showThumbnail":this.model.showThumbnail=i[r];this._switchLayoutView();break;case"enableThumbnailCompress":this.model.enableThumbnailCompress=i[r];this.model.showThumbnail&&this.model.layout!="grid"&&this._renderTileView(this._fileExplorer[this._originalPath]);break;case"path":i[r]?this._setPath(i[r]):this._getPath();break;case"enableRTL":this._enableRTL(i[r]);break;case"allowKeyboardNavigation":this._subControlsSetModel("allowKeyboardNavigation",i[r]);this._gridObj&&this._gridObj.setModel({allowKeyboardNavigation:i[r]});break;case"showFooter":i[r]?(this._statusbar.hasClass("e-statusbar")?(e=this._splittag.find(".e-cont2").outerHeight()-this._statusbar.outerHeight(),this._tileView.height(e),this._gridtag.height(e),this._statusbar.show()):(this._createStatusBar(),this._updateData(),this.model.enableResize&&this._resizeFileExplorer(),this._on(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView),this._on(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView)),o=this._splittag.height()-this._gridtag.find(".e-gridheader").outerHeight(),this._tileContent.parent(".e-tile-wrapper").ejScroller({height:this._splittag.outerHeight()-this._statusbar.outerHeight(),scrollerSize:this._scrollerSize,thumbStart:function(n){f._onThumbStart(n)}})):(this._tileView.height("auto"),this._gridtag.height("auto"),this._statusbar.hide(),o=this._splittag.height()-this._gridtag.find(".e-gridheader").outerHeight(),this._tileContent.parent(".e-tile-wrapper").ejScroller({height:this._splittag.outerHeight(),scrollerSize:this._scrollerSize,thumbStart:function(n){f._onThumbStart(n)}}));break;case"gridSettings":u=JSON.parse(JSON.stringify(i[r]));u.columns&&(u.columns.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"<script type='text/x-jsrender'><span class='e-fe-icon {{:cssClass}}' unselectable='on'><\/span><\/script>",textAlign:t.TextAlign.Center,allowResizing:!1}),this.model.showCheckbox&&u.columns.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:18,template:"<script type='text/x-jsrender'><input type='checkbox' class='e-grid-row-checkbox'/><\/script>",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1}));this._gridObj&&this._gridtag.ejGrid(u);this._showHideContextMenu();this._renderSortbyDrpdwn();break;case"locale":this.model.locale=i[r];this._destroy();this._init();break;case"cssClass":this._changeSkin(i[r]);break;case"fileTypes":n.each(f._fileExplorer,function(n){f._fileExplorer[n]=""});this._removeOldSelectionDetails();this._refreshItems(this._selectedNode,this._currentPath);this._uploadtag.ejUploadbox("option",{extensionsAllow:this.model.fileTypes=="*.*"?"":this.model.fileTypes.replace(/\*/g,"")});break;case"selectedFolder":this._selectedFolder(this.model.selectedFolder);break;case"selectedItems":this._selectedItems=i[r];this._setSelectedItems(i[r]);break;case"allowMultiSelection":i[r]||this._setSelectedItems([]);this._gridtag.find(".e-gridheader").length&&this._gridtag.ejGrid("option",{selectionType:i[r]?"multiple":"single"});break;case"isResponsive":this.model.isResponsive=i[r];this._toolBarObj&&(this._toolBarObj.option("isResponsive",this.model.isResponsive),this.model.showToolbar?this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize());this._wireResizing();break;case"tools":case"toolsList":r=="tools"?n.extend(this.model.tools,i[r]):this.model.toolsList=i[r];this._toolBarObj&&(this._toolBarObj.destroy(),this.element.find("#"+this._ExplorerId+"_toolbar").remove(),this._updateToolbar(),this.model.showToolbar?this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize());break;case"enableResize":i[r]?i[r]&&this.model.showFooter&&(this._resizeItem=t.buildTag("div.e-icon e-fe-resize e-resize-handle"),this._resizeItem.insertBefore(this.element.find(".e-switchView")),this._resizeFileExplorer()):this._resizeItem&&this._resizeItem.remove();break;case"minHeight":this.element.css("min-height",this._getProperValue(this.model.minHeight));this._refreshResizeHandler();break;case"maxHeight":this.element.css("max-height",this._getProperValue(this.model.maxHeight));this._refreshResizeHandler();break;case"minWidth":this.element.css("min-width",this._getProperValue(this.model.minWidth));this._refreshResizeHandler();break;case"maxWidth":this.element.css("max-width",this._getProperValue(this.model.maxWidth));this._refreshResizeHandler();break;case"showCheckbox":this._changeCheckState=this.model.showCheckbox;this.model.layout=="grid"?this._renderGridView(this._fileExplorer[this._originalPath]):this._renderTileView(this._fileExplorer[this._originalPath],!0);this._setSelectedItems(this.model.selectedItems);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"contextMenuSettings":n.extend(this.model[r],i[r]);this._showHideContextMenu()}},_init:function(){this._cloneElement=this.element.clone();t.isNullOrUndefined(this.model.uploadBoxSettings)||(this.model.uploadSettings=this.model.uploadBoxSettings);t.isNullOrUndefined(this.model.showTreeview)||(this.model.showNavigationPane=this.model.showTreeview);t.isNullOrUndefined(this.model.move)||(this.model.cut=this.model.move);this._initialize();this._render();this._changeLayoutActive(this.model.layout)},_postInit:function(){this._enablePostInit=!1;this._enableRTL(this.model.enableRTL);this._wireEvents();this._wireResizing();this._setMinMaxSizeInInteger();this.model.enableResize&&this.model.showFooter&&this._resizeFileExplorer();this._isClicked=!1;this._selectedTreeFolder&&this._currentPath!=this._selectedTreeFolder&&this._selectedFolder(this._selectedTreeFolder);this._selectedNodes.length&&this._setSelectedItems(this._selectedNodes);this._isClicked=!0},_initialize:function(){this._ExplorerId=this.element[0].id;this._fileExplorer={};this._feParent={};this._updateImages={};this._selectedStates=[];this._updateOnNodeSelection=!1;this._isClicked=!0;this._toolBarObj=null;this._tileView=null;this._tileScroll=null;this._originalPath=null;this._initPath="";this._initUpdate=!1;this._scrollerSize=8;this._editingToolsState=!0;this._renderMultiTouchDialog();this._ensureResolution();this._isDevice=this._checkDevice();this.element.css({height:this._getProperValue(this.model.height),width:this._getProperValue(this.model.width),"min-width":this._getProperValue(this.model.minWidth),"max-width":this._getProperValue(this.model.maxWidth),"min-height":this._getProperValue(this.model.minHeight),"max-height":this._getProperValue(this.model.maxHeight)});this._customCssClass=this.model.cssClass;this.element.addClass(this.model.cssClass);this._isTreeNode=!1;this._selectedItems=[];this._selectedTileItems=[];this._downloadDialog=null;this._newFolderDialog=null;this._renameDialog=null;this._openDialog=null;this._detailsDialog=null;this._alertDialog=null;this._enablePostInit=!0;this._initialTime=(new Date).getTime();this._currentPath=this.model.path.replace(/\\/g,"/");this._rootPath=this._currentPath=this._currentPath.endsWith("/")?this._currentPath:this._currentPath+"/";this._gridObj=null;this._setUploadLocalization();this._restrictedToolbarOptions=[];this._restrictedMenuOption=[];this._changeCheckState=this.model.showCheckbox;this._perRow=1;this._suggestionItems=[];this._highlightedNodes="";this._prevsorting=!0},_renderMultiTouchDialog:function(){var n,i,r;this._customPop=t.buildTag("div.e-fe-popup","",{display:"none"});n=t.buildTag("div.e-content");i=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSelection&&(r=t.buildTag("span.e-rowselect e-icon"),n.append(r));this._customPop.append(n);this._customPop.append(i);this.element.append(this._customPop);this._on(this._customPop,"mousedown",this._popupClick)},_popupClick:function(){var n=this._customPop.find(".e-rowselect");n.hasClass("e-spanclicked")?this._hidePopup():n.addClass("e-spanclicked")},_hidePopup:function(){this._customPop!=null&&this._customPop.is(":visible")&&(this._customPop.find(".e-rowselect").removeClass("e-spanclicked"),this._customPop.hide())},_ensureResolution:function(){this._isMobileOrTab=n(window).width()<=750?!0:!1;this._isMobileOrTab?(this.element.addClass("e-fe-mobile"),this._toolBarObj&&this._toolBarObj._liTemplte.css("max-width",this.element.width())):(this.element.removeClass("e-fe-mobile"),this._splitObj&&this.model.showNavigationPane&&this._splitObj.element.find(".e-cont1").hasClass("collapsed")&&(this.model.enableRTL?this._splitObj.expand(1):this._splitObj.expand(0)));this._toolBarObj&&this._toolBarObj.option("cssClass",this.model.cssClass+" e-fe-toolbar "+(this._isMobileOrTab?"e-fe-mobile":""));n(window).width()<=350||this.element.width()<=350?this.element.addClass("e-fe-small"):this.element.removeClass("e-fe-small");n(window).width()<=295||this.element.width()<=295?this.element.addClass("e-fe-short"):this.element.removeClass("e-fe-short")},_showHideNavigation:function(){this._splitObj.element.find(".e-cont1").hasClass("collapsed")?this.model.enableRTL?this._splitObj.collapse(0):this._splitObj.collapse(1):this.model.enableRTL?this._splitObj.expand(0):this._splitObj.expand(1)},_renderSplitIcon:function(){this.model.showNavigationPane&&(this._splitIcon=t.buildTag("div.e-fe-split-icon"),this._splitIcon.append("<span class='e-icon e-arrow-sans-left'><\/span>"),this._splitObj.element.find(".e-splitbar").append(this._splitIcon),this._on(this._splitIcon,"touchend click",this._showHideNavigation),this._isMobileOrTab&&this._splitObj&&this.model.showNavigationPane&&(this.model.enableRTL?this._splitObj.collapse(1):this._splitObj.collapse(0)))},_checkDevice:function(){return t.isDevice()&&t.isTouchDevice()},_initContextMenuOptions:function(n){for(var i,f,u=[],r=this.model.contextMenuSettings.items[n],e=this.model.contextMenuSettings.customMenuFields,t=0;t<r.length;t++)r[t]!="|"&&(i=this._getCustomItem(e,r[t]),f=r[t+1]=="|"?"e-fe-separator":null,this._addMenuItem(i,r[t],f,u,n),i&&i.hasOwnProperty("child")&&this._getChildItems(i.child,u,n,i.id));return u},_addMenuItem:function(n,i,r,u,f,e){var o=this._extendAttr(n,"text"),s,h;this["_menu"+i]=o?o:this._getLocalizedLabels("ContextMenu"+i);s=this._extendAttr(n,"htmlAttributes",r);h=this._extendAttr(n,"spriteCssClass","e-fileexplorer-toolbar-icon "+i);u.push({id:t.isNullOrUndefined(n)?this._ExplorerId+"_"+f+"_"+i:i,text:this["_menu"+i],parentId:e,sprite:h,htmlAttr:s})},_getChildItems:function(n,i,r,u){for(var e,f=0,o=n.length;f<o&&!t.isNullOrUndefined(n[f]);f++)e=n[f],this._addMenuItem(e,n[f].id,null,i,r,u),e&&e.hasOwnProperty("child")&&this._getChildItems(e.child,i,r,e.id)},_getCustomItem:function(n,i){for(var u,r=0,f=n.length;r<f&&!t.isNullOrUndefined(n[r]);r++){if(n[r].id==i){u=n[r];break}if(n[r].hasOwnProperty("child")){u=this._getCustomItem(n[r].child,i);break}}return u},_extendAttr:function(n,t,i){return i?t=="htmlAttributes"?{"class":n?n[t]?n[t]["class"]?n[t]["class"]+" "+i:i:i:i}:n?n[t]?n[t]+" "+i:i:i:n?n[t]?n[t]:null:null},_render:function(){this._selectedTreeFolder=this.model.selectedFolder;this._selectedNodes=this.model.selectedItems;this.element.addClass("e-widget e-box").attr({role:"fileexplorer",tabindex:0});this.model.showToolbar&&this._renderToolBar();this._createSplitPane();this._read();this._roundedCorner(this.model.showRoundedCorner)},_read:function(){var i=this,u={data:{ActionType:"Read",Path:this._currentPath,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(),this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(n){if(n!==r&&n!==null){if(n.hasOwnProperty("d")&&(n=n.d),!t.isNullOrUndefined(n.error)){i._showErrorDialog(n.error);return}i._feParent[i._currentPath]=n.cwd;i._readSuccess(n.files);i._enablePostInit&&i._postInit()}},successAfter:this.model.ajaxSettings.read.success};this.model.ajaxSettings.read.success=r;n.extend(!0,u,this.model.ajaxSettings.read);this._sendAjaxRequest(u)},_sendAjaxRequest:function(i,r){var e,f,u;(!i.dataType&&this.model.ajaxDataType&&(i.dataType=this.model.ajaxDataType),this.model.ajaxAction!=""&&this._currentPath!="")&&((i.data.ActionType!="Read"&&(this._selectedItemDetails=i.data.SelectedItems),e={Name:"",ActionType:"",Path:"",ExtensionsAllow:"",LocationFrom:"",LocationTo:"",Action:"",NewName:"",Names:[],CaseSensitive:!1,SearchString:"",FileUpload:null,CommonFiles:null},r||this._waitingPopup.show(),n.extend(!0,e,i.data),f={data:e,ajaxSettings:i},u=this,this._trigger("beforeAjaxRequest",f))||(i=f.ajaxSettings,n.ajax({data:i.dataType&&i.dataType.toLowerCase()=="jsonp"||i.contentType=="application/x-www-form-urlencoded"?{json:JSON.stringify(f.data)}:JSON.stringify(f.data),url:i.url,type:i.dataType&&i.dataType.toLowerCase()=="jsonp"?"GET":i.type,async:i.async,success:function(n){u._waitingPopup.hide();i.success.call(this,n);typeof i.successAfter=="function"&&i.successAfter.apply(this,arguments)},contentType:i.contentType?i.contentType:"application/json",dataType:i.dataType,jsonpCallback:i.jsonpCallback?i.jsonpCallback:i.dataType&&i.dataType.toLowerCase()=="jsonp"?"MyCallbackFunction":"",error:i.error?i.error:function(n){u._waitingPopup.hide();var i=n.responseJSON?n.responseJSON.ExceptionType+", "+n.responseJSON.ExceptionMessage:n.statusText;u._alertDialog=u._createDialog(t.buildTag("div.e-fe-dialog-label",i),{width:400,height:"auto",title:u._getLocalizedLabels("Error")});u._alertDialogObj=u._alertDialog.data("ejDialog")},beforeSend:i.beforeSend,complete:function(){u._waitingPopup.hide();i.complete}})))},_onBeforeOpen:function(){var t,n=[],i;return t=this._nodeType=="File"?this._currentPath.replace("~","..")+this._selectedFile:this._currentPath,this._selectedFile?n=this._getSelectedItemDetails(this._currentPath,this._selectedFile):this._selectedContent&&(n=this._getSelectedItemDetails(this._getFolderPath(),this._selectedContent)),i={path:t,itemType:this._nodeType,selectedItems:n},this._trigger("beforeOpen",i)},_readSuccess:function(n){var t;if(n!==r&&n!==null){for(this._update=!1,t=0;t<n.length;t++)n[t].sizeInByte=n[t].size,n[t].size=n[t].isFile?this._bytesToSize(n[t].size):"",n[t].cssClass=this._getCssClass(n[t]);var i=this.model.gridSettings.columns[0];this._changeActiveSortedoption(i.headerText,!0);this._sorting(i.field,!0,n);this._fileExplorer[this._currentPath]=n;this._itemStatus&&this._itemStatus.html(this._sorteditems.length+" "+(this._sorteditems.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")));this._treetag.hasClass("e-treeview")||(this._renderTreeView(this._sorteditems),this._updateOnNodeSelection=!0);this.model.layout=="grid"?this._renderGridView(this._sorteditems):this._renderTileView(this._sorteditems);this._usePreviousValues()}},_getCssClass:function(n){var t=n.name.substr(n.name.lastIndexOf(".")+1).toLowerCase();return n.isFile?/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(n.name)?"e-fe-images":/\.(mp3|wav|aac|ogg|wma|aif|fla|m4a)$/i.test(n.name)?"e-fe-audio":/\.(webm|mkv|flv|vob|ogv|ogg|avi|wmv|mp4|3gp)$/i.test(n.name)?"e-fe-video":/\.(css|exe|html|js|msi|pdf|pptx|ppt|rar|zip|txt|docx|doc|xlsx|xls|xml|rtf|php)$/i.test(n.name)?"e-fe-"+t:"e-fe-unknown e-fe-"+t:n.permission&&!n.permission.Read?"e-fe-folder e-fe-lock":"e-fe-folder"},_bytesToSize:function(n){var t,i;return n==0?"0 Byte":(t=parseInt(Math.floor(Math.log(n)/Math.log(1024))),i=n/Math.pow(1024,t),i.toFixed(2)+" "+["Bytes","KB","MB","GB","TB"][t])},_setPath:function(n){this.model.path=n;this._treetag.remove();this._treetag=t.buildTag("div#"+this._ExplorerId+"_treeView");this._splittag.find(".e-cont1 > .e-tree-wrapper").append(this._treetag);this._fileExplorer=this._updateImages={};this._selectedStates=[];this._selectedItems=[];this._selectedTileItems=[];this._initUpdate=!1;this._initPath="";this._currentPath=this.model.path.replace(/\\/g,"/");this._originalPath=this._rootPath=this._currentPath=this._currentPath.endsWith("/")?this._currentPath:this._currentPath+"/";this._read()},_getPath:function(){return this.model.path},_changeSkin:function(n){this.element.removeClass(this._customCssClass).addClass(n);this._customCssClass=n;this._waitingPopup.option("cssClass",n);this._subControlsSetModel("cssClass",n)},_draggableOption:function(n){this._treeDragEvents(n);this._tileDragEvents(n);this._gridDragEvents(n);n=="_off"&&(this._previousPath=null);this._statusbar&&this[n](this._statusbar,"dragover",this._preventDropOption);this._toolBarItems&&this[n](this._toolBarItems,"dragover",this._preventDropOption)},_swapWith:function(t,i){t=n(t);i=n(i);var r=n("<span>").hide();t.before(r);i.before(t);r.replaceWith(i)},_enableRTL:function(n){var r=this._splittag.find(".e-cont1"),u=this._splittag.find(".e-cont2"),i,t;if(this.model.enableRTL=n,n){for(r.index()<u.index()&&this._swapWith(r,u),i=JSON.parse(JSON.stringify(this.model.gridSettings.columns)),this._oldFormat||(this._oldFormat=JSON.parse(JSON.stringify(i))),t=0;t<i.length;t++)i[t].textAlign=i[t].headerTextAlign="right";this._gridObj&&this._gridObj.columns(i);this.element.addClass("e-rtl");this.element.find(".e-scroller").addClass("e-rtl")}else{if(r.index()>u.index()&&this._swapWith(u,r),this._gridObj&&this._oldFormat){for(t=0;t<this._oldFormat.length;t++)this._oldFormat[t].textAlign||(this._oldFormat[t].textAlign="left"),this._oldFormat[t].headerTextAlign||(this._oldFormat[t].headerTextAlign="left");this._gridObj.columns(this._oldFormat)}this._oldFormat&&(this.model.gridSettings.columns=JSON.parse(JSON.stringify(this._oldFormat)),this._oldFormat=null);this.element.removeClass("e-rtl");this.element.find(".e-scroller").removeClass("e-rtl");this._gridtag&&this._gridtag.removeClass("e-rtl")}this._splitterCorrection();this._subControlsSetModel("enableRTL",n)},_roundedCorner:function(n){var t=n?"addClass":"removeClass";this.element[t]("e-corner-all");this._treeContextMenutag&&this._treeContextMenutag[t]("e-corner");this._tileContextMenutag&&this._tileContextMenutag[t]("e-corner");this._subControlsSetModel("showRoundedCorner",n)},_destroy:function(){this._toolBarObj&&this._toolBarObj.destroy();this._treeContextMenutag&&this._treeContextMenutag.parent().remove();this._tileContextMenutag&&this._tileContextMenutag.parent().remove();this._newFolderDialogObj&&this._newFolderDialogObj.isOpen()&&this._removeDialog(this._newFolderDialogObj);this._renameDialogObj&&this._renameDialogObj.isOpen()&&this._removeDialog(this._renameDialogObj);this._openDialogObj&&this._openDialogObj.isOpen()&&this._removeDialog(this._openDialogObj);this._detailsDialogObj&&this._detailsDialogObj.isOpen()&&this._removeDialog(this._detailsDialogObj);this._alertDialogObj&&this._alertDialogObj.isOpen()&&this._removeDialog(this._alertDialogObj);this._alertWindowObj&&this._alertWindowObj.isOpen()&&this._removeDialog(this._alertWindowObj);this._splitButtonObj&&this._splitButtonObj.destroy();this._splitButtonObj1&&this._splitButtonObj1.destroy();this._waitingPopup&&this._waitingPopup.destroy();this._gridObj&&this._gridObj.element.ejWaitingPopup("destroy");this._unwireEvents();this.element.html("");n(this._cloneElement).attr("style")?this.element.attr("style",n(this._cloneElement).attr("style")):this.element.removeAttr("style");this.element.removeClass("e-widget e-box e-rtl");this.element.removeAttr("role");delete this._prevsortingoption;this._prevsorting},_createFolder:function(i){var u=this,f={data:{ActionType:"CreateFolder",Name:i,Path:this._originalPath,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(this._originalPath),this._treeObj.getText(this._selectedNode))},url:this.model.ajaxAction,type:"POST",success:function(n){var i,e,f,o;if(n!==r&&n!==null){if(n.hasOwnProperty("d")&&(n=n.d),!t.isNullOrUndefined(n.error)){u._showErrorDialog(n.error);return}i=u._selectedNode;e=[{id:n.files[0].name,name:n.files[0].name,spriteCssClass:n.files[0].permission&&!n.files[0].permission.Read?"e-fe-icon e-fe-folder e-fe-lock":"e-fe-icon e-fe-folder",hasChild:!1}];u._treetag.ejTreeView("isExpanded",i)||u._treeObj&&u._treeObj.expandNode(i);u._nodeExpanded=!0;u._treeObj.addNode(e,i);u._nodeExpanded=!1;u._update=!0;u._treeObj.selectNode(i);u._refreshTreeScroller();u._treetag.find("li").removeAttr("tabindex");f=u._treetag.find("li div a").not(".e-js");u.model.allowDragAndDrop&&f.length&&(u._drag(f),f.addClass("e-file-draggable"));o={data:n,selectedItems:u._selectedItemDetails};u._trigger("createFolder",o);u._setSelectedItems([n.files[0].name])}},successAfter:this.model.ajaxSettings.createFolder.success};this.model.ajaxSettings.createFolder.success=r;n.extend(!0,f,this.model.ajaxSettings.createFolder);this._sendAjaxRequest(f)},_needToScroll:function(n,i){var f,e=i=="Tree"?n.find("a").eq(0).outerHeight():n.outerHeight()+(this.model.layout=="grid"?0:10),r=0,u;if(r+=n.position().top+e,i=="Tree"){while(n.parent().hasClass("e-treeview-ul"))n=n.parent(),r+=n.position().top;f=this._splittag.find(".e-cont1").height()}else this.model.layout==t.FileExplorer.layoutType.Grid?(f=this._gridtag.find(".e-gridcontent").height(),r=r-this._gridtag.find(".e-gridheader").outerHeight()):f=this._tileViewWrapper.height();u=n.closest(".e-scroller .e-content",".e-fileexplorer");f<r?u.animate({scrollTop:u.scrollTop()+e*2},500,"linear"):r<n.outerHeight()&&u.animate({scrollTop:u.scrollTop()-e*2},500,"linear")},_cut_copy:function(n){var i=this,f,r,e,u,o;if(this._sourcePath==this._currentPath&&this._option=="move"){this.element.find(".e-blur").removeClass("e-blur");this.model.layout!="grid"&&this._clearTileCheckBoxSelection();this._setSelectedItems(this._fileName);n&&(this._activeSource=this.model.selectedItems);return}for(f=this._fileExplorer[this._currentPath],r=typeof this._copiedNodes=="string"?[this._copiedNodes]:this._copiedNodes,this._pastedFiles=r.slice(),e=0;e<r.length;e++)if(!this._isNameExist(this._suggestionItems.length?this._suggestionItems:this._fileExplorer[this._sourcePath],r[e]))return;u=i._currentPath;o=function(){if(i._currentPath=u,t.isNullOrUndefined(f)&&(f=i._fileExplorer[u]),i._existingItems=[],i._sourcePath!=u&&f.length)i._getDuplicateItems(i._sourcePath,u,typeof i._fileName=="string"?[i._fileName]:i._fileName),i._existingItems.length?i._createReplaceConformationDiaolg("_pasteOperation","ReplaceAlert"):i._pasteOperation();else{for(var n=0;n<r.length;n++)i._pastedFiles[n]=i._getDuplicateName(i._fileExplorer[u],r[n]);i._pasteOperation()}};t.isNullOrUndefined(f)?this._getFileDetails(this._currentPath,"","",o):o()},_createReplaceConformationDiaolg:function(i,r){var u=this,f=0,v=String.format(this._getLocalizedLabels(r),this._existingItems[f].Path),o=t.buildTag("div.e-get-name"),y=t.buildTag("div.e-fe-dialog-label",v),s=t.buildTag("div.e-fe-dialog-btn e-replace"),e=t.buildTag("button.e-fe-btn-yes ",this._getLocalizedLabels("YesButton")),h=t.buildTag("button.e-fe-btn-yes e-all ",this._getLocalizedLabels("YesToAllButton")),c=t.buildTag("button.e-fe-btn-no ",this._getLocalizedLabels("NoButton")),l=t.buildTag("button.e-fe-btn-no e-all ",this._getLocalizedLabels("NoToAllButton")),a;e.ejButton({type:"button",cssClass:"e-flat",click:function(){/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(u._existingItems[f].Name)&&(u._updateImages[u._existingItems[f].Path]=(new Date).getTime());u._existingItems[f].IsReplace=!0;f++;f<u._existingItems.length?u._alertDialog.find(".e-fe-dialog-label").text(String.format(u._getLocalizedLabels(r),u._existingItems[f].Path)):u._destroyReplaceConformationDiaolg(i)}});c.ejButton({type:"button",cssClass:"e-flat",click:function(){u._existingItems[f].IsReplace=!1;f++;f<u._existingItems.length?u._alertDialog.find(".e-fe-dialog-label").text(String.format(u._getLocalizedLabels(r),u._existingItems[f].Path)):u._destroyReplaceConformationDiaolg(i)}});h.ejButton({type:"button",cssClass:"e-flat",click:function(){for(var n=f;n<u._existingItems.length;n++)/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(u._existingItems[n].Name)&&(u._updateImages[u._existingItems[n].Path]=(new Date).getTime()),u._existingItems[n].IsReplace=!0;u._destroyReplaceConformationDiaolg(i)}});l.ejButton({cssClass:"e-flat",type:"button",click:function(){for(var n=f;n<u._existingItems.length;n++)u._existingItems[n].IsReplace=!1;u._destroyReplaceConformationDiaolg(i)}});s.append(e,h,c,l);n(o).append(y,s);a=function(){e.focus()};this._alertDialog=this._createDialog(o,{width:500,height:"auto",title:this._getLocalizedLabels("Error"),open:a});this._alertDialogObj=this._alertDialog.data("ejDialog")},_destroyReplaceConformationDiaolg:function(n){this._removeDialog(this._alertDialogObj);this[n]()},_pasteOperation:function(){var i,u,r,o,e,c;for(this._removeBlurEffect(),i=this,u=-1,typeof this._fileName=="string"&&(this._fileName=[this._fileName]),r=0;r<this._fileName.length;r++)if(o=this._sourcePath+this._fileName[r]+"/",this._currentPath.indexOf(o)>=0){u=r;break}if(u!=-1){var l=this._getLocalizedLabels("CancelPasteAction"),s=t.buildTag("div"),a=t.buildTag("div.e-fe-dialog-label",l),h=t.buildTag("div.e-fe-dialog-centerbtn"),f=t.buildTag("button.e-fe-btn-cancel ",this._getLocalizedLabels("CancelButton"));f.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});e=t.buildTag("button.e-fe-btn-skip ",this._getLocalizedLabels("SkipButton"));e.ejButton({cssClass:"e-flat",type:"button",click:function(){i._fileName.splice(u,1);i._removeDialog(i._alertDialogObj);i._performPasteOperation()}});h.append(e,f);n(s).append(a,h);c=function(){f.focus()};this._alertDialog=this._createDialog(s,{width:400,height:"auto",title:this._getLocalizedLabels("Error"),open:c});this._alertDialogObj=this._alertDialog.data("ejDialog")}else this._performPasteOperation()},_performPasteOperation:function(){var i=this,u=this._currentPath.split("/"),f={data:{ActionType:"Paste",LocationFrom:this._sourcePath,LocationTo:this._currentPath,Names:typeof this._fileName=="string"?[this._fileName]:this._fileName,Action:this._option,CommonFiles:this._existingItems,SelectedItems:this._getSelectedItemDetails(this._sourcePath,this._fileName),TargetFolder:this._getSelectedItemDetails(this._getFolderPath(),u[u.length-2])},url:this.model.ajaxAction,type:"POST",success:function(r){var o,s,f,e,h,c;if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){i._showErrorDialog(r.error);return}for(typeof i._fileName=="string"&&(i._fileName=[i._fileName]),f=0;f<i._pastedFiles.length;f++)/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(i._pastedFiles[f])&&(i._updateImages[i._currentPath+i._pastedFiles[f]]=(new Date).getTime());if(i._existingItems&&i._existingItems.filter(function(t){if(t.IsReplace==!1){var r=n.inArray(t.Name,i._pastedFiles);r>-1&&i._pastedFiles.splice(r,1)}}),i._existingItems=[],o=i._originalPath,s=i._selectedNode,i._option=="move"){for(f=0;f<i._fileName.length;f++)i._modifySelectedStates(i._sourcePath+i._fileName[f],"");if(i._fileName.length>0)if(i._fileName.length==1)i._sourceType=="Directory"&&i._treeObj.removeNode(i._refreshNode);else for(u=i._refreshNode.siblings(),i._sourceType=="Directory"&&i._treeObj.removeNode(i._refreshNode),f=0;f<i._fileName.length;f++)for(e=0;e<u.length;e++)i._fileName[f]==n(u[e]).text()&&i._treeObj.removeNode(u[e])}n.each(i._fileExplorer,function(n){n.startsWith(o)&&(i._fileExplorer[n]="")});i._currentPath=i._originalPath;i._highlightedNodes=i._pastedFiles;i._option=="move"?i._refreshItems(s,o,function(){i._fileExplorer[i._sourcePath]="";i._getFileDetails(i._sourcePath)}):i._refreshItems(s,o);h=i._getFolderPath();i._option=="move"&&(i._fileName="",i._option=null,i._toolBarItems&&i._toolBarItems.ejToolbar("disableItemByID",i._ExplorerId+"Paste"),i.model.showContextMenu&&(i._viewMenuObj.disableItem(i._menuPaste),i._treeMenuObj.disableItem(i._menuPaste)));c={name:i._fileName,targetPath:i.model.path,selectedItems:i._selectedItemDetails,targetFolder:i._getSelectedItemDetails(h,i._selectedContent)};i._trigger("paste",c)},successAfter:this.model.ajaxSettings.paste.success};this.model.ajaxSettings.paste.success=r;n.extend(!0,f,this.model.ajaxSettings.paste);this._sendAjaxRequest(f)},_deletion:function(i,u){var f=this,o=this._treeObj.getSelectedNode(),e;this._treeObj.isExpanded(o)||this._treeObj&&this._treeObj.expandNode(o);e={data:{ActionType:"Remove",Names:typeof i=="string"?[i]:i,Path:u,SelectedItems:this._getSelectedItemDetails(u,i)},traditional:!0,url:this.model.ajaxAction,type:"POST",success:function(r){var o,s,h;if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){f._showErrorDialog(r.error);return}for(f._selectedItemsTag&&f._selectedItemsTag.html(""),f._fileExplorer[f._ajax_folderPath]="",n.each(f._fileExplorer,function(n){n.startsWith(f._ajax_folderPath)&&(f._fileExplorer[n]="")}),o=0;o<e.data.SelectedItems.length;o++)e.data.SelectedItems[o].isFile==!1&&f._modifySelectedStates(u+e.data.SelectedItems[o].name,"");f._currentPath=f._ajax_folderPath;s=f._selectedContent==f._selectedTreeText?f._parentNode:f._selectedNode;f._refreshItems(s,f._ajax_folderPath);f._treeObj.getSelectedNode().length==0?f._treeObj.selectNode(f._parentNode):f.model.layout=="grid"?f._gridtag.find(".e-gridcontent").click():f._tileViewWrapper.click();h={data:r,path:f._ajax_folderPath,name:i,selectedItems:f._selectedItemDetails};f._trigger("remove",h)},successAfter:this.model.ajaxSettings.remove.success};this.model.ajaxSettings.remove.success=r;n.extend(!0,e,this.model.ajaxSettings.remove);this._sendAjaxRequest(e)},_rename:function(){var i=this,u={data:{ActionType:"Rename",Path:i._currentPath,Name:i._selectedContent,NewName:i._ajax_person,CommonFiles:i._existingItems,SelectedItems:this._getSelectedItemDetails(i._currentPath,this._selectedContent)},url:this.model.ajaxAction,type:"POST",success:function(r){if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){i._showErrorDialog(r.error);return}i._existingItems=[];i._fileExplorer[i._currentPath]="";i._nodeType!="File"&&i._modifySelectedStates(i._currentPath+i._selectedContent,i._currentPath+i._ajax_person);i._splittag.find(".e-cont2 .e-active").length<=0?(n.each(i._fileExplorer,function(n){n.startsWith(i._currentPath+i._selectedContent+"/")&&(i._fileExplorer[n]="")}),i._selectedNode.find("> div > .e-text")[0].lastChild.nodeValue=i._selectedContent=i._ajax_person,i._originalPath=i._currentPath+=i._ajax_person+"/",i._updateAddressBar()):(i.model.selectedItems.length>0?(i.model.selectedItems[i.model.selectedItems.length-1]=i._getOriginalName(i._ajax_person),i._selectedItems[0]=i._ajax_person,i._highlightedNodes=i.model.selectedItems,i._refreshItems(i._selectedNode,i._currentPath)):i._refreshItems(i._parentNode,i._currentPath),i._treeObj.getSelectedNode().length==0&&n(i._parentNode).find("li a").each(function(){if(n(this).text()==i._ajax_person)return i._treeObj.selectNode(n(this).closest("li.e-item")),!1}))},successAfter:this.model.ajaxSettings.rename.success};this.model.ajaxSettings.rename.success=r;n.extend(!0,u,this.model.ajaxSettings.rename);this._sendAjaxRequest(u)},_downloadFile:function(){var t=this._getSelectedItemDetails(this._currentPath,this._selectedItems),i={Path:this._currentPath,ActionType:"Download",SelectedItems:JSON.stringify(t),Names:this._selectedItems},r=this.model.ajaxAction+"?"+n.param(i,!0),u;if(this.model.ajaxSettings.download.url&&(r=this.model.ajaxSettings.download.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.download.url,"?"+n.param(i,!0)):this.model.ajaxSettings.download.url),u={path:this._currentPath,files:this._selectedItems,selectedItems:t},this._trigger("beforeDownload",u))return!1;window.location=r},_removeBlurEffect:function(){this._currntNode&&(this._currntNode.hasClass("e-active")&&this._currntNode.removeClass("e-blur"),this._currntNode.find(".e-active").length&&this._currntNode.find(".e-active").removeClass("e-blur"))},_renderTreeView:function(t){var e=t.length>0?!0:!1,i,r,u,f;for(this._collapse=!1,i=this,r=this._currentPath.split("/"),u=0;u<r.length-2;u++)this._initPath+=r[u]+"/";f=r[r.length-2];this._localData=[{id:1,name:f,spriteCssClass:this._hasReadPermission(this._currentPath)?"e-fe-icon e-fe-folder":"e-fe-icon e-fe-folder e-fe-lock",hasChild:e}];this._treetag._collapse=!1;this._treetag.ejTreeView({loadOnDemand:!0,cssClass:i.model.cssClass,enableRTL:i.model.enableRTL,allowKeyboardNavigation:i.model.allowKeyboardNavigation,fields:{dataSource:i._localData,id:"id",parentId:"pid",text:"name",hasChild:"hasChild",spriteCssClass:"spriteCssClass"},nodeCollapse:function(n){i._refreshTreeScroller(n)},nodeExpand:function(n){i._refreshTreeScroller(n)},nodeClick:function(n){i._treenodeClicked(n)},beforeExpand:function(n){i._treeNodeBeforeExpand(n)},nodeSelect:function(n){i._updateTreePath(n)},beforeCollapse:function(n){i._onBeforeCollapse(n)},beforeDelete:function(n){i._treeBeforeDelete(n)}});this._treeObj=this._treetag.data("ejTreeView");this._treeViewEvents("_off");this._treeViewEvents("_on");this._isClicked=!1;this._treetag.ejTreeView("selectNode",n(this._treetag).find("li")[0]);this._isClicked=!0;this._treeScroll=this._treetag.parent(".e-tree-wrapper").ejScroller({height:this._splittag.height(),width:parseInt(this._splittag.find(".e-cont1").width()),buttonSize:0,scrollerSize:this._scrollerSize,thumbStart:function(n){i._onThumbStart(n)}}).data("ejScroller");this._addChild(t)},_treeViewEvents:function(n){this[n](this._treetag,"focus",this._focusTreeView);this[n](this._treetag,"blur",this._blurTreeView);this.model.allowDragAndDrop&&this._treeDragEvents(n)},_treeDragEvents:function(n){var t=this._treetag.parent(".e-tree-wrapper");t&&(this[n](t,"dragover",this._onDragOverHandler),this[n](t,"drop",this._onDropHandler),this[n](t,"dragleave",this._onDragLeave))},_focusTreeView:function(){this._treetag.hasClass("e-focus")||(this._treetag.addClass("e-focus"),this._itemList=[],this._on(this._treetag,"keydown",this._OnKeyUp),this._hidePopup())},_blurTreeView:function(){this._treetag.removeClass("e-focus");this._off(this._treetag,"keydown",this._OnKeyUp)},_treeBeforeDelete:function(n){if(!t.isNullOrUndefined(n.event)){var i=this._getKeyCode(n.event);i==46&&(n.cancel=!0)}},_treeNodeBeforeExpand:function(n){if(!this._nodeExpanded){var t=this._updatePath(n.currentElement,n.value);this._fileExplorer[t]||this._getFileDetails(t,n.currentElement);this._treetag.ejTreeView("hasChildNode",n.currentElement)||this._fileExplorer[t]&&this._addChild(this._fileExplorer[t],n.currentElement)}},_treenodeClicked:function(t){if(t.event.currentTarget&&t.event.currentTarget.focus(),n(t.currentElement).hasClass("e-text")&&t.currentElement!=this._selectedNode.find("> div > .e-text")[0]){this._selectedContent=t.currentElement.text;this._selectedNode=n(t.currentElement).closest("li.e-item");var i=n(this._selectedNode.parents("li.e-item")[0]);this._parentNode=i.length!=0?i:this._selectedNode;this._nodeType="Directory";this._isTreeNode=!0}},_showHideContextMenu:function(){if(this.model.showContextMenu){var i={beforeOpen:"",click:""},r={id:"",targetId:""};this._treeMenuOptions=this._initContextMenuOptions("navbar");r.id=this._ExplorerId+"_treeView";r.targetId="#"+this._ExplorerId+"_treeView";i.beforeOpen=n.proxy(this._beforeOpenContextMenu,this);i.open=n.proxy(this._contextMenuOpen,this);i.close=n.proxy(this._onHideContextMenu,this);i.click=n.proxy(this._contextMenuClick,this);this._treeContextMenutag=this._createContextMenuTag(this._treeMenuOptions,r,i);this._treeMenuObj=this._treeContextMenutag.ejMenu("instance");this._cwdMenuOptions=this._initContextMenuOptions("cwd");this._addSortbyoptions();r.id=this._ExplorerId+"_tileView";r.targetId="#"+this._ExplorerId+"_tileWrapper,#"+this._ExplorerId+"_grid";i.beforeOpen=n.proxy(this._beforeOpenTileContextMenu,this);i.open=n.proxy(this._contextMenuOpen,this);i.click=n.proxy(this._fileContextMenuClick,this);this._tileContextMenutag=this._createContextMenuTag(this._cwdMenuOptions,r,i);this._viewMenuObj=this._tileContextMenutag.ejMenu("instance");(t.isNullOrUndefined(this._fileName)||this._fileName=="")&&this._treeMenuObj.disableItem(this._menuPaste);this._fileMenuOptions=this._initContextMenuOptions("files")}else this._treeContextMenutag&&this._tileContextMenutag&&(this._treeMenuObj.destroy(),this._viewMenuObj.destroy(),n("#"+this._ExplorerId+"_treeViewContextMenu").remove(),n("#"+this._ExplorerId+"_tileViewContextMenu").remove(),this._viewMenuObj=this._treeMenuObj=null)},_addSortbyoptions:function(){var r=this.model.contextMenuSettings.items.cwd.length,i=this.model.contextMenuSettings.items.cwd,n,t;if(i.indexOf("SortBy")>-1)for(n=this.model.gridSettings.columns.length,j=0;j<n;j++)t="e-fileexplorer-toolbar-icon "+this.model.gridSettings.columns[j].field,this._cwdMenuOptions.push({id:this._ExplorerId+"_cwd_"+this.model.gridSettings.columns[j].field,text:this.model.gridSettings.columns[j].headerText,parentId:this._ExplorerId+"_cwd_SortBy",sprite:t})},enableMenuItem:function(n){n=this._findCommand(n,this.model.contextMenuSettings.items,!0);for(var t=0;t<this._restrictedMenuOption.length;t++)if(this._restrictedMenuOption[t]==n){this._restrictedMenuOption.splice(t,1);break}this._treeMenuObj&&this._treeMenuObj.enableItem(n);this._viewMenuObj&&this._viewMenuObj.enableItem(n)},disableMenuItem:function(t){t=this._findCommand(t,this.model.contextMenuSettings.items,!0);n.inArray(t,this._restrictedMenuOption)==-1&&this._restrictedMenuOption.push(t);this._treeMenuObj&&this._treeMenuObj.disableItem(t);this._viewMenuObj&&this._viewMenuObj.disableItem(t)},_renderGridView:function(i){for(var r,f,s,o,u=JSON.parse(JSON.stringify(this.model.gridSettings.columns)),h=null,e=0;e<u.length;e++)u[e].template||(u[e].template="<script type='text/x-jsrender'><span title= '{{:"+u[e].field+"}}'>{{:"+u[e].field+"}}<\/span><\/script>");this._suggestionItems.length&&u.push({field:"filterPath",headerText:"Folder",width:"20%"});u.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"<script type='text/x-jsrender'><span class='e-fe-icon {{:cssClass}}' unselectable='on'><\/span><\/script>",textAlign:t.TextAlign.Center,allowResizing:!1});this.model.showCheckbox&&u.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:22,template:"<script type='text/x-jsrender'><input type='checkbox' class='e-grid-row-checkbox'/><\/script>",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1});r=this;f=u[u.length-1];f&&(f.customAttributes?f.customAttributes["class"]?f.customAttributes["class"].search("e-rowcell e-last-rowcell")==-1&&(f.customAttributes["class"]=f.customAttributes["class"]+" e-rowcell e-last-rowcell"):f.customAttributes["class"]=" e-rowcell e-last-rowcell":f.customAttributes={"class":"e-rowcell e-last-rowcell"});this._gridObj?(u.length!=this._gridObj.model.columns.length&&(this._gridObj.model.columns=u,this._gridObj.columns(this._gridObj.model.columns)),h=JSON.parse(JSON.stringify(this._gridObj.model.sortSettings)),this._gridObj.option("dataSource",i),this._gridObj.option("enableRTL",this.model.enableRTL),this._gridObj.option("sortSettings",h)):this._gridtag.ejGrid({cssClass:r.model.cssClass,enableRTL:r.model.enableRTL,allowKeyboardNavigation:this.model.allowKeyboardNavigation,dataSource:i,selectionType:r.model.allowMultiSelection?"multiple":"single",allowSorting:r.model.gridSettings.allowSorting,columns:u,isResponsive:!0,scrollSettings:{width:186,height:200,buttonSize:0,scrollerSize:r._scrollerSize},allowScrolling:!0,enableResponsiveRow:!1,rowSelected:function(n){r._updatePathFromGrid(n)},recordDoubleClick:function(n){r._openAction(n)},templateRefresh:function(n){r._templateRefresh(n)},create:this.model.showCheckbox?function(n){r._gridCheckboxState(n)}:null,actionBegin:function(n){r._gridActionBegin(n)},actionComplete:function(n){r._gridActionComplete(n)},allowResizing:r.model.gridSettings.allowResizing});i.length&&i[0].filterPath&&this._setFilteredContent();this._gridObj=this._gridtag.ejGrid("instance");s=this._getFilePermission(this._currentPath);s&&!s.Read?this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("ProtectedFolder")).addClass("e-fe-center"):this._gridObj.model.dataSource.length==0&&this._searchbar&&n.trim(this._searchbar.val())?this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("EmptyResult")).addClass("e-fe-center"):this._gridObj.model.dataSource.length==0&&this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("EmptyFolder")).addClass("e-fe-center");this.gridItems=this._gridObj.getRows();this.model.allowDragAndDrop&&(this._gridtag.children(".e-gridcontent").addClass("e-droppable"),this._drag(n(this.gridItems)),n(this.gridItems).addClass("e-file-draggable"));this._reSizeHandler();o=this._gridObj.getScrollObject();o&&(o.isVScroll()||o.isVScroll())&&o.element.ejScroller({thumbStart:function(n){r._onThumbStart(n)}});this._gridtag.attr("tabindex",-1);this._gridViewEvents("_off");this._gridViewEvents("_on");this._gridupdate(this._prevsortingoption)},_setFilteredContent:function(){for(var t,r=this._gridtag.find(".e-gridcontent tr"),i=0;i<r.length;i++)t=n(r[i]).find("td:last"),n(r[i]).attr("data-parent-path",t.text()),t.attr("title",t.text()),t.text("/"+t.text().replace(this._rootPath,""))},_templateRefresh:function(n){this._trigger("templateRefresh",n)},_gridActionBegin:function(n){if(n.requestType=="sorting"){n.cancel=!0;this._suggestionItems.length&&this._setFilteredContent();var t=this.model.gridSettings.columns.length;for(i=0;i<t;i++)if(n.columnName==this.model.gridSettings.columns[i].field){this._changeActiveSortedoption(this.model.gridSettings.columns[i].headerText);this._sorting(this._prevsortingoption,this._prevsorting);this._sortingActioncomplete();break}}},_gridActionComplete:function(n){this.model.showCheckbox&&this._gridCheckboxState(n);!t.isNullOrUndefined(this._gridObj)&&this.model.gridSettings.allowSorting&&this._gridupdate(this._prevsortingoption)},_gridCheckboxState:function(){var n=this;this._gridtag.find(".e-headercelldiv:first").html(" <input type='checkbox' id='headchk' />").addClass("e-col-check");this._headCheckObj=this._gridtag.find("#headchk").ejCheckBox({showRoundedCorner:n.model.showRoundedCorner,change:function(t){n._headCheckChange(t)}}).data("ejCheckBox");this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({showRoundedCorner:n.model.showRoundedCorner});this._gridtag.find(".e-chkbox-wrap").removeAttr("tabindex")},_checkChange:function(t){var i,e;if(t.isInteraction||t.isInteraction==r){var o=this._gridtag.find(".e-grid-row-checkbox"),f=this._gridtag.find(" .e-gridcontent .e-checkbox:checked"),u=[];for(i=0;i<f.length;i++)u.push(n(f[i]).closest("tr").index());for(t&&!t.type&&(e=n.inArray(t.index(),u),t.find(".e-chk-act").length==1?u.splice(e,1):u.push(t.index())),this._changeCheckState=!1,this._gridObj.clearSelection(),u.length==o.length?this._gridtag.find("#headchk").ejCheckBox({checked:!0}):this._gridtag.find("#headchk").ejCheckBox({checked:!1}),this._isClicked=!1,i=0;i<u.length;i++)!0&&(this._gridObj.multiSelectCtrlRequest=!0,this._gridObj.selectRows(u[i]));this._isClicked=!0;this.model.checked==!1&&this._gridtag.find("#headchk").ejCheckBox({checked:!1});this._changeCheckState=!0}},_recordClick:function(){for(var r,i=this._gridtag.find(".e-grid-row-checkbox"),t=0;t<i.length;t++)n.inArray(t,this._gridObj.selectedRowsIndexes)<0?(n(i[t]).ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1}),this._gridObj.multiSelectCtrlRequest||this._unselectEvent()):(n(i[t]).ejCheckBox({checked:!0}),r=this._gridtag.find(".e-grid-row-checkbox:checked"),r.length==i.length&&this._gridtag.find("#headchk").ejCheckBox({checked:!0}))},_headCheckChange:function(n){if(n.isInteraction){var i=this,t=this._gridtag.find(".e-grid-row-checkbox");t.ejCheckBox({change:function(n){i._checkChange(n)}});this._gridtag.find("#headchk").is(":checked")?(t.ejCheckBox({checked:!0}),this._gridObj.selectRows(0,t.length)):(t.ejCheckBox({checked:!1}),this._setSelectedItems([]),this._unselectEvent())}},_unselectEvent:function(){var t=this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName),i,e,u,f;if((this._filteredItemsName=[],!this._gridObj||!this._gridObj.multiSelectCtrlRequest)&&t.length>0){for(this._unselectedItems=[],i=0;i<t.length;i++)name=t[i].name,this._unselectedItems.push(name);e=n.inArray(r,this.model.selectedItems);n.each(this._fileExplorer[this._originalPath],function(n,t){u=t.isFile?"File":"Directory"});f={name:this._unselectedItems[this._unselectedItems.length-1],names:this._unselectedItems,path:this.model.selectedFolder,nodeType:u,unselectedItem:t[t.length-1],unselectedItems:t};this._trigger("unselect",f)}},_gridViewEvents:function(n){this[n](this._gridtag.find(".e-gridcontent"),"focusin",this._focusGridView);this[n](this._gridtag.find(".e-gridcontent"),"focusout",this._blurGridView);this.model.allowDragAndDrop&&this._gridDragEvents(n)},_gridDragEvents:function(n){var t=this._gridtag.children(".e-gridcontent");t&&(this[n](t,"dragover",this._onDragOverHandler),this[n](t,"drop",this._onDropHandler),this[n](t,"dragleave",this._onDragLeave),this[n](this._gridtag.find(".e-gridheader"),"dragover",this._preventDropOption))},_focusGridView:function(){this._gridtag.find(".e-gridcontent").hasClass("e-focus")||(this._gridtag.find(".e-gridcontent").addClass("e-focus"),this._itemList=[],this._on(this._gridtag.find(".e-gridcontent"),"keydown",this._OnKeyUp),this._hidePopup())},_blurGridView:function(){this._gridtag.find(".e-gridcontent").removeClass("e-focus");this._off(this._gridtag.find(".e-gridcontent"),"keydown",this._OnKeyUp)},_setThumbImageHeight:function(){var i=this._perRow=1,t,f,r,u;if(this.items){for(t=0;t<this.items.length-1;t++)if(this.items[t].getBoundingClientRect().top==this.items[t+1].getBoundingClientRect().top)i++;else break;if(!(i==null||i<2))for(t=0,f=this.items.length;t<f;t+=i)r=0,u=this.items.slice(t,t+i),u.each(function(){var t=parseInt(n(this).find(".e-thumb-image").outerHeight());t>r&&(r=t)}),u.find(".e-thumb-image.e-image").css("height",r);this._tileScroll&&this._tileScroll.refresh()}this._perRow=i},_renderTileView:function(i,r){var h,c,l,o,a,s,e;this._tileView.children()&&this._tileView.children().remove()&&this._tileView.removeClass("e-tileview");this._tileView.appendTo(this._tileContent);this._tileView.addClass("e-tileview").attr("role","tileview");h=this._getFilePermission(this._currentPath);h&&!h.Read?this._tileView.html(this._getLocalizedLabels("ProtectedFolder")).addClass("e-fe-center"):this._searchbar&&n.trim(this._searchbar.val())&&i.length==0?this._tileView.html(this._getLocalizedLabels("EmptyResult")).addClass("e-fe-center"):i.length==0?this._tileView.html(this._getLocalizedLabels("EmptyFolder")).addClass("e-fe-center"):this._tileView.html("").removeClass("e-fe-center");var u=this,v=r,f=null;if(n.each(i,function(i,r){var e,s,c,o,l,a,p,w;e=r.filterPath?n("<li class='e-tilenode' data-parent-path='"+r.filterPath+"'><\/li>"):n("<li class='e-tilenode'><\/li>");s=n("<div class='e-align'><div class='e-thumb-image e-image ' unselectable='on'><\/div><\/div>");r.isFile?(s.appendTo(e),c=r.name.substr(r.name.lastIndexOf(".")+1).toLowerCase(),/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(r.name)?u.model.showThumbnail?(o=r.filterPath?r.filterPath.replace("~","..")+r.name:v?u._originalPath.replace("~","..")+r.name:u._currentPath.replace("~","..")+r.name,l=u._getImage(o,r.name,u.model.enableThumbnailCompress),f=t.buildTag("img.e-thumbImage","","",{src:l?l:o+"?"+(u._updateImages[o]?u._updateImages[o]:u._initialTime),unselectable:"on"})):f=n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-images"):f=/\.(mp3|wav|aac|ogg|wma|aif|fla|m4a)$/i.test(r.name)?n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-audio"):/\.(webm|mkv|flv|vob|ogv|ogg|avi|wmv|mp4|3gp)$/i.test(r.name)?n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-video"):/\.(css|exe|html|js|msi|pdf|pptx|ppt|rar|zip|txt|docx|doc|xlsx|xls|xml|rtf|php)$/i.test(r.name)?n("<span class='e-thumbImage e-fe-icon' unselectable='on'><\/span>").addClass("e-fe-"+c):n("<span class='e-thumbImage e-fe-icon e-fe-unknown' unselectable='on'><\/span>").addClass("e-fe-"+c)):(s.appendTo(e),e.addClass("e-folder"),f=n("<span class='e-thumbImage e-fe-icon e-fe-folder' unselectable='on'><\/span>"),r.permission&&!r.permission.Read&&f.addClass("e-fe-lock"));f.appendTo(s.find(".e-thumb-image"));u.model.showCheckbox&&(a=n("<input type='checkbox' class='e-tile-checkbox' />"));var y=n("<div class='e-name-wrap' unselectable='on' <\/div>"),h=n("<div class='e-name e-name-in-wrap' unselectable='on'><\/div>"),b=n("<div class='e-file-name' unselectable='on'><span class='e-file-info' title= '"+r.name+"'>"+r.name+"<\/span><\/div>");b.appendTo(h);r.isFile&&u.model.layout=="tile"&&(p=n("<div class='e-file-type' unselectable='on'><span class='e-file-info'>"+r.type+"<\/span><\/div>"),p.appendTo(h),w=n("<div class='e-file-size' unselectable='on'><span class='e-file-info'>"+r.size+"<\/span><\/div>"),w.appendTo(h));h.appendTo(y);e.attr({"aria-selected":!1,title:r.isFile?r.dateModified+" ("+r.size+")":r.dateModified,role:"tileitem"});u.model.showCheckbox&&a.prependTo(e);y.appendTo(e);e.appendTo(u._tileView);u.model.showCheckbox&&u._tileView.find(".e-tile-checkbox").ejCheckBox({size:"mini",showRoundedCorner:u.model.showRoundedCorner});u._tileView.find(".e-chkbox-wrap").removeAttr("tabindex")}),this._activeItem=0,this.items=this._tileView.children("li.e-tilenode"),this.model.allowDragAndDrop&&(this._tileViewWrapper.addClass("e-droppable"),this._drag(this.items),this.items.addClass("e-file-draggable")),this._tileViewEvents("_off"),this._tileViewEvents("_on"),this._tileContent.addClass("e-content"),c=this.model.showFooter?this._splittag.outerHeight()-this._statusbar.outerHeight():this._splittag.outerHeight(),l=parseInt(this._splittag.find(".e-cont2").width()),t.isNullOrUndefined(this._tileScroll)?this._tileScroll=this._tileContent.parent(".e-tile-wrapper").ejScroller({height:c,width:l,buttonSize:0,scrollerSize:this._scrollerSize,thumbStart:function(n){u._onThumbStart(n)}}).data("ejScroller"):(this._tileScroll.option({height:c,width:l}),this._tileScroll&&this._tileScroll.refresh()),u._tileView.find(".e-image > img").length)for(o=u._tileView.find(".e-image > img"),a=0,s=0;s<o.length;s++)e=new Image,e.onload=e.onabort=e.onerror=function(n){if(n){++a==o.length&&u._setThumbImageHeight();var t={path:n.target.src,element:n.target,originalArgs:n,action:"thumbnailPreview"};u._trigger("getImage",t)}},e.src=n(o[s]).attr("src");else u._setThumbImageHeight()},_getImage:function(n,t,i){var f,r,u;return(n=n.replace("..","~"),f=this._getSelectedItemDetails(this._currentPath,t),r={path:n,canCompress:i,size:i?{Height:104,Width:116}:null,selectedItems:f},this._trigger("beforeGetImage",r))?"":((this._currentPath.indexOf(":")==1||this.model.ajaxSettings.getImage.url)&&(u=this.model.ajaxAction+"?Path="+r.path+"&ActionType=GetImage&CanCompress="+r.canCompress+"&Size="+JSON.stringify(r.size)+"&SelectedItems="+JSON.stringify(r.selectedItems),this.model.ajaxSettings.getImage.url&&(u=this.model.ajaxSettings.getImage.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.getImage.url,"?CanCompress="+r.canCompress+"&Size="+JSON.stringify(r.size)+"&Path="+r.path+"&SelectedItems="+JSON.stringify(r.selectedItems)):this.model.ajaxSettings.getImage.url)),u?u:i?this.model.ajaxAction+"?ActionType=GetImage&CanCompress="+r.canCompress+"&Size="+JSON.stringify(r.size)+"&Path="+r.path+"&SelectedItems="+JSON.stringify(r.selectedItems):"")},_gridtagClick:function(t){t.stopPropagation();(n(t.target).hasClass("e-gridcontent")||n(t.target).hasClass("e-content")||n(t.target).hasClass("e-table"))&&(this._addFocus(this._gridtag.find(".e-gridcontent")),this.model.showCheckbox&&(this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1})),this._gridObj.clearSelection(),this._unselectEvent(),this._updateCurrentPathPermission(),this._activeSource&&this._activeSource.length&&this._setSelectedItems(this._activeSource));this._activeSource=null},_updateGridSelection:function(t){t.events&&!t.events.ctrlKey&&n(t.target)[0]!=null&&this._gridObj.selectRows(n(t.target).closest("td").parent().index(),null,n(t.target).closest("td"))},_updateTileSelection:function(t){t.events&&!t.events.ctrlKey&&n(t.target)[0]!=null&&this._triggerClick(t.target)},_tileViewEvents:function(t){this[t](this.items,"mousedown",this._preventDefaultSelection);this[t](this.items,this._isDevice&&n.isFunction(n.fn.tap)?"tap":"click",this._upDatePathFromTileView);this[t](this.items,this._isDevice&&n.isFunction(n.fn.tap)?"doubletap":"dblclick",this._openAction);this[t](this.items,"mouseenter",this._onItemHover);this[t](this.items,"mouseleave",this._onItemLeave);this[t](this._tileViewWrapper,"focusin",this._focusTileView);this[t](this._tileViewWrapper,"focusout",this._blurTileView);this.model.allowDragAndDrop&&this._tileDragEvents(t)},_tileDragEvents:function(n){this._tileViewWrapper&&(this[n](this._tileViewWrapper,"dragover",this._onDragOverHandler),this[n](this._tileViewWrapper,"drop",this._onDropHandler),this[n](this._tileViewWrapper,"dragleave",this._onDragLeave))},_preventDefaultSelection:function(n){n.shiftKey&&n.preventDefault()},_tileViewWrapperClick:function(t){(n(t.target).hasClass("e-tile-wrapper")||n(t.target).hasClass("e-tile-content")||n(t.target).hasClass("e-tileview"))&&(this._lastItemIndex=this._lastItemIndex?this._lastItemIndex:this._itemList?this._itemList.filter(".e-active").index():-1,this._addFocus(this._tileViewWrapper),this.items.hasClass("e-active")&&this.items.removeClass("e-active").attr("aria-selected",!1),this._updateCurrentPathPermission(),this.model.showCheckbox&&this._clearTileCheckBoxSelection(),this._hidePopup(),this._activeSource&&this._activeSource.length&&this._setSelectedItems(this._activeSource),this._unselectEvent());this._activeSource=null},_onItemHover:function(t){var i=t.currentTarget,r=t.target;n(i).hasClass("e-disable")||(this.items.removeClass("e-hover"),n(i).addClass("e-hover"))},_onItemLeave:function(t){var i=t.currentTarget,r=t.target;n(i).hasClass("e-disable")||n(i).removeClass("e-hover")},_focusTileView:function(){this._tileViewWrapper.hasClass("e-focus")||(this._tileViewWrapper.addClass("e-focus"),this._itemList=this.items,this._on(this._tileViewWrapper,"keydown",this._OnKeyUp),this._on(this._tileViewWrapper,"keydown",this._OnKeyDown))},_blurTileView:function(){this._tileViewWrapper.removeClass("e-focus");this._off(this._tileViewWrapper,"keydown",this._OnKeyUp);this._off(this._tileViewWrapper,"keydown",this._OnKeyDown)},_OnKeyDown:function(t){var i=this._itemList.length-1,r;if(this._activeItem=this._lastItemIndex?this._lastItemIndex:this._itemList?this._itemList.filter(".e-active").index():-1,r=this._getKeyCode(t),this.model.allowKeyboardNavigation){switch(r){case 38:if(t.preventDefault(),n(t.target).hasClass("e-statusbar")){this._focusLayout(this.model.layout);return}if(this._activeItem<this._perRow-1)return;this._activeItem-=this._perRow;this._beforeListHover(t);break;case 37:if(t.preventDefault(),this._activeItem==0)return;this._activeItem<0||this._activeItem==null||this._activeItem>i?this._activeItem=0:this._activeItem==0?this._activeItem=i:this._activeItem-=1;this._beforeListHover(t);break;case 40:if(t.preventDefault(),this._activeItem+this._perRow>=this._itemList.length)return;this._activeItem+=this._perRow;this._beforeListHover(t);break;case 39:if(t.preventDefault(),this._activeItem==i)return;this._activeItem>i||this._activeItem==null||this._activeItem<0?this._activeItem=i:this._activeItem==i?this._activeItem=0:this._activeItem+=1;this._beforeListHover(t);break;case 33:case 36:t.preventDefault();this._activeItem=0;this._beforeListHover(t);break;case 34:case 35:t.preventDefault();this._activeItem=i;this._beforeListHover(t)}this._lastItemIndex=t.shiftKey?this._activeItem:null}},_OnKeyUp:function(i){var o=this._getKeyCode(i),f,u,s,r,e;if(this.model.allowKeyboardNavigation&&!this._KeydownEventHandler(i))switch(o){case 13:i.preventDefault();i.altKey?(this._lastFocusedElement=i.currentTarget,this._getDetails()):(i.preventDefault(),this._lastFocusedElement=i.currentTarget,n(i.currentTarget).hasClass("e-treeview")||(f=!1,n(i.currentTarget).hasClass("e-tile-wrapper")?f=this.items.hasClass("e-active"):n(i.currentTarget).hasClass("e-gridcontent")&&(f=n(this.gridItems).find("td").hasClass("e-active")),f&&this._selectedContent&&this._openAction()));break;case 86:i.ctrlKey&&(i.preventDefault(),!t.isNullOrUndefined(this._option)&&this._selectedContent&&(this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath),this._lastFocusedElement=i.currentTarget,this._cut_copy()));break;case 46:case 67:case 68:case 88:case 113:if(i.preventDefault(),this._lastFocusedElement=i.currentTarget,f=!1,n(i.currentTarget).hasClass("e-treeview")?this._rootPath!=this._currentPath&&(f=this._treetag.find(".e-active").length>0?!0:!1):n(i.currentTarget).hasClass("e-tile-wrapper")?f=this.items.hasClass("e-active"):n(i.currentTarget).hasClass("e-gridcontent")&&(f=n(this.gridItems).find("td").hasClass("e-active")),f&&this._selectedContent&&this._toRead&&(o==67&&this._toCopy&&i.ctrlKey&&this._copyMoveNode("copy"),this._toEdit))switch(o){case 46:this._deleteFolder();break;case 68:i.ctrlKey&&this._deleteFolder();break;case 88:i.ctrlKey&&this._copyMoveNode("move");break;case 113:this._renameFolder()}break;case 93:case 121:if((i.shiftKey||o==93)&&this.model.showContextMenu)if(i.preventDefault(),this._lastFocusedElement=i.currentTarget,u=null,n(i.currentTarget).hasClass("e-treeview"))r=this._treeObj.getSelectedNode().find(".e-active"),u=this._getMenuPosition(r),this._treeMenuObj.show(u.left,u.top,r,i,!0);else{if(n(i.currentTarget).hasClass("e-tile-wrapper")){for(e=0;e<this.items.length;e++)if(r=n(this.items[e]),r.text()==this._selectedContent){u=this._getMenuPosition(r);s=r;break}}else if(n(i.currentTarget).hasClass("e-gridcontent"))for(e=0;e<this.gridItems.length;e++)if(r=n(this.gridItems[e]).find("td.e-grid-image").next(),r.text()==this._selectedContent){u=this._getMenuPosition(r);s=r;break}u==null&&(u=n(i.currentTarget).offset(),s=n(i.currentTarget));this._viewMenuObj.show(u.left,u.top,s,i,!0)}}},_KeydownEventHandler:function(n){return data={keyCode:n.keyCode,altKey:n.altKey,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,originalArgs:n},this._trigger("keydown",data)},_getMenuPosition:function(n){var i=n.outerHeight()/2,r=n.outerWidth()/2,t=n.offset();return{top:t.top+i,left:t.left+r}},_beforeListHover:function(i){var r=this._getActiveItem(),u;r.hasClass("e-disable")||(n(i.target).hasClass("e-statusbar")?(this.model.layout=r.hasClass("e-switchGridView")?t.FileExplorer.layoutType.Grid:t.FileExplorer.layoutType.LargeIcons,this._switchLayoutView(this.model.layout),this._addFocus(this._statusbar)):(u={keyCode:91,shiftKey:i.shiftKey,innerEvent:!0,currentTarget:r[0],target:r[0]},this._upDatePathFromTileView(u)))},_getActiveItem:function(){return n(n(this._itemList)[this._activeItem])},_getURL:function(){var n=this.model.ajaxAction+"?Path="+this._currentPath+"&ActionType=Upload"+(this._selectedContent?"&SelectedItems="+JSON.stringify(this._getSelectedItemDetails(this._getFolderPath(),[this._selectedContent])):"");return this.model.ajaxSettings.upload.url&&(n=this.model.ajaxSettings.upload.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.upload.url,"?Path="+this._currentPath+(this._selectedContent?"&SelectedItems="+JSON.stringify(this._getSelectedItemDetails(this._getFolderPath(),[this._selectedContent])):"")):this.model.ajaxSettings.upload.url),n},_renderUploadBox:function(){var n=this,i=this._getURL();this._uploadtag.ejUploadbox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,height:"0px",width:"0px",uploadName:"FileUpload",autoUpload:this.model.uploadSettings.autoUpload,showFileDetails:!this.model.uploadSettings.autoUpload,dialogText:{title:n._getLocalizedLabels("Upload")},dialogAction:{modal:!0,content:n.element},showRoundedCorner:this.model.showRoundedCorner,extensionsAllow:this.model.fileTypes=="*.*"?"":this.model.fileTypes.replace(/\*/g,""),multipleFilesSelection:this.model.uploadSettings.allowMultipleFile,fileSize:this.model.uploadSettings.maxFileSize,buttonText:{browse:"Upload file"},saveUrl:i,removeUrl:this.model.ajaxAction+"?Path="+this._currentPath+"&ActionType=Remove",locale:t.Uploadbox.Locale[this.model.locale]?this.model.locale:"en-US",complete:function(t){n._uploadSuccess(t)},remove:function(t){n._uploadSuccess(t)},fileSelect:function(t){var f,r,i,u;for(n._fileExplorer[n._currentPath]||n._getFileDetails(n._currentPath),f=n._fileExplorer[n._currentPath],n._existingItems=[],r=n._files=t.files,i=0;i<r.length;i++)for(u=0;u<f.length;u++)if(r[i].name==f[u].name){n._existingItems.push({Name:r[i].name,Path:n._currentPath+r[i].name,IsReplace:!0});break}n._existingItems.length&&(n._createReplaceConformationDiaolg("_customUpload","ReplaceAlert"),t.cancel=!0)},error:function(i){n._alertDialog&&n._alertDialog.is(":visible")||(n._alertDialog=n._createDialog(t.buildTag("div.e-fe-dialog-label",i.error?i.error:i.responseText),{width:400,height:"auto",title:n._getLocalizedLabels("Error")}),n._alertDialogObj=n._alertDialog.data("ejDialog"))},begin:function(t){var i=n._currentPath.split("/"),r={path:n._currentPath,selectedItems:n._getSelectedItemDetails(n._getFolderPath(),i[i.length-2]),uploadItemDetails:t.files};n._trigger("beforeUpload",r)&&(t.cancel=!0);n._uploadtag.ejUploadbox({saveUrl:n._getURL()})},cancel:function(){n._usePreviousValues()}})},_usePreviousValues:function(){this._previousPath&&(this._currentPath=this._previousPath,this._selectedContent=this._previousSelectedContent,this._previousPath=null)},_isRestrictedUpload:function(n,t,i){var r=null,u;if(n.find(".e-fe-lock").length){if(r=i?i:this._getFolderPath(this._updatePath(n,t)),this._fileExplorer[r]&&this._fileExplorer[r].length)for(u=0;u<this._fileExplorer[r].length;u++)if(this._fileExplorer[r][u].name==t&&this._fileExplorer[r][u].permission)return!this._fileExplorer[r][u].permission.Upload;return!1}return!1},_onDragOverHandler:function(i){var e="",o="",r=n(i.target),u=r.hasClass("e-js")||r.hasClass("e-tileview")?"":r.text(),f,s;i.originalEvent.dataTransfer.dropEffect="copy";i.stopPropagation();i.preventDefault();r.hasClass("e-file-droppable")||(e=this._splittag.find(".e-file-droppable"),e&&e.removeClass("e-file-droppable"),n(i.currentTarget).hasClass("e-tree-wrapper")?!t.isNullOrUndefined(r)&&r.is("A")?(this._droppableElement=r,this._droppableElement.length&&this._droppableElement.addClass("e-file-droppable"),f=r.closest("li.e-item"),f.find(".e-icon").length&&!this._treeObj.isExpanded(f)&&(this._expandTimer=window.setTimeout(function(){this._treeObj&&this._treeObj.expandNode(f)},800))):i.originalEvent.dataTransfer.dropEffect="none":(this.model.layout=="grid"?(this._droppableElement=r.closest("tr","table.e-table"),this._droppableElement.length?(this._droppableElementData=this._gridObj.model.currentViewData[this._gridObj.getIndexByRow(this._droppableElement)],this._droppableElementData.isFile&&(this._gridtag.find(".e-gridcontent").addClass("e-file-droppable"),this._droppableElement=null)):this._gridtag.find(".e-gridcontent").addClass("e-file-droppable")):(this._droppableElement=r.closest("li",".e-tileview").has(".e-fe-folder"),this._droppableElement.length||this._tileViewWrapper.addClass("e-file-droppable")),this._droppableElement&&this._droppableElement.length&&this._droppableElement.addClass("e-file-droppable"),o=this._getHoverTreeElementPath(r),this._droppableElement&&this._droppableElement.length&&(u=this.model.layout=="grid"?this._droppableElementData.name:this._droppableElement.find(".e-file-name").text())));this._droppableElement&&this._droppableElement.length&&this._isRestrictedUpload(this._droppableElement,u?u:i.target.textContent,o)&&(i.originalEvent.dataTransfer.dropEffect="none");s={target:this._droppableElement&&this._droppableElement.length?this._droppableElement:r,targetElementName:u,targetPath:this._getHoverTreeElementPath(r)+u};this._trigger("drag",s)},_getHoverTreeElementPath:function(n){return n.hasClass("e-text")?this._updatePath(n,n.text()):this._originalPath},_onDropHandler:function(t){var r,i;if(t.originalEvent.dataTransfer.files&&t.originalEvent.dataTransfer.files.length){if(t.stopPropagation(),t.preventDefault(),this._expandTimer!=null&&(window.clearTimeout(this._expandTimer),this._expandTimer=null),this.element.find(".e-file-droppable").removeClass("e-file-droppable"),r=this._uploadtag.ejUploadbox("instance"),this._droppableElement&&this._droppableElement.length)this._previousPath=this._currentPath,this._previousSelectedContent=this._selectedContent,n(t.currentTarget).hasClass("e-tree-wrapper")?(this._selectedContent=t.target.text,this._currentPath=this._updatePath(n(t.target),this._selectedContent)):(this._selectedContent=this.model.layout=="grid"?this._droppableElementData.name:n(t.target).closest("li","e-tileview").find(".e-file-name").text(),this._currentPath=this._originalPath+this._selectedContent+"/");else{if(this._droppableElement&&!this._droppableElement.length&&this._isRestrictedUpload(this._selectedNode,this._selectedTreeText,this._getFolderPath(this._originalPath)))return t.originalEvent.dataTransfer.dropEffect="none",null;this._currentPath=this._originalPath;this._selectedContent=this._selectedTreeText}(i={dropAction:"upload",fileInfo:t.originalEvent.dataTransfer.files,target:this._droppableElement&&this._droppableElement.length?this._droppableElement:n(t.currentTarget),targetPath:this._currentPath,targetElementName:this._selectedContent},this._trigger("dragStop",i))||(r._onDropHandler(t),i={dropAction:"upload",fileInfo:t.originalEvent.dataTransfer.files,target:this._droppableElement&&this._droppableElement.length?this._droppableElement:n(t.currentTarget),targetPath:this._currentPath,targetFolder:this._selectedContent},this._trigger("drop",i))}},_onDragLeave:function(t){this._expandTimer!=null&&(window.clearTimeout(this._expandTimer),this._expandTimer=null);(this._gridtag.find(".e-gridcontent").hasClass("e-file-droppable")||n(t.target).hasClass("e-tile-wrapper")||n(t.target).hasClass("e-gridcontent")||n(t.target).closest(".e-fileexplorer .e-tile-wrapper")||n(t.target).closest(".e-fileexplorer .e-gridcontent"))&&(this.model.layout=="grid"?this._gridtag.find(".e-gridcontent").removeClass("e-file-droppable"):this._tileViewWrapper.removeClass("e-file-droppable"))},_customUpload:function(){for(var t,n=0;n<this._existingItems.length;n++)if(!this._existingItems[n].IsReplace)for(t=0;t<this._files.length;t++)if(this._files[t].name==this._existingItems[n].Name){this._files.splice(t,1);break}this._uploadtag.ejUploadbox({pushFile:this._files})},_uploadSuccess:function(n){for(var r=this._currentPath,i=[],t=0;t<n.success;t++)i.push(n.success[t].name);this.element.find(".e-dialog.e-js .e-action-perform").remove();this._fileExplorer[this._currentPath]="";this._treeObj.selectNode(this._selectedNode);r==this._currentPath&&this._setSelectedItems(i)},_preventDrag:function(){var t=this._treetag.find("li div a");t.removeClass("e-file-draggable");this.gridItems&&this.gridItems.length&&n(this.gridItems).removeClass("e-file-draggable");this.items&&this.items.length&&this.items.removeClass("e-file-draggable")},_allowDrag:function(){var t,r,i,u;this._gridtag.children(".e-gridcontent").addClass("e-droppable");this._tileViewWrapper.addClass("e-droppable");t=this._treetag.find("li div a").not(".e-js");t.length&&this._drag(t);r=n(this.gridItems).not(".e-js");r.length&&this._drag(n(this.gridItems));i=this.items.not(".e-js");i.length&&this._drag(i);u=this._treetag.find("li div a");u.addClass("e-file-draggable");this.gridItems&&this.gridItems.length&&n(this.gridItems).addClass("e-file-draggable");this.items&&this.items.length&&this.items.addClass("e-file-draggable")},_drag:function(i){var f,e,o,h,u,c,s,r=this;i.ejDraggable({dragOnTaphold:!0,clone:!0,dragStart:function(t){var u=!1,i,e;if(r._previousElement=r._selectedNode,n(t.target).hasClass("e-text")?(u=!0,r._copiedNodes=[n(t.target).text()],r._option="move",r._sourcePath=r._getFolderPath(r._getHoverTreeElementPath(n(t.target))),r._sourceType="Directory",r._fileName=n(t.target).text(),r._refreshNode=n(t.target).closest("li")):r.model.selectedItems.length<=1&&(r.model.layout=="grid"?r._gridObj.selectRows(n(t.target).closest("tr").index()):r._triggerClick(t.target)),r.model.selectedItems.length){for(i=0;i<r.model.selectedItems.length;i++)if(t.target&&r._isRestrictedMove(t.element,r.model.selectedItems[i],r.model.selectedFolder))return f.remove(),t.cancel=!0,null}else if(n(t.target).hasClass("e-text")&&(o=t.target.textContent),t.target&&o&&r._isRestrictedMove(t.element,o,""))return f.remove(),t.cancel=!0,null;u||r._copyMoveNode("move");r._previousElement.find("a").eq(0).click();e={target:t.element,targetPath:r._currentPath,selectedItems:r._getSelectedItemDetails(r._sourcePath,r._fileName)};r._trigger("dragStart",e)},drag:function(t){var l,a=u,v=n(t.target).closest(".e-droppable",".e-fileexplorer"),i,y;n(t.target).hasClass("e-droppable")?u=n(t.target):v.length?u=v:n(t.target).hasClass("e-text")?u=n(t.target).find(".e-droppable"):r._clearExpand(n(t.target).closest("li.e-item"));document.body.style.cursor="no-drop";e&&(e.style.cursor=h);e=t.target;h=t.target.style.cursor;n(f).css({"margin-left":"10px"});u&&a&&u.hasClass("e-draggable")?(u.text()!=a.text()&&(i=n(t.target).closest("li.e-item"),r._clearExpand(i),i&&i.find(".e-icon").length&&!r._treeObj.isExpanded(i)&&(r._expandTimer=window.setTimeout(function(){r._treeObj&&r._treeObj.expandNode(i)},800)),clearTimeout(l),l=setTimeout(function(){n(e).hasClass("e-text")?r._needToScroll(n(e).closest("li"),"Tree"):u&&r._needToScroll(n(u),"")},100)),t.target.style.cursor="pointer"):t.target.style.cursor="no-drop";n(e).hasClass("e-text")?(o=e.textContent,s=""):(o=r.model.layout=="grid"?u?u.find("[data-cell='"+r._gridObj.getColumnByField("name").headerText+"']").text():"":u?u.hasClass("e-tile-wrapper")?"":u.text():"",s=r._getHoverTreeElementPath(n(e)));e&&r._isRestrictedMove(u,o,s)?(t.target.style.cursor="no-drop",c=!0):c=!1;s+(o?o+"/":"")!=r._sourcePath&&(t.target.style.cursor="pointer");y={target:u&&u.length?u:n(t.target),targetElementName:o,targetPath:(s?s:r._originalPath)+o};r._trigger("drag",y)},dragStop:function(i){var o=!1,s;if(o=r.model.layout=="grid"?n(i.target).hasClass("e-gridcontent")||n(i.target).find("table").length&&n(i.target).closest(".e-gridcontent",".e-fileexplorer").length:n(i.target).hasClass("e-tileview")||n(i.target).find(".e-tileview").length&&n(i.target).closest(".e-fileexplorer").length,o&&r._sourcePath==r._originalPath&&(r._activeSource=r.model.selectedItems),o){if(r._setSelectedItems([]),t.isNullOrUndefined(r._copiedNodes)||!i.element.hasClass("e-file-draggable"))return;if(f.hide(),r.element.find(".e-blur").removeClass("e-blur"),r._currentPath==r._sourcePath+r._fileName+"/")return;r._cut_copy();f&&f.remove()}r._expandTimer!=null&&(window.clearTimeout(r._expandTimer),r._expandTimer=null);e&&(e.style.cursor=h);document.body.style.cursor="";r.element.find(".e-blur").removeClass("e-blur");!i.element.dropped&&((n(i.event.target).hasClass("e-tree-wrapper")||n(i.event.target).parents(".e-tree-wrapper").length>0)&&!n(i.event.target).is("a")||!n(i.event.target).hasClass("e-tile-wrapper")&&!n(i.event.target).parents(".e-tile-wrapper").length>0&&!n(i.event.target).hasClass("e-gridcontent")&&!n(i.event.target).parents(".e-gridcontent").length>0&&!n(i.event.target).hasClass("e-tree-wrapper")&&!n(i.event.target).parents(".e-tree-wrapper").length>0)&&f&&f.remove();s={dropAction:"move",fileInfo:r._getSelectedItemDetails(r._sourcePath,r._copiedNodes),target:u&&u.length?u:n(i.target),targetElementName:r._selectedContent,targetPath:r._currentPath};r._trigger("dragStop",s)},helper:function(i){var u,e,s,o,h;if(!t.isNullOrUndefined(i.element)){if(!i.element.hasClass("e-file-draggable"))return i.cancel=!0,null;if(r)return f=t.buildTag("div.e-dragedNode e-fe"),h=t.util.getZindexPartial(r.element),f.css({"z-index":h}),f.addClass(r.model.cssClass+(r.model.enableRTL?" e-rtl":"")),u=n(i.element).clone().addClass("dragClone"),e=u.find("img"),s=e.length?t.buildTag("img.e-thumbImage","","",{src:e.attr("src")}):t.buildTag("span","","",{"class":u.find(".e-fe-icon").attr("class")}),r.model.selectedItems.length>1&&(o=t.buildTag("div.e-count"),o.text(r.model.selectedItems.length),f.append(o)),f.append(s),f.appendTo(n("body"))}}});i.ejDroppable({accept:i,drop:function(i,u){var f,e;c||t.isNullOrUndefined(r._copiedNodes)||!u.draggable.hasClass("e-file-draggable")||(n(u.helper).hide(),f=function(t){var u,f;(t||r._clickTarget(i),r._currentPath!=r._sourcePath+r._fileName+"/")&&(u=r._getSelectedItemDetails(r._sourcePath,r._fileName),r._cut_copy(!0),f={dropAction:"move",fileInfo:u,target:n(i.dropTarget),targetPath:r._currentPath,targetFolder:r._selectedContent},r._trigger("drop",f))},r.model.layout!="grid"||n(i.dropTarget).hasClass("e-text")?(e=r._getHoverTreeElementPath(n(i.dropTarget)),r._fileExplorer[e]?f():r._getFileDetails(e,"","",f)):(r._gridObj.selectRows(n(i.dropTarget).closest("tr").index()),f(!0)),n("body").find(".e-dragedNode").length>0&&n("body").find(".e-dragedNode").remove())}})},_clickTarget:function(t){if(n(t.dropTarget).hasClass("e-text"))this._treeObj&&this._treeObj.selectNode(t.dropTarget);else if(this.model.layout=="grid"){var i=n(t.dropTarget).closest("tr").index();i>=0?this._gridObj.selectRows(n(t.dropTarget).closest("tr").index()):n(t.dropTarget).click()}else this._triggerClick(t.dropTarget)},_triggerClick:function(t){var i=n(t).closest(".e-tilenode");i.length>0&&this._isDevice&&n.isFunction(n.fn.tap)?n(t).trigger("tap"):n(t).click()},_clearExpand:function(){this._expandTimer!=null&&(window.clearTimeout(this._expandTimer),this._expandTimer=null)},_isRestrictedMove:function(n,t,i){var r=null,u;if(n&&n.find(".e-fe-lock").length){if(r=i?i:this._getFolderPath(this._updatePath(n,t)),this._fileExplorer[r]&&this._fileExplorer[r].length)for(u=0;u<this._fileExplorer[r].length;u++)if(this._fileExplorer[r][u].name==t&&this._fileExplorer[r][u].permission)return!this._fileExplorer[r][u].permission.Copy;return!1}return!1},_createAddressBar:function(){this._addresstag=t.buildTag("input.e-addressBar e-tool-input","",{},{id:this._ExplorerId+"_addressbar",type:"text"});this._addresstag.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Addressbar").html(""));var i=n("<span class='e-fe-icon e-fe-folder'><\/span>");i.insertBefore(this._addresstag);t.browserInfo().name=="msie"&&t.ieClearRemover(this._addresstag[0]);this._addressBarEvents("_on")},_addressBarEvents:function(t){this[t](n("#"+this._ExplorerId+"_addressbar"),"focus",this._inputFocusin);this[t](n("#"+this._ExplorerId+"_addressbar"),"keydown",this._searchPath);this[t](n("#"+this._ExplorerId+"_addressbar"),"blur",this._addressbarFocusout)},_inputFocusin:function(t){n(t.target).select()},_updateAddressBar:function(){if(this._addresstag){var n=this._currentPath;this._addresstag.val(n.replace(this._initPath,""))}},_onEpand:function(n){this._splitObj.element.find(".e-cont1").hasClass("collapsed")?this._splitIcon&&this._splitIcon.find(".e-icon").hasClass("e-arrow-sans-left")&&this._splitIcon.find(".e-icon").addClass("e-arrow-sans-right").removeClass("e-arrow-sans-left"):this._splitIcon&&this._splitIcon.find(".e-icon").hasClass("e-arrow-sans-right")&&this._splitIcon.find(".e-icon").addClass("e-arrow-sans-left").removeClass("e-arrow-sans-right");this._reSizeHandler(n)},_createSplitPane:function(){var f=this,i=t.buildTag("div"),n=t.buildTag("div"),e,u;this._splittag=t.buildTag("div#"+this._ExplorerId+"_splitter");i.addClass("e-cont1");n.addClass("e-cont2");this.model.enableRTL?this._splittag.append(n,i):this._splittag.append(i,n);e=this.model.enableRTL?[{},{paneSize:this._isMobileOrTab?"150px":"25%"}]:[{paneSize:this._isMobileOrTab?"150px":"25%"},{}];this.element.append(this._splittag);this._splitObj=this._splittag.ejSplitter({enableAutoResize:!0,animationSpeed:50,width:"100%",cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,allowKeyboardNavigation:this.model.allowKeyboardNavigation,height:this.element.height()-(this._toolBarItems?this._toolBarItems.outerHeight():0),properties:e,expandCollapse:function(n){f._onEpand(n)},resize:function(n){f._reSizeHandler(n)}}).data("ejSplitter");var r=this._splitObj.element.find(".e-splitbar"),o=r.css("border-width"),s=r.css("width");r.css({width:"0px","border-width":"0px"});this._splitObj.refresh();r.css({width:s,"border-width":o});this._renderSplitIcon();u=t.buildTag("div.e-tree-wrapper");i.append(u);this._treetag=t.buildTag("div#"+this._ExplorerId+"_treeView");u.append(this._treetag);this._gridtag=t.buildTag("div#"+this._ExplorerId+"_grid");n.append(this._gridtag);this._tileViewWrapper=t.buildTag("div.e-tile-wrapper#"+this._ExplorerId+"_tileWrapper","","",{tabindex:0});this.model.layout=="tile"&&this._tileViewWrapper.addClass("e-tileInfo-view");n.append(this._tileViewWrapper);this._tileViewWrapper.append("<div class='e-tile-content' > <\/div>");this._tileContent=this._tileViewWrapper.find(".e-tile-content");this._tileView=t.buildTag("ul#"+this._ExplorerId+"_tileView");this._tileContent.append(this._tileView);this._statusbar=t.buildTag("div","","",{tabindex:0});this._statusbar.insertAfter(this._tileView);n.append(this._statusbar);this.model.showFooter&&this._createStatusBar();this._waitingPopup=this._splittag.find(".e-cont2").ejWaitingPopup({showOnInit:!1,cssClass:this.model.cssClass}).data("ejWaitingPopup");this._showHideSplitBar(!1);this._showHideContextMenu();this.model.layout=="grid"?this._tileContent.parent().hide():this._gridtag.hide();this._createUploadBox()},_selectedFolder:function(n){var i,r,t,e;this._isClicked=!1;var o=n.replace(this._initPath,""),u=this._treeObj.getSelectedNode(),f=o.split("/");for(o&&this._treeObj.selectNode(this._treeObj.element.find("li:first")),i=0;i<f.length;i++)if(f[i]!="")for(u=this._treeObj.getSelectedNode(),this._treeObj.isExpanded(u)||this._treeObj&&this._treeObj.expandNode(u),r=u.find("ul:first>li").find("div:first .e-text"),t=0;t<r.length;t++)r[t].text==f[i]&&(e=f.filter(function(n){return n!=""}),e[e.length-1]==r[t].text&&(this._isClicked=!0),this._treeObj.selectNode(r[t].parentNode.parentNode));this._isClicked=!0},_setSelectedItems:function(t){var f,o,r,u,i,e,s;if(this._suggestionItems.length&&(f=t,t=this._selectedItems),typeof t=="string"&&(t=[t]),this._removeOldSelectionDetails(),this.model.layout=="grid"){for(this._gridObj.clearSelection(),o=this._gridObj.multiSelectCtrlRequest,this._gridObj.multiSelectCtrlRequest=!0,r=this._gridtag.find(".e-gridcontent tr"),u=0;u<t.length;u++)for(r=n("#"+this._ExplorerId+" .e-gridcontent td:contains("+(f?f[u]:t[u])+")"),i=0;i<r.length;i++)if(this._suggestionItems.length?this._originalPath+t[u]==n(r[i]).closest("tr").attr("data-parent-path")+n(r[i]).text():t[u]==n(r[i]).text()){this._gridObj.selectRows(n(r[i]).closest("tr").index());break}this._recordClick();this._gridObj.multiSelectCtrlRequest=o}else for(this.items.removeClass("e-active").attr("aria-selected",!1),r=this._tileView.find(".e-tilenode"),u=0;u<t.length;u++)for(i=0;i<r.length;i++)if(e=this.model.layout=="tile"?n(r[i]).find(".e-file-name").text():n(r[i]).text(),this._suggestionItems.length?this._originalPath+t[u]==n(r[i]).attr("data-parent-path")+e:t[u]==e){s={keyCode:91,ctrlKey:!0,currentTarget:r[i],target:r[i]};this._upDatePathFromTileView(s);break}},_refreshTreeScroller:function(){t.isNullOrUndefined(this.element)||(this.model.enableRTL&&(this._treeScroll.model.scrollLeft=0),this._treeScroll&&this._treeScroll.refresh())},_createStatusBar:function(){var i,n;this._statusbar.addClass("e-statusbar");this._itemStatus=t.buildTag("div.e-itemStaus");this._selectedItemsTag=t.buildTag("div.e-itemStaus e-selected-items");this._switchBtn=t.buildTag("div.e-switchView");this._statusbar.append(this._switchBtn,this._itemStatus,this._selectedItemsTag);this.model.enableResize&&(this._resizeItem=t.buildTag("div.e-icon e-fe-resize e-resize-handle"),this._resizeItem.insertBefore(this._switchBtn));i=this._splittag.find(".e-cont2").outerHeight()-this._statusbar.outerHeight();this._gridtag.height(i);n=t.buildTag("button.e-switchGridView#"+this._ExplorerId+"_switchGridView","",{},{title:this._getLocalizedLabels("Grid"),tabindex:0});this._switchBtn.append(n);n.ejButton({type:"button",size:"normal",contentType:"imageonly",prefixIcon:"e-icon e-fe-grid"});n=t.buildTag("button.e-swithListView#"+this._ExplorerId+"_swithListView","",{},{title:this._getLocalizedLabels("LargeIcons"),tabindex:0});this._switchBtn.append(n);n.ejButton({type:"button",size:"normal",contentType:"imageonly",prefixIcon:"e-icon e-fe-largeicons"});this.model.layout=="grid"&&this._statusbar.find(".e-switchGridView").addClass("e-active");this.model.layout=="largeicons"&&this._statusbar.find(".e-swithListView").addClass("e-active");this._statusBarEvents("_off");this._statusBarEvents("_on")},_statusBarEvents:function(n){this[n](this._statusbar,"focus",this._focusStatusBar);this[n](this._statusbar.find("button"),"focus",this._focusStatusBarButton);this[n](this._statusbar.find("button"),"blur",this._blurStatusBarButton);this[n](this._statusbar,"blur",this._blurStatusBar);this.model.allowDragAndDrop&&this[n](this._statusbar,"dragover",this._preventDropOption)},_focusStatusBar:function(){this._statusbar.hasClass("e-focus")||(this._statusbar.addClass("e-focus"),this._itemList=this._switchBtn.find("button"),this._on(this._statusbar,"keydown",this._OnKeyDown),this._hidePopup())},_focusStatusBarButton:function(){this._on(this._statusbar.find("button"),"keydown",this._check)},_blurStatusBarButton:function(){this._off(this._statusbar.find("button"),"keydown",this._check)},_blurStatusBar:function(){this._statusbar.removeClass("e-focus");this._off(this._statusbar,"keydown",this._OnKeyDown)},_check:function(){var n;this.model.layout==t.FileExplorer.layoutType.Grid?(this.model.layout=t.FileExplorer.layoutType.LargeIcons,n=!0):this.model.layout==t.FileExplorer.layoutType.LargeIcons&&(this.model.layout=t.FileExplorer.layoutType.Grid,n=!0);n&&this._switchLayoutView()},_refreshResizeHandler:function(){this._setMinMaxSizeInInteger();this.adjustSize();this.model.showFooter&&this.model.enableResize&&this._resizeFileExplorer()},_refreshResizeEventHandler:function(t){var i=n(t.element).parents("div.e-fileexplorer");this.model.height=n(i).outerHeight();this.model.width=n(i).outerWidth();this.element.css({height:this.model.height,width:this.model.width});this.adjustSize()},_convertPercentageToPixel:function(n,t){return Math.round(t*n/100)},_getProperValue:function(n){return n==null?null:isNaN(n)?n:n},_setMinMaxSizeInInteger:function(){var t;this._minWidth=parseInt(this.model.minWidth);this._minHeight=parseInt(this.model.minHeight);this._maxWidth=parseInt(this.model.maxWidth);this._maxHeight=parseInt(this.model.maxHeight);t=this.element.parent()[0].nodeName=="BODY"?n(window):n(this.element.parent()[0]);isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(this._minWidth=this._convertPercentageToPixel(t.outerWidth(),this._minWidth));isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(this._minHeight=this._convertPercentageToPixel(t.outerHeight(),this._minHeight));isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(this._maxWidth=this._convertPercentageToPixel(t.innerWidth(),this._maxWidth));isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(this._maxHeight=this._convertPercentageToPixel(t.innerHeight(),this._maxHeight))},_resizeFileExplorer:function(){var t=this;this.element.find("div.e-fe-resize").ejResizable({minHeight:t._minHeight,minWidth:t._minWidth,maxHeight:t._maxHeight,maxWidth:t._maxWidth,resizeStart:function(n){t._trigger("resizeStart",{event:n})},resize:function(n){t._refreshResizeEventHandler(n);t._trigger("resize",{event:n})},resizeStop:function(n){t._refreshResizeEventHandler(n);t._trigger("resizeStop",{event:n})},helper:function(){return n(t.element)}})},_showHideSplitBar:function(n){this._splittag.show();this._splitObj.model.properties[1].paneSize==0?(this.element.find(".e-splitbar").show(),this._splitObj.expand(1),!this._gridtag.hasClass("e-grid")&&n&&this._updateData()):this._splitObj.model.properties[0].paneSize==0&&(this.element.find(".e-splitbar").show(),this._splitObj.expand(0),this._treetag.parent(".e-tree-wrapper").css("display","block"));this.model.showNavigationPane||(this.model.enableRTL?this._splitObj.collapse(1):this._splitObj.collapse(0),this.element.find(".e-splitbar").hide(),!this._gridtag.hasClass("e-grid")&&n&&this._updateData())},_updateTreePath:function(i){var r,u,f,i;if(this._suggestionItems=[],this._toDownload=!1,this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0,this._removeBlurEffect(),this._searchbar&&this._searchbar.val(""),this._selectedTreeText=this._selectedContent=i.value,this._selectedNode=i.currentElement,r=n(this._selectedNode.parents("li.e-item")[0]),this._parentNode=r.length!=0?r:this._selectedNode,this._nodeType="Directory",this._initUpdate?this._currentPath=this._updatePath(i.currentElement,i.value):this._initUpdate=!0,this._updateOnNodeSelection&&this._updateData(),this._originalPath=this._currentPath,!this._isStateNavigation){if(!t.isNullOrUndefined(this._currentState)){for(u=this._selectedStates.length-1;u>this._currentState;u--)this._selectedStates.pop();this._toolBarItems&&this._disableToolbarItem("Forward")}this._selectedStates[this._selectedStates.length-1]!=this._originalPath&&(this._currentState=this._selectedStates.length,this._selectedStates.push(this._originalPath),this._selectedStates.length==2&&this._toolBarItems&&this._enableToolbarItem("Back"))}this._updateAccessRules(this._originalPath);this._updateToolbarItems();this._updateNewFolderTool(this._toRead&&this._toEditContents);r.length||(this._disableEditingTools(),this._toolBarItems&&this._disableToolbarItem("Copy"));this.model.selectedFolder=this._currentPath;this._updateAddressBar();this._currntNode=this._selectedNode.find("> div > .e-text");this.model.selectedItems=[];this._filteredItemsName=[];this._selectedItems=[];this._selectedTileItems=[];f=this._getFolderPath();this._isClicked&&(i={name:[i.value],names:[i.value],path:f,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(f,this._selectedContent)},this._trigger("select",i))},_modifySelectedStates:function(t,i){var r=this;n.each(r._selectedStates,function(n,u){u&&u.startsWith(t)&&(r._selectedStates[n]=i?r._selectedStates[n].replace(t,i):i)})},_onBeforeCollapse:function(){this._collapse=!0},_updatePath:function(t,i){for(var u="",r=0;r<t.parents("ul").length-1;r++)n(t.parents("ul")[r]).siblings("div").find("a").text()&&(u=n(t.parents("ul")[r]).siblings("div").find("a").text()+"/"+u);return this._initPath+u+i+"/"},_updatePathFromGrid:function(i){var s,e,a,c,f,y,h,o;this._searchbar&&n.trim(this._searchbar.val())||(this._suggestionItems=[]);this.model.showCheckbox&&this._changeCheckState&&(this.model.allowMultiSelection||this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({checked:!1}),n(i.target).closest(".e-chkbox-wrap").length&&this._checkChange(i.row),(i.target&&n(i.target).closest(".e-chkbox-wrap").length==0||t.isNullOrUndefined(i.target))&&this._recordClick());s=this;e=n(i.target).closest("td.e-rowcell");this._addFocus(this._gridtag.find(".e-gridcontent"));c=!0;this._toDownload=this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0;this._isTreeNode=!1;this._selectedItems=[];var l=0,u=this._gridtag.ejGrid("getSelectedRecords"),v=n.inArray(r,u);for(v>-1&&u.splice(v,1),f=0;f<u.length;f++)this._suggestionItems&&this._suggestionItems.length?(h=u[f].filterPath.replace(this._originalPath,"")+u[f].name,this._selectedItems.push(h)):this._selectedItems.push(u[f].name),l+=u[f].sizeInByte,u[f].isFile||(c=!1,this._toDownload=!1),this._updateAccessValue(u[f]);this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath);n.each(s._suggestionItems.length>0?s._suggestionItems:s._fileExplorer[s._originalPath],function(n,t){t.name!=i.data.name||t.isFile||(a=!0)});a?(this._nodeType="Directory",e.hasClass("e-active")&&this._updateNode(i.data.name)):this._nodeType="File";y=this._nodeType;this._currntNode=e[0]!=null&&e.parent("tr");this._selectedContent=this._selectedItems[this._selectedItems.length-1];!e.hasClass("e-active")&&u.length>0&&(this._selectedContent=this._selectedItems[this._selectedItems.length-1],this._nodeType=u[u.length-1].isFile?"File":"Directory",this._nodeType=="Directory"&&this._updateNode(this._selectedContent));this._selectedItemsTag&&this._selectedItemsTag.html((this._selectedItems.length>0?this._selectedItems.length+" "+(this._selectedItems.length>1?this._getLocalizedLabels("Items"):this._getLocalizedLabels("Item"))+" "+this._getLocalizedLabels("Selected"):"")+(l?c?" "+this._bytesToSize(l):"":""));this._setFilteredItemsName();this.model.selectedItems=this._filteredItemsName;o={name:this._selectedItems,names:this._selectedItems,path:this.model.selectedFolder,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName)};this._urlTag&&this._urlTag.find("input").val(o.path);this._nameTag&&this._nameTag.find("input").val(o.name);this._updateSelectionDetails(this._nodeType);this._isClicked&&(!i.target||e&&e.hasClass("e-active")?this._trigger("select",o):(h=this._suggestionItems&&this._suggestionItems.length?i.data.filterPath.replace(this._originalPath,"")+i.data.name:i.data.name,o={name:h,names:[h],path:this.model.selectedFolder,nodeType:y,unselectedItem:i.data,unselectedItems:[i.data]},this._trigger("unselect",o)))},_enableEditingTools:function(){var t,n;if(!this._editingToolsState&&this._toolBarItems){for(t=["Rename","Delete","Cut"],n=0;n<t.length;n++)this._enableToolbarItem(t[n]);this._editingToolsState=!0}},_enableToolbarItem:function(n){if(this._restrictedToolbarOptions.indexOf(n)<0){var t=this._ExplorerId+n.replace(/ /g,"");this._toolBarObj&&this._toolBarObj.itemsContainer.find("li#"+t).hasClass("e-disable")&&this._toolBarObj.enableItemByID(t)}},_disableToolbarItem:function(n){var t=this._ExplorerId+n.replace(/ /g,"");this._toolBarObj&&!this._toolBarObj.itemsContainer.find("li#"+t).hasClass("e-disable")&&this._toolBarObj.disableItemByID(t)},_disableEditingTools:function(){var t,n;if(this._toolBarItems){for(t=["Rename","Delete","Cut"],n=0;n<t.length;n++)this._disableToolbarItem(t[n]);this._editingToolsState=!1}},_clearTileCheckBoxSelection:function(){this.model.showCheckbox&&this._tileView.find(".e-tile-checkbox ").ejCheckBox({checked:!1})},_upDatePathFromTileView:function(t){var b=n(t.target),v,l,s,a,u,y,f,e,o,h,c,w,r,i;if(t.pointerType=="touch"&&this._customPop!=null&&this.model.allowMultiSelection?(this._customPop.is(":visible")||this._customPop.show(),this._customPop.is(":visible")&&!this._customPop.find(".e-rowselect").hasClass("e-spanclicked")?(v=b.offset(),this._customPop.offset({left:v.left-40,top:v.top-40})):t.ctrlKey=!0):this._hidePopup(),this._searchbar&&n.trim(this._searchbar.val())||(this._suggestionItems=[]),t.innerEvent||(this._lastItemIndex=n(t.currentTarget).index()),this._addFocus(this._tileViewWrapper),this._isTreeNode=!1,l=this,this.model.showCheckbox&&(s=n(t.target).closest(".e-tilenode").find(".e-tile-checkbox").data("ejCheckBox"),n(t.target).hasClass("e-chk-image")&&(t.ctrlKey=this.model.showCheckbox)),t.shiftKey){for(this._selectItems=[],this._startNode||(this._startNode=this._currntNode),h=n(t.currentTarget).index(),c=this._startNode.index(),h>c&&(w=h,h=c,c=w),r=this._tileContent.find(".e-tilenode"),r.removeClass("e-active").attr("aria-selected",!1),i=h;i<=c;i++)this._selectItems.push(n(r.get(i)).find(".e-file-name").text());this._setSelectedItems(this._selectItems)}else{if(a=[],t.ctrlKey&&this.model.allowMultiSelection||(this._sizeInByte=0,this._selectedItems=[],this._selectedTileItems=[],n(t.currentTarget).siblings().removeClass("e-active").attr("aria-selected",!1),n(t.currentTarget).removeClass("e-active").attr("aria-selected",!1),this._clearTileCheckBoxSelection(),this._unselectEvent()),n(t.currentTarget).hasClass("e-active")?(n(t.currentTarget).removeClass("e-active").attr("aria-selected",!1),s&&s.option("checked",!1)):(n(t.currentTarget).addClass("e-active").attr("aria-selected",!0),s&&s.option("checked",!0)),u="File",y=!0,this._toDownload=this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0,f=n(t.currentTarget).find(".e-file-name").text(),this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath),r=this._suggestionItems.length?this._suggestionItems:this._fileExplorer[this._originalPath],r)for(i=0;i<r.length;i++)if(r[i].name==f){n(t.currentTarget).hasClass("e-active")?(this._sizeInByte+=r[i].sizeInByte,this._selectedTileItems.push(r[i])):t.ctrlKey&&(this._sizeInByte-=r[i].sizeInByte,e=n.inArray(r[i],this._selectedTileItems),e>-1&&(a.push(this._selectedTileItems[e]),this._selectedTileItems.splice(e,1)));break}if(n.each(this._selectedTileItems,function(n,t){t.isFile||(l._update=!1,y=!1,l._toDownload=!1);l._updateAccessValue(t)}),n(t.currentTarget).find(".e-fe-folder").length&&(u="Directory",n(t.currentTarget).hasClass("e-active")&&this._updateNode(f)),this._currntNode=n(t.currentTarget),this._currntNode.attr("data-parent-path")&&(f=this._currntNode.attr("data-parent-path").replace(this._originalPath,"")+f),this._selectedContent=f,n(t.currentTarget).hasClass("e-active"))this._selectedItems.push(this._selectedContent);else{var e=n.inArray(this._selectedContent,this._selectedItems),p=this._selectedContent,k=u;e>-1&&this._selectedItems.splice(e,1);this._selectedTileItems.length>0&&(this._selectedContent=this._selectedItems[this._selectedItems.length-1],u=this._selectedTileItems[this._selectedTileItems.length-1].type,u=="Directory"&&this._updateNode(this._selectedContent))}this._startNode&&this._selectItems.length!=0&&this._selectItems.length!=this._selectedItems.length||((!this._selectItems||this._selectItems.length<=0)&&(this._startNode=null),this._selectedItemsTag&&this._selectedItemsTag.html((this._selectedItems.length>0?this._selectedItems.length+" "+(this._selectedItems.length>1?this._getLocalizedLabels("Items"):this._getLocalizedLabels("Item"))+" "+this._getLocalizedLabels("Selected"):"")+(this._sizeInByte?y?" "+this._bytesToSize(this._sizeInByte):"":"")),this._nodeType=u,this._setFilteredItemsName(),this.model.selectedItems=this._filteredItemsName,o={name:this._selectedItems,names:this._selectedItems,path:this.model.selectedFolder,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName)},this._urlTag&&this._urlTag.find("input").val(o.url),this._nameTag&&this._nameTag.find("input").val(o.name),this._updateSelectionDetails(this._nodeType),this._isClicked&&(n(t.currentTarget).hasClass("e-active")?this._trigger("select",o):(o={name:p,names:[p],path:this.model.selectedFolder,nodeType:k,unselectedItem:a[0],unselectedItems:a},this._trigger("unselect",o))),this._selectItems=[])}},_setFilteredItemsName:function(){var t,n;for(this._filteredItemsName=[],t=0;t<this._selectedItems.length;t++)n=this._selectedItems[t].split("/"),this._filteredItemsName.push(n[n.length-1]?n[n.length-1]:n[n.length-2])},_getOriginalName:function(n){var t=n.split("/");return t[t.length-1]?t[t.length-1]:t[t.length-2]},_updateNode:function(n){this._currentPath+=n+"/"},_getFileURL:function(){return this._nodeType=="File"?(/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(this._selectedContent)?(this._widthTag&&this._widthTag.show().removeClass("e-hide"),this._heightTag&&this._heightTag.show().removeClass("e-hide")):(this._widthTag&&this._widthTag.hide().addClass("e-hide"),this._heightTag&&this._heightTag.hide().addClass("e-hide")),this._currentPath.replace("~","..")+this._selectedContent):""},_updateData:function(){var n=this._fileExplorer[this._currentPath],t;if(this._selectedItemsTag&&this._selectedItemsTag.html(""),n&&!this._update){this._itemStatus&&this._itemStatus.html(n.length+" "+(n.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")));var i=this.model.gridSettings.columns[0];this._changeActiveSortedoption(i.headerText,!0);this._sorting(i.field,!0,n);t=this._sorteditems;this.model.layout=="grid"?this._renderGridView(t):this._renderTileView(t)}else this._read()},_addChild:function(t,i){var e=[],r,o,u,f;if(t)for(r=0;r<t.length;r++)t[r].isFile||(t[r].id=t[r].name,t[r].spriteCssClass=t[r].permission&&!t[r].permission.Read?"e-fe-icon e-fe-folder e-fe-lock":"e-fe-icon e-fe-folder",e.push(t[r]));this._nodeExpanded=!0;o=i?n(i).closest("li.e-item"):this._treeObj.getSelectedNode();e.length&&this._treeObj.addNode(e,o);u=o.find(".e-load");u&&(u.hasClass("e-plus")||u.hasClass("e-minus")?u.removeClass("e-load"):u.removeClass("e-icon e-load"));this._nodeExpanded=!1;this._treetag.find("li").removeAttr("tabindex");f=this._treetag.find("li div a").not(".e-js");f.length&&this.model.allowDragAndDrop&&(this._drag(f),f.addClass("e-file-draggable"))},_createContextMenuTag:function(i,r,u){var e=n("body").find("#"+r.id+"ContextMenu"),f=e.length?e:t.buildTag("ul.fe-context-menu #"+r.id+"ContextMenu");return f.ejMenu({menuType:t.MenuType.ContextMenu,enableSeparator:!0,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,contextMenuTarget:r.targetId,beforeOpen:u.beforeOpen,open:u.open,close:u.close,click:u.click,fields:{dataSource:i,id:"id",text:"text",htmlAttribute:"htmlAttr",spriteCssClass:"sprite"}}),f.hide(),f},_beforeOpenContextMenu:function(t){if(n(t.target).hasClass("e-text")){if(this._menuNode=n(t.target).closest("li.e-item"),this._treeObj&&this._treeObj.element.find(".e-node-focus").removeClass("e-node-focus"),this._menuNode.find("> div > .e-text:first").addClass("e-node-focus"),t.dataSource=this._treeMenuOptions.slice(),t.contextMenu="navbar",t.element=this._treeMenuObj.element,this._trigger("menuBeforeOpen",t))return!1;JSON.stringify(this._treeMenuObj.model.fields.dataSource)!=JSON.stringify(this._treeMenuOptions)&&this._treeMenuObj.option("fields",{dataSource:t.dataSource});for(var i=0;i<this._restrictedMenuOption.length;i++)this._treeMenuObj&&this._treeMenuObj.disableItem(this._restrictedMenuOption[i]);this._toRead&&this._toEdit?this._enableEditingMenus():this._disableEditingMenus();this._toRead&&this._toCopy?this._restrictedMenuOption.indexOf(this._menuCopy)<0&&this._treeMenuObj.enableItem(this._menuCopy):this._treeMenuObj.disableItem(this._menuCopy);this._toRead?this._restrictedMenuOption.indexOf(this._menuOpen)<0&&this._treeMenuObj.enableItem(this._menuOpen):this._treeMenuObj.disableItem(this._menuOpen);this._toRead&&this._toEditContents?this._restrictedMenuOption.indexOf(this._menuNewFolder)<0&&this._treeMenuObj.enableItem(this._menuNewFolder):this._treeMenuObj.disableItem(this._menuNewFolder);this._toRead&&this._toUpload?this._restrictedMenuOption.indexOf(this._menuUpload)<0&&this._treeMenuObj.enableItem(this._menuUpload):this._treeMenuObj.disableItem(this._menuUpload);n(t.target).parents("li.e-item:first").attr("id")==1&&this._disableEditingMenus()}else t.cancel=!0},_beforeOpenTileContextMenu:function(t){if(n(t.target).closest("th.e-headercell").hasClass("e-col-check")&&this._headCheckObj.wrapper.click(),n(t.target).hasClass("e-scrollbar")||n(t.target).parents().hasClass("e-scrollbar")||n(t.target).closest("th.e-headercell").hasClass("e-col-check")){t.cancel=!0;return}if(!n(t.target).hasClass("e-rowcell")&&!n(t.target).closest("td.e-rowcell").hasClass("e-col-check")&&n(t.target).closest("td.e-rowcell").length>0&&!n(t.target).closest("td.e-rowcell").hasClass("e-active")&&t.events&&(t.events.button==2||t.events.which==3)?this._updateGridSelection(t):(n(t.target).hasClass("e-file-info")||n(t.target).hasClass("e-thumb-image")||n(t.target).closest(".e-thumb-image").length>0||n(t.target).closest(".e-tilenode").length>0)&&n(t.target).closest(".e-chkbox-wrap").length==0&&!n(t.target).closest(".e-tilenode").hasClass("e-active")&&this._updateTileSelection(t),n(t.target).is(".e-tilenode.e-active")||n(t.target).closest(".e-tilenode").hasClass("e-active")||n(t.target).closest("td.e-rowcell").is(".e-active")||(t.events.ctrlKey||t.events.shiftKey||n(t.target).closest("td.e-rowcell").hasClass("e-col-check")||n(t.target).closest(".e-chkbox-wrap").length>0)&&(n(this.items).hasClass("e-active")||n(this.gridItems).find("td").hasClass("e-active"))?(t.dataSource=this._fileMenuOptions.slice(),t.contextMenu="files",t.element=this._viewMenuObj.element):(n(t.events.currentTarget).hasClass("e-grid")&&(n(t.target).hasClass("e-gridcontent")||n(t.target).hasClass("e-content")||n(t.target).hasClass("e-table")||!n(t.target).is(".e-rowcell.e-active"))&&(this._gridObj.clearSelection(),this.model.showCheckbox&&(this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1}))),n(t.events.currentTarget).hasClass("e-tile-wrapper")&&(n(t.target).hasClass("e-tile-wrapper")||n(t.target).hasClass("e-tile-content")||n(t.target).hasClass("e-tileview")||!(n(t.target).is(".e-tilenode.e-active")||n(t.target).parent(".e-tilenode").hasClass("e-active")))&&(this.model.showCheckbox&&this._clearTileCheckBoxSelection(),this.items.hasClass("e-active")&&this.items.removeClass("e-active").attr("aria-selected",!1)),this._updateCurrentPathPermission(),t.dataSource=this._cwdMenuOptions.slice(),t.contextMenu="cwd",t.element=this._viewMenuObj.element),this._trigger("menuBeforeOpen",t))return!1;JSON.stringify(this._viewMenuObj.model.fields.dataSource)!=JSON.stringify(t.dataSource)&&this._viewMenuObj.option("fields",{dataSource:t.dataSource});for(var i=0;i<this._restrictedMenuOption.length;i++)this._viewMenuObj&&this._viewMenuObj.disableItem(this._restrictedMenuOption[i]);this._toRead&&(/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(this.model.selectedItems)||this._nodeType!="File")?this._restrictedMenuOption.indexOf(this._menuOpen)<0&&this._viewMenuObj.enableItem("Open"):this._viewMenuObj&&this._viewMenuObj.disableItem("Open");this._option&&this._toRead||this._viewMenuObj.disableItem(this._menuPaste);this._isupdate?this._restrictedMenuOption.indexOf(this._menuDownload)<0&&this._viewMenuObj.enableItem(this._menuDownload):this._viewMenuObj.disableItem(this._menuDownload);this._searchbar&&n.trim(this._searchbar.val())?this._restrictedMenuOption.indexOf(this._menuOpenFolderLocation)<0&&this._viewMenuObj.enableItem(this._menuOpenFolderLocation):this._viewMenuObj.disableItem(this._menuOpenFolderLocation);this._toRead&&this._toDownload?this._restrictedMenuOption.indexOf(this._menuDownload)<0&&this._viewMenuObj.enableItem(this._menuDownload):this._viewMenuObj.disableItem(this._menuDownload);this._toRead&&this._toUpload?this._restrictedMenuOption.indexOf(this._menuUpload)<0&&this._viewMenuObj.enableItem(this._menuUpload):this._viewMenuObj.disableItem(this._menuUpload);this._toRead&&this._toEdit?this._enableEditingMenus():this._disableEditingMenus();this._toRead&&this._toCopy?this._restrictedMenuOption.indexOf(this._menuCopy)<0&&this._viewMenuObj.enableItem(this._menuCopy):this._viewMenuObj.disableItem(this._menuCopy);this._hasEditContentsPermission(this._originalPath)?this._restrictedMenuOption.indexOf(this._menuNewFolder)<0&&this._viewMenuObj.enableItem(this._menuNewFolder):this._viewMenuObj.disableItem(this._menuNewFolder)},_contextMenuOpen:function(n){if(n.contextMenu=n.model.contextMenuTarget==this._ExplorerId+"_treeView"?"navbar":this.model.selectedItems.length>0?"files":"cwd",n.element=n.contextMenu=="navbar"?this._treeMenuObj.element:this._viewMenuObj.element,n.contextMenu=="cwd")var t=this.model.gridSettings.columns.length;for(i=0;i<t;i++)this._prevsortingoption==this.model.gridSettings.columns[i].field&&this._changeActiveSortedoption(this.model.gridSettings.columns[i].headerText,!1,!0);this._trigger("menuOpen",n)},_removeOldSelectionDetails:function(n){this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath);this._sizeInByte=0;this._selectedItems=[];this._selectedTileItems=[];this.model.selectedItems=[];this._selectedContent=this._selectedTreeText;this._nodeType=n?n:"Directory";this._selectedItemsTag&&this._selectedItemsTag.html("");this._toolBarItems&&this._disableToolbarItem("Download");this._viewMenuObj&&this._viewMenuObj.disableItem(this._menuDownload);this._disableEditingTools()},_contextMenuClick:function(n){this._treeObj.selectNode(this._menuNode);this._fileContextMenuClick(n)},_fileContextMenuClick:function(n){var u,f,i,r;if(this.model.ajaxAction!=""&&this._currentPath!=""){if(n.contextMenu=n.model.contextMenuTarget==this._ExplorerId+"_treeView"?"navbar":this.model.selectedItems.length>0?"files":"cwd",(t.isNullOrUndefined(n.selectedItem)||n.selectedItem.attr("id")!=this._ExplorerId+"_cwd_SortBy")&&(t.isNullOrUndefined(n.element)||n.element.parentElement.parentElement.id!=this._ExplorerId+"_cwd_SortBy"))switch(n.text){case this._menuOpen:this._openAction();break;case this._menuNewFolder:this._createNewFolder();break;case this._menuDelete:this._deleteFolder();break;case this._menuRefresh:this.refresh();break;case this._menuRename:this._renameFolder();break;case this._menuUpload:this.element.find(".e-uploadinput").click();break;case this._menuDownload:this._downloadFile();break;case this._menuCut:this._copyMoveNode("move");break;case this._menuCopy:this._copyMoveNode("copy");break;case this._menuPaste:this._cut_copy();break;case this._menuGetinfo:this._getDetails();break;case this._menuOpenFolderLocation:this._setFilteredItemsName();u=this.model.selectedItems;this._selectedFolder(this._originalPath+this._selectedContent.replace(this._filteredItemsName,""));this._setSelectedItems(u);break;case n.text:f=this.model.contextMenuSettings.customMenuFields;r=this._getCustomItem(f,n.ID);r&&(i=r.action);typeof i=="string"&&(i=t.util.getObject(i,window));i&&i(n)}else this._changeActiveSortedoption(n.text),this._sorting(this._prevsortingoption,this._prevsorting),this._sortingActioncomplete();this._trigger("menuClick",n)}},_createNewFolder:function(){var i=this,r="",c=this._getLocalizedLabels("NewFolderAlert"),e=t.buildTag("div.e-get-name"),l=t.buildTag("div.e-fe-dialog-label",c),u=t.buildTag("input.e-fe-dialog-text e-ejinputtext e-textbox","","",{type:"text"}),o=t.buildTag("div.e-fe-dialog-label e-error-msg");u.val("New folder");var s=t.buildTag("div.e-fe-dialog-btn"),f=t.buildTag("button.e-fe-btn-ok ",this._getLocalizedLabels("OkButton")),h=t.buildTag("button.e-fe-btn-cancel ",this._getLocalizedLabels("CancelButton"));f.ejButton({type:"button",cssClass:"e-flat",click:function(){var f,e,l;if(i._removeDialog(i._newFolderDialogObj),r=u.val(),n.trim(r)||(r="New folder"),i._fileExplorer[i._currentPath]||i._getFileDetails(i._currentPath),f=i._fileExplorer[i._currentPath],f.length)for(e=0;e<f.length;e++)if(f[e].isFile||f[e].name!=r)e==f.length-1&&r&&i._createFolder(r);else{var s=t.buildTag("div.e-get-name"),a=t.buildTag("div.e-fe-dialog-label",String.format(i._getLocalizedLabels("ErrorOnFolderCreation"),r)),h=t.buildTag("div.e-fe-dialog-btn"),o=t.buildTag("button.e-fe-btn-ok ",i._getLocalizedLabels("YesButton")),c=t.buildTag("button.e-fe-btn-cancel ",i._getLocalizedLabels("NoButton"));o.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});c.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj);i._createFolder(i._getDuplicateName(f,"New folder"))}});h.append(o,c);n(s).append(a,h);l=function(){o.focus()};i._alertDialog=i._createDialog(s,{width:400,height:"auto",title:i._getLocalizedLabels("Error"),open:l});i._alertDialogObj=i._alertDialog.data("ejDialog");break}else r&&i._createFolder(r)}});h.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._newFolderDialogObj)}});s.append(f,h);n(e).append(l,u,o,s);this._newFolderDialog=this._createDialog(e,{width:350,height:"auto",open:function(){i._openInputDialog(u,f,o,this)},title:this._getLocalizedLabels("NewFolder")});this._newFolderDialogObj=this._newFolderDialog.data("ejDialog")},_openInputDialog:function(n,t,i,r){var u=this;n.focus();this._isDevice||n.select();(this._isMobileOrTab||this._isDevice)&&r.option("position",{Y:"20%"});n.keyup(function(n){var i=u._getKeyCode(n);i==13&&t.click()});n.keypress(function(n){var t=u._getKeyCode(n);return/[/\\|*?"<>:]/.test(String.fromCharCode(t))?(i.html(u._getLocalizedLabels("InvalidFileName")),!1):!0});n.keydown(function(){i.html("")})},_deleteFolder:function(){var i,f;this._alertWindow=t.buildTag("div#e-fe_deleteAlert");i=this._selectedItems.length>1?String.format(this._getLocalizedLabels("DeleteMultipleFolder"),this._selectedItems.length):this._getLocalizedLabels("DeleteFolder")+this._selectedContent+"?";var e=t.buildTag("div.e-fe-dialog-label",i),r=t.buildTag("div.e-fe-dialog-btn"),n=t.buildTag("button.e-fe-btn-ok",this._getLocalizedLabels("OkButton")),u=t.buildTag("button.e-fe-btn-cancel",this._getLocalizedLabels("CancelButton"));r.append(n,u);this._alertWindow.append(e,r);proxy=this;n.ejButton({type:"button",cssClass:"e-flat",click:function(){proxy._removeDialog(proxy._alertWindowObj);proxy._ajax_folderPath=proxy._nodeType=="Directory"?proxy._getFolderPath():proxy._currentPath;proxy._deletion(proxy._selectedItems.length>1?proxy._selectedItems:proxy._selectedContent,proxy._ajax_folderPath);proxy._disableEditingTools();proxy._disableToolbarItem("Copy")}});u.ejButton({cssClass:"e-flat",type:"button",click:function(){proxy._removeDialog(proxy._alertWindowObj)}});f=function(){n.focus()};this._alertWindow=this._createDialog(this._alertWindow,{width:350,height:"auto",title:this._getLocalizedLabels("Delete"),open:f});this._alertWindowObj=this._alertWindow.data("ejDialog")},_getFileDetails:function(i,u,f,e){var o=this,s={data:{ActionType:"Read",Path:i,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(i),u?u.text():this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(r){if(r=r.hasOwnProperty("d")?r.d:r,!t.isNullOrUndefined(r.error)){o._showErrorDialog(r.error);return}for(var s=0;s<r.files.length;s++)r.files[s].sizeInByte=r.files[s].size,r.files[s].size=r.files[s].size?o._bytesToSize(r.files[s].size):"",r.files[s].cssClass=o._getCssClass(r.files[s]);o._feParent[i]=r.cwd;o._fileExplorer[i]=r.files;u&&o._addChild(o._fileExplorer[i],n(u));f&&(o._sorting(o._prevsortingoption,o._prevsorting,r.files),o.model.layout=="grid"?o._renderGridView(o._sorteditems):o._renderTileView(o._sorteditems),o._updateItemStatus(o._sorteditems));o._highlightedNodes&&!o._suggestionItems.length&&(o._setSelectedItems(o._highlightedNodes),o._highlightedNodes="");o._searchbar&&n.trim(o._searchbar.val())&&o._searchFiles(o._originalPath);e&&typeof e=="function"&&e()},successAfter:this.model.ajaxSettings.read.success};this.model.ajaxSettings.read.success=r;n.extend(!0,s,this.model.ajaxSettings.read);this._sendAjaxRequest(s)},_searchFiles:function(i){var u=this,f={data:{ActionType:"Search",SearchString:this._queryString,Path:i,CaseSensitive:this.model.filterSettings.caseSensitiveSearch,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(i),this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(n){if(n=n.hasOwnProperty("d")?n.d:n,!t.isNullOrUndefined(n.error)){u._showErrorDialog(n.error);return}for(var i=0;i<n.files.length;i++)n.files[i].sizeInByte=n.files[i].size,n.files[i].size=n.files[i].size?u._bytesToSize(n.files[i].size):"",n.files[i].cssClass=u._getCssClass(n.files[i]),n.files[i].filterPath=u._originalPath+n.files[i].filterPath.replace(/\\/g,"/");u._sorting(u._prevsortingoption,u._prevsorting,n.files);u._suggestionItems=n.files=u._sorteditems;u._suggestionItems=n.files;u.model.layout=="grid"?u._renderGridView(n.files):u._renderTileView(n.files);u._updateItemStatus(n.files);u._setSelectedItems(u._highlightedNodes);u._highlightedNodes=""},successAfter:this.model.ajaxSettings.search.success};this.model.ajaxSettings.search.success=r;n.extend(!0,f,this.model.ajaxSettings.search);this._sendAjaxRequest(f)},_getDuplicateName:function(n,t){for(var i=0,r=t;this._isNameExist(n,t);)i++,t=r.split(".")[0]+(i>0?"("+i+")":"")+(t.split(".")[1]?"."+t.split(".")[1]:"");return t},_isNameExist:function(n,t){for(var i=0;n&&i<n.length;i++)if(t==n[i].name)return!0;return!1},_renameFolder:function(){var i=this,c=this._getLocalizedLabels("RenameAlert"),e=t.buildTag("div.e-rename"),l=t.buildTag("div.e-fe-dialog-label",c),r=this._selectedContent.split(".")[0].split("/");r.indexOf("")!=-1&&r.splice(r.indexOf(""),1);var u=t.buildTag("input.e-fe-dialog-text e-ejinputtext e-textbox","","",{type:"text",value:r[r.length-1]}),o=t.buildTag("div.e-fe-dialog-label e-error-msg"),s=t.buildTag("div.e-fe-dialog-btn"),f=t.buildTag("button.e-fe-btn-ok",this._getLocalizedLabels("OkButton")),h=t.buildTag("button.e-fe-btn-cancel",this._getLocalizedLabels("CancelButton"));f.ejButton({cssClass:"e-flat",type:"button",click:function(){var f=u.val(),s=r[r.length-1],o,e,v;if(i._removeDialog(i._renameDialogObj),n.trim(f)&&f!=s)for(i._currentPath=i._nodeType=="Directory"?i._getFolderPath():i._currentPath,i._fileExplorer[i._currentPath]||i._getFileDetails(i._currentPath),o=i._fileExplorer[i._currentPath],i._ajax_person=i._selectedContent.replace(s,f),i._nodeType=="File"&&/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(i._ajax_person)&&(i._updateImages[i._currentPath+i._ajax_person]=(new Date).getTime()),e=0;e<o.length;e++)if(o[e].name==f){i._nodeType=="File"&&(f=i._getDuplicateName(i._fileExplorer[i._currentPath],f),i._ajax_person=i._selectedContent.replace(s,f));var c=t.buildTag("div.e-get-name"),y=t.buildTag("div.e-fe-dialog-label",String.format(i._getLocalizedLabels(i._nodeType=="File"?"DuplicateFileCreation":"ErrorOnFolderCreation"),f)),l=t.buildTag("div.e-fe-dialog-btn"),h=t.buildTag("button.e-fe-btn-ok ",i._getLocalizedLabels("OkButton")),a=t.buildTag("button.e-fe-btn-cancel ",i._getLocalizedLabels("CancelButton"));h.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj);i._nodeType=="File"?i._rename():(i._existingItems=[],i._getDuplicateItems(i._currentPath+i._selectedContent+"/",i._currentPath+f+"/",!0),i._existingItems.length?i._createReplaceConformationDiaolg("_rename","DuplicateAlert"):i._rename())}});a.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});l.append(h,a);n(c).append(y,l);v=function(){h.focus()};i._alertDialog=i._createDialog(c,{width:400,height:"auto",title:i._getLocalizedLabels("Error"),open:v});i._alertDialogObj=i._alertDialog.data("ejDialog");break}else e==o.length-1&&i._rename()}});h.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._renameDialogObj)}});s.append(f,h);n(e).append(l,u,o,s);this._renameDialog=this._createDialog(e,{width:350,height:"auto",open:function(){i._openInputDialog(u,f,o,this)},title:this._getLocalizedLabels("Rename")});this._renameDialogObj=this._renameDialog.data("ejDialog")},_isSelectedFile:function(n,t){for(var i=0;i<n.length;i++)if(t==n[i])return!0;return!1},_refreshItems:function(t,i,r){var e,f,u,o;if(this._treeObj){for(t=n(t),!this._treeObj.isExpanded(t)&&this._treeObj.hasChildNode(t)&&this._treeObj.expandNode(t),this._fileExplorer[i]="",e=this,n.each(e._fileExplorer,function(n){n.startsWith(i)&&(e._fileExplorer[n]="")}),f=t.find("ul:first > li"),u=0;u<f.length;u++)t.find(f[u]).length&&this._treeObj.removeNode(n(f[u]));o=t.find(".e-process");o.length&&o.removeClass("e-process");this._getFileDetails(i,t.find("> div > .e-text"),!0,r)}else this._currentPath=this.model.path,this._read()},_getDuplicateItems:function(n,t,i){var r,f,e,u;if(this._fileExplorer[t]||this._getFileDetails(t),r=this._fileExplorer[t],this._fileExplorer[n]||this._getFileDetails(n),f=this._fileExplorer[n],f&&r)for(e=0;e<f.length;e++)for(u=0;u<r.length;u++)f[e].name==r[u].name&&(i==!0||this._isSelectedFile(i,r[u].name))&&(this._existingItems[this._existingItems.length]={Name:r[u].name,Path:t+r[u].name+(r[u].isFile?"":"/"),IsReplace:!0},r[u].isFile||this._getDuplicateItems(n+f[e].name+"/",t+r[u].name+"/",!0))},_backward:function(){var i;if(this._currentState>0){var n=!0,t=0;for(this._isStateNavigation=!0,i=this._currentState,--this._currentState;this._selectedStates[this._currentState]==""||this._selectedStates[this._currentState]==this._selectedStates[i];)this._currentState?--this._currentState:n=!1;n&&this._selectedFolder(this._selectedStates[this._currentState]);this._isStateNavigation=!1;(this._currentState==t||this._selectedStates.length-2==this._currentState)&&this._toolBarItems&&this._enableToolbarItem("Forward");this._currentState==t&&this._toolBarItems&&this._disableToolbarItem("Back")}},_forward:function(){var t;if(this._currentState+1<this._selectedStates.length){var n=!0;for(this._isStateNavigation=!0,t=this._currentState,++this._currentState;this._selectedStates[this._currentState]==""||this._selectedStates[this._currentState]==this._selectedStates[t];)this._currentState<this._selectedStates.length-1?++this._currentState:n=!1;n&&this._selectedFolder(this._selectedStates[this._currentState]);this._isStateNavigation=!1;this._selectedStates.length-1==this._currentState&&this._toolBarItems&&this._disableToolbarItem("Forward");this._currentState==0&&this._toolBarItems&&this._disableToolbarItem("Back");this._currentState==1&&this._toolBarItems&&this._enableToolbarItem("Back")}},_copyMoveNode:function(n){var t,i;n=="move"&&(this.element.find(".e-blur").removeClass("e-blur"),t=this.element.find(".e-splitter .e-active"),t.length&&t.length==1?t.addClass("e-blur"):this.element.find(".e-cont2 .e-active").addClass("e-blur"));this._copiedNodes=this._filteredItemsName;this._option=n;this._sourcePath=this._nodeType=="Directory"?this._getFolderPath():this._currentPath;this._sourceType=this._nodeType;this._fileName=this._selectedItems.length>1?this._selectedItems:this._selectedContent;this._refreshNode=this._originalPath!=this._currentPath?this._findMatchingElement(this._selectedNode.find("ul:first"),this._selectedContent):this._selectedNode;this._toolBarItems&&this._enableToolbarItem("Paste");this.model.showContextMenu&&(this._restrictedMenuOption.indexOf(this._menuPaste)<0&&this._viewMenuObj.enableItem(this._menuPaste),this._restrictedMenuOption.indexOf(this._menuPaste)<0&&this._treeMenuObj.enableItem(this._menuPaste));i={name:this._fileName,sourcePath:this._sourcePath,selectedItems:this._getSelectedItemDetails(this._sourcePath,this._fileName)};n=="move"?this._trigger("cut",i):this._trigger("copy",i)},_openAction:function(){var i,s,r,h,o,u,f,e,a,v;if(this._toRead&&(i=this,this._nodeType=="File"&&(this._selectedFile=this._selectedContent),!this._onBeforeOpen())){if(this._nodeType=="Directory")if(this._suggestionItems.length)this._selectedFolder(this._originalPath+this._selectedContent);else{for(r=this._treeObj.getSelectedNode(),h=this._selectedContent,this._treeObj.isExpanded(r)||this._treeObj&&this._treeObj.expandNode(r),o=r.find("ul:first>li").find("div:first .e-text"),this._treeObj.hasChildNode(r)||(u=this._isTreeNode==!0?this._currentPath:this._currentPath.replace(this._selectedContent+"/",""),this._isTreeNode=!1,this._addChild(this._fileExplorer[u])),f=0;f<o.length;f++)if(n(o[f]).text()==h){this._treeObj.selectNode(o[f].parentNode.parentNode);break}s=this._getSelectedItemDetails(this._getFolderPath(),h);this._selectedItems=[];this._selectedTileItems=[]}else if(this._nodeType=="File"){if(/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(this._selectedFile)){i._openDialog=t.buildTag("div.e-imageViewer","","",{id:i._ExplorerId+"_basicDialog",title:i._selectedFile});var u=i._currentPath.replace("~","..")+this._selectedFile,c=this._getImage(u,this._selectedFile,!1),l=t.buildTag("img","","",{src:c?c:u});n(i._openDialog).append(l);n(i.element).append(i._openDialog);e=new Image;e.onload=e.onabort=e.onerror=function(n){if(n){var t={path:n.target.src,element:n.target,originalArgs:n,action:"open"};i._trigger("getImage",t)}};e.src=l.attr("src");i._openDialog.ejDialog({width:450,height:350,minHeight:200,minWidth:300,maxWidth:"100%",isResponsive:i.model.isResponsive,target:i.element,closeIconTooltip:i._getLocalizedLabels("DialogCloseToolTip"),enableRTL:i.model.enableRTL,showRoundedCorner:i.model.showRoundedCorner,cssClass:i.model.cssClass,close:function(n){i._onDialogClose(n)}}).parents(".e-dialog-wrap").addClass("e-imageViewer-wrap");i._openDialog.css("height","90%");i._openDialogObj=i._openDialog.data("ejDialog")}s=i._getSelectedItemDetails(i._currentPath,i._selectedContent)}a=this._nodeType=="File"?u:this._currentPath;v={path:a,itemType:this._nodeType,selectedItems:s};this._trigger("open",v)}},_getSelectedItemDetails:function(n,t){var f,i,u,r;if(typeof t=="string"&&(t=[t]),f=[],i=this._suggestionItems&&this._suggestionItems.length?this._suggestionItems:this._fileExplorer[n],i)for(u=0;u<t.length;u++)for(r=0;r<i.length;r++)i[r].name==this._getOriginalName(t[u])&&f.push(i[r]);return f},_getDetails:function(){var e=this._nodeType=="Directory"?this._getFolderPath():this._currentPath,i=this,u=typeof this._selectedContent=="string"?[this._selectedContent]:this._selectedContent,f;u[0].endsWith("/")&&(u[0]=u[0].substring(0,u[0].length-1));f={data:{ActionType:"GetDetails",Path:e,Names:u,SelectedItems:this._getSelectedItemDetails(e,this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(u){if(u.hasOwnProperty("d")&&(u=u.d),!t.isNullOrUndefined(u.error)){i._showErrorDialog(u.error);return}var c=t.buildTag("div.e-fe-table"),o=t.buildTag("table"),e,l,s,f,h,a;n.each(u.details[0],function(u,c){e=t.buildTag("tr");l=t.buildTag("td",t.isNullOrUndefined(i._getLocalizedLabels(u))?u:i._getLocalizedLabels(u));s=t.buildTag("td");u=="Name"||u=="Location"?(f=t.buildTag("div"),h=t.buildTag("input.e-readonly","","",{style:"border:none;",type:"text",value:c,title:c,readonly:!0}),h.focus(function(){n(this).blur()}),f.append(h)):u=="Size"?(a=i._bytesToSize(c),f=t.buildTag("span",a+" ("+c+" Bytes)")):f=u=="Permission"?c!=r?t.buildTag("span",i._objToString(c),"",{style:"word-break: break-word;"}):null:t.buildTag("span",c);f!=r&&(u=="Permission"&&n(o).find("tr:last").addClass("e-border"),s.append(f),n(o).append(e),n(e).append(l,s),(u=="Name"||u=="Size")&&e.addClass("e-border"))});n(c).append(o);i._detailsDialog=i._createDialog(c,{width:500,height:"auto",title:i._getLocalizedLabels("Details")});i._detailsDialogObj=i._detailsDialog.data("ejDialog");i._detailsDialogObj.focus()},successAfter:this.model.ajaxSettings.getDetails.success};this.model.ajaxSettings.getDetails.success=r;n.extend(!0,f,this.model.ajaxSettings.getDetails);this._sendAjaxRequest(f,!0)},_objToString:function(n){var i="";for(var t in n)n.hasOwnProperty(t)&&(i+=t+": "+n[t]+", ");return i},_uploadFile:function(){proxy=this.element.find(".e-uploadbox");proxy=proxy.ejUploadbox("instance")},_getFolderPath:function(n){for(var i=n?n.split("/"):this._currentPath.split("/"),r="",t=0;t<i.length-2;t++)r+=i[t]+"/";return r},_renderToolBar:function(){this._crateToolbarTemplate();this._initToolbarItems();var t={};t.click=n.proxy(this._toolBarClick,this);t.cssClass=this.model.cssClass;t.enableRTL=this.model.enableRTL;t.enableSeparator=!0;t.isResponsive=this.model.isResponsive;t.height=t.isResponsive?"":"auto";t.cssClass=this.model.cssClass+" e-fe-toolbar "+(this._isMobileOrTab?"e-fe-mobile":"");t.enableRTL=this.model.enableRTL;this._toolBarItems.ejToolbar(t);this._toolBarObj=this._toolBarItems.ejToolbar("instance");this._isMobileOrTab&&this._toolBarObj.model.isResponsive&&this._toolBarObj._liTemplte.css("max-width",this.element.width());this._disableToolbarItem("Paste");this._disableToolbarItem("Download");this._disableToolbarItem("Back");this._disableToolbarItem("Forward");this._disableEditingTools()},_initToolbarItems:function(){this._toolBarItems.find("#"+this._ExplorerId+"Addressbar").length>0&&this._createAddressBar();this._toolBarItems.find("#"+this._ExplorerId+"Searchbar").length>0&&this._searchDetails();this._toolBarItems.find("#"+this._ExplorerId+"Layout").length>0&&this._renderLayoutDrpdwn();this._toolBarItems.find("#"+this._ExplorerId+"SortBy").length>0&&this._renderSortbyDrpdwn()},_renderSortbyDrpdwn:function(){var f,e,r,u;for(this._showSortbyDDL=t.buildTag("button#"+this._ExplorerId+"_sortby","","",{"data-role":"none",type:"button"}),f=n("<ul id="+this._ExplorerId+"_splitMenu1 class='e-fe-split-context'>"),e=this.model.gridSettings.columns.length,i=0;i<e;i++)f.append(n("<li><a class=' e-arrow-space'><span class='e-icon'><\/span>"+this.model.gridSettings.columns[i].headerText+"<\/a><\/li>"));f.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"SortBy").html(""));r={};u=this;r.height="24px";r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.targetID=this._ExplorerId+"_splitMenu1";r.contentType="imageonly";r.buttonMode="dropdown";r.itemSelected=function(n){u._changeActiveSortedoption(n.text);u._sorting(u._prevsortingoption,u._prevsorting);u._sortingActioncomplete()};r.prefixIcon="e-icon e-fe-sortby";this._showSortbyDDL.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"SortBy").addClass("e-fe-split-button"));this._showSortbyDDL.ejSplitButton(r);this._splitButtonObj1=this._showSortbyDDL.data("ejSplitButton")},_gridupdate:function(n){var i;i=this._prevsorting?"ascending":"descending";t.isNullOrUndefined(this._gridObj)||(this._gridObj.getHeaderTable().find("[ej-mappingname="+n+"]").parent().attr("aria-sort",i),this._gridObj._addSortElementToColumn(n,i))},_changeActiveSortedoption:function(r,u,f){var l,e,a,c,o,s,h;for(f==!0&&(this._prevsorting=!this._prevsorting),l=this.model.gridSettings.columns.length,a=n("#"+this._ExplorerId+"_tileViewContextMenu").find("li").length,j=0;j<a;j++)c=n("#"+this._ExplorerId+"_tileViewContextMenu").find("li")[j],c.id==this._ExplorerId+"_cwd_SortBy"&&(e=n(c).find("ul li"));for(o=n("#"+this._ExplorerId+"_splitMenu1").find("li"),n(e).find("span").removeClass("e-fe-ascending e-fe-descending"),n(o).find("span").removeClass("e-fe-ascending e-fe-descending"),i=0;i<l;i++)if(s=!t.isNullOrUndefined(e)&&e[i],h=!t.isNullOrUndefined(o)&&o[i],contextactiveElement=n(s).find("span"),toolbaractiveElement=n(h).find("span"),!t.isNullOrUndefined(s)&&n(s).text()==r||!t.isNullOrUndefined(h)&&n(h).find("a").text()==r){u?(contextactiveElement.addClass("e-fe-ascending"),toolbaractiveElement.addClass("e-fe-ascending")):this._prevsortingoption==this.model.gridSettings.columns[i].field?this._prevsorting?(contextactiveElement.addClass("e-fe-descending"),toolbaractiveElement.addClass("e-fe-descending")):(contextactiveElement.addClass("e-fe-ascending"),toolbaractiveElement.addClass("e-fe-ascending")):this._prevsorting?(contextactiveElement.addClass("e-fe-ascending"),toolbaractiveElement.addClass("e-fe-ascending")):(contextactiveElement.addClass("e-fe-descending"),toolbaractiveElement.addClass("e-fe-descending"));this._prevsortingoption=this.model.gridSettings.columns[i].field;this._prevsorting=contextactiveElement.hasClass("e-fe-ascending")||toolbaractiveElement.hasClass("e-fe-ascending")?!0:!1;break}},_sorting:function(n,i,r){var c,u,f,e,o,s,h;c=t.isNullOrUndefined(r)?this._searchbar&&this._searchbar.val()!=""?this._suggestionItems.length>=0?this._suggestionItems:this._fileExplorer[this._originalPath]:this._fileExplorer[this._originalPath]:r;u=n=="type"?"name":n=="size"?"sizeInByte":n;f=t.DataManager(c);switch(n){case"type":case"dateModified":i?(e=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortBy(u)),o=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortBy(u)),this._sorteditems=e.concat(o)):(s=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortByDesc(u)),h=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortByDesc(u)),this._sorteditems=s.concat(h));break;case"name":case"size":default:i?(e=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortBy(u)),o=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortBy(u)),this._sorteditems=e.concat(o)):(s=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!1).sortByDesc(u)),h=f.executeLocal(t.Query().where("isFile",t.FilterOperators.equal,!0).sortByDesc(u)),this._sorteditems=h.concat(s))}},_sortingActioncomplete:function(){switch(this.model.layout){case t.FileExplorer.layoutType.Grid:this._gridObj.option("dataSource",this._sorteditems);break;case t.FileExplorer.layoutType.LargeIcons:case t.FileExplorer.layoutType.Tile:default:this._renderTileView(this._sorteditems,!0)}t.isNullOrUndefined(this._selectedItems)||this._selectedItems.length!=1||this._setSelectedItems(this._selectedContent)},_renderLayoutDrpdwn:function(){var f,r,u;for(this._showLayoutDDL=t.buildTag("button#"+this._ExplorerId+"_layout","","",{"data-role":"none",type:"button"}),f=n("<ul id="+this._ExplorerId+"_splitMenu class='e-fe-split-context'>"),this._layoutList=["Tile","Grid","LargeIcons"],i=0;i<this._layoutList.length;i++)f.append(n("<li><a class=' e-arrow-space'><span class='e-icon e-fe-activeicon'><\/span>"+this._getLocalizedLabels(this._layoutList[i])+"<\/a><\/li>"));f.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Layout").html(""));r={};u=this;r.height="24px";r.enableRTL=this.model.enableRTL;r.showRoundedCorner=this.model.showRoundedCorner;r.targetID=this._ExplorerId+"_splitMenu";r.contentType="imageonly";r.buttonMode="dropdown";r.itemSelected=function(n){switch(n.text){case u._getLocalizedLabels("LargeIcons"):u.model.layout="largeicons";break;case u._getLocalizedLabels("Tile"):u.model.layout="tile";break;case u._getLocalizedLabels("Grid"):default:u.model.layout="grid"}u._switchLayoutView()};r.prefixIcon="e-icon e-fe-"+this.model.layout;this._showLayoutDDL.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Layout").addClass("e-fe-split-button"));this._showLayoutDDL.ejSplitButton(r);this._splitButtonObj=this._showLayoutDDL.data("ejSplitButton")},_changeLayoutActive:function(i){if(this._splitButtonObj&&this._splitButtonObj.option("prefixIcon","e-icon e-fe-"+i),this._toolBarItems&&this._toolBarItems.find("#"+this._ExplorerId+"Layout").length>0){n(n("#"+this._ExplorerId+"_splitMenu").find("li span").removeClass("e-fe-activeicon"));switch(i){case t.FileExplorer.layoutType.LargeIcons:n(n("#"+this._ExplorerId+"_splitMenu").find("li")[2]).find("span").addClass("e-fe-activeicon");break;case t.FileExplorer.layoutType.Tile:n(n("#"+this._ExplorerId+"_splitMenu").find("li")[0]).find("span").addClass("e-fe-activeicon");break;case t.FileExplorer.layoutType.Grid:default:n(n("#"+this._ExplorerId+"_splitMenu").find("li")[1]).find("span").addClass("e-fe-activeicon")}}},_createUploadBox:function(){this._uploadtag=t.buildTag("div#"+this._ExplorerId+"FileUpload","",{padding:"0px",height:"0px",width:"0px"});this.element.prepend(this._uploadtag);this._renderUploadBox();this._uploadtag.find(".e-inputbtn").hide();this._uploadtag.find(".e-uploadinput").attr("tabindex",-1)},_searchDetails:function(){this._isWatermark="placeholder"in document.createElement("input");var i=this._getLocalizedLabels("Search");this._searchbar=t.buildTag("input.e-searchBar e-tool-input","",{},{id:this._ExplorerId+"_searchbar",type:"text",placeholder:i});this._searchbar.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Searchbar").html(""));t.browserInfo().name=="msie"&&t.ieClearRemover(this._searchbar[0]);this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ",i,{display:"block"}).insertAfter(this._searchbar));this._on(n("#"+this._ExplorerId+"_searchbar"),"focus",this._inputFocusin);this._on(n("#"+this._ExplorerId+"_searchbar"),"keyup",this._onSearchKeyup)},_setUploadLocalization:function(){n.each(t.FileExplorer.Locale,function(n,i){i.UploadSettings&&(t.Uploadbox.Locale[n]=i.UploadSettings)})},_getLocalizedLabels:function(n){return t.FileExplorer.Locale[this.model.locale]===r||t.FileExplorer.Locale[this.model.locale][n]===r?t.FileExplorer.Locale["en-US"][n]?t.FileExplorer.Locale["en-US"][n]:n:t.FileExplorer.Locale[this.model.locale][n]},_crateToolbarTemplate:function(){this._toolBarItems=t.buildTag("div#"+this._ExplorerId+"_toolbar").prependTo(this.element);for(var n=0;n<this.model.toolsList.length;n++)items=this.model.toolsList[n],t.isNullOrUndefined(this.model.tools[items])||(items=="customTool"?t.isNullOrUndefined(this.model.tools[items])||this._customTools(this.model.tools[items]):this.model.tools[items].length>0&&this._createToolsItems(this.model.tools[items],items))},_createToolsItems:function(i,r){var f=t.buildTag("ul#"+(this._ExplorerId+r)),e,u;for(f.addClass("e-ul-"+r),u=0;u<i.length;u++)e=n("<li id='"+(this._ExplorerId+i[u].replace(/ /g,""))+"' class='e-feItem-"+i[u]+"' title='"+this._getLocalizedLabels(i[u].replace(/ /g,""))+"' ><div class='e-fileexplorer-toolbar-icon "+i[u]+"'><\/div><\/li>"),e.appendTo(f);f.appendTo(this._toolBarItems)},_customTools:function(i){for(var e,f,u,r=0;r<i.length;r++)e=t.buildTag("ul"),f=n("<li id='"+(this._ExplorerId+i[r].name.replace(/ /g,""))+"' title='"+i[r].tooltip+"' ><div class='"+(t.isNullOrUndefined(i[r].css)?"":i[r].css)+"'><\/div><\/li>"),u=i[r].action,typeof u=="string"&&(u=t.util.getObject(u,window)),t.isNullOrUndefined(i[r].action)||this._on(f,"click",u),n(i[r].template).appendTo(f.find("div")),f.appendTo(e),e.appendTo(this._toolBarItems)},_toolBarClick:function(t){var i,r,u;if(this._hidePopup(),i=this,t.event.which&&(t.event.which==3||t.event.which==2)||t.event.button&&t.event.button==2)return!1;if(this.model.ajaxAction!=""&&this._currentPath!=""){this._lastFocusedElement=n(t.currentTarget);r=n(t.currentTarget);u=r.attr("id");switch(u){case this._ExplorerId+"Addressbar":case this._ExplorerId+"Searchbar":this._searchbar&&!this._isWatermark&&(this._searchbar.blur(function(){i._searchbar.val()||i._hiddenSpan.css("display","block")}),this._hiddenSpan.css("display","none"));t.event.type=="keyup"&&r.find("input").focus();break;case this._ExplorerId+"Download":this._downloadFile();break;case this._ExplorerId+"Upward":this._upward();break;case this._ExplorerId+"NewFolder":this._createNewFolder();break;case this._ExplorerId+"Delete":this._deleteFolder();break;case this._ExplorerId+"Rename":this._renameFolder();break;case this._ExplorerId+"Refresh":this._currentPath=this._originalPath;this._highlightedNodes=this.model.selectedItems;this._refreshItems(this._treeObj?this._treeObj.getSelectedNode():"",this._originalPath);break;case this._ExplorerId+"Back":this._backward();break;case this._ExplorerId+"Forward":this._forward();break;case this._ExplorerId+"Cut":this._copyMoveNode("move");break;case this._ExplorerId+"Copy":this._copyMoveNode("copy");break;case this._ExplorerId+"Paste":this._currentPath=this._originalPath;this._cut_copy();break;case this._ExplorerId+"Open":this._openAction();break;case this._ExplorerId+"Details":this._getDetails();break;case this._ExplorerId+"Upload":this.element.find(".e-uploadinput").click()}}},_upward:function(){this._treeObj&&this._treeObj.selectNode(this._treeObj.getSelectedNode().parent().closest("li.e-item"))},_getFilteredList:function(){if(this._suggestionItems=[],n.trim(this._queryString)){switch(this.model.filterSettings.filterType){case t.FileExplorer.filterType.StartsWith:this._queryString=this._queryString+"*";break;case t.FileExplorer.filterType.EndsWith:this._queryString="*"+this._queryString;break;case t.FileExplorer.filterType.Contains:this._queryString="*"+this._queryString+"*"}this._searchFiles(this._originalPath)}else this._suggestionItems=[],this._sorting(this._prevsortingoption,this._prevsorting,this._fileExplorer[this._originalPath]),this.model.layout=="grid"?this._renderGridView(this._sorteditems):this._renderTileView(this._sorteditems),this._updateItemStatus(this._fileExplorer[this._originalPath]);this._gridupdate(this._prevsortingoption)},_updateItemStatus:function(n){n&&this._itemStatus&&this._itemStatus.html(n.length+" "+(n.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")))},_onSearchKeyup:function(n){var t=this,n=n;clearTimeout(this._searchTimer);this._searchTimer=setTimeout(function(){t._validateKeyCode(n)},300)},_validateKeyCode:function(n){var t;switch(n.which){case 38:case 40:case 37:case 39:case 20:case 16:case 17:case 18:case 35:case 36:case 144:break;case 27:this._searchbar&&this._searchbar.val("");this._queryString="";t=this._addresstag.val();this._removeOldSelectionDetails();this._currentPath=this._currentPath.split(t)[0]+t;this._getFilteredList(this._fileExplorer[this._currentPath]);this.model.layout=="grid"?this._addFocus(this._gridtag.find(".e-gridcontent")):this._addFocus(this._tileViewWrapper);break;case 9:case 46:case 8:case 13:default:if(!this.model.filterSettings.allowSearchOnTyping&&n.which==13||this.model.filterSettings.allowSearchOnTyping){this._queryString=n.currentTarget.value;t=this._addresstag.val();this._removeOldSelectionDetails();this._currentPath=this._currentPath.split(t)[0]+t;this._getFilteredList(this._fileExplorer[this._currentPath]);break}}},_onDialogClose:function(){n("body").find("#"+this._ExplorerId+"_basicDialog_wrapper").remove();this._lastFocusedElement&&this._lastFocusedElement.focus()},_switchView:function(n){var i=!1;n.currentTarget.getAttribute("id")==this._ExplorerId+"_swithListView"?this.model.layout!=t.FileExplorer.layoutType.LargeIcons&&(this.model.layout=t.FileExplorer.layoutType.LargeIcons,i=!0):this.model.layout!=t.FileExplorer.layoutType.Grid&&(this.model.layout=t.FileExplorer.layoutType.Grid,i=!0);i&&this._switchLayoutView()},_switchLayoutView:function(n){var i=!1,r=this._sorteditems,u;this._currentPath=this._originalPath;switch(this.model.layout){case t.FileExplorer.layoutType.LargeIcons:case t.FileExplorer.layoutType.Tile:this._gridtag.hide();this._tileContent.parent().show();this._tileViewWrapper.removeClass("e-tileInfo-view");this._statusbar&&(this._statusbar.find(".e-swithListView").removeClass("e-active"),this._statusbar.find(".e-switchGridView").removeClass("e-active"));this.model.layout==t.FileExplorer.layoutType.LargeIcons?this._statusbar&&this._statusbar.find(".e-swithListView").addClass("e-active"):(this._tileViewWrapper.addClass("e-tileInfo-view"),this.items=this._tileView.find("li.e-tilenode"),this._setThumbImageHeight());this._renderTileView(r);i=!0;break;case t.FileExplorer.layoutType.Grid:default:this._tileView&&this._tileContent.parent().hide();this._gridtag.show();this._renderGridView(r);this._statusbar&&(this._statusbar.find(".e-swithListView").removeClass("e-active"),this._statusbar.find(".e-switchGridView").addClass("e-active"));i=!0}this._changeLayoutActive(this.model.layout);i&&(this._updateItemStatus(r),this._setSelectedItems(this.model.selectedItems),u={layoutType:this.model.layout,isInteraction:!n},this._trigger("layoutChange",u))},_wireEvents:function(){this._on(n("#"+this._ExplorerId+"_newFolder"),"click",this._createNewFolder);this._on(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView);this._on(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView);this._on(this.element,"keydown",this._keyDownOnInput);this._on(this._gridtag,"click",this._gridtagClick);this._on(this._tileViewWrapper,"click",this._tileViewWrapperClick);this.model.allowDragAndDrop&&this._toolBarItems&&this._on(this._toolBarItems,"dragover",this._preventDropOption)},_preventDropOption:function(n){n.preventDefault();n.stopPropagation();n.originalEvent.dataTransfer.dropEffect="none"},_onHideContextMenu:function(){this._treeObj&&this._treeObj.element.find(".e-node-focus").removeClass("e-node-focus")},_adjustSize:function(n){this._isWindowResized=n?!0:!1;this.adjustSize()},_closeDialog:function(t){this._unwireDialogEvent(t);n(t.target).closest("div.e-dialog").find(".e-dialog").ejDialog("close")},_searchPath:function(i){var o=this._getKeyCode(i),r;switch(o){case 13:this._searchbar&&this._searchbar.val("");var e=this._addresstag.val(),u=e.split("/"),f=this._treetag;for(r=0;r<u.length;r++)u[r]&&(f=this._findMatchingElement(n(f).children("ul"),u[r]),f.length?this._treetag.ejTreeView("selectNode",f):(this._setSelectedItems([u[r]]),this.model.selectedItems.length?this._openAction():(this._alertDialog=this._createDialog(t.buildTag("div.e-fe-dialog-label",String.format(this._getLocalizedLabels("ErrorPath"),e)),{width:400,height:"auto",title:this._getLocalizedLabels("Error")}),this._alertDialogObj=this._alertDialog.data("ejDialog"))));break;case 27:i.preventDefault();this._updateAddressBar();this._toolBarItems.focus()}},_addressbarFocusout:function(){this._updateAddressBar()},_createDialog:function(i,r){var u=this,f=t.buildTag("div#"+this._ExplorerId+"_basicDialog.e-fe-dialog");return n(i).css("overflow","hidden"),n(f).append(i),f.ejDialog({title:r.title?r.title:"",width:r.width,maxWidth:"100%",isResponsive:u.model.isResponsive,target:u.element,closeIconTooltip:u._getLocalizedLabels("DialogCloseToolTip"),height:r.height,enableModal:!0,showHeader:!0,enableResize:!1,enableAnimation:!1,allowKeyboardNavigation:u.model.allowKeyboardNavigation,enableRTL:u.model.enableRTL,showRoundedCorner:u.model.showRoundedCorner,cssClass:this.model.cssClass+" e-fe-dialog",open:r.open,close:function(n){u._onDialogClose(n)}}),f},_showErrorDialog:function(n){this._alertDialog=this._createDialog(t.buildTag("div.e-fe-dialog-label",n),{width:400,height:"auto",title:this._getLocalizedLabels("Error")});this._alertDialogObj=this._alertDialog.data("ejDialog")},_findMatchingElement:function(t,i){return n(t).children("li").filter(function(){if(n(this).find(".e-text:first").text()==i)return n(this)})},_getKeyCode:function(n){return n.keyCode?n.keyCode:n.which?n.which:n.charCode},_keyDownOnInput:function(i){var f,r,u,i;if(!n(i.target).hasClass("e-tool-input")&&(f=this._getKeyCode(i),this.model.allowKeyboardNavigation)&&!this._KeydownEventHandler(i))switch(f){case 49:i.shiftKey&&i.ctrlKey&&this.model.showToolbar&&(i.preventDefault(),this._addFocus(this._toolBarItems));break;case 50:i.shiftKey&&i.ctrlKey&&this.model.showNavigationPane&&(i.preventDefault(),this._addFocus(this._treetag));break;case 51:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._addFocus(n(this._splittag.find(".e-splitbar")[0])));break;case 52:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._changeLayout(t.FileExplorer.layoutType.Grid));break;case 53:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._changeLayout(t.FileExplorer.layoutType.Tile));break;case 54:i.shiftKey&&i.ctrlKey&&(i.preventDefault(),this._changeLayout(t.FileExplorer.layoutType.LargeIcons));break;case 55:i.shiftKey&&i.ctrlKey&&this.model.showFooter&&(i.preventDefault(),this._addFocus(this._statusbar));break;case 65:if(i.ctrlKey)if(i.preventDefault(),this.model.layout=="grid")r=this.gridItems,this._gridObj.clearSelection(),this._removeOldSelectionDetails(),this._addFocus(this._gridtag.find(".e-gridcontent")),this._gridObj.selectRows(0,r.length-1,n(r[r.length-1]).find("td:first"));else for(r=this.items,this.items.hasClass("e-active")&&this.items.removeClass("e-active").attr("aria-selected",!1),this._removeOldSelectionDetails(),this._addFocus(this._tileViewWrapper),u=0;u<r.length;u++)i={keyCode:91,ctrlKey:!0,currentTarget:r[u],target:r[u]},this._upDatePathFromTileView(i);break;case 78:i.altKey&&this._hasEditContentsPermission(this._originalPath)&&(i.preventDefault(),this._createNewFolder());break;case 85:i.ctrlKey&&this._toUpload&&(i.preventDefault(),this.element.find(".e-uploadinput").click());break;case 116:i.preventDefault();this._currentPath=this._originalPath;this._highlightedNodes=this.model.selectedItems;this._refreshItems(this._treeObj?this._treeObj.getSelectedNode():"",this._originalPath)}},_changeLayout:function(n){this.model.layout!=n&&(this.model.layout=n,this._removeFocus(),this._switchLayoutView(n));this._focusLayout(n)},_focusLayout:function(n){switch(n){case t.FileExplorer.layoutType.Grid:this._addFocus(this._gridtag.find(".e-gridcontent"));break;case t.FileExplorer.layoutType.Tile:case t.FileExplorer.layoutType.LargeIcons:default:this._addFocus(this._tileViewWrapper)}},_getFocusedElement:function(){var t=this.element.find(".e-focus");return t?t:n(":focus")},_addFocus:function(n){n.hasClass("e-focus")||(this._removeFocus(),n.focus())},_removeFocus:function(){var n=this._getFocusedElement();n.length>0&&n.blur()},_subControlsSetModel:function(n,t){var i={};i[n]=t;this._treeObj&&this._treeObj.option(n,t);this._downloadDialogObj&&this._downloadDialogObj.isOpen()&&this._downloadDialogObj.option(n,t);this._newFolderDialogObj&&this._newFolderDialogObj.isOpen()&&this._newFolderDialogObj.option(n,t);this._renameDialogObj&&this._renameDialogObj.isOpen()&&this._renameDialogObj.option(n,t);this._openDialogObj&&this._openDialogObj.isOpen()&&this._openDialogObj.option(n,t);this._detailsDialogObj&&this._detailsDialogObj.isOpen()&&this._detailsDialogObj.option(n,t);this._alertDialogObj&&this._alertDialogObj.isOpen()&&this._alertDialogObj.option(n,t);this._alertWindowObj&&this._alertWindowObj.isOpen()&&this._alertWindowObj.option(n,t);this._treeContextMenutag&&this._treeMenuObj.option(n,t);this._tileContextMenutag&&this._viewMenuObj.option(n,t);this._toolBarObj&&this._toolBarObj.option(n,t);this._uploadtag&&this._uploadtag.data("ejUploadbox").option(n,t);this._splitObj&&this._splitObj.option(n,t);this._splitButtonObj&&this._splitButtonObj.option(n,t);this._splitButtonObj1&&this._splitButtonObj1.option(n,t);this._statusbar.find("button").length&&this._statusbar.find("button").ejButton(i);this._headCheckObj&&this._headCheckObj.option(n,t);this._tileView.find(".e-tile-checkbox").length&&this._tileView.find(".e-tile-checkbox").ejCheckBox(i);this._gridtag.find(".e-grid-row-checkbox").length&&this._gridtag.find(".e-grid-row-checkbox").ejCheckBox(i)},_removeDialog:function(n){n.close();var t=n._overLay;t&&t.remove();n._ejDialog.remove()},_reSizeHandler:function(){if(this._splitterCorrection(),this.model.ajaxAction!=""&&this._currentPath!=""){if(this.model.layout=="grid"){var n=this._splittag.outerHeight()-this._gridtag.find(".e-gridheader").outerHeight();this._gridObj&&this._gridObj.option("scrollSettings",{height:this.model.showFooter?n-this._statusbar.outerHeight():n,width:this._splittag.find(".e-cont2").width()})}else this._tileScroll&&this._tileScroll.option("width",parseInt(this._splittag.find(".e-cont2").width())),this._setThumbImageHeight();this._treeScroll&&this._treeScroll.option("width",parseInt(this._splittag.find(".e-cont1").width()));this._waitingPopup&&this._waitingPopup.refresh()}},_splitterCorrection:function(){var n=this._splittag.find(this.model.enableRTL?".e-cont2":".e-cont1").width()-1;this._splittag.find(".e-split-divider").css("left",n).css("z-index",1)},_findCommand:function(t,i,r){var u=this;return n.each(i,function(n,i){for(var f=0,e=i.length;f<e;f++)if(i[f].toLowerCase()==t.toLowerCase())return t=r?u["_menu"+i[f]]:i[f],!1}),t},_getElement:function(t){return typeof t=="string"&&(t=this._findCommand(t,this.model.tools)),typeof t!="object"&&(t=typeof t=="string"?this._toolBarObj.itemsContainer.find("li#"+t).length>0?this._toolBarObj.itemsContainer.find("li#"+t):this._toolBarObj.itemsContainer.find("li#"+this._ExplorerId+t.replace(/ /g,"")):this._toolBarObj.itemsContainer.find("li").eq(t)),t=n(t),n(t[0])},_updateToolbar:function(){this._renderToolBar();this._selectedStates.length>=2&&this._enableToolbarItem("Back");this._updateAddressBar();this._selectedItems.length>0&&this._toRead&&(this._toDownload&&this._enableToolbarItem("Download"),this._enableEditingTools(),this._toCopy&&this._enableToolbarItem("Copy"));t.isNullOrUndefined(this._fileName)||this._fileName==""||this._toRead&&this._enableToolbarItem("Paste")},_enableEditingMenus:function(){for(var t=[this._menuRename,this._menuDelete,this._menuCut],n=0;n<t.length;n++)this._restrictedMenuOption.indexOf(t[n])<0&&(this._viewMenuObj&&this._viewMenuObj.enableItem(t[n]),this._treeMenuObj&&this._treeMenuObj.enableItem(t[n]))},_disableEditingMenus:function(){for(var t=[this._menuRename,this._menuDelete,this._menuCut],n=0;n<t.length;n++)this._viewMenuObj&&this._viewMenuObj.disableItem(t[n]),this._treeMenuObj&&this._treeMenuObj.disableItem(t[n])},_updateSelectionDetails:function(n){this._selectedItems.length==0?this._removeOldSelectionDetails(n):(this._updateToolbarItems(),this._updateNewFolderTool(this._hasEditContentsPermission(this._originalPath)))},_updatePasteTool:function(){this._toolBarItems&&(this._option&&this._toRead?this._enableToolbarItem("Paste"):this._disableToolbarItem("Paste"))},_updateAccessRules:function(n){var t=this._feParent[n];this._updateAccessValue(t)},_updateAccessValue:function(n){t.isNullOrUndefined(n)||t.isNullOrUndefined(n.permission)||(n.permission.Copy||(this._toCopy=!1),n.permission.Download||(this._toDownload=!1),n.permission.Edit||(this._toEdit=!1),n.permission.EditContents||(this._toEditContents=!1),n.permission.Read||(this._toRead=!1),n.permission.Upload||(this._toUpload=!1))},_updateToolbarItems:function(){this._toolBarItems&&(this._toRead&&this._toDownload?this._enableToolbarItem("Download"):this._disableToolbarItem("Download"),this._toRead&&this._toUpload?this._enableToolbarItem("Upload"):this._disableToolbarItem("Upload"),this._toRead&&this._toEdit?this._enableEditingTools():this._disableEditingTools(),this._toRead&&this._toCopy?this._enableToolbarItem("Copy"):this._disableToolbarItem("Copy"),this._updatePasteTool())},_getFilePermission:function(n){return this._feParent[n]?this._feParent[n].permission:null},_updateCurrentPathPermission:function(){this._removeOldSelectionDetails();this._toDownload=!1;this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0;this._updateAccessRules(this._originalPath);this._toolBarItems&&(this._toUpload?this._enableToolbarItem("Upload"):this._disableToolbarItem("Upload"));this._updateNewFolderTool(this._hasEditContentsPermission(this._originalPath));this._disableToolbarItem("Copy");this._updatePasteTool()},_updateNewFolderTool:function(n){this._toolBarItems&&(n?this._enableToolbarItem("NewFolder"):this._disableToolbarItem("NewFolder"))},_hasEditContentsPermission:function(n){var t=this._getFilePermission(n);return t?t.Read&&t.EditContents?!0:!1:!0},_hasReadPermission:function(n){var t=this._getFilePermission(n);return t&&!t.Read?!1:!0},_unwireEvents:function(){this._off(n("#"+this._ExplorerId+"_newFolder"),"click",this._createNewFolder);this._off(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView);this._off(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView);this._addressBarEvents("_off");this._off(n("#"+this._ExplorerId+"_searchbar"),"focus",this._inputFocusin);this._off(n("#"+this._ExplorerId+"_searchbar"),"keyup",this._onSearchKeyup);this._off(this.element,"keydown",this._keyDownOnInput);this._off(this._gridtag,"click");this._off(this._tileViewWrapper,"click");this.model.isResponsive&&this._off(n(window),"resize",this._adjustSize);this._toolBarItems&&this._off(this._toolBarItems,"dragover",this._preventDropOption)},_wireResizing:function(){this.model.isResponsive?this._on(n(window),"resize",this._adjustSize):this._off(n(window),"resize",this._adjustSize)},adjustSize:function(){this._ensureResolution();!this._isWindowResized&&this.model.showToolbar&&this.model.isResponsive&&this._toolBarObj._reSizeHandler();this._isWindowResized=!1;this._splittag.css("height",this.element.height()-(this.model.showToolbar&&this._toolBarItems?this._toolBarItems.outerHeight():0));var n=this._splittag.outerHeight()-(this.model.showFooter?this._statusbar.outerHeight():0);this._tileContent&&this._tileContent.parent(".e-tile-wrapper").height(n);this._tileScroll&&this._tileScroll.option("height",n);this._gridtag&&this._gridtag.height(n);this._splitObj&&this._splitObj._windowResized();this._treeScroll&&this._treeScroll.option("height",this._splittag.height());this._reSizeHandler()},refresh:function(){this._refreshItems(this._selectedNode,this._currentPath)},enableToolbarItem:function(n){this._removeRestrictedToolItem(n);n=this._getElement(n);n[0]!=null&&this._toolBarObj&&this._toolBarObj.enableItem(n)},disableToolbarItem:function(n){if(n=this._getElement(n),n[0]!=null&&this._toolBarObj){var t=n.attr("id").replace(this._ExplorerId,"");this._restrictedToolbarOptions.push(t);this._toolBarObj.disableItem(n)}},removeToolbarItem:function(n){this._removeRestrictedToolItem(n);n=this._getElement(n);n[0]!=null&&this._toolBarObj&&this._toolBarObj.removeItem(n)},_removeRestrictedToolItem:function(n){for(var i=typeof n=="string"?n:n.attr("id").replace(this._ExplorerId,""),t=0;t<this._restrictedToolbarOptions.length;t++)if(this._restrictedToolbarOptions[t]==i){this._restrictedToolbarOptions.splice(t,1);break}},_onThumbStart:function(t){var i=n(t.originalEvent.target);if(i.hasClass("e-draggable")||i.closest(".e-draggable").length)return t.cancel=!0,!1}});t.FileExplorer.Locale={};t.FileExplorer.Locale["en-US"]={EmptyFolder:"This folder is empty",ProtectedFolder:"You don't currently have permission to access this folder",EmptyResult:"No items match your search",Back:"Backward",Forward:"Forward",Upward:"Upward",Refresh:"Refresh",Addressbar:"Address bar",Upload:"Upload",Rename:"Rename",Delete:"Delete",Download:"Download",Error:"Error",Cut:"Cut",Copy:"Copy",Paste:"Paste",Details:"Details",Searchbar:"Search bar",Open:"Open",Search:"Search",NewFolder:"New folder",SortBy:"Sort by",Size:"Size",RenameAlert:"Please enter new name",NewFolderAlert:"Please enter new folder name",ContextMenuOpen:"Open",ContextMenuNewFolder:"New folder",ContextMenuDelete:"Delete",ContextMenuRename:"Rename",ContextMenuUpload:"Upload",ContextMenuDownload:"Download",ContextMenuCut:"Cut",ContextMenuCopy:"Copy",ContextMenuPaste:"Paste",ContextMenuGetinfo:"Get info",ContextMenuRefresh:"Refresh",ContextMenuOpenFolderLocation:"Open folder location",Item:"item",Items:"items",Selected:"selected",ErrorOnFolderCreation:"This destination already contains a folder named '{0}'. Do you want to merge this folder content with already existing folder '{0}'?",InvalidFileName:"A file name can't contain any of the following characters: \\/:*?\"<>|",GeneralError:"Please see browser console window for more information",ErrorPath:"FileExplorer can't find '{0}'. Check the spelling and try again.",ReplaceAlert:"File named '{0}' already exists. Replace old file with new one?",DuplicateAlert:"There is already a file with the same name '{0}'. Do you want to create file with duplicate name",DuplicateFileCreation:"There is already a file with the same name in this location. Do you want to rename '{0}' to '{1}'?",DeleteFolder:" Are you sure you want to delete ",DeleteMultipleFolder:"Are you sure you want to delete these {0} items?",CancelPasteAction:"The destination folder is a subfolder of source folder.",OkButton:"OK",ContextMenuSortBy:"Sort by",CancelButton:"Cancel",YesToAllButton:"Yes to all",NoToAllButton:"No to all",YesButton:"Yes",NoButton:"No",SkipButton:"Skip",Grid:"Grid view",Tile:"Tile view",LargeIcons:"Large icons",Name:"Name",Location:"Location",Type:"Item type",Layout:"Layout",Created:"Created",Accessed:"Accessed",Modified:"Modified",Permission:"Permission",DialogCloseToolTip:"Close",UploadSettings:{buttonText:{upload:"Upload",browse:"Browse",cancel:"Cancel",close:"Close"},dialogText:{title:"Upload Box",name:"Name",size:"Size",status:"Status"},dropAreaText:"Drop files or click to upload",filedetail:"The selected file size is too large. Please select a file within the valid size.",denyError:"Files with #Extension extensions are not allowed.",allowError:"Only files with #Extension extensions are allowed.",cancelToolTip:"Cancel",removeToolTip:"Remove",retryToolTip:"Retry",completedToolTip:"Completed",failedToolTip:"Failed",closeToolTip:"Close"}};t.FileExplorer.filterType={StartsWith:"startswith",Contains:"contains",EndsWith:"endswith"};t.FileExplorer.layoutType={Tile:"tile",Grid:"grid",LargeIcons:"largeicons"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejCaptcha","ej.Captcha",{element:null,model:null,validTags:["div"],_setFirst:!1,_rootCSS:"e-captcha",defaults:{enablePattern:!0,targetInput:"",targetButton:"",height:50,width:150,characterSet:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",maximumLength:8,minimumLength:4,enableCaseSensitivity:!0,enableAutoValidation:!1,encryptedCode:"",customErrorMessage:"Invalid Captcha",showAudioButton:!1,showRefreshButton:!1,locale:"en-US",enableRTL:!1,requestMapper:"",refreshBegin:"",refreshSuccess:"",refreshFailure:"",refreshComplete:"",mapper:"",hatchStyle:"BackwardDiagonal"},dataTypes:{targetInput:"string",targetButton:"string",height:"number",width:"number",characterSet:"string",maximumLength:"number",minimumLength:"number",enableCaseSensitivity:"boolean",enableAutoValidation:"boolean",encryptedCode:"string",customErrorMessage:"string",requestMapper:"string",showAudioButton:"boolean",locale:"string",showRefreshButton:"boolean",enableRTL:"boolean",mapper:"string",hatchStyle:"enum",enablePattern:"boolean"},_updateLocalConstant:function(){this._localizedLabels=t.getLocalizedConstants("ej.Captcha",this.model.locale)},_getLocalizedLabels:function(n){return this._localizedLabels[n]===i?t.Captcha.Locale["en-US"][n]:this._localizedLabels[n]},_init:function(){this._initialize();this._wireEvents()},_initialize:function(){this._updateLocalConstant();n("#"+this._id+"_RefreshButton").ejButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly",prefixIcon:"e-icon e-captcha e-reload",type:"button"});n("#"+this._id+"_PlayAudio").ejButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly",prefixIcon:"e-icon e-captcha e-volume-up",type:"button"});n("#"+this._id+"_ValidText").attr("placeholder",this._getLocalizedLabels("placeHolderText"));this._control=n("#"+this._id).get(0);this.model.targetInput||(this.model.targetInput=this._id+"_ValidText");this._target=n("#"+this.model.targetInput).get(0);this._captchaImage=n("#"+this._id+"_CaptchaImage").get(0);this._message=n("#"+this._id+"_CaptchaMessage").get(0);this._refreshButton=n("#"+this._id+"_RefreshButton").get(0);this._form=n(this._target).parents("form")[0];this._audioObject=n("#"+this._id+"_AudioObject").get(0);this._audioButton=n("#"+this._id+"_PlayAudio").get(0);this._audioPluginObject=null;this._audioType="audio/wav";t.isNullOrUndefined(this.model.targetButton)||this.model.targetButton===""||(this._submitButton=n("#"+this.model.targetButton).get(0),this._submitButton||(this._submitButton=n("[id$='"+this.model.targetButton+"']").get(0)));this._hiddenField=n("#"+this._id+"_Hidden").get(0);this._audioObject&&(this._isSupportAudio(this._audioType)||this._appendAudioPlugin())},_wireEvents:function(){if(this._FormSubmitDelegate=n.proxy(this.formSubmit,this),this._CaptchaRefreshDelegate=n.proxy(this.refresh,this),this._PlayAudioDelegate=n.proxy(this.playAudio,this),this._audioButton)n(this._audioButton).on("click",this._PlayAudioDelegate);if(this._submitButton)n(this._submitButton).on("click",this._FormSubmitDelegate);if(this._refreshButton)n(this._refreshButton).on("click",this._CaptchaRefreshDelegate)},_unwireEvents:function(){this._audioButton&&n(this._audioButton).off("click",this._PlayAudioDelegate);this._submitButton&&n(this._submitButton).off("click",this._FormSubmitDelegate);this._refreshButton&&n(this._refreshButton).off("click",this._CaptchaRefreshDelegate)},playAudio:function(){try{this._audioPluginObject?this._audioPluginObject.Play():this._audioObject&&this._audioObject.play&&this._audioObject.play()}catch(n){}},_isSupportAudio:function(n){return document.createElement("audio").canPlayType?document.createElement("audio").canPlayType(n).match(/maybe|probably/i)?!0:!1:!1},_appendAudioPlugin:function(){n(this._audioPluginObject).remove();var t=this._createAudioPluginObject();this._audioObject.parentNode.appendChild(t);this._audioPluginObject=n("#"+this._id+"_AudioPlugin").get(0)},_createAudioPluginObject:function(){var n=document.createElement("embed");return n.setAttribute("id",this._id+"_AudioPlugin"),n.setAttribute("src",this.model.audioUrl),n.setAttribute("name","AudioPlugin"),n.setAttribute("enablejavascript","true"),n.setAttribute("type","audio/wav"),n.setAttribute("autostart","false"),n.setAttribute("pluginspage","http://www.apple.com/quicktime/download/"),n.style.top=0,n.style.left=0,n.style.width="0px",n.style.height="0px",n.style.position="absolute",n},_onSuccess:function(t){var i=t.d?JSON.parse(t.d):t;try{this._audioPluginObject?this._audioPluginObject.Pause():this._audioObject&&this._audioObject.pause&&this._audioObject.pause()}catch(r){}this._captchaImage.src=i.NewChallenge;this._audioObject&&(this._audioObject.src=i.AudioLink);this.model.audioURL=i.AudioLink;this._audioPluginObject&&this._appendAudioPlugin();this.model.isValid=i.Validation=="False"?!1:!0;this.model.enableAutoValidation&&this._displayMessages();n("#"+this._id+"_ValidText")&&n("#"+this._id+"_ValidText").val("");this.model.encryptedCode=i.Script;n(this._hiddenField).val(this.model.encryptedCode)},_displayMessages:function(){this.model.isValid?n("#"+this._id+"_CaptchaMessage").html(""):(n("#"+this._id+"_CaptchaMessage").html(this.model.locale=="en-US"?this.model.customErrorMessage:t.Captcha.Locale[this.model.locale].customErrorMessage),n("#"+this._id+"_ValidText").addClass("error"))},_onRefreshSuccess:function(t){var i=t.d?JSON.parse(t.d):t;try{this._audioPluginObject?this._audioPluginObject.Pause():this._audioObject&&this._audioObject.pause&&this._audioObject.pause()}catch(r){}this._captchaImage.src=i.NewChallenge;this._audioObject&&(this._audioObject.src=i.AudioLink);this.model.audioUrl=i.AudioLink;this._audioPluginObject&&this._appendAudioPlugin();this.model.encryptedCode=i.EncryptedText;n(this._hiddenField).val(i.EncryptedText)},formSubmit:function(t){var i=this,r={Height:this.model.height,Width:this.model.width,CharacterSet:this.model.characterSet,MaximumLength:this.model.maximumLength,MinimumLength:this.model.minimumLength,CaseSensitive:this.model.enableCaseSensitivity,ShowRefreshButton:this.model.showRefreshButton,ShowAudioButton:this.model.showAudioButton,EncryptedText:this.model.encryptedCode,ResponseText:n(this._target).val(),Id:this._id,HatchStyle:this.model.hatchStyle,EnablePattern:this.model.enablePattern,RequestType:"CaptchaRequest",ActionType:"Validation"};return n.ajax({type:"POST",url:this.model.requestMapper?this.model.requestMapper:this.model.pathName+"/"+this.model.mapper,data:JSON.stringify({captchaModel:r}),dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(n){n&&i._onSuccess(n);return},error:function(){i._trigger("refreshFailure");return}}),!this.model.isValid&&this.model.enableAutoValidation?(t.preventDefault(),t.stopPropagation(),!1):void 0},refresh:function(){var t=this,i={Height:this.model.height,Width:this.model.width,CharacterSet:this.model.characterSet,MaximumLength:this.model.maximumLength,MinimumLength:this.model.minimumLength,CaseSensitive:this.model.enableCaseSensitivity,EncryptedText:this.model.encryptedCode,ShowRefreshButton:this.model.showRefreshButton,ShowAudioButton:this.model.showAudioButton,Id:this._id,HatchStyle:this.model.hatchStyle,EnablePattern:this.model.enablePattern,RequestType:"CaptchaRequest",ActionType:"Refresh"};if(t._trigger("refreshBegin"))return!1;n.ajax({type:"POST",url:this.model.requestMapper?this.model.requestMapper:this.model.pathName+"/"+this.model.mapper,data:JSON.stringify({captchaModel:i}),dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(n){n&&(t._onRefreshSuccess(n),t._trigger("refreshSuccess"));return},error:function(){t._trigger("refreshFailure");return},complete:function(){t._trigger("refreshComplete");return}})}});t.HatchStyle={None:"none",BackwardDiagonal:"backwardDiagonal",Cross:"cross",DarkDownwardDiagonal:"darkDownwardDiagonal",DarkHorizontal:"darkHorizontal",DarkUpwardDiagonal:"darkUpwardDiagonal",DarkVertical:"darkVertical",DashedDownwardDiagonal:"dashedDownwardDiagonal",DashedHorizontal:"dashedHorizontal",DashedUpwardDiagonal:"dashedUpwardDiagonal",DashedVertical:"dashedVertical",DiagonalBrick:"diagonalBrick",DiagonalCross:"diagonalCross",Divot:"divot",DottedDiamond:"dottedDiamond",DottedGrid:"dottedGrid",ForwardDiagonal:"forwardDiagonal",Horizontal:"horizontal",HorizontalBrick:"horizontalBrick",LargeCheckerBoard:"largeCheckerBoard",LargeConfetti:"largeConfetti",LargeGrid:"largeGrid",LightDownwardDiagonal:"lightDownwardDiagonal",LightHorizontal:"lightHorizontal",LightUpwardDiagonal:"lightUpwardDiagonal",LightVertical:"lightVertical",Max:"max",Min:"min",NarrowHorizontal:"narrowHorizontal",NarrowVertical:"narrowVertical",OutlinedDiamond:"outlinedDiamond",Percent90:"percent90",Wave:"wave",Weave:"weave",WideDownwardDiagonal:"wideDownwardDiagonal",WideUpwardDiagonal:"wideUpwardDiagonal",ZigZag:"zigZag"};t.Captcha.Locale=t.Captcha.Locale||{};t.Captcha.Locale["default"]=t.Captcha.Locale["en-US"]={placeHolderText:"Type the code shown",CustomErrorMessage:"Invalid Captcha"}}(jQuery,Syncfusion),function(n,t){"use strict";var i=function(){function i(n,i){this._heatmap=i?i:null;i&&(i._grid=this);this._rootCSS="e-grid";this.element=null;this.validTags=["div"];this.model=null;this._requiresID=!0;this.keyConfigs={focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",nextPage:"34",previousPage:"33",lastPage:"ctrl+alt+34",firstPage:"ctrl+alt+33",nextPager:"alt+34",previousPager:"alt+33",firstCellSelection:"36",lastCellSelection:"35",firstRowSelection:"ctrl+36",lastRowSelection:"ctrl+35",upArrow:"38",downArrow:"40",rightArrow:"39",leftArrow:"37",moveCellRight:"9",moveCellLeft:"shift+9",selectedGroupExpand:"alt+40",totalGroupExpand:"ctrl+40",selectedGroupCollapse:"alt+38",totalGroupCollapse:"ctrl+38",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40"};this._ignoreOnPersist=["query","isEdit","toolbarClick","queryCellInfo","mergeCellInfo","currentViewData","enableAltRow","enableRTL","contextClick","contextOpen","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","childGrid","summaryRows","toolbarSettings","editSettings","allowMultiSorting","enableAutoSaveOnSelectionChange","locale","allowCellMerging","allowTextWrap","textWrapSettings","cssClass","dataSource","groupSettings.enableDropAreaAnimation","enableRowHover","showSummary","allowGrouping","enableHeaderHover","allowKeyboardNavigation","scrollSettings.frozenRows","scrollSettings.frozenColumns","enableTouch","contextMenuSettings.enableContextMenu","exportToExcelAction","exportToWordAction","exportToPdfAction"];this.ignoreOnExport=["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","editSettings","pageSettings","enableAutoSaveOnSelectionChange","localization","allowScrolling","cssClass","dataSource","groupSettings.enableDropAreaAnimation","enableRowHover","allowSummary","enableHeaderHover","allowKeyboardNavigation"];this.observables=["dataSource","selectedRowIndex","pageSettings.currentPage"];this._tags=[{tag:"columns",attr:["allowEditing","allowFiltering","allowGrouping","allowResizing","allowSorting","cssClass","customAttributes","dataSource","defaultValue","disableHtmlEncode","editTemplate","editType","foreignKeyField","foreignKeyValue","headerTemplateID","headerText","isFrozen","isIdentity","isPrimaryKey","filterBarTemplate","textAlign","templateID","textAlign","headerTextAlign","tooltip","clipMode","validationRules.minlength","validationRules.maxlength","validationRules.range","validationRules.number","validationRules.required","editParams.decimalPlaces",[{tag:"commands",attr:["type","buttonOptions"]}]],content:"template"},{tag:"summaryRows",attr:["showCaptionSummary","showTotalSummary",[{tag:"summaryColumns",attr:["customSummaryValue","dataMember","displayColumn","summaryType","template"]}]]},{tag:"stackedHeaderRows",attr:[[{tag:"stackedHeaderColumns",attr:["headerText","column"]}]]},{tag:"filterSettings.filteredColumns",attr:[]},{tag:"sortSettings.sortedColumns",attr:[]}];this._dataSource=t.util.valueFunction("dataSource");this._selectedRow=t.util.valueFunction("selectedRowIndex");this._currentPage=t.util.valueFunction("pageSettings.currentPage");this.dataTypes={dataSource:"data",query:"data",columns:"array",childGrid:"parent",gridLines:"enum",summaryRows:"array",stackedHeaderRows:"array",toolbarSettings:{toolbarItems:"array",customToolbarItems:"array"},contextMenuSettings:{contextMenuItems:"array",customContextMenuItems:"array",subContextMenu:"array"},selectionSettings:{selectionMode:"array",selectedRecords:"array"},sortSettings:{sortedColumns:"array"},filterSettings:{filteredColumns:"array",filterType:"enum",filterBarMode:"enum"},groupSettings:{groupedColumns:"array"},editSettings:{editMode:"enum",formPosition:"enum",rowPosition:"enum"},searchSettings:{fields:"array"},textWrapSettings:{wrapMode:"enum"}};this.model={allowPaging:!1,showColumnChooser:!1,gridLines:"both",allowSorting:!1,showStackedHeader:!1,selectedRecords:[],stackedHeaderRows:[],allowFiltering:!1,allowMultipleExporting:!1,allowSelection:!0,allowGrouping:!1,showSummary:!1,allowResizing:!1,allowResizeToFit:!1,allowTextWrap:!1,allowCellMerging:!1,enableRowHover:!0,enablePersistence:!1,enableFocusout:!1,selectedRowIndex:-1,allowSearching:!1,enableToolbarItems:!1,enableHeaderHover:!1,allowReordering:!1,allowKeyboardNavigation:!0,allowRowDragAndDrop:!1,enableTouch:!0,columnLayout:"auto",selectionType:"single",dataSource:null,cssClass:"",allowScrolling:!1,locale:"en-US",enableAutoSaveOnSelectionChange:!0,allowMultiSorting:!1,exportToExcelAction:"",exportToWordAction:"",exportToPdfAction:"",_groupingCollapsed:[],editSettings:{allowEditing:!1,showAddNewRow:!1,allowAdding:!1,allowDeleting:!1,editMode:"normal",rowPosition:"top",dialogEditorTemplateID:null,allowEditOnDblClick:!0,externalFormTemplateID:null,inlineFormTemplateID:null,formPosition:"bottomleft",titleColumn:null,showConfirmDialog:!0,showDeleteConfirmDialog:!1},selectionSettings:{selectionMode:["row"],enableToggle:!1,cellSelectionMode:"flow"},pageSettings:{pageSize:12,pageCount:8,currentPage:1,totalPages:null,enableTemplates:!1,showDefaults:!1,template:null,totalRecordsCount:null,enableQueryString:!1,printMode:"allpages"},groupSettings:{showDropArea:!0,showToggleButton:!1,showGroupedColumn:!0,showUngroupButton:!0,enableDropAreaAutoSizing:!0,captionFormat:null,groupedColumns:[]},contextMenuSettings:{enableContextMenu:!1,contextMenuItems:["Add Record","Edit Record","Delete Record","Sort In Ascending Order","Sort In Descending Order","Next Page","Last Page","Previous Page","First Page","Save","Cancel","Grouping","Ungrouping"],customContextMenuItems:[],subContextMenu:[],disableDefaultItems:!1},filterSettings:{filterType:"filterbar",filterBarMode:"immediate",showFilterBarStatus:!0,statusBarWidth:450,showPredicate:!1,filteredColumns:[],enableInterDeterminateState:!0,maxFilterChoices:1e3,enableCaseSensitivity:!1,immediateModeDelay:1500,enableComplexBlankFilter:!0,blankValue:""},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},sortSettings:{sortedColumns:[]},toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},minWidth:0,currentIndex:0,rowDropSettings:{dropMapper:null,dragMapper:null,dropTargetID:null},scrollSettings:{width:"auto",height:0,enableTouchScroll:!0,allowVirtualScrolling:!1,virtualScrollMode:"normal",frozenRows:0,frozenColumns:0,buttonSize:18,autoHide:!1,scrollerSize:18,scrollOneStepBy:57,enableVirtualization:!1},textWrapSettings:{wrapMode:"both"},summaryRows:[],enableRTL:!1,enableAltRow:!0,currentViewData:null,detailsTemplate:null,childGrid:null,keySettings:null,rowTemplate:null,detailsDataBound:null,rowDataBound:null,queryCellInfo:null,mergeCellInfo:null,create:null,actionBegin:null,actionComplete:null,actionFailure:null,beginEdit:null,endEdit:null,endAdd:null,endDelete:null,beforeBatchAdd:null,beforeBatchSave:null,beforeBatchDelete:null,batchAdd:null,batchDelete:null,cellSave:null,cellEdit:null,resizeStart:null,resizeEnd:null,resized:null,load:null,destroy:null,rowSelecting:null,rowSelected:null,cellSelecting:null,cellSelected:null,columnSelecting:null,columnSelected:null,columnDragStart:null,columnDrag:null,columnDrop:null,dataBound:null,recordClick:null,recordDoubleClick:null,templateRefresh:null,rightClick:null,detailsCollapse:null,detailsExpand:null,toolbarClick:null,contextOpen:null,contextClick:null,columns:[],query:null,isEdit:!1,isResponsive:!1,enableResponsiveRow:!1,virtualLoading:null}}return i.prototype._dataSource=t.util.valueFunction("dataSource"),i.prototype._selectedRow=t.util.valueFunction("selectedRowIndex"),i.prototype._currentPage=t.util.valueFunction("pageSettings.currentPage"),i.prototype._mapValues=function(){},i.prototype._createElement=function(i,r){this.element=i.jquery?i:n(i);this.sfType="ej-grid";this.pluginName="ej.Grid";this.model=t.copyObject(!0,{},this.model,r);this.model.keyConfigs=t.copyObject(this.keyConfigs);this.element.addClass("e-grid e-js").data("ej.Grid",this)},i.prototype._init=function(n,i,r){var f,u,e;this._createElement(n,i);!t.isNullOrUndefined(this.model.query)&&this.model.query instanceof t.Query||(this.model.query=t.Query());t.isNullOrUndefined(this.model.parentDetails)||(f=this.model.queryString,u=this.model.foreignKeyField,this.model.query=this.model.query.clone(),e=this.model.parentDetails.parentKeyFieldValue===undefined?"undefined":this.model.parentDetails.parentKeyFieldValue,this.model.query.where(t.isNullOrUndefined(u)?f:u,"equal",e,!0));this._initPrivateProperties();this._initScrolling();this.model.enableResponsiveRow&&this.element.addClass("e-responsive");this._checkForeignKeyBinding();this._checkDataBinding(r);this._refreshScroller({})},i.prototype._checkDataBinding=function(n){var i,u,r,f;if(!this.model.columns.length&&((this._dataSource()==null||!this._dataSource().length)&&!(this._dataSource()instanceof t.DataManager)||this._dataSource()instanceof t.DataManager&&this._dataManager.dataSource.url==undefined&&!this._dataSource().dataSource.json.length)){this._alertDialog.find(".e-content").text(this.localizedLabels.EmptyDataSource);this._alertDialog.ejDialog("open");return}if(this._initialRenderings(),this.model.editSettings.allowDeleting&&this.model.selectionType=="multiple"&&(this.multiDeleteMode=!0),this.initialRender=!0,this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.allowFiltering&&this._isExcelFilter&&this._renderExcelFilter(),this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),this.model.allowGrouping&&this.element.append(this._renderGroupDropArea()),(this.model.toolbarSettings.showToolbar||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&this.element.append(this._renderToolBar()),i=this.model.columns,i&&i.length){if(u=this.model.query._expands,typeof i[0]=="string")for(r=0;r<i.length;r++)i[r]={field:i[r]};for(r=0;r<i.length;r++)i[r].field&&i[r].field.indexOf(".")!==-1&&this._getExpands(i[r].field,u);this.model.query.expand(u);this.commonQuery.expand(u);this._renderAfterColumnInitialize()}this.model.allowPaging&&this.element.append(this._renderGridPager());this.model.contextMenuSettings.enableContextMenu&&this.element.append(this._renderContext());this.model.scrollSettings.allowVirtualScrolling&&(this._loadedJsonData=[],this._prevPage=1);this._dataSource()instanceof t.DataManager?this._dataSource().ready!=undefined?(f=this,this._dataSource().ready.done(function(n){f._initDataSource();f.model.dataSource=t.DataManager(n.result)})):this._initDataSource():(this._ensureDataSource(),this._setForeignKeyData(),this._relationalColumns.length==0&&this._initGridRender(n),this._vRowHeight=Math.floor(this.getRowHeight()));this.model.showColumnChooser&&this._renderColumnChooser()},i.prototype._initialRenderings=function(){var r,i;if(this.model.groupSettings.groupedColumns.length){for(r=[],i=0;i<this.model.sortSettings.sortedColumns.length;i++)t.isNullOrUndefined(this.model.sortSettings.sortedColumns[i].direction)&&(this.model.sortSettings.sortedColumns[i].direction=t.sortOrder.Ascending),r.push(this.model.sortSettings.sortedColumns[i].field);if(this.model.allowGrouping)for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)n.inArray(this.model.groupSettings.groupedColumns[i],r)==-1&&this.model.sortSettings.sortedColumns.push({field:this.model.groupSettings.groupedColumns[i],direction:t.sortOrder.Ascending})}},i.prototype._renderAfterColumnInitialize=function(){this.element.append(this._renderGridHeader())},i.prototype.setGridHeaderContent=function(n){this._gridHeaderContent=n},i.prototype._renderGridHeader=function(){var n=t.buildTag("div.e-gridheader"),r,u,i=t.buildTag("div");return this.model.allowScrolling&&i.addClass("e-headercontent"),this.setGridHeaderContent(n),this.initialRender&&(this.columnsWidthCollection=[],this._hiddenColumns=[],this._hiddenColumnsField=[]),this._visibleColumns=[],this._visibleColumnsField=[],this._disabledGroupableColumns=[],this._fieldColumnNames={},this._headerColumnNames={},this.model.scrollSettings.frozenColumns>0?(r=t.buildTag("div.e-frozenheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(0,this.model.scrollSettings.frozenColumns),!0)),u=t.buildTag("div.e-movableheader",t.buildTag("div.e-movableheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(this.model.scrollSettings.frozenColumns),!1))),i.append(r).append(u)):i.append(this._renderGridHeaderInternalDesign(this.model.columns)),n.html(i),this.model.isResponsive&&n.addClass("e-textover"),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),n},i.prototype.setGridHeaderTable=function(n){this._gridHeaderTable=n},i.prototype._renderGridHeaderInternalDesign=function(i,r){var y=t.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"heatmap"}),c=t.buildTag("thead"),p=t.buildTag("tbody.e-hide"),l=t.buildTag("tr.e-columnheader"),a=n(document.createElement("colgroup")),w=n(document.createElement("tr")),b,u,v,h,s,o;if((this.model.childGrid||this.model.detailsTemplate)&&(l.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),a.append(this._getIndentCol())),this.model.showStackedHeader)for(o=0;o<this.model.stackedHeaderRows.length;o++)b=this._createStackedRow(this.model.stackedHeaderRows[o],r),c.append(b);for(u=0;u<i.length;u++){var e=t.buildTag("th.e-headercell e-default","",{},{role:"columnheader"}),k=document.createElement("td"),f=t.buildTag("div.e-headercelldiv",i[u].headerText===undefined?i[u].headerText=i[u].field:i[u].headerText,{},{"ej-mappingname":i[u].field});if(i[u].disableHtmlEncode&&f.text(i[u].headerText),t.isNullOrUndefined(i[u].headerTooltip)||f.addClass("e-headertooltip"),t.isNullOrUndefined(i[u].tooltip)||f.addClass("e-gridtooltip"),(i[u].clipMode==t.HeatMapGrid.ClipMode.Ellipsis||i[u].clipMode==t.HeatMapGrid.ClipMode.EllipsisWithTooltip)&&f.addClass("e-gridellipsis"),e.append(f),this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&(i[u].allowFiltering==undefined||i[u].allowFiltering===!0)&&(!t.isNullOrUndefined(i[u].field)||i[u].field=="")){if(v="e-filterset",!this.initialRender&&this.model.filterSettings.filteredColumns)for(h=0;h<this.model.filterSettings.filteredColumns.length;h++)this.model.filterSettings.filteredColumns[h].field==i[u].field&&(v="e-filterset e-filteredicon e-filternone");e.append(t.buildTag("div.e-filtericon e-icon "+v));e.addClass("e-headercellfilter");t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this.model.enableRTL&&n(f).css("padding","0 0 0 2em")}s=document.createElement("col");i[u].priority&&n(k).addClass("e-table-priority-"+i[u].priority);w.append(k);l.append(e);a.append(s);i[u].visible===!1?(e.addClass("e-hide")&&n(s).css("display","none"),n.inArray(i[u].headerText,this._hiddenColumns)==-1&&n.inArray(i[u].field,this._hiddenColumnsField)==-1&&(this._hiddenColumns.push(i[u].headerText)&&i[u].field!=(""||undefined)?this._hiddenColumnsField.push(i[u].field):this._hiddenColumnsField.push(i[u].headerText)),n.inArray(i[u].field,this._visibleColumnsField)!=-1&&this._visibleColumnsField.splice(n.inArray(i[u].field,this._visibleColumnsField),1)&&this._visibleColumns.splice(n.inArray(i[u].headerText,this._visibleColumns),1)):(this._visibleColumns.push(i[u].headerText)&&i[u].field!=(""||undefined)?this._visibleColumnsField.push(i[u].field):this._visibleColumnsField.push(i[u].headerText),i[u].visible=!0,n.inArray(i[u].field==""?i[u].headerText:i[u].field,this._hiddenColumnsField)!=-1&&this._hiddenColumnsField.splice(n.inArray(i[u].field==""?i[u].headerText:i[u].field,this._hiddenColumnsField),1)&&this._hiddenColumns.splice(n.inArray(i[u].headerText,this._hiddenColumns),1));this.model.showColumnChooser&&i[u].showInColumnChooser!==!1&&(i[u].showInColumnChooser=!0);this.model.allowResizing&&i[u].allowResizing!==!1&&(i[u].allowResizing=!0);t.isNullOrUndefined(i[u].headerTextAlign)?i[u].textAlign!=undefined?f.css("text-align",i[u].textAlign):this.model.enableRTL&&f.css("text-align",i[u].textAlign="right"):f.css("text-align",i[u].headerTextAlign);i[u].allowResizing===!1&&this._disabledResizingColumns.push(i[u].field);i[u].allowSorting===!1&&this._disabledSortableColumns.push(i[u].field);i[u].allowGrouping===!1&&this._disabledGroupableColumns.push(i[u].field);i[u].allowEditing===!1&&this._disabledEditableColumns.push(i[u].field);t.isNullOrUndefined(i[u].cssClass)||(e.addClass(i[u].cssClass),n(s).addClass(i[u].cssClass));t.isNullOrUndefined(i[u].headerTemplateID)||(f.html(n(i[u].headerTemplateID).hide().html()).parent().addClass("e-headertemplate"),o=n.inArray(i[u].field,this._disabledGroupableColumns),o==-1&&t.isNullOrUndefined(i[u].field)&&this._disabledGroupableColumns.push(i[u].field));this.model.isResponsive&&e.attr("title",this._decode(i[u].headerText));i[u].priority&&(e.attr("data-priority",i[u].priority).addClass("e-table-priority-"+i[u].priority),n(s).addClass("e-table-priority-"+i[u].priority));this.initialRender&&(typeof i[u].width=="string"&&i[u].width.indexOf("%")!=-1?this.columnsWidthCollection.push(parseInt(i[u].width)/100*this.element.width()):this.columnsWidthCollection.push(i[u].width));i[u].width==undefined&&this.model.commonWidth!==undefined&&(this.columnsWidthCollection[u]=this.model.commonWidth);this._fieldColumnNames[i[u].headerText]=i[u].field;this._headerColumnNames[i[u].field]=i[u].headerText}return c.append(l),p.append(w),y.append(a).append(c).append(p),y},i.prototype._decode=function(t){return n("<div/>").html(t).text()},i.prototype._checkForeignKeyBinding=function(){if(this.model.columns.length){var i,r,u,n;for(i=0,r=this.model.columns,u=r.length;i<u;i++)n=r[i],n.hasOwnProperty("foreignKeyField")&&n.dataSource instanceof t.DataManager&&this._relationalColumns.push({field:n.field,key:n.foreignKeyField,value:n.foreignKeyValue,dataSource:n.dataSource});this._$fkColumn=!0}},i.prototype._initScrolling=function(){for(var u,r=[],f=[],e=0,i=0;i<this.model.columns.length;i++)this.model.columns[i].visible===!1&&i<this.model.scrollSettings.frozenColumns&&e++,this.model.columns[i].isFrozen===!0?r.push(this.model.columns[i]):f.push(this.model.columns[i]);(r.length>0&&(u=this.model.scrollSettings.frozenColumns,this.model.columns=n.merge(n.merge([],r),f),this.model.scrollSettings.frozenColumns=r.length,r.length!=u&&u!=0&&(this.model.scrollSettings.frozenColumns=u)),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&(this.model.allowGrouping||this.model.rowTemplate!=null||this.model.detailsTemplate!=null||this.model.childGrid!=null||this.model.scrollSettings.allowVirtualScrolling||this.model.editSettings.editMode=="batch"))||(this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this.model.scrollSettings.enableVirtualization?(this._vRowHeight=Math.floor(this.getRowHeight()+1),this._virtualRowCount=Math.round(this.model.scrollSettings.height/this._vRowHeight)+1,this.model.pageSettings.pageSize<this._virtualRowCount*5&&(this.model.pageSettings.pageSize=this._virtualRowCount*5)):(this.model.pageSettings.pageSize=this.model.pageSettings.pageSize==12?Math.round(this.model.scrollSettings.height/32)+1:this.model.pageSettings.pageSize,this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize))),(this.model.width||this.model.height)&&(this.model.allowScrolling=!0,this.model.width&&(this.model.scrollSettings.width=this.model.width),this.model.height&&(this.model.scrollSettings.height=this.model.height)),this._originalScrollWidth=t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)?this.model.scrollSettings.width:this.model.scrollSettings.previousStateWidth)},i.prototype._initPrivateProperties=function(){this._click=0;this._tabKey=!1;this._gridHeaderTable=null;this._gridWidth=this.element.width();this._id=this.element.attr("id");this._gridRows=null;this._unboundRow=null;this._gridContentTable=null;this._gridContent=null;this._remoteSummaryData=null;this._gridSort=null;this._gridHeaderContent=null;this._gridFooterContent=null;this._gridFooterTable=null;this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0;this._links=null;this._gridPager=null;this._cSortedColumn=null;this._cSortedDirection=null;this._$curSElementTarget=null;this._gridFilterBar=null;this._$curFieldName=null;this._$prevFieldName=null;this._mediaStatus=!1;this._$fDlgIsOpen=!1;this._$menuDlgIsOpen=!1;this._$colType=null;this._$colFormat=null;this._$prevColType=null;this._$prevSElementTarget=null;this._currentFilterColumn=null;this._filteredRecordsCount=null;this._filteredRecords=[];this._validatedColumns=[];this.filterColumnCollection=[];this._previousFilterCount=null;this._excelFilter=null;this._isExcelFilter=this.model.filterSettings.filterType=="excel";this._$fkColumn=!1;this._fkParentTblData=[];this._primaryKeys=[];this._identityKeys=[];this._primaryKeyValues=[];this._modifiedRecords=[];this._addedRecords=[];this._tdsOffsetWidth=[];this._deletedRecords=[];this._disabledToolItems=n();this._validationRules={};this._groupedColumns=[];this._scolumns=[];this._currentJsonData=[];this._groupingColumnIndex=0;this._dataManager=this._dataSource()instanceof t.DataManager?this._dataSource():this._dataSource()!=null?t.DataManager(this._dataSource()):null;this._dataManager!=null&&this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.totalRecordsCount!=null&&this._dataManager.dataSource.json!=null&&this._dataManager.dataSource.json.splice(this.model.pageSettings.totalRecordsCount);this._isRemoteSaveAdaptor=this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.remoteSaveAdaptor;this._isLocalData=!0;this._disabledResizingColumns=[];this._disabledSortableColumns=[];this._disabledGroupableColumns=[];this._disabledFilterableColumns=[];this._disabledEditableColumns=[];this._hiddenColumns=[];this._visibleColumns=[];this._visibleColumnsField=[];this._hiddenColumnsField=[];this._ccVisibleColumns=[];this._ccHiddenColumns=[];this._sortedColumns=[];this.multiSortRequest=!1;this.multiSelectCtrlRequest=!1;this.multiSelectShiftRequest=!1;this._enableSelectMultiTouch=!1;this._enableSortMultiTouch=!1;this._templateRefresh=!1;this.initialRender=!1;this._selectDrag=!1;this._isAddNew=!1;this._fieldColumnNames={};this._headerColumnNames={};this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualPageRecords={};this._queryCellView=[];this._currentPageViews=[];this._virtualLoadedPages=[];this._currentLoadedIndexes=[];this._prevVirtualSort=[];this._prevVirtualFilter=[];this._prevVirtualIndex=0;this._currentVirtualIndex=1;this._virtualRowCount=0;this._virtualSelectedRecords={};this.selectedRowsIndexes=[];this._isReorder=!1;this._searchString="";this._searchCount=null;this.columnsWidthCollection=[];this._Indicator=null;this._resizer=null;this._bulkEditCellDetails={cellValue:null,rowIndex:-1,columnIndex:-1,fieldName:null,_data:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],rowData:null};this.batchChanges={added:[],deleted:[],changed:[]};this._bulkEditTemplate=n();this._confirmDialog=null;this._confirmedValue=!1;this._lastRow=!1;this._isVirtualRecordsLoaded=!1;this._scrollValue=0;this._currentTopFrozenRow=this.model.scrollSettings.frozenRows;this._rowHeightCollection=[];this._scrollObject=null;this._customPop=null;this.selectedRowCellIndexes=[];this._rowIndexesColl=[];this.selectedColumnIndexes=[];this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1;this.commonQuery=n.extend(!0,{},this.model.query);this.phoneMode=this.model.isResponsive&&document.documentElement.clientWidth<360?!0:!1;this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();this._mediaQuery=!1;this._columnChooserList=null;this._$headerCols=null;this._$contentCols=null;this._detailsOuterWidth=null;this._editForm=null;this._cloneQuery=null;this.localizedLabels=this._getLocalizedLabels();this._searchBar=null;this._relationalColumns=[];this._dropDownManager={};this._isUngrouping=!1;this._columnChooser=!1},i.prototype._getLocalizedLabels=function(){return t.getLocalizedConstants("ej.HeatMapGrid",this.model.locale)},i.prototype._initSelection=function(){for(var t=this.model.selectionSettings.selectionMode,n=0;n<t.length;n++)this["_allow"+t[n]+"Selection"]=!0},i.prototype._getSelectedViewData=function(t,i,r){var o=t%this._virtualRowCount,u,f={},e;return u=i?parseInt(n(i).closest("tr").attr("name"),32):r?r:t>1?Math.ceil((t+1)/this._virtualRowCount):1,f.viewIndex=u,this._virtualLoadedRecords[u]&&(f.data=this._virtualLoadedRecords[u][o]),e=t%this._virtualRowCount,f.rowIndex=u*this._virtualRowCount-(this._virtualRowCount-e),f},i.prototype._frozenCell=function(t,i){var r=i,u=0,f=this.getRowByIndex(t);return i>=this.model.scrollSettings.frozenColumns&&(u=1,r=r-this.model.scrollSettings.frozenColumns),n(f.eq(u).find(".e-rowcell:eq("+r+")"))},i.prototype.selectCells=function(i){var r,e,o,c,s,u,h,f;if(!this._allowcellSelection)return!1;r=null;c=this._excludeDetailRows();r=this.model.scrollSettings.frozenColumns?this._frozenCell(i[0][0],i[0][1][0]):c.eq(i[0][0]).find(".e-rowcell:eq("+i[0][1]+")");t.isNullOrUndefined(this._previousRowCellIndex)||this._previousRowCellIndex.length==0||(this.model.scrollSettings.enableVirtualization?(e=this._prevRowCell,o=this._preVirRowCellIndex):(e=n(this.getRowByIndex(this._previousRowCellIndex[0][0]).find(".e-rowcell:eq("+this._previousRowCellIndex[0][1]+")")),o=this._previousRowCellIndex));s=this._currentJsonData[i[0][0]];u=i[0][0];this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(h=this._getSelectedViewData(i[0][0],r),s=h.data,u=h.rowIndex);f={currentCell:r,cellIndex:i[0][1],data:s,previousRowCellIndex:o,previousRowCell:e};this.model.selectionType=="multiple"&&(f.isCtrlPressed=this.multiSelectCtrlRequest,f.isShiftPressed=this.multiSelectShiftRequest);switch(this.model.selectionType){case t.HeatMapGrid.SelectionType.Single:this.clearCellSelection();this.clearColumnSelection();this.selectedRowCellIndexes=[];this._virtualRowCellSelIndex=[];n.inArray(u,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(u);this.selectedRowCellIndexes.push({rowIndex:u,cellIndex:i[0][1]});this.model.scrollSettings.frozenColumns?this._frozenCell(i[0][0],i[0][1][0]).addClass("e-cellselectionbackground e-activecell"):n(this.getRowByIndex(i[0][0]).find(".e-rowcell:eq("+i[0][1]+")")).addClass("e-cellselectionbackground e-activecell")}f={currentCell:r,cellIndex:i[0][1],data:s,selectedRowCellIndex:this.selectedRowCellIndexes,previousRowCellIndex:o,previousRowCell:e};(!this.multiSelectShiftRequest||t.isNullOrUndefined(this._previousRowCellIndex))&&(this._previousRowCellIndex=i,this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._preVirRowCellIndex=n.extend(!0,[],i),this._preVirRowCellIndex[0][0]=u),this._prevRowCell=r);this._heatmap&&this._heatmap._cellSelected(f);return},i.prototype.clearSelection=function(i){var r,i,u,f,e;return this._selectedRow()>=-1&&(r=this.model.scrollSettings.frozenColumns?this._excludeDetailRows():n(this.element.find("tr[aria-selected='true']")),t.isNullOrUndefined(i)?(this.model.scrollSettings.frozenColumns>0&&(r=n(r[0]).add(r[1])),r.removeAttr("aria-selected").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-selectionbackground").removeClass("e-active"),this._clearVirtualSelection||(this.selectedRowsIndexes=[],this.model.selectedRecords=[])):(this.getRowByIndex(i).removeAttr("aria-selected").find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),u=this.getRowByIndex(i),this.model.scrollSettings.enableVirtualization&&this.multiSelectCtrlRequest&&n.inArray(i,this.selectedRowsIndexes)==-1&&(f=parseInt(u.attr("name"),32)*this._virtualRowCount,e=this._virtualRowCount-u.index()%this._virtualRowCount,i=f-e),i=n.inArray(i,this.selectedRowsIndexes),i!=-1&&this.selectedRowsIndexes.splice(i,1)),this.selectedRowsIndexes.length||this._selectedRow(-1)),!0},i.prototype._excludeDetailRows=function(){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)?n(this.getRows()):n(this.getRows()).not(".e-detailrow,.e-gridSummaryRows")},i.prototype.clearCellSelection=function(i,r){var f,e,u;if(this._allowcellSelection)if(f=this.model.scrollSettings.frozenColumns||!t.isNullOrUndefined(i)?this._excludeDetailRows():n(this.element.find(".e-cellselectionbackground")).parent(),t.isNullOrUndefined(i))this.model.scrollSettings.frozenColumns&&(f=n(f[0]).add(f[1])),f.find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-cellselectionbackground").removeClass("e-activecell"),this.selectedRowCellIndexes=[],this._rowIndexesColl=[];else{for(u=0;u<this.selectedRowCellIndexes.length;u++)if(this.selectedRowCellIndexes[u].rowIndex==i){e=n.inArray(r,this.selectedRowCellIndexes[u].cellIndex);this.model.scrollSettings.frozenColumns?this._frozenCell(i,r).removeClass("e-cellselectionbackground").removeClass("e-activecell"):f.eq(i).find(".e-rowcell").eq(r).removeClass("e-cellselectionbackground").removeClass("e-activecell");break}u!=this.selectedRowCellIndexes.length&&(this.selectedRowCellIndexes[u].cellIndex.splice(e,1),this.selectedRowCellIndexes[u].cellIndex.length==0&&(this.selectedRowCellIndexes.splice(u,1),this._rowIndexesColl.splice(n.inArray(i,this._rowIndexesColl),1)))}return!0},i.prototype.clearColumnSelection=function(i){var r,o,u,s,f,e;if(this._allowcolumnSelection)if(r=n(this._excludeDetailRows()),t.isNullOrUndefined(i))this.model.scrollSettings.frozenColumns&&(r=n(r[0]).add(r[1])),r.find(".e-rowcell").removeClass("e-columnselection"),n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")).removeClass("e-columnselection"),this.selectedColumnIndexes=[];else{if(o=0,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(++i,o=1),this.model.scrollSettings.frozenColumns)for(u=0,s=i,i>=this.model.scrollSettings.frozenColumns&&(u=1,s=i-this.model.scrollSettings.frozenColumns),f=0;f<r[u].length;f++)n(r[u][f].cells[s]).removeClass("e-columnselection");else for(e=0;e<r.length;e++)n(r[e].cells[i]).removeClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")[i]).removeClass("e-columnselection");this.selectedColumnIndexes.splice(0,i-o)}return!0},i.prototype.getSelectedRecords=function(){var t=[],n;if(this._virtualScrollingSelection)return this._virtualSelRecords;for(n=0;n<this.selectedRowsIndexes.length;n++)this.selectedRowsIndexes[n]!=-1&&(this.model.scrollSettings.allowVirtualScrolling?t.push(this._virtualSelectedRecords[this.selectedRowsIndexes[n]]):t.push(this._currentJsonData[this.selectedRowsIndexes[n]]));return t},i.prototype._setCurrentRow=function(n){(n==t.HeatMapGrid.Actions.Refresh||n==t.HeatMapGrid.Actions.Ungrouping||n==t.HeatMapGrid.Actions.Grouping||n==t.HeatMapGrid.Actions.Filtering||n==t.HeatMapGrid.Actions.Sorting||n==t.HeatMapGrid.Actions.Delete||n==t.HeatMapGrid.Actions.Save||n==t.HeatMapGrid.Actions.Cancel||n==t.HeatMapGrid.Actions.Paging)&&(this._selectedRow(-1),this._virtualDataRefresh||(this.selectedRowsIndexes=[]))},i.prototype.refreshContent=function(){var n={};n.requestType=t.HeatMapGrid.Actions.Refresh;this._processBindings(n)},i.prototype.rowHeightRefresh=function(){var i,f;if(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.model.currentViewData)&&this.model.currentViewData.length){var u=this.getContentTable().get(0).rows,e=this.getContentTable().get(1).rows,r=0;if(this.getContent().find(".e-frozencontentdiv").is(":visible"))for(i=0;i<u.length;i++)n(u[i]).css("display")!="none"&&(r=t.max([u[i].getClientRects()[0].height,e[i].getClientRects()[0].height]),n(u[i]).height(r),n(e[i]).height(r),i&&(i==this.model.scrollSettings.frozenRows-1||i==u.length-1)&&(r=r+1),this.model.allowTextWrap||i&&i!=this.model.scrollSettings.frozenRows-1||(r=r-1),this.model.isEdit&&n(u[i]).find("#"+this._id+"EditForm").length&&i&&n(u[i]).find("#"+this._id+"EditForm td").css("height",r),n(e[i]).find("#"+this._id+"EditForm td").css("height",r));this._getRowHeights();!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&this.getScrollObject().isVScroll()&&(f=this.getScrollObject()._vScrollbar,f&&f.value()!=f.model.maximum&&this._scrollObject.refresh(this.model.scrollSettings.frozenColumns>0))}},i.prototype._refreshDataSource=function(n){this._dataManager=n instanceof t.DataManager?n:t.DataManager(n);this._isLocalData=!(this._dataSource()instanceof t.DataManager)||this._dataManager.dataSource.offline||this._isRemoteSaveAdaptor;this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._virtualDataRefresh=!0);this.refreshContent(!0);this._refreshScroller({requestType:"refresh"})},i.prototype.dataSource=function(n,t){t&&(this._templateRefresh=!0);this._dataSource(n);this.model.scrollSettings.enableVirtualization||(n.length>0?this._currentPage(1):this._currentPage(0));this._refreshDataSource(n);var i=this._refreshVirtualPagerInfo();(this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling)&&this._showPagerInformation(i);this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData?this._refreshVirtualView():this._refreshVirtualContent(),this.getContent().ejScroller("isHScroll")&&this.getContent().ejScroller("scrollX",0,!0),this.getContent().ejScroller("isVScroll")?(this.model.scrollSettings.enableVirtualization||this.getContent().ejScroller("scrollY",0,!0),this.element.find(".e-gridheader").addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss"));(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow();this._trigger("dataBound",{})},i.prototype._trigger=function(){},i.prototype.getFooterContent=function(){return this._gridFooterContent},i.prototype.getScrollObject=function(){return(this._scrollObject==null||t.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},i.prototype.getRowHeight=function(){var i=-1,n,r,t;return this.getContentTable()!=null&&(n=this.getContentTable().find("tr:not(.e-virtualrow)"),r=n.length>2?1:0,n.length&&(t=n[r].getBoundingClientRect()),n.length>1&&(i=t&&t.height?t.height:n[r].offsetHeight)),i==-1?32:i},i.prototype.getCurrentIndex=function(){return(this._currentPage()-1)*this.model.pageSettings.pageSize},i.prototype.getColumnByIndex=function(n){return n<this.model.columns.length?this.model.columns[n]:null},i.prototype.set_currentPageIndex=function(n){var i=this.model.pageSettings,u=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r;return(i.totalPages==null&&(i.totalPages=Math.ceil(u/i.pageSize)),n>i.totalPages||n<1||n==this._currentPage())?!1:(t.isNullOrUndefined(this._prevPageNo)&&(this._prevPageNo=this._currentPage()),this._currentPage(n),this._currentPage()!=this._prevPageNo?(r={},r.requestType="paging",this.gotoPage(this._currentPage(),r),!0):!1)},i.prototype.set_currentVirtualIndex=function(n){var t,i;return n<1||n!=1&&n!=this._totalVirtualViews&&n==this._currentVirtualIndex&&this._checkCurrentVirtualView(this._virtualLoadedRows,n)?!1:(this._prevVirtualIndex=this._currentVirtualIndex,this._currentVirtualIndex=n,t=this._calculateCurrentViewPage(),t<=this.model.pageSettings.totalPages&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)?this._prevVirtualIndex<n&&n!=1?(i=this._isThumbScroll&&t!=1?t:t+1,!this._virtualPageRecords[i]&&i<=this.model.pageSettings.totalPages?this._setCurrentViewPage(i):this._renderVirtulViewContent(t)):this._prevVirtualIndex>n?(i=this._isThumbScroll?t:t-1,this._virtualPageRecords[i]&&!this._virtualLoadedRecords[n-1]&&(i=t-1),!this._virtualPageRecords[i]&&i>=1&&this._setCurrentViewPage(i)):this._renderVirtulViewContent(t):this._renderVirtulViewContent(t),!0)},i.prototype._setCurrentViewPage=function(n){this._needPaging=!0;this._prevPageNo=this._currentPage();this.gotoPage(n)},i.prototype._renderVirtulViewContent=function(){this._needPaging=!1;this._refreshVirtualView(this._currentVirtualIndex)},i.prototype._checkCurrentVirtualView=function(t,i){var f=this._virtualRowCount,u=i-1,r=i+1,e;if(t instanceof Array){if(t.length&&((u==0||r==this._totalVirtualViews+1)&&n.inArray(i,t)!=-1||n.inArray(u,t)!=-1&&n.inArray(i,t)!=-1&&n.inArray(r,t)!=-1))return!0}else if(e=r==this._totalVirtualViews?this._lastViewData:f,!this.initialRender&&i==1&&this._virtualLoadedRows[i]||i==this._totalVirtualViews&&t==this._virtualLoadedRows&&t[i]||u==0&&t[i]&&t[i].length==f||r==this._totalVirtualViews+1&&t[i]&&t[i].length==this._lastViewData||t[u]&&t[u].length==f&&t[i]&&t[i].length==f&&t[r]&&t[r].length==e)return!0;return!1},i.prototype._refreshStackedHeader=function(){var i,r,u,t;if(this.model.showStackedHeader){for(i=this.model.stackedHeaderRows,t=0;t<i.length;t++)if(this.model.scrollSettings.frozenColumns!=0){var f=n(this.getHeaderContent().find(".e-frozenheaderdiv")),e=n(this.getHeaderContent().find(".e-movableheader")),o=this._createStackedRow(i[t],!0),s=this._createStackedRow(i[t],!1);n(f.find("tr.e-stackedHeaderRow")[t]).replaceWith(o);n(e.find("tr.e-stackedHeaderRow")[t]).replaceWith(s)}else r=this._createStackedRow(i[t],!1),this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]?n(this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]).replaceWith(r):r.insertBefore(this.getHeaderTable().find("tr.e-columnheader:last"));if(u={},u.requestType="refresh",this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0)for(t=0;t<this.model.groupSettings.groupedColumns.length;t++)this.getHeaderTable().find(".e-stackedHeaderRow").prepend(this._getGroupTopLeftCell());this.model.allowScrolling&&this._refreshScroller(u)}},i.prototype._getStackedColumnByTarget=function(n){var r=(n.get(0)||{}).className,i=/e-row([0-9])-column([0-9])/.exec(r),u=i[1],f=i[2],e=[u,"stackedHeaderColumns",f].join(".");return t.getObject(e,this.model.stackedHeaderRows)},i.prototype._checkSkipAction=function(n){switch(n.requestType){case t.HeatMapGrid.Actions.Save:case t.HeatMapGrid.Actions.Delete:return!0}return!1},i.prototype._processBindings=function(i){var r,u,f;if(this._requestType=i.requestType,this.model.query=this.commonQuery.clone(),this.model.editSettings.editMode=="batch"&&i.requestType!="batchsave"&&i.requestType!="cancel"&&!this._confirmedValue&&this._bulkChangesAcquired())return this._requestArgs=i,!1;!t.isNullOrUndefined(this.model.dataSource)&&i.requestType=="refresh"&&this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this._scrollValue=0,this._loadedJsonData=[],this._prevPage=this._currentPage());this._ensureDataSource(i);this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="virtualscroll"?(this._loadedJsonData.push({pageIndex:this._prevPage,data:this._currentJsonData}),this._prevPage=this._currentPage()):this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=this.model.currentViewData),i.requestType=="filtering"&&(this._loadedJsonData=[],this._prevPage=this._currentPage()));this.model.scrollSettings.allowVirtualScrolling&&i.requestType=="filtering"&&this.model.filterSettings.filteredColumns.length>0&&this.getScrollObject().scrollY(0);this.model.enableRTL?this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"):this.element.hasClass("e-rtl")&&this.element.removeClass("e-rtl");i.requestType==t.HeatMapGrid.Actions.Delete&&this.model.groupSettings.groupedColumns.length==0&&(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").remove(),i.tr.remove());this._editForm=this.model.scrollSettings.frozenColumns>0||this.model.editSettings.showAddNewRow?this.element.find(".gridform"):n("#"+this._id+"EditForm");this.model.editSettings.showAddNewRow&&i.requestType=="beginedit"||this._editForm.length==0||this._editForm.length>1&&(i.requestType=="save"&&i.action=="edit"||i.requestType=="cancel")&&(this._editForm=this.model.editSettings.rowPosition=="top"?this._editForm[1]:this._editForm[0]);this._dataSource()instanceof t.DataManager&&!this._isRemoteSaveAdaptor&&i.requestType!=t.HeatMapGrid.Actions.BeginEdit&&i.requestType!=t.HeatMapGrid.Actions.Cancel&&i.requestType!=t.HeatMapGrid.Actions.Add?(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage&&(r=t.pvt.filterQueries(this.model.query.queries,"onPage"),this.model.query.queries.splice(n.inArray(r[0],this.model.query.queries),1),this.model.query.page(this._currentPage()-1,this.model.pageSettings.pageSize),u=this._dataSource().executeQuery(this.model.query),this.model.query.queries.splice(n.inArray(r[0],this.model.query.queries),1),this.model.query.page(this._currentPage(),this.model.pageSettings.pageSize)),this._virtualSelectedRows&&this._virtualSelectedRows.length>0&&this.model.query.addParams("virtualSelectRecords",this._virtualSelectedRows),f=this._queryPromise=this._dataSource().executeQuery(this.model.query),proxy._dataSource().ready?proxy._dataSource().ready.done(function(){proxy._processDataRequest(proxy,i,f,u)}):proxy._processDataRequest(proxy,i,f,u)):this._isRelationalRendering(i)?this._setForeignKeyData(i):this.sendDataRenderingRequest(i)},i.prototype._processDataRequest=function(n,i,r,u){r.done(t.proxy(function(r){var e,f,o;if(n._relationalColumns.length==0,u&&!n._previousPageRendered)n.model.previousViewData&&n.model.previousViewData.length!=0&&(n.model.previousViewData.splice(0,r.result.length),n._previousPageLength=r.result.length,n._currentPageData=r.result,t.merge(n.model.previousViewData,r.result),n.model.currentViewData=n.model.previousViewData,n._remoteLastPageRendered=!0);else if(n._remoteLastPageRendered&&n.model.pageSettings.currentPage==n.model.pageSettings.totalPages-1&&!n.model.scrollSettings.enableVirtualization){for(e=n.model.pageSettings.pageSize-n._previousPageLength,f=0;f<e;f++)o=n.getRows()[n.getRows().length-(n.model.pageSettings.pageSize-f)],o.remove();n._tempPageRendered=!0;n.model.currentViewData=r.result}else n.model.pageSettings.currentPage!=n.model.pageSettings.totalPages-1||n._remoteLastPageRendered||(n._previousPageRendered=!0),n.model.currentViewData=r.result==null?[]:r.result,n._$fkColumn&&n.model.filterSettings.filterType=="excel"&&n.model.filterSettings.filteredColumns.length>0&&(n._fkParentTblData=r.result);n.model.allowScrolling&&n.model.scrollSettings.allowVirtualScrolling&&n.model.scrollSettings.enableVirtualization&&(i.requestType=="filtering"&&(n._gridRecordsCount=n._filteredRecordsCount=r.count,n._refreshVirtualViewDetails()),r.result.length?(n._isInitNextPage||n._isLastVirtualpage?(n._setInitialCurrentIndexRecords(r.result,n._currentPage()),n._isInitNextPage=n._isLastVirtualpage=!1):n._setVirtualLoadedRecords(r.result,n._currentPage()),n._isThumbScroll&&!n._checkCurrentVirtualView(n._virtualLoadedRecords,n._currentVirtualIndex)&&n._checkPrevNextViews(),n._remoteRefresh=!0):n.getContent().find(".e-virtualtop, .e-virtualbottom").remove());t.isNullOrUndefined(r.aggregates)||(n._remoteSummaryData=r.aggregates);t.isNullOrUndefined(n._unboundRow)||i.selectedRow==n._unboundRow||i.requestType!="save"||(n._unboundRow.find(".e-editbutton").trigger("click"),n._unboundRow=null)}));r.fail(t.proxy(function(t){i.error=t.error;t=[];n.model.currentViewData=[];n._trigger("actionFailure",i)}))},i.prototype._createUnboundElement=function(i){var f=document.createElement("div"),e,u,r,o;for(i.headerText=t.isNullOrUndefined(i.headerText)?i.field:i.headerText,t.isNullOrUndefined(i.headerText)||(f.id=this._id+i.headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate"),e=t.buildTag("div.e-unboundcelldiv"),u=i.commands,r=0;r<u.length;r++)o=t.buildTag("button.e-"+u[r].type.replace(/\s+/g,"")+"button","",{},{type:"button"}),o.val(u[r].type),e.append(o);return n("body").append(n(f).html(e).hide()),f},i.prototype._gridTemplate=function(n,t,i){var r=n.model.columns[i];return n._isGrouping&&(this.index=n._currentJsonData.indexOf(this.data)),n._renderEjTemplate("#"+t,this.data,this.index,r)},i.prototype._renderEjTemplate=function(i,r,u,f){var e=null;return((typeof i=="object"||i.startsWith("#")||i.startsWith("."))&&(e=n(i).attr("type")),e&&(e=e.toLowerCase(),t.template[e]))?t.template[e](this,i,r,u,f):t.template.render(this,i,r,u,f)},i.prototype._createTemplateElement=function(i,r,u){var e=i["templateID"in i?"templateID":"template"],s=/^#([\w-]*)/.exec(e),r=r||n("body"),f,h=u?"Pager":i.headerText+n.inArray(i,this.model.columns)+"_Template",o={name:"SCRIPT",type:"text/x-template",text:e,id:(this._id+h).replace(/[^0-9A-z-_]/g,"")};return f=s&&s[1]?document.getElementById(s[1]):/^<script/i.test(e)?n(e).get(0):t.buildTag(o.name,o.text).get(0),f.id=f.id||o.id,f.type=f.type||o.type,r.append(u?f.innerHTML:f),f},i.prototype._page=function(n){var t;n.events.text==this.localizedLabels.NextPage?(t=this.model.pageSettings.currentPage,++t,this.gotoPage(t)):n.events.text==this.localizedLabels.PreviousPage?(t=this.model.pageSettings.currentPage,t>1?(--t,this.gotoPage(t)):this.gotoPage(t)):n.events.text==this.localizedLabels.LastPage?(t=this.model.pageSettings.totalPages,this.gotoPage(t)):this.gotoPage(1)},i.prototype.gotoPage=function(n){var i,r,u;(this.model.allowPaging||this.model.allowScrolling||this.model.scrollSettings.allowVirtualScrolling)&&(i={},i.previousPage=this._currentPage(),this._currentPage(n),i.endIndex=this._currentPage()*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:this._currentPage()*this.model.pageSettings.pageSize,i.startIndex=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=n,this.model.allowPaging&&(i.requestType=t.HeatMapGrid.Actions.Paging),this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this._isVirtualRecordsLoaded=!1,u=this._refreshVirtualPagerInfo(),this._showPagerInformation(u),i.requestType=t.HeatMapGrid.Actions.VirtualScroll),r=this._processBindings(i),r&&this._currentPage(i.previousPage),this._primaryKeyValues=[])},i.prototype._checkScrollActions=function(n){return!this.model.scrollSettings.allowVirtualScrolling&&(n==t.HeatMapGrid.Actions.Sorting||n==t.HeatMapGrid.Actions.Reorder)||n==t.HeatMapGrid.Actions.Grouping||n==t.HeatMapGrid.Actions.Ungrouping||n==t.HeatMapGrid.Actions.Add||n==t.HeatMapGrid.Actions.Cancel||n==t.HeatMapGrid.Actions.Save||n==t.HeatMapGrid.Actions.BatchSave||n==t.HeatMapGrid.Actions.Delete||n==t.HeatMapGrid.Actions.Filtering||n==t.HeatMapGrid.Actions.Paging||n==t.HeatMapGrid.Actions.Refresh||n==t.HeatMapGrid.Actions.Search?!0:!1},i.prototype._frozenAlign=function(){var t=this.getContent().first(),i=this.getBrowserDetails(),n;n=this.model.enableRTL?"margin-right":"margin-left";t.find(".e-movablecontent").css(n,i.browser==="safari"?"auto":t.find(".e-frozencontentdiv").width()+"px");this.getHeaderContent().find(".e-movableheader").removeAttr("style").css(n,i.browser==="safari"?"auto":this.getHeaderContent().find(".e-frozenheaderdiv").width()+"px")},i.prototype._refreshScroller=function(n){var r=this.getContent().first(),i,u,f,e,o,s;t.isNullOrUndefined(r.data("ejScroller"))||(this.model.scrollSettings.frozenColumns>0&&(this._frozenAlign(),this.refreshScrollerEvent(),r.find(".e-movablecontent").scrollLeft(this.getHeaderContent().find(".e-movableheader").scrollLeft()),!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&this.getScrollObject()._vScrollbar.value()>this.getScrollObject()._vScrollbar.model.maximum&&(i=this.getScrollObject()._vScrollbar.model.maximum)),this.model.scrollSettings.frozenRows>0&&(this._initFrozenRows(),i=this.getScrollObject().model.scrollTop,!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&i>this.getScrollObject()._vScrollbar.model.maximum&&(i=this.getScrollObject()._vScrollbar.model.maximum),(n.requestType=="cancel"||n.requestType=="save")&&i>this._editFormHeight&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&(i=i-this._editFormHeight),n.requestType==t.Grid.Actions.Add&&this.getScrollObject().scrollY(0,!0),t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)),n.requestType=="beginedit"&&(i=this.getScrollObject().model.scrollTop,this.getScrollObject().scrollY(0,!0)),!t.isNullOrUndefined(this.model.dataSource)&&(n.requestType=="refresh"||n.requestType=="searching")&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData&&this._gridRecordsCount>0?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(1),this._currentVirtualIndex==1&&this.getScrollObject().scrollY(0)),this.model.scrollSettings.frozenColumns>0&&n.requestType!="filtering"?this.rowHeightRefresh():this.getScrollObject().refresh(),r.ejScroller("model.enableRTL",this.model.enableRTL),this.model.isResponsive&&(n.requestType=="searching"||n.requestType=="filtering")&&(u=this.getScrollObject(),f=u.isHScroll()?this.getContentTable().height()+u.model.buttonSize:this.getContentTable().height(),f>this.model.scrollSettings.height&&(f=this.model.scrollSettings.height),e=typeof this.model.scrollSettings.width=="string"?this.element.width()-u.model.buttonSize:this.model.scrollSettings.width,o=e,this.getContent().ejScroller({height:f,width:o})),r.ejScroller("isVScroll")&&!this.getScrollObject().model.autoHide?(this.getHeaderContent().addClass("e-scrollcss"),this.getHeaderContent().find(".e-headercontent").hasClass("e-hscrollcss")||this.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):this._showHideScroller(),this._getRowHeights(),i&&!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&n.requestType!=t.Grid.Actions.Add&&(this._currentTopFrozenRow=0,i>this.getScrollObject()._vScrollbar.model.maximum&&(i=this.getScrollObject()._vScrollbar.model.maximum),this.getScrollObject()._vScrollbar.scroll(i)),n.requestType=="virtualscroll"&&(s=this.getScrollObject().model.scrollTop+this.getScrollObject().model.height-this.getScrollObject().model.height*.3,this.getScrollObject().scrollY(s,!0)))},i.prototype._isFrozenColumnVisible=function(){for(var n=0;n<this.model.scrollSettings.frozenColumns;n++)if(this.model.columns[n].visible)return!0;return!1},i.prototype._frozenPaneRefresh=function(){this.getContent().find(".e-frozencontentdiv").css("display","none");this.getHeaderContent().find(".e-frozenheaderdiv").css("display","none");this.getHeaderContent().find(".e-movableheader")[0].style["margin-left"]="";this.getContent().find(".e-movablecontent")[0].style["margin-left"]="";var i=t.isNullOrUndefined(this._scrollObject._vScrollbar)?0:this._scrollObject._vScrollbar["e-vscroll"].width(),n=this.model.scrollSettings.width-i-1;this.model.scrollSettings.width>this.getContent().find(".e-movablecontentdiv").width()&&(this.getContent().find(".e-movablecontentdiv").width(n),this.getHeaderContent().find(".e-movableheaderdiv").width(n));this._scrollObject.option("scrollLeft",0)},i.prototype._renderScroller=function(){var e,o,u,f,r,l,s,i,h,c;if(this.model.scrollSettings||(this.model.scrollSettings={}),this.model.enablePersistence&&(t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)||!this.model.scrollSettings.previousStateWidth)&&this.model.isResponsive&&(this.model.scrollSettings.previousStateWidth=this.model.scrollSettings.width),typeof this._originalScrollWidth!="string"||this.model.isResponsive||(this.element.css("width","auto"),e=this.element.width(),(this.model.scrollSettings.width=="auto"||this._originalScrollWidth=="auto")&&(this._originalScrollWidth="100%"),this.model.scrollSettings.width=e*(parseFloat(this._originalScrollWidth)/100)),typeof this.model.scrollSettings.height!="string"||this.model.isResponsive||(o=this.element.height(),this.model.scrollSettings.height=="auto"&&(this.model.scrollSettings.height="100%"),this.model.scrollSettings.height=o*(parseFloat(this.model.scrollSettings.height)/100)),(this.model.scrollSettings.width||this.model.width)&&!this._mediaQuery&&this.element.width(this.model.scrollSettings.width||this.model.width),u=this.getContent().attr("tabindex","0"),l=this.getRows(),this.model.scrollSettings.frozenColumns>0){if(s=this.getContent().find(".e-frozencontentdiv").width()+20,s>this.model.scrollSettings.width){this.getContent().remove();this.getHeaderTable().eq(1).remove();return}f=this.getContent().find(".e-frozencontentdiv").width();r=this.model.enableRTL?"margin-right":"margin-left";this.getContent().find(".e-movablecontent").css(r,f+"px");this.getHeaderContent().find(".e-movableheader").css(r,f+"px");this.model.scrollSettings.targetPane=".e-movablecontent"}this._initFrozenRows();this.model.scrollSettings.autoHide&&(this.model.scrollSettings.show=n.proxy(this._showHideScroller,this));i=this;this.model.scrollSettings.frozenRows||(this.model.scrollSettings.scroll=function(n){t.isNullOrUndefined(n.scrollData)||n.scrollData.handler!="e-hhandle"?(i._scrollValue=n.scrollTop,i.model.currentIndex=n.scrollTop==0?n.scrollTop:Math.floor(n.scrollTop/i._vRowHeight)):(i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),i._checkScroller(n,this))});!this.model.scrollSettings.allowVirtualScrolling&&this.model.currentIndex>0&&!this.model.scrollSettings.scrollTop&&(h=this.model.currentIndex*this.getRowHeight(),this.model.scrollSettings.scrollTop=h);this.model.scrollSettings&&!this.model.scrollSettings.height&&(this.model.scrollSettings.height=0);u.ejScroller(this.model.scrollSettings);this.model.rowTemplate!=null&&(this.getBrowserDetails().browser=="msie"||this.getBrowserDetails().browser=="safari")&&this.getScrollObject().refresh();this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenRows==0&&this.getScrollObject()._vScrollbar&&this.getScrollObject()._hScrollbar&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=this.getScrollObject()._hScrollbar._scrollData.skipChange=!0);this.model.scrollSettings.autoHide||this._showHideScroller();this.getBrowserDetails().browser=="safari"&&this.model.scrollSettings.frozenColumns>0&&this.getHeaderContent().find(".e-movableheader").add(this.getContent().find(".e-movablecontent")).css(r,"auto");this.refreshScrollerEvent();this.model.scrollSettings.frozenColumns>0&&!this._isFrozenColumnVisible()&&this._frozenPaneRefresh();i.model.scrollSettings.allowVirtualScrolling&&(c=this._refreshVirtualPagerInfo(),this._showPagerInformation(c),u.ejScroller({scroll:function(r){if(i.model.scrollSettings.enableVirtualization&&r.scrollData!=null&&r.scrollData.handler!="e-hhandle"){if(r.reachedEnd=r.scrollData.scrollable-r.scrollTop==0,r.source=="thumb"){var f=Object.keys(i._virtualLoadedRows),u=(i._currentVirtualIndex+2).toString();i.model.scrollSettings.virtualScrollMode=="continuous"&&n.inArray(u,f)==-1&&u<i._totalVirtualViews?i._isContinuous=!0:(r.model.scrollTop=r.scrollTop,i._isContinuous=!1,r.cancel=!0)}(r.source=="button"||r.source=="key"||r.source=="wheel")&&(i._isThumbScroll=!1,i._virtualViewScroll(r),i.model.scrollSettings.virtualScrollMode=="continuous"&&r.reachedEnd&&this.refresh());i.model.currentIndex=r.scrollTop==0?r.scrollTop:Math.floor(r.scrollTop/i._vRowHeight)}else!t.isNullOrUndefined(r.scrollData)&&r.scrollData.handler=="e-hhandle"&&i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),r.reachedEnd=this.content()[0].scrollHeight-r.scrollTop==this.content()[0].clientHeight,(r.source=="button"||r.source=="key"||r.source=="wheel")&&i.model!=null&&i._virtualScroll(r),r.source=="wheel"&&r.scrollTop!=i._scrollValue&&(r.scrollTop=i._scrollValue),i._checkScroller(r,this)},thumbEnd:function(t){(i.model.scrollSettings.enableVirtualization&&i.model.scrollSettings.virtualScrollMode=="continuous"?t.reachedEnd=t.scrollData.scrollable-t.model.scrollTop==0:t.originalEvent&&!n(t.originalEvent.target).hasClass("e-rowcell")&&(t.reachedEnd=this.content()[0].scrollHeight-t.scrollData.sTop==this.content()[0].clientHeight),t.scrollData.handler!="e-hhandle")&&i.model!=null&&t.originalEvent&&(i.model.scrollSettings.enableVirtualization?(i._isThumbScroll=!0,i._virtualViewScroll(t),i.model.scrollSettings.virtualScrollMode=="continuous"&&t.reachedEnd&&this.refresh()):i._virtualScroll(t))},scrollEnd:function(t){if(t.scrollData.type!="mousewheel"&&(t.scrollData.model==null||t.scrollData.model.orientation!="horizontal")&&i.model.scrollSettings.enableVirtualization&&!i._isContinuous){var r=i._calculateCurrentViewPage(t.model),u=n.inArray(r,i._virtualLoadedPages)!=-1;u?(i._isThumbScroll=!0,i._virtualViewScroll(t),i._totalVirtualViews<=i._maxViews*3&&(this._content[0].scrollTop=t.scrollData.scrollTop)):t.cancel=!0}}}))},i.prototype._checkScroller=function(n,t){var i=n.scrollLeft>0?n.scrollLeft:Math.abs(n.scrollLeft),r;n.source=="thumb"&&(t.content()[0].scrollWidth-i==t.content()[0].clientWidth||i==0)&&(this.model.enableRTL&&(r=i==0?n.scrollData.scrollable:0,n.scrollData.sTop=n.model.scrollLeft=r,t.content().scrollLeft(r)),t.refresh())},i.prototype._showHideScroller=function(){this.getContent().ejScroller("isVScroll")?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this.model.scrollSettings.autoHide||this.getHeaderContent().addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss");this.getBrowserDetails().browser=="msie"||this.model.scrollSettings.frozenColumns!=0||this._mediaQuery||(!this.element.find(".e-gridheader").hasClass("e-scrollcss")&&(this.model.filterSettings.filteredColumns.length||this._hiddenColumns.length)?(this.getHeaderTable().removeAttr("style"),this.getContentTable().removeAttr("style")):(this.getHeaderContent().find("div table").first().width(this.getContentTable().width()),this.getContent().find("div table").first().width(this.getContentTable().width()),this.getHeaderTable().width(this.getContentTable().width())));this.getBrowserDetails().browser=="msie"&&this.model.scrollSettings.frozenColumns==0&&(this.getContent().ejScroller("isVScroll")?this.getContent().width(this.getHeaderContent().width()+18):this.getContent().width(this.getHeaderContent().width()));this._isHscrollcss()},i.prototype._isHscrollcss=function(){var n=this.getContent().data("ejScroller"),t=n&&(n.isHScroll()||n.isVScroll())?"addClass":"removeClass";this.getHeaderContent().find(".e-headercontent")[t]("e-hscrollcss")},i.prototype._initFrozenRows=function(){var i=this.getRows();this.model.currentViewData&&this.model.currentViewData.length!=0&&(this.model.scrollSettings.frozenRows>0&&i!=null?(this.model.scrollSettings.scroll=n.proxy(this._scroll,this),this.getContent().find(".e-frozeny").removeClass("e-frozeny").end().find(".e-frozenrow").removeClass("e-frozenrow"),!t.isNullOrUndefined(i[0][this.model.scrollSettings.frozenRows-1])&&!t.isNullOrUndefined(i[1][this.model.scrollSettings.frozenRows-1])&&this.model.scrollSettings.frozenColumns>0?n(i[0][this.model.scrollSettings.frozenRows-1].cells).add(i[1][this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"):t.isNullOrUndefined(this.getRowByIndex(this.model.scrollSettings.frozenRows-1)[0])||n(i[this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"),this.model.scrollSettings.height=this._rowHeightCollection[Math.floor(this.model.scrollSettings.height/this._rowHeightCollection[1])]+18):delete this.model.scrollSettings.scroll)},i.prototype.refreshScrollerEvent=function(){var i=this;this.getContent().find(".e-content:first,.e-movablecontent").scroll(t.proxy(function(t){if(this.model.scrollSettings.targetPane?this.getHeaderContent().find(".e-movableheader").scrollLeft(n(t.currentTarget).scrollLeft()):this.getHeaderContent().find("div").first().scrollLeft(n(t.currentTarget).scrollLeft()),this.model.scrollSettings.frozenRows>0&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&this.model.isEdit){var i=t.target.scrollTop;this.getContent().find(".e-content").scrollTop(0);this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop+i,!0)}},this));this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").scroll(t.proxy(function(t){var i=n(t.currentTarget);this.model.scrollSettings.targetPane?(this.getContent().find(".e-movablecontent").scrollLeft(i.scrollLeft()),this.model.showSummary&&this.getFooterContent().find(".e-movablefooter").scrollLeft(i.scrollLeft())):(this.model.showSummary&&this.getFooterContent().scrollLeft(i.scrollLeft()),this.getContent().find(".e-content").first().scrollLeft(i.scrollLeft()))},this))},i.prototype._renderByFrozenDesign=function(){var r=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),i={};i.colgroup1=r.append(t.buildTag("colgroup").append(u.splice(0,this.model.scrollSettings.frozenColumns))).html();i.colgroup2=r.html(t.buildTag("colgroup").append(u)).html();this.getContent().find("div").first().get(0).innerHTML=n.render[this._id+"_FrozenTemplate"]({datas:this.model.currentViewData},i);this.setGridContentTable(this.getContent().find(".e-table").attr("role","heatmap"))},i.prototype.addFrozenTemplate=function(){var i="<div class='e-frozencontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup1}}<tbody>{{for datas tmpl='"+this._id+"_JSONFrozenTemplate'/}}<\/tbody><\/table><\/div><div class='e-movablecontent'><div class='e-movablecontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup2}}<tbody>{{for datas tmpl='"+this._id+"_JSONTemplate'/}}<\/tbody><\/table><\/div><\/div>",t={};t[this._id+"_FrozenTemplate"]=i;n.templates(t)},i.prototype._getTopRow=function(n){var i=this.model.scrollSettings.frozenRows,t=0;if(n>10)for(t=0;t<this._rowHeightCollection.length;t++)if(this._rowHeightCollection[t]>n){i=this.model.scrollSettings.frozenRows+t-1;break}return{imaginaryIndex:i,actualIndex:t}},i.prototype._showHideRow=function(t,i,r,u){var f=this.getRows();this.model.scrollSettings.frozenColumns>0?n(f[0]).slice(t,i).add(n(f[1]).slice(t,i).toArray())[r]():n(f).slice(t,i)[r]();this._currentTopFrozenRow=r=="show"?t:i;this.getScrollObject()._changevHandlerPosition(u)},i.prototype._scroll=function(n){var i,f,e,o,u;if(n.scrollData!=null&&n.scrollData.dimension!="width"){n.cancel=!0;var h=this.getRows(),s=this._getTopRow(n.scrollTop),r=s.imaginaryIndex;if(r>this._currentTopFrozenRow?this._showHideRow(this.model.scrollSettings.frozenRows,r,"hide",n.scrollTop):r<this._currentTopFrozenRow&&this._showHideRow(r,this._currentTopFrozenRow+1,"show",n.scrollTop),i=this.getContentTable().last().find("tr"),f=parseInt(i.last().find("td:first").css("border-top-width"))*2+1,n.scrollTop==this.getScrollObject()._vScrollbar.model.maximum&&i.last()[0].offsetTop+i.last().height()-f>this.element.find(".e-content").height()){for(e=i.last().prev()[0].offsetTop+i.last().prev().height(),o=1,u=i.length-2;e-f>this.element.find(".e-content").height();u++){e=i[u].offsetTop+i.eq(u).height();o++;break}this._showHideRow(this.model.scrollSettings.frozenRows,r+o,"hide",n.scrollTop)}n.model.scrollTop=n.scrollTop}else t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)},i.prototype._virtualScroll=function(t){var i,f;if(t!=null){var u=0,e=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r=this.model.pageSettings,o=this.getContentTable()[0].tBodies[0],s=n(o).find("tr.e-virtualrow");if(r.totalPages=Math.ceil(e/r.pageSize),t.scrollTop!==undefined&&(t.model.scrollTop=t.scrollTop),t.reachedEnd!=undefined&&(t.model.reachedEnd=t.reachedEnd),i=this._calculateCurrenPage(s,this.getContentTable(),t.model),i>r.totalPages&&(i=r.totalPages),r.currentPage!=i&&n.inArray((i-1)*r.pageSize,this.virtualLoadedPages)==-1&&(this._isVirtualRecordsLoaded=!1),this._isVirtualRecordsLoaded)r.currentPage=i;else{if(n.inArray((i-1)*r.pageSize,this.virtualLoadedPages)==-1){if(this.model.scrollSettings.virtualScrollMode=="continuous"&&!t.reachedEnd)return;i==r.totalPages&&n.inArray((i-2)*r.pageSize,this.virtualLoadedPages)==-1&&(u++,this.set_currentPageIndex(i));u==1&&(this._lastRow=!0);this.set_currentPageIndex(i)}r.currentPage=i}f=this._refreshVirtualPagerInfo();this._showPagerInformation(f)}},i.prototype._virtualViewScroll=function(t){if(t!=null){t.scrollTop!==undefined&&(t.model.scrollTop=t.scrollTop);t.reachedEnd!=undefined&&(t.model.reachedEnd=t.reachedEnd);var i=this._calculateCurrentVirtualIndex(t);n.inArray(i,this._currentLoadedIndexes)==-1&&(this._isVirtualRecordsLoaded=!1);this._isVirtualRecordsLoaded||this.set_currentVirtualIndex(i)}},i.prototype._refreshVirtualContent=function(t){var f=this.getRowHeight(),e=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,o,i,u,s,h,c,r;t!=null&&(this._currentPage(t),o=this._refreshVirtualPagerInfo(),this._showPagerInformation(o));i=this.getCurrentIndex();u=this.getContentTable()[0].tBodies[0];i>0&&(s=document.createElement("tr"),n(s).addClass("e-virtualrow").css("height",f*i).prependTo(u));i+this.model.pageSettings.pageSize<=e&&this.getContentTable().find("tr").last().hasClass("e-virtualrow")!=!0&&this.model.scrollSettings.frozenColumns==0&&(h=document.createElement("tr"),c=this.model.scrollSettings.virtualScrollMode=="normal"?f*(e-(i+this.model.pageSettings.pageSize)):1,n(h).addClass("e-virtualrow").css("height",c).appendTo(n(u)));this.virtualLoadedPages=[];this.orderedVirtualLoadedPage=[];this.virtualLoadedPages.push(i>=0?i:0);this.orderedVirtualLoadedPage.push(i>=0?i:0);r=n(u).find("tr:not(.e-virtualrow)").attr("name",i>=0?i:0)[0];r&&r.previousSibling&&(n(r.previousSibling).hasClass("e-virtualrow")||r.previousSibling.offsetTop>i*this.getContent().height())&&(this.getContent().children("div").first().scrollTop(this.getContent().find(".content").scrollTop()-(this.getContent().find(".content").scrollTop()-r.offsetTop)),this._isVirtualRecordsLoaded=!0)},i.prototype._refreshVirtualView=function(t){var u,e,r,o,h,f,i;if(this._singleView)this._singleView=!1,this._addLastRow(),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),f=this._currentVirtualIndex.toString(32),n(this._gridRows).attr("name",f),this._virtualLoadedRows[this._currentVirtualIndex]=this._gridRows,this._eventBindings();else{if(u=this._virtualRowCount,t)t>this._totalVirtualViews&&(t=1,e=!0),this._currentVirtualIndex=t,this._virtualLoadedRecords[t]?r=Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize):(this._virtualDataRefresh||this._currentVirtualIndex==this._totalVirtualViews||(e=!0),r=Math.ceil(t*this._virtualRowCount/this.model.pageSettings.pageSize)),this._refreshVirtualViewScroller(e),r>this.model.pageSettings.totalPages&&(r=this.model.pageSettings.totalPages),r<=0&&(r=1),n.inArray(r,this._virtualLoadedPages)==-1?this.gotoPage(r):(this._currentPage(r),this._needPaging=this._checkCurrentVirtualView(this._virtualLoadedRecords,t)?!1:!0,this._getVirtualLoadedRecords(this.model.query),this._replacingVirtualContent());else{if(this._refreshVirtualViewDetails(),o=n(this.getContentTable()[0].rows),this._setVirtualTopBottom(),this.initialRender){for(i=0;i<this._currentLoadedIndexes.length;i++){var s=this._currentLoadedIndexes[i],l=(i+1)*u,c=i*u;n(o[l-1]).addClass("e-virtualview"+s);f=s.toString(32);h=o.slice(c,c+u).attr("name",f).detach();this._virtualLoadedRows[s]=h;h.appendTo(this.getContentTable())}this._currentVirtualIndex>1&&this._refreshVirtualViewScroller()}this._eventBindings()}n.inArray(this._currentPage(),this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(this._currentPage())}if(!t&&(this.model.queryCellInfo||this.model.rowDataBound))for(i=0;i<this._currentLoadedIndexes.length;i++)n.inArray(this._currentLoadedIndexes[i],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[i]);this._isThumbScroll=!1;this._virtualDataRefresh=!1},i.prototype._refreshVirtualViewData=function(){this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualLoadedPages=[];this._virtualPageRecords={};this._queryCellView=[];this.model.pageSettings.totalPages!=null&&this._currentPage()>this.model.pageSettings.totalPages&&(this._currentPage(1),this._currentVirtualIndex=1)},i.prototype.setCurrentPageData=function(n){this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._refreshVirtualViewDetails(),this._setVirtualLoadedRecords(n,this._currentPage()),this._refreshVirtualView(this._currentVirtualIndex))},i.prototype._refreshVirtualViewScroller=function(n){var t,i;this.initialRender&&!this.model.scrollSettings.scrollTop||n?(i=this._vRowHeight,t=this.model.currentIndex*this._vRowHeight):t=this._scrollObject.model.scrollTop;this.getContent().ejScroller("model.scrollTop",t);this._scrollValue=t},i.prototype._calculateCurrentViewPage=function(n){n||(n=this._scrollObject.model);var i=this.model.pageSettings.pageSize,t=Math.ceil((n.scrollTop+this.model.scrollSettings.height)/this._vRowHeight/i);return this.model.pageSettings.totalPages==null&&(this.model.pageSettings.totalPages=Math.ceil(this._getVirtualTotalRecord()/i)),t>this.model.pageSettings.totalPages&&(t=this.model.pageSettings.totalPages),t},i.prototype._calculateCurrentVirtualIndex=function(t){var h=t.model,p=this._getVirtualTotalRecord(),i,c,l,u=[],e,o,a,r=h.scrollTop,y=r+this.model.scrollSettings.height,s,v,f;if(i=y/this._vRowHeight/this._virtualRowCount,i=this._prevVirtualIndex>this._currentVirtualIndex&&r<=this._scrollValue?Math.floor(i):Math.ceil(i),r>=this._scrollValue&&h.virtualScrollMode=="continuous"&&h.reachedEnd&&(i=i+1),i>this._totalVirtualViews&&(i=this._totalVirtualViews),i<=0&&(i=1),n.inArray(i,this._currentLoadedIndexes)!==-1&&this._virtualLoadedRows[i]&&r!=t.scrollData.scrollable){for(s=this.getContentTable()[0].rows,a=s.length,v=this.getContent().find(".e-virtualtop").height(),l=r>=this._scrollValue,f=0;f<a;f++){if(e=s[f],o=e.offsetHeight+e.offsetTop+v,o>r+this.model.scrollSettings.height){u.length===0&&f!==0&&(u=[s[e.offsetTop<=r+this.model.scrollSettings.height?f:f-1]]);break}if(o>=r&&o<=r+this.model.scrollSettings.height&&(u.push(e),l===!1&&u.length>1))break}c=n(r>=this._scrollValue?u[u.length-1]:u[0]);c.length&&(i=parseInt(c.attr("name"),32))}return this._scrollValue=r,i},i.prototype._calculateCurrenPage=function(t,i,r){var o=this.model.pageSettings.pageSize,u,a=this,v,w,f=[],s,h,b,k,y,g=this.getRowHeight(),c,e,l,p,d;if(u=(r.scrollTop+this.model.scrollSettings.height)/g/o,k=this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1),y=this.getContentTable().find("tr[name="+k+"]").eq(0),u=y.length&&y.offset().top>0&&u>=1&&r.scrollTop<this._scrollValue&&this.virtualLoadedPages.indexOf(Math.ceil(u-1)*o)!==-1?Math.floor(u):Math.ceil(u),r.scrollTop>=this._scrollValue&&r.virtualScrollMode=="continuous"&&r.reachedEnd&&(u=this.virtualLoadedPages[this.virtualLoadedPages.length-1]/o+2),n.inArray((u-1)*o,this.virtualLoadedPages)!==-1){for(c=this.getContentTable().children("tbody").children("tr"),b=c.length,w=r.scrollTop>=this._scrollValue,e=0;e<b;e++){if(s=c[e],h=s.offsetHeight+s.offsetTop,h>r.scrollTop+a.model.scrollSettings.height){f.length===0&&e!==0&&(f=[c[s.offsetTop<=r.scrollTop+a.model.scrollSettings.height?e:e-1]]);break}if(h>=r.scrollTop&&h<=r.scrollTop+a.model.scrollSettings.height&&(f.push(s),w===!1&&f.length>1))break}v=n(r.scrollTop>=this._scrollValue?f[f.length-1]:f[0]);v.hasClass("e-virtualrow")?f.length===1&&u++:u=parseInt(v.attr("name"),10)/o+1}for(this._scrollValue=r.scrollTop,l=0;l<t.length;l++)if(p=t[l],p.offsetTop+p.offsetHeight>=r.scrollTop)return d=this._calculatePrevPage(t,i,r),this._prevPageNo=d,u==0&&(u=1),u>this.model.pageSettings.totalPages?this.model.pageSettings.totalPages:u;return u},i.prototype._calculatePrevPage=function(t,i,r){for(var f,e,u=0;u<t.length;u++)if(f=t[u],f.offsetTop+f.offsetHeight>=r.scrollTop&&(e=n(f).prevAll("tr[name]")[0],e!=null))return Math.ceil(parseInt(n(e).attr("name"),10)/this.model.pageSettings.pageSize)+1;return-1},i.prototype._refreshVirtualPagerInfo=function(){var n={};return n.pageSize=this.model.pageSettings.pageSize,n.currentPage=this._currentPage(),n.totalRecordsCount=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,n.totalPages=Math.ceil(n.totalRecordsCount/n.pageSize),n},i.prototype._showPagerInformation=function(t){var i=(t.currentPage-1)*t.pageSize;n(this.$pagerStatusBarDiv).find("div:first").html(String.format("{0} of {1} pages ({2} items)",t.currentPage,t.totalPages,t.totalRecordsCount),i,i+t.pageSize);n(this.$pagerStatusBarDiv).css("display","block")},i.prototype._replacingContent=function(){var yt=document.createElement("div"),u=this.getCurrentIndex(),o=this.getContentTable()[0],rt=n(o).find("colgroup").first(),l=this.getRowHeight(),r,a,ut,f,h,b,e,y,ft,k,et,d,ot,st,nt,i,s,at,tt,kt,dt,it,vt;rt.replaceWith(this._getMetaColGroup());(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&rt.prepend(this._getIndentCol());r=o.tBodies[0];a=this.model.currentViewData;t.isNullOrUndefined(this._currentPageData)?this._virtualLoadedRecords[this._currentPage()]=a:(this._virtualLoadedRecords[this._currentPage()]=this._currentPageData,this._currentPageData=null);var pt=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](a)),w=this,v=pt.children("tr");if(this._allowcolumnSelection&&this.selectedColumnIndexes.length>0)for(s=0;s<this.selectedColumnIndexes.length;s++)ut=this.selectedColumnIndexes[s]+1,v.find("td:nth-of-type("+ut+")").addClass("e-columnselection");for(this.virtualLoadedPages.push(u>=0?u:0),f=t.dataUtil.mergeSort(t.distinct(this.virtualLoadedPages)),n(v).attr("name",u),h=t.dataUtil.min(f),b=t.dataUtil.max(f),n(r).children(".e-virtualrow").remove(),i=0;i<f.length;i++)e=f[i],y=f[i-1],(e!=this.orderedVirtualLoadedPage[i]||this.orderedVirtualLoadedPage[i]==undefined)&&(y!=undefined?v.insertAfter(n(r).children("[name="+y+"]:last")):v.insertBefore(n(r).children("[name="+this.orderedVirtualLoadedPage[i]+"]:first")),this.orderedVirtualLoadedPage=f),e!=0&&(ft=e==h?h:y,k=e-ft-w.model.pageSettings.pageSize,k>0&&(et=document.createElement("tr"),n(et).addClass("e-virtualrow").css("height",l*k).insertBefore(n(r).children("[name="+e+"]:first")))),e==b&&(d=w._gridRecordsCount-b-w.model.pageSettings.pageSize,d>0&&(ot=document.createElement("tr"),n(ot).addClass("e-virtualrow").css("height",l*d).appendTo(r)));h>0&&(st=document.createElement("tr"),n(st).addClass("e-virtualrow").css("height",l*h).prependTo(r));var ht=this.getContent(),p=n(r).children("tr[name="+u+"]")[0],g=p.previousSibling,ct=ht.height(),lt=p.offsetTop;if(this._virtaulUnSel)for(nt=n.extend(!0,[],this._virtaulUnSel),i=0;i<nt.length;i++){var c=nt[i],wt=this.model.pageSettings.currentPage,bt=c%this.model.pageSettings.pageSize==0?parseInt(c/this.model.pageSettings.pageSize):parseInt(c/this.model.pageSettings.pageSize)+1;bt==wt&&(s=c%this.model.pageSettings.pageSize,at=n(r).find("tr[name="+u+"]").eq(s),at.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),tt=this._virtaulUnSel.indexOf(c),tt!=-1&&this._virtaulUnSel.splice(tt,1))}(p&&g&&(this._virIndex||n(g).hasClass("e-virtualrow")||g.offsetTop>u*ct)&&(this._gridRecordsCount-u>=this.model.pageSettings.pageSize||p.offsetParent.offsetHeight-lt<ct)||this._lastRow)&&(this._lastRow&&(this._lastRow=!1),this._virIndex&&(this._virIndex=!1),this._isVirtualRecordsLoaded=!0,ht.find(".e-content").scrollTop(lt),this._scrollValue=this.getContent()[0].firstChild.scrollTop);kt=n(o).get(0);dt=yt.firstChild;this._currentJsonData=a;this._gridRows=n(o).get(0).rows;it=n(o).find(".e-virtualrow").last();vt=this.model.scrollSettings.virtualScrollMode=="normal"?it.height()-(n(o).height()-this._gridRecordsCount*l):1;it.css("height",vt);this._eventBindings()},i.prototype._replacingVirtualContent=function(){var f=this.getContentTable()[0],e=this._currentLoadedIndexes,r=n("<tbody><\/tbody>"),s,l,i,u,a,h,c,t;if(this._checkCurrentVirtualView(this._virtualLoadedRows,this._currentVirtualIndex)){for(s=[],t=0;t<e.length;t++)n.merge(s,this._virtualLoadedRows[e[t]]);n(r).append(s)}else for(l=n("<tbody><\/tbody>"),t=0;t<e.length;t++)if(i=e[t],u=this._virtualLoadedRows[i],u)i<this._currentVirtualIndex?(c=r.find(".e-virtualview"+i),c.length?n(u).insertBefore(c):r.prepend(u)):n(u).insertAfter(r.find(".e-virtualview"+(i-1)));else{var l=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](this._virtualLoadedRecords[i])),o=l[0].rows,v=o.length-1;n(o[v]).addClass("e-virtualview"+i);a=i.toString(32);h=n(o).attr("name",a);(h.length==this._virtualRowCount||i==this._totalVirtualViews)&&(this._virtualLoadedRows[i]=h,r.append(o))}if(f.replaceChild(r[0],f.lastChild),n(f.rows).removeClass("e-hover"),this._setVirtualTopBottom(),(this._isThumbScroll||this._remoteRefresh)&&(this._scrollObject._content[0].scrollTop=this._scrollObject.scrollTop(),this._isThumbScroll=this._remoteRefresh=!1),this.model.allowSelection&&this._checkVirtualSelection(),this._gridRows=f.rows,this._checkCurrentVirtualView(this._queryCellView,this._currentVirtualIndex)||this._eventBindings(),this.model.queryCellInfo||this.model.rowDataBound)for(t=0;t<this._currentLoadedIndexes.length;t++)n.inArray(this._currentLoadedIndexes[t],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[t])},i.prototype._setVirtualTopBottom=function(){var f=this.getContentTable()[0],c=this._vRowHeight,v=t.dataUtil.mergeSort(t.distinct(this._currentLoadedIndexes)),y=t.dataUtil.min(v),e=t.dataUtil.max(v),p=this._getVirtualTotalRecord(),a,l,w,i,u,h,o,r,s;if(this.model.scrollSettings.virtualScrollMode=="continuous"&&this._virtualLoadedRows[e+1]&&(w=Object.keys(this._virtualLoadedRows),l=parseInt(t.dataUtil.max(w),10),e=l-e),a=e*this._virtualRowCount*c,n.inArray(this._totalVirtualViews,this._currentLoadedIndexes)!=-1&&this._currentVirtualIndex!=this._totalVirtualViews&&(a=(p-(this._virtualRowCount-this._lastViewData))*c),i=p*c-a,this.model.scrollSettings.virtualScrollMode!="continuous"||this._virtualLoadedRows[e+1]||(i=l&&l<=e+1?i:1),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),u=1e6,i>0&&this._getVirtualTotalRecord()>this._virtualRowCount*2)if(Math.round(i).toString().length<7)t.buildTag("div.e-virtualbottom","",{height:i}).insertAfter(f);else for(t.buildTag("div.e-virtualbottom").insertAfter(f),o=Math.ceil(i/u),r=0;r<o;r++)s=u,r==o-1&&(s=i%u),n(f).next().append(t.buildTag("div","",{height:s}));if(y>1)if(h=(y-1)*this._virtualRowCount*c,Math.round(h).toString().length<7)t.buildTag("div.e-virtualtop","",{height:h}).insertBefore(f);else for(t.buildTag("div.e-virtualtop").insertBefore(f),o=Math.ceil(h/u),r=0;r<o;r++)s=u,r==o-1&&(s=h%u),n(f).prev().append(t.buildTag("div","",{height:s}));this._scrollObject.model.scrollTop!=this._scrollValue&&this.getContent().ejScroller("model.scrollTop",this._scrollValue)},i.prototype._checkVirtualSelection=function(){for(var e,i,r,s,a,f,o,l,u=this.getContentTable()[0],t=0;t<this.selectedRowsIndexes.length;t++)i=this.selectedRowsIndexes[t],r=this._getSelectedViewData(i).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&(e=i%this._virtualRowCount+this._currentLoadedIndexes.indexOf(r)*this._virtualRowCount,n(u.rows[e].cells).hasClass("e-selectionbackground")||(n(n(u.rows[e]).attr("aria-selected","true")[0].cells).addClass("e-selectionbackground e-active"),this.model.selectedRecords[t]=this._virtualLoadedRecords[r][e%this._virtualRowCount]));for(t=0;t<this._rowIndexesColl.length;t++)i=this._rowIndexesColl[t],r=this._getSelectedViewData(i).viewIndex,(n.inArray(r,this._currentLoadedIndexes)!=-1&&n.inArray(i,this._virtualRowCellSelIndex)==-1||this._virtualDataRefresh)&&(s=n.inArray(i,this._rowIndexesColl),a=this.selectedRowCellIndexes[s].cellIndex);for(f=n(u.rows).find(".e-active, .e-cellselectionbackground").closest("tr"),t=0;t<f.length;t++){var v=parseInt(n(f[t]).attr("name"),32)*this._virtualRowCount,y=this._virtualRowCount-n(f[t]).index()%this._virtualRowCount,h=v-y,c=n(f[t]).index();this.selectedRowsIndexes.length&&n.inArray(h,this.selectedRowsIndexes)==-1&&(this._clearVirtualSelection=!0,this.clearSelection(c));this._rowIndexesColl.length&&n.inArray(h,this._rowIndexesColl)==-1&&n(this.getRowByIndex(c)[0].cells).removeClass("e-cellselectionbackground e-activecell")}for(n(u.rows).find(".e-columnselection").removeClass("e-columnselection"),o=0;o<this.selectedColumnIndexes.length;o++)l=this.selectedColumnIndexes[o]+1,n(u.rows).find("td:nth-of-type("+l+")").addClass("e-columnselection");this._clearVirtualSelection=!1},i.prototype._calculateWidth=function(){for(var t=this.getHeaderTable().find(".e-columnheader").last().find("th:visible"),i=0,n=0;n<t.length;n++)i+=t.eq(n).outerWidth();return i},i.prototype.columns=function(i,r){var f,u,e,o,s;if(!t.isNullOrUndefined(i)){for(f=!1,typeof i=="string"?(i=[i],f=!0):i instanceof Array&&i.length&&typeof i[0]=="string"&&(f=!0),u=0;u<i.length;u++)e=n.inArray(this.getColumnByField(f?i[u]:i[u].field),this.model.columns),r=="add"||t.isNullOrUndefined(r)?e==-1?this.model.columns.push(f?{field:i[u]}:i[u]):this.model.columns[e]=f?{field:i[u]}:i[u]:e!=-1&&this.model.columns.splice(e,1);for(this.columnsWidthCollection=[],o=!1,s=0;s<this.model.columns.length;s++)this.columnsWidthCollection.push(this.model.columns[s].width),t.isNullOrUndefined(o)||(o=!0);this._enableRowHover(o);(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.refreshContent(!0);this.model.allowScrolling&&(this.refreshScrollerEvent(),this.model.allowResizeToFit&&this.getContent().ejScroller("isVScroll")&&this._showHideScroller())}},i.prototype._enableRowHover=function(i,r){var f=!0,u;if(t.isNullOrUndefined(i)){for(u=0;u<this.model.columns.length;u++)if(!t.isNullOrUndefined(this.model.columns[u].tooltip)){f=!0;break}}else f=i;this.model.enableRowHover||f?r._on(this.element,"mouseenter mouseleave",".e-gridcontent tr td",n.proxy(this._rowHover,this)):r._off(this.element,"mouseenter mouseleave",".e-gridcontent tr td")},i.prototype._rowHover=function(i){var u=n(i.target),r,f;if(r=this.model.scrollSettings.frozenColumns?n(this.getRows()):this.element.find(".e-row.e-hover,.e-alt_row.e-hover"),(!u.closest("#"+this._id+"EditForm").length||!u.hasClass("e-rowcell"))&&u.hasClass("e-rowcell"))return i.type=="mouseenter"&&u.hasClass("e-gridtooltip")&&this._showTooltip(u),this.model.enableRowHover&&(i.type!="mouseenter"||this._dragActive?(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(r[0])&&!t.isNullOrUndefined(r[1])&&(r=n(r[0]).add(r[1])),r.removeClass("e-hover")):this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(r[0])&&!t.isNullOrUndefined(r[1])?(r=n(r[0]).add(r[1]),r.removeClass("e-hover"),f=this.getIndexByRow(u.parent()),f!=-1&&this.getRowByIndex(f).addClass("e-hover")):(r.removeClass("e-hover"),(u.parent().hasClass("e-row")||u.parent().hasClass("e-alt_row"))&&u.parent().addClass("e-hover"))),!1},i.prototype._showTooltip=function(i,r){var e=i.index(),l=i.hasClass("e-stackedHeaderCell"),u,o,c,a,f,h,s,v;if(i.hasClass("e-headercelldiv")&&(e=i.parent(".e-headercell").index()-this.model.groupSettings.groupedColumns.length),!l&&(this.model.childGrid||this.model.detailsTemplate)&&e--,this.model.scrollSettings.frozenColumns>0&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(e=e+this.model.scrollSettings.frozenColumns),u=l?this._getStackedColumnByTarget(i):this.getColumnByIndex(e),u.clipMode!=t.HeatMapGrid.ClipMode.Ellipsis){if(u.clipMode==t.HeatMapGrid.ClipMode.EllipsisWithTooltip&&(o=i,i.find("span").hasClass("e-tooltip")||(c=t.buildTag("span.e-tooltip",{},{}),c.html(i.html()),o.html(c)),o.find("span.e-tooltip").css("display","inline-block"),a=o.find("span:first")[0].getBoundingClientRect().width,o.find("span.e-tooltip").css("display","inline"),i.width()>a)){i.removeAttr("title");return}if(f=document.createElement("script"),t.isNullOrUndefined(u.tooltip)&&t.isNullOrUndefined(u.headerTooltip))return;f.id=(this._id+u.headerText+n.inArray(u,this.model.columns)+"_TemplateToolTip").split(" ").join("");f.type="text/x-template";s=r?"headerTooltip":"tooltip";t.isNullOrUndefined(u[s])||u[s].slice(0,1)==="#"?h=n(u[s]):f.text=u[s];h&&(f.text=h.html(),f.type=h.attr("type")||f.type);n("body").append(f);v=n(f).render({value:i.text()});i.attr("title",v)}else i.removeAttr("title")},i.prototype._colgroupRefresh=function(){var t,i,r,u;(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(t=n(this.getHeaderTable()).find("colgroup"),i=n(this.getContentTable()).find("colgroup")):(t=n(this.getHeaderTable()).find("colgroup")[0],i=n(this.getContentTable()).find("colgroup")[0]);r=n(t).clone();u=n(i).clone();n(i).remove();n(t).remove();(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(n(r[0]).prependTo(this.getHeaderTable()[0]),n(r[1]).prependTo(this.getHeaderTable()[1]),n(u[0]).prependTo(this.getContentTable()[0]),n(u[1]).prependTo(this.getContentTable()[1])):(n(r).prependTo(this.getHeaderTable()),n(u).prependTo(this.getContentTable()))},i.prototype._detailColsRefresh=function(){this._$headerCols=this.getHeaderTable().children("colgroup").find("col");this._$contentCols=this.getContentTable().children("colgroup").find("col");var n=this.model.columns.length;this._$headerCols.length>n&&this._$headerCols.splice(0,this._$headerCols.length-n);this._$contentCols.length>n&&this._$contentCols.splice(0,this._$contentCols.length-n)},i.prototype._htmlEscape=function(n){var t={"&":"&","<":"<",">":">",'"':""","'":"'"};return n.replace(/[&<>"']/g,function(n){return t[n]})},i.prototype._getForeignKeyData=function(n){for(var u,e,r=this,f={},i=0;i<this.model.columns.length;i++)this.model.columns[i].foreignKeyValue&&this.model.columns[i].dataSource&&(u=t.isNullOrUndefined(r.model.columns[i].foreignKeyField)?r.model.columns[i].field:r.model.columns[i].foreignKeyField,e=this.model.columns[i].dataSource instanceof t.DataManager?this.model.columns[i].foreignKeyData:this.model.columns[i].dataSource,e.filter(function(t){var e=n[r.model.columns[i].field],o=!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):e;t[u]==o&&(f[u]=t)}));return f},i.prototype._foreignKeyBinding=function(i,r,u){var f,e,o=n("#"+u).ejGrid("instance"),s;return i=o.model.columns[i],s=i.dataSource instanceof t.DataManager?i.foreignKeyData:i.dataSource,s.filter(function(n){if(t.getObject(i.foreignKeyField,n)==r)return e=t.getObject(i.foreignKeyValue,n),f=i.type=="date"?new Date(e):e}),i.format&&(f=o.formatting(i.format,f,o.model.locale)),f},i.prototype._setForeignKeyData=function(){var f;if(this._relationalColumns.length){var c=this._relationalColumns,l=this._relationalColumns.length,a=[],u=this.model.currentViewData,i={},r,e,o,s,v=this,h=t.proxy(function(n){this._trigger("actionFailure",{requestType:"fetchingforeigndata",error:n.error})},this);for(f=0;f<l;f++)if(0 in u){if(r=c[f],i.field=r.field,i.keyField=r.key,i.valueField=r.value,i.dataSource=r.dataSource,i.query=(new t.Query).select([i.valueField,i.keyField]).foreignKey(i.keyField),o=t.distinct(u.level?u.records:u,i.keyField,!0),e=t.UrlAdaptor.prototype.getFiltersFrom(o,i.query),i.query.where(e),this._trigger("actionBegin",n.extend(i,{requestType:"fetchingforeigndata",column:this.getColumnByField(i.field)})))return;s=i.dataSource.ready===undefined?i.dataSource.executeQuery(i.query,null,h):i.dataSource.ready.fail(h);a.push(s)}}},i.prototype._isRelationalRendering=function(n){return 0 in this._relationalColumns&&["add","beginedit","cancel"].indexOf(n.requestType)==-1},i.prototype._columns=function(){var n=this.element.find(".e-gridheader");n.find("div").first().empty().append(this._renderGridHeader().find("table"));this._headerCellgDragDrop();this.refreshContent(!0);this._trigger("refresh")},i.prototype._summaryRows=function(n,i,r){if(i=="showTotalSummary"||i=="showCaptionSummary"){var u=n.summaryRows,f=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;this.option("summaryRows")[u][i]=f}this.element.find(".e-gridfooter").remove();(i=="showCaptionSummary"||i=="title")&&(this._isCaptionSummary=this.option("summaryRows")[u].showCaptionSummary,this.model.showSummary=this._isCaptionSummary,this.model.groupSettings.groupedColumns.length!=0&&this._refreshCaptionSummary())},i.prototype._summaryRows_summaryColumns=function(n,i,r){(i=="displayColumn"||i=="dataMember")&&t.isNullOrUndefined(this.getColumnByField(r))||this.element.find(".e-groupcaptionsummary").length!=0&&this._refreshCaptionSummary()},i.prototype._stackedHeaderRows_stackedHeaderColumns=function(){this._refreshStackedHeader()},i.prototype._sortSettings_sortedColumns=function(n,t,i){var u,f,r=this.model.sortSettings.sortedColumns[n["sortSettings.sortedColumns"]];t=="field"?(u=this.getColumnByField(i)!=null?i:null,f=r.direction=="ascending"||r.direction=="descending"?r.direction:null):t=="direction"&&(u=this.getColumnByField(r.field)!=null?r.field:null,f=i=="ascending"||i=="descending"?i:null);u!=null&&f!=null&&this.sortColumn(u,f)},i.prototype._filterSettings_filteredColumns=function(n,i,r){var f,e,o,s,h,u=this.model.filterSettings.filteredColumns[n["filterSettings.filteredColumns"]];switch(i){case"field":f=this.getColumnByField(r)!=null?r:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"matchcase":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;break;case"operator":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,r);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"predicate":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=r=="and"||r=="or"?r:null;o=u.matchcase;break;case"value":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=r;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase}f!=null&&e!=null&&h!=null&&s!=null&&o!=null&&this.filterColumn(f,e,h,s,o)},i.prototype._map=function(t,i){var r=n.map(t,function(n){if(n===i)return n});return r.length!=0?r[0]:null},i.prototype._refreshCaptionSummary=function(){var t=document.createElement("div");t.innerHTML=["<table>",n.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("");this.getContentTable().get(0).replaceChild(t.firstChild.firstChild,this.getContentTable().get(0).lastChild);this.refreshContent()},i.prototype.getContentTable=function(){return this._gridContentTable},i.prototype.setGridContentTable=function(n){this._gridContentTable=n},i.prototype.getContent=function(){return this._gridContent},i.prototype.setGridContent=function(n){this._gridContent=n},i.prototype.getHeaderContent=function(){return this._gridHeaderContent},i.prototype.getHeaderTable=function(){return this._gridHeaderTable},i.prototype.getRows=function(){return this._gridRows},i.prototype.getFilteredRecords=function(){return this._filteredRecords},i.prototype.getRowByIndex=function(i,r){var e;try{var f=this.getRows(),o=this._excludeDetailRows(),u=n();if(n.isArray(i)){for(e=0;e<i.length;e++)this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i[e]]),u.push(f[1][i[e]])):u.push(f[i[e]]);return u}return t.isNullOrUndefined(r)?this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i]),u.push(f[1][i]),u):n(o.not(".e-virtualrow")[i]):this.model.scrollSettings.frozenColumns>0?(u.push(n(f[0]).slice(i,r)),u.push(n(f[1]).slice(i,r)),u):n(o.not(".e-virtualrow").slice(i,r))}catch(s){return n()}},i.prototype.getColumnIndexByField=function(n){for(var t=0,i=this.model.columns,r=i.length;t<r;t++)if(i[t].field===n)return t;return-1},i.prototype.getColumnIndexByHeaderText=function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r},i.prototype.getIndexByRow=function(t){var r=this.getRows(),u=this._excludeDetailRows(),i;return this.model.scrollSettings.frozenColumns>0?(i=n(r[0]).index(t),i==-1&&(i=n(r[1]).index(t)),i):u.not(".e-virtualrow").index(t)},i.prototype.getPrimaryKeyFieldNames=function(){if(this._primaryKeys.length!=0)return this._primaryKeys;for(var n=0,t=this.model.columns,i=t.length;n<i;n++)t[n].isPrimaryKey&&this._primaryKeys.push(t[n].field);return this._primaryKeys},i.prototype.getVisibleColumnNames=function(){return this._visibleColumns},i.prototype.getHiddenColumnNames=function(){return this._hiddenColumns},i.prototype.getColumnByField=function(n){for(var t=0;t<this.model.columns.length;t++)if(this.model.columns[t].field==n)break;return t==this.model.columns.length?null:this.model.columns[t]},i.prototype.getsortColumnByField=function(n){for(var t=0;t<this.model.sortSettings.sortedColumns.length;t++)if(this.model.sortSettings.sortedColumns[t].field==n)break;return t==this.model.sortSettings.sortedColumns.length?null:this.model.sortSettings.sortedColumns[t]},i.prototype.getColumnByHeaderText=function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r==this.model.columns.length?null:this.model.columns[r]},i.prototype.getCurrentViewData=function(){return this._currentJsonData},i.prototype.getColumnFieldNames=function(){for(var t=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].field&&t.push(this.model.columns[n].field);return t},i.prototype.getBrowserDetails=function(){var t=navigator.userAgent.match(/(firefox|mozilla|chrome|opera|msie|safari)\s?\/?(\d+(.\d+)*)/i);return!navigator.userAgent.match(/Trident\/7\./)?{browser:t[1].toLowerCase(),version:t[2]}:{browser:"msie",version:n.uaMatch(navigator.userAgent).version}},i.prototype._initComplexColumn=function(n,i,r){var e=r||i,u,o,f;for(u in n)typeof n[u]!="object"||t.isNullOrUndefined(n[u])?(o=e.concat(".").concat(u),f=n[u],this.model.columns.push({field:o,type:f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null})):(e=e.concat(".").concat(u),this._initComplexColumn(n[u],u,e))},i.prototype._initColumns=function(i){for(var f,e,r,u,o;i.items!=undefined;)i=i.items[0];if(this.model.columns.length==0&&i){for(f in i)i.hasOwnProperty(f)&&(typeof i[f]!="object"||i[f]instanceof Date||i[f]==null)?(e=i[f],this.model.columns.push({field:f,type:e!=null?e.getDay?e.getHours()>0||e.getMinutes()>0||e.getSeconds()>0||e.getMilliseconds()>0?"datetime":"date":typeof e:null})):typeof i[f]=="object"&&this._initComplexColumn(i[f],f);this.model.columns.length&&this._renderAfterColumnInitialize()}else for(r=0;r<this.model.columns.length;r++)this.model.columns[r].field=t.isNullOrUndefined(this.model.columns[r].field)?"":this.model.columns[r].field,t.isNullOrUndefined(this.model.columns[r].validationRules)||this._validatedColumns.push(this.model.columns[r].field),t.isNullOrUndefined(this.model.columns[r].type)?(u=t.isNullOrUndefined(this.model.columns[r].field)?null:t.getObject(this.model.columns[r].field,i),o=this.model.columns[r].dataSource,!!o&&this.model.columns[r].foreignKeyValue&&(this.model.columns[r].originalType=u!=null?u.getDay?u.getHours()>0||u.getMinutes()>0||u.getSeconds()>0||u.getMilliseconds()>0?"datetime":"date":typeof u:null,u=(o instanceof t.DataManager)?t.getObject("0."+this.model.columns[r].foreignKeyValue,this.model.columns[r].foreignKeyData):t.getObject("0."+this.model.columns[r].foreignKeyValue,o)),this.model.columns[r].type=u!=null?u.getDay?u.getHours()>0||u.getMinutes()>0||u.getSeconds()>0||u.getMilliseconds()>0?"datetime":"date":typeof u:null):this.model.columns[r].type!="date"||this.model.columns[r].format!=undefined||this._isReorder==!0||this.model.allowGrouping==!0||this._showHideColumns?this.model.columns[r].type!="datetime"||this.model.columns[r].format!=undefined||this._isReorder==!0||this.model.allowGrouping==!0||this._showHideColumns||(t.isNullOrUndefined(t.globalize)?n.extend(this.model.columns[r],{format:"{0:"+t.preferredCulture().calendars.standard.patterns.d+" "+t.preferredCulture().calendars.standard.patterns.t+"}"}):n.extend(this.model.columns[r],{format:"{0:M/d/yyyy h:mm tt}"})):t.isNullOrUndefined(t.globalize)?n.extend(this.model.columns[r],{format:"{0:"+t.preferredCulture().calendars.standard.patterns.d+"}"}):n.extend(this.model.columns[r],{format:"{0:M/d/yyyy}"})},i.prototype._getExpands=function(n,t){var r=n.split("."),i="",u,f;for(r.splice(r.length-1,1),u=0;u<r.length;u++,i=""){for(f=0;f<u;f++)i+=r[f]+"/";i=i+r[u];t.indexOf(i)===-1&&t.push(i)}},i.prototype._ensureDataSource=function(i){var r,k,v,y,s,h,e,u,o,d,p,g,nt,w,b,l,f,tt,c,it,a,rt;if(this._dataSource()==null&&!(this._dataSource()instanceof t.DataManager)){if(t.isNullOrUndefined(i)||i.requestType!="add")return;this.dataSource([])}if(this.model.query.requiresCount(),r=this.model.query,k=r.clone(),this._dataSource()instanceof t.DataManager||(this.model.currentViewData=this._dataSource()),this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!t.isNullOrUndefined(this._cModifiedData)||!t.isNullOrUndefined(this._cAddedRecord))){if(t.isNullOrUndefined(this._cAddedRecord)){for(s=0;s<this._primaryKeys.length;s++)r=r.where(this._primaryKeys[s],t.FilterOperators.equal,this._primaryKeyValues[s]);v=this._dataManager.executeLocal(r);this._dataSource()instanceof t.DataManager?n.extend(this._dataSource().dataSource.json[n.inArray(v.result[0],this._dataSource().dataSource.json)],this._cModifiedData):n.extend(this._dataSource()[n.inArray(v.result[0],this._dataSource())],this._cModifiedData);this._cModifiedData=null}else y=this._cAddedRecord,this._cAddedRecord=null,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.unshift(y):this._dataSource(undefined,!0).splice(0,0,y);r.queries=k.queries;this.model.editSettings.showAddNewRow||(this.model.isEdit=!1)}if(i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&(this._excludeDetailRows().length==1||this.multiDeleteMode=="multiple"&&this.selectedRowsIndexes.length==this._excludeDetailRows().length)&&this.model.pageSettings.currentPage!=1&&this._currentPage(this.model.pageSettings.totalPages-1),i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&!t.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof t.DataManager?(s=n.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(s,1)):(s=n.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(undefined,!0).splice(s,1))),this.model.sortSettings.sortedColumns.length){for(h=[],e=this.model.sortSettings.sortedColumns,u=e.length-1;u>=0;u--)if(this.model.groupSettings.groupedColumns.indexOf(e[u].field)==-1){if(r.sortBy(e[u].field,e[u].direction),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&n.inArray(e[u],this._prevVirtualSort)==-1){for(o=0;o<this._prevVirtualSort.length;o++)e[u].field==this._prevVirtualSort[o].field&&this._prevVirtualSort.splice(o,1);this._needVPaging=this._currentVirtualIndex*this._virtualRowCount%this.model.pageSettings.pageSize<=this._virtualRowCount;this._prevVirtualSort.push(e[u]);this._virtualDataRefresh=!0;this._refreshVirtualViewData()}}else h.push({field:e[u].field,direction:e[u].direction});for(o=0;o<h.length;o++)r.sortBy(h[o].field,h[o].direction)}if((this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization)&&(this._isLocalData?(d=this._dataManager.executeLocal(r),this._recordsCount=d.count,p=this._recordsCount%this.model.pageSettings.pageSize==0?this._recordsCount/this.model.pageSettings.pageSize:parseInt(this._recordsCount/this.model.pageSettings.pageSize,10)+1,this._currentPage()>p&&this._currentPage(p)):t.isNullOrUndefined(i)&&this._currentPage(1),this._currentPage()==0&&(this._prevPageNo==0||this._prevPageNo==null?this._currentPage(1):this._currentPage(this._prevPageNo)),r.page(this._currentPage(),this.model.pageSettings.pageSize)),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._needPaging=!0,this.initialRender&&this.model.currentIndex>1&&(this.model.currentIndex<=this._getVirtualTotalRecord()||!this._isLocalData)&&(this.model.scrollSettings.virtualScrollMode=="continuous"&&(this.model.currentIndex=1),this._currentVirtualIndex=Math.ceil(this.model.currentIndex/this._virtualRowCount),this._isThumbScroll=!0,this._currentPage(Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this._virtualDataRefresh&&(this._isThumbScroll=!0,this._refreshVirtualViewData(!0),this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0,this._currentPage(Math.ceil(this._currentVirtualIndex*this._virtualRowCount/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this.model.virtualLoading!=null&&(this._gridRecordsCount=this.model.pageSettings.totalRecordsCount),this.model.filterSettings.filteredColumns==0&&this._prevVirtualFilter.length&&(this._refreshVirtualViewData(),this._prevVirtualFilter=[]),this._isLocalData&&this.initialRender&&this._refreshVirtualViewDetails(),this._getVirtualLoadedRecords(r)),i!=undefined&&i.requestType=="add"&&this._isLocalData&&this.model.groupSettings.groupedColumns.length==0&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&((this._dataSource()instanceof t.DataManager)?this._dataSource().dataSource.json.unshift(i.data):this._dataSource().unshift(i.data)),t.isNullOrUndefined(i)||i.action!="add"||t.isNullOrUndefined(this.model.parentDetails)||(g=this.getColumnByField(this.model.parentDetails.parentKeyField),nt=n.inArray(g,this.model.columns),nt==-1&&(w={},w[this.model.parentDetails.parentKeyField]=this.model.parentDetails.parentKeyFieldValue,n.extend(!0,this.model.currentViewData[0],w))),this._cloneQuery=r.clone(),this._isLocalData&&(!this.model.scrollSettings.enableVirtualization||this._virtualDataRefresh)){if(b=this._dataManager.dataSource.json,l=this._dataSource().dataSource,!t.isNullOrUndefined(l)&&this._dataSource()instanceof t.DataManager&&(this._dataManager.dataSource.json=b!=l.json?l.json:b),f=this._dataManager.executeLocal(r),this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&(this._prevPageRendered=!0),this.model.scrollSettings.allowVirtualScrolling&&!this._prevPageRendered&&f.result.length!=this.model.pageSettings.pageSize&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage)tt=t.pvt.filterQueries(r.queries,"onPage"),r.queries.splice(n.inArray(tt[0],r.queries),1),r.page(this._currentPage()-1,this.model.pageSettings.pageSize),c=this._dataManager.executeLocal(r),c.result.splice(0,f.result.length),this._previousPageRecords=n.extend(!0,[],c.result),this._previousPageLength=f.result.length,this._currentPageData=f.result,t.merge(c.result,f.result),this.model.currentViewData=c.result,this._lastPageRendered=!0;else if(this._lastPageRendered&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&!this.model.scrollSettings.enableVirtualization){for(it=this.model.pageSettings.pageSize-this._previousPageLength,a=0;a<it;a++)rt=this.getRows()[this.getRows().length-(this.model.pageSettings.pageSize-a)],rt.remove();this._tempPageRendered=!0;this.model.currentViewData=f.result}else this.model.currentViewData=f.result;this._gridRecordsCount=f.count;this._remoteSummaryData=f.aggregates;this._searchCount=this._searchString.length?f.count:null;this.model.groupSettings.groupedColumns.length&&this._setAggregates()}},i.prototype._refreshViewPageDetails=function(){this._currentPage(1);this.model.currentIndex=0;this._currentVirtualIndex=1;this.getContent().ejScroller("model.scrollTop",0)},i.prototype._refreshVirtualViewDetails=function(n){n&&(this._gridRecordsCount=this._dataSource()!==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount);this._totalVirtualViews=Math.ceil(this._getVirtualTotalRecord()/this._virtualRowCount);this._maxViews=Math.ceil(this.model.pageSettings.pageSize/this._virtualRowCount);this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize);this.model.pageSettings.totalRecordsCount=this._gridRecordsCount;this._lastViewData=this._virtualRowCount-(this._totalVirtualViews*this._virtualRowCount-this._getVirtualTotalRecord())},i.prototype._getVirtualLoadedRecords=function(t){var i=this._currentPage(),r,u,f;if(this._needPaging&&(this._isLastVirtualpage=r=this._isThumbScroll&&i==this.model.pageSettings.totalPages&&!this._virtualPageRecords[i],(this.initialRender||this._virtualDataRefresh)&&(r=!0),this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||i!=1)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._getVirtualOnLoadingData(i,!r):this._setVirtualPaging(t,i,!r),!this.initialRender&&this._isThumbScroll&&this._virtualPageRecords[i]&&!this._virtualDataRefresh&&this._checkPrevNextViews(i,t)),this._needPaging=!1,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.initialRender&&this._isLocalData)for(this.model.currentViewData=[],u=0;u<this._currentLoadedIndexes.length;u++)f=this._currentLoadedIndexes[u],this._virtualLoadedRecords[f]&&n.merge(this.model.currentViewData,this._virtualLoadedRecords[f])},i.prototype._setVirtualPaging=function(i,r,u){var e=t.pvt.filterQueries(i.queries,"onPage"),f;e.length&&i.queries.splice(n.inArray(e[0],i.queries),1);(!u||this._needVPaging)&&this.model.currentIndex>this._virtualRowCount?(this._initCurrentIndex(i,r),this._needVPaging=!1):i.page(r,this.model.pageSettings.pageSize);this._isLocalData&&!this._virtualPageRecords[r]&&(f=this._dataManager.executeLocal(i),this.initialRender||(this.model.currentViewData=f.result),f.result.length?(this._setVirtualLoadedRecords(f.result,r),n.inArray(r,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(r)):this.getContent().find(".e-virtualtop, .e-virtualbottom").remove())},i.prototype._checkPrevNextViews=function(){var n=this._currentVirtualIndex,u=this._virtualLoadedRecords[n-1],f=this._virtualLoadedRecords[n+1],r=this._maxViews==3?1:2,t,i;n!=1&&n!=this._totalVirtualViews&&(u&&u.length==this._virtualRowCount?f&&f.length==this._virtualRowCount||this._totalVirtualViews==n-1||(i=n-r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i-1,t=this._scrollValue-r*this._virtualRowCount*this._vRowHeight):(i=n+r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i+1,t=this._scrollValue+r*this._virtualRowCount*this._vRowHeight),t&&(this._scrollValue=t,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.model.currentIndex=t==0?t:Math.floor(t/this._vRowHeight)))},i.prototype._initCurrentIndex=function(n,t){var u=t*this.model.pageSettings.pageSize,o=this._currentVirtualIndex*this._virtualRowCount+this._virtualRowCount,s=this._currentVirtualIndex*this._virtualRowCount-this._virtualRowCount*2,c=o>u||s<u-this.model.pageSettings.pageSize,r,f,i,h,e;c||this._isLastVirtualpage?(o>u?(r=(t-1)*this.model.pageSettings.pageSize,f=this.model.pageSettings.pageSize*2,this._isInitNextPage=!0):(s<u-this.model.pageSettings.pageSize||this._isLastVirtualpage)&&(r=(t-2)*this.model.pageSettings.pageSize,f=this.model.pageSettings.pageSize*2,this._isInitNextPage=!1,this._remoteRefresh=!0),this.model.virtualLoading&&this._isLocalData?(i={},i.endIndex=r+f,i.endIndex=i.endIndex>this._getVirtualTotalRecord()?this._getVirtualTotalRecord():i.endIndex,i.startIndex=r,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),e=i.result,this._setInitialCurrentIndexRecords(e,t)):(n.skip(r).take(f),this._isLocalData&&(h=this._dataManager.executeLocal(n),e=h.result,this._isLastVirtualpage=!1,this._setInitialCurrentIndexRecords(e,t)))):(this._needVPaging=!1,this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||t!=1)?this._getVirtualOnLoadingData(t,!0):this._setVirtualPaging(n,t,!0))},i.prototype._setInitialCurrentIndexRecords=function(n,t){for(var i=0;i<2;i++){var r=i*this.model.pageSettings.pageSize,f=r+this.model.pageSettings.pageSize,e=n.slice(r,f),u;u=this._isInitNextPage?i==0?t:t+1:i==0?t-1:t;this._setVirtualLoadedRecords(e,u)}},i.prototype._getVirtualOnLoadingData=function(n,t){var i,r;n>0&&(this.model.currentIndex>this._virtualRowCount&&(!t||this._needVPaging)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._initCurrentIndex(undefined,n):(i={},i.endIndex=n*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:n*this.model.pageSettings.pageSize,i.startIndex=n*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),r=i.result,this._setVirtualLoadedRecords(r,n)))},i.prototype._setVirtualLoadedRecords=function(t,i){var u=this._virtualRowCount,h=this.model.pageSettings.pageSize,v=h/u,o,y=Math.ceil(i*h/u),p=i==this.model.pageSettings.totalPages,l,e,f,s,r,w,c,a,b;for(this._virtualPageRecords[i]||(this._virtualPageRecords[i]=t),p&&(l=this._getVirtualTotalRecord()%h,y=(!this._virtualLoadedRecords[this._totalVirtualViews]||this._virtualLoadedRecords[this._totalVirtualViews].length!=this._lastViewData)&&l<this._lastViewData&&l!=0?this._totalVirtualViews+1:this._totalVirtualViews,this._getVirtualTotalRecord()<u&&(this._singleView=!0)),e=0;e<v;e++)r=Math.ceil((i-1)*v+(e+1)),(r<=this._totalVirtualViews||p)&&r<=y&&(this._virtualLoadedRecords[r-1]&&this._virtualLoadedRecords[r-1].length!=u?(w=this._virtualLoadedRecords[r-1].length+e*u,f=u-w+e*u,n.merge(this._virtualLoadedRecords[r-1],t.slice(0,f)),o=s=f+u,r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,o))):r==1||this._virtualLoadedRecords[r-1]?(f=o?o:e*u%h,o=s=f+u):(c=s=(r-1)*u%h,c!=0&&(this._virtualLoadedRecords[r-1]=t.slice(0,c)),f=c,s=o=c+u),this._virtualLoadedRecords[r]&&this._virtualLoadedRecords[r].length!=u?(a=t.slice(f,s),a.length+this._virtualLoadedRecords[r].length<=u&&(b=n.merge(a,this._virtualLoadedRecords[r]),this._virtualLoadedRecords[r]=b)):!this._virtualLoadedRecords[r]&&r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,s)));n.inArray(i,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(i)},i.prototype._setVirtualLoadedIndexes=function(n){var i,t;for(this._currentLoadedIndexes=[],i=n==this._totalVirtualViews?n:n+1,n!=1&&(n=n-1),t=n;t<=i;t++)this._currentLoadedIndexes.push(t)},i.prototype._getVirtualTotalRecord=function(){return this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount},i.prototype._initGridRender=function(t){var r,i;this.addInitTemplate();this.model.scrollSettings.frozenColumns>0&&this.addFrozenTemplate();this.model.allowGrouping&&this.addGroupingTemplate();this.model.showSummary&&this.addSummaryTemplate();this.model.keySettings&&n.extend(this.model.keyConfigs,this.model.keySettings);this.render();this._setTextWrap();this._wireEvents(t);this.initialRender=!1;this.model.width&&!this.model.allowScrolling&&this.element.width(this.model.width);(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.model.parentDetails&&(r=this.model.parentDetails.parentID,i=n("#"+r).data("ejGrid"),i.model.allowScrolling&&i._refreshScroller({requestType:"refresh"}));this.element.closest("tr").hasClass("e-detailrow")&&!this.model.parentDetails&&(i=this.element.closest("tr.e-detailrow").closest(".e-grid").data("ejGrid"),i.model.allowScrolling&&i.getScrollObject().refresh())},i.prototype._setTextWrap=function(){if(this.model.allowTextWrap==!0)switch(this.model.textWrapSettings.wrapMode){case"content":this.element.find(".e-columnheader").removeClass("e-wrap");this.element.removeClass("e-wrap");this.getContent().addClass("e-wrap");break;case"header":this.element.removeClass("e-wrap");this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").addClass("e-wrap");break;default:this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").removeClass("e-wrap");this.element.addClass("e-wrap")}else this.getContent().removeClass("e-wrap"),this.element.find(".e-columnheader").removeClass("e-wrap"),this.element.removeClass("e-wrap")},i.prototype._getMetaColGroup=function(){for(var r,u=t.buildTag("colgroup"),i=0;i<this.model.columns.length;i++)r=n(document.createElement("col")),this.model.columns[i].visible===!1&&r.css("display","none"),this.model.rowTemplate==null||t.isNullOrUndefined(this.model.columns[i].cssClass)||r.addClass(this.model.columns[i].cssClass),this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&n.inArray(this.model.columns[i].field,this.model.groupSettings.groupedColumns)!=-1&&r.css("display","none"),u.append(r);return u},i.prototype._alternateRow=function(){return this.getIndex()%2==0?"e-row":"e-alt_row"},i.prototype.formatting=function(i,r,u){var f,l,h,c,a,v,s,e,y;if(i=i.replace(/%280/g,'"').replace(/</g,"<").replace(/>/g,">"),u=t.preferredCulture(u)?u:"en-US",f=i,l=i.split("{0:"),a=i.split("}"),h=l[0],c=a[1],typeof r=="string"&&n.isNumeric(r)&&(r=Number(r)),i.indexOf("{0:")!=-1)return v=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),s=v.exec(i),s!=null&&r!=null?h!=null&&c!=null?h+t.format(r,s[2],u)+c:t.format(r,s[2],u):r!=null?r:"";if(f.startsWith("{")&&!f.startsWith("{0:")){var o=f.split(""),r=(r||"")+"",p=r.split(""),w=/[0aA\*CN<>\?]/gm;for(e=0,y=0;e<o.length;e++)o[e]=w.test(o[e])?"{"+y+++"}":o[e];return String.format.apply(String,[o.join("")].concat(p)).replace("{","").replace("}","")}return this.data!=null&&this.data.Value==null?(n.each(this.data,function(n,t){f=f.replace(new RegExp("\\{"+n+"\\}","gm"),t)}),f):this.data.Value},i.prototype.addInitTemplate=function(){var p=this.element.find(".e-headercelldiv:not(.e-emptyCell)"),l={},w=!0,a=document.createElement("tbody"),v=n(a),c,b,u,tt,o,k,g,f,nt;if(this.model.rowTemplate==null){var y=document.createElement("tr"),e=n(y),r=this.model.columns,i;for(this._gridRecordsCount&&!this._virtualDataRefresh?this._initColumns(this.model.currentViewData[0]!=undefined?this.model.currentViewData[0]:this.model.currentViewData.value):this._isLocalData&&(this._dataSource()!=null&&this._dataSource().length||this._dataManager&&this._dataManager.dataSource.json.length)&&this._initColumns(this._dataSource()[0]!=undefined?this._dataSource()[0]:this._dataManager.dataSource.json[0]),c={_gridFormatting:this.formatting},n.views.helpers(c),f={},f._foreignKey=this._foreignKeyBinding,n.views.helpers(f),(this.model.childGrid||this.model.detailsTemplate)&&(b=t.buildTag("td.e-detailrowcollapse","<div class='e-icon e-gnextforward'><\/div>"),e.append(b)),i=0;i<this.model.columns.length;i++){if(u=t.buildTag("td.e-rowcell"),t.isNullOrUndefined(r[i].tooltip)&&r[i].clipMode!=t.HeatMapGrid.ClipMode.EllipsisWithTooltip||u.addClass("e-gridtooltip"),(r[i].clipMode==t.HeatMapGrid.ClipMode.Ellipsis||r[i].clipMode==t.HeatMapGrid.ClipMode.EllipsisWithTooltip)&&u.addClass("e-gridellipsis"),this.model.isResponsive&&u.attr("data-cell",this._decode(this.model.columns[i].headerText)),r[i].visible==!1?u.addClass("e-hide"):(w&&(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&u.addClass("e-detailrowvisible"),w=!1),this.model.groupSettings.showGroupedColumn||u.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[i].field+"'}}e-hide{{/if}}{{/for}}"),t.isNullOrUndefined(r[i].templateID||r[i].template)){for(var s=(r[i].field||"").split("."),d=s.length-1,h="";d;)h+="(",d--;g=r[i].type||r[i].editType;switch(g){default:r[i].disableHtmlEncode?u.html("{{html:"+h+"#data['"+s.join("'] || {})['")+"']}}"):u.html("{{:"+h+"#data['"+s.join("'] || {})['")+"']}}")}r[i].format==undefined||r[i].foreignKeyValue||u.html("{{:~_gridFormatting('"+r[i].format+"',"+h+"#data['"+s.join("'] || {})['")+"'],'"+this.model.locale+"')}}");r[i].foreignKeyValue&&r[i].dataSource&&u.html("{{:~_foreignKey("+i+","+h+"#data['"+s.join("'] || {})['")+"'],'"+this._id+"')}}");r[i].commands&&(f={},n.views.helpers(f),(t.isNullOrUndefined(r[i].field)||r[i].field=="")&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),t.isNullOrUndefined(r[i].headerText)||n("#"+this._id+r[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate").remove(),nt=this._createUnboundElement(r[i]),t.isNullOrUndefined(r[i].headerText)||u.addClass("e-unboundcell").addClass("e-"+r[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+nt.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&u.addClass("e-frozenunbound"),this._isUnboundColumn=!0)}else f={},o=r[i].headerText,f["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this,tt),n.views.helpers(f),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.match(/[^0-9\s\w]/g))||(o=o.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+o+i+"_Template").remove(),k=this._createTemplateElement(r[i]),(r[i].field==""||t.isNullOrUndefined(r[i].field))&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),r[i].template!=!1&&u.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+k.id+"','"+i+"')}}");r[i].textAlign==undefined&&(r[i].textAlign="left");r[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(r[i].field)),this._primaryKeys=n.unique(this._primaryKeys));this.phoneMode&&this.model.enableResponsiveRow||r[i].textAlign==undefined||(u.css("text-align",r[i].textAlign),n(p[i]).css("text-align",r[i].textAlign));this.phoneMode||t.isNullOrUndefined(r[i].headerTextAlign)||n(p[i]).css("text-align",r[i].headerTextAlign);t.isNullOrUndefined(r[i].cssClass)||u.addClass(r[i].cssClass);t.isNullOrUndefined(r[i].priority)||u.addClass("e-table-priority-"+r[i].priority);t.isNullOrUndefined(r[i].customAttributes)||u.attr(r[i].customAttributes);u.addClass("sf-ht-heatmapcell");u.attr("role","heatmapcell");e.append(u);this.model.enableAltRow?(c["_"+this._id+"AlternateRow"]=this._alternateRow,n.views.helpers(c),e.addClass("{{:~_"+this._id+"AlternateRow()}}")):e.addClass("e-row");e.attr("role","row");this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenColumns==i+1&&(a.appendChild(y),l[this._id+"_JSONFrozenTemplate"]=v.html(),e.empty(),v.empty())}a.appendChild(y)}l[this._id+"_JSONTemplate"]=this.model.rowTemplate!=null?n(this.model.rowTemplate).html():v.html();n.templates(l)},i.prototype.render=function(){this.model.showSummary=this.model.summaryRows.length>0||this.model.showSummary;this._renderGridContent().insertAfter(this.element.children(".e-gridheader"));this.model.allowResizeToFit&&this.setWidthToColumns();this._initialEndRendering()},i.prototype._createStackedRow=function(i,r){for(var v,ft,et,u,y,p,w,f,e,st,k,a=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),l=[],d=[],g=[],nt=[],o=0;o<this.model.columns.length;o++)if(v=this.model.columns[o],v.visible!=!1){if(this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&this.model.groupSettings.groupedColumns.length>0&&n.inArray(v.field,this.model.groupSettings.groupedColumns)!=-1)continue;var tt="",it="",rt="",ut="",h=i.stackedHeaderColumns;for(e=0;e<h.length;e++)ft=n.isArray(h[e].column)?h[e].column:n.map(h[e].column.split(","),n.trim),et="e-row"+n.inArray(i,this.model.stackedHeaderRows)+"-column"+e,n.inArray(v.field,ft)!=-1&&(tt=h[e].headerText,it=h[e].cssClass,rt=h[e].textAlign,ut=h[e].tooltip?" e-gridtooltip "+et:"");l.push(tt);d.push(it);g.push(rt);nt.push(ut)}for(u=[],f=0;f<l.length;f++){for(y=1,p=f+1;p<l.length;p++)if(l[f]==l[p])y++;else break;u.push({sapnCount:y,headerText:l[f],cssClass:d[f],txtAlign:g[f],tooltip:nt[f]});f+=y-1}if(a=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),w=this.model.scrollSettings.frozenColumns,this.model.allowScrolling&&w>0){var b=[],c=0,s=0,ot=0;for(f=0;f<this.model.columns.length;f++)e=this.model.columns[f],f<w&&e.visible==!1&&ot++;for(c=w-ot;c>0;)st=u[s].sapnCount,u[s].sapnCount<c?(b.push(u[s]),r?s++:u.splice(s,1)):u[s].sapnCount>c?(u[s].sapnCount=u[s].sapnCount-c,r&&b.push({sapnCount:c,headerText:u[s].headerText})):(b.push(u[s]),r||u.splice(s,1)),c-=st;r&&(u=b)}for((this.model.detailsTemplate||this.model.childGrid)&&a.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),o=0;o<u.length;o++)k=t.buildTag("th.e-headercell e-stackedHeaderCell e-default"+u[o].tooltip,u[o].headerText,{},{colspan:u[o].sapnCount}),k.css("textAlign",u[o].txtAlign),a.append(k),u[o].cssClass!=undefined&&k.addClass(u[o].cssClass);return a},i.prototype._renderGridContent=function(){var o=t.buildTag("div.e-gridcontent"),h=t.buildTag("div"),f=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),c=n(document.createElement("tbody")),r,i,e,l,u,s,a;if(f.append(this.getHeaderTable().find("colgroup").clone()).append(c),h.html(f),o.html(h),this.setGridContentTable(f),this.setGridContent(o),f.attr("role","heatmap"),r={},this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length){if(this.initialRender&&(r.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],!this.model.groupSettings.showGroupedColumn))for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)e=this.model.groupSettings.groupedColumns[i],n.inArray(e,this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(e),this.getColumnByField(e).visible=!1);r.requestType=t.HeatMapGrid.Actions.Grouping}else r.requestType=t.HeatMapGrid.Actions.Refresh;if(this._dataSource()==null||this._dataSource().length==0||this.model.currentViewData.length==0?(l=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length}),c.append(n(document.createElement("tr")).append(l)),this.setWidthToColumns(),this.initialRender&&this.sendDataRenderingRequest(r)):this.sendDataRenderingRequest(r),this._isCaptionSummary&&r.requestType=="grouping"&&this.model.groupSettings.groupedColumns.length>1)for(u=this.getContentTable().find(".e-table").not(".e-recordtable").children("colgroup"),s=n(this.getContentTable().find(".e-recordtable")[0]).children("colgroup").find("col"),i=0;i<u.length;i++)a=n(u[i]).find("col").length,n(u[i]).find("col:gt("+(a-s.length-1)+")").remove(),n(u[i]).append(s.clone());return o},i.prototype.sendDataRenderingRequest=function(i){var v,rt,ut,s,ft,et,tt,a,k,ot,c,y,o,d,it,st,g,ht;if(this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1),this.setFormat(),this.model.scrollSettings.enableVirtualization||(this._previousColumnIndex=null,this._previousRowCellIndex=null,this._previousIndex=null),i.requestType=="add"||i.requestType=="grouping"||this.model.currentViewData!=null&&this.model.currentViewData.length)switch(i.requestType){case t.HeatMapGrid.Actions.Refresh:case t.HeatMapGrid.Actions.Paging:case t.HeatMapGrid.Actions.Sorting:case t.HeatMapGrid.Actions.Filtering:case t.HeatMapGrid.Actions.Save:case t.HeatMapGrid.Actions.Cancel:case t.HeatMapGrid.Actions.Delete:case t.HeatMapGrid.Actions.Search:case t.HeatMapGrid.Actions.Reorder:case t.HeatMapGrid.Actions.BatchSave:if(v=this.model.groupSettings.groupedColumns,this.model.allowGrouping&&i.requestType==t.HeatMapGrid.Actions.Refresh&&v.length==0&&this.element.find(".e-grouptopleftcell").length>0&&(rt=this.element.children(".e-gridheader"),rt.find("div").first().empty().append(this._renderGridHeader().find("table"))),this.model.allowGrouping||(v=[]),(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none"),v.length==0){var u=document.createElement("div"),p,h=-1,nt=!1;if(this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(this.model.childGrid!=null||this.model.detailsTemplate!=null)&&this.getContentTable().find("colgroup").first().prepend(this._getIndentCol()),ut=this._currentPage(),(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"||this.model.editSettings.editMode=="normal")&&(i.requestType=="cancel"||i.requestType=="save")&&(this._editFormHeight=this.element.find(".gridform").closest("tr").height()),this.model.scrollSettings.frozenColumns>0)u.innerHTML=this._renderByFrozenDesign();else{i.data&&(p=document.createElement("div"),p.innerHTML=["<table>",n.render[this._id+"_JSONTemplate"](i.data),"<\/table>"].join(""),this._dataSource()instanceof t.DataManager&&i.requestType==t.HeatMapGrid.Actions.Save&&(h=this._getDataIndex(this.model.currentViewData,i.data),nt=this._dataSource().adaptor instanceof t.remoteSaveAdaptor));u.innerHTML=["<table>",n.render[this._id+"_JSONTemplate"](this.model.currentViewData),"<\/table>"].join("");var w=this.getContentTable().get(0),r=w.lastChild,ct=this.getContentTable().first().find("tbody").first();if((i.requestType=="save"||i.requestType=="cancel")&&this.model.editSettings.editMode!="batch"){if(s=this.model.editSettings.editMode.indexOf("inlineform")!=-1?t.isNullOrUndefined(i.selectedRow)?this._selectedRow():i.selectedRow:this.getContentTable().find(".e-"+i.action+"edrow").index(),ft=this._currentTrIndex,s==-1&&(s=ft),this.model.detailsTemplate!=null||this.model.childGrid!=null)for(et=this.model.editSettings.editMode=="inlineform"?n(n(r.childNodes).not(".e-detailrow")[s]):n(r.childNodes[s]),tt=n(r.childNodes).not(".e-detailrow"),c=0;c<tt.length;c++)et.is(tt[c])&&(s=c);if(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"){if(i.action=="add"&&!this.getContentTable().find(".e-addedrow").length)break;var f=this.getContentTable().find(".e-addedrow").get(0),l=this.getContentTable().find(".e-editedrow"),e=l.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:p.firstChild.firstChild.lastChild;l.length?(this.model.editSettings.showAddNewRow&&this.model.editSettings.rowPosition=="top"&&(s=s-1),e=u.firstChild.firstChild.childNodes[s],this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(f=l.prev("tr").get(0),l.remove()):f=l.get(0),a=n(e),o=n(f),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next("tr.e-detailrow:visible").length&&(y=a.find(".e-detailrowcollapse"),y.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),i.requestType=="cancel"?(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").addClass("e-showaddrow"),o.replaceWith(a)):!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(this.model.detailsTemplate!=null&&o.next("tr.e-detailrow").length&&r.removeChild(o.next("tr.e-detailrow").get(0)),o.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&v.length==0&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):r.replaceChild(e,f)):(a=n(e),o=n(f),i.action=="add"&&i.requestType=="save"&&this.model.editSettings.showAddNewRow&&this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&(this.model.editSettings.rowPosition=="bottom"?r.lastChild.previousSibling.remove():r.lastChild.remove()),i.requestType=="cancel"||this._dataSource()instanceof t.DataManager||this._currentPage()!=1||i.requestType=="save"&&!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount==this._previousFilterCount?(t.isNullOrUndefined(f)||(o.remove(),this._dataSource()instanceof t.DataManager&&h!=-1?h==0?r.insertBefore(e,r.children[h]):a.insertAfter(r.children[h-1]):this._dataSource()instanceof t.DataManager&&!nt||this._currentPage()==1||i.requestType!="save"||n(r).prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&v.length==0&&(this._dataSource()instanceof t.DataManager&&h==-1&&!nt&&i.requestType!="save"||i.requestType!="save"&&!(this._dataSource()instanceof t.DataManager))&&i.requestType=="cancel"&&!this.model.editSettings.showAddNewRow&&w.lastChild.appendChild(u.firstChild.firstChild.lastChild)),i.requestType=="cancel"&&this._selectedRow()!=-1&&this.clearSelection()):this.model.currentViewData.length==1?(n(r).empty(),r.appendChild(e)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this.model.editSettings.rowPosition=="bottom"?(ct.prepend(f),r.replaceChild(e,f)):r.replaceChild(e,f))}else if(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"){if(i.action=="add"&&!this.element.find(".e-addedrow").length)break;if(l=this.element.find(".e-editedrow"),i.requestType!="cancel"&&(l.length||t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount!=this._previousFilterCount))if(l.length){if(e=u.firstChild.firstChild.childNodes[s],f=this._excludeDetailRows(r.childNodes)[s],this.model.allowCellMerging!=null&&(o=n(f),n(f.childNodes).hasClass("e-merged")))for(k=o.children(".e-merged").index(),ot=f.children[k].colSpan,c=0;c<ot;c++)e.childNodes[k+c].className+=" e-merged e-hide",e.childNodes[k].colSpan=c+1;this.model.detailsTemplate!=null&&(f=n(r.childNodes).not(".e-detailrow").eq(s).get(0));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next("tr.e-detailrow:visible").length&&(y=n(e).find(".e-detailrowcollapse"),y.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"));!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(o=n(f),this.model.detailsTemplate!=null&&o.next("tr.e-detailrow").length&&r.removeChild(o.next("tr.e-detailrow").get(0)),o.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):r.replaceChild(e,f)}else this.model.currentViewData.length==1&&this.getContentTable().find("td.e-rowcell").length==0?(e=u.firstChild.firstChild.firstChild,n(r).empty(),r.appendChild(e)):(d=l.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:p.firstChild.firstChild.lastChild,this._dataSource()instanceof t.DataManager?h!=-1&&(h==0?r.insertBefore(d,r.children[h]):n(d).insertAfter(r.children[h-1]),this.model.allowPaging&&(this.model.pageSettings.pageSize<=this.model.currentViewData.length||h==this.model.pageSettings.pageSize-1)&&r.removeChild(r.lastChild)):(this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this._currentPage()==1?this.getContentTable().find("tbody").first().prepend(n(d)):this.getContentTable().find("tbody").first().prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.removeChild(r.lastChild)),this.model.detailsTemplate!=null&&n(w.lastChild.lastChild).children(".e-detailrowexpand").length&&r.removeChild(r.lastChild));else e=u.firstChild.firstChild.childNodes[s],f=r.childNodes[s],a=n(e),o=n(f),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next(".e-detailrow:visible").length&&(y=a.find(".e-detailrowcollapse"),y.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),o.replaceWith(a),this.clearSelection()}this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():w.rows;this.model.enableAltRow&&this._refreshAltRow()}else if(i.requestType=="delete"){if(this._isUnboundColumn){var b=this.element.find(".e-editedrow"),f=this.getContentTable().find(".e-editedrow").get(0),e=b.length?u.firstChild.firstChild.firstChild:p.firstChild.firstChild.lastChild;b.length!=0&&(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")?n(f).replaceWith(n(e)):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(f=b.prev("tr").get(0),b.remove()):f=b.get(0)}this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&this.getContentTable()[0].rows.length!=this.model.currentViewData.length&&(this.getContentTable().find("tr").length&&this._excludeDetailRows().length?this.multiDeleteMode?(it=u.firstChild.firstChild.rows.length,st=n(u.firstChild.firstChild.rows).slice(it-this.selectedRowsIndexes.length,it),n(r).append(st)):r.appendChild(u.firstChild.firstChild.lastChild):n(r).prepend(u.firstChild.firstChild.rows));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(g=this.getContentTable().find(".e-detailrow:visible"),n.each(g,function(n){g.eq(n).closest("tr").prev().children(".e-detailrowexpand").length==0&&g.eq(n).remove()}));this._gridRows=w.rows;this.model.enableAltRow&&this._refreshAltRow()}else this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild)}this._currentJsonData=this.model.currentViewData;this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():this.getContentTable().get(0).rows;this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);ht={};(i.requestType=="sorting"||i.requestType=="filtering")&&this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="filtering"&&(this.getContent().first().ejScroller("refresh").ejScroller("isVScroll")?this.element.find(".gridheader").addClass("e-scrollcss"):this.element.find(".gridheader").removeClass("e-scrollcss"),ht=this._refreshVirtualPagerInfo()),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(ut),i.requestType=="filtering"&&this.getContent().first().ejScroller("refresh"));this.model.scrollSettings.enableVirtualization||this._eventBindings();break}case t.HeatMapGrid.Actions.Grouping:this._group(i);this._refreshStackedHeader();break;case t.HeatMapGrid.Actions.BeginEdit:this._edit(i);break;case t.HeatMapGrid.Actions.Add:this._add(i);break;case t.HeatMapGrid.Actions.Ungrouping:this._ungroup(i);break;case t.HeatMapGrid.Actions.VirtualScroll:this._isVirtualRecordsLoaded||(this.model.scrollSettings.enableVirtualization?this._replacingVirtualContent():this._replacingContent())}else i.requestType!="refresh"||this.model.currentViewData!=0||this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),this._newungroup(i);this._showGridLines();this._completeAction(i)},i.prototype._showGridLines=function(){var n=this.model.gridLines;n!="both"&&this.getContent().addClass(n!="none"?"e-"+n+"lines":"e-hidelines")},i.prototype._newungroup=function(n){n.requestType=="ungrouping"?this._ungroup(n):this.getContentTable().find("tbody").empty().first().append(this._getEmptyTbody())},i.prototype.setFormat=function(){for(var i,r,t=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].type=="date"&&t.push(this.model.columns[n]);if(t.length>0)for(n=0;n<this.model.currentViewData.length;n++)for(i=0;i<t.length;i++)r=this.model.currentViewData[n][t[i].field],/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(r)&&(this.model.currentViewData[n][t[i].field]=new Date(this.model.currentViewData[n][t[i].field]))},i.prototype._completeAction=function(i){var u,r;if(this.model.editSettings.showAddNewRow||(this.model.isEdit=!1),this._confirmedValue=!1,t.HeatMapGrid.Actions.Grouping!=i.requestType||!t.isNullOrUndefined(i.columnName)){if(i.columnSortDirection!="ascending"&&i.columnSortDirection!="descending"||t.isNullOrUndefined(i.columnName)||(u=this.getColumnByField(i.columnName),this.model.allowSorting&&this.model.allowMultiSorting?this._scolumns.push(u.field):this._gridSort=u.field),i.requestType!="beginedit"&&i.requestType!="add"&&this.setWidthToColumns(),(i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&(this._isAddNew=!1,this.model.isResponsive&&this.model.minWidth&&this.windowonresize()),this.initialRender||!(t.HeatMapGrid.Actions.UnGrouping==i.requestType||this.model.groupSettings.groupedColumns.length>0)||n("#"+this._id+"EditForm").length?t.HeatMapGrid.Actions.Sorting==i.requestType&&this.model.allowSorting||t.HeatMapGrid.Actions.Refresh==i.requestType||t.HeatMapGrid.Actions.Cancel==i.requestType?!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i):t.HeatMapGrid.Actions.Delete==i.requestType||t.HeatMapGrid.Actions.Save==i.requestType||t.HeatMapGrid.Actions.Search==i.requestType?(this._editEventTrigger(i),!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i)):t.HeatMapGrid.Actions.Filtering==i.requestType?this._filterCompleteAction():t.HeatMapGrid.Actions.BeginEdit==i.requestType||t.HeatMapGrid.Actions.Add==i.requestType?this._editCompleteAction(i):(t.HeatMapGrid.Actions.Grouping==i.requestType||t.HeatMapGrid.Actions.Ungrouping==i.requestType)&&this["_"+i.requestType+"CompleteAction"](i):this._recalculateIndentWidth(),!this.initialRender&&this.model.showSummary&&this.model.summaryRows.length>0&&(this.model.currentViewData.length||this.element.children(".e-gridfooter").remove()),this.initialRender||(this.getContent().find("td.e-selectionbackground").length||this._setCurrentRow(i.requestType),i.requestType!="virtualscroll"&&this.clearColumnSelection()&&n(this.getHeaderTable().find("th.e-headercell")).removeClass("e-columnselection")),this.model.editSettings.editMode=="batch"&&this.refreshBatchEditMode(),(!this.initialRender&&(this.model.allowScrolling||this.model.isResponsive)&&(this._checkScrollActions(i.requestType)||this.model.editSettings.editMode.indexOf("inline")!=-1&&i.requestType=="beginedit")||this.model.scrollSettings.virtualScrollMode=="continuous"&&i.requestType=="virtualscroll")&&(this.model.isResponsive&&this.model.minWidth?this.windowonresize():this._refreshScroller(i)),this.model.scrollSettings.virtualScrollMode=="normal"&&i.requestType=="virtualscroll"&&this.getContent().find("div:first").scrollLeft(this.getScrollObject().scrollLeft()),this._customPop!=null&&i.requestType!="sorting"&&this._customPop.hide(),!this.model.allowScrolling||this.initialRender||this.model.scrollSettings.enableVirtualization||this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell"),t.HeatMapGrid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0&&this._groupingCompleteAction(i),t.HeatMapGrid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length<1&&this._ungroupingCompleteAction(i),this.model.textWrapSettings&&this._setTextWrap(),(this._isUngrouping||this._columnChooser)&&i.requestType=="refresh"||(this._isUngrouping=!1,this._columnChooser=!1),this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&(this.initialRender||this.getContentTable().find("tr.e-addedrow").length!=0||this.element.find(".e-gridcontent").find("tr").length==0||this._startAdd()),(t.HeatMapGrid.Actions.BeginEdit==i.requestType||t.HeatMapGrid.Actions.Add==i.requestType)&&n.isFunction(n.validator)&&this.setValidation(),this.initialRender||(this.model._groupingCollapsed=[]),!this.initialRender&&i.requestType=="refresh")for(r=0;r<this.model.filterSettings.filteredColumns.length;r++)this.getHeaderTable().find(".e-headercelldiv").eq(this.getColumnIndexByField(this.model.filterSettings.filteredColumns[r].field)).parent().find(".e-filtericon").addClass("e-filteredicon e-filternone");this.model.columnLayout!="fixed"||this.model.isEdit||this.setWidthToColumns()}},i.prototype._getDataIndex=function(n,t){for(var i,u,f=0,r=0,e=n.length;r<e;r++){for(i=0,u=this._primaryKeys.length;i<u;i++)if(this._checkPrimaryValue(n[r][this._primaryKeys[i]],t[this._primaryKeys[i]],this._primaryKeys[i]))continue;else i==u-1&&(f=1);if(f)return r}return-1},i.prototype._checkPrimaryValue=function(n,t,i){return this.getColumnByField(i).type=="string"&&(n=n.trim()),n!=t?!0:!1},i.prototype._eventBindings=function(){var a=this.model.scrollSettings.frozenColumns>0?this._gridRows[0].length:this._gridRows.length,e=0,h,c=this.model.pageSettings.pageSize,i,r,u,o,f,s,l;if(this._gridRecordsCount!=0&&(this.model.queryCellInfo!=null||this.model.rowDataBound!=null||this.model.mergeCellInfo!=null||this.model.templateRefresh!=null))for(i=0;i<a;i++){if(r=null,e=i,this.model.scrollSettings.allowVirtualScrolling&&i<c)if(this.model.scrollSettings.enableVirtualization){if(r=n(this._gridRows).eq(i),u=parseInt(n(r).attr("name"),32),n.inArray(u,this._queryCellView)!=-1)continue;this._virtualLoadedRecords[u]&&(o=this._virtualLoadedRecords[u][i%this._virtualRowCount]);e=u*this._virtualRowCount+i%this._virtualRowCount}else{for(f=0;f<this._cloneQuery.queries.length;f++)h=this._cloneQuery.queries[f].fn=="onPage"&&this._cloneQuery.queries[f].e.pageIndex-1;s=c*h;s!=0&&(r=this.getContentTable().find("tr[name="+s+"]").eq(i),e=r.index())}else this.model.scrollSettings.enableVirtualization&&(r=n(this._gridRows).eq(i));if(r=r||this.getRowByIndex(e),r.hasClass("e-virtualrow")||t.isNullOrUndefined(this._currentJsonData[i]||o))break;l=this.model.scrollSettings.enableVirtualization?o:this._currentJsonData[i];this._rowEventTrigger(r,l)}},i.prototype._rowEventTrigger=function(i,r){for(var o,f={row:i,data:r},s=i.cells,e=n(i).find(".e-rowcell"),u=0;u<e.length;u++)f={cell:e[u],data:r,text:e[u].innerHTML},o=this._getForeignKeyData(f.data),n(e[u]).hasClass("e-rowcell")&&(f.column=this.model.columns[u]),t.isNullOrUndefined(o)||(f.foreignKeyData=o),this._heatmap._setBinding(f),n(e[u]).hasClass("e-templatecell")&&(f={cell:e[u],column:this.model.columns[u],data:r,rowIndex:n(i).index()})},i.prototype.setWidthToColumns=function(){var r=this.getContentTable().children("colgroup").find("col"),u=this.getHeaderTable().children("colgroup").find("col"),f=this.element.width(),o=0,s=0,v=0,y,w,b,l,a,p,e,rt,h,i;for(this.model.groupSettings.groupedColumns.length&&!this.model.allowScrolling&&this.model.groupSettings.showGroupedColumn&&(y=this.getBrowserDetails(),y.browser=="msie"&&parseInt(y.version,10)>8&&r.first().css("width",3e3/f+"%")),t.isNullOrUndefined(this.model.detailsTemplate)||(w=this.model.groupSettings.groupedColumns.length,b=this.model.groupSettings.groupedColumns.length!=0?1:0,r.eq(b).css("width",this._detailsOuterWidth),u.eq(w).css("width",this._detailsOuterWidth)),this._detailColsRefresh(),r=this._$headerCols,u=this._$contentCols,i=0;i<u.length;i++){if(this.model.allowResizeToFit&&this.model.columns[i].width===undefined&&this.columnsWidthCollection[i]===undefined){var ut=this.model.groupSettings.groupedColumns.length?i+this.model.groupSettings.groupedColumns.length:i,k=this._resizer._getContentWidth(i),d=this.getHeaderTable().find(".e-headercelldiv").eq(ut),g=this._resizer._getHeaderContentWidth(d);v=this.model.editSettings.editMode=="normal"&&(this.model.isEdit||this._isAddNew)?r.eq(i).width():(k>g?k:g)+parseInt(d.css("padding-left"),10);this.columnsWidthCollection[i]=v;s+=this.model.columns[i].visible?v:0}else s+=this.model.columns[i].visible?parseInt(this.model.columns[i].width,10):0;if(t.isNullOrUndefined(this.columnsWidthCollection[i])){if(this.model.allowScrolling){var ft=(f/this.model.columns.length).toFixed(2),et=(f/(this.model.scrollSettings.buttonSize||18)/100).toFixed(2),c=ft-et;r.eq(i).css("width",c+"px");u.eq(i).css("width",c+"px");this.model.columns[i].width=c;this.columnsWidthCollection[i]=parseFloat(c)}}else r.eq(i).width(this.columnsWidthCollection[i]),u.eq(i).width(this.columnsWidthCollection[i]),this.model.columns[i].priority&&u.eq(i).addClass("e-table-priority-"+this.model.columns[i].priority)}if(this.model.columnLayout=="fixed"){this.model.scrollSettings&&this.model.scrollSettings.frozenColumns==0&&(this.getHeaderTable().width(s),this.getContentTable().width(s));var ot=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),nt=this.getHeaderContent().width()>ot?"addClass":"removeClass",tt=this.getHeaderTable(),it=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(tt=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),it=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0));tt[nt]("e-tableLastCell");it[nt]("e-tableLastCell")}if(!this.model.allowScrolling&&this.model.allowResizeToFit&&s>f&&(this.model.allowScrolling=!0,this.model.scrollSettings.width=f,this.getHeaderTable().parent().addClass("e-headercontent"),!this.model.scrollSettings.frozenColumns>0&&this.getHeaderTable().width(f)),this.model.isEdit&&(e=r.clone(),this.model.editSettings.showAddNewRow&&(l=this.getContentTable().find(".e-editedrow")),a=this.model.scrollSettings.frozenColumns>0?this.getContent().find(".gridform").find("colgroup"):!t.isNullOrUndefined(l)&&l.length==1?l.find("colgroup"):n("#"+this._id+"EditForm").find("colgroup"),this.model.scrollSettings.frozenColumns>0&&a.first().empty().append(e.splice(0,this.model.scrollSettings.frozenColumns)),a.last().empty().append(e),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&a.prepend(this._getIndentCol())),this.model.groupSettings.groupedColumns.length)for(p=this.getContentTable().find(".e-recordtable").children("colgroup"),i=0;i<p.length;i++)e=r.clone(),rt=this._detailsOuterWidth!=null?this._detailsOuterWidth:"30px",(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&e.splice(0,0,n(this._getIndentCol()).width(rt)[0]),p.eq(i).empty().append(e);if(this.model.scrollSettings.frozenColumns>0){for(h=0,i=0;i<this.columnsWidthCollection.length;i++)h+=parseInt(this.columnsWidthCollection[i],10),this.model.scrollSettings.frozenColumns-1==i&&(o=Math.ceil(h));this.getContent().find(".e-frozencontentdiv").outerWidth(o).end().find(".e-movablecontentdiv").outerWidth(h-o);this.getHeaderContent().find(".e-frozenheaderdiv").outerWidth(o).end().find(".e-movableheaderdiv").outerWidth(h-o)}},i.prototype._initialEndRendering=function(){if(this.model.scrollSettings.frozenColumns>0&&!this.model.allowScrolling){this.getContent().remove();this.getHeaderTable().eq(1).remove();return}if(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization,this._getRowHeights(),this.element.width()!=0)this.model.allowScrolling&&this._renderScroller();else if(this.model.allowScrolling&&this.element.width()==0){var n=this,i=setInterval(function(){n.element.width()==0||t.isNullOrUndefined(n.element.width())||(n._renderScroller(),n._endRendering(),clearInterval(i))},100);return}this._endRendering()},i.prototype._endRendering=function(){var n,i;!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&this.model.allowScrolling&&(n=this.getScrollObject());i=this.model.enableRTL?"e-summaryscroll e-rtl":"e-summaryscroll";this.model.allowScrolling&&this.model.showSummary&&n._vScroll&&this.element.find(".e-summaryrow.e-scroller").addClass(i);this._addMedia();this.model.allowScrolling&&this.model.allowTextWrap&&!this.model.scrollSettings.allowVirtualScrolling&&this.getContent().first().ejScroller("refresh");this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage()!=1||this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=this._currentJsonData),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView():this._refreshVirtualContent(),this.getContent().first().ejScroller("refresh"),this.getContent().ejScroller("isVScroll")?(this.element.find(".e-gridheader").addClass("e-scrollcss"),this.getHeaderTable().first().width(this.getContentTable().width())):this.element.find(".e-gridheader").removeClass("e-scrollcss"));this._selectedRow()!=-1&&(this.model.currentIndex=this._selectedRow());this.rowHeightRefresh();this.initialRender&&(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow()},i.prototype._addLastRow=function(){var r=this.getContentTable().find("tr:last").find("td"),u=0,i;if(this.model.allowScrolling&&!this.model.scrollSettings.allowVirtualScrolling&&!t.isNullOrUndefined(this.model.dataSource)&&!t.isNullOrUndefined(this.getRows())){for(i=0;i<this.getRows().length;i++)u+=n(this.getRows()[i]).height();u<this.getContent().height()-1&&r.addClass("e-lastrowcell")}this.model.scrollSettings.allowVirtualScrolling&&this.getContentTable().height()<this.getContent().height()&&r.addClass("e-lastrowcell")},i.prototype._addMedia=function(){if(typeof this.model.scrollSettings.width!="string"&&this.model.scrollSettings.width>0?this._responsiveScrollWidth=this._originalScrollWidth=this.model.scrollSettings.width:this._originalScrollWidth=this.element.width(),typeof this.model.scrollSettings.height!="string"&&this.model.scrollSettings.height>0&&(this._responsiveScrollHiehgt=this.model.scrollSettings.height),this.model.minWidth&&this.model.isResponsive){if(this._$onresize=n.proxy(this.windowonresize,this),n(window).bind("resize",this._$onresize),n.isFunction(window.matchMedia)){var t=window.matchMedia("(max-width: 768px)");this._mediaStatus=t.matches}this.windowonresize()}},i.prototype._getNoncontentHeight=function(){var n=this.getHeaderContent().outerHeight();return this.model.allowGrouping&&this.model.groupSettings.showDropArea&&(n+=this.element.find(".e-groupdroparea").outerHeight()),n},i.prototype._mediaQueryUpdate=function(n,i,r,u){var e,o,s,f;if(window.innerWidth<=320&&this.model.enableResponsiveRow){e=this.getContentTable()[0].style;e.removeAttribute?e.removeAttribute("min-width"):e.removeProperty("min-width");o=this.getContent().data("ejScroller");o&&this.getContent().ejScroller("destroy");return}n?(this.model.scrollSettings.width=t.isNullOrUndefined(this._responsiveScrollWidth)?r:Math.min(this._responsiveScrollWidth,r),f=Math.min(u,i)-this._getNoncontentHeight(),f=t.isNullOrUndefined(this._responsiveScrollHiehgt)?f:Math.min(this._responsiveScrollHiehgt,f),f=this.model.scrollSettings.height!="auto"?f-(parseInt(this.element.parent().css("margin-bottom"))+1):this.model.scrollSettings.height,this.model.minWidth>r&&i>u&&(f=f!="auto"?f+this.model.scrollSettings.buttonSize:f),t.isNullOrUndefined(this.getRows())&&(f="100%"),this.model.scrollSettings.height=f,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller()):(this.model.scrollSettings.width="100%",t.isNullOrUndefined(this._responsiveScrollWidth)||(this.model.scrollSettings.width=Math.min(this._responsiveScrollWidth,r)),s=Math.min(u,i),f=s-this._getNoncontentHeight(),t.isNullOrUndefined(this._responsiveScrollHiehgt)||(f=Math.min(this._responsiveScrollHiehgt,u)),f=this.model.scrollSettings.height!="auto"?f-parseInt(this.element.parent().css("margin-bottom")):this.model.scrollSettings.height,t.isNullOrUndefined(this.getRows())&&(f="100%"),this.model.scrollSettings.height=f,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller())},i.prototype.windowonresize=function(){var i,f;this.model.scrollSettings.width=this._responsiveScrollWidth;this.element.width("100%");this.getContentTable().width("100%");this.getHeaderTable().width("100%");this.getContentTable().css("minWidth",this.model.minWidth);i=this.element.width();var e=n(window).height()-this.element.offset().top,s=t.isNullOrUndefined(this.getRows())?1:this.getRows().length,o=this.element.parent().is(n("body"))||this.element.parent().height()==n("body").height()||this.element.parent()[0].style.height=="",r=this.getContentTable()[0].scrollHeight+this._getNoncontentHeight(),u=o?e:this.element.parent().height();r+=parseInt(this.element.parent().css("margin-top"));f=this.model.minWidth>i||u<=r;this._mediaQueryUpdate(f,u,i,r);this._refreshScroller({})},i.prototype._getRowHeights=function(){var n=this.getRows(),i,r,t;if(n!==null)if(this._rowHeightCollection=[],n[1]!==undefined&&n[1].length&&(this.model.scrollSettings.frozenColumns>0&&n[0]!==undefined||n[0]!==undefined&&typeof n[0].item!="undefined"&&typeof n[0].length=="number"&&typeof n[1].item!="undefined"&&typeof n[1].length=="number"))for(i=n[0],r=n[1],t=0;t<i.length;t++)this._rowHeightCollection[t]=i[t].offsetTop>=r[t].offsetTop?i[t].offsetTop:r[t].offsetTop;else for(t=0;t<n.length;t++)this._rowHeightCollection[t]=n[t].offsetTop;return this._rowHeightCollection},i.prototype._getEmptyTbody=function(){var i=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length});return n(document.createElement("tr")).append(i)},i.prototype._getIndentCol=function(){return t.buildTag("col","",{width:"30px"})},i.prototype._wireEvents=function(t){t._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",n.proxy(this._clickHandler,this));this._enableRowHover(undefined,t);this.model.allowGrouping&&(this._enableGroupingEvents(),this._on(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",n.proxy(this._dropAreaHover,this)))},i.prototype._clickHandler=function(t){var i=n(t.target),e=n("[id$='ccDiv'].e-grid.e-columnChooser"),o,a=n("#"+this._id+"EditForm"),s,r,u,v,f,y,h,c,l,p,w;if(e.length)for(v=!0,f=0;f<e.length;f++)(i.parents(".e-ccButton").length||i.hasClass("e-ccButton"))&&(v=n(t.target).closest(".e-grid").attr("id")+"ccDiv"!=e[f].id);if(i.closest(".e-grid").attr("id")===this._id&&!i.closest("#"+this._id+"EditForm").length){if(i.hasClass("e-rowcell")||i.closest("td").is(".e-rowcell")||i.hasClass("e-headercell")&&t.clientY-i.offset().top<i.height()/4){if(this._bulkEditCellDetails.cancelSave){this._bulkEditCellDetails.cancelSave=!1;return}if(this.model.editSettings.editMode=="batch"&&n.isFunction(n.validator)&&a.length&&a.validate().errorList.length>0)return;this.model.editSettings.editMode=="batch"&&this.element.focus();s=i.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0;y=i.closest(".e-rowcell").index()!=-1?i.closest(".e-rowcell").index():i.closest(".e-headercell").index()-this.model.groupSettings.groupedColumns.length;r=i.hasClass("e-rowcell")?i.index()-s:y-s;r=this.model.detailsTemplate!=null||this.model.childGrid!=null?r-1:r;this.model.scrollSettings.frozenColumns&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(r=r+this.model.scrollSettings.frozenColumns);u=this.getIndexByRow(i.closest("tr"));this._bulkEditCellDetails.columnIndex=r;this._bulkEditCellDetails.rowIndex=u;this.model.allowSelection&&(this.model.selectionType=="multiple"&&((t.ctrlKey||this._enableSelectMultiTouch)&&(this.multiSelectCtrlRequest=!0),t.shiftKey&&(this.multiSelectShiftRequest=!0,this._allowcellSelection&&u>-1&&this.selectCells([[u,[r]]]),this._selectedRow(this.getIndexByRow(i.closest("tr")))),t.pointerType=="touch"&&this._customPop!=null&&!this._customPop.is(":visible")&&this._customPop.find(".e-rowselect").hasClass("e-spanclicked")&&this.model.selectionSettings.selectionMode=="row"&&this._customPop.show(),t.pointerType=="touch"&&this._customPop!=null&&(this._customPop.find(".e-sortdirect").is(":visible")||!this._customPop.find(".e-rowselect").hasClass("e-spanclicked"))&&this.model.selectionType=="multiple"&&(this._customPop.removeAttr("style"),h=i.offset(),this._customPop.offset({top:0,left:0}).offset({left:h.left,top:h.top-this.getRowHeight()}).find(".e-sortdirect").hide().end().find(".e-rowselect").show().end().show())),this.multiSelectShiftRequest||(this._allowcellSelection&&u>-1&&(c=this._checkCellSelectionByRow(u,r),(this.model.selectionSettings.enableToggle&&this.selectedRowCellIndexes.length==1&&this.selectedRowCellIndexes[0].cellIndex.length==1||t.ctrlKey&&this.model.selectionType=="multiple")&&c!=-1&&this.selectedRowCellIndexes.length>0&&this.selectedRowCellIndexes[0].cellIndex.length>0?this.clearCellSelection(c.rowIndex,r):this.selectCells([[u,[r]]])),this._allowrowSelection&&u>-1&&(l=this.getIndexByRow(i.closest("tr")),this.model.scrollSettings.enableVirtualization&&(p=u%this._virtualRowCount,w=parseInt(n(i).closest("tr").attr("name"),32),l=w*this._virtualRowCount-(this._virtualRowCount-p)),this.model.selectionSettings.enableToggle&&this.getSelectedRecords().length==1&&n.inArray(this.getIndexByRow(i.closest("tr")),this.selectedRowsIndexes)!=-1&&this.clearSelection(l)),this._allowcolumnSelection&&i.hasClass("e-headercell")&&!i.hasClass("e-stackedHeaderCell")&&t.clientY-i.offset().top<i.height()/4&&this.model.selectionSettings.enableToggle&&this.selectedColumnIndexes.length==1&&n.inArray(r,this.selectedColumnIndexes)!=-1&&this.clearColumnSelection(r),this.multiSelectCtrlRequest=!1),this.multiSelectShiftRequest=!1);o=this.model.columns[this._bulkEditCellDetails.columnIndex].field;i.closest(".e-rowcell").length&&o&&(this._tabKey=!1,this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="batch"&&this.editCell(n.inArray(i.closest("tr").get(0),this.getRows()),o))}(i.hasClass("e-rowselect")||i.hasClass("e-sortdirect"))&&(i.hasClass("e-spanclicked")?(i.removeClass("e-spanclicked"),i.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!1),i.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!1),this._customPop.hide()):(i.addClass("e-spanclicked"),i.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!0),i.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!0)));i.is(".e-filtericon")&&i.closest(".e-detailrow").length!=0&&t.preventDefault();this.model.allowSearching&&this._searchBar!=null&&(i.is(this._searchBar.find(".e-cancel"))?this._searchBar.find("input").val(""):t.target.id==this._id+"_searchbar"?this._searchBar.find(".e-cancel").removeClass("e-hide"):this._searchBar.find(".e-cancel").hasClass("e-hide")||this._searchBar.find(".e-cancel").addClass("e-hide"))}},i.prototype._checkCellSelectionByRow=function(t,i){for(var r=0;r<this.selectedRowCellIndexes.length;r++)if(this.selectedRowCellIndexes[r].rowIndex==t)break;return r!=this.selectedRowCellIndexes.length&&n.inArray(i,this.selectedRowCellIndexes[r].cellIndex)!=-1?this.selectedRowCellIndexes[r]:-1},i.prototype._destroy=function(){var t,r,u,i;if(this.element.off(),this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").add(this.getContent().find(".e-content,.e-movablecontent")).unbind("scroll"),t=n("#"+this._id+"EditForm"),t.length){for(r=t.find(".e-field"),i=0;i<r.length;i++)u=n(r[i]);t.remove()}this.model.showColumnChooser&&(n("#"+this._id+"ccDiv").remove(),n("#"+this._id+"_ccTail").remove(),n("#"+this._id+"_ccTailAlt").remove());this.model.allowFiltering&&this.model.filterSettings.filterType=="excel"&&this._excelFilter.resetExcelFilter();this.model.allowReordering&&n(".e-columndropindicator").remove();this._$onresize&&n(window).unbind("resize",this._$onresize);this.element.empty().removeClass("e-grid "+this.model.cssClass)},i}();t.HeatMapGrid=function(n,t){return new i(n,t)};t.HeatMapGrid.Locale=t.HeatMapGrid.Locale||{};t.HeatMapGrid.Actions={Paging:"paging",Sorting:"sorting",Filtering:"filtering",BeginEdit:"beginedit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Grouping:"grouping",Ungrouping:"ungrouping",Refresh:"refresh",Reorder:"reorder",Search:"searching",BatchSave:"batchsave",VirtualScroll:"virtualscroll"};t.HeatMapGrid.ClipMode={Ellipsis:"ellipsis",Clip:"clip",EllipsisWithTooltip:"ellipsiswithtooltip"};t.HeatMapGrid.SelectionType={Single:"single",Multiple:"multiple"};t.HeatMapGrid.SelectionMode={Row:"row",Cell:"cell",Column:"column"};t.HeatMapGrid.Locale["default"]=t.HeatMapGrid.Locale["en-US"]={EmptyRecord:"No records to display",GroupDropArea:"Drag a column header here to group its column",DeleteOperationAlert:"No records selected for delete operation",EditOperationAlert:"No records selected for edit operation",SaveButton:"Save",OkButton:"OK",CancelButton:"Cancel",EditFormTitle:"Details of ",AddFormTitle:"Add New Record",Notactionkeyalert:"This Key-Combination is not available",Keyconfigalerttext:"This Key-Combination has already been assigned to ",GroupCaptionFormat:"{{:headerText}}: {{:key}} - {{:count}} {{if count == 1 }} item {{else}} items {{/if}} ",BatchSaveConfirm:"Are you sure you want to save changes?",BatchSaveLostChanges:"Unsaved changes will be lost. Are you sure you want to continue?",ConfirmDelete:"Are you sure you want to Delete Record?",CancelEdit:"Are you sure you want to Cancel the changes?",PagerInfo:"{0} of {1} pages ({2} items)",FrozenColumnsViewAlert:"Frozen columns should be in grid view area",FrozenColumnsScrollAlert:"Enable allowScrolling while using frozen Columns",FrozenNotSupportedException:"Frozen Columns and Rows are not supported for Grouping, Row Template, Detail Template, Hierarchy Grid and Batch Editing",Add:"Add",Edit:"Edit",Delete:"Delete",Update:"Update",Cancel:"Cancel",Done:"Done",Columns:"Columns",SelectAll:"(Select All)",PrintGrid:"Print",ExcelExport:"Excel Export",WordExport:"Word Export",PdfExport:"PDF Export",StringMenuOptions:[{text:"StartsWith",value:"StartsWith"},{text:"EndsWith",value:"EndsWith"},{text:"Contains",value:"Contains"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],NumberMenuOptions:[{text:"LessThan",value:"LessThan"},{text:"GreaterThan",value:"GreaterThan"},{text:"LessThanOrEqual",value:"LessThanOrEqual"},{text:"GreaterThanOrEqual",value:"GreaterThanOrEqual"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],PredicateAnd:"AND",PredicateOr:"OR",Filter:"Filter",FilterMenuCaption:"Filter Value",FilterbarTitle:"'s filter bar cell",MatchCase:"Match Case",Clear:"Clear",ResponsiveFilter:"Filter",ResponsiveSorting:"Sort",Search:"Search",DatePickerWaterMark:"Select date",EmptyDataSource:"DataSource must not be empty at initial load since columns are generated from dataSource in AutoGenerate Column Grid",ForeignKeyAlert:"The updated value should be a valid foreign key value",True:"true",False:"false",UnGroup:"Click here to ungroup",AddRecord:"Add Record",EditRecord:"Edit Record",DeleteRecord:"Delete Record",Save:"Save",Grouping:"Group",Ungrouping:"Ungroup",SortInAscendingOrder:"Sort In Ascending Order",SortInDescendingOrder:"Sort In Descending Order",NextPage:"Next Page",PreviousPage:"Previous Page",FirstPage:"First Page",LastPage:"Last Page",EmptyRowValidationMessage:"Atleast one field must be updated",NoResult:"No Matches Found"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};Heatmap=function(n){function t(t,i){return n.call(this),this._rootCSS="e-heatmap",this._grid=null,this.PluginName="ejHeatMap",this._setFirst=!1,this.id="null",this.model=null,this.validTags=["div"],this.defaults={itemsSource:null,itemsMapping:{itemsSource:null,columnStyle:{headerTemplateID:"",templateID:"",textAlign:"",width:null},headerMapping:{columnStyle:{headerTemplateID:"",templateID:"",textAlign:"",width:null},displayName:"",propertyName:""},column:{displayName:"",propertyName:""},columnMapping:null,row:{displayName:"",propertyName:""},value:{displayName:"",propertyName:""}},colorMappingCollection:null,selectedItem:null,legendCollection:[],heatMapCell:{showContent:"visible",showColor:!0},cellMouseOver:null,cellMouseEnter:null,cellMouseLeave:null,cellSelected:null,isResponsive:!1,enableVirtualization:!1,enableRTL:!1,defaultColumnStyle:{textAlign:"center",headerTemplateID:"",templateID:""},enableTooltip:!1,tooltipSettings:{templateId:null,position:{stem:{horizontal:"left",vertical:"center"},target:{horizontal:"right",vertical:"center"}},isBalloon:!0,animation:{effect:"none",speed:0},associate:"mouseFollow",trigger:"hover"},width:null,height:null},this.observables=["heatMapCell.showContent","heatMapCell.showColor",],this.dataTypes={colorMappingCollection:"data",itemsMapping:{columnMapping:"data"},itemsSource:"data",legendCollection:"data"},this._tags=[{tag:"colorMappingCollection",attr:["value","color","label.bold","label.italic","label.text","label.textDecoration","label.fontSize","label.fontFamily","label.fontColor",],singular:"colorMapping"}],this._heatmapShowContent=ej.util.valueFunction("heatMapCell.showContent"),this._heatmapShowColor=ej.util.valueFunction("heatMapCell.showColor"),t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejHeatMap(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype._setModel=function(n){var t=!1,i=this._grid,u,r;if(i){for(u in n)switch(u){case"colorMappingCollection":n.colorMappingCollection&&n.colorMappingCollection.length>0&&(this.model.colorMappingCollection=n.colorMappingCollection,t=!0);break;case"itemsSource":n.itemsSource&&(this.model.itemsSource=n.itemsSource,r=void 0,r=this.model.itemsMapping&&this.model.itemsMapping.column&&this.model.itemsMapping.row?this._bindCellMapValues():this._bindTableMapValues(),i.dataSource(r.dataTableMapping,!1),t=!0);break;case"legendCollection":n.legendCollection&&n.legendCollection>0&&(this.model.legendCollection=n.legendCollection);break;case"heatMapCell":case"heatmapCell":n.heatmapCell&&(n.heatmapCell.showContent!=undefined&&(n.heatMapCell.showContent=n.heatmapCell.showContent),n.heatmapCell.showColor!=undefined&&(n.heatMapCell.showColor=n.heatmapCell.showColor));n.heatMapCell&&(n.heatMapCell.showColor&&(typeof n.heatMapCell.showColor()=="boolean"?this._heatmapShowColor(n.heatMapCell.showColor()):this.model.heatMapCell.showColor=n.heatMapCell.showColor||n.heatMapCell.showColor===!1?n.heatMapCell.showColor:this.model.heatMapCell.showColor),n.heatMapCell.showContent&&(typeof n.heatMapCell.showContent()=="function"?this._heatmapShowContent(n.heatMapCell.showContent()):this.model.heatMapCell.showContent=n.heatMapCell.showContent||n.heatMapCell.showContent===!1?n.heatMapCell.showContent:this.model.heatMapCell.showContent),t=!0);break;case"tooltipSettings":case"enableTooltip":n.enableTooltip!=undefined&&(this.model.enableTooltip=n.enableTooltip);n.tooltipSettings&&(n.tooltipSettings.position&&(this.model.tooltipSettings.position=n.tooltipSettings.position),n.tooltipSettings.isBalloon!=undefined&&(this.model.tooltipSettings.isBalloon=n.tooltipSettings.isBalloon),n.tooltipSettings.animation&&(this.model.tooltipSettings.animation=n.tooltipSettings.animation),n.tooltipSettings.associate&&(this.model.tooltipSettings.associate=n.tooltipSettings.associate),n.tooltipSettings.trigger&&(this.model.tooltipSettings.trigger=n.tooltipSettings.trigger),n.tooltipSettings.templateId!==undefined&&n.tooltipSettings.templateId!==null&&(this.model.tooltipSettings.templateId=n.tooltipSettings.templateId));this._hasClass(this.element[0],"e-tooltip")&&($("#"+this.element[0].id).data("ejTooltip").destroy(),this.element.addClass("e-js"));this._renderTooltip()}t&&(i.refreshContent(),this._updateResponsiveSize(i))}},t.prototype._hasClass=function(n,t){for(var r=n.classList,i=0;i<r.length;i++)if(r[i]==t)return!0},t.prototype._init=function(){var n=this._getSpace();this._initData();this._updateDataSource();this._wireEvents();this._renderMapGrid();this._renderTooltip()},t.prototype._wireEvents=function(){this._on($(window),"resize",this._updateResponsiveSize);this._on($(window),"load",this._updateResponsiveSize);$(window).bind("mousewheel DOMMouseScroll",$.proxy(this._hideLegendMarker,this))},t.prototype._hideLegendMarker=function(){for(var i,n=$(".gradient_scale_marker"),t=0;n.length>0&&t<n.length;t++)n[t]&&(i=n[t],i.style.visibility="hidden")},t.prototype._getBoundingClientRect=function(n){var t=n.getBoundingClientRect();return ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"&&(t={left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:$(n).width(),height:$(n).height()}),t},t.prototype._getSpace=function(){var n=this._getBoundingClientRect(this.element[0])},t.prototype._initData=function(){typeof this.model.legendCollection=="string"&&(this.model.legendCollection=JSON.parse(this.model.legendCollection));this._updateHeatMapCellData(this.model);this.model.enableTooltip&&this.model.tooltipSettings&&!this.model.tooltipSettings.templateId&&(this.model.tooltipSettings.templateId=this.element[0].id+"_DefaultTooltipDiv")},t.prototype._updateHeatMapCellData=function(n){n&&n.heatmapCell&&(n.heatmapCell.showContent!=undefined&&(this.model.heatMapCell.showContent=n.heatmapCell.showContent),n.heatmapCell.showColor!=undefined&&(this.model.heatMapCell.showColor=n.heatmapCell.showColor))},t.prototype._updateDataSource=function(){},t.prototype._bindTableMapValues=function(){var o=[],f=[],e,r,n,u,i,t;if(this.model.itemsSource&&this.model.itemsSource.length>0)for(e=this.model.itemsSource,t=0;t<e.length;t++)o.push(e[t]);for(r=this.model.itemsMapping.headerMapping,n=r.columnStyle,n=this._mergeDefaultSettings(n,!0),u=!0,u=this.model.enableVirtualization?!1:u,r&&f.push({field:r.propertyName,headerText:r.displayName,isFrozen:u,width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""}),i=this.model.itemsMapping.columnMapping,t=0;i&&t<i.length;t++)n=i[t].columnStyle,n=this._mergeDefaultSettings(n,!1),f.push({field:i[t].propertyName,headerText:i[t].displayName,width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""});return{dataTableMapping:o,columns:f}},t.prototype._renderMapGrid=function(){var n=null,u,t,i,r;n=this.model.itemsMapping&&this.model.itemsMapping.column&&this.model.itemsMapping.column.propertyName!=""&&this.model.itemsMapping.row&&this.model.itemsMapping.row.propertyName!=""?this._bindCellMapValues():this._bindTableMapValues();u=null;this.model.height===null&&delete this.model.height;this.model.width===null&&delete this.model.width;n&&$("#"+this.element[0].id)[0]&&(t=ej.HeatMapGrid({},this),i={height:this.model.height!==undefined?this.model.height-40:"auto",width:this.model.width!==undefined?Number(this.model.width):"100%",allowVirtualScrolling:this.model.enableVirtualization?!0:!1,virtualScrollMode:"normal",enableVirtualization:this.model.enableVirtualization?!0:!1},this.model.width===undefined&&delete i.width,r={dataSource:n.dataTableMapping?n.dataTableMapping:[],columns:n.columns?n.columns:[],enableRowHover:!1,allowScrolling:!0,selectionSettings:{selectionMode:[ej.HeatMapGrid.SelectionMode.Cell]},queryCellInfo:$.proxy(this._setBinding,this),cellSelected:$.proxy(this._cellSelected,this),isResponsive:this.model.isResponsive?this.model.isResponsive:!1,enableResponsiveRow:!1,scrollSettings:i,minWidth:10,enableRTL:this.model.enableRTL?this.model.enableRTL:!1},t._init($("#"+this.element[0].id),r,this),this._updateResponsiveSize(t))},t.prototype._updateResponsiveSize=function(n){var e,o,u,f,t,i,r;if(this.model.isResponsive){if(e=$(".e-movableheaderdiv"),o=$(".e-movablecontentdiv"),e.css("width","100%"),o.css("width","100%"),e[0]&&(u=e[0].getElementsByTagName("colgroup")[0],u&&u.childNodes&&u.childNodes.length>0))for(t=0;this.model.itemsMapping.columnMapping&&t<this.model.itemsMapping.columnMapping.length;t++)i=this.model.itemsMapping.columnMapping[t],!i||i.columnStyle&&i.columnStyle.width||(r=$(u.childNodes[t]),r&&r[0]&&(r[0].style.width=""));if(o[0]&&(f=o[0].getElementsByTagName("colgroup")[0],f&&f.childNodes&&f.childNodes.length>0))for(t=0;this.model.itemsMapping.columnMapping&&t<this.model.itemsMapping.columnMapping.length;t++)i=this.model.itemsMapping.columnMapping[t],!i||i.columnStyle&&i.columnStyle.width||(r=$(f.childNodes[t]),r&&r[0]&&(r[0].style.width=""));n&&n._refreshScroller&&$(".e-scrollbar")[0]&&(this.model.enableVirtualization||$(".e-scrollbar")[0].parentNode.removeChild($(".e-scrollbar")[0]),n._initScrolling())}},t.prototype._cellSelected=function(n){this.model.selectedItem={cellValue:n.currentCell[0].ejHeatMapData.cellValue,source:n.currentCell[0].ejHeatMapData.data,cell:n.currentCell[0]};this._raiseEvent("cellSelected",{cellValue:n.currentCell[0].ejHeatMapData.cellValue,source:this._getTableData(n.currentCell[0].ejHeatMapData),cell:n.currentCell[0]})},t.prototype._componentToHex=function(n){var t=n.toString(16);return t.length===1?"0"+t:t},t.prototype._rgbToHex=function(n,t,i){return isNaN(n)&&isNaN(t)&&isNaN(i)?"":"#"+this._componentToHex(n)+this._componentToHex(t)+this._componentToHex(i)},t.prototype._setBinding=function(n){var t=$(n.cell),r=this._convertToRBG(ej.parseFloat(ej.format(n.text,"c")),this.model.colorMappingCollection),f=this._rgbToHex(r.R,r.G,r.B),u=this.model.itemsMapping.columnStyle&&this.model.itemsMapping.columnStyle[n.column.field]?this.model.itemsMapping.columnStyle[n.column.field]:null,i;this._heatmapShowColor()!=undefined&&(n.column.field&&u&&u.fillColor?(i=this._getForeGroundColor(u.fillColor),t.css("background-color",u.fillColor).css("color",i?i:"black")):(this._heatmapShowColor()===!1?t.css("background-color","white"):(i=this._getForeGroundColor(r),t.css("background-color",f).css("color",i?i:"")),this._setClassOnForzen(n.cell)&&t.index()===0&&t.css("font-weight","normal").css("font-size",12)));this._canEnableContent(n)&&(t[0].innerHTML=" ");this._bindHoverOutEvents(n,f);this.model.itemsMapping.headerMapping&&n.column.field&&this.model.itemsMapping.headerMapping.propertyName===n.column.field||t.addClass("sf-ht-enabletooltip")},t.prototype._canEnableContent=function(n){if(this._heatmapShowContent()===ej.datavisualization.HeatMap.CellVisibility.Hidden)return this.model.itemsMapping.headerMapping&&n.column&&this.model.itemsMapping.headerMapping.propertyName===n.column.field?!1:!0},t.prototype._setClassOnForzen=function(n){do if(n)if(n=n.parentNode,n){if(n.className==="e-movablecontent")return!0}else break;while(n&&n.className!=="e-gridcontent");return!1},t.prototype._getForeGroundColor=function(n){if(n.R!==undefined&&n.G!==undefined&&n.B!==undefined){var t=(n.R+n.G+n.B)/3;return t<255*.5?"white":isNaN(n.R)&&isNaN(n.G)&&isNaN(n.B)?"":"black"}return null},t.prototype._getTableData=function(n){var f=n.data,i,r,u,t;if(this.model.itemsMapping&&this.model.itemsMapping.column&&this.model.itemsMapping.row){if(i=this.model.itemsMapping.row,r=this.model.itemsMapping.column,n.column.field)return u=n.column.field,t={},t[i.propertyName]=f[i.propertyName],t.value=n.cellValue,t[r.propertyName]=u,t}else return n.data},t.prototype._bindHoverOutEvents=function(n,t){$(n.cell).mouseenter($.proxy(this._cellMouseEnter,this)).mousemove($.proxy(this._cellMouseHover,this)).mouseleave($.proxy(this._cellMouseOut,this));n.cell.ejHeatMapData={column:n.column,cellValue:n.text,data:n.data,rgb:t}},t.prototype._cellMouseOut=function(n){var t,i,r;for(this._raiseEvent("cellMouseLeave",{cellValue:n.currentTarget.ejHeatMapData.cellValue,source:this._getTableData(n.currentTarget.ejHeatMapData),cell:n.currentTarget}),t=$(".gradient_scale_marker"),i=0;t.length>0&&i<t.length;i++)t[i]&&(r=t[i],r.style.visibility="hidden")},t.prototype._cellMouseHover=function(n){this._raiseEvent("cellMouseOver",{cellValue:n.currentTarget.ejHeatMapData.cellValue,source:this._getTableData(n.currentTarget.ejHeatMapData),cell:n.currentTarget})},t.prototype._cellMouseEnter=function(n){var i,t,r,u;if(this.model.legendCollection.length>0)for(i=0,t=null;i<this.model.legendCollection.length;i++)r=this.model.legendCollection[i],r&&$("#"+r)[0]&&(u=$("#"+r).data("ejHeatMapLegend"),u&&(n.currentTarget.ejHeatMapData&&(t=n.currentTarget.ejHeatMapData.cellValue),t&&u.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient.toString()&&(t=Number(t),this.model.itemsMapping.headerMapping&&n.currentTarget.ejHeatMapData&&n.currentTarget.ejHeatMapData.column.field&&this.model.itemsMapping.headerMapping.propertyName===n.currentTarget.ejHeatMapData.column.field?this._hideLegendMarker():this._drawLegendMarker(u,t))));this._raiseEvent("cellMouseEnter",{cellValue:n.currentTarget.ejHeatMapData.cellValue,source:this._getTableData(n.currentTarget.ejHeatMapData),cell:n.currentTarget})},t.prototype._raiseEvent=function(n,t){if(this.model[n])return this._trigger(n,t)},t.prototype._drawDefaultTooltip=function(n){var t=document.getElementById(this.element[0].id+"_DefaultTooltipDiv");return t||(t=this._createDefaultTooltip(n)),t},t.prototype._createDefaultTooltip=function(n){var r=document.createElement("div"),f,t,i,u;return f={id:this.element[0].id+"_DefaultTooltipDiv","class":"e-heatmap-tooltip-default",style:"padding-top:3px; height: 24px;pointer-events:none;position: absolute"},t=this.model.itemsMapping.headerMapping&&this.model.itemsMapping.headerMapping.displayName?this.model.itemsMapping.headerMapping.displayName:"",t==""&&(t=this.model.itemsMapping.row&&this.model.itemsMapping.row.displayName?this.model.itemsMapping.headerMapping.displayName:""),n.event.currentTarget&&n.event.currentTarget.ejHeatMapData&&this.model.itemsMapping.headerMapping&&this.model.itemsMapping.headerMapping.propertyName&&(i=n.event.currentTarget&&n.event.currentTarget.ejHeatMapData,u=i.data[this.model.itemsMapping.headerMapping.propertyName]),r.innerHTML="<table><tr><td style='min-width:50px;padding-right: 10px;'>"+t+"<\/td><td>"+u+"<\/td><\/tr><tr><td>Value<\/td><td>"+i.cellValue+"<\/td><\/tr><\/table>",r},t.prototype._renderTooltip=function(){var n=this;n.model.enableTooltip&&$("#"+this.element[0].id).ejTooltip({target:".sf-ht-enabletooltip",position:this.model.tooltipSettings.position,isBalloon:this.model.tooltipSettings.isBalloon,animation:this.model.tooltipSettings.animation,associate:this.model.tooltipSettings.associate,trigger:this.model.tooltipSettings.trigger,beforeOpen:function(t){if(n.model.enableTooltip)if($("#"+n.element[0].id).ejTooltip("instance").hide(),t.event.currentTarget&&t.event.currentTarget.ejHeatMapData&&n.model.tooltipSettings.templateId!=this.element[0].id+"_DefaultTooltipDiv")$("#"+n.element[0].id).ejTooltip({content:$.templates("#"+n.model.tooltipSettings.templateId).render(t.event.currentTarget.ejHeatMapData)});else{var i=n._drawDefaultTooltip(t);$("#"+n.element[0].id).ejTooltip({content:$.templates(i).render(t.event.currentTarget.ejHeatMapData)})}}})},t.prototype._drawLegendMarker=function(n,t){var o,u,r;if(n&&t!==undefined&&!isNaN(t)){if(o=$("#"+n._id+"_gradient_scale")[0],o){u="position:absolute;visibility:visible;box-sizing:border-box;";r=$("#"+n._id+"_gradient_scale_marker")[0];r||(r=document.createElement("div"),r.setAttribute("id",n._id+"_gradient_scale_marker"),r.setAttribute("class","gradient_scale_marker"),o.appendChild(r));var i=this._getBoundingClientRect(o),s=this._getBoundingClientRect(r),f=this._getScroll(),e=this.model.colorMappingCollection,h=e[e.length-1].value;u+=n.model.orientation==="horizontal"?"width: 0;height: 0;border-left:"+i.height/2+"px solid transparent;border-right: "+i.height/2+"px solid transparent;border-bottom: "+i.height+"px solid green;":"border-left: none;border-right: "+i.width+"px solid green;border-bottom: "+i.width/2+"px solid transparent;border-top: "+i.width/2+"px solid transparent;";var l=e[0].value,c=e[e.length-1].value,a=c-l;n.model.orientation==="horizontal"?(u+=this.model.enableRTL?"left:"+(Math.round(i.left+f.x-s.width/2+1)+(Number((c-t)*100/h)/100*i.width-3))+"px;":"left:"+(Math.round(i.left+f.x-s.width/2+1)+(Number(t*100/h)/100*i.width-3))+"px;",u+="top:"+(i.top+f.y+2)+"px;"):(u+="left:calc("+(i.left+f.x)+"px + 0px);",u+=this.model.enableRTL?"top: calc( "+Math.round(i.top+f.y-s.height/2+1)+"px + "+(Number((c-t)*100/h)/100*i.height-3)+"px);":"top: calc( "+Math.round(i.top+f.y-s.height/2+1)+"px + "+(Number(t*100/h)/100*i.height-3)+"px);");r.setAttribute("style",u)}}else this._hideLegendMarker()},t.prototype._getScroll=function(){if(window.pageYOffset!==undefined)return{x:pageXOffset?pageXOffset:0,y:pageYOffset?pageYOffset:0};var n=void 0,t=void 0,i=document,r=i.documentElement,u=i.body;return n=r.scrollLeft||u.scrollLeft||0,t=r.scrollTop||u.scrollTop||0,{x:n?n:0,y:t?t:0}},t.prototype._convertToRBG=function(n,t){var u=0,o,e,i,s,h,c;typeof n=="number"?u=Number(n):typeof n=="string"||n==null;var r=0,f=0;t=this._orderbyOffset(t);for(o in t)if(e=Number(t[o].value),e!==undefined)if(u<=e){f=e;break}else f=e,r=e;return u<r||u>f,i=0,r!==undefined?(s=f-r,i=(u-r)/s,i=isNaN(i)&&u===0?0:i):r=f,i<0||i>1,h=this._getEqualColor(t,r),c=this._getEqualColor(t,f),this._getPercentageColor(i,h,c)},t.prototype._hashCode=function(n){for(var t=0,i=0;i<n.length;i++)t=n.charCodeAt(i)+((t<<5)-t);return t},t.prototype._intToRGB=function(n){var t=(n&16777215).toString(16).toUpperCase();return"00000".substring(0,6-t.length)+t},t.prototype._getPercentageColor=function(n,t,i){var e=i,u,o=t,r,f;e.split("#").length>1?u=e.split("#")[1]:(f=this._intToRGB(this._hashCode(e)),u=f);r=null;o.split("#").length>1?r=o.split("#")[1]:(f=this._intToRGB(this._hashCode(o)),r=f);var s=this._getPercentage(n,parseInt(r.substr(0,2),16),parseInt(u.substr(0,2),16)),h=this._getPercentage(n,parseInt(r.substr(2,2),16),parseInt(u.substr(2,2),16)),c=this._getPercentage(n,parseInt(r.substr(4,2),16),parseInt(u.substr(4,2),16));return{R:s,G:h,B:c}},t.prototype._getPercentage=function(n,t,i){var r=i-t;return Math.round(t+r*n)},t.prototype._getEqualColor=function(n,t){for(var r,i=0;i<n.length;i++)if(r=n[i],r&&Number(r.value)===t)return r.color;return"#00000"},t.prototype._orderbyOffset=function(n){for(var u,t,i,r=0;r<n.length-1;r++)t=n[r],i=n[r+1],t&&i&&t.value&&i.value&&t.value>i.value&&(u=t,t=i,i=u);return n},t.prototype._mergeDefaultSettings=function(n,t){var r,i;return n&&(r=n.width===undefined?!0:!1),i=$.extend(!0,{},this.model.defaultColumnStyle,n),t&&this.model.enableRTL&&(i.textAlign=!n||n&&!n.textAlign?"right":n.textAlign),r&&delete i.width,i},t.prototype._bindCellMapValues=function(){var f=[],e={prLeft:this.model.itemsMapping.row.propertyName,prTop:this.model.itemsMapping.column.propertyName,prValue:this.model.itemsMapping.value.propertyName},i=this._convertToCellBindingData(this.model.itemsSource,e),r=this.model.itemsMapping.row,o=this.model.itemsMapping.column,n=this._getCellBingingColumnData(r.propertyName,!0),u,t;for(n=this._mergeDefaultSettings(n,!1),r&&(u=!0,u=this.model.enableVirtualization?!1:u,f.push({field:r.propertyName,headerText:r.displayName,isFrozen:u,width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""})),t=0;t<i.items.length;t++)n=this._getCellBingingColumnData(i.items[t],!1),n=this._mergeDefaultSettings(n,!1),f.push({field:i.items[t],headerText:i.items[t],width:n&&n.width?n.width:null,textAlign:n&&n.textAlign?n.textAlign:"center",headerTemplateID:n&&n.headerTemplateID?n.headerTemplateID:"",templateID:n&&n.templateID?n.templateID:""});return{dataTableMapping:i.dataTableMapping,columns:f}},t.prototype._getCellBingingColumnData=function(n,t){var u,i,r,f;if(t){if(u=this.model.itemsMapping&&this.model.itemsMapping.headerMapping,u.propertyName===n)return this._mergeColumnStyle(u.columnStyle,!0)}else if(i=this.model.itemsMapping&&this.model.itemsMapping.columnMapping,i&&i.length>0)for(r=0;r<i.length;r++)if(f=this._mergeDefaultSettings(i[r],!1),f.propertyName===n)return this._mergeColumnStyle(f.columnStyle,!1);return null},t.prototype._mergeColumnStyle=function(n,t){return n=this._mergeDefaultSettings(n,t),$.extend(!0,{},{textAlign:n&&n.textAlign?n.textAlign:"center"},n)},t.prototype._convertToCellBindingData=function(n,t){var u=[],e=[],c,i,r,f,o,s,h;for(c in n)if(i=n[c],i&&(r={},i[t.prLeft]))if(u.length===0)f=!1,r.hasOwnProperty(i[t.prLeft])||(r[t.prLeft]=i[t.prLeft],u.push(r),f=!0),f&&(r[i[t.prTop].toString()]=i[t.prValue]);else{for(f=!1,o=0;o<u.length;o++)s=u[o],s&&s[t.prLeft]===i[t.prLeft]&&(s[i[t.prTop]]=i[t.prValue],e.indexOf(i[t.prTop])===-1&&e.push(i[t.prTop].toString()),f=!0);f||(h=!1,r.hasOwnProperty(i[t.prLeft])||(r[t.prLeft]=i[t.prLeft],u.push(r),h=!0),h&&(r[i[t.prTop].toString()]=i[t.prValue],e.indexOf(i[t.prTop])===-1&&e.push(i[t.prTop].toString())))}return{dataTableMapping:u,items:e}},t}(ej.WidgetBase);window.ej.widget("ejHeatMap","ej.datavisualization.HeatMap",new Heatmap);ej.datavisualization.HeatMap.CellVisibility={Visible:"visible",Hidden:"hidden"};ej.datavisualization.HeatMap.Effect={Slide:"slide",Fade:"fade",None:"none"};ej.datavisualization.HeatMap.Trigger={Hover:"hover",Click:"click"};ej.datavisualization.HeatMap.Associate={MouseFollow:"mouseFollow",MouseEnter:"mouseEnter",Target:"target"};ej.datavisualization.HeatMap.Horizontal={Left:"left",Center:"center",Right:"right"};ej.datavisualization.HeatMap.Vertical={Top:"top",Center:"center",Bottom:"bottom"};ej.datavisualization.HeatMap.TextAlign={Right:"right",Left:"left",Center:"center"};ej.datavisualization.HeatMap.LegendMode={Gradient:"gradient",List:"list"};ej.datavisualization.HeatMap.LegendOrientation={Horizontal:"horizontal",Vertical:"vertical"};ej.datavisualization.HeatMap.TextDecorations={Underline:"underline",Overline:"overline",LineThrough:"line-through",None:"none"};HeatmapLegend=function(n){function t(t,i){return n.call(this),this.defaults={colorMappingCollection:null,orientation:ej.datavisualization.HeatMap.LegendOrientation.Horizontal,showLabel:!0,legendMode:"gradient",height:null,width:null,isResponsive:!1,enableRTL:!1},this.validTags=["div"],this._rootCSS="e-heatmaplegend",this._id="",this.setFirst=!1,this.PluginName="ejHeatMapLegend",this.id="null",this.model=null,this.dataTypes={colorMappingCollection:"data"},this._tags=[{tag:"colorMappingCollection",attr:["value","color","label.bold","label.italic","label.text","label.textDecoration","label.fontSize","label.fontFamily","label.fontColor",],singular:"colorMapping"}],t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejHeatMapLegend(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype._init=function(){this._initLegendData();this._wireEvents();this._renderLegend()},t.prototype._setLabel=function(n){var t=n?n:{};return t.bold=t&&t.bold!==undefined?t.bold:!1,t.italic=t&&t.italic!==undefined?t.italic:!1,t.text=t&&t.text?t.text:"",t.textDecoration=t&&t.textDecoration?t.textDecoration:ej.datavisualization.HeatMap.TextDecorations.None,t.fontSize=t&&t.fontSize?t.fontSize:10,t.fontFamily=t&&t.fontFamily?t.fontFamily:"Arial",t.fontColor=t&&t.fontColor?t.fontColor:"black",t},t.prototype._initLegendData=function(){this.model.colorMappingCollection=this._getSortedMappingList(this.model.colorMappingCollection);for(var n=0;n<this.model.colorMappingCollection.length;n++)this.model.colorMappingCollection[n].label=this._setLabel(this.model.colorMappingCollection[n].label)},t.prototype._wireEvents=function(){this._on($(window),"resize",this._updateLegendSize);$(this.element[0].parentNode).scroll($.proxy(this._hideLegendMarker,this))},t.prototype._hideLegendMarker=function(){var n=$(".gradient_scale_marker");for(var t in n)n[t]&&n[t].parentNode&&n[t].parentNode.removeChild(n[t])},t.prototype._scrollElement=function(){var n=$("#"+this._id+"_gradient_scale_marker")[0];n&&n.parentNode.removeChild(n)},t.prototype._getLargerGradientLabel=function(){for(var u,n,f,t={left:0,top:0,width:0,height:0},i=this.model.colorMappingCollection,r=0;i&&r<i.length;r++)u=i[r],n=document.createElement("span"),this.element[0].appendChild(n),this._mergeLabelProperties(n,u),u.label&&(f=this._getBoundingClientRect(n),t=this._union(t,f)),n.parentNode.removeChild(n);return t},t.prototype._getBoundingClientRect=function(n){var t=n.getBoundingClientRect();return ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"&&(t={left:t.left<0?0:t.left,top:t.top<0?0:t.top,right:t.right<0?0:t.right,bottom:t.bottom<0?0:t.bottom,width:$(n).outerWidth(),height:$(n).outerHeight()}),{left:t.left<0?0:t.left,top:t.top<0?0:t.top,right:t.right<0?0:t.right,bottom:t.bottom<0?0:t.bottom,width:t.width,height:t.height}},t.prototype._getSpace=function(){var t=this._getLargerGradientLabel(),n=this._getBoundingClientRect(this.element[0]);return n={bottom:n.bottom,height:n.height-(t.height/2+2),left:n.left,right:n.right,top:n.top,width:this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?n.width-10:n.width},this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient&&(this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?n.width=n.width-t.width/2:n.height=n.height-t.height/2),n},t.prototype._renderLegend=function(){var n=$("#"+this.element[0].id)[0],i,r,t;n&&($("div."+this.element[0].id).find("*").removeAttr("style"),$("#"+this.element[0].id).empty());i=this.model.height?this.model.height:"100%";r=this.model.width?this.model.width:"100%";$("#"+this.element[0].id).attr("role","heatmap-legend").css("height",i).css("width",r).css("overflow","hidden");t=this._getSpace(null);this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient?this._renderGradient(t,n,null):this._renderList(t,n,null)},t.prototype._mergeLabelProperties=function(n,t){if(n&&t&&t.label){var i=t.label;i&&(n.innerHTML=this.model.legendMode!=="gradient"&&i.text?i.text:t.value,n.style.fontFamily=i.fontFamily,n.style.fontSize=i.fontSize+"px",n.style.fontColor=i.fontColor,n.style.textDecoration=i.textDecoration,n.style.fontWeight=i.bold?"bold":"",n.style.fontStyle=i.italic?"italic":"")}},t.prototype._union=function(n,t){var i=Math.min(n.left,t.left),r=Math.min(n.top,t.top),u=Math.max(n.width,t.width),f=Math.max(n.height,t.height);return{left:i,top:r,width:u-i,height:f-r}},t.prototype._updateLegendSize=function(n){if(this.model.isResponsive){var r=this.model.height?this.model.height:"100%",u=this.model.width?this.model.width:"100%",t=$("#"+this.element[0].id)[0],i=this._getSpace(!0);this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient?this._renderGradient(i,t,n):this._renderList(i,t,n)}},t.prototype._renderListBox=function(n,t,i,r,u,f){var e=$("#"+t)[0],h,s,c,o,l;e||(e=document.createElement("div"),e.setAttribute("id",t),this.model.enableRTL?$(n).prepend(e):n.appendChild(e),e.setAttribute("style","height:auto;height:auto;float:left;vertical-align: middle;"));e.setAttribute("role","list");h="";s=$("#"+e.id+"_colordiv_")[0];s||(s=document.createElement("div"),s.setAttribute("id",e.id+"_colordiv_"),e.appendChild(s));h="background-color:"+i.color+";";s.setAttribute("style",h+"height:"+u+"px;width:"+r+"px;float:left");this.model.showLabel&&(c=this._getBoundingClientRect(e),o=$("#"+e.id+"_labelSpan_")[0],o||(o=document.createElement("span"),o.setAttribute("id",e.id+"_labelSpan_"),o.setAttribute("aria-label","label"),o.setAttribute("class","sf-ht-label"),o.innerHTML=i.label&&i.label.text?i.label.text:i.value,e.appendChild(o)),o.setAttribute("style","float:left;margin-left:3px;margin-right:3px;margin-right:3px;margin-bottom:3px;"),this._mergeLabelProperties(o,i),l=this._getBoundingClientRect(o),o.style.marginTop=c.height/2-l.height/2+"px");this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?e.style.margin="10px":(!f||this.model.enableRTL)&&($("#"+e.id+"_colordiv_br")[0]||$(e).after("<div id="+e.id+"_colordiv_br> <\/br><\/br><\/div> "))},t.prototype._renderList=function(n,t,i){var r=$("#"+t.id+"_list")[0],f,u,e;for(r?i&&(r.innerHTML=""):(r=document.createElement("div"),r.setAttribute("id",t.id+"_list"),t.appendChild(r),r.setAttribute("style","height:auto;height:auto;float:left;")),f=this.model.colorMappingCollection,u=0;u<f.length;u++)this._renderListBox(r,t.id+"_listBox_"+u,f[u],15,15,u===f.length-1?!0:!1);var o=this._getBoundingClientRect(t),s=this._getBoundingClientRect(r),h=o.width/2-s.width/2;r.style.marginLeft=h<=0?"0px":h+"px";e=o.height/2-s.height/2;r.style.marginTop=e<=0?"0px":e+"px"},t.prototype._setAttribute=function(n,t){if(n)for(var i in t)n.setAttribute(i,t[i])},t.prototype._renderGradient=function(n,t,i){var r=$("#"+this.element[0].id+"_gradient_scale_line")[0],f,o,u,s,e;r||(r=document.createElement("div"),t.appendChild(r));f=this.model.orientation==="horizontal"?"":"float:left;";f+=this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?"height:"+(40/100*n.height+20/100*n.height)+"px;width:"+n.width+"px; ":"height:"+n.height+"px;width:"+(40/100*n.width+20/100*n.width)+"px;";o=this._getStartlabelOffset();f+=this.model.orientation==="horizontal"?"padding-left:"+o.width+"px;":"padding-top:"+(o.height/2-1)+"px;";r.setAttribute("style",f);this._setAttribute(r,{id:"#"+this.element[0].id+"_gradient_scale_line"});r.setAttribute("style",f);u=$("#"+this.element[0].id+"_gradient")[0];u?i&&(u.innerHTML=""):(u=document.createElement("div"),r.appendChild(u));this._setAttribute(u,{id:this.element[0].id+"_gradient",role:"gradient"});s="to right , ";e="float:left; ";this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?e+="height:"+(40/100*n.height-2)+"px; width:"+n.width+"px; ":(s="to bottom , ",e+="height:"+n.height+"px;width:"+(40/100*n.width-2)+"px;");u.setAttribute("style",e);this._renderGradientElements(u);this._renderGradientScale(n,r,i);this._renderGradientScaleValue(n,t,i)},t.prototype._renderGradientElements=function(n){var i=this.model.colorMappingCollection,p=Number(i[0].value),f=i.length,s=Number(i[i.length-1].value),t,l,o,a,v;if(f>0){var h=0,c=0,e=this._getBoundingClientRect(n);for(t=1;i&&t<f;t++){var r="float:left;border:none;",u=$("#"+this.element[0].id+"_inner_gradient"+t)[0],y=this._childElementsBounds(n).width?this._childElementsBounds(n).width:0;u||(u=document.createElement("div"),this.model.enableRTL?$(n).prepend(u):n.appendChild(u));this.model.orientation==="horizontal"?(l=i[t].value*100/s,o=e.width*(l/100)-h,t===f-1&&(o=e.width-y-1),r+="height:100%;width:"+o+"px;",r+=this.model.enableRTL?ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t].color+", endColorstr="+i[t-1].color+",GradientType=1 );":"background:linear-gradient(to right ,"+i[t].color+", "+i[t-1].color+");":ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t-1].color+", endColorstr="+i[t].color+",GradientType=1 );":"background:linear-gradient(to right ,"+i[t-1].color+", "+i[t].color+");"):(a=i[t].value*100/s,v=e.height*(a/100)-c,r+="width:100%;height:"+v+"px;",r+=this.model.enableRTL?ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t].color+", endColorstr="+i[t-1].color+",GradientType=0 );":"background:linear-gradient(to bottom ,"+i[t].color+", "+i[t-1].color+");":ej.browserInfo().name==="msie"&&ej.browserInfo().version==="8.0"||ej.browserInfo().version==="9.0"?"filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="+i[t-1].color+", endColorstr="+i[t].color+",GradientType=0 );":"background:linear-gradient(to bottom ,"+i[t-1].color+", "+i[t].color+");");this._setAttribute(u,{id:this.element[0].id+"_inner_gradient"+t,style:r});h=this._childElementsBounds(n).width;c=this._childElementsBounds(n).height}}},t.prototype._getStartlabelOffset=function(){var n=document.createElement("span"),t,i;return this.element[0].appendChild(n),t=this.model.colorMappingCollection[0],this._mergeLabelProperties(n,t),i=null,t.label&&(i=this._getBoundingClientRect(n)),n.parentNode.removeChild(n),i},t.prototype._renderGradientScaleValue=function(n,t,i){var u=$("#"+this.element[0].id+"_gradient_scale_value")[0],o,r;u?i&&(u.innerHTML=""):(u=document.createElement("div"),t.appendChild(u));this._setAttribute(u,{id:this.element[0].id+"_gradient_scale_value"});o="float:left;";o+=this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?"width: 100%;":"height:100%;width:12px;margin-left:2px;";u.setAttribute("style",o);var f=this.model.colorMappingCollection,h=this._getBoundingClientRect(u),e=null,s=this._getStartlabelOffset();if(this.model.enableRTL)for(r=f.length-1;r>=0;r--)e=this._createGradientLabel(n,f[r],u,this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?!0:!1,r,e,r===0?s.width/2:0,0);else for(r=0;r<f.length;r++)e=this._createGradientLabel(n,f[r],u,this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?!0:!1,r,e,r===0?s.width/2:0,0)},t.prototype._createGradientLabel=function(n,t,i,r,u,f,e,o){var c,s,h,a;if(this.model.showLabel){c=this._getBoundingClientRect(i);s=$("#"+this.element[0].id+"_gradient_scale_value"+t.value)[0];s||(s=document.createElement("span"),i.appendChild(s));s.setAttribute("id",this.element[0].id+"_gradient_scale_value"+t.value);h="float:left;";h+="height:auto;";h+="width:auto;";s.setAttribute("style",h);s.innerHTML=t.value;this._mergeLabelProperties(s,t);var d=this._getBoundingClientRect(s),l=this.model.colorMappingCollection,g=l[l.length-1].value,nt=this._getScroll(),b=$("#"+this.element[0].id+"_gradient")[0],k=l[0].value,w=l[l.length-1].value,v=w-k,y=0,p=0;return b&&(c=this._getBoundingClientRect(b)),r?(y=this.model.enableRTL?Math.round(r?(w-t.value)/v*c.width:0):Math.round(r?t.value/v*c.width:0),h+="margin-left:"+(y+(e?e:0)-(f&&f.x?f.x:0))+"px;"):(p=this.model.enableRTL?Math.round((w-t.value)/v*c.height):Math.round(t.value/v*c.height),h+="margin-top:"+(p+(u===1?-3:0)+(o?o:0)-(f&&f.y?f.y:0))+"px;"),r?p=0:y=0,s.setAttribute("style",h),s.setAttribute("aria-label","label"),s.setAttribute("class","sf-ht-label"),this._mergeLabelProperties(s,t),a=this._getBoundingClientRect(s),{x:y+a.width+(e?a.width/2:0),y:p+a.height-(u===0?0:0)+(o?a.height/2:0)}}},t.prototype._renderGradientScale=function(n,t,i){var u=$("#"+this.element[0].id+"_gradient_scale")[0],o,f,r;if(u?i&&(u.innerHTML=""):(u=document.createElement("div"),t.appendChild(u)),this._setAttribute(u,{id:this.element[0].id+"_gradient_scale"}),o="float:left;",o+=this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal?"height:"+20/100*n.height+"px; width:"+n.width+"px; margin-top:2px;":"height:"+n.height+"px;width:"+20/100*n.width+"px; margin-left:2px",u.setAttribute("style",o),this.model.legendMode===ej.datavisualization.HeatMap.LegendMode.Gradient){var e=this.model.colorMappingCollection,s=this._getBoundingClientRect(u),h=e[e.length-1].value;if(this.model.orientation===ej.datavisualization.HeatMap.LegendOrientation.Horizontal)for(f=this._createValueLine(this.element[0].id+"_gradient_scale_first",!0,n,"",u),r=1;r<e.length;r++)f+=this._createSpaceLine(this.element[0].id+r+"space",!0,n,"",u,f,e[r],r),f+=this._createValueLine(this.element[0].id+r+"value",!0,n,"",u);else for(f=this._createValueLine(this.element[0].id+"_gradient_scale_first",!1,n,"",u),r=1;r<e.length;r++)f+=this._createSpaceLine(this.element[0].id+r+"space",!1,n,"",u,f,e[r],r),f+=this._createValueLine(this.element[0].id+r+"value",!1,n,"",u)}},t.prototype._childElementsBounds=function(n){var i=n.childNodes,u={left:0,top:0,right:0,bottom:0,width:0,height:0},r,t;if(i.length>0)for(t=0;t<i.length;t++)i[t]&&(r=this._getBoundingClientRect(i[t]),r&&(u.width+=r.width,u.height+=r.height));return u},t.prototype._createSpaceLine=function(n,t,i,r,u,f,e,o){var y=this._getBoundingClientRect(u),w=this._childElementsBounds(u),s=$("#"+n)[0],h,a,v;s||(s=document.createElement("div"),s.setAttribute("id",n),this.model.enableRTL?$(u).prepend(s):u.appendChild(s));h="float:left;border: 1px solid gray; ";var c=this.model.colorMappingCollection,b=c[0].value,k=c[c.length-1].value,p=k-b,l=t?e.value/p*y.width:0;return l-=o===1||o===c.length-1?5:4,t&&(l-=w.width),a=Math.round(t?0:e.value/p*y.height-(o===1?6:4)),t||(a-=f),h+="height:"+Math.floor(a)+"px;",h+="width:"+Math.floor(l)+"px;",s.setAttribute("style",h),v=this._getBoundingClientRect(s),t?v.width:v.height},t.prototype._createValueLine=function(n,t,i,r,u){var s=this._getBoundingClientRect(u),f=$("#"+n)[0],o;f||(f=document.createElement("div"),f.setAttribute("id",n),this.model.enableRTL?$(u).prepend(f):u.appendChild(f));var e="float:left;",h=t?0:s.width,c=t?s.height:0;return e+="height:"+c+"px;",e+="width:"+h+"px;",e+="border: 1px solid gray; ",r&&(e+=r),f.setAttribute("style",e),o=this._getBoundingClientRect(f),t?o.width:o.height},t.prototype._getScroll=function(){if(window.pageYOffset!==undefined)return{x:pageXOffset?pageXOffset:0,y:pageYOffset?pageYOffset:0};var n=void 0,t=void 0,i=document,r=i.documentElement,u=i.body;return n=r.scrollLeft||u.scrollLeft||0,t=r.scrollTop||u.scrollTop||0,{x:n?n:0,y:t?t:0}},t.prototype._getSortedMappingList=function(n){var t,i,r;if(n){for(t=0;t<n.length;t++)for(i=t+1;i<n.length;i++)Number(n[t].value)>Number(n[i].value)&&(r=n[t],n[t]=n[i],n[i]=r);return n}},t.prototype._setModel=function(n){var i,t;for(i in n)switch(i){case"colorMappingCollection":for(this.model.colorMappingCollection=n.colorMappingCollection?n.colorMappingCollection:this.model.colorMappingCollection,this.model.colorMappingCollection=this._getSortedMappingList(this.model.colorMappingCollection),t=0;t<this.model.colorMappingCollection.length;t++)this.model.colorMappingCollection[t].label=this._setLabel(this.model.colorMappingCollection[t].label);this._updateLegendSize(!0);break;case"legendMode":this._renderLegend()}},t}(ej.WidgetBase);window.ej.widget("ejHeatMapLegend","ej.datavisualization.HeatMapLegend",new HeatmapLegend),function(n,t,r){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.common={refreshContent:function(n){n&&(this.refreshTemplate(),this.refreshHeader());this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFilterBarTemplate();var i={};this._initialRenderings();i.requestType=t.Grid.Actions.Refresh;this._processBindings(i)},rowHeightRefresh:function(){var i,s,h,f,o;if(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.model.currentViewData)&&this.model.currentViewData.length){var u=this.getContentTable().get(0).rows,e=this.getContentTable().get(1).rows,r=0;if(this.getContent().find(".e-frozencontentdiv").is(":visible"))for(i=0;i<u.length;i++)n(u[i]).css("display")!="none"&&(s=u[i].getClientRects()[0].height,h=e[i].getClientRects()[0].height,r=t.isNullOrUndefined(s)||t.isNullOrUndefined(h)?t.max([u[i].offsetHeight,e[i].offsetHeight]):t.max([s,h]),n(u[i]).height(r),n(e[i]).height(r),i&&(i==this.model.scrollSettings.frozenRows-1||i==u.length-1)&&(r=r+1),this.model.allowTextWrap||i&&i!=this.model.scrollSettings.frozenRows-1||(r=r-1),this.model.isEdit&&n(u[i]).find("#"+this._id+"EditForm").length&&i&&n(u[i]).find("#"+this._id+"EditForm td").css("height",r),n(e[i]).find("#"+this._id+"EditForm td").css("height",r));if(this.model.showSummary&&this.model.summaryRows.length>0){var c=this.getFooterTable().get(0).rows,a=this.getFooterTable().get(1).rows,l=0;for(f=0;f<c.length;f++)l=t.max([c[f].getClientRects()[0].height,a[f].getClientRects()[0].height]),n(c[f]).height(l),n(a[f]).height(l)}this._getRowHeights();!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&(this.getScrollObject()._vScrollbar!=null||this.getScrollObject().isVScroll())&&(o=this.getScrollObject()._vScrollbar,(t.isNullOrUndefined(o)||o.value()!=o.model.maximum)&&this._scrollObject.refresh(this.model.scrollSettings.frozenColumns>0))}},dataSource:function(n,t){if(t&&(this._templateRefresh=!0),this._dataSource(n),this.model.scrollSettings.enableVirtualization||this._currentPage(1),this._updateDataSource=!0,this._refreshDataSource(n,t),this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling){var i=this._refreshVirtualPagerInfo();this._showPagerInformation(i)}this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData?this._refreshVirtualView():this._refreshVirtualContent(),this.getContent().ejScroller("isHScroll")&&this.getContent().ejScroller("scrollX",0,!0),this.getContent().ejScroller("isVScroll")?(this.model.scrollSettings.enableVirtualization||this.getContent().ejScroller("scrollY",0,!0),this.element.find(".e-gridheader").addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss"));(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow();this._trigger("dataBound",{})},_refreshDataSource:function(n,i){this._dataManager=n instanceof t.DataManager?n:t.DataManager(n);this._isRemoteSaveAdaptor=this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.remoteSaveAdaptor;this._isLocalData=!(this._dataSource()instanceof t.DataManager)||this._dataManager.dataSource.offline||this._isRemoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor;this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._virtualDataRefresh=!0,this._isLocalData&&this._refreshVirtualViewDetails(!0));this.refreshContent(t.isNullOrUndefined(i)?!0:i);t.isNullOrUndefined(this.getPager())||(this.getPager().ejPager("model.currentPage",1),this._refreshGridPager())},hideColumns:function(i){var v=0,s={},e,w=[],b,c,y=0,r,l,h,p,a;b=typeof i=="string"?this.getColumnByHeaderText(i):this.getColumnByHeaderText(i[0]);c=typeof i=="string"?this.getColumnByField(i):this.getColumnByField(i[0]);this._showHideColumns=!0;var o=this._isDuplicate(n.merge(n.merge([],this._visibleColumns),this._hiddenColumns)),f=o?"_hiddenColumnsField":"_hiddenColumns",u=o?"_visibleColumnsField":"_visibleColumns";if(!o&&c!=null)if(n.isArray(i))for(r=0;r<i.length;r++)l=this.getColumnByField(i[r]),i[r]=l!=null?l.headerText:i[r];else i=c.headerText;if(n.isArray(i))for(r=0;r<i.length;r++)e=n.inArray(i[r],this[u]),e!=-1?(this[f].push(i[r]),this[u].splice(e,1)):e==-1&&u=="_visibleColumnsField"&&n.inArray(i[r],this[f])==-1&&t.isNullOrUndefined(this.getColumnByField(i[r]))&&(this[f].push(this.getColumnByHeaderText(i[r]).field)&&this._hiddenColumns.push(this.getColumnByHeaderText(i[r]).field),this[u].splice(n.inArray(this.getColumnByHeaderText(i[r]).field,this[u]),1)&&this._visibleColumns.splice(n.inArray(i[r],this._visibleColumns),1));else e=n.inArray(i,this[u]),e!=-1?(this[f].push(i),this[u].splice(e,1)):e==-1&&u=="_visibleColumnsField"&&n.inArray(i,this[f])==-1&&t.isNullOrUndefined(this.getColumnByField(i))&&(this[f].push(this.getColumnByHeaderText(i).field)&&this._hiddenColumns.push(this.getColumnByHeaderText(i).field),this[u].splice(n.inArray(this.getColumnByHeaderText(i).field,this[u]),1)&&this._visibleColumns.splice(n.inArray(i,this._visibleColumns),1));for(r=0;r<this.model.columns.length;r++)if(h=o?"field":"headerText",n.inArray(t.isNullOrUndefined(this.model.columns[r][h])||this.model.columns[r][h]==""?this.model.columns[r].headerText:this.model.columns[r][h],this[f])!=-1&&(this.model.columns[r].visible&&w.push(this.model.columns[r]),this.model.columns[r].visible=!1,this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&this.model.columns.indexOf(this.model.columns[r])<this.model.scrollSettings.frozenColumns&&y++,v++),this[f].length==v)break;s.requestType="refresh";this._hideHeaderColumn(this[f],o);this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&(p=this._renderGridHeader(),this.element.find(".e-gridheader").replaceWith(p[0]),this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering(),this.model.allowReordering&&this._headerCellreorderDragDrop());this.refreshTemplate();this.model.scrollSettings.allowVirtualScrolling&&this._virtualShowHide(s);this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(s),this._isAddNew=!1);this.sendDataRenderingRequest(s);this.rowHeightRefresh();this.model.allowScrolling&&(this.model.scrollSettings.frozenColumns!=0||t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||(a=this._calculateWidth(),this.getHeaderTable().width(a),this.getContentTable().width(a)),t.isNullOrUndefined(this._scrollObject)||this.getScrollObject().refresh());this.model.showColumnChooser&&this._refreshColumnChooserList();this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&(y==this.model.scrollSettings.frozenColumns&&this._frozenPaneRefresh(),this.getScrollObject().refresh());this._showHideColumns=!1},showColumns:function(i){var y=0,s={},c=[],w,l,a,h,v,u,r,p;w=typeof i=="string"?this.getColumnByHeaderText(i):this.getColumnByHeaderText(i[0]);l=typeof i=="string"?this.getColumnByField(i):this.getColumnByField(i[0]);this._showHideColumns=!0;var o=this._isDuplicate(n.merge(n.merge([],this._visibleColumns),this._hiddenColumns)),f=o?"_hiddenColumnsField":"_hiddenColumns",e=o?"_visibleColumnsField":"_visibleColumns";if(!o&&l!=null)if(n.isArray(i))for(r=0;r<i.length;r++)a=this.getColumnByField(i[r]),i[r]=a!=null?a.headerText:i[r];else i=l.headerText;if(n.isArray(i))for(r=0;r<i.length;r++)u=n.inArray(i[r],this[f]),u!=-1?(this[f].splice(u,1),this[e].push(i[r])):u==-1&&f=="_hiddenColumnsField"&&n.inArray(i[r],this[e])==-1&&t.isNullOrUndefined(this.getColumnByField(i[r]))&&(this[e].push(this.getColumnByHeaderText(i[r]).field)&&this._visibleColumns.push(i[r]),this[f].splice(n.inArray(this.getColumnByHeaderText(i[r]).field,this[f]),1)&&this._hiddenColumns.splice(n.inArray(i[r],this._hiddenColumns),1));else u=n.inArray(i,this[f]),u!=-1?(this[f].splice(u,1),this[e].push(i)):u==-1&&f=="_hiddenColumnsField"&&n.inArray(i,this[e])==-1&&t.isNullOrUndefined(this.getColumnByField(i))&&(this[e].push(this.getColumnByHeaderText(i).field)&&this._visibleColumns.push(i),this[f].splice(n.inArray(this.getColumnByHeaderText(i).field,this[f]),1)&&this._hiddenColumns.splice(n.inArray(i,this._hiddenColumns),1));for(r=0;r<this.model.columns.length;r++)if(h=o?"field":"headerText",n.inArray(t.isNullOrUndefined(this.model.columns[r][h])||this.model.columns[r][h]==""?this.model.columns[r].headerText:this.model.columns[r][h],this[e])!=-1&&(this.model.columns[r].visible||c.push(this.model.columns[r]),this.model.columns[r].visible=!0,y++),this[e].length==y)break;if(this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0){for(v=!1,r=0;r<c.length;r++)u=this.model.columns.indexOf(c[r]),u<this.model.scrollSettings.frozenColumns&&(v=!0);if(v){for(r=0;r<this.model.columns.length;r++)n.inArray(this.model.columns[r].headerText,this._hiddenColumns)!=-1?this.model.columns[r].visible=!1:n.inArray(this.model.columns[r].headerText,this._visibleColumns)!=-1&&(this.model.columns[r].visible=!0);p=this._renderGridHeader();this.element.find(".e-gridheader").replaceWith(p[0]);this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering();this.model.allowReordering&&this._headerCellreorderDragDrop()}}s.requestType="refresh";this._showHeaderColumn(this[e],o);this.refreshTemplate();this.model.scrollSettings.allowVirtualScrolling&&this._virtualShowHide(s);this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(s),this._isAddNew=!1);this.sendDataRenderingRequest(s);this.rowHeightRefresh();this.model.allowScrolling&&!t.isNullOrUndefined(this._scrollObject)&&this.getScrollObject().refresh();this.model.showColumnChooser&&this._refreshColumnChooserList();this._showHideColumns=!1},_virtualShowHide:function(n){this._currentPage(1);this.model.query=this.commonQuery.clone();this._ensureDataSource(n);this._loadedJsonData=[];this._prevPage=this._currentPage()},resizeColumns:function(n,t){var i,r;if(n instanceof Array)for(i=0;i<n.length;i++)r=t instanceof Array?t[i]:t,this._setWidthColumnCollection(n[i],r);else this._setWidthColumnCollection(n,t);this.setWidthToColumns();this.model.scrollSettings.frozenColumns&&(this._frozenAlign(),this.rowHeightRefresh())},_setWidthColumnCollection:function(t,i){var r=this.getColumnByHeaderText(t)||this.getColumnByField(t);r.width=i;n.inArray(r.field,this._disabledResizingColumns)==-1&&(this.columnsWidthCollection[n.inArray(r,this.model.columns)]=i)},refreshTemplate:function(){this.addInitTemplate();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.model.allowGrouping&&this.addGroupingTemplate()},refreshHeader:function(){var n=this.element.find(".e-gridheader");this.element[0].replaceChild(this._renderGridHeader()[0],n[0]);this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering();this.model.allowGrouping&&this._headerCellgDragDrop();this.model.allowReordering&&this._headerCellreorderDragDrop();this.model.showColumnChooser&&this._renderColumnChooserData(!0);this.model.gridLines!="both"&&this._showHeaderGridLines()},set_dropColumn:function(i,u){var w,b,y,ut,ft,et,tt,ot,k,st,a,e,f,o,nt;if(this.model.allowReordering&&i!=u){this.model.columns.splice(u,0,this.model.columns.splice(i,1)[0]);var s=this.model.columns,p=this.getHeaderTable().find(".e-columnheader:last .e-headercell").not(".e-stackedHeaderCell"),c=p.find(".e-headercelldiv"),ht=this.getHeaderContent().find("div").first().scrollLeft();this.model.scrollSettings.frozenColumns||this.getHeaderTable().find("colgroup").replaceWith(this._getMetaColGroup());(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&this.getHeaderTable().find("colgroup").prepend(this._getIndentCol());w=function(t){var i=[],o,e,s;if(t!=r){["",r].indexOf(t.value)==-1&&(i.push({name:"value",value:t.value}),t.value="");for(var u=0,f=t.attributes,h=f.length;u<h;u++)o=/^jQuery[0-9]+$/,f[u].name.match(o)||i.push({name:f[u].name,value:f[u].value});for(e=0,s=i.length;e<s;e++)n(t).removeAttr(i[e].name);return i}};b=function(t,i){if(i!=r)for(var u=0,f=t.length;u<f;u++)t[u].name=="value"&&(i.value=t[u].value),n(i).attr(t[u].name,t[u].value)};this.getHeaderTable().find(".e-fltrtempdiv").length==0&&this.getHeaderTable().find(".e-filterdiv").length>0&&(y=this.getHeaderTable().find(".e-filterdiv input"));var d=t.isNullOrUndefined(y),h={cellattributes:[],headerattributes:[],filtercellattributes:[],filterThattributes:[]},it=i<u?i:u,rt=i<u?u:i;for(f=it,o=0;f<=rt;f++)ut=this.model.detailsTemplate!=null||this.model.childGrid!=null?f+1:f,h.headerattributes[o]=w(p[ut]),h.cellattributes[o]=w(c[f]),h.filtercellattributes[o]=d?[]:w(y[f]),h.filterThattributes[o]=d?[]:w(n(y[f]).closest("th")[0]),o++;ft=i<u?h.cellattributes.length-1:0;et=i<u?0:h.cellattributes.length-1;for(tt in h)h[tt].splice(ft,0,h[tt].splice(et,1)[0]);for(f=it,o=0;f<=rt;f++)ot=this.model.detailsTemplate!=null||this.model.childGrid!=null?f+1:f,b(h.headerattributes[o],p[ot]),b(h.cellattributes[o],c[f]),d||b(h.filtercellattributes[o],y[f]),d||b(h.filterThattributes[o],n(y[f]).closest("th")[0]),o++;if(this.model.allowFiltering&&["menu","excel"].indexOf(this.model.filterSettings.filterType)!=-1){for(this._$fDlgIsOpen&&this._closeFDialog(),k=this.model.columns,p.find(".e-filtericon").remove(),f=0;f<k.length;f++)(k[f].allowFiltering||t.isNullOrUndefined(k[f].allowFiltering))&&(st=p.find(".e-headercelldiv[ej-mappingname="+k[f].field+"]").closest(".e-headercell"),st.append(t.buildTag("div.e-filtericon e-icon e-filterset")));this._refreshFilterIcon()}for(this.columnsWidthCollection.splice(u,0,this.columnsWidthCollection.splice(i,1)[0]),this._fieldColumnNames=this._headerColumnNames=[],e=0;e<s.length;e++)this._fieldColumnNames[s[e].headerText]=s[e].field,this._headerColumnNames[s[e].field]=s[e].headerText,a=n(c[e]),t.isNullOrUndefined(s[e].headerTemplateID)?s[e].type=="checkbox"?a.html("<input type = 'checkbox' class = 'e-checkselectall'><\/input>"):s[e].disableHtmlEncode?a.text(s[e].headerText):a.html(s[e].headerText):a.html(n(s[e].headerTemplateID).html()),this.model.groupSettings.showToggleButton&&(t.isNullOrUndefined(s[e].allowGrouping)||s[e].allowGrouping)&&(n.inArray(s[e].field,this.model.groupSettings.groupedColumns)!=-1?a.append(this._getToggleButton().addClass("e-toggleungroup")):a.append(this._getToggleButton().addClass("e-togglegroup")));if(this.model.allowGrouping&&this.model.allowSorting!=!0)for(f=0;f<this.model.sortSettings.sortedColumns.length;f++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[f].field,this.model.sortSettings.sortedColumns[f].direction);if(this.model.allowSorting)for(f=0;f<this.model.sortSettings.sortedColumns.length;f++){var g=1,v=this.model.sortSettings.sortedColumns[f],ct=this.getsortColumnByField(v.field),l=this.getColumnIndexByField(v.field),lt=n.inArray(ct,this.model.sortSettings.sortedColumns);if(imageDirection=v.direction!="descending"?"e-rarrowup-2x":"e-rarrowdown-2x",this.model.allowMultiSorting){for(o=1;o<=lt;o++)g=g+1;c.eq(l).css("text-align")=="right"?(this.model.sortSettings.sortedColumns.length>1&&c.eq(l).prepend(this._createSortNumber(g,c.eq(l)).addClass("e-sortnumber")),c.eq(l).append(this._createSortElement().addClass("e-"+(v.direction||"ascending")+" "+imageDirection))):(c.eq(l).append(this._createSortElement().addClass("e-"+(v.direction||"ascending")+" "+imageDirection)),this.model.sortSettings.sortedColumns.length>1&&c.eq(l).append(this._createSortNumber(g,c.eq(l)).addClass("e-sortnumber")))}else imageDirection=v.direction!="descending"?"e-rarrowup-2x":"e-rarrowdown-2x",c.eq(l).append(this._createSortElement().addClass("e-"+(v.direction||"ascending")+" "+imageDirection))}this.getHeaderTable().find(".e-fltrtempdiv").length>0&&(this.getHeaderTable().find(".e-filterbar").first().remove(),this._renderFiltering(),this._renderFilterBarTemplate());nt={};nt.requestType=t.Grid.Actions.Reorder;this._isReorder=!0;this.refreshTemplate();this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(nt),this._isAddNew=!1);this.setWidthToColumns();this.model.scrollSettings.frozenColumns||this.getHeaderContent().find("div").first().scrollLeft(ht);this.sendDataRenderingRequest(nt);this._isReorder=!1}},getPager:function(){return this._gridPager},getFooterTable:function(){return this._gridFooterTable},setGridFooterTable:function(n){this._gridFooterTable=n},getFooterContent:function(){return this._gridFooterContent},setGridFooterContent:function(n){this._gridFooterContent=n},getScrollObject:function(){return(this._scrollObject==null||t.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},setGridPager:function(n){this._gridPager=n},getRowHeight:function(){var r=-1,i,f,u,o;if(this.getContentTable()!=null)i=this.getContentTable().find("tr:not(.e-virtualrow)"),f=i.length>2?1:0,i.length&&(u=i[f].getBoundingClientRect()),i.length>1&&(r=u&&u.height?u.height:i[f].offsetHeight);else if(!t.isNullOrUndefined(this.model.rowTemplate)&&!t.isNullOrUndefined(this._dataSource())&&this._dataSource().length>0){var e=document.createElement("div"),s=n.templates(this.model.rowTemplate),h=this._dataSource()[0];e.innerHTML=['<table class="e-template-table">',s.render(h),"<\/table>"].join("");n("body").append(e.firstChild);o=n("body").find(".e-template-table").find("tr")[0];r=o.offsetHeight;n("body").find(".e-template-table").remove()}return r==-1?32:r},getCurrentIndex:function(){return(this._currentPage()-1)*this.model.pageSettings.pageSize},getColumnByIndex:function(n){return n<this.model.columns.length?this.model.columns[n]:null},set_currentPageIndex:function(n){var i=this.model.pageSettings,u=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r;return(i.totalPages==null&&(i.totalPages=Math.ceil(u/i.pageSize)),n>i.totalPages||n<1||n==this._currentPage())?!1:(t.isNullOrUndefined(this._prevPageNo)&&(this._prevPageNo=this._currentPage()),this._currentPage(n),this._currentPage()!=this._prevPageNo?(r={},r.requestType="paging",this.gotoPage(this._currentPage(),r),!0):!1)},set_currentVirtualIndex:function(n){var t,i;return n<1||n!=1&&n!=this._totalVirtualViews&&n==this._currentVirtualIndex&&this._checkCurrentVirtualView(this._virtualLoadedRows,n)?!1:(this._prevVirtualIndex=this._currentVirtualIndex,this._currentVirtualIndex=n,t=this._calculateCurrentViewPage(),t<=this.model.pageSettings.totalPages&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)?this._prevVirtualIndex<n&&n!=1?(i=this._isThumbScroll&&t!=1?t:t+1,!this._virtualPageRecords[i]&&i<=this.model.pageSettings.totalPages?this._setCurrentViewPage(i):this._renderVirtulViewContent(t)):this._prevVirtualIndex>n?(i=this._isThumbScroll?t:t-1,this._virtualPageRecords[i]&&!this._virtualLoadedRecords[n-1]&&(i=t-1),!this._virtualPageRecords[i]&&i>=1&&this._setCurrentViewPage(i)):this._renderVirtulViewContent(t):this._renderVirtulViewContent(t),!0)},_setCurrentViewPage:function(n){this._needPaging=!0;this._prevPageNo=this._currentPage();this.gotoPage(n)},_renderVirtulViewContent:function(){this._needPaging=!1;this._refreshVirtualView(this._currentVirtualIndex);this.element.ejWaitingPopup("hide")},_checkCurrentVirtualView:function(t,i){var f=this._virtualRowCount,u=i-1,r=i+1,e;if(t instanceof Array){if(t.length&&((u==0||r==this._totalVirtualViews+1)&&n.inArray(i,t)!=-1||n.inArray(u,t)!=-1&&n.inArray(i,t)!=-1&&n.inArray(r,t)!=-1))return!0}else if(e=r==this._totalVirtualViews?this._lastViewData:f,!this.initialRender&&i==1&&this._virtualLoadedRows[i]||i==this._totalVirtualViews&&t==this._virtualLoadedRows&&t[i]||u==0&&t[i]&&t[i].length==f||r==this._totalVirtualViews+1&&t[i]&&t[i].length==this._lastViewData||t[u]&&t[u].length==f&&t[i]&&t[i].length==f&&t[r]&&t[r].length==e)return!0;return!1},expandCollapse:function(i){var a,w,b,l,k,e,v,o,s,h,u;if(i.prop("tagName")=="DIV"&&(i.parent().hasClass("e-recordplusexpand")||i.parent().hasClass("e-recordpluscollapse")||i.parent().hasClass("e-detailrowcollapse")||i.parent().hasClass("e-detailrowexpand"))&&(i=i.parent()),a=-1,this.model.allowGrouping&&(t.isOnWebForms||this.initialRender))for(w=i.attr("ej-mappingname"),fieldValue=i.attr("ej-mappingvalue"),i.parents(".e-tabletd").length&&(b=i.parents(".e-tabletd").parent("tr").prev("tr").find(".e-recordplusexpand").attr("ej-mappingvalue")),l=this.model._groupingCollapsed,u=0;u<l.length;u++)if(l[u].key==w&&l[u].value==fieldValue&&(l[u].parent==r||l[u].parent==b)){a=u;break}if(i.hasClass("e-recordplusexpand")||i.hasClass("e-recordpluscollapse")||i.hasClass("e-detailrowcollapse")||i.hasClass("e-detailrowexpand")){if(i.hasClass("e-recordplusexpand")&&this.model.groupSettings.groupedColumns.length)k=i.index(),e=i.closest("tr").next(),e.hide(),i.removeClass("e-recordplusexpand").addClass("e-recordpluscollapse").find("div").removeClass("e-gdiagonalnext").addClass("e-gnextforward"),(t.isOnWebForms||this.initialRender)&&a==-1&&this.model._groupingCollapsed.push({key:w,value:fieldValue,parent:b});else if(i.hasClass("e-recordpluscollapse")&&this.model.groupSettings.groupedColumns.length){var k=i.index(),e=i.closest("tr").next(),o=[],s=e;for(n(s[0].cells[k]).hasClass("e-indentcell")&&s.children(".e-indentcell").length==i.parent().children(".e-indentcell").length+1&&(s.show(),h=s.children(".e-recordplusexpand"),h!=null&&h.length>0&&o.push(h)),i.removeClass("e-recordpluscollapse").addClass("e-recordplusexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"),u=0;u<o.length;u++)o[u].removeClass("e-recordplusexpand").addClass("e-recordpluscollapse").find("div").removeClass("e-gdiagonalnext").addClass("e-gnextforward"),this.expandCollapse(o[u]);(t.isOnWebForms||this.initialRender)&&a!=-1&&this.model._groupingCollapsed.splice(a,1)}else if(i.hasClass("e-detailrowexpand")){var k=i.index(),f=this,y=this.getIndexByRow(i.closest("tr")),e=i.closest("tr").next();e.hide(0,function(){var n={masterRow:i.closest("tr"),detailsRow:e,masterData:f._currentJsonData[y]},r=f._getForeignKeyData(n.masterData);t.isNullOrUndefined(r)||(n.foreignKeyData=r);f._trigger("detailsCollapse",n);f.model.childGrid!=null&&f.model.allowScrolling&&f._refreshScroller({requestType:"refresh"})});i.removeClass("e-detailrowexpand").addClass("e-detailrowcollapse").find("div").addClass("e-gnextforward").removeClass("e-gdiagonalnext")}else if(i.hasClass("e-detailrowcollapse")){var k=i.index(),f=this,y=this.getIndexByRow(i.closest("tr")),d=i.closest("tr").next();if(d.hasClass("e-detailrow"))e=d;else{var c=t.buildTag("tr.e-detailrow","",{display:"none"},{}),nt=t.buildTag("td.e-detailindentcell"),tt=this.model.groupSettings.showGroupedColumn?0:this.model.groupSettings.groupedColumns.length,g=t.buildTag("td.e-detailcell","",{},{colspan:this._visibleColumns.length-tt}),p=t.buildTag("div"),it=n(i.closest("tr")).parents(".e-grid").length;p.attr("id","child"+it+"_grid"+y+Math.round(Math.random()*1e3));n(c).append(nt);n(c).append(g);v=this._currentJsonData[y];this.model.detailsTemplate&&n(c).append(g.append(this._renderEjTemplate(this.model.detailsTemplate,v)));n(i.closest("tr")).after(c);this.model.childGrid&&(this.model.childGrid.parentDetails={parentID:this._id,parentPrimaryKeys:this.getPrimaryKeyFieldNames(),parentKeyField:this.model.childGrid.queryString,parentKeyFieldValue:v[this.model.childGrid.queryString],parentRowData:v},n(c).append(g.append(p)));e=c}for(this._showGridLines(),o=[],s=e,n(s[0].cells[k]).hasClass("e-detailindentcell")&&(s.show(0,function(){var n={masterRow:i.closest("tr"),detailsRow:e,masterData:f._currentJsonData[y]},r=f._getForeignKeyData(n.masterData);t.isNullOrUndefined(r)||(n.foreignKeyData=r);f._trigger("detailsExpand",n);f.model.childGrid!=null&&f.model.allowScrolling&&f._refreshScroller({requestType:"refresh"})}),d.hasClass("e-detailrow")||(this._trigger("detailsDataBound",{detailsElement:c,data:v}),this._trigger("refresh")),this.model.childGrid&&!t.isNullOrUndefined(p)&&p.ejGrid(this.model.childGrid),h=s.children(".e-detailrowexpand"),h!=null&&h.length>0&&o.push(h)),i.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").addClass("e-gdiagonalnext").removeClass("e-gnextforward"),u=0;u<o.length;u++)o[u].removeClass("e-detailrowexpand").addClass("e-detailrowcollapse").find("div").removeClass("e-gdiagonalnext").addClass("e-gnextforward"),this.expandCollapse(o[u])}!this.model.allowScrolling||t.isNullOrUndefined(this._scrollObject&&this._scrollObject.model)||i.closest(".e-hscroll").length||this.getScrollObject().refresh();this.model.isResponsive&&this.windowonresize()}},_refreshGridPager:function(){var i,n,r;this.getPager()!=null&&(i=this.getPager().ejPager("model"),n={},n.currentPage=this._currentPage(),this._filteredRecordsCount==0&&this.model.currentViewData.length==0&&(t.isNullOrUndefined(this._prevPageNo)||this._prevPageNo)?(n.currentPage=0,this._prevPageNo=i.currentPage,this.model.pageSettings.currentPage=0):i.currentPage==0&&(t.isNullOrUndefined(this._prevPageNo)||this._prevPageNo)&&(n.currentPage=this._prevPageNo),r=this.model.editSettings.showAddNewRow&&this.model.groupSettings.groupedColumns.length==0?1:0,n.totalRecordsCount=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount-r:this._searchCount:this._filteredRecordsCount,t.util.isNullOrUndefined(n.currentPage)&&(n.currentPage=this._currentPage()),this.getPager().ejPager("option",n).ejPager("refreshPager"),this.model.pageSettings.totalPages=i.totalPages||null,this.model.pageSettings.totalRecordsCount=i.totalRecordsCount||null)},_showHeaderColumn:function(i,r){for(var u,o,a,s,h=this.getHeaderTable().find("thead"),c=h.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),v=h.find(".e-filterbar").find(".e-filterbarcell"),e=this.getHeaderTable().find("colgroup").find("col"),l,f=0;f<i.length;f++)l=r?t.isNullOrUndefined(this.getColumnByField(i[f]))?this.getColumnByHeaderText(i[f],t.isNullOrUndefined(this.getColumnByField(i[f]))):this.getColumnByField(i[f]):this.getColumnByHeaderText(i[f]),u=n.inArray(l,this.model.columns),u=this.model.detailsTemplate!=null||this.model.childGrid?u+1:u,o=this.model.scrollSettings.frozenColumns,a=o!=0&&u>=o?c.eq(u).removeClass("e-hide").index()+o:c.eq(u).removeClass("e-hide").index(),v.eq(a).removeClass("e-hide"),e.length>this.model.columns.length&&this.model.groupSettings.groupedColumns.length&&(s=e.length-this.model.columns.length,e=e.slice(this.model.detailsTemplate||this.model.childGrid?s+1:s)),e.eq(u).css("display","");this.model.showStackedHeader&&this._refreshStackedHeader()},_hideHeaderColumn:function(i,r){for(var a,s=this.getHeaderTable().find("thead"),h=s.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),v=s.find(".e-filterbar").find(".e-filterbarcell"),f=this.getHeaderTable().find("colgroup").find("col"),c,u=0;u<i.length;u++){c=r?t.isNullOrUndefined(this.getColumnByField(i[u]))?this.getColumnByHeaderText(i[u],t.isNullOrUndefined(this.getColumnByField(i[u]))):this.getColumnByField(i[u]):this.getColumnByHeaderText(i[u]);var e=n.inArray(c,this.model.columns),l=this.model.detailsTemplate!=null||this.model.childGrid?e+1:e,o=this.model.scrollSettings.frozenColumns;a=o!=0&&e>=o?h.eq(l).addClass("e-hide").index()+o:h.eq(l).addClass("e-hide").index();v.eq(a).addClass("e-hide");f.length>this.model.columns.length&&(f=f.slice(f.length-this.model.columns.length));f.eq(e).css("display","none")}this.model.showStackedHeader&&(this._refreshStackedHeader(),this._colgroupRefresh())},_refreshStackedHeader:function(){var i,r,u,t;if(this.model.showStackedHeader){for(i=this.model.stackedHeaderRows,t=0;t<i.length;t++)if(this.model.scrollSettings.frozenColumns!=0){var f=n(this.getHeaderContent().find(".e-frozenheaderdiv")),e=n(this.getHeaderContent().find(".e-movableheader")),o=this._createStackedRow(i[t],!0),s=this._createStackedRow(i[t],!1);n(f.find("tr.e-stackedHeaderRow")[t]).replaceWith(o);n(e.find("tr.e-stackedHeaderRow")[t]).replaceWith(s)}else r=this._createStackedRow(i[t],!1),this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]?n(this.getHeaderTable().find("tr.e-stackedHeaderRow")[t]).replaceWith(r):r.insertBefore(this.getHeaderTable().find("tr.e-columnheader:last"));if(u={},u.requestType="refresh",this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0)for(t=0;t<this.model.groupSettings.groupedColumns.length;t++)this.getHeaderTable().find(".e-stackedHeaderRow").prepend(this._getGroupTopLeftCell());this.model.allowScrolling&&this._refreshScroller(u)}},_getStackedColumnByTarget:function(n){var r=(n.get(0)||{}).className,i=/e-row([0-9])-column([0-9])/.exec(r),u=i[1],f=i[2],e=[u,"stackedHeaderColumns",f].join(".");return t.getObject(e,this.model.stackedHeaderRows)},_checkSkipAction:function(n){switch(n.requestType){case t.Grid.Actions.Save:case t.Grid.Actions.Delete:return!0}return!1},_unboundTemplateRendering:function(t){return n("#"+t).html()},_processBindings:function(i){var r,f,e;if(this._requestType=i.requestType,this.model.query=this.commonQuery.clone(),!this._checkSkipAction(i)&&this._trigger("actionBegin",i))return!0;if(this.model.editSettings.editMode=="batch"&&i.requestType!="batchsave"&&i.requestType!="cancel"&&!this._confirmedValue&&this._bulkChangesAcquired()&&this.model.editSettings.showConfirmDialog)return this._confirmDialog.find(".e-content").html(this.localizedLabels.BatchSaveLostChanges),this._confirmDialog.ejDialog("open"),this._requestArgs=i,!1;if(!t.isNullOrUndefined(this.model.dataSource)&&i.requestType=="refresh"&&this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this._scrollValue=0,this._loadedJsonData=[],this._prevPage=this._currentPage()),this._ensureDataSource(i),this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="virtualscroll"?(this._loadedJsonData.push({pageIndex:this._prevPage,data:this._currentJsonData}),this._prevPage=this._currentPage()):this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=t.isNullOrUndefined(this._currentPageData)?this.model.currentViewData:this._currentPageData,this._currentPageData=null),i.requestType=="filtering"&&(this._loadedJsonData=[],this._prevPage=this._currentPage(),n("#"+this._id+"_externalEdit").remove()),(i.requestType==t.Grid.Actions.Delete||i.requestType==t.Grid.Actions.Add)&&this._refreshVirtualViewDetails()),this.model.scrollSettings.allowVirtualScrolling&&i.requestType=="filtering"&&this.model.filterSettings.filteredColumns.length>0&&this.getScrollObject().scrollY(0),this.model.enableRTL?this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"):this.element.hasClass("e-rtl")&&this.element.removeClass("e-rtl"),i.requestType==t.Grid.Actions.Delete&&this.model.groupSettings.groupedColumns.length==0&&(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").remove(),i.tr.remove()),this._editForm=this.model.scrollSettings.frozenColumns>0||this.model.editSettings.showAddNewRow?this.element.find(".gridform"):n("#"+this._id+"EditForm"),!(this.model.editSettings.showAddNewRow&&i.requestType=="beginedit")&&this._editForm.length!=0)for(r=0;r<this._editForm.length;r++)n(this._editForm[r]).find("select.e-dropdownlist").ejDropDownList("destroy"),n(this._editForm[r]).find(".e-datepicker").ejDatePicker("destroy"),n(this._editForm[r]).find(".e-datetimepicker").ejDateTimePicker("destroy"),n(this._editForm[r]).find(".e-numerictextbox").ejNumericTextbox("destroy");if(!(this._dataSource()instanceof t.DataManager)||this._isRemoteSaveAdaptor||i.requestType==t.Grid.Actions.BeginEdit||i.requestType==t.Grid.Actions.Cancel||i.requestType==t.Grid.Actions.Add||this._dataSource().adaptor instanceof t.SqlDataSourceAdaptor&&(i.requestType==t.Grid.Actions.Save||i.requestType==t.Grid.Actions.Delete))this._isRelationalRendering(i)?this._setForeignKeyData(i):this.sendDataRenderingRequest(i);else{this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage&&this.virtualLoadedPages.indexOf((this._prevPageNo-1)*this.model.pageSettings.pageSize)==-1&&(f=t.pvt.filterQueries(this.model.query.queries,"onPage"),this.model.query.queries.splice(n.inArray(f[0],this.model.query.queries),1),this.model.query.page(this._currentPage()-1,this.model.pageSettings.pageSize),e=this._dataSource().executeQuery(this.model.query),this.model.query.queries.splice(n.inArray(f[0],this.model.query.queries),1),this.model.query.page(this._currentPage(),this.model.pageSettings.pageSize));this._virtualSelectedRows&&this._virtualSelectedRows.length>0&&this.model.query.addParams("virtualSelectRecords",this._virtualSelectedRows);var o=this._queryPromise=this._dataSource().executeQuery(this.model.query),s=this.element.ejWaitingPopup("instance"),u=this;this.element.ejWaitingPopup("show");u._dataSource().ready?u._dataSource().ready.done(function(){u._processDataRequest(u,i,o,e)}):u._processDataRequest(u,i,o,e)}},_processDataRequest:function(n,i,r,u){r.done(t.proxy(function(r){var e,f,o;if(!t.isNullOrUndefined(n.element)){if(n._relationalColumns.length==0&&n.element.ejWaitingPopup("hide"),u&&!n._previousPageRendered)n._processLastPageData(n,i,r.result,u),n.model.previousViewData&&n.model.previousViewData.length!=0&&(n.model.previousViewData.splice(0,r.result.length),n._previousPageLength=r.result.length,n._currentPageData=r.result,t.merge(n.model.previousViewData,r.result),n.model.currentViewData=n.model.previousViewData,n._remoteLastPageRendered=!0);else if(n._remoteLastPageRendered&&n.model.pageSettings.currentPage==n.model.pageSettings.totalPages-1&&!n.model.scrollSettings.enableVirtualization){for(e=n.model.pageSettings.pageSize-n._previousPageLength,f=0;f<e;f++)o=n.getRows()[n.getRows().length-(n.model.pageSettings.pageSize-f)],o.remove();n._tempPageRendered=!0;n.model.currentViewData=r.result}else n._identityKeys.length&&i.action=="add"&&this.adaptor instanceof t.ODataAdaptor&&n._processIdentityField(r.result,i),n.model.pageSettings.currentPage!=n.model.pageSettings.totalPages-1||n._remoteLastPageRendered||(n._previousPageRendered=!0),n.model.currentViewData=r.result==null?[]:r.result,n._$fkColumn&&n.model.filterSettings.filterType=="excel"&&n.model.filterSettings.filteredColumns.length>0&&(n._fkParentTblData=r.result);n.model.allowScrolling&&n.model.scrollSettings.allowVirtualScrolling&&n.model.scrollSettings.enableVirtualization&&(i.requestType=="filtering"&&(n._gridRecordsCount=n._filteredRecordsCount=r.count,n._refreshVirtualViewDetails()),r.result.length?(n._isInitNextPage||n._isLastVirtualpage?(n._setInitialCurrentIndexRecords(r.result,n._currentPage()),n._isInitNextPage=n._isLastVirtualpage=!1):(n._gridRecordsCount=r.count,n._refreshVirtualViewDetails(),n._setVirtualLoadedRecords(r.result,n._currentPage())),n._isThumbScroll&&!n._checkCurrentVirtualView(n._virtualLoadedRecords,n._currentVirtualIndex)&&n._checkPrevNextViews(),n._remoteRefresh=!0):n.getContent().find(".e-virtualtop, .e-virtualbottom").remove());t.isNullOrUndefined(r.aggregates)||(n._remoteSummaryData=r.aggregates);n._processData(r,i);t.isNullOrUndefined(n._unboundRow)||i.selectedRow==n._unboundRow||i.requestType!="save"||(n._unboundRow.find(".e-editbutton").trigger("click"),n._unboundRow=null)}}));r.fail(t.proxy(function(r){t.isNullOrUndefined(n.element)||(n.element.ejWaitingPopup("hide"),i.error=r.error,r=[],n.model.currentViewData=[],n._processData(r,i),t.isNullOrUndefined(n.getPager())||n.getPager().ejPager({currentPage:0,totalRecordsCount:0}),n._trigger("actionFailure",i))}))},_processIdentityField:function(i,r){var u=this._primaryKeys[0],e=t.distinct(i,u),o=t.distinct(this.model.currentViewData,u),s=n.grep(e,function(t){return n.inArray(t,o)==-1?!0:!1}),f=t.DataManager(i).executeLocal((new t.Query).where(u,"equal",s))[0];r.data=t.isNullOrUndefined(f)?r.data:f},_processLastPageData:function(n,i,r,u){u.done(t.proxy(function(t){n.model.previousViewData=t.result}));u.fail(t.proxy(function(t){n.element.ejWaitingPopup("hide");i.error=t.error;t=[];n.model.previousViewData=[];n._processData(t,i);n._trigger("actionFailure",i)}))},_createUnboundElement:function(i,r){var o=document.createElement("div"),s,f,u,e;for(i.headerText=t.isNullOrUndefined(i.headerText)?i.field:i.headerText,t.isNullOrUndefined(i.headerText)||(o.id=this._id+i.headerText.replace(/[^a-z0-9|s_]/gi,"")+r+"_UnboundTemplate"),s=t.buildTag("div.e-unboundcelldiv"),f=i.commands,u=0;u<f.length;u++)e=t.buildTag("button.e-flat e-"+f[u].type.replace(/\s+/g,"")+"button","",{},{type:"button"}),e.val(f[u].type),(f[u].type=="save"||f[u].type=="edit")&&e.addClass("e-btnsub"),(f[u].type=="cancel"||f[u].type=="delete")&&e.addClass("e-btncan"),s.append(e);return n("body").append(n(o).html(s).hide()),o},_refreshUnboundTemplate:function(i){var h,e,s,u,r,f,o;if(this._isUnboundColumn)for(h=0,e=0;e<this.model.columns.length;e++)if(this.model.columns[e].commands)for(s=i.find(".e-unboundcell.e-"+this.model.columns[e].headerText.replace(/[^a-z0-9|s_]/gi,"")+e).find(".e-unboundcelldiv"),u=n.extend(!0,[],this.model.columns[e].commands),r=0;r<u.length;r++){for(t.isNullOrUndefined(u[r].buttonOptions)&&(u[r].buttonOptions={}),u[r].buttonOptions.width=t.isNullOrUndefined(u[r].buttonOptions.width)?"52":u[r].buttonOptions.width,u[r].buttonOptions.height=t.isNullOrUndefined(u[r].buttonOptions.height)?"28":u[r].buttonOptions.height,u[r].buttonOptions.cssClass=t.isNullOrUndefined(u[r].buttonOptions.cssClass)?this.model.cssClass:u[r].buttonOptions.cssClass,u[r].buttonOptions.enableRTL=this.model.enableRTL,f=s.find(".e-"+u[r].type.replace(/\s+/g,"")+"button"),this.model.isEdit&&this._requestType!="cancel"||(i.closest(".e-editcell").length?u[r].type=="save"||u[r].type=="cancel"?f.show():(f.hasClass("e-deletebutton")&&f.hide(),f.hasClass("e-editbutton")&&f.hide()):u[r].type=="save"||u[r].type=="cancel"?f.hide():(f.hasClass("e-deletebutton")&&f.show(),f.hasClass("e-editbutton")&&f.show())),o=0;o<f.length;o++)n(f[o]).data("ejButton")&&n(f[o]).ejButton("destroy");f.ejButton(u[r].buttonOptions)}else continue},_gridTemplate:function(n,t,i){var r=n.model.columns[i];return n.model.scrollSettings.enableVirtualization&&(this.index+=n._currentVirtualRowIndex),n._isGrouping&&(this.index=n._currentJsonData.indexOf(this.data)),n._renderEjTemplate("#"+t,this.data,this.index,r)},_createTemplateElement:function(i,r,u){var e=i["templateID"in i?"templateID":"template"],s=/^#([\w-]*)/.exec(e),r=r||n("body"),f,h=u?"Pager":i.headerText+n.inArray(i,this.model.columns)+"_Template",o={name:"SCRIPT",type:"text/x-template",text:e,id:(this._id+h).replace(/(\\|[^0-9A-z-_])/g,"")};return f=s&&s[1]?document.getElementById(s[1]):/^<script/i.test(e)?n(e).get(0):t.buildTag(o.name,o.text).get(0),f.id=f.id||o.id,f.type=f.type||o.type,r.append(u?f.innerHTML:f),f},_renderGridPager:function(){var i=n(document.createElement("div")),t={};return this.model.pageSettings.click=this._gPagerClickHandler,this.model.pageSettings.totalRecordsCount=this._gridRecordsCount||null,this.model.pageSettings.enableRTL=this.model.enableRTL,this.model.pageSettings.locale=this.model.locale,this.model.pageSettings.enableQueryString=this.model.pageSettings.enableQueryString,this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&(t.enableExternalMessage=this.model.filterSettings.showFilterBarStatus),n.extend(t,this.model.pageSettings),t.currentPage=this._currentPage(),t.masterObject=this,this.setGridPager(i),i.ejPager(t),i.ejPager("refreshPager"),t=i.ejPager("model"),this.model.pageSettings.totalPages=t.totalPages||null,this._currentPage()!==t.currentPage&&this._currentPage(t.currentPage),this._renderPagerTemplate(i),i},_renderPagerTemplate:function(n,i){var r=this.model.pageSettings,f=n.find(".e-pagercontainer").not(".e-template").length==0,u;n.find(".e-pagercontainer.e-template").remove();(i||!r.enableTemplates)&&f&&n.ejPager("renderPager");r.enableTemplates&&(r.showDefaults||n.children().remove(),u=t.buildTag("div",null,null,{"class":"e-pagercontainer e-template"}),this._createTemplateElement(this.model.pageSettings,u,!0),n.append(u))},_renderContext:function(){var y=this.model.contextMenuSettings.contextMenuItems,p,w,e=0,r=t.buildTag("ul","",{},{id:this._id+"_Context"}),i,l,s,a,k,v,h;if(!this.model.contextMenuSettings.disableDefaultItems)for(e;e<y.length;e++)p=y[e],w=this._items(p,"contextMenuItem"),r.append(w);var b=this.model.contextMenuSettings.customContextMenuItems,f=this.model.contextMenuSettings.subContextMenu,u,c,o=0;for(o;o<b.length;o++){for(u=b[o],c=this._items(u,"customContextMenuItem"),i=0;i<f.length;i++)if(typeof u=="string"&&u==f[i].contextMenuItem||typeof u=="object"&&u.id==f[i].contextMenuItem){for(l=t.buildTag("ul","",{},{id:this._id+"_subMenuContext"+i}),s=0;s<f[i].subMenu.length;s++)menuItem=f[i].subMenu[s],menuItem1=this._items(menuItem,"subMenuItems"),l.append(menuItem1);c.append(l)}r.append(c)}r.find("li").length>0&&(this.element.append(r),a=this.element.parents("div.e-grid"),k=t.Menu.prototype._showContextMenu,t.Menu.prototype._showContextMenu=function(t,i,r,u){n(this.model.contextMenuTarget).hasClass("e-grid")&&(++t,++i);k.apply(this,[t,i,r,u])},n(r).ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+this._id,click:n.proxy(this._clickevent,this),width:"auto",beforeOpen:n.proxy(this._menu,this)}),a.length&&(v=n("#"+a[0].id+"_Context"),h=v.ejMenu("model.excludeTarget"),v.ejMenu({excludeTarget:!t.isNullOrUndefined(h)&&h.length!=0?h.concat(",#"+this._id):"#"+this._id})),this._conmenu=r.data("ejMenu"))},_clickevent:function(i){var o=i.events.text,e=n(this._contexttarget.parentNode),r=n(this._contexttarget),u,f;if(r.hasClass("e-filterset")?r=r.siblings():(r.hasClass("e-icon")||r.hasClass("e-number"))&&(r=r.parent()),u=r.attr("ej-mappingname")||r.find(".e-headercelldiv").attr("ej-mappingname"),!this._trigger("contextClick",i))switch(o){case this.localizedLabels.AddRecord:this._startAdd();break;case this.localizedLabels.EditRecord:if(this.model.editSettings.editMode=="batch"){var s=n(this._contexttarget.parentNode).find(".e-rowcell").index(r),h=this._excludeDetailRows().index(e),c=this.model.columns[s].field;this.editCell(h,c)}else this.startEdit(e);break;case this.localizedLabels.DeleteRecord:this.model.editSettings.showDeleteConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open"):this.multiDeleteMode&&this.selectedRowsIndexes.length>1?this._multiRowDelete():this.deleteRow(e);break;case this.localizedLabels.Save:this.endEdit();break;case this.localizedLabels.Cancel:this.cancelEdit();break;case this.localizedLabels.SortInDescendingOrder:f=t.sortOrder.Descending;this.sortColumn(u,f);break;case this.localizedLabels.SortInAscendingOrder:f=t.sortOrder.Ascending;this.sortColumn(u,f);break;case this.localizedLabels.Grouping:this.groupColumn(u);break;case this.localizedLabels.Ungrouping:this.ungroupColumn(u);break;case this.localizedLabels.NextPage:case this.localizedLabels.PreviousPage:case this.localizedLabels.LastPage:case this.localizedLabels.FirstPage:this._page(i)}},_menu:function(i){var r=this._conmenu.element,u,d,p,o,g,tt,s,e,k,c,l,v,y,a,f;if(this._contexttarget=i.target,u=n(i.target),o=n(this._contexttarget),this.model.allowSelection&&(o.hasClass("e-rowcell")||o.closest(".e-rowcell").length)&&!u.hasClass("e-selectionbackground")&&(g=o.hasClass("e-rowcell")?o.parent():o.closest(".e-rowcell").parent(),this.model.isEdit||this.selectRows(this.getIndexByRow(g),null,o)),(u.hasClass("e-ascending")||u.hasClass("e-descending"))&&!u.parent().hasClass("e-headercelldiv"))return!1;d=u.hasClass("e-filtericon")||u.hasClass("e-headercelldiv")?i.target.parentNode.getAttribute("aria-sort"):u.hasClass("e-headercell")?i.target.getAttribute("aria-sort"):u.parent().parent().attr("aria-sort");tt=i.target.className;s=n(r);p=u.hasClass("e-filterset")?u.siblings().attr("ej-mappingname"):u.hasClass("e-icon")||u.hasClass("e-number")?u.parent().attr("ej-mappingname"):u.hasClass("e-headercell")?u.find(".e-headercelldiv").attr("ej-mappingname"):u.attr("ej-mappingname");r.css("visibility","visible");var nt=u.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0,w=u.closest(".e-rowcell"),b=u.closest(".e-headercell"),it=w.index()!=-1?w.index():b.index()-this.model.groupSettings.groupedColumns.length,h=u.hasClass("e-rowcell")?u.index()-nt:it-nt;h=this.model.detailsTemplate!=null||this.model.childGrid!=null?h-1:h;e=this.model.columns[h];k={allowGrouping:".e-contextgrouping",allowSorting:".e-contextascending, .e-contextdescending","editSettings.allowAdding":".e-contextadd","editSettings.allowEditing":".e-contextedit","editSettings.allowDeleting":".e-contextdelete"};for(c in k)l=r.find(k[c]).parent(),t.getObject(c,this.model)==!1||t.getObject(c,e)===!1?l.css("display","none"):l.css("display")=="none"&&l.css("display","block");if(u.closest(".e-grid").attr("id")!==this._id||u.is("input")){r.css("visibility","hidden");return}if(this.getHeaderTable().find(u).length>0){if(!(b.length!=0&&b.children().hasClass("e-headercelldiv"))){r.css("visibility","hidden");return}f=n(r.find(".e-head"));r.find(".e-page").css("display","none");r.find(".e-content").css("display","none");r.find(".e-savcan").css("display","none");f.css("display","block");(t.isNullOrUndefined(e.field)||e.field=="")&&(f.css("display","none"),r.find(".e-customitem").length==0&&r.css("visibility","hidden"));a={columnIndex:h,headerText:e.headerText};n.extend(i,a)}else if(this.getContentTable().find(u).length>0){if(v=this.getIndexByRow(n(i.target.parentElement)),y=this.model.editSettings.editMode=="batch"?this.getDataByIndex(v):this.getSelectedRecords(),w.length==0){r.css("visibility","hidden");return}f=n(r.find(".e-content"));r.find(".e-head").css("display","none");r.find(".e-page").css("display","none");r.find(".e-savcan").css("display","none");f.css("display","block");(t.isNullOrUndefined(e.field)||e.field=="")&&this.model.editSettings.editMode=="batch"&&(f.css("display","none"),r.find(".e-customitem").length==0&&r.css("visibility","hidden"));a=this.model.editSettings.editMode=="batch"?{columnIndex:h,rowIndex:v,rowData:y,headerText:e.headerText,cellValue:t.getObject(t.isNullOrUndefined(e.field)?"":e.field,y)}:{columnIndex:h,rowIndex:v,rowData:y,headerText:e.headerText};n.extend(i,a)}else if(this.getPager().find(u).length>0||u.hasClass("e-pager"))f=n(r.find(".e-page")),r.find(".e-head").css("display","none"),r.find(".e-content").css("display","none"),r.find(".e-savcan").css("display","none"),f.css("display","block");else return f=n(r),r.css("visibility","hidden"),!1;switch(d){case"ascending":s.find(".ascending").parent().css("display","none");break;case"descending":s.find(".descending").parent().css("display","none")}u.hasClass("e-rowcell")&&this.model.editSettings.showAddNewRow&&(f=n(r.find(".e-savcan")),r.find(".e-contextadd").parent().css("display","none"),f.css("display","block"));this.model.isEdit&&u.hasClass("e-rowcell")&&(!this.model.editSettings.showAddNewRow||n(".e-editedrow").length>0)&&(f=n(r.find(".e-savcan")),r.find(".e-head").css("display","none"),r.find(".e-content").css("display","none"),r.find(".e-page").css("display","none"),f.css("display","block"));this.model.pageSettings.totalPages==1&&f.hasClass("e-page")?r.find(".e-customitem").length==0?r.css("visibility","hidden"):r.find(".e-page").css("display","none"):this.model.pageSettings.currentPage==1?(s.find(".previous").parent().css("display","none"),s.find(".first").parent().css("display","none")):this.model.pageSettings.currentPage==this.model.pageSettings.totalPages&&(s.find(".last").parent().css("display","none"),s.find(".nextpage").parent().css("display","none"));this.model.groupSettings.groupedColumns.indexOf(p)!=-1?f.find(".group").parent().css("display","none"):this.model.groupSettings.groupedColumns.indexOf(p)==-1&&f.find(".ungroup").parent().css("display","none");this.model.contextOpen&&this._trigger("contextOpen",i)},_items:function(i,r){var f,u,e,o;return i==""?!1:(r=="contextMenuItem"&&(i.indexOf("Record")!=-1?(u=t.buildTag("li","",{},{"class":"e-content"}),u.css("display","none")):i.indexOf("Page")!=-1?(u=t.buildTag("li","",{},{"class":"e-page"}),i.indexOf("Next")!=-1?f=t.buildTag("div","",{},{"class":"nextpage"}):i.indexOf("Previous")!=-1?f=t.buildTag("div","",{},{"class":"previous"}):i.indexOf("Last")!=-1?f=t.buildTag("div","",{},{"class":"last"}):i.indexOf("First")!=-1&&(f=t.buildTag("div","",{},{"class":"first"})),u.css("display","none")):i=="Save"||i=="Cancel"?(u=t.buildTag("li","",{},{"class":"e-savcan"}),u.css("display","none")):(i.indexOf("Order")!=-1||i=="Grouping"||i=="Ungrouping")&&(u=t.buildTag("li","",{},{"class":"e-head"}),i.indexOf("Ascending")!=-1?f=t.buildTag("div","",{},{"class":"ascending"}):i.indexOf("Descending")!=-1?f=t.buildTag("div","",{},{"class":"descending"}):i=="Grouping"?f=t.buildTag("div","",{},{"class":"group"}):i=="Ungrouping"&&(f=t.buildTag("div","",{},{"class":"ungroup"})),u.css("display","none"))),t.isNullOrUndefined(u)&&(u=t.buildTag("li","",{},{"class":"e-customitem"}),u.css("display","block")),u.append(f),e=document.createElement("a"),o="",typeof i=="string"&&(o=i.indexOf("Ascending")!=-1?"ascending":i.indexOf("Descending")!=-1?"descending":i.split(" ")[0].toLowerCase(),e.innerHTML=t.isNullOrUndefined(this.localizedLabels[i.replace(/\s+/g,"")])?i:this.localizedLabels[i.replace(/\s+/g,"")]),typeof i=="object"&&(o=i.id=="Ascending"?"ascending":i.id=="Descending"?"descending":i.id.split(" ")[0].toLowerCase(),e.innerHTML=t.isNullOrUndefined(this.localizedLabels[i.text.replace(/\s+/g,"")])?i.text:this.localizedLabels[i.text.replace(/\s+/g,"")],u.attr("id",i.id)),n(e).append(t.buildTag("span","",{},{"class":"e-gridcontext e-icon e-context"+o})),u.append(e),u)},_page:function(n){var t;n.events.text==this.localizedLabels.NextPage?(t=this.model.pageSettings.currentPage,++t,this.gotoPage(t)):n.events.text==this.localizedLabels.PreviousPage?(t=this.model.pageSettings.currentPage,t>1?(--t,this.gotoPage(t)):this.gotoPage(t)):n.events.text==this.localizedLabels.LastPage?(t=this.model.pageSettings.totalPages,this.gotoPage(t)):this.gotoPage(1)},gotoPage:function(n){var i,r,u;(this.model.allowPaging||this.model.allowScrolling||this.model.scrollSettings.allowVirtualScrolling)&&(i={},i.previousPage=this._currentPage(),this._currentPage(n),i.endIndex=this._currentPage()*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:this._currentPage()*this.model.pageSettings.pageSize,i.startIndex=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=n,this.model.allowPaging&&(i.requestType=t.Grid.Actions.Paging),this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this._isVirtualRecordsLoaded=!1,u=this._refreshVirtualPagerInfo(),this._showPagerInformation(u),i.requestType=t.Grid.Actions.VirtualScroll),r=this._processBindings(i),r&&this._currentPage(i.previousPage),this._primaryKeyValues=[])},_gPagerClickHandler:function(n){if(this._prevPageNo!=n.currentPage)return this.model.masterObject.gotoPage(n.currentPage),!1},_processData:function(i,r){var u,f;if(this.initialRender)this._initDataProcessed=!0,this._initDataProcess(i,r);else{if(this._gridRecordsCount=i.count==0&&this.model.currentViewData.length?i.result.length:i.count,this.getPager()!=null&&(this.model.pageSettings.totalRecordsCount=this._gridRecordsCount),(r.requestType==t.Grid.Actions.Filtering||t.Grid.Actions.Save||this.model.filterSettings.filteredColumns.length>0&&r.requestType==t.Grid.Actions.Refresh)&&(this._filteredRecordsCount=i.count),this.model.allowScrolling&&this.model.scrollSettings.enableVirtualization)for(this.model.currentViewData=[],u=0;u<this._currentLoadedIndexes.length;u++)f=this._currentLoadedIndexes[u],n.merge(this.model.currentViewData,this._virtualLoadedRecords[f]||[]);this._setForeignKeyData(r);this._relationalColumns.length==0&&this.sendDataRenderingRequest(r)}},_frozenCell:function(t,i){var r=i,u=0,f=this.getRowByIndex(t);return i>=this.model.scrollSettings.frozenColumns&&(u=1,r=r-this.model.scrollSettings.frozenColumns),n(f.eq(u).find(".e-rowcell:eq("+r+")"))},_frozenColumnSelection:function(t,i,r){var e=i,f=0,o,u;if(r)for(u=i;u<r;u++){for(e=u,u>=this.model.scrollSettings.frozenColumns&&(f=1,e=u-this.model.scrollSettings.frozenColumns),o=0;o<t[f].length;o++)n(t[f][o].cells[e]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell")[u]).addClass("e-columnselection");this.selectedColumnIndexes.push(u)}else for(i>=this.model.scrollSettings.frozenColumns&&(f=1,e=i-this.model.scrollSettings.frozenColumns),u=0;u<t[f].length;u++)n(t[f][u].cells[e]).addClass("e-columnselection")},_renderGridFooter:function(){var i,n;if(this.model.summaryRows.length>0){if(i=t.buildTag("div.e-gridfooter"),n=t.buildTag("table.e-gridsummary","",{},{cellspacing:"0.25px"}),this.setGridFooterContent(i),this.model.scrollSettings.frozenColumns>0){var u=t.buildTag("div.e-frozenfooterdiv"),f=t.buildTag("div.e-movablefooter"),r=n.clone(),e=t.buildTag("div.e-movablefooterdiv");f.append(e);n.append(this.getHeaderTable().first().find("colgroup").clone());r.append(this.getHeaderTable().last().find("colgroup").clone());u.append(n);e.append(r);this.setGridFooterTable(n.add(r));this._createSummaryRows(this.getFooterTable());i.append(u.add(f));i.find(".e-frozenfooterdiv").outerWidth(this.getHeaderContent().find(".e-frozenheaderdiv").width()).end().find(".e-movablefooterdiv").outerWidth(this.getContent().find(".e-movablecontentdiv").width())}else n.append(this.getHeaderTable().find("colgroup").clone()),this.setGridFooterTable(n),this._createSummaryRows(this.getFooterTable()),i.append(n);return i}throw"summary row collection is missing";},_setSummaryAggregate:function(n){for(var t,f,u=this.model.summaryRows,i,r=0,e=u.length;r<e;r++)for(i=u[r].summaryColumns,t=0,f=i.length;t<f;t++)n.aggregate(i[t].summaryType,i[t].dataMember)},_createSummaryRows:function(i,r,u,f,e){var l=i.find("col");i.find("tbody").length>0&&i.find("tbody").remove();var s=t.buildTag("tbody"),o=this,h=s.clone(),c=this.model.summaryRows;!t.isNullOrUndefined(r)&&this._isCaptionSummary&&(c=this._captionSummary(e));n.each(c,function(c,a){var y,k,w,d,tt,p;if(a.showTotalSummary===!1&&t.isNullOrUndefined(r)||a.showGroupSummary===!1&&e&&!t.isNullOrUndefined(r))return!0;if(y=t.buildTag("tr.e-gridSummaryRows"),t.isNullOrUndefined(f&&f.level))for(p=0;p<o.model.groupSettings.groupedColumns.length;p++)y.prepend(t.buildTag("td").addClass("e-indentcell"));k=e?" e-gcsummary":"";(o.model.detailsTemplate!=null||o.model.childGrid!=null)&&(o.model.groupSettings.groupedColumns.length!=0?y.children("td.e-indentcell").last().after("<td class='e-summaryrow"+k+"'><\/td>"):y.prepend("<td class='e-summaryrow'><\/td>"));var v=o.getHeaderTable().find("td").clone().addClass("e-summaryrow"+k+""),w=0;if(t.isNullOrUndefined(a.titleColumn)||(w=o.getColumnIndexByField(a.titleColumn),w==-1&&(w=o.getColumnIndexByHeaderText(a.titleColumn))),w!=-1&&(v=o._assignTitleColumn(w,a.title,v,0)),o._hideSummaryColumn(v,l),o.model.scrollSettings.frozenColumns>0)d=y.clone(),s.append(y.append(v.slice(0,o.model.scrollSettings.frozenColumns))),h.append(d.append(v.slice(o.model.scrollSettings.frozenColumns)));else if(o._isCaptionSummary&&!e||t.isNullOrUndefined(f&&f.level))s.append(y.append(v));else{var g=o.model.groupSettings.groupedColumns.length-f.level+1,b=i.clone().addClass("e-groupsummary"),nt={};for(nt.data={items:f},y.prepend("<td class='e-summaryrow"+k+"' colspan="+o._colSpanAdjust(null,null,nt)+" style = 'padding:0;' ><\/td>"),n(y[0].cells).filter(".e-summaryrow").html(b.append(t.buildTag("tr",v))),tt=b.find("col").length-(o.model.columns.length+g),(o.model.detailsTemplate!=null||o.model.childGrid!=null)&&y.find("tr").prepend("<td class='e-summaryrow'><\/td>"),p=0;p<tt;p++)b.find("col").first().remove();for(p=0;p<g;p++)n(b[0].rows).prepend("<td class='e-indentcell'><\/td>"),n(b.find("col")[p]).addClass("e-summary");s.append(y)}n.each(a.summaryColumns,function(i,f){var s,e,h,c;s=f.summaryType!="custom"?u?u[f.dataMember+" - "+f.summaryType]:o._remoteSummaryData[f.dataMember+" - "+f.summaryType]:o.getSummaryValues(f,r);prefix=f.prefix?f.prefix:"";e=o.getColumnIndexByField(f.displayColumn);h=f.suffix?f.suffix:"";o.model.allowScrolling&&n(v[e]).addClass("e-scroller");n(v[e]).html()!=""&&prefix==""&&(prefix=n(v[e]).html());t.isNullOrUndefined(f.template)?e!=-1&&n(v[e]).html(prefix+(f.format?o.formatting(f.format,s,o.model.locale):s)+h).css("text-align",o.model.columns[e].textAlign):(c={summaryValue:f.format?o.formatting(f.format,s,o.model.locale):s,summaryColumn:f},n(v[e]).html(n.render[o._id+"_summaryTemplate"+f.template](c)).css("text-align",o.model.columns[e].textAlign),n(v[e]).addClass("e-summarytemplate"))})});this.model.scrollSettings.frozenColumns>0?(i.first().append(s),i.last().append(h)):i.append(s)},_assignTitleColumn:function(n,t,i,r){for(var f,u=n;u<this.model.columns.length;u++)if(f=this.model.columns[u],r==0&&f.visible!=!1){i.eq(u).html(t);break}return i},getSummaryValues:function(i,r){var f,u,o,s,h,e;u=t.isNullOrUndefined(r)?this.model.filterSettings.filteredColumns.length>0?this._filteredRecords:this._dataSource():r;u instanceof t.DataManager?(o=u,u=u.dataSource.json):o=t.DataManager(u);switch(i.summaryType){case t.Grid.SummaryType.Maximum:s=t.max(u,i.dataMember);f=t.getObject(i.dataMember,s);break;case t.Grid.SummaryType.Minimum:s=t.min(u,i.dataMember);f=t.getObject(i.dataMember,s);break;case t.Grid.SummaryType.Average:f=t.avg(u,i.dataMember);break;case t.Grid.SummaryType.Sum:f=t.sum(u,i.dataMember);break;case t.Grid.SummaryType.Count:f=u.length;break;case t.Grid.SummaryType.TrueCount:h=t.Predicate(i.dataMember,"equal",!0);f=o.executeLocal(t.Query().where(h)).length;break;case t.Grid.SummaryType.FalseCount:h=t.Predicate(i.dataMember,"equal",!1);f=o.executeLocal(t.Query().where(h)).length;break;case t.Grid.SummaryType.Custom:e=i.customSummaryValue;e&&(typeof e=="string"&&(e=t.util.getObject(e,window)),n.isFunction(e)&&(f=e.call(this,i,u)))}return f},_hideCaptionSummaryColumn:function(){var f=this.getHeaderTable().find(".e-headercelldiv[ej-mappingname]").first(),e=this.getContentTable().find(".e-groupcaption").clone(),t=this.getContentTable().find(".e-groupcaption").parent(),o=this.model.columns.length-1,r,n,u;if(this._isCaptionSummary&&(this.getContentTable().find(".e-summaryrow:not(.e-gcsummary)").remove(),this.getFooterTable().find("tbody td").slice(-o).removeClass("e-groupcaptionsummary").addClass("e-summaryrow"),this.getFooterTable()!=null&&this.getContentTable().find(".e-recordplusexpand").parent().children(".e-indentcell").remove(),!this.model.groupSettings.showGroupedColumn&&this.getContentTable().find(".e-groupcaptionsummary").not(".e-hide").length&&(r=+this.getContentTable().find(".e-recordtable:first").parents("tbody:first").find(".e-groupcaption").attr("colspan"),this._hiddenColumnsField.length==this.model.columns.length-1&&f.parent().hasClass("e-hide")||!r)))for(i=0;i<e.length;i++)t.eq(i).children().not(".e-hide,.e-recordplusexpand").filter("td.e-groupcaptionsummary:first").addClass("e-hide"),n=t.eq(i).find(".e-groupcaption"),u=parseInt(n.attr("colspan")),n.attr("colspan",++u);this.getContentTable().find(".e-recordtable").find(".e-indentcell").remove()},_hideSummaryColumn:function(t,r){if(r.length>this.model.columns.length&&(r=r.slice(r.length-this.model.columns.length)),!this.model.groupSettings.showGroupedColumn&&this.model.showSummary)for(i=0;i<this.model.columns.length;i++)for(j=0;j<this.model.groupSettings.groupedColumns.length||j<this._hiddenColumnsField.length;j++){var u=this.getHeaderTable().find(".e-headercelldiv:not(.e-emptyCell)");if(u.eq(i).is(":visible"))r.eq(i).css("display")=="none"&&r.eq(i).css("display","");else{r.eq(i).css("display","none");n(t[i]).addClass("e-hide");break}}else for(i=0;i<this.model.columns.length;i++)this.model.columns[i].visible?r.eq(i).css("display")=="none"&&r.eq(i).css("display",""):(r.eq(i).css("display","none"),n(t[i]).addClass("e-hide"))},_initScrolling:function(){var r=[],f=[],e=0,i,u;for(this.model.scrollSettings.enableVirtualization&&(this.model.scrollSettings.allowVirtualScrolling=!0),i=0;i<this.model.columns.length;i++)this.model.columns[i].visible===!1&&i<this.model.scrollSettings.frozenColumns&&e++,this.model.columns[i].isFrozen===!0?r.push(this.model.columns[i]):f.push(this.model.columns[i]);if(r.length>0&&(u=this.model.scrollSettings.frozenColumns,this.model.columns=n.merge(n.merge([],r),f),this.model.scrollSettings.frozenColumns=r.length,r.length!=u&&u!=0&&(this.model.scrollSettings.frozenColumns=u)),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&(this.model.allowGrouping||this.model.rowTemplate!=null||this.model.detailsTemplate!=null||this.model.childGrid!=null||this.model.scrollSettings.allowVirtualScrolling||this.model.editSettings.editMode=="batch")){this._renderAlertDialog();this._alertDialog.find(".e-content").text(this._getLocalizedLabels().FrozenNotSupportedException);this._alertDialog.ejDialog("open");return}this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this.model.scrollSettings.enableVirtualization?(this._vRowHeight=Math.floor(this.getRowHeight()+1),this._virtualRowCount=Math.round(this.model.scrollSettings.height/this._vRowHeight)+1,this.model.pageSettings.pageSize<this._virtualRowCount*5&&(this.model.pageSettings.pageSize=this._virtualRowCount*5)):(this.model.pageSettings.pageSize=this.model.pageSettings.pageSize==12?Math.round(this.model.scrollSettings.height/32)+1:this.model.pageSettings.pageSize,this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize)));(this.model.width||this.model.height)&&(this.model.allowScrolling=!0,this.model.width&&(this.model.scrollSettings.width=this.model.width),this.model.height&&(this.model.scrollSettings.height=this.model.height));this._originalScrollWidth=t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)?this.model.scrollSettings.width:this.model.scrollSettings.previousStateWidth},_checkScrollActions:function(n){return!this.model.scrollSettings.allowVirtualScrolling&&(n==t.Grid.Actions.Sorting||n==t.Grid.Actions.Reorder)||n==t.Grid.Actions.Grouping||n==t.Grid.Actions.Ungrouping||n==t.Grid.Actions.Add||n==t.Grid.Actions.Cancel||n==t.Grid.Actions.Save||n==t.Grid.Actions.BatchSave||n==t.Grid.Actions.Delete||n==t.Grid.Actions.Filtering||n==t.Grid.Actions.Paging||n==t.Grid.Actions.Refresh||n==t.Grid.Actions.Search?!0:!1},_frozenAlign:function(){var r=this.getContent().first(),n=!t.isIOSWebView()&&this.getBrowserDetails(),i;i=this.model.enableRTL?"margin-right":"margin-left";r.find(".e-movablecontent").css(i,n&&n.browser==="safari"?"auto":r.find(".e-frozencontentdiv").width()+"px");this.getHeaderContent().find(".e-movableheader").removeAttr("style").css(i,n&&n.browser==="safari"?"auto":this.getHeaderContent().find(".e-frozenheaderdiv").width()+"px")},_refreshScroller:function(i){var r=this.getContent().first(),o,f,s,u,h,e,c,l;if(!t.isNullOrUndefined(r.data("ejScroller"))){if(this.model.scrollSettings.frozenColumns>0){if(this._isFrozenColumnVisible())if(this._visibleColumns.length<=this.model.scrollSettings.frozenColumns){for(o=!1,f=this.model.scrollSettings.frozenColumns;f<this.model.columns.length;f++)if(this._visibleColumns.indexOf(this.model.columns[f].headerText)!=-1){o=!0;break}o||(r.find(".e-frozencontentdiv").removeAttr("style"),this.getHeaderContent().find(".e-frozenheaderdiv").removeAttr("style"),r.find(".e-movablecontent").width(0),r.find(".e-movablecontentdiv").width(0),r.find(".e-movablecontent").height(0),r.find(".e-movablecontentdiv").height(0))}else this._frozenAlign(),r.find(".e-movablecontent").scrollLeft(this.getHeaderContent().find(".e-movableheader").scrollLeft()),!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&this.getScrollObject()._vScrollbar.value()>this.getScrollObject()._vScrollbar.model.maximum&&(u=this.getScrollObject()._vScrollbar.model.maximum);else r.find(".e-movablecontentdiv").removeAttr("style"),this.getHeaderContent().find(".e-movableheaderdiv").removeAttr("style"),r.find(".e-frozencontent").width(0),r.find(".e-frozencontentdiv").width(0),r.find(".e-frozencontent").height(0),r.find("e-frozencontentdiv").height(0);this.refreshScrollerEvent()}if(this.model.scrollSettings.frozenRows>0){for(this._initFrozenRows(),f=0;f<this.getRows().length;f++)n(this.getRows()[f]).filter(":hidden").css("display","table-row");!this.initialRender&&t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&this.element.height()>this.model.scrollSettings.height&&this.getContent().attr("tabindex","0").ejScroller(this.model.scrollSettings);u=this.getScrollObject().model.scrollTop;s=this.getScrollObject().model.scrollLeft;!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&u>this.getScrollObject()._vScrollbar.model.maximum&&(u=this.getScrollObject()._vScrollbar.model.maximum);(i.requestType=="cancel"||i.requestType=="save")&&u>this._editFormHeight&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&(u=u-this._editFormHeight);i.requestType==t.Grid.Actions.Add&&this.getScrollObject().scrollY(0,!0);t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)}(i.requestType=="beginedit"||i.requestType=="save")&&(u=this.getScrollObject().model.scrollTop,this.getScrollObject().scrollY(0,!0));!t.isNullOrUndefined(this.model.dataSource)&&(i.requestType=="refresh"||i.requestType=="searching")&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData&&this._gridRecordsCount>0?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(1),this._currentVirtualIndex==1&&this.getScrollObject().scrollY(0));this.model.scrollSettings.frozenColumns>0&&this.rowHeightRefresh();this.getScrollObject().refresh();r.ejScroller("model.enableRTL",this.model.enableRTL);this.model.isResponsive&&(i.requestType=="searching"||i.requestType=="filtering")&&(h=this.getScrollObject(),e=h.isHScroll()?this.getContentTable().height()+h.model.buttonSize:this.getContentTable().height(),e=typeof this.model.scrollSettings.height=="string"||e>this.model.scrollSettings.height?this.model.scrollSettings.height:e,c=typeof this.model.scrollSettings.width=="string"?this.element.width():this.model.scrollSettings.width,width=c,this.getContent().ejScroller({height:e,width:width}));this.getScrollObject().isVScroll()&&!this.getScrollObject().model.autoHide?(this.getHeaderContent().addClass("e-scrollcss"),this.getHeaderTable().first().width(this.getContentTable().width()),this.getHeaderContent().find(".e-headercontent").hasClass("e-hscrollcss")||this.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):this._showHideScroller();!this.model.allowPaging||this.getScrollObject().isVScroll()||this.getScrollObject().isHScroll()||this.getContentTable().width()==this.getContent().width()||(this.getContentTable().width(this.getContent().width()),this.getHeaderTable().width(this.getContentTable().width()));this._getRowHeights();u&&!t.isNullOrUndefined(this.getScrollObject()._vScrollbar)&&i.requestType!=t.Grid.Actions.Add&&(this._currentTopFrozenRow=0,u>this.getScrollObject()._vScrollbar.model.maximum&&(u=this.getScrollObject()._vScrollbar.model.maximum),this.getScrollObject()._vScrollbar.scroll(u));s&&this.model.scrollSettings.frozenColumns>0&&i.requestType==t.Grid.Actions.BeginEdit&&this.getScrollObject()._hScrollbar.scroll(s);i.requestType=="virtualscroll"&&(l=this.getScrollObject().model.scrollTop+this.getScrollObject().model.height-this.getScrollObject().model.height*.3,this.getScrollObject().scrollY(l,!0))}},_isFrozenColumnVisible:function(){for(var n=0;n<this.model.scrollSettings.frozenColumns;n++)if(this.model.columns[n].visible)return!0;return!1},_frozenPaneRefresh:function(){this.getContent().find(".e-frozencontentdiv").css("display","none");this.getHeaderContent().find(".e-frozenheaderdiv").css("display","none");this.getHeaderContent().find(".e-movableheader")[0].style["margin-left"]="";this.getContent().find(".e-movablecontent")[0].style["margin-left"]="";var i=t.isNullOrUndefined(this._scrollObject._vScrollbar)?0:this._scrollObject._vScrollbar["e-vscroll"].width(),n=this.model.scrollSettings.width-i-1;this.model.scrollSettings.width>this.getContent().find(".e-movablecontentdiv").width()&&(this.getContent().find(".e-movablecontentdiv").width(n),this.getHeaderContent().find(".e-movableheaderdiv").width(n));this._scrollObject.option("scrollLeft",0)},_renderScroller:function(){var s,r,u,o,f,l,e,i,h,c;if(this.model.scrollSettings||(this.model.scrollSettings={}),this.model.enablePersistence&&(t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)||!this.model.scrollSettings.previousStateWidth)&&this.model.isResponsive&&(this.model.scrollSettings.previousStateWidth=this.model.scrollSettings.width),typeof this._originalScrollWidth!="string"||this.model.isResponsive||(this.element.css("width","auto"),r=this.element.width(),(this.model.scrollSettings.width=="auto"||this._originalScrollWidth=="auto")&&(this._originalScrollWidth="100%"),this.model.scrollSettings.width=r*(parseFloat(this._originalScrollWidth)/100)),typeof this.model.scrollSettings.height!="string"||this.model.isResponsive||(s=this.element.height(),this.model.scrollSettings.height=="auto"&&(this.model.scrollSettings.height="100%"),this.model.scrollSettings.height=s*(parseFloat(this.model.scrollSettings.height)/100)),(this.model.scrollSettings.width||this.model.width)&&!this._mediaQuery&&(r=this.model.scrollSettings.width||this.model.width,typeof r=="string"?this.element.css("width",this.model.scrollSettings.width||this.model.width):this.element.width(this.model.scrollSettings.width||this.model.width)),u=this.getContent().attr("tabindex","0"),l=this.getRows(),this.model.scrollSettings.frozenColumns>0){for(e=0;e<this.getRows().length;e++)n(this.getRows()[e]).filter(":hidden").css("display","table-row");if(scrollWidth=this.getContent().find(".e-frozencontentdiv").width()+20,scrollWidth>this.model.scrollSettings.width){this.getContent().remove();this.getHeaderTable().eq(1).remove();this._alertDialog.find(".e-content").text(this.localizedLabels.FrozenColumnsViewAlert);this._alertDialog.ejDialog("open");return}o=this.getContent().find(".e-frozencontentdiv").width();f=this.model.enableRTL?"margin-right":"margin-left";this.getContent().find(".e-movablecontent").css(f,o+"px");this.getHeaderContent().find(".e-movableheader").css(f,o+"px");this.model.scrollSettings.targetPane=".e-movablecontent"}this._initFrozenRows();this.model.scrollSettings.autoHide&&(this.model.scrollSettings.show=n.proxy(this._showHideScroller,this));i=this;this.model.scrollSettings.frozenRows||(this.model.scrollSettings.scroll=function(n){t.isNullOrUndefined(n.scrollData)||n.scrollData.handler!="e-hhandle"?(i._scrollValue=n.scrollTop,i.model.currentIndex=n.scrollTop==0?n.scrollTop:Math.floor(n.scrollTop/i._vRowHeight)):(i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),i._checkScroller(n,this))});!this.model.scrollSettings.allowVirtualScrolling&&this.model.currentIndex>0&&!this.model.scrollSettings.scrollTop&&(h=this.model.currentIndex*this.getRowHeight(),this.model.scrollSettings.scrollTop=h);u.ejScroller(this.model.scrollSettings);this.model.allowRowDragAndDrop&&this.model.allowScrolling&&t.gridFeatures.dragAndDrop&&u.ejScroller({thumbStart:function(){return!1}});this.model.rowTemplate==null||t.isIOSWebView()||this.getBrowserDetails().browser!="msie"&&this.getBrowserDetails().browser!="safari"||this.getScrollObject().refresh();this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenRows==0&&this.getScrollObject()._vScrollbar&&this.getScrollObject()._hScrollbar&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=this.getScrollObject()._hScrollbar._scrollData.skipChange=!0);this.model.scrollSettings.autoHide||this._showHideScroller();!t.isIOSWebView()&&this.getBrowserDetails().browser=="safari"&&this.model.scrollSettings.frozenColumns>0&&this.getHeaderContent().find(".e-movableheader").add(this.getContent().find(".e-movablecontent")).css(f,"auto");this.refreshScrollerEvent();this.model.scrollSettings.frozenColumns>0&&!this._isFrozenColumnVisible()&&this._frozenPaneRefresh();i.model.scrollSettings.allowVirtualScrolling&&(c=this._refreshVirtualPagerInfo(),this._showPagerInformation(c),u.ejScroller({scroll:function(r){if(i.model.scrollSettings.enableVirtualization&&r.scrollData!=null&&r.scrollData.handler!="e-hhandle"){if(r.reachedEnd=r.scrollData.scrollable-r.scrollTop==0,r.source=="thumb"){var f=t._getObjectKeys(i._virtualLoadedRows),u=(i._currentVirtualIndex+2).toString();i.model.scrollSettings.virtualScrollMode=="continuous"&&n.inArray(u,f)==-1&&u<i._totalVirtualViews?i._isContinuous=!0:(r.model.scrollTop=r.scrollTop,i._isContinuous=!1,r.cancel=!0)}(r.source=="button"||r.source=="key"||r.source=="wheel")&&(n("#"+i._id+"_WaitingPopup").is(":visible")?r.cancel=!0:(i._isThumbScroll=!1,i._virtualViewScroll(r)),i.model.scrollSettings.virtualScrollMode=="continuous"&&r.reachedEnd&&this.refresh());i.model.currentIndex=r.scrollTop==0?r.scrollTop:Math.floor(r.scrollTop/i._vRowHeight)}else!t.isNullOrUndefined(r.scrollData)&&r.scrollData.handler=="e-hhandle"&&i.model.allowFiltering&&(i.model.filterSettings.filterType=="menu"||i._isExcelFilter)&&(i._isExcelFilter?i._excelFilter.closeXFDialog():i._closeFilterDlg()),r.reachedEnd=this.content()[0].scrollHeight-r.scrollTop==this.content()[0].clientHeight,(r.source=="button"||r.source=="key"||r.source=="wheel")&&i.model!=null&&i._virtualScroll(r),r.source=="wheel"&&r.scrollTop!=i._scrollValue&&(r.scrollTop=i._scrollValue),i._checkScroller(r,this)},thumbEnd:function(t){(i.model.scrollSettings.enableVirtualization&&i.model.scrollSettings.virtualScrollMode=="continuous"?t.reachedEnd=t.scrollData.scrollable-t.model.scrollTop==0:t.originalEvent&&!n(t.originalEvent.target).hasClass("e-rowcell")&&(t.reachedEnd=this.content()[0].scrollHeight-t.scrollData.sTop==this.content()[0].clientHeight),t.scrollData.handler!="e-hhandle")&&i.model!=null&&t.originalEvent&&(i.model.scrollSettings.enableVirtualization?(i._isThumbScroll=!0,i._virtualViewScroll(t),i.model.scrollSettings.virtualScrollMode=="continuous"&&t.reachedEnd&&this.refresh(),i._isLocalData&&i.element.ejWaitingPopup("hide")):i._virtualScroll(t))},scrollEnd:function(t){if(t.scrollData.type!="mousewheel"&&(t.scrollData.model==null||t.scrollData.model.orientation!="horizontal")&&i.model.scrollSettings.enableVirtualization&&!i._isContinuous){var u=i._calculateCurrentViewPage(t.model),r=n.inArray(u,i._virtualLoadedPages)!=-1;r?(i._isThumbScroll=!0,i._virtualViewScroll(t),i.element.ejWaitingPopup("hide"),i._totalVirtualViews<=i._maxViews*3&&(this._content[0].scrollTop=t.scrollData.scrollTop)):(r||i.element.ejWaitingPopup("show"),t.cancel=!0)}}}))},_checkScroller:function(n,t){var i=n.scrollLeft>0?n.scrollLeft:Math.abs(n.scrollLeft),r;n.source=="thumb"&&(t.content()[0].scrollWidth-i==t.content()[0].clientWidth||i==0)&&(this.model.enableRTL&&(r=i==0?n.scrollData.scrollable:0,n.scrollData.sTop=n.model.scrollLeft=r,t.content().scrollLeft(r)),t._hScrollbar.refresh())},_showHideScroller:function(){this.getScrollObject().isVScroll()?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this.model.scrollSettings.autoHide||this.getHeaderContent().addClass("e-scrollcss")):this.element.find(".e-gridheader").removeClass("e-scrollcss");this.model.scrollSettings.frozenColumns!=0||this._mediaQuery||(!this.element.find(".e-gridheader").hasClass("e-scrollcss")&&(this.model.filterSettings.filteredColumns.length||this._hiddenColumns.length&&!this.model.minWidth)?(this.getHeaderTable().removeAttr("style"),this.getContentTable().removeAttr("style")):(this.getHeaderContent().find("div table").first().width(this.getContentTable().width()),this.getContent().find("div table").first().width(this.getContentTable().width()),this.getHeaderTable().width(this.getContentTable().width())));this._isHscrollcss()},_isHscrollcss:function(){var n=this.getContent().data("ejScroller"),t=n&&(n.isHScroll()||n.isVScroll())?"addClass":"removeClass";this.getHeaderContent().find(".e-headercontent")[t]("e-hscrollcss")},_initFrozenRows:function(){var i=this.getRows(),r;this.model.currentViewData&&this.model.currentViewData.length!=0&&(this.model.scrollSettings.frozenRows>0&&i!=null?(this.model.scrollSettings.scroll=n.proxy(this._scroll,this),this.getContent().find(".e-frozeny").removeClass("e-frozeny").end().find(".e-frozenrow").removeClass("e-frozenrow"),!t.isNullOrUndefined(i[0][this.model.scrollSettings.frozenRows-1])&&!t.isNullOrUndefined(i[1][this.model.scrollSettings.frozenRows-1])&&this.model.scrollSettings.frozenColumns>0?n(i[0][this.model.scrollSettings.frozenRows-1].cells).add(i[1][this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"):t.isNullOrUndefined(this.getRowByIndex(this.model.scrollSettings.frozenRows-1)[0])||n(i[this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"),this.getContent().height()>this.model.scrollSettings.height&&(r=t.isNullOrUndefined(this.getContent().data("ejScroller"))?null:this.getScrollObject(),this.initialRender||t.isNullOrUndefined(r)||!t.isNullOrUndefined(r._vScrollbar)||this._getRowHeights(),this.model.scrollSettings.height=this._rowHeightCollection[Math.floor(this.model.scrollSettings.height/this._rowHeightCollection[1])]+18)):delete this.model.scrollSettings.scroll)},refreshScrollerEvent:function(){var i=this;this.getContent().find(".e-content:first,.e-movablecontent").scroll(t.proxy(function(t){if(this.model.scrollSettings.targetPane?($movablecontent=n(t.currentTarget).hasClass("e-movablecontent")||!this.model.currentViewData||this.model.currentViewData.length==0?n(t.currentTarget):n(t.currentTarget).find(".e-movablecontent"),this.getHeaderContent().find(".e-movableheader").scrollLeft($movablecontent.scrollLeft())):this.getHeaderContent().find("div").first().scrollLeft(n(t.currentTarget).scrollLeft()),this.model.scrollSettings.frozenRows>0&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&this.model.isEdit){var i=t.target.scrollTop;this.getContent().find(".e-content").scrollTop(0);this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop+i,!0)}},this));this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").scroll(t.proxy(function(t){var i=n(t.currentTarget);this.model.scrollSettings.targetPane?(this.getContent().find(".e-movablecontent").scrollLeft(i.scrollLeft()),this.model.showSummary&&this.getFooterContent().find(".e-movablefooter").scrollLeft(i.scrollLeft())):(this.model.showSummary&&this.getFooterContent().scrollLeft(i.scrollLeft()),this.getContent().find(".e-content").first().scrollLeft(i.scrollLeft()))},this))},clearFiltering:function(n){var i,t;if(n){if(this._clearFilter(n),this.model.filterSettings.filterType!="filterbar")for(t=0;t<this.filterColumnCollection.length;t++)this.filterColumnCollection[t].field==n&&this.filterColumnCollection.splice(t,1)}else{for(i=this.model.filterSettings.filteredColumns,t=0;t<i.length;)this._clearFilter(i[t].field);this.filterColumnCollection=[];(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&this.getHeaderTable().find(".e-filtericon").removeClass("e-filteredicon e-filternone")}},_clearFilter:function(i){var u=this.model.filterSettings.filterType,f,r;t.isNullOrUndefined(this.getColumnByField(i).filterType)||(u=this.getColumnByField(i).filterType);switch(u){case t.Grid.FilterType.FilterBar:n.inArray(this.getColumnByField(i),this.filterColumnCollection)!=-1&&(this.getHeaderTable().find("#"+i+"_filterBarcell").val(""),this._currentFilterbarValue="",f=n.inArray(i,this.filterColumnCollection),this._currentFilterColumn=this.getColumnByField(i),this._showFilterMsg());break;case t.Grid.FilterType.Menu:r="#"+this._id+"_"+this._$colType+"Dlg";this._$colType=="boolean"?n(r).find(".e-value .e-js").ejCheckBox("model.checked",!1):this._$colType=="number"?n(r).find(".e-numerictextbox").ejNumericTextbox("model.value",""):n(r).find(".e-value input").val("");(this._excelFilterRendered||this._isExcelFilter)&&delete this._excelFilter._predicates[0][i];this._$curFieldName=i;break;case t.Grid.FilterType.Excel:delete this._excelFilter._predicates[0][i];this._excelFilter.closeXFDialog();this._$curFieldName=i}this.filterColumn(i,"","","or")},clearSearching:function(){this.element.find(".e-gridtoolbar #"+this._id+"_search").val("");this.search("");n.extend(this.model.searchSettings,this.defaults.searchSettings)},_renderByFrozenDesign:function(){var r=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),i={};i.colgroup1=r.append(t.buildTag("colgroup").append(u.splice(0,this.model.scrollSettings.frozenColumns))).html();i.colgroup2=r.html(t.buildTag("colgroup").append(u)).html();this.getContent().find("div").first().get(0).innerHTML=n.render[this._id+"_FrozenTemplate"]({datas:this.model.currentViewData},i);this.setGridContentTable(this.getContent().find(".e-table").attr("role","grid"))},addFrozenTemplate:function(){var i="<div class='e-frozencontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup1}}<tbody>{{for datas tmpl='"+this._id+"_JSONFrozenTemplate'/}}<\/tbody><\/table><\/div><div class='e-movablecontent'><div class='e-movablecontentdiv'><table cellspacing='0.25px' class='e-table'>{{:~colgroup2}}<tbody>{{for datas tmpl='"+this._id+"_JSONTemplate'/}}<\/tbody><\/table><\/div><\/div>",t={};t[this._id+"_FrozenTemplate"]=i;n.templates(t)},_getTopRow:function(n){var i=this.model.scrollSettings.frozenRows,t=0;if(n>10)for(t=0;t<this._rowHeightCollection.length;t++)if(this._rowHeightCollection[t]>n){i=this.model.scrollSettings.frozenRows+t-1;break}return{imaginaryIndex:i,actualIndex:t}},_showHideRow:function(t,i,r,u){var f=this.getRows();this.model.scrollSettings.frozenColumns>0?n(f[0]).slice(t,i).add(n(f[1]).slice(t,i).toArray())[r]():n(f).slice(t,i)[r]();this._currentTopFrozenRow=r=="show"?t:i;this.getScrollObject()._changevHandlerPosition(u)},_scroll:function(n){var i,f,e,o,u;if(n.scrollData!=null&&n.scrollData.dimension!="width"){n.cancel=!0;var h=this.getRows(),s=this._getTopRow(n.scrollTop),r=s.imaginaryIndex;if(r>this._currentTopFrozenRow?this._showHideRow(this.model.scrollSettings.frozenRows,r,"hide",n.scrollTop):r<this._currentTopFrozenRow&&this._showHideRow(r,this._currentTopFrozenRow+1,"show",n.scrollTop),i=this.getContentTable().last().find("tr"),f=parseInt(i.last().find("td:first").css("border-top-width"))*2+1,n.scrollTop==this.getScrollObject()._vScrollbar.model.maximum&&i.last()[0].offsetTop+i.last().height()-f>this.element.find(".e-content").height()){for(e=i.last().prev()[0].offsetTop+i.last().prev().height(),o=1,u=i.length-2;e-f>this.element.find(".e-content").height();u++){e=i[u].offsetTop+i.eq(u).height();o++;break}this._showHideRow(this.model.scrollSettings.frozenRows,r+o,"hide",n.scrollTop)}n.model.scrollTop=n.scrollTop}else t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)},_renderAlertDialog:function(){var r=t.buildTag("div.e-content",this._getLocalizedLabels().frozenColumnsMessage),i=t.buildTag("span.e-buttons","<input type='button' class='e-flat' id="+this._id+"ConfirmDialogOK value='"+this._getDeprecatedLocalizedLabel("OKButton")+"'/>");this._alertDialog=t.buildTag("div#"+this._id+"AlertDialog");this._alertDialog.append(r).append(i);this.element.append(this._alertDialog);i.find("input").ejButton({cssClass:this.model.cssClass,showRoundedCorner:!0,size:"mini",click:n.proxy(function(){this._alertDialog.ejDialog("close")},this)});this._renderFDialog(this._id+"AlertDialog");this._alertDialog.ejDialog({width:"auto",enableModal:!0})},_renderFDialog:function(t){n("#"+t).ejDialog({showOnInit:!1,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showHeader:!1,width:260,enableResize:!1,allowKeyboardNavigation:!1,content:"#"+this._id})},_virtualScroll:function(t){var i,e;if(this.selectedRowsIndexes.length==this._gridRecordsCount&&this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").prop("checked","checked"),t!=null){var f=0,o=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,u=this.model.pageSettings,s=this.getContentTable()[0].tBodies[0],h=n(s).find("tr.e-virtualrow");if(u.totalPages=Math.ceil(o/u.pageSize),t.scrollTop!==r&&(t.model.scrollTop=t.scrollTop),t.reachedEnd!=r&&(t.model.reachedEnd=t.reachedEnd),i=this._calculateCurrenPage(h,this.getContentTable(),t.model),i>u.totalPages&&(i=u.totalPages),u.currentPage!=i&&n.inArray((i-1)*u.pageSize,this.virtualLoadedPages)==-1&&this.element.find(".gridform:visible").length==0&&(this._isVirtualRecordsLoaded=!1),this._isVirtualRecordsLoaded)u.currentPage=i;else{if(n.inArray((i-1)*u.pageSize,this.virtualLoadedPages)==-1){if(this.model.scrollSettings.virtualScrollMode=="continuous"&&!t.reachedEnd)return;i==u.totalPages&&n.inArray((i-2)*u.pageSize,this.virtualLoadedPages)==-1&&(f++,this.set_currentPageIndex(i));f==1&&(this._lastRow=!0);this.set_currentPageIndex(i)}u.currentPage=i}e=this._refreshVirtualPagerInfo();this._showPagerInformation(e)}},_virtualViewScroll:function(t){if(t!=null){t.scrollTop!==r&&(t.model.scrollTop=t.scrollTop);t.reachedEnd!=r&&(t.model.reachedEnd=t.reachedEnd);var i=this._calculateCurrentVirtualIndex(t);this.model.isEdit&&this.cancelEdit();n.inArray(i,this._currentLoadedIndexes)==-1&&(this._isVirtualRecordsLoaded=!1);this._isVirtualRecordsLoaded||this.set_currentVirtualIndex(i)}},_createPagerStatusBar:function(){var n=this.element.find(".e-pagerstatusbar"),i,r;n.length&&n.remove();i=t.buildTag("div.e-pagermsgdiv");this.$pagerStatusBarDiv=t.buildTag("div.e-pagerstatusbar").append(i);this.model.scrollSettings.allowVirtualScrolling&&this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&(r=t.buildTag("div.e-pagerfiltermsg").css("display","none"),this.$pagerStatusBarDiv.append(r));this.$pagerStatusBarDiv.appendTo(this.element);this.$pagerStatusBarDiv.css("display","none")},_refreshVirtualContent:function(t){var e=this.getRowHeight(),o=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,s,r,i,f,h,c,l,u;t!=null&&(this._currentPage(t),s=this._refreshVirtualPagerInfo(),this._showPagerInformation(s));r=0;this.model.scrollSettings.enableVirtualization&&(r=1);i=r==1?this.getCurrentIndex()+1:this.getCurrentIndex();f=this.getContentTable()[0].tBodies[0];i>1&&(h=document.createElement("tr"),n(h).addClass("e-virtualrow").css("height",e*i).prependTo(f));i+this.model.pageSettings.pageSize<=o&&this.getContentTable().find("tr").last().hasClass("e-virtualrow")!=!0&&this.model.scrollSettings.frozenColumns==0&&(c=document.createElement("tr"),l=this.model.scrollSettings.virtualScrollMode=="normal"?e*(o-(i+this.model.pageSettings.pageSize)):1,n(c).addClass("e-virtualrow").css("height",l).appendTo(n(f)));this.virtualLoadedPages=[];this.orderedVirtualLoadedPage=[];this.virtualLoadedPages.push(i>=r?i:r);this.orderedVirtualLoadedPage.push(i>=r?i:r);u=n(f).find("tr:not(.e-virtualrow)").attr("name",i>=r?i:r)[0];u&&u.previousSibling&&(n(u.previousSibling).hasClass("e-virtualrow")||u.previousSibling.offsetTop>i*this.getContent().height())&&(this.getContent().children("div").first().scrollTop(this.getContent().find(".content").scrollTop()-(this.getContent().find(".content").scrollTop()-u.offsetTop)),this._isVirtualRecordsLoaded=!0)},isIntermediate:function(){return this.model.currentIndex<this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1)?!0:!1},_refreshVirtualView:function(t,i,r){var e,o,f,a,c,s,l,h,u;if(this._singleView)this._singleView=!1,this._addLastRow(),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),h=this._currentVirtualIndex.toString(32),n(this._gridRows).attr("name",h),this._virtualLoadedRows[this._currentVirtualIndex]=this._gridRows,this._eventBindings();else{if(e=this._virtualRowCount,t)t>this._totalVirtualViews&&(t=1,o=!0),i=="selectRows"&&(o=!0),this._currentVirtualIndex=t,this._virtualLoadedRecords[t]?(a=this.getScrollObject(),f=Math.ceil((a.scrollTop()+this.model.scrollSettings.height)/this._vRowHeight/this.model.pageSettings.pageSize)):(this._virtualDataRefresh||this._currentVirtualIndex==this._totalVirtualViews||(o=!0),f=Math.ceil(t*this._virtualRowCount/this.model.pageSettings.pageSize)),this._refreshVirtualViewScroller(o,i,r),f>this.model.pageSettings.totalPages&&(f=this.model.pageSettings.totalPages),f<=0&&(f=1),n.inArray(f,this._virtualLoadedPages)==-1?this.gotoPage(f):(this._currentPage(f),this._needPaging=this._checkCurrentVirtualView(this._virtualLoadedRecords,t)?!1:!0,this._getVirtualLoadedRecords(this.model.query),this._replacingVirtualContent());else{if(this._refreshVirtualViewDetails(),c=n(this.getContentTable()[0].rows),this._setVirtualTopBottom(),this.initialRender){for(u=0;u<this._currentLoadedIndexes.length;u++)s=this._currentLoadedIndexes[u],viewIndex=(u+1)*e,viewCount=u*e,n(c[viewIndex-1]).addClass("e-virtualview"+s),h=s.toString(32),l=c.slice(viewCount,viewCount+e).attr("name",h).detach(),this._virtualLoadedRows[s]=l,l.appendTo(this.getContentTable());this._currentVirtualIndex>1&&this._refreshVirtualViewScroller()}this._eventBindings()}n.inArray(this._currentPage(),this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(this._currentPage())}if(!t&&(this.model.queryCellInfo||this.model.rowDataBound))for(u=0;u<this._currentLoadedIndexes.length;u++)n.inArray(this._currentLoadedIndexes[u],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[u]);this._isThumbScroll=!1;this._virtualDataRefresh=!1},_refreshVirtualViewData:function(){this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualLoadedPages=[];this._virtualPageRecords={};this._queryCellView=[];this.model.pageSettings.totalPages!=null&&this._currentPage()>this.model.pageSettings.totalPages&&(this._currentPage(1),this._currentVirtualIndex=1)},setCurrentPageData:function(n){this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._refreshVirtualViewDetails(),this._setVirtualLoadedRecords(n,this._currentPage()),this._refreshVirtualView(this._currentVirtualIndex))},_refreshVirtualViewScroller:function(n,t,i){var r,u;(this.initialRender&&!this.model.scrollSettings.scrollTop||n)&&(u=this._vRowHeight,r=this.model.currentIndex*this._vRowHeight);r=t=="selectRows"?i*this._vRowHeight:this._scrollObject.model.scrollTop;this.getContent().ejScroller("model.scrollTop",r);this._scrollValue=r},_calculateCurrentViewPage:function(n){n||(n=this._scrollObject.model);var i=this.model.pageSettings.pageSize,t=Math.ceil((n.scrollTop+this.model.scrollSettings.height)/this._vRowHeight/i);return this.model.pageSettings.totalPages==null&&(this.model.pageSettings.totalPages=Math.ceil(this._getVirtualTotalRecord()/i)),t>this.model.pageSettings.totalPages&&(t=this.model.pageSettings.totalPages),this.model.pageSettings.currentPage=t,t},_calculateCurrentVirtualIndex:function(t){var h=t.model,p=this._getVirtualTotalRecord(),i,c,l,u=[],e,o,a,r=h.scrollTop,y=r+this.model.scrollSettings.height,s,v,f;if(i=y/this._vRowHeight/this._virtualRowCount,i=this._prevVirtualIndex>this._currentVirtualIndex&&r<=this._scrollValue?Math.floor(i):Math.ceil(i),r>=this._scrollValue&&h.virtualScrollMode=="continuous"&&h.reachedEnd&&(i=i+1),i>this._totalVirtualViews&&(i=this._totalVirtualViews),i<=0&&(i=1),n.inArray(i,this._currentLoadedIndexes)!==-1&&this._virtualLoadedRows[i]&&r!=t.scrollData.scrollable){for(s=this.getContentTable()[0].rows,a=s.length,v=this.getContent().find(".e-virtualtop").height(),l=r>=this._scrollValue,f=0;f<a;f++){if(e=s[f],o=e.offsetHeight+e.offsetTop+v,o>r+this.model.scrollSettings.height){u.length===0&&f!==0&&(u=[s[e.offsetTop<=r+this.model.scrollSettings.height?f:f-1]]);break}if(o>=r&&o<=r+this.model.scrollSettings.height&&(u.push(e),l===!1&&u.length>1))break}c=n(r>=this._scrollValue?u[u.length-1]:u[0]);c.length&&(i=parseInt(c.attr("name"),32))}return this._scrollValue=r,i},_calculateCurrenPage:function(t,i,r){var o=this.model.pageSettings.pageSize,u,a=this,v,w,f=[],s,h,b,k,y,g=this.getRowHeight(),c,e,l,p,d;if(u=(r.scrollTop+this.model.scrollSettings.height)/g/o,k=this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1),y=this.getContentTable().find("tr[name="+k+"]").eq(0),u=y.length&&y.offset().top>0&&u>=1&&r.scrollTop<this._scrollValue&&this.virtualLoadedPages.indexOf(Math.ceil(u-1)*o)!==-1?Math.floor(u):Math.ceil(u),r.scrollTop>=this._scrollValue&&r.virtualScrollMode=="continuous"&&r.reachedEnd&&(u=this.virtualLoadedPages[this.virtualLoadedPages.length-1]/o+2),n.inArray((u-1)*o,this.virtualLoadedPages)!==-1){for(c=this.getContentTable().children("tbody").children("tr"),b=c.length,w=r.scrollTop>=this._scrollValue,e=0;e<b;e++){if(s=c[e],h=s.offsetHeight+s.offsetTop,h>r.scrollTop+a.model.scrollSettings.height){f.length===0&&e!==0&&(f=[c[s.offsetTop<=r.scrollTop+a.model.scrollSettings.height?e:e-1]]);break}if(h>=r.scrollTop&&h<=r.scrollTop+a.model.scrollSettings.height&&(f.push(s),w===!1&&f.length>1))break}v=n(r.scrollTop>=this._scrollValue?f[f.length-1]:f[0]);v.hasClass("e-virtualrow")?f.length===1&&u++:u=parseInt(v.attr("name"),10)/o+1}for(this._scrollValue=r.scrollTop,l=0;l<t.length;l++)if(p=t[l],p.offsetTop+p.offsetHeight>=r.scrollTop)return d=this._calculatePrevPage(t,i,r),this._prevPageNo=d,u==0&&(u=1),u>this.model.pageSettings.totalPages?this.model.pageSettings.totalPages:u;return u},_calculatePrevPage:function(t,i,r){for(var f,e,u=0;u<t.length;u++)if(f=t[u],f.offsetTop+f.offsetHeight>=r.scrollTop&&(e=n(f).prevAll("tr[name]")[0],e!=null))return Math.ceil(parseInt(n(e).attr("name"),10)/this.model.pageSettings.pageSize)+1;return-1},_refreshVirtualPagerInfo:function(){var n={};return n.pageSize=this.model.pageSettings.pageSize,n.totalRecordsCount=this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,n.totalRecordsCount==0&&this._currentPage(0),n.currentPage=this._currentPage(),n.totalPages=Math.ceil(n.totalRecordsCount/n.pageSize),n},_showPagerInformation:function(t){var i=(t.currentPage-1)*t.pageSize;n(this.$pagerStatusBarDiv).find("div:first").html(String.format(this.localizedLabels.PagerInfo,t.currentPage,t.totalPages,t.totalRecordsCount),i,i+t.pageSize);n(this.$pagerStatusBarDiv).css("display","block")},_cellMerging:function(i){i.colMerge=function(n){if(this.cell.className.indexOf("e-colmerge")==-1){this.cell.className+=" e-colmerge";this.model.columns.length-this.cell.cellIndex<n&&(n=this.model.columns.length-this.cell.cellIndex);this.cell.colSpan=n;for(var i=1;i<n;i++)t.isNullOrUndefined(this.cell.parentElement.children[this.cell.cellIndex+i])||(this.cell.parentElement.children[this.cell.cellIndex+i].className+=" e-hide")}};i.rowMerge=function(i){var r,u;if(this.cell.className.indexOf("e-rowmerge")==-1)for(this.cell.className+=" e-rowmerge",r=this.cell.parentNode.parentNode,r.rows.length-this.cell.parentElement.rowIndex<i&&(i=r.rows.length-this.cell.parentElement.rowIndex),this.cell.rowSpan=i,u=0;u<i-1;u++)if(t.isNullOrUndefined(r.children[this.cell.parentElement.rowIndex+u].nextSibling))break;else(!n(".e-grid").children().is(".e-dialog")||n(".e-grid").find(".e-dialog").attr("style").indexOf("display: none")!=-1||this.model.allowFiltering)&&(r.children[this.cell.parentElement.rowIndex+u].nextSibling.children[this.cell.cellIndex].className+=" e-merged e-hide")};i.merge=function(r,u){var o,s,e,f;if(r>1&&u>1){if(this.cell.className.indexOf("e-colmerge")==-1){if(this.cell.className+=" e-colmerge",o=this.cell.parentNode.parentNode,o.rows.length-this.cell.parentElement.rowIndex<u&&(u=o.rows.length-this.cell.parentElement.rowIndex),!n(".e-grid").children().is(".e-dialog")||n(".e-grid").find(".e-dialog").attr("style").indexOf("display: none")!=-1||this.model.allowFiltering)for(s=0;s<u;s++)if(t.isNullOrUndefined(o.children[this.cell.parentElement.rowIndex+s]))break;else for(e=o.children[this.cell.parentElement.rowIndex+s].children[this.cell.cellIndex],this.model.columns.length-e.cellIndex<r&&(r=this.model.columns.length-e.cellIndex),e.colSpan=r,f=1;f<r;f++)t.isNullOrUndefined(e.parentElement.children[this.cell.cellIndex+f])||(e.parentElement.children[this.cell.cellIndex+f].className+=" e-hide");else for(this.cell.colSpan=r,f=1;f<r;f++)t.isNullOrUndefined(this.cell.nextSibling)||(this.cell.parentElement.children[this.cell.cellIndex+f].className+=" e-hide");i.rowMerge(u)}}else r>1&&i.colMerge(r),u>1&&i.rowMerge(u)}},_replacingContent:function(){var wt=document.createElement("div"),a=0,u,y,et,e,c,d,o,w,ot,g,st,nt,ht,ct,it,i,h,yt,rt,gt,ni,ut,pt;this.model.scrollSettings.enableVirtualization&&(a=1);var f=a==1?this.getCurrentIndex()+1:this.getCurrentIndex(),s=this.getContentTable()[0],ft=n(s).find("colgroup").first(),v=this.getRowHeight();ft.replaceWith(this._getMetaColGroup());(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&ft.prepend(this._getIndentCol());u=s.tBodies[0];y=this.model.currentViewData;t.isNullOrUndefined(this._currentPageData)?this._virtualLoadedRecords[this._currentPage()]=y:(this._virtualLoadedRecords[this._currentPage()]=this._currentPageData,this._currentPageData=null);var bt=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](y)),k=this,p=bt.children("tr");if(this._allowcolumnSelection&&this.selectedColumnIndexes.length>0)for(h=0;h<this.selectedColumnIndexes.length;h++)et=this.selectedColumnIndexes[h]+1,p.find("td:nth-of-type("+et+")").addClass("e-columnselection");for(this.virtualLoadedPages.push(f>=a?f:a),e=t.dataUtil.mergeSort(t.distinct(this.virtualLoadedPages)),n(p).attr("name",f),c=t.dataUtil.min(e),d=t.dataUtil.max(e),n(u).children(".e-virtualrow").remove(),i=0;i<e.length;i++)o=e[i],w=e[i-1],(o!=this.orderedVirtualLoadedPage[i]||this.orderedVirtualLoadedPage[i]==r)&&(w!=r?p.insertAfter(n(u).children("[name="+w+"]:last")):p.insertBefore(n(u).children("[name="+this.orderedVirtualLoadedPage[i]+"]:first")),this.orderedVirtualLoadedPage=e),o!=0&&(ot=o==c?c:w,g=o-ot-k.model.pageSettings.pageSize,g>0&&(st=document.createElement("tr"),n(st).addClass("e-virtualrow").css("height",v*g).insertBefore(n(u).children("[name="+o+"]:first")))),o==d&&(nt=k._gridRecordsCount-d-k.model.pageSettings.pageSize,nt>0&&(ht=document.createElement("tr"),n(ht).addClass("e-virtualrow").css("height",v*nt).appendTo(u)));c>0&&(ct=document.createElement("tr"),n(ct).addClass("e-virtualrow").css("height",v*c).prependTo(u));var lt=this.getContent(),b=n(u).children("tr[name="+f+"]")[0],tt=b.previousSibling,at=lt.height(),vt=b.offsetTop;if(this._virtaulUnSel)for(it=n.extend(!0,[],this._virtaulUnSel),i=0;i<it.length;i++){var l=it[i],kt=this.model.pageSettings.currentPage,dt=l%this.model.pageSettings.pageSize==0?parseInt(l/this.model.pageSettings.pageSize):parseInt(l/this.model.pageSettings.pageSize)+1;dt==kt&&(h=l%this.model.pageSettings.pageSize,yt=n(u).find("tr[name="+f+"]").eq(h),yt.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),rt=this._virtaulUnSel.indexOf(l),rt!=-1&&this._virtaulUnSel.splice(rt,1))}(b&&tt&&(this._virIndex||n(tt).hasClass("e-virtualrow")||tt.offsetTop>f*at)&&(this._gridRecordsCount-f>=this.model.pageSettings.pageSize||b.offsetParent.offsetHeight-vt<at)||this._lastRow)&&(this._lastRow&&(this._lastRow=!1),this._virIndex&&(this._virIndex=!1),this._isVirtualRecordsLoaded=!0,lt.find(".e-content").scrollTop(vt),this._scrollValue=this.getContent()[0].firstChild.scrollTop);gt=n(s).get(0);ni=wt.firstChild;this._currentJsonData=y;this._gridRows=n(s).get(0).rows;ut=n(s).find(".e-virtualrow").last();pt=this.model.scrollSettings.virtualScrollMode=="normal"?ut.height()-(n(s).height()-this._gridRecordsCount*v):1;ut.css("height",pt);this._enableCheckSelect&&this._virtualCheckSelection(f);this._eventBindings()},_virtualCheckSelection:function(t){var i=this.getContentTable()[0].tBodies[0];n(i).find("tr[name="+t+"]").find(".e-checkcelldiv input").prop("checked","checked");n(i).find("tr[name="+t+"]").attr("aria-selected","true").find("td").addClass("e-selectionbackground e-active")},_replacingVirtualContent:function(){var f=this.getContentTable()[0],e=this._currentLoadedIndexes,r=n("<tbody><\/tbody>"),s,l,i,u,a,h,c,t;if(this._checkCurrentVirtualView(this._virtualLoadedRows,this._currentVirtualIndex)){for(s=[],t=0;t<e.length;t++)n.merge(s,this._virtualLoadedRows[e[t]]);n(r).append(s)}else for(l=n("<tbody><\/tbody>"),t=0;t<e.length;t++)if(i=e[t],u=this._virtualLoadedRows[i],u)i<this._currentVirtualIndex?(c=r.find(".e-virtualview"+i),c.length?n(u).insertBefore(c):r.prepend(u)):n(u).insertAfter(r.find(".e-virtualview"+(i-1)));else{this._currentVirtualRowIndex=i>0?(i-1)*this._virtualRowCount:0;var l=n("<tbody><\/tbody>").append(n.render[this._id+"_JSONTemplate"](this._virtualLoadedRecords[i])),o=l[0].rows,v=o.length-1;n(o[v]).addClass("e-virtualview"+i);a=i.toString(32);h=n(o).attr("name",a);(h.length==this._virtualRowCount||i==this._totalVirtualViews)&&(this._virtualLoadedRows[i]=h,r.append(o))}if(f.replaceChild(r[0],f.lastChild),n(f.rows).removeClass("e-hover"),this._setVirtualTopBottom(),(this._isThumbScroll||this._remoteRefresh)&&(this._scrollObject._content[0].scrollTop=this._scrollObject.scrollTop(),this._isThumbScroll=this._remoteRefresh=!1),this.model.allowSelection&&this._checkVirtualSelection(),this._gridRows=f.rows,this._currentJsonData=this.model.currentViewData,this._checkCurrentVirtualView(this._queryCellView,this._currentVirtualIndex)||this._eventBindings(),this.model.queryCellInfo||this.model.rowDataBound)for(t=0;t<this._currentLoadedIndexes.length;t++)n.inArray(this._currentLoadedIndexes[t],this._queryCellView)==-1&&this._queryCellView.push(this._currentLoadedIndexes[t]);this._trigger("refresh")},_setVirtualTopBottom:function(){var f=this.getContentTable()[0],c=this._vRowHeight,v=t.dataUtil.mergeSort(t.distinct(this._currentLoadedIndexes)),y=t.dataUtil.min(v),e=t.dataUtil.max(v),p=this._getVirtualTotalRecord(),a,l,w,i,u,h,o,r,s;if(this.model.scrollSettings.virtualScrollMode=="continuous"&&this._virtualLoadedRows[e+1]&&(w=Object.keys(this._virtualLoadedRows),l=parseInt(t.dataUtil.max(w),10),e=l-e),a=e*this._virtualRowCount*c,n.inArray(this._totalVirtualViews,this._currentLoadedIndexes)!=-1&&this._currentVirtualIndex!=this._totalVirtualViews&&(a=(p-(this._virtualRowCount-this._lastViewData))*c),i=p*c-a,this.model.scrollSettings.virtualScrollMode!="continuous"||this._virtualLoadedRows[e+1]||(i=l&&l<=e+1?i:1),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),u=1e6,i>0&&this._getVirtualTotalRecord()>this._virtualRowCount*2)if(Math.round(i).toString().length<7)t.buildTag("div.e-virtualbottom","",{height:i}).insertAfter(f);else for(t.buildTag("div.e-virtualbottom").insertAfter(f),o=Math.ceil(i/u),r=0;r<o;r++)s=u,r==o-1&&(s=i%u),n(f).next().append(t.buildTag("div","",{height:s}));if(y>1)if(h=(y-1)*this._virtualRowCount*c,Math.round(h).toString().length<7)t.buildTag("div.e-virtualtop","",{height:h}).insertBefore(f);else for(t.buildTag("div.e-virtualtop").insertBefore(f),o=Math.ceil(h/u),r=0;r<o;r++)s=u,r==o-1&&(s=h%u),n(f).prev().append(t.buildTag("div","",{height:s}));this._scrollObject.model.scrollTop!=this._scrollValue&&this.getContent().ejScroller("model.scrollTop",this._scrollValue)},_checkVirtualSelection:function(){for(var e,i,r,c,h,o,f,s,v,u=this.getContentTable()[0],t=0;t<this.selectedRowsIndexes.length;t++)i=this.selectedRowsIndexes[t],r=this._getSelectedViewData(i).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&(e=i%this._virtualRowCount+this._currentLoadedIndexes.indexOf(r)*this._virtualRowCount,n(u.rows[e].cells).hasClass("e-selectionbackground")||(n(n(u.rows[e]).attr("aria-selected","true")[0].cells).addClass("e-selectionbackground e-active"),this.model.selectedRecords[t]=this._virtualLoadedRecords[r][e%this._virtualRowCount]));for(t=0;t<this._rowIndexesColl.length;t++)if(i=this._rowIndexesColl[t],r=this._getSelectedViewData(i).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&n.inArray(i,this._virtualRowCellSelIndex)==-1||this._virtualDataRefresh)for(c=n.inArray(i,this._rowIndexesColl),h=this.selectedRowCellIndexes[c].cellIndex,o=0;o<h.length;o++)this._selectMultipleCells(i,h[o]);for(f=n(u.rows).find(".e-active, .e-cellselectionbackground").closest("tr"),t=0;t<f.length;t++){var y=parseInt(n(f[t]).attr("name"),32)*this._virtualRowCount,p=this._virtualRowCount-n(f[t]).index()%this._virtualRowCount,l=y-p,a=n(f[t]).index();this.selectedRowsIndexes.length&&n.inArray(l,this.selectedRowsIndexes)==-1&&(this._clearVirtualSelection=!0,this.clearSelection(a));this._rowIndexesColl.length&&n.inArray(l,this._rowIndexesColl)==-1&&n(this.getRowByIndex(a)[0].cells).removeClass("e-cellselectionbackground e-activecell")}for(n(u.rows).find(".e-columnselection").removeClass("e-columnselection"),s=0;s<this.selectedColumnIndexes.length;s++)v=this.selectedColumnIndexes[s]+1,n(u.rows).find("td:nth-of-type("+v+")").addClass("e-columnselection");this._clearVirtualSelection=!1},_refreshPagerTotalRecordsCount:function(){this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._gridRecordsCount:this._searchCount,currentPage:this._currentPage()})},_maxZindex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==r||t==null)&&(t=1),t},_keyPressed:function(i,u,f,e){var s=n(u),g,nt,c,h,y,w,k,tt,a,b,p,d,o,l,v;if(s.hasClass("e-tooltxt")&&f.code==13)return g={currentTarget:u,target:u.firstChild},nt=n(u).closest(".e-gridtoolbar"),nt.ejToolbar("instance")._trigger("click",g),!1;if((!this._allowcellSelection||this._previousRowCellIndex&&this._previousRowCellIndex.length!=0||(this._previousRowCellIndex=[],this._previousRowCellIndex.push([0,[0]])),s.hasClass("e-ddl")&&f.code==13&&n(document.activeElement).parents("td").hasClass("e-templatecell"))||!this.model.allowKeyboardNavigation||u.tagName=="INPUT"&&this.model.keyConfigs[i].indexOf(",")==-1&&f.code!=40&&f.code!=38&&f.code!=13&&f.code!=27&&f.code!=9||String.fromCharCode(f.code).toLowerCase()==this.element[0].accessKey.toLowerCase()||n(u).prop("type")=="checkbox"&&f.code!=13&&f.code!=9&&f.code!=27||this.model.editSettings.editMode=="batch"&&u.tagName=="INPUT"&&f.code!=13&&f.code!=9&&f.code!=27&&(u.selectionStart!=0&&i!="moveCellRight"||u.selectionEnd!=u.value.length&&i!="moveCellLeft")||this.model.allowFiltering&&s.hasClass("e-filtertext")&&f.code==13||s.hasClass("e-fltrbtn")&&f.code==13||(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate")&&n(u).closest("#"+this._id+"EditForm").length||n(u).parent().siblings("#"+this._id+"EditForm").length||f.code==13&&s.parent().hasClass("e-unboundcelldiv"))return!0;if(f.code==13&&u.tagName=="INPUT"&&s.closest("#"+this._id+"_search").length&&(i="searchRequest"),f.code==13&&this._excelFilter!=null&&!t.isNullOrUndefined(this._excelFilter._openedFltr)&&this._excelFilter._openedFltr.length&&this._excelFilter._openedFltr.is(":visible")&&(i="excelfilter"),f.code==13&&n(u).hasClass("e-gridtoolbar")&&(toolbarId=s.find(".e-hover").attr("Id"),i="toolbarOperationRequest"),!this.model.isEdit&&i=="cancelRequest")return this.clearSelection(),this.clearCellSelection(),this.clearColumnSelection(),!0;if(n(u).find("input.e-dropdownlist").attr("aria-expanded")=="true"&&this.model.isEdit&&i=="saveRequest")return!0;if(this.getPager()!=null&&(c=this.getPager().ejPager("model"),h=c.currentPage),y=!1,s=n(u),s.closest(".e-grid").attr("Id")===this._id){switch(i){case"insertRecord":!t.gridFeatures.edit||this.model.isEdit||this.model.editSettings.showAddNewRow||this.model.editSettings.editMode!="normal"||this._toolbarOperation(this._id+"_add");break;case"toolbarOperationRequest":this._toolbarOperation(toolbarId);this.element.focus();break;case"searchRequest":this.search(s.val());break;case"excelfilter":k=this._id+this._excelFilter._$colType;this._excelFilter._openedFltr.hasClass("e-dlgcustom")&&(k+="Custom");this._excelFilter._openedFltr.find("#"+k+"_OkBtn").trigger("click");break;case"saveRequest":t.gridFeatures.edit&&(s.blur(),this.model.editSettings.editMode=="batch"?(tt=n(this.getRowByIndex(this._bulkEditCellDetails.rowIndex)),this.model.isEdit&&tt.hasClass("e-insertedrow")&&this._batchCellValidation(this._bulkEditCellDetails.rowIndex),this._moveCurrentCell("down")):this._toolbarOperation(this._id+"_update"),e.stopPropagation());break;case"cancelRequest":t.gridFeatures.edit&&this._toolbarOperation(this._id+"_cancel");break;case"deleteRecord":t.gridFeatures.edit&&this._toolbarOperation(this._id+"_delete");break;case"editRecord":t.gridFeatures.edit&&(!this.model.isEdit||this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal")&&this._toolbarOperation(this._id+"_edit");break;case"totalGroupCollapse":t.gridFeatures.group&&(this.collapseAll(),this.element.focus());break;case"totalGroupExpand":t.gridFeatures.group&&(this.expandAll(),this.element.focus());break;case"selectedGroupExpand":t.gridFeatures.group&&(this._$currentTr=n(this.getRows()).eq(this._selectedRow()),w=this._$currentTr.parents("tr").first().prev().find(".e-recordpluscollapse"),this.expandCollapse(w));break;case"selectedGroupCollapse":t.gridFeatures.group&&(this._$currentTr=n(this.getRows()).eq(this._selectedRow()),w=this._$currentTr.parents("tr").first().prev().find(".e-recordplusexpand"),this.expandCollapse(w));break;case"firstRowSelection":t.gridFeatures.selection&&this.selectRows(0);break;case"lastRowSelection":t.gridFeatures.selection&&(o=this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])?n(this.getRows()[0]).length-1:n(this._excludeDetailRows()).length-1);this.selectRows(o);break;case"rowUpSelection":this.element.find(".e-row.e-hover,.e-alt_row.e-hover").removeClass("e-hover");a=this._traverseRow!=null?this._traverseRow:this._selectedRow();a>0&&(this._nextRow=a,this._prevRow=a-1,b=n(this.getContent().find("tr.e-traverse")[0]),b.removeClass("e-traverse"),this.getRowByIndex(this._prevRow).addClass("e-traverse"),p=this.getContent().find("tr.e-traverse"),this._traverseRow=this.getIndexByRow(p));break;case"rowDownSelection":this.element.find(".e-row.e-hover,.e-alt_row.e-hover").removeClass("e-hover");a=this._traverseRow!=null?this._traverseRow:this._selectedRow();(a+1<this.model.currentViewData.length||this.model.scrollSettings.allowVirtualScrolling)&&(this._prevRow=a,this._nextRow=a+1,b=n(this.getContent().find("tr.e-traverse")[0]),b.removeClass("e-traverse"),this.getRowByIndex(this._nextRow).addClass("e-traverse"),p=this.getContent().find("tr.e-traverse"),this._traverseRow=this.getIndexByRow(p));break;case"randomSelection":this.element.find(".e-row.e-hover,.e-alt_row.e-hover").removeClass("e-hover");this.model.selectionType=="multiple"&&(this.multiSelectCtrlRequest=!0);p=this.getContent().find("tr.e-traverse");this._traverseRow=this.getIndexByRow(p);this._traverseRow!=-1&&(this.model.selectionSettings.enableToggle&&this.getSelectedRecords().length==1&&n.inArray(this._traverseRow,this.selectedRowsIndexes)!=-1?this.clearSelection(selectedIndex):this.selectRows(this._traverseRow));this.getRowByIndex(a).removeClass("e-traverse");this.multiSelectCtrlRequest=!1;break;case"upArrow":if(this.multiSelectCtrlRequest=!1,this._traverseRow=null,this.model.isEdit&&s.hasClass("e-ddl"))break;if(t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=r)&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;this._selectedRow()>0&&(this._enableCheckSelect||this.selectRows(this._selectedRow()-1),this.model.editSettings.editMode!="batch"||this.model.scrollSettings.enableVirtualization||this._moveCurrentCell("up"));this._previousRowCellIndex&&this._previousRowCellIndex.length!=0&&this._previousRowCellIndex[0][0]!=0&&this._allowcellSelection&&(this.selectCells([[this._previousRowCellIndex[0][0]-1,this._previousRowCellIndex[0][1]]]),this.model.editSettings.editMode=="batch"&&this._moveCurrentCell("down"))}break;case"downArrow":if(this.multiSelectCtrlRequest=!1,this._traverseRow=null,this.model.isEdit&&s.hasClass("e-ddl"))break;if(t.gridFeatures.selection&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;this._selectedRow()==-1&&(this.model.selectedRowIndex=0);o=this._excludeDetailRows().length-1;this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])&&(o=this.getRows()[0].length-1);this._selectedRow()!=o&&this._selectedRow()!=-1&&(this._enableCheckSelect||this.selectRows(this._selectedRow()+1),this.model.editSettings.editMode!="batch"||this.model.scrollSettings.enableVirtualization||this._moveCurrentCell("down"));this._previousRowCellIndex&&this._previousRowCellIndex.length!=0&&this._previousRowCellIndex[0][0]!=o&&this._allowcellSelection&&(this.selectCells([[this._previousRowCellIndex[0][0]+1,this._previousRowCellIndex[0][1]]]),this.model.editSettings.editMode=="batch"&&this._moveCurrentCell("down"))}break;case"rightArrow":if(t.gridFeatures.selection&&this._allowcellSelection&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;o=n(this.getRows()).length-1;this._previousRowCellIndex&&this._previousRowCellIndex[0][1]==this.model.columns.length-1&&this._previousRowCellIndex[0][0]!=o?this.selectCells([[this._previousRowCellIndex[0][0]+1,[0]]]):this._previousRowCellIndex&&this._previousRowCellIndex[0][1]!=this.model.columns.length-1&&this.selectCells([[this._previousRowCellIndex[0][0],[parseInt(this._previousRowCellIndex[0][1])+1]]])}break;case"leftArrow":if(t.gridFeatures.selection&&this._allowcellSelection&&(this.element.is(document.activeElement)||this.element.find(document.activeElement).not(".e-gridtoolbar").length)){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;this._previousRowCellIndex&&this._previousRowCellIndex[0][1]==0&&this._previousRowCellIndex[0][0]!=0?this.selectCells([[this._previousRowCellIndex[0][0]-1,[this.model.columns.length-1]]]):this._previousRowCellIndex&&this._previousRowCellIndex[0][1]!=0&&this.selectCells([[this._previousRowCellIndex[0][0],[parseInt(this._previousRowCellIndex[0][1])-1]]])}break;case"firstCellSelection":if(t.gridFeatures.selection&&this._allowcellSelection){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;o=n(this.getRows()).length-1;o>-1&&this.selectCells([[0,[0]]])}break;case"lastCellSelection":if(t.gridFeatures.selection&&this._allowcellSelection){if((u.type=="text"||u.type=="checkbox")&&this.model.isEdit&&this.model.editSettings.editMode!="batch")return!0;o=this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])?this.getRows()[0].length-1:n(this._excludeDetailRows()).length-1;o>-1&&this.selectCells([[o,[this.model.columns.length-1]]])}break;case"nextPage":this.getPager()!=null&&(h=h+1);t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||this.element.focus();break;case"previousPage":this.getPager()!=null&&(h=h-1);t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||this.element.focus();break;case"lastPage":this.getPager()!=null&&(h=c.totalPages);break;case"firstPage":this.getPager()!=null&&(h=1);break;case"nextPager":this.getPager()!=null&&(h=Math.ceil(c.currentPage/c.pageCount)*c.pageCount+1);break;case"previousPager":this.getPager()!=null&&(h=(Math.floor(c.currentPage/c.pageCount)-1)*c.pageCount+1);break;case"moveCellLeft":this.model.editSettings.editMode=="batch"?(this._tabKey=!0,y=this._moveCurrentCell("left")):y=!0;break;case"moveCellRight":this.model.editSettings.editMode=="batch"&&s?(this._tabKey=!0,y=this._moveCurrentCell("right")):y=!0;break;case"multiSelectionByDownArrow":t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=r)&&(o=this._excludeDetailRows().length-1,s=this.element.find(".e-gridcontent").find(".e-rowcell"),this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])&&(o=this.getRows()[0].length-1),this._selectedRow()<=o&&this._selectedRow()!=-1&&(l=this._selectedRow()+1,v=this._previousIndex,this.selectRows(v,l,s),l-1==o&&(this.selectRows(v,o),l=o)),this._selectedRow(l),this._previousIndex=v);this.model.editSettings.editMode=="batch"&&this.element.focus();break;case"multiSelectionByUpArrow":d=0;t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=r)&&(o=this._excludeDetailRows().length-1,s=this.element.find(".e-gridcontent").find(".e-rowcell"),this._selectedRow()>=0&&this._selectedRow()>=-1&&(l=this._selectedRow()-1,v=this._previousIndex,this.selectRows(v,l,s),l<0&&(this.selectRows(v,d),l=d)),this._selectedRow(l),this._previousIndex=v);this.model.editSettings.editMode=="batch"&&this.element.focus();break;default:y=!0}return this.getPager()!=null&&h<=c.totalPages&&c.currentPage!==h&&i!="searchRequest"&&i!=="deleteRecord"&&this.getPager().ejPager("goToPage",h),y}},_findColumnsWidth:function(){for(var t=this.getHeaderTable().find(".e-headercell").not(".e-stackedHeaderCell, .e-detailheadercell"),n=0;n<this.model.columns.length;n++)this.model.columns[n].visible&&(this.columnsWidthCollection[n]=t.eq(n+0).outerWidth())},_calculateWidth:function(){for(var t=this.getHeaderTable().find(".e-columnheader").last().find("th:visible"),i=0,n=0;n<t.length;n++)i+=t.eq(n).outerWidth();return i},_initIndicators:function(){var t=this._id+"_ColumnDropIndicator";n("#"+t).length&&n("#"+t).remove();this._Indicator=document.createElement("DIV");n(this._Indicator).attr("id",t).addClass("e-columndropindicator").addClass("e-dropAcceptor").appendTo(document.body);n(this._Indicator).css({display:"none"})},_refreshGridFooterColGroup:function(){this.getFooterTable().find("colgroup").remove();this.model.scrollSettings.frozenColumns>0?(this.getFooterTable().eq(0).append(this.getHeaderTable().eq(0).find("colgroup").clone()),this.getFooterTable().eq(1).append(this.getHeaderTable().eq(1).find("colgroup").clone())):this.getFooterTable().append(this.getHeaderTable().find("colgroup").clone())},_refreshGroupSummary:function(){var r=this.getHeaderContent().find("colgroup col").clone(),i,t;for(r.splice(0,this.model.groupSettings.groupedColumns.length),i=this.getContentTable().find(".e-groupsummary colgroup"),t=0;t<i.length;t++)n(i[t]).find(".e-summary").is("visible")||n(i[t]).find(".e-summary").show(),n(i[t]).find("col:not('.e-summary')").remove(),n(i[t]).append(r.clone())},reorderColumns:function(n,t){var i,r;(typeof n=="string"&&typeof t=="string"?(i=this.getColumnIndexByField(n),r=this.getColumnIndexByField(t)):(i=n,r=t),i!=-1&&r!=-1&&typeof i!="string"&&typeof r!="string")&&(this.set_dropColumn(i,r),this.model.showStackedHeader&&this._refreshStackedHeader(),this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization?(this._virtualDataRefresh=!0,this._queryCellView=[],this._virtualLoadedRows={},this._refreshVirtualView(this._currentVirtualIndex)):this._refreshVirtualContent()))},columns:function(r,u){var f,e,s,o,h;if(!t.isNullOrUndefined(r)){for(f=!1,typeof r=="string"?(r=[r],f=!0):r instanceof Array&&r.length&&typeof r[0]=="string"&&(f=!0),i=0;i<r.length;i++)e=f?r[i]:r[i].field,s=f?r[i]:r[i].headerText,o=(t.isNullOrUndefined(e)||e=="")&&(t.isNullOrUndefined(s)||s=="")?-1:t.isNullOrUndefined(e)||e==""?n.inArray(this.getColumnByHeaderText(s),this.model.columns):n.inArray(this.getColumnByField(e),this.model.columns),u=="add"||t.isNullOrUndefined(u)?o==-1?this.model.columns.push(f?{field:r[i]}:r[i]):this.model.columns[o]=f?{field:r[i]}:r[i]:o!=-1&&this.model.columns.splice(o,1);for(this.columnsWidthCollection=[],tooltip=!1,h=0;h<this.model.columns.length;h++)this.columnsWidthCollection.push(this.model.columns[h].width),t.isNullOrUndefined(tooltip)||(tooltip=!0);this._enableRowHover(tooltip);this.refreshHeader();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this.refreshContent(!0);this.model.allowScrolling&&(this.refreshScrollerEvent(),this.model.allowResizeToFit&&this.getContent().ejScroller("isVScroll")&&this._showHideScroller())}},_enableRowHover:function(n){var r=!0,i;if(t.isNullOrUndefined(n)){for(i=0;i<this.model.columns.length;i++)if(!t.isNullOrUndefined(this.model.columns[i].tooltip)){r=!0;break}}else r=n;this.model.enableRowHover||r?this._on(this.element,"mouseenter mouseleave",".e-gridcontent tr td",this._rowHover):this._off(this.element,"mouseenter mouseleave",".e-gridcontent tr td")},_rowHover:function(i){var r=n(i.target),u,f,e,o,s;if(r.hasClass("e-rowcell")||(r=r.closest(".e-rowcell")),u=this.model.scrollSettings.frozenColumns?n(this.getRows()):this.element.find(".e-row.e-hover,.e-alt_row.e-hover"),(!r.closest("#"+this._id+"EditForm").length||!r.hasClass("e-rowcell"))&&r.hasClass("e-rowcell"))return i.type=="mouseenter"&&r.hasClass("e-gridtooltip")&&this._showTooltip(r),this.model.enableRowHover&&(this.element.find(".e-traverse").removeClass("e-traverse"),this._traverseRow=null,i.type!="mouseenter"||this._dragActive?(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(u[0])&&!t.isNullOrUndefined(u[1])&&(u=n(u[0]).add(u[1])),u.removeClass("e-hover")):this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(u[0])&&!t.isNullOrUndefined(u[1])?(u=n(u[0]).add(u[1]),u.removeClass("e-hover"),f=this.getIndexByRow(r.parent()),f!=-1&&this.getRowByIndex(f).addClass("e-hover")):(u.removeClass("e-hover"),(r.parent().hasClass("e-row")||r.parent().hasClass("e-alt_row"))&&r.parent().addClass("e-hover")),gridRows=r.parent(),f=this.getIndexByRow(gridRows),e=this._currentJsonData[f],this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization?(f=f%this.model.pageSettings.pageSize,e=this._currentJsonData[f]):this.model.scrollSettings.enableVirtualization&&(o=this._getSelectedViewData(f,r),e=o.data,f=o.rowIndex),s={row:gridRows,rowIndex:f,rowData:e,cell:r},this._trigger("rowHover",s)),!1},_showTooltip:function(i,r){var u=i.index(),a=i.hasClass("e-stackedHeaderCell"),c={},f,s,v,e,h,o,l,y,p;if(i.hasClass("e-headercelldiv")&&(u=i.parent(".e-headercell").index()-this.model.groupSettings.groupedColumns.length),!a&&(this.model.childGrid||this.model.detailsTemplate)&&u--,this.model.scrollSettings.frozenColumns>0&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(u=u+this.model.scrollSettings.frozenColumns),f=a?this._getStackedColumnByTarget(i):this.getColumnByIndex(u),f.clipMode!=t.Grid.ClipMode.Ellipsis){if(f.clipMode==t.Grid.ClipMode.EllipsisWithTooltip&&(s=i,i.find("span").hasClass("e-ellipsistooltip")||($span=t.buildTag("span.e-ellipsistooltip",{},{}),$span.html(i.html()),s.append($span)),s.find("span.e-ellipsistoottip").css("display","inline-block"),v=s.find("span:first")[0].getBoundingClientRect().width,s.find("span.e-ellipsistooltip").remove(),i.width()>v)){i.removeAttr("title");return}if(e=document.createElement("script"),t.isNullOrUndefined(f.tooltip)&&t.isNullOrUndefined(f.headerTooltip))return;e.id=(this._id+f.headerText+n.inArray(f,this.model.columns)+"_TemplateToolTip").split(" ").join("");e.type="text/x-template";o=r?"headerTooltip":"tooltip";t.isNullOrUndefined(f[o])||f[o].slice(0,1)==="#"?h=n(f[o]):e.text=f[o];h&&(e.text=h.html(),e.type=h.attr("type")||e.type);t.isNullOrUndefined(h)||f[o].slice(0,1)==="#"||n("body").append(e);l=i.closest("tr");n(l).hasClass("e-columnheader")||i.hasClass("e-gridheader")||(u=this.getIndexByRow(l),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling?this.model.scrollSettings.enableVirtualization?(y=l.attr("name"),u=u%this._virtualRowCount,virtualIndex=parseInt(y,32),c=this._virtualLoadedRecords[virtualIndex][u]):u=u%this.model.pageSettings.pageSize:c=this.getCurrentViewData()[u]);c.value=!i.hasClass("e-headercell")||a?i.text():i.find("e-gridheadertooltip").text();p=n(e).render(c);i.attr("title",p)}else i.removeAttr("title")},_rightClickHandler:function(i){var f,u,e,r;if(i.preventDefault(),f=t.browserInfo(),i.which==3||f.name=="msie"&&f.version=="8.0"){if(u={},$target=n(i.target),$gridRow=n(this.getRows()),this.getContentTable().has($target).length){var r=$gridRow.index($target.parent()),s=this.getRowByIndex(r),o=this._currentJsonData[r];if(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(e=this._getSelectedViewData(r,$target),o=e.data,r=e.rowIndex),r==-1)return;u={rowIndex:r,row:s,data:o,cellIndex:$target.index(),cellValue:$target.html(),cell:$target}}else if(this.getHeaderTable().has($target).length){if(r=0,$th=this.getHeaderTable().find("th").not(".e-detailheadercell,.e-grouptopleftcell,.e-filterbarcell"),r=$target.is(".e-headercelldiv")?$th.index($target.closest(".e-headercell")):$th.index($target),r==-1)return;u={headerIndex:r,headerText:this.getColumnFieldNames()[r],headerCell:$th.eq(r),column:this.getColumnByIndex(r)}}else($target.is(".e-pager")||this.getPager()!=null&&this.getPager().has($target).length)&&(u={pager:this.model.pageSettings});this._trigger("rightClick",u)}},_touchGrid:function(n){var i=this._currentPage(),r=!0,t;(this.model.allowScrolling||this.model.isResponsive&&this.model.minWidth!=0)&&(t=(this.getScrollObject()||{})._scrollXdata,t&&(r=n.type=="swipeleft"?t.scrollable-t.sTop==0:t.sTop==0));switch(n.type){case"swipeleft":this.model.allowPaging&&i!=this.model.pageSettings.totalPages&&!this.model.isEdit&&r&&this.element.ejGrid("gotoPage",i+1);break;case"swiperight":this.model.allowPaging&&i>1&&!this.model.isEdit&&r&&this.element.ejGrid("gotoPage",i-1)}},_recorddblClickHandler:function(n){this._recordClickProcess(n,this,"recordDoubleClick")},_recordClickProcess:function(t,i,r){var c={},u=n(t.target).is(".e-rowcell")?n(t.target):n(t.target).closest("td"),o,e,h,a,v;if(u.closest(".e-grid").attr("id")===i._id&&(u.is(".e-rowcell")||u.closest("td").is(".e-rowcell"))&&!(u.closest(".e-editcell,.e-insertedrow").length>0)&&(o=i.model.detailsTemplate!=null||i.model.childGrid!=null?u.index()-1:u.index(),e=i.getColumnByIndex(o),i.model.editSettings.editMode!="batch"||e.allowEditing==!1||e.isPrimaryKey==!0)){var f=i.getIndexByRow(u.closest("tr")),l=i.getRowByIndex(f),s=i._currentJsonData[f];i.model.scrollSettings.allowVirtualScrolling&&(i.model.scrollSettings.enableVirtualization?(h=i._getSelectedViewData(f,u),s=h.data,f=h.rowIndex):(a=f%i.model.pageSettings.pageSize,v=(parseFloat(l.attr("name"))-(this.model.scrollSettings.enableVirtualization?1:0))/i.model.pageSettings.pageSize+1,s=i._virtualLoadedRecords[v][a]));c={rowIndex:f,row:l,data:s,cell:u,cellIndex:o,columnName:e.headerText,cellValue:u.text()};i._trigger(r,c)}},_invokeRecordClick:function(n,t){this._recordClickProcess(n,t,"recordClick")},_recordClick:function(i){this._click++;var r=this,u=null;r._click==1?n.inArray("recordClick",this.model.serverEvents)!==-1&&n.inArray("recordDoubleClick",this.model.serverEvents)!==-1?u=setTimeout(function(){r._click=0;r._invokeRecordClick(i,r)},400):(r._click=0,t.isNullOrUndefined(u)||clearTimeout(u),r._invokeRecordClick(i,r)):r._click==2&&(t.isNullOrUndefined(u)||clearTimeout(u),r._click=0)},_headerMouseDown:function(t){if(n(t.target).hasClass("e-headercelldiv")&&!n(t.target).parent().hasClass("e-grouptopleftcell")||n(t.target).hasClass("e-headercell")){var i=n(t.target).hasClass("e-headercelldiv")?n(t.target).parent():n(t.target);this.model.enableHeaderHover&&i.removeClass("e-hover e-headercell-hover").addClass("e-headercellactive e-active")}if(this.model.allowResizing)return this._resizer._mouseDown(t)},_contentMouseDown:function(i){var u,f,r;n(i.target).closest("td").hasClass("e-selectionbackground")||n(i.target).closest("tr").length&&(u=i.type=="touchstart"?i.originalEvent.touches[0].pageX:i.pageX,f=i.type=="touchstart"?i.originalEvent.touches[0].pageY:i.pageY,this._dragDiv=t.buildTag("div.e-griddragarea","",{position:"absolute",width:"0px",height:"0px"}),this.getContent().append(this._dragDiv),r=n(i.target).closest("tr.e-row"),r.length||(r=n(i.target).closest("tr.e-alt_row")),this._startIndex=r.length?this.getIndexByRow(r):null,this._on(n(document),"touchmove mousemove",this._mouseMoveDragHandler),t.isIOSWebView()||this.getBrowserDetails().browser!="safari"||this.model.contextMenuSettings.enableContextMenu||this._on(this.element,"contextmenu",function(n){n.preventDefault()}),this._on(n(document),"touchend mouseup",this._mouseUpDragHandler),this._startDrag={_x:u,_y:f})},_mouseMoveDragHandler:function(i){var c,e,v,l,f;if(i.pageY!=this._startDrag._y){c=i.type=="touchmove"?i.originalEvent.touches[0].pageX:i.pageX;e=i.type=="touchmove"?i.originalEvent.touches[0].pageY:i.pageY;this._selectDrag=!0;var y=this._dragDiv[0].offsetLeft,p=this._dragDiv[0].offsetTop,r=this._startDrag._x,u=this._startDrag._y,o=c,s=e,h,a=e+2;r>o&&(h=o,o=r,r=h);u>s&&(h=s,s=u,u=h,a=e-2);v=this._dragDiv.height();this._dragDiv.css({left:r,top:u,width:o-r,height:s-u});l=n(document.elementFromPoint(c,a));f=l.closest("tr.e-row");f.length||(f=l.closest("tr.e-alt_row"));f.length&&(this._endIndex=this.getIndexByRow(f),t.isNullOrUndefined(this._startIndex)&&(this._startIndex=this._endIndex),this.selectRows(this._startIndex,this._endIndex))}},_mouseUpDragHandler:function(i){this._off(n(document),"touchend mouseup",this._mouseUpDragHandler);this._off(n(document),"touchmove mousemove",this._mouseMoveDragHandler);t.isIOSWebView()||this.getBrowserDetails().browser!="safari"||this.model.contextMenuSettings.enableContextMenu||this._off(this.element,"contextmenu",function(n){n.preventDefault()});i.stopPropagation();this._selectDrag=!1;this._dragDiv.remove()},_headerHover:function(t){var i=n(t.target);t.type=="mouseover"||t.type=="mousemove"||t.type=="touchmove"||t.type=="MSPointerMove"?((this.model.allowResizing||this.model.allowResizeToFit)&&this._resizer._mouseHover(t),this.model.enableHeaderHover&&!this._dragActive&&(i.hasClass("e-headercelldiv")&&!i.parent().hasClass("e-grouptopleftcell")||i.hasClass("e-headercell"))&&(i.hasClass("e-headercelldiv")&&(i=i.parent()),this.getHeaderTable().find(".e-columnheader").find(".e-headercell-hover").removeClass("e-headercell-hover").removeClass("e-hover"),i.addClass("e-headercell-hover e-hover")),i.hasClass("e-gridtooltip")&&this._showTooltip(i),(i.hasClass("e-gridheadertooltip")||i.find(".e-gridheadertooltip").length)&&this._showTooltip(i,!0),t.type=="mouseover"&&this._addCursor()):this.model.enableHeaderHover&&this.getHeaderTable().find(".e-columnheader").find(".e-headercell-hover").removeClass("e-headercell-hover").removeClass("e-hover")},_addCursor:function(){var u=this.model.allowResizing||this.model.allowResizeToFit||this.model.allowGrouping||this.model.allowFiltering||this.model.allowSorting||this.model.allowReordering||this.model.contextMenuSettings.enableContextMenu||this._allowcolumnSelection,i,r,n;if(u){if(this.getHeaderTable().find(".e-columnheader").removeClass("e-defaultcursor"),!(this.model.contextMenuSettings.enableContextMenu||this.model.selectionSettings.selectionMode=="column")){for(i=[{val:this.model.allowSorting,str:"sort"},{val:this.model.allowGrouping,str:"group"},{val:this.model.allowReordering,str:"reorder"},{val:this.model.allowFiltering,str:"filter"}],r=0,n=0;n<i.length;n++)i[n].val==!1&&(i.splice(n,1),n--);for(n=0;n<this.model.columns.length&&i.length>0;n++){for(j=0;j<i.length;j++)switch(i[j].str){case"sort":t.isNullOrUndefined(this.model.columns[n].allowSorting)||this.model.columns[n].allowSorting||r++;break;case"group":t.isNullOrUndefined(this.model.columns[n].allowGrouping)||this.model.columns[n].allowGrouping||r++;break;case"reorder":t.isNullOrUndefined(this.model.columns[n].allowReordering)||this.model.columns[n].allowReordering||r++;break;case"filter":t.isNullOrUndefined(this.model.columns[n].allowFiltering)||this.model.columns[n].allowFiltering||r++}isTempCol=t.isNullOrUndefined(this.model.columns[n].template)&&t.isNullOrUndefined(this.model.columns[n].templateID)?!1:!0;r!=i.length||isTempCol||this.getHeaderTable().find(".e-headercell").eq(n).addClass("e-defaultcursor");r=0}}}else this.getHeaderTable().find(".e-columnheader").addClass("e-defaultcursor"),this.getHeaderTable().find(".e-headercell").removeClass("e-defaultcursor")},_colgroupRefresh:function(){var t,i,r,u;(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(t=n(this.getHeaderTable()).find("colgroup"),i=n(this.getContentTable()).find("colgroup")):(t=n(this.getHeaderTable()).find("colgroup")[0],i=n(this.getContentTable()).find("colgroup")[0]);r=n(t).clone();u=n(i).clone();n(i).remove();n(t).remove();(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(n(r[0]).prependTo(this.getHeaderTable()[0]),n(r[1]).prependTo(this.getHeaderTable()[1]),n(u[0]).prependTo(this.getContentTable()[0]),n(u[1]).prependTo(this.getContentTable()[1])):(n(r).prependTo(this.getHeaderTable()),n(u).prependTo(this.getContentTable()))},_detailColsRefresh:function(){this._$headerCols=this.getHeaderTable().children("colgroup").find("col");this._$contentCols=this.getContentTable().children("colgroup").find("col");var n=this.model.columns.length;this._$headerCols.length>n&&this._$headerCols.splice(0,this._$headerCols.length-n);this._$contentCols.length>n&&this._$contentCols.splice(0,this._$contentCols.length-n)},_summaryColRrefresh:function(){for(var t=this.getFooterContent().find(".e-gridsummary"),n=0;n<this.columnsWidthCollection.length;n++)t.find("col").eq(n).width(this.columnsWidthCollection[n])},_headerdblClickHandler:function(n){this.model.allowResizeToFit&&this._resizer._columnResizeToFit(n);this.model.allowScrolling&&this.getScrollObject().refresh(this.model.scrollSettings.frozenColumns>0)},_mouseUp:function(n){this.model.allowResizing&&this._resizer._mouseUp(n)},_mouseMove:function(n){this.model.allowResizing&&this._resizer._mouseMove(n)},_setModel:function(i){var u,y,p,tt,w,s,h,it,rt,ut,l,b,a,k,ft,e,et,f,c,v,ot,o,nt;for(u in i)switch(u){case"enableResponsiveRow":i[u]?(this.element.addClass("e-responsive"),this.model.minWidth&&(this._removeMedia(),this._scrollerAddedOnMedia=!1),this.model.allowFiltering&&(this.element.find(".e-filterDialoge").remove(),this._renderFilterDialogs(),this._renderResponsiveFilter(),this.element.find(".e-gridtoolbar").remove())):(this.model.allowFiltering&&(n("body").find(".e-filterDialoge").remove(),this._renderFilterDialogs()),this.element.css("display")=="none"&&this.element.css("display","block"),this.element.removeClass("e-responsive"),this.model.minWidth&&this._addMedia(),this.model.allowScrolling&&(this.getScrollObject().refresh(),this.getScrollObject().isVScroll()?this.getScrollObject().isVScroll()&&(this.getHeaderContent().addClass("e-scrollcss"),this.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):(this.getHeaderContent().removeClass("e-scrollcss"),this.getHeaderContent().find(".e-headercontent").removeClass("e-hscrollcss"))));this._tdsOffsetWidth=[];(this.model.allowFiltering||this.model.allowSorting)&&(y=this.model.toolbarSettings.toolbarItems.indexOf("responsiveFilter"),y!=-1&&this.model.toolbarSettings.toolbarItems.splice(y,1),p=this.model.toolbarSettings.toolbarItems.indexOf("responsiveSorting"),p!=-1&&this.model.toolbarSettings.toolbarItems.splice(p,1),this.element.find(".e-gridtoolbar").remove(),this._renderToolBar().insertBefore(this.element.find(".e-gridheader").first()));break;case"showColumnChooser":i[u]?(this._visibleColumns=[],this._hiddenColumns=[],this._visibleColumnsField=[],this._hiddenColumnsField=[],this._renderGridHeaderInternalDesign(this.model.columns),this._renderColumnChooser()):(tt=n("#"+this._id+"ccDiv").data("ejDialog"),tt.isOpened()&&n("#"+this._id+"_ccTail").remove(),w=0,t.isNullOrUndefined(this.element.find(".e-ccButton").outerHeight())||(w+=this.element.find(".e-ccButton").outerHeight()),this.element.find(".e-ccButton").remove(),n("#"+this._id+"ccDiv_wrapper").remove(),this.element.css("margin-top",parseInt(this.element.css("margin-top"),10)-w));break;case"gridLines":this.getContent().removeClass("e-horizontallines e-verticallines e-hidelines");this.getHeaderContent().removeClass("e-horizontallines e-verticallines e-hidelines");this._showHeaderGridLines();this._showGridLines();break;case"showDeleteConfirmDialog":this.model.editSettings.showDeleteConfirmDialog=i[u];i[u]?this._renderConfirmDialog():this.element.find("#"+this._id+"ConfirmDialog_wrapper").remove();break;case"showConfirmDialog":this.model.editSettings.showConfirmDialog=i[u];i[u]?this._renderConfirmDialog():this.element.find("#"+this._id+"ConfirmDialog_wrapper").remove();break;case"pageSettings":if(s=this.getPager().ejPager("model"),t.isNullOrUndefined(i[u].currentPage)||s.currentPage!=this._currentPage()){for(h in i[u])h!="currentPage"&&i[u][h]===s[h]&&delete i[u][h];if(n.isEmptyObject(i[u]))break;i[u].currentPage=this._currentPage();this.getPager().ejPager("option",i[u]);this._renderPagerTemplate(this.getPager(),i[u].showDefaults);this._currentPage(this._currentPage()>s.totalPages?s.totalPages:this._currentPage());this.refreshContent()}break;case"columns":it=i.columns;this.model.columns=[];this.columns(it,"add");break;case"allowPaging":this.model.allowPaging=i[u];i[u]&&this.element.children(".e-pager").length==0?(this.element.append(this._renderGridPager()),this.refreshContent(),this.getPager().ejPager("refreshPager")):(this.getPager().remove(),this.setGridPager(null),this.refreshContent(),this.model.filterSettings.filterType=="filterbar"&&this.model.allowFiltering&&this._createPagerStatusBar());break;case"allowSearching":this.model.allowSearching=i[u];break;case"searchSettings":n.extend(this.model.searchSetings,i[u]);this.refreshContent();break;case"allowGrouping":i[u]&&this.element.children(".e-groupdroparea").length==0?(this.model.allowGrouping=i[u],this.addGroupingTemplate(),this.model.showColumnChooser&&this.element.find(".e-ccButton").length>0?this.element.find(".e-ccButton").after(this._renderGroupDropArea()):this.element.prepend(this._renderGroupDropArea()),this._enableGroupingEvents(),this._headerCellgDragDrop(),this._off(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",this._dropAreaHover),this._on(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",this._dropAreaHover)):this.element.children(".e-groupdroparea").remove();this.model.allowGrouping&&(t.isNullOrUndefined(i.groupSettings)||n.extend(this.model.groupSettings,i.groupSettings),this._enableGrouping());break;case"groupSettings":n.extend(this.model.groupSettings,i[u]);this.model.allowGrouping&&t.isNullOrUndefined(i.allowGrouping)&&this._enableGrouping();t.isNullOrUndefined(this.model.groupSettings.enableDropAreaAnimation)||(this.model.groupSettings.enableDropAreaAutoSizing=this.model.groupSettings.enableDropAreaAnimation);break;case"cssClass":this.element.removeClass(this.model.cssClass).addClass(i[u]);break;case"allowFiltering":case"filterSettings":if(u=="filterSettings"?n.extend(this.model.filterSettings,i[u]):this.model.allowFiltering=i[u],this.filterColumnCollection=[],this._$fDlgIsOpen&&this._closeFDialog(),this.model.allowFiltering){if(this.model.filterSettings.filterType==t.Grid.FilterType.FilterBar)for(this.getHeaderTable().find(".e-filterbar").remove(),this.getHeaderTable().find(".e-columnheader").find(".e-filtericon").remove().end().find(".e-headercellfilter").removeClass("e-headercellfilter"),this._renderFiltering(),this._renderFilterBarTemplate(),this.model.filterSettings.showFilterBarStatus&&!this.model.allowPaging?this._createPagerStatusBar():this.model.allowPaging&&this.getPager().ejPager({enableExternalMessage:this.model.filterSettings.showFilterBarStatus}),rt=this.getHeaderTable().find(".e-filterbar"),f=0;f<this.model.groupSettings.groupedColumns.length;f++)rt.prepend(this._getEmptyFilterBarCell());else if(!ut&&(this.model.filterSettings.filterType==t.Grid.FilterType.Menu||this.model.filterSettings.filterType==t.Grid.FilterType.Excel)){for(ut=1,this.getHeaderTable().find(".e-columnheader").find(".e-filtericon").remove().end().find(".e-headercellfilter").removeClass("e-headercellfilter"),this.getHeaderTable().find(".e-filterbar").remove(),l=this.getHeaderTable().find(".e-columnheader").find(".e-headercell").not(".e-detailheadercell"),f=0;f<l.length;f++)b=l.eq(f).find(".e-headercelldiv").attr("ej-mappingname"),t.isNullOrUndefined(b)||(a=this.getColumnByField(b),!t.isNullOrUndefined(a)&&(t.isNullOrUndefined(a.allowFiltering)||a.allowFiltering)&&l.eq(f).addClass("e-headercellfilter").append(t.buildTag("div.e-filtericon e-icon e-filterset")));this.model.filterSettings.filterType==t.Grid.FilterType.Excel?(this._isExcelFilter=!0,this._renderExcelFilter()):this._isExcelFilter&&(this._isExcelFilter=!1,this._excelFilter.resetExcelFilter(),this._excelFilter=null);this.model.filterSettings.filterType==t.Grid.FilterType.Menu&&this._renderFilterDialogs();this.model.filterSettings.filteredColumns=[];this.refreshContent()}this._enableFilterEvents()}else this.model.filterSettings.filterType==t.Grid.FilterType.FilterBar?this.getHeaderTable().find(".e-filterbar").remove():(this.model.filterSettings.filterType==t.Grid.FilterType.Menu||this.model.filterSettings.filterType==t.Grid.FilterType.Excel)&&this.getHeaderTable().find(".e-columnheader").find(".e-filtericon").remove().end().find(".e-headercellfilter").removeClass("e-headercellfilter"),(this._isExcelFilter||this._excelFilterRendered)&&(this._isExcelFilter=this._excelFilterRendered=!1,this._excelFilter.resetExcelFilter(),this._excelFilter=null),this.model.filterSettings.filteredColumns=[],this.refreshContent();this.model.isResponsive&&this.model.allowScrolling&&(k={},k.requestType="filtering",this._refreshScroller(k));break;case"enableRowHover":this.model.enableRowHover=i[u];this._enableRowHover();break;case"allowScrolling":case"scrollSettings":if(e=this.getContent(),u!="allowScrolling"){if(!t.util.isNullOrUndefined(i.scrollSettings)){if(n.isEmptyObject(i.scrollSettings))break;t.util.isNullOrUndefined(i.scrollSettings.enableVirtualization)||t.util.isNullOrUndefined(i.scrollSettings.allowVirtualScrolling)||(i.scrollSettings.allowVirtualScrolling=i.scrollSettings.enableVirtualization);n.extend(this.model.scrollSettings,i.scrollSettings)}this._initHeight=this.model.scrollSettings.height;this._isHeightResponsive=this.model.scrollSettings.height=="100%"?!0:!1;this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this.model.currentIndex=1,this.model.scrollSettings.enableVirtualization?(this._virtualRowCount=Math.round(this.model.scrollSettings.height/this.getRowHeight())+1,this._refreshVirtualViewDetails(),this._refreshVirtualViewData()):(this._createPagerStatusBar(),this._showPagerInformation(this.model.pageSettings)));i.scrollSettings.frozenColumns!==r||i.scrollSettings.frozenRows!==r||i.scrollSettings.allowVirtualScrolling!==r||i.scrollSettings.virtualScrollMode!==r||i.scrollSettings.enableVirtualization!=r?(o=this.model,o.query=this.commonQuery.clone(),this._selectedRow()!=-1&&this.clearSelection(this._selectedRow()),i.scrollSettings.virtualScrollMode!=r&&(o.pageSettings.currentPage=1),this.element.ejGrid("destroy").ejGrid(o)):(t.util.isNullOrUndefined(i.allowScrolling)||(this.model.allowScrolling=i.allowScrolling),t.util.isNullOrUndefined(e.data("ejScroller"))||e.ejScroller("destroy"),this.model.allowScrolling?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this._originalScrollWidth=this.model.scrollSettings.width,this._renderScroller(),this.setWidthToColumns(),t.util.isNullOrUndefined(e.data("ejScroller"))||this.getScrollObject().refresh(),this.refreshScrollerEvent()):(this.element.children(".e-gridheader").removeClass("e-scrollcss"),this.element.get(0).style.width.length==0&&this.element.css("width","auto"),this.setWidthToColumns()),this._addLastRow())}break;case"currentIndex":this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization?(ft=Math.ceil(i.currentIndex/this._virtualRowCount),this._isThumbScroll=!0,this._refreshVirtualView(ft),this._refreshVirtualViewScroller(!0)):this._scrollObject.option("scrollTop",i.currentIndex*this.getRowHeight());break;case"locale":this.model.locale=i[u];this.model.query=this.commonQuery.clone();this._destroy();this.element.css("margin-top","0px").addClass("e-grid"+this.model.cssClass);this._init();break;case"dataSource":for(e=this.element.find(".e-gridcontent").first(),n.isFunction(i.dataSource)||this.resetModelCollections(),this._gridRecordsCount==1&&!t.isNullOrUndefined(this._cDeleteData)&&n.inArray(this._cDeleteData[0],this._dataSource())==-1&&this.model.editSettings.allowDeleting&&(this._gridRecordsCount=this._dataSource().length),f=0;f<this.model.columns.length;f++)this.model.columns[f].template!==r&&(this._columntemplaterefresh=!0);this._updateDataSource=!0;this._refreshDataSource(this._dataSource());this.element.children(".e-gridfooter").remove();this.model.showSummary&&this.model.currentViewData.length>0&&this._renderGridFooter().insertAfter(e);(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow();break;case"selectedRowIndex":this._selectedRow()!=-1&&n.inArray(this._selectedRow(),this.selectedRowsIndexes)==-1?(this.model.currentIndex=this._selectedRow(),this.selectRows(this._selectedRow())):this._selectedRow()==-1&&(this.clearSelection(),this.selectedRowsIndexes=[]);break;case"selectedRowIndices":if(this.model.allowSelection==!0&&this.model.selectionType=="multiple"&&this._selectedMultipleRows().length>0){for(this.clearSelection(),this.selectedRowsIndexes=this._selectedMultipleRows(),this._selectedMultipleRows(this.selectedRowsIndexes),f=0;f<this.selectedRowsIndexes.length;f++)et=this.getRowByIndex(this.selectedRowsIndexes[f]),et.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active");this.model.selectedRecords=this.getSelectedRecords()}else this._selectedMultipleRows().length==0&&(this.clearSelection(),this.selectedRowsIndexes=[]);break;case"editType":this._selectedRow()!=-1&&n.inArray(this._selectedRow(),this.selectedRowsIndexes)==-1&&this.selectRows(this._selectedRow());break;case"editSettings":n.extend(this.model.editSettings,i[u]);this.refreshToolbar();this.refreshContent(!0);this.refreshBatchEditMode();this._tdsOffsetWidth=[];n("#"+this._id+"_dialogEdit").data("ejDialog")&&n("#"+this._id+"_dialogEdit").ejDialog("destroy");n("#"+this._id+"_dialogEdit_wrapper,#"+this._id+"_dialogEdit").remove();n("#"+this._id+"_externalEdit").remove();this.getContentTable().find(".e-insertedrow").remove();this.model.isEdit=!1;this.model.editSettings.editMode!="normal"&&(this.model.editSettings.showAddNewRow=!1);this.model.editSettings.showAddNewRow||this.getContentTable().find(".e-addedrow").length&&this.cancelEdit();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?this.element.append(this._renderDialog()):(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&this.element.append(this._renderExternalForm()));(this.model.editSettings.allowDeleting&&this.model.editSettings.showDeleteConfirmDialog||this.model.editSettings.editMode=="batch"&&this.model.editSettings.showConfirmDialog)&&t.isNullOrUndefined(this._confirmDialog)&&this._renderConfirmDialog();this._enableEditingEvents();this.refreshToolbar();break;case"allowResizing":this.model.allowResizing=i[u];this.model.allowResizing?(this._on(this.element,t.eventType.mouseMove,this._mouseMove),this._on(this.element,"mouseup",this._mouseUp),this._resizer=this._resizer||new t.gridFeatures.gridResize(this)):(this._off(this.element,t.eventType.mouseMove,this._mouseMove),this._off(this.element,"mouseup",this._mouseUp),this.model.allowResizeToFit||(this._resizer=null));break;case"allowResizeToFit":this.model.allowResizeToFit?(this._on(this.element,"dblclick",".e-gridheader",this._headerdblClickHandler),this._resizer=this._resizer||new t.gridFeatures.gridResize(this),this.setWidthToColumns()):(this._off(this.element,"dblclick",".e-gridheader",this._headerdblClickHandler),this.model.allowResizing||(this._resizer=null));break;case"allowReordering":this.model.allowReordering=i[u];this.model.allowReordering&&this._headerCellreorderDragDrop();break;case"allowRowDragAndDrop":this.model.allowRowDragAndDrop?(this._rowsDragAndDrop(),this.model.selectionType=="multiple"&&this._on(this.element,"touchstart mousedown",".e-gridcontent",this._contentMouseDown),this.model.allowScrolling&&this.getContent().ejScroller({thumbStart:function(){return!1}})):(this._off(this.element,"touchstart mousedown",".e-gridcontent",this._contentMouseDown),this.getContentTable().ejDroppable("destroy"),n(this.getRows()).ejDraggable("destroy"),this.getContent().ejScroller({thumbStart:null}));break;case"showSummary":case"summaryRows":if(u=="showSummary"&&i[u]&&this.addSummaryTemplate(),u!="showSummary"||i[u]){if(u=="summaryRows"&&this.model.showSummary||u=="showSummary"){this.element.children(".e-gridfooter").remove();this.element.children(".e-gridfooter").remove();var e=this.element.find(".e-gridcontent").first(),d=this.model.query.queries,g=[];for(f=0;f<d.length;f++)d[f].fn==="onPage"&&(g=d.splice(f,1));c=this.model.query;this._setSummaryAggregate(c);g.length&&c.queries.push(g[0]);this.model.currentViewData.length&&(this._isLocalData?(this._remoteSummaryData=this._dataManager.executeLocal(c).aggregates,this._renderGridFooter().insertAfter(e)):(v=this,ot=this._dataManager.executeQuery(c),ot.done(function(n){v.element.children(".e-gridfooter").remove();v._remoteSummaryData=n.aggregates;v._renderGridFooter().insertAfter(e)})));this.model.allowGrouping&&(this._rowCol=this._captionSummary(),this._isCaptionSummary=(this._rowCol!=null&&this._rowCol.length)>0?!0:!1,this.refreshContent(!0))}}else this.element.children(".e-gridfooter").remove();break;case"enableAltRow":this.model.enableAltRow=i[u];this.addInitTemplate();this.refreshContent();break;case"toolbarSettings":n.extend(this.model.toolbarSettings,i[u]);this.element.children(".e-gridtoolbar").remove();this.model.toolbarSettings.showToolbar&&this._renderToolBar().insertBefore(this.element.find(".e-gridheader").first());break;case"allowSorting":this.model.allowSorting=i[u];this.model.allowSorting||this.clearSorting();break;case"selectionSettings":n.extend(this.model.selectionSettings,i[u]);this.clearSelection();this.clearCellSelection();this.clearColumnSelection();this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1;this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();break;case"sortSettings":n.extend(this.model.sortSettings,i[u]);this.refreshContent();break;case"contextMenuSettings":n.extend(this.model.contextMenuSettings,i[u]);!t.isNullOrUndefined(n("#"+this._id+"_Context").data("ejMenu"))&&n("#"+this._id+"_Context").ejMenu("destroy")&&n("#"+this._id+"_Context").remove();this.model.contextMenuSettings.enableContextMenu&&this._renderContext();break;case"enableRTL":this.model.enableRTL=i[u];o=this.model;o.query=this.commonQuery.clone();this.element.ejGrid("destroy");o.enableRTL?n("#"+this._id).addClass("e-rtl"):n("#"+this._id).removeClass("e-rtl");n("#"+this._id).ejGrid(o);break;case"enableTouch":this.model.enableTouch=i[u];this.model.enableTouch?(this._on(this.element,"swipeleft swiperight",".e-gridcontent .e-table",n.proxy(this._touchGrid,this)),this.element.removeClass("e-touch")):(this.element.addClass("e-touch"),this._off(this.element,"swipeleft swiperight",".e-gridcontent .e-table"));break;case"allowSelection":i[u]?(this._off(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",this._clickHandler),this._on(this.element,"click",this._clickHandler),this._initSelection()):(this.clearSelection(),this.clearCellSelection(),this.clearColumnSelection(),this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1);break;case"query":this.commonQuery=n.extend(!0,{},i[u]);break;case"showStackedHeader":case"stackedHeaderRows":this.model.showStackedHeader&&i.stackedHeaderRows&&i.stackedHeaderRows.length>0?(t.getObject("stackedHeaderRows.length",i)&&(this.model.stackedHeaderRows=i.stackedHeaderRows),this._refreshStackedHeader()):this.getHeaderTable().find(".e-stackedHeaderRow").remove();break;case"allowTextWrap":case"textWrapSettings":n.extend(this.model.textWrapSettings,i[u]);this._setTextWrap();break;case"rowTemplate":this.refreshContent(!0);break;case"detailsTemplate":this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0?(this._renderAlertDialog(),this._alertDialog.find(".e-content").text(this._getLocalizedLabels("FrozenNotSupportedException")),this._alertDialog.ejDialog("open")):(nt=this.element.children(".e-gridheader"),nt.find("div").first().empty().append(this._renderGridHeader().find("table")),this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&this._renderFiltering(),this.setGridHeaderContent(nt),this.refreshContent(!0),this.model.allowReordering&&this._headerCellreorderDragDrop(),this.model.allowGrouping&&this._headerCellgDragDrop())}},resetModelCollections:function(){this.model.groupSettings.groupedColumns=[];this.model.filterSettings.filteredColumns=[];this.filterColumnCollection=[];this.model.sortSettings.sortedColumns=[];this.model.pageSettings.currentPage=this.defaults.pageSettings.currentPage},_enableGrouping:function(){var r,f,u,e,i;if(this.refreshTemplate(),this.model.groupSettings.showToggleButton)for(r=0;r<this.model.columns.length;r++)f=this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").eq(r),u=this.model.columns[r].field,n.inArray(u,this._disabledGroupableColumns)!=-1||t.isNullOrUndefined(u)||u==""||f.find(".e-gridgroupbutton").length||(n.inArray(u,this.model.groupSettings.groupedColumns)!=-1?f.append(this._getToggleButton().addClass("e-toggleungroup")):f.append(this._getToggleButton().addClass("e-togglegroup")));if(this.model.groupSettings.showToggleButton||this.getHeaderTable().find(".e-gridgroupbutton").remove(),this.element.find(".e-groupdroparea").remove(),this.model.groupSettings.showDropArea&&(this.model.showColumnChooser&&this.element.find(".e-ccButton").length>0?this.element.find(".e-ccButton").after(this._renderGroupDropArea()):this.element.prepend(this._renderGroupDropArea()),t.gridFeatures.dragAndDrop&&(this._groupHeaderCelldrag(),this._headerCellgDragDrop())),!t.isNullOrUndefined(this.model.groupSettings.groupedColumns.length)&&this.model.groupSettings.groupedColumns.length){for(e={},e.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],e.requestType=t.Grid.Actions.Grouping,this.element.find(".e-groupdroparea").empty(),i=0;i<this.model.groupSettings.groupedColumns.length-1;i++)this._addColumnToGroupDrop(this.model.groupSettings.groupedColumns[i]);for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)t.isNullOrUndefined(this.getsortColumnByField(this.model.groupSettings.groupedColumns[i]))&&this.model.sortSettings.sortedColumns.push({field:this.model.groupSettings.groupedColumns[i],direction:t.sortOrder.Ascending});this._processBindings(e)}},addIgnoreOnExport:function(n){typeof n=="string"?this.ignoreOnExport.push(n):this.ignoreOnExport=this.ignoreOnExport.concat(n)},addIgnoreOnToolbarServerClick:function(n){typeof n=="string"?this.ignoreOnToolbarServerClick.push(n):this.ignoreOnToolbarServerClick=this.ignoreOnToolbarServerClick.concat(n)},_decode:function(t){return n("<div/>").html(t).text()},_htmlEscape:function(n){var t={"&":"&","<":"<",">":">",'"':""","'":"'"};return n.replace(/[&<>"']/g,function(n){return t[n]})},_mappingSelection:function(){var i,n;if(t.gridFeatures.selection&&this._enableCheckSelect){for(this.multiSelectCtrlRequest=!0,i=[],n=0;n<this._currentJsonData.length;n++)t.pvt.getObject(this._selectionMapColumn,this._currentJsonData[n])==!0&&i.push(n);this.selectedRowsIndexes=[];this._selectedRow(-1);this._selectionByGrid=!0;i.length&&this.selectRows(i);this._selectionByGrid=!1}},_headerCheckUpdateAll:function(n){for(var r=[],r=this._isLocalData?this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json:this._dataSource():this._currentJsonData,i=0;i<r.length;i++)r[i][this._selectionMapColumn]=n,this.batchChanges.changed.push(r[i]);this.batchSave();return},_getForeignKeyData:function(n){var r=this,f={},u,e;for(i=0;i<this.model.columns.length;i++)this.model.columns[i].foreignKeyValue&&this.model.columns[i].dataSource&&(u=t.isNullOrUndefined(r.model.columns[i].foreignKeyField)?r.model.columns[i].field:r.model.columns[i].foreignKeyField,e=this.model.columns[i].dataSource instanceof t.DataManager?this.model.columns[i].foreignKeyData:this.model.columns[i].dataSource,e.filter(function(e){var o=t.getObject(r.model.columns[i].field,n),s=!isNaN(parseFloat(o))&&isFinite(o)?parseFloat(o):o;e[u]==s&&(f[u]=e)}));return f},_foreignKeyBinding:function(i,r,u){var f,e,o=n("#"+u).ejGrid("instance"),s;return i=o.model.columns[i],s=i.dataSource instanceof t.DataManager?i.foreignKeyData:i.dataSource,s.filter(function(n){if(t.getObject(i.foreignKeyField,n)==r)return e=t.getObject(i.foreignKeyValue,n),f=i.type=="date"?new Date(e):e}),i.format&&(f=o.formatting(i.format,f,o.model.locale)),f},_checkForeignKeyBinding:function(){if(this.model.columns.length){var i,r,u,n;for(i=0,r=this.model.columns,u=r.length;i<u;i++)n=r[i],n.hasOwnProperty("foreignKeyField")&&n.dataSource instanceof t.DataManager&&this._relationalColumns.push({field:n.field,key:n.foreignKeyField,value:n.foreignKeyValue,dataSource:n.dataSource});this._$fkColumn=!0}},_setForeignKeyData:function(i){var s,w,l,h;if(this._relationalColumns.length){var a=this._relationalColumns,b=this._relationalColumns.length,c=[],o=this.model.currentViewData,u={},f,v,y,p,e=this;if(o.length==0)for(s=0,w=this.model.columns.length;s<w;s++)column=this.model.columns[s],!t.isNullOrUndefined(column.foreignKeyField)&&column.dataSource instanceof t.DataManager&&(column.foreignKeyData=[]);for(l=t.proxy(function(n){this._trigger("actionFailure",{requestType:"fetchingforeigndata",error:n.error})},this),this.element.ejWaitingPopup("model.showOnInit")||this.element.ejWaitingPopup("show"),h=0;h<b;h++)if(0 in o){if(f=a[h],u.field=f.field,u.keyField=f.key,u.valueField=f.value,u.dataSource=f.dataSource,u.query=(new t.Query).select([u.valueField,u.keyField]).foreignKey(u.keyField),y=t.distinct(o.level?o.records:o,u.keyField,!0),v=t.UrlAdaptor.prototype.getFiltersFrom(y,u.query),u.query.where(v),this._trigger("actionBegin",n.extend(u,{requestType:"fetchingforeigndata",column:this.getColumnByField(u.field)})))return;p=u.dataSource.ready===r?u.dataSource.executeQuery(u.query,null,l):u.dataSource.ready.fail(l);c.push(p)}n.when.apply(this,c).then(function(){var u,t,n,o,r,s;for(e.element.ejWaitingPopup("hide"),u=[].slice.call(arguments,0,arguments.length),n=0,o=c.length;n<o;n++)for(f=a[n],r=0,s=e.model.columns.length;r<s;r++)t=e.model.columns[r],t.foreignKeyField==f.key&&t.foreignKeyValue==f.value&&(t.foreignKeyData=u[n].result);e.initialRender?e._initGridRender():e.sendDataRenderingRequest(i)})}},_isRelationalRendering:function(n){return 0 in this._relationalColumns&&["add","beginedit","cancel"].indexOf(n.requestType)==-1}}}(jQuery,Syncfusion),function(n,t,r){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.edit={_processEditing:function(){var e=this._columnToSelect(),h=e.query,i=[],y=e.fields,f=[],p,o=this._relationalColumns,w=o.length,a,c,b,v,u,s,l,k;if(this.model.query._fromTable!=""&&h.from(this.model.query._fromTable),a=y.length,a&&f.push(this._dataManager.executeQuery(h)),w!=0)for(c=0;c<w;c++)obj=o[c],qry=(new t.Query).select([obj.key,obj.value]),p=obj.dataSource.ready===r?obj.dataSource.executeQuery(qry):obj.dataSource.ready,f.push(p);if(e.fieldsDrop.length)for(b=e.fieldsDrop.length,v=e.fieldsDrop,u=0;u<b;u++)s=[],l=this.getColumnByField(v[u]),t.isNullOrUndefined(t.getObject("editParams.fields.text",l))?i.push(v[u]):(k=l.editParams,i.push(k.fields)),i[u]instanceof Object?(s.push(i[u].text),s.push(i[u].value)):s.push(i[u]),h=(new t.Query).select(s),f.push(l.dataSource.executeQuery(h));f.length!=0?n.when.apply(this,f).then(t.proxy(function(){for(var r=[].slice.call(arguments,0,arguments.length),n=0,e=0,u=0,s=a,h,c=f.length;n<c;n++){while(s>0)t.createObject(y[--s],r[n].result,this._dropDownManager),h=!0;if(!h||n!=0){if(o.length!=e){obj=o[e];key=obj.key+"."+obj.value;t.createObject(key,r[n].result,this._dropDownManager);e++;continue}o.length==e&&i.length&&(i[u]instanceof Object?(t.createObject(i[u].text,r[n].result,this._dropDownManager),t.createObject(i[u].value,r[n].result,this._dropDownManager)):t.createObject(i[u],r[n].result,this._dropDownManager),u++)}}this._initiateTemplateRendering()},this)):this._initiateTemplateRendering()},_initiateTemplateRendering:function(){this.model.editSettings.editMode=="normal"?this.addEditingTemplate():this.model.editSettings.editMode=="batch"?this.addBatchEditTemplate():this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="inlineform"?this.addDialogEditingTemplate():this.addExternalDialogEditingTemplate();this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&this._startAdd()},addEditingTemplate:function(){var c,s,i,u,e,w,f,h;if(this.model.columns.length!=0){var o=t.buildTag("tbody"),v=t.buildTag("tr"),y=t.buildTag("td","",{},{colSpan:this.model.scrollSettings.frozenColumns>0?this.model.scrollSettings.frozenColumns:this.model.columns.length}),p=t.buildTag("form","",{},{id:this._id+"EditForm","class":"gridform"}),l=t.buildTag("table.e-table","",{},{cellspacing:.25}),b=t.buildTag("tbody"),a=t.buildTag("tr");for(o.append(v),v.append(y),y.append(p),c=n(document.createElement("colgroup")),p.append(l),l.append(c),b.append(a).appendTo(l),this.model.scrollSettings.frozenColumns>0&&(s=o.clone(),s.find("td").first().prop("colSpan",this.model.columns.length-this.model.scrollSettings.frozenColumns)),i=0;i<this.model.columns.length;i++)(u=t.buildTag("td.e-rowcell"),a.append(u.get(0)),this.model.columns[i].type!="checkbox"||this._isMapSelection)&&(t.isNullOrUndefined(this.model.columns[i].commands)&&(!this.model.columns[i].template||this.model.columns[i].template&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field)?this._initCellEditType(i,u):this.model.columns[i].template?(f={},e=this.model.columns[i].headerText,f["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this),n.views.helpers(f),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.match(/[^0-9\s\w]/g))||(e=e.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+e+i+"_Template").remove(),w=this._createTemplateElement(this.model.columns[i]),u.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+w.id+"')}}")):this.model.columns[i].commands&&(f={},f["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,n.views.helpers(f),n("#"+this._id+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(this.model.columns[i],i),u.addClass("e-unboundcell").addClass("e-"+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&u.addClass("e-frozenunbound"),this._isUnboundColumn=!0),this.model.columns[i].textAlign!=r&&u.css("text-align",this.model.columns[i].textAlign),this.model.columns[i].allowEditing==!1&&u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isPrimaryKey===!0&&u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isIdentity===!0&&(u.find(".e-field").addClass("e-identity"),this._identityKeys.push(n.trim(this.model.columns[i].field)),this._identityKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._identityKeys.sort()):n.uniqueSort(this._identityKeys.sort())),h=n(document.createElement("col")),this.model.columns[i].priority&&(u.addClass("e-table-priority-"+this.model.columns[i].priority),h.addClass("e-table-priority-"+this.model.columns[i].priority)),this.model.columns[i].visible===!1&&(h.css("display","none"),u.addClass("e-hide")),t.isNullOrUndefined(this.model.columns[i].cssClass)||u.addClass(this.model.columns[i].cssClass),!this.model.groupSettings.showGroupedColumn&&u.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[i].field+"'}}e-hide{{/if}}{{/for}}")&&h.css("display","none"),c.append(h),i==this.model.scrollSettings.frozenColumns-1&&(a=s.find("tr").last(),c=s.find("colgroup"),n.templates(this._id+"_JSONFrozenEditingTemplate",o.html()),o=s));n.templates(this._id+"_JSONEditingTemplate",o.html())}},addDialogEditingTemplate:function(){var i,o,y,e;if(this.model.columns.length!=0){var h=t.buildTag("div"),s=t.buildTag("form.gridform","",{},{id:this._id+"EditForm"}),l=t.buildTag("table","",{},{cellspacing:"14px"}),f,a,u,v,c;for(i=0;i<this.model.columns.length;i++)(this.model.columns[i].type!="checkbox"||this._isMapSelection)&&(this.model.editSettings.editMode=="dialog"?(v="tr",c="td"):v=c="div",f=t.buildTag(v),a=t.buildTag(c,"",{"text-align":"right"}).addClass("e-label"),u=t.buildTag(c,"",{"text-align":"left"}).addClass("e-rowcell"),f.is("div")&&f.addClass("e-gridFromDiv"),this.model.columns[i].priority&&this.model.editSettings.editMode=="inlineform"&&f.addClass("e-table-priority-"+this.model.columns[i].priority),f.append(a.get(0)).append(u.get(0)),this.model.columns[i].headerText==r&&(this.model.columns[i].headerText=this.model.columns[i].field),a.append("<label for='"+this.model.columns[i].field+"'>"+this.model.columns[i].headerText+"<\/label>"),t.isNullOrUndefined(this.model.columns[i].commands)&&(!this.model.columns[i].template||this.model.columns[i].template&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field)?this._initCellEditType(i,u):this.model.columns[i].template?(e={},o=this.model.columns[i].headerText,e["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this),n.views.helpers(e),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.match(/[^0-9\s\w]/g))||(o=o.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+o+i+"_Template").remove(),y=this._createTemplateElement(this.model.columns[i]),u.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+y.id+"')}}")):this.model.columns[i].commands&&(e={},e["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,n.views.helpers(e),n("#"+this._id+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(this.model.columns[i],i),u.addClass("e-unboundcell").addClass("e-"+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&u.addClass("e-frozenunbound"),this._isUnboundColumn=!0,f.addClass("e-hide")),this.model.columns[i].allowEditing==!1&&u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isIdentity===!0&&(u.find(".e-field").addClass("e-identity"),this._identityKeys.push(n.trim(this.model.columns[i].field)),this._identityKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._identityKeys.sort()):n.uniqueSort(this._identityKeys.sort())),this.model.columns[i].visible===!1&&f.addClass("e-hide"),t.isNullOrUndefined(this.model.columns[i].cssClass)||u.addClass(this.model.columns[i].cssClass),this.model.editSettings.editMode=="dialog"?(s.append(l),l.append(f)):s.append(f),s.appendTo(h),this.model.columns[i].isPrimaryKey===!0&&(u.find(".e-field").attr("disabled",!0).addClass("e-disable"),this._primaryKeys.push(n.trim(this.model.columns[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort())));this.model.editSettings.editMode=="dialog"&&s.append(l);h=this.renderDiaglogButton(s,h);n.templates(this._id+"_JSONDialogEditingTemplate",h.html())}},_editEventTrigger:function(n){if(n.requestType=="save"||n.requestType=="delete"){var i={data:n.data,previousData:n.previousData,action:n.action!==r?n.action:n.requestType};t.isNullOrUndefined(n.foreignKeyData)||(i.foreignKeyData=n.foreignKeyData);this._trigger("end"+i.action.charAt(0).toUpperCase()+i.action.slice(1),i)}},_compiledDropDownTemplate:function(i,r,u,f){var s={_gridFormatting:this.formatting},e,o;return n.views.helpers(s),e=t.buildTag("select"),o=t.buildTag("option",f!=null?"{{:~_gridFormatting('"+f+"',"+r+",'"+this.model.locale+"')}}":"{{:"+r+"}}",{},{value:"{{:"+i+"}}"}),e.append(o),n.templates(e.html())},_initCellEditType:function(i,u){var o=this.model.columns[i].field,a,nt,c,d,g,it,rt,f,h,w,l,y,s,e,k,ut,ft,et;this.model.columns[i].foreignKeyValue&&(this.model.columns[i].editType="dropdownedit");this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&(e=n.inArray(this.model.columns[i].field,this._dataSource().adaptor.value),e!=-1&&(a=this._dataSource().adaptor.value[e],nt=this._dataSource().adaptor.key[e]));this.model.columns[i].editTemplate&&(this.model.columns[i].editType="edittemplate");t.isNullOrUndefined(this.model.columns[i].editType)&&(this.model.columns[i].editType=this.model.columns[i].type=="date"||this.model.columns[i].type=="datetime"?this.model.columns[i].type+"picker":"stringedit");this.model.isResponsive&&u.attr("data-cell",this._decode(this.model.columns[i].headerText));var v=(o||"").split("."),tt=v.length-1,p="";for(t.isNullOrUndefined(o)||(o=o.replace(/[^a-z0-9\s_]/gi,""));tt;)p+="(",tt--;switch(this.model.columns[i].editType){case"edittemplate":c=this.model.columns[i].editTemplate.create;typeof c=="string"?(d=t.util.getObject(c,window),g=n.isFunction(d)?n(d()).attr({id:this._id+o,name:this.model.columns[i].field}):n(c).length==1&&n(c).get(0).tagName=="SCRIPT"?n(n(c).html()).attr({id:this._id+o,name:this.model.columns[i].field}):n(c).attr({id:this._id+o,name:this.model.columns[i].field})):g=n(c()).attr({id:this._id+o,name:this.model.columns[i].field});u.append(g);break;case"stringedit":u.html(t.buildTag("input.e-field e-ejinputtext","",{},{value:"{{html:"+p+"#data['"+v.join("'] || {})['")+"']}}",id:this._id+o,name:this.model.columns[i].field}));break;case"booleanedit":u.html('{{if #data["'+v.join('"]["')+'"]}} <input class="e-field e-checkbox" type ="checkbox" id='+this._id+o+" name="+this.model.columns[i].field+' checked="checkbox"><\/input>{{else}} <input class="e-field e-checkbox" type ="checkbox" id='+this._id+o+" name="+this.model.columns[i].field+" > {{/if}}");this.model.editSettings.editMode=="normal"&&u.addClass("e-boolcell");break;case"numericedit":it=t.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:"+p+"#data['"+v.join("'] || {})['")+"']}}",id:this._id+o,name:this.model.columns[i].field});u.append(it);break;case"datepicker":case"datetimepicker":rt=t.buildTag("input.e-"+this.model.columns[i].editType+" e-field","",{},{type:"text",value:"{{:"+p+"#data['"+v.join("'] || {})['")+"']}}",id:this._id+o,name:this.model.columns[i].field});u.append(rt);break;case"dropdownedit":if(f=this.model.columns[i],h=[],t.isNullOrUndefined(f.dataSource)){if(t.isNullOrUndefined(f.dataSource)&&this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a&&(data=this.model.dataSource.adaptor.foreignData[e],$foreignkeyfield=this.model.dataSource.adaptor.key[e],$foreignkeyvalue=this.model.dataSource.adaptor.value[e],h=data),l=f.field,t.isNullOrUndefined(t.getObject(l,this._dropDownManager)))return;if(w=t.getObject(l,this._dropDownManager),y=0 in w&&typeof w[0]=="object",s=s=t.dataUtil.mergeSort(t.distinct(w,y?l:r,y?!1:r)),h.length==0)if(t.isNullOrUndefined(f.dataSource)&&this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a)for(e=0;e<s.length;e++)h.push({text:s[e][0],value:s[e][1]});else for(e=0;e<s.length;e++)h.push({text:s[e],value:s[e]})}else if(t.isNullOrUndefined(f.foreignKeyField)&&f.dataSource instanceof t.DataManager){var l=f.field,b=t.getObject(l,this._dropDownManager),y=0 in b&&typeof b[0]=="object",s=s=t.dataUtil.mergeSort(t.distinct(b,y?l:r,y?!1:r));if(t.isNullOrUndefined(t.getObject("editParams.fields.text",f))||(h=b),h.length==0)for(e=0;e<s.length;e++)h.push({text:s[e],value:s[e]})}else h=!t.isNullOrUndefined(f.foreignKeyField)&&f.field in this._dropDownManager?t.getObject(f.foreignKeyField+"."+f.foreignKeyValue,this._dropDownManager):f.dataSource;ut=t.isNullOrUndefined(f.foreignKeyField)?f.field:f.foreignKeyField;f.foreignKeyValue?k=this._compiledDropDownTemplate(ut,f.foreignKeyValue,f.type,f.format):this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a?k=this._compiledDropDownTemplate($foreignkeyfield?$foreignkeyfield:"value",$foreignkeyvalue?$foreignkeyvalue:"text",f.type,f.format):(ft=t.getObject("editParams.fields.value",f)||"value",et=t.getObject("editParams.fields.text",f)||"text",k=this._compiledDropDownTemplate(ft,et,f.type,f.format));u.get(0).innerHTML=!t.isNullOrUndefined(f.editParams)&&this._dataSource()instanceof t.DataManager&&this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&f.field==a?"<input data-value='{{:"+nt+"}}'/>":["<select>",k.render(h),"<\/select>"].join("");u.find("select,input").prop({id:this._id+o,name:f.field}).addClass("e-field e-dropdownlist")}},addBatchEditTemplate:function(){if(this.model.columns.length!=0){for(var u=t.buildTag("div","",{display:"none"},{id:this._id+"_BulkEditTemplate"}),r,i=0,f=this.model.columns.length;i<f;i++)(t.isNullOrUndefined(this.model.columns[i].commands)&&t.isNullOrUndefined(this.model.columns[i].template)||this.model.columns[i].template&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field)&&(r=t.buildTag("div","",{},{id:this.model.columns[i].field.replace(/\./g,t.pvt.consts.complexPropertyMerge)+"_BulkEdit"}),this._initCellEditType(i,r),u.append(r)),this.model.columns[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(this.model.columns[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort())),this.model.columns[i].isIdentity===!0&&(r.find(".e-field").addClass("e-identity"),this._identityKeys.push(n.trim(this.model.columns[i].field)),this._identityKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._identityKeys.sort()):n.uniqueSort(this._identityKeys.sort()));u.children().length&&(this._bulkEditTemplate=u)}},addExternalDialogEditingTemplate:function(){var e,i,u,r,f;if(this.model.columns.length!=0){for(e=t.buildTag("td","",{"text-align":"left"}).addClass("e-rowcell"),i=0;i<this.model.columns.length;i++)(this.model.columns[i].type!="checkbox"||this._isMapSelection)&&(t.isNullOrUndefined(this.model.columns[i].commands)&&!t.isNullOrUndefined(this.model.columns[i].template)&&this.model.columns[i].allowEditing!=!1&&this.model.columns[i].field&&!t.isNullOrUndefined(this.model.columns[i].editTemplate)&&this._initCellEditType(i,e),this.model.columns[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(this.model.columns[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort())));u=t.buildTag("div","",{display:"none"});r=t.buildTag("form.gridform","",{},{id:this._id+"EditForm"});this.model.editSettings.editMode=="dialogtemplate"&&this.model.editSettings.dialogEditorTemplateID!=null?f=this.model.editSettings.dialogEditorTemplateID:this.model.editSettings.editMode=="externalformtemplate"&&this.model.editSettings.externalFormTemplateID!=null?(f=this.model.editSettings.externalFormTemplateID,r.addClass("e-display")):(f=this.model.editSettings.inlineFormTemplateID,r.addClass("e-display"));r.html(n(f).html());u=this.renderDiaglogButton(r,u);n.templates(this._id+"_JSONdialogTemplateMode",u.html())}},_editdblClickHandler:function(t){var i=n(t.target);i.closest(".e-grid").attr("id")===this._id&&(i.hasClass("e-rowcell")||i.closest("td").hasClass("e-rowcell"))&&(!this.model.isEdit||this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal")&&(this._$currentTr=this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0?this.getRowByIndex(i.closest("tr").index()):i.closest("tr"),this.startEdit(this._$currentTr))},_columnToSelect:function(){for(var r=[],u=[],f=this.model.columns,i=0;i<this.model.columns.length;i++)this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&n.inArray(this.model.columns[i].field,this._dataSource().adaptor.value)!=-1&&t.isNullOrUndefined(this.model.columns[i].editType)&&(this.model.columns[i].editType="dropdownedit"),this.model.columns[i].editType===t.Grid.EditingType.Dropdown&&t.isNullOrUndefined(this.model.columns[i].dataSource)&&r.push(this.model.columns[i].field),f[i].editType===t.Grid.EditingType.Dropdown&&t.isNullOrUndefined(f[i].foreignKeyField)&&f[i].dataSource instanceof t.DataManager&&u.push(this.model.columns[i].field);return r.length?{query:t.Query().select(r),fields:r,fieldsDrop:u}:{query:t.Query(),fields:[],fieldsDrop:u}},_renderExternalForm:function(){var f=t.buildTag("div","",{display:"none"},{id:this._id+"_externalEdit","class":"e-form-container"}),n=t.buildTag("div","","",{id:this._id+"_eFormHeader","class":"e-form-titlebar"}),e=t.buildTag("span","","",{"class":"e-form-title"}),i=t.buildTag("div","","",{id:this._id+"_eFormToggleBtn","class":"e-form-togglebtn"}),o=t.buildTag("span","","",{"class":"e-form-toggle-icon e-icon"});i.append(o);n.append(e).append(i);var r=t.buildTag("div","","",{id:this._id+"_eFormContent","class":"e-form-content"}),u=t.buildTag("div","","",{id:this._id+"_externalForm","class":"e-externalform"}),s=t.buildTag("div","","",{"class":"e-externalformedit"});return u.append(s),r.append(u),f.append(n).append(r)},_buttonClick:function(t){if(t.type=="close"){if(!this.model.isEdit)return;this.model.isEdit=!1;this.element.ejGrid("cancelEdit");this.refreshToolbar();return}if(t.keyCode!==r&&t.keyCode!=13||this.model==null)return!0;this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?t.target.id=="EditDialog_"+this._id+"_Save"?this.element.ejGrid("endEdit"):t.target.id=="EditDialog_"+this._id+"_Cancel"&&(this.element.ejGrid("cancelEdit"),n("#"+this._id+"_dialogEdit").ejDialog("close")):this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"?n(t.target).hasClass("e-form-toggle-icon")?(this.element.ejGrid("cancelEdit"),n("#"+this._id+"_externalEdit").css("display","none")):t.target.id=="EditExternalForm_"+this._id+"_Save"?this.element.ejGrid("endEdit").length!==r&&n("#"+this._id+"_externalEdit").css("display","none"):t.target.id=="EditExternalForm_"+this._id+"_Cancel"&&(this.element.ejGrid("cancelEdit"),n("#"+this._id+"_externalEdit").css("display","none")):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?t.target.id=="InlineEditForm_"+this._id+"_Save"?this.element.ejGrid("endEdit"):t.target.id=="InlineEditForm_"+this._id+"_Cancel"&&this.element.ejGrid("cancelEdit"):this.element.ejGrid("cancelEdit")},_enableEditingEvents:function(){if(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding){if(this.model.editSettings.allowEditing&&this.model.editSettings.editMode!="batch"&&this.model.editSettings.allowEditOnDblClick?this._on(this.element,n.isFunction(n.fn.doubletap)&&this.model.enableTouch?"doubletap":"dblclick",".e-gridcontent",this._editdblClickHandler):(this._off(this.element,"dblclick",".e-gridcontent"),this._off(this.element,"doubletap",".e-gridcontent")),this._off(n("#"+this._id+"_dialogEdit"),"click ","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel"),this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate")this._on(n("#"+this._id+"_dialogEdit"),"click ","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel",this._buttonClick);else if(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"){this._on(n("#"+this._id+"_externalEdit"),"click ","#EditExternalForm_"+this._id+"_Save ,#EditExternalForm_"+this._id+"_Cancel",this._buttonClick);n(this.element).on("click",".e-form-toggle-icon",n.proxy(this._buttonClick,this))}else if(this.model.editSettings.editMode=="batch")this._on(n(document),"mousedown",this._saveCellHandler),this._batchEnabled=!0;else if(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")n(this.element).on("click ","#InlineEditForm_"+this._id+"_Save ,#InlineEditForm_"+this._id+"_Cancel",n.proxy(this._buttonClick,this));this.model.editSettings.editMode!="batch"&&this._batchEnabled&&(this._off(n(document),"mousedown",this._saveCellHandler),this._batchEnabled=!1)}else this._off(n("#"+this._id+"_dialogEdit"),"click","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel"),n(this.element).off("click",".e-icon"),this._off(n("#"+this._id+"_externalEdit"),"click","#EditExternalForm_"+this._id+"_Save ,#EditExternalForm_"+this._id+"_Cancel"),n(this.element).off("click",".e-form-toggle-icon"),n(this.element).off("click","#InlineEditForm_"+this._id+"_Save ,#InlineEditForm_"+this._id+"_Cancel")},_multiRowDelete:function(){var i={},n,r,u;if(i.added=[],i.deleted=[],i.changed=[],i.deleted=this.getSelectedRecords(),n={},n.data=this.getSelectedRecords(),n.tr=this.getSelectedRows(),r=this._getForeignKeyData(n.data),t.isNullOrUndefined(r)||(n.foreignKeyData=r),n.requestType="delete",this._trigger("actionBegin",n))return!0;u=this;this._sendBulkReuqest(i,n)},deleteRow:function(i){var c,s,f,u,h,e,o;if(this.model.editSettings.allowDeleting&&(!this.model.isEdit||this.model.editSettings.editMode=="batch"||this.model.editSettings.showAddNewRow)){if(this.model.editSettings.showDeleteConfirmDialog&&!this._confirmDialog.is(":visible")){this._cDeleteData=i;this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open");return}if(n.isArray(i))this.selectRows(i),this._multiRowDelete();else if(this.model.editSettings.editMode=="batch")this._bulkDelete(this.getIndexByRow(i));else{if(this._primaryKeys.length==0&&!this.model.editSettings.allowEditing&&!this.model.editSettings.allowAdding)for(f=0;f<this.model.columns.length;f++)this.model.columns[f].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(this.model.columns[f].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort()));if(this._selectedRow()==-1&&t.isNullOrUndefined(i)){alert(this.localizedLabels.DeleteOperationAlert);return}for(t.isNullOrUndefined(i)&&(i=this.model.scrollSettings.enableVirtualization?this.getContentTable().find("tr[aria-selected='true']"):this.getRowByIndex(this._selectedRow())),this._primaryKeyValues=[],this._getPrimaryKeyValues(i),c=t.DataManager(this._currentJsonData),s=new t.Query,f=0;f<this._primaryKeys.length;f++)s=s.where(this._primaryKeys[f],t.FilterOperators.equal,this._primaryKeyValues[f]);if(currentData=c.executeLocal(s),u={},u.tr=i,u.data=currentData[0],h=this._getForeignKeyData(u.data),t.isNullOrUndefined(h)||(u.foreignKeyData=h),u.requestType=t.Grid.Actions.Delete,this._trigger("actionBegin",u))return!0;this._cDeleteData=currentData;!(t.isOnWebForms&&this.model.serverEvents&&this.model.serverEvents.indexOf("endDelete")!=-1)&&this._dataSource()instanceof t.DataManager&&!this._dataManager.dataSource.offline&&this._dataManager.dataSource.json!==r||this._dataSource().adaptor instanceof t.remoteSaveAdaptor?(e=this._dataManager.remove(this._primaryKeys[0],this._primaryKeys.length?t.getObject(this._primaryKeys[0],currentData[0]):null,this.model.query),o=this,n.isFunction(e.promise)?(e.done(function(){o._processBindings(u);o._primaryKeyValues=[];o._cDeleteData=null}),e.fail(function(n){u.error=n;o._trigger("actionFailure",u)})):this._processBindings(u)):this._processBindings(u);e!=r&&n.isFunction(e.promise)||(this._primaryKeyValues=[],this._cDeleteData=null)}}},_htmlEncode:function(n){return str=n,t.isNullOrUndefined(str)||(str=isNaN(str)?str.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"):str),str},startEdit:function(i){if(this.model.editSettings.allowEditing&&(!this.model.editSettings.showAddNewRow||this.model.editSettings.editMode!="normal"||!this._excludeDetailRows().hasClass("e-editedrow"))&&!this.element.ejWaitingPopup("model.showOnInit")){if(this._selectedRow()==-1&&t.isNullOrUndefined(i)){alert(this.localizedLabels.EditOperationAlert);return}if(this.model.scrollSettings.enableVirtualization&&t.isNullOrUndefined(i)&&(i=this.getContentTable().find("tr[aria-selected='true']")),t.isNullOrUndefined(i)?(this._currentTrIndex=this._selectedRow(),this._$currentTr=this.getRowByIndex(this._currentTrIndex)):(this._currentTrIndex=this.getIndexByRow(i),this._$currentTr=i),!n(this._$currentTr).is(":visible"))return!1;this._primaryKeyValues=[];this._getPrimaryKeyValues(this._$currentTr);var u=this._editedData=this._currentJsonData[this._currentTrIndex],r={row:this._$currentTr,rowIndex:this._currentTrIndex,primaryKey:this._primaryKeys,primaryKeyValue:this._primaryKeyValues,rowData:u},f=this._trigger("beginEdit",r);if(f){this._primaryKeyValues=[];return}r.requestType=t.Grid.Actions.BeginEdit;this._processBindings(r)}},_getPrimaryKeyValues:function(i){var u,f,o=i.attr("name"),s,r,h,c=!1,e;for(this._lastVirtualPage=null,e=0;e<this._primaryKeys.length;e++)s=this.getColumnByField(this._primaryKeys[e]),u=this.getIndexByRow(i),f=this._currentJsonData,this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization?(u=u%this._virtualRowCount,r=parseInt(o,32)):(u=u%this.model.pageSettings.pageSize,r=parseFloat(o)/this.model.pageSettings.pageSize+1,this._currentJsonData=this._virtualLoadedRecords[r],r!=this.model.pageSettings.totalPages||this._prevPageRendered||this._virtualLoadedRecords[r].length==this.model.pageSettings.pageSize||(f=n.extend(!0,[],this._previousPageRecords),h=n.extend(!0,[],this._virtualLoadedRecords[r]),t.merge(f,h),this._lastVirtualPage=this._currentJsonData=n.extend(!0,[],f),c=!0)),f=c?f:this._virtualLoadedRecords[r],this._vCurrentTrIndex=u,this._currentVIndex=r),this._primaryKeyValues.push(this._htmlEncode(t.getObject(s.field,f[u])))},_startAdd:function(){var f,r,u,e,i,h,o,c,s,l;if(this.model.editSettings.allowAdding)if(this._isAddNew=!0,this.model.editSettings.editMode=="batch")this._bulkAddRow();else{for(f={},r=this.model.columns,i=0;i<r.length;i++)t.isNullOrUndefined(this.model.parentDetails)||r[i].field!=this.model.parentDetails.parentKeyField||(r[i].defaultValue=this.model.parentDetails.parentKeyFieldValue),!t.isNullOrUndefined(r[i].field)&&r[i].field.indexOf(".")>0?t.createObject(r[i].field,r[i].defaultValue||"",f):f[r[i].field]=t.isNullOrUndefined(r[i].defaultValue)?r[i].type=="date"||r[i].type=="datetime"?null:"":r[i].defaultValue;if(u={},e={},u.data=f,this.model.editSettings.editMode.indexOf("template")!=-1)for(i=0;i<this.model.columns.length;i++)t.isNullOrUndefined(this.model.columns[i].field)||this.model.columns[i].field.indexOf(".")==-1||(h=this.model.columns[i].field.split("."),t.createObject(this.model.columns[i].field,u.data[this.model.columns[i].field],e),u.data[h[0]]=e,delete u.data[this.model.columns[i].field]);o=this._getForeignKeyData(u.data);t.isNullOrUndefined(o)||(u.foreignKeyData=o);u.requestType="add";this.clearSelection();this.model.selectionSettings.selectionMode.indexOf("cell")!=-1&&this.clearCellSelection();this.model.scrollSettings.allowVirtualScrolling&&(this._currentVIndex=null,this._lastVirtualPage=null,this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(1):this._virtualLoadedRecords[1]?this._currentPage(1):this.gotoPage(1),this.getScrollObject().scrollY(0));c=this._processBindings(u);c||(this.model.editSettings.showAddNewRow?this._selectedRow(-1):this._selectedRow(0));s=this.model.groupSettings.groupedColumns.length;s>1&&(l=this.getContentTable().find(".e-addedrow").find("table").find("colgroup").children(),n(l.slice(0,s-1)).css("width",this.getHeaderTable().find("colgroup").children()[0].style.width))}},endEdit:function(){var e,c,w,b,l,a,k,s,nt,v,y,rt,p,ut,h,tt,ft,it,et;if(this.model.isEdit){if(b=0,!this.editFormValidate())return!0;if(l={},this.model.editSettings.editMode=="batch")this.saveCell();else{for(this._isAddNew&&(this._isEditChangesApplied=!0),this.model.editSettings.showAddNewRow&&(w=this.getContentTable().find(".e-editedrow")),e=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):!t.isNullOrUndefined(w)&&w.length==1?w[0].lastChild.lastChild:document.getElementById(this._id+"EditForm"),c=n(e),a=this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?c.closest("tr"):c.closest("div"),a.find("td.e-rowcell").removeClass("e-validError"),e=this.model.scrollSettings.frozenColumns>0?e[0]:e,s=0;s<e.length;s++)if(!a.hasClass("e-addedrow")||!n(e[s]).hasClass("e-identity")){var f=e[s].name,o=n(e[s]),u=this.getColumnByField(f);if(!o.hasClass("e-dropdownlist e-input")||o.attr("id").indexOf("_input")==-1||!t.isNullOrUndefined(c[1])){if(f!=r&&f!=""&&l[f]==null){u=this.getColumnByField(f);var i=e[s].value,d=e[s].type,g=n(e[s]).is(":checked"),k=u?u.originalType:null;if(n(e[s]).attr("type")=="hidden"&&t.isNullOrUndefined(o.attr("value")))continue;if(t.isNullOrUndefined(u)||u.editType!="edittemplate")n(e[s]).hasClass("e-datepicker")?(i=o.ejDatePicker("model.value"),this._isEditChangesApplied||(colFormat=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(u.format)?u.format:"{0:MM/dd/yyyy}",this.formatting(colFormat,i,this.model.locale)!=this.formatting(colFormat,this._editedData[f],this.model.locale)&&(this._isEditChangesApplied=!0))):n(e[s]).hasClass("e-datetimepicker")?(i=o.ejDateTimePicker("model.value"),this._isEditChangesApplied||(colFormat=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(u.format)?u.format:"{0:MM/dd/yyyy hh:mm:ss}",this.formatting(colFormat,i,this.model.locale)!=this.formatting(colFormat,this._editedData[f],this.model.locale)&&(this._isEditChangesApplied=!0))):o.is(".e-numerictextbox")?(i=o.ejNumericTextbox("getValue"),t.isNullOrUndefined(u)||u.type!="string"||t.isNullOrUndefined(i)||(i=i.toString()),this._isEditChangesApplied||this._editedData[f]==i||(this._isEditChangesApplied=!0)):(o.data("ejDropDownList")||o.is(".e-dropdownlist"))&&(o.is(":hidden")&&o.is("input")&&t.isNullOrUndefined(o.data("ejDropDownList"))&&(o=o.siblings(".e-dropdownlist")),i=o.ejDropDownList("getSelectedValue"),t.isNullOrUndefined(u)||t.isNullOrUndefined(u.format)||u.type!="date"&&u.type!="datetime"||(i=i.length>0?new Date(i):i),this._isEditChangesApplied||this._editedData[f]==i||(this._isEditChangesApplied=!0));else if(nt=n(e[s]).attr("type")=="hidden",n(e[s]).is("#"+this._id+f)||nt)v=u.editTemplate.read,o=n(e[s]),o=nt?n(e[s]).siblings("#"+this._id+f).length?n(e[s]).siblings("#"+this._id+f):o:o,typeof v=="string"&&(v=t.util.getObject(v,window)),i=v(o),this._isEditChangesApplied||typeof this._editedData[f]!="object"?this._isEditChangesApplied||u.type!="number"?this._isEditChangesApplied||u.type!="string"?this._isEditChangesApplied||u.type!="boolean"||this._editedData[f]!=i&&(this._isEditChangesApplied=!0):this._editedData[f]!=i&&(this._isEditChangesApplied=!0):(rt=typeof i=="string"?+i:i,this._editedData[f]!=rt&&(this._isEditChangesApplied=!0)):(y="",u.type=="date"||u.type=="datetime"?(u.type=="date"&&(y=t.isNullOrUndefined(u.format)?"{0:MM/dd/yyyy}":u.format),u.type=="datetime"&&(y=t.isNullOrUndefined(u.format)?"{0:MM/dd/yyyy hh:mm:ss}":u.format),this.formatting(y,this._editedData[f],this.model.locale)!=this.formatting(y,i,this.model.locale)&&(this._isEditChangesApplied=!0)):JSON.stringify(this._editedData[f])!=JSON.stringify(i.split(","))&&(this._isEditChangesApplied=!0));else continue;k&&(i=k=="number"?+i:k=="boolean"?i===this.localizedLabels.True?!0:!1:k==="date"?new Date(i):i);u==null?i=!isNaN(parseFloat(i))&&isFinite(i)?parseFloat(i):i:u.type=="number"&&!t.isNullOrUndefined(i)&&i.length&&(i=t.parseFloat(i,this.model.locale),this._isEditChangesApplied||this._editedData[f]==i||(this._isEditChangesApplied=!0));typeof i!="string"||i.length||(i=null);this._isEditChangesApplied||t.isNullOrUndefined(u)||u.type!="string"||this._editedData[f]==i||(this._isEditChangesApplied=!0);this._isEditChangesApplied||t.isNullOrUndefined(u)||u.type!="date"||u.editType!="stringedit"||u.format!=null&&this.formatting(u.format,this._editedData[f],this.model.locale)!=i&&(this._isEditChangesApplied=!0);(d!="checkbox"&&!t.isNullOrUndefined(i)&&i!==""||g)&&b++;p=d=="checkbox"&&(t.isNullOrUndefined(u)||u.type=="boolean")?g:i;this._isEditChangesApplied||t.isNullOrUndefined(u)||u.type!="boolean"||(ut=d=="checkbox"?g:JSON.parse(i),this._editedData[f]!=ut&&(this._isEditChangesApplied=!0));this._isEditChangesApplied||typeof p!="string"||typeof this._editedData[f]!="string"||this._editedData[f]==p||(this._isEditChangesApplied=!0);f.indexOf(".")!=-1?t.createObject(f,p,l):l[f]=p}s==e.length-1&&c.length>1&&c.index(e)==0&&(e=c[1],s=-1)}}if(h={data:l},tt=this._getForeignKeyData(h.data),t.isNullOrUndefined(tt)||(h.foreignKeyData=tt),h.requestType=t.Grid.Actions.Save,h.selectedRow=this._selectedRow(),h.previousData=jQuery.extend({},this.model.currentViewData[h.selectedRow]),this._trigger("actionBegin",h))return!0;if(a.hasClass("e-editedrow")?(this._cModifiedData=l,h.action="edit"):a.hasClass("e-addedrow")&&(b&&(this._cAddedRecord=l),h.action="add"),h.action=="add"&&this.editFormValidate()&&(t.isNullOrUndefined(this.model.queryString)||(ft=this.model.foreignKeyField||this.model.queryString,h.data[ft]=this.model.parentDetails.parentRowData[this.model.queryString]),!b))return elements=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):n("#"+this._id+"EditForm"),it=t.buildTag("div"),elements.addClass("field-validation-empty"),et=elements.find("input:visible").not(".e-identity").first(),this._renderValidator(it,et),$errorMessage=t.buildTag("div.e-field-validation-error",this.localizedLabels.EmptyRowValidationMessage),$tail=n(it).find(".e-errortail"),$errorMessage.insertAfter($tail),$errorMessage.css("display","block"),!1;(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none");this._isAddNew||this._isEditChangesApplied?(this._isEditChangesApplied=!1,this._updateAction(h)):this.cancelEdit()}}},_updateAction:function(i){var f,u;this._dataSource()instanceof t.DataManager&&!this._dataManager.dataSource.offline&&this._dataManager.dataSource.json!==r||this._dataSource().adaptor instanceof t.remoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor?this.model.editSettings.editMode=="batch"?(this.batchChanges.added.push(i.data),this.batchSave()):(t.isNullOrUndefined(this._cModifiedData)||t.isOnWebForms&&this.model.serverEvents&&this.model.serverEvents.indexOf("endEdit")!=-1?t.isOnWebForms&&this.model.serverEvents&&this.model.serverEvents.indexOf("endAdd")!=-1||(f=this._dataManager.insert(i.data,this.model.query)):f=this._dataManager.update(this._primaryKeys[0],i.data,this.model.query),u=this,this.element.ejWaitingPopup("show"),f&&n.isFunction(f.promise)?(f.done(function(r){u.model.isEdit=!1;!t.isNullOrUndefined(r)&&n.isPlainObject(r.record)&&(n.extend(i.data,r.record),i.action=="add"&&(u._cAddedRecord=i.data),i.action=="edit"&&(u._cModifiedData=i.data));u._processBindings(i);u._isRemoteSaveAdaptor&&(u.element.ejWaitingPopup("hide"),t.isNullOrUndefined(u._unboundRow)||i.selectedRow==u._unboundRow||i.requestType!="save"||(u._unboundRow.find(".e-editbutton").trigger("click"),u._unboundRow=null));u._cModifiedData=null;u._cAddedRecord=null;u._primaryKeyValues=[]}),f.fail(function(n){i.error=n&&n.error?n.error:n;u._cModifiedData=null;u._cAddedRecord=null;u.element.ejWaitingPopup("hide");u._trigger("actionFailure",i)})):(u.model.isEdit=!1,u._processBindings(i))):this._processBindings(i);f!=r&&n.isFunction(f.promise)||(this._cModifiedData=null,this._cAddedRecord=null,this._primaryKeyValues=[])},cancelEdit:function(){var i={};i.requestType=t.Grid.Actions.Cancel;this._cModifiedData=null;this._processBindings(i);this._primaryKeyValues=[];this._currentData=null;(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none")},refreshToolbar:function(){var r=n("#"+this._id+"_toolbarItems"),t=r.find("li"),u,i;if(r.ejToolbar("enableItem",t),u=this.getContentTable().find(".e-editedrow"),this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&u.length==0)this._disabledToolItems.push(t.filter("[id="+this._id+"_add]"));else for(i=0;i<t.length;i++)switch(t[i].id){case this._id+"_add":case this._id+"_edit":case this._id+"_delete":case this._id+"_responsiveFilter":case this._id+"_responsiveSorting":case this._id+"_search":this.model.isEdit?this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&u.length==0||(n(t[i]).hasClass("e-hover")&&n(t[i]).removeClass("e-hover"),this._disabledToolItems.push(t[i])):this.model.enableToolbarItems||this.model.editSettings.allowAdding||t[i].id!=this._id+"_add"?this.model.enableToolbarItems||this.model.editSettings.allowEditing||t[i].id!=this._id+"_edit"?this.model.enableToolbarItems||this.model.editSettings.allowDeleting||t[i].id!=this._id+"_delete"||this._disabledToolItems.push(t[i]):this._disabledToolItems.push(t[i]):this._disabledToolItems.push(t[i]);break;case this._id+"_update":case this._id+"_cancel":this.model.isEdit||this.getContentTable().find(".e-updatedtd.e-icon.e-gupdatenotify").length!=0||this._isBatchDeleteApplied||(n(t[i]).hasClass("e-hover")&&n(t[i]).removeClass("e-hover"),this._disabledToolItems.push(t[i]))}r.ejToolbar("disableItem",this._disabledToolItems);r.ejToolbar("model.enableRTL",this.model.enableRTL);this._disabledToolItems=n()},_getHiddenCount:function(n){for(var i=0,t=0;t<n.length;t++)n.eq(t).hasClass("e-hide")&&i++;return i},_refreshTemplateCell:function(t,i){for(var f,u=t.find(".e-templatecell"),r=0;r<u.length;r++)f={cell:u[r],data:i,column:this.model.columns[n(u[r]).index()],rowIndex:t.index()},this._trigger("templateRefresh",f)},_edit:function(i){var k=this.model.scrollSettings.enableVirtualization?t.DataManager(this._virtualLoadedRecords[this._currentVIndex]):t.DataManager(this._currentJsonData),f,l=new t.Query,c,b,s,o,h,p,u;for(this.model.allowFiltering&&(this._previousFilterCount=this._filteredRecordsCount),c=0;c<this._primaryKeys.length;c++)l=l.where(this._primaryKeys[c],t.FilterOperators.equal,this._primaryKeyValues[c]);this._currentData=k.executeLocal(l);var e=document.createElement("div"),a=t.isNullOrUndefined(this.model.editSettings.titleColumn)?this._primaryKeys[0]:this.model.editSettings.titleColumn,r=n(e);if(this.model.editSettings.editMode=="normal"){e.innerHTML=["<table>",n.render[this._id+"_JSONEditingTemplate"](this._currentData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("");var v=r.find("tr").first(),s=0,w=this.model.columns.length,y=i.row.first();this.model.scrollSettings.frozenColumns>0&&(r.prepend(["<table>",n.render[this._id+"_JSONFrozenEditingTemplate"](this._currentData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("")),v.splice(0,0,r.find("table").first().find("tr").first().get(0)),$currentTrLa=i.row.last(),$tempLastTR=v.last());f=r.find("tr").first();r.find("td").not(".e-rowcell").addClass("e-editcell e-normaledit");this._setEditDropdownValue(r);this.model.groupSettings.groupedColumns.length>=2&&(b=i.row.find("td.e-indentcell"),r.find("tr").first().prepend(b));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(s++,r.find(".e-editcell").find("tr").prepend(i.row.find("[class*=e-detailrow]").eq(0).removeClass("e-selectionbackground e-active")),this.model.gridLines!="both"&&r.find(".e-editcell .e-rowcell:first").addClass("e-detailrowvisible"));this.model.scrollSettings.frozenColumns>0&&(r.find(".e-editcell").get(1).colSpan=this.model.columns.length-this.model.scrollSettings.frozenColumns-i.row.last().find(".e-hide").length+s,w=this.model.scrollSettings.frozenColumns,$currentTrLa.hasClass("e-alt_row")&&$tempLastTR.addClass("e-alt_row"));r.find(".e-editcell").get(0).colSpan=w-y.find("td").not(":visible").length+s;y.hasClass("e-alt_row")&&f.addClass("e-alt_row");y.empty().replaceWith(f.addClass("e-editedrow"));i.row=f;f.is(":last-child")||f.find("td.e-rowcell").addClass("e-validError");this.model.scrollSettings.frozenColumns>0&&($currentTrLa.empty().replaceWith($tempLastTR.addClass("e-editedrow")),i.row=$tempLastTR);this._refreshUnboundTemplate(v.find(".gridform"));this._gridRows=this.model.scrollSettings.frozenColumns==0?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row, tr.e-editedrow").toArray():n(this.getContentTable().get(0).rows).toArray();this.model.scrollSettings.frozenColumns>0&&(this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop,!0),this._gridRows=[this._gridRows,n(this.getContentTable().get(1).rows).toArray()])}else this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(s=0,e.innerHTML=this.model.editSettings.editMode=="inlineform"?n.render[this._id+"_JSONDialogEditingTemplate"](this._currentData):n.render[this._id+"_JSONdialogTemplateMode"](this._currentData),this._setEditDropdownValue(r),o=t.buildTag("tr"),h=t.buildTag("td"),o.addClass("e-editedrow"),h.addClass("e-inlineformedit"),e=n(e).clone(!0).children(),h.html(e),o.append(h),o.is(":last-child")||o.find(".e-rowcell").addClass("e-validError"),this.model.scrollSettings.frozenColumns>0?(p=o.clone(),p.find("td").empty().prop("colspan",this.model.scrollSettings.frozenColumns),i.row.eq(1).after(o).end().eq(0).after(p),this._gridRows=[this._gridRows,this.getContentTable().last().find("tr").toArray()]):i.row.after(o),this._gridRows=this.getContentTable().first().find(".e-rowcell,.e-inlineformedit").closest("tr").toArray(),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&s++,this.model.scrollSettings.frozenColumns>0?h.prop("colspan",this.model.columns.length-this.model.scrollSettings.frozenColumns-o.find("form").children().not(":visible").length+s):h.prop("colspan",this.model.columns.length-this._hiddenColumns.length+s),this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find("tr").toArray()]),n("#"+this._id+"_inlineFormTitle").text(this.localizedLabels.EditFormTitle+this._currentData[0][a]),i.row.find("input").attr("disabled","disabled").addClass("e-disable")):(r.addClass("e-editedrow"),e.innerHTML=this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform"?n.render[this._id+"_JSONDialogEditingTemplate"](this._currentData):n.render[this._id+"_JSONdialogTemplateMode"](this._currentData),this._setEditDropdownValue(r),this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?(n("#"+this._id+"_dialogEdit").html(n(e)),u={},u.cssClass=this.model.cssClass,u.enableRTL=this.model.enableRTL,u.width="auto",u.enableResize=this.phoneMode,u.close=n.proxy(this._buttonClick,this),u.content="#"+this._id,u.enableModal=!0,u.allowKeyboardNavigation=!1,u.title=this.localizedLabels.EditFormTitle+this._currentData[0][a],n("#"+this._id+"_dialogEdit").ejDialog(u),n("#"+this._id+"_dialogEdit").ejDialog("open")):(n("#"+this._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),n("#"+this._id+"_externalForm").find(".e-externalformedit").html(n(e)),n("#"+this._id+"_eFormHeader").find(".e-form-title").text(this.localizedLabels.EditFormTitle+this._currentData[0][a]),this._externalFormPosition(),i.row.find("input").attr("disabled","disabled").addClass("e-disable")));this.model.editSettings.editMode!="normal"&&(f=n(e));t.isNullOrUndefined(this.model.templateRefresh)||f.find(".e-templatecell").length==0||this._refreshTemplateCell(f,this.model.currentViewData[f.index()])},_setEditDropdownValue:function(i){for(var s,h,e,l,f,u=i.find("select.e-field"),o,c=i.find("input.e-field.e-dropdownlist"),r=0;r<u.length;r++){if(s={},h="",u[r].name.indexOf(".")!=-1){for(f=1;f<u[r].name.split(".").length;f++)h=h.concat("(");s[this._id+"ddlTemp"]="{{:"+h+"#data['"+u[r].name.split(".").join("'] || {})['")+"']}}"}else s[this._id+"ddlTemp"]="{{:"+u[r].name.replace(/[^a-z0-9\s_]/gi,"")+"}}";n.templates(s);o=n.render[this._id+"ddlTemp"](this._currentData);e=i.find("select:eq("+r+') option[value="'+o+'"]');u.eq(r).data("ej-value",o);l=this.getColumnByField(u[r].name);this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&this._dataSource().adaptor.value.indexOf(l.field)!=-1&&(e=i.find("select:eq("+r+') option:contains("'+o+'")'),u.eq(r).val(e[0].value),u.eq(r).data("ej-value",e[0].value));e.attr("selected","selected")}for(f=0;f<c.length;f++)c.eq(f).data("ej-value",t.getObject(c.eq(f).attr("name"),this._currentData[0]))},_add:function(i){var u=document.createElement("div"),e,c,l,a,h,v,y,p,f,r,s;if(this._isLocalData&&this.model.groupSettings.groupedColumns.length==0&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&((this._dataSource()instanceof t.DataManager)?this._dataSource().dataSource.json.splice(0,1):this._dataSource().splice(0,1)),this._previousFilterCount=this._filteredRecordsCount,this.model.editSettings.editMode=="normal"){for(l=n(u),a=this.model.columns.length,u.innerHTML=["<table>",n.render[this._id+"_JSONEditingTemplate"](i.data,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join(""),f=n(u).find("select.e-field"),r=0;r<f.length;r++)f.eq(r).val(i.data[f[r].name]),f.eq(r).data("ej-value",i.data[f[r].name]);if(this.model.scrollSettings.frozenColumns>0&&($tempLastTR=l.find("table").first().find("tr").first(),l.prepend(["<table>",n.render[this._id+"_JSONFrozenEditingTemplate"](i.data,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("")),n($tempLastTR).find("td").first().addClass("e-editcell")),c=l.find("tr").first(),h=n(u).find(".e-editcell").get(0),n(u).find("td").first().addClass("e-editcell"),this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&this.model.groupSettings.groupedColumns.length==0&&!this.model.editSettings.showAddNewRow&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&n(this.getContentTable().get(0).lastChild.lastChild).children(".e-detailrowexpand").length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),(this.model.currentViewData.length==0||this.getContentTable().find("td.e-rowcell").length==0)&&this.model.scrollSettings.frozenColumns==0?(this.getContentTable().find("tr").first().replaceWith(n(u).find("tr").first().addClass("e-addedrow e-normaledit")),this.getContentTable().find("tr").length==0&&this.getContentTable().append(n(u).find("tr").first().addClass("e-addedrow e-normaledit"))):(this.model.scrollSettings.frozenColumns>0&&this._renderByFrozenDesign(),v=this.getContentTable().first().find("tbody").first(),this.model.editSettings.rowPosition=="top"?v.prepend(c.addClass("e-addedrow e-normaledit")):this.model.editSettings.rowPosition=="bottom"&&v.append(c.addClass("e-addedrow e-normaledit")),this.model.scrollSettings.frozenColumns>0&&this.getContentTable().last().find("tbody").first().prepend($tempLastTR.addClass("e-addedrow e-normaledit"))),e=this.getContentTable().find("tr.e-addedrow"),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&e.attr("name",0),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&e.find("tr").first().prepend(t.buildTag("td.e-detailrowcollapse")),this.model.groupSettings.groupedColumns.length){for(r=0;r<this.model.groupSettings.groupedColumns.length;r++)r==0?e.prepend(t.buildTag("td.e-indentcell")):e.find("tr").prepend(t.buildTag("td.e-indentcell"));this.model.groupSettings.groupedColumns.length>0&&(this.model.detailsTemplate!=null||this.model.childGrid!=null)?e.find("td.e-editcell").prop("colspan",this.model.columns.length+this.model.groupSettings.groupedColumns.length-this._hiddenColumns.length):this.model.groupSettings.groupedColumns.length>=2?e.find("td.e-editcell").prop("colspan",this.model.columns.length+(this.model.groupSettings.groupedColumns.length-1)-this._hiddenColumns.length):e.find("td.e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length)}else this.model.detailsTemplate!=null||this.model.childGrid!=null?e.find(".e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length+1):(this.model.scrollSettings.frozenColumns>0&&(e.find(".e-editcell").last().prop("colspan",this.model.columns.length-this.model.scrollSettings.frozenColumns-$tempLastTR.find("td").not(":visible").length),a=this.model.scrollSettings.frozenColumns),e.find(".e-editcell").first().prop("colspan",a-c.find("td").not(":visible").length));e.is(":last-child")||e.find("td.e-rowcell").addClass("e-validError");t.isIOSWebView()||this.getBrowserDetails().browser!="msie"||this.model.editSettings.rowPosition!="bottom"||this._colgroupRefresh();this._refreshUnboundTemplate(e.find(".gridform"));this._gridRows=this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray();this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray()])}else if(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"){u.innerHTML=this.model.editSettings.editMode=="inlineform"?n.render[this._id+"_JSONDialogEditingTemplate"](i.data):n.render[this._id+"_JSONdialogTemplateMode"](i.data);var w=0,o=t.buildTag("tr"),h=t.buildTag("td");for(o.addClass("e-addedrow"),h.addClass("e-inlineformedit e-editcell"),u=n(u).clone(!0).children(),f=n(u).find("select.e-field"),r=0;r<f.length;r++)f.eq(r).val(i.data[f[r].name]),f.eq(r).data("ej-value",i.data[f[r].name]);if(h.html(u),o.append(h),o.is(":last-child")||o.find(".e-rowcell").addClass("e-validError"),this.model.groupSettings.groupedColumns.length)for(r=0;r<this.model.groupSettings.groupedColumns.length;r++)o.prepend(t.buildTag("td.e-indentcell"));else o.find("td.e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length);this.model.scrollSettings.frozenColumns>0?(y=o.clone(),p=h.find(".gridform").children(),y.find("td").empty().prop("colSpan",this.model.scrollSettings.frozenColumns-this._getHiddenCount(p.slice(0,this.model.scrollSettings.frozenColumns))),h.prop("colSpan",this.model.columns.length-this.model.scrollSettings.frozenColumns-this._getHiddenCount(p.slice(this.model.scrollSettings.frozenColumns))),(this.model.currentViewData.length==0||this.getContentTable().find("td.e-rowcell").length==0)&&this._renderByFrozenDesign(),this.getContentTable().first().find("tbody").first().prepend(y),this.getContentTable().last().find("tbody").first().prepend(o)):((this.model.detailsTemplate!=null||this.model.childGrid!=null)&&w++,h.prop("colspan",this.model.columns.length-this._hiddenColumns.length+w),this.model.currentViewData.length==0||this.getContentTable().find("td.e-rowcell").length==0?this.getContentTable().find("tr").first().replaceWith(n(o)):this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&this.model.groupSettings.groupedColumns.length==0&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),this.model.editSettings.rowPosition=="top"?this.getContentTable().first().find("tbody").first().prepend(o):this.model.editSettings.rowPosition=="bottom"&&this.getContentTable().first().find("tbody").first().append(o));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&n(this.getContentTable().get(0).lastChild.lastChild).children(".e-detailrowexpand").length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild);n("#"+this._id+"_inlineFormTitle").text(this.localizedLabels.AddFormTitle);this._refreshUnboundTemplate(n("#"+this._id+"EditForm"));this._gridRows=this.getContentTable().first().find(".e-rowcell,.e-inlineformedit").closest("tr.e-row, tr.e-alt_row").toArray();this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray()])}else{for(n(u).addClass("e-addedrow"),u.innerHTML=this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform"?n.render[this._id+"_JSONDialogEditingTemplate"](i.data):n.render[this._id+"_JSONdialogTemplateMode"](i.data),f=n(u).find("select.e-field"),r=0;r<f.length;r++)f.eq(r).val(i.data[f[r].name]),f.eq(r).data("ej-value",i.data[f[r].name]);this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?(n("#"+this._id+"_dialogEdit").html(n(u)),s={},s.cssClass=this.model.cssClass,s.width="auto",s.enableResize=this.phoneMode,s.content="#"+this._id,s.enableModal=!0,s.close=n.proxy(this._buttonClick,this),s.enableRTL=this.model.enableRTL,s.allowKeyboardNavigation=!1,s.title=this.localizedLabels.AddFormTitle,n("#"+this._id+"_dialogEdit").ejDialog(s),n("#"+this._id+"_dialogEdit").ejDialog("open")):(n("#"+this._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),n("#"+this._id+"_externalForm").find(".e-externalformedit").html(n(u)),n("#"+this._id+"_eFormHeader").find(".e-form-title").text(this.localizedLabels.AddFormTitle),this._externalFormPosition())}this.model.editSettings.editMode!="normal"&&(e=n(u));t.isNullOrUndefined(this.model.templateRefresh)||e.find(".e-templatecell").length==0||this._refreshTemplateCell(e,i.data);this.model.allowPaging&&(this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._gridRecordsCount:this._searchCount,currentPage:this._currentPage()}),this._refreshGridPager())},editFormValidate:function(){var t,i,r;return n.isFunction(n.validator)?this.model.scrollSettings.frozenColumns>0?(t=this.element.find(".gridform"),t.length>1?(i=t.eq(0).validate().form(),r=t.eq(1).validate().form(),i&&r?!0:!1):t.validate().form()):this.model.editSettings.showAddNewRow?n(this.getRows()).hasClass("e-editedrow")?this.element.find(".e-editedrow .gridform").validate().form():this.element.find(".e-addedrow .gridform").validate().form():n("#"+this._id+"EditForm").validate().form():!0},_refreshAltRow:function(){for(var t,r=this._excludeDetailRows(),i=0;i<r.length;i++)t=n(r[i]),t.hasClass("e-alt_row")&&t.removeClass("e-alt_row"),i%2!=0?t.addClass("e-alt_row"):t.addClass("e-row")},_editCompleteAction:function(i){var o=this.element.find(".gridform"),s,h,u,r,f,e;if(this.model.isEdit=!0,s=this.getContentTable().children("colgroup").find("col"),h=this.element.width(),this.setWidthToColumns(),t.Grid.Actions.Add==i.requestType){for(u=o.find(".e-field:disabled"),r=0;r<u.length;r++)f=n(u[r]).attr("name"),n(u[r]).hasClass("e-identity")||(n.inArray(f,this._disabledEditableColumns)==-1||n.inArray(f,this._primaryKeys)!==-1)&&n(u[r]).prop("disabled",!1).removeClass("e-disable");for(e=0;e<this.model.groupSettings.groupedColumns.length-1;e++)o.find("colgroup").prepend(this._getIndentCol())}(this._tdsOffsetWidth.length==0||this.model.groupSettings.groupedColumns.length||n.inArray(0,this._tdsOffsetWidth)!=-1||this._hiddenColumns.length>0)&&this._setoffsetWidth();this._refreshEditForm(i);this.model.scrollSettings.frozenColumns>0&&(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")&&(i.requestType=="beginedit"?i.row.eq(0).next().find("td").height(i.row.eq(1).next().find("td").height()):this.getContentTable().first().find("tr").first().find("td").height(this.getContentTable().last().find("tr").first().find("td").height()));this.model.scrollSettings.frozenRows>0&&i.requestType=="beginedit"&&(this._initFrozenRows(),t.getObject("_vScrollbar._scrollData",this.getScrollObject())&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0));this.model.scrollSettings.frozenColumns>0&&(this.rowHeightRefresh(),this._refreshScroller(i));this.model.allowScrolling&&this.model.scrollSettings.frozenColumns<=0&&this.getScrollObject()&&this.getScrollObject().isHScroll()&&this.getScrollObject().refresh();n.isFunction(n.validator)&&this.initValidator()},_refreshEditForm:function(i){var g,ot,it,v,rt,e,b,nt,u,c,o,ut,k,tt,y,h,l,f,p,a,w,d,s,st,ht;for(this.model.editSettings.showAddNewRow&&(g=this.getContentTable().find(".e-editedrow")),ot=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):!t.isNullOrUndefined(g)&&g.length==1?g[0].lastChild.lastChild:document.getElementById(this._id+"EditForm"),it=!1,this.model.enableResponsiveRow&&n.isFunction(window.matchMedia)&&(rt=window.matchMedia("(max-width: 320px)")),e=n(ot).find("input,select,div.e-field,textarea"),b=86,(this._isUnboundColumn||this.getContentTable().find(".e-templatecell")!=null)&&this.model.editSettings.editMode!="batch"&&(e=e.filter(function(){return!n(this).closest(".e-rowcell").hasClass("e-unboundcell")&&!n(this).closest(".e-rowcell").hasClass("e-templatecell")})),nt=null,l=0;l<e.length;l++){if(u=e.eq(l),o=this.getColumnByField(t.isNullOrUndefined(u.prop("name"))?u.attr("name"):u.prop("name")),o!=null&&(v=n.inArray(o,this.model.columns)),this.model.editSettings.editMode=="batch"?b=95:this.model.editSettings.editMode=="normal"&&(b=96),this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(u.parent().css("width",t.dataUtil.max(this._tdsOffsetWidth)+"px"),c=t.max(this._tdsOffsetWidth)*(b/100)):c=this._tdsOffsetWidth[l]*(b/100),(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="batch"||this.model.allowResizing||this.model.allowResizeToFit)&&!u.hasClass("e-checkbox")&&(c="100%"),o!=null&&v!==r&&v<this.model.columns.length&&this.model.columns[v].editTemplate)ut={rowdata:this.model.editSettings.editMode=="batch"?this._batchEditRowData:this._currentJsonData[this._selectedRow()],column:this.model.columns,element:u,requestType:i.requestType,type:i.type},k=this.model.columns[v].editTemplate.write,t.isNullOrUndefined(i)||i.requestType!="add"||(ut.rowdata={}),typeof k=="string"&&(k=t.util.getObject(k,window)),k(ut),this.model.columns[v].isPrimaryKey&&i.requestType=="beginedit"&&u.addClass("e-disable").attr("disabled","disabled");else if(u.hasClass("e-numerictextbox")||u.hasClass("e-datepicker")||u.hasClass("e-datetimepicker")||u.hasClass("e-dropdownlist"))tt=this.getColumnByField(u.prop("name")),y=u.val(),(!t.isNullOrUndefined(rt)&&rt.matches||tt.width&&typeof tt.width=="string"&&tt.width.indexOf("%")!=-1&&(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="batch"))&&(c="100%"),u.outerWidth(c),u.hasClass("e-numerictextbox")&&(y.length&&u.attr("value",parseFloat(y)),u.prop("name",u.prop("name").replace(this._id,""))),u.hasClass("e-disable")&&u.attr("disabled","disabled");else if(u.hasClass("e-save e-button")||u.hasClass("e-cancel e-button"))u.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,width:"100","text-align":"centre",height:"35px"});else switch(u.prop("tagName")){case"INPUT":if(!t.isNullOrUndefined(o)&&o.format&&u.val()!="")switch(o.type){case"date":var y=u.val(),at=new Date(y),s=o.format.replace("{0:","").replace("}",""),vt=t.format(at,s,this.model.locale);u.val(vt);break;case"number":y=u.val();s=new RegExp("\\{0(:([^\\}]+))?\\}","gm").exec(o.format);s[2].toLowerCase().split("")[0]=="c"?s[2]=s[2].toLowerCase().replace("c","n"):s[2];u.val(t.format(parseFloat(y),s[2],this.model.locale))}u.attr("type")!="checkbox"?(u.css("text-align",u.attr("name")!=null&&this.getColumnByField(u.attr("name"))!=null?this.getColumnByField(u.attr("name")).textAlign:"center"),this.model.editSettings.editMode=="batch"?(u.css("width","100%").css("height","28px"),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version,10)==8&&u.css("line-height","22px")):this.model.editSettings.editMode=="normal"?(u.css("width","100%").css("height","30px"),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version,10)==8&&u.css("line-height","24px")):(u.outerWidth(c).height(28),t.browserInfo().name=="msie"&&parseInt(t.browserInfo().version,10)==8&&u.css("line-height","26px"))):u.width(c>0?u.width()>c?c:u.width():this.model.editSettings.editMode.indexOf("template")!=-1?u.width():1);this.model.editSettings.editMode!="batch"||this._tabKey||(u.is(":checked")?u.prop("checked",!1):u.prop("checked",!0));break;case"SELECT":u.width(c).height(28)}o==null||o.visible||!o.validationRules||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalformtemplate"||this.model.editSettings.editMode=="inlineformtemplate"||u.addClass("e-hide");u.is(":disabled")||it||u.is(":hidden")&&typeof(u.data("ejDropDownList")||u.data("ejNumericTextbox"))!="object"||(nt=u,it=!0)}for(h={},h.enableRTL=this.model.enableRTL,h.cssClass=this.model.cssClass,h.watermarkText=this.localizedLabels.NumericTextBoxWaterMark,h.locale=this.model.locale,e.filter(".e-numerictextbox").ejNumericTextbox(n.extend({showSpinButton:!0},h)),h.watermarkText=this.localizedLabels.DatePickerWaterMark,e.filter(".e-datepicker").ejDatePicker(n.extend({displayDefaultDate:!0,showPopupButton:!1},h)),delete h.watermarkText,e.filter(".e-datetimepicker").ejDateTimePicker(n.extend({showPopupButton:!1},h)),e.filter(".e-dropdownlist").ejDropDownList(n.extend({enableIncrementalSearch:!0,htmlAttributes:{style:"width: 100%"}},h)),l=0;l<this.model.columns.length;l++){if(f=this.model.columns[l],!t.isNullOrUndefined(f.editParams))switch(f.editType){case t.Grid.EditingType.DateTimePicker:e.filter("#"+this._id+f.field+".e-datetimepicker").ejDateTimePicker(f.editParams);break;case t.Grid.EditingType.DatePicker:e.filter("#"+this._id+f.field+".e-datepicker").ejDatePicker(f.editParams);break;case t.Grid.EditingType.Numeric:e.filter("#"+this._id+f.field+".e-numerictextbox").ejNumericTextbox(f.editParams);break;case t.Grid.EditingType.Dropdown:e.filter("#"+this._id+f.field+".e-dropdownlist").ejDropDownList(f.editParams)}if(f.editType==t.Grid.EditingType.Dropdown&&(p=-1,this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&(p=this._dataSource().adaptor.value.indexOf(f.field)),a=e.filter("#"+this._id+f.field.replace(".","")+".e-dropdownlist"),w=null,!t.isNullOrUndefined(f.dataSource)&&!t.isNullOrUndefined(f.editParams)&&t.isNullOrUndefined(f.foreignKeyField)&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&p!=-1?w=f.dataSource:t.isNullOrUndefined(f.dataSource)&&p!=-1&&!t.isNullOrUndefined(f.editParams)?w=this._dataSource().adaptor.foreignData[p]:!t.isNullOrUndefined(f.editParams)&&"fields"in f.editParams&&t.isNullOrUndefined(f.foreignKeyField)&&(w=f.dataSource),w!=null&&a.ejDropDownList({dataSource:w}),d=a.data("ej-value"),this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&p!=-1&&!t.isNullOrUndefined(f.editParams)?a.ejDropDownList("setSelectedText",i.requestType=="add"&&t.isNullOrUndefined(f.defaultValue)&&t.isNullOrUndefined(d)?a.val(""):d):a.ejDropDownList("setSelectedValue",i.requestType=="add"&&t.isNullOrUndefined(f.defaultValue)&&t.isNullOrUndefined(d)?a.val(""):d),f==null||f.visible||!f.validationRules||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalformtemplate"||this.model.editSettings.editMode=="inlineformtemplate"||f.editType==t.Grid.EditingType.Dropdown&&a.closest(".e-rowcell").find("input").addClass("e-hide")),s=null,f.format!==r&&f.format.length>0&&(st=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),ht=st.exec(f.format),s=ht[2]),[t.Grid.EditingType.DatePicker,t.Grid.EditingType.DateTimePicker].indexOf(f.editType)!=-1){var ct=f.editType==t.Grid.EditingType.DatePicker?"datePicker":"dateTimePicker",lt="ej"+ct.replace(/\b\w/g,function(n){return n.toUpperCase()}),yt=this._id+f.field,ft=e.filter(function(t,i){return i.id==yt&&(n(i).hasClass("e-datepicker")||n(i).hasClass("e-datetimepicker"))}),et={};s==null||!t.isNullOrUndefined(f.editParams)&&(f.editParams.dateFormat||f.editParams.dateTimeFormat)||(et[ct.replace("Picker","")+"Format"]=s);ft.hasClass("e-disable")&&(et.enabled=!1);ft[lt](et);this.model.editSettings.editMode=="batch"&&ft[lt]("show")}}nt!=null&&this._focusElements(nt)},_focusElements:function(n){if(n.length){var t=n;(t[0].tagName.toLowerCase()!="select"||t.hasClass("e-field e-dropdownlist"))&&(t[0].tagName.toLowerCase()!="input"||t.hasClass("e-numerictextbox"))?t.hasClass("e-field e-dropdownlist")?t.closest(".e-ddl").focus():t.hasClass("e-numerictextbox")?t.siblings("input:visible").first().select().focus():t.find("input:visible,select").first().select().focus():(t.focus().select(),t[0].focus())}},_renderToolBar:function(){var r=t.buildTag("div.e-gridtoolbar","",{},{id:this._id+"_toolbarItems"}),f=t.buildTag("ul"),u,i;return(!t.isNullOrUndefined(this.model.toolbarSettings.toolbarItems)&&this.model.toolbarSettings.toolbarItems.length||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&this._renderLi(f),r.append(f),u=t.buildTag("ul"),r.append(u),!t.isNullOrUndefined(this.model.toolbarSettings.customToolbarItems)&&this.model.toolbarSettings.customToolbarItems.length&&this._renderCustomLi(u),i={},i.click=this._toolBarClick,i.cssClass=this.model.cssClass,i.enableRTL=this.model.enableRTL,i.enableSeprator=!1,r.ejToolbar(i),r.ejToolbar("disableItem",this._disabledToolItems),this._disabledToolItems=n(),r},_renderCustomLi:function(i){for(var e,u,f,r=0;r<this.model.toolbarSettings.customToolbarItems.length;r++){f=this.model.toolbarSettings.customToolbarItems[r].templateID?this.model.toolbarSettings.customToolbarItems[r].templateID.replace("#",""):this.model.toolbarSettings.customToolbarItems[r];u=t.buildTag("li","",{},{id:this._id+"_"+f,title:f});switch(typeof this.model.toolbarSettings.customToolbarItems[r]){case"string":e=t.buildTag("a.e-toolbaricons e-icon","",{}).addClass(this.model.toolbarSettings.customToolbarItems[r]);break;case"object":u.attr("title",this.model.toolbarSettings.customToolbarItems[r].templateID.replace("#",""));e=n(this.model.toolbarSettings.customToolbarItems[r].templateID).hide().html()}u.html(e);i.append(u)}},_renderLi:function(i){var f,r,u,e;for(n.isFunction(window.matchMedia)&&this.model.enableResponsiveRow&&(f=this.model.toolbarSettings.toolbarItems.indexOf("search"),f!=-1&&this.model.toolbarSettings.toolbarItems.splice(f,1),this.model.allowFiltering&&this.model.toolbarSettings.toolbarItems.push("responsiveFilter"),this.model.allowSorting&&this.model.toolbarSettings.toolbarItems.push("responsiveSorting"),f!=-1&&this.model.toolbarSettings.toolbarItems.push("search")),r=0;r<this.model.toolbarSettings.toolbarItems.length;r++)u=t.buildTag("li","",{},{id:this._id+"_"+this.model.toolbarSettings.toolbarItems[r],title:this.localizedLabels[this.model.toolbarSettings.toolbarItems[r].slice(0,1).toUpperCase()+this.model.toolbarSettings.toolbarItems[r].slice(1)]}),this._renderLiContent(u,this.model.toolbarSettings.toolbarItems[r]),e=this.model.toolbarSettings.toolbarItems[r],this.model.enableResponsiveRow&&(e==="responsiveFilter"||e==="responsiveSorting")&&(u.addClass("e-gridresponsiveicons"),u.css("display","none")),i.append(u)},_renderLiContent:function(n,i){var r,u,f,e;switch(i){case"add":r=t.buildTag("a.e-addnewitem e-toolbaricons e-icon e-addnew","",{});break;case"edit":r=t.buildTag("a.e-edititem e-toolbaricons e-icon e-edit","",{});break;case"delete":r=t.buildTag("a.e-deleteitem e-toolbaricons e-icon e-delete","",{});break;case"update":r=t.buildTag("a.e-saveitem e-toolbaricons e-disabletool e-icon e-save","",{});this._disabledToolItems.push(n.get(0));break;case"cancel":r=t.buildTag("a.e-cancel e-toolbaricons e-disabletool e-icon e-gcancel","",{});this._disabledToolItems.push(n.get(0));break;case"search":r=t.buildTag("a.e-searchitem e-toolbaricons e-disabletool e-icon e-searchfind","",{});this.model.enableResponsiveRow||(u=t.buildTag("input.e-ejinputtext e-gridsearchbar","",{},{type:"text",id:this._id+"_searchbar"}),e=t.buildTag("span.e-cancel e-icon e-hide","",{right:"1%"}),f=t.buildTag("div.e-filterdiv e-searchinputdiv","",{display:"inline-table",width:"83%"}),f.append(u).append(e),n.append(f),t.isNullOrUndefined(this.model.searchSettings.key)||u.val(this.model.searchSettings.key));this.model.allowSearching=!0;break;case"printGrid":r=t.buildTag("a.e-print e-toolbaricons e-icon","",{});break;case"excelExport":r=t.buildTag("a.e-toolbaricons e-excelIcon e-icon","",{});break;case"wordExport":r=t.buildTag("a.e-toolbaricons e-wordIcon e-icon","",{});break;case"pdfExport":r=t.buildTag("a.e-toolbaricons e-pdfIcon e-icon","",{});break;case"responsiveFilter":r=t.buildTag("a.e-toolbaricons e-filterset e-icon","",{});break;case"responsiveSorting":r=t.buildTag("a.e-toolbaricons e-respponsiveSorting e-icon","",{})}n.append(r);i=="search"&&(this._searchBar=n,n.css("display","flex"))},_toolBarClick:function(i){var h=n(this.itemsContainer).closest(".e-grid"),u=h.ejGrid("instance"),f=h.attr("id"),s,c,e;if(i.event!=r||i.target.tagName!="INPUT"||i.currentTarget.id!=f+"_search"){n.isFunction(n.fn.ejDatePicker)&&n("#"+f+"EditForm").find(".e-datepicker").ejDatePicker("hide");var o=i.currentTarget,v=i.target,y=n.extend({},u.model);if(u.ignoreOnToolbarServerClick.length)for(s=0;s<u.ignoreOnToolbarServerClick.length;s++)delete y[u.ignoreOnToolbarServerClick[s]];if(c={itemName:n(o).attr("data-content"),itemId:o.id,currentTarget:o,target:v,itemIndex:n(o).index(),itemCurrentTarget:o.outerHTML,gridModel:y,itemTarget:v.outerHTML,toolbarData:i},!h.ejGrid("instance")._trigger("toolbarClick",c)){switch(c.itemId){case f+"_add":u._toolbarOperation(f+"_add");break;case f+"_edit":u._toolbarOperation(f+"_edit");break;case f+"_delete":u._toolbarOperation(f+"_delete");break;case f+"_update":u._toolbarOperation(f+"_update");break;case f+"_cancel":u.model.editSettings.editMode=="batch"?u.model.editSettings.showConfirmDialog?u._confirmDialog.find(".e-content").html(u.localizedLabels.CancelEdit).end().ejDialog("open"):u.cancelEdit():u._toolbarOperation(f+"_cancel");break;case f+"_search":if(u.model.enableResponsiveRow)if(t.isNullOrUndefined(u.element.find(".e-responsesearch")[0])){var l=t.buildTag("div.e-gridtoolbar","",{},{id:this._id+"_toolbarItems"}),p=t.buildTag("div.e-responsesearch","",{width:"95%",height:"38px","margin-top":"7px","margin-left":"6px"}),a=t.buildTag("span.e-ttoltxt","",{width:"98%","margin-left":"2%"},{id:u._id+"_search"});$a=t.buildTag("span.e-searchitem e-toolbaricons e-disabletool e-icon e-searchfind","",{position:"absolute",right:"2%","margin-top":"1%"});t.browserInfo().name==="webkit"&&$a.css("margin-top","-2px");e=t.buildTag("input.e-ejinputtext","",{width:"97%",height:"30px"},{type:"search",id:u._id+"_searchInput"});t.isNullOrUndefined(u.model.searchSettings.key)||e.val(u.model.searchSettings.key);a.append(e);a.append($a);p.append(a);l.append(p);l.ejToolbar({click:function(t){u._toolbarOperation(f+"_search",n(t.currentTarget).find("input").val())}});e.on("keyup",function(){e.val()!=""?($a.removeClass("e-searchfind"),$a.addClass("e-cancel")):($a.removeClass("e-cancel"),$a.addClass("e-searchfind"))});$a.click(function(){$a.hasClass("e-cancel")&&(e.val(""),$a.removeClass("e-cancel"),$a.addClass("e-searchfind"),u._toolbarOperation(f+"_search",n("#"+f+"_searchInput").val()))});l.insertBefore(u.getHeaderContent())}else u.element.find(".e-responsesearch").css("display")=="block"?u.element.find(".e-responsesearch").css("display","none"):u.element.find(".e-responsesearch").css("display","block");else u._toolbarOperation(f+"_search",n(i.target).hasClass("e-cancel")?"":n(i.currentTarget).find("input").val());break;case f+"_printGrid":u._toolbarOperation(f+"_printGrid");break;case f+"_excelExport":u._toolbarOperation(f+"_excelExport");break;case f+"_wordExport":u._toolbarOperation(f+"_wordExport");break;case f+"_pdfExport":u._toolbarOperation(f+"_pdfExport");break;case f+"_responsiveFilter":u._toolbarOperation(f+"_responsiveFilter");break;case f+"_responsiveSorting":u._toolbarOperation(f+"_responsiveSorting")}return!1}}},_toolbarOperation:function(i,r){var h=this.element,u=h.ejGrid("instance"),o=u.model.editSettings.editMode=="batch",f=h.attr("id"),c,s,e,l,p;u._exportTo=u["export"];switch(i){case f+"_add":o?u._bulkAddRow():u._startAdd();break;case f+"_edit":if(o&&u.model.editSettings.allowEditing){if(u._bulkEditCellDetails.columnIndex==-1){alert(this.localizedLabels.EditOperationAlert);return}c=u.model.columns[u._bulkEditCellDetails.columnIndex].field;c&&u.editCell(u._bulkEditCellDetails.rowIndex,c)}else u.startEdit();break;case f+"_delete":if(this._selectedRow()==-1){alert(this.localizedLabels.DeleteOperationAlert);return}this.model.editSettings.showDeleteConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open"):o?this._bulkDelete():this.multiDeleteMode?this._multiRowDelete():this.deleteRow();break;case f+"_update":o&&n("#"+this._id+"EditForm").children().find(".e-field-validation-error").length==0?this.model.editSettings.showConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.BatchSaveConfirm).end().ejDialog("open"):this.batchSave():u.endEdit();break;case f+"_cancel":o?n("#"+f+"ConfirmDialog").ejDialog("isOpened")===!0?this._triggerConfirm():u.cancelEditCell():u.cancelEdit();break;case f+"_search":args.type=="click"&&(args.target.nodeName=="A"||args.target.nodeName=="SPAN")&&h.ejGrid("search",r);break;case f+"_printGrid":this.print();break;case f+"_excelExport":u._exportTo(u.model.exportToExcelAction,"excelExporting",u.model.allowMultipleExporting);break;case f+"_wordExport":u._exportTo(u.model.exportToWordAction,"wordExporting",u.model.allowMultipleExporting);break;case f+"_pdfExport":u._exportTo(u.model.exportToPdfAction,"pdfExporting",u.model.allowMultipleExporting);break;case f+"_responsiveFilter":n("#responsiveFilter").css("display","block");setTimeout(function(){u.element.css("display","none");0});break;case f+"_responsiveSorting":for(this._sortColumns=[],this._removeSortCol=[],s=0;s<this.model.sortSettings.sortedColumns.length;s++)this._sortColumns.push({field:this.model.sortSettings.sortedColumns[s].field,direction:this.model.sortSettings.sortedColumns[s].direction});if(t.isNullOrUndefined(n("#responsiveSort")[0])){e=n("#responsiveFilter").clone().css("display","block");e.insertAfter(this.element);e.attr("id","responsiveSort");u._setSortingButton();var a=t.buildTag("div.btnContainer","",{width:"100%",bottom:"0px",position:"absolute"}),v=t.buildTag("input.e-resposnsiveFilterBtnLeft e-flat e-btnsub","OK",{width:"45.6%"}),y=t.buildTag("input.e-resposnsiveFilterBtnRight e-flat e-btncan","Cancel",{width:"46%"}),w=t.buildTag("div.e-resFIlterRigthIcon"),b=t.buildTag("span.e-icon e-responsiveClose e-resIcon");e.find(".e-resFilterleftIcon").remove();e.find(".labelRes").text("Sorting");e.find(".e-resFilterDialogHeaderDiv").append(w.append(b));e.find(".e-resFilterDialogHeaderDiv").find(".e-resFIlterRigthIcon").click(function(){n("#responsiveSort").css("display","none");u.element.css("display","block")});l=t.buildTag("div.e-resFilterleftIcon","",{"margin-top":"3%"});p=t.buildTag("span.e-icon e-resIcon e-responsiveSortClear");l.click(function(){e.find(".e-responsivefilterColDiv").find(".e-button").remove();u._setSortingButton(!0);for(var n=0;n<u._sortColumns.length;n++)u._removeSortCol.indexOf(u._sortColumns[n].field)==-1&&u._removeSortCol.push(u._sortColumns[n].field);u._sortColumns=[];u._removeSortCol=[]});e.find(".e-resFilterDialogHeaderDiv").prepend(l.append(p));e.append(a);a.append(v).append(y);v.ejButton({text:"OK",type:"button",click:n.proxy(this._resSortOperation,this)});y.ejButton({text:"Cancel",type:"button",click:function(){n("#responsiveSort").css("display","none");u.element.css("display","block");u._sortColumns=[];e.find(".e-responsivefilterColDiv").find(".e-button").remove();u._setSortingButton()}})}else n("#responsiveSort").find(".e-responsivefilterColDiv").find(".e-button").remove(),this._setSortingButton();n("#responsiveSort").find(".e-responsivefilterColDiv").find(".e-filternone").remove();n("#responsiveSort").css("display","block");setTimeout(function(){u.element.css("display","none");0})}return!1},_resSortOperation:function(){for(var i=[],t=0;t<this.model.sortSettings.sortedColumns.length;t++)i.push(this.model.sortSettings.sortedColumns[t].field);for(t=0;t<i.length;t++)this.removeSortedColumns(i[t]);for(t=0;t<this._sortColumns.length;t++)this.model.allowMultiSorting&&(this.multiSortRequest=!0),this.sortColumn(this._sortColumns[t].field,this._sortColumns[t].direction);n("#responsiveSort").css("display","none");this.element.css("display","block")},_setSortingButton:function(i){var u=n("#responsiveSort"),r=this;this._sortCols=[];t.isNullOrUndefined(u.find(".e-responsivefilterColDiv").find(".e-button")[0])&&u.find(".e-responsivefilterColDiv").each(function(u,f){var l=t.buildTag("div","",{float:"right","margin-right":"2%","margin-top":"-1%"}),o=n(f).attr("ej-MappingName"),h=t.buildTag("button#"+o+".e-sortingBtn e-flat",""),e,c,s;if(n(f).append(l.append(h)),e="None",c="",i)h.ejButton({text:e,type:"button",height:28,width:120,id:o,showRoundedCorner:!0,click:n.proxy(r._resSortButClick,r)});else{for(s=0;s<r.model.sortSettings.sortedColumns.length;s++)r.model.sortSettings.sortedColumns[s].field==o&&(e=r.model.sortSettings.sortedColumns[s].direction=="ascending"?"Ascending":"Descending",c=e=="Ascending"?"e-resIcon e-respponsiveSortingAsc":"e-resIcon e-respponsiveSortingDesc");c!=""?h.ejButton({text:e,type:"button",height:28,width:120,cssClass:"e-resSortIconBtn",id:o,prefixIcon:c,imagePosition:"imageright",contentType:"textandimage",showRoundedCorner:!0,click:n.proxy(r._resSortButClick,r)}):h.ejButton({text:e,type:"button",height:28,cssClass:"e-resSortIconBtn",width:120,id:o,showRoundedCorner:!0,click:n.proxy(r._resSortButClick,r)})}})},_sortOperation:function(t,i){var r,u,f;for(this._removeSortCol.indexOf(t)!=-1&&(this._sortColumns.splice(this._removeSortCol.indexOf(t),0),this._removeSortCol.splice(this._removeSortCol.indexOf(t),0)),r=0;r<this._sortColumns.length;r++)if(this._sortColumns[r].field==t)break;this.model.allowMultiSorting?(this.multiSortRequest=!0,r!=-1&&(this._sortColumns.splice(r,1),this._removeSortCol.indexOf(t)==-1&&this._removeSortCol.push(t))):(n("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-button").removeClass("e-disable"),u=n("#responsiveFilter").find(".e-responsivefilterColDiv").not(".e-responsivefilterColDiv[ej-mappingname='"+t+"']"),f=u.find(".e-button").addClass("e-disable"),f.text("None"),this._sortColumns.length>0&&(this._removeSortCol.push(this._sortColumns[0].field),this._sortColumns=[]));this._sortColumns.push({field:t,direction:i})},_resSortButClick:function(t){var f="",e="",u=t.model.id,i=n("#"+t.model.id).ejButton("instance"),r;if(t.model.text=="None")f="Ascending",e="e-resIcon e-respponsiveSortingAsc",this._sortOperation(u,"ascending");else if(t.model.text=="Ascending")f="Descending",e="e-resIcon e-respponsiveSortingDesc",this._sortOperation(u,"descending");else{for(i.model.text="None",i.model.prefixIcon="",i.type="button",i.model.contentType="text",i._render(),r=0;r<this._sortColumns.length;r++)if(this._sortColumns[r].field==u)break;this._removeSortCol.push(u);this._sortColumns.splice(r,1);n("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-button").removeClass("e-disable");return}i.model.text=f;i.model.prefixIcon="e-resIcon "+e;i.model.imagePosition="imageright";i.model.contentType="textandimage";i._render()},renderDiaglogButton:function(n,i){var r,o,f,e,u;return this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"?r="EditExternalForm_":this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?(r="InlineEditForm_",o=t.buildTag("div","","",{id:this._id+"_inlineFormTitle","class":"e-inlineform-titlebar"}),o.appendTo(i)):r="EditDialog_",f=t.buildTag("input.e-save e-button e-btnsub e-flat","",{"margin-left":"30px"},{type:"button",id:r+this._id+"_Save"}),f.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:this.localizedLabels.SaveButton,width:"100"}),e=t.buildTag("input.e-cancel e-button e-btncan e-flat","",{"margin-left":"19px","margin-right":"13px"},{type:"button",id:r+this._id+"_Cancel"}),e.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:this.localizedLabels.CancelButton,width:"100"}),u=this.model.editSettings.editMode!="dialog"&&this.model.editSettings.editMode!="dialogtemplate"?t.buildTag("div","","",{"class":"e-editform-btn"}):t.buildTag("div"),u.append(f),u.append(e),n.appendTo(i),this.model.editSettings.editMode!="dialog"&&this.model.editSettings.editMode!="dialogtemplate"?u.appendTo(i):n.append(u),i},_externalFormPosition:function(){var t=n(this.element).offset(),r=n(this.element).width(),u=n(this.element).height(),i=n("#"+this._id+"_externalEdit");switch(this.model.editSettings.formPosition){case"topright":n(i).find(".e-form-toggle-icon").removeClass("e-bottomleft").addClass("e-topright");n(i).css({left:t.left+r+1+"px",top:t.top+"px",position:"absolute",width:"290px"});n("#"+this._id+"_eFormContent").height("auto");break;case"bottomleft":n(i).find(".e-form-toggle-icon").removeClass("e-topright").addClass("e-bottomleft");n(i).css({left:t.left+"px",top:t.top+u+1+"px"});n("#"+this._id+"_eFormContent").width("100%")}},_setoffsetWidth:function(){var i,r=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):n("#"+this._id+"EditForm"),t;if(this._gridRecordsCount!=0||this.model.groupSettings.groupedColumns.length!=0||this.model.scrollSettings.frozenColumns!=0||this.model.scrollSettings.frozenRows!=0||this.model.editSettings.editMode=="batch")for(i=this.model.editSettings.editMode=="batch"?r.closest("td"):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate"?r.find(".e-rowcell").not(".e-unboundcell,.e-templatecell"):r.find("tr").find(".e-rowcell").not(".e-unboundcell,.e-templatecell"),t=0;t<i.length;t++)this._tdsOffsetWidth[t]=i.get(t).offsetWidth},_bulkChangesAcquired:function(){return this.batchChanges.added.length>0||this.batchChanges.changed.length||this.batchChanges.deleted.length?!0:!1},_renderDialog:function(){return t.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none"},{id:this._id+"_dialogEdit"})},getCurrentEditCellData:function(){var r,i,f,u,e,o;if(this.model.isEdit&&n("#"+this._id+"EditForm").length){r=n("#"+this._id+this._bulkEditCellDetails.fieldName.replace(/[^a-z0-9\s_]/gi,""));f=this.model.columns[this._bulkEditCellDetails.columnIndex];switch(this._bulkEditCellDetails.cellEditType){case t.Grid.EditingType.String:case t.Grid.EditingType.Numeric:i=r.val();break;case t.Grid.EditingType.Dropdown:i=this._bulkEditCellDetails.isForeignKey?{value:r.ejDropDownList("getSelectedValue"),text:r.ejDropDownList("getValue")}:r.ejDropDownList("getSelectedValue");this._bulkEditCellDetails.isForeignKey&&f.originalType=="number"&&i.value!=""&&(i.value=JSON.parse(i.value));break;case t.Grid.EditingType.Boolean:i=r.is(":checked");break;case t.Grid.EditingType.DatePicker:e=n.trim(r.val());o=r.ejDatePicker("instance");o._setDateValue(e);i=e==""?e:o.model.value;break;case t.Grid.EditingType.DateTimePicker:i=n.trim(r.val())==""?n.trim(r.val()):r.ejDateTimePicker("model.value");break;case"edittemplate":u=f.editTemplate.read;typeof u=="string"&&(u=t.util.getObject(u,window));i=u(r)}return typeof i=="string"&&i.length&&f.type=="number"&&(i=t.globalize.parseFloat(i,this.model.locale)),i}return null},cancelEditCell:function(){if(this.model.isEdit){var r=this.getRows()[this._bulkEditCellDetails.rowIndex],u={},i;t.createObject(this._bulkEditCellDetails.fieldName,this._bulkEditCellDetails.cellValue,u);i=n(r).hasClass("e-insertedrow")?n(r).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex+this.model.groupSettings.groupedColumns.length):n(r).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex);n(i).removeClass("e-validError");n(i).hasClass("e-updatedtd")&&n(i).addClass("e-gupdatenotify");n(i).removeClass("e-editedbatchcell").empty().html(n(n.templates[this._id+"_JSONTemplate"].render(u)).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex).innerHTML);this.model.isEdit=!1;this.element.focus()}},saveCell:function(i){var l,a,v,o,w,s;if(this.model.isEdit){if(!this.editFormValidate())return!0;var y=n("#"+this._id+"EditForm"),b=y.closest("tr"),k=y.closest("td"),f,e,r={},u=this.model.columns[this._bulkEditCellDetails.columnIndex],p=n("#"+this._id+this._bulkEditCellDetails.fieldName.replace(/[^a-z0-9\s_]/gi,"")),c,h;if(r={columnName:u.field,value:this.getCurrentEditCellData(),rowData:this._bulkEditCellDetails.rowData,previousValue:this._bulkEditCellDetails.cellValue,columnObject:u,cell:k,isForeignKey:this._bulkEditCellDetails.isForeignKey},!i&&this._trigger("cellSave",r)){this._focusElements(r.cell);this._bulkEditCellDetails.cancelSave=!0;return}if(this.model.allowTextWrap&&r.cell.addClass("e-nowrap"),(this._bulkEditCellDetails.cellEditType=="datetimepicker"||this._bulkEditCellDetails.cellEditType=="dropdownedit"||this._bulkEditCellDetails.cellEditType=="datepicker")&&p[p.data("ejWidgets")[0]]("destroy"),t.isNullOrUndefined(u.format)||(u.type!="date"&&u.type!="datetime"||t.isNullOrUndefined(r.value)||(r.isForeignKey?r.value.text=r.value.text.length>0?new Date(r.value.text):r.value.text:r.value=r.value.length>0?new Date(r.value):r.value),e=this.formatting(u.format,r.isForeignKey?!isNaN(parseFloat(r.value.text))&&isFinite(r.value.text)?parseFloat(r.value.text):r.value.text:r.value,this.model.locale),r.cell.empty().html(e)),t.createObject(this._bulkEditCellDetails.fieldName,r.isForeignKey?r.value.value:r.value,r.rowData),t.isNullOrUndefined(u.format)&&(e=r.isForeignKey?r.value.text:r.value),t.isNullOrUndefined(u.template)||(l=t.copyObject({},r.rowData),t.createObject(this._bulkEditCellDetails.fieldName,r.isForeignKey?r.value.value:r.value,l),e=n.templates(u.template).render(l)),this._bulkEditCellDetails.cellEditType=="edittemplate"?(r.value instanceof Array&&(e=r.value.join()),r.cell.empty().html(e)):r.columnObject.type=="boolean"||r.columnObject.editType=="booleanedit"?(a={},t.createObject(r.columnObject.field,r.value,a),r.cell.empty().html(n(n.templates[this._id+"_JSONTemplate"].render(a))[0].cells[this._bulkEditCellDetails.columnIndex].innerHTML)):r.columnObject.editType!="datepicker"&&r.columnObject.editType!="datetimepicker"||t.isNullOrUndefined(u.format)?r.columnObject.disableHtmlEncode?r.cell.text(e).html():r.cell.empty().html(e):r.cell.empty().html(e),r.cell.removeClass("e-validError"),r.cell.hasClass("e-updatedtd")&&r.cell.addClass("e-gupdatenotify"),r.previousValue=t.isNullOrUndefined(r.previousValue)?"":u.type=="date"||u.type=="datetime"?new Date(r.previousValue):r.previousValue,f=r.isForeignKey?r.value.value:r.value,v=!1,o=this.model.editSettings.rowPosition=="bottom"&&this._currentJsonData.length==this._bulkEditCellDetails.rowIndex?this._currentJsonData[this._bulkEditCellDetails.rowIndex-1]:this._currentJsonData[this._bulkEditCellDetails.rowIndex],v=this._currentJsonData.length>0?this._bulkEditCellDetails.type!="date"&&this._bulkEditCellDetails.type!="datetime"||t.isNullOrUndefined(this._bulkEditCellDetails.format)?t.isNullOrUndefined(t.getObject(r.columnName,o))?!t.isNullOrUndefined(f):(this._bulkEditCellDetails.cellEditType=="datepicker"||this._bulkEditCellDetails.cellEditType=="datetimepicker"||this._bulkEditCellDetails.cellEditType=="dropdownedit")&&f instanceof Date&&r.previousValue instanceof Date?f.getTime()!==t.getObject(r.columnName,o).getTime():typeof f=="number"?f!==parseFloat(t.getObject(r.columnName,o)):typeof f=="boolean"?f!=t.getObject(r.columnName,o):f!==t.getObject(r.columnName,o).toString():this._bulkEditCellDetails.cellValue instanceof Date?this.formatting(this._bulkEditCellDetails.format,f)!=this.formatting(this._bulkEditCellDetails.format,t.getObject(r.columnName,o)):!0:!0,this.model.isEdit=!1,v)r.cell.addClass("e-updatedtd e-icon e-gupdatenotify"),this._enableSaveCancel(),c=t.getObject(this._bulkEditCellDetails.fieldName,r.rowData),h=typeof c=="string"&&c.length?r.isForeignKey?r.value.value.toString():r.value.toString():r.isForeignKey?isNaN(parseInt(r.value.value))?r.value.value:parseInt(r.value.value):r.value,typeof r.value!="string"||h.length||(h=null),t.createObject(this._bulkEditCellDetails.fieldName,h,r.rowData),n.inArray(r.rowData,this.batchChanges.changed)==-1&&n.inArray(r.rowData,this.batchChanges.added)==-1&&this.batchChanges.changed.push(r.rowData),this.isejObservableArray&&(w=r.cell.closest("tr").hasClass("e-insertedrow")?"insert":"update",this._refreshViewModel(r,w));else if(r.cell.removeClass("e-updatedtd e-icon e-gupdatenotify"),this._enableSaveCancel(),this.batchChanges.changed.length>0&&!r.cell.hasClass("e-editedbatchcell e-updatedtd e-icon e-gupdatenotify")&&!r.cell.parent().children().hasClass("e-updatedtd e-icon e-gupdatenotify"))for(s=0;s<this.batchChanges.changed.length;s++)r.rowData[this._primaryKeys[0]]==this.batchChanges.changed[s][this._primaryKeys[0]]&&this.batchChanges.changed.splice(s,1);b.removeClass("e-editedrow").removeClass("e-batchrow");r.cell.removeClass("e-editedbatchcell")}},_refreshViewModel:function(i,u){var s,e,f;for(s=this._dataSource()instanceof t.DataManager?this._dataSource():t.DataManager(this._dataSource()),e=new t.Query,f=0;f<this._primaryKeys.length;f++)e=e.where(this._primaryKeys[f],t.FilterOperators.equal,this._primaryKeys.length?t.getObject(this._primaryKeys[f],i.rowData):null);var c=s.executeLocal(e),o=this._dataSource(r,!0),h=n.inArray(c[0],this._dataSource());this.model.editSettings.showConfirmDialog=!1;switch(u){case"update":o(i.rowData,h,u);break;case"remove":o(i.rowData,h,u);break;case"insert":o(i.rowData,0,u)}},_enableSaveCancel:function(){if(this.model.toolbarSettings.showToolbar){var n=this.getContentTable().find(".e-updatedtd.e-icon.e-gupdatenotify").length>0||this._isBatchDeleteApplied?"enableItemByID":"disableItemByID";$toolBar=this.element.find("#"+this._id+"_toolbarItems");$toolBar.ejToolbar(n,this._id+"_update");$toolBar.ejToolbar(n,this._id+"_cancel")}},setCellText:function(i,u,f){var v=typeof u=="string",nt=this._excludeDetailRows(),o,tt=this.model.groupSettings.groupedColumns.length!=0,h=this.model.scrollSettings.allowVirtualScrolling,e=this[v?"getColumnByField":"getColumnByIndex"](u),y=t.getObject(["currentViewData",tt?".records":""].join(""),this.model),c={},it=h?this._dataManager:new t.DataManager(y),l=this._primaryKeys[0],b=v||t.getObject(i+"."+l,h?this._dataManager.dataSource.json:y),rt=f,k=!1,a,d,p,w,ut,s,g;t.createObject(e.field,f,c);v&&(b=i,i=it.executeLocal((new t.Query).select(l)).indexOf(i),u=this.getColumnIndexByField(e.field));h&&(a=this.model.pageSettings.pageSize,w=i%a,d=(i+a-w)/a,p=(d-1)*a,isCached=n.inArray(p,this.virtualLoadedPages)!=-1,isCached&&(o=this.getContentTable().find("tr[name="+p+"]")[w].cells[u]));ut=this._excludeDetailRows()[i];s=this;t.isNullOrUndefined(e)||e.isPrimaryKey||e.allowEditing==!1||(t.isNullOrUndefined(e.validationRules)||($form=t.buildTag("form","",{},{id:this._id+"EditForm"}),$valElem=t.buildTag("input","",{},{id:this._id+e.field,value:f}),$form.addClass("gridform"),$form.append($valElem),this.element.append($form),$form.validate({errorPlacement:function(t){return s._alertDialog||s._renderAlertDialog(),n("#"+s._id+"AlertDialog_wrapper").css("min-height",""),s._alertDialog.find(".e-content").text(t.text()),s._alertDialog.ejDialog("open"),s.element.find($form).remove(),k=!0,!0}}),this.setValidationToField(e.field,e.validationRules)),t.isNullOrUndefined(e.format)||(g=this.formatting(e.format,e.foreignKeyValue?!isNaN(parseFloat(f))&&isFinite(f)?parseFloat(f):f:f,this.model.locale),rt=g),t.isNullOrUndefined(e.validationRules)||(n($form).validate().form(),this.element.find($form).remove()),k||(canSkip=i==-1||u==-1||h&&!isCached||i>(h?this._dataSource():y).length||u>this.model.columns.length,canSkip||(o=this.model.scrollSettings.frozenColumns?this._frozenCell(i,u)[0]:o||this._excludeDetailCells(nt[i])[u],f=e.format===r?f:this.formatting(e.format,f,this.model.locale),t.isNullOrUndefined(e.foreignKeyField)||t.isNullOrUndefined(e.foreignKeyValue)||(f=this._getForeignKeyData(c)[e.foreignKeyField][e.foreignKeyValue]),e.disableHtmlEncode?n(o).text(f):o.innerHTML=f,this._trigger("queryCellInfo",{cell:o,text:o.innerHTML,column:e,data:c})),l&&(t.createObject(l,b,c),this._dataManager.update(l,c))))},_excludeDetailCells:function(i){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)?n(i.cells):n(i.cells).not(".e-detailrowexpand, .e-detailrowcollapse")},setCellValue:function(i,u,f){var y;if(n("#"+this._id+"EditForm").length>0&&n("#"+this._id+"EditForm").attr("id","EditForm1"),this.model.editSettings.editMode=="batch"&&!this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.frozenColumns){var c=this.getDataByIndex(i),l=this._excludeDetailRows()[i],a=this.getColumnIndexByField(u),s=this,h=f,v=!1,e=this.getColumnByField(u),o;if(o=n(l).hasClass("e-insertedrow")?n(l.cells).not(".e-detailrowcollapse, .e-detailrowexpand")[a+this.model.groupSettings.groupedColumns.length]:n(l.cells).not(".e-detailrowcollapse, .e-detailrowexpand")[a],!t.isNullOrUndefined(e)&&!e.isPrimaryKey&&e.allowEditing!=!1){if(t.isNullOrUndefined(e.validationRules)||($form=t.buildTag("form","",{},{id:this._id+"EditForm"}),$valElem=t.buildTag("input","",{},{id:this._id+e.field,value:f}),$form.append($valElem),this.element.append($form),$form.validate({errorPlacement:function(t){return s._alertDialog||s._renderAlertDialog(),n("#"+s._id+"AlertDialog_wrapper").css("min-height",""),s._alertDialog.find(".e-content").text(t.text()),s._alertDialog.ejDialog("open"),s.element.find($form).remove(),v=!0,!0}}),this.setValidationToField(e.field,e.validationRules)),e.foreignKeyValue&&(h=this._foreignKeyBinding(a,f,this._id),h==r)){this._alertDialog||this._renderAlertDialog();n("#"+this._id+"AlertDialog_wrapper").css("min-height","");this._alertDialog.find(".e-content").text(this.localizedLabels.ForeignKeyAlert);this._alertDialog.ejDialog("open");t.isNullOrUndefined(e.validationRules)||this.element.find($form).remove();return}t.isNullOrUndefined(e.format)||(y=this.formatting(e.format,e.foreignKeyValue?!isNaN(parseFloat(f))&&isFinite(f)?parseFloat(f):f:f,this.model.locale),h=y);t.isNullOrUndefined(e.validationRules)||(n($form).validate().form(),this.element.find($form).remove());n("#EditForm1").attr("id",this._id+"EditForm");v||o.innerHTML==h||(n(o).has("form").length>0&&(this.model.isEdit=!1),n(o).hasClass("e-boolrowcell")?n(o).find("input").attr("checked",h):o.innerHTML=h,n(o).addClass("e-updatedtd e-icon e-gupdatenotify"),n(o).removeClass("e-validError e-editedbatchcell"),t.createObject(u,f,c),n.inArray(c,this.batchChanges.changed)==-1&&this.batchChanges.changed.push(c),this._enableSaveCancel())}}},setDefaultData:function(i){var e,h,o,u,f,c;if(t.isNullOrUndefined(i)){for(e=[],h=this.model.columns,o=0;o<this.model.columns.length;o++)e.push(this.model.columns[o].field);for(t.isNullOrUndefined(this._bulkEditCellDetails._data)&&(this._bulkEditCellDetails._data=[]),i={},u=function(n,r){t.createObject(n,r,i)},f=0;f<e.length;f++){var s=f,r=e[f],l=h[f].type,a=t.getObject(r,this._bulkEditCellDetails._data[0]),v=t.isNullOrUndefined(this.model.parentDetails)?null:this.model.parentDetails.parentKeyField;if(r===v&&(this.model.columns[s].defaultValue=this.model.parentDetails.parentKeyFieldValue),t.isNullOrUndefined(this.model.columns[s].defaultValue))switch(l){case"number":u(r,0);break;case"string":u(r,null);break;case"boolean":u(r,!1);break;case"object":n.isArray(a)?u(r,[]):u(r,null);case"datetime":case"date":u(r,null)}else u(r,this.model.columns[s].defaultValue)}t.isNullOrUndefined(this.model.queryString)||(c=this.model.foreignKeyField||this.model.queryString,i[c]=this.model.parentDetails.parentRowData[this.model.queryString])}this._bulkEditCellDetails.defaultData=i},_bulkDelete:function(i){if(this.model.editSettings.allowDeleting){if(t.isNullOrUndefined(i)&&(i=this._selectedRow()),i==-1){alert(this.localizedLabels.DeleteOperationAlert);return}var e,r,u,f={};if(this.multiDeleteMode&&this.selectedRowsIndexes.length>1?(u=[],r=this.getSelectedRows(),Array.prototype.push.apply(u,this.getSelectedRecords()),Array.prototype.push.apply(this.batchChanges.deleted,this.getSelectedRecords())):(e=this.getRows()[i],r=n(e),u=this.getDataByIndex(i)),f={primaryKey:this._primaryKeys,rowIndex:i,rowData:u,row:r},this._trigger("beforeBatchDelete",f))return;this.isejObservableArray&&this._refreshViewModel(f,"remove");this.model.isEdit&&this.cancelEditCell();r.hasClass("e-insertedrow")?(r.remove(),i=n.inArray(e,this._bulkEditCellDetails.insertedTrCollection),i!=-1&&(this._bulkEditCellDetails.insertedTrCollection.splice(i,1),this.batchChanges.added.splice(i,1))):(r.hide(),(f.rowIndex==0||r.hasClass("e-firstrow"))&&(r.hasClass("e-firstrow")&&this.getContentTable().find("tr").removeClass("e-firstrow"),this.getContentTable().find("tr:visible").first().addClass("e-firstrow")),n.isArray(u)||this.batchChanges.deleted.push(u));this._gridRows=this.getContentTable().find("td.e-rowcell").closest("tr").toArray();this.model.allowScrolling&&this._refreshScroller(f);this._isBatchDeleteApplied=!0;this._enableSaveCancel();this._selectedRow(-1);f={primaryKey:this._primaryKeys,rowIndex:i,rowData:u};this._trigger("batchDelete",f)}},_bulkAddRow:function(i){var h=n("#"+this._id+"EditForm"),r,u,f,e,o,s;if(h.length&&!this.editFormValidate())return!0;if(this.model.editSettings.allowAdding){if(r={},e=this.getRows(),t.isNullOrUndefined(i)||(this._bulkEditCellDetails.defaultData=i),t.isNullOrUndefined(this._bulkEditCellDetails.defaultData)&&this.setDefaultData(),r={defaultData:n.extend(!0,{},this._bulkEditCellDetails.defaultData),primaryKey:this._primaryKeys},this._trigger("beforeBatchAdd",r))return;for(u=n(n.render[this._id+"_JSONTemplate"](r.defaultData)).addClass("e-insertedrow"),e!=null&&n(e[0]).hasClass("e-alt_row")&&u.removeClass("e-alt_row"),this.model.editSettings.rowPosition=="top"?this.getContentTable().first().find("tbody").first().prepend(u):this.model.editSettings.rowPosition=="bottom"&&this.getContentTable().first().find("tbody").first().append(u),this.model.allowScrolling&&this._refreshScroller(r),this._gridRecordsCount===0&&this.getContentTable().find("tbody .emptyrecord").first().remove(),this._gridRows=this.getContentTable().find("td.e-rowcell").closest("tr").toArray(),o=0;o<this.model.groupSettings.groupedColumns.length;o++)u.prepend(t.buildTag("td.e-indentcell"));this._bulkEditCellDetails.insertedTrCollection.push(u.get(0));this.batchChanges.added.push(r.defaultData);s=this._gridRows.length-1;this.model.editSettings.rowPosition=="bottom"?(f=this._findNextEditableCell(0),this.selectRows(s),this.editCell(s,this.model.columns[f].field)):(f=this._findNextEditableCell(0),this.selectRows(0),this.editCell(0,this.model.columns[f].field));u.find(".e-rowcell").addClass("e-updatedtd e-icon e-gupdatenotify");this._enableSaveCancel();r={defaultData:r.defaultData};n.extend(r,{columnObject:this.model.columns[f],columnIndex:f,row:u,primaryKey:this._primaryKeys,cell:n(u[0].cells[f])});this._trigger("batchAdd",r)}},getDataByIndex:function(t){var i=n(this._excludeDetailRows()[t]),r;return i.hasClass("e-insertedrow")?(r=n.inArray(i[0],this._bulkEditCellDetails.insertedTrCollection),this.batchChanges.added[r]):this._bulkEditCellDetails._data[this.model.editSettings.rowPosition=="top"?t-this._bulkEditCellDetails.insertedTrCollection.length:t]},refreshBatchEditChanges:function(){this._bulkEditCellDetails={cellValue:null,rowIndex:-1,_data:null,columnIndex:-1,fieldName:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],rowData:null,isForeignKey:!1};this.batchChanges={added:[],deleted:[],changed:[]}},refreshBatchEditMode:function(){this.model.editSettings.editMode=="batch"&&(this.refreshBatchEditChanges(),this._bulkEditCellDetails._data=n.extend(!0,[],this.getCurrentViewData()))},batchCancel:function(){this.cancelEdit()},batchSave:function(){var n={},t=this;(this.saveCell(),n.batchChanges=this.getBatchChanges(),this._trigger("beforeBatchSave",n))||(n={},n.requestType="batchsave",this._sendBulkReuqest(this.getBatchChanges(),n))},_sendBulkReuqest:function(n,i){var r=this._dataManager.saveChanges(n,this._primaryKeys[0],this.model.query._fromTable,this.model.query),u=this;this._isBatchDeleteApplied=!1;this._dataManager instanceof t.DataManager&&!this._dataManager.dataSource.offline?(r.done(function(){u._processBindings(i)}),r.fail(function(n){var t={error:n.error};u._trigger("actionFailure",t)})):this._processBindings(i)},getBatchChanges:function(){return this.batchChanges},editCell:function(i,u){var c;if(!this.element.ejWaitingPopup("model.showOnInit")&&this.model.editSettings.allowEditing&&n.inArray(u,this._disabledEditableColumns)==-1){if(c=n("#"+this._id+"EditForm"),this.model.isEdit&&this.saveCell(),n.isFunction(n.validator)&&c.length&&c.validate().errorList.length)return;var o=n(this._excludeDetailRows()[i]),s=this.getColumnIndexByField(u),a=o.find(".e-rowcell").eq(s),e=this.model.columns[s],h=this.getDataByIndex(i),f={validationRules:t.isNullOrUndefined(e.validationRules)?{}:n.extend(!0,{},e.validationRules),columnName:e.field,value:t.getObject(t.isNullOrUndefined(u)?"":u,h),rowData:h,row:o,primaryKey:this._primaryKeys,columnObject:e,cell:a,isForeignKey:!t.isNullOrUndefined(e.foreignKeyValue)&&this.model.editSettings.editMode=="batch"?!0:!1},l=!0;if(this.model.allowTextWrap&&this.element.find(".e-rowcell").removeClass("e-nowrap"),this.model.allowScrolling&&this._refreshScroller(f),this._batchEditRowData=h,this._trigger("cellEdit",f))return;o.hasClass("e-insertedrow")&&(f.requestType="add");(n.inArray(u,this._primaryKeys)!=-1||f.columnObject.allowEditing===!1||(f.columnObject.template||f.columnObject.type=="checkbox")&&(f.columnObject.allowEditing==!1||!f.columnObject.field)||f.columnObject.commands)&&(n.extend(this._bulkEditCellDetails,{cellValue:f.value,rowIndex:i,fieldName:u,rowData:f.rowData,columnIndex:s,isForeignKey:t.isNullOrUndefined(f.columnObject.foreignKeyValue)?!1:!0}),l=!1);o.hasClass("e-insertedrow")&&f.columnObject.isPrimaryKey&&(l=!0);l&&(n.extend(this._bulkEditCellDetails,{rowIndex:i,cellValue:f.value,columnIndex:s,format:e.format==r?null:e.format,type:e.type,fieldName:u,cellEditType:f.columnObject.editType,rowData:h,isForeignKey:t.isNullOrUndefined(f.columnObject.foreignKeyValue)?!1:!0}),this._renderBulkEditObject(f,a),o.addClass("e-editedrow").addClass("e-batchrow"),f.cell.addClass("e-editedbatchcell"),f.columnObject.editType=="booleanedit"&&f.cell.addClass("e-boolrowcell"))}},_findNextEditableCell:function(n){for(var i=this.model.columns.length,t=n;t<i;t++)if(!this.model.columns[t].template&&!this.model.columns[t].commands&&this.model.columns[t].visible)return t;return-1},_findNextCell:function(i,r){var e,u=[],f,o=this.getRows();return this.model.columns[i].template&&(this.model.columns[i].__isTemplate=!0),this.model.columns[i].commands&&(this.model.columns[i].__isCommand=!0),f=t.Predicate("visible","equal",!0).and("__isTemplate","notequal",!0).and("__isCommand","notequal",!0),n(o[this._bulkEditCellDetails.rowIndex]).hasClass("e-insertedrow")||(f=f.and("allowEditing","notequal",!1)),e=r=="right"?this.model.columns.slice(i):this.model.columns.slice(0,i+1).reverse(),u=t.DataManager(e).executeLocal(t.Query().where(f)),u.length!=0||r=="left"&&this._bulkEditCellDetails.rowIndex==0||r=="right"&&this._bulkEditCellDetails.rowIndex+1==this.getRows().length||(e=r=="right"?this.model.columns.slice(0,i):this.model.columns.slice(i).reverse(),u=t.DataManager(e).executeLocal(t.Query().where(f)),this._bulkEditCellDetails.rowIndex=u.length&&r=="right"?this._bulkEditCellDetails.rowIndex+1:this._bulkEditCellDetails.rowIndex-1),u.length?n.inArray(u[0],this.model.columns):-1},_moveCurrentCell:function(i){var r,u=this._bulkEditCellDetails.rowIndex,f=n("#"+this._id+"EditForm");if(this._bulkEditCellDetails.rowIndex==-1&&this._bulkEditCellDetails.columnIndex==-1)return!0;switch(i){case"right":if(this._bulkEditCellDetails.rowIndex==this.getRows().length-1&&this._bulkEditCellDetails.columnIndex==this.model.columns.length-1||!this.element.is(document.activeElement)&&f.length==0)return!0;this._bulkEditCellDetails.columnIndex==this.model.columns.length-1?(r=0,this._bulkEditCellDetails.rowIndex=this._bulkEditCellDetails.rowIndex+1):r=this._bulkEditCellDetails.columnIndex+1;(t.isNullOrUndefined(this.model.columns[r].template)||!t.isNullOrUndefined(this.model.columns[r].field))&&t.isNullOrUndefined(this.model.columns[r].commands)&&this.model.columns[r].visible!==!1&&this.model.columns[r].allowEditing!==!1||(r=this._findNextCell(r,i));this._bulkEditCellDetails.rowIndex!=u&&this.selectRows(this._bulkEditCellDetails.rowIndex);r!=-1&&this.editCell(this._bulkEditCellDetails.rowIndex,this.model.columns[r].field);break;case"left":if(this._bulkEditCellDetails.rowIndex==0&&this._bulkEditCellDetails.columnIndex==0||!this.element.is(document.activeElement)&&f.length==0)return!0;this._bulkEditCellDetails.columnIndex==0?(r=this.model.columns.length-1,this._bulkEditCellDetails.rowIndex=this._bulkEditCellDetails.rowIndex-1,this.selectRows(this._bulkEditCellDetails.rowIndex)):r=this._bulkEditCellDetails.columnIndex-1;(t.isNullOrUndefined(this.model.columns[r].template)||!t.isNullOrUndefined(this.model.columns[r].field))&&t.isNullOrUndefined(this.model.columns[r].commands)&&this.model.columns[r].visible!==!1&&this.model.columns[r].allowEditing!==!1||(r=this._findNextCell(r,i));this._bulkEditCellDetails.rowIndex!=u&&this.selectRows(this._bulkEditCellDetails.rowIndex);r!=-1&&this.editCell(this._bulkEditCellDetails.rowIndex,this.model.columns[r].field);break;case"up":if(this._bulkEditCellDetails.rowIndex==0)return;r=this._bulkEditCellDetails.columnIndex;this._enableCheckSelect||this.selectRows(this._bulkEditCellDetails.rowIndex-1);this.editCell(this._bulkEditCellDetails.rowIndex-1,this.model.columns[this._bulkEditCellDetails.columnIndex].field);break;case"down":if(this._bulkEditCellDetails.rowIndex==this.getRows().length-1){this.endEdit();return}r=this._bulkEditCellDetails.columnIndex;this._enableCheckSelect||this.selectRows(this._bulkEditCellDetails.rowIndex+1);this._bulkEditCellDetails.columnIndex!=-1&&this.editCell(this._bulkEditCellDetails.rowIndex+1,this.model.columns[this._bulkEditCellDetails.columnIndex].field)}return addedRow=!n(this.getRows()[this._bulkEditCellDetails.rowIndex]).hasClass("e-insertedrow"),r!=-1&&(this.model.columns[r].commands||this.model.columns[r].isPrimaryKey&&addedRow||this.model.columns[r].template)&&this.element.focus(),!1},_renderBulkEditObject:function(i,r){var o=t.buildTag("form","",{},{id:this._id+"EditForm"}),c=this._bulkEditTemplate,l=this._id+i.columnObject.field,u,s,e={},h,f;t.createObject(i.columnObject.field,i.value,e);h={requestType:i.requestType};r.empty();r.parent().is(":last-child")||(r.addClass("e-validError"),r.removeClass("e-gupdatenotify"));s=c.find("#"+i.columnObject.field.replace(/\./g,t.pvt.consts.complexPropertyMerge)+"_BulkEdit").html();u=n(n.templates(s).render(e));u.get(0).tagName=="SELECT"&&(f=t.getObject(i.columnObject.field,e),u.val(t.isNullOrUndefined(f)?"":f.toString()),u.val()==null&&u.val(u.find("option").first().val()),u.data("ej-value",f));o.append(u);r.append(o);this._setoffsetWidth();this._refreshEditForm(h);n.isFunction(n.validator)&&!n.isEmptyObject(i.validationRules)&&(this.initValidator(),this.setValidationToField(i.columnObject.field,i.validationRules));this.model.isEdit=!0},_triggerConfirm:function(n){if(n!==r&&n.model.text==this._getDeprecatedLocalizedLabel("OKButton"))this._confirmDialog.find(".e-content").text()==this.localizedLabels.BatchSaveConfirm?this.batchSave():this._confirmDialog.find(".e-content").text()==this.localizedLabels.ConfirmDelete?this.model.editSettings.editMode=="batch"?this._bulkDelete():this.multiDeleteMode?this._multiRowDelete():t.isNullOrUndefined(this._cDeleteData)?this.deleteRow():(this.deleteRow(this._cDeleteData),this._cDeleteData=null):this._confirmDialog.find(".e-content").text()==this.localizedLabels.CancelEdit?this.cancelEdit():(this._confirmedValue=!0,this._processBindings(this._requestArgs)),this._isBatchDeleteApplied=!1,this.clearSelection();else{if(this._confirmDialog.find(".e-content").text()!=this.localizedLabels.BatchSaveConfirm&&this._confirmDialog.find(".e-content").text()!=this.localizedLabels.ConfirmDelete&&this._confirmDialog.find(".e-content").text()!=this.localizedLabels.CancelEdit)switch(this._requestArgs.requestType){case"grouping":this.model.groupSettings.groupedColumns.pop();break;case"ungrouping":this.model.groupSettings.groupedColumns.push(this._requestArgs.columnName);break;case"sorting":this._cSortedDirection=this._cSortedColumn=null;break;case"filtering":this.model.filterSettings.filteredColumns.reverse().splice(0,this._requestArgs.currentFilterObject);this.model.filterSettings.filteredColumns.reverse();break;case"paging":this._currentPage(this._requestArgs.previousPage);this.getPager().ejPager("model.currentPage",this._requestArgs.previousPage)}this._confirmedValue=!1}this._requestArgs=null;this._confirmDialog.ejDialog("close")},_batchCellValidation:function(n){var r=this.getRowByIndex(n),t;if(this.model.editSettings.editMode=="batch"&&this.model.isEdit&&r.hasClass("e-insertedrow"))for(i=0;i<this._validatedColumns.length;i++){if(t=this.getColumnIndexByField(this._validatedColumns[i]),!this.editFormValidate())return!0;this.editCell(n,this.model.columns[t].field)}},_saveCellHandler:function(t){var i=n(t.target),r;t.stopPropagation();r=this.model.editSettings.rowPosition=="top"||this._gridRows==null?0:this._gridRows.length-1;i.closest(".e-popup").length==0&&i.closest(".e-rowcell").find("#"+this._id+"EditForm").length==0&&(n(this.getRows()).hasClass("e-insertedrow")&&this._batchCellValidation(r),this.saveCell())},initValidator:function(){for(var r=this,i=this.model.scrollSettings.frozenColumns>0||this.model.editSettings.showAddNewRow?this.element.find(".gridform"):n("#"+this._id+"EditForm"),t=0;t<i.length;t++)i.eq(t).validate({ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(n,t){r._renderValidator(n,t)}})},_renderValidator:function(i,r){var v,w,y,d,g,nt;if(r.is(":hidden")&&(r=r.siblings("input:visible")),r.length){var f=r.closest(".e-rowcell"),e=n(i).addClass("e-error"),l=t.buildTag("div.e-errortail e-toparrow"),u=t.isNullOrUndefined(this.getContent().data("ejScroller"))?null:this.getScrollObject(),p=0;f=f.length?f:f=r.closest("td");f.find(".e-error").remove();r.parent().hasClass("e-in-wrap")?e.insertAfter(r.closest(".e-widget")):e.insertAfter(r);v=this.model.scrollSettings.frozenRows>0&&this._currentTrIndex>=this.model.scrollSettings.frozenRows?!0:!1;w=v?"append":"prepend";e[w](l);this.model.allowScrolling&&(u&&u._hScrollbar||u._vScrollbar)&&(f.addClass("e-validError"),p=u._hScrollbar?u._hScrollbar.element[0].offsetTop:0);var o=f.offset().top+f[0].offsetHeight+i[0].offsetHeight,a=!1,b=u&&u._hScrollbar?u._hScrollbar.model.height:0;if((u&&u.isHScroll()&&o>p||o>this.getContent()[0].offsetTop+this.getContent().find(".e-content").height())&&(a=!0),this.model.enableRTL?this.model.editSettings.editMode!="dialog"&&e.offset({top:r.offset().top+r.height()}):this.model.editSettings.editMode!="dialog"&&e.offset({left:r.offset().left,top:r.offset().top+r.height()}),this.model.scrollSettings.frozenRows<=0&&n.inArray(this.model.editSettings.editMode,["externalform","externalformtemplate","dialog","dialogtemplate"])==-1){var k=this.getContent(),h=k.find(".e-content"),c=h.height(),s=k[0].offsetTop;if(a&&u!=null&&u._vScrollbar&&this.model.scrollSettings.frozenColumns){var rt=u._vScrollbar.model.value-(o-(s+h[0].scrollHeight)),tt=s+h[0].scrollHeight,it=s+c;(!this.model.scrollSettings.frozenColumns&&o>tt||this.model.scrollSettings.frozenColumns&&o>it)&&(u._vScrollbar.model.maximum+=o-(s+c),u._vScrollbar.refresh(!0));this.model.scrollSettings.frozenColumns&&(y=this.getContent().find(".e-movablecontent"),y.height(y[0].scrollHeight));u.scrollY(r.offset().top-s+h[0].scrollTop)}else a&&this.model.allowScrolling&&u!=null&&(u.isVScroll()?u.isVScroll()&&(u.refresh(),this._showHideScroller(),u._vScroll&&(g=u._vScrollbar.model.value+(o-(s+c+b-b)),u.scrollY(g))):(d=o-(s+c),h.height(c+d)))}else v&&(a?(nt=e.css("top"),l.addClass("e-bottomarrow"),e.css({bottom:nt,top:"auto"})):l.prependTo(l.parent()));e.show("slow")}},setValidation:function(){for(var n=0;n<this.model.columns.length;n++)t.isNullOrUndefined(this.model.columns[n].validationRules)||this.setValidationToField(this.model.columns[n].field,this.model.columns[n].validationRules)},setValidationToField:function(i,r){var u=i,f,o,s,e;t.isNullOrUndefined(i)||(u=u.replace(/[^a-z0-9\s_]/gi,""));o=this.model.editSettings.editMode=="batch"?this.element.find("#"+this._id+"EditForm"):this.model.editSettings.showAddNewRow?n(this.getRows()).hasClass("e-editedrow")?this.element.find(".e-editedrow .gridform"):this.element.find(".e-addedrow .gridform"):this.element.find(".gridform");f=o.find("#"+this._id+u).length>0?o.find("#"+this._id+u):o.find("#"+u);r.regex&&(r[i+"regex"]=r.regex,delete r.regex,n.validator.addMethod(u+"regex",function(n,t,i){var r=i instanceof RegExp?i:new RegExp(i);return r.test(n)},t.getObject("messages.regex",r)||this.getColumnByField(i).headerText+" should match the given pattern"));f.attr("name")||f.attr("name",i);f.rules("add",r);s=n("#"+this._id+"EditForm").validate();s.settings.messages[i]=s.settings.messages[i]||{};t.isNullOrUndefined(r.required)||(e=t.isNullOrUndefined(r.messages&&r.messages.required)?n.validator.messages.required:r.messages.required,e.indexOf("This field")==0&&(e=e.replace("This field",this.getColumnByField(i).headerText)),s.settings.messages[i].required=e,f.hasClass("e-datepicker")&&f.ejDatePicker({watermarkText:""}))},_renderConfirmDialog:function(){var r=t.buildTag("div.e-content",this.localizedLabels.BatchSaveConfirm),i=t.buildTag("span.e-buttons",'<input type="button" class="e-flat e-btnsub" id='+this._id+'ConfirmDialogOK value="'+this._getDeprecatedLocalizedLabel("OKButton")+"\" /> <input type='button' class='e-flat e-btncan' id="+this._id+"ConfirmDialogCancel value='"+this.localizedLabels.CancelButton+"' />");this._confirmDialog=t.buildTag("div#"+this._id+"ConfirmDialog",{float:"left"});this._confirmDialog.append(r).append(i);this.element.append(this._confirmDialog);i.find("input").ejButton({cssClass:this.model.cssClass,showRoundedCorner:!0,size:"mini",click:n.proxy(this._triggerConfirm,this)});this._renderFDialog(this._id+"ConfirmDialog");this._confirmDialog.ejDialog({width:"auto",minWidth:0,minHeight:0,enableModal:!0})},_unboundClickHandler:function(i){var r=n(i.target).closest("button"),e,o,u,s,h,f,c,l;if((!r.hasClass("e-button")||!(r.hasClass("e-disable")||r.prop("disabled")))&&r.closest(".e-grid").attr("id")===this._id&&(e=0,o={},!n(i.target).hasClass("e-unboundcelldiv"))){if(u=r.hasClass("e-savebutton")?this.getIndexByRow(n(".e-editedrow")):this.getIndexByRow(r.closest("tr")),this.model.isEdit&&(!this._isLocalData||this._isRemoteSaveAdaptor)&&r.hasClass("e-editbutton")){this._unboundRow=r.closest("tr");return}if(s=this._currentJsonData[u],h=n(r).ejButton("instance"),(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlinetemplate")&&(e=n("#"+this._id).find(".e-editedrow").length),this.model.allowSelection&&!this.model.isEdit&&this.selectRows(this.getIndexByRow(r.closest("tr"))-e),r.hasClass("e-cancelbutton")&&(this.model.isEdit=!1),n.isFunction(n.fn.ejDatePicker)&&n("#"+this._id+"EditForm").find(".e-datepicker").ejDatePicker("hide"),r.hasClass("e-editbutton")&&this.model.editSettings.editMode!="batch")this.model.isEdit&&this.cancelEdit(),f=this.getRowByIndex(u),this.startEdit(f);else if(r.hasClass("e-deletebutton")){if(f=this.getRowByIndex(u),this.model.editSettings.showDeleteConfirmDialog&&!this._isUnboundColumn){this._toolbarOperation(this._id+"_delete");return}this.deleteRow(f)}else r.hasClass("e-savebutton")?(this.endEdit(),s=this._currentJsonData[u]):r.hasClass("e-cancelbutton")&&this.cancelEdit();o={rowIndex:u,data:s,buttonModel:h.model,commandType:r.val()};t.raiseWebFormsServerEvents&&(c={model:this.model,originalEventType:"commandButtonClick"},l=o,t.isNullOrUndefined(this.model.serverEvents)||n.inArray("commandButtonClick",this.model.serverEvents)==-1||t.raiseWebFormsServerEvents("commandButtonClick",c,l))}},addRecord:function(n,i){var u,r;this.model.editSettings.allowAdding&&this.element.find(".e-gridcontent .gridform").length==0&&(n?((this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")&&(u=t.buildTag("tr.e-addedrow"),this.getContentTable().find("tbody").first().prepend(u)),r={data:n},r.action="add",r.selectedRow=this._selectedRow(),this._cAddedRecord=n,r.requestType=t.Grid.Actions.Save,this._updateAction(r),r.selectedRow!=-1&&this.selectRows(r.selectedRow+1),this._isUnboundColumn&&this._refreshUnboundTemplate(this.getContentTable()),i||(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate")&&this.model.allowPaging&&this.model.pageSettings.pageSize<this.model.currentViewData.length&&this.model.groupSettings.groupedColumns.length==0&&!this.model.editSettings.showAddNewRow&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild)):this._startAdd())},updateRecord:function(n,i){this._updateDeleteRecord(n,i,"update");this.model.editSettings.editMode!="batch"&&(this.model.sortSettings.sortedColumns.length||this.model.summaryRows.length>0||this.model.groupSettings.groupedColumns.length||!t.isNullOrUndefined(this._searchCount)||this.filterColumnCollection.length)&&this.refreshContent()},_updateDeleteRecord:function(i,r,u){var l=t.DataManager(this._currentJsonData),e=[],f,s,h,o,c;t.isNullOrUndefined(i)||(e=l.executeLocal(t.Query().where(i,t.FilterOperators.equal,t.getObject(i,r))));e.length?(f=n.inArray(e[0],this._currentJsonData),o={data:r,requestType:t.Grid.Actions.Save,previousData:e[0],rowIndex:f},c=this._getForeignKeyData(o.data),t.isNullOrUndefined(c)||(o.foreignKeyData=c),this._trigger("actionBegin",o),f!=-1&&(s=this.getRowByIndex(f),u=="update"?(t.copyObject(e[0],r),h=n(n.render[this._id+"_JSONTemplate"](e)),s.hasClass("e-alt_row")?h.addClass("e-alt_row"):h.removeClass("e-alt_row"),s.replaceWith(h),this._trigger("actionComplete",o),this._isUnboundColumn&&this._refreshUnboundTemplate(this.getContentTable()),this.model.editSettings.editMode=="batch"?this.batchChanges.changed.push(e[0]):this._dataManager[u](i,r),this._isMapSelection&&(this._selectionByGrid=!0,this.multiSelectCtrlRequest=!0,r[this._selectionMapColumn]?this.selectRows(f):this.clearSelection(f),this._selectionByGrid=!1)):(n.inArray(f,this.selectedRowsIndexes)==-1&&this.selectedRowsIndexes.push(f),this.deleteRow(s)),this.model.editSettings.editMode=="batch"&&(this.batchSave(),this._confirmedValue=!0))):this.model.editSettings.editMode=="batch"?(this.batchChanges[u=="update"?"changed":"deleted"].push(r),this.batchSave(),this._confirmedValue=!0):this._dataManager[u](i,r)},deleteRecord:function(n,t){this._updateDeleteRecord(n,t,"remove")}}}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.sort={_addSortElementToColumn:function(i,r){var h=t.DataManager(this.model.columns).executeLocal(t.Query().where("field","equal",i)),f,o,e,s;if(o=h.length>1?this.getColumnByHeaderText(this._$curSElementTarget.text()):this.getColumnByField(i),!t.isNullOrUndefined(o)){var c=n.inArray(o,this.model.columns),l=this.getsortColumnByField(i),a=n.inArray(l,this.model.sortSettings.sortedColumns),u=this.getHeaderTable().find("thead tr:not('.e-stackedHeaderRow')").find(".e-headercell").not(".e-detailheadercell").eq(c).find(".e-headercelldiv");if(r=t.isNullOrUndefined(r)?"ascending":r.toLowerCase(),u.find(".e-ascending,.e-descending").remove(),this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i+"']").find(".e-ascending,.e-descending").not(".e-ungroupbutton").remove(),f=r!="descending"?"e-rarrowup-2x":"e-rarrowdown-2x",e=1,this.model.allowSorting&&this.model.allowMultiSorting&&this.model.sortSettings.sortedColumns.length>1){for(s=1;s<=a;s++)e=e+1;u.css("text-align")=="right"?(u.prepend(this._createSortNumber(e,u).addClass("e-sortnumber")),u.append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f))):(u.prepend(this._createSortNumber(e,u).addClass("e-sortnumber")),u.append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f)))}else u.append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f));this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i+"']").append(this._createSortElement().addClass("e-"+(r||"ascending")+" "+f));u.parent().attr("aria-sort",r)}},_removeSortElementFromColumn:function(t){var r=this.getColumnByField(t),u=n.inArray(r,this.model.columns),i=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell").eq(u).find(".e-headercelldiv");i.find(".e-ascending,.e-descending").remove();i.parent().prop("aria-sort",!1)},_sortCompleteAction:function(i){var f,e,r,u;for(e=this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").parent().attr("ej-mappingname"),this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),n(this.getHeaderTable().find(".e-columnheader").find(".e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell,.e-hide)")[this.getColumnIndexByField(e)]).removeAttr("aria-sort"),this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i.columnName+"']").find(".e-ascending,.e-descending,.e-number").not(".e-ungroupbutton").remove(),this.getHeaderTable().find("[aria-sort]").prop("aria-sort",!1),r=0;r<this.model.sortSettings.sortedColumns.length;r++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[r].field,this.model.sortSettings.sortedColumns[r].direction);this.model.groupSettings.groupedColumns.length&&this._$curSElementTarget!=null&&(u=this._checkEinGroupDrop(n.trim(this._$curSElementTarget.attr("ej-mappingname"))),t.isNullOrUndefined(u)||(f=(t.isNullOrUndefined(i.columnSortDirection)||i.columnSortDirection==""?this.getsortColumnByField(this._$curSElementTarget.attr("ej-mappingname")).direction.toLowerCase():i.columnSortDirection)=="ascending"?"e-rarrowup-2x":"e-rarrowdown-2x",u.find(".e-ascending,.e-descending").removeClass().addClass("e-icon e-"+(t.isNullOrUndefined(i.columnSortDirection)||i.columnSortDirection==""?this.getsortColumnByField(this._$curSElementTarget.attr("ej-mappingname")).direction.toLowerCase():i.columnSortDirection)+" "+f)));this.multiSortRequest=!1;(!this.model.allowScrolling||!this.initialRender||this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this.setWidthToColumns()},removeSortedColumns:function(t){if(n.isArray(t))for(var i=0;i<t.length;i++)this._removeSortedColumnFromCollection(t[i]);else this._removeSortedColumnFromCollection(t);this.multiSortRequest=!0;this.sortColumn(null,null)},_removeSortedColumnFromCollection:function(n){for(var t=0;t<this.model.sortSettings.sortedColumns.length;t++)if(this.model.sortSettings.sortedColumns[t].field==n){this.model.sortSettings.sortedColumns.splice(t,1);break}},clearSorting:function(){var t=this;this.model.sortSettings.sortedColumns=n.grep(this.model.sortSettings.sortedColumns,function(i){return n.inArray(i.field,t.model.groupSettings.groupedColumns)!=-1?!0:!1});this._$prevSElementTarget=null;this._$curSElementTarget=null;this.refreshContent()},sortColumn:function(i,r){var u,f,e;this.model.allowSorting&&n.inArray(i,this._disabledSortableColumns)==-1&&(i==null||i.length!=0)&&(u={},this.multiSortRequest||(f=this,this.model.sortSettings.sortedColumns=n.grep(this.model.sortSettings.sortedColumns,function(t){return n.inArray(t.field,f.model.groupSettings.groupedColumns)!=-1?!0:!1})),u.requestType=t.Grid.Actions.Sorting,this._cSortedColumn=u.columnName=i,this._cSortedDirection=u.columnSortDirection=t.isNullOrUndefined(r)?t.sortOrder.Ascending:r.toLowerCase(),this._cSortedColumn!==null&&(this._removeSortedColumnFromCollection(i),this.model.sortSettings.sortedColumns.push({field:this._cSortedColumn,direction:this._cSortedDirection})),e=this._processBindings(u),e&&(this._cSortedDirection=this._cSortedColumn=null),this._primaryKeyValues=[])},_createSortElement:function(){return t.buildTag("span.e-icon"," ")},_renderMultiTouchDialog:function(){var n,r,i;this._customPop=t.buildTag("div.e-gridpopup","",{display:"none"});n=t.buildTag("div.e-content");r=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSorting&&(i=t.buildTag("span.e-sortdirect e-icon"),n.append(i));this.model.selectionType=="multiple"&&(i=t.buildTag("span.e-rowselect e-icon"),n.append(i));this._customPop.append(n);this._customPop.append(r);this.element.append(this._customPop)}}}(jQuery,Syncfusion),function($,ej,undefined){ej.gridFeatures=ej.gridFeatures||{};ej.gridFeatures.filter={getFilterBar:function(){return this._gridFilterBar},setGridFilterBar:function(n){this._gridFilterBar=n},filterColumn:function(n,t,i,r,u,f){var e,a,s,h,p,d,l,o,g,y,w,k,v;if(this.model.allowFiltering)for(e=this.getColumnByField(n),(ej.isNullOrUndefined(e)||ej.isNullOrUndefined(e.filterBarTemplate)||e.type!="boolean"||i!="true")&&i!="false"||(i=JSON.parse(i)),e&&ej.isNullOrUndefined(e.format)?e.type=="date"?a=ej.preferredCulture().calendar.patterns.d:e.type=="datetime"&&(a=ej.preferredCulture().calendar.patterns.f):e&&(a=e.format.replace("{0:","").replace("}","")),!ej.isNullOrUndefined(e)&&!ej.isNullOrUndefined(e.filterBarTemplate)&&(e.type=="date"||e.type=="datetime")&&i.length>0&&(i=ej.parseDate(i,a,this.model.locale)),s=[],typeof n=="object"?s=n:s.push({field:n,operator:t,value:i,predicate:r,matchcase:u,actualFilterValue:f}),h=0;h<s.length;h++){var n=s[h].field,t=s[h].operator,i=s[h].value,r=s[h].predicate,u=ej.isNullOrUndefined(s[h].matchcase)?!1:s[h].matchcase,f=s[h].actualFilterValue,c={};for(c.requestType=ej.Grid.Actions.Filtering,c.currentFilterObject=[],this._$curFieldName=n,$.isArray(t)||(t=$.makeArray(t)),$.isArray(i)||(i=$.makeArray(i)),$.isArray(r)||(r=$.makeArray(r)),p=!1,d=this._filterCollection,ej.util.isNullOrUndefined(this._currentFilterColumn)&&(this._currentFilterColumn=this.getColumnByField(n)),l=0;l<t.length;l++){if(o={field:n,operator:t[l],value:i[l],matchcase:u,predicate:r[l],actualFilterValue:ej.getObject("value",f),actualOperator:ej.getObject("operator",f)},predicated=ej.getObject("ejpredicate",f),predicated&&(o=predicated),this._$colType!=null&&this.model.filterSettings.filterType!="filterbar"||ej.isNullOrUndefined(this._currentFilterColumn)||(this._$colType=this._currentFilterColumn.type),this.model.filterSettings.filteredColumns.length==0&&o.value!=="")(this._$colType=="date"||this._$colType=="datetime")&&this.model.filterSettings.filterType!=="excel"&&(t=="equal"||t=="notequal")&&typeof o.value!="string"?this._setDateFilters(o):this.model.filterSettings.filteredColumns.push(o);else{if(g=this,!p){var nt=ej.DataManager(this.model.filterSettings.filteredColumns),tt=(new ej.Query).where("field",ej.FilterOperators.equal,o.field),b=nt.executeLocal(tt);for(y=0;y<b.length;y++)w=$.inArray(b[y],this.model.filterSettings.filteredColumns),w!=-1&&this.model.filterSettings.filteredColumns.splice(w,1)}o.value!==""&&((this._$colType=="date"||this._$colType=="datetime")&&this.model.filterSettings.filterType!=="excel"&&(t=="equal"||t=="notequal")&&typeof o.value!="string"?this._setDateFilters(o):this.model.filterSettings.filteredColumns.push(o))}p=!0;c.currentFilterObject.push(o)}c.filterCollection=this.model.filterSettings.filteredColumns;c.currentFilteringColumn=n;k=this._processBindings(c);k&&(this.model.filterSettings.filteredColumns.reverse().splice(0,t.length),this.model.filterSettings.filteredColumns.reverse());this.model.filterSettings.filterType=="filterbar"&&(v=this.getHeaderTable().find("#"+n+"_filterBarcell"),v.val()!=""&&(v.val()==i||this._fltrBarcell)||(i[0]instanceof Date?v.val(ej.format(i[0],a,this.model.locale)):v.val(i[0]),this._currentFilterbarValue=i,this.filterStatusMsg="",this._showFilterMsg()));ej.isNullOrUndefined(e)||ej.isNullOrUndefined(e.filterBarTemplate)||(this.filterStatusMsg="",this._currentFilterbarValue=c.currentFilterObject[0].value,this._oldFilterColumn!=e&&this.filterColumnCollection.length>0&&$.inArray(e,this.filterColumnCollection)==-1&&this.filterColumnCollection.push(e),this._oldFilterColumn=this._currentFilterColumn=e,this._showFilterMsg());this._fltrBarcell=!1}},search:function(n){var t={};$("#"+this._id+"_search").find("input").val()!=n;$("#"+this._id+"_search").find("input").val(n);t.requestType=ej.Grid.Actions.Search;t.keyValue=n;this.model.searchSettings.fields=this.model.searchSettings.fields.length!=0?this.model.searchSettings.fields:this.getColumnFieldNames();(n!=""||this.model.searchSettings.key!="")&&(this.model.searchSettings.key=n.toLowerCase()==this.localizedLabels.True.toLowerCase()?"true":n.toLowerCase()==this.localizedLabels.False.toLowerCase()?"false":n,this._processBindings(t));this._primaryKeyValues=[]},_filterBarHandler:function(n){var f=n.keyCode,i=$(n.target),u,r,t;if(i.closest(".e-grid").attr("id")===this._id&&(this.model.filterSettings.filterBarMode=="immediate"||f==13)&&f!=9){for(i=$(n.target),this.filterStatusMsg="",u=i.prop("id").replace("_filterBarcell",""),t=0;t<this.model.columns.length;t++)if(ej.isNullOrUndefined(this.model.columns[t].foreignKeyValue)||u.indexOf("_"+this.model.columns[t].foreignKeyValue)==-1){if(this.model.columns[t].field==u){r=this.model.columns[t];break}}else{r=this.model.columns[t];break}if(r==null)return;if(this._currentFilterColumn=r,this._$curFieldName=r.field,this._currentFilterColumn!=this._oldFilterColumn&&(this.filterValueOldLength=0),this._currentFilterbarValue=i.val().toLowerCase()==this.localizedLabels.True.toLowerCase()?"true":i.val().toLowerCase()==this.localizedLabels.False.toLowerCase()?"false":i.val(),this.filterValueCurrentLength=this._currentFilterbarValue.length,(this.filterValueCurrentLength==0&&this.filterValueOldLength==0||this._currentFilterbarValue==this.OldfilterValue)&&this._currentFilterColumn==this._oldFilterColumn&&!this.model.scrollSettings.enableVirtualization){this._showFilterMsg();return}if(this._skipFilterProcess=this._checkForSkipInput(),this._skipFilterProcess)if(this._currentFilterColumn.type=="string")this.filterStatusMsg="Invalid Filter Data",this._showFilterMsg();else{this._skipFilterProcess=!1;this.model.scrollSettings.enableVirtualization||this._showFilterMsg();return}else this._processFilter(n)}},_renderResponsiveFilter:function(){for(var i,r,n=ej.buildTag("div#responsiveFilter.resFilterDiv","",{width:"100%",padding:"0px"}),f=$(window).height()+1,h=f*(8/100),v=this.element.height()>f?$(window).width()+16.5:$(window).width(),e=ej.buildTag("div.columnDiv","",{width:"100%"}),t=0;t<this.model.columns.length;t++)i=ej.buildTag("div.e-responsivefilterColDiv","",{width:"100%"},{"ej-MappingName":this.model.columns[t].field}),r=ej.buildTag("span",this.model.columns[t].headerText,{"margin-left":"4%"}),i.append(r),e.append(i);n.append(e);this.element.append(n);var c=this,y=this.element.outerWidth(),u=ej.buildTag("div.e-resFilterDialogHeaderDiv","",{height:h}),r=ej.buildTag("div.labelRes","<span>Filter<\/span>"),o=ej.buildTag("div.e-resFilterleftIcon","",{"margin-top":"3%"}),l=ej.buildTag("span.e-icon e-responsiveFilterClear e-resIcon","",{"font-size":"23px"}),s=ej.buildTag("div.e-resFIlterRigthIcon","",{float:"right","margin-top":"3%"},{closeDialogue:"responsiveFilter",gridEle:!0}),a=ej.buildTag("span.e-icon e-responisveClose e-resIcon","",{"font-size":"23px"},{closeDialogue:"responsiveFilter",gridEle:!0});s.click(function(){$("#responsiveFilter").css("display","none");c.element.css("display","block")});o.click(function(){$("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-filternone").click()});u.append(o.append(l));u.append(r).append(s.append(a));n.prepend(u);n.insertAfter(this.element);$(".resFilterDiv").on("keydown",$.proxy(this._responsiveDialogueKeyUp,this));n.css("display","none");$(".e-responsivefilterColDiv").on("click",$.proxy(this._mouseClickHandler,this))},_closeDivIcon:function(n){var i=$(n.target),t;ej.isNullOrUndefined(i.attr("closeDialogue"))||(t=$("#"+i.attr("closeDialogue")),ej.isNullOrUndefined(t.data("ejDialog"))?t.css("display","none"):t.ejDialog("close"));ej.isNullOrUndefined(i.attr("gridEle"))||this.element.css("display","block");ej.isNullOrUndefined(i.attr("openDialogue"))||(this.model.enableResponsiveRow||i.attr("closeDialogue").indexOf("Custom")!=-1?(t=$("#"+i.attr("openDialogue")),ej.isNullOrUndefined(t.data("ejDialog"))?t.css("display","block"):t.ejDialog("open")):this.element.css("display","block"))},_setResponsiveFilterIcon:function(){var t=$("#responsiveFilter").find(".columnDiv"),i=this,n;for(t.find(".e-filtericon").remove(),n=0;n<this.model.filterSettings.filteredColumns.length;n++){var r=this.model.filterSettings.filteredColumns[n],u=t.find(".e-responsivefilterColDiv[ej-MappingName="+r.field+"]"),f=ej.buildTag("div.e-filtericon e-icon e-resIcon e-filterset e-filternone e-filterreset","",{float:"right",height:"22px",width:"21px","font-size":"20px","margin-right":"3%","margin-top":"2%"}),e=ej.buildTag("span.e-filtericon e-icon e-resIcon e-filterset e-filternone","",{},{colType:r.type});u.find(".e-filternone").remove();u.append(f);e.click(function(n){var t=n.target;i._$colType=t.attr("colType");i._fltrClrHandler();t.remove()})}},_renderExcelFilter:function(){var n=this.model.filterSettings.filteredColumns.length!=0?this.model.filterSettings.filteredColumns[0].field:null,t={instance:this,showSortOptions:this.model.allowSorting,allowFormatFiltering:this.model.filterSettings.allowFormatFiltering,allowCaseSensitive:this.model.filterSettings.enableCaseSensitivity,maxFilterLimit:this.model.filterSettings.maxFilterChoices,interDeterminateState:this.model.filterSettings.enableInterDeterminateState,enableComplexBlankFilter:this.model.filterSettings.enableComplexBlankFilter,blankValue:this.model.filterSettings.blankValue,filterHandler:ej.proxy(this._filterHandler,this),initFilterCol:n,actionBegin:"actionBegin",actionComplete:"actionComplete"};this._excelFilter=new ej.excelFilter(t);$.extend(this._excelFilter,this.model.filterSettings)},_filterHandler:function(n){var r={},o,s,h,u,f,i,t,e,c;if(r.requestType=n.action=="sorting"?n.action:"filtering",s=this.model.filterSettings.filteredColumns,n.action=="filtering"){for(o=ej.DataManager(this.model.filterSettings.filteredColumns),h=(new ej.Query).where("field",ej.FilterOperators.equal,n.fieldName),u=o.executeLocal(h),t=0;t<u.length;t++)f=$.inArray(u[t],this.model.filterSettings.filteredColumns),f!=-1&&this.model.filterSettings.filteredColumns.splice(f,1);ej.merge(this.model.filterSettings.filteredColumns,n.filterCollection);n.currentFilterCollection=n.filterCollection}else{if(n.action=="clearfiltering"){for(i=n.filterDetails,delete this._excelFilter._predicates[0][n.fieldName],this.filterColumn(i.field,i.operator,i.value,i.predicate),t=0;t<this.filterColumnCollection.length;t++)this.filterColumnCollection[t].field==i.field&&this.filterColumnCollection.splice(t,1);return}if(n.action=="sorting"){e=n.sortDetails;ej.gridFeatures.sort&&this.sortColumn(e.field,e.direction);this._excelFilter.closeXFDialog();return}}r.currentFilteringColumn=n.fieldName;r.predicated=n.ejpredicate;c=this._processBindings(r);c&&(this.model.filterSettings.filteredColumns=s)},_renderFiltering:function(){var c=this.getHeaderTable(),v,u,r=ej.buildTag("tr.e-filterbar"),y,l=[],i,n,e,s,t,a,h;for((this.model.detailsTemplate||this.model.childGrid)&&r.append(ej.buildTag("th.e-filterbarcell e-mastercell")),n=0;n<this.model.columns.length;n++){var o=ej.buildTag("th.e-filterbarcell"),f=ej.buildTag("div.e-filterdiv"),p=ej.buildTag("span.e-cancel e-icon e-hide"),e=ej.isNullOrUndefined(this.model.columns[n].field)?this.model.columns[n].field:this.model.columns[n].field.replace(/[^a-z0-9|s_]/gi,""),s=ej.isNullOrUndefined(this.model.columns[n].foreignKeyValue)?e+"_filterBarcell":e+"_"+this.model.columns[n].foreignKeyValue+"_filterBarcell";if(this.model.columns[n].allowFiltering==!1||ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate)||ej.isNullOrUndefined(this.model.columns[n].field)?(f.addClass("e-fltrinputdiv"),e=this.model.columns[n].field,s=ej.isNullOrUndefined(this.model.columns[n].foreignKeyValue)?e+"_filterBarcell":e+"_"+this.model.columns[n].foreignKeyValue+"_filterBarcell",i=ej.buildTag("input.e-ejinputtext e-filtertext","",{},{title:this.model.columns[n].headerText+this.localizedLabels.FilterbarTitle,type:"search",id:s})):(o.addClass("e-fltrtemp"),f.addClass("e-fltrtempdiv"),ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate.create)?i=ej.buildTag("input e-filtertext","",{},{title:this.model.columns[n].headerText+this.localizedLabels.FilterbarTitle,id:s,"class":"e-filterUi_input e-filtertext e-fltrTemp"}):(v={columnIndex:n,column:this.model.columns[n]},u=this.model.columns[n].filterBarTemplate.create,typeof u=="string"&&(u=ej.util.getObject(u,window)),i=u(v),i=$(i).attr({title:this.model.columns[n].headerText+this.localizedLabels.FilterbarTitle,id:s,"class":"e-filterUi_input e-filtertext e-fltrTemp"}))),this.model.filterSettings.filteredColumns.length>0&&this.model.filterSettings.filterType=="filterbar"&&$.inArray(this.model.columns[n].field,l)==-1)for(t=0;t<this.model.filterSettings.filteredColumns.length;t++)this.getColumnIndexByField(this.model.filterSettings.filteredColumns[t].field)==n&&(this.model.filterSettings.filteredColumns[t].operator=="greaterthan"?i.val(">"+this.model.filterSettings.filteredColumns[t].value):this.model.filterSettings.filteredColumns[t].operator=="lessthan"?i.val("<"+this.model.filterSettings.filteredColumns[t].value):this.model.filterSettings.filteredColumns[t].operator=="notequal"?i.val("!="+this.model.filterSettings.filteredColumns[t].value):i.val(this.model.filterSettings.filteredColumns[t].value),$.inArray(this.model.filterSettings.filteredColumns[t].field,l)==-1&&l.push(this.model.filterSettings.filteredColumns[t].field));(this.model.columns[n].allowFiltering===!1||this.model.columns[n].field==""||ej.isNullOrUndefined(this.model.columns[n].field))&&(i.attr("disabled",!0).addClass("e-disable"),this._disabledFilterableColumns.push(this.model.columns[n].headerText));this.model.columns[n].visible===!1&&o.addClass("e-hide");ej.isNullOrUndefined(this.model.columns[n].cssClass)||o.addClass(this.model.columns[n].cssClass);this.model.columns[n].allowFiltering==!1||ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate)?f.append(i).append(p):f.append(i);r.append(o.append(f));n==this.model.scrollSettings.frozenColumns-1&&(y=r.clone(),c.find("thead").first().append(y),r.empty())}if(c.find("thead").last().append(r),ej.browserInfo().name=="msie"&&ej.browserInfo().version<10)for(a=c.find("thead").find(".e-ejinputtext.e-filtertext"),h=0;h<a.length;h++)ej.ieClearRemover(a[h]);this.setGridFilterBar(r)},_renderFilterBarTemplate:function(){for(var u,t,i,r,f=!1,n=0;n<this.model.columns.length;n++)if(this.model.columns[n].allowFiltering!=!1&&!ej.isNullOrUndefined(this.model.columns[n].filterBarTemplate)&&!ej.isNullOrUndefined(this.model.columns[n].field)){if(i=this.model.columns[n].filterBarTemplate.read,typeof i=="string"&&(i=ej.util.getObject(i,window)),t=this.model.columns[n].foreignKeyField?{element:this.getHeaderTable().find(".e-filterbar").find(".e-fltrtemp").find("#"+this.model.columns[n].field.replace(/[^a-z0-9|s_]/gi,"")+"_"+this.model.columns[n].foreignKeyValue.replace(/[^a-z0-9|s_]/gi,"")+"_filterBarcell"),columnIndex:n,column:this.model.columns[n]}:{element:this.getHeaderTable().find(".e-filterbar").find(".e-fltrtemp").find("#"+this.model.columns[n].field.replace(/[^a-z0-9|s_]/gi,"")+"_filterBarcell"),columnIndex:n,column:this.model.columns[n]},typeof t.column.filterBarTemplate.read=="string"&&(t.column.filterBarTemplate.read=i),r=this.model.columns[n].filterBarTemplate.write,typeof r=="string"&&(r=ej.util.getObject(r,window)),this.model.filterSettings.filteredColumns.length>0)for(u=0;u<this.model.filterSettings.filteredColumns.length;u++)this.model.columns[n].field==this.model.filterSettings.filteredColumns[u].field&&(t.modelVal=this.model.filterSettings.filteredColumns[u].value);r.call(this,t);f=!0}f&&(this.model.filterSettings.filterBarMode=ej.Grid.FilterBarMode.OnEnter)},_closeFilterDlg:function(){ej.isNullOrUndefined($("#"+this._id+"_"+this._$colType+"Dlg").data("ejDialog"))?$("#"+this._id+"_"+this._$colType+"Dlg").css("display","none"):$("#"+this._id+"_"+this._$colType+"Dlg").ejDialog("close");this._$fDlgIsOpen=!1;this._$menuDlgIsOpen=!1},_filterBarClose:function(n){var t=$(n.target),i;t.closest(".e-grid").attr("id")===this._id&&(n.type=="click"&&t.hasClass("e-cancel")&&(i=t.prev(),i.focus().val(""),i.trigger("keyup"),n.stopPropagation()),n.type=="focusin"&&t.hasClass("e-filtertext")&&(t=$(n.target).next(),this.getFilterBar().find(".e-cancel").addClass("e-hide"),t.removeClass("e-hide")))},_processFilter:function(n){this._alreadyFilterProcessed?(this._stopTimer(),this._startTimer(n)):(this._alreadyFilterProcessed=!0,this._startTimer(n))},_startTimer:function(n){var t=this,i=n.keyCode==13?0:t.model.filterSettings.immediateModeDelay;this._timer=window.setTimeout(function(){t._onTimerTick()},i)},_stopTimer:function(){this._timer!=null&&window.clearTimeout(this._timer)},_onTimerTick:function(){var n,t,i;this.OldfilterValue=this._currentFilterbarValue;this._oldFilterColumn=this._currentFilterColumn;this.filterValueOldLength=this.filterValueCurrentLength;this._findPredicate();var r=this._currentFilterColumn.type=="string"?!1:!0,u=$.extend([],this.model.filterSettings.filteredColumns);for(n=0;n<u.length;n++)this.getHeaderContent().find(".e-filterbar #"+u[n].field+"_filterBarcell").val()==""&&($.inArray(this.model.filterSettings.filteredColumns[n],this.filterColumnCollection)!=-1&&this.filterColumnCollection.splice(n,1),this.model.filterSettings.filteredColumns.splice(n,1));if(this._currentFilterColumn.type=="date"||this._currentFilterColumn.type=="datetime")for(t=0;t<this.model.filterSettings.filteredColumns.length;t++)this.model.filterSettings.filteredColumns[t].isComplex&&(i=this.model.filterSettings.filteredColumns[t].predicates,this.model.filterSettings.filteredColumns.length==1?this.model.filterSettings.filteredColumns=i:(this.model.filterSettings.filteredColumns[t]=i[0],this.model.filterSettings.filteredColumns.push(i[1])));this._skipFilterProcess?this.filterStatusMsg="Invalid Filter Data":this._currentFilterColumn.foreignKeyValue&&this._currentFilterColumn.dataSource&&this._currentFilterbarValue!=""?this._fltrForeignKeyValue(this._operator,this._currentFilterbarValue,r,this._currentFilterColumn.dataSource,this._currentFilterColumn.foreignKeyField,this._currentFilterColumn.foreignKeyValue,this._currentFilterColumn.type):ej.isNullOrUndefined(this._currentFilterColumn.filterBarTemplate)&&(this._fltrBarcell=!0,this.filterColumn(this._currentFilterColumn.field,this._operator,this._currentFilterbarValue,this._predicate,r));!this.model.scrollSettings.enableVirtualization&&ej.isNullOrUndefined(this._currentFilterColumn.filterBarTemplate)&&this._showFilterMsg();this._stopTimer()},_findPredicate:function(){var u=this._currentFilterbarValue.replace(/ && /i," and ").replace(" || "," or "),t=u.split(" "),n;if(this._predicate="and",t.length!=0)if($.isFunction(ej.Predicate[t[1]])){this._skipFilterProcess=!1;this._predicate=t[1];var i=u.split(" "+t[1]+" "),f=[],r=[];for(n=0;n<i.length;n++)this._validateFilterValue(i[n]),f.push(this._operator),this._currentFilterColumn.type=="number"?r.push(this._currentFilterbarValue):this._currentFilterColumn.type=="string"&&r.push(i[n]);this._currentFilterbarValue=r;this._operator=f}else this._validateFilterValue($.trim(this._currentFilterbarValue));else this._validateFilterValue($.trim(this._currentFilterbarValue))},_validateFilterValue:function(n){var r,t,i,u;switch(this._currentFilterColumn.type){case"number":for(this._operator=ej.FilterOperators.equal,r=[">","<","=","!"],t=0;t<n.length;t++)if(jQuery.inArray(n[t],r)!=-1)break;t!=n.length&&(this._getOperator(n.substring(t)),t!=0&&(this._currentFilterbarValue=n.substring(0,t)));this._currentFilterbarValue=this._currentFilterbarValue!=""&&n.length>=1?ej.parseFloat(this._currentFilterbarValue,this.model.locale):n.length>1?ej.parseFloat(n,this.model.locale):n;break;case"date":case"datetime":this._operator=ej.FilterOperators.equal;this._getOperator(n);i=ej.isNullOrUndefined(this._currentFilterColumn.format)?this._currentFilterColumn.type=="date"?ej.preferredCulture().calendar.patterns.d:ej.preferredCulture().calendar.patterns.f:this._currentFilterColumn.format.replace("{0:","").replace("}","");this._currentFilterbarValue!=""&&(u=ej.parseDate(this._currentFilterbarValue,i,this.model.locale),ej.isNullOrUndefined(u)?this.filterStatusMsg="Invalid Filter Data":this._currentFilterbarValue=ej.parseDate(this._currentFilterbarValue,i,this.model.locale));break;case"string":n.charAt(0)=="*"?(this._currentFilterbarValue=this._currentFilterbarValue.slice(1),this._operator=ej.FilterOperators.startsWith):n.charAt(n.length-1)=="%"?(this._currentFilterbarValue=this._currentFilterbarValue.slice(0,-1),this._operator=ej.FilterOperators.startsWith):n.charAt(0)=="%"?(this._currentFilterbarValue=this._currentFilterbarValue.slice(1),this._operator=ej.FilterOperators.endsWith):this._operator=ej.FilterOperators.startsWith;break;case"boolean":case"checkbox":this._currentFilterbarValue.toLowerCase()=="true"||this._currentFilterbarValue=="1"?this._currentFilterbarValue=!0:(this._currentFilterbarValue.toLowerCase()=="false"||this._currentFilterbarValue=="0")&&(this._currentFilterbarValue=!1);this._operator=ej.FilterOperators.equal;break;default:this._operator=ej.FilterOperators.equal}},_getOperator:function(n){n.charAt(0)=="="&&(this._operator=ej.FilterOperators.equal,this._currentFilterbarValue=n.substring(1));(ej.data.operatorSymbols[n.charAt(0)]!==undefined||ej.data.operatorSymbols[n.slice(0,2)]!==undefined)&&(this._operator=ej.data.operatorSymbols[n.charAt(0)],this._currentFilterbarValue=n.substring(1),this._operator===undefined&&(this._operator=ej.data.operatorSymbols[n.slice(0,2)],this._currentFilterbarValue=n.substring(2)));(this._operator==ej.FilterOperators.lessThan||this._operator==ej.FilterOperators.greaterThan)&&this._currentFilterbarValue.charAt(0)=="="&&(this._operator=this._operator+"orequal",this._currentFilterbarValue=this._currentFilterbarValue.substring(1))},_checkForSkipInput:function(){var t=!1,r=this,i,n;if(this._currentFilterColumn.type=="number"&&(ej.data.operatorSymbols[this._currentFilterbarValue]!==undefined||$.inArray(this._currentFilterbarValue,["="," ","!"])!=-1)&&(t=!0),this._currentFilterColumn.type=="string")for(i=[">","<","=","!"],n=0;n<this._currentFilterbarValue.length;n++)$.inArray(this._currentFilterbarValue[n],i)!=-1&&(t=!0);return t},_showFilterMsg:function(){var n=$.inArray(this._currentFilterColumn,this.filterColumnCollection),t,u,i,f,r;if(this._currentFilterbarValue!==""&&n==-1&&this.filterColumnCollection.push(this._currentFilterColumn),this._currentFilterbarValue===""&&n!=-1&&this.filterColumnCollection.splice(n,1),(!this._skipFilterProcess||this.filterColumnCollection.length>0)&&this.filterStatusMsg!="Invalid Filter Data")for(n=0;n<this.filterColumnCollection.length;n++)ej.isNullOrUndefined(this.filterColumnCollection[n])||(i=this.filterColumnCollection[n].headerText,this.filterColumnCollection[n].disableHtmlEncode&&(i=this._htmlEscape(i)),this.filterColumnCollection[n].field.indexOf(".")!=-1?(f=this.filterColumnCollection[n].field.split("."),u=f.join("\\."),t=$("#"+u+"_filterBarcell").val()):(r=ej.isNullOrUndefined(this.filterColumnCollection[n].foreignKeyValue)?this.filterColumnCollection[n].field+"_filterBarcell":this.filterColumnCollection[n].field+"_"+this.filterColumnCollection[n].foreignKeyValue+"_filterBarcell",t=this._currentFilterColumn.type=="boolean"&&!ej.isNullOrUndefined(this._currentFilterColumn.filterBarTemplate)&&this.element.find("#"+r).hasClass("e-checkbox e-js")?this.element.find("#"+r).parent().attr("aria-checked"):this.element.find("#"+r).val()),t!=""&&(n>0&&this.filterStatusMsg!=""&&(this.filterStatusMsg+=" && "),this.filterStatusMsg+=i+": "+t));this.model.allowPaging?this.getPager().ejPager("model.externalMessage",this.filterStatusMsg):(this.model.scrollSettings.allowVirtualScrolling?this.$pagerStatusBarDiv.find(".e-pagerfiltermsg").html(this.filterStatusMsg).css("display","block"):this.$pagerStatusBarDiv.find("div").html(this.filterStatusMsg),this.filterStatusMsg.length?this.$pagerStatusBarDiv.css("display","block"):this.model.scrollSettings.allowVirtualScrolling?this.$pagerStatusBarDiv.find(".e-pagerfiltermsg").hide():this.$pagerStatusBarDiv.hide());this.filterStatusMsg=="Invalid Filter Data"&&(n=$.inArray(this._currentFilterColumn,this.filterColumnCollection),this.filterColumnCollection.splice(n,1));this.filterStatusMsg=""},_renderFilterDialogs:function(){var n,t,i,r,u,f;$.each(this.model.columns,ej.proxy(function(e,o){o.type!="string"||n&&ej.isNullOrUndefined(o.filterType)?o.type!="guid"||f&&ej.isNullOrUndefined(o.filterType)?o.type!="number"||t&&ej.isNullOrUndefined(o.filterType)?o.type!="date"||r&&ej.isNullOrUndefined(o.filterType)?o.type!="datetime"||u&&ej.isNullOrUndefined(o.filterType)?o.type!="boolean"||i&&ej.isNullOrUndefined(o.filterType)||(ej.isNullOrUndefined(o.filterType)&&(i=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(u=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(r=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(t=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(f=!0),this._renderFilters(o)):(ej.isNullOrUndefined(o.filterType)&&(n=!0),this._renderFilters(o))},this))},_renderFilters:function(col){this._isExcelFilter&&col.filterType!="menu"||col.filterType=="excel"?(ej.isNullOrUndefined(this._excelFilter)&&(this._renderExcelFilter(),this._excelFilterRendered=!0),this._excelFilter.renderDialog(col.type)):eval(this["_render"+col.type.substring(0,1).toUpperCase()+col.type.substring(1)+"Dialog"](col))},_renderStringDialog:function(){var n=this._id+"_stringDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"string"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(n))},_renderBooleanDialog:function(){var n=this._id+"_booleanDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"boolean"),this.model.isResponsive&&this._mediaStatus||(this._renderFDialog(n),this.model.filterSettings.showPredicate?$("#"+n).ejDialog({minHeight:136,width:"100%"}):$("#"+n).ejDialog({minHeight:90,width:"100%"})))},_renderGuidDialog:function(){var n=this._id+"_guidDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"guid"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(n))},_renderNumberDialog:function(){var n=this._id+"_numberDlg",t;$("#"+n).length>0||(t=ej.buildTag("div#"+n+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"number"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(n))},_renderDateDialog:function(n){var t=this._id+"_dateDlg",i;$("#"+t).length>0||(i=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),i.appendTo("body"),this._renderDlgContent(i,"date",n),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderDatetimeDialog:function(n){var t=this._id+"_datetimeDlg",i;$("#"+t).length>0||(i=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),i.appendTo("body"),this._renderDlgContent(i,"datetime",n),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderFDialog:function(n){$("#"+n).ejDialog({showOnInit:!1,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showHeader:!1,width:260,enableResize:!1,allowKeyboardNavigation:!1,content:"#"+this._id})},_closeFDialog:function(){(this._isExcelFilter||this._excelFilterRendered)&&this._excelFilter.closeXFDialog();this._$menuDlgIsOpen&&this._closeFilterDlg()},_renderDlgContent:function(n,t,i){n.addClass("e-grid");var f=ej.buildTag("div.e-predicate"),o=ej.buildTag("div.e-operator"),u=ej.buildTag("div.e-value"),b=this.localizedLabels.StringMenuOptions,s=this.localizedLabels.NumberMenuOptions,c=ej.buildTag("input#"+this._id+t+"_ddinput",{},{},{type:"text"}),l=ej.buildTag("div#"+this._id+t+"_dropdown"),h=ej.buildTag("ul"),a=ej.buildTag("input",{},{},{type:"radio",name:this._id+"_predicate"+t,value:"or"}),v=ej.buildTag("input",{},{},{type:"radio",name:this._id+"_predicate"+t,value:"and",checked:"checked"}),e;f.append(v).append(ej.buildTag("span.e-caption").html(this.localizedLabels.PredicateAnd)).append(a).append(ej.buildTag("span.e-caption").html(this.localizedLabels.PredicateOr));this.model.filterSettings.showPredicate||f.hide();t=="string"&&(e=ej.buildTag("input",{},{},{type:"checkbox"}),f.append(e).append(ej.buildTag("span.e-caption").html(this.localizedLabels.MatchCase)),$.each(b,function(n,t){h.append(ej.buildTag("li",{},{},{value:t.value}).html(t.text))}));(t=="number"||t=="date"||t=="datetime"||t=="guid")&&(t=="guid"&&(s=s.slice(4,6)),$.each(s,function(n,t){h.append(ej.buildTag("li",{},{},{value:t.value}).html(t.text))}));t!="boolean"&&(l.append(h),o.append(c),o.append(l));var r=ej.buildTag("input",{},{},{type:"text"}),y=ej.buildTag("input",{},{},{type:"checkbox"}),k=this.model.enableResponsiveRow?"OkButton":"Filter",d=this.model.enableResponsiveRow?"CancelButton":"Clear",p=ej.buildTag("input.e-filter e-flat e-btnsub",{},{},{type:"button",value:this.localizedLabels[k]}),w=ej.buildTag("input.e-clear e-flat e-btncan",{},{},{type:"button",value:this.localizedLabels[d]});u.append(ej.buildTag("span.e-caption").html(this.localizedLabels.FilterMenuCaption));n.append(f);t=="boolean"?(u.find("span.e-caption").css("top","1px"),u.append(y)):(u.append(ej.buildTag("br")).append(r),n.append(o));n.append(u);n.append(ej.buildTag("div.e-dlgBtns").append(p).append(w));t!="boolean"&&c.ejDropDownList({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,targetID:this._id+t+"_dropdown",width:"100%",height:"26px",selectedItemIndex:0});a.ejRadioButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL});v.ejRadioButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,checked:!0});e&&e.ejCheckBox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL});n.css("display","none");this._createButton("filter",p);this._createButton("clear",w);t=="number"?r.ejNumericTextbox({cssClass:this.model.cssClass,locale:this.model.locale,enableRTL:this.model.enableRTL,value:0,showSpinButton:!1,height:"26px",decimalPlaces:2,width:"100%"}):t=="guid"?r.css({height:"26px",width:"100%"}):t=="date"?(r.attr("id",this._id+"_dpDate"),r.ejDatePicker({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableStrictMode:!0,width:"100%",watermarkText:this.localizedLabels.DatePickerWaterMark,locale:this.model.locale}),ej.isNullOrUndefined(i.format)||r.ejDatePicker({dateFormat:i.format.replace(/{0:|}/g,function(){return""})})):t=="datetime"?(r.attr("id",this._id+"_dpDateTime"),r.ejDateTimePicker({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableStrictMode:!0,width:"100%",locale:this.model.locale}),ej.isNullOrUndefined(i.format)||r.ejDateTimePicker({dateTimeFormat:i.format.replace(/{0:|}/g,function(){return""})})):t=="boolean"?y.ejCheckBox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL}):t=="string"&&(r.attr("id",this._id+"_acString"),r.ejAutocomplete({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,dataSource:this._dataSource(),width:"100%",height:26,enableDistinct:!0,focusIn:function(){var n=this.element.closest(".e-dialog").find(".e-dropdownlist"),t=this.element.closest(".e-dialog").find(".e-checkbox").prop("checked");this.model.filterType=n.ejDropDownList("model.value");this.model.caseSensitiveSearch=t},open:function(){var n=!this.element.closest(".e-dialog").ejDialog("isOpened");this.suggestionList.css({visibility:n?"hidden":"visible"})}}))},_createButton:function(n,t){var i=n=="filter"?ej.proxy(this._fltrBtnHandler,this):ej.proxy(this._fltrClrHandler,this);t.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,click:i})},_getIdField:function(){var n;return $.each(this.model.columns,function(t,i){if(i.key)return n=i.field,!1}),n},_filterCompleteAction:function(){var i,t;if(this.model.allowPaging&&this._refreshGridPager(),this.model.scrollSettings.allowVirtualScrolling&&(i=this._refreshVirtualPagerInfo(),this._showPagerInformation(i)),this.model.filterSettings.filterType=="menu"||this._isExcelFilter){this._closeFDialog();var u=this.getColumnByField(this._$curFieldName),f=$.inArray(u,this.model.columns),r=this,n=!1;$.each(this.model.filterSettings.filteredColumns,function(t,i){return i.field==r._$curFieldName?(n=!0,!1):i.isComplex==!0&&i.predicates[0].field==r._$curFieldName?(n=!0,!1):void 0});t=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell").eq(f).find(".e-filtericon");n?t.addClass("e-filteredicon e-filternone"):t.removeClass("e-filteredicon e-filternone")}},_refreshFilterIcon:function(){var r,n,u,t,i,f;if(this.model.filterSettings.filteredColumns.length)for(r=ej.distinct(this.model.filterSettings.filteredColumns,"field",!0),n=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell"),this.model.showStackedHeader&&(n=n.not(".e-stackedHeaderCell")),this.model.allowReordering&&n.find(".e-filtericon").removeClass("e-filteredicon e-filternone"),i=0,f=r.length;i<f;i++)t=r[i],u=this.getColumnIndexByField(t.isComplex===!0?t.predicates[0].field:t.field),n.eq(u).find(".e-filtericon").addClass("e-filteredicon e-filternone")},_setFilterFieldValues:function(n){var i="",t=this,r=-1,u;$.each(this.model.filterSettings.filteredColumns,function(n,i){i.field==t._$curFieldName&&(r=n)});r==-1&&this._$colType!="boolean"&&(this._$colType=="string"&&$(".e-predicate input.e-js[type='checkbox']").ejCheckBox({checked:!1}),$(".e-predicate input[name ="+this._id+"_predicate"+this._$colType+"]:first").ejRadioButton({checked:!0}),$("#"+this._id+this._$colType+"_ddinput").ejDropDownList({selectedItemIndex:0,change:function(){this.element.closest(".e-dialog").find(".e-autocomplete").val(i)}}));u=$(this.model.filterSettings.filteredColumns).map(function(){return this.field}).get();(this._$curFieldName!=this._$prevFieldName||$.inArray(this._$curFieldName,u)!=-1)&&($.each(this.model.filterSettings.filteredColumns,function(n,r){if(r.field==t._$curFieldName){for(var e=t._$colType=="number"||t._$colType=="date"||t._$colType=="datetime"?"Number":"String",f=t.localizedLabels[e+"MenuOptions"],o=ej.isNullOrUndefined(r.actualOperator)?r.operator:r.actualOperator,u=0;u<f.length;u++)if(f[u].value.toLowerCase()==o)break;return t._$colType=="string"&&$(".e-predicate input.e-js[type='checkbox']").ejCheckBox({checked:r.matchcase}),$("input[value="+r.predicate+"]").ejRadioButton({checked:!0}),$("#"+t._id+t._$colType+"_ddinput").ejDropDownList({selectedItemIndex:u}),i=r.actualFilterValue!=null?r.actualFilterValue:r.value,!1}}),this._$colType=="boolean"?i&&i!=""?$(n).find(".e-value input:checkbox.e-js").ejCheckBox({checked:!0}):$(n).find(".e-value input:checkbox.e-js").ejCheckBox({checked:!1}):this._$colType=="date"||this._$colType=="datetime"?$(n).find(".e-value .e-datepicker")[this._$colType=="date"?"ejDatePicker":"ejDateTimePicker"]("model.value",i):this._$colType=="number"?$(n).find(".e-value .e-numerictextbox").ejNumericTextbox("model.value",i):$(n).find(".e-value input").val(i))},_fltrBtnHandler:function(){var f;this.model.isResponsive&&this._mediaStatus&&this._responsiveFilterClose();var o=this._id+"_"+this._$colType+"Dlg",i=$("#"+o),n=i.find(".e-value input"),u,e,t=n.val(),r=undefined;this._$colType=="number"&&(n=n.filter(".e-numerictextbox"),t=parseFloat(n.ejNumericTextbox("getValue")),r=!0);this._$colType=="string"&&(r=i.find(".e-predicate input[type='checkbox']").is(":checked"));(this._$colType=="date"||this._$colType=="datetime")&&(t=ej.parseDate(t,this._$colFormat,this.model.locale),r=!0);this._$colType=="boolean"?(t=n.ejCheckBox("model.checked")!=null?n.ejCheckBox("model.checked"):!1,u="equal"):u=$("#"+this._id+this._$colType+"_ddinput").ejDropDownList("getSelectedValue").toLowerCase();e=i.find(".e-predicate input[type='radio']:checked");this._$colForeignKeyValue&&this._$colDropdownData?this._fltrForeignKeyValue(u,t,r,this._$colDropdownData,this._$colForeignKeyField,this._$colForeignKeyValue,this._$colType,e):this.filterColumn(this._$curFieldName,u,t,i.find(".e-predicate input[type='radio']:checked").attr("value"),r);this.model.isResponsive&&(i.css("display","none"),this._setResponsiveFilterIcon(),this.element.css("display","block"),!this.model.allowScrolling||this.model.enableResponsiveRow&&this.model.minWidth||(f={},f.requestType="refresh",this._refreshScroller(f)))},_fltrClrHandler:function(){this.clearFiltering(this._$curFieldName)},_fltrForeignKeyValue:function(n,t,r,u,f,e,o,s){var y,p;ej.isNullOrUndefined(r)&&(r=!0);var b=[],v,l,g=s?s.css("display")=="none":!0,k=s?s.attr("value"):"and",a,w=u,c,h={mapFieldName:e,fieldName:f,operator:n,value:t,predicate:s,matchcase:r},d={requestType:ej.Grid.Actions.Filtering,action:"fetchingForeignKeyField",currentFilteringColumn:f,currentFilterObject:h};this._trigger("actionBegin",d);u instanceof ej.DataManager||(w=new ej.DataManager(u));o=="date"?(y=new Date(t.setDate(t.getDate()-1)),p=new Date(t.setDate(t.getDate()+2)),v=n=="equal"||n=="notequal"?n=="equal"?(new ej.Query).where(ej.Predicate(h.mapFieldName,">",y,!h.matchcase).and(h.mapFieldName,"<",p,!h.matchcase)).select(h.fieldName):(new ej.Query).where(ej.Predicate(h.mapFieldName,"<=",y,!h.matchcase).or(h.mapFieldName,">=",p,!h.matchcase)).select(h.fieldName):(new ej.Query).where(h.mapFieldName,h.operator,h.value,!h.matchcase).select(h.fieldName)):v=(new ej.Query).where(h.mapFieldName,h.operator,h.value,!h.matchcase).select(h.fieldName);l={actualFilterValue:h.value,actualOperator:h.operator,ejpredicate:undefined,predicate:k};w.executeQuery(v).done(ej.proxy(function(n){for(c=n.result,requireProc=$.isPlainObject(c[0]),preds=[],merge=!1,c=requireProc?ej.distinct(c,f,!1):c,field=this._$curFieldName,a=new ej.Predicate(field,"equal",c[0],r),i=1,vlen=c.length;i<vlen;i++)preds.push(new ej.Predicate(field,"equal",c[i],r)),merge=!0;merge&&(preds.unshift(a),a=ej.Predicate.or(preds));$.extend(l,{ejpredicate:$.extend(a,{field:field},l)});this.filterColumn(h.fieldName,h.operator,h.value,b,h.matchcase,l)},this))},_setDateFilters:function(n,t){var u,f,e,r,i;if(t||ej.isNullOrUndefined(this.getColumnByField(n.field).format)?(u=new Date(n.value.setSeconds(n.value.getSeconds()-1)),f=new Date(n.value.setSeconds(n.value.getSeconds()+2))):(e=this.getColumnByField(n.field).format,e.indexOf("s")!=-1?(u=new Date(n.value.setSeconds(n.value.getSeconds()-1)),f=new Date(n.value.setSeconds(n.value.getSeconds()+2))):e.indexOf("m")!=-1?(u=new Date(n.value.setMinutes(n.value.getMinutes()-1)),f=new Date(n.value.setMinutes(n.value.getMinutes()+2))):e.indexOf("h")!=-1?(u=new Date(n.value.setHours(n.value.getHours()-1)),f=new Date(n.value.setHours(n.value.getHours()+2))):(u=new Date(n.value.setSeconds(n.value.getSeconds()-1)),f=new Date(n.value.setDate(n.value.getDate()+1)))),r=$.extend({},n),i=$.extend({},n),r.value=u,i.value=f,n.operator=="equal"?(r.operator="greaterthan",r.predicate="and",i.operator="lessthan",i.predicate="and"):(r.operator="lessthanorequal",r.predicate="or",i.operator="greaterthanorequal",i.predicate="or"),pred=ej.Predicate(r.field,r.operator,r.value,!1),predicate=pred[i.predicate](ej.Predicate(i.field,i.operator,i.value,!1)),n.value=new Date(n.value.setSeconds(i.value.getSeconds()-1)),t)return predicate;this.model.filterSettings.filteredColumns.push($.extend(predicate,{field:n.field,operator:n.operator,value:n.value}))}}}(jQuery,Syncfusion),function(n,t,i){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.group={_renderGroupDropArea:function(){var i,n;return t.isNullOrUndefined(this.model.groupSettings.enableDropAreaAnimation)||(this.model.groupSettings.enableDropAreaAutoSizing=this.model.groupSettings.enableDropAreaAnimation),i=this.model.groupSettings.enableDropAreaAutoSizing?"":this.localizedLabels.GroupDropArea,this.model.groupSettings.showDropArea?(n=t.buildTag("div.e-groupdroparea",i),n.addClass("e-default"),this.model.groupSettings.enableDropAreaAutoSizing&&n.append(t.buildTag("div.e-animatebutton e-icon").addClass(this.model.groupSettings.enableDropAreaAutoSizing?"e-animatebuttondown e-gdownarrow":"e-animatebuttonup e-guparrow")),n):void 0},_getColGroup:function(t){var r=this.getRsc("helpers",t),f,e,u;return f=r.model.groupSettings.groupedColumns.length==1?this.data.items.level===i?0:this.data.items.level-1:this.data.items.level===i?r.model.groupSettings.groupedColumns.length:this.data.items.level-1,e=n(document.createElement("div")),r._isCaptionSummary?u=r._getCaptionColGroup(f):(u=r._getMetaColGroup(),f!=r.model.groupSettings.groupedColumns.length&&r.model.groupSettings.groupedColumns.length>1&&u.prepend(r._getIndentCol())),e.html(u),e.html()},_colSpanAdjust:function(r,u,f){var e,s,c,l,a,o,w,h,b;if(t.isNullOrUndefined(r)?(e=this,s=f):(e=this.getRsc("helpers",r),s=this),e.model.groupSettings.groupedColumns.length==1?(c=s.data.items.level===i?1:s.data.items.level-1,u=="groupcaption"&&(e._currentJsonData=e._currentJsonData.concat(s.data.items))):(c=s.data.items.level===i?e.model.groupSettings.groupedColumns.length:s.data.items.level-1,u=="groupcaption"&&s.data.items.level===i&&(e._currentJsonData=e._currentJsonData.concat(s.data.items))),e._isGrouping=!0,l=e.model.groupSettings.showGroupedColumn?0:e.model.groupSettings.groupedColumns.length,a=0,n.each(e._hiddenColumnsField,function(t,i){var r=n.inArray(i,e.model.groupSettings.groupedColumns);r!=-1&&(a=a+1,e.model.groupSettings.showGroupedColumn&&(l=l+1))}),o=e.model.columns.length+e.model.groupSettings.groupedColumns.length-c-e._hiddenColumnsField.length-l+a,o=e.model.detailsTemplate!=null||e.model.childGrid!=null?o+1:o,e._isCaptionSummary&&u=="groupcaption"){var v=[],k=0,d=e._captionSummary(),y=0,p=[];for(n.each(d[0].summaryColumns,function(t,i){n.inArray(i.displayColumn,e._hiddenColumnsField)!=-1&&k++;p.push(e.getColumnIndexByField(i.displayColumn));v.push(e.getColumnIndexByField(i.displayColumn)+e.model.groupSettings.groupedColumns.length-c)}),w=t.min(p),h=0;h<e._hiddenColumnsField.length;h++)b=t.isNullOrUndefined(e.getColumnByField(e._hiddenColumnsField[h]))?e.getColumnIndexByHeaderText(e._hiddenColumnsField[h],t.isNullOrUndefined(e.getColumnByField(e._hiddenColumnsField[h]))):e.getColumnIndexByField(e._hiddenColumnsField[h]),w>b&&y++;v.length>0&&(o=t.min(v));o=o-y;o=e.model.detailsTemplate!=null||e.model.childGrid!=null?o+1:o}return o},_captionEncode:function(n){var t=this.getRsc("helpers",n),i=t.getColumnByField(this.data.field);return i.disableHtmlEncode},_captionFormat:function(i){var u=this.getRsc("helpers",i),e,r=n.extend({},this.data),f=u.getColumnByField(r.field);return e=f.foreignKeyValue&&f.dataSource?u._foreignKeyBinding(u.getColumnIndexByField(r.field),r.key,u._id):r.key,t.isNullOrUndefined(f.format)||f.format.indexOf("{0:")!=-1||(r[r.field]=r.key,u.data=r),r.key=f.format?u.formatting(f.format,e,u.model.locale):e,r.headerText=f.headerText,n.render[u._id+"_CaptionTemplate"](r)},_getCaptionColGroup:function(n){var t=this.getHeaderTable().find("colgroup").clone(),u=t.find("col"),i=u.length-this.model.columns.length,r;if((this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(i=i-1),t.find("col:lt("+i+")").remove(),n>0&&n!=this.model.groupSettings.groupedColumns.length)if(this.model.groupSettings.groupedColumns.length>2&&n!=this.model.groupSettings.groupedColumns.length-1)for(r=0;r<this.model.groupSettings.groupedColumns.length-n;r++)t.prepend(this._getIndentCol());else t.prepend(this._getIndentCol());return t},_groupSummaryRow:function(i,r,u,f){var e=this.getRsc("helpers",u),f=!t.isNullOrUndefined(f),s,a,v,o,h,c;if(e.model.showSummary){if(e.getFooterTable()==null&&e._renderGridFooter(),e._createSummaryRows(e.getFooterTable(),i.records==null?i:i.records,r,i,f),e._isCaptionSummary&&!f&&(s=[],a=e._captionSummary(),n.each(a[0].summaryColumns,function(n,t){s.push(e.getColumnIndexByField(t.displayColumn))}),s.length>0&&(colIndex=t.min(s)),v=e.model.columns.length,e.getFooterTable().find("tbody td").slice(-(v-colIndex)).removeClass("e-summaryrow").addClass("e-groupcaptionsummary")),!e.model.groupSettings.showGroupedColumn){var y=e.model.groupSettings.groupedColumns,l=0,p=e.getFooterTable().children("tbody").find("tr");for(o=0;o<e.model.summaryRows.length;o++){for(h=0;h<e.model.summaryRows[o].summaryColumns.length;h++)for(c=0;c<y.length;c++)y[c]==e.model.summaryRows[o].summaryColumns[h].displayColumn&&(l++,e.model.summaryRows[o].summaryColumns.length==l&&n(p[o]).addClass("e-hide"));l=0}}return f?e.getFooterTable().find("tbody").html():e.getFooterTable().find("tbody").find("tr").html()}},addGroupingTemplate:function(){var l=document.createElement("tbody"),i=this,r={},f,u,o,e;r["_"+i._id+"ColSpanAdjust"]=this._colSpanAdjust;r["_"+i._id+"Colgroup"]=this._getColGroup;t.isNullOrUndefined(this.model.groupSettings.captionFormat)?n.templates(i._id+"_CaptionTemplate",this.localizedLabels.GroupCaptionFormat):n.templates(i._id+"_CaptionTemplate",this.model.groupSettings.captionFormat);r["_"+i._id+"CaptionFormat"]=this._captionFormat;r["_"+i._id+"GroupSummaryRow"]=this._groupSummaryRow;r["_"+i._id+"CaptionEncode"]=this._captionEncode;r[i._id+"Object"]=this;n.views.helpers(r);f=" ~_"+i._id+"CaptionFormat('"+i._id+"Object')";u="<td class='e-recordplusexpand' ej-mappingname='{{:field}}' ej-mappingvalue='{{:key}}'><div class='e-icon e-gdiagonalnext'><\/div><\/td><td class='e-groupcaption' colspan='{{:~_"+i._id+"ColSpanAdjust('"+i._id+"Object','groupcaption') }}'>{{if ~_"+i._id+"CaptionEncode('"+i._id+"Object')}}{{html:"+f+"}}{{else}}{{:"+f+"}}{{/if}}<\/td>";this._isCaptionSummary&&this.model.showSummary&&(u=u+"{{:~_"+i._id+"GroupSummaryRow(items, aggregates,'"+i._id+"Object')}}");o="<tr class='e-groupcaptionrow'>"+u+"<\/tr>";e=t.buildTag("tbody");e.html("{{if items.GROUPGUID}}{{for items tmpl='"+i._id+"_GroupingTemplate'/}}{{else}}{{for items tmpl='"+i._id+"_JSONTemplate'/}}{{/if}}");var s="<table class='e-table {{if items.GROUPGUID}}{{else}}e-recordtable{{/if}}' cellspacing='0.25px' >{{:~_"+i._id+"Colgroup('"+i._id+"Object')}}"+e.html()+"{{:~_"+i._id+"GroupSummaryRow(items, aggregates,'"+i._id+"Object', '"+i._id+"showGroupCaption')}}<\/table>",h="<td class='e-tabletd' colspan='{{:~_"+i._id+"ColSpanAdjust('"+i._id+"Object','table')}}'>"+s+"<\/td>",c="<tr><td class='e-indentcell'><\/td>"+h+"<\/tr>";n.templates(i._id+"_GroupingTemplate",o+c)},addSummaryTemplate:function(){var i=this;n.each(i.model.summaryRows,function(r,u){n.each(u.summaryColumns,function(r,u){t.isNullOrUndefined(u.template)||n.templates(i._id+"_summaryTemplate"+u.template,u.template)})})},_getGroupTopLeftCell:function(){var n=t.buildTag("th.e-grouptopleftcell");return n.append(t.buildTag("div.e-headercelldiv e-emptyCell"," ")),n},_getEmptyFilterBarCell:function(){return t.buildTag("th.e-filterbarcell e-grouptopleftcell")},_groupingAction:function(n){var i=this.getHeaderTable().find("thead").find(".e-columnheader:not(.e-stackedHeaderRow)").find(".e-grouptopleftcell"),u=this.getHeaderTable().find("colgroup").find("col"),r=i.length,t;for(r&&(this.getHeaderTable().find("colgroup").replaceWith(this._getMetaColGroup()),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&this.getHeaderTable().find("colgroup").prepend(this._getIndentCol()),i.remove(),this.getHeaderTable().find("thead").find(".e-filterbar").find(".e-filterbarcell:lt("+r+")").remove()),(!this.model.allowResizeToFit||n)&&this.setWidthToColumns(),t=0;t<this.model.groupSettings.groupedColumns.length;t++)this.getHeaderTable().find("colgroup").prepend(this._getIndentCol()),this.getHeaderTable().find("thead").find(".e-columnheader").prepend(this._getGroupTopLeftCell()),this.getHeaderTable().find("thead").find(".e-filterbar").prepend(this._getEmptyFilterBarCell());this.getHeaderTable().find(".e-columnheader").find("th.e-grouptopleftcell").last().addClass("e-lastgrouptopleftcell")},groupColumn:function(i){var r,u,f;if((this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&this._closeFDialog(),this.model.allowGrouping&&n.inArray(i,this._disabledGroupableColumns)==-1)&&!t.isNullOrUndefined(this.getColumnByField(i))&&n.inArray(i,this.model.groupSettings.groupedColumns)==-1){for(this.model.groupSettings.groupedColumns.push(i),r=0;r<this.model.sortSettings.sortedColumns.length;r++)if(this.model.sortSettings.sortedColumns[r].field==i)break;this.model.sortSettings.sortedColumns.length==r&&this.model.sortSettings.sortedColumns.push({field:i,direction:t.sortOrder.Ascending});u={};u.columnName=i;u.requestType=t.Grid.Actions.Grouping;f=this._processBindings(u);f&&(n.inArray(i,this._scolumns)!=-1||this._gridSort==i||this.model.sortSettings.sortedColumns.pop(),this.model.groupSettings.groupedColumns.pop());this._primaryKeyValues=[]}},ungroupColumn:function(i){var f,e,u,r,o,s;if(this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&this._closeFDialog(),this.model.allowGrouping){if(n.inArray(i,this.model.groupSettings.groupedColumns)!=-1)this.model.groupSettings.groupedColumns.splice(n.inArray(i,this.model.groupSettings.groupedColumns),1);else return null;for(this.model.groupSettings.groupedColumns.length==0&&(this._LastColumnUnGroup=!0),f=this.getColumnByField(i),this.model.groupSettings.showGroupedColumn||f.visible||(e=this._hiddenColumnsField.indexOf(i),this._hiddenColumnsField.splice(e,1),f.visible=!0),u={},r=0;r<this.model.sortSettings.sortedColumns.length;r++)if(this.model.sortSettings.sortedColumns[r].field==i){if(this._scolumns.indexOf(i)!=-1&&this.model.allowSorting&&this.model.allowMultiSorting||this._gridSort==i)if(this.model.allowSorting&&this.model.allowMultiSorting){o=n.inArray(i,this._scolumns);this._scolumns.splice(o,1);break}else{this._gridSort=null;break}else this.model.sortSettings.sortedColumns.splice(r,1);break}u.columnName=i;u.requestType=t.Grid.Actions.Ungrouping;this._isUngrouping=!0;s=this._processBindings(u);s&&this.model.groupSettings.groupedColumns.push(i);this._primaryKeyValues=[]}},collapseGroupDropArea:function(){var r=this.element.find(".e-groupdroparea").first(),i=this;this.model.groupSettings.groupedColumns.length==0&&this.model.groupSettings.enableDropAreaAutoSizing&&r.animate({height:"10px"},200,function(){i.model!=null&&i.model.groupSettings.groupedColumns.length==0&&(n(this).html("").append(t.buildTag("div.e-animatebutton e-animatebuttondown e-icon e-gdownarrow")),n(this).dequeue().css("height","auto"))})},expandGroupDropArea:function(){var n=this.element.find(".e-groupdroparea").first(),i=this;this.model.groupSettings.groupedColumns.length==0&&i.model.groupSettings.enableDropAreaAutoSizing&&n.animate({height:"30px"},150,function(){i.model.groupSettings.groupedColumns.length==0&&n.html(i.localizedLabels.GroupDropArea).append(t.buildTag("div.e-animatebutton e-animatebuttonup e-icon e-guparrow"));n.dequeue().css("height","30px")})},_enableGroupingEvents:function(){this.model.allowGrouping&&this._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",".e-groupdroparea",this._groupHeaderCellClick)},_recalculateIndentWidth:function(){var e=this,o=!t.isIOSWebView()&&this.getBrowserDetails(),i=this.getHeaderTable().find(".e-lastgrouptopleftcell").width(),r=i,s=i/30,f,u,h,c;s>=1&&(r=30/s);this.getHeaderTable().find("colgroup").find("col").slice(0,this.model.groupSettings.groupedColumns.length).css("width",r+"px");u=this.getContentTable().find("table").filter(":not(.e-recordtable)");i=this.getHeaderTable().find(".e-lastgrouptopleftcell").width();i>30||this._isCaptionSummary&&(i>=30||i>r)?(this._isCaptionSummary?(h=this.model.isEdit?u.parent(":not(.gridform)").children("colgroup"):u.children("colgroup"),n.each(h,function(t,i){var u=n(i).find("col").length-e.model.columns.length;(e.model.detailsTemplate!=null||e.model.childGrid!=null)&&u>0&&(u=u-1);n(i).find("col").slice(0,u).css("width",r+"px")})):this.model.isEdit?u.parent(":not(.gridform)").children("colgroup").find("col:first-child").css("width",i+"px"):u.children("colgroup").find("col:first-child").css("width",i+"px"),f=this.getContentTable().find("colgroup").first().find("col").slice(0,this.model.groupSettings.groupedColumns.length),o&&o.browser!="msie"?f.css("width",r+"px"):this._isCaptionSummary?f.css("width",r+"px"):f.first().css("width",i/this.element.width()*100+"%")):(this.getContentTable().find("colgroup").first().find("col").slice(0,this.model.groupSettings.groupedColumns.length).css("width",r+"px"),this.getContentTable().find("table").filter(":not(.e-recordtable)").children("colgroup").find("col:first-child").css("width",i+"px"));this.model.showSummary&&(c=this.getContentTable().find("table").filter(".e-groupsummary").find(".e-summary"),c.css("width",r+"px"))},getFieldNameByHeaderText:function(n){return t.isNullOrUndefined(this._fieldColumnNames[n])?null:this._fieldColumnNames[n]},getHeaderTextByFieldName:function(n){return t.isNullOrUndefined(this._headerColumnNames[n])?null:this._headerColumnNames[n]},expandAll:function(){var i=this.element.find(".e-recordpluscollapse"),r=this._excludeDetailRows().find(".e-detailrowcollapse"),t;if(i.length!=0)for(t=0;t<i.length;t++)this.expandCollapse(n(i[t]));if(r.length!=0)for(t=0;t<r.length;t++)this.expandCollapse(n(r[t]))},collapseAll:function(){var i=this.element.find(".e-recordplusexpand"),r=this.element.find(".e-detailrowexpand"),t;if(i.length!=0)for(t=0;t<i.length;t++)this.expandCollapse(n(i[t]));if(r.length!=0)for(t=0;t<r.length;t++)this.expandCollapse(n(r[t]))},_group:function(i){var u,o,f,e,s,r,h;if(this.model.groupSettings.groupedColumns.length&&this.model.currentViewData){if(this._currentJsonData=[],u=document.createElement("div"),!this.model.groupSettings.showGroupedColumn){if(this.initialRender||t.isNullOrUndefined(i.columnName)||i.requestType!="grouping")for(r=0;r<this.model.groupSettings.groupedColumns.length;r++)n.inArray(this.model.groupSettings.groupedColumns[r],this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(this.model.groupSettings.groupedColumns[r]),this._hiddenColumns.push(this.getColumnByField(this.model.groupSettings.groupedColumns[r]).headerText),this.getColumnByField(this.model.groupSettings.groupedColumns[r]).visible=!1);else o=this.getColumnByField(i.columnName),n.inArray(i.columnName,this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(i.columnName),this._hiddenColumns.push(this.getColumnByField(i.columnName).headerText),o.visible=!1);this._hideHeaderColumn(this.model.groupSettings.groupedColumns,!0);this.getContentTable().children("colgroup").replaceWith(this.getHeaderTable().find("colgroup").clone())}for(this._isReorder=i.requestType=="reorder"?!0:!1,f=this.getContentTable().children("colgroup").find("col"),e=f.length-this.model.columns.length,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&e--,f.length>this.model.columns.length&&this.getContentTable().children("colgroup").find("col:lt("+e+")").remove(),this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),s=this.model.detailsTemplate!=null||this.model.childGrid!=null?this.model.groupSettings.groupedColumns.length+1:this.model.groupSettings.groupedColumns.length,r=0;r<s;r++)this.getContentTable().children("colgroup").prepend(this._getIndentCol());this.model.currentViewData.length?(h=this.getContentTable().children("tbody"),h.empty(),u.innerHTML=["<table><tbody>",n.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/tbody><\/table>"].join(""),this.getContentTable().get(0).replaceChild(u.firstChild.firstChild,this.getContentTable().get(0).lastChild),this._hideCaptionSummaryColumn()):this.model.isEdit&&this.cancelEdit();this._groupingAction();this._gridRows=this.getContentTable().find(".e-recordtable").find("tbody").find("tr").not(".e-gridSummaryRows");this._eventBindings()}},_ungroup:function(){var i,r,u,n;if(this._isGrouping=!1,t.isNullOrUndefined(this.model.detailsTemplate)||(this._detailsOuterWidth=null),i=this.element.children(".e-gridheader"),r=i.find(".e-filterbar").find("th").find("input"),i.find("div").first().empty().append(this._renderGridHeader().find("table")),this.setGridHeaderContent(i),this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar")for(this._renderFiltering(),this._renderFilterBarTemplate(),u=this.element.children(".e-gridheader").find(".e-filterbar").find("th").find("input"),n=0;n<r.length;n++)u.eq(n).val(r.eq(n).val());this.model.groupSettings.showGroupedColumn||this._hideHeaderColumn(this.model.groupSettings.groupedColumns,!0);this.refreshTemplate();this.element.find(".e-gridcontent").children("div").first().empty().append(this._renderGridContent().find("table").first());this.setGridContent(this.element.find(".e-gridcontent"));this._gridRows=this.model.groupSettings.groupedColumns.length!=0?this.getContentTable().find(".e-recordtable").find("tbody").find("tr").toArray():this.getContentTable().get(0).rows;this.element.find(".e-groupdroparea").first().hasClass("e-allowDrop")&&this.element.find(".e-groupdroparea").first().removeClass("e-allowDrop")},_groupHeaderCellClick:function(t){var i=n(t.target),r;i.hasClass("e-groupdroparea")||(i.hasClass("e-ungroupbutton")?(r=i.parent().attr("ej-mappingname"),this.ungroupColumn(r)):i.hasClass("e-togglegroupbutton")?(r=i.parent().attr("ej-mappingname"),i.hasClass("e-toggleungroup")&&this.ungroupColumn(r)):i.hasClass("e-animatebutton")?n(t.target).hasClass("e-animatebuttondown")?this.expandGroupDropArea():this.collapseGroupDropArea():(i.addClass("e-headercelldiv"),this._mouseClickHandler(t),i.removeClass("e-headercelldiv")))},_captionSummary:function(i){for(var f=null,u=this.model.summaryRows,e=u.length,r=0;r<e;r++)if(u[r].showCaptionSummary==!0){f=n(u[r]);break}return i&&(left=u.slice(0,r),right=u.slice(r+1,e),t.merge(f=left,right)),f},_dropAreaHover:function(t){var i=n(t.target),r=this;return t.type=="mouseenter"?(this._dragActive?i.hasClass("e-groupdroparea")&&i.addClass("e-hover"):i.removeClass("e-hover"),i.hasClass("e-groupheadercell")&&this.model.groupSettings.showUngroupButton&&i.find(".e-ungroupbutton").show(150)):t.type=="mouseleave"&&(i.hasClass("e-groupdroparea")&&(i.find(".e-ungroupbutton").hide(150),i.removeClass("e-hover")),i.hasClass("e-groupheadercell")&&this.model.groupSettings.showUngroupButton&&i.find(".e-ungroupbutton").hide(150)),!1},_groupingCompleteAction:function(n){var r=this.element.children(".e-groupdroparea"),i;if((this.model.groupSettings.groupedColumns.length&&r.find(".e-grid-icon").length==0||t.Grid.Actions.Refresh==n.requestType)&&r.empty(),this.initialRender||t.Grid.Actions.Refresh==n.requestType){for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)this._addColumnToGroupDrop(this.model.groupSettings.groupedColumns[i]);this._refreshGridPager()}else this._addColumnToGroupDrop(n.columnName);for(this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),i=0;i<this.model.sortSettings.sortedColumns.length;i++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[i].field,this.model.sortSettings.sortedColumns[i].direction);!this.initialRender&&t.gridFeatures.dragAndDrop&&this._groupHeaderCelldrag();this.model.allowScrolling&&this.getContentTable().parent().scrollLeft(this.getHeaderTable().parent().scrollLeft()-1);this.element.children(".e-cloneproperties").remove();t.gridFeatures.filter&&["menu","excel"].indexOf(this.model.filterSettings.filterType)&&this._refreshFilterIcon()},_ungroupingCompleteAction:function(n){var r=this.element.children(".e-groupdroparea"),i;for(n.requestType!=t.Grid.Actions.Refresh&&this._removeColumnFromDrop(n.columnName),this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),i=0;i<this.model.sortSettings.sortedColumns.length;i++)this._addSortElementToColumn(this.model.sortSettings.sortedColumns[i].field,this.model.sortSettings.sortedColumns[i].direction);this.model.groupSettings.groupedColumns.length==0&&(r.html(this.model.groupSettings.enableDropAreaAutoSizing?"":this.localizedLabels.GroupDropArea),this.model.groupSettings.enableDropAreaAutoSizing&&r.append(t.buildTag("div.e-animatebutton e-icon").addClass(this.model.groupSettings.enableDropAreaAutoSizing?"e-animatebuttondown e-gdownarrow":"e-animatebuttonup e-guparrow")),r.css("height","auto"));t.gridFeatures.dragAndDrop&&this._headerCellgDragDrop();this.model.allowReordering&&t.gridFeatures.dragAndDrop&&this._headerCellreorderDragDrop();this.model.allowScrolling&&this.getContentTable().parent().scrollLeft(this.getHeaderTable().parent().scrollLeft()-1);this.element.children(".e-cloneproperties").remove();t.gridFeatures.filter&&["menu","excel"].indexOf(this.model.filterSettings.filterType)&&this._refreshFilterIcon()},_getToggleButton:function(){return t.buildTag("span.e-togglegroupbutton e-icon e-gridgroupbutton"," ")},_checkEinHeader:function(t){for(var u,r=this.element.children(".e-gridheader").find("thead").find(".e-columnheader").find(".e-headercell"),i=0;i<r.length;i++){if(n.trim(r.eq(i).find("div").attr("ej-mappingname"))==t)return r.eq(i);if(this.model.allowSorting&&this.model.allowMultiSorting&&(u=n(r.eq(i)).clone(),u.find(".e-number").remove(),n.trim(u.find("div").attr("ej-mappingname"))==t))return u}return null},_checkEinGroupDrop:function(t){for(var r=this.element.children(".e-groupdroparea").find(".e-grid-icon"),i=0;i<r.length;i++)if(n.trim(r.eq(i).find("div").attr("ej-mappingname"))==t)return r.eq(i);return null},_addColumnToGroupDrop:function(i){var r=t.buildTag("div.e-grid-icon e-groupheadercell"),h=this.element.find(".e-groupdroparea").first(),u=t.buildTag("div",{},{},{"ej-mappingname":i}),c="e-rarrowup-2x",f=this.getColumnByField(i),e,o;f.disableHtmlEncode?r.append(u.text(f.headerText)):f.headerTemplateID?r.append(u.html(n(f.headerTemplateID).html())):r.append(u.html(f.headerText));e=this._checkEinHeader(i);this.model.groupSettings.showToggleButton&&(u.append(this._getToggleButton().addClass("e-toggleungroup")),e.find(".e-headercelldiv").find(".e-togglegroupbutton").remove().end().append(this._getToggleButton().addClass("e-toggleungroup")));o="ascending";e.find(".e-ascending,.e-descending").length&&(o=e.find(".e-ascending,.e-descending").hasClass("e-ascending")?"ascending":"descending",c=o=="ascending"?"e-rarrowup-2x":"e-rarrowdown-2x");u.append(this._createSortElement().addClass("e-"+o+" "+c));this.model.groupSettings.showUngroupButton&&u.append(t.buildTag("span.e-ungroupbutton e-icon e-cancel"," ",{},{title:this.localizedLabels.UnGroup}));h.append(r).css("height","auto");var l=r.offset().left,s=r.clone().css("position","absolute"),a=this;r.css("visibility","hidden");h.append(s).dequeue();s.css({left:l+150}).animate({left:l},150,function(){r.css("visibility","visible");s.remove()})},_removeColumnFromDrop:function(t){for(var f=this.getHeaderTextByFieldName(t),e=this,u=this.element.children(".e-groupdroparea"),r=u.css("height","30px").find(".e-grid-icon"),i=0;i<r.length;i++)n.trim(r.eq(i).find("div").attr("ej-mappingname"))==t&&(this.model.groupSettings.groupedColumns.length==0?this.collapseGroupDropArea():r.eq(i).remove())},_setAggreatedCollection:function(n){if((!(this._dataSource()instanceof t.DataManager)||this._dataManager.dataSource.url==i||this._isRemoteSaveAdaptor||this._dataManager.dataSource.offline)&&!this.model.enableLoadOnDemand){var r;r=this._dataManager.executeLocal(n).result;this._aggregatedCollection=r}},_setAggregates:function(n,i){var r,e,k=new t.Query,l,a,s,u,h,y,v,o,p,c,w,f,b;for(n=n||this.model.currentViewData,i=i||this._aggregatedCollection,l=n.length,l!=0&&(s=t.Predicate("field","equal",n[0].field),u=t.Predicate("key","equal",n[0].key),n[0].key instanceof Date&&(h={value:n[0].key,operator:"equal",field:"key"},u=this._setDateFilters(h,!0)),e=s.and(u)),r=1;r<l;r++)s=t.Predicate("field","equal",n[r].field),u=t.Predicate("key","equal",n[r].key),n[r].key instanceof Date&&(h={value:n[r].key,operator:"equal",field:"key"},u=this._setDateFilters(h,!0)),e=e.or(s.and(u));if(i=e?new t.DataManager(i).executeLocal(k.where(e)):i,a=i.length,n.length>0)for(r=0;r<a;r++)if((!(r>0)||!(r<a-1))&&(n[r].count=i[r].count,n[r].items.GROUPGUID&&this._setAggregates(n[r].items,i[r].items),this.model.showSummary))for(y=n[r].aggregates=[],v=this.model.summaryRows,c=0,w=v.length;c<w;c++)for(o=v[c].summaryColumns,f=0,b=o.length;f<b;f++)p=i[r].items.level?i[r].items.records:i[r].items,y[o[f].dataMember+" - "+o[f].summaryType]=this.getSummaryValues(o[f],p)}}}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.dragAndDrop={_headerCellgDragDrop:function(){var i=this,r;this.dragHeaderElement();r=this.element.children("div.e-groupdroparea");r.ejDroppable({accept:r,drop:function(r,u){if(!t.isNullOrUndefined(u.helper)&&u.helper.is(":visible")){var f=i.getColumnByField(n.trim(n(u.draggable[0]).find("div").attr("ej-mappingname")));(u.helper.remove(),i._disabledGroupableColumns.length&&n.inArray(f.field,i._disabledGroupableColumns)!=-1)||(t.isNullOrUndefined(f)||t.isNullOrUndefined(f.field)||f.field==""||i.groupColumn(f.field),i.model.allowGrouping&&i.collapseGroupDropArea())}}})},_headerCellreorderDragDrop:function(){var i=this,r;this.dragHeaderElement();r=this.element.find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell");r.ejDroppable({accept:r,drop:function(r,u){var v,h,l,f,e,c,a,y,p,o,s,w;!t.isNullOrUndefined(u.helper)&&u.helper.is(":visible")&&n(u.draggable[0]).closest(".e-grid").attr("id")==i._id&&((u.draggable.attr("aria-sort")=="ascending"||u.draggable.attr("aria-sort")=="descending")&&(v=i.getColumnByField(n.trim(n(u.draggable[0]).find("div").attr("ej-mappingname"))),i.model.allowSorting&&i.model.allowMultiSorting?i._scolumns.push(v.field):i._gridSort=v.field),a=u.draggable.index(),r.dropTarget.hasClass("e-headercelldiv")?c=r.dropTarget.parent().index():(r.dropTarget.parent().hasClass("e-headercell")||r.dropTarget.hasClass("e-headercell"))&&(c=r.dropTarget.index()),(n(r.dropTarget).hasClass("e-number")||n(r.dropTarget).hasClass("e-icon"))&&(c=r.dropTarget.closest(".e-headercell").index()),i.model.scrollSettings.frozenColumns>0?(f=u.draggable.closest(".e-frozenheaderdiv").length>0?a:a+i.model.scrollSettings.frozenColumns,e=r.dropTarget.closest(".e-frozenheaderdiv").length>0?c:c+i.model.scrollSettings.frozenColumns):(f=a,e=c),i.model.allowGrouping&&i.model.groupSettings.groupedColumns.length>0?(f=f-i.model.groupSettings.groupedColumns.length,e=e-i.model.groupSettings.groupedColumns.length):(i.model.detailsTemplate!=null||i.model.childGrid!=null)&&(f=f-1,e=e-1),h=i.getColumnByIndex(f),l=i.getColumnByIndex(e),y=!t.isNullOrUndefined(h)&&!t.isNullOrUndefined(h.field)&&h.field!=""?h.field:null,p=!t.isNullOrUndefined(l.field)&&l.field!=""?l.field:null,u.helper.remove(),o=n(r.dropTarget).clone(),o.find(".e-number").remove(),t.isNullOrUndefined(y)||t.isNullOrUndefined(p)?i.reorderColumns(f,e):(n(r.dropTarget).hasClass("e-droppable")?(o=o.children(".e-headercelldiv"),s=n(r.dropTarget).children(".e-headercelldiv")):(o=n(r.dropTarget).parent(),s=n(r.dropTarget),n(s).hasClass("e-filtericon")&&(s=o=n(s).siblings(".e-headercelldiv"))),w=i.model.allowSorting&&i.model.allowMultiSorting?r.dropTarget.hasClass("e-number")||r.dropTarget.hasClass("e-icon")?i.getColumnByField(n.trim(o.attr("ej-mappingname"))):i.getColumnByField(n.trim(s.attr("ej-mappingname"))):r.dropTarget.hasClass("e-icon")&&!r.dropTarget.hasClass("e-filtericon")?i.getColumnByField(n.trim(o.attr("ej-mappingname"))):i.getColumnByField(n.trim(s.attr("ej-mappingname"))),i.reorderColumns(h.field,w.field)),i.model.allowGrouping&&i.collapseGroupDropArea())}})},dragHeaderElement:function(){var i=this,f=this.element.children("div.e-gridheader").find("th.e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell"),u=t.buildTag("div.e-cloneproperties e-grid","",{height:"20px","z-index":2}),r;f.ejDraggable({cursorAt:{top:0,left:0},helper:function(t){var f,s,e,o;return i.element.find(".e-dragclone").length>0&&i.element.find(".e-dragclone").remove(),f=n(t.element).hasClass("e-headercell")?n(t.element):n(t.element).closest("th"),s=f.find(".e-headercelldiv"),e=n(t.element).index(),i.model.allowGrouping&&i.model.groupSettings.groupedColumns.length>0?e=e-i.model.groupSettings.groupedColumns.length:(i.model.detailsTemplate!=null||i.model.childGrid!=null)&&(e=e-1),r=i.getColumnByIndex(e),i._$curSElementTarget=s,i.model.allowSorting&&i.model.allowMultiSorting?(o=n(f).clone(),o.find(".e-number").remove(),u.text(o.text()).clone().width(f.outerWidth()+2).height(f.height()+2).css({"font-size":parseInt((f.height()+3)/2)}).addClass("e-dragclone").appendTo(i.element)):u.text(f.text()).clone().width(f.outerWidth()+2).height(f.height()+2).css({"font-size":parseInt((f.height()+3)/2)}).addClass("e-dragclone").appendTo(i.element)},dragStart:function(t){var e=t.target,s=n(e),h={target:e,draggableType:"headercell",column:r},u,f,o=!1;return(i.model.groupSettings.showToggleButton&&r&&r.allowGrouping&&(u=n.inArray(r.field,i.model.groupSettings.groupedColumns),f=n(t.element).find(".e-togglegroupbutton").hasClass("e-togglegroup"),(u!=-1&&f||u==-1&&!f)&&(o=!0)),i._resizer!=null&&i._resizer._expand||o||s.eq(0).hasClass("e-filtericon")||r&&r.allowGrouping==!1&&r.allowReordering==!1)?(n(".e-dragclone").remove(),!1):(i._dragActive=!0,i.model.allowGrouping&&i.expandGroupDropArea(),i._trigger("columnDragStart",h)?!1:void 0)},drag:function(t){var u=n(t.target),e={target:u,draggableType:"headercell",column:r},f;if(i._trigger("columnDrag",e))return!1;u.closest(".e-grid").attr("id")===i._id&&(i.getHeaderTable().find(".e-headercell").removeClass("e-reorderindicate"),!i.model.allowReordering||!(u.hasClass("e-headercelldiv")||u.hasClass("e-headercell"))||u.hasClass("e-detailheadercell")||u.hasClass("e-stackedHeaderCell")||u.parent().hasClass("e-grouptopleftcell")||(document.body.style.cursor="",u.addClass("e-allowDrop"),i.getHeaderTable().find(".e-reorderindicate").removeClass("e-reorderindicate"),u.hasClass("e-headercell")?u.addClass("e-reorderindicate"):u.parent().addClass("e-reorderindicate")),i.model.allowScrolling&&(f=t.event.type=="touchmove"?t.event.originalEvent.touches[0].pageX:t.event.pageX,i._dragAutoScrollX(f,t)),u.hasClass("e-groupdroparea")||u.closest(".e-groupdroparea").length?(document.body.style.cursor="default",u.addClass("e-allowDrop")):u.hasClass("e-headercelldiv")||u.hasClass("e-headercell")?document.body.style.cursor="pointer":u.hasClass("e-rowcell")&&(document.body.style.cursor="not-allowed"))},dragStop:function(t){if(!t.element.dropped){var u=n(t.target),f={target:u,draggableType:"headercell",column:r};i._trigger("columnDrop",f);i.element.find(".e-groupdroparea").removeClass("e-hover");i.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive").removeClass("e-active");n(t.target).closest(".e-groupdroparea").length||n(t.target).closest(".e-columnheader").length&&i.model.allowReordering&&!n(t.target).hasClass("e-stackedHeaderCell")||n(".e-dragclone").remove();(n(t.target).hasClass("e-rowcell")||n(t.target).hasClass("e-stackedHeaderCell"))&&i.collapseGroupDropArea();i._dragActive=!1;i.getHeaderTable().find(".e-reorderindicate").removeClass("e-reorderindicate");document.body.style.cursor="";n(i._Indicator).css("display","none")}}})},_groupHeaderCelldrag:function(){var u=t.buildTag("div.e-cloneproperties e-grid","",{height:"20px","z-index":2}),i=childProxy=this,f=this.element.children(".e-groupdroparea").find(".e-groupheadercell"),r;f.ejDraggable({cursorAt:{top:0,left:0},helper:function(t){var r=n(t.sender.target).closest(".e-grid-icon");return u.text(n(t.sender.target).closest(".e-groupheadercell").text()).clone().width(r.width()+2).height(r.height()+2).addClass("e-dragclone").appendTo(i.element)},dragStart:function(n){var r=n.target,t;return n.model.cursorAt={top:0,left:0},t={target:r,draggableType:"groupheadercell"},i._trigger("columnDragStart",t)?!1:void 0},drag:function(t){n(".Sibling").remove();var r=n(t.target),u={target:r,draggableType:"groupheadercell"};if(i._trigger("columnDrag",u))return!1;r.closest("div.e-gridcontent").length?(document.body.style.cursor="",r.addClass("e-allowDrop")):document.body.style.cursor=n(t.target).closest(".e-columnheader").length>0?"pointer":"not-allowed"},dragStop:function(t){if(childProxy=i,!t.element.dropped){var r=n(t.target),u={target:r,draggableType:"groupheadercell"};n(t.target).closest(".e-rowcell").length||n(t.target).closest(".e-groupcaption").length||n(t.target).closest(".e-columnheader").length||n(".e-dragclone").remove();document.body.style.cursor=""}}});r=this.element.children(".e-gridcontent, .e-gridheader");r.ejDroppable({accept:i.element.children("div.e-groupdroparea").find(".e-groupheadercell"),drop:function(i,r){if(!t.isNullOrUndefined(r.helper)&&r.helper.is(":visible")&&r.draggable.hasClass("e-groupheadercell")){var u=n(r.draggable[0]).find("div").attr("ej-mappingname");r.helper.remove();t.isNullOrUndefined(u)||childProxy.ungroupColumn(u)}}})},_rowsDragAndDrop:function(){this.dragRowElement();var r=this.getContentTable(),i=this;r.ejDroppable({accept:r,drop:function(r,u){var v=n(r.dropTarget).closest("tr"),f,l,h,c,o,a;if(!u.helper.find("tr.e-srcgridinfo").length||(i._draggedGridID=u.helper.find("tr.e-srcgridinfo").children("td").text(),f=i._draggedGridID!=i._id?n("#"+i._draggedGridID).ejGrid("instance"):i,f._id!=i._id&&f.model.rowDropSettings.dropTargetID!="#"+i._id))return!1;var s=f.getSelectedRecords(),e=l=i.getIndexByRow(v);if(e==-1&&(e=l=0),e=e+i._currentPage()*i.model.pageSettings.pageSize-i.model.pageSettings.pageSize,h={sourceID:f._id,destinationID:i._id,destinationRowIndex:e},o={target:v,targetIndex:e,draggedRecords:s,dropDetails:h},!i._trigger("beforeRowDrop",o))if(c=i._dataSource()instanceof t.DataManager?i._dataSource().dataSource:i._dataSource(),t.isNullOrUndefined(i.model.rowDropSettings.dropMapper)||(t.isNullOrUndefined(c.headers)&&(c.headers=[]),c.headers.push({rowDropDetails:JSON.stringify(h)})),i._id!=f._id){var p=i._dataManager,w=i._dataSource().adaptor,y=f.getBatchChanges();y.deleted=s;o={dropDetails:h,records:s,requestType:t.Grid.Actions.Refresh,targetIndex:e,action:"rowDragged"};i._processDropRequest(f,y,"drag",o);a=i.getBatchChanges();a.added=s;o.action="rowDropped";i._processDropRequest(i,a,"drop",o)}else i._draggedGridID==i._id&&(i.reorderRows(f.selectedRowsIndexes,l),n(".e-dragclone").remove())}})},_dragAutoScrollX:function(n){var u=n-this.element.offset().left,f=this.element.width()-this.model.scrollSettings.scrollerSize,i=this.getScrollObject(),r=this;i&&i._hScrollbar&&(u<5?this._dragLeftInterval=setInterval(function(){if(r._dragLeftInterval){var n=i.scrollLeft(),u=t.sum(r.columnsWidthCollection)/r.model.columns.length;n>i._hScrollbar.model.minimum?n>u?i.scrollX(i.scrollLeft()-u,!0):i.scrollX(i._hScrollbar.model.minimum,!0):r._dragLeftInterval&&(r._dragLeftInterval=clearInterval(r._dragLeftInterval))}},500):u>f-5?this._dragRightInterval=setInterval(function(){if(r._dragRightInterval){var n=i.scrollLeft(),u=t.sum(r.columnsWidthCollection)/r.model.columns.length;Math.round(n)<i._hScrollbar.model.maximum?i.scrollX(i.scrollLeft()+u,!0):r._dragRightInterval&&(r._dragRightInterval=clearInterval(r._dragRightInterval))}},500):(this._dragLeftInterval&&(this._dragLeftInterval=clearInterval(this._dragLeftInterval)),this._dragRightInterval&&(this._dragRightInterval=clearInterval(this._dragRightInterval))))},_dragAutoScroll:function(n,t){var i=n.getContent().data("ejScroller"),r=n.getContent()[0].getBoundingClientRect();r||(r=n.getContent().offset());i&&i._vScrollbar&&(r.top>=t.event.clientY?n._dragUpInterval=setInterval(function(){if(n._dragUpInterval){var t=-n.getRowHeight(),r=i.scrollTop();r!=0?i.scrollY(i.scrollTop()+t,!0):n._dragUpInterval&&(n._dragUpInterval=clearInterval(n._dragUpInterval))}},500):r.top+n.getContent().height()<=t.event.clientY?n._dragDownInterval=setInterval(function(){if(n._dragDownInterval){var t=n.getRowHeight(),r=i.scrollTop();Math.round(r)<=i._vScrollbar.model.maximum?i.scrollY(i.scrollTop()+t,!0):n._dragDownInterval&&(n._dragDownInterval=clearInterval(n._dragDownInterval))}},500):(n._dragUpInterval&&(n._dragUpInterval=clearInterval(n._dragUpInterval)),n._dragDownInterval&&(n._dragDownInterval=clearInterval(n._dragDownInterval))))},dragRowElement:function(){var i=this,r=n(this.getRows());r.ejDraggable({cursorAt:{top:-8,left:-8},helper:function(r){var f,u,e,o,h,s;return(this.clone=!0,f=n(r.element).closest("tr"),i._selectDrag||!f.length||n.inArray(i.getIndexByRow(f),i.selectedRowsIndexes)==-1)?!1:(u=t.buildTag("div.e-cloneproperties e-draganddrop e-grid","",{height:"auto","z-index":2,position:"absolute",width:i.element.width()}),u.append(t.buildTag("table","",{width:i.element.width()})),o=n(i.getRows()).clone().removeClass(),h=0,e=n.map(o,function(t,r){if(n.inArray(r,i.selectedRowsIndexes)!=-1)return t}),s=t.buildTag("tr.e-srcgridinfo e-grid","",{display:"none",height:"auto"}).append("<td>"+i._id+"<\/td>"),e.push(s[0]),n(e).find("td").removeClass("e-selectionbackground e-active"),u.find("table").append(e),f.find("td.e-selectionbackground").length||u.css("display","none"),u.addClass("e-dragclone").appendTo(n("body")))},dragStart:function(t){var r=n(t.target).closest("tr");if(i._selectDrag||n.inArray(i.getIndexByRow(r),i.selectedRowsIndexes)==-1)return!1;var u=t.target,f=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),e=i.getSelectedRecords(),o={target:f,currentTarget:u,draggableType:"rows",data:e};if(i._trigger("rowDragStart",o))return!1},drag:function(t){var r=n(t.target),f=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),e=i.getSelectedRecords(),o={target:f,currentTarget:r,draggableType:"rows",data:e},u;if(i._dragAutoScroll(i,t),i._trigger("rowDrag",o))return!1;document.body.style.cursor="not-allowed";u=n(i.model.rowDropSettings.dropTargetID);(r.closest(i.model.rowDropSettings.dropTargetID).length||r.closest("#"+i._id).length)&&(r.closest(".e-grid").length&&(r.closest(".e-rowcell").length||r.closest(".emptyrecord").length)?r.closest("table").addClass("e-allowRowDrop"):u.hasClass("e-grid")||u.addClass("e-allowRowDrop"))},dragStop:function(r){var u,f;if(!r.element.dropped){i._dragUpInterval&&(i._dragUpInterval=clearInterval(i._dragUpInterval));i._dragDownInterval&&(i._dragDownInterval=clearInterval(i._dragDownInterval));var e=n(r.target),o=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),s=i.getSelectedRecords();if(document.body.style.cursor="",u=n(i.model.rowDropSettings.dropTargetID),u.hasClass("e-grid")?u.find(".e-gridcontent").find("table").removeClass("e-allowRowDrop"):u.removeClass("e-allowRowDrop"),i.getContent().find("table").removeClass("e-allowRowDrop"),f={rows:o,target:e,draggableType:"rows",data:s},t.isNullOrUndefined(this._checkTargetElement(r.event))&&n(".e-dragclone").remove(),i._trigger("rowDrop",f))return!1}}})},_processDropRequest:function(i,r,u,f){var e,o;f.action=="rowDragged"&&n(".e-dragclone").remove();e=i._dataManager.dataSource.batchUrl;i._dataManager.dataSource.batchUrl=i.model.rowDropSettings[u+"Mapper"];o=i._dataManager.saveChanges(r,i._primaryKeys[0],i.model.query._fromTable);n.isFunction(o.promise)&&i._dataManager.dataSource.batchUrl!=null?(n("#"+i._id).data("ejWaitingPopup").show(),o.done(function(){i._isLocalData&&u=="drop"&&(f.dropDetails.sourceID==f.dropDetails.destinationID?i._moveDroppedRowIndex(f.targetIndex,f.records,f.draggedRowIndexes):i._moveDroppedRowIndex(f.targetIndex,f.records));u=="drop"&&(i._dataSource()instanceof t.DataManager?i._dataSource().dataSource.headers.pop():i._dataSource().headers.pop());i._dataManager.dataSource.batchUrl=e;i.refreshBatchEditChanges();n("#"+i._id).data("ejWaitingPopup").hide();i._processBindings(f)}),o.fail(function(t){i._dataManager.dataSource.batchUrl=e;n("#"+i._id).data("ejWaitingPopup").hide();f.error=t&&t.error?t.error:t;i._trigger("actionFailure",f)})):(i.refreshBatchEditChanges(),i._dataManager.dataSource.batchUrl=e,u=="drop"&&i._moveDroppedRowIndex(f.targetIndex,f.records),f.dropDetails.sourceID==f.dropDetails.destinationID&&u=="drag"||i._processBindings(f))},reorderRows:function(n,i){var r,u,f;if(!this.model.sortSettings.sortedColumns.length)if(r=this.getSelectedRecords(),this.selectedRowsIndexes=[],u={requestType:t.Grid.Actions.Refresh,action:"rowReordering",draggedRowIndexes:n,targetIndex:i,dropDetails:{sourceID:this._id,destinationID:this._id,DestinationRowIndex:i},records:r},t.isNullOrUndefined(this.model.rowDropSettings.dropMapper)){if(this._trigger("actionBegin",u))return!1;this._moveDroppedRowIndex(i,r,n);this._trigger("actionComplete",u)}else f=this.getBatchChanges(),f.changed=r,this._processDropRequest(this,f,"drop",u)},_moveDroppedRowIndex:function(i,r,u){var a,o,h,p,f;if(t.isNullOrUndefined(u)){if(i>-1)for(h=this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json:this._dataSource(),p=i+this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,f=0;f<r.length;f++)h.splice(i++,0,h.splice(h.length-r.length+f,1)[0])}else{var u=u.sort(function(n,t){return n-t}),c=i,s,e,l=0,v=this.model.currentViewData.slice(),y=this.getRowByIndex(i);for(i+=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,f=0;f<u.length;f++)h=v[u[f]],e=u[f]-l,s=0,a=this._excludeDetailRows(),o=n(a[e]),c>e&&l++,this.model.allowPaging&&(s=this._currentPage()*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize),e=s+e,this.selectedRowsIndexes.push(c-l),f==u.length-1&&(this.model.selectedRowIndex=this.selectedRowsIndexes[0]),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&o.next().hasClass("e-detailrow")&&(o=o.add(o.next()[0])),y.before(o),c<u[f]-l?c++:i--,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.splice(i+f,0,this._dataSource().dataSource.json.splice(e,1)[0]):this._dataSource().splice(i+f,0,this._dataSource().splice(e,1)[0]),this.model.currentViewData.splice(i+f-s,0,this.model.currentViewData.splice(e-s,1)[0])}}}}(jQuery,Syncfusion),function(n,t,i){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.selection={selectRows:function(r,u,f){var s,st,c,l,lt,at,vt,p,yt,nt,ft,pt,k,e,d,v,b,a,et,ot,y,wt,bt,kt,h;if(!this._allowrowSelection)return!1;if(this._traverseRow!=r&&n(".e-traverse").removeClass("e-traverse"),this._traverseRow=null,s=[],this.initialRender&&(this.model.currentIndex=r),this.model.scrollSettings.enableVirtualization&&(n.isArray(r)?this.model.currentIndex=r[0]:u&&(this.model.currentIndex=r>u?u:r)),!this.multiSelectCtrlRequest&&this.model.scrollSettings.allowVirtualScrolling&&(this._virtuaOtherPage?this._virtualScrollingSelection=!0:(this.clearSelection(),this._virtualScrollingSelection=!1)),n.isArray(r)&&(s=r,r=s[0],this._virtaulSel=[],this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization))for(this._virtualScrollingSelection=!0,this._virtualSelectedRows=s,st=parseInt(r/this.model.pageSettings.pageSize)*this.model.pageSettings.pageSize,d=(parseInt(r/this.model.pageSettings.pageSize)+1)*this.model.pageSettings.pageSize,this._virtaulSel.push(r),this._virtuaOtherPage||(this._virtaulUnSel=[]),e=1;e<s.length;e++)st<s[e]&&s[e]<d?this._virtaulSel.push(s[e]):this._virtaulUnSel.push(s[e]);if(p=n(this.getRows()),this.model.allowScrolling&&!this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&(l=p.eq(r)[0],!t.isNullOrUndefined(l)&&this.model.groupSettings.groupedColumns.length==0)){var ht=this.getScrollObject().scrollTop(),ct=ht+this.getScrollObject().content()[0].clientHeight,tt=l.offsetTop+l.offsetHeight;(!t.isNullOrUndefined(l)&&ct<tt||tt<=ht&&tt<ct)&&(lt=t.isNullOrUndefined(l)?" ":l.offsetTop,at=this.getScrollObject(),at.scrollY(lt))}var h={},g,it=this._currentPage()-1,w=this.model.pageSettings.pageSize;this.model.scrollSettings.enableVirtualization||(v=this.getRowByIndex(r).attr("name"),b=t.isNullOrUndefined(v)?r:parseInt(v)/w+1);t.isNullOrUndefined(r)||(this.model.editSettings.editMode=="batch"&&n(p[r]).hasClass("e-insertedrow")?(vt=this.batchChanges.added.reverse(),c=vt[r],this.batchChanges.added.reverse()):c=this.model.editSettings.editMode=="batch"?this._currentJsonData[r-this.batchChanges.added.length]:this._currentJsonData[t.isNullOrUndefined(r)?u:r]);var o=r,rt=this._previousIndex,ut=this.getRowByIndex(this._previousIndex);if(h={rowIndex:o,row:p.eq(r),data:c,target:f,prevRow:ut,prevRowIndex:rt},this.model.scrollSettings.allowVirtualScrolling&&(h=this._getVirtualRows(r,f,"selectRows",s),this.model.scrollSettings.enableVirtualization||(r=h.rowIndex),c=h.data,o=h.rowIndex,rt=h.prevRowIndex,ut=h.prevRow),!this._trigger("rowSelecting",h)){if(f&&f.hasClass("e-checkselectall")&&this._isLocalData&&this._isMapSelection)return this._headerCheckUpdateAll(!f[0].checked);if(p=n(this.getRows()),this._isMapSelection&&!this._selectionByGrid&&t.isNullOrUndefined(u)&&!s.length){c[this._selectionMapColumn]=!h.row.find(".e-checkcelldiv input").prop("checked");this.updateRecord(this._primaryKeys[0],c,"update");return}if((this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this.model.isEdit&&this.model.enableAutoSaveOnSelectionChange&&(!(this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal")||this.getContentTable().find(".e-editedrow").length!=0)){if(this.endEdit())return;(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none")}if(this.checkSelectedRowsIndexes[it]!=i||this._isMapSelection||(this.checkSelectedRowsIndexes[it]=[]),s.length>0){for(e=0;e<s.length;e++)this.selectedRowsIndexes.indexOf(s[e])==-1&&this.selectedRowsIndexes.push(s[e]),this._selectedMultipleRows(this.selectedRowsIndexes),this._isMapSelection&&!this._selectionByGrid&&(y=this._currentJsonData[s[e]],y[this._selectionMapColumn]=!0,this.batchChanges.changed.push(y));if(!this.model.scrollSettings.enableVirtualization)for(yt=this._virtaulSel[0]-r,e=0;e<this._virtaulSel.length;e++)this._virtaulSel[e]-=yt;if(rows=this.getRowByIndex(this.model.scrollSettings.allowVirtualScrolling?this._virtaulSel:s),this.model.scrollSettings.frozenColumns&&(rows=n(rows[0]).add(rows[1])),n(rows).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),this._enableCheckSelect&&!this._isMapSelection&&n(rows).find(".e-checkcelldiv input").prop("checked","checked"),Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords()),this._isMapSelection&&!this._selectionByGrid){this.batchSave();return}}else if(t.isNullOrUndefined(u)||t.isNullOrUndefined(r)){r=t.isNullOrUndefined(r)?u:r;o=r;switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){this.model.selectedRecords=[];nt=n.inArray(o,this.selectedRowsIndexes);nt!=-1&&!this._isMapSelection&&this.clearSelection(o,f)&&this.selectedRowsIndexes.splice(nt,0);nt==-1&&(this.selectedRowsIndexes.push(o),this._selectedMultipleRows(this.selectedRowsIndexes),ft=this.getRowByIndex(r),ft.attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),this.model.scrollSettings.enableVirtualization?this._virtualSelectedRecords[o]=this._getSelectedViewData(r,f).data:this._virtualSelectAction(b,r,w),(this._enableCheckSelect&&f&&!f.parent().hasClass("e-checkcelldiv")||t.isNullOrUndefined(f)&&this._enableCheckSelect)&&ft.find(".e-checkcelldiv input").prop("checked","checked"));Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords());break}case t.Grid.SelectionType.Single:this.clearSelection();this.clearColumnSelection();this.selectedRowsIndexes=[];this.model.selectedRecords=[];this._virtualSelectedRecords={};this.selectedRowsIndexes.push(o);this._selectedMultipleRows(this.selectedRowsIndexes);this.getRowByIndex(r).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active");this.model.scrollSettings.enableVirtualization?this._virtualSelectedRecords[o]=c:this._virtualSelectAction(b,r,w);Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords());this._enableCheckSelect&&this.getRowByIndex(r).find(".e-checkcelldiv [type=checkbox]").prop("checked",!0)}}else if(this.model.selectionType==t.Grid.SelectionType.Multiple&&(this._isMapSelection||this.clearSelection(),this.clearColumnSelection(),this.selectedRowsIndexes=[],this.model.selectedRecords=[],this._virtualSelectedRecords={},$toIndex=u,this._virtualUnSel=[],this._virtualUnSelIndexes=[],this._isMapSelection||!(f&&f.hasClass("e-checkselectall")&&f[0].checked))){for(this.model.scrollSettings.enableVirtualization&&f&&(a=this._getSelectedViewData(u,f).viewIndex,pt=u%this._virtualRowCount,$toIndex=a*this._virtualRowCount-(this._virtualRowCount-pt),o!=this._prevSelIndex&&(o=this._prevSelIndex)),g=o-$toIndex<0,this.model.scrollSettings.enableVirtualization||(rows=g?this.getRowByIndex(r,u+1):this.getRowByIndex(u,r+1)),this.model.scrollSettings.frozenColumns&&(rows=n(rows[0]).add(rows[1])),k=[],e=g?o:$toIndex,d=g?$toIndex:o;e<=d;e++)this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization?(this._virtualSelectedRecords[e]=this._getSelectedViewData(e).data,a=this._getSelectedViewData(e).viewIndex,n.inArray(a,this._currentLoadedIndexes)!=-1?(et=this._currentLoadedIndexes.indexOf(a),ot=e%this._virtualRowCount+et*this._virtualRowCount,ot==0&&et*this._virtualRowCount,k.push(ot)):(this._virtualUnSel.push(e),n.inArray(a,this._virtualUnSelIndexes)==-1&&this._virtualUnSelIndexes.push(a))):(v=this.getRowByIndex(e).attr("name"),b=t.isNullOrUndefined(v)?r:parseInt(v)/w+1,this._virtualSelectAction(b,e,w))),this.selectedRowsIndexes.push(e),this._selectedMultipleRows(this.selectedRowsIndexes),this._isMapSelection&&!this._selectionByGrid&&(y=this._currentJsonData[e],y[this._selectionMapColumn]=!0,this.batchChanges.changed.push(y));if(this._isMapSelection){this.batchSave();return}this.model.scrollSettings.enableVirtualization&&(rows=this.getRowByIndex(k[0],k[k.length-1]+1));n(rows).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active");Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords());this._enableCheckSelect&&n(rows).find(".e-checkcelldiv input").prop("checked","checked")}this._enableCheckSelect&&(this.checkSelectedRowsIndexes[it]=this.selectedRowsIndexes,this._selectAllCheck||(this.selectedRowsIndexes.length==this._currentJsonData.length||this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.selectedRowsIndexes.length==this._gridRecordsCount?this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").prop("checked","checked"):this._selectionByGrid&&this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").prop("checked",!1)));this._selectedRow()!==o&&n(this.getRowByIndex(o)).attr("aria-selected")=="true"&&this._selectedRow(o);f&&f.hasClass("e-checkselectall")&&!this._isMapSelection&&(wt=this,bt=this._dataSource()instanceof t.DataManager&&this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization?Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize):this.model.pageSettings.totalPages,this.checkSelectedRowsIndexes=f.is(":checked")?[]:n.map(Array(bt),function(){return Array(n.map(Array(wt.model.pageSettings.pageSize),function(n,t){return t}))}));c=this._virtualScrollingSelection?this._virtualSelRecords:c;kt=this.model.scrollSettings.enableVirtualization?o:this._selectedRow();h={rowIndex:kt,row:this.getRowByIndex(this._selectedRow()),data:c,target:f,prevRow:ut,prevRowIndex:rt};this._previousIndex=this.selectedRowsIndexes.length?r:this._previousIndex;this.model.scrollSettings.enableVirtualization&&(this._prevSelIndex=o,this._prevSelRow=this.getRowByIndex(r));this.model._checkSelectedRowsIndexes=this.checkSelectedRowsIndexes;n(this.getRowByIndex(r)).is('[role="row"]')&&n(this.getRowByIndex(o)).attr("aria-selected")=="true"&&this._trigger("rowSelected",h)}},_getVirtualRows:function(i,r,u,f){var p=i,d=this._previousIndex,g=this.getRowByIndex(this._previousIndex),w,c,a={},it=n(this.getRows()),nt,y,e,o,k;if(this.model.scrollSettings.enableVirtualization){var rt=this._virtualRowCount,v=Math.ceil((i+1)/rt),b=v>1?this._virtualRowCount:0;if(this.initialRender||v!=this._currentVirtualIndex&&!r?(this._isThumbScroll=!0,this._refreshVirtualView(v,u,i),i=i!=0?i%this._virtualRowCount+b:i):(!(i>this._virtualRowCount*3)&&(t.isNullOrUndefined(r)||n(r).parent().hasClass("e-headercelldiv")||t.isNullOrUndefined(r[0])||r[0].checked)?i=i%this._virtualRowCount+b:(y=this._getSelectedViewData(i,r).viewIndex,nt=i%this._virtualRowCount,p=y*this._virtualRowCount-(this._virtualRowCount-nt)),i!=p||r||(i=i!=0?i%this._virtualRowCount+b:i)),f.length)for(o=0;o<f.length;o++)y=this._getSelectedViewData(f[o]).viewIndex,n.inArray(y,this._currentLoadedIndexes)!=-1&&this._virtaulSel.push(f[o]),this._virtualSelectedRecords[f[o]]||(this._virtualSelectedRecords[f[o]]=this._getSelectedViewData(f[o]).data);c=this._getSelectedViewData(i,r,v).data;d=this._prevSelIndex;g=this._prevSelRow}else{var s=this.model.pageSettings.pageSize,tt=this.getRowByIndex(i).attr("name"),ut=t.isNullOrUndefined(tt)?i:parseInt(tt)/s+1,l=i%s,h=parseInt(i/s),k=h*s;if(!t.isNullOrUndefined(h)&&h>0&&n.inArray(k,this.virtualLoadedPages)==-1&&t.isNullOrUndefined(r))if(l--,this._virIndex=!0,this._virtualTrIndex=l,this.gotoPage(h+1),e=this,this._dataSource()instanceof t.DataManager){if(this._queryPromise.done(function(n){var t;e._virtuaOtherPage=!0;e._virtualdata=e._currentJsonData;e._pageTo=h;e._virtualScrollingSelection&&(e._virtualSelRecords=n.virtualSelectRecords);var u=parseInt(i/e.model.pageSettings.pageSize)*e.model.pageSettings.pageSize,o=(parseInt(i/e.model.pageSettings.pageSize)+1)*e.model.pageSettings.pageSize,r=[];for(r.push(i),t=1;t<f.length;t++)u<f[t]&&f[t]<o&&r.push(f[t]);return e.selectRows(r),!1}),e._virtualScrollingSelection)return}else{if(e._virtualdata=e._currentJsonData,f.length>0)for(e._virtualSelRecords=[],o=0;o<f.length;o++)e._virtualSelRecords.push(this.model.dataSource[f[o]]);e._pageTo=h}for(this._virtuaOtherPage&&(this._virtuaOtherPage=!1),o=0;o<this._loadedJsonData.length;o++)this._loadedJsonData[o].pageIndex==ut&&(w=this._loadedJsonData[o].data);c=t.isNullOrUndefined(w)?this._currentJsonData[l]:w[l];c=this._virtualScrollingSelection?this._virtualSelRecords:c;k=this._pageTo*s;!t.isNullOrUndefined(this._virtualdata)&&this._virtualdata.length>0?(i=n(document.getElementsByName(k)[l]).index(),c=this._virtualdata[l],this._virtualdata=[]):n(document.getElementsByName(h*s)).length>0&&!t.isNullOrUndefined(this._pageTo)&&(i=n(document.getElementsByName(h*s)[i%s]).index())}return a={rowIndex:this.model.scrollSettings.enableVirtualization?p:i,row:it.eq(i),data:c},u=="selectRows"&&(a.prevRow=g,a.prevRowIndex=d),a},_selectingMultipleRows:function(n){this._modelMultiSelectedIndexes=n;this.clearSelection();this.multiSelectCtrlRequest=!0;for(var t=0;t<n.length;t++)this.selectRows(n[t]);this.multiSelectCtrlRequest=!1;this._modelMultiSelectedIndexes=[]},_virtualSelectAction:function(n,i,r){this.model.scrollSettings.allowVirtualScrolling&&!t.isNullOrUndefined(i)&&(this._virtualSelectedRecords[i]=t.isNullOrUndefined(this._virtualLoadedRecords[n])?this._currentJsonData[i%r]:this._virtualLoadedRecords[n][i%r])},_getSelectedViewData:function(t,i,r){var o=t%this._virtualRowCount,u,f={},e;return u=i?parseInt(n(i).closest("tr").attr("name"),32):r?r:t>1?Math.ceil((t+1)/this._virtualRowCount):1,f.viewIndex=u,this._virtualLoadedRecords[u]&&(f.data=this._virtualLoadedRecords[u][o]),e=t%this._virtualRowCount,f.rowIndex=u*this._virtualRowCount-(this._virtualRowCount-e),f},selectCells:function(r){var y,tt,it,g,nt,e,b,h,c,l,u,v,f,ut,d,k;if(!this._allowcellSelection)return!1;if(y=null,g=this._excludeDetailRows(),y=this.model.scrollSettings.frozenColumns?this._frozenCell(r[0][0],r[0][1][0]):g.eq(r[0][0]).find(".e-rowcell:eq("+r[0][1]+")"),t.isNullOrUndefined(this._previousRowCellIndex)||this._previousRowCellIndex.length==0||(this.model.scrollSettings.enableVirtualization?(tt=this._prevRowCell,it=this._preVirRowCellIndex):(tt=n(this.getRowByIndex(this._previousRowCellIndex[0][0]).find(".e-rowcell:eq("+this._previousRowCellIndex[0][1]+")")),it=this._previousRowCellIndex)),nt=this._currentJsonData[r[0][0]],e=r[0][0],this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(b=this._getSelectedViewData(r[0][0],y),nt=b.data,e=b.rowIndex),k={currentCell:y,cellIndex:r[0][1],data:nt,previousRowCellIndex:it,previousRowCell:tt},this.model.selectionType=="multiple"&&(k.isCtrlPressed=this.multiSelectCtrlRequest,k.isShiftPressed=this.multiSelectShiftRequest),!this._trigger("cellSelecting",k)){switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){d=n.inArray(e,this._rowIndexesColl);d!=-1?this.selectedRowCellIndexes[d].cellIndex.push(parseInt(r[0][1].toString())):(n.inArray(e,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(e),this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:r[0][1]}));y.addClass("e-cellselectionbackground e-activecell");break}else if(this.multiSelectShiftRequest&&this._previousRowCellIndex!=i){this.clearCellSelection();this.clearColumnSelection();this.selectedRowCellIndexes=[];var p=this._previousRowCellIndex[0][0],s=parseInt(this._previousRowCellIndex[0][1]),a=r[0][0],o=parseInt(r[0][1]);if(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(p=this._preVirRowCellIndex[0][0],a=this._getSelectedViewData(a,this.getRowByIndex(a).find(".e-rowcell")).rowIndex),h=[],this.model.selectionSettings.cellSelectionMode=="box"){var et=this.model.scrollSettings.frozenColumns?this.getRows()[0].length-1:this.getRows().length-1,rt=s<o?s:o,ft=rt==o?s:o,w=[],h=[];for(u=rt;u<=ft;u++){if(c=p,l=a,c<l)for(f=c;f<=l;f++)n.inArray(f,w)==-1&&w.push(f),this._selectMultipleCells(f,u,o,s);else for(f=l;f<=c;f++)n.inArray(f,w)==-1&&w.push(f),this._selectMultipleCells(f,u,o,s);h.push(u)}for(u=0;u<w.length;u++)this.selectedRowCellIndexes.push({rowIndex:w[u],cellIndex:h});this._rowIndexesColl=t.distinct(w)}else if(a>p)for(u=p;u<=a;u++){for(h=[],c=u==p?s:0,l=u==a?o:this.model.columns.length-1,f=c;f<=l;f++)h.push(f),this._selectMultipleCells(u,f,o,s);this.selectedRowCellIndexes.push({rowIndex:u,cellIndex:h});this._rowIndexesColl.push(u)}else for(u=p;u>=a;u--){if(h=[],c=u==p?s:this.model.columns.length-1,l=u==a?o:0,c>l)for(f=c;f>=l;f--)h.push(f),this._selectMultipleCells(u,f,o,s);else for(f=l;f>=c;f--)h.push(f),this._selectMultipleCells(u,f,o,s);this.selectedRowCellIndexes.push({rowIndex:u,cellIndex:h});this._rowIndexesColl.push(u)}break}else{for(this.clearCellSelection(),this._virtualRowCellSelIndex=[],u=0;u<r.length;u++)if(r[u][1].length>1)for(v=g.eq(r[u][0]).find(".e-rowcell"),this.model.scrollSettings.frozenColumns&&(v=n(g[0]).eq(r[u][0]).find(".e-rowcell").add(n(g[1]).eq(r[u][0]).find(".e-rowcell"))),f=0;f<v.length;f++)ut=this.model.detailsTemplate!=null||this.model.childGrid!=null?v[f].cellIndex-1:f,n.inArray(ut,r[u][1])!=-1&&(n(v[f]).addClass("e-cellselectionbackground e-activecell"),d=n.inArray(r[u][0],this._rowIndexesColl),d!=-1?this.selectedRowCellIndexes[d].cellIndex.push(v[f].cellIndex):(e=r[u][0],this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(b=this._getSelectedViewData(e,v),nt=b.data,e=b.rowIndex),this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:[v[f].cellIndex]}),this._rowIndexesColl.push(r[u][0])));else this.model.scrollSettings.frozenColumns?this._frozenCell(r[u][0],r[u][1][0]).addClass("e-cellselectionbackground e-activecell"):n(this.getRowByIndex(r[u][0]).find(".e-rowcell:eq("+r[u][1]+")")).addClass("e-cellselectionbackground e-activecell"),this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:r[u][1]}),this._rowIndexesColl.push(e);break}case t.Grid.SelectionType.Single:this.clearCellSelection();this.clearColumnSelection();this.selectedRowCellIndexes=[];this._virtualRowCellSelIndex=[];n.inArray(e,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(e);this.selectedRowCellIndexes.push({rowIndex:e,cellIndex:r[0][1]});this.model.scrollSettings.frozenColumns?this._frozenCell(r[0][0],r[0][1][0]).addClass("e-cellselectionbackground e-activecell"):n(this.getRowByIndex(r[0][0]).find(".e-rowcell:eq("+r[0][1]+")")).addClass("e-cellselectionbackground e-activecell")}k={currentCell:y,cellIndex:r[0][1],data:nt,selectedRowCellIndex:this.selectedRowCellIndexes,previousRowCellIndex:it,previousRowCell:tt};(!this.multiSelectShiftRequest||t.isNullOrUndefined(this._previousRowCellIndex))&&(this._previousRowCellIndex=r,this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._preVirRowCellIndex=n.extend(!0,[],r),this._preVirRowCellIndex[0][0]=e),this._prevRowCell=y);this._trigger("cellSelected",k)}},_selectMultipleCells:function(t,i){var r,u,f;this.model.scrollSettings.frozenColumns?this._frozenCell(t,i).addClass("e-cellselectionbackground e-activecell"):this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization?(r=this._getSelectedViewData(t).viewIndex,n.inArray(r,this._currentLoadedIndexes)!=-1&&(u=this._currentLoadedIndexes.indexOf(r),f=t%this._virtualRowCount+u*this._virtualRowCount,n(this.getRowByIndex(f).find(".e-rowcell:eq("+i+")")).addClass("e-cellselectionbackground e-activecell"),n.inArray(t,this._virtualRowCellSelIndex)==-1&&n.inArray(t,this._rowIndexesColl)!=-1&&t!=this._preVirRowCellIndex[0][0]&&this._virtualRowCellSelIndex.push(t))):n(this.getRowByIndex(t).find(".e-rowcell:eq("+i+")")).addClass("e-cellselectionbackground e-activecell")},selectColumns:function(r,u){var s,v,c,l,f,h,o;if(!this._allowcolumnSelection)return!1;this._allowcolumnSelection=!0;var e=this.getRows(),a=this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[this._previousColumnIndex],o={columnIndex:r==i?u:r,headerCell:n(this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[r]),column:this.model.columns[r],previousColumnIndex:this._previousColumnIndex,prevColumnHeaderCell:a},y=this._previousColumnIndex;if(this._previousColumnIndex=(o.isShiftPressed=this.multiSelectShiftRequest)==!0?r==i?u:r:u,this.model.selectionType=="multiple"&&(o.isCtrlPressed=this.multiSelectCtrlRequest,o.isShiftPressed=this.multiSelectShiftRequest),!this._trigger("columnSelecting",o)){if(t.isNullOrUndefined(u)||t.isNullOrUndefined(r)){r=t.isNullOrUndefined(r)?u:r;switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){if(s=n.inArray(r,this.selectedColumnIndexes),s!=-1&&this.clearColumnSelection(r)&&this.selectedColumnIndexes.splice(s,0),s==-1){if(this.selectedColumnIndexes.push(r),this._previousColumnIndex=this.selectedColumnIndexes.length?r:i,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(e,r);else for(f=0;f<e.length;f++)n(this._excludeDetailCells(e[f])[r]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell)")[r]).addClass("e-columnselection")}break}case t.Grid.SelectionType.Single:if(this.clearSelection(),this.clearCellSelection(),this.clearColumnSelection(),this.selectedColumnIndexes=[],this.selectedColumnIndexes.push(r),this._previousColumnIndex=this.selectedColumnIndexes.length?r:i,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(e,r);else for(f=0;f<e.length;f++)n(this._excludeDetailCells(e[f])[r]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell)")[r]).addClass("e-columnselection")}}else if(this.model.selectionType==t.Grid.SelectionType.Multiple)if(this.clearColumnSelection(),this.selectedColumnIndexes=[],v=0,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(v=1),c=r>u?u:r,l=r>u?r+1:u+1,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(e,c,l);else for(f=c;f<l;f++){for(h=0;h<e.length;h++)n(this._excludeDetailCells(e[h])[f]).addClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell,.e-detailheadercell)")[f]).addClass("e-columnselection");this.selectedColumnIndexes.push(f)}o={columnIndex:r==i?u:r,headerCell:n(this.getHeaderTable().find(".e-columnheader").last().find("th").not(".e-detailheadercell")[r]),column:this.model.columns[r],selectedColumnIndex:this.selectedColumnIndexes,previousColumnIndex:y,prevColumnHeaderCell:a};this._trigger("columnSelected",o)}},clearSelection:function(r,u){var p=r,g=n(this.getRows()),e=n(this.getRows()),r,l,o,a,w,v,s,y,u,b,h,k,d,f,nt,c;if(this._selectedRow()>=-1){if(e=this.model.scrollSettings.frozenColumns||!t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid)?this._excludeDetailRows():n(this.element.find("tr[aria-selected='true']")),l=e.find("td").hasClass("e-selectionbackground e-active"),l){if(o={},a=n(this.getContent().find("tr[aria-selected='true']")),this.model.scrollSettings.allowVirtualScrolling)t.isNullOrUndefined(r)?(y=this.selectedRowsIndexes[0],u=this.getSelectedRecords().length&&this._enableCheckSelect&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization?this.element.find(".e-headercheckcelldiv .e-checkselectall"):a[0]):y=r,b=this.selectedRowsIndexes,o=this._getVirtualRows(y,u,"clearSelection",b);else{for(t.isNullOrUndefined(r)||(this.model.editSettings.editMode=="batch"&&n(e[r]).hasClass("e-insertedrow")?(w=this.batchChanges.added.reverse(),f=w[r],this.batchChanges.added.reverse()):f=this.model.editSettings.editMode=="batch"?this._currentJsonData[r-this.batchChanges.added.length]:this._currentJsonData[t.isNullOrUndefined(r)?toIndex:r]),v=[],s=0;s<this.selectedRowsIndexes.length;s++)v.push(this._currentJsonData[this.selectedRowsIndexes[s]]);o={rowIndex:r==i?this.selectedRowsIndexes:r,row:r==i?a:g.eq(r),data:r==i?v:f}}if(this._trigger("rowDeselecting",o))return}t.isNullOrUndefined(r)?(e.removeAttr("aria-selected").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-selectionbackground").removeClass("e-active"),this._clearVirtualSelection||(this.selectedRowsIndexes=[],this.model.selectedRecords=[]),this._selectionByGrid||(e.find(".e-checkcelldiv [type=checkbox]").prop("checked",!1),nt=null,this._isMapSelection&&this._headerCheckUpdateAll(!1),Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords()))):(this.getRowByIndex(r).removeAttr("aria-selected").find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),h=this.getRowByIndex(r),this.model.scrollSettings.enableVirtualization&&this.multiSelectCtrlRequest&&(k=parseInt(h.attr("name"),32)*this._virtualRowCount,d=this._virtualRowCount-h.index()%this._virtualRowCount,r=k-d),r=n.inArray(r,this.selectedRowsIndexes),r!=-1&&(this.selectedRowsIndexes.splice(r,1),this._selectedMultipleRows(this.selectedRowsIndexes),this.model.selectedRecords.splice(r,1)),this._enableCheckSelect&&!u&&h.find(".e-checkcelldiv [type=checkbox]").prop("checked",!1),this._isMapSelection&&(this._selectionByGrid||t.isNullOrUndefined(r)||r==-1||(f=this._currentJsonData[p],f[this._selectionMapColumn]=!1,this.updateRecord(this._primaryKeys[0],f,"update")),Array.prototype.push.apply(this.model.selectedRecords,this.getSelectedRecords())));this._enableCheckSelect&&(this.selectedRowsIndexes.length==this._currentJsonData.length||this._selectAllCheck||this.getHeaderTable().find(".e-headercheckcelldiv .e-checkselectall").prop("checked",!1),c=this._currentPage()-1,checkBoxIndex=n.inArray(p,this.checkSelectedRowsIndexes[c]),checkBoxIndex!=-1&&this.checkSelectedRowsIndexes[c].splice(r,1),this.selectedRowsIndexes.length||this._isMapSelection||u||(this.checkSelectedRowsIndexes[c]=[],e.find(".e-checkcelldiv [type=checkbox]").prop("checked",!1)));this.selectedRowsIndexes.length||this._selectedRow(-1)}return this.model._checkSelectedRowsIndexes=this.checkSelectedRowsIndexes,l&&this._trigger("rowDeselected",o)?!0:void 0},_excludeDetailRows:function(){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)||this.model.scrollSettings.frozenColumns?this.model.scrollSettings.frozenColumns>0&&this.getRows()!=null&&this.getRows().length>1?n(this.getRows()[0]).not(".e-detailrow,.e-gridSummaryRows").add(n(this.getRows()[1]).not(".e-detailrow,.e-gridSummaryRows")):n(this.getRows()):n(this.getRows()).not(".e-detailrow,.e-gridSummaryRows")},clearCellSelection:function(r,u){var e,c,l,h,o,s,f;if(this._allowcellSelection){if(e=t.isNullOrUndefined(r)&&t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid)?n(this.element.find(".e-cellselectionbackground")).parent():this._excludeDetailRows(),h=e.find("td").hasClass("e-cellselectionbackground e-activecell"),h){c=this.model.scrollSettings.frozenColumns&&!t.isNullOrUndefined(r)?this._frozenCell(r,u):this.getContent().find(".e-cellselectionbackground");var a=[],y=[u],v=[];for(o=0;o<this.selectedRowCellIndexes.length;o++)for(a.push(this._currentJsonData[this.selectedRowCellIndexes[o].rowIndex]),f=0;f<this.selectedRowCellIndexes[o].cellIndex.length;f++)v.push(this.selectedRowCellIndexes[o].cellIndex[f]);if(s={currentCell:(r||u)==i?c:e.eq(r).find(".e-rowcell").eq(u),cellIndex:(r||u)==i?v:y,data:(r||u)==i?a:this._currentJsonData[r]},this.model.selectionType=="multiple"&&(s.isCtrlPressed=this.multiSelectCtrlRequest,s.isShiftPressed=this.multiSelectShiftRequest),this._trigger("cellDeselecting",s))return!0}if(t.isNullOrUndefined(r))this.model.scrollSettings.frozenColumns&&(e=n(e[0]).add(e[1])),e.find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-cellselectionbackground").removeClass("e-activecell"),this.selectedRowCellIndexes=[],this._rowIndexesColl=[];else{for(f=0;f<this.selectedRowCellIndexes.length;f++)if(this.selectedRowCellIndexes[f].rowIndex==r){l=n.inArray(u,this.selectedRowCellIndexes[f].cellIndex);this.model.scrollSettings.frozenColumns?this._frozenCell(r,u).removeClass("e-cellselectionbackground").removeClass("e-activecell"):e.eq(r).find(".e-rowcell").eq(u).removeClass("e-cellselectionbackground").removeClass("e-activecell");break}f!=this.selectedRowCellIndexes.length&&(this.selectedRowCellIndexes[f].cellIndex.splice(l,1),this.selectedRowCellIndexes[f].cellIndex.length==0&&(this.selectedRowCellIndexes.splice(f,1),this._rowIndexesColl.splice(n.inArray(r,this._rowIndexesColl),1)))}}if(h&&this._trigger("cellDeselected",s))return!0},clearColumnSelection:function(r){var s,h,e,c,l,u,o;if(this._allowcolumnSelection){var f=n(this._excludeDetailRows()),v=n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")),a=v.hasClass("e-columnselection");if(a){for(s=[],h=[],u=0;u<this.selectedColumnIndexes.length;u++)s.push(this.model.columns[this.selectedColumnIndexes[u]]),h.push(n(this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[this.selectedColumnIndexes[u]]));if(e={columnIndex:r==i?this.selectedColumnIndexes:r,headerCell:r==i?h:n(this.getHeaderTable().find(".e-columnheader").last().find("th.e-headercell").not(".e-detailheadercell")[r]),column:r==i?s:this.model.columns[r]},this.model.selectionType=="multiple"&&(e.isCtrlPressed=this.multiSelectCtrlRequest,e.isShiftPressed=this.multiSelectShiftRequest),this._trigger("columnDeselecting",e))return}if(t.isNullOrUndefined(r))f.find(".e-rowcell").removeClass("e-columnselection"),n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")).removeClass("e-columnselection"),this.selectedColumnIndexes=[];else{if(c=0,(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(++r,c=1),this.model.scrollSettings.frozenColumns)for(l=r,r>=this.model.scrollSettings.frozenColumns?(l=r-this.model.scrollSettings.frozenColumns,f=n(this.getContent).find(".e-movablecontent").find("tr")):f=n(this.getContent).find(".e-frozencontentdiv").find("tr"),u=0;u<f.length;u++)n(f[u].cells[l]).removeClass("e-columnselection");else for(o=0;o<f.length;o++)n(f[o].cells[r]).removeClass("e-columnselection");n(this.getHeaderTable().find("th.e-headercell:not(.e-stackedHeaderCell)")[r]).removeClass("e-columnselection");this.selectedColumnIndexes.splice(0,r-c)}}if(a&&this._trigger("columnDeselected",e))return!0},getSelectedRows:function(){for(var i=n(),t=0;t<this.selectedRowsIndexes.length;t++)this.model.scrollSettings.frozenColumns>0?(i.push(this.getRowByIndex(this.selectedRowsIndexes[t])[0]),i.push(this.getRowByIndex(this.selectedRowsIndexes[t])[1])):i.push(this.getRowByIndex(this.selectedRowsIndexes[t])[0]);return i},getSelectedRecords:function(){var i=[],t,r;if($gridRows=this.getRows(),this._virtualScrollingSelection)return this._virtualSelRecords;for(t=0;t<this.selectedRowsIndexes.length;t++)this.selectedRowsIndexes[t]!=-1&&(this.model.editSettings.editMode=="batch"&&n($gridRows[this.selectedRowsIndexes[t]]).hasClass("e-insertedrow")?(r=this.batchChanges.added.reverse(),i.push(r[this.selectedRowsIndexes[t]]),this.batchChanges.added.reverse()):this.model.scrollSettings.allowVirtualScrolling?i.push(this._virtualSelectedRecords[this.selectedRowsIndexes[t]]):this.model.editSettings.editMode=="batch"?i.push(this._currentJsonData[this.selectedRowsIndexes[t]-this.batchChanges.added.length]):i.push(this._currentJsonData[this.selectedRowsIndexes[t]]));return i},_setCurrentRow:function(n){(n==t.Grid.Actions.Refresh||n==t.Grid.Actions.Ungrouping||n==t.Grid.Actions.Grouping||n==t.Grid.Actions.Filtering||n==t.Grid.Actions.Sorting||n==t.Grid.Actions.Delete||n==t.Grid.Actions.Save||n==t.Grid.Actions.Paging||n==t.Grid.Actions.Search)&&(this._selectedRow(-1),this._selectedMultipleRows([]),this._virtualDataRefresh||(this.selectedRowsIndexes=[]))},_renderMultiTouchDialog:function(){var n,r,i;this._customPop=t.buildTag("div.e-gridpopup","",{display:"none"});n=t.buildTag("div.e-content");r=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSorting&&(i=t.buildTag("span.e-sortdirect e-icon"),n.append(i));this.model.selectionType==t.Grid.SelectionType.Multiple&&(i=t.buildTag("span.e-rowselect e-icon"),n.append(i));this._customPop.append(n);this._customPop.append(r);this.element.append(this._customPop)}}}(jQuery,Syncfusion),function(n,t,r){t.gridFeatures=t.gridFeatures||{};t.widget("ejGrid","ej.Grid",{_rootCSS:"e-grid",element:null,validTags:["div"],model:null,_requiresID:!0,keyConfigs:{focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",nextPage:"34",previousPage:"33",lastPage:"ctrl+alt+34",firstPage:"ctrl+alt+33",nextPager:"alt+34",previousPager:"alt+33",firstCellSelection:"36",lastCellSelection:"35",firstRowSelection:"ctrl+36",lastRowSelection:"ctrl+35",rowUpSelection:"ctrl+shift+38",rowDownSelection:"ctrl+shift+40",randomSelection:"ctrl+shift+83",upArrow:"38",downArrow:"40",rightArrow:"39",leftArrow:"37",moveCellRight:"9",moveCellLeft:"shift+9",selectedGroupExpand:"alt+40",totalGroupExpand:"ctrl+40",selectedGroupCollapse:"alt+38",totalGroupCollapse:"ctrl+38",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40"},_ignoreOnPersist:["actionBegin","actionComplete","actionFailure","batchAdd","batchDelete","beforeBatchSave","beforeBatchAdd","beforeBatchDelete","beginEdit","cellEdit","cellSave","cellSelecting","cellSelected","cellDeselecting","cellDeselected","columnDrag","columnDragStart","columnDrop","columnSelecting","columnSelected","columnDeselecting","columnDeselected","create","dataBound","destroy","detailsCollapse","detailsExpand","endAdd","endDelete","endEdit","recordClick","recordDoubleClick","load","resized","resizeEnd","resizeStart","rightClick","rowSelected","rowSelecting","rowDeselected","rowDeselecting","rowDrag","rowDragStart","rowDrop","templateRefresh","beforePrint","beforeRowDrop","query","isEdit","toolbarClick","queryCellInfo","mergeCellInfo","currentViewData","enableAltRow","enableRTL","contextClick","contextOpen","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","childGrid","summaryRows","toolbarSettings","editSettings","allowMultiSorting","enableAutoSaveOnSelectionChange","locale","allowCellMerging","allowTextWrap","textWrapSettings","cssClass","dataSource","groupSettings.enableDropAreaAutoSizing","enableRowHover","showSummary","allowGrouping","enableHeaderHover","allowKeyboardNavigation","scrollSettings.frozenRows","scrollSettings.frozenColumns","enableTouch","contextMenuSettings.enableContextMenu","exportToExcelAction","exportToWordAction","exportToPdfAction"],ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","rowDataBound","rowTemplate","detailsDataBound","detailsTemplate","editSettings","pageSettings","enableAutoSaveOnSelectionChange","localization","allowScrolling","cssClass","dataSource","groupSettings.enableDropAreaAnimation","enableRowHover","allowSummary","enableHeaderHover","allowKeyboardNavigation"],ignoreOnToolbarServerClick:[],observables:["dataSource","selectedRowIndex","pageSettings.currentPage","selectedRowIndices"],_tags:[{tag:"columns",attr:["allowEditing","allowFiltering","allowTextWrap","filterType","allowGrouping","allowResizing","allowSorting","cssClass","customAttributes","dataSource","defaultValue","disableHtmlEncode","editTemplate","editType","foreignKeyField","foreignKeyValue","headerTemplateID","headerText","isFrozen","isIdentity","isPrimaryKey","filterBarTemplate","textAlign","templateID","textAlign","headerTextAlign","tooltip","clipMode","validationRules.minlength","validationRules.maxlength","validationRules.range","validationRules.number","validationRules.required","editParams.decimalPlaces",[{tag:"commands",attr:["type","buttonOptions"]}]],content:"template"},{tag:"summaryRows",attr:["showCaptionSummary","showTotalSummary",[{tag:"summaryColumns",attr:["customSummaryValue","dataMember","displayColumn","summaryType","template"]}]]},{tag:"stackedHeaderRows",attr:[[{tag:"stackedHeaderColumns",attr:["headerText","column"]}]]},{tag:"filterSettings.filteredColumns",attr:[]},{tag:"sortSettings.sortedColumns",attr:[]}],_dataSource:t.util.valueFunction("dataSource"),_selectedRow:t.util.valueFunction("selectedRowIndex"),_selectedMultipleRows:t.util.valueFunction("selectedRowIndices"),_currentPage:t.util.valueFunction("pageSettings.currentPage"),defaults:{allowPaging:!1,showColumnChooser:!1,gridLines:"both",allowSorting:!1,showStackedHeader:!1,selectedRecords:[],stackedHeaderRows:[],allowFiltering:!1,allowMultipleExporting:!1,allowSelection:!0,allowGrouping:!1,showSummary:!1,allowResizing:!1,allowResizeToFit:!1,allowTextWrap:!1,allowCellMerging:!1,enableRowHover:!0,enablePersistence:!1,enableFocusout:!1,selectedRowIndex:-1,selectedRowIndices:[],allowSearching:!1,enableToolbarItems:!1,enableHeaderHover:!1,allowReordering:!1,allowKeyboardNavigation:!0,allowRowDragAndDrop:!1,enableTouch:!0,enableLoadOnDemand:!1,columnLayout:"auto",selectionType:"single",dataSource:null,cssClass:"",allowScrolling:!1,locale:"en-US",enableAutoSaveOnSelectionChange:!0,allowMultiSorting:!1,exportToExcelAction:"ExportToExcel",exportToWordAction:"ExportToWord",exportToPdfAction:"ExportToPdf",_groupingCollapsed:[],_checkSelectedRowsIndexes:[],editSettings:{allowEditing:!1,showAddNewRow:!1,allowAdding:!1,showAddNewRow:!1,allowDeleting:!1,editMode:"normal",rowPosition:"top",dialogEditorTemplateID:null,allowEditOnDblClick:!0,externalFormTemplateID:null,inlineFormTemplateID:null,formPosition:"bottomleft",titleColumn:null,showConfirmDialog:!0,showDeleteConfirmDialog:!1},selectionSettings:{selectionMode:["row"],enableToggle:!1,cellSelectionMode:"flow"},resizeSettings:{resizeMode:"normal"},pageSettings:{pageSize:12,pageCount:8,currentPage:1,totalPages:null,enableTemplates:!1,showDefaults:!1,template:null,totalRecordsCount:null,enableQueryString:!1,printMode:"allpages"},groupSettings:{showDropArea:!0,showToggleButton:!1,showGroupedColumn:!0,showUngroupButton:!0,enableDropAreaAutoSizing:!0,captionFormat:null,groupedColumns:[]},contextMenuSettings:{enableContextMenu:!1,contextMenuItems:["Add Record","Edit Record","Delete Record","Sort In Ascending Order","Sort In Descending Order","Next Page","Last Page","Previous Page","First Page","Save","Cancel","Grouping","Ungrouping"],customContextMenuItems:[],subContextMenu:[],disableDefaultItems:!1},filterSettings:{filterType:"filterbar",filterBarMode:"immediate",showFilterBarStatus:!0,statusBarWidth:450,showPredicate:!1,filteredColumns:[],enableInterDeterminateState:!0,maxFilterChoices:1e3,enableCaseSensitivity:!1,immediateModeDelay:1500,enableComplexBlankFilter:!0,blankValue:""},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},sortSettings:{sortedColumns:[]},toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},minWidth:0,currentIndex:0,rowDropSettings:{dropMapper:null,dragMapper:null,dropTargetID:null},scrollSettings:{width:"auto",height:0,enableTouchScroll:!0,allowVirtualScrolling:!1,virtualScrollMode:"normal",frozenRows:0,frozenColumns:0,buttonSize:18,autoHide:!1,scrollerSize:18,scrollOneStepBy:57,enableVirtualization:!1},textWrapSettings:{wrapMode:"both"},summaryRows:[],enableRTL:!1,enableAltRow:!0,currentViewData:null,detailsTemplate:null,childGrid:null,keySettings:null,rowTemplate:null,detailsDataBound:null,rowDataBound:null,queryCellInfo:null,mergeCellInfo:null,create:null,actionBegin:null,actionComplete:null,actionFailure:null,beginEdit:null,endEdit:null,endAdd:null,endDelete:null,beforeBatchAdd:null,beforeBatchSave:null,beforeBatchDelete:null,beforePrint:null,batchAdd:null,batchDelete:null,cellSave:null,cellEdit:null,resizeStart:null,resizeEnd:null,resized:null,load:null,destroy:null,rowSelecting:null,rowSelected:null,rowHover:null,rowDeselecting:null,rowDeselected:null,cellSelecting:null,cellSelected:null,cellDeselecting:null,cellDeselected:null,columnSelecting:null,columnSelected:null,columnDeselecting:null,columnDeselected:null,columnDragStart:null,columnDrag:null,columnDrop:null,rowDrag:null,rowDragStart:null,rowDrop:null,beforeRowDrop:null,dataBound:null,recordClick:null,recordDoubleClick:null,templateRefresh:null,rightClick:null,detailsCollapse:null,detailsExpand:null,toolbarClick:null,contextOpen:null,contextClick:null,columns:[],query:null,isEdit:!1,isResponsive:!1,enableResponsiveRow:!1,virtualLoading:null},dataTypes:{dataSource:"data",query:"data",columns:"array",childGrid:"parent",gridLines:"enum",summaryRows:"array",stackedHeaderRows:"array",toolbarSettings:{toolbarItems:"array",customToolbarItems:"array"},contextMenuSettings:{contextMenuItems:"array",customContextMenuItems:"array",subContextMenu:"array"},selectionSettings:{selectionMode:"array",selectedRecords:"array"},sortSettings:{sortedColumns:"array"},filterSettings:{filteredColumns:"array",filterType:"enum",filterBarMode:"enum"},groupSettings:{groupedColumns:"array"},editSettings:{editMode:"enum",formPosition:"enum",rowPosition:"enum"},searchSettings:{fields:"array"},textWrapSettings:{wrapMode:"enum"}},_columns:function(){var n=this.element.find(".e-gridheader");n.find("div").first().empty().append(this._renderGridHeader().find("table"));this._headerCellgDragDrop();this.refreshContent(!0);this._trigger("refresh")},_summaryRows:function(n,i,r){if(i=="showTotalSummary"||i=="showCaptionSummary"){var u=n.summaryRows,f=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;this.option("summaryRows")[u][i]=f}this.element.find(".e-gridfooter").remove();this._renderGridFooter().insertAfter(this.getContent());(i=="showCaptionSummary"||i=="title")&&(this._isCaptionSummary=this.option("summaryRows")[u].showCaptionSummary,this.model.showSummary=this._isCaptionSummary,this.model.groupSettings.groupedColumns.length!=0&&this._refreshCaptionSummary())},_summaryRows_summaryColumns:function(n,i,r){(i=="displayColumn"||i=="dataMember")&&t.isNullOrUndefined(this.getColumnByField(r))||(this._createSummaryRows(this.getFooterTable()),this.element.find(".e-groupcaptionsummary").length!=0&&this._refreshCaptionSummary())},_stackedHeaderRows_stackedHeaderColumns:function(){this._refreshStackedHeader()},_sortSettings_sortedColumns:function(n,t,i){var u,f,r=this.model.sortSettings.sortedColumns[n["sortSettings.sortedColumns"]];t=="field"?(u=this.getColumnByField(i)!=null?i:null,f=r.direction=="ascending"||r.direction=="descending"?r.direction:null):t=="direction"&&(u=this.getColumnByField(r.field)!=null?r.field:null,f=i=="ascending"||i=="descending"?i:null);u!=null&&f!=null&&this.sortColumn(u,f)},_filterSettings_filteredColumns:function(n,i,r){var f,e,o,s,h,u=this.model.filterSettings.filteredColumns[n["filterSettings.filteredColumns"]];switch(i){case"field":f=this.getColumnByField(r)!=null?r:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"matchcase":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=r.toLowerCase()=="true"||r.toLowerCase()=="false"?t.parseJSON(r):!1;break;case"operator":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,r);h=u.value;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase;break;case"predicate":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=u.value;s=r=="and"||r=="or"?r:null;o=u.matchcase;break;case"value":f=this.getColumnByField(u.field)!=null?u.field:null;e=this._map(t.FilterOperators,u.operator);h=r;s=u.predicate=="and"||u.predicate=="or"?u.predicate:null;o=u.matchcase}f!=null&&e!=null&&h!=null&&s!=null&&o!=null&&this.filterColumn(f,e,h,s,o)},_map:function(t,i){var r=n.map(t,function(n){if(n===i)return n});return r.length!=0?r[0]:null},_refreshCaptionSummary:function(){var t=document.createElement("div");t.innerHTML=["<table>",n.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),"<\/table>"].join("");this.getContentTable().get(0).replaceChild(t.firstChild.firstChild,this.getContentTable().get(0).lastChild);this.refreshContent()},getContentTable:function(){return this._gridContentTable},setGridContentTable:function(n){this._gridContentTable=n},getContent:function(){return this._gridContent},setGridContent:function(n){this._gridContent=n},getHeaderContent:function(){return this._gridHeaderContent},setGridHeaderContent:function(n){this._gridHeaderContent=n},getHeaderTable:function(){return this._gridHeaderTable},setGridHeaderTable:function(n){this._gridHeaderTable=n},getRows:function(){return this._gridRows},getFilteredRecords:function(){return this._filteredRecords},getRowByIndex:function(i,r){var e;try{var f=this.getRows(),o=this._excludeDetailRows(),u=n();if(n.isArray(i)){for(e=0;e<i.length;e++)this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i[e]]),u.push(f[1][i[e]])):u.push(f[i[e]]);return u}return t.isNullOrUndefined(r)?this.model.scrollSettings.frozenColumns>0?(u.push(f[0][i]),u.push(f[1][i]),u):n(o.not(".e-virtualrow")[i]):this.model.scrollSettings.frozenColumns>0?(u.push(n(f[0]).slice(i,r)),u.push(n(f[1]).slice(i,r)),u):n(o.not(".e-virtualrow").slice(i,r))}catch(s){return n()}},getColumnIndexByField:function(n){for(var t=0,i=this.model.columns,r=i.length;t<r;t++)if(i[t].field===n)return t;return-1},getColumnIndexByHeaderText:function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r},getIndexByRow:function(t){var r=this.getRows(),u=this._excludeDetailRows(),i;return this.model.scrollSettings.frozenColumns>0?(i=n(r[0]).index(t),i==-1&&(i=n(r[1]).index(t)),i):u.not(".e-virtualrow").index(t)},getPrimaryKeyFieldNames:function(){if(this._primaryKeys.length!=0)return this._primaryKeys;for(var n=0,t=this.model.columns,i=t.length;n<i;n++)t[n].isPrimaryKey&&this._primaryKeys.push(t[n].field);return this._primaryKeys},getVisibleColumnNames:function(){return this._visibleColumns},getHiddenColumnNames:function(){return this._hiddenColumns},getColumnByField:function(n){for(var t=0;t<this.model.columns.length;t++)if(this.model.columns[t].field==n)break;return t==this.model.columns.length?null:this.model.columns[t]},getsortColumnByField:function(n){for(var t=0;t<this.model.sortSettings.sortedColumns.length;t++)if(this.model.sortSettings.sortedColumns[t].field==n)break;return t==this.model.sortSettings.sortedColumns.length?null:this.model.sortSettings.sortedColumns[t]},getColumnByHeaderText:function(n,i){for(var r=0;r<this.model.columns.length;r++)if(this.model.columns[r].headerText==n)if(i){if(t.isNullOrUndefined(this.model.columns[r].field)||this.model.columns[r].field=="")break}else break;return r==this.model.columns.length?null:this.model.columns[r]},getCurrentViewData:function(){return this._currentJsonData},getColumnFieldNames:function(){for(var t=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].field&&t.push(this.model.columns[n].field);return t},getBrowserDetails:function(){var t=navigator.userAgent.match(/(firefox|chrome|opera|msie|safari)\s?\/?(\d+(.\d+)*)/i);return!!navigator.userAgent.match(/Trident\/7\./)||!!navigator.userAgent.match(/Edge/)?{browser:"msie",version:n.uaMatch(navigator.userAgent).version}:{browser:t[1].toLowerCase(),version:t[2]}},_initPrivateProperties:function(){this._showInColumnchooserCol=[];this._currentVirtualRowIndex=0;this._click=0;this._gridPhoneMode=320;this._columntemplaterefresh=!1;this._tabKey=!1;this._gridHeaderTable=null;this._gridWidth=this.element.width();this._id=this.element.attr("id");this._gridRows=[];this._fltrBarcell=!1;this._unboundRow=null;this._gridContentTable=null;this._gridContent=null;this._remoteSummaryData=null;this._gridSort=null;this._gridHeaderContent=null;this._gridFooterContent=null;this._gridFooterTable=null;this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0;this._links=null;this._gridPager=null;this._cSortedColumn=null;this._cSortedDirection=null;this._$curSElementTarget=null;this._gridFilterBar=null;this._$curFieldName=null;this._$prevFieldName=null;this._editedData={};this._isEditChangesApplied=!1;this._mediaStatus=!1;this._$fDlgIsOpen=!1;this._$menuDlgIsOpen=!1;this._$colType=null;this._$colFormat=null;this._$prevColType=null;this._$prevSElementTarget=null;this._currentFilterColumn=null;this._filteredRecordsCount=null;this._filteredRecords=[];this._validatedColumns=[];this.filterColumnCollection=[];this._previousFilterCount=null;this._excelFilter=null;this._isExcelFilter=this.model.filterSettings.filterType=="excel";this._$fkColumn=!1;this._fkParentTblData=[];this._primaryKeys=[];this._identityKeys=[];this._primaryKeyValues=[];this._modifiedRecords=[];this._addedRecords=[];this._tdsOffsetWidth=[];this._deletedRecords=[];this._disabledToolItems=n();this._validationRules={};this._groupedColumns=[];this._LastColumnUnGroup=!1;this._scolumns=[];this._currentJsonData=[];this._groupingColumnIndex=0;this._dataManager=this._dataSource()instanceof t.DataManager?this._dataSource():this._dataSource()!=null?t.DataManager(this._dataSource()):null;this._dataManager!=null&&this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.totalRecordsCount!=null&&this._dataManager.dataSource.json!=null&&this._dataManager.dataSource.json.splice(this.model.pageSettings.totalRecordsCount);this._isRemoteSaveAdaptor=this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.remoteSaveAdaptor;this._isLocalData=!0;this._disabledResizingColumns=[];this._disabledSortableColumns=[];this._disabledGroupableColumns=[];this._disabledFilterableColumns=[];this._disabledEditableColumns=[];this._hiddenColumns=[];this._visibleColumns=[];this._visibleColumnsField=[];this._hiddenColumnsField=[];this._ccVisibleColumns=[];this._ccHiddenColumns=[];this._sortedColumns=[];this.multiSortRequest=!1;this.multiSelectCtrlRequest=!1;this.multiSelectShiftRequest=!1;this._enableSelectMultiTouch=!1;this._enableSortMultiTouch=!1;this._templateRefresh=!1;this.initialRender=!1;this._selectDrag=!1;this._isAddNew=!1;this._fieldColumnNames={};this._headerColumnNames={};this._virtualLoadedRecords={};this._virtualLoadedRows={};this._virtualPageRecords={};this._virtaulSel=[];this._dragUpInterval=null;this._dragDownInterval=null;this._queryCellView=[];this._currentPageViews=[];this._virtualLoadedPages=[];this._currentLoadedIndexes=[];this._prevVirtualSort=[];this._prevVirtualFilter=[];this._prevVirtualIndex=0;this._currentVirtualIndex=1;this._virtualRowCount=0;this._virtualSelectedRecords={};this._selectionByGrid=!1;this._enableCheckSelect=!1;this.checkSelectedRowsIndexes=[];this._isMapSelection=!1;this._selectionMapColumn=null;this._selectAllCheck=!1;this.selectedRowsIndexes=[];this._isReorder=!1;this._searchString="";this._searchCount=null;this.columnsWidthCollection=[];this._Indicator=null;this._resizer=null;this._bulkEditCellDetails={cellValue:null,rowIndex:-1,columnIndex:-1,fieldName:null,_data:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],rowData:null};this.batchChanges={added:[],deleted:[],changed:[]};this._bulkEditTemplate=n();this._confirmDialog=null;this._confirmedValue=!1;this._lastRow=!1;this._isVirtualRecordsLoaded=!1;this._scrollValue=0;this._currentTopFrozenRow=this.model.scrollSettings.frozenRows;this._rowHeightCollection=[];this._scrollObject=null;this._customPop=null;this.selectedRowCellIndexes=[];this._rowIndexesColl=[];this.selectedColumnIndexes=[];this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1;this.commonQuery=this.model.query.clone();t.gridFeatures.group&&(this._rowCol=this._captionSummary(),this._isCaptionSummary=(this._rowCol!=null&&this._rowCol.length)>0?!0:!1);this.phoneMode=this.model.isResponsive&&document.documentElement.clientWidth<360?!0:!1;this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();this._mediaQuery=!1;this._columnChooserList=null;this._$headerCols=null;this._$contentCols=null;this._detailsOuterWidth=null;this._editForm=null;this._cloneQuery=null;this.localizedLabels=this._getLocalizedLabels();this._searchBar=null;this._relationalColumns=[];this._dropDownManager={};this._isUngrouping=!1;this._columnChooser=!1;this._showHideColumns=!1;this._vCurrentTrIndex=null;this._lastVirtualPage=null;this._currentVIndex=null;(!this.model.enablePersistence||t.isNullOrUndefined(this._isHeightResponsive))&&(this._isHeightResponsive=!1);this._resize=!1;this._initHeight=0;this._initDataProcessed=!1;this._menuColTypes=[];this._excelColTypes=[]},_init:function(){var i,n,u;this._trigger("load");!t.isNullOrUndefined(this.model.query)&&this.model.query instanceof t.Query||(this.model.query=t.Query());t.isNullOrUndefined(this.model.parentDetails)||(i=this.model.queryString,n=this.model.foreignKeyField,this.model.query=this.model.query.clone(),u=this.model.parentDetails.parentKeyFieldValue===r?"undefined":this.model.parentDetails.parentKeyFieldValue,this.model.query.where(t.isNullOrUndefined(n)?i:n,"equal",u,!0));this._initPrivateProperties();t.gridFeatures.common&&this._initScrolling();this.model.enableResponsiveRow&&this.element.addClass("e-responsive");this._checkForeignKeyBinding();this._checkDataBinding()},_initComplexColumn:function(n,i,r){var e=r||i,u,o,f;for(u in n)typeof n[u]!="object"||t.isNullOrUndefined(n[u])?(o=e.concat(".").concat(u),f=n[u],this.model.columns.push({field:o,type:f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null})):(e=e.concat(".").concat(u),this._initComplexColumn(n[u],u,e))},_initColumns:function(i){for(var e,o,u,f,s;i.items!=r;)i=i.items[0];if(this.model.columns.length==0&&i){for(e in i)i.hasOwnProperty(e)&&(typeof i[e]!="object"||i[e]instanceof Date||i[e]==null)?(o=i[e],this.model.columns.push({field:e,type:o!=null?o.getDay?o.getHours()>0||o.getMinutes()>0||o.getSeconds()>0||o.getMilliseconds()>0?"datetime":"date":typeof o:null})):typeof i[e]=="object"&&this._initComplexColumn(i[e],e);this.model.columns.length&&this._renderAfterColumnInitialize()}else for(u=0;u<this.model.columns.length;u++)this.model.columns[u].field=t.isNullOrUndefined(this.model.columns[u].field)?"":this.model.columns[u].field,t.isNullOrUndefined(this.model.columns[u].validationRules)||this._validatedColumns.push(this.model.columns[u].field),t.isNullOrUndefined(this.model.columns[u].type)?(f=t.isNullOrUndefined(this.model.columns[u].field)?null:t.getObject(this.model.columns[u].field,i),s=this.model.columns[u].dataSource,!!s&&this.model.columns[u].foreignKeyValue&&(this.model.columns[u].originalType=f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null,f=(s instanceof t.DataManager)?t.getObject("0."+this.model.columns[u].foreignKeyValue,this.model.columns[u].foreignKeyData):t.getObject("0."+this.model.columns[u].foreignKeyValue,s)),this.model.columns[u].type=f!=null?f.getDay?f.getHours()>0||f.getMinutes()>0||f.getSeconds()>0||f.getMilliseconds()>0?"datetime":"date":typeof f:null):this.model.columns[u].type=="date"&&this.model.columns[u].format==r&&this._isReorder!=!0&&this.initialRender&&!this._showHideColumns?n.extend(this.model.columns[u],{format:"{0:"+t.preferredCulture(this.model.locale).calendars.standard.patterns.d+"}"}):this.model.columns[u].type=="datetime"&&this.model.columns[u].format==r&&this._isReorder!=!0&&this.initialRender&&!this._showHideColumns&&n.extend(this.model.columns[u],{format:"{0:"+t.preferredCulture(this.model.locale).calendars.standard.patterns.d+" "+t.preferredCulture(this.model.locale).calendars.standard.patterns.t+"}"})},_initSelection:function(){var n=this.model.selectionSettings.selectionMode;for(i=0;i<n.length;i++)this["_allow"+n[i]+"Selection"]=!0},_checkDataBinding:function(){var o,i,f,u,e;if(!this.model.columns.length&&((this._dataSource()==null||!this._dataSource().length)&&!(this._dataSource()instanceof t.DataManager)||this._dataSource()instanceof t.DataManager&&this._dataManager.dataSource.url==r&&!this._dataSource().dataSource.json.length)){this._renderAlertDialog();this._alertDialog.find(".e-content").text(this.localizedLabels.EmptyDataSource);this._alertDialog.ejDialog("open");return}if(this._initialRenderings(),this.model.editSettings.allowDeleting&&this.model.selectionType=="multiple"&&(this.multiDeleteMode=!0),this.initialRender=!0,this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.allowFiltering&&this._isExcelFilter&&this._renderExcelFilter(),this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),this.model.allowGrouping&&this.element.append(this._renderGroupDropArea()),(this.model.toolbarSettings.showToolbar||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&(this.element.append(this._renderToolBar()),t.browserInfo().name=="msie"&&t.browserInfo().version<10&&n.inArray("search",this.model.toolbarSettings.toolbarItems)!=-1&&(o=this.element.find(".e-toolbar.e-toolbarspan .e-gridsearchbar"),t.ieClearRemover(o[0]))),i=this.model.columns,i&&i.length){if(f=this.model.query._expands,typeof i[0]=="string")for(u=0;u<i.length;u++)i[u]={field:i[u]};for(u=0;u<i.length;u++)i[u].field&&i[u].field.indexOf(".")!==-1&&this._getExpands(i[u].field,f);this.model.query.expand(f);this.commonQuery.expand(f);this._renderAfterColumnInitialize()}this.model.allowPaging&&(this.element.append(this._renderGridPager()),this.model.pageSettings.isResponsive&&n(this.element.find(".e-pager")).ejPager("instance")._reSizeHandler());this.model.contextMenuSettings.enableContextMenu&&this.element.append(this._renderContext());n.isFunction(n.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),n("#"+this._id+"_WaitingPopup").addClass("e-gridwaitingpopup"));this.model.scrollSettings.allowVirtualScrolling&&(this._loadedJsonData=[],this._prevPage=1);this._dataSource()instanceof t.DataManager?(this.element.ejWaitingPopup("show"),this._dataSource().ready!=r?(e=this,this._dataSource().ready.done(function(n){e._initDataSource();e.model.dataSource=t.DataManager(n.result)})):(this.element.ejWaitingPopup("show"),this._initDataSource())):(this._ensureDataSource(),this._trigger("actionBegin"),this._setForeignKeyData(),this._relationalColumns.length==0&&this._initGridRender(),this._vRowHeight=Math.floor(this.getRowHeight()))},_renderColumnChooser:function(){var u=t.buildTag("button .e-ccButton",this.localizedLabels.Columns,{float:this.model.enableRTL?"left":"right"}).attr("type","button"),e,l,y,i,o,s,h,a,f,c,v;this.element.prepend(u);u.ejButton({prefixIcon:"e-icon e-down-arrow",imagePosition:"imageright",contentType:"textandimage",type:"button",click:n.proxy(this._ccClickHandler,this),width:90});e=u.outerHeight();u.css("margin-top",0-e);l=parseInt(this.element.css("margin-top"),10);this.element.css("margin-top",l+e);y=t.buildTag("div");i=t.buildTag("div .e-grid e-columnChooser","",{},{id:this._id+"ccDiv"});n("#"+this._id+"ccDiv").data("ejDialog")!=r&&(n("#"+this._id+"ccDiv").ejDialog("destroy"),n("#"+this._id+"ccDiv").remove());o=t.buildTag("div.e-searchbox e-fields").append(t.buildTag("input#"+this._id+"_ccSearchBox.e-ejinputtext e-filtertext",{},{},{type:"text"}));s=t.buildTag("span .e-searchfind e-icon");o.append(s);h=t.buildTag("div","",{height:"228px"},{id:this._id+"liScrollerDiv"});this._renderColumnChooserData(!1);h.append(this._columnChooserList);i.append(o);i.append(h);a=t.buildTag("div .e-columnChooserSplitter","",{"border-bottom":"0px"});i.append(a);this.model.enableRTL?($buttonDiv=t.buildTag("div .e-ccBtndiv","",{float:"left","margin-top":"7px","margin-right":"-13px"}),f=t.buildTag("button .e-ccformbtn e-btncan e-flat",this.localizedLabels.Cancel,{"margin-right":"7px","margin-left":"9px"}),n(s).addClass("e-rtl")):($buttonDiv=t.buildTag("div .e-ccBtndiv","",{float:"right","margin-top":"7px"}),f=t.buildTag("button .e-ccformbtn e-btncan e-flat",this.localizedLabels.Cancel,{"margin-right":"7px","margin-left":"6px"}));c=t.buildTag("button .e-ccformbtn e-btnsub e-flat",this.localizedLabels.Done);$buttonDiv.append(c);$buttonDiv.append(f);i.append($buttonDiv);c.ejButton({click:n.proxy(this._addButtonCC,this),showRoundedCorner:!0,width:66});f.ejButton({click:n.proxy(this._cancelButtonHandler,this),showRoundedCorner:!0,width:66});i.insertBefore(this.element);i.ejDialog({width:"auto",beforeClose:n.proxy(this._columnChooserBeforeClose,this),showOnInit:!1,allowKeyboardNavigation:!1,enableResize:!1,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showHeader:!1,width:260});t.browserInfo().name=="msie"&&t.browserInfo().version<10&&(v=n(".e-columnChooser").find("input#"+this._id+"_ccSearchBox")[0],t.ieClearRemover(v))},_renderColumnChooserData:function(i){var w=this.model.columns.length==this.getVisibleColumnNames().length,o,c,e,f,l,y,p;for(this._ccCheckBoxList=[],o=t.buildTag("div","",{"margin-left":"0px",width:"250px"}),c=0,e=-1;e<this.model.columns.length;e++)if(f=e==-1,f||this.model.columns[e].showInColumnChooser){var u=this.model.columns[e],s=f?this.localizedLabels.SelectAll:t.isNullOrUndefined(u.headerText)||u.headerText==""?u.field==""?null:u.field:u.headerText,b=u&&u.disableHtmlEncode?this._htmlEscape(s):s;if(!t.isNullOrUndefined(s)||f){var a=t.buildTag("div","",{},{"class":"e-columnChooserListDiv"}),h=f?this._id+"selectAll":this._id+s.replace(/\s|\.|[^a-zA-Z0-9]| /g,"_"),v=o.find("#"+h).length;v&&c++;l=t.buildTag("input","",{},{id:v?h+c+"":h,value:s,type:"checkbox","ej-field":f?"":u.field,"ej-headertext":f?"":u.headerText,"class":f?"e-selectall":""});y=t.buildTag("label",b,{"font-size":"13px"},{"for":v?h+c+"":h});a.append(l);a.append(y);o.append(a);p=!f&&!t.isNullOrUndefined(u.visible)?u.visible:!0;l.ejCheckBox({checked:f?w:p,change:n.proxy(this._columnChooserCheckChange,this)});f||t.isNullOrUndefined(u.visible)||l[u.visible?"attr":"removeAttr"]("checked",!0)}}else this.model.columns[e].showInColumnChooser!=r&&this._showInColumnchooserCol.push(this.model.columns[e]);i?(this._columnChooserList.empty().append(o.children()),n("#"+this._id+"liScrollerDiv").is(":visible")&&n("#"+this._id+"liScrollerDiv").ejScroller("refresh")):this._columnChooserList=o;this._ccCheckBoxList=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall")},_checkFinder:function(){var t=n(this),i=t.closest(".e-columnChooserListDiv");if(t.hasClass("e-checkbox")&&!i.hasClass("e-hide")&&t.prop("checked"))return!0},_displayFinder:function(){return!n(this).closest(".e-columnChooserListDiv").hasClass("e-hide")},_columnChooserCheckChange:function(t){var e;if(!t.isInteraction){t.isChecked&&n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']").removeClass("e-disable");return}var i=t.isChecked,r=this._ccCheckBoxList.filter(this._displayFinder),u=this._ccCheckBoxList.filter(this._checkFinder),o=r.length,f=u.length;t.model.id==this._id+"selectAll"?i?r.not(":checked").ejCheckBox({checked:i}):u.ejCheckBox({checked:i}):(this._columnChooserList.find("input.e-selectall").ejCheckBox("model.checked",o==f),i=f!=0,this.element[i?"attr":"removeAttr"]("checked",!0));e=i?"removeClass":"addClass";n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']")[e]("e-disable")},_columnChooserBeforeClose:function(){n(".e-columnChoosertail").remove();n(".e-columnChoosertailAlt").remove();n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']").removeClass("e-disable");n("#"+this._id+"_ccSearchBox").val("");var t={};t.target={};t.target.value="";this._columnChooserSearch(t)},_columnChooserSearch:function(r){var u,f,c,o,l,v;r.type=="click"&&(r.target.value="",n("#"+this._id+"_ccSearchBox").val(""));u=r.target.value;f=n("#"+this._id+"_ccSearchBox").next("span");u!=""?(f.removeClass("e-searchfind"),f.addClass("e-cancel")):(f.removeClass("e-cancel"),f.addClass("e-searchfind"));n(".e-cancel").on("click",n.proxy(this._columnChooserSearch,this));var s=this.model.columns,e=[],h=[],a=[],p=this,w=function(t){var i=p.model.groupSettings;return!i.showGroupedColumn&&n.inArray(t,i.groupedColumns)>-1};for(u!=""&&(s=t.DataManager(this.model.columns).executeLocal(t.Query().where("headerText",t.FilterOperators.startsWith,u,!0)),a=t.DataManager(this.model.columns).executeLocal(t.Query().where("field",t.FilterOperators.startsWith,u,!0)),a.forEach(function(t){t.headerText==""&&n.inArray(t,s)==-1&&s.push(t)})),s.forEach(function(n){if(n.showInColumnChooser&&!w(n.field)){var i=t.isNullOrUndefined(n.headerText)||n.headerText==""?n.field==""?null:n.field:n.headerText;e.push(i)}}),t.isNullOrUndefined(n("#nomatches")[0])||n("#nomatches").remove(),c=this._columnChooserList.find(".e-columnChooserListDiv"),i=0;i<this.model.columns.length;i++)this.model.columns[i].showInColumnChooser&&!t.isNullOrUndefined(this.model.columns[i].headerText)&&(this.model.columns[i].headerText!=""?h.push(this.model.columns[i].headerText):this.model.columns[i].field!=""&&h.push(this.model.columns[i].field));for(o=0;o<h.length;o++)l=h[o],v=e.indexOf(l),t.isNullOrUndefined(l)||c.eq(o+1)[v==-1?"addClass":"removeClass"]("e-hide");e.length==0&&this._emptyColumnChooserData();var b=this._ccCheckBoxList.filter(this._displayFinder).length,y=this._ccCheckBoxList.filter(this._checkFinder).length,k=y==b;e.length&&c.eq(0).find("input.e-js").ejCheckBox({checked:k});c.eq(0)[e.length==0?"addClass":"removeClass"]("e-hide");n("#"+this._id+"ccDiv").find("button[aria-describedby = '"+this.localizedLabels.Done+"']")[y?"removeClass":"addClass"]("e-disable");n("#"+this._id+"liScrollerDiv").ejScroller("refresh")},_addButtonCC:function(){var i,r,t,u;for(this._visibleColumns=[],this._hiddenColumns=[],this._visibleColumnsField=[],this._hiddenColumnsField=[],this._columnChooserClick=!0,i={},i.requestType="columnchooser",this._columnChooser=!0,r=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall"),t=0,u=r.length;t<u;t++){var o=n(r[t]),s=o.attr("ej-headertext"),f=o.attr("ej-field");this._id+"selectAll"!=o.attr("id")&&(this[r[t].checked?"_visibleColumns":"_hiddenColumns"].push(s),this[r[t].checked?"_visibleColumnsField":"_hiddenColumnsField"].push(f!=""?f:s))}for(t=0,u=this._showInColumnchooserCol.length;t<u;t++){var e=this._showInColumnchooserCol[t],h=e.headerText,f=e.field;this[e.visible?"_visibleColumns":"_hiddenColumns"].push(h);this[e.visible?"_visibleColumnsField":"_hiddenColumnsField"].push(f!=""?f:h)}var a=this._visibleColumns,v=this._hiddenColumns,c,l;c=n.merge(n.merge([],a),v);l=this._isDuplicate(c);this._trigger("actionBegin",i);l?(this.showColumns(this._visibleColumnsField),this.hideColumns(this._hiddenColumnsField)):(this.showColumns(this._visibleColumns),this.hideColumns(this._hiddenColumns));n("#"+this._id+"ccDiv").ejDialog("close");n(".e-columnChoosertail").remove();this.refreshScrollerEvent();i={requestType:"columnchooser",removedcolumns:[],addedcolumns:[],visiblecolumns:this.getVisibleColumnNames(),hiddencolumns:this.getHiddenColumnNames()};this._ccColumnUpdate(i.addedcolumns,this.getVisibleColumnNames(),this._ccVisibleColumns);this._ccColumnUpdate(i.removedcolumns,this.getHiddenColumnNames(),this._ccHiddenColumns);this._trigger("actionComplete",i);this._columnChooser=!1},_ccColumnUpdate:function(t,r,u){for(i=0;i<r.length;i++)n.inArray(r[i],u)==-1&&t.push(r[i])},_isDuplicate:function(n){for(var t,i=[],r=0;r<n.length;r++)t=n[r],i[t]=i[t]>=1?i[t]+1:1;for(t in i)if(i[t]>1)return!0;return!1},_cancelButtonHandler:function(){n("#"+this._id+"ccDiv").ejDialog("close");n(".e-columnChoosertailAlt").remove();n(".e-columnChoosertail").remove()},_ccClickHandler:function(){var f=230,i,r=this.element.find(".e-ccButton"),u;if(i=r.offset().left+r.width(),u=n("#"+this._id+"ccDiv").data("ejDialog"),u&&u.isOpened())u.close(),n(".e-columnChoosertail").remove(),n(".e-columnChoosertailAlt").remove();else{n("#"+this._id+"ccDiv").ejDialog({width:"230px",height:"310px",position:{X:this.model.enableRTL?i-f+143:i-f,Y:r.offset().top+35}}).ejDialog("open");var e=parseInt(n("#"+this._id+"ccDiv_wrapper").css("z-index")),o=t.buildTag("div #"+this._id+"_ccTail .e-columnChoosertail","",{display:"block",position:"absolute",left:this.model.enableRTL?i-78:i-29,top:r.offset().top+15}),s=t.buildTag("div #"+this._id+"_ccTailAlt .e-columnChoosertailAlt","",{display:"block","z-index":e+2,position:"absolute",left:this.model.enableRTL?i-78:i-29,top:r.offset().top+16});o.insertBefore(n("#"+this._id+"ccDiv_wrapper"));s.insertBefore(n("#"+this._id+"ccDiv_wrapper"))}this._refreshColumnChooserList();this._ccVisibleColumns=this.getVisibleColumnNames();this._ccHiddenColumns=this.getHiddenColumnNames();n("#"+this._id+"liScrollerDiv").ejScroller({height:"228",width:"228",buttonSize:0});n("#"+this._id+"liScrollerDiv").ejScroller("refresh");t.isIOSWebView()||this.getBrowserDetails().browser!="chrome"||n(".e-columnChooser .e-hscrollbar").attr("style","height: 10px !important;");n(".e-ejinputtext").on("keyup",n.proxy(this._columnChooserSearch,this))},_refreshColumnChooserList:function(){for(var c,l,a,i=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall"),s=this._isDuplicate(n.merge(n.merge([],this._visibleColumns),this._hiddenColumns)),u=0,v=i.length;u<v;u++){var f=n(i[u]),e=f.attr("ej-headertext"),h=f.attr("ej-field"),o=r,y=i.filter("[ej-headertext='"+e+"']").length;this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&n.inArray(n(i[u]).attr("ej-field"),this.model.groupSettings.groupedColumns)!=-1?(n(i[u]).parents(".e-columnChooserListDiv").addClass("e-hide"),i[u].checked=!1,this._columnChooserList.find(".e-columnChooserListDiv").eq(0).hasClass("e-hide")&&this.model.columns.length>this.model.groupSettings.groupedColumns.length&&this._columnChooserList.find(".e-columnChooserListDiv").eq(0).removeClass("e-hide")):(n(i[u]).parents(".e-columnChooserListDiv").removeClass("e-hide"),i[u].checked=!0);c=s?h==""?e:h:e;o=this[s?"_hiddenColumnsField":"_hiddenColumns"].indexOf(c)!=-1;f.prop("checked",!o);f.ejCheckBox("model.checked",!o)}l=i.filter(this._displayFinder).length==i.filter(this._checkFinder).length&&i.filter(this._displayFinder).length?!0:!1;this._columnChooserList.find("input:checkbox.e-selectall").ejCheckBox({checked:l});this.model.groupSettings.showGroupedColumn||(t.isNullOrUndefined(n("#nomatches")[0])||n("#nomatches").remove(),this.model.columns.length==this.model.groupSettings.groupedColumns.length&&(this._columnChooserList.find(".e-columnChooserListDiv").eq(0).addClass("e-hide"),this._emptyColumnChooserData()),a=i.filter(this._displayFinder).length>0?!0:!1,n("#"+this._id+"ccDiv").find("button[aria-describedby='Done']").ejButton({enabled:a}))},_emptyColumnChooserData:function(){var i=t.buildTag("div#nomatches","",{"padding-left":"13px"}),r=n("#"+this._id+"ccDiv").find("#"+this._id+"liScrollerDiv"),u=t.buildTag("span",this.localizedLabels.NoResult);i.append(u);n(r).append(i)},_initDataSource:function(){var i,n;this._isLocalData=!(this._dataSource()instanceof t.DataManager)||this._dataSource().dataSource.offline||this._isRemoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor;this._dataSource().adaptor instanceof t.SqlDataSourceAdaptor&&(this._isLocalData=!1);this._ensureDataSource();this._trigger("actionBegin");i=this._dataSource().executeQuery(this.model.query);n=this;this._dataManager.dataSource.table!=null&&this._dataManager.dataSource.table.css("display","none");this.element.is(":visible")||this.element.ejWaitingPopup("hide");i.done(t.proxy(function(n){this._initDataProcessed||(this._initDataProcess(n),this._initDataProcessed=!0)},this));n=this;i.fail(function(i){if(!t.isNullOrUndefined(n.element)){n.element.ejWaitingPopup("hide");n.model.currentViewData=[];n._gridRecordsCount=0;n._renderGridContent().insertAfter(n.element.children(".e-gridheader"));var r={error:i.error};n._trigger("actionFailure",r)}})},_initDataProcess:function(i,r){var f,u,e;if(!t.isNullOrUndefined(this.element)){if(this._relationalColumns.length==0&&this.element.ejWaitingPopup("hide"),!this.model.columns.length&&!i.count){f=i.count%this.model.pageSettings.pageSize==0?i.count/this.model.pageSettings.pageSize:parseInt(i.count/this.model.pageSettings.pageSize,10)+1;this._currentPage()>f&&this._currentPage(f);this._renderAlertDialog();this._alertDialog.find(".e-content").text(this.localizedLabels.EmptyDataSource);this._alertDialog.ejDialog("open");this.element.ejWaitingPopup("hide");return}if(t.isNullOrUndefined(i.aggregates)||(this._remoteSummaryData=i.aggregates),this.model.scrollSettings.enableVirtualization||(this.model.currentViewData=i.result),this._$fkColumn&&this.model.filterSettings.filteredColumns.length>0&&this.model.filterSettings.filterType=="excel"&&(this._fkParentTblData=i.result),this._gridRecordsCount=this.model.enablePersistence||this.model.pageSettings.totalRecordsCount==null||this.model.filterSettings.filteredColumns.length!=0?i.count==0&&i.result.length?i.result.length:i.count:this.model.pageSettings.totalRecordsCount,this.model.filterSettings.filteredColumns.length>0&&(this._filteredRecordsCount=i.count),this.getPager()!=null&&(this.model.pageSettings.totalRecordsCount=this._gridRecordsCount),this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization)if(this._refreshVirtualViewDetails(),this._isInitNextPage||this._remoteRefresh?(this._setInitialCurrentIndexRecords(i.result,this._currentPage()),this._isInitNextPage=this._remoteRefresh=!1):this._setVirtualLoadedRecords(i.result,this._currentPage()),this._isThumbScroll&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)&&this._checkPrevNextViews(this._currentPage()),this.initialRender)for(this.model.currentViewData=[],u=0;u<this._currentLoadedIndexes.length;u++)e=this._currentLoadedIndexes[u],n.merge(this.model.currentViewData,this._virtualLoadedRecords[e]||[]);else this.model.currentViewData=i.result;this._setForeignKeyData(r);this._relationalColumns.length==0&&this._initGridRender()}},_initialRenderings:function(){var r,i;if(this.model.groupSettings.groupedColumns.length){for(r=[],i=0;i<this.model.sortSettings.sortedColumns.length;i++)t.isNullOrUndefined(this.model.sortSettings.sortedColumns[i].direction)&&(this.model.sortSettings.sortedColumns[i].direction=t.sortOrder.Ascending),r.push(this.model.sortSettings.sortedColumns[i].field);if(this.model.allowGrouping)for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)n.inArray(this.model.groupSettings.groupedColumns[i],r)==-1&&this.model.sortSettings.sortedColumns.push({field:this.model.groupSettings.groupedColumns[i],direction:t.sortOrder.Ascending})}},_getExpands:function(n,t){var r=n.split("."),i="",u,f;for(r.splice(r.length-1,1),u=0;u<r.length;u++,i=""){for(f=0;f<u;f++)i+=r[f]+"/";i=i+r[u];t.indexOf(i)===-1&&t.push(i)}},_renderAfterColumnInitialize:function(){this.element.append(this._renderGridHeader());this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&(this._renderFiltering(),this._renderFilterBarTemplate());this.model.gridLines!="both"&&this._showHeaderGridLines();this.model.allowPaging&&this.element.append(this.element.find(".e-pager").first())},_ensureDataSource:function(i){var f,k,ut,ft,d,l,a,s,v,e,c,et,ct,y,ot,lt,o,g,w,p,u,b,tt,at,vt,st,ht,it,h,yt,nt,pt,rt,wt;if(this._dataSource()==null&&!(this._dataSource()instanceof t.DataManager)){if(t.isNullOrUndefined(i)||i.requestType!="add")return;this.dataSource([])}if(this.model.query.requiresCount(),f=this.model.query,k=f.clone(),this._dataSource()instanceof t.DataManager||(this.model.currentViewData=this._dataSource()),this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!t.isNullOrUndefined(this._cModifiedData)||!t.isNullOrUndefined(this._cAddedRecord))){if(t.isNullOrUndefined(this._cAddedRecord)){for(c=0;c<this._primaryKeys.length;c++)f=f.where(this._primaryKeys[c],t.FilterOperators.equal,this._primaryKeyValues[c]);ut=this._dataManager.executeLocal(f);this._dataSource()instanceof t.DataManager?t.copyObject(this._dataSource().dataSource.json[n.inArray(ut.result[0],this._dataSource().dataSource.json)],this._cModifiedData):t.copyObject(this._dataSource()[n.inArray(ut.result[0],this._dataSource())],this._cModifiedData);this._cModifiedData=null}else ft=this._cAddedRecord,this._cAddedRecord=null,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.unshift(ft):this._dataSource(r,!0).splice(0,0,ft);f.queries=k.queries;this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"||(this.model.isEdit=!1)}if(i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&(this._excludeDetailRows().length==1||this.multiDeleteMode=="multiple"&&this.selectedRowsIndexes.length==this._excludeDetailRows().length)&&this.model.pageSettings.currentPage!=1&&this._currentPage(this.model.pageSettings.totalPages-1),i&&this.model.editSettings.allowDeleting&&i.requestType=="delete"&&!t.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof t.DataManager?(c=n.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(c,1)):(c=n.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(r,!0).splice(c,1))),this.model.scrollSettings.allowVirtualScrolling&&i&&(i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&(this._virtualDataRefresh=!0,this._refreshVirtualViewData()),this.model.sortSettings.sortedColumns.length){for(d=[],l=this.model.sortSettings.sortedColumns,u=l.length-1;u>=0;u--)if(this.model.groupSettings.groupedColumns.indexOf(l[u].field)==-1){if(f.sortBy(l[u].field,l[u].direction),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&n.inArray(l[u],this._prevVirtualSort)==-1){for(o=0;o<this._prevVirtualSort.length;o++)l[u].field==this._prevVirtualSort[o].field&&this._prevVirtualSort.splice(o,1);this._needVPaging=this._currentVirtualIndex*this._virtualRowCount%this.model.pageSettings.pageSize<=this._virtualRowCount;this._prevVirtualSort.push(l[u]);this._virtualDataRefresh=!0;this._refreshVirtualViewData()}}else d.push({field:l[u].field,direction:l[u].direction});for(o=0;o<d.length;o++)f.sortBy(d[o].field,d[o].direction)}if(this.model.allowSearching&&this.model.searchSettings.key.length&&(a=this.model.searchSettings,a.fields=a.fields.length!=0?a.fields:this.getColumnFieldNames(),f.search(a.key,a.fields,a.operator||"contains",a.ignoreCase),this.initialRender||i.requestType!="searching"||this._currentPage(1)),this._isLocalData&&this.model.allowSearching&&(this._filteredRecords=this.model.searchSettings.key.length!=0?this._dataManager.executeLocal(f).result:[]),this.model.allowFiltering&&this.model.filterSettings.filteredColumns.length){for(v=this.model.filterSettings.filteredColumns[0],e=this.model.filterSettings.filteredColumns,u=0;u<e.length;u++)c=n.inArray(this.getColumnByField(e[u].field),this.filterColumnCollection),e[u].field!==""&&c==-1&&this.filterColumnCollection.push(this.getColumnByField(e[u].field));if(!(this._isExcelFilter||this._excelFilterRendered)||v instanceof t.Predicate)for(v instanceof t.Predicate?(s=v,this._excelFilterRendered&&(lt=t.distinct(e,"field",!1),this._excelFilter._predicates[0]=this._excelFilter._predicates[0]||{},this._excelFilter._predicates[0][lt[0]]=s)):s=t.Predicate(v.field,v.operator,v.value,!v.matchcase),u=1;u<e.length;u++)e[u]instanceof t.Predicate?s=s[e[u].predicate||"and"](e[u]):!this._isLocalData&&e.length>2&&u>1&&e[u].predicate=="or"?s.predicates.push(t.Predicate(e[u].field,e[u].operator,e[u].value,e[u].ignoreCase||!e[u].matchcase)):s=s[e[u].predicate||"and"](e[u].field,e[u].operator,e[u].value,!e[u].matchcase);else{this._excelFilter.getPredicate(e,null,!0);et=this._excelFilter._predicates[0];for(ct in et)y=et[ct],ot=y.from!=r,ot?f.skip(y.from=="top"?0:this._gridRecordsCount-y.take).take(y.take):s=s!=r?s.and(y):y}if(s&&f.where(s),this._isLocalData?(g=this._dataManager.executeLocal(f),this._filteredRecordsCount=ot?g.result.length:g.count,w=this._filteredRecordsCount%this.model.pageSettings.pageSize==0?this._filteredRecordsCount/this.model.pageSettings.pageSize:parseInt(this._filteredRecordsCount/this.model.pageSettings.pageSize,10)+1,this._currentPage()>w&&this._currentPage(w),this._filteredRecords=this._dataManager.executeLocal(f).result,this._$fkColumn&&this.model.filterSettings.filteredColumns.length>0&&this.model.filterSettings.filterType=="excel"&&(this._fkParentTblData=this._filteredRecords)):t.isNullOrUndefined(i)||i.requestType!=t.Grid.Actions.Filtering||this._currentPage(1),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization)for(u=0;u<e.length;u++){for(o=0;o<this._prevVirtualFilter.length;o++)e[u]==this._prevVirtualFilter[o]&&i.requestType==t.Grid.Actions.Filtering&&this._prevVirtualFilter.splice(o,1);n.inArray(e[u],this._prevVirtualFilter)==-1&&(this._prevVirtualFilter.push(e[u]),this._gridRecordsCount=this._filteredRecordsCount,this._refreshViewPageDetails(),this._refreshVirtualViewData(),this._refreshVirtualViewDetails())}}if(this._isLocalData&&this.model.allowFiltering&&this.model.filterSettings.filteredColumns.length==0&&(!t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount>0)&&(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshViewPageDetails(),this._refreshVirtualViewDetails(!0)),this._filteredRecordsCount=null,this._filteredRecords=[]),this.model.summaryRows.length&&this._setSummaryAggregate(f),this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization){if(this._isLocalData&&(g=this._dataManager.executeLocal(f),this._recordsCount=g.count,w=this._recordsCount%this.model.pageSettings.pageSize==0?this._recordsCount/this.model.pageSettings.pageSize:parseInt(this._recordsCount/this.model.pageSettings.pageSize,10)+1,this._currentPage()>w&&this._currentPage(w)),this._currentPage()==0&&(this._prevPageNo==0||this._prevPageNo==null?this._currentPage(1):this._currentPage(this._prevPageNo)),!this._isLocalData&&!this.initialRender&&!t.isNullOrUndefined(i)&&i.requestType=="refresh"&&k.queries.length)for(u=0;u<k.queries.length;u++)k.queries[u].fn=="onWhere"&&this._currentPage(1);f.page(this._currentPage(),this.model.pageSettings.pageSize)}if(this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._needPaging=!0,this.initialRender&&this.model.currentIndex>1&&(this.model.currentIndex<=this._getVirtualTotalRecord()||!this._isLocalData)&&(this.model.scrollSettings.virtualScrollMode=="continuous"&&(this.model.currentIndex=1),this._currentVirtualIndex=Math.ceil(this.model.currentIndex/this._virtualRowCount),this._isThumbScroll=!0,this._currentPage(Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this._virtualDataRefresh&&(this._isThumbScroll=!0,this._refreshVirtualViewData(!0),this._gridRecordsCount=this._dataSource()!==null?this.model.pageSettings.totalRecordsCount==null?this._dataSource().length:this.model.pageSettings.totalRecordsCount:0,this._currentPage(Math.ceil(this._currentVirtualIndex*this._virtualRowCount/this.model.pageSettings.pageSize)),this._virtualLoadedPages.push(this._currentPage())),this.model.virtualLoading!=null&&(this._gridRecordsCount=this.model.pageSettings.totalRecordsCount),this.model.filterSettings.filteredColumns==0&&this._prevVirtualFilter.length&&(this._refreshVirtualViewData(),this._prevVirtualFilter=[]),this._isLocalData&&this.initialRender&&this._refreshVirtualViewDetails(),this._getVirtualLoadedRecords(f)),this.model.allowGrouping){for(p=f.clone(),this.model.allowPaging&&this.model.groupSettings.groupedColumns.length&&(p.queries=p.queries.slice(0,p.queries.length-1)),u=0;u<this.model.groupSettings.groupedColumns.length;u++)b=this.model.groupSettings.groupedColumns[u],tt=this.getColumnByField(b),t.isNullOrUndefined(tt)||t.isNullOrUndefined(tt.enableGroupByFormat)||!tt.enableGroupByFormat?(f.group(b),p.group(b)):(f.group(b,t.proxy(this._formatGroupColumn,this)),p.group(b,t.proxy(this._formatGroupColumn,this)));this.model.groupSettings.groupedColumns.length&&this._setAggreatedCollection(p)}if(i!=r&&i.requestType=="add"&&this._isLocalData&&this.model.groupSettings.groupedColumns.length==0&&this.model.scrollSettings.frozenColumns==0&&this.model.scrollSettings.frozenRows==0&&((this._dataSource()instanceof t.DataManager)?this._dataSource().dataSource.json.unshift(i.data):this._dataSource().unshift(i.data)),t.isNullOrUndefined(i)||i.action!="add"||t.isNullOrUndefined(this.model.parentDetails)||(at=this.getColumnByField(this.model.parentDetails.parentKeyField),vt=n.inArray(at,this.model.columns),vt==-1&&(st={},st[this.model.parentDetails.parentKeyField]=this.model.parentDetails.parentKeyFieldValue,n.extend(!0,this.model.currentViewData[0],st))),this._cloneQuery=f.clone(),this._isLocalData&&(!this.model.scrollSettings.enableVirtualization||this._virtualDataRefresh)){if(ht=this._dataManager.dataSource.json,it=this._dataSource().dataSource,!t.isNullOrUndefined(it)&&this._dataSource()instanceof t.DataManager&&(this._dataManager.dataSource.json=ht!=it.json?it.json:ht),h=this._dataManager.executeLocal(f),!t.isNullOrUndefined(i)&&i.requestType=="beginedit")this.model.currentViewData=h.result;else if(this.model.scrollSettings.allowVirtualScrolling&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&(this._prevPageRendered=!0),this.model.scrollSettings.allowVirtualScrolling&&!this._prevPageRendered&&h.result.length!=this.model.pageSettings.pageSize&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage)yt=t.pvt.filterQueries(f.queries,"onPage"),f.queries.splice(n.inArray(yt[0],f.queries),1),f.page(this._currentPage()-1,this.model.pageSettings.pageSize),nt=this._dataManager.executeLocal(f),nt.result.splice(0,h.result.length),this._previousPageRecords=n.extend(!0,[],nt.result),this._previousPageLength=h.result.length,this._currentPageData=h.result,t.merge(nt.result,h.result),this.model.currentViewData=this._lastVirtualPage=nt.result,this._lastPageRendered=!0;else if(this._lastPageRendered&&this.model.pageSettings.currentPage==this.model.pageSettings.totalPages-1&&!this.model.scrollSettings.enableVirtualization){for(pt=this.model.pageSettings.pageSize-this._previousPageLength,rt=0;rt<pt;rt++)wt=this.getRows()[this.getRows().length-(this.model.pageSettings.pageSize-rt)],wt.remove();this._tempPageRendered=!0;this.model.currentViewData=h.result}else this.model.currentViewData=h.result;this._gridRecordsCount=h.count;this._remoteSummaryData=h.aggregates;this._searchCount=this._searchString.length?h.count:null;this.model.groupSettings.groupedColumns.length&&this._setAggregates()}},_formatGroupColumn:function(n,i){var f=this.getColumnByField(i),r,u;return r=f.format,u=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),r=u.exec(r)[2],t.format(n,r,this.model.locale)},_refreshViewPageDetails:function(){this._currentPage(1);this.model.currentIndex=0;this._currentVirtualIndex=1;this.getContent().ejScroller("model.scrollTop",0)},_refreshVirtualViewDetails:function(n){var i=this._dataSource();n&&(this._gridRecordsCount=i!==null?i instanceof t.DataManager?i.dataSource.json.length:i.length:this.model.pageSettings.totalRecordsCount);this._totalVirtualViews=Math.ceil(this._getVirtualTotalRecord()/this._virtualRowCount);this._maxViews=Math.ceil(this.model.pageSettings.pageSize/this._virtualRowCount);this.model.pageSettings.totalPages=Math.ceil(this._gridRecordsCount/this.model.pageSettings.pageSize);this.model.pageSettings.totalRecordsCount=this._gridRecordsCount;this._lastViewData=this._virtualRowCount-(this._totalVirtualViews*this._virtualRowCount-this._getVirtualTotalRecord())},_getVirtualLoadedRecords:function(t){var i=this._currentPage(),r,u;if(this._needPaging&&(this._isLastVirtualpage=needTwoPage=this._isThumbScroll&&i==this.model.pageSettings.totalPages&&!this._virtualPageRecords[i],(this.initialRender||this._virtualDataRefresh)&&(needTwoPage=!0),this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||i!=1)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._getVirtualOnLoadingData(i,!needTwoPage):this._setVirtualPaging(t,i,!needTwoPage),!this.initialRender&&this._isThumbScroll&&this._virtualPageRecords[i]&&!this._virtualDataRefresh&&this._checkPrevNextViews(i,t)),this._needPaging=!1,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.initialRender&&this._isLocalData)for(this.model.currentViewData=[],r=0;r<this._currentLoadedIndexes.length;r++)u=this._currentLoadedIndexes[r],this._virtualLoadedRecords[u]&&n.merge(this.model.currentViewData,this._virtualLoadedRecords[u])},_setVirtualPaging:function(i,r,u){var e=t.pvt.filterQueries(i.queries,"onPage"),f;e.length&&i.queries.splice(n.inArray(e[0],i.queries),1);(!u||this._needVPaging)&&this.model.currentIndex>this._virtualRowCount?this._initCurrentIndex(i,r):i.page(r,this.model.pageSettings.pageSize);this._needVPaging=!1;this._isLocalData&&!this._virtualPageRecords[r]&&(f=this._dataManager.executeLocal(i),this.initialRender||(this.model.currentViewData=f.result),f.result.length?(this._setVirtualLoadedRecords(f.result,r),n.inArray(r,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(r)):this.initialRender||this.getContent().find(".e-virtualtop, .e-virtualbottom").remove())},_checkPrevNextViews:function(){var n=this._currentVirtualIndex,u=this._virtualLoadedRecords[n-1],f=this._virtualLoadedRecords[n+1],r=this._maxViews==3?1:2,t,i;n!=1&&n!=this._totalVirtualViews&&(u&&u.length==this._virtualRowCount?f&&f.length==this._virtualRowCount||this._totalVirtualViews==n-1||(i=n-r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i-1,t=this._scrollValue-r*this._virtualRowCount*this._vRowHeight):(i=n+r,this._currentVirtualIndex=this._virtualLoadedRecords[n]?i:i+1,t=this._scrollValue+r*this._virtualRowCount*this._vRowHeight),t&&(this._scrollValue=t,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.model.currentIndex=t==0?t:Math.floor(t/this._vRowHeight)))},_initCurrentIndex:function(i,r){var e=r*this.model.pageSettings.pageSize,c=this._currentVirtualIndex*this._virtualRowCount+this._virtualRowCount,l=this._currentVirtualIndex*this._virtualRowCount-this._virtualRowCount*2,v=c>e||l<e-this.model.pageSettings.pageSize,f,o,u,h,a,s;v||this._isLastVirtualpage?(c>e?(f=(r-1)*this.model.pageSettings.pageSize,o=this.model.pageSettings.pageSize*2,this._isInitNextPage=!0):(l<e-this.model.pageSettings.pageSize||this._isLastVirtualpage)&&(f=(r-2)*this.model.pageSettings.pageSize,o=this.model.pageSettings.pageSize*2,this._isInitNextPage=!1,this._remoteRefresh=!0),this.model.virtualLoading&&this._isLocalData?(u={},u.endIndex=f+o,u.endIndex=u.endIndex>this._getVirtualTotalRecord()?this._getVirtualTotalRecord():u.endIndex,u.startIndex=f,u.currentPage=this._currentPage(),u.result=null,this._trigger("virtualLoading",u),s=u.result,this._setInitialCurrentIndexRecords(s,r)):(h=t.pvt.filterQueries(i.queries,"onSkip"),h.length&&i.queries.splice(n.inArray(h[0],i.queries),1),i.skip(f).take(o),this._isLocalData&&(a=this._dataManager.executeLocal(i),s=this.model.currentViewData=a.result,this._isLastVirtualpage=!1,this._setInitialCurrentIndexRecords(s,r)))):(this._needVPaging=!1,this.model.virtualLoading&&this._isLocalData&&(this.model.currentIndex!=0||r!=1)?this._getVirtualOnLoadingData(r,!0):this._setVirtualPaging(i,r,!0))},_setInitialCurrentIndexRecords:function(n,t){for(i=0;i<2;i++){var r=i*this.model.pageSettings.pageSize,f=r+this.model.pageSettings.pageSize,e=n.slice(r,f),u;u=this._isInitNextPage||t==1&&this.model.pageSettings.totalPages==1?i==0?t:t+1:i==0?t-1:t;this._setVirtualLoadedRecords(e,u)}},_getVirtualOnLoadingData:function(n,t){var i,u;n>0&&(this.model.currentIndex>this._virtualRowCount&&(!t||this._needVPaging)&&this.model.currentIndex<this.model.pageSettings.totalRecordsCount?this._initCurrentIndex(r,n):(i={},i.endIndex=n*this.model.pageSettings.pageSize>this._gridRecordsCount?this._gridRecordsCount:n*this.model.pageSettings.pageSize,i.startIndex=n*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),u=i.result,this._setVirtualLoadedRecords(u,n)))},_setVirtualLoadedRecords:function(t,i){var u=this._virtualRowCount,h=this.model.pageSettings.pageSize,v=h/u,o,y=Math.ceil(i*h/u),p=i==this.model.pageSettings.totalPages,l,e,f,s,r,w,c,a,b;for(this._virtualPageRecords[i]||(this._virtualPageRecords[i]=t),p&&(l=this._getVirtualTotalRecord()%h,y=(!this._virtualLoadedRecords[this._totalVirtualViews]||this._virtualLoadedRecords[this._totalVirtualViews].length!=this._lastViewData)&&l<this._lastViewData&&l!=0?this._totalVirtualViews+1:this._totalVirtualViews,this._getVirtualTotalRecord()<u&&(this._singleView=!0)),e=0;e<v;e++)r=Math.ceil((i-1)*v+(e+1)),(r<=this._totalVirtualViews||p)&&r<=y&&(this._virtualLoadedRecords[r-1]&&this._virtualLoadedRecords[r-1].length!=u?(w=this._virtualLoadedRecords[r-1].length+e*u,f=u-w+e*u,n.merge(this._virtualLoadedRecords[r-1],t.slice(0,f)),o=s=f+u,r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,o))):r==1||this._virtualLoadedRecords[r-1]?(f=o?o:e*u%h,o=s=f+u):(c=s=(r-1)*u%h,c!=0&&(this._virtualLoadedRecords[r-1]=t.slice(0,c)),f=c,s=o=c+u),this._virtualLoadedRecords[r]&&this._virtualLoadedRecords[r].length!=u?(a=t.slice(f,s),a.length+this._virtualLoadedRecords[r].length<=u&&(b=n.merge(a,this._virtualLoadedRecords[r]),this._virtualLoadedRecords[r]=b)):!this._virtualLoadedRecords[r]&&r<=this._totalVirtualViews&&(this._virtualLoadedRecords[r]=t.slice(f,s)));n.inArray(i,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(i)},_setVirtualLoadedIndexes:function(n){var i,t;for(this._currentLoadedIndexes=[],i=n==this._totalVirtualViews?n:n+1,n!=1&&(n=n-1),t=n;t<=i;t++)this._currentLoadedIndexes.push(t)},_getVirtualTotalRecord:function(){return this.model.filterSettings.filteredColumns.length==0?this._searchCount==null?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount},_initGridRender:function(){var i,s,u,h,c,r;if(this.addInitTemplate(),this.model.scrollSettings.frozenColumns>0&&this.addFrozenTemplate(),this.model.allowGrouping&&this.addGroupingTemplate(),this.model.showSummary&&this.addSummaryTemplate(),(this.model.allowResizing||this.model.allowResizeToFit)&&(this._resizer=new t.gridFeatures.gridResize(this)),this.model.keySettings&&n.extend(this.model.keyConfigs,this.model.keySettings),this._initHeight=this.model.scrollSettings.height,this.model.scrollSettings.height=="100%"&&(this._isHeightResponsive=!0),this.render(),this._setTextWrap(),this.model.columnLayout=="fixed"){var l=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),f=this.getHeaderContent().width()>l?"addClass":"removeClass",e=this.getHeaderTable(),o=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(e=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),o=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0));e[f]("e-tableLastCell");o[f]("e-tableLastCell")}if(this.model.allowGrouping&&t.gridFeatures.dragAndDrop&&this._headerCellgDragDrop(),this.model.allowReordering&&t.gridFeatures.dragAndDrop&&(this._headerCellreorderDragDrop(),this._initIndicators()),this._wireEvents(),this.model.allowGrouping&&!t.isNullOrUndefined(this.model.serverProperties))for(this.model._groupingCollapsed=this.model.serverProperties._groupingCollapsed,i=0;i<this.model._groupingCollapsed.length;i++)s=this.getContent().find(".e-recordplusexpand"),u=s.filter("td[ej-mappingname='"+this.model._groupingCollapsed[i].key+"' ][ej-mappingvalue='"+this.model._groupingCollapsed[i].value+"']"),u.length>1&&!t.isNullOrUndefined(this.model._groupingCollapsed[i].parent)&&(h=this.model._groupingCollapsed[i].parent,u=u.filter(function(){return n(this).parents(".e-tabletd").parent("tr").prev("tr").find(".e-recordplusexpand[ej-mappingvalue="+h+"]").length})),this.expandCollapse(u);this.initialRender=!1;this.model.width&&!this.model.allowScrolling&&this.element.width(this.model.width);(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this._processEditing();this._trigger("dataBound",{});this._trigger("refresh");this.model.parentDetails&&(c=this.model.parentDetails.parentID,r=n("#"+c).data("ejGrid"),r.model.allowScrolling&&r._refreshScroller({requestType:"refresh"}));this.element.closest("tr").hasClass("e-detailrow")&&!this.model.parentDetails&&(r=this.element.closest("tr.e-detailrow").closest(".e-grid").data("ejGrid"),r.model.allowScrolling&&r.getScrollObject().refresh());this.model.allowFiltering&&this.model.filterSettings.filterType=="menu"&&this._renderFilterDialogs();this.model.enableResponsiveRow&&(this.model.allowSorting||this.model.allowFiltering)&&this._renderResponsiveFilter();this.model.allowGrouping&&this.model.showSummary&&(this._refreshGroupSummary(),this.model.currentViewData.length&&this._refreshGridFooterColGroup());this._isMapSelection&&this._mappingSelection();this.model.showColumnChooser&&this._renderColumnChooser();this._enableCheckSelect&&(this.model.currentViewData!=null&&this.model.currentViewData.length==0?this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").hide():this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").show())},_setTextWrap:function(){if(this.model.allowTextWrap==!0){switch(this.model.textWrapSettings.wrapMode){case"content":this.element.find(".e-columnheader").removeClass("e-wrap");this.element.removeClass("e-wrap");this.getContent().addClass("e-wrap");break;case"header":this.element.removeClass("e-wrap");this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").addClass("e-wrap");break;default:this.getContent().removeClass("e-wrap");this.element.find(".e-columnheader").removeClass("e-wrap");this.element.addClass("e-wrap")}if(this.model.scrollSettings.frozenColumns>0&&this.model.textWrapSettings.wrapMode!="content"){var n=this.getHeaderContent().find(".e-frozenheaderdiv").find(".e-columnheader").last().find("th"),t=this.getHeaderContent().find(".e-movableheader").find(".e-columnheader").last().find("th");n.height()>t.height()?t.height(n.height()):n.height(t.height())}}else this.getContent().removeClass("e-wrap").find(".e-rowcell").removeClass("e-nwrap"),this.element.find(".e-columnheader").removeClass("e-wrap").find(".e-headercelldiv").removeClass("e-nwrap"),this.element.removeClass("e-wrap")},_getMetaColGroup:function(){for(var r,u=t.buildTag("colgroup"),i=0;i<this.model.columns.length;i++)r=n(document.createElement("col")),this.model.columns[i].visible===!1&&r.css("display","none"),this.model.rowTemplate==null||t.isNullOrUndefined(this.model.columns[i].cssClass)||r.addClass(this.model.columns[i].cssClass),this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&n.inArray(this.model.columns[i].field,this.model.groupSettings.groupedColumns)!=-1&&r.css("display","none"),u.append(r);return u},_alternateRow:function(){return this.getIndex()%2==0?"e-row":"e-alt_row"},addInitTemplate:function(){var k=this.element.find(".e-headercelldiv:not(.e-emptyCell)"),v={},d=!0,y=document.createElement("tbody"),p=n(y),b,a,g,f,ut,s,nt,it,l,rt,e;if(this.model.rowTemplate==null){var w=document.createElement("tr"),o=n(w),u=this.model.columns,i;for(this._gridRecordsCount&&!this._virtualDataRefresh?(b=this.model.editSettings.showAddNewRow&&!this.initialRender?this.model.currentViewData[1]:this.model.currentViewData[0],t.isNullOrUndefined(b)||this._initColumns(b)):this._isLocalData&&(this._dataSource()!=null&&this._dataSource().length||this._dataManager&&this._dataManager.dataSource.json.length)&&this._initColumns(this._dataSource()[0]!=r?this._dataSource()[0]:this._dataManager.dataSource.json[0]),a={_gridFormatting:this.formatting,getComplexData:t.getObject},n.views.helpers(a),e={},e._foreignKey=this._foreignKeyBinding,n.views.helpers(e),(this.model.childGrid||this.model.detailsTemplate)&&(g=t.buildTag("td.e-detailrowcollapse","<div class='e-icon e-gnextforward'><\/div>"),o.append(g)),i=0;i<this.model.columns.length;i++){if(f=t.buildTag("td.e-rowcell"),t.isNullOrUndefined(u[i].tooltip)&&u[i].clipMode!=t.Grid.ClipMode.EllipsisWithTooltip||f.addClass("e-gridtooltip"),(u[i].clipMode==t.Grid.ClipMode.Ellipsis||u[i].clipMode==t.Grid.ClipMode.EllipsisWithTooltip)&&f.addClass("e-gridellipsis"),this.model.isResponsive&&f.attr("data-cell",this._decode(this.model.columns[i].headerText)),u[i].visible==!1?f.addClass("e-hide"):(d&&(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.addClass("e-detailrowvisible"),d=!1),this.model.groupSettings.showGroupedColumn||f.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[i].field+"'}}e-hide{{/if}}{{/for}}"),t.isNullOrUndefined(u[i].templateID||u[i].template)){for(var h=(u[i].field||"").split("."),tt=h.length-1,c="";tt;)c+="(",tt--;it=u[i].type||u[i].editType;switch(it){case"boolean":case"booleanedit":t.isNullOrUndefined(u[i].displayAsCheckbox)&&(u[i].displayAsCheckbox=!0);u[i].displayAsCheckbox?(l="",l=this.model.editSettings.editMode=="batch"&&(t.isNullOrUndefined(u[i].allowEditing)||u[i].allowEditing)?l:"disabled='disabled'",rt="{{if ~getComplexData('"+this.model.columns[i].field+"', #data)}} <input type ='checkbox' "+l+" checked='checked'><\/input>{{else}} <input type ='checkbox' "+l+"><\/input> {{/if}}",f.addClass("e-boolrowcell").html(rt)):f.html("{{if ~getComplexData('"+this.model.columns[i].field+"', #data)}}"+this.localizedLabels.True+"{{else}}"+this.localizedLabels.False+"{{/if}}");break;case"checkbox":this._enableCheckSelect=!0;this.model.selectionType="multiple";this.model.editSettings.allowDeleting&&(this.multiDeleteMode=!0);this.model.selectionSettings.enableToggle=!0;this._isMapSelection=u[i].field!="";this._selectionMapColumn=u[i].field;u[i].textAlign="center";this._isMapSelection||(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1);f.addClass("e-checkcell").html("<div class = 'e-checkcelldiv'>{{if #data['"+h.join("']['")+"']}} <input type ='checkbox' checked='checked'><\/input>{{else}} <input type ='checkbox'><\/input> {{/if}}<\/div>");this.model.columns[i].editType=t.Grid.EditingType.Boolean;this.model.scrollSettings.frozenColumns>0&&f.addClass("e-frozenunbound");this.model.enableAutoSaveOnSelectionChange=!1;break;default:u[i].disableHtmlEncode?f.html("{{html:"+c+"#data['"+h.join("'] || {})['")+"']}}"):f.html("{{:"+c+"#data['"+h.join("'] || {})['")+"']}}")}u[i].format==r||u[i].foreignKeyValue||f.html("{{:~_gridFormatting('"+u[i].format+"',"+c+"#data['"+h.join("'] || {})['")+"'],'"+this.model.locale+"')}}");u[i].foreignKeyValue&&u[i].dataSource&&f.html("{{:~_foreignKey("+i+","+c+"#data['"+h.join("'] || {})['")+"'],'"+this._id+"')}}");u[i].commands&&(e={},e["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,n.views.helpers(e),(t.isNullOrUndefined(u[i].field)||u[i].field=="")&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),t.isNullOrUndefined(u[i].headerText)||n("#"+this._id+u[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(u[i],i),t.isNullOrUndefined(u[i].headerText)||f.addClass("e-unboundcell").addClass("e-"+u[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+i).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&f.addClass("e-frozenunbound"),this._isUnboundColumn=!0)}else e={},s=u[i].headerText,e["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this,ut),n.views.helpers(e),t.isNullOrUndefined(s)||t.isNullOrUndefined(s.match(/[^0-9\s\w]/g))||(s=s.replace(/[^0-9\s\w]/g,"_")),n("#"+this._id+s+i+"_Template").remove(),nt=this._createTemplateElement(u[i]),(u[i].field==""||t.isNullOrUndefined(u[i].field))&&(this.model.columns[i].allowGrouping=this.model.columns[i].allowFiltering=this.model.columns[i].allowSorting=!1),u[i].template!=!1&&f.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+nt.id+"','"+i+"')}}");u[i].textAlign==r&&(u[i].textAlign="left");u[i].isPrimaryKey===!0&&(this._primaryKeys.push(n.trim(u[i].field)),this._primaryKeys=t.isNullOrUndefined(n.uniqueSort)?n.unique(this._primaryKeys.sort()):n.uniqueSort(this._primaryKeys.sort()));this.phoneMode&&this.model.enableResponsiveRow||u[i].textAlign==r||(f.css("text-align",u[i].textAlign),n(k[i]).css("text-align",u[i].textAlign));this.phoneMode||t.isNullOrUndefined(u[i].headerTextAlign)||n(k[i]).css("text-align",u[i].headerTextAlign);t.isNullOrUndefined(u[i].cssClass)||f.addClass(u[i].cssClass);this.model.allowTextWrap&&this.model.textWrapSettings.wrapMode!="header"&&u[i].allowTextWrap==!1&&f.addClass("e-nwrap");t.isNullOrUndefined(u[i].priority)||f.addClass("e-table-priority-"+u[i].priority);t.isNullOrUndefined(u[i].customAttributes)||f.attr(u[i].customAttributes);f.attr("role","gridcell");o.append(f);this.model.enableAltRow?(a["_"+this._id+"AlternateRow"]=this._alternateRow,n.views.helpers(a),o.addClass("{{:~_"+this._id+"AlternateRow()}}")):o.addClass("e-row");o.attr("role","row");this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenColumns==i+1&&(y.appendChild(w),v[this._id+"_JSONFrozenTemplate"]=p.html(),o.empty(),p.empty())}y.appendChild(w)}v[this._id+"_JSONTemplate"]=this.model.rowTemplate!=null?n(this.model.rowTemplate).html():p.html();n.templates(v)},render:function(){this.model.showSummary=this.model.summaryRows.length>0||this.model.showSummary;this._renderGridContent().insertAfter(this.element.children(".e-gridheader"));this.model.allowResizeToFit&&this.setWidthToColumns();this.model.allowGrouping&&t.gridFeatures.dragAndDrop&&this._groupHeaderCelldrag();this.model.showSummary&&this._currentJsonData.length&&(this._renderGridFooter().insertAfter(this.getContent()),this._hideCaptionSummaryColumn());this._initialEndRendering()},_createStackedRow:function(i,u){var y=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),a=[],g=[],p,ut,ft,f,w,b,k,e,s,ot,o,v;for(tAl=[],tp=[],o=0;o<this.model.columns.length;o++)if(p=this.model.columns[o],p.visible!=!1){if(this.model.allowGrouping&&!this.model.groupSettings.showGroupedColumn&&this.model.groupSettings.groupedColumns.length>0&&n.inArray(p.field,this.model.groupSettings.groupedColumns)!=-1)continue;var nt="",tt="",it="",rt="",c=i.stackedHeaderColumns;for(s=0;s<c.length;s++)ut=n.isArray(c[s].column)?c[s].column:n.map(c[s].column.split(","),n.trim),ft="e-row"+n.inArray(i,this.model.stackedHeaderRows)+"-column"+s,n.inArray(p.field,ut)!=-1&&(nt=c[s].headerText,tt=c[s].cssClass,it=c[s].textAlign,rt=c[s].tooltip?" e-gridtooltip "+ft:"");a.push(nt);g.push(tt);tAl.push(it);tp.push(rt)}for(f=[],e=0;e<a.length;e++){for(w=1,b=e+1;b<a.length;b++)if(a[e]==a[b])w++;else break;f.push({sapnCount:w,headerText:a[e],cssClass:g[e],txtAlign:tAl[e],tooltip:tp[e]});e+=w-1}if(y=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),k=this.model.scrollSettings.frozenColumns,this.model.allowScrolling&&k>0){var d=[],l=0,h=0,et=0;for(e=0;e<this.model.columns.length;e++)s=this.model.columns[e],e<k&&s.visible==!1&&et++;for(l=k-et;l>0;)ot=f[h].sapnCount,f[h].sapnCount<l?(d.push(f[h]),u?h++:f.splice(h,1)):f[h].sapnCount>l?(f[h].sapnCount=f[h].sapnCount-l,u&&d.push({sapnCount:l,headerText:f[h].headerText})):(d.push(f[h]),u||f.splice(h,1)),l-=ot;u&&(f=d)}for((this.model.detailsTemplate||this.model.childGrid)&&y.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),o=0;o<f.length;o++)v=t.buildTag("th.e-headercell e-stackedHeaderCell e-default"+f[o].tooltip,f[o].headerText,{},{colspan:f[o].sapnCount}),v.css("textAlign",f[o].txtAlign),y.append(v),f[o].cssClass!=r&&v.addClass(f[o].cssClass),(this.model.allowResizing||this.model.allowReordering||this.model.allowResizeToFit)&&v.addClass("e-resizer");return y},_renderGridHeaderInternalDesign:function(i,u){var p=t.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"grid"}),l=t.buildTag("thead"),w=t.buildTag("tbody.e-hide"),a=t.buildTag("tr.e-columnheader"),v=n(document.createElement("colgroup")),b=n(document.createElement("tr")),k,f,y,c,h,s;if((this.model.childGrid||this.model.detailsTemplate)&&(a.append(t.buildTag("th.e-headercell e-detailheadercell","<div><\/div>")),v.append(this._getIndentCol())),this.model.showStackedHeader)for(s=0;s<this.model.stackedHeaderRows.length;s++)k=this._createStackedRow(this.model.stackedHeaderRows[s],u),l.append(k);for(f=0;f<i.length;f++){var o=t.buildTag("th.e-headercell e-default","",{},{role:"columnheader"}),d=document.createElement("td"),e=t.buildTag("div.e-headercelldiv",i[f].headerText===r&&i[f].type!="checkbox"?i[f].headerText=i[f].field:i[f].headerText,{},{"ej-mappingname":i[f].field});if(i[f].disableHtmlEncode&&e.text(i[f].headerText),t.isNullOrUndefined(i[f].headerTooltip)||e.addClass("e-gridheadertooltip"),t.isNullOrUndefined(i[f].tooltip)||e.addClass("e-gridtooltip"),(i[f].clipMode==t.Grid.ClipMode.Ellipsis||i[f].clipMode==t.Grid.ClipMode.EllipsisWithTooltip)&&e.addClass("e-gridellipsis"),(this.model.allowResizing||this.model.allowReordering||this.model.allowResizeToFit)&&o.addClass("e-resizer"),o.append(e),this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel")&&(i[f].allowFiltering==r||i[f].allowFiltering===!0)&&(!t.isNullOrUndefined(i[f].field)||i[f].field=="")&&i[f].type!="checkbox"){if(y="e-filterset",!this.initialRender&&this.model.filterSettings.filteredColumns)for(c=0;c<this.model.filterSettings.filteredColumns.length;c++)this.model.filterSettings.filteredColumns[c].field==i[f].field&&(y="e-filterset e-filteredicon e-filternone");o.append(t.buildTag("div.e-filtericon e-icon "+y));o.addClass("e-headercellfilter");t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"&&this.model.enableRTL&&n(e).css("padding","0 0 0 2em")}h=document.createElement("col");i[f].priority&&n(d).addClass("e-table-priority-"+i[f].priority);b.append(d);a.append(o);v.append(h);i[f].visible===!1?(o.addClass("e-hide")&&n(h).css("display","none"),n.inArray(i[f].headerText,this._hiddenColumns)==-1&&n.inArray(i[f].field,this._hiddenColumnsField)==-1&&(this._hiddenColumns.push(i[f].headerText)&&i[f].field!=(""||r)?this._hiddenColumnsField.push(i[f].field):this._hiddenColumnsField.push(i[f].headerText)),n.inArray(i[f].field,this._visibleColumnsField)!=-1&&this._visibleColumnsField.splice(n.inArray(i[f].field,this._visibleColumnsField),1)&&this._visibleColumns.splice(n.inArray(i[f].headerText,this._visibleColumns),1)):(this._visibleColumns.push(i[f].headerText)&&i[f].field!=(""||r)?this._visibleColumnsField.push(i[f].field):this._visibleColumnsField.push(i[f].headerText),i[f].visible=!0,n.inArray(i[f].field==""?i[f].headerText:i[f].field,this._hiddenColumnsField)!=-1&&this._hiddenColumnsField.splice(n.inArray(i[f].field==""?i[f].headerText:i[f].field,this._hiddenColumnsField),1)&&this._hiddenColumns.splice(n.inArray(i[f].headerText,this._hiddenColumns),1));this.model.showColumnChooser&&i[f].showInColumnChooser!==!1&&(i[f].showInColumnChooser=!0);this.model.allowResizing&&i[f].allowResizing!==!1&&(i[f].allowResizing=!0);t.isNullOrUndefined(i[f].headerTextAlign)?i[f].textAlign!=r?e.css("text-align",i[f].textAlign):this.model.enableRTL&&e.css("text-align",i[f].textAlign="right"):e.css("text-align",i[f].headerTextAlign);i[f].allowResizing===!1&&this._disabledResizingColumns.push(i[f].field);i[f].allowSorting===!1&&this._disabledSortableColumns.push(i[f].field);i[f].allowGrouping===!1&&this._disabledGroupableColumns.push(i[f].field);i[f].allowEditing===!1&&this._disabledEditableColumns.push(i[f].field);t.isNullOrUndefined(i[f].cssClass)||(o.addClass(i[f].cssClass),n(h).addClass(i[f].cssClass));this.model.allowTextWrap&&this.model.textWrapSettings.wrapMode!="content"&&i[f].allowTextWrap==!1&&e.addClass("e-nwrap");t.isNullOrUndefined(i[f].headerTemplateID)||(e.html(n(i[f].headerTemplateID).hide().html()).parent().addClass("e-headertemplate"),s=n.inArray(i[f].field,this._disabledGroupableColumns),s==-1&&t.isNullOrUndefined(i[f].field)&&this._disabledGroupableColumns.push(i[f].field));t.getObject("type",i[f])=="checkbox"&&t.isNullOrUndefined(i[f].headerText)&&(e.addClass("e-headercheckcelldiv"),e.html("<input type = 'checkbox' class = 'e-checkselectall'><\/input>"),t.isNullOrUndefined(i[f].field)||e.attr("ej-mappingname",i[f].field));this.model.allowGrouping&&this.model.groupSettings.showToggleButton&&n.inArray(i[f].field,this._disabledGroupableColumns)==-1&&!t.isNullOrUndefined(i[f].field)&&i[f].field!=""&&(n.inArray(i[f].field,this.model.groupSettings.groupedColumns)!=-1?e.append(this._getToggleButton().addClass("e-toggleungroup")):e.append(this._getToggleButton().addClass("e-togglegroup")));this.model.isResponsive&&o.attr("title",this._decode(i[f].headerText));i[f].priority&&(o.attr("data-priority",i[f].priority).addClass("e-table-priority-"+i[f].priority),n(h).addClass("e-table-priority-"+i[f].priority));this.initialRender&&(typeof i[f].width=="string"&&i[f].width.indexOf("%")!=-1?this.columnsWidthCollection.push(parseInt(i[f].width)/100*this.element.width()):this.columnsWidthCollection.push(i[f].width));i[f].width==r&&this.model.commonWidth!==r&&(this.columnsWidthCollection[f]=this.model.commonWidth);this._fieldColumnNames[i[f].headerText]=i[f].field;this._headerColumnNames[i[f].field]=i[f].headerText}return l.append(a),w.append(b),p.append(v).append(l).append(w),p},_renderGridHeader:function(){var n=t.buildTag("div.e-gridheader"),r,u,i=t.buildTag("div");return this.model.allowScrolling&&i.addClass("e-headercontent"),this.setGridHeaderContent(n),this.initialRender&&(this.columnsWidthCollection=[],this._hiddenColumns=[],this._hiddenColumnsField=[]),this._visibleColumns=[],this._visibleColumnsField=[],this._disabledGroupableColumns=[],this._fieldColumnNames={},this._headerColumnNames={},this.model.scrollSettings.frozenColumns>0?(r=t.buildTag("div.e-frozenheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(0,this.model.scrollSettings.frozenColumns),!0)),u=t.buildTag("div.e-movableheader",t.buildTag("div.e-movableheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(this.model.scrollSettings.frozenColumns),!1))),i.append(r).append(u)):i.append(this._renderGridHeaderInternalDesign(this.model.columns)),n.html(i),this.model.isResponsive&&n.addClass("e-textover"),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),n},_renderGridContent:function(){var o=t.buildTag("div.e-gridcontent"),h=t.buildTag("div"),e=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),c=n(document.createElement("tbody")),r,i,u,l,f,s,a;if(e.append(this.getHeaderTable().find("colgroup").clone()).append(c),h.html(e),o.html(h),this.setGridContentTable(e),this.setGridContent(o),e.attr("role","grid"),r={},this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length){if(this.initialRender&&(r.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],!this.model.groupSettings.showGroupedColumn))for(i=0;i<this.model.groupSettings.groupedColumns.length;i++)u=this.model.groupSettings.groupedColumns[i],n.inArray(u,this._hiddenColumnsField)==-1&&(this._hiddenColumnsField.push(u),this._hiddenColumns.push(this.getColumnByField(u).headerText),this.getColumnByField(u).visible=!1);r.requestType=t.Grid.Actions.Grouping}else r.requestType=t.Grid.Actions.Refresh;if(this._dataSource()==null||this._dataSource().length==0||this.model.currentViewData.length==0?(l=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length-this._hiddenColumns.length}),c.append(n(document.createElement("tr")).append(l)),this.setWidthToColumns(),(this.initialRender||this.model.groupSettings.groupedColumns.length)&&this.sendDataRenderingRequest(r)):this.sendDataRenderingRequest(r),this._isCaptionSummary&&r.requestType=="grouping"&&this.model.groupSettings.groupedColumns.length>1)for(f=this.getContentTable().find(".e-table").not(".e-recordtable").children("colgroup"),s=n(this.getContentTable().find(".e-recordtable")[0]).children("colgroup").find("col"),i=0;i<f.length;i++)a=n(f[i]).find("col").length,n(f[i]).find("col:gt("+(a-s.length-1)+")").remove(),n(f[i]).append(s.clone());return o},print:function(){var r={};r.requestType="print";this._printselectrows=this.getContentTable().find('tr[aria-selected="true"]');this._trigger("actionBegin",r);var u=window.open("","print","height=452,width=1024,tabbar=no"),f=t.buildTag("div#"+this._id),i=n.extend({},this.model);i.toolbarSettings.showToolbar=i.allowPaging=i.allowScrolling=!1;i.query.queries=[];this.model.allowPaging&&this.model.pageSettings.printMode=="currentpage"?(i.query.queries=[{fn:"onPage",e:{pageIndex:this._currentPage(),pageSize:this.model.pageSettings.pageSize}}],i.dataBound=function(){this._printProcess(u)}):i.dataBound=function(){this._printProcess(u)};f.ejGrid(i)},_printProcess:function(n){var i=this.element,r={requestType:"print",element:i,selectedRows:this._printselectrows};this.model.allowFiltering&&this.model.filterSettings.filterType=="filterbar"&&i.find(".e-filterbar").remove();i.show();this._trigger("beforePrint",r);t.print(i,n);this._trigger("actionComplete",r)},"export":function(i,r,u,f){var o=n.extend(!0,{},this.model),h=this,w={action:i,method:"post","data-ajax":"false"},e=t.buildTag("form","",null,w),s=[],l,b,c,a,v,y,p;if(u&&!t.isOnWebForms)l=n("div.e-grid"),f&&f.length>0&&(l=n.map(f,function(n){return document.getElementById(n)})),n.each(l,function(i,r){var u=n(r).data("ejGrid"),f,o,c,l;if(s.push({id:u._id,locale:u.model.locale}),!t.isNullOrUndefined(u)&&(f=n.extend(!0,{},u.model),f=h._getModifyExportModel(f),u.ignoreOnExport)){for(o=0;o<u.ignoreOnExport.length;o++)delete f[u.ignoreOnExport[o]];c={name:"GridModel",type:"hidden",value:u.stringify(f)};l=t.buildTag("input","",null,c);e.append(l)}}),n("body").append(e),e.submit();else{if(this._locale=this.model.locale,o=this._getModifyExportModel(o),b=this,this.ignoreOnExport)for(c=0;c<this.ignoreOnExport.length;c++)delete o[this.ignoreOnExport[c]];t.raiseWebFormsServerEvents?(a={model:o,originalEventType:r},v={model:this.stringify(o)},t.raiseWebFormsServerEvents(r,a,v),setTimeout(function(){t.isOnWebForms=!0},1e3)):(y={name:"GridModel",type:"hidden",value:this.stringify(o)},p=t.buildTag("input","",null,y),e.append(p),e.append(this),n("body").append(e),e.submit())}return setTimeout(function(){var i,r;if(s.length)for(i=0;i<s.length;i++)r=n("#"+s[i].id).data("ejGrid"),r.model.locale=s[i].locale;t.isNullOrUndefined(h._locale)||(h.model.locale=h._locale)},0),e.remove(),!0},_getModifyExportModel:function(i){var e={},u,o,f;n.extend(e,t.Grid.Locale["en-US"],t.Grid.Locale[i.locale]);var s=e.GroupCaptionFormat,h=s.indexOf("{{if"),l=s.indexOf(" {{else}}"),a=s.slice(h,l).replace("{{if count == 1 }}",""),c={EmptyRecord:e.EmptyRecord,GroupCaptionFormat:s.slice(0,h),GroupText:a,True:e.True,False:e.False};for(t.isNullOrUndefined(this.model)||(this.model.locale=i.locale.concat(JSON.stringify(c))),i.locale=i.locale.concat(JSON.stringify(c)),u=0;u<i.columns.length;u++)if(i.columns[u].editType!=r)switch(i.columns[u].editType){case"stringedit":case"edittemplate":i.columns[u].editType="string";break;case"numericedit":i.columns[u].editType="numeric";break;case"dropdownedit":i.columns[u].editType="dropdown";break;case"booleanedit":i.columns[u].editType="boolean"}for(u=0;u<i.filterSettings.filteredColumns.length;u++)i.filterSettings.filteredColumns[u].operator=="equal"?i.filterSettings.filteredColumns[u].operator="equals":i.filterSettings.filteredColumns[u].operator=="notequal"&&(i.filterSettings.filteredColumns[u].operator="notequals");if(i.showStackedHeader)for(i.stackedHeaderRow=i.stackedHeaderRows,u=0;u<i.stackedHeaderRow.length;u++)for(i.stackedHeaderRow[u].stackedHeaderColumn=i.stackedHeaderRow[u].stackedHeaderColumns,o=i.stackedHeaderRow[u].stackedHeaderColumn,f=0;f<o.length;f++)i.stackedHeaderRow[u].stackedHeaderColumn[f].column=n.isArray(o[f].column)?o[f].column:o[f].column.split(",");return i},sendDataRenderingRequest:function(i){var h,d,g,w,nt,tt,b,s,v,it,o,c,f,rt,k,ut,y,ft;if(this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1),this.setFormat(),this.model.scrollSettings.enableVirtualization||(this._previousColumnIndex=null,this._previousRowCellIndex=null,this._previousIndex=null),i.requestType=="add"||i.requestType=="grouping"||this.model.currentViewData!=null&&this.model.currentViewData.length)switch(i.requestType){case t.Grid.Actions.Refresh:case t.Grid.Actions.Paging:case t.Grid.Actions.Sorting:case t.Grid.Actions.Filtering:case t.Grid.Actions.Save:case t.Grid.Actions.Cancel:case t.Grid.Actions.Delete:case t.Grid.Actions.Search:case t.Grid.Actions.Reorder:case t.Grid.Actions.BatchSave:if(h=this.model.groupSettings.groupedColumns,this.model.allowGrouping&&i.requestType==t.Grid.Actions.Refresh&&h.length==0&&this.element.find(".e-grouptopleftcell").length>0&&(d=this.element.children(".e-gridheader"),d.find("div").first().empty().append(this._renderGridHeader().find("table"))),(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&n("#"+this._id+"_externalEdit").css("display","none"),this.model.allowGrouping||(h=[]),h.length==0){var u=document.createElement("div"),l,e=-1,p=!1;if(this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(this.model.childGrid!=null||this.model.detailsTemplate!=null)&&this.getContentTable().find("colgroup").first().prepend(this._getIndentCol()),g=this._currentPage(),(this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"||this.model.editSettings.editMode=="normal")&&(i.requestType=="cancel"||i.requestType=="save")&&(this._editFormHeight=this.element.find(".gridform").closest("tr").height()),this.model.scrollSettings.frozenColumns>0)u.innerHTML=this._renderByFrozenDesign();else{i.data&&(l=document.createElement("div"),l.innerHTML=["<table><tbody>",n.render[this._id+"_JSONTemplate"](i.data),"<\/tbody><\/table>"].join(""),this._dataSource()instanceof t.DataManager&&i.requestType==t.Grid.Actions.Save&&(e=this._getDataIndex(this.model.currentViewData,i.data),p=this._dataSource().adaptor instanceof t.remoteSaveAdaptor));w=null;w=!this.model.scrollSettings.allowVirtualScrolling||this.model.scrollSettings.enableVirtualization||t.isNullOrUndefined(this._currentVIndex)||i.requestType!="save"&&i.requestType!="cancel"&&i.requestType!="delete"?this.model.currentViewData:t.isNullOrUndefined(this._lastVirtualPage)?this._virtualLoadedRecords[this._currentVIndex]:this._lastVirtualPage;u.innerHTML=["<table><tbody>",n.render[this._id+"_JSONTemplate"](w),"<\/tbody><\/table>"].join("");var a=this.getContentTable().get(0),r=a.lastChild,et=this.getContentTable().first().find("tbody").first();if(i.requestType!="save"&&i.requestType!="cancel"||this.model.editSettings.editMode=="batch"||this.model.scrollSettings.allowVirtualScrolling)i.requestType!="delete"||this.model.scrollSettings.allowVirtualScrolling?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):(this._isUnboundColumn&&($editedrow=this.element.find(".e-editedrow"),$oldChild=this.getContentTable().find(".e-editedrow").get(0),$newChild=$editedrow.length?u.firstChild.firstChild.firstChild:l.firstChild.firstChild.lastChild,$editedrow.length!=0&&(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")?n($oldChild).replaceWith(n($newChild)):this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?($oldChild=$editedrow.prev("tr").get(0),$editedrow.remove()):$oldChild=$editedrow.get(0)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&this.getContentTable()[0].rows.length!=this.model.currentViewData.length&&(this.getContentTable().find("tr").length&&this._excludeDetailRows().length?this.multiDeleteMode?(k=u.firstChild.firstChild.rows.length,ut=n(u.firstChild.firstChild.rows).slice(k-this.selectedRowsIndexes.length,k),n(r).append(ut)):r.appendChild(u.firstChild.firstChild.lastChild):n(r).prepend(u.firstChild.firstChild.rows)),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&(y=this.getContentTable().find(".e-detailrow:visible"),n.each(y,function(n){y.eq(n).closest("tr").prev().children(".e-detailrowexpand").length==0&&y.eq(n).remove()})),this._gridRows=a.rows,this.model.enableAltRow&&this._refreshAltRow());else{if(rowIndex=this.model.editSettings.editMode.indexOf("inlineform")!=-1?t.isNullOrUndefined(i.selectedRow)?this._selectedRow():i.selectedRow:this.getContentTable().find(".e-"+i.action+"edrow").index(),nt=this._currentTrIndex,rowIndex==-1&&(rowIndex=nt),this.model.detailsTemplate!=null||this.model.childGrid!=null)for(tt=this.model.editSettings.editMode=="inlineform"?n(n(r.childNodes).not(".e-detailrow")[rowIndex]):n(r.childNodes[rowIndex]),b=n(r.childNodes).not(".e-detailrow"),o=0;o<b.length;o++)tt.is(b[o])&&(rowIndex=o);if(this.model.editSettings.editMode=="normal"||this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"){if(i.action=="add"&&!this.getContentTable().find(".e-addedrow").length)break;$oldChild=this.getContentTable().find(".e-addedrow").get(0);$editedTr=this.getContentTable().find(".e-editedrow");$newChild=$editedTr.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:l.firstChild.firstChild.lastChild;$editedTr.length?($newChild=u.firstChild.firstChild.childNodes[rowIndex],this.model.editSettings.editMode=="inlineform"||this.model.editSettings.editMode=="inlineformtemplate"?($oldChild=$editedTr.prev("tr").get(0),$editedTr.remove()):$oldChild=$editedTr.get(0),s=n($newChild),f=n($oldChild),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.next("tr.e-detailrow:visible").length&&(c=s.find(".e-detailrowcollapse"),c.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),i.requestType=="cancel"?(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").addClass("e-showaddrow"),f.replaceWith(s)):!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(this.model.detailsTemplate!=null&&f.next("tr.e-detailrow").length&&r.removeChild(f.next("tr.e-detailrow").get(0)),f.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&h.length==0&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):t.isNullOrUndefined(this.model.currentViewData[rowIndex])||this._primaryKeys.length&&t.getObject(this._primaryKeys[0],this.model.currentViewData[rowIndex])!=t.getObject(this._primaryKeys[0],i.data)?n(r).replaceWith(n(u).find("tbody")):r.replaceChild($newChild,$oldChild),this.model.editSettings.showAddNewRow&&(this.model.editSettings.rowPosition=="top"?r.firstChild.remove():r.lastChild.remove())):(s=n($newChild),f=n($oldChild),i.action=="add"&&i.requestType=="save"&&this.model.editSettings.showAddNewRow&&this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&(this.model.editSettings.rowPosition=="bottom"?r.lastChild.previousSibling.remove():r.lastChild.remove()),i.requestType=="cancel"||this._dataSource()instanceof t.DataManager||this._currentPage()!=1||i.requestType=="save"&&!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount==this._previousFilterCount?(t.isNullOrUndefined($oldChild)||(f.remove(),this._dataSource()instanceof t.DataManager&&e!=-1?e==0?r.insertBefore($newChild,r.children[e]):s.insertAfter(r.children[e-1]):this._dataSource()instanceof t.DataManager&&!p||this._currentPage()==1||i.requestType!="save"||n(r).prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&h.length==0&&(this._dataSource()instanceof t.DataManager&&e==-1&&!p&&i.requestType!="save"||i.requestType!="save"&&!(this._dataSource()instanceof t.DataManager))&&i.requestType=="cancel"&&!this.model.editSettings.showAddNewRow&&a.lastChild.appendChild(u.firstChild.firstChild.lastChild)),i.requestType!="cancel"||this._selectedRow()==-1||this._enableCheckSelect||this.clearSelection()):this.model.currentViewData.length==1?(n(r).empty(),r.appendChild($newChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this.model.editSettings.rowPosition=="bottom"?(et.prepend($oldChild),r.replaceChild($newChild,$oldChild)):r.replaceChild($newChild,$oldChild))}else if(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"||this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")if($editedTr=this.element.find(".e-editedrow"),i.requestType!="cancel"&&($editedTr.length||t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount!=this._previousFilterCount))if($editedTr.length){if($newChild=u.firstChild.firstChild.childNodes[rowIndex],$oldChild=this._excludeDetailRows(r.childNodes)[rowIndex],this.model.allowCellMerging!=null&&(f=n($oldChild),n($oldChild.childNodes).hasClass("e-merged")))for(v=f.children(".e-merged").index(),it=$oldChild.children[v].colSpan,o=0;o<it;o++)$newChild.childNodes[v+o].className+=" e-merged e-hide",$newChild.childNodes[v].colSpan=o+1;this.model.detailsTemplate!=null&&($oldChild=n(r.childNodes).not(".e-detailrow").eq(rowIndex).get(0));(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.next("tr.e-detailrow:visible").length&&(c=n($newChild).find(".e-detailrowcollapse"),c.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"));!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount<this._previousFilterCount?(f=n($oldChild),this.model.detailsTemplate!=null&&f.next("tr.e-detailrow").length&&r.removeChild(f.next("tr.e-detailrow").get(0)),f.remove(),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.appendChild(u.firstChild.firstChild.lastChild)):this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):t.isNullOrUndefined(this.model.currentViewData[rowIndex])||this._primaryKeys.length&&t.getObject(this._primaryKeys[0],this.model.currentViewData[rowIndex])!=t.getObject(this._primaryKeys[0],i.data)?n(r).replaceWith(n(u).find("tbody")):r.replaceChild($newChild,$oldChild)}else this.model.currentViewData.length==1&&this.getContentTable().find("td.e-rowcell").length==0?($newChild=u.firstChild.firstChild.firstChild,n(r).empty(),r.appendChild($newChild)):(newChild=$editedTr.length||i.requestType=="cancel"?u.firstChild.firstChild.firstChild:l.firstChild.firstChild.lastChild,this._dataSource()instanceof t.DataManager?e!=-1&&(e==0?r.insertBefore(newChild,r.children[e]):n(newChild).insertAfter(r.children[e-1]),rt=this._isAddNew&&e?this.model.currentViewData.length-1:this.model.currentViewData.length+1,this.model.allowPaging&&(this.model.pageSettings.pageSize<rt||e==this.model.pageSettings.pageSize)&&r.removeChild(r.lastChild)):(this.model.sortSettings.sortedColumns.length&&i.requestType=="save"&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(this.model.rowTemplate!=null?u.firstChild.lastChild:u.firstChild.firstChild,this.getContentTable().get(0).lastChild):this._currentPage()==1?this.getContentTable().find("tbody").first().prepend(n(newChild)):this.getContentTable().find("tbody").first().prepend(n(u.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&r.removeChild(r.lastChild)),this.model.detailsTemplate!=null&&n(a.lastChild.lastChild).children(".e-detailrowexpand").length&&r.removeChild(r.lastChild));else $newChild=u.firstChild.firstChild.childNodes[rowIndex],$oldChild=r.childNodes[rowIndex],s=n($newChild),f=n($oldChild),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&f.next(".e-detailrow:visible").length&&(c=s.find(".e-detailrowcollapse"),c.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),f.replaceWith(s),this._enableCheckSelect||this.clearSelection(),this.model.allowPaging&&this._refreshGridPager();this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():a.rows;this.model.enableAltRow&&this._refreshAltRow()}}this._currentJsonData=this.model.currentViewData;this._gridRows=this.model.editSettings.showAddNewRow?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row").toArray():this.getContentTable().get(0).rows;this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);ft={};(i.requestType=="sorting"||i.requestType=="filtering"||i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&this.model.scrollSettings.allowVirtualScrolling&&(i.requestType=="filtering"&&(this.getContent().first().ejScroller("refresh").ejScroller("isVScroll")?this.element.find(".gridheader").addClass("e-scrollcss"):this.element.find(".gridheader").removeClass("e-scrollcss"),ft=this._refreshVirtualPagerInfo()),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(g),i.requestType=="filtering"&&this.getContent().first().ejScroller("refresh"));this.model.allowPaging&&(this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:this._searchCount==null?this._gridRecordsCount:this._searchCount,currentPage:this._currentPage()}),this._refreshGridPager());this.model.scrollSettings.enableVirtualization||this._eventBindings();break}case t.Grid.Actions.Grouping:this._group(i);this._refreshStackedHeader();break;case t.Grid.Actions.BeginEdit:this._edit(i);break;case t.Grid.Actions.Add:this._add(i);break;case t.Grid.Actions.Ungrouping:this._ungroup(i);break;case t.Grid.Actions.VirtualScroll:this._isVirtualRecordsLoaded||(this.model.scrollSettings.enableVirtualization?this._replacingVirtualContent():this._replacingContent())}else i.requestType=="reorder"&&this.model.groupSettings.groupedColumns.length>0?this._group(i):((t.isNullOrUndefined(this.model.currentViewData)||this.model.currentViewData.length==0)&&!this.phoneMode&&(i.requestType=="refresh"&&this.model.scrollSettings.frozenColumns==0&&this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(i.requestType=="filtering"||i.requestType=="cancel"||i.requestType=="refresh")&&this.model.scrollSettings.frozenColumns>0&&this._removeFrozenTemplate()),this._newungroup(i));(t.isNullOrUndefined(this.model.currentViewData)||this.model.currentViewData.length==0)&&(this._currentJsonData=[]);this._showGridLines();this._completeAction(i)},_removeFrozenTemplate:function(){this.getContent().find(".e-content").empty();var i=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),r=n(document.createElement("tbody"));i.append(this.getHeaderTable().find("colgroup").clone()).append(r);this.getContent().find(".e-content").html(i);this.setGridContentTable(i)},_showGridLines:function(){var n=this.model.gridLines;n!="both"&&this.getContent().addClass(n!="none"?"e-"+n+"lines":"e-hidelines")},_showHeaderGridLines:function(){var n=this.model.gridLines;n!="both"&&this.getHeaderContent().addClass(n!="none"?"e-"+n+"lines":"e-hidelines")},_newungroup:function(n){n.requestType=="ungrouping"?this._ungroup(n):this.getContentTable().find("tbody").empty().first().append(this._getEmptyTbody())},setFormat:function(){for(var f,r,u,i=[],n=0;n<this.model.columns.length;n++)this.model.columns[n].type=="date"&&i.push(this.model.columns[n]);if(i.length>0&&!t.isNullOrUndefined(this.model.currentViewData))for(n=0,f=this.model.currentViewData.length;n<f;n++)for(r=0;r<i.length;r++)u=t.getObject(i[r].field,this.model.currentViewData[n]),/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(u)&&t.createObject(i[r].field,new Date(u),this.model.currentViewData[n])},_completeAction:function(i){var s,e,f,l,h,c,r,u,o;if(this.model.editSettings.editMode.indexOf("dialog")!=-1&&(i.requestType=="save"||i.requestType=="cancel")&&n("#"+this._id+"_dialogEdit").data("ejDialog")&&n("#"+this._id+"_dialogEdit").ejDialog("close"),this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"||(this.model.isEdit=!1),this._confirmedValue=!1,t.Grid.Actions.Grouping==i.requestType&&t.isNullOrUndefined(i.columnName)||i.requestType=="refresh"&&this._LastColumnUnGroup){this._LastColumnUnGroup=!1;return}i.columnSortDirection!="ascending"&&i.columnSortDirection!="descending"||t.isNullOrUndefined(i.columnName)||(s=this.getColumnByField(i.columnName),this.model.allowSorting&&this.model.allowMultiSorting?this._scolumns.push(s.field):this._gridSort=s.field);i.requestType!="beginedit"&&i.requestType!="add"&&(!this.model.allowScrolling||!this.initialRender||this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this.setWidthToColumns();(i.requestType=="save"||i.requestType=="cancel"||i.requestType=="delete")&&(this._isAddNew=!1,this.model.isResponsive&&this.model.minWidth&&this.windowonresize());this.initialRender||!(t.Grid.Actions.UnGrouping==i.requestType||this.model.groupSettings.groupedColumns.length>0)||n("#"+this._id+"EditForm").length||this._recalculateIndentWidth();t.Grid.Actions.Paging==i.requestType||t.Grid.Actions.BatchSave==i.requestType?this._refreshGridPager():t.Grid.Actions.Sorting==i.requestType&&this.model.allowSorting||t.Grid.Actions.Refresh==i.requestType||t.Grid.Actions.Cancel==i.requestType?(t.gridFeatures.sort&&this.getHeaderTable()!==null&&this._sortCompleteAction(i),this.model.allowPaging&&(e=this.getPager().ejPager("option"),this._currentPage(e.currentPage),delete e.currentPage,n.extend(this.model.pageSettings,e),delete this.model.pageSettings.masterObject,this._refreshGridPager()),!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i)):t.Grid.Actions.Delete==i.requestType||t.Grid.Actions.Save==i.requestType||t.Grid.Actions.Search==i.requestType?(this._editEventTrigger(i),!this.initialRender&&(this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0)&&this._refreshScroller(i),this.model.allowPaging&&this._refreshPagerTotalRecordsCount()):t.Grid.Actions.Filtering==i.requestType?this._filterCompleteAction():t.Grid.Actions.BeginEdit==i.requestType||t.Grid.Actions.Add==i.requestType?this._editCompleteAction(i):(t.Grid.Actions.Grouping==i.requestType||t.Grid.Actions.Ungrouping==i.requestType)&&this["_"+i.requestType+"CompleteAction"](i);(this.model.toolbarSettings.showToolbar||(this.model.allowSorting||this.model.allowFiltering)&&this.model.enableResponsiveRow)&&this.refreshToolbar();!this.initialRender&&this.model.showSummary&&this.model.summaryRows.length>0&&(this.model.currentViewData.length?(this.element.children(".e-gridfooter").length||this._renderGridFooter().insertAfter(this.getContent()),i.requestType=="beginedit"||i.requestType=="add"||(this._refreshGridFooterColGroup(),this._createSummaryRows(this.getFooterTable()))):this.element.children(".e-gridfooter").remove());!this.initialRender&&t.gridFeatures.selection&&(this.getContent().find("td.e-selectionbackground").length||this._setCurrentRow(i.requestType),i.requestType=="cancel"&&n(this.getRowByIndex(this.model.selectedRowIndex)).attr("aria-selected","true").find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").addClass("e-selectionbackground e-active"),i.requestType!="virtualscroll"&&this.clearColumnSelection()&&n(this.getHeaderTable().find("th.e-headercell")).removeClass("e-columnselection"));this.model.editSettings.editMode=="batch"&&this.refreshBatchEditMode();(!this.initialRender&&(this.model.allowScrolling||this.model.isResponsive)&&(this._checkScrollActions(i.requestType)||this.model.editSettings.editMode.indexOf("inline")!=-1&&i.requestType=="beginedit")||this.model.scrollSettings.virtualScrollMode=="continuous"&&i.requestType=="virtualscroll")&&(this.model.isResponsive&&this.model.minWidth?this.windowonresize():this._refreshScroller(i));this.model.scrollSettings.virtualScrollMode=="normal"&&i.requestType=="virtualscroll"&&this.getContent().find("div:first").scrollLeft(this.getScrollObject().scrollLeft());this._customPop!=null&&i.requestType!="sorting"&&this._customPop.hide();!this.model.allowScrolling||this.initialRender||this.model.scrollSettings.enableVirtualization||this.model.isResponsive&&this._isHeightResponsive||this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell");this.model.allowGrouping&&this.model.showSummary&&this._refreshGroupSummary();t.Grid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length>0&&this._groupingCompleteAction(i);t.Grid.Actions.Refresh==i.requestType&&!this.initialRender&&this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length<1&&this._ungroupingCompleteAction(i);this.model.allowGrouping&&(f=this.element.children(".e-groupdroparea"),f.length>0&&f.removeClass("e-default").removeClass("e-active"),this.model.groupSettings.groupedColumns.length>0?f.addClass("e-active"):f.addClass("e-default"));this.model.textWrapSettings&&this._setTextWrap();i.requestType==t.Grid.Actions.Reorder&&this.model.showColumnChooser&&(l=n("#"+this._id+"ccDiv").data("ejDialog"),l.isOpened()&&n("#"+this._id+"_ccTail").first().remove(),h=0,t.isNullOrUndefined(this.element.find(".e-ccButton").outerHeight())||(h+=this.element.find(".e-ccButton").outerHeight()),this.element.find(".e-ccButton").first().remove(),n("#"+this._id+"ccDiv_wrapper").remove(),this.element.css("margin-top",parseInt(this.element.css("margin-top"),10)-h),this._renderColumnChooser());this.initialRender&&i.requestType=="grouping"&&(i={requestType:"refresh"});(this._isUngrouping||this._columnChooser)&&i.requestType=="refresh"||(this._trigger("actionComplete",i),this._isUngrouping=!1,this._columnChooser=!1);(!this._isUngrouping&&!this.initialRender||this._showHideColumns||this._columntemplaterefresh)&&this._trigger("refresh");this.model.editSettings.showAddNewRow&&this.model.editSettings.editMode=="normal"&&(this.initialRender||this.getContentTable().find("tr.e-addedrow").length!=0||this.element.find(".e-gridcontent").find("tr").length==0||this._startAdd(),i.requestType=="searching"&&this.element.find(".e-gridtoolbar").find("li#"+this._id+"_search input").focus());(t.Grid.Actions.BeginEdit==i.requestType||t.Grid.Actions.Add==i.requestType)&&n.isFunction(n.validator)&&this.setValidation();this.initialRender||(this.model._groupingCollapsed=[]);this._updateDataSource&&this._gridRecordsCount&&(c=this.model.editSettings.showAddNewRow?this.model.currentViewData[1]:this.model.currentViewData[0],t.isNullOrUndefined(c)||(this._initColumns(c),this.model.allowFiltering&&this._renderFilterDialogs(),this._updateDataSource=!1));this.model.columnLayout!="fixed"||this.model.isEdit||this.setWidthToColumns();this.model.allowRowDragAndDrop&&this._rowsDragAndDrop();!this._isLocalData&&this.model.allowScrolling&&this.element.width()!=0&&this.refreshScrollerEvent();!this.initialRender&&this._enableCheckSelect&&(r=this.checkSelectedRowsIndexes[this._currentPage()-1],u=this.getHeaderTable().find(".e-headercheckcelldiv .e-checkselectall"),this._selectAllCheck||this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&this.selectedRowsIndexes.length==this._gridRecordsCount||u.prop("checked",!1),!this._isMapSelection&&r&&r.length>this._gridRows.length&&r.splice(this._gridRows.length,r.length-this._gridRows.length),this._isMapSelection?this._mappingSelection():i.requestType!="paging"&&i.requestType!="save"&&i.requestType!="beginedit"&&i.requestType!="cancel"?this.checkSelectedRowsIndexes=[]:r&&r.length&&this.selectRows(r),this.model.currentViewData!=null&&this.model.currentViewData.length==0?this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").hide():this.getHeaderTable().find(".e-headercelldiv .e-checkselectall").show(),this._selectAllCheck&&(o=u.prop("checked")^this.selectedRowsIndexes.length==this.model.currentViewData.length,this.model.groupSettings.groupedColumns.length&&(o=!o),u[0].checked=o?u[0].checked:!u[0].checked))},_getDataIndex:function(n,t){for(var i,u,f=0,r=0,e=n.length;r<e;r++){for(i=0,u=this._primaryKeys.length;i<u;i++)if(this._checkPrimaryValue(n[r][this._primaryKeys[i]],t[this._primaryKeys[i]],this._primaryKeys[i]))break;else{i==u-1&&(f=1);continue}if(f)return r}return-1},_checkPrimaryValue:function(n,t,i){return this.getColumnByField(i).type=="string"&&(n=n.trim()),n!=t?!0:!1},_eventBindings:function(){var a=this.model.scrollSettings.frozenColumns>0?this._gridRows[0].length:this._gridRows.length,e=0,h,c=this.model.pageSettings.pageSize,i,r,u,o,f,s,l;if(t.gridFeatures.common&&this._refreshUnboundTemplate(this.getContentTable()),this._gridRecordsCount!=0&&(this.model.queryCellInfo!=null||this.model.rowDataBound!=null||this.model.mergeCellInfo!=null||this.model.templateRefresh!=null))for(i=0;i<a;i++){if(r=null,e=i,this.model.scrollSettings.allowVirtualScrolling&&i<c)if(this.model.scrollSettings.enableVirtualization){if(r=n(this._gridRows).eq(i),u=parseInt(n(r).attr("name"),32),n.inArray(u,this._queryCellView)!=-1)continue;this._virtualLoadedRecords[u]&&(o=this._virtualLoadedRecords[u][i%this._virtualRowCount]);e=u*this._virtualRowCount+i%this._virtualRowCount}else{for(f=0;f<this._cloneQuery.queries.length;f++)h=this._cloneQuery.queries[f].fn=="onPage"&&this._cloneQuery.queries[f].e.pageIndex-1;s=c*h;s!=0&&(r=this.getContentTable().find("tr[name="+s+"]").eq(i),e=r.index())}else this.model.scrollSettings.enableVirtualization&&(r=n(this._gridRows).eq(i));if(r=r||this.getRowByIndex(e),r.hasClass("e-virtualrow")||t.isNullOrUndefined(this._currentJsonData[i]||o))break;l=this.model.scrollSettings.enableVirtualization?o:this._currentJsonData[i];this._rowEventTrigger(r,l)}},_rowEventTrigger:function(i,r){var u={row:i,data:r},s,e,f,o;if(this._trigger("rowDataBound",u),s=i.cells,e=n(i).find(".e-rowcell"),this.model.queryCellInfo!=null||this.model.mergeCellInfo!=null||this.model.templateRefresh!=null)for(f=0;f<e.length;f++)u={cell:e[f],data:r,text:e[f].innerHTML},o=this._getForeignKeyData(u.data),n(e[f]).hasClass("e-rowcell")&&(u.column=this.model.columns[f]),t.isNullOrUndefined(o)||(u.foreignKeyData=o),this.model.allowCellMerging==!0&&(this._cellMerging(u),this._trigger("mergeCellInfo",u)),this._trigger("queryCellInfo",u),n(e[f]).hasClass("e-templatecell")&&(u={cell:e[f],column:this.model.columns[f],data:r,rowIndex:n(i).index()},this._trigger("templateRefresh",u))},setWidthToColumns:function(){var f=this.getContentTable().children("colgroup").find("col"),h=this.getHeaderTable().children("colgroup").find("col"),s=[],e=this.element.width(),l=0,a=0,w=0,y=!t.isIOSWebView()&&this.getBrowserDetails(),g,nt,rt,ut,p,k,c,ht,o,i,d;for(this.model.groupSettings.groupedColumns.length&&!this.model.allowScrolling&&this.model.groupSettings.showGroupedColumn&&y&&y.browser=="msie"&&parseInt(y.version,10)>8&&f.first().css("width",3e3/e+"%"),t.isNullOrUndefined(this.model.detailsTemplate)||(g=this.model.groupSettings.groupedColumns.length,nt=this.model.groupSettings.groupedColumns.length!=0?1:0,f.eq(nt).css("width",this._detailsOuterWidth),h.eq(g).css("width",this._detailsOuterWidth)),this._detailColsRefresh(),f=this._$headerCols,h=this._$contentCols,i=0;i<h.length;i++){if(this.model.allowResizeToFit&&this.model.columns[i].width===r){hCellIndex=this.model.groupSettings.groupedColumns.length?i+this.model.groupSettings.groupedColumns.length:i;var tt=this._resizer._getContentWidth(i),b=this.getHeaderTable().find(".e-headercelldiv").eq(hCellIndex),it=this._resizer._getHeaderContentWidth(b);w=this.model.editSettings.editMode=="normal"&&(this.model.isEdit||this._isAddNew)?y.browser=="firefox"?parseInt(f[i].style.width,10):f.eq(i).width():(tt>it?tt:it)+parseInt((b.css("padding-left"),10)+(b.css("padding-right"),10));this.columnsWidthCollection[i]=w;a+=this.model.columns[i].visible?w:0}else a+=this.model.columns[i].visible?parseInt(this.model.columns[i].width,10):0;this.model.columns[i].priority&&h.eq(i).addClass("e-table-priority-"+this.model.columns[i].priority);t.isNullOrUndefined(this.columnsWidthCollection[i])?this.model.allowScrolling&&s.push(this.model.columns[i]):(f.eq(i).width(this.columnsWidthCollection[i]),h.eq(i).width(this.columnsWidthCollection[i]))}for(rt=s.filter(function(n){return!n.visible}).length,ut=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell"),i=0;i<s.length;i++)if(s[i].visible){var v=t.isNullOrUndefined(s[i].field)?this.getColumnIndexByField(s[i].field):this.getColumnIndexByHeaderText(s[i].headerText),ft=ut.eq(v)[0],u=ft.getBoundingClientRect().width;t.isNullOrUndefined(u)&&(u=ft.offsetWidth);parseInt(u)<15&&(u=(e/this.model.columns.length).toFixed(2),bSize=(e/(this.model.scrollSettings.buttonSize||18)/100).toFixed(2),u=u-bSize);f.eq(v).css("width",u+"px");h.eq(v).css("width",u+"px");this.model.columns[v].width=u;this.columnsWidthCollection[v]=parseFloat(u)}if(rt||(this._undefinedColsCollection=null),this.model.columnLayout=="fixed"){this.model.scrollSettings&&this.model.scrollSettings.frozenColumns==0&&(this.getHeaderTable().width(a),this.getContentTable().width(a));var ct=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),et=this.getHeaderContent().width()>ct?"addClass":"removeClass",ot=this.getHeaderTable(),st=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(ot=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),st=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0));ot[et]("e-tableLastCell");st[et]("e-tableLastCell")}if(!this.model.allowScrolling&&this.model.allowResizeToFit&&!this.model.isResponsive&&a>e&&(this.model.allowScrolling=!0,this.model.scrollSettings.width=e,this.getHeaderTable().parent().addClass("e-headercontent"),this._renderScroller(),!this.model.scrollSettings.frozenColumns>0&&this.getHeaderTable().width(e)),this.model.isEdit&&(c=f.clone(),this.model.editSettings.showAddNewRow&&(p=this.getContentTable().find(".e-editedrow")),$colGroup=this.model.scrollSettings.frozenColumns>0?this.getContent().find(".gridform").find("colgroup"):!t.isNullOrUndefined(p)&&p.length==1?p.find("colgroup"):n("#"+this._id+"EditForm").find("colgroup"),this.model.scrollSettings.frozenColumns>0&&$colGroup.first().empty().append(c.splice(0,this.model.scrollSettings.frozenColumns)),$colGroup.last().empty().append(c),(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&$colGroup.prepend(this._getIndentCol())),this.model.groupSettings.groupedColumns.length)for(k=this.getContentTable().find(".e-recordtable").children("colgroup"),i=0;i<k.length;i++)c=f.clone(),ht=this._detailsOuterWidth!=null?this._detailsOuterWidth:"30px",(this.model.detailsTemplate!=null||this.model.childGrid!=null)&&c.splice(0,0,n(this._getIndentCol()).width(ht)[0]),k.eq(i).empty().append(c);if(this.model.scrollSettings.frozenColumns>0){for(o=0,i=0;i<this.model.columns.length;i++)o+=this.model.columns[i].visible?parseInt(this.columnsWidthCollection[i],10):0,this.model.scrollSettings.frozenColumns-1==i&&(l=Math.ceil(o));this.element.width(this.model.scrollSettings.width||this.model.width);d=this.element.find(".e-gridcontent").children().first().width();d>o?o=d+(this.getContentTable().height()<this.model.scrollSettings.height&&this.getScrollObject()._vScroll?this.model.scrollSettings.buttonSize:0):o+=this.getHeaderContent().height()<this.model.scrollSettings.height?this.model.scrollSettings.buttonSize:0;this.getContent().find(".e-frozencontentdiv").outerWidth(l).end().find(".e-movablecontentdiv").outerWidth(o-l);this.getHeaderContent().find(".e-frozenheaderdiv").outerWidth(l).end().find(".e-movableheaderdiv").outerWidth(o-l)}!this.initialRender&&this.model.allowResizeToFit&&this.model.allowScrolling&&this.model.scrollSettings.enableVirtualization&&(e=this.getHeaderTable().width()>this.getContentTable().width()?this.getHeaderTable().width():this.getContentTable().width(),this.getContentTable().width(e),this.getHeaderTable().width(e))},_initialEndRendering:function(){var r,i,u;if(this.model.allowRowDragAndDrop&&this._rowsDragAndDrop(),(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?this.element.append(this._renderDialog()):(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&this.element.append(this._renderExternalForm())),(this.model.editSettings.editMode=="batch"||this.model.editSettings.showDeleteConfirmDialog)&&this._renderConfirmDialog(),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&n("#"+this._id+"AlertDialog").length==0&&this._renderAlertDialog(),(this.model.allowMultiSorting||this.model.selectionType=="multiple")&&this._renderMultiTouchDialog(),this.model.scrollSettings.frozenColumns>0&&!this.model.allowScrolling){this.getContent().remove();this.getHeaderTable().eq(1).remove();this._alertDialog.find(".e-content").text(this.localizedLabels.FrozenColumnsScrollAlert);this._alertDialog.ejDialog("open");return}if(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this._createPagerStatusBar(),this._getRowHeights(),this.element.width()!=0&&this.model.allowScrolling)this._renderScroller(),this.model.scrollSettings.frozenRows>0||this.model.scrollSettings.frozenColumns>0||(this.setWidthToColumns(),r=t.isNullOrUndefined(this.getContent().data("ejScroller"))?null:this.getScrollObject(),r!=null&&r.refresh(),this.refreshScrollerEvent());else if((this.model.allowScrolling||this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length)&&this.element.width()<=0){i=this;u=setInterval(function(){if(!t.isNullOrUndefined(i.element)&&i.element.width()>0&&!t.isNullOrUndefined(i.element.width())){if(i.model.allowScrolling&&(i._renderScroller(),!(i.model.scrollSettings.frozenRows>0||i.model.scrollSettings.frozenColumns>0))){i.setWidthToColumns();var n=t.isNullOrUndefined(i.getContent().data("ejScroller"))?null:i.getScrollObject();n!=null&&n.refresh();i.refreshScrollerEvent()}i.model.allowGrouping&&i.model.groupSettings.groupedColumns.length&&i.getHeaderTable().find(".e-grouptopleftcell").width()<=0&&i.getHeaderTable().find(".e-grouptopleftcell").css("width",i.getHeaderTable().find("colgroup col").eq(0).width());i._endRendering();clearInterval(u)}},100);return}this._endRendering()},_endRendering:function(){var n,r,u,i,f;t.isNullOrUndefined(this.model.serverProperties)||(n=this.model.serverProperties._checkSelectedRowsIndexes,this.checkSelectedRowsIndexes=n&&n.length?n:this.checkSelectedRowsIndexes);!t.isNullOrUndefined(this.getContent().data("ejScroller"))&&this.model.allowScrolling&&(r=this.getScrollObject());u=this.model.enableRTL?"e-summaryscroll e-rtl":"e-summaryscroll";this.model.allowScrolling&&this.model.showSummary&&(r._vScroll&&this.element.find(".e-summaryrow.e-scroller").addClass(u),this.getFooterTable()&&this.getFooterTable().find("colgroup").first().replaceWith(this.getHeaderTable().find("colgroup").clone()));this._addMedia();this.model.allowScrolling&&this.model.allowTextWrap&&!this.model.scrollSettings.allowVirtualScrolling&&this.getContent().first().ejScroller("refresh");this.model.scrollSettings.allowVirtualScrolling&&(this._currentPage(1),this._currentPage()!=1||this.model.scrollSettings.enableVirtualization||(this._virtualLoadedRecords[this._currentPage()]=this._currentJsonData),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView():this._refreshVirtualContent(this._currentPage()),this.getContent().first().ejScroller("refresh"),this.getContent().ejScroller("isVScroll")?(this.element.find(".e-gridheader").addClass("e-scrollcss"),this.getHeaderTable().first().width(this.getContentTable().width())):this.element.find(".e-gridheader").removeClass("e-scrollcss"));this.model.allowSelection==!0&&this.model.selectionType=="multiple"&&this._selectedMultipleRows().length>0&&this._selectingMultipleRows(this._selectedMultipleRows());(this._selectedRow()!=-1||this._selectedMultipleRows().length==1)&&(i=this._selectedMultipleRows(),f=i.length?i:this._selectedRow(),this.selectRows(f));!this.model.allowFiltering||this.model.filterSettings.filterType!="filterbar"||this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling||this._createPagerStatusBar();t.gridFeatures.common&&this.rowHeightRefresh();t.gridFeatures.filter&&["menu","excel"].indexOf(this.model.filterSettings.filterType)!=-1&&this._refreshFilterIcon();this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length!=0&&this._recalculateIndentWidth();this.initialRender&&(!this.model.scrollSettings.enableVirtualization||this._gridRows.length<this._virtualRowCount)&&this._addLastRow()},_addLastRow:function(){var r=this.getContentTable().find("tr:last").find("td"),u=0,i;if(this.model.allowScrolling&&!this.model.scrollSettings.allowVirtualScrolling&&!t.isNullOrUndefined(this.model.dataSource)&&!t.isNullOrUndefined(this.getRows())){for(i=0;i<this.getRows().length;i++)u+=n(this.getRows()[i]).height();u<this.getContent().height()-1&&r.addClass("e-lastrowcell")}this.model.scrollSettings.allowVirtualScrolling&&this.getContentTable().height()<this.getContent().height()&&r.addClass("e-lastrowcell")},_addMedia:function(){if(!this.model.enablePersistence&&typeof this.model.scrollSettings.width!="string"&&this.model.scrollSettings.width>0?this._responsiveScrollWidth=this._originalScrollWidth=this.model.scrollSettings.width:this._originalScrollWidth=this.element.width(),typeof this.model.scrollSettings.height!="string"&&this.model.scrollSettings.height>0&&(this._responsiveScrollHiehgt=this.model.scrollSettings.height),this.model.minWidth&&this.model.isResponsive){this._$onresize=n.proxy(this.windowonresize,this);n(window).on("resize",this._$onresize);if(n.isFunction(window.matchMedia)){var t=window.matchMedia("(max-width: 768px)");this._mediaStatus=t.matches}this.windowonresize()}},_getNoncontentHeight:function(){var n=0;return t.isNullOrUndefined(this.getHeaderContent().outerHeight())||(n+=this.getHeaderContent().outerHeight()),this.model.toolbarSettings.showToolbar&&!t.isNullOrUndefined(this.element.find(".e-gridtoolbar").outerHeight())&&(n+=this.element.find(".e-gridtoolbar").outerHeight()),this.model.allowPaging&&!t.isNullOrUndefined(this.element.find(".e-pager").outerHeight())&&(n+=this.element.find(".e-pager").outerHeight()),this.model.showColumnChooser&&!t.isNullOrUndefined(this.element.find(".e-ccButton").outerHeight())&&(n+=this.element.find(".e-ccButton").outerHeight()),this.model.allowGrouping&&this.model.groupSettings.showDropArea&&!t.isNullOrUndefined(this.element.find(".e-groupdroparea").outerHeight())&&(n+=this.element.find(".e-groupdroparea").outerHeight()),this.model.showSummary&&!t.isNullOrUndefined(this.element.find(".e-gridsummary").outerHeight())&&(n+=this.element.find(".e-gridsummary").outerHeight()),n},setDimension:function(n,t){var i=n-this._getNoncontentHeight();this.model.scrollSettings.height=i;this.model.scrollSettings.width=t;this._renderScroller()},_getVisibleColumnsWidth:function(){for(var t=0,n=0;n<this.columnsWidthCollection.length;n++)this.model.columns[n].visible&&(t+=this.columnsWidthCollection[n]);return t},setPhoneModeMaxWidth:function(n){this._gridPhoneMode=n},_mediaQueryUpdate:function(i,r,u,f){var o,s,h,e;if(window.innerWidth<=this._gridPhoneMode&&this.model.enableResponsiveRow){o=this.getContentTable()[0].style;o.removeAttribute?o.removeAttribute("min-width"):o.removeProperty("min-width");s=this.getContent().data("ejScroller");s&&this.getContent().ejScroller("destroy");return}i?(this.model.scrollSettings.width=t.isNullOrUndefined(this._responsiveScrollWidth)?u:Math.min(this._responsiveScrollWidth,u),e=Math.min(f,r)-this._getNoncontentHeight(),e=t.isNullOrUndefined(this._responsiveScrollHiehgt)?e:Math.min(this._responsiveScrollHiehgt,e),(this.element.parent().is("body")&&n(document).height()>e||e>this.element.parent().height())&&this.model.scrollSettings.height!="auto"&&(e-=parseInt(this.element.parent().css("margin-bottom")+1)),e=this.model.scrollSettings.height!="auto"?e:this.model.scrollSettings.height,(this.model.minWidth>u||this.getContentTable().width()>u)&&r>f&&(e=e!="auto"?e+this.model.scrollSettings.buttonSize:e),t.isNullOrUndefined(this.getRows())&&(e="100%"),this.model.scrollSettings.height=this._isHeightResponsive?e:this._initHeight?this._initHeight:this.getContentTable()[0].scrollHeight,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller()):(this.model.scrollSettings.width="100%",t.isNullOrUndefined(this._responsiveScrollWidth)||(this.model.scrollSettings.width=Math.min(this._responsiveScrollWidth,u)),h=Math.min(f,r),e=h-this._getNoncontentHeight(),t.isNullOrUndefined(this._responsiveScrollHiehgt)||(e=Math.min(this._responsiveScrollHiehgt,e)),(this.element.parent().is("body")&&n(document).height()>e||e>this.element.parent().height())&&this.model.scrollSettings.height!="auto"&&(e-=parseInt(this.element.parent().css("margin-bottom"))),e=this.model.scrollSettings.height!="auto"?e:this.model.scrollSettings.height,(!t.isNullOrUndefined(this._responsiveScrollWidth)&&this.model.scrollSettings.width==this._responsiveScrollWidth&&(this.model.minWidth>this._responsiveScrollWidth||this._getVisibleColumnsWidth()>this._responsiveScrollWidth)||t.isNullOrUndefined(this._responsiveScrollWidth)&&(this.getRowHeight()==e||this._isHeightResponsive)&&this.getContentTable().width()>u)&&(e=e!="auto"?e+this.model.scrollSettings.buttonSize:e),t.isNullOrUndefined(this.getRows())&&(e="100%"),this.getContent().height()>=e&&!this._resize&&!this.initialRender&&typeof this.model.scrollSettings.width=="string"&&(this.model.scrollSettings.width=u),this.model.scrollSettings.height=this._isHeightResponsive?e:this._initHeight?this._initHeight:this.getContentTable()[0].scrollHeight,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller());this._resize=!1},windowonresize:function(i){var r,e,u,s;if(!this.element.is(":visible")){r=this;r._isVisible=!0;e=setInterval(function(){r.element.is(":visible")&&r._isVisible&&(r.windowonresize(),r._isVisible=!1,clearInterval(e))},100);return}i&&i.type=="resize"&&(this._resize=!0);this.model.scrollSettings.width=this._responsiveScrollWidth;this.element.css("width","100%");this.getContentTable().width("100%");this.getHeaderTable().width("100%");this.getContentTable().css("minWidth",this.model.minWidth);this.getContent().find(".e-vscrollbar").length==0&&this._isHeightResponsive&&(this.getContent().height("100%"),this.getContent().find(".e-content").height("100%"));this.getBrowserDetails().browser=="msie"&&this.getHeaderTable().css("min-width",this.model.minWidth);u=this.element.width();var h=n(window).height()-this.element.offset().top,l=t.isNullOrUndefined(this.getRows())?1:this.getRows().length,c=this.element.parent().is(n("body"))||this.element.parent().height()==n("body").height()||["","auto"].indexOf(this.element.parent()[0].style.height)!=-1,f=this.getContentTable()[0].scrollHeight+this._getNoncontentHeight(),o=c?h:this.element.parent().height();f+=parseInt(this.element.parent().css("margin-top"));s=this.model.minWidth>u||o<=f;this._mediaQueryUpdate(s,o,u,f)},_removeMedia:function(){n(window).off("resize",this._$onresize);this.getContentTable().css("min-width","");this.getHeaderTable().css("min-width","");this.getContentTable().css("width","");this.model.scrollSettings.width="auto";this.getContent().data("ejScroller")&&this.getContent().ejScroller("destroy")},_getRowHeights:function(){var n=this.getRows(),t;if(n!==null)if(this._rowHeightCollection=[],n[1]!==r&&n[1].length&&(this.model.scrollSettings.frozenColumns>0&&n[0]!==r||n[0]!==r&&typeof n[0].item!="undefined"&&typeof n[0].length=="number"&&typeof n[1].item!="undefined"&&typeof n[1].length=="number"))for(frotrs=n[0],movtrs=n[1],t=0;t<frotrs.length;t++)this._rowHeightCollection[t]=frotrs[t].offsetTop>=movtrs[t].offsetTop?frotrs[t].offsetTop:movtrs[t].offsetTop;else for(t=0;t<n.length;t++)this._rowHeightCollection[t]=n[t].offsetTop;return this._rowHeightCollection},_getEmptyTbody:function(){var i=t.buildTag("td.emptyrecord",this.localizedLabels.EmptyRecord,{},{colSpan:this.model.columns.length-this._hiddenColumns.length});return n(document.createElement("tr")).append(i)},_getIndentCol:function(){return t.buildTag("col","",{width:"30px"})},_createSortElement:function(){return t.buildTag("span.e-icon"," ")},_createSortNumber:function(n,i){return i.css("text-align")=="right"?t.buildTag("span.e-number",n,{color:"white","font-size":"9px","text-align":"center",float:"left"}):t.buildTag("span.e-number",n,{color:"white","font-size":"9px","text-align":"center",float:"right"})},_onFocusIn:function(){var n=this;setTimeout(function(){n.element.removeClass("e-activefocusout")},0)},_onFocusOut:function(){var n=this;setTimeout(function(){n.element.addClass("e-activefocusout")},0)},_wireEvents:function(){this._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",this._clickHandler);this._on(this.element,n.isFunction(n.fn.tap)&&this.model.enableTouch?"tap":"click",".e-gridheader",this._mouseClickHandler);this.model.enableFocusout&&(this._on(this.element,"focusout",this._onFocusOut),this._on(this.element,"focusin",this._onFocusIn));t.gridFeatures.common&&(this._on(this.element,n.isFunction(n.fn.doubletap)&&this.model.enableTouch?"doubletap":"dblclick",".e-gridcontent > div:first",this._recorddblClickHandler),this.model.rightClick&&this._on(this.element,"contextmenu",this._rightClickHandler),this._on(this.element,"click",".e-gridcontent",this._recordClick),this._enableRowHover(),this.model.enableTouch?this._on(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._touchGrid,this)):this.element.addClass("e-touch"),this._on(this.element,"mousedown",".e-gridheader",this._headerMouseDown),this.model.allowRowDragAndDrop&&this.model.selectionType=="multiple"&&this._on(this.element,"touchstart mousedown",".e-gridcontent",this._contentMouseDown),this._on(this.element,"mouseover mouseleave",".e-gridheader:first",this._headerHover),this._on(this.element,t.eventType.mouseMove,".e-gridheader:first",this._headerHover),this.model.allowResizeToFit&&this._on(this.element,"dblclick",".e-gridheader",this._headerdblClickHandler),this.model.allowResizing&&(this._on(this.element,t.eventType.mouseMove,".e-gridheader:first",this._mouseMove),this._on(this.element,"mouseup",this._mouseUp)),this.model.allowKeyboardNavigation&&(this.element[0].tabIndex=this.element[0].tabIndex==-1?0:this.element[0].tabIndex,this.element[0].accessKey=!t.isNullOrUndefined(this.element[0].accessKey)&&this.element[0].accessKey!=""?this.element[0].accessKey:"e",this._on(this.element,"keyup",this._keyDownHandler)));t.gridFeatures.edit&&(this._enableEditingEvents(),this._on(this.element,"click",".e-gridcontent .e-unboundcelldiv",this._unboundClickHandler));this.model.allowGrouping&&(this._enableGroupingEvents(),this._on(this.element,"mouseenter mouseleave",".e-groupdroparea,.e-groupheadercell",this._dropAreaHover));this._enableFilterEvents()},_enableFilterEvents:function(){if((this.model.allowMultiSorting||this.model.selectionType=="multiple"||this.model.allowFiltering)&&this._on(n(document),"mousedown",this._docClickHandler),this.model.allowFiltering){var t=this;this._off(this.element,"keyup",".e-filterbar input")._on(this.element,"keyup",".e-filterbar input",this._filterBarHandler);this._on(this.element,"focus click",".e-filterbar",this._filterBarClose)}},_docClickHandler:function(i){var r=!t.isIOSWebView()&&this.getBrowserDetails(),u=n(i.target);this._customPop!=null&&this.element.find(i.target).length==0&&this._customPop.hide();this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this.model.filterSettings.filterType=="excel"?this._$colType&&(n(i.target).find(".e-grid.e-dlgcontainer").length>1||n(i.target).find(".e-excelfilter").length>1)&&(r&&r.browser=="msie"?i.target.tagName!="BODY"&&(this.isExcelFilter?this._excelFilter.closeXFDialog(i):this._closeFilterDlg()):this._isExcelFilter?this._excelFilter.closeXFDialog(i):this._closeFilterDlg()):u.hasClass("e-filtertext")||u.hasClass("e-cancel")||this.getFilterBar().find(".e-cancel").addClass("e-hide"))},_mouseClickHandler:function(i){var d=n(i.target),u,lt=this.commonQuery.clone(),g,rt,ut,h,ft,o,f,s,at,ot,bt,k,st,vt,tt,yt,y,nt,c,it,pt,ht,ti,ct;if((d.closest(".e-grid").length==0||d.closest(".e-grid").attr("id")===this._id)&&this.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow").css("cursor")!="col-resize")if(u=n(i.target).is(".e-ascending, .e-descending")?n(i.target.parentNode):d.hasClass("e-groupheadercell")?d.children("div"):n(i.target),this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this._isExcelFilter)&&(n.fx.off=!0,this._closeFDialog(),n.fx.off=!1),this.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive").removeClass("e-active"),u.hasClass("e-headercelldiv")||u.hasClass("e-headercell")&&n.inArray("column",this.model.selectionSettings.selectionMode)==-1||!u.hasClass("e-togglegroupbutton")&&u.closest(".e-headercelldiv").length&&n.inArray(u[0].tagName,["SELECT","INPUT","TEXTAREA"])==-1||u.closest(".e-groupheadercell").length&&n(i.target).is(".e-ascending, .e-descending")){if(!this.model.allowSorting||t.gridFeatures.sort===r)return;u=u.hasClass("e-headercelldiv")||u.closest(".e-groupheadercell").length?u:u.hasClass("e-headercell")?u.find(".e-headercelldiv"):u.closest(".e-headercelldiv");h=u.attr("ej-mappingname");g=t.sortOrder.Ascending;this._$prevSElementTarget=this._$curSElementTarget;this._$curSElementTarget=u;g=u.find("span").hasClass("e-ascending")?t.sortOrder.Descending:t.sortOrder.Ascending;i.pointerType=="touch"&&this._customPop!=null&&!this._customPop.is(":visible")&&this._customPop.find(".e-sortdirect").hasClass("e-spanclicked")&&this._customPop.show();i.pointerType=="touch"&&this._customPop!=null&&(this._customPop.find(".e-rowselect").is(":visible")||!this._customPop.find(".e-sortdirect").hasClass("e-spanclicked"))&&this.model.allowMultiSorting&&(rt=u.offset(),this._customPop.removeAttr("style"),this._customPop.offset({left:rt.left,top:rt.top-this.getHeaderTable().find(".e-columnheader").height()-u.height()}).find(".e-sortdirect").show().end().find(".e-rowselect").hide().end().show());this.model.allowMultiSorting&&(i.ctrlKey||this._enableSortMultiTouch)&&(this.multiSortRequest=!0);i.shiftKey&&n.inArray(h,this.model.groupSettings.groupedColumns)==-1&&(this._removeSortedColumnFromCollection(h),this.multiSortRequest=!0,h=null,this.sortColumn(h,g));t.isNullOrUndefined(h)||this.sortColumn(h,g)}else if(u.hasClass("e-togglegroupbutton")&&this.model.allowGrouping)ut=u.parent().attr("ej-mappingname"),u.hasClass("e-togglegroup")&&this.groupColumn(ut),u.hasClass("e-toggleungroup")&&this.ungroupColumn(ut);else if((u.hasClass("e-filtericon")||u.hasClass("e-filteredicon")||u.hasClass("e-responsivefilterColDiv")||u.parent().hasClass("e-responsivefilterColDiv"))&&(h=u.parent().find(".e-headercelldiv").attr("ej-mappingname")||u.attr("ej-mappingname")||n(u.parent()).attr("ej-mappingname"),this._$prevFieldName=this._$curFieldName,currentColumn=this.getColumnByField(h),ft={True:this.localizedLabels.True,False:this.localizedLabels.False},this.model.allowFiltering)){if(o=this,this.model.filterSettings.filterType=="excel"&¤tColumn.filterType=="menu"&&n.inArray(currentColumn.type,this._menuColTypes)==-1?(this._renderFilters(currentColumn),this._menuColTypes.push(currentColumn.type)):(this.model.filterSettings.filterType=="menu"&¤tColumn.filterType=="excel"||this.model.filterSettings.filterType=="excel"&¤tColumn.filterType!="menu")&&n.inArray(currentColumn.type,this._excelColTypes)==-1&&(this._renderFilters(currentColumn),this._excelColTypes.push(currentColumn.type)),n.each(this.model.columns,function(n,t){t.field==h&&(o._$colType=t.type,o._$curFieldName=t.field,o._$colFormat=t.format,o._$filterType=t.filterType,o._$colForeignKeyField=t.foreignKeyField?t.foreignKeyField:t.field,o._$colForeignKeyValue=t.foreignKeyValue,o._$colDropdownData=t.dataSource)}),(this.model.filterSettings.filterType=="menu"&&this._$filterType!="excel"||this.model.filterSettings.filterType=="excel"&&this._$filterType=="menu")&&(f="#"+this._id+"_"+this._$colType+"Dlg",this._$menuDlgIsOpen=!0,this._$colType=="string"?this._$colForeignKeyValue&&this._$colDropdownData?n("#"+this._id+"_acString").ejAutocomplete({fields:{text:o._$colForeignKeyValue,key:o._$colForeignKeyField},dataSource:o._$colDropdownData}):n("#"+this._id+"_acString").ejAutocomplete({fields:{text:o._$curFieldName,key:this._getIdField()},dataSource:this._dataSource()}):this._$colType=="date"?this._$colFormat!=r?(this._$colFormat=this._$colFormat.replace("{0:","").replace("}",""),n(f).find(".e-datewidget .e-datepicker").ejDatePicker({dateFormat:this._$colFormat.replace("{0:","").replace("}","")})):n(f).find(".e-datewidget .e-datepicker").ejDatePicker({dateFormat:t.preferredCulture(this.model.locale).calendars.standard.patterns.d}):this._$colType=="datetime"&&(this._$colFormat!=r&&(this._$colFormat=this._$colFormat.replace("{0:","").replace("}",""),n(f).find(".e-datetimewidget input").ejDateTimePicker({dateFormat:this._$colFormat.replace("{0:","").replace("}","")})),this._setFilterFieldValues(f))),this._mediaStatus=document.documentElement.clientWidth<768,this.model.isResponsive&&this._mediaStatus){var e=this,l=t.buildTag("div.e-resFilterDialogHeaderDiv"),wt=t.buildTag("div.labelRes","<span>Filter<\/span>");n(".e-filterMenuBtn").length>0&&n(".e-filterMenuBtn").remove();var et=t.buildTag("div.e-filterMenuBtn"),b=t.buildTag("input.e-resposnsiveFilterBtnLeft e-flat e-btnsub"),p=t.buildTag("input.e-resposnsiveFilterBtnRight e-flat e-btncan");if(l.append(wt),l.css("width","100%"),s=n(f).css("padding-left","0px"),u.parent().hasClass("e-responsivefilterColDiv")&&u.hasClass("e-filternone"))o._fltrClrHandler(),u.remove(),n("#responsiveFilter").css("display","block");else if(this.element.css("display","none"),setTimeout(function(){n("#responsiveFilter").css("display","none");0}),this._isExcelFilter||this._$filterType=="excel"){if(this._excelDlg=f="#"+this._id+this._$colType+"_excelDlg",t.isNullOrUndefined(s.find(".e-resFilterDialogHeaderDiv")[0])){b.ejButton({text:"OK",type:"button",click:function(){e._responsiveFilterClose();e._excelFilter._openedFltr=n(e._excelDlg);e._excelFilter._fltrBtnHandler();e._setResponsiveFilterIcon()}});p.ejButton({text:"Cancel",type:"button",click:function(){n(f).css("display","none");o.element.css("display","block")}});n(f).children().not(".e-searchcontainer").remove();var kt=this._excelFilter,k=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"}),st=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"});k.click(function(t){n.proxy(e._closeDivIcon(t),this)});l.append(k.append(st));y=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:f.slice(1),gridEle:!0});nt=t.buildTag("span.e-icon e-resIcon e-responisveCustomFilter","",{},{closeDialogue:f.slice(1),gridEle:!0});y.click(function(t){n.proxy(e._closeDivIcon(t),this)});o._$colType!="boolean"&&l.append(y.append(nt));n(f).css("padding","0px");c=n(f).css("height",n(window).height()-2);c.css("width",n(window).width()-2);ht=c.find(".e-searchcontainer .e-searchbox").css("margin-top","10px");ht.children().css("margin-top","10px");var dt=c.find(".e-checkboxlist"),gt=n(window).width()*(97/100),ni=n(window).height()*(65/100);n(c.find(".e-searchcontainer")).addClass("e-resSearch");it=c.find(".e-resSearch .e-btncontainer").remove();it.find("input:first").css("width","45.6%");it.find("input:first").addClass("e-resposnsiveFilterBtnLeft");it.find("input:last").addClass("e-resposnsiveFilterBtnRight");c.find(".e-excelLabel").remove();pt=t.buildTag("div.e-excelLabel","Order Id",{"font-weight":"bold","margin-top":"10px"});ht=c.find(".e-searchcontainer");pt.insertAfter(c.find(".e-searchcontainer .e-searchbox"));c.prepend(l);n(f).append(et.append(b).append(p));dt.ejScroller({height:ni,width:gt}).ejScroller("refresh")}this._excelFilter.openXFDialog({field:h,enableResponsiveRow:!0,displayName:currentColumn.headerText,dataSource:this._dataSource(),query:lt,position:{X:v,Y:w},dimension:{height:n(window).height(),width:n(window).width()},cssClass:"resFilter",type:this._$colType,format:this._$colFormat,localizedStrings:ft});n(f).insertAfter(this.element);t.isNullOrUndefined(n(f).parents(".e-grid")[0])||n(f).remove();y.click(function(){var y,w,i,u,k,h,d,c,g,l,nt,tt,r,it,rt,a,v,s;n(e._excelDlg).css("display","none");y=n(window).height()-5;w=n(window).width();kt._openCustomFilter("equal");i=f=n("#"+e._id+e._$colType+"_CustomFDlg").addClass("e-responsviesExcelFilter");t.isNullOrUndefined(i.find(".e-resFilterDialogHeaderDiv")[0])&&(u=t.buildTag("div.e-resFilterDialogHeaderDiv"),k=t.buildTag("div.labelRes","<span>Custom Filter<\/span>"),u.append(k),h=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",openDialogue:e._excelDlg.slice(1)}),d=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",openDialogue:e._excelDlg.slice(1)}),h.click(function(){i.css("display","none");e.model.enableResponsiveRow?n("#responsiveFilter").css("display","block"):e.element.css("display","block")}),u.append(h.append(d)),c=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",gridEle:!0}),g=t.buildTag("span.e-icon e-resIcon e-responisveClose","",{},{closeDialogue:e._id+e._$colType+"_CustomFDlg",gridEle:!0}),u.append(c.append(g)),c.click(function(){i.css("display","none");e.element.css("display","block")}),i.prepend(u),i.insertAfter(e.element),i.find(".e-dlgfields").css("width","100%"),l=i.find(".e-dlgfields:first").css("width","92%").css("margin-left","6%"),l.css("margin-top","4%"),nt=i.find(".e-dlgfields").find(".e-fieldset legend").text(),tt=t.buildTag("div.e-responsiveLabelDiv",nt,{"margin-left":"6%"}),tt.insertAfter(l),r=i.find(".e-dlgfields").find(".e-fieldset").find("table").css("width","61%"),i.find(".e-dlgfields").find(".e-fieldset").replaceWith(r),it=r.parent("div").addClass("e-responsiveExcelFilterFieldDiv"),rt=r.find(".e-dropdownlist"),r.find(".e-dropdownlist").each(function(t,i){var u=n(i).ejDropDownList("model.dataSource"),r=n(window).width()*(40/100);n(i).ejDropDownList("destroy").ejDropDownList({width:r,popupWidth:r+"px",dataSource:u})}),r.find(".e-autocomplete").each(function(t,i){var r=n(i).ejAutocomplete("model.dataSource"),u=n(window).width()*(40/100);n(i).ejAutocomplete("destroy").ejAutocomplete({width:u,dataSource:r.dataSource,fields:r.fields})}),r.find(".e-datepicker").each(function(t,i){var u=n(i).ejDatePicker("model.dataSource"),r=n(window).width()*(40/100);n(i).ejDatePicker("destroy").ejDatePicker({width:r})}),a=b.clone(),v=p.clone(),a.ejButton({text:"OK",type:"button",click:function(){e._excelFilter._openedFltr=i;e._excelFilter._fltrBtnHandler();i.hasClass("e-dlgcustom")&&i.ejDialog("close");e._setResponsiveFilterIcon();e.element.css("display","block")}}),v.ejButton({text:"Cancel",type:"button",click:function(){i.ejDialog("close");o.element.css("display","block")}}),i.append(et.clone().append(a).append(v)),s=i.find(".e-dlgfields .e-btncontainer").remove(),s.find("input:first").addClass("e-resposnsiveFilterBtnLeft"),s.find("input:first").css("width","45.6%"),s.find("input:last").addClass("e-resposnsiveFilterBtnRight"));e.element.css("display","none");i.ejDialog({enableModal:!1,height:y,width:w,position:{X:0,Y:0},enableResize:!1,showHeader:!1}).ejDialog("open")});ti=t.buildTag("div")}else at=this.model.enableResponsiveRow?"OK":"Filter",ot=this.model.enableResponsiveRow?"Cancel":"Clear",b.ejButton({text:at,type:"button",click:n.proxy(this._fltrBtnHandler,this)}),p.ejButton({text:ot,type:"button",click:function(){ot=="Clear"&&(o.element.css("display","block"),o._fltrClrHandler());n(f).css("display","none");p.hasClass("e-resposnsiveFilterBtnRight")&&o.element.css("display","block")}}),u.parent().hasClass("e-responsivefilterColDiv")&&u.hasClass("e-filternone")?(o._fltrClrHandler(),u.remove()):(s.addClass("e-resMenuFltr"),s.css("height",n(window).height()-1).css("width",n(window).width()-2),s.find(".e-operator").addClass("e-resFilterOperator"),s.find(".e-value").addClass("e-resFilterOperator"),bt=s.find(".e-dlgBtns").remove().addClass("e-filterMenuBtn"),s.append(et.append(b).append(p)),t.isNullOrUndefined(s.find(".e-resFilterDialogHeaderDiv")[0])&&(s.insertAfter(this.element),k=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"}),st=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:f.slice(1),openDialogue:"responsiveFilter"}),k.click(function(){s.css("display","none");e.model.enableResponsiveRow?n("#responsiveFilter").css("display","block"):e.element.css("display","block")}),l.append(k.append(st)),y=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:f.slice(1),gridEle:!0}),nt=t.buildTag("span.e-icon e-resIcon e-responisveClose","",{},{closeDialogue:f.slice(1),gridEle:!0}),y.click(function(){s.css("display","none");e.element.css("display","block")}),vt=n(s.find(".e-value").find("input:last")),o._$colType=="string"&&(tt=n(s.find(".e-value").find("input:last")).ejAutocomplete("model"),vt.ejAutocomplete("destroy").ejAutocomplete({enableDistinct:!0,dataSource:tt.dataSource,fields:tt.fields,width:tt.width,focusIn:function(){var n=this.element.closest(".e-filterDialoge").find(".e-dropdownlist");this.model.filterType=n.val()}})),l.append(y.append(nt)),s.prepend(l)),s.find(".e-responsiveLabelDiv").remove(),yt=t.buildTag("div.e-responsiveLabelDiv","",{"margin-left":"5%","font-size":"17px","margin-top":"5%"}).append(t.buildTag("span",this.getHeaderTextByFieldName(h),{"font-weight":"bold"})),yt.insertAfter(s.find(".e-resFilterDialogHeaderDiv")),s.fadeIn(100,function(){}))}else{n(f).hasClass("e-resMenuFltr")&&(n(f).remove(),this._renderFilterDialogs(),f="#"+this._id+"_"+this._$colType+"Dlg");n(f).ejDialog({position:{X:"",Y:""}});var oi=n(document).width(),a=document.documentElement.clientWidth<800?200:250,v=u.position().left+18,w=u.position().top+2,ii=n("#"+this._id).width();u.closest(".e-headercell").css("position")=="relative"&&(v=u.offset().left+15,w=u.offset().top+20);ct="e-filterdialoglarge";a=this._isExcelFilter&¤tColumn.filterType!="menu"&&!t.isNullOrUndefined(this._excelFilter._dialogContainer)?this._excelFilter._dialogContainer.width():a;var ri=this.element.offset().left+this.element.width()-u.offset().left,ui=a-ri,fi=u.offset().left-this.element.offset().left,ei=a-fi;u.offset().left+18+a>ii&&ui>ei&&(v=v-a);a==200&&(ct="");t.isNullOrUndefined(this._$colType)||(this.model.filterSettings.filterType=="menu"&&this._$filterType!="excel"||this.model.filterSettings.filterType=="excel"&&this._$filterType=="menu"?(v=v-n("#"+this._id).offset().left,w=w-n("#"+this._id).offset().top,n(f).ejDialog({position:{X:v,Y:w},width:a,cssClass:ct}).ejDialog("open")):this._excelFilter.openXFDialog({field:h,displayName:currentColumn.headerText,dataSource:this._dataSource(),query:lt,position:{X:v,Y:w},type:this._$colType,format:currentColumn.format,foreignKey:currentColumn.foreignKeyField,foreignKeyType:currentColumn.originalType,foreignKeyValue:currentColumn.foreignKeyValue,foreignDataSource:currentColumn.dataSource,localizedStrings:ft}))}this._setFilterFieldValues(f);this._$colType=="number"&¤tColumn.serverType!=r?n(f).find(".e-numerictextbox").ejNumericTextbox({width:"100%",decimalPlaces:0}):this._$colType=="number"&&n(f).find(".e-numerictextbox").ejNumericTextbox({width:"100%",decimalPlaces:2});this._$prevColType=this._$colType;this._$fDlgIsOpen=!0}},_responsiveFilterClose:function(){this.element.css("display","block")},_clickHandler:function(i){var r=n(i.target),o=n("[id$='ccDiv'].e-grid.e-columnChooser"),s,w=n("#"+this._id+"EditForm"),h,u,f,c,e,l,b,a,k,v,y,p,d,g;if(o.length)for(c=!0,e=0;e<o.length;e++)(r.parents(".e-ccButton").length||r.hasClass("e-ccButton"))&&(c=n(i.target).closest(".e-grid").attr("id")+"ccDiv"!=o[e].id),l=n("#"+o[e].id).ejDialog("instance"),l.isOpened()&&c&&(l.close(),n(".e-columnChoosertail").remove(),n(".e-columnChoosertailAlt").remove());if((!r.hasClass("e-button")||!(r.hasClass("e-disable")||r.prop("disabled")))&&r.closest(".e-grid").attr("id")===this._id&&!r.closest("#"+this._id+"EditForm").length){if(r.hasClass("e-rowcell")||r.closest("td").is(".e-rowcell")||r.hasClass("e-headercell")&&i.clientY-r.offset().top<r.height()/4||r.parents(".e-headercheckcelldiv").length){if(this._bulkEditCellDetails.cancelSave){this._bulkEditCellDetails.cancelSave=!1;return}if(this.model.editSettings.editMode=="batch"&&n.isFunction(n.validator)&&w.length&&w.validate().errorList.length>0)return;this.model.editSettings.editMode=="batch"&&this.element.focus();h=r.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0;b=r.closest(".e-rowcell").index()!=-1?r.closest(".e-rowcell").index():r.closest(".e-headercell").index()-this.model.groupSettings.groupedColumns.length;u=r.hasClass("e-rowcell")?r.index()-h:b-h;u=this.model.detailsTemplate!=null||this.model.childGrid!=null?u-1:u;this.model.scrollSettings.frozenColumns&&(r.closest(".e-movableheaderdiv").length||r.closest(".e-movablecontentdiv").length)&&(u=u+this.model.scrollSettings.frozenColumns);f=this.getIndexByRow(r.closest("tr"));this._bulkEditCellDetails.columnIndex=u;this._bulkEditCellDetails.rowIndex=f;this.model.allowSelection&&t.gridFeatures.selection&&(a=this._enableCheckSelect&&r.parent(".e-checkcelldiv").length?!0:!1,r.hasClass("e-checkselectall")&&(this._selectAllCheck=!0,k=this.model.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling?this._gridRecordsCount:this.model.allowPaging?this.model.currentViewData.length:this._gridRows.length,this.selectRows(0,k-1,r)),this.model.selectionType=="multiple"&&((i.ctrlKey||this._enableSelectMultiTouch)&&(this.multiSelectCtrlRequest=!0),i.shiftKey&&(this.multiSelectShiftRequest=!0,this._allowcellSelection&&f>-1&&this.selectCells([[f,[u]]]),this._allowrowSelection&&f>-1&&(!this._enableCheckSelect||a)&&this.selectRows(this._previousIndex,this.getIndexByRow(r.closest("tr")),r),this._selectedRow(this.getIndexByRow(r.closest("tr"))),this._allowcolumnSelection&&r.hasClass("e-headercell")&&!r.hasClass("e-stackedHeaderCell")&&i.clientY-r.offset().top<r.height()/4&&this.selectColumns(this._previousColumnIndex,u)),i.pointerType=="touch"&&this._customPop!=null&&!this._customPop.is(":visible")&&this._customPop.find(".e-rowselect").hasClass("e-spanclicked")&&this.model.selectionSettings.selectionMode=="row"&&this._customPop.show(),i.pointerType=="touch"&&this._customPop!=null&&(this._customPop.find(".e-sortdirect").is(":visible")||!this._customPop.find(".e-rowselect").hasClass("e-spanclicked"))&&this.model.selectionType=="multiple"&&(this._customPop.removeAttr("style"),v=r.offset(),this._customPop.offset({top:0,left:0}).offset({left:v.left,top:v.top-this.getRowHeight()-r.height()}).find(".e-sortdirect").hide().end().find(".e-rowselect").show().end().show())),this.multiSelectShiftRequest||(this._allowcellSelection&&f>-1&&(y=this._checkCellSelectionByRow(f,u),(this.model.selectionSettings.enableToggle&&this.selectedRowCellIndexes.length==1&&this.selectedRowCellIndexes[0].cellIndex.length==1||i.ctrlKey&&this.model.selectionType=="multiple")&&y!=-1&&this.selectedRowCellIndexes.length>0&&this.selectedRowCellIndexes[0].cellIndex.length>0?this.clearCellSelection(y.rowIndex,u):this.selectCells([[f,[u]]])),this._allowrowSelection&&f>-1&&(p=this.getIndexByRow(r.closest("tr")),this._enableCheckSelect&&(this.multiSelectCtrlRequest=!0),this.model.scrollSettings.enableVirtualization&&(d=f%this._virtualRowCount,g=parseInt(n(r).closest("tr").attr("name"),32),p=g*this._virtualRowCount-(this._virtualRowCount-d)),(!this._enableCheckSelect||a)&&(this.model.selectionSettings.enableToggle&&!this._enableCheckSelect&&this.getSelectedRecords().length==1&&n.inArray(this.getIndexByRow(r.closest("tr")),this.selectedRowsIndexes)!=-1?this.clearSelection(p):this.selectRows(this.getIndexByRow(r.closest("tr")),null,r)),!this._enableCheckSelect||i.ctrlKey||this._enableSelectMultiTouch||(this.multiSelectCtrlRequest=!1)),this._allowcolumnSelection&&r.hasClass("e-headercell")&&!r.hasClass("e-stackedHeaderCell")&&i.clientY-r.offset().top<r.height()/4&&(this.model.selectionSettings.enableToggle&&this.selectedColumnIndexes.length==1&&n.inArray(u,this.selectedColumnIndexes)!=-1?this.clearColumnSelection(u):this.selectColumns(u)),this.multiSelectCtrlRequest=!1),this.multiSelectShiftRequest=!1);s=this._bulkEditCellDetails.columnIndex>=0?this.model.columns[this._bulkEditCellDetails.columnIndex].field:null;r.closest(".e-rowcell").length&&!t.isNullOrUndefined(s)&&(this._tabKey=!1,this.model.editSettings.allowEditing&&this.model.editSettings.editMode==t.Grid.EditMode.Batch&&this.editCell(n.inArray(r.closest("tr").get(0),this._excludeDetailRows()),s))}(r.hasClass("e-rowselect")||r.hasClass("e-sortdirect"))&&(r.hasClass("e-spanclicked")?(r.removeClass("e-spanclicked"),r.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!1),r.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!1),this._customPop.hide()):(r.addClass("e-spanclicked"),r.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!0),r.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!0)));this._selectAllCheck=!1;t.gridFeatures.common&&this.expandCollapse(r);r.is(".e-filtericon")&&r.closest(".e-detailrow").length!=0&&i.preventDefault();this._$fDlgIsOpen&&this.model.allowFiltering&&(this.model.filterSettings.filterType=="menu"||this._isExcelFilter)&&!r.is(".e-filtericon")&&r.closest(".e-dlgcontainer").length!=1&&this._closeFDialog();this.model.allowSearching&&this._searchBar!=null&&(r.is(this._searchBar.find(".e-cancel"))?this._searchBar.find("input").val(""):i.target.id==this._id+"_searchbar"?this._searchBar.find(".e-cancel").removeClass("e-hide"):this._searchBar.find(".e-cancel").hasClass("e-hide")||this._searchBar.find(".e-cancel").addClass("e-hide"))}},_checkCellSelectionByRow:function(t,i){for(var r=0;r<this.selectedRowCellIndexes.length;r++)if(this.selectedRowCellIndexes[r].rowIndex==t)break;return r!=this.selectedRowCellIndexes.length&&n.inArray(i,this.selectedRowCellIndexes[r].cellIndex)!=-1?this.selectedRowCellIndexes[r]:-1},_persistState:function(n){this.model.enablePersistence&&this._isHeightResponsive&&(n._isHeightResponsive=this._isHeightResponsive)},_restoreState:function(n){this.model.enablePersistence&&n._isHeightResponsive&&(this._isHeightResponsive=n._isHeightResponsive)},_destroy:function(){var u,e,t,f,i,r;if(this.element.off(),this.element.find(".e-gridheader").find(".e-headercontent,.e-movableheader").add(this.element.find(".e-gridcontent").find(".e-content,.e-movablecontent")).off("scroll"),u=n("#"+this._id+"EditForm"),u.length){for(e=u.find(".e-field"),f=0;f<e.length;f++)t=n(e[f]),t.hasClass("e-datetimepicker")?t.ejDateTimePicker("destroy"):t.hasClass("e-datepicker")?t.ejDatePicker("destroy"):t.hasClass("e-dropdownlist")&&t.ejDropDownList("destroy");u.remove()}this._confirmDialog&&this._confirmDialog.ejDialog("destroy");this.element.find(".e-dropdownlist").ejDropDownList("model.dataSource",[]);this.model.showColumnChooser&&(n("#"+this._id+"ccDiv").ejDialog("destroy"),n("#"+this._id+"ccDiv").remove(),n("#"+this._id+"_ccTail").remove(),n("#"+this._id+"_ccTailAlt").remove());this.model.allowFiltering&&this.model.filterSettings.filterType=="excel"&&this._excelFilter.resetExcelFilter();this.model.allowReordering&&n(".e-columndropindicator").remove();this.model.allowFiltering&&this.model.filterSettings.filterType=="menu"&&(i=this,n.each(this.model.columns,function(t,u){r=u.type;n("#"+i._id+r+"_ddinput_popup_wrapper").remove();r=="string"?n("#"+i._id+"_stringDlg").find(".e-autocomplete").ejAutocomplete("destroy"):r=="date"?n("#"+i._id+"_dateDlg").find(".e-datepicker").ejDatePicker("destroy"):r=="datetime"?n("#"+i._id+"_datetimeDlg").find(".e-datetimepicker").ejDateTimePicker("destroy"):r=="number"&&n("#"+i._id+"_numberDlg").find(".e-numerictextbox").ejNumericTextbox("destroy")}));this._$onresize&&n(window).off("resize",this._$onresize);this.element.empty().removeClass("e-grid "+this.model.cssClass);this.element.ejWaitingPopup("destroy");this.model.contextMenuSettings.enableContextMenu&&(n("#"+this._id+"_Context").ejMenu("destroy"),n("#"+this._id+"_Context").remove())},_getDeprecatedLocalizedLabel:function(n){if(["OkButton","OKButton"].indexOf(n)!=-1)return this.localizedLabels.OkButton||this.localizedLabels.OKButton},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.gridFeatures.common&&n.extend(t.Grid.prototype,t.gridFeatures.common);t.gridFeatures.edit&&n.extend(t.Grid.prototype,t.gridFeatures.edit);t.gridFeatures.filter&&n.extend(t.Grid.prototype,t.gridFeatures.filter);t.gridFeatures.group&&n.extend(t.Grid.prototype,t.gridFeatures.group);t.gridFeatures.selection&&n.extend(t.Grid.prototype,t.gridFeatures.selection);t.gridFeatures.sort&&n.extend(t.Grid.prototype,t.gridFeatures.sort);t.gridFeatures.dragAndDrop&&n.extend(t.Grid.prototype,t.gridFeatures.dragAndDrop);t.Grid.Locale=t.Grid.Locale||{};t.Grid.Locale["default"]=t.Grid.Locale["en-US"]={EmptyRecord:"No records to display",GroupDropArea:"Drag a column header here to group its column",DeleteOperationAlert:"No records selected for delete operation",EditOperationAlert:"No records selected for edit operation",SaveButton:"Save",OKButton:"OK",CancelButton:"Cancel",EditFormTitle:"Details of ",AddFormTitle:"Add New Record",GroupCaptionFormat:"{{:headerText}}: {{:key}} - {{:count}} {{if count == 1 }} item {{else}} items {{/if}} ",BatchSaveConfirm:"Are you sure you want to save changes?",BatchSaveLostChanges:"Unsaved changes will be lost. Are you sure you want to continue?",ConfirmDelete:"Are you sure you want to Delete Record?",CancelEdit:"Are you sure you want to Cancel the changes?",PagerInfo:"{0} of {1} pages ({2} items)",FrozenColumnsViewAlert:"Frozen columns should be in grid view area",FrozenColumnsScrollAlert:"Enable allowScrolling while using frozen Columns",FrozenNotSupportedException:"Frozen Columns and Rows are not supported for Grouping, Row Template, Detail Template, Hierarchy Grid and Batch Editing",Add:"Add",Edit:"Edit",Delete:"Delete",Update:"Update",Cancel:"Cancel",Done:"Done",Columns:"Columns",SelectAll:"(Select All)",PrintGrid:"Print",ExcelExport:"Excel Export",WordExport:"Word Export",PdfExport:"PDF Export",StringMenuOptions:[{text:"StartsWith",value:"StartsWith"},{text:"EndsWith",value:"EndsWith"},{text:"Contains",value:"Contains"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],NumberMenuOptions:[{text:"LessThan",value:"LessThan"},{text:"GreaterThan",value:"GreaterThan"},{text:"LessThanOrEqual",value:"LessThanOrEqual"},{text:"GreaterThanOrEqual",value:"GreaterThanOrEqual"},{text:"Equal",value:"Equal"},{text:"NotEqual",value:"NotEqual"}],PredicateAnd:"AND",PredicateOr:"OR",Filter:"Filter",FilterMenuCaption:"Filter Value",FilterbarTitle:"'s filter bar cell",MatchCase:"Match Case",Clear:"Clear",ResponsiveFilter:"Filter",ResponsiveSorting:"Sort",Search:"Search",DatePickerWaterMark:"Select date",NumericTextBoxWaterMark:"Enter value",EmptyDataSource:"DataSource must not be empty at initial load since columns are generated from dataSource in AutoGenerate Column Grid",ForeignKeyAlert:"The updated value should be a valid foreign key value",True:"true",False:"false",UnGroup:"Click here to ungroup",AddRecord:"Add Record",EditRecord:"Edit Record",DeleteRecord:"Delete Record",Save:"Save",Grouping:"Group",Ungrouping:"Ungroup",SortInAscendingOrder:"Sort In Ascending Order",SortInDescendingOrder:"Sort In Descending Order",NextPage:"Next Page",PreviousPage:"Previous Page",FirstPage:"First Page",LastPage:"Last Page",EmptyRowValidationMessage:"Atleast one field must be updated",NoResult:"No Matches Found"};t.Grid.Actions={Paging:"paging",Sorting:"sorting",Filtering:"filtering",BeginEdit:"beginedit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Grouping:"grouping",Ungrouping:"ungrouping",Refresh:"refresh",Reorder:"reorder",Search:"searching",BatchSave:"batchsave",VirtualScroll:"virtualscroll"};t.Grid.SummaryType={Average:"average",Minimum:"minimum",Maximum:"maximum",Count:"count",Sum:"sum",TrueCount:"truecount",FalseCount:"falsecount",Custom:"custom"};t.Grid.EditMode={Normal:"normal",Dialog:"dialog",DialogTemplate:"dialogtemplate",Batch:"batch",ExternalForm:"externalform",ExternalFormTemplate:"externalformtemplate",InlineForm:"inlineform",InlineTemplateForm:"inlineformtemplate"};t.Grid.PrintMode={AllPages:"allpages",CurrentPage:"currentpage"};t.Grid.ResizeMode={NextColumn:"nextcolumn",Control:"control",Normal:"normal"};t.Grid.Rowposition={Top:"top",Bottom:"bottom"};t.Grid.FormPosition={BottomLeft:"bottomleft",TopRight:"topright"};t.Grid.ClipMode={Ellipsis:"ellipsis",Clip:"clip",EllipsisWithTooltip:"ellipsiswithtooltip"};t.Grid.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker"};t.Grid.UnboundType={Edit:"edit",Save:"save",Delete:"delete",Cancel:"cancel"};t.Grid.ToolBarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",Search:"search",PrintGrid:"printGrid",ExcelExport:"excelExport",WordExport:"wordExport",PdfExport:"pdfExport"};t.Grid.FilterType={Menu:"menu",FilterBar:"filterbar",Excel:"excel"};t.Grid.FilterBarMode={Immediate:"immediate",OnEnter:"onenter"};t.Grid.SelectionType={Single:"single",Multiple:"multiple"};t.Grid.ColumnLayout={Auto:"auto",Fixed:"fixed"};t.Grid.GridLines={Both:"both",None:"none",Horizontal:"horizontal",Vertical:"vertical"};t.Grid.VirtualScrollMode={Normal:"normal",Continuous:"continuous"};t.Grid.SelectionMode={Row:"row",Cell:"cell",Column:"column"};t.Grid.WrapMode={Both:"both",Content:"content",Header:"header"};t.Grid.exportAll=function(n,i){t.Grid.prototype["export"](n,null,!0,i)};t.SqlDataSourceAdaptor=(new t.UrlAdaptor).extend({init:function(){this.initialRender=!0},processQuery:function(n,i,r){var h=t.UrlAdaptor.prototype.processQuery(n,i,r),u=t.parseJSON(h.data),e={},f,o,s,c;if(u.param)for(f=0;f<u.param.length;f++)o=u.param[f],s=Object.keys(o)[0],e[s]=o[s];return e.value=u,c=JSON.stringify({type:"SqlData",args:u}),this.initialRender==!1&&__doPostBack("",c),this.initialRender=!1,{data:JSON.stringify(e),result:n.dataSource.json,ejPvtData:h.ejPvtData,count:n.dataSource.json.length}},processResponse:function(n,i,u,f,e){var h=n.ejPvtData||{},l=n.groupDs,v,a,s,o,w;if(f&&f.getResponseHeader("Content-Type")&&f.getResponseHeader("Content-Type").indexOf("xml")!=-1&&n.nodeType==9)return u._requiresCount?{result:[],count:0}:[];if(v=JSON.parse(n.data),v&&v.action==="batch"&&n.added)return e.added=n.added,e;if(h&&h.aggregates&&h.aggregates.length){var c=h.aggregates,s={},y,p={};for(("count"in n)&&(s.count=n.count),n.result&&(s.result=n.result),n.aggregate&&(n=n.aggregate),o=0;o<c.length;o++)y=t.aggregates[c[o].type],y&&(p[c[o].field+" - "+c[o].type]=y(n,c[o].field));s.aggregates=p;n=s}if(h&&h.groups&&h.groups.length){for(a=h.groups,s={},("count"in n)&&(s.count=n.count),n.aggregates&&(s.aggregates=n.aggregates),n.result&&(n=n.result),o=0;o<a.length;o++)w=null,t.isNullOrUndefined(l)||(l=t.group(l,a[o])),n=t.group(n,a[o],h.aggregates,w,l);return s.count!=r?s.result=n:s=n,s}return n}})}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.gridResize=function(t){this.$headerTable=t.getHeaderTable();this.gridInstance=t;this._colMinWidth=15;this._$visualElement=n();this._currentCell=-1;this._allowStart=!1;this._oldWidth=null;this._orgX=null;this._orgY=null;this._extra=null;this._expand=!1;this._target=null;this._cellIndex=-1};t.gridFeatures.gridResize.prototype={_mouseHover:function(t){var r,h,o,c,s;if(!this._$visualElement.is(":visible")&&(this._allowStart=!1,n(t.target).is(".e-headercelldiv")&&(t.target=t.target.parentNode),r=n(t.target),n(t.target).hasClass("e-filtericon")&&(n(t.target).css("cursor")=="col-resize"||n(t.target).closest("tr").css("cursor")=="col-resize")&&(n(t.target).css("cursor","pointer"),n(t.target).closest("tr").css("cursor","pointer")),r.hasClass("e-headercell"))){var f=t.target,u=f.getBoundingClientRect(),i=0,e=0;(t.type="mousemove")?(i=t.clientX,e=t.clientY):(t.type="touchmove")?(i=evt.originalEvent.changedTouches[0].clientX,e=evt.originalEvent.changedTouches[0].clientY):(t.type="MSPointerMove")&&(i=t.originalEvent.clientX,e=t.originalEvent.clientY);h=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.getHeaderContent().width()+this.gridInstance.element.children(".e-gridheader").find(".e-columnheader").offset().left:this.gridInstance.getHeaderTable().width()+this.gridInstance.element.children(".e-gridheader").find(".e-columnheader").offset().left;(i>=u.left+document.documentElement.scrollLeft+f.offsetWidth-5||i<=u.left+3)&&i<h&&i>=u.left&&e<=u.top+document.documentElement.scrollTop+t.target.offsetHeight?(o=i>u.left+3?n(t.target).find(".e-headercelldiv"):n(t.target).prevAll("th:visible:first").find(".e-headercelldiv"),c=window.pageXOffset||document.documentElement.scrollTop||document.body.scrollTop,s=this.gridInstance.element.find(".e-headercell").not(".e-detailheadercell").offset().left+10-c,(this.gridInstance.model.enableRTL&&i<=s||!this.gridInstance.model.enableRTL&&i>=s)&&((this.gridInstance.model.showStackedHeader||o.length)&&n.inArray(n(o).attr("ej-mappingname"),this.gridInstance._disabledResizingColumns)==-1?(this.gridInstance.model.showStackedHeader&&n(r.parents("thead")).find("tr").css("cursor","col-resize"),this.gridInstance.model.showStackedHeader||r.parent().css("cursor","col-resize"),this._currentCell=n(t.target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell:visible").index(f):this.gridInstance.getHeaderContent().find(".e-headercell:visible").not(".e-stackedHeaderCell,.e-detailheadercell").index(f),this.gridInstance.model.enableRTL&&(this._currentCell=this._currentCell-1),this._allowStart=!0):(r.parent().css("cursor","pointer"),this._currentCell=-1))):(this.gridInstance.element.find(".e-columnheader").css("cursor","pointer"),this._currentCell=-1)}},_start:function(t,i){var o=this.gridInstance.getHeaderTable().find(".e-columnheader"),s,f,r,h,e,u;if(f=n(this._target).hasClass("e-stackedHeaderCell")?o.find(".e-headercell").not(".e-hide"):o.find(".e-headercell").not(".e-stackedHeaderCell,.e-hide"),this._currentCell!=-1&&this._currentCell<f.length&&(r=f[this._currentCell]),typeof r!="undefined")if(h=r.getBoundingClientRect(),s=this._tableY=h.top+parseInt(navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollTop:document.documentElement.scrollTop),this._allowStart){if(e=this._$visualElement=n(document.createElement("div")),_height=this.gridInstance.element.find(".e-gridcontent").first().height()+this.gridInstance.element.find(".e-gridheader").height(),this.gridInstance.model.showStackedHeader&&this.gridInstance.model.stackedHeaderRows.length>0){var c=this.gridInstance.getHeaderTable().find("tr.e-columnheader"),a=c.length,l=n(this._target).parent("tr")[0].rowIndex;for(u=0;u<l;u++)_height=_height-n(c[u]).height()}e.addClass("e-reSizeColbg").appendTo(this.gridInstance.element).attr("unselectable","on").css("visibility","hidden");this.gridInstance._resizeTimeOut=setTimeout(function(){e.css({visibility:"visible",height:_height+"px",cursor:"col-resize",left:t,top:s,position:"fixed"})},100);this._oldWidth=r.offsetWidth;this._orgX=t;this._orgY=i;this._extra=t-this._orgX;this._expand=!0}else this._currentCell=-1},_mouseMove:function(n){if(this._expand){var t=0,i=0;(n.type="mousemove")?(t=n.clientX,i=n.clientY):(n.type="touchmove")?(t=evt.originalEvent.changedTouches[0].clientX,i=evt.originalEvent.changedTouches[0].clientY):(n.type="MSPointerMove")&&(t=n.originalEvent.clientX,i=n.originalEvent.clientY);navigator.userAgent.indexOf("WebKit")!=-1&&(t=n.pageX,i=n.pageY);t+=document.documentElement.scrollLeft;n.preventDefault();this._moveVisual(t)}else this._mouseHover(n)},_getCellIndex:function(t){var o=n(t._target),i=t._target,f=i.getBoundingClientRect(),e=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,r,u;return this._orgX<f.left+5+e&&(i=n(i).prevAll(":visible:first")[0]),r=i.cellIndex,u=r,t.gridInstance.model.groupSettings.groupedColumns.length&&(u=r-t.gridInstance.model.groupSettings.groupedColumns.length),u},_reSize:function(i){var ti=this,s,a,g,v,d,ht,h,nt,f,tt,y,l,rt,w,k,r,ot;if(this._initialTableWidth=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.getHeaderTable().first().parent().width()+this.gridInstance.getHeaderTable().last().parent().width():this.gridInstance.getHeaderTable().parent().width(),this.gridInstance.model.enableRTL&&(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell=this._currentCell-1:this.gridInstance.model.enableRTL||this._getResizableCell(),a=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?this.gridInstance.getHeaderTable().find("thead"):n(this._target).parents("thead"),this._currentCell!=-1&&this._expand){this._expand=!1;var dt=n(this._target).hasClass("e-stackedHeaderCell")?a.find(".e-headercell:not(.e-detailheadercell)").filter(":visible"):a.find(".e-headercell:not(.e-detailheadercell,.e-stackedHeaderCell)").filter(":visible"),st=dt[this._currentCell],c=st.offsetWidth,u=i-this._orgX;if(this.gridInstance.model.enableRTL&&(u=-u),parseInt(u)+parseInt(c)>this._colMinWidth){if(u!=0&&a.css("cursor","default"),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"&&(g=this.gridInstance.getHeaderTable().find("colgroup").find("col"),t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),g=this.gridInstance._$headerCols),v=g.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length),d=v.width()),this._resizeColumnUsingDiff(c,u),s=this.gridInstance.element.find(".e-gridcontent").first(),ht=s.find("div").hasClass("e-content"),h=!t.isIOSWebView()&&this.gridInstance.getBrowserDetails(),h&&h.browser=="msie"&&this.gridInstance.model.allowScrolling&&(nt=this.gridInstance.getContentTable().width(),f=this.gridInstance._calculateWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?(this.gridInstance.getHeaderTable().last().width(f-this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()),this.gridInstance.getContentTable().last().width(f-this.gridInstance.getContent().find(".e-frozencontentdiv").width()),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().last().width(f-this.gridInstance.getFooterContent().find(".e-frozenfootertdiv").width())):f>nt&&(this.gridInstance.getHeaderTable().width(f),this.gridInstance.getContentTable().width(f),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().width(f)),parseInt(h.version,10)>8&&this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length&&(f>nt?(this.gridInstance.getContentTable().width(f),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",2e3/s.find("table").first().width()+"%")):(this.gridInstance.getContentTable().css("width","100%"),this.gridInstance._groupingAction(!0),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",(this.gridInstance.getHeaderTable().find("colgroup").find("col").first().width()/s.find("table").first().width()*100).toFixed(2)+"%"))),this.gridInstance.getHeaderTable().parent().scrollLeft(s.find(".e-content").scrollLeft()-1)),this.gridInstance._colgroupRefresh(),this.gridInstance.model.allowTextWrap&&this.gridInstance.rowHeightRefresh(),this.gridInstance.model.groupSettings.groupedColumns.length&&!this.gridInstance.model.isEdit&&this.gridInstance._recalculateIndentWidth(),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)!="normal")if(t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"){tt=this.gridInstance.getHeaderTable().find("colgroup").find("col");y=this.gridInstance.getContentTable().find("colgroup").find("col");t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),tt=this.gridInstance._$headerCols,y=this.gridInstance._$contentCols);var e=this._currentCell+1,ct=tt.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)?e:e+this.gridInstance.model.groupSettings.groupedColumns.length),o=ct.width()+(d-v.width());if(o<this._colMinWidth&&(o=this._colMinWidth),ct.width(o),this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length){var lt=this.gridInstance.getContentTable().find(".e-recordtable"),p=lt.find("colgroup"),at=this.gridInstance.getVisibleColumnNames().length;for(this.gridInstance.getContentTable().find(".e-detailrow").length&&(p=p.not(lt.find(".e-detailrow").find("colgroup")).get()),r=0;r<p.length;r++)l=n(p[r]).find("col").filter(this._diaplayFinder),l.length>at&&l.splice(0,l.length-at),n(l[e]).width(o)}if(this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){if(e>=0&&e<this.gridInstance.model.scrollSettings.frozenColumns&&this._getFrozenResizeWidth()+u>this.gridInstance.element.find(".e-headercontent").first().width())return;$ContentCol=y.filter(this._diaplayFinder).eq(e)}else $ContentCol=y.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)?e:e+this.gridInstance.model.groupSettings.groupedColumns.length);if($ContentCol.width(o),this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings.frozenColumns>0&&n(st).is(":last-child")&&this.gridInstance.pluginName=="ejGrid"){var it=v.width()-d,vt=this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()+it,yt=this.gridInstance.getHeaderContent().find(".e-movableheaderdiv").width()-it,pt=parseInt(this.gridInstance.getHeaderContent().find(".e-movableheader")[0].style["margin-left"])+it;this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(vt);this.gridInstance.getContent().find(".e-frozencontentdiv").width(vt);this.gridInstance.getHeaderContent().find(".e-movableheaderdiv").width(yt);this.gridInstance.getContent().find(".e-movablecontentdiv").width(yt);this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",pt);this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",pt)}this.gridInstance.model.scrollSettings.frozenColumns>0&&n(this._target).parent("tr").parents("div:first").hasClass("e-frozenheaderdiv")&&(this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(this._newWidth),this.gridInstance.getContent().find(".e-frozencontentdiv").width(this._newWidth))}else this.gridInstance.model.scrollSettings.frozenColumns||(rt=this.gridInstance.getHeaderTable().width(),this.gridInstance.getHeaderTable().css("width",rt+parseInt(u)),this.gridInstance.getContentTable().css("width",rt+parseInt(u)),this.gridInstance.model.scrollSettings.width+=parseInt(u),this.gridInstance.getContent().width()>this.gridInstance.getContentTable().width()?(this.gridInstance.getContentTable().addClass("e-tableLastCell"),this.gridInstance.getHeaderTable().addClass("e-tableLastCell")):(this.gridInstance.getContentTable().removeClass("e-tableLastCell"),this.gridInstance.getHeaderTable().removeClass("e-tableLastCell")));if(h.browser=="msie"||!h||!this.gridInstance.model.allowScrolling||this.gridInstance.model.scrollSettings.frozenColumns!=0||(this.gridInstance.getHeaderTable().width("100%"),this.gridInstance.getContentTable().width("100%"),w=this.gridInstance._calculateWidth(),(w<=this.gridInstance.getContentTable().width()||this.gridInstance.getHeaderTable().width()>this.gridInstance.getContentTable().width())&&(this.gridInstance.getHeaderTable().width(w),this.gridInstance.getContentTable().width(w))),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="default"){var wt=this._currentCell,ut=n(this._target),bt=[],kt=[],o=c+u,ft={};if(this.gridInstance.model.showStackedHeader&&ut.hasClass("e-stackedHeaderCell")){var gt=ut.parent(".e-stackedHeaderRow").index(),ni=ut.text(),et=this.gridInstance.model.stackedHeaderRows[gt].stackedHeaderColumns,b;for(r=0;r<et.length;r++)et[r].headerText==ni&&(b=et[r].column);for(k=b,b instanceof Array||(k=b.split(",")),r=0;r<k.length;r++)ot=this.gridInstance.getColumnIndexByField(k[r]),bt.push(ot),kt.push(this.gridInstance.model.columns[ot]);ft={columnIndex:bt,column:kt,oldWidth:c,newWidth:o}}else ft={columnIndex:wt,column:this.gridInstance.model.columns[wt],oldWidth:c,newWidth:o};this.gridInstance._trigger("resized",ft)}this.gridInstance.model.allowScrolling&&(this.gridInstance.getScrollObject().refresh(this.gridInstance.model.scrollSettings.frozenColumns>0),this.gridInstance.model.isResponsive&&this.gridInstance.model.minWidth&&this.gridInstance.windowonresize(),!ht&&s.find("div").hasClass("e-content")&&this.gridInstance.refreshScrollerEvent(),this.gridInstance._isHscrollcss())}}this._target=null;this._$visualElement.remove();this._expand=!1;this._currentCell=-1;this._allowStart=!1},_getFrozenResizeWidth:function(){for(var t=this.gridInstance.getHeaderTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),i=0,n=0;n<t.length;n++)t.eq(n).css("display")!="none"&&(i+=parseInt(t[n].style.width.replace("px","")));return i},_diaplayFinder:function(){return n(this).css("display")!="none"},_resizeColumnUsingDiff:function(i,r){var vt=this,a,h,v,e,y,nt,r,c,p,o,w,b,tt,at,it,u,l,rt,st,ht,ct,k,f,ut;this._currntCe=this._currentCell;h=this.gridInstance.getHeaderTable().find("colgroup").find("col");v=this.gridInstance.getContentTable().find("colgroup").find("col");t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),h=this.gridInstance._$headerCols,v=this.gridInstance._$contentCols);var s=h.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length),d,ft,yt=h.slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),g=s[0].style.width,et=g.indexOf("%")!=-1,ot=!g||et?n(this._target).outerWidth():g,lt=et?1:i/parseInt(ot);if(a=r=r/lt,e=this._newWidth=parseInt(r)+parseInt(ot),e>0&&r!=0){if(e<this._colMinWidth&&(e=this._colMinWidth),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"&&(y=s.next(),nt=this.gridInstance.model.scrollSettings.frozenColumns&&this._currentCell==this.gridInstance.model.scrollSettings.frozenColumns-1?!0:!1,nt&&(y=h.eq(this.gridInstance.model.scrollSettings.frozenColumns)),(nt||!s.is(":last-child"))&&y.width()+(s.width()-e)<=this._colMinWidth&&(e=s.width()+(y.width()-this._colMinWidth))),r=e-i,this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){if(this._currentCell>=0&&this._currentCell<this.gridInstance.model.scrollSettings.frozenColumns&&this._getFrozenResizeWidth()+r>this.gridInstance.element.find(".e-headercontent").first().width())return;d=v.filter(this._diaplayFinder).eq(this._currentCell)}else d=v.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length);if(this.gridInstance.model.showSummary&&(this._$footerCols=this.gridInstance.getFooterTable().find("colgroup").find("col"),c=this.gridInstance.model.columns.length,this._$footerCols.length>c&&this._$footerCols.splice(0,this._$footerCols.length-c),$footerCols=this._$footerCols,ft=$footerCols.filter(this._diaplayFinder).eq(this._currentCell),ft.outerWidth(e)),n(this._target).parent("tr").hasClass("e-stackedHeaderRow")?this._resizeStackedHeaderColumn(n(this._target).parent("tr"),a,this._currntCe):s.outerWidth(e),n(this._target).parent("tr").hasClass("e-stackedHeaderRow")){if(this.gridInstance.model.groupSettings.groupedColumns.length)for(p=this.gridInstance.getContentTable().find(".e-recordtable"),o=p.find("colgroup"),u=0;u<this._changedcell.length;u++)for(w=this._changedcell[u],b=0;b<o.length;b++)tt=n(o[b]).children().filter(this._diaplayFinder),f=parseInt(a)+parseInt(tt[w].style.width),f<this._colMinWidth&&(f=this._colMinWidth),n(tt[w]).width(f);for(at=this.gridInstance.getContentTable().find("colgroup").find("col").filter(this._diaplayFinder).length,u=0;u<this._changedcell.length;u++)it=this.gridInstance.getContentTable().find("colgroup").find("col").filter(this._diaplayFinder)[this._changedcell[u]],f=parseInt(a)+parseInt(it.style.width),f<this._colMinWidth&&(f=this._colMinWidth),n(it).outerWidth(f),this.gridInstance.model.isEdit&&this.gridInstance.model.allowGrouping&&this.gridInstance.model.groupSettings.groupedColumns.length==0&&($sEditCol=this.gridInstance.getContentTable().find(".gridform").find("colgroup col").filter(this._diaplayFinder)[this._changedcell[u]],n($sEditCol).outerWidth(f))}else{if(this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length){var p=this.gridInstance.getContentTable().find(".e-recordtable"),o=p.find("colgroup"),w=this._currentCell,c=this.gridInstance.getVisibleColumnNames().length;for(this.gridInstance.getContentTable().find(".e-detailrow").length&&(o=o.not(p.find(".e-detailrow").find("colgroup")).get()),u=0;u<o.length;u++)l=n(o[u]).find("col").filter(this._diaplayFinder),l.length>c&&l.splice(0,l.length-c),n(l[w]).width(e)}d.outerWidth(e);this.gridInstance.model.isEdit&&(rt=this.gridInstance.getContentTable().find(".e-editedrow,.e-addedrow"),st=rt.find("table").find("colgroup col"),ht=rt.hasClass("e-addedrow")&&this.gridInstance.model.groupSettings.groupedColumns.length?this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length-1:this._currentCell,ct=st.filter(this._diaplayFinder).eq(ht),ct.outerWidth(e))}if(this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns&&t.getObject("resizeSettings.resizeMode",this.gridInstance.model)!="nextcolumn"&&this.gridInstance.pluginName=="ejGrid"){for(k=this.gridInstance.getContentTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings.frozenColumns),f=0,u=0;u<k.length;u++)f+=k[u].style.display=="none"?0:parseInt(k[u].style.width.replace("px",""));this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(f);ut=this.gridInstance.model.enableRTL?"margin-right":"margin-left";this.gridInstance.getContent().find(".e-frozencontentdiv").width(f).next().css(ut,f+"px");this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(f).next().css(ut,f+"px");this.gridInstance.model.showSummary&&this.gridInstance.getFooterContent().find(".e-frozenfooterdiv").width(f)}this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor","default")}},_resizeStackedHeaderColumn:function(t,i,r){var v,y,f,c,o;this._changedcell=[];var p=this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-detailheadercell"),u=0,e=0,s=p[r],l=n(s).attr("colspan"),w=i/l,a=n(s).parent("tr"),b=a.next(),h=s.cellIndex;for(this.gridInstance.model.groupSettings.showGroupedColumn&&(e=this.gridInstance.model.groupSettings.groupedColumns.length,u+=e);h>e;)h--,v=n(a).children("th").not(".e-detailheadercell")[h],u+=parseInt(n(v).attr("colspan"));for(this._currentCell=u,y=u+parseInt(l),f=u;f<y;f++)c=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder)[f],this._changedcell.push(f-e),o=parseInt(i)+parseInt(c.style.width),o<this._colMinWidth&&(o=this._colMinWidth),n(c).outerWidth(o)},_triggerResizeEvents:function(t,i){var p=this.gridInstance.getHeaderTable().find(".e-columnheader"),b=p.find(".e-headercell").filter(":visible"),o=this._cellIndex,u=n(this._target),l=[],s,f,c,r,v,e;if(col=[],t=="resizeStart"&&(this._orgX=i,o=this._cellIndex=this._getCellIndex(this,i)),s=b[this._currentCell],f=s.offsetWidth,this.gridInstance.model.showStackedHeader&&u.hasClass("e-stackedHeaderCell")){var k=u.parent(".e-stackedHeaderRow").index(),d=u.text(),a=this.gridInstance.model.stackedHeaderRows[k].stackedHeaderColumns,h;for(r=0;r<a.length;r++)a[r].headerText==d&&(h=a[r].column);for(c=h,h instanceof Array||(c=h.split(",")),r=0;r<c.length;r++)v=this.gridInstance.getColumnIndexByField(c[r]),l.push(v),col.push(this.gridInstance.model.columns[v])}if(t=="resizeStart")return e={},e=this.gridInstance.model.showStackedHeader&&u.hasClass("e-stackedHeaderCell")?{columnIndex:l,column:col,target:u,oldWidth:f}:{columnIndex:o,column:this.gridInstance.model.columns[o],target:n(s),oldWidth:f},this.gridInstance._trigger("resizeStart",e);var g=p.find(".e-headercell").not(".e-detailheadercell").filter(":visible"),y=i-this._orgX,w=f+y;return this.gridInstance._colgroupRefresh(),e={},e=this.gridInstance.model.showStackedHeader&&u.hasClass("e-stackedHeaderCell")?{columnIndex:l,column:col,target:n(s),oldWidth:f,newWidth:w,extra:y}:{columnIndex:o,column:this.gridInstance.model.columns[o],target:n(s),oldWidth:f,newWidth:w,extra:y},this.gridInstance._trigger("resizeEnd",e)},_mouseUp:function(n){if(this.gridInstance._resizeTimeOut&&(clearTimeout(this.gridInstance._resizeTimeOut),this.gridInstance._resizeTimeOut=0),this._expand){var i=n.clientX,r=n.clientY;if(navigator.userAgent.indexOf("WebKit")!=-1&&(i=n.pageX,r=n.pageY),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="col-resize"&&this._triggerResizeEvents("resizeEnd",i)){this.gridInstance.element.find(".e-reSizeColbg").remove();return}i+=document.documentElement.scrollLeft;this._reSize(i,r);!t.isNullOrUndefined(this._currntCe)&&this._currntCe>=0&&(this.gridInstance.model.columns[this._currntCe].width=this.gridInstance.columnsWidthCollection[this._currntCe])}},_getResizableCell:function(){var r,i,u,t,f;if(r=n(this._target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderTable().find(".e-columnheader"):this.gridInstance.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow"),i=r.find(".e-headercell").not(".e-hide,.e-detailheadercell"),u=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,!this.gridInstance.model.scrollSettings.frozenColumns||this._currentCell!=this.gridInstance.model.scrollSettings.frozenColumns-1)for(t=0;t<i.length;t++){if(point=i[t].getBoundingClientRect(),f=point.left+u+5,f>this._orgX&&n(i[t]).height()+point.top>=this._orgY){this._currentCell=t-1;return}if(t==i.length-1||this.gridInstance.model.showStackedHeader&&n(this._target).get(0)===i[t]){this._currentCell=t;return}}},_moveVisual:function(n){var t=this.gridInstance.getHeaderContent().find("div").first()[0].getBoundingClientRect();t.left+document.documentElement.scrollLeft+t.width<n||n<t.left+document.documentElement.scrollLeft?this._$visualElement.remove():this._currentCell!=-1&&this._$visualElement.css({left:n,top:this._tableY})},_mouseDown:function(t){var i,r,u;return this._allowStart&&n(t.target).closest("tr").css("cursor")=="col-resize"?(this._target=t.target,i=t.clientX,r=t.clientY,navigator.userAgent.indexOf("WebKit")!=-1&&(i=t.pageX,r=t.pageY-document.body.scrollTop),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="col-resize"&&(n(t.target).is(".e-headercelldiv")&&(t.target=t.target.parentNode),this._target=t.target,this._triggerResizeEvents("resizeStart",i)))?void 0:(u=this,i+=document.documentElement.scrollLeft,t.button!=2&&this._start(i,r),!1):!0},_columnResizeToFit:function(i){var lt=this.gridInstance.getHeaderTable().find(".e-columnheader").filter(function(){return n(this).css("cursor")=="col-resize"}),at,st,d,e,h,v,rt,ht,ct,ut,et,ft,ot,r;if(this.gridInstance.model.allowResizeToFit&<.length){n(i.target).is(".e-headercelldiv")&&(i.target=i.target.parentNode);var y=n(i.target),c,f=0,o=0;if(c=y.hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-detailheadercell"):this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-stackedHeaderCell,.e-detailheadercell"),this._target=y,y.hasClass("e-headercell")){var b=i.target,p=n.inArray(b,c),w=p;this._orgX=i.pageX;this.gridInstance.model.enableRTL?this._currentCell=p:this._getResizableCell();p!=this._currentCell&&(p=w=this._currentCell,b=i.target.previousSibling);var l=c.filter(":visible")[w],s=[],a=[],k=[];if(o=this.gridInstance.model.groupSettings.groupedColumns.length,t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)&&t.isNullOrUndefined(this.gridInstance.model.childGrid)||(o+=1),n(b).parent("tr").hasClass("e-stackedHeaderRow")){for(currentSpan=n(l).attr("colspan"),tr=n(l).parent("tr"),tHeadIndex=l.cellIndex,at=tr.next();tHeadIndex>o;)tHeadIndex--,st=n(tr).children("th")[tHeadIndex],f+=parseInt(n(st).attr("colspan"));d=f+parseInt(currentSpan)}else f=w,d=w+1;var u=0,g=0,nt=0,tt=[],it=[];if(f!=-1)for(e=c.slice(0,f+1).filter(".e-hide").length,h={columnIndex:f+e,column:this.gridInstance.model.columns[f+e],target:y,oldWidth:v},this.gridInstance._trigger("resizeStart",h),r=f;r<d;r++){if(e=c.slice(0,r+1).filter(".e-hide").length,nt=this._getContentWidth(r+e),$cellDiv=this.gridInstance.getHeaderTable().find(".e-headercell:not(.e-hide, .e-stackedHeaderCell)").children(".e-headercelldiv").eq(r),g=this._getHeaderContentWidth($cellDiv),u=g>nt?g:nt,u+=parseInt(($cellDiv.css("padding-left"),10)+($cellDiv.css("padding-right"),10)),v=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder).eq(r+o).width(),u=v>u?u:this._colMinWidth<u?u:this._colMinWidth,rt=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder),(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)&&rt.splice(0,1),rt.eq(r+o).width(u),this.gridInstance.model.groupSettings.groupedColumns.length&&(ht=this.gridInstance.getContentTable().find(".e-recordtable").find("colgroup"),ct=this,n.each(ht,function(t,i){n(i).find("col").filter(ct._diaplayFinder).eq(r).width(u)})),ut=this.gridInstance.getContentTable().find("col").filter(this._diaplayFinder),(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)&&ut.splice(0,1),ut.eq(r+o).width(u),this.gridInstance.model.isEdit)for(ft=this.gridInstance.getContentTable().find(".e-editedrow").find("col"),et=this.gridInstance.element.find(".gridform"),j=0;j<et.length;j++)ft=n(et[j]).find("col"),ft.eq(r+o).width(u);tt.push(this.gridInstance.model.columns[r+e]);it.push(Math.abs(u-v));s.push(r+e);a.push(u);k.push(v);(this.gridInstance.model.scrollSettings.frozenColumns>0||this.gridInstance.model.groupSettings.groupedColumns.length&&this.gridInstance.model.isEdit)&&(ot=r+e,this.gridInstance.columnsWidthCollection[ot]=u,this.gridInstance.setWidthToColumns(),this.gridInstance.model.scrollSettings.frozenColumns<=ot+1&&(this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",u),this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",u)))}for(this.gridInstance._colgroupRefresh(),this.gridInstance._recalculateIndentWidth(),h={columnIndex:s,column:tt,target:l,oldWidth:k,newWidth:a,extra:it},this.gridInstance._trigger("resizeEnd",h),r=0;r<s.length;r++)this.gridInstance.columnsWidthCollection[s[r]]=a[r],this.gridInstance.model.columns[s[r]].width=a[r];h={columnIndex:s,column:tt,target:l,oldWidth:k,newWidth:a,extra:it};this.gridInstance._trigger("resized",h);this.gridInstance.model.summaryRows.length>0&&this.gridInstance._summaryColRrefresh();this.gridInstance._findColumnsWidth()}}},_getContentWidth:function(i){var e=0,r=t.buildTag("span",{},{}),u=this.gridInstance,o,f;return t.isNullOrUndefined(u._gridRows)||(f=u._gridRows,this.gridInstance.model.scrollSettings.frozenColumns&&i>=this.gridInstance.model.scrollSettings.frozenColumns&&(f=f[1],i=i-this.gridInstance.model.scrollSettings.frozenColumns),n.each(f,function(t,f){if(n(f).is(".e-row,.e-alt_row")&&!n(f).is(".e-editedrow")){var s=n(f).find("td.e-rowcell").eq(i),h=n(s).html();u.model.columns[i].commands?r.html(n(h).children()):s.hasClass("e-validError")?r.html(n(h).attr("value")):r.html(h);n(s).html(r);o=s.find("span:first").width();o>e&&(e=o);n(s).html(h)}})),u._refreshUnboundTemplate(this.gridInstance.getContentTable()),e},_getHeaderContentWidth:function(n){var i=0,r=t.buildTag("span",{},{}),u=n.html();return r.html(u),n.html(r),i=n.find("span:first").width(),(this.gridInstance.model.allowFiltering&&this.gridInstance.model.filterSettings.filterType=="menu"||this.gridInstance.model.filterSettings.filterType=="excel")&&(i=i+n.parent().find(".e-filtericon").width()+10),n.html(u),i}}}(jQuery,Syncfusion),function(n,t){t.scheduleFeatures=t.scheduleFeatures||{};var r=function(){return"{{if multiRes == true}}<td class = 'e-horizontalheader'><div class='e-horizontalresheader'>{{:label}}<\/div><\/td>{{else}}{{/if}}<td class='e-horizontaldaterender'><div class='e-horizontaltimecells {{:heightclass}}'><div class='e-headerdays' style='position:absolute;'><table class ='e-table {{:tablelayout}}' cellpadding='0px' cellspacing='0px' style='width:100%;border-collapse:separate;table-layout:fixed;'><tbody>{{if view !== 'month'}}<tr style='width:100%;'> <td>{{if view === 'day'}}<table cellspacing='0px' style='width:100%;'>{{else}}<table class='e-table' cellspacing='0px'>{{/if}}<tbody><tr> {{for cols ~headercellWidth = headercellWidth}}<td class='e-headercells {{:cellToday}} e-horizontalheadertddate'><div class='{{:currentDateClass}} e-horizontalheaderdiv'>{{:currentDay}}<\/div><\/td>{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr><tr style='width:100%;position:absolute;'> <td><table class =' e-table e-horizontaltabletimecell' cellspacing='0px' style='border-collapse:collapse;'><tbody><tr> {{for timeTdCount ~columnvalue =column }}{{for ~name=time ~dayend=timecellclass ~index=#getIndex() }}<td class='e-horizontaltimetd {{:~dayend}}'><div style='width:{{:timeCellWidth}}'><span class ='e-horizontaltimespan'>{{:~name.slice(0,2)}}<\/span><div class ='e-horizontaltimespandiv'>{{:~name.slice(3,5)}}<\/div><\/div><\/td>{{for ~columnvalue[~index] ~width = timeCellWidth}}<td class='e-horizontalalternatetd'><div style='width:{{:~width}}'><\/div><\/td>{{/for}}{{/for}}{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr>{{/if}}{{if view == 'month'}}<tr>{{for cols}}<td class='e-headercells e-horizontmonthheaderdatetd {{:cellToday}}'><div title='{{:title}}' class='e-dateheadercell e-horizontmonthdatealign'>{{:currentDate}}<\/div><\/td>{{/for}}<\/tr><tr>{{for cols}}<td class ='e-horizontmonthheaderdaytd' style='width:{{:cellWidth}}'><div class='e-dateheadercell e-horizontmonthdatealign' title='{{:daynameTitle}}'>{{:currentDay}}<\/div><\/td>{{/for}}<\/tr>{{/if}}<\/tbody><\/table><\/div><\/div><\/td>"},u=function(){return"{{if multiRes == true}}<td class = 'e-horizontalheader'><div class='e-horizontalresheader'>{{:label}}<\/div><\/td>{{else}}{{/if}}<td class='e-horizontaldaterender'><div class='e-horizontaltimecells {{:heightclass}}'><div class='e-headerdays' style='position:absolute;'><table class ='e-table' cellpadding='0px' cellspacing='0px' style='width:100%;border-collapse:separate;table-layout:fixed;'><tbody>{{if view !== 'month'}}<tr style='width:100%;'> <td>{{if view === 'day'}}<table cellspacing='0px' style='width:100%;'>{{else}}<table class='e-table' cellspacing='0px'>{{/if}}<tbody><tr> {{for cols ~headercellWidth = headercellWidth}}<td class='e-headercells {{:cellToday}} e-horizontalheadertddate'><div class='{{:currentDateClass}} e-horizontalheaderdiv'>{{:currentDay}}<\/div><\/td>{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr><tr style='width:100%;position:absolute;'> <td><table class='e-table e-horizontaltabletimecell' cellspacing='0px' style='border-collapse:collapse;'><tbody><tr> {{for timeTdCount ~userTemplateId = userTemplateId ~template=template ~columnvalue =column}}{{for ~name=time ~names=times ~dayend=timecellclass }}<td class='e-horizontaltimetd {{:~dayend}}'><div style='width:{{:timeCellWidth}}'><span class ='e-horizontaltimespan'>{{:~name}}<\/span><div class ='e-horizontaltimespandiv'><\/div><\/div><\/td>{{for ~columnvalue ~width = timeCellWidth ~names=~names}}<td class='e-horizontalalternatetd' style='vertical-align:middle !important;'><div style='width:{{:~width}};' > {{if ~template ==true || ~userTemplateId==true }}{{:~names[#getIndex()]}}{{else}}<\/div>{{/if}}<\/td>{{/for}}{{/for}}{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr>{{/if}}{{if view == 'month'}}<tr>{{for cols}}<td class='e-headercells e-horizontmonthheaderdatetd {{:cellToday}}'><div class='e-dateheadercell e-horizontmonthdatealign'>{{:currentDate}}<\/div><\/td>{{/for}}<\/tr><tr>{{for cols}}<td class ='e-horizontmonthheaderdaytd'><div class='e-dateheadercell e-horizontmonthdatealign' style='width:{{:cellWidth}}'>{{:currentDay}}<\/div><\/td>{{/for}}<\/tr>{{/if}}<\/tbody><\/table><\/div><\/div><\/td>"},f=function(){return"<div class ='e-horizontresdiv'><div class='e-horires' style='height:100%'><table class='e-table e-resourceheadertable' width='100%' cellpadding='0px' cellspacing='0px' style='table-layout:fixed'><tbody>{{for trs}}<tr class='e-horizontresheaderdiv'>{{for ~resname=name ~marginleft=marginleft }}{{if classname == 'e-parentnode'}}<td class='{{:classname}} resemptytd' style='width:25px;height:{{:cellHeight}}'><\/td>{{else}}<td class='resemptytd' style='width:25px;height:{{:cellHeight}}'><\/td>{{/if}}<td class='{{:classname}}' style='vertical-align:middle;height:{{:cellHeight}};'>{{if classname == 'e-parentnode'}}<div id={{:idnum}} class='{{:classname}}category e-resourceicon e-resourcecollapse' style='width:20px;vertical-align:middle;float:left;margin-left:{{:~marginleft}};margin-top:2px;'><\/div>{{/if}}<div class='e-resourceheadertext' style='text-align:left;margin-left:{{:~marginleft}};' title='{{if userResTemplId == true}}{{:name}}{{else}}{{:~resname}}{{/if}}'>{{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resname}}{{/if}}<\/div><\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table><\/div><\/div>"},e=function(){return"<table class='e-table e-workcellstab'cellpadding='0px' cellspacing='0px'><tbody>{{for cellrows ~cols=cols ~hourdiff=hourdiff ~view=view ~classname=classname ~columnvalue=column ~userTemp=userTemplate ~userHtml=userHtml}}{{if classname == 'e-parentnode'}} <tr class='e-resourceheadertr' style='width:100%'>{{for ~cols ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}<td class='e-resourceheadercells e-workcells e-parentworkcell e-dayend' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{else}}<td class='e-resourceheadercells e-workcells e-parentworkcell' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{/if}}{{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}<\/td>{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}<td class='e-resourceheadercells e-workcells e-parentworkcell e-alternateworkcell' style='width:{{:~width}};height:{{:cellHeight}}'>{{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}<\/td>{{/for}}{{/if}}{{/for}}<\/tr>{{else}}<tr style='width:100%'>{{for ~cols ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}<td class='e-workcells e-childworkcell e-dayend' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{else}}<td class='e-workcells e-childworkcell' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{/if}}{{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}<\/td>{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}<td class='e-workcells e-childworkcell e-alternateworkcell' style='width:{{:~width}};height:{{:cellHeight}}'>{{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}<\/td>{{/for}}{{/if}}{{/for}}<\/tr>{{/if}}{{/for}}<\/tbody><\/table>"};t.scheduleFeatures.horizontal={_renderHorizontalTemplates:function(){this.horizontalHeader=n.templates(r());this.cellTemplate=n.templates(e());this.horizontalResHeader=n.templates(f());this.userTimeCellHoriTemplate=n.templates(u())},_horizontalViewNavigation:function(t){var u,i,r,f;if(t.type=="click"){if(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7){if(this.element.find(".e-headercells").children().removeClass("e-activeview"),u=t.currentTarget.cellIndex,i=new Date(this._dateRender[u]),this.model.minDate<=i&&this.model.maxDate>=i)this.model.timeScale.enable&&n(t.currentTarget).children().addClass("e-activeview"),this.currentDate(i);else return!1;this._businessHourScroller()}else if(this.currentView()=="month"||this._isCustomMonthView()){if(u=t.currentTarget.cellIndex,this.model.views.indexOf("day")==-1)return!1;if(i=new Date(this.monthDays[u]),this.model.minDate<=i&&this.model.maxDate>=i)this.currentDate(i);else return!1;this._navView=!0;this._viewChange(t,this.currentView(),"day")}}else if(t.type=="dblclick"&&(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7)){if(r=n(t.target),f=r.hasClass("e-headercells")?r:r.parent().hasClass("e-headercells")?r.parent():r.parent().parent(),this.model.views.indexOf("day")==-1||!f.hasClass("e-headercells"))return!1;if(i=new Date(this._dateRender[f.index()]),this.model.minDate<=i&&this.model.maxDate>=i)this.currentDate(i);else return!1;this._navView=!0;this._viewChange(t,this.currentView(),"day")}},_renderHorizontalHeaderDays:function(i){var u,s,h,f,c,e,o,r;if(this.element.find(".e-headercells").addClass("e-dateheaderselect"),this.currentView()==="month"||this._isCustomMonthView())for(o=this.monthDays,r=0;r<o.length;r++)new Date(new Date(o[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight");else{if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(this.element.find(".e-headercells").children().removeClass("e-activeview"),r=0;r<this._dateRender.length;r++)u=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(this._dateRender[r]).getDay()].split("")[0]:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?i.calendar.days.names[new Date(this._dateRender[r]).getDay()]:this._dayShortNames[new Date(this._dateRender[r]).getDay()]:this._dayShortNames[new Date(this._dateRender[r]).getDay()],s=this.model.timeScale.enable?this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?u+parseInt(t.format(new Date(this._dateRender[r]),"dd",this.model.locale)):this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?u+" "+t.format(new Date(this._dateRender[r]),"dd MMMM yyyy",this.model.locale):u+" "+t.format(new Date(this._dateRender[r]),"dd MMM yy",this.model.locale):u+" "+new Date(this._dateRender[r]).getDate():this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?u+parseInt(t.format(new Date(this._dateRender[r]),"dd",this.model.locale)):this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?t.format(new Date(this._dateRender[r]),"dd MMMM yyyy",this.model.locale):t.format(new Date(this._dateRender[r]),"dd MMM yy",this.model.locale):("0"+new Date(this._dateRender[r]).getDate()).slice(-2),n(this.element.find(".e-headercells")[r]).find("div")[0].innerHTML=s,new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight"),new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date(this.currentDate().setHours(0,0,0,0)).getTime()&&n(this.element.find(".e-headercells")[r]).children().addClass("e-activeview");else for(h=this._getUserDateheaderTemplate(),r=0;r<this._dateRender.length;r++)n(this.element.find(".e-headercells")[r]).find("div")[0].innerHTML=h[r].currentDay,new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight");f=new Date(this.currentDate());this.model.orientation=="horizontal"&&this.currentView()!="month"&&this.model.timeScale.enable&&(new Date(this.currentDate()).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&(this.element.find(".e-headercells").children().removeClass("e-activeview"),this.element.find(".e-currentdayhighlight").children().addClass("e-activeview")),c=this.element.find(".e-headercells").children(".e-activeview").parent().index(),this.element.find(".e-headercells").children().removeClass("e-activeview"),e=this.currentView()==="day"?0:this.currentView()==="workweek"?f.getDay()-1:this.currentView()==="week"?f.getDay():c,this.currentView()!="day"&&n(this.element.find(".e-headercells")[e]).children().addClass("e-activeview"),new Date(new Date(this.currentDate()).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?n(this.element.find("td.e-horizontalheadertddate")[e]).addClass("e-headerToday"):"")}},_horizontalScroll:function(i,r){var e,f,u;if(!t.isNullOrUndefined(i.scrollLeft)&&(r.currentView()=="day"||r.currentView()=="week"||r.currentView()=="workweek"||this.currentView()==="customview"&&this._renderDays<=7)){if(e=n(r.element.find(".e-headercells").find(".e-activeview").parent()).index(),u=0,this.model.enableRTL?(f=t.browserInfo().name=="mozilla"?Math.abs(i.scrollLeft):i.scrollData.scrollable-i.scrollLeft,n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",f-1+"px"),u=Math.floor(Math.abs(f)/(r.element.find(".e-workcells").width()+1)/((r.model.endHour-r.model.startHour)*r.model.timeScale.minorSlotCount))):u=Math.floor(Math.abs(i.scrollLeft)/r.element.find(".e-workcells").width()/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),i.scrollData.scrollable-i.scrollLeft==0)return;r.currentView()!="day"&&e!==u&&r.element.find(".e-headercells").children().removeClass("e-activeview");r.currentView()!="day"&&n(r.element.find(".e-headercells")[u]).children().addClass("e-activeview");this.model.timeScale.enable||r.element.find(".e-headercells").children().removeClass("e-activeview")}},_getHorizontalheaderCellCount:function(n){var f=[],r,u,e;if(this._isCustomMonthView(),!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&(this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"||this.currentView()=="customview"&&this._oneWeek))f=this._getUserDateheaderTemplate();else for(i=0;i<this._dateRender.length;i++)r=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(this._dateRender[i]).getDay()].split("")[0]:this.currentView()==="month"||this.currentView()==="day"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?n.calendar.days.names[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],u=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday e-currentdayhighlight":"",e=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:r,currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?{currentDay:t.format(new Date(this._dateRender[i]),this._pattern.D,this.model.locale),currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:{currentDay:r+" "+t.format(new Date(this._dateRender[i]),"dd MMM yy",this.model.locale),currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:{currentDay:this._mediaQuery?r+parseInt(t.format(new Date(this._dateRender[i]),"dd",this.model.locale)):r+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:u,cellWidth:this.model.cellWidth},f.push(e);return f},_getHoriStartEndTime:function(i){var c=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),v,l,f,y,p,w,h,u,r,o;c&&(v=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),l=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()));var e=[],s=this.model.cellWidth?this._safariBrowser?parseInt(this.model.cellWidth)-1+"px":this.model.cellWidth:this._safariBrowser?"29px":"30px",b=this.currentView()=="week"?7:this.currentView()=="day"?1:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length;for(f=0;f<b;f++)if(c){var h=new Date((new Date).setHours(0,0,0,0)),r=0,a=[];for(u=this.model.startHour;u<this.model.endHour;){for(y=this.model.timeScale.majorSlot+r,p=r;r<y;)w=r,r=r*6e4,c?w==p?o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?l.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}):v.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}):t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||a.push(l.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}).trim()):this._timeMode=="12"?(o=(u===this.model.startHour||u===12)&&i.AM&&i.PM&&r==0?t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh:mm tt",this.model.locale),e.push({time:o,id:u+"_"+r,timecellclass:u==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(u<=9?"0"+u:u)+" 00",timecellclass:u%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)==this.model.startHour&&f!=0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),r=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?r/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount:r/6e4+this.model.timeScale.majorSlot;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:r>=60?u+1:u;r=r>=60?0:r;c&&(r==this.model.timeScale.majorSlot||r==0)&&(e.push({time:o.trim(),times:a,id:u+"_"+r,timecellclass:u-1==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),a=[])}}else for(h=new Date((new Date).setHours(0,0,0,0)),u=this.model.startHour;u<this.model.endHour;){for(r=0;r<60;)r=r*6e4,this._timeMode=="12"?(o=(u===this.model.startHour||u===12)&&i.AM&&i.PM&&r==0?t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh:mm tt",this.model.locale),e.push({time:o,id:u+"_"+r,timecellclass:u==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(u<=9?"0"+u:u)+" 00",timecellclass:u%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)==this.model.startHour&&f!=0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),r=r/6e4+this.model.timeScale.majorSlot;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:u+1}return e},_getHorizontalDayAppointments:function(n,i,r,u){for(var e=[],f=0;f<n.length;f++)e=!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?new t.DataManager(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,n[f][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])):this.res1,e.length!=0&&(new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(n[f][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[f][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?n[f][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.id]:!0&&new Date(new Date(n[f][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[f][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())&&this._renderApp(n[f],r,u)},_horiGroupCollection:function(){if(this._tempResource.length!=0){var n=this._resourceSort(),i=this.res1,r=n.filter(function(n){return i.indexOf(n)===-1});return t.isNullOrUndefined(this.model.group)&&(this.res1=["0"]),r}},_renderHorizontalApp:function(i,r,u,f,e,o,s,h){var ft=this.element.find(".e-workcellstab tr"),a,k,d=0,nt,lt,et,ot,st,g,p,w,ct,c,b,it,y,kt;if(i<=r&&(lt=new Date(i).getHours()<s?new Date(i).getHours()+-new Date(i).getHours()+-new Date(i).getMinutes():new Date(i).getHours()+-s,et=new Date(r).getHours()>h?new Date(r).getHours()+(-new Date(r).getHours()+(h-s))+-new Date(r).getMinutes():new Date(r).getHours()+-s,et=new Date(r).getHours()==h?new Date(et).getMinutes()+-new Date(r).getMinutes():et,a=this.element.find(".e-appointment").length>0?this.element.find(".e-appointment").outerHeight(!0):this._getElementHeight("e-appointment"),ot=0,this.model.startHour<=new Date(i).getHours()&&this.model.endHour>=new Date(i).getHours())){var l=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._grouping.length>1?this._findResourceIndex(this._horiHeaderCollection,this._tempResource[this._tempResource.length-2].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:0,v=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()])+1:1,at=this.model.appointmentTemplateId?!0:!1,rt=at?this._getUserAppointmentTemplate(u):"";if(a=this.model.appointmentTemplateId?n(rt).css("height")=="100%"?this.model.showOverflowButton?e-15:this.initialCellHeight:n(rt).css("height")=="0px"?a:n(rt).height():a,ot=t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)?this._getOverlapCount(u,f,this._dateRender,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getOverlapCount(u,f,this._dateRender,null),this._renderedAllDay.push(n.extend(!0,{},u)),d=ot*a+d,u[this._appointmentSettings.allDay])st=new Date(new Date(new Date(r).setHours(0,0,0,0)).getTime())-new Date(new Date(new Date(i).setHours(0,0,0,0)).getTime()),g=Math.round(st/864e5)+1,g>this._dateRender.length&&(g=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay()),p=g*(h-s)*60,w=(this.model.endHour-this.model.startHour)*o*f,k=this.cellwidth/30*p+(p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1),nt="0";else if(new Date(new Date(new Date(u[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime())<new Date(new Date(new Date(u[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())){var vt=new Date(r)<new Date(new Date(r).setHours(this.model.endHour,0,0))&&new Date(r)<new Date(new Date(r).setHours(this.model.startHour,0,0))?this.model.endHour*30:new Date(r).getHours()*60+new Date(r).getMinutes(),yt=new Date(i)>new Date(new Date(r).setHours(this.model.startHour,0,0))?this.model.startHour*60:new Date(i).getHours()*60+new Date(i).getMinutes(),ht=1,pt,ut,wt,bt,st;if(pt=this._dateRender.indexOf(new Date(r).setHours(0,0,0,0)),ut=this._dateRender.indexOf(new Date(i).setHours(0,0,0,0)),pt==-1)while(ht<7)if(new Date(this._dateRender[this._dateRender.length-ht]).getTime()<new Date(r).setHours(0,0,0,0)){wt=this._dateRender.length-ht;vt=this.model.endHour*60;break}else ht++;else wt=pt;ut==-1?(bt=f,yt=this.model.startHour*60):bt=ut;st=wt-bt;p=st*(h-s)*60-yt+vt;w=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+(ut==-1?0:lt*o)*(60/this.model.timeScale.majorSlot));k=this.cellwidth/30*p+(p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2);g>this._dateRender.length&&(g=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay(),p=g*(h-s)*60,k=p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(p/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));nt=ut==-1?0:parseFloat(new Date(i).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*o/this.model.timeScale.majorSlot}else{if(nt=parseFloat(new Date(i).getMinutes()+new Date(i).getMilliseconds()/60)*this.cellwidth*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,this.model.endHour-this.model.startHour==24)ct=new Date(r).getHours()*60+new Date(r).getMinutes()-(new Date(i).getHours()*60+new Date(i).getMinutes());else var vt=new Date(r).getHours()*60+new Date(r).getMinutes()>this.model.endHour*60?this.model.endHour*60:new Date(r).getHours()*60+new Date(r).getMinutes(),yt=new Date(i).getHours()*60+new Date(i).getMinutes()<this.model.startHour*60?this.model.startHour*60:new Date(i).getHours()*60+new Date(i).getMinutes(),ct=vt-yt;ct+=1;k=ct/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(ct/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2)+1;w=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+lt*o*(60/this.model.timeScale.majorSlot))}if(c=this._appointmentColor(u),e=t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0?e:ft.eq(v+l-1).children().eq(w).height()+1,b=this._indicationApp(u),d+a+7<e){var dt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.startTime]),"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.endTime]),"HH:mm",this.model.locale),ni=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,tt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!c.appointColor.applyFilter?!0:!1,subject:u[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:nt+"px",top:d,appHeight:this.model.appointmentTemplateId?a:"",appWidth:k+"px",userAppTemplId:at,userTemplate:rt,appClass:"e-appointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?u[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(u):u[this._appointmentSettings.priority],uid:u.Guid,recurrence:u[this._appointmentSettings.recurrence],recurrenceEdit:ni,leftInd:b.leftIndication,rightInd:b.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),y=ft.eq(v+l-1).children().eq(w);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,tt);y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(tt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(tt))}else if(this.model.showOverflowButton)it=w+Math.round(new Date(i).getMinutes()/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it).length==0&&(y=ft.eq(v+l-1).children().eq(it),kt='<div id="'+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it+'" class="e-icon e-arrowhead-down e-appsoverflow" cellinfo="'+this._dateRender[f]+'"><\/div>',y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(kt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(kt)),d=e-this.element.find(".e-appsoverflow").height(),this.element.find("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it).css(this.model.enableRTL?"right":"left",this.cellwidth-25+"px").css("top",d+"px")),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(v+l-1)+"_"+it).attr("appcount",ot+1);else{this.element.find(".e-workcellstab tr").eq(v+l-1).children().css("height",e+a-1+"px");this.element.find(".e-resourceheadertable tr").eq(v+l-1).find(".e-childnode").css("height",e+a-1+"px");var dt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.startTime]),"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.endTime]),"HH:mm",this.model.locale),ni=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,tt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,subject:u[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:nt+"px",top:d,appHeight:this.model.appointmentTemplateId?a:"",appWidth:k+"px",userAppTemplId:at,userTemplate:rt,appClass:"e-appointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?u[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(u):u[this._appointmentSettings.priority],uid:u.Guid,recurrence:u[this._appointmentSettings.recurrence],recurrenceEdit:ni,leftInd:b.leftIndication,rightInd:b.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),y=ft.eq(v+l-1).children().eq(w);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,tt);y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(tt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(tt));this._overflowFlag=!0}t.isNullOrUndefined(b)||(b.leftIndication&&(this.model.enableRTL?this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),b.rightIndication&&(this.model.enableRTL?this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find(".e-appointment").filter("div[guid="+u.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")));!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(this._horiHeaderCollection,l,w,u,k,nt)}},_renderAppointmentCategory:function(i,r,u,f,e,o){var h,y,c=0,p,k,l=[],w,b=this.element.find(".e-resourceheadercells").height(),v,s,a;if(!t.isNullOrUndefined(this.model.group)&&this._grouping.length>0){h=this._getResourceColor(f);y=h.appointData==""?"e-categorycolor":"";r-=1;e=this.currentView()=="month"||this._isCustomMonthView()?e:e+2;do if(s=this.element.find(".e-resourceheadertr").eq(r).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;left:"+o+"px;'><\/div>",s.find("div.e-appointwrapper").length>0?s.find("div.e-appointwrapper").append(a):s.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),this._tempResource.length>2){for(v=this._tempResource.length-2;v>=0;v--)if(c=this._tempResource[v].resourceSettings.dataSource.indexOf(i[r]),c!=-1){if(c=v,p=this._tempResource[v].resourceSettings.groupId,t.isNullOrUndefined(p))return;break}k=c==0?c:c-1;l=new t.DataManager(i).executeLocal((new t.Query).where(this._tempResource[k].resourceSettings.id,t.FilterOperators.equal,i[r][p]));w=this._tempResource[0].resourceSettings.dataSource.indexOf(l[0]);w==0?(l=[],this._tempResource.length>2&&(s=this.element.find(".e-resourceheadertr").eq(w).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+this.element.find(".e-resourceheadercells").height()+"px;background:"+h.appointData+";width:"+e+"px;left:"+o+"px;'><\/div>",s.find("div.e-appointwrapper").length>0?s.find("div.e-appointwrapper").append(a):s.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)))):l.length!=0?r=i.indexOf(l[0]):""}while(l.length!=0)}},_getHorizontalOverlapCount:function(n,i,r,u,f){for(var o=[],e=0,s=n.length;e<s;e++)t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?new Date(new Date(n[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[e][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&(new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])>=new Date(n[e][this._appointmentSettings.startTime])||new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])&&new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.startTime])>=new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])<new Date(n[e][this._appointmentSettings.endTime]))&&(f!=null?f==n[e][this._tempResource[this._tempResource.length-1].field]:f==null)&&o.push(n[e]):new Date(new Date(n[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[e][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&(new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])>=new Date(n[e][this._appointmentSettings.startTime])||new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])&&new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.startTime])>=new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])<new Date(n[e][this._appointmentSettings.endTime]))&&o.push(n[e]);return o},_renderHorizontalHeaderBar:function(){var y=this._isCustomMonthView(),u=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",p=u=="day"?1:u=="week"?7:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length,c,l,w,e,o,s,h,f,i,b,v,k;if(this._strTime=this._getStartEndTime(),c=this._columnTimeScale(this._strTime),this.datesColumn=this._getHeaderAllDayCellsCount(),u==="month"||this._isCustomMonthView()){for(this.datesColumn=[],this.monthDays=[],this.totdays=[],i=0;i<this._dateRender.length;i++)this.currentView()==="month"||this._isCustomMonthView()&&this._oneWeek?new Date(this.currentDate()).getMonth()===new Date(this._dateRender[i]).getMonth()&&this.totdays.push(this._dateRender[i]):this.totdays.push(new Date(this._dateRender[i]));if(l=this.totdays.length,!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&(this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"||this.currentView()=="customview"&&this._oneWeek))for(w=this._getUserDateheaderTemplate(),i=0;i<l;i++)e={currentDate:w[i].currentDay,currentDateClass:"",currentDay:this.currentView()=="day"?this._dayFullNames[new Date(this.totdays[i]).getDay()]:this._dayShortNames[new Date(this.totdays[i]).getDay()].toString(),cellWidth:this.model.cellWidth?this.model.cellWidth:"100%",cellHeight:this.model.cellHeight,cellToday:new Date(this.totdays[i]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()?"e-currentdayhighlight":""},this.datesColumn.push(e),this.monthDays.push(this.totdays[i]);else for(i=0;i<l;i++)s=new Date(this.totdays[i]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()?"e-currentdayhighlight":"",o=y&&new Date(this.totdays[i]).getDate()==1?t.format(new Date(this.totdays[i]),"MMM",this.model.locale)+" "+new Date(this.totdays[i]).getDate():t.format(new Date(this.totdays[i]),"dd",this.model.locale),e=this.model.timeScale.enable?{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this._dayFullNames[new Date(this.totdays[i]).getDay()].toString().slice(0,1),cellWidth:!this.model.cellWidth&&this.currentView()!="month"&&!this._isCustomMonthView()?"30px":this.model.cellWidth,cellHeight:this.model.cellHeight,cellToday:s}:this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"?{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this.currentView()=="day"?this._dayFullNames[new Date(this.totdays[i]).getDay()]:this._dayShortNames[new Date(this.totdays[i]).getDay()].toString(),cellWidth:this.model.cellWidth?this.model.cellWidth:"100%",cellHeight:this.model.cellHeight,cellToday:s}:{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this._dayFullNames[new Date(this.totdays[i]).getDay()].toString().slice(0,1),cellWidth:this.model.cellWidth,cellHeight:this.model.cellHeight,cellToday:s},this.datesColumn.push(e),this.monthDays.push(this.totdays[i])}if(h=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,f=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,h||f){var d=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),g=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),nt=[],r=0;for(i=this.model.startHour;i<this.model.endHour;){for(var a=[],tt=this.model.timeScale.majorSlot+r,it=r;r<tt;)b=r,r=r*6e4,this._timeMode=="12"&&(b!=it||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?a.push(d.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,r))}).trim()):a.push(g.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,r))}).trim())),r=r/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;i=this.model.timeScale.majorSlot>60?i+this.model.timeScale.majorSlot/60:r>=60?i+1:i;r=r>=60?0:r;nt.push(a)}f=!0}v=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&this._tempResource[0].resourceSettings.dataSource.length!=0?!0:!1;k=h||f?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:v,view:u,timeTdCount:this._strTime,colspan:u=="month"?1:this._strTime.length/p*2,heightclass:u=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",width:this.model.width,headercellWidth:u=="day"?"100%":"55px",column:c,userTemplateId:h,template:f}):this.horizontalHeader.render({tablelayout:y?"e-fixedlayout":"",cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:v,view:u,timeTdCount:this._strTime,colspan:u=="month"?1:this._strTime.length/p*2,heightclass:u=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",width:this.model.width,headercellWidth:u=="day"?"100%":"55px",column:c});this.aTR.append(k)},_renderHorizontalContent:function(n,i,r,u,f,e){var y=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),s,o,l=[],p=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,v=this._strTime,h,a,c;l=this._columnValue;this._tempResource.length==0||t.isNullOrUndefined(this.model.group)||this._tempResource[0].resourceSettings.dataSource.length==0?(o="",s=[{classname:"e-childnode"}]):(o=this._renderHorizontalResources(),s=this._horiResources);h=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0;h&&(a=this._getUserWorkCellsTemplate());c=this.cellTemplate.render({cellrows:s,hourdiff:Math.ceil((this.model.endHour-this.model.startHour)*(60/this.model.timeScale.majorSlot)),view:this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",cols:this.model.timeScale.enable?this.currentView()=="month"||this._isCustomMonthView()?this.datesColumn:v:this.datesColumn,column:l,userTemplate:h,userHtml:a});o==""?this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(c))))))))):this.wTR.append(t.buildTag("td.e-horizontalrestd",{},{},{width:"15%",height:"100%"}).append(o)).append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(c)))))))))},_columnTimeScale:function(n){var u,i;this._columnValue=[];_cols2=[];var r=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,f=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate),e=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)?!0:!1,o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)?!1:!0;if(f)for(i=0;i<n.length;i++)this._columnValue.push(i);else for(i=0;i<n.length;i++){for(u=0;u<this.model.timeScale.minorSlotCount-1;u++)if(r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,r>(this.model.endHour-this.model.startHour)*60){if(_cols2.push(u),u==this.model.timeScale.minorSlotCount-2){r=0;break}}else _cols2.push(u);this._columnValue.push(_cols2);r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;_cols2=[]}return this._columnValue},_getResourceHeadTemplate:function(t){var i=n.templates(n(this.model.resourceHeaderTemplateId).html());return i.render(t)},_renderHorizontalResources:function(){var i,u,f,r,e,c,o;this._resCollect=[];this._horizontalResRender=[];this._horiResources=[];var s=this.currentView(),l=s=="day"?1:s=="week"||s=="month"||this._isCustomMonthView()?7:this.model.workWeek.length,h=this.model.resourceHeaderTemplateId?!0:!1;if(t.isNullOrUndefined(this.model.group))for(o=0;o<this._tempResource.length;o++)this._horizontalResRender.push(this._tempResource[o].resourceSettings.dataSource),this._resCollect.push(this._tempResource[o].resourceSettings.dataSource);else if(this._grouping.length===1){for(u=0;u<this._grouping.length;u++)i=this._findResourceIndex(this._tempResource,"name",this._grouping[u]);for(u=0;u<this._resourceInfo[i].dataSource.length;u++)this._horiResources.push({cellHeight:this.model.cellHeight,name:this._resourceInfo[i].dataSource[u][this._resourceInfo[i].text],idnum:this._resourceInfo[i].dataSource[u][this._resourceInfo[i].id],classname:"e-childnode",marginleft:"10px",width:"10px",backgroundcolor:"",border:"1px solid #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(this._resourceInfo[i].dataSource[u],{classname:"e-childnode"})),userResTemplId:h}),this._resCollect.push(this._resourceInfo[i].dataSource[u]);this._horizontalResRender.push(this._resCollect)}else{for(f=this._resourceSort(),r=0;r<f.length;r++){for(e=0;e<this.render_Resources.length;e++)if(c=this.render_Resources[e].indexOf(f[r]),c!=-1){i=e;break}i==this.render_Resources.length-1?(this._horiResources.push({cellHeight:this.model.cellHeight,name:f[r][this._tempResource[i].resourceSettings.text],classname:"e-childnode",marginleft:(this._mediaQuery?i*11:i*21)+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(f[r],{classname:"e-childnode"})),userResTemplId:h}),this._resCollect.push(f[r])):(this._horiResources.push({cellHeight:this.model.cellHeight,name:f[r][this._tempResource[i].resourceSettings.text],idnum:f[r][this._tempResource[i].resourceSettings.id]+"_"+f[r][this._tempResource[i].resourceSettings.groupId],classname:"e-parentnode",marginleft:i*10+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(f[r],{classname:"e-parentnode"})),userResTemplId:h}),this._resCollect.push(f[r]))}this._horizontalResRender.push(this._resCollect)}return this.horizontalResHeader.render({trs:this._horiResources})},_horizontalResIcon:function(){for(var r,s,e=this.element.find(".e-parentnodecategory"),o,u,h,i,f=0;f<e.length;f++){for(o=e[f].id.split("_")[0],r=0;r<this._tempResource.length;r++)if(u=new t.DataManager(this._tempResource[r].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.id,t.FilterOperators.equal,o)),u.length!=0){u=r;break}for(i=u+1,i=i==this._tempResource.length?i-1:i,s=0;s<this._tempResource.length;s++){h=new t.DataManager(this._resourceSort()).executeLocal((new t.Query).where(this._tempResource[i].resourceSettings.groupId,t.FilterOperators.equal,o));h.length==0&&n(e[f]).removeClass("e-resourceicon e-resourcecollapse");break}}},_renderHorizontalCurrentTime:function(){var i,r,t;if(this.currentView()==="month"||this._isCustomMonthView())for(i=this.monthDays,r=this.element.find(".e-headerdays").find("table").find("td"),t=0;t<i.length;t++)new Date(new Date(i[t]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()&&n(r[t]).addClass("e-monthcurrenttime");else this.element.find("td.e-headerToday").length>0&&(this.element.find(".e-horizontaltabletimecell").parent().append('<div id="'+this._id+'_HighlightCurrentTimeline" class="e-highlightcurrenttimeline" style="height: 92%; width: 2px; position: absolute; background-color: red; "><\/div>'),n("#"+this._id+"_HighlightCurrentTimeline").css("top",this.element.find(".e-headerdays tr")[1].offsetTop))},_horizontalTimePosition:function(t,i){if(t.element.find("td.e-headerToday").length>0){var r=t.element.find("td.e-headerToday")[0].cellIndex,u=(t.model.endHour-t.model.startHour)*60/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount*r+(i.getHours()-t.model.startHour)*60/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount,f=parseFloat(i.getMinutes())*t.element.find(".e-workcells")[1].offsetWidth*t.model.timeScale.minorSlotCount/t.model.timeScale.majorSlot;n("#"+t._id+"_HighlightCurrentTimeline").css("left",u*t.element.find(".e-workcells")[1].offsetWidth+f)}},_horizontalBusinessHighlight:function(i,r,u,f,e){var a=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._horiResources.length:1,h,l,o,c,s;if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable)for(o=0;o<a;o++)for(h=0;h<i.length;h++)for(s=0;s<this.model.workWeek.length;s++)this._dayNamesArray.indexOf(this.model.workWeek[s])==new Date(i[h]).getDay()&&n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[r*f+(this.model.endHour-this.model.startHour)*f*h-1]).nextAll(".e-workcells").slice(0,u*f-r*f).addClass("e-businesshighlightworkcells");else for(l=this.monthDays,e=this.element.find(".e-workcells"),e.removeClass("e-monthcellhighlight"),o=0;o<a;o++)for(c=0;c<l.length;c++)for(s=0;s<this.model.workWeek.length;s++)this._dayNamesArray.indexOf(this.model.workWeek[s])==new Date(l[c]).getDay()&&n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[c]).addClass("e-monthcellhighlight")},_onResourceClick:function(i){var s,e,l,y,h,a,o,v,u=[],c=[],f,r;for(e=n(i.currentTarget),e.hasClass("e-resourceicon e-resourcecollapse")?(e.removeClass("e-resourceicon e-resourcecollapse").addClass("e-resourceicon e-resourceexpand"),l=!0):(e.removeClass("e-resourceicon e-resourceexpand").addClass("e-resourceicon e-resourcecollapse"),y=!0),this.model.cellHeight||(this.element.find(".e-workcellstab").css("height","100%"),this.element.find(".e-resourceheadertable").css("height","100%")),s=n(i.currentTarget).closest("td.e-parentnode").parent().index(),v=this._getResourceCollection(),r=0;r<v.length;r++)if(h=new t.DataManager(this._tempResource[r].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.id,t.FilterOperators.equal,i.currentTarget.id.split("_")[0])),h.length!=0){a=h[0].count;break}for(f=0;f<a;f++)u.push(this.element.find(".e-resourceheadertable tr")[s+f+1]),c.push(this.element.find(".e-workcellstab tr")[s+f+1]);for(r=0;r<u.length;r++)l?(o=n(u[r]).children().hasClass("e-parentnode"),o&&n(u[r]).find(".e-parentnodecategory").removeClass("e-resourceicon e-resourcecollapse").addClass("e-resourceicon e-resourceexpand"),n(u[r]).is(":visible")&&(n(u[r]).toggle(),n(c[r]).toggle())):(o=n(u[r]).children().hasClass("e-parentnode"),o&&n(u[r]).find(".e-parentnodecategory").removeClass("e-resourceicon e-resourceexpand").addClass("e-resourceicon e-resourcecollapse"),n(u[r]).is(":hidden")&&(n(u[r]).toggle(),n(c[r]).toggle()));this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height());this._horizontalRender();this.model.cellHeight&&this._reRenderScroller();this._mediaQuery&&this.refreshScroller();this._horizontalResIcon();this.element.find("div.e-prevapp,div.e-nextapp").remove();this.element.find(".e-categorybar").height(this.element.find(".e-parentworkcell").height()-3);this._businessHourScroller();this._renderAppointmentAll()}}}(jQuery,Syncfusion),function(n,t,i){t.ExcelFilter=t.ExcelFilter||{};t.excelFilter=function(n){return this._ctrlInstance=n.instance,this.id=this._ctrlInstance._id,this._dialogContainer=null,this._showSort=n.showSortOptions||!1,this._interDeterminateState=n.interDeterminateState||!1,this._maxCount=t.isNullOrUndefined(n.maxFilterLimit)?1e3:n.maxFilterLimit,this._formatFiltering=!0,this._locale=this._ctrlInstance.model.locale||"en-US",this.localizedLabels=this._getLocalizedLabel(),this._filterHandler=n.filterHandler||null,this._searchHandler=this._ctrlInstance.model.searchSettings||null,this._cancelHandler=n.cancelHandler||null,this._customFilterHandler=n.customFilterHandler||null,this._cssClass=n.cssClass||null,this._matchCase=n.allowCaseSensitive||!1,this._title=n.title||this.localizedLabels.title,this._complexBlankCriteria=n.enableComplexBlankFilter,this._blankValue=n.blankValue,this.fName=n.initFilterCol||null,this._spliter=n.valueDelimiter||t.ExcelFilter.valueDelimiter,this._initialFName=this.fName,this._displayName=null,this._dataSource=null,this._isUrlAdaptor=!1,this._$tableID=null,this._$blankVal=null,this._$selectedColors=[],this._$enableColor=!1,this._$filteredByColor="",this._$colType=null,this._$key=0,this.filteredColumn=null,this.sortedColumns=null,this._chkList=null,this._listsWrap=null,this._menuWrap=null,this._localJSON=null,this._actualCount=0,this._totalRcrd=0,this._enableResponsiveRow=!1,this._searchCount=0,this._currentData=null,this._openedFltr=null,this._predicates=[],this.cFilteredCols=this.fName!=null?[this.fName]:[],this._columnsFiltered=[],this.guid=t.getGuid("excelfilter"),this._noDlg=[],this._sepAftr=["sortDesc","notequal","between","top10","endswith","contains"],this._posType=["number","date","datetime","string","boolean","guid"],this._empties=this._complexBlankCriteria?["null","undefined",""]:[this.guid],this._reqInProgess=!1,this._isFiltered=!1,this._onActionBegin=n.actionBegin||null,this._onActionComplete=n.actionComplete||null,this.maxItemOnQuery=0,this.enableNormalize=!0,this.enableSelect=!1,this._onDemandSearch=!1,this._searchRequest=!1,this._isIndeterminate=!1,this._selectAll="<div class='e-ftrchk'><input type='checkbox' class='e-selectall' value='selectall' class='e-ftrchk' /><label class='e-ftrchk'>("+this.localizedLabels.SelectAll+")<\/label><\/div>",this._blanks="<div class='e-ftrchk'><input type='checkbox' id='blanks' class='e-ftrchk' value='"+this._empties.join(this._spliter)+"' @@/><label class='e-ftrchk' for='blanks' value=''>("+this.localizedLabels.Blanks+")<\/label><\/div>",this._blank=i,this._addAtLast=!1,this.guidMenuOpt=[{id:1,text:this.localizedLabels.SortNoSmaller,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortNoLarger,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.GuidFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.GuidMenuOptions}],this.numberMenuOpt=this.booleanMenuOpt=[{id:1,text:this.localizedLabels.SortNoSmaller,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortNoLarger,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.NumberFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.NumberMenuOptions}],this.stringMenuOpt=[{id:1,text:this.localizedLabels.SortTextAscending,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortTextDescending,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.TextFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.StringMenuOptions}],this.dateMenuOpt=[{id:1,text:this.localizedLabels.SortDateOldest,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortDateNewest,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.DateFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.DateMenuOptions}],this.datetimeMenuOpt=[{id:1,text:this.localizedLabels.SortDateOldest,sprite:"e-sortasc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortAsc"}},{id:2,text:this.localizedLabels.SortDateNewest,sprite:"e-sortdesc e-icon e-fnsort",htmlAttribute:{ejfnrole:"sortDesc"}},{id:3,text:this.localizedLabels.SortByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:4,text:this.localizedLabels.ClearFilter,sprite:"e-filternone e-icon",htmlAttribute:{ejfnrole:"clearfilter"}},{id:5,text:this.localizedLabels.FilterByColor,htmlAttribute:{ejfnrole:"popup"},child:[]},{id:6,text:this.localizedLabels.DateTimeFilter,htmlAttribute:{ejfnrole:"filterpopup"},child:this.localizedLabels.DatetimeMenuOptions}],this};t.excelFilter.prototype={isNotBlank:function(n,i){var r=t.isNullOrUndefined(n)||n===""||n===null;return i||n!==""&&n!==null||(this._addAtLast=!0),!r},_checkBlank:function(n){if(this.isNotBlank(n))return!0;var t=this._blank==i&&!this._addAtLast;return t&&(this._blank=!0),t},_getValueData:function(n,i){var r=this._empties;return this.isNotBlank(n,!0)&&(r=t.distinct(i,this._$foreignKey||this.fName,!1)),r.join(this._spliter)},getPredicate:function(n,r,u){var e,s,o,f,h;for(this._isUrlAdaptor=this._ctrlInstance._dataSource()instanceof t.DataManager&&(this._ctrlInstance._dataSource().adaptor instanceof t.UrlAdaptor||this._ctrlInstance._dataSource().adaptor instanceof t.WebMethodAdaptor),e=r!=i?[r]:t.distinct(n,"field",!1),o={},f=0,h=e.length;f<h;f++)s=new t.DataManager(n).executeLocal((new t.Query).where("field","equal",e[f])),o[e[f]]=this.generatePredicate(s),u&&(this._predicates[this._$key]=this._predicates[this._$key]||{},this._predicates[this._$key][e[f]]=o[e[f]]);return o},generatePredicate:function(n){var f=n?n.length:0,u,r,i;if(f){for(r=this._updateDateFilter(n[0]),u=this._isUrlAdaptor&&(r.type=="date"||r.type=="datetime")?this._getDatePredicate(r):r.ejpredicate?r.ejpredicate:t.Predicate(r.field,r.operator,r.value,r.ignoreCase||!r.matchcase),i=1;i<f;i++)n[i]=this._updateDateFilter(n[i]),this._isUrlAdaptor&&f>2&&i>1&&n[i].predicate=="or"?n[i].type=="date"||n[i].type=="datetime"?u.predicates.push(this._getDatePredicate(n[i])):u.predicates.push(t.Predicate(n[i].field,n[i].operator,n[i].value,n[i].ignoreCase||!n[i].matchcase)):u=this._isUrlAdaptor&&(n[i].type=="date"||n[i].type=="datetime")?u[n[i].predicate](this._getDatePredicate(n[i])):n[i].ejpredicate?u[n[i].predicate](n[i].ejpredicate):u[n[i].predicate](n[i].field,n[i].operator,n[i].value,n[i].ignoreCase||!n[i].matchcase);return u||null}},_getDatePredicate:function(n){return t.Predicate(n.field,n.operator,n.value,n.ignoreCase||!n.matchcase)},getFilterFrom:function(n,i){var i=t.distinct(i,this.fName,!1);return this.maxItemOnQuery>0&&(i=i.slice(0,this.maxItemOnQuery)),t.UrlAdaptor.prototype.getFiltersFrom(i,(new t.Query).foreignKey(this._$foreignKey))},renderDialog:function(n){this._$colType=n;var e=this.id+n+"_excelDlg",i=t.buildTag("div#"+e+".e-excelfilter e-dlgcontainer e-shadow"),r=t.buildTag("ul#"+this.id+n+"_MenuItem"),o=this._getMenuData(n);r=this._createLiTag(r,o,!1);var f=t.buildTag("span.e-searchbox e-fields").append(t.buildTag("input#"+this.id+"_SearchBox.e-ejinputtext e-searchinput",{},{},{type:"text",placeholder:this.localizedLabels.Search})).append(t.buildTag("span.e-search e-icon")),s=t.buildTag("div#"+this.id+n+"_CheckBoxList.e-checkboxlist e-fields").append(t.buildTag("div")),h=this._createBtn(),u=t.buildTag("div.e-searchcontainer"),c=t.buildTag("div.e-status e-fields e-hide",this.localizedLabels.CheckBoxStatusMsg);i.append(r);u.append(f);u.append(c);u.append(s);u.append(h);i.append(u);i.appendTo(this._ctrlInstance.element);i.css("display","none");this._renderCustomFDlg(n);this._dialogContainer=i;this._cssClass!=null&&i.addClass(this._cssClass);this._showSort||(r.find(".e-fnsort").closest("li").css("display","none"),r.find("li.e-separator:first").css("display","none"));this._lsitBoxTemplate();this._renderSubCtrls(n);t.browserInfo().name=="msie"&&t.browserInfo().version<10&&t.ieClearRemover(f.find("input")[0]);this._wireEvents()},_getDeprecatedLocalizedLabel:function(n){if(["Ok","OK"].indexOf(n)!=-1)return this.localizedLabels.Ok||this.localizedLabels.OK},_renderSubCtrls:function(i){n("#"+this.id+i+"_MenuItem").ejMenu({orientation:"vertical",width:266,container:"#"+this.id,click:t.proxy(this._menuHandler,this),enableRTL:this._ctrlInstance.model.enableRTL,enableSeparator:!1});n("#"+this.id+i+"_OkBtn").ejButton({text:this._getDeprecatedLocalizedLabel("OK"),showRoundedCorner:!0,width:60,click:t.proxy(this._fltrBtnHandler,this),enabled:!0});n("#"+this.id+i+"_CancelBtn").ejButton({text:this.localizedLabels.Cancel,showRoundedCorner:!0,width:60,click:t.proxy(this.closeXFDialog,this)});n("#"+this.id+i+"_CheckBoxList").ejScroller({height:130,width:234,scroll:t.proxy(this._virtualize,this)});n("#"+this.id+i+"_CheckBoxList").ejWaitingPopup({showOnInit:!1})},openXFDialog:function(r){var u,f,e;(this.fName=r.field,this._dataSource=r.dataSource,this._$colType=r.type||"string",this._$format=r.format||"",this._enableResponsiveRow=r.enableResponsiveRow,this.filteredColumn=r.filteredColumns||this._ctrlInstance.model.filterSettings.filteredColumns,this.sortedColumns=r.sortedColumns||this._ctrlInstance.model.sortSettings.sortedColumns,this._displayName=r.displayName,this.query=r.query||new t.Query,this._$key=r.key||0,this._$tableID=r.tableID,this._$blankVal=t.isNullOrUndefined(this._$tableID)?this._$blankVal:r.blank,this._$selectedColors=r.selectedColors||[],this._$enableColor=r.enableColor||!1,this._$filteredByColor=r.filteredByColor||this._$filteredByColor,this._$foreignField=r.foreignKeyValue,this._$foreignData=r.foreignDataSource,this._$foreignKey=r.foreignKey,this._$foreignKeyType=r.foreignKeyType,this._$foreignData instanceof t.DataManager&&(this._$foreignData.adaptor instanceof t.ODataAdaptor||this._$foreignData.adaptor instanceof t.ODataV4Adaptor||this._$foreignData.adaptor instanceof t.WebApiAdaptor)&&(this.maxItemOnQuery=50),n.extend(this.localizedLabels,r.localizedStrings||{}),e={requestType:"filterbeforeopen",filterModel:this,columnName:this.fName,columnType:this._$colType},this._ctrlInstance._trigger(this._onActionBegin,e))||(this._openedFltr!=null&&this._openedFltr.is(n("#"+this.id+this._$colType+"_excelDlg"))||(this.closeXFDialog(),this._openedFltr=n("#"+this.id+this._$colType+"_excelDlg")),this._listsWrap=n("#"+this.id+this._$colType+"_CheckBoxList"),this._menuWrap=n("#"+this.id+this._$colType+"_MenuItem"),this._searchBox=this._openedFltr.find(".e-searchbox input"),this._setPosition(this._openedFltr,r.position),this._openedFltr.addClass(r.cssClass),this._openedFltr.fadeIn(300,function(){}),f=n("#"+this.id+this._$colType+"_MenuItem").find("li[ejfnrole='popup']"),this._$enableColor?(this._createDivTag(f.eq(0).find(".e-shadow"),this._$selectedColors,!1,"sort"),this._$filteredByColor==-1||this._$filteredByColor.length<1||this._$filteredByColor===this.fName?this._createDivTag(f.eq(1).find(".e-shadow"),this._$selectedColors,!1,"filter"):f.eq(1).addClass("e-disable-item")):f.hide(),this._isFiltered=this._predicates[this._$key]!=i&&this._predicates[this._$key][this.fName]!=i,this._isFiltered=r.isFiltered||this._isFiltered,(this._$colType=="date"||this._$colType=="datetime")&&this._$format==""&&(this._$format=this._$colType=="date"?"{0:MM/dd/yyyy}":"{0:MM/dd/yyyy hh:mm:ss}"),this._processListData(),u=this._listsWrap.data("ejScroller"),this._ctrlInstance.model.enableRTL&&u.isHScroll()&&(u.scrollLeft(u.content()[0].scrollWidth-u.content()[0].clientWidth),u.refresh()),this._setDisable(),e={requestType:"filterafteropen",filterModel:this,columnName:this.fName,columnType:this._$colType},this._ctrlInstance._trigger(this._onActionComplete,e))},closeXFDialog:function(i){if(i!=null){var r=n(i.target);if(!(r.closest("#"+this.id+this._$colType+"_CustomFDlg").length>0||r.closest("#"+this.id+this._$colType+"_excelDlg").length>0))return}this._openedFltr&&(this._openedFltr.hasClass("e-dlgcustom")?this._openedFltr.ejDialog("close"):(this._openedFltr.fadeOut(300,function(){}),this._listsWrap.ejWaitingPopup("hide")),t.isNullOrUndefined(this._cancelHandler)||this._cancelHandler(),this.resetFilterModel(),this._ctrlInstance._$fDlgIsOpen=!1)},_setPosition:function(n,t){n.css("position","absolute");n.css("left",t.X).css("top",t.Y)},_setDisable:function(){var o=this._menuWrap.find("li[ejfnrole='clearfilter']"),r=this._menuWrap.find("li[ejfnrole='filterpopup']"),e=this._menuWrap.find("li[ejfnrole *= 'sort']"),s=this._listsWrap.find("input").filter(":checked:not(.e-selectall)").length,f,u,i;if(this._isFiltered?o.removeClass("e-disable-item"):o.addClass("e-disable-item"),this._showSort&&(f=t.DataManager(this.sortedColumns).executeLocal((new t.Query).where("field","equal",this.fName)),f.length&&f[0].direction=="ascending"?e.filter("[ejfnrole='sortAsc']").addClass("e-disable-item"):e.filter("[ejfnrole='sortAsc']").removeClass("e-disable-item"),f.length&&f[0].direction=="descending"?e.filter("[ejfnrole='sortDesc']").addClass("e-disable-item"):e.filter("[ejfnrole ='sortDesc']").removeClass("e-disable-item")),u=r.find(".aschild"),this.cFilteredCols.length!=0&&n.inArray(this.fName,this.cFilteredCols)!=-1){for(i=0;i<this.filteredColumn.length;i++)if(this.filteredColumn[i].field==this.fName){u.find("#ejFiltercheck").length==0&&(u.append("<input type='checkbox' id='ejFiltercheck' />"),u.find("#ejFiltercheck").ejCheckBox({checked:!0}),u.find("#ejFiltercheck").ejCheckBox("disable"));r.find(".e-shadow .e-exceltick").length>0&&r.find(".e-shadow .e-exceltick").remove();this.filteredColumn[i].field==this.fName&&!t.isNullOrUndefined(this.filteredColumn[i+1])&&this.filteredColumn[i+1].field==this.fName&&(this._$foreignField&&this.filteredColumn[i+1].customFilter||!this._$foreignField)?this.filteredColumn[i].operator=="greaterthanorequal"&&this.filteredColumn[i+1].operator=="lessthanorequal"?r.find(".e-shadow .e-list[ejvalue=between]").find("a").append("<span class='e-exceltick e-icon' />"):r.find(".e-shadow .e-list[ejvalue=customfilter]").find("a").append("<span class='e-exceltick e-icon' />"):this._$foreignField?r.find(".e-shadow .e-list[ejvalue="+this.filteredColumn[i].actualFilterOperator+"]").find("a").append("<span class='e-exceltick e-icon' />"):r.find(".e-shadow .e-list[ejvalue="+this.filteredColumn[i].operator+"]").find("a").append("<span class='e-exceltick e-icon' />");break}}else for(i=0;i<this.filteredColumn.length;i++)if(this.filteredColumn[i].field==this.fName){this._removeTick(r,u);break}this._isFiltered||u.find("#ejFiltercheck").length==0||this._removeTick(r,u);this._$colType=="boolean"&&this._menuWrap.find("li[aria-haspopup=true]").addClass("e-hide");this._searchBox.val("");this._searchBox.siblings().addClass("e-search").removeClass("e-cancel")},_removeTick:function(n,t){t.find("#ejFiltercheck").ejCheckBox("destroy");n.find(".aschild #ejFiltercheck").remove();n.find(".e-shadow .e-exceltick.e-icon").remove()},_createBtn:function(n){var i=n?this.id+this._$colType+"Custom":this.id+this._$colType,u=t.buildTag("div.e-btncontainer e-fields"),r=t.buildTag("div");return r.append(t.buildTag("input#"+i+"_OkBtn.e-fltrbtn e-btnsub e-flat",{},{},{type:"button"})).append(t.buildTag("input#"+i+"_CancelBtn.e-fltrbtn e-btncan e-flat",{},{},{type:"button"})),u.append(r)},_menuHandler:function(t){var s=n(t.element),i=s.attr("ejfnrole"),r={},h,c,f,e,o,u;if(i==="filterbgcolor"||i==="filterfgcolor")h={field:this.fName,operation:i,color:n(t.element).css("background-color")},r={originalEvent:t.event,action:"filterbycolor",filterDetails:h,tableID:this._$tableID},this._isFiltered=!1;else if(i=="clearfilter")c={field:this.fName,operator:"",value:"",predicate:"or"},r={originalEvent:t.event,fieldName:this.fName,action:"clearfiltering",filterDetails:c,tableID:this._$tableID},f=n.inArray(this.fName,this.cFilteredCols),f!=-1&&this.cFilteredCols.splice(f,1),e=n.inArray(this.fName,this._columnsFiltered),e!=-1&&this._columnsFiltered.splice(e,1),this._initialFName==this.fName&&(this._initialFName=null);else{if(i=="popup"||i=="filterpopup")return;i=="operator"?this._openCustomFilter(s.attr("ejvalue")):i=="sortAsc"||i=="sortDesc"?(o=i=="sortAsc"?"ascending":"descending",u={field:this.fName,direction:o},r={originalEvent:t.event,action:"sorting",sortDetails:u,tableID:this._$tableID}):(u={field:this.fName,direction:o,operation:i,color:n(t.element).css("background-color")},r={originalEvent:t.event,action:"sortbycolor",sortDetails:u,tableID:this._$tableID})}i!="operator"&&(this._filterHandler(r),this.closeXFDialog())},_searchBoxFocus:function(t){var i=n(t.target);i.hasClass("e-cancel")&&(i.prev().val(""),i.next().addClass("e-cancel"),i.addClass("e-search"),i.prev().trigger("keyup"));t.type=="focusin"&&(i.next().addClass("e-cancel"),i.next().removeClass("e-search"))},_search:function(r){var e=r.target.value,u,o,f=n(r.target);(u=this.getType()!="string"&&parseFloat(e)?parseFloat(e):e,o="contains",u=u==""||u==i?i:u,this._$colType=="boolean"&&(u!=i&&this.localizedLabels.True.toLocaleLowerCase().indexOf(u.toLowerCase())!=-1?u="true":u!=i&&this.localizedLabels.False.toLocaleLowerCase().indexOf(u.toLowerCase())!=-1&&(u="false")),this._$colType!="date"&&this._$colType!="datetime"||(u=t.parseDate(e,this.replacer(this._$format,/{0:|}/g,"")),o="equal",this._previousValue!=null||u!=null))&&(this._previousValue=u,delay=this._dataSource instanceof t.DataManager&&this._ctrlInstance.model.pageSettings.totalRecordsCount>this._ctrlInstance.model.filterSettings.maxFilterChoices?1500:0,sender={type:"filterchoicesearch",value:u,operator:o,matchcase:["date","datetime"].indexOf(this._$colType)!=-1?!1:this._matchCase},this._processSearch(sender,delay),f.val()==""?(f.next().addClass("e-search"),f.next().removeClass("e-cancel")):(f.next().addClass("e-cancel"),f.next().removeClass("e-search")))},_processSearch:function(n,t){this._alreadySearchProcessed?(this._stopTimer(),this._startTimer(n,t)):(this._alreadySearchProcessed=!0,this._startTimer(n,t))},_startTimer:function(n,t){this._timer=window.setTimeout(function(){proxy._processListData(n)},t)},_stopTimer:function(){this._timer!=null&&window.clearTimeout(this._timer)},_getLocalizedLabel:function(){return t.getLocalizedConstants("ej.ExcelFilter",this._locale)},_getMenuData:function(n){return n!=i?this[n+"MenuOpt"]:[]},_lsitBoxTemplate:function(){var i={},u={},r;i[this.id+"isNotBlank"]=t.proxy(this.isNotBlank,this);i[this.id+"checkBlank"]=t.proxy(this._checkBlank,this);i[this.id+"_getValueData"]=t.proxy(this._getValueData,this);i[this.id+"_checkBoxState"]=t.proxy(this._setCheckState,this);i[this.id+"_genId"]=this._genCheckID;n.views.helpers(i);r=this.id+this._$colType+"{{:~"+this.id+"_genId()}}";u[this.id+this._$colType+"_listBox_Template"]="{{if ~"+this.id+"checkBlank(key)}}<div class='e-ftrchk'><input type='checkbox' id='"+r+"' value='{{html:~"+this.id+"_getValueData(key, items)}}' class='e-ftrchk' {{:~"+this.id+"_checkBoxState(~"+this.id+"_getValueData(key, items))}}/><label class='e-ftrchk' for='"+r+"'>{{if ~"+this.id+"isNotBlank(key,'true')}} {{>key}} {{else}} (Blanks) {{/if}}<\/label><\/div>{{/if}}";n.templates(u)},_processListData:function(n){var e,u={},r=new t.Query,k=(new t.Query).requiresCount(),h={},v,o,y,l,b,s;this._searchCount=0;var p=this._predicates[this._$key],c,f=null,a=null,w=null,s=null;t.isNullOrUndefined(this._$foreignField&&this._$foreignData)?(f=this._dataSource,a=this.fName,w=this._localJSON):(f=w=this._$foreignData,this._dataSource instanceof t.DataManager&&!(f instanceof t.DataManager)&&(f=t.DataManager(f)),a=this._$foreignField);for(v in p)v!=this.fName&&(o=p[v],y=o.from,y?r.skip(y=="top"?0:f.length-(f.length-o.take)).take(o.take):c=c!=i?c.and(o):o);(u.columnName=a,r.requiresCount(),this._dataSource instanceof t.DataManager&&!this._dataSource.dataSource.offline&&this._ctrlInstance.model.pageSettings.totalRecordsCount>this._ctrlInstance.model.filterSettings.maxFilterChoices&&(r.take(this.maxFilterChoices),this._onDemandSearch=!0),c&&r.where(c),t.merge(r.queries,this.query.queries)||t.merge(r._params,this.query._params),h.requestType=n?n.type:"filterchoicerequest",h.filterModel=this,h.query=r,h.dataSource=f,this._ctrlInstance._trigger(this._onActionBegin,h))||(!t.isNullOrUndefined(this._searchHandler)&&this._searchHandler.key.length&&(l=this._searchHandler,r.search(l.key,l.fields,l.operator||"contains",l.ignoreCase||!0)),this.enableSelect&&r.select(this.fName),n&&n.type=="filterchoicesearch"?(u.type=n.type,this._$foreignField&&(r=k),n.value&&r.where(a,n.operator,n.value,!n.matchcase),this._dataSource instanceof t.DataManager&&this._ctrlInstance.model.pageSettings.totalRecordsCount>this._ctrlInstance.model.filterSettings.maxFilterChoices?(this._searchRequest=!0,this._listsWrap.ejWaitingPopup("show"),this._$foreignField?(b=this._$foreignData instanceof t.DataManager?this._$foreignData:t.DataManager(this._$foreignData),this._dataProcessing(b,r,u)):this._dataProcessing(this._dataSource,r,u)):this._dataProcessing(t.DataManager(this._localJSON),r,u)):this._dataSource instanceof t.DataManager?(proxy=this,u.type="filterchoicerequest",this._listsWrap.ejWaitingPopup("show"),this._reqInProgess||(this._reqInProgess=!0,this._$foreignField&&(f=this._dataSource),e=f.executeQuery(r),e.done(function(n){proxy._$foreignField?proxy._filterForeignData(n,u):(s=n.result,u.data=proxy._localJSON=proxy._currentData=s,proxy._totalRcrd=n.count,proxy._listsWrap.ejWaitingPopup("hide"),proxy._setCheckBoxList(u),proxy._reqInProgess=!1)}))):(s=[],e=t.DataManager(this._dataSource).executeLocal(r),u.type="filterchoicerequest",this._$foreignField?this._filterForeignData(e,u):(s=e.result,u.data=this._localJSON=this._currentData=s,this._totalRcrd=e.count,this._setCheckBoxList(u))))},_dataProcessing:function(n,t,i){var r;r=n.executeQuery(t);r.done(function(n){i.data=proxy._currentData=n.result;proxy._totalRcrd=proxy._searchCount=n.result.length;proxy._setCheckBoxList(i)})},_filterForeignData:function(i,r){var a=typeof r=="boolean",h=this._$foreignKey,c=this._$foreignField,b=this._$foreignKeyType,v,l,f=this,y={},e,p,o=new t.Query,k=this._$foreignData instanceof t.DataManager?this._$foreignData:t.DataManager(this._$foreignData),s,u,w;if(a){for(u=i[0],y=i[0],p=i.slice(),!u||this.closeXFDialog(),e=new t.Predicate(c,u.operator,u.value,!u.matchcase),s=1,w=i.length;s<w;s++)u=i[s],e=e[u.predicate](c,u.operator,u.value,!u.matchcase);o.where(e)}else v=i.result,l=i.count,!l||o.where(this.getFilterFrom(this._$foreignData,v)),this._listsWrap.ejWaitingPopup("model.showOnInit")||this._listsWrap.ejWaitingPopup("show");o.select([h,c]);k.executeQuery(o).done(function(i){if(a){var u=t.distinct(i.result,h,!0),u=0 in u?u:[{}],e=u.map(function(t){return n.extend({},y,{value:t[h],operator:"equal",actuals:p,type:b})});f.initiateFilter(e)}else r.data=f._localJSON=f._currentData=i.result,f._totalRcrd=l,f._listsWrap.ejWaitingPopup("hide"),f._setCheckBoxList(r),f._reqInProgess=!1})},_setCheckBoxList:function(i){var u={},f,e,o=this._blanks,r;(u.requestType=i.type,u.dataSource=this._dataSource,u.filterModel=this,this._currentData.length!=0?(f=this.getDistinct(i.data,i.columnName,!0,!!this._$foreignKey),e=this._isFiltered,this._actualCount=f.length,f.length=this._maxCount>this._actualCount?this._actualCount:this._maxCount,this._onDemandSearch&&this._actualCount==1e3||this._actualCount>=this._maxCount?this._openedFltr.find("div.e-status").removeClass("e-hide"):this._openedFltr.find("div.e-status").addClass("e-hide"),this._filterdCol=t.DataManager(this.filteredColumn).executeLocal(t.Query().where("field","equal",this.fName)),this._listsWrap.find("div:first").html([this._selectAll,n.render[this.id+this._$colType+"_listBox_Template"](f),this._addAtLast?this.replacer(o,/@@/g,this._setCheckState,this._empties.join(this._spliter)):""].join("")),this._chkList=this._listsWrap.find("input:checkbox").not(".e-selectall"),$inView=this._chkList.slice(0,20),$inView.ejCheckBox({change:t.proxy(this._checkHandler,this)}),$inView.siblings().height(14).width(14),this._listsWrap.find(".e-selectall").ejCheckBox({change:t.proxy(this._selectAllHandler,this),enableTriState:this._interDeterminateState}),this._listsWrap.find(".e-selectall").attr("id",this.id+this._$colType+"SelectAll"),this._listsWrap.find(".e-selectall").siblings().height(14).width(14),this._listsWrap.find(".e-selectall").closest("span").siblings("label").attr("for",this.id+this._$colType+"SelectAll")):(this._listsWrap.find("div").first().html(t.buildTag("div.e-ftrchk",this.localizedLabels.NoResult,{},{})),this._chkList=this._listsWrap.find("input:checkbox").not(".e-selectall")),t.isNullOrUndefined(this._chkList)||(r=this._chkList.filter(":checked").length),this._isFiltered&&this._searchRequest&&r==0&&this._checkIsIndeterminate(i.columnName,this.filteredColumn),this._isFiltered&&this._actualCount!=r?(r>0||this._isIndeterminate&&this._interDeterminateState)&&this._listsWrap.find(".e-selectall").ejCheckBox("model.checkState","indeterminate"):this._listsWrap.find(".e-selectall").ejCheckBox({checked:!0}),n("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:r!=0}),this._listsWrap.ejScroller({scrollTop:0}).ejScroller("refresh"),this._listsWrap.hasClass("e-waitingpopup")&&this._listsWrap.ejWaitingPopup("hide"),this._ctrlInstance._trigger(this._onActionComplete,u))||(this._isIndeterminate=!1)},_checkIsIndeterminate:function(n,t){for(var i=0;i<t.length;i++)n==t[i].field&&(this._isIndeterminate=!0)},_createLiTag:function(r,u,f){return proxy=this,n.each(u,function(u,e){var s=t.buildTag("li",{},{},e.htmlAttribute||f&&{ejfnrole:"operator",ejvalue:e.value}||{}),h,c=f&&n.inArray(e.value,proxy._noDlg)==-1?"...":"",o=t.buildTag("a",e.text+c,{},{});e.sprite!=i&&o.append(t.buildTag("span",{},{},{"class":e.sprite}));e.child!=i&&(h=e.id!=3&&e.id!=5?proxy._createLiTag(t.buildTag("ul.e-shadow"),e.child,!0):e.id===3?proxy._createDivTag(t.buildTag("ul.e-shadow"),e.child,!0,"sort"):proxy._createDivTag(t.buildTag("ul.e-shadow"),e.child,!0,"filter"));e.child==i?r.append(s.append(o)):r.append(s.append(o).append(h));n.inArray(e.value||e.htmlAttribute&&e.htmlAttribute.ejfnrole,proxy._sepAftr)!=-1&&r.append(t.buildTag("li.e-separator"))}),r},_createDivTag:function(n,i,r,u){var e,l,s=[],h=[],c=!1,a="",v="",y="",p="",w="",b="",o,f;if(u=="sort"?(a=this.localizedLabels.SortByCellColor,v=this.localizedLabels.SortByFontColor):(a=this.localizedLabels.FilterByCellColor,v=this.localizedLabels.FilterByFontColor),y=u+"colorhdr",w=u+"fonthdr",p=u+"bgcolor",b=u+"fgcolor",n.length>0&&n.children().remove(),i.length>0){for(f=0;f<i.length;f++){for(o=0;o<s.length;o++)if(s[o]==i[f].background){c=!0;break}for(c||t.isNullOrUndefined(i[f].background)||i[f].background.startsWith("#6n")||s.push(i[f].background),c=!1,o=0;o<h.length;o++)if(h[o]==i[f].foreground){c=!0;break}c||t.isNullOrUndefined(i[f].foreground)||i[f].foreground.startsWith("#6n")||h.push(i[f].foreground);c=!1}if(s.length>0)for(e=t.buildTag("li.e-list e-bghdrcolor","","",{ejfnrole:y}),l=t.buildTag("a.e-menulink",a,{}),e.append(l),n.append(e),f=0;f<s.length;f++)e=t.buildTag("li.e-list e-valcolor",{},{"background-color":s[f]},{ejfnrole:p}),n.append(e);if(h.length>0)for(e=t.buildTag("li.e-list e-fghdrcolor","","",{ejfnrole:w}),l=t.buildTag("a.e-menulink",v,{}),e.append(l),n.append(e),f=0;f<h.length;f++)e=t.buildTag("li.e-list e-valcolor",{},{"background-color":h[f]},{ejfnrole:b}),n.append(e);s.length<1&&h.length<1?n.parent().addClass("e-disable-item"):n.parent().removeClass("e-disable-item")}else n.parent().addClass("e-disable-item");return n},_setCheckState:function(n){var i=n,f=n.split(this._spliter),e=f.length,r,o,s,h,u;if(!this._isFiltered||this._searchCount)return"checked";while(e--)if(i=this.processValue(f[e]),this._$colType=="date"||this._$colType=="datetime"||this._$colType=="boolean"){for(r=0,o=this._filterdCol.length;r<o;r++)if((this._$colType!="boolean"||i===this._filterdCol[r].value)&&(this._$colType!="date"&&this._$colType!="datetime"||(s=this._$colType=="date"&&i instanceof Date?this._formatting(this._$format,new Date(i.getFullYear(),i.getMonth(),i.getDate()),this._locale):this._formatting(this._$format,i,this._locale),h=this._formatting(this._$format,this._filterdCol[r].value,this._locale),s===h)))return"checked"}else if(u=t.DataManager(this._filterdCol).executeLocal(t.Query().where("value","equal",i).where("operator","equal","equal")),u.length!=0)return u[0].operator=="equal"&&u[0].isCustom==!0&&this._ctrlInstance.model.currentViewData.length>0?"checked":u[0].isCustom===!0?"":"checked"},_genCheckID:function(){return"CheckBox"+this.getIndex()},_formatting:function(n,t,i){if(this._$colType=="date"&&n==""&&(n="{0:MM/dd/yyyy hh:mm:ss}"),this._$colType=="boolean")return t===""?"":this.localizedLabels[t==!0?"True":t==!1?"False":""];if(this._formatFiltering||this._$colType=="date"){var r=this._ctrlInstance.formatting;return n!=""?r(n,t,i):t}},_updateDateFilter:function(n){return n.type!="date"&&!(n.value instanceof Date)?n:(n.value=n.value instanceof Date?n.value:t.parseJSON({val:n.value}).val,["equal","notequal"].indexOf(n.operator)==-1?n:this._setDateObject(n))},_checkHandler:function(t){n("#"+t.model.id).prop("checked",t.isChecked);var f=this._listsWrap.find("input.e-ftrchk").filter(":checked:not(.e-selectall)"),r=f.length,i=this._listsWrap.find(".e-selectall"),u;r==this._chkList.length?(i.prop("checked",!0),u=!0):r!=0&&this._interDeterminateState?t.isInteraction&&i.ejCheckBox("model.checkState","indeterminate"):(i.prop("checked",!1),u=!1);i.ejCheckBox({checked:u});n("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:r!=0})},_selectAllHandler:function(t){t.checkState=="check"?(this._chkList.filter(":not(:checked)").ejCheckBox({checked:t.isChecked}),this._chkList.prop("checked",!0)):t.checkState=="uncheck"&&(this._chkList.filter(function(){if(n(this).hasClass("e-checkbox")&&n(this).prop("checked"))return this}).ejCheckBox({checked:t.isChecked}),this._chkList.prop("checked",!1),this._chkList.removeAttr("checked"));n("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:t.isChecked})},_renderCustomFDlg:function(i){var u=this.id+i+"_CustomFDlg",r;n("#"+u).length||(r=t.buildTag("div#"+u+".e-excelfilter e-dlgcustom"),r.addClass(this._cssClass),this._renderCDlgContent(r,i),r.ejDialog({showOnInit:!1,enableResize:!1,enableModal:!0,allowKeyboardNavigation:!1,title:this._title,width:370,content:"#"+this.id,enableRTL:this._ctrlInstance.model.enableRTL,closeIconTooltip:"Close",cssClass:"e-excelfilter e-customDlg"}),r.ejDialog("refresh"))},_renderCDlgContent:function(i,r){var k=t.buildTag("div.e-dlgfields",this.localizedLabels.Showrowswhere,{},{}),u=this.id+this._$colType,l=t.buildTag("fieldset.e-fieldset"),a=t.buildTag("tr.e-fields"),v=t.buildTag("tr.e-fields"),y=t.buildTag("tr.e-fields e-top"),f=t.buildTag("input#"+u+"_CustomDrop1"),e=t.buildTag("input#"+u+"_CustomDrop2"),d=t.buildTag("input#"+u+"_CustomDrop3"),o=t.buildTag("input#"+u+"_CustomValue1.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),s=t.buildTag("input#"+u+"_CustomValue2.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),g=t.buildTag("input#"+u+"_CustomValue3.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),c=t.buildTag("tr.e-predicate"),p=t.buildTag("input#"+u+"_CustomAndPredicate",{},{},{type:"radio",name:"predicate",value:"and"}),w=t.buildTag("input#"+u+"_CustomOrPredicate",{},{},{type:"radio",name:"predicate",value:"or"}),b=t.buildTag("input#"+u+"_CustomMatchPredicate",{},{},{type:"checkbox"}),h,nt;i.append(k);h=t.buildTag("table.e-optable");a.append(t.buildTag("td.e-operator").append(f)).append(t.buildTag("td.e-value").append(o));c.append(t.buildTag("td",{},{},{}).append(p).append(t.buildTag("label.e-caption",this.localizedLabels.PredicateAnd,{},{"for":u+"_CustomAndPredicate"})).append(w).append(t.buildTag("label.e-caption",this.localizedLabels.PredicateOr,{},{"for":u+"_CustomOrPredicate"})));v.append(t.buildTag("td.e-operator").append(e)).append(t.buildTag("td.e-value").append(s));h.append(a).append(c).append(v);r=="string"&&c.append(t.buildTag("td",{},{},{}).append(b).append(t.buildTag("label.e-caption",this.localizedLabels.MatchCase,{},{"for":u+"_CustomMatchPredicate"})));(r=="number"||r=="guid")&&(y.append(t.buildTag("td.e-operator").append(d)).append(t.buildTag("td.e-value").append(g)),h.append(y));l.append(t.buildTag("legend")).append(h);i.append(t.buildTag("div.e-dlgfields").append(l));i.append(t.buildTag("div.e-dlgfields").append(this._createBtn(!0)));i.appendTo("body");nt=r.replace(r.charAt(0),r.charAt(0).toUpperCase());n([f,e]).ejDropDownList({fields:{text:"text",value:"value"},height:27,width:120,enableRTL:this._ctrlInstance.model.enableRTL});r=="number"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n([o,s]).ejNumericTextbox({showSpinButton:!1,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.NumericTextboxWaterMark,focusOut:function(){this.model.decimalPlaces==0&&this.element.prev(".e-input").val(this.model.value)}})):r=="guid"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n(o).css({height:"22px",width:"175px"}),n(s).css({height:"22px",width:"177px"})):r=="date"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n([o,s]).ejDatePicker({cssClass:this._ctrlInstance.model.cssClass,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.DatePickerWaterMark,locale:this._locale})):r=="datetime"?(n([f,e]).ejDropDownList({popupWidth:"170px"}),n([o,s]).ejDateTimePicker({cssClass:this._ctrlInstance.model.cssClass,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.DateTimePickerWaterMark,locale:this._locale})):r=="string"&&n([o,s]).ejAutocomplete({cssClass:this._ctrlInstance.model.cssClass,enableRTL:this._ctrlInstance.model.enableRTL,enableDistinct:!0,width:"177px",height:"27px",locale:this._locale});n([p,w]).ejRadioButton({cssClass:this._ctrlInstance.model.cssClass,enableRTL:this._ctrlInstance.model.enableRTL});b.ejCheckBox({});n("#"+u+"Custom_OkBtn").ejButton({text:this._getDeprecatedLocalizedLabel("OK"),showRoundedCorner:!0,width:"23.6%",click:t.proxy(this._fltrBtnHandler,this),enabled:!0});n("#"+u+"Custom_CancelBtn").ejButton({text:this.localizedLabels.Cancel,showRoundedCorner:!0,width:"23.6%",click:t.proxy(this.closeXFDialog,this)})},_openCustomFilter:function(i){var o=i!="top10"?this._$colType:i,a=this.query,s=o.replace(o.charAt(0),o.charAt(0).toUpperCase()),r=this.id+this._$colType,h,f,e,c,l,u;(this.closeXFDialog(),this._openedFltr=n("#"+r+"_CustomFDlg"),u={requestType:"filterbeforeopen",filterModel:this,columnName:this.fName,columnType:this._$colType,isCustomFilter:!0},this._ctrlInstance._trigger(this._onActionBegin,u))||(this._openedFltr.ejDialog("open"),this._openedFltr.ejDialog({open:function(){n("#"+r+"_CustomValue1").hasClass("e-autocomplete")?n("#"+r+"_CustomValue1").focus():n("#"+r+"_CustomValue1").prev().focus()}}),this._openedFltr.find("legend").html(this._displayName),h=["Number","Date"].indexOf(s)!=-1?6:5,f=this.localizedLabels[s+"MenuOptions"].slice(0,h),f.unshift({text:"",value:""}),n("#"+r+"_CustomDrop1").ejDropDownList({dataSource:f}),n("#"+r+"_CustomDrop2").ejDropDownList({dataSource:f}),this._$colType=="number"?(e=0,i=="top10"?(this._openedFltr.find(".e-optable tr").not(".e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr.e-top").removeClass("e-hide"),n("#"+r+"_CustomDrop3").ejDropDownList({dataSource:this.localizedLabels[s+"MenuOptions"]})):(e=this._$format.length!=0?parseInt(this._$format.replace(/\D/g,"")):0,this._openedFltr.find(".e-optable tr.e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr").not(".e-top").removeClass("e-hide"),n("#"+r+"_CustomValue1").ejNumericTextbox("model.decimalPlaces",e),n("#"+r+"_CustomValue2").ejNumericTextbox("model.decimalPlaces",e))):(this._openedFltr.find(".e-optable tr.e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr").not(".e-top").removeClass("e-hide")),this._$colType=="string"&&(c=this._$foreignField?this._$foreignField:this.fName,l=this._$foreignData&&this._$foreignField?this._$foreignData:this._dataSource,this._openedFltr.find(".e-autocomplete").ejAutocomplete({fields:{text:c},dataSource:l,query:a,focusIn:function(){var n=this.element.closest("td").siblings().find(".e-dropdownlist").ejDropDownList("getSelectedValue"),t=this.element.closest(".e-dialog-scroller").find(".e-checkbox").prop("checked");this.model.caseSensitiveSearch=t;this.model.filterType=n==""?this.model.filterType:n}})),this._$colType=="date"&&this._$format!=""?this._openedFltr.find(".e-datepicker").ejDatePicker({dateFormat:this._$format.replace(/{0:|}/g,function(){return""}),enableStrictMode:!0}):this._$colType=="datetime"&&this._$format!=""&&this._openedFltr.find(".e-datetimepicker").ejDateTimePicker({dateTimeFormat:this._$format.replace(/{0:|}/g,function(){return""}),enableStrictMode:!0}),this._setFilteredData(r,i),t.isNullOrUndefined(this._customFilterHandler)||this._customFilterHandler(),u={requestType:"filterafteropen",filterModel:this,columnName:this.fName,columnType:this._$colType,isCustomFilter:!0},this._ctrlInstance._trigger(this._onActionComplete,u))},_setFilteredData:function(r,u){var o=n.inArray(this.fName,this.cFilteredCols),e=[],v=[],s,f,c,l,p,w;if(u!="top10"){o!=-1&&(e=t.DataManager(this.filteredColumn).executeLocal(t.Query().where("field","equal",this.fName)));o!=-1&&this._$foreignField&&(e=e[0].actuals);this._initialFName!=null&&this._initialFName==this.fName&&(e[0].isCustom=!0);s=e.length;var a=this._openedFltr.find(".e-dropdownlist"),h=this._openedFltr.find(".e-value input.e-ejinputtext.e-input"),y=this._openedFltr.find(".e-predicate");for(v=o!=-1&&s&&e[0].from!=i?[u,""]:u=="between"&&o!=-1&&s?[e[0].operator,t.isNullOrUndefined(e[1])?"":e[1].operator]:o!=-1&&s&&e[0].isCustom?[u!="customfilter"&&o!=-1?u:e[0].operator,u=="customfilter"&&e[1]?e[1].operator:""]:o==-1&&u=="customfilter"?["equal",""]:u=="between"||u=="customfilter"?u!="customfilter"?["greaterthanorequal","lessthanorequal"]:["",""]:[u,""],f=0;f<(o!=-1?s:2);f++)c=/\D*/.exec(v[f])[0],n(a[f]).prop("value",c),n(a[f]).ejDropDownList("setSelectedValue",c),n(a[f]).ejDropDownList({change:function(){this.element.closest(".e-fields").find(".e-autocomplete").val("")}}),l=o!=-1&&s&&e[f].isCustom&&(c==(this._$foreignField?e[f].actualFilterOperator:e[f].operator)||c=="customfilter"||c=="between")?this._$foreignField?c!=""?e[f].actualFilterValue:"":e[f].value:"",n(h[f]).hasClass("e-datepicker")?n("#"+h[f].id).ejDatePicker("model.value",o!=-1&&s&&e[f].isCustom?e[f].value:null):n(h[f]).hasClass("e-numerictextbox")?n("#"+h[f].id).ejNumericTextbox("model.value",l):n(h[f]).hasClass("e-datetimepicker")?n(h[f]).ejDateTimePicker("model.value",l):n(h[f]).val(l),p=o!=-1&&s&&e[f].isCustom&&e[f].predicate!=i?this._$foreignField?e[f].actualPredicate:e[f].predicate:"and",y.find("input[value="+p+"]").ejRadioButton({checked:!0}),this._$colType=="string"&&(w=o!=-1&&s&&e[f].isCustom?e[f].matchcase:this._matchCase,y.find("input.e-js[type='checkbox']").ejCheckBox({checked:w})),this._openedFltr.find(".e-value input:visible:eq(0)").select()}},_setDateObject:function(i){var f;if(i.value!=null){var s=i.value,u=n.extend(!0,{},i),r=n.extend(!0,{},i),e=new Date(u.value.setSeconds(u.value.getSeconds()-1)),o=new Date(r.value.setSeconds(r.value.getSeconds()+2));return i.value=new Date(i.value.setSeconds(r.value.getSeconds()-1)),u.value=e,r.value=o,i.operator=="equal"?(u.operator="greaterthan",u.predicate="and",r.operator="lessthan",r.predicate="and"):i.operator=="notequal"&&(u.operator="lessthanorequal",u.predicate="or",r.operator="greaterthanorequal",r.predicate="or"),f=t.Predicate(u.field,u.operator,u.value,!1),f=f[r.predicate](r.field,r.operator,r.value,!1),i.ejpredicate=f,i.type="date",i}return i},_getCDlgFields:function(){var h=this._openedFltr.find(".e-dropdownlist"),f,y=this._openedFltr.find(".e-checkbox"),c=!0,e=[],s=this._openedFltr.find(".e-value input.e-ejinputtext.e-input"),p=this._openedFltr.find(".e-value input"),w=this._openedFltr.find(".e-predicate input[type='radio']:checked").val(),r,l,t,u,a,v,o;for(n.inArray(this.fName,this.cFilteredCols)==-1&&this.cFilteredCols.push(this.fName),r=0,l=h.length;r<l;r++)if(t=n(h[r]).ejDropDownList("getSelectedValue"),this._$colType=="number"&&(u=parseFloat(s.eq(r).ejNumericTextbox("model.value"))),this._$colType=="guid"&&(u=p.eq(r).val()),this._$colType=="string"&&(u=s.eq(r).val(),c=y.is(":checked")),this._$colType=="date"&&(u=s.eq(r).ejDatePicker("model.value")),this._$colType=="datetime"&&(u=s.eq(r).ejDateTimePicker("model.value")),f={field:this.fName,predicate:r==1?w:"or",matchcase:c,isCustom:!0},t=="top"||t=="bottom")e.push(n.extend(!0,{value:"",operator:"notequal",take:u,from:t},f));else if(t!="")this._empties.indexOf(u+"")>-1||this._$colType=="number"&&isNaN(u)?(a=this.iterateAndGetCollection(this._empties.join(this._spliter),n.extend({},f,{predicate:t.toLowerCase()==="notequal"?"and":"or",operator:t.toLowerCase()})),v=this.generatePredicate(a),e.push(n.extend({},f,{ejpredicate:v,operator:t.toLowerCase()}))):(o={},n.extend(!0,o,{value:u,operator:t.toLowerCase(),isCustom:!0,actualFilterOperator:t.toLowerCase(),actualFilterValue:u,actualPredicate:f.predicate},f),this._$colType=="date"&&(o.type="date"),e.push(this._$colType=="date"&&["equal","notequal"].indexOf(t.toLowerCase())!=-1?this._setDateObject(o):o));else break;this._$foreignField==i?this.initiateFilter(e):this._filterForeignData(e,!0)},_fltrBtnHandler:function(){var i=[],u={},f,e;if(this._openedFltr.hasClass("e-dlgcustom"))i=this._getCDlgFields(),n.inArray(this.fName,this.cFilteredCols)==-1&&i[0]&&this.cFilteredCols.push(this.fName);else{if(!this._isFiltered&&this._listsWrap.find(".e-selectall").ejCheckBox("model.checked")&&this._searchCount==0)return this.closeXFDialog();var o=this._listsWrap.find("input.e-ftrchk").filter(":checked:not(.e-selectall)"),c=o.length,r,s=this.getType(),l=this._colType=="string"?"startswith":"equal",a=this._colType=="string"?this._matchCase:!0,h={field:this.fName,predicate:"or",operator:l,matchcase:a};for(f=0;f<c;f++){if(r=o[f].value,this.enableNormalize&&r.indexOf(this._spliter)!=-1){t.merge(i,this.iterateAndGetCollection(r,h));continue}r=this.processValue(r,s);n.extend(!0,u,{value:r},h);i.push(s=="date"?this._setDateObject(u):u);u={}}e=n.inArray(this.fName,this.cFilteredCols);e!=-1&&this.cFilteredCols.splice(e,1);this._isFiltered&&this._searchRequest&&(this._checkIsIndeterminate(this.fName,this.filteredColumn),this._isIndeterminate&&(t.merge(i,this.filteredColumn),i=t.distinct(i,"value",!0),this._searchRequest=!1));this.initiateFilter(i)}},initiateFilter:function(r){var f=r[0],e,u,o;if(!t.isNullOrUndefined(f)){for(isTake=f.from,e=f.ejpredicate?f.ejpredicate:t.Predicate(f.field,f.operator,f.value,!f.matchcase),u=1,o=r.length;u<o;u++)e=r[u].ejpredicate!=i?e[r[u].predicate](r[u].ejpredicate):e[r[u].predicate](r[u].field,r[u].operator,r[u].value,!r[u].matchcase);arg={action:"filtering",filterCollection:r,fieldName:this.fName,ejpredicate:e,tableID:this._$tableID};this._predicates[this._$key]==i&&(this._predicates[this._$key]={});this._predicates[this._$key][this.fName]=isTake?{from:f.from,take:f.take}:e;this._openedFltr.hasClass("e-dlgcustom")||!this._listsWrap.find(".e-selectall").ejCheckBox("model.checked")||this._searchCount||n.inArray(this.fName,this._columnsFiltered)==-1||(arg={action:"clearfiltering",filterDetails:{field:this.fName,operator:"",predicate:"or",value:""},fieldName:this.fName,tableID:this._$tableID});n.inArray(this.fName,this._columnsFiltered)==-1&&this._columnsFiltered.push(this.fName);this._filterHandler(arg)}this.closeXFDialog()},getDistinct:function(n,i,r,u){for(var s={},h=n.length,c=[],e,f,o;h--;)e=n[h],f=t.getObject(i,e),o=f,t.isNullOrUndefined(e)||(this.enableNormalize&&(o=this._formatting(this._$format,f,this._locale)),e.ejvalue=o,!u&&f in s||c.push(r?e:f),s[f]=!0);return t.group(t.mergeSort(c,i),"ejvalue")},iterateAndGetCollection:function(t,i){for(var r=t.split(this._spliter),u=r.length,f=[],e;u--;)e=this.processValue(r[u]),f.push(n.extend(!0,{value:e},i));return f},processValue:function(n,r){r=r||this.getType();r=this._empties.indexOf(n)!=-1?"empty":r;n=n===this.guid?this._blankValue+"":n;switch(r){case"empty":n=n=="null"?null:n=="undefined"?i:"";break;case"date":case"datetime":n=new Date(n);break;case"number":n=+n;break;case"boolean":n=!isNaN(n)&&typeof n=="string"?t.parseInt(n)!=0:n==="true"?!0:!1}return n},getType:function(){return t.isNullOrUndefined(this._$foreignField)?this._$colType:this._$foreignKeyType},replacer:function(n,t,i,r){return typeof i=="function"&&(i=i.call(this,r)),n.replace(t,i)},_virtualize:function(i){var f=n("#"+this.id+this._$colType+"_CheckBoxList").height(),r=this._chkList.not(".e-checkbox").filter(function(){if(this.offsetTop>i.scrollTop-this.offsetHeight&&i.scrollTop+f+70>this.offsetTop+this.offsetHeight)return this}),u;r.length!=0&&(r.filter(":checked").ejCheckBox({checked:!0}),r.filter(":not(:checked)").ejCheckBox({checked:!1}),r.ejCheckBox({change:t.proxy(this._checkHandler,this)}),u=this._listsWrap.ejScroller("instance"),u.refresh())},resetFilterModel:function(){this._blank=i;this._addAtLast=!1;this._isFiltered=!1;this._searchCount=0},resetExcelFilter:function(){var u,i,e=this.id,f,r,t;for(this._predicates=[],this.cFilteredCols=[],this.resetFilterModel(),u=0,f=this._posType.length;u<f;u++)i=this._posType[u],r=e+i,t=n("#"+r+"_CustomFDlg"),n("#"+r+"_CheckBoxList").ejWaitingPopup("destroy"),n("#"+r+"_excelDlg").remove(),t.find(".e-dropdownlist").ejDropDownList("destroy"),t.find(".e-button").ejButton("destroy"),(i=="string"||i=="boolean")&&t.find(".e-autocomplete").ejAutocomplete("destroy"),i=="number"&&t.find(".e-numerictextbox").ejNumericTextbox("destroy"),i=="date"&&t.find(".e-datepicker").ejDatePicker("destroy"),t.ejDialog("destroy"),n("#"+r+"_CustomFDlg").remove()},_wireEvents:function(){this._ctrlInstance._on(this._dialogContainer,"focus click",".e-searchbox",t.proxy(this._searchBoxFocus,this));this._ctrlInstance._on(this._dialogContainer,"keyup",".e-searchbox input",t.proxy(this._search,this))}};t.ExcelFilter.valueDelimiter="@|@";t.ExcelFilter.Locale=t.ExcelFilter.Locale||{};t.ExcelFilter.Locale["default"]=t.ExcelFilter.Locale["en-US"]={SortNoSmaller:"Sort Smallest to Largest",SortNoLarger:"Sort Largest to Smallest",SortTextAscending:"Sort A to Z",SortTextDescending:"Sort Z to A",SortDateOldest:"Sort by Oldest",SortDateNewest:"Sort by Newest",SortByColor:"Sort By Color",SortByCellColor:"Sort by Cell Color",SortByFontColor:"Sort by Font Color",FilterByColor:"Filter By Color",CustomSort:"Custom Sort",FilterByCellColor:"Filter by Cell Color",FilterByFontColor:"Filter by Font Color",ClearFilter:"Clear Filter",NumberFilter:"Number Filters",GuidFilter:"Guid Filters",TextFilter:"Text Filters",DateFilter:"Date Filters",DateTimeFilter:"Date Time Filters",SelectAll:"Select All",Blanks:"Blanks",Search:"Search",Showrowswhere:"Show rows where",NumericTextboxWaterMark:"Enter value",StringMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Starts With",value:"startswith"},{text:"Ends With",value:"endswith"},{text:"Contains",value:"contains"},{text:"Custom Filter",value:"customfilter"}],NumberMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"},{text:"Custom Filter",value:"customfilter"}],GuidMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Custom Filter",value:"customfilter"}],DateMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"},{text:"Custom Filter",value:"customfilter"}],DatetimeMenuOptions:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"},{text:"Custom Filter",value:"customfilter"}],Top10MenuOptions:[{text:"Top",value:"top"},{text:"Bottom",value:"bottom"}],title:"Custom Filter",PredicateAnd:"AND",PredicateOr:"OR",OK:"OK",MatchCase:"Match Case",Cancel:"Cancel",NoResult:"No Matches Found",CheckBoxStatusMsg:"Not all items showing",DatePickerWaterMark:"Select date",DateTimePickerWaterMark:"Select date time",True:"true",False:"false"}}(jQuery,Syncfusion),function(n,t){t.scheduleFeatures=t.scheduleFeatures||{};var r=function(){return"{{for resourceName}}{{for ~cols=colspan}}<td class='e-resourcecells' colspan='{{:~cols}}'> {{for ~resource=resourceNam}}<div class='e-resourceheadertext' align='center' title='{{if userResTemplId == true}}{{:resourceNam}}{{else}}{{:~resource}}{{/if}}'>{{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resource}}{{/if}}<\/div>{{/for}} <\/td>{{/for}}{{/for}}"};t.scheduleFeatures.resources={_getMultipleResourceCellsCount:function(n){var y,s,n,h,r,f,c,l,p,e,i,a,o,v,u;if(this._grouping.length===1){if(y=this._findResourceIndex(this._tempResource,"name",this._grouping[0]),s=this._resourceInfo[y].dataSource.length,this._resWorkWeek)for(n=0,h=this._resourceInfo[y].dataSource,u=0;u<h.length;u++)n=t.isNullOrUndefined(h[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?n+this.model.workWeek.length:n+h[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length}else{for(r=this._getResourceCollection(),f=[],i=0;i<r.length;i++)if(f=[],i==0)for(a=0;a<r[i].dataSource.length;a++)f.push({resourceNam:r[i].dataSource[a][r[i].text]});else for(i>1&&(r[i-1].dataSource=[],r[i-1].dataSource=this.res),this.res=[],c=t.group(r[i].dataSource,r[i].groupId),l=t.group(r[i-1].dataSource,r[i-1].id),this._resourceManager1=c instanceof t.DataManager?c:t.DataManager(c),o=0;o<l.length;o++)for(v=0;v<l[o].items.length;v++)if(p=(new t.Query).where("key",t.FilterOperators.equal,l[o].items[v][r[i-1].id]),e=this._resourceManager1.executeLocal(p),e.length>0)for(u=0;u<e[0].items.length;u++)f.push({resourceNam:e[0].items[u][r[i].text]}),this.res.push(e[0].items[u]);s=f.length;this.res1=f.length}return n=this._resWorkWeek?n:n*s,{resCount:s,count:n}},_initResourceData:function(n,t){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){n.dataSource=r.result;i._resourceInfo.push(n);t==i.model.resources.length-1&&(i._renderInitSchedule(),i._bindAppointmentsData("Load"))})},_showMultipleResourceDetails:function(n){var f,e,o,u,i,r;if(this._tempResource.length>0){for(u=this._resCollection,r=0;r<u.length;r++)this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText");for(i=0;i<this.render_Resources.length-1;i++)f=this.render_Resources[i+1]instanceof t.DataManager?this.render_Resources[i+1]:t.DataManager(this.render_Resources[i+1]),e=(new t.Query).where(u[i+1].groupId,t.FilterOperators.equal,n[this._appointmentSettings.resourceFields.toString().split(",")[i].trim()]),o=f.executeLocal(e),this._appointmentAddWindow.find(".owner_"+(i+1)).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+(i+1)).ejAutocomplete("option","dataSource",o);for(r=0;r<u.length;r++)this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(n[this._appointmentSettings.resourceFields.toString().split(",")[r].trim()])}},_renderAppWindowResources:function(n){for(var i=this.render_Resources,r=this.model.enableRTL?"margin-right:30px;margin-top:-18px":"",u=this.model.enableRTL?"float:none":"float:left",t=0;t<i.length;t++)n.find(".owner_"+t).ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",cssClass:this.model.cssClass,multiSelectMode:this._tempResource[t].allowMultiple?"visualmode":"none",emptyResultText:this._getLocalizedLabels("EmptyResultText"),dataSource:i[t],fields:{text:this._resCollection[t].text,key:this._resCollection[t].id},change:this._onResourceChange,template:"<div class='e-resourcediv' style='height:15px; margin-right:5px; margin-top:3px; float:left;width:15px;"+u+"; background-color: ${"+this._resCollection[t].color+"}'><\/div><div style= "+r+">${"+this._resCollection[t].text+"}<\/div>"})},_onResourceChange:function(i){var d,b,v,y,p,h,s;if(!t.isNullOrUndefined(i.value)&&i.value!=""){var g=n("#"+this._id.toString().split("_")[0]),f=g.ejSchedule("instance"),w=parseInt(this._id.toString().split("_")[2]),nt=f._appointmentAddWindow.find(".owner_"+w).ejAutocomplete("option","multiSelectMode"),o=this.getSelectedItems(),u=f._resCollection;if(w<f.render_Resources.length-1&&o.length>0){var r=w+1,k=f.render_Resources[r-1]instanceof t.DataManager?f.render_Resources[r-1]:t.DataManager(f.render_Resources[r-1]),tt=f.render_Resources[r]instanceof t.DataManager?f.render_Resources[r]:t.DataManager(f.render_Resources[r]),l,e,c=[];if(nt=="none"){if(t.isNullOrUndefined(i.value)||(d=(new t.Query).where(u[r-1].text,t.FilterOperators.equal,i.value),b=k.executeLocal(d)),v=!i.value||t.isNullOrUndefined(i.value)||b.length<=0?o[0][u[r-1].id]:b[0][u[r-1].id],!t.isNullOrUndefined(v))for(a=r;a<u.length;a++){for(e=new t.DataManager(u[r].dataSource).executeLocal((new t.Query).where(u[r].groupId,t.FilterOperators.equal,v)),e.length!=0&&(v=e[0][u[r-1].id]),c=[],s=0;s<e.length;s++)c.push(e[s]);e.length!=0?(f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c),f._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(e[0][u[r].id]),o=e[0][u[r].id]):(f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c));r++}}else{for(y=t.Predicate(u[r-1].id,t.FilterOperators.equal,o[0][u[r-1].id]),o=i.value.split(","),h=1;h<o.length;h++)y=y.or(u[r-1].text,t.FilterOperators.equal,o[h]);if(l=(new t.Query).where(y),resApp=k.executeLocal(l),resApp.length>0){for(p=t.Predicate(u[r].groupId,t.FilterOperators.equal,resApp[0][u[r-1].id]),h=1;h<resApp.length;h++)p=p.or(u[r].groupId,t.FilterOperators.equal,resApp[h][u[r-1].id]);for(l=(new t.Query).where(p),e=tt.executeLocal(l),c=[],s=0;s<e.length;s++)c.push(e[s]);f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText");f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c);f._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(e[0][u[r].id]);o.push(e[0][u[r].id])}}}}},_getResourceCollection:function(){var i=[],f,n,r,u;if(this._tempResource.length!=0){if(t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0)for(n=0;n<this._tempResource.length;n++)i.push({index:n});else{for(n=0;n<this._grouping.length;n++)f=this._findResourceIndex(this._tempResource,"name",this._grouping[n]),i.push({index:f,name:this._tempResource[n].name});i=i.sort(function(n,t){var i=n.index,r=t.index;return i<r?-1:i>r?1:0})}for(r=[],u=0;u<i.length;u++)r.push(this._resourceInfo[i[u].index]);return this._resCollection=r,r}},_resourceSort:function(){var r,u,e,o,s,f,h=[],n=[],l=[];if(this._tempResource.length>1){for(i=0;i<this._tempResource.length;i++)for(j=0;j<this._tempResource[i].resourceSettings.dataSource.length;j++)h.push(this._tempResource[i].resourceSettings.dataSource[j]);for(u=1,a=0;a<this._tempResource.length;a++){for(b=0,f=this._tempResource[a].resourceSettings.dataSource;b<f.length;b++)if(e=n.indexOf(f[b]),e==-1?n.push(f[b]):"",r=new t.DataManager(h).executeLocal((new t.Query).where(this._tempResource[u].resourceSettings.groupId,t.FilterOperators.equal,f[b][this._tempResource[a].resourceSettings.id])),r=r.filter(function(n){return f.indexOf(n)===-1}),o=n.indexOf(f[b]),r.length!=0)for(c=0;c<r.length;c++)s=o+c+1,e=n.indexOf(r[c]),e==-1?n.splice(s,0,r[c]):"";u++;u=u==this._tempResource.length?u-1:u}for(x=0;x<n.length;x++)o=this.res1.indexOf(n[x]),o!=-1&&l.push(n[x]);this.res1=l}else n=this.res1;return n},_renderMultipleResourceHeaderTemplate:function(i,r){var nt,p,c,tt,it,k,a,u,e,ft,et,o,g,d,l,y,s;this.res1=[];this.render_Resources=[];this.level_Resources=[];var v=this.currentView(),f=this._getResourceCollection(),ot=this.model.showWeekend?7:this.model.workWeek.length,h=v=="day"?1:v=="week"||v=="month"?ot:this.model.workWeek.length;if(h=v=="customview"&&this._dateRender.length>=7?ot:v=="customview"&&this._dateRender.length<7?this._dateRender.length:h,t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0){for(s=0;s<this._tempResource.length;s++)this.render_Resources.push(this._tempResource[s].resourceSettings.dataSource);this.res1=[0]}else if(nt=this.model.resourceHeaderTemplateId?!0:!1,p=[],this._grouping.length===1){for(u=0;u<this._grouping.length;u++)c=this._findResourceIndex(this._tempResource,"name",this._grouping[u]);for(u=0;u<this._resourceInfo[c].dataSource.length;u++)this._resWorkWeek&&(l=t.isNullOrUndefined(this._resourceInfo[c].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?h:this._resourceInfo[c].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length),this.currentView()!="agenda"&&p.push({resourceNam:this._resourceInfo[c].dataSource[u][this._resourceInfo[c].text],colspan:this._resWorkWeek?l:h,userResHeader:this._getResourceHeadTemplate(n.extend(this._resourceInfo[c].dataSource[u],{classname:"e-childnode"})),userResTemplId:nt}),this.res1.push(this._resourceInfo[c].dataSource[u]),this.level_Resources.push(this.res1[u]);this._valueCollection=this.res1;this.render_Resources.push(this.res1);this.model.orientation=="vertical"&&this.currentView()!="agenda"&&i!==null&&r!=null&&(tt=v=="month"?50:56,it=this.resourceHeadTemplate.render({cols:r,resourceName:p,leftWidth:tt}),i.append(t.buildTag("tr.e-headerbar").append(it)))}else{var st=[],lt=[],rt=[],b=0,ht=[],ut=[],at=[],ct=[];if(this.resourceValue=0,k=0,st=n.merge(st,f),this._tempResource.length){for(s=0,e=0;e<f[f.length-2].dataSource.length;e++)for(var d=(new t.Query).where(f[f.length-1].groupId,t.FilterOperators.equal,f[f.length-2].dataSource[e][f[f.length-2].id]),o=new t.DataManager(f[f.length-1].dataSource).executeLocal(d),w=0;w<o.length;)lt.push({resourceNam:o[w][f[f.length-1].text],colspan:1*h,userResHeader:this._getResourceHeadTemplate(n.extend(o[w],{classname:"e-childnode"})),userResTemplId:nt}),rt[s]=o[w],this.res1.push(o[w]),s++,w++;this._valueCollection=rt;f[f.length-1].dataSource=rt;a=n.extend(!0,[],f)}for(u=this._tempResource.length-1;u>=0;u--){for(at.push(u),e=0;e<f[u].dataSource.length;e++){if(ft=u!=0?this._findResourceIndex(f[u-1].dataSource,f[u-1].id,f[u].dataSource[e][f[u].groupId]):0,et=u!=this._tempResource.length-1?this._findResourceIndex(f[u+1].dataSource,f[u+1].groupId,f[u].dataSource[e][f[u].id]):this._tempResource.length-1,t.isNullOrUndefined(ft)&&t.isNullOrUndefined(et)?f[u].dataSource[e]=0:"",!t.isNullOrUndefined(ft)&&!t.isNullOrUndefined(et)&&f[u].dataSource[e]!==0){if(ut.push(f[u].dataSource[e]),this.resourceValue=ut.length,u<=this._tempResource.length-2){if(d=(new t.Query).where(f[u+1].groupId,t.FilterOperators.equal,f[u].dataSource[e][f[u].id]),o=new t.DataManager(f[u+1].dataSource).executeLocal(d),u<=this._tempResource.length-3){for(s=0;s<o.length;s++)b=b+(t.isNullOrUndefined(o[s].count)?0:o[s].count);k=this.model.orientation=="vertical"?b:b+o.length;f[u].dataSource[e].count=k;b=0}u==this._tempResource.length-2&&(f[u].dataSource[e].count=o.length,k=o.length);this.resourceValue=k;o.length=0}if(this._resWorkWeek){if(g=0,u!=this._tempResource.length-1)for(d=(new t.Query).where(a[u+1].groupId,t.FilterOperators.equal,a[u].dataSource[e][a[u].id]),l=new t.DataManager(a[u+1].dataSource).executeLocal(d),y=0;y<l.length;y++)g+=t.isNullOrUndefined(l[y][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?t.isNullOrUndefined(l[y].colspan)?h:l[y].colspan:l[y][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else g+=t.isNullOrUndefined(a[u].dataSource[e][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?h:a[u].dataSource[e][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;a[u].dataSource[e].colspan=g;this.resourceValue=g}this.currentView()!="agenda"&&p.push({resourceNam:f[u].dataSource[e][f[u].text],colspan:this._resWorkWeek?this.resourceValue:this.resourceValue*h,userResHeader:this._getResourceHeadTemplate(n.extend(f[u].dataSource[e],{classname:this._tempResource.length-1==u?"e-childnode":"e-parentnode"})),userResTemplId:nt});this.level_Resources.push(f[u].dataSource[e]);ut.length=0}this.model.orientation=="vertical"&&this.currentView()!="agenda"&&i!==null&&r!=null&&(tt=v=="month"?50:56,it=this.resourceHeadTemplate.render({cols:r,resourceName:p,leftWidth:tt}),ct[u]=t.buildTag("tr.e-headerbar").append(it)[0])}ht[u]=f[u].dataSource;p.length=0}this.render_Resources=ht;this.model.orientation=="vertical"&&this.currentView()!="agenda"?i.append(ct):""}return i},_getMultipleResourceAlldayApp:function(n,t,i,r){this.allDayCount=[];new Date(new Date(n[t]).setHours(0,0,0,0)).getTime()==new Date(new Date(this._processed[r][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&this._processed[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]&&(this._processed[r][this._appointmentSettings.allDay]===!0||(new Date(this._processed[r][this._appointmentSettings.endTime])-new Date(this._processed[r][this._appointmentSettings.startTime]))/36e5>=24)&&(this._setAllDayPos(this._processed[r],t,i),this.allDayCount.push(r))},_getResourceColor:function(n){var i=this._resCollection,f,r="",u="",e;if(t.isNullOrUndefined(this.model.group))f=this._findResourceIndex(this.render_Resources[this.render_Resources.length-1],i[i.length-1].id,n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()]),t.isNullOrUndefined(f)||(r=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].color])?r:this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].color],u=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].appointmentClass])?u:this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].appointmentClass]);else{for(e=0;e<this.render_Resources.length;e++)if(f=this._findResourceIndex(this.render_Resources[e],i[e].id,n[this._appointmentSettings.resourceFields.split(",")[e].trim()]),!t.isNullOrUndefined(f)&&(r=r==""||t.isNullOrUndefined(r)?this.render_Resources[e][f][i[e].color]:r,u=u==""||t.isNullOrUndefined(u)?this.render_Resources[e][f][i[e].appointmentClass]:u,!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(u)))break;r=!t.isNullOrUndefined(r)&&r!=""?r:"";u=!t.isNullOrUndefined(u)&&u!=""?u:""}return{appointData:r,appointCustomcss:u,applyFilter:!1}},_getResourceValue:function(n){var r,i;return t.scheduleFeatures.resources&&this._tempResource.length!=0&&(i=this._getResourceDetails(n),r=t.DataManager(this._resCollection[i.length-1].dataSource).executeLocal((new t.Query).where(this._tempResource[i.length-1].resourceSettings.id,"equal",i[0].id))[0]),r},_getResourceDetails:function(n,i){var e,s,f,h,o,l,a,c,r,u;if(this._tempResource.length!=0&&this._tempResource.length>0){if(e=this.currentView()=="day"?1:this.model.showWeekend&&(this.currentView()=="week"||this.currentView()=="month")?7:this.model.workWeek.length,e=this.model.showWeekend&&this.currentView()=="customview"&&this._dateRender.length>=7?7:this.currentView()=="customview"&&this._dateRender.length<7?this._dateRender.length:e,i=this.currentView()==="month"||this.currentView()=="customview"?n.index():!t.isNullOrUndefined(this._cellIndex)&&t.isNullOrUndefined(this._multiple)?this._cellIndex:n.index(),n.hasClass("e-detailedapp")?"":this.index=i,i=n.hasClass("e-detailedapp")?this.index:i,this._resWorkWeek){for(s=0,f=0;f<this._valueCollection.length;f++)if(s+=t.isNullOrUndefined(this._valueCollection[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this._valueCollection[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,s>n.index()){i=f;break}}else i=this.model.orientation=="vertical"?parseInt(i/e):t.isNullOrUndefined(this._workCellIndex)?n.parent().index():this._workCellIndex;for(h=this.model.orientation=="vertical"?this._valueCollection:this._resCollect,this._resourceCollection=[],r=this._resCollection,u=r.length-1;u>=0;u--)u==r.length-1?t.isNullOrUndefined(this.model.group)?(this._resourceCollection.push({id:r[r.length-1].dataSource[i][r[r.length-1].id]}),o=r[r.length-1].dataSource[i][r[r.length-1].groupId]):(this._resourceCollection.push({id:h[i][r[u].id]}),o=h[i][r[u].groupId]):(l=r[u].dataSource instanceof t.DataManager?r[u].dataSource:t.DataManager(r[u].dataSource),a=(new t.Query).where(r[u].id,t.FilterOperators.equal,o),c=l.executeLocal(a),this._resourceCollection.push({id:c[0][r[u].id]}),o=c[0][r[u].groupId]);return this._resourceCollection}},_getResourceFields:function(n){if(!t.isNullOrUndefined(this.model.group)||this._tempResource.length>1)for(var i=0,r=this._resourceCollection.length-1;i<this._resourceCollection.length;i++,r--)n[this._appointmentSettings.resourceFields.split(",")[i].trim()]=this._resourceCollection[r].id;else n[this._appointmentSettings.resourceFields.split(",")[0].trim()]=this._resourceCollection[0].id;return n},_getDragDropResourceData:function(n,i,r){var f,e,o,u,s;if(!t.isNullOrUndefined(i)){if(f=n.currentView()=="day"?1:n.model.showWeekend&&(n.currentView()=="week"||n.currentView()=="month")?7:n.model.workWeek.length,f=n.model.showWeekend&&n.currentView()=="customview"&&n._dateRender.length>=7?7:n.currentView()=="customview"&&n._dateRender.length<7?n._dateRender.length:f,e=n.model.enableRTL?n.res1.length-Math.floor(i/f)-1:Math.floor(i/f),n._resWorkWeek)for(o=0,u=0;u<n.res1.length;u++)if(o+=t.isNullOrUndefined(n.res1[u][n.model.resources[n.model.resources.length-1].resourceSettings.workWeek])?n.model.workWeek.length:n.res1[u][n.model.resources[n.model.resources.length-1].resourceSettings.workWeek].length,o>i){e=u;break}s=n.model.orientation=="vertical"?n.res1[e]:n._resCollect[i];r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]=s[n.model.resources[n.model.resources.length-1].resourceSettings.id];n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=s[n.model.resources[n.model.resources.length-1].resourceSettings.groupId])}return r},_renderResourceData:function(n,i){var f,u,r,e,s,o;if((n.hasClass("e-workcells")||n.hasClass("e-alldaycells")||n.hasClass("e-monthcells"))&&!n.hasClass("e-resourceheadercells")&&this._getResourceDetails(n),f=[],u=[],this._tempResource.length)for(r=this._resourceCollection.length-1;r>=0;r--)e=this._findResourceIndex(this._resCollection[r].dataSource,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id),f.push(this._resCollection[r].dataSource[e]),r!=0?(s=(new t.Query).where(t.Predicate(this._resCollection[r].groupId,t.FilterOperators.equal,this._resCollection[r].dataSource[e][this._resCollection[r].groupId])),o=new t.DataManager(this._resCollection[r].dataSource).executeLocal(s),i=this._findResourceIndex(o,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id),u=o,this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",u),this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(u[i][this._resCollection[r].id])):(this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(f[this._resourceCollection.length-1-r][this._resCollection[r].id]))},_bindResourcesData:function(){var i,n;if(this._tempResource.length!=0){for(this._resourceInfo=[],i=!1,n=0;n<this._tempResource.length;n++)t.isNullOrUndefined(this._tempResource[n].resourceSettings)||(!t.isNullOrUndefined(this._tempResource[n].resourceSettings.query)&&this._tempResource[n].resourceSettings.query instanceof t.Query||(this._tempResource[n].resourceSettings.query=t.Query()),this._tempResource[n].resourceSettings.dataSource instanceof t.DataManager?this._initResourceData(this._tempResource[n].resourceSettings,n):(this._resourceInfo.push(this._tempResource[n].resourceSettings),i=!0));i&&this._renderInitSchedule()}},_renderResourceElements:function(n){for(var t=0;t<this._tempResource.length;t++)n+="<tr><td class='e-leftfields e-textlabel'>"+this._tempResource[t].title+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"_ownerfield_"+t+"' class='owner_"+t+"' type='text' value=''/><div id='ownerlist'><\/div><\/td><\/tr>";return n},_renderResourcesTemplate:function(){this.model.orientation=="vertical"&&(this.resourceHeadTemplate=n.templates(r()))}}}(jQuery,Syncfusion),function(n,t,r){t.scheduleFeatures=t.scheduleFeatures||{};var u=function(){return"<table class='e-table e-workcellstab' height='100%'width='100%' cellpadding='0px' cellspacing='0px'><tbody>{{for cellrows ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}<tr>{{for ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}<td class='e-monthcells' width='{{:~cwidth}}' height='{{:~cheight}}'><div class='e-monthheader'><\/div>{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},f=function(){return"<div class='{{:appClass}} {{:appointCustomcss}}' id='Appointment_{{:id}}' guid= '{{:uid}}' resource='{{:resId}}' role='presentation' style='{{if rtl == true}}right{{else}}left{{/if}}: {{:left}}; {{if ignoreColorFilter == true}}filter:none;{{/if}} width: {{:appWidth}}; background: {{:appointData}}; color:{{:appointtextcolor}}; {{if appHeight}}height:{{:appHeight}}px;{{/if}} top: {{:top}}px;' >{{if appResize == true}}{{if appClass == 'e-appointment'}}{{if orientation == 'vertical'}}<div class='e-tophandle'><\/div><div class='e-bottomhandle'><\/div>{{else}}<div class='e-lefthandle'><\/div><div class='e-righthandle'><\/div>{{/if}}{{else}}{{if currentview != 'day'}}<div class='e-lefthandle'><\/div><div class='e-righthandle'><\/div>{{/if}}{{/if}}{{/if}}<span class='e-icon e-schedulemouseclose'/><\/span>{{if (priority!=undefined && priority!='') && ((priorityTemplate!=undefined && priorityTemplate!=''))}}{{if enablePriority==null}}<div class='e-priority e-{{:priorityTemplate}}'><\/div>{{else}}<div class='e-priority'>{{:priorityTemplate}}<\/div>{{/if}}{{/if}}{{if userAppTemplId == false}}{{if leftInd ==true}}<span class='e-icon e-arrow-sans-left e-leftind'><\/span>{{/if}}{{if rightInd ==true}}<span class='e-icon e-arrow-sans-right e-rightind'><\/span>{{/if}}{{if bottomInd ==true}}<span class='e-icon e-arrow-sans-down e-bottomind'><\/span>{{/if}}{{if topInd ==true}}<span class='e-icon e-arrow-sans-up e-topind'><\/span>{{/if}}<div class='e-appointinnertext'><div class='e-apptext {{if (priority!=undefined && priority!='')}}e-priorwidth{{/if}}'>{{if recurrence == true}}{{if recurrenceEdit == true}}<span class='e-icon e-recureditapp'><\/span>{{else}}<span class='e-icon e-recurapp'><\/span>{{/if}}{{/if}}{{:subject}} <\/div><div class='e-apptime {{if (priority!=undefined && priority!='')}}e-priorwidth{{/if}}'> {{:startTime}} - {{:endTime}}<\/div>{{if value == true}}<div class='e-multipleCategory'>{{:multiDiv}}<\/div>{{/if}}<\/div>{{else}}{{if recurrence == true}}{{if recurrenceEdit == true}}<span class='e-icon e-recureditapp'><\/span>{{else}}<span class='e-icon e-recurapp'><\/span>{{/if}}{{/if}}{{:userTemplate}}{{/if}}<\/div>"},e=function(){return"<div class='e-blocktimewrapper'><div class='e-blocktimeappointment {{:blockClass}} {{:customStyle}}' id='BlockTime_{{:id}}' role='presentation' style='width: {{:appWidth}}; height: {{:appHeight}}px; left: {{:left}}px; top: {{:top}}px;'>{{if userTempId == false}}{{:subject}}{{else}}{{:userTemplate}}{{/if}}<\/div><\/div>"},o=function(){return"{{for renderData }}<div style='background:{{:value}};height:11px;width:6px;float:left'><\/div>{{/for}}"},s=function(){return"{{for cols ~view=view ~colspan=colspan}}{{if cellToday == 'e-headerToday'}}<td class='e-headercells e-currentdayhighlight' colspan='{{:~colspan}}'>{{else}}<td class='e-headercells' colspan='{{:~colspan}}'>{{/if}}<div class='e-dateheadercell'> <span class='e-headerdaydisplay'>{{:currentDay}}<\/span><\/div><\/td>{{/for}}"},h=function(){return"<table class='e-table e-leftindenttable' height='100%' cellpadding='0px' cellspacing='0px'><tbody> {{for trs ~tdClass=tdClass ~divClass=divClass}} <tr>{{for ~tdClass=tdClass ~divClass=divClass}} <td class='{{:~tdClass}} {{if ~tdClass == 'e-leftindent' }}e-alldaycellsheight{{else}}e-headercellsheight{{/if}}'> <div class='{{:~divClass}}'><\/div><\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},l=function(){return"{{for cols ~colspan=colspan ~userTemp=userTemp ~allDayHtml=userHtml}}<td class='e-alldaycells e-alldaycellsheight' colspan='{{:~colspan}}'>{{if ~userTemp==true}}{{:~allDayHtml[#getIndex()]}}{{/if}}<\/td>{{/for}}"},v=function(){return"<table class='e-table e-workcellstab' width='100%' height='100%' cellpadding='0px' cellspacing='0px'><tbody >{{for cellrows ~timesc=timeScale ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}<tr>{{for ~index=#index ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}{{if ((~index+1) % ~timesc) == 0 }}<td class='e-workcells' width='{{:~cwidth}}' height='{{:~cheight}}'>{{else}}<td class='e-workcells e-alternatecells'width='{{:~cwidth}}' height='{{:~cheight}}'>{{/if}}{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},y=function(){return"<div class='e-scrolltimecells' style='width:auto;height:100%;'><table class='e-table e-timecelltable' width='100%' height='100%' cellpadding='0px' cellspacing='0px'><tbody>{{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template}}<tr>{{for ~name=time ~id=id ~view=~view1 ~index=#index }}{{if ~view == 0}}{{if ~userTemplateId==true}}<td class='e-timecells'>{{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}<div class='e-timecelldivs' style='height: 20px'>{{:~timeValue1[~index][#getIndex()]}}<\/div>{{else}}<div class='e-timecelldivs' style='height: 21px'>{{:~timeValue1[~index][#getIndex()]}}<\/div>{{/if}}{{/for}}<\/td>{{else}}<td class='e-timecells'><div class='e-timecelldivs'>{{if ~template==true}}{{:~name}}{{else}}{{:~name.slice(0,2)}}{{/if}}<\/div><\/td>{{/if}}<td class='e-timecells' rowspan='1'>{{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}<div class='e-ampmdisplay'><\/div> {{else}} {{if (#getIndex())== 0}}<div id='{{:~id}}' class='e-ampmdisplay e-ampmstyle e-idAmpmstyle'> {{if ~template ==true || ~userTemplateId==true }}{{else}}{{:~name.slice(3,6)}}{{/if}}<\/div>{{else}}<div class='e-ampmdisplay e-ampmstyle'><\/div>{{/if}} {{/if}}{{/for}}<\/td>{{else}}<td class='e-timecells'><div class='e-timecelldivs'><\/div><\/td>{{/if}}{{/for}}<\/tr>{{/for}}<\/tbody><\/table><\/div>"},p=function(){return"<div class='e-scrolltimecells'><table class='e-table' cellpadding='0px' cellspacing='0px' width='70px'><tbody>{{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template ~cheight = cheight}}<tr height='21px'>{{if ~timesc == 1}}<th class='e-timecells' rowspan='1'>{{else}}<th class='' rowspan='1'>{{/if}}{{:~timeValue1[#getIndex()][0]}}<\/th><\/tr>{{for ~cols1 ~name=time ~id=id ~view=~view1 ~index=#index ~timeSc=~timesc}}{{if (#getIndex()+2)% ~timeSc ==0}}<tr height='21px'><th class='e-timecells' style='text-align:left' rowspan='1'>{{:~timeValue1[~index][#getIndex()+1]}}<\/th><\/tr> {{else}}<tr height='21px'>{{if ~timesc == 1}}<th class='e-timecells' rowspan='1'>{{else}}<th class='' rowspan='1'>{{/if}}{{:~timeValue1[~index][#getIndex()+1]}}<\/th><\/tr>{{/if}}{{/for}}{{/for}}<\/tbody><\/table><\/div>"},w=function(){return"<tr>{{for cols}}<td class='e-headercells {{:className}} {{if (#index==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'><b>{{:headertext}}<\/b><\/div><\/td>{{/for}}<\/tr>"},k=function(){return"<table class='e-table e-agendacellstab' width='100%' cellpadding='0px' cellspacing='0px'><tbody >{{for cols}}<tr>{{if resGroup}}{{for resGroup}}<td class='e-agendacells {{:resId}} e-resourcecolumn {{if (#index==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{:text}}<\/div><\/td>{{/for}}{{/if}}{{if resChild}}<td rowspan={{:resRowSpan}} class='e-agendacells e-resourcecolumn {{if (resGroup.length==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{if userResourceId == false}}{{:resName}}{{else}}{{:userResourceHtml}}{{/if}}<\/div><\/td>{{/if}}{{if dayChild}}<td rowspan={{:dayRowSpan}} class='e-agendacells e-datecolumn {{if (resGroup.length != 0) }}{{else (resName =='')}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{if userDateId == false}}{{:date}}{{else}}{{:userDateHtml}}{{/if}}<\/div><\/td>{{/if}}<td class='e-agendacells e-timecolumn {{if dayBorderBottom==false}}e-alternatecells{{/if}}'><div class='e-textwrapper'>{{if userTimeId == false}}{{:time}}{{else}}{{:userTimeHtml}}{{/if}}<\/div><\/td><td class='e-agendacells e-eventcolumn {{if dayBorderBottom==false}}e-alternatecells{{/if}}'><div class='e-textwrapper'><div id='Appointment_{{:id}}' guid= '{{:uid}}' class='e-agendaappointment'>{{if userAppTemplId == false}}<span class='e-agendacolordiv' style='background:{{:background}}; {{if ignoreColorFilter == true}}filter:none;{{/if}}'/>{{:event}}{{else}}{{:userTemplate}}{{/if}}{{if readOnly == false}}<div class='e-agendahover'><span class='e-icon e-edit_05 e-editapp' title={{:edittext}}/><span class='e-icon e-close e-deleteapp' title={{:deletetext}}/><\/div>{{/if}}<\/div><\/div><\/td><\/tr>{{/for}}<\/tbody><\/table>"};t.widget("ejSchedule","ej.Schedule",{_rootCSS:"e-schedule",element:null,validTags:["div"],model:null,_requiresID:!0,defaults:{timeZoneCollection:{dataSource:[{text:"UTC -12:00",id:"1",value:"UTC -12:00"},{text:"UTC -11:00",id:"2",value:"UTC -11:00"},{text:"UTC -10:00",id:"3",value:"UTC -10:00"},{text:"UTC -09:00",id:"4",value:"UTC -09:00"},{text:"UTC -08:00",id:"5",value:"UTC -08:00"},{text:"UTC -07:00",id:"6",value:"UTC -07:00"},{text:"UTC -06:00",id:"7",value:"UTC -06:00"},{text:"UTC -05:00",id:"8",value:"UTC -05:00"},{text:"UTC -04:30",id:"9",value:"UTC -04:30"},{text:"UTC -04:00",id:"10",value:"UTC -04:00"},{text:"UTC -03:30",id:"11",value:"UTC -03:30"},{text:"UTC -03:00",id:"12",value:"UTC -03:00"},{text:"UTC -02:00",id:"13",value:"UTC -02:00"},{text:"UTC -01:00",id:"14",value:"UTC -01:00"},{text:"UTC +00:00",id:"15",value:"UTC +00:00"},{text:"UTC +01:00",id:"16",value:"UTC +01:00"},{text:"UTC +02:00",id:"17",value:"UTC +02:00"},{text:"UTC +03:00",id:"18",value:"UTC +03:00"},{text:"UTC +03:30",id:"19",value:"UTC +03:30"},{text:"UTC +04:00",id:"20",value:"UTC +04:00"},{text:"UTC +04:30",id:"21",value:"UTC +04:30"},{text:"UTC +05:00",id:"22",value:"UTC +05:00"},{text:"UTC +05:30",id:"23",value:"UTC +05:30"},{text:"UTC +05:45",id:"24",value:"UTC +05:45"},{text:"UTC +06:00",id:"25",value:"UTC +06:00"},{text:"UTC +06:30",id:"26",value:"UTC +06:30"},{text:"UTC +07:00",id:"27",value:"UTC +07:00"},{text:"UTC +08:00",id:"28",value:"UTC +08:00"},{text:"UTC +09:00",id:"29",value:"UTC +09:00"},{text:"UTC +09:30",id:"30",value:"UTC +09:30"},{text:"UTC +10:00",id:"31",value:"UTC +10:00"},{text:"UTC +11:00",id:"32",value:"UTC +11:00"},{text:"UTC +12:00",id:"33",value:"UTC +12:00"},{text:"UTC +13:00",id:"34",value:"UTC +13:00"}],text:"text",id:"id",value:"value"},views:["Day","Week","WorkWeek","Month","Agenda"],agendaViewSettings:{daysInAgenda:7,dateColumnTemplateId:null,timeColumnTemplateId:null},currentView:"week",timeMode:null,firstDayOfWeek:null,workWeek:["Monday","Tuesday","Wednesday","Thursday","Friday"],dateFormat:"",isDST:!1,timeZone:null,timeScale:{enable:!0,minorSlotCount:2,majorSlot:60,minorSlotTemplateId:null,majorSlotTemplateId:null},startHour:0,endHour:24,highlightBusinessHours:!0,enableLoadOnDemand:!1,enablePersistence:!1,showQuickWindow:!0,showLocationField:!1,showTimeZoneFields:!0,businessStartHour:9,businessEndHour:18,workHours:{highlight:!0,start:9,end:18},width:"100%",height:"1120px",cellHeight:"",cellWidth:"",currentDate:new Date,minDate:new Date(1900,01,01),maxDate:new Date(2099,12,31),cssClass:"",locale:"en-US",enableResize:!1,readOnly:!1,enableRTL:!1,enableAppointmentNavigation:null,showAppointmentNavigator:!0,appointmentTemplateId:null,allDayCellsTemplateId:null,dateHeaderTemplateId:null,workCellsTemplateId:null,resourceHeaderTemplateId:null,allowDragDrop:null,allowDragAndDrop:!0,enableAppointmentResize:!0,showCurrentTimeIndicator:!0,showAllDayRow:!0,showHeaderBar:!0,isResponsive:!0,showWeekend:!0,enableRecurrenceValidation:!0,appointmentDragArea:"",showOverflowButton:!0,reminderSettings:{enable:!1,alertBefore:5},contextMenuSettings:{enable:!1,menuItems:{appointment:[{id:"open",text:"Open Appointment"},{id:"delete",text:"Delete Appointment"}],cells:[{id:"new",text:"New Appointment"},{id:"recurrence",text:"New Recurring Appointment"},{id:"today",text:"Today"},{id:"gotodate",text:"Go to date"},{id:"settings",text:"Settings"},{id:"view",text:"View",parentId:"settings"},{id:"timemode",text:"TimeMode",parentId:"settings"},{id:"view_Day",text:"Day",parentId:"view"},{id:"view_Week",text:"Week",parentId:"view"},{id:"view_Workweek",text:"Workweek",parentId:"view"},{id:"view_Month",text:"Month",parentId:"view"},{id:"view_Agenda",text:"Agenda",parentId:"view"},{id:"timemode_Hour12",text:"12 Hours",parentId:"timemode"},{id:"timemode_Hour24",text:"24 Hours",parentId:"timemode"},{id:"workhours",text:"Work Hours",parentId:"settings"}]}},group:null,resources:null,allowKeyboardNavigation:!0,blockoutSettings:{enable:!1,templateId:null,dataSource:[],query:null,tableName:null,id:"Id",subject:"Subject",startTime:"StartTime",endTime:"EndTime",isBlockAppointment:"IsBlockAppointment",isAllDay:null,customStyle:null,resourceId:null},appointmentSettings:{applyTimeOffset:!0,dataSource:[],query:null,tableName:null,id:null,subject:null,description:null,startTime:null,endTime:null,recurrence:null,recurrenceRule:null,allDay:null,resourceFields:null,categorize:null,recurrenceId:null,recurrenceExDate:null,location:null,priority:null,startTimeZone:null,endTimeZone:null},renderDates:null,orientation:"vertical",categorizeSettings:{title:null,enable:!1,allowMultiple:!1,dataSource:[{text:"Blue Category",id:1,color:"#43b496",fontColor:"#ffffff"},{text:"Green Category",id:2,color:"#7f993e",fontColor:"#ffffff"},{text:"Orange Category",id:3,color:"#cc8638",fontColor:"#ffffff"},{text:"Purple Category",id:4,color:"#ab54a0",fontColor:"#ffffff"},{text:"Red Category",id:5,color:"#dd654e",fontColor:"#ffffff"},{text:"Yellow Category",id:6,color:"#d0af2b",fontColor:"#ffffff"}],text:"text",id:"id",color:"color",fontColor:"fontColor"},prioritySettings:{title:null,enable:!1,template:null,dataSource:[{text:"None",value:"none"},{text:"High",value:"high"},{text:"Medium",value:"medium"},{text:"Low",value:"low"}],text:"text",value:"value"},showTimeScale:!0,tooltipSettings:{enable:!1,templateId:null},showDeleteConfirmationDialog:!0,showNextPrevMonth:!0,cellClick:null,cellHover:null,appointmentClick:null,appointmentHover:null,cellDoubleClick:null,appointmentWindowOpen:null,appointmentSaved:null,appointmentEdited:null,appointmentDeleted:null,beforeAppointmentCreate:null,beforeAppointmentChange:null,beforeAppointmentRemove:null,appointmentCreated:null,appointmentChanged:null,appointmentRemoved:null,keyDown:null,navigation:null,dragStart:null,drag:null,dragStop:null,resizeStart:null,resize:null,resizeStop:null,menuItemClick:null,beforeContextMenuOpen:null,reminder:null,actionBegin:null,actionComplete:null,overflowButtonClick:null,overflowButtonHover:null,create:null,load:null,destroy:null,queryCellInfo:null},dataTypes:{views:"array",workWeek:"array",timeZoneCollection:{dataSource:"data",query:"data"},renderDates:"data",enablePersistence:"boolean",showTimeScale:"boolean",resources:"array",group:{resources:"array"},appointmentSettings:{dataSource:"data",query:"data",subject:"parent",description:"parent",startTime:"parent",endTime:"parent",recurrence:"parent",recurrenceRule:"parent",allDay:"parent",resourceFields:"parent",categorize:"parent",location:"parent",priority:"parent",startTimeZone:"parent",endTimeZone:"parent"},categorizeSettings:{dataSource:"data",query:"data"},prioritySettings:{dataSource:"data",query:"data"},contextMenuSettings:{menuItems:{appointment:"array",cells:"array"}},blockoutSettings:{dataSource:"data",query:"data"}},_ignoreOnPersist:["appointmentSettings.query","appointmentSettings.dataSource","timeZoneCollection.dataSource","allowKeyboardNavigation","showQuickWindow","cssClass","locale","enableResize","showHeaderBar","readOnly","enableRTL","enableAppointmentNavigation","showAppointmentNavigator","appointmentTemplateId","resourceHeaderTemplateId","allowDragDrop","allowDragAndDrop","enableAppointmentResize","showCurrentTimeIndicator","reminderSettings.enable","contextMenuSettings.enable","group","categorizeSettings.enable","categorizeSettings.dataSource","cellClick","overflowButtonClick ","overflowButtonHover","keyDown","appointmentClick","cellDoubleClick","appointmentWindowOpen","appointmentSaved","appointmentEdited","appointmentDeleted","beforeAppointmentCreate","beforeAppointmentChange","beforeAppointmentRemove","appointmentCreated","appiontmentChanged","appointmentRemoved","navigation","dragStart","dragStop","resizeStart","resize","resizeStop","menuItemClick","beforeContextMenuOpen","reminder","prioritySettings.dataSource","prioritySettings.enable","agendaViewSettings.daysInAgenda","agendaViewSettings.dateColumnTemplateId","agendaViewSettings.timeColumnTemplateId","blockoutSettings.dataSource"],_ignoreFromAppointmentOnExport:["dataSource","query","tableName","resourceFields"],_ignoreFromModelOnExport:["timezoneCollection","timeZoneCollection","contextMenuSettings","prioritySettings"],_resources:function(){this.element.empty();this._bindResourcesData();t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()},observables:["appointmentSettings.dataSource","currentView","currentDate"],_tags:[{tag:"timeZoneCollection",attr:[],singular:"timeZoneCollection"},{tag:"appointmentSettings.dataSource",attr:[],singular:"dataSource"},{tag:"resources",attr:["allowMultiple","field","title","name","resourceSettings"]},{tag:"contextMenuSettings.menuItems.appointment",attr:["id","text","parentId"]},{tag:"contextMenuSettings.menuItems.cells",attr:["id","text","parentId"]},{tag:"categorizeSettings.dataSource",attr:["text","id","color","fontColor"]},{tag:"timeZoneCollection.dataSource",attr:["text","id","value"]},{tag:"prioritySettings.dataSource",attr:["text","value"]}],currentView:t.util.valueFunction("currentView"),currentDate:t.util.valueFunction("currentDate"),dataSource:t.util.valueFunction("appointmentSettings.dataSource"),_init:function(){n.isEmptyObject(this.model.group)&&(this.model.group=null);this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale);this.model.locale!="en-US"&&this._recurrenceLocal();t.isNullOrUndefined(this.model.workHours.start)&&(this.model.workHours.start=this.model.businessStartHour);t.isNullOrUndefined(this.model.workHours.end)&&(this.model.workHours.end=this.model.businessEndHour);t.isNullOrUndefined(this.model.workHours.highlight)&&(this.model.workHours.highlight=this.model.highlightBusinessHours);t.isNullOrUndefined(this.model.timeZoneCollection)&&(this.model.timeZoneCollection=this.model.timezoneCollection);t.isNullOrUndefined(this.model.timeScale.enable)&&(this.model.timeScale.enable=this.model.showTimeScale);this.model.showAppointmentNavigator=t.isNullOrUndefined(this.model.enableAppointmentNavigation)?this.model.showAppointmentNavigator:this.model.enableAppointmentNavigation;this.model.allowDragAndDrop=t.isNullOrUndefined(this.model.allowDragDrop)?this.model.allowDragAndDrop:this.model.allowDragDrop;t.isNullOrUndefined(this.model.beforeAppointmentCreate)&&(this.model.beforeAppointmentCreate=this.model.appointmentSaved);t.isNullOrUndefined(this.model.beforeAppointmentChange)&&(this.model.beforeAppointmentChange=this.model.appointmentEdited);t.isNullOrUndefined(this.model.beforeAppointmentRemove)&&(this.model.beforeAppointmentRemove=this.model.appointmentDeleted);this._processAppointmentSettings();this._currentDateFormat(this.model.dateFormat);this._trigger("load");this.element.addClass("e-schedule");this.model.cssClass!=null&&this.element.addClass(this.model.cssClass);this._initPrivateProperties();t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._resourceSegregate();this.model.categorizeSettings.enable&&this.model.categorizeSettings.dataSource instanceof t.DataManager&&this._bindCategorizeData();this.model.prioritySettings.enable&&this.model.prioritySettings.dataSource instanceof t.DataManager&&this._bindPriorityData();t.scheduleFeatures.resources&&this._tempResource.length!=0?this._bindResourcesData():this._renderInitSchedule();this._wireEvents();t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null);this._bindAppointmentsData("Load");this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments());this.model.reminderSettings.enable&&(this._checkReminders(),this._reminderInterval=window.setInterval(n.proxy(this._checkReminders,this),6e4))},_processAppointmentSettings:function(){var i,r,u;!t.isNullOrUndefined(this.model.appointmentSettings.query)&&this.model.appointmentSettings.query instanceof t.Query||(this.model.appointmentSettings.query=t.Query());this._appointmentSettings={};resource="";this._applyTimeOffset=this.model.appointmentSettings.applyTimeOffset;for(i in this.model.appointmentSettings)if(i!="applyTimeOffset"&&i!=="tableName"&&i!=="query"&&i!=="dataSource"&&(this._appointmentSettings[i]=n.type(this.model.appointmentSettings[i])=="string"||t.isNullOrUndefined(this.model.appointmentSettings[i])?this.model.appointmentSettings[i]:this.model.appointmentSettings[i].field,i!=="resourceFields"&&i!=="categorize"&&i!=="priority"&&t.isNullOrUndefined(this._appointmentSettings[i])&&(this._appointmentSettings[i]=i.charAt(0).toUpperCase()+i.slice(1)),i=="resourceFields"&&t.isNullOrUndefined(this._appointmentSettings.resourceFields)&&!t.isNullOrUndefined(this.model.resources)))for(r=0,u=this.model.resources.length;r<u;r++)resource=this.model.resources[r].field.charAt(0).toUpperCase()+this.model.resources[r].field.slice(1),this._appointmentSettings[i]+=(r!==0?",":"")+resource},_setModel:function(i){var u=!1,r,e,o,s,f,h,c,l,a;t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.ejDialog("close");for(r in i)switch(r){case"views":this.model.views=i[r];this.model.views=this.model.views.length==0?this.currentView().toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(",");this.hTR.find("table.e-viewstable").remove();this.hTR.find("div.e-viewsdiv").append(this._renderViewNavigation(i[r].toString().toLowerCase().split(",")));this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview").attr("tabIndex",0).focus();t.isNullOrUndefined(this._scheduleDrawer)||(this._scheduleDrawer.ejNavigationDrawer("destroy"),n(this._scheduleDrawer).remove(),this._scheduleDrawer=null,(this._mediaQuery||this.element.width()<600)&&!n("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer());this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&(this._navView=!0,this.model.views.length==0?(this.model.views=this.currentView().toString().toLowerCase().split(","),u=!0):this._viewChange(null,null,this.model.views[0].toLowerCase()));break;case"currentView":this.model.views.toString().toLowerCase().split(",").indexOf(t.util.getVal(i[r]).toLowerCase())!=-1?(this._navView=!0,this._viewChange(null,null,t.util.getVal(i[r]).toLowerCase())):(this._navView=!1,this.currentView(this.element.find(".e-activeview")[0].className.split("e-")[2].split(" ")[0]));break;case"currentDate":if(n.type(i[r])=="string"?this._currentDateFormat(this.model.dateFormat):n.type(i[r])=="function"&&n.type(t.util.getVal(i[r]))=="string"&&this.currentDate(t.parseDate(this.currentDate(),this._datepattern())),this._keyPressed)return this._keyPressed=!1,!1;this._setCurrentDate=!0;this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate);this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate);this._navigateClick(null,"DateNavigation");break;case"minDate":case"maxDate":this._currentDateFormat(this.model.dateFormat);u=!0;break;case"timeMode":this.model.timeMode=this._timeMode=i[r]=="Hour12"?"12":i[r]=="Hour24"?"24":i[r];this._updateTimeMode();break;case"timeZone":this._setmodelvalue=!0;this.model.timeZone=i[r];this.element.find("div.e-categorybar").remove();this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this._bindAppointmentsData("Load");this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments());break;case"showTimeScale":case"timeScale":r=="showTimeScale"&&(this.model.timeScale.enable=i[r]);r=="timeScale"&&n.extend(this.model.timeScale,i[r]);this.currentView()!=="agenda"&&(u=!0);break;case"timezoneCollection":case"timeZoneCollection":n.extend(this.model.timeZoneCollection,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._appointmentAddWindow.find(".startutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});this._appointmentAddWindow.find(".endutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});break;case"showTimeZoneFields":this.model.showTimeZoneFields=i[r];t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.showTimeZoneFields?(this._appointmentAddWindow.find("#"+this._id+"_appStartTime").children().length<4&&(this._mediaQuery?(e="<td width='31%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>",o="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"):(e="<td width='28%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>",o="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),this._appointmentAddWindow.find("#"+this._id+"_appStartTime").append(e),this._appointmentAddWindow.find("#"+this._id+"_appEndTime").append(o),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._startUtc,this),cssClass:this.model.cssClass}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._endUtc,this),cssClass:this.model.cssClass})),this._timeZoneCollection(null)):(this._appointmentAddWindow.find("#"+this._id+"_appStartTime").children().last().remove(),this._appointmentAddWindow.find("#"+this._id+"_appEndTime").children().last().remove());break;case"startHour":this.model.startHour=i[r];this.model.startHour<0&&(this.model.startHour=0);this.currentView()!=="agenda"&&this._setNewStartEndHours();break;case"endHour":this.model.endHour=i[r];this.model.endHour>24&&(this.model.endHour=24);this.currentView()!=="agenda"&&this._setNewStartEndHours();break;case"highlightBusinessHours":case"businessStartHour":case"businessEndHour":case"workHours":r=="highlightBusinessHours"&&(this.model.workHours.highlight=i[r]);r=="businessStartHour"&&(this.model.workHours.start=i[r]);r=="businessEndHour"&&(this.model.workHours.end=i[r]);r=="workHours"&&n.extend(this.model.workHours,i[r]);this.currentView()!=="agenda"&&(this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells,.e-monthcells").removeClass("e-businesshighlightworkcells").removeClass("e-monthcellhighlight"),this._businessHourScroller(),this._renderUpDownIconPosition());break;case"showAllDayRow":this.model.showAllDayRow=i[r];this.model.timeScale.enable||(this.model.showAllDayRow=!1);this.model.orientation=="vertical"&&this.model.timeScale.enable&&this.currentView()!="agenda"&&this.currentView()!="month"&&!this._isCustomMonthView()&&(this.aTR.empty(),this._renderHeaderAllDayTemplate(),this._borderAddRemove(),this._headerbarWidth(),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.model.showAllDayRow&&this._reRenderAllDayAppointments(),this.model.orientation=="vertical"&&this.model.cellWidth&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-headercells").width()),this._reRenderScroller());break;case"isResponsive":this.model.isResponsive=i[r];this._onScheduleResize();break;case"isDST":this.model.isDST=i[r];t.isNullOrUndefined(this.model.timeZone)&&(s=new Date,this._timeValue=this._true==!1?-(s.getTimezoneOffset()-this._stdTimezoneOffset()):s.getTimezoneOffset()-this._stdTimezoneOffset(),this._true=this.model.isDST==!0?!1:!0,this._dayLight=!0,this.element.find("div.e-categorybar").remove(),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-appsoverflow").remove(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Load"));break;case"enableRecurrenceValidation":this.model.enableRecurrenceValidation=i[r];this.model.enableRecurrenceValidation&&t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._dataProcessing(this._currentAppointmentData);this._renderAppointmentAll();break;case"height":this.model.height=i[r];this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();u=!0;break;case"width":this.model.width=i[r];this._clientWidth=this.model.width;this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();u=!0;break;case"cssClass":this.element.removeClass(this.model.cssClass).addClass(i[r]);break;case"locale":this.model.locale=i[r];this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale);this.model.locale!="en-US"&&this._recurrenceLocal();this._culture=t.preferredCulture(this.model.locale);this._dayShortNames=this._culture.calendar.days.namesAbbr;this._dayFullNames=this._culture.calendar.days.names;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this.model.contextMenuSettings.enable&&(n("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0);u=!0;break;case"dateFormat":t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._appointmentAddWindow.find(".startenddate").ejDatePicker({dateFormat:i[r]});this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({dateFormat:i[r]});this._appointmentAddWindow.find(".e-until").ejDatePicker({dateFormat:i[r]});this._currentDateFormat(i[r]);break;case"enableResize":this.model.enableResize=i[r];this.model.enableResize&&(t.isTouchDevice()?this._on(n(window),"orientationchange",n.proxy(this._onScheduleResize,this)):this._on(n(window),"resize",n.proxy(this._onScheduleResize,this)));break;case"readOnly":this.model.readOnly=i[r];this._renderAppointmentAll();break;case"showCurrentTimeIndicator":this.model.showCurrentTimeIndicator=i[r];this.currentView()!=="agenda"&&(this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.showCurrentTimeIndicator||(this.currentView()!=="month"&&!this._isCustomMonthView()?this.element.find(".e-highlightcurrenttimeline").remove():n(this.element.find(".e-monthcells")).removeClass("e-monthcurrenttime")));break;case"enableRTL":i[r]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this.model.enableRTL=i[r];u=!0;this.model.contextMenuSettings.enable&&(n("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0);this._quickAppointWindow=null;break;case"appointmentTemplateId":this.model.appointmentTemplateId=i[r];this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this.element.find("div.e-categorybar").remove();t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"allDayCellsTemplateId":this.model.allDayCellsTemplateId=i[r];u=!0;break;case"dateHeaderTemplateId":this.model.dateHeaderTemplateId=i[r];u=!0;break;case"workCellsTemplateId":this.model.workCellsTemplateId=i[r];u=!0;break;case"showWeekend":this.model.showWeekend=i[r];u=!0;break;case"allowKeyboardNavigation":this.model.allowKeyboardNavigation=i[r];this.model.allowKeyboardNavigation?(this._on(this.element,"keydown",n.proxy(this._onKeyDown,this)),this._on(n(document),"keydown",n.proxy(this._documentOnKeyDown,this))):(this._off(this.element,"keydown"),this._off(n(document),"keydown"));break;case"renderDates":n.extend(this.model.renderDates,i[r]);this._navView=!0;this._viewChange(null,null,"customview");break;case"appointmentSettings":n.isEmptyObject(i[r])||(n.extend(this.model.appointmentSettings,i[r]),this._processAppointmentSettings(),this.element.find("div.e-categorybar").remove(),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-appsoverflow").remove(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null),this._setmodelvalue=!0,this._bindAppointmentsData("Load"));break;case"contextMenuSettings":n.extend(this.model.contextMenuSettings,i[r]);this.model.contextMenuSettings.enable&&(t.isNullOrUndefined(this._contextMenu)||this.model.categorizeSettings.enable)&&this._showContextMenu(this.model.contextMenuSettings.enable);break;case"reminderSettings":i[r].enable?this._checkReminders()&&(this._reminderInterval=window.setInterval(n.proxy(this._checkReminders,this),6e4)):window.clearInterval(this._reminderInterval);break;case"showAppointmentNavigator":case"enableAppointmentNavigation":this.model.showAppointmentNavigator=this.model.enableAppointmentNavigation=i[r];this.model.showAppointmentNavigator?(this._nextPrevAppointment(this.model.showAppointmentNavigator),this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon(),t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()):(this.element.find(".e-prevapp,.e-nextapp").remove(),this.element.find(".e-upicon,.e-downicon").remove());break;case"enableLoadOnDemand":this.model.enableLoadOnDemand=i[r];this.element.find("div.e-categorybar").remove();this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this._bindAppointmentsData("Load");break;case"resources":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(t.copyObject(this.model.resources,i[r]),this.model.resources=i[r],this.model.resources.length==0?(this.model.resources=null,this.model.group=null,u=!0):u=!0);break;case"categorizeSettings":n.extend(this.model.categorizeSettings,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)?(this._renderTemplates(),this._renderAppointmentWindow()):t.isNullOrUndefined(this.model.categorizeSettings)||(this.model.categorizeSettings.enable?(this._appointmentAddWindow.find(".e-categorizevalue").length==1&&this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove(),f="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Categorize")+":<\/td><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' class='e-categorizevalue' type='text' name='"+this._appointmentSettings.categorize+"' value=''/><\/td><\/tr>",this._appointmentAddWindow.find("."+this._id+"summary").after(f),this._renderTemplates(),this._renderCategoryItems(this._appointmentAddWindow)):this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove());this._showContextMenu(this.model.contextMenuSettings.enable);t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"group":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(n.extend(this.model.group,i[r]),n.isEmptyObject(this.model.group)&&(this.model.group=null),u=!0);break;case"cellWidth":this.model.cellWidth=i[r];this.currentView()!=="agenda"&&(u=!0);break;case"cellHeight":this.model.cellHeight=i[r];this.currentView()!=="agenda"&&(u=!0);break;case"orientation":this.model.orientation=i[r];t.scheduleFeatures.resources&&this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&this.model.orientation=="horizontal"&&this._on(this.element,"click",".e-parentnodecategory",n.proxy(this._onResourceClick,this));u=!0;break;case"resourceHeaderTemplateId":this.model.resourceHeaderTemplateId=i[r];t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&(this.currentView()!="agenda"?this.model.orientation=="horizontal"?(h=n(this.wTR.find("td")[0]),h.find("div.e-horizontresdiv").remove(),c=this._renderHorizontalResources(),h.html(c)):(this.aTR.empty(),this._renderHeaderAllDayTemplate(),this._borderAddRemove(),this._headerbarWidth(),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.model.showAllDayRow&&this._reRenderAllDayAppointments()):this._renderAgendaContent());break;case"showLocationField":this.model.showLocationField=i[r];t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.showLocationField?(f="<tr id='"+this._id+"showLocation' class='"+this._id+"showLocation'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>",this._appointmentAddWindow.find("."+this._id+"subjecttr").after(f)):this._appointmentAddWindow.find("."+this._id+"showLocation").remove();break;case"prioritySettings":n.extend(this.model.prioritySettings,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.prioritySettings.enable?(this._appointmentAddWindow.find("."+this._id+"priorityshow").length==1&&(this._appointmentAddWindow.find("."+this._id+"priorityshow").remove(),this._appointmentAddWindow.find("."+this._id+"prioritylistshow").remove()),f="<td colspan='1' class='e-textlabel "+this._id+"priorityshow'>"+this._getLocalizedLabels("Priority")+":<\/td><td colspan='1' class='"+this._id+"prioritylistshow'><input id='"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value='' /><div id='prioritylist'><\/div><\/td>",this._appointmentAddWindow.find("."+this._id+"parrow").prepend(f),this._renderPriorityItems(this._appointmentAddWindow),this._renderTemplates()):(this._appointmentAddWindow.find("."+this._id+"priorityshow").remove(),this._appointmentAddWindow.find("."+this._id+"prioritylistshow").remove());t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"showQuickWindow":this.model.showQuickWindow=i[r];t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow();t.isNullOrUndefined(this._quickAppointWindow)||(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this._quickWindow=this.model.showQuickWindow;break;case"allowDragAndDrop":case"allowDragDrop":if(this.model.allowDragAndDrop=this.model.allowDragDrop=i[r],this.currentView()=="agenda")return!1;this.model.allowDragAndDrop?this._dragdropAppointments():this._unWireDragDrop();break;case"enableAppointmentResize":if(this.model.enableAppointmentResize=i[r],this.currentView()=="agenda")return!1;this._renderAppointmentAll();break;case"showHeaderBar":this.model.showHeaderBar=i[r];this.model.showHeaderBar?(this.element.find(".e-scheduleheader").show(),this._reRenderHeaderBar()):(this.element.find(".e-scheduleheader").empty(),this.element.find(".e-scheduleheader").hide());this.refreshScroller();break;case"tooltipSettings":n.extend(this.model.tooltipSettings,i[r]);l=this.model.tooltipSettings.enable?".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendacells.e-eventcolumn,.e-appup,.e-appdown,.e-appsoverflow":".e-appup,.e-appdown,.e-appsoverflow";a=this.element.data("ejTooltip");a.setModel({target:l});break;case"showOverflowButton":this.model.showOverflowButton=i[r];u=!0;break;case"appointmentDragArea":this.model.appointmentDragArea=i[r];u=!0;break;case"firstDayOfWeek":this.model.firstDayOfWeek=this._firstdayofweek=i[r];this._firstdayofweek&&(u=!0);break;case"workWeek":this.model.workWeek=i[r];(this.model.workWeek==null||this.model.workWeek.length>=0)&&(u=!0);break;case"agendaViewSettings":n.extend(this.model.agendaViewSettings,i[r]);this.currentView()=="agenda"&&(this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this._renderAgendaContent());break;case"showNextPrevMonth":this.model.showNextPrevMonth=i[r];this.model.orientation=="vertical"&&this.currentView()=="month"&&(this._renderMonthTimeCells(),this._highlightBusinessHours(),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll());break;case"blockoutSettings":n.isEmptyObject(i[r])||(n.extend(this.model.blockoutSettings,i[r]),this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments()))}u&&(this.element.empty(),t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("destroy"),this._scheduleDrawer=null,this._quickAppointWindow=null,this._quickAppDetailsWindow=null,this._alertWindow=null,this._appointmentAddWindow=null,n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper").remove(),t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._resourceSegregate(),this._setmodelvalue=!0,this._tempResource.length==0&&this._grouping.length==0?this._renderInitSchedule():this._bindResourcesData(),this._businessHourScroller(),t.isNullOrUndefined(this.dataSource())||this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll(),this.model.blockoutSettings.enable&&this._renderBlockAppointments())},_touchSchedule:function(t){var u,h,e,r;if(n(t.target).is(".e-appointment,.e-alldayappointment,.e-monthappointment")||n(t.target).parents().is(".e-appointment,.e-alldayappointment,.e-monthappointment")||this.model.orientation=="horizontal")return!1;var s=this.model.enableRTL?t.type=="swipeleft"?"swiperight":"swipeleft":t.type,c=this.model.enableRTL?"margin-right":"margin-left",f,a=parseInt(this.element.find(".e-draggableworkarea").css(c)),o=Math.round(this.element.find(".e-draggableworkarea").width()/this.res1.length),l=this.element.find(".e-workleftindent").length>0?this.element.find(".e-workleftindent").outerWidth():0,i=Math.round(Math.abs((this.element.find(".e-draggableworkarea").offset().left-l-1)/o));if(this.currentView()=="month"||this._isCustomMonthView()){for(u=0,h=s=="swipeleft"?(i+1)*7:(i-1)*7,e=0;e<h;e++)u+=this.element.find(".e-draggableworkarea tr").eq(0).children().eq(e).outerWidth();u+=3}switch(s){case"swipeleft":if(this._mediaQuery&&this.currentView()!="agenda"&&this.model.orientation=="vertical"){if(i+1!=this.res1.length)return r=this.currentView()=="month"||this._isCustomMonthView()?-u:-((i+1)*o),this.element.find(".e-headrealldaytable").css("left","0px"),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate(this.model.enableRTL?{"margin-right":r}:{"margin-left":r},500),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").css(this.model.enableRTL?{"margin-left":0}:{"margin-right":0}),i+1==this.res1.length-1&&this._showScrollTd(),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css({marginLeft:"0px",marginRight:"0px"})}f={currentTarget:this.element.find(".e-navigatenext")};this._navigateClick(f,"Next");break;case"swiperight":if(this._mediaQuery&&this.currentView()!="agenda"&&this.model.orientation=="vertical"){if(i!=0)return r=this.currentView()=="month"||this._isCustomMonthView()?-u:-((i-1)*o),this.element.find(".e-headrealldaytable").css("left","0px"),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate(this.model.enableRTL?{"margin-right":r}:{"margin-left":r},500),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").css(this.model.enableRTL?{"margin-left":0}:{"margin-right":0}),i+1==this.res1.length-1&&this._showScrollTd(),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css({marginLeft:"0px",marginRight:"0px"})}f={currentTarget:this.element.find(".e-navigateprevious")};this._navigateClick(f,"Previous")}},_initPrivateProperties:function(){this._navSelected=this._navDrawer=this._alldayLevel=this._reminderClose=this._navView=this._editKey=this._cellClick=this._recurChecked=this._setCurrentDate=this._leftResizing=this._rightResizing=this._topResizing=this._bottomResizing=this._allDayDrag=this._dateNavigation=this._isQuickDialogOpened=!1;this._gotoDate=this._bindapp=this._showBlockAlert=this._seriesAlert=!0;this._tempStart=this._tempEnd=this._currentAction="";this._currentRowIndex=this._currentColIndex=0;this._appId=this._parentId=1;this._currentAppointmentData=[];this._currentViewAppointments=[];this._processed=[];this._renderedApp=[];this._renderedAllDay=[];this._dateRender=[];this._grouping=[];this._tempResource=[];this.res1=[0];this._appMainId=null;this._scheduleDrawer=null;this._quickAppointWindow=null;this._quickAppDetailsWindow=null;this._alertWindow=null;this._appointmentAddWindow=null;this._dayNamesArray=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];this._dayNames=["SU","MO","TU","WE","TH","FR","SA"];this._culture=t.preferredCulture(this.model.locale);this._dayShortNames=this._culture.calendar.days.namesAbbr;this._dayFullNames=this._culture.calendar.days.names;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this._browserInfo=t.browserInfo();this._safariBrowser=this._browserInfo.name=="webkit"&&!t.isTouchDevice();this._focused=null;Array.prototype.map=Array.prototype.map||function(n,t){var e,u,i,r,f,o,s;if(this==null)throw new TypeError("this is null or not defined");if(r=Object(this),f=r.length>>>0,typeof n!="function")throw new TypeError(n+" is not a function");for(arguments.length>1&&(e=t),u=new Array(f),i=0;i<f;)i in r&&(o=r[i],s=n.call(e,o,i,r),u[i]=s),i++;return u};String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.capitalizeFirstString=String.prototype.capitalizeFirstString||function(){return this.charAt(0).toUpperCase()+this.slice(1)};Date.prototype.parseISO8601=function(n){return typeof n=="string"?n.indexOf("Date")!=-1?new Date(parseInt(n.match(/\d+/).toString())):n.indexOf("T")!=-1?new Date(n):new Date(n.replace(/-/g,"/")):new Date(n)};Date.prototype._currentMonthDates=function(){return{start:new Date(this.getFullYear(),this.getMonth(),1),end:new Date(this.getFullYear(),this.getMonth()+1,0)}};Date.prototype._currentWeekDates=function(n){var i=this.getDay()-n,t=new Date(this.getFullYear(),this.getMonth(),this.getDate()+(i<0?i+7:i)*-1),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+6);return{start:new Date(t),end:new Date(r)}}},_destroy:function(){this.element.off();this._destorySubControls(n("#"+this._id+"_AddEditForm"));t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find("#"+this._id+"recurrenceEditor").ejRecurrenceEditor("destroy");this.element.find("#"+this._id+"_navigator").ejDatePicker("destroy");window.clearInterval(this._intervalID);t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("destroy");n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"gotoWindow_wrapper").remove();this.element.empty().removeClass("e-schedule")},_destorySubControls:function(t){for(var i,u=t.find(".e-timepicker,.e-datepicker,.e-dropdownlist,.e-autocomplete"),r=0;r<u.length;r++)i=n(u[r]),i.hasClass("e-timepicker")?i.ejTimePicker("destroy"):i.hasClass("e-datepicker")?i.ejDatePicker("destroy"):i.hasClass("e-dropdownlist")?i.ejDropDownList("destroy"):i.hasClass("e-autocomplete")&&i.ejAutocomplete("destroy")},_closeRecurence:function(i){var u,r,f,e,o;if(t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._appointmentAddWindow.find(".e-recuruntil").ejRadioButton("option","checked")&&i.model.text!=this._getLocalizedLabels("Cancel")&&this._appointmentAddWindow.find(".recurstartdate").ejDatePicker("option","value")>this._appointmentAddWindow.find(".e-until").ejDatePicker("option","value"))return this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("WrongPattern")),this._alertWindow.ejDialog("open"),!1;u=!0;i.model.text==this._getLocalizedLabels("Cancel")?this._appointmentAddWindow.find(".e-recurFinalRule").html()==""&&this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox({checked:!1}):(r=this._appointmentAddWindow.find(".e-recurEditor").data("ejRecurrenceEditor"),this._rRuleStr=r.closeRecurPublic(),f=r.element.find(".recurstartdate").ejDatePicker("option","value"),e=r.recurrenceDateGenerator(r._recRule,f),r._rRule.freq!="MONTHLY"||t.isNullOrUndefined(r._rRule.monthDay)||(o=e.filter(function(n){return new Date(n).getDate()==r._rRule.monthDay}),(!t.isNullOrUndefined(r._rRule.count)&&o.length!=e.length||t.isNullOrUndefined(r._rRule.count)&&[29,30,31].indexOf(r._rRule.monthDay)!=-1)&&(u=!1,this._alertWindow.find(".e-alertbtn").find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"})),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("RecurrenceDateValidation")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.addClass("e-recurAlert"),this._alertWindow.ejDialog("open"))),new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")).setHours(0,0,0,0)!=new Date(f).getTime()&&this._recurDateChange(f),u&&(this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(this._rRuleStr),this._appointmentAddWindow.find(".e-recuredit").css("display","inline")));u&&(this._appointmentAddWindow.find(".e-recurEditor").toggle(),this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","block"),this._appointmentAddWindow.find(".done").focus())},_wireEvents:function(){this._on((this.element,n(window)),"mousedown",n.proxy(this._onScheduleMouseDown,this));this._on(this.element,"click","div.e-navigateprevious,div.e-navigatenext",n.proxy(this._navigateClick,this));this._on(n(window),"resize",n.proxy(this._onScheduleResize,this));this._on(this.element,"click",".e-commonviewbutton",n.proxy(this._viewChange,this));this._on(this.element,"click",".e-datedisplay",n.proxy(this._viewCalendar,this));this._on(this.element,"click","div.e-appsoverflow",n.proxy(this._appOverflowClick,this));this._on(this.element,"click",".e-prevapp.enable,.e-nextapp.enable",n.proxy(this._nextPrev,this));this._on(this.element,"dblclick",".e-headercells",n.proxy(this._navigateView,this));this._on(this.element,"click",".e-headercells,.e-timecells,td.e-monthcells div.e-monthheader",n.proxy(this._navigateView,this));this._on(this.element,"mouseover","td.e-alldaycells,td.e-workcells:not('.e-resourceheadercells'),td.e-monthcells:not('.e-othermonths'),td.e-agendacells",n.proxy(this._onCellMouseOver,this));this._on(this.element,"mouseout","td.e-alldaycells,td.e-workcells:not('.e-resourceheadercells'),td.e-monthcells:not('.e-othermonths'),td.e-agendacells",n.proxy(this._onCellMouseOver,this));this._on(this.element,"click",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells",n.proxy(this._cellSelection,this));this._mediaQuery||t.isTouchDevice()||(this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",n.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",n.proxy(this._shiftSelection,this)));this._on(this.element,t.isMobile()?"click":t.isTouchDevice()&&(n.isFunction(n.fn.tap)||n.isFunction(n.fn.doubletap))?"doubletap":"dblclick",".e-workcells:not('.e-resourceheadercells'),.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells.e-eventcolumn,.e-agendacells.e-timecolumn",n.proxy(this._appointmentWindow,this));(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));t.isTouchDevice()&&this._on(this.element,n.isFunction(n.fn.tap)?"tap":"doubletap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));this._on(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",n.proxy(this._onAppointMouseOver,this));this._on(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",n.proxy(this._onAppointMouseOver,this));this._on(this.element,"click",".e-appup,.e-appdown",n.proxy(this._renderAppPosition,this));(this._mediaQuery||this.element.width()<600)&&this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this));this.model.allowKeyboardNavigation&&(this._on(this.element,"keydown",n.proxy(this._onKeyDown,this)),this._on(n(this.element),"keydown",n.proxy(this._documentOnKeyDown,this)));this.model.orientation=="horizontal"&&this._on(this.element,"click",".e-parentnodecategory",n.proxy(this._onResourceClick,this));(this._mediaQuery||t.isTouchDevice())&&this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",n.proxy(this._touchSchedule,this));this.model.enableResize&&(t.isTouchDevice()?this._on(n(window),"orientationchange",n.proxy(this._onScheduleResize,this)):this._on(n(window),"resize",n.proxy(this._onScheduleResize,this)));this._on(this.element,"click",".e-schedulemouseclose,.e-deleteapp",n.proxy(this._deleteAppoint,this));this._on(this.element,"click",".e-editapp",n.proxy(this._appointmentWindow,this))},_drawerOpen:function(){this._scheduleDrawer.ejNavigationDrawer("open")},_mouseButtonClick:function(i){var s,e,o;if(!i.altKey&&!i.shiftKey&&!i.ctrlKey&&i.which!=3&&(i.which==1||i.type=="touchstart")&&!n(i.target).hasClass("e-resourceheadercells")&&!n(i.target).hasClass("e-othermonths")){var u=i.target||document.activeElement||i.srcElement,f=this.element.find("div.e-draggableworkarea tr"),r=this;if(n(u).hasClass("e-alldaycells")&&(f=this.element.find(".e-alldaycells").parent()),n(u).hasClass("e-selectedAppointment")&&(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(f[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=n(u).parent()[0].rowIndex,this._currentColIndex=n(u)[0].cellIndex,s=r.model.orientation=="horizontal"&&r.currentView()=="month"?r.monthDays:r.model.orientation=="vertical"?r.dateRender:r._dateRender,e=n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7,this.model.orientation=="horizontal"&&(e=r.currentView()!=="month"?Math.floor(e/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):e),o=new Date(s[e]),o>=this.model.minDate&&o<=this.model.maxDate&&(n(u).hasClass("e-workcells")||n(u).hasClass("e-monthcells")||n(u).hasClass("e-alldaycells"))){f.on(t.eventType.mouseMove,function(i){var f,e;!t.isNullOrUndefined(r._quickAppointWindow)&&r.model.showQuickWindow&&(r._quickAppointWindow.ejDialog("close"),r._quickAppDetailsWindow.ejDialog("close"));i.preventDefault();f=i.target;i.type=="touchmove"&&(e=i.originalEvent.changedTouches[0],f=document.elementFromPoint(e.pageX,e.pageY));n(f).hasClass("e-selectedCell")&&r.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");r._mouseSelection(i,r,u,f);r._moveScrollContent(u,r)});f.on(t.eventType.mouseUp,function(){f.off(t.eventType.mouseMove)});this.element.find("e.workcells,e.alldaycells,.e-monthcells").removeClass("e-mousehover");this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment")}}},_mouseSelection:function(i,r,u,f){var h=r.element.find("div.e-draggableworkarea tr"),v=n(u).parent().index(),s=n(u).index(),nt=h.length-1,c,l,e,a=n(f).parent().index(),o=n(f).index(),w=r.element.find(".e-alldaycells").parent(),d=r.model.showAllDayRow,y,g,tt,b,k,p;if(this._resWorkWeek)for(y=0,g=0;g<this.res1.length;g++)if(tt=t.isNullOrUndefined(this.res1[g][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this.res1[g][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,o<=y+(tt-1)){b=y+tt;break}else y+=this.res1[g][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else var it=r.model.orientation=="horizontal"?h[0].cells.length:r.currentView()=="month"||r._isCustomMonthView()?h[0].cells.length/r.res1.length:r._dateRender.length,rt=Math.floor(n(f).index()/it),b=it*(rt+1),y=it*rt;if(n(f).hasClass("e-workcells"))if(r.model.orientation=="vertical")if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(s==o)if(a>v)for(e=parseInt(v);e<=a;e++)n(h[e].cells[s]).addClass("e-selectedCell");else if(a<v)for(e=parseInt(v);e>=a;e--)n(h[e].cells[s]).addClass("e-selectedCell");else n(h[a].cells[o]).addClass("e-selectedCell");else if(o>s){for(p=o-s,c=parseInt(v);c<=nt;c++)n(h[c].cells[s]).addClass("e-selectedCell");if(d&&n(w[0].cells[[s]]).addClass("e-selectedCell"),d&&n(w[0].cells[[o]]).addClass("e-selectedCell"),p>1)for(e=1;e<=p-1;e++){for(k=0;k<=nt;k++)n(h[k].cells[o-e]).addClass("e-selectedCell");d&&n(w[0].cells[[o-e]]).addClass("e-selectedCell")}for(l=0;l<=a;l++)n(h[l].cells[o]).addClass("e-selectedCell")}else if(o<s){for(p=s-o,c=parseInt(v);c>=0;c--)n(h[c].cells[s]).addClass("e-selectedCell");if(d&&n(w[0].cells[[s]]).addClass("e-selectedCell"),d&&n(w[0].cells[[o]]).addClass("e-selectedCell"),p>1)for(e=1;e<=p-1;e++){for(k=0;k<=nt;k++)n(h[k].cells[[o+e]]).addClass("e-selectedCell");d&&n(w[0].cells[[o+e]]).addClass("e-selectedCell")}for(l=parseInt(a);l<=nt;l++)n(h[l].cells[o]).addClass("e-selectedCell")}r._currentRowIndex=a;r._currentColIndex=o;n(h[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(v==a&&s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(o>s)for(l=s;l<=o;l++)n(h[a].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(o<=s)for(l=s;l>=o;l--)n(h[a].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(n(f).hasClass("e-alldaycells"))if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(o<s)for(e=s;e>=o;e--)n(w[0].cells[e]).addClass("e-selectedCell");else if(o>s)for(e=s;e<=o;e++)n(w[0].cells[e]).addClass("e-selectedCell");r._currentRowIndex=0;r._currentColIndex=o;n(w[0].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(n(f).hasClass("e-monthcells")){if(n(f).hasClass("e-othermonths"))return!1;if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(a==v)if(o<s)for(e=s;e>=o;e--)n(h[a].cells[e]).addClass("e-selectedCell");else if(o>s)for(e=s;e<=o;e++)n(h[a].cells[e]).addClass("e-selectedCell");else o==s&&n(h[a].cells[o]).addClass("e-selectedCell");else if(a>v){for(p=a-v,c=s;c<b;c++)n(h[v].cells[c]).addClass("e-selectedCell");if(p>1)for(e=1;e<=p-1;e++)for(c=y;c<b;c++)n(h[v+e].cells[c]).addClass("e-selectedCell");for(l=y;l<=o;l++)n(h[a].cells[l]).addClass("e-selectedCell")}else if(a<v){for(p=v-a,c=s;c>=y;c--)n(h[v].cells[c]).addClass("e-selectedCell");if(p>1)for(e=1;e<=p-1;e++)for(c=y;c<b;c++)n(h[v-e].cells[c]).addClass("e-selectedCell");for(l=b-1;l>=o;l--)n(h[a].cells[l]).addClass("e-selectedCell")}r._currentRowIndex=a;r._currentColIndex=o;n(h[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1}},_shiftSelection:function(i){var f,r,u;if(i.shiftKey==!0&&i.which==1&&!n(i.target).hasClass("e-resourceheadercells")){var e=this._focused,o=this,s=i.target;!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this.element.find("e.workcells,e.alldaycells,.e-monthcells").removeClass("e-mousehover");this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");f=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender;r=n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7;this.model.orientation=="horizontal"&&(r=this.currentView()!=="month"?Math.floor(r/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):r);u=new Date(f[r]);u>=this.model.minDate&&u<=this.model.maxDate&&this._mouseSelection(i,o,e,s)}},_moveScrollContent:function(t,i){var r,f,u;i.model.orientation==="horizontal"?(r=i.element.find(".e-draggableworkarea").scrollLeft(),r=i.model.enableRTL?i._browserInfo.name=="mozilla"?r>0?r:r*-1:i._browserInfo.name=="chrome"||i._browserInfo.name=="webkit"?i.element.find(".e-workcells")[0].offsetLeft+i.element.find(".e-workcells").width()-i.element.find(".e-draggableworkarea").scrollLeft()-i.element.find(".e-draggableworkarea").width():Math.abs(r):-r,i.currentView()!="month"?n(i.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",r+"px"):i.element.find(".e-headerdays").css("left",r+"px"),i.currentView()==="day"||i.currentView()==="month"||i.currentView()=="customview"&&i._dateRender.length>7||!i.model.timeScale.enable||(f=n(i.element.find(".e-headercells").find(".e-activeview").parent()).index(),u=Math.floor(Math.abs(r)/i.element.find(".e-workcells").outerWidth()/((i.model.endHour-i.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),f!==u&&i.element.find(".e-headercells").children().removeClass("e-activeview"),n(i.element.find(".e-headercells")[u]).children().addClass("e-activeview"))):n(t).hasClass("e-monthcells")||i.element.find(".e-scrolltimecells").css("top",-i.element.find(".e-draggableworkarea").scrollTop()+"px")},_onScheduleMouseDown:function(i){var r=n(i.target),u=r.hasClass("e-appointment,e-alldayappointment,e-monthappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment");r.hasClass("e-workcells")||u.hasClass("e-appointment")||u.hasClass("e-alldayappointment")||u.hasClass("e-monthappointment")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||r.parents(".e-scheduledialog").hasClass("e-scheduledialog")||(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),this.element.find(".e-workcells").removeClass("e-mousehover"),r.closest("#"+this._id).length>0&&this._scrollerPosition())},_onCellMouseOver:function(i){var r,u,e,f,o;if(n(i.target).closest(".e-appointment,.e-blocktimeappointment,.e-alldayappointment,.e-monthappointment").length>0)return!1;if(this.currentView()=="agenda"){if(this._mediaQuery==!0)return!1;r=n(i.currentTarget);i.type==="mouseover"?(this.element.find(".e-mousehover").removeClass("e-mousehover"),r.hasClass("e-agendacells")&&(r.parent().find(".e-timecolumn,.e-eventcolumn").addClass("e-mousehover"),r.parent().find(".e-editapp").parent().show())):i.type==="mouseout"&&r.hasClass("e-agendacells")&&(r.parent().find(".e-timecolumn,.e-eventcolumn").removeClass("e-mousehover"),r.parent().find(".e-editapp").parent().hide())}else if(r=n(i.currentTarget),u=n(i.target).hasClass("e-workcells")?n(i.target).index():n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7,this.model.orientation=="horizontal"&&(u=this.currentView()!=="month"?Math.floor(u/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):u),e=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender,f=new Date(e[u]),this._slotByElement(n(i.target),"cellHover"),o={cellIndex:u,startTime:new Date(this.cellHoverStartTime),endTime:new Date(this.cellHoverEndTime),target:i,resources:!t.isNullOrUndefined(this.model.cellHover)&&this._tempResource.length!=0?this._getResourceValue(r,u):null},f>=this.model.minDate&&f<=this.model.maxDate)if(i.type==="mouseover"){if(this._trigger("cellHover",o))return!1;this.element.find(".e-mousehover").removeClass("e-mousehover");(r.hasClass("e-workcells")||r.hasClass("e-monthcells"))&&!r.hasClass("e-resourceheadercells")&&r.addClass("e-mousehover")}else i.type==="mouseout"&&(r.hasClass("e-workcells")||r.hasClass("e-monthcells"))&&r.removeClass("e-mousehover");else return!1},_getAppDetails:function(i){var r=t.isNullOrUndefined(i.target)?n(i):n(i.target),o=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),u,f,e;return(this.currentView()=="agenda"&&r.hasClass("e-eventcolumn")&&(o=r.find(".e-agendaappointment")),appId=o.attr("guid"),t.isNullOrUndefined(appId))?!1:(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,appId)),u[0][this._appointmentSettings.recurrence]?(f=n.extend(!0,[],u),f[0][this._appointmentSettings.endTime]=f[f.length-1][this._appointmentSettings.endTime],e=u[0][this._appointmentSettings.recurrence]&&u[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")==1?this._getAppointmentByParentId(appId):f[0]):e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,appId))[0],e)},_onAppointMouseOver:function(i){var f,u,r;if(!this.model.readOnly){if(!t.isNullOrUndefined(this.model.appointmentHover)&&(f={appointment:this._getAppDetails(i)},this._trigger("appointmentHover",f)))return!1;if(this.currentView()=="agenda"){if(this._mediaQuery==!0)return!1;u=n(i.currentTarget);i.type==="mouseover"?(this.element.find(".e-mousehover").removeClass("e-mousehover"),u.hasClass("e-agendaappointment")&&(u.addClass("e-mousehover"),u.find(".e-editapp").parent().show())):i.type==="mouseout"&&u.hasClass("e-agendaappointment")&&(u.removeClass("e-mousehover"),u.find(".e-editapp").parent().hide())}else r=n(i.target).hasClass("e-appointment,e-alldayappointment,e-monthappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment"),r.hasClass("e-appointment")&&this.model.orientation=="vertical"?i.type==="mouseover"?(this.model.enableAppointmentResize&&(r.find(".e-bottomhandle,.e-tophandle").addClass("e-icon e-nsexpand"),r.find(".e-bottomhandle").addClass("e-appointresizer-bottom"),r.find(".e-tophandle").addClass("e-appointresizer-top")),r.find(".e-schedulemouseclose").css("display","block")):i.type==="mouseout"&&(this.model.enableAppointmentResize&&r.find(".e-bottomhandle,.e-tophandle").removeClass("e-icon e-nsexpand"),r.find(".e-schedulemouseclose").css("display","none")):((r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment"))&&this.model.orientation=="vertical"||this.model.orientation=="horizontal")&&(i.type==="mouseover"?(this.model.enableAppointmentResize&&(r.find(".e-lefthandle,.e-righthandle").addClass("e-icon e-ewexpand"),r.find(".e-lefthandle").addClass("e-appointresizer-left"),r.find(".e-righthandle").addClass("e-appointresizer-right")),r.find(".e-schedulemouseclose").css("display","block")):i.type==="mouseout"&&(this.model.enableAppointmentResize&&r.find(".e-lefthandle,.e-righthandle").removeClass("e-icon e-ewexpand"),r.find(".e-schedulemouseclose").css("display","none")))}},_quickWindowPosition:function(t,i,r,u){var a=u.find(".e-tableAppoint"),f=n("#"+u.prop("id")+"_wrapper").width(),e=this.element.offset().left,o=this.element.offset().left+this.element.width(),s=this.element.offset().top,p=this.element.offset().top+this.element.height(),l=r.width()/2,v="rotate(0deg)",h=!0,c="40%",y;return t>e&&t+f>o&&i>s?(t=o-f-5,c=r.offset().left-t+l):t<e&&t+f<o&&i>s?(t=e+5,c=r.offset().left-t+l):i<s&&(h=!1,v="rotate(180deg)",t<e?(t=e+5,c=r.offset().left-t+l):t+f>o&&(t=o-f-5,c=r.offset().left-t+l),y=u.prop("id")==this._id+"AppDetailsWindow"?r.height():this.model.orientation=="horizontal"?r.height()/2:r.height()-4,i=r.offset().top+10+y,(i<s||i>p-n("#"+u.prop("id")+"_wrapper").height())&&(i=s+4,h=!0,v="rotate(0deg)")),h?a.removeClass("e-tablePosition"):a.addClass("e-tablePosition"),u.find(".e-quickarrow").css("transform",v).css("top",h?a.outerHeight()+1:0).css("left",c),h?u.addClass("e-quickwinarrowbottom").removeClass("e-quickwinarrowtop"):u.addClass("e-quickwinarrowtop").removeClass("e-quickwinarrowbottom"),{X:t,Y:i}},_scrollerPosition:function(){var t,i,n;this.currentView()!="agenda"&&this.model.timeScale.enable&&(this.element.find(".e-vscroll").length>0||this.element.find(".e-hscroll").length>0)&&(t=this.element.find("#"+this._id+"_scroller").ejScroller("instance"),this.model.orientation=="vertical"?(t.isVScroll()&&(n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:n})),t.isHScroll()&&(n=this.element.find(".e-draggableworkarea").offset().left-this.element.find(".e-workcellstab").offset().left,this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:Math.abs(n)}))):this._grouping.length>0&&(t.isVScroll()&&this.element.find(".e-resourceheadertable").offset().top!=this.element.find(".e-workcellstab").offset().top&&(n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this._isQuickDialogOpened=!0,this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:n})),t.isHScroll()&&(i=this.currentView()=="month"||this._isCustomMonthView()?this.element.find(".e-headerdays").offset().left:this.element.find(".e-horizontaltabletimecell").closest("tr").offset().left,this.element.find(".e-workcellstab").offset().left!=i&&(n=this.element.find(".e-draggableworkarea").offset().left-this.element.find(".e-workcellstab").offset().left,this._isQuickDialogOpened=!0,this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:Math.abs(n)})))))},_cellSelection:function(r){var u,k,d,a,h,v,f,g,s,it,rt,w,b,ut,ft,et,ot,c,e;if(r.shiftKey||(t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide"),this.element.find("e.workcells,e.alldaycells,.e-monthcells,.e-agendacells").removeClass("e-mousehover"),this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),u=t.isNullOrUndefined(r.target)?n(r):n(r.target),u.hasClass("e-blocktimeappointment")||u.closest(".e-blocktimeappointment").length>0))return!1;if(this.currentView()=="agenda"||u.hasClass("e-schedulemouseclose")||t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(u=u.closest(".e-appointment,.e-monthappointment").length>0?u.closest(".e-appointment,.e-monthappointment"):u.hasClass("e-apptime")||u.hasClass("e-apptext")||u.hasClass("e-appointinnertext")||u.hasClass("e-schedulemouseclose")||u.hasClass("e-monthheader")?n(r.target):u.closest(".e-workcells, .e-alldaycells, .e-monthcells")),u.hasClass("e-appointwrapper")||u.hasClass("e-textwrapper")&&(u=n(u).parent()),t.isNullOrUndefined(r.type)||r.type!="beforeOpen"?this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell"):(k=this.element.find("td.e-selectedCell"),k.length>0&&!u.hasClass("e-selectedCell")&&this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell")),this.model.showQuickWindow&&t.isNullOrUndefined(this._quickAppointWindow)&&this._renderQuickWindow(),this.currentView()!="agenda"){if((u.hasClass("e-workcells")||u.hasClass("e-alldaycells")||u.hasClass("e-monthcells"))&&!u.hasClass("e-resourceheadercells")){if((this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"),this._slotByElement(u,"cellClick"),this.model.minDate>this.curDate||this.model.maxDate<this.curDate)||(d=this._dayFullNames[new Date(this.curDate).getDay()]+", "+t.format(new Date(this.curDate),"MMMM",this.model.locale)+" "+new Date(this.curDate).getDate()+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale),a={cellIndex:this._cellIndex,startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:r,resources:(this.model.cellClick!=null||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("cellClick")!=-1)&&this._tempResource.length!=0?this._getResourceValue(u):null,quickString:d},this._trigger("cellClick",a)))return!1;if(u.addClass("e-selectedCell").attr("tabIndex",0).focus(),this._scrollerPosition(),this.model.showQuickWindow){this._quickAppointWindow.find("#"+this._id+"_quickAppwindow").css("display","block");this._quickAppointWindow.find(".e-quickstartend").html(a.quickString);h=n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells")?n(r):n(r.target);r.type!="beforeOpen"&&!this.model.readOnly?this._quickAppointWindow.ejDialog("open"):"";this._quickAppointWindow.find(".subject").val("");var st=h.offset().left-(this._quickAppointWindow.width()-h.width())/2+10,ht=h.offset().top-this._quickAppointWindow.outerHeight()+4,c=this._quickWindowPosition(st,ht,h,this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:c.X,Y:c.Y}});t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(u,this._cellIndex)}this._focused=n(":focus");this.model.showQuickWindow&&this._quickAppointWindow.find(".subject").focus();this._cellClick=!0;t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("CreateAppointmentTitle")})}else if(!u.hasClass("e-resourceheadercells")&&!u.hasClass("e-appsoverflow")&&!u.hasClass("e-monthheader")&&!u.hasClass("e-categorybar")){if(this._cellClick=!1,t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.find("#"+this._id+"_quickAppDetailswindow").css("display","block"),!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close"),e=u.hasClass("e-appointment")||u.hasClass("e-monthappointment")||u.hasClass("e-alldayappointment")?u:u.closest(".e-appointment,.e-alldayappointment,.e-monthappointment"),this._appUid=e.attr("guid"),u.hasClass("e-schedulemouseclose"))return!1;for(this._processed=this._sortAppById(this._processed),v=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),i=0;i<v.length;i++){f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,v[i].Guid));break}for(i=0;i<f.length;i++)g=this.element.find("[guid="+f[i].Guid+"]"),g.addClass("e-selectedAppointment");this._mediaQuery&&(this._mAppId=this._appUid);var nt=this._sortAppById(f),l=nt[0][this._appointmentSettings.recurrence]?nt[0]:this._getAppointmentByParentId(this._appUid),y=(new Date).getTime()-l[this._appointmentSettings.startTime].getTime(),p=6e4,ct=60*p,lt=24*ct,tt=Math.abs(new Date-l[this._appointmentSettings.startTime]),o=Math.floor(tt/36e5);if(o=o<=9?"0"+o:o,s=new Date(tt).getUTCMinutes(),s=s<=9?"0"+s:s,it=Math.ceil(y/p-1)<0&&o<24?this._getLocalizedLabels("EventBeginsin")+" "+o+" "+this._getLocalizedLabels("Hours")+" "+s+" "+this._getLocalizedLabels("Minutes"):Math.ceil(y/p-1)<0&&o>=24?this._getLocalizedLabels("EventBeginsin")+" "+Math.abs(Math.ceil(y/lt))+" "+this._getLocalizedLabels("Days"):this._getLocalizedLabels("Overdue"),rt={appointment:f[0]},this._trigger("appointmentClick",rt))return n(".e-selectedAppointment").css({border:"none"}),!1;this.model.showQuickWindow&&(this._quickAppDetailsWindow&&this._quickAppDetailsWindow.find(".e-quicksubject").html(l[this._appointmentSettings.subject]).attr("title",l[this._appointmentSettings.subject]),w=this._timeMode=="12"?t.format(f[0][this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(f[0][this._appointmentSettings.startTime],"HH:mm",this.model.locale),b=this._timeMode=="12"?t.format(f[f.length-1][this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(f[f.length-1][this._appointmentSettings.endTime],"HH:mm",this.model.locale),this._quickAppDetailsWindow.find(".e-rightfields").html(it),ut=Math.ceil((f[0][this._appointmentSettings.endTime]-f[0][this._appointmentSettings.startTime])/36e5)/24,ft=f.length>1||this.model.orientation=="horizontal"&&this.currentView()=="month"&&ut>1||f[0][this._appointmentSettings.startTime].getDay()!=f[f.length-1][this._appointmentSettings.endTime].getDay()?this._dayFullNames[f[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(f[0][this._appointmentSettings.startTime],"MMMM",this.model.locale)+" "+f[0][this._appointmentSettings.startTime].getDate()+" - "+w+" to "+this._dayFullNames[f[f.length-1][this._appointmentSettings.endTime].getDay()]+", "+t.format(f[f.length-1][this._appointmentSettings.endTime],"MMMM",this.model.locale)+" "+f[f.length-1][this._appointmentSettings.endTime].getDate()+" - "+b:this._dayFullNames[f[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(f[0][this._appointmentSettings.startTime],"MMMM",this.model.locale)+" "+f[0][this._appointmentSettings.startTime].getDate()+", "+w+" - "+b,this._quickAppDetailsWindow.find(".e-quickstartendtime").html(ft),l[this._appointmentSettings.recurrence]==1?this._quickAppDetailsWindow.find(".e-editseries").removeClass("e-disable"):this._quickAppDetailsWindow.find(".e-editseries").addClass("e-disable"),r.type!="beforeOpen"?this._quickAppDetailsWindow.ejDialog("open"):"",this.model.readOnly?this._quickAppDetailsWindow.find(".e-scheduledelete").addClass("e-disable"):this._quickAppDetailsWindow.find(".e-scheduledelete").removeClass("e-disable"),et=n(e).width()>this.element.width()?n(e).offset().left>this.element.offset().left?n(e).offset().left:this.element.find(".e-draggableworkarea").scrollLeft()>n(e).width()?this.element.offset().left:this.element.width()/2-4:n(e).offset().left-((this._quickAppDetailsWindow.width()-n(e).width())/2-4),ot=n(e).offset().top-this._quickAppDetailsWindow.outerHeight()+4,c=this._quickWindowPosition(et,ot,e,this._quickAppDetailsWindow),this._quickAppDetailsWindow.ejDialog({position:{X:c.X,Y:c.Y}}),this._quickAppDetailsWindow.focus());t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("Editevent")})}n(u).hasClass("e-monthcells")||this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px")}else{if((this._cellIndex=0,this.cur_StartTime=new Date(new Date(this.currentDate()).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(this.currentDate()).setHours(23,59,59)),n(u).parentsUntil(".e-agendacellstab tbody").find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus(),e=u.hasClass("e-agendaappointment")?u:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),this._appUid=e.attr("guid"),this._mediaQuery&&(this._mAppId=this._appUid),u.hasClass("e-editapp")||u.hasClass("e-deleteapp"))||(e=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._trigger("appointmentClick",{appointment:e[0]})))return!1;this._cellClick=!1}},_getDateByElement:function(n){var t=this.model.showWeekend?7:this.model.workWeek.length,i;this._cellIndex=this.model.timeScale.enable?n.hasClass("e-workcells")?n.index():n.hasClass("e-alldaycells")?n.index():this._isCustomMonthView()&&this._oneWeek?n.index():t-((parseInt(n.index()/t)+1)*t-n.index())+n.parent().index()*t:this.model.orientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?t-((parseInt(n.index()/t)+1)*t-n.index())+n.parent().index()*t:n.index();this.model.orientation=="horizontal"&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):this._cellIndex:n.index(),this._workCellIndex=n.parent().index());i=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this._resWorkWeek?this._dateRender:this.dateRender:this._dateRender;i=this.model.orientation=="horizontal"&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:i;this.curDate=new Date(i[this._cellIndex])},_slotByElement:function(n,i){this._getDateByElement(n);var r=this.curDate;n.hasClass("e-workcells")&&this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?(this._calcCurrentTime(r,n,i),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1})):i=="cellHover"?(this.cellHoverStartTime=new Date(new Date(r).setHours(0,0,0)),this.cellHoverEndTime=new Date(new Date(r).setHours(23,59,59))):(this.cur_StartTime=new Date(new Date(r).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(r).setHours(23,59,59)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}))},_calcCurrentTime:function(n,t,i){var r=this.model.orientation=="vertical"?this.model.startHour*60+t.parent().index()*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount):this.model.startHour*60+t.index()*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*this._cellIndex*(60/this.model.timeScale.majorSlot)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),u;r=r*6e4;this._timeScaleMin=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;this._timeScaleMin=this._timeScaleMin*6e4;i=="cellHover"?(this.cellHoverStartTime=new Date(n).setMilliseconds(r),u=parseInt(new Date(this.cellHoverStartTime).getHours())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getHours()&&parseInt(new Date(this.cellHoverStartTime).getMinutes())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?r+(this._timeScaleMin-1):new Date(this.cellHoverStartTime).getMilliseconds()+this._timeScaleMin,this.cellHoverEndTime=new Date(new Date(this.cellHoverStartTime).setMilliseconds(u)),this.cellHoverEndTime=new Date(this.cellHoverStartTime).setHours(0,0,0,0)<new Date(this.cellHoverEndTime).setHours(0,0,0,0)?new Date(new Date(this.cellHoverStartTime).setHours(23,59,59)):this.cellHoverEndTime):(this.cur_StartTime=new Date(n).setMilliseconds(r),u=parseInt(new Date(this.cur_StartTime).getHours())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getHours()&&parseInt(new Date(this.cur_StartTime).getMinutes())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?r+(this._timeScaleMin-1):new Date(this.cur_StartTime).getMilliseconds()+this._timeScaleMin,this.cur_EndTime=new Date(new Date(this.cur_StartTime).setMilliseconds(u)),this.cur_EndTime=new Date(this.cur_StartTime).setHours(0,0,0,0)<new Date(this.cur_EndTime).setHours(0,0,0,0)?new Date(new Date(this.cur_StartTime).setHours(23,59,59)):this.cur_EndTime)},_checkReminders:function(){var n,i;for(this._todayAppointments=[],n=0;n<this._processed.length;n++)new Date(new Date(this._processed[n][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()>=new Date((new Date).setHours(0,0,0,0)).getTime()&&this._todayAppointments.push(this._processed[n]);i=this;jQuery.each(this._todayAppointments,function(n,r){var u,f,e,o;t.isNullOrUndefined(i.model.reminderSettings)||(u=i.model.reminderSettings.alertBefore,f=r[i._appointmentSettings.startTime],u!=-1&&u!=null&&(e=(new Date).getTime(),o=(e-new Date(f).getTime())/6e4,Math.round(o)==u*-1&&i._trigger("reminder",{reminderAppointment:r})))})},_showContextMenu:function(i){var e=!1,o=!1,s=this.model.contextMenuSettings.menuItems.cells,f,h,c,l,r,u,a;if(i){if(this._contextMenu=t.buildTag("ul#"+this._id+"contextMenu"),this.element.append(this._contextMenu),this._contextMenu.ejMenu({fields:{id:"id",text:"text",parentId:"parentId"},menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+this._id,width:"auto",click:n.proxy(this._onMenuSelect,this),beforeOpen:n.proxy(this._beforeopen,this)}),this.model.categorizeSettings.enable&&this.model.contextMenuSettings.menuItems.appointment){for(f=this.model.contextMenuSettings.menuItems.appointment,h=this.model.categorizeSettings.dataSource.length,r=0;r<f.length;r++)if(f[r].id=="categorize"){c=r;o=!0;break}if(o)for(l=new t.DataManager(this.model.contextMenuSettings.menuItems.appointment).executeLocal((new t.Query).where("parentId",t.FilterOperators.equal,"categorize")),new t.DataManager(this.model.contextMenuSettings.menuItems.appointment).saveChanges({added:[],changed:[],deleted:l},"parentId"),r=0;r<h;r++)u=this.model.categorizeSettings,this.model.contextMenuSettings.menuItems.appointment.push({text:u.dataSource[r][u.text],id:"categorize_"+u.dataSource[r][u.id],fontColor:u.dataSource[r][u.fontColor],color:u.dataSource[r][u.color],parentId:this.model.contextMenuSettings.menuItems.appointment[c].id.toString()})}if(this._gotoDate&&this.model.contextMenuSettings.enable){for(a in s)if(s[a].id=="gotodate"){e=!0;break}e&&(this._renderGotoWindow(),this._gotoDate=!1)}}},_beforeopen:function(i){var f,v,y,p,a,e,u,w,h;if(this.model.contextMenuSettings.enable){n(document).off(t.eventType.mouseMove);var r=n(i.target).closest(".e-alldayappointment,.e-appointment,.e-monthappointment,.e-workcells,.e-monthcells,.e-alldaycells"),c,o=null,s,l=n(r).parents(".e-draggableworkarea tr").length>0&&n(r).parentsUntil(".e-draggableworkarea tr").is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn")||n(r).is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn");if(r.hasClass("e-appointment")||r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||t.isNullOrUndefined(this.model.appointmentTemplateId)||(r=n(i.target).offsetParent()),i.cancel=r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointment")||r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-appointinnertext")||r.hasClass("e-monthcells")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||l?!1:!0,i.cancel==!0)return h=this._contextMenu.data("ejMenu"),h.hide(),!1;if(this.currentView()=="agenda"&&l&&(i=n(r).hasClass("e-agendaappointment")?i:n(r).parents(".e-draggableworkarea tr").find(".e-agendaappointment")),this._cellSelection(i),(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells"))&&(s={currentDate:this.curDate,cellIndex:this._cellIndex,events:i,resources:!t.isNullOrUndefined(this.model.beforeContextMenuOpen)&&this._tempResource.length!=0?this._getResourceValue(r,this._cellIndex):null}),(r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||r.hasClass("e-appointment"))&&(o=this._getAppDetails(i),s={appointment:o,events:i}),this.currentView()=="agenda"&&(o=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],s={appointment:o,events:i}),this._baseTarget=r,this._trigger("beforeContextMenuOpen",s))return!1;if(f=this._contextMenu.data("ejMenu"),c=r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointment")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||l?!1:!0,c?f.option("fields.dataSource",this.model.contextMenuSettings.menuItems.cells):f.option("fields.dataSource",this.model.contextMenuSettings.menuItems.appointment),this.model.readOnly?(f.disableItemByID("new"),f.disableItemByID("recurrence"),f.disableItemByID("delete"),f.disableItemByID("categorize")):(f.enableItemByID("new"),f.enableItemByID("recurrence"),f.enableItemByID("delete"),f.enableItemByID("categorize")),v=this.element.find("td.e-selectedCell"),v.length>1&&this.currentView()!="agenda"&&this._multipleCellAppointCreation(i),this._target=i,this.model.showQuickWindow&&!t.isNullOrUndefined(this._quickAppointWindow)&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),this.model.categorizeSettings.enable&&c==!1){if(y=this._contextMenu.find("li#categorize").find("li").children(),y.find("div").length==0)for(u=0;u<this.model.categorizeSettings.dataSource.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+this.model.categorizeSettings.dataSource[u][this.model.categorizeSettings.id]).children().append('<div><div style="border: 1px solid black;height: 12px;margin-left: 2px;margin-top: 2px;width: 12px;background-color:'+this.model.categorizeSettings.dataSource[u][this.model.categorizeSettings.color]+'"><\/div><\/div>');for(u=1;u<=this.model.categorizeSettings.dataSource.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+u).children().find("div:first-child.e-categorizeMenuSelected")&&this._contextMenu.find("li#categorize").find("li#categorize_"+u).children().find("div:first-child").removeClass("e-categorizeMenuSelected");if(p=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),a=t.DataManager(this._processed).executeLocal(p),a[0][this._appointmentSettings.categorize])if(e=a[0][this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(e[0].length>0)for(u=0;u<e.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+e[u]).children().find("div:first-child").addClass("e-categorizeMenuSelected")}else e[0].length>0&&(w=e.length-1,this._contextMenu.find("li#categorize").find("li#categorize_"+e[w]).children().find("div:first-child").addClass("e-categorizeMenuSelected"))}else this._contextMenu.find("li#categorize")&&this._contextMenu.find("li#categorize").css("display","none")}else return h=this._contextMenu.data("ejMenu"),h.hide(),!1},_onMenuSelect:function(i){var o=i.events.ID.split("_"),u="",c=this._baseTarget,l,d,p,e,s,r,g,f,h,a,k,y,v;if(n(c).is(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment")||c.parents(".e-appointment").hasClass("e-appointment")||c.parents(".e-monthappointment").hasClass("e-monthappointment")||c.parents(".e-alldayappointment").hasClass("e-alldayappointment")||this.currentView()=="agenda"&&this.element.find(".e-selectedCell").parent().find(".e-agendaappointment")?(l=t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u=l[0][this._appointmentSettings.recurrence]==1&&l[0][this._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1?l[0]:this._getAppointmentByParentId(this._appUid)):u={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,resourceInfo:this._getResourceDetails(c)},t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("menuItemClick")==-1||(i={ID:i.ID,type:i.type,text:i.text,parentId:i.parentId,parentText:i.parentText}),this._trigger("menuItemClick",{events:i,targetInfo:u}))return!1;d=u[this._appointmentSettings.categorize];switch(o[0]){case"new":this._appointmentWindow(this._target);break;case"recurrence":this._appointmentWindow(this._target);this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0});this._repeat(i={isChecked:!0,isInteraction:!0});break;case"open":this._appointmentWindow(this._target);break;case"today":this._navigateClick(this.currentDate(new Date),"DateNavigation");break;case"view":t.isNullOrUndefined(o[1])||(p=o[1].toLowerCase(),this._navView=!0,this.currentView()!=p&&this._viewChange(null,this.currentView(),p));break;case"timemode":t.isNullOrUndefined(o[1])||(this.model.timeMode=this._timeMode=o[1]=="Hour12"?"12":"24",this._updateTimeMode());break;case"businesshours":case"workhours":this.model.workHours.highlight=this.model.workHours.highlight?!1:!0;this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells")&&this.element.find(".e-monthcells").removeClass("e-monthcellhighlight");break;case"gotodate":this._gotoWindow.ejDialog("open");break;case"delete":this._deleteAppoint();break;case"print":this._printAppointment(this._appUid);break;case"categorize":if(t.isNullOrUndefined(o[1]))this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment").removeClass("e-selectedAppointment");else if(this.model.categorizeSettings.enable){if(e=o[1],s="",u[this._appointmentSettings.categorize])if(r=u[this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(r[0].length>0){for(f=0;f<r.length;f++)if(r[f]==e){g=!0;break}if(g==!0)for(f=0;f<r.length;f++)r[r.length-1]!=e?r[f]!=e&&(s+=r.length-1!=f?r[f]+",":r[f]):r[f]!=e&&(s+=r.length-2!=f?r[f]+",":r[f]);else s=u[this._appointmentSettings.categorize]+","+e}}else s=r[r.length-1]==e?"":e.toString();else s=e.toString();if(u[this._appointmentSettings.categorize]=s,!t.isNullOrUndefined(o[1])&&this._trigger("beforeAppointmentChange",{appointment:u}))return u[this._appointmentSettings.categorize]=d,!1;var w=this,nt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",b=this._dataManager.update(nt,u,this.model.appointmentSettings.query._fromTable);for(new t.DataManager(this._currentAppointmentData).update("AppTaskId",u),h=this._processed.filter(function(n){return n[w._appointmentSettings.id]==u[w._appointmentSettings.id]}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:h},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:h},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:h},"Guid"),a=0,v=h.length;a<v;a++)this._appointmentRemove(h[a]);for(this._appointmentProcessing(u),this._currentViewAppointments=this._appointmentCount(),k=this._currentViewAppointments.filter(function(n){return n.ParentId==u.ParentId}),y=0,v=k.length;y<v;y++)this._refreshDayAppointments(k[y]);this._trigger("appointmentChanged",{appointment:u});!t.isNullOrUndefined(b)&&n.isFunction(b.promise)&&this.dataSource()instanceof t.DataManager&&b.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&w._processUrlBinding(i)});break}}},_updateTimeMode:function(){var r=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,u=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,i=this._timeSlotCount(r,u),n,f,e,h,o,s;t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".startendtime").ejTimePicker({timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});this.model.orientation!="horizontal"||this.currentView()==="month"||this._isCustomMonthView()||this.currentView()==="agenda"?this.currentView()==="month"||this._isCustomMonthView()||this.currentView()==="agenda"||(o=this.currentView()=="month"?1:0,(r||u)&&this.currentView()!=="month"&&!this._isCustomMonthView()?(i.columnCount.pop(),s=this.userTimeCellTemplate.render({timerows:i.strTime,cols1:i.columnCount,viewclass:o,timeScale:this.model.timeScale.minorSlotCount,cheight:this.model.cellHeight,userTemplateId:r,timeValue1:i.timeValue1,template:u})):s=this.timeCellTemplate.render({timerows:i.strTime,cols1:i.columnCount,viewclass:o,timeScale:this.model.timeScale.minorSlotCount,userTemplateId:r,template:u}),this.$TimeCellTD.children().remove(),this.$TimeCellTD.append(s),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px"),this.element.find(".e-headercells").addClass("e-dateheaderselect"),this._highlightCurrentTime(this.model.showCurrentTimeIndicator)):(n=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",f=n=="day"?1:n=="week"?7:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:5,this.datesColumn=this._getHeaderAllDayCellsCount(),e=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)?!0:!1,h=r||u?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),heightclass:n=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",multiRes:e,view:n,timeTdCount:i.strTime,colspan:n=="month"?1:i.strTime.length/f*2,height:n=="month"?62:59,width:this.model.width,headercellWidth:n=="day"?"100%":"55px",column:i.columnCount,userTemplateId:r,template:u}):this.horizontalHeader.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),heightclass:n=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",multiRes:e,view:n,timeTdCount:i.strTime,colspan:n=="month"?1:i.strTime.length/f*2,height:n=="month"?62:59,width:this.model.width,headercellWidth:n=="day"?"100%":"55px",column:i.columnCount}),this.aTR.children().remove(),this.aTR.append(h),this._borderAddRemove(),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this.element.find(".e-headercells").addClass("e-dateheaderselect"),this._businessHourScroller());t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()},_gotoOk:function(t){var u,f,i,r;if(n(t.currentTarget).hasClass("e-gotoOk")){if(u=this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker("option","value"),f=this._gotoWindow.find("#"+this._id+"show").ejDropDownList("option","itemValue"),data={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:t},this._trigger("actionBegin",{data:data,requestType:"dateNavigate"}))return!1;if(i=this.currentDate(),r=this.currentView(),this.currentDate(new Date(u)),this.currentView(f.toLowerCase()),data={previousDate:i,currentDate:this.currentDate(),previousView:r,currentView:this.currentView(),target:t,requestType:"dateNavigate"},this._trigger("navigation",data))return this.currentDate(new Date(i)),this.currentView(r),this._navView=!1,!1;this._renderCurrentView("ViewChange");this._trigger("actionComplete",{data:data,requestType:"dateNavigate"})}this._gotoCancel()},_gotoCancel:function(){this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker({value:this.currentDate()});this._gotoWindow.find("#"+this._id+"show").ejDropDownList({value:this.currentView()});this._gotoWindow.ejDialog("close")},_renderGoto:function(){var n,t;for(this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate}),n=[],t=0;t<this.model.views.length;t++)switch(this.model.views[t]){case"day":n.push({text:this._getLocalizedLabels("Day"),value:"day"});break;case"week":n.push({text:this._getLocalizedLabels("Week"),value:"week"});break;case"workweek":n.push({text:this._getLocalizedLabels("WorkWeek"),value:"workweek"});break;case"month":n.push({text:this._getLocalizedLabels("Month"),value:"month"});break;case"customview":n.push({text:this._getLocalizedLabels("CustomView"),value:"customview"});break;case"agenda":n.push({text:this._getLocalizedLabels("Agenda"),value:"agenda"})}this._gotoWindow.find("#"+this._id+"show").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:n,width:"100%",selectedItemIndex:0,cssClass:this.model.cssClass});this._gotoWindow.find(".e-gotobutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"60px",cssClass:"e-flat"+this.model.cssClass})},_renderGotoWindow:function(){n("#"+this._id+"gotoWindow_wrapper")&&n("#"+this._id+"gotoWindow_wrapper").remove();this._gotoWindow=t.buildTag("div.e-gotodialog#"+this._id+"gotoWindow");var i="<div><table width='100%' cellpadding='5'><tbody><tr><td>"+this._getLocalizedLabels("Date")+":<\/td><td><input id='"+this._id+"gotodate' type='text' value='' /><\/td><\/tr><tr><td>"+this._getLocalizedLabels("Showin")+":<\/td><td><input type='text' id='"+this._id+"show' /><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-floatright'><table><tr><td><div><button id='"+this._id+"gotook' type='button' class='e-gotobutton e-gotoOk'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div><button id='"+this._id+"gotocancel' type='button' class='e-gotobutton e-gotoCancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>";this._on(this._gotoWindow,"click",".e-gotobutton",n.proxy(this._gotoOk,this));this._gotoWindow.append(i);this.element.append(this._gotoWindow);this._renderGoto();this._gotoWindow.ejDialog({width:300,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("Gotodate"),target:"#"+this._id,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._gotoCancel,this)});n("#"+this._id+"gotoWindow_wrapper").appendTo("body").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_highlightCurrentTime:function(i){var e,f,c,u;if(t.preferredCulture(this.model.locale),i&&this.model.timeScale.enable){for(e=!1,f=0,u=0;u<this._dateRender.length;u++)if(new Date(new Date(this._dateRender[u]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()){e=!0;f=u;break}if(c=this.element.find(".e-workcellstab tr").first().find("td"),this.currentView()==="month"||this._isCustomMonthView())if(e)if(this.model.orientation=="vertical"){var o=this.model.showWeekend?7:this.model.workWeek.length,s=Math.floor(f/o),h=Math.abs(f-s*o);for(this.model.group||(this.res1=["0"]),u=0;u<this.res1.length;u++)n(n(this.element.find(".e-workcellstab tr")[s]).children()[Math.floor(h)]).hasClass("e-othermonths")||n(n(this.element.find(".e-workcellstab tr")[s]).children()[Math.floor(h)]).addClass("e-currentdayhighlight"),h+=o}else this._renderHorizontalCurrentTime();else this.model.orientation=="vertical"?this.element.find(".e-monthcells").removeClass("e-currentdayhighlight"):this.element.find(".e-workcells").removeClass("e-currentdayhighlight");else if(e){var r=this,l=this.currentView()==="week"?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._dateRender.length:1,a=this.model.cellWidth?parseInt(this.model.cellWidth):this.element.find(".e-draggableworkarea")[0].offsetWidth/(l*this.res1.length);if((new Date).getHours()>=r.model.startHour&&(new Date).getHours()<=r.model.endHour)if(r.model.orientation=="vertical")for(u=0;u<this.res1.length;u++)this.element.find(".e-draggableworkarea").append('<div id="'+this._id+u+'_HighlightCurrentTimeline" class="e-highlightcurrenttimeline"><\/div>'),n("#"+this._id+u+"_HighlightCurrentTimeline").append('<div class="e-currenttime"><\/div>').append(t.buildTag("div.e-icon e-circle_01 e-timeidicatorcircle e-lefttimeindicator")).append(t.buildTag("div.e-icon e-circle_01 e-timeidicatorcircle e-righttimeindicator")).css("width",a+"px").css("left",c[f+l*u].offsetLeft+"px").find(".e-righttimeindicator").css("margin-left",a-3+"px");else this._renderHorizontalCurrentTime();function v(){var f,o,s,i;if(r.currentView()!="month"&&!r._isCustomMonthView()){var h=r.element.find(".e-workcellstab tr").first().find("td"),e=r.currentView()==="week"?r.model.showWeekend?7:r.model.workWeek.length:r.currentView()==="workweek"?r.model.workWeek.length:r.currentView()=="customview"?r._dateRender.length:1,u=new Date;if(u.setMinutes(u.getMinutes()),f=r._dateRender.indexOf(new Date(u).setHours(0,0,0,0)),u.getHours()>=r.model.startHour&&u.getHours()<=r.model.endHour)if(r.model.orientation=="vertical"){for(r.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),o=((u.getHours()-r.model.startHour)*60+u.getMinutes())*(r.element.find(".e-workcells").height()+1)*r.model.timeScale.minorSlotCount/r.model.timeScale.majorSlot,i=0;i<r.res1.length;i++)r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").css("top",o-1),r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").css("left",h[f+e*i].offsetLeft),n(r.element.find(".e-dateheader").children()[f+e*i]).addClass("e-currentdayhighlight");for(s=r._timeMode=="12"?t.format(new Date,"hh:mm tt",r.model.locale):t.format(new Date,"HH:mm",r.model.locale),i=0;i<r.res1.length;i++)r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").find(".e-currenttime").html(s),r._timeMode=="12"&&r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").find(".e-currenttime").addClass("e-timewidth")}else r._horizontalTimePosition(r,u)}}v();t.isNullOrUndefined(this._intervalID)&&(this._intervalID=window.setInterval(v,6e4))}else window.clearInterval(this._intervalID),this._intervalID=null,this.element.find(".e-highlightcurrenttimeline").remove()}},_filter:function(){for(var r=[],i=n.extend(!0,[],this._processed),t=0;t<i.length;t++)new Date(i[t][this._appointmentSettings.endTime])>=this.model.minDate&&new Date(i[t][this._appointmentSettings.endTime])<=this.model.maxDate&&r.push(i[t]);return r},_getPreviousNextAppointment:function(){var i=(this.model.orientation=="horizontal"||!this.model.showNextPrevMonth)&&this.currentView()=="month"?this.monthDays:this._dateRender,u=[],f=[],t=this._filter(),n,r;if(this.currentView()!="workweek")for(n=0;n<t.length;n++)new Date(t[n][this._appointmentSettings.startTime])<new Date(i[0])&&new Date(t[n][this._appointmentSettings.endTime])<new Date(i[0])?u.push(t[n]):new Date(t[n][this._appointmentSettings.startTime])>new Date(i[i.length-1])&&new Date(t[n][this._appointmentSettings.endTime])>new Date(i[i.length-1])&&f.push(t[n]);else for(n=0;n<t.length;n++)for(r=0;r<i.length;r++)new Date(t[n][this._appointmentSettings.startTime]).getDay()==new Date(i[r]).getDay()&&(new Date(t[n][this._appointmentSettings.startTime])<new Date(i[0])&&new Date(t[n][this._appointmentSettings.endTime])<new Date(i[0])?u.push(t[n]):new Date(t[n][this._appointmentSettings.startTime])>new Date(i[i.length-1])&&new Date(t[n][this._appointmentSettings.endTime])>new Date(i[i.length-1])&&f.push(t[n]));return{previous:u,next:f}},_nextPrevAppointment:function(n){var r,i;if(n&&!(this._browserInfo.name==="msie"&&this._browserInfo.version<9)){var u=this.element.find("#"+this._id+"_scroller"),o=u.ejScroller("instance").isVScroll()?this.element.find("#"+this._id+"_scroller").find(".e-vscroll").outerWidth():0,f=t.buildTag("div.e-prevapp enable",this._getLocalizedLabels("PreviousAppointment"),{},{}),e=t.buildTag("div.e-nextapp enable",this._getLocalizedLabels("NextAppointment"),{},{});u.append(f).append(e);r=u.height()/2-75;i=this.element.find(".e-scrolltimecells").parent().outerWidth();i=t.isNullOrUndefined(i)?0:i;this.model.enableRTL?(f.css({top:r+40+"px",transform:"rotate(-90deg)",right:i-61+"px"}),e.css({top:r+40+"px",transform:"rotate(90deg)",right:this.element.find(".e-workareadiv").width()-61-o-30+"px"})):(f.css({top:r+40+"px",transform:"rotate(90deg)",left:i-61+"px"}),e.css({top:r+40+"px",transform:"rotate(-90deg)",left:this.element.find(".e-workareadiv").width()-61-o-30+"px"}))}},_nextPrev:function(i){var u=this,r=this._getPreviousNextAppointment();n(i.currentTarget).hasClass("e-prevapp")?t.isNullOrUndefined(r)||(r.previous.sort(function(n,t){return new Date(t[u._appointmentSettings.startTime])-new Date(n[u._appointmentSettings.startTime])}),this.currentView()=="customview"&&(this._daterend=r.previous[0][this._appointmentSettings.startTime]),this._navigateClick(this.currentDate(new Date(new Date(r.previous[0][this._appointmentSettings.startTime]).setHours(0,0,0,0))),"Previous")):n(i.currentTarget).hasClass("e-nextapp")&&(t.isNullOrUndefined(r)||(r.next.sort(function(n,t){return new Date(n[u._appointmentSettings.startTime])-new Date(t[u._appointmentSettings.startTime])}),this.currentView()=="customview"&&(this._daterend=r.next[0][this._appointmentSettings.startTime]),this._navigateClick(this.currentDate(new Date(new Date(r.next[0][this._appointmentSettings.startTime]).setHours(0,0,0,0))),"Next")))},_nextPrevButton:function(){if(this._appointmentCount().length!=0)this.element.find(".e-prevapp,.e-nextapp").css("display","none");else{this.currentView()=="agenda"&&this._refreshAppNavigation();var n=this._getPreviousNextAppointment();this.element.find(".e-prevapp,.e-nextapp").css("display","block");n.previous.length==0?this.element.find(".e-prevapp").removeClass("enable").addClass("e-nextprevappdisable"):this.element.find(".e-prevapp").addClass("enable").removeClass("e-nextprevappdisable");n.next.length==0?this.element.find(".e-nextapp").removeClass("enable").addClass("e-nextprevappdisable"):this.element.find(".e-nextapp").addClass("enable").removeClass("e-nextprevappdisable")}},_navigateView:function(i){var e,u,o,f,c=this.currentView(),r=n(i.target),s,h;if(this.currentView()=="agenda")return!1;if(this.model.orientation=="vertical"){if(this.currentView()==="month"||this._isCustomMonthView()){if(r.hasClass("e-monthheader")){if(this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1)return!1;if(f=r.parent().index(),o=f>6?f%7:f,u=new Date(this._dateRender[r.parent().parent().index()*7+o]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(u);else return!1;e="day"}else if(r.hasClass("e-timecells")||r.hasClass("e-timecelldivs")){if(r=r.hasClass("e-timecells")?r:r.parent(),this.model.views.toString().toLowerCase().split(",").indexOf("week")==-1)return!1;if(u=new Date(this._dateRender[r.parent().index()*7]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(u);else return!1;e="week"}}else if(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7){if(s=r.hasClass("e-headercells")?r:r.parent().hasClass("e-headercells")?r.parent():r.closest(".e-headercells"),this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1||!s.hasClass("e-headercells"))return!1;if(f=s.index(),h=this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()==="customview"?this._dateRender.length:7,o=f>h-1?f%h:f,u=new Date(this._dateRender[o]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(new Date(u));else return!1;e="day"}this._navView=!0;c=="day"||t.isNullOrUndefined(e)||(this._viewChange(i,c,e),this._businessHourScroller())}else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._horizontalViewNavigation(i)},_appOverflowClick:function(i){var r;if(this.model.views.toString().toLowerCase().split(",").indexOf("day")!==-1){if(this._trigger("overflowButtonClick",{event:i,Datas:this._overflowApp}))return!1;t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");this.model.orientation=="vertical"?(r=n(i.target).closest(".e-monthcells,.e-workcells").parent().index()*7+n(i.target).closest(".e-monthcells,.e-workcells").index()%7,this.currentDate(new Date(this._dateRender[r]))):(r=parseInt(n(i.target).attr("id").split("_")[n(i.target).attr("id").split("_").length-1]),this.currentDate(this.currentView()=="month"||this._isCustomMonthView()?new Date(this.monthDays[r]):new Date(parseInt(n(i.target).attr("cellinfo")))));this._navView=!0;this._viewChange(i,this.currentView(),"day")}else return!1},_viewCalendar:function(){var u=this.element.find("#"+this._id+"_navigator").data("ejDatePicker"),i,t,r;u&&(u.show(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}),i=this.element.offset(),this.model.enableRTL?(t=i.left+this.element.width()-280,t<0&&(t=0)):(t=i.left+55,r=n(document).scrollLeft()+n(window).width(),r-t<n("#e-"+this._id+"_navigator").width()&&(t=r-n("#e-"+this._id+"_navigator").width())),n("#e-"+this._id+"_navigator").css({top:i.top+47+"px",left:t+"px"}));this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover");this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment").removeClass("e-selectedAppointment")},_viewChange:function(i,r,u){this._viewchange=!0;this._renderedApp=[];u=t.isNullOrUndefined(u)?i.currentTarget.className.split("e-")[2].split(" ")[0]:u;var e=!0,f;if(f={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i},this._trigger("actionBegin",{data:f,requestType:"viewNavigate"}))return!1;if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),r!==u||!r&&!u){if(r=this.currentView(),this._navView?this.currentView(u):(e=this.currentView()==i.currentTarget.className.split("e-")[2].split(" ")[0]?!1:!0,this.currentView(n(i.currentTarget).hasClass("e-activeview")?this.currentView():i.currentTarget.className.split("e-")[2].split(" ")[0])),f={previousView:r,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i,requestType:"viewNavigate"},this._trigger("navigation",f))return this.currentView(r),this._navView=!1,!1;e&&this._renderCurrentView("ViewChange")}f={previousView:r,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i,requestType:"viewNavigate"};this._mediaQuery&&r!=this.currentView()&&this.element.find(".e-workareadiv,.e-navigate").addClass("navigate");this._trigger("actionComplete",{data:f,requestType:"viewNavigate"})},_renderCurrentView:function(n){t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");this._resWorkWeek=this.model.orientation=="vertical"&&this.model.showWeekend&&this.currentView()=="workweek"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek);this.element.find(".e-commonviewbutton").blur().removeClass("e-activeview");this.model.orientation=="vertical"&&this.element.find(".e-headerdaydisplay,.e-datedisplay,.e-headrealldaytable").children().remove();this._getRenderDates();this.wTR.children().remove();this.aTR.children().remove();this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview").attr("tabIndex",0).focus();t.isNullOrUndefined(this._scheduleDrawer)||this._navSelected||this._scheduleDrawer.ejNavigationDrawer({listViewSettings:{selectedItemIndex:this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())+1}});this._renderHeaderAllDayTemplate();this._renderContentAreaTemplate();this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue());this._renderCommon();t.isNullOrUndefined(this.dataSource())||(n!="ScheduleResize"?this.model.enableLoadOnDemand?this._bindAppointmentsData(n):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):this._renderAppointmentAll());this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.blockoutSettings.enable&&this._renderBlockAppointments();this._navView=!1},_renderHeaderDays:function(){var f,u,e,h,r,o,i,s;if(this.dateRender=[],f=this._getRenderDates(),this.res1=t.isNullOrUndefined(this.model.group)?[0]:this.res1,!this._resWorkWeek)for(i=0;i<this.res1.length;i++)for(u=0;u<f.length;u++)this.dateRender.push(new Date(f[u]));if(this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate),this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate),this.model.orientation=="vertical")if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),this.currentView()==="month"||this._isCustomMonthView())this._renderMonthTimeCells();else{if(t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(i=0;i<this.dateRender.length;i++)e=this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this.dateRender[i]).getDay()]:this._dayShortNames[new Date(this.dateRender[i]).getDay()]:this._dayShortNames[new Date(this.dateRender[i]).getDay()],h=this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?t.format(new Date(this.dateRender[i]),this._pattern.D,this.model.locale):e+" "+new Date(this.dateRender[i]).getDate():e+" "+new Date(this.dateRender[i]).getDate(),this.element.find(".e-headerdaydisplay").eq(i).html(h),new Date(new Date(this.dateRender[i]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&this.element.find("td.e-headercells").eq(i).addClass("e-currentdayhighlight");else{if(r=[],o=this._getUserDateheaderTemplate(),this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(i=0;i<this.res1.length;i++)r=n.merge(r,o);else r=n.merge(r,o);for(i=0;i<this.dateRender.length;i++)this.element.find(".e-headerdaydisplay").eq(i).html(r[i].currentDay),new Date(new Date(this.dateRender[i]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&this.element.find("td.e-headercells").eq(i).addClass("e-currentdayhighlight")}if(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),!t.isNullOrUndefined(this.model.allDayCellsTemplateId)&&this.model.timeScale.enable){for(s=this._getUserAllDayCellsTemplate(),a=0;a<s.length;a++)this.element.find(".e-alldaycells").eq(a).html(s[a]);this.element.find(".e-leftindent").height(this.element.find(".e-alldaycells").height())}this.element.find(".e-headercells").addClass("e-dateheaderselect")}else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._renderHorizontalHeaderDays(this._culture)},_renderMonthTimeCells:function(){var s=0,u=this._dateRender,o=0,r=this.model.showWeekend?7:this.model.workWeek.length,f=t.isNullOrUndefined(this.model.group)?r:this.res1.length*r,h=this._tempResource.length!=0&&t.scheduleFeatures.resources?!0:!1,c,e,n,i;for(f=h?this._isCustomMonthView()&&this._oneWeek?this.res1.length*this._dateRender.length:this.res1.length*r:t.isNullOrUndefined(this.model.group)?r:this._isCustomMonthView()&&this._oneWeek?this.res1.length*this._dateRender.length:this.res1.length*7,c=h&&this._isCustomMonthView()&&this._oneWeek?!0:!1,e=this.element.find("div.e-monthheader"),n=0;n<u.length;n++){for(i=o;i<f;i=c?i+this._dateRender.length:i+r)e.eq(i).html(t.format(new Date(u[n]),"dd",this.model.locale).toString()),this.currentView()!=="customview"&&(new Date(u[n]).getMonth()!==new Date(this.currentDate()).getMonth()?this.model.showNextPrevMonth?e.eq(i).addClass("e-monthdateshighlight").closest(".e-monthcells").removeClass("e-othermonths").children().show():e.eq(i).addClass("e-monthdateshighlight").closest(".e-monthcells").addClass("e-othermonths").children().hide():e.eq(i).removeClass("e-monthdateshighlight").closest(".e-monthcells").removeClass("e-othermonths").children().show()),new Date(u[n]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&(this.element.find("td.e-monthcells").eq(i).hasClass("e-othermonths")||this.element.find("td.e-monthcells").eq(i).addClass("e-currentdayhighlight"));o++;(n+1)%r==0&&(o=f,f=f+(t.isNullOrUndefined(this.model.group)?1:this.res1.length)*r,this.model.showNextPrevMonth||this.currentView()=="customview"?(start=t.format(new Date(u[n-(r-1)]),"MMM dd",this.model.locale),end=t.format(new Date(u[n]),"MMM dd",this.model.locale)):(tempDate=new Date(this.currentDate()),start=n==r-1?t.format(new Date(tempDate.getFullYear(),tempDate.getMonth(),1),"MMM dd",this.model.locale):t.format(new Date(u[n-(r-1)]),"MMM dd",this.model.locale),end=n==u.length-1?t.format(new Date(tempDate.getFullYear(),tempDate.getMonth()+1,0),"MMM dd",this.model.locale):t.format(new Date(u[n]),"MMM dd",this.model.locale)),this.model.timeScale.enable&&this.element.find(".e-timecelldivs").eq(s).html(start+" - "+end),s++)}this.model.showNextPrevMonth||this.currentView()!="month"||this._refreshOtherMonthsBorder();this.element.find(".e-timecells").addClass("e-dateheaderselect");this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length))},_refreshOtherMonthsBorder:function(){for(var i,e,n,r=this.model.enableRTL?"e-borderright":"e-borderleft",u=this.element.find(".e-workcellstab tr").first().find(".e-othermonths").length,f=u/this.res1.length,t=f;t<u;t=t+f)this.element.find(".e-workcellstab tr").first().find(".e-othermonths").eq(t).addClass(r);for(i=this.element.find(".e-workcellstab tr").last().find(".e-othermonths").length,e=i/this.res1.length,n=0;n<i;n=n+e)this.element.find(".e-workcellstab tr").last().find(".e-othermonths").eq(n).addClass(r)},_nextPrevDate:function(n){var r,t=new Date(new Date(this.currentDate()).setHours(0,0,0,0)),i=this.currentView()==="day"||this.currentView()==="agenda"?1:this.currentView()==="customview"?this._dateRender.length:7,u,f,e;return this.currentView()==="month"?(u=n=="navigateprevious"?new Date(t.getFullYear(),t.getMonth()-1,t.getDate()):new Date(t.getFullYear(),t.getMonth()+1,t.getDate()),f=n=="navigateprevious"?new Date(t.getFullYear(),t.getMonth()-1,1):new Date(t.getFullYear(),t.getMonth()+1,1),r=u.getMonth()==f.getMonth()?new Date(u):new Date(f._currentMonthDates().end)):this.currentView()==="customview"?(this._daterend=this._dateRender,this._dateNavigation=!0,t=this.model.showWeekend?new Date(this._dateRender[0]):new Date(this._renderStart),i=this.model.showWeekend?i:this._isCustomMonthView()?this._numDays:this._renderDays,r=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i)):this.currentView()!="day"||this.model.showWeekend?r=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i):(e=n=="navigateprevious"?new Date(t.getTime()-864e5):new Date(t.getTime()+864e5),i=this._getPrevNextDateCount(e,n=="navigateprevious"?"previous":"next")+1,t=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i),r=new Date(t)),new Date(r.getFullYear(),r.getMonth(),r.getDate())},_navigateClick:function(i,r){var u,f,o,e;if(this._viewchange=!0,f=r,o=new Date(this.currentDate()),u={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i},this._trigger("actionBegin",{data:u,requestType:"dateNavigate"}))return!1;if(t.isNullOrUndefined(i)||t.isNullOrUndefined(i.value)||this.currentDate(t.parseDate(i.value,this._pattern.d)),i!=null&&!this._setCurrentDate){if(n(i.currentTarget).hasClass("e-disable"))return!1;n(i.currentTarget).hasClass("e-navigateprevious")?(this.currentDate(this._nextPrevDate("navigateprevious")),this.element.find(".e-navigateprevious").attr("tabIndex",0).focus(),f="Previous"):n(i.currentTarget).hasClass("e-navigatenext")&&(this.currentDate(this._nextPrevDate("navigatenext")),this.element.find(".e-navigatenext").attr("tabIndex",0).focus(),f="Next")}if(i!=null&&(n(i.currentTarget).hasClass("e-navigateprevious")||n(i.currentTarget).hasClass("e-navigatenext")||i.type=="select")&&(u={previousDate:o,currentDate:new Date(this.currentDate()),currentView:this.currentView(),target:i,requestType:"dateNavigate"}),this._trigger("navigation",u))return this.currentDate(new Date(o)),!1;this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");this.element.find(".e-appsoverflow").remove();this.element.find(".e-monthcells").removeClass("e-monthcurrenttime");this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));t.isNullOrUndefined(this._scheduleDrawer)||this._scheduleDrawer.ejNavigationDrawer("close");this.currentView()!=="month"&&this.currentView()!=="agenda"&&!this._isCustomMonthView()&&(this.currentView()!=="customview"||this.model.showWeekend)&&this.model.timeScale.enable&&t.isNullOrUndefined(this.model.workCellsTemplateId)?(this._renderHeaderDays(),t.isNullOrUndefined(this.model.queryCellInfo)||(this._renderQueryCellInfo("renderHeaderAllDayTemplate"),this._renderQueryCellInfo("renderContentAreaTemplate"),this._renderQueryCellInfo("emptycell")),this.model.showOverflowButton||this.model.orientation!="horizontal"||(this._horizontalRender(),this._reRenderScroller()),t.isNullOrUndefined(this.dataSource())||(this.model.enableLoadOnDemand?this._bindAppointmentsData(f):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll())),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this._businessHourScroller(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.blockoutSettings.enable&&this._renderBlockAppointments()):this._renderCurrentView(f);this._validateMinMaxDate();!t.isNullOrUndefined(this.oldDate)&&this.oldDate!=""&&this._setCurrentDate&&(this.currentDate(new Date(this.oldDate)),this.oldDate="");this._setCurrentDate=!1;this._mediaQuery&&!t.isNullOrUndefined(i)&&(e=n(i.currentTarget).hasClass("e-navigateprevious")?this.element.width():n(i.currentTarget).hasClass("e-navigatenext")||i.type=="select"?-this.element.width():0,this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll,.e-emptyscrolltd").toggle(),this.model.enableRTL?this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginRight:-e,marginLeft:e}).toggle().animate({marginLeft:0,marginRight:0},500,this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length==1?n.proxy(this._animateScroll,this):""):this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginLeft:-e,marginRight:e}).toggle().animate({marginLeft:0,marginRight:0},500,this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length==1?n.proxy(this._animateScroll,this):""));this._trigger("actionComplete",{data:u,requestType:"dateNavigate"})},_animateScroll:function(){this.element.find(".e-emptyscrolltd").toggle();this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginRight:0,marginLeft:0});(this._browserInfo.name=="webkit"||this._browserInfo.name=="msie")&&(highScrol=this.element.find(".e-businesshighlightworkcells").length!=0?this.element.find(".e-businesshighlightworkcells").first().parent()[0].rowIndex*n(".e-workcells").height():0,n("#"+this._id+"_scroller").ejScroller({scrollTop:highScrol+1}),this.element.find(".e-scrolltimecells").css("top",-(highScrol+1)+"px"))},_validateMinMaxDate:function(){this.element.find(".e-navigateprevious,.e-navigatenext").removeClass("e-disable");var i=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this._dateRender,n=new Date(i[0]),t=new Date(i[i.length-1]);this.currentView()=="workweek"&&(n=new Date(n.setDate(n.getDate()-1)),t=new Date(t.setDate(t.getDate()+1)));n<=this.model.minDate?this.element.find(".e-navigateprevious").addClass("e-disable"):this.element.find(".e-navigateprevious").removeClass("e-disable");t>=this.model.maxDate?this.element.find(".e-navigatenext").addClass("e-disable"):this.element.find(".e-navigatenext").removeClass("e-disable")},_onScheduleResize:function(){var s,u,c,l,a,o,r,i,f,e,h;if(t.isNullOrUndefined(this._scheduleDrawer)||(t.isNullOrUndefined(this._scheduleDrawer.data("ejNavigationDrawer"))?(n(this._scheduleDrawer).remove(),this._scheduleDrawer=null):this._scheduleDrawer.ejNavigationDrawer("close")),this._mediaQuery&&t.isMobile()){if(t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("refresh"),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("refresh"),window.orientation==this._screenOrientation)return!1;this._screenOrientation=window.orientation}if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),e=this._mediaQuery,s=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:(document.documentElement.clientWidth+(s?17:0)<361||t.isMobile())&&this.model.isResponsive,this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive"),u=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),this.currentView()!="agenda"?(c=u.isVScroll()?this.element.find("div#"+this._id+"_scroller").find(".e-vscroll").width():0,this.element.find(".e-nextapp").css("left",this.element.width()-c-90+"px"),this.model.enableRTL&&this.element.find(".e-nextapp").css("left","-45px"),this.model.enableRTL&&this.element.find(".e-prevapp").css("left",this.element.width()-this.element.find(".e-scrolltimecells").width()-89+"px"),this.model.orientation!="horizontal"||t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||(this.element.find(".resemptytd").width(this.element.find(".e-horizontalrestd").width()<100?5:this.element.find(".e-horizontalrestd").width()>=100&&this.element.find(".e-horizontalrestd").width()<=150?10:25),this.element.find(".e-horizontalresheader").width(this._mediaQuery?"50px":"100%"),this.element.find(".e-parentnodecategory").width(this._mediaQuery?"12px":"20px")),l=this.model.orientation==="vertical"?(s&&this._mediaQuery?this.element.outerWidth()+17:this.element.outerWidth())-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width(),u.model.width=parseInt(l)-2,u.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),u.refresh(),this.model.orientation=="vertical"?(this._renderHoriVerticalScroll(),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-upicon, .e-downicon").children().width(this.element.find(".e-workcells").width()),this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css("margin-left","0px"),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px")):this._isCustomMonthView()&&this.currentView()=="month"&&this.currentView()=="day"&&this.model.enableRTL&&!this.model.timeScale.enable||(this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this._horizontalRender(),this.model.showOverflowButton||this._renderAppointmentAll()),this.currentView()=="month"||this._isCustomMonthView()||this.model.orientation!="vertical"?(this._isCustomMonthView()||this.currentView()=="month"||this.currentView()=="day"||this.model.enableRTL||!this.model.timeScale.enable)&&this._renderCurrentView("ScheduleResize"):this.model.enableRTL&&(this.model.cellWidth||this.model.cellHeight)?this._renderCurrentView("ScheduleResize"):(this.model.showAllDayRow&&this.model.timeScale.enable&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments(),this.model.timeScale.enable||(this.element.find("div.e-monthappointment").remove(),this._currentViewAppointments=this._appointmentCount(),this._renderMonthAppointment()),this._bindAppointmentAction()),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator)):(u.model.width=parseInt(this.element.width())-2,u.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),u.refresh(),a=n("div#"+this._id+"_scroller"),this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),a.ejScroller("isVScroll")?this.element.find(".e-emptyscrolltd").show()&&this.element.find(".e-draggableworkarea").height(this.element.find(".e-draggableworkarea").height()+1):this.element.find(".e-emptyscrolltd").hide()),(this._mediaQuery||this.element.width()<600)&&!n("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer(),o=this._mediaQuery==e?!1:!0,!o&&(this.element.width()<600&&this.hTR.find(".e-mobileNavigation").length<1||this.element.width()>600&&this.hTR.find("table.e-viewstable").length<1)&&(this._reRenderHeaderBar(),this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this))),o){if(this.model.orientation=="horizontal")for(r=this._dateRender,i=0;i<r.length;i++)f=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(r[i]).getDay()].split("")[0]:this.currentView()==="day"?t.isNullOrUndefined(this._tempResource)&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(r[i]).getDay()]:this._dayShortNames[new Date(r[i]).getDay()]:this._dayShortNames[new Date(r[i]).getDay()],e=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?f+parseInt(t.format(new Date(r[i]),"dd",this.model.locale)):this.currentView()==="day"?t.isNullOrUndefined(this._tempResource)&&t.isNullOrUndefined(this.model.group)?f+" "+t.format(new Date(r[i]),"dd MMMM yyyy",this.model.locale):f+" "+t.format(new Date(r[i]),"dd MMM yy",this.model.locale):f+" "+new Date(r[i]).getDate(),this.element.find(".e-headerdaydisplay,.e-horizontalheaderdiv").length!=0&&(this.element.find(".e-headerdaydisplay,.e-horizontalheaderdiv")[i].innerHTML=e);this.model.showAppointmentNavigator=o&&!this._mediaQuery;this.model.showAppointmentNavigator?this._nextPrevAppointment(this.model.showAppointmentNavigator):this.element.find(".e-prevapp,.e-nextapp").remove();this.model.showHeaderBar&&this._reRenderHeaderBar();this.element.find(".e-leftindenttable").width(this.element.find(".e-workleftindent").width());this.element.find(".e-ampmdisplay").height(this.element.find(".e-workcells").height());this._businessHourScroller();this.model.showQuickWindow=this._mediaQuery?!1:this._quickWindow;t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow();this._refreshAppointmentWindow();t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close");t.isNullOrUndefined(this._recurEditWindow)||(this._recurEditWindow.ejDialog("close"),this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":360}));this._mediaQuery&&this._phoneChanges();this._renderAppointmentAll();this.model.blockoutSettings.enable&&this._renderBlockAppointments();this._mediaQuery?(this._off(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells"),this._off(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells"),this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this))):(this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells",n.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells",n.proxy(this._shiftSelection,this)),this.element.width()>600&&this._off(this.element,"click","#"+this._id+"navDrawerIcon"));this._mediaQuery||t.isTouchDevice()?this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",n.proxy(this._touchSchedule,this)):this._off(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab");this._on(this.element,t.isMobile()?"click":"dblclick",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells",n.proxy(this._appointmentWindow,this));this._mediaQuery||t.isMobile()?this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this)):this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment");h=n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper");this._mediaQuery?h.addClass("e-scheduleresponsive"):h.removeClass("e-scheduleresponsive");this._mediaQuery&&this.res1.length>1&&this.element.addClass("e-resources")}(this._mediaQuery||this.element.width()<600)&&this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36)},_reRenderHeaderBar:function(){var t=this.element.find(".e-scheduleheader");t.empty();this._renderHeaderBar(t);this.element.find("#"+this._id+"_navigator").ejDatePicker({enableRTL:this.model.enableRTL,buttonText:this._getLocalizedLabels("Today"),select:n.proxy(this._onselect,this),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate});this.element.find(".e-datecommondiv").find(".e-datewidget").css("display","none");this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview")},_renderTemplates:function(){this.model.orientation=="vertical"&&(this.workcellTemp=n.templates(v()),this.monthcellTemp=n.templates(u()),this.timeCellTemplate=n.templates(y()),this.userTimeCellTemplate=n.templates(p()),this.headTemplate=n.templates(s()),this.alldayTemp=n.templates(l()),this.leftIndent=n.templates(h()));t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._renderResourcesTemplate();this.agendaheadTemplate=n.templates(w());this.agendacellTemp=n.templates(k());this.appTemplate=n.templates(f());this.blockTimeTemplate=n.templates(e());t.scheduleFeatures.horizontal&&this.model.orientation==="horizontal"&&this._renderHorizontalTemplates();!t.isNullOrUndefined(this.model.categorizeSettings)&&this.model.categorizeSettings.enable&&(this._renderCategorizeTemplate(),this._categorizeMultipleTemplate=n.templates(o()))},_setNewStartEndHours:function(){this.currentView()==="month"||this._isCustomMonthView()||(this.model.orientation=="horizontal"&&(this.aTR.children().remove(),this._renderHeaderAllDayTemplate()),this.wTR.children().remove(),this._renderContentAreaTemplate(),this._borderAddRemove(),this.model.orientation=="horizontal"&&this._horizontalRender(),this._renderScroller(),this.element.find(".e-ampmdisplay").height(this.element.find(".e-workcells").height()),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").addClass("e-businesshighlightworkcells"),this._businessHourScroller(),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this._renderAppointmentAll(),this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments()))},_renderInitSchedule:function(){var u,i,r;this.element.addClass("e-scheduleouter");this._screenOrientation=window.orientation;this._quickWindow=this.model.showQuickWindow;u=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth;this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:(document.documentElement.clientWidth+(u?17:0)<361||t.isMobile())&&this.model.isResponsive;this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive");this._mediaQuery&&(this.model.showQuickWindow=!1);t.isNullOrUndefined(this._clientWidth)&&(this._clientWidth=this.model.width);this.currentView(this.currentView().toLowerCase());this.model.views=this.model.views.length==0?this.currentView().toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(",");this.model.workWeek=this.model.workWeek==""||this.model.workWeek==null?this._dayNamesArray:this.model.workWeek;this._resWorkWeek=this.model.orientation=="vertical"&&this.model.showWeekend&&this.currentView()=="workweek"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek);this.model.endHour>24&&(this.model.endHour=24);this.model.startHour<0&&(this.model.startHour=0);i=t.preferredCulture(this.model.locale);this._timeMode=this.model.timeMode==null?i.calendar.AM==null&&i.calendar.PM==null?"24":"12":this.model.timeMode=="Hour12"?"12":this.model.timeMode=="Hour24"?"24":this.model.timeMode;this.model.timeMode==null?this._pattern=i.calendar.patterns:this._pattern.t=this._timeMode=="12"?"h:mm tt":"HH:mm";this._firstdayofweek=this.model.firstDayOfWeek!=null?typeof this.model.firstDayOfWeek=="string"?this._dayNamesArray.indexOf(this.model.firstDayOfWeek.toString().toLowerCase()):this.model.firstDayOfWeek:i.calendar.firstDay;this.model.workWeek=this.model.workWeek.toString().toLowerCase().split(",");this.model.width=this.model.width?this.element.width(this._clientWidth).width():this.element.width();this.model.height=this.model.height?this.element.height(this.model.height).height():this.element.height();this.scWidth=this._scWidth?parseInt(this._scWidth):parseInt(this.model.width);this.scHeight=this._scHeight?parseInt(this._scHeight):parseInt(this.model.height);this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate);this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate);this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&this.currentView(this.model.views[0].toLowerCase());this._getRenderDates();this.element.css({width:this._clientWidth,height:this.model.height}).attr({role:"presentation",tabIndex:1});var e=this.model.orientation=="vertical"?"e-vertical":"e-horizontal",f=t.buildTag("div.e-scheduleinner "+e,"",{},{height:this.scHeight,width:this.scWidth}).css({height:this.scHeight-2+"px",position:"relative"}),o=t.buildTag("table.e-table","",{},{cellpadding:"0px",cellspacing:"0px"}).addClass("e-scheduleoutertable"),s=t.buildTag("tbody");this.hTR=t.buildTag("tr.e-scheduleheader");this.aTR=t.buildTag("tr.e-headerarearow");this.wTR=t.buildTag("tr.e-contentarearow");this.model.cellHeight?this.wTR.removeClass("e-celldefaultheight"):this.wTR.addClass("e-celldefaultheight");this._renderTemplates();this.model.showHeaderBar&&this._renderHeaderBar(this.hTR);this._renderHeaderAllDayTemplate();this._renderContentAreaTemplate();f.append(o.append(s.append(this.hTR).append(this.aTR).append(this.wTR)));this._mediaQuery&&this.res1.length>1&&this.element.addClass("e-resources");this._renderToolTip();this.element.append(f);this.model.showHeaderBar||this.element.find(".e-scheduleheader").hide();this.model.showHeaderBar&&(this.hTR.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview"),this.element.find("#"+this._id+"_navigator").ejDatePicker({startDay:this._firstdayofweek,enableRTL:this.model.enableRTL,buttonText:this._getLocalizedLabels("Today"),select:n.proxy(this._onselect,this),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate}),this.element.find("span.e-datewidget").css("display","none"));(this._mediaQuery||this.element.width()<600)&&this._renderNavigationDrawer();this._showContextMenu(this.model.contextMenuSettings.enable);r=n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper");this._mediaQuery?r.addClass("e-scheduleresponsive"):r.removeClass("e-scheduleresponsive");this._mediaQuery&&this._phoneChanges();this.model.enableRTL&&this._browserInfo.name=="webkit"&&!t.isNullOrUndefined(this._appointmentAddWindow)&&this._appointmentAddWindow.find(".e-chk-image").css("margin-right","-13px");this._renderCommon()},_renderToolTip:function(){var i=this,r;t.isNullOrUndefined(this.element.data("ejTooltip"))&&(r=this.model.tooltipSettings.enable?".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendacells.e-eventcolumn,.e-appup,.e-appdown,.e-appsoverflow":".e-appup,.e-appdown,.e-appsoverflow",this.element.ejTooltip({target:r,associate:"mousefollow",isBalloon:!1,beforeOpen:function(n){i._showToolTip(n)?i._openTooltip=!0:(n.cancel=!0,i._openTooltip=!1)},containment:"#"+this._id,tip:{adjust:{xValue:20,yValue:20}},position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}},tracking:function(t){(!i._openTooltip||n(t.event.target).is(".e-tophandle,.e-bottomhandle,.e-schedulemouseclose,.e-righthandle,.e-lefthandle,.e-schedulerepeat,.e-editapp,.e-deleteapp"))&&(t.cancel=!0,this.hide())}}))},_renderQuickWindow:function(){this.model.showQuickWindow&&(this._renderQuickAppWindow(),this._renderQuickAppDetailsView())},_renderDialogs:function(){this._renderQuickWindow();this._renderAppointmentWindow();this._renderRecurrenceEditor();this._renderRecurEditWindow();this._renderAlertWindow()},_renderCommon:function(){if(this.currentView()!="agenda"){if(this.model.orientation=="vertical"&&(this._headerbarWidth(),(this.currentView()==="month"||this._isCustomMonthView())&&this._renderMonthTimeCells(),this.model.timeScale.enable||(this.element.find(".e-headercells").first("td").css("border-left","none"),this.element.find(".e-workcellstab tr td:first-child").css("border-left","none")),!this.model.showAllDayRow&&this.model.cellWidth&&this.element.find(".e-workcellstab tr td:first-child").css({width:this.element.find(".e-headercells").width()}),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.element.find(".e-ampmdisplay").css({height:this.element.find(".e-workcells").height()})),this.currentView()!="agenda"&&this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0){var i=this.model.enableRTL?"border-right":"border-left";this.element.find(".e-horizontaldaterender").css(i,"0px");this.wTR.find(".e-workareadiv").parent().css(i,"0px");this.model.timeScale.enable||this.currentView()==="month"||this._isCustomMonthView()||this.element.find(".e-workcellstab tr td:nth-child(1)").css(i,"0px")}this.model.enableRTL&&this.element.addClass("e-rtl");this.model.timeScale.enable&&this._borderAddRemove();this.model.orientation=="vertical"?this.currentView()!=="month"&&!this._isCustomMonthView()?this.element.find(".e-headercells").addClass("e-dateheaderselect"):"":this.element.find(".e-headercells").addClass("e-dateheaderselect");this.model.orientation=="horizontal"&&(this.currentView()=="month"||this._isCustomMonthView())&&this.element.find(".e-workcells").width()<this.element.find(".e-dateheadercell").width()&&this.model.cellWidth==""&&(this.model.timeScale.enable?this.element.find(".e-workcells").css({width:this.element.find(".e-horizontmonthheaderdaytd").width()}):this.element.find(".e-headerdays table tr td:nth-child(1)").css({width:this.element.find(".e-horizontmonthheaderdaytd").width()+1}));this.model.orientation!="horizontal"||this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()||this.model.cellWidth!=""||this.element.find(".e-horizontmonthheaderdatetd,.e-horizontmonthheaderdaytd").width(this.element.find(".e-workcells").width());this.element.find(".e-horizontalresheader").css({width:this._mediaQuery?"50px":"100%"});this._renderScroller();this.model.showAppointmentNavigator&&this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon();this.model.orientation=="horizontal"?this._horizontalRender():this.model.showOverflowButton||this.currentView()!="month"?this.currentView()=="month"||this._isCustomMonthView()?this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length)):this.element.find(".e-ampmdisplay").height(this.model.timeScale.minorSlotCount==1?this.element.find(".e-timecelldivs").height():this.element.find(".e-workcells").height()):this._monthCellsRender();this._highlightCurrentTime(this.model.showCurrentTimeIndicator);this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal?(this.model.timeScale.enable||this.element.find(".e-headercells").removeClass("e-dateheaderselect"),t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0||this._horizontalResIcon(),t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView()||this.element.find(".e-headercells").parent().parent().parent().css("width",this.element.width()/10*this._dateRender.length+"px"),this.element.find(".e-parentnodecategory").css({width:this._mediaQuery?"12px":"20px"})):t.isNullOrUndefined(this.model.allDayCellsTemplateId)||this.element.find(".e-leftindent").css({height:this.element.find(".e-alldaycells").height()});this.model.workHours.highlight&&this.model.highlightBusinessHours?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");this._dateRender.length>60||n.isNumeric(this.element.find(".e-monthcells").height())&&this.element.find(".e-monthcells").height()!=n(this.element.find(".e-timecells")[3]).height()&&this.model.orientation=="vertical"&&this.model.showOverflowButton?this.element.find("td.e-timecells .e-timecelldivs").addClass("e-timedivcells"):"";this.model.orientation=="horizontal"&&this._safariBrowser&&this.element.find(".e-workcells.e-dayend").width(this.element.find(".e-workcells.e-dayend").outerWidth()+1);this._browserInfo.name=="msie"&&this._browserInfo.version<9&&this.model.orientation=="vertical"&&(this.element.find(".e-workleftindent").find("tr").last().find("td").addClass("e-lastcell"),this.element.find(".e-workcellstab").find("tr").last().find("td").addClass("e-lastcell"))}this._validateMinMaxDate();t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("emptycell");this._businessHourScroller()},_resourceSegregate:function(){var r="",i;if(this._tempResource=[],this._grouping=[],t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources))t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&n.merge(this._tempResource,this.model.resources);else{for(i=0;i<this.model.group.resources.length;i++)if(index=this._findResourceIndex(this.model.resources,"name",this.model.group.resources[i]),!t.isNullOrUndefined(index))if(this.model.resources.length!=0&&this.model.resources[index].resourceSettings.dataSource.length!=0)this._tempResource.push(this.model.resources[index]),this._grouping.push(this.model.group.resources[i]),r=i==this.model.group.resources.length-1?r+this.model.resources[index].field:r+this.model.resources[index].field+",";else return!1;this._appointmentSettings.resourceFields=r}},_borderAddRemove:function(){this.model.enableRTL?(this.element.find(".e-headrealldaytable tr td:first-child,.e-workcellstab tr td:first-child,.e-headerdays table tr td:first-child").css("border-right","none"),this.element.find(".e-horizontalheader,.e-horizontalrestd,.e-monthleftindent,.e-workleftindent,.e-empty").addClass("e-borderleft")):(this.element.find(".e-headrealldaytable tr td:first-child,.e-workcellstab tr td:first-child,.e-headerdays table tr td:first-child").css("border-left","none"),this.element.find(".e-horizontalheader,.e-horizontalrestd,.e-monthleftindent,.e-workleftindent,.e-empty").addClass("e-borderright"));this.model.orientation=="horizontal"?this.currentView()=="month"?this.element.find(".e-headerdays table tr td:first-child").width(this.element.find(".e-workcellstab tr td:first-child").width()):this._browserInfo.name=="webkit"&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-horizontaltimetd").first().width()):(this.model.cellWidth!=""&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-headercells").first().width()),this._safariBrowser&&(this.currentView()=="month"?this.element.find(".e-monthleftindent").width(this.element.find(".e-monthempty").width()+1):this.element.find(".e-workleftindent").attr("style","width:"+(this.element.find(".e-empty").width()+1)+"px !important")));t.isNullOrUndefined(this.oldDate)||this.oldDate==""||(this.currentDate(new Date(this.oldDate)),this.oldDate="")},_phoneChanges:function(){t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({allowDraggable:!1,position:{X:"0",Y:"0"}})},_dateConvert:function(i){if(t.isNullOrUndefined(i))r=null;else{var r=new Date(parseInt(i.match(/\d+/).toString()));r=n.type(r)=="date"?r:new Date}return r},_calculateCustomDays:function(){var r=n.type(this.model.renderDates.start)!="date"?t.parseDate(this.model.renderDates.start,this._datepattern()):new Date(this.model.renderDates.start),i;if(r=t.isNullOrUndefined(r)?new Date(this.model.renderDates.start).toString()=="Invalid Date"||new Date(this.model.renderDates.start).toString()=="NaN"?this._dateConvert(this.model.renderDates.start):new Date(this.model.renderDates.start):r,i=n.type(this.model.renderDates.end)!="date"?t.parseDate(this.model.renderDates.end,this._datepattern()):new Date(this.model.renderDates.end),i=t.isNullOrUndefined(i)?new Date(this.model.renderDates.end).toString()=="Invalid Date"||new Date(this.model.renderDates.end).toString()=="NaN"?this._dateConvert(this.model.renderDates.end):new Date(this.model.renderDates.end):i,t.isNullOrUndefined(this.model.minDate)||t.isNullOrUndefined(this.model.maxDate)||(r=this.model.minDate>=r&&this.model.maxDate<=r?r:this.model.minDate>=r&&this.model.maxDate>=r?this.model.minDate:this.model.maxDate<=r?this.model.minDate:r,i=this.model.minDate>=i&&this.model.maxDate<=i?i:this.model.minDate<=i&&this.model.maxDate<=i?this.model.maxDate:this.model.minDate>=i?this.model.maxDate:i),this._renderStart=t.isNullOrUndefined(r)?i:new Date(r.getFullYear(),r.getMonth(),r.getDate()),this._renderEnd=t.isNullOrUndefined(i)?r:new Date(i.getFullYear(),i.getMonth(),i.getDate()),this._renderDays=Math.round((this._renderEnd-this._renderStart)/864e5)+1,this.oldDate=this.currentDate(),this._dateNavigation||this._renderStart.getTime()>this.currentDate().getTime()||this._renderEnd.getTime()<this.currentDate().getTime()?(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+864e5*(this._renderDays-1)),this._dateNavigation=!1):this.currentDate(new Date(this._renderStart)),this._renderDays>7){var e=this.model.orientation=="vertical"?new Date(this._firstweekdate(this._renderStart)):new Date(this._renderStart),u=new Date(this._renderEnd),f=u.getDay();this._firstdayofweek==0&&f!=6?u.setDate(new Date(this._renderEnd).getDate()+(6-f)):u.setDate(new Date(this._renderEnd).getDate()+(6-f)+this._firstdayofweek);u=this.model.orientation=="vertical"?u:new Date(this._renderEnd);this._numDays=Math.round((u-e)/864e5)+1}return this},_isCustomMonthView:function(){return this.currentView()=="customview"?(this._oneWeek=this._dateRender.length>7?!1:!0,!this._oneWeek):!1},_headerbarWidth:function(){if(this.element.children().length==0)return!1;var i=this.currentView()=="workweek"?this.model.workWeek.length:this.currentView()=="day"?1:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:7,n=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.res1.length*i:i,r=this.element.outerWidth()-(this.element.find(".e-draggableworkarea").offset().left-this.element.offset().left)<parseInt(this.model.cellWidth)*n?1:0;this._browserInfo.name=="webkit"?this.aTR.find(".e-headrealldaytable").width(this.model.cellWidth?parseInt(this.model.cellWidth)*n+(r?0:n):"100%"):this.aTR.find(".e-headrealldaytable").width(this.model.cellWidth?parseInt(this.model.cellWidth)*n+n:"100%")},_renderScroller:function(){if(this.element.children().length==0)return!1;var r=this.element.find("div#"+this._id+"_scroller"),u=this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),i=this,f=this.model.orientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width()-1:this.element.width();r.ejScroller({enableRTL:this.model.enableRTL,height:u-1,width:parseInt(f)-2,cssClass:this.model.cssClass,thumbStart:function(t){var r=n(t.originalEvent.target);if(!i._mediaQuery&&r.closest(".e-workcells").hasClass("e-workcells")||r.closest(".e-appointment").hasClass("e-appointment")||r.closest(".e-monthappointment").hasClass("e-monthappointment")||r.closest(".e-categorybar").hasClass("e-categorybar"))return!1},scroll:function(r){var e,o,u,f;t.isNullOrUndefined(r.scrollTop)||(r.scrollTop=parseInt(r.scrollTop));e=i.element.find("div#"+i._id+"_scroller").data("ejScroller");(e.isVScroll()||e.isHScroll())&&(i.model.orientation==="vertical"?i.element.find(".e-scrolltimecells").css("top",-r.scrollTop+"px"):i.model.timeScale.enable&&i.currentView()!=="month"&&!i._isCustomMonthView()?n(i.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-r.scrollLeft+"px"):i.element.find(".e-headerdays").css("left",-r.scrollLeft+"px"),i.element.find(".e-vhandle").length==1&&i.element.find(".e-horires").css("top",-r.scrollTop+"px"),i.model.orientation=="vertical"?(i.element.find(".e-headrealldaytable").css("left",i.model.enableRTL?r.scrollData.scrollable-r.scrollLeft:-r.scrollLeft+"px"),o=i.element.find(".e-scrolltimecells").width()-3,i.element.find(".e-upicon, .e-downicon").css("left",-(r.scrollLeft-o)+"px"),i._timeMode!="12"||i.currentView()==="month"||i._isCustomMonthView()||(u=r.scrollTop/(i.element.find(".e-workcells").height()*i.model.timeScale.minorSlotCount),u=Math.round(u)<u?Math.round(u)+1:Math.round(u),f=t.preferredCulture(i.model.locale).calendar,f.AM&&f.PM&&i.element.find(".e-idAmpmstyle").each(function(t,i){t==u&&n(i).text().trim()=="00"?parseInt(n(i)[0].id)<12?n(i).text(f.AM[0]):n(i).text(f.PM[0]):(n(i).text()==f.AM[0]&&t>0||n(i).text()==f.PM[0]&&parseInt(n(i)[0].id)>12)&&n(i).text("00")})),i._mediaQuery&&i.element.find(".e-headrealldaytable").css("left","0px"),i.model.showAppointmentNavigator&&i.model.orientation=="vertical"&&e.isVScroll()&&i.currentView()!="month"&&!i._isCustomMonthView()&&!i._mediaQuery&&(i._renderUpDownIcon(),i._renderUpDownIconPosition())):t.scheduleFeatures.horizontal&&i.model.orientation=="horizontal"&&i._horizontalScroll(r,i));t.isNullOrUndefined(i._quickAppointWindow)||!i.model.showQuickWindow||i._isQuickDialogOpened||(i._isQuickDialogOpened=!1,i._quickAppointWindow.ejDialog("close"),i._quickAppDetailsWindow.ejDialog("close"))}});this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator);this._renderHoriVerticalScroll();this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);this._showScrollTd()},_showScrollTd:function(){var n=this.model.enableRTL?"e-borderright":"e-borderleft",i=this.model.orientation=="horizontal"?"16px":"17px";this.model.orientation=="horizontal"&&(this.element.find(".e-vscroll").length>0?(this.element.find(".e-scheduleheader td").first().attr("colspan","3"),this.element.find(".e-workareadiv").parent().attr("colspan","2"),this.element.find(".e-emptyscrolltd").length==0&&this.aTR.append(t.buildTag("td.e-emptyscrolltd","",{},{width:this._mediaQuery?"0px":"16px"})),this.element.find(".e-emptyscrolltd").addClass("e-horizontalemptytd")):(this.element.find(".e-scheduleheader td").first().attr("colspan","2"),this.element.find(".e-workareadiv").parent().attr("colspan","2")));this.element.find(".e-vscroll").length>0?this.element.find(".e-emptyscrolltd").addClass(n).attr("width",i).show():this.element.find(".e-emptyscrolltd").removeClass(n).attr("width","0px").hide()},_renderHoriVerticalScroll:function(){var i=this.element.find("div#"+this._id+"_scroller"),u=this.model.orientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width(),e,o,s;u=parseInt(u)-1;var r=parseInt(this.scHeight)-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),f=i.ejScroller("isVScroll")?18:0,h=i.ejScroller("isHScroll")?18:0;if(this.model.orientation=="vertical"){if(this.model.cellWidth||this.model.cellHeight){this.currentView()=="day"&&this.element.find(".e-headerdaydisplay").css("width",this.model.cellWidth);var c=(parseInt(this.model.cellWidth)+1)*this.element.find("div.e-draggableworkarea tr:first td").length,l=parseInt(this.model.cellHeight)*this.element.find("div.e-draggableworkarea tr").length,a=this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").width():0;this.element.find(".e-draggableworkarea").width(this.element.width()>c+a+f?c-1:u-1-f);this.model.cellHeight?this.element.find(".e-draggableworkarea").height(r>l?l:r-1-h):this.element.find(".e-draggableworkarea").height(r-1-h);this.model.cellWidth&&this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2)}else this.element.find(".e-draggableworkarea").height(r-1),!this.model.showOverflowButton&&(this.currentView()=="month"||this._isCustomMonthView())&&this._monthCellsRender(),this.element.find(".e-draggableworkarea").width(u-1-f);this._mediaQuery&&this.res1.length>1&&(this.element.find(".e-draggableworkarea").width(this.element.find(".e-draggableworkarea").width()*this.res1.length),this.element.find(".e-headrealldaytable").width(this.element.find(".e-draggableworkarea").width()));this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width());this.element.find(".e-scrolltimecells").height(this.element.find(".e-workcellstab").height())}else i.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").css("height","100%")&&this.element.find(".e-resfootertr").css("height","0px"),i.ejScroller("isVScroll")?"":this.element.find(".e-draggableworkarea").css("height",r-19),this._mediaQuery&&(this.element.find(".e-horizontresdiv").height(i.height()),this.element.find(".e-draggableworkarea").children().height("100%"),this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height()),this.element.find(".e-horires").children().height("100%")),(this.model.cellWidth||this.model.cellHeight)&&(e=n(this.element.find(".e-workcells")[0]).parent().find("td").length,i.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").width(parseInt(this.model.cellWidth)*e+e),(this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable)&&this.element.find(".e-headerdays").children().css("width",this.element.find(".e-draggableworkarea").children().width()+"px").css("table-layout","auto"),this.model.cellHeight&&!this._tempResource&&this.element.find(".e-draggableworkarea").height(parseInt(this.model.cellHeight)-1)),(this.currentView()=="month"||this._isCustomMonthView())&&(o=this.element.find(".e-workcellstab tr td:first-child").width(),this.element.find(".e-headerdays table tr td:first-child").width(this.model.timeScale.enable?o:o+1)),this.currentView()=="day"&&this.model.timeScale.enable&&n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-horizontaltabletimecell").width(this.element.find(".e-workcellstab").width()),!this.model.timeScale.enable||i.ejScroller("isHScroll")||this.currentView()=="month"||this._isCustomMonthView()||(s=Math.floor(this.element.find(".e-draggableworkarea").width()/n(this.element.find(".e-workcells")[0]).parent().find("td").length),this.element.find(".e-workcells").width(s),this.element.find(".e-horizontaltabletimecell").find("tr td").width(s),this.element.find(".e-horizontaltabletimecell").css("table-layout","fixed").width(this.element.find(".e-draggableworkarea").width()),i.ejScroller("refresh")),this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()||(this.model.cellWidth||this._browserInfo.name=="webkit"?this._browserInfo.name=="webkit"&&this.currentView()!="month"&&(this.model.cellWidth&&this.element.find(".e-headerdays").width(this.model.cellWidth),this.element.find(".e-workcells").width(this.element.find(".e-draggableworkarea").width/this._dateRender.length),this.element.find(".e-dateheadercell").width(this.element.find(".e-workcells").width()),this.element.find(".e-headerdays table tr td:not(:first-child)").find(".e-dateheadercell").width(this.element.find(".e-workcells").width()-1),this.element.find(".e-workcells").width(this.element.find(".e-workcells").width())):(this.element.find(".e-dateheadercell").width(this.element.find(".e-workcells").width()),this.element.find(".e-workcells").width(this.element.find(".e-horizontmonthheaderdaytd").width())))},_getDayNameIndex:function(n){var r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=[],t=this._firstdayofweek;do t>6&&(t=0),i.push(r[t]),t++;while(i.length<7);return i.indexOf(n.capitalizeFirstString())},_highlightBusinessHours:function(){var ot,r,f,e,it,a,ut,l,rt,u,et,i,v;if(this.currentView()=="agenda")return!1;if(ot=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek)||!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.start)||!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.end):!1,ot){this.element.find(".e-workcells, .e-monthcells").removeClass("e-businesshighlightworkcells e-monthcellhighlight");var c,k,d,y,p,w,nt,tt,g,l,o,s,a,st,ht,b=0,ct=[],u=this.element.find(".e-workcellstab tr"),h=this.model.orientation=="horizontal"&&this._grouping.length>1?this._resourceSort():this.res1;if(this.model.orientation=="vertical")for(i=0;i<h.length;i++)if(o=t.isNullOrUndefined(h[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:h[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(c=this.dateRender,(t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.start))&&t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.end)?(k=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,d=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour):(y=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.start],p=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.end],k=t.isNullOrUndefined(y)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:y>=this.model.startHour?y:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,d=t.isNullOrUndefined(p)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:p<=this.model.endHour?p:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end),w=this.model.endHour-this.model.startHour,nt=Math.floor(u.length/w*k)-this.model.startHour*this.model.timeScale.minorSlotCount,tt=Math.floor(u.length/w*d)-this.model.startHour*this.model.timeScale.minorSlotCount,l=this.currentView()==="week"?this.model.showWeekend?7:o.length:this.currentView()==="workweek"?o.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:1,r=nt;r<tt;r++)for(f=b;f<b+l;f++)for(e=0;e<o.length;e++)s=this._dayNamesArray.indexOf(o[e]),s==-1&&(s=this._getDayNameIndex(o[e])),s==new Date(c[f]).getDay()&&n(n(u[r]).children()[f]).addClass("e-businesshighlightworkcells");b+=l}else{if(this._resWorkWeek){for(r=0;r<o.length;r++)a=this._dayFullNames.indexOf(o[r].capitalizeFirstString()),a==-1&&(a=this._getDayNameIndex(o[r])),ct.push(this._renderDates[a]);c=ct}else c=this.currentView()!="month"&&!this._isCustomMonthView()?this.dateRender:this._dateRender;for(l=this._resWorkWeek?o.length:this.currentView()=="day"?1:7,st=this.currentView()!="month"&&!this._isCustomMonthView()?b:i*7,ht=this.currentView()!="month"&&!this._isCustomMonthView()?b+l:(i+1)*7,r=0;r<u.length;r++)for(f=st;f<ht;f++)for(e=0;e<o.length;e++)s=this._dayNamesArray.indexOf(o[e]),s==-1&&(s=this._getDayNameIndex(o[e])),s==new Date(c[f]).getDay()&&(n(n(u[r]).children()[f]).hasClass("e-othermonths")?n(n(u[r]).children()[f]).removeClass("e-monthcellhighlight"):n(n(u[r]).children()[f]).addClass("e-monthcellhighlight"));b+=l}else if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(c=this._dateRender,i=0;i<h.length;i++)if(h[i].classname!="e-parentnode")for(y=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.start],p=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.end],k=t.isNullOrUndefined(y)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:y>=this.model.startHour?y:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,d=t.isNullOrUndefined(p)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:p<=this.model.endHour?p:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end,w=this.model.endHour-this.model.startHour,g=n(u[i]).children().length/c.length,nt=Math.floor(g/w*k),tt=Math.floor(g/w*d),r=0;r<c.length;r++)for(f=0;f<this.model.workWeek.length;f++)if(s=this._dayNamesArray.indexOf(this.model.workWeek[f]),s==-1&&(s=this._getDayNameIndex(this.model.workWeek[f])),s==new Date(c[r]).getDay())for(e=g*r+nt;e<g*r+tt;e++)if(n(n(u[i]).children()[e]).addClass("e-businesshighlightworkcells"),this._grouping.length>1){it=i;a=this._tempResource.length-1;do ut=new t.DataManager(this._tempResource[a-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[a-1].resourceSettings.id,t.FilterOperators.equal,h[it][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])),t.isNullOrUndefined(ut)||(it=h.indexOf(ut[0]),n(n(u[it]).children()[e]).addClass("e-businesshighlightworkcells")),a-=1;while(a>0)}}else this._horizontalBusinessHighlight(null,null,null,null,null)}else if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");var c=this.dateRender,u=this.element.find(".e-workcells"),lt=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,at=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour,ft=60/this.model.timeScale.majorSlot*this.model.timeScale.minorSlotCount;if(this.res1=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.res1:[0],l=this.currentView()==="week"?this.model.showWeekend?7*this.res1.length:this.model.workWeek.length*this.res1.length:this.currentView()==="workweek"?this.model.workWeek.length*this.res1.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length*this.res1.length:1*this.res1.length,this.model.orientation=="vertical")for(i=lt*ft;i<at*ft;i++)for(v=0;v<l;v++)for(rt=0;rt<this.model.workWeek.length;rt++)this._dayNamesArray.indexOf(this.model.workWeek[rt])==new Date(c[v]).getDay()&&n(u[i*l+v]).addClass("e-businesshighlightworkcells");else this._horizontalBusinessHighlight(this._dateRender,lt,at,ft,u)}else if(this.model.orientation=="vertical")for(et=this.dateRender,u=this.element.find(".e-monthcells"),u.removeClass("e-monthcellhighlight"),i=0;i<et.length;i++)for(v=0;v<this.model.workWeek.length;v++)this._dayNamesArray.indexOf(this.model.workWeek[v])==new Date(et[i]).getDay()&&(n(u[i]).hasClass("e-othermonths")?n(u[i]).removeClass("e-monthcellhighlight"):n(u[i]).addClass("e-monthcellhighlight"));else this._horizontalBusinessHighlight(null,null,null,null,null)},_onselect:function(n){this._navigateClick(n,"DateNavigation")},_renderHeaderBar:function(n){var e=this.model.orientation=="vertical"?1:3,r=t.buildTag("td","",{},{colspan:e}),i=t.buildTag("div.e-datecommondiv").append(t.buildTag("div.e-icon e-navigateprevious","",{},{title:this._getLocalizedLabels("Previous")})).append(t.buildTag("div","",{},{"aria-live":"assertive",tabindex:0}).html(this._getCurrentDateHeaderValue()).addClass("e-datedisplay")).append(t.buildTag("input#"+this._id+"_navigator").css("display","none").addClass("dateCalendar")).append(t.buildTag("div.e-icon e-navigatenext","",{},{title:this._getLocalizedLabels("Next")})),u,f;this._mediaQuery||this.element.width()<600?(this._mediaQuery&&(i=t.buildTag("div.e-datecommondiv").append(t.buildTag("div.e-icon e-navigateprevious","",{},{title:this._getLocalizedLabels("Previous")})).append(t.buildTag("div.e-icon e-navigatenext","",{},{title:this._getLocalizedLabels("Next")})).append(t.buildTag("div","",{},{"aria-live":"assertive",tabindex:0}).html(this._getCurrentDateHeaderValue()).addClass("e-datedisplay")).append(t.buildTag("input#"+this._id+"_navigator").css("display","none").addClass("dateCalendar"))),u=t.buildTag("div#"+this._id+"navDrawerIcon.e-mobileNavigation e-icon"),n.append(r.append(t.buildTag("div").css("width","100%").append(i).append(u)))):(f=t.buildTag("div.e-viewsdiv"),n.append(r.append(t.buildTag("div").css("width","100%").append(i).append(f.append(this._renderViewNavigation(this.model.views))))));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderBar","",n)},_renderViewNavigation:function(n){for(var e=t.buildTag("table.e-table e-viewstable","",{},{cellspacing:"0px",cellpadding:"0px"}),o=t.buildTag("tbody"),u=t.buildTag("tr"),r=n,f,i=0;i<r.length;i++){f=r.length==1?"e-"+r[i].toLowerCase()+" e-singleview":i==0?"e-"+r[i].toLowerCase()+" e-firstview":i==r.length-1?"e-"+r[i].toLowerCase()+" e-lastview":"e-"+r[i].toLowerCase();switch(r[i]){case"day":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Day"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"week":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Week"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"workweek":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("WorkWeek"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"month":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Month"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"customview":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("CustomView"),{},{}).addClass("e-commonviewbutton").addClass(f)));break;case"agenda":u.append(t.buildTag("td").append(t.buildTag("div",this._getLocalizedLabels("Agenda"),{},{}).addClass("e-commonviewbutton").addClass(f)))}}return e.append(o.append(u)),e},_renderNavigationDrawer:function(){var r,i;if(t.isNullOrUndefined(this._scheduleDrawer)){for(this._scheduleDrawer=t.buildTag("div#"+this._id+"navDrawer.navDrawerMenu e-scheduledrawer"),r="<ul><li data-ej-imageClass='e-icon e-mAddEvent' data-ej-text='"+this._getLocalizedLabels("AddEvent")+"' id='addEvent'><\/li>",i=0;i<this.model.views.length;i++)switch(this.model.views[i]){case"day":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Day")+"' id='"+this.model.views[i]+"'><\/li>";break;case"week":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Week")+"' id='"+this.model.views[i]+"'><\/li>";break;case"workweek":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("WorkWeek")+"' id='"+this.model.views[i]+"'><\/li>";break;case"month":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Month")+"' id='"+this.model.views[i]+"'><\/li>";break;case"customview":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("CustomView")+"' id='"+this.model.views[i]+"'><\/li>";break;case"agenda":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Agenda")+"' id='"+this.model.views[i]+"'><\/li>"}r+="<\/ul>";this._scheduleDrawer.append(r);this.element.find(".e-scheduleinner").append(this._scheduleDrawer);this._navDrawer=!0;this._scheduleDrawer.ejNavigationDrawer({type:"overlay",targetId:this._id+"navDrawerIcon",direction:this.model.enableRTL?"left":"right",enableListView:!0,listViewSettings:{persistSelection:!0,selectedItemIndex:this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())+1,width:100,height:"auto",mouseUp:n.proxy(this._slideMenuClick,this)},position:"normal"});this.model.enableRTL&&this._scheduleDrawer.parent().css("left","0px");this._navDrawer=!1}},_slideMenuClick:function(t){var r,u,e,f,i,o;if(this._navDrawer)return!1;if(this._scheduleDrawer.ejNavigationDrawer("close"),r=t.item.find("div").hasClass("e-day")?"day":t.item.find("div").hasClass("e-week")?"week":t.item.find("div").hasClass("e-workweek")?"workweek":t.item.find("div").hasClass("e-month")?"month":t.item.find("div").hasClass("e-customview")?"customview":t.item.find("div").hasClass("e-agenda")?"agenda":"open",r!="open")this._navView=this._navSelected=!0,this.currentView()!=r&&this._viewChange(null,this.currentView(),r),this._navSelected=!1;else if(this.currentView()!="agenda"){for(u=new Date(this.currentDate()),f=0,u=new Date(u.setHours(0,0,0,0)),i=0;i<this.dateRender.length;i++)if(new Date(this.dateRender[i]).getTime()==u.getTime()){f=i;break}o=this.model.orientation=="vertical"?this.model.startHour+(new Date).getHours()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot):this.res1.length-1;e=this.currentView()!="month"&&this.currentView()!="customview"&&this.model.timeScale.enable?this.element.find(".e-draggableworkarea tr")[o].cells[f]:this.element.find(".e-monthcells")[f];n(e).addClass(".e-selectedCell").trigger(n.Event("click"));this._appointmentWindow({target:e})}},_renderAlertWindow:function(){this._alertWindow=t.buildTag("div.e-alertdialog#"+this._id+"alertWindow");var i="<div><div class='e-alerttext'><\/div><div class='e-alertbtn'><button id='"+this._id+"alertok' type='button' class='e-alertbutton e-alertOk e-buttonactive'>"+this._getLocalizedLabels("Ok")+"<\/button><\/div><\/div>";this._alertWindow.append(i);this.element.append(this._alertWindow);this._alertWindow.find(".e-alertbutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass});this._alertWindow.ejDialog({width:this._mediaQuery?"75%":450,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("RecurrenceAlert"),target:"#"+this._id,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._alertClose,this)});n("#"+this._id+"alertWindow_wrapper").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_alertClose:function(t){this._alertWindow.ejDialog("close");this._alertWindow.hasClass("e-recurAlert")?(this._alertWindow.removeClass("e-recurAlert"),n(t.target).hasClass("e-alertOk")?(this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0}),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(this._rRuleStr),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"),this._appointmentAddWindow.find(".e-recurEditor").toggle(),this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","block"),this._appointmentAddWindow.find(".done").focus()):this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!1})):this._alertWindow.hasClass("e-seriesAlert")?(this._alertWindow.removeClass("e-seriesAlert"),n(t.target).hasClass("e-alertOk")?this._appointmentAddWindow.find("#done").click():this._seriesAlert=!0):this._alertWindow.hasClass("e-deleteAlert")&&(this._alertWindow.removeClass("e-deleteAlert"),n(t.target).hasClass("e-alertOk")&&this._deletingAppointment());this._alertWindow.find("#"+this._id+"alertcancel").length!=0&&this._alertWindow.find("#"+this._id+"alertcancel").remove()},_renderAppointmentWindow:function(){var i,r;n("#"+this._id+"AppointmentAddEditWindow_wrapper")&&n("#"+this._id+"AppointmentAddEditWindow_wrapper").remove();this._appointmentAddWindow=t.buildTag("div.e-scheduledialog e-appointmentaddwindow#"+this._id+"AppointmentAddEditWindow");i="<div class='e-appwindow e-windowmargin'><form id='"+this._id+"_AddEditForm'><table class='e-table' width='100%' cellpadding='7'><tbody>";this._mediaQuery?(i+="<tr id='"+this._id+"subjectlabeltr'><td colspan='3' class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><\/tr><tr id='"+this._id+"subjecttr' class='"+this._id+"subjecttr'><td colspan='3' class='e-rightfields'><input id='"+this._id+"subject' tabIndex='0' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><input id='id' class='id' type='text' name='"+this._appointmentSettings.id+"' value='' style='display: none'/><\/td><\/tr>",this.model.showLocationField&&(i+="<tr><td colspan='3' class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>"),i+="<tr id='"+this._id+"_appStartTime'><td class='e-textlabel' colspan='3'>"+this._getLocalizedLabels("StartTime")+":<\/td><\/tr><tr><td width='37%'><input id='"+this._id+"startdate' class='startenddate' type='text' name='StartDate' value='' /><\/td><td width=31%'><input type='text' id='"+this._id+"starttime' class='startendtime' name='StartTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td width='31%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>"),i+="<\/tr>",i+="<tr id='"+this._id+"_appEndTime'><td class='e-textlabel' colspan='3'>"+this._getLocalizedLabels("EndTime")+":<\/td><\/tr><tr><td><input id='"+this._id+"enddate' class='startenddate' type='text' name='EndDate' value='' /><\/td><td><input type=''text' id='"+this._id+"endtime' class='startendtime' name='EndTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),i+="<\/tr>",this.model.prioritySettings.enable&&(i+="<tr><td class='e-leftfields e-textlabel' colspan='3'>"+this._getLocalizedLabels("Priority")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id= '"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value=''/><div id='prioritylist'><\/div><\/td><\/tr>"),i+="<tr class='"+this._id+"parrow'><td class='"+this._id+"allDay' colspan='3'><table class='e-table e-appchecktable' cellpadding='3'><tr><td><div class='e-allday e-checkboxmargin'><input id='"+this._id+"allday' tabIndex='0' class='allday' type='checkbox' name='"+this._appointmentSettings.allDay+"'/><\/div><\/td><td><div class='e-alldaytext'><label for='"+this._id+"allday'>"+this._getLocalizedLabels("AllDay")+"<\/label><\/div><\/td><td><div class='e-checkboxmargin e-recurrence'><input id='"+this._id+"recurrence' tabIndex='0' class='recurrence' type='checkbox' name='"+this._appointmentSettings.recurrence+"' value='recurrence'/><\/div><\/td><td><label class='e-repeatlbl' for='"+this._id+"recurrence'>"+this._getLocalizedLabels("Recurrence")+"<\/label><\/td><\/tr><\/table><\/td><\/tr>",i+="<tr id='"+this._id+"summary' class='"+this._id+"summary' style='display:none'><td class='e-textlabel'><label>"+this._getLocalizedLabels("Summary")+":<\/label><\/td><\/tr><tr class='"+this._id+"summary' style='display:none'><td colspan='4'><table><tr><td><label class='e-recurFinalRule'><\/label><\/td><td><div class='e-recuredit'><a class='e-recuredit' href='#' onclick='return false;'>"+this._getLocalizedLabels("Edit")+"<\/a><span class='e-icon e-edit_01 e-scheduleedit'><\/span><\/div><\/td><\/tr><\/table><\/td><\/tr>",this.model.categorizeSettings.enable&&(i+="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel' colspan='3'>"+this._getLocalizedLabels("Categorize")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' name='"+this._appointmentSettings.categorize+"' class='e-categorizevalue' type='text' value=''/><\/td><\/tr>"),this._tempResource.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="<tr><td colspan='3'><textarea class='e-description e-textarea e-animation e-inputtext' id='"+this._id+"description' name='"+this._appointmentSettings.description+"'><\/textarea><span class='e-ripple-bar'><\/td><\/tr>",i+="<\/tbody><\/table><\/form>",i+="<div class='e-floatright' style='width:100%'><table width='100%' class='e-table' cellpadding='5'><tr><td width='30%'><div class='e-btnmargin e-floatleft'><button id='mDelete' class='e-btndelete e-appdelete'>"+this._getLocalizedLabels("Delete")+"<\/button><\/div><\/td><td width='30%'><div class='e-btnmargin e-floatleft'><button id='done' class='e-btndone e-appsave e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td width='30%'><div class='e-btnmargin e-floatleft'><button id='cancel' class='e-appointcancel cancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>"):(i+="<tr id='"+this._id+"subjecttr' class='"+this._id+"subjecttr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"subject' tabIndex='0' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><input id='id' class='id' type='text' name='"+this._appointmentSettings.id+"' value='' style='display: none'/><\/td><\/tr>",this.model.showLocationField&&(i+="<tr id='"+this._id+"showLocation' class='"+this._id+"showLocation'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>"),i+="<tr id='"+this._id+"_appStartTime'><td class='e-textlabel'>"+this._getLocalizedLabels("StartTime")+":<\/td><td width='25%'><input id='"+this._id+"startdate' class='startenddate' type='text' name='StartDate' value='' /><\/td><td width=22%'><input type='text' id='"+this._id+"starttime' class='startendtime' name='StartTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td width='28%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>"),i+="<\/tr>",i+="<tr id='"+this._id+"_appEndTime'><td class='e-textlabel'>"+this._getLocalizedLabels("EndTime")+":<\/td><td><input id='"+this._id+"enddate' class='startenddate' type='text' name='EndDate' value='' /><\/td><td><input type=''text' id='"+this._id+"endtime' class='startendtime' name='EndTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),i+="<\/tr>",r=this.model.prioritySettings.enable?"<td colspan='1' class='e-textlabel "+this._id+"priorityshow'>"+this._getLocalizedLabels("Priority")+":<\/td><td colspan='1' class='"+this._id+"prioritylistshow'><input id='"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value='' /><div id='prioritylist'><\/div><\/td>":"",i+="<tr class='"+this._id+"parrow'>"+r+"<td class='"+this._id+"allDay' colspan='4'><table class='e-table e-appchecktable' cellpadding='3'><tr><td><div class='e-allday e-checkboxmargin'><input id='"+this._id+"allday' tabIndex='0' class='allday' type='checkbox' name='"+this._appointmentSettings.allDay+"'/><\/div><\/td><td><div class='e-alldaytext'><label for='"+this._id+"allday'>"+this._getLocalizedLabels("AllDay")+"<\/label><\/div><\/td><td><div class='e-checkboxmargin e-recurrence'><input id='"+this._id+"recurrence' tabIndex='0' class='recurrence' type='checkbox' name='"+this._appointmentSettings.recurrence+"' value='recurrence'/><\/div><\/td><td><label class='e-repeatlbl' for='"+this._id+"recurrence'>"+this._getLocalizedLabels("Recurrence")+"<\/label><\/td><\/tr><\/table><\/td><\/tr>",i+="<tr id='"+this._id+"summary' class='"+this._id+"summary' style='display:none'><td class='e-textlabel'><label>"+this._getLocalizedLabels("Summary")+":<\/label><\/td><td colspan='3'><table><tr><td><label class='e-recurFinalRule'><\/label><\/td><td><div class='e-recuredit'><a class='e-recuredit' href='#' onclick='return false;'>"+this._getLocalizedLabels("Edit")+"<\/a><span class='e-icon e-edit_01 e-scheduleedit'><\/span><\/div><\/td><\/tr><\/table><\/td><\/tr>",this.model.categorizeSettings.enable&&(i+="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Categorize")+":<\/td><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' name='"+this._appointmentSettings.categorize+"' class='e-categorizevalue' type='text' value=''/><\/td><\/tr>"),this._tempResource.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="<tr><td colspan='4'><textarea class='e-description e-textarea e-animation e-inputtext' id='"+this._id+"description' name='"+this._appointmentSettings.description+"'><\/textarea><span class='e-ripple-bar'><\/td><\/tr>",i+="<\/tbody><\/table><\/form>",i+="<div class='e-floatright'><table class='e-table' cellpadding='5'><tr><td><div class='e-btnmargin e-floatleft'><button id='done' class='e-btndone e-appsave e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div class='e-btnmargin e-floatleft'><button id='cancel' class='e-appointcancel cancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>");this._appointmentAddWindow.append(i);this.element.append(this._appointmentAddWindow);this._renderControls();this._appointmentAddWindow.ejDialog({width:this._mediaQuery?"100%":600,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("CreateAppointmentTitle"),target:"#"+this._id,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._onclose,this)});this._mediaQuery?n("#"+this._id+"AppointmentAddEditWindow_wrapper").appendTo("body").addClass("e-scheduledialog e-scheduleresponsive").find(".e-titlebar").addClass("e-dialogheader"):n("#"+this._id+"AppointmentAddEditWindow_wrapper").appendTo("body").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader");n("#"+this._id+"priority_popup_wrapper").addClass("e-schedulepriority");this._on(this._appointmentAddWindow,"click","a.e-recuredit",n.proxy(this._editRecurrence,this));this._mediaQuery&&this._appointmentAddWindow.ejDialog("refresh");n.isFunction(n.validator)&&this._setValidation();this._mediaQuery&&this._phoneChanges()},_renderRecurrenceEditor:function(){var i=t.buildTag("div.e-recurEditor#"+this._id+"recurrenceEditor").ejRecurrenceEditor({selectedRecurrenceType:1,frequencies:["daily","weekly","monthly","yearly","everyweekday"],startDate:this.currentDate(),minDate:this.model.minDate,maxDate:this.model.maxDate,firstDayOfWeek:this.model.firstDayOfWeek,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,locale:this.model.locale}),r="<div class='e-floatright'><table class='e-table' cellpadding='5'><tr><td><div class='e-btnmargin e-floatleft'><button id='"+this._id+"donerecur' class='recurbutton e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div class='e-btnmargin e-floatleft'><button id='"+this._id+"cancelrecur' class='e-cancelrecur recurbutton'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div>";n(i).insertAfter(this._appointmentAddWindow.find(".e-appwindow"));this._appointmentAddWindow.find(".e-recurEditor").append(r);this._appointmentAddWindow.find("#"+this._id+"donerecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._closeRecurence,this),cssClass:"e-flat"+this.model.cssClass});this._appointmentAddWindow.find("#"+this._id+"cancelrecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._closeRecurence,this),cssClass:"e-flat"+this.model.cssClass});this._appointmentAddWindow.find(".e-recurEditor").css("display","none");this._mediaQuery&&this._phoneChanges()},_refreshAppointmentWindow:function(){this._destorySubControls(n("#"+this._id+"_AddEditForm"));this._destorySubControls(n("#"+this._id+"_RecurForm"));n("#"+this._id+"AppointmentAddEditWindow_wrapper").remove();this._renderAppointmentWindow();n.isFunction(n.validator)&&this._setValidation()},_renderQuickAppWindow:function(){var i,r;this._quickAppointWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppointmentQuickWindow");i="<div id='"+this._id+"_quickAppwindow' class='e-tableAppoint'><table cellpadding='7' class='e-qappwindow'><tbody>";i+="<tr><td colspan='2'><div class='e-quickstartend'><\/div> <div title='"+this._getLocalizedLabels("Close")+"'class='e-icon e-scheduleclose e-schedclosemargin e-pointercursor'><\/div><\/td><\/tr><tr><td class='e-subjectlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><td colspan='2' class='e-rightfields'><form id='"+this._id+"_AddForm' onsubmit='return false;'><input id='"+this._id+"subject' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><\/span><\/form><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-quickcreatebottomcontainer'><div tabIndex='0' class='e-detailedapp e-detailedwindow'> "+this._getLocalizedLabels("Detailed")+" >><\/div><div style='margin-right:-3px;' class='e-floatright'><div class='e-quickAppDone'><button id='done' class='e-btndone e-qAppDone e-buttonactive' style='font-size:12px !important;'>"+this._getLocalizedLabels("CreateAppointmentTitle")+"<\/button><\/div><\/div><\/div><\/div>";this._quickAppointWindow.append(i);this.element.append(this._quickAppointWindow);this._quickAppointWindow.append(t.buildTag("div.e-quickarrow").append("<div class='e-outerarrowline'><\/div>").append("<div class='e-innerarrow'><\/div>"));r=this._quickAppointWindow;r.find(".e-btndone").ejButton({showRoundedCorner:!0,click:n.proxy(this._saveAppointment,this),cssClass:"e-flat"+this.model.cssClass,enableRTL:this.model.enableRTL});this._on(r.find(".e-scheduleclose"),"click",n.proxy(this._quickWindowClose,this));this._on(r.find(".e-detailedapp"),"click",n.proxy(this._appointmentWindow,this));this._quickAppointWindow.ejDialog({width:330,minHeight:0,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableAnimation:!1,showOnInit:!1,enableResize:!1,allowDraggable:!1,showHeader:!1,allowKeyboardNavigation:!1,close:n.proxy(function(){this._processFocus()},this)});n.isFunction(n.validator)&&this._setQuickValidation();n("#"+this._id+"AppointmentQuickWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppointmentQuickWindow").addClass("e-dialogouter")},_renderQuickAppDetailsView:function(){this._quickAppDetailsWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppDetailsWindow");var i="<div id='"+this._id+"_quickAppDetailswindow' class='e-tableAppoint e-appdetails'><table cellpadding='1' class='e-qappwindow'><tbody>";i+="<tr><td colspan='2'><div class='e-quicksubject e-textellipsis'><\/div> <div title='"+this._getLocalizedLabels("Close")+"' class='e-icon e-scheduleclose e-schedclosemargin e-pointercursor'><\/div><\/td><\/tr><tr><td colspan='2' class='e-quickduein e-rightfields'><\/td><\/tr><tr><td colspan='2'><div class='e-quickstartendtime'><\/div><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-quickbottomcontainer'><div title='"+this._getLocalizedLabels("Delete")+"' class='e-icon e-delete e-scheduledelete e-pointercursor' tabIndex='0'><\/div><div class='e-floatright'><div class='e-editevents'><div class='e-editevent e-textellipsis' tabIndex='0'>"+this._getLocalizedLabels("Editevent")+" | <\/div><div class='e-editseries e-textellipsis' tabIndex='0'>"+this._getLocalizedLabels("Editseries")+" >><\/div> <\/div><\/div><\/div><\/div>";this._quickAppDetailsWindow.append(i);this.element.append(this._quickAppDetailsWindow);this._quickAppDetailsWindow.append(t.buildTag("div.e-quickarrow").append("<div class='e-outerarrowline'><\/div>").append("<div class='e-innerarrow'><\/div>"));this._on(this._quickAppDetailsWindow.find(".e-scheduleclose"),"click",n.proxy(this._quickAppDetailWindowClose,this));this._on(this._quickAppDetailsWindow.find(".e-scheduledelete"),"click",n.proxy(this._deleteAppoint,this));this._on(this._quickAppDetailsWindow.find(".e-editevent,.e-editseries"),"click",n.proxy(this._editClick,this));this._quickAppDetailsWindow.ejDialog({width:270,minHeight:0,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableAnimation:!1,showOnInit:!1,enableResize:!1,allowDraggable:!1,showHeader:!1,allowKeyboardNavigation:!1,close:n.proxy(function(){this._processFocus()},this)});n("#"+this._id+"AppDetailsWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppDetailsWindow").addClass("e-dialogouter")},_editClick:function(i){if(n(i.target).hasClass("e-editseries")&&this._quickAppDetailsWindow.find(".e-editseries").hasClass("e-disable"))return!1;var u=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),r=new t.DataManager(this._processed).executeLocal(u);n(i.target).hasClass("e-editevent")?r[0][this._appointmentSettings.recurrence]==1?(this._parentId=r[0].ParentId,this._currentAction=t.Schedule.Actions.EditOccurrence,this._showAppointmentDetails(this._appUid,!0)):t.isNullOrUndefined(r[0][this._appointmentSettings.recurrence])?(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(this._appUid,!0)):(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(r[0].Guid,!0)):n(i.target).hasClass("e-editseries")&&r[0][this._appointmentSettings.recurrence]==1&&(this._parentId=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],this._currentAction=t.Schedule.Actions.EditSeries,this._showAppointmentDetails(this._parentId,!1));this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close")},_deleteAppoint:function(i){var r,f,u;this.model.readOnly||(t.isNullOrUndefined(i)||!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this._quickAppDetailsWindow.ejDialog("isOpen")?(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?(this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("isOpen")&&this._quickAppDetailsWindow.ejDialog("close"),this._deletingAppointment()):this._deleteConfirmation()):(r=n(i.target).parent(),f=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),this._appUid=f.attr("guid"),this._mediaQuery&&(this._mAppId=this._appUid),u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?this._deletingAppointment():this._deleteConfirmation()))},_deletingAppointment:function(){if(this._appUid=t.isNullOrUndefined(this._appUid)?this._deleteUid:this._appUid,this._appUid){this._currentAction=t.Schedule.Actions.Delete;var n=this._getAppointmentByParentId(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid);n[this._appointmentSettings.recurrence]?(t.isNullOrUndefined(this._recurEditWindow)&&this._renderRecurEditWindow(),this._parentId=n.ParentId,this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):this._deleteApp(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid)}t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close")},_deleteConfirmation:function(){!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"}),n("#"+this._id+"alertWindow").ejDialog({width:this._mediaQuery?"90%":450,title:this._getLocalizedLabels("MouseOverDeleteTitle")}),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("DeleteConfirmation")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Delete")));this._alertWindow.ejDialog("isOpen")||(this._alertWindow.addClass("e-deleteAlert"),this._alertWindow.ejDialog("open"),this._alertWindow.find(".e-alertOk").attr("tabIndex",0).focus())},_quickAppDetailWindowClose:function(){this._quickAppDetailsWindow.ejDialog("close");this._processFocus()},_alldayCheck:function(){if(this._appointmentAddWindow.find(".allday").ejCheckBox("option","checked"))this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._timeMode=="12"?"12:00 AM":"00:00",enabled:!1}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._timeMode=="12"?"11:59 PM":"23:59",enabled:!1}),this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!1});else{if(this._tempStart!=""||this._tempEnd!=""){var n=t.format(new Date((new Date).setHours(0,0,0)),this._pattern.t,this.model.locale),i=t.format(new Date((new Date).setHours(23,59,59)),this._pattern.t,this.model.locale);this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._tempStart});this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._tempEnd});(this._timeMode=="12"?this._tempStart==n&&this._tempEnd==i:this._tempStart=="00:00"&&this._tempEnd=="23:59")&&(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":00:00"),this._pattern.t,this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":30:00"),this._pattern.t,this.model.locale)}))}this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0});this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!0});this._endSlotChange=!0;this._startSlotChange=!0}},_renderRecurEditWindow:function(){n("#"+this._id+"RecurrenceEdit_wrapper")&&n("#"+this._id+"RecurrenceEdit_wrapper").remove();this._recurEditWindow=t.buildTag("div.e-scheduledialog#"+this._id+"RecurrenceEdit");var f=t.buildTag("div.e-recureditmsg",this._getLocalizedLabels("RecurrenceEditMessage")),i=this._getLocalizedLabels("RecurrenceEditOnly"),r=this._getLocalizedLabels("RecurrenceEditSeries"),u=t.buildTag("div.e-recureditbtns").append(t.buildTag("button.e-editonly#"+this._id+"Editonly",i,{},{name:"recurrenceeditonly",value:i})).append(t.buildTag("button.e-editseries#"+this._id+"EditSeries",r,{},{name:"recurrenceeditseries",value:r}));this._recurEditWindow.append(f).append(u);u.find(".e-editonly,.e-editseries").ejButton({cssClass:"e-flat"+this.model.cssClass,enableRTL:this.model.enableRTL,showRoundedCorner:!0});this._on(this._recurEditWindow,"click",".e-editonly,.e-editseries",n.proxy(this._recurBtnClick,this));this._on(this._recurEditWindow,"click","div.e-scheduleclose",n.proxy(this._recrConformClose,this));this._recurEditWindow.appendTo(this.element);this._mediaQuery&&this._recurEditWindow.find(".e-editonly,.e-editseries").css({"margin-top":"10px"});this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":360,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,title:this._getLocalizedLabels("RecurrenceEditTitle"),showOnInit:!1,enableModal:!0,enableResize:!1,target:"#"+this._id,allowKeyboardNavigation:!1,close:n.proxy(this._processFocus,this),beforeOpen:n.proxy(this._deleteBeforeOpen,this)});n("#"+this._id+"RecurrenceEdit_wrapper").appendTo("body").addClass("e-scheduledialog")},_recrConformClose:function(){t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("close");this._processFocus()},_deleteBeforeOpen:function(){n("#"+this._id+"RecurrenceEdit_title").addClass("e-dialogheader");n("#"+this._id+"RecurrenceEdit_title").find(".e-title").html(this._currentAction==t.Schedule.Actions.Delete?this._getLocalizedLabels("RecurrenceDeleteTitle"):this._getLocalizedLabels("RecurrenceEditTitle"))},_recurBtnClick:function(r){var u,y,l,a,f,e,s,p,h,c,b,v;if(n(r.target).hasClass("e-editonly"))if(this._editOnlyClicked=!0,this._currentAction==t.Schedule.Actions.Delete){if(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1){if(this._trigger("actionBegin",{id:this._appUid,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence})||(y=u[this._appointmentSettings.recurrenceId]==null?u.ParentId:u[this._appointmentSettings.recurrenceId],l=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,y)),this._trigger("beforeAppointmentRemove ",{appointment:l,currentAction:t.Schedule.Actions.DeleteOccurrence})))return!1;a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"Guid";f=this._dataManager.remove(a,u[a],this.model.appointmentSettings.query._fromTable);this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove("Guid",u);e=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:e},"Guid");new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:e},"Guid");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:e},"Guid");this._appointmentRemove(e[0]);this._refreshDayAppointments(e[0]);this._trigger("appointmentRemoved",{appointment:l,requestType:"appointmentDeleted",currentAction:t.Schedule.Actions.DeleteOccurrence});this._trigger("actionComplete",{appointment:l,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence});!t.isNullOrUndefined(f)&&n.isFunction(f.promise)&&this.dataSource()instanceof t.DataManager&&(v=this,f.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&v._processUrlBinding(i)}))}else{if(this._trigger("actionBegin",{id:this._appId,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence}))return!1;var y=u[this._appointmentSettings.recurrenceId]==null?u.ParentId:u[this._appointmentSettings.recurrenceId],k=this._deleteOcurrence(y,u[this._appointmentSettings.startTime]),w=this._timeZoneAppointments(k[0],"");if(this._trigger("beforeAppointmentRemove",{appointment:u,currentAction:t.Schedule.Actions.DeleteOccurrence}))return this._recurEditWindow.ejDialog("close"),!1;var a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",f=this._dataManager.update(a,w,this.model.appointmentSettings.query._fromTable),o=this._timeZoneAppointments(w,"reverse");if(new t.DataManager(this._currentAppointmentData).update("AppTaskId",o),this._refreshCellsHeight(),new Date(new Date(o[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(o[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(o[this._appointmentSettings.endTime]-o[this._appointmentSettings.startTime])/36e5<24&&o[this._appointmentSettings.allDay]!==!0)for(s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),h=[],i=0;i<s.length;i++)p=this._processed.filter(function(n){return n.Guid==s[i].Guid}),p.length>0&&h.push(p[0]),new t.DataManager(this._processed).remove("Guid",s[i].Guid),new t.DataManager(this._renderedApp).remove("Guid",s[i].Guid),new t.DataManager(this._renderedAllDay).remove("Guid",s[i].Guid);else h=this._processed.filter(function(n){return n.Guid==u.Guid}),new t.DataManager(this._processed).remove("Guid",this._appUid),new t.DataManager(this._renderedApp).remove("Guid",this._appUid),new t.DataManager(this._renderedAllDay).remove("Guid",this._appUid),this._appUid=null;for(c=0,b=h.length;c<b;c++)this._appointmentRemove(h[c]),this._refreshDayAppointments(h[c]);this._trigger("appointmentRemoved",{appointment:u,requestType:"appointmentDeleted",currentAction:t.Schedule.Actions.DeleteOccurrence});this._trigger("actionComplete",{appointment:u,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence});!t.isNullOrUndefined(f)&&n.isFunction(f.promise)&&this.dataSource()instanceof t.DataManager&&(v=this,f.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&v._processUrlBinding(i)}))}this._currentViewAppointments=this._appointmentCount();this.model.showAppointmentNavigator&&this._nextPrevButton()}else this._currentAction=t.Schedule.Actions.EditOccurrence,this._showAppointmentDetails(this._appUid,!0);else this._editOnlyClicked=!1,this._currentAction==t.Schedule.Actions.Delete?(this._actionType=t.Schedule.Actions.DeleteSeries,this._deleteApp(this._appUid)):(this._currentAction=t.Schedule.Actions.EditSeries,this._showAppointmentDetails(this._parentId,!1));t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("close")},_repeat:function(n){var i,r;n.isInteraction&&(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),this._appointmentAddWindow.find(".e-recurEditor").length==0&&this._renderRecurrenceEditor(),n.isChecked||this._recurChecked?this._currentAction==t.Schedule.Actions.EditSeries||this._appointmentAddWindow.find(".e-recurFinalRule").html()!=""?this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"):(this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").toggle(),this._appointmentAddWindow.find(".e-recurEditor").css("margin-left",700).toggle().animate({"margin-left":10},400),i=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),i.clearRecurrenceFields(),this._appointmentAddWindow.find(".e-recurEditor").css("display","block"),r=new Date(this._appointmentAddWindow.find(".startenddate").ejDatePicker("option","value")),i.model.startDate=r,i.setDefaultValues()):(this._currentAction==t.Schedule.Actions.EditSeries||this._appointmentAddWindow.find(".e-recurFinalRule").html()!="")&&this._appointmentAddWindow.find("."+this._id+"summary").css("display","none"),this._recurChecked=!1)},_resourceDaysReorder:function(n){var c=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],f=[],r=[],e=[],h=[],o=this._firstdayofweek,s,i,u;do o>6&&(o=0),f.push(c[o]),o++;while(f.length<7);for(s=0;s<n.length;s++)r.push(n[s].toLowerCase());for(i=0;i<r.length;i++)f.indexOf(r[i])!=-1&&(e[f.indexOf(r[i])]=r[i]);for(u=0;u<e.length;u++)t.isNullOrUndefined(e[u])||h.push(e[u]);return h},_daysReorder:function(n){var i=[],t=n,r=[0,1,2,3,4,5,6];do t>6&&(t=0),i.push(r[t]),t++;while(i.length<7);return i},_getWeekDays:function(){for(var t,r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],i=[],n=0;n<this.model.workWeek.length;n++)t=r.indexOf(this.model.workWeek[n]),t!=-1&&i.push(t);return i},_resourceRenderDates:function(){var s,u,h,c,f,r,e,i,o;if(this._tempResource.length>1){for(s=this._resourceSort(),u=[],x=0;x<s.length;x++)i=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource.indexOf(s[x]),i!=-1&&u.push(s[x]);this.res1=u}else u=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource;for(h=[],c=[],this._resDateRen={},f=0;f<u.length;f++)if(r=u[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],t.isNullOrUndefined(r))o=n.extend(!0,[],this._dateRender),o=o.filter(function(n){return new Date(n).getDay()!=0&&new Date(n).getDay()!=6}),n.merge(h,o),this._resDateRen[f]=o;else{for(r=this._resourceDaysReorder(r),e=0;e<r.length;e++)i=this._dayFullNames.indexOf(r[e].capitalizeFirstString()),i==-1&&(i=this._getDayNameIndex(r[e])),h.push(this._renderDates[i]),c.push(this._renderDates[i]);this._resDateRen[f]=c;c=[]}return h},_customviewRenderDates:function(){var u,f,e,r,n,o,i;if(t.isNullOrUndefined(this.model.renderDates))i=this._monthdates();else for(this._calculateCustomDays(),i=[],u=this._getWeekDays(),this._setCurrentDate&&this.model.orientation!="horizontal"&&(this.oldDate=this.currentDate(),this._renderStart.getTime()<this.currentDate().getTime()&&this._renderEnd.getTime()>this.currentDate().getTime()?this.currentDate(new Date(this._renderStart)):(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+(this._renderDays-1)*864e5))),f=this._renderDays<=7?new Date(this.currentDate()):this.model.orientation=="vertical"?this._firstweekdate(this.currentDate()):new Date(this.currentDate()),e=this._renderDays<=7?this._renderDays:this._numDays,r=0;r<e;r++)n=new Date(new Date(f).getTime()+864e5*r),this.model.showWeekend?i.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()):(o=u.indexOf(n.getDay()),o!=-1&&i.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()));return i},_getRenderDates:function(){var i,t,f,u,e;if(this.currentDate(new Date(new Date(this.currentDate()).setHours(0,0,0,0))),this._dateRender=[],this.currentView()==="week"||this.currentView()==="workweek"){if(this.model.showWeekend){i=this._firstweekdate(this.currentDate());do this._dateRender.push(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()),i.setDate(i.getDate()+1);while(this._dateRender.length<7);this._renderDates=n.extend(!0,[],this._dateRender)}else{u=this._getWeekDays();t=this._firstweekdate(this.currentDate());do f=u.indexOf(t.getDay()),f!=-1&&this._dateRender.push(new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()),t=new Date(new Date(t).getTime()+864e5);while(this._dateRender.length!=this.model.workWeek.length);this._renderDates=n.extend(!0,[],this._dateRender)}if(this._resWorkWeek)this.dateRender=this._dateRender=this._resourceRenderDates();else if(this.currentView()=="workweek"&&this.model.showWeekend){var o=this,s=this._daysReorder(this._firstdayofweek),h=this.model.workWeek.map(function(n){return o._dayNamesArray.indexOf(n)}),c=s.filter(function(n){return h.indexOf(n)!==-1}),l=this._dateRender.map(function(n){if(c.indexOf(new Date(n).getDay())!=-1)return n});this._dateRender=l.filter(function(n){return n!=r})}}else this.currentView()==="month"?this._dateRender=this._monthdates():this.currentView()==="customview"?this._dateRender=this._customviewRenderDates():(this.model.showWeekend||(u=this._getWeekDays(),u.indexOf(this.currentDate().getDay())==-1&&(e=this._getPrevNextDateCount(this.currentDate(),"next"),this.currentDate(new Date(this.currentDate().getTime()+864e5*e)))),this._dateRender.push(new Date(this.currentDate().getFullYear(),this.currentDate().getMonth(),this.currentDate().getDate()).getTime()));return this._dateRender},_getAgendaDateCount:function(){var t=this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0,r;if(!this.model.showWeekend){var u=this._getWeekDays(),i=0,n=agendaDate=new Date(this.currentDate());do r=u.indexOf(n.getDay()),r!=-1&&i++,n=new Date(new Date(n).getTime()+864e5);while(this.model.agendaViewSettings.daysInAgenda!=i);t=(n.getTime()-agendaDate.getTime())/864e5-1}return t},_getCurrentDateHeaderValue:function(){var i,n=this._resWorkWeek?this._renderDates:this._dateRender,u,f,r;return this.currentView()==="day"?this.model.dateFormat==""||t.isNullOrUndefined(this.model.dateFormat)?(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),i=r.toLowerCase().startsWith("d")?t.format(new Date(n[0]),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?t.format(new Date(n[0]),"MMM dd, yyyy",this.model.locale):t.format(new Date(n[0]),r,this.model.locale)):i=t.format(new Date(n[0]),this.model.dateFormat,this.model.locale):this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()=="agenda"?(u=this.currentView()=="agenda"?new Date(this.currentDate()):new Date(n[0]),f=this.currentView()=="agenda"?new Date(new Date(this.currentDate()).setDate(u.getDate()+this._getAgendaDateCount())):new Date(n[n.length-1]),i=this._formatDateHeaderValue(u,f)):this.currentView()==="customview"?n.length==1?this.model.dateFormat==""||t.isNullOrUndefined(this.model.dateFormat)?(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),i=r.toLowerCase().startsWith("d")?t.format(new Date(n[0]),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?t.format(new Date(n[0]),"MMM dd, yyyy",this.model.locale):t.format(new Date(n[0]),r,this.model.locale)):i=t.format(new Date(n[0]),this.model.dateFormat,this.model.locale):i=n.length>1&&n.length<=7?this._formatDateHeaderValue(new Date(n[0]),new Date(n[n.length-1])):new Date(n[0]).getFullYear()==new Date(n[n.length-1]).getFullYear()?new Date(n[0]).getMonth()==new Date(n[n.length-1]).getMonth()?t.format(new Date(this.currentDate()),"MMM yyyy",this.model.locale):t.format(new Date(n[0]),"MMM",this.model.locale)+" - "+t.format(new Date(n[n.length-1]),"MMM yyyy",this.model.locale):t.format(new Date(n[0]),"MMM yyyy",this.model.locale)+" - "+t.format(new Date(n[n.length-1]),"MMM yyyy",this.model.locale):i=t.format(new Date(this.currentDate()),"MMM yyyy",this.model.locale),i},_firstweekdate:function(n){var t=new Date(n),i=t.getDay(),r;return this._firstdayofweek==0?i!=0&&(t.setDate(t.getDate()-i),!this.model.timeScale.enable&&(this.currentView()=="workweek"||this._oneWeek)&&this._resize&&(t=new Date(this._dateRender[0]))):this._firstdayofweek!=0&&(r=t.getDay()-this._firstdayofweek<0?7+t.getDay()-this._firstdayofweek:t.getDay()-this._firstdayofweek,t=new Date(t.setDate(t.getDate()-r))),t},_formatDateHeaderValue:function(n,i){var r,u;return this.model.dateFormat!=""&&!t.isNullOrUndefined(this.model.dateFormat)?t.format(n,this.model.dateFormat,this.model.locale)+" - "+t.format(i,this.model.dateFormat,this.model.locale):(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),r.toLowerCase().startsWith("d")?new Date(n).getYear()===new Date(i).getYear()?new Date(n).getMonth()===new Date(i).getMonth()?t.format(new Date(n),"dd",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):t.format(new Date(n),"dd MMM",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):t.format(new Date(n),"dd MMM yyyy",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?new Date(n).getYear()===new Date(i).getYear()?new Date(n).getMonth()===new Date(i).getMonth()?t.format(new Date(n),"MMM dd",this.model.locale)+" - "+t.format(new Date(i),"dd, yyyy",this.model.locale):t.format(new Date(n),"MMM dd",this.model.locale)+" - "+t.format(new Date(i),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),"MMM dd, yyyy",this.model.locale)+" - "+t.format(new Date(i),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),r,this.model.locale)+" - "+t.format(new Date(i),r,this.model.locale))},_getHeaderAllDayCellsCount:function(){var c,f,e,o=[],r=[],s,u=1,h,i;if(this.dateRender=[],this._value=[],this.value=[],this.model.orientation=="vertical"){if(t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView())for(e=this._getColumnCount().length,this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(h=this._getMultipleResourceCellsCount(e),u=h.resCount,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(u=1)),i=0;i<e;i++)s=this.currentView()==="month"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],f=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday":"",c=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:s,currentDateClass:"",cellToday:""}:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?{currentDay:t.format(new Date(this._dateRender[i]),this._pattern.D,this.model.locale),currentDateClass:"",cellToday:f}:{currentDay:s+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:"",cellToday:f}:{currentDay:s+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:f},o.push(c),this._value.push(i);else o=this._getUserDateheaderTemplate(),this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(h=this._getMultipleResourceCellsCount(e),u=h.resCount,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(u=1));if(this._resWorkWeek)r=n.merge(r,o),this.dateRender=n.merge(this.dateRender,this._dateRender),this.value=n.merge(this.value,this._value);else for(i=0;i<u;i++)this.dateRender=n.merge(this.dateRender,this._dateRender),r=n.merge(r,o),this.value=n.merge(this.value,this._value)}else r=this._getHorizontalheaderCellCount(this._culture);return r},_findResourceIndex:function(n,t,i){for(var r=0;r<n.length;r++)if(n[r][t]===i)return r},_renderHeaderAllDayTemplate:function(){var r,e,i,g,w,nt,tt,b,k,o;if(this.currentView()!="agenda")if(t.scheduleFeatures.horizontal&&this.model.orientation=="horizontal")this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._renderMultipleResourceHeaderTemplate(null,null),this._renderHorizontalHeaderBar();else{var s=t.buildTag("div.e-headerscrolldiv"),h=t.buildTag("div.e-headeralldaydiv","",{},{height:"100%"}).css({position:"relative",overflow:"hidden"}),c=0,l=t.buildTag("table.e-table e-headrealldaytable","",{},{cellspacing:"0px",cellpadding:"0px",width:"100%"}),u=t.buildTag("tbody"),d=t.buildTag("tr.e-dateheader"),f=this._getHeaderAllDayCellsCount(),o=this.headTemplate.render({cols:f,view:this.currentView(),colspan:1});this._tempResource.length!=0&&t.scheduleFeatures.resources&&(u=this._renderMultipleResourceHeaderTemplate(u,f),c=t.isNullOrUndefined(this.model.group)?0:this._grouping.length,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(c=0));var a=t.buildTag("div.e-navigate","",{},{}),v=t.buildTag("table.e-table e-headertable","",{},{cellspacing:"0px",cellpadding:"0px"}),y=t.buildTag("tbody"),p=t.buildTag("tr.e-headertr");for(headTrCount=this.currentView()=="month"||this._isCustomMonthView()?1:2,r=c+headTrCount,e=[],i=0;i<r;i++)this.currentView()=="month"||this._isCustomMonthView()?e.push({tdClass:i==r-1?"e-monthleftcells":"e-resourceleftindentcells",divClass:i==r-1?"e-dateheadercell":""}):e.push({tdClass:i==r-1?"e-leftindent":i==r-2?"e-settingsindent":"e-resourceleftindentcells",divClass:i==r-1?"e-schedulesettings e-textellipsis":i==r-2?"e-dateheadercell":""});this.model.showAllDayRow||new t.DataManager(e).remove("tdClass","e-leftindent");g=this.leftIndent.render({trs:e});this.model.timeScale.enable?this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td.e-empty").addClass(this.currentView()=="month"||this._isCustomMonthView()?"e-monthempty":"").append(g)).append(t.buildTag("td").append(s.append(h.append(l.append(u.append(d.append(o))))))).append(t.buildTag("td.e-emptyscrolltd","",{},{width:this.currentView()=="month"||this._isCustomMonthView()?"0px":this._mediaQuery?"0px":"18px"}))))))):this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td").append(s.append(h.append(l.append(u.append(d.append(o))))))).append(t.buildTag("td.e-emptyscrolltd","",{},{width:this.currentView()=="month"||this._isCustomMonthView()?"0px":this._mediaQuery?"0px":"18px"})))))));this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable&&this.model.showAllDayRow&&(w=t.isNullOrUndefined(this.model.allDayCellsTemplateId)?!1:!0,w&&(nt=this._getUserAllDayCellsTemplate()),tt=this.alldayTemp.render({cols:f,colspan:1,userTemp:w,userHtml:nt}),u.append(t.buildTag("tr").append(tt)))}else{var a=t.buildTag("div.e-navigate","",{},{}),v=t.buildTag("table.e-table e-headertable","",{},{cellspacing:"0px",cellpadding:"0px"}),y=t.buildTag("tbody"),p=t.buildTag("tr.e-headertr"),s=t.buildTag("div.e-headerscrolldiv"),h=t.buildTag("div.e-headeralldaydiv","",{},{height:"100%"}).css({position:"relative",overflow:"hidden"}),l=t.buildTag("table.e-table e-headrealldaytable","",{},{cellspacing:"0px",cellpadding:"0px",width:"100%"}),u=t.buildTag("tbody tr"),f=[{headertext:this._getLocalizedLabels("Date"),className:"e-datecolumn"},{headertext:this._getLocalizedLabels("Time"),className:"e-timecolumn"},{headertext:this._getLocalizedLabels("Event"),className:"e-eventcolumn"}];if(this._tempResource.length!=0&&t.scheduleFeatures.resources){for(this._renderMultipleResourceHeaderTemplate(null,null),b=[],k=0;k<this.render_Resources.length;k++)b.push({headertext:"",className:"e-resourcecolumn"});t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0||(f=n.merge(b,f))}o=this.agendaheadTemplate.render({cols:f});this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td").append(s.append(h.append(l.append(u.append(o)))))).append(t.buildTag("td.e-emptyscrolltd","",{},{width:"18px"})))))))}t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderAllDayTemplate")},_getDateTime:function(n){var t=n,r,i;return(this._cellIndex=this.model.timeScale.enable?t.is(".e-workcells, .e-alldaycells")||this._isCustomMonthView()&&this._oneWeek?t.index():7-((parseInt(t.index()/7)+1)*7-t.index())+t.parent().index()*7:this.model.orientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?7-((parseInt(t.index()/7)+1)*7-t.index())+t.parent().index()*7:t.index(),this.model.orientation=="horizontal"&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):this._cellIndex:t.index(),this._workCellIndex=t.parent().index()),r=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this._resWorkWeek?this._dateRender:this.dateRender:this._dateRender,r=this.model.orientation=="horizontal"&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r,i=new Date(r[this._cellIndex]),this.model.minDate>i||this.model.maxDate<i)?!1:(t.hasClass("e-workcells")&&this.model.showTimeScale&&this.currentView()!=="month"&&!this._isCustomMonthView()?this._calcCurrentTime(i,t,""):(this.cur_StartTime=new Date(new Date(i).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(i).setHours(23,59,59))),t.hasClass("e-horizontmonthheaderdaytd")?{startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,currentDate:i,cellIndex:this._cellIndex,currentDate:i}:{startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,currentDate:i,cellIndex:this._cellIndex,currentDate:i,resources:this._tempResource.length!=0?this._getResourceValue(t,this._cellIndex):null})},_getAgendaAppointment:function(i){var r=[],o,u,f,s,e;if(i.hasClass("e-datecolumn")){if(o=n(i).attr("rowspan"),u=n(i).parent().nextAll("tr").andSelf().slice(0,parseInt(o)),u.length>0)for(f=0;f<u.length;f++)s=n(u[f]).find(".e-eventcolumn .e-agendaappointment").attr("guid"),r.push(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,s))[0])}else r=i.hasClass("e-agendaappointment")?i:i.parent().find(".e-agendaappointment"),e=r.attr("guid"),this._mediaQuery&&(this._mAppId=e),r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,e));return r},_monthdates:function(){var t=new Date(this.currentDate()),u=t._currentMonthDates(),i=u.start._currentWeekDates(this._firstdayofweek).start,o=u.end._currentWeekDates(this._firstdayofweek).end,r=[],f,n,e;this.monthDays=[];f=this._getWeekDays();n=new Date(i.getFullYear(),i.getMonth(),i.getDate());do this.model.showWeekend?(r.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()),new Date(t).getMonth()===new Date(n).getMonth()&&this.monthDays.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime())):(e=f.indexOf(new Date(n).getDay()),e!=-1&&(r.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()),new Date(t).getMonth()===new Date(n).getMonth()&&this.monthDays.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()))),n.setDate(n.getDate()+1);while(n.getTime()<=o.getTime());return this.model.orientation=="vertical"?r:this.monthDays},_getStartEndTime:function(){var i=[],f,u,e,o,r,n;if(this._timeInitial=0,u=this._culture.calendar,this.model.orientation==="vertical")if(this.currentView()=="month"||this._isCustomMonthView())for(e=this._dateRender.length,o=this.model.showWeekend?7:this.model.workWeek.length,n=0;n<e/o;n++)i.push(n);else if(t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId))for(r=new Date((new Date).setHours(0,0,0,0)),n=this.model.startHour*60;n<this.model.endHour*60;)this._timeMode=="12"?new Date(new Date(r).setHours(this.model.endHour,0,0,0)).getTime()>new Date(new Date(r).setHours(0,n,0,0)).getTime()&&(f=(n/60===this.model.startHour||n/60==12)&&u.AM&&u.PM?t.format(new Date(new Date(r).setHours(0,n,0,0)),"hh tt",this.model.locale):t.format(new Date(new Date(r).setHours(0,n,0,0)),"hh mm",this.model.locale),i.push({time:f,id:n/60})):i.push({time:new Date(new Date(r).setHours(0,n,0,0)).toTimeString().slice(0,5)+" 00"}),n=n+this.model.timeScale.majorSlot;else i=this._getUserTimeCellsTemplate();else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(i=this._getHoriStartEndTime(u));return i},_getWorkCellsCount:function(){var t=[],u=this.model.showWeekend?7:this.model.workWeek.length,f,r,i,n;if(this.model.timeScale.enable)if(this.currentView()=="month"||this._isCustomMonthView())for(i=this._dateRender.length,n=0;n<i/u;n++)t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});else for(f=this._getStartEndTime(),r=0,n=0;n<this.model.timeScale.minorSlotCount*f.length;n++)if(r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,r>(this.model.endHour-this.model.startHour)*60){t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});break}else t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});else for(i=this._resWorkWeek?1:this._dateRender.length,n=0;n<i/u;n++)t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});return t},_renderContentAreaTemplate:function(){var n=t.buildTag("div.e-workareadiv"),i=t.buildTag("table.e-table e-worktable","",{},{height:"100%",cellpadding:"0px",cellspacing:"0px",width:"100%"}),r=t.buildTag("tbody"),u=t.buildTag("tr"),f=t.buildTag("td"),e=t.buildTag("div#"+this._id+"_scroller"),c,v;if(this.$WorkCellDiv=t.buildTag("div.e-draggableworkarea").attr({width:"100%",height:"100%"}),this.currentView()!="agenda")if(t.scheduleFeatures.horizontal&&this.model.orientation=="horizontal")this._renderHorizontalContent(n,i,r,u,f,e);else{this.$TimeCellTD=t.buildTag("td","",{},{}).addClass(this.currentView()=="month"||this._isCustomMonthView()?"e-monthleftindent":"e-workleftindent");var l,a,o=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,s=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,y=this.currentView()=="month"||this._isCustomMonthView()?1:0,h=this._timeSlotCount(o,s);(o||s)&&this.currentView()!="month"&&!this._isCustomMonthView()?(h.columnCount.pop(),l=this.userTimeCellTemplate.render({timerows:this._getStartEndTime(),cols1:h.columnCount,viewclass:y,timeScale:this.model.timeScale.minorSlotCount,cheight:this.model.cellHeight,userTemplateId:o,timeValue1:h.timeValue1,template:s})):l=this.timeCellTemplate.render({timerows:this._getStartEndTime(),cols1:h.columnCount,viewclass:y,timeScale:this.model.timeScale.minorSlotCount,userTemplateId:o,template:s});c=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0;c&&(v=this._getUserWorkCellsTemplate());a=this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?this.workcellTemp.render({cellrows:this._getWorkCellsCount(),cols1:this.value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:c,userHtml:v}):this.monthcellTemp.render({cellrows:this._getWorkCellsCount(),cols1:this.value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:c,userHtml:v});this.model.timeScale.enable?this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(this.$TimeCellTD.append(l)).append(f.append(e.append(this.$WorkCellDiv.append(a))))))))):this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(a)))))))))}else this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv))))))));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderContentAreaTemplate")},_renderQueryCellInfo:function(i,r,u){var it,h,a,v,ft,et,p,st,ht,w,nt,tt,o,f,e,s;if(i=="renderHeaderBar"&&this._trigger("queryCellInfo",{element:u,requestType:"headerBar"}),i=="appointment"&&this._trigger("queryCellInfo",{appointment:r,element:u,requestType:"appointment"}),i=="blockAppointment"&&this._trigger("queryCellInfo",{appointment:r,element:u,requestType:"blockoutCells"}),i=="emptycell"&&(it=this.aTR.find(".e-emptyscrolltd"),this._trigger("queryCellInfo",{element:n(it[0]),requestType:"emptytd"})),i=="renderAgendaContent"){for(h=this.aTR.find(".e-headercells"),f=0;f<h.length;f++)this._trigger("queryCellInfo",{element:n(h[f]),cellType:"agendaheadercells",requestType:"agendacells"});var b=this.element.find(".e-draggableworkarea").find(".e-datecolumn"),k=this.element.find(".e-draggableworkarea").find(".e-timecolumn"),d=this.element.find(".e-draggableworkarea").find(".e-eventcolumn");if(this._tempResource.length!=0)for(a=this.element.find(".e-draggableworkarea").find(".e-resourcecolumn"),f=0;f<a.length;f++)e=this._getAgendaAppointment(n(a[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(a[f]),cellType:"agendaresourcecell",requestType:"agendacells"});for(f=0;f<b.length;f++)e=this._getAgendaAppointment(n(b[f])),this._trigger("queryCellInfo",{currentAppointmentDate:new Date(new Date(e[0][this._appointmentSettings.startTime]).setHours(0,0,0)),appointments:e,element:n(b[f]),cellType:"agendadatecell",requestType:"agendacells"});for(f=0;f<k.length;f++)e=this._getAgendaAppointment(n(k[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(k[f]),cellType:"agendatimecell",requestType:"agendacells"});for(f=0;f<d.length;f++)e=this._getAgendaAppointment(n(d[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(d[f]),cellType:"agendaeventcell",requestType:"agendacells"})}else if(i=="renderHeaderAllDayTemplate")if(this.model.orientation=="vertical"){var h=this.aTR.find(".e-headercells"),rt=this.res1,ut=this._getHeaderAllDayCellsCount();if(this.res1=rt,this.model.showAllDayRow)for(v=this.aTR.find(".e-alldaycells"),f=0;f<v.length;f++)e=this._getDateTime(n(v[f])),s={cellIndex:e.cellIndex,currentDate:e.currentDate,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(v[f]),requestType:"alldaycells"});if(this.currentView()!="agenda")for(ft=h.length/this.res1.length,f=0;f<h.length;f++)et=Math.floor(f/ft),this._trigger("queryCellInfo",{resource:this.res1[et],currentDay:ut[f].currentDay,element:n(h[f]),requestType:"headercells"});if(this._tempResource.length!=0){var y=[],c=this.aTR.find(".e-resourcecells"),ot=this.aTR.find(".e-resourceleftindentcells");for(p=0;p<this._tempResource.length;p++)n.merge(y,this._tempResource[p].resourceSettings.dataSource);for(f=0;f<c.length;f++)this._trigger("queryCellInfo",{resource:y[f],element:n(c[f]),cellType:"headercells",requestType:"resourceheadercells"});for(f=0;f<ot.length;f++)this._trigger("queryCellInfo",{element:n(ot[f]),cellType:"headerdivcells",requestType:"resourceheadercells"})}this.currentView()=="month"&&this._isCustomMonthView()||(st=this.aTR.find(".e-leftindent"),this._trigger("queryCellInfo",{element:st,requestType:"leftindentcells"}));ht=this.currentView()=="month"||this._isCustomMonthView()?this.aTR.find(".e-monthleftcells"):this.aTR.find(".e-settingsindent");this._trigger("queryCellInfo",{element:ht,requestType:"leftheadercells"})}else{var ct=this.aTR.find(".e-headercells"),rt=this.res1,ut=this._getHeaderAllDayCellsCount();this.res1=rt;var lt=this.aTR.find(".e-horizontaltimetd "),l=this.aTR.find(".e-horizontalalternatetd"),g=this._getStartEndTime();for(f=0;f<lt.length;f++)this._trigger("queryCellInfo",{cell:g[f],element:n(lt[f]),cellType:"timecell",requestType:"timecells"});for(f=0;f<l.length;f++)this._trigger("queryCellInfo",{element:n(l[f]),cellType:"timeampmcell",requestType:"timecells"});if(this.currentView()!="agenda")for(f=0;f<ct.length;f++)this._trigger("queryCellInfo",{currentDay:ut[f].currentDay,element:n(ct[f]),requestType:"headercells"});for(w=this.aTR.find(".e-horizontmonthheaderdaytd"),f=0;f<w.length;f++)e=this._getDateTime(n(w[f])),s={cellIndex:e.cellIndex,currentDate:e.currentDate},this._trigger("queryCellInfo",{cell:s,element:n(w[f]),requestType:"headerdate"});if(this._tempResource.length!=0)for(nt=this.aTR.find(".e-horizontalheader"),f=0;f<nt.length;f++)this._trigger("queryCellInfo",{element:n(nt[f]),requestType:"resourcegroupheader"})}else if(i=="renderContentAreaTemplate")if(this.model.orientation=="vertical"){for(l=this.wTR.find(".e-timecelldivs"),timeCellAMPM=this.wTR.find(".e-ampmdisplay"),g=this._getStartEndTime(),this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(o=this.wTR.find(".e-workcells"),tt="workcells"):(o=this.wTR.find(".e-monthcells"),tt="monthcells"),f=0;f<l.length;f++)this._trigger("queryCellInfo",{cell:g[f],element:n(l[f]).parent(),cellType:"timecell",requestType:"timecells"});for(f=0;f<timeCellAMPM.length;f++)this._trigger("queryCellInfo",{element:n(timeCellAMPM[f]),cellType:"timeampmcell",requestType:"timecells"});for(f=0;f<o.length;f++)e=this._getDateTime(n(o[f])),s=this.currentView()!="month"&&this.currentView()!="customview"&&this.model.timeScale.enable?{cellIndex:e.cellIndex,startTime:e.startTime,endTime:e.endTime,resources:e.resources}:{cellIndex:e.cellIndex,currentDate:e.currentDate,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(o[f]),requestType:tt})}else{if(o=t.isNullOrUndefined(this.$WorkCellDiv)?null:this.$WorkCellDiv.find(".e-workcells"),this._tempResource.length!=0&&!t.isNullOrUndefined(this.$WorkCellDiv)){var c=this.$WorkCellDiv.find(".e-resourceheadercells"),y=this._resourceSort(),at=this.wTR.find(".e-horizontresheaderdiv");for(f=0;f<at.length;f++)this._trigger("queryCellInfo",{resource:y[n(c[f]).index()],element:n(at[f]),cellType:"headerdivcells",requestType:"resourceheadercells"});for(f=0;f<c.length;f++)this._trigger("queryCellInfo",{resource:y[n(n(c[f]).parent()).index()],element:n(c[f]),cellType:"headercells",requestType:"resourceheadercells"})}if(!t.isNullOrUndefined(o))for(f=0;f<o.length;f++)n(o[f]).hasClass("e-childworkcell")&&n(o[f]).hasClass("e-workcells")&&(e=this._getDateTime(n(o[f])),s={cellIndex:e.cellIndex,startTime:e.startTime,endTime:e.endTime,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(o[f]),requestType:"workcells"}))}},_timeSlotCount:function(i,r){var e=0,o=[],a=[],h,v,f,c,u,l;if((i||r)&&this.currentView()!=="month"&&!this._isCustomMonthView()){for(u=0;u<this.model.timeScale.minorSlotCount;u++)o.push(u);c=o}else{for(h=this._getStartEndTime(),v=this.model.orientation=="vertical"?this.model.timeScale.minorSlotCount:this.model.timeScale.minorSlotCount-1,f=0;f<h.length;f++){for(u=0;u<v;u++)if(e=e+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,e>(this.model.endHour-this.model.startHour)*60){if(o.push(u),u==this.model.timeScale.minorslotcount-2){e=0;break}}else o.push(u);a.push(o);e=e+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;o=[]}c=a}if((i||r)&&this.currentView()!=="month"&&!this._isCustomMonthView()){var y=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),p=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),w=[],f=0;for(u=this.model.startHour;u<this.model.endHour;){for(var s=[],e=this.model.timeScale.majorSlot+f,b=f;f<e;)l=f,f=f*6e4,this._timeMode=="12"?l!=b||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?s.push(y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):s.push(p.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):l!=b||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?s.push(y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):s.push(p.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()),f=f/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:f>=60?u+1:u;f=f>=60?0:f;w.push(s)}r=!0}return{columnCount:c,timeValue1:w,strTime:h}},_renderAgendaContent:function(){var l,o,e,h,y,tt,p,it,pt,s,wt,bt,f,i,gt,u,n,a,v,c,rt;this.element.find(".e-agendacellstab").remove();var r=new Date(new Date(this.currentDate()).setHours(0,0,0,0)),w=[],ut=[],ft,et,ot,st,ht,b,ct,k,lt,d,at,g,vt,nt,yt;for(this.model.group||(this.res1=["0"]),l=this._getLocalizedLabels("Recurrence"),o=this._getAgendaDateCount(),e=0;e<this.res1.length;e++)if(f=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(r).setDate(r.getDate()+o)).setHours(23,59,59))),f=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?f.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.id]):f,h=new t.DataManager(this._processed).executeLocal((new t.Query).where(f)),h=this._appointmentSort(h),h.length>0){if(y=[],!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources){for(tt=this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.groupId],u=this._resCollection,n=u.length-1;n>0;n--)p=new t.DataManager(u[n-1].dataSource).executeLocal((new t.Query).where(u[n-1].id,t.FilterOperators.equal,tt)),y.push({resId:"resLevel_"+n+"_"+p[0][u[n-1].id],text:p[0][u[n-1].text]}),tt=p[0][u[n-1].groupId];y.reverse()}for(it=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?!0:!1,pt=h.length,nt=this.model.resourceHeaderTemplateId?!0:!1,yt=nt?this._getResourceHeadTemplate(this.res1[e]):"",s=0,new Date(r)<this.model.minDate&&(s=Math.floor((new Date(this.model.minDate)-new Date(r))/864e5)),new Date(new Date(r).setDate(r.getDate()+o))>this.model.maxDate&&(o=o-Math.floor((new Date(new Date(r).setDate(r.getDate()+o))-new Date(this.model.maxDate))/864e5));s<=o;s++)if((this.model.showWeekend||(wt=this._getWeekDays(),bt=new Date(new Date(r).setDate(r.getDate()+s)),wt.indexOf(bt.getDay())!=-1))&&(f=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(r).setDate(r.getDate()+s))).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(r).setDate(r.getDate()+s)).setHours(23,59,59))),f=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?f.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.id]):f,i=new t.DataManager(h).executeLocal((new t.Query).where(f)),i.length>0)){w.push(w.length+1);var ni=i.length,kt=!0,dt=!1;for(n=0;n<i.length;n++)n==i.length-1&&(dt=!0),ft=this._timeMode=="12"?t.format(i[n][this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[n][this._appointmentSettings.startTime],"HH:mm",this.model.locale),et=this._timeMode=="12"?t.format(i[n][this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[n][this._appointmentSettings.endTime],"HH:mm",this.model.locale),ot="<strong class='e-agendaday'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"dd",this.model.locale)+"<\/strong><span class='e-agendaweek'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"dddd",this.model.locale)+"<\/span><span class='e-agendamonth'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"MMM, yyyy",this.model.locale)+"<\/span>",st=!t.isNullOrUndefined(i[n][this._appointmentSettings.allDay])&&JSON.parse(i[n][this._appointmentSettings.allDay])?"<div class='e-icon e-circle e-scheduleallday'><\/div>"+this._getLocalizedLabels("AllDay"):ft+" - "+et,ht=!t.isNullOrUndefined(i[n][this._appointmentSettings.recurrence])&&JSON.parse(i[n][this._appointmentSettings.recurrence])?i[n][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?"<span class='e-icon e-schedulerepeatedit' title='"+l+"'/>"+i[n][this._appointmentSettings.subject]:"<span class='e-icon e-schedulerepeat' title='"+l+"'/>"+i[n][this._appointmentSettings.subject]:i[n][this._appointmentSettings.subject],b=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(i[n][this._appointmentSettings.categorize])&&i[n][this._appointmentSettings.categorize]!=""?this._getCategorizeColor(i[n]):this._tempResource.length!=0&&t.scheduleFeatures.resources?this._getResourceColor(i[n]):{appointData:"",appointCustomcss:"",appointtextcolor:""},ct=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&this._tempResource.length!=0?this.res1[e][this._tempResource[this._tempResource.length-1].resourceSettings.text]:"",k=this.model.appointmentTemplateId?!0:!1,lt=k?i[n][this._appointmentSettings.recurrence]?i[n][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?"<span class='e-icon e-schedulerepeatedit' title='"+l+"'/>"+this._getUserAppointmentTemplate(i[n]):"<span class='e-icon e-schedulerepeat' title='"+l+"'/>"+this._getUserAppointmentTemplate(i[n]):this._getUserAppointmentTemplate(i[n]):"",d=this.model.agendaViewSettings.dateColumnTemplateId?!0:!1,at=d?this._getUserTemplate(this.model.agendaViewSettings.dateColumnTemplateId,i[n]):"",g=this.model.agendaViewSettings.timeColumnTemplateId?!0:!1,vt=g?this._getUserTemplate(this.model.agendaViewSettings.timeColumnTemplateId,i[n]):"",ut.push({readOnly:this.model.readOnly,edittext:this._getLocalizedLabels("Edit"),deletetext:this._getLocalizedLabels("Delete"),userResourceId:nt,userResourceHtml:yt,userDateId:d,userDateHtml:at,userTimeId:g,userTimeHtml:vt,userAppTemplId:k,userTemplate:lt,resGroup:y,resName:ct,resChild:it,resRowSpan:pt,id:i[n].AppTaskId,uid:i[n].Guid,dayRowSpan:i.length,dayChild:kt,dayBorderBottom:dt,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!b.applyFilter?!0:!1,background:b.appointData,date:ot,time:st,event:ht}),kt=!1,it=!1}}if(gt=this.agendacellTemp.render({rows:w,cols:ut}),this.element.find(".e-draggableworkarea").append(gt),!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(u=this.render_Resources,n=0;n<u.length-1;n++)for(a=0;a<u[n].length;a++)v="resLevel_"+(n+1)+"_"+u[n][a][this._resCollection[n].id],this.element.find("."+v).first().attr("rowspan",this.element.find("."+v).length),this.element.find("."+v).slice(1).addClass("e-hide"),this.element.find(".e-hide").remove(),this.model.resourceHeaderTemplateId&&this.element.find("."+v).children().empty().append(this._getResourceHeadTemplate(u[n][a]));c=this.element.find("div#"+this._id+"_scroller");t.isNullOrUndefined(c.data("ejScroller"))&&(c.ejScroller({enableRTL:this.model.enableRTL,height:this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top)-1,width:parseInt(this.element.width())-2,cssClass:this.model.cssClass}),this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator));c.ejScroller("refresh");rt=this.model.enableRTL?"e-borderright":"e-borderleft";c.ejScroller("isVScroll")?this.element.find(".e-emptyscrolltd").addClass(rt).show()&&this.element.find(".e-draggableworkarea").height(this.element.find(".e-draggableworkarea").height()+1):this.element.find(".e-emptyscrolltd").removeClass(rt).hide();this.element.find(".e-vscroll").css("left",this.model.enableRTL?0:this.element.outerWidth()-(c.ejScroller("isVScroll")?19:0));this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width());this.model.showAppointmentNavigator&&this._nextPrevButton();t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderAgendaContent")},_getUserTemplate:function(t,i){var r=n.extend(r,i);return r.View=this.currentView(),n.templates(n(t).html()).render(r)},_getColumnCount:function(){for(var t=[],i=this.currentView()==="month"||this._isCustomMonthView()?this._isCustomMonthView()?this._renderDays<=7?this._renderDays:this.model.showWeekend?7:this.model.workWeek.length:this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length,n=0;n<i;n++)t.push(n);return t},_bindAppointmentsData:function(i){if(t.isNullOrUndefined(this.model.appointmentSettings)||this.dataSource()==null)this.model.showAppointmentNavigator&&this._nextPrevButton();else if(this.model.enablePersistence&&(this.model.appointmentSettings.query=new t.Query,this._enablePersist=!0),!this.dataSource()instanceof t.DataManager&&this.dataSource().dataSource.offline&&this._dateFormat(this.dataSource()),this.dataSource()instanceof t.DataManager&&!this.dataSource().dataSource.offline)this._initDataSource(i);else{this._bindAppointments=this.dataSource().length>0?!0:!1;var r=i=="Refresh"?!1:this._viewchange;this._angular=this._bindAppointments&&!this._bindapp&&!this._setmodelvalue&&r==!0&&this._obj.length>0&&this.dataSource()[0][this._appointmentSettings.id]==this._obj[0][this._appointmentSettings.id];this._true=this.model.isDST==!0?!0:!1;this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&this.model.isDST==!1?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0;this._currentAppointmentData=this.dataSource();n.extend(!0,this._obj=[],this.dataSource());!t.isNullOrUndefined(this.dataSource().dataSource)&&this.dataSource().dataSource.json&&(this._currentAppointmentData=this.dataSource().dataSource.json);this._dataCount=this._currentAppointmentData.length;this._dataCount>0&&(this._dataProcessing(this._currentAppointmentData),this.element.children().length>0&&this._renderAppointmentAll());this.model.showAppointmentNavigator&&this._nextPrevButton();this.tzone=this.model.timeZone;this._bindapp=!1;this._setmodelvalue=!1;this._viewchange=!1}},_initDataSource:function(i){var e=this._columnToSelect(this.model.appointmentSettings,i),f=n.extend(!0,[],e._params),o,s,u,r,h;for(this._true=this.model.isDST==!0?!0:!1,this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&this.model.isDST==!1?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0,e._params=[],o=new Date(new Date(this.currentDate()).setHours(0,0,0)),s=new Date(o.getTime()+-this._timeZoneCalculate()*6e4),e.addParams("CurrentDate",s).addParams("CurrentView",this.currentView()).addParams("CurrentAction",i),u=0;u<f.length;u++)f[u].key!="CurrentDate"&&f[u].key!="CurrentView"&&f[u].key!="CurrentAction"&&e.addParams(f[u].key,f[u].value);r=this;h=this.dataSource().executeQuery(e);h.done(function(n){r._dataCount=n.result.length;t.isNullOrUndefined(n.result.result)||(r._dataCount=n.result.count+1,n.result=n.result.result);r._bindAppointments=n.result.length>0?!0:!1;r._currentAppointmentData=n.result;r._dataProcessing(n.result);r._renderAppointmentAll();r.model.showAppointmentNavigator&&r._nextPrevButton()});this.model.showAppointmentNavigator&&this._nextPrevButton()},_bindCategorizeData:function(){t.isNullOrUndefined(this.model.categorizeSettings)||(this._categoryInfo=[],!t.isNullOrUndefined(this.model.categorizeSettings.query)&&this.model.categorizeSettings.query instanceof t.Query||(this.model.categorizeSettings.query=t.Query()),this.model.categorizeSettings.dataSource instanceof t.DataManager?this._initCategorizeData(this.model.categorizeSettings):this._categoryInfo.push(this.model.categorizeSettings))},_initCategorizeData:function(n){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){t.isNullOrUndefined(i._appointmentAddWindow)&&i._renderAppointmentWindow();n.dataSource=r.result;i._categoryInfo.push(n);i._renderCategoryItems(i._appointmentAddWindow)})},_bindPriorityData:function(){t.isNullOrUndefined(this.model.prioritySettings)||(this._priorityInfo=[],!t.isNullOrUndefined(this.model.prioritySettings.query)&&this.model.prioritySettings.query instanceof t.Query||(this.model.prioritySettings.query=t.Query()),this.model.prioritySettings.dataSource instanceof t.DataManager?this._initPriorityData(this.model.prioritySettings):this._priorityInfo.push(this.model.prioritySettings))},_initPriorityData:function(n){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){t.isNullOrUndefined(i._appointmentAddWindow)&&i._renderAppointmentWindow();n.dataSource=r.result;i._priorityInfo.push(n);i._renderPriorityItems(i._appointmentAddWindow)})},_bindBlockData:function(){if(!t.isNullOrUndefined(this.model.blockoutSettings)&&(!t.isNullOrUndefined(this.model.blockoutSettings.query)&&this.model.blockoutSettings.query instanceof t.Query||(this.model.blockoutSettings.query=t.Query()),this.model.blockoutSettings.dataSource instanceof t.DataManager)){var i=this._columnToSelect(this.model.blockoutSettings),n=this,r=this.model.blockoutSettings.dataSource.executeQuery(i);r.done(function(t){n.model.blockoutSettings.dataSource=t.result;n._renderBlockAppointments()})}},_dateFormat:function(n){if(n.length>0&&new Date(n[0][this._appointmentSettings.startTime]).toString()=="Invalid Date")for(var t=0,i=n.length;t<i;t++)n[t][this._appointmentSettings.startTime]=(new Date).parseISO8601(n[t][this._appointmentSettings.startTime]),n[t][this._appointmentSettings.endTime]=(new Date).parseISO8601(n[t][this._appointmentSettings.endTime])},_columnToSelect:function(n){var i=t.Query();return t.isNullOrUndefined(n.tableName)||this.dataSource().dataSource.url.match(n.tableName+"$")?i=n.query:(i=n.query,i.from(n.tableName)),i},_getColumns:function(n){var r=[];for(var i in n)i!=="tableName"&&i!=="query"&&i!=="dataSource"&&(t.isNullOrUndefined(n[i])||r.push(n[i]));return r},_sortAppById:function(n){return n.sort(function(n,t){var i=n.AppTaskId,r=t.AppTaskId;return i<r?-1:i>r?1:0}),n},_stdTimezoneOffset:function(){return Math.max(new Date((new Date).getFullYear(),0,1).getTimezoneOffset(),new Date((new Date).getFullYear(),6,1).getTimezoneOffset())},_timeZoneCalculate:function(){var i,r,u,o,s,f,h,c,l,e=(new Date).toString().indexOf("Daylight Time")!=-1&&this.model.isDST==!1?-(new Date).getTimezoneOffset()-this._timeZoneOffset:-(new Date).getTimezoneOffset();return i=e,t.isNullOrUndefined(this.model.timeZone)||(this.model.timeZone.indexOf(":")!==-1?(t.isNullOrUndefined(this.tzone)&&(this.tzone=this.model.timeZone),r=this.model.timeZone.split(" ")[this.model.timeZone.split(" ").length-1].split(":"),u=this.tzone.split(" ")[this.tzone.split(" ").length-1].split(":"),n.isNumeric(parseInt(r[0]))&&parseInt(r[0]).toString.length<=2||r[0].indexOf("UTC")!==-1?(o=this.model.timeZone.indexOf("-")!==-1?-parseInt(r[0].replace(/\D/g,"")):parseInt(r[0].replace(/\D/g,"")),s=parseInt(r[1]),f=-(o*60+s),this._setmodelvalue==!0?this.tzone==this.model.timeZone?i=-(-e+f):(h=this.tzone.indexOf("-")!==-1?-parseInt(u[0].replace(/\D/g,"")):parseInt(u[0].replace(/\D/g,"")),c=parseInt(u[1]),l=-(h*60+c),i=-(-l+f)):i=-f):i=-e):i=-e),i},_timeZoneAppointments:function(i,r){if(this.model.appointmentSettings.applyTimeOffset){var o,s,u,f,e;if(i[this._appointmentSettings.allDay])i[this._appointmentSettings.startTime]=new Date(i[this._appointmentSettings.startTime]),i[this._appointmentSettings.endTime]=new Date(i[this._appointmentSettings.endTime]);else return t.isNullOrUndefined(this._dayLight)?(u=i[this._appointmentSettings.startTimeZone],f=i[this._appointmentSettings.endTimeZone],t.isNullOrUndefined(f)&&!t.isNullOrUndefined(u)&&(i[this._appointmentSettings.endTimeZone]=f=u),!t.isNullOrUndefined(f)&&t.isNullOrUndefined(u)&&(i[this._appointmentSettings.startTimeZone]=u=f),t.isNullOrUndefined(u)||t.isNullOrUndefined(f)||(u=u.indexOf("UTC")!=-1?parseInt(u.split(" ")[1].split(":")[0])*60+parseInt(u.split(" ")[1].split(":")[1]):parseInt(u.split(":")[0])*60+parseInt(u.split(":")[1]),f=f.indexOf("UTC")!=-1?parseInt(f.split(" ")[1].split(":")[0])*60+parseInt(f.split(" ")[1].split(":")[1]):parseInt(f.split(":")[0])*60+parseInt(f.split(":")[1])),e=t.isNullOrUndefined(u)&&!n.isNumeric(u)?this._timeZoneCalculate(i):u-this._timeZoneCalculate(i)):e=this._timeValue,e=r==""?-e:e,o=new Date(i[this._appointmentSettings.startTime]),s=new Date(i[this._appointmentSettings.endTime]),i[this._appointmentSettings.allDay]&&Math.round((new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5)<24?i:(i[this._appointmentSettings.startTime]=new Date(o.setMinutes(o.getMinutes()+e)),i[this._appointmentSettings.endTime]=new Date(s.setMinutes(s.getMinutes()+e)),i);return i}return i},_processtimeZone:function(n){var t=new Date(n[this.model.blockoutSettings.startTime]),i=new Date(n[this.model.blockoutSettings.endTime]),r;return n[this.model.blockoutSettings.isAllDay]?(n[this.model.blockoutSettings.startTime]=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n[this.model.blockoutSettings.endTime]=new Date(i.getFullYear(),i.getMonth(),i.getDate(),23,59,59)):(r=this._timeZoneCalculate(n),n[this.model.blockoutSettings.startTime]=new Date(t.setMinutes(t.getMinutes()+r)),n[this.model.blockoutSettings.endTime]=new Date(i.setMinutes(i.getMinutes()+r))),n},_dataProcessing:function(n){var u,i,r;if(this._processed=[],this._appMainId=null,n.length>0){for(u=this._sortAppById(n),this._maxId=t.isNullOrUndefined(n[0])||t.isNullOrUndefined(n[0].AppTaskId)?1:n[0].AppTaskId,i=0;i<n.length;i++)n[i][this._appointmentSettings.startTime]=(new Date).parseISO8601(n[i][this._appointmentSettings.startTime]),n[i][this._appointmentSettings.endTime]=(new Date).parseISO8601(n[i][this._appointmentSettings.endTime]),this._bindAppointments==!0&&!this._angular&&!this._setmodelvalue&&this._applyTimeOffset&&t.isNullOrUndefined(this._enablePersist)?(r=this._timeZoneAppointments(n[i],"reverse"),this._appointmentProcessing(r)):this._appointmentProcessing(n[i]);return this._bindAppointments=!1,this._setmodelvalue=!1,this._processed=this._sortAppById(this._processed),this._processed}},_guidFormatGenerate:function(){function n(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()},_RecurrenceAppointment:function(i){var u,e,o;t.RecurrenceEditor.prototype._initializePrivateProperties();u=t.RecurrenceEditor.prototype;u._rRule={};i.AppTaskId=t.isNullOrUndefined(i.AppTaskId)?this._maxId:i.AppTaskId;t.isNullOrUndefined(i[this._appointmentSettings.id])&&(i[this._appointmentSettings.id]=i.AppTaskId);u.model.startDate=new Date(this.currentDate());for(var c=u.recurrenceDateGenerator(i[this._appointmentSettings.recurrenceRule],i[this._appointmentSettings.startTime],i[this._appointmentSettings.recurrenceExDate]),s=0,h=c;s<h.length;){var r={},f=new Date(h[s]),l=i[this._appointmentSettings.endTime];u._rRule.freq!="MONTHLY"&&u._rRule.freq!="YEARLY"||t.isNullOrUndefined(u._rRule.setPositions)||(f=u._dayOfWeekInMonth(f,u._rRule.weekDays,u._rRule.setPositions));e=new Date(f.getFullYear(),f.getMonth(),f.getDate(),new Date(i[this._appointmentSettings.startTime]).getHours(),new Date(i[this._appointmentSettings.startTime]).getMinutes(),new Date(i[this._appointmentSettings.startTime]).getSeconds());o=new Date(new Date(e).setMilliseconds(i[this._appointmentSettings.endTime].getTime()-i[this._appointmentSettings.startTime].getTime()));this._idChecking();i[this._appointmentSettings.recurrenceId]=i[this._appointmentSettings.recurrenceId]||i[this._appointmentSettings.id]||i.AppTaskId;i.ParentId=i[this._appointmentSettings.recurrenceId];t.isNullOrUndefined(u._rRule.exDate)?r=this._addAppData(i,this._maxId,e,o,i.ParentId):u._rRule.exDate.indexOf(t.format(new Date(f),this._pattern.d,this.model.locale))==-1&&(r=this._addAppData(i,this._maxId,e,o,i.ParentId));new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.allDay]!==!0?(r.Guid=this._guidFormatGenerate(),this._multipleDayApp(r,this._maxId,r[this._appointmentSettings.startTime],o)):Math.round((r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5)>24?(r.Guid=this._guidFormatGenerate(),this._multipleSplit(r,this._maxId,r[this._appointmentSettings.startTime],r[this._appointmentSettings.endTime])):n.isEmptyObject(r)||(r.Guid=this._guidFormatGenerate(),this._processed.push(r));s++;this._maxId++}},_recurrenceAppSort:function(i){for(var e,u,f=[],r=0;r<i.length;r++)e=new t.DataManager(i).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i[r].Guid)),e.length>1?(u=n.extend(!0,[],e),u[0][this._appointmentSettings.endTime]=u[u.length-1][this._appointmentSettings.endTime],f.push(u[0]),r++):f.push(i[r]);return f},_appointmentProcessing:function(n){this._maxId=t.isNullOrUndefined(this._appMainId)?parseInt(this._maxId):parseInt(this._appMainId)+1;var i=t.RecurrenceEditor.prototype;i._rRule={};t.isNullOrUndefined(n[this._appointmentSettings.recurrence])||t.isNullOrUndefined(n[this._appointmentSettings.recurrenceRule])||i.recurrenceRuleSplit(n[this._appointmentSettings.recurrenceRule],n[this._appointmentSettings.recurrenceExDate]);n[this._appointmentSettings.recurrence]==1&&t.isNullOrUndefined(i._rRule.recurEditId)?this._RecurrenceAppointment(n):new Date(new Date(n[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(n[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(n[this._appointmentSettings.endTime]-n[this._appointmentSettings.startTime])/36e5<24&&n[this._appointmentSettings.allDay]!==!0&&(n[this._appointmentSettings.recurrence]&&!t.isNullOrUndefined(i._rRule.recurEditId)||!n[this._appointmentSettings.recurrence])?(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.id]:i._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._maxId=n.AppTaskId,this._multipleDayApp(n,this._maxId,n[this._appointmentSettings.startTime],n[this._appointmentSettings.endTime])):(n[this._appointmentSettings.endTime]-n[this._appointmentSettings.startTime])/36e5>=24?(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.id]:i._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._maxId=n.AppTaskId,this._multipleSplit(n,this._maxId,n[this._appointmentSettings.startTime],n[this._appointmentSettings.endTime])):n[this._appointmentSettings.recurrence]!=0&&t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.recurrence]!=r&&n[this._appointmentSettings.allDay]!=r||n[this._appointmentSettings.recurrence]||(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=n[this._appointmentSettings.id],n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,n.RecurrenceId=n.recurrenceExDate=null,this._processed.push(n)):(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(i._rRule.recurEditId)?n[this._appointmentSettings.id]:i._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._processed.push(n));this._appMainId=t.isNullOrUndefined(this._appMainId)||this._appMainId<this._maxId?this._maxId:this._appMainId},_idChecking:function(){for(var n,i,r=0;r<this._currentAppointmentData.length;r++)if(n=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._maxId),i=new t.DataManager(this._currentAppointmentData).executeLocal(n),i.length==0){this._maxId;break}else this._maxId++;for(;;)if(n=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._maxId),i=new t.DataManager(this._processed).executeLocal(n),i.length==0){this._maxId;break}else this._maxId++;return this._maxId},_getTotalDays:function(n,t){var u=this._getWeekDays(),i=new Date(n),r=0;do r=u.indexOf(i.getDay())!=-1?r+1:r,i=new Date(new Date(i).getTime()+864e5);while(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()<=new Date(t).getTime());return r},_getPrevNextDateCount:function(n,t){for(var u=this._getWeekDays(),i=new Date(n),r=0;u.indexOf(i.getDay())<0;)i=t=="next"?new Date(new Date(i).getTime()+864e5):new Date(new Date(i).getTime()-864e5),r++;return r},_multipleDayApp:function(n,t,i,r){r.getHours()==0&&r.getMinutes()==0&&(r=new Date(r.getTime()-1e3));var f=new Date(i),u=new Date(r);for((this.model.orientation=="vertical"||this.model.orientation=="horizontal"&&(i<new Date(this._dateRender[0])||r>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))))&&(u=new Date(new Date(i).setHours(23,59,59)));f>=new Date(i)&&f<=u&&u<=new Date(r);)this._processed.push(this._addAppData(n,t,f,u,n.ParentId)),f=new Date(new Date(u).setHours(24,0,0)),u=n[this._appointmentSettings.endTime],this._maxId=t=this._idChecking()},_multipleSplit:function(t,i,r,u){var s,f,a,h,o,v,c,l,e,y;if(r=new Date(r),this.currentView()=="workweek"&&!this._resWorkWeek&&n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)==-1){for(s=1;s<this._dateRender.length;s++)if(n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()+s).getTime(),this._dateRender)>=0){c=n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()+s).getTime(),this._dateRender);r=new Date(this._dateRender[c]);break}this.currentView()!="workweek"||this._resWorkWeek||this.model.orientation!="horizontal"||n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)!=-1||(r=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate()+(7-this._dateRender.length)))}for(f=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate(),new Date(r).getHours(),new Date(r).getMinutes(),new Date(r).getSeconds()),a=new Date(new Date(u).getFullYear(),new Date(u).getMonth(),new Date(u).getDate(),23,59,59);f<=a;)h=0,o=new Date(f),this.currentView()!=="day"&&this.currentView()!="agenda"&&(v=o._currentWeekDates(this._firstdayofweek),!this._isCustomMonthView()&&this._oneWeek?(f=new Date(new Date(o).getFullYear(),new Date(o).getMonth(),new Date(o).getDate()),h=this._dateRender.indexOf(f.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(f.getTime()):f.getTime()<new Date(this._dateRender[0]).getTime()?(new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1)).getTime()-new Date(f).setHours(0,0,0,0))/864e5:f.getTime()>new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):this.currentView()!="month"||this.model.orientation!="horizontal"&&(this.model.showNextPrevMonth||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(f.getFullYear(),f.getMonth(),1).getTime())?(c=this.currentView()=="workweek"&&!this._resWorkWeek&&this._firstdayofweek==0?v.end.getDay()-new Date(this._dateRender[this._dateRender.length-1]).getDay():0,h=(v.end.getTime()-new Date(o).setHours(0,0,0))/864e5-c):h=new Date(o.getFullYear(),o.getMonth()+1,0).getDate()-o.getDate()),l=new Date(f.getFullYear(),f.getMonth(),f.getDate()+h),e=new Date(l).getDate()==new Date(a).getDate()&&this.currentView()!=="month"?new Date(new Date(l).setHours(u.getHours(),u.getMinutes(),u.getSeconds())):new Date(new Date(l).setHours(23,59,59)),e>=new Date(u)&&this.currentView!=="day"&&(e=t[this._appointmentSettings.endTime]),this.model.showNextPrevMonth||this.currentView()!="month"||new Date(f.getFullYear(),f.getMonth(),1).getTime()==new Date(e.getFullYear(),e.getMonth(),1).getTime()||(e=new Date(f.getFullYear(),f.getMonth()+1,0,e.getHours(),e.getMinutes(),e.getSeconds())),appointment=this._addAppData(t,i,o,e,t.ParentId),this._processed.push(appointment),this._maxId=i=this._idChecking(),y=this.model.showWeekend?this.currentView()=="workweek"&&this._firstdayofweek==0?8-this.model.workWeek.length:1:this._getPrevNextDateCount(new Date(new Date(e).setHours(0,0,0,0)+864e5),"next")+1,f=new Date(new Date(e).getFullYear(),new Date(e).getMonth(),new Date(e).getDate()+y)},_deleteOcurrence:function(n,i){var u,o,e,f,h;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties();var s=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),c=(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n),r=new t.DataManager(this._currentAppointmentData).executeLocal(c);if((this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()&&(u=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,i)),u=u.length==0?this._objDate:u,u=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u[0].AppTaskId))),!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceRule])){if(o=r[0][this._appointmentSettings.recurrenceRule],s.recurrenceRuleSplit(o,r[0][this._appointmentSettings.recurrenceExDate]),t.isNullOrUndefined(s._rRule.exDate))(this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()?u[0][this._appointmentSettings.startTime].getDay()==u[0][this._appointmentSettings.endTime].getDay()?(i=u[0][this._appointmentSettings.startTime],r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()):(r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()):(r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString());else{for(e=o.split(";"),recurRule="",f=0;f<e.length;f++)recurRule!=""&&(recurRule+=";"),h=e[f].replace(/ /g,"").split("="),h[0]=="EXDATE"&&((this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()?u[0][this._appointmentSettings.startTime].getDay()==u[0][this._appointmentSettings.endTime].getDay()?(i=u[0][this._appointmentSettings.startTime],e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale)):e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale):e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale)),recurRule+=e[f];r[0][this._appointmentSettings.recurrenceRule]=recurRule;r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()}return r}},_getWeekIndex:function(n){var i=0,t=new Date(n.getFullYear(),n.getMonth(),1),r=n.getDay();if(r!=t.getDay())do t=new Date(t.setDate(t.getDate()+1));while(r!=t.getDay());while(t.getDate()!=n.getDate())t=new Date(t.setDate(t.getDate()+7)),i++;return i},_addAppData:function(i,r,u,f,e){var s={},o,c,h,l;for(o in this._appointmentSettings)if(o!="dataSource"&&o!="query"&&o!="tableName"&&o!="resourceFields"&&(s[this._appointmentSettings[o]]=i[this._appointmentSettings[o]]),o=="resourceFields"&&!t.isNullOrUndefined(this._appointmentSettings.resourceFields))for(c=this._appointmentSettings.resourceFields.split(","),h=0,l=c.length;h<l;h++)s[c[h]]=i[c[h]];return t.isNullOrUndefined(r)||(s.AppTaskId=r),t.isNullOrUndefined(u)||(s[this._appointmentSettings.startTime]=u),t.isNullOrUndefined(f)||(s[this._appointmentSettings.endTime]=f),t.isNullOrUndefined(e)||(s.ParentId=e),n.extend({},i,s)},_renderAppointments:function(){var r=n.extend(!0,[],this._dateRender),h,u,f,s,e,o,i;for(this._overflowFlag=!1,this._renderedApp=[],this._renderedAllDay=[],h=1,this.level=0,this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length)),this.cellwidth=this.element.find(".e-workcells").width(),this.cellheight=this.element.find(".e-workcells").outerHeight(),this.model.orientation=="vertical"&&this.model.showAllDayRow&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none")),this.alldaycellsheight=this.element.find(".e-alldaycells").height(),this._horiHeaderCollection=this._horiGroupCollection(),this.leftPosition=0,this._variable=[],this.model.group&&(this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length!=0)||(this.res1=["0"]),this.resIndex=0,this._processed=this._appointmentSort(this._processed),u=0;u<this.res1.length;u++){if(f=0,e=r.length,new Date(r[0])<this.model.minDate&&(f=Math.floor((new Date(this.model.minDate)-new Date(r[0]))/864e5)),new Date(r[r.length-1])>this.model.maxDate&&(s=Math.floor((new Date(r[r.length-1])-new Date(this.model.maxDate))/864e5),e=r.length-s),this._resWorkWeek)for(e=0,f=0,o=0,i=0;i<u+1;i++)if(t.isNullOrUndefined(this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(e+=this.model.workWeek.length,i==u&&(o+=this.model.workWeek.length)):(e+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,i==u&&(o+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length)),i==u){f=e-o;break}for(f;f<e;f++)this._getDayAppointments(f,u)}(this._overflowFlag||this._allDayDrag)&&this._reRenderScroller();this._overflowFlag=this._allDayDrag=!1},_appointmentRemove:function(n){this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment").filter("div[guid="+n.Guid+"]").remove();this.element.find(".e-categorybar").filter("div[id=categorybar_"+n.Guid+"]").remove()},_refreshDayAppointments:function(n){var r,y,e,a,o,p,h;if(this.model.timeScale.enable&&this.currentView()!="agenda"&&this.currentView()!="month"&&!this._isCustomMonthView()){this._overflowFlag=!1;var f=new Date(n[this._appointmentSettings.startTime]).setHours(0,0,0,0),i=this._tempResource.length>0&&this._grouping.length>0&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]]):0,u=this._dateRender.indexOf(f),v=0;if(this.model.orientation=="vertical"&&this._grouping.length>0)if(this._resWorkWeek){var s=0,u=0,c=0,l=0;for(r=0;r<i+1;r++)if(t.isNullOrUndefined(this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(s+=this.model.workWeek.length,r==i&&(c+=this.model.workWeek.length,l=this._resDateRen[i].indexOf(f))):(s+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,r==i&&(c+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,l=this._resDateRen[i].indexOf(f))),r==i){u=s-c;break}u=u+l}else v+=i*(this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:this.currentView()=="week"||this.currentView()=="week"||this._isCustomMonthView()?this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length);this.model.orientation=="horizontal"&&(y=this._grouping.length>1?this._resCollect.indexOf(this.res1[i]):i);this.model.orientation=="vertical"?this.element.find(".e-workcellstab tr td:nth-child("+(u+v+1)+")").find(".e-appointwrapper").remove():this.element.find(".e-workcellstab tr:nth("+y+")").find(".e-appointwrapper").remove();this.model.orientation=="vertical"?(e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(f).setHours(23,59,59))),e=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,h=new t.DataManager(this._renderedApp).executeLocal((new t.Query).where(e))):(a=this._appointmentCount(),this._grouping.length>0&&(o=this,p=a.filter(function(t){return t[o._appointmentSettings.resourceFields.toString().split(",")[o._tempResource.length-1].trim()]==n[o._appointmentSettings.resourceFields.toString().split(",")[o._tempResource.length-1].trim()]})),h=this._grouping.length>0?p:a);new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:h},"AppTaskId");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:h},"AppTaskId");var s=this.model.orientation=="vertical"?1:this._dateRender.length,w=this.model.orientation=="vertical"?u:0,b=0,w=this.model.orientation=="vertical"?u:0;this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length));this.cellwidth=this.element.find(".e-workcells").width();this.cellheight=this.element.find(".e-workcells").outerHeight();this.alldaycellsheight=t.isNullOrUndefined(this.alldaycellsheight)?this.element.find(".e-alldaycells").height():this.alldaycellsheight;this._horiHeaderCollection=this._horiGroupCollection();do this._getDayAppointments(w,i),b++,w++;while(b<s);this.model.orientation=="vertical"&&this.model.showAllDayRow&&this._renderAllDayAppointments();this._overflowFlag&&(this._reRenderScroller(),this._overflowFlag=!1);this.model.showAppointmentNavigator&&this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIconPosition()}else this.currentView()=="agenda"?this._renderAgendaContent():this._renderMonthAppointment();this._bindAppointmentAction()},_renderUpDownIcon:function(){if(this.element.find(".e-upicon, .e-downicon").length==0){var t=downIcon=upIconHtml=downIconHtml="",i=this.element.find(".e-hscroll").length==0?"0px":this.element.find(".e-hscroll").outerHeight()+"px";for(a=0;a<this.dateRender.length;a++)t=t+"<td class='upicon_"+a+"' style='width:100%;height:100%;'><span class='e-icon e-arrow-sans-up e-appup'><\/span><\/td>",downIcon=downIcon+"<td class='downicon_"+a+"' style='width:100%;height:100%;'><span class='e-icon e-arrow-sans-down e-appdown'><\/span><\/td>";upIconHtml="<tr class='e-upicon' style='pointer-events:none;top:0px;'>"+t+"<\/tr>";downIconHtml="<tr class='e-downicon' style='pointer-events:none;bottom:"+i+";'>"+downIcon+"<\/tr>";n(upIconHtml).insertBefore(this.element.find(".e-draggableworkarea").parent());n(downIconHtml).insertAfter(this.element.find(".e-draggableworkarea").parent());this.model.enableRTL&&this.element.find(".e-appup, .e-appdown").addClass("e-rtl");this.element.find(".e-upicon, .e-downicon").css({width:this.element.find(".e-workcellstab").width()});this.element.find(".e-appup, .e-appdown").css({pointerEvents:"visible"});this.element.find(".e-upicon, .e-downicon").children().css({float:this.model.enableRTL?"right":"left",visibility:"hidden",width:Math.floor(this.element.find(".e-workcellstab").width()/this.element.find(".e-upicon").children().length)})}},_renderUpDownIconPosition:function(){var e,v,n,y,i,p;if(this.element.find(".e-upicon, .e-downicon").children().css({visibility:"hidden"}),this.element.find(".e-vscroll").length>0){var r=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),s=t.isNullOrUndefined(r._scrollYdata)?this.element.height():r._scrollYdata.scrollable,h=r.scrollTop(),l=h>s?s:h,w=l+this.element.find(".e-draggableworkarea").height(),k=parseInt(l/this.element.find(".e-workcells").outerHeight())+1,d=parseInt(w/this.element.find(".e-workcells").outerHeight()),u=this.element.find(".e-upicon"),f=this.element.find(".e-downicon"),g=(this.model.startHour*60+k*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,nt=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4,tt=(this.model.startHour*60+d*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4+nt;for(this._currentViewAppointments=this._appointmentCount(),e=this,appointments=this._currentViewAppointments.filter(function(n){return(n[e._appointmentSettings.endTime]-n[e._appointmentSettings.startTime])/36e5<24}),a=0;a<this._dateRender.length;a++){var it=this.model.endHour<24?new Date(new Date(this._dateRender[a]).setHours(this.model.endHour,0,0)):new Date(new Date(this._dateRender[a]).setHours(23,59,59)),rt=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(this._dateRender[a]).setHours(this.model.startHour,0,0))).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(it)),o=new t.DataManager(appointments).executeLocal((new t.Query).where(rt));if(o.length!=0){if(v=new Date(new Date(this._dateRender[a]).setMilliseconds(g)),n=new t.DataManager(o).executeLocal((new t.Query).where(this._appointmentSettings.endTime,t.FilterOperators.lessThan,new Date(v))),n=this._appointmentSort(n).reverse(),!t.isNullOrUndefined(u)&&n.length!=0)if(this._grouping.length==0)u.children().eq(a).css({visibility:"visible"});else for(b=0;b<this.res1.length;b++)y=new t.DataManager(n).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[b].id)),y.length!=0&&u.children().eq(a+b*this._dateRender.length).css({visibility:"visible"});if(i=new t.DataManager(o).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.greaterThan,new Date(new Date(this._dateRender[a]).setMilliseconds(tt)))),i=this._appointmentSort(i),!t.isNullOrUndefined(f)&&i.length!=0)if(this._grouping.length==0)f.children().eq(a).css({visibility:"visible"});else for(c=0;c<this.res1.length;c++)p=new t.DataManager(i).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[c].id)),p.length!=0&&f.children().eq(a+c*this._dateRender.length).css({visibility:"visible"})}}}},_renderAppPosition:function(i){var w=n(i.target).hasClass("e-appup")?"e-appup":"e-appdown",r=n(i.target).parent().index(),c=this._appointmentCount(),e=this.element.find("div#"+this._id+"_scroller").data("ejScroller");switch(w){case"e-appup":var l=e.scrollTop(),o=parseInt(l/this.element.find(".e-workcells").outerHeight())+1,g=this.element.find(".e-draggableworkarea").find("tr").eq(o),u=(this.model.startHour*60+o*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,f=new Date(new Date(this.dateRender[r]).setMilliseconds(u)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(this.dateRender[r])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(f)),v=new t.DataManager(c).executeLocal((new t.Query).where(a));if(v.length!=0){var b=Math.abs(v[0][this._appointmentSettings.startTime]-f),y=parseInt((u-b)/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4)),p=l-(o-y)*this.element.find(".e-workcells").height();this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:p});this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})}break;case"e-appdown":var k=e.scrollTop()+n(this.element.find(".e-vscroll")[0]).height(),s=parseInt(k/this.element.find(".e-workcells").height()),nt=this.element.find(".e-draggableworkarea").find("tr").eq(s),u=(this.model.startHour*60+s*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,f=new Date(new Date(this.dateRender[r]).setMilliseconds(u)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(this.dateRender[r]).setHours(23,59,59))),h=new t.DataManager(c).executeLocal((new t.Query).where(a));if(h.length!=0){var d=f.getTime()-h[0][this._appointmentSettings.endTime].getTime(),y=parseInt((u-d)/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4)),p=e.scrollTop()+(y-s)*this.element.find(".e-workcells").height()+this.element.find("div#Appointment_"+h[0].AppTaskId).height();this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:p});this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})}}this._renderUpDownIconPosition();t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide")},_findAllDayApp:function(n){var i;if(!n[this._appointmentSettings.allDay])return i=n[this._appointmentSettings.recurrence]?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n[this._appointmentSettings.id])):new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,n.ParentId)),t.isNullOrUndefined(i[0])?!1:(i[0][this._appointmentSettings.endTime]-i[0][this._appointmentSettings.startTime])/36e5>=24?!0:!1},_getDayAppointments:function(n,i){var f=this._dateRender,r=this._currentViewAppointments=this._appointmentCount(),s=this.model.endHour<24?new Date(new Date(f[n]).setHours(this.model.endHour,0,0)):new Date(new Date(f[n]).setHours(23,59,59)),a=t.Predicate(this._appointmentSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(s)),v=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(s)),o=a.or(v),h,u,c,e,l;if(o=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):o,r=new t.DataManager(r).executeLocal((new t.Query).where(o)),h=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(f[n-1]).setHours(24,0,0))).or(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])),r=new t.DataManager(r).executeLocal((new t.Query).where(h)),this.model.orientation=="vertical")for(u=0;u<r.length;u++)c=(r[u][this._appointmentSettings.endTime]-r[u][this._appointmentSettings.startTime])/36e5>=24,e=r[u][this._appointmentSettings.allDay],e=t.isNullOrUndefined(e)||e==""?!1:e,new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()==new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&e||c?this._setAllDayPos(r[u],n,i):new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()==new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!e&&(this._findAllDayApp(r[u])?this._setAllDayPos(r[u],n,i):(l=this._renderedApp.filter(function(n){return n.Guid==r[u]}),l.length==0&&this._renderApp(r[u],n,i)));else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._getHorizontalDayAppointments(r,f,n,i)},_startUtc:function(n){!t.isNullOrUndefined(this.startutcValue)&&t.isNullOrUndefined(this.tempValue)?this._utcValue(n,"startUtc"):n.model.value==""?"":n.model.value==this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value")&&this._appointmentAddWindow.find("#"+this._id+"startTimeZone").attr("aria-expanded")=="true"?this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:n.text,value:n.value}):""},_endUtc:function(n){this._appointmentAddWindow.find("#"+this._id+"endTimeZone").attr("aria-expanded")=="true"?this._utcValue(n,"endUtc"):this.startutcValue=this.tempValue=null},_utcValue:function(n,i){var h,d,g,nt,l,a;t.preferredCulture(this.model.locale);i=="endUtc"?this._appointmentAddWindow.find(".endutc").val(n.text):"";var v={StartDate:this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("model.value"),EndDate:this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("model.value")},y={StartTime:this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("model.value"),EndTime:this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("model.value")},p=this._timeFormat(y.StartTime).split(":"),w=this._timeFormat(y.EndTime).split(":"),f=new Date(v.StartDate.setHours(parseInt(p[0],10),parseInt(p[1],10))),e=new Date(v.EndDate.setHours(parseInt(w[0],10),parseInt(w[1],10))),b=new Date(f),tt=new Date(e),u=i=="Appoint"?this.endTimeAppoint:i=="endUtc"?n.value:this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value"),r=i=="Appoint"?this.startTimeAppoint:i=="startUtc"?n.value:this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("model.value");if(r=r==""?this._timezoneStringValue():r,u=u==""?this._timezoneStringValue():u,u=u.indexOf("UTC")!=-1?parseInt(u.split(" ")[1].split(":")[0])*60+parseInt(u.split(" ")[1].split(":")[1]):parseInt(u.split(":")[0])*60+parseInt(u.split(":")[1]),r=r.indexOf("UTC")!=-1?parseInt(r.split(" ")[1].split(":")[0])*60+parseInt(r.split(" ")[1].split(":")[1]):parseInt(r.split(":")[0])*60+parseInt(r.split(":")[1]),h=u-r,f=new Date(f.setMinutes(f.getMinutes()+h)),i=="Appoint"){var k=new Date(n[this._appointmentSettings.startTime]),s=new Date(n[this._appointmentSettings.endTime]),c=t.isNullOrUndefined(this.model.timeZone)?-(new Date).getTimezoneOffset()+this._timeZoneOffset:this.model.timeZone.indexOf("UTC")!=-1?parseInt(this.model.timeZone.split(" ")[1].split(":")[0])*60+parseInt(this.model.timeZone.split(" ")[1].split(":")[1]):parseInt(this.model.timeZone.split(":")[0])*60+parseInt(this.model.timeZone.split(":")[1]),o=r==c?0:c-r;o=new Date(k.setMinutes(k.getMinutes()-o));d=this._timeMode=="12"?t.format(new Date(o),this._pattern.t,this.model.locale):t.format(new Date(o),"HH:mm",this.model.locale);this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker({value:t.format(new Date(o),this._datepattern(),this.model.locale)});g=u-c;this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:d})}e=i=="endUtc"||i=="Appoint"?new Date(b.setMinutes(b.getMinutes()+h)):f;e=i=="Appoint"?new Date(s.setMinutes(s.getMinutes()+g)):e;nt=this._timeMode=="12"?t.format(new Date(f),this._pattern.t,this.model.locale):t.format(new Date(f),"HH:mm",this.model.locale);i=="Appoint"?a=this._timeMode=="12"?t.format(new Date(s),this._pattern.t,this.model.locale):t.format(new Date(s),"HH:mm",this.model.locale):(l=new Date(e.setMinutes(e.getMinutes()+30)),a=this._timeMode=="12"?t.format(new Date(l),this._pattern.t,this.model.locale):t.format(new Date(l),"HH:mm",this.model.locale));this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker({value:t.format(new Date(e),this._datepattern(),this.model.locale)});this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:a});this.startutcValue=1},_rowHandlesOver:function(t){this.model.enableAppointmentResize&&n(t.target).addClass("e-rowcursor")},_colHandlesOver:function(t){this.model.enableAppointmentResize&&n(t.target).addClass("e-columncursor")},_getDateCount:function(n){var u,i,r,f;if(this._resWorkWeek)for(f=[],i=t.isNullOrUndefined(this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],i=this._resourceDaysReorder(i),r=0;r<i.length;r++)u=this._dayFullNames.indexOf(i[r].capitalizeFirstString()),u==-1&&(u=this._getDayNameIndex(i[r])),f.push(this._renderDates[u]);else f=this._dateRender;return f},_renderApp:function(i,r,u){var k=this.cellheight,y=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.startHour):0,p=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.endHour):24,d=this._getDateCount(u),f=new Date(i[this._appointmentSettings.startTime]),s=new Date(i[this._appointmentSettings.endTime]),c,w,nt,tt,ut,st,ht,g,a,ct,h,o,v,lt,at,e,vt,it,yt,rt,pt;if(f=new Date(f).getHours()<y?new Date(new Date(f).setHours(y,f.getMinutes(),f.getSeconds())):f,this.model.orientation=="vertical"){if(h=-1,f<=s&&new Date(d[0]).getTime()<=f.getTime()&&new Date(new Date(d[d.length-1]).setHours(23,59,59))>=f.getTime()&&(nt=new Date(f).getHours()<y?new Date(f).getHours()+-new Date(f).getHours()+-new Date(f).getMinutes():new Date(f).getHours()+-y,tt=new Date(s).getHours()>p?new Date(s).getHours()+(-new Date(s).getHours()+(p-y))+-new Date(s).getMinutes():new Date(s).getHours()+-y,tt=new Date(s).getHours()==p?new Date(tt).getMinutes()+-new Date(s).getMinutes():tt,p<=s.getHours()?(ut=new Date(s.setHours(p,00,00)),w=parseFloat(new Date(ut).getHours()*60+new Date(ut).getMinutes()-(new Date(f).getHours()*60+new Date(f).getMinutes()))*k*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-2):(w=parseFloat(new Date(new Date(s).getTime())-new Date(new Date(f).getTime()))/6e4*k*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-2,w=i[this._appointmentSettings.endTime].getTimezoneOffset()-i[this._appointmentSettings.startTime].getTimezoneOffset()!=0?w-k*this.model.timeScale.minorSlotCount:w),st=(parseFloat(new Date(f).getHours()*60+new Date(f).getMinutes()+new Date(f).getSeconds()/60)-parseInt(nt*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-this.model.startHour*60)*k*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),this.model.startHour<=new Date(f).getHours())){if(ht=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.id]:null,g=this._overlapApp(i.AppTaskId,i[this._appointmentSettings.startTime],i[this._appointmentSettings.endTime],ht),o=this,a=this._grouping.length>0&&this._tempResource.length>0&&this._tempResource[0].resourceSettings.dataSource.length>0&&t.scheduleFeatures.resources?g.filter(function(n){return n[o._appointmentSettings.endTime]>i[o._appointmentSettings.startTime]&&n[o._appointmentSettings.startTime]<i[o._appointmentSettings.endTime]&&n[o._appointmentSettings.resourceFields.toString().split(",")[o._tempResource.length-1].trim()]==o.res1[u][o._tempResource[o._tempResource.length-1].resourceSettings.id]}):g.filter(function(n){return n[o._appointmentSettings.endTime]>i[o._appointmentSettings.startTime]&&n[o._appointmentSettings.startTime]<i[o._appointmentSettings.endTime]}),a.length>0){for(this._variable=[],v=0,lt=a.length;v<lt;v++)t.isNullOrUndefined(this._variable[a[v].Index])?this._variable[a[v].Index]=[a[v]]:this._variable[a[v].Index].push(a[v]);ct=n.map(a,function(n){return[n.Index]});h=this._smallestMissingNumber(ct)}for(h=h==-1?0:h,i.Index=h,g.push(i),g.length!=1?t.isNullOrUndefined(this._variable[h])?this._variable[h]=[i]:this._variable[h].push(i):(this._variable=[],this._variable.push([i])),c=(90-this._variable.length)/this._variable.length+"%",this.leftPosition="0%",at=this._resWorkWeek?0:this._dateRender.length*u,e=0,vt=this._variable.length;e<vt;e++)if(!t.isNullOrUndefined(this._variable[e]))for(it=0,yt=this._variable[e].length;it<yt;it++){var ft=this.element.find(".e-workcellstab tr td:nth-child("+(at+r+1)+")").find(".e-appointwrapper").find(".e-appointment"),rt=this._variable[e][it].Guid,l=ft.filter("div[guid="+rt+"]");t.isNullOrUndefined(l[0])||rt==i.Guid?(c=t.isNullOrUndefined(this._variable[e-1])?(90-this._variable.length)/this._variable.length:!t.isNullOrUndefined(this.element.find("[guid="+this._variable[e-1][0].Guid+"]")[0])&&parseFloat(ft.filter("div[guid="+this._variable[e-1][0].Guid+"]")[0].style.width),this.leftPosition=(c+1)*h+"%"):parseFloat(c)<=parseFloat(l[0].style.width)?(this.model.enableRTL?l[0].style.right=(parseFloat(c)+1)*e+"%":l[0].style.left=(parseFloat(c)+1)*e+"%",l[0].style.width=parseFloat(c)+"%"):(rt=this._variable[t.isNullOrUndefined(this._variable[e-1])?e:e-1][0].Guid,pt=ft.filter("div[guid="+rt+"]"),l[0].style.width=pt[0].style.width,this.model.enableRTL?l[0].style.right=(parseFloat(l[0].style.width)+1)*e+"%":l[0].style.left=(parseFloat(l[0].style.width)+1)*e+"%")}c=parseFloat(c)+"%";this._renderedApp.push(n.extend(!0,{},i));var b=this._appointmentColor(i),wt=this.model.appointmentTemplateId?!0:!1,kt=wt?this._getUserAppointmentTemplate(i):"",dt=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale),ni=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,bt=this._indicationApp(i),et=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:w,rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!b.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:this.leftPosition,top:st,appWidth:c,userAppTemplId:wt,userTemplate:kt,appClass:"e-appointment",appointData:b.appointColor.appointData,appointCustomcss:b.appointColor.appointCustomcss,appointtextcolor:b.appointColor.appointtextcolor,value:b.value,multiDiv:b.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:ni,topInd:bt.leftIndication,bottomInd:bt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),h=this._resWorkWeek?nt*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r:parseInt(nt*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*d.length*this.res1.length+r+d.length*u,ot=this.element.find("td.e-workcells").eq(h);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,et);ot.find("div.e-appointwrapper").length>0?ot.find("div.e-appointwrapper").append(et):ot.prepend(n("<div class='e-appointwrapper'><\/div>").append(et))}}else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&this._renderHorizontalApp(f,s,i,r,k,this.model.timeScale.minorSlotCount,y,p);delete i.Index},_priorityTemplate:function(n){return this.model.prioritySettings.template.replace("{","").replace("$","").replace("}","").replace(this.model.prioritySettings.template.indexOf("value")!=-1?this.model.prioritySettings.value:this.model.prioritySettings.text,n[this._appointmentSettings.priority])},_getUserAppointmentTemplate:function(t){var r=n.templates(n(this.model.appointmentTemplateId).html()),i=n.extend(i,t);return i.View=this.currentView(),r.render(i)},_getUserTimeCellsTemplate:function(){for(var t,f=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),r,u=[],i=this.model.startHour;i<this.model.endHour;){for(t=0;t<60;)t=t*6e4,r=f.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,t))}),u.push({time:r.trim(),id:i+"_"+t}),t=t/6e4+this.model.timeScale.majorSlot;i=this.model.timeScale.majorSlot>60?i+this.model.timeScale.majorSlot/60:i+1}return u},_getUserAllDayCellsTemplate:function(){var t=[],i,r,u;for(r=n.templates(n(this.model.allDayCellsTemplateId).html()),a=0;a<this.res1.length;a++)for(b=0;b<this._dateRender.length;b++)i=new Date(new Date(this._dateRender[b]).setHours(this.model.startHour,0,0)),u=r.render(object={date:i,view:this.currentView(),resource:this.res1[a],timescale:this.model.timeScale.enable}),t.push(u.trim());return t},_getUserDateheaderTemplate:function(){var r=[],u,f,e,o,s;for(u=n.templates(n(this.model.dateHeaderTemplateId).html()),i=0;i<this._dateRender.length;i++)f=u.render(object={date:new Date(this._dateRender[i])}),e=this.currentView()==="month"||this.currentView()==="day"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],o=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday":"",s=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:e,currentDateClass:"",cellToday:""}:{currentDay:f,currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:o},r.push(s),this._value.push(i);return r},_getUserWorkCellsTemplate:function(){var i,t=[],e=[],f,u,r=0,s=this.model.timeScale.minorSlotCount,h,k,g,p;if(f=n.templates(n(this.model.workCellsTemplateId).html()),this._isCustomMonthView(),this.model.orientation=="vertical")if(this.currentView()=="month"||this._isCustomMonthView())for(h=0,a=0;a<this._dateRender.length/7;a++){for(t=[],b=0;b<this.res1.length;b++)for(h=a*7,c=0;c<7;c++)i=new Date(new Date(this._dateRender[h]).setHours(this.model.startHour,r,0)),u=f.render(object={date:i,view:this.currentView(),resource:this.res1[b],timescale:this.model.timeScale.enable}),t.push(u.trim()),h++;e.push(t)}else for(a=0;a<(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);a++){for(t=[],b=0;b<this.res1.length;b++)for(c=0;c<this._dateRender.length;c++)i=new Date(new Date(this._dateRender[c]).setHours(this.model.startHour,r,0)),u=f.render(object={date:i,view:this.currentView(),resource:this.res1[b],timescale:this.model.timeScale.enable}),t.push(u.trim());r=r+this.model.timeScale.majorSlot/s;e.push(t)}else{var w,l=[],v=[],y=[],o=this._tempResource.length==0?this.res1:this._resourceSort();if(this.model.timeScale.enable&&this.currentView()!="month"&&!this._isCustomMonthView())for(a=0;a<o.length;a++){for(t=[],v=[],y=[],b=0;b<this._dateRender.length;b++)for(r=0,c=0;c<(this.model.endHour-this.model.startHour)*(60/this.model.timeScale.majorSlot);c++)for(d=0;d<s;d++)i=new Date(new Date(this._dateRender[b]).setHours(this.model.startHour,r,0)),d==0?(u=f.render(object={date:i,view:this.currentView(),resource:o[a],timescale:this.model.timeScale.enable}),t.push(u.trim())):(w=f.render(object={date:i,view:this.currentView(),resource:o[a],timescale:this.model.timeScale.enable}),l.push(w.trim()),l.length==s-1&&(y.push(l),l=[])),r=r+this.model.timeScale.majorSlot/s;k=n.extend(!0,[],t);g=n.extend(!0,[],y);v.push(k,g);e.push(v)}else for(p=!this.model.timeScale.enable&&this.currentView()!="month"||this.currentView()=="customview"&&this._oneWeek?this._dateRender:this.monthDays,a=0;a<o.length;a++){for(t=[],b=0;b<p.length;b++)i=new Date(new Date(p[b]).setHours(this.model.startHour,r,0)),u=f.render(object={date:i,view:this.currentView(),resource:o[a],timescale:this.model.timeScale.enable}),t.push(u.trim());e.push(t)}}return e},_overlapApp:function(i,r,u,f){var o=this._renderedApp,h=[],c=[],a=[],l=[],e,s;if(this.model.orientation=="vertical")e=this,h=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.filter(function(n){return n[e._appointmentSettings.endTime]>r&&n[e._appointmentSettings.startTime]<u&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==f}):o.filter(function(n){return n[e._appointmentSettings.endTime]>r&&n[e._appointmentSettings.startTime]<u}),h.forEach(function(i){a=!t.isNullOrUndefined(e.model.group)&&e._tempResource.length!=0&&e._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(i[e._appointmentSettings.startTime])&&n[e._appointmentSettings.startTime]<=new Date(i[e._appointmentSettings.endTime])&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==f}):o.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(i[e._appointmentSettings.startTime])&&n[e._appointmentSettings.startTime]<=new Date(i[e._appointmentSettings.endTime])});var r=n(a).not(h);return r.length!=0&&(c=n.merge(c,r)),c}),l=n.merge(h,c);else if(this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal)for(s=0;s<o.length;s++)t.scheduleFeatures.resources&&this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)?new Date(o[s][this._appointmentSettings.endTime])>new Date(r)&&new Date(o[s][this._appointmentSettings.startTime])<=new Date(u)&&o[s][this._tempResource[this._tempResource.length-1].field]==f&&new Date(new Date(o[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(r).setHours(0,0,0,0)).getTime()&&l.push(o[s]):new Date(o[s][this._appointmentSettings.endTime])>new Date(r)&&new Date(o[s][this._appointmentSettings.startTime])<=new Date(u)&&new Date(new Date(o[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(r).setHours(0,0,0,0)).getTime()&&l.push(o[s]);return l},_getOverlapCount:function(i,r,u,f){var e,s,c,h,a,v,y,o,l;if(this._renderedAllDay.length==0)i.Index=0,o=0;else{if(l=[],e=this,s=this.model.orientation=="horizontal"&&t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?this._renderedAllDay.filter(function(n){return(n[e._appointmentSettings.endTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))||n[e._appointmentSettings.startTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59)))&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==i[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]}):this._renderedAllDay.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))||n[e._appointmentSettings.startTime]>=new Date(u[r])&&n[e._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))}),c=[],this.model.orientation=="vertical")for(h=0,a=s.length;h<a;h++)v=(s[h][this._appointmentSettings.endTime]-s[h][this._appointmentSettings.startTime])/36e5>=24,y=s[h][this._appointmentSettings.allDay],(new Date(new Date(u[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(s[h][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&y||v)&&(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)?s[h][this._tempResource[this._tempResource.length-1].field]==f:!0)&&c.push(s[h]);else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(c=this._getHorizontalOverlapCount(s,u,r,i,f));o=-1;o=this._findResourceIndex(c,"AppTaskId",i.AppTaskId);l=n.map(c,function(n){return[n.Index]});o=this._smallestMissingNumber(l);i.Index=o;o=o==-1?0:o}return o},_smallestMissingNumber:function(n){var i,t;if(n.length==0)return 0;for(i=Math.max.apply(Math,n),t=0;t<i;t++)if(n.indexOf(t)==-1)return t;return i+1},_setAllDayPos:function(i,r,u){var o=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._getOverlapCount(i,r,this._dateRender,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getOverlapCount(i,r,this._dateRender,null),e=new Date(i[this._appointmentSettings.startTime]),f=new Date(i[this._appointmentSettings.endTime]),ut,p,k,l,ot,d,a,h,v,it;if(new Date(e)<=new Date(f)){var s=this._dateRender,rt,w=0,b=appHeight=this.element.find(".e-alldayappointment").length>0?this.element.find(".e-alldayappointment").outerHeight(!0):this._getElementHeight("e-alldayappointment");if(this.level<=o&&(ut=(o+1)*appHeight+this.alldaycellsheight,this.element.find(".e-alldaycells,.e-leftindent").removeClass("e-alldaycellsheight").css("height",ut+"px"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this.element.find(".e-vscroll").length==0&&this.level==0&&this._reRenderScroller()),this._overflowFlag=!0,this._resWorkWeek){for(k=[],p=t.isNullOrUndefined(this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],l=0;l<p.length;l++)h=this._dayFullNames.indexOf(p[l].capitalizeFirstString()),h==-1&&(h=this._getDayNameIndex(p[l])),k.push(this._renderDates[h]);s=k}if(ot=new Date(s[0]),d=new Date(new Date(s[s.length-1]).setHours(23,59,59)),f=new Date(f)>new Date(d)?d:f,(this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend)&&n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender)==-1)for(a=1;a<this._dateRender.length;a++)if(n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()-a).getTime(),this._dateRender)>0){h=n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()-a).getTime(),this._dateRender);f=new Date(new Date(this._dateRender[h]).setHours(i[this._appointmentSettings.endTime].getHours(),i[this._appointmentSettings.endTime].getMinutes(),i[this._appointmentSettings.endTime].getSeconds()));break}this._renderedAllDay.push(n.extend(!0,{},i));v=this._resWorkWeek||this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend?n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),s)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),s)+1:this.currentView()=="week"||this.currentView()=="day"||this.currentView()=="customview"&&parseFloat((f-e)/36e5)<=24?f.getHours()==0&&f.getMinutes()==0?Math.ceil((new Date(f)-new Date(e))/864e5):Math.ceil((new Date(f).setHours(23,59,59)-new Date(e).setHours(0,0,0))/864e5):n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),this._dateRender)+1;v<=0&&(v=1);var st=this.element.find(".e-alldaycells").width(),g=this._dateRender.length,nt=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._grouping.length:0,tt=this.currentView()==="day"?0:this._dateRender.indexOf(new Date(e).setHours(0,0,0));this._resWorkWeek?w=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[r].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[r].offsetLeft:t.isNullOrUndefined(this.element.find(".e-alldaycells")[tt+u*g])||(w=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[tt+u*g].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[tt+u*g].offsetLeft);rt=v*st+v-2;b=o*b+(o+1)+this.element.find(".e-headercells").outerHeight()+(nt!=0?nt*this.element.find(".e-headerbar").first().height():nt);var c=this._appointmentColor(i),ft=this.model.appointmentTemplateId?!0:!1,ht=ft?this._getUserAppointmentTemplate(i):"",ct=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),lt=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale),at=i[this._appointmentSettings.recurrence]?i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1:!1,y=this._indicationApp(i),et=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),top:b,rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!c.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:ct,endTime:lt,appHeight:this.model.appointmentTemplateId?appHeight:"",appWidth:rt+"px",allday:!0,left:w+"px",userAppTemplId:ft,userTemplate:ht,appClass:"e-alldayappointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:at,leftInd:y.leftIndication,rightInd:y.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,et);this.element.find(".e-headrealldaytable").append(et)}this._alldayLevel=!1;this.level=this.level<o?o:this.level;i[this._appointmentSettings.recurrence]!=1&&(it=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId)),new Date(i[this._appointmentSettings.endTime])<it[0][this._appointmentSettings.endTime]&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").children(".e-lefthandle").remove():this.element.find("[guid="+i.Guid+"]").children(".e-righthandle").remove()),new Date(i[this._appointmentSettings.startTime])>it[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").children(".e-righthandle").remove():this.element.find("[guid="+i.Guid+"]").children(".e-lefthandle").remove()));t.isNullOrUndefined(y)||(y.leftIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),y.rightIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")));delete i.Index},_indicationApp:function(i){var u=!1,f=!1,r=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId))[0],s,h,c,e,l,o;return t.isNullOrUndefined(r)?{leftIndication:!1,rightIndication:!1}:(r[this._appointmentSettings.endTime].getHours()==0&&r[this._appointmentSettings.endTime].getMinutes()==0&&(r=n.extend(!0,[],r),r[this._appointmentSettings.endTime]=new Date(r[this._appointmentSettings.endTime].getTime()-1e3)),c=this.currentView()=="day"?[new Date(this._dateRender[0]).getTime()]:this._dateRender,e=this.currentView()=="month"&&new Date(new Date(r[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(r[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5<24,s=n.inArray(new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime(),c),h=n.inArray(new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime(),c),i[this._appointmentSettings.recurrence]?(l=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid)),l.length>1&&(o=this._sortAppById(l),(o[0][this._appointmentSettings.startTime]<i[this._appointmentSettings.startTime]||s==-1)&&!e&&(this.model.enableRTL?f=!0:u=!0),(o[o.length-1][this._appointmentSettings.endTime]>i[this._appointmentSettings.endTime]||h==-1)&&!e&&(this.model.enableRTL?u=!0:f=!0))):((new Date(r[this._appointmentSettings.startTime])<i[this._appointmentSettings.startTime]||s==-1)&&!e&&(this.model.enableRTL?f=!0:u=!0),(new Date(r[this._appointmentSettings.endTime])>i[this._appointmentSettings.endTime]||h==-1)&&!e&&(this.model.enableRTL?u=!0:f=!0)),{leftIndication:t.isNullOrUndefined(u)?!1:u,rightIndication:t.isNullOrUndefined(f)?!1:f})},_reRenderScroller:function(){var i,u,e;t.isNullOrUndefined(this._appointmentAddWindow)||(i=this._appointmentAddWindow.data("ejDialog"),i.option("enableAnimation",!1),i.close());var n=this.element.find("div#"+this._id+"_scroller"),r=n.data("ejScroller"),f=this.model.orientation==="vertical"?parseInt(this.element.width())-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?parseInt(this.element.width())-parseInt(this.element.find(".e-resourceheadertable").width()):parseInt(this.element.width());r.model.width=parseInt(f)-2;r.model.height=this.scHeight-1-(this.wTR.find(".e-draggableworkarea").offset().top-this.element.offset().top);r.refresh();this.model.cellWidth!=""&&(u=(parseInt(this.model.cellWidth)+1)*this.element.find("div.e-draggableworkarea tr:first td").length,e=this.wTR.find(".e-scrolltimecells").length>0?this.wTR.find(".e-scrolltimecells").width():0,this.wTR.find(".e-draggableworkarea").width(this.element.width()>u+e+(n.ejScroller("isVScroll")?18:0)?u-1:f-2-(n.ejScroller("isVScroll")?18:0)),this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width()));this.model.orientation!="vertical"||this.model.cellHeight||this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable||this.element.find(".e-draggableworkarea").height(r.model.height-(n.ejScroller("isHScroll")?18:0));this.model.orientation=="vertical"&&this._mediaQuery&&this.res1.length>1&&this.element.find(".e-draggableworkarea").width(this.element.find(".e-draggableworkarea").width()*this.res1.length);this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width());this.wTR.find(".e-scrolltimecells").css("top",-this.wTR.find(".e-draggableworkarea").scrollTop()+"px");this._mediaQuery&&!t.isNullOrUndefined(this._appointmentAddWindow)&&this._appointmentAddWindow.ejDialog("close");t.isNullOrUndefined(this._appointmentAddWindow)||i.option("enableAnimation",!0);(this.model.orientation=="horizontal"&&n.ejScroller("isVScroll")||this._mediaQuery)&&this._renderHoriVerticalScroll();this._showScrollTd()},_appointmentSort:function(n){var t=this;return this.currentView()=="agenda"?n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime],f=n[t._appointmentSettings.endTime],e=i[t._appointmentSettings.endTime];return r.getTime()-u.getTime()||f.getTime()-e.getTime()}):this.currentView()!="day"?n.sort(function(n,i){var o=n[t._appointmentSettings.endTime]-n[t._appointmentSettings.startTime],s=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime],f=new Date(n[t._appointmentSettings.startTime]),e=new Date(i[t._appointmentSettings.startTime]),h=new Date(n[t._appointmentSettings.endTime]),c=new Date(i[t._appointmentSettings.endTime]),r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime];return f==e&&h==c?r-u||n.Guid.localeCompare(i.Guid):f-e==0?s-o||r-u||n.Guid.localeCompare(i.Guid):r-u||n.Guid.localeCompare(i.Guid)}):n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime],f=n[t._appointmentSettings.endTime]-n[t._appointmentSettings.startTime],e=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime];return r-u||e-f||n.Guid.localeCompare(i.Guid)}),n},_alldaySort:function(n){for(var i=[],t=0;t<n.length;t++)(new Date(n[t][this._appointmentSettings.endTime])-new Date(n[t][this._appointmentSettings.startTime]))/36e5<24&&!n[t][this._appointmentSettings.allDay]&&i.push(n[t]);return i},_appointmentRecurrenceSort:function(n){var t=this;return n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime];return r-u}),n},_renderMonthAppointment:function(){var f,r,o,s,c,u,l;this._overflowFlag=!1;this.filterData=[];this._renderedApp=[];this.element.find(".e-appointwrapper").remove();this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length));var n=this.model.orientation=="vertical"?this.currentView()=="month"&&!this.model.showNextPrevMonth?this.monthDays:this._dateRender:this.monthDays,i=this._currentViewAppointments=this._appointmentCount(),e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(n[0])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(n[n.length-1]).setHours(23,59,59))),h=new t.DataManager(i).executeLocal((new t.Query).where(e));for(i=h,n=this.model.orientation=="vertical"?this._dateRender:this.monthDays,this.model.group&&(this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length!=0)||(this.res1=["0"]),f=0;f<this.res1.length;f++)for(r=0,o=n.length,new Date(n[0])<this.model.minDate&&(r=Math.floor((new Date(this.model.minDate)-new Date(n[0]))/864e5)),new Date(n[n.length-1])>this.model.maxDate&&(o=n.length-Math.floor((new Date(n[n.length-1])-new Date(this.model.maxDate))/864e5)),r;r<o;r++)for(s=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(n[r])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(n[r]).setHours(23,59,59))),s=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[f][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,i=new t.DataManager(h).executeLocal((new t.Query).where(s)),c=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(n[r])),i=new t.DataManager(i).executeLocal((new t.Query).where(c)),u=0;u<i.length;u++)l=this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?new t.DataManager(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,i[u][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])):this.res1,l.length!=0&&new Date(new Date(n[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(i[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&this._renderAppointmentMonth(i[u],r,f);this._overflowFlag&&(this._reRenderScroller(),this._overflowFlag=!1);this.model.showAppointmentNavigator&&this._nextPrevButton()},_wireResizeEvents:function(){if(this.model.enableAppointmentResize&&!this.model.readOnly){this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").on("mousedown",n.proxy(this._appointmentResizeStart,this));this._on(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",n.proxy(this._colHandlesOver,this));this._on(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",n.proxy(this._rowHandlesOver,this))}},_unWireResizeEvents:function(){this.model.enableAppointmentResize&&(this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").off("mousedown",n.proxy(this._appointmentResizeStart,this)),this._off(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",n.proxy(this._colHandlesOver,this)),this._off(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",n.proxy(this._rowHandlesOver,this)))},_recuCollectionIndex:function(n,t){for(var r,u=this._appointmentSettings,i=0;i<n.length;i++)if(n[i].Guid==t.Guid&&n[i].AppTaskId==t.AppTaskId){r=i;break}return r},_getIndex:function(i,r,u,f,e){var h,o,v,s,a;if(this._renderedApp.length==0)r.Index=0,s=0;else{var a=[],c=this,y=u.length,l=[];for(h=this.model.orientation=="horizontal"&&t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?f.filter(function(n){return n[c._appointmentSettings.resourceFields.toString().split(",")[c._tempResource.length-1].trim()]==r[c._appointmentSettings.resourceFields.toString().split(",")[c._tempResource.length-1].trim()]}):f,o=0,v=h.length;o<v;o++)(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?h[o][this._tempResource[this._tempResource.length-1].field]==e:!0)&&new Date(new Date(h[o][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(h[o][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(u[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(h[o][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(h[o][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&l.push(h[o]);s=-1;l.length>0&&(a=n.map(l,function(n){return[n.Index]}),s=this._smallestMissingNumber(a));s=s==-1?0:s;r.Index=s}return s},_recurrenceLocal:function(){var r=t.RecurrenceEditor.Locale[this.model.locale]=n.extend(!0,{},t.RecurrenceEditor.Locale["en-US"]),i=this;n.each(r,function(n){t.RecurrenceEditor.Locale[i.model.locale][n]=i._getLocalizedLabels(n)})},_minMaxIndex:function(){var t=n.unique(this._dateRender.map(function(n){return new Date(n).getDay()})),i=Math.min.apply(Math,t),r=Math.max.apply(Math,t);return{minIndex:i,maxIndex:r}},_renderAppointmentMonth:function(i,r,u){var it=this.model.orientation=="vertical"?this._dateRender:this.monthDays,rt=this.model.orientation=="vertical"?"td.e-monthcells":"td.e-workcells",wt=this._renderedApp,y=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._getIndex(r,i,it,wt,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getIndex(r,i,it,wt,null),k=new Date(i[this._appointmentSettings.startTime]),bt=new Date(i[this._appointmentSettings.endTime]),s,v=0,ut=new Date(k),g=new Date(bt),kt=new Date(new Date(it[it.length-1]).setHours(23,59,59)),nt,d,f,ct,ot,c,o,ri,ui,ht,pt;g=g>kt?kt:g;this.leftPosition=0;this.CellWidth=this.model.orientation=="vertical"?this.element.find(".e-monthcells").width():this.element.find(".e-workcells").width();this.CellHeight=this.model.orientation=="vertical"?this.element.find(".e-monthcells").height():this.element.find(".e-workcells").height();this._renderedApp.push(n.extend(!0,{},i));var p=this.model.showWeekend?ut.getHours()==0&&g.getHours()==0?Math.ceil((new Date(g)-new Date(ut))/864e5):Math.ceil((new Date(g).setHours(23,59,59)-new Date(ut).setHours(0,0,0))/864e5):this._getTotalDays(ut,g),l=this.model.showWeekend?7:this._minMaxIndex().maxIndex+1,dt=!this.model.timeScale.enable&&this._oneWeek?l-it.indexOf(ut.getTime()):l-new Date(ut).getDay()+this._firstdayofweek;if(k.getTime()<=bt.getTime()){if(this.model.orientation=="vertical"?(p=p>=dt?dt:p,nt=Math.ceil((r+1)/(this.model.showWeekend?l:this.model.workWeek.length)),s=p*this.CellWidth-this.CellWidth/20):s=!this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()?this.model.cellWidth!=""?p*this.CellWidth+p:p*this.CellWidth:this.CellWidth*p-parseInt(this.CellWidth/10),d=this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):0,f=this.model.showWeekend?this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this.model.orientation=="vertical"?this.currentView()=="day"?d+1:this.currentView()=="workweek"||this._isCustomMonthView()&&this._oneWeek?d*this._dateRender.length+(r+1):this.currentView()=="workweek"?d*this._dateRender.length+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*this._dateRender.length:this._firstdayofweek==0?d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l:this.model.orientation=="vertical"&&this._firstdayofweek!=0?d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l-this._firstdayofweek:r+1:r+1:this.model.orientation=="vertical"&&this._isCustomMonthView()&&!this._oneWeek?d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l:r+1:this.model.orientation=="vertical"?(nt-1)*this.res1.length*this.model.workWeek.length+u*this.model.workWeek.length+r%this.model.workWeek.length+1:r+1,this.model.orientation=="vertical"&&this._firstdayofweek!=0&&new Date(k).getDay()<this._firstdayofweek&&(f=d*l+(new Date(k).getDay()+1)+(nt-1)*this.res1.length*l-this._firstdayofweek+l),this.model.orientation=="horizontal"&&this.model.cellWidth==""&&p>1&&!this.model.enableRTL){var fi=this.element.find(".e-workcellstab tr:first").children().eq(f-1).offset().left,gt=this.element.find(".e-workcellstab tr:first").children().eq(f-2+p),ei=gt.offset().left+gt.width();s=ei-fi}var oi=s-1,ft=this.model.appointmentTemplateId?!0:!1,w=ft?this._getUserAppointmentTemplate(i):"",et=this.element.find(".e-monthheader").length!=0?this.element.find(".e-monthheader").height():0,h=this.model.appointmentTemplateId?n(w).css("height")=="100%"?this.model.showOverflowButton?this.CellHeight-et-15:this.initialCellHeight:n(w).css("height")=="0px"?this.element.find(".e-monthappointment").height():n(w).height():this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):this._getElementHeight("e-monthappointment");s=this.model.appointmentTemplateId?n(w).css("width")=="100%"||n(w).css("width")=="0px"?s:n(w).width():s;v=y*h;this.leftPosition=0;this._tempResource.length!=0&&(ct=this._resCollection,ot=this._horiGroupCollection());c=this.model.orientation=="vertical"?!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(ct[0].dataSource,ct[0].id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:0:!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(ot,this._tempResource[this._tempResource.length-2].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:0;var b=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()])+1:1,e=this._appointmentColor(i),si=this.element.find(".e-monthappointment").length!=0?this.element.find(".e-monthappointment").outerWidth(!0)-this.element.find(".e-monthappointment").width():0,ni=parseInt(this.CellWidth/(this.CellWidth<=s?this.CellWidth:s+si)),hi=parseInt((this.CellHeight-et-10)/(this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):h));this.CellHeight=this.model.orientation=="horizontal"?this.element.find(".e-workcellstab tr").eq(b+c-1).find(".e-workcells").height():this.element.find("td.e-monthcells").eq(f-1).parent().children().outerHeight();var tt=this._indicationApp(i),lt=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),at=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale);if(this.model.showOverflowButton&&ft&&n(w).css("height")!="0px"&&this.model.orientation!="horizontal"?y+1<=ni*hi:this.CellHeight>et+(y+1)*h+10){ft&&s<oi&&this.element.find(".e-appointwrapper").eq(f-1).attr("style","height:"+(parseInt(y/ni)+1)*h+"px !important;width:"+this.CellWidth+"px !important;position:absolute !important;");v>1&&(v=y*h);this.leftPosition=this.leftPosition>1?this.leftPosition-1:this.leftPosition;var vt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,a=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!e.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:lt,endTime:at,left:this.leftPosition+"px",top:v,appHeight:this.model.appointmentTemplateId?h:"",appWidth:s+"px",userAppTemplId:ft,userTemplate:w,appClass:"e-monthappointment",appointData:e.appointColor.appointData,appointCustomcss:e.appointColor.appointCustomcss,appointtextcolor:e.appointColor.appointtextcolor,value:e.value,multiDiv:e.multiDiv,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:vt,leftInd:tt.leftIndication,rightInd:tt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),o=this.model.orientation=="vertical"?this.element.find("td.e-monthcells").eq(f-1):this.element.find(".e-workcellstab tr").eq(b+c-1).find("td.e-workcells").eq(f-1);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,a);this.model.orientation=="vertical"?o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(a)):this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(ot,c,f-1,i,s,this.leftPosition));a=""}else{if(n("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(b+c-1)+"_"+(f-1)).length!=0&&n("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(b+c-1)+"_"+(f-1)).remove(),this.model.showOverflowButton){var ti=f-1,ii=new Date(i[this._appointmentSettings.startTime]).getTime(),ci=Math.round((i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/864e5),st=ti,li=y+1;do o=this.model.orientation=="vertical"?this.element.find("td.e-monthcells").eq(st):this.element.find(".e-workcellstab tr").eq(b+c-1).find("td.e-workcells").eq(st),ri='<div id="'+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(b+c-1)+"_"+st+'" class="e-icon e-arrowhead-down e-appsoverflow" cellinfo="'+it[r]+'" appcount="'+li+'"><\/div>',o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(ri):this.model.orientation=="vertical"?o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(a)):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),ii=ii+864e5,st++;while(st<ci+ti);this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(ot,c,f-1,i,s,this.leftPosition)}else{if(this.model.orientation=="vertical"){v=y*h;var vt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,ai=this.element.find("td.e-monthcells").eq(f-1).parent().index(),a=this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!e.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:lt,endTime:at,left:this.leftPosition+"px",top:v,appHeight:this.model.appointmentTemplateId?h:"",appWidth:s+"px",userAppTemplId:ft,userTemplate:w,appClass:"e-monthappointment",appointData:e.appointColor.appointData,appointCustomcss:e.appointColor.appointCustomcss,appointtextcolor:e.appointColor.appointtextcolor,value:e.value,multiDiv:e.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:vt,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}),o=this.element.find("td.e-monthcells").eq(f-1),yt=this.element.find("td.e-monthcells").eq(f-1).parent().children().outerHeight();this.CellHeight=yt>h*(y+1)+et?yt:yt+(h-1);this.element.find("td.e-monthcells").eq(f-1).parent().children().css("height",this.CellHeight+"px");this.element.find(".e-timecells").eq(ai).css("height",this.CellHeight+"px");o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(a))}else{v=y*h;this.CellHeight-10<h*(y+1)&&(this.element.find(".e-workcellstab tr").eq(b+c-1).find(".e-workcells").css("height",this.CellHeight+h+"px"),this.element.find(".e-resourceheadertable tr").eq(b+c-1).find(".e-childnode").css("height",this.CellHeight+h+"px"));var vt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,a=this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!e.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:lt,endTime:at,left:this.leftPosition+"px",top:v,appHeight:this.model.appointmentTemplateId?h:"",appWidth:s+"px",userAppTemplId:ft,userTemplate:w,appClass:"e-monthappointment",appointData:e.appointColor.appointData,appointCustomcss:e.appointColor.appointCustomcss,appointtextcolor:e.appointColor.appointtextcolor,value:e.value,multiDiv:e.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:vt,leftInd:tt.leftIndication,rightInd:tt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}),o=this.element.find(".e-workcellstab tr").eq(b+c-1).find("td.e-workcells").eq(f-1);o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(a):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(a));!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(ot,c,f-1,i,s,this.leftPosition)}this._overflowFlag=!0}ui=this.element.find(".e-appsoverflow").length>0?this.element.find(".e-appsoverflow").height():0;v=this.CellHeight-(et+ui-2);this.model.enableRTL?this.element.find(".e-icon.e-appsoverflow").css({right:this.CellWidth+this.leftPosition-25+"px",top:v+"px"}):this.element.find(".e-icon.e-appsoverflow").css({left:this.CellWidth+this.leftPosition-25+"px",top:v+"px"})}delete i.Index}i[this._appointmentSettings.recurrence]||(ht=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId)),pt=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid)),new Date(i[this._appointmentSettings.endTime])<ht[0][this._appointmentSettings.endTime]&&(this.model.enableRTL?this.element.find(rt).eq(f-1).find("[guid="+ht[0].Guid+"]").children(".e-lefthandle").remove():this.element.find(rt).eq(f-1).find("[guid="+ht[0].Guid+"]").children(".e-righthandle").remove()),new Date(i[this._appointmentSettings.startTime])>ht[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-righthandle").remove():this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-lefthandle").remove()));!t.isNullOrUndefined(pt)&&pt>1&&(this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-lefthandle").remove(),this.element.find(rt).eq(f-1).find("[guid="+i.Guid+"]").children(".e-righthandle").remove());t.isNullOrUndefined(tt)||(tt.leftIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),tt.rightIndication&&(this.model.enableRTL?this.element.find("[guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("[guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")))},_getElementHeight:function(t){var i=n(document.createElement("div")).addClass(t).clone(!1),r;return i.css({visibility:"hidden",position:"absolute"}),i.appendTo(this.element.find(".e-scheduleinner")),r=i.outerHeight(!0),i.remove(),r},_quickWindowClose:function(){this._quickAppointWindow.find(".e-error").remove();this._quickAppointWindow.ejDialog("close");this._scrollerPosition();this._processFocus()},_appointmentWindow:function(i){var f,e,r,u,o;if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close"),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),this.currentView()=="agenda"||r.hasClass("e-detailedapp")||t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(r=t.isNullOrUndefined(n(i.target).closest(".e-appointment,.e-monthappointment"))?r.closest(".e-workcells, .e-alldaycells, .e-monthcells"):n(i.target).closest(".e-appointment,.e-monthappointment")),r.hasClass("e-appup")||r.hasClass("e-appdown")||r.closest(".e-blocktimeappointment").hasClass("e-blocktimeappointment")||r.closest(".e-categorybar").hasClass("e-categorybar"))return!1;var c=(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||this._cellClick||r.hasClass("e-detailedapp"))&&!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-schedulemouseclose")&&!r.hasClass("e-appointinnertext")&&!r.hasClass("e-apptext")&&!r.hasClass("e-apptime"),l=this.model.appointmentWindowOpen!=null||this.model.cellDoubleClick!=null||!t.isNullOrUndefined(this.model.serverEvents)&&(this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1||this.model.serverEvents.indexOf("cellDoubleClick")!=-1),s={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:i,resources:l&&c&&this._tempResource.length!=0?this._getResourceValue(r):null};if(!(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||this._cellClick||r.hasClass("e-detailedapp"))||r.hasClass("e-resourceheadercells")||r.hasClass("e-schedulemouseclose")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptext")||r.hasClass("e-apptime")){if(!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-schedulemouseclose")){if(r.hasClass("e-monthheader")||r.hasClass("e-appsoverflow"))return!1;u=this._editKey?n(i):r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-monthappointment,.e-appointment,.e-alldayappointment,.e-agendaappointment");this.currentView()=="agenda"&&(u=u.hasClass("e-agendaappointment")?u:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"));u.length>0&&!t.isNullOrUndefined(u[0].id)&&(this._currentAction=t.Schedule.Actions.Save,this._appUid=u.attr("guid"),o=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),o[0][this._appointmentSettings.recurrence]==1?(t.isNullOrUndefined(this._recurEditWindow)&&this._renderRecurEditWindow(),this._parentId=o[0].ParentId,this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):this._showAppointmentDetails(this._appUid,!0),!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"));this._editKey=!1}}else{if(!t.isNullOrUndefined(this.model.cellDoubleClick)&&this._trigger("cellDoubleClick",s))return!1;this._currentAction=t.Schedule.Actions.Add;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").css("display","block"));var a=this._cellIndex,v=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender,h=new Date(v[a]);if(this.model.minDate>h||this.model.maxDate<h||(f=new Date(this.cur_StartTime),e=new Date(this.cur_EndTime),(!t.isNullOrUndefined(this.model.appointmentWindowOpen)||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1)&&this._trigger("appointmentWindowOpen",s)))return!1;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find("#"+this._id+"subject").val(this.model.showQuickWindow?this._quickAppointWindow.find(".subject").val():""),this._appointmentAddWindow.find("#"+this._id+"location").val(this.model.showQuickWindow?this._quickAppointWindow.find(".location").val():""),this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option",{value:t.format(new Date(f),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option",{value:t.format(new Date(e),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(f),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(e),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option","value",this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]),(n(i.currentTarget).hasClass("e-alldaycells")||this.currentView()=="month"||this._isCustomMonthView())&&this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}),this._timeZoneCollection(null),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),this._alldayCheck(),t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._renderResourceData(r,this._cellIndex),this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave ,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open")),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus(),this._cellClick=!1)}},_editRecurrence:function(){this._appointmentAddWindow.find(".e-appwindow").toggle();this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","none");this._appointmentAddWindow.find(".e-recurEditor").css("margin-left",700).toggle().animate({"margin-left":10},300)},_showAppointmentDetails:function(n,i){var f,u,e;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties();f=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor");this._appUid=t.isNullOrUndefined(this._appUid)?n:this._appUid;this._currentAction=t.isNullOrUndefined(this._currentAction)||this._currentAction==""?t.Schedule.Actions.Save:this._currentAction;var o=i==!0?(new t.Query).where("Guid",t.FilterOperators.equal,n):(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n),s=i==!0?this._processed:this._currentAppointmentData,r=this._sortAppById(new t.DataManager(s).executeLocal(o)),h={appointment:r[0],edit:i};if(this._trigger("appointmentWindowOpen",h))return!1;r[0][this._appointmentSettings.endTime]=r[r.length-1][this._appointmentSettings.endTime];t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find(".subject").val(r[0][this._appointmentSettings.subject]),this._appointmentAddWindow.find(".location").val(r[0][this._appointmentSettings.location]),this._appointmentAddWindow.find(".id").val(r[0].AppTaskId),this._appointmentAddWindow.find(".e-description").val(r[0][this._appointmentSettings.description]?r[0][this._appointmentSettings.description]:""),u=r[0],this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",t.format(u[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",t.format(u[this._appointmentSettings.endTime],this._datepattern(),this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(u[this._appointmentSettings.startTime],this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(u[this._appointmentSettings.endTime],this._pattern.t,this.model.locale)),this.model.prioritySettings.enable&&(t.isNullOrUndefined(u[this._appointmentSettings.priority])?this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option",{value:this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]}):this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option",{value:r[0][this._appointmentSettings.priority]})),this._timeZoneCollection(u),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),r[0][this._appointmentSettings.allDay]==1&&this._appointmentAddWindow.find(".allday ").ejCheckBox({checked:!0}),r[0][this._appointmentSettings.recurrence]==1&&(f._recRule=r[0][this._appointmentSettings.recurrenceRule],i==!0?(t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceRule])||r[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")==-1||(this._currentAction=t.Schedule.Actions.Save),this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0,enabled:!1}),this._appointmentAddWindow.find(".e-repeatlbl").addClass("e-disable"),this._appointmentAddWindow.find("."+this._id+"summary").css("display","none"),this._appointmentAddWindow.find(".e-recurFinalRule").html("")):(f.recurrenceRuleSplit(r[0][this._appointmentSettings.recurrenceRule],u[this._appointmentSettings.recurrenceExDate]),this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({value:t.format(u[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(f.showRecurrenceSummary(n)),this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0}),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"))),this.model.categorizeSettings.enable&&!t.isNullOrUndefined(u[this._appointmentSettings.categorize])&&this._showCategorizeDetails(u),this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._showMultipleResourceDetails(u),(u[this._appointmentSettings.allDay]||this.currentView()=="agenda")&&this._alldayCheck(),e=this.model.readOnly?"disable":"enable",this._appointmentAddWindow.find(".e-appsave,#"+this._id+"donerecur").ejButton(e,!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","block"),this._appointmentAddWindow.ejDialog("open"),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus())},_recurDateChange:function(n){this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",n);this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")<this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")?this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",n):n!=this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")&&this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",n)},_cancel:function(){this._appointmentAddWindow.ejDialog("close")},_timeChange:function(n){var i=this._appointmentAddWindow.find("#"+this._id+"starttime").data("ejTimePicker");if(t.isNullOrUndefined(n.value)){i.option("value",new Date(this.cur_StartTime));return}if(i.showDropdown&&i._id==this._id+"starttime"){if(this._appointmentAddWindow.find(".startutc").val()!=this._appointmentAddWindow.find(".endutc").val())this._utcValue("","starttime");else{var u=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),f=new Date(new Date("1/1/2000").setHours(parseInt(u[0],10),parseInt(u[1],10))),e=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),r=new Date(new Date("1/1/2000").setHours(parseInt(e[0],10),parseInt(e[1],10))),o=this._timeFormat(n.prevTime).split(":"),s=new Date(new Date("1/1/2000").setHours(parseInt(o[0],10),parseInt(o[1],10))),h=new Date(new Date(r).setHours(r.getHours()+f.getHours()-s.getHours(),r.getMinutes()+f.getMinutes()-s.getMinutes()));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",h)}this._startSlotChange=!0}},_setQuickValidation:function(){var f,i,r,u;if(t.isNullOrUndefined(this._quickAppointWindow))return!1;f=this._id+"_AddForm";this._initValidator(f);t.isNullOrUndefined(this.model.appointmentSettings.subject)||t.isNullOrUndefined(this.model.appointmentSettings.subject.validationRules)||(i=this.model.appointmentSettings.subject.field,r=this.model.appointmentSettings.subject.validationRules,ele=this._quickAppointWindow.find(".subject"),ele.attr("name")||ele.attr("name",i),ele.rules("add",r),u=n("#"+this._id+"_AddForm").validate(),t.isNullOrUndefined(r.required)||(t.isNullOrUndefined(u.settings.messages[i])?u.settings.messages[i]={}:"",u.settings.messages[i].required=t.isNullOrUndefined(r.messages&&r.messages.required)?i+" is required.":r.messages.required))},_setValidation:function(){var r=this._id+"_AddEditForm",i;this._initValidator(r);i=this;n.each(this.model.appointmentSettings,function(n){t.isNullOrUndefined(i.model.appointmentSettings[n])||t.isNullOrUndefined(i.model.appointmentSettings[n].validationRules)||i._setValidationToField(n,i.model.appointmentSettings[n].field,i.model.appointmentSettings[n].validationRules)})},_initValidator:function(i){n("#"+i).validate({onfocusout:!1,ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,r){var e=r.closest("td"),u=n(i).addClass("e-error"),o=t.buildTag("div.e-errortail e-toparrow"),f;e.find(".e-error").remove();r.parent().hasClass("e-in-wrap")?u.insertAfter(r.closest(".e-widget")):u.insertAfter(r);u.prepend(o);f=r[0].type=="checkbox"||r[0].type=="hidden"?r.parent().offset().top+r.parent().height():r.offset().top+r.height();u.offset({top:f});u.fadeIn("slow")}})},_setValidationToField:function(i,r,u){var f,e,o;for(ele=i=="startTime"?this._appointmentAddWindow.find("#"+this._id+"startdate,#"+this._id+"starttime"):i=="endTime"?this._appointmentAddWindow.find("#"+this._id+"enddate,#"+this._id+"endtime"):i=="resourceFields"?n("#"+this._id+"AppointmentAddEditWindow").find("[id^="+this._id+"_ownerfield_][type!=hidden]").find(".e-autocomplete"):n("#"+this._id+"AppointmentAddEditWindow").find("[name="+r+"][type!=hidden]"),ele.length<1&&(ele=n("#"+this._id+i)),f=0;f<ele.length;f++)n(ele[f]).hasClass("e-autocomplete")&&(e=n(ele[f]).data("ejAutocomplete"),ele[f]=e.model.multiSelectMode=="visualmode"?e._hiddenInput:e.element),n(ele[f]).rules("add",u),o=n("#"+this._id+"_AddEditForm").validate(),t.isNullOrUndefined(u.required)||(t.isNullOrUndefined(o.settings.messages[r])?o.settings.messages[r]={}:"",o.settings.messages[r].required=t.isNullOrUndefined(u.messages&&u.messages.required)?r+" is required.":u.messages.required)},_endTimeChange:function(n){var i=this._appointmentAddWindow.find("#"+this._id+"endtime").data("ejTimePicker");if(t.isNullOrUndefined(n.value)){i.option("value",new Date(this.cur_EndTime));return}i.showDropdown&&i._id==this._id+"endtime"&&(this._endSlotChange=!0)},_renderControls:function(){var i=this._appointmentAddWindow;i.find(".allday").ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:n.proxy(this._alldayCheck,this)});i.find(".startenddate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),startDay:this._firstdayofweek,enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,dateFormat:this.model.dateFormat,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate});i.find("#"+this._id+"starttime").ejTimePicker({enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,change:n.proxy(this._timeChange,this),cssClass:this.model.cssClass,interval:30,timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});i.find("#"+this._id+"endtime").ejTimePicker({enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,change:n.proxy(this._endTimeChange,this),cssClass:this.model.cssClass,interval:30,timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});i.find("#"+this._id+"startTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._startUtc,this),cssClass:this.model.cssClass});i.find("#"+this._id+"endTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._endUtc,this),cssClass:this.model.cssClass});!this.model.prioritySettings.enable||this.model.prioritySettings.dataSource instanceof t.DataManager||this._renderPriorityItems(i);this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._renderAppWindowResources(i);!this.model.categorizeSettings.enable||this.model.categorizeSettings.dataSource instanceof t.DataManager||this._renderCategoryItems(i);i.find(".recurrence").ejCheckBox({enableRTL:this.model.enableRTL,change:n.proxy(this._repeat,this),cssClass:this.model.cssClass});i.find(".e-btndone").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:this._mediaQuery?"100%":"100px",click:n.proxy(this._saveAppointment,this),cssClass:"e-flat"+this.model.cssClass});i.find(".cancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:this._mediaQuery?"100%":"100px",click:n.proxy(this._cancel,this),cssClass:"e-flat"+this.model.cssClass});this._mediaQuery&&i.find(".e-btndelete").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100%",click:n.proxy(this._mobileAppDelete,this),cssClass:"e-flat"+this.model.cssClass})},_mobileAppDelete:function(){this._mediaQuery&&!t.isNullOrUndefined(this._editOnlyClicked)&&!this._editOnlyClicked&&this._appointmentAddWindow.find(".recurrence").ejCheckBox("option","checked")?this._deleteApp(this._appUid):this._deleteAppoint();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("close")},_renderPriorityItems:function(n){t.isNullOrUndefined(n)||n.find(".priority").ejDropDownList({enableRTL:this.model.enableRTL,template:t.isNullOrUndefined(this.model.prioritySettings.template)?"<div class='e-${"+this.model.prioritySettings.value+"}'><\/div><div>${"+this.model.prioritySettings.text+"}<\/div>":this.model.prioritySettings.template+"${"+this.model.prioritySettings.text+"}",dataSource:this.model.prioritySettings.dataSource,fields:{text:this.model.prioritySettings.text,value:this.model.prioritySettings.value},width:"100%",cssClass:this.model.cssClass})},_renderCategoryItems:function(i){t.isNullOrUndefined(i)||i.find(".e-categorizevalue").ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",cssClass:this.model.cssClass,multiSelectMode:this.model.categorizeSettings.allowMultiple?"visualmode":"none",focusOut:n.proxy(this._categorizeValidate,this),dataSource:this.model.categorizeSettings.dataSource,fields:{text:this.model.categorizeSettings.text,value:this.model.categorizeSettings.color,key:this.model.categorizeSettings.id,fontColor:this.model.categorizeSettings.fontColor},template:this._categorizeTemplate,emptyResultText:this._getLocalizedLabels("EmptyResultText")})},_categorizeValidate:function(){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddEditForm").validate().form())return!1},_appointmentColor:function(n){var i=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(n[this._appointmentSettings.categorize])&&n[this._appointmentSettings.categorize]!=""?this._getCategorizeColor(n):this._tempResource.length!=0&&t.scheduleFeatures.resources?this._getResourceColor(n):{appointData:"",appointCustomcss:"",appointtextcolor:"",applyFilter:!0};if(this.model.categorizeSettings.enable&&this.model.categorizeSettings.allowMultiple&&!t.isNullOrUndefined(n[this._appointmentSettings.categorize]))var f=n[this._appointmentSettings.categorize].split(","),e=f.length,r=e>1?!0:!1,u=this._categorizeMultipleDiv(n,f,e);return!t.isNullOrUndefined(u)&&i.appointData.length>0&&this.model.categorizeSettings.allowMultiple?{appointColor:i,value:r,multiDiv:u,applyFilter:!1}:i.appointData.length>0&&!this.model.categorizeSettings.allowMultiple||this._tempResource.length!=0&&t.scheduleFeatures.resources?{appointColor:i,applyFilter:!1}:(appointData="",appointCustomcss="",appointtextcolor="",r="",{appointColor:i,value:r,multiDiv:u,applyFilter:!0})},_categorizeMultipleDiv:function(n,r,u){var o=[],f,e;for(i=0;i<=u-1;i++)if(i!=u-1){if(f=this.model.categorizeSettings,e=this._findResourceIndex(f.dataSource,this.model.categorizeSettings.id,r[i]),t.isNullOrUndefined(e)&&(e=this._findResourceIndex(f.dataSource,this.model.categorizeSettings.id,parseInt(r[i]))),t.isNullOrUndefined(e))return n[this._appointmentSettings.categorize]="",null;o.push({text:f.dataSource[e][f.text],value:f.dataSource[e][f.color],key:f.dataSource[e][f.id],fontColor:f.dataSource[e][f.fontColor]})}return this._categorizeMultipleTemplate.render({renderData:o})},_getResCategorySaveData:function(n,i,r,u,f){var a=[],o,b,k,d=[],y,c,p,w,h,l,g,v,e,s;if(o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&!t.isNullOrUndefined(n[0][0])){for(y=n[n.length-1].length-1,c="",e=0;e<=y;e++)p=n[n.length-1][e][this.model.categorizeSettings.id],c=e!=y?c+p.toString()+",":c+p.toString();o[this._appointmentSettings.categorize]=c}if(i.length>0){if(w=o[this._appointmentSettings.categorize],s=this._appointmentSettings.resourceFields.toString().split(","),this._grouping.length!=0&&s.length!=this._grouping.length){for(e=0;e<this._grouping.length;e++)d.push(s[e]);s=d}if(h=this._getResourceCollection(),i[i.length-1].length>0)for(l=0;l<i[i.length-1].length;l++){for(o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=w),i[i.length-1].length>1&&(r.Guid=this._guidFormatGenerate(),u++,g=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u)),u=g.length==0?u:this._sortAppById(this._processed)[this._processed.length-1].AppTaskId+1,r[this._appointmentSettings.id]=f=u,this._currentAction==t.Schedule.Actions.EditSeries&&(r[this._appointmentSettings.recurrenceId]=u)),o[s[s.length-1].trim()]=i[s.length-1][l][h[h.length-1].id],v=i[s.length-1][l][h[h.length-1].id],e=s.length-1;e>0;e--)b=this.render_Resources[e]instanceof t.DataManager?this.render_Resources[e]:t.DataManager(this.render_Resources[e]),query=(new t.Query).where(h[e].id,t.FilterOperators.equal,v),appointId=b.executeLocal(query),k=this.render_Resources[e-1]instanceof t.DataManager?this.render_Resources[e-1]:t.DataManager(this.render_Resources[e-1]),query1=(new t.Query).where(h[e-1].id,t.FilterOperators.equal,appointId[0][h[e].groupId]),appointGroupId=k.executeLocal(query1),v=appointGroupId[0][h[e-1].id],o[s[e-1]]=v;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);a.push(o)}else{if(s=this._appointmentSettings.resourceFields.toString().split(","),o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=w),s.length>1)for(e=0;e<s.length;e++)o[s[e].trim()]=this._tempResource[e].resourceSettings.dataSource[0].id;else o[s[s.length-1].trim()]=this._tempResource[0].resourceSettings.dataSource[0].id;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);a.push(o)}}return i.length==0&&n.length>0&&(this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId),a.push(o)),a},_timeZoneCollection:function(n){var u;t.isNullOrUndefined(n)||(this.startTimeAppoint=n[this._appointmentSettings.startTimeZone],this.endTimeAppoint=n[this._appointmentSettings.endTimeZone]);this.startutcValue=this.tempValue=null;!t.isNullOrUndefined(n)&&this.endTimeAppoint&&(this._utcValue(n,"Appoint"),this.tempValue=1);var s=this.model.timeZone==null?this._timezoneStringValue():this.model.timeZone,e=t.isNullOrUndefined(n)?s:t.isNullOrUndefined(this.startTimeAppoint)?s:this.startTimeAppoint,r=e.indexOf("UTC")!=0?"UTC "+e:e,o=r.split(" ")[1].split(":")[0].length!=3?r.split(" ")[1].split(":")[0][0]=="+"?"+0"+r.split(" ")[1].split(":")[0].split("+")[1]+":"+r.split(" ")[1].split(":")[1]:"-0"+r.split(" ")[1].split(":")[0].split("-")[1]+":"+r.split(" ")[1].split(":")[1]:r,f=o.indexOf("UTC")!=0?"UTC "+o:o,i=t.isNullOrUndefined(this._findResourceIndex(this.model.timeZoneCollection.dataSource,this.model.timeZoneCollection.value,f))?"add":this._findResourceIndex(this.model.timeZoneCollection.dataSource,this.model.timeZoneCollection.value,f);t.isNullOrUndefined(n)||i==="add"?i!=="add"&&(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{text:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.text],value:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.text],value:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]})):(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{value:!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.startTimeAppoint)?this.startTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{value:!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.endTimeAppoint)?this.endTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}));i=="add"&&(u={},u[this.model.timeZoneCollection.text]=f,u[this.model.timeZoneCollection.id]=(this.model.timeZoneCollection.dataSource.length+1).toString(),u[this.model.timeZoneCollection.value]=f,this.model.timeZoneCollection.dataSource.push(u),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),n!=null?this._timeZoneCollection(n):this._timeZoneCollection(null));this.tempValue=null},_timezoneStringValue:function(){var t=-(new Date).getTimezoneOffset()+this._timeZoneOffset,i=t<0?"-":"+",n=Math.abs(t),r=Math.floor(n/60)<10?"0"+Math.floor(n/60):Math.floor(n/60),u=n%60<10?"0"+n%60:n%60;return i+r+":"+u},_showCategorizeDetails:function(t){var r=t[this._appointmentSettings.categorize].split(","),u;for(i=0;i<r.length;i++)u=n.type(r[i])=="string"?r[i]:parseInt(r[i]),this._appointmentAddWindow.find(".e-categorizevalue").data("ejAutocomplete").selectValueByKey(u)},_renderCategorizeTemplate:function(){var n=this.model.enableRTL?"margin-right:30px;margin-top:-18px":"",i=this.model.enableRTL?"float:none":"float:left";t.isNullOrUndefined(this.model.categorizeSettings)||(this._categorizeTemplate="<div class='e-categorizeTemplate' style='height:15px;margin-right:5px;margin-top:3px;"+i+";width:15px;background-color: ${"+this.model.categorizeSettings.color+"}'><\/div><div style= "+n+">${"+this.model.categorizeSettings.text+"}<\/div>")},_getCategorizeColor:function(n){var r=null,u="",o="",f="",e=n[this._appointmentSettings.categorize].split(","),s=e.length-1,i=this.model.categorizeSettings;return(r=this._findResourceIndex(i.dataSource,this.model.categorizeSettings.id,e[s]),t.isNullOrUndefined(r)&&(r=this._findResourceIndex(i.dataSource,this.model.categorizeSettings.id,parseInt(e[s]))),t.isNullOrUndefined(r))?(n[this._appointmentSettings.categorize]="",{appointData:u,appointCustomcss:o,appointtextcolor:f}):(u=t.isNullOrUndefined(i.dataSource[r][i.color])?u:i.dataSource[r][i.color],f=t.isNullOrUndefined(i.dataSource[r][i.fontColor])?f:i.dataSource[r][i.fontColor],{appointData:u,appointCustomcss:o,appointtextcolor:f,applyFilter:!1})},_currentDateFormat:function(i){var r,u,f,e;t.isNullOrUndefined(i)||n.type(this.currentDate())=="date"&&n.type(this.model.minDate)=="date"&&n.type(this.model.maxDate)=="date"?i=="MM/dd/yyyy"&&(n.type(this.currentDate())!="date"||n.type(this.model.minDate)!="date"||n.type(this.model.maxDate)!="date")&&(e=t.parseDate(this.currentDate()),r=t.parseDate(this.model.minDate),u=t.parseDate(this.model.maxDate),t.isNullOrUndefined(e)?this.currentDate(new Date):this.currentDate(e),this.model.minDate=t.isNullOrUndefined(r)?this.model.minDate:r,this.model.maxDate=t.isNullOrUndefined(u)?this.model.maxDate:u):(f=t.parseDate(this.currentDate(),this.model.dateFormat),r=t.parseDate(this.model.minDate,this.model.dateFormat),u=t.parseDate(this.model.maxDate,this.model.dateFormat),this.currentDate(t.isNullOrUndefined(f)?new Date(this.currentDate()).toString()=="Invalid Date"||new Date(this.currentDate()).toString()=="NaN"?this._dateConvert(this.currentDate()):new Date(this.currentDate()):f),this.model.minDate=t.isNullOrUndefined(r)?new Date(this.model.minDate).toString()=="Invalid Date"||new Date(this.model.minDate).toString()=="NaN"?this._dateConvert(this.model.minDate):new Date(this.model.minDate):r,this.model.maxDate=t.isNullOrUndefined(u)?new Date(this.model.maxDate).toString()=="Invalid Date"||new Date(this.model.maxDate).toString()=="NaN"?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate):u)},_datepattern:function(){return this.model.dateFormat!=""&&!t.isNullOrUndefined(this.model.dateFormat)?this.model.dateFormat:this._pattern.d},_businessHourScroller:function(){var n,i,r,u;if(this.currentView()=="agenda")return!1;n=0;this.model.orientation=="vertical"&&this.model.timeScale.enable&&this.currentView()!="month"&&!this._isCustomMonthView()?(n=this.element.find(".e-businesshighlightworkcells").length!=0&&this.model.workHours.highlight?this.element.find(".e-businesshighlightworkcells").first().parent().index()*this.element.find(".e-workcells").height():0,this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:n}),this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})):this.model.orientation=="horizontal"&&this.model.timeScale.enable&&(this.element.find(".e-businesshighlightworkcells").length!=0&&this.model.workHours.highlight&&this.currentView()!="month"?(n=this.element.find(".e-businesshighlightworkcells")[0].offsetLeft,(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7)&&(i=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index(),!t.isNullOrUndefined(i)&&i>=0&&(this.currentView()=="customview"?this.currentDate(new Date(this._dateRender[0])):this.currentDate(new Date(this._dateRender[i])),n=this.element.find(".e-workcells")[i*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)].offsetLeft,r=this.model.workHours.start-this.model.startHour<=0?1:this.model.workHours.start-this.model.startHour,[0,6].indexOf(new Date(this._dateRender[i]).getDay())==-1&&this.currentView()!="customview"&&(this.model.enableRTL?n-=r*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*this.element.find(".e-workcells").width():n+=r*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*this.element.find(".e-workcells").width()-this.element.find(".e-workcells").width())))):n=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index()!=-1?this.element.find(".e-workcells")[this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index()*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)].offsetLeft:0,u=this.model.enableRTL?this.element.find(".e-workcells")[0].offsetLeft-n:n,this.element.find("div#"+this._id+"_scroller").ejScroller({scrollLeft:u}))},_minToHour:function(n){return{h:parseInt(n/60),m:n%60}},_onclose:function(){this._appointmentAddWindow.find(".e-error").remove();this._appointmentAddWindow.find(".e-recurEditor").hide();this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).show().animate({"margin-left":10},300);this._clearFields();this._processFocus()},_printAppointment:function(i){var h=t.buildTag("div"),r,c,f,u,s,l,a;typeof i=="object"?r=i:(c=(new t.Query).where("Guid",t.FilterOperators.equal,i),list=new t.DataManager(this._processed).executeLocal(c),list.length>1?(f=n.extend(!0,[],list),f[0][this._appointmentSettings.endTime]=f[f.length-1][this._appointmentSettings.endTime],r=f[0]):r=list[0]);var e="<table align='center' style='margin-top:50px;margin-left:50;'>",o=this,v=["Guid","ParentId","RecurrenceId","RecurrenceExDate","AppTaskId"];return n.each(r,function(n,i){v.indexOf(n)!=-1||t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||n=="null"||((n==o._appointmentSettings.startTime||n==o._appointmentSettings.endTime)&&(i=i),e+="<tr style='height:30px'><td style='width:300px'><b>"+n+":<\/b><\/td><td style='width:600px'>"+i+"<\/td><\/tr>")}),e+="<\/table>",u="",this._tempResource.length!=0&&(t.isNullOrUndefined(r[this._tempResource[this._tempResource.length-1].field])||(s=o._appointmentSettings.resourceFields.split(","),n.each(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource,function(n,t){t.id==r[s[s.length-1].trim()]&&(u=t.text)}))),u=u==""?"Unknown":u,l="<font size='20' style='margin-top:50px;margin-left:50;font-family:Times New Roman'><b>"+u+"<\/b><\/font><\/br><hr style='margin-left:50' size='10'>",a=l+e,h.append(a),t.print(h),!1},_recurrenceValidate:function(n,i,r,u){var f=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),h,s,y,p,o,c,b,l,k,v,e;if(t.isNullOrUndefined(n)||f.recurrenceRuleSplit(n,i),t.isNullOrUndefined(u)?(y=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),h=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(y[0],10),parseInt(y[1],10)))):h=u,t.isNullOrUndefined(r)?(p=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),s=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(p[0],10),parseInt(p[1],10)))):s=r,o=t.isNullOrUndefined(r)?this._appointmentAddWindow.find(".recurstartdate").ejDatePicker("option","value"):r,c=f._rRule.interval,t.isNullOrUndefined(f._rRule.until))if(t.isNullOrUndefined(f._rRule.count))recurEndDate=new Date(new Date(this.currentDate()).setDate(o.getDate()+42*c));else switch(f._rRule.freq){case"DAILY":recurEndDate=new Date(new Date(o).setDate(o.getDate()+f._rRule.count*c));break;case"WEEKLY":b=f._rRule.weekDays.split(",");l=o.getDate()+f._rRule.count/b.length*7*c;recurEndDate=new Date(new Date(o).setDate(Math.round(l)<l?l+1:l));break;case"MONTHLY":recurEndDate=new Date(new Date(o).setMonth(o.getMonth()+f._rRule.count*c));break;case"YEARLY":recurEndDate=new Date(new Date(o).setFullYear(o.getFullYear()+f._rRule.count*c))}else recurEndDate=new Date(f._rRule.until),recurEndDate.setDate(recurEndDate.getDate()+1);if((recurEndDate-o)/864e5<(f._rRule.freq=="DAILY"?2:f._rRule.freq=="WEEKLY"?7:1))return!0;switch(f._rRule.freq){case"DAILY":return k=f._rRule.interval,(h-s)/36e5>parseInt(k)*24?!1:!0;case"WEEKLY":if(n.split(";")[1].split("=")[0]=="INTERVAL"){var a=f._rRule.weekDays.split(","),g={SU:0,MO:1,TU:2,WE:3,TH:4,FR:5,SA:6},w=[],d=[];for(e=0;e<a.length*(parseInt(f._rRule.interval)+1);e++)w[e]=a.length>e?g[a[e]]:w[e-a.length]+7*parseInt(f._rRule.interval);for(v=w.sort(function(n,t){return n-t}),e=1;e<v.length;e++)d.push(v[e]-v[e-1]);return(h-s)/36e5>Math.min.apply(Math,d)*24?!1:!0}return(h-s)/36e5>24?!1:!0;case"MONTHLY":return h.getTime()>new Date(s).setMonth(s.getMonth()+parseInt(f._rRule.interval))?!1:!0;case"YEARLY":return h.getTime()>new Date(s).setFullYear(s.getFullYear()+parseInt(f._rRule.interval))?!1:!0}return!0},_saveAppointment:function(){var nt,tr,tt,yi,i,ui,pt,wt,rt,o,v,b,pi,bt,kt,y,et,k,ei,fi,h,u,dt,si,oi,ht,c,gt,e,hi,li,bi,ni,ki,di,s,gi,lt,ti,at,vt,yt,d,ii,ci,w,l,p,it,ri,ot,ft,st,f,nr;if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),nt=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),this._currentAction!=""){if(t.isNullOrUndefined(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value"))||t.isNullOrUndefined(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")))return!1;if(start=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),end=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),startTime=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(start[0],10),parseInt(start[1],10))),endTime=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(end[0],10),parseInt(end[1],10))),startTime>endTime)return t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("StartEndError")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.ejDialog("open"),!1}if(this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked")&&nt._recRule!=""&&!t.isNullOrUndefined(nt._recRule)&&this.model.enableRecurrenceValidation&&this._currentAction=="add"&&!this._recurrenceValidate(nt._recRule))return this._alertCreateError(),!1;if(tr=this._sortAppById(this._processed),this._cellClick&&this.model.showQuickWindow){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddForm").validate().form())return!1;if(i={},tt=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,this.model.enableLoadOnDemand&&(tt=this._dataCount),i[this._appointmentSettings.id]=i.AppTaskId=i.ParentId=tt,i[this._appointmentSettings.subject]=this._quickAppointWindow.find(".subject").val(),i[this._appointmentSettings.startTime]=new Date(this.cur_StartTime),i[this._appointmentSettings.endTime]=new Date(this.cur_EndTime),i[this._appointmentSettings.allDay]=this.currentView()==="month"||new Date(this.cur_StartTime).getHours()==0&&new Date(this.cur_EndTime).getHours()==23&&new Date(this.cur_EndTime).getMinutes()==59||this._isCustomMonthView()?!0:!1,this.model.appointmentSettings.applyTimeOffset&&!i[this._appointmentSettings.allDay]&&(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),i[this._appointmentSettings.recurrence]=!1,(!t.isNullOrUndefined(this.model.group)||this._tempResource.length!=0&&t.scheduleFeatures.resources)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&(i=this._getResourceFields(i)),"null"in i&&delete i[null],ht=this._checkAvailability(i),u={appointment:i},this._trigger("actionBegin",{data:u.appointment,requestType:"appointmentSave"})||ht.length>0)return this._showBlockAlert&&ht.length>0&&this._alertBlockError(),t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close"),!1;if(this._trigger("beforeAppointmentCreate",u))return t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close"),!1;for(this._currentAction==t.Schedule.Actions.Add,u.appointment.Guid=this._guidFormatGenerate(),n.extend(!0,yi={},u.appointment),c=this._timeZoneAppointments(yi,""),w=this._dataManager.insert(c,this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u.appointment),new t.DataManager(this._currentAppointmentData).update("AppTaskId",u.appointment),this._appointmentProcessing(u.appointment),this._currentViewAppointments=this._appointmentCount(),ui=this._currentViewAppointments.filter(function(n){return n.Guid==u.appointment.Guid}),pt=0;pt<ui.length;pt++)this._refreshDayAppointments(ui[pt]);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;this._trigger("appointmentCreated",{appointment:u.appointment,requestType:"appointmentSaved"});this._trigger("actionComplete",{data:u.appointment,requestType:"appointmentSave"});this._cellClick=!1;t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close");this._scrollerPosition();!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(f=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(r))f._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(f._dateFormat(r.added),e=0,o=r.added.length;e<o;e++)u.appointment[f._appointmentSettings.id]=r.added[e][f._appointmentSettings.id],u.appointment[f._appointmentSettings.recurrence]||(u.appointment.ParentId=r.added[e][f._appointmentSettings.id]),new t.DataManager(f._processed).update("Guid",u.appointment)}))}else{if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddEditForm").validate().form())return!1;var a,i={},c={},ir=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));for(tt=this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOccurrence?this.model.enableLoadOnDemand?this._dataCount+1:t.isNullOrUndefined(this._appMainId)?parseInt(this._appId):this._appMainId+1:ir[0].AppTaskId,a=n("#"+this._id+"AppointmentAddEditWindow").find("#"+this._id+"_AddEditForm").get(0),wt=[],rt=[],o=0;o<a.length;o++)v=a[o].name,b=n(a[o]),v!=r&&(y=a[o].value,v!=""&&i[v]==null?(v==this._appointmentSettings.id&&(y=y==""?parseInt(tt):parseInt(y)),n(a[o]).hasClass("e-datepicker")?y=b.ejDatePicker("option","value"):n(a[o]).hasClass("e-timepicker")?y=b.ejTimePicker("option","value"):b.data("ejDropDownList")?y=b.ejDropDownList("model.value"):b.data("ejAutocomplete")&&(n(a[o])[0].id==this._id+"categorize"?rt.push(b.data("ejAutocomplete").getSelectedItems()):n(a[o])[0].id.indexOf(this._id+"_ownerfield_")==0&&wt.push(b.data("ejAutocomplete").getSelectedItems())),v!="StartDate"&&v!="EndDate"&&v!="StartTime"&&v!="EndTime"?i[v]=a[o].type!="checkbox"?y:n(a[o]).is(":checked"):c[v]=v=="StartDate"||v=="EndDate"?new Date(y):y):b.data("ejAutocomplete")&&(n(a[o])[0].id==this._id+"categorize"?rt.push(b.data("ejAutocomplete").getSelectedItems()):n(a[o])[0].id.indexOf(this._id+"_ownerfield_")==0&&wt.push(b.data("ejAutocomplete").getSelectedItems())));if(this.startutcValue=this.tempValue=null,this.model.showTimeZoneFields||(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),this.model.categorizeSettings.enable==!0&&this.model.categorizeSettings.allowMultiple!=!0&&(pi=this.model.categorizeSettings,categorizeDataIndex=this._findResourceIndex(pi.dataSource,this.model.categorizeSettings.text,i[this._appointmentSettings.categorize]),rt[0].push(this.model.categorizeSettings.dataSource[categorizeDataIndex]),rt[0].shift()),"null"in i&&delete i[null],bt=this._timeFormat(c.StartTime).split(":"),kt=this._timeFormat(c.EndTime).split(":"),i[this._appointmentSettings.startTime]=new Date(c.StartDate.setHours(parseInt(bt[0],10),parseInt(bt[1],10))),i[this._appointmentSettings.endTime]=new Date(c.EndDate.setHours(parseInt(kt[0],10),parseInt(kt[1],10))),i[this._appointmentSettings.recurrence]&&(i[this._appointmentSettings.recurrenceRule]=nt._recRule),this._publicMethodSave=!0,y=this._timeZoneSavingAppoint(i,c),i=y.obj,et=this._currentAction=="save"?"edit":this._currentAction,k=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),i[this._appointmentSettings.recurrenceRule]!=""&&!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&this.model.enableRecurrenceValidation&&(this._currentAction=="editSeries"||this._currentAction=="editOccurrence"||this._currentAction=="save"))if(this._currentAction=="editOccurrence"){var ct=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],fi=ct[this._appointmentSettings.recurrenceId]==null?ct.ParentId:ct[this._appointmentSettings.recurrenceId],ei=ct[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,g=new t.DataManager(this._processed).executeLocal((new t.Query).where(ei,t.FilterOperators.equal,fi)),rr=(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.endTime].getDate()!=i[this._appointmentSettings.startTime].getDate();rr&&(g=this._recurrenceAppSort(g));var g=this._appointmentRecurrenceSort(g),o=this._recuCollectionIndex(g,ct),ut=this._appointmentSettings;if(o==0?t.isNullOrUndefined(g[o+1])?!1:!(new Date(new Date(g[o+1][ut.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[ut.endTime]).setHours(0,0,0,0)).getTime()):o==g.length-1?!(new Date(new Date(g[o-1][ut.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[ut.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(g[o-1][ut.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[ut.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(g[o+1][ut.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[ut.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else if(!this._recurrenceValidate(i[this._appointmentSettings.recurrenceRule],k[0][this._appointmentSettings.recurrenceExDate]))return this._alertCreateError(),!1;if(this._currentAction==t.Schedule.Actions.EditOccurrence)this._objDate=k,ei=this._objDate[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,e=this._deleteOcurrence(this._objDate[0][ei],new Date(k[0][this._appointmentSettings.startTime])),i[this._appointmentSettings.recurrence]=1,i[this._appointmentSettings.recurrenceRule]=e[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+e[0].ParentId,i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId],i.Guid=this._appUid,i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExDate];else if(this._currentAction==t.Schedule.Actions.EditSeries){if(fi=k[0][this._appointmentSettings.recurrenceId]==null?k[0].ParentId:k[0][this._appointmentSettings.recurrenceId],e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,fi)),!t.isNullOrUndefined(e[0].RecurrenceExDate)&&this._seriesAlert)return this._seriesAlert=!1,t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._alertWindow.find(".e-alertbtn").find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"})),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("SeriesChangeAlert")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.addClass("e-seriesAlert"),this._alertWindow.ejDialog("open"),!1;t.isNullOrUndefined(e[0].RecurrenceExDate)||(this._seriesAlert=!0);i.AppTaskId=e[0].AppTaskId;i[this._appointmentSettings.id]=e[0][this._appointmentSettings.id];i.Guid=this._appUid;tt=e[0].AppTaskId;i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId];i[this._appointmentSettings.recurrenceExDate]=null;i[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(nt._recRule)||nt._recRule==""?e[0][this._appointmentSettings.recurrenceRule]:nt._recRule}if(this._currentAction!=t.Schedule.Actions.Add){if(i.Guid=k[0].Guid,i.AppTaskId=k[0].AppTaskId,i[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?k[0][this._appointmentSettings.id]:i[this._appointmentSettings.id],h=n.extend(h,i),this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:et}))return this._appointmentAddWindow.ejDialog("close"),!1}else if(i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,this._trigger("actionBegin",{data:i,requestType:"appointmentSave"}))return this._appointmentAddWindow.ejDialog("close"),!1;if(u=[],this._startTimezone!=this._endTimezone?i[this._appointmentSettings.endTime]=y.cloneEnddiffer:"",parId=this._currentAction==t.Schedule.Actions.Add?tt:k[0].ParentId,!t.isNullOrUndefined(this.model.categorizeSettings)&&rt.length>0&&!t.isNullOrUndefined(rt[0][0])||this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?u=this._getResCategorySaveData(rt,wt,i,tt,parId,bt,kt):(dt=this._addAppData(i,tt,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),parId),this._currentAction==t.Schedule.Actions.EditOccurrence&&(dt[this._appointmentSettings.id]=dt.AppTaskId),u.push(dt)),this._currentAction==t.Schedule.Actions.Add&&this._trigger("beforeAppointmentCreate",{appointment:u,currentAction:et}))return this._appointmentAddWindow.ejDialog("close"),!1;if(this._currentAction!=t.Schedule.Actions.Add){if(this._currentAction!=t.Schedule.Actions.EditOccurrence)oi=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.notEqual,h[this._appointmentSettings.id])),si=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,h[this._appointmentSettings.id]));else for(s=0;s<u.length;s++)si=new t.DataManager(u).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,h[this._appointmentSettings.id])),oi=new t.DataManager(u).executeLocal((new t.Query).where("ParentId",t.FilterOperators.notEqual,h[this._appointmentSettings.id]));if(_batch={added:oi,changed:si},this._trigger("beforeAppointmentChange",{appointment:_batch,currentAction:et}))return this._appointmentAddWindow.ejDialog("close"),!1}if(ht=this._checkAvailability(u[0]),u[this._appointmentSettings.startTime]>u[this._appointmentSettings.endTime]||ht.length>0)return this._showBlockAlert&&this._alertBlockError(),!1;if(this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOccurrence){for(c=[],d=0;d<u.length;d++)gt=u[d][this._appointmentSettings.startTimeZone],gt!=this.model.timeZone?c.push(this._timeZoneAppointments(u[d],"")):c.push(u[d]),new t.DataManager(this._currentAppointmentData).update("AppTaskId",u[d]);e=[];this._currentAction==t.Schedule.Actions.EditOccurrence&&(hi=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,this._parentId)),new t.DataManager(this._currentAppointmentData).update("AppTaskId",hi[0]),e.push(this._timeZoneAppointments(hi[0],"")));var ci=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:c,changed:e,deleted:[]},ci,this.model.appointmentSettings.query._fromTable),wi=[];for(l=0;l<c.length;l++)wi=gt!=this.model.timeZone?this._timeZoneAppointments(c[l],"reverse"):c[l],new t.DataManager(this._currentAppointmentData).update("AppTaskId",wi);for(li=[],l=0;l<e.length;l++)li=gt!=this.model.timeZone?this._timeZoneAppointments(e[l],"reverse"):e[l],new t.DataManager(this._currentAppointmentData).update("AppTaskId",li);for(p=0,bi=u.length;p<bi;p++)for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u[p]),ni=this._processed.filter(function(n){return n.Guid==u[p].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ni},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ni},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ni},"Guid"),this._maxId=t.isNullOrUndefined(this._maxId)?u[p].AppTaskId:this._maxId,this._appointmentProcessing(u[p]),this._currentViewAppointments=this._appointmentCount(),ot=this._currentViewAppointments.filter(function(n){return n.ParentId==u[p].ParentId}),ft=0,st=ot.length;ft<st;ft++)this._refreshDayAppointments(ot[ft]);this._trigger("appointmentCreated",{appointment:u[0],requestType:"appointmentSaved"});this._trigger("actionComplete",{data:u,requestType:"appointmentSave"});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(f=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(r))f._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(f._dateFormat(r.added),e=0,o=r.added.length;e<o;e++)u[0][f._appointmentSettings.id]=r.added[e][f._appointmentSettings.id],u[0][f._appointmentSettings.recurrence]||(u[0].ParentId=r.added[e][f._appointmentSettings.id]),new t.DataManager(f._processed).update("Guid",u[0])}))}else if(this._currentAction==t.Schedule.Actions.Save||this._currentAction==t.Schedule.Actions.EditSeries){var ai=[],h=[],vi=[];for(s=0;s<u.length;s++)ki=this._currentAction==t.Schedule.Actions.Save?u[s].Guid:u[s][this._appointmentSettings.recurrenceId],di=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId,e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(di,t.FilterOperators.equal,ki)),!t.isNullOrUndefined(e)&&e.length>0?h.push(u[s]):ai.push(u[s]);if(this._currentAction==t.Schedule.Actions.EditSeries)for(s=0;s<h.length;s++)for(gi=new t.DataManager(this._currentAppointmentData).executeLocal(t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+u[s][this._appointmentSettings.recurrenceId],!0))),vi=vi.concat(gi),this._appointmentAddWindow.find(".recurbutton").click(),h[s][this._appointmentSettings.recurrenceRule]=nt._recRule,h[s][this._appointmentSettings.recurrenceExDate]=null,new t.DataManager(this._currentAppointmentData).remove("ParentId",h[s].ParentId),lt=this._processed.filter(function(n){return n.ParentId==h[s].ParentId}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:lt},"Guid"),ti=this._appointmentCount(lt),at=0,st=ti.length;at<st;at++)this._appointmentRemove(ti[at]),this._refreshDayAppointments(ti[at]);for(vt=[],yt=[],d=0;d<ai.length;d++)vt.push(this._timeZoneAppointments(ai[d],""));for(ii=0;ii<h.length;ii++)yt.push(this._timeZoneAppointments(h[ii],""));for(ci=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:vt,changed:yt,deleted:vi},ci,this.model.appointmentSettings.query._fromTable),l=0;l<vt.length;l++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(vt[l],"reverse"));for(p=0;p<yt.length;p++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(yt[p],"reverse"));if(h.length>0){for(it=0;it<u.length;it++)for(new t.DataManager(this._currentAppointmentData).remove("Guid",u[it]),ri=this._processed.filter(function(n){return n.Guid==u[it].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ri},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ri},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ri},"Guid"),this._currentAppointmentData.push(u[it]),this._appointmentProcessing(u[it]),this._appointmentRemove(u[it]),this._currentViewAppointments=this._appointmentCount(),ot=this._currentViewAppointments.filter(function(n){return n.ParentId==u[it].ParentId}),ft=0,st=ot.length;ft<st;ft++)this._refreshDayAppointments(ot[ft]);this._trigger("appointmentChanged",{appointment:h[0],requestType:"appointmentChanged",currentAction:et});this._trigger("actionComplete",{data:h,requestType:"appointmentEdit",currentAction:et});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(f=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(r))f._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(f._dateFormat(r.added),e=0,o=r.added.length;e<o;e++)u[0][f._appointmentSettings.id]=r.added[e][f._appointmentSettings.id],u[0][f._appointmentSettings.recurrence]||(u[0].ParentId=r.added[e][f._appointmentSettings.id])}))}}this._clearFields();this._appointmentAddWindow.ejDialog("close")}this.element.find("div.e-draggableworkarea tr").find("td").hasClass("e-selectedCell")&&this._processFocus();this.model.orientation=="horizontal"&&this.currentView()!="agenda"&&this.element.find(".e-draggableworkarea").offset().top>this.element.find(".e-workcellstab").offset().top&&(nr=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-nr+"px"));this._recRule="";this.model.showAppointmentNavigator&&this._nextPrevButton()},_alertCreateError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("CreateError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_timeZoneSavingAppoint:function(n,i){var s,f,r,e;if(this.model.appointmentSettings.applyTimeOffset){if(this._startTimezone=n[this._appointmentSettings.startTimeZone],this._endTimezone=n[this._appointmentSettings.endTimeZone],!t.isNullOrUndefined(this._startTimezone)&&this._startTimezone!=""){var o=this._startTimezone.indexOf("UTC")!=-1?this._startTimezone.split(" ")[1].split(":"):this._startTimezone.split(":"),l=parseInt(o[0]),a=parseInt(o[1]),u=l*60+a;if(this.model.timeZone==null?(s=(new Date).getTimezoneOffset()-this._timeZoneOffset,r=this._minToHour(s+u)):(f=this.model.timeZone.indexOf("UTC")!=-1?this.model.timeZone.split(" ")[1].split(":"):this.model.timeZone.split(":"),r=this._minToHour(u),r.h=r.h-parseInt(f[0]),r.m=r.m-parseInt(f[1])),new Date(n[this._appointmentSettings.startTime].setHours(n[this._appointmentSettings.startTime].getHours()-r.h,n[this._appointmentSettings.startTime].getMinutes()-r.m)),this._startTimezone!=this._endTimezone&&this._publicMethodSave){this.startutcValue=null;this.tempValue=null;var h=this._endTimezone.indexOf("UTC")!=-1?this._endTimezone.split(" ")[1].split(":"):this._endTimezone.split(":"),v=parseInt(h[0]),y=parseInt(h[1]),p=v*60+y,w=u-p,b=new Date(i.StartDate),k=new Date(n[this._appointmentSettings.startTime]),c=new Date(i.EndDate);duration=new Date(c.setMinutes(c.getMinutes()+w));duration=new Date(duration.setMinutes(duration.getMinutes()-(r.h*60+r.m)));e=duration}else new Date(n[this._appointmentSettings.endTime].setHours(n[this._appointmentSettings.endTime].getHours()-r.h,n[this._appointmentSettings.endTime].getMinutes()-r.m))}return{obj:n,cloneEnddiffer:e}}return{obj:n,cloneEnddiffer:e}},_renderAllDayAppointments:function(){var s=this.element.find(".e-workcells").width()-20,f,r,o,e,i,u,n;if(this.level=0,f=this._dateRender,this._renderedAllDay=[],allDayCount=[],this.element.find(".e-alldayappointment").remove(),r=this._appointmentSort(this._processed),this.model.group||(this.res1=["0"]),this._resWorkWeek)for(o=0,e=0,i=0;i<this.res1.length;i++)for(o+=t.isNullOrUndefined(this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,e;e<o;e++)for(n=0;n<r.length;n++)this._getMultipleResourceAlldayApp(f,e,i,n),t.isNullOrUndefined(this.allDayCount[0])?"":allDayCount.push(this.allDayCount[0]);else for(i=0;i<this.res1.length;i++)for(u=0;u<f.length;u++)for(n=0;n<r.length;n++)this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?(this._getMultipleResourceAlldayApp(f,u,i,n),t.isNullOrUndefined(this.allDayCount[0])?"":allDayCount.push(this.allDayCount[0])):t.format(new Date(f[u]),this._pattern.d,this.model.locale)==t.format(new Date(r[n][this._appointmentSettings.startTime]),this._pattern.d,this.model.locale)&&(r[n][this._appointmentSettings.allDay]===!0||this._findAllDayApp(r[n]))&&(this._setAllDayPos(r[n],u,i),allDayCount.push(n));this.allDayLevel=allDayCount.length;allDayCount.length==0&&this.level==0&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"));this._reRenderScroller()},_renderSingleApp:function(){this.element.find(".e-prevapp,.e-nextapp").css("display","none");this._dataProcessing(this._currentAppointmentData);this._renderAppointmentAll()},_timeFormat:function(n){var e=t.parseDate(n,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale),i,r,o,u,f;return e?(i=e.getHours(),r=e.getMinutes()):(i=Number(n.match(/^(\d+)/)[1]),r=Number(n.match(/:(\d+)/)[1]),t.isNullOrUndefined(n.split(" ")[1])||(o=n.match(/\s(.*)$/)[1],t.isNullOrUndefined(this._culture.calendar.AM)||t.isNullOrUndefined(this._culture.calendar.PM)||(o==this._culture.calendar.PM[0]&&i<12&&(i=i+12),o==this._culture.calendar.AM[0]&&i==12&&(i=i-12)))),u=i.toString(),f=r.toString(),i<10&&(u="0"+u),r<10&&(f="0"+f),u+":"+f},_processEscapeKey:function(){t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.find(".e-error").remove();this._processFocus();this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")},_processFocus:function(){var h=this.element.find("div.e-selectedAppointment"),s,a;if(h.length!=0&&h.focus(),this.element.find("td.e-selectedCell").hasClass("e-workcells")){var u=this.element.find("div.e-draggableworkarea tr"),c=u.length-1,r,i,l,e,f,o=this.currentView(),v=this;this.element.find("td.e-selectedCell").each(function(t,s){var h=n(s).index(),a;if(h!=null&&!isNaN(h))if(r==null?(r=h,l=n(s).parent()[0].rowIndex):r<h?r=r:r!=h&&(r=h,l=n(s).parent()[0].rowIndex),i==null){if(i=h,o!="month")for(f=parseInt(i),a=0;a<=c;a++)n(u[a].cells[f]).hasClass("e-selectedCell")&&(e=a)}else if(i>h)i=i;else if(i!=h&&(i=h,o!="month"))for(f=parseInt(i),a=0;a<=c;a++)n(u[a].cells[f]).hasClass("e-selectedCell")&&(e=a)});o!="month"?n(u[e].cells[i]).attr("tabIndex",0).focus():(s=u.find("td.e-selectedCell"),a=parseInt(s.length)-1,n(s[a]).attr("tabIndex",0).focus())}else this.element.focus(),this.element.find("td.e-selectedCell").attr("tabIndex",0).focus(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("isOpened")&&this._appointmentAddWindow.find(".subject").focus()},_clearFields:function(){this._appointmentAddWindow.find(".subject").val("");this._appointmentAddWindow.find(".id").val("");this._appointmentAddWindow.find(".e-description").val("").css("height","");this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",new Date);this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",new Date);this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0});this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date,this._pattern.t,this.model.locale));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date,this._pattern.t,this.model.locale));this._appointmentAddWindow.find(".recurrence,.weekdays").ejCheckBox({checked:!1,enabled:!0});this._appointmentAddWindow.find(".e-repeatlbl").removeClass("e-disable");this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1});this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList("clearText");this._appointmentAddWindow.find("."+this._id+"summary").css("display","none");this._appointmentAddWindow.find(".e-recurFinalRule").html("");this._appointmentAddWindow.find(".e-recuredit").hide();this._appointmentAddWindow.find(".e-categorizevalue").ejAutocomplete("clearText")},_getNumericModel:function(){return numericModel={width:"100px",minValue:1,value:1,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,localize:this.model.locale}},_deleteApp:function(i){var s=this._actionType==t.Schedule.Actions.DeleteSeries?t.Schedule.Actions.DeleteSeries:t.Schedule.Actions.Delete,r,f,e,h,c,o,v,u,y,p;if(this._trigger("actionBegin",{id:i,requestType:"appointmentDelete",currentAction:s})||(r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i)),r.length==0)||this._trigger("beforeAppointmentRemove",{appointment:r[0],currentAction:s}))return!1;if(f=this._getAppointmentByParentId(i),f[this._appointmentSettings.recurrence])var l=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],a=r[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,w=t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(a,t.FilterOperators.equal,l)),e=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:[],changed:[],deleted:w},e,this.model.appointmentSettings.query._fromTable);else e=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.remove(e,f[e],this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove(e,f[e]);if(this._refreshCellsHeight(),this.currentView()!="agenda")if(this._currentAppointmentData.length>0)for(u=r[0][this._appointmentSettings.recurrence]?this._processed.filter(function(n){return n[a]==l}):this._processed.filter(function(n){return n.Guid==i}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:u},"Guid"),c=this._appointmentCount(u),o=0,v=c.length;o<v;o++)this._appointmentRemove(c[o]),this._refreshDayAppointments(c[o]);else this._processed=[],this._renderedApp=[],this._renderedAllDay=[],this.element.find("div.e-appointwrapper").remove(),this._appointmentRemove(r[0]),this._refreshDayAppointments(r[0]);else new t.DataManager(this._processed).remove("Guid",i),u=new t.DataManager(this._processed).executeLocal((new t.Query).where(t.Predicate("ParentId",t.FilterOperators.equal,r[0].ParentId))),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:u},"Guid"),this._renderAgendaContent();this._trigger("appointmentRemoved",{appointment:f,requestType:"appointmentDeleted",currentAction:s});this._trigger("actionComplete",{data:f,requestType:"appointmentDelete",currentAction:s});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&(y=this,h.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&y._processUrlBinding(i)}));this.model.timeScale.enable&&((r[0][this._appointmentSettings.endTime]-r[0][this._appointmentSettings.startTime])/36e5>24||r[0][this._appointmentSettings.allDay])&&this.currentView()!="month"&&!this._isCustomMonthView()&&this.currentView()!="agenda"&&this.allDayLevel==0&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this._reRenderScroller());this._currentViewAppointments=this._appointmentCount();this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.showOverflowButton||this.model.orientation!="horizontal"||this.currentView()=="agenda"||(p=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-p+"px"));this._appUid=null;this._actionType=""},_appointmentCount:function(n){var i=this.model.orientation=="horizontal"&&(this.currentView()=="month"||this._isCustomMonthView())?this.monthDays:this._resWorkWeek?this._renderDates:this._dateRender,u=t.isNullOrUndefined(n)?this._appointmentSort(this._processed):n,r=this.currentView()=="agenda"?new Date(new Date(this.currentDate()).setHours(0,0,0)):new Date(i[0]),f=this.currentView()=="agenda"?new Date(new Date(new Date(this.currentDate()).setDate(r.getDate()+(this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0))).setHours(23,59,59)):new Date(new Date(i[i.length-1]).setHours(23,59,59)),e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,r).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,f);return new t.DataManager(u).executeLocal((new t.Query).where(e))},_reRenderAllDayAppointments:function(){this._alldayLevel=this.level==1?!0:!1;this.model.showAllDayRow&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments();this._bindAppointmentAction()},_appointmentResizeStart:function(i){if(this.model.enableAppointmentResize){this._tooltipEvents("disable");this._appointdata=n(i.target).parent();var u=n(i.target).parent().attr("guid"),f=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,u))),r={element:n(i.target).parent(),appointment:f[0]};if(this._trigger("actionBegin",{data:r,requestType:"appointmentResize"})||this._trigger("resizeStart",r))return this._tooltipEvents("enable"),!1;i.preventDefault();!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this.resizeStart=!0;n(i.target).hasClass("e-lefthandle")||n(i.target).hasClass("e-righthandle")?(this.resize=i.pageX,this.appoint_width=n(i.target).parent().width(),this.appoint_left=parseInt(n(i.target).parent()[0].style.left),this._appointleft=parseInt(n(n(i.target).parent()[0]).offset().left),this._appointright=parseInt(n(n(i.target).parent()[0]).css("right")),this.model.orientation=="horizontal"&&this.model.enableRTL?n(i.target).hasClass("e-lefthandle")?this._rightResizing=!0:this._leftResizing=!0:n(i.target).hasClass("e-lefthandle")?this._leftResizing=!0:this._rightResizing=!0):(n(i.target).hasClass("e-tophandle")||n(i.target).hasClass("e-bottomhandle"))&&(this.resize=i.pageY,this.appoint_height=n(i.target).parent().height(),this.appoint_top=parseInt(n(i.target).parent()[0].style.top),n(i.target).hasClass("e-tophandle")?this._topResizing=!0:this._bottomResizing=!0);this._curElmt=n(i.target).parent();this.element.find(".e-workcells").removeClass("e-selectedCell,e-mousehover");n(document).on(t.eventType.mouseMove,n.proxy(this._appointmentResizing,this));n(document).on(t.eventType.mouseUp,n.proxy(this._appointmentResizeStop,this));if(n(i.target).hasClass("e-rowcursor")||n(i.target).hasClass("e-columncursor"))return!1}},_appointmentResizing:function(i){var o=n(i.target),u={element:o.parent(),interval:10},r,f,e;t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");r=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-alldayappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");n(".e-scheduleAppGlassy").length==0&&(r.find(".e-schedulemouseclose").addClass("e-schedulemouseclosetemp").removeClass("e-schedulemouseclose e-icon"),r.clone().prop("id","cloneElement").appendTo(r.parent()),r.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose").appendTo(r.parent()),this._topResizing||this._bottomResizing?(this.model.enableRTL?r.css("right","0"):r.css("left","0"),r.css("width","98%")):(this._rightResizing||this._leftResizing)&&(this.model.orientation!="horizontal"?this.currentView()==="month"||this._isCustomMonthView()?this._appointmentResizeHeight(r,-this.element.find(".e-monthheader").height(),"e-monthcells"):this.model.timeScale.enable?(r.css("top",this.element.find(".e-headerarearow").height()-this.element.find(".e-alldaycells").height()-2),r.css("height",this.element.find(".e-alldaycells").height()-2)):r.css("height",this.element.find(".e-monthcells").height()-2):this._appointmentResizeHeight(r,0,"e-workcells")));r=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-monthcells")||n(i.target).hasClass("e-alldayappointment")||n(i.target).hasClass("e-alldaycells")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");f=this.element.find(".e-workcells").height();e=n(r[0]).height()/f;this._topResizing?e>0&&!n(i.target).hasClass("e-alldaycells")&&!n(i.target).hasClass("e-apptext")&&(this._curElmt.height(this.appoint_height+this.resize-i.pageY+3),this._curElmt.css("top",this.appoint_top-(this.resize-i.pageY)-3)):this._bottomResizing?this._curElmt.height(this.appoint_height+(i.pageY-this.resize)+2):this._rightResizing?this.model.orientation=="horizontal"&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+this.resize-i.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-i.pageX)-3)):(this._curElmt.width(this.appoint_width+(i.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(i.pageX-this.resize)-2)):this._leftResizing&&(this.model.orientation=="horizontal"&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+(i.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(i.pageX-this.resize)-2)):(this._curElmt.width(this.appoint_width+this.resize-i.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-i.pageX)-3)));this._trigger("resize",u);this._resizeInterval=u.interval;this._curElmt.hasClass("e-appointment")&&this._appointmentCurrentTimeUpdate()},_appointmentResizeHeight:function(t,i,r){if(t.length>0){var u=this.model.showOverflowButton?this.element.find("."+r):t.closest("td");t.css("top",i).css("height",n(u).height()-2)}},_appointmentCurrentTimeUpdate:function(){var a=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(this._curElmt.attr("id").split("_")[1])))[0],r=new Date(a[this._appointmentSettings.startTime]),i=new Date(a[this._appointmentSettings.endTime]),s=this.element.find(".e-workcells").outerHeight(),h=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),w,o,b,l,d,u;if(this.currentView()!=="month"&&!this._isCustomMonthView())var e=this.element.find(".e-draggableworkarea"),g=n(this._curElmt[0]).offset().top,v=e.height()+e.scrollTop(),nt=n(this._curElmt[0]).outerHeight(),y=g-e.offset().top+e.scrollTop(),p=y-s/this.model.timeScale.minorSlotCount<v?y:v-nt;if(this._topResizing)o=p*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*s),r.setHours(parseInt(this.model.startHour)+parseInt(o/60)),r.setMinutes(parseInt(o%60)),h>=this._resizeInterval?r.setMinutes(Math.round(r.getMinutes()/this._resizeInterval)*this._resizeInterval):r.setMinutes(r.getMinutes()/this._resizeInterval*this._resizeInterval);else if(this._bottomResizing)w=n(this._curElmt[0]).outerHeight()/s,o=(p+w*s)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*s),i.setHours(parseInt(this.model.startHour)+parseInt(o/60)),i.setMinutes(o%60),h>=this._resizeInterval?i.setMinutes(Math.round(i.getMinutes()/this._resizeInterval)*this._resizeInterval):i.setMinutes(i.getMinutes()/this._resizeInterval*this._resizeInterval);else if(this._rightResizing){if(b=this.model.endHour-this.model.startHour==24?this._curElmt.width()-this.appoint_width:this._curElmt.width(),u=b*60/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),this.model.endHour-this.model.startHour==24?(i.setHours(new Date(i).getHours()+parseInt(u/60)),i.setMinutes(new Date(i).getMinutes()+parseInt(u%60))):(i.setHours(new Date(r).getHours()+parseInt(this._curElmt.width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),i.setMinutes(new Date(r).getMinutes()+parseInt(u%60))),h>=this._resizeInterval?i.setMinutes(Math.round(i.getMinutes()/this._resizeInterval)*this._resizeInterval):i.setMinutes(i.getMinutes()/this._resizeInterval*this._resizeInterval),i>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))&&(i=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))),this.model.endHour-this.model.startHour!=24){var tt=parseInt((this._curElmt.offset().left+(e.scrollLeft()-e.offset().left)+this._curElmt.width())/this.element.find(".e-workcells").width())-1,c=parseInt(tt/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),it=new Date(r),k=new Date(i).getHours()>=this.model.endHour?(this._dateRender[c]-new Date(new Date(new Date(r).setHours(0,0,0,0))).getTime())/864e5:0,rt=this.currentView()=="workweek"?(k-1)*(this.model.endHour-this.model.startHour):0,f=new Date(i).getHours()>=this.model.endHour?new Date(new Date(it).setHours(new Date(r).getHours()+rt+parseInt(n(this._curElmt).width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))+k*(24-this.model.endHour+this.model.startHour))):i;new Date(i).getHours()>=this.model.endHour&&f.setMinutes(new Date(r).getMinutes()+parseInt(u%60));new Date(new Date(f).setHours(0,0,0,0)).getTime()!=new Date(this._dateRender[c]).getTime()&&(f=new Date(this._dateRender[c]).setHours(new Date(f).getHours(),new Date(f).getMinutes(),new Date(f).getSeconds(),new Date(f).getMilliseconds()));i=new Date(f)}}else this._leftResizing&&(l=n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left<n(this._curElmt).offset().left?this._curElmt.offset().left-this._appointleft:n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left-this._appointleft,this.model.enableRTL&&(d=this._curElmt.width()-this.appoint_width,l=-d),u=l*60/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),r.setHours(parseInt(new Date(r).getHours())+parseInt(u/60)),r.setMinutes(new Date(r).getMinutes()+parseInt(u%60)),h>=this._resizeInterval?r.setMinutes(Math.round(r.getMinutes()/this._resizeInterval)*this._resizeInterval):r.setMinutes(r.getMinutes()/this._resizeInterval*this._resizeInterval),r<new Date(this._dateRender[0])&&(r=new Date(this._dateRender[0])));this.model.enableRTL?(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","left").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px")):(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","right").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px"));this._resizeNewStartTime=r;this._resizeNewEndTime=i},_leftRightResize:function(t,i,r,u,f,e){var s=this._leftResizing?f:e,o=this._leftResizing?e:f,p,l,v,a,y,h,b,c;if(this._resWorkWeek?(h=i.offset(),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none"),p=this._leftResizing?t.elementFromPoint(h.left-n(t).scrollLeft(),h.top-n(t).scrollTop()):t.elementFromPoint(h.left+i.width()-n(t).scrollLeft(),h.top-n(t).scrollTop()),l=this._leftResizing?Math.floor(i.offset().left/this.element.find(".e-alldaycells").width())-Math.floor(i.width()/this.element.find(".e-alldaycells").width()):Math.floor(i.offset().left/this.element.find(".e-alldaycells").width())+Math.floor(i.width()/this.element.find(".e-alldaycells").width()),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible")):l=this._leftResizing?r*u:r==this.res1.length-1?(r+1)*u-1:(r+1)*u,this.model.enableRTL)if(this._resWorkWeek){y=n.extend(!0,[],this._dateRender);y.reverse();h=i.offset();this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none");var p=this._rightResizing?t.elementFromPoint(h.left-n(t).scrollLeft(),h.top-n(t).scrollTop()):t.elementFromPoint(h.left+i.width()-n(t).scrollLeft(),h.top-n(t).scrollTop()),w=n.grep(p,function(t){if(n(t).closest("td").hasClass("e-alldaycells"))return t}),l=this.element.find(".e-alldaycells").length-1-n(w[0]).index();this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible");newEndTime=new Date(y[l]);newEndTime.setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())}else b=n(i[0]).width()-this.appoint_width,c=Math.round(n(i[0]).width()/this.element.find(".e-alldaycells").width())-1,newEndTime=this._rightResizing?new Date(e):new Date(s),this._rightResizing?newEndTime.setDate(new Date(newEndTime).getDate()-c):newEndTime.setDate(new Date(newEndTime).getDate()+c),newEndTime.setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()),newEndTime>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()))?newEndTime=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())):newEndTime<new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()))&&(newEndTime=new Date(new Date(this._dateRender[0]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())));else this._rightResizing?(a=i[0].offsetLeft+n(i[0]).width(),this._resWorkWeek||(c=Math.floor(a/this.element.find(".e-alldaycells").width())-r*u),v=r==this.res1.length-1?n(this.element.find(".e-alldaycells")[l]).offset().left+this.element.find(".e-alldaycells").width():n(this.element.find(".e-alldaycells")[l]).offset().left):(a=n(this.element.find(".e-alldaycells")[l]).offset().left,v=n(i[0]).offset().left),v>=a?(newStartTime=new Date(this._dateRender[0]),!this._resWorkWeek&&this._leftResizing&&(a=n(i[0]).offset().left-n(this.element.find(".e-alldaycells")[r*u]).offset().left,c=Math.round(a/(this.element.find(".e-alldaycells").width()+1))),this.model.workWeek.length>0?this._resWorkWeek?(newStartTime=new Date(this._dateRender[l]),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(this._dateRender[c]).getDate()),newStartTime.setMonth(new Date(this._dateRender[c]).getMonth()),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(newStartTime).getDate()+(c>=u?c-1:c)),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds()))):(this._rightResizing?this._rightResizing=!1:this._leftResizing=!1,this.model.enableRTL?newEndTime=e:newStartTime=f);return this.model.enableRTL?newEndTime:newStartTime},_appointmentResizeStop:function(i){var ct,hi,ni,ti,fr,er,pt,ii,vi,s,bt,yt,ri,v,k,wt,ui,o,pi,ei,lt,wi,bi,oi,si,rt,tt,c,l,ot,kt,it,d,dt,ki,gt,st,i,ht,g;this._tooltipEvents("enable");try{ct=this.element.find(".e-draggableworkarea");this.resizeStart=!1;n(document).off(t.eventType.mouseMove,n.proxy(this._appointmentResizing,this));n(document).off(t.eventType.mouseUp,n.proxy(this._appointmentResizeStop,this));var u=this._appointmentSettings,di=this.element.find(".e-workcellstab"),gi=di.find("tr").length*this.element.find(".e-workcells").height(),h=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-alldayappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");h.length==0&&(h=this._appointdata);h.attr("guid")!=this._appointdata.attr("guid")&&(h=this._appointdata);this._appUid=h.attr("guid");var a=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),et=a.length>1?!0:!1,w=a[0][u.recurrence]&&a[0][u.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):a[0][u.recurrence]?a[0]:this._getAppointmentByParentId(this._appUid),b=this.currentView()==="week"||this.currentView()==="month"||this._isCustomMonthView()?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="workweek"&&this.model.workWeek.length>0?this.model.workWeek.length:1;if(b=this.currentView()=="customview"&&this._renderDays<=7?this._renderDays:b,this._resWorkWeek&&(ni=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,a[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]])),hi=t.isNullOrUndefined(ni[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:ni[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],b=hi.length),w!=null||w!==r){var lr=w[this._appointmentSettings.startTime].getDate()<new Date(w[this._appointmentSettings.endTime]).getDate()?!0:!1,e=new Date(w[this._appointmentSettings.startTime]),f=new Date(w[this._appointmentSettings.endTime]);et&&a[0][u.recurrence]?(ti=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,a[0].Guid))),e=new Date(ti[0][this._appointmentSettings.startTime]),f=new Date(ti[1][this._appointmentSettings.endTime])):a[0][u.recurrence]&&(e=new Date(a[0][this._appointmentSettings.startTime]),f=new Date(a[0][this._appointmentSettings.endTime]));this.element.find("[guid="+a[0].Guid+"]").removeClass("e-selectedAppointment");var y=w[this._appointmentSettings.startTime],p=w[this._appointmentSettings.endTime],ci=n(h[0]).outerHeight(),vt=this.element.find(".e-workcells").outerHeight();if(this.currentView()!=="month"&&!this._isCustomMonthView())var nr=n(h[0]).offset().top,li=ct.height()+ct.scrollTop(),ai=nr-ct.offset().top+ct.scrollTop(),ut=ai-vt/this.model.timeScale.minorSlotCount<li?ai:li-ci;ut=t.isNullOrUndefined(ut)?0:ut;var tr=n(h[0]).outerHeight()/vt,ir=(ut+tr*vt)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*vt)/30,rr=ci-parseInt(ir),ur=ut+rr;if(this._topResizing)fr=this._topResizing,ut>0?e=this._resizeNewStartTime:e.setHours(0,0,0),this._topResizing=!1;else if(this._bottomResizing)er=this._bottomResizing,ut>=0&&ur<gi?f=this._resizeNewEndTime:f.setHours(23,59,59),this._bottomResizing=!1;else if(this._leftResizing){if(this.model.orientation=="vertical"){if(s=this.model.group?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,w[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-1].trim()]):0,this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable)this.model.enableRTL?f=this._leftRightResize(document,h,s,b,y,p):e=this._leftRightResize(document,h,s,b,y,p);else if(yt=this.model.enableRTL?n(this.element.find(".e-monthcells")[(s+1)*b-1]).offset().left:n(this.element.find(".e-monthcells")[s*b]).offset().left,n(h[0]).offset().left>yt)if(this.model.enableRTL)if(this.model.showWeekend)v=Math.round((n(h[0]).width()-this.appoint_width)/this.element.find(".e-monthcells").width()),f.setDate(new Date(f).getDate()+v),f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds());else{for(pt=this._getWeekDays();pt.indexOf(f.getDay())<0;)f=new Date(new Date(f).getTime()+864e5);k=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0))+v;f=new Date(this._dateRender[k]);f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds())}else if(this._resize=!0,e=new Date(this._firstweekdate(new Date(a[0][u.startTime]))),this._resize=!1,v=Math.round((n(h[0]).offset().left-n(this.element.find(".e-monthcells")[s*b]).offset().left)/this.element.find(".e-monthcells").width()),this.model.showWeekend)e.setDate(e.getDate()+v),e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds());else{for(pt=this._getWeekDays();pt.indexOf(e.getDay())<0;)e=new Date(new Date(e).getTime()+864e5);k=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+v;e=new Date(this._dateRender[k]);e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds())}}else ii=n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left<n(h[0]).offset().left?n(h[0]).offset().left-this._appointleft:n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left-this._appointleft,this.model.enableRTL&&(vi=n(h[0]).width()-this.appoint_width,ii=-vi),this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?(v=Math.round(ii/(this.element.find(".e-workcells").width()+1)),this.model.showWeekend?e.setDate(new Date(e).getDate()+v):(k=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+v,wt=new Date(new Date(this._dateRender[k]).setHours(new Date(e).getHours(),new Date(e).getMinutes(),new Date(e).getSeconds())),e=new Date(wt))):e=this._resizeNewStartTime;this._leftResizing=!1}else this._rightResizing&&(this.model.orientation=="vertical"?(s=this.model.group?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,w[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-1].trim()]):0,this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?this.model.enableRTL?e=this._leftRightResize(document,h,s,b,y,p):f=this._leftRightResize(document,h,s,b,y,p):(bt=this.element.find(".e-monthcells").width(),yt=this.model.enableRTL?n(this.element.find(".e-monthcells")[s*b]).offset().left+bt:s==this.res1.length-1?n(this.element.find(".e-monthcells")[(s+1)*b-1]).offset().left+bt:n(this.element.find(".e-monthcells")[(s+1)*b]).offset().left,yt>=n(h[0]).offset().left+n(h[0]).width()&&(v=Math.round((n(h[0]).width()-this.appoint_width)/bt),this.model.enableRTL?this.model.showWeekend?(e.setDate(new Date(e).getDate()-v),e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds())):(k=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))-v,e=new Date(this._dateRender[k]),e.setHours(new Date(y).getHours(),new Date(y).getMinutes(),new Date(y).getSeconds())):this.model.showWeekend?(f.setDate(new Date(f).getDate()+v),f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds())):(k=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0))+v,f=new Date(this._dateRender[k]),f.setHours(new Date(p).getHours(),new Date(p).getMinutes(),new Date(p).getSeconds()))))):(ri=this.model.endHour-this.model.startHour==24?n(h[0]).width()-this.appoint_width:n(h[0]).width(),this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?(ri=n(h[0]).width()-this.appoint_width,v=Math.round(ri/(this.element.find(".e-workcells").width()+1)),this.model.showWeekend?f.setDate(new Date(f).getDate()+v):(k=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0))+v,wt=new Date(new Date(this._dateRender[k]).setHours(new Date(f).getHours(),new Date(f).getMinutes(),new Date(f).getSeconds())),f=new Date(wt))):f=this._resizeNewEndTime),this._rightResizing=!1);if((e>=f||n(h[0]).width()==0)&&(e=a[0][u.startTime],f=a[0][u.endTime]),e.getTime()==a[0][u.startTime].getTime()&&f.getTime()==a[0][u.endTime].getTime())return this.element.find("#cloneElement").length>0&&(ui=this.element.find(".e-monthappointment").length>1?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),this.model.enableRTL?this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:ui,top:this.element.find("#cloneElement").css("top"),right:this.element.find("#cloneElement").css("right")}):this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:ui,top:this.element.find("#cloneElement").css("top"),left:this.element.find("#cloneElement").css("left")}),this._curElmt.find(".e-apptext").replaceWith(this.element.find("#cloneElement").find(".e-apptext")).prop("style",!1),this._curElmt.find(".e-apptime").html(this.element.find("#cloneElement").find(".e-apptime").text()).prop("style",!1),this._curElmt.css("width",this.element.find("#cloneElement")[0].style.width),this._curElmt.hasClass("e-alldayappointment")&&this._curElmt.height(19),this.element.find("#cloneElement").remove(),n(h[0]).find(".e-schedulemouseclosetemp").addClass("e-schedulemouseclose e-icon").removeClass("e-schedulemouseclosetemp")),!1;this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove();this._refreshCellsHeight();var yi=new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1),or=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),sr=!this.model.showNextPrevMonth&&this.model.orientation=="vertical"&&this.currentView()=="month"?yi.getTime()!=new Date(e.getFullYear(),e.getMonth(),1).getTime()||yi.getTime()!=new Date(f.getFullYear(),f.getMonth(),1).getTime():!1;if(!sr&&f>=new Date(this.model.minDate)&&f<=or)if(w[u.recurrence]==1&&w[u.recurrenceRule].toString().indexOf("RECUREDITID")==-1){var s,ft=!1,fi=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),nt=n.extend(!0,{},fi[0]);nt[this._appointmentSettings.endTime]=fi[fi.length-1][this._appointmentSettings.endTime];var ei=nt[this._appointmentSettings.recurrenceId]==null?nt.ParentId:nt[this._appointmentSettings.recurrenceId],hr=nt[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,c=new t.DataManager(this._processed).executeLocal((new t.Query).where(hr,t.FilterOperators.equal,ei));for(et&&(c=this._recurrenceAppSort(c)),c=this._appointmentRecurrenceSort(c),o=n.extend({},a[0]),et&&(o=n.extend({},c.filter(function(n){return n.Guid==a[0].Guid})[0])),this.model.enableRecurrenceValidation&&o[u.recurrence]&&(s=this._recuCollectionIndex(c,nt)),!this.model.enableRecurrenceValidation||!o[u.recurrence]||(s==0?t.isNullOrUndefined(c[s+1])?!0:new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime():s==c.length-1?new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime())?(prvStartTime=o[u.startTime],prvEndTime=o[u.endTime],o[u.startTime]=new Date(e),o[u.endTime]=new Date(f),ot=this._checkAvailability(o),kt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?{type:i.type}:i,this._trigger("resizeStop",{appointment:o,target:kt})||ot.length>0?(this._showBlockAlert&&ot.length>0&&this._alertBlockError(),o[u.startTime]=new Date(prvStartTime),o[u.endTime]=new Date(prvEndTime),ft=!0):(pi=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,ei=o[u.recurrenceId]==null?o.ParentId:o[u.recurrenceId],this._deleteOcurrence(ei,new Date(nt[u.startTime])),o[u.recurrenceRule]=a[0][u.recurrenceRule]+";RECUREDITID="+o.ParentId,o[u.id]=o.AppTaskId=pi)):(o[u.startTime]=nt[u.startTime],o[u.endTime]=nt[u.endTime],this._alertDragResizeError(),ft=!0),it=[],lt=[],it.push(this._timeZoneAppointments(o,"")),wi=o[this._appointmentSettings.recurrenceId]==null?o.ParentId:o[this._appointmentSettings.recurrenceId],bi=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,wi)),lt.push(this._timeZoneAppointments(bi[0],"")),dt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",ft||(d=this._dataManager.saveChanges({added:it,changed:lt,deleted:[]},dt,this.model.appointmentSettings.query._fromTable)),oi=[],rt=0;rt<it.length;rt++)oi=this._timeZoneAppointments(it[rt],"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",oi);for(si=[],rt=0;rt<lt.length;rt++)si=this._timeZoneAppointments(lt[rt],"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",si);if(ft)for(this._appointmentRemove(o),tt=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:tt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:tt},"Guid"),i=0,ht=tt.length;i<ht;i++)this._refreshDayAppointments(tt[i]);else for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(o),tt=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:tt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:tt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:tt},"Guid"),this._appointmentProcessing(o),this._appointmentRemove(o),this._currentViewAppointments=this._appointmentCount(),st=this._currentViewAppointments.filter(function(n){return n.Guid==o.Guid}),i=0,ht=st.length;i<ht;i++)this._refreshDayAppointments(st[i]);this._trigger("actionComplete",{data:o,requestType:"appointmentResize"});!t.isNullOrUndefined(d)&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(g=this,d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,u,f;if(n.isArray(r))g._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(g._dateFormat(r.added),u=0,f=r.added.length;u<f;u++)o[g._appointmentSettings.id]=r.added[u][g._appointmentSettings.id],new t.DataManager(g._processed).update("Guid",o)}),d.fail(function(){g._renderAppointmentAll()}))}else{var s,ft=!1,cr=et?this._currentAppointmentData:this._processed,at=new t.DataManager(cr).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,w.Guid)),c=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,at[0].ParentId));for(et&&(c=this._recurrenceAppSort(c)),c=this._appointmentRecurrenceSort(c),l=n.extend({},at[0]),this.model.enableRecurrenceValidation&&l[u.recurrence]&&(s=this._recuCollectionIndex(c,at[0])),!this.model.enableRecurrenceValidation||!l[u.recurrence]||(s==0?t.isNullOrUndefined(c[s+1])?!0:new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime():s==c.length-1?new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(c[s-1][u.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[s+1][u.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(f).setHours(0,0,0,0)).getTime())?(prevStartTime=l[u.startTime],prevEndTime=l[u.endTime],l[u.startTime]=e,l[u.endTime]=f,ot=this._checkAvailability(l),kt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?{type:i.type}:i,(this._trigger("resizeStop",{appointment:l,target:kt})||ot.length>0)&&(this._showBlockAlert&&ot.length>0&&this._alertBlockError(),l[u.startTime]=prevStartTime,l[u.endTime]=prevEndTime,ft=!0)):(l[u.startTime]=at[0][u.startTime],l[u.endTime]=at[0][u.endTime],this._alertDragResizeError(),ft=!0),it=this._timeZoneAppointments(l,""),dt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",ft||(d=this._dataManager.update(dt,it,this.model.appointmentSettings.query._fromTable)),ki=this._timeZoneAppointments(it,"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",ki),et?(gt=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,l.Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:gt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:gt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:gt},"Guid"),this._appointmentProcessing(l)):(new t.DataManager(this._processed).update("Guid",l),new t.DataManager(this._renderedApp).remove("Guid",l),new t.DataManager(this._renderedAllDay).remove("Guid",l)),this._appointmentRemove(l),this._currentViewAppointments=this._appointmentCount(),st=this._currentViewAppointments.filter(function(n){return n.Guid==l.Guid}),i=0,ht=st.length;i<ht;i++)this._refreshDayAppointments(st[i]);this._trigger("actionComplete",{data:l,requestType:"appointmentResize"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(d)&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(g=this,d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&g._processUrlBinding(i)}),d.fail(function(){g._renderAppointmentAll()}))}else this._renderAppointmentAll()}this.element.find("div.e-tophandle,div.e-bottomhandle").removeClass("e-rowcursor");this.element.find("div.e-lefthandle,div.e-righthandle").removeClass("e-columncursor")}catch(i){}},_dragdropAppointments:function(){var r,i,u;if(this.model.readOnly)return!1;this._topResizing=!1;this._bottomResizing=!1;this._leftResizing=!1;this._rightResizing=!1;this.model.allowDragAndDrop&&(i=this,u=this.element.find(".e-appointment"),u.ejDraggable({handle:".e-appointment",dragArea:i.model.appointmentDragArea==""?i.element.find("div.e-draggableworkarea",".e-headrealldaytable tr"[!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._grouping.length+1:1]):n(i.model.appointmentDragArea),cursorAt:i.model.appointmentDragArea==""?{top:0,left:0}:{top:-40,left:-40},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-appointment")?n(t.sender.target):n(t.sender.target).parents(".e-appointment"),i._appointElement(r,i)}}),u=this.element.find(".e-alldayappointment"),u.ejDraggable({handle:".e-alldayappointment",dragArea:i.model.appointmentDragArea==""?i.element:n(i.model.appointmentDragArea),cursorAt:{top:17,left:0},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-alldayappointment")?n(t.sender.target):n(t.sender.target).parents(".e-alldayappointment"),i._appointElement(r,i)}}),u=this.element.find(".e-monthappointment"),u.ejDraggable({handle:".e-monthappointment",dragArea:i.model.appointmentDragArea==""?i.element.find("div.e-draggableworkarea"):n(i.model.appointmentDragArea),cursorAt:i.model.appointmentDragArea==""?{top:0,left:0}:{top:-20,left:10},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-monthappointment")?n(t.sender.target):n(t.sender.target).parents(".e-monthappointment"),i._appointElement(r,i)}}))},_appointElement:function(t,i){var r=i.model.orientation=="vertical"&&t.hasClass("e-appointment")?t.closest("td").width()*.85:t.width();return t.find(".e-schedulemouseclose").removeClass("e-schedulemouseclose e-icon"),t.find(".e-tophandle").removeClass("e-tophandle e-appointresizer-top e-icon e-nsexpand"),t.find(".e-bottomhandle").removeClass("e-bottomhandle e-appointresizer-bottom e-icon e-nsexpand"),t.find(".e-lefthandle").removeClass("e-lefthandle e-appointresizer-left e-icon e-ewexpand"),t.find(".e-righthandle").removeClass("e-righthandle e-appointresizer-right e-icon e-ewexpand"),t.clone().prop("id","cloneElement").appendTo(t.parent()),t.css("cursor","move"),i.model.appointmentDragArea==""?t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",r+"px").appendTo(i.element):t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",r+"px").appendTo(n(document.body))},_dragStart:function(i){var s,f,e,u,r,o;if(n(i.element[0]).hasClass("e-appointment")||n(i.element[0]).hasClass("e-monthappointment")||n(i.element[0]).hasClass("e-alldayappointment")){if((this._tooltipEvents("disable"),(this._mediaQuery||t.isMobile())&&this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment"),s=this._curDragElmt=i.element,f=this._appointmentSettings,this._appUid=n(i.element[0]).attr("guid"),u=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),u.length>1?(r=n.extend(!0,[],u),r[0][f.endTime]=r[r.length-1][f.endTime],e=r[0]):e=u[0],o={target:s,appointment:e},this._trigger("actionBegin",{data:o,requestType:"appointmentDrag"}))||this._trigger("dragStart",o))return i.cancel=!0,n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove(),this._renderAppointmentAll(),this._tooltipEvents("enable"),(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this)),!1}else i.cancel=!0;!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"))},_dragOver:function(i){var c=n(i.element),e={target:c,interval:10},s,h,u,f;if(t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide"),this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover"),this._trigger("drag",e),this._dragInterval=e.interval,this.currentView()!="month"&&!this._isCustomMonthView()&&(n(i.element[0]).hasClass("e-appointment")||i.target.className.indexOf("e-workcells")>-1)&&this._dragAppointmentCurrentTime(i),this.model.orientation=="horizontal"&&this._tempResource.length!=0&&this._grouping.length!=0){if(i.element.css("pointer-events","none"),this.model.group.resources.length>1){var l=document.elementFromPoint(i.element.offset().left,i.element.offset().top),o=n(l).closest(".e-workcells").parent().index(),r=n(this.element.find(".e-resourceheadertable tr")[o]).children();if(r.hasClass("e-parentnode")&&n(r.children()[0]).hasClass("e-resourceexpand")){for(n(r.children()[0]).removeClass("e-resourceexpand").addClass("e-resourcecollapse"),s=n(r.children()[0]).attr("id").split("_")[0],h=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,s)),u=0;u<h.length;u++)f=o+u+1,n(this.element.find(".e-resourceheadertable tr")[f]).is(":hidden")&&(n(this.element.find(".e-resourceheadertable tr")[f]).toggle(),n(this.element.find(".e-workcellstab tr")[f]).toggle());this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height());this._horizontalRender();this.model.cellHeight&&this._reRenderScroller();this._horizontalResIcon()}}i.element.css("pointer-events","")}},_dragStop:function(i){var u,ut,at,vt,wi,c,b,st,yt,pt,ni,bi,ki,di,gi,ti,ft,a,nr,oi,e,v,tr,ht,si,s,w,tt,wt,hi,li,ci,ir,rr,y,nt,kt,ai,dt,bt,ur,rt,vi,ri,ot,yi,ui,l,ct,f,it,d,ii,fr,er,or,fi,pi,ei,lt;(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));this._tooltipEvents("enable");!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");var g=this,r=this._appointmentSettings,p=this.element.find(".e-draggableworkarea");if(this._appUid=i.element.attr("guid"),u=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),u.length>1&&!u[0][r.recurrence]?(ut=!0,f=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0]):(ut=u.length>1?!0:!1,at=n.extend(!0,[],u),at[0][r.endTime]=at[at.length-1][r.endTime],f=u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):u[0][r.recurrence]?u.length>1?at[0]:u[0]:this._getAppointmentByParentId(this._appUid)),(t.isNullOrUndefined(this._dragNewStartTime)||t.isNullOrUndefined(this._dragNewEndTime))&&u.length!=0&&(this._dragNewStartTime=new Date(u[0][this._appointmentSettings.startTime]),this._dragNewEndTime=new Date(u[u.length-1][this._appointmentSettings.endTime])),vt=n.extend(!0,{},f),wi=Math.ceil((vt[r.endTime]-vt[r.startTime])/36e5)<24&&vt[r.endTime].getDay()!=vt[r.startTime].getDay()?!0:!1,this.model.orientation=="vertical")if(n(i.element[0]).hasClass("e-appointment"))e=c=this._dragNewStartTime,v=b=this._dragNewEndTime,(i.target.className.indexOf("e-alldaycells")>-1||Math.ceil((this._dragNewEndTime.getTime()-this._dragNewStartTime.getTime())/36e5)>=24)&&(st=!0,c=new Date(c.setHours(0,0,0,0)),b=new Date(b.setHours(23,59,59,59))),s=Math.round((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-workcells").width());else if(n(i.element[0]).hasClass("e-alldayappointment"))if(i.target.className.indexOf("e-workcells")>-1)s=i.target.cellIndex,c=this._dragNewStartTime,b=this._dragNewEndTime,st=!1,this._allDayDrag=!0;else{e=f[r.startTime];v=f[r.endTime];u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(e=u[0][r.startTime],v=u[0][r.endTime]);yt=n(i.element[0]).offset().left+p.scrollLeft()-this.element.find(".e-alldaycells").offset().left-1;yt=this.model.enableRTL?Math.abs(yt):yt;var s=Math.round(yt/(this.element.find(".e-alldaycells").width()+1)),yr=Math.round(n(i.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),pr=Math.ceil((v-e)/864e5),wr=Math.round(n(i.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),gt=this.currentView()==="week"?7:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._renderDays:1;e=new Date(this._dateRender[s]);v=new Date(this._dateRender[s]);v.setHours(f[r.endTime].getHours(),f[r.endTime].getMinutes(),f[r.endTime].getSeconds());s<0?e<=new Date(this._dateRender[0])?(c=new Date(e),c.setDate(c.getDate()+s),c.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()),c=new Date(c)):(pt=new Date(this._dateRender[0]),pt.setDate(pt.getDate()+s),pt.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()),c=new Date(pt)):e<new Date(this._dateRender[0])?(ni=s>gt-1?s%gt:s,this._resWorkWeek?e=new Date(new Date(this._dateRender[s])):e.setDate(new Date(f[g._appointmentSettings.startTime]).getDate()+ni),e.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()),c=new Date(e)):(ni=s>gt-1?s%gt:s,c=new Date(new Date(this._dateRender[ni])),c.setHours(new Date(f[r.startTime]).getHours(),new Date(f[r.startTime]).getMinutes()));bi=new Date(c);ki=new Date(f[r.endTime]).getTime()-new Date(f[r.startTime]).getTime();b=new Date(new Date(bi).setMilliseconds(ki))}else n(i.element[0]).hasClass("e-monthappointment")&&(w=f[r.startTime],tt=f[r.endTime],u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(w=u[0][r.startTime],tt=u[u.length-1][r.endTime]),e=new Date(new Date(this.model.currentDate).getFullYear(),new Date(this.model.currentDate).getMonth(),1),di=e.getDay(),e.setDate(e.getDate()-di),this.currentView()!="month"&&(this.currentView()!="customview"||this._oneWeek)?(gi=t.isNullOrUndefined(this.model.group)?this._dateRender.length:this._dateRender.length*this.res1.length,s=parseInt((n(i.element[0]).offset().left-p.offset().left)/Math.round(p.width()/gi))):(s=parseInt((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-monthcells").width()),s=this.model.enableRTL?6-s:s),wi&&parseInt(i.element.attr("id").split("_")[1])==u[u.length-1].AppTaskId&&(s-=1),ti=parseInt((n(i.element[0]).offset().top+p.scrollTop()-p.offset().top)/this.element.find(".e-monthcells").outerHeight()),this.model.showOverflowButton||(ti=this._findRowIndex(i)),ft=this.currentView()=="month"||this._isCustomMonthView()&&!this._oneWeek?this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length,a=this.model.enableRTL?ti*ft+(s-Math.floor(s/ft)*ft)-(tt.getDay()-w.getDay()):ti*ft+(s-Math.floor(s/ft)*ft),e=new Date(new Date(this._dateRender[a]).setHours(w.getHours(),w.getMinutes(),w.getSeconds())),Math.ceil((f[r.endTime]-f[r.startTime])/36e5)>24?(nr=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(i.element.attr("id").split("_")[1]))),oi=new Date(nr[0][r.startTime])-new Date(u[0][r.startTime]),c=new Date(e-oi),wt=e.getTime()-new Date(w).getTime()-new Date(oi).getTime()):(c=new Date(e),wt=e.getTime()-new Date(w).getTime()),v=new Date(new Date(tt).getTime()+wt),b=new Date(v));else this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&(e=c=this._dragNewStartTime,v=b=this._dragNewEndTime,tr=this.model.enableRTL?document.elementFromPoint(n(i.element[0]).offset().left,n(i.element[0]).offset().top-1).cellIndex-Math.round(n(i.element[0]).width()/30-1):Math.round((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-workcells").width()),ht=parseInt((n(i.element[0]).offset().top+p.scrollTop()-p.offset().top)/this.element.find(".e-workcells").outerHeight()),this.model.showOverflowButton||(ht=this._findRowIndex(i)),this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(ht+=n(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return n(this).css("display")!=="none"})[ht]).prevUntil("table.e-resourceheadertable").filter(function(){return n(this).css("display")=="none"}).length),si=n(this.element.find(".e-workcellstab tr")[ht]).find("td")[tr],n(si).hasClass("e-resourceheadercells")||t.isNullOrUndefined(si)||(this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(n(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((n(i.element[0]).offset().left+p.scrollLeft()-p.offset().left)/this.element.find(".e-workcells").width()),s=ht,n(i.element[0]).hasClass("e-monthappointment")&&(w=new Date(f[r.startTime]),tt=new Date(f[r.endTime]),u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1?(w=u[0][r.startTime],tt=u[0][r.endTime]):u[0][r.recurrence]&&u[0][r.recurrenceRule].toString().indexOf("RECUREDITID")>0&&(f=u[0],w=u[0][r.startTime],tt=u[0][r.endTime]),e=new Date(this.monthDays[this._cellIndex]),e.setHours(w.getHours(),w.getMinutes(),w.getSeconds()),c=new Date(e),wt=e.getTime()-new Date(w).getTime(),v=new Date(new Date(tt).getTime()+wt),b=new Date(v))));if(hi=this.currentView()==t.Schedule.CurrentView.Month||this._isCustomMonthView(),this.model.orientation==t.Schedule.Orientation.Horizontal&&u[0][r.allDay]&&this.res1.length>1&&!hi&&(c=new Date(u[0][r.startTime]),b=new Date(u[0][r.endTime])),ci=!0,this._grouping.length>0&&(nt=n.extend(!0,{},u[0]),nt=this._getDragDropResourceData(this,s,nt),li=this._appointmentSettings.resourceFields.split(","),ci=nt[this._appointmentSettings.resourceFields.split(",")[li.length-1]]==u[0][this._appointmentSettings.resourceFields.split(",")[li.length-1]]),ci&&!t.isNullOrUndefined(e)&&new Date(e).getTime()==new Date(u[0][r.startTime]).getTime()&&new Date(v).getTime()==new Date(u[0][r.endTime]).getTime()&&!hi){if(this.element.find("#cloneElement").length>0){var k=this._curDragElmt.clone(),sr=this._timeMode=="12"?t.format(u[0][r.startTime],this._pattern.t,this.model.locale):t.format(u[0][r.startTime],"HH:mm",this.model.locale),hr=this._timeMode=="12"?t.format(u[0][r.endTime],this._pattern.t,this.model.locale):t.format(u[0][r.endTime],"HH:mm",this.model.locale);k.find(".e-apptime").remove();k.find(".e-appointinnertext").append(n("<div class='e-apptime'>"+sr+" - "+hr+"<\/div>"));this.model.enableRTL?k.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerWidth():this.element.find("#cloneElement").width(),height:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),top:this.element.find("#cloneElement").css("top"),right:this.element.find("#cloneElement").css("right"),cursor:""}):k.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerWidth():this.element.find("#cloneElement").width(),height:this.model.orientation=="vertical"?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),top:this.element.find("#cloneElement").css("top"),left:this.element.find("#cloneElement").css("left"),cursor:""});k.appendTo(this.element.find("#cloneElement").parent());this.element.find("#cloneElement").remove();!this.model.timeScale.enable||this.model.orientation!="vertical"||this.currentView()=="month"||this._isCustomMonthView()||k.hasClass("e-alldayappointment")?(k.children().eq(0).addClass("e-lefthandle e-appointresizer-left e-icon"),k.children().eq(1).addClass("e-righthandle e-appointresizer-right e-icon")):(k.children().eq(0).addClass("e-tophandle e-appointresizer-top e-icon"),k.children().eq(1).addClass("e-bottomhandle e-appointresizer-bottom e-icon"));k.children().eq(2).addClass("e-schedulemouseclose e-icon").removeAttr("style");this._bindAppointmentAction();n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove()}return!1}if(ir=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),rr=!this.model.showNextPrevMonth&&this.model.orientation=="vertical"&&this.currentView()=="month"?new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()!=new Date(c.getFullYear(),c.getMonth(),1).getTime():!1,!rr&&b>=new Date(this.model.minDate)&&b<=ir)if(this._refreshCellsHeight(),f[r.recurrence]==1&&f[r.recurrenceRule].indexOf("RECUREDITID")==-1){y=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)));y.length>1&&(nt=n.extend(!0,[],y),nt[0][r.endTime]=nt[nt.length-1][r.endTime]);y=y.length>1?nt[0]:y[0];var bt=y[r.recurrenceId]==null?y.ParentId:y[r.recurrenceId],cr=y[r.recurrenceId]==null?"ParentId":r.recurrenceId,l=new t.DataManager(this._processed).executeLocal((new t.Query).where(cr,t.FilterOperators.equal,bt));ut&&(l=this._recurrenceAppSort(l));var l=this._appointmentRecurrenceSort(l),o=n.extend({},y),a,et=!1;for(this.model.enableRecurrenceValidation&&o[r.recurrence]&&(a=this._recuCollectionIndex(l,y)),!this.model.enableRecurrenceValidation||!o[r.recurrence]||(a==0?t.isNullOrUndefined(l[a+1])?!0:new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime():a==l.length-1?new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime())?(kt=n.extend(!0,[],y),o[r.startTime]=c,o[r.endTime]=b,!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources&&(o=this._getDragDropResourceData(this,s,o)),t.isNullOrUndefined(st)||(o[r.allDay]=st),ct=this._checkAvailability(o),lt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,this._trigger("dragStop",{appointment:o,event:lt})||ct.length>0?(this._showBlockAlert&&ct.length>0&&this._alertBlockError(),o=n.extend(!0,[],kt),et=!0):(this._processed=this._sortAppById(this._processed),ai=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,this._appMainId=ai,bt=f[r.recurrenceId]==null?f.ParentId:f[r.recurrenceId],this._deleteOcurrence(bt,y[r.startTime]),o[r.recurrenceRule]=f[r.recurrenceRule]+";RECUREDITID="+o.ParentId,o[r.recurrenceExDate]=f[r.recurrenceExDate],o[r.id]=o.AppTaskId=ai)):(o[r.startTime]=y[r.startTime],o[r.endTime]=y[r.endTime],this._alertDragResizeError(),et=!0),it=[],dt=[],it.push(this._timeZoneAppointments(o,"")),bt=o[r.recurrenceId]==null?f.ParentId:o[r.recurrenceId],ur=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,bt)),dt.push(this._timeZoneAppointments(ur[0],"")),ii=this.dataSource()instanceof t.DataManager?r.id:"AppTaskId",et||(d=this._dataManager.saveChanges({added:it,changed:dt,deleted:[]},ii,this.model.appointmentSettings.query._fromTable)),rt=0;rt<it.length;rt++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(it[rt],"reverse"));for(rt=0;rt<dt.length;rt++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(dt[rt],"reverse"));if(et)for(this._appointmentRemove(o),ot=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ot},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ot},"Guid"),yi=this._processed.filter(function(n){return n.Guid==o.Guid}),ui=0;ui<yi.length;ui++)this._refreshDayAppointments(yi[ui]);else{for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(o),ot=this._processed.filter(function(n){return n.Guid==o.Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ot},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ot},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ot},"Guid"),this._appointmentProcessing(o),this._appointmentRemove(o),vi=this._processed.filter(function(n){return n.Guid==o.Guid}),ri=0;ri<vi.length;ri++)this._refreshDayAppointments(vi[ri]);this._refreshDayAppointments(kt)}this._trigger("actionComplete",{appointment:o,requestType:"appointmentDrag"});!t.isNullOrUndefined(d)&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,u,f;if(n.isArray(r))g._processUrlBinding(i);else if(n.isPlainObject(r)&&r.added.length>0)for(g._dateFormat(r.added),u=0,f=r.added.length;u<f;u++)o[g._appointmentSettings.id]=r.added[u][g._appointmentSettings.id],new t.DataManager(g._processed).update("Guid",o)}),d.fail(function(){g._renderAppointmentAll()}))}else{var a,et=!1,lr=ut?this._currentAppointmentData:this._processed,h=new t.DataManager(lr).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,u[0].Guid)),kt=n.extend(!0,{},h[0]),ar=h[0][r.startTime],vr=h[0][r.endTime],l=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,h[0].ParentId));if(ut&&(l=this._recurrenceAppSort(l)),l=this._appointmentRecurrenceSort(l),h[0][r.startTime]=c,h[0][r.endTime]=b,this.model.enableRecurrenceValidation&&(a=this._recuCollectionIndex(l,h[0])),!this.model.enableRecurrenceValidation||!h[0][r.recurrence]||(a==0?t.isNullOrUndefined(l[a+1])?!0:new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime():a==l.length-1?new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime():new Date(new Date(l[a-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(e).setHours(0,0,0,0)).getTime()&&new Date(new Date(l[a+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(v).setHours(0,0,0,0)).getTime())?(!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources&&(h[0]=this._getDragDropResourceData(this,s,h[0])),t.isNullOrUndefined(st)||(h[0][r.allDay]=st),ct=this._checkAvailability(h[0]),lt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,(this._trigger("dragStop",{appointment:h[0],event:lt})||ct.length>0)&&(this._showBlockAlert&&ct.length>0&&this._alertBlockError(),h[0]=n.extend(!0,{},kt),et=!0)):(h[0][r.startTime]=ar,h[0][r.endTime]=vr,this._alertDragResizeError(),et=!0),this.model.appointmentDragArea!=""&&(f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),f.length==0))return!1;for(it=this._timeZoneAppointments(h[0],""),ii=this.dataSource()instanceof t.DataManager?r.id:"AppTaskId",et||(d=this._dataManager.update(ii,it,this.model.appointmentSettings.query._fromTable)),fr=this._timeZoneAppointments(it,"reverse"),er=ut?"Guid":"AppTaskId",new t.DataManager(this._currentAppointmentData).update(er,fr),or=new Date(new Date(h[0][r.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(h[0][r.endTime]).setHours(0,0,0,0)).getTime(),or||ut?(fi=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,h[0].Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:fi},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:fi},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:fi},"Guid"),this._appointmentProcessing(h[0])):(new t.DataManager(this._processed).update("AppTaskId",h[0]),new t.DataManager(this._renderedApp).remove("AppTaskId",h[0]),new t.DataManager(this._renderedAllDay).remove("AppTaskId",h[0])),this._appointmentRemove(h[0]),pi=this._processed.filter(function(n){return n.Guid==h[0].Guid}),ei=0;ei<pi.length;ei++)this._refreshDayAppointments(pi[ei]);this._refreshDayAppointments(kt);this._trigger("actionComplete",{appointment:h[0],requestType:"appointmentDrag"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(d)&&d&&n.isFunction(d.promise)&&this.dataSource()instanceof t.DataManager&&(d.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;n.isArray(r)&&g._processUrlBinding(i)}),d.fail(function(){g._renderAppointmentAll()}))}else this._renderAppointmentAll(),lt=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,this._trigger("dragStop",{appointment:u[0],event:lt});n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove();this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove()},_findRowIndex:function(t){var i=n(t.element[0]).offset(),r,u;return this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none"),r=n(document.elementFromPoint(i.left-n(document).scrollLeft(),i.top-n(document).scrollTop()-1)),u=n(r).closest("td").parent().index(),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible"),u},_alertDragResizeError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("DragResizeError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_processUrlBinding:function(i){if(this.model.enableLoadOnDemand||this.dataSource()instanceof t.DataManager&&this.dataSource().adaptor instanceof t.ODataAdaptor)this._initDataSource("refresh");else{var r=t.isNullOrUndefined(i.record)?i:i.record;this._currentAppointmentData.length=0;this._dateFormat(r);this._bindAppointments=!0;this._currentAppointmentData=n.merge(this._currentAppointmentData,r);this._dataProcessing(r);this._renderAppointmentAll()}},_refreshCellsHeight:function(){if(this.currentView()=="agenda")return!1;this.model.orientation!="horizontal"||this.model.showOverflowButton||(this._horizontalRender(),this._reRenderScroller());this.model.orientation!="vertical"||this.model.showOverflowButton||this.currentView()!="month"||(this._monthCellsRender(),this._reRenderScroller())},_dragAppointmentCurrentTime:function(i){var w=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.element.attr("guid")))),e=this.element.find(".e-draggableworkarea"),ft=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),u=this,c=u._appointmentSettings,b,f,y,st,g,ht,ct,vt,h,a,nt,l,v,p,tt,rt,r,o,yt,wt,ut,bt,kt,it;if(w[0][c.recurrence]?(b=n.extend(!0,[],w),b[0][c.endTime]=b[b.length-1][c.endTime],f=w[0][c.recurrence]&&w[0][c.recurrenceRule].toString().indexOf("RECUREDITID")==1?this._getAppointmentByParentId(this._appUid):w[0][c.recurrence]?b[0]:this._getAppointmentByParentId(this._appUid)):f=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],this.model.orientation=="vertical"&&(n(i.element[0]).hasClass("e-appointment")||i.target.className.indexOf("e-workcells")>-1)){var et=e.height()+e.scrollTop(),gt=i.element[0].offsetHeight,k=this.element.find(".e-workcells").outerHeight(),ot=n(i.element[0]).offset().top-e.offset().top+e.scrollTop(),d=ot-k/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))<et?ot:et-gt,r,s,l,v;if(n(i.element[0]).hasClass("e-alldayappointment"))a=i.target.cellIndex,r=new Date(this.dateRender[a]),y=d>0?d*60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k),r.setHours(parseInt(this.model.startHour)+Math.round(y/60)),r.setMinutes(parseInt(y%60)),r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r),r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval),l=new Date(r),s=new Date(r).setMinutes(r.getMinutes()+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),v=new Date(s);else if((d>0||!this.model.showAllDayRow)&&i.target.className.indexOf("e-alldaycells")!=1){if(y=Math.round(d>0?d*60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*k)),st=new Date(new Date(f[u._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(f[u._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()?!0:!1,u.currentView()==="month"||u._isCustomMonthView()?(r=f[c.startTime],s=new Date(r)):(g=new Date(u._firstweekdate(u.currentDate())),(u.currentView()==="workweek"||u.currentView()=="customview"&&u._renderDays==5)&&(ht=new Date(g).getDay(),ct=ht==0?1:0,g.setDate(g.getDate()+ct)),r=g,h=u.currentView()==="week"?7:u.currentView()==="workweek"?this.model.workWeek.length:u.currentView()=="customview"?u._renderDays:1,h=t.isNullOrUndefined(u.model.group)?h:h*u.res1.length,a=Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width()),r=this.model.enableRTL?new Date(this.dateRender[h-a-1]):new Date(this.dateRender[a]),s=r),st)r=this._getNewStartTime(y,r),l=new Date(r);else{var lt=(y%60).toFixed(1),at=lt.toString().split("."),ni=t.isNullOrUndefined(at[1])?0:at[1]/1;r.setHours(parseInt(this.model.startHour)+Math.round(y/60),parseInt(lt.toString().split(".")[0]),ni,0);r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r);ft>=this._dragInterval?r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval):r.setMinutes(r.getMinutes()/this._dragInterval*this._dragInterval);l=new Date(r)}vt=new Date(f[c.endTime]).getTime()-new Date(f[c.startTime]).getTime();v=new Date(new Date(r).setMilliseconds(vt))}else h=this.currentView()==="week"?7:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._renderDays:1,h=t.isNullOrUndefined(this.model.group)?h:h*this.res1.length,a=Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width()),r=this.model.enableRTL?new Date(this.dateRender[h-a-1]):new Date(this.dateRender[a]),l=new Date(r.setHours(0,0,0)),v=new Date(r.setHours(23,59,59))}else if(this.model.orientation=="horizontal"&&n(i.element[0]).hasClass("e-appointment")&&(l=new Date(f[u._appointmentSettings.startTime]),v=new Date(f[u._appointmentSettings.endTime]),p=this.model.enableRTL?document.elementFromPoint(n(i.element[0]).offset().left,n(i.element[0]).offset().top-1).cellIndex-Math.round(n(i.element[0]).width()/30-1):Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width()),tt=parseInt((n(i.element[0]).offset().top+e.scrollTop()-e.offset().top)/this.element.find(".e-workcells").outerHeight()),this.model.showOverflowButton||(tt=this._findRowIndex(i)),this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(tt+=n(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return n(this).css("display")!=="none"})[tt]).prevUntil("table.e-resourceheadertable").filter(function(){return n(this).css("display")=="none"}).length),rt=n(this.element.find(".e-workcellstab tr")[tt]).find("td")[p],!n(rt).hasClass("e-resourceheadercells")&&!t.isNullOrUndefined(rt))){r=new Date(this._dateRender[0]);nt=this.model.enableRTL?p*30:(n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/n(this.element.find(".e-workcells")[1]).outerWidth();o=this.model.startHour+p*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/60;yt=parseInt(p/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)));o=o>=this.model.endHour?Math.round(nt/60)+yt*(24-this.model.endHour+this.model.startHour):Math.round(nt/60);r.setHours(parseInt(u.model.startHour)+o);r.setMinutes(parseInt(nt%60));r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r);ft>=this._dragInterval?r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval):r.setMinutes(r.getMinutes()/this._dragInterval*this._dragInterval);l=new Date(r);var ti=f[u._appointmentSettings.startTime],ii=f[u._appointmentSettings.endTime],pt=(ii-ti)/1e3,ut=Math.floor(pt/3600),ri=parseInt(i.element.width()/this.element.find(".e-workcells").width())/this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);this.currentView()=="workweek"&&this.model.workWeek!=5&&new Date(f.StartTime).getDay()!=new Date(f.EndTime).getDay()&&(wt=new Date(f.EndTime).getDay()-new Date(f.StartTime).getDay(),ut=ut-(wt-1)*(this.model.endHour-this.model.startHour));bt=Math.round(Math.floor(pt%3600/60)/this._dragInterval)*this._dragInterval;s=u._getNewEndTime(r,ri,bt);new Date(f.StartTime).getDay()==new Date(f.EndTime).getDay()&&this.currentView()=="workweek"&&this.model.workWeek.length!=5&&(totalhrs=r.getHours()+ut,totalhrs>24&&(kt=n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)+1,s.setDate(new Date(this._dateRender[kt]).getDate())));it=parseInt(p)+parseInt(n(i.element[0]).width()/this.element.find(".e-workcells").width())-1;it=parseInt(it/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)));var dt=new Date(s).getHours()>=this.model.endHour?parseInt(parseInt((new Date(s)-new Date(new Date(new Date(r).setHours(0,0,0,0)).setHours(this.model.endHour)))/36e5)/(this.model.endHour-this.model.startHour)):0,ui=new Date(r),fi=this.currentView()=="workweek"?(dt-1)*(this.model.endHour-this.model.startHour):0;o=new Date(s).getHours()>=this.model.endHour?new Date(new Date(ui).setHours(new Date(r).getHours()+fi+parseInt(n(i.element[0]).width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))+dt*(24-this.model.endHour+this.model.startHour))):s;new Date(s).getHours()>=this.model.endHour&&o.setMinutes(new Date(r).getMinutes()+Math.round(parseInt(nt%60)/this._dragInterval)*this._dragInterval);this.model.endHour-this.model.startHour!=24&&new Date(new Date(o).setHours(0,0,0,0)).getTime()!=new Date(this._dateRender[it]).getTime()&&(o=new Date(this._dateRender[it]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds(),new Date(o).getMilliseconds()));v=new Date(o);this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(n(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((n(i.element[0]).offset().left+e.scrollLeft()-e.offset().left)/this.element.find(".e-workcells").width())}i.element.find(".e-apptime").html(t.format(l,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(v,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).insertBefore(i.element.find(".e-apptext")).css("font-size","12px").css("white-space","normal");this._dragNewStartTime=l;this._dragNewEndTime=v},_unWireDragDrop:function(){var n=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment");n.ejDraggable("destroy")},_getAppointmentByParentId:function(i){var f=this._currentAppointmentData,u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i)),r=new t.DataManager(f).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[0].ParentId));return n.isEmptyObject(r)?r:r[0]},_renderAppointmentAll:function(){if(this.element.children().length==0)return!1;if(this.currentView()=="agenda")this._renderAgendaContent();else if(t.preferredCulture(this.model.locale),this.element.find("div.e-appointwrapper,.e-alldayappointment,.e-scheduleAppGlassy").remove(),this._currentViewAppointments=this._appointmentCount(),this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(this.model.orientation=="vertical"&&this._reRenderScroller(),this._renderAppointments(),this.model.showAppointmentNavigator&&(this.model.orientation=="vertical"&&this.element.find(".e-vscroll").length>0&&!this._mediaQuery&&this._renderUpDownIconPosition(),this._nextPrevButton())):this._renderMonthAppointment(),this._bindAppointmentAction(),!this.model.showOverflowButton&&this.model.orientation=="horizontal"){var n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top;this.element.find(".e-horires").css({top:-n+"px"})}},_bindAppointmentAction:function(){this._unWireResizeEvents();this._wireResizeEvents();this._dragdropAppointments()},_renderBlockAppointments:function(){var i,u,f,s,e,o,r;if(this.element.find(".e-blocktimewrapper").remove(),this.model.blockoutSettings.enable&&!(this.model.blockoutSettings.dataSource instanceof t.DataManager)&&this.currentView()!="agenda")for(this._processBlockApps(),i=this.model.orientation=="horizontal"&&this.currentView()=="month"?n.extend(!0,[],this.monthDays):n.extend(!0,[],this._dateRender),this.model.group||(this.res1=["0"]),u=0;u<this.res1.length;u++){if(f=0,e=i.length,new Date(i[0])<this.model.minDate&&(f=Math.floor((new Date(this.model.minDate)-new Date(i[0]))/864e5)),new Date(i[i.length-1])>this.model.maxDate&&(s=Math.floor((new Date(i[i.length-1])-new Date(this.model.maxDate))/864e5),e=i.length-s),this._resWorkWeek)for(e=0,f=0,o=0,r=0;r<u+1;r++)if(t.isNullOrUndefined(this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(e+=this.model.workWeek.length,r==u&&(o+=this.model.workWeek.length)):(e+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,r==u&&(o+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length)),r==u){f=e-o;break}for(f;f<e;f++)this._getBlockIntervals(f,u,i)}},_processBlockApps:function(){var i,t;for(this._processedIntervals=[],i=n.extend(!0,[],this.model.blockoutSettings.dataSource),t=0;t<i.length;t++)i[t]=this._processtimeZone(i[t]),new Date(new Date(i[t][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[t][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()?this._blockTimeSplit(i[t],new Date(i[t][this.model.blockoutSettings.startTime]),new Date(i[t][this.model.blockoutSettings.endTime])):this._processedIntervals.push(i[t])},_blockTimeSplit:function(t,i,r){for(var u=new Date(this._dateRender[0])<=i?i:new Date(this._dateRender[0]),l=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate(),23,59,59),c=0,o,s,f,e,h;u<=l;)if(o=0,f=u,(this.currentView()=="month"||this._isCustomMonthView()||this.currentView()!="agenda"&&this.currentView()!="day"&&this.model.orientation=="horizontal")&&(this.model.orientation=="horizontal"&&this.currentView()=="month"?o=new Date(f.getFullYear(),f.getMonth()+1,0).getDate()-f.getDate():this.currentView()=="customview"&&(this._renderDays<=7||this.model.orientation=="horizontal")?(u=new Date(new Date(f).getFullYear(),new Date(f).getMonth(),new Date(f).getDate()),o=this._dateRender.indexOf(u.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(u.getTime()):u.getTime()<new Date(this._dateRender[0]).getTime()?(new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1)).getTime()-new Date(u).setHours(0,0,0,0))/864e5:u.getTime()>new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):(o=this.model.showNextPrevMonth||this.currentView()!="month"||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(u.getFullYear(),u.getMonth(),1).getTime()?6-f.getDay()+this._firstdayofweek:new Date(f.getFullYear(),f.getMonth()+1,0).getDate()-f.getDate(),this._firstdayofweek>f.getDay()&&(o=6-f.getDay()-(7-this._firstdayofweek)))),s=new Date(new Date(u).getFullYear(),new Date(u).getMonth(),new Date(u).getDate()+o),e=new Date(s).getDate()==new Date(r).getDate()?new Date(new Date(s).setHours(r.getHours(),r.getMinutes(),r.getSeconds())):new Date(new Date(s).setHours(23,59,59)),e>=new Date(r)&&(e=t[this.model.blockoutSettings.endTime]),this.model.showNextPrevMonth||this.currentView()!="month"||new Date(u.getFullYear(),u.getMonth(),1).getTime()==new Date(e.getFullYear(),e.getMonth(),1).getTime()||(e=new Date(u.getFullYear(),u.getMonth()+1,0,e.getHours(),e.getMinutes(),e.getSeconds())),h={},h[this.model.blockoutSettings.startTime]=f,h[this.model.blockoutSettings.endTime]=e,this._processedIntervals.push(n.extend({},t,h)),c=this.model.orientation=="horizontal"&&this.currentView()=="workweek"&&new Date(this._dateRender[0]).getDay()==1&&new Date(this._dateRender[this._dateRender.length-1]).getDay()==5?3:1,u=new Date(new Date(e).getFullYear(),new Date(e).getMonth(),new Date(e).getDate()+c),new Date(this._dateRender[this._dateRender.length-1])<u)break},_getBlockIntervals:function(n,i,r){var u=this._processedIntervals,o=t.Predicate(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(r[n])).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r[n]).setHours(23,59,59))),s=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r[n])).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r[n]).setHours(23,59,59))),e=o.or(s),f;for(e=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?e.and(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,u=new t.DataManager(u).executeLocal((new t.Query).where(e)),f=0;f<u.length;f++)new Date(new Date(r[n]).setHours(0,0,0,0)).getTime()==new Date(new Date(u[f][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[n]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[f][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(u[f][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[f][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()&&(this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?u[f][this.model.blockoutSettings.isAllDay]&&this._renderMonthBlockTime(u[f],n,i):this._renderBlockTime(u[f],n,i))},_renderBlockTime:function(i,r,u){var b=this.element.find(".e-workcells").outerHeight(),h=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.startHour):0,p=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.endHour):24,l=this._getDateCount(u),f=i[this.model.blockoutSettings.startTime],e=i[this.model.blockoutSettings.endTime],c,s,k,d,a,ft,et,ot,g,o,nt,v;if(f=new Date(f).getHours()<h?new Date(new Date(f).setHours(h,f.getMinutes(),f.getSeconds())):f,e=p<=e.getHours()?new Date(new Date(e).setHours(p,00,00)):e,c=new Date(f).getHours()<h?new Date(f).getHours()+-new Date(f).getHours()+-new Date(f).getMinutes():new Date(f).getHours()+-h,f<=e&&new Date(l[0]).getTime()<=f.getTime()&&new Date(new Date(l[l.length-1]).setHours(23,59,59))>=f.getTime())if(this.model.orientation=="vertical")s="100%",a=0,k=parseFloat(new Date(new Date(e).getTime())-new Date(new Date(f).getTime()))/6e4*b*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,d=(parseFloat(new Date(f).getHours()*60+new Date(f).getMinutes()+new Date(f).getSeconds()/60)-parseInt(c*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-this.model.startHour*60)*b*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),v=this._generateBlockElement(i,s,k,d,a),this._resWorkWeek?n(this.element.find("td.e-workcells")[c*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r]).append(v):n(this.element.find("td.e-workcells")[parseInt(c*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*l.length*this.res1.length+r+l.length*u]).append(v);else{var ct=this._horiGroupCollection(),k=b,s,d=0,a,ut=0;if(!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(ft=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,i[this.model.blockoutSettings.resourceId])),ut=this._findResourceIndex(ct,this._tempResource[this._tempResource.length-2].resourceSettings.id,ft[0][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])+1),et=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource)?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId])+1:1,new Date(new Date(new Date(i[this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime())<new Date(new Date(new Date(i[this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime())){var st=new Date(e)<new Date(new Date(e).setHours(this.model.endHour,0,0))&&new Date(e)<new Date(new Date(e).setHours(this.model.startHour,0,0))?this.model.endHour*30:new Date(e).getHours()*60+new Date(e).getMinutes(),ht=new Date(f)>new Date(new Date(e).setHours(this.model.startHour,0,0))?this.model.startHour*60:new Date(f).getHours()*60+new Date(f).getMinutes(),w=1,tt,y,it,rt,ot;if(tt=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0)),y=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0)),tt==-1)while(w<7)if(new Date(this._dateRender[this._dateRender.length-w]).getTime()<new Date(e).setHours(0,0,0,0)){it=this._dateRender.length-w;st=this.model.endHour*60;break}else w++;else it=tt;y==-1?(rt=r,ht=this.model.startHour*60):rt=y;ot=it-rt;o=ot*(p-h)*60-ht+st;nt=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*r+(y==-1?0:c*this.model.timeScale.minorSlotCount)*(60/this.model.timeScale.majorSlot);s=this.element.find(".e-workcells").outerWidth()/30*o+(o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2);g>this._dateRender.length&&(g=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(f).getDay(),o=g*(p-h)*60,s=o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));a=y==-1?0:parseFloat(new Date(f).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot}else a=parseFloat(new Date(f).getMinutes()+new Date(f).getMilliseconds()/60)*n(this.element.find(".e-workcells")[1]).width()*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,o=new Date(e).getHours()*60+new Date(e).getMinutes()-(new Date(f).getHours()*60+new Date(f).getMinutes())+1,s=o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(o/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2)+1,nt=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*r+c*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);s=s+"px";v=this._generateBlockElement(i,s,k,d,a);n(n(this.element.find(".e-workcellstab tr")[et+ut-1]).find("td.e-workcells")[nt]).append(v)}},_generateBlockElement:function(i,r,u,f,e){var o=this.model.blockoutSettings.templateId?!0:!1,h=o?this._getUserTemplate(this.model.blockoutSettings.templateId,i):"",c=i[this.model.blockoutSettings.isBlockAppointment]?"e-blockenable":"",s=n(this.blockTimeTemplate.render({id:i[this.model.blockoutSettings.id],subject:i[this.model.blockoutSettings.subject],appWidth:r,appHeight:u,left:e,top:f,blockClass:c,customStyle:i[this.model.blockoutSettings.customStyle],userTempId:o,userTemplate:h}));return t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("blockAppointment",i,s),s},_renderMonthBlockTime:function(i,r){var b=this.model.orientation=="vertical"?this._dateRender:this.monthDays,u=new Date(i[this.model.blockoutSettings.startTime]),h=new Date(i[this.model.blockoutSettings.endTime]),k,d,l,it=this.model.orientation=="vertical"?this.element.find(".e-monthcells").width():this.element.find(".e-workcells").width(),f=new Date(u),g=new Date(new Date(b[b.length-1]).setHours(23,59,59)),a=new Date(h)>g?g:new Date(h),o=f.getHours()==0&&a.getHours()==0?Math.ceil((new Date(a)-new Date(f))/864e5):Math.ceil((new Date(a).setHours(23,59,59)-new Date(f).setHours(0,0,0))/864e5),v,y,p,e,nt,s,tt,w,c;u<=h&&(this.model.orientation=="vertical"&&(v=this._firstdayofweek==0?7-new Date(f).getDay():7-new Date(f).getDay()+this._firstdayofweek,o=o>=v?v:o,y=Math.ceil((r+1)/7)),k=o*it+"px",p=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId]):0,e=this.model.orientation=="vertical"?p*7+(new Date(u).getDay()+1)+(y-1)*this.res1.length*7-this._firstdayofweek:r+1,this.model.orientation=="vertical"&&this._firstdayofweek!=0&&new Date(u).getDay()<this._firstdayofweek&&(e=p*7+(new Date(u).getDay()+1)+(y-1)*this.res1.length*7-this._firstdayofweek+7),this.model.orientation=="vertical"?l=n(this.element.find("td.e-monthcells")[e-1]).closest("tr").find(".e-monthcells").outerHeight():(nt=this._horiGroupCollection(),s=0,!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(tt=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,i[this.model.blockoutSettings.resourceId])),s=this._findResourceIndex(nt,this._tempResource[this._tempResource.length-2].resourceSettings.id,tt[0][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])+1),w=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource)?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId])+1:1,l=n(this.element.find(".e-workcellstab tr")[w+s-1]).find(".e-workcells").height()),d=l-this.element.find(".e-monthheader").height(),c=this._generateBlockElement(i,k,d,0,0),this.model.orientation=="vertical"?n(this.element.find("td.e-monthcells")[e-1]).append(c):this.model.orientation=="horizontal"&&t.scheduleFeatures.horizontal&&n(n(this.element.find(".e-workcellstab tr")[w+s-1]).find("td.e-workcells")[e-1]).append(c))},_checkAvailability:function(n){if(this.model.blockoutSettings.enable){var r=new Date(n[this._appointmentSettings.startTime]),f=new Date(n[this._appointmentSettings.endTime]),u;!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(u=n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]);var e=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.greaterThanOrEqual,r).and(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThanOrEqual,r).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThan,f),o=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,r).and(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThan,r),i=e.or(o);return i=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?i.and(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,u):i,i=i.and(this.model.blockoutSettings.isBlockAppointment,t.FilterOperators.equal,!0),new t.DataManager(this._processedIntervals).executeLocal((new t.Query).where(i))}return[]},_alertBlockError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("BlockIntervalAlertTitle"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("BlockIntervalError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_getNewEndTime:function(n,t){var i=new Date(n);return i.setMilliseconds(36e5*t),i},_getNewStartTime:function(n,t){return t.setHours(t.getHours()+parseInt(this.model.startHour)+parseInt(n/60)),t.setMinutes(t.getMinutes()+parseInt(n%60)),t.setMinutes(Math.round(t.getMinutes()/10)*10),t},_documentOnKeyDown:function(n){if(this.model.allowKeyboardNavigation){var t=n.target||document.activeElement||n.srcElement;n.which==27?this._processEscapeKey():n.which==13?this._processEnterKey(t):n.shiftKey==!1&&n.which==9&&this._processWindowTab(t)}},_processWindowTab:function(i){n(i).hasClass("e-qAppDone")&&!t.isNullOrUndefined(this._quickAppointWindow)?this._quickAppointWindow.find(".subject").focus():!t.isNullOrUndefined(this._appointmentAddWindow)&&(n(i).hasClass("e-appointcancel")||n(i).hasClass("e-cancelrecur"))?this._appointmentAddWindow.find(".subject").focus():n(i).hasClass("e-editseries")&&!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.focus()},_onKeyDown:function(i){var u,r,f,o,s,e,l;if(this.model.allowKeyboardNavigation){if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),u=this.element.find("div.e-draggableworkarea tr"),r=i.target||document.activeElement||i.srcElement,n(r).hasClass("e-alldaycells")&&(u=this.element.find(".e-alldaycells").parent()),this._trigger("keyDown",{event:i}))return!1;if(n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells"))this._getDateByElement(n(r)),f=this.curDate,i.which==39&&f.setDate(f.getDate()+1),i.which==37&&f.setDate(f.getDate()-1),f>=this.model.minDate&&f<=this.model.maxDate&&(this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"),(n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells"))&&n(r).addClass("e-selectedCell"),i.shiftKey==!1&&i.which==38?(this._stopDefaultAction(i),this._processUpArrow(r,u)):i.shiftKey==!1&&i.which==40?(this._stopDefaultAction(i),this._processDown(r,u)):i.ctrlKey==!1&&i.shiftKey==!1&&i.which==39?(this._stopDefaultAction(i),this._processRight(r,u)):i.ctrlKey==!1&&i.shiftKey==!1&&i.which==37?(this._stopDefaultAction(i),this._processLeft(r,u)):i.shiftKey==!0&&i.which==38?(this._stopDefaultAction(i),this._processShiftUp(r,i,u)):i.shiftKey==!0&&i.which==40?(this._stopDefaultAction(i),this._processShiftDown(r,i,u)):i.shiftKey==!0&&i.which==37?(this._stopDefaultAction(i),this._processShiftLeft(r,i,u)):i.shiftKey==!0&&i.which==39&&(this._stopDefaultAction(i),this._processShiftRight(r,i,u)));else if(this.currentView()=="agenda"&&n(r).hasClass("e-agendacells")&&(this._stopDefaultAction(i),i.which==38||i.which==40)){this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");var a=u.length-1,h=this.element.find(".e-selectedCell").parent().index(),c=i.which==38?parseInt(h)-1:parseInt(h)+1;c>=0&&c<=a&&h!="undefined"&&(n(u).find(".e-eventcolumn,.e-timecolumn").removeClass("e-selectedCell"),n(u[c]).find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus())}i.altKey==!0&&i.which==67?(this._stopDefaultAction(i),this.element.find(".e-datedisplay").click()):i.ctrlKey==!0&&i.which==37?(this._stopDefaultAction(i),this.element.find("div.e-navigateprevious").click(),this.element.find("div.e-navigateprevious").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.ctrlKey==!0&&i.which==39?(this._stopDefaultAction(i),this.element.find("div.e-navigatenext").click(),this.element.find("div.e-navigatenext").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.altKey==!0&&i.which==107||i.altKey==!0&&i.which==187||i.altKey==!0&&i.which==61?(this._stopDefaultAction(i),this._navigateToolbarRight(i)):i.altKey==!0&&i.which==189||i.altKey==!0&&i.which==109||i.altKey==!0&&i.which==45||i.altKey==!0&&i.which==173?(this._stopDefaultAction(i),this._navigateToolbarLeft(i)):i.ctrlKey==!0&&i.which==67?(this._stopDefaultAction(i),this._cancel()):i.which==32?n(document.activeElement)[0]===this.element.find("div.e-navigateprevious")[0]?(this._stopDefaultAction(i),this.element.find("div.e-navigateprevious").click(),this.element.find("div.e-navigateprevious").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):n(document.activeElement)[0]===this.element.find("div.e-navigatenext")[0]&&(this._stopDefaultAction(i),this.element.find("div.e-navigatenext").click(),this.element.find("div.e-navigatenext").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.altKey==!0&&i.which==78?(this._stopDefaultAction(i),this.currentView()!="agenda"&&this._newAppWindow(r,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):i.ctrlKey==!0&&i.which==69?(this._stopDefaultAction(i),o=this.element.find(".e-selectedAppointment"),this.currentView()=="agenda"&&this.element.find(".e-selectedCell").length>0&&(e=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),e.hasClass("e-agendaappointment")&&(o=e)),o.length>0&&(this._editKey=!0,this._cellClick=!1,this._appointmentWindow(o),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"))):i.which==46?(this._stopDefaultAction(i),s=this.element.find(".e-selectedAppointment"),this.currentView()=="agenda"&&this.element.find(".e-selectedCell").length>0&&(e=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),e.hasClass("e-agendaappointment")&&(s=e)),s.length>0&&(this._appUid=s.attr("guid"),this._deleteAppoint())):i.shiftKey==!0&&i.which==9?(this._stopDefaultAction(i),this._reverseTab(r,i,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):i.shiftKey==!1&&i.which==9&&(this._stopDefaultAction(i),this._processTab(r,i,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"));l=this;this.currentView()!="agenda"&&this._moveScrollContent(r,l)}},_processShiftUp:function(t,i,r){var u,s,o;if(this.model.orientation=="horizontal")return!1;if(n(t).hasClass("e-workcells")){var h=r.length-1,e=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;e>0&&e<=h&&e!="undefined"?(u=parseInt(e)-1,u>=0&&(n(r[u].cells[f]).hasClass("e-selectedCell")?(n(r[u].cells[f]).attr("tabIndex",0).focus(),n(r[e].cells[f]).removeClass("e-selectedCell")):(n(r[e].cells[f]).addClass("e-selectedCell"),n(r[u].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus())),this._currentRowIndex=u,this._currentColIndex=f):(n(r[e].cells[f]).attr("tabIndex",0).focus(),this._currentRowIndex=e,this._currentColIndex=f)}else if(n(t).hasClass("e-monthcells")){var c=Math.floor(n(t).index()/7),h=r.length-1,l=7*(c+1),a=7*parseInt(c),e=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;if(e>0&&e<=h&&e!="undefined")if(u=parseInt(e)-1,u>=0)if(n(r[u].cells[f]).hasClass("e-selectedCell")){for(s=f;s>=a;s--)n(r[e].cells[s]).attr("tabIndex",0).focus(),n(r[e].cells[s]).removeClass("e-selectedCell");for(o=l-1;o>=f;o--)u>=0&&(n(r[u].cells[o]).attr("tabIndex",0).focus(),n(r[u].cells[o]).removeClass("e-selectedCell"));n(r[u].cells[f]).hasClass("e-othermonths")||n(r[u].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(s=f;s>=a;s--)n(r[e].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(o=l-1;o>=f;o--)u>=0&&(n(r[u].cells[o]).hasClass("e-othermonths")||n(r[u].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else n(r[u+1].cells[f]).attr("tabIndex",0).focus();else return!1}else return!1},_processShiftDown:function(t,i,r){var u,o,s;if(this.model.orientation=="horizontal")return!1;if(n(t).hasClass("e-workcells")){var h=r.length-1,f=n(t).parent()[0].rowIndex,e=n(t)[0].cellIndex;f>=0&&f<=h&&f!="undefined"&&(n(r[f].cells[e]).addClass("e-selectedCell").attr("tabIndex",0).focus(),u=parseInt(f)+1,u<=h?(n(r[u].cells[e]).hasClass("e-selectedCell")?(n(r[u].cells[e]).attr("tabIndex",0).focus(),n(r[f].cells[e]).removeClass("e-selectedCell")):(n(r[f].cells[e]).addClass("e-selectedCell"),n(r[u].cells[e]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=u,this._currentColIndex=e):(n(r[f].cells[e]).attr("tabIndex",0).focus(),this._currentRowIndex=f,this._currentColIndex=e))}else if(n(t).hasClass("e-monthcells")){var c=Math.floor(n(t).index()/7),h=r.length-1,l=7*(c+1),a=7*parseInt(c),f=n(t).parent()[0].rowIndex,e=n(t)[0].cellIndex;if(f>=0&&f<=h&&f!="undefined")if(u=parseInt(f)+1,u<this._dateRender.length/7)if(n(r[u].cells[e]).hasClass("e-selectedCell")){for(o=e;o<=l-1;o++)n(r[f].cells[o]).attr("tabIndex",0).focus(),n(r[f].cells[o]).removeClass("e-selectedCell");for(s=a;s<=e;s++)u<this._dateRender.length/7&&(n(r[u].cells[s]).attr("tabIndex",0).focus(),n(r[u].cells[s]).removeClass("e-selectedCell"));n(r[u].cells[e]).hasClass("e-othermonths")||n(r[u].cells[e]).addClass("e-selectedCell")}else{for(o=e;o<=l-1;o++)n(r[f].cells[o]).hasClass("e-othermonths")||n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(s=a;s<=e;s++)u<this._dateRender.length/7&&(n(r[u].cells[s]).hasClass("e-othermonths")||n(r[u].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else n(r[u-1].cells[e]).attr("tabIndex",0).focus();else return!1}else return!1},_processShiftLeft:function(t,i,r){var rt=r.length-1,c,l,h,v;if(n(t).hasClass("e-workcells")){var b=t,y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,d=this.model.orientation=="vertical"?y:this.currentView()=="month"?this.totdays.length:y*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),p=Math.floor(n(b).index()/d),g=d*p,o=n(b)[0].cellIndex,e=n(b).parent()[0].rowIndex,u=o-1,nt=this.model.orientation=="vertical"?0:e,tt=this.model.orientation=="vertical"?rt:e,it=this.model.orientation=="vertical"&&this.model.showAllDayRow?!0:!1,k=this.element.find(".e-alldaycells").parent();if(o>0&&u>parseInt(g)-1&&o!="undefined"){if(n(r[e].cells[u]).hasClass("e-selectedCell")){for(c=nt;c<=parseInt(e);c++)n(r[c].cells[o]).removeClass("e-selectedCell");for(l=tt;l>=parseInt(e);l--)n(r[l].cells[u]).removeClass("e-selectedCell");it&&n(k[0].cells[o]).removeClass("e-selectedCell").attr("tabIndex",0).focus();n(r[e].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(c=nt;c<=parseInt(e);c++)n(r[c].cells[o]).addClass("e-selectedCell");for(l=tt;l>=parseInt(e);l--)n(r[l].cells[u]).addClass("e-selectedCell");it&&(n(k[0].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(k[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus());n(r[e].cells[u]).attr("tabIndex",0).focus()}this._currentRowIndex=e;this._currentColIndex=u}else n(r[e].cells[u+1]).attr("tabIndex",0).focus(),this._currentRowIndex=e,this._currentColIndex=u+1}else if(n(t).hasClass("e-monthcells")){var p=Math.floor(n(t).index()/7),rt=r.length-1,a=7*(parseInt(p)+1),w=7*parseInt(p),s=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;if(f>=w&&f<=a&&f!="undefined")newcur=parseInt(f)-1,n(r[s].cells[newcur]).hasClass("e-selectedCell")?f==w&&s>=1?(h=parseInt(s)-1,v=parseInt(a)-1,h>=0&&(n(r[h].cells[v]).attr("tabIndex",0).focus(),n(r[h].cells[f]).removeClass("e-selectedCell"),n(r[s].cells[w]).removeClass("e-selectedClass"))):f<a&&(newcur=parseInt(f)-1,n(r[s].cells[newcur]).attr("tabIndex",0).focus(),n(r[s].cells[f]).removeClass("e-selectedCell")):f==w&&s>=0?(h=parseInt(s)-1,v=parseInt(a)-1,h>=0?n(r[h].cells[v]).hasClass("e-othermonths")||n(r[h].cells[v]).addClass("e-selectedCell").attr("tabIndex",0).focus():n(r[h+1].cells[f]).attr("tabIndex",0).focus()):f<a&&(newcur=parseInt(f)-1,n(r[s].cells[newcur]).hasClass("e-othermonths")||n(r[s].cells[newcur]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(t).hasClass("e-alldaycells")){var y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=Math.floor(n(t).index()/y),g=y*p,o=n(t)[0].cellIndex,u=o-1;o>0&&u>parseInt(g)-1&&o!="undefined"?(n(r[0].cells[u]).hasClass("e-selectedCell")?(n(r[0].cells[o]).removeClass("e-selectedCell"),n(r[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=u):(n(r[0].cells[u+1]).attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=u+1)}else return!1},_processShiftRight:function(t,i,r){var s,h,o;if(n(t).hasClass("e-workcells")){var g=r.length-1,l=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=this.model.orientation=="vertical"?l:this.currentView()=="month"?this.totdays.length:l*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),a=Math.floor(n(t).index()/p),c=p*(a+1),e=n(t).parent()[0].rowIndex,u=n(t)[0].cellIndex,f=parseInt(u)+1,w=this.model.orientation=="vertical"?0:e,b=this.model.orientation=="vertical"?g:e,y=this.element.find(".e-alldaycells").parent(),k=this.model.orientation=="vertical"&&this.model.showAllDayRow?!0:!1;if(u>=0&&u<parseInt(c)-1&&u!="undefined"){if(n(r[e].cells[f]).hasClass("e-selectedCell")){for(s=parseInt(e);s<=b;s++)n(r[s].cells[u]).removeClass("e-selectedCell");for(h=w;h<=e;h++)n(r[h].cells[f]).removeClass("e-selectedCell").attr("tabIndex",0).focus();k&&n(y[0].cells[u]).removeClass("e-selectedCell");n(r[e].cells[f]).addClass("e-selectedCell")}else{for(s=parseInt(e);s<=b;s++)n(r[s].cells[u]).addClass("e-selectedCell");for(h=w;h<=e;h++)n(r[h].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus();k&&(n(y[0].cells[f]).addClass("e-selectedCell"),n(y[0].cells[u]).addClass("e-selectedCell"))}this._currentRowIndex=e;this._currentColIndex=f}else n(r[e].cells[u]).attr("tabIndex",0).focus()}else if(n(t).hasClass("e-monthcells")){var a=Math.floor(n(t).index()/7),g=r.length-1,v=c=7*(parseInt(a)+1),d=7*parseInt(a),e=n(t).parent()[0].rowIndex,u=n(t)[0].cellIndex,f=parseInt(u)+1;if(u>=0&&u<=parseInt(c)-1&&u!="undefined")n(r[e].cells[f]).hasClass("e-selectedCell")?(f<v&&(n(r[e].cells[f]).attr("tabIndex",0).focus(),n(r[e].cells[u]).removeClass("e-selectedCell")),u==parseInt(c)-1&&e<this._dateRender.length/7&&(o=parseInt(e)+1,u=d,o<this._dateRender.length/7&&(n(r[o].cells[u]).hasClass("e-othermonths")||n(r[o].cells[u]).removeClass("e-selectedCell").attr("tabIndex",0).focus(),f<v&&(n(r[o].cells[f]).attr("tabIndex",0).focus(),n(r[o].cells[u]).removeClass("e-selectedCell"))))):(f<v&&(n(r[e].cells[f]).hasClass("e-othermonths")||n(r[e].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()),u==parseInt(c)-1&&e<this._dateRender.length/7&&(o=parseInt(e)+1,u=d,o<this._dateRender.length/7?(n(r[o].cells[u]).hasClass("e-othermonths")&&n(r[o].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),f<v&&n(r[o].cells[f]).hasClass("e-othermonths")&&n(r[o].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[o-1].cells[f-1]).attr("tabIndex",0).focus()));else return!1}else if(n(t).hasClass("e-alldaycells")){var l=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,a=Math.floor(n(t).index()/l),c=l*(a+1),u=n(t)[0].cellIndex,f=parseInt(u)+1;u>=0&&u<parseInt(c)-1&&u!="undefined"?(n(r[0].cells[f]).hasClass("e-selectedCell")?(n(r[0].cells[u]).removeClass("e-selectedCell"),n(r[0].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[0].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=f):n(r[0].cells[u]).attr("tabIndex",0).focus()}else return!1},_processEnterKey:function(i){var f,e,u,r;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();n(i).hasClass("e-workcells")||n(i).hasClass("e-monthcells")||n(i).hasClass("e-alldaycells")?(f=this.element.find("td.e-selectedCell"),e=f.length-1,e==0?this._cellSelection(i):this._multipleCellAppointCreation(i)):n(i).hasClass("e-detailedapp e-detailedwindow")?this._appointmentWindow(i):n(i).parent().hasClass("e-allday")?(u=this._appointmentAddWindow.find("#"+this._id+"allday").ejCheckBox("option","checked"),r=u?!1:!0,this._appointmentAddWindow.find(".allday").ejCheckBox({checked:r})):n(i).parent().hasClass("e-recurrence")?(u=this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked"),r=u?!1:!0,this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:r}),this._recurChecked=r?!0:!1,this._repeat(i)):n(i).hasClass("e-scheduledelete")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-scheduledelete").click():n(i).hasClass("e-editevent")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-editevent").click():n(i).hasClass(".e-editseries")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-editseries").click():n(i).hasClass("e-appointment")||n(i).hasClass("e-alldayappointment")||n(i).hasClass("e-monthappointment")?this._cellSelection(i):n(i).parent().hasClass("e-weekday")&&(u=this._appointmentAddWindow.find("#"+n(i).children()[0].id).ejCheckBox("option","checked"),r=u?!1:!0,this._appointmentAddWindow.find("#"+n(i).children()[0].id).ejCheckBox({checked:r}))},_findMinMaxCellIndex:function(){var u=this.element.find("div.e-draggableworkarea tr"),o=u.length-1,i,t,f,s,e,r=this.currentView(),h=r=="day"?1:r=="workweek"?this.model.workWeek.length:7,c=this;return this.element.find("td.e-selectedCell").each(function(h,c){var a=n(c).index(),l;if(a!=null&&!isNaN(a)){if(i==null?(i=a,f=n(c).parent()[0].rowIndex):i<a?i=i:i!=a&&(i=a,f=n(c).parent()[0].rowIndex),r!="month")for(l=0;l<=o;l++)if(n(u[l].cells[i]).hasClass("e-selectedCell")){f=l;break}if(t==null){if(t=a,r!="month")for(e=parseInt(t),l=0;l<=o;l++)n(u[l].cells[e]).hasClass("e-selectedCell")&&(s=l)}else if(t>a)t=t;else if(t!=a&&(t=a,r!="month"))for(e=parseInt(t),l=0;l<=o;l++)n(u[l].cells[e]).hasClass("e-selectedCell")&&(s=l)}}),{rowInx:f,maxrowInx:s,omincolIndex:i,omaxcolIndex:t}},_multipleCellAppointCreation:function(i){var r;if(t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow(),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),this._multiple=!0,this._slotByCellSelect(r),this.model.showQuickWindow&&i.type!=="beforeOpen"){this._quickAppointWindow.find("#"+this._id+"_quickAppwindow").css("display","block");new Date(new Date(this.cur_StartTime).setHours(0,0,0,0)).getTime()==new Date(new Date(this.cur_EndTime).setHours(0,0,0,0)).getTime()?this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"MMMM",this.model.locale)+" "+new Date(this.cur_StartTime).getDate()+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)):this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"MMMM",this.model.locale)+" "+new Date(this.cur_StartTime).getDate()+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+this._dayFullNames[new Date(this.cur_EndTime).getDay()]+", "+t.format(new Date(this.cur_EndTime),"MMMM",this.model.locale)+" "+new Date(this.cur_EndTime).getDate()+", "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale));this._quickAppointWindow.find(".subject").val("");this.model.readOnly||this._quickAppointWindow.ejDialog("open");var f=n(r).offset().left-(this._quickAppointWindow.width()-n(r).width())/2+10,e=n(r).offset().top-this._quickAppointWindow.height()-10,u=this._quickWindowPosition(f,e,n(r),this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:u.X,Y:u.Y}});this._quickAppointWindow.find(".subject").focus();t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(n(r))}this._cellClick=!0},_slotByCellSelect:function(t){var i=this.model.showWeekend?7:this.model.workWeek.length,u,f;this._cellIndex=n(t).hasClass("e-workcells")?n(t).index():n(t).hasClass("e-alldaycells")?n(t).index():i-((parseInt(n(t).index()/i)+1)*i-n(t).index())+n(t).parent().index()*i;this.model.orientation=="horizontal"&&(this._cellIndex=this.currentView()!=="month"?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)):this._cellIndex,this._workCellIndex=n(t).parent().index());var e=this._findMinMaxCellIndex(),o=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"?this.dateRender:this._dateRender,s=e.omincolIndex,h=e.omaxcolIndex,p=e.rowInx,c=e.maxrowInx,u=o[s],f=o[h];if(this.model.orientation=="vertical")if(n(t).hasClass("e-workcells")){var l=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,v=this.model.startHour*36e5+p*l*6e4,y=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)-1==c?this.model.startHour*36e5+(c+1)*l*6e4-1:this.model.startHour*36e5+(c+1)*l*6e4;this.cur_StartTime=new Date(new Date(u).setMilliseconds(v));this.cur_EndTime=new Date(new Date(f).setMilliseconds(y))}else if(n(t).hasClass("e-monthcells")){var r=this.element.find("td.e-selectedCell"),a=r.length-1,w=n(r[0]).parent().index()*i+(n(r[0]).index()-Math.floor(n(r[0]).index()/i)*i),b=n(r[a]).parent().index()*i+(n(r[a]).index()-Math.floor(n(r[a]).index()/i)*i),k=new Date(this._dateRender[w]),d=new Date(this._dateRender[b]);this.cur_StartTime=new Date(k.setHours(0,0,0));this.cur_EndTime=new Date(d.setHours(23,59,59))}else n(t).hasClass("e-alldaycells")&&(this.cur_StartTime=new Date(u),this.cur_EndTime=new Date(new Date(f).setHours(23,59,59)));else if(this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){var u=o[parseInt(s/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],f=o[parseInt(h/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],g=s%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),v=this.model.startHour+g/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),nt=h%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),y=this.model.startHour+nt/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot));this.cur_StartTime=new Date(u).setMinutes(v*60);this.cur_EndTime=new Date(f).setMinutes(y*60);this.cur_EndTime=new Date(new Date(this.cur_EndTime).setMinutes(new Date(this.cur_EndTime).getMinutes()+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))}else u=this.totdays[s],f=this.totdays[h],this.cur_StartTime=new Date(u),this.cur_EndTime=new Date(new Date(f).setHours(23,59,59))},_addCellSelection:function(t){var i=this.element.find("td.e-selectedCell"),r=i.length-1;r>0&&(this.element.find("td.e-selectedCell").removeClass("e-selectedCell"),n(t[this._currentRowIndex].cells[this._currentColIndex]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_processUpArrow:function(t,i){var e,r,u;if(n(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(t).hasClass("e-selectedCell")&&this._addCellSelection(i),e=this.element.find(".e-alldaycells"),n(t).hasClass("e-workcells")){var o=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)-1;if(r>0&&r<=o&&r!="undefined"){if(n(i[r-1].cells[u]).hasClass("e-resourceheadercells"))return!1;n(i[r].cells[u]).removeClass("e-selectedCell").blur();n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else r==0&&(this.model.orientation=="vertical"?(r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(this.element).attr("tabIndex",0).focus(),n(e[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else{if(n(t).hasClass("e-alldaycells"))return!1;if(n(t).hasClass("e-monthcells")){var o=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)-1;if(r>=0&&r<=o&&r!="undefined")f>=0?(n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._selectCurrentMonth(i,r,u);else return!1}else return!1}},_processDown:function(t,i){var o,s;if(n(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(t).hasClass("e-selectedCell")&&this._addCellSelection(i),n(t).hasClass("e-workcells")){var e=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)+1;if(r>=0&&r<=e&&r!="undefined")if(f<=e){if(n(i[r+1].cells[u]).hasClass("e-resourceheadercells"))return!1;n(i[r].cells[u]).removeClass("e-selectedCell").blur();n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else n(i[r].cells[u]).attr("tabIndex",0).focus()}else if(n(t).hasClass("e-alldaycells"))o=this.element.find("td.e-selectedCell")[0].cellIndex,s=this.element.find(".e-alldaycells"),n(s[o]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-workcells")[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(n(t).hasClass("e-monthcells")){var e=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)+1;r>=0&&r<e&&r!="undefined"&&(f<=7?(n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[f-1].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus());this._selectCurrentMonth(i,r,u)}else return!1},_processRight:function(i,r){var l,s,y,p,e,h;if(n(i).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i).hasClass("e-selectedCell")&&this._addCellSelection(r),n(i).hasClass("e-workcells")){var c=r[0].cells.length,f=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,o=parseInt(u)+1;if(u>=0&&u<parseInt(c)-1&&u!="undefined")n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(u==parseInt(c)-1)this.currentView()!="month"?(l=n(i).parent()[0].rowIndex,this.element.find("div.e-navigatenext").click(),n(r[l].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigatenext").click(),n(this.element.find("div.e-draggableworkarea tr")[f].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(i).hasClass("e-monthcells")){var a=Math.floor(n(i).index()/7),b=r.length-1,v=resmaxcolindex=7*(parseInt(a)+1),w=7*parseInt(a),f=n(i).parent()[0].rowIndex,u=n(i)[0].cellIndex,o=parseInt(u)+1;o<v&&(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus());u==parseInt(resmaxcolindex)-1&&f<this._dateRender.length/7&&(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),s=parseInt(f)+1,u=w,s<this._dateRender.length/7?(n(r[s].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),o<v&&n(r[s].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(y=u/7,this.element.find("div.e-navigatenext").click(),p=t.isNullOrUndefined(this.model.group)?0:y*7,n(this.element.find(".e-monthcells")[p]).addClass("e-selectedCell").attr("tabIndex",0).focus()));this._selectCurrentMonth(r,f,u)}else if(n(i).hasClass("e-alldaycells"))if(e=this.element.find("td.e-selectedCell")[0].cellIndex,h=parseInt(this.element.find(".e-alldaycells").length)-1,e>=0&&e<h)n(this.element.find(".e-alldaycells")[e]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-alldaycells")[parseInt(e)+1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(e==h)this.element.find("div.e-navigatenext").click(),n(this.element.find(".e-alldaycells")[0]).addClass("e-selectedCell").attr("tabIndex",0).focus();else return!1;this._keyPressed=!0},_processLeft:function(i,r){var l,f,u,h,w,b,k,d,e,c;if(n(i).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i).hasClass("e-selectedCell")&&this._addCellSelection(r),n(i).hasClass("e-workcells")){var o=r[0].cells.length,f=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,s=parseInt(u)-1;if(u>0&&u<=parseInt(o)-1&&u!="undefined")n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(u==0)this.currentView()!="month"?(l=n(i).parent()[0].rowIndex,this.element.find("div.e-navigateprevious").click(),n(r[l].cells[o-1]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigateprevious").click(),n(this.element.find("div.e-draggableworkarea tr")[f].cells[this.totdays.length-1]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(i).hasClass("e-monthcells")){var a=Math.floor(n(i).index()/7),nt=r.length-1,v=7*(parseInt(a)+1),g=7*parseInt(a),y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=this.model.orientation=="vertical"?y:this.currentView()=="month"?this.totdays.length:y*(this.model.endHour-this.model.startHour)*2;o=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&this.model.orientation=="vertical"?this.render_Resources[this.render_Resources.length-1].length*p:p;f=this.element.find("td.e-selectedCell").parent()[0].rowIndex;u=this.element.find("td.e-selectedCell")[0].cellIndex;u==g&&f>=0?(h=parseInt(f)-1,w=parseInt(v)-1,h>=0?(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[h].cells[w]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(b=u/7,this.element.find("div.e-navigateprevious").click(),k=this._dateRender.length/7,d=t.isNullOrUndefined(this.model.group)?0:b*7,n(this.element.find("div.e-draggableworkarea tr")[k-1].cells[d+6]).addClass("e-selectedCell").attr("tabIndex",0).focus())):u<v&&(s=parseInt(u)-1,n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus());this._selectCurrentMonth(r,f,u)}else if(n(i).hasClass("e-alldaycells"))if(e=this.element.find("td.e-selectedCell")[0].cellIndex,c=parseInt(this.element.find(".e-alldaycells").length)-1,e>0&&e<=c)n(this.element.find(".e-alldaycells")[e]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-alldaycells")[parseInt(e)-1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(e==0)this.element.find("div.e-navigateprevious").click(),n(this.element.find(".e-alldaycells")[c]).addClass("e-selectedCell").attr("tabIndex",0).focus();else return!1;this._keyPressed=!0},_selectCurrentMonth:function(t,i,r){t.find(".e-selectedCell").hasClass("e-othermonths")&&(t.find(".e-selectedCell").removeClass("e-selectedCell").blur(),n(t[i].cells[r]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_navigateToolbarRight:function(n){var t=this.model.views,i=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index(),r;i<t.length-1&&(r=t[i+1].toLowerCase(),this._navView=!0,this._viewChange(n,this.currentView(),r),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_navigateToolbarLeft:function(n){var t=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index(),i;t>0&&(i=this.model.views[t-1].toLowerCase(),this._navView=!0,this._viewChange(n,this.currentView(),i),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_newAppWindow:function(i){var u,f,b,v,k,w;if(n(i).hasClass("e-selectedCell")){t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._currentAction=t.Schedule.Actions.Add;var h=i==null?w:i,ut=n(h).parent().index(),ft=n(h).index(),r=this.model.orientation=="horizontal"&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this.dateRender:this._dateRender;if(r=this.model.orientation=="horizontal"&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r,u=parseInt(this.element.find("td.e-selectedCell").length)-1,_target=n(h),this._cellIndex=this.model.timeScale.enable?_target.hasClass("e-workcells")?_target.index():_target.hasClass("e-alldaycells")?_target.index():this._isCustomMonthView()&&this._oneWeek?_target.index():7-((parseInt(_target.index()/7)+1)*7-_target.index())+_target.parent().index()*7:this.model.orientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?7-((parseInt(_target.index()/7)+1)*7-_target.index())+_target.parent().index()*7:_target.index(),this.model.orientation=="horizontal"&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*2)):this._cellIndex:_target.index(),this._workCellIndex=_target.parent().index()),u==0){if(f=new Date(r[this._cellIndex]),this.model.minDate>f||this.model.maxDate<f)return!1;_target.hasClass("e-workcells")&&this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?(b=this.model.orientation=="vertical"?this.model.startHour+_target.parent().index()/2:this.model.startHour+(_target.index()-(this.model.endHour-this.model.startHour)*2*this._cellIndex)/2,v=b.toString().split("."),startTime=new Date(f).setHours(parseInt(v[0]),parseInt(v[1])==5?30:00),k=parseInt(new Date(startTime).getHours())==23&&parseInt(new Date(startTime).getMinutes())==30?new Date(startTime).getMinutes()+29:new Date(startTime).getMinutes()+30,endTime=new Date(new Date(startTime).setMinutes(k)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1})):(startTime=new Date(new Date(f).setHours(0,0,0)),endTime=new Date(new Date(f).setHours(23,59,59)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}))}else if(u>0){var c=this._findMinMaxCellIndex(),l=c.omincolIndex,a=c.omaxcolIndex,d=c.rowInx,g=c.maxrowInx;if(this.model.orientation=="vertical")if(n(i).hasClass("e-workcells")){var y=r[l],p=r[a],e=(this.model.startHour+d/2).toString().split("."),o=(this.model.startHour+g/2).toString().split(".");startTime=new Date(new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:00));endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:00);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else if(n(i).hasClass("e-monthcells")){var s=this.element.find("td.e-selectedCell"),nt=n(s[0]).parent().index()*7+(n(s[0]).index()-Math.floor(n(s[0]).index()/7)*7),tt=n(s[u]).parent().index()*7+(n(s[u]).index()-Math.floor(n(s[u]).index()/7)*7),it=new Date(this._dateRender[nt]),rt=new Date(this._dateRender[tt]);startTime=new Date(new Date(it).setHours(0,0,0));endTime=new Date(new Date(rt).setHours(23,59,59))}else n(i).hasClass("e-alldaycells")&&(startTime=new Date(new Date(r[l]).setHours(0,0,0)),endTime=new Date(new Date(r[a]).setHours(23,59,59)));else if(this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){var y=r[0],p=r[0],e=(this.model.startHour+l/2).toString().split("."),o=(this.model.startHour+a/2).toString().split(".");startTime=new Date(new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:00));endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:00);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else{var y=this.totdays[l],p=this.totdays[a],e=this.model.startHour.toString().split("."),o=this.model.startHour.toString().split(".");startTime=new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:00);endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:00);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30));endTime=new Date(new Date(endTime).setHours(23,59,59))}}if(w={startTime:new Date(startTime),endTime:new Date(endTime),target:_target,resources:(this.model.appointmentWindowOpen!=null||this.model.cellDoubleClick!=null)&&this._tempResource.length!=0?this._getResourceValue(_target):null},this._trigger("appointmentWindowOpen",w))return!1;t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._renderResourceData(n(h),this._cellIndex);this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",new Date(startTime));this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",new Date(endTime));this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(startTime),this._pattern.t,this.model.locale));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(endTime),this._pattern.t,this.model.locale));(n(i).hasClass("e-alldaycells")||this.currentView()=="month"||this._isCustomMonthView())&&this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0});this._timeZoneCollection(null);this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value");this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value");this._alldayCheck();this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open"));this._appointmentAddWindow.find(".subject").focus();this._cellClick=!1}},_tooltipEvents:function(n){var i;n=="disable"?t.isNullOrUndefined(this.element.data("ejTooltip"))||(i=this.element.ejTooltip("instance"),i._wireEvents(!1)):t.isNullOrUndefined(this.element.data("ejTooltip"))||(i=this.element.ejTooltip("instance"),i._wireEvents(!0))},_showToolTip:function(i){var i=i.event,u,r,f;if(t.isNullOrUndefined(i.target))return!1;if(u=this.element.data("ejTooltip"),n(i.target).hasClass("e-appup")||n(i.target).hasClass("e-appdown"))return u.setModel({content:this._getLocalizedLabels("AppointmentIndicator")}),!0;if(n(i.target).hasClass("e-appsoverflow"))return this._showAppCount(i);if(this.model.tooltipSettings.enable&&!t.isTouchDevice()){if(r=this._getAppDetails(i.currentTarget),r==!1)return!1;if(t.isNullOrUndefined(this.model.tooltipSettings.templateId))var e=this._timeMode=="12"?t.format(r[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(r[this._appointmentSettings.startTime],"HH:mm",this.model.locale),o=this._timeMode=="12"?t.format(r[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(r[this._appointmentSettings.endTime],"HH:mm",this.model.locale),s=r[this._appointmentSettings.subject]==""||t.isNullOrUndefined(r[this._appointmentSettings.subject])?this._getLocalizedLabels("NoTitle"):r[this._appointmentSettings.subject],f=s+": ("+e+"-"+o+")";else f=n(this.model.tooltipSettings.templateId).render(r).trim();return u.setModel({content:f}),!0}return!1},_showAppCount:function(i){var f=i.target.id.split("_"),l=this.currentView()!="day"?new Date(parseInt(n(i.currentTarget).attr("cellinfo"))):new Date(n(i.currentTarget).attr("cellinfo")),a,r,s,h,u,c,b;if(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&(a=this._resourceSort()[parseInt(f[f.length-2])].id),this.model.orientation=="horizontal"&&this.currentView()!="month")var k=parseInt(f[f.length-1]),v=new Date(l.setMilliseconds((this.model.startHour*60+k*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4)),d=new Date(v.setMilliseconds(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4));if(r=n.templates(n(this.model.appointmentTemplateId).html()),s=this.element.find(".e-appsoverflow").height(),this.model.orientation=="vertical"){var y=this.element.find(".e-monthcells").outerHeight(),e=this.element.find(".e-monthappointment").outerHeight(),g=this.element.find(".e-monthheader").height();t.isNullOrUndefined(e)&&(e=this.model.appointmentTemplateId?n(r.markup).css("height")=="100%"?y-this.element.find(".e-monthheader").height()-15:n(r.markup).css("height")=="0px"?20:n(r.markup).height():19);var p=parseInt(n(i.currentTarget).attr("appcount")),w=p*e+g+s,o=Math.round((w-y)/e);o=o==0?1:o}else{h=this.element.find(".e-workcells").outerHeight();u=this.currentView()=="month"?u=this.element.find(".e-monthappointment").outerHeight():this.element.find(".e-appointment").height();t.isNullOrUndefined(u)&&(u=this.model.appointmentTemplateId?n(r.markup).css("height")=="100%"?h-15:n(r.markup).css("height")=="0px"?20:n(r.markup).height():20);var s=this.element.find(".e-appsoverflow").height(),p=parseInt(n(i.currentTarget).attr("appcount")),w=p*u+s,o=Math.ceil((w-h)/u)}return(c={Date:l,ResourceValue:a,StartTime:v,EndTime:d},this._overflowApp=c,b=this.element.data("ejTooltip"),this._trigger("overflowButtonHover",{event:i,datas:c}))?!1:(b.setModel({content:o+" "+this._getLocalizedLabels("OverFlowAppCount")}),!0)},_horizontalRender:function(){var u,i,r,n,f;t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this.element.find(".resemptytd").width(this.element.find(".e-horizontalrestd").width()<100?5:this.element.find(".e-horizontalrestd").width()>=100&&this.element.find(".e-horizontalrestd").width()<=150?10:25);this._mediaQuery?this.element.find(".e-parentnode,.e-childnode").css({height:this.element.find(".e-workcells").height()}):(u=this._tempResource.length==0?this.res1.length:this._resourceSort().length,i=this.element.find("div#"+this._id+"_scroller").ejScroller("isHScroll")?this.element.find("div#"+this._id+"_scroller").find(".e-hscroll").outerHeight():0,i=t.isNullOrUndefined(i)?0:i,r=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top+i),t.isNullOrUndefined(this.model.group)||this._tempResource.length==0?this.element.find(".e-workcells").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):Math.round(r-1)+"px"}):(n=Math.round(r/u)-1,n=n<20?20:n,this.element.find(".e-workcells").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.element.find(".e-childnode").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.element.find(".e-parentnode").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.currentView()!="agenda"&&(f=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css({top:-f+"px"}))));this.element.find(".e-workcells").height()>r&&this.element.find("div#"+this._id+"_scroller").ejScroller("refresh");this.element.find("div#"+this._id+"_scroller").ejScroller("isVScroll")&&this._showScrollTd()},_monthCellsRender:function(){var n=this.element.find(".e-workcellstab tr").length,t=parseInt(this.scHeight)-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top);this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:Math.round(t/n))},_processTab:function(t,i,r){var u=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment"),h,c,o,e,f,s;if((t.id==this._id||n(t).hasClass("e-datedisplay"))&&(u.length!=0?n(u[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),n(t).hasClass("e-selectedCell")&&u.length!=0){if(h=this.element.find("td.e-selectedCell"),c=parseInt(h.length)-1,c>0)for(o=0;o<=c;o++)h.eq(o).removeClass("e-selectedCell").blur();else n(t).removeClass("e-selectedCell").blur();n(u[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}n(t).hasClass("e-navigateprevious")?this.element.find(".e-navigatenext").attr("tabIndex",0).focus():n(t).hasClass("e-navigatenext")&&(n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(r[0].cells[0]).hasClass("e-resourceheadercells")&&n(r[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());(n(t).hasClass("e-appointment")||n(t).hasClass("e-alldayappointment")||n(t).hasClass("e-monthappointment")||n(t).hasClass("e-agendaappointment"))&&(e=u.length,f=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),f<e&&f>=0?(n(u[f]).removeClass("e-selectedAppointment").blur(),s=parseInt(f)+1,s<e?n(u[s]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():s==e&&this.element.find(".e-navigateprevious").attr("tabIndex",0).focus()):f==e&&this.element.find(".e-navigateprevious").attr("tabIndex",0).focus())},_reverseTab:function(t,i,r){var u=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment"),h,e,c,l,o,f,s;if((t.id==this._id||n(t).hasClass("e-datedisplay"))&&(e=parseInt(u.length)-1,u.length!=0&&n(u[e]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()),h=u.length,n(t).hasClass("e-selectedCell")&&(e=u.length-1,u.length!=0)){if(c=this.element.find("td.e-selectedCell"),l=parseInt(c.length)-1,l>0)for(o=0;o<=l;o++)c.eq(o).removeClass("e-selectedCell").blur();else n(t).removeClass("e-selectedCell").blur();n(u[e]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}n(t).hasClass("e-navigatenext")?n(this.element).find(".e-navigateprevious").attr("tabIndex",0).focus():n(t).hasClass("e-navigateprevious")&&(n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(r[0].cells[0]).hasClass("e-resourceheadercells")&&n(r[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());(n(t).hasClass("e-appointment")||n(t).hasClass("e-alldayappointment")||n(t).hasClass("e-monthappointment")||n(t).hasClass("e-agendaappointment"))&&(f=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),f<h&&f>0?(n(u[f]).removeClass("e-selectedAppointment").blur(),s=parseInt(f)-1,s<h&&f>=0?n(u[s]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():s==0&&n(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()):f==0&&(n(u[f]).removeClass("e-selectedAppointment").blur(),n(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()))},_stopDefaultAction:function(n){n.cancelBubble=!0;n.returnValue=!1;n.stopPropagation();n.preventDefault()},_getLocalizedLabels:function(n){return n=="Categorize"?t.isNullOrUndefined(this.model.categorizeSettings.title)?this._localizedLabels[n]===r?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]:this.model.categorizeSettings.title:n=="Priority"?t.isNullOrUndefined(this.model.prioritySettings.title)?this._localizedLabels[n]===r?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]:this.model.prioritySettings.title:this._localizedLabels[n]===r?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]},_refreshDatasource:function(){var i,n,r;if(!t.isNullOrUndefined(this.dataSource())&&this.dataSource().length>0)for(i=this.dataSource(),n=0,r=i.length;n<r;n++)this._timeZoneAppointments(i[n],"")},refreshAppointments:function(){t.isNullOrUndefined(this._appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null);this._refreshDatasource();this._bindAppointmentsData("Refresh")},refresh:function(){this._refreshDatasource();this._destroy();this._init()},getSlotByElement:function(i){var r=t.isNullOrUndefined(i)?n(this.element.find("td.e-selectedCell")):n(i);return t.isNullOrUndefined(r)||r.length==0||this.currentView()=="agenda"?!1:((r.hasClass("e-workcells")||r.hasClass("e-monthcells")||r.hasClass("e-alldaycells"))&&(r.length==1?this._slotByElement(r,""):this._slotByCellSelect(r)),{startTime:new Date(this.cur_StartTime),endTime:new Date(this.cur_EndTime),resources:!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._getResourceValue(r):null})},saveAppointment:function(i){var tt,ri,d,gt,k,r,a,v,vt,ut,et,u,g,yt,ni,ht,s,ft,e,ti,ii,ct,rt,st,h,dt,lt,nt,b,at,y;if(!this.model.readOnly){if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties(),tt=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),ri=this._sortAppById(this._processed),this._publicMethodSave=!1,this.model.appointmentSettings.applyTimeOffset&&(t.isNullOrUndefined(i[this._appointmentSettings.startTimeZone])&&(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),t.isNullOrUndefined(i[this._appointmentSettings.endTimeZone])&&(i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone)),gt=this._timeZoneSavingAppoint(i,""),i=gt.obj,t.isNullOrUndefined(i[this._appointmentSettings.id])&&!i[this._appointmentSettings.id]!=""||(k=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i[this._appointmentSettings.id])),t.isNullOrUndefined(k[0])||(i.Guid=k[0].Guid,i.AppTaskId=k[0].AppTaskId,i[this._appointmentSettings.recurrenceId]=k[0][this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=k[0][this._appointmentSettings.recurrenceExDate],i.ParentId=k[0].ParentId)),r=this,this._maxId=d=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,a=this._currentAction=="save"?"edit":this._currentAction,t.isNullOrUndefined(i.AppTaskId)||i.AppTaskId==""){if((i[this._appointmentSettings.id]=t.isNullOrUndefined(i[this._appointmentSettings.id])||i[this._appointmentSettings.id]==""?d:i[this._appointmentSettings.id],i.AppTaskId=i.ParentId=d,i.Guid=this._guidFormatGenerate(),this._trigger("actionBegin",{data:i,requestType:"appointmentSave",methodType:"public"}))||this._trigger("beforeAppointmentCreate",{appointment:i,methodType:"public"}))return!1;for(v=this._timeZoneAppointments(i,""),h=this._dataManager.insert(v,this.model.appointmentSettings.query._fromTable),new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(v,"reverse")),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(v),this._appointmentProcessing(i),this._currentViewAppointments=this._appointmentCount(),vt=this._currentViewAppointments.filter(function(n){return i.ParentId==n.ParentId}),ut=0,y=vt.length;ut<y;ut++)this._refreshDayAppointments(vt[ut]);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;this._trigger("appointmentCreated",{appointment:v,requestType:"appointmentSaved",methodType:"public"});this._trigger("actionComplete",{data:v,requestType:"appointmentSave",methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var u=t.isNullOrUndefined(i.record)?i:i.record,f,e;if(n.isArray(u))r._processUrlBinding(i);else if(n.isPlainObject(u)&&u.added.length>0)for(r._dateFormat(u.added),f=0,e=u.added.length;f<e;f++)v[r._appointmentSettings.id]=u.added[f][r._appointmentSettings.id],v[r._appointmentSettings.recurrence]||(v.ParentId=u.added[f][r._appointmentSettings.id]),new t.DataManager(r._processed).update("Guid",v)})}else if(this._currentAction=="editOccurrence"){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:a})||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:a}))return!1;var p=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],ft=p[this._appointmentSettings.recurrenceId]==null?p.ParentId:p[this._appointmentSettings.recurrenceId],et=p[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,c=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(et,t.FilterOperators.equal,ft))),l=this._recuCollectionIndex(c,p),o=this._appointmentSettings;if(l==0?t.isNullOrUndefined(c[l+1])?!1:!(new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()):l==c.length-1?!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1;s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));this._objDate=s;et=this._objDate[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId;e=this._deleteOcurrence(this._objDate[0][et],new Date(s[0][this._appointmentSettings.startTime]));i[this._appointmentSettings.recurrence]=1;i[this._appointmentSettings.recurrenceRule]=e[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+e[0].ParentId;i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId];i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExdate];i.Guid=s[0].Guid;i[this._appointmentSettings.id]=s[0][this._appointmentSettings.id];u=[];g=this._addAppData(i,d,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),i[this._appointmentSettings.recurrenceId]);g[this._appointmentSettings.id]=g.AppTaskId;u.push(g);var w=[],e=[],ot=u[0][this._appointmentSettings.startTimeZone];ot!=this.model.timeZone?w.push(this._timeZoneAppointments(u[0],"")):w.push(u[0]);yt=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,this._parentId));ot!=this.model.timeZone?e.push(this._timeZoneAppointments(yt[0],"")):e.push(yt[0]);var st=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:w,changed:e,deleted:[]},st,this.model.appointmentSettings.query._fromTable),ui=ot!=this.model.timeZone?this._timeZoneAppointments(w[0],"reverse"):w[0];for(new t.DataManager(this._currentAppointmentData).update("AppTaskId",ui),ni=ot!=this.model.timeZone?this._timeZoneAppointments(e[0],"reverse"):e[0],new t.DataManager(this._currentAppointmentData).update("AppTaskId",ni),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u[0]),ht=this._processed.filter(function(n){return n.Guid==u[0].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ht},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ht},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ht},"Guid"),this._appointmentProcessing(u[0]),this._currentViewAppointments=this._appointmentCount(),nt=this._currentViewAppointments.filter(function(n){return n.ParentId==u[0].ParentId}),b=0,y=nt.length;b<y;b++)this._refreshDayAppointments(nt[b]);this._trigger("appointmentChanged",{appointment:u[0],requestType:"appointmentChanged",currentAction:a,methodType:"public"});this._trigger("actionComplete",{data:u,requestType:"appointmentEdit",currentAction:a,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var f=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(f))r._processUrlBinding(i);else if(n.isPlainObject(f)&&f.added.length>0)for(r._dateFormat(f.added),e=0,o=f.added.length;e<o;e++)u[0][r._appointmentSettings.id]=f.added[e][r._appointmentSettings.id],u[0][r._appointmentSettings.recurrence]||(u[0].ParentId=f.added[e][r._appointmentSettings.id]),new t.DataManager(r._processed).update("Guid",u[0])})}else if(this._currentAction=="save"&&i[this._appointmentSettings.recurrence]||this._currentAction==t.Schedule.Actions.EditSeries){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:a})||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:a}))return!1;if(s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._currentAction!=t.Schedule.Actions.EditSeries){t.isNullOrUndefined(s[0][this._appointmentSettings.recurrenceRule])||(i[this._appointmentSettings.recurrenceRule]=s[0][this._appointmentSettings.recurrenceRule]);var p=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],ft=p[this._appointmentSettings.recurrenceId]==null?p.ParentId:p[this._appointmentSettings.recurrenceId],et=p[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,c=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(et,t.FilterOperators.equal,ft))),l=this._recuCollectionIndex(c,p),o=this._appointmentSettings;if(l==0?t.isNullOrUndefined(c[l+1])?!1:!(new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()):l==c.length-1?!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(c[l-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(c[l+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else ft=s[0][this._appointmentSettings.recurrenceId]==null?s[0].ParentId:s[0][this._appointmentSettings.recurrenceId],e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,ft)),d=i.AppTaskId=e[0].AppTaskId,i[this._appointmentSettings.id]=e[0][this._appointmentSettings.id],i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExate],i[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(tt._recRule)||tt._recRule==""?e[0][this._appointmentSettings.recurrenceRule]:tt._recRule;i.Guid=s[0].Guid;i[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?s[0][this._appointmentSettings.id]:i[this._appointmentSettings.id];var u=[],g,pt=this._currentAction==t.Schedule.Actions.EditOccurrence||!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?this._parentId:this._currentAction==t.Schedule.Actions.Save?s[0].AppTaskId:d,wt=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&this._currentAction!=t.Schedule.Actions.EditOccurrence&&i[this._appointmentSettings.allDay]==!0?pt:this._currentAction==t.Schedule.Actions.Save?s[0].AppTaskId:this._appMainId+1;wt=this._currentAction==t.Schedule.Actions.EditSeries?pt:wt;g=this._addAppData(i,wt,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),pt);u.push(g);var w=[],f=[],it=[],fi=this._currentAction==t.Schedule.Actions.Save?u[0].Guid:u[0][this._appointmentSettings.recurrenceId],ei=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId,e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(ei,t.FilterOperators.equal,fi));if(!t.isNullOrUndefined(e)&&e.length>0?f.push(u[0]):w.push(u[0]),this._currentAction==t.Schedule.Actions.EditSeries)for(ti=t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+u[0].ParentId,!0)),ii=new t.DataManager(this._currentAppointmentData).executeLocal(ti),it=it.concat(ii),f[0][this._appointmentSettings.recurrenceRule]=tt._recRule,f[0][this._appointmentSettings.recurrenceExDate]=null,new t.DataManager(this._currentAppointmentData).remove("ParentId",f[0].ParentId),ct=this._processed.filter(function(n){return n.ParentId==f[0].ParentId}),this._processed=this._processed.filter(function(n){return n.ParentId!=f[0].ParentId}),this._renderedAllDay=this._renderedAllDay.filter(function(n){return n.ParentId!=f[0].ParentId}),this._renderedApp=this._renderedApp.filter(function(n){return n.ParentId!=f[0].ParentId}),rt=0,y=ct.length;rt<y;rt++)this._appointmentRemove(ct[rt]),this._refreshDayAppointments(ct[rt]);var r=this,bt=[],kt=[];for(w.length>0&&bt.push(this._timeZoneAppointments(w[0],"")),f.length>0&&kt.push(this._timeZoneAppointments(f[0],"")),st=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:bt,changed:kt,deleted:it},st,this.model.appointmentSettings.query._fromTable),f.length>0&&(dt=this._timeZoneAppointments(kt[0],"reverse")),w.length>0&&(dt=this._timeZoneAppointments(bt[0],"reverse")),new t.DataManager(this._currentAppointmentData).update("AppTaskId",dt),new t.DataManager(this._currentAppointmentData).remove("Guid",f[0]),lt=this._processed.filter(function(n){return n.Guid==f[0].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:lt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:lt},"Guid"),this._currentAppointmentData.push(f[0]),this._appointmentProcessing(f[0]),this._currentViewAppointments=this._appointmentCount(),nt=this._currentViewAppointments.filter(function(n){return n.ParentId==f[0].ParentId}),b=0,y=nt.length;b<y;b++)this._refreshDayAppointments(nt[b]);for(at=0,y=it.length;at<y;at++)this._refreshDayAppointments(it[at]);this._trigger("appointmentChanged",{appointment:f[0],requestType:"appointmentChanged",currentAction:a,methodType:"public"});this._trigger("actionComplete",{data:f,requestType:"appointmentEdit",currentAction:a,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var u=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(u))r._processUrlBinding(i);else if(n.isPlainObject(u)&&u.added.length>0)for(r._dateFormat(u.added),e=0,o=u.added.length;e<o;e++)f[0][r._appointmentSettings.id]=u.added[e][r._appointmentSettings.id],f[0][r._appointmentSettings.recurrence]||(f[0].ParentId=u.added[e][r._appointmentSettings.id])})}else{if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:a,methodType:"public"})||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:a,methodType:"public"}))return!1;var v=this._timeZoneAppointments(i,""),st=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.update(st,v,this.model.appointmentSettings.query._fromTable);new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(v,"reverse"));this._renderSingleApp();this._trigger("appointmentChanged",{appointment:i,requestType:"appointmentChanged",currentAction:a,methodType:"public"});this._trigger("actionComplete",{data:i,requestType:"appointmentEdit",currentAction:a,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(u){var f=t.isNullOrUndefined(u.record)?u:u.record,e,o;if(n.isArray(f))r._processUrlBinding(u);else if(n.isPlainObject(f)&&f.added.length>0)for(r._dateFormat(f.added),e=0,o=f.added.length;e<o;e++)i[r._appointmentSettings.id]=f.added[e][r._appointmentSettings.id],i[r._appointmentSettings.recurrence]||(i.ParentId=f.added[e][r._appointmentSettings.id])})}this._currentViewAppointments=this._appointmentCount();this.model.showAppointmentNavigator&&this._nextPrevButton()}},print:function(i){if(t.isNullOrUndefined(i)){var r=this.element.clone();this.currentView()=="agenda"?(r.width(this.element.find(".e-agendacellstab").width()+2),r.height(n("#"+this._id+" .e-headertr").height()+this.element.find(".e-agendacellstab").height()+n("#"+this._id+" .e-scheduleheader").height()+2),r.find("div#"+this._id+"_scroller").ejScroller({width:this.element.find(".e-agendacellstab").width(),height:this.element.find(".e-agendacellstab").height()+2}),r.find(".e-commonviewbutton").css({"margin-top":"0px"}),r.find(".e-viewstable").css({"padding-top":"15px"})):(r.find(".e-upicon,.e-downicon").remove(),this.model.orientation=="vertical"?this.model.timeScale.enable?(this.currentView()=="month"||this._isCustomMonthView()&&this._renderDays>7?r.width(this.element.find(".e-workcellstab").width()+n(".e-monthleftindent").width()):r.width(this.element.find(".e-workcellstab").width()+n(".e-workleftindent").width()),r.height(n("#"+this._id+" .e-headertr").height()+n("#"+this._id+" .e-workcellstab").height()+n("#"+this._id+" .e-scheduleheader").height()+2),r.find(".e-scroller").ejScroller({width:n(".e-dateheader").width(),height:n("#"+this._id+" .e-workcellstab").height()+2}),r.find(".e-scrolltimecells").css({top:0}),r.find(".e-commonviewbutton").css({"margin-top":"0px"}),r.find(".e-viewstable").css({"padding-top":"15px"}),r.children().first().css({border:"0px solid #bbbcbb"}),r.css({border:"1px solid #bbbcbb"}),this.currentView()=="month"&&r.find(".e-draggableworkarea").css({height:this.element.find(".e-timecells").height()*this.element.find(".e-timecells").length+2})):(r.width(this.element.find(".e-workcellstab").width()+n(".e-workleftindent").width()),r.find(".e-workcellstab").css({left:-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"})):this.currentView()=="month"||this._isCustomMonthView()&&this._renderDays>7?r.width(this.element.find(".e-workcellstab").width()):(r.find(".e-workcellstab").css({left:-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"}),r.find(".e-horizontaltimecells tr:nth-child(2)").css("left",-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft()+"px")));this._schedulePrint(r)}else this._printAppointment(i)},_schedulePrint:function(i,r){var f=t.buildTag("div"),o=i.clone(),s=Math.round(o.width()/100)*100,r,e,u;f.append(o);r||(r=window.open("","print","height=452,width="+s+",tabbar=no"));r.document.write("<!DOCTYPE html>");e=n("head").find("link").add("style");t.browserInfo().name==="msie"?(u="",e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.write("<html><head><\/head><body>"+u+f[0].innerHTML+"<\/body><\/html>")):(u="",r.document.write("<html><head>"),e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.writeln(u+"<\/head><body>"),r.document.writeln(f[0].innerHTML+"<\/body><\/html>"));r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},1e3))},1e3)},notifyChanges:function(i,r){var e,u,f;t.isNullOrUndefined(r)&&r.length==0||(e=t.isNullOrUndefined(r)?r[0]:r,u=n.extend(!0,{},e),u[this._appointmentSettings.startTime]=new Date(u[this._appointmentSettings.startTime]),u[this._appointmentSettings.endTime]=new Date(u[this._appointmentSettings.endTime]),i=="beforeAppointmentCreate"?(new t.DataManager(this._currentAppointmentData).insert(u),this._appointmentProcessing(u),this._renderAppointmentAll()):i=="beforeAppointmentChange"?(new t.DataManager(this._currentAppointmentData).update(this._appointmentSettings.id,u),new t.DataManager(this._processed).remove(this._appointmentSettings.id,u[this._appointmentSettings.id]),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):i=="beforeAppointmentRemove"&&(f=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[this._appointmentSettings.id])),new t.DataManager(this._currentAppointmentData).remove(this._appointmentSettings.id,f[0][this._appointmentSettings.id]),new t.DataManager(this._processed).remove(this._appointmentSettings.id,f[0][this._appointmentSettings.id]),this._renderAppointmentAll()))},deleteAppointment:function(n){var i;this.model.readOnly||(typeof n=="string"?(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,n)),i[0][this._appointmentSettings.recurrence]?(this._deleteUid=n,this._deletingAppointment()):this._deleteApp(n)):typeof n=="object"&&(this._deleteUid=n.Guid,t.isNullOrUndefined(this._deleteUid)&&(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,n.ParentId)),this._deleteUid=i[0].Guid),n[this._appointmentSettings.recurrence]?this._deletingAppointment():this._deleteApp(this._deleteUid)))},getAppointments:function(){return this.dataSource()},searchAppointments:function(n,i,r,u){var e=t.isNullOrUndefined(i)?this._getColumns(this._appointmentSettings):i,o=t.isNullOrUndefined(r)?"contains":r,s=t.isNullOrUndefined(u)?!0:u,f;return typeof n=="string"?f=n==""?[]:new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).search(n,e,o,s)):typeof n=="object"&&(f=this.filterAppointments(n)),f},filterAppointments:function(n){var e,o=t.Query(),u,r,f,i;if(!t.isNullOrUndefined(n)){for(r=n[0],u=t.isNullOrUndefined(r.matchcase)?!0:r.matchcase,f=t.Predicate(r.field,r.operator,r.value,u),i=1;i<n.length;i++)u=t.isNullOrUndefined(n[i].matchcase)?!0:n[i].matchcase,f=f[n[i].predicate](n[i].field,n[i].operator,n[i].value,u);o.where(f);e=new t.DataManager(this._currentAppointmentData).executeLocal(o)}return e},refreshScroller:function(){var i=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),r=this.model.orientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):this.model.orientation=="horizontal"&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width();i.model.width=parseInt(r)-2;i.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top);i.refresh();this.model.orientation=="vertical"?(this._renderHoriVerticalScroll(),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px")):(n(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-horizontresdiv").height(this.element.find(".e-draggableworkarea").height()));this._reRenderHeaderBar();this.model.showAppointmentNavigator&&this._refreshAppNavigation();this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();this._highlightCurrentTime(this.model.showCurrentTimeIndicator);(this.currentView()=="month"||this._isCustomMonthView())&&this.model.orientation=="vertical"&&this._renderCurrentView("ScheduleResize");this._showScrollTd();this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36)},_refreshAppNavigation:function(){var i=this.element.find("#"+this._id+"_scroller");if((this._browserInfo.name!=="msie"||!(this._browserInfo.version<9))&&!t.isNullOrUndefined(i.data("ejScroller"))){var u=i.ejScroller("instance").isVScroll()?i.find(".e-vscroll").outerWidth():0,r=i.height()/2-75,n=this.element.find(".e-scrolltimecells").parent().outerWidth();n=t.isNullOrUndefined(n)?0:n;this.model.enableRTL?(this.element.find(".e-prevapp").css({top:r+40+"px",transform:"rotate(-90deg)",right:n-61+"px"}),this.element.find(".e-nextapp").css({top:r+40+"px",transform:"rotate(90deg)",right:this.element.find(".e-workareadiv").width()-61-u-30+"px"})):(this.element.find(".e-prevapp").css({top:r+40+"px",transform:"rotate(90deg)",left:n-61+"px"}),this.element.find(".e-nextapp").css({top:r+40+"px",transform:"rotate(-90deg)",left:this.element.find(".e-workareadiv").width()-61-u-30+"px"}))}},getDifference:function(n){var t="";return n.toString().indexOf("-")!=-1?(t=n.toString().substring(n.toString().indexOf("-")+1,n.toString().indexOf("-")+5),-(parseInt(t.substring(0,2))*60)+parseInt(t.substring(2,4))):(t=n.toString().substring(n.toString().indexOf("+")+1,n.toString().indexOf("+")+5),parseInt(t.substring(0,2))*60+parseInt(t.substring(2,4)))},exportSchedule:function(i,r,u){var l={},e=[],o=[],h,y,a,v,f,w,b,k,d;for(n.extend(!0,l,this.model),n.extend(!0,e,this._processed),n.extend(!0,o,this._processedIntervals),f=0;f<e.length;f++)e[f][this._appointmentSettings.startTime]=new Date(e[f][this._appointmentSettings.startTime].getTime()+this.getDifference(e[f][this._appointmentSettings.startTime])*6e4),e[f][this._appointmentSettings.endTime]=new Date(e[f][this._appointmentSettings.endTime].getTime()+this.getDifference(e[f][this._appointmentSettings.endTime])*6e4);for(h=0;h<o.length;h++)o[h][this.model.blockoutSettings.startTime]=new Date(o[h][this.model.blockoutSettings.startTime].getTime()+this.getDifference(o[h][this.model.blockoutSettings.startTime])*6e4),o[h][this.model.blockoutSettings.endTime]=new Date(o[h][this.model.blockoutSettings.endTime].getTime()+this.getDifference(o[h][this.model.blockoutSettings.endTime])*6e4);y=new Date(new Date(this.currentDate()).setHours(0,0,0));l.currentDate=new Date(y.getTime()+this.getDifference(y)*6e4);a=JSON.parse(JSON.stringify(this._appointmentSettings));n.extend(!0,l.appointmentSettings,a);v=JSON.parse(JSON.stringify(this.model.blockoutSettings));n.extend(!0,l.blockoutSettings,v);var c=JSON.parse(JSON.stringify(l)),g={action:i,method:"post"},s=t.buildTag("form","",null,g),p=this.currentView()=="day"?"Day":this.currentView()=="month"?"Month":this.currentView()=="week"?"Week":this.currentView()=="agenda"?"Agenda":this.currentView()=="workweek"?"WorkWeek":"CustomView";if(this._ignoreFromAppointmentOnExport)for(f=0;f<this._ignoreFromAppointmentOnExport.length;f++)delete a[this._ignoreFromAppointmentOnExport[f]],delete v[this._ignoreFromAppointmentOnExport[f]];if(this._ignoreFromModelOnExport)for(f=0;f<this._ignoreFromModelOnExport.length;f++)delete c[this._ignoreFromModelOnExport[f]];if(delete c.appointmentSettings.dataSource,delete c.blockoutSettings.dataSource,t.raiseWebFormsServerEvents)w={model:c,originalEventType:r},b={appSetting:JSON.stringify(a),appId:u,processedApp:JSON.stringify(e),blockedApp:JSON.stringify(o),model:JSON.stringify(c),locale:this._getLocalizedLabels(p)+","+this._getLocalizedLabels("AllDay")+","+this._getLocalizedLabels("Date")+","+this._getLocalizedLabels("Time")+","+this._getLocalizedLabels("Event")},t.raiseWebFormsServerEvents(r,w,b);else{var nt={name:"ScheduleApps",type:"hidden",value:JSON.stringify(a)},tt=t.buildTag("input","",null,nt),it={name:"ScheduleBlockedApps",type:"hidden",value:JSON.stringify(v)},rt=t.buildTag("input","",null,it),ut={name:"ScheduleModel",type:"hidden",value:JSON.stringify(c)},ft=t.buildTag("input","",null,ut),e={name:"ScheduleProcesedApps",type:"hidden",value:JSON.stringify(e)},et=t.buildTag("input","",null,e),o={name:"ScheduleProcesedIntervalsApps",type:"hidden",value:JSON.stringify(o)},ot=t.buildTag("input","",null,o),st={name:"Locale",type:"hidden",value:this._getLocalizedLabels(p)+","+this._getLocalizedLabels("AllDay")+","+this._getLocalizedLabels("Date")+","+this._getLocalizedLabels("Time")+","+this._getLocalizedLabels("Event")},ht=t.buildTag("input","",null,st);s.append(ft);s.append(et);s.append(ot);s.append(ht);t.isNullOrUndefined(u)||(k={name:"AppointmentId",type:"hidden",value:u},d=t.buildTag("input","",null,k),s.append(d));s.append(tt);s.append(rt);s.append(this);n("body").append(s);s.submit()}return!0}});t.scheduleFeatures.resources&&n.extend(t.Schedule.prototype,t.scheduleFeatures.resources);t.scheduleFeatures.horizontal&&n.extend(t.Schedule.prototype,t.scheduleFeatures.horizontal);t.Schedule.Locale=t.Schedule.Locale||{};t.Schedule.Locale["default"]=t.Schedule.Locale["en-US"]={ReminderWindowTitle:"Reminder window",CreateAppointmentTitle:"Create Appointment",RecurrenceEditTitle:"Edit Repeat Appointment",RecurrenceEditMessage:"How would you like to change the appointment in the series?",RecurrenceEditOnly:"Only this appointment",RecurrenceEditSeries:"Entire series",PreviousAppointment:"Previous Appointment",NextAppointment:"Next Appointment",AppointmentSubject:"Subject",StartTime:"Start Time",EndTime:"End Time",AllDay:"All day",StartTimeZone:"Start TimeZone",EndTimeZone:"End TimeZone",Today:"Today",Recurrence:"Repeat",Done:"Done",Cancel:"Cancel",Ok:"OK",Repeat:"Repeat",RepeatBy:"Repeat by",RepeatEvery:"Repeat every",RepeatOn:"Repeat on",StartsOn:"Starts on",Ends:"Ends",Summary:"Summary",Daily:"Daily",Weekly:"Weekly",Monthly:"Monthly",Yearly:"Yearly",Every:"Every",EveryWeekDay:"Every weekday",Never:"Never",After:"After",Occurrence:"Occurrence(s)",On:"On",Edit:"Edit",RecurrenceDay:"Day(s)",RecurrenceWeek:"Week(s)",RecurrenceMonth:"Month(s)",RecurrenceYear:"Year(s)",The:"The",OfEvery:"of every",First:"First",Second:"Second",Third:"Third",Fourth:"Fourth",Last:"Last",WeekDay:"Weekday",WeekEndDay:"Weekendday",Subject:"Subject",Categorize:"Categories",DueIn:"Due In",DismissAll:"Dismiss All",Dismiss:"Dismiss",OpenItem:"Open Item",Snooze:"Snooze",Day:"Day",Week:"Week",WorkWeek:"Work Week",Month:"Month",AddEvent:"Add Event",CustomView:"Custom View",Agenda:"Agenda",Detailed:"Edit Appointment",EventBeginsin:"Appointment Begins in",Editevent:"Edit Appointment",Editseries:"Edit Series",Times:"times",Until:"until",Eventwas:"Appointment was",Hours:"hrs",Minutes:"mins",Overdue:"Overdue Appointment",Days:"day(s)",Event:"Event",Select:"select",Previous:"Previous",Next:"Next",Close:"Close",Delete:"Delete",Date:"Date",Showin:"Show in",Gotodate:"Go To Date",Resources:"RESOURCES",RecurrenceDeleteTitle:"Delete Repeat Appointment",Location:"Location",Priority:"Priority",RecurrenceAlert:"Alert",RecurrenceDateValidation:"Some months have fewer than selected dates. For these months, the occurrence will fall on the last date of the month.",NoTitle:"No Title",OverFlowAppCount:"more appointment(s)",AppointmentIndicator:"Click for more appointments",WrongPattern:"The recurrence pattern is not valid",CreateError:"The duration of the appointment must be shorter than how frequently it occurs. Shorten the duration, or change the recurrence pattern in the Appointment Recurrence dialog box.",DragResizeError:"Cannot reschedule an occurrence of the recurring appointment if it skips over a later occurrence of the same appointment.",StartEndError:"End time should be greater than start time",SeriesChangeAlert:"The changes made to specific instances of this series will be cancelled and those appointments will match the series again.",MouseOverDeleteTitle:"Delete Appointment",DeleteConfirmation:"Are you sure you want to delete this appointment?",Time:"Time",EmptyResultText:"No suggestions",BlockIntervalAlertTitle:"Alert",BlockIntervalError:"The selected time interval has been blocked and is unavailable for selection."};t.Schedule.Actions={Add:"add",Save:"save",Delete:"delete",DeleteOccurrence:"deleteOccurrence",DeleteSeries:"deleteSeries",EditOccurrence:"editOccurrence",EditSeries:"editSeries"};t.Schedule.CurrentView={Day:"day",Week:"week",Workweek:"workweek",Month:"month",CustomView:"customview",Agenda:"agenda"};t.Schedule.TimeMode={Hour12:"12",Hour24:"24"};t.Schedule.Orientation={Vertical:"vertical",Horizontal:"horizontal"};t.Schedule.DayOfWeek={Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};RecurrenceEditor=function(n){function t(t,i){return n.call(this),this.defaults={frequencies:["never","daily","weekly","monthly","yearly","everyweekday"],firstDayOfWeek:null,enableSpinners:!0,startDate:new Date,locale:"en-US",enableRTL:!1,value:"",dateFormat:"",selectedRecurrenceType:0,minDate:new Date(1900,1,1),maxDate:new Date(2099,12,31),cssClass:"",change:null,create:null},this.dataTypes={frequencies:"array",enableSpinners:"boolean",enableRTL:"boolean"},this.rootCSS="e-recurrenceeditor",this.PluginName="ejRecurrenceEditor",this._id="null",this.validTags=["div"],this.model=this.defaults,t&&(this._id=t[0].id,t.jquery||(t=$("#"+t)),t.length)?$(t).ejRecurrenceEditor(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype._setModel=function(n){var i=!1;for(var t in n){switch(t){case"frequencies":this.model.frequencies=n[t];i=!0;break;case"firstDayOfWeek":this.model.firstDayOfWeek=this._firstDayOfWeek=n[t];i=!0;break;case"enableSpinners":this.model.enableSpinners=n[t];i=!0;break;case"startDate":$.type(n[t])=="string"?this._currentDateFormat(this.model.dateFormat):$.type(n[t])=="function"&&$.type(ej.util.getVal(n[t]))=="string"&&(this.model.startDate=ej.parseDate(this.model.startDate.toString(),this._datepattern()));this.model.startDate<this.model.minDate?this.model.startDate=this.model.minDate:"";this.model.startDate>this.model.maxDate?this.model.startDate=this.model.maxDate:"";this._recurrenceContent.find(".recurstartdate").ejDatePicker("option","value",this.model.startDate);break;case"locale":this.model.locale=n[t];i=!0;break;case"enableRTL":this.model.enableRTL=n[t];this._recurrenceLayout.addClass("e-rtl");break;case"value":this.model.value=n[t];break;case"dateFormat":this.model.dateFormat=n[t];this._recurrenceContent.find(".recurstartdate").ejDatePicker("option","dateFormat",this.model.dateFormat);this._recurrenceContent.find(".until").ejDatePicker("option","dateFormat",this.model.dateFormat);break;case"selectedRecurrenceType":this.model.selectedRecurrenceType=n[t];this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:this.model.selectedRecurrenceType});break;case"minDate":case"maxDate":this._currentDateFormat(this.model.dateFormat);this._recurrenceContent.find(".recurstartdate").ejDatePicker({minDate:this.model.minDate,maxDate:this.model.maxDate});break;case"cssClass":this.model.cssClass=n[t];this.element.removeClass(this.model.cssClass).addClass(n[t])}i==!0&&this._render()}},t.prototype._init=function(){ej.isNullOrUndefined(this.element)||this._render()},t.prototype._destroy=function(){var i,t,n;for(this.element.off(),i=this.element.find(".e-datepicker,.e-dropdownlist"),t=0;t<i.length;t++)n=$(i[t]),n.hasClass("e-datepicker")?n.ejDatePicker("destroy"):n.hasClass("e-dropdownlist")&&n.ejDropDownList("destroy");this.element.empty().removeClass("e-recurrenceeditor")},t.prototype._render=function(){var t,n;for($("#"+this._id+"recurrenceeditor").remove(),this._currentDateFormat(this.model.dateFormat),this._initializePrivateProperties(),t=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:document.documentElement.clientWidth+(t?17:0)<361||ej.isMobile(),this.model.frequencies=this.model.frequencies.toString().toLowerCase().split(","),n=0;n<this.model.frequencies.length;n++)this.model.frequencies[n]=this.model.frequencies[n]=="everyweekday"?"EveryWeekDay":this.model.frequencies[n].replace(/^./,function(n){return n.toUpperCase()});this._renderRecurrenceEditor()},t.prototype._initializePrivateProperties=function(){this._rRule={};this.flag=!0;this._subControlChange=!1;this._culture=ej.preferredCulture(this.model.locale);this._dayNamesArray=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];this._firstDayOfWeek=this.model.firstDayOfWeek!=null?typeof this.model.firstDayOfWeek=="string"?this._dayNamesArray.indexOf(this.model.firstDayOfWeek.toString().toLowerCase()):this.model.firstDayOfWeek:this._culture.calendar.firstDay;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this._browserInfo=ej.browserInfo();this._dayNamesValue=["SU","MO","TU","WE","TH","FR","SA"];this._dayNames=[];this._dayShortNames=[];this._dayFullNames=[];var n=this._firstDayOfWeek;do n>6&&(n=0),this._dayFullNames.push(this._culture.calendar.days.names[n]),this._dayShortNames.push(this._culture.calendar.days.namesAbbr[n]),this._dayNames.push(this._dayNamesValue[n]),n++;while(this._dayNames.length<7);this._mediaQuery=!1},t.prototype._currentDateFormat=function(n){var t,i,r,u;ej.isNullOrUndefined(n)||$.type(this.model.startDate)=="date"&&$.type(this.model.minDate)=="date"&&$.type(this.model.maxDate)=="date"?n=="MM/dd/yyyy"&&($.type(this.model.startDate)!="date"||$.type(this.model.minDate)!="date"||$.type(this.model.maxDate)!="date")&&(u=ej.parseDate(this.model.startDate.toString(),n),t=ej.parseDate(this.model.minDate.toString(),n),i=ej.parseDate(this.model.maxDate.toString(),n),this.model.startDate=ej.isNullOrUndefined(u)?this.model.startDate:u,this.model.minDate=ej.isNullOrUndefined(t)?this.model.minDate:t,this.model.maxDate=ej.isNullOrUndefined(i)?this.model.maxDate:i):(r=ej.parseDate(this.model.startDate.toString(),this.model.dateFormat),t=ej.parseDate(this.model.minDate.toString(),this.model.dateFormat),i=ej.parseDate(this.model.maxDate.toString(),this.model.dateFormat),this.model.startDate=ej.isNullOrUndefined(r)?new Date(this.model.startDate.toString()).toString()=="Invalid Date"||new Date(this.model.startDate.toString()).toString()=="NaN"?this._dateConvert(this.model.startDate):new Date(this.model.startDate.toString()):r,this.model.minDate=ej.isNullOrUndefined(t)?new Date(this.model.minDate.toString()).toString()=="Invalid Date"||new Date(this.model.minDate.toString()).toString()=="NaN"?this._dateConvert(this.model.minDate):new Date(this.model.minDate.toString()):t,this.model.maxDate=ej.isNullOrUndefined(i)?new Date(this.model.maxDate.toString()).toString()=="Invalid Date"||new Date(this.model.maxDate.toString()).toString()=="NaN"?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate.toString()):i)},t.prototype._renderRecurrenceEditor=function(){var n,t;for(this._recurrenceLayout=ej.buildTag("div#"+this._id+"recurrenceeditor","",{},{}),this.model.enableRTL&&this._recurrenceLayout.addClass("e-rtl"),n="<table style='width:100%'><tr><td style='width:20%'><div class='e-textlabel'>"+this._getLocalizedLabels("Repeat")+":<\/div><\/td><td><input class='e-recurrencetype' id='"+this._id+"_recurrenceType' type='text' name='RecurrenceType' value='' /><\/td><\/tr><\/table><div id='"+this._id+"_recurtypelist'><ul>",t=0;t<this.model.frequencies.length;t++)n+="<li>"+this._getLocalizedLabels(this.model.frequencies[t])+"<\/li>";n+="<\/ul><\/div>";this.element.append(this._recurrenceLayout.append(n));this._renderRecurrenceContent();this._initialSubControlRender=!0;this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_recurtypelist",width:this._mediaQuery?"140px":"33%",change:$.proxy(this._recurrenceTypeChange,this),cssClass:this.model.cssClass});this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:this.model.selectedRecurrenceType})},t.prototype._renderRecurrenceContent=function(){for(var i,c,n,t,r,u,f,e,o,s,h=0;h<this._dayNames.length;h++)this._dayNames[h]=this._dayNames[h].toUpperCase();if(i=[this._getLocalizedLabels("First"),this._getLocalizedLabels("Second"),this._getLocalizedLabels("Third"),this._getLocalizedLabels("Fourth"),this._getLocalizedLabels("Last")],c=this.model.enableRTL?"margin-right":"margin-left",this._recurrenceContent=ej.buildTag("div.e-recurrencecontent#"+this._id+"recurrencecontent","",{},{}),this._mediaQuery){for(n="<form id='"+this._id+"_recurrenceForm'><table class='e-table' width='100%' cellpadding='7'><tbody>",n+="<tr id='"+this._id+"_every' style='display:none'><td width='16%' id='everylabel' class='e-textlabel'>"+this._getLocalizedLabels("Every")+":<\/td><td id='everycount' class='e-tdpadding'><table><tr><td><div class='e-floatleft'><input id='"+this._id+"_recurevery' class='recurevery' type='text' /><\/div><\/td><td><div id='"+this._id+"_recurtypes' class='e-appcheckbox e-labelcursor'>"+this._getLocalizedLabels("RecurrenceDay")+"<\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_weekly' class='"+this._id+"_weekly' style='display:none'><td colspan='2' id='weeklabel' class='e-textlabel'><div>"+this._getLocalizedLabels("RepeatOn")+":<\/div><\/td><\/tr><tr class='"+this._id+"_weekly' style='display:none'><td colspan='2' id='weekcount'><table class='e-table' cellpadding='3'><tr>",t=0;t<this._dayShortNames.length;t++)n+="<td><div class='e-weekday "+this._dayShortNames[t]+"'><input id='"+this._id+"_"+this._dayNames[t]+"' class='weekdays e-weekly"+this._dayNames[t]+"'name='weekdays' type='checkbox'/><label class='e-textmargin' for='"+this._id+"_"+this._dayNames[t]+"'>"+this._dayShortNames[t]+"<\/label><\/div><\/td>";for(n+="<\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_monthly' class='"+this._id+"_monthly' style='display:none'><td colspan='2' id='monthlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><\/tr><tr class='"+this._id+"_monthly' style='display:none'><td colspan='2' id='monthcount'><table class='e-table' cellpadding='3'><tr id='monthdaytr'><td><div><input id='"+this._id+"_monthday' class='monthdaytype' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthday'>"+this._getLocalizedLabels("Day")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthdate' class='monthdate' type='text'/><\/div><\/td><\/tr><tr id='monthweekdaytr'><td><div><input id='"+this._id+"_monthon' class='monthposition' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthon'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthsrt' class='monthsrt' type='text' name='monthsrt' value=''/><div id='"+this._id+"_monthsrtlist'><ul>",r=0;r<i.length;r++)n+="<li>"+i[r]+"<\/li>";for(n+="<\/div><\/div><\/td>",n+="<td><div class='e-appcheckbox e-labelcursor'><input id='"+this._id+"_monthsrtday' class='e-monthsrtday monthsrtday' type='text' name='monthsrtday' value=''/><div id='"+this._id+"_monthsrtdaylist'><ul>",u=0;u<this._dayFullNames.length;u++)n+="<li>"+this._dayFullNames[u]+"<\/li>";for(n+="<\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_yearly' class='"+this._id+"_yearly' style='display:none'><td colspan='2' id='yearlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><\/tr><tr class='"+this._id+"_yearly' style='display:none'><td colspan='2' id='yearcount' ><table class='e-table' cellpadding='3'><tr id='yeardaytr'><td><div><input id='"+this._id+"_yearday' class='yearrecurday' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearday'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearmonth' class='yearmonth' type='text' name='yearmonth' value=''/><\/div><\/td><div id='"+this._id+"_yearmonthlist'><ul>",f=0;f<this._monthNames.length-1;f++)n+="<li>"+this._monthNames[f]+"<\/li>";for(n+="<\/ul><\/div><td><input id='"+this._id+"_yeardate' class='yeardate' text='text'/><\/td><\/tr><tr id='yearweekdaytr'><td><div><input id='"+this._id+"_yearother' class='yearrecurposi' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearother'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_yearsrt' class='yearsrt' type='text' name='yearsrt' value=''/><div id='"+this._id+"_yearsrtlist'><ul>",e=0;e<i.length;e++)n+="<li>"+i[e]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearsrtday' class='yearsrtday' type='text' name='yearsrtday' value=''/><div id='"+this._id+"_yearsrtdaylist'><ul>",o=0;o<this._dayFullNames.length;o++)n+="<li>"+this._dayFullNames[o]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div><span>"+this._getLocalizedLabels("OfEvery")+"<\/span><\/div><\/td><\/tr><tr><td><\/td><td><div><input id='"+this._id+"_yearsrtmonth' class='yearsrtmonth' type='text' name='yearsrtmonth' value=''/><div id='"+this._id+"_yearsrtmonthlist'><ul>",s=0;s<this._monthNames.length-1;s++)n+="<li>"+this._monthNames[s]+"<\/li>";n+="<\/ul><\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>";n+="<tr id='"+this._id+"_startson' ><td colspan='2' id='startsonlabel' class='e-textlabel'>"+this._getLocalizedLabels("StartsOn")+":<\/td><\/tr><tr><td colspan='2' id='startsoncount'><input id='"+this._id+"_recurstartdate' class='recurstartdate' type='text' name='RecurStartDate' value=''/><\/td><\/tr>";n+="<tr id='"+this._id+"_endson' ><td colspan='2' id='endsonlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("Ends")+":<\/div><\/td><\/tr><tr><td colspan='2' id='endsoncount'><table class='e-table' cellpadding='3'><tr id='endsonnever'><td><div><input id='"+this._id+"_repeatendnever' class='recurends e-recurnoend' type='radio' name='"+this._id+"_repeatend' value='Never'/><label class='e-textmargin' for='"+this._id+"_repeatendnever'>"+this._getLocalizedLabels("Never")+"<\/label><\/div><\/td><\/tr><tr id='endsonafter'><td><div><input id='"+this._id+"_repeatendafter' class='recurends e-recurafter' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendafter'>"+this._getLocalizedLabels("After")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_recurcount' class='recurcount' type='text'/><\/div><\/td><td><span class='e-labelcursor' style='"+c+": -80px;'>"+this._getLocalizedLabels("Occurrence")+"<\/span><\/td><\/tr><tr id='endsonuntil'><td><div><input id='"+this._id+"_repeatendon' class='recurends e-recuruntil' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendon'>"+this._getLocalizedLabels("On")+"<\/label><\/div><\/td><td><input id='"+this._id+"_daily' class='e-until until' type='text' name='daily' value=''/><\/td><\/tr> <\/table><\/td><\/tr>";n+="<tr style='display:none'><td><span class='e-textlabel'>Summary:<\/span><\/td><td><span class=e-recurRule><\/span><\/td><\/tr><\/tbody><\/table><\/form>"}else{for(n="<form id='"+this._id+"_recurrenceForm'><table class='e-table' width='100%' cellpadding='7'><tbody>",n+="<tr id='"+this._id+"_every' style='display:none'><td width='20%' id='everylabel' class='e-textlabel'>"+this._getLocalizedLabels("Every")+":<\/td><td id='everycount' class='e-tdpadding'><table><tr><td><div class='e-floatleft'><input id='"+this._id+"_recurevery' class='recurevery' type='text' /><\/div><\/td><td><div id='"+this._id+"_recurtypes' class='e-appcheckbox e-labelcursor'>"+this._getLocalizedLabels("RecurrenceDay")+"<\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_weekly' class='"+this._id+"_weekly' style='display:none'><td id='weeklabel' class='e-textlabel'><div>"+this._getLocalizedLabels("RepeatOn")+":<\/div><\/td><td id='weekcount'><table class='e-table' cellpadding='3'><tr>",t=0;t<this._dayShortNames.length;t++)n+="<td><div class='e-weekday "+this._dayShortNames[t]+"'><input id='"+this._id+"_"+this._dayNames[t]+"' class='weekdays e-weekly"+this._dayNames[t]+"'name='weekdays' type='checkbox'/><label class='e-textmargin' for='"+this._id+"_"+this._dayNames[t]+"'>"+this._dayShortNames[t]+"<\/label><\/div><\/td>";for(n+="<\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_monthly' class='"+this._id+"_monthly' style='display:none'><td id='monthlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><td id='monthcount'><table class='e-table' cellpadding='3'><tr id='monthdaytr'><td><div><input id='"+this._id+"_monthday' class='monthdaytype' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthday'>"+this._getLocalizedLabels("Day")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthdate' class='monthdate' type='text'/><\/div><\/td><\/tr><tr id='monthweekdaytr'><td><div><input id='"+this._id+"_monthon' class='monthposition' name='"+this._id+"_monthday' type='radio'/><label class='e-textmargin' for='"+this._id+"_monthon'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_monthsrt' class='monthsrt' type='text' name='monthsrt' value=''/><div id='"+this._id+"_monthsrtlist'><ul>",r=0;r<i.length;r++)n+="<li>"+i[r]+"<\/li>";for(n+="<\/div><\/div><\/td>",n+="<td><div class='e-appcheckbox e-labelcursor'><input id='"+this._id+"_monthsrtday' class='e-monthsrtday monthsrtday' type='text' name='monthsrtday' value=''/><div id='"+this._id+"_monthsrtdaylist'><ul>",u=0;u<this._dayFullNames.length;u++)n+="<li>"+this._dayFullNames[u]+"<\/li>";for(n+="<\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>",n+="<tr id='"+this._id+"_yearly' class='"+this._id+"_yearly' style='display:none'><td id='yearlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("RepeatBy")+":<\/div><\/td><td id='yearcount' ><table class='e-table' cellpadding='3'><tr id='yeardaytr'><td><div><input id='"+this._id+"_yearday' class='yearrecurday' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearday'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearmonth' class='yearmonth' type='text' name='yearmonth' value=''/><\/div><\/td><div id='"+this._id+"_yearmonthlist'><ul>",f=0;f<this._monthNames.length-1;f++)n+="<li>"+this._monthNames[f]+"<\/li>";for(n+="<\/ul><\/div><td><input id='"+this._id+"_yeardate' class='yeardate' text='text'/><\/td><\/tr><tr id='yearweekdaytr'><td><div><input id='"+this._id+"_yearother' class='yearrecurposi' name='"+this._id+"_yearday' type='radio'/><label class='e-textmargin' for='"+this._id+"_yearother'>"+this._getLocalizedLabels("The")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_yearsrt' class='yearsrt' type='text' name='yearsrt' value=''/><div id='"+this._id+"_yearsrtlist'><ul>",e=0;e<i.length;e++)n+="<li>"+i[e]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div class='e-controlalign'><input id='"+this._id+"_yearsrtday' class='yearsrtday' type='text' name='yearsrtday' value=''/><div id='"+this._id+"_yearsrtdaylist'><ul>",o=0;o<this._dayFullNames.length;o++)n+="<li>"+this._dayFullNames[o]+"<\/li>";for(n+="<\/ul><\/div><\/div><\/td><td><div><span>"+this._getLocalizedLabels("OfEvery")+"<\/span><\/div><\/td><td><div><input id='"+this._id+"_yearsrtmonth' class='yearsrtmonth' type='text' name='yearsrtmonth' value=''/><div id='"+this._id+"_yearsrtmonthlist'><ul>",s=0;s<this._monthNames.length-1;s++)n+="<li>"+this._monthNames[s]+"<\/li>";n+="<\/ul><\/div><\/div><\/td><\/tr><\/table><\/td><\/tr>";n+="<tr id='"+this._id+"_startson' style='display:none'><td width='20%' id='startsonlabel' class='e-textlabel'>"+this._getLocalizedLabels("StartsOn")+":<\/td><td id='startsoncount'><input id='"+this._id+"_recurstartdate' class='recurstartdate' type='text' name='RecurStartDate' value=''/><\/td><\/tr>";n+="<tr id='"+this._id+"_endson' style='display:none'><td id='endsonlabel' class='e-recurendslabel'><div class='e-recurendsalign'>"+this._getLocalizedLabels("Ends")+":<\/div><\/td><td id='endsoncount'><table class='e-table' cellpadding='3'><tr id='endsonnever'><td><div><input id='"+this._id+"_repeatendnever' class='recurends e-recurnoend' type='radio' name='"+this._id+"_repeatend' value='Never'/><label class='e-textmargin' for='"+this._id+"_repeatendnever'>"+this._getLocalizedLabels("Never")+"<\/label><\/div><\/td><\/tr><tr id='endsonafter'><td><div><input id='"+this._id+"_repeatendafter' class='recurends e-recurafter' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendafter'>"+this._getLocalizedLabels("After")+"<\/label><\/div><\/td><td><div><input id='"+this._id+"_recurcount' class='recurcount' type='text'/><\/div><\/td><td><span class='e-labelcursor' style='"+c+": -80px;'>"+this._getLocalizedLabels("Occurrence")+"<\/span><\/td><\/tr><tr id='endsonuntil'><td><div><input id='"+this._id+"_repeatendon' class='recurends e-recuruntil' type='radio' name='"+this._id+"_repeatend'/><label class='e-textmargin' for='"+this._id+"_repeatendon'>"+this._getLocalizedLabels("On")+"<\/label><\/div><\/td><td><input id='"+this._id+"_daily' class='e-until until' type='text' name='daily' value=''/><\/td><\/tr> <\/table><\/td><\/tr>";n+="<tr style='display:none'><td><span class='e-textlabel'>Summary:<\/span><\/td><td><span class=e-recurRule><\/span><\/td><\/tr><\/tbody><\/table><\/form>"}this._recurrenceLayout.append(this._recurrenceContent.append(n));this._renderControls()},t.prototype._renderControls=function(){var n=this._recurrenceContent;n.find(".weekdays").ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._weeklyClick,this)});n.find(".monthsrt").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_monthsrtlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._monthSrt,this)});n.find(".monthsrtday").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_monthsrtdaylist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._monthSrt,this)});n.find(".yearsrt").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearsrtlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearsrt,this)});n.find(".yearmonth").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearmonthlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearmonth,this)});n.find(".yearsrtday").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearsrtdaylist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearsrt,this)});n.find(".yearsrtmonth").ejDropDownList({enableRTL:this.model.enableRTL,targetID:this._id+"_yearsrtmonthlist",width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._yearsrt,this)});n.find(".recurstartdate").ejDatePicker({buttonText:"Today",startDay:this._firstDayOfWeek,enableRTL:this.model.enableRTL,locale:this.model.locale,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,value:this.model.startDate,minDate:this.model.minDate,maxDate:this.model.maxDate,change:$.proxy(this._startDateChange,this)});n.find(".until").ejDatePicker({buttonText:"Today",startDay:this._firstDayOfWeek,enableRTL:this.model.enableRTL,locale:this.model.locale,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,change:$.proxy(this._recurUntil,this)});n.find(".recurcount").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"recurcount",minValue:1,value:10,width:"65px",decimalPlaces:0,cssClass:this.model.cssClass,change:$.proxy(this._recurCount,this)});n.find(".recurevery").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"recurevery",minValue:1,value:1,decimalPlaces:0,width:"100px",cssClass:this.model.cssClass,change:$.proxy(this._everyCount,this)});n.find(".monthdate").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"monthdate",minValue:1,decimalPlaces:0,maxValue:31,value:1,width:"70px",cssClass:this.model.cssClass,change:$.proxy(this._monthDate,this)});n.find(".yeardate").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"yeardate",minValue:1,decimalPlaces:0,maxValue:31,value:1,width:"70px",cssClass:this.model.cssClass,change:$.proxy(this._yearmonth,this)});n.find(".recurends").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._recurEndChange,this)});n.find(".monthposition,.monthdaytype").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._recurEndChange,this)});n.find(".yearrecurposi,.yearrecurday").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:$.proxy(this._recurEndChange,this)})},t.prototype._recurrenceTypeChange=function(n){this._recurrenceType(n);this._rRuleFreq!=""&&this.closeRecurPublic();this._rRuleFreq==""&&(this._recRule=undefined);this._trigger("change",{recurrenceRule:this._recRule})},t.prototype._recurrenceType=function(n){var i,t,r,u;if(this._rRuleFreq="",i="",t=$.type(this.model.startDate)=="string"?this._dateConvert(this.model.startDate):this.model.startDate,this.flag&&(this._subControlChange=!0,this._recurrenceContent.find(".until").ejDatePicker({value:new Date(new Date(t.toDateString()).setDate(new Date(t.toDateString()).getDate()+70))}),this._subControlChange=!1,this._recurrenceContent.find(".e-recurnoend").ejRadioButton({checked:!0}),this.flag=!1),this._mediaQuery||this._recurrenceContent.find("#"+this._id+"_startson,#"+this._id+"_endson").css("display","table-row"),n.itemId!=null){this._recurrenceContent.find("#"+this._id+"_every").css("display","table-row");r=this._getLocalizedLabels(this.model.frequencies[n.itemId]);switch(r){case this._getLocalizedLabels("Never"):this._recurrenceContent.css("display","none");break;case this._getLocalizedLabels("Daily"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceDay");this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_monthly,."+this._id+"_yearly").css("display","none");this._rRuleFreq="DAILY";i=this._getLocalizedLabels("RecurrenceDay").toLowerCase();break;case this._getLocalizedLabels("Weekly"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceWeek");u=this._dayShortNames.indexOf(ej.format(t,"ddd",this.model.locale));this._initialSubControlRender=!0;this._recurrenceContent.find(".e-weekly"+this._dayNames[u]).ejCheckBox({checked:!0});i=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+this._dayFullNames[t.getDay()];this._rRuleFreq="WEEKLY";this._recurrenceContent.find("."+this._id+"_monthly,."+this._id+"_yearly").css("display","none");this._recurrenceContent.find("."+this._id+"_weekly").css("display","table-row");break;case this._getLocalizedLabels("Monthly"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceMonth");this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_yearly").css("display","none");this._recurrenceContent.find("."+this._id+"_monthly").css("display","table-row");this._initialSubControlRender=!0;this._recurrenceContent.find(".monthdate").ejNumericTextbox({value:t.getDate()});this._recurrenceContent.find(".monthsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(ej.format(t,"ddd","en-US").substr(0,2).toUpperCase())});this._recurrenceContent.find(".monthsrt").ejDropDownList({selectedItemIndex:this._getWeekIndex(t)});this._recurrenceContent.find(".monthdaytype").ejRadioButton({checked:!0});this._rRuleFreq="MONTHLY";i=this._getLocalizedLabels("RecurrenceMonth").toLowerCase();break;case this._getLocalizedLabels("Yearly"):this._recurrenceContent.css("display","block");this._recurrenceContent.find("#"+this._id+"_recurtypes").get(0).innerHTML=this._getLocalizedLabels("RecurrenceYear");this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_monthly").css("display","none");this._recurrenceContent.find("."+this._id+"_yearly").css("display","table-row");this._initialSubControlRender=!0;this._recurrenceContent.find(".yearmonth").ejDropDownList({selectedItemIndex:t.getMonth()});this._recurrenceContent.find(".yeardate").ejNumericTextbox({value:t.getDate()});this._recurrenceContent.find(".yearsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(ej.format(t,"ddd","en-US").substr(0,2).toUpperCase())});this._recurrenceContent.find(".yearsrtmonth").ejDropDownList({selectedItemIndex:t.getMonth()});this._recurrenceContent.find(".yearsrt").ejDropDownList({selectedItemIndex:this._getWeekIndex(t)});this._recurrenceContent.find(".yearrecurday").ejRadioButton({checked:!0});this._rRuleFreq="YEARLY";i=this._getLocalizedLabels("RecurrenceYear").toLowerCase();break;case this._getLocalizedLabels("EveryWeekDay"):this._recurrenceContent.css("display","block");this._rRuleFreq="WEEKDAYS";this._recurrenceContent.find("."+this._id+"_weekly,."+this._id+"_yearly,#"+this._id+"_every,."+this._id+"_monthly").css("display","none");i=n.text}this._initialSubControlRender=!1}this._recurrenceContent.find(".e-recurRule").html(i)},t.prototype._getWeekIndex=function(n){var i=0,t=new Date(n.getFullYear(),n.getMonth(),1),r=n.getDay();if(r!=t.getDay())do t=new Date(t.setDate(t.getDate()+1));while(r!=t.getDay());while(t.getDate()!=n.getDate())t=new Date(t.setDate(t.getDate()+7)),i++;return i},t.prototype._weeklyClick=function(){this._initialSubControlRender||this._stringGenerate()},t.prototype._monthSrt=function(){this._subControlChange=!0;this._recurrenceContent.find("#"+this._id+"_monthon").ejRadioButton("option","checked",!0);this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._yearsrt=function(){this._subControlChange=!0;this._recurrenceContent.find("#"+this._id+"_yearother").ejRadioButton("option","checked",!0);this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._yearmonth=function(){this._subControlChange=!0;this._recurrenceContent.find("#"+this._id+"_yearday").ejRadioButton("option","checked",!0);this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._startDateChange=function(n){this.model.startDate=new Date(n.model.value);(!this._recurrenceContent.find("#"+this._id+"_repeatendon").ejRadioButton("model.checked")||this.model.startDate>this._recurrenceContent.find(".until").ejDatePicker("option","value"))&&(this._subControlChange=!0,this._recurrenceContent.find(".until").ejDatePicker("option","value",new Date(new Date(n.model.value).setDate(n.model.value.getDate()+70))));this._subControlChange=!1;this._initialSubControlRender||this._stringGenerate()},t.prototype._recurUntil=function(){this._subControlChange||(this._subControlChange=!0,this._recurrenceContent.find("#"+this._id+"_repeatendon").ejRadioButton("option","checked",!0),this._subControlChange=!1,this._initialSubControlRender||this._stringGenerate())},t.prototype._recurCount=function(){this._recurrenceContent.find("#"+this._id+"_repeatendafter").ejRadioButton("option","checked",!0);this._initialSubControlRender||this._stringGenerate()},t.prototype._everyCount=function(){this._initialSubControlRender||this._stringGenerate()},t.prototype._monthDate=function(){this._recurrenceContent.find("#"+this._id+"_monthday").ejRadioButton("option","checked",!0);this._initialSubControlRender||this._stringGenerate()},t.prototype._recurEndChange=function(){this._subControlChange||this._initialSubControlRender||this._stringGenerate()},t.prototype._stringGenerate=function(){this.closeRecurPublic();this._trigger("change",{recurrenceRule:this._recRule})},t.prototype._findInterval=function(n){var t;return t=n.ejNumericTextbox("model.value"),ej.isNullOrUndefined(t)?0:t},t.prototype._weeklyDayFind=function(n,t){var i=n,r;do i=new Date(i.setDate(i.getDate()+1)),r=this._dayNamesValue[new Date(i).getDay()].toUpperCase();while(t.indexOf(r)==-1);return i},t.prototype._dayOfWeekInMonth=function(n,t,i){for(var f=this._dayNamesValue.indexOf(t),r=i==-1?new Date(n.getFullYear(),n.getMonth()+1,0):new Date(n.getFullYear(),n.getMonth(),1),u;r.getDay()!=f;)r=new Date(i==-1?r.setDate(r.getDate()-1):r.setDate(r.getDate()+1));return u=Math.abs(Math.ceil((r.getDate()-1-r.getDay())/7)),new Date(i==1||i==-1?r.toString():new Date(r.setDate(r.getDate()+(i-u-1)*7)).toString())},t.prototype._findRecurCount=function(n,t,i){var l=0,n,t,u=!1,e,o,s=this._interval,r=new Date(this._recurrenceContent.find(".recurstartdate").ejDatePicker("model.value")),h,a,c,v,f;for(ej.isNullOrUndefined(this._actualDate)||this._actualDate==0||(h=new Date(r.getFullYear(),r.getMonth()+1,0),r=h.getDate()<this._actualDate?h:new Date(r.getFullYear(),r.getMonth(),this._actualDate)),o=e=new Date(r.toString()),a=new Date(this.element.find(".e-until").ejDatePicker("model.value"));r<=a;){switch(this._rRuleFreq){case"DAILY":r=new Date(r.setDate(r.getDate()+n));u=!0;break;case"WEEKLY":case"WEEKDAYS":for(c=t.split(","),v=i._dayNames[new Date(r.toString()).getDay()],f=0;f<c.length;f++)if(c[f]==v){if(s==this._interval){u=!0;s=1;break}s++}break;case"MONTHLY":r=new Date(r.setMonth(r.getMonth()+n));!ej.isNullOrUndefined(this._month)&&this._month&&e.getMonth()>r.getMonth()&&(r=new Date(r.setDate(e.getDate())));r.getDate()!=o.getDate()&&(ej.isNullOrUndefined(this._month)||!this._month)&&(this._month=!0,r=new Date(r.setDate(r.getDate()-r.getDate())));u=!0;break;case"YEARLY":r=new Date(r.setFullYear(r.getFullYear()+n));u=!0}u&&l++;u=!1;(this._rRuleFreq=="WEEKLY"||this._rRuleFreq=="WEEKDAYS")&&(r=new Date(r.setDate(r.getDate()+1)));o=new Date(r.toString())}return this._month=!1,this._actualDate=0,l},t.prototype._getLocalizedLabels=function(n){return ej.isNullOrUndefined(ej.RecurrenceEditor.Locale[this.model.locale])?ej.RecurrenceEditor.Locale["en-US"][n]:ej.RecurrenceEditor.Locale[this.model.locale][n]},t.prototype._datepattern=function(){return this.model.dateFormat!=""&&!ej.isNullOrUndefined(this.model.dateFormat)?this.model.dateFormat:this._pattern.d},t.prototype._dateConvert=function(n){if(ej.isNullOrUndefined(n))t=null;else{var t=new Date(parseInt(n.match(/\d+/).toString()));t=$.type(t)=="date"?t:new Date}return t},t.prototype.recurrenceDateGenerator=function(n,t,i){var s=[],rt=n.split(";"),r,l,nt,tt,p,e,f,u,c,w,a,v,b,h,k,y;if(this._recurDates={},r=new Date(t),l=0,p=new Date(r),ej.isNullOrUndefined(i)&&(i=null),this.recurrenceRuleSplit(n,i),ej.isNullOrUndefined(this._rRule.recurEditId)){if(f="",u=ej.isNullOrUndefined(this._rRule.interval)?1:this._rRule.interval,ej.isNullOrUndefined(this._rRule.weekDays)||(f=this._rRule.weekDays.split(",")),ej.isNullOrUndefined(this._rRule.until))if(ej.isNullOrUndefined(this._rRule.count))e=new Date(new Date(this.model.startDate.toString()).setDate(r.getDate()+42*u));else switch(this._rRule.freq){case"DAILY":e=new Date(new Date(r).setDate(r.getDate()+this._rRule.count*u));break;case"WEEKLY":c=r.getDate()+this._rRule.count/f.length*7*u;e=new Date(new Date(r).setDate(Math.round(c)<c?c+1:c));break;case"MONTHLY":e=new Date(new Date(r).setMonth(r.getMonth()+this._rRule.count*u));break;case"YEARLY":e=new Date(new Date(r).setFullYear(r.getFullYear()+this._rRule.count*u))}else e=new Date(this._rRule.until),e.setDate(e.getDate()+1);switch(this._rRule.freq){case"WEEKLY":f=this._rRule.weekDays.split(",");f.indexOf(this._dayNamesValue[new Date(r).getDay()].toUpperCase())==-1&&(r=this._weeklyDayFind(r,f));break;case"MONTHLY":if(ej.isNullOrUndefined(this._rRule.monthDay))r=new Date(this._getWeekIndex(r)+1>this._rRule.setPositions&&this._rRule.setPositions!=-1?new Date(r.getFullYear(),r.getMonth(),1):r);else for(w=new Date(r).getDate()==new Date(r.getFullYear(),r.getMonth()+1,0).getDate()?!0:!1;new Date(r).getDate()!=this._rRule.monthDay;)r=new Date(r.setDate(r.getDate()+1));nt=tt=new Date(r);break;case"YEARLY":ej.isNullOrUndefined(this._rRule.monthDay)?ej.isNullOrUndefined(this._rRule.setPositions)||(r=new Date(r.getFullYear(),this._rRule.month-1,r.getDate()),r=new Date(this._getWeekIndex(r)+1>this._rRule.setPositions&&this._rRule.setPositions!=-1?new Date(r.getFullYear(),r.getMonth(),1):r)):(a=new Date(p.setMonth(this._rRule.month-1)),v=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),this._rRule.monthDay>v&&(this._rRule.monthDay=v),r=r.getMonth()+1>=this._rRule.month&&r.getDate()>this._rRule.monthDay?new Date(r.getFullYear()+1,this._rRule.month-1,this._rRule.monthDay):new Date(r.getFullYear(),this._rRule.month-1,this._rRule.monthDay))}while(r<=e){this._rRule.freq!="MONTHLY"&&this._rRule.freq!="YEARLY"||ej.isNullOrUndefined(this._rRule.setPositions)||(r=this._dayOfWeekInMonth(r,this._rRule.weekDays,this._rRule.setPositions));ej.isNullOrUndefined(this._rRule.exDate)?b=0:this._rRule.exDate.indexOf(ej.format(new Date(r),this._pattern.d,this.model.locale))==-1&&(b=2);h=new Date(r);switch(this._rRule.freq){case"DAILY":s.push(new Date(h.toString()).getTime());r=new Date(r.setDate(r.getDate()+u));break;case"WEEKLY":k=this._dayNamesValue[new Date(r).getDay()].toUpperCase();f.length-1!=f.indexOf(k)?(s.push(new Date(h.toString()).getTime()),r=this._weeklyDayFind(r,f)):(s.push(new Date(h.toString()).getTime()),r=new Date(r.setDate(r.getDate()+r.getDay()*-1)),r=new Date(r.setDate(r.getDate()+u*7-1)),r=this._weeklyDayFind(r,f));break;case"MONTHLY":if(s.push(new Date(h.toString()).getTime()),w)r=new Date(r.getFullYear(),r.getMonth()+u+1,0);else if(ej.isNullOrUndefined(this._rRule.setPositions)){var d=new Date(r),o=new Date(d.setMonth(d.getMonth()+u)),g=new Date(o.getFullYear(),o.getMonth()+1,0),it=r.getFullYear()==o.getFullYear()?r.getMonth()+u:o.getMonth();it==o.getMonth()?r=o>g?new Date(g.toString()):new Date(o.setDate(this._rRule.monthDay)):(y=new Date(o.setMonth(o.getMonth()-1)),r=new Date(y.getFullYear(),y.getMonth()+1,0))}else r=new Date(r.getFullYear(),r.getMonth()+u,1);break;case"YEARLY":s.push(new Date(h.toString()).getTime());r=new Date(r.setFullYear(r.getFullYear()+u))}if(l++,!ej.isNullOrUndefined(this._rRule.count)&&l==this._rRule.count)break}}return s},t.prototype.recurrenceRuleSplit=function(n,t){var r,f,o,e,u,i;if(this._rRule={},f=t,o=n.split(";"),!ej.isNullOrUndefined(t)&&!ej.isNullOrUndefined(f.split(",")))for(u=f.split(","),this._rRule.exDate=[],i=0;i<u.length;i++)this._rRule.exDate[i]=u[i];for(e=0;e<o.length;e++){r=o[e].split("=");switch($.trim(r[0]).toUpperCase()){case"FREQ":this._rRule.freq=$.trim(r[1]).toUpperCase();break;case"INTERVAL":this._rRule.interval=parseInt(r[1],10);break;case"COUNT":this._rRule.count=parseInt(r[1],10);break;case"UNTIL":this._rRule.until=new Date(r[1]);break;case"BYDAY":this._rRule.weekDays=r[1];break;case"BYMONTHDAY":this._rRule.monthDay=parseInt(r[1],10);break;case"BYMONTH":this._rRule.month=parseInt(r[1],10);break;case"BYSETPOS":this._rRule.setPositions=parseInt(r[1],10);break;case"WKST":this._rRule.weekStart=r[1];break;case"EXDATE":if(ej.isNullOrUndefined(t)||ej.isNullOrUndefined(f.split(",")))for(u=r[1].split(","),this._rRule.exDate=[],i=0;i<u.length;i++)this._rRule.exDate[i]=u[i];else for(u=f.split(","),this._rRule.exDate=[],i=0;i<u.length;i++)this._rRule.exDate[i]=u[i];break;case"RECUREDITID":this._rRule.recurEditId=parseInt(r[1])}}return this._rRule},t.prototype.clearRecurrenceFields=function(){for(var t=this.element.find("input.weekdays"),n=0;n<t.length;n++)$(t[n]).ejCheckBox({checked:!1});this.element.find(".recurevery").ejNumericTextbox({value:1});this.element.find(".recurcount").ejNumericTextbox({value:10});this.element.find(".e-recurRule").html("")},t.prototype.setDefaultValues=function(){var n=this.model.startDate.toString();this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:0});this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:1});this.element.find(".recurstartdate").ejDatePicker({value:new Date(n)});this.element.find(".e-until").ejDatePicker({value:new Date(new Date(n).setDate(new Date(n).getDate()+70))});this.element.find(".e-recurnoend").ejRadioButton({checked:!0})},t.prototype.showRecurrenceSummary=function(){for(var r,n=0;n<this._dayNames.length;n++)this._dayNames[n]=this._dayNames[n].toUpperCase();var t="",i="",u=this.element.find("#"+this._id+"_recurrenceType");t=ej.isNullOrUndefined(this._rRule.interval)?this._getLocalizedLabels("Every")+" ":this._getLocalizedLabels("Every")+" "+this._rRule.interval+" ";u.ejDropDownList({selectedItemIndex:this.model.frequencies.indexOf(this._rRule.freq.toLowerCase().replace(/^./,function(n){return n.toUpperCase()}))});switch(this._rRule.freq){case"DAILY":t+=this._getLocalizedLabels("RecurrenceDay").toLowerCase();this._rRuleFreq="DAILY";break;case"WEEKLY":for(this._rRuleFreq="WEEKLY",this.element.find(".weekdays").ejCheckBox({checked:!1}),r=this._rRule.weekDays.split(","),n=0;n<r.length;n++)this.element.find(".e-weekly"+r[n]).ejCheckBox({checked:!0}),i+=this._dayShortNames[this._dayNames.indexOf(r[n])]+(n==r.length-1?"":", ");t+=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+i;break;case"MONTHLY":this._rRuleFreq="MONTHLY";ej.isNullOrUndefined(this._rRule.monthDay)?(this.element.find(".e-monthposition").ejRadioButton({checked:!0}),this.element.find(".e-monthsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(this._rRule.weekDays)}),this.element.find(".monthsrt").ejDropDownList({selectedItemIndex:this._rRule.setPositions-1}),i=this.element.find(".monthsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[this._dayNames.indexOf(this._rRule.weekDays)]):(this.element.find(".e-monthdaytype").ejRadioButton({checked:!0}),this.element.find(".e-monthdate").ejNumericTextbox({value:parseInt(this._rRule.monthDay)}),i=parseInt(this._rRule.monthDay).toString());t+=this._getLocalizedLabels("RecurrenceMonth").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+i;break;case"YEARLY":this._rRuleFreq="YEARLY";ej.isNullOrUndefined(this._rRule.monthDay)?(this.element.find(".e-yearrecurposi").ejRadioButton({checked:!0}),this.element.find(".yearsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(this._rRule.weekDays)}),this.element.find(".yearsrtmonth").ejDropDownList({selectedItemIndex:this._rRule.month-1}),this.element.find(".yearsrt").ejDropDownList({selectedItemIndex:this._rRule.setPositions-1}),i=this.element.find(".yearsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[this._dayNames.indexOf(this._rRule.weekDays)]+" "+this._monthNames[this._rRule.month-1]):(this.element.find(".e-yearrecurday").ejRadioButton({checked:!0}),this.element.find(".yearmonth").ejDropDownList({selectedItemIndex:this._rRule.month-1}),this.element.find(".yeardate").ejNumericTextbox({value:parseInt(this._rRule.monthDay)}),i=this._monthNames[this._rRule.month-1]+" "+parseInt(this._rRule.monthDay));t+=this._getLocalizedLabels("RecurrenceYear").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+i}return this.element.find(".recurevery").ejNumericTextbox({value:ej.isNullOrUndefined(this._rRule.interval)?1:this._rRule.interval}),ej.isNullOrUndefined(this._rRule.count)?ej.isNullOrUndefined(this._rRule.until)?this.element.find(".e-recurnoend").ejRadioButton({checked:!0}):(this.element.find(".e-recuruntil").ejRadioButton({checked:!0}),this.element.find(".e-until").ejDatePicker({value:new Date(this._rRule.until)}),t+=" "+this._getLocalizedLabels("Until").toLowerCase()+" "+ej.format(new Date(this._rRule.until),this._datepattern(),this.model.locale)):(this.element.find(".e-recurafter").ejRadioButton({checked:!0}),this.element.find(".recurcount").ejNumericTextbox({value:this._rRule.count}),t+=", "+this._rRule.count+this._getLocalizedLabels("Times").toLowerCase()),t},t.prototype.getRecurrenceRule=function(){return this.closeRecurPublic(),this._recRule},t.prototype.closeRecurPublic=function(){var u=this._rRuleFreq,n,v,y="",o="",i="",t="",f,e,b,k,r,h,c,w,l,a,d,g;n=this._interval=this._findInterval(this.element.find(".recurevery"));switch(u){case"DAILY":t="FREQ="+u+";INTERVAL="+n;break;case"WEEKDAYS":t="FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR";i="MO,TU,WE,TH,FR";break;case"WEEKLY":var p=this.element.find("input.weekdays"),s="";for(f=0;f<p.length;f++)$(p[f]).ejCheckBox("model.checked")==!0?i+=(i!=""?",":"")+this._dayNames[f].toUpperCase():"",$(p[f]).ejCheckBox("model.checked")==!0?s+=(s!=""?", ":"")+this._dayShortNames[f]:"";for(e=0;e<this._dayNamesValue.length;e++)"".indexOf(this._dayNamesValue[e])!=-1&&(i+=(i!=""?",":"")+this._dayNamesValue[e]),"".indexOf(this._culture.calendar.days.namesAbbr[e])!=-1&&(s+=(s!=""?",":"")+this._culture.calendar.days.namesAbbr[e]);i==""&&(b=this.element.find(".recurstartdate").ejDatePicker("model.value"),i=this._dayNames[b.getDay()].toUpperCase());k=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" on "+s;this.element.find(".e-recurRule").html(k);t="FREQ="+u+";INTERVAL="+n+";BYDAY="+i;break;case"MONTHLY":this.element.find(".monthdaytype").ejRadioButton("model.checked")?(v=this.element.find(".monthdate").ejNumericTextbox("model.value"),t="FREQ="+u+";BYMONTHDAY="+v+";INTERVAL="+n,o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+v):(r=this.element.find(".monthsrt").ejDropDownList("selectedItemIndex"),h=this.element.find(".e-monthsrtday").ejDropDownList("selectedItemIndex"),r=r<5?r+1:-1,t="FREQ="+u+";BYDAY="+this._dayNames[h]+";BYSETPOS="+r+";INTERVAL="+n,o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+this.element.find(".monthsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[h]);break;case"YEARLY":if(this.element.find("#"+this._id+"_yearday").ejRadioButton("model.checked"))c=this.element.find(".yearmonth").ejDropDownList("selectedItemIndex"),w=this._findInterval(this.element.find(".yeardate")),t="FREQ="+u+";BYMONTHDAY="+w+";BYMONTH="+(c+1)+";INTERVAL="+n,o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+this._monthNames[c]+" "+w;else{var r=this.element.find(".yearsrt").ejDropDownList("selectedItemIndex"),c=this.element.find(".yearsrtmonth").ejDropDownList("selectedItemIndex"),h=this.element.find(".yearsrtday").ejDropDownList("selectedItemIndex");r=r<5?r+1:-1;t="FREQ="+u+";BYDAY="+this._dayNames[h]+";BYMONTH="+(c+1)+";BYSETPOS="+r+";INTERVAL="+n;o=" "+this._getLocalizedLabels("On").toLowerCase()+" "+this.element.find(".yearsrt").ejDropDownList("model.value").toLowerCase()+" "+this._dayFullNames[h]+" "+this._monthNames[c]}break;case"NEVER":this._recRule=undefined}return this.element.find(".e-recurafter").ejRadioButton("model.checked")?(l=this._findInterval(this.element.find(".recurcount")),t+=";COUNT="+l,y=l?", "+l+" "+this._getLocalizedLabels("Times"):", "):this.element.find(".e-recuruntil").ejRadioButton("model.checked")&&(a=this._findRecurCount(n,i,this),t+=";COUNT="+a,y=a?", "+a+" "+this._getLocalizedLabels("Times"):", "),d=(this._rRuleFreq!="WEEKDAYS"?this._getLocalizedLabels("Every"):"")+" "+(n>1?n+" ":""),g=d+this.element.find(".e-recurRule").html()+o+y,this._recRule=t,g},t}(ej.WidgetBase);ej.widget("ejRecurrenceEditor","ej.RecurrenceEditor",new RecurrenceEditor);ej.RecurrenceEditor.Locale={};ej.RecurrenceEditor.Locale["en-US"]={Repeat:"Repeat",Never:"Never",Daily:"Daily",Weekly:"Weekly",Monthly:"Monthly",Yearly:"Yearly",First:"First",Second:"Second",Third:"Third",Fourth:"Fourth",Last:"Last",EveryWeekDay:"Every weekday",Every:"Every",RecurrenceDay:"Day(s)",RecurrenceWeek:"Week(s)",RecurrenceMonth:"Month(s)",RecurrenceYear:"Year(s)",RepeatOn:"Repeat on",RepeatBy:"Repeat by",StartsOn:"Starts on",Times:"times",Ends:"Ends",Day:"Day",The:"The",OfEvery:"Of",After:"After",On:"On",Occurrence:"Occurrence(s)",Until:"Until"},function(n,r,u){r.widget("ejGantt","ej.Gantt",{_rootCSS:"e-gantt",element:null,validTags:["div"],model:null,_tags:[{tag:"holidays",attr:["day","background","label"],content:"template"},{tag:"stripLines",attr:["day","label","lineStyle","lineColor","lineWidth"],content:"template"},{tag:"editDialogFields",attr:["field","editType"],content:"template"},{tag:"addDialogFields",attr:["field","editType"],content:"template"},{tag:"sortSettings.sortedColumns",attr:["field","direction"]},{tag:"dayWorkingTime",attr:["from","to"],singular:"dayWorkingTime"}],_holidays:function(){this._$ganttchartHelper.ejGanttChart("refreshHolidays");this._trigger("refresh")},_stripLines:function(){this._$ganttchartHelper.ejGanttChart("refreshStripLines");this._trigger("refresh")},_editDialogFields:function(){this._trigger("refresh")},_addDialogFields:function(){this._trigger("refresh")},defaults:{expandStateMapping:"",allowSorting:!1,allowColumnResize:!1,allowSelection:!0,allowMultipleExporting:!1,allowDragAndDrop:!1,dragTooltip:{showTooltip:!1,tooltipItems:[],tooltipTemplate:""},dataSource:null,showColumnChooser:!1,showColumnOptions:!1,query:null,splitterSettings:{position:"",index:-1},splitterPosition:"",taskIdMapping:"",parentTaskIdMapping:"",taskNameMapping:"",startDateMapping:"",endDateMapping:"",baselineStartDateMapping:"",baselineEndDateMapping:"",childMapping:"",durationMapping:"",milestoneMapping:"",progressMapping:"",predecessorMapping:"",resourceInfoMapping:"",taskSchedulingModeMapping:"",workMapping:"",notesMapping:"",resources:[],holidays:[],searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},highlightWeekends:!0,scheduleStartDate:null,scheduleEndDate:null,enableProgressBarResizing:!0,rowHeight:30,includeWeekend:!0,taskSchedulingMode:"auto",validateManualTasksOnLinking:!1,toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},stripLines:[],workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",workUnit:"hour",taskType:"fixedUnit",perMinuteWidth:null,perHourWidth:null,perDayWidth:null,perWeekWidth:null,perMonthWidth:null,minuteInterval:null,scheduleHeaderSettings:{weekHeaderFormat:"MMM dd , yyyy",dayHeaderFormat:"",yearHeaderFormat:"yyyy",monthHeaderFormat:"MMM",hourHeaderFormat:"HH",scheduleHeaderType:"week",minutesPerInterval:"auto",weekendBackground:"",timescaleStartDateMode:"auto",timescaleUnitSize:"100%",weekStartDay:0},taskbarBackground:"",progressbarBackground:"",connectorLineBackground:"",parentTaskbarBackground:"",parentProgressbarBackground:"",connectorlineWidth:1,readOnly:!1,showTaskNames:!0,leftTaskLabelMapping:"",rightTaskLabelMapping:"",leftTaskLabelTemplate:"",rightTaskLabelTemplate:"",showGridCellTooltip:!1,cellTooltipTemplate:null,showGridExpandCellTooltip:!1,showProgressStatus:!0,showResourceNames:!0,enableTaskbarDragTooltip:!0,enableTaskbarTooltip:!0,enableWBS:!1,enableWBSPredecessor:!1,editSettings:{allowEditing:!1,allowAdding:!1,allowDeleting:!1,allowIndent:!1,editMode:"normal",beginEditAction:"dblclick",rowPosition:"belowselectedrow"},flatRecords:[],parentRecords:[],currentViewData:[],updatedRecords:[],ids:[],allowKeyboardNavigation:!0,cssClass:"",locale:"en-US",allowMultiSorting:!1,sortSettings:{sortedColumns:[]},enableAltRow:!0,enableVirtualization:!1,progressbarHeight:100,taskbarTooltipTemplate:"",progressbarTooltipTemplate:"",taskbarTooltipTemplateId:"",dateFormat:"",resourceIdMapping:"",resourceNameMapping:"",resourceUnitMapping:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",selectedRowIndex:-1,allowGanttChartEditing:!0,sizeSettings:{height:"",width:""},selectedItem:null,selectionType:"single",selectionMode:"row",selectedCellIndexes:[],weekendBackground:"",baselineColor:"#fba41c",treeColumnIndex:0,editDialogFields:[],addDialogFields:[],columnDialogFields:[],renderBaseline:!1,enableContextMenu:!1,enableResize:!0,isResponsive:!0,enableCollapseAll:!1,enablePredecessorValidation:!0,taskbarTemplate:"",parentTaskbarTemplate:"",milestoneTemplate:"",durationUnitMapping:"",dayWorkingTime:[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}],exportToExcelAction:"",exportToPdfAction:"",rowSelecting:null,rowSelected:null,rowDragStart:null,rowDrag:null,rowDragStop:null,cellSelecting:null,cellSelected:null,queryCellInfo:null,queryTaskbarInfo:null,beginEdit:null,endEdit:null,rowDataBound:null,expanding:null,expanded:null,collapsing:null,collapsed:null,actionBegin:null,actionComplete:null,taskbarEditing:null,taskbarEdited:null,load:null,create:null,contextMenuOpen:null,taskbarClick:null,taskbarHeight:20,criticalTask:""},dataTypes:{allowSorting:"boolean",allowColumnResize:"boolean",allowSelection:"boolean",dataSource:"data",query:"data",taskIdMapping:"string",parentTaskIdMapping:"string",taskNameMapping:"string",startDateMapping:"string",endDateMapping:"string",baselineStartDateMapping:"string",baselineEndDateMapping:"string",childMapping:"string",durationMapping:"string",milestoneMapping:"string",progressMapping:"string",predecessorMapping:"string",resourceInfoMapping:"string",taskSchedulingModeMapping:"string",notesMapping:"string",workMapping:"string",resources:"array",holidays:"array",dayWorkingTime:"array",highlightWeekends:"boolean",scheduleStartDate:"data",scheduleEndDate:"data",enableProgressBarResizing:"boolean",rowHeight:"number",includeWeekend:"boolean",taskSchedulingMode:"string",validateManualTasksOnLinking:"boolean",toolbarSettings:{showToolbar:"boolean",toolbarItems:"array",customToolbarItems:"array"},stripLines:"array",scheduleHeaderSettings:"data",roundOffDayworkingTime:"boolean",taskbarBackground:"string",progressbarBackground:"string",connectorLineBackground:"string",parentTaskbarBackground:"string",parentProgressbarBackground:"string",connectorlineWidth:"number",readOnly:"boolean",showTaskNames:"boolean",leftTaskLabelMapping:"string",rightTaskLabelMapping:"string",leftTaskLabelTemplate:"string",rightTaskLabelTemplate:"string",showProgressStatus:"boolean",showResourceNames:"boolean",enableTaskbarDragTooltip:"boolean",enableTaskbarTooltip:"boolean",editSettings:"data",flatRecords:"array",parentRecords:"array",currentViewData:"array",ids:"array",updatedRecords:"array",allowKeyboardNavigation:"boolean",cssClass:"string",locale:"string",allowMultiSorting:"boolean",showGridExpandCellTooltip:"boolean",sortSettings:{sortedColumns:"array"},enableAltRow:"boolean",enableVirtualization:"boolean",progressbarHeight:"number",taskbarTooltipTemplate:"string",progressbarTooltipTemplate:"string",taskbarTooltipTemplateId:"string",dateFormat:"string",resourceIdMapping:"string",resourceNameMapping:"string",resourceUnitMapping:"string",progressbarTooltipTemplateId:"string",taskbarEditingTooltipTemplateId:"string",taskbarEditingTooltipTemplate:"string",allowGanttChartEditing:"boolean",size:{height:"string",width:"string"},weekendBackground:"string",baselineColor:"string",renderBaseline:"boolean",enableContextMenu:"boolean",showGridCellTooltip:"boolean",treeColumnIndex:"number",editDialogFields:"array",addDialogFields:"array",showColumnChooser:"boolean",enableResize:"boolean",isResponsive:"boolean",enableCollapseAll:"boolean",enablePredecessorValidation:"boolean",durationUnitMapping:"string",taskbarTemplate:"string",parentTaskbarTemplate:"string",milestoneTemplate:"string",taskbarHeight:"number",criticalTask:"string"},ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","enableRTL","rowDataBound","editSettings","localization","cssClass","dataSource","allowKeyboardNavigation"],observables:["selectedItem","selectedRowIndex","selectedCellIndexes","splitterPosition","dataSource","splitterSettings.position"],selectedItem:r.util.valueFunction("selectedItem"),selectedRowIndex:r.util.valueFunction("selectedRowIndex"),selectedCellIndexes:r.util.valueFunction("selectedCellIndexes"),splitterPosition:r.util.valueFunction("splitterSettings.position"),dataSource:r.util.valueFunction("dataSource"),_splitterPosition:r.util.valueFunction("splitterPosition"),getColumns:function(){return this._columns},setColumns:function(n){this._columns=n},customColumnFields:function(){for(var t=this,u=t.model,i=t._columns,r=i.length,n=0;n<r;n++)t._columnHeaderTexts[i[n].field]||(t._columnHeaderTexts[i[n].field]=i[n].headerText)},_init:function(){var t=this,n=t.model,i=n.scheduleHeaderSettings.minutesPerInterval,u=n.durationUnit;n.isdesignMode&&(n.taskIdMapping="Id",n.taskNameMapping="Name",n.startDateMapping="StartDate",n.durationMapping="Duration",n.progressMapping="Progress",n.scheduleStartDate="02/23/2014",n.scheduleEndDate="03/10/2014",this.dataSource([{Id:1,Name:"Task 1",StartDate:"02/23/2014",Duration:5,Progress:40},{Id:2,Name:"Task 2",StartDate:"02/24/2014",Duration:5,Progress:40},{Id:3,Name:"Task 3",StartDate:"02/25/2014",Duration:5,Progress:40}]),n.sizeSettings.height="300px",n.sizeSettings.width="800px");n.scheduleStartDate||n.scheduleEndDate||i!="auto"||(n.scheduleHeaderSettings.minutesPerInterval=r.Gantt.minutesPerInterval.FiveMinutes);n.workMapping!=""&&(n.taskType=r.Gantt.TaskType.FixedWork);t._initPrivateProperties();t._trigger("load");t.element.addClass("e-gantt-core");this.dataSource()!==null?this._checkDataBinding():t._initialize()},_setTaskbarHeight:function(n){this.taskbarHeight=n<this.model.rowHeight?n:this.model.rowHeight;this._milesStoneWidth=Math.floor(this.taskbarHeight/2)*2},_deSelectRowItem:function(){var n=this,t=n.model;n._$ganttchartHelper.ejGanttChart("selectRows",-1);n._$treegridHelper.ejTreeGrid("selectRows",-1);this.selectedRowIndex(-1);t.selectedItem=null},_checkDataBinding:function(){var t=this,i=t.model,e,o,u,f;if(this.dataSource()==null&&this.dataSource([]),this.dataSource()instanceof r.DataManager)this._initDataSource();else if(this.dataSource().length>0){if(i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t._retrivedData=t.dataSource(),o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o);t._createGanttRecords(t.secondaryDatasource)}else t._createGanttRecords(this.dataSource());t._initialize()}else t._initialize()},_initDataSource:function(){var t=this,i=t.model,u=this._columnToSelect(),f=this.dataSource().executeQuery(u);f.done(r.proxy(function(r){var e,o,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=r.result,o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createGanttRecords(t.secondaryDatasource);t._initialize()}))},_columnToSelect:function(){var t=this,n=t.model,i=r.Query();return n.query?n.query:i},_intersectionObjects:function(n,t){for(var r=[],i;n.length>0&&t.length>0;)i=t.indexOf(n[0]),i==-1?n.shift():(r.push(n.shift()),t.splice(i,1));return r},_reconstructDatasource:function(n){var u=this,f=u.model,i,s,e,t,o,h,c;for(s=r.Predicate(f.parentTaskIdMapping,r.FilterOperators.notEqual,"null"),i=r.DataManager(n).executeLocal(r.Query().where(s).group(f.parentTaskIdMapping)),e=[],t=0;t<i.length;t++){if(!r.isNullOrUndefined(i[t].key)&&(o=u._taskIds.indexOf(i[t].key),o>-1)){n[o][f.childMapping]=i[t].items;continue}h=i[t].items;for(c in i[t].items)e.push(h[c])}u.secondaryDatasource=u._intersectionObjects(n,e)},updateScheduleDates:function(t,i){var u=this,e=this.model,o=e.scheduleHeaderSettings.scheduleHeaderType,s,f;e.scheduleStartDate=t;e.scheduleEndDate=i;u._scheduleDays=[];u._scheduleMonths=[];u._scheduleWeeks=[];u._scheduleYears=[];u._scheduleHours=[];u._scheduleMinutes=[];u._calculateHeaderDates();s=n("#ejGanttChart"+u._id).ejGanttChart("instance");f=s.model;u._isTreeGridRendered=!1;u._isGanttChartRendered=!1;u._isChartRendering=!0;u._updateGanttRecords();f.projectStartDate=u._getDateFromFormat(u._projectStartDate);f.projectEndDate=u._getDateFromFormat(u._projectEndDate);f.scheduleDays=u._scheduleDays;f.scheduleMonths=u._scheduleMonths;f.scheduleWeeks=u._scheduleWeeks;f.scheduleYears=u._scheduleYears;f.scheduleHours=u._scheduleHours;f.scheduleMinutes=u._scheduleMinutes;f.renderBaseline=e.renderBaseline;f.scheduleHeaderSettings.scheduleHeaderType=o;o=="week"?(f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.weekHeaderFormat=e.scheduleHeaderSettings.weekHeaderFormat,f.scheduleHeaderSettings.dayHeaderFormat=e.scheduleHeaderSettings.dayHeaderFormat,f.durationUnit=e.durationUnit,f.perDayWidth=u._perDayWidth):o=="day"?(f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.dayHeaderFormat=e.scheduleHeaderSettings.dayHeaderFormat,f.scheduleHeaderSettings.hourHeaderFormat=e.scheduleHeaderSettings.hourHeaderFormat,f.durationUnit=e.durationUnit,f.perHourWidth=u._perHourWidth,f.perDayWidth=u._perDayWidth):o=="hour"?(f.dateFormat=e.dateFormat,f.durationUnit=r.Gantt.DurationUnit.Minute,f.scheduleHeaderSettings.minutesPerInterval=e.scheduleHeaderSettings.minutesPerInterval,f.workingTimeScale=e.workingTimeScale,f.minuteInterval=u._minuteInterval,f.perMinuteWidth=u._perMinuteWidth,f.perDayWidth=u._perDayWidth):o=="month"?(f.durationUnit=e.durationUnit,f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.monthHeaderFormat=e.scheduleHeaderSettings.monthHeaderFormat,f.scheduleHeaderSettings.weekHeaderFormat=e.scheduleHeaderSettings.weekHeaderFormat,f.perDayWidth=u._perDayWidth,f.perWeekWidth=u._perWeekWidth):o=="year"&&(f.durationUnit=e.durationUnit,f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.yearHeaderFormat=e.scheduleHeaderSettings.yearHeaderFormat,f.perDayWidth=u._perDayWidth,f._perMonthWidth=u._perMonthWidth);n("#ejGanttChart"+u._id).ejGanttChart("refreshChartHeader",u._getDateFromFormat(t),u._getDateFromFormat(i));n("#ejGanttChart"+u._id).ejGanttChart("refreshContainersWidth");u._$ganttchartHelper.ejGanttChart("refreshHelper",u.model.currentViewData,u.model.updatedRecords,u._totalCollapseRecordCount);e.predecessorMapping&&(u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._connectorlineIds=[],u._connectorLinesCollection=[],u._isValidationEnabled=!1,u._createConnectorLinesCollection(),u._isValidationEnabled=!0);s._$bodyContainer.ejScroller("refresh");u._isTreeGridRendered=!0;u._isGanttChartRendered=!0;u._isChartRendering=!1},reRenderChart:function(t){var i=this,u=i.model,e=i._getDateFromFormat(u.scheduleStartDate),o=i._getDateFromFormat(u.scheduleEndDate),f,s;u.flatRecords=[];u.parentRecords=[];n("#ejGanttChart"+i._id).empty();switch(t){case r.Gantt.ScheduleHeaderType.Week:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Week;i._perDayWidth=u.perDayWidth;i._calculateWeekSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Day:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Day;i._perHourWidth=u.perHourWidth;i._perDayWidth=i._perHourWidth*24;i._calculateDaySplit(e,o);break;case r.Gantt.ScheduleHeaderType.Month:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Month;i._perDayWidth=u.perDayWidth;i._perWeekWidth=u.perWeekWidth;i._calculateMonthSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Year:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Year;i._perDayWidth=u.perDayWidth;i._perMonthWidth=u.perMonthWidth;i._calculateYearSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Hour:if(u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Hour,f=u.scheduleHeaderSettings.minutesPerInterval,s=r.Gantt.minutesPerInterval,i._perMinuteWidth=u.perMinuteWidth,f)if(f==s.Auto){var h=o-e;h>864e6?(i._minuteInterval=30,i._perDayWidth=i._perMinuteWidth*48):h>6048e5?(i._minuteInterval=15,i._perDayWidth=i._perMinuteWidth*96):h>1728e5?(i._minuteInterval=5,i._perDayWidth=i._perMinuteWidth*288):(i._minuteInterval=1,i._perDayWidth=i._perMinuteWidth*1440)}else f==s.OneMinute?(i._minuteInterval=1,i._perDayWidth=i._perMinuteWidth*1440):f==s.FiveMinutes?(i._minuteInterval=5,i._perDayWidth=i._perMinuteWidth*288):f==s.FifteenMinutes?(i._minuteInterval=15,i._perDayWidth=i._perMinuteWidth*96):f==s.ThirtyMinutes&&(i._minuteInterval=30,i._perDayWidth=i._perMinuteWidth*48);i._calculateHourSplit(e,o)}i.element.ejGantt("destroy").ejGantt(u);i._isTreeGridRendered=!1;i._isGanttChartRendered=!1},changeTaskMode:function(n,t){var i=this,f=i.model,u={};u.data=n;i._isValidationEnabled=!0;t==r.Gantt.TaskSchedulingMode.Manual?(n.isAutoSchedule=!1,n.item[f.taskSchedulingModeMapping]=!0):t==r.Gantt.TaskSchedulingMode.Auto&&(n.isAutoSchedule=!0,n.item[f.taskSchedulingModeMapping]=!1);u.columnName="taskMode";i._updateEditedGanttRecords(u);i._isValidationEnabled=!1},autoSchedule:function(n){var t=this,u=t.model,i,f=u.updatedRecords;i=f.filter(function(t){return t.taskId===n});t.changeTaskMode(i[0],r.Gantt.TaskSchedulingMode.Auto)},manualSchedule:function(n){var t=this,u=t.model,i,f=u.updatedRecords;i=f.filter(function(t){return t.taskId===n});t.changeTaskMode(i[0],r.Gantt.TaskSchedulingMode.Manual)},_updateGanttRecords:function(){for(var i=this,f=i.model,e=f.flatRecords,o=e.length,n,t,u,r=0;r<o;r++)n=e[r],n.hasChildRecords===!1&&(n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n.width=n.isMilestone==!0?i._milesStoneWidth:f.flatRecords[r].width,n.progressWidth=n._calculateProgressWidth(n.width,n.status)),n.baselineStartDate&&n.baselineEndDate?(n.baselineLeft=n._calculateBaselineLeft(this),n.baselineRight=n._calculateBaselineRight(this),n.baselineWidth=n._calculateBaseLineWidth(this)):(n.baselineLeft=0,n.baselineRight=0,n.baselineWidth=0),t=n.parentItem,u=t&&t.childRecords,t&&u.indexOf(n)==u.length-1&&n.hasChildRecords===!1&&(t.isAutoSchedule?i._updateParentItem(n):i._updateManualParentItem(n))},_initPrivateProperties:function(){var n=this;model=n.model;scheduleMode=model.scheduleHeaderSettings.scheduleHeaderType;n._isFromGantt=!0;n._disabledToolItems=[];n._id=n.element.attr("id");n._scheduleWeeks=[];n._taskIds=[];n._duplicate=!1;n._wrongenddate=!1;n._addPosition=null;n._scheduleYears=[];n._scheduleMonths=[];n._scheduleYears=[];n._scheduleDays=[];n._scheduleHours=[];n._projectStartDate;n._projectEndDate;n._columns=[];n._storedIndex=-1;n._perDayWidth;n._prevDayWidth=0;n._rowIndexOfLastSelectedCell=-1;n._perMonthWidth;n._perWeekWidth;n._$treegridPane=null;n._$ganttchartPane=null;n._$treegrid=null;n._$ganttchart=null;n._$ejGantt=null;n._$treegridHelper=null;n._$ganttchartHelper=null;n._tdsOffsetWidth=[];n._subPosx=[];n._predecessorsCollection=[];n._connectorLinesCollection=[];n._updatedConnectorLineCollection=[];n._connectorlineIds=[];n._gridRows=null;n._collapsedRecordCount=0;n._expandedRecordsCount=0;n._totalCollapseRecordCount=0;n._isInExpandCollapse=!1;n._hiddenRecordCount=0;n.prevPredecessorTO=null;n.prevPredecessorFrom=null;n.prevPredecessorcount=0;n._isValidationEnabled=!0;n._isTreeGridRendered=!1;n._isGanttChartRendered=!1;n._isChartRendering=!1;n._holidaysList=n._getHoliday();n._stringHolidays=n._getStringHolidays();n._isinBeginEdit=!1;n._isMileStoneEdited=!1;n._cellEditColumn=null;n._isinAddnewRecord=!1;n._contextMenuItems=null;n._totalBorderWidth=2;n._totalBorderHeight=r.browserInfo().name=="msie"&&r.browserInfo().version<9?model.toolbarSettings.showToolbar?3:2:model.toolbarSettings.showToolbar?1:0;n._columnHeaderTexts=null;n._predecessorEditingTexts=null;n._editDialogTexts=null;n._toolboxTooltipTexts=null;n._durationUnitTexts=null;n._durationUnitEditText=null;n._workUnitTexts=null;n._taskTypeTexts=null;n._effortDrivenTexts=null;n._contextMenuTexts=null;n._columnMenuTexts=null;n._editTypeText=null;n._clipModeText=null;n._textAlignTypeText=null;n._columnDialogTitle=null;n._deleteColumnText=null;n._okButtonText=null;n._cancelButtonText=null;n._confirmDeleteText=null;n._columnDialogTexts=null;n._newTaskTexts=null;n._months=null;n._days=null;n._dialogTabTitleTexts=null;n._isLoad=!0;n._updatedColumn="";n._isExistingUnitIsUpdated=!1;n._isDurationUpdated=!1;n._isResourceAddedOrRemoved=!1;n._newRecordResourceCollection=[];n._alertTexts=null;n._commonColumnWidth=150;n._searchString="";n._emptyDataColumns=[];n.secondaryDatasource=[];n._datasourceChildItems=[];n._$predecessorTable=null;n._mappingItems=[];n._editedDialogRecord=null;n._calculateDimensions();n._retrivedData=this.dataSource();n._isInExpandCollapseAll=!1;n._preTableCollection=[];n._defaultStartTime=null;n._defaultEndTime=null;n._workingTimeRanges=[];n._nonWorkingHours=[];this._validateTimeRange();JSON.stringify(model.dayWorkingTime)=='[{"from":"08:00 AM","to":"12:00 PM"},{"from":"01:00 PM","to":"05:00 PM"}]'&&(model.dayWorkingTime=model.workingTimeScale!=r.Gantt.workingTimeScale.TimeScale8Hours?[{from:"12:00 AM",to:"12:00 AM"}]:[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}]);n._secondsPerDay=n._getSecondsPerDay();n._timelineWidthCalculation();n._localizedLabels=n._getLocalizedLabels();n._setCultureInfo();n.setColumns(model.columns&&model.columns.length?model.columns:n.createTreeGridColumns());model.isRerender&&n._updateColumnDropDownData();n._updateColumnLocaleText();n._isRefreshAddedRecord=!1;n._isInAdd=!1;n._activeMenuItemId=null;n._isAddEditDialogSave=!1;n._setTaskbarHeight(model.taskbarHeight);n.isCriticalPathEnable=!1;n.criticalPathCollection=[];n.detailPredecessorCollection=[];n.collectionTaskId=[];n._enableDisableCriticalIcon=!1;n._generalTabColumnFields=[];n._addDialogGeneralColumns=[];n._addDialogcustomColumns=[];n._editDialogGeneralColumns=[];n._editDialogCustomColumns=[];model.resourceUnitMapping==""&&(model.resourceUnitMapping="unit");n._dialogTab=["General","Predecessors","Resources","Custom Fields","Notes"]},_updateModelsWidth:function(){var n=this,t=n.model;t.perDayWidth=n._perDayWidth?n._perDayWidth:null;t.perMonthWidth=n._perMonthWidth?n._perMonthWidth:null;t.perWeekWidth=n._perWeekWidth?n._perWeekWidth:null;t.perHourWidth=n._perHourWidth?n._perHourWidth:null;t.perMinuteWidth=n._perMinuteWidth?n._perMinuteWidth:null;t.minuteInterval=n._minuteInterval?n._minuteInterval:null},_timelineWidthCalculation:function(n){var t=this,f=t.model,e=!0,h=f.scheduleHeaderSettings.scheduleHeaderType,a=f.scheduleHeaderSettings.timescaleUnitSize,c=a.toString(),i,l,o,s;if(n==u&&a!="100%"&&(e=!1,l=c.indexOf("-"),i=l!=-1?100:+c.match(/\d+/)[0],i<50?i=50:i>500&&(i=500),f.scheduleHeaderSettings.timescaleUnitSize=i+"%"),n!=u&&(e=!1,l=c.indexOf("-"),i=l!=-1?a:+c.match(/\d+/)[0],i<50?i=50:i>500&&(i=500),f.scheduleHeaderSettings.timescaleUnitSize=i+"%"),h=="week")t._perDayWidth=e?30:Math.round(i*.3),t._perMinuteWidth=t._perDayWidth/1440;else if(h=="year")t._perDayWidth=e?3:Math.round(i*.03),t._perMonthWidth=t._perDayWidth*30,t._perMinuteWidth=t._perDayWidth/1440;else if(h=="month")t._perDayWidth=e?10:Math.round(i*.1),t._perWeekWidth=t._perDayWidth*7,t._perHourWidth=t._perDayWidth/24,t._perMinuteWidth=t._perDayWidth/1440;else if(h=="day")t._perHourWidth=e?20:Math.round(i*.2),t._perMinuteWidth=t._perHourWidth/60,t._perDayWidth=t._perHourWidth*24;else if(h=="hour"&&(o=f.scheduleHeaderSettings.minutesPerInterval,s=r.Gantt.minutesPerInterval,t._perMinuteWidth=e?20:Math.round(i*.2),o))if(o==s.Auto){var y=t._getDateFromFormat(f.scheduleStartDate),p=t._getDateFromFormat(f.scheduleEndDate),v=p-y;v>864e6?(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48):v>6048e5?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):v>1728e5?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440)}else o==s.OneMinute?(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440):o==s.FiveMinutes?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):o==s.FifteenMinutes?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):o==s.ThirtyMinutes&&(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48);t._updateModelsWidth()},_updateTimescaleUnitSize:function(n){var t=this,i=t.model,u=i.scheduleHeaderSettings,f=u.timescaleUnitSize,r;u.timescaleUnitSize=n;t._timelineWidthCalculation(n);t.updateScheduleDates(i.scheduleStartDate,i.scheduleEndDate);r=t.selectedRowIndex();r>=0&&t.focusOnTask(r)},_validateTimeRange:function(){for(var n,o="01/01/2016",a=this,f=this.model,l=f.dayWorkingTime.length,i=!0,u=null,e=0;e<l;e++)if(n=f.dayWorkingTime[e],n.from&&n.to){var s=r.parseDate(o+" "+n.from,"MM/dd/yyyy h:mm tt","en-US"),h=n.to!="12:00 AM"?r.parseDate(o+" "+n.to,"MM/dd/yyyy h:mm tt","en-US"):r.parseDate("01/02/2016 "+n.to,"MM/dd/yyyy h:mm tt","en-US"),v=h.getTime()-s.getTime(),c=this._getSecondsInDecimal(s),t=this._getSecondsInDecimal(h);t==0&&(t=86400);c>=t?i=!1:u==null?u=t:(u>=c||u>=t)&&(i=!1)}else i=!1;i||(f.dayWorkingTime=[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}])},_getParsedDate:function(n,t,i){return r.parseDate(n,t,i)},_setTime:function(n,t){var i=parseInt(n/3600),r=parseInt((n-i*3600)/60),u=n-i*3600-r*60;t.setHours(i,r,u,0)},_checkStartDate:function(n,t){var i=new Date(n),e=this.model,u=this._getSecondsInDecimal(i),f,o,l,s,h,c;if(u<this._defaultStartTime)this._setTime(this._defaultStartTime,i);else if(u!=this._defaultEndTime||t&&t.isMilestone){if(u>this._defaultEndTime)i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(f=0;f<this._workingTimeRanges.length;f++)if(o=this._workingTimeRanges[f],u>=o.to&&this._workingTimeRanges[f+1]&&u<this._workingTimeRanges[f+1].from){u!=o.to||t&&t.isMilestone?u!=o.to&&this._setTime(this._workingTimeRanges[f+1].from,i):this._setTime(this._workingTimeRanges[f+1].from,i);break}}else i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i);do if(l=new Date(i),!r.isNullOrUndefined(t)&&t.isAutoSchedule&&(!e.includeWeekend||e.holidays.length>0)||r.isNullOrUndefined(t)&&(!e.includeWeekend||e.holidays.length>0))for(e.includeWeekend||(i.getDay()==0?(i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i)):i.getDay()==6&&(i.setDate(i.getDate()+2),this._setTime(this._defaultStartTime,i))),s=0;s<e.holidays.length;s++)h=this._getDateFromFormat(e.holidays[s].day),c=new Date(h),h.setHours(0,0,0,0),c.setHours(23,59,59,59),i.getTime()>=h.getTime()&&i.getTime()<c.getTime()&&(i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i));while(l.getTime()!=i.getTime());return new Date(i)},_checkEndDate:function(n,t){var i=new Date(n),u=this.model,e=this._getSecondsInDecimal(i),f,l,a,s;if(e>this._defaultEndTime)this._setTime(this._defaultEndTime,i);else if(e<=this._defaultStartTime)i.setDate(i.getDate()-1),this._setTime(this._defaultEndTime,i);else if(e>this._defaultStartTime&&e<this._defaultEndTime)for(f=0;f<this._workingTimeRanges.length;f++)if(l=this._workingTimeRanges[f],e>l.to&&this._workingTimeRanges[f+1]&&e<=this._workingTimeRanges[f+1].from){this._setTime(this._workingTimeRanges[f].to,i);break}do if(a=new Date(i),!r.isNullOrUndefined(t)&&t.isAutoSchedule&&(!u.includeWeekend||u.holidays.length>0)||r.isNullOrUndefined(t)&&(!u.includeWeekend||u.holidays.length>0))for(u.includeWeekend||(i.getDay()==0?(i.setDate(i.getDate()-2),this._setTime(this._defaultEndTime,i)):i.getDay()==6?(i.setDate(i.getDate()-1),this._setTime(this._defaultEndTime,i)):i.getDay()==1&&this._defaultEndTime==86400&&this._getSecondsInDecimal(i)==0&&i.setDate(i.getDate()-2)),s=0;s<u.holidays.length;s++){var o=this._getDateFromFormat(u.holidays[s].day),h=new Date(o),c=new Date(i);c.setMinutes(i.getMinutes()-2);o.setHours(0,0,0,0);h.setHours(23,59,59,59);(i.getTime()>=o.getTime()&&i.getTime()<h.getTime()||c.getTime()>=o.getTime()&&c.getTime()<h.getTime())&&(i.setDate(i.getDate()-1),i.getTime()==o.getTime()&&this._defaultEndTime==86400&&this._getSecondsInDecimal(i)==0||this._setTime(this._defaultEndTime,i))}while(a.getTime()!=i.getTime());return new Date(i)},_checkBaseLineStartDate:function(n){var t=new Date(n),e=this.model,u=this._getSecondsInDecimal(t),i,f;if(r.isNullOrUndefined(n))return"";if(u<this._defaultStartTime)this._setTime(this._defaultStartTime,t);else if(u>=this._defaultEndTime)t.setDate(t.getDate()+1),this._setTime(this._defaultStartTime,t);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(i=0;i<this._workingTimeRanges.length;i++)if(f=this._workingTimeRanges[i],u>=f.to&&this._workingTimeRanges[i+1]&&u<this._workingTimeRanges[i+1].from){this._setTime(this._workingTimeRanges[i+1].from,t);break}return t},_checkBaseLineEndDate:function(n){var t=new Date(n),e=this.model,u=this._getSecondsInDecimal(t),i,f;if(r.isNullOrUndefined(n))return"";if(u>this._defaultEndTime)this._setTime(this._defaultEndTime,t);else if(u<=this._defaultStartTime)t.setDate(t.getDate()-1),this._setTime(this._defaultEndTime,t);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(i=0;i<this._workingTimeRanges.length;i++)if(f=this._workingTimeRanges[i],u>f.to&&this._workingTimeRanges[i+1]&&u<=this._workingTimeRanges[i+1].from){this._setTime(this._workingTimeRanges[i].to,t);break}return t},_getTaskLeft:function(n){var t=new Date(n),u=this.model,i=u.scheduleHeaderSettings.scheduleHeaderType;return(i==r.Gantt.ScheduleHeaderType.Week||i==r.Gantt.ScheduleHeaderType.Month||i==r.Gantt.ScheduleHeaderType.Year)&&this._getSecondsInDecimal(t)==this._defaultStartTime&&t.setHours(0,0,0,0),this._projectStartDate?(t.getTime()-this._projectStartDate.getTime())/864e5*this._perDayWidth:0},_getTaskWidth:function(n,t){var i=new Date(n),u=new Date(t),e=this.model,f=e.scheduleHeaderSettings.scheduleHeaderType;return(f==r.Gantt.ScheduleHeaderType.Week||f==r.Gantt.ScheduleHeaderType.Month||f==r.Gantt.ScheduleHeaderType.Year)&&(this._getSecondsInDecimal(i)==this._defaultStartTime&&i.setHours(0,0,0,0),this._getSecondsInDecimal(u)==this._defaultEndTime&&u.setHours(24)),timeDiff=u.getTime()-i.getTime(),timeDiff/864e5*this._perDayWidth},_getHolidaysCount:function(n,t){for(var i,f=this.model,e=this.model.holidays,r=0,u=0;u<e.length;u++)i=this._getDateFromFormat(e[u].day),n.getTime()<i.getTime()&&t.getTime()>=i.getTime()&&(f.includeWeekend||i.getDay()==0||i.getDay()==6?f.includeWeekend&&(r+=1):r+=1);return r},_getWeekendCount:function(n,t){var i=new Date(n),u=new Date(t),r=0;for(i.setHours(0,0,0,0),i.setDate(i.getDate()+1),u.setHours(0,0,0,0);i.getTime()<u.getTime();)i.getDay()==0&&(r+=1,i.setDate(i.getDate()+5)),i.getTime()<t.getTime()&&i.getDay()==6&&(r+=1),i.setDate(i.getDate()+1);return r},_getDayDiff:function(n,t){return(t.getTime()-n.getTime())/864e5},_getNumberOfSeconds:function(n,t){var i=new Date(n),r=new Date(t),u=0;return i.setHours(0,0,0,0),i.setDate(i.getDate()+1),r.setHours(0,0,0,0),i.getTime()<r.getTime()&&(u=(r.getTime()-i.getTime())/1e3),u},_getEndDate:function(n,t,i,u){for(var e=0,s=-1,h=0,f=new Date(n),l=-1,o,c,e=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Hour?t*3600:t*60:this._secondsPerDay*t;e>0;){for(s=this._getSecondsInDecimal(f),o=0;o<this._workingTimeRanges.length;o++)if(c=this._workingTimeRanges[o],s>=c.from&&s<=c.to){l=o;break}if(h=Math.round(this._workingTimeRanges[l].to-s),h<=e)f.setSeconds(f.getSeconds()+h),e-=h;else{f.setSeconds(f.getSeconds()+e);break}e>0&&(f=this._checkStartDate(f,u))}return f},_getStartDate:function(n,t,i,u){for(var e=0,o=-1,h=0,f=new Date(n),l=-1,s,c,e=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Hour?t*3600:t*60:this._secondsPerDay*t;e>0;){for(o=this._getSecondsInDecimal(f),this._workingTimeRanges.length>0&&this._workingTimeRanges[this._workingTimeRanges.length-1].to==86400&&o==0&&(o=86400),s=0;s<this._workingTimeRanges.length;s++)if(c=this._workingTimeRanges[s],o>=c.from&&o<=c.to){l=s;break}if(h=Math.round(o-this._workingTimeRanges[l].from),h<=e)f.setSeconds(f.getSeconds()-h),e-=h;else{f.setSeconds(f.getSeconds()-e);break}e>0&&(f=this._checkEndDate(f,u))}return f},_getDuration:function(n,t,i,u){var e=t.getTime()-n.getTime(),s,h=!this.model.includeWeekend&&u?this._getWeekendCount(n,t):0,c=0,f=0,o=this._getNumberOfSeconds(n,t),l=u?this._getHolidaysCount(n,t):0;return e=e/1e3,o=(o-h*86400-l*86400)/86400,c=this._getNonWorkingSecondsOnDate(n,t),f=e-o*(86400-this._secondsPerDay)-h*86400-l*86400-c,s=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Minute?f/60:f/3600:f/this._secondsPerDay,parseFloat(s.toFixed(2))},_getSecondsInDecimal:function(n){return n.getHours()*3600+n.getMinutes()*60+n.getSeconds()+n.getMilliseconds()/1e3},_getNonWorkingSecondsOnDate:function(n,t){for(var u,i=this,s=this._getSecondsInDecimal(n),h=this._getSecondsInDecimal(t),f=-1,e=-1,o=0,r=0;r<this._workingTimeRanges.length;r++)u=this._workingTimeRanges[r],s>=u.from&&s<=u.to&&(f=r),h>=u.from&&h<=u.to&&(e=r);return n.getDate()!=t.getDate()?o=i._nonWorkingHours[i._nonWorkingHours.length-1-f]+86400-i._defaultEndTime+(i._nonWorkingHours[e]+i._defaultStartTime):f!=e&&(o=i._nonWorkingHours[e]-i._nonWorkingHours[f]),o},_getSecondsPerDay:function(){for(var i,e="01/01/2016",n=this,o=this.model,s=o.dayWorkingTime.length,h=0,t=0;t<s;t++)if(i=o.dayWorkingTime[t],i.from&&i.to){var c=r.parseDate(e+" "+i.from,"MM/dd/yyyy h:mm tt","en-US"),l=i.to!="12:00 AM"?r.parseDate(e+" "+i.to,"MM/dd/yyyy h:mm tt","en-US"):r.parseDate("01/02/2016 "+i.to,"MM/dd/yyyy h:mm tt","en-US"),a=l.getTime()-c.getTime(),f=this._getSecondsInDecimal(c),u=this._getSecondsInDecimal(l);u==0&&(u=86400);h+=a/1e3;t==0&&(n._defaultStartTime=f);t==s-1&&(n._defaultEndTime=u);t>0?n._nonWorkingHours.push(n._nonWorkingHours[n._nonWorkingHours.length-1]+f-n._workingTimeRanges[t-1].to):n._nonWorkingHours.push(0);n._workingTimeRanges.push({from:f,to:u})}return h},_updateColumnLocaleText:function(){var i=this.model,n=i.columns,t;if(n&&n.length>0)for(t=0;t<n.length;t++)n[t].field&&this._columnHeaderTexts[n[t].field]&&(n[t].headerText=this._columnHeaderTexts[n[t].field])},_calculateDimensions:function(){var t=this,u=this.model.sizeSettings,i=u.height,r=u.width,n=t.element,f=n[0].style.height,e=n[0].style.width,o=n.parent().height(),s=n.parent().width();r&&n.css("width",r);i&&n.css("height",i);i||f||(f="450px",n.css("height","450px"));r||e||(e="100%",t.element.css("width","100%"));t._ganttHeight=n.height();t._ganttWidth=n.width();t._ganttHeight===0&&(t._ganttHeight=450,n.css("450px"))},_setCultureInfo:function(){var i=this,e=i.model,f=e.locale,t=n.extend({},i._localizedLabels,r.isNullOrUndefined(r.cultures[f])?r.cultures["default"]:r.cultures[f]),u=n.extend({},r.cultures["default"],r.Gantt.Locale["default"]);e.dateFormat=e.dateFormat?e.dateFormat:t&&t.calendars&&t.calendars.standard.patterns?t.calendars.standard.patterns.d:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.patterns.d:u.calendars.standard.patterns.d;i._emptyRecordText=t&&t.emptyRecord?t.emptyRecord:u.emptyRecord;i._columnHeaderTexts=t&&t.columnHeaderTexts?t.columnHeaderTexts:u.columnHeaderTexts;i._columnHeaderTexts=n.extend({},u.columnHeaderTexts,i._columnHeaderTexts);i._taskModeTexts=t&&t.taskModeTexts?t.taskModeTexts:u.taskModeTexts;i._taskModeTexts=n.extend({},u.taskModeTexts,i._taskModeTexts);i._editDialogTexts=t&&t.editDialogTexts?t.editDialogTexts:u.editDialogTexts;i._editDialogTexts=n.extend({},u.editDialogTexts,i._editDialogTexts);i._columnDialogTexts=t&&t.columnDialogTexts?t.columnDialogTexts:u.columnDialogTexts;i._toolboxTooltipTexts=t&&t.toolboxTooltipTexts?t.toolboxTooltipTexts:u.toolboxTooltipTexts;i._toolboxTooltipTexts=n.extend({},u.toolboxTooltipTexts,i._toolboxTooltipTexts);i._durationUnitTexts=t&&t.durationUnitTexts?t.durationUnitTexts:u.durationUnitTexts;i._durationUnitTexts=n.extend({},u.durationUnitTexts,i._durationUnitTexts);i._durationUnitEditText=t&&t.durationUnitEditText?t.durationUnitEditText:u.durationUnitEditText;i._durationUnitEditText=n.extend({},u.durationUnitEditText,i._durationUnitEditText);i._workUnitTexts=t&&t.workUnitTexts?t.workUnitTexts:u.workUnitTexts;i._workUnitTexts=n.extend({},u.workUnitTexts,i._workUnitTexts);i._taskTypeTexts=t&&t.taskTypeTexts?t.taskTypeTexts:u.taskTypeTexts;i._taskTypeTexts=n.extend({},u.taskTypeTexts,i._taskTypeTexts);i._effortDrivenTexts=t&&t.effortDrivenTexts?t.effortDrivenTexts:u.effortDrivenTexts;i._effortDrivenTexts=n.extend({},u.effortDrivenTexts,i._effortDrivenTexts);i._contextMenuTexts=t&&t.contextMenuTexts?t.contextMenuTexts:u.contextMenuTexts;i._contextMenuTexts=n.extend({},u.contextMenuTexts,i._contextMenuTexts);i._newTaskTexts=t&&t.newTaskTexts?t.newTaskTexts:u.newTaskTexts;i._months=t&&t.calendars?t.calendars.standard.months.namesAbbr:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.months.namesAbbr:u.calendars.standard.months.namesAbbr;i._days=t&&t.calendars?t.calendars.standard.months.namesAbbr:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.days.namesAbbr:u.calendars.standard.days.namesAbbr;i._columnMenuTexts=t&&t.columnMenuTexts?t.columnMenuTexts:u.columnMenuTexts;i._columnMenuTexts=n.extend({},u.contextMenuTexts,i._columnMenuTexts);i._columnDialogTitle=t&&t.columnDialogTitle?t.columnDialogTitle:u.columnDialogTitle;i._deleteColumnText=t&&t.deleteColumnText?t.deleteColumnText:u.deleteColumnText;i._okButtonText=t&&t.okButtonText?t.okButtonText:u.okButtonText;i._cancelButtonText=t&&t.cancelButtonText?t.cancelButtonText:u.cancelButtonText;i._confirmDeleteText=t&&t.confirmDeleteText?t.confirmDeleteText:u.confirmDeleteText;i._predecessorEditingTexts=t&&t.predecessorEditingTexts?t.predecessorEditingTexts:u.predecessorEditingTexts;i._predecessorEditingTexts=n.extend({},u.contextMenuTexts,i._predecessorEditingTexts);i._alertTexts=t&&t.alertTexts?t.alertTexts:u.alertTexts;i._alertTexts=n.extend({},u.alertTexts,i._alertTexts);i._dialogTabTitleTexts=t&&t.dialogTabTitleTexts?t.dialogTabTitleTexts:u.dialogTabTitleTexts;i._dialogTabTitleTexts=n.extend({},u.dialogTabTitleTexts,i._dialogTabTitleTexts);i._predecessorCollectionText=t&&t.predecessorCollectionText?t.predecessorCollectionText:u.predecessorCollectionText;i._editTypeText=t&&t.editTypeTexts?t.editTypeTexts:u.editTypeTexts;i._textAlignTypeText=t&&t.textAlignTypes?t.textAlignTypes:u.textAlignTypes;i._clipModeText=t&&t.clipModeTexts?t.clipModeTexts:u.clipModeTexts},_getMappingItems:function(){for(var n=this,u=n.model,i=[],r=n._columns.length,t=0;t<r;t++)i.push(n._columns[t].mappingName);return i},_getContextMenuItems:function(){var t=this,n=this._contextMenuTexts;return[{headerText:n.taskDetailsText,eventHandler:null,isDefault:!0,menuId:"Task"},{headerText:n.addNewTaskText,eventHandler:null,isDefault:!0,menuId:"Add"},{headerText:n.indentText,eventHandler:null,isDefault:!0,menuId:"Indent"},{headerText:n.outdentText,eventHandler:null,isDefault:!0,menuId:"Outdent"},{headerText:n.deleteText,eventHandler:null,isDefault:!0,menuId:"Delete"},{iconPath:null,headerText:n.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:n.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_initialize:function(){if(!this._isFromSetModel){var n=this,t=n.model;n._$treegridPane=r.buildTag("div.e-treegridPane");n._$ganttchartPane=r.buildTag("div.e-ganttchartPane");n._$ejGantt=r.buildTag("div.e-gantt-Spliter#e-ejSpliter"+n._id,"",{},{unselectable:"on"});t.predecessorMapping&&n._updatePredecessors();n._render();t.updatedRecords=t.flatRecords.slice();t.currentViewData=t.flatRecords.slice();t.predecessorMapping&&t.enablePredecessorValidation&&n._updatedRecordsDateByPredecessor();n._calculateScheduleDates();n._calculateHeaderDates();n._updateGanttRecords();n._checkDataManagerUpdate();n._renderTreeGrid();t.updatedRecords=n.getUpdatedRecords();t.currentViewData=n.getCurrentViewData();n._renderGanttChart();n._enableCreateCollection=!0;n._isValidationEnabled=!1;n._isLoad=!1;t.predecessorMapping&&n._createConnectorLinesCollection();n._isValidationEnabled=!0;n._$treegridPane.css({overflow:"hidden"});n._initiateDialogTemplates();n._isTreeGridRendered=!0;n._isGanttChartRendered=!0;n._gridRows=n.getRows();n._ganttChartRows=n.getGanttChartRows();n._createContextMenuTemplate();n._wireEvents();n._initialEndRendering();n._getLocalizedLabels()}},_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},_initialEndRendering:function(){var n=this,t=this.model,i;t.enableCollapseAll?(this.selectedRowIndex()!=-1&&n._deSelectRowItem(),n._collapseAll()):t.expandStateMapping&&n._collapseRecordOnLoad();n.selectedRowIndex()>=0&&n.selectedRowIndex()<n.model.updatedRecords.length&&t.selectionMode=="row"&&(i={},i.recordIndex=n.selectedRowIndex(),i.previousIndex=t.selectedItem?t.updatedRecords.indexOf(t.selectedItem):-1,n.rowSelecting(i)&&(n.selectRows(n.selectedRowIndex()),n._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")))},_checkDataManagerUpdate:function(){var n=this,t=this.dataSource();n._isDataManagerUpdate=!1;n._jsonData=null;t instanceof r.DataManager&&(t.dataSource.offline&&t.dataSource.json?(n._isDataManagerUpdate=!0,n._jsonData=t.dataSource.json):t.dataSource.offline||(n._isDataManagerUpdate=!0,n._jsonData=n._retrivedData))},_initiateDialogTemplates:function(){var t=this,i=this.model,u;t.customColumnFields();(i.editSettings.allowEditing||i.editSettings.editMode=="normal"||i.editSettings.editMode=="dialogTemplate")&&(t.editDialogTemplate(),n("#"+this._id+"_dialogEdit").length===0&&t.element.append(t._renderDialog()));i.editSettings.allowAdding&&(t.addDialogTemplate(),n("#"+this._id+"_dialogAdd").length===0&&(u=r.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none","overflow-x":"hidden"},{id:this._id+"_dialogAdd"}),t.element.append(u)))},_render:function(){var n=this,t=n.element,i=n.model;n.model.toolbarSettings.showToolbar&&t.append(n._renderToolBar());n._ganttHeight=parseInt(n._ganttHeight)-n._getToolBarHeight()-n._totalBorderHeight;n._$treegrid=r.buildTag("div.ejTreeGrid#ejTreeGrid"+n._id,"",{height:n._ganttHeight},{});n._$ganttchart=r.buildTag("div.ejGanttChart#ejGanttChart"+n._id,"",{height:n._ganttHeight},{});n._$ganttchartPane.append(n._$ganttchart);n._$treegridPane.append(n._$treegrid);n._$ejGantt.append(n._$treegridPane);n._$ejGantt.append(n._$ganttchartPane);t.append(n._$ejGantt);n._renderGantt()},_renderDialog:function(){return r.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none","overflow-x":"hidden"},{id:this._id+"_dialogEdit"})},editDialogTemplate:function(){var t=this,f=t.model,u=n.extend([],t._columns),s=u.length,f=t.model,ft=-1,et=-1,at=t._$treegridHelper.data("ejTreeGrid"),ot,st=t._dialogTab,vt=st.length,w,l,b,a,e,y,k,d,i,g,nt,tt,it,rt,ut;if(t._editDialogGeneralColumns=[],t._editDialogCustomColumns=[],t._generalTabColumnFields=["taskId","taskMode","taskName","startDate","endDate","duration","resourceInfo","status","work","taskType","effortDriven","baselineStartDate","baselineEndDate","predecessor","WBS","notesText"],t._mappingItems=t._getMappingItems(),s!=0){if(f.editDialogFields.length>0){for(w=[],l=0;l<f.editDialogFields.length;l++)b=n.grep(t._columns,function(n){return n.mappingName===f.editDialogFields[l].field}),b.length&&w.push(b[0]);u=w}else f.enableWBS&&(f.enableWBSPredecessor&&(a=u.filter(function(n){return n.mappingName!="WBSPredecessor"})),a&&a.length&&(u=a));for(e=n.map(u,function(n,t){if(n.mappingName==f.taskNameMapping)return t}),(e[0]+1)%3==0&&u.splice(e[0]-1,0,u.splice(e[0],1)[0]),s=u.length,i=0;i<s;i++)if(n.inArray(u[i].mappingName,t._mappingItems)!=-1){if(!f.resourceInfoMapping&&(u[i].field=="work"||u[i].field=="taskType"||u[i].field=="effortDriven"))continue;u[i].mappingName!==f.predecessorMapping&&u[i].mappingName!=f.resourceInfoMapping&&u[i].mappingName!=f.notesMapping?(e=n.map(t._generalTabColumnFields,function(n,t){if(n==u[i].field)return t}),e.length>0?t._editDialogGeneralColumns.push(u[i]):t._editDialogCustomColumns.push(u[i])):u[i].mappingName!==f.baselineStartDateMapping&&u[i].mappingName!==f.baselineEndDateMapping&&(u[i].mappingName!==f.predecessorMapping?et=i:ft=i)}var v=r.buildTag("div","",{},{}),o=r.buildTag("div","",{},{id:t._id+"EditTab"}),h=r.buildTag("ul","",{},{});for(o.append(h),v.append(o),y=0;y<vt;y++)switch(st[y]){case"General":h.append("<li><a href='#"+t._id+"EditGeneral'>"+t._dialogTabTitleTexts.generalTabText+"<\/a><\/li>");k=r.buildTag("div.e-gantt-editor-container","",{},{id:t._id+"EditGeneral"});d=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"GeneralEditForm"});k.append(d);o.append(k);$form=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"EditForm"});$genearlTable=r.buildTag("table.e-general-edit-div","",{"border-spacing":"2px","border-collapse":"separate"},{});$tr=r.buildTag("tr");var p=0,c=t._editDialogGeneralColumns,s=c.length;for(i=0;i<s;i++)p<3?(c[i].mappingName!==f.taskNameMapping?(p++,$td=r.buildTag("td.e-property-container","",{},{})):(p+=2,$td=r.buildTag("td.e-property-container","",{},{colspan:"2"})),$innerTable=r.buildTag("table","",{outline:"none","border-spacing":"2px","border-collapse":"separate"},{}),$inTr=r.buildTag("tr","",{"line-height":"1.4"},{}),$inTd=r.buildTag("td.editLabel","",{},{}),$inTd.append("<label for='"+c[i].field+"'>"+t._columnHeaderTexts[c[i].field]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue","",{},{}),ot=t._columns.indexOf(c[i]),r.TreeGrid._initCellEditType(at,$inTd2,t._id,ot,"Edit"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($genearlTable.append($tr),$tr=$tempTr=r.buildTag("tr"),i--,p=0);$genearlTable.append($tr);d.append($genearlTable);break;case"Predecessors":f.predecessorMapping&&ft!=-1&&(h.append("<li><a href='#"+t._id+"EditPredecessors'>"+t._dialogTabTitleTexts.predecessorsTabText+"<\/a><\/li>"),g=r.buildTag("div.e-gantt-predecessor-container","",{},{id:t._id+"EditPredecessors"}),nt=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"PredecessorEditForm"}),g.append(nt),o.append(g),$predecessorTable=r.buildTag("table#"+t._id+"predecessoreditTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},""),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"EditDialog_PredecesorAdd' class='e-addpre e-icon e-enable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"EditDialog_PredecesorDelete' class='e-deletepre e-icon e-disable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$predecessorTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"predecessorEdit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$predecessorTable.append($inTr2),nt.append($predecessorTable));break;case"Resources":f.resourceInfoMapping&&et!=-1&&(h.append("<li><a href='#"+t._id+"EditResources'>"+t._dialogTabTitleTexts.resourcesTabText+"<\/a><\/li>"),tt=r.buildTag("div.e-gantt-resource-container","",{},{id:t._id+"EditResources"}),it=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"ResourceEditForm"}),tt.append(it),o.append(tt),$resourceTable=r.buildTag("table#"+t._id+"resourceeditTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"EditDialog_ResourceAdd' class='e-addpre e-icon e-enable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"EditDialog_ResourceDelete' class='e-deletepre e-icon e-disable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$resourceTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"resourceEdit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$resourceTable.append($inTr2),it.append($resourceTable));break;case"Custom Fields":t._editDialogCustomColumns.length>0&&(h.append("<li><a href='#"+t._id+"EditCustomFields'>"+t._dialogTabTitleTexts.customFieldsTabText+"<\/a><\/li>"),rt=r.buildTag("div.e-gantt-csfield-container","",{},{id:t._id+"EditCustomFields"}),ut=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"CustomFieldsEditForm"}),rt.append(ut),o.append(rt),$customFieldTable=r.buildTag("table#"+t._id+"customFieldeditTable","",{width:"100%",outline:"none",position:"relative",left:"-2px",top:"4px","border-collapse":"collapse"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse"},""),$inTd=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"customFieldEdit","",{},{}),$inTd.append($preDiv),$inTr.append($inTd),$customFieldTable.append($inTr),ut.append($customFieldTable));break;case"Notes":var ht=f.editDialogFields,s=ht.length,e=n.map(ht,function(n,t){if(n.field==f.notesMapping)return t});if(f.notesMapping&&s==0||s>0&&e.length>0){h.append("<li><a href='#"+t._id+"EditNotes'>"+t._dialogTabTitleTexts.notesTabText+"<\/a><\/li>");var ct=r.buildTag("div.e-gantt-notes-container","",{},{id:t._id+"EditNotes"}),lt=r.buildTag("div","",{padding:"0px",position:"relative",top:"5px",left:"-1px"},{}),yt=r.buildTag("textarea","",{},{id:t._id+"EditAreaNotes"});lt.append(yt);ct.append(lt);o.append(ct)}}v=t.renderDiaglogButton("edit",v);n.templates(t._id+"_JSONDialogEditingTemplate",v.html())}},addDialogTemplate:function(){var t=this,f=t.model,u=n.extend([],t._columns),s=u.length,f=t.model,ft=-1,et=-1,at=t._$treegridHelper.data("ejTreeGrid"),ot,st=t._dialogTab,vt=st.length,w,l,b,a,e,y,k,d,i,g,nt,tt,it,rt,ut;if(t._addDialogGeneralColumns=[],t._addDialogCustomColumns=[],t._generalTabColumnFields=["taskId","taskMode","taskName","startDate","endDate","duration","resourceInfo","status","work","taskType","effortDriven","baselineStartDate","baselineEndDate","predecessor","WBS","notesText"],t._mappingItems=t._getMappingItems(),s!=0){if(f.addDialogFields.length>0){for(w=[],l=0;l<f.addDialogFields.length;l++)b=n.grep(t._columns,function(n){return n.mappingName===f.addDialogFields[l].field}),b.length&&w.push(b[0]);u=w}else f.enableWBS&&(f.enableWBSPredecessor&&(a=u.filter(function(n){return n.mappingName!="WBSPredecessor"})),a&&a.length&&(u=a));e=n.map(u,function(n,t){if(n.mappingName==f.taskNameMapping)return t});(e[0]+1)%3==0&&u.splice(e[0]-1,0,u.splice(e[0],1)[0]);var v=r.buildTag("div","",{},{}),o=r.buildTag("div","",{},{id:t._id+"AddTab"}),h=r.buildTag("ul","",{},{});for(o.append(h),v.append(o),s=u.length,i=0;i<s;i++)if(n.inArray(u[i].mappingName,t._mappingItems)!=-1){if(!u[i].mappingName&&u[i].field=="work"||u[i].field=="taskType"||u[i].field=="effortDriven")continue;u[i].mappingName!==f.predecessorMapping&&u[i].mappingName!=f.resourceInfoMapping&&u[i].mappingName!=f.notesMapping?(e=n.map(t._generalTabColumnFields,function(n,t){if(n==u[i].field)return t}),e.length>0?t._addDialogGeneralColumns.push(u[i]):t._addDialogCustomColumns.push(u[i])):u[i].mappingName===f.predecessorMapping?ft=i:u[i].mappingName===f.resourceInfoMapping&&(et=i)}for(y=0;y<vt;y++)switch(st[y]){case"General":h.append("<li><a href='#"+t._id+"AddGeneral'>"+t._dialogTabTitleTexts.generalTabText+"<\/a><\/li>");k=r.buildTag("div.e-gantt-editor-container","",{},{id:t._id+"AddGeneral"});d=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"GeneralAddForm"});k.append(d);o.append(k);$form=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"AddForm"});$genearlTable=r.buildTag("table.e-general-edit-div","",{"border-spacing":"2px","border-collapse":"separate"},{});$tr=r.buildTag("tr");var p=0,c=t._addDialogGeneralColumns,s=c.length;for(i=0;i<s;i++)p<3?(c[i].mappingName!==f.taskNameMapping?(p++,$td=r.buildTag("td.e-property-container","",{},{})):(p+=2,$td=r.buildTag("td.e-property-container","",{},{colspan:"2"})),$innerTable=r.buildTag("table","",{outline:"none","border-spacing":"2px","border-collapse":"separate"},{}),$inTr=r.buildTag("tr","",{"line-height":"1.4"},{}),$inTd=r.buildTag("td.editLabel","",{},{}),$inTd.append("<label for='"+c[i].field+"'>"+t._columnHeaderTexts[c[i].field]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue","",{},{}),ot=t._columns.indexOf(c[i]),r.TreeGrid._initCellEditType(at,$inTd2,t._id,ot,"Add"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($genearlTable.append($tr),$tr=$tempTr=r.buildTag("tr"),i--,p=0);$genearlTable.append($tr);d.append($genearlTable);break;case"Predecessors":f.predecessorMapping&&ft!=-1&&(h.append("<li><a href='#"+t._id+"AddPredecessors'>"+t._dialogTabTitleTexts.predecessorsTabText+"<\/a><\/li>"),g=r.buildTag("div.e-gantt-predecessor-container","",{},{id:t._id+"AddPredecessors"}),nt=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"PredecessorAddForm"}),g.append(nt),o.append(g),$predecessorTable=r.buildTag("table#"+t._id+"predecessoraddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"AddDialog_PredecesorAdd' class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"AddDialog_PredecesorDelete' class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$predecessorTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"predecessorAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$predecessorTable.append($inTr2),nt.append($predecessorTable));break;case"Resources":f.resourceInfoMapping&&et!=-1&&(h.append("<li><a href='#"+t._id+"AddResources'>"+t._dialogTabTitleTexts.resourcesTabText+"<\/a><\/li>"),tt=r.buildTag("div.e-gantt-resource-container","",{},{id:t._id+"AddResources"}),it=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"ResourceAddForm"}),tt.append(it),o.append(tt),$resourceTable=r.buildTag("table#"+t._id+"resourceaddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"AddDialog_ResourceAdd' class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.addPredecessor+"<\/span>      <span id='"+t._id+"AddDialog_ResourceDelete' class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>  "+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$resourceTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"resourceAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$resourceTable.append($inTr2),it.append($resourceTable));break;case"Custom Fields":t._addDialogCustomColumns.length>0&&(h.append("<li><a href='#"+t._id+"AddCustomFields'>"+t._dialogTabTitleTexts.customFieldsTabText+"<\/a><\/li>"),rt=r.buildTag("div.e-gantt-csfield-container","",{},{id:t._id+"AddCustomFields"}),ut=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"CustomfFieldsAddForm"}),rt.append(ut),o.append(rt),$customFieldTable=r.buildTag("table#"+t._id+"customfieldaddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"4px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"customFieldAdd","",{},{}),$inTd.append($preDiv),$inTr.append($inTd),$customFieldTable.append($inTr),ut.append($customFieldTable));break;case"Notes":var ht=f.addDialogFields,s=ht.length,e=n.map(ht,function(n,t){if(n.field==f.notesMapping)return t});if(f.notesMapping&&s==0||s>0&&e.length>0){h.append("<li><a href='#"+t._id+"AddNotes'>"+t._dialogTabTitleTexts.notesTabText+"<\/a><\/li>");var ct=r.buildTag("div.e-gantt-notes-container","",{},{id:t._id+"AddNotes"}),lt=r.buildTag("div","",{padding:"0px",position:"relative",top:"5px",left:"-1px"},{}),yt=r.buildTag("textarea","",{},{id:t._id+"AddAreaNotes"});lt.append(yt);ct.append(lt);o.append(ct)}}v=t.renderDiaglogButton("add",v);n.templates(t._id+"_JSONDialogAddingTemplate",v.html())}},_clearContextMenu:function(){n(".e-contextmenu").remove();n(".e-innerContextmenu").remove()},_createContextMenuTemplate:function(){var t=this,u={},i,f,r;u["_"+t._id+"getHeaderName"]=n.proxy(t._getHeaderName,t);n.views.helpers(u);i="<li style='list-style-type:none;margin:0px;'>";f="<div class='e-menuitem{{if disable}} e-disable{{/if}}{{if ~_"+t._id+"getHeaderName(#data)}} e-parent-menuitem{{/if}}' id={{:menuId}} style='display:table;cursor:pointer;min-width:100px;'>{{if iconPath}}<div class='e-icon e-contextmenu-image' style='background-image:{{:iconPath}};background-repeat:no-repeat;'/>{{else}}<div class='e-icon {{:iconClass}} e-contextmenu-icon'/>{{/if}}<div class='e-contextmenu-label'><span>{{:headerText}}<\/span><\/div>{{if ~_"+t._id+"getHeaderName(#data)}}<div class='e-icon e-expander e-contextmenu-icon'/> {{/if}}";i+=f;i+="<\/div><\/li>";r={};r[t._id+"contextMenuTemplate"]=i;n.templates(r)},_getHeaderName:function(n){var t=this._contextMenuItems.filter(function(t){if(n.menuId!=null&&n.menuId==t.parentMenuId)return!0});return t.length>0?!0:!1},initCellEditType:function(t,i,u){var f=this,o=f.model,e,s={},h,c,l,a;e=u?u:"";r.isNullOrUndefined(t.editType)&&(t.editType="stringedit");switch(t.editType){case"stringedit":t.mappingName===o.predecessorMapping?(s["_"+f._id+"predecessor"]=f._getPredecessorsValue,n.views.helpers(s),i.html(r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+f._id+"predecessor('"+f._id+"Object','"+o.predecessorMapping+"','"+t.field+"')}}",id:f._id+t.field,name:t.field}))):i.html(r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u}));break;case"booleanedit":i.html("{{if "+t.field+'}} <input class="e-field e-checkbox" type ="checkbox" id='+f._id+t.field+" name="+t.field+' checked="checked"><\/input>{{else}} <input class="e-field e-checkbox" type ="checkbox" id='+f._id+t.field+" name="+t.field+" > {{/if}}");break;case"numericedit":h=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(h);break;case"datepicker":case"datetimepicker":c=r.buildTag("input.e-"+t.editType+" e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(c);break;case"dropdownedit":l=r.buildTag("input.e-field e-dropdownlist e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(l);break;case"maskedit":a=r.buildTag("input .e-field e-maskedit","",{},{value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(a)}},_getPredecessorsValue:function(n,t){return this.data.item?this.data.item[t]:""},_onHoliDayCheckBefore:function(n){var i=this,r=i.model.holidays,e=i.model.includeWeekend,t,u,f;if(isAutoSchedule&&r&&r.length){for(t=0,u=r.length,t=0;t<u;t++)if(f=i._getDateFromFormat(r[t].day),f.getTime()==n.getTime())n.setDate(n.getDate()-1),this.model.includeWeekend===!1&&i._setBeforeWeekend(n);else return n;return n}return n},_onHoliDayCheck:function(n){var i=this,r=i.model.holidays,e=i.model.includeWeekend,t,u,f;if(isAutoSchedule&&r&&r.length&&!i.hasChildRecords){for(t=0,u=r.length,t=0;t<u;t++)if(f=i._getDateFromFormat(r[t].day),f.getTime()==n.getTime())n.setDate(n.getDate()+1),this.model.includeWeekend===!1&&(n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2));else return n;return n}return n},_getDurationValues:function(n,t){var f=0,e=this.model,i=e.durationUnit,u,o;return typeof n=="string"?(u=n.match(/(\d*\.*\d+|[A-z]+)/g),u&&u.length<=2&&(f=parseFloat(u[0]),i=u[1]?u[1].toLowerCase():"",i=this._durationUnitEditText.minute.indexOf(i)!=-1?r.Gantt.DurationUnit.Minute:this._durationUnitEditText.hour.indexOf(i)!=-1?r.Gantt.DurationUnit.Hour:this._durationUnitEditText.day.indexOf(i)!=-1?r.Gantt.DurationUnit.Day:e.durationUnit)):(f=n,i=e.durationUnit),isNaN(f)&&(f=t?this._editedDialogRecord.duration:0,i=t?this._editedDialogRecord.durationUnit:e.durationUnit),o={},o.duration=f,o.durationUnit=i,o},_editStartDateChange:function(t,i){var e=this,f=e._id,c=e.model,l=t.attr("id"),ft=this.model.holidays,it=t.attr("dialog"),et=c.selectionMode=="row"?this.selectedItem():c.updatedRecords[e._rowIndexOfLastSelectedCell],r=this._editedDialogRecord,rt=r.effortDriven=="true"?!0:!1,a,s,v,y,p,d,g,nt,tt,w,b;if(!this._editedDialogRecord.isUpdatedFromDialog){this._editedDialogRecord.isUpdatedFromDialog=!0;it==="Add"?(a="#"+f+"startDateAdd",s="#"+f+"endDateAdd",v="#"+f+"durationAdd",effortDrivenId="#"+f+"effortDrivenAdd",typeId="#"+f+"taskTypeAdd",workId="#"+f+"workAdd",y="#"+f+"baselineStartDateAdd",p="#"+f+"baselineEndDateAdd"):(a="#"+f+"startDateEdit",s="#"+f+"endDateEdit",v="#"+f+"durationEdit",effortDrivenId="#"+f+"effortDrivenEdit",typeId="#"+f+"taskTypeEdit",workId="#"+f+"workEdit");var h=n(a).val(),o=n(s).val(),k=n(v).val(),ut=n(workId).val();(l===f+"startDateEdit"||l===f+"startDateAdd")&&(h||(h=r?r.startDate:u));k||(k=r?r.duration:u);o||(o=r?r.endDate:u);l===f+"startDateEdit"||l===f+"startDateAdd"?(h=i.value?e._getDateFromFormat(i.value):h,h=e._checkStartDate(h,r),e.getFormatedDate(h)!=i.value&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",h):n(a).ejDatePicker("option","value",h)),nt=e._getEndDate(h,r.duration,r.durationUnit,r),r.startDate=h,r.endDate=nt,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",nt):n(s).ejDatePicker("option","value",nt)):l===f+"endDateEdit"||l===f+"endDateAdd"?(o=i.value?e._getDateFromFormat(i.value):o,o.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,o),o=this._checkEndDate(o,r),e.getFormatedDate(o)!=i.value&&(c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)),r.isMilestone&&(r.startDate=this._checkStartDate(r.startDate,r),e.getFormatedDate(r.startDate)!=h&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",r.startDate):n(a).ejDatePicker("option","value",r.startDate)),e._updateResourceRelatedFields(r),n(workId).ejNumericTextbox("option","value",r.work),n(v).val(e._getDurationStringValue(r))),r.startDate.getTime()<=o.getTime()?(r.endDate=o,r.duration=this._getDuration(r.startDate,o,r.durationUnit,r.isAutoSchedule),k=e._getDurationStringValue(r),n(v).val(k)):c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",r.endDate):n(s).ejDatePicker("option","value",r.endDate)):l===f+"durationEdit"||l===f+"durationAdd"?(tt=e._getDurationValues(k,!0),d=tt.duration,g=tt.durationUnit,(r.duration!=d||r.durationUnit!=g)&&(r.duration=d,r.durationUnit=g,r.isMilestone&&(r.startDate=this._checkStartDate(r.startDate,r),e.getFormatedDate(r.startDate)!=h&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",r.startDate):n(a).ejDatePicker("option","value",r.startDate))),o=this._getEndDate(r.startDate,d,g,r),r.endDate=o,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)),e._updateResourceRelatedFields(r),rt||n(workId).ejNumericTextbox("option","value",r.work),n(v).val(e._getDurationStringValue(r)),r.taskType=="fixedWork"&&e._updateResourceDataSource(r)):l===f+"workEdit"||l===f+"workAdd"?(r.work=parseInt(ut),e._updateResourceRelatedFields(r),r.taskType!="fixedDuration"&&r.isAutoSchedule?(n(v).val(e._getDurationStringValue(r)),o=this._getEndDate(r.startDate,r.duration,r.durationUnit,r),r.endDate=o,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)):e._updateResourceDataSource(r)):l===f+"baselineStartDateAdd"?n(p).length>0&&(w=e._getDateFromFormat(n(y).val()),b=e._getDateFromFormat(n(p).val()),w&&b&&w.getTime()>b.getTime()&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(y).ejDateTimePicker("option","value",i.prevDate):n(y).ejDatePicker("option","value",i.prevDate))):l===f+"baselineEndDateAdd"&&n(y).length>0&&(w=e._getDateFromFormat(n(y).val()),b=e._getDateFromFormat(n(p).val()),w&&b&&w.getTime()>b.getTime()&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(p).ejDateTimePicker("option","value",i.prevDate):n(p).ejDatePicker("option","value",i.prevDate)));this._editedDialogRecord.isUpdatedFromDialog=!1}},_taskNameCollection:function(){var i=this,t=i.model.flatRecords,r=[],n,u,f;for(idsCollection=[],i._preTableCollection=[],n=0;n<t.length;n++)u={id:t[n].taskId.toString(),text:t[n].taskId.toString()+"-"+t[n].taskName,value:t[n].taskId.toString()+"-"+t[n].taskName},f={id:t[n].taskId.toString()+"-"+t[n].taskName,text:t[n].taskId.toString(),value:t[n].taskId.toString()},r.push(u),idsCollection.push(f);i._preTableCollection.push(idsCollection);i._preTableCollection.push(r)},_idFromPredecessor:function(n){for(var u,i,r=n.split(","),f=[],t=0;t<r.length;t++){for(u=[],i=0;i<r[t].length;i++)if(isNaN(r[t].charAt(i)))break;else u.push(r[t].charAt(i));f.push(u.join(""))}return f},_preIdChangByName:function(){var i=this,r=n("#"+i._id+"PreEditForm");$targetTr=r.closest("tr");$val=r.find(".onEdit");var f=$val.val(),u=i._taskNameCollection(),t=n.map(u,function(n){if(n.text===$val.val())return n.id});t=t[0];$targetTr.find(".id").html(t)},_preEndEdit:function(t,i,u){var c=this,o=u.model.dataSource,f=u.model.selectedItem,l,s,h,e;c._taskNameCollection();u.value!==null&&(u.columnName==="name"||u.columnName==="id")&&(u.columnName==="name"&&u.value.length>0&&(l=u.value.split("-"),s=n.map(c._preTableCollection[1],function(n){if(n.id===l[0])return n.id}),s=s[0],f.id=s,f.name=u.value,e=o.indexOf(f.item),e===-1&&(o.push(f.item),e=o.indexOf(f.item)),o[e].id=s,o[e].name=u.value),u.columnName==="id"&&u.value.length>0&&(h=n.map(c._preTableCollection[0],function(n){if(n.value===u.value)return n.id}),h=h[0],f.name=h,f.id=s,e=o.indexOf(f.item),e===-1&&(o.push(f.item),e=o.indexOf(f.item)),o[e].name=h),f.type||r.isNullOrUndefined(e)||(f.type="Finish-Start",o[e].type="Finish-Start"),n(t).ejTreeGrid("refreshRow",u.model.selectedRowIndex),n(t).ejTreeGrid("selectRows",u.model.selectedRowIndex),c._enbleDisablePredecessorAddButton("enable",i))},_enableDisablePredecessorDelete:function(t){var i=this,r;r=t=="add"?n("#"+i._id+"AddDialog_PredecesorDelete"):n("#"+i._id+"EditDialog_PredecesorDelete");n(r).unbind("click",n.proxy(i._deletepredecessor,i)).bind("click",n.proxy(i._deletepredecessor,i));n(r).removeClass("e-disable").addClass("e-enable")},_enableDisableResouceDelete:function(t){var i=this,r;r=t=="add"?n("#"+i._id+"AddDialog_ResourceDelete"):n("#"+i._id+"EditDialog_ResourceDelete");n(r).unbind("click",n.proxy(i._deleteResource,i)).bind("click",n.proxy(i._deleteResource,i));n(r).removeClass("e-disable").addClass("e-enable")},_predecessorEditCollection:function(){var u=this,y=u.model,o,k,s,l=[],i,n,h,p,w,a,f,e,c,v,b;if(k="#"+u._id+"predecessor",s=u._predecessorCollectionText,l=[],i=y.selectedItem,u._taskNameCollection(),o=u._preTableCollection[1],!r.isNullOrUndefined(i)&&!r.isNullOrUndefined(i.predecessor)&&!r.isNullOrUndefined(i.item[y.predecessorMapping])){var t=i.predecessor,d=t.length,g=s.length,nt=o.length;for(n=0;n<d;n++)if(h=t[n].from,i.taskId.toString()!==h.toString()){for(a=0,f=0;f<nt;f++)if(o[f].id===h){p=o[f].value;break}for(e=0;e<g;e++)s[e].id==t[n].predecessorsType&&(w=s[e].text);c=t[n].offset!=1;v="";v+=t[n].offsetDurationUnit=="day"?c?this._durationUnitTexts.days:this._durationUnitTexts.day:t[n].offsetDurationUnit=="hour"?c?this._durationUnitTexts.hours:this._durationUnitTexts.hour:c?this._durationUnitTexts.minutes:this._durationUnitTexts.minute;a=t[n].offset+" "+v;b={id:h,name:p,type:w,offset:a};l.push(b)}}return l},_getResourceInfoIndex:function(n,t){var i=0,r=[];if(n&&t)for(i;i<n.length;i++)t[n[i]]&&r.push(n[i]);return r},_refreshEditForm:function(t){var i=this,vt=!1,ot,o=0,ii,f,p="165px",e=i.model,yt,s={},h,pt,nt,wt,d,b=e.selectionMode=="row"?e.selectedItem:e.updatedRecords[i._rowIndexOfLastSelectedCell],g,bt,kt,ft,dt,st,l,c,ht,gt,it,ni,lt,w,k,ct,y,v,ti;if(t.requestType=="add"){var ui=document.getElementById(i._id+"AddTab"),ri=n("#"+i._id+"_dialogAdd_wrapper"),ii=document.getElementById(i._id+"GeneralAddForm"),d="#treegrid"+i._id+"predecessorAdd",tt="#"+i._id+"AddAreaNotes",rt="#treegrid"+i._id+"resourceAdd",ut="#treegrid"+i._id+"customFieldAdd";!r.isNullOrUndefined(e.dataSource)&&e.dataSource.length==0&&e.predecessorMapping&&n(d).length>0?(g=[],g[0]=i._dialogTab.indexOf("Predecessors"),n("#"+i._id+"AddTab").ejTab("option","disabledItemIndex",g)):(g=[],g[0]=i._dialogTab.indexOf("Predecessors"),n("#"+i._id+"AddTab").ejTab("option","enabledItemIndex",g),n("#"+i._id+"AddTab").find("div.e-content").css("overflow","visible"));nt=i.model.flatRecords.length;nt=i._getNewTaskId(nt);i.model.enableWBS&&(bt=e.editSettings.rowPosition.toLowerCase(),kt=i._getNewWBSid(bt))}else{var ui=document.getElementById(i._id+"EditTab"),ri=n("#"+i._id+"_dialogEdit_wrapper"),ii=document.getElementById(i._id+"GeneralEditForm"),d="#treegrid"+i._id+"predecessorEdit",tt="#"+i._id+"EditAreaNotes",rt="#treegrid"+i._id+"resourceEdit",ut="#treegrid"+i._id+"customFieldEdit";e.flatRecords.length<=2&&e.parentRecords.length==1&&e.predecessorMapping&&n(d).length>0&&n("#"+i._id+"EditTab").ejTab("removeItem",1)}for(ot=n(ii).find("input,select"),k=ot.length,o;o<k;o++){if(f=ot.eq(o),s={},p=180,h=r.TreeGrid.getColumnByField(i._columns,f.prop("name")),h)v=t.data[h.field];else continue;if(f.hasClass("e-numerictextbox"))yt=p,s.width=yt,s.showSpinButton=!0,s.cssClass=e.cssClass,l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&(l=="statusEdit"||l=="workEdit")&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),(l=="statusEdit"||l=="statusAdd")&&(s.maxValue=100,s.minValue=0),l=="workEdit"&&(s.change=function(){i._updatedColumn="work";i._editStartDateChange(n(this.element[0]))}),s.value=v&&v.toString().length?parseFloat(v):0,r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejNumericTextbox(s),f.prop("name",f.prop("name").replace(i._id,""));else if(f.hasClass("e-datepicker"))s.width=p,s.cssClass=e.cssClass,s.dateFormat=e.dateFormat,s.locale=e.locale,s.startDay=e.scheduleHeaderSettings.weekStartDay,s.change=function(n){this.option("value",n.value);i._updatedColumn=this.element[0].name;i._editStartDateChange(this.element,n)},l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&b.isAutoSchedule&&(l=="startDateEdit"||l=="endDateEdit")&&t.requestType!=="add"&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),s.value=v&&v.toString().length?i._getDateFromFormat(v.toString()):i._getDateFromFormat(e.scheduleStartDate),h.format!==u&&h.format.length>0&&(pt=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),wt=pt.exec(h.format),s.dateFormat=wt[2],s.value=r.format(new Date(s.value),s.dateFormat,s.locale),f.val(s.value)),r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejDatePicker(s);else if(f.hasClass("e-datetimepicker"))s={width:p,rtl:e.rtl,locale:e.locale,cssClass:e.css,dateTimeFormat:e.dateFormat,startDay:e.scheduleHeaderSettings.weekStartDay},s.change=function(n){i._updatedColumn=this.element[0].name;this.option("value",n.value);this._prevDateTimeVal&&i._editStartDateChange(this.element,n)},l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&b.isAutoSchedule&&b.isAutoSchedule&&(l=="startDate"||l=="endDate")&&t.requestType!=="add"&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),s.value=v&&v.toString().length?i._getDateFromFormat(v.toString()):i._getDateFromFormat(e.scheduleStartDate),r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejDateTimePicker(s);else if(f.hasClass("e-dropdownlist"))ft=h.dropdownData,h.field==="resourceInfo"?f.ejDropDownList({cssClass:e.cssClass,width:p,showCheckbox:!0,dataSource:ft,fields:{id:e.resourceIdMapping,text:e.resourceNameMapping,value:e.resourceNameMapping},selectedItems:t.requestType=="add"?i._getResourceInfoIndex(t.data.resourceInfo,e.resources):i.getIndexofresourceInfo(ft,t.data)}):(c={},c.cssClass=e.cssClass,c.width=p,c.dataSource=ft,c.value=v,c.change=function(){i._updateEditDialogFields(this)},r.isNullOrUndefined(h.editParams)||n.extend(c,h.editParams),f.val.length&&(h.field=="taskMode"?(v=t.requestType=="beginedit"?!t.data.isAutoSchedule:e.taskSchedulingMode=="manual"?!0:!1,c.value=v.toString()):h.field=="taskType"?c.value=t.requestType=="beginedit"?t.data.taskType:i.model.taskType:h.field=="effortDriven"&&(c.value=t.requestType=="beginedit"?t.data.effortDriven:e.taskType=="fixedWork"?!0:!1)),t.requestType!="beginedit"||t.data.isAutoSchedule||h.field!="taskType"&&h.field!="effortDriven"||(c.enabled=!1),t.data.taskType=="fixedWork"&&h.field=="effortDriven"&&(c.enabled=!1),t.requestType=="add"&&h.field=="effortDriven"&&e.taskType=="fixedWork"&&(c.enabled=!1),(h.field=="taskType"||h.field=="effortDriven")&&t.data.hasChildRecords&&(c.enabled=!1),h.field=="taskMode"&&e.taskSchedulingMode!=r.Gantt.TaskSchedulingMode.Custom&&(c.enabled=!1),f.val(c.value),f.ejDropDownList(c),dt=f.ejDropDownList("instance"),dt._setValue(f.val()));else if(f.hasClass("e-maskedit"))c={},c.locale=e.locale,c.cssClass=e.cssClass,c.width=p,r.isNullOrUndefined(h.editParams)||n.extend(c,h.editParams),f.ejMaskEdit(c);else switch(f.prop("tagName")){case"INPUT":f.attr("type")!="checkbox"?(f.attr("name")==="taskId"?t.requestType!=="add"?(f.attr("readonly","readonly"),f.css("opacity",.5),f.val(t.data.taskId)):t.requestType==="add"&&(t.data.taskId==""||r.isNullOrUndefined(t.data.taskId)?f.val(nt):f.val(t.data.taskId)):f.attr("name")==="taskName"?t.requestType==="add"?t.data.taskName==""||r.isNullOrUndefined(t.data.taskName)?f.val(i._newTaskTexts.newTaskName+" "+nt):f.val(t.data.taskName):f.val(t.data.taskName):f.attr("name")==="duration"?(t.data&&f.val(i._getDurationStringValue(t.data)),st=i._getDurationValues(t.data),t.requestType!=="add"&&t.data.hasChildRecords&&t.data.isAutoSchedule?(f.attr("readonly","readonly"),f.css("opacity",.5)):t.requestType=="add"&&t.data.duration==""?f.val("0 "+i._durationUnitTexts[st.durationUnit]):f.val(t.data.duration+" "+i._durationUnitTexts[st.durationUnit]),f.change(function(){i._updatedColumn="duration";i._editStartDateChange(n(this))}),f.keyup(function(t){t.keyCode==13&&i._editStartDateChange(n(this))})):f.attr("name")==="WBS"?t.requestType!=="add"?(f.attr("readonly","readonly").css("opacity",.5),f.val(t.data.WBS)):t.requestType==="add"&&(f.val(kt),f.attr("readonly","readonly").css("opacity",.5)):f.attr("name")==="WBSPredecessor"&&f.attr("readonly","readonly").css("opacity",.5),f.attr("name")==="taskName"&&(p=380),l=f[0].id,l=l.replace(i._id,""),f.css("text-align",f.attr("name")!=null&&r.TreeGrid.getColumnByField(i._columns,f.prop("name"))!=null?r.TreeGrid.getColumnByField(i._columns,f.attr("name")).textAlign:"center"),f.outerWidth(p)):(c={},c.cssClass=e.cssClass,c.size="medium",r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejCheckBox(c));break;case"SELECT":f.width(p).height(23)}f.is(":disabled")||vt||f.is(":hidden")&&typeof f.data("ejDropDownList")!="object"||i._isEnterKeyPressed||(i._focusElements(f.closest("td")),vt=!0)}if(e.predecessorMapping&&n(d).length&&(ht=[],t.requestType!=="add"&&(ht=i._predecessorEditCollection()),i._taskNameCollection(),gt=i._predecessorCollectionText,n(d).ejTreeGrid({dataSource:ht,allowSorting:!1,columns:[{headerText:i._columnHeaderTexts.taskId,field:"id",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:i._preTableCollection[0],width:"89px"},{headerText:i._columnHeaderTexts.taskName,field:"name",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:i._preTableCollection[1],width:"300px"},{headerText:i._columnHeaderTexts.type,field:"type",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:gt,width:"141px"},{headerText:i._columnHeaderTexts.offset,field:"offset",editType:r.TreeGrid.EditingType.String,width:"88px"}],enableAltRow:!1,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",rowPosition:"bottom",beginEditAction:r.TreeGrid.BeginEditAction.Click},locale:e.locale,endEdit:n.proxy(i._preEndEdit,i,d,t.requestType),beginEdit:n.proxy(i._preBeginEdit,i),rowSelected:n.proxy(i._enableDisablePredecessorDelete,i,t.requestType),actionComplete:function(n){n.requestType=="delete"&&(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._disablePredecessorAddButton(d,t.requestType))},treeColumnIndex:5,predecessorTable:i._isFromGantt,sizeSettings:{width:"620px",height:"198px"},isResponsive:!1}),e.selectedItem&&e.selectedItem.hasChildRecords&&t.requestType!=="add"?(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._enbleDisablePredecessorAddButton("disable",t.requestType)):(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._enbleDisablePredecessorAddButton("enable",t.requestType))),e.resourceInfoMapping&&n(rt).length){if(it=[],ct=n.extend(!0,[],e.resources),t.requestType!="add")for(w=t.data.resourceInfo,k=w?w.length:0,o=0;o<k;o++)it.push({name:w[o][e.resourceIdMapping],unit:w[o][e.resourceUnitMapping]});else if(t.data.resourceInfo.length!=0)for(ganttRecord=new r.Gantt.GanttRecord,ganttRecord.item=t.data,ni=e.resources,lt=t.data.resourceInfo,ganttRecord.resourceInfo=lt&&ganttRecord._setResourceInfo(lt,e.resourceIdMapping,e.resourceNameMapping,e.resourceUnitMapping,ni),w=ganttRecord.resourceInfo,k=w?w.length:0,o=0;o<k;o++)it.push({name:w[o][e.resourceIdMapping],unit:w[o][e.resourceUnitMapping]});ct=n.extend(!0,[],e.resources);n(rt).ejTreeGrid({dataSource:it,columns:[{headerText:i._columnHeaderTexts.resourceInfo,field:"name",width:"309px",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:ct,editParams:{fields:{text:e.resourceNameMapping,value:e.resourceIdMapping}}},{headerText:i._columnHeaderTexts.unit,field:"unit",width:"309px",editType:r.TreeGrid.EditingType.Numeric,visible:!0,headerTextAlign:"center"}],enableAltRow:!1,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",beginEditAction:r.TreeGrid.BeginEditAction.Click},locale:e.locale,endEdit:n.proxy(i._resourceEndEdit,i,rt,t.requestType),beginEdit:n.proxy(i._resourceBeginEdit,i,rt),rowSelected:n.proxy(i._enableDisableResouceDelete,i,t.requestType),actionBegin:function(t){(t.requestType=="delete"||t.requestType=="sorting")&&(this.model.columns[0].dropdownData=n.extend(!0,[],i.model.resources))},actionComplete:function(n){n.requestType=="delete"&&(i._enableDisableResourceAddButton(n,!0,t.requestType),i.enbleDisableDeleteResourceButton("disable",t.requestType))},treeColumnIndex:3,resourceTable:i._isFromGantt,sizeSettings:{width:"620px",height:"198px"},isResponsive:!1});t.requestType!=="add"&&it.length==e.resources.length?(i.enbleDisableDeleteResourceButton("enable",t.requestType),i.enbleDisableAddResourceButton("disable",t.requestType)):(i.enbleDisableDeleteResourceButton("disable",t.requestType),i.enbleDisableAddResourceButton("enable",t.requestType))}if(n(ut).length){if(t.requestType=="add"){var a=i._addDialogCustomColumns,at=[],et=0,k=a.length;for(o=0;o<k;o++)et++,y={},y.id=et,y.field=a[o].field,y.headerText=a[o].headerText,y.value=t.data[a[o].field],y.text=t.data[a[o].field],y.editType=a[o].editType?a[o].editType.toLowerCase():"stringedit",at.push(y)}else{var a=i._editDialogCustomColumns,at=[],et=0,k=a.length;for(o=0;o<k;o++)et++,y={},y.id=et,y.field=a[o].field,y.headerText=a[o].headerText,y.value=t.data[a[o].field],y.editType=a[o].editType?a[o].editType.toLowerCase():"stringedit",y.text=a[o].editType.toLowerCase()=="dropdownedit"?r.isNullOrUndefined(t.data[a[o].field])?"":i._getDropDownText(a[o],t.data[a[o].field]):t.data[a[o].field],at.push(y)}n(ut).ejTreeGrid({dataSource:at,allowSorting:!1,locale:e.locale,enableAltRow:!1,rowHeight:30,columns:[{headerText:i._columnHeaderTexts.dialogCustomFieldName,field:"headerText",allowEditing:!1},{headerText:"Original Value",field:"value",visible:!1},{headerText:"Field",field:"field",visible:!1},{headerText:i._columnHeaderTexts.dialogCustomFieldValue,field:"text",editTemplate:{create:function(){return"<input style='width:100%;'>"},read:n.proxy(i._customColumnRead,i,ut),write:n.proxy(i._customColumnWrite,i,a,ut)}}],allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",beginEditAction:r.TreeGrid.BeginEditAction.Click},sizeSettings:{width:"620px",height:"234px"},isResponsive:!1})}e.notesMapping&&n(tt).length&&(t.requestType=="add"?v=t.data.notes:(ti=t.data.item[e.notesMapping],v=ti),n(tt).ejRTE({width:"620px",isResponsive:!1,height:"281px",value:v,locale:e.locale,tools:{font:["fontName","fontSize","fontColor","backgroundColor"],style:["bold","italic","underline","strikethrough"],alignment:["justifyLeft","justifyCenter","justifyRight","justifyFull"],doAction:["undo","redo"],indenting:[],clear:[],links:["createLink","removeLink"],images:[],media:[],tables:[],lists:["unorderedList"],clipboard:[],edit:[],formatStyle:[],view:[]}}),n(tt+"_wrapper").find(".e-toolbar.e-toolbarspan").css("border-bottom","none"),n(tt+"_editor").height("208"),n(tt+"_Iframe")[0].style.height="203px",n(ri).removeClass("e-rte"))},_enbleDisablePredecessorDeleteButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_PredecesorDelete"):n("#"+r._id+"EditDialog_PredecesorDelete");t==="enable"?(n(u).unbind("click",n.proxy(r._deletepredecessor,r)).bind("click",n.proxy(r._deletepredecessor,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._deletepredecessor,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_enbleDisablePredecessorAddButton:function(t,i){var r=this,u="";u=i=="add"?n("#"+r._id+"AddDialog_PredecesorAdd"):n("#"+r._id+"EditDialog_PredecesorAdd");t==="enable"?(n(u).unbind("click",n.proxy(r._addpredecessor,r)).bind("click",n.proxy(r._addpredecessor,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._addpredecessor,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_disablePredecessorAddButton:function(t,i){var f=this,e=n(t+"e-table"),o=!1,s=e[0].rows.length,r,u;for(f._enbleDisablePredecessorAddButton("disable",i),r=0;r<s;r++)u=e[0].rows[r],u.cells.length===4&&u.cells[1].innerText===""&&(o=!0);o||f._enbleDisablePredecessorAddButton("enable",i)},_updateEditDialogFields:function(t){var f=this,e=n(t.element).attr("dialog"),i,u;e=="Add"?(i=n("#"+f._id+"effortDrivenAdd").data("ejDropDownList"),u=n("#"+f._id+"taskTypeAdd").data("ejDropDownList")):(i=n("#"+f._id+"effortDrivenEdit").data("ejDropDownList"),u=n("#"+f._id+"taskTypeEdit").data("ejDropDownList"));r.isNullOrUndefined(i)||t._name!="taskType"||(t.model.value=="fixedWork"?(i.selectItemByValue("true"),i.disable()):i.enable(),f._editedDialogRecord[t._name]=t.model.value);t._name=="taskMode"&&(t.model.text=="Auto"&&(r.isNullOrUndefined(i)||r.isNullOrUndefined(u)||u.model.value=="fixedWork"||i.enable(),r.isNullOrUndefined(u)||u.enable(),f._editedDialogRecord.isAutoSchedule=!0),t.model.text=="Manual"&&(r.isNullOrUndefined(i)||i.disable(),r.isNullOrUndefined(u)||u.disable(),f._editedDialogRecord.isAutoSchedule=!1))},_customColumnWrite:function(t,i,r){var e=this,o=r.rowdata!==u?r.rowdata.text:"",s=n(i).ejTreeGrid("instance").model,h=t[s.selectedRowIndex],f={},c,l;h.editParams&&(f=n.extend(!0,{},h.editParams));f.value=o;f.locale=e.model.locale;switch(r.rowdata.editType.toLowerCase()){case"numericedit":f.height="25px";r.element.ejNumericTextbox(f);break;case"stringedit":n(r.element).val(o).css({padding:"0px",border:"0px",height:"25px"}).addClass("e-ejinputtext");break;case"datepicker":f.width="100%";f.height="25px";f.startDay=e.model.scheduleHeaderSettings.weekStartDay;r.element.ejDatePicker(f);break;case"datetimepicker":f.width="100%";f.height="25px";f.startDay=e.model.scheduleHeaderSettings.weekStartDay;r.element.ejDateTimePicker(f);break;case"maskedit":f.width="100%";f.height="25px";r.element.ejMaskEdit(f);break;case"dropdownedit":f.width="100%";f.height="25px";f.dataSource=h.dropdownData;f.value=s.currentViewData[s.selectedRowIndex].value;r.element.ejDropDownList(f);break;case"booleanedit":f.cssClass=model.cssClass;f.size="small";f.checked=o;r.element.ejCheckBox(f);c=r.element.parent(".e-chkbox-wrap");l=c.parent("form");l.length>0?l.css("margin-left","45%"):c.css("margin-left","45%")}},_customColumnRead:function(t,i){var u,r,f=n(t).ejTreeGrid("instance"),e=f.model.selectedRowIndex,o=f.model.updatedRecords;return n(i).blur(),n(i).focusout(),n(i[0]).hasClass("e-numerictextbox")?u=r=n(i).ejNumericTextbox("getValue"):n(i[0]).hasClass("e-datepicker")?u=r=n(i).ejDatePicker("getValue"):n(i[0]).hasClass("e-datepicker")?u=r=n(i).ejDatePicker("getValue"):n(i[0]).hasClass("e-dattimeepicker")?u=r=n(i).ejDateTimePicker("getValue"):n(i[0]).hasClass("e-maskedit")?u=r=n(i[0]).ejMaskEdit("model.value"):n(i[0]).hasClass("e-dropdownlist")?(r=n(i[0]).ejDropDownList("model.text"),u=n(i[0]).ejDropDownList("getSelectedValue")):u=n(i[0]).hasClass("e-checkbox")?r=n(i[0]).ejCheckBox("isChecked"):r=n(i).val(),o[e].value=u,o[e].text=r,f.refreshRow(e),r},_enableDisableResourceAddButton:function(t,i,r){var u=this,f=t.model.dataSource,e=!1,o;u.enbleDisableAddResourceButton("disable",r);i&&(o=n.map(f,function(n,t){if(n.name==""||n.name==null)return t}),o.length>0&&f.length>0&&(e=!0),e||u.enbleDisableAddResourceButton("enable",r))},_addpredecessor:function(t){var i=this,f,r,u;n(t.target).hasClass("e-edit-dialog")?(f="#treegrid"+i._id+"predecessorEdit",u="edit"):(f="#treegrid"+i._id+"predecessorAdd",u="add");i._enbleDisablePredecessorAddButton("disable",u);r=n(f).ejTreeGrid("instance");r.addRow({id:"",name:"",type:"Finish-Start",offset:"0"});r.clearSelection(r.model.selectedRowIndex);i._enbleDisablePredecessorDeleteButton("disable",u)},_deletepredecessor:function(t){var u=this,i,f,e,o;n(t.target).hasClass("e-edit-dialog")?(i="#treegrid"+u._id+"predecessorEdit",f="edit"):(i="#treegrid"+u._id+"predecessorAdd",f="add");e=n(i).ejTreeGrid("option","selectedRowIndex");o={};o.requestType=r.TreeGrid.Actions.Delete;e!==-1&&(n(i).ejTreeGrid("deleteRow"),u._enbleDisablePredecessorDeleteButton("disable",f));u._disablePredecessorAddButton(i,f)},enbleDisableDeleteResourceButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_ResourceDelete"):n("#"+r._id+"EditDialog_ResourceDelete");t==="enable"?(n(u).unbind("click",n.proxy(r._deleteResource,r)).bind("click",n.proxy(r._deleteResource,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._deleteResource,r)),n(u).addClass("e-disable").removeClass("e-enable"))},enbleDisableAddResourceButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_ResourceAdd"):n("#"+r._id+"EditDialog_ResourceAdd");t==="enable"?(n(u).unbind("click",n.proxy(r._addResource,r)).bind("click",n.proxy(r._addResource,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._addResource,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_addResource:function(t){var i=this,f,r,u;n(t.target).hasClass("e-edit-dialog")?(u="edit",f="#treegrid"+i._id+"resourceEdit"):(u="add",f="#treegrid"+i._id+"resourceAdd");i.enbleDisableAddResourceButton("disable",u);r=n(f).ejTreeGrid("instance");r.clearSelection(r.model.selectedRowIndex);r.addRow({name:"",unit:"100"},"bottom");i.enbleDisableDeleteResourceButton("disable",u)},_deleteResource:function(t){var u=this,i,f,e;i=n(t.target).hasClass("e-edit-dialog")?"#treegrid"+u._id+"resourceEdit":"#treegrid"+u._id+"resourceAdd";f=n(i).ejTreeGrid("option","selectedRowIndex");e={};e.requestType=r.TreeGrid.Actions.Delete;f!==-1&&n(i).ejTreeGrid("deleteRow")},_resourceEndEdit:function(t,i,r){var u=this,f=r.model.columns;f[0].dropdownData=n.extend(!0,[],u.model.resources);enableResourceAdd=r.model.dataSource.length<u.model.resources.length;u._enableDisableResourceAddButton(r,enableResourceAdd,i)},_resourceBeginEdit:function(t,i){for(var o,s=this,h=s.model.resourceIdMapping,f=i.model,c=f.columns,e=c[0].dropdownData,u=f.dataSource,l=u.length,a=i.data.item.name,r=0;r<l;r++)u[r].name!=""&&u[r].name!=null&&a!=u[r].name&&(o=n.map(e,function(n,t){if(n[h].toString()==u[r].name)return t}),e.splice(o[0],1))},getColumnIndexByField:function(n){var r=this,i=r.model.columns,u=i.length,t=0;for(t;t<u;t++)if(i[t].field==n)break;return t},getIndexofresourceInfo:function(n,t){var r=t.resourceInfo,i=0,f=r?r.length:0,u=[];for(i;i<f;i++)n.indexOf(r[i])!=-1&&u.push(n.indexOf(r[i]));return u},_focusElements:function(n){if(n.length){n.focus();var t=n.children();t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t.find(".e-ddl").focus():t.find("input,select").select().focus()}},renderDiaglogButton:function(n,t){var e,i=this,u=i.model,o,l,a,s,v,h,f,c;return e=n=="edit"?"EditDialog_":"AddDialog_",o=r.buildTag("input","",{"border-radius":"3px","min-width":"70px"},{type:"button",id:e+i._id+"_Save"}),l=n=="edit"?i._editDialogTexts.saveButton:i._editDialogTexts.addButton,o.ejButton({cssClass:u.cssClass,text:l,width:"auto"}),a=i._editDialogTexts.cancelButton,s=r.buildTag("input","",{"margin-left":"18px","border-radius":"3px","min-width":"70px"},{type:"button",id:e+i._id+"_Cancel"}),s.ejButton({cssClass:u.cssClass,text:a,width:"auto"}),v=i._editDialogTexts.deleteButton,h=r.buildTag("input","",{"border-radius":"3px","min-width":"90px"},{type:"button",id:"EditDialog_"+i._id+"_Delete"}),h.ejButton({cssClass:u.cssClass,text:v,width:"auto"}),f=r.buildTag("div","",{float:"right","z-index":"10"},{"class":"e-editform-btn e-editfrom-btn-right"}),c=r.buildTag("div","",{float:"left","z-index":"10"},{"class":"e-editform-btn e-editfrom-btn-left"}),f.append(o),n=="edit"&&u.editSettings.allowDeleting&&c.append(h),f.append(s),f.appendTo(t),c.appendTo(t),t},_renderToolBar:function(){var t=this,f=t.model,u=r.buildTag("div.e-gantttoolbar#e-gantttoolbar"+t._id,"",{height:"50px"},{id:t._id+"_toolbarItems"}),e,o,s,h,i;return!r.isNullOrUndefined(f.toolbarSettings.toolbarItems)&&f.toolbarSettings.toolbarItems.length&&(e=r.buildTag("ul","",{},{}),t._renderLi(e),u.append(e)),!r.isNullOrUndefined(f.toolbarSettings.customToolbarItems)&&f.toolbarSettings.customToolbarItems.length&&(o=r.buildTag("ul","",{},{}),t._renderCustomLi(o),u.append(o)),f.toolbarSettings.toolbarItems.indexOf(r.Gantt.ToolbarItems.Search)!=-1&&(s=r.buildTag("ul.e-gantt-search-container","",{float:"right"},{}),h=r.buildTag("li","",{},{id:t._id+"_"+r.Gantt.ToolbarItems.Search,tabindex:"0"}),t._renderLiContent(h,r.Gantt.ToolbarItems.Search),s.append(h),u.append(s)),i={},i.click=t._toolBarClick,i.cssClass="",i.rtl=!1,i.itemSeparator=!1,i.width=t._ganttWidth,i.fields={id:"",tooltipText:"",imageUrl:"",text:"",imageAttributes:"",spriteCSS:"",htmlAttributes:""},u.ejToolbar(i),u.ejToolbar("disableItem",t._disabledToolItems),t._disabledToolItems=n(),u},_renderCustomLi:function(t){for(var e,o=this,h=o.model,f,s,u=h.toolbarSettings.customToolbarItems,i=0;i<u.length;i++)(u[i].text||u[i].templateID)&&(u[i].text?(e=u[i].tooltipText?u[i].tooltipText:u[i].text,f=r.buildTag("li","",{},{id:o._id+"_"+u[i].text,title:e}),s=r.buildTag("a.e-toolbaricons e-icon e-ganttcustomtoolbaritem","",{}).addClass(u[i].text),f.addClass("e-gantttoolbaritem")):(e=u[i].tooltipText?u[i].tooltipText:u[i].templateID.replace("#",""),f=r.buildTag("li","",{},{id:o._id+"_"+u[i].templateID.replace("#",""),title:e}),s=n(u[i].templateID).hide().html()),f.html(s),t.append(f))},_renderLi:function(n){var f=this,i=f.model.toolbarSettings.toolbarItems,e=i.length,t=0,u;for(t;t<e;t++)u=r.buildTag("li","",{},{id:f._id+"_"+i[t],tabindex:"0"}),i[t]!=="search"&&(u.addClass("e-gantttoolbaritem"),f._renderLiContent(u,i[t]),n.append(u))},_renderLiContent:function(t,i){var f,u,e=this.selectedRowIndex(),tt=this.model.editSettings,s,h,c,l,a,v,y,p,w,b,k,d,o,g,nt;switch(i){case"add":f=r.buildTag("a.e-addnewitem e-toolbaricons e-icon e-gantt-add","",{});s=this._toolboxTooltipTexts.addTool;t.attr("title",s);this.model.readOnly!=!0&&this.model.editSettings.allowAdding||this._disabledToolItems.push(t.get(0));break;case"edit":f=r.buildTag("a.e-edititem e-toolbaricons e-icon e-gantt-edit","",{});h=this._toolboxTooltipTexts.editTool;t.attr("title",h);this.model.readOnly!=!0&&this.model.editSettings.allowEditing&&e!=-1&&this.model.editSettings.beginEditAction!="click"||this._disabledToolItems.push(t.get(0));break;case"delete":c=this._toolboxTooltipTexts.deleteTool;t.attr("title",c);f=r.buildTag("a.e-deleteitem e-toolbaricons e-icon e-gantt-delete","",{});this.model.readOnly!=!0&&this.model.editSettings.allowDeleting&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"update":l=this._toolboxTooltipTexts.saveTool;t.attr("title",l);f=r.buildTag("a.e-saveitem e-toolbaricons e-icon e-gantt-save e-disabletool","",{});this._disabledToolItems.push(t.get(0));break;case"cancel":a=this._toolboxTooltipTexts.cancelTool;t.attr("title",a);f=r.buildTag("a.e-cancel e-toolbaricons e-icon e-gantt-cancel e-disabletool","",{});this._disabledToolItems.push(t.get(0));break;case"indent":v=this._toolboxTooltipTexts.indentTool;t.attr("title",v);u=r.buildTag("a.e-indent e-toolbaricons e-icon e-disabletool e-gantt-indent","",{},{});t.append(u);this.model.readOnly!=!0&&this.model.editSettings.allowIndent&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"outdent":y=this._toolboxTooltipTexts.outdentTool;t.attr("title",y);u=r.buildTag("a.e-outdent e-toolbaricons e-icon e-disabletool e-gantt-outdent","",{},{});t.append(u);this.model.readOnly!=!0&&this.model.editSettings.allowIndent&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"expandAll":p=this._toolboxTooltipTexts.expandAllTool;t.attr("title",p);u=r.buildTag("a.e-expandall e-toolbaricons e-icon e-gantt-expandall","",{},{});t.append(u);break;case"collapseAll":w=this._toolboxTooltipTexts.collapseAllTool;t.attr("title",w);u=r.buildTag("a.e-collapseall e-toolbaricons e-icon e-gantt-collapseall","",{},{});t.append(u);break;case"prevTimeSpan":b=this._toolboxTooltipTexts.prevTimeSpanTool;t.attr("title",b);u=r.buildTag("a.e-prevtimespan e-toolbaricons e-icon e-gantt-prevtimespan","",{},{});t.append(u);break;case"nextTimeSpan":k=this._toolboxTooltipTexts.nextTimeSpanTool;t.attr("title",k);u=r.buildTag("a.e-nexttimespan e-toolbaricons e-icon e-gantt-nexttimespan","",{},{});t.append(u);break;case"criticalPath":d=this._toolboxTooltipTexts.criticalPathTool;t.attr("title",d);u=r.buildTag("a.e-criticaltask e-toolbaricons e-icon e-gantt-criticaltask","",{},{});t.append(u);break;case"search":o=this._toolboxTooltipTexts.searchTool;u=r.buildTag("input.e-ejinputtext","",{margin:"4px","text-indent":"4px"},{type:"text",placeholder:o},{color:"#E8E9E9"});t.css({float:"right",padding:"2px"});t.attr("title",o);t.addClass("e-search");t.append(u);this.model.allowSearching=!0;u.keydown(n.proxy(this._keyDown,this));break;case"excelExport":g=this._toolboxTooltipTexts.excelExportTool;t.attr("title",g);u=r.buildTag("a.e-excelIcon e-toolbaricons e-icon e-gantt-excelexport","",{},{});t.append(u);break;case"pdfExport":nt=this._toolboxTooltipTexts.pdfExportTool;t.attr("title",nt);u=r.buildTag("a.e-pdfIcon e-toolbaricons e-icon","",{},{});t.append(u)}t.append(f)},_keyDown:function(n){if(n.which===13)return this._toolbarOperation(this._id+"_search",n.currentTarget.value),n.preventDefault(),!1},_updateToolbarOptions:function(){var v=this,e=v.model,o=e.editSettings,i=n("#"+v._id+"_toolbarItems"),f=n(i).find(".e-addnewitem").parent()[0],r=n(i).find(".e-edititem").parent()[0],u=n(i).find(".e-deleteitem").parent()[0],s=n(i).find(".e-indent").parent()[0],h=n(i).find(".e-outdent").parent()[0],c=n(i).find(".e-saveitem").parent()[0],l=n(i).find(".e-cancel").parent()[0],t=[],a=[];e.readOnly==!0?(f&&t.push(n(f)),r&&t.push(n(r)),u&&t.push(n(u)),s&&t.push(n(s)),h&&t.push(n(h)),c&&t.push(n(c)),l&&t.push(n(l)),n(i).ejToolbar("disableItem",t)):(o.allowAdding?f&&a.push(f):f&&t.push(n(f)),e.selectedItem?(o.allowEditing&&e.editSettings.beginEditAction!="click"?r&&a.push(r):r&&t.push(n(r)),o.allowDeleting?u&&a.push(u):u&&t.push(n(u)),v.updateIndentOutdentOption(e.selectedItem)):(o.allowEditing&&r&&t.push(n(r)),o.allowDeleting&&u&&t.push(n(u)),c&&c&&t.push(n(c)),l&&l&&t.push(n(l)),s&&s&&t.push(n(s)),h&&h&&t.push(n(h))),n(i).ejToolbar("disableItem",t),n(i).ejToolbar("enableItem",a))},_renderGantt:function(){var i=this,a=i.model,t,c,u=parseInt(i._ganttWidth),e=i.splitterPosition(),s=!1,l=a.splitterSettings.index,h,o,f;if(e||(e=i._splitterPosition(),i.splitterPosition(e)),e||l>-1){if(e)typeof e=="string"&&e.indexOf("%")!=-1?(t=parseInt(e),s=!0):(t=parseInt(e)/u*100,s=!1);else{for(h=i.getColumns(),o=0,columnIndex=l,columnIndex>=h.length&&(columnIndex=h.length-1),f=0;f<=columnIndex;f++)o+=h[f].width;if(o<=u)t=parseInt(o)/u*100,l=f-1;else for(o=0,f=0;f<=columnIndex;f++)if(o+h[f].width<=u)o+=h[f].width,l=f;else{t=parseInt(o)/u*100;break}a.splitterSettings.index=l}(isNaN(t)||t<0)&&(t=0);t>100&&(t=(2*i._commonColumnWidth+3)/u*100,t=t<30?t:30,s=!0)}else t=(2*i._commonColumnWidth+3)/u*100,t=t<30?t:30,s=!0;c=100-t-900/u;c<=0?(s?i.splitterPosition("100%"):i.splitterPosition(u.toString()),t=100-900/u,c=0):c>0&&(s?i.splitterPosition(Math.round(t)+"%"):i.splitterPosition(Math.round(t*u/100).toString()));i._splitterPosition(i.splitterPosition());n("#e-ejSpliter"+i._id).ejSplitter({height:i._ganttHeight,width:u,orientation:r.Orientation.Horizontal,properties:[{paneSize:t+"%",collapsible:!1},{paneSize:c+"%",collapsible:!1}],enableAutoResize:!1,resize:n.proxy(i._onResize,i)})},_renderTreeGrid:function(){var i=this,t=i.model;i._$treegridHelper=n("#ejTreeGrid"+i._id).ejTreeGrid({enableAltRow:t.enableAltRow,allowColumnResize:t.allowColumnResize,enableVirtualization:t.enableVirtualization,allowSorting:t.allowSorting,showColumnChooser:t.showColumnChooser,showColumnOptions:t.showColumnOptions,allowMultiSorting:t.allowMultiSorting,sortSettings:t.sortSettings,allowSelection:t.allowSelection,selectionType:t.selectionMode=="cell"?t.selectionType:"single",selectionMode:t.selectionMode,selectedRowIndex:this.selectedRowIndex(),allowDragAndDrop:t.allowDragAndDrop,dragTooltip:t.dragTooltip,allowSearching:t.allowSearching,parentIdMapping:t.parentTaskIdMapping,baselineStartDateMapping:t.baselineStartDateMapping,baselineEndDateMapping:t.baselineEndDateMapping,allowKeyboardNavigation:t.allowKeyboardNavigation,cssClass:t.cssClass,locale:t.locale,columns:i.getColumns(),editSettings:t.editSettings,toolbarSettings:t.toolbarSettings,rowTemplate:t.rowTemplate,rowDataBound:t.rowDataBound,queryCellInfo:t.queryCellInfo,cellSelecting:t.cellSelecting,cellSelected:t.cellSelected,selectedCellIndexes:this.selectedCellIndexes(),dataSource:this.dataSource(),flatRecords:t.flatRecords,parentRecords:t.parentRecords,ids:i.model.ids,columns:i._columns,dateFormat:t.dateFormat,resourceInfoMapping:t.resourceInfoMapping,resourceNameMapping:t.resourceNameMapping,resourceIdMapping:t.resourceIdMapping,resourceUnitMapping:t.resourceUnitMapping,idMapping:t.taskIdMapping,readOnly:t.readOnly,notesMapping:t.notesMapping,showGridCellTooltip:t.showGridCellTooltip,cellTooltipTemplate:t.cellTooltipTemplate,showGridExpandCellTooltip:t.showGridExpandCellTooltip,taskNameMapping:t.taskNameMapping,taskSchedulingModeMapping:t.taskSchedulingModeMapping,startDateMapping:t.startDateMapping,endDateMapping:t.endDateMapping,childMapping:t.childMapping,durationMapping:t.durationMapping,durationUnitMapping:t.durationUnitMapping,durationUnit:t.durationUnit,progressMapping:t.progressMapping,predecessorMapping:t.predecessorMapping,rowHeight:t.rowHeight,emptyRecordText:i._emptyRecordText,isFromGantt:i._isFromGantt,treeColumnIndex:t.treeColumnIndex,workingTimeScale:t.workingTimeScale,enableWBS:t.enableWBS,enableWBSPredecessor:t.enableWBSPredecessor,columnMenuTexts:i._columnMenuTexts,editTypeText:i._editTypeText,clipModeText:i._clipModeText,textAlignTypeText:i._textAlignTypeText,columnDialogTitle:i._columnDialogTitle,deleteColumnText:i._deleteColumnText,okButtonText:i._okButtonText,cancelButtonText:i._cancelButtonText,confirmDeleteText:i._confirmDeleteText,columnDialogFields:t.columnDialogFields,columnDialogTexts:i._columnDialogTexts,workMapping:t.workMapping,workUnit:i._workUnitTexts[t.workUnit],taskTypeTexts:i._taskTypeTexts,effortDrivenTexts:i._effortDrivenTexts,dataManagerUpdate:{isDataManagerUpdate:i._isDataManagerUpdate,jsonData:i._jsonData},durationUnitEditText:this._durationUnitEditText,durationUnitTexts:i._durationUnitTexts,enableCollapseAll:t.enableCollapseAll,weekStartDay:t.scheduleHeaderSettings.weekStartDay,indentLevelWidth:this.indentLevelWidth})},_renderGanttChart:function(){var i=this,t=this.model;i._$ganttchartHelper=n("#ejGanttChart"+i._id).ejGanttChart({dataSource:this.dataSource(),scheduleStartDate:t.scheduleStartDate,scheduleEndDate:t.scheduleEndDate,startDateMapping:t.startDateMapping,endDateMapping:t.endDateMapping,taskNameMapping:t.taskNameMapping,taskIdMapping:t.taskIdMapping,progressMapping:t.progressMapping,durationMapping:t.durationMapping,childPropertyName:t.childMapping,predecessorMapping:t.predecessorMapping,enableVirtualization:t.enableVirtualization,highlightWeekends:t.highlightWeekends,milestoneMapping:t.milestoneMapping,enableRowHover:t.enableRowHover,perDayWidth:i._perDayWidth,workingTimeScale:t.workingTimeScale,roundOffDayworkingTime:t.roundOffDayworkingTime,durationUnit:t.durationUnit,isCriticalPathEnable:this.isCriticalPathEnable,criticalPathCollection:this.criticalPathCollection,perMonthWidth:i._perMonthWidth,perWeekWidth:i._perWeekWidth,perHourWidth:i._perHourWidth,perMinuteWidth:i._perMinuteWidth,perTopHourWidth:i._perTopHourWidth,minuteInterval:i._minuteInterval,includeWeekend:t.includeWeekend,connectorlineWidth:t.connectorlineWidth,workingTimeRanges:i._workingTimeRanges,secondsPerDay:i._secondsPerDay,scheduleHeaderSettings:t.scheduleHeaderSettings,taskbarBackground:t.taskbarBackground,progressbarBackground:t.progressbarBackground,connectorLineBackground:t.connectorLineBackground,parentTaskbarBackground:t.parentTaskbarBackground,parentProgressbarBackground:t.parentProgressbarBackground,holidays:t.holidays,dateFormat:t.dateFormat,locale:t.locale,enableTaskbarTooltip:t.enableTaskbarTooltip,enableTaskbarDragTooltip:t.enableTaskbarDragTooltip,flatRecords:t.flatRecords,parentRecords:t.parentRecords,scheduleWeeks:i._scheduleWeeks,projectStartDate:i._projectStartDate,projectEndDate:i._projectEndDate,scheduleYears:i._scheduleYears,scheduleMonths:i._scheduleMonths,scheduleDays:i._scheduleDays,scheduleHours:i._scheduleHours,progressbarHeight:t.progressbarHeight,tooltipTemplate:t.taskbarTooltipTemplate,tooltipTemplateId:t.taskbarTooltipTemplateId,progressbarTooltipTemplate:t.progressbarTooltipTemplate,progressbarTooltipTemplateId:t.progressbarTooltipTemplateId,queryTaskbarInfo:t.queryTaskbarInfo,readOnly:t.readOnly,showTaskNames:t.showTaskNames,leftTaskLabelMapping:t.leftTaskLabelMapping,rightTaskLabelMapping:t.rightTaskLabelMapping,leftTaskLabelTemplate:t.leftTaskLabelTemplate,rightTaskLabelTemplate:t.rightTaskLabelTemplate,showProgressStatus:t.showProgressStatus,showResourceNames:t.showResourceNames,resourceInfoMapping:t.resourceInfoMapping,resourceNameMapping:t.resourceNameMapping,resourceUnitMapping:t.resourceUnitMapping,enableProgressBarResizing:t.enableProgressBarResizing,allowGanttChartEditing:t.allowGanttChartEditing,taskbarEditingTooltipTemplateId:t.taskbarEditingTooltipTemplateId,taskbarEditingTooltipTemplate:t.taskbarEditingTooltipTemplate,ids:i.model.ids,stripLines:t.stripLines,_predecessorCollection:i._predecessorsCollection,_columns:i._columns,weekendBackground:t.weekendBackground,allowKeyboardNavigation:t.allowKeyboardNavigation,updatedRecords:i.model.updatedRecords,renderBaseline:t.renderBaseline,baselineColor:t.baselineColor,editSettings:t.editSettings,columnHeaderTexts:i._columnHeaderTexts,durationUnitTexts:i._durationUnitTexts,predecessorEditingTexts:i._predecessorEditingTexts,localizedDays:i._days,localizedMonths:i._months,rowHeight:t.rowHeight,allowSelection:t.allowSelection,selectionMode:t.selectionMode,taskbarTemplate:t.taskbarTemplate,parentTaskbarTemplate:t.parentTaskbarTemplate,milestoneTemplate:t.milestoneTemplate,durationUnitEditText:this._durationUnitEditText,taskbarClick:t.taskbarClick,predecessorText:i._getPredecessorText(),taskbarHeight:i.taskbarHeight})},_getPredecessorText:function(){var n=this._predecessorCollectionText[1],t={};return n=n.value.split("-"),t.Start=n[0],t.Finish=n[1],t},_updateColumnDropDownData:function(){for(var n=this,r=n.model,i=r.columns,u=i.length,t=0;t<u;t++)i[t].field=="taskMode"&&(i[t].dropdownData=[{id:1,text:n._taskModeTexts.manual,value:"true"},{id:2,text:n._taskModeTexts.auto,value:"false"}]),i[t].field=="taskType"&&(i[t].dropdownData=[{id:1,text:n._taskTypeTexts.fixedWork,value:"fixedWork"},{id:2,text:n._taskTypeTexts.fixedUnit,value:"fixedUnit"},{id:3,text:n._taskTypeTexts.fixedDuration,value:"fixedDuration"}]),i[t].field=="effortDriven"&&(i[t].dropdownData=[{id:1,text:n._effortDrivenTexts.yes,value:"true"},{id:2,text:n._effortDrivenTexts.no,value:"false"}])},createTreeGridColumns:function(){var u=this,i=u.model,t,f=[],n=i.taskIdMapping,e;return n.length&&(t=i.showColumnChooser?{field:"taskId",headerText:u._columnHeaderTexts.taskId,width:40,editType:r.Gantt.EditingType.String,mappingName:n,allowEditing:!1,allowCellSelection:!0}:{field:"taskId",headerText:u._columnHeaderTexts.taskId,width:30,editType:r.Gantt.EditingType.String,mappingName:n,allowEditing:!1,allowCellSelection:!0},f.push(t)),n=i.taskNameMapping,n.length&&(t={field:"taskName",headerText:u._columnHeaderTexts.taskName,width:150,editType:r.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},f.push(t)),n=i.startDateMapping,n.length&&(t={field:"startDate",headerText:u._columnHeaderTexts.startDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},f.push(t)),n=i.endDateMapping,n.length&&(t={field:"endDate",headerText:u._columnHeaderTexts.endDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},f.push(t)),n=i.resourceInfoMapping,n.length&&(t={field:"resourceInfo",headerText:u._columnHeaderTexts.resourceInfo,width:150,editType:r.Gantt.EditingType.Dropdown,mappingName:n,allowCellSelection:!0,dropdownData:i.resources},f.push(t)),n=i.durationMapping,n.length&&(t={field:"duration",headerText:u._columnHeaderTexts.duration,width:150,editType:r.Gantt.EditingType.String,allowCellSelection:!0,mappingName:n},f.push(t)),n=i.progressMapping,n.length&&(t={field:"status",headerText:u._columnHeaderTexts.status,width:150,editType:r.Gantt.EditingType.Numeric,mappingName:n,allowCellSelection:!0},f.push(t)),n=i.predecessorMapping,n.length&&(t={field:"predecessor",headerText:u._columnHeaderTexts.predecessor,width:150,editType:r.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},f.push(t)),i.renderBaseline&&i.baselineStartDateMapping&&i.baselineEndDateMapping&&(n=i.baselineStartDateMapping,n.length&&(t={field:"baselineStartDate",headerText:u._columnHeaderTexts.baselineStartDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},f.push(t)),n=i.baselineEndDateMapping,n.length&&(t={field:"baselineEndDate",headerText:u._columnHeaderTexts.baselineEndDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},f.push(t))),i.enableWBS&&(n="WBS",n.length&&(t={field:"WBS",headerText:u._columnHeaderTexts.WBS,width:150,editType:r.Gantt.EditingType.String,allowEditing:!1,mappingName:n},f.push(t))),i.enableWBS&&i.enableWBSPredecessor&&(n="WBSPredecessor",n.length&&(t={field:"WBSPredecessor",headerText:u._columnHeaderTexts.WBSPredecessor,width:150,editType:r.Gantt.EditingType.String,allowEditing:!1,mappingName:n},f.push(t))),n=i.notesMapping,n.length&&(t={field:"notesText",headerText:u._columnHeaderTexts.notes,width:150,editType:"stringedit",mappingName:n,allowEditing:!0,allowCellSelection:!0},f.push(t)),n=i.taskSchedulingModeMapping,n.length&&(e=!1,i.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom&&(e=!0),t={field:"taskMode",headerText:u._columnHeaderTexts.taskMode,width:100,editType:r.Gantt.EditingType.Dropdown,allowCellSelection:e,allowEditing:e,mappingName:n,dropdownData:[{id:1,text:u._taskModeTexts.manual,value:"true"},{id:2,text:u._taskModeTexts.auto,value:"false"}],editParams:{field:{text:"text",value:"value"}}},f.push(t)),n=i.workMapping,t={field:"work",headerText:u._columnHeaderTexts.work,width:150,editType:r.Gantt.EditingType.Numeric,allowEditing:!0,allowCellSelection:!0,visible:n?!0:!1},n.length&&(t.mappingName=n),f.push(t),t={field:"taskType",headerText:u._columnHeaderTexts.taskType,width:150,editType:r.Gantt.EditingType.Dropdown,dropdownData:[{id:1,text:u._taskTypeTexts.fixedWork,value:"fixedWork"},{id:2,text:u._taskTypeTexts.fixedUnit,value:"fixedUnit"},{id:3,text:u._taskTypeTexts.fixedDuration,value:"fixedDuration"}],editParams:{field:{text:"text",value:"value"}},allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),t={field:"effortDriven",headerText:u._columnHeaderTexts.effortDriven,width:150,editType:r.Gantt.EditingType.Dropdown,dropdownData:[{id:1,text:u._effortDrivenTexts.yes,value:"true"},{id:2,text:u._effortDrivenTexts.no,value:"false"}],editParams:{field:{text:"text",value:"value"}},allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),f},_createGanttRecords:function(n){var t=this,r=t.model,e=r.flatRecords,o=n.length,f=0,i,s=r.parentRecords,c=r.allowSorting,l=r.enableAltRow,h=t.model.ids;for(f;f<o;f++)r.enableWBS&&(n[f].WBS=(f+1).toString()),i=t._createGanttRecord(n[f],0,null,u,"Load"),t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,h[t._storedIndex]=i.taskId.toString(),e.push(i),s.push(i),i.childRecords&&t._addNestedGanttRecords(i.childRecords);r.enableWBS&&r.enableWBSPredecessor&&t.createWBSPredecessor()},createWBSPredecessor:function(){var c=this,n=c.model,u,r,i,s,h,o;if(n.enableWBS&&n.enableWBSPredecessor&&n.predecessorMapping)for(u=n.flatRecords.filter(function(n){return n&&n.predecessor}),r=0;r<u.length;r++){var f=u[r],e=f.predecessor,t=null;for(i=0;i<e.length;i++)s=+e[i].from,h=n.flatRecords.filter(function(n){return n&&n.taskId==s}),o=h[0].WBS+e[i].predecessorsType,t=t?t+","+o:o;f.WBSPredecessor=t;f.item.WBSPredecessor=t}},_calculateScheduleDates:function(t){var o=this,r,i,f,e,u=this.model,s=u.flatRecords,h;(!u.scheduleEndDate||!u.scheduleStartDate)&&s.length>0||t?(n.each(s,function(n,t){f=new Date(t.startDate);e=new Date(t.endDate);baseLineStartDate=t.baselineStartDate?new Date(t.baselineStartDate):null;baseLineEndDate=t.baselineEndDate?new Date(t.baselineEndDate):null;r?(r.getTime()>=f.getTime()&&(r=f),baseLineStartDate&&u.renderBaseline&&r.getTime()>=baseLineStartDate.getTime()?r=baseLineStartDate:baseLineEndDate&&u.renderBaseline&&r.getTime()>=baseLineEndDate.getTime()&&(r=baseLineEndDate)):r=baseLineStartDate&&u.renderBaseline&&f.getTime()>=baseLineStartDate.getTime()?baseLineStartDate:baseLineEndDate&&u.renderBaseline&&f.getTime()>=baseLineEndDate.getTime()?baseLineEndDate:f;i?(i.getTime()<=e.getTime()&&(i=e),baseLineEndDate&&u.renderBaseline&&i.getTime()<=baseLineEndDate.getTime()?i=baseLineEndDate:baseLineStartDate&&u.renderBaseline&&i.getTime()<=baseLineStartDate.getTime()&&(i=baseLineStartDate)):(baseLineEndDate&&u.renderBaseline&&e.getTime()<=baseLineEndDate.getTime()&&(i=baseLineEndDate),i=baseLineStartDate&&u.renderBaseline&&e.getTime()<=baseLineStartDate.getTime()?baseLineStartDate:e)}),h=o._updateScheduleDatesByTaskLables(r,i),r=h.minStartDate,i=h.maxEndDate):u.scheduleEndDate&&u.scheduleStartDate||s.length!==0||(r=o._getDateFromFormat(new Date),i=o._getDateFromFormat(new Date(r)),i.setDate(i.getDate()+20));t?(t.minStartDate=r,t.maxEndDate=i):(u.scheduleStartDate=r?o.getFormatedDate(r):u.scheduleStartDate,u.scheduleEndDate=i?o.getFormatedDate(i):u.scheduleEndDate)},_updateScheduleDatesByTaskLables:function(n,t){var f=this,e=this.model,s=e.scheduleHeaderSettings.scheduleHeaderType,h=r.Gantt.ScheduleHeaderType,i=f._getResourceStringWidth(),o,u={},c=e.scheduleEndDate&&this._getDateFromFormat(e.scheduleEndDate);return s==h.Week&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perDayWidth+7:7,t.setDate(t.getDate()+o))),s==h.Year&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perMonthWidth+1:1,t.setMonth(t.getMonth()+o))),s==h.Month&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perDayWidth+7:7,t.setDate(t.getDate()+o))),s==h.Day&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perHourWidth+7:7,t.setHours(t.getHours()+o))),s==h.Hour&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(numOfHours=i>0?i/f._perMinuteWidth+5:5,t.setHours(t.getHours()+numOfHours),n.setHours(n.getHours()-1))),u=f._updateScheduleDatesByStripLines(n,t),n=u.startDate,t=u.endDate,u=f._updateScheduleDatesByHolidays(n,t),n=u.startDate,t=u.endDate,u.minStartDate=n,u.maxEndDate=t,u},_updateScheduleDatesByHolidays:function(t,i){var u=this,f=this.model,r={};return u._holidaysList.length>0&&n.each(u._holidaysList,function(n,r){r.getTime()>t.getTime()&&r.getTime()<i.getTime()||(r.getTime()<t.getTime()?t=new Date(r):i=new Date(r))}),r.startDate=t,r.endDate=i,r},_updateScheduleDatesByStripLines:function(t,i){var f=this,u=this.model,r={};return u.stripLines.length>0&&n.each(u.stripLines,function(n,r){var u=f._getDateFromFormat(r.day);u.getTime()>t.getTime()&&u.getTime()<i.getTime()||(u.getTime()<t.getTime()?t=new Date(u):i=new Date(u))}),r.startDate=t,r.endDate=i,r},_getResourceStringWidth:function(){var s=this,u=this.model,f=u.resources,e="",o,i,t;if(f.length>0&&u.showResourceNames){for(i=0;i<f.length;i++)e+=f[i][u.resourceNameMapping]+" ,";return t=r.buildTag("span","",{"font-family":"Segoe UI","font-size":"12px"},{}),t.text(e),n(document.body).append(t),o=t.width(),t.remove(),o}return 0},_calculateHeaderDates:function(){var n=this,e=this.model,t=n._getDateFromFormat(e.scheduleStartDate),i=n._getDateFromFormat(e.scheduleEndDate),u=e.scheduleHeaderSettings.scheduleHeaderType,f=r.Gantt.ScheduleHeaderType;u==f.Week&&n._calculateWeekSplit(t,i);u==f.Year&&n._calculateYearSplit(t,i);u==f.Month&&n._calculateMonthSplit(t,i);u==f.Day&&n._calculateDaySplit(t,i);u==f.Hour&&n._calculateHourSplit(t,i)},_addNestedGanttRecords:function(n){var t=this,o=t.model.ids,s=t.model,h=s.flatRecords,u=0,c=n.length,f=[],r,a=s.enableAltRow;for(u;u<c;u++)if(r=n[u],t._storedIndex++,r.isAltRow=t._storedIndex%2==0?!1:!0,r.index=t._storedIndex,o[t._storedIndex]=r.taskId.toString(),h.push(r),f=r.childRecords,f){var e=0,l=f.length,i=null;for(e;e<l;e++)i=f[e],t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,o[t._storedIndex]=i.taskId.toString(),h.push(i),i.childRecords&&t._addNestedGanttRecords(i.childRecords)}},_createGanttRecord:function(n,t,i,f,e){var h=this,o,s=h.model,y=h._columns,tt=y.length,l=n[s.childMapping],b=r.isNullOrUndefined(n[s.durationMapping])?null:n[s.durationMapping],it=n[s.progressMapping]?isNaN(parseFloat(n[s.progressMapping]))?0:parseFloat(n[s.progressMapping]):0,a=h._getDateFromFormat(n[s.startDateMapping]),c=h._getDateFromFormat(n[s.endDateMapping]),k=r.isNullOrUndefined(n[s.workMapping])?null:n[s.workMapping],ft=n[s.resourceInfoMapping],p=n[s.predecessorMapping],d=n[s.notesMapping],et=h._getDateFromFormat(n[s.baselineStartDateMapping]),w=h._getDateFromFormat(n[s.baselineEndDateMapping]),ot=n.WBS?n.WBS:null,st=s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Auto?!0:s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Manual?!1:s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom?n[s.taskSchedulingModeMapping]==!0?!1:!0:s.taskSchedulingMode,g=s.durationUnitMapping&&n[s.durationUnitMapping]?h._validateDurationUnitMapping(n[s.durationUnitMapping]):null,rt=s.milestoneMapping&&n[s.milestoneMapping],ht=a?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes()).getTime():null,ct=c?new Date(c.getFullYear(),c.getMonth(),c.getDate(),c.getHours(),c.getMinutes()).getTime():null,ut,nt,v;if(o=new r.Gantt.GanttRecord,o.taskId=n[s.taskIdMapping],o.taskName=n[s.taskNameMapping],h._addItemValue(o,n,e),o.isAutoSchedule=st,o.startDate=this._checkStartDate(a,o),ut=h._isinAddnewRecord?h._newRecordResourceCollection:s.resources,o.resourceInfo=ft&&o._setResourceInfo(n[s.resourceInfoMapping],s.resourceIdMapping,s.resourceNameMapping,s.resourceUnitMapping,ut),h._updateResourceName(o),!r.isNullOrUndefined(rt)&&rt?(o.duration=0,o.durationUnit=g,o.isMilestone=!0,o.endDate=new Date(o.startDate)):s.workMapping?(o.durationUnit=s.durationUnit,isNaN(k)||r.isNullOrUndefined(k)?(o.work=0,o.duration=0,o.isMilestone=!0,o.endDate=new Date(o.startDate)):(o.work=k,o._updateDurationWithWork(h),o.duration==0?(o.isMilestone=!0,o.endDate=new Date(o.startDate)):o.endDate=this._getEndDate(o.startDate,o.duration,o.durationUnit,o)),r.isNullOrUndefined(n[s.durationMapping])||(n[s.durationMapping]=o.duration),r.isNullOrUndefined(n[s.durationMapping])||(n[s.endDateMapping]=o.endDate)):r.isNullOrUndefined(b)?c?(c.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,c),o.endDate=this._checkEndDate(c,o),o.startDate.getTime()>=o.endDate.getTime()?(o.endDate=new Date(o.startDate),o.isMilestone=!0,o.duration=0):o.duration=this._getDuration(o.startDate,o.endDate,s.durationUnit,o.isAutoSchedule),o.durationUnit=s.durationUnit):!c&&r.isNullOrUndefined(b)&&(o.isMilestone=!0,o.duration=0,o.endDate=new Date(o.startDate)):(nt=this._getDurationValues(b),o.duration=nt.duration,o.durationUnit=g?g:nt.durationUnit,o.duration==0?(o.isMilestone=!0,o.endDate=new Date(o.startDate)):o.endDate=this._getEndDate(o.startDate,o.duration,o.durationUnit,o)),o.baselineStartDate=this._checkBaseLineStartDate(et),w&&w.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,w),o.baselineEndDate=this._checkBaseLineEndDate(w),o.WBS=ot,o.notes=d,o.notesText=d?h._getPlainText(d):"",tt)for(v=0;v<tt;v++)o[y[v].field]==u&&(o[y[v].field]=n[y[v].mappingName]);return o.status=it,o.predecessor=p&&o._calculatePredecessor(p,this._durationUnitEditText,s.durationUnit),o.predecessorsName=p,o.parentItem=i,o.level=t,e||(o.width=o._calculateWidth(this),o.left=o._calculateLeft(this),o.progressWidth=o._calculateProgressWidth(o.width,it),o.baselineStartDate&&o.baselineEndDate&&(o.baselineLeft=o._calculateBaselineLeft(this),o.baselineRight=o._calculateBaselineRight(this),o.baselineWidth=o._calculateBaseLineWidth(this))),h._updateItemValueInRecord(o),o.childRecords=l&&l.length>0&&h._createChildRecords(l,t+1,o),o.hasChildRecords=l&&l.length>0?!0:!1,o.isMilestone=o.hasChildRecords?!1:o.isMilestone,s.expandStateMapping&&o.hasChildRecords&&(r.isNullOrUndefined(n[s.expandStateMapping])?r.isNullOrUndefined(n[s.expandStateMapping])&&!s.enableCollapseAll?o[s.expandStateMapping]=o.item[s.expandStateMapping]=n[s.expandStateMapping]=!0:r.isNullOrUndefined(n[s.expandStateMapping])&&s.enableCollapseAll&&(o[s.expandStateMapping]=o.item[s.expandStateMapping]=n[s.expandStateMapping]=!1):o[s.expandStateMapping]=o.item[s.expandStateMapping]=n[s.expandStateMapping]),o.expanded=f!==u?f:l?l.length>0:!1,s.enableVirtualization===!1&&(o.isExpanded=!0),o.hasChildRecords&&(o.manualStartDate=o.startDate,o.manualEndDate=o.endDate,o.manualDuration=o.duration),o.taskType=n.taskType?n.taskType:s.taskType,o.effortDriven=n.effortDriven?n.effortDriven:o.taskType!="fixedWork"?"false":"true",s.workMapping||o._updateWorkWithDuration(h),p&&h._predecessorsCollection.push(o),o},_validateDurationUnitMapping:function(n){var t=n;return this._durationUnitEditText.minute.indexOf(t)!=-1?t=r.Gantt.DurationUnit.Minute:this._durationUnitEditText.hour.indexOf(t)!=-1?t=r.Gantt.DurationUnit.Hour:this._durationUnitEditText.day.indexOf(t)!=-1&&(t=r.Gantt.DurationUnit.Day),t==r.Gantt.DurationUnit.Day||t==r.Gantt.DurationUnit.Hour||t==r.Gantt.DurationUnit.Minute?t:this.model.durationUnit},_updateItemValueInRecord:function(n){var t=this.model,i;n.item&&(i=n.item,t.startDateMapping&&(i[t.startDateMapping]=n.startDate),t.endDateMapping&&(i[t.endDateMapping]=n.endDate),t.durationMapping&&(i[t.durationMapping]=n.duration),t.durationUnitMapping&&(i[t.durationUnitMapping]=n.durationUnit),t.workMapping&&(i[t.workMapping]=n.work),t.taskSchedulingModeMapping&&(i[t.taskSchedulingModeMapping]=!n.isAutoSchedule))},_addItemValue:function(n,t,i){var f=this,e=this.model,o,u;e.parentTaskIdMapping&&i?(o=t[e.taskIdMapping],u=f._taskIds.indexOf(o),n.item=u>-1?f._retrivedData[u]:[]):this.dataSource()instanceof r.DataManager&&this.dataSource().dataSource.json&&this.dataSource().dataSource.offline&&i?e.parentTaskIdMapping?(o=t[e.taskIdMapping],u=f._taskIds.indexOf(o),n.item=u>-1?f._retrivedData[u]:[]):n.item=t:n.item=t},_getPlainText:function(n){var t=document.createElement("DIV");return t.innerHTML=n,t.textContent||t.innerText||""},_updateResourceName:function(n){var f=this,i=n.resourceInfo,r=[],u,t;if(i){for(u=i.length,n.item?n.item[this.model.resourceInfoMapping]=[]:null,t=0;t<u;t++)r.push(i[t][this.model.resourceNameMapping]),n.item&&n.item[this.model.resourceInfoMapping].push(i[t][this.model.resourceIdMapping]);n.resourceNames=r.join(",")}},_updateResourceRelatedFields:function(n){var t=this,u=t.model,e=n.taskType,i=n.isAutoSchedule,f=n.effortDriven==="true";if(!r.isNullOrUndefined(n.resourceInfo))if(n.work>0||t._updatedColumn=="work")switch(e){case"fixedUnit":i&&n.resourceInfo.length&&(t._updatedColumn=="work"||f&&t._updatedColumn=="resourceInfo")?n._updateDurationWithWork(t):i||t._updatedColumn!="work"?n._updateWorkWithDuration(t):n._updateUnitWithWork(t);break;case"fixedWork":if(n.resourceInfo.length==0)return;i?t._updatedColumn=="duration"||t._updatedColumn=="endDate"?(n._updateUnitWithWork(t),n.duration==0&&(n.work=0,u.workMapping&&(n.item[u.workMapping]=0))):n._updateDurationWithWork(t):t._updatedColumn=="work"?n._updateUnitWithWork(t):n._updateWorkWithDuration(t);break;case"fixedDuration":n.resourceInfo.length&&(t._updatedColumn=="work"||i&&f&&t._updatedColumn=="resourceInfo")?n._updateUnitWithWork(t):n._updateWorkWithDuration(t)}else n._updateWorkWithDuration(t)},_updateResourceDataSource:function(t){for(var o,f,i,s,e=this,r=[],h=t.resourceInfo?t.resourceInfo.length:0,u=0;u<h;u++)r.push({name:t.resourceInfo[u][e.model.resourceIdMapping],unit:t.resourceInfo[u][e.model.resourceUnitMapping]});for(o="#treegrid"+e._id+"resourceEdit",f=n(o).data("ejTreeGrid").model.dataSource,i=0;i<f.length;i++)s=r.filter(function(n){return n.name===parseInt(f[i].name)}),s&&s.length==0&&r.push(f[i]);n(o).ejTreeGrid("option","dataSource",r)},_getHoliday:function(){var n;if(this.model.holidays!=null){var t=this.model.holidays,i=[],r=t.length;if(r>0){for(n=0;n<r;n++)i[n]=this._getDateFromFormat(t[n].day);return i}}return!1},_getStringHolidays:function(){var n;if(this._holidaysList!=null&&this._holidaysList.length>0){var t=this._holidaysList,i=[],u=t.length;if(u>0){for(n=0;n<u;n++)i[n]=r.format(t[n],this.model.dateFormat,this.model.locale);return i}}return[]},_createChildRecords:function(n,t,i){for(var f=[],s=this,r=0,h=n.length,e,o,r=0;r<h;r++)model.enableWBS&&(e=i.WBS,n[r].WBS=e+"."+(r+1)),n[r]&&(o=s._createGanttRecord(n[r],t,i,u,"Load"),f.push(o));return f},_createResourceInfoCollection:function(n){var i=this,t=0,r=n.length;for(t;t<r;t++)i._resourceInfoCollection.push(i._createResourceInfo(n[t]))},_createResourceInfo:function(n){var i=this.model,t={};return t.resourceId=n[i.resourceIdMapping],t.resourceName=n[i.resourceNameMapping],t},_calculateWeekSplit:function(n,t){var i=this,u=i.model,f=u.scheduleHeaderSettings.weekStartDay,e,r,o;e=u.scheduleHeaderSettings.timescaleStartDateMode=="month"?new Date(n.getFullYear(),n.getMonth(),1):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?new Date(n.getFullYear(),0,1):n;n=e;r=f>=0&&f<7?f:0;o=n.getDay()<=r?n.getDate()-(7-r+n.getDay()):n.getDate()-n.getDay()+r;n.setDate(o);n.setHours(0,0,0,0);do i._scheduleWeeks.push(new Date(n)),n.setDate(n.getDate()+7);while(!(n>t));i._projectStartDate=new Date(i._scheduleWeeks[0]);i._projectEndDate=new Date(i._scheduleWeeks[i._scheduleWeeks.length-1])},_calculateYearSplit:function(n,t){var i=this,r=i.model,u,f,e,o;if(r.scheduleHeaderSettings.timescaleStartDateMode=="month"){u=new Date(n.getFullYear(),n.getMonth(),1);n=u;do i._scheduleYears.push(new Date(n)),n=new Date(n.getFullYear()+1,0,1);while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0].getFullYear(),i._scheduleYears[0].getMonth(),1);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}else if(r.scheduleHeaderSettings.timescaleStartDateMode=="week"){f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay();n.setDate(f);do i._scheduleYears.push(new Date(n)),n=n.getDate()==29&&n.getMonth()==0&&n.getFullYear()%4!=0?new Date(n.getFullYear()+1,n.getMonth(),n.getDate()-1):new Date(n.getFullYear()+1,n.getMonth(),n.getDate());while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0]);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}else{n.setMonth(0);n.setDate(1);n.setHours(0,0,0,0);do i._scheduleYears.push(new Date(n)),n.setMonth(n.getMonth()+12);while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0].getFullYear(),i._scheduleYears[0].getMonth(),1);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}},_calculateDaySplit:function(n,t){var i=this,u=i.model,f,r;u.scheduleHeaderSettings.timescaleStartDateMode=="week"?(f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay(),n.setDate(f)):u.scheduleHeaderSettings.timescaleStartDateMode=="month"?(r=new Date(n.getFullYear(),n.getMonth(),1),n=r):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?(r=new Date(n.getFullYear(),0,1),n=r):n.setHours(0,0,0,0);do i._scheduleDays.push(new Date(n)),n.setDate(n.getDate()+1);while(n<=t);i._projectStartDate=new Date(i._scheduleDays[0]);i._projectEndDate=new Date(i._scheduleDays[i._scheduleDays.length-1])},_calculateHourSplit:function(n,t){var i=this,u=i.model,f,r;u.scheduleHeaderSettings.timescaleStartDateMode=="week"?(f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay(),n.setDate(f)):u.scheduleHeaderSettings.timescaleStartDateMode=="month"?(r=new Date(n.getFullYear(),n.getMonth(),1),n=r):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?(r=new Date(n.getFullYear(),0,1),n=r):n.setMinutes(0);do i._scheduleHours.push(new Date(n)),n.setHours(n.getHours()+1);while(n<=t);i._projectStartDate=new Date(i._scheduleHours[0]);i._projectEndDate=new Date(i._scheduleHours[i._scheduleHours.length-1])},_calculateMonthSplit:function(n,t){var i=this,f=i.model,e,u,o,r;if(f.scheduleHeaderSettings.timescaleStartDateMode=="week"){e=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay();n.setDate(e);do i._scheduleMonths.push(new Date(n)),n=n.getDate()==29&&n.getMonth()==0&&n.getFullYear()%4!=0?new Date(n.getFullYear(),n.getMonth()+1,n.getDate()-1):new Date(n.getFullYear(),n.getMonth()+1,n.getDate());while(!(n>=t))}else if(f.scheduleHeaderSettings.timescaleStartDateMode=="year"){u=new Date(n.getFullYear(),0,1);n=u;do i._scheduleMonths.push(new Date(n)),n.getMonth()==0||n.getMonth()==2||n.getMonth()==4||n.getMonth()==6||n.getMonth()==7||n.getMonth()==9||n.getMonth()==11?n.setDate(n.getDate()+31):n.getMonth()==3||n.getMonth()==5||n.getMonth()==8||n.getMonth()==10?n.setDate(n.getDate()+30):n.getMonth()==1&&(n.getFullYear()%4==0?n.setDate(n.getDate()+29):n.setDate(n.getDate()+28));while(!(n>=t))}else{u=new Date(n.getFullYear(),n.getMonth(),1);n=u;do i._scheduleMonths.push(new Date(n)),n.getMonth()==0||n.getMonth()==2||n.getMonth()==4||n.getMonth()==6||n.getMonth()==7||n.getMonth()==9||n.getMonth()==11?n.setDate(n.getDate()+31):n.getMonth()==3||n.getMonth()==5||n.getMonth()==8||n.getMonth()==10?n.setDate(n.getDate()+30):n.getMonth()==1&&(n.getFullYear()%4==0?n.setDate(n.getDate()+29):n.setDate(n.getDate()+28));while(!(n>=t))}o=new Date(i._scheduleMonths[0]);r=new Date(i._scheduleMonths[i._scheduleMonths.length-1]);r=new Date(r.getFullYear(),r.getMonth()+1,0);i._projectStartDate=o;i._projectEndDate=r},_updatePredecessors:function(){var u=this,i=0,f=u._predecessorsCollection,h=f.length,e,o,r=0,n,s,t;for(i;i<h;i++)for(e=f[i],o=e.predecessor,s=o.length,r=0;r<s;r++)t=o[r],n=u.model.flatRecords[u.model.ids.indexOf(t.from)],t.from!==e.taskId.toString()&&n&&(n.predecessor?n.predecessor.push(t):(n.predecessor=[],n.predecessor.push(t),f.push(n)))},getDateType:function(n){if(n!=null){if(typeof n=="object")return n;var t=new RegExp("\\-","g"),i=new RegExp("\\.","g");return n=n.replace(t,"/"),n=n.replace(i,"/"),new Date(n)}return null},getFormatedDate:function(n){return r.format(n,this.model.dateFormat,this.model.locale)},_getProgressWidth:function(n,t){return n*t/100},_wireEvents:function(){var t=this,u=t.model,i=n("#ejTreeGrid"+t._id),r=n("#ejGanttChart"+t._id),f=t._$ejGantt;t._on(t.element,"click",t.clickHandler);t._on(t.element,"click",".e-ejinputtext",t._searchTextFocusIn);t._on(t.element,"focusout",".e-ejinputtext",t._searchTextFocusOut);u.enableContextMenu&&(t._on(t.element,"contextmenu",t._rightClick),t._on(t.element,"keyup",this._preventContextMenu));u.enableResize&&u.isResponsive&&t._on(n(window),"resize",t.windowResize);i.ejTreeGrid({rowSelecting:n.proxy(t.rowSelecting,t)});i.ejTreeGrid({rowSelected:n.proxy(t.rowSelected,t)});i.ejTreeGrid({cellSelecting:n.proxy(t.cellSelecting,t)});i.ejTreeGrid({cellSelected:n.proxy(t.cellSelected,t)});i.ejTreeGrid({rowDrag:n.proxy(t.rowDrag,t)});i.ejTreeGrid({rowDragStart:n.proxy(t.rowDragStart,t)});i.ejTreeGrid({rowDragStop:n.proxy(t.rowDragStop,t)});i.ejTreeGrid({actionBegin:n.proxy(t.actionBegin,t)});i.ejTreeGrid({actionComplete:n.proxy(t.actionComplete,t)});i.ejTreeGrid({expandAllCollapseAllRequest:n.proxy(t.expandAllCollapseAllRequest,t)});i.ejTreeGrid({contextMenuAction:n.proxy(t.contextMenuAction,t)});i.ejTreeGrid({subContextMenuAction:n.proxy(t.subContextMenuAction,t)});i.ejTreeGrid({setInitialData:n.proxy(t.setInitialData,t)});u.queryCellInfo&&i.ejTreeGrid({queryCellInfo:n.proxy(t._queryCellInfo,t)});u.rowDataBound&&i.ejTreeGrid({rowDataBound:n.proxy(t._rowDataBound,t)});i.ejTreeGrid({beginEdit:n.proxy(t._beginEdit,t)});i.ejTreeGrid({endEdit:n.proxy(t._endEdit,t)});i.ejTreeGrid({expanding:n.proxy(t.expanding,t)});i.ejTreeGrid({collapsing:n.proxy(t.collapsing,t)});i.ejTreeGrid({expanded:n.proxy(t.expanded,t)});i.ejTreeGrid({collapsed:n.proxy(t.collapsed,t)});i.ejTreeGrid({refreshRow:n.proxy(t.refreshRow,t)});i.ejTreeGrid({cancelEditCell:n.proxy(t.cancelEditCell,t)});r.ejGanttChart({rowSelecting:n.proxy(t.rowSelecting,t)});r.ejGanttChart({rowSelected:n.proxy(t.rowSelected,t)});r.ejGanttChart({rowHover:n.proxy(t._ganttChartRowHover,t)});r.ejGanttChart({actionBegin:n.proxy(t.actionBegin,t)});r.ejGanttChart({actionComplete:n.proxy(t.chartactionComplete,t)});r.ejGanttChart({refreshRow:n.proxy(t.refreshRowData,t)});r.ejGanttChart({zooming:n.proxy(t.zoomingChart,t)});r.ejGanttChart({queryTaskbarInfo:n.proxy(t.queryTaskbarInfo,t)});r.ejGanttChart({expanding:n.proxy(t.expanding,t)});r.ejGanttChart({collapsing:n.proxy(t.collapsing,t)});r.ejGanttChart({expanded:n.proxy(t.expanded,t)});r.ejGanttChart({collapsed:n.proxy(t.collapsed,t)});r.ejGanttChart({expandAllCollapseAllRequest:n.proxy(t.expandAllCollapseAllRequest,t)});r.ejGanttChart({taskbarEditing:n.proxy(t.taskbarEditing,t)});r.ejGanttChart({taskbarEdited:n.proxy(t.taskbarEdited,t)});r.ejGanttChart({calculateEndDate:n.proxy(t.calculateEndDate,t)});r.ejGanttChart({calculateDuration:n.proxy(t.calculateDuration,t)});r.ejGanttChart({clearColumnMenu:n.proxy(t.clearColumnMenu,t)});r.ejGanttChart({deleteRow:n.proxy(t.deleteRow,t)});r.ejGanttChart({cancelEditCell:n.proxy(t.cancelEditCell,t)});f.ejSplitter({allowResizing:n.proxy(t._onResize,t)});t._on(t.element,"mousedown",t._mousedownhandler);t._enableEditingEvents()},_preventContextMenu:function(n){if(n.keyCode==93)return n.preventDefault(),n.stopPropagation(),!1},_onResize:function(t){var i=this,r=!1,u=i.splitterPosition();i._isinBeginEdit&&n("#ejTreeGrid"+i._id+"EditForm").length>0&&(i._$treegridHelper.ejTreeGrid("cancelEditCell"),i._isinBeginEdit=!1);r=u.indexOf("%")!=-1?!0:!1;r?i.splitterPosition(Math.round(t.prevPane.size/i._ganttWidth*100)+"%"):i.splitterPosition(Math.round(t.prevPane.size).toString());i._splitterPosition(i.splitterPosition());i._$treegridHelper.ejTreeGrid("refreshScroller",t.prevPane.size);i._$ganttchartHelper.ejGanttChart("refreshScroller",t.nextPane.size-1)},_searchTextFocusOut:function(t){var r=this,u=this._toolboxTooltipTexts.searchTool,i=n(t.target);n(i).closest("li")&&n(i).closest("li").attr("id")==r._id+"_search"&&n(i).attr("placeholder",u)},_searchTextFocusIn:function(t){var u=this,i=n(t.target),r=n(i).attr("placeholder");i.hasClass("e-ejinputtext")&&r&&i.removeAttr("placeholder")},clickHandler:function(t){var r=this,i=n(t.target);(r._clearContextMenu(),i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vhandlespace")||i.hasClass("e-vdown"))||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hup")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||(r._isinBeginEdit&&document.getElementById(r._id).contains(i[0])&&(i.closest("td").hasClass("e-editedcell")||i.hasClass("e-date")||i.hasClass("e-arrow")||i.hasClass("e-down-arrow")||i.closest("form#ejTreeGrid"+r._id+"EditForm").length!=0||!(n("#ejTreeGrid"+r._id+"EditForm").length>0)||(r._$treegridHelper.ejTreeGrid("saveCell"),r._isinBeginEdit=!1)),r.clearColumnMenu())},windowResize:function(){var nt,tt,it,rt,ut,v,ft,b,e,h,y;if(this.element.is(":visible")){var t=this,p="#e-ejSpliter"+this._id,l="#"+this._id+"_toolbarItems",k="#ejGanttChart"+this._id,et="#ejTreeGrid"+this._id,o=".e-ganttviewerbodyContianer",w=".e-ganttviewerheaderContainer",ot="#ejTreeGrid"+this._id,c="#ejTreeGrid"+this._id+"e-gridcontent",s=t.model.sizeSettings.width,a=t.model.sizeSettings.height,d=t.element[0].style.height,g=t.element[0].style.width,i,u,f;s&&typeof s!="number"&&s.indexOf("%")!=-1||g.indexOf("%")!=-1?(v=s?s:g,nt=n(t.element).parent().width()?n(t.element).parent().width():n(t.element).width(),i=nt/100*parseInt(v)):i=n(t.element).width();t.splitterPosition().indexOf("%")==-1?(tt=parseInt(t.splitterPosition())+7+2,t._ganttWidth=i=Math.max(i,tt)):t._ganttWidth=i;a&&typeof s!="number"&&a.indexOf("%")!=-1||d.indexOf("%")!=-1?(it=a?a:d,rt=n(t.element).parent().height()?n(t.element).parent().height():n(t.element).height(),ut=n(t.element).parent().height()?rt/100*parseInt(it):n(t.element).height(),u=ut):u=n(t.element).height();u=u-t._totalBorderHeight;i=Math.round(i);h=n(l).length?n(l).height():0;n(p).css("width",i);n(p).css("height",u-h);n(p).ejSplitter("refresh");n(l).length&&n(l).css("width",i);v=n(k).width();ft=n(et).width();n(k).height(u-h);b=n(o).ejScroller("option","scrollTop");e=n(o).ejScroller("option","scrollLeft");n(o).ejScroller({width:v,height:u-h-n(w).height()-parseInt(n(w).css("border-bottom-width"))});n(o).ejScroller("refresh");f=t._$ganttchartHelper.ejGanttChart("getMaxScrollWidth");e>f&&(e=f>0?f:0);n(o).ejScroller("option","scrollTop",b);n(o).ejScroller("option","scrollLeft",e);n(ot).height(u-h);n(c).height(u-h-n(w).height()-t._totalBorderHeight);e=n(c).ejScroller("option","scrollLeft");n(c).width(ft);n(c).ejScroller("refresh");f=t._$treegridHelper.ejTreeGrid("getMaxScrollWidth");e>f&&(e=f>0?f:0);n(c).ejScroller("option","scrollLeft",e);t._$treegridHelper.ejTreeGrid("updateViewPortHeight");t._$ganttchartHelper.ejGanttChart("updateViewPortHeight");t.model.enableVirtualization&&(t._$treegridHelper.ejTreeGrid("cancelRowEditCell"),y={},y.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("processBindings",y),t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",y),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords),t._$ganttchartHelper.ejGanttChart("onScrollHelper",b));t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._updateRowHeightInConnectorLine(t._connectorLinesCollection);t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection);t.setSplitterPosition(t.splitterPosition())}},_updateRowHeightInConnectorLine:function(t){var u,i,r;if(t&&t.length&&(u=n("#ejGanttChart"+this._id).ejGanttChart("instance"),i=n("#"+u._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height,i&&!isNaN(i)))for(r=0;r<t.length;r++)t[r].RowHeight=i},setScrollTop:function(n){var t=this,i=t._$treegridHelper.ejTreeGrid("getMaxScrollHeight");t._isinBeginEdit&&t._$treegridHelper.ejTreeGrid("saveCell");(typeof n=="number"||typeof parseInt(n)=="number")&&(n=parseInt(n),n>=0&&(i>=n?t._$ganttchartHelper.ejGanttChart("onScrollHelper",n):t._$ganttchartHelper.ejGanttChart("onScrollHelper",i)))},_rightClick:function(t){t.preventDefault();var i=this,e=i.model,o=n(t.target),h=o.closest("tr"),s,c,r,u,l,f={};i._$treegridHelper.ejTreeGrid("disableTooltip");i.clearColumnMenu();n(h).hasClass("e-chartcell")||n(h).hasClass("e-ganttrowcell")?(s=i._$ganttchartHelper.ejGanttChart("getGanttChartRows"),f.target="ejTreeGrid"):(s=n(i._$treegridHelper.ejTreeGrid("getRows")),f.target="ejGanttChart");c=o.closest("tr");r=s.index(c);i.model.currentViewData=i.getCurrentViewData();u=i.model.currentViewData[r];r=i.model.updatedRecords.indexOf(u);f.data=u;f.recordIndex=r;u&&i.model.enableContextMenu?(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._updateIndentOutdentContextmenuOption(u),i._clearContextMenu(),i._contextMenuItems.length>0&&(i.model.readOnly!=!0&&i.model.editSettings.allowAdding||(i._removeContextMenuItem("Below"),i._removeContextMenuItem("Above")),i._renderContextMenu(t,r,u)),e.selectionMode=="row"&&(r!=i.model.selectedRowIndex&&i.rowSelected(f),i._$treegridHelper.ejTreeGrid("selectRows",r),i._$ganttchartHelper.ejGanttChart("selectRows",r),i.updateIndentOutdentOption(f.data)),e.selectionMode=="cell"&&(i._rowIndexOfLastSelectedCell=r,l=i._$treegridHelper.ejTreeGrid("getCellIndex",t),n(o.closest("td")).hasClass("e-chartcell")||i.selectCells([{rowIndex:r,cellIndex:l}])),e.editSettings.beginEditAction=="click"&&n("#ejTreeGrid"+i._id+"EditForm").length>0&&(i._$treegridHelper.ejTreeGrid("saveCell"),i._isinBeginEdit=!1)):i.model.flatRecords.length===0&&i.model.enableContextMenu&&(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._contextMenuItems.splice(5,2),i._updateIndentOutdentContextmenuOption(u),i._clearContextMenu(),i._contextMenuItems.length>0&&i._renderContextMenu(t,r,u))},_mousedownhandler:function(t){var i=n(t.target),r=this;r._clearContextMenu();(i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vdown")||i.hasClass("e-vhandlespace")||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||i.hasClass("e-splitbar"))&&r.clearColumnMenu()},_removeContextMenuItem:function(n){var u=this,r,t=u._contextMenuItems,i;i=t.filter(function(t){if(t.menuId===n)return!0});i.length>0&&(r=t.indexOf(i[0]),t.splice(r,1))},_updateIndentOutdentContextmenuOption:function(n){var t=this,i=t.model,u=this.model.flatRecords,r=u.indexOf(n),f;t.model.readOnly==!0?(t._removeContextMenuItem("Add"),t._removeContextMenuItem("Task"),t._removeContextMenuItem("Delete"),t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")):(r===0?(t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")):r>0?n.level===0?t._removeContextMenuItem("Outdent"):(f=u[r-1],n.level-f.level==1&&t._removeContextMenuItem("Indent")):r<0&&(t._removeContextMenuItem("Task"),t._removeContextMenuItem("Delete"),t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")),i.editSettings.allowAdding||t._removeContextMenuItem("Add"),i.editSettings.allowDeleting||t._removeContextMenuItem("Delete"),i.editSettings.allowEditing||t._removeContextMenuItem("Task"),i.editSettings.allowIndent||(t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")))},queryTaskbarInfo:function(n){this._trigger("queryTaskbarInfo",n)},zoomingChart:function(n){var t=this;t.reRenderChart(n.delta)},refreshRowData:function(n){var t=this,i=t._$treegridHelper.ejTreeGrid("instance");r.TreeGrid.refreshRow(i,n.index)},expanding:function(n){var t=this;if(!t._trigger("expanding",n)){if(t.model.enableVirtualization)r.TreeGrid.sendExpandCollapseRequest(t,n);else{if(t._isInExpandCollapse=!0,t._isRefreshAddedRecord){n.data.expanded=!0;t._$treegridHelper.ejTreeGrid("updateExpandStatus",n.data,!0);t._refreshChartAndGridRows();t._isRefreshAddedRecord=!1;return}r.TreeGrid.sendExpandCollapseRequest(t,n);t._isInExpandCollapse=!1}t.updateSelectedItemIndex()}},collapsing:function(t){var i=this,o=this.model,u=n("#"+i._id+"_toolbarItems"),f,e;if(!i._trigger("collapsing",t)){if(i.model.enableVirtualization)r.TreeGrid.sendExpandCollapseRequest(i,t);else{if(i._isInExpandCollapse=!0,i._isRefreshAddedRecord){t.data.expanded=!1;i._$treegridHelper.ejTreeGrid("updateExpandStatus",t.data,!1);i._refreshChartAndGridRows();i._isRefreshAddedRecord=!1;return}i._gridRows=i.getRows();r.TreeGrid.sendExpandCollapseRequest(i,t);i._isInExpandCollapse=!1}f=i.selectedItem();f&&(e=i.getExpandStatus(f),e||t.expanded?i.updateSelectedItemIndex():(i._deSelectRowItem(),o.toolbarSettings.showToolbar&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&(n(u).ejToolbar("disableItem",n(u).find(".e-deleteitem").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-indent").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-outdent").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-edititem").parent()[0]))))}},refreshRow:function(n){var t=this;t._$ganttchartHelper.ejGanttChart("refreshRow",n.recordIndex)},_enableEditingEvents:function(){var t=this,i=t.model;t._off(n("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick);t._off(n("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick);(i.editSettings.allowEditing||i.editSettings.editMode=="dialogTemplate"||i.toolbarSettings.showToolbar&&(i.editSettings.allowAdding&&i.toolbarSettings.toolbarItems.indexOf("add")!==-1||i.editSettings.allowEditing&&i.toolbarSettings.toolbarItems.indexOf("index")!==-1))&&(t._on(n("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick),t._on(n("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick))},cancelEditCell:function(){var t=this;n("#ejTreeGrid"+t._id+"EditForm").length>0&&t._$treegridHelper.ejTreeGrid("cancelEditCell")},_keyPressed:function(){},_buttonClick:function(t){var e;if(t.type!="click"&&t.keyCode!==u&&t.keyCode!=13)return!0;var i=this,f=i.model;return f.editSettings.allowEditing||f.editSettings.editMode=="dialogTemplate"||f.toolbarSettings.showToolbar&&(f.editSettings.allowAdding&&f.toolbarSettings.toolbarItems.indexOf("add")!==-1||f.editSettings.allowEditing&&f.toolbarSettings.toolbarItems.indexOf("index")!==-1)?t.target.id=="EditDialog_"+i._id+"_Save"?i._sendSaveRequest("Edit")||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+i._id+"_Cancel"?(f.selectedItem.resourceInfo&&f.selectedItem._updateUnitWithWork(i),n("#"+i._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+i._id+"_Delete"?(e=f.allowSelection!=!1||r.isNullOrUndefined(i._contextMenuSelectedIndex)?i._$treegridHelper.ejTreeGrid("deleteRow"):i._$treegridHelper.ejTreeGrid("deleteRow",null,!0,i._contextMenuSelectedIndex),e==!0||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogEdit").ejDialog("close"))):t.target.id=="AddDialog_"+i._id+"_Save"?i._sendSaveRequest("Add")||this._duplicate||this._wrongenddate||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogAdd").ejDialog("close")):t.target.id=="AddDialog_"+i._id+"_Cancel"&&n("#"+i._id+"_dialogAdd").ejDialog("close"):i._sendCancelRequest(),!1},rowDrag:function(n){var t=this;t.model.selectedCellIndexes=[];t._trigger("rowDrag",n)},rowDragStart:function(n){var t=this;t._trigger("rowDragStart",n)},rowDragStop:function(n){var t=this;t._trigger("rowDragStop",n)},cellSelecting:function(n){var t=this,i=t.model;t._trigger("cellSelecting",n)},cellSelected:function(n){var t=this,i=t.model;t._trigger("cellSelected",n);i.selectedCellIndexes=t._$treegridHelper.ejTreeGrid("instance").model.selectedCellIndexes;t._rowIndexOfLastSelectedCell=i.selectedCellIndexes[0].rowIndex},rowSelecting:function(n){var i=this,t={},u=this.model;return i.model.rowSelecting&&u.selectionMode=="row"&&(t.recordIndex=n.recordIndex,t.previousIndex=n.previousIndex,t.previousData=u.updatedRecords[n.previousIndex],t.data=u.updatedRecords[n.recordIndex],t.previousChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",n.previousIndex),t.previousGridRow=r.TreeGrid.getRowByIndex(this,n.previousIndex),t.targetChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",n.recordIndex),t.targetGridRow=r.TreeGrid.getRowByIndex(this,n.recordIndex),i._trigger("rowSelecting",t))?!1:!0},rowSelected:function(t){var i=this,e=this.model,u=n("#"+i._id+"_toolbarItems"),h,o,s,f;e.allowSelection&&(t.target=="ejTreeGrid"&&i._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex),t.target=="ejGanttChart"&&i._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex));h=t.recordIndex;this.selectedItem(t.data);this.selectedRowIndex(h);i.model.toolbarSettings.showToolbar&&t.requestType!="rowDragAndDrop"&&(i.model.readOnly==!0?(o=[],o.push(n(u).find(".e-deleteitem").parent()[0]),o.push(n(u).find(".e-addnewitem").parent()[0]),o.push(n(u).find(".e-edititem").parent()[0]),n(u).ejToolbar("disableItem",o)):((i.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1||i.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1)&&i.model.allowSelection&&i.updateIndentOutdentOption(t.data),s=[],i.model.editSettings.allowDeleting&&i.model.allowSelection&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&s.push(n(u).find(".e-deleteitem").parent()[0]),i.model.editSettings.allowAdding&&i.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&s.push(n(u).find(".e-addnewitem").parent()[0]),i.model.editSettings.allowEditing&&i.model.allowSelection&&e.editSettings.beginEditAction!="click"&&i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&s.push(n(u).find(".e-edititem").parent()[0]),n(u).ejToolbar("enableItem",s)));f={};f.recordIndex=t.recordIndex;data=n.extend({},e.updatedRecords[t.recordIndex]);delete data.childRecords;delete data.parentItem;f.data=data;f.targetChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",t.recordIndex);f.targetGridRow=r.TreeGrid.getRowByIndex(this,t.recordIndex);e.allowSelection&&e.selectionMode=="row"&&i._trigger("rowSelected",f)},_treeGridRowHover:function(n){var t=this;n.reason=="mouseenter"?t._$ganttchartHelper.ejGanttChart("addRowHover",n.index):n.reason=="mouseleave"&&t._$ganttchartHelper.ejGanttChart("removeRowHover")},updateIndentOutdentOption:function(t){var r=this,e=r.model.flatRecords,o=e.indexOf(t),s,i=n("#"+r._id+"_toolbarItems"),u=n(i).find(".e-indent").parent()[0],f=n(i).find(".e-outdent").parent()[0];o===0||r.model.editSettings.allowIndent==!1||r.model.readOnly==!0?(u&&n(i).ejToolbar("disableItem",u),f&&n(i).ejToolbar("disableItem",f)):t.level===0&&r.model.editSettings.allowIndent==!0?(u&&n(i).ejToolbar("enableItem",u),f&&n(i).ejToolbar("disableItem",f)):(s=e[o-1],t.level-s.level==1&&r.model.editSettings.allowIndent==!0&&r.selectedRowIndex()!=-1?(f&&n(i).ejToolbar("enableItem",f),u&&n(i).ejToolbar("disableItem",u)):r.model.editSettings.allowIndent==!0&&r.selectedRowIndex()!=-1&&(u&&n(i).ejToolbar("enableItem",u),f&&n(i).ejToolbar("enableItem",f)))},_ganttChartRowHover:function(n){var t=this;n.reason=="mouseenter"?t._$treegridHelper.ejTreeGrid("addRowHover",n.index):n.reason=="mouseleave"&&t._$treegridHelper.ejTreeGrid("removeRowHover")},_removeChildRecordsPredecessor:function(n){var i=this,r,t;if(n.hasChildRecords)for(r=n.childRecords.length,t=0,t;t<r;t++)n.childRecords[t].predecessor&&i._removePredecessor(n.childRecords[t].predecessor,n.childRecords[t]),n.childRecords[t].hasChildRecords&&i._removeChildRecordsPredecessor(n.childRecords[t])},getExpandedRecordCount:function(n,t){var i,u=this,r;if(!n.hasChildRecords)return 0;for(r=0;r<n.childRecords.length;r++)i=n.childRecords[r],u.getExpandStatus(i)&&t++,i.hasChildRecords&&(t=u.getExpandedRecordCount(i,t));return t},_updateExpandStatus:function(){for(var i=this,t=this.model.flatRecords,r=t.length,u,n=0;n<r;n++)u=t[n].isExpanded,i.getExpandStatus(t[n])!==t[n].isExpanded&&(t[n].isExpanded=i.getExpandStatus(t[n]),t[n].isExpanded?i._totalCollapseRecordCount--:i._totalCollapseRecordCount++)},actionComplete:function(n){var t=this,i=t.model,o=-1,h,c,f,e,s;if(t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t._gridRows=t.getRows(),t._ganttChartRows=t.getGanttChartRows(),t._totalCollapseRecordCount=t._$treegridHelper.ejTreeGrid("getCollapsedRecordCount"),(n.requestType==="searching"||n.requestType==="sorting")&&(t._isRefreshAddedRecord=!1,t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords,t._totalCollapseRecordCount),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection(),this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)),n.requestType=="sorting"&&t._deSelectRowItem(),n.requestType==="delete"){if(t._isRefreshAddedRecord=!1,this.dataSource(t._$treegridHelper.ejTreeGrid("getDataSource")),t._isDataManagerUpdate&&(this._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),t.model.flatRecords=t._$treegridHelper.ejTreeGrid("getFlatRecords"),t.model.ids=t._$treegridHelper.ejTreeGrid("getUpdatedIds"),t.model.updatedRecords=t.getUpdatedRecords(),i.selectedItem=null,this.selectedRowIndex(-1),h=0,c=0,i.parentRecords.indexOf(n.data)!==-1&&i.parentRecords.splice(i.parentRecords.indexOf(n.data),1),n.data.hasChildRecords&&t._removeChildRecordsPredecessor(n.data),n.isDragAndDropDelete||n.data.predecessor&&t._removePredecessor(n.data.predecessor,n.data),n.data.parentItem&&(parentRecord=n.data.parentItem,n.data.parentItem.childRecords.length>0?n.data.parentItem.isAutoSchedule?t._updateParentItem(n.data):n.data.parentItem.isAutoSchedule||t._updateManualParentItem(n.data):(parentRecord.expanded=!1,parentRecord.hasChildRecords=!1,t.refreshGanttRecord(parentRecord))),n.isDragAndDropDelete)return;t._isValidationEnabled=!1;t.model.predecessorMapping&&(t._connectorlineIds=[],t._connectorLinesCollection=[],t._predecessorsCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection());this.isCriticalPathEnable==!0&&this.showCriticalPath(!0,!0);t._$ganttchartHelper.ejGanttChart("refreshHelper",t.getCurrentViewData(),t.getUpdatedRecords(),t._totalCollapseRecordCount);t._updateToolbarOptions();t.updateAltRow(t.getUpdatedRecords(),0,1);this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)}if(n.requestType==="selection"&&t._$ganttchartHelper.ejGanttChart("selectRows",n.recordIndex),n.requestType==="rowHover"&&t._$ganttchartHelper.ejGanttChart("addRowHover",n.index),n.requestType==="scroll"&&t._$ganttchartHelper.ejGanttChart("onScrollHelper",n.delta),n.requestType=="dragAndDrop"&&(t._isRefreshAddedRecord=!1,this.dataSource(t._$treegridHelper.ejTreeGrid("getDataSource")),t._isDataManagerUpdate&&(this._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),i.flatRecords=t._$treegridHelper.ejTreeGrid("getFlatRecords"),i.ids=t._$treegridHelper.ejTreeGrid("getUpdatedIds"),i.updatedRecords=t.getUpdatedRecords(),f=n.draggedRow.parentItem,n.droppedPosition=="insertAsChild"&&f&&(f.taskType=r.Gantt.TaskType.FixedDuration,f.effortDriven="false"),i.predecessorMapping&&(n.droppedPosition=="insertAsChild"&&(f.predecessor&&t._removePredecessor(f.predecessor,f),f.item[i.predecessorMapping]=u,f.predecessorsName=u,f.predecessor=u),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection(),t._isValidationEnabled=!0),n.draggedRow.parentItem&&n.draggedRow.parentItem.isAutoSchedule?t._updateParentItem(n.draggedRow):n.draggedRow.parentItem&&!n.draggedRow.parentItem.isAutoSchedule&&t._updateManualParentItem(n.draggedRow),this.isCriticalPathEnable==!0&&this.showCriticalPath(!0,!0),n.draggedRow&&t._$ganttchartHelper.ejGanttChart("refreshHelper",t.getCurrentViewData(),t.getUpdatedRecords(),t._totalCollapseRecordCount),this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)),n.requestType==="save"&&(n._cAddedRecord?(i.enableWBS&&i.enableWBSPredecessor&&i.predecessorMapping&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n._cAddedRecord),t._renderAddedRow(n.index,n._cAddedRecord),n._cAddedRecord.parentItem&&n._cAddedRecord.parentItem.isAutoSchedule?t._updateParentItem(n._cAddedRecord):n._cAddedRecord.parentItem&&!n._cAddedRecord.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cAddedRecord),r.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0),t.selectRows(i.updatedRecords.indexOf(n._cAddedRecord)),o=t.selectedRowIndex(),i.enableVirtualization||(e={},e.index=e.recordIndex=i.currentViewData.indexOf(n._cAddedRecord),t.refreshRowData(e),t.refreshRow(e))):n._cModifiedData&&(n._cModifiedData.hasChildRecords&&n._cModifiedData.isAutoSchedule?(n._cModifiedData.startDate=t._checkStartDate(n._cModifiedData.manualStartDate,n._cModifiedData),n._cModifiedData.left=n._cModifiedData._calculateManualLeft(this),n._cModifiedData.width=n._cModifiedData._calculateManualWidth(this),n._cModifiedData.progressWidth=n._cModifiedData._getProgressWidth(n._cModifiedData.width,n._cModifiedData.status),n._cModifiedData.endDate=n._cModifiedData.manualEndDate,n._cModifiedData._calculateDuration(this)):n._cModifiedData.hasChildRecords&&!n._cModifiedData.isAutoSchedule?(n._cModifiedData.left=n._cModifiedData._calculateLeft(this),n._cModifiedData.width=n._cModifiedData._calculateWidth(this),n._cModifiedData._calculateDuration(this),n._cModifiedData.manualStartDate=n._cModifiedData.startDate,n._cModifiedData.manualEndDate=n._cModifiedData.endDate,t._updateManualParentItem(n._cModifiedData,null,!0)):(n._cModifiedData.startDate=t._checkStartDate(n._cModifiedData.startDate,n._cModifiedData),n._cModifiedData.endDate=t._getEndDate(n._cModifiedData.startDate,n._cModifiedData.duration,n._cModifiedData.durationUnit,n._cModifiedData),n._cModifiedData.left=n._cModifiedData._calculateLeft(this),n._cModifiedData.width=n._cModifiedData._calculateWidth(this),n._cModifiedData.progressWidth=n._cModifiedData._getProgressWidth(n._cModifiedData.width,n._cModifiedData.status)),i.enableWBS&&i.enableWBSPredecessor&&i.predecessorMapping&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n._cModifiedData),t.refreshGanttRecord(n._cModifiedData),n._cModifiedData.parentItem&&n._cModifiedData.parentItem.isAutoSchedule?t._updateParentItem(n._cModifiedData):n._cModifiedData.parentItem&&!n._cModifiedData.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cModifiedData),n._cModifiedData.predecessor&&n.previousValue&&t._removeConnectorLine(n.previousValue,n._cModifiedData)),t.model.predecessorMapping&&(t._isValidationEnabled=n._cModifiedData&&n._cModifiedData.predecessor?!0:!1,n._cAddedRecord?(n._cAddedRecord.predecessor&&(t._validatePredecessorDates(n._cAddedRecord),t._addConnectorLine(n._cAddedRecord)),t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection()):n._cModifiedData&&(n.previousValue&&t._removeConnectorLine(n.previousValue,n._cModifiedData),t._addConnectorLine(n._cModifiedData),n._cModifiedData.predecessor&&(t._isUpdateOffset&&(t._editedTaskBarItem=n._cModifiedData),t._isMileStoneEdited=n._cModifiedData.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._validatePredecessor(n._cModifiedData,n.previousValue),t._isUpdateOffset&&(t._editedTaskBarItem=null),t._updatedConnectorLineCollection.length>0&&(t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection))),n._cModifiedData.parentItem&&n._cModifiedData.parentItem.isAutoSchedule?t._updateParentItem(n._cModifiedData):n._cModifiedData.parentItem&&!n._cModifiedData.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cModifiedData))),this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))),n.requestType==="validatePredecessor"){s=t._editedPredecessorValidation(n);n.result=s;return}t._ganttActionCompleteTrigger(n);o>=0&&t.focusOnTask(o)},focusOnTask:function(n){var r=this,h=r.model,o=r.element.find(".e-ganttviewerbodyContianer"),u=o.ejScroller("instance"),f=h.updatedRecords[n].left,s=u.model.width,i=u.model.scrollLeft,e=u._hScrollbar,t;e&&(e.model.maximum<i&&(i=e.model.maximum),(i>f||i+s<f)&&(t=f-s/2,t=t<0?0:t,o.ejScroller("scrollX",t,!0)));r._$ganttchartHelper.ejGanttChart("updateScrollBar")},calculateEndDate:function(n){var t=this,i=this._getEndDate(t._checkStartDate(n.startDate,n.record),n.duration,n.durationUnit,n.record);t._$ganttchartHelper.ejGanttChart("updateEditedRecordEndDate",t._checkEndDate(i,n.record))},calculateDuration:function(n){var t=this,i=this._getDuration(t._checkStartDate(n.startDate,n.record),t._checkEndDate(n.endDate,n.record),n.durationUnit,n.isAutoSchedule);t._$ganttchartHelper.ejGanttChart("updateEditedRecordDuration",i)},expandAllCollapseAllRequest:function(t){var r=this,i=n(r.element),u=i.ejGantt("instance"),f=i.attr("id");u._toolbarOperation(f+"_"+t.requestType)},chartactionComplete:function(n){var t=this,f,o,i,s,e;t.model.updatedRecords=t.getUpdatedRecords();t.model.currentViewData=t.getCurrentViewData();n.requestType==="updateConnectors"&&t.model.predecessorMapping&&(f=n.ganttRecord,t._isMileStoneEdited=f.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._editedTaskBarItem=f,t._validatePredecessor(f),t._updatedConnectorLineCollection.length>0&&(t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection)),t._editedTaskBarItem=null);n.requestType==="rowHover"&&t._$treegridHelper.ejTreeGrid("addRowHover",n.index);n.requestType==="scroll"&&(t._isTreeGridRendered=!1,t._isGanttChartRendered=!1,n.vscrollExsist&&n.delta!==u&&t._$treegridHelper.ejTreeGrid("onScrollHelper",n.delta),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t.model.enableVirtualization&&t.model.predecessorMapping&&(t._connectorLinesCollection.length>0&&t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection()),t._isTreeGridRendered=!0,t._isGanttChartRendered=!0);n.requestType==="selection"&&t._$treegridHelper.ejTreeGrid("selectRows",n.recordIndex);n.requestType==="validatePredecessor"&&(o=t._editedPredecessorValidation(n),n.predecessorValidation=o);n.requestType==="drawConnectorLine"&&(i=n.toItem._calculatePredecessor(n.predecessor,this._durationUnitEditText,this.model.durationUnit),n.toItem.item[t.model.predecessorMapping]=n.predecessorString[0],n.toItem.predecessorsName=n.toItem.item[t.model.predecessorMapping],model.enableWBS&&model.enableWBSPredecessor&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n.toItem),n.fromItem.predecessor?n.fromItem.predecessor.push(i[0]):n.fromItem.predecessor=i,n.toItem.predecessor?n.toItem.predecessor.push(i[0]):(n.toItem.predecessor=[],n.toItem.predecessor.push(i[0])),t._isMileStoneEdited=n.toItem.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._isValidationEnabled=t.model.enablePredecessorValidation&&(n.toItem.isAutoSchedule||t.model.validateManualTasksOnLinking)?!0:!1,t._validatePredecessor(n.toItem),t._updatedConnectorLineCollection.length>0&&(t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection)),n.toItem.isAutoSchedule||t.model.validateManualTasksOnLinking||(s=t._$treegridHelper.ejTreeGrid("instance"),r.TreeGrid.refreshRow(s,t.model.currentViewData.indexOf(n.toItem))),e={},e.data=n.toItem,t._updateScheduleDatesOnEditing(e),this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0)));t._ganttActionCompleteTrigger(n)},hideColumn:function(n){var t=this;t._$treegridHelper.ejTreeGrid("hideColumn",n)},showColumn:function(n){var t=this;t._$treegridHelper.ejTreeGrid("showColumn",n)},clearColumnMenu:function(){var n=this;n._$treegridHelper.ejTreeGrid("clearColumnMenu")},deleteRow:function(){var n=this;n._$treegridHelper.ejTreeGrid("deleteRow")},taskbarEditing:function(n){this._trigger("taskbarEditing",n)},setInitialData:function(){this._setInitialData()},sortColumn:function(n,t){var i=this;i._$treegridHelper.ejTreeGrid("sortColumn",n,t)},clearSorting:function(){var n=this,t=n.model;n._$treegridHelper.ejTreeGrid("clearSorting")},"export":function(t,i,f){var o=this,e=o.model,ft={action:t,method:"post","data-ajax":"false"},c,s,v,h,it,rt,ut;n("form#"+o._id+"export").remove();var l=r.buildTag("form#"+o._id+"export","",null,ft),a=o.ignoreOnExport,nt=a.length;if(e.criticalTask=this.criticalPathCollection.join(),!f){var y=e.updatedRecords,p=e.currentViewData,w=e.flatRecords,b=e.parentRecords,k=e.selectedItem,d=e.selectedItems,g=e.workUnit;for(o._$treegridHelper.ejTreeGrid("contextMenuOperations","Cancel"),delete e.updatedRecords,delete e.currentViewData,delete e.flatRecords,delete e.parentRecords,delete e.selectedItem,delete e.selectedItems,delete e.workUnit,c=n.extend(!0,{},e),e.updatedRecords=y,e.currentViewData=p,e.flatRecords=w,e.parentRecords=b,e.selectedItem=k,e.selectedItems=d,e.workUnit=g,s=c.columns,v=s.length,h=0;h<v;h++)if(c.columns[h].editType!=u)switch(s[h].editType){case"stringedit":s[h].editType="string";break;case"numericedit":s[h].editType="numeric";break;case"dropdownedit":s[h].editType="dropdown";break;case"booleanedit":s[h].editType="boolean"}if(this.ignoreOnExport)for(h=0;h<nt;h++)delete c[a[h]]}if(r.raiseWebFormsServerEvents){var tt={durationText:o._durationUnitTexts,durationEditText:o._durationUnitEditText,taskTypeTexts:o._taskTypeTexts,effortDrivenTexts:o._effortDrivenTexts,taskModeTexts:o._taskModeTexts},et={model:c,originalEventType:i},ot={model:JSON.stringify(c),locale:JSON.stringify(tt)};r.raiseWebFormsServerEvents(i,et,ot)}else{it={};f?n("body").find(".e-gantt").each(function(t,i){var c=n(i).data("ejGantt"),f,h,o,tt,rt;if(!r.isNullOrUndefined(c)){for(f=c.model,y=f.updatedRecords,w=f.flatRecords,p=f.currentViewData,b=f.parentRecords,k=f.selectedItem,d=f.selectedItems,g=e.workUnit,delete f.updatedRecords,delete f.flatRecords,delete f.currentViewData,delete f.parentRecords,delete f.selectedItem,delete f.selectedItems,delete f.workUnit,h=JSON.parse(JSON.stringify(f)),f.updatedRecords=y,f.flatRecords=w,f.currentViewData=p,f.parentRecords=b,f.selectedItem=k,f.selectedItems=d,f.workUnit=g,s=h.columns,v=s.length,o=0;o<v;o++)if(s[o].editType!=u)switch(s[o].editType){case"stringedit":s[o].editType="string";break;case"numericedit":s[o].editType="numeric";break;case"dropdownedit":s[o].editType="dropdown";break;case"booleanedit":s[o].editType="boolean"}if(a){for(o=0;o<nt;o++)delete h[a[o]];it[t]=JSON.stringify(h);tt={name:"GanttModel",type:"hidden",value:JSON.stringify(h)};rt=r.buildTag("input","",null,tt);l.append(rt)}}}):(rt={name:"GanttModel",type:"hidden",value:JSON.stringify(c)},ut=r.buildTag("input","",null,rt),l.append(ut),l.append(this));var tt={durationText:o._durationUnitTexts,durationEditText:o._durationUnitEditText,taskTypeTexts:o._taskTypeTexts,effortDrivenTexts:o._effortDrivenTexts,taskModeTexts:o._taskModeTexts},st={name:"locale",type:"hidden",value:JSON.stringify(tt)},ht=r.buildTag("input","",null,st);l.append(ht);n("body").append(l);l.submit()}return!0},_refreshParent:function(n){this.refreshGanttRecord(n);n.parentItem&&this._refreshParent(n.parentItem)},taskbarEdited:function(n){var i=this,t=n.data,s=i.model,l=new Date(i._projectStartDate),f,u,h,c,e=s.scheduleHeaderSettings.scheduleHeaderType,o=r.Gantt.ScheduleHeaderType,nt=r.Gantt.DurationUnit,g,b,k,d,v,a;if(i._isValidationEnabled=!1,n.dragging){if(v="dragging",n.previousData.left!==t.left){if(f=t.left%i._perDayWidth,h=(t.left-f)/i._perDayWidth,u=f/i._perDayWidth,(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.left=t.left-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.left=t.left-f+a):u>.75&&(h+=1,u=0,t.left=t.left-f+i._perDayWidth)),c=e==o.Day||e==o.Hour?24:i._secondsPerDay/3600,c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);l=t._startDateUpdate(l,h,w,i._workingTimeRanges,e);t.startDate=i._checkStartDate(l,t);s.startDateMapping&&(t.item[s.startDateMapping]=t.startDate);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._isValidationEnabled=!0}}else if(n.rightResizing){if(v="Resizing",n.previousData.width!==t.width){if(e==o.Day||e==o.Hour?(g=new Date(t.startDate),b=new Date(t.startDate),b.setHours(0,0,0,0),k=g.getTime()-b.getTime(),d=k>0?t.width+k/864e5*i._perDayWidth:t.width,f=d%i._perDayWidth,h=(d-f)/i._perDayWidth,c=24):(f=t.width%i._perDayWidth,h=(t.width-f)/i._perDayWidth,c=i._secondsPerDay/3600),u=f/i._perDayWidth,startDate=i._getDateFromFormat(t.startDate),(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.width=t.width-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.width=t.width-f+a):u>.75&&(h+=1,u=0,t.width=t.width-f+i._perDayWidth)),c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);endDate=t._endDateUpdate(startDate,h-1,w,i._workingTimeRanges,e);t.endDate=i._checkEndDate(endDate,t);s.endDateMapping&&(t.item[s.endDateMapping]=t.endDate);t._calculateDuration(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._updatedColumn="duration";i._updateResourceRelatedFields(t)}}else if(n.leftResizing&&(v="Resizing",n.previousData.left!==t.left)){if(f=t.left%i._perDayWidth,h=(t.left-f)/i._perDayWidth,u=f/i._perDayWidth,(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.left=t.left-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.left=t.left-f+a):u>.75&&(h+=1,u=0,t.left=t.left-f+i._perDayWidth)),c=e==o.Day||e==o.Hour?24:i._secondsPerDay/3600,c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);l=t._startDateUpdate(l,h,w,i._workingTimeRanges,e);t.startDate=i._checkStartDate(l,t);s.startDateMapping&&(t.item[s.startDateMapping]=t.startDate);t.endDate=i._checkEndDate(t.endDate,t);t.isAutoSchedule&&s.includeWeekend==!1&&(e==o.Hour||e==o.Day)&&t._calculateEndDate(this);t._calculateDuration(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._updatedColumn="duration";i._updateResourceRelatedFields(t)}n.progressResizing?n.previousData.status!=n.data.status&&(t.status=t._getProgressPercent(t.width,t.progressWidth),t.parentItem&&t._updateParentProgress(t.parentItem,s.progressMapping),i._refreshParent(t)):(i._isValidationEnabled=!0,i._updateEditedGanttRecord(t),t.predecessor&&(i._isMileStoneEdited=t.isMilestone,i._updatedConnectorLineCollection=[],i._connectorlineIds=[],i._editedTaskBarItem=t,s.enablePredecessorValidation?i._validatePredecessor(t):i._validatePredecessorOnEditing(t),i._updatedConnectorLineCollection.length>0&&(i._$ganttchartHelper.ejGanttChart("appendConnectorLine",i._updatedConnectorLineCollection),this._updateConnectorLineCollection(i._updatedConnectorLineCollection))),i._editedTaskBarItem=null,t.isAutoSchedule||!t.hasChildRecords||n.isChildren||n.rightResizing||i._validateAutoChildRecords(n),t.parentItem&&t.parentItem.isAutoSchedule?i._updateParentItem(t,v):t.parentItem&&!t.parentItem.isAutoSchedule&&i._updateManualParentItem(t,v));i.refreshGanttRecord(t);i._trigger("taskbarEdited",n);!n.cancel&&(n.leftResizing||n.rightResizing||n.dragging)&&i._isValidationEnabled&&i._updateScheduleDatesOnEditing(n);this.isCriticalPathEnable==!0&&(i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_validatePredecessorOnEditing:function(n,t){var i=this,r=i.model,s=n.taskId.toString(),r=this.model,h=n.predecessor,u=r.flatRecords,f=r.ids,c=null,o=h.filter(function(n){return n.to===s}),l=h.filter(function(n){return n.from===s}),a=o.length,v,e;for(count=0;count<a;count++)predecessor=o[count],isOffsetChanged=i._isOffsetChange(predecessor,c,count),parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],t&&(i._validateChildGanttRecord(parentGanttRecord,record,predecessor,r.enablePredecessorValidation,isOffsetChanged),t=!1),connectorLineId="parent"+parentGanttRecord.taskId+"child"+record.taskId,i._$ganttchartHelper&&(i._$ganttchartHelper.ejGanttChart("removeConnectorline",connectorLineId),this._updateConnectorLineCollection(connectorLineId));for(count=0;count<a;count++)(predecessor=o[count],parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],r.enableVirtualization!==!1||parentGanttRecord.isExpanded!==!1&&record.isExpanded!=!1)&&(connectorLineObject=i._createConnectorLineObject(parentGanttRecord,record,predecessor),connectorLineObject&&(i._connectorlineIds.length>0&&i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)==-1?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.length==0?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)!=-1&&(e=i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId),i._updatedConnectorLineCollection[e]=connectorLineObject)));for(v=l.length,count=0;count<v;count++)(predecessor=l[count],parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],connectorLineId="parent"+parentGanttRecord.taskId+"child"+record.taskId,isOffsetChanged=i._isOffsetChange(predecessor,c,count),i._$ganttchartHelper&&(i._$ganttchartHelper.ejGanttChart("removeConnectorline",connectorLineId),this._updateConnectorLineCollection(connectorLineId)),t&&(i._validateChildGanttRecord(parentGanttRecord,record,predecessor,r.enablePredecessorValidation,isOffsetChanged),t=!1),r.enableVirtualization!==!1||parentGanttRecord.isExpanded!==!1&&record.isExpanded!=!1)&&(connectorLineObject=i._createConnectorLineObject(parentGanttRecord,record,predecessor),connectorLineObject&&(i._connectorlineIds.length>0&&i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)==-1?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.length==0?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)!=-1&&(e=i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId),i._updatedConnectorLineCollection[e]=connectorLineObject)))},_validateAutoChildRecords:function(t){for(var e=this,f=t.data,o=t.previousData,r=f.childRecords,u={},s=f.left-o.left,i=0;i<r.length;i++)r[i].isAutoSchedule&&!r[i].hasChildRecords&&(u.previousData=n.extend({},r[i]),r[i].left+=s,u.data=r[i],u.dragging=!0,t.isChildren=!0,e.taskbarEdited(u))},actionBegin:function(n){var t=this;t._trigger("actionBegin",n)||n.requestType==="beginedit"&&t._sendEditRequest()},_ganttActionCompleteTrigger:function(n){this._trigger("actionComplete",n);n.cancel||n.requestType!=="save"||(n._cModifiedData&&(n.data=n._cModifiedData),n._cAddedRecord&&(n.data=n._cAddedRecord),this._updateScheduleDatesOnEditing(n))},_queryCellInfo:function(n){this._trigger("queryCellInfo",n)},_beginEdit:function(t){var i=this,r=n("#"+i._id+"_toolbarItems"),u;if(!i._trigger("beginEdit",t)&&(i._isinBeginEdit=!0,i.model.toolbarSettings.showToolbar)){var f=[],e=n(r).find(".e-cancel").parent()[0],o=n(r).find(".e-saveitem").parent()[0];e&&f.push(e);o&&f.push(o);n(r).ejToolbar("enableItem",f);u=[];i.model.editSettings.allowAdding&&i.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&u.push(n(r).find(".e-addnewitem").parent()[0]);i.model.editSettings.allowEditing&&i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&u.push(n(r).find(".e-edititem").parent()[0]);i.model.editSettings.allowDeleting&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&u.push(n(r).find(".e-deleteitem").parent()[0]);n(r).ejToolbar("disableItem",u)}},_endEdit:function(t){var i=this,s=this.model,e=n("#"+i._id+"_toolbarItems"),u,r,o,f;i._trigger("endEdit",t)?(u="",t.data[t.columnName]=t.previousValue,t.columnName==="predecessor"?(u=i._predecessorToString(t.data.predecessor,t.data),t.data.item[t.columnObject.mappingName]=u,t.data.predecessorsName=u):(t.data.item[t.columnObject.mappingName]=t.previousValue,t.columnName==="resourceInfo"&&(i._updateResourceName(t.data),i._updateResourceRelatedFields(t.data)))):(i._updatedColumn=t.columnName,t.columnName=="taskType"&&t.value=="fixedWork"&&(t.data.effortDriven="true"),(t.columnName==="duration"||t.columnName=="work")&&i._updateResourceRelatedFields(t.data),t.columnName==="resourceInfo"&&(i._updateResourceName(t.data),i._updateResourceRelatedFields(t.data),i._isDurationUpdated==!1&&(r=t.data,o=t.data.hasChildRecords?!0:!1,o&&r.isAutoSchedule?i._updateParentItem(r,null,!0):o&&!r.isAutoSchedule&&i._updateManualParentItem(r,null,!0),r.parentItem&&r.parentItem.isAutoSchedule?i._updateParentItem(r,null,!1):r.parentItem&&!r.parentItem.isAutoSchedule&&i._updateManualParentItem(r,null,!1))),(t.isModified||i._isDurationUpdated)&&(i.model.currentViewData=i._$treegridHelper.ejTreeGrid("getCurrentViewData"),i._isValidationEnabled=t.data.isAutoSchedule||s.validateManualTasksOnLinking?!0:!1,i._updateEditedGanttRecords(t)));i._isDurationUpdated=!1;i._isinBeginEdit=!1;i.refreshGanttRecord(t.data);delete t.isModified;i.model.toolbarSettings.showToolbar&&(f=[],i.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&f.push(n(e).find(".e-cancel").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&f.push(n(e).find(".e-saveitem").parent()[0]),n(e).ejToolbar("disableItem",f));t.cancel||t.columnName!=="startDate"&&t.columnName!=="endDate"&&t.columnName!=="duration"&&t.columnName!=="baselineStartDate"&&t.columnName!=="baselineEndDate"||i._updateScheduleDatesOnEditing(t);t.cancel||t.columnName!=="taskMode"&&t.columnName!=="startDate"&&t.columnName!=="endDate"&&t.columnName!=="duration"&&t.columnName!=="status"&&t.columnName!=="predecessor"||this.isCriticalPathEnable==!0&&(i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_updateScheduleDatesOnEditing:function(n){var i=this,t=this.model,o=i._getDateFromFormat(n.data.startDate),c=i._getDateFromFormat(n.data.endDate),s=i._projectStartDate,l=i._getDateFromFormat(t.scheduleEndDate),v,y,p,w,u=!1,r=t.scheduleStartDate,b,f=t.scheduleEndDate,e;if(n.data.hasChildRecords&&!n.data.isAutoSchedule&&(o=i._getDateFromFormat(n.data.manualStartDate),c=i._getDateFromFormat(n.data.manualEndDate)),i._calculateDatesForScheduleCheck(o),t.predecessorMapping)e={},e.onEditing=!0,i._calculateScheduleDates(e),i._calculateDatesForScheduleCheck(e.minStartDate),e.minStartDate.getTime()<s&&(r=n.data._getFormatedDate(e.minStartDate,t.dateFormat,t.locale),u=!0),e.maxEndDate.getTime()>l&&(f=n.data._getFormatedDate(e.maxEndDate,t.dateFormat,t.locale),u=!0),u&&i.updateScheduleDates(r,f);else{if(o.getTime()>=s.getTime()&&o.getTime()<=l.getTime()||(o.getTime()<s.getTime()?(v=o,s=o):(y=i._getDateFromFormat(n.data.startDate),l=i._getDateFromFormat(n.data.startDate))),c.getTime()>=s.getTime()&&c.getTime()<=l.getTime()||(c.getTime()<s.getTime()?v=c:y=c),y&&(u=!0,f=n.data._getFormatedDate(y,t.dateFormat,t.locale)),v&&(u=!0,r=n.data._getFormatedDate(v,t.dateFormat,t.locale)),t.renderBaseline&&n.data.baselineStartDate&&n.data.baselineEndDate){var h=i._getDateFromFormat(n.data.baselineStartDate),a=i._getDateFromFormat(n.data.baselineEndDate),r=i._getDateFromFormat(r),f=i._getDateFromFormat(f);h.getTime()>=r.getTime()&&h.getTime()<=f.getTime()||(h.getTime()<r.getTime()?(p=h,s=h):(w=h,l=h));a.getTime()>=r.getTime()&&a.getTime()<=f.getTime()||(a.getTime()<r.getTime()?p=a:w=a)}w&&(u=!0,f=n.data._getFormatedDate(w,t.dateFormat,t.locale));p&&(u=!0,r=n.data._getFormatedDate(p,t.dateFormat,t.locale));u&&(b=i._updateScheduleDatesByTaskLables(i._getDateFromFormat(r),i._getDateFromFormat(f)),i.updateScheduleDates(n.data._getFormatedDate(b.minStartDate,t.dateFormat,t.locale),n.data._getFormatedDate(b.maxEndDate,t.dateFormat,t.locale)))}},_calculateDatesForScheduleCheck:function(n){var f=this,u=this.model,t=u.scheduleHeaderSettings.scheduleHeaderType,i=r.Gantt.ScheduleHeaderType;t==i.Week&&n.setDate(n.getDate()-3);t==i.Year&&n.setDate(n.getDate()-5);t==i.Month&&n.setDate(n.getDate()-3);t==i.Day&&n.setHours(n.getHours()-2);t==i.Hour&&n.setMinutes(n.getMinutes()-5)},_updateScheduleDatesByToolBar:function(t){var i=this,f=this.model,u=t==="prevTimeSpan"?i._projectStartDate:i._getDateFromFormat(i.model.scheduleStartDate);endDate=i._getDateFromFormat(i.model.scheduleEndDate);chartObject=n("#ejGanttChart"+i._id).ejGanttChart("instance");scheduleHeaderType=f.scheduleHeaderSettings.scheduleHeaderType;scheduleHeaderValue=r.Gantt.ScheduleHeaderType;maxScrollWidth=0;scheduleHeaderType==scheduleHeaderValue.Week&&(t==="prevTimeSpan"?u.setDate(u.getDate()-6):endDate.setDate(endDate.getDate()+7));scheduleHeaderType==scheduleHeaderValue.Year&&(t==="prevTimeSpan"?u.setDate(u.getDate()-360):endDate.setDate(endDate.getDate()+365));scheduleHeaderType==scheduleHeaderValue.Month&&(t==="prevTimeSpan"?u.setMonth(u.getMonth()-1):endDate.setDate(endDate.getDate()+30));scheduleHeaderType==scheduleHeaderValue.Day&&(t==="prevTimeSpan"?u.setDate(u.getDate()-1):endDate.setDate(endDate.getDate()+1));scheduleHeaderType==scheduleHeaderValue.Hour&&(t==="prevTimeSpan"?u.setHours(u.getHours()-1):endDate.setHours(endDate.getHours()+1));t==="prevTimeSpan"?(i.updateScheduleDates(i._getFormatedDate(u,f.dateFormat,f.locale),i._getFormatedDate(endDate,f.dateFormat,f.locale)),chartObject._$bodyContainer.ejScroller("scrollX",0,!0),i.isCriticalPathEnable==!0&&f.predecessorMapping&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",i.criticalPathCollection,i.detailPredecessorCollection,!0,i.collectionTaskId)):t==="nextTimeSpan"&&(i.updateScheduleDates(i._getFormatedDate(u,f.dateFormat,f.locale),i._getFormatedDate(endDate,f.dateFormat,f.locale)),maxScrollWidth=chartObject.getMaxScrollWidth(),chartObject._$bodyContainer.ejScroller("scrollX",maxScrollWidth,!0),i.isCriticalPathEnable==!0&&f.predecessorMapping&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",i.criticalPathCollection,i.detailPredecessorCollection,!0,i.collectionTaskId))},_rowDataBound:function(n){this._trigger("rowDataBound",n)},_refreshToolBar:function(){var t=n("#"+this._id+"_toolbarItems");t.find("li").removeClass("e-hover")},_toolBarClick:function(t){var f=this,c=f.model,e=n(this.itemsContainer).closest(".e-gantt"),r=e.ejGantt("instance"),i=e.attr("id"),o=n("#"+r._id+"_toolbarItems");if(r._clearContextMenu(),t.event==u&&t.target.tagName=="INPUT"&&t.currentTarget.id==i+"_search")return!1;r.model.dateFormat.toLowerCase().indexOf("hh")!=-1?n.isFunction(n.fn.ejDateTimePicker)&&n("#"+i+"EditForm").find(".e-datetimepicker").ejDateTimePicker("hide"):n.isFunction(n.fn.ejDatePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDatePicker("hide");var s=t.currentTarget,l=t.target,h={itemName:t.text,currentTarget:s,model:r.model};if(e.ejGantt("instance")._trigger("toolbarClick",h))return!1;n(o).ejToolbar("deselectItem",t.currentTarget);switch(t.currentTarget.id){case i+"_excelExport":r._toolbarOperation(i+"_excelExport");break;case i+"_pdfExport":r._toolbarOperation(i+"_pdfExport");break;case i+"_add":r._toolbarOperation(i+"_add");break;case i+"_edit":r._toolbarOperation(i+"_edit");break;case i+"_delete":r._toolbarOperation(i+"_delete");break;case i+"_update":r._toolbarOperation(i+"_update");break;case i+"_cancel":r._toolbarOperation(i+"_cancel");break;case i+"_search":r._toolbarOperation(i+"_search",n(t.currentTarget).find("input").val());break;case i+"_indent":r._toolbarOperation(i+"_indent");break;case i+"_outdent":r._toolbarOperation(i+"_outdent");break;case i+"_expandAll":r._toolbarOperation(i+"_expandAll");break;case i+"_criticalPath":r._enableDisableCriticalIcon?r._enableDisableCriticalIcon&&r._toolbarOperation(i+"_criticalDisable"):r._toolbarOperation(i+"_criticalEnable");break;case i+"_collapseAll":r._toolbarOperation(i+"_collapseAll");break;case i+"_prevTimeSpan":r._toolbarOperation(i+"_prevTimeSpan");break;case i+"_nextTimeSpan":r._toolbarOperation(i+"_nextTimeSpan");break;case"milestoneTemplate":f._milestoneTemplate(options[option]);break;case"taskbarTemplate":f._taskbarTemplate(options[option]);break;case"parentTaskbarTemplate":f._parentTaskbarTemplate(options[option])}return!1},_toolbarOperation:function(t,i){var o=this.element,f=o.ejGantt("instance"),u=o.attr("id"),r=this,s=r.selectedRowIndex(),e;f._exportTo=f["export"];e=n("#"+r._id+"_toolbarItems");switch(t){case u+"_add":r._sendAddRequest();break;case u+"_edit":r._sendEditRequest();break;case u+"_delete":r._$treegridHelper.ejTreeGrid("deleteRow");r._isRefreshAddedRecord=!1;break;case u+"_update":r._$treegridHelper.ejTreeGrid("endEdit");r.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&r._disabledToolItems.push(n(e).find(".e-cancel").parent()[0]);r.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&r._disabledToolItems.push(n(e).find(".e-saveitem").parent()[0]);n(e).ejToolbar("disableItem",r._disabledToolItems);r._disabledToolItems=[];break;case u+"_cancel":r._$treegridHelper.ejTreeGrid("cancelEditCell");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_criticalEnable":r.showCriticalPath(!0);r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_criticalDisable":r.showCriticalPath(!1);r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_search":r.cancelEditCell();r._searchString!=i&&(r._$treegridHelper.ejTreeGrid("search",i),r._searchString=i,r.updateSelectedItemIndex(),r._updateToolbarOptions(),r._isRefreshAddedRecord=!1);break;case u+"_indent":r._sendIndentRequest();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");r._isRefreshAddedRecord=!1;break;case u+"_outdent":r._sendOutdentRequest();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");r._isRefreshAddedRecord=!1;break;case u+"_expandAll":r._expandAll();r.updateSelectedItemIndex();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_collapseAll":r._collapseAll();r.updateSelectedItemIndex();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_prevTimeSpan":r._updateScheduleDatesByToolBar("prevTimeSpan");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_nextTimeSpan":r._updateScheduleDatesByToolBar("nextTimeSpan");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_excelExport":r._exportTo(f.model.exportToExcelAction,"excelExporting",f.model.allowMultipleExporting);break;case u+"_pdfExport":r._exportTo(f.model.exportToPdfAction,"pdfExporting",f.model.allowMultipleExporting)}return r._refreshToolBar(),!1},updateSelectedItemIndex:function(){var n=this,t=this.model,u=t.updatedRecords,i;t.allowSelection&&!r.isNullOrUndefined(this.selectedItem())?n.getExpandStatus(this.selectedItem())?(i=u.indexOf(this.selectedItem()),n.selectRows(i)):n.selectRows(-1):t.allowSelection||r.isNullOrUndefined(this.selectedItem())||n.selectRows(-1)},clearSelection:function(){var n=this;n.model.selectedCellIndexes=[];n._$treegridHelper.ejTreeGrid("clearSelection");n._$ganttchartHelper.ejGanttChart("clearSelection")},selectCells:function(n,t){var i=this,r=i.model;r.selectionMode=="cell"&&r.allowSelection&&i._$treegridHelper.ejTreeGrid("selectCells",n,t)},selectRows:function(n){var i=this,u=this.model,t;u.selectionMode!="cell"&&(n!==-1&&!r.isNullOrUndefined(n)&&n<u.updatedRecords.length?(t={},t.recordIndex=n,t.data=u.updatedRecords[t.recordIndex],t.target="ejTreeGrid",i.rowSelecting(t)&&(i.rowSelected(t),i._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex),i._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex)),i.updateIndentOutdentOption(t.data)):n===-1&&(i._deSelectRowItem(),i._updateToolbarOptions()))},_setModel:function(t){var i=this,u,f=i.model,o,s,e;for(u in t)switch(u){case"sortSettings":i._sendSortingRequest(t[u]);break;case"allowSorting":i._sortingRequest(t[u]);f.showColumnChooser&&f.showColumnOptions&&i._$treegridHelper.ejTreeGrid("columnAddDialogTemplate");break;case"allowMultiSorting":f.allowMultiSorting=t[u];i._$treegridHelper.ejTreeGrid("model.allowMultiSorting",f.allowMultiSorting);break;case"destroy":i.destroy();break;case"treeColumnIndex":i._columnIndex(t[u]);break;case"allowGanttChartEditing":i._ganttChartEditing(t[u]);break;case"enableProgressBarResizing":i._resizeProgressbar(t[u]);break;case"enableTaskbarTooltip":i._showTooltip(t[u]);break;case"enableTaskbarDragTooltip":i._showEditingTooltip(t[u]);break;case"validateManualTasksOnLinking":f.validateManualTasksOnLinking=t[u];break;case"enableAltRow":i._updateAltRow(t[u]);break;case"locale":f.flatRecords=[];f.parentRecords=[];i._clearContextMenu();f.locale=t[u];f.isRerender=!0;i.element.ejGantt("destroy").ejGantt(f);break;case"allowSelection":f.allowSelection=t[u];f.allowSelection?(i._$treegridHelper.ejTreeGrid("instance").model.allowSelection=!0,i._$ganttchartHelper.ejGanttChart("instance").model.allowSelection=!0):(i._deSelectRowItem(),i._$treegridHelper.ejTreeGrid("instance").model.allowSelection=!1,i._$ganttchartHelper.ejGanttChart("instance").model.allowSelection=!1);i._updateToolbarOptions();break;case"editSettings":n.extend(f.editSettings,t[u]);i._updateEditSettings(t[u]);i._initiateDialogTemplates();i._enableEditingEvents();this.cancelEditCell();break;case"taskbarBackground":i._updateTaskbarBackground(t[u]);break;case"progressbarBackground":i._updateProgressbarBackground(t[u]);break;case"parentTaskbarBackground":i._updateParentTaskbarBackground(t[u]);break;case"parentProgressbarBackground":i._updateParentProgressbarBackground(t[u]);break;case"showTaskNames":i._updateRenderTaskNames(t[u]);break;case"leftTaskLabelMapping":i._refreshLeftTaskLabelMapping(t[u]);break;case"rightTaskLabelMapping":i._refreshRightTaskLabelMapping(t[u]);break;case"leftTaskLabelTemplate":i._refreshLeftTaskLabelTemplate(t[u]);break;case"rightTaskLabelTemplate":i._refreshRightTaskLabelTemplate(t[u]);break;case"showProgressStatus":i._updateRendeProgressStatus(t[u]);break;case"showResourceNames":i._updateRenderResourceNames(t[u]);break;case"progressbarHeight":i._updateProgressbarHeight(t[u]);break;case"baselineColor":i._updateBaselineColor(t[u]);break;case"renderBaseline":i._updateRenderBaseline(t[u]);break;case"allowColumnResize":i._updateAllowColumnResize(t[u]);break;case"allowKeyboardNavigation":i._updateAllowKeyboardNavigation(t[u]);break;case"selectedItem":i._updateSelectedItem(t[u]);break;case"dataSource":i._deSelectRowItem();i._updateToolbarOptions();this._refreshDataSource(t[u]);i._enableDisableCriticalIcon&&i.showCriticalPath(!0);break;case"readOnly":i._updateReadOnly(t[u]);break;case"showGridCellTooltip":i._updateShowGridCellTooltip(t[u]);break;case"showGridExpandCellTooltip":i._updateShowGridExpandCellTooltip(t[u]);break;case"highlightWeekends":i._updateHighlightWeekends(t[u]);break;case"connectorLineBackground":i._updateConnectorLineBackground(t[u]);i._enableDisableCriticalIcon&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId);break;case"connectorlineWidth":i._updateConnectorlineWidth(t[u]);i._enableDisableCriticalIcon&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId);break;case"weekendBackground":i._updateWeekendBackground(t[u]);break;case"scheduleHeaderSettings":o=t[u];for(setting in o)switch(setting){case"timescaleUnitSize":i._updateTimescaleUnitSize(o[setting]);break;case"scheduleHeaderType":i._changeChartSchedule(o[setting])}break;case"enableContextMenu":f.enableContextMenu=t[u];i._clearContextMenu();i._off(i.element,"contextmenu",i._rightClick);f.enableContextMenu&&i._on(i.element,"contextmenu",i._rightClick);break;case"enableResize":f.enableResize?(i.model.enableResize=t[u],i._on(n(window),"resize",i.windowResize)):i._off(n(window),"resize",i.windowResize);break;case"isResponsive":f.isResponsive?(i.model.isResponsive=t[u],i._on(n(window),"resize",i.windowResize)):i._off(n(window),"resize",i.windowResize);break;case"selectedRowIndex":this.selectedRowIndex()===-1||this.selectedRowIndex()===""?(i._deSelectRowItem(),i._updateToolbarOptions()):this.selectedRowIndex()!==-1&&!r.isNullOrUndefined(this.selectedRowIndex())&&this.selectedRowIndex()<i.model.updatedRecords.length&&(s={},s.recordIndex=i.selectedRowIndex(),s.previousIndex=f.selectedItem?f.updatedRecords.indexOf(f.selectedItem):-1,i.rowSelecting(s)&&(e={},e.recordIndex=this.selectedRowIndex(),e.data=i.model.updatedRecords[e.recordIndex],e.target="ejTreeGrid",i._$treegridHelper.ejTreeGrid("selectRows",e.recordIndex),i.rowSelected(e)));break;case"selectedCellIndexes":f.allowSelection&&f.selectionMode=="cell"&&i.selectCells(t[u]);break;case"selectionMode":f.allowSelection&&(i.clearSelection(),i._$treegridHelper.ejTreeGrid("selectRows",-1),i._$ganttchartHelper.ejGanttChart("selectRows",-1),f.selectedItem=null,f.selectionMode=t[u],i._$treegridHelper.ejTreeGrid("option","selectionMode",t[u]),i._$ganttchartHelper.ejGanttChart("option","selectionMode",t[u]),t[u]=="row"&&(i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType="single"),i._updateToolbarOptions());break;case"selectionType":f.allowSelection&&(i.clearSelection(),f.selectionMode=="cell"?(f.selectionType=t[u],i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType=t[u]):(f.selectionType="single",i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType="single"));break;case"showColumnChooser":f.showColumnChooser=t[u];i._$treegridHelper.ejTreeGrid("setModel",{showColumnChooser:f.showColumnChooser});break;case"showColumnOptions":f.showColumnOptions=t[u];i._$treegridHelper.ejTreeGrid("setModel",{showColumnOptions:f.showColumnOptions});break;case"splitterPosition":i.setSplitterPosition(i._splitterPosition());break;case"addDialogFields":f.editSettings.allowAdding&&(f.addDialogFields=t[u],i.addDialogTemplate());break;case"dragTooltip":i._$treegridHelper.ejTreeGrid("setModel",{dragTooltip:t[u]});break;case"allowDragAndDrop":f.allowDragAndDrop=t[u];i._$treegridHelper.ejTreeGrid("setModel",{allowDragAndDrop:f.allowDragAndDrop});break;case"editDialogFields":f.editSettings.allowEditing&&(f.editDialogFields=t[u],i.editDialogTemplate());break;case"toolbarSettings":n.extend(i.model.toolbarSettings,t[u]);i._updateToolbar();break;case"holidays":f.holidays=t[u];i._refreshHolidays();break;case"stripLines":f.stripLines=t[u];i._updateStripLines();break;case"splitterSettings":n.extend(f.splitterSettings,t[u]);!r.isNullOrUndefined(t[u].index)&&r.isNullOrUndefined(t[u].position)?i.setSplitterIndex(f.splitterSettings.index):i.setSplitterPosition(i.splitterPosition());break;case"enablePredecessorValidation":f.enablePredecessorValidation=t[u];break;case"sizeSettings":this._calculateDimensions();this.windowResize();break;case"dayWorkingTime":f.dayWorkingTime=t[u].slice();f.flatRecords=[];f.parentRecords=[];f.updatedRecords=[];f.ids=[];f.scheduleStartDate=f.scheduleStartDate;f.scheduleEndDate=f.scheduleEndDate;i._storedIndex=-1;i.selectedRowIndex(-1);i._predecessorsCollection=[];i.element.ejGantt("destroy").ejGantt(f);break;case"workUnit":f.workUnit=t[u];this._updateWorkUnit();break;case"resources":i._updateResourcesData(t[u])}},_updateResourcesData:function(t){var u=this,i=u.model,e,f=-1,o=u.getColumns();i.resources=n.extend(!0,[],t);n.each(o,function(n,t){if(t.mappingName==i.resourceInfoMapping){f=n;return}});f>-1&&(o[f].dropdownData=i.resources);flatRecords=i.flatRecords.slice();flatRecords.reverse();e=r.Gantt.GanttRecord.prototype;n.each(flatRecords,function(n,t){t.resourceInfo&&t.resourceInfo.length>0&&(t.resourceInfo=e._setResourceInfo(t.item[i.resourceInfoMapping],i.resourceIdMapping,i.resourceNameMapping,i.resourceUnitMapping,i.resources),u._updateResourceName(t),u._updateResourceRelatedFields(t),t.hasChildRecords?t.isAutoSchedule?u._updateParentItem(t,null,!0):t.isAutoSchedule||u._updateManualParentItem(t,null,!0):u.refreshGanttRecord(t))})},_changeChartSchedule:function(n){var t=this,i=t.model,u,f;switch(n){case r.Gantt.ScheduleHeaderType.Week:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Week;t._perDayWidth=30;break;case r.Gantt.ScheduleHeaderType.Day:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Day;t._perHourWidth=20;i.workingTimeScale==r.Gantt.workingTimeScale.TimeScale24Hours?t._perDayWidth=t._perHourWidth*24:i.workingTimeScale==r.Gantt.workingTimeScale.TimeScale8Hours&&(t._perDayWidth=t._perHourWidth*24);break;case r.Gantt.ScheduleHeaderType.Month:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Month;t._perDayWidth=10;t._perWeekWidth=70;break;case r.Gantt.ScheduleHeaderType.Year:i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Year;t._perDayWidth=3;t._perMonthWidth=90;break;case r.Gantt.ScheduleHeaderType.Hour:if(i.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Hour,u=i.scheduleHeaderSettings.minutesPerInterval,f=r.Gantt.minutesPerInterval,t._perMinuteWidth=20,u)if(u==f.Auto){var e=endDate-startDate;e>864e6?(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48):e>6048e5?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):e>1728e5?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440)}else u==f.OneMinute?(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440):u==f.FiveMinutes?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):u==f.FifteenMinutes?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):u==f.ThirtyMinutes&&(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48)}t._updateModelsWidth();t.updateScheduleDates(i.scheduleStartDate,i.scheduleEndDate)},_updateWorkUnit:function(){var n=this,f=n.model,e=f.flatRecords,s=n.getCurrentViewData(),o=n._$treegridHelper.ejTreeGrid("instance"),i,t,u;for(o.model.workUnit=n._workUnitTexts[f.workUnit],i=0;i<e.length;i++)t=e[i],u=s.indexOf(t),t._updateWorkWithDuration(n),t.parentItem&&n._updateParentItem(t),u!=-1&&r.TreeGrid.refreshRow(o,u)},_dataBindingForSetModel:function(){var t=this,i=t.model,s,h,e,o,u,f;if(this.dataSource()==null&&this.dataSource([]),this.dataSource()instanceof r.DataManager)s=this._columnToSelect(),h=this.dataSource().executeQuery(s),h.done(r.proxy(function(r){var e,o,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createGanttRecords(t.secondaryDatasource);t._refreshGanttWithNewRecords()}));else if(this.dataSource().length>0){if(i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],t._taskIds=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o);t._createGanttRecords(t.secondaryDatasource)}else t._createGanttRecords(this.dataSource());this._refreshGanttWithNewRecords()}else this._refreshGanttWithNewRecords();i.expandStateMapping&&t._collapseRecordOnLoad()},_refreshGanttWithNewRecords:function(){var n=this,t=this.model,i={};this._updatePredecessors();this._$treegridHelper.ejTreeGrid("setUpdatedRecords",t.flatRecords,t.updatedRecords,t.ids,t.parentRecords,this.dataSource());this._$treegridHelper.ejTreeGrid("processBindings");n.model.updatedRecords=n.getUpdatedRecords();n.model.currentViewData=n.getCurrentViewData();n._gridRows=n.getRows();n._totalCollapseRecordCount=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");this._$ganttchartHelper.ejGanttChart("setUpdatedRecords",t.currentViewData,t.updatedRecords,t.flatRecords,t.ids);this._calculateScheduleDates();this.updateScheduleDates(t.scheduleStartDate,this.model.scheduleEndDate);i.requestType=r.TreeGrid.Actions.Refresh;n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i);this._isFromSetModel=!1},_refreshDataSource:function(n){var t=this;this.resetModelCollections();this.dataSource(n);this._isFromSetModel=!0;t.secondaryDatasource=[];t._retrivedData=this.dataSource();this._dataBindingForSetModel()},resetModelCollections:function(){var t=this,n=t.model;n.dataSource=[];n.flatRecords=[];n.parentRecords=[];n.updatedRecords=[];n.ids=[];n.scheduleStartDate=n.scheduleStartDate;n.scheduleEndDate=n.scheduleEndDate;t._storedIndex=-1;t.selectedRowIndex(-1);t._predecessorsCollection=[]},_refreshHolidays:function(){var n=this,i=this.model,t,r;n._holidaysList=n._getHoliday();n._stringHolidays=n._getStringHolidays();t=n._updateScheduleDatesByHolidays(new Date(n._projectStartDate),new Date(n._projectEndDate));t.startDate.getTime()!==n._projectStartDate.getTime()||t.endDate.getTime()!==n._projectEndDate.getTime()?(r=n._$ganttchartHelper.data("ejGanttChart"),r.model.holidays=i.holidays,n.updateScheduleDates(t.startDate,t.endDate)):(n._isTreeGridRendered=!1,n._isGanttChartRendered=!1,n._updateGanttRecords(),n._$ganttchartHelper.ejGanttChart("refreshHelper",n.model.currentViewData,n.model.updatedRecords,n._totalCollapseRecordCount),i.predecessorMapping&&(n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._connectorlineIds=[],n._connectorLinesCollection=[],n._isValidationEnabled=!1,n._createConnectorLinesCollection(),n._isValidationEnabled=!0),this._$ganttchartHelper.ejGanttChart("refreshHolidays",i.holidays),n._isTreeGridRendered=!0,n._isGanttChartRendered=!0);n._$treegridHelper.ejTreeGrid("renderRecords")},_updateStripLines:function(){var n=this,r=this.model,t,i;t=n._updateScheduleDatesByStripLines(new Date(n._projectStartDate),new Date(n._projectEndDate));t.startDate.getTime()!==n._projectStartDate.getTime()||t.endDate.getTime()!==n._projectEndDate.getTime()?(i=n._$ganttchartHelper.data("ejGanttChart"),i.model.stripLines=r.stripLines,n.updateScheduleDates(t.startDate,t.endDate)):this._$ganttchartHelper.ejGanttChart("refreshStripLines",this.model.stripLines)},_updateWeekendBackground:function(n){var t=this;this.model.weekendBackground=n;t._$ganttchartHelper.ejGanttChart("updateWeekendBackground",n)},_updateConnectorlineWidth:function(n){var t=this;this.model.connectorlineWidth=n;t._$ganttchartHelper.ejGanttChart("updateConnectorlineWidth",n);t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection)},_updateConnectorLineBackground:function(n){var t=this;this.model.connectorLineBackground=n;t._$ganttchartHelper.ejGanttChart("updateConnectorLineBackground",n);t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection)},_updateHighlightWeekends:function(n){var t=this;this.model.highlightWeekends=n;t._$ganttchartHelper.ejGanttChart("updateHighlightWeekends",n)},_updateReadOnly:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateReadOnly",n);t._$ganttchartHelper.ejGanttChart("updateReadOnly",n);t._updateToolbarOptions()},_updateShowGridCellTooltip:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateShowGridCellTooltip",n)},_updateShowGridExpandCellTooltip:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateShowGridExpandCellTooltip",n)},_updateSelectedItem:function(n){var t=this,i={};n[t.model.taskIdMapping]!=null&&(i.recordIndex=t.model.ids.indexOf(n[t.model.taskIdMapping].toString()),i.item=t.model.flatRecords[i.recordIndex],i.target="ejTreeGrid",t.rowSelected(i),t._$treegridHelper.ejTreeGrid("selectRows",i.recordIndex),t._$ganttchartHelper.ejGanttChart("selectRows",i.recordIndex),t._$ganttchartHelper.ejGanttChart("updateSelectedItem",i.recordIndex))},_updateAllowKeyboardNavigation:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateAllowKeyboardNavigation",n);t._$ganttchartHelper.ejGanttChart("updateAllowKeyboardNavigation",n)},_updateAllowColumnResize:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateAllowColumnResize",n)},_updateProgressbarHeight:function(n){var t=this;this.model.progressbarHeight=n;t._$ganttchartHelper.ejGanttChart("updateProgressbarHeight",n)},_updateBaselineColor:function(n){var t=this;this.model.baselineColor=n;t._$ganttchartHelper.ejGanttChart("updateBaselineColor",n)},_showBaselineColumns:function(){var i=this,n=i.model,u,t;n.renderBaseline&&n.baselineStartDateMapping&&n.baselineEndDateMapping&&(t=n.baselineStartDateMapping,t.length&&(u={field:"baselineStartDate",headerText:i._columnHeaderTexts.baselineStartDate,width:150,editType:n.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:t,format:"{0:"+n.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},i._columns.push(u)),t=n.baselineEndDateMapping,t.length&&(u={field:"baselineEndDate",headerText:i._columnHeaderTexts.baselineEndDate,width:150,editType:n.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:t,format:"{0:"+n.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},i._columns.push(u)))},_updateRenderBaseline:function(n){var t=this,i=t.model,r,u;this.model.renderBaseline=n;t._$ganttchartHelper.ejGanttChart("updateRenderBaseline",n);i.renderBaseline&&(t._showBaselineColumns(),t._trigger("load"));i.renderBaseline||(r=t._getbaselineColumnIndex(t._columns).indexOf("baselineStartDate"),t._columns.splice(r,1),u=t._getbaselineColumnIndex(t._columns).indexOf("baselineEndDate"),t._columns.splice(u,1));t._$treegridHelper.ejTreeGrid("updateColumns",t._columns);t.addDialogTemplate();t.editDialogTemplate()},_getbaselineColumnIndex:function(n){for(var r=this,i=[],t=0;t<n.length;t++)i[t]=n[t].field;return i},_updateRenderTaskNames:function(n){var t=this;this.model.showTaskNames=n;t._$ganttchartHelper.ejGanttChart("updateRenderTaskNames",n)},_refreshLeftTaskLabelMapping:function(n){var t=this;this.model.leftTaskLabelMapping=n;t._$ganttchartHelper.ejGanttChart("refreshLeftTaskLabelMapping",n)},_refreshRightTaskLabelMapping:function(n){var t=this;this.model.rightTaskLabelMapping=n;t._$ganttchartHelper.ejGanttChart("refreshRightTaskLabelMapping",n)},_refreshLeftTaskLabelTemplate:function(n){var t=this;this.model.leftTaskLabelTemplate=n;t._$ganttchartHelper.ejGanttChart("refreshLeftTaskLabelTemplate",n)},_refreshRightTaskLabelTemplate:function(n){var t=this;this.model.rightTaskLabelTemplate=n;t._$ganttchartHelper.ejGanttChart("refreshRightTaskLabelTemplate",n)},_updateRendeProgressStatus:function(n){var t=this;this.model.showProgressStatus=n;t._$ganttchartHelper.ejGanttChart("updateRendeProgressStatus",n)},_updateRenderResourceNames:function(n){var t=this;this.model.showResourceNames=n;t._$ganttchartHelper.ejGanttChart("updateRenderResourceNames",n)},_updateTaskbarBackground:function(n){var t=this;this.model.taskbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateTaskbarBackground",n)},_updateProgressbarBackground:function(n){var t=this;this.model.progressbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateProgressbarBackground",n)},_updateParentTaskbarBackground:function(n){var t=this;this.model.parentTaskbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateParentTaskbarBackground",n)},_updateParentProgressbarBackground:function(n){var t=this;this.model.parentProgressbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateParentProgressbarBackground",n)},_updateEditSettings:function(n){var t=this;t._$ganttchartHelper.ejGanttChart("updateEditSettings",n);t._$treegridHelper.ejTreeGrid("updateEditSettings",n);t._updateToolbarOptions()},_updateRowSelection:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateRowSelection",n)},_updateAltRow:function(n){var t=this;t._$treegridHelper.ejTreeGrid("option","enableAltRow",n)},_renderAddedRow:function(n,t){var i=this,u=this.model,f;u.currentViewData=i._$treegridHelper.ejTreeGrid("getUpdatedCurrentViewData");i._$ganttchartHelper.ejGanttChart("setUpdatedRecords",u.currentViewData,u.updatedRecords,u.flatRecords,u.ids);u.enableVirtualization?(f={},f.requestType=r.TreeGrid.Actions.Refresh,i._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",f),i._$ganttchartHelper.ejGanttChart("refreshHelper",u.currentViewData,u.updatedRecords,i._totalCollapseRecordCount)):(i._$treegridHelper.ejTreeGrid("renderNewAddedRow",n,t),i._$ganttchartHelper.ejGanttChart("renderNewAddedRow",n,t));i._$treegridHelper.ejTreeGrid("updateHeight");i._gridRows=i.getRows();i._ganttChartRows=i.getGanttChartRows()},_getVisibleChildRecordCount:function(n,t,i){var e=this,o=this.model,u,f,r;if(n.hasChildRecords)for(u=n.childRecords,f=u.length,r=0;r<f;r++)i.indexOf(u[r])!==-1&&t++,u[r].hasChildRecords&&(t=e._getVisibleChildRecordCount(u[r],t,i));else i.indexOf(n)!==-1&&t++;return t},_validateAddRecordPrecessorValue:function(n){var u=this,i=n.data,t=this.model,r;return t.predecessorMapping&&i[t.predecessorMapping]&&i[t.predecessorMapping].length>0?(r={},r.currentRecord=n.currentRecord,r.predecessorString=i[t.predecessorMapping].split(","),u._editedPredecessorValidation(r)?!0:(i[t.predecessorMapping]="",n.currentRecord.predecessor=null,n.currentRecord.predecessorsName="",!1)):!0},openAddDialog:function(){this.cancelEditCell();this._sendAddRequest()},openEditDialog:function(){this.cancelEditCell();this._sendEditRequest()},searchItem:function(t){var i=this;i.cancelEditCell();i._searchString!=t&&(i._$treegridHelper.ejTreeGrid("search",t),i._searchString=t,n("#gantt_search input").val(t))},addRecord:function(t,i){var f=this,o=this.model,it=o.selectionMode=="row"?this.selectedRowIndex():f._rowIndexOfLastSelectedCell,e=o.updatedRecords[it],u,nt=o.taskIdMapping,c=o.updatedRecords,w=o.flatRecords,b=o.parentRecords,tt=o.ids,l=this.dataSource(),y=0,k,h={},s,p,a,v,d,rt,g,ut;f.clearSelection();f.cancelEditCell();n.type(l)==="array"||l instanceof r.DataManager||(this.dataSource([]),l=this.dataSource());Object.prototype.toString.call(t)!=="[object Object]"&&(t={});(it!==-1||i!==r.Gantt.RowPosition.AboveSelectedRow&&i!==r.Gantt.RowPosition.BelowSelectedRow&&i!==r.Gantt.RowPosition.Child)&&i||(i=r.Gantt.RowPosition.Top);t[nt]&&(t[nt]=o.ids.indexOf(t[nt].toString())!=-1?null:isNaN(parseInt(t[nt]))?null:parseInt(t[nt]));f._updateAddData(t,i);f._isDataManagerUpdate&&(f._jsonData=f._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData"));switch(i){case r.Gantt.RowPosition.Top:if(y=0,s=null,u=f._createGanttRecord(t,y),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;w.splice(0,0,u);c.splice(0,0,u);tt.splice(0,0,u.taskId.toString());b.splice(0,0,u);f._isDataManagerUpdate?f._jsonData.splice(0,0,u.item):l.splice(0,0,u.item);k=0;break;case r.Gantt.RowPosition.Bottom:if(y=0,s=null,u=f._createGanttRecord(t,y),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;w.push(u);c.push(u);tt.push(u.taskId.toString());b.push(u);f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item);k=c.indexOf(u);break;case r.Gantt.RowPosition.AboveSelectedRow:if(y=e.level,s=e.parentItem,u=f._createGanttRecord(t,y,s),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;a=w.indexOf(e);v=c.indexOf(e);w.splice(a,0,u);c.splice(v,0,u);tt.splice(a,0,u.taskId.toString());r.isNullOrUndefined(s)?(b.splice(b.indexOf(e),0,u),f._isDataManagerUpdate?f._jsonData.splice(f._jsonData.indexOf(e.item),0,u.item):l.splice(l.indexOf(e.item),0,u.item)):(p=s.childRecords.indexOf(e),s.childRecords.splice(p,0,u),o.parentTaskIdMapping?(u.item[o.parentTaskIdMapping]=u.parentItem.taskId,f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item)):s.item[o.childMapping].splice(p,0,u.item));k=v;break;case r.Gantt.RowPosition.BelowSelectedRow:if(y=e.level,s=e.parentItem,u=f._createGanttRecord(t,y,s),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;d=w.indexOf(e);e.hasChildRecords?(dataChildCount=f._$treegridHelper.ejTreeGrid("getChildCount",e,0),a=d+dataChildCount+1,v=c.indexOf(e)+f._getVisibleChildRecordCount(e,0,c)+1):(a=d+1,v=c.indexOf(e)+1);w.splice(a,0,u);c.splice(v,0,u);tt.splice(a,0,u.taskId.toString());r.isNullOrUndefined(s)?(b.splice(b.indexOf(e)+1,0,u),f._isDataManagerUpdate?f._jsonData.splice(f._jsonData.indexOf(e.item)+1,0,u.item):l.splice(l.indexOf(e.item)+1,0,u.item)):(p=s.childRecords.indexOf(e),s.childRecords.splice(p+1,0,u),o.parentTaskIdMapping?(u.item[o.parentTaskIdMapping]=u.parentItem.taskId,f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item)):s.item[o.childMapping].splice(p+1,0,u.item));k=v;break;case r.Gantt.RowPosition.Child:if(y=e.level+1,s=e,u=f._createGanttRecord(t,y,s),u.index=u.taskId,h.data=t,h.currentRecord=u,!f._validateAddRecordPrecessorValue(h)&&f._isinAddnewRecord)return!1;d=w.indexOf(e);e.hasChildRecords?(dataChildCount=f._$treegridHelper.ejTreeGrid("getChildCount",e,0),a=d+dataChildCount+1,e.expanded||(rt={},rt.expanded=!0,rt.data=e,f._isInAdd=!0,f.expanding(rt),f._isInAdd=!1,c=f.getUpdatedRecords()),v=c.indexOf(e)+f._getVisibleChildRecordCount(e,0,c)+1):(e.hasChildRecords=!0,e.childRecords=[],e.expanded=!0,o.parentTaskIdMapping||(e.item[o.childMapping]=[]),e.isMilestone=!1,a=d+1,v=c.indexOf(e)+1,e.predecessor&&f._updatePredecessorOnIndentOutdent(e));w.splice(a,0,u);c.splice(v,0,u);tt.splice(a,0,u.taskId.toString());r.isNullOrUndefined(s)||(p=s.childRecords.indexOf(e),s.childRecords.splice(p+1,0,u),o.parentTaskIdMapping?(u.item[o.parentTaskIdMapping]=u.parentItem.taskId,f._isDataManagerUpdate?f._jsonData.push(u.item):l.push(u.item)):s.item[o.childMapping].splice(p+1,0,u.item));k=v}return f._deSelectRowItem(),f._$treegridHelper.ejTreeGrid("setUpdatedRecords",o.flatRecords,o.updatedRecords,o.ids,o.parentRecords,this.dataSource()),g={},g.requestType="save",g._cAddedRecord=g.addedRecord=u,g.index=k,f.actionComplete(g),o.enableWBS&&f.updateWBSdetails(),ut=f._$treegridHelper.ejTreeGrid("instance"),o.enableVirtualization===!1&&(ut.model.sortSettings.sortedColumns.length>0||ut._searchString.length>0)&&(f._isRefreshAddedRecord=!0),o.selectionMode=="cell"?(it=o.updatedRecords.indexOf(u),f._$treegridHelper.ejTreeGrid("updateScrollBar",it)):f._$treegridHelper.ejTreeGrid("updateScrollBar"),!0},updateWBSdetails:function(n,t,i){var h=this,e=h.model,r=n?n:e.selectionMode=="row"?e.selectedItem:e.updatedRecords[h._rowIndexOfLastSelectedCell],c,o,l,u,s,a,v,f,y;newWBS=r.WBS;r.parentItem?(c=r.parentItem.childRecords,o=c.indexOf(r),u=c,s=u.length):e.flatRecords.length&&(a=e.flatRecords,v=a.filter(function(n){return n&&n.level==0}),u=v,o=u.indexOf(r),s=u.length);l=t?u.slice(o,s):u.slice(o+1,s);l.length&&(f=newWBS.lastIndexOf(".")!=-1?parseInt(newWBS.substr(newWBS.lastIndexOf(".")+1)):parseInt(newWBS),y=r.parentItem?r.parentItem.WBS:null,t&&!i?f--:t&&i?f=f:f++,h.reCalculateWBS(l,f,y))},deleteItem:function(){var n=this;n.cancelEditCell();n._$treegridHelper.ejTreeGrid("deleteRow")},expandAllItems:function(){this.cancelEditCell();this._expandAll();this.updateSelectedItemIndex();this._$treegrid.focus()},collapseAllItems:function(){this._collapseAll();this.updateSelectedItemIndex();this._$treegrid.focus()},indentItem:function(){var e=this,r=this.model,u=e.model.flatRecords,n=r.selectedItem,t=!0,i,f;if(r.editSettings.allowIndent==!1)return!0;if(n&&(i=u.indexOf(n),i===0?t=!1:n.level===0?t=!0:(f=u[i-1],t=n.level-f.level==1?!1:!0)),t)this._sendIndentRequest();else return!1},outdentItem:function(){this._sendOutdentRequest()},updateGanttColumns:function(n){var t=this,i=t.model;i.columns=n;t._columns=n},cancelEdit:function(){this.sendCancelRequest()},expandCollapseRecord:function(t){var e=this,u={},i,o=this.model,h,s,f;i=o.flatRecords[o.ids.indexOf(t.toString())];!r.isNullOrUndefined(i)&&i.hasChildRecords&&(u={},u.expanded=i.expanded==!0?!1:!0,h=e.getExpandStatus(i),h?(u.data=i,u.expanded?e.expanding(u):e.collapsing(u)):(i.expanded=u.expanded,s=o.currentViewData.indexOf(i),s==-1||o.enableVirtualization||(f=n(e.getRows()[s]),i.expanded?(f.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),f.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")):(f.find(".e-treegridexpand").removeClass("e-treegridexpand").addClass("e-treegridcollapse"),f.removeClass("e-treegridrowexpand").addClass("e-treegridrowcollapse")))))},saveEdit:function(){var n=this;n._$treegridHelper.ejTreeGrid("endEdit")},setSplitterIndex:function(t){var r=this,e=r.model,f=r.getColumns(),u=0,o=n("#ejTreeGrid"+r._id+"e-gridcontent"),i;if(columnIndex=parseInt(t),columnIndex>-1&&columnIndex<f.length){for(i=0;i<=columnIndex;i++)u+=f[i].width;if(u>r._ganttWidth)for(u=0,i=0;i<=columnIndex;i++)if(u+f[i].width<=r._ganttWidth)u+=f[i].width,t=i;else{e.splitterSettings.index=t;break}else e.splitterSettings.index=columnIndex;o.ejScroller("isHScroll")&&o.ejScroller("scrollLeft",0);r.setSplitterPosition(u.toString())}},showCriticalPath:function(n,t){var a=this,tt=this.model.ids,h=this.model.flatRecords,y,e,g,yt,et,i,u,pt,ut,wt,l,ot,st;if(n==!0)if(this.isCriticalPathEnable=!0,h.length!=0){var r=[],ct,it,f=[],s=[],c=[],nt=[],lt=[],at=[],o=this.model.flatRecords,b=this.model.parentRecords,kt=[],ft=0,rt=0,vt=[],v,ht;for(v=this.model.parentRecords[0].endDate,this.model.parentRecords[0].manualEndDate>this.model.parentRecords[0].endDate&&!this.model.parentRecords[0].isAutoSchedule&&(v=this.model.parentRecords[0].manualEndDate),ht=this.model.parentRecords[0].taskId,y=1;y<b.length;y++)b[y].endDate>=v&&(v=b[y].endDate,ht=b[y].taskId),b[y].isAutoSchedule||b[y].manualEndDate>=v&&(v=b[y].manualEndDate,ht=b[y].taskId);for(e=0;e<o.length;e++)o[e].isCritical=!1,ft=a._getDuration(o[e].endDate,v,o[e].durationUnit,o[e].isAutoSchedule),o[e].slack=ft+" "+o[e].durationUnit,o[e].endDate>=v&&nt.push(o[e].taskId),o[e].predecessor&&o[e].predecessor.length!=0&&(r.push(o[e]),lt.push(o[e].taskId));for(g=0;g<nt.length;g++)lt.indexOf(nt[g])==-1?(rt=tt.indexOf(nt[g].toString()),h[rt].status<100&&(h[rt].isCritical=!0),h[rt].slack=0+h[rt].durationUnit,at.push(nt[g])):kt.push(nt[g]);for(yt=r.length,et=[],i=0;i<yt;i++){var p=-1,w=-1,k=-1,d=-1;for(ct=r[i].predecessor.length,it=parseInt(r[i].taskId),currentIndex=i,u=0;u<ct;u++)r[i].predecessor[u].from==it&&(p==-1?r[i].predecessor[u].offset?(p=r[i].predecessor[u].to+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,k=r[i].predecessor[u].predecessorsType):(p=r[i].predecessor[u].to,k=r[i].predecessor[u].predecessorsType):r[i].predecessor[u].offset?(p=p+","+r[i].predecessor[u].to+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,k=k+","+r[i].predecessor[u].predecessorsType):(p=p+","+r[i].predecessor[u].to,k=k+","+r[i].predecessor[u].predecessorsType)),r[i].predecessor[u].to==it&&(w==-1?r[i].predecessor[u].offset?(w=r[i].predecessor[u].from+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,d=r[i].predecessor[u].predecessorsType):(w=r[i].predecessor[u].from,d=r[i].predecessor[u].predecessorsType):r[i].predecessor[u].offset?(w=w+","+r[i].predecessor[u].from+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,d=d+","+r[i].predecessor[u].predecessorsType):(w=w+","+r[i].predecessor[u].from,d=d+","+r[i].predecessor[u].predecessorsType));w==-1&&(w=null,d=null);p==-1&&(p=null,k=null);f.push({from:w,fromPredecessor:d,taskid:it,to:p,toPredecessor:k,currentIndex:currentIndex,slack:null,ff:0,fs:0,enddate:null,fsslack:0});s.push(parseInt(it))}for(pt=f.length,ut=0,l=0;l<pt;l++)f[l].to||(wt=f[l].taskid,ut=tt.indexOf(wt.toString()),ft=a._getDuration(h[ut].endDate,v,"minute",h[ut].isAutoSchedule),f[l].slack=ft,f[l].fs=-1,f[l].enddate=h[ut].endDate,et.push({fromdata:f[l].from,todateID:f[l].taskid,fromDataPredecessor:f[l].fromPredecessor}));for(ot=0;ot<et.length;ot++)vt.push(et[ot]),a._slackCalculation(vt,f,s,v,h,tt);c=a._finalCriticalPath(f,at,h,tt);this.criticalPathCollection=c;this.detailPredecessorCollection=f;this.collectionTaskId=s;t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),a._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!0}else{var c=[],f=[],s=[];t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),this._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!0}if(n==!1){var c=[],f=[],s=[],bt=0;for(this.isCriticalPathEnable=!1,st=0;st<a.criticalPathCollection.length;st++)bt=tt.indexOf(a.criticalPathCollection[st].toString()),h[bt].isCritical=!1;t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),this._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!1}},_finalCriticalPath:function(n,t,i,r){for(var o=this,e=[],u,f=0;f<n.length;f++)u=r.indexOf(n[f].taskid.toString()),i[u].durationUnit=="day"?(i[u].slack=n[f].slack/60/(o._secondsPerDay/3600),i[u].slack=i[u].slack%1!=0?i[u].slack.toFixed(2)+" day":i[u].slack+" day"):i[u].durationUnit=="hour"?(i[u].slack=n[f].slack/60,i[u].slack=i[u].slack%1!=0?i[u].slack.toFixed(2)+" hour":i[u].slack+" hour"):i[u].slack=n[f].slack+" minutes",n[f].slack<=0&&i[u].status<100&&(i[u].isCritical=!0,e.push(n[f].taskid));return e.concat(t)},_slackCalculation:function(n,t,i,u,f,e){var l=this,w=n[0].fromdata.split(","),p=n[0].fromDataPredecessor.split(","),s=[],o,c,b=w.length,y,v,h,a;for(xx=0;xx<b;xx++)s=w[xx].split(":"),o=i.indexOf(parseInt(s[0])),c=i.indexOf(parseInt(n[0].todateID)),p[xx]=="FS"&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexfromtaskid].endDate>f[indexenddate].startDate?-l._getDuration(f[indexenddate].startDate,f[indexfromtaskid].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,f[indexenddate].startDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="SS"&&(indexfromtaskid=e.indexOf(s[0].toString()),f[indexfromtaskid].isAutoSchedule?(indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexfromtaskid].startDate>f[indexenddate].startDate?-l._getDuration(f[indexenddate].startDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].startDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate)):f[indexfromtaskid].isAutoSchedule||(enddate=0,h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&t[o].slack!=0&&(t[o].slack=h)),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="FF"&&(t[c].fs==1||t[c].ff==1||t[c].fs==-1?(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),t[c].fs==1?(y=f[indexenddate].endDate,v=t[c].slack):t[c].ff==1&&(y=f[indexenddate].endDate,v=t[c].slack),t[c].fs==-1&&(y=t[c].enddate,v=t[c].slack),h=y>f[indexfromtaskid].endDate?-l._getDuration(f[indexfromtaskid].endDate,y,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(y,f[indexfromtaskid].endDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=v-h<0?0:v-h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack-h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].ff=1,t[o].enddate=y,t[o].fsslack=v):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=v-h<0?0:v-h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack-h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].ff=1,t[o].enddate=y,t[o].fsslack=v)):(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?s.length<=1?r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&(t[o].slack=h):s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&(t[o].slack=h):s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0))),t[o].ff=1),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="SF"&&(indexfromtaskid=e.indexOf(s[0].toString()),f[indexfromtaskid].isAutoSchedule?r.isNullOrUndefined(t[o].slack)?(s.length<=1?r.isNullOrUndefined(t[c].to)?(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack=h):r.isNullOrUndefined(t[c].to)||(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].startDate?-l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack=t[c].slack+h<0?0:t[c].slack+h):s.length>1&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].endDate?f[indexfromtaskid].startDate>f[indexenddate].endDate?-l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):(s.length<=1?(r.isNullOrUndefined(t[c].to)?(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule)):r.isNullOrUndefined(t[c].to)||(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].startDate?-l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule)),t[o].slack>h&&t[o].slack!=0&&(r.isNullOrUndefined(t[c].to)?t[o].slack=h:r.isNullOrUndefined(t[c].to)||(t[o].slack=t[c].slack+h<0?0:t[c].slack+h))):s.length>1&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].endDate?f[indexfromtaskid].startDate>f[indexenddate].endDate?-l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack>h&&t[o].slack!=0&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0))),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):f[indexfromtaskid].isAutoSchedule||(h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&t[o].slack!=0&&(t[o].slack=h)),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),t[o].from&&n.push({fromdata:t[o].from,todateID:t[o].taskid,fromDataPredecessor:t[o].fromPredecessor});n&&(n.splice(0,1),n.length>0&&l._slackCalculation(n,t,i,u,f,e))},setSplitterPosition:function(t){var i=this,o=i.model,e=0,f;if(ganttWidth=parseInt(i._ganttWidth)-i._totalBorderWidth,isPercentage=!1,!r.isNullOrUndefined(t)){if(t.indexOf("%")!=-1?(u=parseInt(t),isPercentage=!0):(u=parseInt(t)/i._ganttWidth*100,isPercentage=!1),u=isNaN(u)?0:u,u<=100)u=u<0?0:u,e=100-u-900/ganttWidth,e<=0?(isPercentage?i.splitterPosition("100%"):i.splitterPosition(ganttWidth.toString()),u=100-900/ganttWidth,e=0):e>0&&(isPercentage?i.splitterPosition(Math.round(u)+"%"):i.splitterPosition(Math.round(u*i._ganttWidth/100).toString())),f=n("#e-ejSpliter"+i._id).ejSplitter("instance"),f.model.properties[0].paneSize=u+"%",f.model.properties[1].paneSize=e+"%",f.refresh(),i._$treegridHelper.ejTreeGrid("refreshScroller",Math.round(u*ganttWidth/100)),i._$ganttchartHelper.ejGanttChart("refreshScroller",f.model.properties[1].paneSize-1),i._clearContextMenu();else{var f=n("#e-ejSpliter"+i._id).ejSplitter("instance"),u=f.model.properties[0].paneSize,e=f.model.properties[1].paneSize;parseInt(e)==0?isPercentage?i.splitterPosition("100%"):i.splitterPosition(ganttWidth.toString()):isPercentage?i.splitterPosition(Math.round(parseInt(u)/ganttWidth*100)+"%"):i.splitterPosition(u.toString())}i._splitterPosition(i.splitterPosition())}},_showTooltip:function(n){var t=this;this.model.enableTaskbarTooltip=n;t._$ganttchartHelper.ejGanttChart("showTooltip",n)},_showEditingTooltip:function(n){var t=this;this.model.enableTaskbarDragTooltip=n;t._$ganttchartHelper.ejGanttChart("showEditingTooltip",n)},_ganttChartEditing:function(t){var i=this;i.model.allowGanttChartEditing=t;i._$ganttchartHelper.ejGanttChart("ganttChartEditing",t);t?(n(".e-gantt-childtaskbar, .e-tasklabel, .progressbar").css({cursor:"move"}),n(".taskbarresizer-right").css({cursor:"w-resize"}),n(".taskbarresizer-left").css({cursor:"e-resize"})):n(".e-gantt-childtaskbar, .e-tasklabel, .progressbar, .taskbarresizer-right, .taskbarresizer-left").css({cursor:"auto"})},_resizeProgressbar:function(n){var t=this;t.model.enableProgressBarResizing=n;t._$ganttchartHelper.ejGanttChart("resizeProgressbar",n)},_milestoneTemplate:function(n){var t=this;t.model.milestoneTemplate=n;t._$ganttchartHelper.ejGanttChart("changeMilestoneTemplate",t.model.milestoneTemplate)},_taskbarTemplate:function(n){var t=this;t.model.taskbarTemplate=n;t._$ganttchartHelper.ejGanttChart("changeTaskbarTemplate",t.model.taskbarTemplate)},_parentTaskbarTemplate:function(n){var t=this;t.model.parentTaskbarTemplate=n;t._$ganttchartHelper.ejGanttChart("changeParentTaskbarTemplate",t.model.parentTaskbarTemplate)},_sendSortingRequest:function(n){var t=this;t.model.sortSettings=n;t._$treegridHelper.ejTreeGrid("option","sortSettings",n)},_sortingRequest:function(n){var t=this,i=t.model;t.model.allowSorting=n;t._$treegridHelper.ejTreeGrid("sortSetting",n)},_columnIndex:function(n){var t=this;t._$treegridHelper.ejTreeGrid("columnIndex",n)},sendCancelRequest:function(){var t=this,i=n("#"+t._id+"_toolbarItems");t._$treegridHelper.ejTreeGrid("cancelEditCell");t.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&t._disabledToolItems.push(n(i).find(".e-cancel").parent()[0]);t.model.toolbarSettings.toolbarItems.indexOf("save")!==-1&&t._disabledToolItems.push(n(i).find(".e-saveitem").parent()[0]);n(i).ejToolbar("disableItem",t._disabledToolItems);t._disabledToolItems=[]},_sendAddRequest:function(){var t=this,i=t._columns,f=i.length,n=0,u={},r={};for(t._isinAddnewRecord=!0,n;n<f;n++)i[n].mappingName&&(u[i[n].mappingName]="");r.data=u;r.requestType="add";t.renderedEditDialog(r)},_sendEditRequest:function(t){var i=this,e=i.model,u={},f;r.isNullOrUndefined(t)?(i._currentTrIndex=e.selectionMode=="row"?this.selectedRowIndex():i._rowIndexOfLastSelectedCell,i._$currentTr=n(i._$treegridHelper.ejTreeGrid("getRows")).eq(this.selectedRowIndex())):(i._currentTrIndex=t.index(),i._$currentTr=t);f=i.getUpdatedRecords()[i._currentTrIndex];u.data=f;u.requestType="beginedit";u.data&&i.renderedEditDialog(u)},_updateAddData:function(n,t){var u=this,i=this.model,f,e;n[i.taskIdMapping]||(f=i.flatRecords.length,f=u._getNewTaskId(f),n[i.taskIdMapping]=f);i.taskNameMapping&&!n[i.taskNameMapping]&&(n[i.taskNameMapping]=u._newTaskTexts.newTaskName+" "+n[i.taskIdMapping]);n[i.startDateMapping]||(n[i.startDateMapping]=i.scheduleStartDate);i.durationMapping&&r.isNullOrUndefined(n[i.durationMapping])&&(n[i.endDateMapping]||(n[i.durationMapping]="5"));i.progressMapping&&(n[i.progressMapping]=n[i.progressMapping]?n[i.progressMapping]>100?100:n[i.progressMapping]:0);!n[i.endDateMapping]&&i.endDateMapping&&(n[i.durationMapping]||(e=u._getDateFromFormat(i.scheduleStartDate),e.setDate(e.getDate()+4),n[i.endDateMapping]=r.format(e,this.model.dateFormat,this.model.locale)));i.enableWBS&&!n.WBS&&(n.WBS=u._getNewWBSid(t));i.enableWBS&&!n.WBS&&(n.WBS=u._getNewWBSid(t));r.isNullOrUndefined(i.selectedItem)||(n.taskType=i.workMapping?r.Gantt.TaskType.FixedWork:i.selectedItem.taskType,n.effortDriven=i.workMapping?"true":i.selectedItem.effortDriven)},_sendSaveRequest:function(t){var e={},wt=document,i=this,u=i.model,v,bt,ti,p,it,l,rt,d,g,w,ft,f={},c,et,b,ot,a,o,st,ht,ut,ct,s,yt,kt,nt,dt,h,y,k,pt,gt,tt,ni;if(this._duplicate=!1,this._wrongenddate=!1,t==="Add"){if(v=wt.querySelectorAll("#"+i._id+"GeneralAddForm","#"+i._id+"PredecessorAddForm","#"+i._id+"ReosurceAddForm","#"+i._id+"CustomFieldsAddForm"),bt=v&&v.length,rt="Add",d="#treegrid"+i._id+"predecessorAdd",g="#treegrid"+i._id+"resourceAdd",w="#treegrid"+i._id+"customFieldAdd",ft="#"+i._id+"AddAreaNotes",p=n("#"+i._id+"taskId"+rt),it=r.TreeGrid.getColumnByField(i._columns,"taskId"),i._cellEditColumn=it,c=i._addDialogGeneralColumns,et=c.length,b=i._addDialogCustomColumns,ot=b.length,it&&p.length>0&&(l=i.getCurrentEditCellData(p,it.dropdownData)),i.model.ids.indexOf(l)!=-1&&l?this._duplicate=!0:l&&(this._duplicate=!1),!this.addFormValidate())return!0}else if(v=wt.getElementById(i._id+"GeneralEditForm"),bt=v&&v.length,d="#treegrid"+i._id+"predecessorEdit",g="#treegrid"+i._id+"resourceEdit",w="#treegrid"+i._id+"customFieldEdit",ft="#"+i._id+"EditAreaNotes",rt="Edit",c=i._editDialogGeneralColumns,et=c.length,b=i._editDialogCustomColumns,ot=b.length,!this.editFormValidate())return!0;if(ti=n(v).closest("div"),this._duplicate)return alert(i._alertTexts.idValidationAlert),!0;for(o=0;o<et;o++)if(p=n(v).find("#"+i._id+c[o].field+rt),p.length>0){if(i._cellEditColumn=c[o],i._cellEditColumn.field=="duration"||i._cellEditColumn.field=="startDate"||i._cellEditColumn.field=="endDate"){e[c[o].mappingName]=this._editedDialogRecord[i._cellEditColumn.field];i._cellEditColumn.field=="duration"&&u.durationUnitMapping&&(e[u.durationUnitMapping]=this._editedDialogRecord.durationUnit);continue}l=i.getCurrentEditCellData(p,c[o].dropdownData);i._isinAddnewRecord===!1&&c[o].mappingName===i.model.predecessorMapping&&(f.previousValue=i._updatePredecessorValue(null,l));c[o].mappingName===i.model.progressMapping&&r.isNullOrUndefined(l)&&(l=0);(u.workMapping||i._cellEditColumn.field!="work")&&i._cellEditColumn.field!="taskType"&&i._cellEditColumn.field!="effortDriven"?e[c[o].mappingName]=l:e[c[o].field]=l}if(n(w).length)for(n(w).ejTreeGrid("model.isEdit")&&n(w).ejTreeGrid("saveCell"),a=n(w).ejTreeGrid("model.updatedRecords"),o=0;o<ot;o++)e[b[o].mappingName]=b[o].editType=="dropdownedit"?a[o].value:a[o].text;if(st=n(ft),st.length&&(e[u.notesMapping]=st.ejRTE("getHtml")),date1=i._getDateFromFormat(e[u.startDateMapping]),date2=i._getDateFromFormat(e[u.endDateMapping]),ht=0,date1&&date2&&(ht=date2.getTime()-date1.getTime()),this._wrongenddate=ht<0?!0:!1,this._wrongenddate)return alert(i._alertTexts.dateValidationAlert),!0;if(ut=n(g),ct=!0,ut.length>0){n(ut).ejTreeGrid("model.isEdit")&&n(ut).ejTreeGrid("saveCell");var lt=[],a=n(g).ejTreeGrid("option","dataSource"),ii=n(g).ejTreeGrid("option","selectedRowIndex");if(n.each(a,function(f,o){var l,c,v,y;if(o.name!=null&&o.name!="")if(c=n.map(u.resources,function(n,t){if(n[u.resourceIdMapping].toString()==o.name)return t}),l=u.resources[c[0]],t==="Add")lt.push(l[u.resourceIdMapping]),l[u.resourceUnitMapping]=o.unit,i._newRecordResourceCollection.push(l);else{r.isNullOrUndefined(u.selectedItem.resourceInfo)&&(u.selectedItem.resourceInfo=[]);var p=i.model,h=p.selectedItem,s=h.resourceInfo,w=p.resourceIdMapping;if((r.isNullOrUndefined(s)||s.length!=a.length)&&(i._isResourceAddedOrRemoved=!0),s)for(c=0;c<s.length;c++)if(s[c][w]===l[w]){v=c;break}else v=-1;else s=[];(r.isNullOrUndefined(v)||v==-1)&&s.length!=a.length&&(y=n.extend({},l),p.selectedItem._updateResourceUnit(l,y,u.resourceUnitMapping),y[u.resourceUnitMapping]=100,s.push(y));s[f][u.resourceUnitMapping]!=a[f].unit&&(i._isExistingUnitIsUpdated=!0);s[f][u.resourceIdMapping]=parseInt(a[f].name);s[f][u.resourceNameMapping]=u.resources[parseInt(a[f].name)-1][u.resourceNameMapping];s[f][u.resourceUnitMapping]=a[f].unit;lt.push(s[f]);i._isExistingUnitIsUpdated&&(h.isAutoSchedule&&h.taskType!="fixedDuration"?h._updateDurationWithWork(i):h._updateWorkWithDuration(i),e.Duration=h.duration,u.workMapping?e[u.workMapping]=h.work:e.work=h.work,i._editedDialogRecord.duration=h.duration,i._editedDialogRecord.work=h.work,i._isExistingUnitIsUpdated=!1)}else return ct=!1,!1}),ct)e[u.resourceInfoMapping]=lt;else return alert(i._alertTexts.dialogResourceAlert),!0}e[u.taskIdMapping]||t!=="Edit"||(e[u.taskIdMapping]=i._editedDialogRecord.taskId);f.data=e;var at=[],vt=!1;if(u.predecessorMapping&&(t==="Edit"?(vt=u.editDialogFields.length===0?!0:!1,at=n.grep(u.editDialogFields,function(n){return n.field===u.predecessorMapping})):t==="Add"&&(vt=u.addDialogFields.length===0?!0:!1,at=n.grep(u.addDialogFields,function(n){return n.field===u.predecessorMapping}))),at.length>0||vt){if(s=[],yt=!0,n(d).ejTreeGrid("model.isEdit")&&n(d).ejTreeGrid("saveCell"),s=n(d).ejTreeGrid("option","dataSource"),n.each(s,function(n,t){(r.isNullOrUndefined(t.id)||r.isNullOrUndefined(t.name)||r.isNullOrUndefined(t.type)||!(t.id.length>0&&t.name.length&&t.type.length))&&(yt=!1)}),yt){for(kt=[],nt=[],types=i._predecessorCollectionText,h=0;h<s.length;h++){for(y={},y.from=e.taskID,y.to=s[h].id,y.isdrawn=!1,y.offset=s[h].offset,k=0;k<types.length;k++)if(s[h].type==types[k].text){y.predecessorType=types[k].id;dt=types[k].id;break}pt=s[h].id+dt;s[h].offset=parseFloat(s[h].offset);s[h].offset!==0&&(pt+=s[h].offset<0?s[h].offset.toString():"+"+s[h].offset.toString());nt.push(pt);kt.push(y)}f.predecessorString=nt}else return alert(i._alertTexts.predecessorAddingValidationAlert),!0;if(i._isinAddnewRecord===!1)if(f.currentRecord=u.selectionMode=="row"?this.selectedItem():u.updatedRecords[i._rowIndexOfLastSelectedCell],i._editedPredecessorValidation(f))f.previousValue=i._updatePredecessorValue(null,nt.join(","));else return alert(i._alertTexts.predecessorEditingValidationAlert),!0;e[u.predecessorMapping]=nt.join(",")}if(f.requestType=r.TreeGrid.Actions.Save,f.recordIndex=this.selectedRowIndex()!==-1?this.selectedRowIndex():-1,i._trigger("actionBegin",f))return!0;if(t==="Edit")f._cModifiedData=i._updateRecord(e),i._editedDialogRecord&&(f._cModifiedData.startDate=new Date(i._editedDialogRecord.startDate),f._cModifiedData.endDate=new Date(i._editedDialogRecord.endDate),f._cModifiedData.duration=i._editedDialogRecord.duration,f._cModifiedData.durationUnit=i._editedDialogRecord.durationUnit,i._isResourceAddedOrRemoved&&i._updateResourceRelatedFields(f._cModifiedData),u.durationUnitMapping&&(f._cModifiedData.item[u.durationUnitMapping]=i._editedDialogRecord.durationUnit),i._editedDialogRecord=null),f.data[u.endDateMapping]&&(r.isNullOrUndefined(f.data[u.durationMapping])||f.data[u.durationMapping]==="")&&i._isDurationUpdated==!1&&(f._cModifiedData.startDate=i._checkStartDate(f._cModifiedData.startDate,f._cModifiedData),f._cModifiedData.endDate=i._checkEndDate(f._cModifiedData.endDate,f._cModifiedData),f._cModifiedData._calculateDuration(this)),f._cModifiedData.isMilestone=f._cModifiedData.duration==0&&f._cModifiedData.startDate.getTime()==f._cModifiedData.endDate.getTime()?!0:!1,f.data[u.baselineStartDateMapping]&&f.data[u.baselineEndDateMapping]&&(gt=i._getDateFromFormat(f.data[u.baselineStartDateMapping]),tt=i._getDateFromFormat(f.data[u.baselineEndDateMapping]),tt&&tt.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,tt),f._cModifiedData.baselineStartDate=this._checkBaseLineStartDate(gt),f._cModifiedData.baselineEndDate=this._checkBaseLineEndDate(tt),f._cModifiedData.baselineLeft=f._cModifiedData._calculateBaselineLeft(this),f._cModifiedData.baselineRight=f._cModifiedData._calculateBaselineRight(this),f._cModifiedData.baselineWidth=f._cModifiedData._calculateBaseLineWidth(this)),f.modifiedRecord=f._cModifiedData,i.actionComplete(f);else if(t==="Add"&&(ni=i._addPosition!=null?i._addPosition:u.editSettings.rowPosition,!i.addRecord(e,ni)))return alert(i._alertTexts.predecessorEditingValidationAlert),!0;return i._cModifiedData=null,i._cAddedRecord=null,i._primaryKeyValues=[],i._isinAddnewRecord=!1,i._isResourceAddedOrRemoved=!1,!1},_recordReturnerByID:function(n){for(var r=this,i=r.model.flatRecords,t=0;t<i.length;t++)if(i[t].taskId.toString()===n.toString())return i[t];return null},_editedPredecessorValidation:function(t){var h=this,c=t.currentRecord.taskId,i,l=t.predecessorString.join(","),u,e,o,s,y,f,p,w;if(l.length>0)for(u=h._idFromPredecessor(l),e=0;e<u.length;e++){if(o=t.currentRecord,o&&o.parentItem&&u.indexOf(o.parentItem.taskId.toString())!==-1)return!1;var b=u.slice(0),a=[],v=!0;if(n.each(b,function(n,t){a.indexOf(t)===-1?a.push(t):v=!1}),v===!1)return!1;for(i=u[e],s=[],y=u.slice(0),y.splice(e,1);i!==null;)if(f=[],s.indexOf(i)===-1){if((currentRecord=h._recordReturnerByID(i),r.isNullOrUndefined(currentRecord))||(!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0&&n.each(currentRecord.predecessor,function(n,t){currentRecord.taskId.toString()!==t.from&&(f.push(t.from.toString()),p=n)}),c.toString()===currentRecord.taskId.toString()||f.indexOf(c.toString())!==-1))return!1;if(s.push(i),!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0){if(f.length>1?w=this._predecessorValidation(f,t):f.length==1&&(i=currentRecord.predecessor[p].from),w===!1)return!1}else break}else break}return!0},_predecessorValidation:function(t,i){for(var f,s,e,h=this,o=i.currentRecord.taskId,u=0;u<t.length;u++)for(currentId=t[u],f=[],s=t.slice(0),s.splice(u,1);currentId!==null;)if(e=[],f.indexOf(currentId)===-1){if((currentRecord=h._recordReturnerByID(currentId),r.isNullOrUndefined(currentRecord))||(!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0&&n.each(currentRecord.predecessor,function(n,t){currentRecord.taskId.toString()!==t.from&&e.push(t.from.toString())}),o.toString()===currentRecord.taskId.toString()||e.indexOf(o.toString())!==-1))return!1;if(f.push(currentId),!r.isNullOrUndefined(currentRecord.predecessor)&¤tRecord.predecessor.length>0)currentId=currentRecord.predecessor[0].from;else break}else break;return!0},_sendCancelRequest:function(){var t=this,u=t.model,i={};u.dateFormat.toLowerCase().indexOf("hh")!=-1?n("#"+t._id+"EditForm").find(".e-datepicker").ejDateTimePicker("destroy"):n("#"+t._id+"EditForm").find(".e-datepicker").ejDatePicker("destroy");i.requestType=r.TreeGrid.Actions.Cancel;t._$treegridHelper.ejTreeGrid("processBindings",i);t._primaryKeyValues=[];t.model.currentData=null},_updatePredecessorValue:function(n,t){var e=this,u,o,a=0,h,c=[],s=0,i=r.isNullOrUndefined(n)?model.selectionMode=="row"?e.selectedItem():model.updatedRecords[e._rowIndexOfLastSelectedCell]:n,f,l;for(u=i.predecessor,t.length>0&&(o=i._calculatePredecessor(t,this._durationUnitEditText,this.model.durationUnit)),o&&(a=o.length),f=0,l=0,u&&(l=u.length),f=0;f<l;f++)h=u[f],h.from===i.taskId.toString()&&c.push(h);for(s=0;s<a;s++)c.push(o[s]);return i.predecessor=c,e.model.predecessorMapping&&(i.item[e.model.predecessorMapping]=t,i.predecessorsName=t),u},getCurrentEditCellData:function(t,i){var u=this,o=u.model,e,f;if(n("#"+u._id+"EditForm").length||n("#"+u._id+"GeneralAddForm").length||n("#"+u._id+"GeneralEditForm").length){f="";switch(u._cellEditColumn.editType){case r.TreeGrid.EditingType.String:f=t.val();break;case r.TreeGrid.EditingType.Numeric:f=t.ejNumericTextbox("getValue");break;case r.TreeGrid.EditingType.Dropdown:f=t.attr("id").indexOf("resourceInfo")>0?u._getSelectedItem(t.ejDropDownList("model.selectedItems"),i):t.attr("id").indexOf("taskMode")>0?t.ejDropDownList("model.value")=="true"?!0:!1:t.ejDropDownList("model.value");break;case r.TreeGrid.EditingType.Boolean:f=t.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:e=t.ejDatePicker("model.value");f=u._cellEditColumn&&!u._cellEditColumn.format?u.getFormatedDate(e):e;break;case r.TreeGrid.EditingType.DateTimePicker:e=t.ejDateTimePicker("model.value");f=u._cellEditColumn&&!u._cellEditColumn.format?f=u.getFormatedDate(e):e;break;case r.TreeGrid.EditingType.Maskedit:f=t.ejMaskEdit("model.value")}return f}return null},_getSelectedItem:function(t,i){var r=0,f=t.length,u=[];if(i)for(r=0;r<f;r++)n.each(i,function(n,i){t[r]===n&&u.push(i)});return u},_getDropDownText:function(t,i){var s,u,o,f,h=t.dropdownData,e;for(i=i.split(","),selectedDropDownText=[],s=i.length,u=t.editParams,u&&u.fields?(f=u.fields.text?u.fields.text:"text",o=u.fields.value?u.fields.value:"value"):(o="value",f="text"),e=0;e<s;e++)n.each(h,function(n,t){if(r.isNullOrUndefined(t[o])){if(i[e]===t[f].toString())return selectedDropDownText.push(t[f].toString()),!1}else if(i[e]===t[o].toString())return selectedDropDownText.push(t[f]),!1});return selectedDropDownText.join(",")},_updateRecord:function(t){var f=this,e=this.model,r=f._columns,c,i=0,l=e.selectionMode=="row"?this.selectedRowIndex():f._rowIndexOfLastSelectedCell,u=f.getUpdatedRecords()[l],s,o,h;if(f._isUpdateOffset=!1,e.editDialogFields.length>0){for(s=[],o=0;o<e.editDialogFields.length;o++)h=n.grep(f._columns,function(n){return n.mappingName===e.editDialogFields[o].field}),h.length&&s.push(h[0]);r=s}for(c=r.length,i=0;i<c;i++)r[i].field.toString()!=="predecessor"&&(r[i].field=="startDate"&&u[r[i].field].getTime()!=t[r[i].mappingName].getTime()&&(f._isUpdateOffset=!0),r[i].field=="endDate"&&u[r[i].field].getTime()!=t[r[i].mappingName].getTime()&&(f._isUpdateOffset=!0),r[i].field=="duration"&&u[r[i].field]!=t[r[i].mappingName]&&(f._isUpdateOffset=!0),r[i].field=="taskMode"&&(u.isAutoSchedule=!t[e.taskSchedulingModeMapping]),r[i].field!="work"&&r[i].field!="taskType"&&(u[r[i].field]=t[r[i].mappingName],u.item[r[i].mappingName]=t[r[i].mappingName]),r[i].field=="work"&&(e.workMapping?(u[r[i].field]=t[r[i].mappingName],u.item[r[i].mappingName]=t[r[i].mappingName]):u[r[i].field]=t[r[i].field]),(r[i].field=="taskType"||r[i].field=="effortDriven")&&(u[r[i].field]=t[r[i].field]),r[i].field.toString()==="resourceInfo"&&f._updateResourceName(u),r[i].field.toString()==="notesText"&&(u.notes=t[e.notesMapping],u.notesText=f._getPlainText(t[e.notesMapping]),u.item[e.notesMapping]=t[e.notesMapping]));return u},updateRecordByTaskId:function(n){var f=this,t=f.model,u,i=n[t.taskIdMapping],o,e;id=typeof i=="number"?i.toString():typeof i=="string"?i:null;r.isNullOrUndefined(id)||(u=t.ids.indexOf(id),u>-1&&(o=t.flatRecords[u],e=t.updatedRecords.indexOf(o),f.updateRecordByIndex(e,n)))},updateRecordByIndex:function(n,t){var h=this,o=h.model,y=o.updatedRecords,c={},a=n,i=a>-1?y.length>0?y[a]:null:null,f,v,l,s,e,p;if(h.cancelEditCell(),!r.isNullOrUndefined(i)){for(v=h.getColumns(),t[o.taskIdMapping]=i.item[o.taskIdMapping],f=h._createGanttRecord(t,i.level,i.parentItem,u),i.isAutoSchedule=f.isAutoSchedule,i.isMilestone=f.isMilestone,l=0;l<v.length;l++)if(s=v[l],e=s.field,!r.isNullOrUndefined(s.mappingName)){if(e=="taskId")continue;else if(i.hasChildRecords&&i.isAutoSchedule&&(e=="startDate"||e=="endDate"||e=="duration"||e=="status"||e=="predecessor"||e=="WBSPredecessor"))continue;e=="predecessor"?(p=r.isNullOrUndefined(f.item[o.predecessorMapping])?"":f.item[o.predecessorMapping],c.previousValue=h._updatePredecessorValue(i,p)):e!="duration"||r.isNullOrUndefined(f.item[o.durationUnitMapping])?e=="notesText"?(i.notes=f.notes,i.notesText=f.notesText,i.item[o.notesMapping]=f.item[o.notesMapping]):(i[e]=f[e],i.item[s.mappingName]=f.item[s.mappingName]):(i.item[o.durationUnitMapping]=f.item[o.durationUnitMapping],i.durationUnit=f.durationUnit,i[e]=f[e],i.item[s.mappingName]=f.item[s.mappingName])}c.requestType=r.TreeGrid.Actions.Save;c.recordIndex=a;c._cModifiedData=i;h.actionComplete(c)}},_sendIndentRequest:function(){var t=this,i=t.model,n=t.getCurrentData(),f={},c={},u,s=!1,y=t._$treegridHelper.ejTreeGrid("instance"),l,o,e,p,h,a,v,w;if(t.cancelEditCell(),r.isNullOrUndefined(n))alert(t._alertTexts.indentAlert);else if(u=i.flatRecords[i.flatRecords.indexOf(n)-1],f.data=n,f.requestType="indent",!t._trigger("actionBegin",f)){if(n.parentItem?(l=n.parentItem.childRecords.indexOf(n),n.parentItem.childRecords.splice(l,1),i.parentTaskIdMapping||n.parentItem.item[i.childMapping].splice(l,1)):this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?(o=this.dataSource().dataSource.json.indexOf(n.item),i.parentTaskIdMapping||this.dataSource().dataSource.json.splice(o,1)):t._isDataManagerUpdate&&(o=t._jsonData.indexOf(n.item),i.parentTaskIdMapping||(t._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),t._jsonData.splice(o,1))):(o=this.dataSource().indexOf(n.item),i.parentTaskIdMapping||this.dataSource().splice(o,1)),n.level===u.level?u.childRecords?u.expanded||(u.childRecords.splice(u.childRecords.length,0,n),n.parentItem=u,i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.taskId:u.item[i.childMapping].splice(u.childRecords.length,0,n.item)):(u.childRecords=[],u.childRecords.push(n),u.expanded=!0,u.taskType=r.Gantt.TaskType.FixedDuration,u.effortDriven="false",n.parentItem=u,u.item[i.childMapping]=[],i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.taskId:u.item[i.childMapping].push(n.item)):u.level-n.level==1?(u.parentItem.childRecords.splice(u.parentItem.childRecords.length,0,n),i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.parentItem.taskId:u.parentItem.item[i.childMapping].splice(u.parentItem.childRecords.length,0,n.item),n.parentItem=u.parentItem):u.level-n.level>1&&(e=t.getParentItem(u,n.level),e.childRecords.splice(e.childRecords.length,0,n),i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=e.taskId:e.item[i.childMapping].splice(e.childRecords.length,0,n.item),n.parentItem=e),n.parentItem.isMilestone&&(n.parentItem.isMilestone=!1),u.hasChildRecords=u.childRecords?u.childRecords.length>0:!1,n.level+=1,(y._searchString.length>0||y.model.sortSettings.sortedColumns.length>0)&&(s=!0),t.updateLevel(n,1,s),s||t.refreshGanttRecord(n),u.level===0&&i.parentRecords.indexOf(u)===-1&&i.parentRecords.push(u),n.level>0&&i.parentRecords.indexOf(n)!==-1&&(p=i.parentRecords.indexOf(n),i.parentRecords.splice(p,1)),n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n),n.parentItem&&n.parentItem.predecessor&&i.predecessorMapping&&t._updatePredecessorOnIndentOutdent(n.parentItem),s||t.refreshGanttRecord(u),t.getExpandStatus(n)||(h={},h.expanded=!0,h.data=n.parentItem,t.expanding(h)),t._$treegridHelper.ejTreeGrid("setUpdatedRecords",i.flatRecords,i.updatedRecords,i.ids,i.parentRecords,this.dataSource()),s&&(f.requestType="indent",t._$treegridHelper.ejTreeGrid("processBindings",f),a={},a.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",a),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",i.currentViewData,i.updatedRecords,i.flatRecords,i.ids),t._$ganttchartHelper.ejGanttChart("refreshHelper",i.currentViewData,i.updatedRecords,t._totalCollapseRecordCount),t.updateAltRow(i.updatedRecords,0,1)),i.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection()),v=i.updatedRecords.indexOf(n),w=t.getGanttChartRows(),f={rowElement:w.eq(v),data:t.model.selectedItem,recordIndex:v},t._$ganttchartHelper.ejGanttChart("selectRows",f.recordIndex),t._$treegridHelper.ejTreeGrid("selectRows",f.recordIndex),this.selectedItem(f.data),this.selectedRowIndex(f.recordIndex),i.allowSelection&&i.selectionMode!="cell"&&t.updateIndentOutdentOption(n),i.enableWBS){var b=n.parentItem.WBS,k=n.parentItem.childRecords.length,d=[n];t.reCalculateWBS(d,k,b);t.updateWBSdetails(n.parentItem)}c.data=n;c.requestType="indent";this._trigger("actionComplete",c)}this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_updatePredecessorOnIndentOutdent:function(n){for(var o,i=this,h=n.predecessor.length,u=n.predecessor,e,t,f,s=[],r=0;r<h;r++)u[r].to===n.taskId.toString()?(t=i.model.flatRecords[i.model.ids.indexOf(u[r].from)],e=t.predecessor.indexOf(u[r]),t.predecessor.splice(e,1),f="parent"+t.taskId+"child"+n.taskId,i._$ganttchartHelper.ejGanttChart("removeConnectorline",f),this._updateConnectorLineCollection(f)):u[r].from===n.taskId.toString()&&(t=i.model.flatRecords[i.model.ids.indexOf(u[r].to)],n.childRecords.indexOf(t)!==-1?(e=t.predecessor.indexOf(u[r]),t.predecessor.splice(e,1),o=i._predecessorToString(t.predecessor,t),t.item[model.predecessorMapping]=o,t.predecessorsName=o,model.enableWBS&&model.enableWBSPredecessor&&i._$treegridHelper.ejTreeGrid("updateWBSPredecessor",t),f="parent"+n.taskId+"child"+t.taskId,i._$ganttchartHelper.ejGanttChart("removeConnectorline",f),this._updateConnectorLineCollection(f),i.refreshGanttRecord(t)):s.push(u[r]));n.predecessor=s;n.item[model.predecessorMapping]="";n.predecessorsName="";model.enableWBS&&model.enableWBSPredecessor&&(n.WBSPredecessor="",n.item.WBSPredecessor="")},_removePredecessor:function(n,t){var r=this,o=n.length,u=0,f=r.model,i,e;for(u;u<o;u++)n[u].from!==t.taskId.toString()?i=r.model.flatRecords[r.model.ids.indexOf(n[u].from)]:n[u].to!==t.taskId.toString()&&(i=r.model.flatRecords[r.model.ids.indexOf(n[u].to)]),i&&(e=i.predecessor.indexOf(n[u]),e!==-1&&i.predecessor.splice(e,1),i.item[f.predecessorMapping]&&(i.item[f.predecessorMapping]=r._predecessorToString(i.predecessor,i),i.predecessorsName=i.item[f.predecessorMapping],f.enableWBS&&f.enableWBSPredecessor&&r._$treegridHelper.ejTreeGrid("updateWBSPredecessor",i),r.refreshGanttRecord(i)))},_predecessorToString:function(n,t){var e=this,u=[],i=0,f=n.length,r;for(i;i<f;i++)t.taskId.toString()!==n[i].from&&(r=n[i].from+n[i].predecessorsType,n[i].offset=isNaN(n[i].offset)?0:n[i].offset,n[i].offset!==0&&(n[i].offset<0?r+=n[i].offset.toString()+"d":n[i].offset>0&&(r+="+"+n[i].offset.toString()+"d")),u.push(r));return u.join(",")},getParentItem:function(n,t){var i=this;return n.parentItem.level===t?n.parentItem:i.getParentItem(n.parentItem,t)},getSubChangeIndex:function(n,t,i){for(var u=this,f,r=0;r<u.model.updatedRecords.length;r++)if(u.model.updatedRecords[r].level==n&&u.model.updatedRecords[r].index>t){i.parentItem&&u.model.updatedRecords[r].parentItem.taskId==i.parentItem.taskId&&(f=u.model.updatedRecords[r].index);break}return f},_nextSameLevelItem:function(n,t){var e=this,r=n.parentItem.level,f=t.indexOf(n),u;for(i=f;i<t.length;i++)if(r===t[i].level||r>t[i].level){u=t[i];break}return u},_sendOutdentRequest:function(){var t=this,u=t.model,n=t.getCurrentData(),f={},y={},o,s,p,a,v,e,c,w,h,b,d,k,g,nt,l;if(t.cancelEditCell(),r.isNullOrUndefined(n))alert(t._alertTexts.outdentAlert);else if(f.data=n,f.requestType="outdent",!t._trigger("actionBegin",f)){if(n.level===0||u.editSettings.allowIndent==!1)return;if(o=t._nextSameLevelItem(n,u.flatRecords),p=u.flatRecords.indexOf(n),a=n.parentItem,v=n.parentItem.childRecords.indexOf(n),e=n.parentItem.parentItem,c=e&&n.parentItem.parentItem.childRecords.indexOf(o),n.parentItem.childRecords.splice(v,1),u.parentTaskIdMapping||n.parentItem.item[u.childMapping].splice(v,1),n.parentItem.childRecords.length==0?(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1):n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n.parentItem.childRecords[0]):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n.parentItem.childRecords[0]),e?(c!=-1?e.childRecords.splice(c,0,n):e.childRecords.push(n),u.parentTaskIdMapping?n.item[u.parentTaskIdMapping]=e.taskId:c!=-1?e.item[u.childMapping].splice(c,0,n.item):e.item[u.childMapping].push(n.item),n.parentItem=e):(this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?u.parentTaskIdMapping||this.dataSource().dataSource.json.push(n.item):t._isDataManagerUpdate&&(u.parentTaskIdMapping||(t._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),t._jsonData.push(n.item))):u.parentTaskIdMapping||(o?(d=this.dataSource().indexOf(o.item),this.dataSource().splice(d,0,n.item)):this.dataSource().push(n.item)),n.parentItem=null,u.parentTaskIdMapping&&(n.item[u.parentTaskIdMapping]=null)),w=t._$treegridHelper.ejTreeGrid("getChildCount",n,0),h=u.flatRecords.splice(p,w+1),b=u.ids.splice(p,w+1),s=o?u.flatRecords.indexOf(o):u.flatRecords.length,n.hasChildRecords&&n.childRecords.length>0)for(i=0;i<h.length;i++)u.flatRecords.splice(s,0,h[i]),u.ids.splice(s,0,b[i]),h[i].level-=1,s++;else u.flatRecords.splice(s,0,h[0]),u.ids.splice(s,0,b[0]),h[0].level-=1;n.parentItem&&(n.parentItem.isMilestone&&(n.parentItem.isMilestone=!1),n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n));n.hasChildRecords&&(n.isAutoSchedule?t._updateParentItem(n,null,!0):t._updateManualParentItem(n,null,!0));n.level===0&&u.parentRecords.indexOf(n)===-1&&u.parentRecords.push(n);n.predecessor&&n.predecessor.length>0&&u.predecessorMapping&&n.hasChildRecords&&t._updatePredecessorOnIndentOutdent(n);u.updatedRecords=u.enableVirtualization?t._$treegridHelper.ejTreeGrid("getExpandedRecords",u.flatRecords):u.flatRecords.slice();t._$treegridHelper.ejTreeGrid("setUpdatedRecords",u.flatRecords,u.updatedRecords,u.ids,u.parentRecords,this.dataSource());f.requestType="outdent";t._$treegridHelper.ejTreeGrid("processBindings",f);k={};k.requestType=r.TreeGrid.Actions.Refresh;t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",k);t.model.updatedRecords=t.getUpdatedRecords();t.model.currentViewData=t.getCurrentViewData();t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",u.currentViewData,u.updatedRecords,u.flatRecords,u.ids);t.model.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection());t._$ganttchartHelper.ejGanttChart("refreshHelper",u.currentViewData,u.updatedRecords,t._totalCollapseRecordCount);t.updateAltRow(u.updatedRecords,0,1);g=u.updatedRecords.indexOf(n);nt=t.getGanttChartRows();f={data:t.model.selectedItem,recordIndex:g};t._$ganttchartHelper.ejGanttChart("selectRows",f.recordIndex);t._$treegridHelper.ejTreeGrid("selectRows",f.recordIndex);this.selectedItem(f.data);this.selectedRowIndex(f.recordIndex);u.allowSelection&&u.selectionMode!="cell"&&t.updateIndentOutdentOption(n);u.enableWBS&&(l=a.childRecords&&a.childRecords[v],l&&t.updateWBSdetails(l,!0),t.updateWBSdetails(a),l&&t.updateWBSdetails(l,!0,!0));y.data=n;y.requestType="outdent";this._trigger("actionComplete",y)}this.isCriticalPathEnable==!0&&(this.showCriticalPath(!0,!0),t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId))},_refreshChildLevel:function(n){for(var r=this,t=0,u=n.childRecords,f=u.length,i,t=0;t<f;t++)i=u[t],r.refreshGanttRecord(i),i.hasChildRecords&&r._refreshChildLevel(i)},_updateChildLevel:function(n){for(var u=this,i=0,r=n.childRecords,f=r.length,t,i=0;i<f;i++)t=r[i],t.level=t.level-1,t.hasChildRecords&&u._updateChildLevel(t)},_removeChildRecords:function(n,t){if(n.parentItem){var o=this,i=o.model,u=0,r,f=0,e=0;for(parentChildRecords=n.parentItem.childRecords,parentChildRecordsLength=parentChildRecords&&parentChildRecords.length,u=t;u<parentChildRecordsLength;u++)r=parentChildRecords[u],r&&(n.childRecords?(e=n.childRecords.length,n.childRecords.splice(e,0,r),i.parentTaskIdMapping?r.item[i.parentTaskIdMapping]=n.taskId:n.item[i.childMapping].splice(e,0,r.item)):(n.childRecords=[],n.item[i.childMapping]=[],n.childRecords.push(r),i.parentTaskIdMapping?r.item[i.parentTaskIdMapping]=n.taskId:n.item[i.childMapping].push(r.item)),r.parentItem=n,f++);n.parentItem.childRecords&&(n.parentItem.childRecords.splice(t,f),i.parentTaskIdMapping||n.parentItem.item[i.childMapping].splice(t,f),n.parentItem.childRecords.length==0&&(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1,o.refreshGanttRecord(n.parentItem)))}},updateChildGanttRecordLevel:function(n,t){for(var r=0,u=this,f=u.model,e=n.parentItem&&n.parentItem.parentItem&&n.parentItem.parentItem.childRecords,o=e&&e.length,i,r=t;r<o;r++)i=e[r],i.childRecords?(i.childRecords.splice(i.childRecords.length,0,i),i.item[f.childMapping].splice(i.childRecords.length,0,i.item)):(i.childRecords=[],i.item[f.childMapping]=[],i&&(i.childRecords.push(i),i.item[f.childMapping].push(i.item))),u.refreshGanttRecord(n.parentItem),n.parentItem=i,++addedChildGanttRecordCount;n.parentItem.childRecords.splice(t,addedChildGanttRecordCount);n.parentItem.childRecords.length==0&&(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1);u.refreshGanttRecord(n.parentItem)},updateLevel:function(n,t,i){var e=this,u=0,f=n.childRecords,o=f&&f.length,r;for(u;u<o;u++)r=f[u],r.level+=t,i||e.refreshGanttRecord(r),r.childRecords&&e.updateLevel(r,t,i)},addNewGanttRecord:function(){var t=this,n={},i;i=this.model.flatRecords[this.model.flatRecords.length].item;n.requestType="save";n._cAddedRecord=n.addedRecord=jQuery.extend(!0,{},i);n.recordIndex=index+1;t.subContextMenuAction(n);t._clearContextMenu()},getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this.getExpandStatus(t.parentItem):!0:!0},subContextMenuAction:function(t){var u=this,f=u.model,i=n.extend(!0,{},u._contextMenuSelectedItem.item),e;f.durationUnitMapping||(i.duration=this._getDurationStringValue(u._contextMenuSelectedItem));delete i[f.childMapping];delete i[f.predecessorMapping];delete i.WBSPredecessor;delete i[f.taskNameMapping];e=t.position==="Below"?r.Gantt.RowPosition.BelowSelectedRow:r.Gantt.RowPosition.AboveSelectedRow;f.enableWBS&&(i.WBS=u._getNewWBSid(e));u.addRecord(i,e)},reCalculateWBS:function(n,t,i){var u=this,e=u.model,f,r;if(i)for(r=0;r<n.length;r++)f=t+r,n[r].WBS=i+"."+f,n[r].item.WBS=i+"."+f,e.enableWBSPredecessor&&e.predecessorMapping&&u._getPredecessorIds(n[r]),u.refreshGanttRecord(n[r]),n[r].hasChildRecords&&u._updateChildWBS(n[r]);else for(r=0;r<n.length;r++)f=(t+r).toString(),n[r].WBS=f,n[r].item.WBS=f,e.enableWBSPredecessor&&e.predecessorMapping&&u._getPredecessorIds(n[r]),u.refreshGanttRecord(n[r]),n[r].hasChildRecords&&u._updateChildWBS(n[r])},_updateChildWBS:function(n){for(var r=this,u=r.model,i=n.childRecords,f=n.WBS,t=0;t<i.length;t++)i[t].WBS=f+"."+(t+1),i[t].item.WBS=f+"."+(t+1),u.enableWBSPredecessor&&u.predecessorMapping&&r._getPredecessorIds(i[t]),r.refreshGanttRecord(i[t]),i[t].hasChildRecords&&r._updateChildWBS(i[t])},_getPredecessorIds:function(n){var r=this,u=r.model,f=n.taskId,e=u.flatRecords,i=e.filter(function(n){var i,t,r,u;if(n.predecessorsName)for(i=n.predecessorsName.split(","),t=0;t<i.length;t++)if(r=i[t].match(/(\d+|[A-z]+)/g),u=+r[0],u==f)return n});if(i.length)for(t=0;t<i.length;t++)r._$treegridHelper.ejTreeGrid("updateWBSPredecessor",i[t]),r.refreshGanttRecord(i[t])},_getNewWBSid:function(n){var e=this,u=e.model,i=u.selectionMode=="row"?u.selectedItem:u.updatedRecords[e._rowIndexOfLastSelectedCell],t,o,f,s;return t=i?i.WBS:1,i&&n==r.Gantt.RowPosition.BelowSelectedRow&&(o=t.lastIndexOf(".")!=-1?parseInt(t.substr(t.lastIndexOf(".")+1)):parseInt(t),f=o+1,i.parentItem?(s=i.parentItem?i.parentItem.WBS:null,t=s+"."+f):t=f),t.toString()},_getNewTaskId:function(n){var t=this;return t.model.ids.indexOf(n.toString())==-1?n==0?1:n:(n++,t._getNewTaskId(n))},contextMenuAction:function(n){var t=this;n.requestType=="contextMenuAdd"&&t._sendAddRequest();n.requestType=="contextMenuIndent"&&t._sendIndentRequest();n.requestType=="contextMenuOutdent"&&t._sendOutdentRequest();n.requestType=="contextMenuDelete"&&t._$treegridHelper.ejTreeGrid("deleteRow",null,!0,t._contextMenuSelectedIndex);n.requestType=="contextMenuTaskDetails"&&t._sendEditRequest()},_renderContextMenu:function(t,i,f){var e=this,s={},h,w,l,o,v,b,c,k,p;if((e._contextMenuSelectedIndex=i,e._contextMenuSelectedItem=f,e._contextMenuEvent=t,b=e._$treegridHelper.ejTreeGrid("getCellIndex",t),t||(t=window.event),t.pageX||t.pageY?(w=h=t.pageX,l=t.pageY):(t.clientX||t.clientY)&&(w=h=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),c=this._$treegridHelper.ejTreeGrid("getOffsetRect",e.element[0]),c.bottom=c.top+this.element[0].offsetHeight,c.right=c.left+n(this.element).width(),s.requestType="ContextMenuOpen",s.contextMenuItems=e._contextMenuItems,s.columnIndex=b,s.item=e._contextMenuSelectedItem,s.targetElement=t,s.index=i,!e._trigger("contextMenuOpen",s))&&(e._activeMenuItemId=null,e._contextMenuItems=s.contextMenuItems,e._contextMenuItems.length!=0)){o=r.buildTag("div.e-contextmenu","",{position:"absolute","z-index":e._$treegridHelper.ejTreeGrid("getMaxZIndex")+1},{id:e._id+"_ContextMenu"});k=s.contextMenuItems.filter(function(n){if(n.parentMenuId==null||n.parentMenuId==u)return!0});v=r.buildTag("ul.e-gantt-contextmenu",n.render[e._id+"contextMenuTemplate"](k),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"});o.append(v);n(document.body).append(o);var d=n(o).outerHeight(),a=n(o).outerWidth(),y=o.find(".e-menuitem");y.width(a+2);a=n(o).outerWidth();(c.left>h||c.right<h+a)&&(c.right<h+a&&(h=h-a),h<0&&(h=c.left+10));c.bottom<l+n(v).outerHeight()?(p=l-n(v).outerHeight(),p>0&&(l=p)):n(window).height()+n(window).scrollTop()<l+d&&(l=l-d);o.css({left:h+"px",top:l+"px"});e._$treegridHelper.ejTreeGrid("setFocusOnTreeGridElement");n(o).css({height:"auto"});e._on(o,"contextmenu",function(n){n.preventDefault()});n(y).click(function(){e._contextMenuClickHandler(this)});n(y).mouseenter(function(){n(this).hasClass("e-disable")||(o.find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),e._activeMenuItemId=n(this).attr("id"),e._showSubContextMenu(this,s.contextMenuItems))});t.preventDefault()}},_showSubContextMenu:function(t,i){var v=this.model,f=this,e=[],s=n(t).attr("id"),u,a,h=[],o,c,l;h=i.filter(function(n){return n.menuId==s&&(e=n),n.parentMenuId==s?!0:void 0});e.parentMenuId||n(".e-innerContextmenu").remove();e.parentMenuId&&this._removeContextMenu(e,i);h.length>0&&(u=r.buildTag("div.e-innerContextmenu","",{position:"absolute","z-index":f._$treegridHelper.ejTreeGrid("getMaxZIndex")+1},{id:this._id+"_SubContextMenu"+s}),a=r.buildTag("ul.e-gantt-innercontextmenu",n.render[f._id+"contextMenuTemplate"](h),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),u.append(a),n(document.body).append(u),o=u.find(".e-menuitem"),c=n(u).outerWidth(),o.width(c>100?c:100),l=f._getSubContextMenuPosition(t,u),n(u).css({top:l.top,left:l.left}),n(o).mouseenter(function(){n(this).hasClass("e-disable")||(f._showSubContextMenu(this,i),n(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),f._activeMenuItemId=n(this).attr("id"))}),f._on(u,"contextmenu",function(n){n.preventDefault()}),n(o).click(function(){f._contextMenuClickHandler(this)}))},_removeContextMenu:function(t,i){var e=n("#"+this._id+"_SubContextMenu"+t.parentMenuId),r=n(e).find(".e-contextmenu-mouseover"),u,f;n(r).length>0&&(u=i.filter(function(t){if(t.menuId==n(r).attr("id"))return!0}),u.length>0&&(f=i.filter(function(n){if(n.parentMenuId==u[0].menuId)return!0}),f.length>0&&this._removeContextMenu(f[0],i)),n("#"+this._id+"_SubContextMenu"+n(r).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var a=this.model,s=n(i).outerWidth(),h=n(i).outerHeight(),c=this._$treegridHelper.ejTreeGrid("getOffsetRect",t),u={top:"",left:""},o=n(t).closest(".e-contextmenu"),f,l,r,e;return o.length==0&&(o=n(t).closest(".e-innerContextmenu")),l=n(o).outerWidth(),u.top=c.top-1,u.left=c.left+n(o).width()+1,f=u.left,r=this._$treegridHelper.ejTreeGrid("getOffsetRect",this.element[0]),r.bottom=r.top+this.element[0].offsetHeight,r.right=r.left+n(this.element).width(),(r.left>f||r.right<f+s)&&(r.right<f+s&&(f=f-l-s),f>0&&(u.left=f)),r.bottom<u.top+h&&(e=u.top+h-r.bottom,e=u.top-e-2,e>0&&(u.top=e)),u},_contextMenuClickHandler:function(t){var u=n(t).attr("id"),i=this,r={};if(!n(t).hasClass("e-disable")&&n(t).find(".e-expander").length==0)switch(u){case"Task":r.requestType="contextMenuTaskDetails";i.contextMenuAction(r);i._clearContextMenu();break;case"Indent":r.requestType="contextMenuIndent";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Outdent":r.requestType="contextMenuOutdent";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Delete":r.requestType="contextMenuDelete";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Above":r.requestType="save";r.position="Above";i.subContextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Below":r.requestType="save";r.position="Below";i.subContextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Open":r.requestType="contextMenuAdd";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Add":i._setInitialData();break;default:r.data=i._contextMenuSelectedItem;i._triggerMenuEventHandler(u,r);i._clearContextMenu()}},_triggerMenuEventHandler:function(t,i){var s=this,e=s._contextMenuItems,f,o,u;r.isNullOrUndefined(e)||(f=e.filter(function(n){if(n.menuId.toString()===t)return!0}),f.length>0&&(o=f[0],i.menuId=t,u=o.eventHandler,u&&(typeof u=="string"&&(u=r.util.getObject(u,window)),n.isFunction(u)&&(args=r.event("customContextMenuHandler",this.model,i),u.call(this,args)))))},_setInitialData:function(){var n=this,t=n.model;t.flatRecords.length==0&&(n.addRecord(),n._clearContextMenu())},updateConnectorLines:function(t,i){for(var f=this,s=t.length/2,r=0,e,u,o,r=0;r<s;r++)e=t[r],u=n(f._gridRows).index(e),u!==-1&&(o=f.model.currentViewData[u],o.isExpanded=i)},updateAltRow:function(t,i,r){var f=this;if(f.model.enableAltRow)for(var u=0,h=f.model.currentViewData,c=h.length,e=t.isAltRow,o,s=n(f._gridRows),u=i+r;u<c;u++)n(s[u]).css("display")!=="none"&&(o=h[u],o.isAltRow=!e,e=o.isAltRow,e?n(s[u]).addClass("e-alt-row"):n(s[u]).removeClass("e-alt-row"))},renderedEditDialog:function(t){var i=this,e=this.model,y=e.columns,k=y.length,p={},c,v,w,s,o,u,b,l,h,f,a;switch(t.requestType){case r.TreeGrid.Actions.Add:if(s=document.createElement("div"),o=n("#"+i._id+"_dialogAdd"),n(s).addClass("e-addedrow"),s.innerHTML=n.render[i._id+"_JSONDialogAddingTemplate"](t.data),n(o).html(n(s)),u={},u.cssClass=e.cssClass,u.enableModal=!0,u.width="650px",u.height="auto",u.enableResize=!1,u.contentSelector="#"+i._id,u.rtl=e.rtl,u.showOnInit=!1,u.allowKeyboardNavigation=!1,u.close=function(){n("#"+i._id+"AddAreaNotes").data("ejRTE")&&n("#"+i._id+"AddAreaNotes").ejRTE("destroy")},u.beforeClose=function(n){i._closeAddEditDialog(n,"Add")?n.cancel=!0:i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")},l=i._editDialogTexts.addFormTitle,u.title=l,i._editedDialogRecord={},h=n("#"+i._id+"AddTab"),n(h).ejTab({headerSize:"25px",height:"auto",locale:e.locale,itemActive:function(t){var u=n(t.activeHeader).find("a").attr("href"),r;u=="#"+i._id+"AddNotes"?n("#"+i._id+"AddAreaNotes_Iframe").height("202"):u=="#"+i._id+"AddCustomFields"?(r=n("#treegrid"+i._id+"customFieldAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"280px"}})):u=="#"+i._id+"AddPredecessors"?(r=n("#treegrid"+i._id+"predecessorAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}})):u=="#"+i._id+"AddResources"&&(r=n("#treegrid"+i._id+"resourceAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}}))}}),n(h).find("div.e-content").css("overflow","visible"),n(h).find("div.e-hidebottom.e-addborderbottom.e-content").css("min-height","283px"),n(o).ejDialog(u),f={},f.data=t.data,f.rowPosition=e.editSettings.rowPosition,f.requestType="beforeOpenAddDialog",f.element=n("#"+i._id+"_dialogAdd"),!i._trigger("actionBegin",f)){for(c=0;c<k;c++)p[y[c].field]=f.data[y[c].mappingName];t.data=p;i._refreshEditForm(t);f.data=t.data;f.requestType="OpenAddDialog";f.element=n("#"+i._id+"_dialogAdd");i._trigger("actionBegin",f)||(a=n("#"+i._id+"_dialogAdd_wrapper"),n(o).find(".e-addedrow").css("overflow","visible"),a.addClass("e-ganttdialog"),n(o).ejDialog("refresh"),n(o).ejDialog("open"))}i._addPosition=f.rowPosition;v=this._getDateFromFormat(e.scheduleStartDate);this._getSecondsInDecimal(v)!=this._defaultStartTime&&this._setTime(this._defaultStartTime,v);this._editedDialogRecord.isUpdatedFromDialog=!1;w=e.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Auto?!0:e.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Manual?!1:e.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom?t.data.taskMode==!0?!1:!0:e.taskSchedulingMode;i._editedDialogRecord.isAutoSchedule=w;i._editedDialogRecord.startDate=t.data.startDate?this._checkStartDate(new Date(t.data.startDate)):this._checkStartDate(new Date(v));i._editedDialogRecord.endDate=t.data.endDate?i._editedDialogRecord.startDate.getTime()>new Date(t.data.endDate).getTime()?new Date(i._editedDialogRecord.startDate):new Date(t.data.endDate):new Date(i._editedDialogRecord.startDate);i._editedDialogRecord.duration=t.data.duration!=""?t.data.duration:0;i._editedDialogRecord.durationUnit=e.durationUnit;break;case r.TreeGrid.Actions.BeginEdit:s=document.createElement("div");o=n("#"+i._id+"_dialogEdit");n(s).addClass("e-editedrow");s.innerHTML=n.render[i._id+"_JSONDialogEditingTemplate"](t.data);n(o).html(n(s));u={};u.cssClass=i.model.cssClass;u.rtl=e.rtl;u.width="650px";u.height="auto";u.enableResize=!1;u.contentSelector="#"+i._id;u.enableModal=!0;u.showOnInit=!1;u.allowKeyboardNavigation=!1;u.close=function(){n("#"+i._id+"EditAreaNotes").data("ejRTE")&&n("#"+i._id+"EditAreaNotes").ejRTE("destroy")};u.beforeClose=function(n){i._closeAddEditDialog(n,"Edit")?n.cancel=!0:i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")};b=e.selectionMode=="row"?i.selectedItem():i.model.updatedRecords[i._rowIndexOfLastSelectedCell];l=i._editDialogTexts.editFormTitle;u.open=function(){var r=this,i=this._id,t=n("#"+i+"_title").children(".e-title");t.width("450px");t.css({"word-wrap":"normal","text-overflow":"ellipsis","white-space":"nowrap",display:"inline-block","overflow-x":"hidden",float:"left"});t.attr("title",l)};u.title=l;h=n("#"+i._id+"EditTab");n(h).ejTab({headerSize:"25px",height:"auto",locale:e.locale,itemActive:function(t){var u=n(t.activeHeader).find("a").attr("href"),r;u=="#"+i._id+"EditNotes"?n("#"+i._id+"EditAreaNotes_Iframe").height("202"):u=="#"+i._id+"EditCustomFields"?(r=n("#treegrid"+i._id+"customFieldEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"279px"}})):u=="#"+i._id+"EditPredecessors"?(r=n("#treegrid"+i._id+"predecessorEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}})):u=="#"+i._id+"EditResources"&&(r=n("#treegrid"+i._id+"resourceEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}}))}});n(h).find("div.e-content").css("overflow","visible");n(h).find("div.e-hidebottom.e-addborderbottom.e-content").css("min-height","283px");n(o).ejDialog(u);f={};f.data=t.data;f.requestType="beforeOpenEditDialog";f.element=n("#"+i._id+"_dialogEdit");i._trigger("actionBegin",f)||(i._editedDialogRecord=jQuery.extend({},b),this._editedDialogRecord.isUpdatedFromDialog=!1,i._refreshEditForm(t),f.data=t.data,f.requestType="openEditDialog",f.element=n("#"+i._id+"_dialogEdit"),i._trigger("actionBegin",f)||(a=n("#"+i._id+"_dialogEdit_wrapper"),n(o).find(".e-editedrow").css("overflow","visible"),a.addClass("e-ganttdialog"),n(o).ejDialog("refresh"),n(o).ejDialog("open")));this._editedDialogRecord&&(this._editedDialogRecord.isUpdatedFromDialog=!1)}},_closeAddEditDialog:function(n,t){var i=this,r;if(i._isAddEditDialogSave)i._isAddEditDialogSave=!1;else return r={},r.requestType=t==="Add"?"closeAddDialog":"closeEditDialog",i._trigger("actionBegin",r)},editFormValidate:function(){return n.isFunction(n.validator)?n("#"+this._id+"GeneralEditForm").validate().form():!0},addFormValidate:function(){return n.isFunction(n.validator)?n("#"+this._id+"GeneralAddForm").validate().form():!0},getCurrentData:function(){var n=this,t=n.getUpdatedRecords(),i=n.model.selectionMode=="row"?this.selectedRowIndex():n._rowIndexOfLastSelectedCell;return t&&t[i]},getCurrentViewData:function(){return this._$treegridHelper.ejTreeGrid("getCurrentViewData")},getUpdatedCurrentViewData:function(){return this._$treegridHelper.ejTreeGrid("getUpdatedCurrentViewData")},getRows:function(){return this._$treegridHelper.ejTreeGrid("getRows")},getSelectedCells:function(){return this._$treegridHelper.ejTreeGrid("getSelectedCells")},getGanttChartRows:function(){return this._$ganttchartHelper.ejGanttChart("getGanttChartRows")},getUpdatedRecords:function(){return this._$treegridHelper.ejTreeGrid("getUpdatedRecords")},_getToolBarHeight:function(){var n=0;return this.model.toolbarSettings.showToolbar&&(n=this.element.find(".e-gantttoolbar").height()),n},_initValidator:function(){var t=this;n("#"+this._id+"EditForm").validate({errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,u){var e=u.closest("td"),f=n(i).addClass("e-error"),o=r.buildTag("div.e-errortail e-toparrow");e.find(".e-error").remove();u.hasClass("e-numerictextbox")?f.insertAfter(u.closest(".e-numeric")):f.insertAfter(u);f.prepend(o);t.model.editSettings.editMode!="normal"&&f.offset({left:u.offset().left});f.fadeIn("slow")}})},setValidation:function(){this._initValidator();for(var n=0;n<this._columns.length;n++)r.isNullOrUndefined(this._columns[n].validationRules)||this.setValidationToField(this._columns[n].field,this._columns[n].validationRules)},setValidationToField:function(t,i){var f=n("#"+this._id+t).length>0?n("#"+this._id+t):n("#"+t),u;f.rules("add",i);u=n("#"+this._id+"EditForm").validate();r.isNullOrUndefined(i.required)||(u.settings.messages.Name={},u.settings.messages.Name.required=r.TreeGrid.getColumnByField(proxy._columns,t).headerText+" is required")},_createConnectorLinesCollection:function(n){var u=this,r=this.model,e=r.currentViewData.length,i,f,t,s=u._predecessorsCollection,h=s.length,l=h/2,c=r.enableVirtualization,o;if(r.enableVirtualization&&n==="Load")for(e=r.updatedRecords.length,i=0;i<e;i++)t=r.updatedRecords[i],f=t.predecessor,f&&(o=t,u._addPredecessorsCollection(t,f));else for(i=0;i<e;i++)(t=r.currentViewData[i],c!==!1||t.isExpanded!==!1)&&r.currentViewData.indexOf(t)!==-1&&(f=t.predecessor,f&&(o=t,u._addPredecessorsCollection(t,f)));u._$ganttchartHelper&&u._$ganttchartHelper.ejGanttChart("renderConnectorLines",u._connectorLinesCollection)},_addPredecessorsCollection:function(t,i){var r=this,v,o,e,s,u,h=r.model,f={},c=h.flatRecords,y=h.updatedRecords,l=h.ids,a,p;if(i){for(v=i.length,o=0;o<v;o++)(e=i[o],s=c[l.indexOf(e.from)],u=c[l.indexOf(e.to)],!h.enableVirtualization&&(s&&s.isExpanded===!1||u&&u.isExpanded===!1))||r._isValidationEnabled&&!r._isInExpandCollapse&&u&&r._validatePredecessorDates(u);if(!r._enableCreateCollection)return;for(a=0,n.each(i,function(n,i){return i.to===t.taskId.toString()&&a++,a}),o=0;o<v;o++)(e=i[o],a>1&&(e.isdrawn=!1),s=c[l.indexOf(e.from)],u=c[l.indexOf(e.to)],y.indexOf(s)!==-1&&y.indexOf(u)!=-1)&&(h.enableVirtualization||s.isExpanded!==!1&&u.isExpanded!==!1)&&s&&u&&(f=r._createConnectorLineObject(s,u,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._connectorLinesCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._connectorLinesCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._connectorLinesCollection[p]=f),e.isdrawn=!0))}},_createConnectorLineObject:function(t,i,u){var f={},a=this,v=a.model,l=v.updatedRecords,e=l.indexOf(t),o=l.indexOf(i),c=0,s=0,h,y,p;if(e!==-1&&o!==-1){if(!v.enableVirtualization)if(h=0,o>e){for(c=0;c<e;c++)l[c].isExpanded===!1&&++h;for(s=e,e-=h,s;s<o;s++)l[s].isExpanded===!1&&++h;o-=h}else if(e>o){for(c=0;c<o;c++)l[c].isExpanded===!1&&++h;for(s=o,o-=h,s;s<e;s++)l[s].isExpanded===!1&&++h;e-=h}return y=n("#ejGanttChart"+a._id).ejGanttChart("instance"),p=r.browserInfo().name=="msie"&&r.browserInfo().version<9?v.rowHeight:n("#"+y._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height,e!=-1&&o!=-1?(f.ParentLeft=t.left,f.ChildLeft=i.left,f.ParentWidth=t.width==0||t.isMilestone?a._milesStoneWidth:t.width,f.ChildWidth=i.width==0||i.isMilestone?a._milesStoneWidth:i.width,f.ParentIndex=e,f.ChildIndex=o,f.RowHeight=p,f.Type=u.predecessorsType,f.ConnectorLineId="parent"+t.taskId+"child"+i.taskId,f.milestoneParent=t.isMilestone?!0:!1,f.milestoneChild=i.isMilestone?!0:!1,f):void 0}},_getDateAfterWeekendHolidays:function(n,t){var o=this,r=this.model,e=this._getStringHolidays(),u=new Date(n),i=!1,f;return u.setHours(0,0,0,0),f=this._getFormatedDate(u,r.dateFormat,r.locale),t&&e.indexOf(f)!=-1&&(n.setDate(n.getDate()+1),i=!0),t&&r.includeWeekend===!1&&(n.getDay()==0?(n.setDate(n.getDate()+1),i=!0):n.getDay()==6&&(n.setDate(n.getDate()+2),i=!0)),i?this._getDateAfterWeekendHolidays(n,t):n},_getDateBeforeWeekendHolidays:function(n,t){var o=this,r=this.model,e=this._getStringHolidays(),u=new Date(n),i=!1,f;return u.setHours(0,0,0,0),f=this._getFormatedDate(u,r.dateFormat,r.locale),t&&e.indexOf(f)!=-1&&(n.setDate(n.getDate()-1),i=!0),t&&r.includeWeekend===!1&&(n.getDay()==0?(n.setDate(n.getDate()-2),i=!0):n.getDay()==6&&(n.setDate(n.getDate()-1),i=!0)),i?this._getDateBeforeWeekendHolidays(n,t):n},_updateDateByOffset:function(n,t,i,r){var u,f=t.offset,e=t.offsetDurationUnit;return f<0?u=this._getStartDate(this._checkEndDate(n,r),f*-1,e,r):(u=this._getEndDate(n,f,e,r),i||(u=this._checkStartDate(u,r))),u},_setStartDateByDurationEndDate:function(n){var s=this,f=this.model,h=f.scheduleHeaderSettings.scheduleHeaderType,c=r.Gantt.ScheduleHeaderType,i=f.durationUnit,e=n.isAutoSchedule,o=i==r.Gantt.DurationUnit.Day?n.duration-1:n.duration,t,u;if(n.isMilestone)n.startDate=n.endDate;else{for(t=new Date(n.endDate),u=0;u<o;u++)i==r.Gantt.DurationUnit.Hour?t.setHours(t.getHours()-1):i==r.Gantt.DurationUnit.Day?t.setDate(t.getDate()-1):i==r.Gantt.DurationUnit.Minute&&t.setMinutes(t.getMinutes()-1),t=this._getDateBeforeWeekendHolidays(t,e);n.startDate=new Date(t)}},_validateChildGanttRecord:function(n,t,i){var r=this,h=r.model;if(r._editedTaskBarItem!==t){switch(i.predecessorsType){case"SS":var f=t.taskId.toString(),u=t.predecessor,e=u.filter(function(n){return n.to===f}),o=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(o);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"SF":var f=t.taskId.toString(),u=t.predecessor,e=u.filter(function(n){return n.to===f}),o=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(o);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"FS":var u=t.predecessor,f=t.taskId.toString(),e=u&&u.filter(function(n){return n.to===f}),s=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(s);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"FF":var f=t.taskId.toString(),u=t.predecessor,e=u&&u.filter(function(n){return n.to===f});t.startDate=r._getPredecessorDate(t,e,i.predecessorsType);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status)}this._updateItemValueInRecord(t);t.parentItem&&t.parentItem.isAutoSchedule?r._updateParentItem(t):t.parentItem&&!t.parentItem.isAutoSchedule&&r._updateManualParentItem(t);(r._isTreeGridRendered||r._isGanttChartRendered)&&r.refreshGanttRecord(t)}},_calculateOffset:function(n,t){var r=this,e=r.model,i=r._daydiff(n,t),u,f;return e.includeWeekend||(u=r._calculateWeekendCount(n,i),i=i>0?i-u:i+u),e.holidays.length&&(f=r._calculateHolidayCount(n,t),i=i>0?i-f:i+f),i},_getValidatedStartDate:function(n,t,i){var e=i.predecessorsType,u=i.offset,r,f;switch(e){case"FS":r=new Date(t.endDate);n.isMilestone&&u==0||(r=this._checkStartDate(r,n));u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));f=n.isMilestone?new Date(r):this._checkStartDate(r,n);break;case"FF":r=new Date(t.endDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));n.isMilestone||(r=this._checkEndDate(r,n));f=this._getStartDate(r,n.duration,n.durationUnit,n);break;case"SF":r=new Date(t.startDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));n.isMilestone||(r=this._checkEndDate(r,n));f=this._getStartDate(r,n.duration,n.durationUnit,n);break;case"SS":r=new Date(t.startDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));f=n.isMilestone?r:this._checkStartDate(r,n)}return f},_getPredecessorDate:function(n,t){var e=this.model,i=null,o,r,s=e.flatRecords,h=e.ids,u,c,l,f=t.filter(function(t){if(t.to===n.taskId.toString())return!0});if(f)for(o=f.length,r=0;r<o;r++)predecessor=f[r],c=s[h.indexOf(predecessor.from)],l=s[h.indexOf(predecessor.to)],u=this._getValidatedStartDate(l,c,predecessor),i==null?i=new Date(u):u.getTime()>i.getTime()&&(i=new Date(u));return i},_setBeforeWeekend:function(n){n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1)},_setAfterWeekend:function(n){n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2)},_updateEditedGanttRecords:function(t){var r=this,f=r.model,i=t.data,s=new Date(i.startDate),p=i.isAutoSchedule,y=!1,l,h,e,c,a,o,v;t.columnName==="startDate"?(l=n.extend({},t.data),s=r._checkStartDate(s,i),i.startDate=new Date(s),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate),i._calculateEndDate(this),i.left=i._calculateLeft(this),i.width=i._calculateWidth(this),i.hasChildRecords?(h={},h.previousData=l,h.data=i,r._validateAutoChildRecords(h)):i.progressWidth=i._calculateProgressWidth(i.width,i.status),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName==="endDate"?(e=new Date(i.endDate),e.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,e),e=this._checkEndDate(e,i),i.endDate=new Date(e),f.endDateMapping&&(i.item[f.endDateMapping]=i.endDate),i.isMilestone&&(i.startDate=this._checkStartDate(i.startDate,i),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate)),s.getTime()<=e.getTime()?(i._calculateDuration(this),i.width=i._calculateWidth(this),i.hasChildRecords||(i.progressWidth=i._calculateProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):(i.endDate=t.previousValue,i.item[f.endDateMapping]=t.previousValue),i.isMilestone=i.duration===0?!0:!1,r._updateResourceRelatedFields(i)):t.columnName=="duration"||r._isDurationUpdated?(c=i.duration,c!=0&&i.isMilestone&&(i.startDate=this._checkStartDate(i.startDate,i),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate)),i._calculateEndDate(this),i.isMilestone=c===0?!0:!1,i.width=i._calculateWidth(this),i.hasChildRecords||(i.progressWidth=i._calculateProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName=="predecessor"?(y=!0,t.previousValue&&r._removeConnectorLine(t.previousValue,i),r._addConnectorLine(i)):t.columnName=="status"?(i.status=i.status>100?100:i.status,i.hasChildRecords||(i.progressWidth=r._getProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName=="taskMode"?r._updateGanttRecord(i):(t.columnName=="baselineStartDate"||t.columnName=="baselineEndDate")&&(a=r._getDateFromFormat(i.baselineStartDate),o=r._getDateFromFormat(i.baselineEndDate),o&&o.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,o),i.baselineStartDate=this._checkBaseLineStartDate(a),i.baselineEndDate=this._checkBaseLineEndDate(o),i.baselineStartDate&&i.baselineEndDate&&(i.baselineLeft=i._calculateBaselineLeft(this),i.baselineRight=i._calculateBaselineRight(this),i.baselineWidth=i._calculateBaseLineWidth(this)));i.predecessor&&(r._isMileStoneEdited=i.isMilestone,r._updatedConnectorLineCollection=[],r._connectorlineIds=[],t.columnName==="predecessor"?f.enablePredecessorValidation?r._validatePredecessor(i,t.previousValue):(v=!0,r._validatePredecessorOnEditing(i,v)):r._validatePredecessor(i,u,"successor"),r._updatedConnectorLineCollection.length>0&&(r._$ganttchartHelper.ejGanttChart("appendConnectorLine",r._updatedConnectorLineCollection),this._updateConnectorLineCollection(r._updatedConnectorLineCollection)));r._isValidationEnabled=!1;r.refreshGanttRecord(i)},_removeConnectorLine:function(n,t){for(var c=this,o=this.model,u,r,f,i=0,l=n&&n.length,e=-1,s=o.flatRecords,h=o.ids,i=0;i<l;i++)r=s[h.indexOf(n[i].from)],f=s[h.indexOf(n[i].to)],t.taskId.toString()===n[i].to.toString()&&(e=r.predecessor.indexOf(n[i]),e>=0&&r.predecessor.splice(e,1)),r&&f&&(u="parent"+r.taskId+"child"+f.taskId,c._$ganttchartHelper.ejGanttChart("removeConnectorline",u),this._updateConnectorLineCollection(u))},_addConnectorLine:function(n){var f=this,r=0,e=f.model,u=n.predecessor,o,i,s=e.flatRecords,h=e.ids,t;if(u)for(o=u.length,r=0;r<o;r++)i=u[r],i.to===n.taskId.toString()&&(t=s[h.indexOf(i.from)]),t&&(t.predecessor?t.predecessor.push(i):(t.predecessor=[],t.predecessor.push(i),f._predecessorsCollection.push(t)))},_calculateUpdatedDate:function(n,t){var i=this,f=i.model,e=r.Gantt.DurationUnit,u=0,o;if(t>0)for(u;u<t;u++)f.durationUnit==e.Day?n=i.dateUpdate(n,1,0):f.durationUnit==e.Hour?n=i.dateUpdate(n,0,1):f.durationUnit==e.Minute&&(n=i.dateUpdate(n,0,0,1)),n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2);else for(o=-1*t,u=0;u<o;u++)f.durationUnit==e.Day?n=i.dateUpdate(n,-1,0):f.durationUnit==e.Hour&&(n=i.dateUpdate(n,0,-1)),n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1);return new Date(n)},_updateEditedGanttRecord:function(n){var t=this;if(n.predecessor)for(var s=n.predecessor,u=0,a=s.length,r,f,e,o,i,h=t.model,c=h.flatRecords,l=h.ids,u=0;u<a;u++)t._updatedConnectorLineCollection=[],t._connectorlineIds=[],r=s[u],r.to===n.taskId.toString()&&(f=c[l.indexOf(r.from)],e=c[l.indexOf(r.to)],f&&e&&(o="parent"+f.taskId+"child"+e.taskId,t._$ganttchartHelper.ejGanttChart("removeConnectorline",o),this._updateConnectorLineCollection(o),i=t._createConnectorLineObject(f,e,r),i&&(t._connectorlineIds.length>0&&t._connectorlineIds.indexOf(i.ConnectorLineId)==-1?(t._updatedConnectorLineCollection.push(i),t._connectorlineIds.push(i.ConnectorLineId)):t._connectorlineIds.length==0&&(t._updatedConnectorLineCollection.push(i),t._connectorlineIds.push(i.ConnectorLineId)),t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),this._updateConnectorLineCollection(t._updatedConnectorLineCollection))))},_updateTargetGanttRecord:function(n){var t=this,i=t.model;n.startDate=t._checkStartDate(n.startDate,n);n.endDate=this._getEndDate(n.startDate,n.duration,n.durationUnit,n);n.left=n._calculateLeft(this);n.width=n._calculateWidth(this);n.progressWidth=n._calculateProgressWidth(n.width,n.status);n.parentItem&&(n.parentItem.isAutoSchedule==!0?t._updateParentItem(n):t._updateManualParentItem(n));t.refreshGanttRecord(n)},_updateGanttRecord:function(n){var t=this,i=t.model;n.hasChildRecords&&n.isAutoSchedule?(n.startDate=t._checkStartDate(n.manualStartDate,n),n.left=n._calculateManualLeft(this),n.width=n._calculateManualWidth(this),n.progressWidth=n._calculateProgressWidth(n.width,n.status),n.endDate=n.manualEndDate,n._calculateDuration(this)):n.hasChildRecords&&!n.isAutoSchedule?(n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n._calculateDuration(this),n.manualStartDate=n.startDate,n.manualEndDate=n.endDate,t._updateManualParentItem(n,null,!0)):(n.startDate=t._checkStartDate(n.startDate,n),n.endDate=this._getEndDate(n.startDate,n.duration,n.durationUnit,n),n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n.progressWidth=n._calculateProgressWidth(n.width,n.status));n.parentItem&&n.parentItem.isAutoSchedule&&t._updateParentItem(n);n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n);t.refreshGanttRecord(n)},refreshGanttRecord:function(n){var t=this,u,f,i;t._isTreeGridRendered&&(t.model.currentViewData=t.getCurrentViewData(),u=t.model.currentViewData.indexOf(n),f=t._$treegridHelper.ejTreeGrid("instance"),f.model.allowSelection=t.model.allowSelection,r.TreeGrid.refreshRow(f,u),t._isGanttChartRendered&&t._$ganttchartHelper.ejGanttChart("refreshRow",u),i={},i.data=n,i.item=n.item,i.requestType="recordUpdate",t._trigger("actionComplete",i))},_updateManualParentItem:function(n,t,i){var e=this,u=i?n:n.parentItem,o=e.model,ht=o.scheduleHeaderSettings.scheduleHeaderType,ct=r.Gantt.ScheduleHeaderType,lt=new Date(u.startDate),k=new Date(u.manualStartDate),ut=new Date(n.startDate),d=new Date(u.endDate),y=new Date(u.manualEndDate),c=new Date(n.endDate),a,v,b;ut.getTime()<k.getTime()&&(u.manualStartDate=n.startDate);c.getTime()>d.getTime()&&e._isLoad&&(dateDiff=e._daydiff(d,c));c.getTime()>y.getTime()&&(u.manualEndDate=n.endDate,dateManualDiff=e._daydiff(y,c));for(var l=0,p=u.childRecords,g=p&&p.length,f,nt=null,s=null,h=null,w=0,tt=0,it=0,rt=0,l=0;l<g;l++){if(f=p[l],!f.isAutoSchedule&&f.hasChildRecords)var ft=new Date(f.manualStartDate),et=new Date(f.manualEndDate),ot=new Date(f.startDate),st=new Date(f.endDate),a=ft.getTime()<ot.getTime()?f.manualStartDate:f.startDate,v=et.getTime()>st.getTime()?f.manualEndDate:f.endDate;else a=f.startDate,v=f.endDate;s===null&&(s=new Date(a));h===null&&(h=new Date(v),nt=o.flatRecords.indexOf(f));v.getTime()>h.getTime()&&(h=new Date(v),nt=o.flatRecords.indexOf(f));a.getTime()<s.getTime()&&(s=new Date(a));rt+=parseInt(f.work);f.isMilestone?tt++:it+=parseInt(f.status)}k.getTime()!==s.getTime()&&(u.manualStartDate=new Date(s));y.getTime()!=h.getTime()&&(u.manualEndDate=new Date(h));(e._isLoad||e._isChartRendering)&&(u._calculateDuration(this),u.width=u._calculateWidth(this));u.left=u._calculateLeft(this);u.manualLeft=u._calculateManualLeft(this);u._calculateManualDuration(this);u.manualWidth=u._calculateManualWidth(this);u._updateWorkWithDuration(e);u.work+=rt;o.workMapping&&(u.item[o.workMapping]=u.work);b=g-tt;w=b>0?it/b:0;u.progressWidth=e._getProgressWidth(u.manualWidth,w);u.status=Math.floor(w);o.progressMapping&&(u.item[o.progressMapping]=u.status);(e._isTreeGridRendered||e._isGanttChartRendered)&&e.refreshGanttRecord(u);u.parentItem&&u.parentItem.isAutoSchedule&&!i?e._updateParentItem(u):!u.parentItem||u.parentItem.isAutoSchedule||i||e._updateManualParentItem(u,t)},_updateParentItem:function(n,t,i){var o=this,u=i?n:n.parentItem,e=o.model,ut=e.scheduleHeaderSettings.scheduleHeaderType,ft=r.Gantt.ScheduleHeaderType,k=new Date(u.startDate),rt=new Date(n.startDate),v=new Date(u.endDate),d=new Date(n.endDate),c,l,b;rt.getTime()<k.getTime()&&(u.startDate=n.startDate,e.startDateMapping&&(u.item[e.startDateMapping]=u.startDate));d.getTime()>v.getTime()&&(dateDiff=o._daydiff(v,d),u.endDate=n.endDate,e.endDateMapping&&(u.item[e.endDateMapping]=u.endDate));for(var a=0,y=u.childRecords,g=y&&y.length,f,nt=null,s=null,h=null,p=0,w=0,tt=0,it=0,a=0;a<g;a++)f=y[a],c=f.startDate,l=f.endDate,f.hasChildRecords&&!f.isAutoSchedule&&(c=f.startDate.getTime()>f.manualStartDate.getTime()?f.manualStartDate:f.startDate),f.hasChildRecords&&!f.isAutoSchedule&&(l=f.endDate.getTime()<f.manualEndDate.getTime()?f.manualEndDate:f.endDate),s===null&&(s=new Date(c)),h===null&&(h=new Date(l),nt=e.flatRecords.indexOf(f)),l.getTime()>h.getTime()&&(h=new Date(l),nt=e.flatRecords.indexOf(f)),c.getTime()<s.getTime()&&(s=new Date(c)),it+=parseInt(f.work),f.isMilestone?w++:tt+=parseInt(f.status);k.getTime()!==s.getTime()&&(u.startDate=new Date(s),e.startDateMapping&&(u.item[e.startDateMapping]=u.startDate));v.getTime()!=h.getTime()&&(u.endDate=new Date(h),e.endDateMapping&&(u.item[e.endDateMapping]=u.endDate));u._calculateDuration(this);u.left=u._calculateLeft(this);u.width=u._calculateWidth(this);w==u.childRecords.length&&(u.startDate.getTime()==u.endDate.getTime()?u.width=Math.floor((e.rowHeight-6)/2)*2:u.width+=Math.floor((e.rowHeight-6)/2)*2);b=g-w;p=b>0?tt/b:0;u.progressWidth=o._getProgressWidth(u.width,p);u.status=Math.floor(p);u._updateWorkWithDuration(o);u.work+=it;e.workMapping&&(u.item[e.workMapping]=u.work);u.taskType=r.Gantt.TaskType.FixedDuration;u.effortDriven="false";e.progressMapping&&(u.item[e.progressMapping]=u.status);(o._isTreeGridRendered||o._isGanttChartRendered)&&o.refreshGanttRecord(u);u.parentItem&&u.parentItem.isAutoSchedule&&!i?o._updateParentItem(u):!u.parentItem||u.parentItem.isAutoSchedule||i||o._updateManualParentItem(u)},UpdatePredecessor:function(){var n=this;n._updatedRecordsDateByPredecessor();n._$ganttchartHelper.ejGanttChart("clearConnectorLines");n._connectorLinesCollection=[];n._createConnectorLinesCollection();n._$ganttchartHelper.ejGanttChart("renderConnectorLines",n._connectorLinesCollection)},_updatedRecordsDateByPredecessor:function(){for(var r=this,i=this.model,t=i.flatRecords,u=t.length,n=0;n<u;n++)t[n].predecessor&&t[n].item[i.predecessorMapping]&&r._validatePredecessorDates(t[n])},_validatePredecessorDates:function(n){var f=this,r=f.model,y;if(n.predecessor){for(var e=n.predecessor,o,u=null,i,s=r.flatRecords,h=r.ids,c=n.taskId.toString(),l=e.filter(function(n){return n.to===c}),a=e.filter(function(n){return n.from===c}),v=l.length,t=0;t<v;t++)i=l[t],o=s[h.indexOf(i.from)],u=s[h.indexOf(i.to)],(u.isAutoSchedule||r.validateManualTasksOnLinking)&&f._validateChildGanttRecord(o,u,i);y=a.length}},_validatePredecessor:function(n,t,i){var r=this,c=r.model,nt,p;if(n.predecessor){for(var b=n.predecessor,h,o=null,l,e,f,a=c.flatRecords,v=c.ids,y=!1,k=n.taskId.toString(),w=b.filter(function(n){return n.to===k}),d=b.filter(function(n){return n.from===k}),g=w.length,s=0;s<g;s++)e=w[s],y=r._isOffsetChange(e,t,s),h=a[v.indexOf(e.from)],o=a[v.indexOf(e.to)],l="parent"+h.taskId+"child"+o.taskId,r._$ganttchartHelper&&(r._$ganttchartHelper.ejGanttChart("removeConnectorline",l),this._updateConnectorLineCollection(l)),r._isValidationEnabled=c.enablePredecessorValidation&&(o.isAutoSchedule||c.validateManualTasksOnLinking)?!0:!1,(n.taskId.toString()===e.to||n.taskId.toString()===e.from)&&(!i||i=="predecessor")&&r._isValidationEnabled&&r._validateChildGanttRecord(h,o,e,c.enablePredecessorValidation,y);for(s=0;s<g;s++)(e=w[s],h=a[v.indexOf(e.from)],o=a[v.indexOf(e.to)],c.enableVirtualization!==!1||h.isExpanded!==!1&&o.isExpanded!=!1)&&(f=r._createConnectorLineObject(h,o,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._updatedConnectorLineCollection[p]=f)));for(nt=d.length,s=0;s<nt;s++)(e=d[s],h=a[v.indexOf(e.from)],o=a[v.indexOf(e.to)],l="parent"+h.taskId+"child"+o.taskId,y=r._isOffsetChange(e,t,s),r._isValidationEnabled=c.enablePredecessorValidation&&(o.isAutoSchedule||c.validateManualTasksOnLinking)?!0:!1,r._$ganttchartHelper&&(r._$ganttchartHelper.ejGanttChart("removeConnectorline",l),this._updateConnectorLineCollection(l)),i!="predecessor"&&r._isValidationEnabled&&r._validateChildGanttRecord(h,o,e,c.enablePredecessorValidation,y),c.enableVirtualization!==!1||h.isExpanded!==!1&&o.isExpanded!=!1)&&(f=r._createConnectorLineObject(h,o,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._updatedConnectorLineCollection[p]=f)),o&&r._validatePredecessor(o,u,"successor"))}},_updateConnectorLineCollection:function(n){var t,r,u,i;if(typeof n=="string"){for(t=0;t<this._connectorLinesCollection.length;t++)if(this._connectorLinesCollection[t].ConnectorLineId==n){this._connectorLinesCollection.splice(t,1);break}}else for(t=0;t<n.length;t++){for(u=0,i=0;i<this._connectorLinesCollection.length;i++)if(this._connectorLinesCollection[i].ConnectorLineId==n[t].ConnectorLineId){r=n[t];u=t;break}r?this._connectorLinesCollection[u]=r:this._connectorLinesCollection.push(n[t])}},_isOffsetChange:function(n,t,i){var e=this,o=e.model,u=!1;if(!o.enablePredecessorValidation)if(t&&t.length){var s=n.offset?parseInt(n.offset):0,f=t[i],h=f.offset?parseInt(f.offset):0;u=s!=h?!0:!1}else u=r.isNullOrUndefined(t)?!1:!0;return u},_calculateDateDifference:function(n,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(n,t):t+this._calculateWeekendCount(n,t)},_calculateWeekendCount:function(n,t){var u=t>=0?t:-1*t,r=0,i=0;if(t>0)for(i=0;i<t;i++)n.getDay()==0?(r++,n.setDate(n.getDate()+1)):n.getDay()==6?(r+=2,++i,n.setDate(n.getDate()+2)):n.setDate(n.getDate()+1);else for(i=0;i<u;i++)n.setDate(n.getDate()-1),(n.getDay()==0||n.getDay()==6)&&(r+=1);return r},_daydiff:function(n,t){return(new Date(t)-new Date(n))/864e5},_calculateHolidayCount:function(n,t){for(var r=this,e=r.model,u=e.holidays,o=u.length,s=n<t?n:t,h=n>t?n:t,f=0,i=0;i<o;i++)r._getDateFromFormat(u[i].day)>=s&&r._getDateFromFormat(u[i].day)<=h&&f++;return f},dateUpdate:function(n,t,i,r){return r||(r=0),new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours()+i,n.getMinutes()+r,n.getSeconds(),n.getMilliseconds())},_refreshChartAndGridRows:function(){var n=this,t=this.model,i;n._$treegridHelper.ejTreeGrid("processBindings");i={};i.requestType=r.TreeGrid.Actions.Refresh;n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i);n.model.updatedRecords=n.getUpdatedRecords();n.model.currentViewData=n.getCurrentViewData();collapsedRecordCount=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");n._totalCollapseRecordCount=collapsedRecordCount;height=(n.model.updatedRecords.length-collapsedRecordCount)*t.rowHeight;n._$ganttchartHelper.ejGanttChart("setUpdatedRecords",t.currentViewData,t.updatedRecords,t.flatRecords,t.ids);n._$ganttchartHelper.ejGanttChart("refreshHelper",t.currentViewData,t.updatedRecords,n._totalCollapseRecordCount);n._isInAdd||(n._$treegridHelper.ejTreeGrid("updateHeight"),n._$ganttchart.ejGanttChart("updateHeight",height),n._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",collapsedRecordCount),n._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",n.model.updatedRecords.length-collapsedRecordCount),t.enableAltRow&&t.currentViewData.length>0&&r.TreeGrid.updateAltRow(n,t.currentViewData[0],0,0),t.predecessorMapping&&(n._isValidationEnabled=!1,n._connectorlineIds=[],n._connectorLinesCollection=[],n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._createConnectorLinesCollection()))},_refreshGanttOnExpandCollapseAll:function(){var n=this,u={},t=this.model,i=0,f=0;if(t.enableVirtualization)u.requestType=r.TreeGrid.Actions.ExpandCollapse,n._$treegridHelper.ejTreeGrid("updateAltRowOnCollapseAll"),n._$treegridHelper.ejTreeGrid("updateAltRowOnRendering"),n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",u),t.updatedRecords=n.getUpdatedRecords(),t.currentViewData=n.getCurrentViewData(),n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._$ganttchartHelper.ejGanttChart("refreshHelper",n.model.currentViewData,n.model.updatedRecords),n._$treegridHelper.ejTreeGrid("updateHeight");else{if(n._isRefreshAddedRecord){n._refreshChartAndGridRows();n._isRefreshAddedRecord=!1;return}i=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");n._totalCollapseRecordCount=i;f=(n.model.updatedRecords.length-i)*t.rowHeight;n._$ganttchartHelper.ejGanttChart("clearConnectorLines");n._$treegridHelper.ejTreeGrid("updateHeight");n._$ganttchart.ejGanttChart("updateHeight",f);n._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",i);n._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",n.model.updatedRecords.length-i);t.enableAltRow&&t.currentViewData.length>0&&r.TreeGrid.updateAltRow(n,t.currentViewData[0],0,0)}t.predecessorMapping&&(n._isValidationEnabled=!1,n._connectorlineIds=[],n._connectorLinesCollection=[],n._createConnectorLinesCollection());n.isCriticalPathEnable==!0&&n._$ganttchartHelper.ejGanttChart("criticalConnectorLine",n.criticalPathCollection,n.detailPredecessorCollection,!0,n.collectionTaskId)},_collapsedRecords:function(){var t=this,n=t.model;return n.updatedRecords.filter(function(t){return t.parentItem==null?t:t.parentItem[n.expandStateMapping]||r.isNullOrUndefined(t.parentItem[n.expandStateMapping])?t:void 0})},_collapseRecordOnLoad:function(){var n=this,i=n.model,u=0,t,f={},e,s=i.enableVirtualization,o=n.getRows();for(n._gridRows=o,n._isInExpandCollapseAll=!0,e=n._collapsedRecords(),u=0;u<e.length;u++)if(t=e[u],!t[i.expandStateMapping]){if(t[i.expandStateMapping]||r.isNullOrUndefined(t[i.expandStateMapping]))continue;f.data=t;f.recordIndex=u;f.expanded=!1;t.hasChildRecords&&(t[i.expandStateMapping]||r.TreeGrid.sendExpandCollapseRequest(n,f))}i.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapseAll=!1},_collapseAll:function(){var n=this,f=n.model,t=0,i,u={},o=f.enableVirtualization,e=n.getRows();for(n._$treegridHelper.ejTreeGrid("cancelEditCell"),n._gridRows=e,n._isInExpandCollapse=!0,n._isInExpandCollapseAll=!0,t=0;t<n.model.parentRecords.length;t++)i=n.model.parentRecords[t],u.data=i,u.recordIndex=t,u.expanded=!1,i.hasChildRecords&&(n._expandCollapseInnerLevelRecord(i,u.expanded),i.expanded&&r.TreeGrid.sendExpandCollapseRequest(n,u));f.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapse=!1;n._isInExpandCollapseAll=!1},_expandCollapseInnerLevelRecord:function(n,t){for(var f=this,e=n.childRecords.length,u={},i=0;i<e;i++)n.childRecords[i].hasChildRecords&&(f._expandCollapseInnerLevelRecord(n.childRecords[i],t),u.data=n.childRecords[i],u.expanded=t,n.childRecords[i].expanded!==t&&r.TreeGrid.sendExpandCollapseRequest(f,u))},_expandAll:function(){var n=this,f=n.model,t=0,i,u={},s=f.enableVirtualization,e=f.parentRecords,o=e.length;for(n._isInExpandCollapse=!0,n._isInExpandCollapseAll=!0,t=0;t<o;t++)i=e[t],u.data=i,u.recordIndex=t,u.expanded=!0,i.hasChildRecords&&(n._expandCollapseInnerLevelRecord(i,u.expanded),i.expanded||r.TreeGrid.sendExpandCollapseRequest(n,u));f.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapse=!1;n._isInExpandCollapseAll=!1},_getDateFromFormat:function(n){if(n!=null)return typeof n=="object"?new Date(n):n?r.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):r.parseDate(n,this.model.dateFormat,this.model.locale):void 0},_getFormatedDate:function(n,t,i){return r.format(n,t,i)},_destroy:function(){var t=this,i,r;this.element.off();t._off(n(window),"resize",t.windowResize);n("#"+t._id+"_dialogEdit").data("ejDialog")&&n("#"+t._id+"_dialogEdit").data("ejDialog").destroy();n("#"+t._id+"_dialogAdd").data("ejDialog")&&n("#"+t._id+"_dialogAdd").data("ejDialog").destroy();n("#"+t._id+"_dialogAdd").remove();n("#"+t._id+"_dialogEdit").remove();n("#"+this._id+"_toolbarItems_Main").remove();n("#"+this._id+"_dialogEdit_wrapper").remove();n("#"+this._id+"startDateEdit_popup").remove();n("#"+this._id+"endDateEdit_popup").remove();n("#"+this._id+"startDateAdd_popup").remove();n("#"+this._id+"endDateAdd_popup").remove();n("#"+this._id+"taskTypeEdit_popup_wrapper").remove();n("#"+this._id+"_dialogAdd_wrapper").remove();n("#"+this._id+"effortDrivenEdit_popup_wrapper").remove();i=t._$ganttchartHelper.ejGanttChart("instance");i.destroy();r=t._$treegridHelper.ejTreeGrid("instance");r.destroy();t.element.empty().removeClass("e-gantt-core e-gantt "+t.model.cssClass)},_updateToolbar:function(){var t=this,u=t.model,e;n("#"+t._id+"_toolbarItems").remove();u.toolbarSettings.showToolbar&&(t._renderToolBar().insertBefore(n("#e-ejSpliter"+t._id)),t._updateToolbarOptions(""));t._totalBorderHeight=r.browserInfo().name=="msie"&&r.browserInfo().version<9?u.toolbarSettings.showToolbar?3:2:u.toolbarSettings.showToolbar?1:0;t._$treegridHelper.ejTreeGrid("cancelEditCell");var o=n("#"+t._id+"_toolbarItems"),i=t.element.find(".e-ganttviewerbodyContianer"),l=t.element.find(".e-ganttviewerheaderContainer"),s="#ejTreeGrid"+t._id+"e-gridcontent",a=n("#e-ejSpliter"+t._id),h=n(t.element).height()-t._totalBorderHeight,f=h-l.height()-2-o.height(),c=i.ejScroller("option","scrollTop"),v=i.ejScroller("option","scrollLeft");i.ejScroller({height:f});ganttHeight=h-o.height();a.height(ganttHeight);n("#ejTreeGrid"+t._id).height(ganttHeight);n("#ejGanttChart"+t._id).height(ganttHeight);n(s).height(f);i.height(f);n(s).ejScroller("refresh");i.ejScroller("option","scrollTop",c);i.ejScroller("option","scrollLeft",v);t._$treegridHelper.ejTreeGrid("updateViewPortHeight");t._$ganttchartHelper.ejGanttChart("updateViewPortHeight");t.model.enableVirtualization&&(t._$treegridHelper.ejTreeGrid("processBindings"),e={},e.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",e),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords),t._$ganttchartHelper.ejGanttChart("onScrollHelper",c));t._clearContextMenu()},_getDurationStringValue:function(n){var i="",t;return n.duration!=null&&n.duration!=u&&(i+=n.duration+" "),n.durationUnit!=null&&n.durationUnit!=u&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this._durationUnitTexts.days:this._durationUnitTexts.day:n.durationUnit=="hour"?t?this._durationUnitTexts.hours:this._durationUnitTexts.hour:t?this._durationUnitTexts.minutes:this._durationUnitTexts.minute),i}});r.Gantt.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedEdit"};r.Gantt.ToolbarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",Search:"search",Indent:"indent",Outdent:"outdent",ExpandAll:"expandAll",CollapseAll:"collapseAll",PrevTimeSpan:"prevTimeSpan",NextTimeSpan:"nextTimeSpan",NextTimeSpan:"nextTimeSpan",CriticalPath:"criticalPath",ExcelExport:"excelExport",PdfExport:"pdfExport"};r.Gantt.ScheduleHeaderType={Year:"year",Month:"month",Week:"week",Day:"day",Hour:"hour"};r.Gantt.minutesPerInterval={Auto:"auto",OneMinute:"oneMinute",FiveMinutes:"fiveMinutes",FifteenMinutes:"fifteenMinutes",ThirtyMinutes:"thirtyMinutes"};r.Gantt.DurationUnit={Day:"day",Hour:"hour",Minute:"minute"};r.Gantt.WorkUnit={Day:"day",Hour:"hour",Minute:"minute"};r.Gantt.TaskType={FixedUnit:"fixedUnit",FixedWork:"fixedWork",FixedDuration:"fixedDuration"};r.Gantt.workingTimeScale={TimeScale8Hours:"TimeScale8Hours",TimeScale24Hours:"TimeScale24Hours"};r.Gantt.RowPosition={Top:"top",Bottom:"bottom",AboveSelectedRow:"aboveselectedrow",BelowSelectedRow:"belowselectedrow",Child:"child"};r.Gantt.BeginEditAction={DblClick:"dblClick",Click:"click"};r.Gantt.SelectionType={Single:"single",Multiple:"multiple"};r.Gantt.TimescaleRoundMode={Auto:"auto",Year:"year",Month:"month",Week:"week"};r.Gantt.SelectionMode={Row:"row",Cell:"cell"};r.Gantt.TaskSchedulingMode={Auto:"auto",Manual:"manual",Custom:"custom"};r.Gantt.Locale=r.Gantt.Locale||{};r.Gantt.Locale["default"]=r.Gantt.Locale["en-US"]={emptyRecord:"No records to display",alertTexts:{indentAlert:"There is no gantt record is selected to perform the Indent",outdentAlert:"There is no gantt record is selected to perform the Outdent",predecessorEditingValidationAlert:"Cyclic Dependency Occured, Please Check The Predecessor",predecessorAddingValidationAlert:"Fill all the columns in predecessor table",idValidationAlert:"Duplicate ID",dateValidationAlert:"Invalid End date",dialogResourceAlert:"Fill All the columns in resource table"},columnHeaderTexts:{taskId:"ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",resourceInfo:"Resources",duration:"Duration",status:"Progress",taskMode:"Task Mode",subTasksStartDate:"SubTasks Start Date",subTasksEndDate:"SubTasks End Date",scheduleStartDate:"Schedule Start Date",scheduleEndDate:"Schedule End Date",predecessor:"Predecessors",type:"Type",offset:"Offset",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",WBS:"WBS",WBSPredecessor:"WBS Predecessor",dialogCustomFieldName:"Column Name",dialogCustomFieldValue:"Value",notes:"Notes",taskType:"Task Type",work:"Work",unit:"Unit",effortDriven:"Effort Driven"},editDialogTexts:{addFormTitle:"New Task",editFormTitle:"Task Information",saveButton:"Save",deleteButton:"Delete Task",cancelButton:"Cancel",addPredecessor:"Add New",removePredecessor:"Remove",addButton:"Add"},columnDialogTexts:{field:"Field",headerText:"Header Text",editType:"Edit Type",filterEditType:"Filter Edit Type",allowFiltering:"Allow Filtering",allowFilteringBlankContent:"Allow Filtering Blank Content",allowSorting:"Allow Sorting",visible:"Visible",width:"Width",textAlign:"Text Alignment",headerTextAlign:"Header Text Alignment",columnsDropdownData:"Column Dropdown Data",dropdownTableText:"Text",dropdownTableValue:"Value",addData:"Add",deleteData:"Remove",allowCellSelection:"Allow Cell Selection",displayAsCheckbox:"Display As Checkbox",clipMode:"Clip Mode",tooltip:"Tooltip",headerTooltip:"Header Tooltip"},toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",saveTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",searchTool:"Search",indentTool:"Indent",outdentTool:"Outdent",expandAllTool:"Expand All",collapseAllTool:"Collapse All",nextTimeSpanTool:"Next Timespan",prevTimeSpanTool:"Previous Timespan",prevTimeSpanTool:"Previous Timespan",criticalPathTool:"Critical Path",excelExportTool:"Excel Export",pdfExportTool:"PDF Export"},durationUnitTexts:{days:"days",hours:"hours",minutes:"minutes",day:"day",hour:"hour",minute:"minute"},durationUnitEditText:{minute:["m","min","minute","minutes"],hour:["h","hr","hour","hours"],day:["d","dy","day","days"]},workUnitTexts:{day:"days",hour:"hours",minute:"minutes"},taskTypeTexts:{fixedWork:"Fixed Work",fixedUnit:"Fixed Units",fixedDuration:"Fixed Duration"},effortDrivenTexts:{yes:"Yes",no:"No"},contextMenuTexts:{taskDetailsText:"Task Details...",addNewTaskText:"Add New Task",indentText:"Indent",outdentText:"Outdent",deleteText:"Delete",aboveText:"Above",belowText:"Below"},newTaskTexts:{newTaskName:"New Task"},columnMenuTexts:{sortAscendingText:"Sort Ascending",sortDescendingText:"Sort Descending",columnsText:"Columns",insertColumnLeft:"Insert Column Left",insertColumnRight:"Insert Column Right",deleteColumn:"Delete Column",renameColumn:"Rename Column"},taskModeTexts:{manual:"Manual",auto:"Auto"},editTypeTexts:{string:"String",numeric:"Numeric",datePicker:"Date Picker",dateTimePicker:"Date Time Picker",dropdown:"Dropdown",boolean:"Boolean"},textAlignTypes:{right:"Right",left:"Left",center:"Center"},clipModeTexts:{clip:"Clip",ellipsis:"Ellipsis"},columnDialogTitle:{insertColumn:"Insert Column",deleteColumn:"Delete Column",renameColumn:"Rename Column"},deleteColumnText:"Are you sure you want to delete this column?",okButtonText:"OK",cancelButtonText:"Cancel",confirmDeleteText:"Confirm Delete",predecessorEditingTexts:{fromText:"From",toText:"To"},dialogTabTitleTexts:{generalTabText:"General",predecessorsTabText:"Predecessors",resourcesTabText:"Resources",customFieldsTabText:"Custom Fields",notesTabText:"Notes"},predecessorCollectionText:[{id:"SS",text:"Start-Start",value:"Start-Start"},{id:"SF",text:"Start-Finish",value:"Start-Finish"},{id:"FS",text:"Finish-Start",value:"Finish-Start"},{id:"FF",text:"Finish-Finish",value:"Finish-Finish"}]};r.Gantt.GanttRecord=function(){var n=this;n.taskId=null;n.taskName=null;n.startDate=null;n.endDate=null;n.duration=null;n.isMilestone=!1;n.status=null;n.predecessor=null;n.resourceInfo=null;n.parentItem=null;n.isSelected=!1;n.childRecords=null;n.hasChildRecords=!1;n.expanded=!1;n.level=0;n.left=0;n.width=0;n.progressWidth=0;n.item=null;n.baselineLeft=0;n.baselineWidth=0;n.baselineStartDate=null;n.baselineEndDate=null;n.isCritical=!1;n.slack=null;n.isReadOnly=!1;n.hasFilteredChildRecords=!0;n.taskbarBackground=null;n.progressbarBackground=null;n.parentProgressbarBackground=null;n.cellBackgroundColor=null;n.rowBackgroundColor=null;n.treeMappingName=[];n.dragState=!0;n.isSelected=!1;n.durationUnit="";n.isAutoSchedule=!0;n.manualStartDate=null;n.manualEndDate=null;n.manualLeft=0;n.manualDuration=0;n.manualWidth=0};r.Gantt.GanttRecord.prototype={_calculateLeft:function(n){return n._getTaskLeft(this.startDate)},_calculateManualLeft:function(n){return n._getTaskLeft(this.manualStartDate)},_calculateBaselineLeft:function(n){var t=new Date(this.baselineStartDate),i=new Date(this.baselineEndDate);return t&&i?n._getTaskLeft(t):0},_calculateBaselineRight:function(n){var i=new Date(this.baselineStartDate),t=new Date(this.baselineEndDate);return i&&t?n._getTaskLeft(t):0},_updateHoliday:function(n,t,i){var r=0,u=t&&t.length,f;if(u>0){for(r=0;r<u;r++)f=new Date(n),f.setHours(0,0,0,0),this._getFormatedDate(t[r],i.dateFormat,i.locale)==this._getFormatedDate(n,i.dateFormat,i.locale)&&n.setDate(n.getDate()+1);i.includeWeekend==!1&&n.getDay()==6&&n.setDate(n.getDate()+2)}},_calculateGanttRecordLeft:function(n,t,i){var r=this,u=r._daydiff(t,n);return u*i},_calculateReverseLeft:function(n,t,i){var h,u=this,e=0,r=u.startDate,o=u.duration&&parseInt(u.duration),f,s;if(r==null&&(r=new Date(u.endDate),r.setDate(r.getDate()-o)),i==!1){for(f=new Date(u.endDate),s=0;s<o;s++)f.getDay()==0?(e+=2,f.setDate(f.getDate()-2)):f.getDay()==6&&e++,f.setDate(f.getDate()-1);r=new Date(u.endDate);e=o===0?1:e;r.setDate(r.getDate()-(o+e-1))}return u.startDate=new Date(r),h=Math.ceil((r-n)/864e5),h*t},_calculateReverseWidth:function(n,t,i,r){var e=this,s=0,a,u,h=0,f=e.startDate,c=e.duration&&parseInt(e.duration),o=e.endDate,l;if(f==null&&(f=new Date(o),f.setDate(f.getDate()-c+1)),i==!1){for(u=new Date(o),h=0;h<c;h++)u.getDay()==0?(s+=2,u.setDate(u.getDate()-2)):u.getDay()==6&&s++,u.setDate(u.getDate()-1);f=new Date(o);f.setDate(f.getDate()-(c+s-1))}if(r!=null&&r.length>0){for(u=new Date(f),h=0;h<c;h++){for(u.setDate(u.getDate()+1),l=0;l<r.length;l++)e._getDateFromFormat(r[l].day).getDate()==u.getDate()&&s++;i==!1&&(u.getDay()==0||u.getDay()==6)&&s++}o=new Date(e.startDate);o.setDate(o.getDate()+(c+s-1))}return a=Math.ceil((new Date(o)-e.startDate)/864e5)+1,a*n},_calculateWidth:function(n){var t=this,i=new Date(t.startDate),r=new Date(t.endDate);return n._getTaskWidth(i,r)},_calculateManualWidth:function(n){var t=this,i=new Date(t.manualStartDate),r=new Date(t.manualEndDate);return n._getTaskWidth(i,r)},_calculateBaseLineWidth:function(n){var r=this,t=new Date(this.baselineStartDate),i=new Date(this.baselineEndDate);return n._getTaskWidth(t,i)},_getFormatedDate:function(n,t,i){return r.format(n,t,i)},_getDateFromFormat:function(n,t,i){if(n)return r.parseDate(n,t,i)==null?new Date(n):r.parseDate(n,t,i)},_calculateProgressWidth:function(n,t){return n*t/100},_setResourceInfo:function(t,i,r,u,f){var c=this,e=0,h=[],o,s;for(e;e<t.length;e++)o=f.filter(function(n){return t[e]===n[i]}),s=n.extend({},o[0]),o.length?(h.push(s),c._updateResourceUnit(o[0],s,u)):(t.splice(e,1),e--);return h},_updateResourceUnit:function(n,t,i){i!=""?r.isNullOrUndefined(n[i])&&(t[i]=100):t.unit=100},_updateEndDate:function(n,t){var i=this,s=new Date(n),h=new Date(i.startDate),e=i._daydiff(s,h),r=new Date(i.endDate),o=0,u,f;if(t==!1)for(u=0,u;u<=e;u++)r.setDate(r.getDate()+1),(r.getDay()==0||r.getDay()==6)&&(o+=1);f=i.endDate;f.setDate(f.getDate()+e+o);i.endDate=new Date(f)},_calculateFormatedDate:function(n,t,i){return r.format(n,t,i)},_updateParentProgress:function(n,t){var i=0,r=n.childRecords,e=r?r.length:0,o=0,s=0,f=0,u,h;if(r){for(u=0;u<e;u++)r[u].isMilestone?s+=1:o+=parseInt(r[u].status);f=e-s;i=f>0?o/f:0;isNaN(i)&&(i=0);h=n.isAutoSchedule?n.width:n.manualWidth;n.progressWidth=this._getProgressWidth(h,i);n.status=Math.floor(i);t&&(n.item[t]=n.status)}n.parentItem&&this._updateParentProgress(n.parentItem,t)},_getProgressWidth:function(n,t){return n*t/100},_calculatePredecessor:function(n,t,i){var o=[],f,r={},u,s=this.taskId.toString(),e,h=this;return typeof n=="string"&&n.split(",").forEach(function(n){u=n.split("+");e="+";n.indexOf("-")>=0&&(u=n.split("-"),e="-");f=u[0].match(/(\d+|[A-z]+)/g);r={from:f[0],predecessorsType:f.length>1?f[1].toUpperCase():"FS",offset:u.length>1?e+""+u[1]:"0",isdrawn:!1,to:s};var c=h._getOffsetDurationUnit(r.offset,t,i);r.offset=c.duration;r.offsetDurationUnit=c.durationUnit;o.push(r)}),o},_getOffsetDurationUnit:function(n,t,i){var e=0,u=i,f,o;return typeof n=="string"?(f=n.match(/(-?\d*\.*\d+|[A-z]+)/g),f&&f.length<=2&&(e=parseFloat(f[0]),u=f[1]?f[1].toLowerCase():"",u=t.minute.indexOf(u)!=-1?r.Gantt.DurationUnit.Minute:t.hour.indexOf(u)!=-1?r.Gantt.DurationUnit.Hour:t.day.indexOf(u)!=-1?r.Gantt.DurationUnit.Day:i)):(e=n,u=i),isNaN(e)&&(e=0,u=r.Gantt.DurationUnit.Day),o={},o.duration=e,o.durationUnit=u,o},_updateGanttRecord:function(n,t,i,r,u,f,e,o){var s=this,h=s.left%f,c=(s.left-h)/f;startDate=new Date(u);startDate.setDate(u.getDate()+c);startDate.getDay()==0?startDate.setDate(startDate.getDate()+1):startDate.getDay()==6&&startDate.setDate(startDate.getDate()+2);s.startDate=new Date(startDate);s.left=s._calculateLeft(this);s.width=s._calculateWidth(this);s.parentItem&&s._updateParentItem(s,n,t,i,r,u,f,e,o)},_calculateUpdatedDate:function(n,t){var r=this,i=0,u;if(t>0)for(i;i<t;i++)n=r._dataSubtract(n,1),n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2);else for(u=-1*t,i=0;i<u;i++)n=r._dataSubtract(n,-1),n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1);return new Date(n)},_dataSubtract:function(n,t){return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())},_calculateEndDate:function(n){var t=n.model,i=n._getEndDate(this.startDate,this.duration,this.durationUnit,this);this.endDate=new Date(i);t.endDateMapping&&(this.item[t.endDateMapping]=this.endDate)},_calculateTimeScale8Hour:function(n,t){24-n>8&&(t=this.duration<8?this.duration:this.duration%8);(24-n<8||this.duration>8)&&(n=8);t==0&&(t=8);var i=n;do n>=8&&n<13||n>13&&n<=17?(i++,t--,n=n==24?0:n+1):(n=n==24?0:n+1,i++,t--);while(t>0);return i},_dateUpdate:function(n,t,i,r){return r||(r=0),new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours()+i,n.getMinutes()+r,n.getSeconds(),n.getMilliseconds())},_calculateDuration:function(n){var t=n._getDuration(this.startDate,this.endDate,this.durationUnit,this.isAutoSchedule);this.duration=t;model.durationMapping&&this.item&&(this.item[model.durationMapping]=t,model.durationUnitMapping&&(this.item[model.durationUnitMapping]=this.durationUnit))},_calculateManualDuration:function(n){var t=n._getDuration(this.manualStartDate,this.manualEndDate,this.durationUnit,this.isAutoSchedule);this.manualDuration=t},_calculateDateDifference:function(n,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(n,t)+1:t+this._calculateWeekendCount(n,t)},_calculateWeekendCount:function(n,t){var u=t>=0?t:-1*t,r=0,i=0;if(t>0)for(i=0;i<t;i++)n.getDay()==0?(r++,n.setDate(n.getDate()+1)):n.getDay()==6?(r+=2,++i,n.setDate(n.getDate()+2)):n.setDate(n.getDate()+1);else for(i=0;i<u;i++)n.setDate(n.getDate()-1),(n.getDay()==0||n.getDay()==6)&&(r+=1);return r},_updateDurationWithWork:function(n){for(var e,c,r=n.model,o,u=this.resourceInfo,s=u?u.length:0,h=0,t=0,i=n._secondsPerDay/3600,f=0;f<s;f++)e=u[f][r.resourceUnitMapping],c=e>0?i*e/100:i,h+=c;o=this._getTotalWorksInHours(r,i);s!=0&&(t+=o/h);this.durationUnit=="minute"&&(t=t*i*60);this.durationUnit=="hour"&&(t=t*i);t%1!=0&&(t=t.toFixed(2));n._isDurationUpdated=!0;this.duration=t;r.durationMapping&&(this.item[r.durationMapping]=this.duration)},_updateWorkWithDuration:function(n){for(var e,o,i=n.model,u=this.resourceInfo,s=u?u.length:0,t=0,r=n._secondsPerDay/3600,h=this._getDurationInDays(r),f=0;f<s;f++)e=u[f][i.resourceUnitMapping],o=e>0?r*e/100:r,t+=o*h;i.workUnit=="minute"&&(t=t*60);i.workUnit=="day"&&(t=t/r);t%1!=0&&(t=t.toFixed(2));this.work=parseFloat(t);i.workMapping&&(this.item[i.workMapping]=this.work)},_updateUnitWithWork:function(n){var e=n.model,r=this.resourceInfo,u=r?r.length:0,f=n._secondsPerDay/3600,i;if(u!=0){var o=this._getDurationInDays(f),h=this._getTotalWorksInHours(e,f),s=o>0?h/(o*f)*100:0,t=s>0?s/u:100;for(t%1!=0&&(t=t.toFixed(2)),i=0;i<u;i++)r[i][e.resourceUnitMapping]=t}},_getTotalWorksInHours:function(n,t){var i=this;return n.workUnit=="day"?i.work*t:n.workUnit=="minute"?i.work/60:i.work},_getDurationInDays:function(n){var t=this;return this.durationUnit=="hour"?t.duration/n:this.durationUnit=="minute"?t.duration/(n*60):t.duration},_daydiff:function(n,t){return(t-n)/864e5},_hourdiff:function(n,t){return(t-n)/36e5},_getProgressPercent:function(n,t){return Math.ceil((t/n*100).toFixed(2))},_minutediff:function(n,t){return(t-n)/6e4},_setTime:function(n,t){var i=parseInt(n/3600),r=parseInt((n-i*3600)/60),u=n-i*3600-r*60;t.setHours(i,r,u,0)},_endDateUpdate:function(n,t,i,r,u){i||(i=0);var f=new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());return u=="day"||u=="hour"?(f.setHours(24),f.setMinutes(i)):r.length&&(i>0?(f.setHours(24),this._setTime(r[0].from,f),f.setMinutes(i)):this._setTime(r[r.length-1].to,f)),f},_startDateUpdate:function(n,t,i,r,u){i||(i=0);var f=new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());return u=="day"||u=="hour"?f.setMinutes(i):r.length&&(i>0?(this._setTime(r[0].from,f),f.setMinutes(i)):this._setTime(r[0].from,f)),f}};r.Gantt._getPredecessorsValue=function(n){var e=n.predecessor,o,r,u,t,i,f;if(e)for(o=e.length,r="",u=0;u<o;u++)t=e[u],i="",t.from!=n.taskId&&(i=t.from+t.predecessorsType,t.offset!=0&&(i+=t.offset>0?"+"+t.offset+" ":t.offset+" ",f=t.offset!=1,i+=t.offsetDurationUnit=="day"?f?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:t.offsetDurationUnit=="hour"?f?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:f?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r=r.length>0?r+","+i:i);return r};r.Gantt._getDurationStringValue=function(n){var i="",t;return n.duration!=null&&n.duration!=u&&(i+=n.duration+" "),n.durationUnit!=null&&n.durationUnit!=u&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.durationUnit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),i};r.Gantt._getCellValue=function(n){var t=this.data[n];return t?t:this.data.item&&this.data.item[n]}}(jQuery,Syncfusion),function(n,r,u){r.widget("ejTreeGrid","ej.TreeGrid",{_rootCSS:"e-treegrid",element:null,validTags:["div"],model:null,_requiresID:!0,_tags:[{tag:"columns",attr:["field","headerText","allowSorting","editType","allowFiltering","filterEditType","width","visible","editParams","format","isFrozen","allowFreezing","headerTemplateID","allowCellSelection","showCheckbox","showInColumnChooser","validationRules.minlength","validationRules.maxlength","validationRules.range","validationRules.number","validationRules.required","displayAsCheckbox"],content:"template"},{tag:"summaryRows",attr:["title","summaryColumns"],content:"template"},{tag:"summaryRows.summaryColumns",attr:["summaryType","dataMember","displayColumn","prefix","suffix","format"],content:"template"},{tag:"sortSettings.sortedColumns",attr:["field","direction"]},{tag:"sizeSettings",attr:["height","width"]},{tag:"columnResizeSettings",attr:["columnResizeMode"]}],_columns:function(n,t,i){var r=this.element.find(".e-headercelldiv");r[n.columns].innerHTML=i;this._trigger("refresh")},keyConfigs:{focus:"e",editRecord:"113",saveRequest:"13",cancelRequest:"27",firstRowSelection:"36",lastRowSelection:"35",leftArrow:"37",upArrow:"38",rightArrow:"39",downArrow:"40",moveCellRight:"9",moveCellLeft:"shift+9",shiftDownArrow:"shift+40",shiftUpArrow:"shift+38",shiftRightArrow:"shift+39",shiftLeftArrow:"shift+37",shiftHomeButton:"shift+36",shiftEndButton:"shift+35",selectedRowExpand:"alt+40",totalRowExpand:"ctrl+40",selectedRowCollapse:"alt+38",totalRowCollapse:"ctrl+38",deleteRecord:"46",spaceBar:"32",topRowSelection:"ctrl+36",bottomRowSelection:"ctrl+35",nextPage:"33",prevPage:"34"},defaults:{expandStateMapping:"",allowFiltering:!1,allowDragAndDrop:!1,dragTooltip:{showTooltip:!1,tooltipItems:[],tooltipTemplate:""},allowSorting:!1,allowColumnResize:!1,allowSelection:!0,allowPaging:!1,dataSource:null,query:r.Query(),idMapping:"",parentIdMapping:"",readOnly:!1,showGridCellTooltip:!1,cellTooltipTemplate:null,showGridExpandCellTooltip:!1,showColumnChooser:!1,showColumnOptions:!1,enableAltRow:!0,selectedItem:null,toolbarSettings:{showToolbar:!1,toolbarItems:[],customToolbarItems:[]},editSettings:{allowEditing:!1,allowAdding:!0,allowDeleting:!0,editMode:"cellEditing",rowPosition:"top",beginEditAction:"dblclick",dialogEditorTemplateID:""},enableVirtualization:!1,allowMultiSorting:!1,sortSettings:{sortedColumns:[]},filterSettings:{filterBarMode:"immediate",filteredColumns:[],filterType:"filterbar"},selectionType:"single",selectionMode:"row",selectionSettings:{selectionType:"single",selectionMode:"row",enableHierarchySelection:!0,enableSelectAll:!0},selectedCellIndexes:[],selectedRowIndex:-1,showSummaryRow:!1,summaryRows:[],showTotalSummary:!1,allowKeyboardNavigation:!0,cssClass:"",locale:"en-US",isEdit:!1,allowScrolling:!1,scrollSettings:{frozenColumns:0},groupSettings:{groupedColumns:[]},sizeSettings:{height:"",width:""},enableResize:!0,isResponsive:!0,showDetailsRow:!1,showDetailsRowInfoColumn:!1,detailsTemplate:"",detailsRowHeight:100,rowDataBound:null,load:null,create:null,queryCellInfo:null,rowSelecting:null,rowSelected:null,cellSelecting:null,cellSelected:null,beginEdit:null,endEdit:null,expanding:null,expanded:null,collapsing:null,collapsed:null,actionComplete:null,actionBegin:null,currentViewData:[],flatRecords:[],parentRecords:[],updatedRecords:[],summaryRowRecords:[],selectedItems:[],ids:[],columns:[{field:"",headerText:"",editType:"",filterEditType:"",allowFiltering:!1,allowFilteringBlankContent:!0,allowSorting:!1,visible:"",textAlign:r.TextAlign.Left,headerTextAlign:r.TextAlign.Left,allowCellSelection:!0,clipMode:"",headerTooltip:"",tooltip:"",showInColumnChooser:!0},],columnDialogFields:[],commonWidth:150,dateFormat:"MM/dd/yyyy",rowHeight:30,emptyRecordText:"No Records To Display",treeColumnIndex:0,workingTimeScale:"TimeScale8Hours",childMapping:"",enableCollapseAll:!1,rowTemplateID:"",altRowTemplateID:"",parseRowTemplate:!0,contextMenuSettings:{showContextMenu:!1,contextMenuItems:[]},contextMenuOpen:null,rowDragStart:null,rowDrag:null,rowDragStop:null,detailsDataBound:null,detailsShown:null,detailsHidden:null,toolbarClick:null,columnResizeStart:null,columnResizeEnd:null,columnResized:null,recordClick:null,exportToPdfAction:"",exportToExcelAction:"",allowMultipleExporting:!1,headerTextOverflow:"none",pageSettings:{pageSize:12,pageCount:8,currentPage:1,totalPages:0,totalRecordsCount:null,pageSizeMode:"all",template:null},allowColumnReordering:!1,columnResizeSettings:{columnResizeMode:"normal"}},dataTypes:{columns:"array",summaryRows:"array",summaryRows:{summaryColumns:"array"},sortSettings:{sortedColumns:"array"},filterSettings:{filteredColumns:"array",filterType:"string"},dataSource:"data",query:"data",currentViewData:"array",flatRecords:"array",parentRecords:"array",updatedRecords:"array",summaryRowRecords:"array",ids:"array",contextMenuSettings:{contextMenuItems:"array"},toolbarSettings:{toolbarItems:"array",customToolbarItems:"array"},selectedItem:"data",summaryRows:"array"},ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","enableRTL","rowDataBound","rowTemplate","parseRowTemplate","detailsTemplate","editSettings","localization","cssClass","dataSource","allowKeyboardNavigation","pageSettings","columnResizeSettings"],observables:["selectedRowIndex","dataSource","selectedCellIndexes","pageSettings.currentPage"],selectedItem:r.util.valueFunction("selectedItem"),selectedRowIndex:r.util.valueFunction("selectedRowIndex"),selectedCellIndexes:r.util.valueFunction("selectedCellIndexes"),dataSource:r.util.valueFunction("dataSource"),_currentPage:r.util.valueFunction("pageSettings.currentPage"),_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},getHeaderTable:function(){return this._$gridHeaderTable},setGridHeaderTable:function(n){this._$gridHeaderTable=n},getHeaderContent:function(){return this._$gridHeaderContent},setGridHeaderContent:function(n){this._$gridHeaderContent=n},getContentTable:function(){return this._$gridContentTable},getContent:function(){return this._$gridContent},setGridContentTable:function(n){this._$gridContentTable=n},getRows:function(){return this._excludeDetailRows()},getSelectedCells:function(){var n=this,i=n.model,t=[];return this._selectedCellDetails.forEach(function(r){var f=r.data,u=i.currentViewData.indexOf(f);u!=-1&&(r.cellElement=n.getRows()[u].childNodes[r.cellIndex]);t.push(r.cellElement)}),t},setGridRows:function(n){this._$gridRows=n},getCurrentViewData:function(){return this.model.currentViewData},getUpdatedCurrentViewData:function(){return this._updateCurrentViewData(),this.model.currentViewData},getFlatRecords:function(){return this.model.flatRecords},setHeight:function(n){this._totalHeight=n},getUpdatedRecords:function(){var n=this.model;return!this._isFromGantt&&n.allowPaging?this._updatedPageData:n.updatedRecords},getsummaryRowRecords:function(){return this.model.summaryRowRecords},getDataSource:function(){return this.dataSource()},getUpdatedIds:function(){return this.model.ids},getRecordsCount:function(){return this._recordsCount},setRecordsCount:function(n){this._recordsCount=n},setFocusOnTreeGridElement:function(){this._focusTreeGridElement()},updateCollapsedRecordCount:function(){var n=this,i=this.model,t=[];t=i.updatedRecords.filter(function(t){return n.getExpandStatus(t)==!1});n._totalCollapsedRecordCount=t.length},_getDetailsExpandedRecords:function(n){var t=this;return n.filter(function(n){return n.isDetailsExpanded==!0})},_getExpandedDetailsRowHeight:function(){var t=this,u=this.model,i,n,r=t.getUpdatedRecords();return i=this.getExpandedRecords(r),n=this._getDetailsExpandedRecords(i),n=t._spliceSummaryRows(n),t._detailsRowHeight*n.length},getCollapsedRecordCount:function(){return this._totalCollapsedRecordCount},_colgroupRefresh:function(){var e=this.model,i,t;this._frozenColumnsLength>0?(i=n(this.getHeaderTable()).find("colgroup"),t=n(this.getContentTable()).find("colgroup")):(i=n(this.getHeaderTable()).find("colgroup")[0],t=n(this.getContentTable()).find("colgroup")[0]);var r=n(i).clone(),u=n(t).clone(),f=n(t).clone();n(t).remove();n(i).remove();this._frozenColumnsLength>0?(n(r[0]).prependTo(this.getHeaderTable()[0]),n(r[1]).prependTo(this.getHeaderTable()[1]),n(u[0]).prependTo(this.getContentTable()[0]),n(u[1]).prependTo(this.getContentTable()[1]),this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(f[0]).prependTo(this._$footertableContent[0]),n(f[1]).prependTo(this._$footertableContent[1])),this._$totalSummaryRowContainer&&this.getBrowserDetails().browser=="safari"&&this._$totalSummaryRowContainer.find("#e-movablefooter"+this._id).css("margin-left","auto"),this.getBrowserDetails().browser=="safari"&&this.getHeaderContent().find("#e-movableheader"+this._id).add(this.getContent().find("#e-movablecontainer"+this._id)).css("margin-left","auto"),n("#e-frozencontentdiv"+this._id).length&&n("#e-frozencontentdiv"+this._id).css("width","100%")):(n(r).prependTo(this.getHeaderTable()),n(u).prependTo(this.getContentTable()),this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(f).prependTo(this._$footertableContent)))},_detailColsRefresh:function(){if(this._$headerCols=this.getHeaderTable().children("colgroup").find("col"),this._$contentCols=this.getContentTable().children("colgroup").find("col"),this.model.detailsTemplate&&this.model.showDetailsRow&&this.model.showDetailsRowInfoColumn||this.model.isFromGantt){var n=this.model.columns.length;this._$headerCols.length>n&&this._$headerCols.splice(n,1);this._$contentCols.length>n&&this._$contentCols.splice(n,1)}},_swipeAction:function(n){var u=this,t=this._currentPage(),r=!0,i=(this.getScrollObject()||{})._scrollXdata;i&&(r=n.type=="swipeleft"?i.scrollable-i.sTop==0:i.sTop==0);switch(n.type){case"swipeleft":this.model.allowPaging&&t!=this.model.pageSettings.totalPages&&!this.model.isEdit&&(r||!u.getScrollElement().ejScroller("isHScroll"))&&this.element.ejTreeGrid("gotoPage",t+1);break;case"swiperight":this.model.allowPaging&&t>1&&!this.model.isEdit&&(r||!u.getScrollElement().ejScroller("isHScroll"))&&this.element.ejTreeGrid("gotoPage",t-1)}},gotoPage:function(n){if(this.model.allowPaging){var t=this,u=t.model,i={},f;r.isNullOrUndefined(n)?n=t._currentPage():n<=0?n=1:n>u.pageSettings.totalPages&&(n=u.pageSettings.totalPages);n=r.isNullOrUndefined(n)?t._currentPage():n;i.previousPage=this._prevPageNo;this._currentPage(n);i.currentPage=n;u.allowPaging&&(i.requestType=r.TreeGrid.Actions.Paging);t._setScrollTop();t._updateCurrentViewData();t.renderRecords(i);t.updateHeight();t.getScrollElement().ejScroller("refresh");t._updateScrollCss();f&&this._currentPage(i.previousPage);i.previousPage!=i.currentPage&&(t.clearSelection(-1),t.selectedRowIndex(-1),t.model.selectedItem=null,t._cancelSaveTools(),t._clearContextMenu(),t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&t._clearMultiSelectPopup(),this._prevPageNo=i.currentPage)}},_pagerClickHandler:function(n){var t=this;if(this._prevPageNo!=n.currentPage)return t._isNextPage=!0,t._isRowEdit?t.cancelRowEditCell():t.model.isEdit&&t.cancelEditCell(),this.gotoPage(n.currentPage),!1},_init:function(){var n=this,t,i,r;if(n.model.isdesignMode){for(n.model.columns=[{field:"Column1",HeaderText:"Column1"},{field:"Column2",HeaderText:"Column2"},{field:"Column3",HeaderText:"Column3"},{field:"Column4",HeaderText:"Column4"}],n.model.childMapping="Children",t=[{Column1:"Value 1",Column2:"Value 2",Column3:"Value 3",Column4:"Value 4",Children:[]}],i=1;i<4;i++)r={Column1:"Value 1",Column2:"Value 2",Column3:"Value 3",Column4:"Value 4"},t[0].Children.push(r);this.dataSource(t);this.model.sizeSettings.height="250px";this.model.sizeSettings.width="600px"}n._trigger("load");n._validateColumnFields();n._initPrivateProperties();n._setCultureInfo();n._initDatasource();n._processEditing();n.model.showColumnChooser&&n.model.showColumnOptions&&(n.columnAddDialogTemplate(),n._renderUpdateConfirmDialog());n._createDragTooltipTemplate();n._createTooltipTemplate()},_renderEditDialog:function(){return r.buildTag("div.e-editdialog-padding","",{display:"none"},{id:this._id+"_dialogEdit"})},_validateColumnFields:function(){var i=this,t=i.model.columns,n;if(!r.isNullOrUndefined(t))for(n=0;n<t.length;n++)r.isNullOrUndefined(t[n].field)&&(t[n].field="",t[n].allowEditing=!1,t[n].allowSorting=!1,t[n].allowFiltering=!1),r.isNullOrUndefined(t[n].editType)&&(t[n].editType="stringedit")},_treeGridAddEditDialog:function(){var t;if(this.model.columns.length!=0){var i=r.buildTag("div"),o=r.buildTag("form.treegridform","",{},{id:this._id+"EditFormDialog"}),s=r.buildTag("table","",{margin:"0 auto"},{}),f,h,e,l,c;for(t=0;t<this.model.columns.length;t++)(this.model.columns[t].visible||r.isNullOrUndefined(this.model.columns[t].visible))&&this.model.columns[t].field!="checkboxState"&&(l="tr",c="td",f=r.buildTag(l),h=r.buildTag(c+".e-editdialoglabel","",{"text-align":"right"}),e=r.buildTag(c+".e-editdialogrowcell","",{"text-align":"left"}),f.append(h.get(0)).append(e.get(0)),this.model.columns[t].headerText==u&&(this.model.columns[t].headerText=this.model.columns[t].field),h.append("<label for='"+this.model.columns[t].field+"'>"+this.model.columns[t].headerText+"<\/label>"),this.model.columns[t].allowEditing!=!1&&this.model.columns[t].field&&r.TreeGrid._initCellEditType(this,e,this._id,t),this.model.columns[t].allowEditing==!1&&e.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[t].visible===!1&&f.addClass("e-hide"),s.append(f));o.append(s);o.appendTo(i);i=this._renderDiaglogButton(o,i,s);n.templates(this._id+"_JSONDialogEditingTemplate",i.html())}},_treeGridAddEditDialogTemplate:function(){if(this.model.columns.length!=0){var t=r.buildTag("div","",{display:"none"}),i=r.buildTag("form.treegridform","",{},{id:this._id+"EditFormDialog"}),u=this.model.editSettings.dialogEditorTemplateID;i.html(n(u).html());t=this._renderDiaglogButton(i,t);n.templates(this._id+"_JSONdialogTemplateMode",t.html())}},_renderDiaglogButton:function(n,t,i){var u,s=this._contextMenuTexts,f,e,o;return u="EditFormDialog_",r.isNullOrUndefined(i)?(f=r.buildTag("input.e-save e-button e-btnsub e-flat","",{"margin-left":"33%"},{type:"button",id:u+this._id+"_Save"}),f.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.saveText,width:"30%"}),e=r.buildTag("input.e-cancel e-button e-btncan e-flat","",{"margin-left":"7%"},{type:"button",id:u+this._id+"_Cancel"}),e.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.cancelText,width:"30%"})):(f=r.buildTag("input.e-save e-button e-btnsub e-flat","",{"margin-left":"0px"},{type:"button",id:u+this._id+"_Save"}),f.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.saveText,width:"45%"}),e=r.buildTag("input.e-cancel e-button e-btncan e-flat","",{"margin-left":"10%"},{type:"button",id:u+this._id+"_Cancel"}),e.ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,text:s.cancelText,width:"45%"})),o=r.buildTag("div","",{},{"class":"e-editform-btn e-editdialogbutton"}),r.isNullOrUndefined(i)||($innerTr=r.buildTag("tr"),$innerTd1=r.buildTag("td.e-editdialoglabel"),$innerTd2=r.buildTag("td.e-editdialogrowcell")),o.append(f),o.append(e),r.isNullOrUndefined(i)||($innerTd2.append(o),$innerTr.append($innerTd1),$innerTr.append($innerTd2),i.append($innerTr)),n.appendTo(t),r.isNullOrUndefined(i)?n.append(o):n.append(i),t},updateAllowKeyboardNavigation:function(n){this.model.allowKeyboardNavigation=n},_refreshFooterSummaryRecords:function(){var t=this,f=this.model,i,u;f.showTotalSummary&&t._$footerContainer.length>0&&(this._frozenColumnsLength>0?(t._$footerContainer.html(this._renderSummaryByFrozenDesign()),this._renderFrozenSummary()):(i=r.buildTag("table.e-table#"+t._id+"summarye-table","",{top:"0px"},{cellspacing:"0px"}),u=r.buildTag("tbody"),i.append(t.getContentTable().find("colgroup").clone()).append(u),u.html(n.render[this._id+"_Template"](t._footerSummaryRecord)),t._$footerContainer.empty().append(i)),t._$footertableContent=t._$footerContainer.find(".e-table"))},_updateHeaderScrollLeft:function(n){var t=this,i=this.model;r.isNullOrUndefined(n)&&(n=t.getScrollElement().ejScroller("option","scrollLeft"));this._frozenColumnsLength>0?(t._$gridHeaderContainer.find("#e-movableheader"+this._id).scrollLeft(n),t.model.showTotalSummary&&t._$footerContainer&&t._$footerContainer.find("#e-movablefooter"+this._id).scrollLeft(n)):(t._$gridHeaderContainer.scrollLeft(n),t.model.showTotalSummary&&t._$footerContainer&&t._$footerContainer.scrollLeft(n))},updateColumns:function(n){var t=this,i=this.model;i.columns=n;t._refreshFrozenColumns()},updateToGanttColumns:function(){var t=this,i=t.model,r=i.columns,u=n("#"+t._id.replace("ejTreeGrid","")).data("ejGantt");u.updateGanttColumns(r)},_updateAddEditDialogTemplate:function(){var t=this,r=t.model,u=r.columns,i=n("#"+t._id.replace("ejTreeGrid","")).data("ejGantt");i.addDialogTemplate();i.editDialogTemplate()},_refreshFrozenColumns:function(){var t=this,i=this.model,f=!1,o,s,u,h,e,c,l;if(t._initFrozenColumns(),t._processEditing(),t._$gridHeaderContent.replaceWith(t._renderGridHeader()),t._addInitTemplate(),i.isFromGantt&&t._$gridContent.removeClass("e-borderbox"),this._frozenColumnsLength>0&&t._$frozenTableContent.length==0?(f=!0,o=t._$gridContent.css("width"),s=t._$gridContent.css("height"),t._$gridContent.ejScroller("destroy"),t._$gridContent.css("width",o),t._$gridContent.css("height",s),t._$gridContainer.html(t._renderByFrozenDesign()),t.setGridContentTable(t._$gridContainer.find(".e-table")),t._$gridContainer.find("#e-movablecontent"+t._id+",#e-movablecontentdiv"+t._id+",#e-frozencontentdiv"+t._id).css("height",t._$gridContainer.css("height")),t._renderScroller(!0)):t._$frozenTableContent.length>0&&this._frozenColumnsLength==0&&(f=!0,t._$gridContent.find("#e-movablecontainer"+t._id).ejScroller("destroy"),u=r.buildTag("table.e-table#"+t._id+"e-table","",{top:"0px",position:"relative"},{cellspacing:"0px"}),h=r.buildTag("tbody"),u.append(t.getHeaderTable().find("colgroup").clone()).append(h),t._$gridContainer.html(u),t.setGridContentTable(u),t._renderScroller(!0)),t._$frozenTableContent=n("#"+t._id+"frozene-table"),t._$movableTableContent=n("#"+t._id+"movablee-table"),t._$tableContent=n("#"+t._id+"e-table"),i.showTotalSummary&&t._$footerContainer.length>0&&t._refreshFooterSummaryRecords(),f)t.onScrollHelper(0);e={};e.requestType=r.TreeGrid.Actions.Refresh;t._isRendered=!1;t.sendDataRenderingRequest(e);t.setWidthToColumns();t._isRendered=!0;t._trigger("refresh");this._eventBindings();this._hideCollapsedDetailsRows();t.getScrollElement().ejScroller("refresh");t._updateScrollCss();i.isFromGantt&&(c=t.getScrollElement(),l=c.ejScroller("isHScroll"),l?t._$gridContent.removeClass("e-borderbox"):t._$gridContent.addClass("e-borderbox"));i.showColumnChooser&&t._renderColumnChooserList(!0);t._updateHeaderScrollLeft();i.isFromGantt&&(t._addEmptyColumntoGrid(),t.updateToGanttColumns())},freezePrecedingColumns:function(n){var s=this,f=this.model,e=f.columns,o=this.getColumnByField(n),t=e.indexOf(o),i,u;if((this.editFormValidate()&&(f.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),this._clearContextMenu(),this._removeDetailsRow(),this._clearColumnMenu(),r.isNullOrUndefined(o)||t==-1)||t==0&&t<=this._frozenColumnsLength||(i=this._getFrozenColumnWidth(t),i=i+18,i>this._gridWidth))return!1;for(u=0;u<t;u++)e[u].isFrozen=!0;s._refreshFrozenColumns()},freezeColumn:function(n,t){var i=this,u=this.model,s=u.columns,f=this.getColumnByField(n),e,o;if((this.editFormValidate()&&(u.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),this._clearContextMenu(),this._removeDetailsRow(),this._clearColumnMenu(),u.selectionSettings.selectionMode=="cell"&&i.clearSelection(),r.isNullOrUndefined(f))||i._frozenColumnsLength==u.columns.length-1&&t||f.isFrozen==t||(e=this._getFrozenColumnWidth(),o=s.indexOf(f),e=e+(t?this.columnsWidthCollection[o]+18:-this.columnsWidthCollection[o]),e>this._gridWidth))return!1;f.isFrozen=t;i._refreshFrozenColumns();i._off(i.element,"mousewheel DOMMouseScroll",i._mouseWheel);this._frozenColumnsLength&&i._on(i.element,"mousewheel DOMMouseScroll",i._mouseWheel)},updateCheckboxColumn:function(t){var i=this,h=i.model,u=h.columns,s=i.getColumnByField(t),f,e,o;i._checkboxSelection&&(n.each(u,function(n,t){t.showCheckbox=!1}),r.isNullOrUndefined(s)||(f=u.indexOf(s),f>-1&&(u[f].showCheckbox=!0)),e={},o={},e.selectionType=r.TreeGrid.SelectionType.Checkbox,o.selectionSettings=e,i._refreshSelectionSettings(o,"selectionSettings"))},_refreshSelectionSettings:function(t,i){var u=this,f=u.model,o=!1,e,s,h;o=!r.isNullOrUndefined(t[i].selectionType)||!r.isNullOrUndefined(t[i].selectionMode);i=="selectionType"?(f.selectionSettings.selectionType=t[i],o=!0):i=="selectionMode"?(f.selectionSettings.selectionMode=t[i],o=!0,f.showColumnChooser&&f.showColumnOptions&&u.columnAddDialogTemplate()):n.extend(f.selectionSettings,t[i]);e=f.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox&&f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row;(!r.isNullOrUndefined(t[i].enableHierarchySelection)&&f.selectedItems.length>0||!e&&u._checkboxSelection)&&(u._isFromSetmodel=!0,u.selectAllRows(!1),u._isFromSetmodel=!1);(u._checkboxSelection||e)&&(u._checkboxSelection=e,u._processEditing(),(!e&&u._checkboxColumnName=="checkboxState"||f.columns[0].nonColumn&&u._checkboxColumnName!="checkboxState")&&(s=f.columns[f.treeColumnIndex],f.columns[0].isFrozen&&(f.columns[0].isFrozen=!1,u._frozenColumnsLength-=1,h=u._frozenColumns.indexOf(f.columns[0]),u._frozenColumns.splice(h,1),f.scrollSettings.frozenColumns=this._frozenColumnsLength),f.columns.splice(0,1),s&&(f.treeColumnIndex=f.columns.indexOf(s))),u._checkboxSelection||(u._checkboxColumnName=null),u._$gridHeaderContent.replaceWith(u._renderGridHeader()),u._setWidthToHeaders(),f.allowFiltering&&u._resizeFilteringElements(),o&&(u._addInitTemplate(),this.renderRecords()),u.setWidthToColumns(),u._updateScrollCss(),u._updateHeaderScrollLeft(),f.selectedItems.length>0&&u.selectAllRows())},_setModel:function(t){var i=this,u=i.model,y=i.getUpdatedRecords(),f,tt,g,lt,it,ot,v,at,l,p,st,ht,w,rt,c,b,k,d,h,s,vt,ut,ft,nt,ct;for(f in t)switch(f){case"enableAltRow":u.enableAltRow=t[f];i._addInitTemplate();i.renderRecords(c);break;case"allowFiltering":!u.allowFiltering&&i._filteredColumnValueID.length>0&&i._clearAllFilter(i._filteredColumnValue);u.allowFiltering=t[f];i._initiateSetModel();u.allowFiltering=t[f];var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),et=0,o=e.scrollTop();i._$gridHeaderContent.replaceWith(i._renderGridHeader());i._setWidthToHeaders();u.showTotalSummary&&(et=i.element.find(".e-footersummaryrowdiv").outerHeight());n("#"+i._id).addClass("e-treegrid-overflow");i._viewPortHeight=i.element.height()-(i._getNonContentHeight()+et);n("#"+i._id).removeClass("e-treegrid-overflow");i._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight);e.option("height",i._viewPortHeight);u.enableVirtualization&&(h=u.currentViewData.length,s=u.rowHeight,s+=u.showDetailsRow&&!u.showDetailsRowInfoColumn?u.detailsRowHeight:0,h*s<i._viewPortHeight&&(h>0?(o=o-(i._viewPortHeight-(h-1)*s),o<0&&(o=0)):(i.processBindings(),i.renderRecords())));u.showColumnChooser&&u.showColumnOptions&&i.columnAddDialogTemplate();u.allowFiltering&&u.filterSettings.filterType=="menu"&&i._renderedFilterMenuDialog.length==0&&i._renderFilterMenu();this.setWidthToColumns();e.scrollY(o,!0);e.scrollX(a,!0);i._updateHeaderScrollLeft(a);i._updateScrollCss();break;case"enableResize":i.model.enableResize=t[f];u.enableResize?i._on(n(window),"resize",i._windowResize):i._off(n(window),"resize",i._windowResize);break;case"isResponsive":i.model.isResponsive=t[f];u.isResponsive?(i._on(n(window),"resize",i._windowResize),n("#"+i._id+"_toolbarItems").addClass("e-treegridadaptivetoolbar"),i._mediaQueryUpdate(),i._off(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this)),i._on(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this))):(i._off(n(window),"resize",i._windowResize),i._off(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this)),n("#"+i._id+"_toolbarItems").removeClass("e-treegridadaptivetoolbar"),i._mediaQueryUpdate());break;case"headerTextOverflow":u.headerTextOverflow=t[f];i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.updateViewPortHeight();u.enableVirtualization&&(i.cancelRowEditCell(),i.processBindings(),tt={},s=u.rowHeight,tt.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(tt),u.showDetailsRow&&u.detailsTemplate&&!u.showDetailsRowInfoColumn&&(s+=u.detailsRowHeight),u.currentViewData.length*s<i._viewPortHeight&&(g=o-(i._viewPortHeight-u.currentViewData.length*s),g<0&&(g=0),i._$gridContent.ejScroller("scrollY",g,!0)));i._$gridContent.ejScroller({height:i._viewPortHeight});i._updateScrollCss();i.setWidthToColumns();break;case"enableVirtualization":u.enableVirtualization=t[f];lt=i._prevSelectedItem;it=i.selectedRowIndex()&&y[i.selectedRowIndex()];i.processBindings();u.enableVirtualization||(this._frozenColumnsLength>0?(i._$frozenTableContent.css({top:0}),i._$movableTableContent.css({top:0})):i._$tableContent.css({top:0}));it&&i.selectedRowIndex(y.indexOf(it));c={};c.requestType=r.TreeGrid.Actions.Refresh;i.sendDataRenderingRequest(c);i._isRowEdit=u.isEdit=!1;i._cancelSaveTools();i._clearColumnMenu();i._clearContextMenu();this._removeDetailsRow();break;case"allowColumnResize":u.allowColumnResize=t[f];u.allowColumnResize&&(i._resizer=new r.gridFeatures.gridResize(i));i._enableColumnResizeEvents();break;case"allowSorting":u.allowSorting=t[f];i.sortSetting(t[f]);u.showColumnChooser&&u.showColumnOptions&&i.columnAddDialogTemplate();break;case"allowPaging":if(u.allowPaging){i.element.append(i._renderGridPager());i.element.append(i.element.find(".e-pager").first());i.element.find(".e-pager").css({width:i._gridWidth-2});var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),o=e.scrollTop();i._viewPortHeight=i._getViewPortHeight();u.showTotalSummary&&(i._viewPortHeight-=i._$totalSummaryRowContainer.outerHeight());e.option("height",i._viewPortHeight);e.scrollY(o,!0);e.scrollX(a,!0);i._pagerHeight=i.element.find(".e-pager").outerHeight();i.gotoPage()}else ot=i.element.find(".e-pager").first().outerHeight(),i.element.find(".e-pager").first().remove(),i._viewPortHeight=i._viewPortHeight+ot,this._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight),i.getScrollElement().ejScroller({height:i._viewPortHeight}),u.pageSettings.totalRecordsCount>0?i._refreshDataSource():i.refreshContent(),i.renderRecords(),i._isRefreshAddedRecord=!1;break;case"dragTooltip":v=t[f].tooltipItems;v&&!n.isArray(v)&&(v=v.length>0?v.split(","):[],t[f].tooltipItems=v);n.extend(u.dragTooltip,t[f]);i._createDragTooltipTemplate();i.refreshContent();break;case"allowDragAndDrop":u.allowDragAndDrop=t[f];at=jQuery.uaMatch(navigator.userAgent);i.refreshContent();break;case"sortSettings":n.extend(u.sortSettings,t[f]);i.refreshContent();l={};l.requestType=r.TreeGrid.Actions.Refresh;i.sendDataRenderingRequest(l);break;case"allowSelection":u.allowSelection=t[f];u.allowSelection||(i._checkboxSelection&&u.selectedItems.length>0&&(i._isFromSetmodel=!0,i.selectAllRows(!1),i._isFromSetmodel=!1),i.clearSelection(-1),i.selectedRowIndex(-1),i.model.selectedItem=null,i._cancelSaveTools());break;case"selectionType":case"selectionMode":case"selectionSettings":this._initiateSetModel();i.clearAllSelection();i._refreshSelectionSettings(t,f);i.model.allowSelection&&i.model.selectionSettings.selectionType=="multiple"&&n("#"+i._id+"_selectionpopup").length==0&&!i.model.isFromGantt&&i._renderMultiSelectionIndicator();break;case"showSummaryRow":u.showSummaryRow=t[f];u.showSummaryRow?(i._createSummaryRow(),l={},l.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(l)):(n(i.element).find(".e-summaryrow").hide(),u.updatedRecords=i._spliceSummaryRows(u.updatedRecords),u.allowPaging&&(i._updateCurrentViewData(),l={},l.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(l)));i.updateCollapsedRecordCount();i.updateHeight();break;case"showTotalSummary":u.showTotalSummary=t[f];u.showTotalSummary?(i._createTotalSummaryRow(),i._setWidthToFooters(),i._viewPortHeight=i._getViewPortHeight(),i._viewPortHeight-=n(i._$totalSummaryRowContainer).height()):(n(i.element).find(".e-footersummaryrowdiv").remove(),i._viewPortHeight=i._getViewPortHeight());var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),o=e.scrollTop();i._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight);e.option("height",i._viewPortHeight);u.enableVirtualization&&(h=u.currentViewData.length,s=u.rowHeight,s+=u.showDetailsRow&&!u.showDetailsRowInfoColumn?u.detailsRowHeight:0,h*s<i._viewPortHeight&&(h>0?(o=o-(i._viewPortHeight-(h-1)*s),o<0&&(o=0)):(i.processBindings(),i.renderRecords())));e.scrollY(o,!0);e.scrollX(a,!0);i._updateHeaderScrollLeft(a);i._updateScrollCss();break;case"selectedRowIndex":this.isEdit||this._isRowEdit?this.selectedRowIndex(y.indexOf(i._prevSelectedItem)):(this.selectedRowIndex()>=0&&!r.isNullOrUndefined(this.selectedRowIndex())&&u.allowSelection&&y.length>this.selectedRowIndex()&&this.getExpandStatus(y[this.selectedRowIndex()])?(p=this.selectedRowIndex(),i._rowSelectingEventTrigger(this._previousIndex,p)||(u.showSummaryRow&&(st=i._spliceSummaryRows(u.updatedRecords),ht=st[p],p=y.indexOf(ht)),i.selectRows(p),i._rowSelectedEventTrigger(p))):(i.clearSelection(-1),i.selectedRowIndex(-1),i.model.selectedItem=null,i._previousIndex=-1),i._cancelSaveTools());break;case"selectedCellIndexes":u.allowSelection&&u.selectionSettings.selectionMode=="cell"&&i.selectCells(t[f]);break;case"editSettings":n.extend(u.editSettings,t[f]);i._processEditing();i._enableEditingEvents();i._updateToolbarItems();break;case"allowKeyboardNavigation":u.allowKeyboardNavigation=t[f];break;case"dataSource":i._isRowEdit||i.model.isEdit||i._refreshDataSource();break;case"columns":u.columns=t[f].slice(0);i._validateColumnFields();i._refreshFrozenColumns();break;case"rowHeight":u.rowHeight=t[f];i._addInitTemplate();i.renderRecords(c);i.updateHeight();break;case"treeColumnIndex":i.columnIndex(t[f]);break;case"showColumnChooser":u.showColumnChooser=t[f];i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.setWidthToColumns();i.getScrollElement().ejScroller("refresh");i._updateScrollCss();u.showColumnChooser?(i._renderColumnChooser(),u.allowFiltering&&u.filterSettings.filterType=="menu"&&i._renderedFilterMenuDialog.length==0&&i._renderFilterMenu()):(i._clearColumnMenu(),n("#"+i._id+"ccDiv_wrapper").remove(),n("#"+i._id+"filterMenu_wrapper").remove());u.isFromGantt&&(i._addEmptyColumntoGrid(),this._updateHeaderScrollLeft(this.getScrollElement().ejScroller("model.scrollLeft")));break;case"showColumnOptions":u.showColumnOptions=t[f];i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.setWidthToColumns();i.getScrollElement().ejScroller("refresh");i._updateScrollCss();u.showColumnChooser&&u.showColumnOptions?(i.columnAddDialogTemplate(),i._renderUpdateConfirmDialog()):(i._clearColumnMenu(),n("#"+i._id+"ccDiv_wrapper").remove(),n("#"+i._id+"filterMenu_wrapper").remove());u.isFromGantt&&i._addEmptyColumntoGrid();break;case"locale":i._clearContextMenu();i._clearColumnMenu();i._removeDetailsRow();u.locale=t[f];i._setCultureInfo();i._processEditing();i._addInitTemplate();i.refreshContent();i._$gridHeaderContent.replaceWith(i._renderGridHeader());i.renderRecords(c);i.setWidthToColumns();i.getScrollElement().ejScroller("refresh");i._updateScrollCss();u.showColumnChooser&&i._renderColumnChooserList(!0);u.toolbarSettings.showToolbar&&i._updateToolbar();u.allowPaging&&i.getPager().ejPager("option",t[f]).ejPager("refreshPager");i.model.showColumnChooser&&i.model.showColumnOptions&&(i.columnAddDialogTemplate(),i._renderUpdateConfirmDialog());u.allowFiltering&&u.filterSettings.filterType=="menu"&&i._renderFilterMenu();break;case"toolbarSettings":n.extend(i.model.toolbarSettings,t[f]);i._updateToolbar();break;case"contextMenuSettings":n.extend(i.model.contextMenuSettings,t[f]);u.contextMenuSettings.showContextMenu||i._clearContextMenu();this._removeDetailsRow();break;case"enableCollapseAll":u.enableCollapseAll=t[f];u.enableCollapseAll?i.collapseAll():i.expandAll();break;case"showDetailsRow":u.showDetailsRow=t[f];this._updateDetailsRowProperties("showDetailsRow");break;case"detailsRowHeight":u.detailsRowHeight=t[f];this._updateDetailsRowProperties("detailsRowHeight");break;case"detailsTemplate":u.detailsTemplate=t[f];this._updateDetailsRowProperties("detailsTemplate");break;case"showDetailsRowInfoColumn":u.showDetailsRowInfoColumn=t[f];this._updateDetailsRowProperties("showDetailsRowInfoColumn");break;case"altRowTemplateID":this._initiateSetModel();u.altRowTemplateID=t[f];i._addInitTemplate();i.renderRecords(c);this.updateHeight();break;case"rowTemplateID":this._initiateSetModel();u.rowTemplateID=t[f];i._addInitTemplate();i.renderRecords(c);this.updateHeight();break;case"pageSettings":this._initiateSetModel();u.allowPaging&&(n.extend(u.pageSettings,t[f]),this.getPager().ejPager("option",u.pageSettings).ejPager("refreshPager"),t[f].totalRecordsCount>0?i._refreshDataSource():i.gotoPage());break;case"sizeSettings":this._initiateSetModel();n.extend(u.sizeSettings,t[f]);this._calculateDimensions();this._getViewPortHeight()<=0&&(u.sizeSettings.height="450px",this._updateElementHeight());this._windowResize();break;case"readOnly":u.readOnly=t[f];break;case"showGridCellTooltip":u.showGridCellTooltip=t[f];break;case"showGridExpandCellTooltip":u.showGridExpandCellTooltip=t[f];break;case"allowMultiSorting":u.allowMultiSorting=t[f];break;case"query":i=this;u.query=r.isNullOrUndefined(t[f])?r.Query():t[f];i._refreshDataSource();break;case"filterSettings":if(u.allowFiltering)if(t.filterSettings.filterType||u.filterSettings.filterType!="filterbar"){if(t.filterSettings.filterType){u.allowFiltering=!0;n.extend(i.model.filterSettings,t[f]);i._initiateSetModel();var e=i.getScrollElement().ejScroller("instance"),a=e.scrollLeft(),o=e.scrollTop();i._$gridHeaderContent.replaceWith(i._renderGridHeader());i._setWidthToHeaders();n("#"+i._id).addClass("e-treegrid-overflow");i._viewPortHeight=i._getViewPortHeight();n("#"+i._id).removeClass("e-treegrid-overflow");u.filterSettings.filterType=="menu"&&i._renderedFilterMenuDialog.length==0&&i._renderFilterMenu();i._frozenColumnsLength>0&&i._$gridContent.css("height",i._viewPortHeight);e.option("height",i._viewPortHeight);u.enableVirtualization&&(h=u.currentViewData.length,s=u.rowHeight,s+=u.showDetailsRow&&!u.showDetailsRowInfoColumn?u.detailsRowHeight:0,h*s<i._viewPortHeight&&(h>0?(o=o-(i._viewPortHeight-(h-1)*s),o<0&&(o=0)):(i.processBindings(),i.renderRecords())));u.showColumnChooser&&u.showColumnOptions&&i.columnAddDialogTemplate();this.setWidthToColumns();e.scrollY(o,!0);e.scrollX(a,!0);i._updateHeaderScrollLeft(a);i._updateScrollCss()}}else{for(c={},n.extend(i.model.filterSettings,t[f]),w=i.model.filterSettings,rt=r.isNullOrUndefined(w.filterBarMode)?"immediate":w.filterBarMode,b=n.extend([],w.filteredColumns),k=0;k<u.columns.length;k++)u.columns[k].allowFiltering&&i._clearFilterElementValue(u.columns[k]);for(w.filteredColumns=b,w.filterBarMode=rt,c.requestType="filtering",d=0;d<b.length;d++)n("#"+i._id+"_"+b[d].field.split(".").join("")+"_filterbarcell").val(b[d].value);i._ensureDataSource(c);i._off(i.element,"keyup",".e-filterbarcell input",i._filterBarHandler);i._off(i.element,"click",".e-filterbarcell .e-checkbox",i._filterBarHandler);rt=="immediate"&&(i._on(i.element,"keyup",".e-filterbarcell input",i._filterBarHandler),i._off(i.element,"click",".e-filterbarcell .e-checkbox")._on(i.element,"click",".e-filterbarcell .e-checkbox",i._filterBarHandler))}break;case"columnResizeSettings":this._initiateSetModel();n.extend(u.columnResizeSettings,t[f]);this._updateGridResizeSettings();ct=u.columnResizeSettings.columnResizeMode;ct==r.TreeGrid.ColumnResizeMode.FixedColumns?this._updateTableWidth():(this._frozenColumnsLength>0?(ut=n(this.getHeaderTable()[1]),ft=n(this.getContentTable()[1]),nt=u.showTotalSummary?n(this._$footertableContent[1]):null):(ut=this.getHeaderTable(),ft=this.getContentTable(),nt=u.showTotalSummary?n(this._$footertableContent[0]):null),ut.css("width","").removeClass("e-tableLastCell"),ft.css("width","").removeClass("e-tableLastCell"),nt&&nt.css("width","").removeClass("e-tableLastCell"));this._updateScrollCss()}},_initiateSetModel:function(){var n=this.model;this.editFormValidate()&&(n.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());this._clearContextMenu();this._clearColumnMenu();this._removeDetailsRow()},_updateDetailsRowProperties:function(n){var t=this,i=this.model,u;if((i.isEdit||this._isRowEdit)&&(this.cancelRowEditCell(),this._cancelSaveTools()),this.clearColumnMenu(),this._clearContextMenu(),this._removeDetailsRow(),t._detailsRowHeight=i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn?i.detailsRowHeight:0,i.flatRecords.forEach(function(n){n.isDetailsExpanded=i.showDetailsRow&&i.detailsTemplate?i.showDetailsRowInfoColumn?!1:!0:!1}),(n=="detailsTemplate"||n=="detailsRowHeight")&&i.showDetailsRowInfoColumn)t._addInitTemplate();else{t._$gridHeaderContent.replaceWith(t._renderGridHeader());t._addInitTemplate();this.onScrollHelper(0);t.refreshContent();t._isRendered=!1;u={};u.requestType=r.TreeGrid.Actions.Refresh;t.sendDataRenderingRequest(u);t.setWidthToColumns();t._isRendered=!0;t._trigger("refresh");this._eventBindings();this._hideCollapsedDetailsRows();t.getScrollElement().ejScroller("refresh");t._updateScrollCss()}},_hideCollapsedDetailsRows:function(){var t=this,i=this.model;i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(this._frozenColumnsLength>0?n(t.getTreeGridRows()[0]).add(t.getTreeGridRows()[1]).filter("tr.collapsedrowexpandeddetailsrow").css("display","none"):n(t.getTreeGridRows()).filter("tr.collapsedrowexpandeddetailsrow").css("display","none"))},_updateToolbar:function(){var t=this,r=t.model,i=t.getScrollElement().ejScroller("instance"),u=i.scrollLeft(),f=i.scrollTop();n("#"+t._id+"_toolbarItems").remove();r.toolbarSettings.showToolbar&&t._renderToolbarTemplate().insertBefore(n("#"+t._id+"e-gridheader"));r.isEdit&&t.cancelEditCell();t._isRowEdit&&(t.cancelRowEditCell(),t._cancelSaveTools());t._viewPortHeight=t._getViewPortHeight();t._frozenColumnsLength>0&&t._$gridContent.css("height",t._viewPortHeight);i.option("height",t._viewPortHeight);r.enableVirtualization&&(t.processBindings(),t.renderRecords());i.option("scrollTop",f);i.option("scrollLeft",u);t._clearContextMenu();this._removeDetailsRow()},_refreshDataSource:function(){var t=this,i=this.model,o,e,u,f;if((t._isRowEdit||t.model.isEdit)&&t.cancelRowEditCell(),t.resetModelCollections(),t._createdAt="load",this.dataSource()instanceof r.DataManager)o=this.dataSource().executeQuery(i.query),o.done(r.proxy(function(u){var o,f,e;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:u.result,i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(o=[],t._taskIds=[],f=0;f<t._retrivedData.length;f++)e=t._retrivedData[f],o.push(n.extend(!0,{},e)),e[i.idMapping]&&t._taskIds.push(e[i.idMapping]);t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createRecords(t.secondaryDatasource);args={};args.requestType=r.TreeGrid.Actions.RefreshDataSource;t._ensureDataSource(args);t.selectedRowIndex()!==-1&&t.selectedRowIndex()<t.model.currentViewData.length&&t.selectRows(t.selectedRowIndex());t.getScrollElement().hasClass("e-scroller")&&t.getScrollElement().ejScroller("refresh");t._createdAt=null}));else if(this.dataSource()){if(t._retrivedData=t.dataSource(),i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(e=[],t._taskIds=[],u=0;u<t._retrivedData.length;u++)f=t._retrivedData[u],e.push(n.extend(!0,{},f)),f[i.idMapping]&&t._taskIds.push(f[i.idMapping]);t._reconstructDatasource(e);t._createRecords(t.secondaryDatasource)}else i.flatRecords.length===0&&this.dataSource()!==null&&t._createRecords(this.dataSource());args={};args.requestType=r.TreeGrid.Actions.RefreshDataSource;t._ensureDataSource(args);this.selectedRowIndex()!==-1&&this.selectedRowIndex()<t.model.currentViewData.length&&t.selectRows(this.selectedRowIndex());t.getScrollElement().hasClass("e-scroller")&&t.getScrollElement().ejScroller("refresh");t._createdAt=null}else this.dataSource()==null&&(args={},args.requestType=r.TreeGrid.Actions.RefreshDataSource,t._ensureDataSource(args),t._createdAt=null);n(".e-tooltiptable").remove();(i.showSummaryRow||i.showTotalSummary)&&t._summaryRow()},refreshContent:function(){var t=this,n={};n.requestType=r.TreeGrid.Actions.Refresh;t.processBindings(n)},resetModelCollections:function(){var n=this,t=n.model;t.currentViewData=[];t.flatRecords=[];t.parentRecords=[];t.updatedRecords=[];t.summaryRowRecords=[];t.ids=[];n.secondaryDatasource=[];n._parentRecords=[];n._storedIndex=-1;n._idGenerator=-1;n._taskIds=[]},_initPrivateProperties:function(){var t=this,i=this.model;t._id=t.element.attr("id");t.columnsWidthCollection=[];t._cSortedColumn=null;t._taskIds=[];t._cSortedDirection=null;t._dataManager=null;t._disabledSortableColumns=[];t._filteredRecords=[];t._disabledToolItems=[];proxy_currentFilterColumn=[];t._fieldColumnNames=[];t._multiSortRequest=null;t._$gridContainer=null;t._$gridContent=null;t._$gridContentTable=null;t._$gridHeaderTable=null;t._$gridHeaderContainer=null;t._$totalSummaryRowContainer=null;t._recordsCount=null;t._$gridRows=null;t._gridRows=null;this._frozenColumnsLength=0;t._initFrozenColumns();t._allowFreezingDefault=this._frozenColumnsLength>0?!0:!1;t._calculateDimensions();t._headerColumnNames=[];t._hiddenColumns=[];t._multiSelectCtrlRequest=!1;t._multiSelectShiftRequest=!1;t._offset=0;t._previousIndex=-1;t._prevRBottom=0;t._prevRTop=0;t._prevScrollTop=0;t._prevScrollLeft=0;t._prevVBottom=0;t._resizer=null;t._scrollTop=0;t._scrollLeft=0;t._searchString="";t._fieldName="";t._selectedCellsinARow=[];t._currentRecordIndex=-1;t._sortedRecords=[];t._storedIndex=-1;t._rowIndex=-1;t._$tableContent=null;t._$footertableContent=null;t._$footerContainer=null;t._tempsortedrecords=[];t._totalHeight=0;t._viewPortHeight=0;t._recordIndexCount=0;t._totalCollapsedRecordCount=0;t._visibleColumns=[];t._visibleRange=null;t._vScrollDir=1;t._vScrollDist=0;t._cellEditTemplate=n();t._tooltipTimer;t._totalBorderWidth=2;t._totalBorderHeight=1;t._toolboxTooltipTexts=null;t._contextMenuTexts=null;t._columnMenuTexts=null;t._deleteColumnText=null;t._okButtonText=null;t._cancelButtonText=null;t._confirmDeleteText=null;t._dropDownListBlanksText=null;t._editTypeText=null;t._textAlignType=null;t._clipMode=null;t._dropDownListClearText=null;t._trueText=null;t._falseText=null;t._rowDragIndexes=[];t._dropCancel=!1;t._cellEditingDetails={cellValue:null,rowIndex:-1,columnIndex:-1,fieldName:null,_data:null,cellEditType:"",cancelSave:!1,defaultData:null,insertedTrCollection:[],data:null};t._previousSelectedCellDetails={rowElement:null,cellElement:null,cellIndex:-1,rowIndex:-1};t._shiftKeyFirstElementDetails={firstElementRowIndex:-1,firstElementCellIndex:-1};t._selectedCellDetails=[];t._focusingRowIndex=-1;t._rowIndexOfLastSelectedCell=-1;t._lastSelectedCellIndex=-1;t._tdsOffsetWidth=[];t._isEnterKeyPressed=!1;t._isShiftKeyNavigation=!1;t._scrollBarHeight=18;t._removedCount=0;t._$gridHeaderContent=null;t.secondaryDatasource=[];t._contextMenuItems=null;t._subContextMenuItems=null;t._createContextMenuTemplate();t._createColumnMenuTemplate();t._retrivedData=this.dataSource();t._createdAt="load";t._isInExpandCollapseAll=!1;t._dataManager=t.dataSource()instanceof r.DataManager?t.dataSource():t.dataSource()!=null?r.DataManager(t.dataSource()):null;t._dragMouseDown=!1;t._dragTooltip=!1;t._dragMouseLeave=!1;_timerDragDown=null;_timerDragUp=null;t._isDataManagerUpdate=!1;t._jsonData=null;t._isRefreshAddedRecord=!1;t._isInAdd=!1;t._maxRowIndex=0;t._isRendered=!1;this._updateGridResizeSettings();t._isSummaryRow=!1;t._flatChildRecords=[];t._footerSummaryRecord=[];t._filteredChildRecords=[];t._parentRecords=[];t._zerothLevelParentRecords=[];t._detailsRowHeight=0;i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(t._detailsRowHeight=i.detailsRowHeight);t._isEmptyRow=!1;t._isPublicAdd=!1;t._prevSelectedItem=null;t._dataSourcefields=[];t._columnDialogTexts=null;t._columnDialogTitle=null;t._addColumnFields=[];t._addColumnFieldsTxt=[];t._targetColumnIndex=0;t._insertPosition=null;t._updateconfirmDialog=null;t._columnRenameDialog=null;t._renderedSubMenuType=null;t.localizedLabels=t._getLocalizedLabels();t._gridRecordsCount=i.pageSettings.totalRecordsCount;t._gridPager=null;t._summaryRowsCount=0;t._updatedPageData=[];t._isNextPage=!1;i.selectionSettings.selectionType=i.selectionSettings.selectionType!="single"?i.selectionSettings.selectionType:i.selectionType!="single"?i.selectionType:i.selectionSettings.selectionType;i.selectionSettings.selectionMode=i.selectionSettings.selectionMode!="row"?i.selectionSettings.selectionMode:i.selectionMode!="row"?i.selectionMode:i.selectionSettings.selectionMode;t._idGenerator=-1;t._checkboxColumnName=null;t._isFromSetmodel=!1;t._flatFilteredRecords=[];t._checkboxSelection=i.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox&&i.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row;t._addCheckboxColumn=this._getDefaultCheckboxColumn();t._filteredColumnValue=[];t._filteredColumnValueID=[];t._filterIconTarget=null;t._renderedFilterMenuDialog=[];t._filtermenutext=null;t._headerDragStatus="";t._draggedColumn=null;t._mouseDragged=!1;t.treeIndentLevelWidth=!r.isNullOrUndefined(i.indentLevelWidth)&&i.isFromGantt?i.indentLevelWidth:t.treeIndentLevelWidth?t.treeIndentLevelWidth:10;t._draggedColumnTemplate=null;t._viewPortWidth=t._gridLeft=0;t._responsiveMinWidth=768;t._dy=t._dx=0;t._isTouchEvent=!1;t._isTouchTrigger=!1;t._currentEditRecordDialogIndex=-1;t._isTreeAddEditDialogSave=!1;t._displayContextMenu=i.contextMenuSettings.showContextMenu?!0:!1;t._isEmptyRowDeleted=!1},_getDefaultCheckboxColumn:function(){return{field:"checkboxState",headerText:"",allowEditing:!1,allowDelete:!1,allowSorting:!1,allowCellSelection:!1,isFrozen:!1,nonColumn:!0,editType:"booleanedit",width:50,textAlign:"center"}},_updateGridResizeSettings:function(){var n={resizeMode:this.model.columnResizeSettings.columnResizeMode=="fixedcolumns"?"control":this.model.columnResizeSettings.columnResizeMode};this.model.resizeSettings=n},_calculateDimensions:function(){var n=this,t=this.model,u,i;if(t.isFromGantt||(t.sizeSettings.width&&n.element.css("width",t.sizeSettings.width),t.sizeSettings.height?n.element.css("height",t.sizeSettings.height):n.element[0].style.height?t.sizeSettings.height=n.element[0].style.height:n.element.height(450)),n._gridHeight=Math.round(n.element.height()),n._gridWidth=Math.round(n.element.width()),this._frozenColumnsLength>0){for(u=0,i=0;i<=this._frozenColumnsLength;i++)t.columns[i]&&(u+=r.isNullOrUndefined(t.columns[i].width)?150:parseInt(t.columns[i].width));n._gridWidth<u&&(n.element.css("width",u),t.sizeSettings.width=n._gridWidth=u)}},_initFrozenColumns:function(){for(var u=[],e=[],s=0,h=0,f=this.model,i=f.columns,o=i[f.treeColumnIndex],t=0;t<i.length;t++)i[t].isFrozen===!0?(u.push(i[t]),(r.isNullOrUndefined(i[t].visible)||i[t].visible)&&(s+=1)):(e.push(i[t]),(r.isNullOrUndefined(i[t].visible)||i[t].visible)&&(h+=1));u.length>0&&(f.columns.length&&f.columns.length==u.length&&(e=u.splice(u.length-1,1),e[0].isFrozen=!1),f.columns=n.merge(n.merge([],u),e));this._frozenColumns=u;this._unFrozenColumns=e;s==0&&this._frozenColumns[0]&&(this._frozenColumns[0].visible=!0);h==0&&this._unFrozenColumns[0]&&(this._unFrozenColumns[0].visible=!0);o&&(f.treeColumnIndex=f.columns.indexOf(o));this._frozenColumnsLength=u.length;f.scrollSettings.frozenColumns=this._frozenColumnsLength},updateAltRowOnCollapseAll:function(){var i=this,n=i.model,t;if(n.enableAltRow&&n.enableCollapseAll)for(t=n.parentRecords,count=0;count<t.length;count++)(record=t[count],record.isSummaryRow)||(record.isAltRow=count%2==0?!1:!0)},updateAltRowOnRendering:function(){var t=this,i=t.model,n=i.updatedRecords.filter(function(n){return n.parentItem==null?n:n.parentItem.expanded?n:void 0});for(count=0;count<n.length;count++)(record=n[count],record.isSummaryRow)||(record.isAltRow=count%2==0?!1:!0)},_checkDataBinding:function(){var t=this,i=t.model;n("#"+t._id).addClass("e-treegrid-overflow");t._createdAt=null;t.element.addClass("e-treegrid-core");t.element.attr("tabindex","0");t._renderToolbar();t._checkboxSelection&&t._updateCheckboxColumnName();t._renderAfterColumnInitialize();t.model.showColumnChooser?(t._renderColumnChooser(),t.model.allowFiltering&&t.model.filterSettings.filterType=="menu"&&t._renderFilterMenu()):t.model.allowFiltering&&t.model.filterSettings.filterType=="menu"&&t._renderFilterMenu();t._setWidthToHeaders();t.model.allowPaging&&(t.element.append(t._renderGridPager()),t.element.append(t.element.find(".e-pager").attr({id:this._id+"Pager"})));t._viewPortHeight=t._getViewPortHeight();!i.isFromGantt&&t._viewPortHeight<0&&t._updateElementHeight();t._ensureDataSource();i.showSummaryRow&&t._createSummaryRow();i.isFromGantt||t.updateAltRowOnCollapseAll();i.expandStateMapping&&i.enableAltRow&&t.updateAltRowOnRendering();t._initGridRender();t._$gridContent=n("#"+t._id+"e-gridcontent");t._$gridContainer=n("#"+t._id+"e-gridcontainer");t._$tableContent=n("#"+t._id+"e-table");t._$frozenTableContent=n("#"+t._id+"frozene-table");t._$movableTableContent=n("#"+t._id+"movablee-table");t._viewPortHeight=t._getViewPortHeight();t._$gridContent.css({height:t._viewPortHeight+"px"});t.element.find(".e-pager").css({width:t._gridWidth-2});t._pagerHeight=t.element.find(".e-pager").outerHeight();i.showTotalSummary&&(t._createTotalSummaryRow(),t._viewPortHeight=t._getViewPortHeight(),(!i.allowPaging||i.sizeSettings.height)&&(t._viewPortHeight=t._viewPortHeight-t._$totalSummaryRowContainer.outerHeight()));t._updatePagerTextAlignment();t.updateHeight();t._wireEvents();t.setWidthToColumns();t._renderScroller();t._updateScrollCss();t._resizeFilteringElements();t._initialEndRendering();i.isFromGantt&&t._addEmptyColumntoGrid();i.isFromGantt?(t._isDataManagerUpdate=i.dataManagerUpdate.isDataManagerUpdate,t._jsonData=i.dataManagerUpdate.jsonData):t._checkDataManagerUpdate();t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&!t.model.isFromGantt&&t._renderMultiSelectionIndicator();n("#"+t._id).removeClass("e-treegrid-overflow")},_renderMultiSelectionIndicator:function(){this._multiSelectPopup=r.buildTag("div.e-treegridpopup#"+this._id+"_selectionpopup","",{display:"none"});var n=r.buildTag("div.e-popupcontent"),t=r.buildTag("div.e-downtail e-tail"),i=r.buildTag("span.e-rowselect e-icon");n.append(i);this._multiSelectPopup.append(n);this._multiSelectPopup.append(t);this.element.append(this._multiSelectPopup)},getUpdatedDataManagerData:function(){var n=this;return n._jsonData},_checkDataManagerUpdate:function(){var n=this,t=this.dataSource();n._isDataManagerUpdate=!1;n._jsonData=null;t instanceof r.DataManager&&(t.dataSource.offline&&t.dataSource.json?(n._isDataManagerUpdate=!0,n._jsonData=t.dataSource.json):t.dataSource.offline||(n._isDataManagerUpdate=!0,n._jsonData=n._retrivedData))},_initDatasource:function(){var t=this,i=t.model,o,e,u,f;if(i.isFromGantt)t._checkDataBinding();else if(this.dataSource()instanceof r.DataManager)o=this.dataSource().executeQuery(i.query),o.done(r.proxy(function(r){var e,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(e=[],t._taskIds=[],u=0;u<t._retrivedData.length;u++)f=t._retrivedData[u],e.push(n.extend(!0,{},f)),f[i.idMapping]&&t._taskIds.push(f[i.idMapping]);t._reconstructDatasource(e);t._createRecords(t.secondaryDatasource)}else t._retrivedData&&t._createRecords(t._retrivedData);t._checkDataBinding()}));else if(this.dataSource()){if(t._retrivedData=t.dataSource(),i.idMapping&&i.parentIdMapping&&t._retrivedData.length>0){for(e=[],t._taskIds=[],u=0;u<t._retrivedData.length;u++)f=t._retrivedData[u],e.push(n.extend(!0,{},f)),f[i.idMapping]&&t._taskIds.push(f[i.idMapping]);t._reconstructDatasource(e);t._createRecords(t.secondaryDatasource)}else i.flatRecords.length===0&&this.dataSource()!==null&&t._createRecords(this.dataSource());t._checkDataBinding()}else t._checkDataBinding()},_intersectionObjects:function(n,t){for(var r=[],i;n.length>0&&t.length>0;)i=t.indexOf(n[0]),i==-1?n.shift():(r.push(n.shift()),t.splice(i,1));return r},_reconstructDatasource:function(n){var f=this,u=f.model,i,s,e,t,o,h,c;for(s=r.Predicate(u.parentIdMapping,r.FilterOperators.notEqual,"null"),i=r.DataManager(n).executeLocal(r.Query().where(s).group(u.parentIdMapping)),e=[],u.chidMapping||(u.childMapping="Children"),t=0;t<i.length;t++){if(!r.isNullOrUndefined(i[t].key)&&(o=f._taskIds.indexOf(i[t].key),o>-1)){n[o][u.childMapping]=i[t].items;continue}h=i[t].items;for(c in i[t].items)e.push(h[c])}f.secondaryDatasource=f._intersectionObjects(n,e)},_windowResize:function(){var t,i,rt,ut,ft,k,et,d,g,nt,a,ot,o,e,v,y,p;if(this.element.is(":visible")){t=this;i=this.model;n("#"+t._id).addClass("e-treegrid-overflow");var s=t._$gridHeaderContent,w=t._$totalSummaryRowContainer,b,l=n("#"+t._id+"_toolbarItems"),h=i.sizeSettings.height,c=i.sizeSettings.width,tt=t.element[0].style.width,it=t.element[0].style.height,u,f;if(t._clearContextMenu(),t.model.isResponsive||r.isTouchDevice()?r.isTouchDevice()||t._clearColumnMenu("resize"):(t._clearColumnMenu(),t._clearFilterMenu()),b=this._frozenColumnsLength>0?this.element.find("#e-movablecontainer"+this._id):n("#"+t._id+"e-gridcontent"),n("#"+this._id+"detailscellwrapper").length>0&&this._removeDetailsRow(),c&&typeof c!="number"&&c.indexOf("%")!=-1||tt.indexOf("%")!=-1){var st=c?c:tt,ht=n(t.element).parent().width()?n(t.element).parent().width():n(t.element).width(),ct=ht/100*parseInt(st);u=ct}else u=n(t.element).width();if(t._gridWidth=u,t._frozenColumnsLength>0){for(o=0,e=0;e<=t._frozenColumnsLength;e++)o+=t.columnsWidthCollection[e];u<o&&(t._gridWidth=u=o)}if(h&&typeof h!="number"&&h.indexOf("%")!=-1||it.indexOf("%")!=-1?(rt=h?h:it,ut=n(t.element).parent().height()?n(t.element).parent().height():n(t.element).height(),ft=n(t.element).parent().height()?ut/100*parseInt(rt):n(t.element).height(),f=ft):f=n(t.element).height(),f=f-t._totalBorderHeight,t._$totalSummaryRowContainer&&(f-=t._$totalSummaryRowContainer.outerHeight()),u=Math.round(u-t._totalBorderWidth),d=l.length>0?l.outerHeight():0,k=b.ejScroller("option","scrollTop"),et=b.ejScroller("option","scrollLeft"),g=u,nt=0,i.allowPaging&&(a=t.element.find(".e-pager").outerHeight(),ot=r.isNullOrUndefined(i.pageSettings.template)?!1:!0,f-=a,!i.sizeSettings.height)){for(o=0,a>t._pagerHeight&&!ot&&(nt=a-t._pagerHeight),e=0;e<t.columnsWidthCollection.length;e++)o+=t.columnsWidthCollection[e];o>t._gridWidth&&(f=f+t._scrollBarHeight)}this._frozenColumnsLength>0&&(t._$gridContent.css("width",u),t._$gridContent.css("height",f-n(s).outerHeight()-d),g=u-this._getFrozenColumnWidth()-1);t.getScrollElement().ejScroller({width:g,height:f-n(s).outerHeight()-d+nt});t._updateScrollCss();n(s).hasClass("e-scrollcss")&&t.getScrollElement().children(".e-vscrollbar").length>0?n(s).width(u-17):n(s).width(u);t._$totalSummaryRowContainer&&(t._$totalSummaryRowContainer.outerHeight()>=90&&t._$totalSummaryRowContainer.hasClass("e-scroller")?t._$totalSummaryRowContainer.ejScroller("refresh"):n(w).hasClass("e-scrollcss")&&t.getScrollElement().children(".e-vscrollbar").length>0?n(w).width(u-17):n(w).width(u));i.toolbarSettings.showToolbar&&l.length>0&&l.width(u);t.getScrollElement().ejScroller("refresh");t.updateViewPortHeight();i.showTotalSummary&&(t._viewPortHeight=t._viewPortHeight-t._$totalSummaryRowContainer.outerHeight());t.getScrollElement().ejScroller("option","scrollTop",k);t.getScrollElement().ejScroller("option","scrollLeft",et);t._updateHeaderScrollLeft();i.enableVirtualization&&(t.cancelRowEditCell(),v={},y=i.rowHeight,v.requestType=r.TreeGrid.Actions.Refresh,t.processBindings(v),t.sendDataRenderingRequest(v),i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(y+=i.detailsRowHeight),i.currentViewData.length*y<t._viewPortHeight&&(p=k-(t._viewPortHeight-i.currentViewData.length*y),p<0&&(p=0),t.getScrollElement().ejScroller("scrollY",p,!0)));i.allowPaging&&t.element.find(".e-pager").css({width:t._gridWidth-2});t._resizeFilteringElements();i.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||i.isFromGantt||this._updateTableWidth(!0);t.model.isResponsive&&!t.model.isFromGantt&&t._mediaQueryUpdate();t._updatePagerTextAlignment();t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&t._alignMultiSelectPopup();n("#"+t._id).removeClass("e-treegrid-overflow")}},_updatePagerTextAlignment:function(){var t=this,i,r;t.model.allowPaging&&(n("#"+t._id+"Pager").find(".e-pagercontainer").outerWidth()+n("#"+t._id+"Pager").find(".e-parentmsgbar").outerWidth()+10>n("#"+t._id).width()?(i=(n("#"+t._id).width()-n("#"+t._id+"Pager").find(".e-pagercontainer").outerWidth())/2,r=(n("#"+t._id).width()-n("#"+t._id+"Pager").find(".e-parentmsgbar").width())/2,i>0&&n("#"+t._id+"Pager").find(".e-pagercontainer").css("margin-left",i+"px"),r>0&&n("#"+t._id+"Pager").find(".e-parentmsgbar").css("margin-right",r-6+"px")):(n("#"+t._id+"Pager").find(".e-pagercontainer").css("margin-left",""),n("#"+t._id+"Pager").find(".e-parentmsgbar").css("margin-right","")))},_alignMultiSelectPopup:function(){var n=this,r=n._$gridContent.offset().top+n._$gridContent.outerHeight(),u=n._$gridContent.offset().left+n._$gridContent.outerWidth(),t,i;(n._multiSelectPopup.offset().top+n._multiSelectPopup.outerHeight()+10>r||n._multiSelectPopup.offset().top<n._$gridContent.offset().top||n._multiSelectPopup.offset().left+n._multiSelectPopup.outerWidth()>u||n._multiSelectPopup.offset().left<n._$gridContent.offset().left)&&(t=n._$gridContent.offset().top+n._$gridContent.outerHeight()/2,i=n._$gridContent.offset().left+n._$gridContent.outerWidth()/2,n._$gridContent.find(".e-hscrollbar").length>0&&(t=t-n._$gridContent.find(".e-hscrollbar").outerHeight()),n._$gridContent.find(".e-vscrollbar").length>0&&(i=i-n._$gridContent.find(".e-vscrollbar").outerWidth()),n._multiSelectPopup.offset({top:t-this._multiSelectPopup.height()/2-5,left:i-this._multiSelectPopup.width()/2}))},_mediaQueryUpdate:function(){var t=this,i=t.getOffsetRect(n("#"+t._id)[0]),u,e,f;n("#"+t._id+"_dialogColumnAdd_wrapper").length>0&&n("#"+t._id+"_dialogColumnAdd_wrapper").css("display")!="none"&&(n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive?(n("#"+t._id+"_dialogColumnAdd").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css("width",n("#"+t._id).width()-80+"px"),n("#"+t._id+"_dialogColumnAdd").ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,allowDraggable:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"_dialogColumnAdd_wrapper").css({left:i.left+"px",top:i.top+"px"}),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-shadow"),n("#"+t._id+"_dialogColumnAdd").removeClass("e-shadow")):(n("#"+t._id+"_dialogColumnAdd").ejDialog({width:"auto",height:"auto",minHeight:0,minWidth:0,showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+t._id+"_dialogColumnAdd").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").addClass("e-treegridadaptivedialog e-treegrid-dialog"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css("width","438px"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").addClass("e-shadow")));n("#"+t._id+"ColumnRenameDialog_wrapper").length>0&&n("#"+t._id+"ColumnRenameDialog_wrapper").css("display")!="none"&&(n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive?(n("#"+t._id+"ColumnRenameDialog").removeClass("e-treegridadaptivedialog"),t._columnRenameDialog.ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",position:{X:i.left,Y:i.top},minHeight:"50px",minWidth:"50px",showOnInit:!1,allowDraggable:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"ColumnRenameDialog_wrapper").css({left:i.left+"px",top:i.top+"px"}),n("#"+t._id+"ColumnRenameDialog_wrapper").removeClass("e-shadow"),n("#"+t._id+"ColumnRenameDialog").removeClass("e-shadow"),n("#"+t._id+"ColumnRenameDialog_wrapper").removeClass("e-treegridadaptivedialog")):(t._columnRenameDialog.ejDialog({width:"auto",height:"auto",minHeight:0,minWidth:0,showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+t._id+"ColumnRenameDialog").addClass("e-treegridadaptivedialog"),n("#"+t._id+"ColumnRenameDialog_wrapper").addClass("e-treegridadaptivedialog e-treegrid-dialog")));t._renderedSubMenuType?(u="",t._renderedSubMenuType.indexOf("Desktop")==-1?u=t._renderedSubMenuType:(e=t._renderedSubMenuType.indexOf("Desktop"),u=t._renderedSubMenuType.slice(0,e)),n(u+"_wrapper").length>0&&n(u+"_wrapper").css("display")!="none"?n(window).width()<=t._responsiveMinWidth&&t._renderedSubMenuType.indexOf("Desktop")==-1&&t.model.isResponsive?(f=n("#"+t._id).height()-50+"px",n(t._renderedSubMenuType+"_wrapper").find("div.e-dialog-scroller").addClass("e-treegridadaptivewidth"),n(t._renderedSubMenuType).ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",position:{X:i.left+"px",Y:i.top+"px"},minHeight:"50px",minWidth:"50px",showOnInit:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n(t._renderedSubMenuType).height()>n(t._renderedSubMenuType+"_wrapper").height()-48?(n(t._renderedSubMenuType+"_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-48+"px",width:"auto",padding:"0px"}),n(t._renderedSubMenuType).ejDialog("refresh")):n(t._renderedSubMenuType+"_wrapper").find("div.e-dialog-scroller").css({height:f,width:"auto"})):r.isTouchDevice()?(t._renderedSubMenuType.indexOf("Desktop")==-1&&n(window).width()>t._responsiveMinWidth||t._renderedSubMenuType.indexOf("Desktop")!=-1&&n(window).width()<=t._responsiveMinWidth)&&(t._clearColumnMenu(),t._clearFilterMenu()):t._clearFilterMenu():(r.isTouchDevice()&&!t._renderedSubMenuType||r.isTouchDevice()&&n(u+"_wrapper").length>0&&n(u+"_wrapper").css("display")=="none")&&t._clearColumnMenu()):(r.isTouchDevice()&&!t._renderedSubMenuType||r.isTouchDevice()&&n(u+"_wrapper").length>0&&n(u+"_wrapper").css("display")=="none")&&t._clearColumnMenu();n("#"+t._id+"ccDiv_wrapper").length>0&&n("#"+t._id+"ccDiv_wrapper").css("display")!="none"&&(n(window).width()<t._responsiveMinWidth&&t._renderedSubMenuType.indexOf("AdaptiveColChooser")==0&&t.model.isResponsive?(f=n("#"+t._id).height()-66+"px",n("#"+t._id+"ccDiv").ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"ccDiv").css({width:"100%",height:"auto"}),n("#"+t._id+"ccDiv").height()>n("#"+t._id+"ccDiv_wrapper").height()-48?(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-48+"px",width:"auto",padding:"0px"}),n("#"+t._id+"ccDiv").removeClass("e-columnSelector"),n("#"+t._id+"ccDiv").ejDialog("refresh")):(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:f,width:"auto",padding:"8px 16px"}),n("#"+t._id+"ccDiv").css({padding:"0px"})),n("#"+t._id+"ccDiv_wrapper").removeClass("e-shadow"),n("#"+t._id+"ccDiv").removeClass("e-shadow")):t._clearColumnMenu());n("#"+t._id+"_dialogEdit").length>0&&n("#"+t._id+"_dialogEdit").css("display")!="none"&&(n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive?(n("#"+t._id+"_dialogEdit").ejDialog({width:n("#"+t._id).width()+"px",height:n("#"+t._id).height()+"px",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,allowDraggable:!1,enableModal:!1,isResponsive:!1}),n("#"+t._id+"_dialogEdit_wrapper").css({left:i.left+"px",top:i.top+"px"}),n("#"+t._id+"_dialogEdit_wrapper").removeClass("e-shadow").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogEdit").removeClass("e-shadow")):(n("#"+t._id+"_dialogEdit").ejDialog({width:"auto",height:"auto",minHeight:"150px",minWidth:"150px",showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+t._id+"_dialogEdit_wrapper").addClass("e-shadow").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogEdit").addClass("e-shadow")));t._renderedSubMenuType&&(t._renderedSubMenuType.indexOf("AdaptiveColChooser")==0||t._renderedSubMenuType.indexOf("ColumnDesktop")==0)&&t._clearColumnMenu()},updateResponsiveMinWidth:function(n){var t=this;parseInt(n)<150&&(n=150);t._responsiveMinWidth=parseInt(n);t._mediaQueryUpdate()},processBindings:function(t){var i=this,u=i.model;if(u.query=new r.Query,!i._isEmptyRow&&i._trigger("actionBegin",t))return t.requestType=="filtering"&&n("#"+i._id+"_"+t.currentFilteringColumn+"_filterbarcell").val(""),!0;i._ensureDataSource(t)},setUpdatedRecords:function(n,t,i,r,u){var f=this.model;f.flatRecords=n;f.updatedRecords=t;f.ids=i;f.parentRecords=r;this.dataSource(u)},getExpandedRecords:function(n){var t=this;return n.filter(function(n){return t.getExpandStatus(n)==!0})},updateExpandStatus:function(n,t){for(var u=this,r=n.childRecords,i=0;i<r.length;i++)r[i].isExpanded=t,r[i].hasChildRecords&&r[i].expanded&&u.updateExpandStatus(r[i],t)},_ensureDataSource:function(t){var i=this,u=i.model,y=u.sortSettings.sortedColumns,f=u.filterSettings.filteredColumns,s=!1,a=this.dataSource(),p=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),h,e,o,c,v,l;if(i._filteredRecords=[],i._flatFilteredRecords=[],u.query.requiresCount(),i._queryManagar=u.query,n.type(a)==="array"||a instanceof r.DataManager||(this.dataSource([]),a=this.dataSource()),t&&t.requestType===r.TreeGrid.Actions.ExpandCollapse&&(s=!0,i._filteredRecords=[],t.data.expanded=t.expanded,r.isNullOrUndefined(t.data.item[u.expandStateMapping])||(t.data[u.expandStateMapping]=t.expanded,t.data.item[u.expandStateMapping]=t.expanded),u.updatedRecords=[],i._flatFilteredRecords=u.flatRecords,i._filteredRecords=i._flatFilteredRecords.filter(function(n){return i.getExpandStatus(n)==!0}),u.updatedRecords=i._filteredRecords),t&&t.requestType=="filtering"||u.allowFiltering&&!u.isFromGantt&&f.length){if(u.showSummaryRow&&(u.updatedRecords=i._spliceSummaryRows(u.updatedRecords),u.flatRecords=i._spliceSummaryRows(u.flatRecords)),u.allowFiltering&&!u.isFromGantt&&f.length){for(e=f[0],e.value==i._dropDownListBlanksText?(h=r.Predicate(e.field,"equal",null),h=h.or(e.field,"equal","")):h=e.isComplex?e:r.Predicate(e.field,e.operator,e.value,!e.matchcase),r.isNullOrUndefined(t)&&i._storePreviousFilteredValue(e.field,e.value,e.operator),o=1;o<f.length;o++)h=f[o].isComplex?h.and(f[o]):h[f[o].predicate](f[o].field,f[o].operator,f[o].value,!f[o].matchcase),r.isNullOrUndefined(t)&&i._storePreviousFilteredValue(f[o].field,f[o].value,f[o].operator);i._queryManagar.where(h);i._filteredRecords=u.flatRecords.slice();c=new r.DataManager(i._filteredRecords);i._tempfilteredrecords=c.executeLocal(i._queryManagar).result;i._updateFilteredRecords(i._tempfilteredrecords);u.updatedRecords=i._filteredRecords;u.allowPaging&&u.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(u.parentRecords=i._getParentRecords(u.updatedRecords,i,!0));u.allowSorting&&u.sortSettings.sortedColumns.length>0&&i._sortingRecords()}else u.updatedRecords=u.enableVirtualization?i.getExpandedRecords(u.flatRecords):u.flatRecords.slice(),i._updateHasFilteredChildRecordsStatus(u.updatedRecords),u.allowPaging&&u.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(u.parentRecords=i._getParentRecords(u.updatedRecords,i,!0));t&&!u.isFromGantt&&t.requestType=="filtering"&&i._checkboxSelection&&u.selectionSettings.enableHierarchySelection&&t.requestType=="filtering"&&(n.each(u.updatedRecords,function(n,t){t.hasChildRecords&&i._updateParentSelection(t)}),i.selectAllRows());u.showSummaryRow&&i._createSummaryRow(t);t&&u.showTotalSummary&&i._updateTotalSummaryRow(t);i.updateCollapsedRecordCount();i.updateHeight();s=!0;u.enableAltRow&&i.updateAltRow()}u.allowSearching&&i._searchString.length||t&&t.requestType==="searching"?(i._queryManagar.search(i._searchString,i.getColumnFieldNames(),r.FilterOperators.contains,!0),i._filteredRecords=u.flatRecords.filter(function(n){return n.hasChildRecords===!1}),u.isFromGantt&&(p.model.searchSettings={fields:i._getColumnMappingNames(),key:i._queryManagar.queries[0].e.searchKey,operator:"contains",ignoreCase:!0}),c=new r.DataManager(i._filteredRecords),i._tempfilteredrecords=c.executeLocal(i._queryManagar).result,i._updateFilteredRecords(i._tempfilteredrecords),u.updatedRecords=i._filteredRecords,u.allowSorting&&u.sortSettings.sortedColumns.length>0&&i._sortingRecords(),i.updateCollapsedRecordCount(),i.updateHeight(),s=!0,u.enableAltRow&&i.updateAltRow(),i.clearSelection()):(u.allowSorting&&y.length>0||t&&t.requestType=="sorting")&&(i._sortingRecords(),u.showSummaryRow&&i._createSummaryRow(t),s||(i.updateCollapsedRecordCount(),i.updateHeight(),s=!0));t&&(t.requestType==="outdent"||t.requestType==="indent")&&(t={},t.requestType=r.TreeGrid.Actions.Refresh,s=!0);t&&u.allowPaging&&t.requestType=="delete"&&(v={},v.totalRecordsCount=i.getExpandedRecords(u.flatRecords).length,i.getPager().ejPager("option",v).ejPager("refreshPager"),l=l=this.getPager().ejPager("model"),i._currentPage()>l.totalPages&&i._currentPage(l.totalPages),s=!0);s||(i._zerothLevelParentRecords=u.parentRecords.slice(),u.updatedRecords=u.enableVirtualization?u.enableCollapseAll&&!t?i._zerothLevelParentRecords:i.getExpandedRecords(u.flatRecords):u.flatRecords.slice(),i.updateCollapsedRecordCount(),i.updateHeight());t||(t={},t.requestType=u.allowPaging?r.TreeGrid.Actions.Paging:r.TreeGrid.Actions.Refresh,t.inital=!0);i._updateCurrentViewData();(u.isFromGantt||t.requestType!=="save")&&t.requestType!=="sorting"&&t.requestType!=="searching"&&t.requestType!=="delete"&&t.requestType!=="refreshDataSource"&&t.requestType!=="filtering"&&t.requestType!=="dragAndDrop"&&(t.inital||t.requestType!=="paging")||(i._isRefreshAddedRecord=!1,i.renderRecords(t),i._setScrollTop(),i.getScrollElement().ejScroller("refresh"),i._updateScrollCss())},_removeChildRecords:function(n,t){var e=this,o=e.model,u=r.isNullOrUndefined(t.childRecords)?[]:t.childRecords,f=n.indexOf(t),i;for(f>-1&&(t.checkboxState="unchecked",n.splice(f,1)),i=0;i<u.length;i++)u[i].hasChildRecords?e._removeChildRecords(n,u[i]):(f=n.indexOf(u[i]),f>-1&&(u[i].checkboxState="unchecked",n.splice(f,1)));t.parentItem&&o.selectionSettings.enableHierarchySelection&&e._updateParentSelection(t.parentItem)},_removeChildItem:function(n){for(var i,t,u=this,f=0;f<n.childRecords.length;f++)t=n.childRecords[f],this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?(i=this.dataSource().dataSource.json.indexOf(t.item),i!==-1&&this.dataSource().dataSource.json.splice(i,1),t.hasChildRecords&&u._removeChildItem(t)):u._isDataManagerUpdate&&(i=u._jsonData.indexOf(t.item),i!==-1&&u._jsonData.splice(i,1),t.hasChildRecords&&u._removeChildItem(t)):(i=this.dataSource().indexOf(t.item),i!==-1&&this.dataSource().splice(i,1),t.hasChildRecords&&u._removeChildItem(t))},_updateCheckboxColumnName:function(){var n=this,t=n.model,i,u;n._checkboxSelection&&(i=t.columns.filter(function(n){return n.showCheckbox==!0}),n._addCheckboxColumn=this._getDefaultCheckboxColumn(),n._checkboxColumnName=i.length>0?i[0].isTemplateColumn?null:i[0].field:null,r.isNullOrUndefined(n._checkboxColumnName)&&(u=t.columns[t.treeColumnIndex],t.columns[0].nonColumn?n._checkboxColumnName=t.columns[0].field:(t.columns.splice(0,0,n._addCheckboxColumn),n._checkboxColumnName=n._addCheckboxColumn.field),u&&(t.treeColumnIndex=t.columns.indexOf(u))),n._frozenColumnsLength>0&&!t.columns[0].isFrozen&&n._checkboxColumnName==n._addCheckboxColumn.field&&(t.columns[0].isFrozen=!0,n._frozenColumnsLength+=1,n._frozenColumns.splice(0,0,t.columns[0]),t.scrollSettings.frozenColumns=this._frozenColumnsLength))},_processEditing:function(){var i=this,t=i.model;i._checkboxSelection&&i._updateCheckboxColumnName();(t.editSettings.allowEditing||t.editSettings.allowAdding)&&(t.editSettings.editMode.toLowerCase()==="cellediting"||t.editSettings.editMode.toLowerCase()==="rowediting"||t.editSettings.editMode.toLowerCase()==="normal"&&t.selectionSettings.selectionMode.toLowerCase()==="cell"?i._addCellEditTemplate():t.editSettings.editMode.toLowerCase()==="dialogediting"&&(r.isNullOrUndefined(t.editSettings.dialogEditorTemplateID)||t.editSettings.dialogEditorTemplateID=="")?(i._treeGridAddEditDialog(),n("#"+this._id+"_dialogEdit").length==0&&this.element.append(this._renderEditDialog())):t.editSettings.editMode.toLowerCase()!=="dialogediting"||r.isNullOrUndefined(t.editSettings.dialogEditorTemplateID)||t.editSettings.dialogEditorTemplateID==""||(i._treeGridAddEditDialogTemplate(),n("#"+this._id+"_dialogEdit").length==0&&this.element.append(this._renderEditDialog())))},_toolBarClick:function(t){if(t.event.which&&(t.event.which==3||t.event.which==2)||t.event.button&&t.event.button==2)return!1;var e=this,c=e.model,f=n(this.itemsContainer).closest(".e-treegrid"),r=f.ejTreeGrid("instance"),i=f.attr("id"),o=n("#"+r._id+"_toolbarItems");if(t.event==u&&t.target.tagName=="INPUT"&&t.currentTarget.id==i+"_search")return!1;r.model.dateFormat.toLowerCase().indexOf("hh")!=-1?n.isFunction(n.fn.ejDateTimePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDateTimePicker("hide"):n.isFunction(n.fn.ejDatePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDatePicker("hide");var s=t.currentTarget,l=t.target,h={itemName:t.text,currentTarget:s,model:r.model,sender:t};if(f.ejTreeGrid("instance")._trigger("toolbarClick",h))return!1;n(o).ejToolbar("deselectItem",t.currentTarget);switch(t.currentTarget.id){case i+"_add":r._toolbarOperation(i+"_add",t);break;case i+"_edit":r._toolbarOperation(i+"_edit",t);break;case i+"_delete":r._toolbarOperation(i+"_delete",t);break;case i+"_update":r._toolbarOperation(i+"_update",t);break;case i+"_cancel":r._toolbarOperation(i+"_cancel",t);break;case i+"_expandAll":r._toolbarOperation(i+"_expandAll",t);break;case i+"_collapseAll":r._toolbarOperation(i+"_collapseAll",t);break;case i+"_pdfExport":r._toolbarOperation(i+"_pdfExport",t);break;case i+"_excelExport":r._toolbarOperation(i+"_excelExport",t)}return!1},_toolbarOperation:function(n,t){var e=this.element,u=e.ejTreeGrid("instance"),r=e.attr("id"),i=this,s=this.selectedItem(),h=t.target,o=i.model.allowPaging?this._updatedPageData.indexOf(s):this.selectedRowIndex(),f;u._exportTo=u["export"];switch(n){case r+"_add":i.model.selectionSettings.selectionMode=="cell"&&(i.model.editSettings.rowPosition="top");i.model.editSettings.allowEditing&&i.model.editSettings.editMode=="dialogEditing"?i._showTreeGridAddEditDialog(-1,"add"):i._startAdd(h,null);break;case r+"_edit":i.updateScrollBar();i.model.editSettings.allowEditing&&i.model.editSettings.editMode=="dialogEditing"?i._showTreeGridAddEditDialog(o):i._editRow(o);break;case r+"_delete":i.deleteRow();i._cancelSaveTools();i._isRefreshAddedRecord=!1;break;case r+"_update":f=i.model.editSettings.editMode;f.toLowerCase()=="cellediting"?this.editFormValidate()&&(i.model.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()):f.toLowerCase()=="rowediting"&&this.editFormValidate()&&i.saveRow();i._clearContextMenu();this._removeDetailsRow();i._focusTreeGridElement();break;case r+"_cancel":f=i.model.editSettings.editMode;f.toLowerCase()=="cellediting"?i._isRowEdit?i.cancelRowEditCell():i.cancelEditCell():f.toLowerCase()=="rowediting"&&i.cancelRowEditCell();i._cancelSaveTools();i._clearContextMenu();this._removeDetailsRow();break;case r+"_expandAll":i.expandAll();break;case r+"_collapseAll":i.collapseAll();break;case r+"_pdfExport":u._exportTo(u.model.exportToPdfAction,"pdfExporting",u.model.allowMultipleExporting);break;case r+"_excelExport":u._exportTo(u.model.exportToExcelAction,"excelExporting",u.model.allowMultipleExporting)}return i._refreshToolBar(),!1},contextMenuOperations:function(n){var t=this,i=t.model,u=t._contextMenuSelectedIndex,o=t._contextMenuEvent,s=t._contextMenuSelectedItem,f,h,e;switch(n){case"Delete":t.deleteRow(null,!0);t._cancelSaveTools();t._clearContextMenu();break;case"Above":t._subContextMenuAction(s,u,"Above");t._focusTreeGridElement();break;case"Below":t._subContextMenuAction(s,u,"Below");t._focusTreeGridElement();break;case"Add":t._setInitialData();t._clearContextMenu();break;case"Edit":i.editSettings.editMode.toLowerCase()=="cellediting"?(f=i.columns[t.getCellIndex(o)],r.isNullOrUndefined(f)||f.allowEditing==!1||(t._focusTreeGridElement(),t._cellEditingDetails.columnIndex=t.getCellIndex(o),t._editedRowIndex=t._cellEditingDetails.rowIndex=t.getRowIndex(o),fieldName=t._cellEditingDetails.columnIndex>=0&&f.field,fieldName&&(t.updateScrollBar(),i.editSettings.allowEditing&&i.editSettings.editMode==r.TreeGrid.EditMode.CellEditing&&t.cellEdit(t._cellEditingDetails.rowIndex,fieldName)&&t._editAddTools()))):i.editSettings.editMode.toLowerCase()=="rowediting"?(t.updateScrollBar(),t._editRow(u)):t.model.editSettings.editMode.toLowerCase()=="dialogediting"&&t._showTreeGridAddEditDialog(u);t._clearContextMenu();break;case"Save":if(i.editSettings.editMode.toLowerCase()=="cellediting")if(this.editFormValidate())t._isRowEdit?t._endEdit():t.saveCell();else return!0;else i.editSettings.editMode.toLowerCase()=="rowediting"&&this.editFormValidate()&&t.saveRow();t._clearContextMenu();t._focusTreeGridElement();break;case"Cancel":h=t.model.editSettings.editMode;h.toLowerCase()=="cellediting"?t._isRowEdit?t.cancelRowEditCell():i.isEdit&&t.cancelEditCell():h.toLowerCase()=="rowediting"&&t.cancelRowEditCell();t._clearContextMenu();t._focusTreeGridElement();break;default:e={};e.data=s;e.menuId=n;t._triggerMenuEventHandler(n,e);t._clearContextMenu()}i.enableAltRow&&i.currentViewData[0]&&r.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0)},_setCultureInfo:function(){var t=this,u=t.model,f=u.locale,n=t.localizedLabel,i=r.TreeGrid.Locale["default"];n=u.predecessorTable||u.resourceTable?r.Gantt.Locale[f]:r.TreeGrid.Locale[f];t._toolboxTooltipTexts=n&&n.toolboxTooltipTexts?n.toolboxTooltipTexts:i.toolboxTooltipTexts;t._contextMenuTexts=n&&n.contextMenuTexts?n.contextMenuTexts:i.contextMenuTexts;t.model.isFromGantt?(t._columnMenuTexts=t.model.columnMenuTexts,t._deleteColumnText=t.model.deleteColumnText,t._okButtonText=t.model.okButtonText,t._cancelButtonText=t.model.cancelButtonText,t._columnDialogTexts=t.model.columnDialogTexts,t._columnDialogTitle=t.model.columnDialogTitle,t._confirmDeleteText=t.model.confirmDeleteText,t._editTypeText=t.model.editTypeText,t._textAlignTypeText=t.model.textAlignTypeText,t._clipModeText=t.model.clipModeText):(t._columnMenuTexts=n&&n.columnMenuTexts?n.columnMenuTexts:i.columnMenuTexts,t._columnDialogTexts=n&&n.columnDialogTexts?n.columnDialogTexts:i.columnDialogTexts,t._columnDialogTitle=n&&n.columnDialogTitle?n.columnDialogTitle:i.columnDialogTitle,t._deleteColumnText=n&&n.deleteColumnText?n.deleteColumnText:i.deleteColumnText,t._okButtonText=n&&n.okButtonText?n.okButtonText:i.okButtonText,t._cancelButtonText=n&&n.cancelButtonText?n.cancelButtonText:i.cancelButtonText,t._confirmDeleteText=n&&n.confirmDeleteText?n.confirmDeleteText:i.confirmDeleteText,t._editTypeText=n&&n.editTypeTexts?n.editTypeTexts:i.editTypeTexts,t._textAlignTypeText=n&&n.textAlignTypes?n.textAlignTypes:i.textAlignTypes,t._clipModeText=n&&n.clipModeTexts?n.clipModeTexts:i.clipModeTexts,t._dropDownListBlanksText=n&&n.dropDownListBlanksText?n.dropDownListBlanksText:i.dropDownListBlanksText,t._dropDownListClearText=n&&n.dropDownListClearText?n.dropDownListClearText:i.dropDownListClearText,t._trueText=n&&n.trueText?n.trueText:i.trueText,t._falseText=n&&n.falseText?n.falseText:i.falseText,t.model.emptyRecordText=n&&n.emptyRecord?n.emptyRecord:i.emptyRecord,t._filterMenuTexts=n&&n.filterMenuTexts?n.filterMenuTexts:i.filterMenuTexts)},_createNewRowInstance:function(n){var t=[];for(var i in n)t.push(i);return t},refresh:function(n,t){var i=this,u=i.model,f;r.isNullOrUndefined(n)?(f={},f.requestType=r.TreeGrid.Actions.Refresh,this.sendDataRenderingRequest(f)):(i.resetModelCollections(),u.dataSource=n,u.query=t,i.element.ejTreeGrid("destroy").ejTreeGrid(u))},_getNewIndex:function(){var n=this;return n._maxRowIndex+=1,n._maxRowIndex},_addRecord:function(t,i,u,f){var e=this,t,ft,ct,k,g,w,tt,et,yt,pt,ot;(e.model.isEdit||e._isRowEdit)&&e.cancelRowEditCell();var s=this.model,lt=this.selectedRowIndex(),o,c=s.updatedRecords,d=s.flatRecords,nt=s.parentRecords,h=s.selectionSettings.selectionMode=="row"?this.selectedItem():c[e._rowIndexOfLastSelectedCell],st=s.columns,p=this.dataSource(),b=0,y,it=-1,ht=!1,at=!1,v=this._getNewIndex(),l,vt=!1,a={},rt,ut;if(n.type(p)==="array"||p instanceof r.DataManager||(this.dataSource([]),p=this.dataSource()),r.isNullOrUndefined(t)){for(t=null,ft=0;ft<st.length;ft++)t=e._restoreCustomData(t,"",st[ft].field);at=!0}if(s.idMapping&&s.parentIdMapping&&!r.isNullOrUndefined(t[e.model.parentIdMapping])&&(ct=s.flatRecords.filter(function(n){return n[s.idMapping]==t[s.parentIdMapping]}),ct.length>0&&(h=ct[0],i=r.TreeGrid.RowPosition.Child,vt=!0)),(lt===-1&&e._rowIndexOfLastSelectedCell==-1&&(i===r.TreeGrid.RowPosition.Above||i===r.TreeGrid.RowPosition.Below||i===r.TreeGrid.RowPosition.Child)||!i||s.selectedItems.length>1&&!e._checkboxSelection)&&(vt||(i=r.TreeGrid.RowPosition.Top)),i==r.TreeGrid.RowPosition.Top||i==r.TreeGrid.RowPosition.Bottom?(rt=0,ut=null):i==r.TreeGrid.RowPosition.Above||i==r.TreeGrid.RowPosition.Below?(rt=h.level,ut=h.parentItem):i==r.TreeGrid.RowPosition.Child&&(rt=h.level+1,ut=h),a.requestType="add",a.data=t,a.level=rt,a.rowPosition=i,a.parentItem=ut,e._trigger("actionBegin",a)){if(f=="dialog")return!0}else{t=a.data;i!=a.rowPosition&&(i=a.rowPosition);t[s.childMapping]&&t[s.childMapping].length&&delete t[s.childMapping];e.selectRows(-1);switch(i){case r.TreeGrid.RowPosition.Top:b=0;l=null;o=e._createRecord(t,b);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);d.splice(0,0,o);c.splice(0,0,o);nt.splice(0,0,o);e._isDataManagerUpdate?e._jsonData.splice(0,0,o.item):p.splice(0,0,o.item);y=0;break;case r.TreeGrid.RowPosition.Bottom:b=0;l=null;o=e._createRecord(t,b);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);d.push(o);c.push(o);nt.push(o);e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item);y=c.indexOf(o);break;case r.TreeGrid.RowPosition.Above:b=h.level;l=h.parentItem;o=e._createRecord(t,b,l);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);g=d.indexOf(h);w=c.indexOf(h);d.splice(g,0,o);c.splice(w,0,o);r.isNullOrUndefined(l)?(nt.splice(nt.indexOf(h),0,o),e._isDataManagerUpdate?e._jsonData.splice(e._jsonData.indexOf(h.item),0,o.item):p.splice(p.indexOf(h.item),0,o.item)):(k=l.childRecords.indexOf(h),l.childRecords.splice(k,0,o),s.parentIdMapping?(o.item[s.parentIdMapping]=o.parentItem.item[s.idMapping],o[s.parentIdMapping]=o.parentItem.item[s.idMapping],e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item)):l.item[s.childMapping].splice(k,0,o.item));y=w;break;case r.TreeGrid.RowPosition.Below:b=h.level;l=h.parentItem;o=e._createRecord(t,b,l);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);tt=d.indexOf(h);h.hasChildRecords?(dataChildCount=e.getChildCount(h,0),g=tt+dataChildCount+1,w=c.indexOf(h)+e._getVisibleChildRecordCount(h,0,c)+1):(g=tt+1,w=c.indexOf(h)+1);d.splice(g,0,o);c.splice(w,0,o);r.isNullOrUndefined(l)?(nt.splice(nt.indexOf(h)+1,0,o),e._isDataManagerUpdate?e._jsonData.splice(e._jsonData.indexOf(h.item)+1,0,o.item):p.splice(p.indexOf(h.item)+1,0,o.item)):(k=l.childRecords.indexOf(h),l.childRecords.splice(k+1,0,o),s.parentIdMapping?(o.item[s.parentIdMapping]=o.parentItem.item[s.idMapping],o[s.parentIdMapping]=o.parentItem.item[s.idMapping],e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item)):l.item[s.childMapping].splice(k+1,0,o.item));y=w;break;case r.TreeGrid.RowPosition.Child:b=h.level+1;l=h;o=e._createRecord(t,b,l);o.index=v;s.idMapping&&s.parentIdMapping&&!e._isPublicAdd&&(o[s.idMapping]=v,o.item[s.idMapping]=v);tt=d.indexOf(h);h.hasChildRecords?(dataChildCount=e.getChildCount(h,0),g=tt+dataChildCount+1,h.expanded&&e.getExpandStatus(h)||(et={},et.expanded=!0,et.data=h,e._isInAdd=!0,e._isRefreshAddedRecord?(et.data.expanded=!0,e.updateExpandStatus(a.data,a.expanded),e.refreshContent(),e._isRefreshAddedRecord=!1):e._expandRecord(h),e._isInAdd=!1,c=e.getUpdatedRecords()),w=c.indexOf(h)+e._getVisibleChildRecordCount(h,0,c)+1-s.summaryRows.length):(e.getExpandStatus(h)||e._expandRecord(h.parentItem),c=e.getUpdatedRecords(),h.hasChildRecords=!0,h.childRecords=[],h.expanded=!0,s.parentIdMapping||(h.item[s.childMapping]=[]),h.isMilestone=!1,g=tt+1,w=c.indexOf(h)+1);d.splice(g,0,o);c.splice(w,0,o);r.isNullOrUndefined(l)||(k=l.childRecords.indexOf(h),l.childRecords.splice(k+1,0,o),s.parentIdMapping?(o.item[s.parentIdMapping]=o.parentItem.item[s.idMapping],o[s.parentIdMapping]=o.parentItem.item[s.idMapping],e._isDataManagerUpdate?e._jsonData.push(o.item):p.push(o.item)):l.item[s.childMapping].splice(k+1,0,o.item));y=w}if(s.allowPaging&&(i==r.TreeGrid.RowPosition.Below||i==r.TreeGrid.RowPosition.Child?(s.pageSettings.pageSizeMode!=="root"||r.isNullOrUndefined(h.parentItem))&&(yt=e._updatedPageData[e._updatedPageData.length-1],pt=e._updatedPageData.length==s.pageSettings.pageSize?s.updatedRecords.indexOf(yt):y,y>pt&&(e._currentPage(this._currentPage()+1),it=0)):i==r.TreeGrid.RowPosition.Top&&(e._currentPage()>1||e._currentPage()<1)?(e._currentPage(1),it=0):i==r.TreeGrid.RowPosition.Bottom&&e._currentPage()<s.pageSettings.totalPages&&(e._currentPage(s.pageSettings.totalPages),it=y)),!at&&(r.TreeGrid.RowPosition.Above||r.TreeGrid.RowPosition.Below)){var a={},st=s.columns,wt=st.length;s.allowPaging||(it=y);a.rowIndex=y;a.requestType="addNewRow";a.addedRow=t;e._trigger("actionComplete",a)?c.splice(y,1):(e._renderAddedRow(y,o),s.showSummaryRow&&(a.requestType=="addNewRow"&&i=="child"&&e._createAndRenderSummaryRecords(a),e._updateSummaryRow(a)),s.showTotalSummary&&e._updateTotalSummaryRow(a),ht=!0)}else e._renderAddedRow(y,o),ht=!0;s.enableVirtualization===!1&&(s.sortSettings.sortedColumns.length>0||s.filterSettings.filteredColumns.length>0)&&(e._isRefreshAddedRecord=!0);s.allowPaging&&(c=e._updatedPageData);ot=ht?c.indexOf(o):lt;s.allowSelection&&s.selectionSettings.selectionMode=="row"&&(e._rowSelectingEventTrigger(this._previousIndex,ot)||(e.selectRows(ot),s.selectionSettings.enableSelectAll&&e.selectAllRows(),e._checkboxSelection&&s.selectionSettings.enableHierarchySelection&&o.parentItem&&e._updateParentSelection(o.parentItem),e._rowSelectedEventTrigger(ot)));s.selectionSettings.selectionMode=="cell"&&(e._rowIndexOfLastSelectedCell=c.indexOf(o));e.updateScrollBar();u=="isEditRow"?e._editRow(c.indexOf(o),o):(r.TreeGrid.refreshRow(e,s.currentViewData.indexOf(o)),e._cancelSaveTools(),s.enableAltRow&&r.TreeGrid.updateAltRow(e,e.model.currentViewData[0],0,0));o.parentItem&&i==r.TreeGrid.RowPosition.Child&&(o.parentItem.childRecords.length==1||!o.parentItem.hasFilteredChildRecords)&&(o.parentItem.hasFilteredChildRecords=!0,r.TreeGrid.refreshRow(e,s.currentViewData.indexOf(o.parentItem)))}},_validateIdValue:function(t){var u=this,i=u.model,r=[],f=i.flatRecords;return r=n.map(f,function(n){if(n[i.idMapping]==t)return n}),r.length?!0:!1},_closeTreegridAddEditDialog:function(n,t){var i=this,r={};if(i._isTreeAddEditDialogSave)i._isTreeAddEditDialogSave=!1;else return r.requestType=t==="Add"?"closeAddDialog":"closeEditDialog",i._trigger("actionBegin",r)},showAddDialog:function(){var n=this;n.model.editSettings.allowAdding&&n.model.editSettings.editMode=="dialogEditing"&&n._showTreeGridAddEditDialog(null,"add")},showEditDialog:function(n){var t=this;t.model.editSettings.allowEditing&&t.model.editSettings.editMode=="dialogEditing"&&t._showTreeGridAddEditDialog(n)},_showTreeGridAddEditDialog:function(t,i){var s=document.createElement("div"),u=this,c=n(s),l=u.getOffsetRect(n("#"+u._id)[0]),o=[],a=u.model.columns,v=u._contextMenuTexts,h,f,e,arguments;if((r.isNullOrUndefined(t)||t==-1)&&!i&&(t=u.model.selectionSettings.selectionMode=="cell"?u.selectedCellIndexes()[0].rowIndex:u.selectedRowIndex()),o[0]=u.model.allowPaging?this._updatedPageData[t]:u.model.updatedRecords[t],i&&i.toLowerCase()==="add"){if(r.isNullOrUndefined(o[0]))for(o[0]=null,h=0;h<a.length;h++)o[0]=u._restoreCustomData(o[0],"",a[h].field);c.addClass("e-dialogaddrow")}else c.addClass("e-dialogeditedrow");r.isNullOrUndefined(u.model.editSettings.dialogEditorTemplateID)||u.model.editSettings.dialogEditorTemplateID==""?s.innerHTML=n.render[this._id+"_JSONDialogEditingTemplate"](o):r.isNullOrUndefined(u.model.editSettings.dialogEditorTemplateID)||u.model.editSettings.dialogEditorTemplateID==""||(s.innerHTML=n.render[this._id+"_JSONdialogTemplateMode"](o));this.model.editSettings.editMode=="dialogEditing"&&(n("#"+this._id+"_dialogEdit").html(n(s)),f={},f.cssClass=this.model.cssClass,f.enableRTL=!1,f.enableResize=!1,f.showOnInit=!1,f.content="#"+this._id,n(window).width()<=u._responsiveMinWidth&&u.model.isResponsive?(f.width=n("#"+u._id).width()+"px",f.height=n("#"+u._id).height()+"px",f.enableModal=!1,f.isResponsive=!1,f.allowDraggable=!1):(f.width="auto",f.height="auto",f.enableModal=!0,f.isResponsive=!1,f.allowDraggable=!0),f.allowKeyboardNavigation=!1,i&&i.toLowerCase()==="add"?(f.title=v.addRowText,f.beforeClose=function(n){u._closeTreegridAddEditDialog(n,"Add")&&(n.cancel=!0)}):(f.title=v.editText,f.beforeClose=function(n){u._closeTreegridAddEditDialog(n,"Edit")&&(n.cancel=!0)}),n("#"+this._id+"_dialogEdit").ejDialog(f),e={},e.data=o[0],i&&i.toLowerCase()==="add"?(e.requestType="beforeOpenAddDialog",e.rowPosition=u.model.editSettings.rowPosition):e.requestType="beforeOpenEditDialog",e.element=n("#"+u._id+"_dialogEdit"),u._trigger("actionBegin",e)||(arguments={},arguments.columnIndex=t,arguments.data=e.data,arguments.requestType="beginEdit",u._refreshEditForm(arguments),e.data=arguments.data,e.requestType=i&&i.toLowerCase()==="add"?"openAddDialog":"openEditDialog",e.element=n("#"+u._id+"_dialogEdit"),u._trigger("actionBegin",e)||(n("#"+this._id+"_dialogEdit").ejDialog("open"),u._currentEditRecordDialogIndex=t,n(window).width()<=u._responsiveMinWidth&&u.model.isResponsive?(n("#"+u._id+"_dialogEdit_wrapper").css({left:l.left+"px",top:l.top+"px"}),n("#"+u._id+"_dialogEdit_wrapper").removeClass("e-shadow").removeClass("e-treegridadaptivedialog"),n("#"+u._id+"_dialogEdit").removeClass("e-shadow")):(n("#"+u._id+"_dialogEdit_wrapper").addClass("e-shadow").addClass("e-treegridadaptivedialog"),n("#"+u._id+"_dialogEdit").addClass("e-shadow")),this._on(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",u._buttonClick),n("#"+u._id+"_dialogEdit").ejDialog("refresh"))));n.isFunction(n.validator)&&(u._initValidator(),u.setValidation())},addRow:function(n,t){var i=this,r=i.model;if(i._cancelEditState(),n)if(r.idMapping&&r.parentIdMapping)if(n[r.idMapping]&&!i._validateIdValue(n[r.idMapping]))i._isPublicAdd=!0,i._addRecord(n,t),i._isPublicAdd=!1;else return!1;else i._addRecord(n,t);else i._addRecord(null,t,"isEditRow")},_startAdd:function(){var n=this,t=this.model;n.model.allowSelection&&n.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&n._clearMultiSelectPopup();n._addRecord(null,t.editSettings.rowPosition,"isEditRow")},_getRecordIndexByItem:function(n,t){var i=r.DataManager(t).executeLocal(r.Query().where("item",r.FilterOperators.equal,n));return i.length>0?t.indexOf(i[0]):-1},_expandRecord:function(n){for(var t=n,i={};t!=null;)t.expanded==!1&&(i.expanded=!0,i.data=t,this._isInExpandCollapseAll=t.parentItem?!0:!1,r.TreeGrid.sendExpandCollapseRequest(this,i)),t=t.parentItem},scrollOffset:function(n,t){var i=this._$gridContent.data("ejScroller"),r=this.model;this.editFormValidate()&&(r.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());(typeof t=="number"||typeof parseInt(t)=="number")&&(t=parseInt(t),t>=0&&this.getMaxScrollHeight()>t&&i.scrollY(t,!0));(typeof n=="number"||typeof parseInt(n)=="number")&&(n=parseInt(n),n>=0&&this.getMaxScrollWidth()>n&&i.scrollX(n,!0))},getScrollTopOffset:function(){return this.getScrollElement().ejScroller("model.scrollTop")},getScrollLeftOffset:function(){return this.getScrollElement().ejScroller("model.scrollLeft")},scrollToTop:function(){var i=this.model,t=proxy.getUpdatedRecords(),r,n=-1;this.editFormValidate()&&(i.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());t=i.allowPaging?t:this.getExpandedRecords(i.updatedRecords);t.length>0&&(n=0,r=t[0],n=t.indexOf(r),i.allowSelection&&!this._rowSelectingEventTrigger(this.selectedRowIndex(),n)&&(this.selectRows(n),this._rowSelectedEventTrigger(n)),this.updateScrollBar(n))},scrollToBottom:function(){var t=this.model,i,r,n=-1;this.editFormValidate()&&(t.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());i=this.getExpandedRecords(t.updatedRecords);i.length>0&&(n=i.length-1,r=i[n],n=t.updatedRecords.indexOf(r),t.allowSelection&&!this._rowSelectingEventTrigger(this.selectedRowIndex(),n)&&(this.selectRows(n),this._rowSelectedEventTrigger(n)),this.updateScrollBar(n))},_editAddTools:function(){var u=this,e=u.model,t=n("#"+u._id+"_toolbarItems"),f=u.model.editSettings,i,r;toolbarItems=e.toolbarSettings.toolbarItems;i=[];f.allowAdding&&toolbarItems.indexOf("add")!==-1&&!n(t).find(".e-addnew").parent("li").hasClass("e-disable")&&i.push(n(t).find(".e-addnew").parent()[0]);f.allowEditing&&toolbarItems.indexOf("edit")!==-1&&!n(t).find(".e-edit").parent("li").hasClass("e-disable")&&i.push(n(t).find(".e-edit").parent()[0]);f.allowDeleting&&toolbarItems.indexOf("delete")!==-1&&!n(t).find(".e-delete").parent("li").hasClass("e-disable")&&e.editSettings.beginEditAction!="click"&&i.push(n(t).find(".e-delete").parent()[0]);i.forEach(function(i){n(t).ejToolbar("disableItem",i)});r=[];toolbarItems.indexOf("cancel")!==-1&&r.push(n(t).find(".e-cancel").parent()[0]);toolbarItems.indexOf("update")!==-1&&r.push(n(t).find(".e-save").parent()[0]);r.forEach(function(i){n(t).ejToolbar("enableItem",i)})},_cancelSaveTools:function(){var u=this,f=u.model,e=u.model.editSettings,t=n("#"+u._id+"_toolbarItems"),s=[],r=f.toolbarSettings.toolbarItems,o,i;if(f.isFromGantt){var t=n("#"+u._id.replace("ejTreeGrid","")+"_toolbarItems"),o=[],i=[];f.readOnly==!0?(i=[],i.push(n(t).find(".e-addnewitem").parent()[0]),i.push(n(t).find(".e-edititem").parent()[0]),i.push(n(t).find(".e-edititem").parent()[0])):(e.allowAdding&&r.indexOf("add")!==-1&&o.push(n(t).find(".e-addnewitem").parent()[0]),e.allowEditing&&r.indexOf("edit")!==-1&&f.allowSelection&&e.beginEditAction!="click"&&(u.selectedRowIndex()!=-1?o.push(n(t).find(".e-edititem").parent()[0]):i.push(n(t).find(".e-edititem").parent()[0])),e.allowDeleting&&r.indexOf("delete")!==-1&&f.allowSelection&&(u.selectedRowIndex()!=-1?o.push(n(t).find(".e-deleteitem").parent()[0]):i.push(n(t).find(".e-deleteitem").parent()[0])),e.allowIndent&&(r.indexOf("indent")!==-1||r.indexOf("outdent")!==-1)&&f.allowSelection&&u.selectedRowIndex()==-1&&(i.push(n(t).find(".e-indent").parent()[0]),i.push(n(t).find(".e-outdent").parent()[0])),n(t).ejToolbar("enableItem",o),r.indexOf("cancel")!==-1&&i.push(n(t).find(".e-cancel").parent()[0]),r.indexOf("update")!==-1&&i.push(n(t).find(".e-saveitem").parent()[0]));i.forEach(function(i){n(t).ejToolbar("disableItem",i)})}else o=[],i=[],e.allowAdding?r.indexOf("add")!==-1&&o.push(n(t).find(".e-addnew").parent()[0]):i.push(n(t).find(".e-addnew").parent()[0]),e.allowEditing&&r.indexOf("edit")!==-1?u.selectedRowIndex()!=-1&&f.allowSelection&&(f.selectedItems.length==1||u._checkboxSelection)&&e.beginEditAction!="click"?o.push(n(t).find(".e-edit").parent()[0]):n(t).find(".e-edit").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-edit").parent()[0]):i.push(n(t).find(".e-edit").parent()[0]),e.allowDeleting&&r.indexOf("delete")!==-1?u.selectedRowIndex()!=-1&&f.allowSelection&&f.selectedItems.length>0?o.push(n(t).find(".e-delete").parent()[0]):n(t).find(".e-delete").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-delete").parent()[0]):i.push(n(t).find(".e-delete").parent()[0]),s=u._getParentRecords(f.updatedRecords,u),s.length<=0?(r.indexOf("expandAll")===-1||n(t).find(".e-expandall").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-expandall").parent()[0]),r.indexOf("collapseAll")===-1||n(t).find(".e-collapseall").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-collapseall").parent()[0])):(r.indexOf("expandAll")!==-1&&o.push(n(t).find(".e-expandall").parent()[0]),r.indexOf("collapseAll")!==-1&&o.push(n(t).find(".e-collapseall").parent()[0])),e.beginEditAction=="click"&&(e.beginEditAction!="click"||f.isEdit)||(r.indexOf("cancel")===-1||n(t).find(".e-cancel").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-cancel").parent()[0]),r.indexOf("update")===-1||n(t).find(".e-save").parent("li").hasClass("e-disable")||i.push(n(t).find(".e-save").parent()[0])),i.forEach(function(i){n(t).ejToolbar("disableItem",i)}),o.forEach(function(i){n(t).ejToolbar("enableItem",i)})},_checkIsEmptyRow:function(n){var i=this.model.columns,t;for(itemIndex=0;itemIndex<i.length;itemIndex++)if(t=this._getCustomCellValue(n,i[itemIndex].field),t!==" "&&t!==null&&t!==""&&t!==!1)return!1;return!0},_beginEdit:function(){var n=this;n._trigger("beginEdit",args);n._isinBeginEdit=!0},_endEdit:function(){var t=this,i,u;if(t._isinBeginEdit=!1,i=this.selectedRowIndex(),u=r.TreeGrid.getRowByIndex(t,i),this.editFormValidate())n("tr").hasClass("e-addedrow")||n("tr").hasClass("e-rowedit")?t.saveRow():t.saveCell();else return!0},_refreshTreeGridOnExpandCollapseAll:function(n){var t=this,i=this.model,u;if(i.enableVirtualization)i.enableAltRow&&t.updateAltRow(),t.sendDataRenderingRequest(n),t._setScrollTop(),t.updateHeight();else{if(i.allowPaging&&(u={},u.totalRecordsCount=this.getExpandedRecords(i.updatedRecords).length,t.getPager().ejPager("option",u).ejPager("refreshPager"),pagerModel=this.getPager().ejPager("model"),t._currentPage(pagerModel.currentPage),u.requestType="paging",t.processBindings(u)),t._isRefreshAddedRecord){t.processBindings();this.renderRecords();t._isRefreshAddedRecord=!1;return}t.updateHeight();i.enableAltRow&&i.currentViewData.length>0&&r.TreeGrid.updateAltRow(t,t.model.currentViewData[0],0,0)}},_expandCollapseInnerLevelRecord:function(n,t){for(var f=this,e=n.childRecords.length,u={},i=0;i<e;i++)n.childRecords[i].hasChildRecords&&(f._expandCollapseInnerLevelRecord(n.childRecords[i],t),u.data=n.childRecords[i],u.expanded=t,r.TreeGrid.sendExpandCollapseRequest(f,u))},_expandParentLevelRecord:function(n,t){var u=this,i={},f=u.getExpandStatus(treegridRecord);n.expanded&&f||(i.data=n,i.expanded=t,r.TreeGrid.sendExpandCollapseRequest(u,i),i.data.parentItem&&u._expandParentLevelRecord(i.data.parentItem,t))},expandAtLevel:function(n){var t=this,i={},u=t._getParentRecords(t.model.updatedRecords,t);for(count=0;count<u.length;count++)treegridRecord=u[count],treegridRecord.level==n&&(i.data=treegridRecord,i.expanded=!0,r.TreeGrid.sendExpandCollapseRequest(t,i),treegridRecord.parentItem&&t._expandParentLevelRecord(treegridRecord.parentItem,i.expanded))},collapseAtLevel:function(n){var t=this,i={},e=t.model,u=t._getParentRecords(e.updatedRecords,t),f;for(count=0;count<u.length;count++)treegridRecord=u[count],treegridRecord.level==n&&treegridRecord.expanded&&(f=t.getExpandStatus(treegridRecord),f&&(i.data=treegridRecord,i.expanded=!1,r.TreeGrid.sendExpandCollapseRequest(t,i)))},expandCollapseRow:function(n){var t=this,i={};n=parseInt(n);t.model.updatedRecords.length>n&&n>=0&&(treegridRecord=t.model.updatedRecords[n],treegridRecord.hasChildRecords&&(i.data=treegridRecord,i.expanded=treegridRecord.expanded?!1:!0,r.TreeGrid.sendExpandCollapseRequest(t,i)))},expandAll:function(){var n=this,f=n.model,i=0,u,t={};for(n._isRowEdit?n.cancelRowEditCell():n.model.isEdit&&n.cancelEditCell(),t.requestType=r.TreeGrid.Actions.ExpandCollapse,n._isInExpandCollapseAll=!0,i=0;i<n.model.parentRecords.length;i++)u=n.model.parentRecords[i],t.data=u,t.recordIndex=i,t.expanded=!0,u.hasChildRecords&&(n._expandCollapseInnerLevelRecord(u,t.expanded),r.TreeGrid.sendExpandCollapseRequest(n,t));f.flatRecords.length>0&&n._refreshTreeGridOnExpandCollapseAll(t);n._isInExpandCollapseAll=!1},_refreshToolBar:function(){var t=n("#"+this._id+"_toolbarItems");t.find("li").removeClass("e-hover")},_renderToolbar:function(){var t=this,i=t.model;if(!i.isFromGantt){var t=this,r=t.element,i=t.model;t.model.toolbarSettings.showToolbar&&r.append(t._renderToolbarTemplate());t.model.isResponsive&&n("#"+t._id+"_toolbarItems").addClass("e-treegridadaptivetoolbar")}},_renderToolbarTemplate:function(){var t=this,f=t.model,u=r.buildTag("div.e-treegridtoolbar#"+t._id+"_toolbarItems","",{height:"36px",border:"1px solid"},{unselectable:"on"}),e,o,i;return!r.isNullOrUndefined(f.toolbarSettings.toolbarItems)&&f.toolbarSettings.toolbarItems.length&&(e=r.buildTag("ul","",{},{}),t._renderLi(e),u.append(e)),!r.isNullOrUndefined(f.toolbarSettings.customToolbarItems)&&f.toolbarSettings.customToolbarItems.length&&(o=r.buildTag("ul","",{},{}),t._renderCustomLi(o),u.append(o)),i={},i.click=t._toolBarClick,i.cssClass="",i.rtl=!1,i.itemSeparator=!1,i.itemLeave=t._toolbarItemLeave,i.width=t._gridWidth,i.fields={id:"",tooltipText:"",imageUrl:"",text:"",imageAttributes:"",spriteCSS:"",htmlAttributes:""},u.ejToolbar(i),u.ejToolbar("disableItem",t._disabledToolItems),t._disabledToolItems=n(),u},_renderCustomLi:function(t){for(var e,o=this,h=o.model,f,s,u=h.toolbarSettings.customToolbarItems,i=0;i<u.length;i++)(u[i].text||u[i].templateID)&&(u[i].text?(e=u[i].tooltipText?u[i].tooltipText:u[i].text,f=r.buildTag("li","",{},{id:o._id+"_"+u[i].text,title:e}),s=r.buildTag("a.e-toolbaricons e-icon e-treegridcustomtoolbaritem","",{}).addClass(u[i].text),f.addClass("e-treegridtoolbaritem")):(e=u[i].tooltipText?u[i].tooltipText:u[i].templateID.replace("#",""),f=r.buildTag("li","",{},{id:o._id+"_"+u[i].templateID.replace("#",""),title:e}),s=n(u[i].templateID).hide().html()),f.html(s),t.append(f))},_renderLi:function(n){var i=this,u=i.model.toolbarSettings.toolbarItems,e=u.length,t=0,f;for(t;t<e;t++)f=r.buildTag("li.e-treegridtoolbaritem","",{},{id:i._id+"_"+u[t]}),i._renderLiContent(f,u[t]),n.append(f)},_renderLiContent:function(n,t){var u,i,f=this.selectedRowIndex(),p=this.model.editSettings,e,o,s,h,c,l,a,v,y;switch(t){case"add":u=r.buildTag("a.e-addnew e-toolbaricons e-icon e-treegrid-add","",{});e=this._toolboxTooltipTexts.addTool;n.attr("title",e);this.model.editSettings.allowAdding||this._disabledToolItems.push(n.get(0));break;case"edit":u=r.buildTag("a.e-edit e-toolbaricons e-icon e-treegrid-edit","",{});o=this._toolboxTooltipTexts.editTool;n.attr("title",o);this.model.editSettings.allowEditing&&f!=-1&&this.model.allowSelection&&this.model.editSettings.beginEditAction!="click"||this._disabledToolItems.push(n.get(0));break;case"delete":s=this._toolboxTooltipTexts.deleteTool;n.attr("title",s);u=r.buildTag("a.e-delete e-toolbaricons e-icon e-treegrid-delete","",{});this.model.editSettings.allowDeleting&&f!=-1&&this.model.allowSelection||this._disabledToolItems.push(n.get(0));break;case"update":h=this._toolboxTooltipTexts.updateTool;n.attr("title",h);u=r.buildTag("a.e-save e-toolbaricons e-icon e-treegrid-save e-disabletool","",{});this._disabledToolItems.push(n.get(0));break;case"cancel":c=this._toolboxTooltipTexts.cancelTool;n.attr("title",c);u=r.buildTag("a.e-cancel e-toolbaricons e-icon e-treegrid-cancel e-disabletool","",{});this._disabledToolItems.push(n.get(0));break;case"expandAll":l=this._toolboxTooltipTexts.expandAllTool;n.attr("title",l);i=r.buildTag("a.e-expandall e-toolbaricons e-icon e-treegrid-expandall","",{},{});n.append(i);break;case"collapseAll":a=this._toolboxTooltipTexts.collapseAllTool;n.attr("title",a);i=r.buildTag("a.e-collapseall e-toolbaricons e-icon e-treegrid-collapseall","",{},{});n.append(i);break;case"pdfExport":v=this._toolboxTooltipTexts.pdfExportTool;n.attr("title",v);i=r.buildTag("a.e-pdfIcon e-toolbaricons e-icon","",{},{});n.append(i);break;case"excelExport":y=this._toolboxTooltipTexts.excelExportTool;n.attr("title",y);i=r.buildTag("a.e-excelIcon e-toolbaricons e-icon","",{},{});n.append(i)}n.append(u)},_updateToolbarItems:function(){var t=this,i=t.model,u=i.toolbarSettings.toolbarItems,f=i.editSettings,e=n("#"+t._id+"_toolbarItems"),o=t.selectedRowIndex(),r=f.editMode;disableToolItems=[];enableToolItems=[];u=i.toolbarSettings.toolbarItems;r.toLowerCase()=="cellediting"||r.toLowerCase()=="dialogediting"?t._isRowEdit?t.cancelRowEditCell():i.isEdit&&t.cancelEditCell():r.toLowerCase()=="rowediting"&&t.cancelRowEditCell();t._cancelSaveTools()},_renderAfterColumnInitialize:function(){var n=this;n.element.append(n._renderGridHeader())},filterEditType:function(n,t,i){var u=this,h=u.model,f=n.field.split(".").join(""),e,o,s;r.isNullOrUndefined(n.filterEditType)&&(n.filterEditType=n.editType);switch(n.filterEditType){case"stringedit":t.html(r.buildTag("input.e-ejinputtext e-filtertext e-field e-filterwidth","",{},{id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i}));break;case"numericedit":e=r.buildTag("input.e-numerictextbox e-field","",{width:n.width-15},{type:"text",id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i});t.append(e);break;case"datepicker":case"datetimepicker":o=r.buildTag("input.e-"+n.filterEditType+" e-field","",{},{type:"text",id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i});t.append(o);break;case"booleanedit":case"dropdownedit":s=r.buildTag("input.e-field e-dropdownlist e-field","",{},{type:"text",id:u._id+"_"+f+"_filterbarcell",name:n.field,value:i});t.append(s)}},_filteringElements:function(t){var i=this,s=i.model,et=!1,rt,ot,st,f,a,o={},h,y,w,b,e,k,v;for(selectedItem=s.selectedItem,t.requestType=="filtering"&&(ot=document.getElementById(i._id+"_filterBar"+t.fieldname.split(".").join(""))),e=y=r.TreeGrid.getColumnByField(s.columns,t.fieldname),rt=n(ot).find("input,select"),st=rt.length,k=0;k<st;k++){if(f=rt.eq(k),o={},inputWidth=f.closest("div").width()-2,f.hasClass("e-numerictextbox"))a=inputWidth,h=f.val(),o.width=a,o.showSpinButton=!0,o.cssClass=s.cssClass,o.locale=s.locale,o.height=28,o.focusIn=n.proxy(i._cancelEditState,i,f),v=f[0].id,v=v.replace(i._id,""),o.change=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null,o.value=h.length?parseFloat(h):null,y=r.TreeGrid.getColumnByField(i.model.columns,f.prop("name")),r.isNullOrUndefined(y)||r.isNullOrUndefined(y.editParams)||n.extend(o,y.editParams),f.ejNumericTextbox(o),f.prop("name",f.prop("name").replace(i._id,""));else if(f.hasClass("e-datepicker"))a=inputWidth,o.width=a,o.cssClass=s.cssClass,o.dateFormat=s.dateFormat,o.locale=s.locale,o.height=28,o.focusIn=n.proxy(i._cancelEditState,i,f),v=f[0].id,v=v.replace(i._id,""),o.select=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null,e=r.TreeGrid.getColumnByField(i.model.columns,f.prop("name")),e.format!==u&&e.format.length>0&&(w=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),b=w.exec(e.format),o.dateFormat=b[2]),r.isNullOrUndefined(e.editParams)||n.extend(o,e.editParams),s.dateFormat.toLowerCase().indexOf("hh")!=-1?f.ejDateTimePicker(o):f.ejDatePicker(o),i._preventDoubleClick(e);else if(f.hasClass("e-datetimepicker"))a=inputWidth,o={width:a,rtl:s.rtl,locale:s.locale,cssClass:s.cssClass,showButton:!1,focusIn:n.proxy(i._cancelEditState,i,f)},o.height=28,o.close=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null,e=r.TreeGrid.getColumnByField(i.model.columns,f.prop("name")),e.format!==u&&e.format.length>0&&(w=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),b=w.exec(e.format),o.dateTimeFormat=b[2]),r.isNullOrUndefined(e.editParams)||n.extend(o,e.editParams),f.ejDateTimePicker(o),i._preventDoubleClick(e);else if(f.hasClass("e-dropdownlist")){e=r.TreeGrid.getColumnByField(s.columns,t.fieldname);var p=e.editParams&&e.editParams.fields&&e.editParams.fields.text?e.editParams.fields.text:"text",h=e.editParams&&e.editParams.fields&&e.editParams.fields.value?e.editParams.fields.value:"value",d,g,c=[],ut,nt,tt;e.dropdownData&&e.dropdownData.length>0?c=n.extend(!0,[],e.dropdownData):e.editType=="booleanedit"?(c=[],nt={},nt[p]=i._trueText,nt[h]="true",c.push(nt),tt={},tt[p]=i._falseText,tt[h]="false",c.push(tt)):c=i._dropDownArrayCollection(e,t.fieldname);d={};d[p]=i._dropDownListClearText;d[h]="";c.splice(0,0,d);ut=e.allowFilteringBlankContent==u?!0:e.allowFilteringBlankContent;ut&&(g={},g[p]=i._dropDownListBlanksText,g[h]=i._dropDownListBlanksText,c.push(g));var l={},ft=f.val(),it,ht=n("#"+f[0].id).data("ejDropDownList");ht&&(it=n(ht.popupList));l.width=inputWidth;l.showCheckbox=!1;l.dataSource=c;l.height=28;l.popupShown=n.proxy(i._cancelEditState,i,f);l.fields={text:p,value:h};l.popupHide=s.filterSettings.filterBarMode=="immediate"?n.proxy(i._filterBarHandler,i,f):null;f.ejDropDownList(l);it&&(it.find(".e-ul :first-child").find(".e-ddltxt").css("font-style","italic"),ut&&it.find(".e-ul :last-child").find(".e-ddltxt").css("font-style","italic"));ft==i._dropDownListClearText&&(ft="");f.ejDropDownList("selectItemByValue",ft);i._preventDoubleClick(e)}else switch(f.prop("tagName")){case"INPUT":f.width(inputWidth-4);e.filterEditType=="stringedit"&&i._on(n("#"+i._id+"_"+e.field.split(".").join("")+"_filterbarcell"),"focus",i._cancelEditState);break;case"SELECT":f.width(inputWidth).height(15)}f.is(":disabled")||et||f.is(":hidden")&&typeof f.data("ejDropDownList")!="object"||i._isEnterKeyPressed||(et=!0)}},_dropDownArrayCollection:function(t,i){var u=this,s=u.model,f=i,e=[],r=[],o=[],h=t.editType;return e=n.map(s.flatRecords,function(n){if(n.item[f])return n.item[f]}),n.each(e,function(t,i){i=n.trim(i);n.inArray(i,r)===-1&&r.push(i)}),h!="numericedit"?r.sort(u.stringCompare):r=r.sort(function(n,t){return n-t}),n.each(r,function(n,t){o.push({text:t,value:t})}),o},stringCompare:function(n,t){var i=[],r=[];for(n.replace(/(\d+)|(\D+)/g,function(n,t,r){i.push([t||Infinity,r||""])}),t.replace(/(\d+)|(\D+)/g,function(n,t,i){r.push([t||Infinity,i||""])});i.length&&r.length;){var u=i.shift(),f=r.shift(),e=u[0]-f[0]||u[1].localeCompare(f[1]);if(e)return e}return i.length-r.length},_preventDoubleClick:function(t){var i=this,u=n("#"+i._id+"_"+t.field.split(".").join("")+"_filterbarcell_popup");if(u.length!=0)n(u).on("click",function(){r.isTouchDevice()?i._off(i.element,"doubletap ",".e-gridcontent",i._editdblClickHandler):i._off(i.element,"dblclick ",".e-gridcontent",i._editdblClickHandler);setTimeout(function(){r.isTouchDevice()?i._on(i.element,"doubletap ",".e-gridcontent",i._editdblClickHandler):i._on(i.element,"dblclick ",".e-gridcontent",i._editdblClickHandler)},300)})},_renderFiltering:function(t,i){var l=this,f=this.model,o,s,u,h,c,e,a;if(totColumns=f.columns,filteredColumns=f.filterSettings.filteredColumns,o=r.buildTag("tr.e-filterbar","",{},{}),l.model.allowFiltering&&(n.each(totColumns,function(n,t){r.isNullOrUndefined(t.allowFiltering)&&(t.allowFiltering=!0)}),s=!1,n.each(totColumns,function(n,t){if(t.allowFiltering==!0)return s=!0,!1}),s))for(u=0;u<t.length;u++)if(h=r.buildTag("th.e-filterbarcell .e-editValue","",{},{}),t[u].visible===!1&&h.addClass("e-hide"),$div=r.buildTag("div.e-filterdiv","",{},{id:l._id+"_filterBar"+t[u].field.split(".").join("")}),o.append(h.append($div)),t[u].allowFiltering==!1)continue;else{if(c="",filteredColumns.length>0)for(e=0;e<filteredColumns.length;e++)t[u].field==filteredColumns[e].field&&(c=filteredColumns[e].value);this.filterEditType(t[u],$div,c);a=r.buildTag("span.e-cancel e-icon e-hide e-spanstyle");$div.append(a)}return f.showDetailsRow&&f.detailsTemplate&&f.showDetailsRowInfoColumn&&i&&o.append(r.buildTag("th.e-filterbarcell e-detailheadercell",'<div style="width:35px;"><\/div>')),o},_getIndentCol:function(){return r.buildTag("col","",{width:"35px"})},_renderGridHeader:function(){var n=this,i=n.model,o=document,u,e,t=r.buildTag("div.e-gridheadercontainer","",{overflow:"hidden"},{unselectable:"on"}),f=i.isFromGantt?r.buildTag("div.e-gridheader#"+n._id+"e-gridheader","",{"border-left-style":"solid","border-left-width":"1px"},""):r.buildTag("div.e-gridheader#"+n._id+"e-gridheader","",{"border-top-style":"solid","border-left-style":"solid","border-right-style":"solid","border-top-width":"1px","border-left-width":"1px","border-right-width":"1px",width:n._gridWidth},"");return i.allowFiltering==!0&&i.filterSettings.filterType==r.TreeGrid.FilterType.FilterBar&&t.addClass("e-headercontent-material-filterbar"),t.addClass("e-headercontent"),n.setGridHeaderContent(f),n._$gridHeaderContainer=t,n._hiddenColumns=[],n._visibleColumns=[],n.columnsWidthCollection=[],this._frozenColumnsLength>0?(t.addClass("e-frozen-header-container"),u=r.buildTag("div.e-frozenheaderdiv#e-frozenheaderdiv"+n._id,this._renderGridHeaderInternalDesign(i.columns.slice(0,this._frozenColumnsLength),!1)),i.allowFiltering==!0&&i.filterSettings.filterType==r.TreeGrid.FilterType.FilterBar&&u.addClass("e-filterbar-header-material"),e=r.buildTag("div.e-movableheader#e-movableheader"+n._id,r.buildTag("div.e-movableheaderdiv#e-movableheaderdiv"+n._id,this._renderGridHeaderInternalDesign(this.model.columns.slice(this._frozenColumnsLength),!0))),t.append(u).append(e)):(t.append(this._renderGridHeaderInternalDesign(this.model.columns,!0)),t.removeClass("e-frozen-header-container")),f.html(t),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),f},getPager:function(){return this._gridPager},setTreeGridPager:function(n){this._gridPager=n},_renderGridPager:function(){var t=this,u=n(document.createElement("div")),i={},f=t.model.pageSettings,e,o;return f.click=n.proxy(t._pagerClickHandler,t),f.totalRecordsCount=t._gridRecordsCount,n.extend(i,f),i.locale=t.model.locale,t._currentPage()<0&&t._currentPage(1),i.currentPage=this._prevPageNo=t._currentPage(),i.masterObject=t,t.setTreeGridPager(u),u.ejPager(i),u.ejPager("refreshPager"),i=u.ejPager("model"),f.totalPages=i.totalPages,t._currentPage()!==i.currentPage&&t._currentPage(i.currentPage),!r.isNullOrUndefined(f.template)&&f.template.length>0&&(u.children().remove(),e=r.buildTag("div.e-pagercontainer"),o=this._createTemplateElement(f,!0),e.append(o.innerHTML),u.append(e)),u},_addHeaderCheckboxTemplate:function(){var n=this.model;return n.flatRecords.length==n.selectedItems.length?'<div><span class="e-chkbox-wrap e-widget" style="margin-left:5px;padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-act"><span class="e-checkbox e-checkmark e-chk-image e-icon e-headerCheckbox"id ='+this._id+"_headerCheckbox><\/span><\/span><\/div><\/span><\/div>":n.flatRecords.length>n.selectedItems.length&&n.selectedItems.length>0?'<div><span class="e-chkbox-wrap e-widget" style="margin-left:5px;padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-indeter"><span class="e-checkbox e-stop e-chk-image e-icon e-headerCheckbox"id ='+this._id+"_headerCheckbox><\/span><\/span><\/div><\/span><\/div>":'<div><span class="e-chkbox-wrap e-widget" style="margin-left:5px;padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-inact"><span class="e-checkbox e-chk-image e-icon e-headerCheckbox"id ='+this._id+"_headerCheckbox><\/span><\/span><\/div><\/span><\/div>"},_renderGridHeaderInternalDesign:function(t,i){var e=this,o=e.model,l=document,b=r.buildTag("table.e-table","",{},{cellspacing:"0px","border-spacing":"0px"}),v=r.buildTag("thead"),it=r.buildTag("tbody.e-hide"),a=r.buildTag("tr.e-columnheader"),y=n(l.createElement("colgroup")),nt=n(l.createElement("tr")),f=0,tt=t.length,s,k,h,p,w,d,g,c;for((o.allowSorting||o.showColumnChooser||o.allowColumnReordering)&&a.css({cursor:"pointer"}),o.headerTextOverflow==="wrap"?e.element.addClass("e-wrap"):e.element.removeClass("e-wrap"),f;f<tt;f++)if(t[f]){if(d=t[f].headerTextAlign?t[f].headerTextAlign:t[f].textAlign?t[f].textAlign:r.TextAlign.Left,(e.model.showColumnChooser||!e.model.showColumnChooser&&e.model.allowFiltering&&e.model.filterSettings.filterType=="menu")&&t[f].field!="checkboxState"?r.isNullOrUndefined(t[f].allowFiltering)||t[f].allowFiltering||e.model.showColumnChooser?(s=r.buildTag("th.e-headercell","",{},{}),s.addClass("e-column-menu-padding")):s=r.buildTag("th.e-headercell","",{},{}):s=r.buildTag("th.e-headercell","",{},{}),e.model.allowFiltering&&e.model.filterSettings.filterType==r.TreeGrid.FilterType.FilterBar&&s.addClass("e-filterbar-material"),k=l.createElement("td"),h=r.buildTag("div.e-headercelldiv","",{"text-align":d},{"ej-mappingname":t[f].field,unselectable:"on"}),t[f].clipMode&&t[f].clipMode==r.TreeGrid.ClipMode.Ellipsis&&h.addClass("e-treegridtrimcell"),e._checkboxSelection&&o.selectionSettings.enableSelectAll&&e._checkboxColumnName==t[f].field&&h.append(e._addHeaderCheckboxTemplate()),t[f].field=="checkboxState"&&s.css({cursor:"default"}),g=r.buildTag("span",t[f].headerText==u?t[f].headerText=t[f].field:t[f].headerText),h.append(g),s.append(h),e.model.showColumnChooser&&!t[f].nonColumn)$columnChooser=r.buildTag("div.e-columnmenu-icon e-icon e-columnicon","",{cursor:"pointer"}),$columnChooser.data("isClicked",!1),s.append($columnChooser);else if(!e.model.showColumnChooser&&e.model.allowFiltering&&e.model.filterSettings.filterType=="menu"&&(r.isNullOrUndefined(t[f].allowFiltering)||t[f].allowFiltering)&&t[f].field!="checkboxState"){if($columnFilter=e._filteredColumnValueID.indexOf(t[f].field)!=-1?r.buildTag("div.e-column-filtered-icon e-icon e-filtericon","",{cursor:"pointer"}):r.buildTag("div.e-column-filter-icon e-icon e-filtericon","",{cursor:"pointer"}),e.model.filterSettings.filteredColumns)for(c=0;c<e.model.filterSettings.filteredColumns.length;c++)e.model.filterSettings.filteredColumns[c].field==t[f].field&&e.model.filterSettings.filteredColumns[c].value.toString()!=""&&($columnFilter=r.buildTag("div.e-column-filtered-icon e-icon e-filtericon","",{cursor:"pointer"}));$columnFilter.data("isClicked",!1);s.append($columnFilter)}p=l.createElement("col");nt.append(k);a.append(s);y.append(p);t[f].visible===!1&&t[f]!=o.columns[o.treeColumnIndex]?s.addClass("e-hide")&&n(p).css("display","none")&&e._hiddenColumns.push(t[f].headerText):(e._visibleColumns.push(t[f].headerText),t[f].visible=!0);t[f].allowSorting===!1&&(e._disabledSortableColumns.push(t[f].headerText),s.css({cursor:"normal"}));r.isNullOrUndefined(t[f].headerTemplateID)||h.html(n(t[f].headerTemplateID).hide().html()).parent().addClass("e-headertemplate");t[f].allowCellSelection==u&&(t[f].allowCellSelection=!0);t[f].showInColumnChooser==u&&(t[f].showInColumnChooser=!0);t[f].width==u&&o.commonWidth!==u?(e.columnsWidthCollection.push(o.commonWidth),t[f].width=o.commonWidth):(e.columnsWidthCollection.push(parseFloat(t[f].width)),t[f].width=parseFloat(t[f].width));e._fieldColumnNames[t[f].headerText]=t[f].field;e._headerColumnNames[t[f].field]=t[f].headerText}return o.isFromGantt&&e.updateToGanttColumns(),o.showDetailsRow&&o.detailsTemplate&&o.showDetailsRowInfoColumn&&i&&(a.append(r.buildTag("th.e-headercell e-detailheadercell",'<div style="width:35px;"><\/div>',{},{})),y.append(this._getIndentCol())),o.allowFiltering&&!o.isFromGantt&&o.filterSettings.filterType=="filterbar"&&(w=this._renderFiltering(t,i)),v.append(a),w&&v.append(w),b.append(y).append(v),b},_initGridRender:function(){var n=this;n._addInitTemplate();n._renderGrid();n.model.allowColumnResize&&(n._resizer=new r.gridFeatures.gridResize(n))},_summaryRow:function(){var n=this,t=n.model;t.showSummaryRow&&n._createSummaryRow();t.showTotalSummary&&(n._createTotalSummaryRow(),n._viewPortHeight=n._viewPortHeight-n._$totalSummaryRowContainer.outerHeight())},_renderGrid:function(){var n=this;n._renderGridContent().insertAfter(n.element.children(".e-gridheader"))},_renderFrozenSummary:function(){this._$footerContainer.find("#e-frozenfooterdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[0]);this._$footerContainer.find("#e-movablefooterdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[1]);this._$footerContainer.find("#e-frozenfooterdiv"+this._id+" .e-table tbody").html(n.render[this._id+"_JSONFrozenTemplate"](this._footerSummaryRecord));this._$footerContainer.find("#e-movablefooterdiv"+this._id+" .e-table tbody").html(n.render[this._id+"_Template"](this._footerSummaryRecord))},_renderSummaryByFrozenDesign:function(){var i=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),t={};return t.colgroup1=i.append(r.buildTag("colgroup").append(u.splice(0,this._frozenColumnsLength))).html(),t.colgroup2=i.html(r.buildTag("colgroup").append(u)).html(),n.templates[this._id+"_FrozenSummaryTemplate"]||this.addFrozenSummaryTemplate(),n.render[this._id+"_FrozenSummaryTemplate"](t)},_spliceSummaryRows:function(n){var i=this,r=i.model,t=[],u=n.filter(function(n){n.isSummaryRow||t.push(n)});return t},addFrozenSummaryTemplate:function(){var i="<div class='e-frozenfooterdiv' id='e-frozenfooterdiv"+this._id+"'><table class='e-table' style='width:100%' cellspacing='0' id='"+this._id+"frozensummarye-table'>{{:colgroup1}}<tbody><\/tbody><\/table><\/div><div class='e-movablefooter' id='e-movablefooter"+this._id+"'><div class='e-movablefooterdiv' id='e-movablefooterdiv"+this._id+"'><table class='e-table' id='"+this._id+"movablesummarye-table' cellspacing='0'>{{:colgroup2}}<tbody><\/tbody><\/table><\/div><\/div>",t={};t[this._id+"_FrozenSummaryTemplate"]=i;n.templates(t)},_createTotalSummaryRow:function(){var t=this,f,i=t.model,p=i.flatRecords,l=i.summaryRows,y=l.length,w=i.updatedRecords,b=i.parentRecords,a=i.columns,v=r.buildTag("tbody"),u,e,o,s,h,c;for(t._footerSummaryRecord=[],t._footerSummaryRows=[],n("#"+t._id+"-footersummaryrow").remove(),f=r.buildTag("div.e-footersummaryrowdiv#"+t._id+"-footersummaryrow","",{overflow:"hidden",cursor:"default"}),u=r.buildTag("div.e-footercontainer#e-footercontainer"+t._id,"",{overflow:"hidden"}),t._flatChildRecords=t._spliceSummaryRows(i.updatedRecords),e=1;e<=y;e++){for(o={},s=0;s<a.length;s++)o[a[s].field]="";o=t._createSummaryItem(o,l[e-1]);h=t._createRecord(o,0);h.footerSummaryRowRecord=!0;h.index=e;t._footerSummaryRecord.push(h)}t._$footerContainer=u;this._frozenColumnsLength>0?(u.html(this._renderSummaryByFrozenDesign()),this._renderFrozenSummary()):(c=r.buildTag("table.e-table#"+t._id+"summarye-table","",{top:"0px"},{cellspacing:"0px"}),c.append(t.getContentTable().find("colgroup").clone()).append(v),v.html(n.render[this._id+"_Template"](t._footerSummaryRecord)),u.append(c));t._$totalSummaryRowContainer=f;t._$footertableContent=u.find(".e-table");f.append(u);i.allowPaging?t.element.append(n("#"+this._id+"Pager").before(f)):t.element.append(f);t._flatChildRecords=[];this._setWidthToFooters();this._$totalSummaryRowContainer.outerHeight()<90?t.isVScroll()&&t._$totalSummaryRowContainer.addClass("e-scrollcss"):t._$totalSummaryRowContainer.ejScroller({height:90})},_getFooterRows:function(){var t=n();return this.model.showTotalSummary&&this._$footertableContent&&(t=this._$footertableContent.get(0).rows,this._frozenColumnsLength>0&&(t=[t,this._$footertableContent.get(1).rows])),n(t)},_setWidthToFooters:function(){var r=this._gridWidth,t,i,n;if(this._frozenColumnsLength>0){for(t=0,n=0;n<this.columnsWidthCollection.length;n++)t+=this.columnsWidthCollection[n],this._frozenColumnsLength-1==n&&(i=Math.ceil(t));this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).width(r).next().css("margin-left",i+"px");this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).outerWidth(i).end().find("#e-movablefooterdiv"+this._id).css("width","100%")}},_excludeSummaryRows:function(){var t=n(),i=this.model;return this.getTreeGridRows()&&this.getTreeGridRows().length>0&&(t=this._frozenColumnsLength>0?[n(this.getTreeGridRows()[0]).not(".e-summaryrow"),n(this.getTreeGridRows()[1]).not(".e-summaryrow")]:n(this.getTreeGridRows()).not(".e-summaryrow")),t},_createSummaryRow:function(n){var i=this,t=i.model,f,s={},c,p=t.summaryRows,w=p.length,b=t.columns,h,v,k,l,o,a,e,u,y,d;if(n&&(n.requestType=="dragAndDrop"||n.requestType=="addNewRow"||n.requestType=="sorting")){if(f=i._getParentRecords(t.updatedRecords,i),n.requestType=="dragAndDrop")for(h=0;h<f.length;h++)v=[],v=f[h].childRecords.filter(function(n){if(!n.isSummaryRow)return!0}),f[h].childRecords=v.slice()}else f=i._parentRecords;for(k=f.length,n&&r.isNullOrUndefined(n.filterCollection)&&(n.filterCollection=[]),t.enableCollapseAll&&t.enableVirtualization&&!n&&(t.updatedRecords=t.flatRecords.slice()),t.updatedRecords=i._spliceSummaryRows(t.updatedRecords),t.flatRecords=i._spliceSummaryRows(t.flatRecords),t.summaryRowRecords=[],i._flatChildRecords=[],l=0;l<k;l++)if(parentRecord=f[l],c=i._getChildRecordsLength(parentRecord,t.updatedRecords),c!=0){for(o=1;o<=w;o++){for(a=0;a<b.length;a++)s[b[a].field]="";s=i._createSummaryItem(s,p[o-1],parentRecord);e=t.updatedRecords.indexOf(parentRecord)+c+o;u=i._createRecord(s,e);i._isSummaryRow=!0;u.level=parentRecord.level+1;u.parentItem=parentRecord;u.isSummaryRow=!0;u.index=t.flatRecords.length+1;t.enableVirtualization?(t.updatedRecords.splice(e,0,u),(!n||n&&n.filterCollection)&&t.summaryRowRecords.push(t.updatedRecords[e])):(t.updatedRecords.splice(e,0,u),t.summaryRowRecords.push(t.updatedRecords[e]));e=t.flatRecords.indexOf(parentRecord)+c+o;t.flatRecords.splice(e,0,u);y=parentRecord.childRecords.filter(function(n){if(n.isSummaryRow&&u.summaryColumn.summaryType==n.summaryColumn.summaryType)return!0});y.length>0?(d=parentRecord.childRecords.indexOf(y[0]),parentRecord.childRecords.splice(d,1),parentRecord.childRecords.push(u)):parentRecord.childRecords.push(u);s={};o==w&&(u.isLastSummary=!0)}i._flatChildRecords=[]}i._isSummaryRow=!1;i._summaryRowsCount=f.length;t.enableVirtualization&&(t.updatedRecords=i.getExpandedRecords(t.updatedRecords),t.enableAltRow&&i.updateAltRow());this._updateCurrentViewData()},_getInnerParentRecords:function(n,t,i){for(var u=n.childRecords.length,r=0;r<n.childRecords.length;r++)n.childRecords[r].hasChildRecords&&(i.indexOf(n.childRecords[r])==-1&&i.push(n.childRecords[r]),t._getInnerParentRecords(n.childRecords[r],t,i))},_getParentRecords:function(n,t,i){for(var o=n.length,u,f=[],e=0;e<o;e++)u=n[e],i?r.isNullOrUndefined(u.parentItem)&&f.push(u):u.childRecords&&u.childRecords.length>0&&(t.model.enableVirtualization||t.model.allowPaging&&t.model.showSummaryRow?(f.indexOf(u)==-1&&f.push(u),t._getInnerParentRecords(u,t,f)):f.push(u));return f},_getChildRecordsLength:function(n,t){for(var r=this,f=t.length,i,u=0;u<f;u++)(i=t[u],i.summaryRow)||n==i.parentItem&&(r._flatChildRecords.push(i),i.hasChildRecords&&r._getChildRecordsLength(i,t));return r._flatChildRecords.length},_createSummaryItem:function(n,t){for(var u,f=this,c=t.summaryColumns,l=c.length,s=0;s<l;s++){var i=c[s],e=i.prefix,o=i.suffix,h=i.displayColumn;r.isNullOrUndefined(h)&&(h=i.dataMember);r.isNullOrUndefined(e)&&(e="");r.isNullOrUndefined(o)&&(o="");n.summaryColumn=i;n.summaryRow=t;for(u in n)u==h&&(n[u]=n[u]?n[u]+" "+e+f._getSummaryValues(i,f._flatChildRecords)+o:e+f._getSummaryValues(i,f._flatChildRecords)+o)}return n},_getSummaryValues:function(n,t){var f=n.dataMember,h=n.format,i=t,e,u,c,o,s;i instanceof r.DataManager?(e=i,i=i.dataSource.json):e=r.DataManager(i);switch(n.summaryType){case r.TreeGrid.SummaryType.Sum:u=r.sum(i,f);break;case r.TreeGrid.SummaryType.Average:u=r.avg(i,f);break;case r.TreeGrid.SummaryType.Maximum:o=r.max(i,f);u=parseInt(this._getCustomCellValue(o,n.dataMember));break;case r.TreeGrid.SummaryType.Minimum:c=i.filter(function(n){if(n[f]!=="")return!0});o=r.min(c,f);u=parseInt(this._getCustomCellValue(o,n.dataMember));break;case r.TreeGrid.SummaryType.MaximumDate:u=this._getMaxDate(i,f);break;case r.TreeGrid.SummaryType.MinimumDate:u=this._getMinDate(i,f);break;case r.TreeGrid.SummaryType.Count:u=i.length;break;case r.TreeGrid.SummaryType.TrueCount:s=r.Predicate(n.dataMember,"equal",!0);u=e.executeLocal(r.Query().where(s)).length;break;case r.TreeGrid.SummaryType.FalseCount:s=r.Predicate(n.dataMember,"equal",!1);u=e.executeLocal(r.Query().where(s)).length}return r.isNullOrUndefined(h)||(u=this.formatting(h,u,this.model.locale)),u},_getMaxDate:function(n,t){for(var r=0,u=null,i=0;i<n.length;i++){var f=n[i],o=new Date(f[t]),e=o.getTime();e>r&&(r=e,u=f[t])}return u},_getMinDate:function(n,t){for(var o=new Date(n[0][t]),r=o.getTime(),u=n[0][t],i=0;i<n.length;i++){var f=n[i],s=new Date(f[t]),e=s.getTime();e<r&&(r=e,u=f[t])}return u},_createAndRenderSummaryRecords:function(n){var t=this,i;t._createSummaryRow(n);i={};i.requestType=r.TreeGrid.Actions.Refresh;t.sendDataRenderingRequest(i);t.updateCollapsedRecordCount();t.updateHeight()},_updateSummaryRow:function(t){var i=this,u=i.model,h,o,y=[],f=[],c,e=i.getUpdatedRecords(),l,a,s,v;if(t&&t.requestType=="dragAndDrop"&&(t.rowIndex=e.indexOf(i._droppedRecord)),t&&t.requestType=="delete"){i._updateAfterDeleteRecord(t);return}if(t&&t.editType=="celledit"&&(t.columnObject.editType=="numericedit"&&(c=parseInt(t.value),t.value=isNaN(c)?"":c,t.data[t.columnName]=t.value),t.currentValue=t.value,l=i.getIndexByRow(t.rowElement),a=u.enableVirtualization?u.currentViewData[l]:e[l],t.rowIndex=e.indexOf(a)),t.currentValue!=t.previousValue||t.requestType=="dragAndDrop"||t.requestType=="addNewRow"){if(o=t.requestType=="addNewRow"?u.updatedRecords[t.rowIndex]:e[t.rowIndex],o.parentItem&&(f=i._getpRecords(o,i)),r.isNullOrUndefined(f))return;for(s=0;s<f.length;s++)v=u.summaryRowRecords,i._getChildRecordsLength(f[s],e),n.each(v,function(c,l){var k,p,g,d,v;if(h=l.summaryRow,l.parentItem===f[s])for(k=h.summaryColumns.length,p=0;p<k;p++){var a=h.summaryColumns[p],w=a.prefix,b=a.suffix;r.isNullOrUndefined(w)&&(w="");r.isNullOrUndefined(b)&&(b="");t.editType=="rowedit"&&(t.columnName=a.dataMember,g=u.columns,d=i.getColumnIndexByField(t.columnName),u.columns[d].editType=="numericedit"&&(o[t.columnName]=parseInt(o[t.columnName])));v=a.displayColumn;v||(v=a.dataMember);recordindex=u.enableVirtualization?u.currentViewData.indexOf(l):e.indexOf(l);columnIndex=i.getColumnIndexByField(v);t.data=l;i._frozenColumnsLength>0?i._frozenColumnsLength>columnIndex?t.rowElement=n(i.getRows()[0][recordindex]):(t.rowElement=n(i.getRows()[1][recordindex]),columnIndex-=i._frozenColumnsLength):t.rowElement=n(i.getRows()[recordindex]);t.cellElement=t.rowElement.find(".e-rowcell").eq(columnIndex);value=i._getSummaryValues(a,i._flatChildRecords);l[v]=w+value+b;t.cellElement.empty().html(w+value+b);y.push(l)}}),i._flatChildRecords=[],i._summaryRowCount=f.length}},_updateTotalSummaryRow:function(t){var f,o,b;if(t.requestType!="dragAndDrop"&&!t.isDragAndDropDelete){var i=this,l=i.model,p=l.summaryRows,a,w,e,k=p.length;if(l.updatedRecords.length==0){n("#"+i._id+"-footersummaryrow").hide();return}for(n("#"+i._id+"-footersummaryrow").show(),f=0;f<k;f++)for(summaryRow=p[f],a=summaryRow.summaryColumns,w=a.length,e=i._footerSummaryRecord[f],o=0;o<w;o++){var u=a[o],s=u.prefix,h=u.suffix;if(r.isNullOrUndefined(s)&&(s=""),r.isNullOrUndefined(h)&&(h=""),t.editType=="rowedit"&&(t.columnName=u.dataMember),c||(c=u.dataMember),u.dataMember==t.columnName||t.requestType=="delete"||t.requestType=="filtering"||t.requestType=="addNewRow"){var c=u.displayColumn,v=i._footerSummaryRecord.indexOf(e),y=i.getColumnIndexByField(c);t.data=e;this._frozenColumnsLength>0?this._frozenColumnsLength>y?t.rowElement=this._getFooterRows()[0][v]:(t.rowElement=this._getFooterRows()[1][v],y-=this._frozenColumnsLength):t.rowElement=this._getFooterRows()[v];t.cellElement=t.rowElement.childNodes[y];b=i._spliceSummaryRows(l.updatedRecords);value=i._getSummaryValues(u,b);e[c]=s+value+h;t.cellElement.innerHTML=s+value+h}}}},_updateAfterDeleteRecord:function(t){var i=this,e=i.model,o,c=[],u,f,s,h;if(deletedRecord=t.data,deletedRecord.parentItem&&(u=i._getpRecords(deletedRecord,i)),!r.isNullOrUndefined(u))for(f=0;f<u.length;f++)(s=e.summaryRowRecords,h=u[f].childRecords,h.length!=0)&&(i._getChildRecordsLength(u[f],e.updatedRecords),n.each(s,function(s,h){var b,l;if(o=h.summaryRow,h.parentItem===u[f]){for(b=o.summaryColumns.length,l=0;l<b;l++){var a=o.summaryColumns[l],k=a.displayColumn,v=e.updatedRecords.indexOf(h),w=i.getColumnIndexByField(k),y=a.prefix,p=a.suffix;r.isNullOrUndefined(y)&&(y="");r.isNullOrUndefined(p)&&(p="");t.data=h;i._frozenColumnsLength>0?i._frozenColumnsLength>w?t.tr=n(i.getRows()[0][v]):(t.tr=n(i.getRows()[1][v]),w-=i._frozenColumnsLength):t.tr=n(i.getRows()[v]);t.tr=n(i.getRows()[v]);t.cellElement=t.tr.find(".e-rowcell").eq(w);value=i._getSummaryValues(a,i._flatChildRecords);h[k]=y+value+p;t.cellElement.empty().html(y+value+p)}c.push(h)}}),i._flatChildRecords=[])},_getpRecords:function(n){var t=[];do n=n.parentItem,t.push(n);while(n.parentItem);return t},_renderGridContent:function(){var t=this,o=document,i=t.model,h=n(o.createElement("tbody")),e=r.buildTag("div.e-gridcontent#"+t._id+"e-gridcontent","",{height:t._viewPortHeight}),u=r.buildTag("div.e-gridcontainer#"+t._id+"e-gridcontainer","",{},{}),s,f;return $scrolllerContentDiv=r.buildTag("div",{},{width:"auto",height:"auto"}),$scrolllerContentDiv.append(u),(i.enableVirtualization||i.allowPaging)&&u.css({height:t._totalHeight}),this._frozenColumnsLength>0?(u.html(t._renderByFrozenDesign()),t.setGridContentTable(u.find(".e-table"))):(s=r.buildTag("table.e-table#"+t._id+"e-table","",{top:"0px",position:"relative"},{cellspacing:"0px","border-spacing":"0px"}),s.append(t.getHeaderTable().find("colgroup").clone()).append(h),u.html(s),t.setGridContentTable(s)),e.html($scrolllerContentDiv),t._$gridContent=e,this.dataSource()===null||this.model.currentViewData.length==0?this._frozenColumnsLength>0?(f=r.buildTag("td",i.emptyRecordText,{},{colSpan:this._frozenColumns.length}),u.find("#e-frozencontentdiv"+t._id+" .e-table tbody").append(n(o.createElement("tr")).append(f)),f=r.buildTag("td",i.emptyRecordText,{visibility:"hidden"},{colSpan:this._unFrozenColumns.length}),u.find("#e-movablecontentdiv"+t._id+" .e-table tbody").append(n(o.createElement("tr")).append(f))):(f=r.buildTag("td",i.emptyRecordText,{},{colSpan:i.columns.length}),h.append(n(o.createElement("tr")).append(f)),u.css("height",i.rowHeight)):t.renderRecords(),i.isFromGantt?e.css({"border-left-style":"solid","border-left-width":"1px"}):e.css({"border-bottom-style":"solid","border-bottom-width":"1px","border-left-style":"solid","border-left-width":"1px","border-right-style":"solid","border-right-width":"1px",width:"auto",height:"auto",cursor:"default"}),e},_initialEndRendering:function(){var n=this,t=n.model,e=n.getExpandedRecords(t.updatedRecords),i=n.selectedRowIndex(),r=n.selectedCellIndexes(),u,f;t.allowSelection&&(t.selectionSettings.selectionMode!="row"||i==-1||t.isFromGantt||(t.showSummaryRow&&(u=n._spliceSummaryRows(t.updatedRecords),f=u[i],i=t.updatedRecords.indexOf(f)),n._rowSelectingEventTrigger(this._previousIndex,i)||(n.selectRows(i),n._cancelSaveTools(),n._rowSelectedEventTrigger(i))),t.selectionSettings.selectionMode=="cell"&&r.length>0&&(n.selectedRowIndex(-1),n.selectCells(r),n._cancelSaveTools()));n._isRendered=!0;n._trigger("refresh");n._eventBindings();n._hideCollapsedDetailsRows()},_addCellEditTemplate:function(){for(var t=this,o=t.model,i=o.columns,n=0,u=r.buildTag("div","",{display:"none"},{id:t._id+"_CellEditTemplate"}),f,e,n=0;n<i.length;n++)i[n]&&(e=t._getFieldValue(i[n].field,n),f=r.buildTag("div","",{},{id:e+"_CellEdit"}),r.TreeGrid._initCellEditType(t,f,t._id,n),u.append(f));u.children().length&&(t._cellEditTemplate=u)},_getState:function(){return this.data.parentItem?!1:!0},_getCellIndex:function(n,t){for(var u=this,r=[],i=0;i<n.length;i++)r[i]=n[i][t];return r},_getSelectedCellClass:function(n,t){var i=this,o=i.model,u=parseInt(t),e=i._selectedCellDetails,f;return o.selectionSettings.selectionMode=="cell"&&e.length>0&&(i._getSelectedCellsinARow(n.index,e),i._selectedCellsinARow.length>0&&(f=r.browserInfo().name=="msie"&&r.browserInfo().version<9?i._getCellIndex(i._selectedCellsinARow,"cellIndex").indexOf(u):i._selectedCellsinARow.map(function(n){return n.cellIndex}).indexOf(u),f!=-1&&i._selectedCellsinARow[f].cellIndex==u))?"selectingcell":""},_getSelectedCellsinARow:function(n,t){var i=this;i._selectedCellsinARow=[];t.forEach(function(t){t.data.index==n&&i._selectedCellsinARow.push(t)});i._currentRecordIndex=n},_getrowName:function(){var n=this;return"gridrowIndex"+(n.data.index.toString()+"level"+n.data.level.toString())},_getDetailsColSpan:function(n){var i=this.model,t=[];return this._frozenColumnsLength>0?n?(t=this._frozenColumns.filter(function(n){return n.visible!==!1}),t.length):(t=this._unFrozenColumns.filter(function(n){return n.visible!==!1}),t.length):i.showDetailsRowInfoColumn?this._visibleColumns.length+1:this._visibleColumns.length},_getDetailsExpandStatus:function(n){var t=this;return t.getExpandStatus(n)&&n.isDetailsExpanded?!0:!1},_createDetailsRowTemplate:function(t){var i=this,r=this.model,f={},u,e,s,o;return f["_"+i._id+"getDetailsColSpan"]=n.proxy(i._getDetailsColSpan,i),f["_"+i._id+"getDetailsExpandStatus"]=n.proxy(i._getDetailsExpandStatus,i),f["_"+i._id+"getExpandStatus"]=n.proxy(i.getExpandStatus,i),n.views.helpers(f),u="{{if !isSummaryRow && !footerSummaryRowRecord}}<tr class='e-detailsrow e-treegridrows detailsrow{{:~_"+i._id+"rowClassName()}} {{if isDetailsExpanded}}e-detailsrowexpanded{{else}}e-detailsrowcollapsed{{/if}}{{if !~_"+i._id+"getExpandStatus(#data) && isDetailsExpanded}} collapsedrowexpandeddetailsrow{{/if}}' style='{{if ~_"+i._id+"getDetailsExpandStatus(#data)}}display:table-row;{{else}}visibility:none;{{/if}}height:"+r.detailsRowHeight+"px;'><td class='e-detailsrowcell' colspan='{{:~_"+i._id+"getDetailsColSpan("+t+")}}'><div class='e-detailscellwrapper' style='height:"+(r.detailsRowHeight-1)+"px;'>",e="",r.detailsTemplate&&r.detailsTemplate.length>0&&(e=document.getElementById(r.detailsTemplate)?"#"+r.detailsTemplate:r.detailsTemplate),t||(n("#treeGridDetailsRowTemplateElement"+i._id).remove(),s=this._createDetailRowTemplateElement(e),u+="{{:~_treeGridTemplating('"+s.id+"')}}"),u+="<\/div><\/td><\/tr>",u+="{{/if}}",t||(o={},o[i._id+"_detailRowTemplate"]=u,n.templates(o)),u},_SelectState:function(){var t=this,n=this.model;return n.allowSelection?!0:!1},_addInitTemplate:function(){var t=this,f=t.model,k=f.columns,s=0,yt=k.length,e,i,h,o={},st,a,w,nt,c,et,tt,l,ot,ht,b,ut,y,ft,rt,it,ct;if(k.length===0)return!1;if(this._frozenColumnsLength>0&&(this.addFrozenTemplate(),f.showTotalSummary&&this.addFrozenSummaryTemplate()),o["_"+t._id+"rowClassName"]=r.TreeGrid._getrowClassName,o["_"+t._id+"SummaryRowtdClassName"]=r.TreeGrid._getSummaryRowtdClassName,o["_"+t._id+"isSelectedCell"]=n.proxy(t._getSelectedCellClass,t),o["_"+t._id+"summaryTitle"]=t._getSummaryTitle,o["_"+t._id+"rowName"]=t._getrowName,o.getState=t._getState,o.SelectState=n.proxy(t._SelectState,t),o["_"+t._id+"expandStatus"]=n.proxy(t._getExpandStatusRecord,t),o["_"+t._id+"cellValue"]=n.proxy(t._getCellValue,t),o["_"+t._id+"TemplateCellValue"]=n.proxy(t._getTemplateCellValue,t),o["_"+t._id+"isTreeColumnIndex"]=n.proxy(t._isTreeColumnIndex,t),o["_"+t._id+"getIndentWidth"]=n.proxy(t._getIndentWidth,t),o["_"+t._id+"checkColumn"]=n.proxy(t._getCellColumn,t),o["_"+t._id+"formatting"]=n.proxy(t.formatting,t),o._treeGridTemplating=r.proxy(t._gridTemplate,null,t),o["_"+t._id+"getCheckboxState"]=n.proxy(t._getCheckboxState,t),o.isTrimCell=n.proxy(t._checkIsTrimCell,t),n.views.helpers(o),f.parseRowTemplate&&(f.rowTemplateID.length>0||f.altRowTemplateID.length>0)){var p=r.buildTag("tbody","",{},{}),v=r.buildTag("tbody","",{},{}),d="",g="",lt=f.altRowTemplateID.length>0?n("#"+f.altRowTemplateID):n("#"+f.rowTemplateID),at=f.rowTemplateID.length>0?n("#"+f.rowTemplateID):n("#"+f.altRowTemplateID),pt=lt[0].innerHTML,wt=at[0].innerHTML;if(n(p[0]).html(pt),n(v[0]).html(wt),v[0].childNodes.length>0)for(a=0;a<v[0].childNodes.length;a++)if(v[0].childNodes[a].nodeName=="TR"&&(v[0].className=v[0].childNodes[a].className,v[0].style.cssText=v[0].childNodes[a].style.cssText,v[0].childNodes[a].childNodes.length>0))for(w=0,nt=0;nt<v[0].childNodes[a].childNodes.length;nt++)c=v[0].childNodes[a].childNodes[nt],c.nodeName=="TD"&&(et=c.innerHTML,tt=t._id+"RowTemplateElement"+w,n("#"+tt).remove(),rt=this._createRowTemplateElement(et,tt,at[0].type),c.innerHTML="{{:~_treeGridTemplating('"+rt.id+"')}}",c.className+=" e-rowcell e-templatecell",k[w]&&(i=k[w],e=i.field,y=i.visible==u?!0:i.visible,l="",i.headerText==t._visibleColumns[0]&&(l="{{if isSummaryRow || footerSummaryRowRecord}}<div class='e-summarytitle{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='float:left;display:block;'>{{:~_"+t._id+"summaryTitle()}}<\/div>{{/if}}"),w==f.treeColumnIndex?(ot="<div class='e-inner-treecolumn-container' style='height:20px;' unselectable='on'><div class='intend' style='height:1px; float:left;width:{{:~_"+t._id+"getIndentWidth(#data)}}; display:inline-block;'>{{if !~getState() || !hasChildRecords }}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='childIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='cancelIcon e-icon' style='position:relative;float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{if ~getState() && hasChildRecords}}<div class='intendparent'><div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:left;display:none;'><\/span><span class='belowIcon e-icon' style='float:left;display:none;'><\/span><span class='childIcon e-icon' style='float:left;display:none;'><\/span><span class='cancelIcon e-icon' style='float:left;display:none;'><\/span><\/div><\/div>{{/if}}<div class='{{if expanded && hasFilteredChildRecords}}e-treegridexpand e-icon{{else hasChildRecords && hasFilteredChildRecords}}e-treegridcollapse e-icon{{/if}}' style='height:20px;width:30px;margin:auto;float:left;margin-left:10px;display:inline-block;'><\/div><div class='e-cell{{if "+(i.showCheckbox&&this.model.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox)+"}} e-treecheckboxcolumn{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='overflow: hidden;'>",d+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"'>"+ot+"{{else}}'>{{/if}}{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",d+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",d+="<\/div><\/div><\/td>"):(d+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",d+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",d+="<\/td>"),this._frozenColumnsLength>0&&this._frozenColumnsLength==w+1&&(st="",st+=d,st+="<\/tr>",d=""),w++));if(p[0].childNodes.length>0)for(a=0;a<p[0].childNodes.length;a++)if(p[0].childNodes[a].nodeName=="TR")for(p[0].className=p[0].childNodes[a].className,p[0].style.cssText=p[0].childNodes[a].style.cssText,w=0,nt=0;nt<p[0].childNodes[a].childNodes.length;nt++)c=p[0].childNodes[a].childNodes[nt],c.nodeName=="TD"&&(et=c.innerHTML,tt=t._id+"AltRowTemplateElement"+w,n("#"+tt).remove(),rt=this._createRowTemplateElement(et,tt,lt[0].type),c.innerHTML="{{:~_treeGridTemplating('"+rt.id+"')}}",c.className+=" e-rowcell e-templatecell",k[w]&&(i=k[w],e=i.field,y=i.visible==u?!0:i.visible,l="",i.headerText==t._visibleColumns[0]&&(l="{{if isSummaryRow || footerSummaryRowRecord}}<div class='e-summarytitle{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='float:left;display:block;'>{{:~_"+t._id+"summaryTitle()}}<\/div>{{/if}}"),w==f.treeColumnIndex?(ot="<div class='e-inner-treecolumn-container' style='height:20px;'><div class='intend' style='height:1px; float:left;width:{{:~_"+t._id+"getIndentWidth(#data)}}; display:inline-block;'>{{if !~getState() || !hasChildRecords }}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='childIcon e-icon' style='position:relative;float:right;display:none;'><\/span><span class='cancelIcon e-icon' style='position:relative;float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{if ~getState() && hasChildRecords}}<div class='intendparent'><div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:left;display:none;'><\/span><span class='belowIcon e-icon' style='float:left;display:none;'><\/span><span class='childIcon e-icon' style='float:left;display:none;'><\/span><span class='cancelIcon e-icon' style='float:left;display:none;'><\/span><\/div><\/div>{{/if}}<div class='{{if expanded&& hasFilteredChildRecords}}e-treegridexpand e-icon{{else hasChildRecords && hasFilteredChildRecords}}e-treegridcollapse e-icon{{/if}}' style='height:20px;width:30px;margin:auto;float:left;margin-left:10px;display:inline-block;'><\/div><div class='e-cell{{if "+i.showCheckbox+"}} e-treecheckboxcolumn{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='overflow:hidden'>",g+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"'>"+ot+"{{else}}'>{{/if}}{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",g+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",g+="<\/div><\/div><\/td>"):(g+="<td class='"+c.className+"{{if isSummaryRow || footerSummaryRowRecord}} e-summaryrowcell{{/if}}{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}} {{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.style.cssText+"{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+c.innerHTML+"{{else}}"+l+"{{/if}}",g+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",g+="<\/td>"),this._frozenColumnsLength>0&&this._frozenColumnsLength==w+1&&(ht="",ht+=g,ht+="<\/tr>",g=""),w++));f.showDetailsRow&&f.detailsTemplate&&f.showDetailsRowInfoColumn&&(g+="<td class='{{if isSelected && ~SelectState()}}e-selectionbackground{{/if}} {{if isDetailsExpanded}}e-detailsrowexpand{{else}}e-detailsrowcollapse{{/if}} e-detailsrowcell{{if isLastSummary}} e-lastsummaryrow{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-detailsiconcell e-icon {{if isDetailsExpanded}}e-detailsinfoiconhide{{else}}e-detailsinfoiconshow{{/if}}'><\/div>{{/if}}",d+="<td class='{{if isSelected && ~SelectState()}}e-selectionbackground{{/if}} {{if isDetailsExpanded}}e-detailsrowexpand{{else}}e-detailsrowcollapse{{/if}} e-detailsrowcell{{if isLastSummary}} e-lastsummaryrow{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-detailsiconcell e-icon {{if isDetailsExpanded}}e-detailsinfoiconhide{{else}}e-detailsinfoiconshow{{/if}}'><\/div>{{/if}}");b="{{if isAltRow}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+p[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+p[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+g+"<\/tr>{{else}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+v[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+v[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+d+"<\/tr>{{/if}}";it="{{if isAltRow}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+p[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+p[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+st+"<\/tr>{{else}}<tr class='{{:~_"+t._id+"rowClassName()}} {{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} e-templaterow "+v[0].className+"' style='{{if !isSummaryRow && !footerSummaryRowRecord}}"+v[0].style.cssText+"{{else}}height:"+f.rowHeight+"px;{{/if}}display:{{:~_"+t._id+"expandStatus(#data)}}''>"+ht+"<\/tr>{{/if}}"}else if(!f.parseRowTemplate&&(f.rowTemplateID.length>0||f.altRowTemplateID.length>0))f.rowTemplateID&&f.altRowTemplateID?b="{{if isAltRow}}"+n("#"+f.rowTemplateID).html().trim()+"{{else}}"+n("#"+f.altRowTemplateID).html().trim()+"{{/if}}":f.rowTemplateID.length>0?b=n("#"+f.rowTemplateID).html().trim():f.altRowTemplateID.length>0&&(b=n("#"+f.altRowTemplateID).html().trim());else{for(b="<tr class='e-treegridrows {{:~_"+t._id+"rowClassName()}} ",f.enableAltRow&&(b+="{{if isAltRow}}e-alt-row{{/if}} "),ut="",s=0;s<yt;s++){if(k[s]){if(e=k[s].field,i=k[s],y=k[s].visible==u?!0:k[s].visible,ft=k[s].textAlign,l="",i.headerText==t._visibleColumns[0]&&(l="{{if isSummaryRow || footerSummaryRowRecord}}<div class='e-summarytitle{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='float:left;display:block;'>{{:~_"+t._id+"summaryTitle()}}<\/div>{{/if}}"),i.isTemplateColumn){b+="e-templaterow ";var tt=i.templateID,vt=i.template,bt=i.angularTemplate;bt?(n("#"+t._id+i.headerText+s+"_Template").remove(),rt=this._createTemplateElement(i),h="<td class='{{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} e-rowcell e-templatecell{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='text-Align:"+ft+"'role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}{{:~_treeGridTemplating('"+rt.id+"')}}{{else}}"+l+"{{/if}}",h+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",h+="<\/td>"):tt?(h="<td class='{{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} e-rowcell e-templatecell{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='text-Align:"+ft+";padding-left:10px;' role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+n("#"+tt)[0].innerHTML+"{{else}}"+l+"{{/if}}",h+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",h+="<\/td>"):vt&&(h="<td class='{{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} e-rowcell e-templatecell{{if isSelected && ~SelectState()}} e-selectionbackground{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}} e-hide{{/if}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}' style='text-Align:"+ft+"';padding-left:10px; role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}"+vt+"{{else}}"+l+"{{/if}}",h+=r.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}{{/if}}",h+="<\/td>")}else s===f.treeColumnIndex?(h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground e-intend {{else}}e-rowcell {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if !isSummaryRow && !footerSummaryRowRecord}} e-intend{{/if}} {{/if}} {{:~_"+t._id+"SummaryRowtdClassName()}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='padding-left:{{if ~_"+t._id+"isTreeColumnIndex('"+e+"') && isSummaryRow }}{{:((level)*"+t.treeIndentLevelWidth+")}}px{{/if}};background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-inner-treecolumn-container' style='height:20px;'>{{if hasChildRecords && hasFilteredChildRecords}}<div class='intend'style='height:1px; float:left; width:{{:((level)*"+t.treeIndentLevelWidth+")}}px; display:inline-block;'>{{if !~getState() || !hasChildRecords}}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><span class='childIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><span class='cancelIcon {{if level == 1 && hasChildRecords}} firstLevIconMargin {{/if}} e-icon' style='position:relative;float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{else !hasChildRecords || (!hasFilteredChildRecords && hasChildRecords)}}<div class='intend'style='height:1px; float:left; width:{{:(level*"+t.treeIndentLevelWidth+")+24}}px; display:inline-block;'>{{if !~getState() || !hasChildRecords}}<div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon iconMargin e-icon' style='position:relative;float:right;display:none;'><\/span><span class='belowIcon iconMargin e-icon' style='float:right;display:none;'><\/span><span class='childIcon iconMargin e-icon' style='float:right;display:none;'><\/span><span class='cancelIcon iconMargin e-icon' style='float:right;display:none;'><\/span><\/div>{{/if}}<\/div>{{/if}}{{if ~getState() && hasChildRecords}}<div class='intendparent'><div class={{:~_"+t._id+"rowName()}} ><span class='aboveIcon e-icon' style='position:relative;float:left;display:none;'><\/span><span class='belowIcon e-icon' style='float:left;display:none;'><\/span><span class='childIcon e-icon' style='float:left;display:none;'><\/span><span class='cancelIcon e-icon' style='float:left;display:none;'><\/span><\/div><\/div>{{/if}}<div class='{{if expanded && hasFilteredChildRecords}}e-treegridexpand e-icon{{else hasChildRecords && hasFilteredChildRecords}}e-treegridcollapse e-icon{{/if}}'style='float:left;display:inline-block; font-size:10px;'><\/div><div class='e-cell{{if "+(i.showCheckbox&&this.model.selectionSettings.selectionType==r.TreeGrid.SelectionType.Checkbox)+"}} e-treecheckboxcolumn{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='overflow: hidden;padding-left:{{if ~_"+t._id+"isTreeColumnIndex('"+e+"') && isSummaryRow}}{{:(level*"+t.treeIndentLevelWidth+")+24}}px{{/if}};'>{{/if}}{{:~_"+t._id+"getCheckboxState(#data, '"+e+"', '"+t._checkboxColumnName+"')}}",r.isNullOrUndefined(i.format)?f.isFromGantt&&i.mappingName===f.resourceInfoMapping?(o={},o["_"+t._id+"resourceName"]=t._getResourceName,n.views.helpers(o),h+="{{:~_"+t._id+"resourceName('"+t._id+"Object','"+f.resourceNameMapping+"','"+f.resourceUnitMapping+"','"+e+"')}}<\/div><\/div><\/td>"):f.isFromGantt&&i.mappingName===f.predecessorMapping?(o={},o["_"+t._id+"predecessor"]=n.proxy(t._getPredecessorsValue,t),n.views.helpers(o),h+="{{:~_"+t._id+"predecessor(#data)}}<\/div><\/div><\/td>"):(h+="{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}"+l+"{{if !isSummaryRow && !footerSummaryRowRecord}}<\/div><\/div><\/td>{{/if}}",l=""):h+="{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}"):f.isFromGantt&&i.mappingName===f.resourceInfoMapping?(o={},o["_"+t._id+"resourceName"]=t._getResourceName,n.views.helpers(o),h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell {{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}}'style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{:~_"+t._id+"resourceName('"+t._id+"Object','"+f.resourceNameMapping+"','"+f.resourceUnitMapping+"','"+e+"')}}<\/td>"):f.isFromGantt&&i.mappingName===f.predecessorMapping?(o={},o["_"+t._id+"predecessor"]=n.proxy(t._getPredecessorsValue,t),n.views.helpers(o),h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell {{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}}' style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{:~_"+t._id+"predecessor(#data)}}<\/td>"):f.isFromGantt&&i.mappingName===f.durationMapping?(o={},o["_"+t._id+"getDurationString"]=n.proxy(t._getDurationString,t),n.views.helpers(o),h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell {{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}}' style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};'role='gridcell'>{{:~_"+t._id+"getDurationString(#data)}}<\/td>"):i.editType=="booleanedit"&&t._checkboxSelection&&e=="checkboxState"?h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}} {{:~_"+t._id+"SummaryRowtdClassName()}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};text-Align: center;role='gridcell'>"+l+"{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"', '"+t._checkboxColumnName+"')}}":(h="<td class='{{if isSelected && ~SelectState()}}e-rowcell e-selectionbackground{{else}}e-rowcell{{/if}} {{:~_"+t._id+"isSelectedCell(#data,'"+s+"')}} {{if "+!y+"}}e-hide{{/if}} {{:~_"+t._id+"SummaryRowtdClassName()}}{{if isLastSummary}} e-lastsummaryrow{{/if}}{{if ~isTrimCell('"+i.clipMode+"')}} e-treegridtrimcell{{/if}}'style='background-color:{{if cellBackgroundColor && ~_"+t._id+"checkColumn('"+e+"',#data)=='"+e+"'}}{{:cellBackgroundColor}}{{else}}none{{/if}};text-Align:"+ft+"'role='gridcell'>{{:~_"+t._id+"getCheckboxState(#data, '"+e+"', '"+t._checkboxColumnName+"')}}"+l,h+=r.isNullOrUndefined(i.format)?"{{:~_"+t._id+"TemplateCellValue(#data,'"+e+"')}}":"{{:~_"+t._id+"formatting('"+i.format+"',~_"+t._id+"TemplateCellValue(#data,'"+e+"'),'"+this.model.locale+"')}}",h+="<\/td>",l="");ut+=h}this._frozenColumnsLength>0&&this._frozenColumnsLength==s+1&&(it="",it+=ut,it+="<\/tr>",ut="")}f.showDetailsRow&&f.detailsTemplate&&f.showDetailsRowInfoColumn&&(ut+="<td class='{{if isSelected && ~SelectState()}}e-selectionbackground{{/if}} {{if isDetailsExpanded}}e-detailsrowexpand{{else}}e-detailsrowcollapse{{/if}} e-detailsrowcell{{if isLastSummary}} e-lastsummaryrow{{/if}}'>{{if !isSummaryRow && !footerSummaryRowRecord}}<div class='e-detailsiconcell e-icon {{if isDetailsExpanded}}e-detailsinfoiconhide{{else}}e-detailsinfoiconshow{{/if}}'><\/div>{{/if}}");b+="{{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} 'style='background-color:{{if rowBackgroundColor }}{{:rowBackgroundColor}}{{else}}none{{/if}}; height:"+f.rowHeight+"px;display:{{:~_"+t._id+"expandStatus(#data)}}'role='row'>";it=b+it;b+=ut;b+=f.isFromGantt?"<td class='e-extendcolumn'><\/td><\/tr>":"<\/tr>"}f.showDetailsRow&&f.detailsTemplate&&(b+="{{if isDetailsExpanded}}"+t._createDetailsRowTemplate()+"{{/if}}",it+="{{if isDetailsExpanded}}"+t._createDetailsRowTemplate(!0)+"{{/if}}");ct={};ct[t._id+"_Template"]=b;ct[t._id+"_JSONFrozenTemplate"]=it;n.templates(ct)},_gridTemplate:function(n,t){return n._renderEjTemplate("#"+t,this.data,this.data.index)},_getIndentWidth:function(n){var t=n.level;return t*this.treeIndentLevelWidth+"px"},_createDetailRowTemplateElement:function(t){var u=/^#([\w-]*)/.exec(t),i={name:"SCRIPT",type:"text/x-template",text:t,id:"treeGridDetailsRowTemplateElement"+this._id};return scripEle=u&&u[1]?document.getElementById(u[1]):/^<script/i.test(t)?n(t).get(0):r.buildTag(i.name,i.text).get(0),scripEle.id=scripEle.id||i.id,scripEle.type=scripEle.type||i.type,n("body").append(scripEle),scripEle},_createRowTemplateElement:function(t,i,r){var u=document.createElement("script");return u.id=i,u.type=r||"text/x-template",u.text=t,n("body").append(u),u},_createTemplateElement:function(t,i){var u=i?"Pager":t.headerText+n.inArray(t,this.model.columns)+"_Template",r=document.createElement("script");return r.id=("treeGrid"+u).split(" ").join(""),r.type="text/x-template",r.text=n(t.angularTemplate?t.angularTemplate:t.template).html(),n("body").append(r),r},_getCheckboxState:function(n,t,i){if(t==i)return n.isSummaryRow==!0||n.summaryColumn||n.summaryRow?void 0:n.checkboxState=="indeterminate"?'<span class="e-chkbox-wrap e-widget" style="padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-indeter"><span class="e-checkbox e-chk-image e-icon e-stop" id ='+this._id+"_checkbox"+n.ejRowId+"><\/span><\/span><\/div><\/span>":n.checkboxState=="unchecked"?'<span class="e-chkbox-wrap e-widget" style="padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-inact"><span class="e-checkbox e-chk-image e-icon" id ='+this._id+"_checkbox"+n.ejRowId+"><\/span><\/span><\/div><\/span>":'<span class="e-chkbox-wrap e-widget" style="padding-right:10px;color:#c8c8c8;"><div class="e-chkbox-small"><span class="e-chk-act"><span class=" e-checkbox e-chk-image e-icon e-checkmark" id ='+this._id+"_checkbox"+n.ejRowId+"><\/span><\/span><\/div><\/span>"},_checkIsTrimCell:function(n){var t=this;return n&&n=="ellipsis"?!0:!1},_getCustomCellValue:function(n,t){if(!r.isNullOrUndefined(n)){var u=(t||"").split("."),i;if(u.length<=1)i=n[t];else{if(i=n[u[0]],r.isNullOrUndefined(i))return null;for(splitKeyIndex=1;splitKeyIndex<u.length;splitKeyIndex++)if(i=i[u[splitKeyIndex]],r.isNullOrUndefined(i))return null}return i}},_restoreCustomData:function(n,t,i){var s=this,e=0,o=0,i,f,u;if(r.isNullOrUndefined(i)&&(i=s._cellEditingDetails.fieldName),f=(i||"").split("."),u={},f.length<=1)r.isNullOrUndefined(n)?(n={},n[i]=t):n[i]=t;else{for(r.isNullOrUndefined(n)?(n={},u=n,o=0):(u=n[f[0]],r.isNullOrUndefined(u)&&(u={},n[f[0]]=u),o=1),e=o;e<f.length-1;e++)r.isNullOrUndefined(u[f[e]])&&(u[f[e]]={}),u=u[f[e]];u[f[e]]=t}return n},_getTemplateCellValue:function(t,i,f){var a=this,s=a.getColumnByField(i),y=s.editType,e=a._getCustomCellValue(t,i),l,h,o,p,c,v;if(e=r.isNullOrUndefined(e)?t.item&&t.item[i]:e,y==r.TreeGrid.EditingType.Boolean&&i==f?e=a._getCheckboxState(t,i,f):t.isSummaryRow||t.footerSummaryRowRecord||y!=r.TreeGrid.EditingType.Boolean||i==f||!(r.isNullOrUndefined(s.displayAsCheckbox)||s.displayAsCheckbox)||(e=e=="true"||e==!0?"<input class='e-treegrid-chekboxcell' type='checkbox' disabled='disabled' checked/>":"<input class='e-treegrid-chekboxcell' type='checkbox' disabled='disabled'/>"),i=="work"&&(e+=" "+a.model.workUnit),i=="taskMode"&&(e=!t.isAutoSchedule),i=="unit"&&(e+="%"),i=="duration"&&(e=a._getDurationString(t)),y==r.TreeGrid.EditingType.Dropdown)if(o=s.editParams,e=e!=null||e!=u?e:"",o&&o.fields?(h=o.fields.text?o.fields.text:"text",l=o.fields.value?o.fields.value:"value"):(l="value",h="text"),o&&o.showCheckbox){if(cellValueCollection=e.split(","),p=cellValueCollection.length,e="",s.dropdownData)for(c=0;c<p;c++)v=s.dropdownData,dropdownValue=n.map(v,function(n){if(r.isNullOrUndefined(n[l])){if(n[h]==cellValueCollection[c])return n[h]}else if(n[l].toString()==cellValueCollection[c].toString())return n[h]}),dropdownValue[0]=dropdownValue[0]?dropdownValue[0]:"",e+=c==0?dropdownValue[0]:","+dropdownValue[0]}else s.dropdownData&&(v=s.dropdownData,dropdownValue=n.map(v,function(n){if(r.isNullOrUndefined(n[l])){if(n[h].toString()==e)return n[h]}else if(n[l].toString()==e.toString())return n[h]}),dropdownValue[0]=r.isNullOrUndefined(dropdownValue[0])?"":dropdownValue[0],e=dropdownValue[0]);return e},_getCellValue:function(n,t){var i=this._getCustomCellValue(n,t);return i||i===0?i:n.item&&n.item[t]},_isTreeColumnIndex:function(n){var r=this,t=r.model,i=t.columns[t.treeColumnIndex];return i&&i.field==n?!0:!1},_getSummaryTitle:function(){var n=this,t=n.data.summaryRow.title;return t?t:n.data.item&&n.data.item.summaryRow.title},_getCellColumn:function(n,t){var i=this;return t.treeMappingName.indexOf(n)!==-1?n:"none"},_getResourceName:function(n,t,i,r){var h=this,u=h.data[r],f=0,e,o,c=u&&u.length,s=[];if(u&&u.length>0)for(f;f<c;f++)e=u[f][t],o=u[f][i],o!=100&&(e+="["+o+"%]"),s.push(e);return s},_getDurationString:function(n){var i="",t;return n.duration!=null&&(i+=n.duration+" "),n.durationUnit!=null&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.durationUnit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),i},_getPredecessorsValue:function(n){var e=n.predecessor,o,r,u,t,i,f;if(e)for(o=e.length,r="",u=0;u<o;u++)t=e[u],i="",t.from!=n.taskId&&(i=t.from+t.predecessorsType,t.offset!=0&&(i+=t.offset>0?"+"+t.offset+" ":t.offset+" ",f=t.offset!=1,i+=t.offsetDurationUnit=="day"?f?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:t.offsetDurationUnit=="hour"?f?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:f?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r=r.length>0?r+","+i:i);return r},_getExpandStatusRecord:function(n){var t=this;return t.getExpandStatus(n)?"table-row":"none"},_createRecords:function(n){var i=this,t=i.model,c=i.model.ids,s=t.flatRecords,e=n.length,o=0,h=!0,u,l=t.parentRecords,f;for(!t.isFromGantt&&t.enableCollapseAll&&(h=!1),t.allowPaging&&t.pageSettings.totalRecordsCount>0&&t.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(e=t.pageSettings.totalRecordsCount<e?t.pageSettings.totalRecordsCount:e),o;o<e;o++)u=i._createRecord(n[o],0,null,h),i._storedIndex++,u.isAltRow=i._storedIndex%2==0?!1:!0,l.push(u),u.index=i._storedIndex,c[i._storedIndex]=u.index,s.push(u),u.hasChildRecords&&i._parentRecords.push(u),u.childRecords&&i._addNestedRecords(u.childRecords);t.allowPaging&&t.pageSettings.totalRecordsCount>0&&t.pageSettings.pageSizeMode!==r.TreeGrid.PageSizeMode.Root&&t.pageSettings.totalRecordsCount<=s.length&&(f=t.pageSettings.totalRecordsCount,t.flatRecords=s.slice(0,f),t.flatRecords[f-1].hasChildRecords&&(t.flatRecords[f-1].hasChildRecords=!1,t.flatRecords[f-1].expanded=!1,t.flatRecords[f-1].childRecords=null,t.flatRecords[f-1].hasFilteredChildRecords=!1));i._maxRowIndex=this.model.flatRecords.length},_createRecord:function(t,i,f,e){var h=this,o,c=t[h.model.childMapping],s=this.model,a,l,v;return o=n.extend({},t),s.parentIdMapping&&h._createdAt==="load"?(a=t[s.idMapping],l=h._taskIds.indexOf(a),o.item=l>-1?h._retrivedData[l]:[]):this.dataSource()instanceof r.DataManager&&this.dataSource().dataSource.json&&this.dataSource().dataSource.offline&&h._createdAt==="load"?s.parentIdMapping?(a=t[s.idMapping],l=h._taskIds.indexOf(a),o.item=l>-1?h._retrivedData[l]:[]):o.item=t:o.item=t,o.parentItem=f,o.childRecords=c&&c.length>0&&h._createChildRecords(c,i+1,o),o.hasChildRecords=c&&c.length>0?!0:!1,s.expandStateMapping&&o.hasChildRecords?(r.isNullOrUndefined(t[s.expandStateMapping])?r.isNullOrUndefined(t[s.expandStateMapping])&&!s.enableCollapseAll?o[s.expandStateMapping]=o.item[s.expandStateMapping]=t[s.expandStateMapping]=!0:r.isNullOrUndefined(t[s.expandStateMapping])&&s.enableCollapseAll&&(o[s.expandStateMapping]=o.item[s.expandStateMapping]=t[s.expandStateMapping]=!1):o[s.expandStateMapping]=o.item[s.expandStateMapping]=t[s.expandStateMapping],v=t[s.expandStateMapping]):v=!0,o.expanded=e!==u&&c!==u&&o.hasChildRecords==!0&&v?e:v&&c?c.length>0:!1,o.dragState=!0,o.isSelected=!1,o.hasFilteredChildRecords=!0,o.level=i,o.cellBackgroundColor=null,o.rowBackgroundColor=null,o.treeMappingName=[],o.isDetailsExpanded=s.showDetailsRow&&s.detailsTemplate?s.showDetailsRowInfoColumn?!1:!0:!1,s.isFromGantt||(o.ejRowId=++h._idGenerator),o.checkboxState="unchecked",delete o[s.childMapping],o},_createChildRecords:function(n,t,i){var f=this,e=f.model,o=[],r=0,c=n.length,u=null,s,h;for(!e.isFromGantt&&e.enableCollapseAll&&(s=!1),r=0;r<c;r++)u=n[r],u&&(h=f._createRecord(u,t,i,s),o.push(h));return o},_addNestedRecords:function(n){for(var t=this,o=t.model,s=t.model.ids,h=o.flatRecords,c=o.updatedRecords,u=0,l=n.length,f=[],i,u=0;u<l;u++)if(i=n[u],t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,s[t._storedIndex]=i.index,h.push(i),c.push(i),i.hasChildRecords&&t._parentRecords.push(i),f=i.childRecords,f)for(var e=0,a=f.length,r=null,e=0;e<a;e++)r=f[e],t._storedIndex++,r.index=t._storedIndex,s[t._storedIndex]=r.index,r.isAltRow=t._storedIndex%2==0?!1:!0,h.push(r),c.push(i),r.hasChildRecords&&t._parentRecords.push(r),r.childRecords&&t._addNestedRecords(r.childRecords)},_enableColumnResizeEvents:function(){var n=this;n.model.allowColumnResize?n._on(n.element,"mousemove",n._mouseMove):n._off(n.element,"mousemove",n._mouseMove)},_wireEvents:function(){var t=this,i=t.model,u=jQuery.uaMatch(navigator.userAgent);r.isTouchDevice()?(t._on(t.element,"tap",t._onRecordClick),t._on(t.element,"tap",t._onClick)):(t._on(t.element,"click",t._onRecordClick),t._on(t.element,"click",t._onClick));t._on(t.element,"keydown",t._keyDown);t._on(t.element,"click","#"+t._id+"e-gridheader",t._onHeaderClick);t._on(t.element,"mousedown touchstart","#"+t._id+"e-gridheader",t._headerMouseDown);t._on(n(document),"mousedown touchstart",t._mouseDownHandler);t._on(t.element,"mousedown touchstart",".e-gridcontent",t._contentMouseDown);this.model.isResponsive&&this._on(this.element,"swipeleft swiperight",".e-gridcontent div > .e-table",n.proxy(this._swipeAction,this));t.model.allowColumnResize&&t._on(t.element,"mousemove",t._mouseMove);i.filterSettings.filterBarMode=="immediate"&&(t._on(t.element,"keyup",".e-filterbarcell input",t._filterBarHandler),t._off(t.element,"click",".e-filterbarcell .e-checkbox")._on(t.element,"click",".e-filterbarcell .e-checkbox",t._filterBarHandler));t._on(t.element,"focus click",".e-filterbarcell input",t._filterBarClose);t._on(t.element,"click",".e-filterbarcell .e-cancel",t._filterBarClose);t.model.showGridCellTooltip&&!t.model.showGridExpandCellTooltip?r.browserInfo().name=="msie"?t._on(t.element,"mouseenter",".e-rowcell",t._mouseHover):t._on(t.element,"mousemove",".e-rowcell",t._mouseHover):t._on(t.element,"mouseenter",".e-rowcell",t._mouseHover);t.model.showGridCellTooltip&&(r.browserInfo().name=="msie"?t._on(t.element,"mouseenter",".e-headercelldiv",t._headermouseHover):t._on(t.element,"mousemove",".e-headercelldiv",t._headermouseHover));t._on(t.element,"mouseleave",".e-rowcell",t._cellMouseLeave);t._on(t.element,"mouseleave",t._cellMouseLeave);t._on(t.element,"mouseleave",".e-headercelldiv",t._headerMouseLeave);t._on(t.element,"mouseleave",t._headerMouseLeave);(i.isFromGantt||this._frozenColumnsLength)&&t._on(t.element,"mousewheel DOMMouseScroll",t._mouseWheel);i.enableResize&&i.isResponsive&&!i.isFromGantt&&t._on(n(window),"resize",t._windowResize);t._enableEditingEvents();i.contextMenuSettings.showContextMenu&&t._on(t.element,"keyup",this._preventContextMenu)},_preventContextMenu:function(n){return this._off(this.element,"contextmenu",this._preventContextMenu),n.keyCode==93||n.type=="contextmenu"||n.type=="taphold"?(n.preventDefault(),n.stopPropagation(),!1):void 0},_mouseDownHandler:function(t){var r=this,i=n(t.target);i.closest("div.e-columnmenuitem").length!=0||i.closest("div.e-columnMenuListDiv").length!=0||(i.hasClass("e-columnmenu-icon")||i.hasClass("e-column-filter-icon")||i.hasClass("e-column-filtered-icon"))&&n(t.target).closest("#"+r._id).length!=0||i.closest("div.e-"+r._id+"filterStringSelector").length!=0||i.closest("div#"+r._id+"filterStringDropDown_popup_list_wrapper").length!=0||i.closest("div#"+r._id+"filterStringInputBox_suggestion").length!=0||i.closest("div.e-"+r._id+"filterNumericSelector").length!=0||i.closest("div#"+r._id+"filterNumericDropDown_popup_list_wrapper").length!=0||i.closest("div.e-"+r._id+"filterDatepickerSelector").length!=0||i.closest("div#"+r._id+"filterDatepickerDropDown_popup_list_wrapper").length!=0||i.closest("div#e-"+r._id+"filterDatepickerInputBox").length!=0||i.closest("div.e-"+r._id+"filterDatetimepickerSelector").length!=0||i.closest("div#"+r._id+"filterDatetimepickerDropDown_popup_list_wrapper").length!=0||i.closest("div#"+r._id+"filterDatetimepickerInputBox_popup").length!=0||i.closest("div.e-"+r._id+"filterDropdownSelector").length!=0||i.closest("div#"+r._id+"filterDropdownDropDown_popup_list_wrapper").length!=0||i.closest("div.e-"+r._id+"filterBooleanSelector").length!=0||r._clearColumnMenu();i.closest("div.e-menuitem").length==0&&r._clearContextMenu();i.closest("div.e-detailscellwrapperfly").length==0&&r._removeDetailsRow(t)},_mouseout:function(t){var i=this,r=i.model,u,c,a=i._gridPosition,e=a.top,f=i._gridHeight,v=i._$gridHeaderContainer.height()+e,h,y,l,s;if(r.toolbarSettings.showToolbar&&(h=r.isFromGantt?i._id.replace("ejTreeGrid",""):i._id,v+=n("#"+h+"_toolbarItems").length>0?n("#"+h+"_toolbarItems").outerHeight():0),r.allowPaging&&(f=f-i.element.find(".e-pager").first().outerHeight()),r.showTotalSummary&&(f=f-i._$totalSummaryRowContainer.outerHeight()),i._dragMouseDown){if(y=a.left,l=t.pageY,i.model.isFromGantt){var h=i._id.replace("ejTreeGrid",""),o=n("#"+h).find(".e-ganttviewerbodyContianer"),p=o.ejScroller("isVScroll"),s=p?o.find(".e-content").get(0).scrollHeight-1:0;c=o.ejScroller("isHScroll")?f+e-r.rowHeight/2-18:f+e-r.rowHeight/2}else s=i.isVScroll()?i.getMaxScrollHeight()-1:0,c=i.getScrollElement().ejScroller("isHScroll")?f+e-r.rowHeight/2-18:f+e-r.rowHeight/2;topScrollPos=v+r.rowHeight/2;l>c?s>i._scrollTop?_timerDragDown||(_timerDragDown=window.setInterval(function(){s>i._scrollTop&&(u=s>i._scrollTop?i._scrollTop+20:s,i.model.isFromGantt?o.ejScroller("scrollY",u,!0):i.getScrollElement().ejScroller("scrollY",u,!0))},100)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));l<topScrollPos&&i._scrollTop!=0?i._scrollTop>0?_timerDragUp||(_timerDragUp=window.setInterval(function(){i._scrollTop>0&&(u=i._scrollTop-20,u<0&&(u=0),i.model.isFromGantt?o.ejScroller("scrollY",u,!0):i.getScrollElement().ejScroller("scrollY",u,!0))},100)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp))}},getRange:function(t,i,u){var f=this,l=f.model;roundOff=0;rowHeight=u[0].offsetHeight;s=f.getOffsetRect(n("#"+f._id)[0]);height=f._$gridHeaderContainer.height()+s.top;rowHeight+=f._detailsRowHeight;l.toolbarSettings.showToolbar&&(height+=r.isNullOrUndefined(n("#"+f._id+"_toolbarItems").height())?0:n("#"+f._id+"_toolbarItems").height());f._scrollTop!=0&&(roundOff=rowHeight-f._scrollTop%rowHeight);var e=i*rowHeight+height+roundOff+7,a=e+u[0].offsetHeight,v=a-e,o=v/3,h=e+o,c=h+o,y=c+o,s={topRowSegment:h,middleRowSegment:c,bottomRowSegment:y};return s},_childValidation:function(n){var i,u=this,f=u._draggedRecord,t=f.parentItem,r;t&&(r=t.childRecords,i=r.indexOf(this._draggedRecord),n==t&&i!=-1&&(this._childItem=!0))},_isColumnHidable:function(n){var u=this.model,t=[],i=[],r=!0;return t=this._frozenColumns.filter(function(n){return n.visible==!0}),i=this._unFrozenColumns.filter(function(n){return n.visible==!0}),t.length==1&&t[0].field==n.field&&(r=!1),i.length==1&&i[0].field==n.field&&(r=!1),r},_updateColumnMenuVisibility:function(){var u=this.model,i=[],r=[],t;u.showColumnChooser&&(i=this._frozenColumns.filter(function(n){return n.visible==!0}),r=this._unFrozenColumns.filter(function(n){return n.visible==!0}),i.length==1&&(t=n("#"+this._id+"_columnMenu_"+i[0].field.split(".").join("")).data("ejCheckBox"),t&&t.option("enabled",!1)),r.length==1&&(t=n("#"+this._id+"_columnMenu_"+r[0].field.split(".").join("")).data("ejCheckBox"),t&&t.option("enabled",!1)))},_renderToolTip:function(t,i,r,u){var f=this,a=this.model,e=[],rt=document,b,ut=f.model.columns,ft=a.dragTooltip.tooltipItems.length,o=u.closest("tr"),y=f.getIndexByRow(o),e={},v,p,s=f.getUpdatedRecords(),l,c;f._insertAbove=!1;f._insertAsChild=!1;f._insertBelow=!1;f._childItem=!1;f._currentRecord=a.currentViewData[y];b=f._draggedRecord;y!=f._draggedIndex&&(f._displayContextMenu=!1);n(".intend").find(".e-icon").css({display:"none"});n(".intendparent").find(".e-icon").css({display:"none"});n(".e-error").css({display:"none"});n(".e-treegridexpand").css({display:"inline-block"});n(".e-treegridcollapse").css({display:"inline-block"});a.rowTemplateID?(v=s,l=s.indexOf(f._currentRecord)):(v=f.getExpandedRecords(s),f.getVisibleRange(),currentViewData=v.slice(f._visibleRange.top,f._visibleRange.bottom),f._scrollTop!=0?(p=s.indexOf(f._draggedRecord)-1,l=currentViewData.indexOf(f._currentRecord)-1):(p=s.indexOf(f._draggedRecord),l=currentViewData.indexOf(f._currentRecord)));var w=s.indexOf(f._currentRecord),k=f._currentRecord&&f._checkPrevNextRecord(f._draggedRecord,w,f._currentRecord.level,"next"),d=f._currentRecord&&f._checkPrevNextRecord(f._draggedRecord,w,f._currentRecord.level,"prev"),g=f._gridPosition.left,h=t.pageY;f._currentRecord&&(e=f.getRange(f._currentRecord,l,o));var nt=h<=e.topRowSegment,tt=h>e.topRowSegment&&h<=e.middleRowSegment,it=h>e.middleRowSegment&&h<=e.bottomRowSegment;f._currentRecord&&(f.data=f._currentRecord,c=this._getrowName(),f._childValidation(f._currentRecord),f._currentRecord.parentItem?f._currentRecord.hasChildRecords&&(f._currentRecord.expanded?o.find(".e-treegridexpand").css({display:"inline-block"}):o.find(".e-treegridcollapse").css({display:"inline-block"})):f._currentRecord.hasChildRecords&&(f._currentRecord.expanded?o.find(".e-treegridexpand").css({display:"none"}):o.find(".e-treegridcollapse").css({display:"none"})),f._currentRecord.dragState==!0&&r.canDrop!=!1?nt&&!d?(n(f.element).find("."+c).find(".aboveIcon").css({display:"block"}),f._insertAbove=!0):tt&&f._childItem==!1?(n(f.element).find("."+c).find(".childIcon").css({display:"block"}),f._insertAsChild=!0):it&&!k&&(n(f.element).find("."+c).find(".belowIcon").css({display:"block"}),f._insertBelow=!0):(n(f.element).find("."+c).find(".cancelIcon").css({display:"block"}),f.cancelDrop=!0));n(f._dragmouseOverTooltip).css({top:h+20+"px",left:g+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"})},_checkPrevNextRecord:function(n,t,i,r){var f=this,o=f.model,u=f.getUpdatedRecords(),e=t;for(r=="next"?t++:t--;u[t];){if(u[t].level==i)return u[t]==n&&n.parentItem==u[e].parentItem?!0:!1;r=="next"?t++:t--}return!1},_createDragTooltipTemplate:function(){var t=this,r=t.model.dragTooltip.tooltipTemplate,u,f,i;r&&(f=r.charAt(0),u=f=="#"?n(t.model.dragTooltip.tooltipTemplate)[0].innerHTML:t.model.dragTooltip.tooltipTemplate);i={};i[t._id+"dragtooltipTemplate"]=u;n.templates(i)},_updateDragStateFalse:function(n,t){var i,f=this,u,r;if(n.dragState=!1,n.hasChildRecords)for(u=n.childRecords.length,r=0;r<u;r++)i=n.childRecords[r],i.dragState=!1,i.hasChildRecords&&(t=f._updateDragStateFalse(i,t));return},_updateDragStateTrue:function(n,t){var i,e=this,f,u;if(!r.isNullOrUndefined(n)&&(n.dragState=!0,n.hasChildRecords))for(f=n.childRecords.length,u=0;u<f;u++)i=n.childRecords[u],i.dragState=!0,i.hasChildRecords&&(t=e._updateDragStateTrue(i,t));return},_getCoordinate:function(n){var t=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"||n.type=="tap")&&(t=n.originalEvent.changedTouches[0]),t},_getElementByPosition:function(t,i){return n(document.elementFromPoint(t-window.pageXOffset,i-window.pageYOffset))},dragRecord:function(t){var g,it,k,a,s,y,e,nt,tt,d,h;if(t.ctrlKey||t.shiftKey||t.which==2||t.which==3)return!0;var i=this,o=i.model,l,c={},p=i._getCoordinate(t),v=n(t.target),f=v.closest("tr");if(updatedRecords=i.getUpdatedRecords(),window.clearTimeout(this._dragTooltipTimer),this._dragTooltipTimer=null,!i._mouseDown)return!0;if(!f.hasClass("e-editedrow")&&i.editFormValidate()){if(o.selectionSettings.selectionMode=="cell"&&i.clearSelection(),i._clearColumnMenu(),i._removeDetailsRow(),i._saveCellHandler(t),i._posx=p.pageX,i._posy=p.pageY,v.hasClass("e-summaryrowcell")||v.hasClass("e-footersummaryrowcell")||v.hasClass("e-summarytitle"))return;o.enableVirtualization?(i._currentIndex=i.getIndexByRow(f),record=o.currentViewData[i._currentIndex],i._currentIndex=updatedRecords.indexOf(record)):i._currentIndex=i.getIndexByRow(f);i._draggedIndex=l=i.getIndexByRow(f);i._draggedRecord=i.model.currentViewData[l];c.draggedRowIndex=l;c.draggedRow=i._draggedRecord;i._trigger("rowDragStart",c);c.draggedRow&&c.draggedRow.isSummaryRow&&(c.cancel=!0);i._gridPosition=i.getOffsetRect(n("#"+i._id)[0]);i._frozenColumnsLength>0&&l!=-1&&(it=f.index(),g=f.closest(".e-movablecontentdiv").length>0?n(i._gridRows[0])[l]:n(i._gridRows[1])[l],f=f.add(g));var w=i._gridPosition.left,b=p.pageY,rt=i._$gridContainer[0].scrollWidth,u=f.clone();if(u.find(".e-hide").remove(),k=o.dragTooltip.tooltipItems.length,a=r.buildTag("table","",{padding:"1",width:"100%","border-collapse":"collapse"},{cellspacing:"1"}),i.model.dragTooltip.showTooltip&&i._dragTooltip==!1)if(i.model.dragTooltip.tooltipTemplate||i.model.dragTooltip.tooltipItems.length!=0)if(k!=0){for(s=o.columns,h=r.buildTag("tbody","",{},{}),tooltiptr=r.buildTag("tr.e-dragtooltipbackground","",{},{}),y=0;y<k;y++)for(e=0;e<s.length;e++)if(s[e].visible!=!1&&(columnTooltipValue=o.isFromGantt?s[e].mappingName:s[e].field,o.dragTooltip.tooltipItems[y]==columnTooltipValue)){nt=columnTooltipValue.split(".");tt=nt.length;d=tt==1?r.isNullOrUndefined(i._draggedRecord.item[s[e].field])?!1:i._draggedRecord.item[s[e].field].toString():i._getCustomCellValue(i._draggedRecord,s[e].field);d&&($td=r.buildTag("td.e-dragrowcell",d.toString(),{padding:"5px",width:i.columnsWidthCollection[e],height:o.rowHeight},{}),tooltiptr.append($td));tooltiptr.append($td);break}h.append(tooltiptr);a.append(h);i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltiptreegrid"+i._id+"",a,{top:b+20+"px",left:w+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"},{});n(i._dragmouseOverTooltip).addClass("e-dragtooltipbackground").addClass("e-dragrowcell");i._dragTooltip=!0}else i.model.dragTooltip.tooltipTemplate&&(i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltiptreegrid"+i._id+"","",{top:b+20+"px",left:w+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"},{}),i.tooltipState="TemplateID",h=r.buildTag("tbody",n.render[i._id+"dragtooltipTemplate"](i._draggedRecord),{},{}),i._dragmouseOverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",i._dragTooltip=!0);else h=r.buildTag("tbody","",{},{}),u.find(".e-treegridexpand").css({display:"none"}),u.find("td.e-detailsrowcell").css({display:"none"}),u.find(".e-treegridcollapse").css({display:"none"}),n(u.find(".intend")).css({width:0}),u.find(".e-intend").removeClass("e-intend"),u.find(".e-rowcell ").removeClass("e-rowcell ").addClass("e-dragrowcell"),u.addClass("e-dragtooltipbackground"),o.isFromGantt&&u.find("td:last").remove(),u.length==2&&this._frozenColumnsLength>0&&(n(u[0]).append(n(u[1].childNodes)),u.splice(1,1)),h.append(u),a.append(h),i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltiptreegrid"+i._id+"",a,{top:b+20+"px",left:w+15+"px",position:"absolute","z-index":"5",padding:"0","border-radius":"3px","border-right":"0","border-bottom":"0",width:rt},{}),n(i._dragmouseOverTooltip).addClass("e-dragtooltipbackground").addClass("e-dragrowcell"),i._dragTooltip=!0;i._draggedRecord&&(i._draggedElement=f,i._updateDragStateFalse(i._draggedRecord),i._dragMouseDown=!0,t.type=="touchstart"?(n(document.body).append(i._dragmouseOverTooltip),i._off(i.element,"touchmove","#"+i._id+"e-gridcontent",i._touchScroll),i._on(i.element,"touchmove",".e-treegridrows, .e-templatecell",i.dragToolTip)):(i._off(i.element,"mousemove","#"+i._id+"e-gridcontent",i._touchScroll),i._on(i.element,"mousemove",".e-treegridrows, .e-templatecell",i.dragToolTip)));c.cancel&&(i._dragMouseDown=!1,i._updateDragStateTrue(i._draggedRecord),i._dragTooltip=!1,i._dragmouseOverTooltip&&i._dragmouseOverTooltip.remove(),i._dragmouseOverTooltip=null,t.type=="touchstart"?i._off(i.element,"touchmove",".e-treegridrows, .e-templatecell",i.dragToolTip):i._off(i.element,"mousemove",".e-treegridrows, .e-templatecell",i.dragToolTip))}},dragToolTip:function(t){var i=this,y=i.model,u={},h,c,s,e,o,f=i._getCoordinate(t),l,a,v;(t.preventDefault(),l=Math.abs(f.pageX-i._posx),a=Math.abs(f.pageY-i._posy),r.isNullOrUndefined(i._posx)||r.isNullOrUndefined(i._posy)||l<10&&a<10)||i._dragMouseDown==!0&&i.model.allowDragAndDrop==!0&&(t.type=="touchmove"?e=i._getElementByPosition(f.pageX,f.pageY):(e=n(t.target),n(document.body).append(i._dragmouseOverTooltip)),o=e.closest("tr"),h=i.getIndexByRow(o),v=i.getUpdatedRecords(),h!=-1?(c=i.model.currentViewData[h],o=r.TreeGrid.getRowByIndex(i,i._currentIndex),s=o.clone(),s.find(".e-hide").remove(),i._dragTargetItem=c,u.targetRowIndex=h,u.targetRow=c,u.canDrop=!0,u.draggedRow=i._draggedRecord,u.draggedRowIndex=v.indexOf(i._draggedRecord),i._trigger("rowDrag",u),i._renderToolTip(f,s,u,e),u.targetRow&&u.targetRow.isSummaryRow?(i._draggedRecord.canDrop=!1,n(".intend").find(".e-icon").css({display:"none"}),n(".intendparent").find(".e-icon").css({display:"none"})):i._draggedRecord.canDrop=u.canDrop==!1?!1:!0):i._draggedRecord&&i._dragMouseDown&&(c=null,o=r.TreeGrid.getRowByIndex(i,i._currentIndex),s=o.clone(),$tr_summary=e.closest("tr"),u.targetRowIndex=null,u.targetRow=null,i._dragTargetItem=null,u.canDrop=!0,u.draggedRow=i._draggedRecord,u.draggedRowIndex=i._draggedRecord.index,i._trigger("rowDrag",u),$tr_summary.hasClass("e-footersummaryrow")||i._renderToolTip(f,s,u,e)),i._mouseout(f))},_mouseupHandler:function(t){var i=this,r=i.model;t.type=="touchstart"?i._off(i.element,"touchmove","#"+i._id+"e-gridcontent",i._touchScroll):i._off(i.element,"mousemove","#"+i._id+"e-gridcontent",i._touchScroll);i._off(n(document),"mouseup touchend",i._mouseupHandler);i._mouseDown=!1;i._isTouchEvent=!1;window.clearTimeout(i._dragTooltipTimer);r.allowDragAndDrop&&i._dragMouseDown&&i.dragMouseUp(t);r.contextMenuSettings.showContextMenu&&i._contextMenuHandler&&i._displayContextMenu?i._rightClick(t):i._contextMenuHandler=!1;i._displayContextMenu=!0;i._dy=i._dx=0},dragMouseUp:function(t){var v=0,o={},h={},u=this,e=u.model,k,l,f=u._draggedRecord,ct=u._currentRecord,nt,ft=e.selectedItems.length,y,tt=u._getCoordinate(t),p,d,a,c,et,s,b,g,w,it,rt;if(_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)),_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)),e.allowDragAndDrop&&(t.type=="touchstart"?u._off(u.element,"touchmove",".e-treegridrows, .e-templatecell",u.dragToolTip):u._off(u.element,"mousemove",".e-treegridrows, .e-templatecell",u.dragToolTip),nt=r.isNullOrUndefined(f)?!0:f.canDrop),window.clearTimeout(u._dragTooltipTimer),u._dragMouseDown=!1,n(u._dragmouseOverTooltip).remove(),u._dragTooltip=!1,k=t.type=="touchend"?u._getElementByPosition(tt.pageX,tt.pageY):n(t.target),l=k.closest("tr"),n(".intend").find(".e-icon").css({display:"none"}),n(".intendparent").find(".e-icon").css({display:"none"}),p=e.currentViewData[u.getIndexByRow(l)],this.cancelDrop!=!0||r.isNullOrUndefined(p)||p.parentItem!=null||(d=r.TreeGrid.getRowByIndex(this,e.updatedRecords.indexOf(p)),p.expanded?d.find(".e-treegridexpand").css({display:"inline-block"}):d.find(".e-treegridcollapse").css({display:"inline-block"})),u._dragMouseLeave=!0,k.closest("div#"+u._id).length!=1||r.isNullOrUndefined(f)||u._dropCancel!=!1)u._updateDragStateTrue(f);else if(e.allowDragAndDrop&&nt)if(u._dragMouseLeave=!1,a=u.getIndexByRow(l),a!=u._currentIndex&&a!=-1)if(u._droppedRecord=e.currentViewData[a],droppedRecord=u._droppedRecord,c=e.flatRecords,o.previousParentItem=f.parentItem,r.isNullOrUndefined(f.parentItem)||(o.parentChildState=f.parentItem.hasChildRecords,o.parentExpandedState=f.parentItem.expanded),h.targetRow=n.extend({},u._droppedRecord),h.targetRow.item=n.extend({},u._droppedRecord.item),h.targetRowIndex=e.updatedRecords.indexOf(droppedRecord),h.draggedRow=n.extend({},u._draggedRecord),h.draggedRow.item=n.extend({},u._draggedRecord.item),h.draggedRowIndex=e.updatedRecords.indexOf(f),o.previousItem=h.draggedRow,o.previousItemIndex=c.indexOf(u._draggedRecord),o.previousTarget=u._droppedRecord,o.previousTargetItemIndex=c.indexOf(u._droppedRecord),o.clonedTarget=n.extend({},u._droppedRecord),o.hasChildRecords=droppedRecord.hasChildRecords,o.expanded=droppedRecord.expanded,o.childIndex=o.previousParentItem?o.previousParentItem.childRecords.indexOf(f):0,o.previousLevel=f.level,et=[],droppedRecord.dragState==!0){if(u._updateDragStateTrue(f),u._insertAbove==!0||u._insertBelow==!0||u._insertAsChild==!0){for(u.model.isEdit||u._isRowEdit||u._cancelSaveTools(),i=0;i<ft;i++)u.clearSelection(e.selectedItems[i]);u._deleteDragRow();s=c.indexOf(droppedRecord);u._checkboxSelection&&e.selectionSettings.enableHierarchySelection&&f.parentItem&&u._updateParentSelection(f.parentItem);u._insertAbove==!0?(y="insertAbove",o.index=s,f.parentItem=c[s].parentItem,f.level=c[s].level,c.splice(s,0,f),e.updatedRecords.splice(s,0,f),e.isFromGantt&&e.ids.splice(s,0,f.taskId.toString()),f.hasChildRecords&&(b=1,u._updateChildRecord(f,s),u._updateChildRecordLevel(f,b)),droppedRecord.parentItem&&droppedRecord.parentItem.childRecords.splice(droppedRecord.parentItem.childRecords.indexOf(droppedRecord),0,f)):u._insertBelow==!0?(y="insertBelow",o.index=s+1,droppedRecord.hasChildRecords?(v=u.getChildCount(droppedRecord,0),c.splice(s+v+1,0,f),e.updatedRecords.splice(s+v+1,0,f),e.isFromGantt&&e.ids.splice(s+v+1,0,f.taskId.toString())):(c.splice(s+1,0,f),e.updatedRecords.splice(s+1,0,f),e.isFromGantt&&e.ids.splice(s+1,0,f.taskId.toString())),f.parentItem=c[s].parentItem,f.level=c[s].level,f.hasChildRecords&&(b=1,u._updateChildRecordLevel(f,b),u._updateChildRecord(f,s+v+1)),droppedRecord.parentItem&&droppedRecord.parentItem.childRecords.splice(droppedRecord.parentItem.childRecords.indexOf(droppedRecord)+1,0,f)):u._insertAsChild==!0&&(y="insertAsChild",o.index=s+1,f.hasChildRecords?(c.splice(s+1,0,f),e.updatedRecords.splice(s+1,0,f),e.isFromGantt&&e.ids.splice(s+1,0,f.taskId.toString()),u._recordLevel(a),u._updateChildRecord(f,s+1,droppedRecord.expanded)):(c.splice(s+1,0,f),e.updatedRecords.splice(s+1,0,f),e.isFromGantt&&e.ids.splice(s+1,0,f.taskId.toString()),u._recordLevel(a)))}if(u._checkboxSelection&&e.selectionSettings.enableHierarchySelection&&(f.parentItem&&u._updateParentSelection(f.parentItem),u.selectAllRows()),f.parentItem==null&&(g=e.parentRecords.indexOf(u._droppedRecord),u._insertBelow==!0?e.parentRecords.splice(g+1,0,f):u._insertAbove==!0&&e.parentRecords.splice(g,0,f)),o.requestType="dragAndDrop",o.draggedRow=f,o.targetRow=droppedRecord,o.droppedPosition=y,u._updateDataSource(),e.showSummaryRow&&u._insertAsChild==!0&&u._createSummaryRow(o),u.processBindings(o),h.draggedRow=o.draggedRow,h.draggedRow.item=o.draggedRow.item,h.draggedRowIndex=e.updatedRecords.indexOf(f),h.requestType=y,u._trigger("rowDragStop",h),e.enableAltRow&&e.currentViewData.length>0&&r.TreeGrid.updateAltRow(u,u.model.currentViewData[0],0,0),h.cancel&&u._revertDragging(o),e.enableWBS&&!h.cancel){f.parentItem?w=f.parentItem.childRecords:(it=e.flatRecords,rt=it.filter(function(n){return n&&n.level==0}),w=rt);var ut=w.indexOf(f),ot=w.slice(ut,w.length),st=f.parentItem?f.parentItem.WBS:null,ht=ut+1;u.reCalculateWBS(ot,ht,st)}e.allowSelection&&(e.selectionSettings.selectionMode=="row"&&u._selectDraggedRow(l),e.selectionSettings.selectionMode=="cell"&&u.updateScrollBar(e.updatedRecords.indexOf(u._draggedRecord)))}else u._updateDragStateTrue(f);else u._updateDragStateTrue(f),u.model.isEdit||u._isRowEdit||u._cancelSaveTools();else return u._updateDragStateTrue(f),u._resetPrivateProperties(),0;r.isNullOrUndefined(u._currentRecord)||u._currentRecord.parentItem==null&&(l=r.TreeGrid.getRowByIndex(u,e.updatedRecords.indexOf(u._currentRecord)),u._currentRecord.expanded?l.find(".e-treegridexpand").css({display:"inline-block"}):l.find(".e-treegridcollapse").css({display:"inline-block"}));e.showSummaryRow&&o.requestType=="dragAndDrop"&&u._insertAsChild!=!0&&u._updateSummaryRow(o);u._dropCancel=!1;u._resetPrivateProperties();r.isNullOrUndefined(f)||u.model.isEdit||u._isRowEdit||u._cancelSaveTools()},dragColumn:function(t){var u=n(t.target),i=this,s=i._getCoordinate(t),e;if(i._posx=s.pageX,i._posy=s.pageY,t.ctrlKey||t.shiftKey||t.which==2||t.which==3)return!0;var o=i.model,c=o.columns,h,f={};if(u.css("cursor")!="col-resize"&&u.closest(".e-headercelldiv")&&!u.hasClass("e-columnmenu-icon")){if(e=u.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),r.isNullOrUndefined(e)&&r.isNullOrUndefined(this.getColumnByField(e)))return;if(this.editFormValidate()&&(o.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),u.hasClass("e-checkbox"))return!1;if(i._draggedColumn=this.getColumnByField(e),h=c.indexOf(i._draggedColumn),f.draggedColumnIndex=h,f.draggedColumn=i._draggedColumn,f.requestType="columnDragStart",i._draggedColumnTemplate=r.isNullOrUndefined(i._draggedColumn.headerTemplateID)?null:u.closest(".e-headertemplate"),!r.isNullOrUndefined(i._draggedColumn.nonColumn))return;if(i._trigger("columnDragStart",f),f.cancel)return;o.selectionSettings.selectionMode=="cell"&&i.clearSelection();i._headerDragStatus="mousedown";i._dragMouseDown=!0;i._mouseDragged=!1;gridPos=i.getOffsetRect(i.element[0]);i._gridLeft=gridPos.left;i._touchstart=!0;t.type!="touchstart"&&i._on(i.element,"mousemove touchmove",i.dragColumnToolTip)}},dragColumnToolTip:function(t){var i=this,a=i.model,u={},v,w=a.columns,f={},s=i._getCoordinate(t),h=s.pageX,c=s.pageY,e,l,y,o,p;if(i._touchstart){i._touchstart=!1;return}if(t.type=="touchmove"?(t.preventDefault(),v=i._getElementByPosition(s.pageX,s.pageY)):v=n(t.target),i._headerDragStatus.length>0&&a.allowColumnReordering==!0)if(a.selectionSettings.selectionMode=="cell"&&i._headerDragStatus!="mousemove"&&i.clearSelection(),e=v.closest(".e-headercell"),l=e.find(".e-headercelldiv").attr("ej-mappingname"),r.isNullOrUndefined(l)||r.isNullOrUndefined(this.getColumnByField(l)))r.isNullOrUndefined(i._dragmouseOverTooltip)||n(i._dragmouseOverTooltip).css({top:c+"px",left:h-i._dragmouseOverTooltip.width/2+"px"});else{if(y=this.getColumnByField(l),i._currentIndex=w.indexOf(y),u.targetColumnIndex=i._currentIndex,u.draggedColumnIndex=w.indexOf(i._draggedColumn),u.draggedColumn=i._draggedColumn,u.targetColumn=y,u.requestType="columnDrag",u.canDrop=!0,i._trigger("columnDrag",u),u.cancel)return;f.pos=i.getOffsetRect(e[0]);f.height=n(e).height();f.width=n(e).outerWidth();f.pos.top=i.getOffsetRect(e.closest(".e-gridheader")[0]).top;f.pos.left=u.draggedColumnIndex>u.targetColumnIndex?f.pos.left-2:f.pos.left+f.width-2;f.display="block";u.column=f;u.direction=u.draggedColumnIndex>u.targetColumnIndex?"left":"right";i._autoHscroll(h,c,u);(u.draggedColumnIndex==u.targetColumnIndex||!r.isNullOrUndefined(u.targetColumn.nonColumn)||f.pos.left-8>i._gridWidth+i._gridLeft)&&(f.display="none");i._headerDragStatus=="mousemove"||i._dragTooltip?(n(i._reordervline).css({height:i._reordervline.height,width:0,"border-width":0,position:"absolute",top:f.pos.top+"px",left:f.pos.left+"px","border-left-width":"3px","border-style":"solid",display:f.display}),n(i._dragmouseOverTooltip).css({top:c+"px",left:h-i._dragmouseOverTooltip.width/2+"px"})):(o=i._gridHeight-1,i.model.toolbarSettings.showToolbar&&(o-=r.isNullOrUndefined(n("#"+i._id+"_toolbarItems").outerHeight())?0:n("#"+i._id+"_toolbarItems").outerHeight()),o-=i.getScrollElement().ejScroller("isHScroll")?18:0,p=r.buildTag("div",i._draggedColumn.headerText,{"margin-top":"5px"}),r.isNullOrUndefined(i._draggedColumnTemplate)||r.isNullOrUndefined(i._draggedColumn)||r.isNullOrUndefined(i._draggedColumn.headerTemplateID)||(p[0].innerHTML=i._draggedColumnTemplate[0].innerHTML),i._dragmouseOverTooltip=r.buildTag("div.e-tooltipgantt#columnreordertooltip"+i._id+"",p,{top:c+"px",left:h-57+"px",position:"absolute","z-index":i.getMaxZIndex()+1},{}),i._reordervline=r.buildTag("div.e-vline#reorderline"+i._id+"",{height:o,width:0,"border-width":0,position:"absolute",top:f.pos.top+"px",left:f.pos.left+"px","border-left-width":"3px","border-style":"solid",display:f.display}),n(document.body).append(i._dragmouseOverTooltip),n(document.body).append(i._reordervline),n(i._dragmouseOverTooltip).addClass("e-headertooltip"),n(i._reordervline).addClass("e-headervline"),i._dragmouseOverTooltip.width=n(i._dragmouseOverTooltip).outerWidth(),i._reordervline.height=o,i._dragTooltip=!0);i._headerDragStatus="mousemove"}},reorderColumn:function(n,t){var i=this,o=i.model,f=o.columns,r,u,s,h,c,e;if(c=f[o.treeColumnIndex],r=i.getColumnByField(n),u=f.indexOf(r),h=i.columnsWidthCollection[u],s=f[t],!s||!s.nonColumn){if(i._frozenColumnsLength>0)if(e=this._getFrozenColumnWidth(),i._frozenColumnsLength<=u&&i._frozenColumnsLength>t&&i._frozenColumns.indexOf(r)==-1){if(e=e+(this.columnsWidthCollection[u]+18),e>this._gridWidth)return!1;r.isFrozen=!0;i._frozenColumns.splice(t,0,r)}else i._frozenColumnsLength>u&&i._frozenColumnsLength<=t&&i._frozenColumns.indexOf(r)!=-1&&(r.isFrozen=!1,i._frozenColumns.splice(u,1),i._checkboxSelection&&i._frozenColumns.length==1&&i._frozenColumns[0].nonColumn&&(i._frozenColumns[0].isFrozen=!1,i._frozenColumns.splice(0,1)));f.splice(u,1);i.columnsWidthCollection.splice(u,1);f.splice(t,0,r);i.columnsWidthCollection.splice(t,0,h);o.treeColumnIndex=f.indexOf(c);i._refreshFrozenColumns()}},_autoHscroll:function(n){var t=this,o=t.model,r,u,s=o.columns,i=0,h=t.columnsWidthCollection,f,e;gridContent=t.getScrollElement();u=gridContent.ejScroller("isHScroll");r=u?gridContent.find(".e-content").get(0).scrollWidth:0;t._viewPortWidth=gridContent.find(".e-content").width();t._frozenColumnsLength>0&&(i=this._getFrozenColumnWidth());f=Math.round((t._gridLeft+t._gridWidth)/10)+18;e=Math.round(t._gridLeft/10)+18;t._gridLeft+t._gridWidth-f<n?_timerDragDown||(_timerDragDown=window.setInterval(function(){r>t._scrollLeft+t._viewPortWidth&&(topvalue=t._scrollLeft,topvalue=topvalue+50,t.getScrollElement().ejScroller("scrollX",topvalue,!0))},300)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));n<t._gridLeft+i+e&&n>t._gridLeft+i&&t._scrollLeft!=0?t._scrollLeft>0?_timerDragUp||(_timerDragUp=window.setInterval(function(){t._scrollLeft>0&&(topvalue=t._scrollLeft,topvalue=topvalue-50,topvalue<0&&(topvalue=0),t.getScrollElement().ejScroller("scrollX",topvalue,!0))},300)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp))},_resetPrivateProperties:function(){_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp));var t=this,i=t.model;t.cancelDrop=!1;t._draggedRecord=null;t._dragMouseDown=!1;_timerDragDown=null;_timerDragUp=null;t._childItem=!1;t._dragMouseLeave=!1;t._currentRecord=null;t._currentIndex=null;t._droppedRecord=null;t._insertAsChild=!1;t._insertAbove=!1;t._insertBelow=!1;i.allowDragAndDrop&&i.enableVirtualization&&(r.browserInfo().name=="chrome"||r.isTouchDevice())&&(t._dummyElement&&n(t._draggedElement).remove(),t._dummyElement=!1,t._draggedElement=null);t._dragTooltipTimer=null;t._dragColumnTooltipTimer=null;t._dragmouseOverTooltip=null},_selectDraggedRow:function(){var n=this,t=n.model,i=n.getUpdatedRecords();rowIndex=i.indexOf(n._draggedRecord);n._focusTreeGridElement();t.allowSelection&&!n._rowSelectingEventTrigger(this.selectedRowIndex(),rowIndex)&&(n.selectRows(rowIndex),n._rowSelectedEventTrigger(rowIndex))},_addChildItem:function(n){for(var t,i=this,f=0,f=n.childRecords.length,u=0;u<f;u++)t=n.childRecords[u],i.dataSource()instanceof r.DataManager?i.dataSource().dataSource.offline&&i.dataSource().dataSource.json&&(i.dataSource().dataSource.json.push(t.item),t.hasChildRecords&&i._addChildItem(t)):(i.dataSource().push(t.item),t.hasChildRecords&&i._addChildItem(t))},_updateDataSource:function(){var n=this,i=n.model,t=n._draggedRecord,u=n._droppedRecord,f,e,o;n.dataSource()instanceof r.DataManager?n.dataSource().dataSource.offline&&n.dataSource().dataSource.json&&(f=n.dataSource().dataSource.json):f=n.dataSource();f&&!u.parentItem?(e=f.indexOf(u.item),n._insertAbove?i.parentIdMapping||f.splice(e,0,t.item):n._insertBelow&&(i.parentIdMapping||f.splice(e+1,0,t.item))):!i.parentIdMapping&&u.parentItem&&(o=u.parentItem.childRecords.indexOf(t),n._insertAbove?u.parentItem.item[n.model.childMapping].splice(o,0,t.item):n._insertBelow&&u.parentItem.item[n.model.childMapping].splice(o,0,t.item));i.parentIdMapping&&(t.parentItem?n._insertAbove||n._insertBelow?i.isFromGantt==!0?t.item[i.parentIdMapping]=u.item[n.model.parentIdMapping]:(t[i.parentIdMapping]=u[n.model.parentIdMapping],t.item[i.parentIdMapping]=u[n.model.parentIdMapping]):i.isFromGantt==!0?t.item[i.parentIdMapping]=u.item[n.model.idMapping]:(t[i.parentIdMapping]=u[n.model.idMapping],t.item[i.parentIdMapping]=u[n.model.idMapping]):(t.item[i.parentIdMapping]=null,t[i.parentIdMapping]=null),n.dataSource()instanceof r.DataManager?n.dataSource().dataSource.offline&&n.dataSource().dataSource.json&&n.dataSource().dataSource.json.push(t.item):((n._insertAbove||n._insertBelow||n._insertAsChild)&&n.dataSource().push(t.item),t.hasChildRecords&&n._addChildItem(t)))},_deleteDragRow:function(n){var t=this,o=t.model,c,i,f={},l=t.getUpdatedRecords(),u,e,s,a,v,h;if(c=l.indexOf(t._draggedRecord),i=l[c],f.tr=n,f.data=i,f.requestType=r.TreeGrid.Actions.Delete,f.isDragAndDropDelete=!0,t._trigger("actionBegin",f))return!0;t.model.enableWBS&&(s=!1,i&&i.parentItem?(u=i.parentItem.childRecords,e=u.indexOf(i)):o.flatRecords.length&&(a=o.flatRecords,v=a.filter(function(n){return n&&n.level==0}),u=v,e=u.indexOf(i)),e!=u.length-1&&(s=!0));t._removeRecords(f);s&&(i.parentItem?h=u[e]:(u.splice(e,1),h=u[e]),t.updateWBSdetails(h));t._checkboxSelection||(o.selectedItems=[]);t._previousIndex=-1},_revertDragging:function(t){var i=this,f=i.model,u=f.flatRecords,o,e;i._draggedRecord=t.draggedRow;i._deleteDragRow();i._draggedRecord.hasChildRecords?(u.splice(t.previousItemIndex,0,i._draggedRecord),r.isNullOrUndefined(u[t.previousItemIndex].parentItem)||(u[t.previousItemIndex].parentItem=t.previousParentItem,r.isNullOrUndefined(t.previousParentItem)||u[t.previousItemIndex].parentItem.childRecords.splice(t.childIndex,0,i._draggedRecord)),o=f.flatRecords.indexOf(i._draggedRecord),i._updateChildRecord(i._draggedRecord,o,t.previousItem.index),i._draggedRecord.level=t.previousLevel,i._updateChildRecordLevel(i._draggedRecord,t.previousLevel)):(u.splice(t.previousItemIndex,0,i._draggedRecord),u[t.previousItemIndex].parentItem=t.previousItem.parentItem,r.isNullOrUndefined(t.previousParentItem)||(u[t.previousItemIndex].parentItem.childRecords.splice(t.childIndex,0,i._draggedRecord),u[t.previousItemIndex].parentItem.hasChildRecords=!0,u[t.previousItemIndex].parentItem.hasFilteredChildRecords=!0,u[t.previousItemIndex].parentItem.expanded=!0),u[t.previousItemIndex].level=t.previousLevel);f.parentIdMapping&&(u[t.previousItemIndex][f.parentIdMapping]=t.previousItem[f.parentIdMapping],u[t.previousItemIndex].item[f.parentIdMapping]=t.previousItem[f.parentIdMapping]);r.isNullOrUndefined(t.previousItem.parentItem)||(t.previousItem.parentItem.hasChildRecords=t.parentChildState,t.previousItem.parentItem.expanded=t.parentExpandedState,f.childMapping&&t.previousItem.parentItem.item[i.model.childMapping]&&t.previousItem.parentItem.item[i.model.childMapping].splice(t.childIndex,0,t.previousItem.item));f.isFromGantt&&(u[t.previousTargetItemIndex]=t.previousTarget,t.previousTarget.isAutoSchedule==!0?(t.previousTarget.startDate=t.previousTarget.item[t.model.startDateMapping]=new Date(t.clonedTarget.startDate),t.previousTarget.endDate=new Date(t.clonedTarget.endDate),t.previousTarget.duration=t.clonedTarget.duration,t.previousTarget.status=t.clonedTarget.status,t.model.endDateMapping&&(t.previousTarget.item[t.model.endDateMapping]=new Date(t.clonedTarget.endDate)),t.model.progressMapping&&(t.previousTarget.item[t.model.progressMapping]=t.clonedTarget.status),t.model.durationMapping&&(t.previousTarget.item[t.model.durationMapping]=t.clonedTarget.duration),t.previousTarget.expanded=t.clonedTarget.expanded,e=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),e._updateTargetGanttRecord(t.previousTarget)):(t.previousTarget.manualStartDate=new Date(t.clonedTarget.manualStartDate),t.previousTarget.manualEndDate=new Date(t.clonedTarget.manualEndDate),t.previousTarget.manualDuration=t.clonedTarget.manualDuration,t.previousTarget.status=t.clonedTarget.status,t.model.progressMapping&&(t.previousTarget.item[t.model.progressMapping]=t.clonedTarget.status),t.previousTarget.expanded=t.clonedTarget.expanded,e=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),e._updateGanttRecord(t.previousTarget)));i.processBindings(t);f.currentViewData.length>0&&r.TreeGrid.updateAltRow(i,f.currentViewData[0],0,0)},_updateChildRecord:function(n,t){var i,f=this,r=f.model,e,u;if(!n.hasChildRecords)return 0;for(e=n.childRecords.length,u=0;u<e;u++)i=n.childRecords[u],t++,r.flatRecords.splice(t,0,i),r.updatedRecords.splice(t,0,i),r.isFromGantt&&r.ids.splice(t,0,i.taskId.toString()),i.hasChildRecords&&(t=f._updateChildRecord(i,t));return t},_recordLevel:function(){var u=this,e=u.model,i=u._draggedRecord,t=u._droppedRecord,f=u.model.childMapping,o;t.hasChildRecords||(t.hasChildRecords=!0,t.hasFilteredChildRecords=!0,(r.util.isNullOrUndefined(t.childRecords)||n.isEmptyObject(t.childRecords))&&(t.childRecords=[],e.parentIdMapping||(t.item[f]=[])));u._insertAsChild&&(i.parentItem=t,t.childRecords.splice(0,0,i),r.isNullOrUndefined(i)||r.isNullOrUndefined(t.item[f])||e.parentIdMapping||t.item[f].splice(0,0,i.item),i.hasChildRecords?(o=1,i.level=t.level+1,u._updateChildRecordLevel(i,o)):i.level=t.level+1,t.expanded=!0,u._parentRecords.push(t))},_updateChildRecordLevel:function(n,t){var u=this,r=0,i;if(t++,!n.hasChildRecords)return 0;for(r=n.childRecords.length,i=0;i<r;i++)currentRecord=n.childRecords[i],currentRecord.level=n.parentItem?n.parentItem.level+t:n.level+1,currentRecord.hasChildRecords&&(t--,t=u._updateChildRecordLevel(currentRecord,t));return t},_filterBarClose:function(t){var i=n(t.target),r;t.type=="click"&&i.hasClass("e-cancel")&&(r=i.prev(),r.focus().val(""),r.prop("checked",!1),r.trigger("keyup"),t.stopPropagation());t.type=="focusin"&&(i=n(t.target).next(),this.getHeaderTable().find(".e-cancel").addClass("e-hide"),i.removeClass("e-hide"))},_checkIdenticalValue:function(n,t){for(var u,f=this,e=f.model,r=e.filterSettings.filteredColumns,o=r.length,i=0;i<o;i++)if(r[i].value===n&&r[i].field==t.field){u=!0;break}return u},_filterBarHandler:function(t){var i=this,o=i.model,c,f,v,y,p,l,a,h,s,e;if(i.model.isEdit?i.cancelEditCell():i._isRowEdit&&i.cancelRowEditCell(),i._isRefreshAddedRecord=!1,i.clearAllSelection(),f=t.target==u?n(t):n(t.target),this.model.allowFiltering){if(v=i.model.columns,y=i._cellEditingDetails,p=i._queryManagar.queries[0],l=f.hasClass("e-ddl")?f.find("input.e-field"):f,i._fieldName=l[0].id.replace(i._id+"_","").replace("_filterbarcell",""),this._currentFilterColumn=r.TreeGrid.getColumnByField(o.columns,i._fieldName),i._fieldName=this._currentFilterColumn.field,a=this._currentFilterColumn,f.hasClass("e-checkbox"))i._searchString=f[0].checked;else if(f.hasClass("e-ddl")){if(f=f.find("input.e-dropdownlist"),s=n("#"+f[0].id).data("ejDropDownList"),s.selectedIndexValue==-1||i._checkIdenticalValue(s._selectedValue,this._currentFilterColumn))return!0;i._searchString=s._selectedValue}else if(f.hasClass("e-dropdownlist")){if(e=n("#"+f[0].id).data("ejDropDownList"),e.selectedIndexValue==-1||i._checkIdenticalValue(e._selectedValue,this._currentFilterColumn))return!0;i._searchString=e._selectedValue==i._dropDownListClearText?"":e._selectedValue}else i._searchString=f.closest("input").val();if((this._currentFilterColumn.filterEditType=="datepicker"||this._currentFilterColumn.filterEditType=="datetimepicker")&&i._searchString!=""&&i._searchString&&(h=a.format?i._getDateFormat(this._currentFilterColumn.format):i.model.dateFormat,i._searchString=r.isNullOrUndefined(r.parseDate(i._searchString,h,o.locale))?"":r.parseDate(i._searchString,h,o.locale)),i._searchString==""&&(c=o.filterSettings.filteredColumns.filter(function(n){if(n.field===i._fieldName)return!0}),!c.length))return i._resizeFilteringElements(),!0;i._validateFilterValue(i._searchString);i.filterColumn(i._fieldName,this._operator,i._searchString,this._predicate);i._storePreviousFilteredValue(i._fieldName,i._searchString,this._operator);i.model.currentViewData.length>0&&i.model.enableAltRow&&r.TreeGrid.updateAltRow(i,i.model.currentViewData[0],0,0)}},_validateFilterValue:function(n){var t=this,i,f;this._predicate="and";switch(this._currentFilterColumn.filterEditType){case"numericedit":this._operator=r.FilterOperators.equal;break;case"datepicker":this._operator=r.FilterOperators.equal;i=this._currentFilterColumn.format==""||this._currentFilterColumn.format==u?r.preferredCulture().calendar.patterns.d:this._currentFilterColumn.format.split(":")[1].replace("}","");this._currentFilterbarValue!=""&&(this._currentFilterbarValue=r.format(n,i,this.model.locale));break;case"datetimepicker":this._operator=r.FilterOperators.equal;i=this._currentFilterColumn.format==""||this._currentFilterColumn.format==u?r.preferredCulture().calendar.patterns.f:this._currentFilterColumn.format.split(":")[1].replace("}","");this._currentFilterbarValue!=""&&(this._currentFilterbarValue=r.format(n,i,this.model.locale));break;case"stringedit":this._operator=r.FilterOperators.startsWith;break;case"dropdownedit":f=this._currentFilterColumn;this._operator=f.editType=="dropdownedit"&&f.editParams&&f.editParams.showCheckbox?r.FilterOperators.contains:r.FilterOperators.equal;break;case"booleanedit":t._searchString==!0||t._searchString=="1"?t._searchString=!0:(t._searchString=="false"||t._searchString=="0")&&(t._searchString=!1);this._operator=r.FilterOperators.equal;break;default:this._operator=r.FilterOperators.equal}},_headermouseHover:function(t){var i,v,d,b,s,y;if(t.preventDefault(),i=this,v=i.model,v.showGridCellTooltip&&!i._dragTooltip){var p=n(t.target),u=0,f=0,g=p.closest("div.e-headercelldiv"),w,s,e,h,c,l,a,o,k;i._headerMouseLeave();t||(t=window.event);t.originalEvent.pageX||t.originalEvent.pageY?(u=t.originalEvent.pageX,f=t.originalEvent.pageY):(t.originalEvent.clientX||t.originalEvent.clientY)&&(u=t.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,f=t.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop);e=g.clone();e.find(".e-ascending").length>0?e.find(".e-ascending").remove():e.find(".e-descending").length>0&&e.find(".e-descending").remove();e=p.closest(".e-headercell").hasClass("e-headertemplate")?e.clone():e.find("span").clone();w=r.buildTag("table.e-tooltiptable","",{padding:"0"},{cellspacing:"1"});s=r.buildTag("tbody",e,{},{});w.append(s);y=n(e).text().replace(/[ \t\r]+/g,"").length>0?!0:!1;s&&(k=p.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),o=this.getColumnByField(k),o&&(r.isNullOrUndefined(o.headerTooltip)||o.headerTooltip=="")?v.showGridCellTooltip&&y&&(d=n("#"+this._id+"detailscellwrapper").length>0?110:5,i._headerMouseOverTooltip=r.buildTag("div.e-tooltipgantt#headertooltip"+i._id+"",w,{top:f+10+"px",left:u+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),i._headerTooltipTimer=setTimeout(function(){n(document.body).append(i._headerMouseOverTooltip);var t=n("#"+i._id.replace("ejTreeGrid","")),r=i.getOffsetRect(t[0]);l=n(t).width()+r.left;a=n(t).height()+r.top;h=n(i._headerMouseOverTooltip).width();c=n(i._headerMouseOverTooltip).height();u+h+15>=l&&(u=u-h-15);f+c+10>=a&&(f=f-c-10);n(i._headerMouseOverTooltip).css({top:f,left:u})},700)):o&&!r.isNullOrUndefined(o.headerTooltip)&&o.headerTooltip!=""&&(d=n("#"+this._id+"detailscellwrapper").length>0?110:5,b={},b.column=o,i._createColumnTooltipTemplate(o.headerTooltip),i._headerMouseOverTooltip=r.buildTag("div.e-tooltipgantt#headertooltip"+i._id+"","",{top:f+10+"px",left:u+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),s=r.buildTag("tbody",n.render[i._id+"columnTooltipTemplate"](b),{},{}),i._headerMouseOverTooltip[0].innerHTML="<table>"+s[0].innerHTML+"<\/table>",y=n(s).text().replace(/[ \t\r]+/g,"").length>0?!0:!1,y&&(i._headerTooltipTimer=setTimeout(function(){var r,t;n(document.body).append(i._headerMouseOverTooltip);v.isFromGantt?(r=n("#"+i._id.replace("ejTreeGrid","")),t=i.getOffsetRect(r[0]),l=n(r).width()+t.left,a=n(r).height()+t.top):(t=i.getOffsetRect(i.element[0]),l=n(i.element).width()+t.left,a=n(i.element).height()+t.top);h=n(i._headerMouseOverTooltip).width();c=n(i._headerMouseOverTooltip).height();u+h+15>=l&&(u=u-h-15);f+c+10>=a&&(f=f-c-10);n(i._headerMouseOverTooltip).css({top:f,left:u})},700))))}},_mouseHover:function(t){var i,u,w,rt,k,c,b;if(t.preventDefault(),i=this,u=i.model,u.showGridCellTooltip&&this._dragMouseDown!=!0){var tt=n(t.target),i=this,f=0,e=0,ut=i.getRows(),p=tt.closest("tr"),s=tt.closest("td.e-rowcell"),d=this.getIndexByRow(p),g=u.currentViewData[d],nt,c,h,l,a,v,y,it=u.columns,o;p.hasClass("e-footersummaryrow")&&(d=i._getFooterRows().index(p),g=i._footerSummaryRecord[d]);(d>=0||p.hasClass("e-footersummaryrow"))&&(columnIndex=i.getCellIndex(t),i._cellMouseLeave(),o=it[columnIndex],t||(t=window.event),t.originalEvent.pageX||t.originalEvent.pageY?(f=t.originalEvent.pageX,e=t.originalEvent.pageY):(t.originalEvent.clientX||t.originalEvent.clientY)&&(f=t.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e=t.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop),(g||p.hasClass("e-footersummaryrow"))&&(columnIndex!=u.treeColumnIndex?(w=s.clone(),w.find(".e-chkbox-wrap").remove(),h=w.children().length?w.children().clone():w.clone()):s.find(".e-cell").length>0?(h=s.find(".e-cell").clone(),h.find(".e-chkbox-wrap").remove()):s.hasClass("e-summaryrowcell")&&(s.find(".e-summarytitle").length>0?h=s.find(".e-summarytitle").clone():(h=s.clone(),n(h).css({cssText:"padding-left: 0px;"}))),nt=r.buildTag("table.e-tooltiptable","",{padding:"0"},{cellspacing:"1"}),(!u.showGridExpandCellTooltip||u.showGridExpandCellTooltip&&columnIndex==i.model.treeColumnIndex)&&(c=r.buildTag("tbody",h,{},{})),nt.append(c),b=n(h).text().replace(/[ \t\r]+/g,"").length>0?!0:!1,c&&n(s).find("#"+i._id+"EditForm").length==0&&(!u.cellTooltipTemplate&&(r.isNullOrUndefined(o.tooltip)||o.tooltip=="")||u.cellTooltipTemplate&&!r.isNullOrUndefined(o.tooltip)&&o.tooltip==""?(!u.showGridExpandCellTooltip&&b||u.showGridExpandCellTooltip&&b)&&(rt=n("#"+this._id+"detailscellwrapper").length>0?110:5,i._mouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltipgantt"+i._id+"",nt,{top:e+10+"px",left:f+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),i._tooltipTimer=setTimeout(function(){var r,t;n(document.body).append(i._mouseOverTooltip);u.isFromGantt?(r=n("#"+i._id.replace("ejTreeGrid","")),t=i.getOffsetRect(r[0]),v=n(r).width()+t.left,y=n(r).height()+t.top):(t=i.getOffsetRect(i.element[0]),v=n(i.element).width()+t.left,y=n(i.element).height()+t.top);l=n(i._mouseOverTooltip).width();a=n(i._mouseOverTooltip).height();f+l+15>=v&&(f=f-l-15);e+a+10>=y&&(e=e-a-10);n(i._mouseOverTooltip).css({top:e,left:f})},700)):(u.cellTooltipTemplate||!r.isNullOrUndefined(o.tooltip)&&o.tooltip!="")&&(rt=n("#"+this._id+"detailscellwrapper").length>0?110:5,k={},k.record=g,k.column=it[columnIndex],r.isNullOrUndefined(o.tooltip)||i._createColumnTooltipTemplate(o.tooltip),i._mouseOverTooltip=r.buildTag("div.e-tooltipgantt#tooltipgantt"+i._id+"","",{top:e+10+"px",left:f+15+"px",position:"absolute","z-index":i.getMaxZIndex()+1,padding:"0","border-radius":"3px"},{}),i.tooltipState="Template",c=r.isNullOrUndefined(o.tooltip)?r.buildTag("tbody",n.render[i._id+"tooltipTemplate"](k),{},{}):r.buildTag("tbody",n.render[i._id+"columnTooltipTemplate"](k),{},{}),i._mouseOverTooltip[0].innerHTML="<table>"+c[0].innerHTML+"<\/table>",b=n(c).text().replace(/[ \t\r]+/g,"").length>0?!0:!1,b&&(i._tooltipTimer=setTimeout(function(){var r,t;n(document.body).append(i._mouseOverTooltip);u.isFromGantt?(r=n("#"+i._id.replace("ejTreeGrid","")),t=i.getOffsetRect(r[0]),v=n(r).width()+t.left,y=n(r).height()+t.top):(t=i.getOffsetRect(i.element[0]),v=n(i.element).width()+t.left,y=n(i.element).height()+t.top);l=n(i._mouseOverTooltip).width();a=n(i._mouseOverTooltip).height();f+l+15>=v&&(f=f-l-15);e+a+10>=y&&(e=e-a-10);n(i._mouseOverTooltip).css({top:e,left:f})},700))))))}},_cellMouseLeave:function(){var t=this;t._mouseOverTooltip!=null&&(n("#tooltipgantt").remove(),window.clearTimeout(t._tooltipTimer),n(t._mouseOverTooltip).remove())},_headerMouseLeave:function(){var t=this;t._headerMouseOverTooltip!=null&&(n("#headertooltip").remove(),window.clearTimeout(t._headerTooltipTimer),n(t._headerMouseOverTooltip).remove())},disableTooltip:function(){this._cellMouseLeave()},_createTooltipTemplate:function(){var i=this,e,s=i.model.columnHeaderTexts,o={_getTaskName:i._tooltipTaskName},r=i.model.cellTooltipTemplate,t=null,u,f;n.views.helpers(o);u="";r?(u=document.getElementById(r)?n("#"+r)[0].innerHTML:r,t=u):(t="<tr class='e-tooltip_rowcell'>",e="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='height:auto;width:auto;font-weight:normal;'>{{:ttiptaskname}}<\/td>{{/if}}",t+=e,t+="<\/tr>");f={};f[i._id+"tooltipTemplate"]=t;n.templates(f)},_tooltipTaskName:function(){return this.data.ttiptaskname},_createColumnTooltipTemplate:function(t){var f=this,r=null,u="",i;t&&(u=document.getElementById(t)?n("#"+t)[0].innerHTML:t.slice(0,1)==="#"&&document.getElementById(t.slice(1,t.length))?n(t)[0].innerHTML:t,r=u);i={};i[f._id+"columnTooltipTemplate"]=r;n.templates(i)},getMaxZIndex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==u||t==null)&&(t=1),t},_onScroll:function(t){var i=this,e=this.model,f,o;if(i._popupHide(),i._clearContextMenu(),n("#"+this._id+"detailscellwrapper").length>0&&this._removeDetailsRow(),i.model.showGridCellTooltip&&(i._cellMouseLeave(),i._headerMouseLeave()),!e.isFromGantt&&i._dragTooltip&&!_timerDragDown&&!_timerDragUp){t.cancel=!0;return}if(!i.isVScroll()&&!i.model.isFromGantt&&t.source==="wheel"){t.cancel=!0;return}t.scrollLeft!=u&&(i._scrollLeft=t.scrollLeft,f=Math.abs(i._scrollLeft-i._prevScrollLeft));t.scrollTop!=u&&(i._scrollTop=t.scrollTop,o=Math.abs(i._scrollTop-i._preVScrollTop));f&&(i._updateHeaderScrollLeft(i._scrollLeft),i._prevScrollLeft=i._scrollLeft);t.scrollTop!=u&&(i.model.isEdit?(i.cancelEditCell(),i._focusTreeGridElement()):i._isRowEdit&&(i.cancelRowEditCell(),i._focusTreeGridElement()),i._vScrollDist=Math.abs(i._scrollTop-i._prevScrollTop),i._preVScrollTop=i._scrollTop,i.model.enableVirtualization&&(i._vScrollDir=i._prevScrollTop<=i._scrollTop?1:-1,i._vScrollDist&&i._scrollTop!=i._prevScrollTop&&(i._updateCurrentViewData(r.TreeGrid.Actions.Scroll),i._prevScrollTop=i._scrollTop)),i._scrollTop=t.scrollTop,this._frozenColumnsLength&&i.getContent().find("#e-frozencontainer"+i._id).scrollTop(i._scrollTop))},editFormValidate:function(){if(n.isFunction(n.validator)){if(n("#"+this._id+"EditForm").length>0)return n("#"+this._id+"EditForm").validate().form();if(n("#"+this._id+"EditFormDialog").length>0)return n("#"+this._id+"EditFormDialog").validate().form()}return!0},saveRow:function(){var t=this,f=t.model,s,h,v,b,d,c,e,w,a,g;t.model.editSettings.allowEditing&&t.model.editSettings.editMode=="dialogEditing"?(s=n("#"+t._id+"EditFormDialog"),h=t._currentEditRecordDialogIndex,v=!0):(s=n("#"+t._id+"EditForm"),h=this.getIndexByRow(s.closest("tr")));var k=n("#"+t._id+"EditFrozenForm"),nt=k.add(s).find("td"),p=s.closest("tr").hasClass("e-addedrow"),o=f.columns,y=o.length,u=f.currentViewData[h],l={};if(previousValue={},args={},t._focusTreeGridElement(),!(s.length<=0)||h!=-1){for(i=0;i<y;i++)if(column=o[i],!r.isNullOrUndefined(column)&&column.field!="")if(column.visible){if(b=r.isNullOrUndefined(column.editType)?"stringedit":column.editType,value=t.getCurrentEditCellDataForRowEdit(column.field,b,i),t._checkboxSelection&&column.field=="checkboxState")continue;f.idMapping&&f.parentIdMapping&&column.field==f.idMapping&&t._validateIdValue(value)&&(value=u[column.field]);d=(column.field||"").split(".");d.length<=1?(previousValue[column.field]=u.item[column.field],l[column.field]=u[column.field]=u.item[column.field]=value):(e=t._getCustomCellValue(u.item,column.field),previousValue=t._restoreCustomData(previousValue,e,column.field),l=t._restoreCustomData(l,value,column.field),u=t._restoreCustomData(u,value,column.field),u.item=t._restoreCustomData(u.item,value,column.field))}else e=t._getCustomCellValue(u,column.field),previousValue=t._restoreCustomData(previousValue,e,column.field),l=t._restoreCustomData(l,e,column.field);if(p){if(args.rowIndex=t.selectedRowIndex(),args.previousValue=previousValue,args.requestType="addNewRow",args.addedRow=t._checkIsEmptyRow(u.item)?null:u.item,args.rowElement=s.closest("tr"),t._trigger("actionComplete",args))for(i=0;i<y;i++)column=o[i],r.isNullOrUndefined(column)||column.visible&&(e=t._getCustomCellValue(previousValue,column.field),u=t._restoreCustomData(u,e,column.field),u.item=t._restoreCustomData(u.item,e,column.field))}else if(args.previousValue=previousValue,args.requestType="update",v?(args.rowIndex=t._currentEditRecordDialogIndex,args.element=n("#"+t._id+"_dialogEdit")):(args.rowIndex=t.selectedRowIndex(),args.rowElement=s.add(k).closest("tr")),args.currentValue=u.item,v){if(t._trigger("actionBegin",args)){for(i=0;i<y;i++)column=o[i],r.isNullOrUndefined(column)||column.visible&&(e=t._getCustomCellValue(previousValue,column.field),u=t._restoreCustomData(u,e,column.field),u.item=t._restoreCustomData(u.item,e,column.field));return!0}for(c=0;c<o.length;c++)(o[c].editType==r.TreeGrid.EditingType.Dropdown||o[c].editType==r.TreeGrid.EditingType.DatePicker||o[c].editType==r.TreeGrid.EditingType.DateTimePicker)&&($element=n("#"+t._id+t._getFieldValue(o[c].field)),$element.data("ejWidgets")&&$element[$element.data("ejWidgets")[0]]("destroy"))}else if(t._trigger("endEdit",args))for(i=0;i<y;i++)column=o[i],r.isNullOrUndefined(column)||column.visible&&(e=t._getCustomCellValue(previousValue,column.field),u=t._restoreCustomData(u,e,column.field),u.item=t._restoreCustomData(u.item,e,column.field));t._checkIsEmptyRow(u.item)&&p?(w=!1,t._isEmptyRow=!0,f.editSettings.allowDeleting||(w=!0,f.editSettings.allowDeleting=!0),t._checkboxSelection?t.deleteRow(null,!0,null):t.deleteRow(),t._isEmptyRow=!1,t._isEmptyRowDeleted=!0,w&&(f.editSettings.allowDeleting=!1)):(r.TreeGrid.refreshRow(t,h),p&&u.parentItem&&u.parentItem.childRecords.length==1&&r.TreeGrid.refreshRow(t,f.currentViewData.indexOf(u.parentItem)),f.showSummaryRow&&(args.editType="rowedit",args.requestType=="addNewRow"&&f.editSettings.rowPosition=="child"&&t._createAndRenderSummaryRecords(args),t._updateSummaryRow(args)),f.showTotalSummary&&(args.editType="rowedit",t._updateTotalSummaryRow(args)),v&&(a={},a.data=f.currentViewData[h],a.item=f.currentViewData[h].item,a.requestType="recordUpdate",t._trigger("actionComplete",a)));t._isRowEdit=!1;f.currentViewData.length>0&&f.enableAltRow&&!f.enableVirtualization&&r.TreeGrid.updateAltRow(t,f.currentViewData[0],0,0);t._cancelSaveTools();g=o.filter(function(n){if(n.filterEditType=="dropdownedit"&&n.editType!="dropdownedit")return!0});f.allowFiltering&&g.length&&t._resizeFilteringElements()}},_excludeDetailRows:function(){var t=n(),i=this.model;return this.getTreeGridRows()&&this.getTreeGridRows().length>0&&(t=i.showDetailsRow&&i.detailsTemplate?this._frozenColumnsLength>0?[n(this.getTreeGridRows()[0]).not(".e-detailsrow"),n(this.getTreeGridRows()[1]).not(".e-detailsrow")]:n(this.getTreeGridRows()).not(".e-detailsrow"):this._frozenColumnsLength>0?[n(this.getTreeGridRows()[0]),n(this.getTreeGridRows()[1])]:n(this.getTreeGridRows())),t},getIndexByRow:function(t){var r=this._excludeDetailRows(),i=-1;return this._frozenColumnsLength>0?(i=n(r[0]).index(t),i==-1&&(i=n(r[1]).index(t)),i):r.index(t)},getTreeGridRows:function(){return this._gridRows},_keyDown:function(n){var t=this;n.shiftKey&&t._shiftKeyFirstElementDetails.firstElementRowIndex==-1&&(t._shiftKeyFirstElementDetails.firstElementRowIndex=t._focusingRowIndex,t._shiftKeyFirstElementDetails.firstElementCellIndex=t._cellIndex)},_focusTreeGridElement:function(){if(r.browserInfo().name=="msie")try{this.element[0].setActive()}catch(n){}else this.element[0].focus()},_onRecordClick:function(t){var f=this,u=n(t.target),s=f.model,e,h=u.closest("td"),i={},o=u.closest("tr");(u.hasClass("e-rowcell")||u.parent().hasClass("e-rowcell")||u.closest("td").hasClass("e-rowcell")||u.closest("td").hasClass("e-rowcell")&&u.hasClass("e-cell"))&&o.find(".e-editedcell").length==0&&!o.hasClass("e-summaryrow")&&(i.cell=h,i.cellIndex=f.getCellIndex(t),i.row=o,i.rowIndex=f.getIndexByRow(i.row),i.data=f.model.currentViewData[i.rowIndex],e=s.columns[i.cellIndex],i.columnName=e.headerText,i.cellValue=r.isNullOrUndefined(i.data)?"":i.data[e.field],f._trigger("recordClick",i))},_addRemoveAnimateClass:function(t){var i=this;this._$gridContentTable&&this._$gridContentTable.find(".e-treegrid-animate").removeClass("e-treegrid-animate");i._$gridHeaderContainer&&i._$gridHeaderContainer.find(".e-treegrid-animate").removeClass("e-treegrid-animate");n(t).addClass("e-treegrid-animate")},_onClick:function(t){var i=this,f=i.model,u=n(t.target),e,o={},l=-1,y,w=u.closest(".e-treegrid").attr("id"),a=i.getUpdatedRecords(),nt,k,it,c,d,ut;if(u.closest(".e-treegrid").attr("id")!==this._id)return!1;if(i._clearContextMenu(),this._removeDetailsRow(t),f.allowDragAndDrop&&window.clearTimeout(i._dragTooltipTimer),f.allowColumnReordering&&(window.clearTimeout(this._dragColumnTooltipTimer),this._dragColumnTooltipTimer=null),i._cellIndex=i.getCellIndex(t),this.getHeaderTable().find(".e-cancel").addClass("e-hide"),f.selectionSettings.selectionMode=="cell"&&f.editSettings.editMode!="dialogEditing"&&(f.editSettings.editMode="cellEditing"),l=i.getRowIndex(t),(f.editSettings.beginEditAction=="click"||u.hasClass("e-treegridexpand")||u.hasClass("e-treegridcollapse"))&&u.closest(".e-scrollbar").length==0&&this.editFormValidate()&&(f.editSettings.editMode.toLowerCase()=="cellediting"&&(i._cellEditingDetails.rowIndex=l),y=f.currentViewData&&f.currentViewData[l]),!i.model.allowSelection||i.model.selectionSettings.selectionType!="multiple"||i.model.isFromGantt||u.hasClass("e-downtail")||(u.hasClass("e-rowselect")?u.hasClass("e-spanclicked")?i._clearMultiSelectPopup():u.addClass("e-spanclicked"):n("#"+w+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")||this._multiSelectPopup.hide()),i._saveCellHandler(t),!u.hasClass("e-summaryrowcell")&&!u.hasClass("e-footersummaryrowcell")&&!u.hasClass("e-summarytitle")){if((u.hasClass("e-treegridexpand")||u.hasClass("e-treegridcollapse"))&&l!=-1){var ft=u.closest("tr"),b=a.indexOf(y),o={},g;u.removeClass("e-treegrid-animate");o.data=s;o.data=y;o.recordIndex=b;o.expanded=ft.hasClass("e-treegridrowexpand")?!1:!0;n("#"+i._id+"EditForm").length==0&&(u.hasClass("e-rowcell")||!u.closest(".e-rowcell").hasClass("e-templatecell"))?i._focusTreeGridElement():i._cancelEditState();g=o.expanded?i._trigger("expanding",o):i._trigger("collapsing",o);g||f.isFromGantt||(i._isRefreshAddedRecord?(o.data.expanded=o.expanded,i.updateExpandStatus(o.data,o.expanded),i.refreshContent(),i.renderRecords(),i._isRefreshAddedRecord=!1):r.TreeGrid.sendExpandCollapseRequest(i,o));f.allowPaging||f.enableVirtualization?(nt=i.getUpdatedRecords(),k=r.TreeGrid.getRowByIndex(this,nt.indexOf(y)),k&&i._addRemoveAnimateClass(n(k).find(".e-treegridcollapse,.e-treegridexpand"))):i._addRemoveAnimateClass(u)}else if(u.hasClass("e-rowcell")||u.parent().hasClass("e-rowcell")||u.closest("td").hasClass("e-rowcell")||u.parent().hasClass("e-detailsrowcell")||u.hasClass("e-detailsrowcell")||u.closest("td").hasClass("e-rowcell")&&u.hasClass("e-cell")){if(n("#"+w+"_selectionpopup").is(":visible")&&(n("#"+w+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")?(t.ctrlKey=!0,f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row&&(i._multiSelectCtrlRequest=!0)):(t.ctrlKey=!1,i._multiSelectCtrlRequest=!1)),n("#"+i._id+"EditForm").length==0&&(u.hasClass("e-rowcell")||!u.closest(".e-rowcell").hasClass("e-templatecell"))&&i._focusTreeGridElement(),e=i.getIndexByRow(u.closest("tr")),f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row){if(i._checkboxSelection&&(n("#"+i._id+"EditForm").length==0||f.editSettings.beginEditAction=="click")&&i.editFormValidate()){var s=i.model.currentViewData[e],b=a.indexOf(s),tt=!1;e==-1||i._rowSelectingEventTrigger(this.selectedRowIndex(),e)||(u.hasClass("e-checkbox")&&(tt=!0),i.selectRows(b,null,tt),i._cancelSaveTools(),i._rowSelectedEventTrigger(b))}f.selectionSettings.selectionType==r.TreeGrid.SelectionType.Multiple&&(t.ctrlKey&&(i._multiSelectCtrlRequest=!0),t.shiftKey&&(e=i.getIndexByRow(u.closest("tr")),s=f.currentViewData[e],e=a.indexOf(s),i._multiSelectShiftRequest=!0,i._rowSelectingEventTrigger(this.selectedRowIndex(),e)||(i.getRows()&&i._prevSelectedItem!=null?i.getExpandStatus(i._prevSelectedItem)?i.selectRows(a.indexOf(i._prevSelectedItem),e):i.selectRows(e):i.getRows()&&i._prevSelectedItem==null&&i.selectRows(0,e),i._cancelSaveTools(),i._rowSelectedEventTrigger(e))));i._checkboxSelection||i._multiSelectShiftRequest||n("#"+i._id+"EditForm").length!=0||l!=-1&&(s=f.currentViewData[l],e=a.indexOf(s),f.allowSelection&&!i._rowSelectingEventTrigger(this.selectedRowIndex(),e)&&(i.selectRows(e),i._cancelSaveTools(),i._rowSelectedEventTrigger(e)));i._multiSelectShiftRequest=!1}if(f.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Cell&&n("#"+i._id+"EditForm").length==0&&i._cellIndex!=-1&&e!=-1&&f.allowSelection){it=i._cellIndex>=i._frozenColumnsLength?1:0;targetRow=i._frozenColumnsLength>0?i.getRows()[it][e]:i.getRows()[e];var et=f.columns,s=f.currentViewData&&f.currentViewData[e],v=a.indexOf(s),rt=i._cellIndex>=i._frozenColumnsLength?i._cellIndex-i._frozenColumnsLength:i._cellIndex,ot=targetRow.childNodes[rt],st=i._previousSelectedCellDetails.rowIndex,ht=i._previousSelectedCellDetails.cellIndex,h=n(ot).closest("td"),p;if(i._focusingRowIndex=v,e!=-1){if(s.isSummaryRow)return;o={rowIndex:v,cellIndex:i._cellIndex,rowElement:targetRow,cellElement:h[0]};c={rowIndex:v,cellIndex:i._cellIndex,cellElement:h[0],data:s};!i._cellSelectingEventTrigger(o)&&et[rt].allowCellSelection&&(f.selectionSettings.selectionType=="multiple"&&(t.ctrlKey||t.shiftKey)?t.ctrlKey?(p=r.browserInfo().name=="msie"&&r.browserInfo().version<9?i._getCellIndex(i._selectedCellDetails,"cellElement").indexOf(h[0]):i._selectedCellDetails.map(function(n){return n.cellElement}).indexOf(h[0]),p==-1?(n(h[0]).addClass("selectingcell"),i._selectedCellDetails.push(c),f.selectedCellIndexes.push({rowIndex:c.rowIndex,cellIndex:c.cellIndex}),i._cellSelectedEventTrigger(o,i._previousSelectedCellDetails)):(n(h[0]).removeClass("selectingcell"),i._selectedCellDetails.splice(p,1),f.selectedCellIndexes.splice(p,1))):t.shiftKey&&(o={rowIndex:v,cellIndex:i._cellIndex},i._shiftKeySelectCells(o),i._rowIndexOfLastSelectedCell=v,i._focusingRowIndex=i._shiftKeyFirstElementDetails.firstElementRowIndex):(i._selectedCellDetails=[],f.selectedCellIndexes=[],n("#"+i._id).find(".selectingcell").removeClass("selectingcell"),n(h[0]).addClass("selectingcell"),i._selectedCellDetails.push(c),f.selectedCellIndexes.push({rowIndex:c.rowIndex,cellIndex:c.cellIndex}),i._cellSelectedEventTrigger(o,i._previousSelectedCellDetails),i._shiftKeyFirstElementDetails={firstElementRowIndex:-1,firstElementCellIndex:-1},i._updateSecondRowIndexBy=1),t.shiftKey||(i._previousSelectedCellDetails={rowElement:targetRow,cellElement:h[0],cellIndex:o.cellIndex,rowIndex:v},i._rowIndexOfLastSelectedCell=i._focusingRowIndex,i._isShiftKeyNavigation=!1));i._cancelSaveTools();i._lastSelectedCellIndex=i._cellIndex}}i._isTouchTrigger&&i.model.allowSelection&&this.model.selectionSettings.selectionType=="multiple"&&!i.model.isFromGantt&&(i._isTouchTrigger&&this._multiSelectPopup!=null&&!this._multiSelectPopup.is(":visible")&&this._multiSelectPopup.find(".e-rowselect").hasClass("e-spanclicked")&&this._multiSelectPopup.show(),i._isTouchTrigger&&this._multiSelectPopup!=null&&!this._multiSelectPopup.find(".e-rowselect").hasClass("e-spanclicked")&&(u.hasClass("e-detailsrowcell")||u.parent("td").hasClass("e-detailsrowcell")||u.closest("tr").hasClass("e-detailsrow")||(this._multiSelectPopup.removeAttr("style"),d=u.closest(".e-rowcell").offset(),this._multiSelectPopup.offset({top:0,left:0}).offset({left:d.left+(u.closest(".e-rowcell").outerWidth()/2-this._multiSelectPopup.width()/2),top:d.top-this._multiSelectPopup.outerHeight()-10}).show())),i._isTouchTrigger=!1)}(u.hasClass("e-detailsrowcell")||u.parent("td").hasClass("e-detailsrowcell"))&&!u.closest("tr").hasClass("e-detailsrow")&&(t.ctrlKey||t.shiftKey||(ut=n("#"+this._id+"EditForm").length>0?this.editFormValidate()?!0:!1:!0,i._isRowEdit?this.saveRow():ut&&i._detailsExpandCollapse(u)));i._isRowEdit&&u.focus();u.closest("#"+i._id+"_ColumnMenu").hasClass("e-columnmenu")||i._clearColumnMenu();f.editSettings.beginEditAction!="click"||u.closest("#"+i._id+"EditForm").length!=0||i._isShiftKeyNavigation||i._isEmptyRowDeleted||i._editdblClickHandler(t);i._isEmptyRowDeleted=!1}},selectAllRows:function(t){var u=this,e=u.model,s=-1,i=u._flatFilteredRecords.length>0?u._flatFilteredRecords:e.flatRecords,c=u.getUpdatedRecords(),o=0,f,h;if(e.selectionSettings.enableSelectAll||u._isFromSetmodel){if(e.showSummaryRow&&(i=u._spliceSummaryRows(i)),!r.isNullOrUndefined(t)){for(t||(i=u._flatFilteredRecords.length>0?u._flatFilteredRecords:n.extend([],e.selectedItems)),f=0;f<i.length;f++)if(t){if(i[f].checkboxState=="checked")continue;i[f].checkboxState="checked";e.selectedItems.push(i[f]);n("#"+this._id+"_checkbox"+i[f].ejRowId).removeClass("e-stop").addClass("e-checkmark");n("#"+this._id+"_checkbox"+i[f].ejRowId).parent("span").removeAttr("class").addClass("e-chk-act")}else s=e.selectedItems.indexOf(i[f]),s>-1&&(i[f].checkboxState="unchecked",e.selectedItems.splice(s,1),n("#"+this._id+"_checkbox"+i[f].ejRowId).removeClass("e-checkmark"),n("#"+this._id+"_checkbox"+i[f].ejRowId).parent("span").removeAttr("class").addClass("e-chk-inact"),(e.selectionSettings.enableHierarchySelection||u._isFromSetmodel)&&u._updateParentSelection(i[f]));u._cancelSaveTools()}u._flatFilteredRecords.length>0&&e.selectedItems.length>0?(h=u._flatFilteredRecords.filter(function(n){return n.checkboxState=="checked"}),o=h.length):o=e.selectedItems.length;o>0?o!=i.length?(n("#"+this._id+"_headerCheckbox").removeClass("e-checkmark").addClass("e-stop"),n("#"+this._id+"_headerCheckbox").parent("span").removeAttr("class").addClass("e-chk-indeter")):(n("#"+this._id+"_headerCheckbox").removeClass("e-stop").addClass("e-checkmark"),n("#"+this._id+"_headerCheckbox").parent("span").removeAttr("class").addClass("e-chk-act")):(n("#"+this._id+"_headerCheckbox").removeClass("e-stop e-checkmark"),n("#"+this._id+"_headerCheckbox").parent("span").removeAttr("class").addClass("e-chk-inact"))}},_updateSelectedItems:function(t,i){var u=this,r=u.model;selectedRowIndex=-1;recordIndex=-1;updatedRecords=u.getUpdatedRecords();recordIndex=updatedRecords.indexOf(t);t.checkboxState=i;selectedRowIndex=n.inArray(t,r.selectedItems);t.checkboxState=="unchecked"?(selectedRowIndex!=-1&&r.selectedItems.splice(selectedRowIndex,1),recordIndex>-1&&(n("#"+this._id+"_checkbox"+t.ejRowId).removeClass("e-checkmark e-stop"),n("#"+this._id+"_checkbox"+t.ejRowId).parent("span").removeAttr("class").addClass("e-chk-inact"))):t.checkboxState=="checked"&&(selectedRowIndex==-1&&r.selectedItems.push(t),recordIndex>-1&&(n("#"+this._id+"_checkbox"+t.ejRowId).removeClass("e-stop").addClass("e-checkmark"),n("#"+this._id+"_checkbox"+t.ejRowId).parent("span").removeAttr("class").addClass("e-chk-act")))},_traverseSelection:function(n,t,i){var f=this,e=0,r,o=this.model,s,u;if(f._updateSelectedItems(n,t),!i&&n.parentItem&&o.selectionSettings.enableHierarchySelection&&f._updateParentSelection(n.parentItem),n.hasChildRecords&&o.selectionSettings.enableHierarchySelection)for(r=n.childRecords,f._flatFilteredRecords.length>0&&(s=r.filter(function(n){return f._flatFilteredRecords.indexOf(n)>-1}),r=s),e=r.length,u=0;u<e;u++)r[u].hasChildRecords?f._traverseSelection(r[u],t,!0):r[u].isSummaryRow||f._updateSelectedItems(r[u],t)},_updateParentSelection:function(t){var u=this,e=0,i=[],o,f,r;t&&t.childRecords&&(i=u._spliceSummaryRows(t.childRecords));u._flatFilteredRecords.length>0&&model.selectionSettings.enableHierarchySelection&&(o=i.filter(function(n){return u._flatFilteredRecords.indexOf(n)>-1}),i=o);e=i&&i.length;callMe=!1;f=i.filter(function(n){return n.checkboxState=="indeterminate"});r=i.filter(function(n){return n.checkboxState=="checked"});f.length>0||r.length>0&&r.length!=e?(t.checkboxState=="checked"?(this._updateSelectedItems(t,"unchecked"),callMe=!0):t.checkboxState=="unchecked"&&(callMe=!0),callMe&&(n("#"+this._id+"_checkbox"+t.ejRowId).addClass("e-stop"),n("#"+this._id+"_checkbox"+t.ejRowId).parent("span").removeAttr("class").addClass("e-chk-indeter"),t.checkboxState="indeterminate",t.parentItem&&this._updateParentSelection(t.parentItem))):r.length==0&&f.length==0?(n("#"+this._id+"_checkbox"+t.ejRowId).removeClass("e-stop e-checkmark").parent("span").removeClass("e-chk-indeter"),t.checkboxState=="checked"?this._updateSelectedItems(t,"unchecked"):t.checkboxState="unchecked",t.parentItem&&this._updateParentSelection(t.parentItem)):(t.checkboxState="checked",this._updateSelectedItems(t,"checked"),t.parentItem&&this._updateParentSelection(t.parentItem))},_removeInnerDetailRows:function(t,i){var f=n(".e-detailscellwrapperfly"),s=f.length,u=0,h=!1,e;for(u;u<s;u++)if(n.contains(f[u],t[0])||t==f[u]){h=!0;break}e=!1;r.isNullOrUndefined(f[u])&&(u=f.index(n("#"+this._id+"detailscellwrapper")),e=!0);var c=e?"":",",l=n(f[u]).attr("parentTreeGridIds"),o=n("[parentTreeGridIds$='"+c+l+"']"),a=o.length;this._triggerDetailRowHideEvent(o,i)},_triggerDetailRowHideEvent:function(t,i){var h=this,o=this.model,f=t.length,r=0,u;if(f>0&&n("#"+this._id+"detailscellwrapper").length>0){var c=n("#"+this._id+"detailscellwrapper"),s=o.selectedItem,e={};if(e.rowData=s,!this._trigger("detailsHidden",e)||i)for(r;r<f;r++)u=n(t[r]).attr("id").replace("detailscellwrapper",""),n("#"+u).find(".e-detailsrowexpand").removeClass("e-detailsrowexpand").addClass("e-detailsrowcollapse"),n("#"+u).find(".e-detailsinfoiconhide").removeClass("e-detailsinfoiconhide").addClass("e-detailsinfoiconshow"),n(t[r]).remove()}},_removeDetailsRow:function(t,i){var y=this.model,u,e,h;if(t){if(u=n(t.target),e=u,u.parent("td").hasClass("e-detailsrowcell")&&(e=u.parent("td")),u.closest(".e-popup").length==0&&u[0]!=n("html").get(0)){var o=n(".e-detailscellwrapperfly"),c=o.length,f=0,s=!1;for(f;f<c;f++)if(n.contains(o[f],u[0])||u[0]==o[f]){s=!0;break}if(u.hasClass("e-detailscellwrapperfly")||e.hasClass("e-detailsrowexpand")||e.hasClass("e-detailsrowcollapse")||s||this._removeInnerDetailRows(n("#"+this._id+"detailscellwrapper"),i),u.hasClass("e-detailscellwrapperfly")||e.hasClass("e-detailsrowcollapse")||!e.hasClass("e-detailsrowexpand")&&s){h=!1;r.isNullOrUndefined(o[f])&&(f=o.index(n("#"+this._id+"detailscellwrapper")),h=!0);var l=h?"":",",a=n(o[f]).attr("parentTreeGridIds"),v=n("[parentTreeGridIds$='"+l+a+"']");this._triggerDetailRowHideEvent(v,i)}}}else n("#"+this._id+"detailscellwrapper").length>0&&this._removeInnerDetailRows(n("#"+this._id+"detailscellwrapper")[0],i),this._triggerDetailRowHideEvent(n("#"+this._id+"detailscellwrapper"),i)},showHideDetailsRow:function(t){var u=this,i=this.model,e,f;this.editFormValidate()&&(i.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());i.showDetailsRow&&i.detailsTemplate&&i.showDetailsRowInfoColumn&&!r.isNullOrUndefined(t)&&t<=i.updatedRecords.length&&u.getExpandStatus(i.updatedRecords[t])&&(t!=this.selectedRowIndex()&&t!=-1&&n.inArray(t,u._selectedRowsIndexes==-1)&&i.allowSelection&&i.updatedRecords.length>t&&(u._rowSelectingEventTrigger(this.selectedRowIndex(),t)||(u.selectRows(t),u._rowSelectedEventTrigger(t))),this.updateScrollBar(t),e=n(r.TreeGrid.getRowByIndex(u,t)),e.length>0&&i.updatedRecords[t]&&u.getExpandStatus(i.updatedRecords[t])&&(f=n(e).find(".e-detailsrowcell"),n(f).length>0&&n(f).hasClass("e-detailsrowcell")&&(this.element.find(".e-detailsrowexpand")[0]!=f[0]&&this._removeDetailsRow(),this._detailsExpandCollapse(n(f)))))},_detailsExpandCollapse:function(t){var i=this,b=this.model,s,l,k,e,o,h,g,p,nt,w,c,u;if(t.parent("td").hasClass("e-detailsrowcell")&&(t=t.parent("td")),s=t.closest("tr"),l=s.find(".e-detailsrowcell"),l.hasClass("e-detailsrowcollapse")){if(k=this.getIndexByRow(s),e=this.model.currentViewData[k],r.isNullOrUndefined(e)||e.isSummaryRow)return;for(var a=this.getOffsetRect(s[0]),tt=n(n.render[i._id+"_detailRowTemplate"](e)),f=n(tt).find(".e-detailscellwrapper").attr({id:this._id+"detailscellwrapper"}),it=i._gridWidth-(i.element.find(".e-scrollcss").length>0?18:0)-2,v=this.element.parents().filter(".e-detailscellwrapperfly"),d=this._id,y="";v.length>0;)y=v.attr("id").replace("detailscellwrapper",""),d+=","+y,v=n("#"+y).parents().filter(".e-detailscellwrapperfly");f.attr("parentTreeGridIds",d);o=this.getOffsetRect(i._$gridContent[0]);o.bottom=o.top+i._$gridContent[0].offsetHeight;h=a.top+s[0].offsetHeight;g=h+b.detailsRowHeight;(h>o.bottom||g>o.bottom)&&(p=a.top-b.detailsRowHeight,p>o.top&&(h=p));f.removeClass("e-detailscellwrapper").addClass("e-detailscellwrapperfly");nt=i.getScrollElement().ejScroller("isHScroll")?i.getScrollElement().ejScroller("option","scrollLeft"):0;w=0;this._frozenColumnsLength>0&&(w=n(this.element).find("#e-frozencontentdiv"+this._id).width());f.css({top:h,left:a.left+nt-w,"z-index":i.getMaxZIndex()+1,position:"absolute",width:it}).appendTo(this.element);this._trigger("refresh");c={};c.detailsElement=f;c.data=e;c.rowIndex=this.selectedRowIndex();this._trigger("detailsDataBound",c);u={};u.detailsElement=f;u.data=e;u.rowIndex=this.selectedRowIndex();u.appendTarget=null;this._trigger("detailsShown",u)?this._removeInnerDetailRows(t):(l.find(".e-detailsinfoiconshow").removeClass("e-detailsinfoiconshow").addClass("e-detailsinfoiconhide"),l.removeClass("e-detailsrowcollapse").addClass("e-detailsrowexpand"),u.appendTarget&&(n(f).css({top:"auto",left:"auto",position:"auto"}),n(f).detach().appendTo(n("#"+u.appendTarget))))}else this._removeInnerDetailRows(t)},_onHeaderClick:function(t){var u=this,f=u.model,i,e,h,c,o,s;if(u._cellMouseLeave(),u._headerMouseLeave(),u._clearContextMenu(),this._removeDetailsRow(),n(t.target).is(".e-ascending, .e-descending")&&(t.target=t.target.parentNode),i=n(t.target),o=!0,u.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive"),u._mouseDragged&&f.allowColumnReordering&&(o=!1),u._checkboxSelection&&f.allowSelection&&f.selectionSettings.enableSelectAll&&i.hasClass("e-headerCheckbox")&&(u.selectAllRows(!i.hasClass("e-checkmark")&&!i.hasClass("e-stop")),o=!1),i.closest(".e-headercelldiv")&&!i.hasClass("e-columnmenu-icon")&&!i.hasClass("e-column-filter-icon")&&!i.hasClass("e-column-filtered-icon"))if(e=i.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),!o||r.isNullOrUndefined(e)&&r.isNullOrUndefined(this.getColumnByField(e))||this.getColumnByField(e).allowSorting==!1){if((f.isEdit||this._isRowEdit)&&this.editFormValidate()&&(f.isEdit?this.saveCell():this._isRowEdit&&this.saveRow()),!i.hasClass("e-checkbox"))return!1}else o&&f.allowSorting&&(c=this.getColumnByField(e),h=i.closest(".e-headercell").find("span").hasClass("e-ascending")?r.sortOrder.Descending:r.sortOrder.Ascending,f.allowMultiSorting&&t.ctrlKey&&(u._multiSortRequest=!0),u._isRefreshAddedRecord=!1,f.isFromGantt?u.sortColumn(c.mappingName,h):u.sortColumn(c.field,h),u.model.isFromGantt&&this.selectedRowIndex()>=0&&(s={},s.data=u.model.selectedItem,s.target="ejTreeGrid",s.recordIndex=this.selectedRowIndex(),u._trigger("rowSelected",s)));return i.hasClass("e-column-filter-icon")||i.hasClass("e-column-filtered-icon")?(i.data("isClicked")?(u._clearColumnMenu(),i.data("isClicked",!1)):(u._updateFilterMenuList(t),n(".e-filtericon").data("isClicked",!1),i.data("isClicked",!0)),this._addRemoveAnimateClass(i)):i.hasClass("e-columnmenu-icon")?(i.data("isClicked")?(u._clearColumnMenu(),i.data("isClicked",!1)):(u._renderColumnMenu(t),n(".e-columnicon").data("isClicked",!1),i.data("isClicked",!0)),this._addRemoveAnimateClass(i)):u._clearColumnMenu(),i.hasClass("e-checkbox")?!0:!1},_triggerColumnResize:function(t,i,u){var f=this,l=f.model,a=f.getHeaderTable().find(".e-columnheader"),v=a.find(".e-headercell"),o=f._cellIndex,y,w=n(f._target),c,s,p,e,h;return col=[],t=="columnResizeStart"&&(f._orgX=i,o=f._currentCell=f._cellIndex=f.getCellIndex(u)),f._currentCell!=-1?(c=v[f._currentCell],s=c.offsetWidth,t=="columnResizeStart"?(e={},e={columnIndex:o,column:f.model.columns[o],target:n(c),oldWidth:s},f._trigger("columnResizeStart",e)):t=="columnResizeEnd"?(p=a.find(".e-headercell").not(".e-detailheadercell").filter(":visible"),h=i-f._orgX,f._newWidth=s+h,f.__oldWidth=s,e={},e={columnIndex:o,column:l.columns[o],target:n(c),oldWidth:s,newWidth:f._newWidth,extra:h},f._trigger("columnResizeEnd",e)):(this.model.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||this.model.isFromGantt?!this.model.isFromGantt&&this.model.columnResizeSettings.columnResizeMode==r.TreeGrid.ColumnResizeMode.NextColumn&&this.model.showTotalSummary&&this._colgroupRefresh():this._updateTableWidth(),e={},h=i-f._orgX,y=s+h,e={columnIndex:o,column:l.columns[o],oldWidth:f.__oldWidth,newWidth:f._newWidth},f._trigger("columnResized",e))):void 0},_headerMouseDown:function(t){var i=this,u=i._getCoordinate(t),r,f,e=i.model,o,s,h,c,l,a;if(i._cellMouseLeave(),i._headerMouseLeave(),t.type=="touchstart"?(r=i._getElementByPosition(u.pageX,u.pageY),i._on(i.element,"touchmove",i._mouseMove)):r=n(t.target),i._on(n(document),"mouseup touchend",i._headerMouseUp),i._on(i.element,"contextmenu",this._preventContextMenu),e.allowColumnReordering&&(r.closest(".e-columnheader").length>0&&i.dragColumn(t),t.type=="touchstart"&&(i._dragColumnTooltipTimer=window.setTimeout(function(){i._touchstart=!1;i._dragTooltip||t.type!="touchstart"||(i.dragColumnToolTip(t),i._dragTooltip&&i._on(i.element,"touchmove",i.dragColumnToolTip))},550))),i.model.allowColumnResize){if(e.isFromGantt?i._on(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._on(i.element,"mouseup touchend",i._mouseUp),f=r.closest("tr"),this._target=r,o=u.pageX,s=u.pageY,navigator.userAgent.indexOf("WebKit")!=-1&&(o=u.pageX,s=u.pageY-document.body.scrollTop),f.length>0&&f[0].style.cursor=="col-resize"&&!r.hasClass("e-columnicon")&&(r.is(".e-headercelldiv")&&(r=n(r[0].parentNode)),this._target=r,i._frozenColumnsLength>0&&(c=r.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),l=i.getColumnByField(c),h=i._frozenColumns.indexOf(l)>-1?!0:!1),h||this._triggerColumnResize("columnResizeStart",o,t)))return;i._resizer._mouseDown(t)}n(t.target).hasClass("headercelldiv")&&n(t.target).hasClass("headercell")&&(a=n(t.target).hasClass("headercelldiv")?n(t.target).parent():n(t.target),e.headerEffects&&a.addClass("headercellactive"))},_headerMouseUp:function(t){var i=this,f=i.model,u={},e=i._getCoordinate(t),o,s;t.type=="touchend"?(o=i._getElementByPosition(e.pageX,e.pageY),i._off(i.element,"touchmove",i._mouseMove)):o=n(t.target);i._off(n(document),"mouseup touchend",i._headerMouseUp);i.model.allowColumnResize&&(f.isFromGantt?i._off(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._off(i.element,"mouseup touchend",i._mouseUp));f.allowColumnReordering&&(window.clearTimeout(this._dragColumnTooltipTimer),this._dragColumnTooltipTimer=null,i._off(i.element,"mousemove touchmove",i.dragColumnToolTip),n(i._reordervline).remove(),n(i._dragmouseOverTooltip).remove(),(i._posx!=e.pageX||i._posy!=e.pageY)&&(i._mouseDragged=!0),f.allowColumnReordering&&o.closest(".e-headercell").length>0&&i._headerDragStatus=="mousemove"&&(s=f.columns,u.targetColumn=s[i._currentIndex],u.targetColumnIndex=i._currentIndex,u.draggedColumn=i._draggedColumn,u.draggedColumnIndex=s.indexOf(i._draggedColumn),r.isNullOrUndefined(u.targetColumn.nonColumn)&&!r.isNullOrUndefined(u.targetColumnIndex)&&u.targetColumnIndex!=u.draggedColumnIndex&&(i._trigger("columnDrop",u),u.cancel||i.reorderColumn(u.draggedColumn.field,u.targetColumnIndex))));i._resetHeaderPrivateProperties()},_resetHeaderPrivateProperties:function(){_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown));_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp));var n=this,t=n.model;n._draggedColumn=null;n._dragMouseDown=!1;n._dragTooltip=!1;n._headerDragStatus="";_timerDragDown=null;_timerDragUp=null;n._currentIndex=null;n._dragmouseOverTooltip=null},_contentMouseDown:function(t){var u=n(t.target),i=this,f=i.model,e=i._getCoordinate(t),o=u.closest(".e-treegrid").attr("id");if(i._contentPageY=e.pageY,i._contentPageX=e.pageX,i._on(n(document),"mouseup touchend",i._mouseupHandler),t.type=="touchstart"&&(i._isTouchEvent=!0,i._isTouchTrigger=!0),n("#"+o+"_selectionpopup").is(":visible")&&(n("#"+o+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")?(t.ctrlKey=!0,i.model.selectionSettings.selectionMode==r.TreeGrid.SelectionMode.Row&&(i._multiSelectCtrlRequest=!0)):(t.ctrlKey=!1,i._multiSelectCtrlRequest=!1)),i.model.isFromGantt||(r.isTouchDevice()?i._on(i.element,"taphold",i._contextMenuAction):i._on(i.element,"contextmenu",i._contextMenuAction)),!(u.hasClass("e-vhandle")||u.hasClass("e-vscrollbar")||u.hasClass("e-vup")||u.hasClass("e-vdown")||u.hasClass("e-vhandlespace")||u.hasClass("e-hhandle")||u.hasClass("e-hscrollbar")||u.hasClass("e-hdown")||u.hasClass("e-hhandlespace")||u.closest(".e-editedcell").length>0)){if(i._mouseDown=!0,r.isTouchDevice()&&t.preventDefault(),f.allowDragAndDrop&&(u.closest(".e-treegridrows").length>0||u.closest(".e-templatecell").length>0)&&(t.type=="touchstart"?i._dragTooltipTimer=window.setTimeout(function(){i.dragRecord(t);i._multiSelectPopup&&i._multiSelectPopup.is(":visible")&&i._dragTooltip&&i._clearMultiSelectPopup()},550):i.dragRecord(t)),t.ctrlKey||t.shiftKey||t.which==2||t.which==3)return!0;f.isFromGantt||t.type=="touchstart"&&i._on(i.element,"touchmove","#"+i._id+"e-gridcontent",i._touchScroll)}},_touchScroll:function(t){var i=this,l=i.model,r=i._getCoordinate(t),u,o,s,h=i._contentPageX,c=i._contentPageY,f=r.pageX,e=r.pageY;i._isTouchTrigger=!1;dx=f-h;dy=e-c;t.type=="touchmove"&&t.preventDefault();i._mouseDown&&!i._dragMouseDown&&(window.clearTimeout(this._dragTooltipTimer),this._dragTooltipTimer=null,window.clearTimeout(this._dragColumnTooltipTimer),this._dragColumnTooltipTimer=null,u=t.type=="touchmove"?i._getElementByPosition(r.pageX,r.pageY):n(t.target),!l.isFromGantt&&u.closest("div").find(".e-content")&&(s=c<e?-Math.abs(dy):Math.abs(dy),o=h<f?-Math.abs(dx):Math.abs(dx),i._contentPageX=f,i._contentPageY=e,i._updateScrollPosition(u,o,s)))},_updateScrollPosition:function(n,t,i){var r=this,s=r.getScrollElement().ejScroller("option","scrollTop"),h=r.getScrollElement().ejScroller("option","scrollLeft"),u=h+t,f=s+i,e=r.isVScroll()?r.getMaxScrollHeight():null,o=r.getScrollElement().ejScroller("isHScroll")?r.getScrollElement().find(".e-content").get(0).scrollWidth:null;e&&(f=e<f?e:f<0?0:f,(f>0&&s>0||f<e&&s<e)&&(r._$gridContent.scrollTop(0),r.getScrollElement().ejScroller("scrollY",f,!0)));o&&(u=o<u?o:u<0?0:u,(u>0&&h>0||u<o&&h<o)&&(r._$gridContent.scrollLeft(0),r.getScrollElement().ejScroller("scrollX",u,!0)))},_mouseMove:function(t){var i=this,r=this.model;window.clearTimeout(this._dragColumnTooltipTimer);this._dragColumnTooltipTimer=null;i.model.allowColumnResize&&i._headerDragStatus.length==0&&(i._resizer._mouseMove(t),i._resizer._expand&&i._cancelEditState(),n(t.target).parent().css("cursor")!=="col-resize"&&((r.allowSorting||r.showColumnChooser||!r.showColumnChooser&&r.allowFiltering&&r.filterSettings.filterType=="menu")&&!n(t.target).closest("th").hasClass("e-detailheadercell")?i.getHeaderTable().find(".e-columnheader").css({cursor:"pointer"}):i.getHeaderTable().find(".e-columnheader").css({cursor:"default"})))},_mouseUp:function(t){var i=this,u=i.model,f,e;if(i._headerDragStatus!="mousemove"&&u.allowColumnResize)if((n(t.target).hasClass("e-headercelldiv")||n(t.target).hasClass("e-reSizeColbg"))&&(i._focusTreeGridElement(),i._clearColumnMenu()),n(t.target).hasClass("e-reSizeColbg")||n(t.target).closest(".e-gridheader").length>0){if(i._resizer._expand){if(f=t.clientX,e=t.clientY,navigator.userAgent.indexOf("WebKit")!=-1&&(f=t.pageX,e=t.pageY),!r.isNullOrUndefined(i._currentCell)&&this._triggerColumnResize("columnResizeEnd",f,t)){this.element.find(".e-reSizeColbg").remove();i._resizer._expand=!1;u.isFromGantt?i._off(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._off(i.element,"mouseup touchend",i._mouseUp);return}if(i._resizer._mouseUp(t),!r.isNullOrUndefined(i._currentCell)&&i._currentCell>=0&&i._currentCell<u.columns.length&&u.columns[i._currentCell]&&(u.columns[i._currentCell].width=i._resizer._newWidth),!r.isNullOrUndefined(i._currentCell)&&this._triggerColumnResize("columnResized",f,t))return;i.getScrollElement().ejScroller("refresh");i._updateHeaderScrollLeft();i._updateScrollCss()}}else this.element.find(".e-reSizeColbg").remove(),i._resizer._expand=!1,u.isFromGantt?i._off(i.element.closest(".e-gantt"),"mouseup touchend",i._mouseUp):i._off(i.element,"mouseup touchend",i._mouseUp)},_resizeFilteringElements:function(){var t=this,i,u,n;if(t.model.allowFiltering)for(i={},u=t.model.columns.length,r.TreeGrid.Actions.Filter="filtering",i.requestType=r.TreeGrid.Actions.Filter,n=0;n<u;n++)t.model.columns[n].width=t.columnsWidthCollection[n],i.fieldname=t.model.columns[n].field,this._filteringElements(i)},_enableEditingEvents:function(){var n=this,t=n.model;t.editSettings.allowEditing?r.isTouchDevice()?(n._off(n.element,"doubletap ",".e-gridcontent",n._editdblClickHandler),n._on(n.element,"doubletap ",".e-gridcontent",n._editdblClickHandler)):(n._off(n.element,"dblclick ",".e-gridcontent",n._editdblClickHandler),n._on(n.element,"dblclick ",".e-gridcontent",n._editdblClickHandler)):r.isTouchDevice()?n._off(n.element,"doubletap ",".e-gridcontent",n._editdblClickHandler):n._off(n.element,"dblclick ",".e-gridcontent",n._editdblClickHandler)},_saveCellHandler:function(t){var i=n(t.target),u=this,f=u.model,e;if(f.isFromGantt&&i.closest("tr").length){var o=i.closest("tr"),c=u.getRows(),s=this.getIndexByRow(o),h=f.currentViewData&&f.currentViewData[s];e=f.updatedRecords.indexOf(h)}i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vdown")||i.hasClass("e-vhandlespace")||i.hasClass("e-vscroll")||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hup")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||i.hasClass("e-hscroll")||((i.closest(".e-gridcontent").length>0||i.hasClass(".e-gridcontent"))&&(u._isRowEdit&&this.editFormValidate()?i.closest("form#"+u._id+"EditForm").length==0&&i.closest("form#"+u._id+"EditFrozenForm").length==0&&n("#"+u._id+"EditForm").length>0&&u.saveRow():i.closest(".e-popup").length==0&&i.closest(".e-rowcell").find("#"+u._id+"EditForm").length==0&&i.closest("form#"+u._id+"EditFrozenForm").length==0&&n("#"+u._id+"EditForm").length>0&&this.editFormValidate()&&u.saveCell()),f.selectedMode!="row"||!f.isFromGantt||!f.updatedRecords.length||r.isNullOrUndefined(e)||i.hasClass("e-treegridexpand")||i.hasClass("e-treegridcollapse")||this.selectedRowIndex()==e||u._rowSelectingEventTrigger(this.selectedRowIndex(),e)||(f.allowSelection&&u.selectRows(e),u._rowSelectedEventTrigger(e)))},_contextMenuAction:function(t){var i=this,r,f=i.model,u=i._getCoordinate(t);if(r=t.type=="taphold"?i._getElementByPosition(u.pageX,u.pageY):n(t.target),t.preventDefault(),f.contextMenuSettings.showContextMenu&&r.closest(".e-gridcontent").length>0){if(t.which!=3||i._isTouchEvent)return i._contextMenuHandler=!0,!0;i._rightClick(t)}else return t.preventDefault(),t.stopPropagation(),!1},_rightClick:function(t){var i=this,e=i.model,u=n(t.target),l=u[0].parentNode,h,f,o,c={},s=!1,a=i.getUpdatedRecords();if(u.closest(".e-treegrid").attr("id")!==this._id)return!1;if(e.selectionSettings.selectionMode=="cell"&&e.editSettings.editMode!="dialogEditing"&&(e.editSettings.editMode="cellEditing"),i.model.contextMenuSettings.showContextMenu){if(i._clearContextMenu(),this._removeDetailsRow(),i.disableTooltip(),u.hasClass("e-summaryrowcell")||u.hasClass("e-summarytitle"))return;(u.hasClass("e-cell")||u.hasClass("e-treegridexpand"))&&(l=u.closest("tr"));h=u.closest("tr");f=i.getIndexByRow(h);i.model.currentViewData=i.getCurrentViewData();o=i.model.currentViewData[f];f=a.indexOf(o);c.data=o;c.recordIndex=f;e.isEdit?s=u.closest(".e-rowcell").find("form#"+i._id+"EditForm").length>0||u.closest(".e-rowcell").find("form#"+i._id+"EditFrozenForm").length>0:this._isRowEdit&&(s=u.closest(".e-rowedit").find("form#"+i._id+"EditForm").length>0||u.closest(".e-rowedit").find("form#"+i._id+"EditFrozenForm").length>0||u.closest(".e-addedrow").find("form#"+i._id+"EditForm").length>0||u.closest(".e-addedrow").find("form#"+i._id+"EditFrozenForm").length>0);!s&&i.editFormValidate()&&(e.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());i.dataSource()==null||i.dataSource().length==0||s||e.flatRecords.length==0?(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._subContextMenuItems=[],i._updateContextmenuOption(f,o),i._clearContextMenu(),i._contextMenuItems.length>0&&i._renderContextMenu(t,f,o,s)):o&&(t.preventDefault(),i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._subContextMenuItems=[],i._subContextMenuItems=i._getsubContextMenuItems(),i._updateContextmenuOption(f,o),i._clearContextMenu(),e.selectionSettings.selectionMode=="row"&&e.allowSelection&&!i._rowSelectingEventTrigger(this.selectedRowIndex(),f)&&(i.selectRows(f),i._rowSelectedEventTrigger(f)),e.selectionSettings.selectionMode=="cell"&&(selectCellIndex=i.getCellIndex(t),i.selectCells([{rowIndex:f,cellIndex:selectCellIndex}]),i._rowIndexOfLastSelectedCell=f),i._contextMenuItems.length>0&&i._renderContextMenu(t,f,o,s),i.editFormValidate()&&i._cancelSaveTools())}i._clearColumnMenu();i._contextMenuHandler=!1;!i.model.isFromGantt&&e.contextMenuSettings.showContextMenu&&(r.isTouchDevice()?i._off(i.element,"taphold",i._contextMenuAction):i._off(i.element,"contextmenu",i._contextMenuAction));return},_editdblClickHandler:function(t){var i=this,e=i.model,s=n("#"+i._id+"EditForm"),c={},f=n(t.target),a=f.closest("tr"),h,v=i._cellEditingDetails,o,l;if(e.readOnly==!0)return!0;if((updatedRecords=i.getUpdatedRecords(),!f.hasClass("e-vhandle")&&!f.hasClass("e-vscrollbar")&&!f.hasClass("e-vup")&&!f.hasClass("e-vdown")&&!f.hasClass("e-vhandlespace")&&!f.hasClass("e-treegridexpand")&&!f.hasClass("e-treegridcollapse"))&&!f.hasClass("e-hhandle")&&!f.hasClass("e-hscrollbar")&&!f.hasClass("e-hup")&&!f.hasClass("e-hdown")&&!f.hasClass("e-hhandlespace")&&!f.hasClass("e-summaryrowcell")&&!f.hasClass("e-footersummaryrowcell")&&!f.hasClass("e-summarytitle")&&!f.hasClass("e-lastsummaryrow")){if(f.closest(".e-treegrid").length&&f.closest(".e-treegrid").attr("id")!==this._id)return!1;if(f.hasClass("e-rowcell")||f.parent().hasClass("e-rowcell")||f.closest("td").hasClass("e-rowcell")||f.closest("td").hasClass("e-rowcell")&&f.hasClass("e-cell")){if(e.editSettings.editMode==="normal"&&e.editSettings.allowEditing&&(c.requestType=r.TreeGrid.Actions.BeginEdit,i._trigger("actionBegin",c)),i._cellEditingDetails.cancelSave){i._cellEditingDetails.cancelSave=!1;return}if(s.length===0&&i.getRows()!==null){if(e.editSettings.editMode.toLowerCase()=="cellediting"){if(i._focusTreeGridElement(),i._cellEditingDetails.columnIndex=i.getCellIndex(t),e.editSettings.beginEditAction!="click"&&(i._cellEditingDetails.rowIndex=i.getRowIndex(t)),h=e.currentViewData[i._cellEditingDetails.rowIndex],h.summaryRow)return;if(e.selectedItem=h,e.columns[v.columnIndex].allowEditing==!1)return;fieldName=i._cellEditingDetails.columnIndex>=0&&e.columns[i._cellEditingDetails.columnIndex].field;fieldName&&(i.updateScrollBar(),e.editSettings.allowEditing&&e.editSettings.editMode.toLowerCase()==r.TreeGrid.EditMode.CellEditing.toLowerCase()&&i.cellEdit(i._cellEditingDetails.rowIndex,fieldName))}else(e.editSettings.editMode.toLowerCase()=="rowediting"||e.editSettings.editMode.toLowerCase()=="dialogediting")&&(e.currentViewData=i.getCurrentViewData(),i.getCellIndex(t)!=-1&&i.getRowIndex(t)!=-1&&(i._cellEditingDetails.columnIndex=i.getCellIndex(t),o=i.getRowIndex(t),e.enableVirtualization&&(l=e.selectionSettings.selectionMode=="row"?e.selectedItem:e.updatedRecords[i._rowIndexOfLastSelectedCell],o=updatedRecords.indexOf(l)),i.model.editSettings.editMode.toLowerCase()=="dialogediting"?i._showTreeGridAddEditDialog(o):(i.updateScrollBar(),i._editRow(o,u,i._cellEditingDetails.columnIndex))));s=n("#"+i._id+"EditForm");s.length>0&&i._editAddTools();n.isFunction(n.validator)&&(i._initValidator(),i.setValidation())}i.model.allowSelection||a.find(".e-active").removeClass("e-active").removeClass("e-selectionbackground");i._clearContextMenu();this._removeDetailsRow()}}},_popupHide:function(t){var u=this,f=u.model.columns,o=null,c=null,s=null,h=t&&n(t).closest("td"),l,e;for(u.model.allowFiltering&&u.model.filterSettings.filterType=="filterbar"&&(h=t&&n(t).closest("td, th")),l=n("#"+u._id+"_ColumnMenu").length,l>0&&(r.isTouchDevice()||u._clearColumnMenu()),i=0;i<f.length;i++)o=null,f[i]&&(s=f[i].field.split(".").join(""),f[i].editType=="datepicker"||f[i].editType=="datetimepicker"?o=n("#"+u._id+s).data("ejDatePicker"):f[i].editType=="dropdownedit"&&(e=n("#"+u._id+s).data("ejDropDownList"),e&&n(h).find("#"+e._id).length==0&&e.hidePopup()),o&&n(h).find("#"+o._id).length==0&&o.hide(),(f[i].filterEditType=="datepicker"||f[i].filterEditType=="datetimepicker")&&(c=n("#"+u._id+"_"+s+"_filterbarcell").data("ejDatePicker"),c&&n(h).find("#"+c._id).length==0&&c.hide()),f[i].filterEditType=="dropdownedit"&&(e=n("#"+u._id+"_"+s+"_filterbarcell").data("ejDropDownList"),e&&n(h).find("#"+e._id).length==0&&e.hidePopup()))},_mouseWheel:function(n){var t=this,i=null,e=n;if(t._popupHide(),n=n.originalEvent,t.getScrollElement().height()>t._$gridContainer.height()){t.getScrollElement().ejScroller("scrollY",0,!0);return}if(n.wheelDelta?(i=-n.wheelDelta/120,window.opera&&parseFloat(window.opera.version,10)<10&&(i=-i)):n.detail&&(i=n.detail/3),!i)return!1;var u=t.getScrollElement().ejScroller("option","scrollTop"),r=u+i*57,f=this.model.isFromGantt?parseInt(t.model.updatedRecords.length*model.rowHeight)-(t._viewPortHeight-18):this.getMaxScrollHeight();if(r>f&&(r=f),r<0&&(r=0),u!=r)try{n.preventDefault?n.preventDefault():e.preventDefault()}catch(o){}return t.updateScrollTop(r),!0},_getCollapsedParentItem:function(n){var t=n.parentItem;return t?this.getExpandStatus(t)===!0?t:this._getCollapsedParentItem(t):null},updateScrollBar:function(n){var t=this,u=t.model,o=0,f,a,s=u.rowHeight+t._detailsRowHeight,v,h,e=t.getUpdatedRecords(),y,l;y=u.allowSelection?u.selectionSettings.selectionMode=="row"?this.selectedItem():e[t._rowIndexOfLastSelectedCell]:this.selectedItem();f=u.allowPaging?e:t.getExpandedRecords(e);a=n||n==0?f.indexOf(e[n]):f.indexOf(y);var i=a*s,w=i+u.rowHeight,c,p=t.getScrollElement().children(".e-content").length;c=p?t.getScrollElement().children(".e-content").scrollTop():t.getScrollElement().scrollTop();(t.getScrollElement().ejScroller("isHScroll")||t.element.find(".e-borderbox").length>0)&&(o=18);v=i<c;h=c+t._viewPortHeight-o<=w;(v||h)&&(i+t._viewPortHeight>f.length*s&&(i=f.length*s-t._viewPortHeight,h&&(i+=o)),l={requestType:r.TreeGrid.Actions.Scroll,delta:i},p?t.updateScrollTop(i):(t.getScrollElement().scrollTop(l.delta),t._completeAction(l)),u.enableVirtualization&&t._focusTreeGridElement())},_keyPressed:function(t,i){var u=this,f=this.model,ct,c,s=u.getUpdatedRecords(),ui,kt,v=f.allowPaging?s:u.getExpandedRecords(f.updatedRecords),ut,e,pt,b,a,fi,h,et,ci,ot,li,dt,ai,ei,wt,st,o,rt,lt,at,ht,nt,tt,vt,y,oi,si,yi,pi,d,yt,g,k,gt,hi,it,ft,ri,bt,w,l,p,ni;if(this._removeDetailsRow(),!f.allowKeyboardNavigation)return!1;if(this.model.editSettings.editMode=="dialogEditing"&&n(i).closest("#"+this._id+"_dialogEdit").length||(pt=!1,b=n(i),$form=n("#"+u._id+"EditForm"),t!="downArrow"&&t!="upArrow"&&t!="saveRequest"&&t!="moveCellLeft"&&t!="moveCellRight"&&t!="cancelRequest"&&b.prop("tagName")=="INPUT"))return!0;f.isFromGantt?(a=n("#"+u._id.replace("ejTreeGrid","")+"_ContextMenu"),fi=n("#"+u._id.replace("ejTreeGrid","")+"_SubContextMenu")):(a=n("#"+u._id+"_ContextMenu"),fi=n("#"+u._id+"_SubContextMenu"));h=n("#"+u._id+"_ColumnMenu");et=n("#"+u._id+"ccDiv_wrapper");u._columnMenuTarget&&(dt=n.trim(u._columnMenuTarget.prev("div.e-headercelldiv").attr("ej-mappingname")),o=u.getColumnByField(dt),o&&(o.filterEditType?(rt=o.filterEditType.indexOf("edit"),filtertype=o.filterEditType):(rt=o.editType.indexOf("edit"),filtertype=o.editType),rt!=-1?(ui=filtertype.slice(0,rt),kt=ui.charAt(0).toUpperCase()+ui.slice(1),ut=n("#"+u._id+"filter"+kt+"MenuDiv_wrapper")):(kt=filtertype.charAt(0).toUpperCase()+filtertype.slice(1),ut=n("#"+u._id+"filter"+kt+"MenuDiv_wrapper"))),li=!r.isNullOrUndefined(ut)&&ut.is(":visible"));ci=fi.css("visibility")=="visible"?!0:!1;ot=et.is(":visible");switch(t){case"saveRequest":if(a.length==0&&h.length==0)(u._isRowEdit||u.model.isEdit)&&(b.blur(),u._endEdit(),u._focusTreeGridElement()),f.filterSettings.filterBarMode=="onEnter"&&f.filterSettings.filterType=="filterbar"&&f.allowFiltering&&b.closest("th").hasClass("e-filterbarcell")&&u._filterBarHandler(i);else if(a.length)u._moveToNextMenuItem("save");else if(h.length&&(g=null,k=et.find("div.e-columnmenuselection"),ot?g=k.data("column"):(d=h.find("div.e-columnmenuselection"),d.length>0&&(g=d[0].id)),!r.isNullOrUndefined(g))){b=u._columnMenuTarget;dt=n.trim(b.prev("div.e-headercelldiv").attr("ej-mappingname"));o=u.getColumnByField(dt);switch(g){case u._id+"_SortAscendingChooser":u.model.allowMultiSorting&&(u._multiSortRequest=!0);f.isFromGantt?u.sortColumn(o.mappingName,r.sortOrder.Ascending):u.sortColumn(o.field,r.sortOrder.Ascending);u._multiSortRequest=!1;break;case u._id+"_SortDescendingChooser":u.model.allowMultiSorting&&(u._multiSortRequest=!0);f.isFromGantt?u.sortColumn(o.mappingName,r.sortOrder.Descending):u.sortColumn(o.field,r.sortOrder.Descending);u._multiSortRequest=!1;break;case u._id+"_FreezeColumnsChooser":o&&!n(u._id+"_FreezeColumnChooser").hasClass("e-disable")&&(u._checkboxSelection&&f.columns[0].nonColumn&&!f.columns[0].isFrozen&&(f.columns[0].isFrozen=!0),u.freezeColumn(o.field,!0));break;case u._id+"_UnfreezeColumnsChooser":o&&!n(u._id+"_UnfreezeColumnChooser").hasClass("e-disable")&&(u._checkboxSelection&&u._frozenColumnsLength==2&&f.columns[0].nonColumn&&f.columns[0].isFrozen&&(f.columns[0].isFrozen=!1),u.freezeColumn(o.field,!1));break;case u._id+"_FreezePrecedingColumnsChooser":o&&!n(u._id+"_FreezePrecedingColumnsChooser").hasClass("e-disable")&&u.freezePrecedingColumns(o.field);break;case u._id+"_ColumnLeftChooser":o&&!n(u._id+"_ColumnLeftChooser").hasClass("e-disable")&&u.insertColumnChooser(o,"left");break;case u._id+"_ColumnRightChooser":o&&!n(u._id+"_ColumnRightChooser").hasClass("e-disable")&&u.insertColumnChooser(o,"right");break;case u._id+"_DeleteColumnChooser":o&&!n(u._id+"_DeleteColumnChooser").hasClass("e-disable")&&(u._targetColumnIndex=f.columns.indexOf(o),u._updateConfirmDialog.ejDialog("open"),u._clearColumnMenu());break;case u._id+"_RenameColumnChooser":o&&!n(u._id+"_RenameColumnChooser").hasClass("e-disable")&&(u._targetColumnIndex=f.columns.indexOf(o),u._renderColumnRenameDialog(o),u._columnRenameDialog.ejDialog("open"),u._clearColumnMenu());break;case u._id+"_FilterChooser":o&&n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon")&&(ai=ut[0].id.substring(u._id.length,ut[0].id.indexOf("MenuDiv")),u._showFilterMenu(null,ai,null,null,null,null,null,null,o));break;case u._id+"_ColumnsChooser":o&&n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon")&&!u.model.isFromGantt&&u._adaptiveColumnChooser();break;default:k.find("span").hasClass("e-disable")||(gt=k.find("span").attr("aria-checked"),gt=="true"?u.hideColumn(g):u.showColumn(g))}}break;case"cancelRequest":a.length==0&&h.length==0?($form.length>0&&(st=f.editSettings.editMode,st.toLowerCase()=="cellediting"?u._isRowEdit?u.cancelRowEditCell():u.cancelEditCell():st.toLowerCase()=="rowediting"&&u.cancelRowEditCell(),u._cancelSaveTools()),u._focusTreeGridElement(),u._dragMouseDown==!0&&(n(u._dragmouseOverTooltip).remove(),n(".intend").find(".e-icon").css({display:"none"}),n(".intendparent").find(".e-icon").css({display:"none"}),u._dropCancel=!0,u._dragMouseDown=!1,u._dragTooltip=!1,u._headerDragStatus="",u._dragTargetItem&&u._dragTargetItem.hasChildRecords&&u._dragTargetItem.level==0&&(ei=r.TreeGrid.getRowByIndex(this,s.indexOf(u._dragTargetItem)),u._dragTargetItem?ei.find(".e-treegridexpand").css({display:"inline-block"}):ei.find(".e-treegridcollapse").css({display:"inline-block"})),u._off(u.element,"touchmove",".e-treegridrows, .e-templatecell",u.dragToolTip),u._off(u.element,"mousemove",".e-treegridrows, .e-templatecell",u.dragToolTip))):(u._clearContextMenu(),u._clearColumnMenu());break;case"editRecord":if(a.length==0&&h.length==0&&(f.selectionSettings.selectionMode=="cell"&&f.editSettings.editMode!="dialogEditing"&&(f.editSettings.editMode="cellEditing"),wt=f.editSettings,st=wt.editMode,f.readOnly==!1&&(wt.allowEditing&&f.selectedItems.length==1||wt.allowEditing&&f.selectionSettings.selectionMode=="cell"||wt.allowEditing&&f.selectedItem&&u._checkboxSelection)))if(st.toLowerCase()=="cellediting"||f.selectionSettings.selectionMode=="cell"){if(o=u.model.columns[u._cellIndex],r.isNullOrUndefined(o)||!o.visible||o.allowEditing==!1)return;u._cellEditingDetails.rowIndex=f.selectionSettings.selectionMode==="cell"?this._rowIndexOfLastSelectedCell:this.selectedRowIndex();u._cellEditingDetails.columnIndex=u._cellIndex;f.selectedItem=s[this.selectedRowIndex()];u._cellEditingDetails.columnIndex>-1&&(u.updateScrollBar(),fieldName=o.field,fieldName&&u.cellEdit(u._cellEditingDetails.rowIndex,fieldName),u._editAddTools())}else st.toLowerCase()!="rowediting"||u._isRowEdit||f.selectionSettings.selectionMode=="cell"?st.toLowerCase()=="dialogediting"&&f.selectionSettings.selectionMode!="cell"&&(rt=u.selectedRowIndex(),rt>=0&&u._showTreeGridAddEditDialog(rt)):(rt=u.selectedRowIndex(),rt>=0&&(u.updateScrollBar(),u._editRow(rt)));break;case"topRowSelection":if(f.allowPaging&&a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(lt=0,s[0].isSummaryRow&&(nt=u._getNextRecord(lt+1,s,t),lt=s.indexOf(nt)),u._rowSelectingEventTrigger(this.selectedRowIndex(),lt)||(u.selectRows(lt),u._focusTreeGridElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(lt)))}break;case"nextPage":f.allowPaging&&(at=u._currentPage(),u._focusTreeGridElement(),at<f.pageSettings.totalPages&&u.gotoPage(at+1));break;case"prevPage":f.allowPaging&&(at=u._currentPage(),u._focusTreeGridElement(),at!=1&&u.gotoPage(at-1));break;case"bottomRowSelection":if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(ht=s.length-1,s[ht].isSummaryRow&&(nt=u._getNextRecord(ht-1,s,t),ht=s.indexOf(nt)),u._rowSelectingEventTrigger(this.selectedRowIndex(),ht)||(u.selectRows(ht),u._focusTreeGridElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(ht)))}break;case"firstRowSelection":if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(f.selectionSettings.selectionMode=="row"?(f.allowPaging&&u.gotoPage(1),f.allowSelection&&!u._rowSelectingEventTrigger(this.selectedRowIndex(),0)&&(u.selectRows(0),u.updateScrollBar(),u._focusTreeGridElement(),u._rowSelectedEventTrigger(0))):f.selectionSettings.selectionMode=="cell"&&(p=u._focusingRowIndex,tt={rowIndex:p,cellIndex:0},u._isShiftKeyNavigation=!1,u._cellIndex=0,u.selectCells([tt])),u._cancelSaveTools())}break;case"lastRowSelection":if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;s.length>0&&(ct=v.length-1,e=v[ct],e.isSummaryRow&&(e=u._getNextRecord(ct-1,v,t)),f.allowPaging&&e&&(u.gotoPage(f.pageSettings.totalPages),s=u._updatedPageData),c=s.indexOf(e),f.selectionSettings.selectionMode=="row"?f.allowSelection&&!u._rowSelectingEventTrigger(this.selectedRowIndex(),c)&&(u.selectRows(c),u._focusTreeGridElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(c)):f.selectionSettings.selectionMode=="cell"&&(p=u._focusingRowIndex,ni=f.columns,u._isShiftKeyNavigation=!1,u._cellIndex=ni.length-1,tt={rowIndex:p,cellIndex:u._cellIndex},u.selectCells([tt])),u._cancelSaveTools())}break;case"moveCellLeft":a.length==0&&h.length==0&&(u._isRowEdit?(previousElement=b.closest("td").prev("td"),this._frozenColumnsLength>0&&previousElement.length==0&&b.closest("#"+u._id+"EditForm").length>0&&(previousElement=n("#"+u._id+"EditFrozenForm").find("td").last()),previousElement.length&&u._focusElementsForRowEdit(previousElement)):f.editSettings.allowEditing&&f.editSettings.editMode.toLowerCase()=="cellediting"&&$form.length>0&&u.editFormValidate()&&(b.blur(),pt=u._moveCurrentCell("left")),f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&!u._isRowEdit&&(u._focusingRowIndex!=0||u._cellIndex!=0)&&(u.model.isEdit?(u._focusingRowIndex=u._cellEditingDetails.rowIndex,u._cellIndex=u._cellEditingDetails.columnIndex,tt={rowIndex:u._focusingRowIndex,cellIndex:u._cellIndex},u.selectCells([tt])):u._selectNextCell("left",t)));break;case"moveCellRight":a.length==0&&h.length==0&&(u._isRowEdit?(nextElement=b.closest("td").next("td"),this._frozenColumnsLength>0&&nextElement.length==0&&b.closest("#"+u._id+"EditFrozenForm").length>0&&(nextElement=n($form).find("td").eq(0)),nextElement.length&&u._focusElementsForRowEdit(nextElement)):f.editSettings.allowEditing&&(f.editSettings.editMode=="cellEditing"||f.selectionSettings.selectionMode=="cell")&&b&&$form.length>0&&this.editFormValidate()&&(b.blur(),pt=u._moveCurrentCell("right")),f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&!u._isRowEdit&&(u._focusingRowIndex!=u.getRows().length-1||u._cellIndex!=bt-1)&&(u.model.isEdit?(u._focusingRowIndex=u._cellEditingDetails.rowIndex,u._cellIndex=u._cellEditingDetails.columnIndex,tt={rowIndex:u._focusingRowIndex,cellIndex:u._cellIndex},u.selectCells([tt])):u._selectNextCell("right",t)));break;case"downArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;if(s.length>0&&f.selectedItem&&u.selectedRowIndex()>-1&&f.selectionSettings.selectionMode=="row")ct=s.length-1,u.selectedRowIndex()!=ct&&(it=s[u.selectedRowIndex()],c=v.indexOf(it),e=v[c+1],e&&e.isSummaryRow&&(e=u._getNextRecord(c+1,v)),c=s.indexOf(e),e&&c<=ct&&f.allowSelection&&!u._rowSelectingEventTrigger(this.selectedRowIndex(),c)&&(u.selectRows(c),u.updateScrollBar(),u._focusTreeGridElement(),u._rowSelectedEventTrigger(u.selectedRowIndex()))),u._cancelSaveTools();else if(f.selectionSettings.selectionMode=="cell"&&u.selectedCellIndexes().length>0){var p=u._focusingRowIndex+1,w=u._cellIndex,vi=s.length;u._isShiftKeyNavigation=!1;p<vi&&(it=s[u._rowIndexOfLastSelectedCell],c=v.indexOf(it),e=v[c+1],e&&e.isSummaryRow&&(e=u._getNextRecord(c+1,v),p=s.indexOf(e)),e&&(tt={rowIndex:p,cellIndex:w},u._focusingRowIndex=p,u.selectCells([tt]),u.updateScrollBar()))}}else a.length?u._moveToNextMenuItem("next"):h.length&&(ot?(k=et.find("div.e-columnmenuselection"),vt=k.next("div.e-columnMenuListDiv"),vt.length>0&&(k.removeClass("e-columnmenuselection"),vt.addClass("e-columnmenuselection"))):(d=h.find("div.e-columnmenuselection"),vt=u._findNextColumnMenuItem(d,"next"),vt.length>0&&(d.removeClass("e-columnmenuselection"),vt.addClass("e-columnmenuselection"),u._focusTreeGridElement(),u._clearFilterMenu())));break;case"rightArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;var p=u.selectedRowIndex(),nt=s[p],l={},ti;l.data=nt;l.recordIndex=p;l.expanded=!0;nt&&nt.hasChildRecords&&!nt.expanded&&u.selectedRowIndex()>=0&&(ti=u._trigger("expanding",l),ti||f.isFromGantt||r.TreeGrid.sendExpandCollapseRequest(u,l),f.enableVirtualization&&u._focusTreeGridElement(),u.updateScrollBar());u._cancelSaveTools();f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&(u._focusingRowIndex!=u.getRows().length-1||u._cellIndex!=bt-1)&&u._selectNextCell("right",t)}else if(a.length&&!ci)u._moveToNextMenuItem("expand");else if(h.length&&!ot)if(y={},y.width="auto",y.height="auto",y.minWidth="0px",y.minHeight="0px",y.showHeader=!1,y.position={X:1,Y:1},y.enableModal=!1,y.isResponsive=!1,y.enableResize=!1,n("#"+u._id+"ccDiv_wrapper").addClass("e-treegridadaptivedialog"),n("#"+u._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content"),n("#"+u._id+"ccDiv").ejDialog(y),n("#"+u._id+"ccDiv").css({height:"auto"}),d=h.find("div.e-columnmenuselection"),oi=et.find("div.e-columnMenuListDiv"),columnListPosX=u._columnListPosX,columnFilterPosX=u._columnFilterPosX,columnChooserListIndex=u._columnChooserListIndex,windowWidth=n(document).width(),d.length>0&&d[0].id==u._id+"_ColumnsChooser"&&!n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon"))si=n("#"+u._id+"ccDiv").ejDialog("instance"),yi=n("#"+u._id+"ccDiv_wrapper").width(),si.open(),windowWidth<columnListPosX+h.width()&&(columnListPosX=columnListPosX-h.width()-yi),pi={X:columnListPosX,Y:posY+n("#"+u._id+"_ColumnsChooser").position().top},si.option({position:pi}),et.css("z-index",u.getMaxZIndex()+1),oi.removeClass("e-columnmenuselection"),oi.eq(0).addClass("e-columnmenuselection"),u._focusTreeGridElement(),u._renderedSubMenuType="ColumnDesktop";else if(d.length>0&&d[0].id==u._id+"_FilterChooser"&&!n("#"+u._id+"_ColumnMenu").find(".e-expander").hasClass("e-treegridadaptivesubicon")){var ki=ut[0].id.indexOf("_"),ii="#"+ut[0].id.slice(0,ki),wi=n(ii).ejDialog("instance"),bi,di,u=this,y={};y.width="auto";y.height="auto";y.minWidth="0px";y.minHeight="0px";y.showHeader=!1;y.position={X:1,Y:1};y.enableModal=!1;y.isResponsive=!1;y.enableResize=!1;n(ii+"_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content");n(ii).ejDialog(y);windowWidth<columnFilterPosX+n("#"+ut[0].id).width()&&(columnFilterPosX=columnFilterPosX-h.width()-n("#"+FilterMenuDiv[0].id).width());di=h.find("div.e-columnmenuselection").closest("li").index();bi={X:columnFilterPosX,Y:posY+n("#"+u._id+"_FilterChooser").position().top};wi.option({position:bi});wi.open();u._updatePreviousFilteredValue(o);ut.css("z-index",u.getMaxZIndex()+1);u._focusTreeGridElement();u._renderedSubMenuType=ii+"Desktop"}break;case"leftArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;var p=u.selectedRowIndex(),nt=s[p],l={},ti;l.data=nt;l.recordIndex=p;l.expanded=!1;nt&&nt.hasChildRecords&&nt.expanded&&u.selectedRowIndex()>=0&&(ti=u._trigger("collapsing",l),ti||f.isFromGantt||r.TreeGrid.sendExpandCollapseRequest(u,l),f.enableVirtualization&&u._focusTreeGridElement(),u.updateScrollBar());u._cancelSaveTools();f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&(u._focusingRowIndex!=0||u._cellIndex!=0)&&u._selectNextCell("left",t)}else a.length?u._moveToNextMenuItem("collapse"):h.length&&(ot||li)&&(n("#"+u._id+"ccDiv").ejDialog("close"),u._clearFilterMenu());break;case"upArrow":if(f.allowSelection)if(a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;if(f.selectionSettings.selectionMode=="row"&&this.selectedRowIndex()>0&&s.length>0&&f.selectedItem)it=s[u.selectedRowIndex()],c=v.indexOf(it),e=v[c-1],e.isSummaryRow&&(e=u._getNextRecord(c-1,v,t)),c=s.indexOf(e),c==-1||u._rowSelectingEventTrigger(this.selectedRowIndex(),c)||(u.selectRows(c),u.updateScrollBar(),u._focusTreeGridElement(),u._rowSelectedEventTrigger(u.selectedRowIndex())),u._cancelSaveTools();else if(f.selectionSettings.selectionMode=="cell"){var p=u._focusingRowIndex-1,w=u._cellIndex,vi=f.flatRecords.length;u._isShiftKeyNavigation=!1;p!=-1&&(it=s[u._rowIndexOfLastSelectedCell],c=v.indexOf(it),e=v[c-1],e&&e.isSummaryRow&&(e=u._getNextRecord(c-1,v,t),p=s.indexOf(e)),e&&(tt={rowIndex:p,cellIndex:w},u._focusingRowIndex=p,u.selectCells([tt]),u.updateScrollBar()))}}else a.length?u._moveToNextMenuItem("prev"):h.length&&(ot?(k=et.find("div.e-columnmenuselection"),yt=k.prev("div.e-columnMenuListDiv"),yt.length>0&&(k.removeClass("e-columnmenuselection"),yt.addClass("e-columnmenuselection"))):(d=h.find("div.e-columnmenuselection"),yt=u._findNextColumnMenuItem(d,"prev"),yt.length>0&&(d.removeClass("e-columnmenuselection"),yt.addClass("e-columnmenuselection"),u._clearFilterMenu())));break;case"deleteRecord":if(f.readOnly==!1&&f.editSettings.allowDeleting&&a.length==0&&h.length==0){if(u._isRowEdit||u.model.isEdit)return!0;u.selectedRowIndex()>=0&&(u.deleteRow(),u._cancelSaveTools(),u._focusTreeGridElement())}break;case"totalRowCollapse":if(a.length==0&&h.length==0){u.model.isFromGantt?(l={},l.requestType="collapseAll",u._trigger("expandAllCollapseAllRequest",l)):u.collapseAll();break}case"totalRowExpand":a.length==0&&h.length==0&&(u.model.isFromGantt?(l={},l.requestType="expandAll",u._trigger("expandAllCollapseAllRequest",l)):u.expandAll());break;case"spaceBar":g=null;h.length&&ot&&(k=et.find("div.e-columnmenuselection"),g=k.data("column"),r.isNullOrUndefined(g)||k.find("span").hasClass("e-disable")||(gt=k.find("span").attr("aria-checked"),gt=="true"?u.hideColumn(g):u.showColumn(g)));u._checkboxSelection&&b.hasClass("e-treegrid")&&n("#"+u._id+"EditForm").length==0&&(u.selectRows(this.selectedRowIndex(),null,!0),u._cancelSaveTools());break;case"shiftDownArrow":if(f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"){var vi=s.length,hi=u._selectedCellDetails.length,it=s[u._rowIndexOfLastSelectedCell];if(c=v.indexOf(it),e=v[c+1],e&&e.isSummaryRow&&(e=u._getNextRecord(c+1,v)),!e)return;if(nextRowIndex=s.indexOf(e),u._focusingRowIndex>u._rowIndexOfLastSelectedCell){for(u._rowIndexOfLastSelectedCell=nextRowIndex,u._selectedCellDetails.sort(function(n,t){return parseFloat(n.rowIndex)-parseFloat(t.rowIndex)}),u._getSelectedCellsinARow(u._selectedCellDetails[0].data.index,u._selectedCellDetails),ft=0;ft<u._selectedCellsinARow.length;ft++)ri=u._selectedCellDetails.indexOf(u._selectedCellsinARow[ft]),n(u._selectedCellsinARow[ft].cellElement).removeClass("selectingcell"),u._selectedCellDetails.splice(ri,1);u.updateScrollBar()}else nextRowIndex<vi&&(l={rowIndex:nextRowIndex,cellIndex:u._lastSelectedCellIndex},u.updateScrollBar(),u._shiftKeySelectCells(l),u._rowIndexOfLastSelectedCell=nextRowIndex)}break;case"shiftUpArrow":if(f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"){if(hi=u._selectedCellDetails.length,it=s[u._rowIndexOfLastSelectedCell],c=v.indexOf(it),e=v[c-1],e&&e.isSummaryRow&&(e=u._getNextRecord(c-1,v,"upArrow")),!e)return;if(nextRowIndex=s.indexOf(e),hi>0&&u._focusingRowIndex<u._rowIndexOfLastSelectedCell){for(u._rowIndexOfLastSelectedCell=nextRowIndex,u._getSelectedCellsinARow(u._selectedCellDetails[hi-1].data.index,u._selectedCellDetails),ft=0;ft<u._selectedCellsinARow.length;ft++)ri=u._selectedCellDetails.indexOf(u._selectedCellsinARow[ft]),n(u._selectedCellsinARow[ft].cellElement).removeClass("selectingcell"),u._selectedCellDetails.splice(ri,1);u.updateScrollBar()}else nextRowIndex>=0&&(l={rowIndex:nextRowIndex,cellIndex:u._lastSelectedCellIndex},u._rowIndexOfLastSelectedCell=nextRowIndex,u.updateScrollBar(),u._shiftKeySelectCells(l))}break;case"shiftRightArrow":f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(bt=f.columns.length,w=u._lastSelectedCellIndex+1,w<bt-1&&(!f.columns[w].visible||!f.columns[w].allowCellSelection)&&(w=u.getUpNextVisibleColumnIndex(w)),w<bt&&(l={rowIndex:u._rowIndexOfLastSelectedCell,cellIndex:w},u._shiftKeyFirstElementDetails.firstElementRowIndex=u._focusingRowIndex,u._shiftKeySelectCells(l),u._lastSelectedCellIndex=w));break;case"shiftLeftArrow":f.allowSelection&&f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(w=u._lastSelectedCellIndex-1,w==-1||f.columns[w].visible&&f.columns[w].allowCellSelection||(w=u.getPreviousVisibleColumnIndex(w)),l={rowIndex:u._rowIndexOfLastSelectedCell,cellIndex:w},w!=-1&&(u._shiftKeyFirstElementDetails.firstElementRowIndex=u._focusingRowIndex,u._shiftKeySelectCells(l),u._lastSelectedCellIndex=w));break;case"shiftHomeButton":f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(p=u._rowIndexOfLastSelectedCell,l={rowIndex:p,cellIndex:0},u._cellIndex=0,u._lastSelectedCellIndex=0,u._shiftKeySelectCells(l));break;case"shiftEndButton":f.selectionSettings.selectionMode=="cell"&&f.selectionSettings.selectionType=="multiple"&&(p=u._rowIndexOfLastSelectedCell,ni=f.columns,u._cellIndex=ni.length-1,l={rowIndex:p,cellIndex:u._cellIndex},u._lastSelectedCellIndex=u._cellIndex,u._shiftKeySelectCells(l));break;default:pt=!0}return pt},_clearAllFilter:function(){var n=this,t=n.model.filterSettings.filteredColumns[0];n.model.allowFiltering=!0;n.model.filterSettings.filteredColumns=[];n.filterColumn(t.field,t.operator,"","and");n._filteredColumnValue=[];n._filteredColumnValueID=[]},filterColumn:function(t,i,u,f,e,o){var p=this,k=p.model,h=k.filterSettings.filteredColumns,c,v,d,l,s,a,y,b;if(this.model.allowFiltering){for(c={},r.TreeGrid.Actions.Filter="filtering",c.requestType=r.TreeGrid.Actions.Filter,c.currentFilterObject=[],n.isArray(i)||(i=n.makeArray(i)),n.isArray(u)||(u=n.makeArray(u)),v=!1,d=this._filterCollection,r.util.isNullOrUndefined(this._currentFilterColumn)&&(this._currentFilterColumn=this.getColumnByField(t)),l=0;l<i.length;l++){if(s={field:t,operator:i[l],value:u[l],matchcase:e,predicate:f,actualFilterValue:o},this._$colType="string",h.length==0&&s.value!=="")this._$colType=="date"&&(i=="equal"||i=="notequal")&&typeof s.value!="string"?this._setDateFilters(s):h.push(s);else{if(p=this,!v){var g=r.DataManager(h),nt=(new r.Query).where("field",r.FilterOperators.equal,s.field),w=g.executeLocal(nt);for(a=0;a<w.length;a++)y=n.inArray(w[a],h),y!=-1&&h.splice(y,1)}s.value!==""&&(this._$colType=="date"&&(i=="equal"||i=="notequal")&&typeof s.value!="string"?this._setDateFilters(s):h.push(s))}v=!0;c.currentFilterObject.push(s)}c.filterCollection=h;c.currentFilteringColumn=t;c.fieldName=t;b=this.processBindings(c);b&&(h.reverse().splice(0,i.length),h.reverse())}},_cellSelectingEventTrigger:function(n){var i=this,e=i.model,t={},r=n.rowIndex,u=n.cellIndex,f=i.getUpdatedRecords();return t.data=f[r],t.targetRow=n.rowElement,t.targetCell=n.cellElement,t.rowIndex=r,t.cellIndex=u,i._trigger("cellSelecting",t)},_cellSelectedEventTrigger:function(n,t){var r=this,h=r.model,i={},u=n.rowIndex,o=n.cellIndex,f=t.rowIndex,s=t.cellIndex,e=r.getUpdatedRecords();return i.PreviousTargetRow=t.rowElement,i.previousTargetCell=t.cellElement,i.previousData=e[f],i.previousRowIndex=f,i.previousCellIndex=s,i.data=e[u],i.targetRow=n.rowElement,i.targetCell=n.cellElement,i.rowIndex=u,i.cellIndex=o,r._trigger("cellSelected",i)},_rowSelectingEventTrigger:function(n,t){var u=this,e=u.model,i={},f;return updatedRecords=u.getUpdatedRecords(),i.targetRow=r.TreeGrid.getRowByIndex(u,t),i.previousTreeGridRow=r.TreeGrid.getRowByIndex(u,n),i.data=updatedRecords[t],i.previousData=updatedRecords[n],i.recordIndex=t,i.previousIndex=n,u.model.isFromGantt&&(i.target="ejTreeGrid"),f=u._trigger("rowSelecting",i),f&&(e.selectedItem=i.data),f},_rowSelectedEventTrigger:function(t){var i=this,e=i.model,u={},o=i.getUpdatedRecords(),f=n.extend({},o[t]);delete f.childRecords;delete f.parentItem;u={targetRow:r.TreeGrid.getRowByIndex(i,t),recordIndex:t};i.model.isFromGantt?(u.target="ejTreeGrid",u.data=e.updatedRecords[t]):u.data=f;i._trigger("rowSelected",u)},_eventBindings:function(t){var u=this,f=u.model,i=0,o,c=u.getUpdatedRecords(),s=u.getRows(),e,h;if(r.isNullOrUndefined(t)?(e=this._frozenColumnsLength>0?n(s[0]).length:n(s).length,t=f.currentViewData):e=t.length,f.queryCellInfo!=null||f.rowDataBound!=null||f.detailsDataBound)for(i;i<e;i++)h=c.indexOf(t[i]),o=r.TreeGrid.getRowByIndex(this,h),u._rowEventTrigger(o,t[i])},_rowEventTrigger:function(t,i){var f=this,e=this.model,u;e.rowDataBound&&f._trigger("rowDataBound",{rowElement:t,data:i});var l=t.cells,o=n(t).find(".e-rowcell"),r=0,h=o.length,s=null,c=f.model.columns;if(e.queryCellInfo)for(r;r<h;r++)n(o[r]).hasClass("e-rowcell")&&(s=c[r]),s&&f._cellEventTrigger(o[r],i,s);e.detailsDataBound&&n(t).next("tr").hasClass("e-detailsrow")&&(u=n(t).next("tr"),this._frozenColumnsLength>0&&(u=n(u[1])),this._trigger("detailsDataBound",{detailsElement:u,data:i}))},_cellEventTrigger:function(n,t,i){var r={cellElement:n,data:t,column:i};r.cellValue=r.column&&this._getCustomCellValue(t,r.column.field);this._trigger("queryCellInfo",r)},_completeAction:function(t){var i=this,u=i.model,e=u.sortSettings.sortedColumns,s=n("#"+i._id.replace("ejTreeGrid","")).data("ejGantt"),f,o;if(u.isEdit=!1,u.allowPaging&&t.requestType!=r.TreeGrid.Actions.Scroll&&this._refreshGridPager(),r.TreeGrid.Actions.Sorting==t.requestType&&u.allowSorting||r.TreeGrid.Actions.Refresh==t.requestType){if(u.allowSorting)for(i._multiSortRequest||(i.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending").remove(),i.getHeaderTable().find("[aria-sort]").removeAttr("aria-sort")),f=0;f<e.length;f++)i._addSortElementToColumn(e[f].field,e[f].direction);i._multiSortRequest=!1}else r.TreeGrid.Actions.BeginEdit==t.requestType||r.TreeGrid.Actions.Add==t.requestType?(o=n("#"+i._id+"EditForm"),i.model.isEdit=!0,i.setWidthToColumns(),r.TreeGrid.Actions.Add==t.requestType&&o.find(".e-field:disabled").not(".e-identity").removeAttr("disabled").removeClass("e-disable"),n.isFunction(n.validator)&&this._initValidator()):u.isFromGantt&&t.requestType===r.TreeGrid.Actions.Scroll&&i._updateCurrentViewData();u.isFromGantt&&(s.model.sortSettings=u.sortSettings);i._trigger("actionComplete",t)},sendDataRenderingRequest:function(t){var i=this,y=this.model,a,e,u,c,l,v;if(i.model.currentViewData.length)switch(t.requestType){case r.TreeGrid.Actions.Delete:case r.TreeGrid.Actions.Refresh:case r.TreeGrid.Actions.Save:case r.TreeGrid.Actions.Filter:case r.TreeGrid.Actions.Sorting:case r.TreeGrid.Actions.Searching:case r.TreeGrid.Actions.ExpandCollapse:case r.TreeGrid.Actions.RefreshDataSource:case r.TreeGrid.Actions.DragAndDrop:case r.TreeGrid.Actions.Paging:case r.TreeGrid.Actions.Scroll:if(a=document.createElement("div"),t.requestType!=r.TreeGrid.Actions.Scroll)this._frozenColumnsLength>0?i._renderFrozenRecords():(i.getContentTable().find("colgroup").first().replaceWith(i._getMetaColGroup()),u=i.getContentTable().children("tbody"),u.empty(),a.innerHTML=["<table>",n.render[i._id+"_Template"](i.model.currentViewData),"<\/table>"].join(""),i.getContentTable().get(0).replaceChild(a.firstChild.firstChild,i.getContentTable().get(0).lastChild),i.setGridRows(n(i.getContentTable().get(0).rows)));else{var u=i.getContentTable().children("tbody"),p=i.model.currentViewData,o=i._visibleRange,w=this._frozenColumnsLength>0?n(u[0]).children("tr").length:u.children("tr").length,s=!1;if(i._scrollTop>i._prevScrollTop){var f=o.top-i._prevRTop,h=o.bottom-i._prevRBottom,e=h?p.slice(-h):[];s=!0}else{var f=w-(i._prevRBottom-o.bottom+1),h=i._prevRTop-o.top,e=p.slice(0,h);f=f>=0?f:-w-1;s=!1}this._frozenColumnsLength>0?i._renderFrozenRecords(e,h,f,s):(i.getContentTable().find("colgroup").first().replaceWith(i._getMetaColGroup()),s?(u.children(":visible:lt("+f+")").remove(),c=n.render[i._id+"_Template"](e),u.append(c)):(u.children(":visible:gt("+f+")").remove(),c=n.render[i._id+"_Template"](e),u.prepend(c)),i._gridRows=i.getContentTable().find("tr"),i.setGridRows(i._gridRows))}this._gridRows=this.getContentTable().get(0).rows;this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);i._$gridContent&&i._isRendered&&(i._trigger("refresh"),i._eventBindings(e),this._hideCollapsedDetailsRows())}else i._frozenColumnsLength>0?(l=r.buildTag("td",y.emptyRecordText,{},{colSpan:this._frozenColumns.length}),v=document,i.getContent().find("#e-frozencontentdiv"+i._id+" .e-table tbody").empty().append(n(v.createElement("tr")).append(l)),l=r.buildTag("td",y.emptyRecordText,{visibility:"hidden"},{colSpan:this._unFrozenColumns.length}),i.getContent().find("#e-movablecontentdiv"+i._id+" .e-table tbody").empty().append(n(v.createElement("tr")).append(l)),i._$gridContainer.find("#e-movablecontentdiv"+i._id+",#e-frozencontentdiv"+i._id).css("height","30px")):(i.getContentTable().find("tbody").empty().append(i._getEmptyTbody()),i._$gridContainer&&i._$gridContainer.css({height:"30px"})),i._gridRows=null,i.setGridRows(null);(i.model.showGridCellTooltip||i.model.showGridExpandCellTooltip)&&(i._cellMouseLeave(),i._headerMouseLeave());t.requestType==r.TreeGrid.Actions.Scroll&&t.requestType==r.TreeGrid.Actions.Refresh;i._completeAction(t)},_renderFrozenRecords:function(t,i,u,f){var e,o,s;this.getContent().find("#e-frozencontentdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[0]);this.getContent().find("#e-movablecontentdiv"+this._id+" .e-table colgroup").replaceWith(this._getMetaColGroup()[1]);e=this.getContentTable().children("tbody");r.isNullOrUndefined(t)?(e.empty(),temp=document.createElement("div"),temp.innerHTML=["<table>",n.render[this._id+"_JSONFrozenTemplate"](this.model.currentViewData),"<\/table>"].join(""),this.getContentTable().get(0).replaceChild(temp.firstChild.firstChild,this.getContentTable().get(0).lastChild),temp=document.createElement("div"),temp.innerHTML=["<table>",n.render[this._id+"_Template"](this.model.currentViewData),"<\/table>"].join(""),this.getContentTable().get(1).replaceChild(temp.firstChild.firstChild,this.getContentTable().get(1).lastChild)):f?(n(e.get(0)).children(":visible:lt("+u+")").remove(),n(e.get(1)).children(":visible:lt("+u+")").remove(),o=n.render[this._id+"_JSONFrozenTemplate"](t),s=n.render[this._id+"_Template"](t),n(e.get(0)).append(o),n(e.get(1)).append(s)):(n(e.get(0)).children(":visible:gt("+u+")").remove(),n(e.get(1)).children(":visible:gt("+u+")").remove(),o=n.render[this._id+"_JSONFrozenTemplate"](t),s=n.render[this._id+"_Template"](t),n(e.get(0)).prepend(o),n(e.get(1)).prepend(s));this.setGridContentTable(this.getContent().find(".e-table"))},_renderByFrozenDesign:function(){var i=n(document.createElement("div")),u=this._getMetaColGroup().find("col"),t={};return t.colgroup1=i.append(r.buildTag("colgroup").append(u.splice(0,this._frozenColumnsLength))).html(),t.colgroup2=i.html(r.buildTag("colgroup").append(u)).html(),n.render[this._id+"_FrozenTemplate"](t)},addFrozenTemplate:function(){var i="<div class='e-frozencontainer' id='e-frozencontainer"+this._id+"' style='overflow:hidden;float:left;'><div class='e-frozencontentdiv' id='e-frozencontentdiv"+this._id+"' style='width:100%;'><table class='e-table' style='width:100%' cellspacing='0' id='"+this._id+"frozene-table'>{{:colgroup1}}<tbody><\/tbody><\/table><\/div><\/div><div class='e-movablecontainer' id='e-movablecontainer"+this._id+"'><div class='e-movablecontent' id='e-movablecontent"+this._id+"'><div class='e-movablecontentdiv' id='e-movablecontentdiv"+this._id+"'><table class='e-table' id='"+this._id+"movablee-table' cellspacing='0'>{{:colgroup2}}<tbody><\/tbody><\/table><\/div><\/div><\/div>",t={};t[this._id+"_FrozenTemplate"]=i;n.templates(t)},sortSetting:function(t){var r=this,i;if(ascendingIcon=n("#"+r._id).find(".e-ascending.e-icon"),descendingIcon=n("#"+r._id).find(".e-descending.e-icon"),r.model.allowSorting=t,ascendingIcon.length>0)for(i=0;i<ascendingIcon.length;i++)n(ascendingIcon[i]).css("visibility","hidden");if(descendingIcon.length>0)for(i=0;i<descendingIcon.length;i++)n(descendingIcon[i]).css("visibility","hidden")},columnIndex:function(n){var t=this,i=t.model;!isNaN(parseInt(n))&&parseInt(n)>=0&&parseInt(n)<i.columns.length&&(i.treeColumnIndex=parseInt(n),t._addInitTemplate(),this.renderRecords(),i.showColumnChooser&&t._renderColumnChooserList(!0))},sortColumn:function(t,i){var f=this,o=f.model,h=o.sortSettings.sortedColumns,s={},e=0,l=h.length,c;if(f._cancelEditState(),f.clearSelection(),o.allowSorting&&n.inArray(t,f._disabledSortableColumns)==-1&&t.length!=0){for(f._multiSortRequest||(o.sortSettings.sortedColumns=[]),s.requestType=r.TreeGrid.Actions.Sorting,s.columnName=t,f._cSortedColumn=t,f._cSortedDirection=s.columnSortDirection=i===u?r.sortOrder.Ascending:i,e;e<l;e++)if(h[e].field==f._cSortedColumn){h.splice(e,1);break}o.sortSettings.sortedColumns.push({field:f._cSortedColumn,direction:f._cSortedDirection});c=f.processBindings(s);c&&(f._cSortedDirection=f._cSortedColumn=null);f.selectedRowIndex()>=0&&f._isRendered&&f.selectedRowIndex(f._sortedRecords.indexOf(this.selectedItem()));f._clearColumnMenu()}},clearSorting:function(){var t=this,i=t.model,n;i.sortSettings.sortedColumns=[];n={};n.requestType=r.TreeGrid.Actions.Sorting;t.processBindings(n)},deleteRow:function(t,i,u){var f=this,s,h={},e=f.model,w=n.extend([],e.selectedItems),a=i?1:w.length,v=f.getUpdatedRecords(),l,o,c,y,b,k,p;if(f._isEmptyRow&&e.selectionSettings.selectionMode=="cell"&&(a=1),!e.editSettings.allowDeleting||a==0)return!1;for(l=0;l<a;l++){if(h.data=e.isFromGantt&&i?v[u]:f._checkboxSelection&&i?e.selectionSettings.selectionMode=="row"?e.selectedItem:v[f._rowIndexOfLastSelectedCell]:e.selectionSettings.selectionMode=="row"?w[l]:v[f._rowIndexOfLastSelectedCell],s=h.data,f.model.enableWBS&&(y=!1,s&&s.parentItem?(o=s.parentItem.childRecords,c=o.indexOf(s)):e.flatRecords.length&&(b=e.flatRecords,k=b.filter(function(n){return n&&n.level==0}),o=k,c=o.indexOf(s)),c!=o.length-1&&(y=!0)),e.flatRecords.indexOf(h.data)!=-1&&(h.requestType=r.TreeGrid.Actions.Delete,h.isFromContextmenu=i,f._selectedCellDetails=[],f._removeRecords(h)))return!0;y&&(s.parentItem?p=o[c]:(o.splice(c,1),p=o[c]),f.updateWBSdetails(p))}f._ensureDataSource(h);f.updateHeight();e.currentViewData.length>0&&e.enableAltRow&&r.TreeGrid.updateAltRow(f,e.currentViewData[0],0,0);f._checkboxSelection?(e.selectedCellIndexes=[],f._prevSelectedItems=null,i||(e.selectedItems=[]),e.selectedItem=null,f.selectedRowIndex(-1),f.selectAllRows()):(e.selectedItems=[],e.selectedCellIndexes=[],e.selectedItem=null,f.selectedRowIndex(-1),f._prevSelectedItems=null,this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&!f.model.isFromGantt&&f._clearMultiSelectPopup())},_removeRecords:function(n){var u=this,i=u.model,f=this.dataSource(),t,s,o,c,h,l,a,e;if(n&&(i.editSettings.allowDeleting||n.isDragAndDropDelete)&&n.requestType===r.TreeGrid.Actions.Delete){if(t=n.data,u._trigger("actionBegin",n))return!0;if(s=i.flatRecords.indexOf(t),t.parentItem&&(c=t.parentItem.childRecords,childIndex=c.indexOf(t),t.parentItem.childRecords.splice(childIndex,1),i.showSummaryRow&&(h=i.summaryRows.length,h==c.length&&(t.parentItem.childRecords.splice(0,h),i.flatRecords.splice(s,h))),i.parentIdMapping||t.parentItem.item[i.childMapping].splice(childIndex,1)),u._checkboxSelection&&!n.isDragAndDropDelete)if(n.isFromContextmenu)u._removeChildRecords(i.selectedItems,n.data);else while(i.selectedItems.length>0)u._removeChildRecords(i.selectedItems,i.selectedItems[0]);l=i.parentRecords.indexOf(t);l!==-1&&i.parentRecords.splice(l,1);s!==-1&&(a=u.getChildCount(t,0),i.flatRecords.splice(s,a+1),i.ids&&i.ids.splice(s,a+1));i.updatedRecords=i.enableVirtualization?u.getExpandedRecords(i.flatRecords):i.flatRecords.slice();u.updateCollapsedRecordCount();i.parentIdMapping?(t.hasChildRecords&&t.childRecords.length>0&&u._removeChildItem(t),f instanceof r.DataManager?f.dataSource.offline&&f.dataSource.json?(e=f.dataSource.json.indexOf(t.item),e!==-1&&f.dataSource.json.splice(e,1)):u._isDataManagerUpdate&&(e=u._jsonData.indexOf(t.item),e!==-1&&u._jsonData.splice(e,1)):(e=f.indexOf(t.item),e!==-1&&f.splice(e,1))):f instanceof r.DataManager?f.dataSource.offline&&f.dataSource.json?(o=f.dataSource.json.indexOf(t.item),o!==-1&&f.dataSource.json.splice(o,1)):u._isDataManagerUpdate&&(o=u._jsonData.indexOf(t.item),u._jsonData.splice(o,1)):(o=f.indexOf(t.item),o!==-1&&f.splice(o,1));t.parentItem&&t.parentItem.childRecords.length==0&&(t.parentItem.expanded=!1,t.parentItem.hasChildRecords=!1,t.parentItem.hasFilteredChildRecords=!1);i.showSummaryRow&&u._updateSummaryRow(n);i.showTotalSummary&&u._updateTotalSummaryRow(n)}},updateWBSdetails:function(n){var h=this,c=h.model,t=n,r=t.WBS,u,f,e,i,o,l,a,s,v;t.parentItem?(u=t.parentItem.childRecords,f=u.indexOf(t),i=u,o=i.length):c.flatRecords.length&&(l=c.flatRecords,a=l.filter(function(n){return n&&n.level==0}),i=a,f=i.indexOf(t),o=i.length);e=i.slice(f,o);e.length&&(s=r.lastIndexOf(".")!=-1?parseInt(r.substr(r.lastIndexOf(".")+1)):parseInt(r),v=t.parentItem?t.parentItem.WBS:null,s--,h.reCalculateWBS(e,s,v))},reCalculateWBS:function(n,t,i){var u=this,e=u.model,o=e.currentViewData,f,r;if(i)for(r=0;r<n.length;r++)f=t+r,n[r].WBS=i+"."+f,n[r].item.WBS=i+"."+f,e.enableWBSPredecessor&&u._getPredecessorIds(n[r]),u.refreshRow(o.indexOf(n[r])),n[r].hasChildRecords&&u._updateChildWBS(n[r]);else for(r=0;r<n.length;r++)f=(t+r).toString(),n[r].WBS=f,n[r].item.WBS=f,e.enableWBSPredecessor&&u._getPredecessorIds(n[r]),u.refreshRow(o.indexOf(n[r])),n[r].hasChildRecords&&u._updateChildWBS(n[r])},_updateChildWBS:function(n){for(var r=this,u=r.model,e=u.currentViewData,i=n.childRecords,f=n.WBS,t=0;t<i.length;t++)i[t].WBS=f+"."+(t+1),i[t].item.WBS=f+"."+(t+1),u.enableWBSPredecessor&&r._getPredecessorIds(i[t]),r.refreshRow(e.indexOf(i[t])),i[t].hasChildRecords&&r._updateChildWBS(i[t])},_getPredecessorIds:function(n){var i=this,u=i.model,f=n.taskId,e=u.flatRecords,o=u.updatedRecords,r=e.filter(function(n){var i,t,r,u;if(n.predecessorsName)for(i=n.predecessorsName.split(","),t=0;t<i.length;t++)if(r=i[t].match(/(\d+|[A-z]+)/g),u=+r[0],u==f)return n});for(t=0;t<r.length;t++)i.updateWBSPredecessor(r[t]),i.refreshRow(o.indexOf(r[t]))},search:function(n){var i=this,t={};t.requestType=r.TreeGrid.Actions.Searching;t.keyValue=n;i._searchString=n;i.processBindings(t)},endEdit:function(){var n=this;if(n.model.editSettings.editMode.toLowerCase()!="cellediting"||n._isRowEdit){if(n.model.editSettings.editMode.toLowerCase()=="dialogediting")return n.saveRow()}else return this.editFormValidate()?n.saveCell():!0;return!0},updateReadOnly:function(n){var t=this;t.model.readOnly=n},updateShowGridExpandCellTooltip:function(n){var t=this;t.model.showGridExpandCellTooltip=n;t.refreshContent()},updateShowGridCellTooltip:function(n){var t=this;t.model.showGridCellTooltip=n;t.refreshContent()},getVisibleRange:function(){var n=this,o=n.model,u=n.model.rowHeight+n._detailsRowHeight,r=n._scrollTop/u,f=r-Math.floor(r),t,i,e=n.getUpdatedRecords();return n._offset=f*u,t=Math.floor(r),i=n._getRowPosition(n._scrollTop+n._viewPortHeight),t=Math.max(0,t),i=Math.min(e.length,i),n._visibleRange={top:t,bottom:i},n._visibleRange},_setWidthToHeaders:function(){var r=this._gridWidth,t,i,n;if(this._frozenColumnsLength>0){for(t=0,n=0;n<this.columnsWidthCollection.length;n++)t+=this.columnsWidthCollection[n],this._frozenColumnsLength-1==n&&(i=Math.ceil(t));this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).width(r).next().css("margin-left",i+"px");this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).outerWidth(i).end().find("#e-movableheaderdiv"+this._id).css("width","100%")}},setWidthToColumns:function(){for(var c,s,i,t=this,f=t.model,h=t.getContentTable().children("colgroup").find("col"),e=t.getHeaderTable().children("colgroup").find("col"),l=t._gridWidth,o=f.columns.length,u=0;u<e.length;u++)r.isNullOrUndefined(t.columnsWidthCollection[u])||(h.eq(u).width(t.columnsWidthCollection[u]),e.eq(u).width(t.columnsWidthCollection[u]));f.isFromGantt||(h.length>o&&h.eq(o).width(35),e.length>o&&e.eq(o).width(35));f.showTotalSummary&&this._$totalSummaryRowContainer&&(c=n(this.getHeaderTable()).find("colgroup"),s=n(c).clone(),this._frozenColumnsLength>0?this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(s[0]).prependTo(this._$footertableContent[0]),n(s[1]).prependTo(this._$footertableContent[1])):this._$footertableContent&&(n(this._$footertableContent).find("colgroup").remove(),n(s).prependTo(this._$footertableContent)));this._frozenColumnsLength>0&&(i=this._getFrozenColumnWidth(),this.getContent().find("#e-movablecontainer"+this._id).css("margin-left",i+"px"),this.getContent().find("#e-frozencontainer"+this._id).outerWidth(i),this.getScrollElement().data("ejScroller")&&(this.getScrollElement().ejScroller("option","width",this._gridWidth-i-this._totalBorderWidth-1),this.getScrollElement().ejScroller("option","scrollTop",t._scrollTop),this.getScrollElement().ejScroller("option","scrollLeft",t._scrollLeft)),this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).next().css("margin-left",i+"px"),this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).outerWidth(i).end().find("#e-movableheaderdiv"+this._id).css("width","100%"),this._$totalSummaryRowContainer&&(this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).width(l).next().css("margin-left",i+"px"),this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).outerWidth(i).end().find("#e-movablefooterdiv"+this._id).css("width","100%"),this.getBrowserDetails().browser=="safari"&&this._$totalSummaryRowContainer.find("#e-movablefooter"+this._id).css("margin-left","auto")),this.getBrowserDetails().browser=="safari"&&this.getHeaderContent().find("#e-movableheader"+this._id).add(this.getContent().find("#e-movablecontainer"+this._id)).css("margin-left","auto"));f.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||f.isFromGantt||this._updateTableWidth()},_updateTableWidth:function(t){var i=0,u,f,e,r;for(model=this.model,frozenColumnWidth=this._getFrozenColumnWidth(),columnLength=model.columns.length,r=0;r<columnLength;r++)(model.columns[r].isFrozen||model.columns[r].visible!=!1)&&(i+=model.columns[r].width);this._frozenColumnsLength>0?(i-=frozenColumnWidth,u=n(this.getHeaderTable()[1]),f=n(this.getContentTable()[1]),e=model.showTotalSummary?n(this._$footertableContent[1]):null):(u=this.getHeaderTable(),f=this.getContentTable(),e=model.showTotalSummary?n(this._$footertableContent[0]):null);model.showDetailsRow&&model.showDetailsRowInfoColumn&&model.detailsTemplate&&(i+=35);t||(u.width(i),f.width(i),e&&e.width(i));i<this._gridWidth-frozenColumnWidth&&model.columns[columnLength-1].visible?(u.addClass("e-tableLastCell"),f.addClass("e-tableLastCell")):(u.removeClass("e-tableLastCell"),f.removeClass("e-tableLastCell"))},_convertHtml:function(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},cellEdit:function(t,i){var f=this,b,s=f.model,v,k=t,d=f.getUpdatedRecords(),o,w,nt;if(o=s.allowSelection==!0?s.selectionSettings.selectionMode=="row"?this.selectedItem():d[f._rowIndexOfLastSelectedCell]:this.selectedItem(),f.model.showGridCellTooltip&&f._cellMouseLeave(),f.model.isEdit&&f.saveCell(),b=n("#"+f._id+"EditForm"),b.length>0)return!0;if(!o||s.isFromGantt&&o.hasChildRecords&&(i==="status"||i==="startDate"&&o.isAutoSchedule||i==="endDate"&&o.isAutoSchedule||i==="duration"&&o.isAutoSchedule||i==="work"||i==="effortDriven"||i==="taskType"||i==="predecessor"||i==="taskId")||s.isFromGantt&&(o.isAutoSchedule&&o.taskType=="fixedWork"&&i=="effortDriven"||!o.isAutoSchedule&&(i=="taskType"||i=="effortDriven")))return!1;if((s.enableVirtualization||s.selectionSettings.selectionMode==="cell")&&(k=d.indexOf(o),t=s.currentViewData.indexOf(o)),v=r.TreeGrid.getRowByIndex(this,k),v&&n(v).find(".e-rowcell").length>0){var c=n(v),l=f.getColumnIndexByField(i),y=c.find(".e-rowcell").eq(l),h=f.model.columns[l],e=o,p=f._getCustomCellValue(e,h.field),a={},u={validationRules:r.isNullOrUndefined(h.validationRules)?{}:n.extend(!0,{},h.validationRules),columnName:h.field,value:r.isNullOrUndefined(p)?e.item&&e.item[i]:p,data:e,columnObject:h,cell:y},g=!0;return(h.field=="notesText"?(u.value=r.isNullOrUndefined(e[i])?e.item&&e.item[i]:e[i],u.value=u.value?f._convertHtml(u.value):u.value):u.value=r.isNullOrUndefined(p)?e.item&&e.item[i]:p,s.isFromGantt&&u.columnName==="predecessor"&&(w=u.data.item[f.model.predecessorMapping],u.value=w?w:""),s.isFromGantt&&u.columnName==="taskMode"&&(nt=!u.data.isAutoSchedule,u.value=nt),a.data=e,a.columnIndex=l,a.rowElement=c,a.cellElement=y,f._cellEventTrigger(y,e,u.columnObject),f._trigger("beginEdit",a))?!1:(c.hasClass("e-insertedrow")&&!u.columnObject.isTemplateColumn&&(g=!0),g&&n.extend(f._cellEditingDetails,{rowIndex:t,cellValue:u.value,columnIndex:l,fieldName:i,cellEditType:u.columnObject.editType,data:e}),u.columnIndex=l,f._renderCellEditObject(u,y),c.hasClass("e-templaterow")||c.addClass("e-editedrow"),u.cell&&u.cell.addClass("e-editedcell"),f._updateHorizontalScrollBar(i),!0)}},_updateHorizontalScrollBar:function(t){var i=this,o=i.getScrollElement(),k=o.ejScroller("isHScroll"),f,u;if(k){var c=i.model,p=c.columns,d=p.length,l=i.getColumnIndexByField(t),s=0,h=0,a=0,v=0,w=o.find(".e-content").width(),r=o.ejScroller("option","scrollLeft"),y=n("#"+i._id+"EditForm"),b,e=[];if(c.selectionSettings.selectionMode=="cell"&&y.length==0?e=n("#"+i._id).find(".selectingcell"):(b=n(y).closest("tr.e-treegridrows"),e=n(b).find("td.e-rowcell")),i._frozenColumnsLength>0&&l<i._frozenColumnsLength)return!1;for(f=i._frozenColumnsLength;f<=l;f++)u=c.selectionSettings.selectionMode=="cell"&&y.length==0?e[e.length-1]:n(e[f-i._frozenColumnsLength]),f==l&&(h=s,a=s+n(u).width()+parseFloat(n(u).css("padding-left"))+parseFloat(n(u).css("padding-right"))+1),p[f].visible&&(s=s+n(u).width()+parseFloat(n(u).css("padding-left"))+parseFloat(n(u).css("padding-right"))+1);(h<r||a>r+w)&&(v=h<r?r-(r-h)-3:r+(a-(r+w)+3),o.ejScroller("option",{scrollLeft:v}),i._updateHeaderScrollLeft(v))}},updateAllowColumnResize:function(n){var t=this,i=t.model;i.allowColumnResize=n;i.allowColumnResize&&(t._resizer=new r.gridFeatures.gridResize(t));t._enableColumnResizeEvents()},_validatePredecessorString:function(n){var i=this,t;if(n.length>0)n.split(",").forEach(function(n){values=n.split("+");offsetvalue="+";n.indexOf("-")>=0&&(values=n.split("-"),offsetvalue="-");match=values[0].match(/(\d+|[A-z]+)/g);match&&i.model.ids.indexOf(match[0])!=-1?match[1]&&(match[1].toUpperCase()=="FS"||match[1].toUpperCase()=="FF"||match[1].toUpperCase()=="SF"||match[1].toUpperCase()=="SS"||(t=!1)):t=!1});else return!0;return t===u||t?!0:!1},saveCell:function(){var i=this,u=i.model,w,e,f,o,tt,it,h,ft,et,s,v,y;if(n("#"+i._id+"EditForm").length>0){if(!i.editFormValidate())return!0;if(i._cellEditingDetails.columnIndex>=0){i._focusTreeGridElement();var ot=n("#"+i._id+"EditForm"),st=u.allowPaging?i._updatedPageData.indexOf(i._cellEditingDetails.data):u.updatedRecords.indexOf(i._cellEditingDetails.data),g=r.TreeGrid.getRowByIndex(this,st),ht=ot.closest("td"),nt,t={},c=u.columns[i._cellEditingDetails.columnIndex],p=n("#"+i._id+i._cellEditingDetails.fieldName.split(".").join("")),l;if(t={columnName:c.field,value:i.getCurrentEditCellData(),data:i._cellEditingDetails.data,previousValue:i._cellEditingDetails.cellValue,columnObject:c,cellElement:ht,rowElement:g},(i._cellEditingDetails.cellEditType=="datetimepicker"||i._cellEditingDetails.cellEditType=="dropdownedit"||i._cellEditingDetails.cellEditType=="datepicker")&&p.data("ejWidgets")&&p[p.data("ejWidgets")[0]]("destroy"),r.isNullOrUndefined(c.format)?t.columnObject.type=="boolean"?(w={},w[t.columnObject.field]=t.value,t.cellElement.empty().html(n(n.templates.Grid_JSONTemplate.render(w))[0].cells[i._cellEditingDetails.columnIndex].innerHTML)):t.columnObject.field=="notesText"?t.cellElement.empty().html(i._convertHtml(t.value)):t.cellElement.empty().html(t.value):(nt=i.formatting(c.format,t.value,u.locale),t.cellElement.empty().html(nt)),e=(i._cellEditingDetails.cellEditType=="datepicker"||i._cellEditingDetails.cellEditType=="datetimepicker")&&t.value instanceof Date&&t.previousValue instanceof Date?t.value.getTime()!==t.previousValue.getTime():t.value!==t.previousValue,u.isEdit=!1,f=i._cellEditingDetails.fieldName,!u.isFromGantt&&u.idMapping&&u.parentIdMapping&&f==u.idMapping&&i._validateIdValue(t.value)&&(t.value=t.previousValue,e=!1),u.isFromGantt&&f==="taskMode"&&(e=t.value!==t.previousValue?!0:!1),u.isFromGantt&&t.value&&(f==="startDate"||f==="endDate")&&this.getFormatedDate(t.value)==this.getFormatedDate(t.data[f])&&(e=!1),u.isFromGantt&&f==="predecessor"){o={};t.value=t.value.trim();tt=i._validatePredecessorString(t.value);tt?(o.predecessorString=t.value.split(","),o.currentRecord=t.data,o.requestType="validatePredecessor",i._trigger("actionComplete",o),it=o.result,it||(t.value=t.previousValue)):t.value=t.previousValue;var b=[],rt=[],k=[],a=0,ut,d;for(t.previousValue=t.data.predecessor,rt=t.previousValue,t.value.length>0&&(k=t.data._calculatePredecessor(t.value,u.durationUnitEditText,u.durationUnit)),ut=k.length,h=0,ft=t.previousValue&&t.previousValue.length,h=0;h<ft;h++)d=rt[h],d.from===t.data.taskId.toString()&&b.push(d);for(a=0;a<ut;a++)b.push(k[a]);t.data[i._cellEditingDetails.fieldName]=b;t.data.item[u.predecessorMapping]=t.value;t.data.predecessorsName=t.value;u.enableWBS&&u.enableWBSPredecessor&&i.updateWBSPredecessor(t.data)}else if(u.isFromGantt&&f==="duration")et=t.value,duration=t.data.duration,durationUnit=t.data.durationUnit,s=et.match(/(\d*\.*\d+|[A-z]+)/g),s&&s.length<=2&&(duration=parseFloat(s[0]),durationUnit=s[1]?s[1].toLowerCase():"",durationUnit=u.durationUnitEditText.minute.indexOf(durationUnit)!=-1?r.Gantt.DurationUnit.Minute:u.durationUnitEditText.hour.indexOf(durationUnit)!=-1?r.Gantt.DurationUnit.Hour:u.durationUnitEditText.day.indexOf(durationUnit)!=-1?r.Gantt.DurationUnit.Day:u.durationUnit),isNaN(duration)?t.data.item[u.durationMapping]=t.previousValue:(t.data.item[u.durationMapping]=t.data.duration=duration,t.data.durationUnit=durationUnit);else if(e){if(u.isFromGantt)switch(f){case"taskId":t.data.item[u.idMapping]=t.value;break;case"taskName":t.data.item[u.taskNameMapping]=t.value;break;case"startDate":t.value||(t.value=t.previousValue);t.data.item[u.startDateMapping]=t.value;break;case"endDate":t.value||(t.value=t.previousValue);t.data.item[u.endDateMapping]=t.value;break;case"resourceInfo":t.data.item[u.resourceInfoMapping]=i._getResourceId(t.value);break;case"status":t.data.item[u.progressMapping]=t.value;break;case"notesText":t.data.item[u.notesMapping]=t.value;t.data.notes=t.value;t.data.notesText=t.value;break;case"taskMode":t.data.item[u.taskSchedulingModeMapping]=t.value;t.data.isAutoSchedule=t.value==!0?!1:!0;break;case"work":u.workMapping?t.data.item[u.workMapping]=t.value:t.data.item[i._cellEditingDetails.fieldName]=t.value;break;case"baselineStartDate":t.data.item[u.baselineStartDateMapping]=t.value;break;case"baselineEndDate":t.data.item[u.baselineEndDateMapping]=t.value;break;default:t.data.item[i._cellEditingDetails.fieldName]=t.value}else v=(i._cellEditingDetails.fieldName||"").split("."),v<=1?t.data.item[i._cellEditingDetails.fieldName]=t.value:t.data.item=i._restoreCustomData(t.data.item,t.value);v=(i._cellEditingDetails.fieldName||"").split(".");v<=1?t.data[i._cellEditingDetails.fieldName]=t.value:t.data=i._restoreCustomData(t.data,t.value)}(u.isFromGantt&&(t.columnName==="startDate"||t.columnName==="endDate"||t.columnName==="duration"||t.columnName==="taskMode"&&e||t.columnName==="predecessor"||t.columnName=="status")||t.columnName=="baselineStartDate"||t.columnName=="baselineEndDate")&&(t.isModified=!0);this._frozenColumnsLength>0?(u.allowSelection||(t.data.isSelected=!1),l=i._cellEditingDetails.columnIndex<this._frozenColumnsLength?n(n.render[i._id+"_JSONFrozenTemplate"](t.data))[0].cells[i._cellEditingDetails.columnIndex]:n(n.render[i._id+"_Template"](t.data))[0].cells[i._cellEditingDetails.columnIndex-this._frozenColumnsLength]):(u.allowSelection||(t.data.isSelected=!1),l=n(n.render[i._id+"_Template"](t.data))[0].cells[i._cellEditingDetails.columnIndex]);t.cellElement.removeClass("e-editedcell").replaceWith(l);t.cellElement=n(l);u.showDetailsRow&&!u.showDetailsRowInfoColumn&&u.detailsTemplate&&this._refreshDetailsRow(u.currentViewData.indexOf(t.data));i._trigger("refresh");t.data.treeMappingName||(t.data.treeMappingName=[]);t.data.treeMappingName.push(t.columnName);i._trigger("endEdit",t)&&(t.data[t.columnName]=t.previousValue,t.data.item[t.columnObject.field]=t.previousValue,i.selectRows(this.selectedRowIndex()),r.TreeGrid.refreshRow(i,u.currentViewData.indexOf(t.data)));i._cellEventTrigger(t.cellElement[0],t.data,t.columnObject);g.removeClass("e-editedrow")}u.showSummaryRow&&(t.editType="celledit",i._updateSummaryRow(t));u.showTotalSummary&&(t.editType="celledit",i._updateTotalSummaryRow(t));i._cancelSaveTools();y=t.columnObject;u.allowFiltering&&y&&u.filterSettings.filterType=="filterbar"&&y.filterEditType=="dropdownedit"&&y.editType!="dropdownedit"&&i._resizeFilteringElements()}return!1},updateWBSPredecessor:function(n){var h=this,c=h.model,u=n.predecessorsName,t=null,f,r,e;if(u&&u.length>0){for(f=u.split(","),r=0;r<f.length;r++){var o=f[r].match(/(\d+|[A-z]+)/g),l=+o[0],s=o[1],i;i=c.flatRecords.filter(function(n){return n&&n.taskId==l});e=s?i[0]&&i[0].WBS+s:i[0]&&i[0].WBS;t=t?t+","+e:e}n.WBSPredecessor=t;n.item.WBSPredecessor=t}else n.WBSPredecessor="",n.item.WBSPredecessor=""},getCurrentEditCellData:function(){var u=this,e=u.model,l=e.columns,f,o,i,t;if(n("#"+u._id+"EditForm").length){i=n("#"+u._id+u._cellEditingDetails.fieldName.split(".").join(""));f=l[u._cellEditingDetails.columnIndex];switch(u._cellEditingDetails.cellEditType){case r.TreeGrid.EditingType.String:t=i.val();break;case r.TreeGrid.EditingType.Numeric:t=parseFloat(i.val());t=e.isFromGantt&&(f.field=="work"||f.field=="status"||f.field=="duration")||f.field=="unit"?isNaN(t)?u._cellEditingDetails.cellValue:t:i.ejNumericTextbox("model.value");break;case r.TreeGrid.EditingType.Maskedit:t=i.ejMaskEdit("model.value");break;case r.TreeGrid.EditingType.Dropdown:t=e.isFromGantt&&u._cellEditingDetails.fieldName==="resourceInfo"?u._getSelectedItem(i.ejDropDownList("model.selectedItems")):e.isFromGantt&&u._cellEditingDetails.fieldName==="taskMode"?i.ejDropDownList("model.value")=="true"?!0:!1:i.ejDropDownList("model.value");break;case r.TreeGrid.EditingType.Boolean:t=i.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:t=f&&!f.format?r.format(i.ejDatePicker("model.value"),this.model.dateFormat,this.model.locale):i.ejDatePicker("model.value");t==""&&e.isFromGantt&&(t=u._cellEditingDetails.cellValue);break;case r.TreeGrid.EditingType.DateTimePicker:var a=i.ejDateTimePicker("model.value"),s=i.ejDateTimePicker("model.dateTimeFormat"),h=i.ejDateTimePicker("model.locale"),c;t=f&&!f.format?r.format(i.ejDateTimePicker("model.value"),this.model.dateFormat,this.model.locale):i.ejDateTimePicker("model.value");o=r.format(i.val(),s,h);c=r.format(a,s,h);o!==c&&e.isFromGantt&&(t=u._cellEditingDetails.cellValue);break;case"edittemplate":temp1=f.editTemplate.read;typeof temp1=="string"&&(temp1=r.util.getObject(temp1,window));t=temp1(i)}return typeof t=="string"&&t.length&&e.columns[u._cellEditingDetails.columnIndex].type=="number"&&(t=parseFloat(t)),t}return null},getCurrentEditCellDataForRowEdit:function(t,i,u){var o=this,c=o.model,v=c.columns,s,t=t.split(".").join(""),l,f,h,e,a;if(o.model.editSettings.allowEditing&&o.model.editSettings.editMode=="dialogEditing"?(l=n("#"+o._id+"EditFormDialog").length,f=n("#"+o._id+t),h=!0):(l=n("#"+o._id+"EditForm").length,f=n("#"+o._id+t)),l){s=v[u];switch(i){case r.TreeGrid.EditingType.String:e=f.val();break;case r.TreeGrid.EditingType.Numeric:e=parseFloat(f.val());e=f.data("ejNumericTextbox")?f.ejNumericTextbox("model.value"):e;break;case r.TreeGrid.EditingType.Dropdown:e=f.data("ejDropDownList")?f.ejDropDownList("model.value"):f.val();h||f.data("ejWidgets")&&f[f.data("ejWidgets")[0]]("destroy");break;case r.TreeGrid.EditingType.Boolean:e=f.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:a=f.hasClass("e-datepicker")?c.dateFormat.toLowerCase().indexOf("hh")==-1?f.ejDatePicker("model.value"):f.ejDateTimePicker("model.value"):f.val();e=s&&!s.format?o.getFormatedDate(a):a;h||f.data("ejWidgets")&&f[f.data("ejWidgets")[0]]("destroy");break;case r.TreeGrid.EditingType.DateTimePicker:e=f.hasClass("e-datetimepicker")?s&&!s.format?r.format(f.ejDateTimePicker("model.value"),this.model.dateFormat,this.model.locale):f.ejDateTimePicker("model.value"):f.val();h||f.data("ejWidgets")&&f[f.data("ejWidgets")[0]]("destroy");break;case r.TreeGrid.EditingType.Maskedit:e=f.ejMaskEdit("model.value");break;case"edittemplate":temp1=s.editTemplate.read;typeof temp1=="string"&&(temp1=r.util.getObject(temp1,window));e=temp1(f)}return typeof e=="string"&&e.length&&c.columns[u].type=="number"&&(e=parseFloat(e)),e}return null},_getResourceId:function(n){for(var i=[],t=0,r=n.length,t=0;t<r;t++)i.push(n[t][this.model.resourceIdMapping]);return i},_getSelectedItem:function(t){var h=this,e=h.model,i=0,u,l=t.length,a=e.resourceUnitMapping,v=e.resourceIdMapping,c=e.columns[h._cellEditingDetails.columnIndex].dropdownData,o=e.selectedItem.resourceInfo,s=[],f;if(c)for(i=0;i<l;i++){if(o)for(f=0;f<o.length;f++)if(o[f][v]===t[i]+1){u=f;break}else u=-1;r.isNullOrUndefined(u)||u==-1?n.each(c,function(r,u){if(t[i]===r){var f=n.extend({},u);f[a]=100;s.push(f)}}):s.push(o[u])}return s},getFormatedDate:function(n){return r.format(n,this.model.dateFormat,this.model.locale)},getDateFromFormat:function(n){return typeof n=="object"?new Date(n):n?r.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):r.parseDate(n,this.model.dateFormat,this.model.locale):void 0},formatting:function(t,i,u){var f,h,o,s,c,l,e;return t=t.replace(/%280/g,'"').replace(/</g,"<").replace(/>/g,">"),u=r.preferredCulture[u]?u:"en-US",f=t,h=t.split("{0:"),c=t.split("}"),o=h[0],s=c[1],typeof i=="string"&&n.isNumeric(i)&&(i=Number(i)),t.indexOf("{0:")!=-1?(l=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),e=l.exec(t),e!=null&&i!=null?o!=null&&s!=null?o+r.format(i,e[2],u)+s:r.format(i,e[2],u):i!=null?i:""):this.data!=null&&this.data.Value==null?(n.each(this.data,function(n,t){f=f.replace(new RegExp("\\{"+n+"\\}","gm"),t)}),f):this.data.Value},getColumnIndexByField:function(n){var r=this,i=r.model.columns,u=i.length,t=0;for(t;t<u;t++)if(i[t].field==n)break;return t==i.length?-1:t},getUpNextVisibleColumnIndex:function(n,t){var r=this,i=r.model.columns;for(n||(n=0),n;n<=i.length;n++)if(n==i.length&&(t=="rightArrow"||t=="moveCellRight")&&(n=0,r._focusingRowIndex+=1),i[n].visible&&i[n].allowCellSelection)return i.indexOf(i[n])},getPreviousVisibleColumnIndex:function(n,t){var r=this,i=r.model.columns;for(n||(n=i.length-1),n;n<i.length;n--)if(n<0&&(t=="leftArrow"||t=="moveCellLeft")&&(n=i.length-1,r._focusingRowIndex-=1),i[n].visible&&i[n].allowCellSelection)return i.indexOf(i[n])},getBrowserDetails:function(){var n=navigator.userAgent.match(/(firefox|chrome|opera|msie|safari)\s?\/?(\d+(.\d+)*)/i);return!navigator.userAgent.match(/Trident\/7\./)?{browser:n[1].toLowerCase(),version:n[2]}:{browser:"msie",version:jQuery.uaMatch(navigator.userAgent).version}},mobileDevice:function(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)?!0:!1},getFieldNameByHeaderText:function(n){var t=this;return r.isNullOrUndefined(t._fieldColumnNames[n])?null:t._fieldColumnNames[n]},clearSelection:function(t){var i=this,u=i.model,a=i.getUpdatedRecords(),e,t,s,l,h,o,c,f;if(this.selectedRowIndex()!=-1||this.selectedRowIndex()==-1&&i._previousIndex!=-1||t==-1){if(e=this._frozenColumnsLength?n(i.getRows()[0]).add(i.getRows()[1]):i.getRows(),r.isNullOrUndefined(t)||t==-1){if(e&&e.find(".e-rowcell,.e-detailsrowcell").removeClass("e-selectionbackground").removeClass("e-active"),l=new r.DataManager(u.flatRecords),h=new r.Query,h.search(!0,["isSelected"],r.FilterOperators.Equals,!0),o=l.executeLocal(h),c=o&&o.length,c>0)for(f=0,f=0;f<c;f++)o[f].isSelected=!1}else r.TreeGrid.getRowByIndex(i,t).find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),s=a[t],s&&(s.isSelected=!1);i._checkboxSelection?(i.selectedRowIndex(-1),u.selectedItem=null,i._cancelSaveTools()):u.selectedItems.length&&(!u.selectedItems.length||i._multiSelectCtrlRequest)&&t!=-1||(i.selectedRowIndex(-1),u.selectedItem=null,u.selectedItems=[],i._cancelSaveTools());i.model.allowSelection&&i.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&!e.find(".e-rowcell,.e-detailsrowcell").hasClass("e-selectionbackground")&&!n("#"+i._id+"_selectionpopup").find(".e-rowselect").hasClass("e-spanclicked")&&i._clearMultiSelectPopup()}u.selectionSettings.selectionMode=="cell"&&(i._selectedCellDetails=[],u.selectedCellIndexes=[],n("#"+i._id).find(".selectingcell").removeClass("selectingcell"),i._rowIndexOfLastSelectedCell=-1,i._lastSelectedCellIndex=-1,i._focusingRowIndex=-1);i.model.allowSelection&&i.model.selectionSettings.selectionType=="multiple"&&r.isNullOrUndefined(t)&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&i._clearMultiSelectPopup()},_clearMultiSelectPopup:function(){var t=this;n("#"+t._id+"_selectionpopup").find(".e-rowselect").removeClass("e-spanclicked");t._multiSelectPopup.hide();t._multiSelectCtrlRequest=!1;t._isTouchTrigger=!1},getChildRecordsCount:function(n){var r=this,i=n.childRecords,t=0,f=i?i.length:0,u;for(t;t<f;t++)r._filteredRecords.length>0?(u=r._filteredRecords.indexOf(i[t]),u!=-1&&(++r._removedCount,i[t].hasChildRecords&&i[t].expanded&&r.getChildRecordsCount(i[t]))):(++r._removedCount,i[t].hasChildRecords&&i[t].expanded&&r.getChildRecordsCount(i[t]));return r._removedCount},getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this.getExpandStatus(t.parentItem):!0:!0},getColumnFieldNames:function(){var i=[],t=this.model.columns,n=0,r=t.length;for(n;n<r;n++)t[n].field&&t[n].field!="resourceInfo"&&t[n].field!="predecessor"?i.push(t[n].field):t[n].field=="resourceInfo"?i.push("resourceNames"):t[n].field=="predecessor"&&i.push("predecessorsName");return i},_getColumnMappingNames:function(){var i=[],t=this.model.columns,n=0,r=t.length;for(n;n<r;n++)t[n].field&&t[n].field!="resourceInfo"&&t[n].field!="predecessor"&&t[n].field!="work"&&t[n].field!="taskType"&&t[n].field!="effortDriven"?i.push(t[n].mappingName):t[n].field=="resourceInfo"?i.push("resourceNames"):t[n].field=="work"?i.push(t[n].field):t[n].field=="taskType"?i.push(t[n].field):t[n].field=="effortDriven"?i.push(t[n].field):t[n].field=="predecessor"&&i.push("predecessorsName");return i},renderRecords:function(n){var t=this,i=t.model;n||(n={},!i.isFromGantt&&i.enableCollapseAll?(n.requestType=r.TreeGrid.Actions.ExpandCollapse,t._isInExpandCollapseAll=!0):n.requestType=r.TreeGrid.Actions.Refresh);this.sendDataRenderingRequest(n);t._isInExpandCollapseAll=!1},_shiftKeySelectCells:function(t){var i=this,h=i.model,c=i.getUpdatedRecords(),l=i._shiftKeyFirstElementDetails.firstElementRowIndex,a=r.isNullOrUndefined(i._shiftKeyFirstElementDetails.firstElementCellIndex)?-1:i._shiftKeyFirstElementDetails.firstElementCellIndex,v=t.rowIndex,y=t.cellIndex,o=[l,v],s=[a,y],u,f,p,e;for(o.sort(function(n,t){return n-t}),s.sort(function(n,t){return n-t}),i._isShiftKeyNavigation=!0,i._selectedCellDetails=[],h.selectedCellIndexes=[],n("#"+i._id).find(".selectingcell").removeClass("selectingcell"),u=o[0];u<=o[1];u++)if(f=c&&c[u],p=h.currentViewData.indexOf(f),!r.isNullOrUndefined(f)&&!f.isSummaryRow)for(e=s[0];e<=s[1];e++)i.selectCells([{rowIndex:u,cellIndex:e}])},selectCells:function(t,i){var u=this,e=u.model,v=u.getUpdatedRecords(),c=u.getRows(),o,f,y=t.length,l=e.columns,s,a,p,w,h;if(e.selectionSettings.selectionType=="single"&&(y=1),(!i||r.isNullOrUndefined(i))&&u._isShiftKeyNavigation==!1&&(u._selectedCellDetails=[],e.selectedCellIndexes=[],n("#"+u._id).find(".selectingcell").removeClass("selectingcell")),e.selectionSettings.selectionMode=="cell"&&e.allowSelection&&c.length>0)for(index=0;index<y;index++)t[index].rowIndex!=-1&&((s=v&&v[t[index].rowIndex],a=e.currentViewData.indexOf(s),s.isSummaryRow)||(p=t[index].cellIndex>=u._frozenColumnsLength?1:0,w=t[index].cellIndex>=u._frozenColumnsLength?t[index].cellIndex-u._frozenColumnsLength:t[index].cellIndex,o=u._frozenColumnsLength>0?c[p][a]:c[a],!r.isNullOrUndefined(s)&&r.isNullOrUndefined(o)&&(o=n(n.render[u._id+"_Template"](s))[0]),f=o.childNodes[w],t[index].cellIndex!=-1&&l[t[index].cellIndex].allowCellSelection&&l[t[index].cellIndex].visible&&!u._cellSelectingEventTrigger({rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,rowElement:o,cellElement:f})&&(n(f).addClass("selectingcell"),h={rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,cellElement:f,data:s},currentCellIndex=r.browserInfo().name=="msie"&&r.browserInfo().version<9?u._getCellIndex(u._selectedCellDetails,"cellElement").indexOf(f):u._selectedCellDetails.map(function(n){return n.cellElement}).indexOf(f),currentCellIndex==-1&&(u._selectedCellDetails.push(h),e.selectedCellIndexes.push({rowIndex:h.rowIndex,cellIndex:h.cellIndex})),u._cellSelectedEventTrigger({rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,rowElement:o,cellElement:f},u._previousSelectedCellDetails),u._previousSelectedCellDetails={rowElement:o,cellElement:f,cellIndex:t[index].cellIndex,rowIndex:t[index].rowIndex},u._updateHorizontalScrollBar(l[t[index].cellIndex].field))));u._isShiftKeyNavigation==!1&&(u._shiftKeyFirstElementDetails.firstElementRowIndex=u._focusingRowIndex,u._shiftKeyFirstElementDetails.firstElementCellIndex=u._cellIndex,u._rowIndexOfLastSelectedCell=h?h.rowIndex:u._rowIndexOfLastSelectedCell,u._lastSelectedCellIndex=u._cellIndex)},selectRows:function(t,i,u){var f=this,e=f.model,v=f.getRows(),y,o,l,s,c,h,p,a;if((e.selectionSettings.selectionMode!="cell"||t==-1)&&!r.TreeGrid.getRowByIndex(f,t).hasClass("e-summaryrow")){if((e.editSettings.allowEditing||e.editSettings.allowAdding)&&!f._isRowEdit&&e.editSettings.beginEditAction!="click"&&n("#"+f._id+"EditForm").length>0&&f.endEdit()){v=f.getRows();return}if(this._frozenColumnsLength>0&&(v=n(f.getRows()[0])),updatedRecords=f.getUpdatedRecords(),r.isNullOrUndefined(i)||r.isNullOrUndefined(t)){t=r.isNullOrUndefined(t)?i:t;switch(e.selectionSettings.selectionType){case r.TreeGrid.SelectionType.Checkbox:return o=updatedRecords[t],f.clearSelection(-1),u&&(y=o.checkboxState=="unchecked"?"checked":"unchecked",f._traverseSelection(o,y,!1),f.selectAllRows()),updatedRecords[t]&&!updatedRecords[t].isSelected&&(e.allowSelection&&r.TreeGrid.getRowByIndex(f,t).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"),updatedRecords[t].isSelected=!0,e.selectedItem=updatedRecords[t]),f._prevSelectedItem&&f._prevSelectedItem!=e.selectedItem&&(f._prevSelectedItem.isSelected=!1),f._prevSelectedItem=updatedRecords[t],this.selectedRowIndex(t),!1;case r.TreeGrid.SelectionType.Multiple:if(f._multiSelectCtrlRequest){o=updatedRecords[t];l=n.inArray(o,e.selectedItems);f._prevSelectedItem=updatedRecords[t];l!=-1&&(f.clearSelection(t),e.selectedItems.splice(l,1),o.isSelected=!1,e.selectedItem=e.selectedItems.length>0?e.selectedItems[e.selectedItems.length-1]:null);l==-1&&(e.selectedItems.push(o),e.allowSelection&&r.TreeGrid.getRowByIndex(f,t).attr("aria-selected","true").find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active").attr("tabindex","0"),o.isSelected=!0,e.selectedItem=updatedRecords[t]);break}case r.TreeGrid.SelectionType.Single:f.clearSelection(-1);e.selectedItem=null;t<=updatedRecords.length-1&&(t!=-1&&e.selectedItems.push(updatedRecords[t]),f._prevSelectedItem=updatedRecords[t],e.allowSelection&&r.TreeGrid.getRowByIndex(f,t).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"),updatedRecords[t]&&(updatedRecords[t].isSelected=!0,e.selectedItem=updatedRecords[t]),f._prevSelectedItem&&f._prevSelectedItem!=e.selectedItem&&(f._prevSelectedItem.isSelected=!1))}e.selectedItems.length&&e.selectedItems.indexOf(updatedRecords[t])!=-1?(f._prevSelectedItem=updatedRecords[t],this.selectedRowIndex()!=t&&this.selectedRowIndex(t)):e.selectedItems.length==0&&this.selectedRowIndex()!=-1?this.selectedRowIndex(-1):this.selectedRowIndex(e.updatedRecords.indexOf(e.selectedItems[e.selectedItems.length-1]))}else if(e.selectionSettings.selectionType==r.TreeGrid.SelectionType.Multiple)for(f.clearSelection(-1),f.selectedRowIndex(t),e.selectedItem=e.updatedRecords[t],s=0,c=t-i<0?updatedRecords.slice(t,i+1):updatedRecords.slice(i,t+1),s;s<c.length;s++)f.getExpandStatus(c[s])&&(c[s].isSelected=!0,p=updatedRecords.indexOf(c[s]),h=r.TreeGrid.getRowByIndex(f,p),this._frozenColumnsLength?(a=n(h[0]).add(h[1]),h=h[0]):a=h,a&&n(a).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"));return e.selectedItems=f.getSelectedRecords(),f._multiSelectCtrlRequest=!1,e.isFromGantt&&f._cancelSaveTools(),!1}},getSelectedRecords:function(){var i=this,t=this.model,n=[];return n=t.updatedRecords.filter(function(n){return n.isSelected}),n.slice()},clearAllSelection:function(){var t=this,i=this.model;t.model.allowSelection&&t.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&t._clearMultiSelectPopup();t.selectRows(-1);i.selectedItem=null;t._selectedCellDetails=[];i.selectedCellIndexes=[];t._rowIndexOfLastSelectedCell=-1;t._lastSelectedCellIndex=-1;t._focusingRowIndex=-1;n("#"+t._id).find(".selectingcell").removeClass("selectingcell");t._cancelSaveTools()},getCellIndex:function(t,i){var r=n(t.target),u=-1,h=this.model,f;if(i&&(r=n(i)),r.hasClass("e-detailsrowcell")||r.closest("td").hasClass("e-detailsrowcell"))return-1;if(r.prop("tagName")=="TD")u=r.index();else if(r.prop("tagName")=="DIV"&&r.hasClass("e-cell"))f=r.closest("td"),u=f.index();else if(r.prop("tagName")=="DIV"&&n(r.closest("td")[0]).hasClass("e-templatecell"))f=r.closest("td"),u=f.index();else if(n(r.closest("td")[0]).hasClass("e-templatecell")&&n(r.closest("tr")[0]).hasClass("e-templaterow"))f=r.closest("td"),u=f.index();else if(r.parent().prop("tagName")=="TD")f=r.closest("td"),u=r.parent().index();else if(r.prop("tagName")=="TH"||r.prop("tagName")=="DIV"&&n(r.closest("th")[0]).css("cursor")=="col-resize"){var e=r.prop("tagName")=="TH"?n(r):r.closest("th"),o=r[0].getBoundingClientRect(),s=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft;u=this._orgX<o.left+5+s?e.prevAll(":visible:first")[0].cellIndex:e.index()}else r.closest("td.e-rowcell").length>0&&(f=r.closest("td.e-rowcell"),u=f.index());return u!=-1&&this._frozenColumnsLength>0&&(r.closest(".e-movablecontentdiv").length>0||r.closest(".e-movableheaderdiv").length>0||r.closest(".e-movablefooterdiv").length>0)&&(u+=this._frozenColumnsLength),u},getRowIndex:function(t){var e=this,i=n(t.target),r=e.getRows(),u=-1,o=this.model,f;return i.closest(".e-gridcontainer").length>0&&(this._frozenColumnsLength>0&&(i.closest(".e-frozencontentdiv").length>0||i.closest(".e-frozencontainer").length>0?r=n(r[0]):(i.closest(".e-movablecontentdiv").length>0||i.closest(".e-movablecontainer").length>0)&&(r=n(r[1]))),u=r.index(i),u==-1&&(f=i.closest("tr"),u=r.index(f))),u},_cancelEditState:function(n){var t=this,i;r.isNullOrUndefined(n)||(r.isNullOrUndefined(n.target)||n.stopImmediatePropagation(),i=t.getScrollElement().ejScroller("option","scrollLeft"),headerScrollLeft=0,headerScrollLeft=this._frozenColumnsLength>0?t._$gridHeaderContainer.find("#e-movableheader"+this._id).scrollLeft():t._$gridHeaderContainer.scrollLeft(),i!=headerScrollLeft&&(t.getScrollElement().ejScroller("option","scrollLeft",headerScrollLeft),t.model.showTotalSummary&&t._$footerContainer&&(this._frozenColumnsLength>0?t._$footerContainer.find("#e-movablefooter"+this._id).scrollLeft(headerScrollLeft):t._$footerContainer.scrollLeft(headerScrollLeft))));t.model.isEdit?t.cancelEditCell():t._isRowEdit&&t.cancelRowEditCell()},cancelEditCell:function(){var t=this,e=t.model,i,s=t.model.selectedItem,u,r=t._cellEditingDetails.columnIndex,f={},o=e.columns[r];if(e.isFromGantt&&!e.isEdit)return!0;f={columnName:o.field,value:t.getCurrentEditCellData(),data:t._cellEditingDetails.data,previousValue:t._cellEditingDetails.cellValue,columnObject:o};this._frozenColumnsLength>0?this._frozenColumnsLength<=t._cellEditingDetails.columnIndex?(r=t._cellEditingDetails.columnIndex-this._frozenColumnsLength,i=n(t.getRows()[1])[t._cellEditingDetails.rowIndex],n(i).hasClass("e-editedrow")&&n(i).removeClass("e-editedrow"),u=i.cells[r],n(u).removeClass("e-editedcell").empty().html(n(n.render[t._id+"_Template"](f.data))[0].cells[r].innerHTML)):(i=n(t.getRows()[0])[t._cellEditingDetails.rowIndex],n(i).hasClass("e-editedrow")&&n(i).removeClass("e-editedrow"),u=i.cells[r],n(u).removeClass("e-editedcell").empty().html(n(n.render[t._id+"_JSONFrozenTemplate"](f.data))[0].cells[r].innerHTML)):(i=n(t.getRows())[t._cellEditingDetails.rowIndex],n(i).hasClass("e-editedrow")&&n(i).removeClass("e-editedrow"),u=i.cells[r],n(u).removeClass("e-editedcell").empty().html(n(n.render[t._id+"_Template"](f.data))[0].cells[r].innerHTML));t._cellEventTrigger(n(u)[0],f.data,f.columnObject);t.model.isEdit=!1;t._cancelSaveTools();t._trigger("refresh")},_destroyWidgetElements:function(){var r=this,e=this.model,u=e.columns,o=u.length,f,t;for(i=0;i<o;i++)f=r._getFieldValue(u[i].field,i),t=n("#"+r._id+f),t.data("ejWidgets")&&t[t.data("ejWidgets")[0]]("destroy")},cancelRowEditCell:function(){var t=this,u=this.model,e=u.editSettings.allowDeleting,f=n(document.getElementById(t._id+"EditForm")),i,o=n("#"+t._id+"EditFrozenForm"),r;(f.length>0&&this._destroyWidgetElements(),i=n(f.closest("tr")),r=o.closest("tr"),rowIndex=t.getIndexByRow(i),data=u.currentViewData[rowIndex],rowIndex!=-1||f.length!=0)&&(i.hasClass("e-addedrow")&&(t.model.editSettings.allowDeleting||(t.model.editSettings.allowDeleting=!0)),i.hasClass("e-editedrow")?(i.removeClass("e-editedrow").empty().html(n(n.render[t._id+"_Template"](data))[0].innerHTML),r.length>0&&r.removeClass("e-editedrow").empty().html(n(n.render[t._id+"_JSONFrozenTemplate"](data))[0].innerHTML),t._rowEventTrigger(i,data)):i.hasClass("e-rowedit")?(i.removeClass("e-rowedit").empty().html(n(n.render[t._id+"_Template"](data))[0].innerHTML),r.length>0&&r.removeClass("e-rowedit").empty().html(n(n.render[t._id+"_JSONFrozenTemplate"](data))[0].innerHTML),t._rowEventTrigger(i,data)):i.hasClass("e-addedrow")&&(t._isRefreshAddedRecord=!1,t._isEmptyRow=!0,t._checkboxSelection?t.deleteRow(null,!0,null):t.deleteRow(),t._isEmptyRow=!1),u.isEdit=t._isRowEdit=!1,u.editSettings.allowDeleting=e,t._cancelSaveTools(),t._trigger("refresh"))},refreshRow:function(t){var i=this,u=i.model,e=u.allowPaging?i._updatedPageData:u.updatedRecords,f=e[t],o=i.getIndexByRow(n("#"+i._id+"EditForm").closest("tr"));(u.enableVirtualization||u.allowPaging)&&(t=u.currentViewData.indexOf(f));f&&t>-1&&(r.TreeGrid.refreshRow(this,t),o==t&&(i._isRowEdit=i.model.isEdit=!1,i._cancelSaveTools()))},_refreshDetailsRow:function(t){var i=this,o=this.model,r=i.model.currentViewData[t],u={},f,e;r&&(u=this._frozenColumnsLength>0?n(i.getRows()[1]):n(i.getRows()),f=n(u[t]).next("tr"),f.hasClass("e-detailsrow")&&(f.remove(),e=n(n.render[i._id+"_detailRowTemplate"](r)),n(u[t]).after(e),i.setGridRows(n(i.getContentTable().get(0).rows)),this._gridRows=this.getContentTable().get(0).rows,this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]),i._trigger("refresh"),o.detailsDataBound&&this._trigger("detailsDataBound",{detailsElement:e,data:r})))},_refreshedCellEventTrigger:function(t){var f=this,i=this.model,o;if(i.queryCellInfo!=null||i.rowDataBound!=null||i.detailsDataBound!=null){i.rowDataBound!=null&&f._trigger("rowDataBound",{rowElement:t.rowElement,data:t.data});var u=t.rowElement.cells,s=n(t.rowElement).find(".e-rowcell"),r=0,h=u.length,e=null,c=f.model.columns;if(i.queryCellInfo!=null)for(r;r<h;r++)n(u[r]).hasClass("e-rowcell")&&(e=c[s.index(u[r])]),e&&f._cellEventTrigger(u[r],t.data,e);i.detailsDataBound&&n(t.rowElement).next("tr").hasClass("e-detailsrow")&&(o=n(t.rowElement).next("tr"),this._frozenColumnsLength>0&&(o=n(o[1])),this._trigger("detailsDataBound",{detailsElement:n(t.rowElement).next("tr"),data:t.data}))}},_refreshGridPager:function(){if(this.getPager()!=null){var n=this,i=n.model,r=this.getPager().ejPager("model"),t={};if(t.currentPage=this._currentPage(),i.currentViewData.length==0&&i.updatedRecords.length>0&&r.totalPages!=1){n.gotoPage(t.currentPage-1);return}t.totalRecordsCount=n._gridRecordsCount;this.getPager().ejPager("option",t).ejPager("refreshPager");r=this.getPager().ejPager("model");i.pageSettings.totalPages=r.totalPages;n._updatePagerTextAlignment()}},_getVisibleChildRecordCount:function(n,t,i){var e=this,o=this.model,u,f,r;if(n.hasChildRecords)for(u=n.childRecords,f=u.length,r=0;r<f;r++)i.indexOf(u[r])!==-1&&t++,u[r].hasChildRecords&&(t=e._getVisibleChildRecordCount(u[r],t,i));else i.indexOf(n)!==-1&&t++;return t},_renderAddedRow:function(n,t){var i=this,f=this.model,u;i._updateCurrentViewData();f.enableVirtualization||f.allowPaging?(i.updateAltRow(),u={},u.requestType=r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(u)):i.renderNewAddedRow(n,t);i.updateHeight()},renderNewAddedRow:function(t,i){var u=this,y=this.model,f=u.getRows(),h=n.render[this._id+"_Template"](i),e=this._frozenColumnsLength>0,o,c,s,l,a,v;e&&(f=n(u.getRows()[1]),c=n(u.getRows()[0]),o=n.render[this._id+"_JSONFrozenTemplate"](i));!r.isNullOrUndefined(f)&&f.length>0?f.length==t?(s=f.eq(t-1),e&&(l=c.eq(t-1)),n(s).next("tr").hasClass("e-detailsrow")?(n(s).next("tr").after(h),e&&n(l).next("tr").after(o)):(n(s).after(h),e&&n(l).after(o))):(f.eq(t).before(h),e&&c.eq(t).before(o)):this._frozenColumnsLength>0?u._renderFrozenRecords():(u.getContentTable().find("tbody").empty().append(u._getEmptyTbody()),a=document.createElement("div"),u.getContentTable().find("colgroup").first().replaceWith(u._getMetaColGroup()),v=u.getContentTable().children("tbody"),v.empty(),a.innerHTML=["<table>",n.render[u._id+"_Template"](u.model.currentViewData),"<\/table>"].join(""),u.getContentTable().get(0).replaceChild(a.firstChild.firstChild,u.getContentTable().get(0).lastChild));this._gridRows=this.getContentTable().get(0).rows;this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]);u.setGridRows(n(u.getContentTable().get(0).rows))},onScrollHelper:function(n,t){var i=this,r;i._isFromChart=t;i.getScrollElement().ejScroller("scrollY",n,!0);r=i.getScrollElement().ejScroller("isHScroll");!r&&this.model.isFromGantt&&i.getScrollElement().scrollTop(n)},isVScroll:function(){return this.getScrollElement().hasClass("e-scroller")?this.getScrollElement().ejScroller("isVScroll"):!1},refreshScroller:function(n){var t=this,f,i,r,u;t._$gridContent.removeClass("e-borderbox");f=t.getScrollElement().ejScroller("option","scrollTop");i=t.getScrollElement().ejScroller("option","scrollLeft");t.getScrollElement().ejScroller("option",{persist:!0});t.getScrollElement().ejScroller("option",{width:n});r=t.getMaxScrollWidth();i>r&&(i=r>0?r:0);t._$gridContent.css("height",t._viewPortHeight);t.getScrollElement().ejScroller("refresh");u=t.getScrollElement().ejScroller("isHScroll");t.model.isFromGantt&&u&&t._$gridContent.removeClass("e-borderbox");t.getScrollElement().ejScroller("option",{scrollTop:f});u&&t.getScrollElement().ejScroller("option",{scrollLeft:i});t._$gridHeaderContainer.scrollLeft(i);u?this.getScrollElement().scrollTop(0):this.getScrollElement().scrollTop(f)},getMaxScrollHeight:function(){var n=this;return n.getScrollElement().children(".e-content").children().height()-this.getScrollElement().children(".e-content").height()},getMaxScrollWidth:function(){var n=this;return n.getScrollElement().children(".e-content").children(".e-gridcontainer").children(".e-table").width()-this.getScrollElement().children(".e-content").width()},refreshHeight:function(){var n=this;n.getScrollElement().ejScroller("refresh")},getColumnByHeaderText:function(n){for(var r=this,u=r.model.columns.length,i=r.model.columns,t=0;t<u;t++)if(i[t].headerText==n)break;return t==i.length?null:i[t]},hideColumn:function(t){var i=this,f=i.model,c=this.getColumnByHeaderText(t),u=n.inArray(c,f.columns),k=n.inArray(t,i._hiddenColumns),l,y,p,s,v,e,b;if(!c||i._isColumnHidable(c)){if(u!=-1&&u!=f.treeColumnIndex&&k==-1){i._cancelEditState();i._hiddenColumns.push(t);i.model.columns[u].visible=!1;i.getHeaderTable().removeClass("e-table");i.getContentTable().removeClass("e-table");l=i.getHeaderTable().find("colgroup").find("col");n(l).eq(u).hide();y=i.getHeaderTable().find("thead").find("th.e-headercell");n(y).eq(u).addClass("e-hide");f.allowFiltering&&f.filterSettings.filterType=="filterbar"&&(p=i.getHeaderTable().find("thead").find("th.e-filterbarcell"),n(p).eq(u).addClass("e-hide"));var h=i.getContentTable().find("colgroup").find("col"),w=!0,a=u,o;n(h).eq(u).hide();h=i.getRows();o=this._getFooterRows();this._frozenColumnsLength>0?u<this._frozenColumnsLength?(h=n(i.getRows()[0]),o=n(o[0]),i._gridRows&&n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s-1))):(h=n(i.getRows()[1]),o=n(o[1]),w=!1,a=u-this._frozenColumnsLength,i._gridRows&&n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s-1))):i._gridRows&&n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s-1));h.each(function(){var t=n(this).children("td").eq(a);n(t).addClass("e-hide");f.showSummaryRow&&n(t).hasClass("e-summaryrowcell")&&w&&i._updateSummaryRowTitleCell(l,t[0].parentElement)});f.showTotalSummary&&(v=i._$footertableContent.find("colgroup").find("col"),n(v).eq(u).hide(),o.each(function(){var t=n(this).children("td").eq(a);n(t).addClass("e-hide");n(t).hasClass("e-footersummaryrowcell")&&i._updateSummaryRowTitleCell(v,t[0].parentElement)}));i.getHeaderTable().addClass("e-table");i.getContentTable().addClass("e-table");e=i.getScrollElement();f.isFromGantt&&(b=e.ejScroller("isHScroll"),b?e.removeClass("e-borderbox"):e.addClass("e-borderbox"));f.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||f.isFromGantt||this._updateTableWidth();e.ejScroller("refresh");i._updateScrollCss();i._updateHeaderScrollLeft();f.isFromGantt&&!e.ejScroller("isHScroll")&&e.scrollTop(e.data("ejScroller").scrollTop());u=n.inArray(t,i._visibleColumns);u!=-1&&i._visibleColumns.splice(u,1);f.showColumnChooser&&(i._renderColumnChooserList(!0,t),i._updateColumnMenuVisibility());i._addInitTemplate()}f.isFromGantt&&i.updateToGanttColumns()}},clearFilter:function(t){var i=this,e=i.model,u,s,f,o;if(r.isNullOrUndefined(t))for(u=e.filterSettings.filteredColumns,s=u&&u.length;u&&u.length>0;)i.clearFilter(u[0].field);else f=i.getColumnByField(t),o=n.grep(e.filterSettings.filteredColumns,function(n){return n.field===t}),f&&o.length>0&&(e.filterBarMode=="immediate"&&f.filterEditType=="numericedit"||(i._searchString="",i._fieldName="",i.filterColumn(t,"equal","","and"),i._storePreviousFilteredValue(i._fieldName,i._searchString,this._operator)),i._clearFilterElementValue(f))},getColumnByField:function(n){for(var r=this,u=r.model,i=u.columns,t=0;t<i.length;t++)if(i[t].field==n)break;return t==i.length?null:i[t]},_clearFilterElementValue:function(t){var r=this,u=t.field.split(".").join(""),i=n("#"+r._id+"_"+u+"_filterbarcell");switch(t.filterEditType){case"stringedit":n(i).val("");break;case"booleanedit":n(i).prop("checked",!1);break;case"numericedit":n(i).ejNumericTextbox("instance").option("value","");break;case"dropdownedit":n(i).ejDropDownList("instance").option("value","");break;case"datepicker":n(i).ejDatePicker("instance").option("value","");break;case"datetimepicker":n(i).ejDateTimePicker("instance").option("value","")}},_updateSummaryRowTitleCell:function(t,i){for(var u,f,e=t.length,r=0;r<e;r++)if(n(t[r]).css("display")!="none"){if(u=n(i).find(".e-summarytitle")[0],f=n(i.childNodes[r]).find(".e-summarytitle")[0],f)return;n(i.childNodes[r]).append(u);return}},showColumn:function(t){var i=this,f=i.model,b=this.getColumnByHeaderText(t),u=n.inArray(b,f.columns),k=n.inArray(t,i._visibleColumns),c,v,y,s,a,e,w;if(u!=-1&&k==-1){i._cancelEditState();i._visibleColumns.push(t);i.model.columns[u].visible=!0;c=i.getHeaderTable().find("colgroup").find("col");n(c).eq(u).show();v=i.getHeaderTable().find("thead").find("th.e-headercell");n(v).eq(u).removeClass("e-hide");f.allowFiltering&&f.filterSettings.filterType=="filterbar"&&(y=i.getHeaderTable().find("thead").find("th.e-filterbarcell"),n(y).eq(u).removeClass("e-hide"));var h=i.getContentTable().find("colgroup").find("col"),p=!0,l=u,o;n(h).eq(u).show();h=i.getRows();o=this._getFooterRows();this._frozenColumnsLength>0?u<this._frozenColumnsLength?(h=n(i.getRows()[0]),o=n(o[0]),i._gridRows&&n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s+1))):(h=n(i.getRows()[1]),o=n(o[1]),p=!1,l=u-this._frozenColumnsLength,i._gridRows&&n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s+1))):i._gridRows&&n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(s=parseInt(n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),n(i.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",s+1));h.each(function(){var t=n(this).children("td").eq(l);n(t).removeClass("e-hide");f.showSummaryRow&&n(t).hasClass("e-summaryrowcell")&&p&&i._updateSummaryRowTitleCell(c,t[0].parentElement)});f.showTotalSummary&&(a=i._$footertableContent.find("colgroup").find("col"),n(a).eq(u).show(),o.each(function(){var t=n(this).children("td").eq(l);n(t).removeClass("e-hide");n(t).hasClass("e-footersummaryrowcell")&&i._updateSummaryRowTitleCell(a,t[0].parentElement)}));i._addInitTemplate();e=i.getScrollElement();f.isFromGantt&&(w=e.ejScroller("isHScroll"),w?e.removeClass("e-borderbox"):e.addClass("e-borderbox"));f.columnResizeSettings.columnResizeMode!=r.TreeGrid.ColumnResizeMode.FixedColumns||f.isFromGantt||this._updateTableWidth();e.ejScroller("refresh");i._updateScrollCss();i._updateHeaderScrollLeft();f.isFromGantt&&!e.ejScroller("isHScroll")&&e.scrollTop(e.data("ejScroller").scrollTop());u=n.inArray(t,i._hiddenColumns);u!=-1&&i._hiddenColumns.splice(u,1);f.showColumnChooser&&(i._renderColumnChooserList(!0,t),i._updateColumnMenuVisibility())}f.isFromGantt&&i.updateToGanttColumns()},getHiddenColumns:function(){for(var n=this,f=n.model,i=n._hiddenColumns,u=i.length,r=[],t=0;t<u;t++)r.push(n.getColumnByHeaderText(i[t]));return r},getColumnByIndex:function(n){var i=this,r=i.model,t=r.columns;return t.length>n?t[n]:null},getVisibleColumns:function(){for(var n=this,f=n.model,i=n._visibleColumns,u=i.length,r=[],t=0;t<u;t++)r.push(n.getColumnByHeaderText(i[t]));return r},cancelEdit:function(){this._isRowEdit?this.cancelRowEditCell():this.model.isEdit&&this.cancelEditCell()},redraw:function(){this.resetModelCollections();this._clearColumnMenu();this._clearContextMenu();this._removeDetailsRow();this.element.empty();this.element.off();var u=jQuery.uaMatch(navigator.userAgent),t=this,i=this.model;t._off(t.element,"click",t._onClick);t._off(t.element,"keydown",t._keyDown);t._off(t.element,"click","#"+t._id+"e-gridheader",t._onHeaderClick);t._off(t.element,"mousedown touchstart","#"+t._id+"e-gridheader",t._headerMouseDown);t._off(n(document),"mousedown touchstart",t._mouseDownHandler);t._off(t.element,"mousedown touchstart",".e-gridcontent",t._contentMouseDown);t._off(t.element,"click",t._onRecordClick);i.filterSettings.filterBarMode=="immediate"&&(t._off(t.element,"keyup",".e-filterbarcell input",t._filterBarHandler),t._off(t.element,"click",".e-filterbarcell .e-checkbox")._off(t.element,"click",".e-filterbarcell .e-checkbox",t._filterBarHandler));t._off(t.element,"focus click",".e-filterbarcell input",t._filterBarClose);t._off(t.element,"click",".e-filterbarcell .e-cancel",t._filterBarClose);t.model.showGridCellTooltip&&!t.model.showGridExpandCellTooltip?r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover):t._off(t.element,"mousemove",".e-rowcell",t._mouseHover):t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover);t.model.showGridCellTooltip&&(r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-headercelldiv",t._headermouseHover):t._off(t.element,"mousemove",".e-headercelldiv",t._headermouseHover));t._off(t.element,"mouseleave",".e-rowcell",t._cellMouseLeave);t._off(t.element,"mouseleave",t._cellMouseLeave);t._off(t.element,"mouseleave",".e-headercelldiv",t._headerMouseLeave);t._off(t.element,"mouseleave",t._headerMouseLeave);(i.isFromGantt||this._frozenColumnsLength)&&t._off(t.element,"mousewheel DOMMouseScroll",t._mouseWheel);i.enableResize&&i.isResponsive&&!i.isFromGantt&&t._off(n(window),"resize",t._windowResize);r.isTouchDevice()?t._off(t.element,"doubletap ",".e-gridcontent",t._editdblClickHandler):t._off(t.element,"dblclick ",".e-gridcontent",t._editdblClickHandler);i.contextMenuSettings.showContextMenu&&t._off(t.element,"keyup",this._preventContextMenu);this._init()},clearColumnMenu:function(){var n=this;n._clearColumnMenu()},"export":function(t,i,u){var f=this,s=f.model,o,h,e,c,l,a,v,y;return f.contextMenuOperations("Cancel"),o=f._getExportModel(s),h={action:t,method:"post","data-ajax":"false"},n("form#"+f._id+"export").remove(),e=r.buildTag("form#"+f._id+"export","",null,h),r.raiseWebFormsServerEvents?(c={model:o,originalEventType:i},l={model:JSON.stringify(o)},r.raiseWebFormsServerEvents(i,c,l)):(a={},u?n("body").find(".e-treegrid").each(function(t,i){var o=n(i).data("ejTreeGrid"),l,u,h,c;r.isNullOrUndefined(o)||(l=o.model,u=f._getExportModel(s),a[t]=JSON.stringify(u),h={name:"TreeGridModel",type:"hidden",value:JSON.stringify(u)},c=r.buildTag("input","",null,h),e.append(c))}):(v={name:"TreeGridModel",type:"hidden",value:JSON.stringify(o)},y=r.buildTag("input","",null,v),e.append(y),e.append(this)),n("body").append(e),e.submit()),!0},_getExportModel:function(t){var h=this,r=t,l=r.updatedRecords,a=r.currentViewData,v=r.flatRecords,y=r.parentRecords,p=r.summaryRowRecords,w=r.selectedItem,b=r.selectedItems,e,s,c,i;delete r.updatedRecords;delete r.currentViewData;delete r.flatRecords;delete r.parentRecords;delete r.summaryRowRecords;delete r.selectedItem;delete r.selectedItems;e=n.extend(!0,{},r);r.updatedRecords=l;r.currentViewData=a;r.flatRecords=v;r.parentRecords=y;r.selectedItem=w;r.selectedItems=b;r.summaryRowRecords=p;var f=e.columns,k=f.length,o=e.filterSettings.filteredColumns,d=o.length;for(i=0;i<k;i++){if(e.columns[i].editType!=u)switch(f[i].editType){case"stringedit":case"edittemplate":f[i].editType="string";break;case"numericedit":f[i].editType="numeric";break;case"dropdownedit":f[i].editType="dropdown";break;case"booleanedit":f[i].editType="boolean"}if(f[i].filterEditType!=u)switch(f[i].filterEditType){case"stringedit":f[i].filterEditType="string";break;case"numericedit":f[i].filterEditType="numeric";break;case"dropdownedit":f[i].filterEditType="dropdown";break;case"booleanedit":f[i].filterEditType="boolean"}}for(i=0;i<d;i++)o[i].operator=="equal"?o[i].operator="equals":e.filterSettings.filteredColumns[i].operator=="notequal"&&(o[i].operator="notequals");if(s=h.ignoreOnExport,c=s.length,h.ignoreOnExport)for(i=0;i<c;i++)delete e[s[i]];return e},_getNonContentHeight:function(){var t=this,f=t.model,i=0,u=0;return u=t.model.isFromGantt?0:1,i=t._$gridHeaderContent.outerHeight()+parseFloat(u),t.model.toolbarSettings.showToolbar&&(i+=r.isNullOrUndefined(n("#"+t._id+"_toolbarItems").outerHeight())?0:n("#"+t._id+"_toolbarItems").outerHeight()),f.allowPaging&&(i+=t.element.find(".e-pager").outerHeight()),i},_getViewPortHeight:function(){return this.element.height()-this._getNonContentHeight()},updateViewPortHeight:function(){var n=this;n._viewPortHeight=n._getViewPortHeight()},_updateScrollCss:function(){var n=this,t=n.model,i;if(!t.isFromGantt){var u=n.isVScroll(),f=n._$gridHeaderContent.hasClass("e-scrollcss"),r=/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor);r&&n._$gridHeaderContent.removeClass("e-gridheader");u?(this.mobileDevice()||n._$gridHeaderContent.addClass("e-scrollcss"),t.showTotalSummary&&n._$totalSummaryRowContainer&&n._$totalSummaryRowContainer.outerHeight()<90&&(this.mobileDevice()||n._$totalSummaryRowContainer.addClass("e-scrollcss"),this.mobileDevice()?n._$totalSummaryRowContainer.width(n._$gridContent.width()):n._$totalSummaryRowContainer.width(n._$gridContent.width()-17))):(n._$gridHeaderContent.removeClass("e-scrollcss"),t.showTotalSummary&&n._$totalSummaryRowContainer&&n._$totalSummaryRowContainer.outerHeight()<90&&(n._$totalSummaryRowContainer.removeClass("e-scrollcss"),n._$totalSummaryRowContainer.width(n._$gridContent.width())));this._updateHeaderScrollLeft(this.getScrollElement().ejScroller("model.scrollLeft"));this._frozenColumnsLength&&(i=this.getContent().find("#e-movablecontent"+n._id).height(),i!=this.getContent().find("#e-frozencontainer"+n._id).height()&&this.getContent().find("#e-frozencontainer"+n._id).height(i));r&&(n._$gridHeaderContent[0].style.width=n._gridWidth+"px",n._$gridHeaderContent.addClass("e-gridheader"));n._resizeFilteringElements()}},_updatePagerIndex:function(){var n=this,u=n.model,h=[],i=-1,f=-1,e=u.updatedRecords,t,l,a;if(u.allowPaging){if(t=u.pageSettings.pageSize,u.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root){var c=u.parentRecords.slice(),o=-1,s=-1;n._gridRecordsCount=c.length;l=n._gridRecordsCount<1?0:t==0?0:Math.ceil(n._gridRecordsCount/t);n._currentPage()>l&&n._currentPage(l);o=n._currentPage()*t>n._gridRecordsCount?n._gridRecordsCount:n._currentPage()*t;s=n._gridRecordsCount<=t?0:n._currentPage()*t-t;i=e.indexOf(c[o]);s>o?s=o-t:n._gridRecordsCount==o&&(i=e.length);f=e.indexOf(c[s]);n._updatedPageData=this.getExpandedRecords(e.slice(f,i))}else h=this.getExpandedRecords(e),n._gridRecordsCount=u.enableVirtualization?e.length:h.length,a=n._gridRecordsCount<1?0:t==0?0:Math.ceil(n._gridRecordsCount/t),n._currentPage()>a&&n._currentPage(a),i=n._currentPage()*t>n._gridRecordsCount?n._gridRecordsCount:n._currentPage()*t,f=n._gridRecordsCount<t?0:n._currentPage()*t-t,f>i&&(f=i-t),n._updatedPageData=h.slice(f,i);n.updateHeight()}},_updateCurrentViewData:function(t){var i=this,u=i.model,o={},f,s=!1,h,e;u.enableVirtualization?(u.allowPaging?(t!=r.TreeGrid.Actions.Scroll&&i._updatePagerIndex(),i.getVisibleRange(),u.currentViewData=u.sizeSettings.height?i._updatedPageData.slice(i._visibleRange.top,i._visibleRange.bottom):i._updatedPageData):(i.getVisibleRange(),u.currentViewData=i.model.updatedRecords.slice(i._visibleRange.top,i._visibleRange.bottom)),u.allowDragAndDrop&&i._dragMouseDown&&(r.browserInfo().name=="chrome"||r.isTouchDevice())&&(h=i.getUpdatedRecords(),e=h.indexOf(i._draggedRecord),(i._visibleRange.top>e||i._visibleRange.bottom<e)&&(i._dummyElement||(n(document.body).append(i._draggedElement),i._dummyElement=!0,n(i._draggedElement).hide()))),i._vScrollDist!==0&&(f=i._scrollTop-i._offset,o.requestType=t&&t==r.TreeGrid.Actions.Scroll?r.TreeGrid.Actions.Scroll:r.TreeGrid.Actions.Refresh,i.sendDataRenderingRequest(o),s=!0,this._frozenColumnsLength>0?(i._$frozenTableContent.css({top:f}),i._$movableTableContent.css({top:f})):i._$tableContent.css({top:f})),i._prevRTop=i._visibleRange.top,i._prevRBottom=i._visibleRange.bottom):u.allowPaging?(i._updatePagerIndex(),u.currentViewData=i._updatedPageData):u.currentViewData=i.model.updatedRecords.slice();i._isEnterKeyPressed&&(i._isEnterKeyPressed=!1,u.allowSelection&&u.editSettings.allowEditing&&(s||(i._cellEditingDetails.rowIndex+=1),i._rowSelectingEventTrigger(this.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex)),i.cellEdit(i._cellEditingDetails.rowIndex,i.model.columns[i._cellEditingDetails.columnIndex].field)))},_getRowPosition:function(n){return Math.ceil(n/(this.model.rowHeight+this._detailsRowHeight))},_getMetaColGroup:function(){return this.getHeaderTable().find("colgroup").clone()},_getEmptyTbody:function(){var t=this,i=r.buildTag("td",t.model.emptyRecordText,{},{colSpan:t.model.columns.length});return n(document.createElement("tr")).append(i)},_addSortElementToColumn:function(t,i){var u=this,s=this.model,e,o,f;e=s.isFromGantt?r.TreeGrid.getColumnByMappingName(u.model.columns,t):r.TreeGrid.getColumnByField(u.model.columns,t);o=n.inArray(e,u.model.columns);f=u.getHeaderTable().find("thead").find(".e-headercell").eq(o).find(".e-headercelldiv");f.find(".e-ascending,.e-descending").remove();f.append(u._createSortElement().addClass("e-"+i).addClass("e-icon"));f.parent().attr("aria-sort",i)},_createSortElement:function(){return r.buildTag("span"," ")},_renderCellEditObject:function(t,i){var f=this,a=r.buildTag("form.#"+f._id+"EditForm","",{},{}),v=f._cellEditTemplate,u,l,o={},e=t.columnObject,s=e.field.split(".").join(""),c=t.value,h;e.editType=="dropdownedit"&&c==!1&&(c=c.toString());o[s]=c;columnIndex=f.getColumnIndexByField(e.field);i.empty();i.addClass("e-validError");l=v.find("#"+s+"_CellEdit").html();u=e.field==="predecessor"||e.field==="duration"?n(n.templates(l).render(t.data)):n(n.templates(l).render(o));u.get(0).tagName=="SELECT"&&(u.val(o[s]),u.val()==null&&u.val(u.find("option").first().val()));u.get(0).tagName=="INPUT"&&f.model.isFromGantt?e.field!="predecessor"&&e.field!="duration"&&u.val(o[s]):u.get(0).tagName=="INPUT"&&u.val(o[s]);a.append(u);i.append(a);f._setoffsetWidth();h={};h.columnIndex=t.columnIndex;h.data=t.data.item;h.requestType="beginEdit";f._refreshEditForm(h);n.isFunction(n.validator)&&!n.isEmptyObject(t.validationRules)&&(f._initValidator(),f.setValidation());f.model.isEdit=!0},_setoffsetWidth:function(){var u=this,f=u.model,t,e=n("#"+u._id+"EditForm"),h=n("#"+u._id+"EditFrozenForm"),r=0,o=u._cellEditingDetails.rowIndex,s,i;for(t=f.editSettings.editMode.toLowerCase()!="cellediting"||u._isRowEdit?h.add(e).find("tr").find(".e-rowcell"):e.closest("td"),s=t.length,r;r<s;r++)i=n(t.children()[0]).children(),u._tdsOffsetWidth[r]=i.length>1?f.currentViewData[o].level==0&&f.currentViewData[o].hasChildRecords?n(t.get(r)).width()-(n(t.children()[0]).outerWidth()-n(t.children()[0]).width())-i[0].offsetWidth-i[2].offsetWidth-(n(i[3]).outerWidth()-n(i[3]).width()):n(t.get(r)).width()-(n(t.children()[0]).outerWidth()-n(t.children()[0]).width())-i[0].offsetWidth-i[1].offsetWidth-(n(i[3]).outerWidth()-n(i[3]).width()):n(t.get(r)).width()},getIndexofresourceInfo:function(n){var u=this,o=u.model,f=o.resourceIdMapping,s=u._cellEditingDetails.data,r=s.resourceInfo,i=0,h=r&&r.length,e=[],t;for(i;i<h;i++)for(t=0;t<n.length;t++)n[t][f]==r[i][f]&&e.push(t);return e},_refreshEditForm:function(t){var s=this,b,c,rt,a,g,ot,nt,tt,h,it,v;s.model.editSettings.allowEditing&&s.model.editSettings.editMode=="dialogEditing"?(b=n("#"+s._id+"EditFormDialog"),c="",rt=!0):(b=n("#"+s._id+"EditForm"),c=s.model.rowHeight-5);var st=n("#"+s._id+"EditFrozenForm"),ut=!1,ft=st.add(b).find("input,select,textarea"),y=0,ht=ft.length,f,l,o=s.model,et,i={},k,e,p,w,d;for(y;y<ht;y++)if(f=ft.eq(y),d=f.attr("edittype"),e=r.TreeGrid.getColumnByField(o.columns,f.prop("name")),r.isNullOrUndefined(e)&&s.model.editSettings.editMode=="dialogEditing"){if(f.hasClass("e-btn")||s.model.editSettings.editMode=="dialogEditing"&&!r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)&&o.editSettings.dialogEditorTemplateID!="")return;f.closest("tr").addClass("e-hide")}else{s.model.editSettings.editMode!="dialogEditing"||r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)||o.editSettings.dialogEditorTemplateID==""||(d=e.editType);l="100%";switch(d){case r.TreeGrid.EditingType.Numeric:i={};et=l;k=f.val();i.width=et;i.locale=o.locale;i.height=c;i.showSpinButton=!0;i.cssClass=o.cssClass;k.length&&(i.value=parseFloat(k));o.isFromGantt&&e.field==="status"&&(i.minValue=0,i.maxValue=100,i.decimalPlaces=0);r.isNullOrUndefined(e.editParams)||n.extend(i,e.editParams);f.ejNumericTextbox(i);f.prop("name",f.prop("name").replace(s._id,""));break;case r.TreeGrid.EditingType.DatePicker:i={};i.width=l;i.height=c;i.locale=o.locale;i.cssClass=o.cssClass;i.dateFormat=o.dateFormat;i.enableStrictMode=!0;o.isFromGantt&&(i.startDay=o.weekStartDay);f.val().length&&(i.value=s.getDateFromFormat(f.val()));e.format!==u&&e.format.length>0&&(p=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),w=p.exec(e.format),i.dateFormat=w[2],f.val().length&&(i.value=r.format(new Date(f.val()),i.dateFormat,i.locale),f.val(i.value)));r.isNullOrUndefined(e.editParams)||n.extend(i,e.editParams);o.dateFormat.toLowerCase().indexOf("hh")==-1?f.ejDatePicker(i):f.ejDateTimePicker(i);break;case r.TreeGrid.EditingType.DateTimePicker:i={};i.width=l;i.height=c;i.locale=o.locale;i.cssClass=o.cssClass;i.displayDefaultDate=!0;i.dateTimeFormat=o.dateFormat;i.enableStrictMode=!0;o.isFromGantt&&(i.startDay=o.weekStartDay);f.val().length&&(i.value=s.getDateFromFormat(f.val()));e.format!==u&&e.format.length>0&&(p=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),w=p.exec(e.format),i.dateTimeFormat=w[2],f.val().length&&(i.value=r.format(new Date(f.val()),i.dateTimeFormat,i.locale),f.val(i.value)));r.isNullOrUndefined(e.editParams)||n.extend(i,e.editParams);f.ejDateTimePicker(i);break;case r.TreeGrid.EditingType.Dropdown:s._isRowEdit?(a=e.dropdownData,g=e.field):(a=e.dropdownData,g=e.field);o.isFromGantt&&g==="resourceInfo"?f.ejDropDownList({width:l,height:c,showCheckbox:!0,dataSource:a,fields:{id:o.resourceIdMapping,text:o.resourceNameMapping,value:o.resourceNameMapping},selectedItems:s.getIndexofresourceInfo(a)}):(h={},h.cssClass=o.cssClass,h.width=l,h.height=c,h.dataSource=a,r.isNullOrUndefined(e.editParams)||n.extend(h,e.editParams),f.ejDropDownList(h),ot=f.ejDropDownList("instance"),ot._setValue(f.attr("cellValue")));break;case r.TreeGrid.EditingType.String:s.model.editSettings.allowEditing&&s.model.editSettings.editMode=="dialogEditing"?f.outerWidth("100%").height(27):f.outerWidth(l).height(o.rowHeight-9);break;case r.TreeGrid.EditingType.Boolean:s._checkboxSelection&&e.nonColumn?f[0].style.display="none":(h={},h.cssClass=o.cssClass,h.size="small",r.isNullOrUndefined(e.editParams)||n.extend(h,e.editParams),f.ejCheckBox(h),nt=f.parent(".e-chkbox-wrap"),tt=nt.parent("form"),rt||(tt.length>0?tt.css("margin-left","45%"):nt.css("margin-left","45%")));break;case r.TreeGrid.EditingType.Maskedit:h={};h.locale=o.locale;h.cssClass=o.cssClass;h.width=l;h.height=c;r.isNullOrUndefined(e.editParams)||n.extend(h,e.editParams);f.ejMaskEdit(h);break;case"edittemplate":it={rowdata:t.data,column:e,element:f,requestType:t.requestType};v=e.editTemplate.write;r.isNullOrUndefined(t)||t.requestType!="add"||(it.rowdata={});typeof v=="string"&&(v=r.util.getObject(v,window));v(it)}f.is(":disabled")||ut||f.is(":hidden")&&typeof(f.data("ejDropDownList")||f.data("ejNumericTextbox")||f.data("ejDatePicker")||f.data("ejCheckBox"))!="object"||(s._isEnterKeyPressed||e!=o.columns[t.columnIndex])&&(t.columnIndex&&t.columnIndex!=-1||s._isEnterKeyPressed)||(s._focusElements(f.closest("td")),ut=!0)}},_getRecordIndex:function(){var n=this,t=n.model,i,r=t.allowPaging?n._updatedPageData:n.getExpandedRecords(t.updatedRecords);return n.getVisibleRange(),i=r.slice(n._visibleRange.top,n._visibleRange.bottom),i.indexOf(t.selectedItem)},_initValidator:function(){for(var r=this,i=n("#"+this._id+"EditForm").length>0?n("#"+this._id+"EditForm"):n("#"+this._id+"EditFormDialog"),t=0;t<i.length;t++)i.eq(t).validate({ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(n,t){r._renderValidator(n,t)}})},_renderValidator:function(t,i){var a,v,c,l;if(i.is(":hidden")&&(i=i.siblings("input:visible")),i.length){var o=this,u=o.model,f,e=i.closest(".e-rowcell"),s=n(t).addClass("e-error"),h=r.buildTag("div.e-errortail");e=e.length?e:e=i.closest("td");e.find(".e-error").remove();u.editSettings.editMode!="dialogEditing"?(f=o._getRecordIndex(),a=(f+1)*u.rowHeight,u.enableVirtualization||(v=o.getExpandedRecords(u.updatedRecords),f=u.allowPaging?o._updatedPageData.indexOf(u.selectedItem):v.indexOf(u.selectedItem)),f==-1&&(u.editSettings.rowPosition=="bottom"?f=u.updatedRecords.length-1:u.editSettings.rowPosition=="top"&&(f=0),a=(f+1)*u.rowHeight),o._viewPortHeight<a+45?(h.addClass("e-bottomarrow"),c=f*u.rowHeight-45,l="append"):(h.addClass("e-toparrow"),c=(f+1)*u.rowHeight,l="prepend")):(c=e.offset().top-n("#"+this._id+"EditFormDialog").offset().top+e.parent()[0].offsetHeight,h.addClass("e-toparrow"),l="prepend");n(s).css({top:c});i.parent().hasClass("e-in-wrap")?s.insertAfter(i.closest(".e-widget")):s.insertAfter(i);s[l](h);s.show("slow")}},setValidation:function(){for(var i=this,n=i.model,t=0;t<this.model.columns.length;t++)if(!r.isNullOrUndefined(n.columns[t].validationRules))if(n.editSettings.editMode==r.TreeGrid.EditMode.RowEditing||n.editSettings.editMode==r.TreeGrid.EditMode.DialogEditing||i.element.find(".e-rowedit").length>0||i.element.find(".e-addedrow").length>0)this.setValidationToField(n.columns[t].field,n.columns[t].validationRules);else if(n.editSettings.editMode==r.TreeGrid.EditMode.CellEditing&&i._cellEditingDetails.columnIndex==t){this.setValidationToField(n.columns[t].field,n.columns[t].validationRules);return}},setValidationToField:function(t,i){var u=t,f,o,s,e;r.isNullOrUndefined(t)||(u=u.replace(/[^a-z0-9\s_]/gi,""));o=n("#"+this._id+"EditForm").length>0?n("#"+this._id+"EditForm"):n("#"+this._id+"EditFormDialog");f=o.find("#"+this._id+u).length>0?o.find("#"+this._id+u):o.find("#"+u);i.regex&&(i[t+"regex"]=i.regex,delete i.regex,n.validator.addMethod(u+"regex",function(n,t,i){var r=i instanceof RegExp?i:new RegExp(i);return r.test(n)},r.getObject("messages.regex",i)||this.getColumnByField(t).headerText+" should match the given pattern"));f.attr("name")||f.attr("name",t);f.rules("add",i);s=n("#"+this._id+"EditForm").length>0?n("#"+this._id+"EditForm").validate():n("#"+this._id+"EditFormDialog").validate();s.settings.messages[t]=s.settings.messages[t]||{};r.isNullOrUndefined(i.required)||(e=r.isNullOrUndefined(i.messages&&i.messages.required)?n.validator.messages.required:i.messages.required,e.indexOf("This field")==0&&(e=e.replace("This field",this.getColumnByField(t).headerText)),s.settings.messages[t].required=e,f.hasClass("e-datepicker")&&f.ejDatePicker({watermarkText:""}))},_focusElements:function(n){var i=this,t,u,f;n.length&&(n.focus(),t=n.children(),t[0]&&(t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t.find(".e-ddl").focus():t.find(".e-chkbox-wrap.e-widget").length?t.find(".e-chkbox-wrap.e-widget").focus():t.find(".e-datepicker").length<=0?t.find("input,select").select().focus():t.find("input,select").select()));u=i.getScrollElement().children(".e-content").scrollLeft();f=i.getScrollElement().ejScroller("option","scrollLeft");i.getScrollElement().hasClass("e-scroller")&&u!=f&&(r.isNullOrUndefined(u)||i.getScrollElement().ejScroller("option","scrollLeft",u));i._updateHeaderScrollLeft(i.getScrollElement().children(".e-content").scrollLeft())},_focusElementsForRowEdit:function(n){if(n.length){var t=n.children();t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t[0].focus():t.hasClass("e-chkbox-wrap")?t[0].focus():t.find(".e-datepicker").length<=0?t.find("input:visible,select").first().select().focus():t.find("input,select").select()}},updateHeight:function(){var n=this,t=this.model,i=0,u=0,r;n._$gridContainer&&n._$gridContent&&(i=t.allowPaging?t.rowHeight*n._updatedPageData.length:t.enableVirtualization?t.updatedRecords.length*t.rowHeight:t.rowHeight*(t.updatedRecords.length-n.getCollapsedRecordCount()),t.showDetailsRow&&t.detailsTemplate&&!t.showDetailsRowInfoColumn&&(u=n._getExpandedDetailsRowHeight()),i+=u,i==0&&(t.currentViewData.length==0||t.flatRecords.length==0)&&(i=30),t.allowPaging&&!t.sizeSettings.height&&(r=i,this._frozenColumnsLength>0?n._$gridContent.css("height",i):n.getScrollElement().hasClass("e-scroller")&&(n.getScrollElement().ejScroller("isHScroll")&&(r=i+n._scrollBarHeight),n.getScrollElement().ejScroller({height:r})),n._viewPortHeight=r,n._gridHeight=i+n._getNonContentHeight(),n._summaryRowsCount>0&&t.showTotalSummary&&(n._gridHeight+=n._$totalSummaryRowContainer.outerHeight()),n.element.height(n._gridHeight)),n._$gridContainer.css({height:i+"px",width:"auto"}),this._frozenColumnsLength&&n._$gridContainer.find("#e-movablecontentdiv"+n._id+",#e-frozencontentdiv"+n._id).css("height",i+"px"),n.getScrollElement().hasClass("e-scroller")&&(n.getScrollElement().ejScroller("refresh"),n._updateScrollCss()))},_setScrollTop:function(){var t=this,i=this.model,u=0,r=t._scrollTop,f=i.rowHeight,e=i.currentViewData.length,o=i.isFromGantt?t._id.replace("ejTreeGrid",""):t._id;ganttbody=n("#"+o).find(".e-ganttviewerbodyContianer");i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(f+=t._detailsRowHeight);i.allowPaging&&t._isNextPage&&(r=0,t._isNextPage=!1,t.getScrollElement().ejScroller("scrollY",r,!0));r!==0&&(i.enableVirtualization?e*f<t._viewPortHeight&&(e>0&&(u=r-(t._viewPortHeight-(e-1)*f),u<0&&(u=0)),i.isFromGantt?ganttbody.ejScroller("scrollY",u,!0):t.getScrollElement().ejScroller("scrollY",u,!0)):i.isFromGantt?ganttbody.ejScroller("scrollY",r,!0):t.getScrollElement().ejScroller("scrollY",r,!0))},getChildCount:function(n,t){var r,u=this,i;if(!n.hasChildRecords)return 0;for(i=0;i<n.childRecords.length;i++)r=n.childRecords[i],t++,r.hasChildRecords&&(t=u.getChildCount(r,t));return t},_updateFilteredRecords:function(n){var t=this,r=0,u=n.length,i,f=t.model.enableVirtualization;for(t._flatFilteredRecords=[],t._filteredRecords=[],t._filteredGanttRecords=[],r;r<u;r++)i=n[r],t._addParentRecord(i),this.model.isFromGantt||(i.hasChildRecords&&i.childRecords.length>0&&(i.hasFilteredChildRecords=this._checkChildExsist(i,n)?!0:!1),i.parentItem&&(i.parentItem.hasFilteredChildRecords=!0));t._filteredRecords=f?t.getExpandedRecords(t._flatFilteredRecords):t._flatFilteredRecords.slice()},_checkChildExsist:function(t,i){for(var u=t.childRecords,e=u.length,f=!1,r=0;r<e;r++)if(n.inArray(u[r],i)!=-1){f=!0;break}else u[r].hasChildRecords&&(f=this._checkChildExsist(u[r],i));return f},_updateHasFilteredChildRecordsStatus:function(n){var t=0,r=n.length,i;for(t;t<r;t++)i=n[t],i.hasChildRecords&&!i.hasFilteredChildRecords&&(i.hasFilteredChildRecords=!0)},_addParentRecord:function(t){var i=this;t.parentItem&&i._addParentRecord(t.parentItem);n.inArray(t,i._flatFilteredRecords)===-1&&i._flatFilteredRecords.push(t)},_updateExpandCollapseForSortedRecords:function(n,t){var i=this,r=0,o=i._sortedRecords.length,u,f=i._sortedRecords.indexOf(n),e;if(t)i._addNestedSortRecords(n,f);else{for(e=0,r=f+1;r<o;r++)if(u=i._sortedRecords[r],u.level===n.level)break;else i.getExpandStatus(u)||e++;i._sortedRecords.splice(f+1,e)}},_addNestedSortRecords:function(t,i){var u=this,c,o=u.model.sortSettings.sortedColumns,s,e,l,h,f;if(o.length)for(s=o.length-1,u._queryManagar.queries=[],e=s;e>=0;e--)u._queryManagar.sortBy(o[e].field,o[e].direction);if(t.hasChildRecords)for(l=r.DataManager(t.childRecords),c=l.executeLocal(u._queryManagar).result,s=c.length,h=0;h<s;h++)f=c[h],u._filteredRecords.length?n.inArray(f,u._filteredRecords)!==-1&&u._sortedRecords.splice(++i,0,f):u._sortedRecords.splice(++i,0,f),f.hasChildRecords&&f.expanded&&u._addNestedSortRecords(f,i)},updateEditSettings:function(n){var t=this;n&&(n.editMode&&(t.model.editSettings.editMode==="normal"&&n.editMode==="cellEditing"?(t.model.editSettings.editMode=n.editMode,t._processEditing()):t.model.editSettings.editMode=n.editMode),r.isNullOrUndefined(n.allowAdding)||(t.model.editSettings.allowAdding=n.allowAdding),r.isNullOrUndefined(n.allowEditing)||(t.model.editSettings.allowEditing=n.allowEditing),r.isNullOrUndefined(n.allowDeleting)||(t.model.editSettings.allowDeleting=n.allowDeleting),r.isNullOrUndefined(n.beginEditAction)||(t.model.editSettings.beginEditAction=n.beginEditAction),t._enableEditingEvents())},updateAltRow:function(){for(var i=this,t=0,r=i.model.updatedRecords,f=r.length,n,u=!0,t=0;t<f;t++)(n=r[t],!n.isSummaryRow&&i.getExpandStatus(n))&&(n.isAltRow=!u,u=n.isAltRow)},_getFilteredChildRecordsCount:function(n){for(var t=this,u=t.model,f=n&&n.childRecords&&n.childRecords.length,i=0,r,i=0;i<f;i++)r=n.childRecords[i],u.enableVirtualization?t.getExpandStatus(r)&&t._removedCount++:t._removedCount++,r.childRecords&&t._getFilteredChildRecordsCount(r);return t._removedCount},_sortingRecords:function(){var n=this,t=n.model,f=t.sortSettings.sortedColumns,e,u,i,o,s,h;if(n._queryManagar.queries=[],f.length)for(e=f.length-1,u=e;u>=0;u--)t.isFromGantt?(o=r.TreeGrid.getColumnByMappingName(n.model.columns,f[u].field),i=o.field):i=f[u].field,t.isFromGantt&&(i==="resourceInfo"?i="resourceNames":i==="predecessor"&&(i="predecessorsName")),n._queryManagar.sortBy(i,f[u].direction);return s=new r.DataManager(t.parentRecords),h=s.executeLocal(n._queryManagar).result,n._sortedRecords=[],n._storedIndex=-1,n._rowIndex=-1,n._createSortedRecords(h),n._tempsortedrecords=n._sortedRecords,n.model.updatedRecords=n._sortedRecords,t.allowPaging&&t.pageSettings.pageSizeMode===r.TreeGrid.PageSizeMode.Root&&(t.parentRecords=n._getParentRecords(n.model.updatedRecords,n,!0)),!0},_createSortedRecords:function(t){var i=this,f=i.model,u=i._sortedRecords,e,o=i.model.enableAltRow,f=this.model;t=i._spliceSummaryRows(t);n.each(t,function(n,t){var s,h;if(t.isSummaryRow){s=t.parentItem.childRecords.indexOf(t);t.parentItem.childRecords.splice(s,1);return}i._searchString.length>0||f.filterSettings.filteredColumns.length>0?i._filteredRecords.length>0&&i._filteredRecords.indexOf(t)!==-1&&(i._storedIndex++,i._rowIndex++,o&&(t.isAltRow=i._rowIndex%2==0?!1:!0),u[i._storedIndex]=t):(i._storedIndex++,i._rowIndex++,o&&(t.isAltRow=i._rowIndex%2==0?!1:!0),u[i._storedIndex]=t);t.hasChildRecords&&t.expanded?(t.childRecords=i._spliceSummaryRows(t.childRecords),e=r.DataManager(t.childRecords),h=e.executeLocal(i._queryManagar).result,i._createSortedRecords(h)):!t.hasChildRecords||t.expanded||f.enableVirtualization||(t.childRecords=i._spliceSummaryRows(t.childRecords),i._setChildRecords(t,u))})},_setChildRecords:function(n,t){var i=this,o=i.model,e=i.model.enableAltRow,s=n.childRecords.length,f,u;for(dataManager=r.DataManager(n.childRecords),f=dataManager.executeLocal(i._queryManagar).result,u=0;u<s;u++)i._searchString.length>0||o.filterSettings.filteredColumns.length>0?i._filteredRecords.length>0&&i._filteredRecords.indexOf(f[u])!==-1&&(i._storedIndex++,e&&(f[u].isAltRow=i._storedIndex%2==0?!1:!0),t[i._storedIndex]=f[u],f[u].hasChildRecords&&this._setChildRecords(f[u],t)):(i._storedIndex++,e&&(f[u].isAltRow=i._storedIndex%2==0?!1:!0),t[i._storedIndex]=f[u],f[u].hasChildRecords&&this._setChildRecords(f[u],t))},_updateSortedRecords:function(t){var u=this,f=0,s=t.length,i,h=this.model,e,o;for(f;f<s;f++)i=t[f],h.enableVirtualization||(u._filteredRecords.length>0?n.inArray(i,u._filteredRecords)!==-1&&n.inArray(i,u._sortedRecords)===-1&&u._sortedRecords.push(i):n.inArray(i,u._sortedRecords)===-1&&u._sortedRecords.push(i),i.hasChildRecords&&i.childRecords.length>0&&(e=r.DataManager(i.childRecords),o=e.executeLocal(u._queryManagar).result,u._updateSortedRecords(o)))},_removeSortElementFromColumn:function(t){var i=this,f=r.TreeGrid.getColumnByField(i.model.columns,t),e=n.inArray(f,i.model.columns),u=i.getHeaderTable().find("thead").find(".e-headercell").eq(e).find(".e-headercelldiv");u.find(".ascending,.descending").remove();u.parent().removeAttr("aria-sort")},_addEmptyColumntoGrid:function(){var t=this;n(t.element).find(".e-gridheadercontainer table colgroup").append(r.buildTag("col","",{width:"auto"},{}));t._$gridContainer.find("table colgroup").append(r.buildTag("col","",{width:"auto"},{}));n(t.element).find(".e-gridheadercontainer table thead tr").append(r.buildTag("th.e-headercell"))},updateScrollTop:function(n,t){var u={},i=this,f;u.requestType=r.TreeGrid.Actions.Scroll;u.delta=n;f=i.getScrollElement().ejScroller("isHScroll");!f&&this.model.isFromGantt?i._$gridContent.scrollTop(n):i._$gridContent.scrollTop(0);i.getScrollElement().ejScroller("scrollY",n,!0);i.model.isFromGantt&&!t?(i._completeAction(u),i._focusTreeGridElement()):i._isFromChart=!1},_selectNextCell:function(n,t){var i=this,h=i.model,u=h.columns,e=u.length,r=i.getUpdatedRecords(),f=h.allowPaging?r:i.getExpandedRecords(h.updatedRecords),o,s;i._isShiftKeyNavigation=!1;switch(n){case"right":if(i._focusingRowIndex>=r.length-1&&i._cellIndex>=e-1||i._focusingRowIndex==-1||i._cellIndex==-1){i.element[0].focus();return}if(i._cellIndex+=1,i._cellIndex==e){if(i._cellIndex=0,o=r[i._rowIndexOfLastSelectedCell],selectingRowIndex=f.indexOf(o),currentSelectingRecord=f[selectingRowIndex+1],currentSelectingRecord&¤tSelectingRecord.isSummaryRow&&(currentSelectingRecord=i._getNextRecord(selectingRowIndex+1,f)),!currentSelectingRecord)return;i._focusingRowIndex=r.indexOf(currentSelectingRecord)}if(i._focusingRowIndex>=r.length)return;(!u[i._cellIndex].visible||!u[i._cellIndex].allowCellSelection)&&$form.length<=0&&(i._cellIndex=i.getUpNextVisibleColumnIndex(i._cellIndex,t));$form.length>0&&u[i._cellEditingDetails.columnIndex].allowCellSelection&&(i._cellIndex=i._cellEditingDetails.columnIndex);s={rowIndex:i._focusingRowIndex,cellIndex:i._cellIndex};i.selectCells([s]);i.updateScrollBar();break;case"left":if(i._cellIndex-=1,e=u.length,i._cellIndex<0){if(i._cellIndex=e-1,o=r[i._rowIndexOfLastSelectedCell],selectingRowIndex=f.indexOf(o),currentSelectingRecord=f[selectingRowIndex-1],currentSelectingRecord&¤tSelectingRecord.isSummaryRow&&(currentSelectingRecord=i._getNextRecord(selectingRowIndex-1,f,"upArrow")),!currentSelectingRecord)return;i._focusingRowIndex=r.indexOf(currentSelectingRecord)}if(i._focusingRowIndex<0)return;i._focusingRowIndex>=r.length&&(i._focusingRowIndex=r.length-1);(!u[i._cellIndex].visible||!u[i._cellIndex].allowCellSelection)&&$form.length<=0&&(i._cellIndex=i.getPreviousVisibleColumnIndex(i._cellIndex,t));$form.length>0&&u[i._cellEditingDetails.columnIndex].allowCellSelection&&(i._cellIndex=i._cellEditingDetails.columnIndex);s={rowIndex:i._focusingRowIndex,cellIndex:i._cellIndex};i.selectCells([s]);i.updateScrollBar()}},_moveCurrentCell:function(t){var i=this,u=i._cellEditingDetails.rowIndex,a=i._cellEditingDetails.columnIndex,f=i.model,h=i.getUpdatedRecords(),k,y,c;if(u==-1&&a==-1)return!1;i.model.isEdit&&(i.saveCell(),i.model.isEdit=!1);f.enableVirtualization&&(k=f.currentViewData[u],i._cellEditingDetails.rowIndex=u=h.indexOf(k));switch(t){case"right":var s=f.columns,d=s.length,p=i.getHiddenColumns(),l=n.extend([],s),e,v,w;if(p&&p.forEach(function(n){l.splice(l.indexOf(n),1)}),v=l.indexOf(s[a]),w=l.length,u==h.length-1&&v==w-1)return!0;if(v==w-1){for(e=0;!s[e].visible;)e++;if(i._cellEditingDetails.columnIndex=e,i._getNextRow(t,u,i))return!0}else{for(e=a+1;!s[e].visible;)e++;i._cellEditingDetails.columnIndex=e}while(f.columns[e].allowEditing==!1||!s[e].visible){if(e+1==f.columns.length){if(i._cellEditingDetails.columnIndex=e=0,i._getNextRow(t,u,i))return!0;continue}i._cellEditingDetails.columnIndex=++e}i.updateScrollBar();i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);i._editAddTools();break;case"left":var s=f.columns,d=s.length,p=i.getHiddenColumns(),l=n.extend([],s),o,v,w;if(p&&p.forEach(function(n){l.splice(l.indexOf(n),1)}),v=l.indexOf(s[a]),w=l.length,u==0&&v==0)return!0;if(v==0){for(o=f.columns.length-1;!s[o].visible;)o--;if(i._cellEditingDetails.columnIndex=o,i._getNextRow(t,u,i))return!0}else{for(o=a-1;!s[o].visible;)o--;i._cellEditingDetails.columnIndex=o}while(f.columns[o].allowEditing==!1||!s[o].visible){if(o-1==-1){if(i._cellEditingDetails.columnIndex=o=d-1,i._getNextRow(t,u,i))return!0;continue}i._cellEditingDetails.columnIndex=--o}i.updateScrollBar();i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);i._editAddTools();break;case"up":if(u==0)return!0;i._cellEditingDetails.rowIndex=u-1;i.selectRows(i._cellEditingDetails.rowIndex);i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex);i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);break;case"down":if(u+1==h.length&&(i._focusTreeGridElement(),i._isEnterKeyPressed=!0),f.showSummaryRow&&u+1==h.length-f.summaryRows.length&&(i._isEnterKeyPressed=!0),i._isEnterKeyPressed)i._isEnterKeyPressed=!1;else{if(h.length>u+1)if(f.enableVirtualization){if(c=h[u+1],c&&c.isSummaryRow&&(c=i._getNextRecord(u+1,h)),y=h.indexOf(c),y==-1)return!0;i._cellEditingDetails.rowIndex=y}else{var g=h[u],b=f.allowPaging?h:i.getExpandedRecords(f.updatedRecords),c=b[b.indexOf(g)+1];if(c&&c.isSummaryRow&&(c=i._getNextRecord(u+1,b)),y=h.indexOf(c),u==b.length-1&&a==f.columns.length-1||y==-1)return!0;i._cellEditingDetails.rowIndex=y}i._rowSelectingEventTrigger(i.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex));i.updateScrollBar();args={};args.requestType=r.TreeGrid.Actions.Scroll;args.delta=i._$gridContent.children(".e-content").scrollTop();i._trigger("actionComplete",args);i.cellEdit(i._cellEditingDetails.rowIndex,f.columns[i._cellEditingDetails.columnIndex].field);i._editAddTools()}}return!1},_getNextRecord:function(n,t,i){do nextRecord=t[n],i=="upArrow"||i=="lastRowSelection"||i=="bottomRowSelection"?n--:n++;while(nextRecord&&nextRecord.isSummaryRow);return nextRecord},_getNextRow:function(n,t,i){var u,e=i.model,f=i.getUpdatedRecords(),r,o;if(u=n=="right"?1:-1,e.enableVirtualization){if(r=f[t+u],r&&r.isSummaryRow&&(o=u>0?"":"lastRowSelection",r=i._getNextRecord(t+u,f,o)),e.allowPaging&&r&&(index=f.indexOf(r),index<0&&u==1?i.gotoPage(i._currentPage()+1):index<0&&u==-1&&i.gotoPage(i._currentPage()-1)),index=f.indexOf(r),index==-1)return!0;i._cellEditingDetails.rowIndex=index}else{var h=f[t],s=e.allowPaging?f:i.getExpandedRecords(e.updatedRecords),r=s[s.indexOf(h)+u];if(r&&r.isSummaryRow&&(o=u>0?"":"lastRowSelection",r=i._getNextRecord(t+u,s,o)),e.allowPaging&&r&&(index=f.indexOf(r),index<0&&u==1?i.gotoPage(i._currentPage()+1):index<0&&u==-1&&i.gotoPage(i._currentPage()-1)),index=f.indexOf(r),index==-1)return!0;i._cellEditingDetails.rowIndex=index}e.allowSelection&&e.selectionSettings.selectionMode=="cell"?(e.selectedItem=f[i._cellEditingDetails.rowIndex],i._rowIndexOfLastSelectedCell=i._cellEditingDetails.rowIndex):i._rowSelectingEventTrigger(i.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex))},_findColumnsWidth:function(){for(var t=this,i=t.model.columns.length,r=t.getHeaderTable().find("colgroup").find("col"),n=0;n<i;n++)t.columnsWidthCollection[n]=r.eq(n).width()},_calculateWidth:function(){for(var t=this.getHeaderTable().find("colgroup").find("col"),i=0,n=0;n<t.length;n++)i+=t.eq(n).width();return i},getScrollObject:function(){return this.getScrollElement().data("ejScroller")},_updateElementHeight:function(){var n=this;n._calculateDimensions();n.updateViewPortHeight()},getScrollElement:function(){return this._frozenColumnsLength>0?this.element.find("#e-movablecontainer"+this._id):this._$gridContent},_getFrozenColumnWidth:function(n){var i=0,n=r.isNullOrUndefined(n)?this._frozenColumnsLength:n,u=r.isNullOrUndefined(n)?this._frozenColumns:this.model.columns,t;if(n>0)for(t=0;t<n;t++)i+=u[t]?this.columnsWidthCollection[t]:0;return i},_renderScroller:function(t){var i=this,u=i.model,a=u.flatRecords.length*u.rowHeight,c=i._viewPortHeight,s=!1,o,h;if(i._$gridContent.hasClass("e-scroller")&&(!u.allowPaging||u.sizeSettings.height))i.getScrollElement().ejScroller("refresh");else{var e=i._gridHeight?c:"auto",l=!1,f=this._gridWidth;this._frozenColumnsLength>0&&(i._$gridContent.css("width",f-i._totalBorderWidth),f=f-this._getFrozenColumnWidth()-1);u.isFromGantt||(l=!0);this.mobileDevice()&&!u.isFromGantt&&(s=!0,i._scrollBarHeight=10);i.getScrollElement().ejScroller({enableTouchScroll:!1,autoHide:s,scrollerSize:i._scrollBarHeight,height:i.model.isFromGantt?0:e,width:i.model.isFromGantt?f:f-i._totalBorderWidth,scroll:n.proxy(i._onScroll,i)})}i.getScrollElement().ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""});r.isNullOrUndefined(t)&&i._updateScrollCss();o=i.getScrollElement().ejScroller("isHScroll");u.allowPaging&&!u.sizeSettings.height&&o&&(h=e+i._scrollBarHeight,i.getScrollElement().ejScroller({height:h}),i.getScrollElement().ejScroller("refresh"));i.model.isFromGantt&&(o?i._$gridContent.removeClass("e-borderbox"):i._$gridContent.addClass("e-borderbox"));!this.mobileDevice()&&this.getBrowserDetails().browser=="safari"&&this._frozenColumnsLength>0&&(this.getHeaderContent().find("#e-movableheader"+i._id).add(this.getContent().find("#e-movablecontainer"+i._id)).css("margin-left","auto"),this._$totalSummaryRowContainer&&this._$totalSummaryRowContainer.find("#e-movablefooter"+i._id).css("margin-left","auto"));this._frozenColumnsLength>0&&(i._$gridContent.height(e),i.getContent().find("#e-frozencontainer"+i._id).height(i.getContent().find("#e-movablecontent"+i._id).height()))},_destroy:function(){var t=this,i=this.model,e=i.columns,u,f;if(t.element.off(),t._off(t.element,"click",t._onClick),t._off(t.element,"keydown",t._keyDown),t._off(t.element,"click","#"+t._id+"e-gridheader",t._onHeaderClick),t._off(t.element,"mousedown touchstart","#"+t._id+"e-gridheader",t._headerMouseDown),t._off(n(document),"mousedown touchstart",t._mouseDownHandler),t._off(t.element,"mousedown touchstart",".e-gridcontent",t._contentMouseDown),t._off(t.element,"click",t._onRecordClick),i.filterSettings.filterBarMode=="immediate"&&(t._off(t.element,"keyup",".e-filterbarcell input",t._filterBarHandler),t._off(t.element,"click",".e-filterbarcell .e-checkbox")._off(t.element,"click",".e-filterbarcell .e-checkbox",t._filterBarHandler)),t._off(t.element,"focus click",".e-filterbarcell input",t._filterBarClose),t._off(t.element,"click",".e-filterbarcell .e-cancel",t._filterBarClose),t.model.showGridCellTooltip&&!t.model.showGridExpandCellTooltip?r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover):t._off(t.element,"mousemove",".e-rowcell",t._mouseHover):t._off(t.element,"mouseenter",".e-rowcell",t._mouseHover),t.model.showGridCellTooltip&&(r.browserInfo().name=="msie"?t._off(t.element,"mouseenter",".e-headercelldiv",t._headermouseHover):t._off(t.element,"mousemove",".e-headercelldiv",t._headermouseHover)),t._off(t.element,"mouseleave",".e-rowcell",t._cellMouseLeave),t._off(t.element,"mouseleave",t._cellMouseLeave),t._off(t.element,"mouseleave",".e-headercelldiv",t._headerMouseLeave),t._off(t.element,"mouseleave",t._headerMouseLeave),(i.isFromGantt||this._frozenColumnsLength)&&t._off(t.element,"mousewheel DOMMouseScroll",t._mouseWheel),i.enableResize&&i.isResponsive&&!i.isFromGantt&&t._off(n(window),"resize",t._windowResize),r.isTouchDevice()?t._off(t.element,"doubletap ",".e-gridcontent",t._editdblClickHandler):t._off(t.element,"dblclick ",".e-gridcontent",t._editdblClickHandler),i.contextMenuSettings.showContextMenu&&t._off(t.element,"keyup",this._preventContextMenu),this._clearColumnMenu(),this._clearContextMenu(),this._removeDetailsRow(),t._columnRenameDialog&&(t._columnRenameDialog.data("ejDialog")&&t._columnRenameDialog.data("ejDialog").destroy(),n("#"+t._columnRenameDialog.attr("id")+"_wrapper").remove(),n("#"+t._id+"ColumnRenameDialog").remove()),this.model.showColumnChooser&&(n("#"+this._id+"ccDiv").data("ejDialog")&&n("#"+this._id+"ccDiv").data("ejDialog").destroy(),n("#"+t._id+"ccDiv_wrapper").remove(),n("#"+this._id+"ccDiv").remove()),t._updateConfirmDialog&&(t._updateConfirmDialog.data("ejDialog")&&t._updateConfirmDialog.data("ejDialog").destroy(),n("#"+t._updateConfirmDialog.attr("id")+"_wrapper").remove(),n("#"+t._id+"ConfirmDialog").remove()),n("#"+t._id+"_dialogColumnAdd_wrapper").length>0&&(n("#"+t._id+"_dialogColumnAdd").data("ejDialog")&&n("#"+t._id+"_dialogColumnAdd").data("ejDialog").destroy(),n("#"+t._id+"_dialogColumnAdd_wrapper").remove(),n("#"+t._id+"_dialogColumnAdd").remove()),i.allowFiltering&&!i.isFromGantt)for(u=0;u<e.length;u++)f=n("#"+this._id+"_"+e[u].field.split(".").join("")+"_filterbarcell"),f.data("ejWidgets")&&n(f).data(n(f).data("ejWidgets")[0]).destroy();t.element.empty().removeClass("e-treegrid-core e-treegrid "+t.model.cssClass)},collapseAll:function(){var n=this,u=n.model,i=0,t={},f=u.enableVirtualization,e=n.getRows();for((n._isRowEdit||n.model.isEdit)&&(n._isRowEdit?n.cancelRowEditCell():n.cancelEditCell(),n.selectRows(-1),n._cancelSaveTools()),t.requestType=r.TreeGrid.Actions.ExpandCollapse,n._isInExpandCollapseAll=!0,i=0;i<n.model.parentRecords.length;i++)treegridRecord=n.model.parentRecords[i],t.data=treegridRecord,t.recordIndex=i,t.expanded=!1,treegridRecord.hasChildRecords&&(n._expandCollapseInnerLevelRecord(treegridRecord,t.expanded),r.TreeGrid.sendExpandCollapseRequest(n,t));u.flatRecords.length>0&&n._refreshTreeGridOnExpandCollapseAll(t);n._isInExpandCollapseAll=!1},_getContextMenuItems:function(){return proxy=this,contextMenuLabel=proxy._contextMenuTexts,[{headerText:contextMenuLabel.addRowText,eventHandler:null,isDefault:!0,disable:!1,menuId:"Add",parentMenuId:null},{iconClass:"e-edit",headerText:contextMenuLabel.editText,eventHandler:null,isDefault:!0,disable:!1,menuId:"Edit",parentMenuId:null},{headerText:contextMenuLabel.deleteText,eventHandler:null,isDefault:!0,disable:!1,menuId:"Delete",parentMenuId:null},{iconClass:"e-save",headerText:contextMenuLabel.saveText,eventHandler:null,isDefault:!0,isEdit:!0,disable:!1,menuId:"Save",parentMenuId:null},{iconClass:"e-cancel",headerText:contextMenuLabel.cancelText,eventHandler:null,isDefault:!0,isEdit:!0,disable:!1,menuId:"Cancel",parentMenuId:null},{iconPath:null,headerText:contextMenuLabel.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:contextMenuLabel.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_getsubContextMenuItems:function(){return proxy=this,contextMenuLabel=proxy._contextMenuTexts,[{iconPath:null,headerText:contextMenuLabel.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:contextMenuLabel.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_clearContextMenu:function(){n(".e-contextmenu").remove();n(".e-innerContextmenu").remove()},_renderContextMenu:function(t,i,f,e){var o=this,w=o.model,s={},l,a,h,b,k=o._getCoordinate(t),c,d,p;if(o._contextMenuSelectedIndex=i,o._contextMenuSelectedItem=f,o._contextMenuEvent=t,e||this.editFormValidate()){if(t||(t=window.event),subposX=l=k.pageX,subposY=a=k.pageY,c=this.getOffsetRect(o.element[0]),c.bottom=c.top+this.element[0].offsetHeight,c.right=c.left+n(this.element).width(),s.targetElement=t,s.item=f,s.index=i,s.columnIndex=o.getCellIndex(t),s.requestType="ContextMenuOpen",s.contextMenuItems=o._contextMenuItems,o._trigger("contextMenuOpen",s))return!1;o._activeMenuItemId=null;o._contextMenuItems=s.contextMenuItems;h=r.buildTag("div.e-contextmenu","",{display:"table",position:"absolute","z-index":o.getMaxZIndex()+1},{id:o._id+"_ContextMenu"});d=s.contextMenuItems.filter(function(n){if(n.parentMenuId==null||n.parentMenuId==u)return!0});b=r.buildTag("ul.e-treegrid-contextmenu",n.render[o._id+"contextMenuTemplate"](d),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"});h.append(b);n(document.body).append(h);r.browserInfo().name=="msie"&&r.browserInfo().version<9&&w.isResponsive&&o._off(n(window),"resize",o.windowResize);var g=n(h).outerHeight(),v=n(h).outerWidth(),y=h.find(".e-menuitem"),nt=y.eq(0);y.outerWidth(v+2);(c.left>l||c.right<l+v)&&(c.right<l+v&&(l=l-v),l<0&&(l=c.left+10));c.bottom<a+g&&(p=a-g,p>0&&(a=p));h.css({left:l+"px",top:a+"px"});o._focusTreeGridElement();n(h).css({height:"auto"});o._on(h,"contextmenu",function(n){n.preventDefault()});n(y).click(function(){o._contextMenuClickHandler(this)});n(y).mouseenter(function(){n(this).hasClass("e-disable")||(h.find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),o._activeMenuItemId=n(this).attr("id"),o._showSubContextMenu(this,s.contextMenuItems))});o.model.allowSelection&&o.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&o._clearMultiSelectPopup();r.browserInfo().name=="msie"&&r.browserInfo().version<9&&w.isResponsive&&o._on(n(window),"resize",o.windowResize);t.preventDefault()}},_showSubContextMenu:function(t,i){var v=this.model,u=this,e=[],s=n(t).attr("id"),f,a,h=[],o,c,l;h=i.filter(function(n){return n.menuId==s&&(e=n),n.parentMenuId==s?!0:void 0});e.parentMenuId||n(".e-innerContextmenu").remove();e.parentMenuId&&this._removeContextMenu(e,i);h.length>0&&(f=r.buildTag("div.e-innerContextmenu","",{display:"table",position:"absolute","z-index":u.getMaxZIndex()+1},{id:this._id+"_SubContextMenu"+s}),a=r.buildTag("ul",n.render[u._id+"contextMenuTemplate"](h),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),f.append(a),n(document.body).append(f),o=f.find(".e-menuitem"),c=n(f).outerWidth(),o.outerWidth(c>100?c:100),l=u._getSubContextMenuPosition(t,f),n(f).css({top:l.top,left:l.left}),n(o).mouseenter(function(){n(this).hasClass("e-disable")||(u._showSubContextMenu(this,i),n(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),u._activeMenuItemId=n(this).attr("id"))}),u._on(f,"contextmenu",function(n){n.preventDefault()}),n(o).click(function(){u._contextMenuClickHandler(this)}),r.browserInfo().name=="msie"&&r.browserInfo().version<9&&v.isResponsive&&u._on(n(window),"resize",u.windowResize))},_removeContextMenu:function(t,i){var e=n("#"+this._id+"_SubContextMenu"+t.parentMenuId),r=n(e).find(".e-contextmenu-mouseover"),u,f;n(r).length>0&&(u=i.filter(function(t){if(t.menuId==n(r).attr("id"))return!0}),u.length>0&&(f=i.filter(function(n){if(n.parentMenuId==u[0].menuId)return!0}),f.length>0&&this._removeContextMenu(f[0],i)),n("#"+this._id+"_SubContextMenu"+n(r).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var a=this,y=this.model,s,c,l,f={top:"",left:""},h=n(t).closest(".e-contextmenu"),e,v,u,o;return h.length==0&&(h=n(t).closest(".e-innerContextmenu")),r.browserInfo().name=="msie"&&r.browserInfo().version<9&&y.isResponsive&&a._off(n(window),"resize",a.windowResize),s=n(i).outerWidth(),c=n(i).height(),l=this.getOffsetRect(t),v=n(h).outerWidth(),f.top=l.top-1,f.left=l.left+n(h).width()+1,e=f.left,u=this.getOffsetRect(this.element[0]),u.bottom=u.top+this.element[0].offsetHeight,u.right=u.left+n(this.element).width(),(u.left>e||u.right<e+s)&&(u.right<e+s&&(e=e-v-s),e>0&&(f.left=e)),u.bottom<f.top+c&&(o=f.top+c-u.bottom,o=f.top-o-2,o>0&&(f.top=o)),f},_contextMenuClickHandler:function(t){var r=n(t).attr("id"),i=this;if(!n(t).hasClass("e-disable")&&n(t).find(".e-expander").length==0)switch(r){case"Delete":i.contextMenuOperations("Delete");break;case"Above":i.contextMenuOperations("Above");break;case"Below":i.contextMenuOperations("Below");break;case"Add":i.contextMenuOperations("Add");break;case"Edit":i.contextMenuOperations("Edit");break;case"Save":i.contextMenuOperations("Save");break;case"Cancel":i.contextMenuOperations("Cancel");break;default:i.contextMenuOperations(r)}},_triggerMenuEventHandler:function(t,i){var s=this,e=s._contextMenuItems,f,o,u;r.isNullOrUndefined(e)||(f=e.filter(function(n){if(n.menuId.toString()===t)return!0}),f.length>0&&(o=f[0],u=o.eventHandler,u&&(typeof u=="string"&&(u=r.util.getObject(u,window)),n.isFunction(u)&&(args=r.event("customContextMenuHandler",this.model,i),u.call(this,args)))))},_createContextMenuTemplate:function(){var t=this,u={},i,f,r;u["_"+t._id+"getHeaderName"]=n.proxy(t._getHeaderName,t);n.views.helpers(u);i="<li style='list-style-type:none;margin:0px;'>";f="<div class='e-menuitem {{if disable}}e-disable{{/if}}{{if ~_"+t._id+"getHeaderName(#data)}} e-parent-menuitem{{/if}}' id={{:menuId}} style='display:table;cursor:{{if disable}}default{{else}}pointer{{/if}};min-width:100px;'>{{if iconPath}}<div class='e-icon e-contextmenu-image' style='background-image:{{:iconPath}};background-repeat:no-repeat;'/> {{else}}<div class='e-icon {{:iconClass}} e-contextmenu-icon'/>{{/if}}<div class='e-contextmenu-label'><span>{{:headerText}}<\/span><\/div>{{if ~_"+t._id+"getHeaderName(#data)}}<div class='e-icon e-expander'/> {{/if}}";i+=f;i+="<\/div><\/li>";r={};r[t._id+"contextMenuTemplate"]=i;n.templates(r)},_getHeaderName:function(n){var t=this._contextMenuItems.filter(function(t){if(n.menuId!=null&&n.menuId==t.parentMenuId)return!0});return t.length>0?!0:!1},_getColumnId:function(n){return n.name.replace(/\s/g,"")},_updateContextmenuOption:function(t){var r,s;if(Array.prototype.clean=function(n){for(var t=0;t<this.length;t++)this[t]==n&&(this.splice(t,1),t--);return this},r=this,r._isRowEdit||r.model.isEdit)r._contextMenuItems.splice(0,3);else{r._contextMenuItems.splice(3,2);var e=r.model.editSettings,o=n.extend(!0,[],r._contextMenuItems),h=r.model.contextMenuSettings.contextMenuItems.clean("").clean(u),f=[];if(n.each(h,function(t,i){n.inArray(i.toLowerCase(),f)===-1&&f.push(i.toLowerCase())}),r._contextMenuItems=[],t==-1)(f.indexOf("add")!=-1||f.length==0)&&(r._contextMenuItems[0]=o[0]),e.allowAdding||(r._contextMenuItems[0].disable=!0),r._contextAddMenuIndex=0;else if(f.length==0)r._contextMenuItems[0]=o[0],e.allowAdding||(r._contextMenuItems[0].disable=!0),r._contextAddMenuIndex=0,r._contextMenuItems[1]=o[2],e.allowDeleting||(r._contextMenuItems[1].disable=!0),r._contextMenuItems.push.apply(r._contextMenuItems,r._subContextMenuItems);else{for(i=0;i<f.length;i++){s=f[i];switch(s.toLowerCase()){case"add":r._contextMenuItems[i]=o[0];r._contextAddMenuIndex=i;e.allowAdding||(r._contextMenuItems[i].disable=!0);break;case"delete":r._contextMenuItems[i]=o[2];e.allowDeleting||(r._contextMenuItems[i].disable=!0);break;case"edit":r._contextMenuItems[i]=o[1];e.allowEditing||(r._contextMenuItems[i].disable=!0)}}r._contextMenuItems.push.apply(r._contextMenuItems,r._subContextMenuItems)}}},_setInitialData:function(){var u=this,f=u.model,o=[],e,t={},n;for(i=0;i<f.columns.length;i++){n=f.columns[i];switch(n.editType){case"booleanedit":t[n.field]=!1;break;case"stringedit":t[n.field]=null;break;case"datepicker":t[n.field]=r.format(new Date,this.model.dateFormat,this.model.locale);break;case"datetimepicker":today=new Date;t[n.field]=r.format(new Date,"MM/dd/yyyy hh:mm tt",this.model.locale);break;case"numericedit":t[n.field]=0;break;default:t[n.field]=null}}o.push(t);(u.dataSource()==null||u.dataSource().length==0||f.flatRecords.length==0)&&(e=u._createRecord(o[0],0,null),e.index=0,u._addRecord(e,r.TreeGrid.RowPosition.Top),u._clearContextMenu(),this._removeDetailsRow())},_subContextMenuAction:function(n,t,i){var f=this,e=f.model,u;({}).requestType="save";u=jQuery.extend(!0,{},n.item);u[f.model.childMapping]=null;e.idMapping&&e.parentIdMapping&&u[e.parentIdMapping]&&delete u[e.parentIdMapping];i=="Above"?f._addRecord(u,r.TreeGrid.RowPosition.Above):i=="Below"&&f._addRecord(u,r.TreeGrid.RowPosition.Below);f._clearContextMenu()},_appendEditTemplateRow:function(t,i,u,f,e){var a=this.model,o=this,w=o.model.rowHeight,b,v,c,y,k=[],tt=o.getUpdatedRecords(),p,g,s,h,l,nt,d;for(this._editedRowIndex=u,c=r.buildTag("table.e-table","",{},{cellspacing:"0px",cellpadding:"0"}),this._frozenColumnsLength>0?f?(v=r.buildTag("form.#"+o._id+"EditFrozenForm","",{margin:"-2px 0px"},{}),c.append(o._$gridHeaderContainer.find("#e-frozenheaderdiv"+o._id).find("colgroup").clone())):(v=r.buildTag("form.#"+o._id+"EditForm","",{margin:"-2px 0px"},{}),c.append(o._$gridHeaderContainer.find("#e-movableheaderdiv"+o._id).find("colgroup").clone())):(v=r.buildTag("form.#"+o._id+"EditForm","",{margin:"-2px 0px"},{}),c.append(o.getHeaderTable().find("colgroup").clone())),!f&&a.showDetailsRow&&a.showDetailsRowInfoColumn&&a.detailsTemplate&&(y=i.find("td.e-detailsrowcell")),i.empty(),e?(i.addClass("e-addedrow"),i.next("tr").hasClass("e-detailsrow")&&i.next("tr").remove()):i.addClass("e-rowedit"),k=t.filter(function(n){return!(n.visible===!1)}),b=r.buildTag("td","",{},{colspan:y?k.length+1:k.length}),p=a.allowSelection?r.buildTag("tr.e-treegridrows e-selectionbackground e-active",{height:w},{}):r.buildTag("tr.e-treegridrows",{height:w},{}),$tbody=r.buildTag("tbody"),$cellEditTemplate=o._cellEditTemplate,g=t.length,s=0;s<g;s++)r.isNullOrUndefined(s)||t[s].visible&&(h={},l=o._getFieldValue(t[s].field,a.columns.indexOf(t[s])),htmlString=$cellEditTemplate.find("#"+l+"_CellEdit").html(),nt=o._getCustomCellValue(tt[u],t[s].field),h[l]=nt,t[s].editType=="dropdownedit"&&h[t[s].field]==!1&&(h[l]=h[l].toString()),$element=n(n.templates(htmlString).render(h)),d=r.buildTag("td.e-rowcell e-editedcell","",{height:w,"vertical-align":"middle;",overflow:"hidden"},{}),d.addClass("e-validError"),t[s].allowEditing==!1&&$element.attr("disabled",!0).addClass("e-disable"),$element.get(0).tagName=="SELECT"&&($element.val(h[t[s].field]),$element.val()==null&&$element.val($element.find("option").first().val())),$element.get(0).tagName=="INPUT"&&$element.val(h[l]),p.append(d.append($element)),$tbody.append(p));y&&p.append(y);c.append($tbody);v.append(c);b.append(v);i.append(b)},_editRow:function(t,i,u){var f=this,s=f.model,l=s.rowHeight,h=f.getUpdatedRecords(),c=!1,e,o,arguments;if(f._editedRowIndex=t,e=r.TreeGrid.getRowByIndex(f,t),e.hasClass("e-summaryrow")){f._editAddTools();return}if(r.isNullOrUndefined(i)){if(o={},o.data=h[t],o.rowElement=e,o.rowIndex=t,o.columnIndex=u,c=!1,f._trigger("beginEdit",o))return!1}else c=!0;this._frozenColumnsLength>0?(f._appendEditTemplateRow(f._frozenColumns,n(e[0]),t,!0,i),f._appendEditTemplateRow(f._unFrozenColumns,n(e[1]),t,!1,i)):f._appendEditTemplateRow(s.columns,n(e),t,!1,i);f._isRowEdit=!0;f._setoffsetWidth();f._editAddTools();arguments={};c?(arguments.data={},arguments.requestType="add"):(arguments.columnIndex=u,arguments.data=h[t],arguments.requestType="beginEdit");f._refreshEditForm(arguments);n.isFunction(n.validator)&&(f._initValidator(),f.setValidation());s.selectedItem=h[t]},_renderColumnChooser:function(){var t=this,i=r.buildTag("div.e-columnSelector","","",{id:this._id+"ccDiv"});n("#"+t._id+"ccDiv_wrapper").remove();t._renderColumnChooserList(!1);i.append(t._columnChooserList);i.insertAfter(t.element);i.data("columnMenuDialog","TreeGrid");i.ejDialog({showOnInit:!1,allowKeyboardNavigation:!1,enableResize:!1,enableRTL:!1,showHeader:!1,width:"auto",allowDraggable:!1,position:{X:1,Y:1},enableAnimation:!1,minWidth:"0px",minHeight:"0px"});n("#"+t._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content").addClass("e-treegrid-columnchooser")},_renderFilterMenu:function(n){var r=this,u=0,f=0,e=0,o=0,s=0,h=0,i=this.model.columns,c,t;if(!n)for(t=0;t<i.length;t++)(i[t].filterEditType=="numericedit"||i[t].editType=="numericedit")&&u++,(i[t].filterEditType=="stringedit"||i[t].editType=="stringedit")&&f++,(i[t].filterEditType=="datepicker"||i[t].editType=="datepicker")&&e++,(i[t].filterEditType=="datetimepicker"||i[t].editType=="datetimepicker")&&s++,(i[t].filterEditType=="booleanedit"||i[t].editType=="booleanedit")&&h++,(i[t].filterEditType=="dropdownedit"||i[t].editType=="dropdownedit")&&(o++,c=i[t]);(f>0||n=="stringedit")&&(r._renderEdittypeFilterMenu("String"),r._renderedFilterMenuDialog.push("stringedit"));(u>0||n=="numericedit")&&(r._renderEdittypeFilterMenu("Numeric"),r._renderedFilterMenuDialog.push("numericedit"));(e>0||n=="datepicker")&&(r._renderEdittypeFilterMenu("Datepicker"),r._renderedFilterMenuDialog.push("datepicker"));(s>0||n=="datetimepicker")&&(r._renderEdittypeFilterMenu("Datetimepicker"),r._renderedFilterMenuDialog.push("datetimepicker"));(o>0||n=="dropdownedit")&&(r._renderEdittypeFilterMenu("Dropdown",c),r._renderedFilterMenuDialog.push("dropdownedit"));(h>0||n=="booleanedit")&&(r._renderEdittypeFilterMenu("Boolean"),r._renderedFilterMenuDialog.push("booleanedit"))},_renderEdittypeFilterMenu:function(t,i){var f=this,o,e=r.buildTag("div.e-"+f._id+"filter"+t+"Selector e-filterMenuDiv e-treegridmenufilterwraper","",{},{id:this._id+"filter"+t+"MenuDiv"}),u=f._filterMenuTexts;o=t=="Dropdown"?"<div class='e-filter-container'><div class='e-dropdown-filter-container'><input id='"+this._id+"filter"+t+"DropDown'/><\/div><div class='e-filter-button-container'><div class='e-filter-btn-filter'><button id='"+this._id+"filter"+t+"MenuButton' class='e-filterMenuDiv'>"+u.filterButton+"<\/button><\/div><div class='e-filter-btn-clear'><button id='"+this._id+"filter"+t+"ClearButton' class='e-filterMenuDiv'>"+u.clearButton+"<\/button><\/div><\/div><\/div>":t=="Boolean"?"<div class='e-filter-container'><div class='e-checkbox-filter-container'><span class='e-checkbox-filter-text'>"+u.filterValue+"<\/span><div class='e-checkbox-filter-control' style='padding-bottom:14px;padding-left: 48%;'><input id='"+this._id+"filter"+t+"InputBox'/><\/div><div class='e-filter-button-container'><div class='e-filter-btn-filter'><button id='"+this._id+"filter"+t+"MenuButton' class='e-filterMenuDiv'>"+u.filterButton+"<\/button><\/div><div class='e-filter-btn-clear'><button id='"+this._id+"filter"+t+"ClearButton' class='e-filterMenuDiv'>"+u.clearButton+"<\/button><\/div><\/div><\/div>":"<div class='e-filter-container'><div class='e-filter-operator'><input id='"+this._id+"filter"+t+"DropDown'/><\/div><span class='e-filter-text'>"+u.filterValue+"<\/span><div class='e-filter-value'><input id='"+this._id+"filter"+t+"InputBox'/><\/div><div class='e-filter-button-container'><div class='e-filter-btn-filter'><button id='"+this._id+"filter"+t+"MenuButton' class='e-filterMenuDiv'>"+u.filterButton+"<\/button><\/div><div class='e-filter-btn-clear'><button id='"+this._id+"filter"+t+"ClearButton' class='e-filterMenuDiv'>"+u.clearButton+"<\/button><\/div><\/div><\/div>";e.append(o);e.insertAfter(f.element);f._renderFilterMenuDialog(t+"MenuDiv",t,i,u);e.data("filter"+t+"MenuDialog","TreeGrid");e.ejDialog({showOnInit:!1,allowKeyboardNavigation:!1,enableResize:!1,enableRTL:!1,showHeader:!1,width:"auto",allowDraggable:!1,position:{X:1,Y:1},enableAnimation:!1});n("#"+f._id+"filter"+t+"MenuDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css({height:"auto",width:"auto"}).removeClass("e-widget-content");n("#"+f._id+"filter"+t+"MenuDiv_wrapper").css("outline","none").addClass("e-treegrid-columnchooser")},_renderFilterMenuDialog:function(t,i,r,u){var f=this,e,s,o;i=="String"&&(e=u.stringMenuOptions,s="endswith",o={value:"value",text:"text"});(i=="Numeric"||i=="Datepicker"||i=="Datetimepicker")&&(e=u.numberMenuOptions,s="GreaterThan",o={value:"value",text:"text"});i=="Dropdown"&&(e=r.dropdownData,o=r.editParams?{value:r.editParams.fields.value,text:r.editParams.fields.text}:{value:"value",text:"text"});i=="String"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejAutocomplete({width:"100%",watermarkText:u.enterValueText,filterType:s,enableResize:!1,enableDistinct:!0,locale:f.model.locale});i=="Numeric"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejNumericTextbox({decimalPlaces:2,width:"100%",locale:f.model.locale});i=="Boolean"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejCheckBox({size:"small"});i=="Datetimepicker"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejDateTimePicker({width:"100%",locale:f.model.locale});i=="Datepicker"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"InputBox").ejDatePicker({width:"100%",locale:f.model.locale});i!="Boolean"&&n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"DropDown").ejDropDownList({dataSource:e,selectedIndex:1,fields:o,select:function(t){if(i=="String"){var r=n("#"+f._id+"filter"+i+"InputBox").data("ejAutocomplete");r.option("filterType",t.value)}},width:"100%"});n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"MenuButton").ejButton({size:"normal",width:"100%",click:function(t){var e=n.trim(f._columnMenuTarget.prev("div.e-headercelldiv").attr("ej-mappingname")),u=f.getColumnByField(e),i,r;t.e.target.id==f._id+"filterStringMenuButton"&&(i=n("#"+f._id+"filterStringInputBox").data("ejAutocomplete"),r=n("#"+f._id+"filterStringMenuDiv").find("#"+f._id+"filterStringDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.value(),r.model.value));t.e.target.id==f._id+"filterNumericMenuButton"&&(i=n("#"+f._id+"filterNumericInputBox").data("ejNumericTextbox"),r=n("#"+f._id+"filterNumericMenuDiv").find("#"+f._id+"filterNumericDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.model.value,r.model.value));t.e.target.id==f._id+"filterDropdownMenuButton"&&(r=n("#"+f._id+"filterDropdownMenuDiv").find("#"+f._id+"filterDropdownDropDown").data("ejDropDownList"),f._performMenuFilter(u,r.model.value,"equal"));t.e.target.id==f._id+"filterDatepickerMenuButton"&&(i=n("#"+f._id+"filterDatepickerInputBox").data("ejDatePicker"),r=n("#"+f._id+"filterDatepickerMenuDiv").find("#"+f._id+"filterDatepickerDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.model.value,r.model.value));t.e.target.id==f._id+"filterDatetimepickerMenuButton"&&(i=n("#"+f._id+"filterDatetimepickerInputBox").data("ejDateTimePicker"),r=n("#"+f._id+"filterDatetimepickerMenuDiv").find("#"+f._id+"filterDatetimepickerDropDown").data("ejDropDownList"),f._performMenuFilter(u,i.model.value,r.model.value));t.e.target.id==f._id+"filterBooleanMenuButton"&&(i=n("#"+f._id+"filterBooleanInputBox").data("ejCheckBox"),i.model.checkState=="uncheck"?f._performMenuFilter(u,!1,"equal"):i.model.checkState=="check"&&f._performMenuFilter(u,!0,"equal"))}});n("#"+f._id+"filter"+t).find("#"+f._id+"filter"+i+"ClearButton").ejButton({size:"normal",width:"100%",click:function(t){var u=n.trim(f._columnMenuTarget.prev("div.e-headercelldiv").attr("ej-mappingname")),r=f.getColumnByField(u),i;t.e.target.id==f._id+"filterStringClearButton"&&(i=n("#"+f._id+"filterStringMenuDiv").find("#"+f._id+"filterStringDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterNumericClearButton"&&(i=n("#"+f._id+"filterNumericMenuDiv").find("#"+f._id+"filterNumericDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterDropdownClearButton"&&(i=n("#"+f._id+"filterDropdownMenuDiv").find("#"+f._id+"filterDropdownDropDown").data("ejDropDownList"),f._performMenuFilter(r,"","equal"));t.e.target.id==f._id+"filterDatepickerClearButton"&&(i=n("#"+f._id+"filterDatepickerMenuDiv").find("#"+f._id+"filterDatepickerDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterDatetimepickerClearButton"&&(i=n("#"+f._id+"filterDatetimepickerMenuDiv").find("#"+f._id+"filterDatetimepickerDropDown").data("ejDropDownList"),f._performMenuFilter(r,"",i.model.value));t.e.target.id==f._id+"filterBooleanClearButton"&&f._performMenuFilter(r,"","equal")}})},_renderColumnChooserList:function(t,i){for(var u,h,f=this,v=f.model.columns.length,c=f.model.columns,s=r.buildTag("div","",{"margin-left":"0px",width:"auto"}),e=0;e<v;e++)if(f.model.treeColumnIndex!=e&&c[e].showInColumnChooser==!0){if(u=c[e],u.nonColumn)continue;if(!r.isNullOrUndefined(u)){var o=r.buildTag("div","","",{"class":"e-columnMenuListDiv"}),l=r.isNullOrUndefined(u.headerText)?u.field:u.headerText,a=r.buildTag("input","",{},{id:f._id+"_columnMenu_"+u.field.split(".").join(""),value:l,type:"checkbox"}),y=r.buildTag("label",l,{width:"auto"},{"for":f._id+"_columnMenu_"+u.field.split(".").join("")});o.append(a);o.append(y);o.data("column",u.headerText);s.append(o);u.headerText==i&&o.addClass("e-columnmenuselection");a.ejCheckBox({checked:r.isNullOrUndefined(u.visible)?!0:u.visible,change:function(n){var t="";t=r.browserInfo().name=="msie"&&r.browserInfo().version<9?this.element.closest(".e-columnMenuListDiv").data().column:n.model.value;n.isChecked?f.showColumn(t):f.hideColumn(t)}})}}t?(f._columnChooserList.empty().append(s.children()),f._focusTreeGridElement()):f._columnChooserList=s;h=f._columnChooserList.find("div.e-columnMenuListDiv");n(h).mouseenter(function(){h.removeClass("e-columnmenuselection");n(this).addClass("e-columnmenuselection")})},_createColumnMenuTemplate:function(){var t=this,r="<li style='list-style-type:none;'><div class='e-columnmenuitem{{if enabled==false}} e-disable{{/if}}{{if (menuId =='Columns' || menuId =='Filter')}} e-parent-menuitem{{/if}}' style='display:table;cursor:pointer' id='"+t._id+"_{{:menuId}}Chooser'><div class='e-icon {{:icon}} e-treegridicon' style='display:inline-block;'><\/div><div class='e-menuitem-label' style='display:inline-block;width:auto'><span>{{:name}}<\/span><\/div>{{if (menuId =='Columns' || menuId =='Filter')}}<div class='e-icon e-expander e-treegridicon' style='display:inline-block;float:right;'/> {{/if}}<\/div>{{if menuId == 'RenameColumn' || menuId == 'SortDescending'}}<hr class='e-menuitem-hr'>{{/if}}<\/li>",i={};i[t._id+"columnMenuTemplate"]=r;n.templates(i)},_updateFilterMenuList:function(t){var i=this,a=i.model,v=columnFilterPosX=posY=0,f=n(t.target),y=o=0,y=f[0].offsetWidth,o=f[0].offsetHeight,p=n.trim(f.prev("div.e-headercelldiv").attr("ej-mappingname")),u,s,l,h,c,e,r=i.getColumnByField(p);i._clearFilterMenu();i._clearColumnMenu("columnmenu");i._columnMenuTarget=f;i._filterIconTarget=t;this.editFormValidate()&&(a.isEdit?this.saveCell():this._isRowEdit&&this.saveRow());u=i.getOffsetRect(f[0]);u.top=u.top+o;posY=i.model.isFromGantt?u.top+o:u.top+o;s=a.isFromGantt?n(this.element).closest(".e-gantt"):n(this.element);containerOffset=this.getOffsetRect(s[0]);containerOffset.bottom=containerOffset.top+s[0].offsetHeight;containerOffset.right=containerOffset.left+n(s).width();r.filterEditType?(c=r.filterEditType.indexOf("edit"),e=r.filterEditType):(c=r.editType.indexOf("edit"),e=r.editType);c!=-1?(l=e.slice(0,c),h=l.charAt(0).toUpperCase()+l.slice(1),i._showFilterMenu("filtermenu","filter"+h,u,y,containerOffset.right,v,null,null,r)):(h=e.charAt(0).toUpperCase()+e.slice(1),i._showFilterMenu("filtermenu","filter"+h,u,y,containerOffset.right,v,null,null,r));i._updatePreviousFilteredValue(r)},_renderColumnMenu:function(t){var i=this,f=i.model,c=columnListPosX=columnFilterPosX=posY=0,y=n(t.target),ot=nt=0,o=[],w=0,ot=y[0].offsetWidth,nt=y[0].offsetHeight,s=i._columnMenuTexts,st=n.trim(y.prev("div.e-headercelldiv").attr("ej-mappingname")),e=i.getColumnByField(st),b,ht=e.allowSorting==u?!0:e.allowSorting,tt,it,p,l,rt,k,ut,lt,h,d,a,et,g;if(i._clearColumnMenu("columnmenu"),i._columnMenuTarget=y,f.isEdit||this._isRowEdit)if(this.editFormValidate())f.isEdit?this.saveCell():this._isRowEdit&&this.saveRow();else return!0;f.showColumnChooser&&f.showColumnOptions&&(tt=i._enableDisableInsertLabel(),o.push({name:s.insertColumnLeft,icon:"e-column-insertleft-icon",menuId:"ColumnLeft",enabled:tt}),o.push({name:s.insertColumnRight,icon:"e-column-insertright-icon",menuId:"ColumnRight",enabled:tt}),o.push({name:s.deleteColumn,icon:"e-column-delete-icon",menuId:"DeleteColumn",enabled:i._enableDisableDEL(e)}),o.push({name:s.renameColumn,icon:"e-column-rename-icon",menuId:"RenameColumn"}));f.allowFiltering&&(r.isNullOrUndefined(e.allowFiltering)||e.allowFiltering)&&f.filterSettings.filterType=="menu"&&(i._filteredColumnValueID.indexOf(e.field)!=-1?(o.push({name:s.menuFilter,icon:"e-column-filtered-icon",menuId:"Filter"}),b=o.length):(o.push({name:s.menuFilter,icon:"e-column-filter-icon",menuId:"Filter"}),b=o.length));f.allowSorting&&ht&&(o.push({name:s.sortAscendingText,icon:"e-columnmenu-ascending",menuId:"SortAscending"}),o.push({name:s.sortDescendingText,icon:"e-columnmenu-descending",menuId:"SortDescending"}));f.showColumnChooser&&(w=o.length,o.push({name:s.columnsText,icon:"e-columnchooser-icon",menuId:"Columns"}));f.isFromGantt||(e.allowFreezing||i._allowFreezingDefault&&r.isNullOrUndefined(e.allowFreezing))&&(p=!1,i._frozenColumnsLength!=f.columns.length-1||e.isFrozen||(it=!0),l=this._getFrozenColumnWidth(),rt=f.columns.indexOf(e),l=l+this.columnsWidthCollection[rt]+18,l>this._gridWidth&&(it=!0),o.push({name:s.freezeText,icon:"e-freezecolumn-icon",menuId:"FreezeColumns",enabled:it?!1:!e.isFrozen}),o.push({name:s.unfreezeText,icon:"e-unfreezecolumn-icon",menuId:"UnfreezeColumns",enabled:e.isFrozen==!0}),i._checkboxSelection?f.columns[0].nonColumn&&f.columns.indexOf(e)!=1&&f.columns.indexOf(e)>this._frozenColumnsLength&&(p=!0):f.columns.indexOf(e)!=0&&f.columns.indexOf(e)>this._frozenColumnsLength&&(p=!0),l=this._getFrozenColumnWidth(rt),l=l+18,l>this._gridWidth&&(p=!1),o.push({name:s.freezePrecedingColumnsText,icon:"e-freezecolumnbefore-icon",menuId:"FreezePrecedingColumns",enabled:p}));k=i.getOffsetRect(y[0]);ut=i.getOffsetRect(i.element[0]);posY=i.model.isFromGantt?k.top+nt:k.top+nt;i._columnChooserListIndex=w;var v=r.buildTag("div.e-columnmenu","",{display:"table",position:"absolute",top:posY,"z-index":i.getMaxZIndex()+1},{id:i._id+"_ColumnMenu"}),ft=r.buildTag("ul.e-treegrid-columnmenu","",{},{}),ct=n.render[i._id+"columnMenuTemplate"](o);ft.append(ct);v.append(ft);n(document.body).append(v);lt=v.height();h=v.outerWidth()+1;c=k.left+ot-h;c<=ut.left&&(c=ut.left);columnListPosX=c+h;columnFilterPosX=c+h;i._columnListPosX=columnListPosX;i._columnFilterPosX=columnFilterPosX;v.css({left:c});v.find(".e-columnmenuitem").outerWidth(h);d=f.isFromGantt?n(this.element).closest(".e-gantt"):n(this.element);a=this.getOffsetRect(d[0]);a.bottom=a.top+d[0].offsetHeight;a.right=a.left+n(d).width();f.isFromGantt||(i.model.isResponsive&&n(window).width()<=i._responsiveMinWidth?n("#"+i._id+"_ColumnMenu").find(".e-expander").addClass("e-treegridadaptivesubicon"):n("#"+i._id+"_ColumnMenu").find(".e-expander").removeClass("e-treegridadaptivesubicon"));n("#"+i._id+"_ColumnsChooser").on("mouseenter click",function(t){var r,s;if(t.type=="mouseenter"&&n(window).width()>i._responsiveMinWidth||!i.model.isResponsive||t.type=="click"&&n(window).width()<=i._responsiveMinWidth&&i.model.isResponsive||f.isFromGantt){if(n(window).width()>i._responsiveMinWidth||!i.model.isResponsive||f.isFromGantt){r={};r.width="auto";r.height="auto";r.minWidth="0px";r.minHeight="0px";r.showHeader=!1;r.position={X:1,Y:1};r.enableModal=!1;r.isResponsive=!1;r.enableResize=!1;n("#"+i._id+"ccDiv_wrapper").addClass("e-treegridadaptivedialog");n("#"+i._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content");n("#"+i._id+"ccDiv").ejDialog(r);n("#"+i._id+"ccDiv").css({height:"auto"});i._updateColumnMenuVisibility();var e=n("#"+i._id+"ccDiv").ejDialog("instance"),u=n("#"+i._id+"ccDiv_wrapper"),o=u.find("div.e-columnMenuListDiv");e.open();a.right<columnListPosX+u.width()&&(columnListPosX=columnListPosX-u.width()-h,columnListPosX<=h&&(columnListPosX=c+h));i._columnListPosX=columnListPosX;s={X:columnListPosX,Y:posY+n("#"+i._id+"_ColumnsChooser").position().top};e.option({position:s});u.css("z-index",i.getMaxZIndex()+1);o.removeClass("e-columnmenuselection");o.eq(0).addClass("e-columnmenuselection");i._focusTreeGridElement();i._renderedSubMenuType="ColumnDesktop"}else i._adaptiveColumnChooser();f.allowFiltering&&f.filterSettings.filterType=="menu"&&i._clearFilterMenu()}});n("#"+i._id+"_FilterChooser").on("mouseenter click",function(t){if(t.type=="mouseenter"&&n(window).width()>i._responsiveMinWidth||!i.model.isResponsive||t.type=="click"&&n(window).width()<=i._responsiveMinWidth&&i.model.isResponsive){var r,f,u;i._updateColumnMenuVisibility();e.filterEditType?(r=e.filterEditType.indexOf("edit"),filtertype=e.filterEditType):(r=e.editType.indexOf("edit"),filtertype=e.editType);r!=-1?(f=filtertype.slice(0,r),u=f.charAt(0).toUpperCase()+f.slice(1),i._showFilterMenu("columnchooser","filter"+u,columnFilterPosX,h,a.right,c,w,b,e)):(u=filtertype.charAt(0).toUpperCase()+filtertype.slice(1),i._showFilterMenu("columnchooser","filter"+u,columnFilterPosX,h,a.right,c,w,b,e));i._updatePreviousFilteredValue(e);n("#"+i._id+"ccDiv").ejDialog("close")}});n("#"+i._id+"_SortAscendingChooser,#"+i._id+"_SortDescendingChooser,#"+i._id+"_FreezeColumnsChooser,#"+i._id+"_UnfreezeColumnsChooser,#"+i._id+"_FreezePrecedingColumnsChooser,#"+i._id+"_ColumnLeftChooser,#"+i._id+"_ColumnRightChooser,#"+i._id+"_DeleteColumnChooser,#"+i._id+"_RenameColumnChooser").mouseenter(function(){n("#"+i._id+"ccDiv").ejDialog("close");f.allowFiltering&&f.filterSettings.filterType=="menu"&&i._clearFilterMenu()});n("#"+i._id+"_SortAscendingChooser").click(function(){f.allowMultiSorting&&(i._multiSortRequest=!0);f.isFromGantt?i.sortColumn(e.mappingName,r.sortOrder.Ascending):i.sortColumn(e.field,r.sortOrder.Ascending);i._multiSortRequest=!1});n("#"+i._id+"_SortDescendingChooser").click(function(){f.allowMultiSorting&&(i._multiSortRequest=!0);f.isFromGantt?i.sortColumn(e.mappingName,r.sortOrder.Descending):i.sortColumn(e.field,r.sortOrder.Descending);i._multiSortRequest=!1});n("#"+i._id+"_FreezeColumnsChooser").click(function(){n(this).hasClass("e-disable")||(i._checkboxSelection&&f.columns[0].nonColumn&&!f.columns[0].isFrozen&&(f.columns[0].isFrozen=!0),i.freezeColumn(e.field,!0))});n("#"+i._id+"_UnfreezeColumnsChooser").click(function(){n(this).hasClass("e-disable")||(i._checkboxSelection&&i._frozenColumnsLength==2&&f.columns[0].nonColumn&&f.columns[0].isFrozen&&(f.columns[0].isFrozen=!1),i.freezeColumn(e.field,!1))});n("#"+i._id+"_FreezePrecedingColumnsChooser").click(function(){n(this).hasClass("e-disable")||i.freezePrecedingColumns(e.field)});n("#"+i._id+"_ColumnLeftChooser").click(function(){if(n(this).hasClass("e-disable"))return!1;i.insertColumnChooser(e,"left")});n("#"+i._id+"_ColumnRightChooser").click(function(){if(n(this).hasClass("e-disable"))return!1;i.insertColumnChooser(e,"right")});n("#"+i._id+"_DeleteColumnChooser").click(function(){if(n(this).hasClass("e-disable"))return!1;i._targetColumnIndex=f.columns.indexOf(e);i._updateConfirmDialog.ejDialog("open");i._clearColumnMenu()});n("#"+i._id+"_RenameColumnChooser").click(function(){i._targetColumnIndex=f.columns.indexOf(e);i._renderColumnRenameDialog(e);i._columnRenameDialog.ejDialog("open");i._clearColumnMenu()});et=n("#"+i._id+"_ColumnMenu");g=et.find("div.e-columnmenuitem");g.eq(0).addClass("e-columnmenuselection");n(g).mouseenter(function(){n(this).hasClass("e-disable")||(g.removeClass("e-columnmenuselection"),n(this).addClass("e-columnmenuselection"))})},_adaptiveColumnChooser:function(){var t=this,i={},r=t.getOffsetRect(n("#"+t._id)[0]),f=t._columnMenuTexts,u;i.cssClass=t.model.cssClass;i.enableModal=!1;i.enableResize=!1;i.enableResize=!1;i.contentSelector="#"+t._id;i.rtl=t.model.rtl;i.allowDraggable=!1;i.showHeader=!0;i.minHeight="50px";i.minWidth="50px";i.width=n("#"+t._id).width()+"px";i.height=n("#"+t._id).height()+"px";i.position={X:r.left+"px",Y:r.top+"px"};i.isResponsive=!1;i.allowKeyboardNavigation=!1;i.title=f.columnsText;n("#"+t._id+"ccDiv_wrapper").removeClass("e-treegridadaptivedialog");n("#"+t._id+"ccDiv_wrapper").addClass("e-dialog").addClass("e-shadow").find("div.e-dialog-scroller").css("height","100%");n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").addClass("e-treegridadaptivedialog");n("#"+t._id+"ccDiv").ejDialog(i);n("#"+t._id+"ccDiv").ejDialog("open");n("#"+t._id+"ccDiv").css({width:"100%",height:"100%"});t.model.isResponsive&&(u=n("#"+t._id).height()-50+"px",n("#"+t._id+"ccDiv_wrapper").css({width:n("#"+t._id).width(),height:n("#"+t._id).height()}),n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"ccDiv").css({width:"100%",height:"auto"}),n("#"+t._id+"ccDiv").height()>n("#"+t._id+"ccDiv_wrapper").height()-48?(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-48+"px",width:"auto",padding:"0px"}),n("#"+t._id+"ccDiv").removeClass("e-columnSelector"),n("#"+t._id+"ccDiv").ejDialog("refresh")):(n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({height:u,width:"auto"}),n("#"+t._id+"ccDiv").css({padding:"8px 16px"})),n("#"+t._id+"ccDiv_wrapper").removeClass("e-shadow"),n("#"+t._id+"ccDiv").removeClass("e-shadow"));t._renderedSubMenuType="AdaptiveColChooser";n("#"+t._id+"_ColumnMenu").remove()},_updatePreviousFilteredValue:function(t){var i=this,f,l,a,v,u,o=[],c,s,h,e;s=t.filterEditType?t.filterEditType:t.editType;s=="stringedit"&&(e=n("#"+i._id+"filterStringInputBox").data("ejAutocomplete"),f=n("#"+i._id+"filterStringMenuDiv").find("#"+i._id+"filterStringDropDown").data("ejDropDownList"),a=r.Query().select(t.field),l=new r.DataManager(i.model.flatRecords.slice()),v=l.executeLocal(a),e.option("dataSource",v),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","startswith"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value),n("#"+i._id+"filterStringInputBox").val(i._filteredColumnValue[u].value)):(f.option("value","startswith"),e.option("value",null)));s=="numericedit"&&(e=n("#"+i._id+"filterNumericInputBox").data("ejNumericTextbox"),f=n("#"+i._id+"filterNumericMenuDiv").find("#"+i._id+"filterNumericDropDown").data("ejDropDownList"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","lessthan"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value),n("#"+i._id+"filterNumericInputBox").val(i._filteredColumnValue[u].value)):(e.option("value",null),f.option("value","lessthan")));s=="datepicker"&&(e=n("#"+i._id+"filterDatepickerInputBox").data("ejDatePicker"),f=n("#"+i._id+"filterDatepickerMenuDiv").find("#"+i._id+"filterDatepickerDropDown").data("ejDropDownList"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","lessthan"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value)):(e.option("value",null),f.option("value","lessthan")),t.format&&e.option("dateFormat",i._getDateFormat(t.format)));s=="datetimepicker"&&(e=n("#"+i._id+"filterDatetimepickerInputBox").data("ejDateTimePicker"),f=n("#"+i._id+"filterDatetimepickerMenuDiv").find("#"+i._id+"filterDatetimepickerDropDown").data("ejDropDownList"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?f.option("value","lessthan"):f.option("value",i._filteredColumnValue[u].dropdown),e.option("value",i._filteredColumnValue[u].value)):(e.option("value",null),f.option("value","lessthan")),t.format&&e.option("dateFormat",i._getDateFormat(t.format)));s=="dropdownedit"&&(n.extend(o,t.dropdownData),t.editParams?(c={value:t.editParams.fields.value,text:t.editParams.fields.text},h={},h[t.editParams.fields.text]=i._dropDownListBlanksText,h[t.editParams.fields.value]="(Blanks)"):(c={value:"value",text:"text"},h={text:i._dropDownListBlanksText,value:"(Blanks)"}),f=n("#"+i._id+"filterDropdownDropDown").data("ejDropDownList"),r.isNullOrUndefined(o)||o.length==0?(o=i._dropDownArrayCollection(t,t.field),(t.allowFilteringBlankContent||r.isNullOrUndefined(t.allowFilteringBlankContent))&&o.unshift(h),f.option("dataSource",o)):((t.allowFilteringBlankContent||r.isNullOrUndefined(t.allowFilteringBlankContent))&&o.unshift(h),f.option("dataSource",o)),f.option("fields",c),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),f.option("value",i._filteredColumnValue[u].value)):f.option("value",null));s=="booleanedit"&&(e=n("#"+i._id+"filterBooleanInputBox").data("ejCheckBox"),i._filteredColumnValueID.indexOf(t.field)!=-1?(u=i._filteredColumnValueID.indexOf(t.field),i._filteredColumnValue[u].value==""?e.option("checkState","uncheck"):e.option("value",i._filteredColumnValue[u].value)):e.option("selectedIndex",""))},_performMenuFilter:function(n,t,i){var u=this,f;u.clearAllSelection();f=n.filterEditType?n.filterEditType:n.editType;r.isNullOrUndefined(t)&&(t="");u._searchString=t;u._filteredColumnValueID.indexOf(n.field)==-1&&t.toString()==""?(u.clearColumnMenu(),u._clearFilterMenu()):(f=="numericedit"||f=="datepicker"||f=="datetimepicker"?(f=="datepicker"||f=="datepicker")&&(i=="equal"||i=="notequal")?u.filterColumn(n.field,i,t,"and"):u.filterColumn(n.field,i,t,"and",!0):u.filterColumn(n.field,i,t,"and"),u.model.showColumnChooser||(u._filterIconTarget.target.className=t.toString()!=""||t.toString()=="false"?"e-column-filtered-icon e-icon e-filtericon":"e-column-filter-icon e-icon e-filtericon"),u._storePreviousFilteredValue(n.field,t,i),u._searchString=t,u.clearColumnMenu(),u._clearFilterMenu())},_storePreviousFilteredValue:function(n,t,i){var r=this;r._filteredColumnValueID.indexOf(n)==-1&&(t.toString()!=""||t.toString()=="false")?(r._filteredColumnValue.push({column:n,value:t,dropdown:i}),r._filteredColumnValueID.push(n)):t.toString()!=""||t.toString()=="false"?(filteredColumnIdIndex=r._filteredColumnValueID.indexOf(n),r._filteredColumnValue[filteredColumnIdIndex].value=t,r._filteredColumnValue[filteredColumnIdIndex].dropdown=i):r._filteredColumnValueID.indexOf(n)!=-1&&(filteredColumnIdIndex=r._filteredColumnValueID.indexOf(n),r._filteredColumnValue.splice(filteredColumnIdIndex,1),r._filteredColumnValueID.splice(filteredColumnIdIndex,1))},_showFilterMenu:function(t,i,r,u,f,e,o,s,h){var k,l,c,y,a,p,v,w;if(this.editFormValidate())if(n(window).width()<=this._responsiveMinWidth&&this.model.isResponsive&&!this.model.isFromGantt){var c=this,l={},b=c.getOffsetRect(n("#"+c._id)[0]);l.cssClass=this.model.cssClass;l.enableModal=!1;l.isResponsive=!1;l.enableRTL=this.model.enableRTL;l.enableResize=!1;l.allowDraggable=!1;l.minWidth="50px";l.minHeight="50px";l.width=n("#"+c._id).width()+"px";l.height=n("#"+c._id).height()+"px";l.position={X:b.left+"px",Y:b.top+"px"};l.contentSelector="#"+c._id;l.rtl=c.model.rtl;l.allowKeyboardNavigation=!1;l.showHeader=!0;l.title=h.headerText;n("#"+c._id+i+"MenuDiv").removeClass("e-treegridadaptivedialog");n("#"+c._id+i+"MenuDiv").ejDialog(l);n("#"+c._id+i+"MenuDiv_wrapper").addClass("e-dialog").addClass("e-shadow").find("div.e-dialog-scroller").addClass("e-treegridadaptivewidth");n("#"+c._id+i+"MenuDiv").css({width:"100%",height:"auto"});k=n("#"+c._id).height()-50+"px";n("#"+c._id+i+"MenuDiv").ejDialog("open");n("#"+c._id+i+"MenuDiv_wrapper").find("div.e-dialog-scroller").css({height:k});n("#"+c._id+i+"MenuDiv_wrapper").removeClass("e-shadow");n("#"+c._id+i+"MenuDiv").removeClass("e-shadow");n("#"+c._id+i+"MenuDiv").height()>n("#"+c._id+i+"MenuDiv_wrapper").height()-48&&n("#"+c._id+i+"MenuDiv").ejDialog("refresh");c._renderedSubMenuType="#"+c._id+i+"MenuDiv";n("#"+c._id+"_ColumnMenu").remove()}else c=this,l={},l.width="auto",l.height="auto",l.minWidth="0px",l.minHeight="0px",l.showHeader=!1,l.position={X:1,Y:1},l.enableModal=!1,l.isResponsive=!1,l.enableResize=!1,n("#"+c._id+i+"MenuDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content"),n("#"+c._id+i+"MenuDiv").ejDialog(l),c=this,y=n("#"+c._id+i+"MenuDiv").ejDialog("instance"),a=n("#"+c._id+i+"MenuDiv_wrapper"),t=="columnchooser"?(windowWidth=n(document).width(),(f<r+a.width()||windowWidth<r+a.width())&&r-u-a.width()>0&&(r=r-u-a.width()),p={X:r,Y:posY+n("#"+c._id+"_FilterChooser").position().top},y.option({position:p}),y.open()):(t="filtermenu")&&(v=r,w=u,e=v.left+w-a.width(),v.left=e+a.width()+4,f<v.left+a.width()&&(v.left=v.left-a.width()-w),p={X:v.left,Y:v.top},y.option({position:p}),y.open()),c._renderedSubMenuType="#"+c._id+i+"MenuDivDesktop"},_clearResponsiveColumnMenu:function(){var t=this;n("div[id$='ccDiv']").each(function(){n(this).data("columnMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("#"+t._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({padding:"0px"});n("#"+t._id+"ccDiv").addClass("e-columnSelector");n("div[id$='filterStringMenuDiv']").each(function(){n(this).data("filterStringMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterNumericMenuDiv']").each(function(){n(this).data("filterNumericMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterBooleanMenuDiv']").each(function(){n(this).data("filterBooleanMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterDatepickerMenuDiv']").each(function(){n(this).data("filterDatepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterDatetimepickerMenuDiv']").each(function(){n(this).data("filterDatetimepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='filterDropdownMenuDiv']").each(function(){n(this).data("filterDropdownMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='ColumnRenameDialog']").each(function(){n(this).data("ejDialog")&&n(this).ejDialog("close")});n("div[id$='dialogColumnAdd']").each(function(){n(this).data("ejDialog")&&n(this).ejDialog("close")});n("#"+t._id).find(".e-filtericon").data("isClicked",!1)},_clearColumnMenu:function(t){var i=this;t==="columnmenu"&&n(window).width()<i._responsiveMinWidth&&i._clearResponsiveColumnMenu();i.model.isResponsive&&n(window).width()<i._responsiveMinWidth?(n("#"+i._id+"_ColumnMenu").remove(),i._renderedSubMenuType&&i._renderedSubMenuType.indexOf("AdaptiveColChooser")==-1&&(n("div[id$='"+i._id+"ccDiv']").each(function(){n(this).data("columnMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("#"+i._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({padding:"0px"}),n("#"+i._id+"ccDiv").addClass("e-columnSelector"))):(n("#"+i._id+"_ColumnMenu").remove(),t!="resize"&&(n("div[id$='"+i._id+"ccDiv']").each(function(){n(this).data("columnMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("#"+i._id+"ccDiv_wrapper").find("div.e-dialog-scroller").css({padding:"0px"}),n("#"+i._id+"ccDiv").addClass("e-columnSelector"),t!="resize"&&i.model.allowFiltering&&i.model.filterSettings.filterType=="menu"&&i._clearFilterMenu()));n("#"+i._id).find(".e-columnicon").data("isClicked",!1);n("#"+i._id).find(".e-filtericon").data("isClicked",!1)},_clearFilterMenu:function(){var t=this,i,r;t.model.allowFiltering&&t.model.filterSettings.filterType=="menu"&&(n("div[id$='"+t._id+"filterStringMenuDiv']").each(function(){n(this).data("filterStringMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterNumericMenuDiv']").each(function(){n(this).data("filterNumericMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterBooleanMenuDiv']").each(function(){n(this).data("filterBooleanMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterDatepickerMenuDiv']").each(function(){n(this).data("filterDatepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterDatetimepickerMenuDiv']").each(function(){n(this).data("filterDatetimepickerMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("div[id$='"+t._id+"filterDropdownMenuDiv']").each(function(){n(this).data("filterDropdownMenuDialog")=="TreeGrid"&&n(this).data("ejDialog")&&n(this).ejDialog("close")}),n("#"+t._id+"filterStringDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterStringInputBox_suggestion").hide(),n("#"+t._id+"filterNumericDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterNumericInputBox_suggestion").hide(),n("#"+t._id+"filterDatepickerDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterDatepickerInputBox_suggestion").hide(),n("#"+t._id+"filterDatetimepickerDropDown_popup_list_wrapper").hide(),n("#"+t._id+"filterDatetimepickerInputBox_suggestion").hide(),n("#"+t._id+"filterDropdownDropDown_popup_list_wrapper").hide(),n("#"+t._id).find(".e-filtericon").data("isClicked",!1),i=n("#"+t._id+"filterDatetimepickerInputBox").data("ejDateTimePicker"),i&&i.hide(),r=n("#"+t._id+"filterDatepickerInputBox").data("ejDatePicker"),r&&r.hide())},_getDateFormat:function(n){var t=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),i=t.exec(n);return i[2]},_enableDisableDEL:function(n){var u=this,t=u.model,i=n.field,r=t.columns.indexOf(n);return t.isFromGantt?i!="taskId"&&i!="taskName"&&i!="startDate"&&i!="endDate"&&(i!="duration"||t.endDateMapping)&&r!=t.treeColumnIndex?!0:!1:r==t.treeColumnIndex?!1:!0},_enableDisableInsertLabel:function(){var t=this,i=t.model,n;return!i.isFromGantt&&t._frozenColumnsLength>0?(n=this._getFrozenColumnWidth(),n=n+250,n>this._gridWidth?!1:!0):!0},insertColumnChooser:function(t,i){var u=this,e=u.model,f;n("#"+u._id+"_dialogColumnAdd").length===0&&(f=r.buildTag("div.e-dialog e-dialog-content e-widget-content","",{display:"none"},{id:u._id+"_dialogColumnAdd"}),u.element.append(f),u._on(n("#"+u._id+"_dialogColumnAdd"),"click keypress","#ColumnAddDialog_"+u._id+"_Ok ,#ColumnAddDialog_"+u._id+"_Cancel",u._buttonClick));u.renderColumnAddDialog();u._targetColumnIndex=e.columns.indexOf(t);u._insertPosition=i},renameColumn:function(n,t){var r=this,f=r.model,u=f.columns,i={};i.requestType="renameColumn";i.columnObject=u[n];i.previousName=u[n].headerText;i.currentName=t;r._trigger("actionComplete",i)||(u[n].headerText=t,r._refreshFrozenColumns())},_renderColumnRenameDialog:function(t){var i=this,o=i._columnMenuTexts,f=r.buildTag("div.e-treegridrenamedialog","",{},{unselectable:"on"}),s=n("#"+i._id).width(),h=n("#"+i._id).height(),e=r.buildTag("form","",{height:"100%",width:"100%","font-size":"14px"},{id:i._id+"ColumnRenameForm",onsubmit:"return false"}),u;$buttons=r.buildTag("span.e-buttons","<input class='e-treegrid-rename-dialog-btn-ok' type='button' id="+i._id+"RenameDialogOK value="+i._okButtonText+" /> <input class='e-treegrid-rename-dialog-btn-cancel' type='button' id="+i._id+"RenameDialogCancel value='"+i._cancelButtonText+"' />");btnDiv=r.buildTag("div","",{},{"class":"e-treegrid-rename-dialog-btn"});$innerTable=r.buildTag("table","",{outline:"none",width:"100%"},{unselectable:"on"});$inTr1=r.buildTag("tr");$inTd=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"});$inTd.append("<label style='font-weight:normal;'>"+i._columnDialogTitle.renameColumn+"<\/label>");$inTr1.append($inTd);$innerTable.append($inTr1);$inTr2=r.buildTag("tr");$inTd2=r.buildTag("td.e-editValue");$input=r.buildTag("input.e-field e-ejinputtext","",{},{value:t.headerText,id:i._id+"RenameHeaderText",name:t.field,dialog:"RenameHeaderText"});$inTd2.html($input);$inTr2.append($inTd2);$innerTable.append($inTr2);e.append($innerTable);f.append(e);i._columnRenameDialog=r.buildTag("div","","",{title:o.renameColumn,id:i._id+"ColumnRenameDialog"});btnDiv.append($buttons);i._columnRenameDialog.append(f).append(btnDiv);i.element.append(i._columnRenameDialog);$buttons.find("input").ejButton({cssClass:i.model.cssClass,showRoundedCorner:!0,size:"normal",click:n.proxy(i._triggerRenameColumn,i)});n(window).width()<=i._responsiveMinWidth&&i.model.isResponsive&&!i.model.isFromGantt?i.model.isResponsive&&(u=i.getOffsetRect(n("#"+i._id)[0]),n("#"+i._id+"ColumnRenameDialog").removeClass("e-treegridadaptivedialog"),i._columnRenameDialog.ejDialog({width:s+"px",height:h+"px",position:{X:u.left+"px",Y:u.top+"px"},minHeight:"50px",minWidth:"50px",showOnInit:!1,allowDraggable:!1,enableResize:!1,enableModal:!1,isResponsive:!1}),n("#"+i._id+"ColumnRenameDialog_wrapper").removeClass("e-shadow").addClass("e-treegrid-dialog"),n("#"+i._id+"ColumnRenameDialog").removeClass("e-shadow")):(i._columnRenameDialog.ejDialog({width:"auto",height:"auto",minHeight:0,minWidth:240,showOnInit:!1,enableResize:!1,allowDraggable:!0,enableModal:!0,isResponsive:!0}),n("#"+i._id+"ColumnRenameDialog_wrapper").addClass("e-treegrid-dialog"));$input.focus().select()},_triggerRenameColumn:function(n){var t=this,i,f;n!==u&&n.model.text==t._okButtonText&&(i=t._columnRenameDialog.find("#"+t._id+"RenameHeaderText"),f=i.val(),t.renameColumn(t._targetColumnIndex,f),this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&(r.isNullOrUndefined(t.model.editSettings.dialogEditorTemplateID)||t.model.editSettings.dialogEditorTemplateID=="")?t._treeGridAddEditDialog():this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&!r.isNullOrUndefined(t.model.editSettings.dialogEditorTemplateID)&&t.model.editSettings.dialogEditorTemplateID!=""&&t._treeGridAddEditDialogTemplate());t._columnRenameDialog.ejDialog("close")},renderColumnAddDialog:function(){var t=this,h=t.model,e=h.columnDialogFields,r={},o=t.getOffsetRect(n("#"+t._id)[0]),u,s,f,i;if(r.requestType="openColumnAddDialog",e.length)for(r.data={},u=0;u<e.length;u++)s=e[u],r.data[s]="";else r.data={field:"",headerText:"",editType:""};t._trigger("actionBegin",r)||(r.requestType="columnAdd",f=document.createElement("div"),n(f).addClass("e-addedColumn"),f.innerHTML=n.render[t._id+"_ColumnAddTemplate"](r.data),n("#"+t._id+"_dialogColumnAdd").html(n(f)),i={},i.cssClass=this.model.cssClass,i.enableResize=!1,i.width="auto",i.height="auto",i.contentSelector="#"+t._id,i.rtl=t.model.rtl,i.allowKeyboardNavigation=!1,title=t._columnDialogTitle.insertColumn,i.title=title,(n(window).width()>t._responsiveMinWidth||!t.model.isResponsive||t.model.isFromGantt)&&(i.enableModal=!0,i.allowDraggable=!0,i.isResponsive=!0,n("#"+t._id+"_dialogColumnAdd").ejDialog(i),n("#"+t._id+"_dialogColumnAdd").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").addClass("e-treegridadaptivedialog e-treegrid-dialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").addClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd").ejDialog("open"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css("width","438px")),n(window).width()<=t._responsiveMinWidth&&t.model.isResponsive&&!t.model.isFromGantt&&(i.isResponsive=!1,i.enableResize=!1,i.enableModal=!1,i.allowDraggable=!1,i.width=n("#"+t._id).width()+"px",i.height=n("#"+t._id).height()+"px",i.minHeight="150px",i.minWidth="150px",n("#"+t._id+"_dialogColumnAdd").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd").find(".dropdowntreegrid").css({width:n("#"+t._id).width()-80+"px",height:"150px"}),n("#"+t._id+"_dialogColumnAdd").ejDialog(i),n("#"+t._id+"_dialogColumnAdd").ejDialog("open"),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-treegridadaptivedialog").addClass("e-treegrid-dialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").removeClass("e-treegridadaptivedialog"),n("#"+t._id+"_dialogColumnAdd_wrapper").css({left:o.left+"px",top:o.top+"px"}),n("#"+t._id+"_dialogColumnAdd_wrapper").removeClass("e-shadow"),n("#"+t._id+"_dialogColumnAdd").removeClass("e-shadow"),n("#"+t._id+"_dialogColumnAdd_wrapper").find("div.e-dialog-scroller").css({height:n("#"+t._id).height()-50+"px"})),t._clearColumnMenu(),t._refreshColumnAddForm(),n("#"+t._id+"_dialogColumnAdd").ejDialog("refresh"))},setAddColumnFields:function(){var t=this,r=t.model,u,i;if(r.columnDialogFields.length){for(t._addColumnFields=r.columnDialogFields,u=["field","headerText","editType"],i=0;i<u.length;i++)if(n.inArray(u[i],t._addColumnFields)==-1)switch(u[i]){case"field":t._addColumnFields.splice(0,0,u[i]);break;case"headerText":t._addColumnFields.splice(1,0,u[i]);break;case"editType":t._addColumnFields.splice(2,0,u[i])}for(r.isFromGantt?(r.allowSorting||t._addColumnFields.indexOf("allowSorting")==-1||t._addColumnFields.splice(t._addColumnFields.indexOf("allowSorting"),1),r.selectionSettings.selectionMode=="row"&&t._addColumnFields.indexOf("allowCellSelection")!=-1&&t._addColumnFields.splice(t._addColumnFields.indexOf("allowCellSelection"),1)):(r.allowSorting||t._addColumnFields.indexOf("allowSorting")==-1||t._addColumnFields.splice(t._addColumnFields.indexOf("allowSorting"),1),r.allowFiltering||t._addColumnFields.indexOf("allowFiltering")==-1||t._addColumnFields.splice(t._addColumnFields.indexOf("allowFiltering"),1),r.selectionSettings.selectionMode=="row"&&t._addColumnFields.indexOf("allowCellSelection")!=-1&&t._addColumnFields.splice(t._addColumnFields.indexOf("allowCellSelection"),1)),t._addColumnFields.indexOf("displayAsCheckbox")!=-1&&t._addColumnFields.push(t._addColumnFields.splice(t._addColumnFields.indexOf("displayAsCheckbox"),1)[0]),t._addColumnFieldsTxt=[],i=0;i<t._addColumnFields.length;i++)switch(t._addColumnFields[i]){case"field":t._addColumnFieldsTxt.push(t._columnDialogTexts.field);break;case"headerText":t._addColumnFieldsTxt.push(t._columnDialogTexts.headerText);break;case"editType":t._addColumnFieldsTxt.push(t._columnDialogTexts.editType);break;case"filterEditType":t._addColumnFieldsTxt.push(t._columnDialogTexts.filterEditType);break;case"allowFiltering":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowFiltering);break;case"allowFilteringBlankContent":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowFilteringBlankContent);break;case"allowSorting":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowSorting);break;case"visible":t._addColumnFieldsTxt.push(t._columnDialogTexts.visible);break;case"width":t._addColumnFieldsTxt.push(t._columnDialogTexts.width);break;case"textAlign":t._addColumnFieldsTxt.push(t._columnDialogTexts.textAlign);break;case"headerTextAlign":t._addColumnFieldsTxt.push(t._columnDialogTexts.headerTextAlign);break;case"isFrozen":t._addColumnFieldsTxt.push(t._columnDialogTexts.isFrozen);break;case"allowFreezing":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowFreezing);break;case"allowCellSelection":t._addColumnFieldsTxt.push(t._columnDialogTexts.allowCellSelection);break;case"showInColumnChooser":t._addColumnFieldsTxt.push(t._columnDialogTexts.showInColumnChooser);break;case"clipMode":t._addColumnFieldsTxt.push(t._columnDialogTexts.clipMode);break;case"tooltip":t._addColumnFieldsTxt.push(t._columnDialogTexts.tooltip);break;case"headerTooltip":t._addColumnFieldsTxt.push(t._columnDialogTexts.headerTooltip);break;case"displayAsCheckbox":t._addColumnFieldsTxt.push(t._columnDialogTexts.displayAsCheckbox)}}else t._addColumnFields=["field","headerText","editType"],t._addColumnFieldsTxt=[t._columnDialogTexts.field,t._columnDialogTexts.headerText,t._columnDialogTexts.editType]},setColumnCelEditType:function(n){var i=this,u=i.model,f=u.columns,t;return n=="field"||n=="filterEditType"||n=="editType"||n=="textAlign"||n=="headerTextAlign"||n=="clipMode"?t=r.buildTag("input.e-field e-dropdownlist","",{},{value:"{{:#data['"+n+"']}}",id:i._id+n+"ColumnAdd",name:n,dialog:"ColumnAdd"}):n=="headerText"||n=="tooltip"||n=="headerTooltip"?t=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+n+"']}}",id:i._id+n+"ColumnAdd",name:n,dialog:"ColumnAdd"}):n=="allowFiltering"||n=="allowSorting"||n=="isFrozen"||n=="allowFreezing"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog ="ColumnAdd" name="'+n+'" edittype="booleanedit">':n=="allowFilteringBlankContent"||n=="visible"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog = "ColumnAdd" checked = "checked" name="'+n+'" edittype="booleanedit">':n=="allowCellSelection"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog = "ColumnAdd" checked = "checked" name="'+n+'" edittype="booleanedit">':n=="showInColumnChooser"||n=="displayAsCheckbox"?t=' <input type ="checkbox" id="'+i._id+n+'ColumnAdd" dialog = "ColumnAdd" checked = "checked" name="'+n+'" edittype="booleanedit">':n=="width"&&(t=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+n+"']}}",id:i._id+n+"ColumnAdd",name:n,dialog:"ColumnAdd"}),t.attr("edittype","numericedit")),t},columnAddDialogTemplate:function(){var t=this,f=t.model,s=f.columns,h=s.length,e,u,i,o;if(h!=0){for(t.setAddColumnFields(),u=r.buildTag("div","",{},{unselectable:"on"}),$form=r.buildTag("form","",{height:"100%",width:"100%","font-size":"14px"},{id:t._id+"ColumnAddForm"}),$table=r.buildTag("table","",{width:"100%"},{unselectable:"on"}),$tr=r.buildTag("tr","",{width:"100%"}),i=0;i<t._addColumnFields.length;i++)$tr.children("td").length<2?($td=r.buildTag("td.e-add-property-container","",{},{unselectable:"on"}),$innerTable=r.buildTag("table","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr=r.buildTag("tr"),$inTd=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append("<label style='font-weight:normal;'>"+t._addColumnFieldsTxt[i]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue"),e=t.setColumnCelEditType(t._addColumnFields[i]),$inTd2.html(e),$inTr2.append($inTd2),$innerTable.append($inTr2),t._addColumnFields[i]=="displayAsCheckbox"&&$innerTable.addClass("e-display-checkbox-conatiner").css("display","none"),$td.append($innerTable),$tr.append($td)):($table.append($tr),$tr=$tempTr=r.buildTag("tr"),i--);$table.append($tr);$tr2=r.buildTag("tr");f.showColumnChooser&&($td=r.buildTag("td.e-add-property-container","",{},{colspan:2,unselectable:"on"}),$innerTable=r.buildTag("table#"+t._id+"dropdownDataTable","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr3=r.buildTag("tr"),$inTd3=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd3.append("<label for='dropdownData' style='font-weight:normal;'>"+t._columnDialogTexts.columnsDropdownData+"<\/label>"),$inTr3.append($inTd3),$innerTable.append($inTr3),$inTr=r.buildTag("tr"),$inTd=r.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append("<span class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;'>"+t._columnDialogTexts.addData+"<\/span>      <span class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;'>  "+t._columnDialogTexts.deleteData+"<\/span>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue"),n("#"+t._id).width()<=t._responsiveMinWidth?(o=n("#"+t._id).width()-80+"px",$inTd3=r.buildTag("div.dropdowntreegrid","",{width:o,overflow:"hidden"})):$inTd3=r.buildTag("div.dropdowntreegrid","",{width:"438px",overflow:"hidden"}),$preDiv=r.buildTag("div#treegrid"+t._id+"dropdownData","",{width:"100%",height:"150px"},{}),$inTd3.append($preDiv),$inTd2.append($inTd3),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr2.append($td),$table.append($tr2));$form.append($table);u=t.renderColumnAddDialogButton($form,u);n.templates(t._id+"_ColumnAddTemplate",u.html())}},renderColumnAddDialogButton:function(n,t){var f="ColumnAddDialog_",i=this,e=i.model,o=r.buildTag("div.e-add-dialog-btn-ok","",{},{}),s=r.buildTag("div","",{},{}),h=r.buildTag("input","",{"border-radius":"3px"},{type:"button",id:f+i._id+"_Ok"}),v=i._okButtonText,u;h.ejButton({cssClass:e.cssClass,text:v,width:"100%"});var c=r.buildTag("div.e-add-dialog-btn-cancel","",{},{}),l=r.buildTag("div","",{},{}),y=i._cancelButtonText,a=r.buildTag("input","",{"border-radius":"3px"},{type:"button",id:f+i._id+"_Cancel"});return a.ejButton({cssClass:e.cssClass,text:y,width:"100%"}),u=r.buildTag("div","",{},{"class":"e-treegrid-add-btn"}),s.append(h),o.append(s),u.append(o),l.append(a),c.append(l),u.append(c),n.appendTo(t),u.appendTo(t),t},_buttonClick:function(t){var v,d,l,e,y,k;if(t.keyCode!=0&&t.keyCode!==u&&t.keyCode!=13)return!0;var f=this,o=f.model,p=o.treeColumnIndex,w=!1,h,i={},b=f._addColumnFields,nt=o.columns,c,s={},k,a;if(t.target.id=="ColumnAddDialog_"+f._id+"_Ok"){for(v=document.getElementById(f._id+"ColumnAddForm"),l=0;l<b.length;l++)if(e=b[l],h=n(v).find("#"+f._id+e+"ColumnAdd"),e=="editType"||e=="filterEditType"||e=="textAlign"||e=="headerTextAlign"||e=="clipMode"){if(d=h.data("ejDropDownList"),i[e]=d._selectedValue,e=="editType"&&i[e]=="dropdownedit"){var tt=n(v).find("#treegrid"+f._id+"dropdownData"),it=tt.data("ejTreeGrid"),g=it.model.dataSource;g.length>0&&(i.dropdownData=g)}}else e=="showInColumnChooser"||e=="allowCellSelection"||e=="allowSorting"||e=="allowFiltering"||e=="allowFilteringBlankContent"||e=="visible"||e=="isFrozen"||e=="allowFreezing"||e=="displayAsCheckbox"?(ch=h.data("ejCheckBox"),i[e]=ch._isChecked):h.val()==""&&(e=="headerText"||e=="field")?e=="field"?i[e]="Column"+(o.columns.length+1):e=="headerText"&&(i[e]="Column "+(o.columns.length+1)):i[e]=h.val();f._insertPosition=="left"?c=f._targetColumnIndex:f._insertPosition=="right"&&(c=f._targetColumnIndex+1);c<=p&&(o.treeColumnIndex=p+1);o.isFromGantt||c<=f._frozenColumnsLength-1&&(w=!0);y={};y=o.isFromGantt?{field:i.field,headerText:i.headerText,editType:i.editType,allowSorting:r.isNullOrUndefined(i.allowSorting)?null:i.allowSorting,visible:i.visible==!1?!1:!0,width:i.width?i.width:150,textAlign:i.textAlign?i.textAlign:"left",headerTextAlign:i.headerTextAlign?i.headerTextAlign:"left",dropdownData:i.dropdownData?i.dropdownData:null,allowCellSelection:r.isNullOrUndefined(i.allowCellSelection)?null:i.allowCellSelection,mappingName:i.field,displayAsCheckbox:i.displayAsCheckbox==!1?!1:!0,clipMode:i.clipMode?i.clipMode:"clip",tooltip:i.tooltip,headerTooltip:i.headerTooltip}:{field:i.field,headerText:i.headerText,editType:i.editType,filterEditType:i.filterEditType?i.filterEditType:"stringedit",allowFiltering:r.isNullOrUndefined(i.allowFiltering)?null:i.allowFiltering,allowFilteringBlankContent:r.isNullOrUndefined(i.allowFilteringBlankContent)?null:i.allowFilteringBlankContent,allowSorting:r.isNullOrUndefined(i.allowSorting)?null:i.allowSorting,visible:i.visible==!1?!1:!0,width:i.width?i.width:150,textAlign:i.textAlign?i.textAlign:"left",headerTextAlign:i.headerTextAlign?i.headerTextAlign:"left",clipMode:i.clipMode?i.clipMode:"clip",tooltip:i.tooltip,headerTooltip:i.headerTooltip,isFrozen:i.isFrozen==!0||w==!0?!0:!1,allowFreezing:r.isNullOrUndefined(i.allowFreezing)?null:i.allowFreezing,dropdownData:i.dropdownData?i.dropdownData:null,allowCellSelection:r.isNullOrUndefined(i.allowCellSelection)?null:i.allowCellSelection,showInColumnChooser:i.showInColumnChooser==!1?!1:!0,displayAsCheckbox:i.displayAsCheckbox==!1?!1:!0};s.requestType="insertColumn";s.columnObject=y;s.insertIndex=c;f._trigger("actionComplete",s)||(nt.splice(s.insertIndex,0,s.columnObject),f._refreshFrozenColumns(),o.isFromGantt&&f._updateAddEditDialogTemplate());n("#"+f._id+"_dialogColumnAdd").ejDialog("close");o.allowFiltering&&o.filterSettings.filterType=="menu"&&(a=s.columnObject.filterEditType?s.columnObject.filterEditType:s.columnObject.editType,k=f._renderedFilterMenuDialog.indexOf(a),k==-1&&f._renderFilterMenu(a));this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&(r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)||o.editSettings.dialogEditorTemplateID=="")?f._treeGridAddEditDialog():this.model.editSettings.allowEditing&&this.model.editSettings.editMode=="dialogEditing"&&!r.isNullOrUndefined(o.editSettings.dialogEditorTemplateID)&&o.editSettings.dialogEditorTemplateID!=""&&f._treeGridAddEditDialogTemplate()}else t.target.id=="ColumnAddDialog_"+f._id+"_Cancel"&&n("#"+f._id+"_dialogColumnAdd").ejDialog("close");if(this.model.editSettings.editMode=="dialogEditing")if(t.target.id=="EditFormDialog_"+this._id+"_Save"){if(!f.editFormValidate())return!0;this.element.find(".e-dialogaddrow .treegridform").length>0?(f.model.allowSelection&&f.model.selectionSettings.selectionType=="multiple"&&this._multiSelectPopup&&this._multiSelectPopup.is(":visible")&&f._clearMultiSelectPopup(),f._treegridDialogAddRow()||(f._isTreeAddEditDialogSave=!0,n("#"+this._id+"_dialogEdit").ejDialog("close"),this._off(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",f._buttonClick))):this.element.find(".e-dialogeditedrow .treegridform").length>0&&(f.endEdit()||(f._isTreeAddEditDialogSave=!0,n("#"+this._id+"_dialogEdit").ejDialog("close"),this._off(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",f._buttonClick)))}else t.target.id=="EditFormDialog_"+this._id+"_Cancel"&&(n("#"+this._id+"_dialogEdit").ejDialog("close"),this._off(n("#"+this._id+"_dialogEdit"),"click keypress","#EditFormDialog_"+this._id+"_Save ,#EditFormDialog_"+this._id+"_Cancel",f._buttonClick));return!1},_treegridDialogAddRow:function(){var n=this,u=n.model.columns,t={},f;for(i=0;i<u.length;i++)if(column=u[i],!r.isNullOrUndefined(column)&&column.field!=""&&column.visible){if(value=n.getCurrentEditCellDataForRowEdit(column.field,column.editType,i),n._checkboxSelection&&column.field=="checkboxState")continue;f=(column.field||"").split(".");f.length<=1?t[column.field]=value:t=n._restoreCustomData(t,value,column.field)}if(n._addRecord(t,n.model.editSettings.rowPosition,null,"dialog"))return!0},_refreshColumnAddForm:function(){var t=this,g=n("#"+t._id+"ColumnAddForm"),nt=g.find("input,select"),v=0,tt=!1,et=nt.length,u,o,f=t.model,e={},w,i,c,s,b=[],ot=t.model.rowHeight,h=t._editTypeText,d=t._textAlignTypeText,it=t._clipModeText,y,a,l,rt,ut,p,ft;for(v;v<et;v++){if(u=nt.eq(v),o="100%",i=u.prop("name"),u.hasClass("e-dropdownlist"))if(i=="field"){for(l=[],y=[],f.columns.length&&(b=n.map(f.columns,function(n){return f.isFromGantt?n.mappingName?n.mappingName:n.field:n.field})),t._dataSourcefields.length||(t._dataSourcefields=n.extend(!0,[],b),t.getAllDataSourceFields()),k=0;k<t._dataSourcefields.length;k++)n.inArray(t._dataSourcefields[k],b)==-1&&t._dataSourcefields[k]!=f.notesMapping&&y.push(t._dataSourcefields[k]);for(a=0;a<y.length;a++)l.push({id:a+1,text:y[a]});u.ejDropDownList({width:o,dataSource:l,fields:{id:"id",text:"text",value:"text"}})}else i=="editType"||i=="filterEditType"?(l=[{id:"1",text:h.string,value:"stringedit"},{id:"2",text:h.numeric,value:"numericedit"},{id:"3",text:h.datePicker,value:"datepicker"},{id:"4",text:h.dateTimePicker,value:"datetimepicker"},{id:"5",text:h.dropdown,value:"dropdownedit"},{id:"6",text:h.boolean,value:"booleanedit"}],u.ejDropDownList({width:o,dataSource:l,fields:{id:"id",text:"text",value:"value"},selectedIndex:0,change:function(i){var u=!1,r;s.hidden==!0&&i.value=="dropdownedit"?(s.hidden=!1,u=!0):s.hidden==!1&&i.value!="dropdownedit"&&(s.hidden=!0,u=!0);r=n("#"+t._id+"_dialogColumnAdd").find(".e-display-checkbox-conatiner");i.value=="booleanedit"&&r.length>0&&r.css("display")=="none"?(r.css("display","block"),u=!0):i.value!="booleanedit"&&r.length>0&&r.css("display")=="block"&&(r.css("display","none"),u=!0);u&&n("#"+t._id+"_dialogColumnAdd").ejDialog("refresh")}})):i=="textAlign"||i=="headerTextAlign"?(rt=[{id:"1",text:d.left,value:"left"},{id:"2",text:d.right,value:"right"},{id:"3",text:d.center,value:"center"}],u.ejDropDownList({width:o,dataSource:rt,fields:{id:"id",text:"text",value:"value"},selectedIndex:0})):i=="clipMode"&&(ut=[{id:"1",text:it.clip,value:"clip"},{id:"2",text:it.ellipsis,value:"ellipsis"}],u.ejDropDownList({width:o,dataSource:ut,fields:{id:"id",text:"text",value:"value"},selectedIndex:0}));else u.hasClass("e-numerictextbox")&&i=="width"?(w=u.val(),e.width=o,e.showSpinButton=!0,e.cssClass=f.cssClass,e.maxValue=250,e.minValue=30,e.value=w.length?parseFloat(w):150,u.ejNumericTextbox(e)):(i=="showInColumnChooser"||i=="allowCellSelection"||i=="allowFiltering"||i=="allowFilteringBlankContent"||i=="allowSorting"||i=="visible"||i=="isFrozen"||i=="allowFreezing"||i=="displayAsCheckbox")&&(p={},p.cssClass=f.cssClass,p.size="small",u.ejCheckBox(p));u.is(":disabled")||tt||u.is(":hidden")&&typeof u.data("ejDropDownList")!="object"||t._isEnterKeyPressed||(t._focusElements(u.closest("td")),tt=!0)}c="#treegrid"+t._id+"dropdownData";n(c).length&&(ft=[],n(c).ejTreeGrid({dataSource:ft,allowSorting:!1,allowAdding:!0,columns:[{headerText:t._columnDialogTexts.dropdownTableText,field:"text",editType:r.TreeGrid.EditingType.String,width:"150px"},{headerText:t._columnDialogTexts.dropdownTableValue,field:"value",editType:r.TreeGrid.EditingType.String,width:"150px"}],enableAltRow:!0,allowColumnResize:!0,enableResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing"},locale:f.locale,treeColumnIndex:5,emptyRecordText:"Add values for dropdown",rowSelected:function(i){i.data&&(n(".e-deletepre").addClass("e-enable").removeClass("e-disable"),n(".e-deletepre").bind("click",n.proxy(t._deleteDropDownRow,t,n(c))))}}),s=g.find("#"+t._id+"dropdownDataTable").parent()[0],s.hidden=!0,n(".e-addpre").bind("click",n.proxy(t._addDropDownRow,t,n(c))))},_addDropDownRow:function(n){var f=this,t=n.data("ejTreeGrid"),r=t.model.dataSource,i=r.length,u={text:"Text "+(i+1),value:"Value"+(i+1)};t.addRow(u,"bottom")},_deleteDropDownRow:function(t){var r=this,i=t.data("ejTreeGrid"),u=i.model.updatedRecords,f=u.length,e=i.model.selectedItem;f!=0&&e&&(i.deleteRow(),n(".e-deletepre").addClass("e-disable").removeClass("e-enable"),n(".e-deletepre").unbind("click",n.proxy(r._deleteDropDownRow,r,t)))},getAllDataSourceFields:function(){for(var u,t,i=this,r=i.model,e=r.dataSource,f=0;f<e.length;f++){u=e[f];for(t in u)t==r.childMapping?i.getChildKeys(u[t]):n.inArray(t,i._dataSourcefields)==-1&&(r.isFromGantt?t!="undefined"&&t!=r.notesMapping&&i._dataSourcefields.push(t):typeof u[t]!="object"&&i._dataSourcefields.push(t))}},getChildKeys:function(t){var r=this,e=r.model,u,f,i;if(t)for(u=0;u<t.length;u++){f=t[u];for(i in f)i==e.childMapping?r.getChildKeys(f[i]):n.inArray(i,r._dataSourcefields)==-1&&typeof f[i]!="object"&&r._dataSourcefields.push(i)}},_renderUpdateConfirmDialog:function(){var t=this,f=t._confirmDeleteText,e=r.buildTag("div.e-content",t._deleteColumnText),i=r.buildTag("span.e-buttons","<input class='e-confirm-dialog-btn-ok' type='button' id="+t._id+"ConfirmDialogOK value="+t._okButtonText+" /> <input class='e-confirm-dialog-btn-cancel' type='button' id="+t._id+"ConfirmDialogCancel value='"+t._cancelButtonText+"' />"),u=r.buildTag("div","",{},{"class":"e-confirm-dialog-btn"});u.append(i);t._updateConfirmDialog=r.buildTag("div","","",{title:f,id:t._id+"ConfirmDialog"});t._updateConfirmDialog.append(e).append(u);t.element.append(t._updateConfirmDialog);i.find("input").ejButton({cssClass:t.model.cssClass,showRoundedCorner:!0,size:"normal",click:n.proxy(t._triggerUpdateConfirm,t)});t._updateConfirmDialog.ejDialog({width:"auto",minHeight:0,minWidth:0,showOnInit:!1,isResponsive:!0,enableResize:!1,enableModal:!0});n("#"+t._id+"ConfirmDialog_wrapper").addClass("e-treegrid-dialog")},_triggerUpdateConfirm:function(n){var t=this;n!==u&&n.model.text==t._okButtonText&&t._updateConfirmDialog.find(".e-content").text()==t._deleteColumnText&&t.deleteColumn(t._targetColumnIndex);t._updateConfirmDialog.ejDialog("close")},deleteColumn:function(t){var r=this,i=r.model,o=i.columns,s,u=i.sortSettings&&i.sortSettings.sortedColumns.length?i.sortSettings.sortedColumns:null,h=o[t],f={},e;f.requestType="deleteColumn";f.columnObject=h;f.deleteIndex=t;r._trigger("actionComplete",f)||(s=o.splice(t,1),u&&(e=n.grep(u,function(n){return n.field==s[0].field}),e.length&&u.splice(u.indexOf(e[0]),1)),r._targetColumnIndex<=i.treeColumnIndex&&(i.treeColumnIndex=i.treeColumnIndex-1),r._refreshFrozenColumns(),i.isFromGantt&&r._updateAddEditDialogTemplate())},getOffsetRect:function(n){var r=n.getBoundingClientRect(),t=document.body,i=document.documentElement,u=window.pageYOffset||i.scrollTop||t.scrollTop,f=window.pageXOffset||i.scrollLeft||t.scrollLeft,e=i.clientTop||t.clientTop||0,o=i.clientLeft||t.clientLeft||0,s=r.top+u-e,h=r.left+f-o;return{top:Math.round(s),left:Math.round(h)}},_moveToNextMenuItem:function(t){var i,u,o,s=this.model,r={},h,e,f;s.isFromGantt?(i=n("#"+this._id.replace("ejTreeGrid","")).data("ejGantt"),o=n("#"+this._id.replace("ejTreeGrid","")+"_ContextMenu")):(i=this,o=n("#"+this._id+"_ContextMenu"));u=n("#"+i._activeMenuItemId);switch(t){case"next":u.length==0?r=o.find("div.e-menuitem:not(.e-disable)").first():(r=u.closest("li").next("li").find("div.e-menuitem"),r.length>0&&r.hasClass("e-disable")&&(r=this._findContextMenuItem(r,"next")));e=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId);e.remove();break;case"prev":r=this._findContextMenuItem(u,"prev");e=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId);e.remove();break;case"expand":u.length>0&&(i._showSubContextMenu(u[0],i._contextMenuItems),f=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),f.length>0&&(r=f.find("div.e-menuitem:not(.e-disable)").first()));break;case"collapse":f=n(u).closest(".e-innerContextmenu");f.length>0&&(h=f.attr("id").replace(i._id+"_SubContextMenu",""),r=n("#"+h),e=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),e.remove(),f.remove());break;case"save":u.length>0&&(n("#"+i._activeMenuItemId).find(".e-expander").length==0?(s.isFromGantt?i._contextMenuClickHandler(n("#"+i._activeMenuItemId)):i.contextMenuOperations(i._activeMenuItemId),i._clearContextMenu()):(i._showSubContextMenu(u[0],i._contextMenuItems),f=n("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),f.length>0&&(r=f.find("div.e-menuitem:not(.e-disable)").first())))}r.length>0&&((t=="next"||t=="prev")&&u.removeClass("e-contextmenu-mouseover"),r.addClass("e-contextmenu-mouseover"),i._activeMenuItemId=n(r).attr("id"))},_findNextColumnMenuItem:function(n,t){var i=this;return t==="next"?(nextItem=n.closest("li").next("li").find("div.e-columnmenuitem"),nextItem.length>0?nextItem.hasClass("e-disable")?i._findNextColumnMenuItem(nextItem,"next"):nextItem:nextItem):(prevItem=n.closest("li").prev("li").find("div.e-columnmenuitem"),prevItem.length>0?prevItem.hasClass("e-disable")?i._findNextColumnMenuItem(prevItem,"prev"):prevItem:prevItem)},_getFieldValue:function(n,t){return n!=""?n.split(".").join(""):"TGcolumn"+t},_findContextMenuItem:function(n,t){var i=this;return t==="next"?(nextItem=n.closest("li").next("li").find("div.e-menuitem"),nextItem.length>0?nextItem.hasClass("e-disable")?i._findContextMenuItem(nextItem,"next"):nextItem:nextItem):(prevItem=n.closest("li").prev("li").find("div.e-menuitem"),prevItem.length>0?prevItem.hasClass("e-disable")?i._findContextMenuItem(prevItem,"prev"):prevItem:prevItem)}});r.TreeGrid.Actions={Sorting:"sorting",BeginEdit:"beginedit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Refresh:"refresh",Searching:"searching",ExpandCollapse:"expandcollapse",Selection:"selection",rowHover:"rowHover",Scroll:"scroll",ContextMenuAdd:"contextMenuAdd",RefreshDataSource:"refreshDataSource",DragAndDrop:"dragAndDrop",Paging:"paging"};r.TreeGrid.SelectionType={Single:"single",Multiple:"multiple",Checkbox:"checkbox"};r.TreeGrid.FilterType={FilterBar:"filterbar",Menu:"menu"};r.TreeGrid.EditMode={CellEditing:"cellEditing",RowEditing:"rowEditing",DialogEditing:"dialogEditing"};r.TreeGrid.ClipMode={Clip:"clip",Ellipsis:"ellipsis"};r.TreeGrid.PageSizeMode={All:"all",Root:"root"};r.TreeGrid.RowPosition={Top:"top",Bottom:"bottom",Above:"aboveSelectedRow",Below:"belowSelectedRow",Child:"child"};r.TreeGrid.BeginEditAction={DblClick:"dblClick",Click:"click"};r.TreeGrid.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedit"};r.TreeGrid.ContextMenuItems={Add:"add",Edit:"edit",Delete:"delete"};r.TreeGrid.ColumnResizeMode={Normal:"normal",FixedColumns:"fixedcolumns",NextColumn:"nextcolumn"};r.TreeGrid=r.TreeGrid||{};r.TreeGrid._initCellEditType=function(t,i,u,f,e){var s=t,p=s.model,o=p.columns,h=o[f],e=e?e:"",g=(o[f].field||"").split("."),c,v,l,b,y,k,a,d,w;o[f].editTemplate?o[f].editType="edittemplate":r.isNullOrUndefined(o[f].editType)&&(h.editType="stringedit");c=s.model.editSettings.editMode=="dialogEditing"?o[f].field:s._getFieldValue(o[f].field,f);switch(h.editType){case"stringedit":p.isFromGantt?(v={},h.field==="predecessor"&&(v["_"+u+"predecessorCell"]=n.proxy(r.Gantt._getPredecessorsValue,s)),n.views.helpers(v),h.field==="predecessor"?l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+u+"predecessorCell(#data)}}",id:u+h.field+e,name:h.field,dialog:e}):h.field==="duration"?(v={},v["_"+u+"getDurationStringValue"]=n.proxy(r.Gantt._getDurationStringValue,s),n.views.helpers(v),l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+u+"getDurationStringValue(#data)}}",id:u+h.field+e,name:h.field,dialog:e})):l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+p.columns[f].field+e,name:p.columns[f].field,dialog:e})):l=r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(h.field,f)+e,name:h.field,dialog:e});l.attr("edittype",o[f].editType);i.html(l);break;case"maskedit":l=r.buildTag("input.e-field e-maskedit","",{},{value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(h.field,f)+e,name:h.field,dialog:e});l.attr("edittype",o[f].editType);i.html(l);break;case"booleanedit":i.html("{{if true===~_"+s._id+'cellValue(#data,"'+c+'")}}<input type ="checkbox" id="'+u+s._getFieldValue(o[f].field,f)+e+'" dialog ="'+e+'" name="'+o[f].field+'" checked="checked" edittype="'+o[f].editType+'"><\/input> {{else}}<input type ="checkbox" id="'+u+s._getFieldValue(o[f].field,f)+e+'" dialog ="'+e+'" name="'+o[f].field+'" edittype="'+o[f].editType+'">{{/if}}');break;case"numericedit":b=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});b.attr("edittype",o[f].editType);i.append(b);break;case"datepicker":y=r.buildTag("input.e-datepicker e-field","",{},{type:"text",value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});y.attr("edittype",o[f].editType);i.append(y);break;case"datetimepicker":y=r.buildTag("input.e-datetimepicker e-field","",{},{type:"text",value:"{{:~_"+s._id+"cellValue(#data,'"+c+"')}}",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});y.attr("edittype",o[f].editType);i.append(y);break;case"dropdownedit":k=r.buildTag("input.e-field e-dropdownlist","",{},{type:"text",id:u+s._getFieldValue(o[f].field,f)+e,name:o[f].field,dialog:e});k.attr("edittype",o[f].editType).attr("cellValue","{{:~_"+s._id+"cellValue(#data,'"+c+"')}}");i.append(k);break;case"edittemplate":a=o[f].editTemplate.create;typeof a=="string"?(d=r.util.getObject(a,window),w=n.isFunction(d)?n(d()).attr({id:u+s._getFieldValue(h.field,f),name:h.field}):n(a).length==1&&n(a).get(0).tagName=="SCRIPT"?n(n(a).html()).attr({id:u+s._getFieldValue(h.field,f),name:h.field}):n(a).attr({id:u+s._getFieldValue(h.field,f),name:h.field})):w=n(a()).attr({id:u+s._getFieldValue(h.field,f),name:h.field});w.attr("edittype",o[f].editType);i.append(w)}};r.TreeGrid.ToolbarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",ExpandAll:"expandAll",CollapseAll:"collapseAll",PdfExport:"pdfExport",ExcelExport:"excelExport"};r.TreeGrid.SummaryType={Sum:"sum",Average:"average",Maximum:"maximum",Minimum:"minimum",Count:"count",MinimumDate:"minimumDate",MaximumDate:"maximumDate",TrueCount:"trueCount",FalseCount:"falseCount"};r.TreeGrid.SelectionMode={Row:"row",Cell:"cell"};r.TreeGrid.Locale=r.TreeGrid.Locale||{};r.TreeGrid.Locale["default"]=r.TreeGrid.Locale["en-US"]={toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",updateTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",expandAllTool:"Expand All",collapseAllTool:"Collapse All",pdfExportTool:"PDF Export",excelExportTool:"Excel Export"},contextMenuTexts:{addRowText:"Add Row",editText:"Edit",deleteText:"Delete",saveText:"Save",cancelText:"Cancel",aboveText:"Above",belowText:"Below"},filterMenuTexts:{stringMenuOptions:[{text:"Starts With",value:"startswith"},{text:"Ends With",value:"endswith"},{text:"Contains",value:"contains"},{text:"Equals",value:"equal"},{text:"Does Not Equal",value:"notequal"}],numberMenuOptions:[{text:"Less Than",value:"lessthan"},{text:"Greater Than",value:"greaterthan"},{text:"Less Than Or Equal To",value:"lessthanorequal"},{text:"Greater Than Or Equal To",value:"greaterthanorequal"},{text:"Equals",value:"equal"},{text:"Does Not Equal",value:"notequal"}],filterValue:"Filter Value",filterButton:"Filter",clearButton:"Clear",enterValueText:"enter value"},columnMenuTexts:{sortAscendingText:"Sort Ascending",sortDescendingText:"Sort Descending",columnsText:"Columns",freezeText:"Freeze",unfreezeText:"Unfreeze",freezePrecedingColumnsText:"Freeze Preceding Columns",insertColumnLeft:"Insert Column Left",insertColumnRight:"Insert Column Right",deleteColumn:"Delete Column",renameColumn:"Rename Column",menuFilter:"Filter"},columnDialogTexts:{field:"Field",headerText:"Header Text",editType:"Edit Type",filterEditType:"Filter Edit Type",allowFiltering:"Allow Filtering",allowFilteringBlankContent:"Allow Filtering Blank Content",allowSorting:"Allow Sorting",visible:"Visible",width:"Width",textAlign:"Text Alignment",headerTextAlign:"Header Text Alignment",isFrozen:"Is Frozen",allowFreezing:"Allow Freezing",columnsDropdownData:"Column Dropdown Data",dropdownTableText:"Text",dropdownTableValue:"Value",addData:"Add",deleteData:"Remove",allowCellSelection:"Allow Cell Selection",showInColumnChooser:"Show In Column Chooser",clipMode:"Clip Mode",tooltip:"Tooltip",headerTooltip:"Header Tooltip",displayAsCheckbox:"Display As Checkbox"},columnDialogTitle:{insertColumn:"Insert Column",deleteColumn:"Delete Column",renameColumn:"Rename Column"},editTypeTexts:{string:"String",numeric:"Numeric",datePicker:"Date Picker",dateTimePicker:"Date Time Picker",dropdown:"Dropdown",boolean:"Boolean"},textAlignTypes:{right:"Right",left:"Left",center:"Center"},clipModeTexts:{clip:"Clip",ellipsis:"Ellipsis"},deleteColumnText:"Are you sure you want to delete this column?",okButtonText:"OK",cancelButtonText:"Cancel",confirmDeleteText:"Confirm Delete",dropDownListBlanksText:"(Blanks)",dropDownListClearText:"(Clear Filter)",trueText:"True",falseText:"False",emptyRecord:"No records to display"};r.TreeGrid._getrowClassName=function(){var n="gridrowIndex",t=this;return t.data.parentItem&&(n+=t.data.parentItem.index.toString()),n+="level",n+=t.data.level.toString(),t.data.isSummaryRow&&(n+=" ",n+="e-summaryrow"),t.data.footerSummaryRowRecord&&(n+=" ",n+="e-footersummaryrow"),n};r.TreeGrid._getSummaryRowtdClassName=function(){proxy=this;var n="";return proxy.data.isSummaryRow&&(n+=" ",n+="e-summaryrowcell"),proxy.data.footerSummaryRowRecord&&(n+=" ",n+="e-footersummaryrowcell"),n};r.TreeGrid.getColumnByField=function(n,t){var i=0;for(i;i<n.length;i++)if(n[i].field.split(".").join("")==t.split(".").join(""))break;return i==n.length?null:n[i]};r.TreeGrid.getColumnByMappingName=function(n,t){var i=0;for(i;i<n.length;i++)if(n[i].mappingName==t)break;return i==n.length?null:n[i]};r.TreeGrid.sendExpandCollapseRequest=function(t,i){var u=t,f=u.model,k=f.toolbarSettings.toolbarItems,a,l,s,h,y;if(i.requestType=r.TreeGrid.Actions.ExpandCollapse,u._isRowEdit?u.cancelRowEditCell():u.model.isEdit&&u.cancelEditCell(),f.enableVirtualization)u._isFromGantt?u._$treegridHelper.ejTreeGrid("processBindings",i):u.processBindings(i),u._isFromGantt?u._isInExpandCollapseAll===!1&&(f.enableAltRow&&u._$treegridHelper.ejTreeGrid("updateAltRow"),u._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i),u._$treegridHelper.ejTreeGrid("updateHeight"),u.model.updatedGanttRecords=u.getUpdatedRecords(),u.model.currentViewData=u.getCurrentViewData(),u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._$ganttchartHelper.ejGanttChart("refreshHelper",u.model.currentViewData,u.model.updatedGanttRecords)):u._isInExpandCollapseAll===!1&&(f.enableAltRow&&u.updateAltRow(),u.sendDataRenderingRequest(i),u._setScrollTop(),u.updateHeight());else{var e=i.data,c,o,v=0,d=e.expanded!==i.expanded;c=u.model.currentViewData.indexOf(e);u._frozenColumnsLength&&u.getRows()?o=n(u.getRows()[0][c]).add(u.getRows()[1][c]):u.getRows()&&(o=u.getRows()&&n(u.getRows()[c]));i.expanded?(e.expanded=i.expanded,o&&r.TreeGrid.expandRecord(u,e,i.expanded,i),e.hasFilteredChildRecords&&(o&&o.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),o&&o.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")),f.enableAltRow&&u._isInExpandCollapseAll===!1&&!f.allowPaging&&r.TreeGrid.updateAltRow(u,e,c,1)):(u._collapsedRecordCount=0,o&&r.TreeGrid.collapseRecord(u,e,i.expanded),e.expanded=i.expanded,e.hasFilteredChildRecords&&(o&&o.find(".e-treegridexpand").removeClass("e-treegridexpand").addClass("e-treegridcollapse"),o&&o.removeClass("e-treegridrowexpand").addClass("e-treegridrowcollapse")),f.enableAltRow&&u._isInExpandCollapseAll===!1&&u._collapsedRecordCount!=0&&!f.allowPaging&&r.TreeGrid.updateAltRow(u,e,c,u._collapsedRecordCount));l=0;u._isFromGantt?(u._$treegridHelper.ejTreeGrid("updateExpandStatus",e,i.expanded),u._$treegridHelper.ejTreeGrid("updateCollapsedRecordCount"),l=u._$treegridHelper.ejTreeGrid("getCollapsedRecordCount")):(u.updateExpandStatus(e,i.expanded),u.updateCollapsedRecordCount(),l=u.getCollapsedRecordCount());v=(u.model.updatedRecords.length-l)*f.rowHeight;f.allowPaging&&(i.type=="ejTreeGridcollapsing"||i.type=="ejTreeGridexpanding")&&(r.isNullOrUndefined(u.getPager())||u.gotoPage(),f.enableAltRow&&u._isInExpandCollapseAll===!1&&r.TreeGrid.updateAltRow(u,e,c,1));u._isFromGantt?u._isInExpandCollapseAll===!1&&(u._totalCollapseRecordCount=l,u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._$treegridHelper.ejTreeGrid("updateHeight"),u._$ganttchartHelper.ejGanttChart("updateHeight",v),u._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",l),u._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",u.model.updatedRecords.length-l)):u._isInExpandCollapseAll===!1&&u.updateHeight()}if(u._isFromGantt&&u.model.predecessorMapping&&u._isInExpandCollapseAll===!1&&(u._isValidationEnabled=!1,u._connectorlineIds=[],u._connectorLinesCollection=[],u._createConnectorLinesCollection(),t.isCriticalPathEnable==!0&&u._$ganttchartHelper.ejGanttChart("criticalConnectorLine",t.criticalPathCollection,t.detailPredecessorCollection,!0,t.collectionTaskId)),u._isFromGantt){var p=u._$treegridHelper.ejTreeGrid("instance"),w=u._$ganttchart.ejGanttChart("instance"),b=p._$gridContent.ejScroller("option","scrollTop");w._$bodyContainer.ejScroller("option","scrollTop",b)}s={};s.recordIndex=i.recordIndex;s.data=i.data;s.requestType=i.requestType;s.expanded=i.expanded;r.isNullOrUndefined(s.data.item[f.expandStateMapping])||(s.data[f.expandStateMapping]=i.expanded,s.data.item[f.expandStateMapping]=i.expanded);i.expanded?u._trigger("expanded",s):u._trigger("collapsed",s);h=u.selectedItem();!u._isFromGantt&&h&&(f.selectedItems.length==1||u._checkboxSelection)&&(y=u.getExpandStatus(h),y||i.expanded||(u.selectRows(-1),u.selectedRowIndex(-1),h.isSelected=!1,f.selectedItem=null,h=null),a=f.allowPaging?u._updatedPageData:u.model.updatedRecords,f.enableVirtualization&&h&&a.indexOf(h)!==u.selectedRowIndex()&&u.selectRows(a.indexOf(h)),u._cancelSaveTools())};r.TreeGrid.expandRecord=function(t,i,u){var f=t,a=".gridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),p=".detailsrowgridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),v=n(f.element).find(a),o=0,h=v.length,c,s,w=f.model,b=n(f.element).find(p),l=n(f.element).find(a),e,k=f.getRows(),y=n(k[e]);for(e=w.currentViewData.indexOf(i),i.hasChildRecords&&i.childRecords.length>0&&(y.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),y.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")),f._expandedRecordsCount+=f._isFromGantt||f._frozenColumnsLength>0?l.length/2:l.length,l.css({display:"table-row"}),b.filter("tr.e-detailsrowexpanded").css("display","table-row"),(f._isFromGantt||f._frozenColumnsLength>0)&&(h=h/2),o;o<h;o++)c=v[o],e=-1,e=f._frozenColumnsLength>0?n(f.getRows()[0]).index(c):f.getRows().index(c),e!==-1&&(s=f._isFromGantt?f.model.updatedRecords[e]:f.model.updatedRecords[e],s.isExpanded=!0,s.expanded&&r.TreeGrid.expandRecord(f,s,u))};r.TreeGrid.collapseRecord=function(t,i,u){var f=t,w=f.model,a=".gridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),y=".detailsrowgridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),v=n(f.element).find(a),e=0,s=v.length,h,o,c,p=n(f.element).find(y),l=n(f.element).find(a),b=f.getRows();for(f._collapsedRecordCount+=f._isFromGantt||f._frozenColumnsLength>0?l.length/2:l.length,l.css({display:"none"}),p.css({display:"none"}),(f._isFromGantt||f._frozenColumnsLength>0)&&(s=s/2),e;e<s;e++)h=v[e],o=-1,o=f._frozenColumnsLength>0?n(f.getRows()[0]).index(h):f.getRows().index(h),o!==-1&&(c=f.getUpdatedRecords()[o],c.expanded&&r.TreeGrid.collapseRecord(f,c,u))};r.TreeGrid.updateAltRow=function(t,i,r,u){var e=t,f=0,s=e.model,v=s.currentViewData,y=v.length,h=i.isAltRow,c,l,a=e.getRows(),o;if(l=e._frozenColumnsLength?e.getRows()[0]:e.getRows(),!s.rowTemplateID&&!s.altRowTemplateID)for(f=r+u;f<y;f++)n(l[f]).hasClass("e-summaryrow")||n(l[f]).css("display")!=="none"&&(c=v[f],f!=0&&(c.isAltRow=!h),h=c.isAltRow,o={},o=e._frozenColumnsLength?n(a[0][f]).add(a[1][f]):n(a[f]),h?n(o).addClass("e-alt-row"):n(o).removeClass("e-alt-row"))};r.TreeGrid.refreshRow=function(t,i){var u=t,e=u.model,f=u.model.currentViewData[i],o,h,s,c;f&&(u._frozenColumnsLength>0?(h=n(u.getRows()[0][i]),o=n(u.getRows()[1][i]),e.showDetailsRow&&e.detailsTemplate&&f.isDetailsExpanded&&(s=h.next("tr"),s.hasClass("e-detailsrow")&&(s.remove(),o.next("tr").remove())),h.replaceWith(n(n.render[u._id+"_JSONFrozenTemplate"](f))),o.replaceWith(n(n.render[u._id+"_Template"](f)))):(o=n(u.getRows()[i]),e.showDetailsRow&&e.detailsTemplate&&f.isDetailsExpanded&&(s=o.next("tr"),s.hasClass("e-detailsrow")&&s.remove()),e.allowSelection||(f.isSelected=!1),o.replaceWith(n(n.render[u._id+"_Template"](f)))),u.setGridRows(n(u.getContentTable().get(0).rows)),u._gridRows=u.getContentTable().get(0).rows,u._frozenColumnsLength>0&&(u._gridRows=[u._gridRows,u.getContentTable().get(1).rows]),c=r.TreeGrid.getRowByIndex(u,u.getUpdatedRecords().indexOf(e.currentViewData[i])),u._trigger("refresh"),u._rowEventTrigger(c,f))};r.TreeGrid.getRowByIndex=function(t,i,u){var f,e,h,o,s;try{return f=t.pluginName=="ejTreeGrid"?t:t._$treegridHelper.data("ejTreeGrid"),e=f.getRows(),h=f.model,updatedRecords=f.getUpdatedRecords(),$row=n(),f.model.enableVirtualization&&(o=updatedRecords[i],i=f.model.currentViewData.indexOf(o)),r.isNullOrUndefined(u)?f._frozenColumnsLength>0?(e[0][i]&&($row.push(e[0][i]),$row.push(e[1][i])),$row):n(e[i]):(f.model.enableVirtualization&&(s=updatedRecords[u],u=f.model.currentViewData.indexOf(s)),f._frozenColumnsLength>0)?($row.push(n(e[0]).slice(i,u)),$row.push(n(e[1]).slice(i,u)),$row):n(e.slice(i,u))}catch(c){return n()}}}(jQuery,Syncfusion),function(n,t,r){t.widget("ejRibbon","ej.Ribbon",{element:null,validTags:["div"],model:null,_rootCSS:"e-ribbon",_requiresID:!0,defaults:{width:null,buttonDefaults:{width:null,height:null,enableRTL:!1,showRoundedCorner:!1,enabled:!0,cssClass:null},expandPinSettings:{toolTip:null,customToolTip:{title:null,content:null,prefixIcon:null}},collapsePinSettings:{toolTip:null,customToolTip:{title:null,content:null,prefixIcon:null}},applicationTab:{type:"menu",backstageSettings:{text:null,height:null,width:null,headerWidth:null,pages:[{id:null,text:null,itemType:"tab",contentID:null,enableSeparator:!1}]},menuItemID:null,menuSettings:{}},tabs:[{id:null,text:null,groups:[{id:null,text:null,type:null,contentID:null,customContent:null,alignType:"rows",enableGroupExpander:!1,groupExpanderSettings:{toolTip:null,customToolTip:{title:null,content:null,prefixIcon:null}},content:[{groups:[{id:null,text:null,toolTip:null,quickAccessMode:"none",isMobileOnly:"false",customToolTip:{title:null,content:null,prefixIcon:null},columns:null,itemHeight:null,itemWidth:null,expandedColumns:null,type:"button",galleryItems:[{text:null,toolTip:null,customToolTip:{},buttonSettings:{}}],customGalleryItems:[{text:null,toolTip:null,customToolTip:{},customItemType:"button",buttonSettings:{},menuId:"",menuSettings:{}}],contentID:null,enableSeparator:!1,isBig:!1,cssClass:null,buttonSettings:{},splitButtonSettings:{},toggleButtonSettings:{},dropdownSettings:{}}],defaults:{}}]}]}],contextualTabs:[{backgroundColor:null,borderColor:null,tabs:[]}],tabSelect:null,tabClick:null,tabAdd:null,tabRemove:null,load:null,beforeTabRemove:null,tabCreate:null,create:null,groupClick:null,beforeTabClick:null,galleryItemClick:null,backstageItemClick:null,collapse:null,expand:null,pinState:null,toggleButtonClick:null,groupExpand:null,qatMenuItemClick:null,selectedItemIndex:1,enabledItemIndex:[],disabledItemIndex:[0],allowResizing:!1,isResponsive:!1,showQAT:!1,showBelowQAT:!1,enableOnDemand:!1,collapsible:!1,locale:"en-US",enableRTL:!1,destory:null,_destroyed:null},dataTypes:{tabs:"array",contextualTabs:"array",disabledItemIndex:"data",enabledItemIndex:"data",selectedItemIndex:"number",applicationTab:{backstageSettings:{pages:"array"}}},_destroy:function(){var i,r,u,f,e,o,s,t;for(f=this._applicationTab.find(".e-menu"),f.length>0&&f.data("ejMenu").destroy(),this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").hide(),i=this.element.find(".e-gallerymenu"),e=i.length,t=0;t<e;t++)i.eq(t).data("ejMenu").destroy(),i.eq(t).remove();for(this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").appendTo(this.element.parent()),r=n(".e-rbn-ddl.e-ddl").find(".e-dropdownlist"),o=r.length,t=0;t<o;t++)r.eq(t).data("ejDropDownList").destroy(),r.siblings("ul").appendTo(this.element.parent());for(u=n(".e-rbn-splitbtn.e-splitbutton"),s=u.length,t=0;t<s;t++)u.eq(t).data("ejSplitButton").destroy(),u.siblings("ul").appendTo(this.element.parent());this.element.children().remove();this.element.hasClass("e-ribwithout-apptab")&&this.element.removeClass("e-ribwithout-apptab");this.model.enableOnDemand&&this.element.ejWaitingPopup("destroy");this._trigger("_destroyed")},_tags:[{tag:"applicationTab.backstageSettings.pages",attr:["id","text","itemType","contentID","enableSeparator"]},{tag:"tabs",attr:["id","text",[{tag:"groups",attr:["id","text","alignType","type","contentID","enableGroupExpander",[{tag:"content",attr:["defaults.type","defaults.width","defaults.height","defaults.isBig",[{tag:"groups",attr:["id","columns","itemHeight","itemWidth","expandedColumns","contentID","text","type","toolTip","isMobileOnly","quickAccessMode","width","enableSeparator","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","splitButtonSettings.contentType","splitButtonSettings.prefixIcon","splitButtonSettings.targetID","splitButtonSettings.buttonMode","splitButtonSettings.arrowPosition","splitButtonSettings.type","splitButtonSettings.click","splitButtonSettings.enabled","splitButtonSettings.showRoundedCorner","splitButtonSettings.enableRTL","splitButtonSettings.size","splitButtonSettings.height","splitButtonSettings.imagePosition","splitButtonSettings.width","splitButtonSettings.text","splitButtonSettings.suffixIcon","splitButtonSettings.create","splitButtonSettings.itemMouseOver","splitButtonSettings.itemSelected","splitButtonSettings.beforeOpen","splitButtonSettings.destroy","splitButtonSettings.cssClass","dropdownSettings.dataSource","dropdownSettings.text","dropdownSettings.value","dropdownSettings.select","dropdownSettings.width","dropdownSettings.showRoundedCorner","dropdownSettings.showPopupOnLoad","dropdownSettings.allowMultiSelection","dropdownSettings.enableRTL","dropdownSettings.enabled","dropdownSettings.caseSensitiveSearch","dropdownSettings.showCheckbox","dropdownSettings.checkAll","dropdownSettings.uncheckAll","dropdownSettings.enablePersistence","dropdownSettings.enableIncrementalSearch","dropdownSettings.readOnly","dropdownSettings.allowGrouping","dropdownSettings.fields","dropdownSettings.selectedItems","dropdownSettings.itemsCount","dropdownSettings.height","dropdownSettings.cssClass","dropdownSettings.itemValue","dropdownSettings.popupHeight","dropdownSettings.targetID","dropdownSettings.waterMarkText","dropdownSettings.template","dropdownSettings.cascadeTo","dropdownSettings.query","dropdownSettings.create","dropdownSettings.popupHide","dropdownSettings.popupShown","dropdownSettings.beforePopupShown","dropdownSettings.change","dropdownSettings.checkChange","dropdownSettings.enableAnimation","dropdownSettings.destroy","toggleButtonSettings.contentType","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.type","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.click","toggleButtonSettings.enabled","toggleButtonSettings.showRoundedCorner","toggleButtonSettings.enableRTL","toggleButtonSettings.enablePersistence","toggleButtonSettings.toggleState","toggleButtonSettings.preventToggle","toggleButtonSettings.size","toggleButtonSettings.imagePosition","toggleButtonSettings.height","toggleButtonSettings.width","toggleButtonSettings.cssClass","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.defaultSuffixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.create","toggleButtonSettings.change","toggleButtonSettings.destroy","customToolTip.title","customToolTip.content","customToolTip.prefixIcon",[{tag:"galleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy"]},{tag:"customGalleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","menuId","customItemType","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","menuSettings.openOnClick","menuSettings.enableCenterAlign","menuSettings.showRooltLevelArrows","menuSettings.showSubLevelArrows","menuSettings.enableSeparator","menuSettings.enabled","menuSettings.orientation","menuSettings.menuType","menuSettings.animationType","menuSettings.subMenuDirection","menuSettings.fields","menuSettings.cssClass","menuSettings.contextMenuTarget","menuSettings.excludeTarget","menuSettings.height","menuSettings.width","menuSettings.titleText","menuSettings.create","menuSettings.beforeOpen","menuSettings.open","menuSettings.close","menuSettings.mouseover","menuSettings.mouseout","menuSettings.keydown","menuSettings.destroy"]}]]}]]}]]}]]},{tag:"contextualTabs",attr:["backgroundColor","borderColor",[{tag:"tabs",attr:["id","text",[{tag:"groups",attr:["id","text","alignType","type","contentID",[{tag:"content",attr:["defaults.type","defaults.width","defaults.height","defaults.isBig",[{tag:"groups",attr:["id","columns","itemHeight","itemWidth","expandedColumns","contentID","text","type","toolTip","width","enableSeparator","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","splitButtonSettings.contentType","splitButtonSettings.prefixIcon","splitButtonSettings.targetID","splitButtonSettings.buttonMode","splitButtonSettings.arrowPosition","splitButtonSettings.type","splitButtonSettings.click","splitButtonSettings.enabled","splitButtonSettings.showRoundedCorner","splitButtonSettings.enableRTL","splitButtonSettings.size","splitButtonSettings.height","splitButtonSettings.imagePosition","splitButtonSettings.width","splitButtonSettings.text","splitButtonSettings.suffixIcon","splitButtonSettings.create","splitButtonSettings.itemMouseOver","splitButtonSettings.itemSelected","splitButtonSettings.beforeOpen","splitButtonSettings.destroy","splitButtonSettings.cssClass","dropdownSettings.dataSource","dropdownSettings.text","dropdownSettings.value","dropdownSettings.select","dropdownSettings.width","dropdownSettings.showRoundedCorner","dropdownSettings.showPopupOnLoad","dropdownSettings.allowMultiSelection","dropdownSettings.enableRTL","dropdownSettings.enabled","dropdownSettings.caseSensitiveSearch","dropdownSettings.showCheckbox","dropdownSettings.checkAll","dropdownSettings.uncheckAll","dropdownSettings.enablePersistence","dropdownSettings.enableIncrementalSearch","dropdownSettings.readOnly","dropdownSettings.allowGrouping","dropdownSettings.fields","dropdownSettings.selectedItems","dropdownSettings.itemsCount","dropdownSettings.height","dropdownSettings.cssClass","dropdownSettings.itemValue","dropdownSettings.popupHeight","dropdownSettings.targetID","dropdownSettings.waterMarkText","dropdownSettings.template","dropdownSettings.cascadeTo","dropdownSettings.query","dropdownSettings.create","dropdownSettings.popupHide","dropdownSettings.popupShown","dropdownSettings.beforePopupShown","dropdownSettings.change","dropdownSettings.checkChange","dropdownSettings.enableAnimation","dropdownSettings.destroy","toggleButtonSettings.contentType","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.type","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.click","toggleButtonSettings.enabled","toggleButtonSettings.showRoundedCorner","toggleButtonSettings.enableRTL","toggleButtonSettings.enablePersistence","toggleButtonSettings.toggleState","toggleButtonSettings.preventToggle","toggleButtonSettings.size","toggleButtonSettings.imagePosition","toggleButtonSettings.height","toggleButtonSettings.width","toggleButtonSettings.cssClass","toggleButtonSettings.defaultText","toggleButtonSettings.activeText","toggleButtonSettings.defaultPrefixIcon","toggleButtonSettings.defaultSuffixIcon","toggleButtonSettings.activePrefixIcon","toggleButtonSettings.create","toggleButtonSettings.change","toggleButtonSettings.destroy","customToolTip.title","customToolTip.content","customToolTip.prefixIcon",[{tag:"galleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy"]},{tag:"customGalleryItems",attr:["text","toolTip","customToolTip.title","customToolTip.content","customToolTip.prefixIcon","menuId","customItemType","buttonSettings.contentType","buttonSettings.type","buttonSettings.imagePosition","buttonSettings.prefixIcon","buttonSettings.click","buttonSettings.width","buttonSettings.cssClass","buttonSettings.enabled","buttonSettings.showRoundedCorner","buttonSettings.enableRTL","buttonSettings.repeatButton","buttonSettings.size","buttonSettings.height","buttonSettings.text","buttonSettings.timeInterval","buttonSettings.create","buttonSettings.click","buttonSettings.destroy","menuSettings.openOnClick","menuSettings.enableCenterAlign","menuSettings.showRooltLevelArrows","menuSettings.showSubLevelArrows","menuSettings.enableSeparator","menuSettings.enabled","menuSettings.orientation","menuSettings.menuType","menuSettings.animationType","menuSettings.subMenuDirection","menuSettings.fields","menuSettings.cssClass","menuSettings.contextMenuTarget","menuSettings.excludeTarget","menuSettings.height","menuSettings.width","menuSettings.titleText","menuSettings.create","menuSettings.beforeOpen","menuSettings.open","menuSettings.close","menuSettings.mouseover","menuSettings.mouseout","menuSettings.keydown","menuSettings.destroy"]}]]}]]}]]}]]}]]}],_ribbonRerender:function(){var n=this.model,r=this.element,t,i,u;if(i=this.element.find(".e-content.e-content-item"),this.element.find(".e-collapse-content").length>0)for(u=i.length,t=0;t<u;t++)if(i.eq(t).hasClass("e-active-content")&&i.eq(t).hasClass("e-collapse-content")){this._selectedItemIndex=t;this._isCollapsed=!0;break}this._isCollapsed?(n.selectedItemIndex=this._selectedItemIndex,n._isCollapsed=!0):n._isCollapsed=!1;this.element.data("ejTab")&&(this.element.data("ejTab")._destroy(),this.element=r,this.model=n);this.element.ejRibbon("destroy").ejRibbon(n);this.model=n;this.element=r;this.model._isCollapsed&&this.collapse()},_setModel:function(i){var e,u,l,s,r,v,f,y,o,a,p;for(e in i)switch(e){case"applicationTab":t.isNullOrUndefined(i.applicationTab.backstageSettings)||t.isNullOrUndefined(i.applicationTab.backstageSettings.pages)||(this.model.applicationTab.backstageSettings.pages=i.applicationTab.backstageSettings.pages);this.model.enableOnDemand?this._createAppTabOnDemand():this._createApplicationTab();break;case"selectedItemIndex":this.model.selectedItemIndex>0&&this._tabObj.model.disabledItemIndex.indexOf(this.model.selectedItemIndex)===-1&&(this._ribbonTabs.eq(this.model.selectedItemIndex).is(":visible")||this._responsiveTabText.eq(t.isNullOrUndefined(t.isNullOrUndefined(this.model.applicationTab))?this.model.selectedItemIndex:this.model.selectedItemIndex-1).is(":visible"))&&this._tabObj.option({selectedItemIndex:this.model.selectedItemIndex});break;case"disabledItemIndex":var u,w=this.model.disabledItemIndex.length,h=this.model.disabledItemIndex,b=this.element.find(".e-link"),c;for(this.model.disabledItemIndex.push(0),this._tabObj.option({disabledItemIndex:this.model.disabledItemIndex}),r=0;r<w;r++)u=this._ribbonTabs.eq(h[r]).parent().parent(),(u.hasClass("e-contextli")||u.hasClass("e-contextliset"))&&u.addClass("e-disable"),this._tabObj.model.selectedItemIndex!=0&&this._tabObj.model.selectedItemIndex===h[r]&&(c=b.eq(h[r]).attr("href"),n(c).append(this.element.find("#"+this._id+"_disabled")),n(c).css("position","relative"),this.element.find("#"+this._id+"_disabled").show());break;case"enabledItemIndex":for(l=this.model.enabledItemIndex.length,s=this._tabUl.find(".e-contextualtabset"),this._ribbonTabs=this._ribbonTabs.not("span,.e-ribresmenu,.e-responsiveqat"),r=0;r<l;r++)this.model.enabledItemIndex[r]!==0&&this._ribbonTabs.eq(this.model.enabledItemIndex[r]).is(":visible")||(this.model.enabledItemIndex.splice(r,1),--l,--r);for(this._conTabsRemove(),this._tabObj.option({enabledItemIndex:this.model.enabledItemIndex}),this._contextualTabs(),v=this.model.enabledItemIndex.length,f=0;f<v;f++)this._tabText.eq(this.model.enabledItemIndex[f]).parent().removeClass("e-disable"),this._tabText.eq(this.model.enabledItemIndex[f]).parent().css("position",""),u=this._ribbonTabs.eq(this.model.enabledItemIndex[f]).parent().parent(),(u.hasClass("e-contextli")||u.hasClass("e-contextliset"))&&u.removeClass("e-disable"),this.model.enabledItemIndex[f]==this._tabObj.model.selectedItemIndex&&this.element.find("#"+this._id+"_disabled").hide();for(y=s.length,o=0;o<y;o++)n(s[o]).hasClass("e-disable")&&n(s[o]).parents(".e-contextliset").addClass("e-disable");break;case"allowResizing":this._ribbonWindowResize();break;case"isResponsive":this._ribbonWindowResize();break;case"width":this.element.width(i[e]);this._ribbonWindowResize();break;case"enableRTL":this.model.enableRTL=i[e];a=this.model;p=this.element;this.element.data("ejTab")&&(this.element.data("ejTab")._destroy(),this.element=p,this.model=a);this.element.ejRibbon("destroy");n("#"+this._id).ejRibbon(a);break;case"locale":this.model.locale=i[e];this._ribbonRerender()}},_setTabContentHeight:function(){var i,f,r,e,u,t;for(this.element.find(".e-ribGroupContent").height("auto"),i=0,f=this.element.find(".e-content.e-content-item"),u=n("#"+this._id).parents(),n(f).addClass("e-content-show"),n("#"+this._id).is(":hidden")&&n("#"+this._id).addClass("e-ribbon-show"),t=0;t<u.length;t++)u.eq(t).is(":hidden")&&u.eq(t).addClass("e-ribbon-show");for(r=this.element.find(".e-separatordivrow"),e=r.length,t=0;t<e;t++)n(r).eq(t).height(n(r).eq(t).prev().height());this.element.find(".e-ribGroupContent").each(function(){i=Math.max(i,n(this).height())});this.element.find(".e-ribGroupContent").height(i);n(f).removeClass("e-content-show");n("#"+this._id).hasClass("e-ribbon-show")&&(this._ribbonResize(),n(".e-ribbon-show").removeClass("e-ribbon-show"))},_init:function(){t.isNullOrUndefined(this.element)||(this._trigger("load"),this._render(),this._wireEvents())},_render:function(){var i,e,o,u,f;this.model.enableOnDemand&&n.isFunction(n.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),n("#"+this._id+"_WaitingPopup").addClass("e-ribbonwaitingpopup"));this.model.disabledItemIndex.length==0&&this.model.disabledItemIndex.push(0);this._renderTab();this.model.showQAT&&(i=t.buildTag("div.e-rbnquickaccessbar").click(n.proxy(this._onQatClick,this)),this.model.showBelowQAT?(i.removeClass("e-rbnabove").addClass("e-rbnbelow"),this.element.append(i).addClass("e-rbnwithqatbelow")):(i.removeClass("e-rbnbelow").addClass("e-rbnabove"),this.element.prepend(i).addClass("e-rbnwithqatabove")),this.element.addClass("e-rbnwithqat"));this._initPrivateProperties();this.model.enableOnDemand?this.model.collapsible?this._createQAT():(this._groupContent(),this.element.find(".e-header").addClass("e-rbnondemand"),this._createQAT()):(this._groupingControls(),this._createQAT());this._initial=!0;this._customization();this._initialRender=!0;this.model.collapsible&&this.collapse();this._ribbonResponsive();this._responsiveTabText=this.element.find(".e-responsivetabheader li");this._phoneMode&&this._ribbonWindowResize();this._tabObj.initialRender=!1;this.element.append(t.buildTag("div#"+this._id+"_disabled"));this.element.append(t.buildTag("div#"+this._id+"_modelDiv"));e=this.element.find(".e-content");this.element.find("#"+this._id+"_disabled").height(this.element.find(".e-active-content").height()).width(this.model.width);this.element.find("#"+this._id+"_disabled").css({top:0,left:0,position:"absolute"}).addClass("e-disable");this.element.find("#"+this._id+"_disabled").hide();this.element.find("#"+this._id+"_modelDiv").height(n(e).height()).width(this.model.width);this.element.find("#"+this._id+"_modelDiv").css({top:0,left:0,position:"absolute"}).addClass("e-modelDiv");this.element.find("#"+this._id+"_modelDiv").hide();o=t.buildTag("div#"+this._id+"_resize").addClass("e-resizediv").hide().click(n.proxy(this._onResizeDivClick,this));this.element.append(o);var r=t.buildTag("div#"+this._id+"_tooltip").addClass("e-tooltipdiv").hide(),s=t.buildTag("div#"+this._id+"_toolTip_title").addClass("e-tooltiptitle"),h=t.buildTag("div#"+this._id+"_toolTip_Desc").addClass("e-tooltipdesc");r.append(s);r.append(h);this.element.append(r);this._applicationTab.hasClass("e-active")&&!t.isNullOrUndefined(this.model.tabs[0].id)&&(this._applicationTab.removeClass("e-active"),this.element.find(".e-content.e-content-item").remove(),this._tabUl.find(".e-expandcollapse").remove());u=this.element.find(".e-empty-content");f=this.element.find(".e-groupdiv").eq(0);n(u).length>0&&n(f).length>0&&n(u).height(n(f).parent().height());this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").show()},_createQuickAccessBar:function(){var u,e,r,o,i,s,f;if(this.model.showQAT){for(u=t.buildTag("div.e-splitbtnqatdiv").attr("title",this.localizedLabels.CustomizeQuickAccess),e=t.buildTag("button#"+this._id+"_qatsplitbtn").addClass("e-splitbtnqat e-rbn-button"),u.append(e.ejButton({size:"normal",type:"button",contentType:"imageonly",height:30,width:14,prefixIcon:"e-icon e-ribbon e-qatexpand",click:n.proxy(this._onQatExpandBtnClick,this)})),this._qAccessBar.append(u),r=t.buildTag("ul.e-rbnqatmenu","<div>"+this.localizedLabels.CustomizeQuickAccess+"<\/div>").click(n.proxy(this._onQatMenuClick,this)),o=this._qatControlsName.length,i=0;i<o;i++)s=t.buildTag("li#"+this._qatControlsName[i].id+"_menuli.e-qatmenuli e-removemenuli","<p>"+this._qatControlsName[i].text+"<\/p>").appendTo(r).attr("title",this.localizedLabels.RemoveFromQuickAccessToolbar),this._qatControlsName[i].qAccess=="menu"&&s.addClass("e-addmenuli").removeClass("e-removemenuli").attr("title",this.localizedLabels.AddToQuickAccessToolbar);f="";f=this.model.showBelowQAT?"<li class='e-rbnshowabove e-qatmenuli'>"+this.localizedLabels.ShowAboveTheRibbon+"<\/li>":"<li class='e-rbnshowbelow e-qatmenuli'>"+this.localizedLabels.ShowBelowTheRibbon+"<\/li>";r.append("<li class='e-qatmenuli e-qatseparator'><\/li><li class='e-qatmorecommands e-qatmenuli' title="+this.localizedLabels.CustomizeQuickAccess+">"+this.localizedLabels.MoreCommands+"<\/li>"+f);this._qAccessBar.append(r.hide())}},_tooltip:function(t){var i=this.element.find(".e-controlclicked");(i.length<=0||n(i).find(".e-ribbonbtn").length>0)&&(this.element.find("#"+t.data.ribbonId+"_resize").is(":visible")||this.element.find(".e-gallexpandcontent").is(":visible")?(n(t.target).parents(".e-resizediv").length>0||n(t.target).parents(".e-gallexpandcontent").length>0)&&this._toolTipShow(t):this._toolTipShow(t))},_toolTipShow:function(i){var u=this.element.find("#"+i.data.ribbonId+"_tooltip"),f,e,s,b,o,l,v,k,y,h,p,r,w,a,c;(u.find(".e-tooltiptitle").length<=0&&(k=t.buildTag("div#"+i.data.ribbonId+"_toolTip_title").addClass("e-tooltiptitle"),u.prepend(k)),u.removeClass("e-tooltipdivwithimg"),l=u.find(".e-tooltiptitle"),l.children().remove(),n(i.target).is("li"))||(n(i.target).hasClass("e-rarrowup-2x")&&!t.isNullOrUndefined(this.model.expandPinSettings.toolTip)&&n(n(i.target).parent()).attr("title",this.model.expandPinSettings.toolTip),!n(i.target).hasClass("e-rarrowup-2x")||t.isNullOrUndefined(this.model.expandPinSettings.customToolTip.title)&&t.isNullOrUndefined(this.model.expandPinSettings.customToolTip.content)||(r=i.data.value.expandObj),n(i.target).hasClass("e-ribbonpinicon")&&!t.isNullOrUndefined(this.model.collapsePinSettings.toolTip)?n(n(i.target).parent()).attr("title",this.model.collapsePinSettings.toolTip):!n(i.target).hasClass("e-ribbonpinicon")||t.isNullOrUndefined(this.model.collapsePinSettings.customToolTip.title)&&t.isNullOrUndefined(this.model.collapsePinSettings.customToolTip.content)?n(i.target).hasClass("e-rarrowup-2x")||n(i.target).hasClass("e-ribbonpinicon")||(r=i.data.value):r=i.data.value.collapseObj,t.isNullOrUndefined(r)||t.isNullOrUndefined(r.customToolTip)||t.isNullOrUndefined(r.customToolTip.title)?l.remove():l.append(r.customToolTip.title),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.customToolTip)||t.isNullOrUndefined(r.customToolTip.content)||(l.children().length<=0&&l.empty().append("<b>"+r.customToolTip.title+"<\/b>"),o=u.find(".e-tooltipdesc"),o.children().remove(),o.append(r.customToolTip.content),o.children().length<=0&&o.empty().append("<h6>"+r.customToolTip.content+"<\/h6>"),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.customToolTip.prefixIcon)?o.children().addClass("e-tooltipcontent"):(o.prepend("<span class=e-tooltipimg><\/span>"),o.find(".e-tooltipimg").addClass(r.customToolTip.prefixIcon),o.children().not("."+r.customToolTip.prefixIcon).addClass("e-tooltipcntwithimg"),u.addClass("e-tooltipdivwithimg"))),t.isNullOrUndefined(r))||(e=this.element.find("#"+i.delegateTarget.id).offset(),f=this.element.find("#"+i.delegateTarget.id),u.stop(!0).delay(700).show(0).addClass("e-rbntooltipshadow"),b=this.element.find("#"+i.data.ribbonId+"_resize"),v=n(i.target).parents(".e-gallexpandcontent"),this.element.css({position:"relative"}),y=this.element.width()+this.element.offset().left-(e.left+parseInt(n(u).width(),10)),e.left=y<=0?e.left+y-this.element.offset().left:e.left-this.element.offset().left,p=this.element.find(".e-active-content").eq(0),h=p.is(":visible")?this._tabUl.height()+p.height():this._tabUl.height(),b.is(":visible")&&!v.is(":visible")?(u.offset({left:e.left}),s=f.parents(".e-galleryrow").length>0?h+f.position().top+f.parents(".e-galleryrow").height():h+f.position().top+f.height(),u.css({top:s})):v.is(":visible")?(w=f.parents(".e-galleryrow").length>0?f.parents(".e-galleryrow"):f.parents(".e-galleryexpanderrow").length>0?f.parents(".e-galleryexpanderrow"):f,s=n(v).parents(".e-resizediv").length>0?w.height()+h+f.position().top+12:w.height()+this._tabUl.height()+f.position().top+12,u.offset({left:e.left}),u.css({top:s})):n(i.target).parents(".e-qatooldiv").length>0||n(i.target).hasClass("e-qatooldiv")?(a=this.element.find(".e-qaresizediv"),c=this.element.find(".e-rbnquickaccessbar"),c.hasClass("e-rbnabove")&&a.length>0?a.is(":visible")&&u.offset({top:a.height()+c.height()+4,left:e.left}):c.hasClass("e-rbnabove")?u.offset({top:c.height()+4,left:e.left}):(s=a.is(":visible")?c.height()+a.height()+h+4:h+c.height()+4,u.offset({top:s,left:e.left}))):(s=h+3,u.offset({top:s,left:e.left})))},_toolTipOut:function(n){var t=this.element.find("#"+n.data.ribbonId+"_tooltip");t.hide(0);t.css({top:"",left:""});t.find(".e-tooltiptitle").children().remove();t.find(".e-tooltipdesc").children().remove()},_responsiveScrollRemove:function(){var t=this.element.find(".e-active-content .e-responsiveScroll"),n=this.element.find(".e-rescontentScroll");n.length>0&&(n.data("ejScroller")._destroy(),n.parent().append(n.find("div:first").children()),n.remove());t.length>0&&(t.data("ejScroller")._destroy(),this.element.find(".e-active-content").append(t.find("div:first").children()),t.remove())},_onGroupClick:function(i){var f,y,r,h,c,l,rt,o,e,a,k,v,d,g,nt,tt,it,ut,ft;if(this._toolTipCustomization(i),parentElem=n(i.target).parents(".e-resizebtnselect"),this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active"),f=n(i.target).parents(".e-resizediv"),n(i.target).hasClass("e-resizebtnselect")?n(i.target).removeClass("e-resizebtnselect e-active"):parentElem.length>0?parentElem.removeClass("e-resizebtnselect e-active"):(parentElem=n(i.target).parents(".e-resizebtn"),parentElem.length>0?parentElem.addClass("e-resizebtnselect e-active"):n(i.target).hasClass("e-resizebtn")&&n(i.target).addClass("e-resizebtnselect e-active")),this.model.showQAT&&!n(i.target).parents(".e-mobdiv").length>0&&(n(i.target).hasClass("e-togglebutton e-btn")||n(i.target).parents(".e-togglebutton.e-btn").length>0)&&(r=n(i.target),n(i.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(i.target).parents(".e-togglebutton.e-btn")),y=this._QATclick?r.parent().find("input").attr("id")+"_mobEle":r.parent().find("input").attr("id")+"_qatEle",n(".e-ribbon.e-rbnwithqat").find("#"+y).length>0&&this._rbnToggleBtnCustomization(i,y)),!this._phoneMode)if(f.length<=0&&(n(i.target).hasClass("e-resizebtn")?f=n(i.target):t.isNullOrUndefined(n(i.target).parents(".e-resizebtn"))||(f=n(i.target).parents(".e-resizebtn"))),this.element.find(".e-resizediv").is(":visible")&&this.element.find(".e-resizediv .e-gallexpandcontent").is(":visible"))n(i.target).hasClass("e-gallerymoveicon")||n(i.target).hasClass("e-gallerymovediv")||n(i.target).hasClass("e-expgallerydiv")||n(i.target).hasClass("e-scrollbar")||n(i.target).parents().hasClass("e-scrollbar")?expClick=i.target:n(i.target).parents().hasClass("e-gallerymenu")&&(n(i.target).hasClass("e-haschild")||n(i.target).hasClass("aschild")||n(i.target).hasClass("e-arrows"))&&(expClick=i.target),t.isNullOrUndefined(expClick)&&(this._ribbonGalleryShow(),this.element.find(".e-resizediv").show().css("visibility",""),this.element.find(".e-resizediv .e-gallexpandcontent").hide().css("visibility",""));else if(f.length<=0){if(!n(i.target).parents(".e-content").length>0&&n(i.target).parents(".e-rbn-ddl").length>0||n(i.target).parents(".e-rbn-splitbtn").length>0||n(i.target).parents(".e-presetWrapper").length>0||n(i.target).parents(".e-ribbonpopup").length>0||n(i.target).parents(".e-colorpicker.e-ribbon:visible").length>0)return!1;this._resizeDivHide()}else n(f).hasClass("e-resizebtn")&&(this.element.find(".e-resizediv").is(":visible")?f.parent().siblings(".e-contentbottom").length<=0?this._resizeDivHide():(this._resizeDivHide(),this._resizeDivShow(f)):this._resizeDivShow(f));if(this._phoneMode){var u=this.element.find(".e-active-content"),s=0,p,w,b,r=i.target;if(n(r).hasClass("e-groupresponsive e-ribdownarrow")){for(p=u.find(".e-resptoolbarScroll .e-scrollbar").height(),b=u.children(".e-groupdiv,.e-groupmobdiv"),h=0;h<b.length;h++)s+=b.eq(h).outerHeight();s+=t.isNullOrUndefined(p)?0:p;w=u.find(".e-respmobcontent").length>0?s-u.find(".e-respmobcontent").outerHeight()>this._responsiveHeight:s>this._responsiveHeight;u.height(w?u.find(".e-respmobcontent").length>0?this._responsiveHeight+u.find(".e-respmobcontent").outerHeight():this._responsiveHeight:s).removeClass("e-responsiveheight e-rbnmobheader e-responsiveToolbarScroll");w&&(c=t.buildTag("div#"+this._id+"_responsiveScroller").addClass("e-responsiveScroll").append(t.buildTag("div")),u.find(".e-respmobcontent").length>0?c.find("div").append(u.children().eq(0).siblings()):c.find("div").append(u.children()),u.append(c),u.find(".e-responsiveScroll").ejScroller({height:this._responsiveHeight,scrollerSize:8,buttonSize:0}));n(r).removeClass("e-ribdownarrow").addClass("e-ribuparrow");n(r).parents(".e-groupdiv").find(".e-ribdownarrow").removeClass("e-ribdownarrow").addClass("e-ribuparrow")}else if(n(r).hasClass("e-groupresponsive e-ribuparrow"))u.addClass("e-responsiveheight e-rbnmobheader"),u.find(".e-resptoolbarScroll").length>0&&u.addClass("e-responsiveToolbarScroll"),this._responsiveScrollRemove(),n(r).removeClass("e-ribuparrow").addClass("e-ribdownarrow");else if(this.element.find(".e-responsivecontent").is(":hidden")&&(n(r).hasClass("e-resizebtn")||n(r).parents(".e-resizebtn").length>0||n(r).hasClass("e-groupresponsive e-ribrightarrow")||n(r).hasClass("e-ribrightdivarrow"))){if(n(r).hasClass("e-resizebtn")?(this._responsiveTarget=n(r).parents(".e-groupdiv"),this._responsiveContent=n(r).parent().siblings()):n(r).parents(".e-resizebtn").length>0?(this._responsiveTarget=n(r).parents(".e-resizebtn").parents(".e-groupdiv"),this._responsiveContent=n(r).parents(".e-resizebtn").parent().siblings()):(n(r).hasClass("e-groupresponsive e-ribrightarrow")||n(r).hasClass("e-ribrightdivarrow"))&&(l=n(r).parents(".e-resizegroupdiv").find(".e-resizebtn"),l.length>0&&(this._responsiveTarget=l.parents(".e-groupdiv"),this._responsiveContent=l.parent().siblings())),rt=this._responsiveContent.eq(0).removeClass("e-reshide"),o=this.element.find(".e-content.e-responsivecontent"),o.children().not(".e-responsiveback").remove(),o.append(rt),this.element.find(".e-restopbackcontent").text(this._responsiveTarget.find(".e-resizebtn .e-btntxt").text()),e=o.find(".e-ribbongallery"),e.length>0){for(a=this._responsiveGallery,k=Math.floor(e.find(".e-galleryrow").children().length/a),e.find(".e-galleryrow").children().length%a>0&&++k,v=1;v<=k;v++){for(d=t.buildTag("div#"+e.attr("id")+"_galleryExpanderRow_"+v).addClass("e-galleryexpanderrow").click({model:e},n.proxy(this._onGalleryItemClick,this)),g=0;g<a;g++)e.find(".e-galleryrow").children().eq(0).appendTo(d);d.appendTo(o.parent().find(".e-expandercontent"))}e.hide();o.parent().find(".e-gallexpandcontent").show()}this._responsiveContentShow(o)}}nt=n(i.target).hasClass("e-groupdiv")?n(i.target).index():n(i.target).parents(".e-groupdiv").index();nt!=-1&&(i.groupItems=this._groupClickEventArgs(nt,i));n(i.target).parents(".e-ribbongallerycontrol").length===0&&(this._trigger("groupClick",i),i.cancel||!t.raiseWebFormsServerEvents||t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("groupClick")!=-1&&(tt=n.extend(!0,{},this.model),it=i.target.id?i.target.id:i.target.parentNode.id,ut={model:tt,originalEventType:"groupClick",id:it},ft={model:tt,id:it},t.raiseWebFormsServerEvents("groupClick",ut,ft)))},_groupClickEventArgs:function(i,r){var f=this._tabUl.find(".e-active"),u=f.index(),o,e;return this._phoneMode&&n(r.target).parents(".e-groupdiv").siblings(".e-groupmobdiv").length>0&&(i-=1),t.isNullOrUndefined(this.model.applicationTab)||f.hasClass("e-contextualtabset")||(u=u-1),(u<0)?void 0:(e=f.hasClass("e-contextualtabset")?this.model.contextualTabs[f.parents(".e-contextual").index()].tabs[u]:this.model.tabs[u],t.isNullOrUndefined(e)||(o=e.groups[i]),o)},goToMainContent:function(){var i=this.element.find(".e-responsivebackstage"),n=this.element.find(".e-responsivetabheader"),r={},t=this.element.find(".e-active-content"),f=this.element.find(".e-responsivebackstage"),u=this.element.find(".e-responsivebackstagecontent");n.removeClass("e-resshow");i.is(":visible")&&i.removeClass("e-backstageshowanimate").addClass("e-reshide");u.is(":visible")&&u.hide();this.element.find(".e-responsivecontent").is(":visible")&&this._responsiveContentBack();t.hasClass("e-responsiveheight")||(t.addClass("e-responsiveheight e-rbnmobheader"),this._responsiveScrollRemove(),t.find(".e-groupresponsive.e-ribuparrow").removeClass("e-ribuparrow").addClass("e-ribdownarrow"),r.type="collapse",this._trigger("collapse",r));n.hasClass("e-resshow")&&n.removeClass("e-resshow")},_onResizeDivClick:function(t){var f,r,i,u;this._toolTipCustomization(t);this.model.showQAT&&(n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0)&&(r=n(t.target),n(t.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(t.target).parents(".e-togglebutton.e-btn")),f=r.parent().find("input").attr("id")+"_qatEle",this._rbnToggleBtnCustomization(t,f));this._phoneMode&&((n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0)&&(r=n(t.target),n(t.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(t.target).parents(".e-togglebutton.e-btn")),f=r.parent().find("input").not(".e-active").attr("id")+"_mobEle",this._rbnToggleBtnCustomization(t,f)),n(t.target).hasClass("e-ribleftarrow")&&this._responsiveContentBack());n(t.currentTarget).find(".e-ribGroupContent").length>0&&(i=n(t.currentTarget).find(".e-ribGroupContent").attr("id").split("_"),u=this.element.find("#"+i[0]+"_"+i[1]+"_"+i[2]).index(),this._phoneMode&&u>0&&this.element.find("#"+i[0]+"_"+i[1]+"_"+i[2]).siblings(".e-groupmobdiv").length>0&&(u-=1),u!=-1&&(t.groupItems=this._groupClickEventArgs(u,t)));t.targetElement="resizedGroup";this._trigger("groupClick",t)},_toolTipCustomization:function(t){var i=n(t.target).parents(".e-controlpadding");n(i).find(".e-ribbongallerycontrol").length<=0&&n(t.target).find(".e-disable").length<=0&&!n(t.target).hasClass("e-disable")&&(this.element.find(".e-tooltipdiv").hide(0),n(i).hasClass("e-controlclicked")?n(i).removeClass("e-controlclicked"):n(i).addClass("e-controlclicked"))},_onTabClick:function(i){var e;this._trigger("beforeTabClick",i);this.model.enableOnDemand&&(n("#"+this._id+"_WaitingPopup").is(":hidden")&&this.element.find(".e-content.e-content-item").eq(i.activeIndex).children().length==0&&this.element.ejWaitingPopup("show"),this._groupContent(i));var l=this.element.find(".e-rarrowup-2x"),o=this._tabUl.find("li.e-active"),f=this.element.find(".e-collapseactive"),s,c,h=this.element.find(".e-active-content").eq(0);if(this._phoneMode){this._responsiveScrollRemove();this.element.find(".e-mobribgroupactive").removeClass("e-mobribgroupactive");var a=i.activeIndex,r=this.element.find(".e-content.e-content-item").eq(a),u=this._tabUl.children(".e-tab").index(i.activeHeader);if(t.isNullOrUndefined(this.model.applicationTab)&&(--i.activeIndex,--i.prevActiveIndex),this.element.find(".e-content.e-content-item").eq(i.prevActiveIndex).removeClass("e-responsiveheight e-rbnmobheader"),this.element.find(".e-content.e-content-item").eq(i.activeIndex).addClass("e-responsiveheight e-rbnmobheader"),this.element.find(".e-responsivecontent").is(":visible")&&this.element.find(".e-responsivecontent").hasClass("e-resshow")&&this.element.find(".e-responsivecontent").removeClass("e-resshow"),t.isNullOrUndefined(this._responsiveContent)||this._responsiveTarget.append(this._responsiveContent).css(this._responsiveContentStyle),u!=-1&&this._mobileContents[u].mobileContent.length>0&&!r.find(".e-respmobcontent").length>0){for(r.prepend(t.buildTag("div#"+this._id+"_mobcontent").addClass("e-respmobcontent e-groupmobdiv").append(t.buildTag("div#"+this._id+"_mobribgroup").addClass("e-mobribgroup e-mobribgroupactive").append(t.buildTag("div.e-ribupdivarrow").addClass("e-toolbaralign").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))))).click(n.proxy(this._onGroupClick,this)).click(n.proxy(this._onMobContentClick,this)),r.find(".e-resgroupheader").removeClass("e-resgroupheader"),e=0;e<this._mobileToolbar[u].Content.length;e++)r.find(".e-mobribgroup").append(this._mobileToolbar[u].Content[e]);r.find(".e-mobribgroup").append(r.find(".e-mobribgroup .e-ribupdivarrow"))}u!=-1&&this._mobileContents[u].mobileContent.length>0&&!r.find(".e-mobribgroup").hasClass("e-mobribgroupactive")&&r.find(".e-mobribgroup").addClass("e-mobribgroupactive")}o.length>0?(o.removeClass("e-active"),o.children().removeClass("e-active"),h.removeClass("e-active-content").hide()):f.length>0&&(i.activeHeader.textContent===f.find(".e-link").text()?(f.addClass("e-active").removeClass("e-collapseactive"),h.removeClass("e-collapse-content").slideDown("fast","swing",n.proxy(this._ribExpand,this))):(s=this.element.find(".e-link"),f.removeClass("e-collapseactive"),this.element.find(".e-collapse-content").removeClass("e-collapse-content"),h.removeClass("e-active-content"),c=s.eq(i.activeIndex).attr("href"),s.eq(i.activeIndex).addClass("e-active"),n(c).slideDown("fast","swing",n.proxy(this._ribExpand,this))));l.length>0&&this.element.find(".e-collapsed").length>0&&this._addRibbonPin();this._initialRender||this._trigger("tabClick",i);this._clickValue="click"},_onTabSelect:function(i){var u,f,e,o,r,h;if(this.model.enableOnDemand&&(this._initialRender&&n("#"+this._id+"_WaitingPopup").is(":hidden")&&this.element.ejWaitingPopup("show"),this._setTabContentHeight()),u=this.element.find("li.e-active"),r=this.element.find(".e-expandcollapse"),this.model.selectedItemIndex=i.activeIndex,u.hasClass("e-disable")||(f=this.element.find(".e-link"),e=f.eq(i.activeIndex).attr("href"),o=n(e).find("#"+this._id+"_disabled"),o&&this.element.find("#"+this._id+"_disabled").hide()),r.length>0&&r.appendTo(this.element.find(".e-active-content").eq(0)),this._phoneMode||this._ribbonResize(),!this._initialRender&&(this._trigger("tabSelect",i),n(".e-menu-wrap").children(".e-split:visible").length>0&&n(n(".e-menu-wrap").children(".e-split")).css("display","none"),n(".e-rbn-ddl").parent(".e-ddl-popup:visible").length>0&&n(n(".e-rbn-ddl").parent(".e-ddl-popup:visible")).css("display","none"),n(".e-popupWrapper").parent(".e-colorpicker.e-ribbon:visible").length>0&&n(n(".e-popupWrapper").parent(".e-colorpicker.e-ribbon")).css("display","none"),t.isOnWebForms&&t.raiseWebFormsServerEvents&&!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("tabSelect")!=-1)){var s=n.extend(!0,{},this.model),c={model:s,originalEventType:"tabSelect",activeIndex:i.activeIndex,prevActiveIndex:i.prevActiveIndex},l={model:s,activeIndex:i.activeIndex,prevActiveIndex:i.prevActiveIndex};t.raiseWebFormsServerEvents("tabSelect",c,l)}this._phoneMode&&!this._initialRender&&this._ribbonWindowResize();this._initialRender=!1;h=this;this.model.enableOnDemand&&n("#"+this._id+"_WaitingPopup").is(":visible")&&setTimeout(function(){h.element.ejWaitingPopup("hide")},300)},_create:function(n){this.model.enableOnDemand&&this.element.find(".e-content.e-content-item").addClass("e-rbn-ondemand");this._trigger("tabCreate",n)},_onGalMoveUpClick:function(t){var i=this.element.find("#"+t.data.galleryId),r=i.find(".e-gallerycontent").children(":visible").first().prev();this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow();r.length>0&&(i.find(".e-gallerycontent").children(":visible").last().hide(),r.show().width(i.find(".e-galleryrow").first().width()),n(r).hasClass("e-gryfirstrow")&&i.find(".e-moveupdiv").addClass("e-disablegrymovebtn"),i.find(".e-movedowndiv").removeClass("e-disablegrymovebtn"))},_onGalMoveDownClick:function(t){var i=this.element.find("#"+t.data.galleryId),r=i.find(".e-gallerycontent").children(":visible").last().next();this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow();r.length>0&&(i.find(".e-gallerycontent").children(":visible").first().hide(),r.show().width(i.find(".e-galleryrow").first().width()),n(r).hasClass("e-grylastrow")&&i.find(".e-movedowndiv").addClass("e-disablegrymovebtn"),i.find(".e-moveupdiv").removeClass("e-disablegrymovebtn"))},_onQatMenuItemClick:function(t){var i={target:n(t.target),cancel:!1,text:n(t.target).text()};this._trigger("qatMenuItemClick",i)},_onQatResizeBtnClick:function(t){var i=this.element.find(".e-qaresizediv"),r=this.element.find(".e-qaresizebtn"),u;r.hasClass("e-active")?r.removeClass("e-tbtn e-active"):r.addClass("e-tbtn e-active");i.is(":hidden")?(n(t.e.currentTarget).position().left+i.width()>this.element.width()?(u=n(t.e.currentTarget).position().left+i.width()-this.element.width(),i.show().css({left:n(t.e.currentTarget).position().left-u})):i.show().css({top:this._qAccessBar.height(),left:n(t.e.currentTarget).position().left}),this._qAccessBar.hasClass("e-rbnbelow")?i.css({top:this.element.height()}):i.css({top:this._qAccessBar.height()})):i.hide().css({top:"",left:""})},_onQatExpandBtnClick:function(t){var f=0,o=this.element.find(".e-splitbtnqat"),e=this.element.find(".e-qaresizediv"),i=this.element.find(".e-rbnqatmenu"),r=n(t.e.currentTarget),u;if(o.hasClass("e-active")){o.removeClass("e-tbtn e-active");i.hide();return}o.addClass("e-tbtn e-active");e.length>0&&e.is(":visible")?(u=e.position().left+r.position().left+i.width(),u>this.element.width()&&(f=u-this.element.width()),i.show().css({top:e.height()-6,left:e.position().left+r.position().left-(f+6)})):(u=r.position().left+i.width(),this.model.enableRTL&&(u=this.element.width()-r.offset().left+i.width()),u>this.element.width()&&(f=u-this.element.width()),this.model.enableRTL&&i.show().css({right:this.element.width()-r.offset().left+this.element.offset().left-r.outerWidth()-f}),i.show().css({left:r.position().left-f}),this.element.hasClass("e-grpdivhide")&&(this.element.removeClass("e-grpdivhide"),this.element.find(".e-active-content").eq(0).addClass("e-resdivshow")))},_onQatClick:function(t){if(this._QATclick||(this._QATclick=!0),this.model.showQAT&&(n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0)){var i,r=n(t.target);n(t.target).parents(".e-togglebutton.e-btn").length>0&&(r=n(t.target).parents(".e-togglebutton.e-btn"));i=r.parents(".e-qatooldiv").attr("id").slice(0,-7);this._rbnToggleBtnCustomization(t,i)}this._QATclick=!1},_onMobContentClick:function(t){if(n(t.target).hasClass("e-togglebutton e-btn")||n(t.target).parents(".e-togglebutton.e-btn").length>0){var r,i=n(t.target);if(n(t.target).parents(".e-togglebutton.e-btn").length>0&&(i=n(t.target).parents(".e-togglebutton.e-btn")),!i.parents(".e-mobdiv").length>0)return;r=i.parents(".e-mobdiv").attr("id").slice(0,-7);this._rbnToggleBtnCustomization(t,r)}},_rbnToggleBtnCustomization:function(n,t){var r=this.element.find("#"+t+":input.e-togglebutton.e-chkbx-hidden"),f=r.parent().siblings(".e-togglebutton"),u,i;this._rbnToggleBtnAction&&r.length>0&&(this._rbnToggleBtnAction=!1,i=r.data("ejToggleButton"),u=i.model.click,i.model.click="",f.click(),i.model.click=u);this._rbnToggleBtnAction=!0},_onQatMenuClick:function(t){var f=this.element.find(".e-rbnquickaccessbar"),r,i=n(t.target),u=i.parents(".e-qatmenuli");(i.hasClass("e-qatmenuli")||u.length>0)&&(u.length>0&&(i=u),i.attr("id")&&(r=this.element.find("#"+this._id+"_"+i.attr("id").slice(0,-7)+"_qatEle").parents(".e-qatooldiv"),r.is(":visible")?(r.hide(),i.addClass("e-addmenuli").removeClass("e-removemenuli").attr("title",this.localizedLabels.AddToQuickAccessToolbar)):(r.show(),i.removeClass("e-addmenuli").addClass("e-removemenuli").attr("title",this.localizedLabels.RemoveFromQuickAccessToolbar))),i.hasClass("e-rbnshowbelow")?(this.element.append(f.removeClass("e-rbnabove").addClass("e-rbnbelow")).removeClass("e-rbnwithqatabove").addClass("e-rbnwithqatbelow"),i.addClass("e-rbnshowabove").removeClass("e-rbnshowbelow").text(this.localizedLabels.ShowAboveTheRibbon),this.model.showBelowQAT=!0):i.hasClass("e-rbnshowabove")&&(this.element.prepend(f.removeClass("e-rbnbelow").addClass("e-rbnabove")).removeClass("e-rbnwithqatbelow").addClass("e-rbnwithqatabove"),i.addClass("e-rbnshowbelow").removeClass("e-rbnshowabove").text(this.localizedLabels.ShowBelowTheRibbon),this.model.showBelowQAT=!1),this.element.find(".e-rbnqatmenu").hide().css({top:"",left:""}),this.element.find(".e-qaresizebtn,.e-splitbtnqat").removeClass("e-tbtn e-active"),(this.model.allowResizing||this.model.isResponsive)&&(this._qatResize(),this._qatResizeRemove()))},_onGalContentClick:function(t){var i=this.element.find("#"+t.data.galleryId);n(t.target).hasClass("e-gallerybtn")?(i.find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).addClass("e-galleryselect")):n(t.target).parents(".e-gallerybtn")&&(i.find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).parents(".e-gallerybtn").addClass("e-galleryselect"))},_onExpandContentClick:function(t){var i=this.element.find("#"+t.data.galleryId);n(t.target).hasClass("e-gallerybtn")?(i.parent().find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).addClass("e-galleryselect")):n(t.target).parents(".e-gallerybtn")&&(i.parent().find(".e-galleryselect").removeClass("e-galleryselect"),n(t.target).parents(".e-gallerybtn").addClass("e-galleryselect"))},_onExpandGalleryClick:function(i){var e,r=this.element.find("#"+i.data.galleryId),u=i.data.expandedColumns,f,o,s,h;for(this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow(),t.isNullOrUndefined(i.data.expandedColumns)&&(u=i.data.columns),e=Math.floor(r.find(".e-galleryrow").children().length/u),r.find(".e-galleryrow").children().length%u>0&&++e,f=1;f<=e;f++){for(o=t.buildTag("div#"+r.attr("id")+"_galleryExpanderRow_"+f).addClass("e-galleryexpanderrow").click({model:r},n.proxy(this._onGalleryItemClick,this)),s=0;s<u;s++)r.find(".e-galleryrow").children().eq(0).appendTo(o);o.appendTo(this.element.find("#"+r.attr("id")).parent().find(".e-expandercontent"))}for(r.hide(),h=0;h<i.data.columns;h++)r.find(".e-galleryrow").eq(0).append("<div><\/div>");this.element.find(".e-resizediv").is(":visible")&&(this.element.find(".e-resizediv").css("visibility","hidden"),this.element.find(".e-resizediv .e-gallexpandcontent").css("visibility","visible"));this.element.find("#"+r.attr("id")).parent().find(".e-gallexpandcontent").show();this.element.find("#"+r.attr("id")).parent().find(".e-expandercontent").height()>160&&!this._phoneMode&&this.element.find("#"+r.attr("id")).parent().find(".e-gallscrollcontent").ejScroller({height:160})},_onGalleryItemClick:function(i){var r,f,u,e,o;r={target:i.target,galleryModel:i.data.model,cancel:!1};n(r.target).hasClass("e-galleryexpanderrow")||(this._trigger("galleryItemClick",r),i.preventDefault(),t.raiseWebFormsServerEvents&&!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("galleryItemClick")!=-1&&(f=n.extend(!0,{},this.model),u=r.target.id?r.target.id:r.target.parentNode.id,e={model:f,originalEventType:"galleryItemClick",id:u},o={model:i.data.model,id:u},t.raiseWebFormsServerEvents("galleryItemClick",e,o)))},_ribbonKeyDown:function(n){(n.keyCode===40||n.keyCode===39)&&this._tabUl.find(".e-tab:visible,.e-contextualtabset:visible").length===this._tabObj.model.selectedItemIndex&&n.stopImmediatePropagation()},_OnKeyDown:function(t){var i,r;t.keyCode===27&&(i=this.element.find(".e-resizediv"),this.element.find(".e-ribbonbackstagepage").is(":visible")?this.hideBackstage():n(".e-menu-wrap").children(".e-split:visible").length<=0&&i.find(".e-ddl").parents(".e-controlclicked").length<=0&&i.is(":visible")?this._resizeDivHide():this.element.find(".e-gallexpandcontent").is(":visible")&&this._ribbonGalleryShow(),i.is(":visible")&&i.find(".e-controlclicked").removeClass("e-controlclicked"),r=this.element.find("#"+this._id+"_modelDiv"),r.is(":visible")&&r.css("display","none"))},_ribCollapse:function(n){var n={clickType:this._clickValue};this._clickValue==null&&(n={clickType:"click"});this._clickValue=null;this._trigger("collapse",n)},_ribExpand:function(n){this.element.find(".e-ribbonpin").length>0&&this._tabContents.width(this.element.width());var n={clickType:this._clickValue};this._clickValue==null&&(n={clickType:"click"});this._clickValue=null;this._trigger("expand",n)},collapse:function(){var t=this.element.find(".e-active-content").eq(0),i=this.element.find("#"+this._id+"_togglebutton");this._initialRender&&this.model.collapsible?t.hide():t.slideUp("fast","swing",n.proxy(this._ribCollapse,this));this.element.find("li.e-active").eq(0).removeClass("e-active").addClass("e-collapseactive e-select");t.addClass("e-collapse-content");this._selectedItemIndex=this._tabObj.model.selectedItemIndex;this._tabObj.option({selectedItemIndex:0});this._tabObj.model.selectedItemIndex=0;this.model.selectedItemIndex=0;i.removeClass("e-expanded").addClass("e-collapsed");this._isCollapsed=!0},expand:function(){var t=this.element.find(".e-active-content").eq(0),i;t.hasClass("e-rbn-ondemand")&&this._groupContent({activeIndex:this.model.selectedItemIndex+1});i=this.element.find("#"+this._id+"_togglebutton");t.slideDown("fast","swing",n.proxy(this._ribExpand,this));this.element.find(".e-collapseactive").addClass("e-active").removeClass("e-collapseactive");t.removeClass("e-collapse-content");this._tabObj.model.selectedItemIndex=this._selectedItemIndex;this.model.selectedItemIndex=this._selectedItemIndex;i.removeClass("e-collapsed").addClass("e-expanded");i.find("span").addClass("e-rarrowup-2x");this._phoneMode||(this._ribbonResize(),this._addRibbonPin())},_addRibbonPin:function(){if(this.element.find(".e-ribbonpinicon").length<=0){var t=this.element.find(".e-expandcollapse"),n=this.element.find(".e-rarrowup-2x");n.parent().removeClass("e-collapsed").addClass("e-expanded e-ribbonpin");n.removeClass("e-rarrowup-2x").addClass("e-ribbonpinicon");this._isCollapsed=!1}this._tabContents.css({position:"absolute"}).width(this.element.width());this.element.hasClass("e-grpdivhide")&&this._tabContents.css({position:""}).width(this.element.width());this.element.hasClass("e-grpdivhide")&&this.element.find(".e-ribbonpin").length>0&&this.model.showQAT&&this._qAccessBar.hasClass("e-rbnbelow")&&this.element.find(".e-rbnquickaccessbar").css({position:"absolute"})},_removeRibbonPin:function(){var n=this.element.find("#"+this._id+"_togglebutton");this._tabContents.css({position:"",width:""});n.removeClass("e-ribbonpin");n.find("span").removeClass("e-ribbonpinicon").addClass("e-rarrowup-2x")},_onRbnPinDivClick:function(){this._removeRibbonPin()},_onGroupExpandClick:function(n){this._trigger("groupExpand",n)},_onBackStageItemClick:function(i){var e,o,r,s,h,u,f,c,l;this._phoneMode&&this.element.find(".e-responsivebackstagecontent .e-backstageTitle").text(n(i.currentTarget).text());u=this.element.find(i.data.contentDivId);i.preventDefault();n(i.target).hasClass("e-backstagebutton")&&(this.element.find(".e-ribbonbackstagepage").hide(),this._phoneMode&&this.element.find(".e-responsivebackstage").is(":visible")&&this.element.find(".e-responsivebackstage").removeClass("e-backstageshowanimate"));this.element.find(".e-backstageactive-content").removeClass("e-backstageactive-content").hide();this.element.find(".e-backstageactive").removeClass("e-backstageactive");this.model.enableOnDemand&&u.children().length==0&&(f=this.model.applicationTab.backstageSettings,c=f.pages.length,this.model.enableOnDemand&&c>0&&(l=n(i.currentTarget).index()-n(i.currentTarget).prevAll(".e-backstageseparator").length,u.append(n("#"+f.pages[l].contentID).addClass("e-backstagetabarea").show())));this.element.find(i.data.contentDivId).addClass("e-backstageactive-content").show();n(i.target).hasClass("e-backstageli")?n(i.target).addClass("e-backstageactive"):n(i.target).parents(".e-backstageli").addClass("e-backstageactive");e=this.element.find(".e-ribbonbackstagetop").height();this.element.find(".e-backstagescrollcontent").ejScroller({height:0});h=this.model.applicationTab.backstageSettings.height;r=t.isNullOrUndefined(n(i.target).text())?n(i.target).children("a").text():n(i.target).text();o=t.isNullOrUndefined(n(i.target).attr("id"))?n(i.target).parent().attr("id"):n(i.target).attr("id");s={id:o,text:r,target:i.target,type:"backstageItemClick",cancel:!1};!this.element.find(i.data.contentDivId).children().hasClass("e-backstagetitlecontent")&&this.model.enableOnDemand?t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent").text(r).prependTo(u):this.model.enableOnDemand&&this.element.find(".e-backstagetitlecontent").text("").append(r);this._backStageHeightCalculate(h,e);n(i.target).parents(".e-backstageheader").length>0&&(n(i.target).find("a").length>0||i.target.localName=="a")&&this._phoneMode&&(this.element.find(".e-responsivebackstagecontent").show(),this.element.find(".e-responsivebackstage").removeClass("e-backstageshowanimate"));this._trigger("backstageItemClick",s)},_onBackStageTopIcon:function(){this.hideBackstage()},_backStageHeightCalculate:function(i,r){var u=this.model.applicationTab.backstageSettings.width;t.isNullOrUndefined(i)||(i.toString().endsWith("%")?i=this.element.find(".e-ribbonbackstagepage").height():i.toString().endsWith("px")&&(i=parseInt(i,10)),this.model.applicationTab.backstageSettings.height!="100%"&&(this.element.find(".e-backstageactive-content").height()>i-r?(this.element.find(".e-ribbonbackstagepage").height(i).width(u),this.element.find(".e-backstagescrollcontent").ejScroller({height:i-r,scroll:n.proxy(this._scroll,this)})):t.isNullOrUndefined(i)&&this.element.find(".e-backstageactive-content").height()>this.element.height()-r&&this.element.find(".e-backstagescrollcontent").ejScroller({height:this.element.height()-r,scroll:n.proxy(this._scroll,this)})));t.isNullOrUndefined(u)||(u.toString().endsWith("%")?u=this.element.find(".e-ribbonbackstagepage").width():u.toString().endsWith("px")&&(i=parseInt(u,10)),this.model.applicationTab.backstageSettings.width!="100%"&&(this.element.find(".e-backstageactive-content").width()>u-this.element.find(".e-backstageheader").width()?(this.element.find(".e-ribbonbackstagepage").height(i).width(u),this.element.find(".e-backstagescrollcontent").ejScroller({width:u})):t.isNullOrUndefined(u)&&this.element.find(".e-backstageactive-content").width()>this.element.width()&&this.element.find(".e-backstagescrollcontent").ejScroller({width:this.element.width()})));this._refreshBackstageScroller()},_refreshBackstageScroller:function(){var i=this;this.element.find(".e-backstagescrollcontent").find(".e-content").scroll(t.proxy(function(t){i.element.find(".e-backstagetopcontent").css({position:"relative",left:-n(t.currentTarget).scrollLeft()});i.element.find(".e-backstagetopicon").css({left:n(t.currentTarget).scrollLeft()+26})}))},_onApplicationTabClick:function(n){n.preventDefault();var t=this.element.find(".e-backstagecontent");this.model.enableOnDemand&&t.length==0&&this._createApplicationTab();t=this.element.find(".e-backstagecontent");this.showBackstage()},showBackstage:function(){var h,w,b,f,r,c,o,e,l,a=this.element.find(".e-backstagecontent"),y,s,u,i,p;if(this.model.enableOnDemand&&a.length==0&&this._createApplicationTab(),e=this.element.find(".e-ribbonbackstagebody"),l=this.element.find(".e-backstageheader"),f=this.model.applicationTab.backstageSettings.height,backStageWidth=this.model.applicationTab.backstageSettings.width,this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage){t.isNullOrUndefined(f)?(this.element.find(".e-ribbonbackstagepage").height(this.element.height()).width(this.element.width()),e.height(this.element.height()-92),l.height(this.element.height()-92)):(e.height(f-92),l.height(f-92));t.isNullOrUndefined(backStageWidth)?(this.element.find(".e-ribbonbackstagepage").height(this.element.height()).width(this.element.width()),e.width(this.element.width())):e.width(backStageWidth);this.element.css({position:"relative"});this.element.find(".e-ribbonbackstagepage").show();h=this.element.find(".e-backstageheader").width();this.element.find(".e-backstagetopcontent").width(h);this.element.find(".e-backstageheader").width(h);o=this.element.find(".e-backstageli");o.width(o.width());b=this.element.find(".e-ribbonbackstagetop").height();this.element.find(".e-backstageactive-content").removeClass("e-backstageactive-content").hide();this.element.find(".e-backstageactive").removeClass("e-backstageactive");o.first().addClass("e-backstageactive");this.element.find(".e-backstagecontent").first().addClass("e-backstageactive-content").show();this.element.find(".e-backstagescrollcontent").ejScroller({height:0,width:0});r=this.element.find(".e-backstageli").first();c=t.isNullOrUndefined(n(r).text())?n(r).children("a").text():n(r).text();var v=this.model.applicationTab.backstageSettings,k=v.pages.length,a=this.element.find(".e-backstagecontent");this._phoneMode||this.model.enableOnDemand&&k>0&&!t.isNullOrUndefined(v.pages[0].text)&&(y=n(".e-backstageactive-content").index()-1,s=n(a).filter(".e-backstageactive-content"),y!=-1&&n(s).append(n("#"+v.pages[y].contentID).addClass("e-backstagetabarea").show()),n(s).children().hasClass("e-backstagetitlecontent")||n(s).prepend(t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent")));this._backStageHeightCalculate(f,b);a=this.element.find(".e-backstagecontent");u=this.element.find(".e-responsivebackstage").removeClass("e-reshide");i=u.find(".e-backstageheader");this._phoneMode&&(this.element.find(".e-responsivetabheader").is(":visible")&&this.element.find(".e-responsivetabheader").removeClass("e-resshow"),u.children().length>0&&(p=parseInt(i.css("top")),this.element.parent(".e-js").length>0&&document.documentElement.clientHeight-u.find(".e-backstageheader").offset().top>this.element.parent(".e-js").height()?i.css({width:this.element.find(".e-header").outerWidth()/2,height:this.element.parent().height()}):i.css({width:this.element.find(".e-header").outerWidth()/2,height:document.documentElement.clientHeight-u.find(".e-backstageheader").offset().top}),i.offset().top!=p&&i.height(i.height()-p)),u.addClass("e-backstageshowanimate"),this.element.find(".e-backstageactive").removeClass("e-backstageactive"));w={id:n(r).attr("id"),text:c,target:n(r).children(),type:"backstageItemClick",cancel:!1};this.model.enableOnDemand&&this.element.find(".e-backstagetitlecontent").text("").append(c);this._trigger("backstageItemClick",w)}},hideBackstage:function(){this.element.find(".e-ribbonbackstagepage").hide();this._phoneMode&&this.goToMainContent()},_initPrivateProperties:function(){this._initialRender=!1;this._tabUl=this.element.find(".e-header");this._applicationTab=this.element.find(".e-apptab");this._ribbonTabs=this._tabUl.find(":not('a')");this._tabText=this.element.find(".e-link");this._id=this.element.attr("id");this._tabObj=this.element.data("ejTab");this._isCollapsed=!1;this._contextualTabSet="";this._resizeWidth=0;this._selectedItemIndex=0;this._clickValue=null;this._tabContents=this.element.children().attr("role","tabpanel").not(".e-header,.e-disable,.e-resizediv,.e-tooltipdiv,.e-ribbonbackstagepage");this._qatControlsName=[];this._qAccessBar=this.element.find(".e-rbnquickaccessbar");this._rbnToggleBtnAction=!0;this.localizedLabels=this._getLocalizedLabels();this._phoneMode=(this.model.allowResizing||this.model.isResponsive)&&document.documentElement.clientWidth<420?!0:!1;this._responsiveTarget=null;this._responsiveContent=null;this._responsiveContentStyle=null;this._responsiveGallery=null;this._mobileToolbar=[];this._mobileContents=[];this._responsiveTabText=null;this._responsiveHeight=document.documentElement.clientHeight*(parseInt("40%")/100);this._QATclick=!1},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_customization:function(){var f,r={},u,i=this;this._initial&&(this.model.contextualTabs.length>0&&this.model.contextualTabs[0].tabs.length>0&&this._contextualTabs(),f="<div id="+this._id+'_togglebutton class="e-expanded"><span class="e-icon e-rarrowup-2x"><\/span><\/div>',u=t.buildTag("li#"+this._id+"_expandCollapse.e-expandcollapse",f),this.element.find(".e-active-content").eq(0).append(u),r.expandObj=this.model.expandPinSettings,r.collapseObj=this.model.collapsePinSettings,u.mouseover({value:r,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)));this.model.enableOnDemand?this._createAppTabOnDemand():this._createApplicationTab();this.element.find(".e-content.e-content-item").on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){i.element.hasClass("e-responsive")&&(i.element.find(".e-ribupdivarrow .e-icon").hasClass("e-ribuparrow")?i._ribExpand(this):i.element.find(".e-ribupdivarrow .e-icon").hasClass("e-ribdownarrow")&&i._ribCollapse(this))})},_createAppTabOnDemand:function(){this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Menu?(this._applicationTab.find(".e-link").hide(),this.model.applicationTab.menuSettings&&(model=this.model.applicationTab.menuSettings),this.model.applicationTab.menuItemID&&(n("#"+this.model.applicationTab.menuItemID).appendTo(this._applicationTab),model.enableRTL=this.model.enableRTL,model.isResponsive=!1,n("#"+this.model.applicationTab.menuItemID).addClass("e-rbncustomelement").ejMenu(model)),n("#"+this._id+"_"+this.model.applicationTab.type.replace(/\s/g,"")).hide()):this._applicationTab.find(".e-link").text(this.model.applicationTab.backstageSettings.text);this._applicationTab.click(n.proxy(this._onApplicationTabClick,this));this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&this._applicationTab.find("a").addClass("e-apptabanchor")},_createApplicationTab:function(){var e=this.element.find(".e-ribbonbackstagepage"),s=this.element.find(".e-backstageheader"),l,a,w,b,h=this.element.find(".e-ribbonbackstagebody"),k=this.element.find(".e-backstagetopcontent"),rt,v,r,nt,f,c,y,u,p,d,g,o,tt,i,it;if(r=this.model.applicationTab.backstageSettings,nt=r.pages.length,this.model.applicationTab.type!==t.Ribbon.ApplicationTabType.Menu||this.model.enableOnDemand?this._applicationTab.find(".e-link").text(this.model.applicationTab.backstageSettings.text):(this._applicationTab.find(".e-link").hide(),this.model.applicationTab.menuSettings&&(model=this.model.applicationTab.menuSettings),this.model.applicationTab.menuItemID&&(n("#"+this.model.applicationTab.menuItemID).appendTo(this._applicationTab),model.enableRTL=this.model.enableRTL,model.isResponsive=!1,n("#"+this.model.applicationTab.menuItemID).addClass("e-rbncustomelement").ejMenu(model)),n("#"+this._id+"_"+this.model.applicationTab.type.replace(/\s/g,"")).hide()),this._applicationTab.click(n.proxy(this._onApplicationTabClick,this)),this.element.find(".e-content.e-content-item").css("box-sizing","content-box"),this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage){for(f=this.model.applicationTab.backstageSettings.height,f.toString().endsWith("%")?f=n(document).height()*(parseInt(f.slice(0,-1),10)/100):f.toString().endsWith("px")&&(f=parseInt(f,10)),e.length==0&&(e=t.buildTag("div#"+this._id+"_BackStage").addClass("e-ribbonbackstagepage"),h=t.buildTag("div#"+this._id+"_BackStageBody").addClass("e-ribbonbackstagebody"),s=t.buildTag("ul#"+this._id+"_BackStageHeader").addClass("e-backstageheader")),e.height(f).width(this.model.applicationTab.backstageSettings.width).hide(),h.height(f-50),s.height(f-50),i=0;i<nt;i++)c=this.element.find("#"+r.pages[i].id+"_backStageTab"),y=this.element.find("#"+r.pages[i].id+"_backStageBtn"),t.isNullOrUndefined(r.pages[i].itemType)&&(r.pages[i].itemType=t.Ribbon.ItemType.Tab),r.pages[i].itemType==t.Ribbon.ItemType.Button&&(c=this.element.find("#"+r.pages[i].id+"_backStageBtn"),y=this.element.find("#"+r.pages[i].id+"_backStageTab")),this.element.find(".e-ribbonbackstagepage").length==0||c.length==0&&y.length==0?(l=t.buildTag("li").addClass("e-backstageli").attr("tabindex",0).click({contentDivId:"#"+this._id+"_BackStage_"+r.pages[i].id.replace(/\s/g,""),height:r.height},n.proxy(this._onBackStageItemClick,this)),r.pages[i].itemType==t.Ribbon.ItemType.Tab?(a=t.buildTag("a",r.pages[i].text,{},{href:"#"+this._id+"_BackStage_"+r.pages[i].id.replace(/\s/g,"")}).focus(function(){n(this).parents(".e-backstageli").addClass("e-bsmaterial-focus")}).focusout(function(){n(this).parents(".e-backstageli").removeClass("e-bsmaterial-focus")}),l.append(a).attr("id",r.pages[i].id+"_backStageTab")):l.append(r.pages[i].text).addClass("e-backstagebutton").attr("id",r.pages[i].id+"_backStageBtn"),s.append(l),r.pages[i].enableSeparator&&(v=t.buildTag("li").addClass("e-backstageseparator"),s.append(v)),r.pages[i].itemType==t.Ribbon.ItemType.Tab&&this._addBackStageTabCont(r,h,i)):(u=y,c.length>0&&(u=c),r.pages[i].itemType==t.Ribbon.ItemType.Button?(u.find("a").length>0&&(this._removeBackStageTabCont(this.element.find(u.find("a").attr("href"))),u.attr("id",r.pages[i].id+"_backStageBtn").addClass("e-backstagebutton"),u.find("a").remove()),u.text(r.pages[i].text)):(u.hasClass("e-backstagebutton")&&(a=t.buildTag("a",r.pages[i].text,{},{href:"#"+this._id+"_BackStage_"+r.pages[i].id.replace(/\s/g,"")}).focus(function(){n(this).parents(".e-backstageli").addClass("e-bsmaterial-focus")}).focusout(function(){n(this).parents(".e-backstageli").removeClass("e-bsmaterial-focus")}),u.append(a).attr("id",r.pages[i].id+"_backStageTab").removeClass("e-backstagebutton"),this._addBackStageTabCont(r,h,i)),u.find("a").text(r.pages[i].text),p=this.element.find(u.find("a").attr("href")),r.pages[i].contentID!=p.find(".e-backstagetabarea").attr("id")&&(p.find(".e-backstagetabarea").removeClass("e-backstagetabarea").appendTo("body"),p.append(n("#"+r.pages[i].contentID).addClass("e-backstagetabarea")))),r.pages[i].enableSeparator?u.next().length>0&&!u.next().hasClass("e-backstageseparator")&&(v=t.buildTag("li").addClass("e-backstageseparator"),u.after(v)):u.next().length>0&&u.next().hasClass("e-backstageseparator")&&u.next().remove());if(this.element.find(".e-ribbonbackstagepage").length==0)h.prepend(s),b=t.buildTag("div#"+this._id+"_BackStageTop").addClass("e-ribbonbackstagetop").height(92),k=t.buildTag("div#"+this._id+"_BackStageTopContent").addClass("e-backstagetopcontent").appendTo(b),rt=t.buildTag("div#"+this._id+"_BackStageTopIcon","<div class='e-ribbonbackicon'><span><\/span><\/div>").addClass("e-backstagetopicon").click(n.proxy(this._onBackStageTopIcon,this)).appendTo(k),e.append(b),w=t.buildTag("div#"+this._id+"_backStageScrollContent","<div><\/div>").addClass("e-backstagescrollcontent"),w.children().append(h),e.append(w),this._applicationTab.addClass("e-backstagetab"),this._applicationTab.find("a").addClass("e-apptabanchor"),this.element.find(".e-ribbonbackstagepage").length>0&&this.element.find(".e-ribbonbackstagepage").remove(),this.element.append(e),d=this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent"),e.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this._phoneMode&&(d.children().remove(),d.append(e.find(".e-ribbonbackstagebody .e-backstagecontent")));else{for(g=[],i=0;i<this.model.applicationTab.backstageSettings.pages.length;i++)g.push(this.model.applicationTab.backstageSettings.pages[i].id);for(i=0;i<this.element.find(".e-backstageli").length;i++)o=this.element.find(".e-backstageli").eq(i),tt=o.attr("id").split("_")[0],n.inArray(tt,g)<0&&(o.find("a").length>0&&this._removeBackStageTabCont(this.element.find(o.find("a").attr("href"))),o.next().length>0&&o.next().hasClass("e-backstageseparator")&&o.next().remove(),o.remove(),--i);for(i=0;i<r.pages.length;i++)this._checkBackstageTabOrder(r.pages[i],i)}t.isNullOrUndefined(r.headerWidth)||(k.css("width",r.headerWidth),s.css("width",r.headerWidth))}this.model.enableOnDemand&&this._phoneMode&&(backstage=this.element.find(".e-responsivebackstage"),backstagePage=this.element.find(".e-ribbonbackstagepage"),this._tabUl.find(".e-backstagetab").length>0&&backstage.length==1&&(it=backstagePage.find(".e-ribbonbackstagebody .e-backstageheader"),backstage.append(it).addClass("e-reshide")))},_addBackStageTabCont:function(i,r,u){var f=t.buildTag("div#"+this._id+"_BackStage_"+i.pages[u].id.replace(/\s/g,"")).addClass("e-backstagecontent").css({width:"auto"});u>0&&f.hide();i.pages[u].contentID&&!this.model.enableOnDemand&&(backStageTitleContent=t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent").appendTo(n(f)),n(backStageTitleContent).text("").append(i.pages[u].text),n(f).append(n("#"+i.pages[u].contentID).addClass("e-backstagetabarea").show()));r.append(f)},_removeBackStageTabCont:function(n){n.find(".e-backstagetabarea").removeClass("e-backstagetabarea").appendTo("body");n.remove()},_conTabsRemove:function(){for(var r=this.element.find(".e-contextli,.e-contextliset"),t,u=r.length,i=0;i<u;i++)t=n(r[i]),t.is(":visible")?t.find("li").insertAfter(t.eq(0)):t.find("li").hide().insertAfter(t.eq(0)),t.remove()},_contextualTabs:function(){var i,f,e,o,r,s,u;if(this.model.contextualTabs)for(o=this.model.contextualTabs.length,r=0;r<o;r++)if(i=this.model.contextualTabs[r],i.tabs.length>0){for(f=t.buildTag("li#e-contextlisetIn_"+r).addClass("e-contextliset"),this._contextualTabSet=this._tabUl.children(".e-contextualtabset").filter(function(){return n(this).text()===i.tabs[0].text}),this._contextualTabSet.before(f),this._tabUl.children(".e-contextualtabset").find("a").css("color",i.borderColor),e=t.buildTag("ul.e-contextual","",{background:i.backgroundColor,"border-top-color":i.borderColor}),s=i.tabs.length,u=0;u<s;u++)e.append(this._tabUl.children(".e-contextualtabset").filter(function(){return n(this).text()===i.tabs[u].text}));e.appendTo(f)}},addBackStageItem:function(n,i){var r=this.model.applicationTab.backstageSettings.pages.length;t.isNullOrUndefined(i)||(r=i);this.model.applicationTab.backstageSettings.pages.splice(r,0,n);this._initial=!1;this._customization();this._phoneMode&&(backstagePage=this.element.find(".e-ribbonbackstagepage"),backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").append(backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent")))},_checkBackstageTabOrder:function(n,t){var i=this.element.find("#"+n.id+"_backStageTab"),r;i.length==0&&(i=this.element.find("#"+n.id+"_backStageBtn"));i.index()!=t&&(r=this.element.find(".e-backstageli").eq(t),n.enableSeparator&&i.next().hasClass("e-backstageseparator")&&(r=i.next().insertBefore(r)),i.insertBefore(r),this.element.find("#"+this._id+"_BackStage_"+n.id).insertBefore(this.element.find(".e-backstagecontent").eq(t)))},removeBackStageItem:function(t){var r,i;r=this.model.applicationTab.backstageSettings.pages[t].id;i="#"+this._id+"_BackStage_"+r;this.model.applicationTab.backstageSettings.pages.splice(t,1);this.element.find(i).hasClass("e-backstagecontent")&&this.element.find(i).remove();n(this.element.find(".e-backstageli")[t]).remove();this.hideBackstage()},updateBackStageItem:function(t,i){n.extend(this.model.applicationTab.backstageSettings.pages[t],i);this._initial=!1;this._customization();this._phoneMode&&(backstagePage=this.element.find(".e-ribbonbackstagepage"),backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").append(backstagePage.find(".e-ribbonbackstagebody .e-backstagecontent")))},showContextualTab:function(t){this.element.find(".e-contexttitle").filter(function(){return n(this).text()===t}).parent().parent().show()},hideContextualTab:function(t){this.element.find(".e-contexttitle").filter(function(){return n(this).text()===t}).parent().parent().hide();this._tabObj.option({selectedItemIndex:this._tabObj.model.selectedItemIndex+1})},_createQAT:function(){if(this.model.showQAT&&(!t.isNullOrUndefined(this.model.qatItems)||this.element.find(".e-rbnquickaccessbar").children().length==0)){if(this.model.enableOnDemand&&(t.isNullOrUndefined(this.model.tabs)||this._createCollapseQuickaccess(this.model.tabs),!t.isNullOrUndefined(this.model.contextualTabs)))for(var n=0;n<this.model.contextualTabs.length;n++)this._createCollapseQuickaccess(this.model.contextualTabs[n].tabs);this.model.showQAT&&!t.isNullOrUndefined(this.model.qatItems)&&this._createCollapseQuickaccess()}this._createQuickAccessBar()},_createCollapseQuickaccess:function(n){var i,r,u,f,e;if(t.isNullOrUndefined(n)||t.isNullOrUndefined(this.model.qatItems)&&this.element.find(".e-rbnquickaccessbar").children().length!=0)this._createqatItems(this.model.qatItems);else for(i=0;i<n.length;i++)if(!t.isNullOrUndefined(n[i].groups))for(r=0;r<n[i].groups.length;r++)if(!t.isNullOrUndefined(n[i].groups[r].content))for(u=0;u<n[i].groups[r].content.length;u++)f=n[i].groups[r].content[u].groups,e=n[i].groups[r].content[u].defaults,n[i].groups[r].content[u].defaults,this._createqatItems(f,e)},_createqatItems:function(i,r){var c,l,u,f,a,v,o,s,e,h;for(this.model.showQAT&&(!t.isNullOrUndefined(this.model.qatItems)||this.element.find(".e-rbnquickaccessbar").children().length==0)&&(c=t.buildTag("div#"+this._id+"order")),l=[],u=0;u<i.length;u++)if(!t.isNullOrUndefined(i[u])){t.isNullOrUndefined(r)||t.isNullOrUndefined(r.type)||(i[u].type=r.type);t.isNullOrUndefined(i[u].type)&&(i[u].type=t.Ribbon.Type.Button);t.isNullOrUndefined(i[u].isBig)&&!t.isNullOrUndefined(r)&&(i[u].isBig=r.isBig);f=this.model.buttonDefaults;t.isNullOrUndefined(i[u].height)&&(t.isNullOrUndefined(i[u].buttonSettings)||t.isNullOrUndefined(i[u].buttonSettings.height)?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.height)?t.isNullOrUndefined(f)||t.isNullOrUndefined(f.height)||(a=f.height):a=r.height:a=i[u].buttonSettings.height,i[u].height=a,a=null);t.isNullOrUndefined(i[u].width)&&(t.isNullOrUndefined(i[u].buttonSettings)||t.isNullOrUndefined(i[u].buttonSettings.width)?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.width)?t.isNullOrUndefined(f)||t.isNullOrUndefined(f.width)||(v=f.width):v=r.width:v=i[u].buttonSettings.width,i[u].width=v,v=null);t.isNullOrUndefined(i[u].buttonSettings)||(o=i[u].buttonSettings,!t.isNullOrUndefined(o.enabled)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enabled)||(o.enabled=f.enabled),!t.isNullOrUndefined(o.enableRTL)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enableRTL)||(o.enableRTL=f.enableRTL),!t.isNullOrUndefined(o.cssClass)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cssClass)||(o.cssClass=f.cssClass),!t.isNullOrUndefined(o.showRoundedCorner)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.showRoundedCorner)||(o.showRoundedCorner=f.showRoundedCorner));t.isNullOrUndefined(i[u].splitButtonSettings)||(s=i[u].splitButtonSettings,!t.isNullOrUndefined(s.enabled)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enabled)||(s.enabled=f.enabled),!t.isNullOrUndefined(s.enableRTL)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enableRTL)||(s.enableRTL=f.enableRTL),!t.isNullOrUndefined(s.cssClass)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cssClass)||(s.cssClass=f.cssClass),!t.isNullOrUndefined(s.showRoundedCorner)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.showRoundedCorner)||(s.showRoundedCorner=f.showRoundedCorner));t.isNullOrUndefined(i[u].toggleButtonSettings)||(!t.isNullOrUndefined(i[u].toggleButtonSettings.enabled)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enabled)||(i[u].toggleButtonSettings.enabled=f.enabled),!t.isNullOrUndefined(i[u].toggleButtonSettings.enableRTL)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.enableRTL)||(i[u].toggleButtonSettings.enableRTL=f.enableRTL),!t.isNullOrUndefined(i[u].toggleButtonSettings.cssClass)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cssClass)||(i[u].toggleButtonSettings.cssClass=f.cssClass),!t.isNullOrUndefined(i[u].toggleButtonSettings.showRoundedCorner)||t.isNullOrUndefined(f)||t.isNullOrUndefined(f.showRoundedCorner)||(i[u].toggleButtonSettings.showRoundedCorner=f.showRoundedCorner));t.isNullOrUndefined(i[u].quickAccessMode)&&(i[u].quickAccessMode="none");switch(i[u].type){case t.Ribbon.Type.SplitButton:split=i[u];model={};split.splitButtonSettings&&(model=JSON.parse(JSON.stringify(split.splitButtonSettings)));model.height=t.isNullOrUndefined(model.height)?i[u].height:model.height;model.width=t.isNullOrUndefined(model.width)?i[u].width:model.width;model.cssClass=model.cssClass?model.cssClass.concat(" e-rbn-splitbtn e-rbn-button"):"e-rbn-splitbtn e-rbn-button";model.enableRTL=this.model.enableRTL;split.quickAccessMode!="none"&&this.model.showQAT&&(this._splitButtonQAT=t.buildTag("button#"+this._id+"_"+split.id+"_qatEle",split.text,{},{type:"button"}).addClass(split.cssClass),e=t.buildTag("div#"+this._id+"_"+split.id+"_qatDiv",this._splitButtonQAT).addClass("e-qatooldiv"),c.append(e),model.height=30,model.arrowPosition=t.ArrowPosition.Right,model.contentType=t.ContentType.ImageOnly,n.isEmptyObject(split.customToolTip)?t.isNullOrUndefined(split.toolTip)||e.attr("title",split.toolTip):e.mouseover({value:split,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._splitButtonQAT.ejSplitButton(model),split.quickAccessMode=="menu"&&e.hide(),t.isNullOrUndefined(split.text)?t.isNullOrUndefined(split.splitButtonSettings.text)||(h=split.splitButtonSettings.text):h=split.text,l.push({id:split.id,text:h,qAccess:split.quickAccessMode}));break;case t.Ribbon.Type.ToggleButton:toggle=i[u];model={};toggle.toggleButtonSettings&&(model=JSON.parse(JSON.stringify(toggle.toggleButtonSettings)));model.height=t.isNullOrUndefined(model.height)?i[u].height:model.height;model.width=t.isNullOrUndefined(model.width)?i[u].width:model.width;toggle.quickAccessMode!="none"&&this.model.showQAT&&(this._toggleButtonQAT=t.buildTag("input#"+this._id+"_"+toggle.id+"_qatEle","","",{type:"checkbox"}).addClass(toggle.cssClass),e=t.buildTag("div#"+this._id+"_"+toggle.id+"_qatDiv",this._toggleButtonQAT).addClass("e-qatooldiv e-rbn-button"),model.height=30,model.contentType=t.ContentType.ImageOnly,n.isEmptyObject(toggle.customToolTip)?t.isNullOrUndefined(toggle.toolTip)||e.attr("title",toggle.toolTip):e.mouseover({value:toggle,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._toggleButtonQAT.ejToggleButton(model).addClass("e-ribbonbtn"),e.find("button").addClass("e-rbn-button"),c.append(e),toggle.quickAccessMode=="menu"&&e.hide(),t.isNullOrUndefined(toggle.text)?t.isNullOrUndefined(toggle.toggleButtonSettings.defaultText)||(h=toggle.toggleButtonSettings.defaultText):h=toggle.text,l.push({id:toggle.id,text:h,qAccess:toggle.quickAccessMode}));break;case t.Ribbon.Type.Button:button=i[u];model={};button.buttonSettings&&(model=JSON.parse(JSON.stringify(button.buttonSettings)));model.height=t.isNullOrUndefined(model.height)?i[u].height:model.height;model.width=t.isNullOrUndefined(model.width)?i[u].width:model.width;button.quickAccessMode!="none"&&this.model.showQAT&&(this._buttonQAT=button.buttonSettings?button.buttonSettings.type?t.buildTag("button#"+this._id+"_"+button.id+"_qatEle",button.text,{},{type:button.buttonSettings.type}).addClass(button.cssClass):t.buildTag("button#"+this._id+"_"+button.id+"_qatEle",button.text).addClass(button.cssClass):t.buildTag("button#"+this._id+"_"+button.id+"_qatEle",button.text).addClass(button.cssClass),e=t.buildTag("div#"+this._id+"_"+button.id+"_qatDiv",this._buttonQAT).addClass("e-qatooldiv"),model.height=30,model.contentType=t.ContentType.ImageOnly,n.isEmptyObject(button.customToolTip)?t.isNullOrUndefined(button.toolTip)||e.attr("title",button.toolTip):e.mouseover({value:button,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._buttonQAT.ejButton(model).addClass("e-ribbonbtn e-rbn-button"),c.append(e),button.quickAccessMode=="menu"&&e.hide(),t.isNullOrUndefined(button.text)?t.isNullOrUndefined(button.buttonSettings.text)||(h=button.buttonSettings.text):h=button.text,l.push({id:button.id,text:h,qAccess:button.quickAccessMode}))}}c.children().prependTo(this._qAccessBar);this._qatControlsName=n.merge(l,this._qatControlsName)},_resizeTabName:function(i){var r,u,f;if(!t.isNullOrUndefined(this.model.tabs))for(r=0;r<this.model.tabs.length;r++)if(this.model.tabs[r].text===i)return n(this._tabUl.find(".e-tab")[r]);if(!t.isNullOrUndefined(this.model.contextualTabs))for(r=0;r<this.model.contextualTabs.length;r++)for(u=0;u<this.model.contextualTabs[r].tabs.length;u++)if(this.model.contextualTabs[r].tabs[u].text===i)return n(this._tabUl.find(".e-contextliset")[r]).children().find(".e-contextualtabset").eq(u)},hideTab:function(i){var u=this._tabText.map(function(t){if(n(this).text()===i)return t})[0],r,l=this._tabObj.model.disabledItemIndex.length,c=!0,h,f,e,o,s;for(this._width=this.element.width(),t.isNullOrUndefined(u)&&(f=this._resizeTabName(i),this._phoneMode&&(f=this._responsiveTabText.filter(function(){return n(this).text()===i}),this.element.find(".e-responsivetabheader").addClass("e-resshow")),t.isNullOrUndefined(f)||f.hide()),e=this.element.find(".e-link").eq(u).attr("href"),h=this._tabText.filter(function(){return n(this).text()===i}).parents(".e-contextualtabset"),o=0;o<l;o++)this._tabObj.model.disabledItemIndex[o]===u&&(c=!1);c&&(h.length>0?(h.hide(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?u:u-1).hide()):(this._tabText.filter(function(){return n(this).text()===i}).parent().hide(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?u:u-1).hide()),n(e).hasClass("e-active-content")&&(n(e).hide(),n(e).removeClass("e-active-content")));this._tabUl.find(".e-active").is(":hidden")&&(this._phoneMode?(this.element.find(".e-responsivetabheader").addClass("e-resshow"),r=this._getVisibleItemIndex(this._responsiveTabText)):r=this._getVisibleItemIndex(this._tabText),r&&(s=this.element.find(".e-link").eq(r).attr("href"),n(this._tabText[r]).parent().hasClass("e-disable")?(n(this._tabText[u]).parent().removeClass("e-active"),n(this._tabText[r]).parent().addClass("e-active"),n(s).append(this.element.find("#"+this._id+"_disabled")),n(s).css("position","relative"),this.element.find("#"+this._id+"_disabled").show(),n(s).show(),this._tabObj.option("selectedItemIndex",r)):this._tabObj.option("selectedItemIndex",r),this._tabObj.model.selectedItemIndex=r,this.model.selectedItemIndex=r));this.element.hasClass("e-responsive")&&this.element.find(".e-responsivetabheader").removeClass("e-resshow")},showTab:function(i){var r=this._tabText.map(function(t){if(n(this).text()===i)return t})[0],f,u,e,o;t.isNullOrUndefined(r)&&(u=this._resizeTabName(i),this._phoneMode&&(u=this._responsiveTabText.filter(function(){return n(this).text()===i}),this.element.find(".e-responsivetabheader").addClass("e-resshow")),t.isNullOrUndefined(u)||u.show());e=this._tabText.filter(function(){return n(this).text()===i}).parent();f=this._tabText.filter(function(){return n(this).text()===i}).parents(".e-contextualtabset");f.length>0?(f.show(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?r:r-1).show()):(this._tabText.filter(function(){return n(this).text()===i}).parent().show(),this._responsiveTabText.eq(t.isNullOrUndefined(this.model.applicationTab)?r:r-1).show());o=this.element.find(".e-content").eq(r);e.hasClass("e-active")?o.css("display")=="none"&&o.show():e.addClass("e-select");this.element.hasClass("e-responsive")&&this.element.find(".e-responsivetabheader").removeClass("e-resshow")},hideGroups:function(t,i){if(typeof i=="string")n("#"+this._id+"_"+t+"_"+i).hide();else for(var r=0;r<i.length;r++)n("#"+this._id+"_"+t+"_"+i[r]).hide()},showGroups:function(t,i){if(typeof i=="string")n("#"+this._id+"_"+t+"_"+i).show();else for(var r=0;r<i.length;r++)n("#"+this._id+"_"+t+"_"+i[r]).show()},hideGroupItems:function(t,i,r){if(typeof r=="string")n("#"+this._id+"_"+t+"_"+i+"_"+r).hide();else for(var u=0;u<r.length;u++)n("#"+this._id+"_"+t+"_"+i+"_"+r[u]).hide()},showGroupItems:function(t,i,r){if(typeof r=="string")n("#"+this._id+"_"+t+"_"+i+"_"+r).show();else for(var u=0;u<r.length;u++)n("#"+this._id+"_"+t+"_"+i+"_"+r[u]).show()},_getVisibleItemIndex:function(t){for(var i=1;i<t.length;){if(n(t[i]).is(":visible"))return i;i++}},removeApplicationTab:function(){if(this._ribbonTabs=this._tabUl.find(".e-link").parent(),href=this._ribbonTabs.eq(0).children().attr("href"),curTab=this._ribbonTabs.eq(0),curTab.hasClass("e-apptab")){this._tabObj.contentPanels.splice(0,1);this._tabObj.items.splice(0,1);this._tabObj.selectedItemIndex(this._tabObj.model.selectedItemIndex-1);curTab.remove();n(href).remove();n(this._tabUl.find(".e-link").parent(".e-active")).find("a").addClass("e-removeapptab");var t=this._tabUl.find("li").eq(0);t.hasClass("e-disable")||t.hasClass("e-apptab")||(this._tabObj.option({enabledItemIndex:[0]}),this.model.disabledItemIndex.splice(0));this.element.addClass("e-ribwithout-apptab");this._ribbonWindowResize()}},removeTab:function(t){var i,r,u,f;this._tabObj.model&&t>0&&(u={index:t},this._trigger("beforeTabRemove",u),this._ribbonTabs=this._tabUl.find(".e-link").parent(),r=this._ribbonTabs.eq(t).children().attr("href"),i=this._ribbonTabs.eq(t),this._phoneMode&&(curResTab=this._responsiveTabText.eq(t-1)),i.hasClass("e-contextualtab")?i.parent().remove():i.hasClass("e-contextualtabset")?i.siblings(".e-contextualtabset").length===0?i.parent().remove():i.remove():i.remove(),this._phoneMode&&curResTab.remove(),this._responsiveTabText=this.element.find(".e-responsivetabheader li"),f=this.element.find(".e-expandcollapse"),n(r).remove(),this._ribbonTabs=this._tabUl.find(".e-link").parent(),this._tabObj.model.selectedItemIndex===t&&(i=this._ribbonTabs.eq(t),this._phoneMode&&(curResTab=this._responsiveTabText.eq(t-1),curResTab.addClass("e-resactive"),this.element.find(".e-ribresmenu .e-reslink").text(this._responsiveTabText.filter(".e-resactive").text())),i.addClass("e-active"),r=i.children().attr("href"),n(r).append(f.click(n.proxy(this._tabExpandCollapse,this))),n(r).addClass("e-active-content e-activetop").show()),this._isCollapsed&&this.element.find(this._ribbonTabs.eq(t).children().attr("href")).append(f.click(n.proxy(this._tabExpandCollapse,this))),this._tabObj.contentPanels.splice(t,1),this._tabObj.items.splice(t,1),this.model.tabs.splice(t-1,1),this._phoneMode&&(this._mobileContents.splice(t-1,1),this._mobileToolbar.splice(t-1,1),this._ribbonWindowResize()),u={removedIndex:t},this._trigger("tabRemove",u))},removeTabGroup:function(i,r){var e,l,o,c,s,y,u,a,h,v,f;if(e=n(n(".e-ribbon .e-content")[i]).find(".e-groupdiv"),l=this._tabUl.find(".e-select,.e-active").eq(i),n(l).hasClass("e-tab"))for(o=this.model.tabs[i-1].groups,u=0;u<o.length;u++)o[u].text==r?(o.splice(u,1),n(e[u]).remove()):t.isNullOrUndefined(r)&&n(e[u]).remove();else for(c=this.model.tabs.length,y=this.model.contextualTabs.length,u=0;u<this.model.contextualTabs.length;u++)for(a=this.model.contextualTabs[u].tabs.length,h=0;h<a;h++)if(++c,c===i)for(s=this.model.contextualTabs[u].tabs[h].groups,v=s.length,f=0;f<v;f++)s[f].text==r?(s.splice(f,1),n(e[f]).remove()):t.isNullOrUndefined(r)&&n(e[f]).remove()},_addTabGrpIntoCollec:function(t,i,r){var e=i.length,o=r,u,f;for(n.isPlainObject(i)&&(e=1),u=0;u<e;u++)f=i,n.isPlainObject(i)||(f=i[u],u>0&&++o),t.groups.splice(o,0,f);return t},addTabGroup:function(i,r,u){var s,a=0,c=0,o,v,y,b,p,k,d,f,g,h,w,e,l;if(v=this._tabUl.find(".e-select,.e-active").eq(i),s=v.children("a").attr("href"),n(v).hasClass("e-tab"))for(k=this.model.tabs.length,f=0;f<k;f++)f===i-1&&(c=this.model.tabs[f].groups.length,t.isNullOrUndefined(u)&&(u=c),o=this._addTabGrpIntoCollec(this.model.tabs[f],r,u));else for(a=this.model.tabs.length,d=this.model.contextualTabs.length,f=0;f<d;f++)for(g=this.model.contextualTabs[f].tabs.length,h=0;h<g;h++)++a,a===i&&(c=this.model.contextualTabs[f].tabs[h].groups.length,t.isNullOrUndefined(u)&&(u=c),o=this._addTabGrpIntoCollec(this.model.contextualTabs[f].tabs[h],r,u));if(!t.isNullOrUndefined(o.groups[u])&&!this.element.find(".e-content.e-content-item").eq(i).hasClass("e-rbn-ondemand")){for(w=r.length,e=u,n.isPlainObject(r)&&(w=1),l=0;l<w;l++)!n.isPlainObject(r)&&l>0&&++e,y=t.isNullOrUndefined(o.groups[e].id)?t.isNullOrUndefined(o.groups[e].text)?o.groups[e].text:o.groups[e].text.replace(/\s/g,""):o.groups[e].id.replace(/\s/g,""),b=this._createControls(e,o,y,i),p=this._addControlsToGroup(e,o,y,b),n(s).children().eq(e).length>0?n(s).children().eq(e).before(p):n(s).append(p);n(s).hasClass("e-empty-content")&&n(s).removeClass("e-empty-content")}n(s).hasClass("e-parentdiv")||n(s).addClass("e-parentdiv");this._setTabContentHeight()},addTabGroupContent:function(i,r,u,f,e){var l,p=0,s,w,v,y,b,c,k,a,d,g,nt=!1,tt,it,rt,o,ut,h,ft;if(w=this._tabUl.find(".e-select,.e-active").eq(i),l=w.children("a").attr("href"),t.isNullOrUndefined(f)&&(f=0),t.isNullOrUndefined(e)&&(e=0),w.hasClass("e-tab"))for(it=this.model.tabs.length,o=0;o<it;o++)o===i-1&&(t.isNullOrUndefined(this.model.tabs[o].groups[r].content)||(g=this.model.tabs[o].groups[r].alignType,f!=0&&t.isNullOrUndefined(this.model.tabs[o].groups[r].content[f-1])||(t.isNullOrUndefined(this.model.tabs[o].groups[r].content[f])?(this.model.tabs[o].groups[r].content[f]=u,nt=!0):this.model.tabs[o].groups[r].content[f].groups.splice(e,0,u),s=this.model.tabs[o])));else for(p=this.model.tabs.length,rt=this.model.contextualTabs.length,o=0;o<rt;o++)for(ut=this.model.contextualTabs[o].tabs.length,h=0;h<ut;h++)++p,p===i&&(t.isNullOrUndefined(this.model.contextualTabs[o].tabs[h].groups[r].content)||(g=this.model.contextualTabs[o].tabs[h].groups[r].alignType,t.isNullOrUndefined(f)&&(f=this.model.contextualTabs[o].tabs[h].groups[r].content[0].groups.length),f!=0&&t.isNullOrUndefined(this.model.contextualTabs[o].tabs[h].groups[r].content[f-1])||(t.isNullOrUndefined(this.model.contextualTabs[o].tabs[h].groups[r].content[f])?(this.model.contextualTabs[o].tabs[h].groups[r].content[f]=u,nt=!0):this.model.contextualTabs[o].tabs[h].groups[r].content[f].groups.splice(e,0,u),s=this.model.contextualTabs[o].tabs[h])));t.isNullOrUndefined(s)||t.isNullOrUndefined(s.groups[r])||this.element.find(".e-content.e-content-item").eq(i).hasClass("e-rbn-ondemand")||(v=t.isNullOrUndefined(s.groups[r].id)?t.isNullOrUndefined(s.groups[r].text)?s.groups[r].text:s.groups[r].text.replace(/\s/g,""):s.groups[r].id.replace(/\s/g,""),y=this._createControls(r,s,v,i),a=t.buildTag("div"),tt=y.find(".e-innerdiv,.e-innerdivrow").eq(f).find(".e-controlpadding"),b=nt?tt:tt.eq(e),k=y.find("#"+b.attr("id")).next(),k.hasClass("e-separatordivrow")&&a.append(k),a.prepend(b),c=n(l).children().eq(r).find(".e-innerdiv,.e-innerdivrow").eq(f),!c.length>0&&(ft=g==t.Ribbon.alignType.columns?t.buildTag("div#"+this._id+"_"+s.id+"_"+v+"_"+(f+1)).addClass("e-innerdiv"):t.buildTag("div#"+this._id+"_"+s.id+"_"+v+"_"+(f+1)).addClass("e-innerdivrow"),n(l).children().eq(r).find(".e-ribGroupContent").append(ft),c=n(l).children().eq(r).find(".e-innerdiv,.e-innerdivrow").eq(f)),d=n(c).parent().height(),c.find(".e-controlpadding").eq(e).length>0?c.find(".e-controlpadding").eq(e).before(a.children()):c.append(a.children()),n(c).parent().height()>d&&this.element.find(".e-content").height(this.element.find(".e-content").height()+(n(c).parent().height()-d)),y.children().remove(),n(l).hasClass("e-empty-content")&&n(l).removeClass("e-empty-content"),this._setTabContentHeight())},removeTabGroupContent:function(i,r,u,f){var nt,p,c,w,s,a,y,e,b,k,o,d,v,g,h,l;if(nt=n(n(".e-ribbon .e-content")[i]).find(".e-groupdiv"),p=this._tabUl.find(".e-select,.e-active").eq(i),a=p.children("a").attr("href"),n(p).hasClass("e-tab")){for(c=this.model.tabs[i-1].groups,b=c.length,o=0;o<b;o++)if(c[o].text==r)if(t.isNullOrUndefined(u)){if(c[o].type===t.Ribbon.type.custom&&c[o].text==r&&t.isNullOrUndefined(c[o].content))e=n(a).find(".e-groupdiv").eq(o).find(".e-ribGroupContent"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent")),e.children().remove(),c[o].contentID=null;else if(c[o].text==r&&t.isNullOrUndefined(u)){if(s=c[o].content,!t.isNullOrUndefined(s))for(conlen=c[o].content.length,l=0;l<conlen;l++)s[l].groups.splice(0,s[l].groups.length);e=n(a).find(".e-groupdiv").eq(o).find(".e-ribGroupContent");this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent"));e.children().remove()}}else if(t.isNullOrUndefined(f)||t.isNullOrUndefined(c[o].content[u].groups))s=c[o].content[u],e=n(a).children(".e-groupdiv").eq(o).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),e.eq(u).children().remove(),s.groups.splice(0,s.groups.length);else{for(s=c[o].content[u].groups,e=n(a).children(".e-groupdiv").eq(o).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),y=e.eq(u),v=0;v<y.children().length;v++)s.splice(v,1);y.children().eq(f).remove();e.children().length==0&&e.remove()}}else for(w=this.model.tabs.length,k=this.model.contextualTabs.length,o=0;o<k;o++)for(d=this.model.contextualTabs[o].tabs.length,v=0;v<d;v++)if(++w,w===i)for(s=this.model.contextualTabs[o].tabs[v].groups,g=s.length,h=0;h<g;h++)if(s[h].text==r)if(t.isNullOrUndefined(u)){if(s[h].type===t.Ribbon.type.custom&&s[h].text==r&&t.isNullOrUndefined(s[h].content))e=n(a).find(".e-groupdiv").eq(h).find(".e-ribGroupContent"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent")),e.children().remove(),s[h].contentID=null;else if(t.isNullOrUndefined(u)){if(contTabGrp=s[h].content,!t.isNullOrUndefined(contTabGrp))for(conlen=s[h].content.length,l=0;l<conlen;l++)contTabGrp[l].groups.splice(0,contTabGrp[l].groups.length);e=n(a).find(".e-groupdiv").eq(h).find(".e-ribGroupContent");this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-ribGroupContent"));e.children().remove()}}else if(t.isNullOrUndefined(f)||t.isNullOrUndefined(s[h].content[u].groups))contTabGrp=s[h].content[u],e=n(a).children(".e-groupdiv").eq(h).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),e.eq(u).children().remove(),contTabGrp.groups.splice(0,contTabGrp.groups.length);else{for(contTabGrp=s[h].content[u].groups,e=n(a).children(".e-groupdiv").eq(h).find(".e-innerdiv,.e-innerdivrow"),this._phoneMode&&this.element.find(".e-responsivecontent").is(":visible")&&e.length==0&&(e=this.element.find(".e-responsivecontent").find(".e-innerdiv,.e-innerdivrow")),y=e.eq(u),m=0;m<y.children().length;m++)contTabGrp.splice(m,1);y.children().eq(f).remove();e.children().length==0&&e.remove()}},addTab:function(r,u,f){var s={id:r.replace(/\s/g,""),text:r,groups:u},p=this.model.tabs.length,h,e,c,l,o;if(t.isNullOrUndefined(f)&&(f=this._tabUl.find(".e-select,.e-active").length),f>0){for(this._conTabsRemove(),this._tabObj.addItem("#"+this._id+"_"+r.replace(/\s/g,""),r,f),this._tabUl.find(".e-ribresmenu").nextAll("li.e-select").length>0&&(l=this._tabUl.find(".e-select,.e-active").not(".e-apptab,.e-tab"),l.insertBefore(this._tabUl.find(".e-ribresmenu"))),this._contextualTabs(),this._tabUl.find(".e-select,.e-active").eq(f).addClass("e-tab"),this._tabUl.find(".e-select > a,.e-active > a ").eq(f).addClass("e-link"),t.isNullOrUndefined(this.model.tabs[0].id)?(this.model.tabs[0]=s,this._tabObj.showItem(1)):this.model.tabs.splice(f-1,0,s),i=0;i<1;i++)for(tabs=this.model.tabs[f-1],o=tabs.groups.length,o==0&&this.element.find("#"+this._id+"_"+tabs.id).addClass("e-empty-content"),j=0;j<o;j++)if(!t.isNullOrUndefined(tabs.groups[j])){var a=t.isNullOrUndefined(tabs.groups[j].id)?t.isNullOrUndefined(tabs.groups[j].text)?tabs.groups[j].text:tabs.groups[j].text.replace(/\s/g,""):tabs.groups[j].id.replace(/\s/g,""),v=this._createControls(j,tabs,a,f),y=this._addControlsToGroup(j,tabs,a,v);e=this.element.find("#"+this._id+"_"+tabs.id);e.append(y).addClass("e-parentdiv")}this._setTabContentHeight();this.element.find(".e-content.e-content-item").css("box-sizing","content-box");this._ribbonTabs=this._tabUl.find(".e-link").parent();this._tabContents=this.element.children().attr("role","tabpanel").not(".e-header,.e-disable,.e-resizediv,.e-tooltipdiv,.e-ribbonbackstagepage");this._applicationTab.click(n.proxy(this._onApplicationTabClick,this));h=this._tabUl.find(".e-select,.e-active").eq(f);c={tabHeader:h,tabContent:e};this._trigger("tabAdd",c)}this._tabText=this.element.find(".e-link");this._applicationTab.hasClass("e-active")&&this._applicationTab.removeClass("e-active");n(e).hasClass("e-parentdiv")||n(e).addClass("e-parentdiv")},addContextualTabs:function(i,r){var l,f,u,e,o,s,h;if(this._tabUl.find(".e-tab").length<r&&(l=this.model.contextualTabs.length,t.isNullOrUndefined(r)&&(r=this._tabUl.find(".e-select,.e-active").length),r>0)){for(this._conTabsRemove(),f=i.tabs.length,u=0;u<f;u++)t.isNullOrUndefined(this._mobileContents[r-1])?(this._mobileContents[r-1]={tab:i.tabs[u].text,mobileContent:[]},this._mobileToolbar[r-1]={tab:i.tabs[u].text,Content:[]}):(this._mobileContents.splice(r-1,0,{tab:i.tabs[u].text,mobileContent:[]}),this._mobileToolbar.splice(r-1,0,{tab:i.tabs[u].text,Content:[]})),this._tabObj.addItem("#"+this._id+"_"+i.tabs[u].id,i.tabs[u].text,r),e=t.buildTag("li",i.tabs[u].text).addClass("e-responsivetabli e-resContextual"),o=n.isEmptyObject(this.model.applicationTab.menuSettings)&&t.isNullOrUndefined(this.model.applicationTab.menuItemID)&&t.isNullOrUndefined(this.model.applicationTab.backstageSettings.pages[0].id),e.insertBefore(this.element.find(".e-rescontent").children(".e-responsivetabli ").eq(r-(o?0:1))),this._responsiveTabText=this.element.find(".e-responsivetabheader li"),this._tabUl.find(".e-ribresmenu").nextAll("li.e-select").length>0&&(s=this._tabUl.find(".e-select,.e-active").not(".e-apptab,.e-tab"),s.insertBefore(this._tabUl.find(".e-ribresmenu"))),this._tabUl.find(".e-select,.e-active").eq(r).addClass("e-contextualtabset"),this._tabUl.find(".e-select > a ,.e-active > a ").eq(r).addClass("e-link"),++r;for(this.model.contextualTabs[0].tabs.length>0?this.model.contextualTabs.splice(r-1,0,i):this.model.contextualTabs[0]=i,this._contextualTabs(),f=i.tabs.length,u=0;u<f;u++)for(tabs=i.tabs[u],h=tabs.groups.length,j=0;j<h;j++)if(!t.isNullOrUndefined(tabs.groups[j])){var c=t.isNullOrUndefined(tabs.groups[j].id)?t.isNullOrUndefined(tabs.groups[j].text)?tabs.groups[j].text:tabs.groups[j].text.replace(/\s/g,""):tabs.groups[j].id.replace(/\s/g,""),a=this._createControls(j,tabs,c),v=this._addControlsToGroup(j,tabs,c,a);tabcont=this.element.find("#"+this._id+"_"+tabs.id);tabcont.append(v).addClass("e-parentdiv")}this._setTabContentHeight();this.element.find(".e-content.e-content-item").css("box-sizing","content-box");this._ribbonTabs=this._tabUl.find(".e-link").parent();this._tabContents=this.element.children().attr("role","tabpanel").not(".e-header,.e-disable,.e-resizediv,.e-tooltipdiv,.e-ribbonbackstagepage");this._applicationTab.click(n.proxy(this._onApplicationTabClick,this))}},setTabText:function(t,i){this._tabText.filter(function(){return n(this).text()===t}).text(i);this._phoneMode&&(this._responsiveTabText.filter(function(){return n(this).text()===t}).text(i),this.element.find(".e-ribresmenu .e-reslink").text(this._responsiveTabText.filter(".e-resactive").text()))},getTabText:function(n){return this._tabText.eq(n).text()},updateGroup:function(i,r,u){var nt,e,y,p,c,l,a,g,w,b,k,v,d,f,s,h,o;if(nt=this._tabUl.find(".e-select,.e-active").eq(i),n(nt).hasClass("e-tab")){for(e=this.model.tabs[i-1].groups,w=e.length,f=0;f<w;f++)if(!t.isNullOrUndefined(e[f].content))for(b=e[f].content.length,s=0;s<b;s++)for(k=e[f].content[s].groups.length,h=0;h<k;h++)e[f].content[s].groups[h].id==r&&(o=e[f].content[s].groups[h],t.isNullOrUndefined(u.buttonSettings)||(n.extend(o.buttonSettings,u.buttonSettings),n(u).removeProp("buttonSettings")),t.isNullOrUndefined(u.dropdownSettings)||(n.extend(o.dropdownSettings,u.dropdownSettings),n(u).removeProp("dropdownSettings")),t.isNullOrUndefined(u.toggleButtonSettings)||(n.extend(o.toggleButtonSettings,u.toggleButtonSettings),n(u).removeProp("toggleButtonSettings")),t.isNullOrUndefined(u.splitButtonSettings)||(n.extend(o.splitButtonSettings,u.splitButtonSettings),n(u).removeProp("splitButtonSettings")),t.isNullOrUndefined(u.customToolTip)||(n.extend(o.customToolTip,u.customToolTip),n(u).removeProp("customToolTip")),n.extend(o,u),l=t.isNullOrUndefined(e[f].id)?t.isNullOrUndefined(e[f].text)?e[f].text:e[f].text.replace(/\s/g,""):e[f].id.replace(/\s/g,""),c=this.model.tabs[i-1],p=this._createControls(f,c,l,i),a="#"+this._id+"_"+c.id+"_"+l+"_"+r,y=this.element.find(a),groupDiv=p.find(a),y.replaceWith(groupDiv))}else for(g=this.model.tabs.length,v=0;v<this.model.contextualTabs.length;v++)for(d=0;d<this.model.contextualTabs[v].tabs.length;d++)if(++g,g===i)for(e=this.model.contextualTabs[v].tabs[d].groups,w=e.length,f=0;f<w;f++)if(!t.isNullOrUndefined(e[f].content))for(b=e[f].content.length,s=0;s<b;s++)for(k=e[f].content[s].groups.length,h=0;h<k;h++)e[f].content[s].groups[h].id==r&&(o=e[f].content[s].groups[h],t.isNullOrUndefined(u.buttonSettings)||(n.extend(o.buttonSettings,u.buttonSettings),n(u).removeProp("buttonSettings")),t.isNullOrUndefined(u.dropdownSettings)||(n.extend(o.dropdownSettings,u.dropdownSettings),n(u).removeProp("dropdownSettings")),t.isNullOrUndefined(u.toggleButtonSettings)||(n.extend(o.toggleButtonSettings,u.toggleButtonSettings),n(u).removeProp("toggleButtonSettings")),t.isNullOrUndefined(u.splitButtonSettings)||(n.extend(o.splitButtonSettings,u.splitButtonSettings),n(u).removeProp("splitButtonSettings")),t.isNullOrUndefined(u.customToolTip)||(n.extend(o.customToolTip,u.customToolTip),n(u).removeProp("customToolTip")),n.extend(o,u),l=t.isNullOrUndefined(e[f].id)?t.isNullOrUndefined(e[f].text)?e[f].text:e[f].text.replace(/\s/g,""):e[f].id.replace(/\s/g,""),c=this.model.contextualTabs[0].tabs[0],p=this._createControls(f,c,l,i),a="#"+this._id+"_"+c.id+"_"+l+"_"+r,y=this.element.find(a),groupDiv=p.find(a),y.replaceWith(groupDiv))},isVisible:function(t){var i=this._tabText.filter(function(){return n(this).text()===t}).parent();return i.is(":visible")},isEnable:function(t){for(var r=!0,u=this._tabText.filter(function(){return n(this).text()===t}).parent().index(),f=this.model.disabledItemIndex.length,i=0;i<f;i++)this.model.disabledItemIndex[i]==u&&(r=!1);return r},_renderTab:function(){var r=t.buildTag("ul"),u,f,c=this.model.applicationTab.type,s,h,i,e,o=this.model.tabs,l=o.length,a,v;if(c!=null&&(f=t.buildTag("a","",{},{href:"#"+this._id+"_"+c.replace(/\s/g,"")})),u=t.buildTag("li.e-apptab",f),r.append(u),l>=1&&!t.isNullOrUndefined(o[0].id)&&!t.isNullOrUndefined(o[0].text))for(i=0;i<l;i++)s=o[i],f=t.buildTag("a",s.text,{},{href:"#"+this._id+"_"+s.id}),u=t.buildTag("li",f).addClass("e-tab"),r.append(u);if(this.model.contextualTabs)for(a=this.model.contextualTabs.length,i=0;i<a;i++)if(this.model.contextualTabs[i].tabs)for(v=this.model.contextualTabs[i].tabs.length,e=0;e<v;e++)h=this.model.contextualTabs[i].tabs[e],f=t.buildTag("a",h.text,{},{href:"#"+this._id+"_"+h.id}),u=t.buildTag("li",f).addClass("e-contextualtabset").css("border-bottom-color",this.model.contextualTabs[i].backgroundColor),r.append(u);r.append(t.buildTag("li.e-ribresmenu").append(t.buildTag("span.e-icon").addClass("e-ribdownarrow")).prepend(t.buildTag("a#"+this._id+"_responsivelink").addClass("e-reslink")).click(n.proxy(this._onResponsiveHeaderClick,this)));this.model.showQAT&&r.append(t.buildTag("li#"+this._id+"_responsiveqat").addClass("e-responsiveqat").click(n.proxy(this._onQatClick,this)));this.element.append(r);this.element.ejTab({width:this.model.width,allowKeyboardNavigation:!1,disabledItemIndex:this.model.disabledItemIndex,enabledItemIndex:this.model.enabledItemIndex,enableTabScroll:!1,itemActive:n.proxy(this._onTabSelect,this),beforeActive:n.proxy(this._onTabClick,this),create:n.proxy(this._create,this),selectedItemIndex:this.model.selectedItemIndex,enableRTL:this.model.enableRTL})},_createControls:function(i,u,f,e){var d,vt,y,ot,o={},a,h,w,nt,v,tt,ni,ti,c,g,l,st,ht,ut,ft,bt,k,it,b,yt,ui,fi,ei,kt,pt,ct,s,et,dt,rt,lt,wt,ri,p,at;if(f=t.isNullOrUndefined(f)?f:f.replace(/\&/g,""),ot=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_content").addClass("e-ribGroupContent"),u.groups[i].type==="custom")u.groups[i].contentID?(vt=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+u.groups[i].type).addClass("e-innerdiv"),n("#"+u.groups[i].contentID).addClass("e-rbncustomelement").appendTo(vt).show()):vt=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+u.groups[i].type,u.groups[i].customContent).addClass("e-innerdiv"),i===0&&ot.append(t.buildTag("div.e-ribupdivarrow").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))).addClass("e-resgroupheader"),ot.append(vt);else if(u.groups[i].content)for(i===0&&ot.append(t.buildTag("div.e-ribupdivarrow").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))).addClass("e-resgroupheader"),ni=u.groups[i].content.length,p=0;p<ni;p++)if(u.groups[i].content[p]!=r)for(c=u.groups[i].content[p].groups,g=u.groups[i].content[p].defaults,u.groups[i].content.length==1&&(centerAlign=!0),t.isNullOrUndefined(u.groups[i].alignType)&&(u.groups[i].alignType=t.Ribbon.AlignType.Rows),u.groups[i].alignType===t.Ribbon.AlignType.Columns?d=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+(p+1)).addClass("e-innerdiv"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(d=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+(p+1)).addClass("e-innerdivrow"),++s),ti=c.length,s=0;s<ti;s++)if(!t.isNullOrUndefined(c[s])){t.isNullOrUndefined(g)||t.isNullOrUndefined(g.type)||(c[s].type=g.type);t.isNullOrUndefined(c[s].type)&&(c[s].type=t.Ribbon.Type.Button);t.isNullOrUndefined(c[s].isBig)&&!t.isNullOrUndefined(g)&&(c[s].isBig=g.isBig);l=this.model.buttonDefaults;t.isNullOrUndefined(c[s].height)&&(t.isNullOrUndefined(c[s].buttonSettings)||t.isNullOrUndefined(c[s].buttonSettings.height)?t.isNullOrUndefined(g)||t.isNullOrUndefined(g.height)?t.isNullOrUndefined(l)||t.isNullOrUndefined(l.height)||(st=l.height):st=g.height:st=c[s].buttonSettings.height,c[s].height=st,st=null);t.isNullOrUndefined(c[s].width)&&(t.isNullOrUndefined(c[s].buttonSettings)||t.isNullOrUndefined(c[s].buttonSettings.width)?t.isNullOrUndefined(g)||t.isNullOrUndefined(g.width)?t.isNullOrUndefined(l)||t.isNullOrUndefined(l.width)||(ht=l.width):ht=g.width:ht=c[s].buttonSettings.width,c[s].width=ht,ht=null);t.isNullOrUndefined(c[s].buttonSettings)||(ut=c[s].buttonSettings,!t.isNullOrUndefined(ut.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(ut.enabled=l.enabled),!t.isNullOrUndefined(ut.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(ut.enableRTL=l.enableRTL),!t.isNullOrUndefined(ut.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(ut.cssClass=l.cssClass),!t.isNullOrUndefined(ut.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(ut.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].splitButtonSettings)||(ft=c[s].splitButtonSettings,!t.isNullOrUndefined(ft.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(ft.enabled=l.enabled),!t.isNullOrUndefined(ft.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(ft.enableRTL=l.enableRTL),!t.isNullOrUndefined(ft.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(ft.cssClass=l.cssClass),!t.isNullOrUndefined(ft.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(ft.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].dropdownSettings)||(!t.isNullOrUndefined(c[s].dropdownSettings.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(c[s].dropdownSettings.enabled=l.enabled),!t.isNullOrUndefined(c[s].dropdownSettings.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(c[s].dropdownSettings.enableRTL=l.enableRTL),!t.isNullOrUndefined(c[s].dropdownSettings.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(c[s].dropdownSettings.cssClass=l.cssClass),!t.isNullOrUndefined(c[s].dropdownSettings.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(c[s].dropdownSettings.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].toggleButtonSettings)||(!t.isNullOrUndefined(c[s].toggleButtonSettings.enabled)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enabled)||(c[s].toggleButtonSettings.enabled=l.enabled),!t.isNullOrUndefined(c[s].toggleButtonSettings.enableRTL)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.enableRTL)||(c[s].toggleButtonSettings.enableRTL=l.enableRTL),!t.isNullOrUndefined(c[s].toggleButtonSettings.cssClass)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.cssClass)||(c[s].toggleButtonSettings.cssClass=l.cssClass),!t.isNullOrUndefined(c[s].toggleButtonSettings.showRoundedCorner)||t.isNullOrUndefined(l)||t.isNullOrUndefined(l.showRoundedCorner)||(c[s].toggleButtonSettings.showRoundedCorner=l.showRoundedCorner));t.isNullOrUndefined(c[s].quickAccessMode)&&(c[s].quickAccessMode="none");switch(c[s].type){case t.Ribbon.Type.Custom:nt=c[s];u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+nt.contentID).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+nt.contentID).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(nt.customToolTip)?t.isNullOrUndefined(nt.toolTip)||y.attr("title",nt.toolTip):y.mouseover({value:nt,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));n("#"+nt.contentID).addClass("e-rbncustomelement").appendTo(y);t.isNullOrUndefined(c[s])||(t.isNullOrUndefined(c[s].height)||y.children().height(c[s].height),t.isNullOrUndefined(c[s].width)||y.children().width(c[s].width));t.isNullOrUndefined(nt.isBig)||(nt.isBig?y.children().addClass("e-big"):y.children().addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+nt.toolTip).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.SplitButton:a=c[s];this._splitButtonControl=t.buildTag("button#"+this._id+"_"+a.id,a.text,{},{type:"button"}).addClass(a.cssClass);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+a.id,this._splitButtonControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+a.id,this._splitButtonControl).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(a.customToolTip)?t.isNullOrUndefined(a.toolTip)||y.attr("title",a.toolTip):y.mouseover({value:a,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));o={};a.splitButtonSettings&&(o=a.splitButtonSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;o.cssClass=o.cssClass?o.cssClass.concat(" e-rbn-splitbtn e-rbn-button"):"e-rbn-splitbtn e-rbn-button";o.enableRTL=this.model.enableRTL;this._splitButtonControl.ejSplitButton(o);y.find(".e-split").addClass("e-rbn-split");a.isMobileOnly&&(this._mobileSplitButton=t.buildTag("button#"+this._id+"_"+a.id+"_mobEle",a.text,{},{type:"button"}).addClass(a.cssClass),it=t.buildTag("div#"+this._id+"_"+a.id+"_mobDiv",this._mobileSplitButton).addClass("e-mobdiv"),o.height=a.splitButtonSettings.height,o.width=a.splitButtonSettings.width,o.arrowPosition=t.ArrowPosition.Right,o.imagePosition=a.splitButtonSettings.imagePosition,o.contentType=a.splitButtonSettings.contentType,this._mobileSplitButton.ejSplitButton(o),it.find("button").addClass("e-rbn-button"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(a.text)?t.isNullOrUndefined(a.splitButtonSettings.text)||(b=a.splitButtonSettings.text):b=a.text,this._mobileContents[e].mobileContent.push({id:a.id,text:b,isMobileOnly:a.isMobileOnly}));a.quickAccessMode!="none"&&this.model.showQAT&&!this.model.enableOnDemand&&(this._splitButtonQAT=t.buildTag("button#"+this._id+"_"+a.id+"_qatEle",a.text,{},{type:"button"}).addClass(a.cssClass),k=t.buildTag("div#"+this._id+"_"+a.id+"_qatDiv",this._splitButtonQAT).addClass("e-qatooldiv"),o.height=30,o.arrowPosition=t.ArrowPosition.Right,o.contentType=t.ContentType.ImageOnly,n.isEmptyObject(a.customToolTip)?t.isNullOrUndefined(a.toolTip)||k.attr("title",a.toolTip):k.mouseover({value:a,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._splitButtonQAT.ejSplitButton(o),k.find("button").addClass("e-rbn-button"),k.appendTo(this._qAccessBar),a.quickAccessMode=="menu"&&k.hide(),t.isNullOrUndefined(a.text)?t.isNullOrUndefined(a.splitButtonSettings.text)||(b=a.splitButtonSettings.text):b=a.text,this._qatControlsName.push({id:a.id,text:b,qAccess:a.quickAccessMode}));t.isNullOrUndefined(a.isBig)||(a.isBig?y.children().prop("style",!1).addClass("e-big"):y.children().prop("style",!1).addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+a.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.ToggleButton:v=c[s];this._toggleButtonControl=t.buildTag("input#"+this._id+"_"+v.id,"","",{type:"checkbox"}).addClass(v.cssClass);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+v.id,this._toggleButtonControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+v.id,this._toggleButtonControl).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(v.customToolTip)?t.isNullOrUndefined(v.toolTip)||y.attr("title",v.toolTip):y.mouseover({value:v,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));o={};v.toggleButtonSettings&&(o=v.toggleButtonSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;bt=n("#"+this._toggleButtonControl.attr("id")+"_qatDiv button.e-togglebutton");this.model.enableOnDemand&&this.model.showQAT&&bt.is(":visible")&&bt.hasClass("e-active")&&(o.toggleState=!0);this._toggleButtonControl.ejToggleButton(o).addClass("e-ribbonbtn e-rbn-button");y.find("button").addClass("e-rbn-button");v.isMobileOnly&&(this._mobileToggleButton=t.buildTag("button#"+this._id+"_"+v.id+"_mobEle","","",{type:"checkbox"}).addClass(v.cssClass),it=t.buildTag("div#"+this._id+"_"+v.id+"_mobDiv",this._mobileToggleButton).addClass("e-mobdiv"),o.height=v.toggleButtonSettings.height,o.width=v.toggleButtonSettings.width,o.contentType=v.toggleButtonSettings.contentType,o.imagePosition=v.toggleButtonSettings.imagePosition,this._mobileToggleButton.ejToggleButton(o).addClass("e-ribbonbtn"),it.find("button").addClass("e-rbn-button"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(v.text)?t.isNullOrUndefined(v.toggleButtonSettings.defaultText)||(b=v.toggleButtonSettings.defaultText):b=v.text,this._mobileContents[e].mobileContent.push({id:v.id,text:b,isMobileOnly:v.isMobileOnly}));v.quickAccessMode!="none"&&this.model.showQAT&&!this.model.enableOnDemand&&(this._toggleButtonQAT=t.buildTag("input#"+this._id+"_"+v.id+"_qatEle","","",{type:"checkbox"}).addClass(v.cssClass),k=t.buildTag("div#"+this._id+"_"+v.id+"_qatDiv",this._toggleButtonQAT).addClass("e-qatooldiv"),o.height=30,o.contentType=t.ContentType.ImageOnly,n.isEmptyObject(v.customToolTip)?t.isNullOrUndefined(v.toolTip)||k.attr("title",v.toolTip):k.mouseover({value:v,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._toggleButtonQAT.ejToggleButton(o).addClass("e-ribbonbtn"),k.find("button").addClass("e-rbn-button"),k.appendTo(this._qAccessBar),v.quickAccessMode=="menu"&&k.hide(),t.isNullOrUndefined(v.text)?t.isNullOrUndefined(v.toggleButtonSettings.defaultText)||(b=v.toggleButtonSettings.defaultText):b=v.text,this._qatControlsName.push({id:v.id,text:b,qAccess:v.quickAccessMode}));t.isNullOrUndefined(v.isBig)||(v.isBig?y.find(".e-togglebutton.e-tbtn.e-btn").addClass("e-big"):y.find(".e-togglebutton.e-tbtn.e-btn").addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+v.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.Button:h=c[s];this._buttonControl=h.buttonSettings?h.buttonSettings.type?t.buildTag("button#"+this._id+"_"+h.id,h.text,{},{type:h.buttonSettings.type}).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id,h.text).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id,h.text).addClass(h.cssClass);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+h.id,this._buttonControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+h.id,this._buttonControl).addClass("e-innerdivchild e-controlpadding"));n.isEmptyObject(h.customToolTip)?t.isNullOrUndefined(h.toolTip)||y.attr("title",h.toolTip):y.mouseover({value:h,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this));o={};h.buttonSettings&&(o=h.buttonSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;this._buttonControl.ejButton(o).addClass("e-ribbonbtn e-rbn-button");h.isMobileOnly&&(this._mobileButton=h.buttonSettings?h.buttonSettings.type?t.buildTag("button#"+this._id+"_"+h.id+"_mobEle",h.text,{},{type:h.buttonSettings.type}).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_mobEle",h.text).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_mobEle",h.text).addClass(h.cssClass),it=t.buildTag("div#"+this._id+"_"+h.id+"_mobDiv",this._mobileButton).addClass("e-mobdiv"),this._mobileButton.ejButton(o).addClass("e-ribbon-resbtn e-rbn-button"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(h.text)?t.isNullOrUndefined(h.buttonSettings.text)||(b=h.buttonSettings.text):b=h.text,this._mobileContents[e].mobileContent.push({id:h.id,text:b,isMobileOnly:h.isMobileOnly}));h.quickAccessMode!="none"&&this.model.showQAT&&!this.model.enableOnDemand&&(this._buttonQAT=h.buttonSettings?h.buttonSettings.type?t.buildTag("button#"+this._id+"_"+h.id+"_qatEle",h.text,{},{type:h.buttonSettings.type}).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_qatEle",h.text).addClass(h.cssClass):t.buildTag("button#"+this._id+"_"+h.id+"_qatEle",h.text).addClass(h.cssClass),k=t.buildTag("div#"+this._id+"_"+h.id+"_qatDiv",this._buttonQAT).addClass("e-qatooldiv"),o.height=30,o.contentType=t.ContentType.ImageOnly,n.isEmptyObject(h.customToolTip)?t.isNullOrUndefined(h.toolTip)||k.attr("title",h.toolTip):k.mouseover({value:h,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),this._buttonQAT.ejButton(o).addClass("e-ribbonbtn e-rbn-button"),k.appendTo(this._qAccessBar),h.quickAccessMode=="menu"&&k.hide(),t.isNullOrUndefined(h.text)?t.isNullOrUndefined(h.buttonSettings.text)||(b=h.buttonSettings.text):b=h.text,this._qatControlsName.push({id:h.id,text:b,qAccess:h.quickAccessMode}));t.isNullOrUndefined(h.isBig)||(h.isBig?y.children().addClass("e-big"):y.children().addClass("e-small"));d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+h.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.DropDownList:w=c[s];this._dropdownControl=t.buildTag("input#"+this._id+"_"+w.id,{type:"text"}).addClass(w.cssClass);w.dropdownSettings&&(u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+w.id,this._dropdownControl).append(n("#"+w.dropdownSettings.targetID)).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+w.id,this._dropdownControl).append(n("#"+w.dropdownSettings.targetID)).addClass("e-innerdivchild e-controlpadding")),n.isEmptyObject(w.customToolTip)?t.isNullOrUndefined(w.toolTip)||y.attr("title",w.toolTip):y.mouseover({value:w,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)));o={};w.dropdownSettings&&(o=w.dropdownSettings);o.height=t.isNullOrUndefined(o.height)?c[s].height:o.height;o.width=t.isNullOrUndefined(o.width)?c[s].width:o.width;o.cssClass=o.cssClass?o.cssClass.concat(" e-rbn-ddl"):"e-rbn-ddl";w.isMobileOnly&&(this._mobileDropdown=t.buildTag("input#"+this._id+"_"+w.id+"_mobEle","","",{type:"text"}).addClass(w.cssClass),it=t.buildTag("div#"+this._id+"_"+w.id+"_mobDiv",this._mobileDropdown).addClass("e-mobdiv"),this._mobileDropdown.ejDropDownList(o).addClass("e-ribbonbtn"),this._mobileToolbar[e].Content.push(it),t.isNullOrUndefined(w.text)?t.isNullOrUndefined(w.dropdownSettings.defaultText)||(b=w.dropdownSettings.defaultText):b=w.text,this._mobileContents[e].mobileContent.push({id:w.id,text:b,isMobileOnly:w.isMobileOnly}));o.enableRTL=this.model.enableRTL;this._dropdownControl.ejDropDownList(o);d.append(y);c[s].enableSeparator&&u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(tt=t.buildTag("div#"+this._id+"_separator_"+w.id).addClass("e-separatordivrow"),d.append(tt));break;case t.Ribbon.Type.Gallery:for(gallery=c[s],this._galleryControl=t.buildTag("div#"+this._id+"_"+gallery.id+"_gallerycontrol").addClass("e-ribbongallerycontrol"),this._gallery=t.buildTag("div#"+this._id+"_"+gallery.id).addClass("e-ribbongallery"),ct=t.buildTag("div#"+this._id+"_"+gallery.id+"_ContentDiv").addClass("e-gallerycontent").height(65).width(gallery.columns*gallery.itemWidth).click({galleryId:this._gallery.attr("id")},n.proxy(this._onGalContentClick,this)),pt=Math.floor(gallery.galleryItems.length/gallery.columns),gallery.galleryItems.length%gallery.columns>0&&++pt,s=1;s<=pt;s++){for(et=t.buildTag("div#"+this._id+"_"+gallery.id+"_galleryrow_"+s).addClass("e-galleryrow").click({model:gallery},n.proxy(this._onGalleryItemClick,this)),s===1?et.addClass("e-gryfirstrow"):s===pt&&et.addClass("e-grylastrow"),dt=1;dt<=gallery.columns;dt++)rt=ct.find(".e-galleryrow").children().length+et.children().length,t.isNullOrUndefined(gallery.galleryItems[rt])||(lt=t.buildTag("button#"+gallery.id+"_galleryItem_"+(rt+1),gallery.galleryItems[rt].text,{},{type:"button"}).addClass("e-gallerybtn e-rbn-button"),n.isEmptyObject(gallery.galleryItems[rt].customToolTip)?t.isNullOrUndefined(gallery.galleryItems[rt].toolTip)||lt.attr("title",gallery.galleryItems[rt].toolTip):lt.mouseover({value:gallery.galleryItems[rt],ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),o={},gallery.galleryItems[rt].buttonSettings&&(o=gallery.galleryItems[rt].buttonSettings),o.height=gallery.itemHeight<=65?gallery.itemHeight:65,o.width=gallery.itemWidth,lt.ejButton(o),lt.appendTo(et));kt=gallery.itemHeight>65?1:ct.height()/gallery.itemHeight;s>kt&&et.hide();et.appendTo(ct)}this._gallery.append(ct);var yt=t.buildTag("div#"+this._id+"_"+gallery.id+"_PagesDiv").addClass("e-gallerymovediv"),ui=t.buildTag("div#"+this._id+"_"+gallery.id+"_prevPage","<span class='e-icon e-galleryup e-gallerymoveicon'><\/span>").click({galleryId:this._gallery.attr("id"),rowCnt:kt},n.proxy(this._onGalMoveUpClick,this)).addClass("e-moveupdiv e-disablegrymovebtn"),fi=t.buildTag("div#"+this._id+"_"+gallery.id+"_nextPage","<span class='e-icon e-gallerydown e-gallerymoveicon'><\/span>").click({galleryId:this._gallery.attr("id")},n.proxy(this._onGalMoveDownClick,this)).addClass("e-movedowndiv"),ei=t.buildTag("div#"+this._id+"_"+gallery.id+"_expandGallery","<span class='e-icon e-galleryexpand e-gallerymoveicon'><\/span>").click({galleryId:this._gallery.attr("id"),columns:gallery.columns,expandedColumns:gallery.expandedColumns,itemWidth:gallery.itemWidth},n.proxy(this._onExpandGalleryClick,this)).addClass("e-expgallerydiv");this._responsiveGallery=gallery.expandedColumns;yt.append(ui);yt.append(fi);yt.append(ei);this._gallery.append(yt);var gt=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExpandContent").addClass("e-gallexpandcontent").hide(),ii=t.buildTag("div#"+this._id+"_"+gallery.id+"_scrollContent","<div><\/div>").addClass("e-gallscrollcontent"),oi=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExpanderContent").addClass("e-expandercontent").click({galleryId:this._gallery.attr("id")},n.proxy(this._onExpandContentClick,this));if(ii.children().append(oi),gt.append(ii),!t.isNullOrUndefined(gallery.customGalleryItems)){for(wt=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExtraContent").addClass("e-extracontent").click({model:gallery},n.proxy(this._onGalleryItemClick,this)),ri=gallery.customGalleryItems.length,p=0;p<ri;p++)t.isNullOrUndefined(gallery.customGalleryItems[p].customItemType)&&(gallery.customGalleryItems[p].customItemType=t.Ribbon.CustomItemType.Button),gallery.customGalleryItems[p].customItemType===t.Ribbon.CustomItemType.Button?(at=t.buildTag("button#"+gallery.id+"__extraItem_"+p,gallery.customGalleryItems[p].text,{},{type:"button"}).addClass("e-galleryextrabtn e-rbn-button"),n.isEmptyObject(gallery.customGalleryItems[p].customToolTip)?t.isNullOrUndefined(gallery.customGalleryItems[p].toolTip)||at.attr("title",gallery.customGalleryItems[p].toolTip):at.mouseover({value:gallery.customGalleryItems[p],ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)),o={},gallery.customGalleryItems[p]&&(gallery.customGalleryItems[p].buttonSettings&&(o=gallery.customGalleryItems[p].buttonSettings),at.ejButton(o)),at.appendTo(wt)):(o={},gallery.customGalleryItems[p].menuSettings&&(o=gallery.customGalleryItems[p].menuSettings),o.menuType=t.MenuType.NormalMenu,o.orientation=t.Orientation.Vertical,o.enableRTL=this.model.enableRTL,n("#"+gallery.customGalleryItems[p].menuId).ejMenu(o).addClass("e-gallerymenu"),n("#"+gallery.customGalleryItems[p].menuId).appendTo(wt).css("width","100%"));gt.append(wt)}this._galleryControl.append(this._gallery);this._galleryControl.append(gt);u.groups[i].alignType===t.Ribbon.AlignType.Columns?y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+gallery.id,this._galleryControl).addClass("e-controlpadding"):u.groups[i].alignType===t.Ribbon.AlignType.Rows&&(y=t.buildTag("div#"+this._id+"_"+u.id+"_"+f+"_"+gallery.id,this._galleryControl).addClass("e-innerdivchild e-controlpadding"));d.append(y)}ot.append(d)}return ot},_groupContent:function(i){var f=0,e,u,o,s,r,h;if(t.isNullOrUndefined(i)?index=this._tabUl.find(".e-active").index()-1:(f=n(i.activeHeader).parents(".e-contextliset").length>0?n(i.activeHeader).parents(".e-contextliset").prevAll(".e-tab").eq(0).prevAll().not(".e-tab,.e-apptab").length:n(i.activeHeader).prevAll().not(".e-tab,.e-apptab").length,index=i.activeIndex-(f+1)),e=this.element.find(".e-content-item").eq(index+(1+f)),e.hasClass("e-rbn-ondemand")&&!(index<0)){if(ribbonModel=n.extend(!0,{},this.model),u=this.model.tabs.length,contextIndex=t.isNullOrUndefined(i)?-1:n(i.activeHeader).hasClass("e-contextualtabset")?u-n(i.activeHeader).index():-1,this.model.contextualTabs&&contextIndex!=-1&&(o=n(i.activeHeader).parents(".e-contextliset").attr("id"),contextIndex=parseInt(o[o.length-1]),contextualTab=this.model.contextualTabs[contextIndex],contextualTab.tabs))for(s=contextualTab.tabs.length,r=0;r<s;r++)!t.isNullOrUndefined(contextualTab.tabs[r].groups)&&contextualTab.tabs[r].groups.length>0&&(this.model.tabs[u]=contextualTab.tabs[r],index=u);if(tabs=this.model.tabs[index],this._mobileContents[this._tabObj.model.selectedItemIndex-1]={tab:tabs.text,mobileContent:[]},this._mobileToolbar[this._tabObj.model.selectedItemIndex-1]={tab:tabs.text,Content:[]},t.isNullOrUndefined(tabs.groups))this.element.find(".e-content.e-content-item").eq(index+1).addClass("e-empty-content");else for(h=tabs.groups.length,j=0;j<h;j++)t.isNullOrUndefined(tabs.groups[j])||(tabGroupText=t.isNullOrUndefined(tabs.groups[j].id)?t.isNullOrUndefined(tabs.groups[j].text)?tabs.groups[j].text:tabs.groups[j].text.replace(/\s/g,""):tabs.groups[j].id.replace(/\s/g,""),contDiv=this._createControls(j,tabs,tabGroupText,index),groupDiv=this._addControlsToGroup(j,tabs,tabGroupText,contDiv),tabcont=this.element.find("#"+this._id+"_"+tabs.id),tabcont.append(groupDiv).addClass("e-parentdiv"));e.removeClass("e-rbn-ondemand");this.model=ribbonModel}},_groupingControls:function(){var s=this.model.tabs.length,f,i,a,v,y,u,r,h,w=n.extend(!0,{},this.model),p,o,c,e,l;if(this.model.contextualTabs)for(p=this.model.contextualTabs.length,o=0;o<p;o++)if(f=this.model.contextualTabs[o],f.tabs)for(c=f.tabs.length,c==0&&this.element.find(".e-content.e-content-item").eq(u+1).addClass("e-empty-content"),e=0;e<c;e++)!t.isNullOrUndefined(f.tabs[e].groups)&&f.tabs[e].groups.length>0&&(this.model.tabs[s]=f.tabs[e],++s);for(u=0;u<s;u++)if(i=this.model.tabs[u],this._mobileContents[u]={tab:i.text,mobileContent:[]},this._mobileToolbar[u]={tab:i.text,Content:[]},t.isNullOrUndefined(i.groups))this.element.find(".e-content.e-content-item").eq(u+1).addClass("e-empty-content");else for(l=i.groups.length,l==0&&this.element.find(".e-content.e-content-item").eq(u+1).addClass("e-empty-content"),r=0;r<l;r++)t.isNullOrUndefined(i.groups[r])||(h=t.isNullOrUndefined(i.groups[r].id)?t.isNullOrUndefined(i.groups[r].text)?i.groups[r].text:i.groups[r].text.replace(/\s/g,""):i.groups[r].id.replace(/\s/g,""),v=this._createControls(r,i,h,u),a=this._addControlsToGroup(r,i,h,v),y=this.element.find("#"+this._id+"_"+i.id),y.append(a).addClass("e-parentdiv"));this._setTabContentHeight();this.model=w},_addControlsToGroup:function(i,r,u,f){var s=t.buildTag("div.e-contentbottom"),h=!1,e,o,c=t.buildTag("div.e-captionarea",r.groups[i].text);return s.append(c),r.groups[i].enableGroupExpander&&(o=t.buildTag("div#"+this._id+"_"+u+"_e-groupexpander.e-icon e-expander e-groupexpander"),s.append(o),t.isNullOrUndefined(r.groups[i].groupExpanderSettings)||(t.isNullOrUndefined(r.groups[i].groupExpanderSettings.toolTip)||o.attr("title",r.groups[i].groupExpanderSettings.toolTip),n.isEmptyObject(r.groups[i].groupExpanderSettings.customToolTip)||o.mouseover({value:r.groups[i].groupExpanderSettings,ribbonId:this._id},n.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},n.proxy(this._toolTipOut,this)))),e=t.buildTag("div#"+this._id+"_"+r.id+"_"+u).addClass("e-groupdiv").click(n.proxy(this._onGroupClick,this)),t.isNullOrUndefined(r.groups[i].content)||r.groups[i].content.length==1&&(h=!0),r.groups[i].width&&e.width(r.groups[i].width),e.append(f),h&&(e.addClass("e-centeralign"),h==!1),e.append(s),e},_tabExpandCollapse:function(t){var i,r,u;(t.type=="touchend"&&t.preventDefault(),i=t.target.tagName=="div"?t.target:t.target.parentNode,u=i.className=="e-expanded"?"collapse":"expand",r={target:n(i),type:t.type,action:u,cancel:!1},this._trigger("toggleButtonClick",r),r.cancel)||(this.element.find(".e-rarrowup-2x").length>0?this.collapse():(this._removeRibbonPin(),this.model.showQAT&&this._qAccessBar.show(),this._trigger("pinState",{action:"pin"})),this._clickValue="click")},_responsiveback:function(){this.element.find(".e-resizebtnselect").removeClass("e-active e-resizebtnselect");this.element.find(".e-responsivebackstagecontent").is(":visible")&&this.element.find(".e-responsivebackstagecontent").hide();!this.element.find(".e-responsivecontent").hasClass("e-resshow")||this.element.find(".e-responsivecontent").find(".e-split.e-active").length>0||this._responsiveContentBack();this.element.find(".e-respcontent").is(":visible")&&(this.element.find(".e-active-content").addClass("e-responsiveheight e-rbnmobheader"),this.element.find(".e-respcontent .e-groupresponsive.e-ribuparrow").removeClass("e-ribuparrow").addClass("e-ribdownarrow"));return},_ribbonResponsive:function(){for(var f,e,u=t.buildTag("ul#"+this._id+"_responsivetabContent").addClass("e-rescontent"),r=this.model.tabs.length,o=!0,i=0;i<r;i++)u.append(t.buildTag("li",this.model.tabs[i].text).addClass("e-responsivetabli"));if(r=this.model.contextualTabs.length,r==1&&(o=this.model.contextualTabs[0].tabs.length>0?!0:!1),r!=0&&o)for(i=0;i<r;i++)u.append(t.buildTag("li",this.model.contextualTabs[i].tabs[0].text).addClass("e-responsivetabli").addClass("e-resContextual"));f=t.buildTag("div#"+this._id+"_responsivetabHeader").addClass("e-responsivetabheader").click(n.proxy(this._onResponsiveHeaderClick,this));f.append(u);this.element.append(f);this._initialRender&&this._tabUl.find("li.e-ribresmenu a").not(".e-backstagetab").text(this._tabUl.find("li.e-active a").text());this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&(this.element.prepend(t.buildTag("div#"+this._id+"_responsivebackstage").addClass("e-responsivebackstage")),e=t.buildTag("div#"+this._id+"_resbackstagecontent").addClass("e-responsivebackstagecontent").append(t.buildTag("div.e-resbackstagecontent")),e.prepend(t.buildTag("div#"+this._id+"backstagetop").addClass("e-backstagerestop").append(t.buildTag("div.e-backstagerestopcontent").append(t.buildTag("span.e-icon").addClass("e-ribleftarrow")).append(t.buildTag("div#"+this._id+"resbacstageTitle").addClass("e-backstageTitle")))),this.element.prepend(e.hide()))},_onResponsiveHeaderClick:function(t){if(n(t.target).hasClass("e-responsivetabli")){var i=n(t.target).parent("ul").children().index(t.target);this.element.find(".e-responsivetabheader").removeClass("e-resshow");this.element.find(".e-ribresmenu a").text(t.target.textContent);n(this._tabUl.find(".e-tab,.e-contextliset").find("a")[i]).trigger("click");n(t.target).parent("ul").children(".e-resactive").removeClass("e-resactive");n(t.target).addClass("e-resactive");return}if(n(t.target).parent(".e-ribresmenu").length>0){this.element.find(".e-responsivetabheader").addClass("e-resshow");return}},_ribbonResGroup:function(){var i=this._tabUl.find(".e-tab,.e-contextualtabset").index(this._tabUl.find("li.e-active")),c,o,r,h;i<0&&(i=this._tabUl.find(".e-tab,.e-contextualtabset").index(this._tabUl.find("li.e-collapseactive")));t.isNullOrUndefined(this.model.applicationTab)||(tabIndex=i+1);var f=this.element.find(".e-content.e-content-item"),u=this.element.find(".e-active-content"),l=f.eq(tabIndex).attr("id"),s=f.eq(tabIndex).children(".e-groupdiv").length,a=f.eq(tabIndex).children(".e-groupdiv")[s-1],e=f.eq(tabIndex).children(".e-groupdiv").eq(s-1).find(".e-resizebtn");if(i!=-1&&this.element.find(".e-content-item").eq(tabIndex).children().not(".e-expandcollapse").length>0&&this._mobileContents[i].mobileContent.length>0&&!u.find(".e-respmobcontent").length>0){for(u.prepend(t.buildTag("div#"+this._id+"_mobcontent").addClass("e-respmobcontent e-groupmobdiv").append(t.buildTag("div#"+this._id+"_mobribgroup").addClass("e-mobribgroup e-mobribgroupactive").append(t.buildTag("div.e-ribupdivarrow").addClass("e-toolbaralign").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribdownarrow"))))).click(n.proxy(this._onGroupClick,this)).click(n.proxy(this._onMobContentClick,this)),u.find(".e-resgroupheader").removeClass("e-resgroupheader"),c=this._mobileToolbar[i].Content.length,o=0;o<c;o++)u.find(".e-mobribgroup").append(this._mobileToolbar[i].Content[o]);u.find(".e-mobribgroup").append(u.find(".e-mobribgroup .e-ribupdivarrow"))}for(r=s-1;r>=0;r--)e=f.eq(tabIndex).children(".e-groupdiv").eq(r).find(".e-resizebtn"),e.length==0&&(r!=0||this._mobileContents[i].mobileContent.length>0)?this._createResizeBtn(tabIndex,r):r==0&&e.length>0&&!this._mobileContents[i].mobileContent.length>0&&(h=e.parent().siblings(),e.parent().remove(),h.show(),h.not(".e-contentbottom").css("width",""))},_ribbonWindowResize:function(){var o,e,s,h,w,b,k,d,tt,g,f,r,l;this._phoneMode=(this.model.allowResizing||this.model.isResponsive)&&document.documentElement.clientWidth<420?!0:!1;var nt=this._tabUl.find(".e-tab,.e-contextualtabset").index(this._tabUl.find("li.e-active")),y=this.element.find(".e-ribbonpin"),u=this.element.find(".e-active-content").eq(0),a=this.element.find(".e-ribresmenu"),v,c,i,p=this.element.find(".e-respcontent");if(t.isNullOrUndefined(this.model.applicationTab)||(tabIndex=nt+1),this.element.find(".e-ribGroupContent.e-resshow").addClass("e-reshide"),this._phoneMode){this._responsiveScrollRemove();p.is(":hidden")&&this.element.find(".e-responsivecontent").is(":hidden")&&p.removeClass("e-reshide");this._isCollapsed?this._tabUl.find(".e-active").length>0?a.find("a").text(this._tabUl.find(".e-active a").text()):(this._responsiveTabText.eq(0).addClass("e-resactive"),a.find("a").text(this._responsiveTabText.filter(".e-resactive").text())):(this._responsiveTabText.filter(".e-resactive").removeClass("e-resactive"),this._responsiveTabText.eq(n(this._ribbonTabs.filter(".e-tab ,.e-contextualtabset")).index(this._ribbonTabs.filter(".e-active"))).addClass("e-resactive"),a.find("a").text(this._responsiveTabText.filter(".e-resactive").text()));y.length>0&&y.trigger("click");u.addClass("e-responsiveheight e-rbnmobheader").addClass("e-tab_"+this._tabUl.find(".e-active a").text());u.hasClass("e-respcontent")||u.addClass("e-respcontent");o=u.find(".e-groupresponsive");(n(o).eq(0).hasClass("e-ribdownarrow")||o.hasClass("e-ribuparrow"))&&o.hasClass("e-ribuparrow")&&o.eq(0).removeClass("e-ribuparrow").addClass("e-ribdownarrow");t.isNullOrUndefined(this.model.applicationTab)||this.element.find(".e-ribresmenu").css("padding-left","12px");this._ribbonResGroup();this.element.addClass("e-responsive");this.element.find(".e-rbn-ddl.e-ddl").addClass("e-rbn-resize");c=this.element.find(".e-ribbonbackstagepage");v=this.element.find(".e-responsivebackstage");e=this.element.find(".e-header").width();this.model.enableOnDemand&&this.element.find(".e-backstagetab .e-resbackstage").length==0?(this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&this._applicationTab.addClass("e-backstagetab"),this.element.find(".e-backstagetab").append(t.buildTag("span.e-icon").addClass("e-ribbon e-resbackstage").click(n.proxy(this._onResponsiveHeaderClick,this))),this.element.find(".e-header").addClass("e-resheader")):this.model.applicationTab.type==t.Ribbon.ApplicationTabType.Backstage&&this.element.find(".e-backstagetab .e-resbackstage").length==0?(this.element.find(".e-backstagetab").append(t.buildTag("span.e-icon").addClass("e-ribbon e-resbackstage").click(n.proxy(this._onResponsiveHeaderClick,this))),this.element.find(".e-header").addClass("e-resheader")):this.model.applicationTab.type==t.Ribbon.ApplicationTabType.Menu&&this.model.applicationTab.menuItemID&&(this.element.find(".e-header").addClass("e-resheader"),this.element.find(".e-rescontent").addClass("e-rescontent-menu"));this.model.showQAT&&(this._tabUl.find("li.e-responsiveqat").append(this.element.find(".e-rbnquickaccessbar.e-rbnabove").children()),s=this.element.find(".e-ribdownarrow").not(".e-groupresponsive"),this.element.find(".e-resqatScroll").length>0&&(h=this.element.find(".e-resqatScroll"),h.data("ejScroller")._destroy(),h.parent().append(h.find("div:first").children()),h.remove()),w=e-(s.offset().left+s.outerWidth())<e-this.element.find("li.e-responsiveqat").offset().left,w&&!this.element.find(".e-resqatScroll").length>0&&(b=e-this.element.find("li.e-responsiveqat").offset().left-(e-(s.offset().left+s.outerWidth())),r=t.buildTag("div#"+this._id+"_responsiveqat").addClass("e-resqatScroll").append(t.buildTag("div")),r.find("div").append(this._tabUl.find("li.e-responsiveqat").children()),this._tabUl.find("li.e-responsiveqat").append(r),k=this.element.find(".e-resqatScroll"),k.ejScroller({width:e-this.element.find("li.e-responsiveqat").offset().left-b,height:"",scrollerSize:3,buttonSize:0})));u.find(".e-groupdiv .e-resizebtn").length>0&&!u.find(".e-groupdiv .e-groupresponsive").not(".e-ribdownarrow").length>0&&u.find(".e-groupdiv").find(".e-resizebtn").parent("div").prepend(t.buildTag("div.e-ribrightdivarrow").append(t.buildTag("span.e-icon").addClass("e-groupresponsive e-ribrightarrow")));this._tabUl.find(".e-backstagetab").length>0&&v.length==1&&(d=c.find(".e-ribbonbackstagebody .e-backstageheader"),v.append(d).addClass("e-reshide"));!this.element.find(".e-responsivecontent").length>0&&(r=t.buildTag("div#"+this._id+"_responsive").addClass("e-content e-responsivecontent").click(n.proxy(this._onResizeDivClick,this)),r.append(t.buildTag("div#"+this._id+"_resback").addClass("e-responsiveback").append(t.buildTag("span").addClass("e-groupresponsive e-icon e-ribleftarrow")).append(t.buildTag("div#"+this._id+"+rescontentback").addClass("e-restopbackcontent"))),this.element.append(r.hide()));c.find(".e-ribbonbackstagebody .e-backstagecontent").length>0&&this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").append(c.find(".e-ribbonbackstagebody .e-backstagecontent"));tt=this.element.find(".e-header");g=document.documentElement.clientHeight;i=this.element.find(".e-mobribgroup.e-mobribgroupactive");this.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").css({height:g-this.element.find(".e-backstagerestop").outerHeight()});i.find(".e-ribupdivarrow").removeClass("e-toolbaralign");f=i.find(".e-resptoolbarScroll");f.length>0&&(f.data("ejScroller")._destroy(),f.parent().append(f.find("div:first").children()),f.parents(".e-active-content").removeClass("e-responsiveToolbarScroll"),f.remove());this._phoneMode&&i.outerWidth()>this.element.find(".e-header").outerWidth()?(r=t.buildTag("div#"+this._id+"_responsivetoolbar").addClass("e-resptoolbarScroll").append(t.buildTag("div")),r.find("div").append(i.children()),i.append(r),l=this.element.find(".e-respmobcontent .e-resptoolbarScroll"),l.find(".e-toolbaralign").removeClass("e-toolbaralign"),l.ejScroller({width:this.element.find(".e-header").width(),height:"",scrollerSize:4,buttonSize:0}),l.parents(".e-active-content").addClass("e-responsiveToolbarScroll")):i.find(".e-resptoolbarScroll").length>0&&!i.find("e-responsiveToolbarScroll").length>0?i.parents(".e-active-content").addClass("e-responsiveToolbarScroll"):i.find(".e-ribupdivarrow").addClass("e-toolbaralign");this.goToMainContent();return}this.element.hasClass("e-responsive")&&(this.element.removeClass("e-responsive"),this._ribbonRerender());(this.model.allowResizing||this.model.isResponsive)&&(this.element.find(".e-ribbonpin").length>0&&this.element.find(".e-active-content").eq(0).is(":visible")?this.collapse():this._ribbonResize());this.element.find(".e-ribbonpin").length>0&&this._tabContents.width(this.element.width())},_ribbonResize:function(){var dt,e,r,a,v,ut,i,at,p,w,vt,yt=0,c,b=[],d,o,ft,f,pt=this.element.find(".e-active-content").eq(0),g,u,k,et,ot=this.element.find(".e-ribbonpin"),nt,wt,tt,it,bt,kt,s,l,y,h,ht,rt,ct,lt;if(u=this._tabUl.find("li.e-select:visible,li.e-active:visible"),k=this.element.find(".e-resizediv"),expandDiv=this.element.find(".e-expandcollapse"),o=this.element.find(".e-header"),ot.length>0&&(this._removeRibbonPin(),expandDiv.children().addClass("e-ribbonpin")),o.is(":hidden")&&pt.is(":hidden")&&this._resizeWidth<=this.element.width()+this.element.offset().left&&(o.show(),this._qAccessBar.show(),(this.element.find(".e-expandcollapse").children().hasClass("e-expanded")||o.find(".e-active").length>0)&&(ot.length<=0?(pt.show(),expandDiv.children().addClass("e-expanded").removeClass("e-collapsed")):ot.length>0&&this.collapse())),g=o.find("li.e-select,li.e-active"),ut=g.length,o.is(":visible")){for(l=ut-1;l>0;l--)for(i=g.eq(l).children(),at=i.text().length-1,y=at;y>1;y--)u.length>0&&(a=u.last().offset().left,v=u.last().width(),(this.element.width()+this.element.offset().left-30-(a+v)<=0||this.model.enableRTL&&u.last().offset().left<this.element.offset().left)&&(i.hasClass("e-resizeHead")?i.text(i.text().slice(0,-1)):i.text(i.text().slice(0,-1)).addClass("e-resizeHead")));et=o.find(".e-resizeHead");ut-1===et.length&&et.eq(0).text().length<=2&&u.length>0&&(a=u.last().offset().left,v=u.last().width(),this.element.width()+this.element.offset().left-30-(a+v)<=0&&(this._resizeWidth=this.element.width()+this.element.offset().left))}if(r=this._tabObj.model.selectedItemIndex,f=this.element.find(".e-content.e-content-item"),dt=f.eq(r).attr("id"),p=f.eq(r).children(".e-groupdiv").length,e=f.eq(r).children(".e-groupdiv")[p-1],ft=f.eq(r).children().eq(p-1).find(".e-resizebtn"),!t.isNullOrUndefined(e)){for(s=p-1;s>=0;s--)ft=f.eq(r).children().eq(s).find(".e-resizebtn"),(this.element.width()+this.element.offset().left-25-(e.offsetWidth+n(e).offset().left)<=0||this.model.enableRTL&&n(window).width()-this.element.offset().left+25-(n(window).width()-n(e).offset().left+e.offsetWidth)<=0)&&ft.length===0&&this._createResizeBtn(r,s);this.element.width()+this.element.offset().left-25-(e.offsetWidth+n(e).offset().left)<=0||this.model.enableRTL&&n(window).width()-this.element.offset().left+25-(n(window).width()-n(e).offset().left+e.offsetWidth)<=0?p===f.eq(r).find(".e-resizebtn").length&&(this._resizeWidth=this.element.width()+this.element.offset().left,this.element.addClass("e-grpdivhide"),this.element.find(".e-expandcollapse").css("display","none")):(this.element.removeClass("e-grpdivhide"),this.element.find(".e-expandcollapse").css("display","block"))}for(this._qatResize(),k.is(":visible")&&(nt=k.children().eq(0).attr("id"),nt="#"+nt.replace("_content",""),k.children().hide().appendTo(nt),k.hide()),wt=this.model.tabs.length,tt=0;tt<wt;tt++)it=this.model.tabs[tt].text,b.push(it);if(this.model.contextualTabs)for(bt=this.model.contextualTabs.length,h=0;h<bt;h++)if(this.model.contextualTabs[h].tabs)for(kt=this.model.contextualTabs[h].tabs.length,s=0;s<kt;s++)it=this.model.contextualTabs[h].tabs[s].text,b.push(it);if(resizeHeadLen=o.find(".e-resizeHead").length,o.is(":visible"))for(l=0;l<resizeHeadLen;l++)if(i=o.find(".e-resizeHead").eq(0),i.hasClass("e-resizeHead")){var st=g.find(".e-link").not(".e-resizeHead").length-1,gt=i.text().length,ni=b[st].length;for(y=gt;y<=ni;y++)u.length>0&&(a=u.last().offset().left,v=u.last().width()+15,(this.element.width()+this.element.offset().left-30>=a+v&&!this.model.enableRTL||this.model.enableRTL&&u.last().offset().left-15>this.element.offset().left)&&(i.text().length===b[st].length?i.removeClass("e-resizeHead"):this._width!=this.element.width()&&i.text(b[st].slice(0,i.text().length+1))))}for(yt=f.eq(r).find(".e-resizebtn").length,h=0;h<yt;h++)if(c=f.eq(r).find(".e-resizebtn").eq(0),n(c).is(":visible")){if(vt=this.element.width()+this.element.offset().left-25,w=c.offset().left+c.parent().siblings().not(".e-contentbottom").width(),this.model.enableRTL&&(w=this.element.width()+this.element.offset().left-c.offset().left+c.parent().siblings().not(".e-contentbottom").width()),ht=f.eq(r).find(".e-resizebtn").length,ht>1)for(rt=0;rt<ht;rt++)w=w+f.eq(r).find(".e-resizebtn").eq(rt).parents(".e-groupdiv").width()+7;vt>w&&(ct=c.parent().siblings(),c.parent().remove(),ct.show(),ct.not(".e-contentbottom").css("width",""))}this._qatResizeRemove();d=this.element.find(".e-tooltipdiv");d.hide();d.find(".e-tooltiptitle").children().remove();d.find(".e-tooltipdesc").children().remove();this.element.find(".e-ribbonpin").length>0&&this.element.find(".e-active-content").eq(0).is(":visible")&&(this._addRibbonPin(),this._tabContents.width(this.element.width()));this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active");this.model.showQAT&&(lt=this.element.find(".e-rbnqatmenu"),lt.is(":visible")&<.hide().css({top:"",left:""}),this.element.find(".e-qaresizebtn,.e-splitbtnqat").removeClass("e-tbtn e-active"))},_qatResize:function(){var r,i,e,u,f,o;if(this.model.showQAT&&this._qAccessBar.is(":visible")){for(e=this._qAccessBar.children(":visible").length,u=0;u<e;u++)r=this._qAccessBar.children(":visible").last(),this.element.width()-(r.width()+n(r).position().left+6)<=0&&(r.hasClass("e-splitbtnqatdiv")?(f=t.buildTag("div.e-qaresizebtndiv").attr("title","More Controls"),o=t.buildTag("button.e-qaresizebtn"),i=t.buildTag("div.e-qaresizediv").hide(),this.element.append(i),i.append(r.prev()),f.append(o.ejButton({size:"normal",type:"button",contentType:"imageonly",height:30,width:14,prefixIcon:"e-icon e-ribbon e-qaresizebtnicon",click:n.proxy(this._onQatResizeBtnClick,this)})),i.append(r),f.insertBefore(this.element.find(".e-rbnqatmenu"))):r.hasClass("e-qaresizebtndiv")&&(i=this.element.find(".e-qaresizediv"),i.prepend(r.prevAll(":visible").first())));i=this.element.find(".e-qaresizediv");i.is(":visible")&&i.hide()}},_qatResizeRemove:function(){var n=this.element.find(".e-qaresizediv"),e=this.element.width(),i=0,r,u,f,t;if(n.length>0&&this._qAccessBar.is(":visible")&&this.model.showQAT){for(n.show(),r=this.element.find(".e-qaresizebtndiv"),u=this._qAccessBar.children(":visible").length,f=n.children().length,t=0;t<u;t++)i=i+this._qAccessBar.children(":visible").eq(t).width()+6;for(t=0;t<=f;t++)i=n.children().length>2?i+n.children().eq(0).width():i+n.width(),e>i&&(n.children().length>2?n.children().eq(0).insertBefore(r):(n.children().insertBefore(r),this.element.find(".e-qaresizebtndiv").remove(),n.remove()));n.hide()}},_createResizeBtn:function(i,r){var e,l,o=this.element.find(".e-content.e-content-item"),u,s,f,h;u=o.eq(i).children(".e-groupdiv").eq(r);f=u.height();h=t.isNullOrUndefined(this.model.tabs[i-1].groups[r].id)?this.model.tabs[i-1].groups[r].text:this.model.tabs[i-1].groups[r].id;e=u.find(".e-contentbottom").text();s=u.children().not(".e-contentbottom");l=s.width();t.isNullOrUndefined(this._responsiveContentStyle)&&(this._responsiveContentStyle={height:f});u.children().hide();s.css("width",l);var a=t.buildTag("div.e-resizegroupdiv#"+this._id+"_resizeDiv_"+h),c=t.buildTag("button#"+this._id+"_resizebtn_"+h,e,{},{type:"button"}).addClass("e-resizebtn e-rbn-button"),v={target:o.eq(i).children(".e-groupdiv").eq(r).children()};c.ejButton({click:n.proxy(this._resizeBtnClick,v),contentType:t.ContentType.TextAndImage,imagePosition:t.ImagePosition.ImageBottom,prefixIcon:"e-icon e-ribbonresize"});u.height(f);c.find("div").prepend("<span class='e-icon e-"+e+"'><\/span>").height(f-5);c.appendTo(a);a.appendTo(o.eq(i).children(".e-groupdiv").eq(r))},_resizeBtnClick:function(){},_responsiveCustomize:function(n){n.find(".e-rbn-resize").parents(".e-controlpadding").addClass("e-rbn-resize").addClass("e-rbn-dll-cus");n.find(".e-rbn-resize").parents(".e-innerdivrow").addClass("e-rbn-resize").next().css("display","inline-block")},_responsiveContentShow:function(n){var r=this.element.find(".e-active-content"),i;this._responsiveCustomize(n);r.addClass("e-reshide");n.addClass("e-resshow");this.element.find(".e-responsivecontent .e-ribGroupContent").addClass("e-resshow");n.find(".e-ribGroupContent").height()>this._responsiveHeight&&(i=t.buildTag("div#"+this._id+"_responsivecontentScroll").addClass("e-rescontentScroll").append(t.buildTag("div")),i.find("div").append(n.children(".e-ribGroupContent")),n.append(i),n.find(".e-rescontentScroll").ejScroller({height:this._responsiveHeight,scrollerSize:8,buttonSize:0}));r.find(".e-resizebtnselect").removeClass("e-resizebtnselect")},_responsiveContentBack:function(){this._responsiveTarget.append(this._responsiveContent).find(".e-ribGroupContent").addClass("e-reshide").css(this._responsiveContentStyle);this._responsiveContent=null;this.element.find(".e-resizebtn.e-active").removeClass("e-active e-resizebtnselect");this.element.find(".e-galleryexpand.e-gallerymoveicon").length>0&&this.element.find(".e-galleryexpand.e-gallerymoveicon").trigger("click");this.element.find(".e-content.e-responsivecontent").children().not(".e-responsiveback").remove();this.element.find(".e-active-content").removeClass("e-reshide");this.element.find(".e-responsivecontent").removeClass("e-resshow")},_ribbonDocClick:function(i){var u,y,h,f,c,e,l;if(this.element.hasClass("e-responsive")){var r=i.target,o={},k=this,s=this.element.find(".e-responsivebackstage"),a=this.element.find(".e-responsivetabheader"),v=this.element.find(".e-active-content"),d=this.element.find(".e-responsivebackstage");if(!n(i.target).parents(".e-ribbon").length>0&&!(i.target==document.documentElement)&&!n(i.target).parents(".e-rbn-ddl").length>0&&!n(i.target).parents(".e-popup").length>0&&!this.element.find(".e-responsivecontent").is(":visible")){if(a.removeClass("e-resshow"),s.is(":visible")&&s.removeClass("e-backstageshowanimate"),this.element.find(".e-responsivecontent").is(":visible")&&this._responsiveContentBack(),this.element.find(".e-responsivebackstagecontent").hide(),!v.hasClass("e-responsiveheight")){v.addClass("e-responsiveheight e-rbnmobheader");this._responsiveScrollRemove();v.find(".e-groupresponsive.e-ribuparrow").removeClass("e-ribuparrow").addClass("e-ribdownarrow");o.isMobile=this.element.hasClass("e-responsive");o.target=r;o.currentTarget=i.currentTarget;o.eventType=i.type;this.element.find(".e-content.e-content-item").on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){k._trigger("collapse",o)})}return}if((n(r).hasClass("e-header")||n(r).hasClass("e-ribGroupContent")||n(r).hasClass("e-groupresponsive")||n(r).hasClass("e-respmobcontent"))&&(a.hasClass("e-resshow")&&a.removeClass("e-resshow"),s.is(":visible")&&s.removeClass("e-backstageshowanimate")),n(r).parent().hasClass("e-backstagerestopcontent")&&!n(".e-ddl-popup").is(":visible")){n(r).parents(".e-responsivebackstagecontent").hide();return}return}if(l=this.element.find(".e-gallexpandcontent"),f=this.element.find("#"+this._id+"_modelDiv"),c=this.element.find(".e-active-content"),f.is(":visible")&&f.hide(),l.hasClass("e-gallerypopupshow")&&(l.removeClass("e-gallerypopupshow"),f.hide()),(n(".e-rbn-splitbtn").parents().hasClass("e-active")||this.element.find(".e-resizebtn").hasClass("e-resizebtnselect")||n(".e-ddl-popup.e-rbn-ddl:visible").length>0||this.element.find(".e-colorwidget").hasClass("e-active"))&&c.append(f.show().height("100%")),e=n(".e-ribbonpopup:visible"),e.length>0&&!e.hasClass("e-ribbonpopupshow")?(e.addClass("e-ribbonpopupshow"),c.append(f.show().height("100%"))):e.hasClass("e-ribbonpopupshow")&&e.removeClass("e-ribbonpopupshow"),(n(i.target).hasClass("e-expgallerydiv")||n(i.target).parents(".e-expgallerydiv").length>0)&&(l.addClass("e-gallerypopupshow"),c.append(f.show().height("100%"))),n(i.target).hasClass("e-gallerymoveicon")||n(i.target).hasClass("e-gallerymovediv")||n(i.target).hasClass("e-expgallerydiv")||n(i.target).hasClass("e-scrollbar")||n(i.target).parents().hasClass("e-scrollbar")?u=i.target:n(i.target).parents().hasClass("e-gallerymenu")&&(n(i.target).hasClass("e-haschild")||n(i.target).hasClass("aschild")||n(i.target).hasClass("e-arrows"))&&(u=i.target),t.isNullOrUndefined(u)&&this._ribbonGalleryShow(),y=this.element.find(".e-tooltipdiv"),disabled=n(i.target).find(".e-disable"),y.is(":visible")&&n(disabled).length<=0&&!n(i.target).hasClass("e-disable")&&y.hide(),(n(i.target).hasClass("e-backstagechild")||n(i.target).parents(".e-backstagechild").length>0||n(i.target).hasClass("e-ribbonbackstagepage")||n(i.target).hasClass("e-apptab")||n(i.target).parents(".e-ribbonbackstagepage").length>0||n(i.target).parents(".e-apptab").length>0)&&(u=i.target),t.isNullOrUndefined(u)&&n(document).find(n(i.target)).length==0&&(u=n(i.currentTarget.activeElement)),t.isNullOrUndefined(u)&&this.element.find(".e-ribbonbackstagepage").hide(),!n(i.target).hasClass("e-disable-item")&&n(i.target).parents(".e-disable-item").length<=0&&this.element.find(".e-controlclicked").removeClass("e-controlclicked"),h=n(i.target).parents(".e-controlpadding"),h.length>0&&n(disabled).length<=0&&!n(i.target).hasClass("e-disable")&&n(h).find(".e-ribbongallerycontrol").length<=0&&n(h).addClass("e-controlclicked"),this.element.find(".e-ribbonpin").is(":visible")&&n(i.target).parents(".e-ribbon").length<=0&&!n(i.target).hasClass("e-scrollbar")&&!n(i.target).parents().hasClass("e-scrollbar")&&this.collapse(),this.element.find(".e-resizediv").is(":hidden")&&this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active"),this._tabUl.find(".e-link.e-active").removeClass("e-active"),this.model.showQAT){var p=this.element.find(".e-rbnqatmenu"),w=this.element.find(".e-qaresizediv"),b=this.element.find(".e-splitbtnqat");!n(i.target).hasClass("e-splitbtnqatdiv")&&n(i.target).parents(".e-splitbtnqatdiv").length<=0&&n(i.target).parents(".e-rbnqatmenu").length<=0&&p.hide().css({top:"",left:""});!n(i.target).hasClass("e-qaresizebtndiv")&&p.is(":hidden")&&n(i.target).parents(".e-qaresizediv").length<=0&&n(i.target).parents(".e-qaresizebtndiv").length<=0&&!n(i.target).hasClass("e-splitbtnqatdiv")&&n(i.target).parents(".e-splitbtnqatdiv").length<=0&&w.hide().css({top:"",left:""});w.is(":hidden")&&this.element.find(".e-qaresizebtn").hasClass("e-active")&&!n(i.target).hasClass("e-qaresizebtndiv")&&n(i.target).parents(".e-qaresizebtndiv").length<=0&&n(i.target).parents(".e-rbnqatmenu").length<=0&&this.element.find(".e-qaresizebtn").removeClass("e-tbtn e-active");b.hasClass("e-active")&&!n(i.target).hasClass("e-splitbtnqatdiv")&&n(i.target).parents(".e-splitbtnqatdiv").length<=0&&n(i.target).parents(".e-rbnqatmenu").length<=0&&b.removeClass("e-tbtn e-active")}},_ribbonGalleryShow:function(){var f=0,r,e,u,i,o,s,t;if(this.element.find(".e-gallexpandcontent:visible").length>0){for(r=0,e=0,gallery=this.element.find(".e-gallexpandcontent:visible").parent().find(".e-ribbongallery"),u=gallery.find(".e-galleryrow").length,t=1;t<=u;t++)gallery.find(".e-galleryrow").eq(t-1).css("display")==="block"&&(r===0&&(f=t-1),++r);for(gallery.find(".e-galleryrow").hide(),gallery.parent().find(".e-gallexpandcontent").hide(),gallery.show(),gryColumns=gallery.find(".e-galleryrow").eq(0).children().length,gallery.find(".e-galleryrow").eq(0).children().remove(),u=gallery.find(".e-galleryrow").length,i=0;i<u;i++)for(o=0;o<gryColumns;o++)if(s=gallery.parent().find(".e-galleryexpanderrow").children().eq(0),n(s).hasClass("e-galleryselect")){for(gallery.find(".e-galleryrow").eq(i).append(gallery.parent().find(".e-galleryexpanderrow").children().eq(0)).show(),--r,t=1;t<=r;t++)gallery.find(".e-galleryrow").eq(i+t).length>0?gallery.find(".e-galleryrow").eq(i+t).show():(++e,gallery.find(".e-galleryrow").eq(i-e).show());gallery.find(".e-galleryrow").last().is(":visible")?gallery.parent().find(".e-movedowndiv").addClass("e-disablegrymovebtn"):gallery.parent().find(".e-movedowndiv").removeClass("e-disablegrymovebtn");gallery.find(".e-galleryrow").first().is(":visible")?gallery.parent().find(".e-moveupdiv").addClass("e-disablegrymovebtn"):gallery.parent().find(".e-moveupdiv").removeClass("e-disablegrymovebtn")}else gallery.find(".e-galleryrow").eq(i).append(gallery.parent().find(".e-galleryexpanderrow").children().eq(0));if(gallery.find(".e-galleryselect").length<=0)for(t=0;t<r;t++)gallery.find(".e-galleryrow").eq(f).show(),++f;gallery.parent().find(".e-galleryexpanderrow").remove()}},_resizeDivHide:function(){var i=this.element.find(".e-resizediv"),r;this._off(n(document),"mousedown",this._rbndocumentClick);n(i).is(":visible")&&(r=n(i).children().eq(0).attr("id"),t.isNullOrUndefined(r)||(r="#"+r.slice(0,-8),n(i).children().hide().appendTo(r),this.element.find("#"+this._id+"_disabled").hide(),n(i).hide()),this.element.find(".e-ribbonpin").length>0&&n(i).css({top:""}))},_resizeDivShow:function(t){var u,f,i,e,r=this.element.find(".e-resizediv");i=this.element.find("#"+t[0].id).parent().siblings();u=i.not(".e-contentbottom").width()+i.parent().offset().left;this.model.enableRTL&&(u=i.not(".e-contentbottom").width()+(this.element.width()+this.element.offset().left-i.parent().offset().left));this.element.css({position:"relative"});n(r).css({left:""});u>this.element.width()+this.element.offset().left?(f=i.parent().position().left-(u-(this.element.width()+this.element.offset().left)),this.model.enableRTL&&(f=this.element.width()+(this.element.offset().left-i.parent().offset().left)-(u-(this.element.width()+this.element.offset().left-i.parent().width()))),e=parseInt(n(r).css("padding-left"),10)+parseInt(n(r).css("padding-right"),10),this.model.enableRTL?n(r).css({right:f+e-1}):n(r).offset({left:f-e})):this.model.enableRTL?n(r).css({right:this.element.width()+(this.element.offset().left-i.parent().offset().left)-i.parent().outerWidth()}):n(r).offset({left:i.parent().position().left});this.element.find(".e-ribbonpin").length>0&&n(r).offset({top:this.element.height()+this.element.find(".e-active-content").eq(0).height()});n(r).width(i.not(".e-contentbottom").css("width"));n(r).append(i.show()).show();this.element.hasClass("e-grpdivhide")&&(this.element.removeClass("e-grpdivhide"),this.element.find(".e-active-content").eq(0).addClass("e-resdivshow"));this._on(n(document),"mousedown",this._rbndocumentClick)},_rbndocumentClick:function(t){this.element.find(".e-resizediv").is(":visible")&&n(t.target).parents(".e-resizediv").length<=0&&n(t.target).parents(".e-rbn-ddl").length<=0&&!n(t.target).hasClass("e-rbn-splitbtn")&&n(t.target).parents(".e-colorpicker.e-ribbon:visible").length<=0&&n(t.target).parents(".e-rbn-splitbtn:visible").length<=0&&this._resizeDivHide();this.element.find(".e-resizediv").is(":hidden")&&this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active")},_ribbonDocRightClick:function(t){var r,i;r=n(t.target).parents(".e-resizediv");r.length<=0&&this._resizeDivHide();this.element.find(".e-resizediv").is(":hidden")&&this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active");this.element.find(".e-gallexpandcontent").hasClass("e-gallerypopupshow")&&this._ribbonGalleryShow();n(this.element.find(".e-ribbonbackstagepage")).is(":visible")&&this.element.find(".e-ribbonbackstagepage").hide();i=this.element.find(".e-tooltipdiv");i.is(":visible")&&i.hide()},_onTabDblClick:function(t){this._phoneMode||this.element.find(".e-apptab .e-menu ul").is(":visible")||this.element.find(".e-ribbonbackstagepage").is(":visible")||(n(t.target).closest(".e-tab.e-disable").length||(this.element.find(".e-collapsed .e-rarrowup-2x").length&&this.expand(),this.element.find(".e-expanded .e-rarrowup-2x").length&&this.collapse(),this.element.find(".e-expanded.e-ribbonpin").length&&this._removeRibbonPin()),this._clickValue=t.type)},_ribbonhover:function(t){this._phoneMode&&(t.type=="mouseover"?n(t.currentTarget).hasClass("e-resizegroupdiv")&&n(t.currentTarget).addClass("e-reshover"):t.type=="mouseout"&&n(t.currentTarget).hasClass("e-resizegroupdiv e-reshover")&&n(t.currentTarget).removeClass("e-reshover"))},_wireEvents:function(){this._on(n(document),"keydown",this._OnKeyDown);this._on(this.element,"keydown",this._ribbonKeyDown);this._on(this.element,"mouseover mouseout",".e-resizegroupdiv",this._ribbonhover);this._on(this.element.find("#"+this._id+"_expandCollapse"),t.eventType.click,this._tabExpandCollapse);this._on(this.element.find(".e-groupexpander"),t.eventType.click,this._onGroupExpandClick);this._on(this.element.find(".e-qatmenuli"),t.eventType.click,this._onQatMenuItemClick);this._on(n(window),"resize",this._ribbonWindowResize);this._on(n(document),"click",this._ribbonDocClick);this._on(n(document),"contextmenu",this._ribbonDocRightClick);this._on(this.element.find(".e-header > li"),"dblclick",this._onTabDblClick)}});t.Ribbon.alignType={rows:"rows",columns:"columns"};t.Ribbon.AlignType={Rows:"rows",Columns:"columns"};t.Ribbon.applicationTabType={menu:"menu",backstage:"backstage"};t.Ribbon.ApplicationTabType={Menu:"menu",Backstage:"backstage"};t.Ribbon.quickAccessMode={none:"none",toolBar:"toolbar",menu:"menu"};t.Ribbon.QuickAccessMode={None:"none",ToolBar:"toolbar",Menu:"menu"};t.Ribbon.type={button:"button",splitButton:"splitbutton",dropDownList:"dropdownlist",custom:"custom",toggleButton:"togglebutton",gallery:"gallery"};t.Ribbon.Type={Button:"button",SplitButton:"splitbutton",DropDownList:"dropdownlist",Custom:"custom",ToggleButton:"togglebutton",Gallery:"gallery"};t.Ribbon.customItemType={button:"button",menu:"menu"};t.Ribbon.CustomItemType={Button:"button",Menu:"menu"};t.Ribbon.itemType={button:"button",tab:"tab"};t.Ribbon.ItemType={Button:"button",Tab:"tab"};t.Ribbon.Locale=t.Ribbon.Locale||{};t.Ribbon.Locale["default"]=t.Ribbon.Locale["en-US"]={CustomizeQuickAccess:"Customize Quick Access Toolbar",RemoveFromQuickAccessToolbar:"Remove from Quick Access Toolbar",AddToQuickAccessToolbar:"Add to Quick Access Toolbar",ShowAboveTheRibbon:"Show Above the Ribbon",ShowBelowTheRibbon:"Show Below the Ribbon",MoreCommands:"More Commands..."}}(jQuery,Syncfusion);InternalAdaptive=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._kbnTimeoutSearch=function(n,t){var i=n.data("ejKanban"),r;r=t.currentTarget;i._searchTout&&(i._searchTout=window.clearInterval(i._searchTout));i._searchTout=window.setInterval(function(){$(".e-kanbanwaitingpopup").removeClass("e-kanbanwaitingpopup").addClass("e-kbnsearchwaitingpopup");n.data("ejWaitingPopup").show();$(".e-kbnsearchwaitingpopup").css({top:"1px",left:"1px"});var u=setTimeout(function(){var f=$(r).find("input").val(),e,o;ej.isNullOrUndefined(f)&&(f=$(r).val());e={itemName:r.title,itemId:r.id,target:r,currentTarget:r,itemIndex:$(r).index(),toolbarData:t,itemText:f};i._trigger("toolbarClick",e);i.KanbanFilter.searchCards(f);i.element.find(".e-searchbar .e-search.e-tooltxt").addClass("e-highliht-kbnsearchbar");$(".e-kbnsearchwaitingpopup").addClass("e-kanbanwaitingpopup").removeClass("e-kbnsearchwaitingpopup").css({top:"0px",left:"0px"});ej.isNullOrUndefined(i.model.fields.swimlaneKey)||(o=(new ej.Query).where(ej.Predicate.or(i.keyPredicates)).select(i.model.fields.swimlaneKey),i._kbnAdaptDdlData=new ej.DataManager(i._currentJsonData).executeLocal(o),i._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(i._kbnAdaptDdlData)),i.KanbanAdaptive._adaptiveSwimlaneRefresh());n.data("ejWaitingPopup").hide();clearTimeout(u)},300);i._searchTout=window.clearInterval(i._searchTout)},1e3)},n.prototype._kbnRightSwipe=function(){var n=this.kanbanObj,h=n.element.width(),l=n.element.find(".e-rowcell:visible"),o,r=n.element.find(".e-stackedHeaderCell"),f=0,u,e,i,a=n,t,c,s;if(n._kbnSwipeCount>0){for(n._kbnSwipeCount==1?n._kbnSwipeWidth=0:(i=l.eq(n._kbnSwipeCount-1),i.length==0&&(i=n.element.find(".e-headercell:visible").not(".e-stackedHeaderCell").eq(n._kbnSwipeCount-1)),n._kbnSwipeWidth=n._kbnSwipeWidth-i.offset().left,window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?o=(h-i.width())/2:(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(o=(h-i.width())/8),n._kbnSwipeWidth=n._kbnSwipeWidth+o),t=0;t<r.length;t++)if(c=n.headerContent.find("col:eq(0)").width(),u=f,e=n._kbnSwipeCount-1,f=f+parseInt($(r).eq(t).attr("colspan")),e>=u&&e<f)if(u==n._kbnSwipeCount-1){n.element.find(".e-adapt-stheader").removeClass("e-adapt-stheader");$(r).eq(t).find("div").css({position:"",left:""});s=$(r).eq(t).prev(".e-stackedHeaderCell");s.length>0&&s.addClass("e-adapt-stheader");break}else if(u<n._kbnSwipeCount-1){$(r).eq(t).find("div").css({position:"relative",left:c*(n._kbnSwipeCount-1-u)+8*(e-1)});break}n._kbnTransitionEnd=!1;n._kbnSwipeCount>1&&(n._kbnSwipeWidth=n._kbnSwipeWidth+n.element.offset().left);n.headerContent.find("table").css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""}).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){a._kbnTransitionEnd=!0});n.kanbanContent.find("table").eq(0).css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""});--n._kbnSwipeCount}},n.prototype._kbnLeftSwipe=function(){var n=this.kanbanObj,e=n.element.width(),l=n.element.find(".e-rowcell:visible"),o,r=n.element.find(".e-stackedHeaderCell"),s=0,f,u,i,a=n,c,t,h;if((window.matchMedia("(max-width: 600px)").matches||window.matchMedia("((max-device-width: 800px)").matches)&&n._kbnSwipeCount<n.model.columns.length-1||(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&n._kbnSwipeCount<n.model.columns.length-2){for(i=l.eq(n._kbnSwipeCount+1),i.length==0&&(i=n.element.find(".e-headercell:visible").not(".e-stackedHeaderCell").eq(n._kbnSwipeCount+1)),n._kbnSwipeWidth=n._kbnSwipeWidth-i.offset().left,window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?o=n._kbnSwipeCount==n.model.columns.length-2?e-i.width():(e-i.width())/2:(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(n._kbnSwipeCount==n.model.columns.length-3?(c=parseInt(n.contentTable.css("border-spacing").split("px")[0]),o=e-(i.width()+c)*2):o=(e-i.width())/8),n._kbnSwipeWidth=n._kbnSwipeWidth+o,t=0;t<r.length;t++)if(h=n.headerContent.find("col:eq(0)").width(),f=s,u=n._kbnSwipeCount+1,s=s+parseInt($(r).eq(t).attr("colspan")),u>f&&u<s)if(t==0){$(r).eq(t).addClass("e-adapt-stheader");$(r).eq(t).find("div").css({position:"relative",left:h*u+8*(u-1)});break}else if(f==n._kbnSwipeCount+1){n.element.find(".e-adapt-stheader").removeClass("e-adapt-stheader");$(r).eq(t-1).find("div").css({position:"",left:""});$(r).eq(t).addClass("e-adapt-stheader");break}else if(f<n._kbnSwipeCount+1){$(r).eq(t).find("div").css({position:"relative",left:h*(n._kbnSwipeCount+1-f)+8*(u-1)});break}n._kbnTransitionEnd=!1;n._kbnSwipeWidth=n._kbnSwipeWidth+n.element.offset().left;n.headerContent.find("table").css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""}).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){a._kbnTransitionEnd=!0});n.kanbanContent.find("table").eq(0).css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":""});++n._kbnSwipeCount}},n.prototype._clearAdaptSearch=function(n){var u=this.kanbanObj,t,r=u.element,i=r.data("ejKanban");ej.isNullOrUndefined(n)||(t=$(n.target));ej.isNullOrUndefined(t)||t.hide();r.data("ejWaitingPopup").show();setTimeout(function(){var e,f,o;ej.isNullOrUndefined(t)||(f=t.prev(".e-input"));(ej.isNullOrUndefined(f)||f.length==0)&&(f=ej.isNullOrUndefined(t)?r.find(".e-kanbantoolbar .e-searchdiv > .e-input"):t.next(".e-search").find("input"));e=ej.isNullOrUndefined(t)?{itemText:f.val()}:{target:t,currentTarget:t,itemIndex:t.index(),toolbarData:n,itemText:f.val()};i._trigger("toolbarClick",e);u.KanbanFilter.searchCards("");u.element.find(".e-searchbar .e-search.e-tooltxt").removeClass("e-highliht-kbnsearchbar");ej.isNullOrUndefined(i.model.fields.swimlaneKey)||(o=(new ej.Query).where(ej.Predicate.or(i.keyPredicates)).select(i.model.fields.swimlaneKey),i._kbnAdaptDdlData=new ej.DataManager(i._currentJsonData).executeLocal(o),i._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(i._kbnAdaptDdlData)),i.KanbanAdaptive._adaptiveSwimlaneRefresh());r.data("ejWaitingPopup").hide()},300)},n.prototype._adaptiveKbnClick=function(n){var t=this.kanbanObj,i=$(n.target),r,s,e=t.element.find(".e-swimlane-window"),y,rt,ut,p,o,w,ft,c,l,h,et,u,g,nt,b,k,tt,a,v,ot,d,it,f;if(t.element.hasClass("e-responsive")){if(r=$(".e-kanbanfilter-window"),s=t.element.find(".e-kanbanfilter-icon"),i.hasClass("e-searchitem")&&(y=i.parents(".e-searchbar"),i.prev().show(),i.prev().children(":first").removeAttr("style"),y.siblings().hide(),y.find(".e-adapt-search").length==0&&(rt=ej.buildTag("div.e-icon e-adapt-search e-searchfind","",{}),ut=ej.buildTag("div.e-icon e-adapt-cancel e-cancel","",{}),i.siblings(".e-searchdiv").append(ut).prepend(rt)),i.parents(".e-search").css({border:""}),i.parents("body").addClass("e-kbnwindow-modal"),i.parents(".e-kanbantoolbar").addClass("e-adaptive-search"),y.find(".e-adapt-cancel").show(),i.hide(),n.type==="tap"&&n.preventDefault()),i.hasClass("e-adapt-cancel")&&(this._clearAdaptSearch(n),i.parents(".e-searchbar").siblings(".e-print,.e-kanbanfilter-icon,.e-customtoolbar").show(),p=i.parents(".e-search"),p.find(".e-searchdiv").hide(),p.find(".e-searchitem").show(),p.css({border:"none"}),i.parents("body").removeClass("e-kbnwindow-modal"),i.parents(".e-kanbantoolbar").removeClass("e-adaptive-search")),(i.hasClass("e-filter-done")||i.hasClass("e-clearfilter"))&&(h=i.text(),r.parents("body").removeClass("e-kbnwindow-modal"),i.hasClass("e-clearfilter")&&(h=i.val()),o={target:i,currentTarget:i,itemIndex:i.index(),toolbarData:n,itemText:h},t._trigger("toolbarClick",o),i.hasClass("e-clearfilter")?(t._kbnFilterCollection=[],t._kbnFilterObject=[],t._filterCollection=[],t._kbnAdaptFilterObject=[],i.hide(),s.removeClass("e-kbnclearfl-icon"),r.find(".e-kbnfilter-check").parents('[aria-checked~="true"]').click()):(s.hasClass("e-kbnclearfl-icon")||s.addClass("e-kbnclearfl-icon"),t._kbnFilterObject.length==0&&s.hasClass("e-kbnclearfl-icon")&&s.removeClass("e-kbnclearfl-icon")),o={},o.requestType=ej.Kanban.Actions.Filtering,o.currentFilterObject=[],o.filterCollection=t._kbnFilterCollection,o.currentFilterObject=t._kbnFilterObject,w=t._dataSource()instanceof ej.DataManager?t._dataSource().dataSource.json:t._dataSource(),w.length==0&&t._currentJsonData.length>0&&(w=t._currentJsonData),t._initialData=w,t.KanbanCommon._processBindings(o),ej.isNullOrUndefined(t.model.fields.swimlaneKey)||(t._currentJsonData.length==0?(t.element.find(".e-swimlane-ddl,.e-swimlane-window").remove(),t.kanbanContent.data("ejScroller").destroy()):(ft=(new ej.Query).where(ej.Predicate.or(t.keyPredicates)).select(t.model.fields.swimlaneKey),t._kbnAdaptDdlData=new ej.DataManager(t._currentJsonData).executeLocal(ft),t._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(t._kbnAdaptDdlData)),t.KanbanAdaptive._adaptiveSwimlaneRefresh())),r.hide(),t.kanbanWindowResize(),n.type==="tap"&&n.preventDefault()),i.hasClass("e-filterback-icon")){for(c=[],u=0;u<t.model.filterSettings.length;u++)c.push(t.model.filterSettings[u].text);for(u=0;u<t._kbnAdaptFilterObject.length;u++)h=t._kbnAdaptFilterObject[u].text,et=$.inArray(h,c),c.splice(et,1),l=r.find("label.e-filterlabel:contains("+h+")").prev(),l.attr("aria-checked")=="false"&&l.click();for(u=0;u<c.length;u++)l=r.find("label.e-filterlabel:contains("+c[u]+")").prev(),l.attr("aria-checked")=="true"&&l.click();r.hide();n.type==="tap"&&n.preventDefault()}i.hasClass("e-kanbanfilter-icon")&&(g=r.find(".e-clearfilter"),k=0,tt=r.find(".e-filter-scrollcontent"),e.is(":visible")&&e.hide(),r.show(),i.hasClass("e-kbnclearfl-icon")?g.show():g.hide(),nt=r.find(".e-kbnfilterwindow-head").height(),b=r.find(".e-clearfilter"),b.is(":visible")&&(tt.ejScroller({height:0,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),k=b.outerHeight()+parseInt(b.css("bottom"))),$(window).height()-k<r.find(".e-filter-content").height()+nt&&tt.ejScroller({height:$(window).height()-(nt+k+10),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),r.parents("body").addClass("e-kbnwindow-modal"),n.type==="tap"&&n.preventDefault());(i.attr("id")==this._id+"_Cancel"||i.parent().attr("id")==this._id+"_closebutton")&&t.KanbanEdit.cancelEdit();i.attr("id")==t._id+"_Save"&&t.KanbanEdit.endEdit()}a=t.element.find(".e-slwindow-scrollcontent");(i.hasClass("e-swimlane-item")||i.parents(".e-swimlane-item").length>0)&&(v=i,i.parents(".e-swimlane-item").length>0&&(v=i.parents(".e-swimlane-item")),v.parents(".e-swimlane-ul").find(".e-selected-item").removeClass("e-selected-item"),v.addClass("e-selected-item"),e=$("#"+t._id+"_slWindow"),t._kbnAdaptDdlIndex=t._freezeSlOrder=e.find(".e-swimlane-item").index(v),f=$("#"+t._id+"_toolbarItems"),f.find(".e-kbnhide").removeClass("e-kbnhide"),f.removeClass("e-kbntoolbar-body").prependTo(t.element),e.removeClass("e-kbnslwindow-body").appendTo(t.element).hide(),t.element.find(".e-swimlane-text").text(t._kbnAdaptDdlData[t._kbnAdaptDdlIndex]),ot=t.element[0].getElementsByClassName("e-columnrow"),t.kanbanWindowResize(),d=t.kanbanContent.data("ejScroller"),d.scrollY(0,!0),d.scrollY($(ot[t._kbnAdaptDdlIndex]).offset().top-t.kanbanContent.offset().top,!0),t._freezeScrollTop=d.scrollTop(),a.hasClass("e-scroller")&&a.data("ejScroller").refresh());(i.hasClass("e-swimlane-ddl")||i.parents(".e-swimlane-ddl").length>0)&&(it=36,e.is(":hidden")?(t.element.parents("body").addClass("e-kbnwindow-modal"),f=t.element.find(".e-kanbantoolbar"),f.children().not(".e-swimlane-ddl").addClass("e-kbnhide"),f.addClass("e-kbntoolbar-body").appendTo("body"),t.element.find(".e-swimlane-window").addClass("e-kbnslwindow-body").appendTo("body"),e.show(),$(window).height()<it+a.height()&&a.ejScroller({height:$(window).height()-it,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0})):(e.hide(),f=$("#"+t._id+"_toolbarItems"),f.find(".e-kbnhide").removeClass("e-kbnhide"),f.removeClass("e-kbntoolbar-body").prependTo(t.element),$("#"+t._id+"_slWindow").removeClass("e-kbnslwindow-body").appendTo(t.element).hide(),t.element.parents("body").removeClass("e-kbnwindow-modal")))},n.prototype._kbnFilterChange=function(n){var t=this,s=$(n.event.target).closest(".e-kanban"),l=s.data("ejKanban"),e=$(n.event.target).parents(".e-chkbox-wrap").next().text(),c,o,u,i,f,r,h;if(!t._kbnAutoFilterCheck){for(e==""&&(e=$(n.event.target).next().text()),c=s.find(".e-kanbanfilter-icon"),o=$(".e-kanbanfilter-window .e-filter-done"),o.is(":hidden")&&o.show(),i=0;i<t.model.filterSettings.length;i++)if(t.model.filterSettings[i].text==e)break;if(u=i==t.model.filterSettings.length?null:t.model.filterSettings[i],n.isChecked)for(t._kbnFilterObject.push(u),r=0;r<t.model.filterSettings.length;r++)t.model.filterSettings[r].text==u.text&&(h=t.model.filterSettings[r].query.queries[0].e,t._kbnFilterCollection.push(h));else f=$.inArray(u,t._kbnFilterObject),f>=0&&(t._kbnFilterObject.splice(f,1),t._kbnFilterCollection.splice(f,1))}},n.prototype._kbnAdaptSwimlaneData=function(){var n=this.kanbanObj,r=n,t,i;n.model.isResponsive&&(ej.isNullOrUndefined(n.model.minWidth)||n.model.minWidth==0)&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey)&&(t=new ej.Query,ej.isNullOrUndefined(n.model.keyField)||n._addColumnFilters(),n.model.query._fromTable!=""&&t.from(n.model.query._fromTable),n._dataSource()instanceof ej.DataManager&&t.queries.length&&!n._dataManager.dataSource.offline?(i=n._dataSource().executeQuery(t),i.done(ej.proxy(function(i){this._kbnAdaptDdlData=new ej.DataManager(i.result);t=(new ej.Query).where(ej.Predicate.or(n.keyPredicates)).select(n.model.fields.swimlaneKey);n._kbnAdaptDdlData=n._kbnAdaptDdlData.executeLocal(t);n._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(n._kbnAdaptDdlData))}))):(t=(new ej.Query).where(ej.Predicate.or(n.keyPredicates)).select(n.model.fields.swimlaneKey),n._dataManager.dataSource.offline&&n._dataManager.dataSource.json.length&&(n._kbnAdaptDdlData=n._dataManager.executeLocal(t)),n._kbnAdaptDdlData=ej.dataUtil.mergeSort(ej.dataUtil.distinct(n._kbnAdaptDdlData))))},n.prototype._setResponsiveHeightWidth=function(){var n=this.kanbanObj;if(typeof n.model.scrollSettings.width=="string"?n._originalScrollWidth=n.element.width():n.model.scrollSettings.width>0&&(n._originalScrollWidth=n.model.scrollSettings.width),typeof n.model.scrollSettings.height=="string"?n._originalScrollHeight=n.getContent().height():n.model.scrollSettings.height>0&&(n._originalScrollHeight=n.model.scrollSettings.height),n.model.isResponsive){$(window).on("resize",$.proxy(n.kanbanWindowResize,n));n.kanbanWindowResize()}},n.prototype._renderResponsiveKanban=function(n,t,i,r,u){var f=this.kanbanObj,e;n?(f.model.scrollSettings.width=ej.isNullOrUndefined(f._originalScrollWidth)?Math.min(i,u):Math.min(f._originalScrollWidth,Math.min(i,u)),e=Math.min(r,t),e=ej.isNullOrUndefined(f._originalScrollHeight)?e:Math.min(f._originalScrollHeight,r),f.model.scrollSettings.height=e,f._originalScrollWidth<u&&(f.model.scrollSettings.width=Math.min(i,u)),f.KanbanScroll&&f.KanbanScroll._renderScroller()):(f.model.scrollSettings.width="100%",ej.isNullOrUndefined(f._originalScrollWidth)||(f.model.scrollSettings.width=Math.min(f._originalScrollWidth,i)),e=f.element.outerHeight(),ej.isNullOrUndefined(f._originalScrollHeight)||(e=Math.min(f._originalScrollHeight,r)),f.model.scrollSettings.height=e,f.KanbanScroll&&f.KanbanScroll._renderScroller())},n.prototype._columnTimeoutAdapt=function(){var t=this.kanbanObj,i,e,o,f,n,s,r,u;for(Math.floor(t.element.width())>$(window).width()&&(t.element.width($(window).width()-t.element.offset().left-5),t.headerContent.removeClass("e-scrollcss"),t.headerContent.find(".e-hscrollcss").removeClass("e-hscrollcss")),n=t,window.matchMedia("(max-width: 480px)").matches?i=t.element.width()*(80/100):window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?i=t.element.width()*(60/100):(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(i=t.element.width()*(43/100)),e=t.element.find(".e-headercell"),o=t.element.find(".e-columnrow .e-rowcell"),t.kanbanContent.find("table:eq(0) > colgroup col").width(i),o.width(i),t.headerContent.find("table > colgroup col").width(i),e.not(".e-stackedHeaderCell").width(i),f=t.element.find(".e-stackedHeaderCell"),u=0;u<f.length;u++)$(f).eq(u).width(parseInt($(f).eq(u).attr("colspan"))*i);s=setTimeout(function(){var u,f,h;n._kbnSwipeCount>0&&(r=o.eq(n._kbnSwipeCount),r.length==0&&(r=e.not(".e-stackedHeaderCell").eq(t._kbnSwipeCount)),n._kbnSwipeWidth=n._kbnSwipeWidth-r.offset().left,u=n.element.width(),f=r.width(),window.matchMedia("(max-width: 600px)").matches||window.matchMedia("(max-device-width: 800px)").matches?i=n._kbnSwipeCount==n.model.columns.length-1?n.element.hasClass("e-swimlane-responsive")?u-(f+18):u-f:(u-f)/2:(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches)&&(n._kbnSwipeCount==n.model.columns.length-3?(h=parseInt(n.contentTable.css("border-spacing").split("px")[0]),eqWidth=u-(f+h)*2):i=(u-f)/8),n._kbnSwipeWidth=n._kbnSwipeWidth+i+t.element.offset().left,n.headerContent.find("table").css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":"0ms"}),n.kanbanContent.find("table").eq(0).css({transform:"translate3d("+n._kbnSwipeWidth+"px, 0px, 0px)","transition-duration":"0ms"}),clearTimeout(s))},2500)},n.prototype._addSwimlaneName=function(){for(var r,i,n,u,f=this.kanbanObj.element.find(".e-columnrow"),t=0;t<f.length;t++)for(r=f.eq(t).find(".e-rowcell"),i=0;i<r.length;i++)n=r.eq(i).find(".e-limits"),n.length==0&&(n=ej.buildTag("div.e-limits","",{},{})),n.find(".e-swimlane-name").length==0?(n.append(ej.buildTag("div.e-swimlane-name",this.kanbanObj._kbnAdaptDdlData[t],{},{})),r.eq(i).prepend(n)):(u=n.find(".e-swimlane-name"),u.text(this.kanbanObj._kbnAdaptDdlData[t]),u.show(),u.parents(".e-limits").show())},n.prototype._kbnAdaptSwimlaneDdl=function(){var n=this.kanbanObj,r=ej.buildTag("div.e-swimlane-ddl","",{}),o=n.model.fields.swimlaneKey,u,t,f,e=n.element.find(".e-kanbantoolbar"),i;for(n.element.addClass("e-swimlane-responsive"),ej.buildTag("div.e-swimlane-text",n._kbnAdaptDdlData[0]).appendTo(r),ej.buildTag("div.e-swimlane-arrow").appendTo(r),u=ej.buildTag("div#"+n._id+"_slWindow.e-swimlane-window","",{}),t=ej.buildTag("ul.e-swimlane-ul ","",{}),i=0;i<n._kbnAdaptDdlData.length;i++)ej.buildTag("li.e-swimlane-item ","<div>"+n._kbnAdaptDdlData[i]+"<\/div>",{}).appendTo(t);t.find(".e-swimlane-item:eq(0)").addClass("e-selected-item");this._addSwimlaneName();f=ej.buildTag("div#"+n._id+"_slScrollContent","<div><\/div>").addClass("e-slwindow-scrollcontent");f.children().append(t);f.appendTo(u);u.appendTo(n.element).hide();e.length==0&&(n._renderToolBar().insertBefore(n.element.find(".e-kanbanheader").first()),e=n.element.find(".e-kanbantoolbar").css("padding","0px").addClass("e-sladapt-bar"));e.prepend(r);n.element.find(".e-swimlanerow").hide()},n.prototype._kbnAdaptFilterWindow=function(){var n=this.kanbanObj,h=n.element.find(".e-kanbantoolbar"),i,e,u,o,c,r,s,t,f;for(h.find(".e-quickfilter").parent().hide(),r=ej.buildTag("div.e-kanbanfilter-window","",{}),i=ej.buildTag("div.e-kbnfilterwindow-head","",{}),ej.buildTag("div.e-filterback-icon","",{}).appendTo(i),ej.buildTag("div.e-text","FILTER",{}).appendTo(i),ej.buildTag("div.e-text e-filter-done","DONE",{}).appendTo(i).hide(),i.appendTo(r),$("body").append(r.hide()),e=ej.buildTag("div.e-kbnfilterwindow-body","",{}),o=ej.buildTag("div.e-filter-content"),t=0;t<n.model.filterSettings.length;t++)f=ej.buildTag("div","",{}),f.append("<input type='checkbox' class='e-kbnfilter-check' id='check"+t+"' /><label for='check"+t+"' class='e-filterlabel'>"+n.model.filterSettings[t].text+"<\/label><\/td>"),o.append(f),f.find("input").ejCheckBox({change:$.proxy(this._kbnFilterChange,n)});e.append(o);s=ej.buildTag("div#"+n._id+"_filterScrollContent","<div><\/div>").addClass("e-filter-scrollcontent");s.children().append(e);s.appendTo(r);u=ej.buildTag("input.e-clearfilter","",{},{type:"button",id:n._id+"_ClearFilter"});u.ejButton({text:"ClearFilter"});r.append(u);u.hide();c=ej.buildTag("div.e-kanbanfilter-icon","",{float:"right"});h.append(c)},n.prototype._setAdaptiveSwimlaneTop=function(){var n=this.kanbanObj,i,r,t;n.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey)&&(i=n.kanbanContent.data("ejScroller"),r=n.element[0].getElementsByClassName("e-columnrow"),t=n._freezeScrollTop,i.scrollY(t,!0),n._freezeScrollTop=t)},n.prototype._adaptiveSwimlaneRefresh=function(){var n=this.kanbanObj,r,i,t;for(n.element.find(".e-swimlane-window .e-swimlane-ul").empty(),i=0;i<n._kbnAdaptDdlData.length;i++)ej.buildTag("li.e-swimlane-item ","<div>"+n._kbnAdaptDdlData[i]+"<\/div>",{}).appendTo(n.element.find(".e-swimlane-window .e-swimlane-ul"));if(n.KanbanAdaptive&&n.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey)){for(n.KanbanAdaptive._addSwimlaneName(),r=n.kanbanContent.find(".e-columnrow"),t=0;t<r.length;t++)if(r.eq(t).offset().top>=0){n.element.find(".e-swimlane-text").text(n._kbnAdaptDdlData[t]);break}n.kanbanContent.hasClass("e-scroller")&&n.kanbanContent.data("ejScroller").refresh()}},n.prototype._removeKbnAdaptItems=function(){var n=this.kanbanObj,u,nt,l,a,f,v,tt,e,y,p,w,t,b,s,o,k;if(n.element.hasClass("e-responsive")){var i=n.element.find(".e-kanbantoolbar"),d=n.element.find(".e-stackedHeaderCell"),h,g=n.element.find(".e-swimlane-ddl"),c=$(".e-kanbanfilter-window"),r;if(g.length>0&&(g.remove(),n.element.find(".e-swimlane-window").remove()),i.hasClass("e-sladapt-bar")&&i.remove(),c.length>0){for(u=c.find(".e-filter-content").children(),t=0;t<u.length;t++)u.eq(t).find("span.e-chkbox-wrap").attr("aria-checked")=="true"&&(nt=u.index(u.eq(t)),n.element.find(".e-quickfilter").nextAll("li.e-tooltxt").eq(nt).addClass("e-select"));c.remove()}if(d.length>0&&d.width(""),n.element.find(".e-rowcell,.e-headercell").width(""),n.kanbanContent.find("table:eq(0) > colgroup col").width(""),n.headerContent.find("table > colgroup col").width(""),!n.element.hasClass("e-swimlane-responsive"))for(h=n.element.find(".e-rowcell .e-cell-scrollcontent:visible"),t=0;t<h.length;t++)l=$(h[t]).data("ejScroller"),ej.isNullOrUndefined(l)||l.destroy();for(i.length>0&&i.is(":visible")&&(i.css("display","block"),a=i.find(".e-quickfilter"),f=i.find(".e-searchbar"),i.find(".e-adapt-cancel").is(":visible")&&f.find(".e-searchitem").addClass("e-cancel").removeClass("e-searchfind"),i.find(".e-adapt-cancel,.e-adapt-search").hide(),a.length>0&&(i.find(".e-kanbanfilter-icon").remove(),a.parent(".e-ul.e-horizontal").show()),v=f.find(".e-searchdiv"),v.length>0&&(v.show(),f.find(".e-search").css("border",""),f.find(".e-searchitem").show(),i.parents("body").removeClass("e-kbnwindow-modal"),i.removeClass("e-adaptive-search"))),n.headerContent.find("table").css({transform:"","transition-duration":""}),n.kanbanContent.find("table").eq(0).css({transform:"","transition-duration":""}),r=n.element.find(".e-cell-scrollcontent"),t=0;t<r.length;t++)tt=r.eq(t).children(),tt.children().appendTo(r.eq(t).parents(".e-rowcell")),r.eq(t).remove();if(e=n.element.find(".e-kanbandialog"),e.is(":visible")&&(y=e.parents(".e-dialog-scroller"),p=e.parents(".e-dialog"),p.css({top:"",left:""}).removeClass("e-kbnadapt-editdlg"),y.css("height","auto"),y.ejScroller({height:0,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),e.parents("body").removeClass("e-kbnwindow-modal"),p.hide(),n.KanbanEdit._onKbnDialogOpen()),!ej.isNullOrUndefined(n.model.fields.swimlaneKey))for(n.kanbanContent.hasClass("e-scroller")&&n.kanbanContent.data("ejScroller").destroy(),n.element.parents("body").removeClass("e-kbnwindow-modal"),n.element.find(".e-swimlanerow").show(),w=n.element.find(".e-columnrow"),t=0;t<w.length;t++)for(b=w.eq(t).find(".e-rowcell"),s=0;s<b.length;s++)o=b.eq(s).find(".e-swimlane-name"),o.length>0&&(o.siblings().length==0?o.parents(".e-limits").hide():o.hide());k=n.element.find(".e-adapt-stheader");k.length>0&&k.find("div").css({position:"",left:""});n.element.removeClass("e-responsive");n.element.removeClass("e-swimlane-responsive")}},n.prototype._setAdaptEditWindowHeight=function(){var r=this.kanbanObj,n,t,i;n=$("#"+r._id+"_dialogEdit");t=n.parents(".e-dialog-scroller");i;n.parents(".e-dialog").css({top:"0",left:"0"}).addClass("e-kbnadapt-editdlg");n.parents("body").addClass("e-kbnwindow-modal");i=t.prev(".e-titlebar");t.ejScroller({height:$(window).height()-i.outerHeight(),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0});t.data("ejScroller").refresh();n.css("height",t.height())},n}();window.ej.createObject("ej.KanbanFeatures.Adaptive",InternalAdaptive,window);InternalScroller=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._initScrolling=function(){var n=this.kanbanObj;(n.model.width||n.model.height)&&(n.model.allowScrolling=!0,n.model.width&&(n.model.scrollSettings.width=n.model.width),n.model.height&&(n.model.scrollSettings.height=n.model.height));n._originalScrollWidth=n.model.scrollSettings.width},n.prototype._renderScroller=function(){var n=this.kanbanObj,i,r,u,f,t,e;n.model.scrollSettings||(n.model.scrollSettings={});typeof n._originalScrollWidth=="string"&&(n.element.css("width","auto"),i=n.element.width(),(n.model.scrollSettings.width=="auto"||n._originalScrollWidth=="auto")&&(n._originalScrollWidth="100%"),n.model.scrollSettings.width=i*(parseFloat(n._originalScrollWidth)/100));typeof n.model.scrollSettings.height=="string"&&(r=n.element.height(),n.model.scrollSettings.height=="auto"&&(n.model.scrollSettings.height="100%"),n.model.scrollSettings.height=r*(parseFloat(n.model.scrollSettings.height)/100));(n.model.scrollSettings.width||n.model.width)&&n.element.width(n.model.scrollSettings.width||n.model.width);u=n.model.scrollSettings.height!=0?n.model.scrollSettings.height-n.getHeaderTable().height()-(!ej.isNullOrUndefined(n._filterToolBar)&&n._filterToolBar.height()):n.model.scrollSettings.height;f=n.getContent().attr("tabindex","0");n.element.addClass("e-kanbanscroll");f.ejScroller({enableRTL:n.model.enableRTL,height:u,width:n.model.scrollSettings.width,thumbStart:$.proxy(n._kbnThumbStart,n),scroll:$.proxy(n._freezeSwimlane,n)});n.getContent().ejScroller("isVScroll")?(n.element.find(".e-kanbanheader").addClass("e-scrollcss"),n.getHeaderContent().find("div").first().addClass("e-headercontent")):n.element.find(".e-kanbanheader").removeClass("e-scrollcss");(n.model.scrollSettings.width||n.model.width)&&n.element.width(n.model.scrollSettings.width||n.model.width);t=n.getContent().data("ejScroller");e=t&&t.isVScroll()?"addClass":"removeClass";n.getHeaderContent().find(".e-headercontent")[e]("e-hscrollcss");this._refreshHeaderScroller()},n.prototype._refreshHeaderScroller=function(){var n=this.kanbanObj;this.kanbanObj.getContent().find(".e-content").scroll(ej.proxy(function(t){n.getHeaderContent().find("div").first().scrollLeft($(t.currentTarget).scrollLeft())}));this.kanbanObj.element.find(".e-kanbanheader").find(".e-headercontent").scroll(ej.proxy(function(t){var i=$(t.currentTarget);n.getContent().find(".e-content").first().scrollLeft(i.scrollLeft())}))},n.prototype._refreshScroller=function(n){var t=this.kanbanObj,i=t.getContent().first();ej.isNullOrUndefined(i.data("ejScroller"))||(n.requestType=="beginedit"&&t.getScrollObject().scrollY(0,!0),i.ejScroller("refresh"),i.ejScroller({enableRTL:t.model.enableRTL}),i.ejScroller("isVScroll")&&!t.getScrollObject().model.autoHide?(t.getHeaderContent().addClass("e-scrollcss"),t.getHeaderContent().find(".e-headercontent").hasClass("e-hscrollcss")||t.getHeaderContent().find(".e-headercontent").addClass("e-hscrollcss")):t.element.find(".e-kanbanheader").removeClass("e-scrollcss"))},n}();window.ej.createObject("ej.KanbanFeatures.Scroller",InternalScroller,window);InternalSelection=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._cardSelection=function(n,t,i){var r=this.kanbanObj,l,c,f=null,o=null,w,s,d,v,y,h,p;if(l=t.parent("td.e-rowcell"),r._currentRowCellIndex.length>0&&(r._previousRowCellIndex=[[r._currentRowCellIndex[0][0],[r._currentRowCellIndex[0][1][0]],[r._currentRowCellIndex[0][2][0]]]]),ej.isNullOrUndefined(t.attr("id"))||(w=new ej.DataManager(r._currentJsonData),o=w.executeLocal((new ej.Query).where(r.model.fields.primaryKey,ej.FilterOperators.equal,t.attr("id")))),ej.isNullOrUndefined(r._previousRowCellIndex)||r._previousRowCellIndex.length==0||(f=r.KanbanCommon._getCardbyIndexes(r._previousRowCellIndex)),c={currentCell:l,target:t,cellIndex:n[0][1][0],cardIndex:n[0][2][0],data:o,previousRowCellIndex:r._previousRowCellIndex,previousCard:f,selectedCardsData:r._selectedCardData},!r._trigger("beforeCardSelect",c)){if($(t).hasClass("e-cardselection")||(r.model.selectionType!="multiple"||r._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")||r._kTouchBar.hide(),i.pointerType!="touch"||r._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")||r.model.selectionType!="multiple"||(s=$(t).offset(),r._kTouchBar.show(),r._kTouchBar.offset({top:s.top,left:s.left}))),i.pointerType=="touch"&&$(t).hasClass("e-cardselection")&&r._kTouchBar.is(":hidden")&&(s=$(t).offset(),r._kTouchBar.show(),r._kTouchBar.offset({top:s.top,left:s.left})),r.model.selectionType=="multiple"&&i.shiftKey){var a,e,u=0,b=0,g=t,k=[];for(ej.isNullOrUndefined(f)?e=t.parents(".e-columnrow").find(".e-kanbancard"):(a=f.parents(".e-columnrow"),a.find(".e-cardselection").not(f).removeClass("e-cardselection"),e=a.find(".e-kanbancard"),u=e.index(f)),r._selectedCards=[],r._selectedCardData=[],r.selectedRowCellIndexes=[];b<=0;)y=[],d=$(e[u]).parents(".e-columnrow"),v=$(e[u]).parents(".e-rowcell"),$(e[u]).addClass("e-cardselection"),k.push(e[u]),r._selectedCardData.push(r.KanbanCommon._getKanbanCardData(r._currentJsonData,e[u].id)[0]),y=[[r.element.find(".e-columnrow").index(d),[v.index()],[v.find($(e[u])).index()]]],e[u].id==g.attr("id")&&(b=1),this._pushIntoSelectedArray(y),ej.isNullOrUndefined(f)?++u:n[0][1][0]<r._previousRowCellIndex[0][1][0]?--u:n[0][1][0]==r._previousRowCellIndex[0][1][0]?n[0][2][0]<r._previousRowCellIndex[0][2][0]?--u:++u:++u;ej.isNullOrUndefined(f)&&(r._previousRowCellIndex=r._currentRowCellIndex=[[0,[0],[0]]],f=r.KanbanCommon._getCardbyIndexes(r._previousRowCellIndex));r._selectedCards=[];r._selectedCards[r._selectedCards.length]=k;!ej.isNullOrUndefined(f)||i.ctrlKey||i.shiftKey||r._enableMultiTouch||($(t).addClass("e-cardselection"),r._selectedCards.push(t[0]),r._selectedCardData.push(r.KanbanCommon._getKanbanCardData(r._currentJsonData,t.id)[0]),this._pushIntoSelectedArray(n))}if(r.model.selectionType=="multiple"&&(i.ctrlKey||r._enableMultiTouch))if($(t).hasClass("e-cardselection")){for($(t).removeClass("e-cardselection"),this._popFromSelectedArray(n[0][0],n[0][1],n[0][2],i),h=0;h<r._selectedCardData.length;h++)if(o[0][r.model.fields.primaryKey]==r._selectedCardData[0][r.model.fields.primaryKey])break;r._selectedCardData.splice(h,1);r._selectedCards.splice(h,1);r._currentRowCellIndex=n}else $(t).addClass("e-cardselection"),r._selectedCards.push(t[0]),this._pushIntoSelectedArray(n),r._selectedCardData.push(o[0]);else r.model.selectionType=="multiple"&&i.shiftKey||(p=n[0][2],r.element.find(".e-cardselection").removeClass("e-cardselection"),r._selectedCards=[],r.selectedRowCellIndexes=[],$(t).addClass("e-cardselection"),r._selectedCardData=[],r._selectedCardData.push(o[0]),r._selectedCards.push(t[0]),r.model.selectionType=="multiple"&&(p=[n[0][2]]),r.selectedRowCellIndexes.push({rowIndex:n[0][0],cellIndex:n[0][1],cardIndex:p}));(c={currentCell:l,target:t,cellIndex:n[0][1][0],cardIndex:n[0][2][0],data:o,selectedRowCellIndex:r.selectedRowCellIndexes,previousRowCellIndex:r._previousRowCellIndex,previousCard:f,selectedCardsData:r._selectedCardData},r.model.selectionType=="multiple"&&i.shiftKey&&$(t).hasClass("e-cardselection")?(r._previousRowCellIndex.length==0&&(r._currentRowCellIndex=[[t.parents(".e-columnrow").index(),[0],[0]]]),r._currentRowCellIndex.length==0&&(r._currentRowCellIndex=n)):$(t).hasClass("e-cardselection")&&(r._currentRowCellIndex=n),r._trigger("cardSelect",c))||r.element.focus()}},n.prototype.clear=function(){var n=this.kanbanObj,t;n.model.allowSelection&&(t=$(n._kanbanRows).not(".e-swimlanerow"),$(t).find(".e-rowcell .e-kanbancard").removeClass("e-cardselection"),n.selectedRowCellIndexes=[],n._selectedCardData=[],n._selectedCards=[],n._previousRowCellIndex=[],n._currentRowCellIndex=[])},n.prototype._pushIntoSelectedArray=function(n){for(var i=this.kanbanObj,r=0,f=!0,e=!0,u,o,t=0;t<i.selectedRowCellIndexes.length;t++)if(u=i.selectedRowCellIndexes[t],u.rowIndex==n[0][0]){for(f=!1,r=0;r<u.cellIndex.length;r++)if(o=u.cellIndex[r],o==n[0][1][0]){e=!1;break}break}f&&i.selectedRowCellIndexes.push({rowIndex:n[0][0],cellIndex:n[0][1],cardIndex:[n[0][2]]});e?f||(i.selectedRowCellIndexes[t].cellIndex.push(n[0][1][0]),i.selectedRowCellIndexes[t].cardIndex.push([n[0][2][0]])):i.selectedRowCellIndexes[t].cardIndex[r].push(n[0][2][0])},n.prototype._popFromSelectedArray=function(n,t,i,r){var e=this.kanbanObj,o,f,s,u,h,c;if(e.model.selectionType=="multiple"&&(r.ctrlKey||r.shiftKey||e._enableMultiTouch))for(o=0;o<e.selectedRowCellIndexes.length;o++)if(u=e.selectedRowCellIndexes[o],u.rowIndex==n)for(f=0;f<u.cellIndex.length;f++)if(h=u.cellIndex[f],h==t[0])if(r.shiftKey){u.cardIndex=[];break}else for(s=0;s<u.cardIndex[f].length;s++)if(c=u.cardIndex[f][s],c==i[0]){u.cardIndex[f].splice(s,1);u.cardIndex[f].length==0&&(u.cardIndex.splice(f,1),u.cellIndex.splice(f,1));u.cellIndex.length==0&&e.selectedRowCellIndexes.splice(o,1);break}},n.prototype._selectionOnRerender=function(){var s,e,t,o=!0,n=this.kanbanObj,r,u,i,f,c,h;if(n.model.allowSelection){if(n.model.selectionType=="single")n._selectedCards.length>0&&(u=$(n._selectedCards[0]),i=n.element.find("#"+u[0].id),i.hasClass("e-kanbancard")?(e=$(i).parents(".e-columnrow"),t=$(i).parents(".e-rowcell"),n._selectedCards=[],n._selectedCards=i.addClass("e-cardselection"),n._currentRowCellIndex=n._previousRowCellIndex=[],n._currentRowCellIndex.push([e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]]),n._currentRowCellIndex=n._previousRowCellIndex,n.selectedRowCellIndexes=[],n.selectedRowCellIndexes.push({rowIndex:n._currentRowCellIndex[0][0],cellIndex:n._currentRowCellIndex[0][1][0],cardIndex:n._currentRowCellIndex[0][2][0]})):(n._selectedCards=[],n._selectedCardData=[],n.selectedRowCellIndexes=[],n._currentRowCellIndex=n._previousRowCellIndex=[]));else{for(r=0;r<n._selectedCards.length;r++)if($(n._selectedCards[r]).length>1)for(f=0;f<n._selectedCards[r].length;f++)u=$(n._selectedCards[r][f]),i=n.element.find("#"+u[0].id),e=$(i).parents(".e-columnrow"),t=$(i).parents(".e-rowcell"),i.hasClass("e-kanbancard")?(o=!0,n._selectedCards[r].splice(f,0,i[0]),i.addClass("e-cardselection"),n._selectedCards[r].splice(f+1,1),r==0&&f==0&&(n._currentRowCellIndex=n._previousRowCellIndex=[],n._currentRowCellIndex.push([e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]]),n._currentRowCellIndex=n._previousRowCellIndex,n.selectedRowCellIndexes=[]),c=[e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]],this._pushIntoSelectedArray([c])):(o=!1,n._selectedCards[r].splice(f,1),h=n._selectedCardData.indexOf(n.KanbanCommon._getKanbanCardData(n._selectedCardData,u[0].id)[0]),n._selectedCardData.splice(h,1),--f);else u=$(n._selectedCards[r]),i=n.element.find("#"+u[0].id),e=$(i).parents(".e-columnrow"),t=$(i).parents(".e-rowcell"),i.hasClass("e-kanbancard")?(o=!0,i.addClass("e-cardselection"),n._selectedCards[r]=i[0],r==0&&(n._currentRowCellIndex=n._previousRowCellIndex=[],n._currentRowCellIndex.push([e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]]),n._currentRowCellIndex=n._previousRowCellIndex,n.selectedRowCellIndexes=[]),c=[e.index(),[t.index()],[t.find(".e-kanbancard").index(t.find("#"+u[0].id))]],this._pushIntoSelectedArray([c])):(o=!1,n._selectedCards.splice(r,1),h=n._selectedCardData.indexOf(n.KanbanCommon._getKanbanCardData(n._selectedCardData,u[0].id)[0]),n._selectedCardData.splice(h,1),--r);!o&&n._selectedCards.length<=0&&(n._currentRowCellIndex=n._previousRowCellIndex=n.selectedRowCellIndexes=[])}s=n.element.find(".e-columnrow").index(n.element.find(".e-cardselection").eq(0).parents(".e-columnrow"));s>=0&&(n.selectedRowCellIndexes[0].rowIndex=n._currentRowCellIndex[0][0]=s,n._previousRowCellIndex.length>0&&(n._previousRowCellIndex[0][0]=s))}},n.prototype._renderKanbanTouchBar=function(){var n=this.kanbanObj;n._kTouchBar=ej.buildTag("div.e-kanbantouchbar","",{display:"none"},{});var t=ej.buildTag("div.e-content","",{},{}),i=ej.buildTag("div.e-downtail e-tail","",{},{}),r=ej.buildTag("span.e-cardtouch e-icon","",{},{});t.append(r);n._kTouchBar.append(t);n._kTouchBar.append(i);n.element.append(n._kTouchBar)},n.prototype._updateSelectedCardIndexes=function(n){var e,f,t=this.kanbanObj,i,r,u;if(t.selectedRowCellIndexes.length>0)for($(n).hasClass("e-rowcell")?f=$(n).index():(n=t.element.find("#"+$(n).attr("id")),f=$(n).parents(".e-rowcell").index()),e=$(n).parents(".e-columnrow"),$.inArray(f,t.selectedRowCellIndexes[0].cellIndex)==-1&&t.selectedRowCellIndexes[0].cellIndex.push(f),i=0;i<t.selectedRowCellIndexes[0].cellIndex.length;i++)if(r=e.find(".e-rowcell").eq(t.selectedRowCellIndexes[0].cellIndex[i]).find(".e-cardselection"),r.length>0)for(t.selectedRowCellIndexes[0].cardIndex.splice(i,1),t.element.find(".e-targetclone").remove(),u=0;u<r.length;u++)u>0?t.selectedRowCellIndexes[0].cardIndex[i].push($(r[u]).index()):t.selectedRowCellIndexes[0].cardIndex.splice(i,0,[$(r[0]).index()]);else t.selectedRowCellIndexes[0].cellIndex.splice(i,1),t.selectedRowCellIndexes[0].cardIndex.splice(i,1),--i},n}();window.ej.createObject("ej.KanbanFeatures.Selection",InternalSelection,window);InternalFilter=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._filterHandler=function(n,t){var i=this.kanbanObj,u={requestType:"filtering",currentFilterObject:[],filterCollection:i._filterCollection},f,o,r,s,e;if(u.currentFilterObject.push(n),i.model.isResponsive){for(f=[],i._kbnFilterObject=i._kbnFilterObject.concat(u.currentFilterObject),r=0;r<i._kbnFilterObject.length;r++)e=$.inArray(i._kbnFilterObject[r],f),e<0&&f.push(i._kbnFilterObject[r]);i._kbnFilterObject=f}for(o=i._dataSource()instanceof ej.DataManager?i._dataSource().dataSource.json:i._dataSource(),o.length==0&&i._currentJsonData.length>0&&(o=i._currentJsonData),i._initialData=o,r=0;r<i.model.filterSettings.length;r++)if(i.model.filterSettings[r].text==u.currentFilterObject[0].text){s=i.model.filterSettings[r].query.queries[0].e;ej.isNullOrUndefined(u.filterCollection[0])?(u.filterCollection.push(s),$(t).addClass("e-select")):$(t).hasClass("e-select")?($(t).removeClass("e-select"),e=$.inArray(s,u.filterCollection),u.filterCollection.splice(e,1)):($(t).addClass("e-select"),u.filterCollection.push(s));break}i.KanbanCommon._processBindings(u)},n.prototype.filterCards=function(n){var t={requestType:"filtering",filterCollection:this.kanbanObj._filterCollection},n=n.queries[0].e;t.filterCollection.push(n);this.kanbanObj.KanbanCommon._processBindings(t)},n.prototype.clearFilter=function(){var n=this.kanbanObj,t;n._filterCollection.length!=0&&(t={requestType:"filtering"},n._filterCollection=[],n.element.find(".e-kanbantoolbar .e-tooltxt").removeClass("e-select"),n.KanbanCommon._processBindings(t))},n.prototype._filterLimitCard=function(n){for(var u,i,f,e,o,t=this.kanbanObj,r=0;r<t.model.columns.length;r++)u=t.model.columns[r],i=t.getHeaderContent().find("span.e-totalcount"),t.model.enableTotalCount&&(i=$(i[r]),f=$(i).text().indexOf(t.localizedLabels.FilterOfText),!ej.isNullOrUndefined(n)&&(n.requestType=="drop"||n.requestType=="beginedit"||n.requestType=="save"||n.requestType=="cancel"||n.requestType=="refresh"||n.requestType=="add"||(n.requestType=="filtering"?n.filterCollection.length>0?!0:t.model.searchSettings.key==""?!1:!0:n.requestType=="search"?t.model.searchSettings.key!=""?!0:t.model.filterSettings.length>0?t.element.find(".e-kanbantoolbar .e-tooltxt").hasClass("e-select"):!1:!1))?((f!=-1||t.model.filterSettings.length!=0||t.model.searchSettings.key.length!=0)&&(e=new ej.DataManager(t.model.dataSource).executeLocal((new ej.Query).where(t.model.keyField,ej.FilterOperators.equal,u.key)).length,$(i).text(e)),o=t.KanbanCommon._multikeySeparation(u.key),$(i).text($($(t.element.find(".e-columnrow")).find('td[ej-mappingkey="'+o+'"] > div.e-kanbancard')).length+" "+t.localizedLabels.FilterOfText+" "+$(i).text())):ej.isNullOrUndefined(u.constraints)?$(i).text($(i).text().slice(f+3)):t.KanbanCommon._renderLimit())},n.prototype.searchCards=function(n){var u,t=this.kanbanObj,i=$("#"+t._id+"_toolbarItems_search"),r;i.find("input").val()!=n&&i.find("input").val(n);t.element.hasClass("e-responsive")||(i.parent().addClass("e-highliht-kbnsearchbar"),i.find("input").val()==""&&i.parent().removeClass("e-highliht-kbnsearchbar"));u={requestType:"search",keyValue:n};(n!=""||t.model.searchSettings.key!="")&&(t.model.searchSettings.key=n,t.model.searchSettings.key.length>0&&(r=t._dataSource()instanceof ej.DataManager?t._dataSource().dataSource.json:t._dataSource(),r.length==0&&t._currentJsonData.length>0&&(r=t._currentJsonData),t._initialData=r),t.KanbanCommon._processBindings(u))},n.prototype.clearSearch=function(){var n=this.kanbanObj;n.element.find(".e-kanbantoolbar #"+n._id+"_toolbarItems_search").val("");this.searchCards("");$.extend(n.model.searchSettings,n.defaults.searchSettings)},n.prototype._onToolbarKeypress=function(n){var t=this.KanbanFilter.kanbanObj,i=t.element,r=i.data("ejKanban");t.model.isResponsive&&i.hasClass("e-responsive")&&($(t.itemsContainer).parent().children().not(".e-searchbar").hide(),t.KanbanAdaptive._kbnTimeoutSearch(i,n))},n}();window.ej.createObject("ej.KanbanFeatures.Filter",InternalFilter,window);InternalDragAndDrop=function(){function n(n){this.kanbanObj=null;this._dragEle=null;this._dropEle=null;this._dropTarget=null;this.kanbanObj=n}return n.prototype._addDragableClass=function(){var n=this.kanbanObj;n._dropped=!1;this._dragEle=n.getContent().find(".e-columnrow td.e-drag .e-kanbancard");this._dropEle=n.getContent().find(".e-columnrow .e-rowcell.e-drop");this._dropEle.addClass("e-droppable");this._dragEle.addClass("e-draggable e-droppable");this._enableDragDrop();n._on(n.element,"mouseup touchstart pointerdown MSPointerDown","",$.proxy(n.element.focus(),this))},n.prototype._enableDragDrop=function(){var n=this.kanbanObj;this._drag();$(n.getContent()).ejDroppable({accept:$(n.getContent()).find("div.e-kanbancard"),drop:function(n,t){$(t.helper).hide()}})},n.prototype._selectedPrevCurrentCards=function(){var t,i,n=this.kanbanObj;n._previousRowCellIndex.length>0&&(t=n.KanbanCommon._getCardbyIndexes(n._previousRowCellIndex),n._pCardId=t.attr("id"));n._previousRowCellIndex=n._currentRowCellIndex;n._pCardId=n._cCardId;n._currentRowCellIndex.length>0&&(i=n.KanbanCommon._getCardbyIndexes(n._currentRowCellIndex),n._cCardId=i.attr("id"))},n.prototype._getPriorityIndex=function(n){for(var i=null,r=this.kanbanObj,t=0;t<r._priorityCollection.length;t++)if(r._priorityCollection[t].primaryKey==n.attr("id")){i=r._priorityCollection[t];break}return ej.isNullOrUndefined(i)?this._getPriorityKey(n.attr("id")):parseInt(i.dropKey)},n.prototype._removeFromPriorirtyCollec=function(n){for(var i=null,r=this.kanbanObj,t=0;t<r._priorityCollection.length;t++)if(r._priorityCollection[t].primaryKey==n){i=t;break}ej.isNullOrUndefined(i)||r._priorityCollection.splice(i,1)},n.prototype._columnDataOndrop=function(n,t){var r=this.kanbanObj,h=new ej.DataManager(r._initialData),u,f,e,o,s,i=new ej.Query;return f=r.model.keyField,e=r.model.fields.swimlaneKey,o=$(n).hasClass("e-rowcell")?$(n).attr("ej-mappingkey"):$(n).parents(".e-rowcell").attr("ej-mappingkey"),s=$(n).parents(".e-columnrow").prev(".e-swimlanerow").find(".e-slkey").text(),i=ej.isNullOrUndefined(e)?i.where(f,ej.FilterOperators.equal,o):i.where(f,ej.FilterOperators.equal,o).where(e,ej.FilterOperators.equal,s),u=h.executeLocal(i),u.sort(function(n,i){return n[t]-i[t]}),u},n.prototype._dropToColumn=function(n,t){var i=this.kanbanObj,h,u,f=[],c=!1,e=i.model.fields.priority,l,a,w=n.parent().has(t).length,o,v,s,r,y,p;for(ej.isNullOrUndefined(i._filterToolBar)||(l=i._filterToolBar.find(".e-select")),n.hasClass("e-targetclone")&&(n=n.parent()),n.hasClass("e-columnkey")&&(n=n.parent().parent()),this._selectedPrevCurrentCards(),e&&(!ej.isNullOrUndefined(i._filterToolBar)&&l.length>0||i._searchBar!=null&&i._searchBar.find(".e-cancel").length>0)?(f=this._columnDataOndrop(n,e),c=f.length>0):c=$(n).children(".e-kanbancard").length>1,a=this._getSelectedCards(t),i.model.selectionType=="multiple"&&a.length>0&&$(t).hasClass("e-cardselection")&&(t=a),o=0;o<t.length;o++)for(v=t[o],s=0;s<$(v).length;s++)r=$(v)[s],$(r).is(":visible")&&(e&&c&&(h=!ej.isNullOrUndefined(i._filterToolBar)&&l.length>0||i._searchBar!=null&&i._searchBar.find(".e-cancel").length>0?f[f.length-1][e]:this._getPriorityIndex(n.find(".e-kanbancard").last()),u=this._getPriorityIndex($(r)),h>=u&&(u=++h),this._removeFromPriorirtyCollec($(r).attr("id")),i._priorityCollection.push({primaryKey:$(r).attr("id"),dropKey:u}),y=i.KanbanCommon._getKanbanCardData(i._currentJsonData,$(r)[0].id)[0],ej.isNullOrUndefined(u)||(y[e]=u,f.push(y))),$(n).find(".e-customaddbutton").length>0?$(r).insertBefore($(n).find(".e-customaddbutton")):i.element.hasClass("e-responsive")?(p=n.find(".e-cell-scrollcontent"),p.length>0?p.children().append(r):$(n).append(r)):$(n).append(r));this._updateDropAction(n,t);w==0&&!ej.isNullOrUndefined(i.model.fields.swimlaneKey)&&i.model.swimlaneSettings.allowDragAndDrop&&i.refresh(!0)},n.prototype._updateDropAction=function(n,t){var a,i=this.kanbanObj,f,r,e,o,s,c,u,l,h;for(a=$(n).hasClass("e-rowcell")?n:$(n).closest("td.e-rowcell"),i._selectedCardData=[],r=0;r<t.length;r++)if(ej.isNullOrUndefined(t[r].length))($(t[r]).is(":visible")||$(n).hasClass("e-hide")&&i.model.contextMenuSettings.enable)&&(e=$(t[r]).attr("id"),this._updateDropData(n,t[r],e),u=i.element.find("#"+e),f=u.parents(".e-rowcell"),u.parents(".e-rowcell").hasClass("e-shrink")&&u.addClass("e-hide"),s=parseInt(f.find(".e-shrinkcount").html()),f.find(".e-shrinkcount").html(++s));else for(o=0;o<t[r].length;o++)($(t[r][o]).is(":visible")||$(n).hasClass("e-hide")&&i.model.contextMenuSettings.enable)&&(e=t[r][o].id,this._updateDropData(n,t[r][o],e),u=i.element.find("#"+e),f=u.parents(".e-rowcell"),u.parents(".e-rowcell").hasClass("e-shrink")&&u.addClass("e-hide"),s=parseInt(f.find(".e-shrinkcount").html()),f.find(".e-shrinkcount").html(++s));if(i.model.fields.priority&&i._priorityCollection.length>0)while(i._priorityCollection.length>0)c=i._priorityCollection[0].primaryKey,u=i.element.find("#"+c),this._updateDropData(n,u,c);h=i._bulkUpdateData[0][i.model.fields.primaryKey];i._bulkUpdateData.length>1&&(h="bulk");l={data:i._bulkUpdateData,requestType:"drop",primaryKeyValue:h};i._saveArgs=l;i.updateCard(h,i._bulkUpdateData);(i.model.allowSelection&&!ej.isNullOrUndefined(t[0].length)&&t[0].length>1||t.length>1||t.length==1&&$(t).hasClass("e-cardselection"))&&(i._previousRowCellIndex=ej.isNullOrUndefined(i._pCardId)?[]:this._updateRowCellIndexes(i._pCardId,i._previousRowCellIndex),i._currentRowCellIndex=ej.isNullOrUndefined(i._cCardId)?[]:this._updateRowCellIndexes(i._cCardId,i._currentRowCellIndex),i.KanbanSelection._selectionOnRerender(),ej.isNullOrUndefined(i._pCardId)&&(i._previousRowCellIndex=i._currentRowCellIndex),i.model.selectionType=="single"?i.selectedRowCellIndexes=i._currentRowCellIndex:i.KanbanSelection._updateSelectedCardIndexes(n));i._priorityCollection=[]},n.prototype._getPriorityKey=function(n){var t=this.kanbanObj,i=t.KanbanCommon._getKanbanCardData(t._currentJsonData,n);return i[0][t.model.fields.priority]},n.prototype._dropAsSibling=function(n,t,i){var r=this.kanbanObj,s=0,g=0,rt=0,w,ut,f,k,nt,ft,et,u=[],lt,c=r.model.fields.priority,b,p,ot,at=n.parent().has(t).length,l,st,v,o,ht,ct,d,tt,y,e,a,h,it;for(ej.isNullOrUndefined(r._filterToolBar)||(b=r._filterToolBar.find(".e-select")),p=r.model.fields.primaryKey,this._selectedPrevCurrentCards(),c&&(!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)&&(u=this._columnDataOndrop(n,c)),$(n).hasClass("e-targetclone")&&(n.next().length==0&&$(n).addClass("e-targetappend"),ft=$(n).prevAll(".e-kanbancard")[0],et=$(n).nextAll(".e-kanbancard")[0],$(n).hasClass("e-targetappend")?(i=!0,n=ft,ej.isNullOrUndefined(n)&&(n=et)):(i=!1,n=et,ej.isNullOrUndefined(n)&&(n=ft))),nt=n,ot=this._getSelectedCards(t),r.model.selectionType=="multiple"&&ot.length>0&&$(t).hasClass("e-cardselection")&&(t=ot),l=0;l<t.length;l++)for(st=t[l],v=0;v<$(st).length;v++)if(o=$(st)[v],$(o).is(":visible")&&(i&&(v>0&&t[l][v-1]!=nt?n=t[l][v-1]:v==0&&l>0&&t[l-1]!=nt&&(n=t[l-1])),o!=nt&&(i?$(o).insertAfter(n):$(o).insertBefore(n),c&&(!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)&&(ht=r.KanbanCommon._getKanbanCardData(u,$(n).attr("id")),h=u.indexOf(ht[0]),d=r.KanbanCommon._getKanbanCardData(r._currentJsonData,$(o)[0].id),ht[0][r.model.keyField]==d[0][r.model.keyField]&&u.splice(u.indexOf(d[0]),1),i?u.splice(h+1,0,d[0]):u.splice(h,0,d[0]),lt=$(o)[0].id)),c)){if(!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)for(a=r.KanbanCommon._getKanbanCardData(u,$(n).attr("id")),s=a[0][c],a=r.KanbanCommon._getKanbanCardData(u,lt),k=[],y=u.indexOf(a[0]);y<u.length;y++)k.push(u[y]);else s=this._getPriorityIndex($(n)),tt=$(o).nextAll(".e-kanbancard"),k=ej.isNullOrUndefined(tt.addBack)?tt.andSelf():tt.addBack();for(y=0;y<k.length;y++){if(e=k[y],!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0?(a=null,f=e[c],!i&&$(o)[0].id==e[p]&&s<f&&(f=s),a=r.KanbanCommon._getKanbanCardData(u,e[p]),h=ct=u.indexOf(a[0]),h-1>=0&&(g=u[h-1][c]),a=r.KanbanCommon._getKanbanCardData(u,e[p]),h=ct=u.indexOf(a[0]),h+1<u.length?(rt=u[h+1][c],w=u[h+1]):w=[]):(f=this._getPriorityKey($(e).attr("id")),!i&&$(o)[0]==e&&s<f&&(f=s),ut=$(e).prevAll(".e-kanbancard"),ut.length>0&&(g=this._getPriorityIndex(ut.eq(0))),w=$(e).nextAll(".e-kanbancard"),w.length>0&&(rt=this._getPriorityIndex(w.eq(0)))),!isNaN(g)&&g<f&&(f<rt||w.length==0))break;!ej.isNullOrUndefined(r._filterToolBar)&&b.length>0||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0?(!i&&$(o)[0].id==e[p]?!i&&$(o)[0].id==e[p]&&s<f||(f=s):f=++s,u[ct][c]=f,it=e[p]):(!i&&$(o)[0]==e?!i&&$(o)[0]==e&&s<f||(f=s):f=++s,it=$(e).attr("id"));this._removeFromPriorirtyCollec(it);r._priorityCollection.push({primaryKey:it,dropKey:f});s=f}}this._updateDropAction(n,t);this._dropTarget=null;at==0&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&r.model.swimlaneSettings.allowDragAndDrop&&r.refresh(!0)},n.prototype._updateDropData=function(n,t,i){var r=this.kanbanObj,e,h,c,u,a,l,v,o,y,s,f;if(!ej.isNullOrUndefined(r.model.fields.primaryKey)){if(u=[],h=r.model.fields.priority,c=r.model.fields.primaryKey,ej.isNullOrUndefined(i)&&(i=$(n).attr("id")),e=$(n).hasClass("e-rowcell")?$(n):$(n).parents(".e-rowcell"),e.index()<0&&(e=r.element.find("#"+$(n).attr("id")).parents(".e-rowcell")),u=$.extend(!0,[],r.KanbanCommon._getKanbanCardData(r._currentJsonData,i)),l=r.model.columns[e.index()].key,a=typeof l=="object"?l:l.split(","),u.length>0&&($(e).find(".e-targetclonemulti").length>0?u[0][r.model.keyField]=$(e).find(".e-columnkey.e-active .e-text").eq(0).text():a.length==1&&(u[0][r.model.keyField]=a[0]),r.model.fields.swimlaneKey&&(v=$(n).parents("tr.e-columnrow").prev().find("div.e-slkey").html(),u[0][r.model.fields.swimlaneKey]=ej.isNullOrUndefined(v)?r.element.find("#"+n.id).parents("tr.e-columnrow").prev().find("div.e-slkey").html():v)),r._dropped=!0,h&&r._priorityCollection.length>0){for(s=0;s<r._priorityCollection.length;s++)if(r._priorityCollection[s].primaryKey==i){o=r._priorityCollection[s];r._priorityCollection.splice(s,1);break}if(!ej.isNullOrUndefined(o)&&u.length>0&&(u[0][h]=o.dropKey),!ej.isNullOrUndefined(r._filterToolBar)&&r._filterToolBar.find(".e-select").length>0&&!ej.isNullOrUndefined(o)||r._searchBar!=null&&r._searchBar.find(".e-cancel").length>0)for(f=0;f<r._initialData.length;f++)if(o.primaryKey==r._initialData[f][c]){u.length>0?r._initialData[f]=u[0]:r._initialData[f][h]=o.dropKey;y=r._initialData[f];break}}if(u.length>0){if($(t).hasClass("e-cardselection")){for(f=0;f<r._selectedCardData.length;f++)if(u[0][c]==r._selectedCardData[f][c])break;r._selectedCardData.splice(f,1);r._selectedCardData.push(u[0])}r._bulkUpdateData.push(u[0])}else h&&r.KanbanCommon._getKanbanCardData(r._bulkUpdateData,y[c]).length<=0&&r._bulkUpdateData.push(y)}},n.prototype._updateRowCellIndexes=function(n,t){var f,i,r=[],u;return ej.isNullOrUndefined(n)?r=t:(u=this.kanbanObj.element.find("#"+n),f=$(u).parents(".e-columnrow"),i=$(u).parents(".e-rowcell"),r.push([f.index(),[i.index()],[i.find(".e-kanbancard").index(i.find("#"+n))]])),r},n.prototype._dragStop=function(n,t,i){var e=this,c,nt,v,tt,o,r=this.kanbanObj,h,it,u,rt,f,k,d,l,y,a,w,b,g,st,ft;if(n.element.dropped||t&&t.remove(),n.target=this._getCursorElement(n),u=$(n.target).closest(".e-kanbancard").length>0?$(n.target).closest(".e-kanbancard")[0]:n.target,r.element.hasClass("e-responsive")&&!$(u).hasClass("e-targetclone")&&(l=$(u).parents(".e-rowcell"),!$(u).hasClass("e-kanbancard")&&$(u).parents(".e-kanbancard").length==0&&l.length>0&&$(u).parents(".e-kanbancard").is(":visible")&&(n.target=u=l[0])),v=$(n.element).parents(".e-columnrow"),rt=v.find(u).parents(".e-rowcell").height()-r._tdHeightDiff,r.element.find(".e-kanban-draggedcard").removeClass("e-kanban-draggedcard"),r.element.find(".e-targetdragclone").remove(),e._dropEle.removeClass("e-dropping e-dragged e-dragpossible"),r.element.find(".e-droppableremove").removeClass("e-droppableremove e-droppable"),r.element.find(".e-dragpossible").removeClass("e-dragpossible e-drop"),c={data:n.dragData,draggedElement:n.dragEle,dropTarget:$(u),event:n.event},r._trigger("cardDragStop",c))return!1;v=$(n.element).parents(".e-columnrow");nt=v.find(".e-cardselection");tt=v.find(".e-rowcell");o=$(n.target).parents(".e-targetclonemulti").length>0?r.element.find(".e-targetclonemulti"):r.element.find(".e-targetclone");h=$(n.element).parents(".e-rowcell");it=r.element.find(".e-rowcell.e-drag").index(h);var ut=$(u).parent().children().hasClass("e-customaddbutton"),p=$(u).parent().children().hasClass("e-limits"),et=$(u).parent().children().hasClass("e-shrinkheader"),s=$(u).parent().children(),ot=et?ut?p?s.length==4:s.length==3:p?s.length==3:s.length==2:ut?p?s.length==3:s.length==2:p?s.length==2:s.length==1;return(o.is(":visible")&&document.body.style.cursor==""&&u.style.cursor==""&&($(u).parents(".e-targetclonemulti").length>0?e._dropToColumn($(u).parents(".e-rowcell"),$(n.element)):u.nodeName=="TD"&&$(u).parent().hasClass("e-columnrow")&&o.is(":visible")||o.siblings().length<=0||ot?(d=$(u).find(".e-cell-scrollcontent"),f=d.length>0?d.children().eq(0).children().last():$(u).children().last(),f.hasClass("e-targetclone")&&(f=f.prev()),k=o.siblings().not(".e-shrinkheader").not(".e-customaddbutton").not(".e-limits"),($(u).children().length==0||k.length<=0||f.hasClass("e-customaddbutton")&&f.prev().hasClass("e-targetclone")||!f.hasClass("e-customaddbutton")&&$(f).offset().top+$(f).height()<$(o).offset().top)&&(f.next().hasClass("e-targetclone")||k.length<=0?e._dropToColumn($(u),$(n.element)):(i=!1,e._dropAsSibling($(o.next()),$(n.element),i)))):u.nodeName=="DIV"&&($(u).hasClass("e-kanbancard")||$(u).hasClass("e-targetclone"))&&($(u).hasClass("e-targetclone")?(l=$(u).parents(".e-rowcell"),$(u).next().length==0&&$(l).find(".e-kanbancard").length==0?e._dropToColumn($(l),$(n.element)):e._dropAsSibling($(u),$(n.element),i)):(o.is(":visible")||nt.length>1)&&e._dropAsSibling($(u),$(n.element),i)),r._kbnBrowserContext="contextmenu"),e._removeKanbanCursor(),r.element.hasClass("e-responsive")&&r.element.parents("body").removeClass("e-kbnwindow-modal"),r._autoKbnSwipeLeft=!1,r._autoKbnSwipeRight=!1,r.element.find(".e-targetclone").remove(),y=r.element.find(".e-targetclonemulti"),y.length>0&&(y.parent().find(".e-kanbancard").show(),$(n.target).parents(".e-rowcell").css("border-style",""),r.element.find(".e-responsive")&&y.parent().find(".e-limits").show(),y.remove()),$(n.element)[0]!=u&&tt.height(rt),r._on(r.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard",r._cardHover),$(t).length>0&&$(t).remove(),r._eventBindings(),r.model.isResponsive&&r.kanbanWindowResize(),a=r.element.find("#"+n.element.attr("id")),$(a).hasClass("e-cardselection")&&(a=$(a).parents(".e-columnrow").find(".e-cardselection:visible")),r.KanbanAdaptive&&r.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&r.KanbanAdaptive._addSwimlaneName(),h=r.element.find(".e-rowcell.e-drag").eq(it),c.draggedElement=a,c.draggedParent=h,c.data=r._bulkUpdateData,r.model.allowScrolling&&!r.element.hasClass("e-responsive")&&r.kanbanContent.data("ejScroller").refresh(),r._trigger("cardDrop",c))?!1:(r._bulkUpdateData=[],w=h.parent().find(".e-rowcell"),b=a.parents(".e-rowcell"),r.model.isResponsive&&r.element.hasClass("e-responsive")&&b[0]!=h[0]&&w.index(b)!=r._kbnSwipeCount&&(w.index(b)>w.index(h)?r.KanbanAdaptive._kbnLeftSwipe():r.KanbanAdaptive._kbnRightSwipe()),r.KanbanEdit&&r.element.find(".e-form-container .e-disable").attr("value")==n.dragEle[0].id&&r.element.find(".e-form-container").css("display")=="block"&&(r.model.editSettings.editMode=="externalform"||r.model.editSettings.editMode=="externalformtemplate")&&r.KanbanEdit.startEdit(n.dragEle),r.element.find(".e-togglevisible").removeClass("e-togglevisible"),r.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&r._kbnAdaptDdlIndex>0&&(g=r.kanbanContent.data("ejScroller"),ft=r._freezeScrollTop,st=r.element[0].getElementsByClassName("e-columnrow"),g.scrollY(0,!0),r._freezeScrollTop=ft,g.scrollY(r._freezeScrollTop,!0)),!0)},n.prototype._getCursorElement=function(n){var i=$(n.target).closest(".dragClone"),t=n.event;return i.length>0&&(i.hide(),n.target=t.type=="touchmove"||t.type=="touchstart"||t.type=="touchend"?document.elementFromPoint(t.originalEvent.changedTouches[0].pageX,t.originalEvent.changedTouches[0].pageY):document.elementFromPoint(t.clientX,t.clientY),i.show()),n.target},n.prototype._getSelectedCards=function(n){for(var r,t=this.kanbanObj,i=0;i<t._selectedCards.length;i++)if($(t._selectedCards[i]).length>1)for(r=0;r<t._selectedCards[i].length;r++)$(t._selectedCards[i][r])[0]==n[0]&&(t._selectedCards[i].splice(r,1),t._selectedCards[i].splice(0,0,n[0]),t._selectedCards.splice(0,0,t._selectedCards[i]),t._selectedCards.splice(i+1,1));else $(t._selectedCards[i])[0]==n[0]&&(t._selectedCards.splice(0,0,t._selectedCards[i]),t._selectedCards.splice(i+1,1));return t._selectedCards},n.prototype._kanbanAutoScroll=function(n){var nt=this,t=this.kanbanObj,r,u,e=null,o=null,s=null,i=null,f=t.element.find(".e-draggedcard"),g=t.element.find(".e-columnrow .e-rowcell"),b,a,k,v,y,c,d,p,h,w,l;v=ej.isNullOrUndefined(n.event.clientX)?n.event.originalEvent.changedTouches[0].clientX:n.event.clientX;y=ej.isNullOrUndefined(n.event.clientY)?n.event.originalEvent.changedTouches[0].clientY:n.event.clientY;b=t.element.width();r=t.element.hasClass("e-responsive")&&!t.element.hasClass("e-swimlane-responsive")?$(g).eq(t._kbnSwipeCount).find(".e-cell-scrollcontent"):t.getContent();u=r.data("ejScroller");a=t.element.offset().left;k=t.element.offset().top;p=r.find(".e-hup");d=r.find(".e-hdown");l=r.find(".e-vup");w=r.find(".e-vdown");c=r.find(".e-hhandle.e-box");h=r.find(".e-vhandle.e-box");!t.element.hasClass("e-responsive")&&t.model.allowScrolling&&(v>a+b-10?(t.element.removeClass("e-view-horizontal"),o=window.setInterval(function(){(f.length<=0||f.length>0&&f.is(":hidden"))&&o&&(o=window.clearInterval(o));c.length>0&&c.width()+c.offset().left<=d.offset().left&&!t.element.hasClass("e-view-horizontal")?u.scrollX(u.scrollLeft()+5,!0):o&&(o=window.clearInterval(o))},100)):v-10<a?(t.element.removeClass("e-view-horizontal"),u.scrollLeft()>0&&(e=window.setInterval(function(){(f.length<=0||f.length>0&&f.is(":hidden"))&&e&&(e=window.clearInterval(e));c.offset().left>=p.offset().left+p.width()&&!t.element.hasClass("e-view-horizontal")?u.scrollX(u.scrollLeft()-5,!0):e&&(e=window.clearInterval(e))},100))):(t.element.addClass("e-view-horizontal"),o&&(o=window.clearInterval(o)),e&&(e=window.clearInterval(e))));!ej.isNullOrUndefined(r)&&r.length>0&&r.hasClass("e-scroller")&&(y>k+t.getHeaderContent().height()+(r.height()-60)&&h.length>0&&w.length>0?(t.element.removeClass("e-view-vertical"),i=window.setInterval(function(){(f.length<=0||f.length>0&&f.is(":hidden"))&&i&&(i=window.clearInterval(i));h.height()+h.offset().top<=w.offset().top&&!t.element.hasClass("e-view-vertical")&&u.scrollTop()<t.kanbanContent.find(".e-table").height()-t.kanbanContent.height()?u.scrollY(u.scrollTop()+5,!0):i&&(i=window.clearInterval(i))},100)):y-30<t.element.find(".e-kanbancontent").offset().top&&h.length>0&&l.length>0?u.scrollTop()>0&&(t.element.removeClass("e-view-vertical"),s=window.setInterval(function(){i&&(i=window.clearInterval(i));(f.length<=0||f.length>0&&f.is(":hidden"))&&s&&(i=window.clearInterval(s));h.offset().top>=l.offset().top+l.height()&&!t.element.hasClass("e-view-vertical")?u.scrollY(u.scrollTop()-5,!0):s&&(s=window.clearInterval(s))},100)):(t.element.addClass("e-view-vertical"),i&&(i=window.clearInterval(i)),s&&(s=window.clearInterval(s))))},n.prototype._changeKanbanCursor=function(n,t,i){var f=$(n).parents(".e-kanbancard"),e=$(n).hasClass("e-kanbancard"),u,r;f.length>0||e?(r=e?$(n):f,r[0].style.cursor="not-allowed"):$(n).hasClass("e-shrinkheader")||$(n).parents(".e-shrinkheader").length>0||$(n).hasClass("e-slexpandcollapse")||$(n).parents(".e-slexpandcollapse").length>0?(r=$(n),$(n).parents(".e-shrinkheader").length>0?r=$(n).parents(".e-shrinkheader"):$(n).parents(".e-slexpandcollapse").length>0&&(r=$(n).parents(".e-slexpandcollapse")),r[0].style.cursor="not-allowed"):$(n).hasClass("e-shrink")?$(n)[0].style.cursor="not-allowed":$(n).parents(".e-columnrow").has(i.element).length==0||$(n).parents(".e-swimlanerow").length>0||$(n).hasClass("e-columnkey e-disable")||$(n).parents(".e-columnkey.e-disable").length>0?document.body.style.cursor="not-allowed":$(n).hasClass("e-rowcell")&&($(n)[0].style.cursor="not-allowed");u=$(t).find(".e-kanbancard");u.length>0&&(u[0].style.cursor="not-allowed")},n.prototype._removeKanbanCursor=function(){document.body.style.cursor="";this.kanbanObj.element.find(".e-kanbancard,.e-shrink,.e-shrinkheader,.e-slexpandcollapse,.e-rowcell").css("cursor","")},n.prototype._multicloneremove=function(n){if(n.hasClass("e-rowcell")){var t=this.kanbanObj;$(trgtCloneMulti).parents(".e-rowcell").css("border-style","");$(trgtCloneMulti).siblings(".e-kanbancard").show();$(trgtCloneMulti).siblings(".e-targetdragclone").show();t.element.find(".e-responsive")&&$(trgtCloneMulti).siblings(".e-limits").show();$(trgtCloneMulti).remove();trgtCloneMulti.children().remove()}},n.prototype._multiKeyCardDrop=function(n,t,i,r,u){var o=this.kanbanObj,h,f,s,e;for($(i).height(n.height()),n.css("border-style","none"),n.children().hide(),o.element.find(".e-responsive")&&n.find(".e-limits").hide(),n.append(i),r=typeof r=="object"?r:r.split(","),h=o.KanbanCommon._getKanbanCardData(o._currentJsonData,u.attr("id")),f=0;f<t;f++)s=n.find(".e-targetclonemulti"),s.append(ej.buildTag("div.e-columnkey")),e=s.find(".e-columnkey").eq(f).addClass(o.KanbanCommon._preventCardMove(h[0][o.model.keyField],r[f])?"":"e-disable"),e.append(ej.buildTag("div.e-text").text(r[f])),e.css({height:n.height()/t-(1+1/t)}),e.find(".e-text").css("top",e.height()/2-e.find(".e-text").height()/2)},n.prototype._createCardClone=function(n,t){var i=this.kanbanObj,r;return n=i.element.find(".e-draggedcard"),n.length>0&&n.remove(),!ej.isNullOrUndefined(t)&&$(t).hasClass("e-draggable")&&(n=ej.buildTag("div.e-draggedcard"),n.addClass(i.model.cssClass),r=$(t).clone().addClass("dragClone"),$(n).css({width:t.width()}),n.append(r),$(n).find("div:first").removeClass("e-hover"),n.appendTo(i.element)),n},n.prototype._drag=function(){var i=this,u=null,t=null,h=null,c=null,l=null,a,o,f,e=[],r,s,n=this.kanbanObj;n.element!=null&&(h=n.getContent().find("div:first"));$(n.getContent()).find(".e-rowcell.e-drag div.e-kanbancard").not(".e-js").ejDraggable({dragArea:h,clone:!0,cursorAt:{left:-20,top:-20},dragStart:function(r){var h,c,o;if(n.model.enableTouch&&!ej.isNullOrUndefined(n._cardSelect)&&n._cardSelect=="touch")return!1;for(n.element.hasClass("e-responsive")&&n.element.parents("body").addClass("e-kbnwindow-modal"),n._off(n.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard"),s=n.element.find(".e-draggedcard"),t=$(r.element).hasClass("e-cardselection")?$(r.element).parents(".e-columnrow").find(".e-cardselection:visible"):$(r.element),t.length>1&&(h=ej.buildTag("div.e-dragmultiple"),h.append(t.length+n.localizedLabels.Cards),s.children().remove(),s.append(h).css("width","90px")),o=0;o<t.length;o++)c=ej.buildTag("div.e-targetdragclone"),$(t).eq(o).after(c),$(c).css({width:$(t).eq(o).width(),height:$(t).eq(o).height()}),$(t).eq(o).addClass("e-kanban-draggedcard");for(e.length!=0&&(e=[]),o=0;o<t.length;o++)t[o].id!=""&&(a=new ej.DataManager(n._currentJsonData),e.push(a.executeLocal((new ej.Query).where(n.model.fields.primaryKey,ej.FilterOperators.equal,t[o].id))));if(i&&!ej.isNullOrUndefined(r.target)){if(f={draggedElement:t,dragTarget:r.target,data:e,event:r.event},n._trigger("cardDragStart",f))return r.cancel=!0,u&&u.remove(),!1}else return!1;return n._dropinside=typeof f.allowInternalDrop=="boolean"?f.allowInternalDrop:!1,!0},drag:function(s){var p=null,d=null,rt=n.element.find(".e-draggedcard"),h,a,v,ut,ft,ht,bt,nt,ct,et,lt,at,y,g,vt,yt,tt,wt,it,st,ot;if(o=!1,n._cardSelect=null,n.element.find(".e-kanbantooltip").hide(),rt.addClass("e-left-rotatecard"),n._kbnMouseX=ej.isNullOrUndefined(s.event.clientX)?s.event.originalEvent.changedTouches[0].clientX:s.event.clientX,$(".e-kanban-context").length>0&&$(".e-kanban-context").css("visibility","hidden"),ej.isNullOrUndefined(n._kTouchBar)||n._kTouchBar.hide(),!n._autoKbnSwipeRight&&n.element.hasClass("e-responsive")&&n.element.offset().left+n.element.width()-50<n._kbnMouseX&&(p=window.setInterval(function(){rt.is(":hidden")?p&&(p=window.clearInterval(p)):n.element.offset().left+n.element.width()<n._kbnMouseX?p=window.clearInterval(p):n.element.offset().left+n.element.width()-50<n._kbnMouseX?n.KanbanAdaptive._kbnLeftSwipe():p&&(p=window.clearInterval(p))},1500),n._autoKbnSwipeRight=!0,n._autoKbnSwipeLeft=!1),!n._autoKbnSwipeLeft&&n.element.hasClass("e-responsive")&&n.element.offset().left+20>n._kbnMouseX&&(d=window.setInterval(function(){rt.is(":hidden")?d&&(d=window.clearInterval(d)):n.element.offset().left+20>n._kbnMouseX?n.KanbanAdaptive._kbnRightSwipe():d&&(d=window.clearInterval(d))},1500),n._autoKbnSwipeLeft=!0,n._autoKbnSwipeRight=!1),(n.model.allowScrolling||n.model.isResponsive)&&i._kanbanAutoScroll(s),$(s.target).closest(".dragClone").length>0&&(s.target=c,clearTimeout(l),l=setTimeout(function(){s.target=i._getCursorElement(s)},10)),$(s.target).hasClass("e-targetclone")||$(s.target).hasClass("e-rowcell")||$(s.target).hasClass("e-customaddbutton")||$(r).remove(),h=$(s.target).closest(".e-kanbancard").length>0?$(s.target).closest(".e-kanbancard")[0]:s.target,ft=!ej.isNullOrUndefined(n.model.fields.swimlaneKey)&&n.model.swimlaneSettings.allowDragAndDrop,v=$(s.element).closest("td.e-rowcell").addClass("e-dragged"),ht=v.siblings().length,v.parent().find(".e-dragpossible").length==0&&ht>0)for(bt=n.KanbanCommon._getKanbanCardData(n._currentJsonData,$(s.element).attr("id"))[0],nt=0;nt<ht;nt++)if(n.KanbanCommon._preventCardMove(bt[n.model.keyField],n.model.columns[v.parent().children().index(v.siblings()[nt])].key)&&(v.siblings().eq(nt).addClass("e-dragpossible"),ft))for(ct=n.element.find(".e-columnrow"),et=0;et<ct.length;et++)lt=ct.eq(et).find(".e-rowcell"),at=v.parent().children(),lt.eq(at.index(v.siblings().eq(nt))).addClass("e-dragpossible"),lt.eq(at.index(v)).addClass("e-dragpossible");if(v.siblings(".e-drop.e-dragpossible").addClass("e-dropping"),n._dropinside?v.addClass("e-dragpossible e-drop e-droppable e-droppableremove"):v.addClass("e-dragpossible e-drop"),f={draggedElement:t,data:e,dragTarget:h,event:s.event},c=a=$(h).closest("td.e-rowcell"),ut=a.parents(".e-columnrow").find(".e-cardselection"),a&&a.hasClass("e-droppable")&&(ft?!0:$(a).parent().has(s.element[0]).length>0)&&(h!=s.element[0]||ut.length>1)){if(document.body.style.cursor="",$(r).parents(".e-rowcell").index()!=a.index()&&$(r).remove(),a.find(".e-kanbancard").removeClass("e-hover"),n.element.hasClass("e-responsive")&&(vt=$(h).parents(".e-rowcell"),!$(h).hasClass("e-kanbancard")&&$(h).parents(".e-kanbancard").length==0&&vt.length>0&&(h=vt,a=$(h).find(".e-cell-scrollcontent").children().eq(0))),y=a.children().last(),y.hasClass("e-shrinkheader")&&(y=y.prev()),($(h).hasClass("e-columnkey")||$(h).parents(".e-columnkey").length>0||$(h).find(".e-columnkey").length>0)&&(yt=$(h).hasClass("e-rowcell")?$(h):$(h).parents(".e-rowcell"),tt=s.target,$(tt).hasClass("e-columnkey")&&!$(tt).hasClass("e-disable")||$(tt).parents(".e-columnkey").length>0&&!$(tt).parents(".e-disable").length>0?(i._removeKanbanCursor(),yt.find(".e-columnkey.e-active").removeClass("e-active"),yt.find(".e-columnkey.e-multiclonestyle").removeClass("e-multiclonestyle"),$(tt).closest(".e-columnkey").not(".e-disable").addClass("e-active"),$(a).find(".e-active").prev().addClass("e-multiclonestyle")):i._changeKanbanCursor(h,u,s)),($(h).hasClass("e-rowcell")||$(h).hasClass("e-kanbancard")||$(h).hasClass("e-targetdragclone")||$(h).hasClass("e-swimlane-name")||$(h).hasClass("e-limits")||$(h).parents(".e-rowcell").not(".e-drop").length>0)&&$(trgtCloneMulti).is(":visible")&&$(h).index()!=trgtCloneMulti.parents(".e-rowcell").index())$(trgtCloneMulti).siblings(".e-kanbancard").not(".e-kanban-draggedcard").show(),$(trgtCloneMulti).parents(".e-rowcell").css("border-style",""),$(trgtCloneMulti).siblings(".e-targetdragclone,.e-customaddbutton,.e-limits").show(),$(trgtCloneMulti).remove(),trgtCloneMulti.children().remove();else if($(h).hasClass("e-rowcell")&&(s.element[0]!=y[0]||ut.length>1)&&!$(h).hasClass("e-shrink")&&!$(y[0]).hasClass("e-targetclonemulti")){var it=$(h).hasClass("e-dragpossible"),kt=$(h).parent().children().index(h),b=n.model.columns[kt].key,k=(typeof b=="object"?b:b.split(",")).length;if(y.length==0||a.children().length==0||y.offset().top+y.height()<$(u).offset().top||k>1)if(it&&(k==1||kt==$(v).parent().children().index(v)&&(t.length==1||t.length>1&&n.selectedRowCellIndexes[0].cellIndex.length==1)||t.length>1&&!n.selectedRowCellIndexes[0].cellIndex.length>1&&$.inArray(a.index(),n.selectedRowCellIndexes[0].cellIndex)!=-1)){g=$(h).height();var dt=$(s.element[0]).height(),gt=$(h).width(),y=a.children().last(),ni=a,pt=a.find(".e-cell-scrollcontent");n.element.hasClass("e-responsive")&&pt.length>0&&(y=pt.children().last(),ni=pt.children());y.hasClass("e-customaddbutton")?y.before($(r).height(dt).width(gt-28)):ni.append($(r).height(dt).width(gt-28));g<$(h).height()&&(a.height(a.height()),n._tdHeightDiff=$(h).height()-g)}else it&&k>1?(!a.find(".e-columnkey").length>0&&i._multicloneremove(a),i._multiKeyCardDrop(a,k,trgtCloneMulti,b,t)):i._changeKanbanCursor(h,u,s)}else if($(h).hasClass("e-rowcell")&&$(h).hasClass("e-shrink")&&$(h).hasClass("e-dragpossible")||($(h).hasClass("e-shrinkheader IE")||$(h).hasClass("e-shrinkcount")||$(h).hasClass("e-shrinklabel"))&&$(h).parents(".e-rowcell").hasClass("e-dragpossible"))wt=$(h).hasClass("e-rowcell")?$(h):$(h).parents(".e-rowcell"),ot=new ej.DataManager(n.model.columns).executeLocal((new ej.Query).where("key",ej.FilterOperators.equal,wt.attr("ej-mappingkey"))),n.toggleColumn(ot[0].headerText),n.element.find(".e-draggedcard").width(n.element.find(".e-targetdragclone").width()),r.width(n.element.find(".e-targetdragclone").width()),wt.addClass("e-togglevisible");else if($(h).hasClass("e-shrink")&&!$(h).hasClass("e-dragpossible"))i._changeKanbanCursor(h,u,s);else if($(h).hasClass("e-kanbancard")||$(h).hasClass("e-targetclone")){var w=$(h).parents(".e-rowcell"),ti,b=n.model.columns[w.parent().children().index(w)].key,k=(typeof b=="object"?b:b.split(",")).length;g=w.height();it=$(h).parents(".e-rowcell").hasClass("e-dragpossible");ti=ej.isNullOrUndefined(s.event.pageY)?s.event.originalEvent.changedTouches[0].pageY:s.event.pageY;$(h).offset().top+$(h).height()/2>=ti&&it&&(t.length>1&&!n.selectedRowCellIndexes[0].cellIndex.length>1&&$.inArray(a.index(),n.selectedRowCellIndexes[0].cellIndex)!=-1||k==1||$(a).parent().children().index(a)==$(v).parent().children().index(v)&&v.parents("tr").index()==a.parents("tr").index())?$(h).prev()[0]!=s.element[0]||ut.length>1?!$(h).hasClass("e-targetclone")&&($(h).prev().length==0||$(h).prev().length>0&&!$(h).prev().hasClass("e-targetdragclone"))&&(i._removeKanbanCursor(),$(r).insertBefore($(h)).height(rt.find(".e-kanbancard").outerHeight()).width($(h).width()).removeClass("e-targetappend")):i._changeKanbanCursor(h,u,s):($(h).next()[0]!=s.element[0]||ut.length>1)&&it&&(t.length>1&&!n.selectedRowCellIndexes[0].cellIndex.length>1&&$.inArray(a.index(),n.selectedRowCellIndexes[0].cellIndex)!=-1||k==1||$(a).parent().children().index(a)==$(v).parent().children().index(v)&&(v.parents("tr").index()==a.parents("tr").index()||ft))?(g=$(h).parents(".e-rowcell").height(),!$(h).hasClass("e-targetclone")&&($(h).next().length==0||$(h).next().length>0&&!$(h).next().hasClass("e-targetdragclone"))&&(o=!0,i._removeKanbanCursor(),$(r).insertAfter($(h)).height(rt.find(".e-kanbancard").outerHeight()).width($(h).width()).addClass("e-targetappend"))):it&&k>1&&!w.find(".e-columnkey").length>0&&!($(a).parent().children().index(a)==$(v).parent().children().index(v))?(i._multicloneremove(a),i._multiKeyCardDrop(w,k,trgtCloneMulti,b,t)):i._changeKanbanCursor(h,u,s);g<w.height()&&(w.height(w.height()),n._tdHeightDiff=w.height()-g)}$(r).parent().hasClass("e-rowcell")&&v.parent().has($(r).parent()).length==0&&ft?(n.element.find(".e-columnrow .e-rowcell.e-drop").addClass("e-dropping"),v.removeClass("e-dropping").addClass("e-dragged")):(n.element.find(".e-columnrow .e-rowcell").removeClass("e-dropping"),v.addClass("e-dragged"),v.siblings(".e-drop.e-dragpossible ").addClass("e-dropping"))}else($(h).parents(".e-rowcell").not(".e-droppable").length>0||$(h).hasClass("e-swimlane-name")||$(h).hasClass("e-limits")||$(h).hasClass("e-swimlanerow")||$(h).parents(".e-swimlanerow").length>0)&&$(trgtCloneMulti).is(":visible")&&($(trgtCloneMulti).siblings(".e-kanbancard").not(".e-kanban-draggedcard").show(),$(trgtCloneMulti).parents(".e-rowcell").css("border-style",""),$(trgtCloneMulti).siblings(".e-targetdragclone,.e-customaddbutton,.e-limits").show(),$(trgtCloneMulti).remove(),trgtCloneMulti.children().remove()),($(h).hasClass("e-swimlanerow")||$(h).parents(".e-swimlanerow").length>0)&&$(r).is(":visible")&&$(r).remove(),i._changeKanbanCursor(h,u,s);return(st=n.element.find(".e-togglevisible"),st.length>0&&!$(h).hasClass("e-togglevisible")&&$(h).parents(".e-togglevisible").length==0&&(ot=new ej.DataManager(n.model.columns).executeLocal((new ej.Query).where("key",ej.FilterOperators.equal,st.attr("ej-mappingkey"))),n.toggleColumn(ot[0].headerText),n.element.find(".e-draggedcard").width(n.element.find(".e-targetdragclone").width()),r.width(n.element.find(".e-targetdragclone").width()),st.removeClass("e-togglevisible")),n._trigger("cardDrag",f))?!1:!0},dragStop:function(r){n._cardSelect=null;r.dragData=e;r.dragEle=t;i._dragStop(r,u,o)},helper:function(t){return n.model.enableTouch&&!ej.isNullOrUndefined(n._cardSelect)&&n._cardSelect=="touch"?!1:(r=ej.buildTag("div.e-targetclone"),trgtCloneMulti=ej.buildTag("div.e-targetclonemulti"),$(r).css({width:t.element.width(),height:t.element.height()}),u=i._createCardClone(u,t.element))}})},n}();window.ej.createObject("ej.KanbanFeatures.DragAndDrop",InternalDragAndDrop,window);InternalEdit=function(){function n(n){this.kanbanObj=null;this._dropDownManager=null;this._editForm=null;this._onKbnDialogBeforeClose=function(){var n=this.kanbanObj,t=n.element.find("#"+n._id+"_dialogEdit_wrapper");t.addClass("e-kbndialog-transitionclose")};this._onKbnDialogBeforeOpen=function(){var n=this.kanbanObj,t=n.element.find("#"+n._id+"_dialogEdit_wrapper");t.removeClass("e-kbndialog-transitionclose")};this.kanbanObj=n}return n.prototype._processEditing=function(){var n=this.kanbanObj,t=this._columnToSelect(),i=this,r;n.model.query._fromTable!=""&&t.from(n.model.query._fromTable);n._dataSource()instanceof ej.DataManager&&t.queries.length&&!n._dataManager.dataSource.offline?(r=n._dataSource().executeQuery(t),r.done(ej.proxy(function(n){i._dropDownManager=new ej.DataManager(n.result);i._addDialogEditingTemplate()}))):i._addDialogEditingTemplate()},n.prototype._renderDialog=function(){return ej.buildTag("div.e-dialog e-kanbandialog e-dialog-content e-shadow e-widget-content","",{display:"none"},{id:this.kanbanObj._id+"_dialogEdit"})},n.prototype._columnToSelect=function(){for(var i=[],t=this.kanbanObj,n=0;n<t.model.editSettings.editItems.length;n++)t.model.editSettings.editItems[n].editType=="dropdownedit"&&ej.isNullOrUndefined(t.model.editSettings.editItems[n].dataSource)&&i.push(t.model.editSettings.editItems[n].field);return i.length?(new ej.Query).select(i):new ej.Query},n.prototype.cancelEdit=function(){var n=this.kanbanObj,t;(n.model.editSettings.allowEditing||n.model.editSettings.allowAdding)&&(n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="dialogtemplate"?$("#"+n._id+"_dialogEdit").ejDialog("close"):(n.model.editSettings.editMode=="externalform"||n.model.editSettings.editMode=="externalformtemplate")&&(n.model.editSettings.formPosition=="right"&&$(n.element).children().css("width","100%"),$("#"+n._id+"_externalEdit").css("display","none")),n.refreshTemplate(),t={requestType:"cancel"},n.KanbanCommon._processBindings(t));n.element.parents("body").removeClass("e-kbnwindow-modal");n.element.hasClass("e-responsive")&&n.kanbanWindowResize()},n.prototype._renderExternalForm=function(){var n=this.kanbanObj,f=ej.buildTag("div","",{display:"none"},{id:n._id+"_externalEdit","class":"e-form-container"}),t=ej.buildTag("div","","",{id:n._id+"_eFormHeader","class":"e-form-titlebar"}),e=ej.buildTag("span","","",{"class":"e-form-title"}),i=ej.buildTag("div","","",{id:n._id+"_closebutton","class":"e-externalform-icon"}),o=ej.buildTag("span","","",{"class":"e-icon e-externaledit e-cancel"});i.append(o);t.append(e).append(i);var r=ej.buildTag("div","","",{id:n._id+"_eFormContent","class":"e-form-content"}),u=ej.buildTag("div","","",{id:n._id+"_externalForm","class":"e-externalform"}),s=ej.buildTag("div","","",{"class":"e-externalformedit"});return u.append(s),r.append(u),f.append(t).append(r)},n.prototype._maxZindex=function(){var n=1;return n=Math.max.apply(null,$.map($("body *"),function(n){if($(n).css("position")=="absolute")return parseInt($(n).css("z-index"))||1})),(n==undefined||n==null)&&(n=1),n},n.prototype.addCard=function(n,t){var i=this.kanbanObj,o,e,r,f,u;if(i._currentJsonData.length==0){o=[];o.push(t);i.element.ejKanban({dataSource:o});return}if(i.model.editSettings.allowAdding)if(r=i.model.fields.primaryKey,n!="bulk"&&$.type(i._currentJsonData[0][r])=="number"&&(n=parseInt(n)),e={data:t,requestType:"save",action:"add",primaryKeyValue:n},i._cAddedRecord=t,i._saveArgs=e,n&&t)i.updateCard(n,t);else{for(f=i.model.editSettings.editItems,e={requestType:"add"},i._currentData={},i._isAddNewClick&&(i.model.fields.swimlaneKey&&(i._currentData[i.model.fields.swimlaneKey]=$(i._newCard).parent().prev(".e-swimlanerow").find(".e-slkey").text()),i.model.keyField&&(i._currentData[i.model.keyField]=i.model.columns[$(i._newCard).index()].key)),u=0;u<f.length;u++)i._currentData[f[u].field]=ej.isNullOrUndefined(f[u].defaultValue)?ej.isNullOrUndefined(i._currentData[f[u].field])?"":i._currentData[f[u].field]:f[u].defaultValue;i._currentData[r]=i._currentJsonData[i._currentJsonData.length-1][r];$.type(i._currentJsonData[0][r])=="string"&&(i._currentData[r]=parseInt(i._currentData[r]));i._currentData[r]=i._currentData[r]+1;$.type(i._currentJsonData[0][r])=="string"&&(i._currentData[r]=i._currentData[r].toString());e.data=i._currentData;i.element.find(".e-kanbandialog").removeAttr("data-id");i.KanbanCommon._processBindings(e)}},n.prototype.deleteCard=function(n){var u,t=this.kanbanObj,f,i,e,r,o=t.model.fields.primaryKey,t=this.kanbanObj;if(f=t.element.find("#"+n),e=new ej.DataManager(t._currentJsonData),r=new ej.Query,r=r.where(t.model.fields.primaryKey,ej.FilterOperators.equal,n),i=e.executeLocal(r),$.type(t._currentJsonData[0][o])=="number"&&(n=parseInt(n)),u={div:f,data:i[0],requestType:"delete",primaryKeyValue:n},t._saveArgs=u,t._trigger("actionBegin",u))return!0;t._cDeleteData=i;t.updateCard(n,i[0])},n.prototype.startEdit=function(n){var t=this.kanbanObj;if($.type(n)!="object"&&(n=t.element.find("#"+n)),t.model.editSettings.allowEditing&&n.hasClass("e-kanbancard")){var f,i,e=t.model.fields.primaryKey,r=n.attr("id"),s=n.hasClass("e-rowcell")?n.index():n.closest(".e-rowcell").index(),h=t.getIndexByRow(n.closest("tr")),o,u=new ej.Query;if(f=n.closest(".e-kanbancard"),t._cardEditClick==!0?t._currentData.data=t._dblArgs.data:(o=new ej.DataManager(t._currentJsonData),u=u.where(e,ej.FilterOperators.equal,n.attr("id")),t._currentData=o.executeLocal(u)),$.type(t._currentJsonData[0][e])=="number"&&(r=parseInt(r)),i={target:n,rowIndex:h,data:t._currentData[0],columnIndex:s,cardIndex:f.index(),primaryKeyValue:r},t._trigger("beginEdit",i),i.requestType="beginedit",i.cancel)return;t.KanbanCommon._processBindings(i)}},n.prototype._refreshEditForm=function(n){var t=this.kanbanObj,v,s,b,d,y,l,p,f,i,r,u,c,a,o,h,e,k,w;for(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate"?(b=t.element.find("#"+t._id+"_dialogEdit_wrapper"),y=95,b.show(),l=$("#"+t._id+"_dialogEdit"),v=l.find("tr").find(".e-rowcell")):(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&(d=t.element.find("#"+t._id+"_externalEdit"),y=133,d.show(),l=$("#"+t._id+"_externalForm"),v=l.find("div").find(".e-rowcell")),e=0;e<v.length;e++)t._tdsOffsetWidth[e]=v.get(e).offsetWidth;for((t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate")&&(s=ej.max(t._tdsOffsetWidth)*(y/100)),p=0;p<t.model.editSettings.editItems.length;p++){if(f=t.model.editSettings.editItems[p],i=l.find("#"+t._id+"_"+f.field),(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&(s=ej.max(t._tdsOffsetWidth)*(y/100),$(i).parent().css("width",s+"px")),f.editType=="stringedit"&&i.width(s-4),c=f.editType=="textarea",a=t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate",u=f.editParams,!ej.isNullOrUndefined(u)&&c?(ej.isNullOrUndefined(u.width)||(i.width(u.width),c&&a&&i.parent().width(u.width+8)),ej.isNullOrUndefined(u.height)||(i.height(u.height),c&&a&&i.parent().height(u.height+8))):c&&(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate")?i.width(250).height(95):c&&a&&t.model.editSettings.formPosition=="bottom"?(i.height(95),$(i).css({width:"400px"}),$(i).parent().css({width:"500px"})):c&&a&&t.model.editSettings.formPosition=="right"&&(i.css({width:s-8}),i.height(150),$(i).parent().css("width",s+8)),f.editType=="rteedit")r={width:"450px",height:"260px",minHeight:"240px",locale:t.model.locale,enableRTL:t.model.enableRTL},u=f.editParams,r.toolsList=["style","links"],r.tools={style:["bold","italic","underline"],casing:["upperCase","lowerCase"],links:["createLink"]},ej.isNullOrUndefined(u)||$.extend(r,u),l.find("#"+t._id+"_"+f.field).ejRTE(r);else if(f.editType=="dropdownedit"){if(r={width:s,enableIncrementalSearch:!0,enableRTL:t.model.enableRTL},o=i.val(),u=f.editParams,h=[],f.field==t.model.keyField&&n.requestType==="beginedit")for(e=0;e<i.children().length;e++)k=i.children().eq(e).val(),ej.isNullOrUndefined(t.model.workflows)||(t.KanbanCommon._preventCardMove(o,i.children().eq(e).val())?!0:h.push(e)),o!=k&&(t.model.columns[t._getColumnKeyIndex(k)].allowDrop||$.inArray(e,h)===-1&&h.push(e),t.model.columns[t._getColumnKeyIndex(o)].allowDrag||$.inArray(e,h)===-1&&h.push(e));if(h.length>0)for(w=h.length-1;w>=0;w--)$(i.children()).eq(h[w]).remove();i.hasClass("e-disable")&&(r.enabled=!1);ej.isNullOrUndefined(u)||$.extend(r,u);t._kbnDdlWindowResize=!0;i.ejDropDownList(r);i.ejDropDownList("setSelectedValue",i.val());t._kbnDdlWindowResize=!1}else f.editType=="numericedit"?(r={width:s},o=i.val(),u=f.editParams,r.cssClass=t.model.cssClass,r.showSpinButton=!0,r.enableRTL=t.model.enableRTL,r.locale=t.model.locale,o.length&&(r.value=parseFloat(o)),i.hasClass("e-disable")&&(r.enabled=!1),ej.isNullOrUndefined(u)||$.extend(r,u),i.ejNumericTextbox(r)):f.editType=="datepicker"?(r={width:s},o=i.val(),u=f.editParams,r.cssClass=t.model.cssClass,r.displayDefaultDate=!0,r.enableRTL=t.model.enableRTL,r.locale=t.model.locale,o.length&&(r.value=new Date(o)),i.hasClass("e-disable")&&(r.enabled=!1),ej.isNullOrUndefined(u)||$.extend(r,u),i.ejDatePicker(r)):f.editType=="datetimepicker"&&(r={width:s,cssClass:t.model.cssClass,locale:t.model.locale,showPopupButton:!1,enableRTL:t.model.enableRTL},o=i.val(),u=f.editParams,o.length&&(r.value=new Date(o)),i.hasClass("e-disable")&&(r.enabled=!1),ej.isNullOrUndefined(u)||$.extend(r,u),i.ejDateTimePicker(r));f.editType!="textarea"&&$(i.outerWidth(s)).height(28);ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8&&i.css("line-height","26px")}a&&(t._editForm=t.element.find(".e-externalform"));(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate")&&(t._editForm=t.element.find(".kanbanform"),b.hide());this._formFocus()},n.prototype._setKanbanDdlValue=function(n){for(var e,i,r=n.find("select.e-field"),u,f=n.find("input.e-field.e-dropdownlist"),t=0;t<r.length;t++)e={},e[this.kanbanObj._id+"drpDownTempl"]="{{:"+r[t].name.replace(/[^a-z0-9\s]/gi,"")+"}}",$.templates(e),u=$.render[this.kanbanObj._id+"drpDownTempl"](this.kanbanObj._currentData),n.find("select").eq(t).val(u).attr("selected","selected"),r.eq(t).val(u);for(i=0;i<f.length;i++)f.eq(i).val(ej.getObject(f.eq(i).attr("name"),this.kanbanObj._currentData[0]))},n.prototype._editAdd=function(n){var f,t=this.kanbanObj,p=t.element.find(".e-kanbandialog"),e=$(n.target),a,h=new ej.Query,c=t.model.fields.primaryKey,o=document.createElement("div"),l=$(o),i,r,u,v,s,y;n.requestType=="add"?l.addClass("e-addedrow"):(t._currentData={},e.hasClass("e-kanbancard")?i=e.attr("id"):e.parents(".e-kanbancard").length>0&&(i=e.parents(".e-kanbancard").attr("id")),$.type(t._currentJsonData[0][c])=="number"&&(i=parseInt(i)),a=new ej.DataManager(t._currentJsonData),h=h.where(c,ej.FilterOperators.equal,i),t._currentData=a.executeLocal(h),l.addClass("e-editedrow"));o.innerHTML=$.render[t._id+"_dialogEditingTemplate"](t._currentData);this._setKanbanDdlValue(l);n.requestType=="add"?ej.isNullOrUndefined(t.model.fields.title)||$.isEmptyObject(t._newData)?u=t.localizedLabels.AddFormTitle:(r=t.model.fields.title,u=t.localizedLabels.EditFormTitle+t._newData[r]):(r=c,ej.isNullOrUndefined(t.model.fields.title)||(r=t.model.fields.title),u=t.localizedLabels.EditFormTitle+t._currentData[0][r]);t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate"?(f=$("#"+t._id+"_dialogEdit"),f.html($(o)),v={cssClass:t.model.cssClass,enableRTL:t.model.enableRTL,width:"auto",content:"#"+t._id,close:$.proxy(this.cancelEdit,this),beforeClose:$.proxy(this._onKbnDialogBeforeClose,this),beforeOpen:$.proxy(this._onKbnDialogBeforeOpen,this),open:$.proxy(this._onKbnDialogOpen,this),enableModal:!0,enableResize:!1,title:u},f.ejDialog(v),f.ejDialog("open"),p.attr("data-id",i),s=t.element.find("#"+t._id+"_dialogEdit_wrapper"),s.css("left","0"),y=self!=parent?ej.browserInfo().name=="chrome"?$(window).scrollTop():-$(window.frameElement).offset().top:$(window).scrollTop(),s.css("top",y),s.hide()):(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&($("#"+t._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),$("#"+t._id+"_externalForm").find(".e-externalformedit").html($(o)),$("#"+t._id+"_eFormHeader").find(".e-form-title").text(u),$("#"+t._id+"_externalForm").attr("data-id",i),this._externalFormPosition());$.isFunction($.validator)&&(this.initValidator(),this.setValidation())},n.prototype._onKbnDialogOpen=function(){var n=this.kanbanObj,t=n.element.find("#"+n._id+"_dialogEdit_wrapper"),i,r,e,u,f,o,s,c,h,l;t.css("position","absolute");e=$(n.element)[0];u=e.offsetTop;f=e.offsetLeft;o=$(e).find(".e-kanbancontent")[0].offsetWidth;s=$(e).find(".e-kanbancontent")[0].offsetHeight+$(n.element).find(".e-kanbanheader")[0].offsetHeight;window.pageYOffset>u?(i=u+s>window.pageYOffset+window.innerHeight?Math.max(0,(window.innerHeight-t.outerHeight())/2):Math.max(0,(u+s-window.pageYOffset-t.outerHeight())/2),i=window.pageYOffset+i):(i=u+s>window.pageYOffset+window.innerHeight?Math.max(0,(window.innerHeight-(u-window.pageYOffset)-t.outerHeight())/2):Math.max(0,(s-t.outerHeight())/2),i=u+i);window.pageXOffset>f?(r=f+o>window.pageXOffset+window.innerWidth?Math.max(0,(window.innerWidth-t.outerWidth())/2):Math.max(0,(f+o-window.pageXOffset-t.outerWidth())/2),r=window.pageXOffset+r):(r=f+o>window.pageXOffset+window.innerWidth?Math.max(0,(window.innerWidth-(f-window.pageXOffset)-t.outerWidth())/2):Math.max(0,(o-t.outerWidth())/2),r=f+r);t.css("top",i+"px");t.css("left",r+"px");t.show();this._formFocus();n._editForm.find(".e-rte").length>0&&n.element.find("#"+n._id+"_dialogEdit").data("ejDialog")._resetScroller();n.model.isResponsive&&n.element.hasClass("e-responsive")?(n._on($(".e-kanban-editdiv"),$.isFunction($.fn.tap)&&n.model.enableTouch?"tap":"click","",n._kbnAdaptEditClickHandler),n.KanbanAdaptive._setAdaptEditWindowHeight(),t.parents(".e-kanban").length>0&&t.appendTo("body")):$(window).scrollTop()+$(window).height()<t.height()+i&&(c=$("#"+n._id+"_dialogEdit"),h=c.parents(".e-dialog-scroller"),l,l=h.prev(".e-titlebar"),h.ejScroller({height:$(window).height()-(l.height()+n.element.find(".e-kanbandialog").offset().top)}),h.data("ejScroller").refresh(),c.css("height",h.height()))},n.prototype._externalFormPosition=function(){var n=this.kanbanObj,t=$(n.element).offset(),r=$(n.element).width(),u=$(n.element).height(),i=$("#"+n._id+"_externalEdit");switch(n.model.editSettings.formPosition){case"right":$(i).find(".e-close").removeClass("e-bottomleft").addClass("e-topright");$("#"+n._id+"_eFormContent").height("auto");n.model.allowScrolling||n.model.isResponsive?($(i).css({left:t.left+r+2+"px",top:t.top+"px",position:"absolute",width:"25%"}),$(".e-externalrow").css("padding-right","0px")):($(n.element).css({width:"100%"}),$(n.element).children().not(".e-form-container").css("width","73%"),$(i).css({left:t.left+$(n.element).children().width()+2+"px",top:t.top+"px",position:"absolute",width:"25%"}));break;case"bottom":$(i).find(".e-close").removeClass("e-topright").addClass("e-bottomleft");$(i).css({left:t.left+"px",top:t.top+u+1+"px"});$("#"+n._id+"_eFormContent").width("100%");(n.element.find(".e-scrollbar").hasClass("e-hscrollbar")||n.model.isResponsive)&&$("#"+n._id+"_externalEdit").css({border:"none","border-top":"1px solid"})}},n.prototype._formFocus=function(){for(var n,i=$(this.kanbanObj._editForm).find("input,select,div.e-field,textarea.e-field"),r=!1,t=0;t<i.length;t++)n=i.eq(t),(n.is(":disabled")||r||n.is(":hidden")&&typeof(n.data("ejDropDownList")||n.data("ejNumericTextbox"))!="object")&&!n.hasClass("e-rte")||(this._focusKbnDialogEle(n),r=!0)},n.prototype._focusKbnDialogEle=function(n){if(n.length)if((n[0].tagName.toLowerCase()!="select"||n.hasClass("e-field e-dropdownlist"))&&n[0].tagName.toLowerCase()!="input"&&(n[0].tagName.toLowerCase()!="textarea"||n.hasClass("e-numerictextbox")))n.hasClass("e-field e-dropdownlist")?n.closest(".e-ddl").focus():n.hasClass("e-numerictextbox")?n.siblings("input:visible").first().select().focus():n.find("input:visible,select").first().select().focus();else if(n.hasClass("e-rte")){var t=n.data("ejRTE");$(t).focus();t.selectAll()}else n.focus().select(),n[0].focus()},n.prototype.endEdit=function(){var n=this.kanbanObj,u,c,t,l,a,i,f,r,o,e,s,v,h;if(n.model.editSettings.allowEditing||n.model.editSettings.allowAdding){if(u=n.model.fields.primaryKey,c=n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="dialogtemplate"?$("#"+n._id+"_dialogEdit"):n.element.find(".e-externalform"),f={},!this.editFormValidate())return!0;for(t=document.getElementById(n._id+"EditForm"),l=$(t),a=l.closest("div"),ej.isNullOrUndefined(c.attr("data-id"))?(i=n._currentJsonData[n._currentJsonData.length-1][u],$.type(n._currentJsonData[0][u])=="string"&&(i=parseInt(i)),i=i+1,$.type(n._currentJsonData[0][u])=="string"&&(i=i.toString()),f[u]=i):(i=c.attr("data-id"),$.type(n._currentJsonData[0][u])=="number"&&(i=parseInt(i))),r=0;r<t.length;r++)if(!a.hasClass("e-addedrow")||!$(t[r]).hasClass("e-identity")){if(o=t[r].name,e=$(t[r]),(e.hasClass("e-dropdownlist")||e.hasClass("e-input"))&&(ej.isNullOrUndefined(e.attr("id"))||e.attr("id").indexOf("_input")!=-1||e.attr("id").indexOf("_hidden")!=-1)){!ej.isNullOrUndefined(l[1])&&ej.isNullOrUndefined(t[r+1])&&(t=l[1],r=-1);continue}o!=undefined&&(o==""&&(t[r].id.indexOf("Save")!=-1||t[r].id.indexOf("Cancel")!=-1?o="":(o=t[r].id.replace(n._id+"_",""),o=o.replace("_hidden",""))),o!=""&&f[o]==null?(s=t[r].value,$(t[r]).hasClass("e-datepicker")?s=e.ejDatePicker("model.value"):$(t[r]).hasClass("e-datetimepicker")?s=e.ejDateTimePicker("model.value"):e.is(".e-numerictextbox")?(s=e.ejNumericTextbox("getValue"),ej.isNullOrUndefined(s)||(s=s.toString())):e.data("ejDropDownList")&&(s=e.ejDropDownList("getSelectedValue")),v=t[r].type!="checkbox"?s:$(t[r]).is(":checked"),f[o]=v):o==u&&(f[u]=t[r].value))}if(n._editForm=$("#"+n._id+"EditForm"),f[u]=isNaN(f[u])?i:$.type(n._currentJsonData[0][u])=="number"?i=parseInt(f[u]):i=f[u],h={data:f,requestType:"save"},n._trigger("actionBegin",h))return!0;$(n._editForm).hasClass("e-formdestroy")?n.refresh(!0):ej.isNullOrUndefined(c.attr("data-id"))?(h.action="add",h.primaryKeyValue=i,n._cAddedRecord=f):(h.action="edit",h.primaryKeyValue=i,n._cModifiedData=f);h.primaryKey=u;n._saveArgs=h;n.updateCard(i,f);n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="dialogtemplate"?(c.removeAttr("data-id"),$("#"+n._id+"_dialogEdit").ejDialog("close")):(n.model.editSettings.editMode=="externalform"||n.model.editSettings.editMode=="externalformtemplate")&&(n.model.editSettings.formPosition=="right"&&$(n.element).children().css("width","100%"),c.removeAttr("data-id"),$("#"+n._id+"_externalEdit").css("display","none"))}n.element.hasClass("e-responsive")&&(n.kanbanWindowResize(),n.element.find(".e-kbnadapt-editdlg").length==0&&$("#"+n._id+"_dialogEdit_wrapper").appendTo(n.element))},n.prototype.initValidator=function(){for(var n=this.kanbanObj,i=n.element.find(".kanbanform"),t=0;t<i.length;t++)i.eq(t).validate({ignore:".e-hide,:hidden",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(t,i){i.is(":hidden")&&(i=i.siblings("input:visible"));var u=i.closest("td"),r=$(t).addClass("e-error"),f=ej.buildTag("div.e-errortail e-toparrow");n.model.editSettings.editMode!="dialog"&&u.find(".e-error").remove();i.parent().hasClass("e-in-wrap")?r.insertAfter(i.closest(".e-widget")):r.insertAfter(i);r.prepend(f);n.model.enableRTL?n.model.editSettings.editMode!="dialog"&&r.offset({left:i.offset().left,top:i.offset().top+i.height()}):n.model.editSettings.editMode!="dialog"&&r.offset({left:i.offset().left,top:i.offset().top+i.height()});r.fadeIn("slow")}})},n.prototype.setValidation=function(){for(var t=this.kanbanObj,n=0;n<t.model.editSettings.editItems.length;n++)ej.isNullOrUndefined(t.model.editSettings.editItems[n].validationRules)||this.setValidationToField(t.model.editSettings.editItems[n].field,t.model.editSettings.editItems[n].validationRules)},n.prototype.setValidationToField=function(n,t){var i=n,u,r,f=this.kanbanObj,e,o;ej.isNullOrUndefined(n)||(i=i.replace(/[^a-z0-9\s_]/gi,""));e=$("#"+f._id+"EditForm");u=e.find("#"+f._id+"_"+i).length>0?e.find("#"+f._id+"_"+i):e.find("#"+i);u.attr("name")||u.attr("name",n);u.rules("add",t);o=$("#"+f._id+"EditForm").validate();o.settings.messages[n]=o.settings.messages[n]||{};ej.isNullOrUndefined(t.required)||(r=ej.isNullOrUndefined(t.messages&&t.messages.required)?$.validator.messages.required:t.messages.required,r.indexOf("This field")==0&&(r=r.replace("This field",n)),o.settings.messages[n].required=r)},n.prototype.editFormValidate=function(){return $.isFunction($.validator)?$("#"+this.kanbanObj._id+"EditForm").validate().form():!0},n.prototype._addDialogEditingTemplate=function(){var n=this.kanbanObj,h=ej.buildTag("div"),u,y,f,p,r,w,b,e,k,c,o,i,t,l,tt,d,it,g,a,v,rt,s,nt;if(n.model.columns.length!=0){if(u=ej.buildTag("form.kanbanform","",{},{id:n._id+"EditForm"}),y=ej.buildTag("table","",{},{cellspacing:"14px"}),ej.isNullOrUndefined(n.model.editSettings.editMode)&&(n.model.editSettings.editMode="dialog"),n.model.editSettings.editMode=="dialog"||n.model.editSettings.editMode=="externalform")for(o=0;o<n.model.editSettings.editItems.length;o++){i=n.model.editSettings.editItems[o];t=i.field;n.model.editSettings.editMode=="dialog"?(k="tr",c="td"):(k="div.e-externalrow",c="div");f=ej.buildTag(k);p=ej.buildTag(c,"",{}).addClass("e-label");r=ej.buildTag(c,"",{"text-align":"left"}).addClass("e-rowcell");o==n.model.editSettings.editItems.length-1&&r.addClass("e-last-rowcell");f.append(p.get(0)).append(r.get(0));p.append("<label style='text-transform:capitalize' for='"+t+"'>"+t+"<\/label>");n.model.editSettings.editMode=="externalform"&&n.model.editSettings.formPosition=="right"&&f.css({width:"300px","padding-right":"0px"});ej.isNullOrUndefined(i.editType)&&(i.editType="stringedit");ej.isNullOrUndefined(t)||(t=t.replace(/[^a-z0-9\s_]/gi,""));switch(i.editType){case"stringedit":n.model.fields.primaryKey==t?r.html(ej.buildTag("input.e-field e-ejinputtext e-disable","",{},{value:"{{html:#data['"+t+"']}}",id:n._id+"_"+t,name:t,disabled:"disabled"})):r.html(ej.buildTag("input.e-field e-ejinputtext","",{},{value:"{{html:#data['"+t+"']}}",id:n._id+"_"+t,name:t}));break;case"numericedit":r.html(ej.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+t+"']}}",id:n._id+"_"+t,name:t}));break;case"dropdownedit":if(l=[],ej.isNullOrUndefined(i.dataSource))for(v=(new ej.Query).where(ej.Predicate.or(n.keyPredicates)).select(i.field),ej.isNullOrUndefined(this._dropDownManager)||!n._dataManager.dataSource.offline&&n._dataManager.dataSource.json.length?g=n._dataManager.executeLocal(v):(n._dataManager.adaptor instanceof ej.JsonAdaptor&&i.field.indexOf(".")!=-1&&(rt=i.field.replace(/\./g,ej.pvt.consts.complexPropertyMerge),v=(new ej.Query).select(rt)),g=this._dropDownManager.executeLocal(v)),a=ej.dataUtil.mergeSort(ej.dataUtil.distinct(g)),s=0;s<a.length;s++)l.push({text:a[s],value:a[s]});else l=i.dataSource;d=ej.buildTag("select");it=ej.buildTag("option","{{:text}}",{},{value:"{{html:#data['value']}}"});d.append(it);tt=$.templates(d.html());r.get(0).innerHTML=ej.isNullOrUndefined(i.editParams)||ej.isNullOrUndefined(i.dataSource)?["<select>",tt.render(l),"<\/select>"].join(""):"<input>";r.find("select,input").prop({id:n._id+"_"+t,name:t}).addClass("e-field e-dropdownlist");break;case"rteedit":r.html(ej.buildTag("textarea.e-field e-rte","{{html:#data['"+t+"']}}",{},{id:n._id+"_"+t,name:t}));break;case"textarea":r.html(ej.buildTag("textarea.e-field e-kanbantextarea e-ejinputtext","{{html:#data['"+t+"']}}",{},{id:n._id+"_"+t,name:t}));break;case"datepicker":case"datetimepicker":r.html(ej.buildTag("input.e-"+i.editType+" e-field","",{},{type:"text",value:"{{:#data['"+t+"']}}",id:n._id+"_"+t,name:t}))}n.model.editSettings.editMode=="dialog"?(u.append(y),y.append(f)):u.append(f);u.appendTo(h)}else n.model.editSettings.editMode=="dialogtemplate"&&n.model.editSettings.dialogTemplate!=null&&(nt=n.model.editSettings.dialogTemplate),n.model.editSettings.editMode=="externalformtemplate"&&n.model.editSettings.externalFormTemplate!=null&&(nt=n.model.editSettings.externalFormTemplate),u.html($(nt).html()),u.appendTo(h);w=ej.buildTag("input.e-save","",{},{type:"button",id:n._id+"_Save"});w.ejButton({text:n.localizedLabels.SaveButton});b=n.model.editSettings.formPosition!="right"?ej.buildTag("input.e-cancel","",{},{type:"button",id:n._id+"_Cancel"}):ej.buildTag("input.e-cancel","",{},{type:"button",id:n._id+"_Cancel"});b.ejButton({text:n.localizedLabels.CancelButton});e=n.model.editSettings.editMode!="dialog"&&n.model.editSettings.editMode!="dialogtemplate"?ej.buildTag("div","","",{"class":"e-editform-btn"}):ej.buildTag("div#"+n._id+"_EditBtnDiv","",{},{"class":"e-kanban-editdiv"});e.append(w);e.append(b);n.model.editSettings.editMode!="dialog"&&n.model.editSettings.editMode!="dialogtemplate"?e.appendTo(h):u.append(e);$.templates(n._id+"_dialogEditingTemplate",h.html())}},n}();window.ej.createObject("ej.KanbanFeatures.Edit",InternalEdit,window);InternalContext=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._renderContext=function(){var n=this.kanbanObj,u,l,h,i,r,t,e,y,a,f,p,c,o,s,v;for(u=n.model.contextMenuSettings.menuItems,f=ej.buildTag("ul","",{},{id:n._id+"_Context"}),p=n.model.contextMenuSettings.disableDefaultItems,s=0;s<u.length;s++)(u[s]==""||u[s]==" ")&&u.splice(s,1);for(t=0;t<u.length;t++)i=u[t],$.inArray(i,p)==-1&&(r=this._items(i,"menuItem")),f.append(r);for(c=n.model.contextMenuSettings.customMenuItems,e=0;e<c.length;e++)y=c[e].text,a=this._items(y,"custom"),c[e].template&&a.append($(c[e].template)),f.append(a);for(o=ej.buildTag("ul","",{},{id:n._id+"_SubContext"}),t=0;t<n.model.columns.length;t++)i=n.model.columns[t].headerText,l=ej.buildTag("input","",{},{type:"checkbox",name:i}),r=this._items(i,"subMenuItem"),r.find("span").append(l),r.find("span").addClass("e-checkbox e-visiblecolumns"),o.append(r),l.ejCheckBox({checked:n.model.columns[t].visible});if($(f).find("li.e-column.e-visiblecolumn").append(o),n.model.fields.swimlaneKey){for(o=ej.buildTag("ul","",{},{id:n._id+"_SubContext"}),v=(new ej.Query).select([n.model.fields.swimlaneKey]),h=n._dataManager.dataSource.offline?n._dataManager.executeLocal(v):n._contextSwimlane.executeLocal(v),h=ej.dataUtil.mergeSort(ej.dataUtil.distinct(h)),t=0;t<h.length;t++)i=h[t],r=this._items(i,"subMenuItem"),o.append(r);$(f).find("li.e-move.e-swimlane").append(o)}$(f).ejMenu({menuType:ej.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+n._id,click:$.proxy(n._clickevent,n),width:"auto",cssClass:"e-kanban-context",beforeOpen:$.proxy(n._menu,n),open:$.proxy(this._contextopen,n)});n._conmenu=f.data("ejMenu")},n.prototype._contextopen=function(){var n=this._conmenu.element;n.length>0&&(n.find("li").is(":visible")||n.css("visibility","hidden"))},n.prototype._kanbanContextClick=function(n,t){var u,i,r,o,e,f,h,s,l,c;if(f=n.parentText!=null?n.parentText:n.events.text,u=$(t._contexttarget),n.targetelement=t._contexttarget,i=u.closest(".e-kanbancard"),r=i.length,i.length>0&&(n.card=i,n.index=i.parent(".e-rowcell").find(".e-kanbancard").index(i),n.cellIndex=i.parent(".e-rowcell").index(),n.rowIndex=t.getIndexByRow(i.parents(".e-columnrow")),n.cardData=t.KanbanCommon._getKanbanCardData(t._currentJsonData,i.attr("id"))[0]),!t._trigger("contextClick",n)){switch(f){case t.localizedLabels.AddCard:t._isAddNewClick=!0;t._newCard=$(t._contexttarget);t.KanbanEdit&&t.KanbanEdit.addCard();break;case t.localizedLabels.EditCard:r>0&&!ej.isNullOrUndefined(t.model.fields.primaryKey)&&t.KanbanEdit&&t.KanbanEdit.startEdit(i);break;case t.localizedLabels.HideColumn:u.closest(".e-headercell").find(".e-headercelldiv").length>0&&t.hideColumns($.trim(u.closest(".e-headercell").find(".e-headercelldiv .e-headerdiv").text()).split("[")[0]);break;case t.localizedLabels.DeleteCard:!ej.isNullOrUndefined(t.model.fields.primaryKey)&&i.length>0&&t.KanbanEdit&&(t.KanbanEdit.deleteCard(i.attr("id")),t.KanbanCommon._showhide(t._hiddenColumns,"hide"),t.model.enableTotalCount&&t.KanbanCommon._totalCount());break;case t.localizedLabels.MoveRight:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropToColumn($(t._contexttarget).closest("td.e-rowcell").next(),i),t.model.enableTotalCount&&t.KanbanCommon._totalCount());break;case t.localizedLabels.MoveLeft:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropToColumn($(t._contexttarget).closest("td.e-rowcell").prev(),i),t.model.enableTotalCount&&t.KanbanCommon._totalCount());break;case t.localizedLabels.MoveUp:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(i.prev(),i,!1));break;case t.localizedLabels.MoveDown:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(i.next(),i,!0));break;case t.localizedLabels.TopofRow:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(u.closest("td.e-rowcell").find(".e-kanbancard").first(),i,!1));break;case t.localizedLabels.BottomofRow:r>0&&t.KanbanDragAndDrop&&(t._bulkUpdateData=[],t.KanbanDragAndDrop._dropAsSibling(u.closest("td.e-rowcell").find(".e-kanbancard").last(),i,!0));break;case t.localizedLabels.MovetoSwimlane:f!=n.text&&r>0&&(o=u.closest(".e-kanbancard").attr("id"),e=new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(t.model.fields.primaryKey,ej.FilterOperators.equal,o))[0],e[t.model.fields.swimlaneKey]=n.text,f={data:e,requestType:"save",primaryKeyValue:e[t.model.fields.primaryKey]},t._saveArgs=f,t.updateCard(o,e),t.KanbanCommon._showhide(t._hiddenColumns,"hide"),t._dataManager.dataSource.offline&&(t._saveArgs=null));break;case t.localizedLabels.PrintCard:r>0&&t.print(i);break;case t.localizedLabels.VisibleColumns:f!=n.text&&(h=$(n.element.parentElement).find("li").index(n.element),t.model.columns[h].visible?(t.hideColumns(n.text),$($(n.element).find("input.e-checkbox")).ejCheckBox({checked:!1})):(t.showColumns(n.text),$($(n.element).find("input.e-checkbox")).ejCheckBox({checked:!0})))}t.model.isResponsive&&t.kanbanWindowResize();t.model.allowScrolling&&!t.element.hasClass("e-responsive")&&t.kanbanContent.data("ejScroller").refresh();t.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(t.model.fields.swimlaneKey)&&t._kbnAdaptDdlIndex>0&&(s=t.kanbanContent.data("ejScroller"),c=t._freezeScrollTop,l=t.element[0].getElementsByClassName("e-columnrow"),s.scrollY(0,!0),t._freezeScrollTop=c,s.scrollY(t._freezeScrollTop,!0))}},n.prototype._kanbanMenu=function(n,t){var i,f,e,w,a,o,b,s,u,h,r,v,c,y,p,l;if(i=t._conmenu.element,t._contexttarget=n.target,f=$(n.target),e=$(t._contexttarget).closest("td.e-rowcell"),w=$(t._contexttarget).closest("tr.e-columnrow"),a=f.closest(".e-rowcell"),o=$(f).closest(".e-kanbancard"),y=t.KanbanCommon._getKanbanCardData(t._currentJsonData,o.attr("id"))[0],b=t.model.contextMenuSettings.menuItems,i.css("visibility","visible"),i.find("li").hide(),f.closest(".e-kanban").attr("id")!==t._id){i.css("visibility","hidden");return}if(i.find(".e-customitem").length>0)for(s=t.model.contextMenuSettings.customMenuItems,u=i.find(".e-customitem"),r=0;r<u.length;r++)if(s[r].target||(s[r].target="all"),s[r].target&&s[r].text==i.find(".e-customitem").children("a").eq(r).text())switch(s[r].target){case"content":t.getContentTable().find(f).length>0?($(u[r]).show(),$(u[r]).find("li").length>0&&$(u[r]).find("li").show()):$(u[r]).hide();break;case"header":t.getHeaderContent().find(f).length>0?($(u[r]).show(),$(u[r]).find("li").length>0&&$(u[r]).find("li").show()):$(u[r]).hide();break;case"card":t.element.find(".e-kanbancard").find(f).length>0?($(u[r]).show(),$(u[r]).find("li").length>0&&$(u[r]).find("li").show()):$(u[r]).hide();break;case"all":$(u[r]).show();$(u[r]).find("li").length>0&&$(u[r]).find("li").show()}if(t.getContentTable().find(f).length>0){if(a.length==0||f.filter(".e-targetclone,.e-targetdragclone").length>0){i.css("visibility","hidden");return}if($(f).closest(".e-swimlanerow").length>0){i.css("visibility","hidden");return}o.length>0?(p=$(f).closest("td.e-rowcell").find(".e-kanbancard"),c=p.index(o),v=p.length,$(i.find("li").not(".e-customitem")).hide(),$(i.find(".e-customitem li")).show(),!ej.isNullOrUndefined(t.model.fields.primaryKey)&&t.model.editSettings.allowEditing&&i.find(".e-content.e-cardedit").show(),e.hasClass("e-drag")&&(c>1&&i.find(".e-move.e-up").show(),c!=v-1&&e.hasClass("e-drop")&&i.find(".e-row.e-bottom").show(),c!=0&&e.hasClass("e-drop")&&i.find(".e-row.e-top").show(),v-1-c>1&&i.find(".e-move.e-down").show(),e.next().length>0&&e.next().hasClass("e-drop")&&!t._checkMultikey(e.next())&&t.KanbanCommon._preventCardMove(y[t.model.keyField],t.model.columns[e.next().index()].key)&&i.find(".e-move.e-right").show(),e.prev().length>0&&e.prev().hasClass("e-drop")&&!t._checkMultikey(e.prev())&&t.KanbanCommon._preventCardMove(y[t.model.keyField],t.model.columns[e.prev().index()].key)&&i.find(".e-move.e-left").show(),t.model.fields.swimlaneKey&&t.model.fields.primaryKey&&i.find(".e-move.e-swimlane").length>0&&(i.find(".e-move.e-swimlane").show(),i.find(".e-move.e-swimlane").find("li").show(),i.find(".e-move.e-swimlane").find("li").eq(t._columnRows.index(w)).hide())),ej.isNullOrUndefined(t.model.fields.primaryKey)||i.find(".e-content.delete").show(),t.model.allowPrinting&&i.find(".e-print").show()):a.length>0&&($(i.find("li").not(".e-customitem")).hide(),$(i.find(".e-customitem li")).show(),t.model.editSettings.allowAdding&&i.find(".e-add").show())}else if(t.getHeaderContent().find(f).length>0)if(l=i.find(".e-column"),$(f).closest(".e-headercell").not(".e-stackedHeaderCell").length>0){for($(i.find("li").not(".e-customitem")).hide(),$(i.find(".e-customitem li")).show(),$(i.find("li.e-haschild").find("li")).show(),l.show(),h=0;h<i.find(".e-column.e-visiblecolumn").find("li").length;h++)t.element.find(".e-headercell").not(".e-stackedHeaderCell").eq(h).hasClass("e-hide")?l.find("li input.e-checkbox").eq(h).ejCheckBox({checked:!1}):l.find("li input.e-checkbox").eq(h).ejCheckBox({checked:!0});l.find("li").show()}else{i.css("visibility","hidden");return}else{i.css("visibility","hidden");return}t.model.contextOpen&&(n.card=o,n.index=o.parent(".e-rowcell").find(".e-kanbancard").index(o),n.cellIndex=o.parent(".e-rowcell").index(),n.rowIndex=t.getIndexByRow(o.parents(".e-columnrow")),n.cardData=t.KanbanCommon._getKanbanCardData(t._currentJsonData,o.attr("id"))[0],t._trigger("contextOpen",n))},n.prototype._items=function(n,t){var i,r,u,f;return n==""||ej.isNullOrUndefined(n)?!1:(t=="menuItem"?n.indexOf("Card")!=-1?(i=ej.buildTag("li","",{},{"class":"e-content"}),i.css("display","none"),n.indexOf("Add")!=-1&&(i.addClass("e-add"),r=this.kanbanObj.localizedLabels.AddCard),n.indexOf("Edit")!=-1&&(i.addClass("e-cardedit"),r=this.kanbanObj.localizedLabels.EditCard),n.indexOf("Delete")!=-1&&(i.addClass("delete"),r=this.kanbanObj.localizedLabels.DeleteCard),n.indexOf("Print")!=-1&&(i.addClass("e-print"),r=this.kanbanObj.localizedLabels.PrintCard),i.css("display","none")):n.indexOf("Column")!=-1||n.indexOf("Columns")!=-1?(i=ej.buildTag("li","",{},{"class":"e-column"}),n.indexOf("Hide")!=-1&&(i.addClass("e-hidecolumn"),r=this.kanbanObj.localizedLabels.HideColumn),n.indexOf("Visible")!=-1&&(i.addClass("e-visiblecolumn"),r=this.kanbanObj.localizedLabels.VisibleColumns),i.css("display","none")):n.indexOf("Row")!=-1?(i=ej.buildTag("li","",{},{"class":"e-row"}),n.indexOf("Top")!=-1?(i.addClass("e-top"),r=this.kanbanObj.localizedLabels.TopofRow):(i.addClass("e-bottom"),r=this.kanbanObj.localizedLabels.BottomofRow),i.css("display","none")):n.indexOf("Move")!=-1&&(i=ej.buildTag("li","",{},{"class":"e-move"}),n.indexOf("Left")!=-1?(i.addClass("e-left"),r=this.kanbanObj.localizedLabels.MoveLeft):n.indexOf("Right")!=-1?(i.addClass("e-right"),r=this.kanbanObj.localizedLabels.MoveRight):n.indexOf("Up")!=-1?(i.addClass("e-up"),r=this.kanbanObj.localizedLabels.MoveUp):n.indexOf("Down")!=-1?(i.addClass("e-down"),r=this.kanbanObj.localizedLabels.MoveDown):n.indexOf("Swimlane")!=-1&&(i.addClass("e-swimlane"),r=this.kanbanObj.localizedLabels.MovetoSwimlane),i.css("display","none")):t=="subMenuItem"?i=ej.buildTag("li","",{},{}):t=="custom"&&(i=ej.buildTag("li","",{},{"class":"e-customitem"}),i.css("display","block")),u=document.createElement("a"),f="",f=typeof n=="string"?n.indexOf("Move to")!=-1?n.split(" ")[2].toLowerCase():n.indexOf("Move")!=-1?n.split(" ")[1].toLowerCase():n.split(" ")[0].toLowerCase():n,u.innerHTML=ej.isNullOrUndefined(r)?n:r,$(u).append(ej.buildTag("span","",{},{"class":"e-kanbancontext e-icon e-context"+f})),i.append(u),i)},n.prototype._kbnBrowserContextMenu=function(n){this._kbnBrowserContext=="contextmenu"&&this.model.enableTouch&&n.preventDefault();this._kbnBrowserContext="null"},n}();window.ej.createObject("ej.KanbanFeatures.Context",InternalContext,window);InternalSwimlane=function(){function n(n){this.kanbanObj=null;this._removeFreezeRow=function(n){var n=this.kanbanObj;(n.model.scrollSettings.allowFreezeSwimlane||$.isEmptyObject(n._freezeSwimlaneRow))&&(!n.element.hasClass("e-responsive")||ej.isNullOrUndefined(n.model.fields.swimlaneKey)||!n.model.scrollSettings.allowFreezeSwimlane)||this._removeFreezeslRow()};this._removeFreezeslRow=function(n){var n=this.kanbanObj,t;n._freezeSwimlaneRow.remove();n.headerContent.css({position:"",top:""});n.kanbanContent.css({position:"",top:""});t=n.element.find(".e-kanbantoolbar");t.length>0&&t.css({position:"",top:""})};this.kanbanObj=n}return n.prototype.expandAll=function(){var t=this.kanbanObj.element.find(".e-swimlanerow .e-slcollapse"),n;if(t.length!=0)for(n=0;n<t.length;n++)this.toggle($(t[n]))},n.prototype.collapseAll=function(){var t=this.kanbanObj.element.find(".e-swimlanerow .e-slexpand"),n;if(t.length!=0)for(n=0;n<t.length;n++)this.toggle($(t[n]))},n.prototype.toggle=function(n){var t,i,r=this.kanbanObj,u;if(typeof n=="string"||typeof n=="number")t=r.KanbanCommon._removeIdSymbols(n),i=r.element.find('tr[id="'+t+'"]'),this._toggleSwimlaneRow($(i).find(".e-rowcell .e-slexpandcollapse"));else if(typeof n=="object"&&n[0].nodeName!="DIV")for(u=0;u<n.length;u++)t=r.KanbanCommon._removeIdSymbols(n[u]),i=r.element.find('tr[id="'+t+'"]'),this._toggleSwimlaneRow($(i).find(".e-rowcell .e-slexpandcollapse"));else this._toggleSwimlaneRow(n)},n.prototype._toggleSwimlaneRow=function(n){var t=this.kanbanObj,s,a=t._swimlaneRows.index(n.parents(".e-swimlanerow")),v,y=t.currentViewData[a],p=n.parent().next(".e-slkey").html(),u,i,f,h,e,o,r,c,l;if(n=n.hasClass("e-slexpandcollapse")?n.find("div:first"):n,n.hasClass("e-slexpand")||n.hasClass("e-slcollapse")){if(u=n.closest("tr"),u.next(".e-collapsedrow").remove(),i=u.next(),f=t.KanbanCommon._removeIdSymbols(n.parent().next(".e-slkey").html()),v=n.hasClass("e-slexpand")?"collapse":"expand",s={target:n,swimlaneRow:u,data:y.items,cards:i.find(".e-kanbancard"),id:p,key:y.key,rowIndex:a,action:v},t._trigger("swimlaneClick",s),s.cancel)return!1;if(n.hasClass("e-slexpand")){for(i.hide(),h=ej.buildTag("tr","",{},{"class":"e-collapsedrow"}),e=t.model.columns,r=0;r<e.length;r++)o=ej.buildTag("td","",{},{"class":"e-rowcell",role:"kanbancell"}),e[r].visible||o.addClass("e-hide"),e[r].isCollapsed&&o.addClass("e-shrink"),h.append(o);i.before(h);n.removeClass("e-slexpand").addClass("e-slcollapse");$.inArray(f,t._collapsedSwimlane)==-1&&t._collapsedSwimlane.push(f)}else i.show(),n.removeClass("e-collapsedrow").removeClass("e-slcollapse").addClass("e-slexpand"),c=$.inArray(f,t._collapsedSwimlane),c!=-1&&t._collapsedSwimlane.splice(c,1);t.model.allowScrolling&&(l=t.headerContent.find(".e-hscrollcss"),t.KanbanScroll._refreshScroller({requestType:"refresh"}),t.getContent().find(".e-vscrollbar").length>0?l.removeClass("e-vscroll-area"):l.addClass("e-vscroll-area"))}},n.prototype._freezeRow=function(n,t){var c=t.model.fields.swimlaneKey,k=t.element.find(".e-kanbantoolbar"),o,p,l,a,w,d;if(t._freezeSwimlaneRow=t.element.find(".e-freezeswimlanerow"),this._removeFreezeRow(),(!t.element.hasClass("e-responsive")||!ej.isNullOrUndefined(c))&&(t.element.hasClass("e-responsive")||t.model.scrollSettings.allowFreezeSwimlane&&!ej.isNullOrUndefined(c)&&(ej.isNullOrUndefined(n.scrollLeft)||t._freezeSwimlaneRow.length!=0))){if(t._freezeSwimlaneRow.length<=0&&t.model.scrollSettings.allowFreezeSwimlane&&!t.element.hasClass("e-responsive"))t._freezeSwimlaneRow=ej.buildTag("div.e-freezeswimlanerow e-swimlanerow","<div><\/div>",{},{}),o=t.headerContent.offset().top+t.headerContent.height()-(t.element.offset().top+1),d=t.element.height(),t._freezeSwimlaneRow.prependTo(t.element).css({top:o}),o=t._freezeSwimlaneRow.height(),t.headerContent.css({position:"relative",top:-o}),t.kanbanContent.css({position:"relative",top:-o}),k.length>0&&k.css({position:"relative",top:-o}),t.element.height(d),p=t._swimlaneRows.eq(0),t._freezeSwimlaneRow.children().append(p.find(".e-slkey,.e-slcount").clone()),t._freezeSwimlaneRow.width(t.headerContent.width()-1).height(p.height()),t._freezeSlOrder=0,l=ej.buildTag("table.e-table e-freeze-table","",{},{cellspacing:"0.25px"}),l.append(t.getContentTable().find("colgroup").clone()),a=ej.buildTag("tbody","",{},{}),l.append(a),a.append(t.getContentTable().find(".e-columnrow").eq(0).clone().removeClass("e-columnrow").addClass("e-collapsedrow")),w=a.find("td"),w.removeClass("e-droppable").removeAttr("ej-mappingkey").height(0),w.children().remove(),t._freezeSwimlaneRow.append(l);else if(t._freezeSwimlaneRow.length>0||!ej.isNullOrUndefined(c)&&t.element.hasClass("e-responsive")){var i,r=0,h=0,b=0,v,y=t.element.find(".e-swimlane-text"),u,s,e,f;!ej.isNullOrUndefined(c)&&t.element.hasClass("e-responsive")?(v=t.element.find(".e-columnrow"),i=t.getContent().offset().top,s=v.eq(t._freezeSlOrder),u=v.eq(t._freezeSlOrder+1),e=v.eq(t._freezeSlOrder-1),u.length>0&&(r=u.offset().top),s.length>0&&(h=s.offset().top),e.length>0&&(b=e.offset().top)):t._freezeSwimlaneRow.length>0&&(i=t.getContent().offset().top+t._freezeSwimlaneRow.height(),s=t._swimlaneRows.eq(t._freezeSlOrder),u=t._swimlaneRows.eq(t._freezeSlOrder+1),e=t._swimlaneRows.eq(t._freezeSlOrder-1),u.length>0&&(r=u.offset().top+u.height()),h=s.offset().top+s.height(),b=e.offset().top+e.height());f=t.element.find(".e-freezeswimlanerow >div");t._freezeScrollTop>n.scrollTop&&(h=h,i>=r&&(r=i+1));t._freezeScrollTop<n.scrollTop&&(r=r);(n.source=="wheel"||n.source=="button")&&(t._freezeScrollTop<n.scrollTop?r=r-n.model.scrollOneStepBy:t._freezeScrollTop>n.scrollTop&&(i=i-n.model.scrollOneStepBy));i>=r&&t._freezeSlOrder<t._swimlaneRows.length-1?(f.length>0&&(f.children().remove(),f.append(u.find(".e-slkey,.e-slcount").clone())),y.length>0&&(y.text(t._kbnAdaptDdlData[t._kbnAdaptDdlIndex+1]),++t._kbnAdaptDdlIndex),++t._freezeSlOrder):i<h&&i>b&&t._freezeSlOrder>0&&(f.length>0&&(f.children().remove(),f.append(e.find(".e-slkey,.e-slcount").clone())),y.length>0&&(y.text(t._kbnAdaptDdlData[t._kbnAdaptDdlIndex-1]),--t._kbnAdaptDdlIndex),--t._freezeSlOrder);n.scrollTop==0&&this._removeFreezeslRow();ej.isNullOrUndefined(n.scrollLeft)||(f.css({left:-n.scrollLeft}),t._freezeSwimlaneRow.find("table").css({left:-n.scrollLeft}))}t._freezeScrollTop=n.scrollTop}},n.prototype._swimlaneLimit=function(){for(var i,s,e,h,o,c,r,a,t,n=this.kanbanObj,u=0;u<n.model.columns.length;u++)if(i=n.model.columns[u].constraints,s=n.KanbanCommon._multikeySeparation(n.model.columns[u].key),!ej.isNullOrUndefined(i)){var l=!ej.isNullOrUndefined(i.min),v=!ej.isNullOrUndefined(i.max),f=$($(n.getContent().find(".e-columnrow")).find('td[ej-mappingkey="'+s+'"]'));if(i.type=="swimlane"&&!ej.isNullOrUndefined(n.model.fields.swimlaneKey))for(r=0;r<f.length;r++)$(f).eq(r).find(".e-limits").length==0&&(a=ej.buildTag("div.e-limits"),$(f).eq(r).prepend(a)),t=$(f).eq(r).find(".e-limits"),l&&(e=ej.buildTag("div.e-min",n.localizedLabels.Min,"",{}),h=ej.buildTag("span.e-minlimit"," "+i.min.toString(),"",{}),e.append(h),t.find(".e-min").length>0&&t.find(".e-min").remove(),t.append(e)),v&&(o=ej.buildTag("div.e-max",n.localizedLabels.Max,"",{}),c=ej.buildTag("span.e-maxlimit"," "+i.max.toString(),"",{}),o.append(c),t.find(".e-max").length>0&&t.find(".e-max").remove(),l&&t.append("/"),t.append(o)),n.getHeaderContent().find(".e-headercell").eq(u).hasClass("e-shrinkcol")&&$(f).eq(r).find(".e-limits").addClass("e-hide")}},n}();window.ej.createObject("ej.KanbanFeatures.Swimlane",InternalSwimlane,window);InternalCommon=function(){function n(n){this.kanbanObj=null;this.kanbanObj=n}return n.prototype._updateGroup=function(n,t){var i=this.kanbanObj;ej.isNullOrUndefined(i._saveArgs)&&new ej.DataManager(i._currentJsonData).update(i.model.fields.primaryKey,t,"");$.type(t)&&!t.count&&this._renderSingleCard(n,t)},n.prototype._removeIdSymbols=function(n){return typeof n=="string"&&(n=n.replace(/[-\s']/g,"_")),n},n.prototype._enableKanbanRTL=function(){this.kanbanObj.model.enableRTL?this.kanbanObj.element.addClass("e-rtl"):this.kanbanObj.element.removeClass("e-rtl")},n.prototype._getEmptyTbody=function(){var n=ej.buildTag("td.e-emptycard",this.kanbanObj.localizedLabels.EmptyCard,{},{colSpan:this.kanbanObj.model.columns.length});return $(document.createElement("tr")).append(n)},n.prototype._renderSingleCard=function(n,t){var i=this.kanbanObj,u=i.element.find("div[id='"+n+"']"),a=i,f,r,e,o,c,s,h,l;i._dropped?(h=$.render[i._id+"_cardTemplate"](t),ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?$(u).after(h):($(u).replaceWith(h),l=$.inArray(n,i._collapsedCards),l!=-1&&i.toggleCard(n))):(e=a.model.fields.swimlaneKey,ej.isNullOrUndefined(e)?f=i.element.find(".e-columnrow:first"):(o=i.model.swimlaneSettings.unassignedGroup,o.enable&&o.keys.length>0&&(t=i._checkKbnUnassigned(t)),c=this._removeIdSymbols(t[e]),s=i.element.find("tr[id='"+c+"']"),s.length>0&&(f=s.next())),r=$(f).find("td.e-rowcell").eq(i._getColumnKeyIndex(t[i.model.keyField])),$(u).remove(),r.length>0&&($(r).children().hasClass("e-customaddbutton")?$($.render[i._id+"_cardTemplate"](t)).insertBefore($(r).find(".e-customaddbutton")):$(r).append($.render[i._id+"_cardTemplate"](t))));i.KanbanDragAndDrop&&i.KanbanDragAndDrop._addDragableClass();i.KanbanSelection&&i.KanbanSelection._selectionOnRerender()},n.prototype._getKanbanCardData=function(n,t){return new ej.DataManager(n).executeLocal((new ej.Query).where(this.kanbanObj.model.fields.primaryKey,ej.FilterOperators.equal,t))},n.prototype._kbnHeaderAndCellEvents=function(n){var t=this.kanbanObj,i={},l=n.find(".e-kanbancard"),r=n,s=n.find(".e-cardselection"),h,tt=this,f=n.index(),a=n.parents(".e-columnrow"),v,e,u,c;if(v=t.element.find(".e-rowcell.e-droppable"),u=n.attr("ej-mappingkey"),r.parents(".e-headercell").length>0&&(r=n.parents(".e-headercell")),r.hasClass("e-headercell")&&(h=f=r.index(),e=v.eq(h),u=e.attr("ej-mappingkey"),t.model.fields.swimlaneKey&&(e=$("td[ej-mappingkey~='"+u+"']")),l=e.find(".e-kanbancard"),s=e.find(".e-cardselection"),a=e.parents(".e-columnrow")),n.hasClass("e-rowcell")||!r.hasClass("e-stackedHeaderCell")){var it=a.prev(".e-swimlanerow").find(".e-slkey").text(),y=[],o=[];if(ej.isNullOrUndefined(u))o.push(new ej.Predicate(t.model.keyField,ej.FilterOperators.equal,u,!0));else for(u=typeof u=="object"?u:u.split(","),c=0;c<u.length;c++)o.push(new ej.Predicate(t.model.keyField,ej.FilterOperators.equal,u[c],!0));i.cardsInfo=function(){var i={},r;return i.cards=l,i.cardsData=t.model.fields.swimlaneKey&&n.hasClass("e-rowcell")?new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(ej.Predicate.or(o)).where(t.model.fields.swimlaneKey,ej.FilterOperators.equal,it)):new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(ej.Predicate.or(o))),i.cardsCount=l.length,t._selectedCardData.length>0&&(r=$.inArray(f,t.selectedRowCellIndexes[0].cellIndex),!ej.isNullOrUndefined(r)&&r>=0&&y.push(t.selectedRowCellIndexes[0].cardIndex[r])),i.selectedCardsIndexes=y,i.selectedCardsData=new ej.DataManager(tt._selectedCardData).executeLocal((new ej.Query).where(ej.Predicate.or(o))),i.selectedCards=s,i}}if(n.hasClass("e-rowcell")&&(i.rowIndex=t.getIndexByRow(a),i.cellIndex=f,t._trigger("cellClick",i)),r.hasClass("e-stackedHeaderCell")){i.text=n.text();var p=[],s,w=[],b=[],k=[],d,g=[],nt=[];d=t.element.find(".e-stackedHeaderRow");i.data=function(){var i,h=0,e,y=t.model.stackedHeaderRows[d.index(r.parents(".e-stackedHeaderRow"))].stackedHeaderColumns,o,u,c,l,a,n;for(i=y[r.index()].column,i=i.split(","),o=0;o<i.length;o++)u=new ej.DataManager(t.model.columns).executeLocal((new ej.Query).where("headerText",ej.FilterOperators.equal,i[o])),c=$("td[ej-mappingkey~='"+u[0].key+"']"),l=c.find(".e-kanbancard"),p.push(l),g.push(new ej.DataManager(t._currentJsonData).executeLocal((new ej.Query).where(t.model.keyField,ej.FilterOperators.equal,u[0].key))),f=v.index($("td[ej-mappingkey~='"+u[0].key+"']")[0]),t._selectedCardData.length>0&&(e=$.inArray(f,t.selectedRowCellIndexes[0].cellIndex),!ej.isNullOrUndefined(e)&&e>=0&&(a=c.find(".e-cardselection"),s.push(a),nt.push(new ej.DataManager(t._selectedCardData).executeLocal((new ej.Query).where(t.model.keyField,ej.FilterOperators.equal,u[0].key))),a.length>0&&(b.push(f),k.push(t.selectedRowCellIndexes[0].cardIndex[e])))),h=h+l.length,w.push(f);return n={},n.count=h,n.cards=p,n.cardsData=g,n.cellIndexes=w,n.selectedCellCardIndexes={cellIndex:b,cardIndex:k},n.selectedCards=s,n.selectedCardsData=nt,n};t._trigger("headerClick",i)}else r.hasClass("e-headercell")&&(i["text "]=r.text(),i.cellIndex=h,i.target=r,i.columnData=t.model.columns[h],t._trigger("headerClick",i),t.model.allowScrolling&&t.model.allowToggleColumn&&(t.KanbanCommon._setWidthToColumns(),t.kanbanContent.data("ejScroller").destroy(),t.KanbanScroll._renderScroller()))},n.prototype._toggleCardByTarget=function(n){var t=this.kanbanObj,s,e,o;if(n=n.hasClass("e-expandcollapse")?n.find("div:first"):n,n.hasClass("e-cardexpand")||n.hasClass("e-cardcollapse")){var i=n.closest("div.e-cardheader"),r=i.next(),h=i.find(".e-primarykey").text(),u=$(n).closest(".e-kanbancard"),f=u.attr("id");n.hasClass("e-cardexpand")?(n.removeClass("e-cardexpand").addClass("e-cardcollapse"),u.addClass("e-collapsedcard"),i.append(r.find(".e-text").clone()),r.hide(),$.inArray(f,t._collapsedCards)==-1&&t._collapsedCards.push(f),s=r.find(".e-bottom-triangle").clone(),i.append(s)):(n.removeClass("e-cardcollapse").addClass("e-cardexpand"),u.removeClass("e-collapsedcard"),i.find(".e-text,.e-bottom-triangle").remove(),r.show(),e=$.inArray(f,t._collapsedCards),e!=-1&&t._collapsedCards.splice(e,1));t.model.allowScrolling&&((t.getScrollObject().isVScroll()||t.getScrollObject().isHScroll())&&t.getScrollObject().refresh(),t.getScrollObject().isVScroll()?t.element.find(".e-kanbanheader").addClass("e-scrollcss").children().addClass("e-hscrollcss"):t.element.find(".e-kanbanheader").removeClass("e-scrollcss").children().removeClass("e-hscrollcss"));t.element.hasClass("e-responsive")&&(o=n.parents(".e-cell-scrollcontent"),o.length>0&&o.data("ejScroller").refresh())}},n.prototype._priorityColData=function(n,t){var u,f=this.kanbanObj.model.fields.primaryKey,i=this.kanbanObj.model.fields.priority,r;return u=$.map(n,function(n,i){if(n[f]==t[f])return i}),ej.isNullOrUndefined(u[0])||n.splice(u,1),r=t[i]-1,ej.isNullOrUndefined(n[r-1])||n[r-1][i]==t[i]&&--r,n.splice(r,0,t),n.sort(function(n,t){return n[i]-t[i]}),n},n.prototype._getPriorityData=function(n,t){var i,r=this.kanbanObj.model.fields.primaryKey;return i=$.map(n,function(n,i){if(n[r]==t[r])return i}),ej.isNullOrUndefined(i[0])?n.push(t):n[i][this.kanbanObj.model.fields.priority]=t[this.kanbanObj.model.fields.priority],n},n.prototype._preventCardMove=function(n,t){for(var s,i,r,u,e,h=this.kanbanObj,o=typeof t=="object"?t:t.split(","),f=0;f<o.length;f++){if(n==o[f])return!0;if(s=!0,i=h.model.workflows,!ej.isNullOrUndefined(i)&&i.length>0)for(r=0;r<i.length;r++)if(i[r].key==n&&!ej.isNullOrUndefined(i[r].allowedTransitions)){if(u=typeof i[r].allowedTransitions=="object"?i[r].allowedTransitions:i[r].allowedTransitions.split(","),u.length==1&&u[0].length==0)return!0;for(e=0;e<u.length;e++){if(o[f]==u[e])return!0;s=!1}}}return s?!0:!1},n.prototype._updateKbnPriority=function(n,t){var f=this.kanbanObj,o=f._currentJsonData,i,l,s=f.model.fields.primaryKey,u=f.model.fields.priority,h=f.model.fields.swimlaneKey,a,v,c,e,r;if((!ej.isNullOrUndefined(f._filterToolBar)&&f._filterToolBar.find(".e-select").length>0||f._searchBar!=null&&f._searchBar.find(".e-cancel").length>0)&&(o=f._initialData),l=this._getKanbanCardData(o,t[s])[0],t[u]=parseInt(t[u]),i=ej.isNullOrUndefined(h)?new ej.DataManager(o).executeLocal((new ej.Query).where(f.model.keyField,ej.FilterOperators.equal,t[f.model.keyField])):new ej.DataManager(o).executeLocal((new ej.Query).where(f.model.keyField,ej.FilterOperators.equal,t[f.model.keyField]).where(h,ej.FilterOperators.equal,t[h])),i=i.slice(),a=f,v=t[s],i.sort(function(n,t){return n[u]-t[u]}),f._bulkPriorityData.length>0){for(r=0;r<i.length;r++)c=$.map(f._bulkPriorityData,function(n,t){if(n[s]==i[r][s])return t}),ej.isNullOrUndefined(c[0])||(i[r][f.model.fields.priority]=f._bulkPriorityData[c][f.model.fields.priority]);i.sort(function(n,t){return n[u]-t[u]})}for(i=ej.isNullOrUndefined(h)?this._priorityColData(i,t):this._priorityColData(i,t),e=t[u]-1,e!=$.inArray(t,i)&&(e=$.inArray(t,i)),t[u]-1>i.length&&(e=i.length-1),e<0&&(e=0),r=e;r<i.length;r++)ej.isNullOrUndefined(i[r])||(r<i.length-1&&!ej.isNullOrUndefined(i[r+1])&&i[r][u]>=i[r+1][u]?(i[r+1][u]=i[r][u]+1,n=this._getPriorityData(n,i[r+1])):r!=i.length-1||ej.isNullOrUndefined(i[r-1])||i[r][u]<i[r-1][u]&&(i[r][u]=i[r-1][u]+1,n=this._getPriorityData(n,i[r])));for(r=e;r>=0;r--)ej.isNullOrUndefined(i[r])||(ej.isNullOrUndefined(i[r-1])?r!=0||ej.isNullOrUndefined(i[r+1])||i[r][u]>i[r+1][u]&&(i[r][u]=i[r+1][u]-1,n=this._getPriorityData(n,i[r])):r>0&&i[r-1][u]>=i[r][u]&&(i[r-1][u]=i[r][u]-1,n=this._getPriorityData(n,i[r-1])));return n},n.prototype._kbnBulkUpdate=function(n,t,i){var r=this.kanbanObj,u,f;r._dataManager instanceof ej.DataManager&&!r._dataManager.dataSource.offline||r._dataSource().adaptor instanceof ej.remoteSaveAdaptor?(f={added:n,deleted:t,changed:i},$("#"+r._id).data("ejWaitingPopup").show(),u=r._dataManager.saveChanges(f,r.model.fields.primaryKey,r.model.query._fromTable),$.isFunction(u.promise)&&(u.done(function(){r.KanbanCommon._processBindings(r._saveArgs);r._cModifiedData=null;r._cAddedRecord=null;r._isAddNewClick=!1;r._currentData=null;r._newCard=null;r._saveArgs=null;r._cardEditClick=null;r._dblArgs=null;r._cDeleteData=null;$("#"+r._id).data("ejWaitingPopup").hide()}),u.fail(function(n){var t;ej.isNullOrUndefined(r._saveArgs)?t=n:(r._saveArgs.error=n&&n.error?n.error:n,t=r._saveArgs);r._renderAllCard();r._enableDragandScroll();r._cModifiedData=null;r._cAddedRecord=null;r._isAddNewClick=!1;r._currentData=null;r._newCard=null;r._saveArgs=null;r._cardEditClick=null;r._dblArgs=null;r._cDeleteData=null;r._trigger("actionFailure",t);$("#"+r._id).data("ejWaitingPopup").hide()}))):r.KanbanCommon._processBindings(r._saveArgs);u!=undefined&&$.isFunction(u.promise)||(r._cModifiedData=null,r._cAddedRecord=null,r._isAddNewClick=!1,r._currentData=null,r._newCard=null,r._saveArgs=null,r._cardEditClick=null,r._dblArgs=null,r._cDeleteData=null)},n.prototype._checkSkipAction=function(n){switch(n.requestType){case"save":case"delete":return!0}return!1},n.prototype._processBindings=function(n){var t=this.kanbanObj,r,i;if(n.primaryKey=t.model.fields.primaryKey,!this._checkSkipAction(n)&&t._trigger("actionBegin",n))return!0;t._ensureDataSource(n);t._editForm=t.element.find(".kanbanform");n.requestType=="beginedit"||n.requestType=="drop"||t._editForm.length==0||(t._editForm.length>1&&n.requestType=="save"&&n.action=="edit"&&(t._editForm=$(t._editForm[0])),$(t._editForm).find("select.e-dropdownlist").ejDropDownList("destroy"),$(t._editForm).find("textarea.e-rte").ejRTE("destroy"),$(t._editForm).find(".e-datepicker").ejDatePicker("destroy"),$(t._editForm).find(".e-datetimepicker").ejDateTimePicker("destroy"),$(t._editForm).find(".e-numerictextbox").ejNumericTextbox("destroy"),$(t._editForm).addClass("e-formdestroy"));n&&n.requestType=="delete"&&n.div.remove();n.requestType=="drop"&&(t._templateRefresh=!0);t._dataSource()instanceof ej.DataManager&&n.requestType!="beginedit"&&n.requestType!="cancel"&&n.requestType!="add"?(t.element.ejWaitingPopup("show"),r=t._queryPromise=t._dataSource().executeQuery(t.model.query),i=t,i._dataSource().ready?i._dataSource().ready.done(function(){i.KanbanCommon._processDataRequest(i,n,r)}):i.KanbanCommon._processDataRequest(i,n,r)):t.sendDataRenderingRequest(n)},n.prototype._processDataRequest=function(n,t,i){i.done(ej.proxy(function(i){n.element.ejWaitingPopup("hide");n._currentJsonData=n.currentViewData=i.result==null?[]:i.result;n.KanbanCommon._processData(i,t)}));i.fail(ej.proxy(function(i){n.element.ejWaitingPopup("hide");t.error=i.error;i=[];n.currentViewData=[];n.KanbanCommon._processData(i,t);n._trigger("actionFailure",t)}))},n.prototype._processData=function(n,t){var i=this.kanbanObj;ej.isNullOrUndefined(i.model.filterSettings)||(t.requestType=="filtering"||i.model.filterSettings.length>0&&t.requestType=="refresh")&&(i._filteredRecordsCount=n.count);i.sendDataRenderingRequest(t)},n.prototype._moveCurrentCard=function(n,t,i){var h,u,e,f,s,c,b,l,y,p,k,r=this.kanbanObj,a,v,w,o;if(u=r.selectedRowCellIndexes[0],a=u.cardIndex,h=u.cellIndex[u.cellIndex.length-1],t=="down"||t=="up"){if(k=$(r._columnRows[n]).find("td.e-rowcell").eq(h),s=k.find(".e-kanbancard"),f=$(s).index(k.find(".e-cardselection")),l=s.length,t=="down")if(ej.isNullOrUndefined(r.model.fields.swimlaneKey)?f=r.model.selectionType=="multiple"?a[u.cellIndex.length-1][a[u.cellIndex.length-1].length-1]:a[u.cellIndex.length-1]:(i.shiftKey||i.ctrlKey)&&r.model.selectionType=="multiple"&&(f=a[u.cellIndex.length-1][a[u.cellIndex.length-1].length-1]),f==l-1||l==0){if(n==r._columnRows.length-1)return;if((i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single")return;this._moveCurrentCard(n+1,t,i)}else s.eq(f+1).hasClass("e-cardselection")?r.KanbanSelection._cardSelection([[n,[h],[f]]],$(s[f]),i):r.KanbanSelection._cardSelection([[n,[h],[f+1]]],$(s[f+1]),i);else if(t=="up")if(ej.isNullOrUndefined(r.model.fields.swimlaneKey)?f=r.model.selectionType=="multiple"?u.cardIndex[u.cellIndex.length-1][u.cardIndex[u.cellIndex.length-1].length-1]:u.cardIndex[u.cellIndex.length-1]:(i.shiftKey||i.ctrlKey)&&r.model.selectionType=="multiple"&&(f=u.cardIndex[u.cellIndex.length-1][u.cardIndex[u.cellIndex.length-1].length-1]),l==0||f==0){if(n==0)return;if((i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single")return;this._moveCurrentCard(n-1,t,i)}else s.eq(f-1).hasClass("e-cardselection")?r.KanbanSelection._cardSelection([[n,[h],[f]]],$(s[f]),i):f!=-1?r.KanbanSelection._cardSelection([[n,[h],[f-1]]],$(s[f-1]),i):r.KanbanSelection._cardSelection([[n,[h],[l-1]]],$(s[l-1]),i);(i.shiftKey||i.ctrlKey)&&!1||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse"))}else if(b=$(r._columnRows[u.rowIndex]),c=b.find("td.e-rowcell"),s=c.eq(n).find(".e-kanbancard"),e=c.eq(n).find(".e-kanbancard"),y=c.eq(n+1),p=c.eq(n-1),v=r.element.find(".e-kanbancard"),w=r.element.find(".e-cardselection"),p.is(":visible")&&y.is(":visible")||ej.isNullOrUndefined(r.model.fields.swimlaneKey)||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")),f=(i.shiftKey||i.ctrlKey)&&r.model.selectionType=="multiple"?u.cardIndex[u.cellIndex.length-1][u.cardIndex[u.cellIndex.length-1].length-1]:r.model.selectionType=="single"?u.cardIndex[0]:u.cardIndex[0][0],t=="right"){if(o=v.eq(v.index(w)+1),n==c.length-1){o.length>0&&(!i.shiftKey&&!i.ctrlKey||r.model.selectionType=="single")&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)&&(r.KanbanSelection._cardSelection([[r._columnRows.index(o.closest("tr.e-columnrow")),[o.closest("tr.e-columnrow").find("td.e-rowcell").index(o.closest("td.e-rowcell"))],[0]]],o,i),r.element.find(".e-cardselection").closest("tr:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")));return}y.find(".e-kanbancard:visible").length>0?(e=y.find(".e-kanbancard"),e.eq(f).length>0?r.KanbanSelection._cardSelection([[u.rowIndex,[n+1],[f]]],$(e[f]),i):r.KanbanSelection._cardSelection([[u.rowIndex,[n+1],[e.length-1]]],$(e[e.length-1]),i),(i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single"||ej.isNullOrUndefined(r.model.fields.swimlaneKey)||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse"))):this._moveCurrentCard(n+1,t,i)}else if(t=="left"){if(v.index(w)!=0&&(o=v.eq(v.index(w)-1)),n==0){if(!i.shiftKey&&!i.ctrlKey&&!ej.isNullOrUndefined(r.model.fields.swimlaneKey)){if(r.KanbanSwimlane.toggle($(b).prev().find(".e-slexpand")),ej.isNullOrUndefined(o))return;(o.length>0&&!i.shiftKey&&!i.ctrlKey||r.model.selectionType=="single")&&(r.KanbanSelection._cardSelection([[r._columnRows.index(o.closest("tr.e-columnrow")),[o.closest("tr.e-columnrow").find("td.e-rowcell").index(o.closest("td.e-rowcell"))],[0]]],o,i),r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")))}return}p.find(".e-kanbancard:visible").length>0?(e=p.find(".e-kanbancard"),e.eq(f).length>0?r.KanbanSelection._cardSelection([[u.rowIndex,[n-1],[f]]],$(e[f]),i):r.KanbanSelection._cardSelection([[u.rowIndex,[n-1],[e.length-1]]],$(e[e.length-1]),i),(i.shiftKey||i.ctrlKey)&&r.model.selectionType!="single"||ej.isNullOrUndefined(r.model.fields.swimlaneKey)||r.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length==0&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slexpand"))):this._moveCurrentCard(n-1,t,i)}},n.prototype._kanbanKeyPressed=function(n,t,i){var u,s,f,h,a=$(t),c=!0,r=this.kanbanObj,l,e,o;u=r.element.find(".e-cardselection");s=r.element.find(".e-kanbancard:visible");i.code==13&&t.tagName=="INPUT"&&a.closest("#"+r._id+"_toolbarItems_search").length&&(n="searchRequest");f=r.selectedRowCellIndexes[0];l=!ej.isNullOrUndefined(r.model.fields.swimlaneKey);switch(n){case"editCard":u.length>0&&r.model.editSettings.allowEditing&&(h=f.cellIndex,u=r._columnRows.eq(f.rowIndex).find("td.e-rowcell").eq(h[h.length-1]).find(".e-kanbancard").eq(f.cardIndex[h.length-1]),r.KanbanEdit.startEdit(u));break;case"insertCard":r.model.editSettings.allowAdding&&r.KanbanEdit.addCard();break;case"swimlaneExpandAll":r.KanbanSwimlane&&r.KanbanSwimlane.expandAll();break;case"swimlaneCollapseAll":r.KanbanSwimlane&&r.KanbanSwimlane.collapseAll();break;case"downArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.rowIndex,"down",i);break;case"upArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.rowIndex,"up",i);break;case"leftArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"left",i);r.model.isResponsive&&r.element.hasClass("e-responsive")&&r._kbnTransitionEnd&&r.KanbanAdaptive._kbnRightSwipe();break;case"rightArrow":u.length>0&&document.activeElement.id==r._id&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"right",i);r.model.isResponsive&&r.element.hasClass("e-responsive")&&r._kbnTransitionEnd&&r.KanbanAdaptive._kbnLeftSwipe();break;case"multiSelectionByDownArrow":i.ctrlKey=!0;u.length>0&&this._moveCurrentCard(f.rowIndex,"down",i);break;case"multiSelectionByUpArrow":i.ctrlKey=!0;u.length>0&&this._moveCurrentCard(f.rowIndex,"up",i);break;case"multiSelectionByRightArrow":i.shiftKey=!0;u.length>0&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"right",i);break;case"multiSelectionByLeftArrow":i.shiftKey=!0;u.length>0&&this._moveCurrentCard(f.cellIndex[f.cellIndex.length-1],"left",i);break;case"firstCardSelection":r.model.allowSelection&&document.activeElement.id==r._id&&(r.KanbanSelection.clear(),s.eq(0).addClass("e-cardselection"),u=r.element.find(".e-cardselection"),e=$(r._columnRows).find(".e-cardselection").index(),o=$(r._columnRows).find(".e-cardselection").parent().children().eq(0).hasClass("e-limits")?e-1:e,r.model.selectionType=="multiple"?r.selectedRowCellIndexes.push({cardIndex:[[o]],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}):r.selectedRowCellIndexes.push({cardIndex:[o],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}));break;case"lastCardSelection":r.model.allowSelection&&document.activeElement.id==r._id&&(r.KanbanSelection.clear(),s.eq(s.length-1).addClass("e-cardselection"),u=r.element.find(".e-cardselection"),u=r.element.find(".e-cardselection"),e=$(r._columnRows).find(".e-cardselection").index(),o=$(r._columnRows).find(".e-cardselection").parent().children().eq(0).hasClass("e-limits")?e-1:e,r.model.selectionType=="multiple"?r.selectedRowCellIndexes.push({cardIndex:[[o]],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}):r.selectedRowCellIndexes.push({cardIndex:[o],cellIndex:[u.parent().index()],rowIndex:$(r._columnRows).index(u.parents(".e-columnrow"))}));break;case"cancelRequest":$("#"+r._id+"_dialogEdit:visible").length>0?r.KanbanEdit.cancelEdit():u.length>0&&r.KanbanSelection.clear();break;case"searchRequest":r.KanbanFilter.searchCards(a.val());c=!1;break;case"saveRequest":$("#"+r._id+"_dialogEdit:visible").length>0&&r.KanbanEdit.endEdit();break;case"deleteCard":u.length>0&&$("#"+r._id+"_dialogEdit:visible").length<=0&&!ej.isNullOrUndefined(r.model.fields.primaryKey)&&r.KanbanEdit.deleteCard(u.attr("id"));break;case"selectedSwimlaneExpand":u.length>0&&l&&(u.is(":visible")||r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slexpandcollapse")));break;case"selectedSwimlaneCollapse":u.length>0&&l&&u.is(":visible")&&r.KanbanSwimlane.toggle($(r._columnRows[r.selectedRowCellIndexes[0].rowIndex]).prev().find(".e-slexpandcollapse"));break;case"selectedColumnCollapse":u.length>0&&this._toggleField(r.model.columns[r.selectedRowCellIndexes[0].cellIndex[0]].headerText);break;case"selectedColumnExpand":r._collapsedColumns.length!=0&&this._toggleField(r._collapsedColumns[r._collapsedColumns.length-1]);break;case"focus":r.element.find(".e-cardselection").focus();break;default:c=!0}return c},n.prototype._createStackedRow=function(n){for(var c,l,o,f,r,a,i,s,e,u,p,w,v=ej.buildTag("tr.e-columnheader e-stackedHeaderRow","",{},{}),t=[],y=this.kanbanObj,h=0;h<y.model.columns.length;h++)if(c=y.model.columns[h],c.visible!=!1){for(l="",o=n.stackedHeaderColumns,f=0;f<o.length;f++)o[f].column.indexOf(c.headerText)!=-1&&(l=o[f].headerText);t.push(l)}for(r=[],a="",i=0;i<t.length;i++){for(s=1,e=i+1;e<t.length;e++)if(t[i]!=""&&t[e]!=""&&t[i]==t[e])s++;else break;r.push({sapnCount:s,headerText:t[i],css:t[i]!=""?a:"e-sheader"});i+=s-1;a=""}for(u=0;u<r.length;u++)p=ej.buildTag("div",r[u].headerText,{},{}),w=ej.buildTag("th.e-headercell e-stackedHeaderCell "+r[u].css+"","",{},{colspan:r[u].sapnCount}).append(p),v.append(w);return v},n.prototype._refreshStackedHeader=function(){for(var u,n=this.kanbanObj,i=n.model.stackedHeaderRows,r=n.element.find(".e-stackedHeaderRow"),t=0;t<i.length;t++)u=this._createStackedRow(i[t]),r.length>0&&r.remove(),$(n.getHeaderTable().find(".e-columnheader").before(u));n.model.allowScrolling&&n.KanbanScroll._refreshScroller({requestType:"refresh"})},n.prototype._stackedHeadervisible=function(){for(var t=this.kanbanObj.element.find(".e-columnheader .e-stackedHeaderCell "),n=0;n<t.length;n++)t[n].offsetWidth<t[n].scrollWidth&&t.eq(n).find("div").addClass("e-hide")},n.prototype._kanbanUpdateCard=function(n,t){var s,i=this.kanbanObj,f=i._saveArgs,it=i.model.fields.swimlaneKey,b=i.model.swimlaneSettings.unassignedGroup,a,u,l,p,c,h,v,o,nt,e,y,w,r,tt;if(!ej.isNullOrUndefined(it)&&b.enable&&b.keys.length>0)if(ej.isNullOrUndefined(t.length))t=i._checkKbnUnassigned(t);else for(r=0;r<t.length;r++)t[r]=i._checkKbnUnassigned(t[r]);if(!ej.isNullOrUndefined(t.length)||$.inArray(t[i.model.keyField],i._keyValue)!=-1){if(ej.isNullOrUndefined(f)&&(i._saveArgs=f={data:t,requestType:"save",action:"edit",primaryKeyValue:n},i._cModifiedData=t),(ej.isNullOrUndefined(f)||!ej.isNullOrUndefined(f)&&f.requestType!="drop")&&(s=i._dataSource()instanceof ej.DataManager?i._dataSource().dataSource.json:i._dataSource(),s.length==0&&i._currentJsonData.length>0&&(s=i._currentJsonData),i.model.fields.priority))if(a=[],$.isPlainObject(t))a.push(t),ej.isNullOrUndefined(t[i.model.fields.priority])&&(e=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.fields.primaryKey,ej.FilterOperators.equal,t[i.model.fields.primaryKey])),e.length>0?t[i.model.fields.priority]=e[0][i.model.fields.priority]:(c=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.keyField,ej.FilterOperators.equal,t[i.model.keyField])),t[i.model.fields.priority]=c[c.length-1][i.model.fields.priority]+1)),t=i.KanbanCommon._updateKbnPriority(a,t);else{for(p=i.model.fields.primaryKey,r=0;r<t.length;r++)for(a=$.extend(!0,[],t),ej.isNullOrUndefined(t[r][i.model.fields.priority])&&(e=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.fields.primaryKey,ej.FilterOperators.equal,t[r][i.model.fields.primaryKey])),e.length>0?t[r][i.model.fields.priority]=e[0][i.model.fields.priority]:(c=new ej.DataManager(s).executeLocal((new ej.Query).where(i.model.keyField,ej.FilterOperators.equal,t[r][i.model.keyField])),t[r][i.model.fields.priority]=c[c.length-1][i.model.fields.priority]+1)),u=t[r],l=i.KanbanCommon._updateKbnPriority(a,u),h=0;h<l.length;h++)i._bulkPriorityData.length>0?(v=$.map(i._bulkPriorityData,function(n,t){if(n[p]==l[h][p])return t}),ej.isNullOrUndefined(v[0])?i._bulkPriorityData.push(l[h]):(i._bulkPriorityData.splice(v,1),i._bulkPriorityData.splice(v,0,l[h]))):i._bulkPriorityData.push(l[h]);t=i._bulkPriorityData;i._bulkPriorityData=[]}var u=[],k=[],d=[],g=[];if(ej.isNullOrUndefined(t)&&n&&(t=new ej.DataManager(i._currentJsonData).executeLocal((new ej.Query).where(i.model.fields.primaryKey,ej.FilterOperators.equal,n))[0]),t=ej.isNullOrUndefined(t)?null:t,$.isPlainObject(t)?u.push(t):u=t,i._isLocalData){for(o=i.model.query,nt=o.clone(),r=0;r<u.length;r++)o=o.where(i.model.fields.primaryKey,ej.FilterOperators.equal,u[r][i.model.fields.primaryKey]),e=i._dataManager.executeLocal(o),y=i._dataSource()instanceof ej.DataManager?$.inArray(e.result[0],i._dataSource().dataSource.json):$.inArray(e.result[0],i._dataSource()),y>=0?i._dataSource()instanceof ej.DataManager?$.extend(i._dataSource().dataSource.json[y],u[r]):$.extend(i._dataSource()[y],u[r]):(w=u[r],i._cAddedRecord=null,i._dataSource()instanceof ej.DataManager?i._dataSource().dataSource.json.push(w):i._dataSource(undefined,!0).splice(i._dataSource().length,0,w)),o.queries=o.queries.slice(o.queries.length);o.queries=nt.queries}if(f.requestType!="drop"&&(f.data=u),i._saveArgs=f,i._dataManager instanceof ej.DataManager&&!i._dataManager.dataSource.offline||i._dataSource().adaptor instanceof ej.remoteSaveAdaptor){if(f.requestType=="delete")d.push(f.data[0]);else for(r=0;r<u.length;r++)tt=this._getKanbanCardData(i._currentJsonData,u[r][i.model.fields.primaryKey]),tt.length>0?g.push(u[r]):k.push(u[r]);i.KanbanCommon._kbnBulkUpdate(k,d,g)}else i.KanbanCommon._processBindings(i._saveArgs),i._cModifiedData=null,i._cAddedRecord=null,i._isAddNewClick=!1,i._currentData=null,i._newCard=null,i._saveArgs=null,i._cardEditClick=null,i._dblArgs=null}},n.prototype._getMetaColGroup=function(){for(var i,r=ej.buildTag("colgroup","",{},{}),n=this.kanbanObj,t=0;t<n.model.columns.length;t++)i=$(document.createElement("col")),n.model.allowToggleColumn&&n.model.columns[t].isCollapsed===!0&&i.addClass("e-shrinkcol"),n.model.columns[t].visible===!1&&i.addClass("e-hide"),r.append(i);return r},n.prototype._kanbanToolbarClick=function(n,t){var i=n.currentTarget,u=n.target,e,f,o,r;if($(i).hasClass("e-quickfilter")||(t.KanbanFilter&&u.tagName=="INPUT"&&$(u).parent().next().hasClass("e-cancel")&&$(u).val().length==0&&t.KanbanFilter.searchCards(""),t.model.isResponsive&&t.element.hasClass("e-responsive")&&($(t.itemsContainer).parent().children().not(".e-searchbar").hide(),n.keyCode==8&&t.KanbanAdaptive._kbnTimeoutSearch(t.element,n)),n.event==undefined))return!1;for(e=$(i).text(),f=0;f<t.model.filterSettings.length;f++)if(t.model.filterSettings[f].text==e)break;return(o=f==t.model.filterSettings.length?null:t.model.filterSettings[f],r={itemName:$(i).attr("data-content"),itemId:i.id,target:u,currentTarget:i,itemIndex:$(i).index(),toolbarData:n,itemText:e,model:t.model,cancel:!1,type:"toolbarClick"},t._trigger("toolbarClick",r))?!1:(r.itemId==t._id+"_toolbarItems_search"?(r.target.nodeName=="A"&&t.model.allowSearching&&t._searchBar!=null&&$(r.currentTarget).find("input").val().length!=0&&($(u).is(t._searchBar.find(".e-searchfind"))?t.KanbanFilter.searchCards($(r.currentTarget).find("input").val()):$(u).is(t._searchBar.find(".e-cancel"))&&t.KanbanFilter.searchCards("")),t._isWatermark||(t._searchInput.blur(function(){t._searchInput.val()||t._hiddenSpan.css("display","block")}),t._hiddenSpan.css("display","none"))):$(r.currentTarget).hasClass("e-printlist")?t.print():t.KanbanFilter&&!$(i).parent().hasClass("e-customtoolbar")&&t.KanbanFilter._filterHandler(o,i),!1)},n.prototype._kanbanSetModel=function(n,t){var i,e,h,u,s,o,r,f,c;for(i in n)switch(i){case"columns":h=n.columns;t.model.columns=[];t._keyValue=[];t.columns(h,"add");break;case"cssClass":t.element.removeClass(t.model.cssClass).addClass(n[i]);break;case"allowFiltering":case"filterSettings":i=="allowFiltering"?(t.model.allowFiltering=n[i],t.model.allowFiltering&&(t.KanbanFilter=new ej.KanbanFeatures.Filter(t)),t.model.allowSearching||t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||(t.KanbanFilter=null)):(i=="filterSettings"&&(t.model.filterSettings=n[i]),t.model.filterSettings.length>0?(t.element.find(".e-kanbantoolbar").remove(),t._filterCollection=[],t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.filterSettings.length>0&&(t.KanbanFilter=new ej.KanbanFeatures.Filter(t))):(t.element.find(".e-kanbantoolbar").remove(),t.model.filterSettings=[],t._filterCollection=[],t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.allowSearching||t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||t.element.find(".e-kanbantoolbar").remove(),$(t.element.find(".e-kanbanheader")).replaceWith(t._renderHeader()),t.refresh()));break;case"allowSearching":if(t.model.allowSearching=n[i],u=[],t.model.filterSettings.length!=0||t.model.allowFiltering)for(s=t.element.find(".e-kanbantoolbar .e-tooltxt.e-select"),o=0;o<s.length;o++)u.push(s.eq(o).index());if(t.model.allowSearching){for(t.element.find(".e-kanbantoolbar").remove(),t.model.searchSettings.key="",t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),r=0;r<u.length;r++)t.element.find(".e-kanbantoolbar .e-tooltxt").eq(u[r]).addClass("e-select");t.model.allowSearching&&(t.KanbanFilter=new ej.KanbanFeatures.Filter(t))}else if(t.KanbanFilter.clearSearch(),t.element.find(".e-kanbantoolbar").remove(),t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||t.element.find(".e-kanbantoolbar").remove(),t.model.filterSettings.length!=0||t.model.allowFiltering)for(r=0;r<u.length;r++)t.element.find(".e-kanbantoolbar .e-tooltxt").eq(u[r]).addClass("e-select");t._on($("#"+t._id+"_searchbar"),"keyup","",t._onToolbarClick);break;case"enableTotalCount":t.model.enableTotalCount=n[i];$(t.element.find(".e-kanbanheader")).replaceWith(t._renderHeader());t.model.enableTotalCount&&this._totalCount();t.refresh();break;case"fields":i=="fields"&&($(t.element.find(".e-kanbanheader")).replaceWith(t._renderHeader()),t.model.allowSearching&&t.KanbanFilter.searchCards(""),!ej.isNullOrUndefined(t.model.fields.swimlaneKey)&&t.model.contextMenuSettings.enable&&t.KanbanContext._renderContext(),t.model.filterSettings.length>0&&t.KanbanFilter.clearFilter(),t.model.filterSettings.length!=0&&$("#Kanban").find(".e-kanbantoolbar .e-tooltxt").removeClass("e-select"),t.getHeaderContent().replaceWith(t._renderHeader()),this._refreshDataSource(t._dataSource()),this._renderLimit(),t.model.enableTotalCount&&this._totalCount(),t.element.find(".e-kanbantoolbar").remove(),t._renderToolBar().insertBefore(t.element.find(".e-kanbanheader").first()),t.model.allowSearching||t.model.filterSettings.length!=0||t.model.allowPrinting||t.model.customToolbarItems.length!=0||t.element.find(".e-kanbantoolbar").remove(),t.model.fields&&!ej.isNullOrUndefined(t.model.fields.swimlaneKey)&&(t.KanbanSwimlane=new ej.KanbanFeatures.Swimlane(t)),t._on($("#"+t._id+"_searchbar"),"keyup","",t._onToolbarClick));break;case"enableTouch":t.model.enableTouch=n[i];t.model.enableTouch?(t._off(t.element,"dblclick",".e-kanbancard"),t.model.editSettings.allowEditing&&t._on(t.element,$.isFunction($.fn.doubletap)&&t.model.enableTouch?"doubletap":"dblclick",".e-kanbancard",t._cardDblClickHandler),t._on(t.element,$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._clickHandler),t._on($(".e-swimlane-window,.e-kanbanfilter-window,.e-kanbantoolbar"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptClickHandler),t._on($(".e-kanban-editdiv"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptEditClickHandler),t.KanbanAdaptive&&(t._on(t.element,"taphold","",t.KanbanAdaptive._kbnHoldHandler),t._on(t.element,"touchend","",t.KanbanAdaptive._kbnTouchEndHandler),t._on(t.element,"swipeleft swiperight",".e-kanbancontent",$.proxy(t._swipeKanban,t)))):(t._off(t.element,"doubletap",".e-kanbancard"),t.model.editSettings.allowEditing&&t._on(t.element,$.isFunction($.fn.doubletap)&&t.model.enableTouch?"doubletap":"dblclick",".e-kanbancard",t._cardDblClickHandler),t.KanbanAdaptive&&(t._off(t.element,"taphold","",t.KanbanAdaptive._kbnHoldHandler),t._off(t.element,"touchend","",t.KanbanAdaptive._kbnTouchEndHandler),t._off(t.element,"swipeleft swiperight",".e-kanbancontent",$.proxy(t._swipeKanban,t))),t._on(t.element,$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._clickHandler),t._on($(".e-swimlane-window,.e-kanbanfilter-window,.e-kanbantoolbar"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptClickHandler),t._on($(".e-kanban-editdiv"),$.isFunction($.fn.tap)&&t.model.enableTouch?"tap":"click","",t._kbnAdaptEditClickHandler));break;case"allowHover":t.model.allowHover=n[i];t._enableCardHover();break;case"enableRTL":t.model.enableRTL=n[i];this._enableKanbanRTL();t.refresh(!0);t.KanbanScroll._refreshScroller({requestType:"refresh"});this._renderLimit();break;case"tooltipSettings":$.extend(t.model.tooltipSettings,n[i]);!ej.isNullOrUndefined(t.model.tooltipSettings)&&t.model.tooltipSettings.enable?(t.element.find(".e-kanbantooltip").remove(),t.element.append($("<div class='e-kanbantooltip'><\/div>")),t.element.find(".e-kanbantooltip").hide(),t._on(t.element,"mouseover",".e-kanbancard",$.proxy(t._showToolTip,t)),t._on(t.element,"mouseout",".e-kanbancard",$.proxy(t._hideToolTip,t))):(t._off(t.element,"mouseover",".e-kanbancard"),t._off(t.element,"mouseout",".e-kanbancard"));break;case"allowScrolling":case"scrollSettings":if(e=t.getContent(),t.model.allowScrolling=n[i],i!="allowScrolling"){if(!ej.isNullOrUndefined(n.scrollSettings)){if($.isEmptyObject(n.scrollSettings))break;$.extend(t.model.scrollSettings,n.scrollSettings)}ej.isNullOrUndefined(n.allowScrolling)||(t.model.allowScrolling=n.allowScrolling);ej.isNullOrUndefined(e.data("ejScroller"))||e.ejScroller("destroy");t.model.allowScrolling?(t.KanbanScroll=new ej.KanbanFeatures.Scroller(t),t.getHeaderContent().find("div").first().addClass("e-headercontent"),t._originalScrollWidth=t.model.scrollSettings.width,t.KanbanScroll._renderScroller()):(t.element.children(".e-kanbanheader").removeClass("e-scrollcss"),t.element.css("width","auto"),t.element.removeClass("e-kanbanscroll"),t.element.find(".e-headercontent").removeClass("e-hscrollcss"));ej.isNullOrUndefined(t.model.fields.swimlaneKey)||(t._swimlaneRows=t.element.find(".e-swimlanerow"));!$.isEmptyObject(t._freezeSwimlaneRow)&&t.KanbanSwimlane&&t.KanbanSwimlane._removeFreezeRow()}break;case"dataSource":e=t.element.find(".e-kanbancontent").first();this._refreshDataSource(t._dataSource());this._addLastRow();break;case"swimlaneSettings":ej.isNullOrUndefined(t.model.fields.swimlaneKey)||($.extend(t.model.swimlaneSettings,n[i]),ej.isNullOrUndefined(n[i].showCount)||t.refresh(!0));break;case"editSettings":$.extend(t.model.editSettings,n[i]);t.KanbanEdit._processEditing();t._tdsOffsetWidth=[];(t.model.editSettings.allowEditing||t.model.editSettings.allowAdding)&&(t.model.editSettings.editMode=="dialog"||t.model.editSettings.editMode=="dialogtemplate"?($("#"+t._id+"_dialogEdit").data("ejDialog")&&$("#"+t._id+"_dialogEdit").ejDialog("destroy"),$("#"+t._id+"_dialogEdit_wrapper,#"+t._id+"_dialogEdit").remove(),ej.isNullOrUndefined($("#"+t._id+"_externalEdit"))||$("#"+t._id+"_externalEdit").remove(),t.element.append(t.KanbanEdit._renderDialog())):(t.model.editSettings.editMode=="externalform"||t.model.editSettings.editMode=="externalformtemplate")&&(ej.isNullOrUndefined(t.element.find(".e-kanbandialog"))||t.element.find(".e-kanbandialog").remove(),$("#"+t._id+"_externalEdit").remove(),t.element.append(t.KanbanEdit._renderExternalForm())),t._isEdit=!1);t._enableEditingEvents();break;case"allowSelection":n[i]&&(t._off(t.element,"click"),t._on(t.element,"click","",t._clickHandler));break;case"query":t.model.query=$.extend(!0,{},n[i]);break;case"stackedHeaderRows":i=="stackedHeaderRows"&&(t.model.stackedHeaderRows=n[i]);t.model.stackedHeaderRows.length>0?this._refreshStackedHeader():(t.element.find(".e-stackedHeaderRow").remove(),t.model.stackedHeaderRows=[]);break;case"cardSettings":ej.isNullOrUndefined(n.cardSettings)||$.extend(t.model.cardSettings,n.cardSettings);t.element.find(".e-kanbancard").remove();t.refreshTemplate();t._renderAllCard();t._enableDragandScroll();break;case"allowToggleColumn":t.model.allowToggleColumn=n[i];t.refreshTemplate();t.getHeaderContent().replaceWith(t._renderHeader());t.sendDataRenderingRequest({requestType:"refresh"});t.model.allowToggleColumn||t.element.find(".e-shrinkheader").not(".e-hide").addClass("e-hide");t.model.enableTotalCount&&this._totalCount();this._renderLimit();break;case"locale":t.model.locale=n[i];f=t.model;c=t.element;f.query.queries=f.query.queries.slice(0,f.query.queries.length-1);t.element.ejKanban("destroy").ejKanban(f);t.element=c;t.model=f;t._collapsedCards.length!=0&&t.toggleCard(t._collapsedCards)}},n.prototype._setWidthToColumns=function(){for(var n=this.kanbanObj,r=n.getContentTable().children("colgroup").find("col"),i=n.getHeaderTable().children("colgroup").find("col"),u=n._originalWidth-n._collapsedColumns.length*50,t=0;t<i.length;t++)if(ej.isNullOrUndefined(n._columnsWidthCollection[t])||n.model.allowToggleColumn){if(n.model.allowScrolling)if(u=n.element.width()-n._collapsedColumns.length*50,n.headerTable.find(".e-shrinkcol").length==0&&!ej.isNullOrUndefined(n._initialKanbanModel.columns[t].width)&&($.isNumeric(n._initialKanbanModel.scrollSettings.width)||$.isNumeric(n._initialKanbanModel.columns[t].width)||(n._initialKanbanModel.scrollSettings.width.indexOf("%")>0||n._initialKanbanModel.scrollSettings.width=="auto")&&n._initialKanbanModel.columns[t].width.indexOf("%")>0))r.eq(t).width(n._initialKanbanModel.columns[t].width),i.eq(t).width(n._initialKanbanModel.columns[t].width);else{var o=parseInt((u/n._expandedColumns.length).toFixed(2)),e=parseInt(n.kanbanContent.find("table:first").css("border-spacing").split("px")[0])*n.model.columns.length+18,f=o-e;n.model.columns[t].isCollapsed?n._columnsWidthCollection[t]=parseInt((u/n.model.columns.length).toFixed(2))-e:(r.eq(t).css("width",f+"px"),i.eq(t).css("width",f+"px"),n.model.columns[t].width=f)}}else r.eq(t).width(n._columnsWidthCollection[t]),i.eq(t).width(n._columnsWidthCollection[t])},n.prototype._getCardbyIndexes=function(n){return $(this.kanbanObj.getRowByIndex(n[0][0]).find(".e-rowcell:eq("+n[0][1][0]+")").find("div.e-kanbancard:eq("+n[0][2][0]+")"))},n.prototype._addLastRow=function(){var n=this.kanbanObj,r=n.getContentTable().find("tr:last").find("td"),i=0,t;if(n.model.allowScrolling&&!ej.isNullOrUndefined(n.model.dataSource)&&!ej.isNullOrUndefined(n._kanbanRows)){for(t=0;t<n._kanbanRows.length;t++)i+=$(n._kanbanRows[t]).height();i<n.getContent().height()-1&&r.addClass("e-lastrowcell")}},n.prototype._refreshDataSource=function(n){var t=this.kanbanObj;t._dataManager=n instanceof ej.DataManager?n:new ej.DataManager(n);t._isLocalData=!(t._dataSource()instanceof ej.DataManager)||t._dataManager.dataSource.offline||t._isRemoteSaveAdaptor;t.refresh(!0)},n.prototype._cardClick=function(n,t){var i,r=null,u;ej.isNullOrUndefined(t.attr("id"))||(u=new ej.DataManager(this.kanbanObj._currentJsonData),r=u.executeLocal((new ej.Query).where(this.kanbanObj.model.fields.primaryKey,ej.FilterOperators.equal,t.attr("id"))));i={target:n,currentCard:t,data:r};this.kanbanObj._trigger("cardClick",i)},n.prototype._validateLimit=function(n,t,i){var e=this.kanbanObj,o=this._multikeySeparation(n.key),r=$($(e.element.find(".e-columnrow")).find('td[ej-mappingkey="'+o+'"]')),u,s=!ej.isNullOrUndefined(n.constraints.min),h=!ej.isNullOrUndefined(n.constraints.max),f=!ej.isNullOrUndefined(e.model.fields.swimlaneKey)&&i==0;n.constraints.type=="column"?u=r.find(".e-kanbancard").length:(u=$(r[i]).find(".e-kanbancard").length,r=$(r[i]));s&&(n.constraints.min>u?(r.addClass("e-deceed"),f&&$(t).addClass("e-deceed")):(r.removeClass("e-deceed"),f&&$(t).removeClass("e-deceed")));h&&(n.constraints.max<u?(r.addClass("e-exceed"),f&&$(t).addClass("e-exceed")):(r.removeClass("e-exceed"),f&&$(t).removeClass("e-exceed")));r.find(".e-limits").addClass("e-hide");n.isCollapsed||$(t).find(".e-limits").removeClass("e-hide")},n.prototype._totalCount=function(){for(var i,n=this.kanbanObj,t=0;t<n.model.columns.length;t++)if(i=n.model.columns[t],n.model.enableTotalCount){var r=n.getHeaderContent().find("span.e-totalcount")[t],u=this._multikeySeparation(i.key),f=$($(n.element.find(".e-columnrow")).find('td[ej-mappingkey="'+u+'"]')),e=f.find(".e-kanbancard").length;$(r).text(e)}},n.prototype._multikeySeparation=function(n){var i=typeof n=="object"?n:n.split(","),n="",r=i.length,t;if(r==1)n=i[0];else for(t=0;t<r;t++)n=n+i[t],t!=r-1&&(n+=",");return n},n.prototype._renderLimit=function(){for(var n,f,e,t=this.kanbanObj,u={},r=0;r<t.model.columns.length;r++)if(n=t.model.columns[r],!ej.isNullOrUndefined(n.constraints)){f=!ej.isNullOrUndefined(n.constraints.min);e=!ej.isNullOrUndefined(n.constraints.max);(f||e)&&(u=t.getHeaderContent().find(".e-columnheader").not(".e-stackedHeaderRow").find(".e-headercell")[r]);var s=typeof n.key=="object"?n.key:n.key.split(","),h=t.KanbanCommon._multikeySeparation(s),o=$($(t.element.find(".e-columnrow")).find('td[ej-mappingkey="'+h+'"]')),i=0;ej.isNullOrUndefined(n.constraints.type)&&(n.constraints.type="column");switch(n.constraints.type){case"column":this._validateLimit(n,u,i);break;case"swimlane":for(i=0;i<o.length;i++)this._validateLimit(n,u,i),t.getHeaderContent().find(".e-headercell").eq(r).hasClass("e-shrinkcol")||o.eq(i).find(".e-limits").removeClass("e-hide");ej.isNullOrUndefined(t.model.fields.swimlaneKey)||$(u).find(".e-limits").addClass("e-hide")}}},n.prototype._showhide=function(n,t){var i=this.kanbanObj,r,w=0,c,e=i.model.columns,o,u,h,p,s;c=t==="show"?"_visibleColumns":"_hiddenColumns";var b=i.getHeaderTable().find("thead"),l=b.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),a=i.getHeaderTable().find("colgroup").find("col"),v,y=i.getContentTable().find("colgroup").find("col"),f=i._columnRows;for(r=0;r<e.length;r++)$.inArray(e[r].headerText,i[c])!=-1&&(e[r].visible=t==="show"?!0:!1,w++),v=i.getColumnByHeaderText(n[r]),o=$.inArray(v,i.model.columns),o!=-1&&(t=="show"?(l.eq(o).removeClass("e-hide"),a.eq(o).css("display","")):(l.eq(o).addClass("e-hide"),a.eq(o).css("display","none")));for(r=0;r<e.length;r++)for(u=0;u<f.length;u++)ej.isNullOrUndefined(i.model.fields.swimlaneKey)||($(f[u]).is(":visible")?f.eq(u).prev().find(".e-rowcell").attr("colspan",i.getVisibleColumnNames().length):(f.eq(u).prev().prev(".e-swimlanerow").find(".e-rowcell").attr("colspan",i.getVisibleColumnNames().length),e[r].visible?f.eq(u).prev(".e-collapsedrow").find("td.e-rowcell").eq(r).removeClass("e-hide"):f.eq(u).prev(".e-collapsedrow").find("td.e-rowcell").eq(r).addClass("e-hide"))),h=f.eq(u).find("td.e-rowcell[ej-mappingkey='"+i.model.columns[r].key+"']"),e[r].visible?(h.removeClass("e-hide"),y.eq(r).removeClass("e-hide")):(h.addClass("e-hide"),y.eq(r).addClass("e-hide"));for(p=i.element.find(".e-kanbanheader"),i._columnsWidthCollection=[],s=0;s<i.model.columns.length;s++)ej.isNullOrUndefined(i.model.columns[s].width)||i._columnsWidthCollection.push(i.model.columns[s].width);i.element[0].replaceChild(i._renderHeader()[0],p[0]);i.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup());this._setWidthToColumns();i.KanbanScroll&&i.KanbanScroll._refreshScroller({requestType:"refresh"})},n.prototype._showExpandColumns=function(n,t,i,r){var u=this.kanbanObj,f,o,e;if(!ej.isNullOrUndefined(n)){if(n!=null)if($.isArray(t))for(f=0;f<t.length;f++)o=u.getColumnByHeaderText(t[f]),t[f]=o!=null?o.headerText:t[f];else t=n.headerText;if($.isArray(t))for(f=0;f<t.length;f++)e=$.inArray(t[f],u[i]),e!=-1?(u[i].splice(e,1),u[r].push(t[f])):e!=-1||$.inArray(t[f],u[r])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t[f]))||(u[r].push(u.getColumnByHeaderText(t[f]).key)&&u[r].push(t[f]),u[i].splice($.inArray(u.getColumnByHeaderText(t[f]).key,u[i]),1)&&u[i].splice($.inArray(t[f],u[i]),1));else e=$.inArray(t,u[i]),e!=-1?(u[i].splice(e,1),u[r].push(t)):e!=-1||$.inArray(t,u[r])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t))||(u[r].push(u.getColumnByHeaderText(t).key)&&u[r].push(t),u[i].splice($.inArray(u.getColumnByHeaderText(t).key,u[i]),1)&&u[i].splice($.inArray(t,u[i]),1))}},n.prototype._expandColumns=function(n){var i,r="_expandedColumns",t=this.kanbanObj;i=typeof n=="string"?t.getColumnByHeaderText(n):t.getColumnByHeaderText(n[0]);this._showExpandColumns(i,n,"_collapsedColumns",r);this._expandCollapse(t[r],"expand");t.model.allowScrolling&&this._setWidthToColumns();t.model.stackedHeaderRows.length>0&&this._refreshStackedHeader()},n.prototype._toggleField=function(n){var u,i,t=this.kanbanObj;if(t.model.allowToggleColumn){if($.isArray(n))for(i=0;i<n.length;i++)u=$.inArray(n[i],t._collapsedColumns),u!=-1?this._expandColumns(n[i]):this._collapseColumns(n[i]);else $.inArray(n,t._collapsedColumns)!=-1?this._expandColumns(n):this._collapseColumns(n);if(t.model.allowScrolling){var o=t.getContentTable().children("colgroup").find("col"),f=t.getHeaderTable().children("colgroup").find("col"),e=t._originalWidth-t._collapsedColumns.length*50;for(i=0;i<f.length;i++){var s=parseInt((e/t._expandedColumns.length).toFixed(2)),h=parseInt((e/(t.model.scrollSettings.buttonSize||18)/100).toFixed(2)),r=s-h;t.model.columns[i].isCollapsed||(o.eq(i).css("width",r+"px"),f.eq(i).css("width",r+"px"),t.model.columns[i].width=r)}}t.KanbanScroll&&t.KanbanScroll._refreshScroller({requestType:"refresh"})}},n.prototype._hideCollapseColumns=function(n,t,i,r){var f,e,u=this.kanbanObj;if(!ej.isNullOrUndefined(n))if($.isArray(t))for(f=0;f<t.length;f++)e=$.inArray(t[f],u[r]),e!=-1?(u[i].push(t[f]),u[r].splice(e,1)):e!=-1||$.inArray(t[f],u[i])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t[f]))||(u[i].push(u.getColumnByHeaderText(t[f]).key)&&u[i].push(u.getColumnByHeaderText(t[f]).key),u[r].splice($.inArray(u.getColumnByHeaderText(t[f]).key,u[r]),1)&&u[r].splice($.inArray(t[f],u[r]),1));else e=$.inArray(t,u[r]),e!=-1?(u[i].push(t),u[r].splice(e,1)):e!=-1||r!=r||$.inArray(t,u[i])!=-1||ej.isNullOrUndefined(u.getColumnByHeaderText(t))||(u[i].push(u.getColumnByHeaderText(t).key)&&u[i].push(u.getColumnByHeaderText(t).key),u[r].splice($.inArray(u.getColumnByHeaderText(t).key,u[r]),1)&&u[r].splice($.inArray(t,u[r]),1))},n.prototype._expandCollapse=function(n,t){var i=this.kanbanObj,f,d=0,w,l=i.model.columns,u,a,v,e,h,y,c,p;w=t==="expand"?"_expandedColumns":"_collapsedColumns";var g=i.getHeaderTable().find("thead"),o=g.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),s=i.getHeaderTable().find("colgroup").find("col"),b,r,k=i.getContentTable().find("colgroup").find("col");for(f=0;f<l.length;f++)if($.inArray(l[f].headerText,i[w])!=-1&&(l[f].isCollapsed=t==="expand"?!1:!0,d++),b=i.getColumnByHeaderText(n[f]),u=$.inArray(b,i.model.columns),a=t=="expand"?!0:!1,u!=-1&&(a?s.eq(u).hasClass("e-shrinkcol")&&(o.eq(u).find(".e-headercelldiv,.e-totalcard,.e-limits").removeClass("e-hide"),o.eq(u).removeClass("e-shrinkcol"),s.eq(u).removeClass("e-shrinkcol"),k.eq(u).removeClass("e-shrinkcol"),o.eq(u).find(".e-clcollapse").addClass("e-clexpand").removeClass("e-clcollapse")):s.eq(u).hasClass("e-shrinkcol")||(o.eq(u).find(".e-headercelldiv,.e-totalcard,.e-limits").addClass("e-hide"),o.eq(u).addClass("e-shrinkcol"),s.eq(u).addClass("e-shrinkcol"),k.eq(u).addClass("e-shrinkcol"),o.eq(u).find(".e-clexpand").addClass("e-clcollapse").removeClass("e-clexpand"))),v=i.model.columns[f].isCollapsed,a){if(!v)for(e=0;e<i._columnRows.length;e++)if(r=i._columnRows.eq(e).find("td.e-rowcell").eq(f),r.hasClass("e-shrink"))r.removeClass("e-shrink").find(".e-shrinkheader").addClass("e-hide").parent().find(".e-kanbancard").removeClass("e-hide"),i.element.hasClass("e-responsive")&&r.find(".e-cell-scrollcontent").length>0&&r.find(".e-cell-scrollcontent").removeClass("e-hide"),i.model.enableRTL&&r.find(".e-shrinkheader").css({position:"",top:""}),r.find(".e-customaddbutton").removeClass("e-hide"),r.find(".e-limits").removeClass("e-hide"),r.find(".e-shrinkcount").text(i._columnCardcount(i.currentViewData,i.model.columns[f].key,i.model.fields.swimlaneKey?e:null,i));else break}else if(v)for(e=0;e<i._columnRows.length;e++)if(r=i._columnRows.eq(e).find("td.e-rowcell").eq(f),r.hasClass("e-shrink"))break;else r.addClass("e-shrink").find(".e-shrinkheader").removeClass("e-hide").parent().find(".e-kanbancard").addClass("e-hide"),i._checkMultikey(r)&&r.addClass("e-shrink").find(".e-shrinkheader").show(),i.element.hasClass("e-responsive")&&r.find(".e-cell-scrollcontent").length>0&&r.find(".e-cell-scrollcontent").addClass("e-hide"),h=r.offset().top,y=r.find(".e-shrinkcount").offset().top,i.model.enableRTL&&h>y&&(c=h-y,p=r.find(".e-shrinkheader"),c=p.offset().top-(h+i.element.offset().top)+c,p.css({position:"relative",top:c-6})),r.find(".e-customaddbutton").addClass("e-hide"),r.find(".e-limits").addClass("e-hide"),r.find(".e-shrinkcount").text(i._columnCardcount(i.currentViewData,i.model.columns[f].key,i.model.fields.swimlaneKey?e:null,i))},n.prototype._collapseColumns=function(n){for(var t=this.kanbanObj,r,u,f="_collapsedColumns",e=0,i=0;i<n.length;i++)r=$.inArray(n[i],t._expandedColumns),r!=-1&&e++;t._expandedColumns.length==e||t.getVisibleColumnNames().length-t._collapsedColumns.length==1||t.model.columns.length-t._collapsedColumns.length==1?t._collapsedColumns.length>0&&(this._expandColumns(t._collapsedColumns[0]),this._collapseColumns(n)):(u=typeof n=="string"?t.getColumnByHeaderText(n):t.getColumnByHeaderText(n[0]),this._hideCollapseColumns(u,n,f,"_expandedColumns"),this._expandCollapse(t[f],"collapse"),t.model.allowScrolling&&this._setWidthToColumns(),t.model.stackedHeaderRows.length>0&&this._refreshStackedHeader())},n}();window.ej.createObject("ej.KanbanFeatures.Common",InternalCommon,window);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};Kanban=function(n){function t(t,i){return n.call(this),this.element=null,this.PluginName="ejKanban",this.id="null",this.validTags=["div"],this.observables=["dataSource"],this._tags=[{tag:"columns",attr:["headerTemplate","headerText","key","isCollapsed","showAddButton","visible","constraints.type","constraints.min","constraints.max","allowDrag","allowDrop","totalCount.text"]},{tag:"workflows",attr:["key","allowedTransitions"]},{tag:"stackedHeaderRows",attr:[[{tag:"stackedHeaderColumns",attr:["headerText","column"]}]]},{tag:"contextMenuSettings",attr:["customMenuItems","menuItems","disableDefaultItems"]},{tag:"filterSettings",attr:["text","query","description"]},{tag:"editSettings.editItems",attr:["field","editType","validationRules","editParams","defaultValue"]}],this.localizedLabels=null,this.currentViewData=null,this.keyConfigs={focus:"e",insertCard:"45",deleteCard:"46",editCard:"113",saveRequest:"13",cancelRequest:"27",firstCardSelection:"36",lastCardSelection:"35",upArrow:"38",downArrow:"40",rightArrow:"39",leftArrow:"37",swimlaneExpandAll:"ctrl+40",swimlaneCollapseAll:"ctrl+38",selectedSwimlaneExpand:"alt+40",selectedSwimlaneCollapse:"alt+38",selectedColumnCollapse:"ctrl+37",selectedColumnExpand:"ctrl+39",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40",multiSelectionByLeftArrow:"shift+37",multiSelectionByRightArrow:"shift+39"},this.dataTypes={dataSource:"data",query:"data",columns:"array",stackedHeaderRows:"array",contextMenuSettings:{disableDefaultItems:"array",menuItems:"array",customMenuItems:"array"},filterSettings:"array",editSettings:{editMode:"enum",editItems:"array"},searchSettings:{fields:"array"}},this.defaults={dataSource:null,keyField:null,keySettings:null,allowTitle:!1,cssClass:"",allowSelection:!0,allowSearching:!1,allowToggleColumn:!1,enableTotalCount:!1,enableTouch:!0,selectionType:"single",allowKeyboardNavigation:!1,allowDragAndDrop:!0,allowHover:!0,allowScrolling:!1,allowPrinting:!1,enableRTL:!1,stackedHeaderRows:[],filterSettings:[],scrollSettings:{width:"auto",height:0,allowFreezeSwimlane:!1},swimlaneSettings:{showCount:!0,allowDragAndDrop:!1,unassignedGroup:{enable:!0,keys:["null","undefined",""]}},fields:{content:null,tag:null,color:null,imageUrl:null,swimlaneKey:null,primaryKey:null,priority:null},cardSettings:{colorMapping:{},template:null},columns:[],contextMenuSettings:{enable:!1,menuItems:["Add Card","Edit Card","Delete Card","Top of Row","Bottom of Row","Move Up","Move Down","Move Left","Move Right","Move to Swimlane","Hide Column","Visible Columns","Print Card"],customMenuItems:[]},customToolbarItems:[],editSettings:{editItems:[],allowEditing:!1,allowAdding:!1,dialogTemplate:null,externalFormTemplate:null,formPosition:"bottom"},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},tooltipSettings:{enable:!1,template:null},minWidth:0,isResponsive:!1,locale:"en-US",query:null,create:null,actionBegin:null,actionComplete:null,actionFailure:null,load:null,destroy:null,beginEdit:null,endEdit:null,endAdd:null,endDelete:null,beforeCardSelect:null,cardSelect:null,toolbarClick:null,cardDoubleClick:null,cardDragStart:null,cardDrag:null,cardDragStop:null,cardDrop:null,contextClick:null,contextOpen:null,cardClick:null,beforePrint:null,cellClick:null,headerClick:null,dataBound:null,queryCellInfo:null},this._dataSource=ej.util.valueFunction("dataSource"),this._rootCSS="e-kanban",this._requiresID=!0,this._id=null,this.KanbanDragAndDrop=null,this.KanbanEdit=null,this.KanbanCommon=null,this.KanbanAdaptive=null,this.KanbanScroll=null,this.KanbanContext=null,this.KanbanSwimlane=null,this.KanbanSelection=null,this.KanbanFilter=null,this._currentJsonData=null,this._kanbanRows=null,this._columnRows=null,this._swimlaneRows=null,this._filterToolBar=null,this._filteredRecordsCount=0,this._filteredRecords=null,this._contexttarget=null,this._editForm=null,this._newData=null,this._isAddNew=!1,this._isRemoteSaveAdaptor=!1,this._queryPromise=null,this._kanbanWidth=null,this.keyPredicates=null,this._cloneQuery=null,this._isLocalData=!0,this._previousRowCellIndex=[],this.selectedRowCellIndexes=[],this._bulkUpdateData=[],this._bulkPriorityData=[],this._kbnFilterObject=[],this._kbnAdaptFilterObject=[],this._kbnFilterCollection=[],this._kbnAdaptDdlData=[],this._kbnAdaptDdlIndex=0,this._kbnSwipeWidth=0,this._kbnSwipeCount=0,this._searchTout=null,this._cardSelect=null,this._kbnBrowserContext=null,this._kbnMouseX=null,this._kbnAutoFilterCheck=!1,this._autoKbnSwipeLeft=!1,this._autoKbnSwipeRight=!1,this._kbnTransitionEnd=!0,this._kbnDdlWindowResize=!1,this._conmenu=null,this._rowIndexesColl=[],this.templates={},this.initialRender=!1,this._columnsWidthCollection=[],this._slTemplate="",this._cardTemplate="",this._tdsOffsetWidth=[],this._scrollObject=null,this._templateRefresh=!1,this._action="",this._hiddenColumns=[],this._visibleColumns=[],this._filterCollection=[],this.collapsedColumns=null,this._expandedColumns=null,this._headerColumnNames=null,this._isWatermark=null,this._searchInput=null,this._hiddenSpan=null,this._currentRowCellIndex=[],this._recordsCount=0,this._dropinside=!1,this._selectedCards=[],this._selectedCardData=[],this._tableBEle=null,this._saveArgs=null,this._cModifiedData=null,this._dropped=null,this._cAddedRecord=null,this._cDeleteData=null,this._isAddNewClick=!1,this._isEdit=!1,this._currentData=null,this._newCard=null,this._cardEditClick=null,this._collapsedCards=[],this._collapsedSwimlane=[],this._keyValue=[],this._dblArgs=null,this._freezeSwimlaneRow={},this._freezeScrollTop=0,this._freezeSlOrder=0,this._originalWidth=null,this._originalScrollWidth=0,this._collapsedColumns=[],this._enableMultiTouch=!1,this._enableSwimlaneCount=!0,this._kTouchBar=null,this._contextSwimlane=null,this._initialData=null,this._searchBar=null,this._originalScrollHeight=null,this._dataManager=null,this._priorityCollection=[],this._initialKanbanModel=[],this._kbnAdaptEditClickHandler=function(n){if(this.element.hasClass("e-responsive")){var t=$(n.target);(t.attr("id")==this._id+"_Cancel"||t.parent().attr("id")==this._id+"_closebutton")&&this.KanbanEdit.cancelEdit();t.attr("id")==this._id+"_Save"&&this.KanbanEdit.endEdit()}},this._keyPressed=function(n,t,i,r){return this.KanbanCommon._kanbanKeyPressed(n,t,i,r)},this._freezeSwimlane=function(n){this.KanbanSwimlane&&this.KanbanSwimlane._freezeRow(n,this)},this.getCurrentJsonData=function(){return this._currentJsonData},t&&(this._id=t[0].id,t.jquery||(t=$("#"+t)),t.length)?$(t).ejKanban(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.getHeaderTable=function(){return this.headerTable},t.prototype.setHeaderTable=function(n){this.headerTable=n},t.prototype.getColumnByHeaderText=function(n){var i,t;if(!ej.isNullOrUndefined(n)){for(i=this.model.columns,t=0;t<i.length;t++)if(i[t].headerText==n)break;return t==i.length?null:i[t]}},t.prototype._getColumnKeyIndex=function(n){for(var r,i=this.model.columns,u,t=0;t<i.length;t++)for(u=typeof i[t].key=="object"?i[t].key:i[t].key.split(","),r=0;r<u.length;r++)if(u[r]==n)return t;return t==i.length?null:i[t]},t.prototype._checkMultikey=function(n){var i=n.index(),t;return t=this.model.columns[i].key,t=typeof t=="object"?t:t.split(","),t.length>1?!0:!1},t.prototype._destroy=function(){var i,n,r,t;if(this.element.off(),this.element.find(".e-kanbanheader").find(".e-headercontent").add(this.getContent().find(".e-content")).off("scroll"),ej.isNullOrUndefined(this._filterToolBar)||this._filterToolBar.ejToolbar("destroy"),!ej.isNullOrUndefined(this._editForm)){for(i=this._editForm.find(".e-field"),t=0;t<i.length;t++)n=$(i[t]),n.hasClass("e-ejinputtext")&&this.element.find(".e-ejinputtext").remove(),n.hasClass("e-kanbantextarea")&&this.element.find(".e-kanbantextarea").remove(),n.hasClass("e-dropdownlist")&&n.ejDropDownList("destroy"),n.hasClass("e-numerictextbox")&&n.ejNumericTextbox("destroy"),r=n.parent("div").find("textarea.e-rte"),r.length&&(r.ejRTE("destroy"),n.parent().find("textarea").remove());$("#"+this._id+"_dialogEdit").ejDialog("destroy")}this.element.ejWaitingPopup("destroy");this.model.contextMenuSettings.enable&&($("#"+this._id+"_Context").ejMenu("destroy"),$("#"+this._id+"_Context").remove());this.element.children().remove();this.model.isResponsive&&$(window).off("resize",$.proxy(this.kanbanWindowResize,this))},t.prototype._menu=function(n){this.KanbanContext&&this.KanbanContext._kanbanMenu(n,this)},t.prototype._setModel=function(n){this.KanbanCommon._kanbanSetModel(n,this)},t.prototype._onToolbarClick=function(n){var i=$(this.itemsContainer).closest(".e-kanban"),t=n.type=="keyup"?this:i.data("ejKanban");t.KanbanCommon._kanbanToolbarClick(n,t)},t.prototype._showToolTip=function(n){var t=this,o,s,f,e;if(t.model.tooltipSettings.enable){if($(n.target).hasClass("e-kanbantooltip"))return;if(f=t.element.find(".e-kanbantooltip"),e=ej.isNullOrUndefined(t.model.tooltipSettings.template),e&&!($(n.target).hasClass("e-tag")||$(n.target).hasClass("e-text")||$(n.target).closest(".e-primarykey").length>0))return;e?f.html($(n.target).text()).removeClass("e-tooltiptemplate"):(f.addClass("e-tooltiptemplate"),s=new ej.DataManager(t._currentJsonData),o=s.executeLocal((new ej.Query).where(t.model.fields.primaryKey,ej.FilterOperators.equal,$(n.currentTarget).attr("id"))),f.html($(t.model.tooltipSettings.template).render(o[0])));var r=ej.isNullOrUndefined(n.originalEvent)?n.originalEvent.clientX:n.pageX,u=ej.isNullOrUndefined(n.originalEvent)?n.originalEvent.clientY:n.pageY,i=$(t.element).find(".e-kanbantooltip");r=r+i.width()<$(t.element).width()?r:r-i.width();u=u+i.height()<$(t.element).height()?u:u-i.height();i.css("left",r);i.css("top",u);t.model.enableRTL==!0&&i.addClass("e-rtl");$(t.element).find(".e-kanbantooltip").show()}},t.prototype._hideToolTip=function(){this.model.tooltipSettings.enable&&this.element.find(".e-kanbantooltip").hide()},t.prototype.showColumns=function(n){var t,i="_visibleColumns";t=typeof n=="string"?this.getColumnByHeaderText(n):this.getColumnByHeaderText(n[0]);this.KanbanCommon._showExpandColumns(t,n,"_hiddenColumns",i);this.KanbanCommon._showhide(this[i],"show");this.KanbanCommon._renderLimit();this.KanbanCommon._totalCount();this.model.stackedHeaderRows.length>0&&this.KanbanCommon._refreshStackedHeader()},t.prototype.print=function(n){var i={},t,o,s,r,n,u,f,e;i.requestType="print";this._trigger("actionBegin",i);ej.isNullOrUndefined(this.element.find("#"+this._id+"_externalEdit"))||this.element.find("#"+this._id+"_externalEdit").css("display","none");t=this.element.clone();t.find(".e-kanbantouchbar").remove();this.model.allowScrolling&&(o=this.model.scrollSettings.width,s=this.model.scrollSettings.height,(this.getScrollObject().isVScroll()||this.getScrollObject().isHScroll())&&(r=this.getContent().find(".e-content")[0],t.find(".e-kanbancontent").height(r.scrollHeight),t.find(".e-kanbancontent").ejScroller({width:r.scrollWidth,height:r.scrollHeight}),t.width(r.scrollWidth)));(!ej.isNullOrUndefined(this.model.filterSettings)||this.model.allowSearching||this.model.allowPrinting||!ej.isNullOrUndefined(this.model.customToolbarItems))&&t.find(".e-kanbantoolbar").remove();t.find(".e-kanbancontent div:first").nextAll().remove();n&&((typeof n=="string"||typeof n=="number")&&(n=this.element.find("div.e-kanbancard[id="+n+"]")),t.find(".e-kanbanheader").remove(),u=n.parent().clone(),f=n.clone(),u.children().remove(),t.find('table[role="kanban"]').remove(),t.find(".e-kanbancontent").children().append(u.append(f)),t.css("border-style","none"),this.model.allowScrolling?(t.css({width:"auto",height:"auto"}),t.find(".e-kanbancontent").css({width:"auto",height:"auto"})):t.find(".e-kanbancard").css("width","30%"));e=window.open("","print","height=452,width=1024,tabbar=no");i={requestType:"print",element:t};this._trigger("beforePrint",i);ej.isNullOrUndefined(i.element)||(t=i.element);ej.print(t,e);this._trigger("actionComplete",i)},t.prototype._kbnAdaptClickHandler=function(n){this.KanbanAdaptive&&this.KanbanAdaptive._adaptiveKbnClick(n)},t.prototype._kbnTouchEndHandler=function(){var n=this.element.find(".e-draggedcard");n.length>0&&n.remove();this._cardSelect="null"},t.prototype._kbnTouchClick=function(n){if(this.model.selectionType=="multiple"&&this._kTouchBar.is(":visible")&&!$(n.target).hasClass("e-cardselection")&&$(n.target).parents(".e-cardselection").length<=0&&!$(n.target).hasClass("e-cardtouch")&&$(n.target).parents(".e-cardtouch").length<=0&&!this._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")&&this._kTouchBar.hide(),n.type=="touchstart"&&(this._cardSelect="touch"),this.model.allowSearching&&!this.element.hasClass("e-responsive")){var t=this.element.find(".e-searchbar.e-ul");$(n.target).hasClass("e-searchitem")&&$(n.target).hasClass("e-cancel")||$(n.target).parents(".e-searchdiv").length>0&&$(n.target).parents(".e-searchbar").find(".e-cancel").length>0?t.addClass("e-highliht-kbnsearchbar"):$(n.target).hasClass("e-searchitem")&&$(n.target).hasClass("e-searchfind")&&t.removeClass("e-highliht-kbnsearchbar")}},t.prototype._kbnHoldHandler=function(n){if(this.model.enableTouch&&($(n.target).hasClass("e-kanbancard")||$(n.target).parents(".e-kanbancard").length>0)&&n.type=="taphold"&&n.pointerType=="touch"){this._cardSelect="hold";var i=$(n.target),t=null;$(n.target).parents(".e-kanbancard").length>0&&(i=$(n.target).parents(".e-kanbancard"));this.KanbanDragAndDrop&&(t=this.KanbanDragAndDrop._createCardClone(t,i),t.css({position:"absolute",top:n.originalEvent.changedTouches[0].pageY,left:n.originalEvent.changedTouches[0].pageX}),t.addClass("e-left-rotatecard"))}},t.prototype._swipeKanban=function(n){if(this.element.hasClass("e-responsive")&&this._kbnTransitionEnd&&this.element.find(".e-targetclone").length==0)switch(n.type){case"swipeleft":this.KanbanAdaptive._kbnLeftSwipe();break;case"swiperight":this.KanbanAdaptive._kbnRightSwipe()}},t.prototype._wireEvents=function(){if(this._on(this.element,$.isFunction($.fn.tap)&&this.model.enableTouch?"tap":"click","",this._clickHandler),this._on($("#"+this._id+"_searchbar"),"keyup","",this._onToolbarClick),this._on($(document),"click touchstart","",this._kbnTouchClick),this._on(this.element,"taphold","",this._kbnHoldHandler),this._on(this.element,"touchend","",this._kbnTouchEndHandler),this._on(this.element,$.isFunction($.fn.doubletap)&&this.model.enableTouch?"doubletap":"dblclick",".e-kanbancard",this._cardDblClickHandler),this.KanbanAdaptive&&this._on(this.element,"swipeleft swiperight",".e-kanbancontent",$.proxy(this._swipeKanban,this)),this.KanbanContext&&this._on(this.element,"contextmenu","",this.KanbanContext._kbnBrowserContextMenu),this.KanbanFilter&&this._on($("#"+this._id+"_searchbar"),"keypress","",this.KanbanFilter._onToolbarKeypress),this.KanbanEdit){if(ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8)$(window).on("resize",$.proxy(this.kanbanWindowResize,this));this._enableEditingEvents()}this._enableCardHover();this.model.tooltipSettings.enable&&(this._on(this.element,"mouseover",".e-kanbancard",this._showToolTip),this._on(this.element,"mouseout",".e-kanbancard",this._hideToolTip));this.model.allowKeyboardNavigation&&(this.element[0].tabIndex=this.element[0].tabIndex==-1?0:this.element[0].tabIndex,this.element[0].accessKey=!ej.isNullOrUndefined(this.element[0].accessKey)&&this.element[0].accessKey!=""?this.element[0].accessKey:"e",this._on(this.element,"keyup","",undefined))},t.prototype._enableEditingEvents=function(){this.model.editSettings.allowAdding?this._on(this.element,"dblclick doubletap",".e-kanbancontent .e-columnrow .e-rowcell",this._cellDblClickHandler):this._off(this.element,"dblclick doubletap",".e-kanbancontent .e-columnrow .e-rowcell");this.model.editSettings.allowEditing||this.model.editSettings.allowAdding?this._on($("#"+this._id+"_dialogEdit"),"click keypress","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel",this._clickHandler):this._off($("#"+this._id+"_dialogEdit"),"click","#EditDialog_"+this._id+"_Save ,#EditDialog_"+this._id+"_Cancel")},t.prototype._cardDblClickHandler=function(n){this._dblArgs=n;var i,f=this.model.fields.primaryKey,r,u,t=new ej.Query;if(i=$(n.target).closest(".e-kanbancard"),r=i.attr("id"),u=new ej.DataManager(this._currentJsonData),t=t.where(f,ej.FilterOperators.equal,r),this._currentData=u.executeLocal(t),this._dblArgs.data=this._currentData[0],this._trigger("cardDoubleClick",this._dblArgs),!this._isEdit){if(this._cardEditClick=!0,!ej.isNullOrUndefined(this._cardEditClick)&&this._cardEditClick&&this._dblArgs.cancel){this._cardEditClick=null;return}this.model.editSettings.allowEditing&&this.KanbanEdit.startEdit($(n.target).closest(".e-kanbancard"))}},t.prototype._cellDblClickHandler=function(n){$(n.target).hasClass("e-rowcell")&&(this._isAddNewClick=!0,this._newCard=$(n.target),this.KanbanEdit.addCard())},t.prototype._enableCardHover=function(){this.model.allowHover?this._on(this.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard",this._cardHover):this._off(this.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard")},t.prototype.refreshColumnConstraints=function(){this.KanbanCommon._renderLimit();this.KanbanSwimlane&&this._enableSwimlaneCount&&this.KanbanSwimlane._swimlaneLimit(args);this._enableSwimlaneCount=!1},t.prototype.hideColumns=function(n){for(var i,r=0,u,f="_hiddenColumns",t=0;t<this._visibleColumns.length;t++)i=$.inArray(this._collapsedColumns[t],this._visibleColumns),i!=-1&&r++;if(this._visibleColumns.length-1>r)u=typeof n=="string"?this.getColumnByHeaderText(n):this.getColumnByHeaderText(n[0]),this.KanbanCommon._hideCollapseColumns(u,n,f,"_visibleColumns"),this.KanbanCommon._showhide(this[f],"hide"),this.model.stackedHeaderRows.length>0&&this.KanbanCommon._refreshStackedHeader();else{if(this._visibleColumns.length==1)return;this._visibleColumns[0]==n?this.KanbanCommon._expandColumns(this._visibleColumns[1]):this.KanbanCommon._expandColumns(this._visibleColumns[0]);this.hideColumns(n)}this.KanbanCommon._renderLimit();this.KanbanCommon._totalCount();this.KanbanCommon._stackedHeadervisible()},t.prototype._cardHover=function(n){var r=$(n.target),i=$(this._kanbanRows),t=$(r).closest(".e-kanbancard");return t.length<=0?!1:(this.model.allowHover&&(n.type=="mouseenter"?ej.isNullOrUndefined(i)||t.index()!=-1&&t.addClass("e-hover"):i.find(".e-kanbancard").removeClass("e-hover")),!1)},t.prototype.toggleCard=function(n){var t,i;if(typeof n=="string"||typeof n=="number")t=this.element.find("div.e-kanbancard[id="+n+"]"),this.KanbanCommon._toggleCardByTarget($(t).find(".e-cardheader .e-icon"));else if(typeof n=="object"&&n[0].nodeName!="DIV")for(i=0;i<n.length;i++)t=this.element.find("div.e-kanbancard[id="+n[i]+"]"),this.KanbanCommon._toggleCardByTarget($(t).find(".e-cardheader .e-icon"));else this.KanbanCommon._toggleCardByTarget(n)},t.prototype.toggleColumn=function(n){var u,i,f,t,r,s,e,o;if(typeof n=="string"||"object"&&n[0].nodeName!="DIV"&&n[0].nodeName!="TD")this.KanbanCommon._toggleField(n);else if(n[0].nodeName=="TD")this.KanbanCommon._toggleField(n.closest(".e-shrink").find(".e-shrinkheader").text().split("[")[0]);else if(s=this.model.columns,this.model.stackedHeaderRows.length&&(r=this.model.stackedHeaderRows[0].stackedHeaderColumns),f=n.closest(".e-headercell").not(".e-stackedHeaderCell"),i=this.element.find(".e-columnheader").not(".e-stackedHeaderRow").find(".e-hide"),f.length>0)this.KanbanCommon._toggleField(s[f.index()].headerText);else if(n.closest(".e-shrink").find(".e-shrinkheader").length>0)for(t=0;t<i.length;t++)e=$(i[t]).find(".e-headerdiv").text().split("[")[0],e==n.closest(".e-shrink").find(".e-shrinkheader").text().split("[")[0]&&($(i[t]).next().find(".e-clcollapse").addClass("e-clexpand"),$(i[t]).next().find(".e-clexpand").removeClass("e-clcollapse"),this.KanbanCommon._toggleField(e));else if(n.closest(".e-stackedHeaderRow").length>0)for(u=n.closest(".e-stackedHeaderCell"),t=0;t<r.length;t++)r[t].headerText==$(u).text()&&(u.hasClass("e-collapse")?this.element.find(".e-stackedHeaderCell").eq(t).removeClass("e-collapse"):this.element.find(".e-stackedHeaderCell").eq(t).addClass("e-collapse"),this.KanbanCommon._toggleField(r[t].column.split(",")));this.element.find(".e-targetdragclone").is(":visible")&&(o=this.element.find(".e-targetdragclone").next(".e-kanbancard").eq(0),o.length>0?this.element.find(".e-targetdragclone").width(o.width()):this.element.find(".e-targetdragclone").width(""));this.model.allowScrolling&&this.model.allowToggleColumn&&(this.KanbanCommon._setWidthToColumns(),this.KanbanScroll._renderScroller())},t.prototype._clickevent=function(n){this.KanbanContext&&this.KanbanContext._kanbanContextClick(n,this)},t.prototype._clickHandler=function(n){var t=$(n.target),i,f=t.hasClass("e-rowcell")?t.index():t.closest(".e-rowcell").index(),r=this.getIndexByRow(t.closest("tr.e-columnrow")),u;i=t.closest(".e-kanbancard");($(n.target).hasClass("e-customaddbutton")||$(n.target).parents(".e-customaddbutton").length>0)&&(this._isAddNewClick=!0,this._newCard=$(n.target).parents(".e-rowcell"),this.KanbanEdit&&this.KanbanEdit.addCard());(t.hasClass("e-cardexpand")||t.hasClass("e-cardcollapse")||t.hasClass("e-expandcollapse"))&&this.toggleCard(t);(t.closest(".e-clexpand").length||t.closest(".e-clcollapse").length||t.closest(".e-shrink").length||t.closest(".e-stackedHeaderRow").length)&&this.model.allowToggleColumn&&this.toggleColumn(t);!ej.isNullOrUndefined(this.model.fields.swimlaneKey)&&(t.hasClass("e-slexpandcollapse")||t.hasClass("e-slexpand")||t.hasClass("e-slcollapse"))&&this.KanbanSwimlane.toggle(t);this.model.allowSelection&&this.KanbanSelection&&i.length>0&&t.closest(".e-expandcollapse").length<=0&&(u=$(i.parent()).children().eq(0).hasClass("e-limits")?i.index()-1:i.index(),this.model.selectionType=="single"?this.KanbanSelection._cardSelection([[r,[f],[u]]],i,n):this.model.selectionType=="multiple"&&(n.shiftKey||n.ctrlKey||this._enableMultiTouch?(this._currentRowCellIndex.length==0||r==this._currentRowCellIndex[0][0])&&this.KanbanSelection._cardSelection([[r,[f],[u]]],i,n):this.KanbanSelection._cardSelection([[r,[f],[u]]],i,n)));i.length>0&&this.KanbanCommon._cardClick(t,i);(t.attr("id")==this._id+"_Cancel"||t.parent().attr("id")==this._id+"_closebutton")&&this.KanbanEdit.cancelEdit();t.attr("id")==this._id+"_Save"&&this.KanbanEdit.endEdit();t.hasClass("e-cardtouch")&&(t.hasClass("e-spanclicked")?(t.removeClass("e-spanclicked"),this._enableMultiTouch=!1,this._kTouchBar.hide()):(t.addClass("e-spanclicked"),this._enableMultiTouch=!0));this.KanbanCommon._kbnHeaderAndCellEvents(t)},t.prototype.getRowByIndex=function(n){if(!ej.isNullOrUndefined(n))return $(this._columnRows[n])},t.prototype.getScrollObject=function(){return(this._scrollObject==null||ej.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},t.prototype.getIndexByRow=function(n){return $(this._columnRows).index(n)},t.prototype._initialize=function(){},t.prototype._initPrivateProperties=function(){this.currentViewData=null;this._filterCollection=[];this._collapsedColumns=[];this._expandedColumns=[];this._dataManager=this._dataSource()instanceof ej.DataManager?this._dataSource():this._dataSource()!=null?new ej.DataManager(this._dataSource()):null;this._originalWidth=this.element.width();this._recordsCount=this._dataSource()!==null?this._dataSource().length:0;ej.Kanban.Locale["default"]=ej.Kanban.Locale["en-US"]={EmptyCard:"No cards to display",SaveButton:"Save",CancelButton:"Cancel",EditFormTitle:"Details of ",AddFormTitle:"Add New Card",SwimlaneCaptionFormat:"- {{:count}}{{if count == 1 }} item {{else}} items {{/if}}",FilterSettings:"Filters:",FilterOfText:"of",Max:"Max",Min:"Min",Cards:" Cards",ItemsCount:"Items Count :",Unassigned:"Unassigned",AddCard:"Add Card",EditCard:"Edit Card",DeleteCard:"Delete Card",TopofRow:"Top of Row",BottomofRow:"Bottom of Row",MoveUp:"Move Up",MoveDown:"Move Down",MoveLeft:"Move Left",MoveRight:"Move Right",MovetoSwimlane:"Move to Swimlane",HideColumn:"Hide Column",VisibleColumns:"Visible Columns",PrintCard:"Print Card",Search:"Search"};this.localizedLabels=this._getLocalizedLabels()},t.prototype._init=function(){if(this._initPrivateProperties(),this._initialKanbanModel=$.extend(!0,{},this.model),this._trigger("load"),!ej.isNullOrUndefined(this.model.query)&&this.model.query instanceof ej.Query||(this.model.query=new ej.Query),this._initSubModules(),this._initialize(),this.model.columns.length==0)return!1;this.KanbanAdaptive&&this.KanbanAdaptive._kbnAdaptSwimlaneData();this.element.removeClass("e-kanbanscroll");this.KanbanScroll&&this.KanbanScroll._initScrolling();this._checkDataBinding()},t.prototype._initSubModules=function(){var n=this.model;this.KanbanCommon=new ej.KanbanFeatures.Common(this);n.allowDragAndDrop&&(this.KanbanDragAndDrop=new ej.KanbanFeatures.DragAndDrop(this));(n.editSettings.allowEditing||n.editSettings.allowAdding)&&(this.KanbanEdit=new ej.KanbanFeatures.Edit(this));n.isResponsive&&(this.KanbanAdaptive=new ej.KanbanFeatures.Adaptive(this));n.isResponsive&&n.minWidth>0&&(n.allowScrolling=!0);n.allowScrolling&&(this.KanbanScroll=new ej.KanbanFeatures.Scroller(this));n.contextMenuSettings.enable&&(this.KanbanContext=new ej.KanbanFeatures.Context(this));n.fields&&!ej.isNullOrUndefined(n.fields.swimlaneKey)&&(this.KanbanSwimlane=new ej.KanbanFeatures.Swimlane(this));n.allowSelection&&(this.KanbanSelection=new ej.KanbanFeatures.Selection(this));(n.filterSettings.length>0||n.allowFiltering||n.customToolbarItems.length>0||n.allowPrinting||n.allowSearching)&&(this.KanbanFilter=new ej.KanbanFeatures.Filter(this))},t.prototype.kanbanWindowResize=function(n){var e,h,u,g,a,i,f,r,nt,tt,o,it,v,y,t,p,rt,w,c,ut,b,l,k,s,d,ft;if(this.KanbanAdaptive)if(this._kbnDdlWindowResize&&ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8&&n.stopImmediatePropagation(),e=this.element.find(".e-kanbantoolbar"),h=this.model.fields.swimlaneKey,this.model.isResponsive&&(ej.isNullOrUndefined(this.model.minWidth)||this.model.minWidth==0)){if(g=$(".e-kanbanfilter-window"),a=!0,ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)<=9&&(a=!1),a)if(window.matchMedia("(max-width: 801px)").matches||window.matchMedia("(max-device-width: 1200px)").matches){if(this.model.isResponsive&&this.kanbanContent.hasClass("e-scroller")&&this.kanbanContent.data("ejScroller").destroy(),this.element.hasClass("e-responsive")||(this.element.addClass("e-responsive"),e.css("display","table"),e.find(".e-searchdiv").hide(),e.find(".e-search").css({border:"none"}),ej.isNullOrUndefined(h)||this.KanbanAdaptive._kbnAdaptSwimlaneDdl(),this.model.filterSettings.length>0&&(this.KanbanAdaptive._kbnAdaptFilterWindow(),this._kbnFilterCollection=this._filterCollection.slice()),this._on($(".e-swimlane-window,.e-kanbanfilter-window,.e-kanbantoolbar"),$.isFunction($.fn.tap)&&this.model.enableTouch?"tap":"click","",this._kbnAdaptClickHandler)),this.KanbanAdaptive._columnTimeoutAdapt(),!this.element.hasClass("e-swimlane-responsive"))for(i=this.element.find(".e-rowcell:visible"),t=0;t<i.length;t++)i.eq(t).height()+i.eq(t).offset().top>$(window).height()&&(f=i.eq(t).find(".e-cell-scrollcontent"),f.length>0?(f.ejScroller({height:$(window).height()-(this.kanbanContent.offset().top+2),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),i.eq(t).find(".e-shrinkheader").prependTo(i.eq(t))):(f=ej.buildTag("div.e-cell-scrollcontent","<div><\/div>"),i.eq(t).append(f),f.children().append(i.eq(t).children(":not('.e-cell-scrollcontent')")),f.ejScroller({height:$(window).height()-(this.kanbanContent.offset().top+2),thumbStart:$.proxy(this._kbnThumbStart,this),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),i.eq(t).find(".e-shrinkheader").prependTo(i.eq(t))));if(u=this.element.find(".e-searchbar"),u.length>0&&u.find(".e-ejinputtext").val().length>0&&(r=u.find(".e-searchitem"),r.addClass("e-searchfind"),r.prev().show(),u.siblings().hide(),u.find(".e-adapt-search").length==0&&(nt=ej.buildTag("div.e-icon e-adapt-search e-searchfind","",{}),tt=ej.buildTag("div.e-icon e-adapt-cancel e-cancel","",{}),r.siblings(".e-searchdiv").append(tt).prepend(nt)),r.parents(".e-search").css({border:""}),r.parents("body").removeClass("e-kbnwindow-modal"),r.parents(".e-kanbantoolbar").addClass("e-adaptive-search"),u.find(".e-adapt-cancel").show(),r.hide()),this.model.filterSettings.length>0)for(o=this.element.find(".e-quickfilter").nextAll(".e-tooltxt"),t=0;t<o.length;t++)o.eq(t).hasClass("e-select")&&(it=o.index(o.eq(t)),v=this.element.find(".e-kanbanfilter-icon"),this._kbnAutoFilterCheck=!0,g.find(".e-filter-content span.e-chkbox-wrap").eq(it).click(),this._kbnAutoFilterCheck=!1,v.hasClass("e-kbnclearfl-icon")||v.addClass("e-kbnclearfl-icon"),o.eq(t).removeClass("e-select"));if(ej.isNullOrUndefined(h)||this.kanbanContent.ejScroller({height:$(window).height()-(this.headerContent.offset().top+this.headerContent.height()+5),scroll:$.proxy(this._freezeSwimlane,this),thumbStart:$.proxy(this._kbnThumbStart,this),buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),!this.element.hasClass("e-swimlane-responsive"))for(y=this.element.find(".e-rowcell .e-cell-scrollcontent:visible"),t=0;t<y.length;t++)p=$(y[t]).data("ejScroller"),ej.isNullOrUndefined(p)||p.refresh();rt=this.element.find(".e-kanbandialog");w=this.element.find(".e-swimlane-window");rt.is(":visible")&&this.KanbanAdaptive&&this.KanbanAdaptive._setAdaptEditWindowHeight();!ej.isNullOrUndefined(h)&&w.is(":visible")&&(c=this.element.find(".e-slwindow-scrollcontent"),ut=this.headerContent.offset().top,c.ejScroller({height:$(window).height()-c.offset().top,buttonSize:0,scrollerSize:9,enableTouchScroll:!0,autoHide:!0}),c.data("ejScroller").refresh(),w.css({height:$(window).height()-ut}));this.KanbanSwimlane&&this.KanbanSwimlane._removeFreezeRow();this.model.allowSearching&&ej.browserInfo().name=="webkit"&&this.element.find(".e-searchitem").addClass("e-webkitadapt-search")}else this.KanbanAdaptive&&(b=$("#"+this._id+"_toolbarItems"),b.parents(".e-kanban").length==0&&(b.removeClass("e-kbntoolbar-body").prependTo(this.element),$("#"+this._id+"_slWindow").removeClass("e-kbnslwindow-body").appendTo(this.element)),this.KanbanAdaptive._removeKbnAdaptItems(),this.element.find(".e-webkitadapt-search").removeClass("e-webkitadapt-search"),this.model.allowScrolling&&(this.KanbanCommon._setWidthToColumns(),this.KanbanScroll._renderScroller()));!ej.isNullOrUndefined(this.model.fields.swimlaneKey)&&this.kanbanContent.hasClass("e-scroller")&&this.kanbanContent.data("ejScroller").refresh();this.KanbanAdaptive._setAdaptiveSwimlaneTop()}else this.model.scrollSettings.width=this._originalScrollWidth,this.element.outerWidth("100%"),this.getContentTable().width("100%"),this.getHeaderTable().width("100%"),l=this.element.outerWidth(),k=$(window).width()-this.element.offset().left,s=$(window).height()-this.element.offset().top,e.length>0&&(s=s-(e.outerHeight()+25)),d=this.headerContent.outerHeight()+this.getContentTable().height(),ft=this.model.minWidth>l||k<=l||s<=d,this.KanbanAdaptive&&this.KanbanAdaptive._renderResponsiveKanban(ft,d,l,s,k)},t.prototype._initKanbanRender=function(){var n=this,t;this._addInitTemplate();this.model.keySettings&&$.extend(this.model.keyConfigs,this.model.keySettings);this._render();this._trigger("dataBound",{});this.model.contextMenuSettings.enable&&(this._dataManager.dataSource.offline?this.KanbanContext._renderContext():(t=n._dataSource().executeQuery(this.model.query),t.done(ej.proxy(function(t){n._contextSwimlane=new ej.DataManager(t.result);n.KanbanContext._renderContext()}))));this.KanbanEdit&&(this.KanbanEdit._processEditing(),this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="dialogtemplate"?this.element.append(this.KanbanEdit._renderDialog()):(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&this.element.append(this.KanbanEdit._renderExternalForm()));this.KanbanAdaptive&&this.KanbanAdaptive._setResponsiveHeightWidth();this.KanbanSelection&&this.KanbanSelection._renderKanbanTouchBar();this._wireEvents();this.model.tooltipSettings.enable&&(this.element.append($("<div class='e-kanbantooltip'><\/div>")),this.element.find(".e-kanbantooltip").hide());this.initialRender=!1},t.prototype._render=function(){this.element.addClass(this.model.cssClass+"e-widget");this._renderContent().insertAfter(this.element.children(".e-kanbanheader"));this.model.enableTotalCount&&this.KanbanCommon._totalCount();this.KanbanCommon._renderLimit();this._enableDragandScroll();ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow"));this.initialRender&&this.KanbanCommon._addLastRow()},t.prototype._renderHeader=function(){var e=ej.buildTag("div.e-kanbanheader","",{},{}),a=ej.buildTag("div","",{},{}),tt=$(document.createElement("colgroup")),s,rt,i,c,w,u,b,et,k,ot,d,st,g,nt,f,l;ej.isNullOrUndefined(this.model.fields.swimlaneKey)||e.addClass("e-slheader");this.model.allowScrolling&&a.addClass("e-headercontent");e.append(a);var o=ej.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"kanban"}),v=ej.buildTag("thead","",{},{}),it=ej.buildTag("tbody.e-hide","",{},{});for(s=0;s<this.model.stackedHeaderRows.length;s++)rt=this.KanbanCommon._createStackedRow(this.model.stackedHeaderRows[s]),v.append(rt);var y=ej.buildTag("tr.e-columnheader","",{},{}),ut=$(document.createElement("tr")),r=this.model.columns;for(this._visibleColumns=[],this._expandedColumns=[],this._headerColumnNames={},i=0;i<r.length;i++){var n=r[i],t=ej.buildTag("th.e-headercell","",{},{role:"columnheader"}),h=document.createElement("col"),ht=document.createElement("td"),p=ej.buildTag("div.e-headercelldiv","",{},{}),ft=ej.buildTag("div.e-headerdiv",n.headerText!=null?n.headerText:n.key,{},{});if(ej.isNullOrUndefined(n.headerTemplate)||ft.html($(n.headerTemplate).hide().html()),u=null,this.model.enableTotalCount&&(c=ej.buildTag("div.e-totalcard","",{},{}),w=ej.buildTag("span.e-totalcount","",{},{}),ej.isNullOrUndefined(n.totalCount)||ej.isNullOrUndefined(n.totalCount.text)?c.append(this.localizedLabels.ItemsCount).append(w):c.append(n.totalCount.text+" : ").append(w),t.append(c)),ej.isNullOrUndefined(n.constraints)||(b=!ej.isNullOrUndefined(n.constraints.min),et=!ej.isNullOrUndefined(n.constraints.max),u=ej.buildTag("div.e-limits","",{},{}),b&&(k=ej.buildTag("div.e-min",this.localizedLabels.Min,"",{}),ot=ej.buildTag("span.e-minlimit"," "+n.constraints.min.toString(),"",{}),k.append(ot),u.append(k)),et&&(d=ej.buildTag("div.e-max",this.localizedLabels.Max,"",{}),st=ej.buildTag("span.e-maxlimit"," "+n.constraints.max.toString(),"",{}),d.append(st),b&&u.append("/"),u.append(d)),this.model.enableTotalCount&&u.children().length>0&&u.prepend("|")),p.append(ft),t.prepend(p),t.append(u),this.model.allowToggleColumn&&(r[i].isCollapsed===!0?t.append(ej.buildTag("div.e-icon e-clcollapse","",{},{})).addClass("e-shrinkcol"):t.append(ej.buildTag("div.e-icon e-clexpand","",{},{}))),r[i].isCollapsed===!0&&this.model.allowToggleColumn?(t.find(".e-headercelldiv,.e-totalcard,.e-limits").addClass("e-hide")&&$(h).addClass("e-shrinkcol"),$.inArray(r[i].headerText,this._collapsedColumns)==-1&&this._collapsedColumns.push(r[i].headerText)):(t.find(".e-headercelldiv,.e-totalcard").removeClass("e-hide")&&$(h).removeClass("e-shrinkcol"),ej.isNullOrUndefined(r[i].constraints)||r[i].constraints.type!="column"?t.find(".e-limits").addClass("e-hide"):t.find(".e-limits").removeClass("e-hide"),this._expandedColumns.push(r[i].headerText),r[i].isCollapsed=!1),tt.append(h),y.append(t),ut.append(ht),n.visible===!1?(t.addClass("e-hide")&&$(h).css("display","none"),$.inArray(n.headerText,this._hiddenColumns)==-1&&this._hiddenColumns.push(n.headerText)):(this._visibleColumns.push(n.headerText),n.visible=!0),g=t.find(".e-limits"),nt=t.find(".e-totalcard"),(t.find(".e-clexpand").length>0||r[i].isCollapsed)&&(nt.length==0&&g.length==0?t.addClass("e-toggleonly"):nt.length==0&&g.children().length==0&&t.addClass("e-toggleonly")),t.hasClass("e-toggleonly"))for(l=0;l<this.model.columns.length;l++)f=this.model.columns[l],ej.isNullOrUndefined(f.constraints)||ej.isNullOrUndefined(f.constraints.min)&&ej.isNullOrUndefined(f.constraints.max)||t.addClass("e-toggle-withoutcount");f=this.model.columns[i];!this.model.enableTotalCount&&(ej.isNullOrUndefined(f.constraints)||ej.isNullOrUndefined(f.constraints.min)&&ej.isNullOrUndefined(f.constraints.max))||(t.addClass("e-toggle-withcount"),y.addClass("e-header-withcount"));(ej.isNullOrUndefined(n.allowDrag)||n.allowDrag!=!1)&&(n.allowDrag=!0);(ej.isNullOrUndefined(n.allowDrop)||n.allowDrop!=!1)&&(n.allowDrop=!0);ej.isNullOrUndefined(n.headerTemplate)||p.parent().addClass("e-headertemplate");this.initialRender&&(typeof n.width=="string"&&n.width.indexOf("%")!=-1?this._columnsWidthCollection.push(parseInt(n.width)/100*this.element.width()):this._columnsWidthCollection.push(n.width))}return v.append(y),o.append(tt).append(v),it.append(ut),o.append(it),a.append(o),this.setHeaderContent(e),this.setHeaderTable(o),e},t.prototype._renderContent=function(){var t=ej.buildTag("div.e-kanbancontent","",{},{}),i=ej.buildTag("div","",{},{}),u=ej.buildTag("tbody","",{},{}),n=ej.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"kanban"}),r;return n.append(this.getHeaderTable().find("colgroup").clone()).append(u),i.append(n),t.append(i),this.setContent(t),this.setContentTable(n),n.attr("role","kanban"),r={requestType:"refresh"},this.sendDataRenderingRequest(r),t},t.prototype.refreshTemplate=function(){this._addInitTemplate();(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this.KanbanEdit._addDialogEditingTemplate()},t.prototype.getContentTable=function(){return this.contentTable},t.prototype.setContentTable=function(n){this.contentTable=n},t.prototype.getVisibleColumnNames=function(){return this._visibleColumns},t.prototype.getHeaderContent=function(){return this.headerContent},t.prototype.setHeaderContent=function(n){this.headerContent=n},t.prototype.getContent=function(){return this.kanbanContent},t.prototype.setContent=function(n){this.kanbanContent=n},t.prototype._initDataSource=function(){var n=this,t;this._isLocalData=!(this._dataSource()instanceof ej.DataManager)||this._dataSource().dataSource.offline;this._ensureDataSource();this._trigger("actionBegin");t=this._dataSource().executeQuery(this.model.query);this.element.is(":visible")||this.element.ejWaitingPopup("hide");t.done(ej.proxy(function(t){n.element.ejWaitingPopup("hide");n._currentJsonData=n.currentViewData=t.result;n._recordsCount=t.count==0&&t.result.length?t.result.length:t.count;n._initKanbanRender()}))},t.prototype.columns=function(n,t,i){var u,r,f,o,e,s;if(!ej.isNullOrUndefined(n)){for(u=!1,typeof n=="string"?(n=[n],u=!0):n instanceof Array&&n.length&&typeof n[0]=="string"&&(u=!0),r=0;r<n.length;r++)f=$.inArray(this.getColumnByHeaderText(u?n[r]:n[r].headerText),this.model.columns),i=="add"||ej.isNullOrUndefined(i)?f==-1?this.model.columns.push(u?{headerText:n[r],key:t}:n[r]):this.model.columns[f]=u?{headerText:n[r],key:t}:n[r]:f!=-1&&this.model.columns.splice(f,1);for(o=this.element.find(".e-kanbanheader"),this._columnsWidthCollection=[],e=0;e<this.model.columns.length;e++)ej.isNullOrUndefined(this.model.columns[e].width)||this._columnsWidthCollection.push(this.model.columns[e].width);this.element[0].replaceChild(this._renderHeader()[0],o[0]);u?(this._keyValue.push(t),this.keyPredicates.push(new ej.Predicate(this.model.keyField,ej.FilterOperators.equal,t,!0))):this._addColumnFilters();s={requestType:"addcolumn"};this.refresh(!0);this.KanbanScroll&&this.KanbanScroll._refreshHeaderScroller();this.KanbanCommon._totalCount()}},t.prototype._checkDataBinding=function(){var n,t;(this.model.columns.length||(this._dataSource()!=null&&this._dataSource().length||this._dataSource()instanceof ej.DataManager)&&(!(this._dataSource()instanceof ej.DataManager)||this._dataManager.dataSource.url!=undefined||this._dataSource().dataSource.json.length))&&(ej.isNullOrUndefined(this.model.keyField)||this._addColumnFilters(),this.initialRender=!0,this.model.cssClass!=null&&this.element.addClass(this.model.cssClass),(this.model.filterSettings.length>0||this.model.allowSearching||this.model.customToolbarItems.length>0||this.model.allowPrinting)&&this.element.append(this._renderToolBar()),n=this.model.columns,n&&n.length&&(this.element.append(this._renderHeader()),this.KanbanCommon._stackedHeadervisible()),$.isFunction($.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),$("#"+this._id+"_WaitingPopup").addClass("e-kanbanwaitingpopup")),this._dataSource()instanceof ej.DataManager?(this.element.ejWaitingPopup("show"),this._dataSource().ready!=undefined?(t=this,this._dataSource().ready.done(function(n){t._initDataSource();t.model.dataSource=new ej.DataManager(n.result)})):(this.element.ejWaitingPopup("show"),this._initDataSource())):(this._trigger("actionBegin"),this._ensureDataSource(),this._initKanbanRender(),this.KanbanCommon._enableKanbanRTL()))},t.prototype._renderToolBar=function(){var n=ej.buildTag("div.e-kanbantoolbar","",{},{id:this._id+"_toolbarItems"}),o,s,f,r,u,t,v;if(this.model.allowSearching){this._isWatermark="placeholder"in document.createElement("input");var e=ej.buildTag("ul.e-searchbar","",{},{}),i=ej.buildTag("li.e-search","",{},{id:this._id+"_toolbarItems_search"}),c=ej.buildTag("a.e-searchitem e-toolbaricons e-disabletool e-icon e-searchfind","",{float:"right"},{});ej.browserInfo().name=="msie"&&c.css("position","absolute");o=ej.buildTag("input.e-ejinputtext e-input","",{},{type:"text",id:this._id+"_searchbar",placeholder:this.localizedLabels.Search,height:"33px"});s=ej.buildTag("div.e-searchdiv","",{display:"inline-table",width:"83%"},{});s.append(o);i.append(s);i.append(c);e.append(i);this._searchInput=o;ej.isNullOrUndefined(this.model.searchSettings.key)||this._searchInput.val(this.model.searchSettings.key);this._searchBar=i;this._isWatermark||(this._hiddenSpan=ej.buildTag("span.e-input e-placeholder","Search",{display:"block"},{}).insertAfter(this._searchInput))}for(ej.isNullOrUndefined(this.model.customToolbarItems)||(f=ej.buildTag("ul.e-customtoolbar"),this.model.filterSettings.length>0&&f.addClass("e-customtoolbarseparator"),!ej.isNullOrUndefined(this.model.customToolbarItems)&&this.model.customToolbarItems.length&&this._renderCustomLi(f),n.append(f)),this.model.filterSettings.length>0&&(r=ej.buildTag("ul","",{},{}),u=ej.buildTag("li","",{},{"class":"e-quickfilter",tabindex:"0"}),u.append("<label class='e-toolbartext e-text'>"+this.localizedLabels.FilterSettings+"<\/label>"),r.append(u)),t=0;t<this.model.filterSettings.length;t++){var l=this.model.filterSettings[t].description,i=ej.buildTag("li","",{},{id:this._id+"_"+this.model.filterSettings[t].text,title:ej.isNullOrUndefined(l)?this.model.filterSettings[t].text:l,tabindex:"0","class":"e-kbnfilter-tbtn"}),a=ej.buildTag("a.e-toolbartext e-text",this.model.filterSettings[t].text,{},{});i.append(a);r.append(i)}if(this.model.allowPrinting){var h=ej.buildTag("ul.e-print","",{},{}),u=ej.buildTag("li","",{},{"class":"e-printlist",title:"Print",tabindex:"0"}),a=ej.buildTag("a.e-printicon e-icon","",{});u.append(a);h.append(u)}return ej.isNullOrUndefined(r)||n.append(r),ej.isNullOrUndefined(h)||n.append(h),ej.isNullOrUndefined(e)||n.append(e),v={click:this._onToolbarClick},n.ejToolbar(v),this._filterToolBar=n,n},t.prototype._renderCustomLi=function(n){for(var i,r,u,t=0;t<this.model.customToolbarItems.length;t++){r=this.model.customToolbarItems[t].template?this.model.customToolbarItems[t].template.replace("#",""):this.model.customToolbarItems[t];i=ej.buildTag("li","",{},{id:this._id+"_"+r,title:r});switch(typeof this.model.customToolbarItems[t]){case"string":u=ej.buildTag("a.e-toolbaricons e-icon","",{}).addClass(this.model.customToolbarItems[t].text);break;case"object":i.attr("title",this.model.customToolbarItems[t].template.replace("#",""));u=$(this.model.customToolbarItems[t].template).hide().html()}i.html(u);n.append(i)}},t.prototype.dataSource=function(n,t){t&&(this._templateRefresh=!0);this._dataSource(n);this.KanbanCommon._refreshDataSource(n);this.model.enableTotalCount&&this.KanbanCommon._totalCount();this.KanbanCommon._addLastRow()},t.prototype._ensureDataSource=function(n){var t,f,s,i,r,e,h,u,c,o,l;if(this._dataSource()==null&&!(this._dataSource()instanceof ej.DataManager)){if(ej.isNullOrUndefined(n)||n.requestType!="add")return;this.dataSource([],!1)}if(this.model.query.requiresCount(),t=this.model.query,u=t.clone(),this._dataSource()instanceof ej.DataManager||(this._currentJsonData=this.currentViewData=this._dataSource()),(this.model.filterSettings.length||this.model.allowFiltering)&&!ej.isNullOrUndefined(n)&&n.requestType=="filtering"||!ej.isNullOrUndefined(n)&&n.requestType=="search"||this.model.searchSettings.key.length){for(t.queries=t.queries.slice(t.queries.length),this.model.allowSearching&&(s=this._searchBar.find(".e-toolbaricons"),this.model.searchSettings.key.length!=0?(i=this.model.searchSettings,s.removeClass("e-searchfind").addClass("e-cancel"),i.fields.length==0&&(ej.isNullOrUndefined(this.model.fields.content)||i.fields.push(this.model.fields.content),ej.isNullOrUndefined(this.model.fields.swimlaneKey)||i.fields.push(this.model.fields.swimlaneKey),ej.isNullOrUndefined(this.model.fields.primaryKey)||i.fields.push(this.model.fields.primaryKey),ej.isNullOrUndefined(this.model.fields.title)||i.fields.push(this.model.fields.title),ej.isNullOrUndefined(this.model.fields.tag)||i.fields.push(this.model.fields.tag),ej.isNullOrUndefined(this.model.fields.imageUrl)||i.fields.push(this.model.fields.imageUrl),ej.isNullOrUndefined(this.model.fields.priority)||i.fields.push(this.model.fields.priority),ej.isNullOrUndefined(this.model.fields.color)||i.fields.push(this.model.fields.color)),t.search(i.key,i.fields,i.operator||"contains",i.ignoreCase)):s.removeClass("e-cancel").addClass("e-searchfind")),this.element.hasClass("e-responsive")&&(this._filterCollection=this._kbnFilterCollection.slice()),r=0;r<this._filterCollection.length;r++)f=f!=undefined?f.and(this._filterCollection[r]):this._filterCollection[r];for(t.where(ej.Predicate.or(this.keyPredicates)),r=0;r<t.queries.length;r++)t.queries[r].fn=="onWhere"&&f&&(t.queries[r].e=t.queries[r].e.and(f));this._isLocalData&&(this._filteredRecords=this._dataManager.executeLocal(t).result,this._filteredRecordsCount=this._filteredRecords.length);this._isLocalData&&this.model.filterSettings.length==0&&(!ej.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount>0)&&(this._filteredRecordsCount=null,this._filteredRecords=[])}this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!ej.isNullOrUndefined(this._cModifiedData)||!ej.isNullOrUndefined(this._cAddedRecord))&&(t.queries=u.queries);n&&n.requestType=="delete"&&!ej.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof ej.DataManager?(e=$.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(e,1)):(e=$.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(undefined,!0).splice(e,1)));this._cloneQuery=t.clone();this._isLocalData&&(!ej.isNullOrUndefined(n)&&(n.requestType=="addcolumn"||n.requestType=="refresh")&&this._filterCollection.length<=0&&(ej.isNullOrUndefined(this._searchInput)||this._searchInput.val().length<=0)?(u=t.clone(),u.queries=[],u.where(ej.Predicate.or(this.keyPredicates)),h=u):h=t,c=this._dataManager.dataSource.json,o=this._dataSource().dataSource,!ej.isNullOrUndefined(o)&&this._dataSource()instanceof ej.DataManager&&(this._dataManager.dataSource.json=c!=o.json?o.json:c),l=this._dataManager.executeLocal(h),this.currentViewData=this._currentJsonData=l.result,this._recordsCount=l.count)},t.prototype._addColumnFilters=function(){for(var n,t,u=this.model.columns,i=[],f=this.model.query,r=0;r<u.length;r++)for(n=u[r].key,ej.isNullOrUndefined(n)||(n=typeof n=="object"?n:n.split(",")),t=0;t<n.length;t++)i.push(new ej.Predicate(this.model.keyField,ej.FilterOperators.equal,n[t],!0)),this._keyValue.push(n[t]);i.length>0&&f.where(ej.Predicate.or(i));this.keyPredicates=i},t.prototype.refresh=function(n){n&&this.refreshTemplate();this.KanbanCommon._processBindings({requestType:"refresh"})},t.prototype.sendDataRenderingRequest=function(n){var t,r;if(this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1),t=this.model.query,r=t.clone(),this.currentViewData!=null&&this.currentViewData.length){switch(n.requestType){case"save":case"drop":case"delete":case"refresh":case"search":case"filtering":this.element.hasClass("e-responsive")&&!ej.isNullOrUndefined(n.currentFilterObject)&&(this._kbnAdaptFilterObject=n.currentFilterObject.slice());case"cancel":if(this.element.find(".e-kbnadapt-editdlg").length==0&&this.element.hasClass("e-responsive")&&(this.model.editSettings.allowAdding||this.model.editSettings.allowEditing)&&$("#"+this._id+"_dialogEdit_wrapper").appendTo(this.element),this.getContentTable().find("colgroup").first().replaceWith(this.KanbanCommon._getMetaColGroup()),!ej.isNullOrUndefined(this.model.fields.swimlaneKey)){var i=this,f=this.model.fields.swimlaneKey,u=this.model.swimlaneSettings.unassignedGroup;t=t.group(f);this.currentViewData.GROUPGUID||(u.enable&&u.keys.length>0&&$.map(i.currentViewData,function(n,t){i.currentViewData[t]=i._checkKbnUnassigned(n)}),this.currentViewData.GROUPGUID||(this.currentViewData=new ej.DataManager(this.currentViewData).executeLocal(t).result))}this._renderAllCard();this.element.hasClass("e-responsive")&&(ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this.element.find(".e-swimlanerow").hide(),this.KanbanAdaptive&&this.KanbanAdaptive._addSwimlaneName()));this._enableSwimlaneCount=!0;this._eventBindings();this._enableDragandScroll();break;case"beginedit":case"add":this.KanbanEdit&&(this.KanbanEdit._editAdd(n),this._enableSwimlaneCount=!1)}t.queries=r.queries}else this.getContentTable().find("tbody").empty().first().append(this.KanbanCommon._getEmptyTbody());(this.model.editSettings.editMode=="externalform"||this.model.editSettings.editMode=="externalformtemplate")&&(this._editForm=this.element.find(".e-externalform"),this.KanbanEdit._formFocus());("beginedit"==n.requestType||"add"==n.requestType)&&(this.model.editSettings.editMode=="dialog"||this.model.editSettings.editMode=="externalform")&&this.KanbanEdit._refreshEditForm(n);this._renderComplete(n);this.KanbanSwimlane&&this._enableSwimlaneCount&&(this.KanbanSwimlane._swimlaneLimit(n),this._swimlaneRows=this.element.find(".e-swimlanerow"));this.KanbanCommon._renderLimit();this._filterCollection.length==0&&this.model.searchSettings.key.length==0&&this.KanbanCommon._totalCount();(this._filterCollection.length>0||this.model.searchSettings.key.length>0)&&this.KanbanFilter._filterLimitCard(n);this._newData=null;this.element.hasClass("e-responsive")&&(this.kanbanWindowResize(),ej.isNullOrUndefined(this.model.fields.swimlaneKey)||this.KanbanAdaptive._setAdaptiveSwimlaneTop())},t.prototype._checkKbnUnassigned=function(n){for(var u,i=this.model.swimlaneSettings.unassignedGroup,r=n[this.model.fields.swimlaneKey],f=this.model.fields.swimlaneKey,t=0;t<i.keys.length;t++)typeof i.keys[t]=="string"&&(i.keys[t].replace(/^\s+|\s+$/g,"")==""&&$.inArray("",i.keys)>=0&&t<$.inArray("",i.keys)?i.keys.splice(t,1):i.keys[t].replace(/^\s+|\s+$/g,"")==""&&(i.keys[t]=i.keys[t].replace(/^\s+|\s+$/g,"")));if(r!=undefined&&r!=null&&typeof r=="string"&&(r=r.replace(/^\s+|\s+$/g,"")),r==null||r==undefined)for(t=0;t<i.keys.length;t++)typeof i.keys[t]=="string"&&(i.keys[t].toLowerCase()=="null"||i.keys[t].toLowerCase()=="undefined")?n[f]=this.localizedLabels.Unassigned:(i.keys[t]==null||i.keys[t]==undefined)&&(n[f]=this.localizedLabels.Unassigned);else for(t=0;t<i.keys.length;t++)u=i.keys[t],typeof r=="number"&&u.startsWith("'")&&u.endsWith("'")&&(u=u.split("'")[1]),u==r&&(n[f]=this.localizedLabels.Unassigned);return n},t.prototype._renderAllCard=function(){var n=document.createElement("div");n.innerHTML=["<table>",$.render[this._id+"_JSONTemplate"]({columns:this.model.columns,dataSource:this.currentViewData}),"<\/table>"].join("");ej.isNullOrUndefined(n.firstChild)||ej.isNullOrUndefined(n.firstChild.lastChild)||this.getContentTable().get(0).replaceChild(n.firstChild.lastChild,this.getContentTable().get(0).lastChild);ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow"));this._cardCollapse();this._swimlaneCollapse();this.KanbanSelection&&this.KanbanSelection._selectionOnRerender()},t.prototype._editEventTrigger=function(n){if(n.requestType=="save"||n.requestType=="delete"){var t={data:n.data,action:n.action!==undefined?n.action:n.requestType};this._trigger("end"+t.action.charAt(0).toUpperCase()+t.action.slice(1),t)}},t.prototype._renderComplete=function(n){n.requestType!="beginedit"&&this.KanbanCommon._setWidthToColumns();(n.requestType=="save"||n.requestType=="cancel")&&(this._isAddNew=!1,this._isEdit=!1);n.requestType=="beginedit"&&(this._isEdit=!0);("delete"==n.requestType||"save"==n.requestType)&&this._editEventTrigger(n);this._tableBEle=this.getContentTable().get(0);this._kanbanRows=this._tableBEle.rows;this._columnRows=$(this._kanbanRows).not(".e-swimlanerow");this.model.allowScrolling&&!this.initialRender&&this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell");this._trigger("actionComplete",n);!this.initialRender&&this.model.allowScrolling&&(n.requestType=="add"||n.requestType=="cancel"||n.requestType=="save"||n.requestType=="delete"||n.requestType=="filtering"||n.requestType=="search"||n.requestType=="refresh"||n.requestType=="drop")&&this.KanbanScroll._refreshScroller(n);this.model.allowDragAndDrop&&this.KanbanDragAndDrop&&this.KanbanDragAndDrop._addDragableClass()},t.prototype._createTemplate=function(n,t){var i=document.createElement("script"),r;return i.id=this._id+t+"_Template",r=this.element.parents("body").find("#"+i.id),i.type="text/x-jsrender",i.text=n,r&&r.remove(),$("body").append(i),i},t.prototype._addInitTemplate=function(){var n=this,t={},r=!ej.isNullOrUndefined(n.model.keyField),u=ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version,10)==8,f=this.model.allowToggleColumn,i=!ej.isNullOrUndefined(n.model.fields.swimlaneKey);this._slTemplate="";t[n._id+"Object"]=this;t["_"+n._id+"columnKeys"]=this._getColumnKeyItems;t["_"+n._id+"tagItems"]=this._gettagItems;t["_"+n._id+"colorMaps"]=this._getColorMaps;t["_"+n._id+"getId"]=this.KanbanCommon._removeIdSymbols;t["_"+n._id+"getData"]=this._columnData;t["_"+n._id+"getCardCount"]=this._columnCardcount;t["_"+n._id+"getStatus"]=this._columnStatus;$.views.helpers(t);i&&(this._slTemplate+="{{for dataSource ~columns=columns ~ds=dataSource}}",this._slTemplate+="<tr id='{{: ~_"+n._id+"getId(key)}}' class='e-swimlanerow' role='kanbanrow'><td class='e-rowcell' role='kanbancell' colspan='"+n.getVisibleColumnNames().length+"'><div class='e-slexpandcollapse'><div class='e-icon e-slexpand'><\/div><\/div><div class='e-slkey'>{{:key}}<\/div>{{if "+this.model.swimlaneSettings.showCount+"}}<div class='e-slcount'>"+n.localizedLabels.SwimlaneCaptionFormat+"<\/div>{{/if}}<\/td><\/tr>");this._slTemplate+="<tr class='e-columnrow' role='kanbanrow'>";this._slTemplate+=i?"{{for ~columns ~items=#data.items}}":"{{for columns}}";this._slTemplate+="<td ej-mappingkey='{{:key}}' class='e-rowcell {{if !#data.visible}} e-hide {{/if}}{{if #data.allowDrag}} e-drag {{/if}}{{if #data.allowDrop}} e-drop {{/if}}{{if (#data.isCollapsed && "+f+")}}e-shrink{{/if}}'role='kanbancell'>{{if "+r+"}}{{for ~_"+n._id+"columnKeys('"+n._id+"Object')}}";this._slTemplate+=this._cardCustomization()+"{{/for}}{{/if}}{{if "+this.model.allowToggleColumn+"}}<div class='e-shrinkheader{{if "+u+"}} IE{{/if}}{{if !#data.isCollapsed}} e-hide {{/if}}'>{{:headerText}}<div class='e-shrinklabel'>[<div class='e-shrinkcount'>{{:~_"+n._id+"getCardCount(~root.dataSource,key,#parent.parent.getIndex(),'"+n._id+"Object') }}<\/div>]<\/div><\/div>{{/if}}{{if "+this.model.editSettings.allowAdding+"}}{{if #data.showAddButton}} <div class='e-customaddbutton{{if #data.isCollapsed}} e-hide {{/if}}'><div class='e-columnadd e-icon'><\/div><\/div>{{/if}}{{/if}}<\/td>{{/for}}<\/tr>";i&&(this._slTemplate+="{{/for}}");this.templates[this._id+"_JSONTemplate"]=$.templates(this._createTemplate(this._slTemplate,"_swinlaneContent"));this.templates[this._id+"_cardTemplate"]=$.templates(this._createTemplate(this._cardTemplate,"_cardTemplate"));$.templates(this.templates)},t.prototype._cardCustomization=function(){var t=this,u=this.model.allowToggleColumn,i=this.model.cardSettings.template?!0:!1,r=this.model.fields.imageUrl?!0:!1,n=this.model.fields,o=!ej.isNullOrUndefined(n.title),f=n.title?n.title:n.primaryKey?n.primaryKey:null,e=!ej.isNullOrUndefined(n.tag)||!ej.isNullOrUndefined(n.content);return r||this.element.addClass("e-onlycontent"),this._cardTemplate="<div id='{{:"+t.model.fields.primaryKey+"}}' class='e-kanbancard {{if ~_"+t._id+"getData(#parent) && "+u+" }}e-hide{{/if}} {{if "+i+"}}e-templatecell{{/if}}'>{{if "+i+"}}"+$(t.model.cardSettings.template).html()+"{{else}}{{if "+t.model.allowTitle+"}}<div class='e-cardheader'><div class='e-primarykey'>{{:"+f+"}}<\/div><div class='e-expandcollapse'><div class='e-icon e-cardexpand'><\/div><\/div><\/div>{{/if}}<div class='e-cardcontent'><table class='e-cardtable'><tbody><tr><td class='e-contentcell'>{{if "+e+"}}<div class='e-text'>{{:"+n.content+"}}<\/div><\/td>{{if "+r+" }} <td class='e-imagecell'><div class='e-card_image'>{{if "+n.imageUrl+"}}<img class='e-image' src='{{:"+n.imageUrl+"}}'><\/img>{{else}}<div class='e-image e-no-user'><\/div>{{/if}}<\/div><\/td>{{/if}}<\/tr><tr><td>{{if "+n.tag+"}}{{for ~_"+t._id+"tagItems("+n.tag+")}}{{:#data}}{{/for}}{{/if}}<\/div>{{/if}}<\/td><td class='e-trainglecell'><div class='e-bottom-triangle'{{if "+n.color+" }} style='border-bottom-color:{{for ~_"+t._id+"colorMaps('"+t._id+"Object',"+n.color+")}}{{:#data}}{{/for}}'{{/if}}><\/div><\/td><\/tr><\/tbody><\/table><\/div>{{/if}}<\/div><\/div>",this._cardTemplate},t.prototype._columnStatus=function(n){var t=this.getRsc("helpers",n),i=t.getBrowserDetails();return i.browser=="msie"?!0:!1},t.prototype._columnCardcount=function(n,t,i,r){var o=r,e,u,f;if(typeof r=="string"&&(o=this.getRsc("helpers",r)),e=0,t=typeof t=="object"?t:t.split(","),ej.isNullOrUndefined(i)){for(u=0;u<n.length;u++)for(f=0;f<t.length;f++)n[u][o.model.keyField]===t[f]&&e++;return e}for(u=0;u<n[i].items.length;u++)for(f=0;f<t.length;f++)n[i].items[u][o.model.keyField]===t[f]&&e++;return e},t.prototype._columnData=function(n){return ej.isNullOrUndefined(n)?!1:n.parent.data.isCollapsed},t.prototype._getColorMaps=function(n,t){var e=this.getRsc("helpers",n),f,r=e.model.cardSettings.colorMapping,i,u;for(i in r){if(r[i].indexOf(",")==-1&&r[i]==t)return i;for(f=r[i].split(","),u=0;u<f.length;u++)if(f[u]==t)return i}},t.prototype._gettagItems=function(n){var i="<div class='e-tags'>",t;for(n=n.split(","),t=0;t<n.length;t++)i=i.concat("<div class='e-tag'>"+n[t]+"<\/div>");return i.concat("<\/div>")},t.prototype._getColumnKeyItems=function(n){var i=this.getRsc("helpers",n),f,s=this.ctx.root.dataSource,r,h=i.model.query,t=h.clone(),e,o,u;for(i._filterCollection.length<=0&&i.model.allowSearching&&i._searchInput.val().length<=0?(t.queries=[],t.where(ej.Predicate.or(i.keyPredicates))):t.queries=t.queries.slice(0,t.queries.length-1),e=typeof this.data.key=="object"?this.data.key:this.data.key.split(","),o=[],u=0;u<e.length;u++)o.push(new ej.Predicate(i.model.keyField,ej.FilterOperators.equal,e[u],!0));return t=t.where(ej.Predicate.or(o)),f=s.GROUPGUID?new ej.DataManager(this.ctx.items).executeLocal(t).result:new ej.DataManager(s).executeLocal(t).result,r=i.model.fields.priority,r&&f.sort(function(n,t){return n[r]-t[r]}),f},t.prototype._kbnThumbStart=function(n){var t=$(n.originalEvent.target);return t.hasClass("e-kanbancard")||t.parents(".e-kanbancard").hasClass("e-kanbancard"),!1},t.prototype._enableDragandScroll=function(){this.model.allowDragAndDrop&&this.KanbanDragAndDrop&&this.KanbanDragAndDrop._addDragableClass();this.model.allowScrolling&&(this.initialRender&&this.element.find(".e-kanbancontent").length>0?(ej.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow")),this.KanbanScroll._renderScroller()):this.KanbanScroll._refreshScroller({requestType:"refresh"}))},t.prototype._cardCollapse=function(){this._collapsedCards.length>0&&this.toggleCard(this._collapsedCards)},t.prototype._swimlaneCollapse=function(){var t,n;if(this._collapsedSwimlane.length>0)for(t=this.element.find(".e-swimlanerow"),n=0;n<t.length;n++)$.inArray(t.eq(n).attr("id"),this._collapsedSwimlane)!=-1&&this.KanbanSwimlane._toggleSwimlaneRow($(t.eq(n)).find(".e-rowcell .e-slexpandcollapse"))},t.prototype.updateCard=function(n,t){this.KanbanCommon._kanbanUpdateCard(n,t)},t.prototype._eventBindings=function(){var i,t,u,r,n,f;if(this._kanbanRows=this.getContentTable().get(0).rows,i=$(this._kanbanRows).not(".e-swimlanerow"),this._currentJsonData.length!=0&&this.model.queryCellInfo!=null)for(t=0;t<i.length;t++)for(u=i[t],r=this.model.columns,n=0;n<r.length;n++)f=$(u).find(".e-rowcell")[n],this._cellEventTrigger(f,r[n])},t.prototype._cellEventTrigger=function(n,t){for(var r=$(n).find(".e-kanbancard"),i=0;i<r.length;i++){var u=r[i].id,f=this.KanbanCommon._getKanbanCardData(this._currentJsonData,u),e={card:r[i],cell:n,column:t,data:f[0]};this._trigger("queryCellInfo",e)}},t.prototype._getLocalizedLabels=function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)},t}(ej.WidgetBase);window.ej.widget("ejKanban","ej.Kanban",new Kanban);ej.Kanban.Actions={Filtering:"filtering",BeginEdit:"beginedit",Edit:"edit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Refresh:"refresh",Search:"searching",Print:"print"};ej.Kanban.EditingType={String:"stringedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",TextArea:"textarea",RTE:"rteedit"};ej.Kanban.EditMode={Dialog:"dialog",DialogTemplate:"dialogtemplate",ExternalForm:"externalform",ExternalFormTemplate:"externalformtemplate"};ej.Kanban.FormPosition={Bottom:"bottom",Right:"right"};ej.Kanban.Type={Column:"column",Swimlane:"swimlane"};ej.Kanban.SelectionType={Multiple:"multiple",Single:"single"};ej.Kanban.MenuItem={AddCard:"Add Card",EditCard:"Edit Card",DeleteCard:"Delete Card",TopofRow:"Top of Row",BottomofRow:"Bottom of Row",MoveUp:"Move Up",MoveDown:"Move Down",MoveLeft:"Move Left",MoveRight:"Move Right",MovetoSwimlane:"Move to Swimlane",HideColumn:"Hide Column",VisibleColumns:"Visible Columns",PrintCard:"Print Card"};ej.Kanban.Target={Header:"header",Content:"content",Card:"card",All:"all"};ej.Kanban.Locale={},function(n,t,r){t.widget("ejSpreadsheet","ej.Spreadsheet",{_rootCSS:"e-spreadsheet",element:null,_excelFilter:null,validTags:["div"],model:null,_requiresID:!0,defaults:{allowFreezing:!0,enableContextMenu:!0,allowEditing:!0,allowResizing:!0,allowMerging:!0,allowWrap:!0,allowUndoRedo:!0,allowClipboard:!0,allowDataValidation:!0,allowConditionalFormats:!0,allowSearching:!0,allowKeyboardNavigation:!0,allowAutoFill:!0,allowSelection:!0,allowSorting:!0,allowDragAndDrop:!0,allowCellType:!0,allowAutoCellType:!1,allowCharts:!0,enablePersistence:!1,allowCellFormatting:!0,allowFormulaBar:!0,showRibbon:!0,showPager:!0,allowComments:!0,allowFiltering:!0,allowInsert:!0,allowDelete:!0,allowFormatPainter:!0,allowHyperlink:!0,allowImport:!0,allowFormatAsTable:!0,allowAutoSum:!0,enablePivotTable:!1,allowLockCell:!0,enableTouch:!0,allowOverflow:!0,allowClear:!0,isReadOnly:!1,columnCount:21,rowCount:20,rowHeight:20,columnWidth:64,sheetCount:1,undoRedoStep:20,activeSheetIndex:1,apWidth:300,activationPanelWidth:300,_isActPanelVisible:!1,cssClass:"",userName:"",locale:"en-US",pageSize:"A4",sheets:[],nameManager:[],customFormulas:[],currentViewData:null,query:null,create:null,actionBegin:null,actionComplete:null,beforeCellFormat:null,cellFormatting:null,beforeOpen:null,beforeDrop:null,drop:null,cellEdit:null,pagerClick:null,cellClick:null,_pivotPrint:null,tabClick:null,tabSelect:null,_createPivotTable:null,beforePanelOpen:null,load:null,loadComplete:null,editRangeBegin:null,editRangeComplete:null,cellHover:null,menuClick:null,contextMenuClick:null,ribbonClick:null,dragStart:null,drag:null,cellSave:null,beforeCellSelect:null,cellSelected:null,autoFillBegin:null,autoFillComplete:null,openFailure:null,onImport:null,onExport:null,beforeBatchSave:null,keyUp:null,keyDown:null,dragShape:null,resizeStart:null,resizeEnd:null,refresh:null,beforeEditComment:null,beforeTabClick:null,scrollStop:null,scrollSettings:{width:"100%",height:"100%",allowScrolling:!0,scrollMode:"infinite",isResponsive:!0,allowVirtualScrolling:!0,allowSheetOnDemand:!1},pageSettings:{pageCount:10,currentPage:1,pagerHeight:26},exportSettings:{allowExporting:!0,excelUrl:null,csvUrl:null,pdfUrl:null,password:null},pictureSettings:{allowPictures:!0,height:220,width:440},selectionSettings:{selectionType:"default",selectionUnit:"multirange",enableAnimation:!1,animationType:"linear",animationTime:.001,activeCell:""},chartSettings:{height:220,width:440},formatSettings:{allowFontFamily:!0,allowDecimalPlaces:!0,allowCellBorder:!0},autoFillSettings:{fillType:"fillseries",showFillOptions:!0},importSettings:{importMapper:"",importUrl:"",password:"",allowSheetOnDemand:!1,importOnLoad:!1},printSettings:{allowPageSetup:!0,allowPageSize:!1,allowPrinting:!0},ribbonSettings:{enableOnDemand:!1,applicationTab:{type:t.Ribbon.ApplicationTabType.Backstage,menuSettings:{isAppend:!1,dataSource:[]}}}},dataTypes:{pageSize:"enum",sheets:"array",nameManager:"array",scrollSettings:{scrollMode:"enum"},selectionSettings:{selectionType:"enum",selectionUnit:"enum",animationType:"enum"},autoFillSettings:{fillType:"enum"}},_dataSource:function(n){return this.getSheet(n).dataSource},getSheet:function(n){return this.model.sheets[this._getSheetIndex(n)]},getSheets:function(){return this.model.sheets},getSheetElement:function(n){return this.element.find("#"+this._id+"_"+this.getSheet(n).sheetInfo.value)},getDataSettings:function(n){var i,r=[],t=this.getSheet(n),u=t.rangeSettings.length;if(u)while(u--)i=t.rangeSettings[u],i.dataSource&&r.push(i);return r.length?r:t.dataSource?[t]:null},_getJSSheetHeader:function(n){return this._sheets[n]._sheetHeader},_setJSSheetHeader:function(n,t){this._sheets[t]._sheetHeader=n},_getInputBox:function(){return this._inputBox},_setInputBox:function(n){this._inputBox=n},_getIndexBox:function(){return this._indexBox},_setIndexBox:function(n){this._indexBox=n},_getJSSheetRowHeader:function(n){return this._sheets[n]._sheetRowHeader},_setJSSheetRowHeader:function(n,t){this._sheets[t]._sheetRowHeader=n},_getJSSheetRowHeaderContent:function(n){return this._sheets[n]._sheetRowHeaderContent},_setJSSheetRowHeaderContent:function(n,t){this._sheets[t]._sheetRowHeaderContent=n},_getJSSheetContent:function(n){return this._sheets[n]._sheetContent},_setJSSheetContent:function(n,t){this._sheets[t]._sheetContent=n},_getContent:function(n){return this._sheets[n]._content},_setContent:function(n,t){this._sheets[t]._content=n},getPager:function(){return this._spreadSheetPager},setPager:function(n){this._spreadSheetPager=n},getFooter:function(){return this._footer},setFooter:function(n){this._footer=n},getMainPanel:function(){return this._mainPanel},setMainPanel:function(n){this._mainPanel=n},getGroupPanel:function(){return this._groupPanel},setGroupPanel:function(n){this._groupPanel=n},getActivationPanel:function(){return this._activationPanel},setActivationPanel:function(n){this._activationPanel=n},getActiveSheetIndex:function(){return this.model.activeSheetIndex},setActiveSheetIndex:function(n){this.model.activeSheetIndex=n},getRows:function(n){return this._sheets[n]._Rows},setRows:function(n,t){this._sheets[t]._Rows=n},getFrozenRows:function(n){return this.getSheet(this._getSheetIndex(n)).frozenRows},setFrozenRows:function(n,t){this.model.isReadOnly||(this.getSheet(this._getSheetIndex(t)).frozenRows=n)},getFrozenColumns:function(n){return this.getSheet(n).frozenColumns},setFrozenColumns:function(n,t){this.model.isReadOnly||(this.getSheet(t).frozenColumns=n)},setFocusTopElem:function(n){this._focusTopElem=n},getFocusTopElem:function(){return this._focusTopElem},setFocusRightElem:function(n){this._focusRightElem=n},getFocusRightElem:function(){return this._focusRightElem},setFocusBottomElem:function(n){this._focusBottomElem=n},getFocusBottomElem:function(){return this._focusBottomElem},setFocusLeftElem:function(n){this._focusLeftElem=n},getFocusLeftElem:function(){return this._focusLeftElem},setAutoFillElem:function(n){this._autoFillElem=n},getAutoFillElem:function(){return this._autoFillElem},_setAutoFillOptElem:function(n){this._autoFillOptElem=n},_getAutoFillOptElem:function(){return this._autoFillOptElem},_getColWidth:function(n,t){return this.getSheet(t).columnsWidthCollection[n]},_getRowHeight:function(n,t){return this.getSheet(t).rowsHeightCollection[n]},setActiveCell:function(n,i,r){var f=this.getSheet(r?r:this.getActiveSheetIndex()),u;typeof n=="string"&&(u=this.getRangeIndices(n),n=u[0],i=u[1]);f._activeCell=t.isNullOrUndefined(n)&&t.isNullOrUndefined(i)?f._startCell:{rowIndex:n,colIndex:i}},getActiveCell:function(n){return this.getSheet(this._getSheetIndex(n))._activeCell},_setFormulaSuggElem:function(n){this._formulaSuggElem=n},_getFormulaSuggElem:function(){return this._formulaSuggElem},_setRowHdrTBody:function(n,t){this._sheets[t]._rowHdrTBody=n},_getRowHdrTBody:function(n){return this._sheets[n]._rowHdrTBody},_setContTBody:function(n,t){this._sheets[t]._contTBody=n},_getContTBody:function(n){return this._sheets[n]._contTBody},_init:function(){var n=this.model.importSettings,t;this._initBegin();this.model.allowImport&&(n.importUrl.length||n.importOnLoad)?this["import"]({url:n.importUrl,password:this._encrypt(n.password),allowSheetOnDemand:n.allowSheetOnDemand}):(this.showWaitingPopUp(),this._initBase(),this._initComplete());this._isAutoWHMode&&(t=this._getElementDimension(),this.element.css({height:t.height,width:t.width}))},_initBegin:function(){var r="touch-action",i=this.model.scrollSettings,f=i.width,e=i.height,u;t.support.stableSort=!1;this._isInitLoad=!0;this._isAutoWHMode=!i.allowScrolling;this._isAutoWHMode&&(i.isResponsive=!1,i.scrollMode="normal",i.allowVirtualScrolling=!1);this._minWidth=280;this._minHeight=200;this._isAutoWHMode||this.element.css({"min-height":this._minHeight,"min-width":this._minWidth,height:i.height,width:i.width});this._updateResponsiveSettings();this._isAutoWHMode||i.isResponsive||(i.width.toString().indexOf("%")>-1&&(i.width=this._responsiveWidth),i.height.toString().indexOf("%")>-1&&(i.height=this._responsiveHeight),this.element.css({height:i.height,width:i.width}));this._browserDetails=t.browserInfo();this.localizedLabels=t.getLocalizedConstants(this.sfType,this.model.locale);this.element.attr("tabindex",0);this._browserDetails.name==="msie"&&(r="-ms-"+r);this.element.css(r,"double-tap-zoom pinch-zoom");u=t.buildTag("div#"+this._id+"_wait","",{position:"absolute"});n(document.body).append(u);u.ejWaitingPopup({showOnInit:!1,target:this.element})},_initBase:function(){this._refreshModel(this.isImport?this._impData.model:null);this._initProps();this._initCSSTag();this._initLayout();this._wireEvents("_on");this._isInitLoad=!1;this.XLRibbon._renderNameManagerDlg()},_initProps:function(){var r=this.model,i=t.spreadsheetFeatures;this.XLClipboard=new i.clipboard(this);this.XLEdit=new i.editing(this);this.XLPrint=new i.print(this);this.XLRibbon=new i.ribbon(this);this.XLScroll=new i.scroller(this);r.allowDragAndDrop&&(this.XLDragDrop=new i.dragAndDrop(this));r.allowKeyboardNavigation&&(this.XLCellNav=new i.cellNavigation(this));r.allowFiltering&&(this.XLFilter=new i.filter(this));r.allowAutoFill&&(this.XLDragFill=new i.dragFill(this));(r.allowCellFormatting||r.allowFormatAsTable||r.allowFormatPainter)&&(this.XLFormat=new i.cellFormatting(this));r.allowCellFormatting&&(this.XLCellFrmtDlg=new i.formatCellDialog(this));r.allowConditionalFormats&&(this.XLCFormat=new i.cFormat(this));r.allowSearching&&(this.XLSearch=new i.findnreplace(this));r.allowCharts&&(this.XLChart=new i.chart(this));r.exportSettings.allowExporting&&(this.XLExport=new i.exporting(this));r.allowSorting&&(this.XLSort=new i.sorting(this));r.allowFreezing&&(this.XLFreeze=new i.freezepane(this));r.allowComments&&(this.XLComment=new i.comments(this));r.allowSelection&&(this.XLSelection=new i.selection(this));(r.allowCharts||r.pictureSettings.allowPictures)&&(this.XLShape=new i.shape(this));r.allowResizing&&(this.XLResize=new i.resizing(this));r.enableContextMenu&&(this.XLCMenu=new i.contextmenu(this));r.allowDataValidation&&(this.XLValidate=new i.validation(this));r.allowCellType&&(this.XLCellType=new i.cellType(this));r.enablePivotTable&&(this.XLPivot=new i.pivot(this));i.math&&n.extend(t.Spreadsheet.prototype,i.math);this._initPvtProps();this._initFATProps();this.model.customFormulas.length&&this._updateCustomFormulas(this.model.customFormulas,"add");this.model.nameManager.length&&this._refreshNameMngr(this.model.nameManager)},_initPvtProps:function(){var u=1,i={rowIndex:0,colIndex:0},r=this._getLocStr("AutoFillOptions").split("/"),e=this.getActiveSheetIndex(),f=t.preferredCulture(this.model.locale).numberFormat;for(this._dataContainer=this.isImport?n.extend(!0,{},this._impData.dataContainer):{sheets:{},sheetCellType:{},hashCode:[],sharedData:[],cellType:[],valData:[],cFormatData:[]},this._newSIndex=1,this.isImport=this.isImport||!1,this.mergeCenter=!1,this.isDirty=!1,this._calcID=CalcEngine.createSheetFamilyID(),this._calcEngine=new CalcEngine(this,this._calcID),this._calcEngine.setUseDependencies(!0),this._calcEngine.setExcelLikeComputations(!0),this._calcEngine.setUseDatesInCalculations(!0),this._calcEngine.setEnableFormulaErrorValidation(!0),this._calcEngine.setCalculatingSuspended(n("#"+this._id+"_CalcManual").find("span").hasClass("e-ss-calcauto")),this._sheets=[],this._cellProp=["value","value2","type","cFormatRule","range","thousandSeparator","rule","format","border","picture","chart","calcValue","align","hyperlink","formats","borders","tformats","tborders","isFilterHeader","filterState","tableName","comment","formatStr","decimalPlaces","cellType","isFilterHighlight","pivot"],this.isImport||(this.model.sheets.splice(0,0,{}),this._updateCellType());u<=this.model.sheetCount;)this.isImport||(this._dataContainer.sheets[u]={}),this._sheetSettings(u),this._newSIndex++,u++;this._detachTable=null;this._isPrint=!1;this._isSheetInsert=!1;this._isSheetRename=!1;this._isTableRename=!1;this._tableClassName=null;this._isSheetNavigate=!1;this._sheetCopy={isSheetCopy:!1,sheetContent:null};this._alertDialog={element:null,action:null};this._dataManager=null;this._isUndo=!1;this._undoCollection=[];this._redoCollection=[];this._ctrlKeyCount=0;this._formulaRange=[];this._formulaHeight=36;this._isSort=!1;this._isPaste=!1;this._isFATResize=!1;this._isDisplayHeader=!1;this._currencySymbol=f.currency.symbol||"$";this._percentSymbol=f.percent.symbol||"%";this._decimalSeparator=f["."]||".";this.operators={"<":function(n,t){return n<t},">":function(n,t){return n>t},">=":function(n,t){return n>=t},"<=":function(n,t){return n<=t},"==":function(n,t){return n===t},"!=":function(n,t){return n!==t},"!":function(n){return!n},"=":function(n){return n}};this.parse={parseInt:function(n){return parseInt(n)},parseFloat:function(n){return parseFloat(n)},parseDate:function(n){return new Date(n).getTime()},parseTime:function(n){return new Date("01/01/1990 "+n).getTime()},length:function(n){return n.charAt(0)==="^"?parseInt(n.split("^")[1]):n.length}};this._selMergeCells=[];this._mergeType="merge-cells";this._delCells=[];this._deletedText=[];this._removeMergeColl=[];this._insData={};this._deletedDimension=[];this._insDelStatus="";this._isUndoRedo=!1;this._indexBox=null;this._inputBox=null;this._focusTopElem=null;this._focusRightElem=null;this._focusBottomElem=null;this._focusLeftElem=null;this._dStartCell=i;this._dEndCell=i;this._pStartCell=i;this._pEndCell=i;this._pFillCell=i;this._borderFocus=["e-focusright","e-focusbottom"];this._cutFocus=["e-cutright","e-cutbottom"];this._autoFillFocus=["e-autofillright","e-autofillbottom"];this._formulaBorder=[["e-bborderright","e-bborderbottom"],["e-rborderright","e-rborderbottom"],["e-vborderright","e-vborderbottom"],["e-gborderright","e-gborderbottom"],["e-pborderright","e-pborderbottom"],["e-oborderright","e-oborderbottom"]];this._ctrlFormulaBorder=[["e-bctrlborderright","e-bctrlborderbottom"],["e-rctrlborderright","e-rctrlborderbottom"],["e-vctrlborderright","e-vctrlborderbottom"],["e-gctrlborderright","e-gctrlborderbottom"],["e-pctrlborderright","e-pctrlborderbottom"],["e-octrlborderright","e-octrlborderbottom"]];this._borderTypes=[{id:"bottomborder",text:this._getLocStr("BottomBorder"),parentId:null,sprite:"e-icon e-ss-bottomborder"},{id:"topborder",text:this._getLocStr("TopBorder"),parentId:null,sprite:"e-icon e-ss-topborder"},{id:"leftborder",text:this._getLocStr("LeftBorder"),parentId:null,sprite:"e-icon e-ss-leftborder"},{id:"rightborder",text:this._getLocStr("RightBorder"),parentId:null,sprite:"e-icon e-ss-rightborder"},{id:"noborder",text:this._getLocStr("NoBorder"),parentId:null,sprite:"e-icon e-ss-noborder"},{id:"allborder",text:this._getLocStr("AllBorder"),parentId:null,sprite:"e-icon e-ss-allborder"}];this._datePattern=["year","month","day","hours","minutes","seconds"];this._styleColl={};this._borderStyle="solid";this._borderColor="#000000";this._borderStyles=["solid","dashed","dotted"];this._ddlCell=null;this._cOpt={};this._shapeChange=!1;this._dupDetails=!1;this._paste=!1;this._autoFillElem=null;this._autoFillOptElem=null;this._fillOptionMenuData=[{id:"copycells",text:r[0],parentId:null,sprite:"e-icon e-ss-fillselect"},{id:"fillseries",text:r[1],parentId:null,sprite:"e-icon e-ss-filloption"},{id:"fillformattingonly",text:r[2],parentId:null,sprite:"e-icon e-ss-filloption"},{id:"fillwithoutformatting",text:r[3],parentId:null,sprite:"e-icon e-ss-filloption"},{id:"flashfill",text:r[4],parentId:null,sprite:"e-icon e-ss-filloption"}];this._formulaSuggElem=null;this._isFormulaSuggestion=!1;this._shiftKeyEnabled=!1;this._preventctrlkey=!1;this._rAlign="e-ralign";this._cAlign="e-calign";this._chartBorder=[["e-rcbright","e-rcbbottom"],["e-vcbright","e-vcbbottom"],["e-bcbright","e-bcbbottom"]];this._selectionBorder=["e-selecttop","e-selectright","e-selectbottom","e-selectleft"];this._autofillBorder=["e-autofilltop","e-autofillright","e-autofillbottom","e-autofillleft"];this._thinBorder=["e-thinright","e-thinbottom"];this._rcRegx=new RegExp("\\be-rc.*\\b","g");this._formatRegx=new RegExp("\\be-format.*?\\b","g");this._borderRegx=new RegExp("\\be-border.*?\\b","g");this._formulaChanged=[];this._ref=[];this._prevText="";this._prevVal="";this._dlgHLClick=!1;this._selectDataval={};this._undoInputobj={};this._cureditedCell="";this._colHeaderHeight=22;this._rowHeaderWidth=30;this._scrollerHeight=18;this._scrollerWidth=18;this._bufferCnt=5;this._maxRowCnt=1048576;this._maxColCnt=16384;this._impData=this._impData||null;this._isNew=!1;this._isSheetReq=!1;this._intrnlReq=!1;this._isFilterApplied=!1;this._commentCount=0;this._tableCnt=1;this._uploadImage=!1;this._responsiveWidth=0;this._responsiveHeight=0;this._celltypes=[];this._reqCnt=0;this._resCnt=0;this._pageClickArgs=null;this._gotoPageArgs=null;this._updateFormulaCollection();this._isRibbonClick=!1;this._intrnlUpdate=!1;this._isPvtNameEdit=!1;this._hlColor="#428bca";this._isFilter=!1;this._isShowHide=!1;this._insRows={};this._isTotalRow=!1;this._scrollReverse=!1;this._phoneMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth<420;this._tabMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth>419&&document.documentElement.clientWidth<617;this._dlgHeight=this._responsiveHeight-2;this._dlgWidth=this._responsiveWidth-2;this._isTouchEvt=!1;this._isTouchMoveSel=!1;this._isTouchScroll=!1;this._startXY=null;this._touchArgs=null;this._isResized=!1;this._isRibbonDestroyed=!1;this._resizeColl=[];this._delWrapColl={};this._fRowHtColl={};this._isInsdel=!1;this._canOverflow=!0;this.preventFilterPopup=!1;this._FATStyles={};this._isFiltered=!1;this._dautoFillCell={rowIndex:0,colIndex:0};this._isPublic=!1;this._fRow={rowAdj:!0,fRowCnt:0};this._fCol={colAdj:!0,fColCnt:0};this.isPasteValuesOnly=!1;this._isSaveAsJSON=!1},_initFATProps:function(){var o,g,t="w:bold",i="c:#FFFFFF",n="c:#000000",l="c:#2F75B5",a="c:#ED7D31",v="c:#FFC000",r="1px solid #000000",u="1px solid #2f75b5",f="1px solid #ED7D31",e="1px solid #FFC000",y="b:#D9D9D9",s="b:#DDEBF7",p="b:#FCE4D6",w="b:#FFF2CC",nt="b:#000000",tt="b:#FFE2C6",it="b:#FFF1BF",h="b:#000000",rt="b:#D7D7D7",b="b:#FFC000",k="b:#5B9BD5",ut="b:#Ed7D31",d="hl?"+t+";"+n+";bo:tb-"+r+"&cl?"+y+";"+n+","+n+"&cb?b-"+r+"/hl?"+t+";bo:tb-"+u+";"+l+"&cl?"+s+";"+l+","+l+"&cb?b-"+u+"/hl?"+t+";bo:tb-"+f+";"+a+"&cl?"+p+";"+a+","+a+"&cb?b-"+f+"/hl?"+t+";bo:tb-"+e+";"+v+"&cl?"+w+";"+v+","+v+"&cb?b-"+e+"/hl?"+t+";"+nt+";"+i+";bo:o-"+r+"&cl?bo:t-"+r+";"+n+"&cb?o-"+r+"/hl?bo:o-"+u+";"+t+";"+k+";"+i+"&cl?bo:t-"+u+";"+n+"&cb?o-"+u+"/hl?"+t+";b:#EB7E2F;"+i+";bo:o-"+f+"&cl?bo:t-"+f+";"+n+"&cb?o-"+f+"/hl?"+t+";"+b+";"+i+";bo:o-"+e+"&cl?bo:t-"+e+";"+n+"&cb?o-"+e+"/hl?"+t+";bo:gb-"+r+";"+n+"&cl?"+y+";"+n+","+n+"&cb?gb-"+r+"/hl?"+t+";bo:gb-"+u+";"+n+"&cl?"+s+";"+n+","+n+"&cb?gb-"+u+"/hl?"+t+";bo:gb-"+f+";"+n+"&cl?"+p+";"+n+","+n+"&cb?gb-"+f+"/hl?"+t+";bo:gb-"+e+";"+n+"&cl?"+w+";"+n+","+n+"&cb?gb-"+e+"/hl?"+t+";"+nt+";"+i+"&cl?b:#A6A6A6;"+n+","+y+";"+n+"/hl?"+t+";"+k+";"+i+"&cl?b:#BDD7EE;"+n+","+s+";"+n+"/hl?"+t+";"+ut+";"+i+"&cl?b:#F8CBAD;"+n+","+p+";"+n+"/hl?"+t+";"+b+";"+i+"&cl?b:#FFE699;"+n+","+w+";"+n+"/hl?"+t+";"+rt+";"+n+";bo:gb-"+r+"&cl?b:#A7A7A7;"+n+","+rt+";"+n+"&cb?gb-"+r+"/hl?"+t+";b:#DBECF6;"+n+";bo:gb-"+u+"&cl?b:#BED8F1;"+n+","+s+";"+n+"&cb?gb-"+u+"/hl?"+t+";"+tt+";"+n+";bo:gb-"+f+"&cl?b:#F6CAAD;"+n+","+tt+";"+n+"&cb?gb-"+f+"/hl?"+t+";"+it+";"+n+";bo:gb-"+e+"&cl?b:#FDE18D;"+n+","+it+";"+n+"&cb?gb-"+e+"/hl?"+t+";"+h+";"+i+"&cl?b:#404040;"+i+",b:#737373;"+i+"/hl?"+t+";"+h+";"+i+"&cl?b:#2F75B5;"+i+","+k+";"+i+"/hl?"+t+";"+h+";"+i+"&cl?b:#C65911;"+i+","+ut+";"+i+"/hl?"+t+";"+h+";"+i+"&cl?b:#BF8F00;"+i+","+b+";"+i,c=["Light1","Light2","Light3","Light5","Light8","Light9","Light10","Light12","Light15","Light16","Light17","Light19","Medium8","Medium9","Medium10","Medium12","Medium22","Medium23","Medium24","Medium26","Dark1","Dark2","Dark3","Dark5"];for(d=d.split("/"),o=0,g=c.length;o<g;)this._FATStyles["TableStyle"+c[o]]={format:this.XLRibbon._getFormatAsTableInput(d[o]),formatName:"TableStyle"+c[o]},o++;this.XLFormat._formatAsTableStyle=this._FATStyles["TableStyle"+c[0]]},_updateResponsiveSettings:function(){var i=t.browserInfo().name==="msie"&&t.browserInfo().version==="8.0",n=this.element[0].getClientRects()[0];this._responsiveHeight=Math.floor(i?this.element[0].offsetHeight:n?n.height:0);this._responsiveWidth=Math.floor(i?this.element[0].offsetWidth:n?n.width:0)},_getElementDimension:function(){var f=0,t,e=0,o=0,i,r,u;return this.model.showRibbon&&(i=n("#"+this._id+"_Ribbon").data("ejRibbon"),t=i.element[0].offsetWidth,f=i.element[0].offsetHeight),this.model.allowFormulaBar&&(r=n("#"+this._id+"_formulabar")[0],e=r.offsetHeight,t||(t=r.offsetWidth)),u=this.element.find(".e-spreadsheetmainpanel")[0],o=u.offsetHeight,t||(t=u.offsetWidth),{width:t+2,height:f+e+o+1}},_sheetSettings:function(i){var o,f,u,s,c,r,e,l,h;if(this._isSheetReq?f=this.getSheet(i):(r=this.getSheet(i),c=this._generateSheetName(this._newSIndex),f=this.model.sheets[i]={colCount:r&&r.colCount||this.model.columnCount,rowCount:r&&r.rowCount||this.model.rowCount,_formulaCollection:{},columnsWidthCollection:[],_colWidthCollection:[],_ofColWidthColl:[],rowsHeightCollection:[],_rowHeightCollection:[],_rowIdxColl:[],_spreadSheetPager:null,showHeadings:r&&!this.isUndefined(r.showHeadings)?r.showHeadings:!0,showGridlines:r&&!this.isUndefined(r.showGridlines)?r.showGridlines:!0,dataSource:r&&r.dataSource||null,_jsonData:r?r.dataSource instanceof t.DataManager?null:r.dataSource:null,_dataManager:r&&r.dataSource instanceof t.DataManager?r.dataSource:null,query:r&&r.query||null,primaryKey:r&&r.primaryKey||"",startCell:r&&r.startCell||"A1",topLeftCell:r&&r.topLeftCell||"A1",fieldAsColumnHeader:r&&r.fieldAsColumnHeader||!1,showHeader:r&&r.showHeader===!1?!1:!0,headerStyles:r&&r.headerStyles||null,batchChanges:{added:[],changed:[],deleted:[]},range:[0,0,0,0],fields:[],_isDataManager:!1,_isOffline:!1,_hasDataSrc:!1,columns:r&&r.columns||[],_columnStyles:{},_rowStyles:{},cellTypes:r&&r.cellTypes||[],rows:r&&r.rows||null,_excelFilter:null,filterSettings:{filteredColumns:[],maxFilterChoices:1e3,filteredRange:[],range:"",tableRange:[]},frozenRows:r&&r.frozenRows||0,frozenColumns:r&&r.frozenColumns||0,_frozenRows:r&&r.frozenRows&&r.frozenRows+1||1,_frozenColumns:r&&r.frozenColumns&&r.frozenColumns+1||1,paneTopLeftCell:r&&r.paneTopLeftCell||"A1",_selectedRange:{},_selectedCellColors:[],columnWidth:r&&r.columnWidth||this.model.columnWidth,rowHeight:this.model.rowHeight,_frozenHeight:0,_frozenWidth:0,_firstRow:{idx:0,value:0},_firstCol:{idx:0,value:0},_topRow:{idx:0,value:0},_bottomRow:{idx:0,value:0},_leftCol:{idx:0,value:0},_rightCol:{idx:0,value:0},_filterColl:{},_filteredColumns:[],_commentColl:{},_mergeColl:{},_unmergeColl:{},_delmergeColl:{},_hideMergeColl:{},_clrMergeColl:[],_clrWrapColl:[],_selectedCells:[],selectedRange:[0,0,0,0],tableManager:{},_header:{},_selectedCellIndexes:[],_startCell:{rowIndex:0,colIndex:0},_endCell:{rowIndex:0,colIndex:0},_activeCell:{rowIndex:0,colIndex:0},_autoFillCell:{rowIndex:0,colIndex:0},rangeSettings:r&&r.rangeSettings||[],sheetInfo:{text:c,value:this._getLocStr("Sheet")+this._newSIndex,isVisible:!0},_multipleFiltering:!1,_multifilterIdx:[],_filteredByColor:"",staticWidth:0,_fRow:0,_fCol:0,hideColsCollection:{},hideRowsCollection:r&&r.hideRowsCollection||[],_hiddenFreezeRows:[],_hiddenFreezeCols:[],_filterHRowsColl:[],_restrictedHeightRows:[],filteredRowsCollection:[],_rHeightCollection:[],_frHiddenHeight:0,_fpHiddenHeight:0,_fpHiddenWidth:0,_pTarget:{},_cSpan:1,_rSpan:1,usedRange:{rowIndex:0,colIndex:0},mergedCells:[],shapeMngr:{picture:{},chart:{},sharedPics:[]},pivotMngr:{pivot:{}},_nmValue:{},_nmEdit:!1,_wrapHtCollection:{},_isChartBorderDrawn:!1,_virtualBlockCnt:0,_virtualBlockRowCnt:0,_virtualContBlockIdx:1,_virtualTopTBodyHgt:0,_virtualBottomTBodyHgt:0,_virtualTBodyHgt:0,_scrollTop:0,_scrollLeft:0,_virtualRowIdx:[],_virtualTopTBodyOffset:{top:0,bottom:0},_virtualContTBodyOffset:{top:0,bottom:0},_virtualBottomTBodyOffset:{top:0,bottom:0},_virtualDataLoadedBlks:[],_virtualDataMngrLoadedBlks:[1,2],_isVirtualTopReached:!0,_isVirtualEndReached:!1,_isLoaded:!1,_isImpSLoad:!1,_isRowSelected:!1,_isColSelected:!1,_isSheetSelected:!1,isSheetProtected:!1,_contWidth:0,_isRangeSelected:!1,_isEmptyActiveCell:!1,_isMultiSelect:!1,_isImported:this.isImport,_isRequested:!1,_goToCollection:{multiple:!1,selected:[]},_showLockCellAlert:!1,_reqCnt:0,_resCnt:0,_templateColCount:0,_isTemplate:!1,_cFormatFormula:{},_isVPRendered:!1,_isDataMoved:!1,_vPortHgt:0,_vPortWth:0,cFormatRule:r&&r.cFormatRule||[],mergeCells:r&&r.mergeCells||[],hideRows:r&&r.hideRows||[],hideColumns:r&&r.hideColumns||[],border:r&&r.border||[],isResized:!1,_isOpened:!1,_wrapColl:{},_isFreezed:!1,_ftopRowIdx:0,_fleftColIdx:0,_contScrollTop:0,_contScrollLeft:0,_fDivTop:0,_fDivLeft:0,_isRibCollapsed:!1},this._initRangeSettings(i),s=f.sheetInfo.value,psheet=this._sheets[i]={_contentColGroup:null,_content:null,_sheetRowHeaderContent:null,_sheetHeader:null,_sheetRowHeader:null,_sheetContent:null,_Rows:null,_contTBody:null,_rowHdrTBody:null},this._calcEngine.registerGridAsSheet(s,s,this._calcID)),this.isImport&&(u=this._impData.model.sheets[i],o=this.getRangeIndices(u.topLeftCell||"A1"),f.sheetInfo.text=u.sheetInfo.text,f.sheetInfo.isVisible=this.isUndefined(u.sheetInfo.isVisible)?!0:u.sheetInfo.isVisible,this.model.importSettings.allowSheetOnDemand&&i!==this.getActiveSheetIndex()||(f._isRequested=!0),f._isRequested)){if(u.usedRange&&(u.usedRange.rowIndex&&(f.usedRange.rowIndex=u.usedRange.rowIndex),u.usedRange.colIndex&&(f.usedRange.colIndex=u.usedRange.colIndex)),u._startCell&&(u._startCell.rowIndex&&(f._startCell.rowIndex=u._startCell.rowIndex),u._startCell.colIndex&&(f._startCell.colIndex=u._startCell.colIndex)),u._endCell&&(u._endCell.rowIndex&&(f._endCell.rowIndex=u._endCell.rowIndex),u._endCell.colIndex&&(f._endCell.colIndex=u._endCell.colIndex)),u._activeCell&&(u._activeCell.rowIndex&&(f._activeCell.rowIndex=u._activeCell.rowIndex),u._activeCell.colIndex&&(f._activeCell.colIndex=u._activeCell.colIndex)),u.columnsWidthCollection&&(f.columnsWidthCollection=u.columnsWidthCollection),u.rowsHeightCollection){for(h=u.hideRowsCollection||[],e=0,l=h.length;e<l;e++)u.rowsHeightCollection[parseInt(h[e])]=0;f.rowsHeightCollection=n.extend(!0,[],u.rowsHeightCollection)}t.isNullOrUndefined(u.showGridlines)||(f.showGridlines=u.showGridlines);u.hideRowsCollection&&(f.hideRowsCollection=u.hideRowsCollection||[]);u.shapeMngr.picture.length&&(f.shapeMngr.sharedPics=u.shapeMngr.sharedPics);u.isSheetProtected&&(f.isSheetProtected=u.isSheetProtected);u._restrictedHeightRows&&(f._restrictedHeightRows=u._restrictedHeightRows||[]);u._isColSelected&&(f._isColSelected=u._isColSelected);u._isRowSelected&&(f._isRowSelected=u._isRowSelected);u.showHeadings===!1&&(f.showHeadings=!1);u.frozenRows&&(f.frozenRows=f._frozenRows=o[0]+u.frozenRows,f._frozenRows=f.frozenRows+1);u.frozenColumns&&(f.frozenColumns=f._frozenColumns=o[1]+u.frozenColumns,f._frozenColumns=f.frozenColumns+1)}},_generateSheetName:function(n){var t,f,r,o=1,u=this.model.sheets,e=this._getLocStr("Sheet"),i=u[n];for(r=i&&i.sheetName||e+n,t=1,f=u.length;t<f;t++)u[t].sheetInfo&&r===u[t].sheetInfo.text&&(t=0,r=i&&i.sheetName?i.sheetName+o++:e+ ++n);return r},_initRangeSettings:function(n){var i,u=this.getSheet(n),r=u.rangeSettings.length;if(r)while(r--)i=u.rangeSettings[r],i.dataSource&&(i._jsonData=i._dataManager=null,i.dataSource instanceof t.DataManager?i._dataManager=i.dataSource:i._jsonData=i.dataSource,i.showHeader!=!1&&(i.showHeader=!0))},_initCSSTag:function(){if(!document.getElementById(this._id+"_sscustomformat")){this.isImport&&(this._dataContainer.hashCode=[]);var n,r,i=0,t;if(t=this._renderStyleTag("custom"),this.isImport)this._refreshImpStyles(this._impData.dataContainer.hashCode);else if(this.XLFormat)for(n="s:11pt/b:#FFC7CE;c:#82012A;f:calibri;s:11pt/b:#C6EED2;c:#0A7043;f:calibri;s:11pt/b:#FEEC9B;c:#826717;f:calibri;s:11pt/f:Calibri;w:bold;v:top;s:11pt/f:calibri;s:18pt/b:#DDE5F6;f:calibri;s:11pt/b:#FDE0D2;f:calibri;s:11pt/b:#EEEEEC;f:calibri;s:11pt/b:#FEF4CD;f:calibri;s:11pt/b:#9CC0E7;f:calibri;s:11pt/b:#F9AD7B;f:calibri;s:11pt/b:#C9C9C9;f:calibri;s:11pt/b:#FED965;f:calibri;s:11pt/b:#559AD9;c:#FFFFFF;f:calibri;s:11pt/b:#EB7E2F;c:#FFFFFF;f:calibri;s:11pt/b:#A5A5A5;c:#FFFFFF;f:calibri;s:11pt/b:#FDBF01;c:#FFFFFF;f:calibri;s:11pt".split("/"),r=n.length;i<r;)this.XLFormat._createFormatClass(this._getStyleAsJSON(n[i]),null,!0),i++;n=".e-spreadsheet .e-hide, .e-spreadsheet .e-mc-hide, .e-spreadsheet .e-fr-hide, .e-spreadsheet .e-fc-hide, .e-spreadsheet .e-c-hide, .e-spreadsheet .e-r-hide, .e-spreadsheet .e-col-hide{ display: none}";n+=".e-spreadsheet .e-rowcell.e-redft { background-color: #FFC7CE; color: #9C0055;} .e-spreadsheet .e-rowcell.e-yellowft { background-color: #FFEB9C; color: #9C6500;}";n+=".e-spreadsheet .e-rowcell.e-greenft { background-color: #C6EFCE; color: #006100;} .e-spreadsheet .e-rowcell.e-redf { background-color: #FFC7CE;} .e-spreadsheet .e-rowcell.e-redt { color: #9C0055;}";n+=".e-spreadsheet .e-rowcell.e-hlcell { background-color: #FFFF00; color: #FF0000;} .e-spreadsheet .e-rowcell.e-goto-blank { background-color: #C6C6C6;}";t.styleSheet?t.styleSheet.cssText+=n:t.appendChild(document.createTextNode(n))}this._renderStyleTag("showhide")},_initEditForm:function(){var n,i,r;n=t.buildTag("input","",{display:"none"},{id:this._id+"_AutoComplete"});n.addClass("e-hide");this.element.append(n);this.XLEdit._renderAutoComplete(n,"",null,!0);n.data("ejAutocomplete")._setListPosition=function(){};i=t.buildTag("form","",{width:1,height:1,display:"none"},{id:this._id+"EditForm"});r=t.buildTag("input","",{width:1,height:1,overflow:"hidden",opacity:0},{id:this._id+"_ValElem"});i.append(r);r.data("id",this._id);this.element.append(i)},_getStyleAsJSON:function(n){var t,i=0,r={},u={b:"background-color",c:"color",f:"font-family",s:"font-size",w:"font-weight",v:"vetical-align",bo:"border"};for(n=n.split(";"),len=n.length;i<len;)t=n[i].split(":"),r[u[t[0]]]=t[0]==="bo"?this.XLRibbon._getBorderObj(t[1].split("-")[0],t[1].split("-")[1]):t[1],i++;return r},_initLayout:function(){this.model.showRibbon&&(this.XLRibbon._renderRibbon(),this._tabMode&&n("#"+this._id+"_Ribbon").ejRibbon("collapse"));this.model.allowFormulaBar&&this._renderFormulaBar();this._renderFUpload();this._renderLayout()},_renderLayout:function(){var n,t;for(this._renderPanel(),this._initTags(),this._initDependencies(),this._renderFooter(),this._refreshSheetLayout(),this.model.scrollSettings.allowVirtualScrolling||this.model.scrollSettings.allowSheetOnDemand?n=t=this.getActiveSheetIndex():(n=1,t=this.model.sheetCount);n<=t;)this._initSheet(n),n++},_renderPanel:function(){var i,n,r=this.model.scrollSettings;i=t.buildTag("div.e-spreadsheetgrppanel","",{},{id:this._id+"GroupPanel"});this.setGroupPanel(i);n=t.buildTag("div.e-spreadsheetmainpanel",this._renderDIV("e-spreadsheet-list",""),{},{id:this._id+"MainPanel"});i.append(n);this.setMainPanel(n);n=t.buildTag("div.e-spreadsheetactpanel","",{height:r.height,width:this.model.activationPanelWidth-1,display:"none"},{id:this._id+"ActivationPanel"});i.append(n);this.setActivationPanel(n);this.element.append(i)},_refreshSheetLayout:function(){var t,i=-1,r=this.model.pageSettings.pagerHeight+1;this._updateResponsiveSettings();this.XLRibbon._ribbonState&&(i=n("#"+this._id+"_Ribbon").find(".e-content:eq(1)").height());t=this._phoneMode?n("#"+this._id+"_Ribbon").height():n("#"+this._id+"_Ribbon").find(".e-header").height()+i+2;formulaHeight=this.model.allowFormulaBar?this._formulaHeight:0;ribbonHeight=t&&this.model.showRibbon&&n("#"+this._id+"_Ribbon").is(":visible")?t:0;this.model.showPager&&this.element.find(".e-spreadsheetfooter").is(":visible")||(r=1);contentHt=this._responsiveHeight-(ribbonHeight+formulaHeight+2);this._browserDetails.name=="msie"||this._isAutoWHMode||this.element.find(".e-spreadsheet-list").height(contentHt-r)},_initTags:function(){var n=t.buildTag("span#"+this._id+"_emptySpan"),i=t.buildTag("div#"+this._id+"_emptyDiv");this.element.find(".e-spreadsheetmainpanel")[0].insertBefore(n[0],this.element.find(".e-spreadsheetmainpanel").find(".e-spreadsheet-list")[0]);this.element.find(".e-spreadsheetmainpanel")[0].insertBefore(i[0],this.element.find(".e-spreadsheetmainpanel").find(".e-spreadsheet-list")[0]);this._refreshGlobalSpan()},_refreshGlobalSpan:function(t,i){t=t||document.getElementById(this._id+(i?"_emptyDiv":"_emptySpan"));t.textContent=t.className="";this._browserDetails.name==="msie"&&this._browserDetails.version==="8.0"?n(t).removeAttr("style").text(""):t.style=""},_initSheet:function(n){var u,t=0,i=this.getSheet(n),r=this.getDataSettings(n);if(this._updateResponsiveSettings(),this._initViewPort(n),r&&!this._sheetCopy.isSheetCopy)for(u=r.length;t<u;)this._initDataSrc(n,i,r[t]),t++;i._reqCnt===i._resCnt&&this._renderSheet(n)},_initViewPort:function(t){var r=-1,u=ribbonHgt=scrollerHgt=scrollerWth=colHdrHgt=rowHdrWth=formulaHgt=0,f=this.model.scrollSettings,i=this.getSheet(t);f.allowScrolling&&(scrollerHgt=this._scrollerHeight,scrollerWth=this._scrollerWidth);i.showHeadings&&(colHdrHgt=this._colHeaderHeight,rowHdrWth=this._rowHeaderWidth);this.model.showRibbon&&(ribbonHgt=n("#"+this._id+"_Ribbon").height(),ribbonHgt=ribbonHgt<189?ribbonHgt:188);this.model.allowFormulaBar&&(formulaHgt=this._formulaHeight);this.model.showPager&&this.element.find(".e-spreadsheetfooter").is(":visible")&&(r=this.model.pageSettings.pagerHeight);this.getActivationPanel().is(":visible")&&(u=this.getActivationPanel().width());i._vPortHgt=this._responsiveHeight-(ribbonHgt+formulaHgt+colHdrHgt+r+scrollerHgt);i._vPortWth=this._responsiveWidth-(u+scrollerWth+rowHdrWth);f.allowVirtualScrolling&&(i._virtualBlockRowCnt=Math.ceil(i._vPortHgt/i.rowHeight)+this._bufferCnt)},_initDataSrc:function(n,i,r){if(r._dataManager){if(r._dataManager instanceof t.DataManager)if(r._dataManager.ready){var u=this;i._reqCnt++;this._reqCnt++;r._dataManager.ready.done(function(){u._initDataMngr(n,i,r)})}else this._initDataMngr(n,i,r)}else r._jsonData&&(r.count=r._jsonData.length)},_initDataMngr:function(n,i,r){var u,f,h,s,c,e,o=0,l=this;if(r._isDataManager=!0,r._isOffline=r._dataManager.dataSource.offline,r.query||(r.query=new t.Query),r.query.requiresCount(),this.model.scrollSettings.allowVirtualScrolling){if(s=r.query.queries,u=s.length,u)while(u--)f=s[u],f.fn==="onTake"?(o=f.e.nos,s.splice(u,1)):f.fn==="onSkip"&&(r._skip=f.e.nos);e=i._virtualBlockRowCnt*2;r.startCell&&(h=this.getRangeIndices(r.startCell),h[0]&&(e-=h[0]-0));o&&o<e&&(e=o);r.query.take(e)}c=r._dataManager.executeQuery(r.query);c.done(function(t){u=t.count||t.result.length;u&&(r._jsonData=t.result,r.count=o||u);l._respHandler(n)});c.fail(function(){l._respHandler(n)});r._dataManager.isDataAvailable||(i._reqCnt++,this._reqCnt++)},_respHandler:function(n){var t=this.getSheet(n);t._resCnt++;this._resCnt++;t._reqCnt===t._resCnt&&this._renderSheet(n);this._initComplete()},_renderSheet:function(i){var u,e,c,o,f=this.getActiveSheetIndex(),r=this.getSheet(i),l=r.sheetInfo.value,s={},h=this.element.find("#"+this._id+"_"+l);this._resizeColl[i-1]=!1;this._isInitLoad&&this._trigger("load",{sheetIndex:i});this._initTmplColumns(i);u=h.length===1?h:t.buildTag("div.e-sheet e-hide ","",{},{id:this._id+"_"+l});u.append(this._renderContent(i));h.length||(this.model.allowFreezing&&(o=this.XLFreeze._getHFreeze()),o?o.before(u):this.element.find(".e-spreadsheet-list").append(u));r.showGridlines===!1&&n("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").ejCheckBox({checked:r.showGridlines});this.model.enableContextMenu&&(this.XLCMenu._initContextMenu(),this.XLCMenu._initColorDialog(),this.XLCMenu._initCMenuFooter());this._updateResponsiveSettings();this._removeClass(u,"e-hide");s.width=this._responsiveWidth;s.height=this._responsiveHeight;this.model.showRibbon&&!this._isAutoWHMode&&(this._tabMode||this._responsiveHeight<280)&&n("#"+this._id+"_Ribbon").ejRibbon("collapse");this._setSheetWidthHeight(i,s,null,"refresh","initial");this._refreshCellBinding(i);this._refreshImpResRowHght(i);this.refreshContent(i);i===f&&this._updateHiddenRows(f);this._initializePicture(i);this.isImport&&this.model.allowCellType&&this.model.allowAutoCellType&&this._celltypes.length&&this._processCellTypes(this._celltypes,i);this.model.allowCellType&&!this.model.scrollSettings.allowVirtualScrolling&&this.XLCellType._rangeCellTypes(r.cellTypes,i);r._isImported&&!this._sheetCopy.isSheetCopy&&(this.setActiveSheetIndex(i),this._refreshImpSheets(i),this.setActiveSheetIndex(f));i!==f?u.hide():this._initSelection();this._initSheetModel(i);this.isImport&&r._isFreezed&&(c=this._impData.model.sheets[i],e=this.getRangeIndices(c.paneTopLeftCell),this._isFrozen(r.frozenRows)&&this.XLScroll._vScroller(i).scroll(this._getRowOffsetTop(r,e[0])-r._frozenHeight),this._isFrozen(r.frozenColumns)&&this.XLScroll._hScroller(i).scroll(this._getColOffsetLeft(r,e[1])-r._frozenWidth));r._isLoaded=!0;!this._isSheetInsert&&(this._pageClickArgs||this._gotoPageArgs)&&this._pageLoadComplete(i);this.getSheet(f)._isOpened=!0;this.model.showRibbon&&(n("#"+this._id+"_Ribbon")[0].style.overflow==="hidden"&&(n("#"+this._id+"_Ribbon")[0].style.overflow="",this.model.showRibbon&&this.XLRibbon._refreshBackstageHeight()),r._isRibCollapsed=!this.XLRibbon._ribbonState);this._isAutoWHMode&&this._autoSSWidthHeight(i)},_initSheetModel:function(n){var u,f,e,o,r=this.getSheet(n),t=this.getFrozenRows(n),i=this.getFrozenColumns(n);r.showHeadings===!1&&this.showHeadings(r.showHeadings);this.isImport&&(o=this._impData.model.sheets[n],u=this.getRangeIndices(o.topLeftCell||"A1"));f=this.isImport?u[0]:this._isFrozen(t)&&r._bottomRow.idx<=t?t-1:0;e=this.isImport?u[1]:this._isFrozen(i)&&r._rightCol.idx<=i?i-1:0;this.model.scrollSettings.allowScrolling&&(f>0&&this.XLScroll._vScroller(n).scroll(this._getRowOffsetTop(r,f)),e>0&&this.XLScroll._hScroller(n).scroll(this._getColOffsetLeft(r,e)));this.model.allowFreezing&&(this._isFrozen(t)&&this._isFrozen(i)?this.XLFreeze.freezePanes(t,i):this._isFrozen(t)?this.XLFreeze._freeze(t):this._isFrozen(i)&&this.XLFreeze._freeze(null,i))},_initTmplColumns:function(n){var u,f,i,r,t=this.getSheet(n);if(!this._sheetCopy.isSheetCopy&&!t.rangeSettings.length&&t.dataSource&&t._jsonData&&t.fieldAsColumnHeader&&(r=t._jsonData[0],range=this.getRangeIndices(t.startCell),u=range[1]+1,r)){for(i in r)r.hasOwnProperty(i)&&(f=r[i],typeof r[i]=="object"&&(i=this._iterateComplxObj(r[i],i).prop),t.columns[u-1]={field:this._generateHeaderText(u),text:i,type:f!=null?f.getDay?"date":typeof f:null},u++);t.colCount=t._templateColCount=t.columns.length;t._isTemplate=!0}},_refreshCellBinding:function(n){var t,r,f,l=this.getSheet(n),e=l.mergeCells,o=l.hideRows,u,i,s,h,c;if(e.length)for(u=0,f=e.length;u<f;u++)for(i=this.getRangeIndices(e[u]),s=i[2]-i[0]+1,h=i[3]-i[1]+1,c,t=0;t<s;t++)for(r=0;r<h;r++)c=t==0&&r==0?{merge:{isMerge:!0,mRange:e[u],isCenterAlign:!1,mSpan:{colSpan:h,rowSpan:s}}}:{isMHide:!0,mergeIdx:{rowIndex:i[0],colIndex:i[1]}},this.XLEdit._updateDataContainer({rowIndex:i[0]+t,colIndex:i[1]+r},{dataObj:c,sheetIdx:n,skipCell:!0});if(o.length&&this.model.scrollSettings.allowVirtualScrolling)for(t=0,f=o.length;t<f;t++)this._cellBindHiddenRows(o[t],o,n)},_cellBindHiddenRows:function(n,t,i){var r,u,e=this.getSheet(i),f=this.XLEdit;e.hideRowsCollection.push(n);this.XLScroll._getRowHeights(i,t.sort()[0]);u=n===0?{rowIndex:n,colIndex:0}:{rowIndex:n-1,colIndex:0};r={rowIndex:n,colIndex:0};f._updateDataContainer(u,{dataObj:{hRow:!0},sheetIdx:i,skipCell:!0});f._updateDataContainer(r,{dataObj:{isRHide:!0},sheetIdx:i,skipCell:!0})},_updateHiddenRows:function(n){var i,r,h,u=this.getSheet(n),s=u.hideRows,f,l=u.cFormatRule,e,o=u.hideColumns,c=u.border;if(s.length&&!this.model.scrollSettings.allowVirtualScrolling)for(i=0,r=s.length;i<r;i++)f=s[i],h=this.getRows(n),rows=h[1],hdrRows=h[0],this.addClass(rows[f],"e-r-hide"),this.addClass(hdrRows[f],"e-r-hide"),f>0&&this.addClass(hdrRows.eq(f-1).find("td")[0],"e-hrow"),this._cellBindHiddenRows(f,s,n);if(o.length&&!this.model.scrollSettings.allowVirtualScrolling){for(i=0,r=o.length;i<r;i++)u.hideColsCollection[o[i]]||this._updateHiddenColumns({rowIndex:0,colIndex:o[i]},n);this.XLScroll._getColWidths(n,o.sort()[0])}if(!t.isNullOrUndefined(l)&&l.length)for(i=0,r=u.cFormatRule.length;i<r;i++)e=u.cFormatRule[i],this.XLCFormat._cFormat(e.action,e.inputs[0],e.inputs[1],e.color,e.range,n);if(c.length&&!this.model.scrollSettings.allowVirtualScrolling)for(i=0,r=c.length;i<r;i++)this._updateCellBorder(c[i],n)},_updateHiddenColumns:function(n,t){var h=n.rowIndex,i=n.colIndex,u=this.getSheet(t),f={isCHide:!0},r=this._getJSSheetHeader(t),e=r.find("th"),o=r.find("col"),s=this._getContent(t).find("col");u.hideColsCollection[i]=u.columnWidth;u.columnsWidthCollection[i]=0;i===0&&(f.hCol=!0);this._writeRule(i,t);this.addClass(e[i],"e-hide");this.addClass(o[i],"e-hide");this.addClass(s[i],"e-hide");r.find("th:eq("+(i-1)+")").hasClass("e-hide")||this.addClass(r.find("th:eq("+(i-1)+")")[0],"e-hcol");this.XLEdit._updateDataContainer({rowIndex:0,colIndex:i},{dataObj:f,sheetIdx:t,skipCell:!0});i>0&&this.isUndefined(this.XLEdit.getPropertyValue(0,i-1,"isCHide"))&&this.XLEdit._updateDataContainer({rowIndex:0,colIndex:i-1},{dataObj:{hCol:!0},sheetIdx:t,skipCell:!0})},_renderContent:function(n){var r=[],i=t.buildTag("div.e-spreadsheetheader"),o=t.buildTag("div.e-headercontent"),h=t.buildTag("div.e-spreadsheetcolumnheader e-icon e-ss-selectall e-ss-cursor","",{},{}),u=t.buildTag("div.e-spreadsheetcontentcontainer","",{"-webkit-tap-highlight-color":"rgba(0,0,0,0)"}),s=t.buildTag("div.e-content e-ss-cursor"),f=t.buildTag("div.e-spreadsheetrowheader","",{float:"left",width:"30px"},{}),e=t.buildTag("div.e-rowheadercontent");return this._isAutoWHMode&&(s.addClass("e-rmvbtmbdr"),o.addClass("e-rmvrghtbdr"),e.addClass("e-rmvbtmbdr")),this._setJSSheetHeader(i,n),i.append(h),i.append(o),r.push(i),i=t.buildTag("div.e-spreadsheetcontent"),this._setJSSheetContent(i,n),this._setContent(u,n),this._setJSSheetRowHeader(f,n),this._setJSSheetRowHeaderContent(e,n),f.append(e),u.append(s),i.append(f),i.append(u),r.push(i),r},refreshContent:function(n){n=n||this.getActiveSheetIndex();var t,i,e=this.getSheet(n),u=this.model.scrollSettings,f=u.allowVirtualScrolling,r=this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content");this._initDataRange(n);this._refreshRowColCnt(n);this._getJSSheetHeader(n).find(".e-headercontent").html(this._renderHeaderColumns(n));this._refreshTemplates(n);this._getJSSheetRowHeaderContent(n).html(this._renderHdrRows(n));r.find(".e-table").remove();r.prepend(this._renderContTable(n));this._initViewPortCont(n);this._isAutoWHMode?this._isInitLoad||this._autoSSWidthHeight(n):this.XLScroll._refreshScroller(n,"refresh","all");f||(this.XLScroll._getFirstRow(n),this.XLScroll._getFirstColumn(n));t=this._getContTBody(n).find("tr");i=this._getRowHdrTBody(n).find("tr");this.setRows([i,t],n)},_autoSSWidthHeight:function(t,i){var r={},f=this.model.scrollSettings,u=n("#"+this._id+"_Ribbon").data("ejRibbon");t=t||this._getSheetIndex();this._responsiveWidth=this._dlgWidth=r.width=this._getContTBody(t).width()+this._getJSSheetRowHeader(t).width();this._responsiveHeight=this._dlgHeight=r.height=this.element.height();this.model.showRibbon&&r.width<=480?(r.width=480,this._getContent(t).find(".e-content").removeClass("e-rmvrghtbdr")):i||this._getContent(t).find(".e-content").addClass("e-rmvrghtbdr");i||this._setSheetWidthHeight(t,r,null,"refresh");this.model.showRibbon&&(r.width<=480&&this._alignFormulaBar(r.width),this.XLRibbon._refreshBackstageHeight(),u.setModel({width:r.width}))},_initDataRange:function(n){var c,r,t,e,o,u,f,s=0,i=this.getSheet(n),h=this.getDataSettings(n);if(h)for(c=h.length;s<c;)t=h[s],t._jsonData&&(t.batchChanges={added:[],changed:[],deleted:[]},t.fields=this.getObjectKeys(t._jsonData[0]),r=t.startCell?this._toIntrnlRange(t.startCell,n):[0,0,0,0],r[2]=r[0]+(!t.fieldAsColumnHeader&&t.showHeader?t.count:t.count-1),r[3]=r[1]+this.getObjectLength(t._jsonData[0])-1,t.range=r,u=r[2],f=r[3],(this._isAutoWHMode||i.usedRange.rowIndex<u)&&(i.usedRange.rowIndex=u),(this._isAutoWHMode||i.usedRange.colIndex<f)&&(i.usedRange.colIndex=f),e=u+1,o=f+1,(this._isAutoWHMode||i.rowCount<e)&&(i.rowCount=e),(this._isAutoWHMode||i.colCount<=o)&&(i.colCount=o),i._hasDataSrc=!0),s++},_renderStyleTag:function(n){var i,t;return i=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0],t=document.createElement("style"),t.type="text/css",n=="custom"?(t.setAttribute("id",this._id+"_sscustomformat"),i.appendChild(t)):n!=="showhide"||document.getElementById(this._id+"_sshide")||(t.setAttribute("id",this._id+"_sshide"),i.appendChild(t)),t},_renderHeaderColumns:function(n){var u,i,f,r,e=document.createElement("thead");return r=this._renderHeaderCol(n,0,this.getSheet(n).colCount),i=t.buildTag("table.e-table","",this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal?{width:this._getEntireColWidth(n)}:{},{cellspacing:"0.25px"})[0],f=r[1],u=r[0],e.appendChild(u),i.appendChild(f),i.appendChild(e),i},_renderHeaderCol:function(n,i,r){var e,h,c,b,l,a,v,y,o,s=0,p=[],f=i,u=this.getSheet(n),w=document.createElement("tr"),k=document.createElement("colgroup");for(w.className="e-columnheader",this.isImport||(u._colWidthCollection.length=0,u._ofColWidthColl.length=0),u._colWidthCollection.push(s),u._ofColWidthColl.push(s);f<r;)e="e-headercell",l="col",o=u.columnsWidthCollection[f],this.isUndefined(o)&&(o=u.columnsWidthCollection[f]=u.columnWidth),f!=r-1&&(s=u._colWidthCollection[u._colWidthCollection.length-1]+o,u._colWidthCollection.push(s),u._ofColWidthColl.push(s)),this.model.allowSelection&&this._inColumn(u.selectedRange,f)&&(e+=" e-colhighlight",u._isColSelected&&(e+=" e-colselected")),o<1?(l+=".e-hide",e+=" e-hide"):u._hiddenFreezeCols.indexOf(f)>-1&&(l+=".e-fcol-hide",e+=" e-fcol-hide"),(this.IsImport||u._isLoaded)&&this.XLEdit.getPropertyValue(0,f,"hCol")&&(e+=" e-hcol"),h=document.createElement("th"),h.className=e,a=v=this._generateHeaderText(f+1),u.fieldAsColumnHeader&&u.columns[f]&&(a=u.columns[f].text),c=document.createElement("div"),c.className="e-headercelldiv",c.innerHTML=a,h.appendChild(c),b=t.buildTag(l,"",{width:o},{}),w.appendChild(h),k.appendChild(b[0]),this._sheetCopy.isSheetCopy||u.columns[f]||(u.columns[f]={field:v,text:v,type:y!=null?y.getDay?"date":typeof y:null}),f++;return p.push(w),p.push(k),p},_getWidth:function(n,t,i){for(var r=0,u=this.getSheet(i);n<=t;n++)r+=u.columnsWidthCollection[n];return r},_getEntireColWidth:function(n){var t=this.getSheet(n),i=this._getIdxWithOffset(null,this._getLastColIdx(t)).xOffset;return i+t.columnsWidthCollection[t.columnsWidthCollection.length-1]},_getLastColIdx:function(n){for(var t=n.colCount-1;t>-1;){if(!(t in n.hideColsCollection)&&n._hiddenFreezeCols.indexOf(t)===-1)break;t--}return t},_getIdxWithOffset:function(n,i,r,u,f){u=u||[];var s,h,a,e=idx=pos=offset=0,l={},c=t.Spreadsheet.HideTypes,o=this.getSheet(f);if(!t.isNullOrUndefined(n)){if(r)for(a=o.rowsHeightCollection.length;e<a;){if(s=h=!1,u.indexOf(c.Default)===-1&&o.hideRowsCollection.indexOf(e)>-1&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeRows.indexOf(e)>-1&&(h=!0),!s&&!h){if(pos+=o.rowsHeightCollection[e],pos>n){idx=e;break}offset=pos}e++}else{while(e<n)s=h=!1,u.indexOf(c.Default)===-1&&o.hideRowsCollection.indexOf(e)>-1&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeRows.indexOf(e)>-1&&(h=!0),s||h||(offset+=o.rowsHeightCollection[e]),e++;idx=n}l.rowIdx=idx;l.yOffset=offset}if(!t.isNullOrUndefined(i)){if(r)for(e=idx=pos=offset=0,a=o.columnsWidthCollection.length;e<a;){if(s=h=!1,u.indexOf(c.Default)===-1&&e in o.hideColsCollection&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeCols.indexOf(e)>-1&&(h=!0),!s&&!h){if(pos+=o.columnsWidthCollection[e],pos>i){idx=e;break}offset=pos}e++}else{while(e<i)s=h=!1,u.indexOf(c.Default)===-1&&e in o.hideColsCollection&&(s=!0),u.indexOf(c.Freeze)===-1&&o._hiddenFreezeCols.indexOf(e)>-1&&(h=!0),s||h||(offset+=o.columnsWidthCollection[e]),e++;idx=i}l.colIdx=idx;l.xOffset=offset}return l},_renderHdrRows:function(n){var r,a,v,b,k,p,d,u,o,s,h,g,c,l,f,e,y,i=this.getSheet(n),w=this.model.scrollSettings.allowVirtualScrolling;if(c=t.buildTag("table.e-table","<colgroup><col style='width: 30px;'><\/colgroup>",{},{cellspacing:"0"}),!this._sheetCopy.isSheetCopy){for(u=f=0,y=i.rows,r=0,p=i.rowCount,i._rowHeightCollection=[],i._rowIdxColl=[],i._rowHeightCollection.push(u);r<p;)l=i.rowsHeightCollection[r],l||(l=i.rowsHeightCollection[r]=i.rowHeight),w&&(i.hideRowsCollection.indexOf(r)!==-1||i._hiddenFreezeRows.indexOf(r)!==-1)?l=0:i._rowIdxColl.push(r),r!=p-1&&i._rowHeightCollection.push(i._rowHeightCollection[i._rowHeightCollection.length-1]+l),r++;if(y){for(e=-1,k=y.length,g=this._browserDetails.name==="mozilla"?2:1,a=0;a<k;a++){for(o=y[a],b=o.cells.length,this.isUndefined(o.index)||(f=o.index),u=o.height||i.rowHeight,i.rowHeight<u&&(i.rowsHeightCollection[f]=u,e===-1&&(e=f)),v=0;v<b;v++)s=o.cells[v],s.style&&s.style["font-size"]&&(h=document.getElementById(this._id+"_emptySpan"),d=this.XLFormat._createFormatClass(s.style),this.addClass(h,d),h.textContent=s.value,u=h.offsetHeight+g,u>i.rowsHeightCollection[f]&&(i.rowsHeightCollection[f]=u,e===-1&&(e=f)),this._refreshGlobalSpan(h)),this.isUndefined(s.value)||(i._hasDataSrc=!0);f++}e!==-1&&this.XLScroll._getRowHeights(n,e,!0)}}return w?c.append("<tbody class='e-ss-virtualtop'><\/tbody><tbody><\/tbody><tbody class='e-ss-virtualbottom'><\/tbody>"):c.append("<tbody>"+this._renderRowHdr(i._rowIdxColl,n)+"<\/tbody>"),this._setRowHdrTBody(c.find("tbody").eq(w?1:0),n),c},_renderRowHdr:function(i,r){for(var u,f,o=0,h=[],e=this.getSheet(r),s=i?i.length:e.rowCount;o<s;)u=i?i[o]:o,(t.isNullOrUndefined(this.XLEdit.getPropertyValue(u,0,"isFilterHide",r))||t.isNullOrUndefined(this.XLEdit.getPropertyValue(u,0,"isRHide",r)))&&(f={height:e.rowsHeightCollection[u]<this.model.rowHeight?this.model.rowHeight:e.rowsHeightCollection[u],rowidx:u},f.className=this.XLEdit.getPropertyValue(u,0,"hRow",r)?"e-rowheader e-hrow ":"e-rowheader",this.XLEdit.getPropertyValue(u,0,"isFilterHighlight",r)&&(f.className+=" e-filterhiglight"),f.wrap=this.XLEdit.getPropertyValue(u,0,"wrapRow",r)?" e-sswraprow":"",this.model.allowSelection&&this._inRow(e.selectedRange,u)&&(f.className+=" e-rowhighlight",e._isRowSelected&&(f.className+=" e-rowselected")),h.push(f)),o++;return n.render[this._id+"JSONRowHdrTemplate"+r](h)},_refreshDataSrc:function(n,t){var r,e,f,o,h,u,i,p,l,s,a,c=isSheetData=!1,v=0,w=this.getSheet(t),y=this.getDataSettings(t);if(!w.rangeSettings.length&&w.dataSource&&(isSheetData=!0),y)for(p=y.length;v<p;){if(i=y[v],i.range)if(s=i.range,c=isSheetData?!i.fieldAsColumnHeader&&i.showHeader:i.showHeader,this.getObjectLength(i.headerStyles)&&this.model.allowCellFormatting&&(l=this.XLFormat._createFormatClass(i.headerStyles)),n)for(r=n[0],e=n[2],o=n[3];r<=e;){if(this._inRow(s,r))for(f=n[1];f<=o;)this._inColumn(s,f)&&(a=i.fields[f-i.range[1]],c&&r===s[0]?(u=i._jsonData[r-i.range[0]],u&&this._refreshCell(r,f,t,i,u,a,!1,l)):(u=i._jsonData[r-(i.range[0]+(c?1:0))],u&&this._refreshCell(r,f,t,i,u,a,!0))),f++;r++}else{if(r=0,e=s[0],o=s[1],f=s[2],c){u=i._jsonData[r];for(h in u)this._refreshCell(e,o,t,i,u,h,!1,l),o++;e++}while(e<=f){u=i._jsonData[r];o=s[1];for(h in u)this._refreshCell(e,o,t,i,u,h,!0),o++;r++;e++}}v++}},_refreshCell:function(n,t,i,r,u,f,e,o){var s,h=this._iterateComplxObj(u[f],f);s=this.XLEdit._parseValue(e?h.value:h.prop,{rowIndex:n,colIndex:t});s.sheetIdx=i;r.rangeName&&(s.rangeName=r.rangeName);e?r.primaryKey===f&&(s.isReadOnly=!0):(o&&(s.format=o,s.formats=r.headerStyles),isSheetData&&(s.isReadOnly=!0));this.XLEdit._updateDataContainer({rowIndex:n,colIndex:t},{dataObj:s,sheetIdx:i,skipCell:!0})},_iterateComplxObj:function(n,t,i){var r,u,e,o=i||t,f={prop:o,value:n};if(this._isObject(n)){e=".";for(r in n){if(u=n[r],this.isUndefined(u))return f;if(n.hasOwnProperty(r)&&this._isObject(u)&&!this._isDateTime(u))o+=e+r,f=this._iterateComplxObj(u,r,o);else return f.prop+=e+r,f.value=u,f}}return f},_refreshCellData:function(t,i){var f,c,w,u,a,e,r,k,v,y,o=0,s=this.getSheet(i),p=s.rows,h=s.hideColumns,b=s.border;if(p){for(f=0,len=p.length;f<len;f++){if(e=0,w=p[f],a=p[f].cells,w.index&&(o=w.index),(!t||this._inRow(t,o))&&a)for(c=0,l=a.length;c<l;c++)u=a[c],u.index&&(e=u.index),(!t||this._inColumn(t,e))&&(r=this.isUndefined(u.value)?{}:this.XLEdit._parseValue(u.value,{rowIndex:o,colIndex:e}),r.value=this.isUndefined(r.value)?this.isUndefined(this.XLEdit.getPropertyValue(o,e))?"":this.XLEdit.getPropertyValue(o,e):r.value,v=this.isFormula(r.value),v&&(this.XLEdit._refreshCalcEngine(o,e,!0,r.value,i),this._applyFormula(i,o,e)),u.format&&(y=this.XLFormat._getFormatObj(u.format),r.type=u.format.type,r.formatStr=y.format.formatStr,r.decimalPlaces=y.format.decimalPlaces,r.thousandSeparator=y.format.thousandSeparator?!0:!1),r.value2=this.XLFormat._format(v?this.XLEdit.getPropertyValue(o,e,"value2"):r.value,{formatStr:r.formatStr,type:r.type,thousandSeparator:r.thousandSeparator,decimalPlaces:r.decimalPlaces,cellObj:r}),u.hyperlink&&(r.hyperlink=u.hyperlink.webAddr?u.hyperlink.webAddr.indexOf("http")===-1?{webAddr:"http://"+u.hyperlink.webAddr}:{webAddr:u.hyperlink.webAddr}:{cellAddr:u.hyperlink.cellAddr+"_"+u.hyperlink.sheetIndex||i},r.formats={color:this._hlColor}),u.comment&&(k=(this.model.userName.length?this.model.userName:this._getLocStr("UserName"))+":\n",r.comment={value:k+(u.comment.value||""),isVisible:u.comment.isVisible||!1}),u.isLocked&&(r.isLocked=!0,this.protectSheet(!0)),u.style&&(r.formats=n.extend(r.formats,u.style)),r.formats&&(r.format=this.XLFormat._createFormatClass(r.formats)),this.XLEdit._updateDataContainer({rowIndex:o,colIndex:e},{dataObj:r,sheetIdx:i,skipCell:!0}),this.XLEdit._refreshCellAlignment({cellIdx:{rowIndex:o,colIndex:e},value:r.value,type:r.type}),v||this.XLEdit._refreshCalcEngine(o,e,!1,null,i)),e++;o++}this.model.scrollSettings.allowVirtualScrolling&&(s._virtualTBodyHgt=s._rowHeightCollection[s._rowHeightCollection.length-1]+s.rowsHeightCollection[s.rowsHeightCollection.length-1])}if(h.length&&this.model.scrollSettings.allowVirtualScrolling){for(f=0,len=h.length;f<len;f++)s.hideColsCollection[h[f]]||this._updateHiddenColumns({rowIndex:0,colIndex:h[f]},i);this.XLScroll._getColWidths(i,h.sort()[0])}if(b.length&&this.model.scrollSettings.allowVirtualScrolling)for(f=0,len=b.length;f<len;f++)this._updateCellBorder(b[f],i)},_updateCellBorder:function(n,t){var r,u,f,i,e=this.getRangeIndices(n.range);if(f={top:{top:"1px solid"},right:{right:"1px solid"},bottom:{bottom:"1px solid"},left:{left:"1px solid"},outside:{top:"1px solid",right:"1px solid",bottom:"1px solid",left:"1px solid"},allborder:{top:"1px solid",right:"1px solid",bottom:"1px solid",left:"1px solid"},thickbox:{top:"2px solid",right:"2px solid",bottom:"2px solid",left:"2px solid"},thickbottom:{bottom:"2px solid"},topandbottom:{top:"1px solid",bottom:"1px solid"},topandthickbottom:{top:"1px solid",bottom:"2px solid"}},i=f[n.type],borderColl=this.getObjectKeys(i),borderColl.length)for(r=0,u=borderColl.length;r<u;r++)i[borderColl[r]]=i[borderColl[r]].concat(" "+n.color);i.skipCell=!0;i.sheetIdx=t;n.type==="allborder"?this.XLFormat._applyAllBorderCss(i,e):this.XLFormat._applyBorderCss(i,e)},_renderContTable:function(i){var r;return this._sheetCopy.isSheetCopy?r=n(this._sheetCopy.sheetContent):(r=t.buildTag("table.e-table",this._sheets[i]._contentColGroup.outerHTML,this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal?{width:this._getEntireColWidth(i)}:{},{cellspacing:"0"}),this.model.scrollSettings.allowVirtualScrolling?r.append("<tbody class='e-ss-virtualtop'><\/tbody><tbody><\/tbody><tbody class='e-ss-virtualbottom'><\/tbody>"):r.append("<tbody><\/tbody>")),this._setContTBody(r.find("tbody").eq(this.model.scrollSettings.allowVirtualScrolling?1:0),i),r},_initViewPortCont:function(n){var i,t=this.getSheet(n);this.model.scrollSettings.allowVirtualScrolling?this._refreshViewport(this._initLoad?0:this._isFrozen(this.getFrozenRows())?t._contScrollTop:t._scrollTop,n):(i=this.getRangeData({property:["value","value2","comment","hyperlink","format","border","type","isFilterHide","isRHide","isFHide","isFilterHeader","isFilterVisible","filterState","isMHide","merge","hRow","isLocked","wrap","isOverflow","align","picture","cFormatRule","isOfBrdr","formatStr"],sheetIdx:n,rowIdxs:t._rowIdxColl,withRowIdx:!0}),this._getContTBody(n).html(this._renderData(i,n)),this.model.allowComments&&this.XLComment._updateCmntArrowPos(null,n));t._isVPRendered=!0},_processCellTypes:function(n,t){for(var r=[],i=0,u=n.length;i<u;i++)n[i].cellType.type==="DatePicker"?r.push({range:this._getAlphaRange(t,n[i].rowIndex,n[i].colIndex,n[i].rowIndex,n[i].colIndex),settings:{type:n[i].cellType.type,value:n[i].value}}):r.push({range:this._getAlphaRange(t,n[i].rowIndex,n[i].colIndex,n[i].rowIndex,n[i].colIndex),settings:{type:n[i].cellType.type,isChecked:n[i].cellType.isChecked}});this.XLCellType._rangeCellTypes(r,t);this._celltypes=[]},_initDependencies:function(){var t=this.model;this._renderAlertdlg();this._renderAlertDlgContent(n("#"+this._id+"_alertdlg"),"Alert","");this._initEditForm();t.allowClipboard&&this.XLClipboard._initCopyPaste();t.allowEditing&&(this.XLEdit._processEditing(),this.getMainPanel().append(this.XLEdit._editElem),this.XLEdit._editElem.hide());this._renderDDownList();this.clearUndoRedo();t.showRibbon&&this.XLRibbon._disableButtons(["clearfilter"],"ejButton");t.allowDataValidation&&this.XLValidate._addDVMethod();t.enableContextMenu&&this.XLCMenu._initCMenuFooter();t.allowFiltering&&this.XLFilter._renderExcelFilter();t.allowFreezing&&this.XLFreeze._initFreeze()},_initComplete:function(){this._reqCnt===this._resCnt&&(this._trigger("loadComplete",{}),this.isDirty=!1,this.clearUndoRedo(),this.hideWaitingPopUp(),this.XLRibbon.updateRibbonIcons())},_showDialog:function(t,i){var e,u="e-dialog",f=this.model,r;switch(t){case this._id+"_Ribbon_Home_Styles_ConditionalFormatting":r=n("#"+this._id+"_CFDialog");!r.length&&f.allowConditionalFormats&&(r=this.XLRibbon._initCFDialog());r.ejDialog("open");break;case this._id+"_chartname":r=n("#"+this._id+"_chartnamedlg");r.length||this.XLRibbon._renderChartNameDlg();break;case this._id+"_Ribbon_ChartDesign_Type_ChangeChartType":r=n("#"+this._id+"_charttypedlg");r.length||(r=this.XLRibbon._renderChartTypeDialog());break;case this._id+"_ImportPasswordDialog":r=n("#"+this._id+"_ImportPasswordDialog");r.length||(r=this._importPasswordDlg());r.ejDialog("open");break;case this._id+"_Ribbon_Insert_Links_Hyperlink":this.model.isReadOnly||(f.allowHyperlink&&!this._hasClass(document.getElementById(this._id+"_HLDialog"),u)&&this.XLRibbon._initHLDialog(),this._hlDlgOpen());break;case this._id+"_Ribbon_Others_Cells_InsertCellOptions":f.allowInsert&&(this._hasClass(document.getElementById(this._id+"_insertdeletedlg"),u)||this._renderInsertDeleteDialog(),this._refreshInsDelDialog("Insert"));break;case this._id+"_Ribbon_Others_Cells_DeleteCellOptions":f.allowDelete&&(this._hasClass(document.getElementById(this._id+"_insertdeletedlg"),u)||this._renderInsertDeleteDialog("delete"),this._refreshInsDelDialog("Delete"));break;case this._id+"_FormatCells":f.allowCellFormatting&&!this._hasClass(document.getElementById(this._id+"_formatdlg"),u)&&this.XLCellFrmtDlg._renderCellFrmtDlg();this.XLCellFrmtDlg._initFormatCellDlg();break;case this._id+"_MoveorCopy":this._hasClass(document.getElementById(this._id+"_moveCopyDlg",u))||this._initMoveCopyDlg();this._renderMoveCopyDlg();break;case this._id+"_UnhideSheet":this._hasClass(document.getElementById(this._id+"_UnhideDlg",u))||this._initUnhideDlg();this._renderUnhideDlg();break;case this._id+"_Ribbon_Data_DataTools_DataValidation":case this._id+"_Ribbon_Data_DataTools_DataValidationOptions":this.model.allowDataValidation&&!this._hasClass(document.getElementById(this._id+"_ValDialog"),u)&&(e=this.XLRibbon._initValDialog(),this.XLRibbon._renderValDialog(e));break;case this._id+"_Filter":document.getElementById(this._id+i+"_excelDlg")||document.getElementById(this._id+"_filter_custom_"+i)||this.XLFilter._renderFilterDialogs(i);break;case this._id+"_Ribbon_Review_Changes_ProtectWorkbook":this._hasClass(document.getElementById(this._id+"_PasswordDialog"),u)||this._passwordDlg();break;case this._id+"_Ribbon_Insert_Tables_Table":f.allowFormatAsTable&&!this._hasClass(document.getElementById(this._id+"_fatnamedlg"),u)&&this.XLRibbon._renderFATNameDlg();break;case this._id+"_Ribbon_Insert_Tables_PivotTable":f.enablePivotTable&&!this._hasClass(document.getElementById(this._id+"_PvtDialog"),u)&&(this.XLRibbon._initPvtDialog(),this.XLRibbon._renderPvtDialog());break;case this._id+"_Ribbon_Others_Editing_FindSelect":f.allowSearching&&!this._hasClass(document.getElementById(this._id+"_FRDialog"),u)&&(this.XLRibbon._initFRDialog(),this.XLRibbon._renderFRDialog(),this.model.isReadOnly||(e=this.XLRibbon._initGoToDialog(),this.XLRibbon._renderGoToDialog(e)));this.model.isReadOnly?n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option",{disabledItemIndex:[1,2]}):n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option",{enabledItemIndex:[1,2]});break;case this._id+"_Ribbon_ChartDesign_Data_SelectData":f.allowCharts&&!this._hasClass(document.getElementById(this._id+"_chartrangedlg",u))&&this.XLChart._renderChartRangeDialog();break;case this._id+"_Ribbon_Others_NameManager":document.getElementById(this._id+"_nmdlg")||this.XLRibbon._renderNameManagerDlg();break;case this._id+"_Ribbon_Design_Tools_ResizeTable":document.getElementById(this._id+"_fatresizetabledlg")||this.XLRibbon._renderFATResizeTableDlg()}},_generateHeaderText:function(n){var t="Z";return n/26>1?this._generateHeaderText(n%26==0?n/26-1:Math.floor(n/26))+String.fromCharCode(n%26==0?t.charCodeAt(t):64+n%26):String.fromCharCode(64+n)},_generateColCount:function(n){var i=0,t;for(n=n.split("").reverse().join(""),t=n.length-1;t>=0;t--)i+=(n[t].charCodeAt(n[t])-64)*Math.pow(26,t);return i},_getSheetIndex:function(n){return n||this.getActiveSheetIndex()},_getSheetIdxFromSheetValue:function(n){for(var t=1,i=this.model.sheets,r=i.length-1;t<=r;){if(i[t].sheetInfo.value.toLowerCase()===n.toLowerCase())return t;t++}return-1},getAlphaRange:function(n,t,i,r){return this.isUndefined(i)&&this.isUndefined(r)&&(i=n,r=t),this._getAlphaRange(null,n,t,i,r)},_getAlphaRange:function(n,t,i,r,u){return t=t+1,i=i+1,r=r+1,u=u+1,t===r&&i===u?this._generateHeaderText(i)+t:this._generateHeaderText(i)+t+":"+this._generateHeaderText(u)+r},_getProperAlphaRange:function(n,t,i,r,u){var f=this._getAlphaRange(n,t,i,r,u);return f.indexOf(":")===-1?f+":"+f:f},_getDollarAlphaRange:function(n,t){var u=this.getActiveSheetIndex(),i=this.getSheet(u).sheetInfo.text,r=i.match(/\s/g)?"'"+i+"'":i;return t&&!this.isRange(n)?r+"!$"+this._generateHeaderText(n[1]+1)+"$"+(n[0]+1):r+"!$"+this._generateHeaderText(n[1]+1)+"$"+(n[0]+1)+":$"+this._generateHeaderText(n[3]+1)+"$"+(n[2]+1)},_toIntrnlRange:function(n,t){return n?this._isString(n)&&(n=this.getRangeIndices(n)):n=this.getSheet(t).selectedRange,n},_getMaxRowColCnt:function(n,t,i){for(var u,f,r,e=0,o=0,n=n?n:this.model.sheets,s=i?i:1,h=i?i+1:n.length;s<h;)r=n[s],t&&r.usedRange?(u=r.usedRange.rowIndex,f=r.usedRange.colIndex):(u=r.rowCount,f=r.colCount),e<u&&(e=u),o<f&&(o=f),s++;return{rowCount:e,colCount:o}},_generateEJMenu:function(n,i,r){return{menuType:n==="normal"?t.MenuType.NormalMenu:t.MenuType.ContextMenu,orientation:i==="vertical"?t.Orientation.Vertical:t.orientation.Horizontal,cssClass:r}},_generateEJDD:function(t,i,r,u,f,e){return{dataSource:t,fields:i,selectedItemIndex:r,width:u,cssClass:"e-"+this._id+"-ddl",change:n.proxy(this.XLRibbon._frTypeChange,this,e)}},_heightWidthCalculation:function(t,i){var r,u=this.getActivationPanel(),f=u.is(":visible");this._isDisplayHeader?(r=n("#"+this._id+"_Ribbon").height(),this._isDisplayHeader=!1):r=this.XLRibbon._ribbonState?this.element.find(".e-ribbon").height()-1:this.element.find(".e-ribbon .e-header").height();this._refreshSheetWithScreen(t);this._updateResponsiveSettings();this._initViewPort(t);this._setSheetWidthHeight(t,{width:this._responsiveWidth,height:this._responsiveHeight},r,"refresh",i.action);f&&u.height(this.getMainPanel().height()-1);this.refreshContent(t)},_refreshSheetWithScreen:function(t){n("#"+this._id+"GroupPanel")[0].style.height="0px";n("#"+this._id+"MainPanel")[0].style.height="0px";this.model.allowFormulaBar&&(this.element.find(".e-formulabar")[0].style.width="0px");this.getSheetElement(t).find(".e-spreadsheetcontentcontainer")[0].style.height="0px";this.getSheetElement(t).find(".e-spreadsheetrowheader")[0].style.height="0px"},_refreshWidthHeight:function(i,r,u,f){var s,y=1,p=0,e=this._getContent(i),h,c,w=this.model.pageSettings.pagerHeight+1,b,l=this.getSheet(i),a=this._getJSSheetRowHeader(i),v,k,d=-1,g=n("#"+this._id+"_Ribbon").ejRibbon("instance"),o,nt;return b=this.model.showRibbon?g.model.selectedItemIndex<1?1:g.model.selectedItemIndex:0,this.XLRibbon._ribbonState&&(d=n("#"+this._id+"_Ribbon").find(".e-content:eq("+b+")").height()),v=this._phoneMode?n("#"+this._id+"_Ribbon").height():n("#"+this._id+"_Ribbon").find(".e-header").height()+d+2,c=this.model.allowFormulaBar?this._formulaHeight:0,u=v&&this.model.showRibbon&&n("#"+this._id+"_Ribbon").is(":visible")?v:0,l.showHeadings&&(y=22,p=a.width()),this._isAutoWHMode||(h=r.height-(u+c+1),this.getGroupPanel().height(h-1),this.getMainPanel().height(h-1),this.model.showPager&&(f==="initial"||this.element.find(".e-spreadsheetfooter").is(":visible"))||(w=1),k=this._browserDetails.name==="chrome"?1:2,r.height=r.height-(y+w+c+u+k),this.element.find(".e-spreadsheet-list")[0].style.height=""),this.model._isActPanelVisible?r.width=r.width-(this.model.activationPanelWidth+2):t.isNullOrUndefined(r.isActPanel)||r.isActPanel||(r.width=r.width+this.model.activationPanelWidth+2),o=this.model.scrollSettings,this.getMainPanel().width(!this.model._isActPanelVisible&&o.isResponsive?"100%":r.width),e.find("#hscrollBar").length>0&&(e.find("#hscrollBar").remove(),a.removeClass("e-scrollrowcss"),this._getJSSheetRowHeaderContent(i).height(r.height),this._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").height(r.height-1)),e.find("#vscrollBar").length>0&&(nt=l._scrollTop,e.find("#vscrollBar").data("ejScrollBar").scroll(0),l._scrollTop=nt,e.find("#vscrollBar").remove(),this._getJSSheetHeader(i).removeClass("e-scrollcss"),this._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").width(o.isResponsive?r.width-2:r.width)),this._isAutoWHMode||(e.height(r.height),a.height(r.height)),this._getJSSheetContent(i).width(o.isResponsive?"100%":r.width),s=this.getFooter(),s&&s.width(o.isResponsive?"100%":r.width),this._alignFormulaBar(this._responsiveWidth),this._initViewPort(i),this.model.allowFreezing&&this.XLFreeze._refreshFreeze(),r.width=r.width-p,r.height=r.height,r},_setSheetWidthHeight:function(t,i,r,u,f){var e=this.getSheet(t),b=n(document),o=this._getContent(t),s,h,a,v,c,l=this._getJSSheetRowHeader(t),y,p=this.model.scrollSettings.isResponsive,k=e.showHeadings?l.width():0,w;p?(f!="initial"&&u!="resize"&&(this._refreshSheetWithScreen(t),this._updateResponsiveSettings(),i={width:this._responsiveWidth,height:this._responsiveHeight}),this._resizeColl[t-1]=this._isResized,u!=="resize"||this.model.allowResizing&&(!this.model.allowResizing||this.XLResize._resizeStart)||f=="toggleBtn"||(this.model.activationPanelWidth=Math.floor(i.width/3)),u==="refresh"&&(w=this._browserDetails,w.name.indexOf("msie")>-1&&(b=this.model.showRibbon?n(document):n("body"))),y=this._refreshWidthHeight(t,n.extend(!0,{},i),r,f,u),this._updateResponsiveSettings(),u!=="resize"||this.model.allowResizing&&(!this.model.allowResizing||this.XLResize._resizeStart)||f=="toggleBtn"||(this.model.activationPanelWidth=Math.floor(i.width/3)),i=y):(this._isAutoWHMode||(i.width=i.width-2),i=this._refreshWidthHeight(t,n.extend(!0,{},i),r,f,u));this.getMainPanel().width(!this.model._isActPanelVisible&&p?"100%":i.width+k);this.model.scrollSettings.allowScrolling&&(this.model._isActPanelVisible&&(i.width+=2),this._renderScroller(t,n.extend(!0,{},i),f),h=o.find("#vscrollBar"),s=o.find("#hscrollBar"),h.length>0&&this._getJSSheetHeader(t).addClass("e-scrollcss"),s.length>0&&(c=o.height(),l.height(c-18),this._getJSSheetRowHeaderContent(t).height(c-(s[0].style.display==="none"?0:18)),l.addClass("e-scrollrowcss")),f!="initial"&&(v=h.data("ejScrollBar"),a=s.data("ejScrollBar"),v.scroll(e._scrollTop),a.scroll(e._scrollLeft)));e.showHeadings||o.find(".e-content")[this.model.allowFormulaBar?"addClass":"removeClass"]("e-viewbrdr");this._isAutoWHMode||(this._dlgWidth=this._phoneMode||this._tabMode||this._responsiveWidth<350?this._responsiveWidth-2:this._responsiveWidth/2,this._dlgHeight=this._phoneMode||this._tabMode||this._responsiveHeight<350?this._responsiveHeight-2:this._responsiveHeight/1.5)},setWidthToColumns:function(n,t){var f=t||this.getActiveSheetIndex(),i=this.getSheet(f),l,a,s=0,u,r,h=!1,c,e,v,o;if(!this.isUndefined(i)){for(typeof n[0]=="object"&&(h=!0),i._isLoaded&&(l=this._getContent(f).find("col"),a=this._getJSSheetHeader(f).find("col")),e=0,v=n.length;e<v;e++){if(u=h?n[e].width:n[e],r=h?n[e].colIndex:e,c=this.XLEdit._getPropWithCellIdx([0,r,i.rowCount-1,r],"isOfBrdr",f),u===0&&(u=64),u<i.columnsWidthCollection[r]&&this.XLEdit.getPropertyValue(0,r,"wrapCol")){s+=u;continue}for(i._isLoaded&&(a[r].style.width=u+"px",l[r].style.width=u+"px"),s+=u,this.XLEdit.getPropertyValue(0,r,"isCHide",f)?(i.hideColsCollection[r]=u,i.columnsWidthCollection[r]=0):i.columnsWidthCollection[r]=u,this.XLScroll._getColWidths(f,r),o=0;o<c.length;o++)cellIdx=c[o],this._textClip(cellIdx.rowIdx,cellIdx.colIdx,"delete","",!0),this._textClip(cellIdx.rowIdx,cellIdx.colIdx,"add","",!0)}i.staticWidth=s;i._isLoaded&&this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(f,"refresh","horizontal");(!i._isImported||i._isLoaded)&&(this.model.allowSelection&&this.XLSelection._refreshBorder(),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this.model.allowComments&&this.XLComment._updateCmntArrowPos(),this._isAutoWHMode&&this._autoSSWidthHeight())}},setHeightToRows:function(n){var u,t=this.getActiveSheetIndex(),e=0,r=this.getSheet(t),f=!1,o=this.getRows(t),h=o[1],c=o[0],i,s;for(typeof n[0]=="object"&&(f=!0),i=0,s=n.length;i<s;i++){if(height=f?n[i].height:n[i],rowIdx=f?n[i].rowIndex:i,height===0&&(height=22),height<r.rowsHeightCollection[rowIdx]&&this.XLEdit.getPropertyValue(rowIdx,0,"wrapRow")){e+=height;continue}this._isRowViewable(t,rowIdx)&&rowIdx!=-1&&(u=this._getRowIdx(rowIdx,t),h[u].style.height=height+"px",c[u].style.height=height+"px");e+=height;r.rowsHeightCollection[rowIdx]=height}this.model.scrollSettings.allowScrolling&&(this.XLScroll._getRowHeights(t,1),this.XLScroll._refreshScroller(t,"refresh","vertical"),this.XLScroll._getFirstRow(t));this.model.allowSelection&&(!r._isImported||r._isLoaded)&&(this.XLSelection._refreshBorder(),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())},_refreshRowColCnt:function(n){var f,o,r,e,u=buffHgt=buffWth=actPnlWidth=ribbonHgt=formulaHgt=0,h=this.model.scrollSettings,c=scrollerHgt=scrollerWth=colHdrHgt=rowHdrWth=0,s=h.scrollMode===t.Spreadsheet.scrollMode.Infinite,i=this.getSheet(n),l=this._responsiveHeight,a=this._responsiveWidth;i.rowCount>this._maxRowCnt&&(i.rowCount=this._maxRowCnt);f=this._getMaxHgt(n,this.isImport);s&&(buffHgt=i._vPortHgt+this._bufferCnt*i.rowHeight,f<buffHgt&&(r=buffHgt-f,u=Math.ceil(r/i.rowHeight),i.rowCount+=u,f+=u*i.rowHeight));h.allowVirtualScrolling&&(e=i.rowCount-(i.hideRowsCollection.length+(this.isImport?i._hiddenFreezeRows.length:0)),s&&(r=e%i._virtualBlockRowCnt,r&&(u=i._virtualBlockRowCnt-r,i.rowCount+=u,e+=u,f+=u*i.rowHeight)),i._virtualBlockCnt=Math.ceil(e/i._virtualBlockRowCnt),i._virtualTBodyHgt=f);i.colCount>this._maxColCnt?i.colCount=this._maxColCnt:s&&(buffWth=i._vPortWth+this._bufferCnt*i.columnWidth,o=this.isImport?this._getMaxWth(n):i.colCount*i.columnWidth,o<buffWth&&(r=buffWth-o,i.colCount+=Math.ceil(r/i.columnWidth)))},_getMaxHgt:function(n,t,i){var f,u=val=0,r=this.getSheet(n);if(t)for(f=r.rowsHeightCollection.length;u<f;)i&&r.hideRowsCollection.indexOf(u)!==-1||(val+=r.rowsHeightCollection[u]),u++;else val=(r.rowCount-(r.hideRowsCollection.length+r._hiddenFreezeRows.length))*r.rowHeight;return val},_getMaxWth:function(n){for(var i=0,t=0,r=this.getSheet(n),u=r.columnsWidthCollection.length;t<u;)i+=r.columnsWidthCollection[t],t++;return i},_refreshTemplates:function(i,r,u,f){for(var h,e,o,s=t.isNullOrUndefined(u)?0:u,l={},a=this.getSheet(i),v=t.buildTag("colgroup"),y=this.model.scrollSettings.allowVirtualScrolling,p=t.isNullOrUndefined(f)?a.colCount:f,c=y?"<tr style = 'height: {{:height}}px' idx = '{{:rowidx}}'>":"<tr style = 'height: {{:height}}px'>";s<p;)h=a.columnsWidthCollection[s],o=this._generateHeaderText(s+1),e=document.createElement("col"),h<1?e.setAttribute("class","e-hide"):a._hiddenFreezeCols.indexOf(s)>-1&&e.setAttribute("class","e-fcol-hide"),e.style.width=h+"px",c+="<td class='{{:"+o+"_className}}' rowspan=' {{:"+o+"_rspan}}' colspan=' {{:"+o+"_cspan}}'>{{:"+o+"_value}}<\/td>",v.append(e),s++;l[this._id+"JSONTemplate"+i]=c+"<\/tr>";r||(l[this._id+"JSONRowHdrTemplate"+i]=y?"<tr class='{{:wrap}}' style='height:{{:height}}px' idx='{{:rowidx}}'><td class='{{:className}}'>{{:rowidx + 1}}<\/td><\/tr>":"<tr class='{{:wrap}}' style='height:{{:height}}px'><td class='{{:className}}'>{{:rowidx + 1}}<\/td><\/tr>");n.templates(l);this._sheets[i]._contentColGroup=v.get(0)},_renderData:function(i,r,u,f,e){var y,h,p,s,o,d,ft,ht,ct,et,it,l,a,k,lt,w,ot,rt,at,v,vt,g=eCol=0,b=" ",nt=[],c=this.getSheet(r),st=e?f:c.colCount,tt=c._goToCollection,yt=tt.selected.length,ut,pt;if(i)for(ft=i.data,it=ft.length/st;g<it;){for(s={},y=eCol,l=i.rowIdx[g],a=e?u:0;y<eCol+st;){if(o=ft[y],o){if(k=this._generateHeaderText(a+1),h=k+"_className",p=k+"_value",s[h]="e-rowcell e-wrapword ",c.showGridlines||(s[h]+=" e-hborder"),!tt.multiple&&yt&&tt.selected.indexOf(l+":"+a)>-1&&(s[h]+=" e-selected"),a in c.hideColsCollection&&(s[h]+=" e-soverflow"),c._hiddenFreezeCols.indexOf(a)>-1&&(s[h]+=" e-fcol-hide"),this.model.allowSelection&&this.inRange(c.selectedRange,l,a)&&(rt=!0,tt.multiple&&(rt=!1,yt&&tt.selected.indexOf(l+":"+a)>-1&&(rt=!0)),rt&&(s[h]+=" e-selected"),c._activeCell.rowIndex===l&&c._activeCell.colIndex===a&&(s[h]+=" e-activecell")),this.isImport&&this.model.allowCellType&&this.model.allowAutoCellType&&((o.type=="shortdate"||o.type=="longdate")&&this._celltypes.push({rowIndex:l,colIndex:a,sheetIndex:r,cellType:{type:"DatePicker"},value:o.value2}),o.value2&&["true","yes","false","no"].indexOf(o.value2.toLowerCase())>-1&&this._celltypes.push({rowIndex:l,colIndex:a,sheetIndex:r,cellType:{type:"CheckBox",isChecked:["yes","true"].indexOf(o.value2.toLowerCase())>-1?!0:!1}})),this.isImport&&o.type=="date"&&this.XLFormat.addCustomFormatSpecifier(null,o.formatStr.replace(/^\{0\:|\}$/g,""),o.type),o.format&&(s[h]+=b+o.format,this._isClassHasProperty(o.format,"text-align","right")&&(s[h]+=" e-rightalign")),o.border&&(s[h]+=b+o.border),o.align?o.align===t.Spreadsheet.Align.Center?s[h]+=b+this._cAlign:o.align===t.Spreadsheet.Align.Right&&(s[h]+=b+this._rAlign):this._isGeneral(o.type)&&(typeof o.value=="object"&&this._isDateTime(o.value)||this.isNumber(o.value))&&(s[h]+=b+this._rAlign),o.isMHide&&(s[h]+=" e-mc-hide",s[h]+=" e-moverflow"),o.isOfBrdr&&(s[h]+=" e-ofbrdr"),o.isOverflow===!1&&(s[h]+=" e-overflow"),o.merge&&(ht=k+"_rspan",ct=k+"_cspan",et=o.merge.mSpan,s[ht]=et.rowSpan,s[ct]=et.colSpan,s[h]+=" e-moverflow",o.merge.isCenterAlign&&(s[h]+=b+this._cAlign)),o.cFormatRule)for(ut=0,pt=o.cFormatRule.length;ut<pt;ut++)ot=o.cFormatRule[ut].split("_"),ot[7]==="true"&&(s[h]+=" e-"+ot[4]);o.wrap&&(c._isImported&&!this.isFormula(o.value)||!c._isImported)&&(s[h]+=" e-sswraptext",v=this._dataContainer.sheets[r],this.isUndefined(v[l])&&(v[l]={}),this.isUndefined(v[l][0])&&(v[l][0]={}),v[l][0].wrapRow=!0,this.isUndefined(v[0])&&(v[0]={}),this.isUndefined(v[0][a])?v[0][a]={wrapCol:!0,wrapWidth:c.columnsWidthCollection[a]}:(v[0][a].wrapCol=!0,v[0][a].wrapWidth=c.columnsWidthCollection[a]),this._wrapCollection(l,a,this._detailsFromGlobalSpan(l,a,"height",this.XLEdit.getPropertyValue(l,a,"value"),c.columnsWidthCollection[a]),r));d=o.value2||"";o.hyperlink?e?(s[h]+=" e-hyperlinks",s[p]=d):s[p]=o.hyperlink.webAddr?String.format("<a href={0} class='e-hyperlinks' target='_blank'>{1}<\/a>",o.hyperlink.webAddr,d):String.format("<a class='e-hyperlinks'>{0}<\/a>",d):s[p]=o.merge&&o.wrap?"<div id ="+this._id+"_MergeWrap style = 'border :0px;overflow: hidden;max-height:"+(Math.floor(c._rowHeightCollection[l+o.merge.mSpan.rowSpan]-c._rowHeightCollection[l])-1)+"px'>"+d+"<\/div>":d;o.comment&&(s[h]+=" e-commentcell",vt=o.comment.isVisible?"visible":"none",s[p]=String.format("<span class='e-comment'><span class='e-celltoparrow'><\/span><textarea class='e-comment-txtarea' style='display:{0};z-index:9'>{1}<\/textarea><\/span>",vt,o.comment.value)+s[p]);o.rule&&o.rule.isApply&&!this.XLValidate._checkValidation(s[p],o.rule.customVal.split("_"),!0,r)&&(s[h]+=" e-hlcell");!o.isFilterHeader||this.isUndefined(c._filterColl[l])||this.isUndefined(c._filterColl[l][a])||(lt="e-icon e-spanfilter e-filterspan "+c._filterColl[l][a].status,at=o.isFilterVisible?"display: visible":"display: none",s[p]=String.format('<span class="{0}" style="{1}"><\/span>',lt,at)+s[p],s[h]=s[h].replace("e-ralign",""),b=b.replace("e-ralign",""));o.altTxt&&!o.wrap&&(s[h]+=" e-alt-unwrap")}a++;y++}s.rowidx=l;w=c.rowsHeightCollection[l];s.height=this.isUndefined(w)||w<this.model.rowHeight?this.model.rowHeight:w;nt.push(s);eCol=y;g++}else if(it=this.model.scrollSettings.allowVirtualScrolling?c._virtualBlockRowCnt:c.rowCount,c._dummyData)nt=c._dummyData;else while(g<it){for(s={},y=0;y<st;)k=this._generateHeaderText(y+1),h=k+"_className",s[h]="e-rowcell e-wrapword ",y++;w=c.rowsHeightCollection[g];s.height=this.isUndefined(w)||w<this.model.rowHeight?this.model.rowHeight:w;s.rowidx=l;nt.push(s);g++}return c._dummyData=nt,n.render[this._id+"JSONTemplate"+r](nt)},_isGeneral:function(n){return this.isUndefined(n)&&(n=t.Spreadsheet.CellType.General),n===t.Spreadsheet.CellType.General},_isFormulaError:function(n){var t,i=["#NA","#DIV/0!","#NAME?","circular reference","TypeError","wrong"];for(t=0,len=i.length;t<len;t++)if(n.indexOf(i[t])>-1)return!0;return!1},_refreshViewport:function(n,t){var e,f,o,a,c,s,l,r,h,u,i=this.getSheet(t),v=this.XLShape._getCellIndexFromOffset(n,0);i._virtualContBlockIdx=this._getVirtualBlockIdx(t,v.rowIndex).idx;o=(i._virtualContBlockIdx-1)*i._virtualBlockRowCnt;a=this._getRowIdx(o,t,!0);s=i._virtualContBlockIdx*i._virtualBlockRowCnt;l=this._getRowIdx(s,t,!0);i._virtualContTBodyOffset.top=this._getRowOffsetTop(i,a);i._virtualBlockCnt===1?(i._virtualTopTBodyOffset.top=i._virtualTopTBodyOffset.bottom=i._virtualTopTBodyHgt=0,i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom=i._virtualBottomTBodyHgt=0,i._virtualContTBodyOffset.bottom=this._getRowOffsetBottom(i._rowIdxColl[i._rowIdxColl.length-1],t),f=i._rowIdxColl,i._isVirtualTopReached=i._isVirtualEndReached=!0):i._virtualContBlockIdx===1?(i._virtualTopTBodyOffset.top=i._virtualTopTBodyOffset.bottom=i._virtualTopTBodyHgt=0,i._virtualContTBodyOffset.bottom=i._virtualBottomTBodyOffset.top=this._getRowOffsetTop(i,l),r=this._getRowIdx(s+(i._virtualBlockRowCnt-1),t,!0),i._virtualBottomTBodyOffset.bottom=this._getRowOffsetBottom(r,t),i._virtualBottomTBodyHgt=i._virtualTBodyHgt-(i._virtualContTBodyOffset.bottom-i._virtualContTBodyOffset.top+(i._virtualBottomTBodyOffset.bottom-i._virtualBottomTBodyOffset.top)),f=i._rowIdxColl.slice(0,i._rowIdxColl.indexOf(r)+1),i._isVirtualTopReached=!0,i._isVirtualEndReached=!1):i._virtualContBlockIdx===i._virtualBlockCnt?(h=(i._virtualContBlockIdx-2)*i._virtualBlockRowCnt,i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom=i._virtualBottomTBodyHgt=0,c=this._getRowIdx(o+(i._virtualBlockRowCnt-1),t,!0),i._virtualContTBodyOffset.bottom=this._getRowOffsetBottom(c,t),u=this._getRowIdx(h,t,!0),i._virtualTopTBodyOffset.top=this._getRowOffsetTop(i,u),i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.top,i._virtualTopTBodyHgt=i._virtualTBodyHgt-(i._virtualContTBodyOffset.bottom-i._virtualContTBodyOffset.top+(i._virtualTopTBodyOffset.bottom-i._virtualTopTBodyOffset.top)),f=i._rowIdxColl.slice(i._rowIdxColl.indexOf(u),i._rowIdxColl.indexOf(c)+1),i._isVirtualEndReached=!0,i._isVirtualTopReached=!1):(h=o-i._virtualBlockRowCnt,u=this._getRowIdx(h,t,!0),i._virtualTopTBodyOffset.top=this._getRowOffsetTop(i,u),i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.top,i._virtualContTBodyOffset.bottom=i._virtualBottomTBodyOffset.top=this._getRowOffsetTop(i,l),r=this._getRowIdx(s+(i._virtualBlockRowCnt-1),t,!0),i._virtualBottomTBodyOffset.bottom=this._getRowOffsetBottom(r,t),i._virtualTopTBodyHgt=n-(i._virtualTopTBodyOffset.bottom-i._virtualTopTBodyOffset.top+(n-i._virtualContTBodyOffset.top)),i._virtualBottomTBodyHgt=i._virtualTBodyHgt-i._virtualBottomTBodyOffset.bottom,f=i._rowIdxColl.slice(i._rowIdxColl.indexOf(u),i._rowIdxColl.indexOf(r)+1),i._isVirtualTopReached=i._isVirtualEndReached=!1);e=this.getRangeData({property:["value","value2","comment","hyperlink","rule","cFormatRule","format","border","type","isFilterHide","isRHide","isFHide","isFilterHeader","isFilterVisible","filterState","isMHide","merge","hRow","isLocked","wrap","isOverflow","align","isOfBrdr","altTxt","formatStr"],sheetIdx:t,rowIdxs:f,withRowIdx:!0});this._getRowHdrTBody(t).html(this._renderRowHdr(e.rowIdx,t));this._getContTBody(t).html(this._renderData(e,t));this._refreshRows(t);this._refreshTBodiesHgt(t);this.model.allowComments&&this.XLComment._updateCmntArrowPos(null,t);i._virtualRowIdx=e.rowIdx;this.model.allowCellType&&this.XLCellType._rangeCellTypes(i.cellTypes,t);this._refreshViewVar(n,i._isLoaded?null:0,t)},refreshOverflow:function(n,t){this._refreshOverflow(n,t)},_refreshOverflow:function(n,t){t=this._getSheetIndex(t);var r,e,i,u,f,o=this.getSheet(t);for(n=n||[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],f=this.XLEdit._getPropWithCellIdx(n,"value2"),r=f.length-1;r>-1;r--)i=f[r].rowIdx,u=f[r].colIdx,this.model.allowOverflow?this._textClip(i,u,"add","",!0):(this._isRowViewable(t,i)&&(e=this.getCell(i,u)[0]),this._removeClass(e,"e-overflow"),this._textClip(i,u,"delete","",!0),this.addClass(e,"e-overflow"),this.XLEdit._updateDataContainer({rowIndex:i,colIndex:u},{dataObj:{isOverflow:!1},skipCell:!0}))},_getVirtualBlockIdx:function(n,t,i){for(var r=1,u={},f=this.getSheet(n),e=this._getRowIdx(t,n,!1,!0);r<=f._virtualBlockCnt;){if(e<r*f._virtualBlockRowCnt){u.idx=r;break}r++}if(i)for(r=0;++r;)if(t<r*f._virtualBlockRowCnt){u.orgIdx=r;break}return u},_getBlockInfo:function(n,t,i){var r,f=this.getSheet(t),u=[0,0,0,f.colCount-1];return r=this._getVirtualBlockIdx(t,n,i),u[0]=f._virtualBlockRowCnt*(r.idx-1),u[2]=f._virtualBlockRowCnt*r.idx-1,r.range=u,i&&(u=[0,0,0,f.colCount-1],u[0]=f._virtualBlockRowCnt*(r.orgIdx-1),u[2]=f._virtualBlockRowCnt*r.orgIdx-1,r.orgRange=u),r},_getRowOffsetTop:function(n,t){return n._rowHeightCollection[t]},_getRowOffsetBottom:function(n,t){return this.getSheet(t)._rowHeightCollection[n]+this.getSheet(t).rowsHeightCollection[n]},_getColOffsetLeft:function(n,t){return n._colWidthCollection[t]},_getCellIdx:function(n){return{rowIndex:this.model.scrollSettings.allowVirtualScrolling?Number(n.parentNode.attributes.getNamedItem("idx").value):n.parentNode.rowIndex,colIndex:n.cellIndex}},_getMidCell:function(){var t,i={},n=this.getSheet();return t=n._bottomRow.idx-n._topRow.idx+1,i.rowIdx=n._topRow.idx+Math.floor(t/2),t=n._rightCol.idx-n._leftCol.idx+1,i.colIdx=n._leftCol.idx+Math.floor(t/2),i},_removeRange:function(t,i){var r=this.getActiveSheetIndex(),e=this._getRowHdrTBody(r),u=n(this._getRowHdrTBody(r)[0].rows),o=this._getContTBody(r),f=n(this._getContTBody(r)[0].rows);u.splice(t,i);f.splice(t,i);this.setRows([u,f],r);o.html(f);e.html(u)},_refreshTBodiesHgt:function(n){var t="px",n=this._getSheetIndex(n),i=this.getSheet(n),r=this._getJSSheetRowHeaderContent(n)[0].getElementsByTagName("tbody"),u=this._getContent(n)[0].getElementsByTagName("tbody");r[0].style.height=u[0].style.height=i._virtualTopTBodyHgt+t;r[2].style.height=u[2].style.height=i._virtualBottomTBodyHgt+t},_renderTD:function(n,t,i){return String.format("<td class='{0}' style='{1}' >{2}<\/td>",n,t,i)},_renderDIV:function(n,t,i){return i?String.format("<div class='{0}' title='{2}'>{1}<\/div>",n,t,i):String.format("<div class='{0}'>{1}<\/div>",n,t)},_renderTR:function(n,t,i){var r=this._sheetCopy.isSheetCopy?this.getSheet(i).rowsHeightCollection[t]:this.model.rowHeight,u="height:"+r+"px";return String.format("<tr style='{0}'>"+n+"<\/tr>",u)},_renderFooter:function(){var h=this.model.scrollSettings,i,r=t.buildTag("div.e-spreadsheetfooter","",{display:this.model.showPager?"block":"none"}),e=t.buildTag("table.e-table","",{},{}),o=n(document.createElement("tbody")),s=n(document.createElement("tr")),f=n(document.createElement("td")),c=this.model.scrollSettings,u;this._updateResponsiveSettings();i=h.isResponsive?"100%":this._responsiveWidth-2;f.append(this._renderSpreadSheetPager());f.find(".e-pagercontainer").append(t.buildTag("div#"+this._id+"_AddSheet.e-new e-icon e-default","",null,{title:this._getLocStr("NewSheet")}));s.append(f);o.append(s);e.append(o);r.append(e);this.getMainPanel().append(r);this.model.scrollSettings.isResponsive||this._isAutoWHMode||(i=i);this._refreshSpreadSheetPager();u=this.element.find(".e-spreadsheetfooter").outerHeight();this.model.showPager&&u>this.model.pageSettings.pagerHeight&&(this.model.pageSettings.pagerHeight=u<37?u:36);r.width(i).height(this.model.showPager?this.model.pageSettings.pagerHeight:0);this.element.find(".e-spreadsheetfooter .e-table").height(this.model.pageSettings.pagerHeight);this.setFooter(r)},gotoPage:function(t,i){var y;if((i||!(t>this.model.sheetCount))&&!(t<1)){var e,u,o=this.model.sheets,w=this.getPager(),s={},h=this._impData,c,l,f={reqType:"gotoSheet",gotoIndex:t,newSheet:i,prevSheetIdx:this.getActiveSheetIndex()},a,v,p=!this.XLRibbon._ribbonState,b={reqType:f.reqType,gotoSheetIndex:f.gotoIndex,isNewSheet:f.newSheet,prevSheetIndex:f.prevSheetIdx};(this._gotoPageArgs=n.extend(!0,{},f),this._isSheetNavigate=i?!1:!0,this._trigActionBegin(b))||(this.isImport||this.hideActivationPanel(),this.setActiveSheetIndex(t),u=o[t],i||u._isRequested||!u._isImported?(this.element.find(".e-sheet").hide(),i&&(this._addSheet(t),u=o[t]),this._isSheetInsert&&(e=w.ejPager("option","currentPage"),this._swapSheetDtCntr(o.length-1,e),this.model.activeSheetIndex=t=e,this._isSheetInsert=!1),this._isNew||(this.model.scrollSettings.allowVirtualScrolling||this.model.scrollSettings.allowSheetOnDemand)&&!u._isLoaded?(this.showWaitingPopUp(),this._initSheet(t)):(this.element.find("#"+this._id+"_"+u.sheetInfo.value).show(),i||this._initSelection(),this._isAutoWHMode&&(this._autoSSWidthHeight(),u._isOpened||this._refreshOverflow(r,t)),this._gotoPageArgs&&this._pageLoadComplete(t)),u._isResized&&(this._refreshSheetWithScreen(t),this._updateResponsiveSettings(),s.width=this._responsiveWidth,s.height=this._responsiveHeight,this._setSheetWidthHeight(t,s,null,"refresh"),u._isResized=!1),this.model.scrollSettings.allowVirtualScrolling||u._isOpened||this._updateHiddenRows(t),this.model.allowFreezing&&this.XLFreeze._refreshFreeze(),this._isSheetNavigate=!1):this._importSheet(t),u._isOpened=!0,h&&!this._isExport&&!u._isImpSLoad&&u._isImported&&(c=h.model.sheets[t]._scrollTop,l=h.model.sheets[t]._scrollLeft,c>0&&this.XLScroll._vScroller(t).scroll(c),l>0&&this.XLScroll._hScroller(t).scroll(l),u._isImpSLoad=!0),a=this.getActiveCell(t),v=this.XLEdit.getPropertyValue(a.rowIndex,a.colIndex,"rule",t),v&&v.type==="list"&&this._setddlCell(),u._isRibCollapsed!=p&&(this._heightWidthCalculation(this.getActiveSheetIndex(),n.extend(!0,{},this.model.scrollSettings)),u._isRibCollapsed=p),this._isAutoWHMode&&(y=this._getElementDimension(),this.element.css({height:y.height,width:y.width})))}},insertSheet:function(){if(this.model.allowInsert&&!this.model.isReadOnly){var n=this.getPager(),t=n.ejPager("option","totalRecordsCount")+1;n.ejPager("option",{totalRecordsCount:t});this._isSheetInsert=!0;this.gotoPage(t,!0);this.setSheetFocus()}},_renameSheet:function(i){var r=this.element.find(".e-currentitem"),u=t.buildTag("input#"+this._id+"_Sheet_RenamePanel","",{width:r.width()+5+"px",padding:0},{type:"input",value:i||r.text(),maxlength:"31"});r.hide();u.insertAfter(r).select().focus();this._isSheetRename=!0;this.model.showRibbon&&this.XLRibbon._disableRibbonIcons();this.model.enableContextMenu&&n("#"+this._id+"_contextMenuFooter").data("ejMenu")._contextMenuEvents("_off")},deleteSheet:function(n){if(this.model.allowDelete&&!this.model.isReadOnly){var t=this.getActiveSheetIndex(),i=this._getSheetNames(!0).length;n=n||t;i>1?(n!==t&&this.gotoPage(n,!1),this.getObjectLength(this._dataContainer.sheets[n])?this._showAlertDlg("","SheetDeleteAlert","sheetDeleteActn",470):this._removeSheet(n)):this._showAlertDlg("Alert","SheetDeleteErrorAlert","",430)}},hideSheet:function(t){if(!this.model.isReadOnly){var i=this._getSheetNames(!0),u=this._getSheetNames(),r=n.isNumeric(t)?t:this._getSheetIndexByName(t)||this.getActiveSheetIndex();i.length>1?(u[r-1].isVisible=!1,this.gotoPage(this._getNxtVisibleSheet(r,null,i))):this._showAlertDlg("Alert","SheetDeleteErrorAlert","",377)}},unhideSheet:function(t){if(!this.model.isReadOnly){var r=this._getSheetNames(),i=n.isNumeric(t)?t:this._getSheetIndexByName(t);r[i-1].isVisible||(r[i-1].isVisible=!0,this.gotoPage(i));this.hideWaitingPopUp()}},_getNxtVisibleSheet:function(n,t,i){var r=this._getSheetNames(),u=r.length,f="<=",e=1,o=this._getSheetNames(!0),s=r[n-1].value===(i&&i[i.length-1].value||o[o.length-1].value);for((t||s)&&(u=0,f=">=",e=-1);this.operators[f](n,u);){if(r[n-1].isVisible)return n;n=n+e}},_renderSpreadSheetPager:function(){var r,i={},t=n(document.createElement("div"));return this.model.pageSettings.click=n.proxy(this._spreadSheetPagerClickHandler,this),this.model.pageSettings.totalRecordsCount=this.model.sheetCount,this.model.pageSettings.locale=this.model.locale,n.extend(i,this.model.pageSettings),i.currentPage=this.getActiveSheetIndex(),i.pageSize=1,i.showGotoPage=!1,this.setPager(t),t.ejPager(i),inst=t.data("ejPager"),inst._$first[0].title=this._getLocStr("Firstsheet"),inst._$last[0].title=this._getLocStr("Lastsheet"),inst._$next[0].title=this._getLocStr("Nextsheet"),inst._$prev[0].title=this._getLocStr("Prevsheet"),t.find(".e-parentmsgbar").remove(),r=t.find(".e-pagercontainer")[0],r.appendChild(t.find("a.e-PP")[0]),r.appendChild(t.find(".e-numericcontainer")[0]),r.appendChild(t.find("a.e-NP")[0]),t},_getPageCount:function(){var y=this.model.scrollSettings.isResponsive,p=this.model.pageSettings.pageCount;if(y){var r=0,h,i,u,c=this.getPager(),l,f,e=c.find(".e-currentitem"),w=c.find(".e-numericcontainer"),o=this._getSheetNames(),a=c.width(),s=250,b=w.children(":visible"),t=this.getActiveSheetIndex(),k=n(b[0]).data("index"),v=!0;for(i=this._browserDetails.name==="msie"&&this._browserDetails.version==="8.0",i?(u=n("#"+this._id+"_emptySpan"),u.css({"font-size":e.css("font-size"),"font-family":e.css("font-family")})):(l=document.createElement("canvas"),f=l.getContext("2d"),f.font=e.css("font-size")+" "+e.css("font-family"));t>k-1;){if(s+=i?u.text(o[t-1].text).width()+19:f.measureText(o[t-1].text).width+19,a<=s)return r||1;t--;r++}for(t=this.getActiveSheetIndex();v;){if(h=this.isUndefined(o[t])?this._getLocStr("Sheet")+t:o[t].text,s+=i?u.text(h).width()+19:f.measureText(h).width+19,a<=s){v=!1;break}t++;r++}return i&&this._refreshGlobalSpan(),r||1}return p},_spreadSheetPagerClickHandler:function(i){var o,e,s=!1,r=this,f,u=n(i.event.target),h=r.getPager().data("ejPager");if(r._filterClose(u),!r._hasClass(u[0],"e-disable")&&(!u.hasClass("e-new")||!r.model.exportSettings.password))return(r.model.allowComments&&r.XLComment._isCommentEdit||r.XLEdit._isEdit||!r.model.allowInsert||r.model.isReadOnly)&&(i.event&&(u.hasClass("e-pager")||u.hasClass("e-new"))||r.element.find(".e-field-validation-error").length)?void 0:(r.model.allowComments&&r.XLComment._isCommentEdit&&r.XLComment._updateCurCmntVal(),r.XLEdit._isEdit&&r.XLEdit.saveCell(),!t.isNullOrUndefined(i.event)&&(u.hasClass("e-prevpage")||u.hasClass("e-nextpage")||u.hasClass("e-firstpage")||u.hasClass("e-lastpage"))&&(i.currentPage=r._getNxtVisibleSheet(i.currentPage,u.hasClass("e-prevpage")||u.hasClass("e-lastpage"))),f={activeSheet:r.getActiveSheetIndex(),gotoSheet:i.currentPage,newSheet:i.event&&u.hasClass("e-new")},f.newSheet?(o=r.getPager(),e=o.ejPager("option","totalRecordsCount")+1,f.gotoSheet=e):f.gotoSheet=i.currentPage,i.currentPage=f.gotoSheet,!t.isNullOrUndefined(i.event)&&i.event.target.id.indexOf("_Sheet_RenamePanel")>-1||r._isSheetRename&&!r._updateSheetNames(null,!1)||h._prevPageNo===i.currentPage)?void 0:(f.newSheet&&(o.ejPager("option",{totalRecordsCount:e,currentPage:e}),i.currentPage=e,s=!0),r._pageClickArgs=n.extend(!0,{},f),r.gotoPage(i.currentPage,s),n(i.event.target).hasClass("e-pager")||(r._completeAction({reqType:"paging",sheetIndex:f.activeSheet,nSheetIndex:i.currentPage}),r._trigActionComplete({reqType:"paging",sheetIndex:f.activeSheet,newSheetIndex:i.currentPage})),!1)},_pageLoadComplete:function(t){var u,f,r=this.getSheet(t),e="option",o="checked",i=this._gotoPageArgs,s=this.model.allowSelection;if(s&&t!==i.prevSheetIdx&&(this.XLSelection._isGridBordering||this.XLSelection._isOutsideBordering)&&(this._getContent(i.prevSheetIdx).find("div:first-child").removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor"),this.XLSelection._isGridBordering=this.XLSelection._isOutsideBordering=!1),(!r._isImported||r._isLoaded)&&this.model.enableContextMenu&&this.XLCMenu.hideCMenu(),this._refreshSpreadSheetPager(i.newSheet),s&&this.getSheetElement(t).find(".e-ss-activeimg").length&&this.XLSelection._cleanUp(!0),this.model.showRibbon&&(this._updateRibbonTab(r._activeCell),this.isImport||(this.model.allowLockCell&&(r.isSheetProtected?this.XLRibbon._disableRibbonIcons():this.XLRibbon._enableRibbonIcons(),this.XLRibbon._updateRibbonIcons()),this.model.allowComments&&this.XLComment._updateCmntRibIcons()),n("#"+this._id+"_Ribbon_PageLayout_Show_Headings").ejCheckBox(e,o,r.showHeadings),n("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").ejCheckBox(e,o,r.showGridlines)),this.model.allowCellFormatting&&(u=this.getSheetElement(t).find(".e-content")[0],this.XLFormat._formatEnable?(this._removeClass(u,"e-ss-cursor"),this.addClass(u,"e-ss-fpcursor")):(this.addClass(u,"e-ss-cursor"),this._removeClass(u,"e-ss-fpcursor"))),this._pageClickArgs){if(this._pageClickArgs.activeSheet=this.getActiveSheetIndex(),this._trigger("pagerClick",this._pageClickArgs))return;this.model.scrollSettings.isResponsive&&this._isResized&&!this._resizeColl[t-1]&&(this._refreshSheetonResize(),this._resizeColl.toString().indexOf("f")<0&&(this._isResized=!1,this._resizeColl.fill(!1)))}this.hideWaitingPopUp();this._pageClickArgs=this._gotoPageArgs=null;f={gotoSheetIndex:i.gotoIndex,isNewSheet:i.newSheet,prevSheetIndex:i.prevSheetIdx,reqType:i.reqType};this._trigActionComplete(f)},_createTemplateElement:function(t,i){var r=document.createElement("script");return r.id=(this._id+t+i.field+n.inArray(i,this.getSheet(t).columns)+"_Template").split(" ").join(""),r.type="text/x-jsrender",r.text=i.templateContent?i.templateContent:n(i.templateID).html(),n("body").append(r),n(i.templateID).hide(),r},_refreshSpreadSheetPager:function(n){var t=this.getPager(),i={currentPage:this.getActiveSheetIndex()},u=t.height(),r;(this.isImport||this._isNew||t===null)&&(i.totalRecordsCount=this.model.sheetCount);(n||this._isInitLoad||this._isSheetInsert||this._isNew)&&(i.pageCount=this._getPageCount());t.ejPager("option",i).ejPager("refreshPager");this._updatePageContainer(t,i.currentPage);r=t.height();u!==r&&(i.pageCount=this._getPageCount(),t.ejPager("option",i).ejPager("refreshPager"),this._updatePageContainer(t,i.currentPage));this.model.allowInsert||this.addClass(document.getElementById(this._id+"_AddSheet"),"e-disable")},_updatePageContainer:function(t,i){var l,w,s,f,e,h,r=0,o=0,u=t.data("ejPager"),et=this.model.sheets,b=t.find(".e-numericcontainer").children(":visible"),k=u.model.pageCount,d=[u._$first[0],u._$prev[0]],g=["e-firstpagedisabled e-disable","e-firstpage e-default","e-prevpagedisabled e-disable","e-prevpage e-default"],nt=[u._$last[0],u._$next[0]],tt=["e-lastpagedisabled e-disable","e-lastpage e-default","e-nextpagedisabled e-disable","e-nextpage e-default"],it=b.length,ot=r+1===it;for(u._$next[0].className=u._$next[0].className.replace("-2x",""),u._$prev[0].className=u._$prev[0].className.replace("-2x","");r<it;){if(f=n(b[r]),s=f.data("index"),h=et[s].sheetInfo,e=h.text,ot){for(var v,st=t.outerWidth(),y,rt,p,ut=!0,c=e,ft=3,a=this._browserDetails.name==="msie"&&this._browserDetails.version==="8.0";ut;){if(a?(v=n("#"+this._id+"_emptySpan"),v.css({"font-size":f.css("font-size"),"font-family":f.css("font-family")}),y=248+(v.text(c).width()+19)):(rt=document.createElement("canvas"),p=rt.getContext("2d"),p.font=f.css("font-size")+" "+f.css("font-family"),y=248+(p.measureText(c).width+19)),st<=y&&e.length>=ft){c=e.slice(0,e.length-ft++)+"...";continue}ut=!1;e=c}a&&this._refreshGlobalSpan()}f.text(e);h.isVisible?w=s%k:f.hide();!l&&h.isVisible&&(l=s%k);r++}if(l===i)for(r=0;r<2;r++)this.addClass(d[r],g[o]),this._removeClass(d[r],g[o+1]),o+=2;if(o=0,w===i)for(r=0;r<2;r++)this.addClass(nt[r],tt[o]),this._removeClass(nt[r],tt[o+1]),o+=2},_updateSheetNames:function(i,r){var l,a,d,s,ht=this.getPager(),rt,v=ht.find(".e-currentitem"),y=this.model.sheets,g=n("#"+this._id+"_Sheet_RenamePanel"),ut=!0,b=[],nt,h,c,f,ft,et,ot,p,tt,u,o,e,w,st=[],k,it;if(t.isNullOrUndefined(i)&&(i=g.val().trim()),a=y[v.data("index")].sheetInfo.text,l={reqType:"renameSheet",prevName:a,newName:i},this._trigActionBegin(l)&&(r=!0),i=l.newName,r)return g.remove(),v.show(),this.model.showRibbon&&this.XLRibbon._enableRibbonIcons(),this.model.enableContextMenu&&n("#"+this._id+"_contextMenuFooter").data("ejMenu")._contextMenuEvents("_on"),this._isSheetRename=!1,!1;if(i.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*"))&&(i=!1),!i)return this._showAlertDlg("Alert",["SheetRenameEmptyAlert","SheetRenameEmptyCharExceedAlert","SheetRenameEmptySplCharAlert","SheetRenameEmptyBlankAlert"],"sheetRenameActn",500),!1;for(u=1,rt=y.length;u<rt;u++)v.text()!==y[u].sheetInfo.text&&i.toLowerCase()===y[u].sheetInfo.text.toLowerCase()&&(ut=!1);if(ut){if(this.model.enablePivotTable&&this.XLPivot._updateSheetName(i),y[v.data("index")].sheetInfo.text=i){g.remove();v.show();calcObj=this._calcEngine;k=calcObj.getDependentCells().items;for(it in k)k.hasOwnProperty(it)&&st.push(it);for(nt=st,h=this._getSheetNames(),u=0;u<nt.length;u++)for(c=k[nt[u]],o=0;o<c.length;o++){if(f=calcObj.getFormulaInfoTable().items[c[o]],f)for(f=f.getFormulaText(),e=0;e<h.length;e++)h[e].text!==h[e].value&&(p=new RegExp(h[e].value+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi"),f.match(p)&&(f=f.replace(p,e+"/"),b.push(e),tt=!0));if(tt){for(w=0;w<b.length;)p=new RegExp(b[w]+'/(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi"),f=f.replace(p,h[b[w]].text),w++;ft=calcObj.rowIndex(c[o])-1;et=calcObj.colIndex(c[o])-1;ot=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+(parseInt(c[o].split("!")[1])+1));this.XLEdit._updateDataContainer({rowIndex:ft,colIndex:et},{dataObj:{value:f},sheetIdx:ot});tt=!1}}this._isSheetRename=!1}this._refreshSpreadSheetPager(!0);this.model.allowFormulaBar&&this.updateFormulaBar();nMngr=this.model.nameManager;for(u in nMngr)s=nMngr[u].refersto,s&&s.indexOf(a)>-1&&(s=s.replace(/[\']/g,""),nMngr[u].refersto=s.replace(a,i.match(/\s/g)?"'"+i+"'":i));return this.model.showRibbon&&(this.XLRibbon._enableRibbonIcons(),d=n("#"+this._id+"_nmgrid").data("ejGrid"),d&&(d.refreshContent(),n("#"+this._id+"_nmrange").val(""))),this.model.enableContextMenu&&n("#"+this._id+"_contextMenuFooter").data("ejMenu")._contextMenuEvents("_on"),l={reqType:"renameSheet",prevName:a,newName:i},this._trigActionComplete(l),!0}this._showAlertDlg("Alert","SheetRenameAlert","sheetRenameActn",325)},_getSheetIndexByName:function(n){var i=this._getSheetNames(),t,r;for(n=n&&n.replace(/^'|'$/g,""),n&&(n=n.toLowerCase()),t=0,r=i.length;t<r;t++)if(i[t].text.toLowerCase()===n)return t+1;return!1},_removeSheet:function(t){var r=this.model.sheetCount,k=this._dataContainer.sheets,i,a=this.model.sheets,d,u,e,s,o,v=[],y,p,g,c,h,nt,w=[],f,b,l;if(r>1){if(c=a[t].sheetInfo.value,this._getAutoFillOptElem().appendTo(this.element),this.element.find("#"+this._id+"_"+c).remove(),r===this.getActiveSheetIndex()){for(i=1;i<r;i++)if(a[t-i].sheetInfo.isVisible){this.setActiveSheetIndex(t-i);break}}else this.setActiveSheetIndex(t);this._swapSheetDtCntr(t,r);r in k&&delete k[r];this._sheets.splice(r,1);a.splice(r,1);r=--this.model.sheetCount;this.getPager().ejPager("option",{totalRecordsCount:r,pageCount:this._getPageCount()});this.gotoPage(this.getActiveSheetIndex(),!1);this._getAutoFillOptElem().appendTo(this._getJSSheetContent(this.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content"));this._rebindScrollEvnt();h=this.model.nameManager;for(i in h)nt=h[i].refersto,nt.indexOf(c)>-1&&(w.push(h[i].name),h[i].refersto="#REF!");f=this._calcEngine;l=f.getDependentCells().items;for(i in l)l.hasOwnProperty(i)&&v.push(i);for(i=0;i<v.length;i++)for(e=l[v[i]],u=0;u<e.length;u++)if(s=f.getFormulaInfoTable().items[e[u]],p=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+(parseInt(e[u].split("!")[1])+1)),s&&p>-1){o=s.getFormulaText();y=new RegExp(c+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi");o.match(y)&&(o=o.replace(y,"#REF"),this.XLEdit._updateDataContainer({rowIndex:f.rowIndex(e[u])-1,colIndex:f.colIndex(e[u])-1},{dataObj:{value:o},sheetIdx:p}),f.refresh(s.getParsedFormula()));for(g in w)o.indexOf(w[g])>-1&&f.refresh(s.getParsedFormula())}if(this.model.showRibbon&&(b=n("#"+this._id+"_nmgrid").data("ejGrid"),b&&(b.refreshContent(),n("#"+this._id+"_nmrange").val(""))),d={sheetIndex:t,reqType:"remove-sheet"},this.clearUndoRedo(),this._trigActionComplete(d))return}},_rebindScrollEvnt:function(){for(var n=1;n<=this.model.sheetCount;n++)this.getSheet(n)._isLoaded&&(this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content").off("scroll"),this.element.find("#"+this._id+"_"+this.model.sheets[n].sheetInfo.value).find(".e-headercontent").off("scroll"),this._refreshScrollerEvent(n))},_getSheetNames:function(n){for(var u=[],i=this.model.sheets,t=1,r=i.length;t<r;t++)(this.isUndefined(n)||(!n||i[t].sheetInfo.isVisible)&&(n||!i[t].sheetInfo.isVisible))&&u.push(i[t].sheetInfo);return u},_initMoveCopyDlg:function(){var n=this._id+"_moveCopyDlg",i,r,f,e,o,s,u,h,c;i=t.buildTag("div#"+n,"",{display:"none"});r=t.buildTag("div#"+n+"_sheetContent.e-dlgctndiv e-dlg-fields",t.buildTag("label.e-dlg-fields",this._getLocStr("Beforesheet")));h=t.buildTag("div.e-dlg-fields");s=t.buildTag("ul#"+n+"_list");r.append(h.append(s));u=t.buildTag("input#"+n+"_createcopy");r.append(u);u.ejCheckBox({cssClass:"e-dlg-fields"});u.parent().append(t.buildTag("label",this._getLocStr("CreateaCopy"),{"margin-left":6}));i.append(r);o=t.buildTag("div#"+n+"_btndiv.e-dlg-btnfields");c=t.buildTag("div.e-dlg-btnctnr");f=t.buildTag("input#"+n+"_okbtn","");e=t.buildTag("input#"+n+"_cnlbtn");f.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,click:t.proxy(this._moveCopyBtnClick,this,"ok"),cssClass:"e-ss-okbtn",width:60});e.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._moveCopyBtnClick,this,"cancel"),showRoundedCorner:!0,width:60});o.append(c.append(f,e));i.append(o);this.element.append(i);i.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("MoveorCopy"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg e-ss-movedlg"});s.ejListBox({dataSource:this._getSheetNames(),height:"197px",width:"250px",fields:{text:"text",value:"value"}})},_renderMoveCopyDlg:function(){var r=n("#"+this._id+"_moveCopyDlg"),t=n("#"+this._id+"_moveCopyDlg_list").data("ejListBox"),i=this._getSheetNames();i.push({text:this._getLocStr("MoveToEnd"),value:this._getLocStr("MoveToEnd")});r.ejDialog("open");t.model.dataSource=i;t.option("fields",{dataSource:i});t.unSelectAll();t.selectItemByIndex(0)},_initUnhideDlg:function(){var n=this._id+"_UnhideDlg",i,r,u,f,e,o,s;i=t.buildTag("div#"+n,"",{display:"none"});r=t.buildTag("div#"+n+"_sheetContent.e-dlgctndiv e-dlg-fields",t.buildTag("label.e-dlg-fields",this._getLocStr("UnhideDlgText")));o=t.buildTag("ul#"+n+"_list");r.append(o);i.append(r);e=t.buildTag("div#"+n+"_btndiv.e-dlg-btnfields");s=t.buildTag("div.e-dlg-btnctnr");u=t.buildTag("input#"+n+"_okbtn");f=t.buildTag("input#"+n+"_cnlbtn");u.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:"25%",click:t.proxy(this._unhideBtnClick,this,"ok"),cssClass:"e-ss-okbtn"});f.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._unhideBtnClick,this,"cancel"),showRoundedCorner:!0,width:"25%"});e.append(s.append(u,f));i.append(e);this.element.append(i);i.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("UnhideSheet"),width:280,height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg"});o.ejListBox({dataSource:this._getSheetNames(),height:"197px",width:"250px",fields:{text:"text",value:"value"}})},_renderUnhideDlg:function(){var r=n("#"+this._id+"_UnhideDlg"),t=n("#"+this._id+"_UnhideDlg_list").data("ejListBox"),i=this._getSheetNames(!1);i.length>0&&(r.ejDialog("open"),t.model.dataSource=i,t.option("fields",{dataSource:i}),t.unselectAll(),t.selectItemByIndex(0))},_moveCopyBtnClick:function(i){switch(i){case"ok":var c,r,u,y,e,p=!1,l=2,f,o=n(this.element).find(".e-currentitem"),w=n("#"+this._id+"_moveCopyDlg_list").data("ejListBox"),h=n("#"+this._id+"_moveCopyDlg_createcopy").data("ejCheckBox"),v=w.getSelectedItems()[0].text,s=w.getIndexByText(v),a=this.model.sheets;if(!h.isChecked()&&v===o.text()){n("#"+this._id+"_moveCopyDlg").ejDialog("close");this.setSheetFocus();return}for(u=1;u<a.length;u++)v===a[u].sheetInfo.text&&(r=u),o.text()===a[u].sheetInfo.text&&(f=u);if(c={reqType:"moveSheet",toSheetIndex:s,fromSheetIndex:f,isCopy:h.isChecked()},this._trigActionBegin(c))return n("#"+this._id+"_moveCopyDlg").ejDialog("close"),!1;if(s=c.toSheetIndex,f=c.fromSheetIndex,h.isChecked()){for(o.text().match(".*[ ]+[(]+[0-9]+[)]$")===null?e=o.text()+" ("+l+")":o.text().lastIndexOf(" ")!==-1&&(l=parseInt(o.text().substring(o.text().lastIndexOf("(")+1,o.text().lastIndexOf(")"))),e=o.text().substring(0,o.text().lastIndexOf(" "))+" ("+l+")");!p;){for(e=e.substring(0,e.lastIndexOf(" "))+" ("+l+")",u=1,y=a.length;u<y;u++)e===a[u].sheetInfo.text&&l++;l===parseInt(e.substring(e.lastIndexOf("(")+1,e.lastIndexOf(")")))&&(p=!0)}this._copySheetProcess(f,e);f=this.model.sheetCount;t.isNullOrUndefined(r)&&(r=f)}else!t.isNullOrUndefined(r)&&r>f&&(r=r-1);if(t.isNullOrUndefined(r)&&(r=s),!h.isChecked()&&r===f){n("#"+this._id+"_moveCopyDlg").ejDialog("close");this.setSheetFocus();break}this._swapSheetDtCntr(f,r);n("#"+this._id+"_moveCopyDlg").ejDialog("close");r<=f&&(s=s+1);this.getPager().ejPager("option",{currentPage:s});this.gotoPage(s,!1);this._rebindScrollEvnt();c={reqType:"moveSheet",toSheetIndex:s,fromSheetIndex:f,isCopy:h.isChecked()};this._trigActionComplete(c);h._unChecked();h._isChecked=!1;this.setSheetFocus();break;case"cancel":n("#"+this._id+"_moveCopyDlg").ejDialog("close")}},_unhideBtnClick:function(t){if(t==="ok"){var i=n("#"+this._id+"_UnhideDlg_list").data("ejListBox");this.unhideSheet(i.getSelectedItems()[0].text)}n("#"+this._id+"_UnhideDlg").ejDialog("close")},_swapSheetDtCntr:function(n,t){var f=this._dataContainer.sheets,i=this.model.sheets,e=this._sheets,o=this._getLocStr("Sheet"),s=[{}],h,l=this._getSheetNames(),u,r,c;for(u in f)f.hasOwnProperty(u)&&(s[parseInt(i[u].sheetInfo.value.replace(o,""))]=f[u]);for(i.splice(t,0,i.splice(n,1)[0]),e.splice(t,0,e.splice(n,1)[0]),r=1,c=i.length;r<c;r++)h=parseInt(i[r].sheetInfo.value.replace(o,"")),this._dataContainer.sheets[r]=s[h];this.clearUndoRedo()},_copySheetProcess:function(t,i){var e,p,r,h,c,u,a=this.getPager(),v=a.ejPager("option","totalRecordsCount")+1,o=this.model.sheets,l,y,f,s;for(this._impData&&this.XLExport._renderAll(),a.ejPager("option",{totalRecordsCount:v,currentPage:v}),o.push(jQuery.extend(!0,{},o[t])),this._sheetCopy={isSheetCopy:!0,sheetContent:this._getContent(t).find(".e-table").clone(!0).get(0)},r=this.model.sheetCount+1,o[r].sheetInfo.text=i,h=o[r].sheetInfo.value=this._getLocStr("Sheet")+this._newSIndex,this._newSIndex++,this.setActiveSheetIndex(r),this._dataContainer.sheets[r]=n.extend(!0,{},this._dataContainer.sheets[t]),p=this._sheets[r]={_contentColGroup:null,_content:null,_sheetRowHeaderContent:null,_sheetHeader:null,_sheetRowHeader:null,_sheetContent:null,_Rows:null},this._initSheet(r),this.model.sheetCount++,this._sheetCopy={isSheetCopy:!1,sheetContent:null},this._calcEngine.registerGridAsSheet(h,h,this._calcID),c=o[r].shapeMngr.picture,s=this.getObjectLength(c),f=1;f<=s;f++)u=c[this._id+"_picture"+f],this.XLShape._createPicture(r,{rowIndex:u.rowIndex,colIndex:u.colIndex},this.getSheet(r).shapeMngr.sharedPics[u.data],u.top,u.left,u.width,u.height,null,u.bcolor,u.bstyle,u.bwidth);if(!this.model.scrollSettings.allowVirtualScrolling)for(l=this._getContent(r).find(".e-commentcell"),f=0,s=l.length;f<s;f++)y=n(l[f]),e=this._getCellIdx(n(".e-commentcell")[0]),y.removeClass("e-commentcell")&&this.XLComment.setComment([e.rowIndex,e.colIndex,e.rowIndex,e.colIndex],null,!1);this.model.allowComments&&this.XLComment._updateCmntArrowPos()},showActivationPanel:function(n){var i,t=this.getActiveSheetIndex(),r=this.getActivationPanel(),u=this.model.scrollSettings;if(!this.model.enablePivotTable||this._phoneMode)return!1;if(this.isUndefined(n))this._getContent(t).find(".e-ss-activepivot").length&&this.XLPivot._displayActPanel&&(this.model._isActPanelVisible=!0,this._setSheetWidthHeight(t,{width:this._responsiveWidth,height:this._responsiveHeight,isActPanel:!0},null,"refresh"),this._refreshActivationPanel());else if(i=this.getSheet(t).rangeSettings[n],i.showPanel){if(this._trigger("beforePanelOpen",{activationPanel:r,range:i,sheetIndex:t}))return;this.model._isActPanelVisible=!0;this._setSheetWidthHeight(t,{width:this._responsiveWidth,height:this._responsiveHeight,isActPanel:!0},null,"refresh");this._refreshActivationPanel()}},_refreshActivationPanel:function(){var n=this.getActivationPanel(),i=this.getMainPanel().height(),t=n.data("ejScroller"),r;n.width(this.model.activationPanelWidth-1).height(i);n.find(".e-ss-pivotfield").hide();n.find("#"+this._id+"_PivotTableSchema_"+this._getContent(this.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).show();n.find(".e-ss-pivotfield").width(this.model.activationPanelWidth-20);n.show();r=this.getActivationPanel().find("#"+this._id+"_PivotTableSchema_"+this._getContent(this.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).data("ejPivotSchemaDesigner");r._reSizeHandler();t&&(t.option({width:this.model.activationPanelWidth-1,height:i}),t.refresh())},hideActivationPanel:function(){var n=this.getActivationPanel(),t=this.model.scrollSettings;n.is(":visible")&&(n.find(".e-ss-pivotfield").hide(),this.model._isActPanelVisible=!1,n.hide(),this._isNew||this._setSheetWidthHeight(this.getActiveSheetIndex(),{width:this._responsiveWidth,height:this._responsiveHeight},null,"refresh"))},_addSheet:function(n){this._sheetSettings(n);this._dataContainer.sheets[n]={};this._initSheet(n);this._newSIndex++;this.model.sheetCount++},addNewSheet:function(){this.model.allowInsert&&!this.model.isReadOnly&&this.element.find(".e-pager .e-new").click()},_createFocusElement:function(){this.setFocusTopElem(n("<div class='e-focustop e-hide' ><\/div>"));this.setFocusRightElem(n("<div class='e-focusright e-hide' ><\/div>"));this.setFocusBottomElem(n("<div class='e-focusbottom e-hide' ><\/div>"));this.setFocusLeftElem(n("<div class='e-focusleft e-hide' ><\/div>"))},_createAutoFillElement:function(){var i,r=this._getJSSheetContent(this.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content");this.model.allowAutoFill&&(i=n("<div class='e-autofill e-hide'><\/div>"),r.append(i),this.setAutoFillElem(i));this.element.append(t.buildTag("ul.e-spreadsheet","",{width:"auto"},{id:this._id+"_ctxtmenu"}));i=n("<div class='e-splitspan e-hide' title="+this._getLocStr("AutoFillTitle")+"><button id="+this._id+"_dragfilloptionbtn type='button'><\/button><\/div>");r.append(i);this._setAutoFillOptElem(i);this._initializeSplitButton()},_initializeSplitButton:function(){this._getAutoFillOptElem().find("button").ejSplitButton({size:"normal",contentType:"imageonly",targetID:this._id+"_ctxtmenu",prefixIcon:"e-icon e-ss-autofill",isSeparator:!1,buttonMode:t.ButtonMode.Dropdown,imagePosition:t.ImagePosition.ImageLeft,arrowPosition:t.ArrowPosition.Right,fields:{dataSource:this._fillOptionMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},beforeOpen:n.proxy(this.model.allowAutoFill&&this.XLDragFill._autoFillClick,this),itemSelected:n.proxy(this.model.allowAutoFill&&this.XLDragFill._autoFillOptionClick,this),width:"42px",height:"24px",cssClass:"e-spreadsheet e-autofillbtn"})},_renderFormulaBar:function(t){var i,r="<div id="+this._id+"_formulabar class='e-formulabar' ><div id="+this._id+"_indexbox class='e-indexbox' title='"+this._getLocStr("NameBox")+"'><\/div><div class='e-inputbox' ><input id="+this._id+"_inputbox type='text' title='"+this._getLocStr("FormulaBar")+"'/><\/div><\/div>",u;t?this.model.showRibbon?n("#"+this._id+"_Ribbon").after(r):this.element.prepend(r):this.element.append(r);this._setIndexBox(n("#"+this._id+"_indexbox"));i=n("#"+this._id+"_inputbox");this._setInputBox(i);this.XLEdit._renderAutoComplete(i,"",26);this._alignFormulaBar();u=this.element.find(".e-formulabar").height();u>36&&(this._formulaHeight=u);this.model.isReadOnly&&(this.element.find(".e-formulabar")[0].disabled=!0)},_alignFormulaBar:function(n){var u=this.model.scrollSettings,i,r,t;n=n||this._responsiveWidth;this.element.find(".e-formulabar").width(u.isResponsive?n-2:n);n=parseInt(n);i=n/10;r=n-(i+24);t=this.element.find(".e-inputbox");t.hide();t.width(Math.floor(r));this.element.find(".e-indexbox").width(Math.floor(i));t.show()},hideFormulaBar:function(){n("#"+this._id+"_formulabar").hide()},showFormulaBar:function(){this.model.allowFormulaBar&&(n("#"+this._id+"_formulabar").show(),this.updateFormulaBar())},_getlocaleNumVal:function(n,i){if(n=typeof n!="object"&&Number(n)?Number(n):!t.isNullOrUndefined(n)&&typeof n!="object"?t.parseFloat(n+"",this.model.locale):null,n&&i){var r=t.preferredCulture(this.model.locale).numberFormat,u=n.toString();r["."]!="."&&u.indexOf(r["."])<0&&(n=u.replace(".",r["."]))}return n},updateFormulaBar:function(){if(!this.model.isReadOnly){var r,u,o,e=this.getActiveSheetIndex(),i=this.getSheet(e)._activeCell,f=this._getContent(e).find(".e-ss-activeimg")[0];u=this.getRangeData({range:[i.rowIndex,i.colIndex,i.rowIndex,i.colIndex],property:["value","value2","isLocked"]})[0];r=t.isNullOrUndefined(u)?"":t.isNullOrUndefined(u.value)?"":u.value;this._isDateTime(r)&&(r=u.value2);this.isNumber(r)&&(r=this._getlocaleNumVal(r,!0));this._getInputBox().val(r);this.XLEdit.getPropertyValue(i.rowIndex,i.colIndex,"isReadOnly")||this.model.allowLockCell&&this.getSheet(e).isSheetProtected&&u.isLocked?this._getInputBox().attr("readonly","readonly"):this._getInputBox().prop("readonly",!1);o=f&&(f.id.indexOf(this._id+"_picture")>-1||f.id.indexOf(this._id+"_chart")>-1)?f.id.replace(n(f).data("parentID")+"_",""):this._generateHeaderText(i.colIndex+1)+(i.rowIndex+1);this._getIndexBox().html(o)}},_initSelection:function(){var r,i=this.model,f=this.getActiveSheetIndex(),n=this.getSheet(f),u=this._getJSSheetContent(f).find(".e-spreadsheetcontentcontainer > .e-content"),e=i.selectionSettings.selectionType,o=t.Spreadsheet.SelectionType,s=i.selectionSettings.activeCell;i.allowSelection&&(this.getFocusTopElem()||this._createFocusElement(),u.append(this.getFocusTopElem(),this.getFocusRightElem(),this.getFocusBottomElem(),this.getFocusLeftElem()),s&&(r=this.getRangeIndices(s),!this.isRange(r)&&r[0]<n.rowCount&&r[1]<n.colCount&&(n._startCell=n._endCell=n._activeCell={rowIndex:r[0],colIndex:r[1]})),(!n._isImported||n._isLoaded)&&n._selectedCells.length?(this.XLSelection.selectRange(n._selectedCells[0],n._selectedCells[n._selectedCells.length-1]),this.XLSelection._refreshBorder()):(this.XLSelection._processBoundary(),e===o.Row||n._isRowSelected?this.XLSelection.selectRows(n._startCell.rowIndex,n._endCell.rowIndex):e===o.Column||n._isColSelected?this.XLSelection.selectColumns(n._startCell.colIndex,n._endCell.colIndex):this.XLSelection.selectRange(n._startCell,n._endCell)));i.allowAutoFill&&(this.getAutoFillElem()||this._createAutoFillElement(),this.getAutoFillElem().appendTo(u),this.XLDragFill.positionAutoFillElement(),i.autoFillSettings.showFillOptions&&i.allowAutoFill&&(this._getAutoFillOptElem().appendTo(u),this.XLDragFill.hideAutoFillOptions()));i.allowSelection&&n._isFreezed&&this.XLFreeze._refreshSelection()},_updateRibbonTab:function(t){var i,u,r=this.getActiveSheetIndex(),o=n("#"+this._id+"_Ribbon").data("ejRibbon"),f=this.XLRibbon,s=this.element.find(".e-ribbon .e-contextual a:visible"),e=s.length,h=o.element.find("#"+this._id+"_Ribbon_togglebutton");if(t&&(u=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"tableName",r)),e)while(e--)o.hideTab(s[e].text);f._toggleAnalyzeTab();h.is(":visible")&&h.hasClass("e-ribbonpin")&&this._refreshSheetonResize();i=this._getContent(r).find(".e-ss-activeimg");i.length?i[0].id.indexOf("chart")>-1?this.XLRibbon._chartDesignTabUpdate(i):this.XLRibbon._formatTabUpdate():u?f._designTabUpdate(this._getTableID(u),t):this._getContent(r).find(".e-ss-activepivot").length&&(f._analyzeTabUpdate(),this.XLSelection._cleanUp(!0),this.getActivationPanel().find("#"+this._id+"_PivotTableSchema_"+this._getContent(r).find(".e-ss-activepivot")[0].id).show(),this.showActivationPanel())},_updateCellType:function(){var n,i=t.Spreadsheet.CellType;for(n in i)this._dataContainer.cellType.push(i[n])},_updateFormulaCollection:function(){var n,i=this._calcEngine.getLibraryFunctions(),t=[];for(n in i.items)t.push({text:"="+n,display:n});this._formulaCollection=t},_renderScroller:function(n,t,i){this.XLScroll._createScroller(n,t,i);this._refreshScrollerEvent(n)},_refreshScrollerEvent:function(i){this._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").scroll(t.proxy(function(t){var i=this.getActiveSheetIndex(),r=this.getSheet(i),u=this._isFrozen(this.getFrozenColumns(i))?n(t.target).scrollLeft():r._scrollLeft;this._getJSSheetHeader(i).find(".e-headercontent").scrollLeft(u);this._getJSSheetRowHeaderContent(i).scrollTop(n(t.currentTarget).scrollTop())},this));this.element.find("#"+this._id+"_"+this.model.sheets[i].sheetInfo.value).find(".e-headercontent").scroll(t.proxy(function(t){var i=this.getActiveSheetIndex(),r=this._isFrozen(this.getFrozenColumns(i))?n(t.target).scrollLeft():this.getSheet(i)._scrollLeft;this._getContent(i).find(".e-content").scrollLeft(r);this.getSheet(i)._scrollLeft=this._getContent(i).find(".e-content").scrollLeft()},this))},_clickHandler:function(i){if(this.XLEdit._isFEdit=!1,this._hasClass(i.target,"e-ssfilter"))this._excelFilter._openedFltr&&n(this._excelFilter._openedFltr).is(":visible")?this._excelFilter.closeXFDialog():this.XLFilter._filterClickHandler(i);else{if(this._isExport||!this.model.cellClick)return!1;var o,r=i.target,s=this.getActiveSheetIndex(),u,f,e;if(i.target.tagName==="TD"&&n(i.target).parents("div")[0].className.indexOf("e-content")>-1&&i.target.className.indexOf("e-rowcell")>-1&&n(i.target).find(".e-chk-image").length<1){if(u=r.cellIndex,f=n.inArray(n(r).closest("tr").get(0),this.getRows(s)[1]),e=this.getSheet(s).columns[u],o={columnName:e.field,value:this.XLEdit.getPropertyValue(f,u),columnIndex:u,rowIndex:f,columnObject:e,cell:r,eventArgs:i,event:i,target:i.target},this._trigger("cellClick",o))return}else if(!t.isNullOrUndefined(n(i.target).parents("div"))&&n(i.target).parents("div")[0].className.indexOf("e-content")>-1&&i.target.className.indexOf("e-rowcell")>-1&&n(i.target).find(".e-chk-image").length<1&&(r=n(i.target).parents("td").get(0),!t.isNullOrUndefined(r)&&(u=r.cellIndex,f=n.inArray(n(r).closest("tr").get(0),this.getRows(s)[1]),e=this.getSheet(s).columns[u],o={columnName:e.field,value:this.XLEdit.getPropertyValue(f,u),columnIndex:u,rowIndex:f,columnObject:e,cell:r,eventArgs:i,event:i,target:i.target},this._trigger("cellClick",o))))return}},_wireEvents:function(t){var i=this.element,r=this._id;this.model.enableTouch&&parseInt(this._browserDetails.version)>8?this._wireTouchEvts("_on"):this._wireTouchEvts("_off");this[t](i,"mousedown",".e-spreadsheetcontentcontainer .e-content, .e-spreadsheetrowheader, .e-spreadsheetheader, .e-spreadsheetactpanel, .e-ribbon, .e-spreadsheetcontentcontainer .e-vscroll, .e-spreadsheetcontentcontainer .e-hscroll",this._mouseDownHandler);this[t](i,"mousemove",this._mouseMoveHandler);this[t](i,"mouseup",this._mouseUpHandler);this[t](i,"keydown",this._keyDownHandler);this[t](i,"keyup",this._keyUpHandler);this[t](i,"click",".e-spreadsheetcontentcontainer .e-content,.e-spreadsheetrowheader,.e-spreadsheetheader,.e-spreadsheetactpanel, .e-ss-object",this._clickHandler);this[t](i,n.isFunction(n.fn.doubletap)&&this.model.enableTouch&&parseInt(this._browserDetails.version)>8&&!this._browserDetails.isMSPointerEnabled?"doubletap":"dblclick",".e-spreadsheetcontentcontainer, .e-spreadsheetheader, .e-spreadsheetrowheader, .e-numericcontainer .e-numericitem",this._dblClickHandler);this[t](i,"mouseleave",".e-spreadsheetrowheader, .e-spreadsheetheader, .e-viewhdrlbl, .e-vheading, .e-viewlinlbl, .e-vgridlines",this._mouseLeaveHandler);this[t](i,"mouseover",".e-spreadsheetcontentcontainer .e-content .e-rowcell, .e-viewhdrlbl, .e-vheading, .e-viewlinlbl, .e-vgridlines, .e-rowheadercontent, .e-vscrollbar, .e-hscrollbar, .e-spreadsheetfooter, .e-spreadsheetheader",this._mouseHoverHandler);this.model.allowFormulaBar&&this[t](this._getInputBox(),"input",this.XLEdit._formulaBoxInputChange);this[t](n(".e-"+r+".e-chartcell"),"click",this._chartClickHandler);this[t](n("#"+r+"_cellstyles"),"click",this._cellStyleClick);this[t](n("#"+r+"_formatastable"),"click",this._formatAsTableClick);this[t](n("#"+r+"_nmuseinformula"),"click",".e-nmuseinformularow",this._useInFormulaClick);this.model.scrollSettings.allowScrolling&&this[t](this.element.find(".e-spreadsheet-list"),"mousewheel DOMMouseScroll",n.proxy(this.XLScroll._spreadMouseWheel,this.XLScroll));this.model.scrollSettings.isResponsive&&this[t](n(window),"resize",n.proxy(this._resizeHandler,this))},_wireTouchEvts:function(n){(this._browserDetails.name!="msie"||["11.0","10.0"].indexOf(this._browserDetails.version)===-1)&&this[n](this.element,this._getBrowserEvt(),".e-spreadsheetcontentcontainer .e-content, .e-spreadsheetrowheader, .e-spreadsheetheader, .e-spreadsheetactpanel, .e-ribbon, .e-spreadsheetcontentcontainer .e-vscroll, .e-spreadsheetcontentcontainer .e-hscroll",this._mouseDownHandler);this[n](this.element,this._getBrowserEvt("move"),this._mouseMoveHandler);this[n](this.element,this._getBrowserEvt("end"),this._mouseUpHandler);this[n](this.element,"swipeleft swiperight",".e-spreadsheetfooter",this._swipeHandler)},_getBrowserEvt:function(n,t){return n==="move"?this._browserDetails.isMSPointerEnabled?this._browserDetails.pointerEnabled?"pointermove":"MSPointerMove":t?"mousemove":"touchmove":n==="end"?this._browserDetails.isMSPointerEnabled?this._browserDetails.pointerEnabled?"pointerup":"MSPointerUp":t?"mouseup":"touchend":this._browserDetails.isMSPointerEnabled?this._browserDetails.pointerEnabled?"pointerdown":"MSPointerDown":"touchstart"},_swipeHandler:function(n){var t=this.getActiveSheetIndex();this.gotoPage(n.type==="swiperight"?--t:++t)},_isTouchEvent:function(n){return this.model.enableTouch&&(n.type.indexOf("touch")>-1||n.type.indexOf("pointer")>-1)&&n.originalEvent.pointerType!=="mouse"&&n.originalEvent.pointerType!==4?!0:!1},_getOriginalEvt:function(n){return n.originalEvent.changedTouches?n.originalEvent.changedTouches[0]:n.originalEvent},_allChartType:function(t){n("#"+this._id+"_allchart").find(".e-chartimg").removeClass("e-chartselect");n(t.target).addClass("e-chartselect")},refreshSpreadsheet:function(){this._responsiveHeight>350&&(this._refreshSheetonResize(),this.model.showRibbon&&n("#"+this._id+"_Ribbon").data("ejRibbon")._ribbonResize())},_resizeHandler:function(){var t,n=this;n.element.is(":hidden")||(t&&clearTimeout(t),t=setTimeout(function(){n._refreshSheetonResize();for(var t=1,i=n.model.sheets.length;t<i;t++)n.getSheet(t)._isResized=t!=n.getActiveSheetIndex()},100))},_refreshSheetonResize:function(){var i=this.getActiveSheetIndex(),u,h=n(".e-menu:visible[id^="+this._id+"], .e-ddl-popup:visible[id^="+this._id+"]"),t,r,c=["CFormat","Validation","PageSize","FPane","Ins","Del","FindRep"],e,l,v=this._phoneMode,o,s,f,a;if(this._resizeColl[i-1]=this._isResized=!0,this.element.find(".e-inputbox").hide(),this.model.enablePivotTable&&this.hideActivationPanel(),this._phoneMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth<420,this._tabMode=this.model.scrollSettings.isResponsive&&document.documentElement.clientWidth>419&&document.documentElement.clientWidth<617,u={width:this._responsiveWidth,height:this._responsiveHeight},this.model.showRibbon&&(this._tabMode||this._responsiveHeight<280)&&n("#"+this._id+"_Ribbon").ejRibbon("collapse"),this._refreshSheetWithScreen(i),this._updateResponsiveSettings(),this._initViewPort(i),this.refreshContent(i),u.width=this._responsiveWidth,u.height=this._responsiveHeight,this._setSheetWidthHeight(i,u,null,"refresh"),contentrows=this._getContTBody(i).find("tr"),rowhdrrows=this._getRowHdrTBody(i).find("tr"),this.setRows([rowhdrrows,contentrows],i),this._dlgWidth=this._phoneMode||this._tabMode||this._responsiveWidth<350?this._responsiveWidth-2:this._responsiveWidth/1.5,this._dlgHeight=this._phoneMode||this._tabMode||this._responsiveHeight<350?this._responsiveHeight-2:this._responsiveHeight/1.2,this.model._isActPanelVisible&&this._refreshActivationPanel(),this.element.find(".e-inputbox").show(),this.model.showPager&&(this._isSheetRename&&(e=this.getPager().find("#"+this._id+"_Sheet_RenamePanel"),l=e.val(),e.remove()),this._refreshSpreadSheetPager(!0),this._isSheetRename&&this._renameSheet(l)),this._phoneMode&&(n("#"+this._id+"_CFormat").css("width",""),n("#"+this._id+"_Ribbon_Border").css("width",""),n("#"+this._id+"_indexbox").css({"text-overflow":"ellipsis",overflow:"hidden"})),this.model.showRibbon&&(this.XLRibbon._refreshBackstageHeight(),this._phoneMode&&!v&&this.XLRibbon._hideRibbonElem()),h.length&&(t=h[0].id.split("_",3),t.indexOf("Ribbon")===-1&&t.splice(1,0,"Ribbon"),t[2]=c.indexOf(t[2])>-1?["Home_Styles_ConditionalFormatting","Data_DataTools_DataValidationOptions","PageLayout_PageLayout_PageSizeOptions","Others_Window_FreezePanes","Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Editing_FindSelect"][c.indexOf(t[2])]:t[2].toLowerCase(),t=t.join("_"),t.length&&(r=n("#"+t),r.hasClass("e-splitbutton")&&r.ejSplitButton("hide"),r.hasClass("e-dropdownlist")&&r.ejDropDownList("hidePopup"))),this._isResized=!1,this._isRibbonDestroyed){if(o=n("#"+this._id+"_Ribbon").ejRibbon("instance"),this.model.ribbonSettings.enableOnDemand)tabText=o.getTabText(o.model.selectedItemIndex),this.XLRibbon._createTabControls(tabText);else for(s=[this._getLocStr("HOME"),this._getLocStr("DATATAB"),this._getLocStr("PAGELAYOUT"),this._getLocStr("OTHERS")],f=0,a=s.length;f<a;f++)this.XLRibbon._updateRibCustomCss(s[f]);this._on(n(".e-"+this._id+".e-chartcell"),"click",this._chartClickHandler);this._on(n("#"+this._id+"_cellstyles"),"click",this._cellStyleClick);this._on(n("#"+this._id+"_formatastable"),"click",this._formatAsTableClick)}this._isRibbonDestroyed=!1;this._trigger("refresh")},_chartClickHandler:function(t){var i=n(t.target),r=n.extend(!0,{},n(t.target).data());i.parents().eq(1).hide();this.XLChart.createChart(null,r)},_useInFormulaClick:function(t){var i,r,e="=",o=!1,u=t.target.textContent,c=this.getActiveSheetIndex(),s=this.getActiveCell(c),f=this.XLEdit._editElem,h=f.text();if(this.XLEdit.editCell(s.rowIndex,s.colIndex,!0),h===e)f.text(e+u);else{if(r=this.XLDragFill._parseFormula(h),i=r.length,i){while(i--)if(r[i]===","||r[i]==="("){r.splice(i+1,0,u);o=!0;break}else if(this._isCellReference(r[i])||this.isNumber(r[i])){r[i]=u;o=!0;break}u=o?r.join(""):u}f.text(e+u)}f.focusEnd();n("#"+this._id+"_nmuseinformula").hide()},_formatAsTableClick:function(t){var u,f,i=t.target,e=this.getActiveSheetIndex(),o=this.getSheet(e),r=o._selectedCells;r.length!==0&&(i.parentNode.className==="e-formatastablecell"&&(u=this.XLEdit.getPropertyValue(r[0].rowIndex,r[0].colIndex,"tableName",e),this._showDialog(this._id+"_Ribbon_Insert_Tables_Table"),u?(this.XLFormat._formatAsTableStyle=this._FATStyles[i.parentNode.id.replace(/ /g,"")],this.XLFormat._createTable(this._getTableID(u),this.XLFormat._formatAsTableStyle)):r.length>1?(f=n("#"+this._id+"_fatname"),n("#"+this._id+"_fatnamedlg").ejDialog("open"),n("#"+this._id+"_fatheader").data("ejCheckBox").option("checked",!1),f.val("Table"+this._tableCnt).focus().setInputPos(f.val().length),this.model.allowCellFormatting&&(this.XLFormat._formatAsTableStyle=this._FATStyles[i.parentNode.id.replace(/ /g,"")])):this._showAlertDlg("Alert","FormatAsTableAlert",null,445)),(i.className.indexOf("back")>-1||i.parentNode.className==="e-formatastablecell")&&n("#"+this._id+"_Ribbon_Home_Styles_FormatAsTable").length&&n("#"+this._id+"_Ribbon_Home_Styles_FormatAsTable").data("ejSplitButton")._hidePopup())},_borderSelectionClick:function(t){var r={ID:t.target.parentNode.id},u,f=t.target,e=this.getActiveSheetIndex(),i=this.getSheet(e)._selectedCells;i.length!==0&&(this._borderStyles.indexOf(r.ID)>-1&&this.XLRibbon._updateBordeStyle(r),hexcode=this._borderColor||"#000000",u=this._getAlphaRange(e,i[0].rowIndex,i[0].colIndex,i[i.length-1].rowIndex,i[i.length-1].colIndex),this.model.allowSelection&&(this.XLSelection._isOutsideBordering||this.XLSelection._isGridBordering)?!(this._borderStyles.indexOf(r.ID)>-1)&&r.ID.indexOf("bordercolor")<0&&(this.XLSelection._isOutsideBordering=this.XLSelection._isGridBordering=!1):this.setBorder({type:r.ID,color:hexcode,style:this._borderStyle},u),(f.className.indexOf("back")>-1||f.parentNode.className==="e-bordercell")&&n("#"+this._id+"_bordercontainer").hide())},_getTableID:function(n,t){var i,r=this.getSheet(this.getActiveSheetIndex()).tableManager;if(t){for(i in r)if(t===r[i].name)return Number(i)}else for(i in r)if(n.indexOf("e-table"+i)>-1)return Number(i)},_cellStyleClick:function(t){var i=this.model.sheets[this.getActiveSheetIndex()].selectedRange,r=t.target.className,f=this.XLFormat.getFormatClass(r),u={range:i,sheetIndex:this.getActiveSheetIndex(),reqType:"cell-styles",opr:t.target.innerText,beforeFormat:this.getRangeData({range:i,property:["format","formats"]})};r.indexOf("e-cellstylecell")>-1&&this.XLFormat.updateUniqueFormat(f,i,t.target.innerText);(r.indexOf("e-cellstylecell")>-1||r.indexOf("back")>-1)&&n("#"+this._id+"_Ribbon_Home_Styles_CellStyles").length&&n("#"+this._id+"_Ribbon_Home_Styles_CellStyles").data("ejSplitButton")._hidePopup();u.afterFormat=this.getRangeData({range:i,property:["format","formats"]});this.isUndoRedo||(this._completeAction(u),this._trigActionComplete(u));this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()},_mouseHoverHandler:function(t){var i=t.target,r;this._hasClass(t.target,"e-viewhdrlbl")||this._hasClass(t.target,"e-vheading")?this.element.find(".e-vheading .e-chk-act, .e-vheading .e-chk-inact").addClass("e-chkhover"):this._hasClass(t.target,"e-viewlinlbl")||this._hasClass(t.target,"e-vgridlines")?this.element.find(".e-vgridlines .e-chk-act, .e-vgridlines .e-chk-inact").addClass("e-chkhover"):this.model.allowDragAndDrop&&this.XLDragDrop._allowDragAndDrop&&(n(t.target).parents(".e-vscrollbar").length>0||t.target.className.indexOf("e-rowheader")>-1||n(t.target).parents(".e-spreadsheetfooter").length>0||t.target.className.indexOf("e-headercell")>-1||t.target.className.indexOf("e-spreadsheetfooter")>-1||n(t.target).parents(".e-hscrollbar").length>0||this.getSheet()._isFreezed&&t.target.className.indexOf("e-rowcell")>-1)?this.XLDragDrop._scrollHover(t):this._hasClass(t.target,"e-rowcell")&&(r=this._getCellIdx(i),this._trigger("cellHover",{target:i,event:t,cellIndex:r}))},_mouseDownHandler:function(i){var o,a,y,p,f,s,h,w,b,k,g=!0,nt=!0,v="e-ss-object",c="e-ss-pivot",r=i.target,u=n(r),e=this.getActiveSheetIndex(),d=this.getSheet(e),tt=this.getSheetElement(e),l=n("#"+this._id+"_Ribbon").data("ejRibbon");if(i.currentTarget.className.indexOf("e-ribbon")<0&&this.element.find(".e-bordercontainer").hide(),this.element.find("#"+this._id+"ddl_popup").has(r).length)return!1;if(this._isTouchEvt=this._isTouchEvent(i),this._isTouchEvt&&(this._touchArgs=i,this._startXY=this._setXY(i,navigator.userAgent.indexOf("WebKit")>-1),this.model.allowDragAndDrop&&this.XLDragDrop._dragtouch(this._startXY[0],this._startXY[1]),!this._hasClass(r,"e-autofill")&&this.model.allowAutoFill&&(y=this._hasClass(r,"e-headercell")?10:20,o=this._setXY(i),a=o[1],o=o[0],o=Math.abs(o-this.getAutoFillElem().offset().left),a=Math.abs(a-this.getAutoFillElem().offset().top),o<=y&&o>=0&&a<=y&&a>=0&&(u=this.getAutoFillElem(),r=i.target=u[0]))),u.parents(".e-ribbon").length||u.parents(".e-vscroll").length||u.parents(".e-hscroll").length)this._excelFilter&&(this.XLFilter._isSearchEdit=!1,this._excelFilter.closeXFDialog());else if(this._hasClass(r,"e-ssddl"))this._ddlopen(i);else{if(i.target=this._changeTargetWithOffset(i),this.model.allowCharts&&d._isChartBorderDrawn&&this.XLChart._clearChartRange(this._arrayAsString(this._chartBorder)),(this.model.pictureSettings.allowPictures||this.model.allowCharts)&&(u.hasClass(v)||n(u).parents("."+v).length)?(u.hasClass(v)||(r=i.target=n(u).parents("."+v)[0]),this.XLShape._shapeMouseDown(i)):(nt=!1,this.XLShape._shapeROStart&&this.XLShape._shapeRSStart||this._getContent(e).find(".e-ss-activeimg").removeClass("e-ss-activeimg e-ss-imgcresize e-ss-imgrresize")),(r.nodeName==="TD"||r.nodeName==="TH")&&(this.XLRibbon._isPanelVisible=!1),this.model.enablePivotTable&&(this._isPvtNameEdit&&(this._isPvtNameEdit=!1,this.XLPivot._changePvtName()),u.hasClass(c)||u.parents("."+c).length?(u.hasClass(c)||(r=i.target=u.parents("."+c)[0]),this.XLPivot._pivotMouseDown(i)):u.parents(".e-ss-pivotfield").length||u.hasClass("e-ss-pivotfield")||u.hasClass("e-vhandle")||u.hasClass("e-hhandle")||u.css("cursor")==="col-resize"||(this.hideActivationPanel(),this.getSheetElement(e).find(".e-ss-activepivot").removeClass("e-ss-activepivot"))),w=r.className,r.id.indexOf("picture")===-1&&this.model.showRibbon&&(l.model.selectedItemIndex===this.XLRibbon._getTabIndex("format")||l.isVisible(this._getLocStr("FORMAT")))&&this.XLRibbon._toggleFormatTab(),this.model.showRibbon&&r.id.indexOf("chart")>-1?this.XLRibbon._chartDesignTabUpdate(n(r)):this.model.showRibbon&&(l.model.selectedItemIndex===this.XLRibbon._getTabIndex("cdesign")||l.isVisible(this._getLocStr("CHARTDESIGN")))&&this.XLRibbon._toggleChartDesignTab(),this.XLEdit._isEdit&&r.nodeName!="TD"&&!this._hasClass(r,"e-autofill"))return;if(this.model.allowDragAndDrop&&this.XLDragDrop._isDragAndDropStart&&w!=="e-autofill"&&w.indexOf("e-filterspan")<0&&this.XLDragDrop._dMouseDown(i),this.model.allowResizing&&!this.XLEdit._isEdit&&(n(r).hasClass("e-headercelldiv")||n(r).hasClass("e-headercell")?this.XLResize._headerMouseDown(i):n(r).hasClass("e-rowheader")?this.XLResize._rowMouseDown(i):(n(r).hasClass("e-spreadsheetactpanel")||n(r).parents(".e-spreadsheetactpanel").length)&&this.XLResize._apMouseDown(i)),n(r).parents("div.e-spreadsheetactpanel").length>0)return;if(this.model.allowEditing&&this.XLEdit._editElem.html()==="="&&(this._isFormulaSuggestion=!1,this.XLEdit._isFormulaEdit=!0),g=this.XLEdit._isEdit?(this._isFormulaSuggestion||!this.XLEdit._isFormulaEdit)&&this.XLEdit.saveCell():!0,!g&&!this.XLEdit._isFormulaEdit)return!1;this.model.allowComments&&!u.hasClass("e-pager")&&this.getSheetElement(e).find(".e-commentcell").length&&this.XLComment._commentMouseDownHandler(i);r.tagName!=="SPAN"&&r.tagName!=="A"||t.isNullOrUndefined(u.parent("td")[0])?r.tagName==="TD"&&this._hasClass(r,"e-rowcell")?(s=r,f=this._getCellIdx(s),this.model.showRibbon&&this.XLRibbon.updateRibbonIcons()):f=this.getActiveCell():(s=u.parent("td")[0],f=this._getCellIdx(s));r.tagName==="A"?(d._activeCell=f,this.model.allowSelection&&(this.XLSelection.selectRange(f,f),this.XLDragFill.positionAutoFillElement()),i.which!==3&&this._hlClick(this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"hyperlink",e))):(i.button!==2||i.which!==3||this.getSheetElement(e).find(".e-selected, .e-colselected .e-headercelldiv, .e-rowselected").index(r)===-1)&&this.model.allowSelection&&!nt&&(t.isNullOrUndefined(this.XLDragDrop)||!this.XLDragDrop._allowDragAndDrop)&&(this.XLResize&&this.XLResize._resizeStart||u.hasClass("e-comment-txtarea")||u.hasClass(c)||n(u).parents("."+c).length||this.XLSelection._selectionMouseDownHandler(i));this._filterClose(i.target);this._undoInputobj={};r.tagName==="TD"&&n(r).parents("div")[0].className==="e-content"&&this.displayActivationPanel(this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"range"));r.tagName==="TD"&&r.className.indexOf("e-rowheader")<0&&(t.isNullOrUndefined(this._ddlCell)||(this.element.find("#"+this._id+"ddl").ejDropDownList("hidePopup"),this.element.find("#"+this._id+"ddlspan").remove(),this._ddlCell=null));r.tagName==="TD"&&this._hasClass(r,"e-rowcell")&&(k=this._getCellIdx(r),t.isNullOrUndefined(this.XLEdit.getPropertyValue(k.rowIndex,k.colIndex,"rule",e))||this._setddlCell(i));this._isTableRename&&(this.XLFormat._renameTable(this._tableClassName),this._isTableRename=!1);this._isSheetRename&&this._updateSheetNames(null,!1);this.element.find("#"+this._id+"ddl").ejDropDownList("hidePopup");this._hasClass(r,"e-rowcell")&&(b=this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"tableName",e));b?(p=this._getTableID(b),this.isNumber(p)&&this.XLRibbon._designTabUpdate(p,f)):this.model.showRibbon&&(l.model.selectedItemIndex===this.XLRibbon._getTabIndex("design")||l.isVisible(this._getLocStr("Design")))&&this.XLRibbon._toggleDesignTab(f);this.model.allowEditing&&(s=d._activeCell,this.XLEdit._isEdit&&i.target.id!==this._id+"_inputbox"&&(h=n(i.target).hasClass("e-ss-input")||!this.XLEdit._isFBarFocused?this.element.find("#"+this._id+"_Edit"):this._getInputBox(),h&&(i.target.id!==h[0].id&&h.focus().setInputPos(h[0].selectionStart,h[0].selectionEnd),h.hasClass("e-ss-input")&&(this.XLEdit._isFBarFocused=!1))),this.model.allowComments&&this.XLComment._isCommentEdit||this._isSheetRename||i.target.id!==this._id+"_inputbox"||(i.target.readOnly?this.setSheetFocus():(this.XLEdit._isEdit||this.XLEdit.editCell(s.rowIndex,s.colIndex,!0),this._getInputBox().focus(),this.XLEdit._isFBarFocused=!0)))}},_renderDDownList:function(){this.element.append(t.buildTag("input.e-"+this._id+"-ddl","","",{id:this._id+"ddl",style:"display:none"}));n("#"+this._id+"ddl").ejDropDownList({fields:{id:"Types",text:"text",value:"text"},beforePopupShown:n.proxy(this._drppopupshow,this),cssClass:"e-"+this._id+"-ddl e-ss-ddlwrap",width:.1,height:.1,change:n.proxy(this._changeddl,this)});n(document.body).append(n("#"+this._id+"ddl_popup_wrapper"))},_setddlCell:function(i){var v,u=[],h=[],d=[],y,a,f,p,w=this.getActiveSheetIndex(),g,b,e,r,l,o,k,s,c;if((t.isNullOrUndefined(i)||i.type!=="mousedown"?(f=this.getActiveCell(),p=n("#"+this._id+"GroupPanel").find("div.e-content")[0]):(f=this._getCellIdx(i.target),p=i.currentTarget),a=this.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"rule",w),a)&&(y=a.customVal.split("_"),a&&y[1]==="list")){if(this._ddlCell=f,e=y[0],o=[],e.startsWith("=")&&e.indexOf(",")<0){for(u=n.trim(e.replace("=","")),u.indexOf("!")>-1&&(k=u.split("!"),w=this._getSheetIndexByName(k[0]),u=k[1]),u.indexOf("$")>-1&&(u=u.split("$").join("")),u.indexOf(":")<0&&(u=u+":"+u),range=this.getRangeIndices(u),s=this._getMultiRangeCells(range),c=this.getRangeData({range:[s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex],property:["value","value2"],sheetIdx:w}),r=0,l=c.length;r<l;r++)t.isNullOrUndefined(c[r].value)||t.isNullOrUndefined(c[r].value2)?(o.push(""),h.push("")):(o.push(c[r].value),h.push(c[r].value2));o.length||(o.push(e),h.push(e))}else e.indexOf(",")>-1?h=o=e.split(","):(o=[],o.push(e),h.push(e));for(r=0,l=o.length;r<l;r++)d[r]={id:r+1,text:h[r],value:o[r]};f=this.getCell(f.rowIndex,f.colIndex);v={top:f[0].offsetTop,left:f[0].offsetLeft};p.insertAdjacentHTML("beforeEnd","<span id='"+this._id+"ddlspan' class='e-icon e-ssddl e-spanddl e-ddlspan' role='button'><\/span>");b=n("#"+this._id+"ddlspan");g=f.height()-(b.height()+3);b.css({top:v.top+g,left:v.left+f.width()+3});n("#"+this._id+"ddl").ejDropDownList("option","dataSource",d)}},_drppopupshow:function(){if(this._ddlCell){var t=this.getCell(this._ddlCell.rowIndex,this._ddlCell.colIndex);n("#"+this._id+"ddl_popup").css({width:this.getActiveCellElem().width()+20,"font-size":"11",top:t.position().top,left:t.position().left})}},_ddlPosition:function(){if(this._ddlCell){var i,t=this.getCell(this._ddlCell.rowIndex,this._ddlCell.colIndex),r={top:t[0].offsetTop,left:t[0].offsetLeft};i=n("#"+this._id+"ddlspan");i.css({top:r.top+t.height()-(i.height()+3),left:r.left+t.width()+3})}},_changeddl:function(n){if(this._ddlCell&&this.model.allowEditing){var t=this.getActiveCell(),i=n.model.dataSource[n.itemId].value,r=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex);this.XLEdit._updateCellValue(t,i);this.getActiveCellElem().hasClass("e-hlcell")&&this.XLValidate.highlightInvalidData();this._trigrDdlActnCmplt(i,r,n.itemId);this.model.allowFormulaBar&&this.updateFormulaBar()}},_trigrDdlActnCmplt:function(n,t,i){if(this.model.actionComplete!==null){var e=this.getActiveCell(),s=this.getActiveSheetIndex(),o,f,r,u,h;if(o=this.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"rule",s),f={reqType:"edit",sheetIndex:s,currValue:n,prevValue:t,rowIndex:e.rowIndex,colIndex:e.colIndex,hasValidation:!0,rule:o,isRefreshVal:!1},o.type=="list"&&n!==""&&(r=o.customVal.split("_")[0],r[0]=="="&&r.indexOf(",")<0)){if(f.isRefrsVal=!0,r=r.replace("=",""),u=r.split("!"),f.refrValSheetIdx=refrSheetIdx=u.length==1?s:this._getSheetIndexByName(u[0]),refrRange=u.length==1?u[0]:u[1],refrRange.indexOf("$")>-1&&(refrRange=refrRange.replace(/\$/g,"")),range=this.getRangeIndices(refrRange),this.isUndefined(i)){h=this.getRangeData({range:range});for(idx in h)h[idx].value==n&&(i=parseInt(idx))}f.refrValCellAddr=range[0]===range[2]?this.getAlphaRange(range[0],range[1]+i):this.getAlphaRange(range[0]+i,range[1])}this._trigActionComplete(f)}},_ddlopen:function(i){var e=this.getActiveSheetIndex(),u=this.getActiveCell(e),o=this.getSheet(e).rowsHeightCollection[u.rowIndex],r,s,f;if(this.XLEdit._isEdit&&this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"rule").customVal.split("_")[2]==="true")return!1;this.XLEdit.saveCell();r=n("#"+this._id+"ddl").data("ejDropDownList");s=this.getCell(this._ddlCell.rowIndex,this._ddlCell.colIndex);i.stopPropagation();t.isNullOrUndefined(r)||(r._isPopupShown()?r._hideResult():(r._showResult(),n("#"+this._id+"ddl_popup").css({width:this.getActiveCellElem().width()+20,"font-size":"11",top:20,left:100}),f=this._getXYPos(s,n("#"+this._id+"ddl_popup"),o,0),n("#"+this._id+"ddl_popup_list_wrapper").css({top:f.yPos+o,left:f.xPos})))},_mouseMoveHandler:function(i){i.target=this._changeTargetWithOffset(i);var r=n(i.target),u,f;this._isTouchEvt=this._isTouchEvent(i);this._isTouchEvt&&(i.preventDefault(),u=this._setXY(i,navigator.userAgent.indexOf("WebKit")>-1),this.model.allowDragAndDrop&&this.XLDragDrop._dragtouch(u[0],u[1]));!this.model.allowResizing||!(this.XLResize._resizeType==="Col"||r.hasClass("e-headercelldiv")||r.hasClass("e-headercell")||r.hasClass("e-reSizeColbg"))||this.XLEdit._isEdit||this.XLCMenu&&this.XLCMenu._isMenuOpened?!this.model.allowResizing||!(this.XLResize._resizeType==="Row"||r.hasClass("e-rowheader")||r.hasClass("e-reSizeRowbg"))||this.XLEdit._isEdit||this.XLCMenu&&this.XLCMenu._isMenuOpened?this.model.allowResizing&&(this.XLResize._resizeType==="AP"||r.hasClass("e-spreadsheetactpanel")||r.parents(".e-spreadsheetactpanel").length>0)?this.XLResize._apMouseMove(i):(this.model.pictureSettings.allowPictures||this.model.allowCharts)&&(r.hasClass("e-ss-object")||r.parents(".e-ss-object").length||this.XLShape._shapeROStart||this.XLShape._shapeRSStart||r.hasClass("e-ss-imgvisual"))&&this.XLShape._imgMouseMove(i):this.XLResize._rMouseMove(i):this.XLResize._cMouseMove(i);this.model.allowSelection&&this.model.allowDragAndDrop&&t.spreadsheetFeatures.dragAndDrop&&r.parents(".e-spreadsheetmainpanel").length&&r.hasClass("e-rowcell")&&!this.XLEdit._isEdit&&this._getJSSheetHeader(this.getActiveSheetIndex())[0].querySelector(".e-spreadsheetcolumnheader").className.indexOf("e-sheetselected")===-1&&this.XLDragDrop._dMouseMove(i);this.model.allowComments&&!this.XLComment._isCommentEdit&&this.getSheetElement(this.getActiveSheetIndex()).find(".e-commentcell").length>0&&this.XLComment._commentMouseMove(i);t.isNullOrUndefined(i.target.parentNode)||i.target.id.indexOf("_svg")<0&&i.target.parentNode.className.indexOf("e-content")<0&&!n(i.target).is("td.e-rowcell")&&this.XLShape._shapeMouseUp(i);this._isTouchEvt&&!this._isSelected(i.target)&&!this._isTouchMoveSel&&this._touchArgs&&!this._isUniqueTarget(this._touchArgs,i)&&r.parents(".e-table").length&&r.parents(".e-spreadsheetcontentcontainer").length&&!this.XLDragDrop._allowDragAndDrop&&(f=this._getClientDiff(this._startXY,u),this._scrollContent(f),this._startXY=u,this._touchArgs=i,this._isTouchScroll=!0)},_mouseLeaveHandler:function(t){this._hasClass(t.target,"e-viewhdrlbl")||this._hasClass(t.target,"e-vheading")?this.element.find(".e-vheading .e-chk-act, .e-vheading .e-chk-inact").removeClass("e-chkhover"):this._hasClass(t.target,"e-viewlinlbl")||this._hasClass(t.target,"e-vgridlines")?this.element.find(".e-vgridlines .e-chk-act,.e-vgridlines .e-chk-inact").removeClass("e-chkhover"):this.model.allowResizing&&n(".e-ss-colresize, .e-ss-rowresize").removeClass("e-ss-colresize e-ss-rowresize")},_mouseUpHandler:function(t){var i=n(t.target),u=this.getActiveSheetIndex(),r=this.XLScroll._vScroller(u),f=this.XLScroll._hScroller(u);if(this.model.allowResizing&&(this.XLResize._resizeType==="Col"?this.XLResize._cMouseUp(t):this.XLResize._resizeType==="Row"?this.XLResize._rMouseUp(t):this.XLResize._resizeType==="AP"&&this.XLResize._apMouseUp(t)),this.model.showRibbon&&!this._phoneMode&&this.element.find(".e-ribbonpin").is(":visible")&&n(t.target).parents(".e-ribbon").length<=0&&n("#"+this._id+"_Ribbon").ejRibbon("collapse"),this.model.allowDragAndDrop&&this.XLDragDrop._allowDragAndDrop&&this.XLDragDrop._dMouseUp(t),this.model.allowComments&&this.XLComment._isCommentEdit&&this.getActiveCellElem().find("textarea").focus(),this._isSheetRename&&n("#"+this._id+"_Sheet_RenamePanel").focus(),this.model.pictureSettings.allowPictures&&this.XLShape._shapeMouseUp(t),this.model.enablePivotTable&&this.XLPivot._pivotMouseUp(t),this.XLEdit._isEdit&&i[0].id!==this.XLEdit._editElem[0].id&&this.XLEdit._editElem.setCursorPosition(this._browserDetails.version==="8.0"?document.selection.anchorOffset:window.getSelection().anchorOffset),this._hasClass(i[0],"e-vhandle")||this._hasClass(i[0],"e-vhandlespace")||this._hasClass(i[0],"e-vup")||this._hasClass(i[0],"e-vdown")){this._trigger("scrollStop",{scrollData:r._scrollData,position:r.model.value,reqType:"vertical"});return}if(this._hasClass(i[0],"e-hhandle")||this._hasClass(i[0],"e-hhandlespace")||this._hasClass(i[0],"e-hdown")||this._hasClass(i[0],"e-hup")){this._trigger("scrollStop",{scrollData:r._scrollData,position:f.model.value,reqType:"horizontal"});return}},_scrollContent:function(n,i){var r,u,e=this.getActiveSheetIndex(),f=this.getSheet(e);n.x&&(r=i?n.x:f._scrollLeft+n.x,u=this.XLScroll._hScroller(e),r<0?r=0:this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal?n.x>0&&u.model.maximum<r+u._scrollData.handle&&(r=u.model.maximum):u._scrollData.step=n.x<0?-1:1,f._scrollLeft!=r&&u.scroll(r));n.y&&(r=i?n.y:f._scrollTop+n.y,u=this.XLScroll._vScroller(e),r<0?r=0:this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&(u._scrollData.step=n.y<0?-1:1),(r||f._scrollTop!=r)&&u.scroll(r))},_keyDownHandler:function(i){var s,e,h,c,o,a=!0,l=!1,f=this.getActiveSheetIndex(),r=this.element.find("#"+this._id+"_AutoComplete").data("ejAutocomplete"),v=n("#"+this._id+"_Ribbon").data("ejRibbon"),u=this.getSheet(f)._activeCell;if(!this._trigger("keyDown",{event:i,isEdit:this.model.allowEditing&&this.XLEdit._isEdit,isCommentEdit:this.model.allowComments&&this.XLComment._isCommentEdit,isSheetRename:this._isSheetRename,sheetIndex:this._getSheetIndex()})){if(this._getContent(f).find(".e-ss-activeimg").length&&(n(i.target).hasClass("e-numerictextbox")&&i.keyCode===13&&i.preventDefault(),l=!0,c=document.activeElement.id,c.indexOf(this._id+"_Ribbon_Format_Size_PictureHeight")<0&&c.indexOf(this._id+"_Ribbon_Format_Size_PictureWidth")<0&&this.XLShape._imgKeyDown(i)),navigator.platform.toLowerCase().indexOf("mac")>-1&&i.metaKey){i.keyCode==67?this.XLClipboard.copy():i.keyCode==86?this.XLClipboard.paste():i.keyCode==88&&this.XLClipboard.cut();return}if(r.showSuggestionBox&&r.suggestionList){if(i.keyCode===38){r._removeListHover();r._activeItem=r._activeItem>1?r._activeItem-1:r._listSize;r._addListHover();r._targetFocus();return}if(i.keyCode===40){r._removeListHover();r._activeItem=r._activeItem<r._listSize?r._activeItem+1:1;r._addListHover();return}}if(i.target.id.indexOf("_Edit")>-1&&this.model.allowKeyboardNavigation&&(this.XLCellNav._canKeyBoardNavigate=!0),this.XLEdit._editElem&&(o=this.XLEdit._editElem.text()),i.target.id.indexOf("_Edit")>-1&&i.keyCode===9&&o.indexOf("=")===0&&o.indexOf(")")!=o.length-1){if(i.preventDefault(),!r.suggestionList.is(":visible")&&this.model.allowKeyboardNavigation){this._isFormulaSuggestion&&(i.keyCode===39||i.keyCode===37||i.keyCode===13&&!i.altKey)&&this.XLEdit.saveCell();this.XLCellNav._selectionKeyDownHandler(i);u=this.getSheet(f)._activeCell;return}e=r.getActiveText();this.XLEdit._isNamedRange(e)||(e+="(");this.XLEdit._editElem.text(e);this.model.allowFormulaBar&&this._getInputBox().val(e);i.target.id.indexOf("_Edit")>-1&&this.XLEdit._editElem.focusEnd();this.XLCellNav._canKeyBoardNavigate=!1;return}if(this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"wrap")&&this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"merge")&&i.keyCode===46&&(this.getCell(u.rowIndex,u.colIndex,f).find("#"+this._id+"_MergeWrap")[0].textContent=""),i.target.id.indexOf("_Custom")<0&&i.target.id.indexOf("_Ribbon")<0){if((i.stopImmediatePropagation(),this.model.allowFiltering&&this.XLFilter._isSearchEdit&&i.keyCode!==27)||(n(i.target).parents(".e-formulabar").length&&this.XLEdit._isEdit&&this.model.allowKeyboardNavigation&&(this.XLCellNav._isNavigate=i.keyCode===13),this._isSheetRename||this.XLEdit._isEdit||this.XLComment&&this.XLComment._isCommentEdit||!this.model.allowClipboard||this.XLClipboard._copyPasteHandler(i),l||this._isSheetRename||((this.XLComment&&this.XLComment._isCommentEdit)?this.model.allowKeyboardNavigation&&(this.XLCellNav._isNavigate=!1):this.model.allowEditing&&(document.activeElement.id.indexOf("_inputbox")===-1||i.keyCode===27)&&this.XLEdit._editingHandler(i)),this._isFormulaSuggestion&&(i.keyCode===39||i.keyCode===37||i.keyCode===13&&!i.altKey)?this.XLEdit.saveCell():this.XLEdit._isFormulaEdit||i.keyCode!==9&&(i.keyCode!==13||i.altKey)&&i.keyCode!==37&&i.keyCode!==38&&i.keyCode!==39&&i.keyCode!==40||(a=this.XLEdit._isEdit&&this.model.allowKeyboardNavigation&&this.XLCellNav._isNavigate?this.XLEdit.saveCell():!0),n(i.target).hasClass("e-field-validation-error")||i.target.id==this._id+"_Ribbon_Home_Font_FontFamily_wrapper"||i.target.id==this._id+"_Ribbon_Home_Number_NumberFormat_wrapper"||i.target.id==this._id+"_Ribbon_Home_Font_FontSize_wrapper"))return!0;if(this.model.allowDataValidation&&this.XLValidate._isErrorVisible&&(i.keyCode===37||i.keyCode===39||i.keyCode===38||i.keyCode===40))return this.XLValidate._isErrorVisible=!1,!0;if(!a&&!this.XLEdit._isFormulaEdit||i.keyCode===13&&i.altKey)return!1;!this.model.allowKeyboardNavigation||l||this._isSheetRename||(this.model.allowComments&&this.XLComment._isCommentEdit||n(i.target).parents(".e-formulabar").length&&i.keyCode!==9&&(i.keyCode!==13||i.altKey)||this.XLCellNav._selectionKeyDownHandler(i),u=this.getSheet(f)._activeCell,this._keyboardShortCuts(i));this.model.allowUndoRedo&&(this.model.allowComments&&!this.XLComment._isCommentEdit?this._undoRedoOperation(i):this.model.allowComments||this._undoRedoOperation(i));this.XLEdit._isFormulaEdit&&i.keyCode===9&&!this.XLCellNav._canKeyBoardNavigate&&(this.XLCellNav._canKeyBoardNavigate=!0)}if(i.target.id===this._id+"_Ribbon_Analyze_PivotTable_PivotTableName")return this._isPvtNameEdit=!0,!0;if(this._isPvtNameEdit&&(this._isPvtNameEdit=!1,this.XLPivot._changePvtName()),i.target.tagName!=="DIV"||this.XLEdit._isEdit||t.isNullOrUndefined(this._ddlCell)||(this.element.find("#"+this._id+"ddl").ejDropDownList("hidePopup"),this.element.find("#"+this._id+"ddlspan").remove(),this._ddlCell=null),h=this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"tableName",f),i.target.id===this._id+"_Ribbon_Design_Properties_TableName")if(this._isTableRename=!0,this._tableClassName=this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"tableName")||"",this._isTableRename&&(i.keyCode===13||i.keyCode===9||i.keyCode===27))i.keyCode===13&&i.preventDefault(),this.XLFormat._renameTable(this._tableClassName);else return;h&&this._getContent(f).find(".e-ss-activeimg").length===0?(s=this._getTableID(h),this.isNumber(s)&&this.XLRibbon._designTabUpdate(s,u)):this.model.showRibbon&&(v.model.selectedItemIndex===this.XLRibbon._getTabIndex("design")||v.isVisible(this._getLocStr("Design")))&&this.XLRibbon._toggleDesignTab(u);this.XLEdit._isEdit||t.isNullOrUndefined(this.XLEdit.getPropertyValue(u.rowIndex,u.colIndex,"rule",f))||this._setddlCell(i);this._isSheetRename&&(i.keyCode===13||i.keyCode===9||i.keyCode===27)&&(i.preventDefault(),this._updateSheetNames(null,i.keyCode===27)&&this.setSheetFocus());r.suggestionList.is(":visible")&&(this.XLEdit._editElem.text()===""||i.keyCode===13)&&r._hideResult();this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()}},_keyUpHandler:function(n){var t=this.element.find("#"+this._id+"_Edit").text();this.model.allowEditing&&this.XLEdit._isEdit&&t.indexOf("=")>-1&&t.length>0&&t.indexOf(")")==-1&&(this.XLEdit._isFEdit||(this.XLCellNav._isNavigate=!0),n.keyCode!==40&&n.keyCode!==38&&t.length>1&&this.XLEdit._captureEditing(n));this._trigger("keyUp",{event:n,isEdit:this.model.allowEditing&&this.XLEdit._isEdit,isCommentEdit:this.model.allowComments&&this.XLComment._isCommentEdit,isSheetRename:this._isSheetRename,sheetIndex:this._getSheetIndex()})},_dblClickHandler:function(t){var i,e,r,u,f;if(this.XLEdit._isFEdit=!1,t.target.tagName!=="A")if(this._hasClass(t.target,"e-numericitem")){if(this.XLEdit&&this.XLEdit._isEdit&&this.getActiveCellElem().find(".e-error").length)return;this._isSheetRename||this._renameSheet()}else{if(t.target.id.indexOf("chart")>-1||this._hasClass(t.target,"e-comment-txtarea")||this._hasClass(t.target,"e-filterspan")||n(t.target).parents(".e-ss-pivot").length)return;if(u=this.getActiveSheetIndex(),f=this.getSheet(u),t.target=this._changeTargetWithOffset(t),!this.model.allowEditing||!this.model.allowSelection)return;if(this.XLSelection._isOutsideBordering||this.XLSelection._isGridBordering){i=this._getContent(u).find("div:first-child");i.addClass("e-ss-cursor");i.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor");this.XLSelection.selectRange(f._startCell,f._endCell);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this.XLSelection._isOutsideBordering=this.XLSelection._isGridBordering=!1;return}if(!this.XLEdit._isEdit&&(n(t.target).hasClass("e-rowcell")||n(t.target).parents("td").hasClass("e-rowcell"))&&!this._hasClass(n(t.target),"e-readonly")&&!n(t.target).hasClass("e-cellreadonly")){if(this._isTouchEvt&&t.preventDefault(),n(".e-cdata").length&&n(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),e=n(t.target),e.closest("#"+this._id+"EditForm").length)return;r=t.target.id.length<1?this._getCellIdx(t.target):this._getCellIdx(n(t.target).parents("td")[0]);this.XLEdit.editCell(r.rowIndex,r.colIndex,!0)}this.model.allowResizing&&(n(t.target).hasClass("e-headercell")||n(t.target).hasClass("e-headercelldiv"))&&(n(t.target).css("cursor")==="col-resize"||this._isTouchEvt)&&(n(t.target).hasClass("e-headercelldiv")&&(t.target=t.target.parentNode),this.XLResize._resizeToFitWidth(t));this.model.allowResizing&&(n(t.target).hasClass("e-ss-rowresize")||this._isTouchEvt&&n(t.target).hasClass("e-rowheader"))&&this.XLResize._resizeToFitHeight(t)}},_setAndSelectActiveCell:function(n,t,i){this.setActiveCell(n,t);this._selectActiveCell(n,t,"",i)},_selectActiveCell:function(n,t,i,r){var e=this.getActiveSheetIndex(),f=i?{rowIndex:i.rowIndex,colIndex:i.colIndex}:{rowIndex:n,colIndex:t},u=this.getSheet(e);if(this.model.allowSelection&&this.model.allowKeyboardNavigation&&this.model.scrollSettings.allowScrolling){this.XLEdit.getPropertyValue(n,t,"mergeIdx")?(u._activeCell=u._endCell=u._startCell=f,this.XLSelection._processBoundary(),u._activeCell=u._startCell,this.XLSelection.selectRange(u._startCell,u._endCell)):this.XLSelection.selectRange(this._getAlphaRange(e,n,t,f.rowIndex,f.colIndex));this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();switch(r){case"Home":this._scrollContent({x:[i?i.colIndex*u.columnWidth:0]-u._scrollLeft});break;case"End":u._isFreezed?this.XLCellNav._navToCell(n,t):(n<u._topRow.idx||n>u._bottomRow.idx||t<u._leftCol.idx||t>u._rightCol.idx)&&this.XLScroll.scrollToCell(this._getAlphaRange(e,n,t,f.rowIndex,f.colIndex));break;case"Ctrl + Home":case"Ctrl + Shift + Home":this.XLScroll.scrollToCell(this._getAlphaRange(e,n,t,f.rowIndex,f.colIndex))}this.XLScroll._getFirstColumn(e)}},_pageUpDown:function(n){if(!this._isAutoWHMode){var u,h,o,e,c,f=0,s,r=this.getActiveCell(),l=this.getActiveSheetIndex(),i=this.getSheet(l),a=this.model.scrollSettings.allowVirtualScrolling;(o=i._rowHeightCollection[r.rowIndex],i.rowCount-1===i._bottomRow.idx&&n===1||(this._isFrozen(i.frozenRows)?r.rowIndex>i.frozenRows&&i._ftopRowIdx===i.frozenRows:i._topRow.idx===0)&&n===-1)||(e=i._bottomRow.value+i.rowsHeightCollection[i._bottomRow.idx],this._isFrozen(i.frozenRows)&&(r.rowIndex<i.frozenRows&&n===1&&(o=i._rowHeightCollection[i.frozenRows]),f=n===1?this._getRowOffsetTop(i,i.frozenRows):this._getIdxWithOffset(i._ftopRowIdx,null,!1,["freeze"]).yOffset),c=n*(e-(f?f:i._topRow.value)),u=o+c>0?o+c:0,f?n===1?(s=r.rowIndex>i._ftopRowIdx?this._getIdxWithOffset(r.rowIndex).yOffset-i._frozenHeight:0,r.rowIndex<i.frozenRows?this._scrollContent({y:n*(e-i.rowsHeightCollection[i._bottomRow.idx]-f)+1}):this._scrollContent({y:this._getIdxWithOffset(i._bottomRow.idx,null,!1,["freeze"]).yOffset-i._frozenHeight},!0),u=this._getIdxWithOffset(i._ftopRowIdx).yOffset+s):(s=r.rowIndex>i._ftopRowIdx?this._getIdxWithOffset(r.rowIndex).yOffset-i._frozenHeight:0,r.rowIndex>i.frozenRows&&a?this._scrollContent({y:f-(e-i.rowsHeightCollection[i._bottomRow.idx])+1},!0):this._scrollContent({y:u+i.rowsHeightCollection[i._bottomRow.idx]-i._frozenHeight+1},!0),u=this._getIdxWithOffset(i._ftopRowIdx).yOffset+s):n===1&&this.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal&&i._bottomRow.value+this.model.rowHeight+i._vPortHgt>=i._rowHeightCollection[i._rowHeightCollection.length-1]?u=i._rowHeightCollection[i._rowHeightCollection.length-1]:this._scrollContent({y:n*(e-i._scrollTop)}),h=this._getIdxWithOffset(u,i._colWidthCollection[r.colIndex],!0),this._setAndSelectActiveCell(h.rowIdx,h.colIdx))}},_keyboardShortCuts:function(i){var v,p,c,y,w,a;if(this.model.allowEditing&&this.XLEdit._isEdit||this.model.allowComments&&this.XLComment._isCommentEdit&&i.keyCode!==27)return!1;var h,s,e,o=this.XLFormat,l=this.getActiveSheetIndex(),u=this.getSheet(l),f=u._selectedCells,r=!1;if(this.model.allowLockCell&&u.isSheetProtected&&(r=!0),!i.ctrlKey&&!i.shiftKey)switch(i.keyCode){case 33:i.preventDefault();this._pageUpDown(-1);break;case 34:i.preventDefault();this._pageUpDown(1);break;case 36:i.preventDefault();this._setAndSelectActiveCell(this.getActiveCell(l).rowIndex,this._isFrozen(u.frozenColumns)?u._frozenColumns-1:0,"Home")}if(i.ctrlKey&&!i.shiftKey){if(!this.element.find("#"+this._id+"_Ribbon .e-ribbonbackstagepage").is(":visible"))switch(i.keyCode){case 65:i.preventDefault();this.model.allowSelection&&(h=this.getActiveCellElem(),this.selectAll(),t.isNullOrUndefined(this.XLCellNav)||this.XLCellNav._updateActiveCell(n(h[0]).closest("tr").index(),h[0].cellIndex,{keyCode:i.keyCode}),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement());break;case 66:i.preventDefault();r||this._toggleFontPrpty("bold");break;case 68:case 82:i.preventDefault();this.model.allowAutoFill&&this.XLDragFill._fillRange(i.keyCode===68);break;case 73:i.preventDefault();r||this._toggleFontPrpty("italic");break;case 75:i.preventDefault();this.model.allowHyperlink&&!r&&this._showDialog(this._id+"_Ribbon_Insert_Links_Hyperlink");break;case 85:i.preventDefault();r||this._toggleFontPrpty("underline");break;case 32:if(i.preventDefault(),!this.model.allowSelection)return;v=f[0].colIndex;p=f[f.length-1].colIndex;s={rowIndex:0,colIndex:v};e={rowIndex:u.rowCount-1,colIndex:p};this.model.allowSelection&&this.XLSelection.selectRange(s,e);u._startCell=s;u._endCell=e;u._isColSelected=!0;t.isNullOrUndefined(this.XLCellNav)||this.XLCellNav._updateActiveCell(f[0].rowIndex,v);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();break;case 35:i.preventDefault();e=this._getUsedRangeFromSheet(l).endCell;this._setAndSelectActiveCell(e.rowIndex,e.colIndex,"End");break;case 36:i.preventDefault();this._setAndSelectActiveCell(this._isFrozen(u.frozenRows)?u._frozenRows-1:0,this._isFrozen(u.frozenColumns)?u._frozenColumns-1:0,"Ctrl + Home");break;case 49:i.preventDefault();this._showDialog(this._id+"_FormatCells");break;case 53:i.preventDefault();r||this._toggleFontPrpty("line-through");break;case 56:i.shiftKey||r||(i.preventDefault(),this._hideColumn(u._startCell.colIndex,u._endCell.colIndex));break;case 57:i.shiftKey||(i.preventDefault(),r||this._hideRow(u._startCell.rowIndex,u._endCell.rowIndex,"isRHide"));break;case 220:i.shiftKey||(i.preventDefault(),this.model.allowSearching&&this.XLSearch._applyGotoRowDiff());break;case 90:i.preventDefault();break;case 89:i.preventDefault();break;case 114:i.preventDefault();this.model.showRibbon&&!r&&this.XLRibbon._openNameManagerDlg();break;case 70:i.preventDefault();this._showDialog(this._id+"_Ribbon_Others_Editing_FindSelect");n("#"+this._id+"_FRDialog").ejDialog("open");this.XLRibbon._refreshFRDlg();n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option","selectedItemIndex",0);break;case 71:i.preventDefault();this._showDialog(this._id+"_Ribbon_Others_Editing_FindSelect");n("#"+this._id+"_GoDialog").ejDialog("open");n("#"+this._id+"_GoToDlgTab").ejTab("option","selectedItemIndex",0);break;case 72:i.preventDefault();this._showDialog(this._id+"_Ribbon_Others_Editing_FindSelect");n("#"+this._id+"_FRDialog").ejDialog("open");this.XLRibbon._refreshFRDlg();n("#"+this._id+"_FRDialog_FPDlgTab").ejTab("option","selectedItemIndex",1)}switch(i.keyCode){case 80:i.preventDefault();this.XLPrint.printSheet();break;case 79:if(i.preventDefault(),this.model.allowImport){if(this.model.importSettings.importMapper.length<1){this._showAlertDlg("Alert","ImportExportUrl","",266);return}this.isDirty&&this._browserDetails.name!=="msie"?this._showAlertDlg("","ImportAlert","Open",470,135):n("#"+this._id+"_file .e-uploadinput").click()}break;case 83:i.preventDefault();this.model.exportSettings.allowExporting&&this.XLExport["export"]("Excel")}}if(i.ctrlKey&&i.shiftKey){if(!this.element.find("#"+this._id+"_Ribbon .e-ribbonbackstagepage").is(":visible")){this._browserDetails.name==="mozilla"&&i.keyCode===173&&(i.keyCode=189);switch(i.keyCode){case 192:i.preventDefault();r||o.format({type:"general"});break;case 52:i.preventDefault();r||o.format({type:"currency"});break;case 53:i.preventDefault();r||o.format({type:"percentage"});break;case 54:i.preventDefault();r||o.format({type:"scientific"});break;case 51:i.preventDefault();r||o.format({type:"shortdate"});break;case 50:i.preventDefault();r||o.format({type:"time"});break;case 49:i.preventDefault();r||o.format({type:"number"});break;case 55:i.preventDefault();this.model.allowCellFormatting&&this.model.formatSettings.allowCellBorder&&!r&&this.XLFormat.applyBorder({top:"1px solid #000000",right:"1px solid #000000",bottom:"1px solid #000000",left:"1px solid #000000"});break;case 189:i.preventDefault();this.model.allowCellFormatting&&this.model.formatSettings.allowCellBorder&&!r&&this.XLFormat.applyBorder("noborder");break;case 73:i.preventDefault();this.model.allowInsert&&!r&&this._showDialog(this._id+"_Ribbon_Others_Cells_InsertCellOptions");break;case 68:i.preventDefault();this.model.allowDelete&&!r&&this._showDialog(this._id+"_Ribbon_Others_Cells_DeleteCellOptions");break;case 113:i.preventDefault();c=n("#"+this._id+"_Ribbon").data("ejRibbon");this.model.showRibbon&&(c._isCollapsed?(c.expand(),c._removeRibbonPin()):c.collapse());break;case 56:i.preventDefault();!r&&this.model.allowSelection&&this._showColumn(f[0].colIndex,f[f.length-1].colIndex);break;case 57:i.preventDefault();!r&&this.model.allowSelection&&this._showRow(f[0].rowIndex,f[f.length-1].rowIndex,"isRHide");break;case 79:i.preventDefault();this.XLSearch._applyGotoComments();break;case 220:i.preventDefault();this.XLSearch._applyGotoColDiff();break;case 36:i.preventDefault();e=this.getActiveCell(l);this._selectActiveCell(0,0,e,"Ctrl + Shift + Home")}}}else if(i.shiftKey)i.keyCode===32?(i.preventDefault(),this.model.allowSelection&&(y=f[0].rowIndex,w=f[f.length-1].rowIndex,s={rowIndex:y,colIndex:0},e={rowIndex:w,colIndex:u.colCount-1},this.XLSelection.selectRange(s,e),u._startCell=s,u._endCell=e,u._isRowSelected=!0,t.isNullOrUndefined(this.XLCellNav)||this.XLCellNav._updateActiveCell(y,f[0].colIndex),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())):i.keyCode===113?(this._dupDetails=!0,i.preventDefault(),h=this.getActiveCellElem(),this.model.allowComments&&!r&&(this._isRibbonClick=!0,h.hasClass("e-commentcell")?this.XLComment.editComment():this.XLComment.setComment(),this._isRibbonClick=!1),this._dupDetails=!1):i.keyCode===122&&(i.preventDefault(),this.addNewSheet());else if(i.keyCode===27){if(this.model.allowComments&&this.XLComment._isCommentEdit&&(this.XLComment._updateCurCmntVal(),this.XLComment._updateCmntRibIcons()),this.model.allowContextMenu&&(this.XLCMenu._isMenuOpened||n("#"+this._id+"_contextMenuColumnHeader").is(":visible")||n("#"+this._id+"_contextMenuRowHeader").is(":visible"))&&this.XLCMenu.hideCMenu(),this.model.allowFiltering&&this._excelFilter&&this._excelFilter._openedFltr&&n(this._excelFilter._openedFltr).is(":visible")){if(a=this._excelFilter._menuWrap.data("ejMenu"),a.element.find(".e-mhover li:visible").length){a._isContextMenuOpen||a._closeMenu();return}this.XLFilter._isSearchEdit=!1;this._excelFilter.closeXFDialog()}this.setSheetFocus()}else i.altKey&&(i.keyCode===112&&this.model.showRibbon&&this.model.allowCharts&&!r?(i.preventDefault(),this.XLChart.createChart(null,{type:"column",enable3D:!1,marker:{visible:!1}})):i.keyCode===84&&this.model.showRibbon&&!this.XLRibbon._isDirtySelect&&!r&&this.model.allowFormatAsTable&&(this._showDialog(this._id+"_Ribbon_Insert_Tables_Table"),i.preventDefault(),this.XLRibbon._openFATDlg()))},_triggerTBtnClick:function(t){var i=n("#"+t).data("ejToggleButton");i.buttontag.click()},_toggleFontPrpty:function(n){var e=this.getActiveCell(),o=this.XLFormat,u={style:{}},f,t,i,r;f=this.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"format");i=!this.isUndefined(f)&&this.XLFormat.getFormatFromHashCode(f);t=n==="bold"?"font-weight":n==="italic"?"font-style":"text-decoration";r=n.charAt(0).toUpperCase()+n.slice(1).toLowerCase();r==="Line-through"&&(r="StrikeThrough");i[t]===n?(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!1),u.style[t]="none"):t==="text-decoration"&&(i[t]==="underline"||i[t]==="line-through")?(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!0),u.style[t]=i[t]==="underline"?n+" "+i[t]:i[t]+" "+n):t==="text-decoration"&&(i[t]==="line-through underline"||i[t]==="underline line-through")?(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!1),i[t]=i[t].split(" ").join(""),u.style[t]=i[t].replace(n,"")):(this.model.showRibbon&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).length&&this.element.find("#"+this._id+"_Ribbon_Home_Font_"+r).ejToggleButton("option","toggleState",!0),u.style[t]=n);o.format(u)},_getLocStr:function(n){return this.localizedLabels[n]},_checkIndicesInContainer:function(n,t,i,r){var u=this._dataContainer.sheets;return n in u&&t in u[n]&&i in u[n][t]?r?r in u[n][t][i]?!0:!1:!0:!1},_textFormatting:function(t){switch(t){case"wrapText":var i=n("#"+this._id+"_Ribbon_Home_Alignment_WrapText").data("ejToggleButton");i&&this.setWrapText(i.model.toggleState?"wrap":"unwrap",null)}},wrapText:function(n){this.model.allowWrap&&!this.model.isReadOnly&&this.setWrapText("wrap",n)},unWrapText:function(n){this.model.allowWrap&&!this.model.isReadOnly&&this.setWrapText("unwrap",n)},setWrapText:function(n,i){var u,tt,k;if(this.model.allowWrap&&!this.model.isReadOnly){var r,a,f,e=this.getActiveSheetIndex(),v,s,w,o=this.getSheet(e),h=0,y,l=this.model.rowHeight,p,d=this.getRows(e),ot=d[1],it=d[0],g,nt=o.rowsHeightCollection,st=o.columnsWidthCollection,l=0,b=o._wrapHtCollection,c=!1,rt,ut=this.model.scrollSettings.allowVirtualScrolling,ft=o._clrWrapColl,et;if(a=this._getRangeArgs(i,"object"),r=this._getSelectedCells(e,a).selCells,r.length!==0){for(g=r.length>1?this._getProperAlphaRange(e,r[0].rowIndex,r[0].colIndex,r[r.length-1].rowIndex,r[r.length-1].colIndex):this._getAlphaRange(e,r[0].rowIndex,r[0].colIndex,r[r.length-1].rowIndex,r[r.length-1].colIndex),u=0,tt=r.length;u<tt;u++)if(rt=ut?this._getRowIdx(r[u].rowIndex):r[u].rowIndex,et=r[r.length-1],c=this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"wrap"),this._isPaste||(n!=="unwrap"||c)&&(n!=="wrap"||!c)){if(n==="unwrap"&&c)this._isUndoRedo||ft.push({rowIdx:r[u].rowIndex,colIdx:r[u].colIndex}),this._isRowViewable(e,r[u].rowIndex)&&(f=this.getCell(r[u].rowIndex,r[u].colIndex),this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"merge")&&!this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"cellType")&&(v=f.find("#"+this._id+"_MergeWrap"),v.length&&(f[0].innerHTML=v[0].innerHTML,v.remove())),s=r[u].rowIndex,w=r[u].colIndex,f&&this._removeClass(f[0],"e-sswraptext"),this._removeClass(it[s],"e-sswraprow"),this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"altTxt")&&this.addClass(f[0],"e-alt-unwrap"),s in o._wrapColl&&w in o._wrapColl[s]&&(delete o._wrapColl[s][w],y=t.max(this._getObjectValues(o._wrapColl[s])),this._fRowHtColl[s]&&y<this._fRowHtColl[s]&&(y=this._fRowHtColl[s]),this.getObjectLength(o._wrapColl[s])||delete o._wrapColl[s]),f.find(".e-filterspan").length>0&&(p=f.find(".e-filterspan"),this.model.allowFiltering&&this.XLFilter._postionFilterIcon(f,p))),this.XLEdit._clearDataContainer({cellIdx:r[u],property:["wrap"]}),this.XLEdit._clearDataContainer({cellIdx:{rowIndex:r[u].rowIndex,colIndex:0},property:["wrapRow"]}),this.XLEdit._clearDataContainer({cellIdx:{rowIndex:0,colIndex:r[u].colIndex},property:["wrapCol","wrapWidth"]}),h=this._getWrapCellHeight(e,r[u].rowIndex,r[u].colIndex,y),this._textClip(r[u].rowIndex,r[u].colIndex,"add");else if(n==="wrap"&&!c){if(this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"isFilterHeader"))continue;this._textClip(r[u].rowIndex,r[u].colIndex,"delete");this._wrapCollection(r[u].rowIndex,r[u].colIndex,nt[r[u].rowIndex],e);this.XLEdit._updateDataContainer({rowIndex:r[u].rowIndex,colIndex:r[u].colIndex},{dataObj:{wrap:!0}});this._isRowViewable(e,r[u].rowIndex)&&(f=this.getCell(r[u].rowIndex,r[u].colIndex),(f.is(":visible")||this._isPaste)&&this.model.allowResizing&&!this.XLResize._preventRowResize(r[u].rowIndex)&&(this.addClass(f[0],"e-sswraptext"),this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"altTxt")&&this._removeClass(f[0],"e-alt-unwrap"),f.find(".e-filterspan").length>0&&(p=f.find(".e-filterspan"),this.model.allowFiltering&&this.XLFilter._postionFilterIcon(f,p))));h=this._getWrapCellHeight(e,r[u].rowIndex,r[u].colIndex);h.rowHt<l&&(h.rowHt=l);l=h.rowHt;this._wrapCollection(r[u].rowIndex,r[u].colIndex,h.cellHt,e);this.XLEdit._updateDataContainer({rowIndex:r[u].rowIndex,colIndex:r[u].colIndex},{dataObj:{wrap:!0}});b[r[u].rowIndex]=u>0&&r[u].rowIndex===r[u-1].rowIndex?b[r[u-1].rowIndex]:b[r[u].rowIndex]=nt[r[u].rowIndex];t.isNullOrUndefined(this.XLEdit.getPropertyValue(r[u].rowIndex,0,"wrapCol"))&&this.XLEdit._updateDataContainer({rowIndex:0,colIndex:r[u].colIndex},{dataObj:{wrapCol:!0,wrapWidth:this.getSheet(e).columnsWidthCollection[r[u].colIndex]}})}h.rowHt>0&&(r[u].colIndex===a[3]||this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"merge"))&&(this.setHeightToRows([{rowIndex:r[u].rowIndex,height:h.rowHt}]),l=0,n!=="wrap"||c||t.isNullOrUndefined(this.XLEdit.getPropertyValue(r[u].rowIndex,0,"wrapRow"))&&this.XLEdit._updateDataContainer({rowIndex:r[u].rowIndex,colIndex:0},{dataObj:{wrapRow:!0}}));this.model.allowFreezing&&(this.XLFreeze._refreshFRowResize(r[u].rowIndex),this.XLFreeze._refreshSelection());r[u].colIndex===a[3]&&(l=0);h=0}this.model.allowComments&&this.XLComment._updateCmntArrowPos();this.model.scrollSettings.allowScrolling&&this.XLScroll._getRowHeights(e,r[0].rowIndex+1);(!o._isImported||o._isLoaded)&&(k={sheetIndex:e,selectedCell:r,reqType:"textwrap",operation:n,range:g},this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(e,"refresh","all"),this.model.allowSelection&&this.XLSelection._refreshBorder(),this._isUndoRedo||this._dupDetails||(this._completeAction(k),this._trigActionComplete(k)))}}},_getWrapCellHeight:function(n,t,i,r){var u,o,f=0,s=0,e,h=this.getSheet(n),c=h.rowsHeightCollection,l=h.columnsWidthCollection;if(o=this.XLEdit.getPropertyValue(t,i,"merge"),f=c[t],s=l[i],o){for(u=t+1;u<t+o.mSpan.rowSpan;u++)f=f+c[u];for(u=i+1;u<i+o.mSpan.colSpan;u++)s=s+l[u]}return o?(f=this._getRowHeight(t,n),e=r?r:f):(e=r?r:this._detailsFromGlobalSpan(t,i,"height",this.XLEdit.getPropertyValue(t,i,"value2"),s),e=e<this.model.rowHeight?this.model.rowHeight:e,f=e),{cellHt:e,rowHt:f}},_wrapCollection:function(n,t,i,r){var u=this.getSheet(r?r:this.getActiveSheetIndex());u._wrapColl[n]||(u._wrapColl[n]={});this.getObjectLength(u._wrapColl[n])>-1&&(u._wrapColl[n][t]=i);u.rowsHeightCollection[n]<i&&!this._isInMrgeRnge(n,t,!u._isLoaded)&&(u.rowsHeightCollection[n]=i,this.model.scrollSettings.allowScrolling&&this.XLScroll._getRowHeights(r,n,!0),this._getRowHdrTBody(r).find('tr[idx="'+n+'"]').height(i))},_isInMrgeRnge:function(n,t,r){if(!r)return this.XLEdit.getPropertyValue(n,t,"merge");var f=this._getSheetIndex(),u=this._impData?this._impData.model.sheets[f].mergedCells:[];for(u||(u=[]),i=0;i<u.length;i++)if(range=this.getRangeIndices(u[i].range),range[0]<=n&&range[2]>=n&&range[1]<=t&&range[3]>=t)return!0;return!1},_setWrapHeight:function(t,i,r,u,f,e){var o,h,c=r[i],s=this.getSheet(t),l=s.rowsHeightCollection;l[i]>0?o=l[i]:(s.hideRowsCollection.indexOf(i)===-1||e==="visible")&&(h=n(r[i].outerHTML).attr("id","ss"),f[0].insertBefore(h[0],f[0].childNodes[0]),o=f[0].rows[0].getBoundingClientRect().height,f[0].rows[0].parentNode.removeChild(f[0].rows[0]));o=o<20?20:o;parseInt(c.style.height)<o&&(c.style.height=o+"px",n(u[i])[0].style.height=o+"px",s.rowsHeightCollection[i]=o)},_setRowHdrHeight:function(n,t){var r=this._getRowIdx(t),u,f,i=this.getSheet(n),e=this.getRows(n),o=i.rowsHeightCollection[t];this._isRowViewable(n,t)&&(f=parseInt(e[0][r].style.height),f!=o&&(e[0][r].style.height=o+"px",this.model.allowSelection&&(u=this._intrnlReq,this._intrnlReq=!0,this.XLSelection.refreshSelection(),i._isFreezed&&this.XLFreeze._refreshSelection(),this._intrnlReq=u),(!i._isImported||i._isLoaded)&&this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()))},_refreshRangeTRHght:function(n,t){for(var r=t[0]<1?t[0]:t[0]-1,u=this.getSheet(n),i=r;i<=t[2];i++)this._setRowHdrHeight(n,i);this.XLScroll._getRowHeights(n,r);(!u._isImported||u._isLoaded)&&this.model.allowSelection&&this.XLSelection._refreshBorder()},_renderAlertdlg:function(){var u,f,e,o,s,r,h="<div class='e-dlg-btnctnr' id=",i=this._id+"_alertdlg",c={text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._alertOkClick,this),enabled:!0,cssClass:"e-ss-okbtn"};document.getElementById(this._id+"_alertdlg")||(o="<input id="+this._id+"_dialog_Ok ><\/input><input id="+this._id+"_dialog_Can style= 'margin-left: 10'; ><\/input>",u="<input id="+this._id+"_dialog_alertOk > <\/input>",e=h+i+"_condiv >"+o+"<\/div>",f=h+i+"_alertdiv >"+u+"<\/div>",r="<div class='e-alertdlgcontent' id="+i+"_dlgcontent > <\/div>",r=r+"<div class='e-dlg-btnfields' id="+i+"_dlgbtncontent >"+e+f+"<\/div>",s=n("<div id="+i+" class='e-alertdlg' style= 'display : none;'>"+r+"<\/div>"),this.element[0].appendChild(s[0]),n("#"+this._id+"_dialog_alertOk").ejButton(c),n("#"+this._id+"_dialog_Ok").ejButton(c),n("#"+this._id+"_dialog_Can").ejButton({text:this._getLocStr("Cancel"),showRoundedCorner:!0,width:60,click:t.proxy(this._alertCanClick,this)}))},alert:function(t){var i=n("#"+this._id+"_alertdlg");this._renderAlertDlgContent(i,"Alert",t);i.ejDialog("open")},_renderAlertDlgContent:function(n,i,r,u,f,e){var o=n.find("#"+this._id+"_alertdlg_dlgcontent"),s=n.find("#"+this._id+"_alertdlg_condiv"),h=n.find("#"+this._id+"_alertdlg_alertdiv");this._tabMode||this._phoneMode?f>this._responsiveWidth/1.2&&(f=this._responsiveWidth/1.2):f=f||400;e=e||"";i==="Alert"?(s.hide(),h.show()):(s.show(),h.hide());o.text("");o.html(r);n.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,enableAnimation:!1,allowKeyboardNavigation:!1,title:this._getLocStr("Title"),width:f,height:"auto",minHeight:0,cssClass:"e-ss-dialog e-"+this._id+"-dlg"+e,open:t.proxy(this._alertDlgOpen)});this._alertDialog={element:n,action:u}},_alertDlgOpen:function(){this.element.find("input:visible:first").focus()},_alertOkClick:function(){var u,r=1,i=this.getActiveSheetIndex(),f,e=this._isUndoRedo,t;this._alertDialog.element.ejDialog("close");switch(this._alertDialog.action){case"findPrevComment":this.gotoPage(this.model.sheetCount,!1);u=this.model.sheets[this.model.sheetCount];this.XLComment._updateCurrentCell(u.rowCount-1,u.colCount-1);this.XLComment.findPrevComment();this._alertDialog.action=null;break;case"findNextComment":this.gotoPage(1,!1);this.XLComment._updateCurrentCell(0,0);this.XLComment.findNextComment();this._alertDialog.action=null;break;case"sheetRenameActn":n("#"+this._id+"_Sheet_RenamePanel").select().focus();break;case"sheetDeleteActn":this._removeSheet(i);this._alertDialog.action=null;break;case"New":this._isNew=!0;this._destroy();this._dataContainer.sheets[r]={};this.clearUndoRedo();this._updateCellType();this.model.sheetCount=r;this.model.activeSheetIndex=r;this._sheetSettings(r);this._newSIndex++;this._initCSSTag();this.gotoPage(r,!1);this.model.allowLockCell&&this.protectSheet(!1);f=n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").data("ejToggleButton");f&&(f.option("toggleState",!1),this.model.exportSettings.password=null,n("#"+this._id+"_AddSheet").removeClass("e-disable"));this.XLRibbon._toggleFormatTab();this.XLRibbon._toggleChartDesignTab();this.XLRibbon._toggleAnalyzeTab();this._refreshSpreadSheetPager();this.hideWaitingPopUp();this._isNew=!1;break;case"Open":n("#"+this._id+"_file .e-uploadinput").click();break;case"MergeCells":this._mergeCells(i,this.model.sheets[i]._selectedCells,{},[]);this._alertDialog.action=null;break;case"MergeAcrossCells":this._mergeAcrossCells(i,this.model.sheets[i]._selectedCells);this._alertDialog.action=null;break;case"MergeInsertDelete":this._refreshMergeCells();this._alertDialog.action=null;break;case"InvalidChartTitleActn":n("#"+this._id+"_chartnamedlg").find("input:first").focus();break;case"ConvertToRange":this.XLFormat._convertToRange({});break;case"TotalRow":this._isUndoRedo=this._dupDetails=!0;this.insertEntireRow(this._insRows.startRow,this._insRows.endRow);this.XLFormat._calculateTotalRow(i,null,!0,!1,!0);this._isUndoRedo=e;break;case"Drop":t=this.getSheet(i);this.XLDragDrop.moveRangeTo([t._startCell.rowIndex,t._startCell.colIndex,t._endCell.rowIndex,t._endCell.colIndex],[this._dStartCell.rowIndex,this._dStartCell.colIndex,this._dEndCell.rowIndex,this._dEndCell.colIndex]);t._startCell=this._dStartCell;t._endCell=this._dEndCell;this._trigger("drop",{sheetIndex:i,target:this.XLDragDrop._target,currentCell:this.XLDragDrop._dragAndDropCell,dragAndDropRange:{startCell:t._startCell,endCell:t._endCell}});break;case"FormulaAlert":this.XLEdit._editElem.focus();break;case"NMUniqueNameAlert":case"NMNameAlert":document.getElementById(this._id+"_nmgridname").focus();break;case"NMRangeAlert":document.getElementById(this._id+"_nmgridrefersto").focus();break;default:this.setSheetFocus()}},_alertCanClick:function(){var t=this._alertDialog,i;(t.action=="findNextComment"||t.action=="findPrevComment")&&n(this.getActiveCellElem()).find(".e-comment-txtarea").css("display","inline-table");t.action=="TotalRow"&&n("#"+this._id+"_Ribbon_Design_TableStyleOptions_TotalRow").length&&(this.XLRibbon._isSetModel=!0,n("#"+this._id+"_Ribbon_Design_TableStyleOptions_TotalRow").data("ejCheckBox").option("checked",!1),this.XLRibbon._isSetModel=!1);t.element&&t.element.ejDialog("close");switch(t.action){case"Drop":i=this.getSheet(this.getActiveSheetIndex());this.performSelection(i._startCell,i._endCell)}this.hideWaitingPopUp()},_showAlertDlg:function(t,i,r,u,f){var o=n("#"+this._id+"_alertdlg"),s="Alert",e,h={reqType:"alert",action:r};if(i instanceof Array?i[0]==="SheetRenameEmptyAlert"?e="<ul><li>"+this._getLocStr(i[0])+"<\/li><li>"+this._getLocStr(i[1])+"<\/li><li>"+this._getLocStr(i[2])+"\\ / ? * ["+this._getLocStr("OR")+" ] <\/li><li>"+this._getLocStr(i[3])+"<\/li><\/ul>":i[0]==="ClipboardAccessError"&&(e=this._getLocStr(i[0])+"<br /><br />"+this._getLocStr(i[1])+"<br />"+this._getLocStr(i[2])+"<br />"+this._getLocStr(i[3])):e=i.indexOf("T-")===0?i.slice(2):this._getLocStr(i),this._trigActionBegin(h)){this._alertDialog.action=r;this._alertCanClick();return}t===s?this._renderAlertDlgContent(o,s,e,r,u,f):this._renderAlertDlgContent(o,"",e,r,u,f);o.ejDialog("open")},_isSheetsDirty:function(){var n=1,t=this._dataContainer.sheets,i=this.getObjectLength(t)+1;if(this.model.nameManager.length||this.getObjectLength(t)>1)return!0;while(n<i){if(this.getObjectLength(t[n]))return!0;n++}return!1},getCell:function(t,i,r){var u=0,r=this._getSheetIndex(r),f=this.getSheet(r);return this.model.scrollSettings.allowVirtualScrolling&&(u=1,t=this._getRowIdx(t,r),t===-1)?null:(this.isImport||f._isImported||this._isPrint)&&this._detachTable?n(this._detachTable[0].tBodies[u].rows[t].cells[i]):this._getContTBody(r)?n(this._getContTBody(r)[0].rows[t].cells[i]):null},getRange:function(i,r,u){i=this._getRangeArgs(i,"object",r);var l=i[0],e=i[1],h=i[2],f=i[3],o,y,c,s,a,w,v,p=[],r=this._getSheetIndex(r),b=this.getSheet(r);if(c=(this.isImport||b._isImported)&&this._detachTable?n(this._detachTable[0].tBodies[1].rows):n(this._getContTBody(r)[0].rows),l>h&&(a=l,l=h,h=a),e>f&&(a=e,e=f,f=a),this.model.scrollSettings.allowVirtualScrolling)for(o=l;o<=h;o++)y=this._getRowIdx(o),y>-1&&(s=n(c[y].cells),v=f===e?[s[f]]:this._browserDetails.version==="8.0"?s.slice(e,f+1).toArray():s.slice(e,f+1),t.merge(p,v));else for(c=h!==l?c.slice(l,h+1):c.eq(h),w=c.length,o=0;o<w;o++)u&&this._isHiddenRow(o,r)||(s=n(c[o].cells),v=f===e?[s[f]]:this._browserDetails.version==="8.0"?s.slice(e,f+1).toArray():s.slice(e,f+1),t.merge(p,v));return n(p)},getRangeIndices:function(n){n=n.indexOf(":")===-1?n+":"+n:n;var r=n.split(":"),t,i=[];return t=r[0].split(/[A-Z]/i),i.push(parseInt(t[t.length-1])-1),i.push(this._generateColCount(r[0].split(/[0-9]/)[0].toUpperCase())-1),t=r[1].split(/[A-Z]/i),i.push(parseInt(t[t.length-1])-1),i.push(this._generateColCount(r[1].split(/[0-9]/)[0].toUpperCase())-1),this.swapRange(i),i},swapRange:function(n){return n[0]>n[2]&&t.dataUtil.swap(n,0,2),n[1]>n[3]&&t.dataUtil.swap(n,1,3),n},updateRange:function(n,t){var v;if(!this.model.isReadOnly){var u,o,y,s,p,h,c,f,l,i=[],a=[],e=t.dataSource,w=e.length,b=this.getObjectLength(e[0]);if(c=t.startCell,t.range?i=t.range:(h=c.split(/[A-Z]/i),i.push(parseInt(h[h.length-1])-1),i.push(this._generateColCount(c[0].split(/[0-9]/)[0].toUpperCase())-1),i.push(i[0]+w-(t.showHeader?0:1)),i.push(i[1]+b-1)),f=this._getSelectedRange({rowIndex:i[0],colIndex:i[1]},{rowIndex:i[2],colIndex:i[3]}),p=this._getContent(n),l=this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content >table"),this.model.allowAutoCellType&&this.model.allowCellType||l.detach(),t.showHeader)for(s in e[0])a.push(s);for(o=0;o<w;o++)if(e[o]!=r)for(s in e[0])a.push(e[o][s]);for(this._dupDetails=!0,u=0,y=f.length;u<y;u++)this.XLEdit._updateCell(f[u],a[u],n),t.showHeader&&u<b&&(i=t.startCell+":"+(this._generateHeaderText(f[f.length-1].colIndex+1)+(f[0].rowIndex+1)),t.headerStyles&&this.XLFormat.format({style:t.headerStyles},i));this._dupDetails=!1;this.model.allowAutoCellType&&this.model.allowCellType||p.find(".e-content").append(l);this._isUndoRedo||(v={sheetIndex:n,reqType:"update-range",rangeSettings:t},this._completeAction(v),this._trigActionComplete(v))}},editRange:function(t,i){var o,s,a,f,v,r,l,u=this.getActiveSheetIndex(),e=this.getSheet(u).rangeSettings[t],h=this.getRangeIndices(e.range),c=this.getRange(h);for(this._trigger("editRangeBegin",{range:e,sheetIndex:u}),e.cssClass&&c.addClass(e.cssClass),e.readOnly&&c.addClass("e-readonly"),v=this._getContent(u),l=this._getJSSheetContent(u).find(".e-spreadsheetcontentcontainer > .e-content >table"),l.detach(),o=0,a=c.length;o<a;o++)f=c[o],$cell=n(f),n.trim(t).length&&this.XLEdit._updateDataContainer({rowIndex:f.parentNode.rowIndex,colIndex:f.cellIndex},{dataObj:{range:t}}),r=i(f,f.cellIndex,o),typeof r=="string"?this.XLEdit._updateCell($cell,r):typeof r=="object"&&(r.Value.indexOf("=")!==0?this.XLEdit._updateCell($cell,r.Value):this.XLEdit._updateCellValue($cell,r.Value),$cell.data("value2",r.Value2),$cell.data("type",r.NumberFormat),r.StyleIndex>1&&$cell.addClass(this._styleColl[r.StyleIndex]));for(v.find(".e-content").append(l),s=h[0];s<h[2]+1;s++)this._setRowHdrHeight(u,s);this._trigger("editRangeComplete",{range:e,sheetIndex:u});this.XLScroll._getRowHeights(u,h[0])},removeRange:function(n){this.clearRange(n);delete this.getSheet(this.getActiveSheetIndex()).rangeSettings[n]},clearRange:function(n){if(!this.model.isReadOnly){var r,t,i=this.getSheet(this.getActiveSheetIndex()).rangeSettings[n];r=this.getRangeIndices(i.range);t=this.getRange(r);i.cssClass&&t.removeClass(i.cssClass);i.readOnly&&t.removeClass("e-readonly");this.clearRangeData(null,["range","value","type","value2"],t);t.empty()}},getObjectLength:function(n){var t,i=0;if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},Object.keys)return Object.keys(n).length;for(t in n)n.hasOwnProperty(t)&&i++;return i},getObjectKeys:function(n){var t,i=[];if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},!Object.keys){for(t in n)n.hasOwnProperty(t)&&i.push(t);return i}if(Object.keys)return Object.keys(n)},toArrayLowerCase:function(n){for(var t=0;t<n.length;t++)n[t]=n[t].toString().toLowerCase();return n},_isValueAlreadyExist:function(n,t,i){for(var r=0,u=n.length;r<u;){if(n[r][t]===i)return!0;r++}return!1},addClass:function(n,t){if(n){(n instanceof jQuery||n instanceof Array)&&(n=n[0]);var i=n.className;i.indexOf(t)===-1&&(n.className=i+" "+t)}},_removeClass:function(n,t){n&&((n instanceof jQuery||n instanceof Array)&&(n=n[0]),n.className=t?n.className.replace(new RegExp(t,"g"),"").replace(/ +/g," "):"")},_hasClass:function(n,t){return n?((n instanceof jQuery||n instanceof Array)&&(n=n[0]),!n||this._isAnimatedString(n.className))?!1:n.className.indexOf(t)>-1:!1},isUndefined:function(n){return n===r},_isString:function(n){return typeof n=="string"},_isEmptyString:function(n){return!n.toString().length},_isObject:function(n){return typeof n!="object"?!1:Object.prototype.toString.call(n)==="[object Object]"},_getObjectValues:function(n){var t,i=[];n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{};for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);return i},_isAnimatedString:function(n){return Object.prototype.toString.call(n)==="[object SVGAnimatedString]"},_isBool:function(n){return n=n+"",n=n.toUpperCase(),n==="TRUE"||n==="FALSE"},isRange:function(n){return n[0]!==n[2]||n[1]!==n[3]},_isMultiRange:function(n){return!this._isString(n)&&!this.isNumber(n[0])},inRange:function(n,t,i){return t>=n[0]&&t<=n[2]&&i>=n[1]&&i<=n[3]},_inRow:function(n,t){return t>=n[0]&&t<=n[2]},_inColumn:function(n,t){return t>=n[1]&&t<=n[3]},_isUniqueRange:function(n,t){return n.toString()===t.toString()},_isUniqueTarget:function(n,t){var i=this._getOriginalEvt(t),r=document.elementFromPoint(i.clientX,i.clientY);return n.target===r},_getClientDiff:function(n,t){return{x:n[0]-t[0],y:n[1]-t[1]}},hasSpan:function(n){return this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge")?!0:!1},_isFrozen:function(n){return n>0},_isSelected:function(t){return this._hasClass(t,"e-selected")||this._hasClass(t,"e-rowselected")||this._hasClass(t,"e-colselected")||n(t).parents(".e-colselected").length?!0:!1},_getMergedIdx:function(n,t){var u,e,o,s,h,i,c,l=ccount=0,f=this.getActiveSheetIndex(),r=this.XLEdit.getPropertyValue(n,t,"merge",f);if(r){if(r.mRange){if(u=this.getRangeIndices(r.mRange),c=this.getSheet(f),c.hideRowsCollection.length&&(e=u[0],o=u[2],o-e>1))for(i=e+1;i<o;)this.XLEdit.getPropertyValue(i,0,["isRHide"],f)&&l++,i++;if(this.getObjectLength(c.hideColsCollection)&&(s=u[1],h=u[3],h-s>1))for(i=s+1;i<h;)this.XLEdit.getPropertyValue(0,i,["isCHide"],f)&&ccount++,i++}if(r.mSpan)return{rowIndex:n+r.mSpan.rowSpan+l-1,colIndex:t+r.mSpan.colSpan+ccount-1}}return{rowIndex:n,colIndex:t}},_getMergeParent:function(n,t){var i=this.XLEdit.getPropertyValue(n,t,"mergeIdx");return i?{rowIndex:i.rowIndex,colIndex:i.colIndex}:{rowIndex:n,colIndex:t}},_getCellInfo:function(n,t){var i=this.getSheet(this._getSheetIndex(t)),s,h,u,f=0,e=0,o,r;if(s=n.rowIndex>=i._frozenRows?i._rowHeightCollection[n.rowIndex]-(i._rowHeightCollection[i._ftopRowIdx]-i._rowHeightCollection[i._frozenRows-1]):i._rowHeightCollection[n.rowIndex],h=n.colIndex>=i._frozenColumns?i._colWidthCollection[n.colIndex]-(i._colWidthCollection[i._fleftColIdx]-i._colWidthCollection[i._frozenColumns-1]):i._colWidthCollection[n.colIndex],u=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge"),u){for(o=u.mSpan,r=0;r<o.rowSpan;r++)e+=i.hideRowsCollection.indexOf(n.rowIndex+r)===-1?i.rowsHeightCollection[n.rowIndex+r]:0;for(r=0;r<o.colSpan;r++)f+=i.columnsWidthCollection[n.colIndex+r]}else e=i.hideRowsCollection.indexOf(n.rowIndex)===-1?i.rowsHeightCollection[n.rowIndex]:0,f=i.columnsWidthCollection[n.colIndex];return{top:s-1,left:h-1,height:e,width:f}},_getRowIdx:function(n,t,i,r){var u,f=this.getSheet(t);return i?(u=f._rowIdxColl[n],n=this.isUndefined(u)?f._rowIdxColl[f._rowIdxColl.length-1]:u):r?(u=f._rowIdxColl.indexOf(n),n=u===-1?n:u):this.model.scrollSettings.allowScrolling&&this.model.scrollSettings.allowVirtualScrolling&&(n=f._virtualRowIdx.indexOf(n)),n},_getMinRowIdx:function(n){for(var t=0;t<n.rowCount;t++)if(n.hideRowsCollection.indexOf(t)===-1&&n._hiddenFreezeRows.indexOf(t)===-1)return t;return 0},_arrayAsString:function(n){return n.join(" ").replace(/,/g," ")},_rangeHasData:function(n){var t,i,r;for(n=this.swapRange(n),t=this._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]}),i=t.length;i--;)if(r=t[i],this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex))return!0;return!1},_isTableRange:function(n,t,i){i=this._getSheetIndex(i);var r,u=this.getSheet(i).tableManager;for(r in u)if(this.inRange(u[r].range,n,t))return!0;return!1},_hasCellStyle:function(n,t,i){for(var r,u=["borders","formats"],f=u.length;f--;)if(r=this.XLEdit.getPropertyValue(n,t,u[f],i),r)return!0;return!1},_isHiddenRow:function(n,t){return this.XLEdit.getPropertyValue(n,0,"isFilterHide",t)||this.XLEdit.getPropertyValue(n,0,"isRHide",t)||!1},_refreshViewVar:function(n,i,r){r=this._getSheetIndex(r);var u=this.getSheet(r);t.isNullOrUndefined(n)||(u._topRow.idx=this.XLShape._getCellIndexFromOffset(n,null,r).rowIndex,u._topRow.value=this._getRowOffsetTop(u,u._topRow.idx),u._bottomRow.idx=u._rowIdxColl[u._topRow.idx+(u._virtualBlockRowCnt-this._bufferCnt-1)],u._bottomRow.value=this._getRowOffsetTop(u,u._bottomRow.idx),u.topLeftCell=this.getAlphaRange(u._topRow.idx,u._leftCol.idx));t.isNullOrUndefined(i)||(u._leftCol.idx=this.XLShape._getCellIndexFromOffset(null,i,r).colIndex,u._leftCol.value=this._getColOffsetLeft(u,u._leftCol.idx),u._rightCol.idx=this.XLShape._getCellIndexFromOffset(null,i+u._vPortWth,r).colIndex||u.colCount-1,u._rightCol.value=this._getColOffsetLeft(u,u._rightCol.idx),u.topLeftCell=this.getAlphaRange(u._topRow.idx,u._leftCol.idx))},_getFormatString:function(n,i){var r=t.Spreadsheet.CellFormat[n];return this.isNumber(i)&&!t.isNullOrUndefined(r)&&(r="{0:"+r.substr(3,1)+i+"}"),r||""},_refreshVrtlBlocks:function(n){for(var r,i=idx=0,u=["_virtualTopTBodyOffset","_virtualContTBodyOffset","_virtualBottomTBodyOffset"],n=this._getSheetIndex(n),t=this.getSheet(n);i<3;)(i||t._isVirtualTopReached)&&i!==1&&(i!==2||t._isVirtualEndReached)||(r=t._virtualRowIdx[idx],t[u[i]].top=this._getRowOffsetTop(t,r),idx+=t._virtualBlockRowCnt,r=t._virtualRowIdx[idx-1],t[u[i]].bottom=this._getRowOffsetBottom(r,n)),i++;t._virtualTBodyHgt=t._rowHeightCollection[t._rowHeightCollection.length-1]+t.rowsHeightCollection[t.rowsHeightCollection.length-1]},getRangeDataAsObject:function(n,i,r){var f,s,e,h,c,w=t.Spreadsheet.CellType,o=this._dataContainer,d=this.getActiveSheetIndex(),l=o.sheets[this.getActiveSheetIndex()],u,a,v,y,b=[],k=[],p=[];for(n.rowIndex>i.rowIndex?(u=i.rowIndex,a=n.rowIndex):(u=n.rowIndex,a=i.rowIndex),n.colIndex>i.colIndex?(v=i.colIndex,y=n.colIndex):(v=n.colIndex,y=i.colIndex);u<=a;){if(!r||!this._isHiddenRow(u)){for(h={},c={},f=v;f<=y;f++)s=this._generateHeaderText(f+1),u in l&&f in l[u]&&(e=l[u][f],h[s]=o.sharedData[e.value],c[s]=[w.General,w.Text].indexOf(o.cellType[e.type])===-1?e.value2:o.sharedData[e.value2]);b.push(h);k.push(c)}u++}return p.push(b),p.push(k),p},getRangeDataAsJSON:function(n,i,r,u){var o,y,e,h,a=t.Spreadsheet.CellType,c=this._dataContainer,s=c.sheets[u?u:this.getActiveSheetIndex()],f,p,w,b,k=[],v=!0,d=[],l;for(n.rowIndex>i.rowIndex?(f=i.rowIndex,p=n.rowIndex):(f=n.rowIndex,p=i.rowIndex),n.colIndex>i.colIndex?(w=i.colIndex,b=n.colIndex):(w=n.colIndex,b=i.colIndex);f<=p;){if(!r||!this._isHiddenRow(f)){for(h={},o=w;o<=b;o++)v?f in s&&o in s[f]&&(e=s[f][o],d[o]=this.isUndefined(e.type)||[a.General,a.Text].indexOf(c.cellType[e.type])!==-1?c.sharedData[e.value2]:e.value2):(y=d[o],f in s&&o in s[f]?(e=s[f][o],l=this.isUndefined(e.type)||[a.General,a.Text].indexOf(c.cellType[e.type])!==-1?c.sharedData[e.value2]:e.value2,h[y]=t.isNullOrUndefined(l)?"":this.isNumber(l)?parseInt(l):l):h[y]="");!v&&this.getObjectLength(h)&&k.push(h)}f++;v&&(v=!1)}return k},_getColorFromFormat:function(n){var r=[],i,u,f;return t.isNullOrUndefined(n)||(i=n.replace("e-format","").toLowerCase(),u=i.startsWith("6n")?"#"+i.substr(2,6):"#"+i.substr(6,6),f="#"+i.substr(0,6),r.push(f),r.push(u)),r},getRangeData:function(n){n=n||{};n.sheetIdx=this._getSheetIndex(n.sheetIdx);n.range=this._toIntrnlRange(n.range,n.sheetIdx);n.property=n.property||["value","value2","type","formatStr","decimalPlaces","thousandSeparator","range","format","border","comment","hyperlink","picture","cFormatRule","rule","chart","isLocked","wrap","formats","cellType","altTxt"];var e=0,c,l,i,r,o,s,u,h=[],f=[],a=this.getSheet(n.sheetIdx);if(n.rowIdxs)for(c=n.rowIdxs.length;e<c;)this._pushRowData(n,n.rowIdxs[e],0,a.colCount-1,f,h),e++;else for(u=!1,this.model.scrollSettings.allowVirtualScrolling&&n.skipHiddenRow&&!t.isNullOrUndefined(n.virtualRowIdx)?(u=!0,i=n.virtualRowIdx,r=i+(n.virtualRowCount-1),o=a.colCount-1):(i=n.range[0],r=n.range[2],o=n.range[3]);i<=r;)s=this._isHiddenRow(i,n.sheetIdx),u&&s?r++:n.skipHiddenRow&&s||(l=u?0:n.range[1],this._pushRowData(n,i,l,o,f,h,!0)),i++;return n.withRowIdx?{rowIdx:h,data:f}:f},_pushRowData:function(n,t,i,r,u,f,e){var o,h,c,s,a,v="value",p=this._intrnlUpdate,y=this._dataContainer,l=y.sheets[n.sheetIdx];if(e||this.XLEdit._refreshContainer(t,n.sheetIdx),l[t])if(n.valueOnly)while(i<=r)o="",s=l[t][i],s&&v in s&&(a=y.sharedData,o=a[s[v]],n.skipDateTime&&this._isDateTime(o)?o=this.XLEdit.getPropertyValue(t,i,"value2",n.sheetIdx):n.skipFormula&&this.isFormula(o)&&(o=this.XLEdit.getPropertyValue(t,i,"calcValue",n.sheetIdx))),n.skipEmptyCell&&(this.isUndefined(o)||!o.toString().length)||u.push(o),i++;else{for(this._intrnlUpdate=!0;i<=r;){if(s=l[t][i],s){h={};for(c in s)n.property.indexOf(c)>-1&&(h[c]=this.XLEdit.getPropertyValue(t,i,c,n.sheetIdx));(!n.skipEmptyCell||this.getObjectLength(h))&&u.push(h)}else n.skipEmptyCell||u.push({});i++}this._intrnlUpdate=p}else if(!n.skipEmptyCell)while(i<=r)n.valueOnly?u.push(""):u.push({}),i++;f.push(t)},_processBindings:function(n){if(this.model.query=new t.Query,this._trigger("actionBegin",n))return!0;this._ensureDataSource(n);n.action==="sorting"?(this.XLSort._sortComplete(n),this._isUndoRedo||(this._completeAction(n),this._trigActionComplete(n))):(this._completeAction(n),this._trigActionComplete(n))},_ensureDataSource:function(n){var i,v,o,u,s,h,f,c,l=this.getActiveSheetIndex(),a=this.getSheet(l),e,y;if(n.action==="filtering"||n.action==="clearfiltering"||n.requestType==="filterbycell"){for(i=a.filterSettings.filteredRange==null?this._dataSource(l):a.filterSettings.filteredRange,c=a.filterSettings.tableRange,e=0,y=c.length;e<y;e++)if(c[e].tableID===n.tableID){c[e].filteredRange=i;break}if(this._dataManager=t.DataManager(i),i instanceof t.DataManager||(this.model.currentViewData=i),this.model.query.requiresCount(),n.filteredcolumns.length){s=this._excelFilter._predicates[l];v=i[0];for(o in s)v.hasOwnProperty(o)&&(h=s[o]),h=s[o],u=u!=r?u.and(h):h;t.isNullOrUndefined(u)||this.model.query.where(u);i instanceof t.DataManager||(f=this._dataManager.executeLocal(this.model.query),this._filteredRecordsCount=f.count,this.model.currentViewData=f.result)}}else n.requestType==="sorting"&&(this._dataManager=t.DataManager(n.rangeData),n.rangeData instanceof t.DataManager||(this.model.currentViewData=n.rangeData),this.model.query.sortBy(n.columnName,n.sortDirection),n.rangeData instanceof t.DataManager||(f=this._dataManager.executeLocal(this.model.query),this.model.currentViewData=f));this._dataManager=null},_toArrayData:function(n){for(var u,t,i=0,r=[],f=n.length;i<f;){if(t=n[i],this.getObjectLength(t))for(u in t)r.push(t[u]);else r.push("");i++}return r},_updateRangeStyle:function(n,t,i){for(var u=this._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]}),r=0;r<u.length;r++)this.model.allowCellFormatting&&this.XLFormat._hasFormat(t[r].format)&&(this.XLFormat._updateFormatClass(u[r],t[r].format),this.XLEdit._updateDataContainer(u[r],{dataObj:{formats:t[r].formats},sheetIdx:this.getActiveSheetIndex(),status:i}))},updateRangeData:function(n,i){var u,f,r;if(!this.model.isReadOnly&&(n=this._getRangeArgs(n,"object"),n.length&&(n.startCell={rowIndex:n[0],colIndex:n[1]},n.endCell={rowIndex:n[2],colIndex:n[3]}),u=this._getSelectedRange(n.startCell,n.endCell),f=this._toArrayData(i),f.length===u.length))for(r=0;r<u.length;r++)t.isNullOrUndefined(f[r])||this.XLEdit._updateCellValue(this.getCell(u[r].rowIndex,u[r].colIndex),f[r])},updateData:function(n,i,r){if(!this.model.isReadOnly){var f,a,e,v,c,o,u,h,y=0,p="clear-format",s={},l=this._cellProp,w=this.getActiveSheetIndex(),b=this.getSheet(w);for(i=this._getRangeArgs(i,"object"),f=i[0],a=i[2],v=i[3];f<=a;){for(e=i[1];e<=v;)u=n[y],o=this.getCell(f,e,w),"wrap"in u&&this.setWrapText("wrap",i),this.XLEdit._updateDataContainer({rowIndex:f,colIndex:e},{dataObj:u}),o&&(l[13]in u&&(h=u.hyperlink,h&&(r===p?o.find("a").css({color:this._hlColor,"text-decoration":"underline"}).addClass("e-hyperlinks"):h.webAddr?o.html(t.buildTag("a",u.value2,"",{href:h.webAddr,target:"_blank","class":"e-hyperlinks"})):o.html(t.buildTag("a",u.value2,"",{"class":"e-hyperlinks"})))),r===p&&(u.formatStr&&(s.formatStr=u.formatStr),u.type&&(s.type=u.type),t.isNullOrUndefined(u.decimalPlaces)||(s.decimalPlaces=u.decimalPlaces),t.isNullOrUndefined(u.thousandSeparator)||(s.thousandSeparator=u.thousandSeparator),this.XLFormat.format(s,[f,e,f,e])),l[21]in u&&this.XLComment._updateCmntFrmCntnr(f,e),l[0]in u&&(c=u.value,this.XLEdit._refreshCalcEngine(f,e,this.isFormula(c),c))),y++,e++;f++}}},updateUniqueData:function(n,t,i,r){if(!this.model.isReadOnly){t=this._getRangeArgs(t,"object");var u,f={dataObj:n},e=t[0],o=t[2],s=t[3];for(i&&(f.skipCell=i),f.sheetIdx=r;e<=o;){for(u=t[1];u<=s;)this.XLEdit._updateDataContainer({rowIndex:e,colIndex:u},f),u++;e++}}},clearRangeData:function(n,t,i,r,u,f){if(!this.model.isReadOnly){var e,o,s,h,c=this.getActiveSheetIndex();for(n=this._getRangeArgs(n,"object",c),t=t?t:["value","value2","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","isFilterHighlight"],e=n[0],s=n[2],h=n[3];e<=s;){if(!r||!this._isHiddenRow(e))for(o=n[1];o<=h;)this.XLEdit._clearDataContainer({cellIdx:{rowIndex:e,colIndex:o},property:t,status:u,skipCell:f}),o++;t.indexOf("wrap")>-1&&this._setRowHdrHeight(c,e);e++}}},_getArrayRangeCells:function(n){return n?(n=this.swapRange(n),this.getRange(n)):this._getContent(this.getActiveSheetIndex()).find(".e-selected")},_getAlphaRangeCells:function(n){return n?(n=this.getRangeIndices(n),this.getRange(n)):this._getContent(this.getActiveSheetIndex()).find(".e-selected")},_getMultiRangeCells:function(n){var i,t,u,r,f;if(n){if(i=0,u=[],r=[],this._isString(n))r.push(this.getRangeIndices(n));else if(this.isNumber(n[0]))r.push(n);else for(f=n.length;i<f;)t=n[i],r.push(Array.isArray(t)?t:this.getRangeIndices(t)),i++;for(i=0,f=r.length;i<f;)t=r[i],u=u.concat(this._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]})),i++}else n=this._getRangeArgs(n,"object"),u=this._getSelectedCells(this.getActiveSheetIndex(),n).selCells;return u},_completeAction:function(n){var u=this.getActiveSheetIndex(),e=this.getSheet(u),i,s,v,y,h,c,l,r,f,o,a;if(n.reqType==="filter"){if(n.operation!=="apply-filter"&&n.operation!=="remove-filter"&&n.operation!=="clearfilter")for(s=n.model.currentViewData,i={sheetIndex:u,range:e._selectedRange,currentViewData:s,fieldName:n.currentFilteringColumn,ejpredicate:n.ejpredicate,activeCell:n.activeCell,filteredValue:n.filteredValue,filterCollection:n.filteredcolumns,requestType:n.requestType,reqType:n.reqType,selectedCell:n.selectedCell,action:n.action,operation:"filter",selectedDataSource:e.selectedDataSource,tableID:n.tableID,filteredCells:n.filteredCells,fltrdIdxes:[],selRange:n.selRange},r=0,len=s.length;r<len;r++)i.fltrdIdxes.push(i.range.startRow+e.filterSettings.filteredRange.indexOf(s[r]));else i=n.operation==="remove-filter"||n.operation==="clearfilter"?n:{sheetIndex:u,filteredCells:n.filteredCells,reqType:"filter",operation:"apply-filter",tableID:n.tableID,fRange:this.getSheet(u).filterSettings.range};i.rowIndex=n.rowIndex;i.colIndex=n.colIndex}else if(n.requestType===t.Spreadsheet.Actions.Sorting){for(l=[],c=n.filterIcon.length>0?n.range[0]-1:n.range[0],r=0;r<n.filterIcon.length;r++)h=this.XLFilter._getFilterHeader(u,c,n.filterIcon[r].colIndex),v=t.isNullOrUndefined(h)?"":h.status.indexOf("-asc")>-1?"-asc":h.status.indexOf("-dsc")>-1?"-dsc":"",y=n.filterIcon[r].colIndex===this._generateColCount(n.columnName)-1?n.sortDirection==="ascending"?"-asc":"-dsc":"",l.push({rowIdx:c,colIdx:n.filterIcon[r].colIndex,prevIcon:v,currIcon:y});i={sheetIndex:u,filterIcons:l,isSortByFilter:n.isSortByFilter,colSelected:n.colSelected,range:n.range,columnName:n.columnName,rangeData:n.rangeData,reqType:"sort",direction:n.sortDirection,operation:"unsort"}}else if(n.requestType==="sortbycolor"||n.requestType==="filterbycolor"){if(i={sheetIndex:u,operation:n.operation,oprType:n.oprType,requestType:n.requestType,action:n.action,bgcolor:n.bgcolor,fgcolor:n.fgcolor,tableID:n.tableID,reqType:n.requestType,sortRange:n.sortRange},i.columnName=n.requestType==="sortbycolor"?n.sortColumn:n.filterColumn,n.requestType==="filterbycolor"){for(o=[],a=this._generateColCount(i.columnName),r=n.range.endRow;r>=n.range.startRow;r--)f=this.XLEdit.getPropertyValue(r,a-1,"formats"),t.isNullOrUndefined(f)||(n.operation==="filterbgcolor"?t.isNullOrUndefined(f["background-color"])||n.bgcolor.toLowerCase()===f["background-color"].toLowerCase()&&o.push(r):t.isNullOrUndefined(f.color)||n.fgcolor.toLowerCase()===f.color.toLowerCase()&&o.push(r));i.fltrdIdxes=o;i.rowIndex=n.range.startRow-1;i.colIndex=a-1}}else i=n;!this.model.allowUndoRedo||i.requestType==="sortbycolor"||this._dupDetails||this.updateUndoRedoCollection(i);(n.requestType==="filtering"||n.requestType==="filterbycolor"||n.requestType==="sortbycolor"||n.requestType==="filterbycell")&&n.operation!=="apply-filter"&&n.operation!=="remove-filter"&&this.sendDataRenderingRequest(i,this.getActiveSheetIndex());this.model.allowAutoFill&&n.reqType!=="find-replace"&&this.element.find(".e-ss-activeimg").length<1&&!e._isFreezed&&this.XLDragFill.positionAutoFillElement();this.XLComment&&this.XLComment._isCommentEdit||this._updateUndoRedoIcons();n.reqType!=="paging"&&n.reqType==="edit"&&n.hasValidation&&this._trigrDdlActnCmplt(n.cValue,n.pValue)},updateUndoRedoCollection:function(n){this._isUndoRedo||n.reqType==="update-range"||(this._undoCollection.push(n),this._redoCollection=[]);this._undoCollection.length>this.undoRedoStep&&this._undoCollection.splice(0,1);this.model.showRibbon&&this.XLRibbon._updateRibbonIcons();this._updateUndoRedoIcons()},_trigActionBegin:function(n){return!this._isSaveAsJSON&&this._trigger("actionBegin",n)},_trigActionComplete:function(n){return!this._isSaveAsJSON&&this._trigger("actionComplete",n)},_updateUndoRedoIcons:function(){if(!this.model.showRibbon||!this.model.allowUndoRedo){this.XLComment&&this.XLComment._isCommentEdit||this.setSheetFocus();return}if(n("#"+this._id+"_Ribbon_Home_Actions_Undo").length&&n("#"+this._id+"_Ribbon_Home_Actions_Redo").length&&!this.model.isReadOnly){var t=n("#"+this._id+"_Ribbon_Home_Actions_Undo").data("ejButton"),i=n("#"+this._id+"_Ribbon_Home_Actions_Redo").data("ejButton");t&&(this._undoCollection.length?t.enable():t.disable());i&&(this._redoCollection.length?i.enable():i.disable());this.XLEdit._isEdit||this.XLComment&&this.XLComment._isCommentEdit||this._isSheetRename||!document.activeElement||!(document.activeElement.id.indexOf(this._id+"_Ribbon")<0)||this.setSheetFocus()}},_filterMergeCells:function(n,t){for(var s=this.getActiveSheetIndex(),h=this._dataContainer.sheets[s],e=this.getObjectKeys(h[n]),r,i,o=!1,u,f=0;f<e.length;f++)u=this.XLEdit.getPropertyValue(n,e[f],"mergeIdx"),u&&(r=u,o=!0);o&&(i=this.getCell(r.rowIndex,r.colIndex)[0],i.rowSpan=t==="incr"?i.rowSpan+1:i.rowSpan-1)},_isRowVisible:function(n,t){var i=this._dataContainer.sheets[n];return t in i?0 in i[t]&&(i[t][0].isRHide||i[t][0].isFRHide)?!1:!0:!0},_selectFirstCell:function(n,t,i,r){var u=this.getSheet(n);return u._isImported&&!u._isLoaded||r||(r=!r,this.performSelection({rowIndex:t,colIndex:i},{rowIndex:t,colIndex:i})),r},_clearAllMergeCells:function(t,i,r,u,f,e){var a=this.getSheet(t),y=!1,b=this._dupDetails,p,v=a._mergeColl,k=a._unmergeColl,d=this._removeMergeColl,o,c,g=this._dataContainer.sheets[t],l={isCancel:!1,isAlert:!0},s,w,h;for(this._dupDetails=!0,o=this.getObjectKeys(v),o.length<1&&(y=!0),s=0,w=o.length;s<w;s++)for(c=this.getObjectKeys(v[o[s]]),h=0;h<c.length;h++)mergeObj=n.extend(!0,{},this.XLEdit.getPropertyValue(o[s],c[h],"merge")),p=this.getRangeIndices(mergeObj.mRange),l=this._checkFilterMerge(t,p,i,r,u,f,e,"merge",y,o[s],c[h],mergeObj),l.isClear&&(o[s]in k||(a._unmergeColl[o[s]]={}),a._unmergeColl[o[s]][c[h]]={type:v[o[s]][c[h]],merge:mergeObj,isClear:!0},this.unmergeCells(mergeObj.mRange,!0)),l.isClear=!1;return this._dupDetails=b,{isCancel:l.isCancel,isAlert:l.isAlert}},_checkFilterMerge:function(n,t,i,r,u,f,e,o,s,h,c,l){var v,p=this.getSheet(n),y=this._getSelectedCells(n,t).range,a=!1,w=p._mergeColl;return e.indexOf("shift")>-1||o!="merge"&&(e.indexOf("insert")>-1||e.indexOf("delete")>-1)?(o==="merge"&&(this._removeMergeColl=[]),e.indexOf("Bottom")>-1||e.indexOf("Up")>-1||o!="merge"&&e.indexOf("Row")>-1?(u>=t[1]||t[3]>=u+f-1||e.indexOf("Row")>-1?(i>=t[2]||i<=t[2])&&(u<t[1]&&u+f-1<t[1]?s=!0:u>t[3]&&u+f-1>t[3]?s=!0:this._isTotalRow||u!==t[1]||t[3]!==u+f-1||(a=!0,s=!0),!s&&i>t[2]&&(s=!0)):u<t[1]&&t[3]<u+f-1&&(s=!0,a=!0),o!=="merge"||this._isUndoRedo||e.indexOf("Up")>-1&&this.XLEdit._rangeHasProperty(y,"merge")&&(this._showAlertDlg("Alert","MergePreventInsertDelete","MergePreventInsertDelete",450),a=!1,v=!0)):(e.indexOf("Right")>-1||e.indexOf("Left")>-1||o!="merge"&&e.indexOf("Column")>-1)&&(i>=t[0]||t[2]>=i+r-1||e.indexOf("Column")>-1?(u>=t[3]||u<=t[3])&&(i<t[0]&&i+r-1<t[0]?s=!0:i>t[2]&&i+r-1>t[2]?s=!0:i===t[0]&&t[2]===i+r-1&&(a=!0,s=!0),!s&&u>t[3]&&(s=!0)):i<t[0]&&t[2]<i+r-1&&(s=!0,a=!0),o!=="merge"||this._isUndoRedo||e.indexOf("Left")>-1&&this.XLEdit._rangeHasProperty(y,"merge")&&(this._showAlertDlg("Alert","CtrlKeyErrorAlert","CtrlKeyErrorAction",450),a=!1,v=!0)),o!=="merge"||s||a||this._removeMergeColl.push({type:w[h][c],merge:l})):(this._isUndoRedo&&(s=!0),(i===-1||i!=-1&&t[0]<=i&&t[2]>i)&&(a=!0),(u===-1||u!=-1&&t[1]<=u&&t[3]>u)&&(a=!0)),{isClear:a,isAlert:s,isCancel:v}},_checkTableApplied:function(n,t,i,r,u,f){var l=this.getSheet(n),o,s=l.tableManager,h=this.getObjectKeys(s),e,c;for(this._isTableApplied=!1,e=0,c=h.length;e<c;e++)if(o=s[h[e]].range,chkObj=this._checkFilterMerge(n,o,t,i,r,u,f,"filter",!1),this._isTableApplied=!chkObj.isAlert,this._isTableApplied)return!0;return!1},_refreshAllMergeCells:function(n,i,r,u,f,e){var p=this.getSheet(n),y=!1,b=p._unmergeColl,d=this._dupDetails,g,nt,h,l,o,tt=this._dataContainer.sheets[n],a,v,w,s,k,c;for(h=this.getObjectKeys(b),this._dupDetails=!0,s=0,k=h.length;s<k;s++)for(g=parseInt(h[s])>i?e.indexOf("insert")>-1?parseInt(h[s])+r:parseInt(h[s])-r:h[s],l=this.getObjectKeys(b[h[s]]),c=0;c<l.length;c++)nt=parseInt(l[c])>u?e.indexOf("insert")>-1?parseInt(l[c])+f:parseInt(l[c])-f:l[c],mergeObj=p._unmergeColl[h[s]][l[c]].merge,this.mergeCenter=p._unmergeColl[h[s]][l[c]].type==="center",w=p._unmergeColl[h[s]][l[c]].isClear,o=this.getRangeIndices(mergeObj.mRange),(i>-1||u>-1)&&(t.isNullOrUndefined(o)||(e.indexOf("Shift")>-1?(this._unMergeRange=mergeObj.mRange,this._showAlertDlg("","MergeCellsAlert","MergeCellsInsertAlert",498)):(i>-1&&(o[0]===o[2]&&(y=!0),(!y||w)&&(a=o[0],v=o[2],i<=o[0]&&(a=e==="insert"?o[0]+r:o[0]-r),i<=o[2]&&(v=e==="insert"?o[2]+r:o[2]-r),a<=v&&(o[0]=a),v>=a&&(o[2]=v))),u>-1&&(o[1]===o[3]&&(y=!0),(!y||w)&&(a=o[1],v=o[3],u<=o[1]&&(a=e==="insert"?o[1]+f:o[1]-f),u<=o[3]&&(v=e==="insert"?o[3]+f:o[3]-f),a<=v&&(o[1]=a),v>=a&&(o[3]=v))),!y||y&&e==="insert"?(mRange=this._getAlphaRange(n,o[0],o[1],o[2],o[3]),this.mergeCells(mRange,!0),delete p._unmergeColl[h[s]][l[c]],y=!1,isPMerge=!1):p._unmergeColl[h[s]][l[c]].isClear=!1)));this._dupDetails=d},_clearMergeColl:function(n,t,i){n[t]&&delete n[t][i];this.getObjectKeys(n[t]).length<1&&delete n[t]},_refreshSHMergeCells:function(t,i,r,u,f){var p=this.getSheet(t),o,a,w=n.extend(!0,{},p._mergeColl),h,v,ut=0,y,e,g,nt,ft=!1,et,k,d,tt,it,ot=!1,st,ht,s,ct,l,lt,c,rt,b;if(h=this.getObjectKeys(w),hideColl=u==="column"?this.getObjectKeys(p.hideColsCollection):p.hideRowsCollection,f==="hide")for(s=0,st=h.length;s<st;s++)for(v=this.getObjectKeys(w[h[s]]),l=0,ht=v.length;l<ht;l++)if(isModified=!1,g=!1,newSpan=0,isSamePosn=!1,isMerge=!1,y=this.XLEdit.getPropertyValue(h[s],v[l],"merge"),!(this.getObjectKeys(y).length<1)){for(e=this.getRangeIndices(y.mRange),o=u==="column"?e[1]:e[0],a=u==="column"?e[3]:e[2],c=o;c<=a;c++)i.indexOf(c)>-1&&(isMerge=!0);if(isMerge){if(this._dupDetails=!0,stIdx=i[0],enIdx=i[i.length-1],diff=enIdx-stIdx+1,this.mergeCenter=w[h[s]][v[l]].type==="center",this.unmergeCells(y.mRange),enIdx<o)g=!0,o=o+diff,a=a+diff;else if(a<stIdx)g=!1;else{for(ut=0,nt=!1,c=0,rt=i.length;c<rt;c++)i[c]>=o&&i[c]<=a&&ut++,i[c]===o&&(nt=!0);for((o in i)&&(nt=!0),et=0,b=o;b<=a;b++)u==="column"&&(b=b.toString()),hideColl.indexOf(b)>-1&&et++;et===a-o+1&&(ft=!0);nt&&!ft&&(o=o+ut)}k=u==="row"?o:e[0];tt=u==="row"?a:e[2];d=u==="column"?o:e[1];it=u==="column"?a:e[3];ft?h[s]in p._delmergeColl?p._delmergeColl[h[s]][v[l]]={type:w[h[s]][v[l]].type,merge:y}:(p._delmergeColl[h[s]]={},p._delmergeColl[h[s]][v[l]]={type:w[h[s]][v[l]].type,merge:y}):this.mergeCells(this._getAlphaRange(t,k,d,tt,it),!0);this.mergeCenter=!1;this._updateMergeColl(t,k,d,w[h[s]][v[l]].type,f==="hide")}}if(f==="show")for(this.getObjectLength(p._delmergeColl)>0&&(w=n.extend(!0,{},p._delmergeColl),h=this.getObjectKeys(w)),s=0,ct=h.length;s<ct;s++)for(v=this.getObjectKeys(w[h[s]]),isMerge=!1,l=0,lt=v.length;l<lt;l++){if(y=w[h[s]][v[l]].merge,this.getObjectKeys(y).length<1&&(y=this.XLEdit.getPropertyValue(h[s],v[l],"merge")),this.getObjectKeys(y).length>0){for(e=this.getRangeIndices(y.mRange),o=u==="column"?e[1]:e[0],a=u==="column"?e[3]:e[2],stIdx=i[0],enIdx=i[i.length-1],c=o;c<=a;c++)stIdx<=c&&(isMerge=!0);if(!isMerge||this.getObjectLength(p._delmergeColl)>0)continue;for(this.getObjectLength(p._delmergeColl)===0&&(this._dupDetails=!0,diff=enIdx-stIdx+1,this.mergeCenter=y.isCenterAlign,this.unmergeCells(y.mRange),enIdx<o&&(g=!0,o=o-diff,diff!=1&&(a=a-diff),k=u==="row"?o:e[0],tt=u==="row"?a:e[2],d=u==="column"?o:e[1],it=u==="column"?a:e[3],this.mergeCells(this._getAlphaRange(t,k,d,tt,it),!0),this._updateMergeColl(t,k,d,w[h[s]][v[l]].type,f==="hide"))),ot=!1,c=0,rt=i.length;c<rt;c++)if(u==="row"&&e[0]<=i[c]||u==="column"&&e[1]<=i[c]){ot=!0;break}if(ot){for(e=this.getRangeIndices(y.mRange),diff=0,b=o;b<=a;b++)if(hideColl.indexOf(b)>-1)diff++;else break;o=o+diff;u==="column"?e[1]=o:e[0]=o;this.mergeCells(this._getAlphaRange(t,e[0],e[1],e[2],e[3]),!0);this._updateMergeColl(t,e[0],e[1],w[h[s]][v[l]].type,!0);this._clearMergeColl(p._delmergeColl,h[s],v[l])}}this.mergeCenter=!1}this._dupDetails=!1},_getSpanFromMCells:function(n,t,i){var u=this.getSheet(this.getActiveSheetIndex()),r=u._hideMergeColl;return!this.isUndefined(r[n])&&!this.isUndefined(r[n][t])?i==="row"?r[n][t].rowspan:r[n][t].colspan:0},_setSpanToMCells:function(n,t,i,r){var f=this.getSheet(this.getActiveSheetIndex()),u=f._hideMergeColl;this.isUndefined(u[n])&&(u[n]={});this.isUndefined(u[n][t])&&(u[n][t]={});i==="row"?u[n][t].rowspan=r:u[n][t].colspan=r},sendDataRenderingRequest:function(i,u){for(var f,it=!1,ri,g,at,lt,ui=this._rAlign,o=this.getSheet(u),tt=this.model.scrollSettings.allowVirtualScrolling,e=o._selectedRange,k=[],h,fi,kt,l=o.filteredRowsCollection,v,ft,y,p=o.filterSettings.tableRange,et=[],dt,ot,b=[],st,ut,w,pt,gt,s,wt,bt,d,ni,ct,ti,ii,a=0,rt=p.length;a<rt;a++)if(p[a].tableID==i.tableID){y=a;break}if(tt&&(ri=o.rowsHeightCollection,g=o.hideRowsCollection),this._dupDetails=!0,t.isNullOrUndefined(i)||i.reqType!="filter"){if(!t.isNullOrUndefined(i)&&(i.requestType==="sortbycolor"||i.requestType==="filterbycolor")){var ei=e.startRow,vt=[],ht,yt=[],h=this._generateColCount(i.columnName)-1,c,nt;if(i.prev={},i.cur={},i.oprType.indexOf("Put")<0&&(o._filterColl[e.startRow-1][h].status.indexOf("e-ssfilter")>-1&&i.requestType==="filterbycolor"?this._isRowViewable(u,e.startRow-1)&&(kt=this.getCell(e.startRow-1,h),kt.removeClass(ui),this.XLFilter._changeFilterIcon({rowIndex:e.startRow-1,colIndex:h},"filter",this.XLEdit.getPropertyValue(e.startRow-1,h,"filterState"))):o._filterColl[e.startRow-1][h].status.indexOf("-asc")&&(i.prev.icon=o._filterColl[e.startRow-1][h].status,this._isRowViewable(u,e.startRow-1)&&(kt=this.getCell(e.startRow-1,h),this.XLFilter._changeSortIcon({rowIndex:e.startRow-1,colIndex:h},"ascending")),i.cur.icon=o._filterColl[e.startRow-1][h].status)),i.requestType==="sortbycolor"){for(c=[e.startRow,h,e.endRow,h],nt=this.getRangeData({range:c,skipHiddenRow:!0}),a=0,ut=nt.length;a<ut;a++)ht=nt[a].formats,t.isNullOrUndefined(ht)||(i.operation==="sortbgcolor"?t.isNullOrUndefined(ht["background-color"])||i.bgcolor===ht["background-color"].toLowerCase()&&vt.push(a):t.isNullOrUndefined(ht.color)||i.fgcolor===ht.color.toLowerCase()&&vt.push(a));if((i.oprType==="PutCellColor"||i.oprType==="PutFontColor")&&(c=i.sortRange),this.isUndefined(i.tableID))for(w=[],bt=c[1];bt<=c[3];bt++)w.push(bt);else w=p[y].multifilterIdx;for(c=[e.startRow,w[0],e.endRow,w[w.length-1]],nt=this.getRangeData({range:c,skipHiddenRow:!0}),i.prev.data=n.extend(!0,[],nt),c.colIndex=h,i.range=c,s=0,rt=w.length;s<rt;s++){for(pt=[],gt=[],c=[e.startRow,w[s],e.endRow,w[s]],nt=this.getRangeData({range:c,skipHiddenRow:!0}),wt=vt.length-1;wt>=0;wt--)pt.push(nt.splice(vt[wt],1)[0]);gt=pt.reverse().concat(nt);pt.length>0&&(this._isSort=!0,this._dupDetails=!0,this.XLComment.deleteComment(c,null,!0,null),this._removeHyperlink(null,null,!0,c),this.clearRangeData(c,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0),this.XLFormat.removeStyle(c,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0}),this._isSort=!1,this._dupDetails=!1,this.XLEdit.updateCellWithContainer(gt,c,u,!0))}c=[e.startRow,w[0],e.endRow,w[w.length-1]];i.cur.data=n.extend(!0,[],this.getRangeData({range:c,skipHiddenRow:!0}));this.updateUndoRedoCollection(i)}else{for(yt=[],et=[],p[y].fltrdIdxes=k=i.fltrdIdxes,v=e.startRow===0?0:e.startRow,f=v;f<=e.endRow;f++){for(st=!1,s=0,ut=k.length;s<ut;s++)k[s]==f&&(st=!0);st?(ct=this.XLEdit.getPropertyValue(f,h,"value2"),ct=t.isNullOrUndefined(ct)?"":ct,dt={field:i.columnName,value:ct,predicate:"or",operator:"equal",matchcase:!1},ot=t.Predicate(i.columnName,"equal",ct),this.XLEdit.getPropertyValue(f,0,"filterID")===i.tableID&&(delete this._dataContainer.sheets[u][f][0].isFilterHide,delete this._dataContainer.sheets[u][f][0].filterID,tt?(g.splice(g.indexOf(f),1),this._refreshSHMergeCells(u,[f],1,"row","show")):(this._dupDetails=this._isFilter=!0,this._showRow(f+1,f),this._dupDetails=this._isFilter=!1,l.indexOf(f)>-1&&l.splice(l.indexOf(f),1),o._isImported&&!o._isLoaded||it||(it=!it,this.performSelection({rowIndex:f,colIndex:h},{rowIndex:f,colIndex:h})))),yt.push(dt),b.push(dt),d=b[0],ni=d.from):(t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isRHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFilterHide"))&&(this.XLEdit._updateDataContainer({rowIndex:f,colIndex:0},{dataObj:{isFilterHide:!0,filterID:i.tableID}}),ft=!0),tt?ft&&(g.push(f),this._refreshSHMergeCells(u,[f],1,"row","hide")):(this._dupDetails=this._isFilter=!0,this._hideRow(f,f,"isFilterHide"),this._dupDetails=this._isFilter=!1,l.indexOf(f)===-1&&l.push(f)),ft=!1)}for(tt&&(!o._isImported||o._isLoaded)&&(this.refreshContent(u),this.performSelection({rowIndex:k[0],colIndex:h},{rowIndex:k[0],colIndex:h})),this.XLScroll._getRowHeights(u,v),i.filterCollection=yt,ot=d.ejpredicate?d.ejpredicate:t.Predicate(d.field,d.operator,d.value,!d.matchcase),s=1;s<b.length;s++)ot=b[s].ejpredicate!=r?ot[b[s].predicate](b[s].ejpredicate):ot[b[s].predicate](b[s].field,b[s].operator,b[s].value,!b[s].matchcase);t.isNullOrUndefined(p[y].predicate[i.columnName])&&(p[y].predicate[i.columnName]={});p[y].filteredColumns=yt;p[y].predicate[i.columnName]=ni?{from:d.from,take:d.take}:ot;p[y].hiddenIdx=n.extend(!0,[],et);et=[]}}}else if(h=this._generateColCount(i.fieldName)-1,idx=n.inArray(i.fieldName,o._filteredColumns),i.action.indexOf("clearfiltering")>-1?o._filteredColumns.splice(idx,1):idx<0&&o._filteredColumns.push(i.fieldName),e=i.range,et=p[y].hiddenIdx,at=i.currentViewData,i.requestType.indexOf("filtering")>-1||i.requestType.indexOf("filterbycell")>-1||i.action.indexOf("clearfiltering")===-1){for(lt=o.filterSettings.filteredRange,at.length<1&&k.push(lt[lt.length-1].idx+1),a=0,rt=at.length;a<rt;a++)idx=lt.indexOf(at[a]),idx>-1&&k.push(lt[idx].idx);for(p[y].fltrdIdxes=k,v=e.startRow===0?0:e.startRow,f=v;f<=e.endRow;f++){for(st=!1,s=0,ut=k.length;s<ut;s++)k[s]==f&&(st=!0);st?(t.isNullOrUndefined(this._dataContainer.sheets[u][f])||t.isNullOrUndefined(this._dataContainer.sheets[u][f][0])||(delete this._dataContainer.sheets[u][f][0].isFilterHide,delete this._dataContainer.sheets[u][f][0].filterID,o._filterHRowsColl.indexOf(f)>-1&&o._filterHRowsColl.splice(o._filterHRowsColl.indexOf(f),1)),tt?(g.indexOf(f)>-1&&(this._refreshSHMergeCells(u,[f],1,"row","show"),g.splice(g.indexOf(f),1)),v=f===0?0:f-1,this.XLEdit.getPropertyValue(v,0,"hRow")&&(delete this._dataContainer.sheets[u][v][0].hRow,l.indexOf(f)>-1&&l.splice(l.indexOf(f),1))):(this._dupDetails=this._isFilter=!0,this._showRow(f+1,f),this._dupDetails=this._isFilter=!1,l.indexOf(f)>-1&&l.splice(l.indexOf(f),1),o._isImported&&!o._isLoaded||it||(it=!it,this.performSelection({rowIndex:f,colIndex:h},{rowIndex:f,colIndex:h})))):(t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isRHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFHide"))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(f,0,"isFilterHide"))&&(this.XLEdit._updateDataContainer({rowIndex:f,colIndex:0},{dataObj:{isFilterHide:!0,filterID:i.tableID}}),l.indexOf(f)<0&&l.push(f),ft=!0),tt?(ft&&(g.push(f),ft=!1,this._refreshSHMergeCells(u,[f],1,"row","hide")),v=f===0?0:f-1,this.XLEdit._updateDataContainer({rowIndex:v,colIndex:0},{dataObj:{hRow:!0}}),l.indexOf(f)<0&&l.push(f)):(this._dupDetails=this._isFilter=!0,this._hideRow(f,f,"isFilterHide"),this._dupDetails=this._isFilter=!1,l.indexOf(f)===-1&&l.push(f)))}v=e.startRow===0?0:e.startRow-1;tt&&(!o._isImported||o._isLoaded)&&(this.refreshContent(u),this.performSelection({rowIndex:v,colIndex:h},{rowIndex:v,colIndex:h}));this.XLScroll._getRowHeights(u,v);fi=o.columns;i.action==="clearfiltering"&&(o._filteredByColor=-1,this._excelFilter.closeXFDialog());this.model.allowFiltering&&this.XLFilter._updateFilterIcons(v,e.startRow,h,i.action);p[y].hiddenIdx=n.extend(!0,[],et);et=[]}t.isNullOrUndefined(i)||i.action!=="filter"&&i.action!=="filtering"&&i.action!=="filterbycolor"?i.action==="clearfiltering"&&(i.tableID>-1&&o.filterSettings.tableRange[y].filterColumnName.pop(i.fieldName),this.XLFilter._fltrRowHighlight(e.startRow,e.endRow,"clear",i.tableID,i.filterCollection.length)):(i.tableID>-1&&o.filterSettings.tableRange[y].filterColumnName.push(i.fieldName),this.XLFilter._fltrRowHighlight(e.startRow,e.endRow,"add",i.tableID,i.filterCollection.length));this._dupDetails=!1;this.model.showRibbon&&this.model.allowFiltering&&(ti=n("#"+this._id+"_Ribbon_Data_SortFilter_ClearFilter").data("ejButton"),ii={rowIndex:this.getActiveCell().rowIndex,colIndex:this.getActiveCell().colIndex},this.XLRibbon._changeClrFltrStatus(ti,"button",ii));this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(u,"refresh","vertical","filter")},_filterClose:function(t){this.model.allowFiltering&&!this._hasClass(t,"e-filterspan")&&n(t).parents(".e-excelfilter").length<1&&this._excelFilter._openedFltr&&n(this._excelFilter._openedFltr).is(":visible")&&(this._excelFilter.closeXFDialog(),this.XLFilter._isSearchEdit=!1)},showPager:function(n){this.model.showPager=n;settings=this.model.scrollSettings;this.element.find(".e-spreadsheetfooter").css("display",n?"block":"none");this._setSheetWidthHeight(this.getActiveSheetIndex(),{width:this._responsiveWidth,height:this._responsiveHeight})},_refreshClipboard:function(n,t){var r=this.model,i=this._id;n.length&&(r.allowFormatPainter&&r.allowCellFormatting||n.find("#"+i+"_Ribbon_home_Clipboard")[t](),n.find("#"+i+"_Ribbon_home_Clipboard_1")[t](),n.find("#"+i+"_Ribbon_home_Clipboard_Home_Clipboard_Cut")[t](),n.find("#"+i+"_Ribbon_home_Clipboard_Home_Clipboard_Copy")[t]())},_setModel:function(i){var f,a,g,h,w,c=this.getActiveSheetIndex(),e=this.model,y=e.scrollSettings,u=this._id,s=n("#"+u+"_Ribbon").ejRibbon("instance"),r=this.model.showRibbon?s.element:[],b,k,d,l,o,nt,tt,it,p,v;for(a in i){f=i[a];switch(a){case"allowClipboard":f?(this._refreshClipboard(r,"show"),t.isNullOrUndefined(this.XLClipboard)&&(this.XLClipboard=new t.spreadsheetFeatures.clipboard(this)),this.XLClipboard._initCopyPaste()):this._refreshClipboard(r,"hide");break;case"activeSheetIndex":this.gotoPage(f,!1);break;case"pageSettings":this.isUndefined(i.pageSettings.currentPage)||this.gotoPage(i.pageSettings.currentPage,!1);this.isUndefined(i.pageSettings.pageCount)||(this.getPager().ejPager("option","pageCount",i.pageSettings.pageCount),this._refreshSpreadSheetPager(!0));break;case"allowComments":f?(t.isNullOrUndefined(this.XLComment)&&(this.XLComment=new t.spreadsheetFeatures.comments(this)),r.length&&r.find("#"+u+"_Ribbon_review_Comments").show(),this.XLComment._updateCmntRibIcons()):this.model.showRibbon&&r.find("#"+u+"_Ribbon_review_Comments").hide();break;case"allowFormatPainter":e.allowCellFormatting&&(f?(e.allowClipboard||r.find("#"+u+"_Ribbon_home_Clipboard").show(),t.isNullOrUndefined(this.XLFormat)&&(this.XLFormat=new t.spreadsheetFeatures.cellFormatting(this)),r.length&&r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").show()):r.length&&(e.allowClipboard||r.find("#"+u+"_Ribbon_home_Clipboard").hide(),r.length&&r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").hide()));break;case"allowFormulaBar":f?(g=n("#"+this._id+"_formulabar"),g.length?this.showFormulaBar():this._renderFormulaBar(!0)):this.hideFormulaBar();this._setSheetWidthHeight(c,{width:this._responsiveWidth,height:this._responsiveHeight});break;case"allowHyperlink":r.length&&(f?r.find("#"+u+"_Ribbon_insert_Links").show():r.find("#"+u+"_Ribbon_insert_Links").hide());break;case"enableContextMenu":f&&t.isNullOrUndefined(this.XLCMenu)&&(this.XLCMenu=new t.spreadsheetFeatures.contextmenu(this),this.XLCMenu._initContextMenu(),this.XLCMenu._initColorDialog(),this.XLCMenu._initCMenuFooter());break;case"allowEditing":f?(t.isNullOrUndefined(this.XLEdit)&&(this.XLEdit=new t.spreadsheetFeatures.editing(this)),this.model.showRibbon&&r.length&&r.find("#"+u+"_Ribbon_home_Editing").show(),this.XLEdit._processEditing(),this.model.enableContextMenu&&this.XLCMenu._enableMenuOpt(["RenameSheet"],"contextMenuFooter")):(r.length&&r.find("#"+u+"_Ribbon_home_Editing").hide(),this.model.enableContextMenu&&this.XLCMenu._disableMenuOpt(["RenameSheet"],"contextMenuFooter"));break;case"allowResizing":f&&t.isNullOrUndefined(this.XLResize)&&(this.XLResize=new t.spreadsheetFeatures.resizing(this));break;case"allowDataValidation":f?(r.find("#"+u+"_Ribbon_data_DataTools").show(),t.isNullOrUndefined(this.XLValidate)&&(this.XLValidate=new t.spreadsheetFeatures.validation(this),this.XLRibbon._renderValDialog(this.XLRibbon._initValDialog()),this.XLValidate._addDVMethod())):r.length&&r.find("#"+u+"_Ribbon_data_DataTools").hide();break;case"allowConditionalFormats":f?(r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_ConditionalFormatting").show(),this.XLRibbon._initCFDialog(),t.isNullOrUndefined(this.XLCFormat)&&(this.XLCFormat=new t.spreadsheetFeatures.cFormat(this))):r.length&&r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_ConditionalFormatting").hide();break;case"allowSearching":this.model.allowSearching=f;f?(t.isNullOrUndefined(this.XLSearch)&&(this.XLSearch=new t.spreadsheetFeatures.findnreplace(this)),r.length&&r.find("#"+u+"_Ribbon_others_Editing").show()):r.length&&r.find("#"+u+"_Ribbon_others_Editing").hide();break;case"pictureSettings":for(w in f)switch(w){case"allowPictures":e.pictureSettings.allowPictures=f[w];f[w]?(t.isNullOrUndefined(this.XLShape)&&(this.XLShape=new t.spreadsheetFeatures.shape(this)),r.length&&r.find("#"+u+"_Ribbon_insert_Illustrations").show()):r.length&&r.find("#"+u+"_Ribbon_insert_Illustrations").hide()}break;case"showRibbon":this.model.showRibbon=f;b=n("#"+u+"_Ribbon");f?(b.length?b.show():this.XLRibbon._renderRibbon(!0),s=n("#"+u+"_Ribbon").ejRibbon("instance"),r=s.element,r[0].style.overflow==="hidden"&&(r[0].style.overflow="")):b.hide();this.refreshSpreadsheet();break;case"exportSettings":for(h in f)switch(h){case"allowExporting":e.exportSettings.allowExporting=f[h];f[h]?((e.exportSettings.excelUrl||e.exportSettings.csvUrl||e.exportSettings.pdfUrl)&&r.length&&r.find("#saveas_backStageTab").show(),t.isNullOrUndefined(this.XLExport)&&(this.XLExport=new t.spreadsheetFeatures.exporting(this))):(r.length&&r.find("#saveas_backStageTab").hide(),r.length&&r.find("#"+u+"_Ribbon_BackStage_saveas").hide());break;case"excelUrl":e.exportSettings.excelUrl=f[h];f[h]?(r.length&&r.find("#saveas_backStageTab").show(),r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").show()):r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").hide();break;case"csvUrl":e.exportSettings.csvUrl=f[h];f[h]?(r.length&&r.find("#saveas_backStageTab").show(),r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").show()):r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").hide();break;case"pdfUrl":e.exportSettings.pdfUrl=i[a][h];f[h]?(r.length&&r.find("#saveas_backStageTab").show(),r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").show()):r.find("#"+u+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").hide()}break;case"allowKeyboardNavigation":f&&t.isNullOrUndefined(this.XLCellNav)&&(this.XLCellNav=new t.spreadsheetFeatures.cellNavigation(this));break;case"enablePivotTable":f?(t.isNullOrUndefined(this.XLPivot)&&(this.XLPivot=new t.spreadsheetFeatures.pivot(this)),r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").show()):(r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").hide(),this.hideActivationPanel(),this.XLRibbon._toggleAnalyzeTab(),this.getSheetElement(c).find(".e-ss-activepivot").removeClass("e-ss-activepivot"));break;case"allowAutoFill":f?(t.isNullOrUndefined(this.XLDragFill)?(this.XLDragFill=new t.spreadsheetFeatures.dragFill(this),this._createAutoFillElement()):this.getAutoFillElem().show(),this.XLDragFill.positionAutoFillElement()):this.getAutoFillElem().hide();break;case"autoFillSettings":for(autofillProp in f)switch(autofillProp){case"fillType":e.allowAutoFill&&(e.autoFillSettings.fillType=f[autofillProp]);break;case"showFillOptions":e.allowAutoFill&&(e.autoFillSettings.showFillOptions=f.showFillOptions)}break;case"allowSelection":f&&t.isNullOrUndefined(this.XLSelection)&&(this.XLSelection=new t.spreadsheetFeatures.selection(this),this._initSelection());break;case"allowDragAndDrop":f&&t.isNullOrUndefined(this.XLDragDrop)&&(this.XLDragDrop=new t.spreadsheetFeatures.dragAndDrop(this));break;case"allowCellFormatting":f?((e.allowConditionalFormats||e.allowFormatAsTable)&&r.find("#"+u+"_Ribbon_home_Styles").show(),r.length&&(r.find("#"+u+"_Ribbon_home_Font").show(),r.find("#"+u+"_Ribbon_home_Number").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_TopAlign").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_MiddleAlign").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_BottomAlign").show(),r.find("#"+u+"_Ribbon_separator_bottom").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignLeft").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignCenter").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignRight").show(),r.find("#"+u+"_Ribbon_separator_right").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_DecreaseIndent").show(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_IncreaseIndent").show(),r.find("#"+u+"_Ribbon_home_separator_right").show(),r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_CellStyles").show(),e.allowFormatPainter&&r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").show(),e.allowClipboard&&r.find("#"+u+"_Ribbon_home_Clipboard").show()),t.isNullOrUndefined(this.XLFormat)&&(this.XLFormat=new t.spreadsheetFeatures.cellFormatting(this)),t.isNullOrUndefined(this.XLCellFrmtDlg)&&(this.XLCellFrmtDlg=new t.spreadsheetFeatures.formatCellDialog(this)),n("#"+u+"_formatdlg").length===0&&this.XLCellFrmtDlg._renderCellFrmtDlg()):r.length&&(r.find("#"+u+"_Ribbon_home_Font").hide(),r.find("#"+u+"_Ribbon_home_Number").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_TopAlign").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_MiddleAlign").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_BottomAlign").hide(),r.find("#"+u+"_Ribbon_separator_bottom").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignLeft").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignCenter").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_AlignRight").hide(),r.find("#"+u+"_Ribbon_separator_right").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_DecreaseIndent").hide(),r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_IncreaseIndent").hide(),r.find("#"+u+"_Ribbon_home_separator_right").hide(),r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_CellStyles").hide(),r.find("#"+u+"_Ribbon_home_Clipboard_Home_Clipboard_FormatPainter").hide(),e.allowClipboard||r.find("#"+u+"_Ribbon_home_Clipboard").hide(),e.allowConditionalFormats||e.allowFormatAsTable||r.find("#"+u+"_Ribbon_home_Styles").hide());break;case"allowImport":r.length&&(f?r.find("#open_backStageTab").show():r.find("#open_backStageTab").hide());break;case"importSettings":for(importProp in f)switch(h){case"importMapper":e.importSettings.importMapper=f[importProp];break;case"importUrl":e.importSettings.importUrl=f[importProp];break;case"password":e.importSettings.password=f[importProp]}break;case"allowSorting":if(k=document.getElementById(u+"number_MenuItem"),d=document.getElementById(u+"string_MenuItem"),f?(p=n("#"+u+"_Ribbon_SortFilter").data("ejMenu"),t.isNullOrUndefined(this.XLSort)&&(this.XLSort=new t.spreadsheetFeatures.sorting(this)),r.length&&(r.find("#"+u+"_Ribbon_data_SortFilter_1").show(),r.find("#"+u+"_Ribbon_data_Sort").show(),r.find("#"+u+"_Ribbon_home_Editing_1").show()),p.enableItemByID("Ribbon_SortAtoZ"),p.enableItemByID("Ribbon_SortZtoA")):r.length&&(r.find("#"+u+"_Ribbon_data_SortFilter_1").hide(),this.model.allowFiltering||(r.find("#"+u+"_Ribbon_data_Sort").hide(),r.find("#"+u+"_Ribbon_home_Editing_1").hide())),this.model.allowFiltering)for(o=0;o<3;o++)t.isNullOrUndefined(k)||(k.childNodes[o].style.display=this.model.allowSorting?o===2?"block":"inline":"none"),t.isNullOrUndefined(d)||(d.childNodes[o].style.display=this.model.allowSorting?o===2?"block":"inline":"none");break;case"formatSettings":if(e.allowCellFormatting)for(l in f)switch(l){case"allowFontFamily":e.formatSettings.allowFontFamily=f[l];r.length&&(f[l]?r.find("#"+u+"_Ribbon_home_Font_Home_Font_FontFamily").show():r.find("#"+u+"_Ribbon_home_Font_Home_Font_FontFamily").hide());break;case"allowDecimalPlaces":e.formatSettings.allowDecimalPlaces=f[l];r.length&&(f[l]?(r.find("#"+u+"_Ribbon_home_Number_Home_Number_IncreaseDecimal").show(),r.find("#"+u+"_Ribbon_home_Number_Home_Number_DecreaseDecimal").show(),r.find("#"+u+"_Ribbon_separator_Home_Number_CommaStyle").show()):(r.find("#"+u+"_Ribbon_home_Number_Home_Number_IncreaseDecimal").hide(),r.find("#"+u+"_Ribbon_home_Number_Home_Number_DecreaseDecimal").hide(),r.find("#"+u+"_Ribbon_separator_Home_Number_CommaStyle").hide()));break;case"allowCellBorder":e.formatSettings.allowCellBorder=f[l];r.length&&(f[l]?(r.find("#"+u+"_Ribbon_separator_border").show(),r.find("#"+u+"_Ribbon_home_Font_Home_Font_Border").show()):(r.find("#"+u+"_Ribbon_separator_border").hide(),r.find("#"+u+"_Ribbon_home_Font_Home_Font_Border").hide()))}break;case"sheets":for(o=0,nt=f.length;o<nt;o++)for(tt in f[o]){if(this.model.sheetCount<o+1&&f.length>c)return;switch(tt){case"showGridlines":o+1===c?this._showGridlines(f[o].showGridlines,c):this.getSheet(o+1).showGridlines=f[o].showGridlines;break;case"showHeadings":o+1===c?this._showHeadings(f[o].showHeadings,c):this.getSheet(o+1).showHeadings=f[o].showHeadings}}break;case"scrollSettings":y={};it=e.scrollSettings.isResponsive;t.isNullOrUndefined(i.scrollSettings)||(t.isNullOrUndefined(i.scrollSettings.allowScrolling)||(e.scrollSettings.allowScrolling=i.scrollSettings.allowScrolling),t.isNullOrUndefined(i.scrollSettings.allowVirtualScrolling)||(e.scrollSettings.allowVirtualScrolling=i.scrollSettings.allowVirtualScrolling),t.isNullOrUndefined(i.scrollSettings.isResponsive)||(it=e.scrollSettings.isResponsive=i.scrollSettings.isResponsive),t.isNullOrUndefined(i.scrollSettings.scrollMode)||(e.scrollSettings.scrollMode=i.scrollSettings.scrollMode==="normal"?t.Spreadsheet.scrollMode.Normal:t.Spreadsheet.scrollMode.Infinite),t.isNullOrUndefined(i.scrollSettings.width)||(e.scrollSettings.width=i.scrollSettings.width),t.isNullOrUndefined(i.scrollSettings.height)||(e.scrollSettings.height=i.scrollSettings.height));e.scrollSettings.isResponsive||(n.extend(!0,y,this.model.scrollSettings),this.element.height(y.height).width(y.width),n("#"+this._id+"_Ribbon").ejRibbon("option",{width:y.width}),this._updateResponsiveSettings(),this._setSheetWidthHeight(c,{height:this._responsiveHeight,width:this._responsiveWidth}));break;case"allowFiltering":f?(p=n("#"+u+"_Ribbon_SortFilter").data("ejMenu"),r.length&&(r.find("#"+u+"_Ribbon_data_SortFilter_2").show(),r.find("#"+u+"_Ribbon_data_Sort").show(),r.find("#"+u+"_Ribbon_home_Editing_1").show()),p.enableItemByID("Ribbon_Filter"),t.isNullOrUndefined(this.XLFilter)&&(this.XLFilter=new t.spreadsheetFeatures.filter(this)),this.XLFilter._renderExcelFilter()):r.length&&(this.model.allowSorting||(r.find("#"+u+"_Ribbon_data_Sort").hide(),r.find("#"+u+"_Ribbon_home_Editing_1").hide()),r.find("#"+u+"_Ribbon_data_SortFilter_2").hide());break;case"allowInsert":f?(r.length&&!e.allowDelete&&r.find("#"+u+"_Ribbon_others_Cells").show(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_1").show(),this.getPager().find(".e-new").removeClass("e-disable"),e.enableContextMenu&&this.XLCMenu._enableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter")):(r.length&&!e.allowDelete&&r.find("#"+u+"_Ribbon_others_Cells").hide(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_1").hide(),this.getPager().find(".e-new").addClass("e-disable"),e.enableContextMenu&&this.XLCMenu._disableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter"));break;case"allowDelete":f?(!e.allowInsert&&r.length&&r.find("#"+u+"_Ribbon_others_Cells").show(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_2").show(),e.enableContextMenu&&this._getSheetNames(!0).length>1&&this.XLCMenu._enableMenuOpt(["DeleteSheet"],"contextMenuFooter")):(!e.allowInsert&&r.length&&r.find("#"+u+"_Ribbon_others_Cells").hide(),r.length&&r.find("#"+u+"_Ribbon_others_Cells_2").hide(),e.enableContextMenu&&this.XLCMenu._disableMenuOpt(["DeleteSheet"],"contextMenuFooter"));break;case"allowFreezing":f?(t.isNullOrUndefined(this.XLFreeze)&&(this.XLFreeze=new t.spreadsheetFeatures.freezepane(this),this.XLFreeze._initFreeze()),r.length&&r.find("#"+u+"_Ribbon_others_Window").show()):r.length&&r.find("#"+u+"_Ribbon_others_Window").hide();break;case"allowMerging":r.length&&(f?r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_Merge").show():r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_Merge").hide());break;case"allowWrap":r.length&&(f?r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_WrapText").show():r.find("#"+u+"_Ribbon_home_Alignment_Home_Alignment_WrapText").hide());break;case"allowUndoRedo":r.length&&(f?r.find("#"+u+"_Ribbon_home_Actions").show():r.find("#"+u+"_Ribbon_home_Actions").hide());break;case"frozenRows":e.allowFreezing&&this.XLFreeze.freezeRows(f);break;case"frozenColumns":e.allowFreezing&&this.XLFreeze.freezeColumns(f);break;case"freezePanes":e.allowFreezing&&this.XLFreeze.freezePanes(f.rowIndex,f.colIndex);case"allowFormatAsTable":f?(e.enablePivotTable||r.find("#"+u+"_Ribbon_insert_Tables").show(),t.isNullOrUndefined(this.XLFormat)&&(this.XLFormat=new t.spreadsheetFeatures.cellFormatting(this)),r.length&&(r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_FormatAsTable").show(),r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_Table").show())):r.length&&(e.enablePivotTable||r.find("#"+u+"_Ribbon_insert_Tables").hide(),r.find("#"+u+"_Ribbon_home_Styles_Home_Styles_FormatAsTable").hide(),r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_Table").hide());break;case"enablePivotTable":r.length&&(f?(!e.allowFormatAsTable&&r.length&&r.find("#"+u+"_Ribbon_insert_Tables").show(),r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").show()):(!e.allowFormatAsTable&&r.length&&r.find("#"+u+"_Ribbon_insert_Tables").hide(),r.length&&r.find("#"+u+"_Ribbon_insert_Tables_Insert_Tables_PivotTable").hide()));break;case"allowAutoSum":r.length&&(f?r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_AutoSum").show():r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_AutoSum").hide());break;case"allowCharts":f?((t.isNullOrUndefined(this.XLChart)||t.isNullOrUndefined(this.XLShape))&&(this.XLShape=new t.spreadsheetFeatures.shape(this),this.XLChart=new t.spreadsheetFeatures.chart(this)),r.length&&r.find("#"+u+"_Ribbon_insert_Charts").show()):r.length&&r.find("#"+u+"_Ribbon_insert_Charts").hide();break;case"printSettings":for(v in f)switch(v){case"allowPrinting":e.printSettings.allowPrinting=f[v];f[v]?(this.XLPrint=new t.spreadsheetFeatures.print(this),r.length&&(r.find("#"+u+"_Ribbon_pagelayout_Print").show(),r.find("#print_backStageTab").show())):r.length&&(r.find("#print_backStageTab").hide(),r.find("#"+u+"_Ribbon_pagelayout_Print").hide());break;case"allowPageSize":e.printSettings.allowPageSize=f[v];r.length&&(f[v]?r.find("#"+u+"_Ribbon_pagelayout_PageLayout").show():r.find("#"+u+"_Ribbon_pagelayout_PageLayout").hide())}break;case"allowLockCell":r.length&&(f?(r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_ProtectSheet").show(),r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_LockCell").show()):(r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_ProtectSheet").hide(),r.find("#"+u+"_Ribbon_review_Changes_Review_Changes_LockCell").hide()));break;case"undoRedoStep":this.undoRedoStep=f;break;case"enableTouch":this._wireTouchEvts(f?"_on":"_off");break;case"showPager":this.showPager(i[a]);this._refreshSpreadSheetPager();break;case"allowOverflow":this._refreshOverflow();break;case"allowClear":r.length&&(f?r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_Clear").show():r.find("#"+u+"_Ribbon_home_Editing_Home_Editing_Clear").hide());break;case"isReadOnly":this._readOnly();break;case"locale":this.model.locale=i[a];this._destroy();this.model.sheets.splice(0,1);this._init();break;case"allowCellType":f&&(this.XLCellType=new t.spreadsheetFeatures.cellType(this));break;case"activationPanelWidth":this.model.apWidth=f;this.getActivationPanel().width(f-1)}}r.length&&(e.allowAutoSum||e.allowFiltering||e.allowUndoRedo||e.allowSorting||e.allowClipboard||e.allowFormatPainter||e.allowCellFormatting||e.allowMerging||e.allowWrap||e.allowConditionalFormats||e.allowFormatAsTable?s.showTab(this._getLocStr("HOME")):s.hideTab(this._getLocStr("HOME")),e.allowFormatAsTable||e.allowPictures||e.allowHyperlink||e.allowCharts?s.showTab(this._getLocStr("INSERT")):s.hideTab(this._getLocStr("INSERT")),e.allowDataValidation||e.allowFiltering||e.allowSorting?s.showTab(this._getLocStr("DATATAB")):s.hideTab(this._getLocStr("DATATAB")),e.printSettings.allowPrinting?s.showTab(this._getLocStr("PAGELAYOUT")):s.hideTab(this._getLocStr("PAGELAYOUT")),e.allowComments||e.allowLockCell?s.showTab(this._getLocStr("REVIEW")):s.hideTab(this._getLocStr("REVIEW")),e.allowFreezing||e.allowInsert||e.allowDelete||e.allowSearching?s.showTab(this._getLocStr("OTHERS")):s.hideTab(this._getLocStr("OTHERS")))},"import":function(t){if(this.model.allowImport){!t.dataContainer&&this.model.allowCellFormatting&&this.XLFormat&&this.getObjectLength(this.XLFormat._customFontFamily)>0&&(t.dataContainer=JSON.stringify({customFontFamily:this.XLFormat._customFontFamily}));var r=this,i={type:"POST",data:this._import(t),async:this.isUndefined(t.async)?!0:t.async,url:this.model.importSettings.importMapper,success:function(n){r._importSuccess(n)},error:function(n,t){r._importFailed({type:t,xhr:{status:n.status,statusText:n.statusText}})}};(this._browserDetails.name!=="msie"||this._browserDetails.version!=="9.0"||i.data.append)&&(i.processData=!1,i.contentType=!1);n("#"+this._id+"_Ribbon_BackStage").hide();r.showWaitingPopUp();n.ajax(i)}},_import:function(n){if(window.FormData&&this._isObject(n)){var t=new FormData;for(prop in n)prop!="async"&&t.append(prop,n[prop]);return t}return n},_importSuccess:function(n){var t=["UnsupportedFile","IncorrectPassword","InvalidUrl","NeedPassword"];if(t.indexOf(n)>-1){switch(n){case t[0]:case t[1]:case t[2]:this._showAlertDlg("Alert",n,"",null,110);break;case t[3]:this._showDialog(this._id+"_ImportPasswordDialog");this.model.importSettings.password=""}this.hideWaitingPopUp()}else this.loadFromJSON(JSON.parse(n))},loadFromJSON:function(t){this.isImport=!0;n("#"+this._id+"_file").ejUploadbox("option","autoUpload",!0);var i,f,r=1,o,u=t.model&&t.model.nameManager,e;if(u&&u.length)for(e in u)u[e].refersto=this._decode(u[e].refersto);if(this._isSheetReq)i=Number(this.getObjectKeys(t.dataContainer.sheets)[0]),this._refreshImpStyles(t.dataContainer.hashCode),this._impData.dataContainer=n.extend(!0,{},t.dataContainer),this._impData.dataContainer.sheets=this._dataContainer.sheets,this._impData.dataContainer.cellType=this._dataContainer.cellType,this._impData.dataContainer.sheets[i]=t.dataContainer.sheets[i],this._impData.model.sheets[i]=t.sheet,this._dataContainer=n.extend(!0,{},this._impData.dataContainer),this._dataContainer.sheetCellType={},this._refreshModel(t.sheet,!0,i),this._sheetSettings(i),this._intrnlReq||this.gotoPage(i,!1),this._isSheetReq=!1;else if(this.model.scrollSettings.allowVirtualScrolling||(f=this._getMaxRowColCnt(t.model.sheets,!0)),this.model.scrollSettings.allowVirtualScrolling||t.dataContainer.sharedData.length<50001&&f.rowCount<10001&&f.colCount<126){if(this._impData=t,o={importData:t},this._trigger("onImport",o))return;if(this._isInitLoad)this._initBase();else{for(this._destroy(),this._refreshModel(t.model),this._dataContainer=n.extend(!0,{},t.dataContainer),this._dataContainer.sheetCellType={},this._initCSSTag();r<=this.model.sheetCount;)this._sheetSettings(r),this._newSIndex++,r++;for(r=1;r<=this.model.sheetCount;)this.model.scrollSettings.allowVirtualScrolling||this.model.importSettings.allowSheetOnDemand||this._initSheet(r),r++;this._refreshNameMngr(t.model.nameManager);this.gotoPage(this.getActiveSheetIndex(),!1);this._isRibbonDestroyed=!1}this._trigger("loadComplete");this.clearUndoRedo()}else this._showAlertDlg("Alert","HugeDataAlert");this._intrnlReq||(this.isImport=!1);this._intrnlReq=!1;this._renderDDownList();this.hideWaitingPopUp()},_importFailed:function(n){var t={failureType:n.type};n.xhr?(t.status=n.xhr.status,t.statusText=n.xhr.statusText):t.statusText=n.error;this.hideWaitingPopUp();this._trigger("openFailure",t)},_importSheet:function(n,t){var i={},r=this.model.importSettings;this._isSheetReq=!0;i={sheetIndex:n,allowSheetOnDemand:r.allowSheetOnDemand,password:this._encrypt(r.password),async:t};i.dataContainer=JSON.stringify({hashCode:this._dataContainer.hashCode,sharedData:this._dataContainer.sharedData,valData:this._dataContainer.valData,cFormatData:this._dataContainer.cFormatData});this["import"](i);this.getSheet(n)._isRequested=!0},_decode:function(t){return n("<div/>").html(t).text()},_refreshModel:function(n,t,i){var u,e,r,f=1;if(n)if(t)r=this.model.sheets[this._getSheetIndex(i)],r.rowCount=n.rowCount||this.defaults.rowCount,r.colCount=n.colCount||this.defaults.colCount;else{for(this.model.sheetCount=n.sheetCount||this.defaults.sheetCount,this.model.activeSheetIndex=n.activeSheetIndex||this.defaults.activeSheetIndex,this.model.rowHeight=n.rowHeight||this.defaults.rowHeight,this.model.columnWidth=n.columnWidth||this.defaults.columnWidth,this.model.sheets=[{}],u=n.sheets.length;f<u;)r=n.sheets[f],e={rowCount:r.rowCount||this.defaults.rowCount,colCount:r.colCount||this.defaults.colCount},this.model.sheets.push(e),f++;n.nameManager&&n.nameManager.length&&(this.model.nameManager=n.nameManager)}else u=this.model.sheets.length,this.model.sheetCount<u&&(this.model.sheetCount=u);this.model.apWidth===300&&this.model.activationPanelWidth!==300?this.model.apWidth=this.model.activationPanelWidth:this.model.apWidth!==300&&this.model.activationPanelWidth===300&&(this.model.activationPanelWidth=this.model.apWidth)},_refreshImpStyles:function(n){for(var r,t,i=0,u=n.length;i<u;)t=n[i],this._dataContainer.hashCode.indexOf(t)===-1&&(t.indexOf("e-format")===-1?(this._dataContainer.hashCode.push(t),t.length<25&&this.XLFormat._writeCssRules(t,this.XLFormat._getCssPropertyAsString({border:this.XLFormat.getBorderFromHashCode(t)}))):(r=this.XLFormat.getFormatFromHashCode(t),this.XLFormat._createFormatClass(r))),i++},_refreshImpSheets:function(t){var i=this._impData.model.sheets[t];this._refreshImpCells(t);this._refreshImpCF(t);this.model.allowMerging&&i.mergedCells&&this._refreshImpMC(i.mergedCells);this.model.allowFiltering&&i.filterSettings&&i.filterSettings.range&&this.XLFilter._filterCellRange(t,i.filterSettings.range);this._refreshImpHC(i.hideColsCollection);this._refreshImpHR(i.hideRowsCollection);this._refreshImpTable(i.tableManager);this._refreshOverflow();this.model.allowCellType&&this._refreshSheetCellTypes(this._impData.dataContainer.sheetCellType,t);this._refreshShapePosOnImp(i.shapeMngr,t);this._refreshImpCharts(i.shapeMngr.chart);this._refreshImpPics(i.shapeMngr,t);this._refreshImpPvts(i.pivotMngr,t);i.showGridlines===!1&&n("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").ejCheckBox({checked:i.showGridlines});i.isSheetProtected&&this.protectSheet(!0)},_refreshImpCells:function(n){for(var t,i=0,u=this.getSheet(n).usedRange,r=this.XLEdit._getPropWithCellIdx([0,0,u.rowIndex,u.colIndex],"value",n,!0),f=r.length;i<f;)t=r[i],this.XLEdit._refreshCalcEngine(t.rowIdx,t.colIdx,!0,t.value,n),i++;if(this.model.allowCellFormatting&&this.model.formatSettings.allowCellBorder)for(i=0,r=this.XLEdit._getPropWithCellIdx([0,0,u.rowIndex,u.colIndex],"borders",n),f=r.length;i<f;)t=r[i],this.XLFormat.applyBorder(t.value,[t.rowIdx,t.colIdx,t.rowIdx,t.colIdx]),i++},_refreshSheetCellTypes:function(n,t){var r=[],i,u;if(!(this.getObjectLength(n)<1)){for(i=1,u=this.getObjectLength(n[t]);i<=u;i++)r.push({range:n[t][i].settings.range,settings:n[t][i].settings});this.XLCellType._rangeCellTypes(r,t,!0)}},_refreshImpCF:function(n){if(this.model.allowConditionalFormats)for(var t,r=this._impData.dataContainer.cFormatData.length,i=0;i<r;i++)t=this._impData.dataContainer.cFormatData[i].split("_"),idx=Number(t[4]),idx===n&&(this.XLCFormat._cFormat(t[0],t[1],t[2],t[3],t[5],idx,this.getRangeIndices(t[5])),this._impData.dataContainer.cFormatData.splice(i,1),r=this._impData.dataContainer.cFormatData.length,i--)},_refreshImpMC:function(n){var t,i=n.length;if(i)while(i--)t=n[i],t.isCenterAlign&&(this.mergeCenter=!0),this.mergeCells(t.range,!0),this.mergeCenter=!1},_refreshImpHC:function(n){var t,r=this.getObjectKeys(n),i=r.length;if(i)while(i--)t=parseInt(r[i]),this._hideColumn(t,t)},_refreshImpResRowHght:function(n){for(var e,f,h,t,u,o=this.getSheet(n),v=o._restrictedHeightRows,p=this._dataContainer.sheets[n],w=this._dataContainer.hashCode,i,c,l=!0,y=this._impData&&this._impData.model.sheets[n]&&this._impData.model.sheets[n].mergedCells?this._impData.model.sheets[n].mergedCells:[],a=[],s,r=0;r<y.length;r++)i=this.getRangeIndices(y[r].range),a.push(i);for(f=this.element.find("#"+this._id+"_emptyDiv"),e=0;e<v.length;e++){u=v[e];cellsData=p[u];for(t in cellsData)if((s=this._dataContainer.sharedData[cellsData[t].value],s&&!this.isFormula(s))&&(hashIdx=cellsData[t].formats,hashIdx)){if(h=w[hashIdx],cellsData[t].wrap){for(r in a)if(i=a[r],i[0]<=u&&i[2]>=u&&i[1]<=t&&i[3]>=t){l=!1;break}l&&(f.width(o.columnsWidthCollection[t]-3),h+=" e-sswraptext")}this.addClass(f[0],h);f.text(s);c=f[0].offsetHeight+1;o.rowsHeightCollection[u]<c&&(o.rowsHeightCollection[u]=c);this._refreshGlobalSpan(null,!0);l=!0}}},_refreshImpHR:function(n){for(var t,i,u=this.getActiveSheetIndex(),s=this.getSheet(u),n=n||[],f=this.getRows(u),h=f[1],c=f[0],e=this._getJSSheetRowHeaderContent(u),l=e.find("tr"),r=0,o=n.length;r<o;r++)t=parseInt(n[r]),i=t?t-1:0,this.isUndefined(this.XLEdit.getPropertyValue(i,0,"isRHide"))&&this.XLEdit._updateDataContainer({rowIndex:i,colIndex:0},{dataObj:{hRow:!0}}),this.model.scrollSettings.allowVirtualScrolling?this.addClass(e.find("[idx ="+i+"] .e-rowheader")[0],"e-hrow"):(this.addClass(l.find(".e-rowheader")[i],"e-hrow"),this.addClass(h[t],"e-r-hide"),this.addClass(c[t],"e-r-hide")),this.XLScroll._getRowHeights(u,s.hideRowsCollection.sort()[0])},_refreshImpTable:function(n){var i,r,t,u=this.getObjectLength(n);if(this.model.allowFormatAsTable&&u)while(u--)t=n[u],i=t.range,r=this.XLFormat._getTableLayoutFromName(t.formatName),r||(r=this.XLFormat._formatAsTableStyle,t.formatName=r.formatName),this.XLFormat.createTable({header:!0,name:"Table"+this._tableCnt,format:r.format,formatName:t.formatName,showHeaderRow:t.showHeaderRow},this._getAlphaRange(this.getActiveSheetIndex(),i[0],i[1],i[2],i[3]))},_refreshImpCharts:function(n){if(this.model.allowCharts)for(var i,t,r=0,u=this.getObjectLength(n);r<u;)t=n["chart"+r],i=this.getSheet(t.dataSheetIdx),t.dataSheetIdx!=this.getActiveSheetIndex()&&i._isImported&&!i._isRequested&&(this._intrnlReq=!0,this._importSheet(t.dataSheetIdx,!1)),this.XLChart.createChart(t.range,{type:t.commonSeriesOptions.type,enable3D:t.enable3D,marker:t.commonSeriesOptions.marker,top:t.top,left:t.left,height:t.size.height,width:t.size.width,title:t.title,legend:t.legend,primaryYAxis:t.primaryYAxis,primaryXAxis:t.primaryXAxis,dataSheetIdx:t.dataSheetIdx}),r++},_refreshImpPics:function(n,t){if(this.model.pictureSettings.allowPictures)for(var i,r=0,u=this.getObjectKeys(n.picture),f=u.length;r<f;)i=n.picture[u[r]],i.sheetIdx=t,this.getSheet(t)._isUpdated?(i.imgData=n.sharedPics[i.data],this.XLShape._refreshPictureElement(i)):this.XLShape._createPicture(t,null,n.sharedPics[i.data],i.top,i.left,i.width,i.height,null,i.bcolor,i.bstyle,i.bwidth,i),r++},_refreshShapePosOnImp:function(n,t){var f=n.chart,e=n.picture,i,o,r,s,u,c=this.getSheet(t),a=c._rowHeightCollection,l=c.rowsHeightCollection,h=this._impData?this._impData.model.sheets[t].rowsHeightCollection:[];if(!this.getObjectLength(e)&&!this.getObjectLength(f))return!1;for(i=0;i<h.length;i++)if(h[i]!==l[i]){o=l[i]-h[i];s=a[i+1]-o;for(r in e)u=e[r].top,u>s&&(e[r].top=u+o);for(r in f)u=f[r].top,u>s&&(f[r].top=u+o)}},_refreshImpPvts:function(n,t){if(this.model.enablePivotTable&&n)for(var i,r=0,e=this.getObjectLength(n.pivot),u=this.getObjectKeys(n.pivot),f;r<e;)i=n.pivot[u[r]],f={rows:i.rows,columns:i.columns,values:i.values,filters:i.filters},this.getSheet(t)._isUpdated?this.XLPivot._refreshPivotElement(i.dataSheetName+"!"+this._getProperAlphaRange(this._getSheetIndexByName(i.dataSheetName),i.dataRange[0],i.dataRange[1],i.dataRange[2],i.dataRange[3]),this.getSheet(i.sheetIdx).sheetInfo.text+"!"+this._getProperAlphaRange(i.sheetIdx,i.rowIndex,i.colIndex,i.rowIndex,i.colIndex),u[r],f,i):this.XLPivot.createPivotTable(i.dataSheetName+"!"+this._getProperAlphaRange(this._getSheetIndexByName(i.dataSheetName),i.dataRange[0],i.dataRange[1],i.dataRange[2],i.dataRange[3]),this.getSheet(i.sheetIdx).sheetInfo.text+"!"+this._getProperAlphaRange(i.sheetIdx,i.rowIndex,i.colIndex,i.rowIndex,i.colIndex),u[r],f,i),r++;this._isExport||this._getContent(t).find(".e-ss-activepivot").removeClass("e-ss-activepivot");this.hideActivationPanel()},_refreshNameMngr:function(t){t=t||this.model.nameManager;var i=t.length;if(this.model.showRibbon){if(i)while(i--)this.XLRibbon._updateNamedRanges(t[i].name,t[i].refersto,!0);n("#"+this._id+"_nmgrid").ejGrid("option",{dataSource:t});this.XLRibbon._updateUseInFormulaTrgt()}this.XLEdit._refreshAutoComplete()},_getBorderInput:function(n){n=n.split("_");for(var t=4,i={},r=["top","right","bottom","left"];t--;)n[t].length&&(i[r[t]]=n[t]);return i},_refreshHashCode:function(n){n=n||this._dataContainer.hashCode;for(var t,i=n.length;i--;)t=n[i],t.indexOf("e-format")===-1&&t.indexOf("e-border")===-1&&(n[i]="")},clearUndoRedo:function(){this._undoCollection=[];this._redoCollection=[];this._updateUndoRedoIcons()},_initializePicture:function(n){this._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content").append(t.buildTag("div.e-ss-imgvisual"))},_getShapePositionInManager:function(n,t,i,r){for(var o=this.getActiveSheetIndex(),f=this._dataContainer.sheets[o][n][t],u=0,e=f.length;u<e;u++)if(f[r][u].id===i)break;return u},_swapVal:function(n){var t=n.prev;n.prev=n.cur;n.cur=t},_getValue:function(n,t){for(var i,r=n.length;r--;)if(i=n[r],i.value===t)return i.value},_isRowViewable:function(n,t){var i=this.getSheet(n),r=i._isVPRendered;return this.model.scrollSettings.allowVirtualScrolling&&(r=i._virtualRowIdx.indexOf(t)>-1),r},_isColumnViewable:function(){return!0},_undoRedoOperation:function(t){var r,u,i=this.getActiveCell();(t.which===90||t.keyCode===90)&&t.ctrlKey?(t.preventDefault(),t.target.id.indexOf("_Edit")>-1||t.target.id.indexOf("_input")>-1?(r=this.XLEdit.getCurrentEditCellData(),r!==this._cureditedCell&&(u=r,t.target.id.indexOf("_Edit")>-1?t.target.textContent=this._cureditedCell:n("#"+this._id+"_Edit")[0].textContent=this._cureditedCell,this.model.allowFormulaBar&&this._getInputBox().val(this._cureditedCell),this._undoInputobj={value:u,rowIndex:i.rowIndex,colIndex:i.colIndex})):(this._isUndo=!0,this._performUndoRedo())):(t.which===89||t.keyCode===89)&&t.ctrlKey&&(t.preventDefault(),t.target.id.indexOf("_Edit")>-1||t.target.id.indexOf("_input")>-1?i.rowIndex===this._undoInputobj.rowIndex&&i.colIndex===this._undoInputobj.colIndex&&(t.target.id.indexOf("_Edit")>-1?t.target.textContent=this._undoInputobj.value:n("#"+this._id+"_Edit")[0].textContent=this._undoInputobj.value,this.model.allowFormulaBar&&this._getInputBox().val(this._undoInputobj.value)):(this._isUndo=!1,this._performUndoRedo()))},_performUndoRedo:function(){var n=this._isUndo?this._undoCollection.pop():this._redoCollection.pop(),i,r;if(!t.isNullOrUndefined(n)){n.sheetIndex!==this.getActiveSheetIndex()&&this.gotoPage(n.sheetIndex,null);this._isUndoRedo=!0;switch(n.reqType){case"auto-fill":this._undoForAutoFill(n);break;case"auto-sum":this._undoForAutoSum(n);break;case"cell-format":this._undoForFormat(n);break;case"cell-styles":this._undoForStyle(n);break;case"clear-all":this._undoForClAll(n);break;case"clear-comment":this._undoForClComment(n);break;case"clear-content":this._undoForClContent(n);break;case"clear-format":this._undoForClFormat(n);break;case"clear-link":this._undoForCLLink(n);break;case"comment":this._undoForComment(n);break;case"cond-format":this._undoForCondFormat(n);break;case"copy-paste":this._undoForCopyPaste(n);break;case"cut-paste":this._undoForCutPaste(n);break;case"delete":this._undoForDel(n);break;case"edit":this._undoForEdit(n);break;case"filter":this._undoForFilter(n);break;case"filterbycolor":this._undoForFilterByColor(n);break;case"find-replace":this._undoForFind(n);break;case"format-painter":this._undoForFormatPaint(n);break;case"format-table":this._undoForFormatTable(n);break;case"hyperlink":this._undoForHyperlink(n);break;case"insert":this._undoForIns(n);break;case"merge-cells":this._undoForMerge(n);break;case"paging":r=n.nSheetIndex;n.nSheetIndex=n.sheetIndex;n.sheetIndex=r;break;case"pivotgrid":this._undoForPivot(n);break;case"resize-column":this._undoForResizeCol(n);break;case"resize-row":this._undoForResizeRow(n);break;case"resize-fit-height":this._undoForResizeFHeight(n);break;case"resize-fit-width":this._undoForResizeFWidth(n);break;case"reorder-cells":this._undoForReOrder(n);break;case"show-hide":this._undoForShowHide(n);break;case"shape":this._undoForShape(n);break;case"sort":this._undoForSort(n);break;case"sortbycolor":this._undoForSortByColor(n);break;case"textwrap":this._undoForTextWrap(n);break;case"validation":this._undoForValidation(n)}if(this._isUndo?this._redoCollection.push(n):this._undoCollection.push(n),i={sheetIdx:n.sheetIndex,reqType:this._isUndo?"undo":"redo",operation:n},this._undoCollection.length>this.undoRedoStep&&this._undoCollection.splice(0,1),this._redoCollection.length>this.undoRedoStep&&this._redoCollection.splice(0,1),this._updateUndoRedoIcons(),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),this._isUndoRedo=!1,this._isUndo=!1,this.model.allowSelection&&n.reqType!="shape"&&this.XLSelection._refreshBorder(),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this._trigActionComplete(i))return}},_undoForAutoFill:function(t){var i=this.getSheet(t.sheetIndex);this._isUndo?(this.clearRangeData(t.range,this._cellProp),this.model.allowCellFormatting&&(this.XLFormat.removeStyle(t.range),this.XLFormat.updateFormat(t.bFormat,t.range)),this.updateData(n.extend(!0,[],t.bData),t.range),t.actionType=="flash-fill"&&this.updateData(n.extend(!0,[],t.bdData),t.bRange),t.colSel?this.XLSelection.selectColumns(i._startCell.colIndex,i._endCell.colIndex):t.rowSel?this.XLSelection.selectRows(i._startCell.rowIndex,i._endCell.rowIndex):this.performSelection({rowIndex:t.bRange[0],colIndex:t.bRange[1]},{rowIndex:t.bRange[2],colIndex:t.bRange[3]})):(this.model.allowCellFormatting&&this.XLFormat.updateFormat(t.aFormat,t.range),this.updateData(n.extend(!0,[],t.aData),t.range),this.XLCFormat.refreshCFormat(),t.actionType=="flash-fill"&&this.updateData(n.extend(!0,[],t.adData),t.bRange),this.performSelection({rowIndex:t.bRange[0],colIndex:t.bRange[1]},{rowIndex:t.range[2],colIndex:t.range[3]}))},_undoForAutoSum:function(t){var e=this._dataContainer.sheets[t.sheetIndex],r,u,i,f;if(this._isUndo){for(i=0,f=t.updCell.length;i<f;i++)r=this.getCell(t.updCell[i].rowIndex,t.updCell[i].colIndex,t.sheetIndex),this._clearFormula(t.updCell[i].rowIndex,t.updCell[i].colIndex),this.clearRangeData([t.updCell[i].rowIndex,t.updCell[i].colIndex,t.updCell[i].rowIndex,t.updCell[i].colIndex],["value2"],null,!0),u=n.extend(!0,{},t.updCell[i].pObj),e[t.updCell[i].rowIndex][t.updCell[i].colIndex]=u,r.text(t.updCell[i].pValue);this.performSelection(t.range)}else this.XLRibbon.autoSum(t.oprType,t.range)},_undoForClAll:function(t){var u=this.model.sheets[t.sheetIndex],i,r;if(this._isPaste=this._dupDetails=!0,this._isUndo){for(this.updateData(n.extend(!0,[],t.bData),t.range),this.XLFormat.updateFormat(n.extend(!0,[],t.bBorder),t.range),i=0,r=t.wrapColl.length;i<r;i++)this.setWrapText("wrap",[t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx,t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx]);for(i=0,r=t.mergeColl.length;i<r;i++)this.mergeCenter=t.mergeColl[i].mergeObj.isCenterAlign,this.mergeCells(t.mergeColl[i].mergeObj.mRange,!0)}else this.model.showRibbon&&this.XLRibbon._isMergeSelect&&this.XLRibbon._isFilterSelect.status?(this.clearRangeData(t.range,["value","value2","hyperlink","cFormatRule","comment"],"",!1),this.XLFormat.removeStyle(null,{cellStyle:!0,format:!0})):this.clearRangeData(t.range,["value","value2","format","formats","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","comment","cFormatRule"]),this.setWrapText("unwrap",t.range),this.unmergeCells(t.range);this._isPaste=this._dupDetails=!1;t.tblObj&&(this._isUndo?(this.XLClipboard._isCut=!0,this.XLFormat.createTable(t.tblObj,t.tblObj.range),this.XLClipboard._isCut=!1):(this.XLFormat.removeTable(t.tblObj.tblId),this.clearRangeData(t.range,["value","value2","format","formats","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","comment","cFormatRule"]),this.XLRibbon._toggleDesignTab(this.getActiveCell())));this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t.range);this.model.allowDataValidation&&!this._isUndo&&this.XLValidate.clearDV();this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForClComment:function(n){var i,u,f,t,e;if(n.selectedCell.length){if(u={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},f={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},this._isUndo)for(t=0,e=n.selectedCell.length;t<e;t++)i={rowIndex:n.selectedCell[t].rowIndex,colIndex:n.selectedCell[t].colIndex},this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[t].rowIndex,colIndex:n.selectedCell[t].colIndex},{dataObj:{comment:n.selectedCell[t].prevComment}}),this.XLSelection.selectRange(i,i),this.XLComment.setComment(),this.XLComment._updateCurCmntVal();else this.XLSelection.selectRange(u,f),this.XLComment.deleteComment(r,null,!1,"clear");this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()}},_undoForClContent:function(t){this._isUndo?this.updateData(n.extend(!0,[],t.bData),t.range):this.clearRangeData(t.range,["value","value2","type","hyperlink"],t.reqType);this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t.range);this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForClFormat:function(t){var u=this._dataContainer.sheets[t.sheetIndex],i,r;if(this._isUndo){for(i=0,r=t.wrapColl.length;i<r;i++)this.setWrapText("wrap",[t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx,t.wrapColl[i].rowIdx,t.wrapColl[i].colIdx]);for(i=0,r=t.mergeColl.length;i<r;i++)this.mergeCenter=t.mergeColl[i].mergeObj.isCenterAlign,this.mergeCells(t.mergeColl[i].mergeObj.mRange,!0);this.updateData(n.extend(!0,[],t.bData),t.range,t.reqType)}else this.XLRibbon._isMergeSelect&&this.XLRibbon._isFilterSelect.status?(this.clearRangeData(t.range,["decimalPlaces","thousandSeparator","hyperlink","cFormatRule"],"",!1,details.reqType),this.XLFormat.removeStyle(null,{cellStyle:!0,format:!0})):this.clearRangeData(t.range,["format","formats","border","type","formatstr","decimalPlaces","thousandSeparator","hyperlink","cFormatRule"],"",!1,t.reqType),this.setWrapText("unwrap",t.range),this.unmergeCells(t.range);this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t.range)},_undoForCLLink:function(n){var f={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},e,u,o={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},i,r;if(this.setActiveCell(n.selectedCell[0].rowIndex,n.selectedCell[0].colIndex),this.XLSelection.selectRange(f,o),this._isUndo)for(i=0,r=n.selectedCell.length;i<r;i++)n.selectedCell[i].prevLink&&(u=this.getCell(n.selectedCell[i].rowIndex,n.selectedCell[i].colIndex),n.selectedCell[i].prevLink.webAddr?u.html(t.buildTag("a.e-hyperlinks",n.selectedCell[i].prevText,"",{href:n.selectedCell[i].prevLink.webAddr,target:"_blank"})):u.html(t.buildTag("a.e-hyperlinks",n.selectedCell[i].prevText,"")),this.isUndefined(n.selectedCell[i].prevLink.cellAddr)?this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},{dataObj:{hyperlink:{webAddr:n.selectedCell[i].prevLink.webAddr}}}):this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},{dataObj:{hyperlink:{cellAddr:n.selectedCell[i].prevLink.cellAddr}}}));else this._removeHyperlink("clear",n.selectedCell);for(this.XLSelection.selectRange(f,o),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),i=0,r=n.selectedCell.length;i<r;i++)e=n.selectedCell[i].prevLink,n.selectedCell[i].prevLink=n.selectedCell[i].curLink,n.selectedCell[i].curLink=e},_undoForComment:function(n){var t,u,f,r,i,e;for(u={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},f={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},i=0,e=n.selectedCell.length;i<e;i++)t={rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},this.XLSelection.selectRange(t,t),this.getSheet(n.sheetIndex)._startCell=t,n.action==="add"?(n.selectedCell[i].prevComment=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"comment"),this.XLComment&&this.XLComment.deleteComment()):n.action==="edit"?(this._isRowViewable(n.sheetIndex,t.rowIndex)&&this.getCell(t.rowIndex,t.colIndex).find(".e-comment-txtarea").val(n.selectedCell[i].prevComment.value),this.XLComment._updateCurCmntVal(),r=n.selectedCell[i].prevComment,n.selectedCell[i].prevComment=n.selectedCell[i].curComment,n.selectedCell[i].curComment=r):(this.XLEdit._updateDataContainer(t,{dataObj:{comment:n.selectedCell[i].prevComment}}),this.XLComment.setComment([t.rowIndex,t.colIndex,t.rowIndex,t.colIndex],null,!1),this.XLSelection.selectRange(t,t),this.XLComment._updateCurCmntVal(),r=n.selectedCell[i].prevComment,n.selectedCell[i].prevComment=n.selectedCell[i].curComment,n.selectedCell[i].curComment=r);n.action==="add"?n.action="delete":n.action==="delete"&&(n.action="add");this.XLSelection.selectRange(u,f);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForCondFormat:function(n){var i,e,l,s,c,r,o=[],h,a,u,f,v;if(n.range=n.data,this._isUndo){if(n.action==="add"){for(u=this._getSelectedRange({rowIndex:n.range[0],colIndex:n.range[1]},{rowIndex:n.range[2],colIndex:n.range[3]}),c=this.XLEdit.getPropertyValue(u[0].rowIndex,u[0].colIndex,"cFormatRule"),n.poppedRule=c[c.length-1],i=0,e=u.length;i<e;i++){if(h=this.XLEdit.getPropertyValue(u[i].rowIndex,u[i].colIndex,"cFormatRule"),!this.isUndefined(h))for(h.pop(),f=0,l=h.length;f<l;f++)s=h[f],o.length===0?(r=s.indexOf("true")>-1?s.replace("_true",""):s.replace("_false",""),o.push(r)):o=this._addCondFormatRule(o,s);this._isRowViewable(n.sheetIndex,u[i].rowIndex)&&(a=this.getCell(u[i].rowIndex,u[i].colIndex,n.sheetIndex),a.removeClass("e-redft e-yellowft e-greenft e-redf e-redt"))}for(this.clearRangeData(n.range,["cFormatRule"],u),i=0,e=o.length;i<e;i++)r=o[i].split("_"),this.XLCFormat._cFormat(r[0],r[2],r[3],r[4],r[5],n.sheetIndex,n.range)}else if(n.action==="clear")for(i=0,e=n.rule.length;i<e;i++)for(f=0,v=n.rule[i].length;f<v;f++)this.XLCFormat.setCFRule(n.rule[i][f])}else n.action==="add"?t.isNullOrUndefined(n.poppedRule)||(r=n.poppedRule.split("_"),this.XLCFormat._cFormat(r[0],r[2],r[3],r[4],r[5],n.sheetIndex,n.range)):n.action==="clear"&&(n.selection?this.XLCFormat.clearCF(n.range):this.XLCFormat.clearCF())},_getCopyText:function(n){for(var i,u,e=[],r,t=0,f=n.length;t<f;t++)for(r=n[t].split("\t"),i=0,u=r.length;i<u;i++)e.push(r[i]);return e},_cutShape:function(t,i,r,u){for(var o,h,e=["picture","chart"],s,f=0,c=e.length;f<c;f++)if(e[f]in t)for(this.XLShape._picCellIdx={rowIndex:i.rowIndex,colIndex:i.colIndex},o=0,h=t[e[f]].length;o<h;o++)s=n.extend(!0,{},r[e[f]][t[e[f]][o]]),this.XLShape._deleteShape(u,this.element.find("#"+s.id))},_pasteShape:function(t,i,r,u){for(var h,l,s=["picture","chart"],f,e,c,o=0,a=s.length;o<a;o++)if(s[o]in t){for(h=0,l=t.picture.length;h<l;h++)f=n.extend(!0,{},r[s[o]][t[s[o]][h]]),this.XLChart._shapeCnt===1||this.XLChart._shapeCnt--,s[o]==="picture"?(c=this._id+"_picture",this.XLShape._createPicture(u,{rowIndex:i.rowIndex,colIndex:i.colIndex},r.sharedPics[f.data],f.top,f.left,f.width,f.height,parseInt(f.id.replace(c,"")))):(e=f.range,this.XLChart.createChart(this._getAlphaRange(u,e[0],e[1],e[2],e[3]),f));s[o]==="chart"&&this.XLSelection.selectRange({rowIndex:e[0],colIndex:e[1]},{rowIndex:e[2],colIndex:e[3]},pSheetIndex)}},_undoForCopyPaste:function(i){var f={},e=this._dataContainer,k,l=this.getSheet(i.pSheetIndex).shapeMngr,u,tt,h,s,d;if(i.operation==="shape")k=i.pShapeId.indexOf("picture")>-1?"picture":"chart",u=n.extend(!0,{},i.pasteCell.obj),t.isNullOrUndefined(u)||(this.XLShape._picCellIdx={rowIndex:i.pasteCell.rowIndex,colIndex:i.pasteCell.colIndex},k==="chart"?"chart"in u&&(this._isUndo?(f=n.extend(!0,{},l.chart[i.pShapeId]),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex]={}),e.sheets[i.pSheetIndex][i.pasteCell.rowIndex][i.pasteCell.colIndex]=u,this.XLShape._deleteShape(i.pSheetIndex,this.element.find("#"+f.id))):(this.setActiveCell(i.pasteCell.rowIndex,i.pasteCell.colIndex,i.pSheetIndex),f=n.extend(!0,{},i.pasteCell.shapeObj),o=f.range,this.XLChart.createChart(this._getAlphaRange(i.sheetIndex,o[0],o[1],o[2],o[3]),f),this.XLSelection.selectRange({rowIndex:o[0],colIndex:o[1]},{rowIndex:o[2],colIndex:o[3]},i.cSheetIndex))):"picture"in u&&(this._isUndo?(f=n.extend(!0,{},l.picture[i.pShapeId]),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex]={}),e.sheets[i.pSheetIndex][i.pasteCell.rowIndex][i.pasteCell.colIndex]=u,this.XLShape._deleteShape(i.pSheetIndex,this.element.find("#"+f.id))):(f=n.extend(!0,{},i.pasteCell.shapeObj),it=this._id+"_picture",this.XLShape._createPicture(i.pSheetIndex,{rowIndex:i.pasteCell.rowIndex,colIndex:i.pasteCell.colIndex},l.sharedPics[f.data],f.top,f.left,f.width,f.height,parseInt(f.id.replace(it,"")),f.bcolor,f.bstyle,f.bwidth)))),this.XLScroll._getRowHeights(i.pSheetIndex,i.pasteCell.rowIndex);else{var a,s,g,d,v,c,nt,tt,o,y,p,it,w,b,r,rt=!1,ut=[],e=this._dataContainer;for(this._getCopyText(i.text),this._dupDetails=!0,this.element.find(".e-cdata").length&&n("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),this.setActiveSheetIndex(i.pSheetIndex),a=0,g=i.pasteCells.length;a<g;a++)r=i.pasteCells[a],u=t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex])?{}:e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex],this._isUndo||"merge"in r.prevObj&&(this.mergeCenter=r.prevObj.merge.isCenterAlign,this.mergeCells(r.prevObj.merge.mRange,!0)),this._isRowViewable(i.pSheetIndex,r.rowIndex)&&(v=this.getCell(r.rowIndex,r.colIndex,i.pSheetIndex)[0],this._isUndo||(v.textContent=ut[a]),rt=!0),t.isNullOrUndefined(u)||(this._cutShape(u,r,l,i.pSheetIndex),c=this._generateHeaderText(r.colIndex+1)+(r.rowIndex+1),"wrap"in u&&this.setWrapText("unwrap",c+":"+c),"merge"in u&&this._isUndo&&(r.newObj=n.extend(!0,{},e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex]),this.unmergeCells(this._getAlphaRange(i.pSheetIndex,r.rowIndex,r.colIndex,r.rowIndex,r.colIndex)),this.getCell(r.rowIndex,r.colIndex,i.pSheetIndex).prop("rowspan",!1).prop("colspan",!1),"merge"in r.prevObj&&(this.mergeCenter=r.prevObj.merge.isCenterAlign,this.mergeCells(r.prevObj.merge.mRange,!0),this.mergeCenter=!1))),rt&&this._isUndo&&(v.textContent="",this._removeClass(v,"e-commentcell")),t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex])&&(e.sheets[i.pSheetIndex][r.rowIndex]={}),t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex])||(w=e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex].overflow),this.model.allowCellFormatting&&this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0,border:!0}),e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex]=n.extend(!0,{},r.prevObj),w&&(e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex].overflow=w),this._textClip(r.rowIndex,r.colIndex,"delete"),this._setRowHdrHeight(i.pSheetIndex,r.rowIndex),u=t.isNullOrUndefined(e.sheets[i.pSheetIndex][r.rowIndex])?{}:e.sheets[i.pSheetIndex][r.rowIndex][r.colIndex],y=r.rowIndex,p=r.colIndex,this._applyCommentLink(u,{rowIndex:r.rowIndex,colIndex:r.colIndex},y,p),this._isPaste=!0,t.isNullOrUndefined(u)||(this._pasteShape(u,{rowIndex:y,colIndex:p},l,i.pSheetIndex),"cellType"in u&&(this._isUndo?this._removeClass(v,"e-cellreadonly"):(b=this._dataContainer.sheetCellType[u.cellType],b.text="",this.model.allowCellType&&this.XLCellType._renderControls(r.rowIndex,r.colIndex,i.pSheetIndex,b,!0))),c=this._generateHeaderText(r.colIndex+1)+(r.rowIndex+1),"wrap"in u&&(this.XLEdit._clearDataContainer({cellIdx:r,property:["wrap"]}),this.setWrapText("wrap",c+":"+c)),this._isPaste=!1),nt=r.prevObj,r.prevObj=r.newObj,r.newObj=nt;if(i.isSpecial&&(this.model.allowCellFormatting&&(this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0}),this.isUndefined(i.pasteBorder.prevBorder)||this.XLFormat.updateFormat(i.pasteBorder.prevBorder,i.pasteBorder.range,"format")),tt=i.pasteBorder.prevBorder,i.pasteBorder.prevBorder=i.pasteBorder.newBorder,i.pasteBorder.newBorder=tt),!t.isNullOrUndefined(i.pfat))for(h=i.pfat.ptable,s=0,d=h.length;s<d;s++)t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),this._isUndo?(this.XLFormat.removeTable(h[s].id),this.XLFormat.removeStyle(h[s].range)):(h[s].header=!0,this.XLFormat.createTable(h[s],h[s].range)));t.isNullOrUndefined(i.filter)||(this.XLFilter.clearFilter(),this.XLFilter.filter(details.filter));this._dupDetails=!1}i.operation!=="shape"&&(this._isUndo?(t.isNullOrUndefined(i.cSheetIndex)||this.setActiveSheetIndex(i.cSheetIndex),i.cutCells.length>0&&this.XLSelection._focusBorder(i.cutCells[0],i.cutCells[i.cutCells.length-1],this._cutFocus),this.setActiveSheetIndex(i.pSheetIndex),this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1])):(t.isNullOrUndefined(i.cSheetIndex)||this.setActiveSheetIndex(i.cSheetIndex),i.cutCells.length>0&&this.XLSelection._focusBorder(i.cutCells[0],i.cutCells[i.cutCells.length-1],this._cutFocus),this.setActiveSheetIndex(i.pSheetIndex),i.pasteCells.length>0&&this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1])),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this.XLScroll._getRowHeights(i.pSheetIndex,i.pasteCells[0].rowIndex))},_undoForCutPaste:function(i){var u,y,o={},e=this._dataContainer,p=this.getSheet(i.pSheetIndex).shapeMngr,ft,it,wt,d,et,ot,st,g,v,h,k,f,c,a,ht,ct,rt,r,s,ut,vt,yt,pt;if(i.operation==="shape")d=i.pShapeId.indexOf("picture")>-1?"picture":"chart",u=n.extend(!0,{},i.pasteCell.obj),t.isNullOrUndefined(u)||(this.XLShape._picCellIdx={rowIndex:i.pasteCell.rowIndex,colIndex:i.pasteCell.colIndex},o=n.extend(!0,{},p[d][i.pShapeId]),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCell.rowIndex]={}),e.sheets[i.pSheetIndex][i.pasteCell.rowIndex][i.pasteCell.colIndex]=u,this.XLShape._deleteShape(i.pSheetIndex,this.element.find("#"+o.id))),u=n.extend(!0,{},i.cutCell.obj),d=i.cShapeId.indexOf("picture")>-1?"picture":"chart",t.isNullOrUndefined(u)||(this.setActiveCell(i.cutCell.rowIndex,i.cutCell.colIndex,i.cSheetIndex),d==="chart"?"chart"in u&&(o=n.extend(!0,{},i.cutCell.shapeObj),h=o.range,this.setActiveSheetIndex(i.cSheetIndex),this.XLChart.createChart(this._getAlphaRange(i.sheetIndex,h[0],h[1],h[2],h[3]),o),this.setActiveSheetIndex(i.sheetIndex),this.XLSelection.selectRange({rowIndex:h[0],colIndex:h[1]},{rowIndex:h[2],colIndex:h[3]},i.cSheetIndex)):"picture"in u&&(o=n.extend(!0,{},i.cutCell.shapeObj),ft=this._id+"_picture",this.XLShape._createPicture(i.cSheetIndex,{rowIndex:i.cutCell.rowIndex,colIndex:i.cutCell.colIndex},p.sharedPics[o.data],o.top,o.left,o.width,o.height,parseInt(o.id.replace(ft,"")),o.bcolor,o.bstyle,o.bwidth))),this.XLShape._picCellIdx={rowIndex:i.cutCell.rowIndex,colIndex:i.cutCell.colIndex},et=i.pasteCell,i.pasteCell=i.cutCell,i.cutCell=et,ot=i.pShapeId,i.pShapeId=i.cShapeId,i.cShapeId=ot;else{for(ct=[],e=this._dataContainer,this.element.find(".e-cdata").length&&n("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),this._getCopyText(i.text),r=0,st=i.pasteCells.length;r<st;r++)t.isNullOrUndefined(i.pSheetIndex)||(this.isUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex])||(u=e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex]),v=this._generateHeaderText(i.pasteCells[r].colIndex+1)+(i.pasteCells[r].rowIndex+1),"wrap"in u&&this.setWrapText("unwrap",v+":"+v),this._isRowViewable(i.pSheetIndex,i.pasteCells[r].rowIndex)&&(k=this.getCell(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,i.pSheetIndex)[0],k.textContent="",this._removeClass(k,"e-commentcell")),this.isUndefined(u)||(this._cutShape(u,i.pasteCells[r],p,i.pSheetIndex),"merge"in u&&(this._isUndo?(n.extend(!0,i.pasteCells[r].newObj,e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex]),this.setActiveSheetIndex(i.pSheetIndex),this.unmergeCells(u.merge.mRange),this.getCell(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,i.pSheetIndex).prop("rowspan",!1).prop("colspan",!1),"merge"in i.pasteCells[r].prevObj&&(this.mergeCenter=i.pasteCells[r].prevObj.merge.isCenterAlign,this.mergeCells(i.pasteCells[r].prevObj.merge.mRange,!0),this.mergeCenter=!1)):(this.setActiveSheetIndex(i.pSheetIndex),this.unmergeCells(u.merge.mRange,!0),"merge"in i.pasteCells[r].prevObj&&(this.mergeCenter=i.pasteCells[r].prevObj.merge.isCenterAlign,this.mergeCells(i.pasteCells[r].prevObj.merge.mRange,!0),this.mergeCenter=!1),this.setActiveSheetIndex(i.cSheetIndex),this.unmergeCells(this._getAlphaRange(i.pSheetIndex,i.cutCells[r].rowIndex,i.cutCells[r].colIndex,i.cutCells[r].rowIndex,i.cutCells[r].colIndex)),h=this.getRangeIndices(i.cutCells[r].prevObj.merge.mRange),this.XLSelection.selectRange({rowIndex:h[0],colIndex:h[1]},{rowIndex:h[2],colIndex:h[3]},i.sheetIndex))),"cellType"in u&&this._removeClass(k,"e-cellreadonly")),this.isUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex])&&(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex]={}),t.isNullOrUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex])||(y=e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex].overflow),this.model.allowCellFormatting&&this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0,border:!0}),e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex].wrap&&(it=!0),wt=this.XLEdit.getPropertyValue(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,"tableName")||"",e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex]=n.extend(!0,{},i.pasteCells[r].prevObj),this._textClip(i.pasteCells[r].rowIndex,i.pasteCells[r].colIndex,"delete"),this.isUndefined(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex])||(y&&(e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex].overflow=y),this._setRowHdrHeight(i.pSheetIndex,i.pasteCells[r].rowIndex),u=e.sheets[i.pSheetIndex][i.pasteCells[r].rowIndex][i.pasteCells[r].colIndex],c=i.pasteCells[r].rowIndex,a=i.pasteCells[r].colIndex,this._applyCommentLink(u,{rowIndex:c,colIndex:a},c,a),it&&(u.wrap=it),this._isPaste=!0,t.isNullOrUndefined(u)||(this._pasteShape(u,{rowIndex:c,colIndex:a},p,i.pSheetIndex,i.sheetIndex),v=this._generateHeaderText(a+1)+(c+1),"wrap"in u&&(this.XLEdit._clearDataContainer({cellIdx:i.pasteCells[r],property:["wrap"]}),this.setWrapText("wrap",v+":"+v)))),g=i.pasteCells[r].prevObj,i.pasteCells[r].prevObj=i.pasteCells[r].newObj,i.pasteCells[r].newObj=g,this._isPaste=!1);for(r=0;r<i.cutCells.length;r++)t.isNullOrUndefined(i.cSheetIndex)||(f=i.cutCells[r],this._isRowViewable(i.cSheetIndex,f.rowIndex)&&(ht=this.getCell(f.rowIndex,f.colIndex,i.cSheetIndex)[0],ht.textContent=ct[r]),this.setActiveSheetIndex(i.cSheetIndex),u=t.isNullOrUndefined(e.sheets[i.cSheetIndex][f.rowIndex])?{}:e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex],t.isNullOrUndefined(u)||this._cutShape(u,f,p,i.cSheetIndex),t.isNullOrUndefined(e.sheets[i.cSheetIndex][f.rowIndex])&&(e.sheets[i.cSheetIndex][f.rowIndex]={}),t.isNullOrUndefined(e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex])||(y=e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex].overflow),f.prevObj.tableName&&delete f.prevObj.tableName,e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex]=n.extend(!0,{},f.prevObj),this.getObjectLength(y)>0&&(e.sheets[i.cSheetIndex][f.rowIndex][f.colIndex].overflow=y)&&(y={}),g=f.prevObj,f.prevObj=f.newObj,f.newObj=g,c=f.rowIndex,a=f.colIndex,this._setRowHdrHeight(i.cSheetIndex,c),this.XLScroll._getRowHeights(i.cSheetIndex,c),u=t.isNullOrUndefined(e.sheets[i.cSheetIndex][c])?{}:e.sheets[i.cSheetIndex][c][a],this._applyCommentLink(u,{rowIndex:c,colIndex:a},c,a),this._isPaste=!0,t.isNullOrUndefined(u)||(this._pasteShape(u,{rowIndex:c,colIndex:a},p,i.cSheetIndex),"merge"in u&&(this.mergeCenter=u.merge.isCenterAlign,this.mergeCells(u.merge.mRange,!0),this.mergeCenter=!1),"cellType"in u&&(rt=this._dataContainer.sheetCellType[u.cellType],rt.text="",this.model.allowCellType&&this.XLCellType._renderControls(f.rowIndex,f.colIndex,i.pSheetIndex,rt,!0)),this._dupDetails=!0,v=this._generateHeaderText(f.colIndex+1)+(f.rowIndex+1),"wrap"in u&&(this.XLEdit._clearDataContainer({cellIdx:f,property:["wrap"]}),this.setWrapText("wrap",v+":"+v)),this._dupDetails=!1),this._isPaste=!1);if(this.XLScroll._getRowHeights(i.pSheetIndex,i.pasteCells[0].rowIndex<i.cutCells[0].rowIndex?i.pasteCells[0].rowIndex:i.cutCells[0].rowIndex),this.model.allowCellFormatting&&!t.isNullOrUndefined(i.pSheetIndex)&&(this.setActiveSheetIndex(i.pSheetIndex),this.XLFormat.removeStyle(i.pasteBorder.range,{cellStyle:!0,tableStyle:!0,format:!0}),this.isUndefined(i.pasteBorder.prevBorder)||this.XLFormat.updateFormat(i.pasteBorder.prevBorder,i.pasteBorder.range,"format")),nBrdr=i.pasteBorder.prevBorder,i.pasteBorder.prevBorder=i.pasteBorder.newBorder,i.pasteBorder.newBorder=nBrdr,this.model.allowCellFormatting&&!t.isNullOrUndefined(i.cSheetIndex)&&(this.setActiveSheetIndex(i.cSheetIndex),i.isSpecial&&this.XLFormat.removeStyle(i.cutBorder.range,{cellStyle:!0,tableStyle:!0,format:!0}),i.cutBorder.prevBorder&&this.XLFormat.updateFormat(i.cutBorder.prevBorder,i.cutBorder.range,"format")),nBrdr=i.cutBorder.prevBorder,i.cutBorder.prevBorder=i.cutBorder.newBorder,i.cutBorder.newBorder=nBrdr,!t.isNullOrUndefined(i.pfat)){var w,l=i.pfat.table,b,lt=i.pfat.minRowIdx,at=i.pfat.minColIdx,nt,tt=i.pfat.range;for(s=0,ut=l.length;s<ut;s++)b=l[s].range,t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),nt=l[s].tblObj.tblId,w=i.pfat.ptable[s].range,this.XLFormat.removeTable(nt),this.XLFormat.removeStyle(w)),t.isNullOrUndefined(i.cSheetIndex)||(this.setActiveSheetIndex(i.cSheetIndex),this.XLClipboard._isCut=!0,this._isUndo?(this.XLFormat.createTable(l[s].tblObj,l[s].range),l[s].tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,nt,l[s].tblObj.fnNumber,l[s].range,!0)):(w=this.getRangeIndices(this._getAlphaRange(i.cSheetIndex,b[0]+lt-tt[0],b[1]+at-tt[1],lt-tt[0]+b[2],at-tt[1]+b[3])),this.XLFormat.createTable(l[s].tblObj,w),l[s].tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,nt,l[s].tblObj.fnNumber,w,!0)),this.XLClipboard._isCut=!1)}t.isNullOrUndefined(i.filter)||(this.XLFilter.clearFilter(),this.XLFilter.filter(details.filter))}i.operation!=="shape"&&(this._isUndo?(t.isNullOrUndefined(i.cSheetIndex)||(this.setActiveSheetIndex(i.cSheetIndex),this.XLSelection.selectRange(i.cutCells[0],i.cutCells[i.cutCells.length-1])),t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1]))):(t.isNullOrUndefined(i.pSheetIndex)||(this.setActiveSheetIndex(i.pSheetIndex),this.XLSelection._focusBorder(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1],this._cutFocus),this.XLSelection.selectRange(i.pasteCells[0],i.pasteCells[i.pasteCells.length-1])),t.isNullOrUndefined(i.cSheetIndex)||(this.setActiveSheetIndex(i.cSheetIndex),this.XLSelection.selectRange(i.cutCells[0],i.cutCells[i.cutCells.length-1]))));this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();vt=i.pasteCells;i.pasteCells=i.cutCells;i.cutCells=vt;yt=i.pasteBorder;i.pasteBorder=i.cutBorder;i.cutBorder=yt;pt=i.cSheetIndex;i.cSheetIndex=i.pSheetIndex;i.pSheetIndex=pt},_undoForDel:function(t){this._delCells=n.extend(!0,[],t.delCells);this._deletedText=n.extend(!0,[],t.text);this._removeMergeColl=n.extend(!0,[],t.removeMerge);this._deletedDimension=n.extend(!0,[],t.deletedDimension);this._isUndo&&(this._fRow.fRowCnt=t.fRow.fRowCnt,this._fCol.fColCnt=t.fCol.fColCnt,this._fRow.rowAdj=t.fRow.rowAdj,this._fCol.colAdj=t.fCol.colAdj);switch(t.action){case"deleteShiftUp":this.deleteShiftUp(t.startCell,t.endCell);break;case"deleteShiftLeft":this.deleteShiftLeft(t.startCell,t.endCell);break;case"deleteRow":this.deleteEntireRow(t.startCell.rowIndex,t.endCell.rowIndex);break;case"deleteColumn":this.deleteEntireColumn(t.startCell.colIndex,t.endCell.colIndex)}},_undoForEdit:function(n){var f,h,l,e,o,s=n.cFormatRule,u={rowIndex:n.rowIndex,colIndex:n.colIndex},c,r,a,v=this.getRows(n.sheetIndex);if(this.setActiveCell(n.rowIndex,n.colIndex,n.sheetIndex),this.XLSelection.selectRange(n.startCell,n.endCell),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this._isRowViewable(n.sheetIndex,n.rowIndex)&&(r=this.getCell(n.rowIndex,n.colIndex),a=r.find("a").css("text-decoration"),n.altwrap&&(this._isUndo?this.XLEdit._clearDataContainer({cellIdx:u,property:["altTxt"]}):this.XLEdit._updateDataContainer(u,{dataObj:{altTxt:!0}}))),f=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"hyperlink",n.sheetIndex),t.isNullOrUndefined(f)||(h=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value2"),n.action=h.length<1?"add":"delete",n.reqType="edit",u.prevLink=f,u.prevText=h,n.selectedCell=[]),c=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"comment"),this.XLEdit._updateCellValue({rowIndex:n.rowIndex,colIndex:n.colIndex},n.pValue),this._dupDetails=!0,s&&s.length){for(i=0,len=s.length;i<len;i++)o=s[i].split("_"),this.XLCFormat._cFormat(o[0],o[2],o[3],o[4],o[5]);this.XLCFormat.refreshCFormat(this._getAlphaRange(n.sheetIndex,n.rowIndex,n.colIndex,n.rowIndex,n.colIndex))}n.prevFrmtObj&&n.curFrmtObj&&(l=this._isUndo?n.prevFrmtObj:n.curFrmtObj,this.XLFormat.format(l,this._getAlphaRange(n.sheetIndex,n.rowIndex,n.colIndex,n.rowIndex,n.colIndex)));this._dupDetails=!1;this._textClip(n.rowIndex,n.colIndex,n.pValue.length>0?"add":"delete");t.isNullOrUndefined(c)||(this.XLEdit._updateDataContainer({rowIndex:n.rowIndex,colIndex:n.colIndex},{dataObj:{comment:c}}),this.XLComment.setComment(),this.XLComment._updateCurCmntVal());this._isRowViewable(n.sheetIndex,n.rowIndex)&&(f&&(f.webAdr?r.html(t.buildTag("a",r.text(),"",{href:hldata.webAdr,target:"_blank","class":"e-hyperlinks"})):r.html(t.buildTag("a",r.text(),"",{"class":"e-hyperlinks"}))),r.find("a").css("text-decoration",a),r.removeClass("e-commentcell"));t.isNullOrUndefined(f)||(u.curLink=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"hyperlink"),u.curText=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value2"),n.selectedCell.push(u));n.prevHeight!=n.newHeight&&(this.getSheet(n.sheetIndex).rowsHeightCollection[n.rowIndex]=n.prevHeight,this._isRowViewable(n.sheetIndex,n.rowIndex)&&(v[0][n.rowIndex].style.height=n.prevHeight+"px",v[1][n.rowIndex].style.height=n.prevHeight+"px"),this._setRowHdrHeight(n.sheetIndex,n.rowIndex),this.XLScroll._getRowHeights(n.sheetIndex,n.rowIndex),e=n.newHeight,n.newHeight=n.prevHeight,n.prevHeight=e);e=n.cValue;n.cValue=n.pValue;n.pValue=e;this.XLEdit._isEdit=!1;e=n.previousValue;n.previousValue=n.value;n.value=e;this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForFilter:function(i){var y=!1,v=[],u,d,c=[],b,o,s,f,g=i.sheetIndex||this.getActiveSheetIndex(),k=this._dataContainer.sheets[g],p,nt,r,e,l,a,tt,w,h;if(i.operation==="filter"&&i.requestType!=="filterbycell")if(this._isUndo){for(r=this._undoCollection.length-1;r>=0;r--){if(this._undoCollection[r].reqType==="filter"&&this._undoCollection[r].tableID===i.tableID&&this._undoCollection[r].action==="filtering"&&this._undoCollection[r].status!=="apply-filterIcon"&&this._undoCollection[r].rowIndex===i.rowIndex&&this._undoCollection[r].colIndex===i.colIndex){for(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],u=this._undoCollection[r],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,u.tableID),r=0,e=u.filterCollection.length;r<e;r++)v.push(u.filterCollection[r]);this.model.sheets[u.sheetIndex].filterSettings.filteredColumns=v;t.isNullOrUndefined(this._excelFilter._predicates[u.sheetIndex][u.fieldName])&&(this._excelFilter._predicates[u.sheetIndex][u.fieldName]={});this._excelFilter._predicates[u.sheetIndex][u.fieldName]=u.ejpredicate;this.model.sheets[u.sheetIndex]._selectedRange=u.range;this.XLFilter._filterHandler(u);b="undo";y=!0;break}if(this._undoCollection[r].reqType==="filter"&&this._undoCollection[r].tableID===i.tableID&&this._undoCollection[r].action==="clearfiltering"){delete this._excelFilter._predicates[i.sheetIndex][i.fieldName];u=this._undoCollection[r];this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,u.tableID);y=!0;break}if(this._undoCollection[r].requestType==="filterbycell"&&this._undoCollection[r].rowIndex===i.rowIndex&&this._undoCollection[r].colIndex===i.colIndex){u=this._undoCollection[r];delete this._excelFilter._predicates[u.sheetIndex][u.fieldName];this.XLFilter._clearFilterColumn(u.fieldName,"","","Or",null,null,u.tableID);n.extend(!0,c,u.selCells);this.XLFilter._filterActiveCell(u.sheetIndex,u.activeCell,c,u.filteredValue,u.selRange);b="undo";y=!0;break}}y||(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID))}else{for(v=[],delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),r=0,e=i.filterCollection.length;r<e;r++)v.push(i.filterCollection[r]);this.model.sheets[i.sheetIndex].filterSettings.filteredColumns=v;t.isNullOrUndefined(this._excelFilter._predicates[i.sheetIndex][i.fieldName])&&(this._excelFilter._predicates[i.sheetIndex][i.fieldName]={});this._excelFilter._predicates[i.sheetIndex][i.fieldName]=i.ejpredicate;i.filterCollection.length&&this.XLFilter._filterHandler(i);b="redo"}else if(this._isUndo){if(i.operation==="apply-filter"&&i.requestType!=="filterbycell")for(r=0,e=i.filteredCells.length;r<e;r++)o=i.filteredCells[r].rowIndex,s=i.filteredCells[r].colIndex,f=this.getCell(o,s,i.sheetIndex),f.find(".e-ssfilter").remove(),this._removeClass(f[0],"e-filterhdr"),this.addClass(f[0],"e-wrapword"),(this.isNumber(f.text())||this.XLEdit._parseValue(f.text(),{rowIndex:o,colIndex:s}).type==="datetime"||this.XLEdit._parseValue(f.text(),{rowIndex:o,colIndex:s}).type==="currency"||this.XLEdit._parseValue(f.text()).type==="percentage",{rowIndex:o,colIndex:s})&&f.addClass(this._rAlign),delete k[o][s].isFilterHeader,delete k[o][s].filterState,delete k[o][s].isFilterVisible,this.XLEdit.getPropertyValue(o,s,"isFilterWrap")&&this.setWrapText("wrap",this._getAlphaRange(g,o,s,o,s));if(i.requestType==="filterbycell"&&(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),!this.isUndefined(i.filteredCells)))for(r=0,e=i.filteredCells.length;r<e;r++)f=this.getCell(i.filteredCells[r].rowIndex,i.filteredCells[r].colIndex,i.sheetIndex),f.find(".e-ssfiltered, .e-ssfilter").remove(),this._removeClass(f[0],"e-filterhdr"),this.addClass(f[0],"e-wrapword"),(this.isNumber(f.text())||this.XLEdit._parseValue(f.text(),{rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex}).type==="datetime"||this.XLEdit._parseValue(f.text(),{rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex}).type==="currency"||this.XLEdit._parseValue(f.text(),{rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex}).type==="percentage")&&f.addClass(this._rAlign);if(this.model.sheets[i.sheetIndex].filterSettings.range="",i.operation==="apply-filter"&&i.requestType!="filterbycell"||i.requestType==="filterbycell"&&!this.isUndefined(i.filteredCells)){for(p=this.model.sheets[i.sheetIndex].filterSettings.tableRange,r=0,e=p.length;r<e;r++)if(p[r].tableID===i.tableID){nt=r;break}i.filterRange=p.splice(nt,1)[0]}if(i.operation==="remove-filter"){if(l=this._undoCollection[this._undoCollection.length-1],h=this.getSheet(i.sheetIndex),l.requestType==="filterbycell")n.extend(!0,c,l.selCells),this.XLFilter._filterActiveCell(l.sheetIndex,l.activeCell,c,l.filteredValue,l.selRange);else for(r=0,e=i.filteredCells.length;r<e;r++)w=this.XLFilter._getFilterIcon(),this.XLFilter._applyFilterIcon(i.filteredCells[r],w);for(h._selectedRange=i.selRange,h.filterSettings.filteredRange=i.fltrdRange,h.filterSettings.filteredColumns=i.filteredCols,h.filterSettings.range=i.fRange,h.filterSettings.tableRange.push(i.filterRange),a=0,tt=i.filterCollection.length;a<tt;a++)this._excelFilter._predicates[i.sheetIndex][i.filterCollection[a].fieldName]=i.filterCollection[a].predicate,this.XLFilter._filterHandler(i.filterCollection[a])}}else if(i.operation==="remove-filter"&&(i.requestType==="filterbycell"?(this._isRowViewable(i.sheetIndex,i.activeCell.rowIndex)&&(d=this.getCell(i.activeCell.rowIndex,i.activeCell.colIndex),d.find("span.e-ssfilter").remove()),delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),n.extend(!0,c,i.selectedCell),this.XLFilter._filterActiveCell(i.sheetIndex,i.activeCell,c,i.filteredValue,i.selRange)):this.XLFilter.clearFilter("remove")),i.operation==="filter"&&i.requestType==="filterbycell"&&(delete this._excelFilter._predicates[i.sheetIndex][i.fieldName],this.XLFilter._clearFilterColumn(i.fieldName,"","","Or",null,null,i.tableID),n.extend(!0,c,i.selectedCell),this.XLFilter._filterActiveCell(i.sheetIndex,i.activeCell,c,i.filteredValue,i.selRange)),i.operation==="apply-filter"){for(h=this.getSheet(i.sheetIndex),r=0,e=i.filteredCells.length;r<e;r++)w=this.XLFilter._getFilterIcon(),this.XLFilter._applyFilterIcon({rowIndex:i.filteredCells[r].rowIndex,colIndex:i.filteredCells[r].colIndex},w);h.filterSettings.range=i.fRange;h.filterSettings.tableRange.push(i.filterRange)}},_undoForFilterByColor:function(n){var i,r=[],t;for(r.push(n),i=this._isUndo?this._undoCollection:r,delete this._excelFilter._predicates[n.sheetIndex][n.columnName],this.XLFilter._clearFilterColumn(n.columnName,"","","Or",null,null,n.tableID),t=i.length-1;t>=0;t--)if(i[t].reqType==="filterbycolor"&&i[t].tableID===n.tableID&&i[t].rowIndex===n.rowIndex&&i[t].colIndex===n.colIndex){this.XLFilter._filterHandler(i[t]);break}},_undoForFind:function(n){var i,t,r,u;switch(n.operation){case"replace":this.XLEdit._updateCellValue({rowIndex:n.rowIndex,colIndex:n.colIndex},n.prevData.value,null,n.sheetIndex);u=n.prevData;n.prevData=n.newData;n.newData=u;this.XLSelection.selectRange({rowIndex:n.rowIndex,colIndex:n.colIndex},{rowIndex:n.rowIndex,colIndex:n.colIndex});break;case"replaceAll":for(t=0,r=n.selectedCell.length;t<r;t++)this.XLEdit._updateCellValue({rowIndex:n.selectedCell[t].rowIndex,colIndex:n.selectedCell[t].colIndex},n.selectedCell[t].prevData.value,null,n.selectedCell[t].sheetIndex),u=n.selectedCell[t].prevData,n.selectedCell[t].prevData=n.selectedCell[t].newData,n.selectedCell[t].newData=u;break;case"blanks":case"conditions":case"validations":case"formulas":case"rowdiff":case"coldiff":case"comments":case"constants":for(t=0,r=n.selectedCell.length;t<r;t++)i=this.getCell(n.selectedCell[t].rowIndex,n.selectedCell[t].colIndex,n.sheetIndex),this._isUndo?i.operation==="coldiff"||i.operation==="rowdiff"?n.selectedCell[t].isApply?i.removeClass("e-selected"):i.addClass("e-selected"):n.selectedCell[t].isApply?i.addClass("e-selected"):i.removeClass("e-selected"):i.removeClass("e-selected")}this.model.allowFormulaBar&&this.updateFormulaBar()},_undoForFormat:function(i){var c=!1,y,r,f,e,o=this._dataContainer.sheets[i.sheetIndex],l,s,a,h="",u,v;if(t.isNullOrUndefined(i.process))for(i.oprType==="style"&&(this.XLFormat.removeStyle(i.range,{cellStyle:!0,format:!0}),h="e-format",!t.isNullOrUndefined(i.process)&&i.process.indexOf("border")>-1&&(h="e-border"),a=new RegExp("\\b"+h+".*?\\b","g")),y={startCell:i.selectedCell[0],endCell:i.selectedCell[i.selectedCell.length-1]},u=0,v=i.selectedCell.length;u<v;u++)r=i.selectedCell[u],this._isRowViewable(i.sheetIndex,r.rowIndex)&&(e=this.getCell(r.rowIndex,r.colIndex)[0],c=!0),t.isNullOrUndefined(o[r.rowIndex])&&(o[r.rowIndex]={}),t.isNullOrUndefined(o[r.rowIndex][r.colIndex])&&(o[r.rowIndex][r.colIndex]={}),n.extend(!0,o[r.rowIndex][r.colIndex],i.selectedCell[u].beforeFormat),c&&(i.oprType==="format"?(l=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2"),this.XLEdit._refreshTextNode(e,t.isNullOrUndefined(l)?"":l),this.XLEdit._refreshCellAlignment({cellIdx:{rowIndex:r.rowIndex,colIndex:r.colIndex}})):(f=h==="e-format"?this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"format"):this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border"),e.className=e.className.replace(a,""),f=t.isNullOrUndefined(f)?"":f,this.addClass(e,f))),i.selectedCell[0].colIndex===i.selectedCell[u].colIndex&&this.model.allowResizing&&(this._isUndo?this.XLResize.setRowHeight(i.selectedCell[u].rowIndex,i.selectedCell[u].bRowHeight):this.XLResize.setRowHeight(i.selectedCell[u].rowIndex,i.selectedCell[u].aRowHeight)),s=i.selectedCell[u].beforeFormat,i.selectedCell[u].beforeFormat=i.selectedCell[u].afterFormat,i.selectedCell[u].afterFormat=s,c=!1;!t.isNullOrUndefined(i.process)&&i.process.indexOf("border")>-1&&(this.XLFormat.removeStyle(i.range,{cellStyle:!0,tableStyle:!0,format:!1,border:!0}),this._isUndo?this.XLFormat.updateFormat(i.beforeFormat,i.range):i.process==="noborder"?this.XLFormat.format({border:{}},i.range):this.XLFormat.applyBorder(n.extend(!0,{},i.options),i.range),s=i.beforeFormat,i.beforeFormat=i.afterFormat,i.afterFormat=s);i.status="undo-cellformat";this.performSelection(i.range)},_undoForFormatPaint:function(t){var r,i,e,o,s=this._dataContainer.sheets[t.sheetIndex],u,f;for(this.XLCFormat.clearCF(t.range),this.XLFormat.removeStyle(t.range),this.updateData(n.extend(!0,[],t.beforeData),t.range),this.XLCFormat.refreshCFormat(t.range),e=this.getRangeData({range:t.range}),o=this._getSelectedRange({rowIndex:t.range[0],colIndex:t.range[1]},{rowIndex:t.range[2],colIndex:t.range[3]}),i=0,f=t.unwrapCells.length;i<f;i++)this.setWrapText("unwrap",this._getAlphaRange(t.sheetIndex,t.unwrapCells[i].rowIndex,t.unwrapCells[i].colIndex,t.unwrapCells[i].rowIndex,t.unwrapCells[i].colIndex));for(i=0,u=t.wrapCells.length;i<u;i++)this.setWrapText("wrap",this._getAlphaRange(t.sheetIndex,t.wrapCells[i].rowIndex,t.wrapCells[i].colIndex,t.wrapCells[i].rowIndex,t.wrapCells[i].colIndex));r=t.unwrapCells;t.unwrapCells=t.wrapCells;t.wrapCells=r;r=t.beforeData;t.beforeData=t.afterData;t.afterData=r},_undoForFormatTable:function(i){var o,k,h,c,l,s,y,p,v,f=0,u=i.sheetIndex,r=this.getSheet(u).tableManager,g,e=i.header,nt=n("#"+this._id+"_Ribbon").data("ejRibbon"),a,tt=this._isUndo,w,d,b;switch(i.action){case"Design_Tools_ConvertToRange":this._isUndo?(r[i.tableID]={name:i.name,range:i.beforeRange,format:i.format,formatName:i.formatName},this.performSelection(this._getAlphaRange(u,i.beforeRange[0],i.beforeRange[1],i.beforeRange[2],i.beforeRange[3])),this.XLFilter._filterTable(u,i.tableID),this.updateUniqueData({tableName:"e-table"+i.tableID},r[i.tableID].range),r[i.tableID].isFilter=i.isFilter,r[i.tableID].firstColumn=i.firstColumn,r[i.tableID].lastColumn=i.lastColumn,r[i.tableID].totalRow=i.totalRow,r[i.tableID].fnNumber=i.fnNumber,this.getSheet(u)._header[i.tableID]=e,range=this._getDollarAlphaRange(r[i.tableID].range,!0),this.XLRibbon.addNamedRange(i.name,range,null,u)):i.tableID in r&&(g="e-table"+i.tableID,this.XLFormat.removeTable(i.tableID),this.XLFilter._clearFilterTable(u,i.tableID),delete r[i.tableID],delete this.model.sheets[u]._header[i.tableID]);break;case"filtericon":w=n("#"+i.id).data("ejCheckBox");d=i.tableId;i.check?w.option("checked",!1):w.option("checked",!0);r[d].isFilter=!i.check;i.check=!i.check;break;case"firstlastcolumn":b=n("#"+i.id).data("ejCheckBox");i.check?(this.XLFormat.format({style:{"font-weight":"normal"}},i.range),b.option("checked",!1)):(this.XLFormat.format({style:{"font-weight":"bold"}},i.range),b.option("checked",!0));r[i.tableId][i.prop]=!i.check;i.check=!i.check;break;case"totalrow":n("#"+i.id).ejCheckBox("option",{checked:!i.check});i.check=!i.check;break;case"Design_Tools_ResizeTable":if(this._isUndo){for(this._isFATResize=!0,i.afterRange=n.extend(!0,[],i.afterRange),i.totalRow&&(this._dupDetails=!0,this.XLFormat._calculateTotalRow(u,i.tableId,!1),i.beforeRange[2]-=1,r[i.tableId].range[2]-=1),l=r[i.tableId].name,this.XLFormat.removeTable(i.tableId),this.XLFormat.removeStyle(i.afterRange),h=i.beforeRange[3]-i.beforeRange[1]+1,s=e[i.tableId].header?this.getRangeData({range:i.beforeRange}):this.getRangeData({range:i.beforeRange}).splice(h,this.getRangeData({range:i.beforeRange}).length),this.clearRangeData(i.beforeRange),e[i.tableId].header?this.updateData(s,[i.beforeRange[0],i.beforeRange[1],i.beforeRange[2],i.beforeRange[3]]):this.updateData(s,[i.beforeRange[0],i.beforeRange[1],i.beforeRange[2]-1,i.beforeRange[3]]),r[i.tableId]={header:e[i.tableId].header,tblId:i.tableId,name:l,range:i.beforeRange,format:i.format,formatName:i.formatName,firstColumn:i.firstColumn,lastColumn:i.lastColumn,isFilter:i.isFilter,totalRow:i.totalRow},this.XLClipboard._isCut=!0,e[i.tableId].header?this.XLFormat.createTable(r[i.tableId],i.beforeRange):this.XLFormat.createTable(r[i.tableId],[i.beforeRange[0],i.beforeRange[1],i.beforeRange[2]-1,i.beforeRange[3]]),i.totalRow&&(this._dupDetails=!0,this.XLFormat._calculateTotalRow(u,i.tableId,!0),i.beforeRange=r[i.tableId].range),a=this.getSheet(u).filterSettings.tableRange,f=0;f<a.length;f++)if(a[f].tableID==i.tableId){a[f].endRow=a[f].selectedRange.endRow=i.beforeRange[2];break}this.XLClipboard._isCut=!1;this._isFATResize=!1}else this._isFATResize=!0,i.beforeRange=n.extend(!0,[],i.beforeRange),i.totalRow&&(this.XLFormat._calculateTotalRow(u,i.tableId,!1),i.afterRange=r[i.tableId].range=[i.afterRange[0],i.afterRange[1],i.afterRange[2]-1,i.afterRange[3]]),l=r[i.tableId].name,this.XLFormat.removeTable(i.tableId),this.XLFormat.removeStyle(i.beforeRange),h=i.beforeRange[3]-i.beforeRange[1]+1,s=e[i.tableId].header?this.getRangeData({range:i.afterRange}):this.getRangeData({range:i.afterRange}).splice(h,this.getRangeData({range:i.afterRange}).length),this.clearRangeData(i.afterRange),e[i.tableId].header?this.updateData(s,i.afterRange):this.updateData(s,[i.afterRange[0],i.afterRange[1],i.afterRange[2]-1,i.afterRange[3]]),r[i.tableId]={header:e[i.tableId].header,tblId:i.tableId,name:l,range:i.beforeRange,format:i.format,formatName:i.formatName,firstColumn:i.firstColumn,lastColumn:i.lastColumn,isFilter:i.isFilter,totalRow:i.totalRow},this.XLClipboard._isCut=!0,e[i.tableId].header?this.XLFormat.createTable(r[i.tableId],i.afterRange):this.XLFormat.createTable(r[i.tableId],[i.afterRange[0],i.afterRange[1],i.afterRange[2]-1,i.afterRange[3]]),this.XLFilter._extendFilterRange(i.tableId,i.afterRange),i.totalRow&&(this.XLFormat._calculateTotalRow(u,i.tableId,!0),i.afterRange=r[i.tableId].range),this.XLClipboard._isCut=!1,this._isFATResize=!1;break;case"renaming":this.XLRibbon.removeNamedRange(r[i.tableId].name);document.getElementById(this._id+"_Ribbon_Design_Properties_TableName")&&(document.getElementById(this._id+"_Ribbon_Design_Properties_TableName").value=r[i.tableId].name=this._isUndo?i.prevName:i.newName);this.XLRibbon.addNamedRange(r[i.tableId].name,i.range,null,u);nt.showTab(this._getLocStr("Design"));break;default:if(this._isUndo){if(l=r[i.tableID].name,this.XLFormat.removeTable(i.tableID),this.XLFormat.removeStyle(i.afterRange),i.tableStyle.header)for(o=0,k=i.beforeRangeHeader.length;o<k;o++)t.isNullOrUndefined(i.beforeRangeHeader[o].value2)?this.XLEdit._updateCellValue(this._getCellIdx(i.pcells[o]),""):this.isNumber(i.pcells[o].innerHTML)&&this.XLEdit._refreshCellAlignment({cellIdx:this._getCellIdx(i.pcells[o])});else h=i.afterRange[3]-i.afterRange[1]+1,this.clearRangeData(i.afterRange),this.updateData(n.extend(!0,[],i.beforeRangeData),i.afterRange);if(this.XLFormat.updateFormat(i.beforeFormat,i.afterRange),y=i.beforeMergeRange,p=y.length,p)while(f<p)v=y[f].value,v&&(c=this.getRangeIndices(v.mRange),selCell=this._getSelectedRange({rowIndex:c[0],colIndex:c[1]},{rowIndex:c[2],colIndex:c[3]}),this.mergeCenter=v.isCenterAlign,this._mergeCells(i.sheetIndex,selCell,{},[])),f++}else this.XLFormat.createTable(i.tableStyle,i.beforeRange)}},_autosumFormatUpdate:function(n,t,i,r){var f={},u,e=this.getActiveSheetIndex();n.type!=="general"&&(this._dupDetails=!0,f.type=n.type,u=i?this._getAlphaRange(e,t[2]+1,t[3],t[2]+1,t[3]):this._getAlphaRange(e,t[0],t[1],t[2],t[3]),r?this.XLFormat.format({type:"general"},u+":"+u):this.XLFormat.format(f,u+":"+u),this._dupDetails=!1)},_undoForHyperlink:function(n){var t,i,r={rowIndex:n.selectedCell[n.selectedCell.length-1].rowIndex,colIndex:n.selectedCell[n.selectedCell.length-1].colIndex},u={rowIndex:n.selectedCell[0].rowIndex,colIndex:n.selectedCell[0].colIndex},f,e,o;for(this.setActiveCell(n.selectedCell[0].rowIndex,n.selectedCell[0].colIndex),this.XLSelection.selectRange(u,r),n.action==="add"?this._removeHyperlink(n.reqType,n.selectedCell):n.action==="edit"?this._setLink(n.selectedCell):this._setLink(n.selectedCell),t=0,i=n.selectedCell.length;t<i;t++)f=n.selectedCell[t].prevLink,n.selectedCell[t].prevLink=n.selectedCell[t].curLink,n.selectedCell[t].curLink=f,e=n.selectedCell[t].prevText,n.selectedCell[t].prevText=n.selectedCell[t].curText,n.selectedCell[t].curText=e,o=n.selectedCell[t].prevColor,n.selectedCell[t].prevColor=n.selectedCell[t].curColor,n.selectedCell[t].curColor=o;n.action==="add"?n.action="delete":n.action==="delete"&&(n.action="add");this.XLSelection.selectRange(u,r);this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForIns:function(t){n.extend(!0,this._delCells,t.delCells);n.extend(!0,this._deletedText,t.text);n.extend(!0,this._removeMergeColl,t.removeMerge);switch(t.action){case"insertShiftRight":this.insertShiftRight(t.startCell,t.endCell);break;case"insertShiftBottom":this.insertShiftBottom(t.startCell,t.endCell);break;case"insertRow":this.insertEntireRow(t.startCell.rowIndex,t.endCell.rowIndex);break;case"insertColumn":this.insertEntireColumn(t.startCell.colIndex,t.endCell.colIndex)}},_undoForMerge:function(n){var r,u,s,e,f,h,i,o;this._delCells=n.hideCells;this._selMergeCells=[];switch(n.action){case"merge-all":case"merge-across":case"un-merge":for(i=0,o=n.mCells.length;i<o;i++)e=t.isNullOrUndefined(n.mCells[i].prevObj)?{}:t.isNullOrUndefined(n.mCells[i].prevObj.merge)?{}:n.mCells[i].prevObj.merge,f=t.isNullOrUndefined(n.mCells[i].curObj)?{}:t.isNullOrUndefined(n.mCells[i].curObj.merge)?{}:n.mCells[i].curObj.merge,n.action==="un-merge"?t.isNullOrUndefined(e.mRange)||(r=this.getRangeIndices(e.mRange),u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]}),this.mergeCenter=e.isCenterAlign,this._mergeCells(n.sheetIndex,u,{},[])):(s=this._getHiddenRowColumnCount(n.sheetIndex,f.mRange),this._unMergeAllCells(n.sheetIndex,i,n.mCells,[],s.hRow,s.hCol)),h=n.mCells[i].prevObj,n.mCells[i].prevObj=n.mCells[i].curObj,n.mCells[i].curObj=h;if(n.action!=="un-merge")for(i=0,o=n.mCells.length;i<o;i++)e=t.isNullOrUndefined(n.mCells[i].prevObj)?{}:t.isNullOrUndefined(n.mCells[i].prevObj.merge)?{}:n.mCells[i].prevObj.merge,f=t.isNullOrUndefined(n.mCells[i].curObj)?{}:t.isNullOrUndefined(n.mCells[i].curObj.merge)?{}:n.mCells[i].curObj.merge,t.isNullOrUndefined(f.mRange)||(r=this.getRangeIndices(f.mRange),u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]}),this.mergeCenter=f.isCenterAlign,this._mergeCells(n.sheetIndex,u,{},[]));n.action=n.action==="un-merge"?"merge-all":"un-merge"}r=this._getSelectedCells(n.sheetIndex,n.range).range;u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]});this.performSelection(u[0],u[u.length-1]);this._delCells=[]},_undoForReOrder:function(i){var r=this.getSheet(i.sheetIndex),u=this.getSheet(i.sheetIndex).tableManager;this._isUndo?(this.XLComment&&this.XLComment.deleteComment(),this.clearRangeData(i.destinationRange),this.XLFormat.removeStyle(i.destinationRange),this.XLCFormat.clearCF(i.destinationRange),this.isUndefined(i.tblObj)||(this.XLFormat.removeTable(i.tblObj.tblId),this.XLClipboard._isCut=!0,this.XLFormat.createTable(i.tblObj,i.sourceRange),i.tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,i.tblObj.tblId,i.tblObj.fnNumber,i.sourceRange,!1),this.XLClipboard._isCut=!1),this.updateData(n.extend(!0,[],i.sourceData),i.sourceRange),this.updateData(n.extend(!0,[],i.destinationData),i.destinationRange),i.tRange&&(this._dupDetails=!0,this.XLFilter.clearFilter("remove"),this.XLFilter.filter(i.tRange),this._dupDetails=!1),this.XLFormat.updateFormat(i.sourceFormat,i.sourceRange),this.XLFormat.updateFormat(i.destinationFormat,i.destinationRange),this.isUndefined(i.sourceCFormat)||i.sourceCFormat instanceof Array||this.XLCFormat.setCFRule(i.sourceCFormat),this.setActiveCell(i.sourceRange[0],i.sourceRange[1]),this.XLSelection.selectRange({rowIndex:i.sourceRange[0],colIndex:i.sourceRange[1]},{rowIndex:i.sourceRange[2],colIndex:i.sourceRange[3]},i.sheetIndex),r._startCell={rowIndex:i.sourceRange[0],colIndex:i.sourceRange[1]},r._endCell={rowIndex:i.sourceRange[2],colIndex:i.sourceRange[3]},this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement(),this.setHeightToRows(i.prevDestRowHt)):(this.XLSelection.selectRange({rowIndex:i.sourceRange[0],colIndex:i.sourceRange[1]},{rowIndex:i.sourceRange[2],colIndex:i.sourceRange[3]},i.sheetIndex),this.XLComment&&this.XLComment.deleteComment(),this.clearRangeData(i.sourceRange),this.clearRangeData(i.destinationRange),t.isNullOrUndefined(this.XLEdit.getPropertyValue(i.destinationRange[0],i.destinationRange[1],"tableName"))&&this.XLFormat.removeStyle(i.destinationRange),this.isUndefined(i.tblObj)||(this.XLFormat.removeTable(i.tblObj.tblId),this.XLClipboard._isCut=!0,this.XLFormat.createTable(i.tblObj,i.destinationRange),this.XLClipboard._isCut=!1),t.isNullOrUndefined(this.XLEdit.getPropertyValue(i.sourceRange[0],i.sourceRange[1],"tableName"))&&this.XLFormat.removeStyle(i.sourceRange),this.XLCFormat.clearCF(i.sourceRange),this.updateData(n.extend(!0,[],i.sourceData),i.destinationRange),i.tRange&&(this._dupDetails=!0,this.XLFilter.clearFilter("remove"),this.XLFilter.filter(i.destinationRange),this._dupDetails=!1),this.XLFormat.updateFormat(i.sourceFormat,i.destinationRange),i.tblObj&&i.tblObj.totalRow&&this.XLFormat._updateTotalRow(i.sheetIndex,i.tblObj.tblId,i.tblObj.fnNumber,i.destinationRange,!1),this.isUndefined(i.destinationCFormat)||i.destinationCFormat instanceof Array||this.XLCFormat.setCFRule(i.destinationCFormat),this.setHeightToRows(i.destHeight),this.setActiveCell(i.destinationRange[0],i.destinationRange[1]),this.XLSelection.selectRange({rowIndex:i.destinationRange[0],colIndex:i.destinationRange[1]},{rowIndex:i.destinationRange[2],colIndex:i.destinationRange[3]},i.sheetIndex),r._startCell={rowIndex:i.destinationRange[0],colIndex:i.destinationRange[1]},r._endCell={rowIndex:i.destinationRange[2],colIndex:i.destinationRange[3]},this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())},_undoForPivot:function(n){var t=this._isUndo?this._undoCollection:this._redoCollection,i={curOperation:n,prevOperation:t[t.length-1],isUndo:this._isUndo};this._trigger("_readUndoRedo",i)},_undoForResizeCol:function(n){this.XLResize._resizeColumnUsingDiff(n.oldWidth,n.newWidth,n.cols);var t=n.oldWidth;n.oldWidth=n.newWidth;n.newWidth=t;this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForResizeRow:function(n){this.XLResize._resizeRowUsingDiff(n.oldHeight,n.newHeight,n.rows);var t=n.oldHeight;n.oldHeight=n.newHeight;n.newHeight=t;this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForResizeFHeight:function(n){var t=this._isUndo,i=n.newHeight;n.newHeight=n.oldHeight;n.oldHeight=i;this.XLResize.setRowHeight(n.rowIndex,n.newHeight);this._isUndo?this.XLEdit._clearDataContainer({sheetIdx:n.sheetIndex,cellIdx:{rowIndex:n.rowIndex,colIndex:0},property:["isFitHeight"]}):this.XLEdit._updateDataContainer({rowIndex:n.rowIndex,colIndex:0},{dataObj:{isFitHeight:!0}});this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this._isUndo=t},_undoForResizeFWidth:function(n){var t=this.getCell(0,n.colIndex).get(0),i=this._isUndo,r=n.newWidth;n.newWidth=t.offsetWidth===n.oldWidth?n.newWidth:n.oldWidth;n.oldWidth=r;this.XLResize._applyWidth(n.target,n.sheetIndex,n.colIndex,n.newWidth);this.XLScroll._getColWidths(n.sheetIndex,n.colIndex);this._isUndo?this.XLEdit._clearDataContainer({sheetIdx:n.sheetIndex,cellIdx:{rowIndex:0,colIndex:n.colIndex},property:["isFitWidth"]}):this.XLEdit._updateDataContainer({rowIndex:0,colIndex:n.colIndex},{dataObj:{isFitWidth:!0}});this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this._isUndo=i},_undoForShape:function(i){var u,r,v,b,nt=0,k,ot=this.getSheet(i.sheetIndex).shapeMngr,y,p,l,rt,c,ut,w,ft,g,h,e,s,a,et;this.model.showRibbon&&(k=this.XLRibbon._chartThemes);i.action!="chartType"&&i.action!=="create"&&i.action!=="remove"&&i.action!=="edit"&&i.action!=="border"&&i.action!=="resetpicture"&&i.action!=="changepicture"&&i.action!=="picturesize"&&i.action!=="chartTheme"&&i.action!=="chartType"&&i.action!=="selectData"&&(u=n("#"+i.cid).data("ejChart"),r=this.getSheet(i.sheetIndex).shapeMngr.chart[this.XLEdit.getPropertyValue(i.rowIndex,i.colIndex,"chart")[0]]);switch(i.action){case"remove":this.XLShape._picCellIdx=this.XLShape._getCellIndexFromOffset(i.position.top,i.position.left);this.XLShape._deleteShape(i.sheetIndex,n("#"+i.id));i.action="create";break;case"create":i.shapeType==="picture"?(this.XLShape._createPicture(i.sheetIndex,i.actCell,i.img,i.position.top,i.position.left,i.position.width,i.position.height,i.cnt,i.bcolor,i.bstyle,i.bwidth),this.XLRibbon._formatTabUpdate(),n(i.actCell).addClass("e-activecell")):(this.XLSelection.selectRange({rowIndex:i.range[0],colIndex:i.range[1]},{rowIndex:i.range[0],colIndex:i.range[1]},i.sheetIndex),this.setActiveCell(i.range[0],i.range[1],i.sheetIndex),this.XLChart.createChart(this._getAlphaRange(i.sheetIndex,i.range[0],i.range[1],i.range[2],i.range[3]),i.options,i.id));i.action="remove";break;case"edit":var tt,h=this._dataContainer.sheets[i.sheetIndex],o=i.id.split("_")[1].replace(/[0-9]/g,""),d={},it,f;n("#"+i.id).css({left:i.prev.left,top:i.prev.top,height:i.prev.height,width:i.prev.width});o==="chart"&&this.XLChart.resizeChart(i.id,i.prev.height,i.prev.width);i.visualImg.hide();this.XLShape._picCellIdx=this.XLShape._getCellIndexFromOffset(i.prev.top,i.prev.left);f=this.XLShape._getCellIndexFromOffset(i.cur.top,i.cur.left);tt=this._getShapePositionInManager(f.rowIndex,f.colIndex,i.id,o);d[o]=i.obj[o][tt];i.actionType!="resize"&&(this.getObjectLength(h[f.rowIndex][f.colIndex])<2&&h[f.rowIndex][f.colIndex][o].length<2?delete h[f.rowIndex][f.colIndex]:h[f.rowIndex][f.colIndex][o].length<2?delete h[f.rowIndex][f.colIndex][o]:(h[f.rowIndex][f.colIndex][o].some(function(n,t){if(d.id===n.id)return it=t,!0}),h[f.rowIndex][f.colIndex][o].splice(it,1)));this.XLEdit._updateDataContainer({rowIndex:this.XLShape._picCellIdx.rowIndex,colIndex:this.XLShape._picCellIdx.colIndex},{dataObj:d});this.getCell(this.XLShape._picCellIdx.rowIndex,this.XLShape._picCellIdx.colIndex,i.sheetIndex).addClass("e-activecell");this.model.showRibbon&&this.element.find(".e-ss-activeimg").length<1&&(o==="picture"?this.XLRibbon._toggleFormatTab():this.XLRibbon._toggleChartDesignTab());this.XLRibbon._setShapeWidthHeight({width:i.prev.width,height:i.prev.height,shapeType:o});this._swapVal(i);break;case"PHAxis":case"PVAxis":y=i.action=="PHAxis"?"primaryXAxis":"primaryYAxis";p=i.action==="PHAxis"?"xAxis":"yAxis";i.visibility=!i.visibility;u.option(y,{visible:i.visibility});r[p].visible=i.visibility;break;case"PX":case"PY":y=i.action=="PX"?"primaryXAxis":"primaryYAxis";p=i.action==="PX"?"xAxis":"yAxis";t.isNullOrUndefined(i.prev.text)&&(i.prev.text="");u.option(y,{title:{text:i.prev.text}});r[p].title.text=i.prev.text;this._swapVal(i);break;case"CT":u.option("title",{textAlignment:i.prev.align,text:i.prev.text});r.title={text:i.prev.text,textAlignment:i.prev.align};this._swapVal(i);break;case"DLNone":u.option({series:i.prev.series});r.dataLabel={visible:i.prev.series[0].marker.dataLabel.visible};this._swapVal(i);break;case"DL":u.option({series:i.prev.series});r.dataLabel={visible:i.prev.series[0].marker.dataLabel.visible,vAlign:i.prev.series[0].marker.dataLabel.verticalTextAlignment,tPosn:i.prev.series[0].marker.dataLabel.textPosition};this._swapVal(i);break;case"PMajorH":i.visibility=!i.visibility;u.option("primaryYAxis",{majorGridLines:{visible:i.visibility}});r.yAxis.majorGridLines={visible:i.visibility};break;case"PMajorV":i.visibility=!i.visibility;u.option("primaryXAxis",{majorGridLines:{visible:i.visibility}});r.xAxis.majorGridLines={visible:i.visibility};break;case"PMinorH":i.visibility=!i.visibility;u.option("primaryYAxis",{minorGridLines:{visible:i.visibility},minorTicksPerInterval:5,minorTickLines:{visible:i.visibility}});r.yAxis.minorGridLines={visible:i.visibility};break;case"PMinorV":i.visibility=!i.visibility;u.option("primaryXAxis",{minorGridLines:{visible:i.visibility},minorTicksPerInterval:5,minorTickLines:{visible:i.visibility}});r.xAxis.minorGridLines={visible:i.visibility};break;case"LNone":i.visibility=!i.visibility;u.option("legend",{visible:i.visibility});r.legend.visible=i.visibility;break;case"Legend":u.option("legend",{position:i.prev.position});r.legend.position=i.prev.position;this._swapVal(i);break;case"width":s={width:i.prev.width,height:i.prev.height,shapeType:"chart"};l=n("#"+u._id);u.option("size",n.extend(!0,{},s));l[0].style.height=i.prev.height+"px";l[0].style.width=i.prev.width+"px";r.width=i.prev.width;r.height=i.prev.height;this.XLRibbon._setShapeWidthHeight(s);this._swapVal(i);break;case"height":s={width:i.prev.width,height:i.prev.height,shapeType:"chart"};l=n("#"+u._id);u.option("size",n.extend(!0,{},s));l[0].style.height=i.prev.height+"px";l[0].style.width=i.prev.width+"px";r.width=i.prev.width;r.height=i.prev.Height;this.XLRibbon._setShapeWidthHeight(s);this._swapVal(i);break;case"srcolumn":u.model.series.length=0;r.isRowColSwitched=!r.isRowColSwitched;rt={xRange:r.xRange,yRange:r.yRange,lRange:r.lRange,isRowColSwitched:r.isRowColSwitched,dataSheetIdx:r.dataSheetIdx};c=this.XLChart._processChartSeries(rt);u.option({series:c.series});this.getActiveSheetIndex()===r.dataSheetIdx&&this.XLChart._focusChartRange(c.xRange,c.yRange,c.lRange);r.xAxis.range=c.xRange;r.yAxis.range=c.yRange;r.legend.range=c.lRange;break;case"border":ft=this._dataContainer.sheets[i.sheetIndex][i.cellIdx.rowIndex][i.cellIdx.colIndex].picture[i.picIdx];e=n("#"+i.id);this._removeClass(e[0],i.curClass);this.addClass(e[0],i.prevClass);w=this.XLShape._getImgStyleFromHashCode(i.prevClass);ft={bcolor:w["border-color"],bstyle:w["border-style"],bwidth:w["border-width"]};ut=i.prevClass;i.prevClass=i.curClass;i.curClass=ut;break;case"resetpicture":e=n("#"+i.id);g=new RegExp("\\be-shapebdr.*?\\b","g");this._isUndo?e[0].className.match(g)&&this.XLShape.changePictureBorder(e[0].id,i.prev.bwidth,i.prev.bstyle,i.prev.bcolor):e[0].className=e[0].className.replace(g,"");i.actionType!=="resetpicture"&&(e.css({width:i.prev.width,height:i.prev.height}),this.XLShape._selectImg(e),this.XLShape._updateShapeObj(e[0]));this._swapVal(i);break;case"changepicture":h=this._dataContainer;n("#"+i.id).css("background-image","url('"+i.prev.img+"')");ot.picture[i.prev.pcIdx].data=i.prev.data;this._swapVal(i);break;case"picturesize":e=n("#"+i.id);s={width:i.prev.width,height:i.prev.height,shapeType:"picture"};e.css(s);this.XLRibbon._setShapeWidthHeight(s);this._swapVal(i);break;case"chartTheme":for(v=this.element.find("#"+this._id+"_chart").val(),b=n("#"+this._id+"_Ribbon_ChartDesign_ChartThemes_ChartThemes").data("ejDropDownList"),i.prev.theme.indexOf("dark")>-1?n("#"+v).addClass("e-ss-charttheme"):n("#"+v).removeClass("e-ss-charttheme"),this.XLChart.refreshChart(v,{theme:i.prev.theme}),a=0,et=k.length;et>a;a++)if(i.prev.theme===k[a].value.toLowerCase()){nt=a;break}b&&b.option({selectedItemIndex:nt});this._swapVal(i);break;case"chartType":this.XLChart.refreshChart(i.chartId,{type:i.prev.chartType,enable3D:i.prev.enable3D,marker:i.prev.marker});this._swapVal(i);break;case"selectData":this.XLChart.changeDataRange(document.getElementById(this._id+"_chart").value,i.prev.xRange,i.prev.yRange,i.prev.lRange);this._swapVal(i)}},_undoForShowHide:function(n){var t,i,r,u,f,e,o;if(n.operation==="row"){for(r=this._getJSSheetRowHeaderContent(n.sheetIndex),n.action==="show"?this._hideRow(n.hideRows[0],n.hideRows[n.hideRows.length-1],"isRHide"):this._showRow(n.hideRows[0],n.hideRows[n.hideRows.length-1],"isRHide"),t=0,i=n.remBRows.length;t<i;t++)this.addClass(r.find("td")[n.remBRows[t]],"e-hrow"),this.XLEdit._updateDataContainer({rowIndex:n.remBRows[t],colIndex:0},{dataObj:{hRow:!0}});for(t=0,i=n.addBRows.length;t<i;t++)this._removeClass(r.find("td")[n.addBRows[t]],"e-hrow"),this._dataContainer.sheets[n.sheetIndex][n.addBRows[t]][0].hRow;this.setActiveCell(n.bSelect.startRow,0);n.bSelect.startRow===n.bSelect.endRow?this.XLSelection.selectRow(n.bSelect.startRow,n.sheetIndex):this.XLSelection.selectRows(n.bSelect.startRow,n.bSelect.endRow,n.sheetIndex);f=n.addBRows;n.addBRows=n.remBRows;n.remBRows=f}else{for(u=this._getJSSheetHeader(n.sheetIndex).find("th"),n.action==="show"?this._hideColumn(n.hideCols[0],n.hideCols[n.hideCols.length-1]):this._showColumn(n.hideCols[0],n.hideCols[n.hideCols.length-1]),t=0,i=n.remBCols.length;t<i;t++)this.XLEdit._updateDataContainer({rowIndex:0,colIndex:n.remBCols[t]},{dataObj:{hCol:!0}}),this.addClass(u[n.remBCols[t]],"e-hcol");for(t=0,i=n.addBCols.length;t<i;t++)this._removeClass(u[n.addBCols[t]],"e-hcol"),this._dataContainer.sheets[n.sheetIndex][0][n.addBCols[t]].hCol;this.setActiveCell(0,n.bSelect.startCol);n.bSelect.startCol===n.bSelect.endCol?this.XLSelection.selectColumn(n.bSelect.startCol,n.sheetIndex):this.XLSelection.selectColumns(n.bSelect.startCol,n.bSelect.endCol,n.sheetIndex);e=n.addBCols;n.addBCols=n.remBCols;n.remBCols=e}n.action=n.action==="show"?"hide":"show";o=n.bSelect;n.bSelect=n.aSelect;n.aSelect=o;this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForSort:function(n){var o=this.XLEdit.getColumnIndexByField(n.columnName),u,i,r,f,e=this.getSheet(n.sheetIndex)._filterColl,t;if(n.colSelected<1&&(f=n.range[0],n.range[0]>0&&(f=n.range[0]-1)),n.operation==="unsort"?(this._dupDetails=!0,this.XLComment.deleteComment(n.range,null,!0,null),this._removeHyperlink(null,null,!0,n.range),this.clearRangeData(n.range,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0),this.XLFormat.removeStyle(n.range,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0}),this.XLEdit.updateCellWithContainer(n.rangeData,n.range,n.sheetIndex,!0),this.XLSort._refreshRowHeight(n.range,n.rangeData),this._dupDetails=!1,n.operation="sort"):(this.XLSort._isSortByFilter=n.isSortByFilter,this.XLSort.sortByRange(n.range,n.columnName,n.direction),n.operation="unsort"),n.isSortByFilter)for(t=0;t<n.filterIcons.length;t++)r=e[n.filterIcons[t].rowIdx][n.filterIcons[t].colIdx],r.status=r.status.indexOf("-asc")>1?r.status.replace("-asc",n.filterIcons[t].prevIcon):r.status.indexOf("-dsc")>1?r.status.replace("-dsc",n.filterIcons[t].prevIcon):r.status+n.filterIcons[t].prevIcon,this._isRowViewable(n.sheetIndex,n.filterIcons[t].rowIdx)&&(i=this.getCell(n.filterIcons[t].rowIdx,n.filterIcons[t].colIdx).find(".e-filterspan")[0],i.className=i.className.indexOf("-asc")>1?i.className.replace("-asc",n.filterIcons[t].prevIcon):i.className.indexOf("-dsc")>1?i.className.replace("-dsc",n.filterIcons[t].prevIcon):i.className.indexOf("e-ssfiltered")>-1?i.className.replace("e-ssfiltered","e-ssfiltered"+n.filterIcons[t].prevIcon):i.className.replace("e-ssfilter","e-ssfilter"+n.filterIcons[t].prevIcon)),u=n.filterIcons[t].prevIcon,n.filterIcons[t].prevIcon=n.filterIcons[t].currIcon,n.filterIcons[t].currIcon=u},_undoForSortByColor:function(n){var t=n.range,r=n.prev.data,u=this._generateColCount(n.columnName)-1,i;this.XLComment.deleteComment(t,null,!0,null);this._isSort=!0;this._dupDetails=!0;this._removeHyperlink(null,null,!0,t);this._isSort=!1;this._dupDetails=!1;this.clearRangeData(t,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0);this.XLFormat.removeStyle(t,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0});this.XLEdit.updateCellWithContainer(r,t,n.sheetIndex,!0);n.oprType.indexOf("Put")<0&&(i=this.getCell(t[0]-1,u).find(".e-filterspan"),i.length>0&&(i[0].className=i[0].className.replace(n.cur.icon,n.prev.icon)));this._swapVal(n)},_undoForStyle:function(n){this.XLFormat.updateUniqueFormat(n.beforeFormat,n.range,n.opr);this._updateRangeStyle(n.range,n.beforeFormat);var t=this.changePosition(n.beforeFormat,n.afterFormat);this._refreshRangeTRHght(this.getActiveSheetIndex(),n.range);n.beforeFormat=t[1];n.afterFormat=t[0];this._isUndoRedo=!0;n.status="undo-cellstyles"},_undoForTextWrap:function(n){n.operation==="wrap"?(this.setWrapText("unwrap",n.range),n.operation="unwrap"):(this.setWrapText("wrap",n.range),n.operation="wrap");this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()},_undoForValidation:function(n){var i,f,e=this.getRangeIndices(n.range),r,u,s,o;if(this.performSelection({rowIndex:e[0],colIndex:e[1]},{rowIndex:e[2],colIndex:e[3]}),n.operation==="cl-hl-data")this.XLValidate.highlightInvalidData(n.range),n.operation="hl-data";else if(n.operation==="apply-validation"){for(r=n.selectedCell,o=[],i=0,f=r.length;i<f;i++)s=this.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"rule"),u=this.changePosition(r[i].prevRule,s),n.selectedCell[i].prevRule=u[1],t.isNullOrUndefined(u[0])||(u[0].customVal=u[0].customVal,this.XLEdit._updateDataContainer({rowIndex:r[i].rowIndex,colIndex:r[i].colIndex},{dataObj:{rule:u[0]}})),o.push(r[i]);t.isNullOrUndefined(u[0])&&this.clearRangeData(null,["rule"],o)}else if(n.operation==="hl-data")this.XLValidate.clearHighlightedValData(n.range),n.operation="cl-hl-data";else if(this._isUndo){for(i=0,f=n.selectedCell.length;i<f;i++)this.XLEdit._updateDataContainer({rowIndex:n.selectedCell[i].rowIndex,colIndex:n.selectedCell[i].colIndex},{dataObj:{rule:n.selectedCell[i].rules}});n.hlStatus&&this.XLValidate.highlightInvalidData(n.range)}else this.XLValidate.clearDV(n.range)},_applyCommentLink:function(i,r,u,f){var a=this._dataContainer,w=a.cFormatData,e,c=!1,l=this.getActiveSheetIndex(),v,y,o,h,p,s;if(this._isRowViewable(l,r.rowIndex)&&(e=this.getCell(r.rowIndex,r.colIndex),c=!0,n(e).removeClass("e-redft e-yellowft e-greenft e-redf e-redt")),i){if(v=this.isNumber(i.value2)?a.sharedData[i.value2]:i.value2,i=n.extend(!0,{},i),this.XLEdit._updateCellValue(r,v),"cFormatRule"in i)for(y=i.cFormatRule,h=0,p=y.length;h<p;h++)o=w[h].split("_"),this.XLCFormat._cFormat(o[0],o[2],o[3],o[4],null,null,[u,f,u,f]);"hyperlink"in i&&(s=i.hyperlink,c&&(s&&!s.webAddr?e.html(t.buildTag("a.e-hyperlinks",this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2",l),"")):e.html(t.buildTag("a.e-hyperlinks",this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2",l),"",{href:s.webAddr,target:"_blank"}))));"comment"in i&&(c&&e.removeClass("e-commentcell"),this.XLComment.setComment([r.rowIndex,r.colIndex,r.rowIndex,r.colIndex],null,!1))}},changePosition:function(n,i){var r=[];return r.push(i),r.push(n),t.swap(r,0,1),r},_addValidationRule:function(t,i){var u=[],r,f;for(n.extend(!0,u,t),r=0,f=t.length;r<f;r++)t[r].customVal!==i.customVal&&t[r].required!==i.required&&t[r].Number!==i.number&&u.push(i);return u},_addCondFormatRule:function(t,i){var f=!1,u=[],r,e;for(n.extend(!0,u,t),r=0,e=t.length;r<e;r++)if(i=i.indexOf("true")>-1?i.replace("_true",""):i.replace("_false",""),t[r]===i){f=!0;break}return f||u.push(i),u},getCellClass:function(n){var t=this._formatRegx;return n&&n.className.indexOf("e-format")>-1?n.className.match(t)[0]:""},_renderInsertDeleteDialog:function(){var n=this._id+"_insertdeletedlg",i,r,u,f,e,o;i=t.buildTag("div#"+n,"",{display:"none"});o=t.buildTag("div#"+n+"_content.e-dlg-fields e-dlgctndiv");i.append(o);f=t.buildTag("div#"+n+"_btndiv.e-dlg-btnfields");e=t.buildTag("div");r=t.buildTag("input#"+n+"_okbtn","",{"margin-left":4});u=t.buildTag("input#"+n+"_cantn");r.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._insertDeleteOk,this),enabled:!0,cssClass:"e-ss-okbtn"});u.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._insertDeleteCancel,this),showRoundedCorner:!0,width:60});f.append(e.append(r,u));i.append(f);i.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,width:"auto",height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg e-ss-insdeldlg",minWidth:150})},_refreshInsDelDialog:function(t){var i=n("#"+this._id+"_insertdeletedlg"),r,u;i.ejDialog({title:this._getLocStr(t)});i.ejDialog("open");this._insDelStatus=t.toLowerCase();r=n("#"+i[0].id+"_content");u=this._insDelStatus==="insert"?["ShiftRight","ShiftBottom","EntireRow","EntireColumn"]:["ShiftLeft","ShiftUp","EntireRow","EntireColumn"];r.children().empty();this._createRadioButton(i,r,u);enableBtn=this._insDelStatus==="insert"?"ShiftBottom":"ShiftLeft";n("#"+i[0].id+"_"+enableBtn).ejRadioButton({checked:!0});i.find("input[type='submit']:first").focus()},_createRadioButton:function(n,i,r){var o,h,s,e,u,f,c;for(s=t.buildTag("table"),f=0,c=r.length;f<c;f++)e=t.buildTag("tr"),u=t.buildTag("td"),h=t.buildTag("label",this._getLocStr(r[f]),{"padding-bottom":4},{"for":n[0].id+"_"+r[f]}),o=t.buildTag("input#"+n[0].id+"_"+r[f],"",{},{type:"radio",name:"inserdelete"}),u.append(o),e.append(u),u=t.buildTag("td"),u.append(h),o.ejRadioButton({size:"medium"}),e.append(u),s.append(e);i.append(s)},_getSelectedOption:function(t){for(var u,f=this._id+"_insertdeletedlg",r=0,i=0;i<4;i++)if(u=n("#"+f+"_"+t[i]).data("ejRadioButton"),u.model.checked){r=i;break}return r},_insertDeleteOk:function(){var o,f;this._isUndo=!1;this._isUndoRedo=!1;this._delCells=[];this._deletedText=[];this._removeMergeColl=[];this._deletedDimension=[];var t,i,e=this.getActiveSheetIndex(),r=this.model.sheets[e]._selectedCells[0],u=this.model.sheets[e]._selectedCells[this.model.sheets[e]._selectedCells.length-1];for(this._insDelStatus.indexOf("insert")>-1?(t=["ShiftRight","ShiftBottom","EntireRow","EntireColumn"],i=this._getSelectedOption(t),t[i].indexOf("ShiftRight")>-1?this.insertShiftRight(r,u):t[i].indexOf("ShiftBottom")>-1?this.insertShiftBottom(r,u):t[i].indexOf("EntireRow")>-1?this.insertEntireRow(r.rowIndex,u.rowIndex):this.insertEntireColumn(r.colIndex,u.colIndex)):(t=["ShiftLeft","ShiftUp","EntireRow","EntireColumn"],i=this._getSelectedOption(t),t[i].indexOf("ShiftLeft")>-1?this.deleteShiftLeft(r,u):t[i].indexOf("ShiftUp")>-1?this.deleteShiftUp(r,u):t[i].indexOf("EntireRow")>-1?this.deleteEntireRow(r.rowIndex,u.rowIndex):this.deleteEntireColumn(r.colIndex,u.colIndex)),n("#"+this._id+"_insertdeletedlg").ejDialog("close"),o=this.model.sheets[this.model.activeSheetIndex].shapeMngr.chart,f=0;f<o.length;f++)this.XLChart._refreshChart(o[f])},_insertDeleteCancel:function(){n("#"+this._id+"_insertdeletedlg").ejDialog("close")},_undoredoDetails:function(t,i,r,u,f){var e={sheetIndex:t,startCell:i,endCell:r,reqType:u,action:f,delCells:n.extend(!0,[],this._delCells),text:this._deletedText,deletedDimension:this._deletedDimension,removeMerge:this._removeMergeColl,fRow:n.extend(!0,{},this._fRow),fCol:n.extend(!0,{},this._fCol)};this.isImport||this._isExport||this._intrnlReq||(this._completeAction(e),this._trigActionComplete(e));this._removeMergeColl=[];this._delCells=[];this._fRow.fRowCnt=0;this._fCol.fColCnt=0;this._fRow.rowAdj=!0;this._fCol.colAdj=!0},_getRangeFrmFormula:function(n){var t=n.substring(n.indexOf("(")+1,n.indexOf(")")),i=new RegExp("^\\b[a-zA-Z][0-9]*:[a-zA-Z][0-9]*\\b$","g");if(i.test(t))return t;if(t.indexOf(",")>1){if(i.test(t.split(",")[1]))return t.split(",")[1];if(i.test(t.replace(",",":")))return t.replace(",",":")}},_refreshFormula:function(n,i,r,u,f,e,o){var y=this.getActiveSheetIndex(),c,h,a=this.XLEdit.getPropertyValue(n,i,"value"),l,v,s,p,w=this.getSheet(y);if((!this._isUndo||this._formulaChanged.pop()!=="true")&&this.isFormula(a)){if(l=this._getRangeFrmFormula(a),t.isNullOrUndefined(l))return;s=this.getRangeIndices(l);c=f==="column"?u==="insert"?s[3]+r:s[3]-r:u==="insert"?s[2]+r:s[2]-r;h=f==="column"?u==="insert"?s[1]+r:s[1]-r:u==="insert"?s[0]+r:s[0]-r;f==="column"?e>s[1]&&(h=s[1]):e>s[0]&&(h=s[0]);f==="column"?e>s[3]&&(c=s[3]):e>s[2]&&(c=s[2]);o&&(s[1]===s[3]||s[0]!==s[2]||(f==="column"?s[1]===s[3]&&(c=s[3],h=s[1]):s[0]===s[2]&&(c=s[2],h=s[0])),f==="column"?c<s[1]&&(c=s[3]):c<s[0]&&(c=s[2]),f==="column"?h<s[1]&&(h=s[1]):h<s[0]&&(h=s[0]),f==="row"&&(u==="delete"?h<s[2]&&s[1]!=i&&(c=s[2],h=s[0]):s[1]!=i&&(c=s[2],h=s[0])),f==="column"&&(u==="delete"?h<s[3]&&s[0]!=n&&(c=s[3],h=s[1]):s[0]!=n&&(c=s[3],h=s[1])));v=f==="column"?this._getAlphaRange(y,s[0],h,s[2],c):this._getAlphaRange(y,h,s[1],c,s[3]);n===s[0]&&i===s[1]&&(v="#REF!",this._ref.push(l));this._isUndo&&l==="#REF!"&&(v=this._ref.pop());a=a.replace(l,v);p=new ValueChangedArgs(n+1,i+1,a);this._calcEngine.valueChanged(w.sheetInfo.value,p);this.XLEdit._updateDataContainer({rowIndex:n,colIndex:i},{dataObj:{value:a}});this._applyFormula(y,n,i);this._isUndo||(l===v?this._formulaChanged.push("true"):this._formulaChanged.push("false"))}},_applyFormula:function(n,i,r){var u,f=this.getSheet(n),e=f._formulaCollection[i];t.isNullOrUndefined(e)&&(f._formulaCollection[i]={});u=this._calcEngine.getFormulaInfoTable().values();f._formulaCollection[i][r]=u[u.length-1]},_clearFormula:function(n,t){var u,f,i,e=this.getActiveSheetIndex(),s=this.XLEdit.getPropertyValue(n,t,"value"),r,o;if(this.isFormula(s)){for(u=this.model.sheets[e]._formulaCollection[n][t],i=this._calcEngine.getFormulaInfoTable().values(),f=i.indexOf(u),i.splice(f,1),this._calcEngine.getFormulaInfoTable().clear(),r=0,o=i.length;r<o;r++)this._calcEngine.getFormulaInfoTable().add(i[r]);delete this.model.sheets[e]._formulaCollection[n][t]}},_refreshValAndCF:function(n,t,i,r,u,f,e){var p=this.getActiveSheetIndex(),a=this._dataContainer.sheets[p],s=this._dataContainer.cFormatData,c,l,v,o,y,h;this.isUndefined(i)&&this.isUndefined(r)?delete a[n][t]:(this.isUndefined(i)||(a[n][t]={rule:i}),this.isUndefined(r)||(cFormatRule=s[r[0]],cFormatRule.indexOf("true")>-1?(h=cFormatRule.replace("true","false"),y=s.indexOf()):(h=cFormatRule.replace("false","true"),y=s.indexOf(h)),l=cFormatRule.split("_")[5],o=this.getRangeIndices(l),e.indexOf("Bottom")>-1||e.indexOf("Row")>-1?o[2]=o[2]+u:o[3]=o[3]+f,v=this._getAlphaRange(p,o[0],o[1],o[2],o[3]),cFormatRule=cFormatRule.replace(l,v),h=h.replace(l,v),s[r[0]]=cFormatRule,s[y]=h,c=cFormatRule.replace("true","false"),s.indexOf(c)<0&&s.push(c),a[n][t]={cFormatRule:[s.indexOf(c)]}))},_refreshRows:function(n){var t=this._getRowHdrTBody(n).find("tr"),i=this._getContTBody(n).find("tr");this.setRows([t,i],n)},_refreshFilterColl:function(t,i,r,u,f){var s=this.getSheet(t),w=s._filterColl,h=this.getObjectKeys(w),c,a,l,v,y,p,e,o;if(u==="row")if(f==="insert")for(e=parseInt(h[h.length-1]);e>=parseInt(h[0]);e--)e=parseInt(e),e>=i&&(s._filterColl[e+r]=n.extend(!0,{},s._filterColl[e]),delete s._filterColl[e]);else for(e=parseInt(h[0]);e<=parseInt(h[h.length-1]);e++)e=parseInt(e),e>=i&&(s._filterColl[e-r]=n.extend(!0,{},s._filterColl[e]),delete s._filterColl[e]);else for(p=this.model.scrollSettings.allowVirtualScrolling,e=parseInt(h[0]);e<=parseInt(h[h.length-1]);e++)if(c=this.getObjectKeys(s._filterColl[e]),f==="insert")for(y=!1,o=parseInt(c[c.length-1]);o>=parseInt(c[0]);o--)(o>=i||y)&&(y=!0,a=s._filterColl[e][o],a.status.indexOf("filtered")>-1&&(l=n.inArray(this._generateHeaderText(o+1),s._filteredColumns),l>-1&&s._filteredColumns.splice(l,1),v=n.inArray(this._generateHeaderText(o+r+1),s._filteredColumns),v<0&&s._filteredColumns.push(this._generateHeaderText(o+r+1))),s._filterColl[e][o+r]=n.extend(!0,{},s._filterColl[e][o]),p?(s._filterColl[e][o].status="e-ssfilter",this.XLEdit._updateDataContainer({rowIndex:e,colIndex:o},{dataObj:{isFilterHeader:!0,filterState:"filter",isFilterVisible:!0},sheetIdx:t})):delete s._filterColl[e][o]);else for(o=parseInt(c[0]);o<=parseInt(c[c.length-1]);o++)o=parseInt(o),o>=i&&(a=s._filterColl[e][o],a.status.indexOf("filtered")>-1&&(l=n.inArray(this._generateHeaderText(o+1),s._filteredColumns),l>-1&&s._filteredColumns.splice(l,1),v=n.inArray(this._generateHeaderText(o-r+1),s._filteredColumns),v<0&&s._filteredColumns.push(this._generateHeaderText(o-r+1))),o-r>=0&&(s._filterColl[e][o-r]=n.extend(!0,{},s._filterColl[e][o])),delete s._filterColl[e][o])},_refreshDataContainer:function(i,u){var p,dt,w,gt,st,ht,e,s,v,ni,ot=0,ui=0,fi,lt,k,d,si,hi,ci=0,li=0,o=this._dataContainer.sheets[i],ei,wt,ai,h,l,a,ct,g,nt,rt,at=this.model.scrollSettings.allowVirtualScrolling,c=this.getSheet(i),bt=c.usedRange,ut=this.getFrozenRows(),ft=this.getFrozenColumns(),it,ti,ii,ri,f,b,pt,oi,tt,kt,et,vt,y,yt;for(lt=parseInt(this.getObjectKeys(o)[this.getObjectLength(o)-1]),y=c.rowsHeightCollection,vt=c.columnsWidthCollection,f=0;f<=lt;f++)t.isNullOrUndefined(o[f])||(fi=this.getObjectKeys(o[f]),ui=parseInt(fi[fi.length-1]),ui>ot&&(ot=ui));if(ai=u.startCol<=ot?u.colCount+u.startCol:ot-1,ei=u.status.indexOf("shift")>-1?ai:ot-1,wt=u.status.indexOf("shift")>-1?u.rowCount+u.startRow:lt,p=u.startRow,dt=u.startRow+u.rowCount-1,w=u.startCol,gt=u.startCol+u.colCount-1,this._isFrozen(ut-1)&&ut>p){for(f=c._frozenRows-1;f<c._ftopRowIdx;f++)ci+=c.rowsHeightCollection[f];this._scrollContent({y:-ci})}if(this._isFrozen(ft-1)&&ft>w){for(f=c._frozenColumns-1;f<c._fleftColIdx;f++)li+=c.columnsWidthCollection[f];this._scrollContent({x:-li})}switch(u.status){case"insertRow":for(f=lt,v=u.startRow;f>=v;f--){if(!t.isNullOrUndefined(o[f])){if(o[f+u.rowCount]=n.extend(!0,{},o[f]),!t.isNullOrUndefined(o[f+u.rowCount]))for(a=this.getObjectKeys(o[f+u.rowCount]),e=0,ni=a.length;e<ni;e++)this._clearFormula(f,a[e]),this._checkIndicesInContainer(i,f,a[e],"wrap")&&(this._wrapCollection(f+u.rowCount,a[e],c._wrapColl[f][a[e]],i),delete c._wrapColl[f][a[e]]),f>=p&&f<=dt?(st=this._checkIndicesInContainer(i,p,a[e],"rule")?this._dataContainer.sheets[i][p][a[e]].rule:r,ht=this._checkIndicesInContainer(i,p,a[e],"cFormatRule")?this._dataContainer.sheets[i][p][a[e]].cFormatRule:r,this._refreshValAndCF(f,a[e],st,ht,u.rowCount,0,u.status),at||p<1||this.addClass(this.getCell(f,a[e])[0],this.XLFormat.getFormatClass(this.getCell(p-1,a[e])[0].className,!1))):delete o[f][a[e]],this._refreshFormula(f+u.rowCount,parseInt(a[e]),u.rowCount,"insert","row",u.startRow,!1),this.XLEdit._refreshCalcEngine(f+u.rowCount,parseInt(a[e]));this.getObjectLength(o[f])<1&&delete o[f]}y[f+u.rowCount]=y[f];y[f]=this.model.rowHeight;c._rowIdxColl[f+u.rowCount]=c._rowIdxColl[f]+u.rowCount}if(this._refreshHideRowColCollection(c.hideRowsCollection,u.startRow,u.rowCount,"row","insert"),this._refreshFilterColl(i,u.startRow,u.rowCount,"row","insert"),this._isUndo&&this._delCells.length>0){for(h=this._delCells,ct=h[h.length-1].row-h[0].row,f=0,v=h.length;f<v;f++){for(o[h[f].row]=h[f].value,a=this.getObjectKeys(o[h[f].row]),e=0,ni=a.length;e<ni;e++)this._refreshFormula(h[f].row,parseInt(a[e]),ct,"insert","row","",!1),this.XLEdit._refreshCalcEngine(h[f].row,parseInt(a[e])),this._checkIndicesInContainer(i,h[f].row,a[e],"wrap")&&this._wrapCollection(h[f].row,a[e],this._delWrapColl[h[f].row][a[e]],i);y[h[f].row]=h[f].height}this._delWrapColl={}}this.model.allowFreezing&&this._isFrozen(ut)&&(p<ut||this._isUndo&&this._fRow.fRowCnt>0)&&(k=c.frozenRows+(this._fRow.fRowCnt>0?this._fRow.fRowCnt:u.rowCount),d=c.frozenColumns,this._fRow.fRowCnt=0,this._fRow.rowAdj||(k-=1,this._fRow.rowAdj=!this._fRow.rowAdj),this._isFrozen(ft)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(k,d)):this.XLFreeze.freezeRows(k));this.XLScroll._getRowHeights(i,u.startRow);break;case"insertColumn":for(ti=!1,f=0;f<=wt;f++)for(e=ot,v=u.startCol;e>=v;e--)g=nt=null,f==0&&(t.isNullOrUndefined(o[0])||t.isNullOrUndefined(o[0][e])||"isCHide"in o[0][e]&&(this._deleteRule(e,i),ti=!0)),t.isNullOrUndefined(o[f])||(t.isNullOrUndefined(o[f][e])||(t.isNullOrUndefined(o[f][e+u.colCount])||(t.isNullOrUndefined(o[f][e+u.colCount].picture)||(g=o[f][e+u.colCount].picture),t.isNullOrUndefined(o[f][e+u.colCount].chart)||(nt=o[f][e+u.colCount].chart)),o[f][e+u.colCount]=o[f][e],t.isNullOrUndefined(o[f][e].picture)&&t.isNullOrUndefined(o[f][e].chart)||(t.isNullOrUndefined(o[f][e].picture)||(g=o[f][e].picture),t.isNullOrUndefined(o[f][e].chart)||(nt=o[f][e].chart)),t.isNullOrUndefined(o[f][e+u.colCount])||(t.isNullOrUndefined(g)||(o[f][e+u.colCount].picture=g),t.isNullOrUndefined(nt)||(o[f][e+u.colCount].chart=nt)),o[f][e].wrap&&(this._wrapCollection(f,e+u.colCount,c._wrapColl[f][e],i),delete c._wrapColl[f][e])),this._clearFormula(f,e),e>=w&&e<=gt?(st=this._checkIndicesInContainer(i,f,w,"rule")?this._dataContainer.sheets[i][f][w].rule:r,ht=this._checkIndicesInContainer(i,f,w,"cFormatRule")?this._dataContainer.sheets[i][f][w].cFormatRule:r,this._refreshValAndCF(f,e,st,ht,0,u.colCount,u.status),at||!w<1&&this.addClass(this.getCell(f,e)[0],this.XLFormat.getFormatClass(this.getCell(f,w-1)[0].className,!1))):delete o[f][e],!t.isNullOrUndefined(o[f][e])||t.isNullOrUndefined(g)&&t.isNullOrUndefined(nt)||(o[f][e]={}),t.isNullOrUndefined(g)||(o[f][e].picture=g),t.isNullOrUndefined(nt)||(o[f][e].chart=nt),this._refreshFormula(f,e+u.colCount,u.colCount,"insert","column",u.startCol,!1),this.XLEdit._refreshCalcEngine(f,e+u.colCount)),f===0&&(ti&&(this._writeRule(e+u.colCount,i),ti=!1),at&&!this._isUndoRedo&&(vt[e+u.colCount]=vt[e],vt[e]=c.columnWidth));if(this._refreshHideRowColCollection(c.hideColsCollection,u.startCol,u.colCount,"column","insert"),this._refreshFilterColl(i,u.startCol,u.colCount,"column","insert"),this.model.allowFreezing&&this._isFrozen(ft)&&(w<ft||this._isUndo&&this._fCol.fColCnt>0)&&(k=c.frozenRows,d=c.frozenColumns+(this._fCol.fColCnt>0?this._fCol.fColCnt:u.colCount),this._fCol.fColCnt=0,this._fCol.colAdj||(d-=1,this._fCol.colAdj=!this._fCol.colAdj),this._isFrozen(ut)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(k,d)):this.XLFreeze.freezeColumns(d)),this._isUndo&&this._delCells.length>0)for(h=this._delCells,ct=h[h.length-1].col-h[0].col,s=0,v=h.length;s<v;s++)t.isNullOrUndefined(o[h[s].row])&&(o[h[s].row]={}),o[h[s].row][h[s].col]=h[s].value,this._refreshFormula(h[s].row,h[s].col,ct,"insert","column","",!1),this.XLEdit._refreshCalcEngine(h[s].row,h[s].col),h[s].value.wrap&&this._wrapCollection(h[s].row,h[s].col,h[s].height,i);break;case"deleteRow":for(this._delCells=[],l=[],f=u.startRow;f<=lt;f++){if(f<u.startRow+u.rowCount){if(this._delCells.push({row:f,value:n.extend(!0,{},o[f]),height:y[f]}),!t.isNullOrUndefined(o[f]))for(a=this.getObjectKeys(o[f]),e=0,v=a.length;e<v;e++)this._clearFormula(f,a[e]),this._checkIndicesInContainer(i,f,a[e],"wrap")&&(this._delWrapColl[f]||(this._delWrapColl[f]={}),this._delWrapColl[f][a[e]]=n.extend(!0,{},c._wrapColl[f][a[e]]),delete c._wrapColl[f][a[e]]),o[f][a[e]]={};o[f]={};l.push({row:f})}if(!t.isNullOrUndefined(o[f+u.rowCount])){for(o[f]=n.extend(!0,{},o[f+u.rowCount]),a=this.getObjectKeys(o[f]),e=0,v=a.length;e<v;e++)this._checkIndicesInContainer(i,f+u.rowCount,a[e],"wrap")&&(this._wrapCollection(f,a[e],c._wrapColl[f+u.rowCount][a[e]],i),delete c._wrapColl[f+u.rowCount][a[e]]),this._clearFormula(f+u.rowCount,a[e]),o[f+u.rowCount][a[e]]={},this._refreshFormula(f,parseInt(a[e]),u.rowCount,"delete","row",u.startRow,!1);o[f+u.rowCount]={};l.push({row:f+u.rowCount})}y[f]=y[f+u.rowCount];y[f+u.rowCount]=this.model.rowHeight;c._rowIdxColl[f]=c._rowIdxColl[f+u.rowCount]-u.rowCount}for(this._refreshHideRowColCollection(c.hideRowsCollection,u.startRow,u.rowCount,"row","delete"),s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row])===0&&(this._clearFormula(l[s].row,l[s].col),delete o[l[s].row]);if(this._refreshFilterColl(i,u.startRow,u.rowCount,"row","delete"),this.XLScroll._getRowHeights(i,u.startRow),this.model.allowFreezing&&this._isFrozen(ut)&&p<ut){if(dt>=ut)for(f=p;f<ut;f++)this._fRow.fRowCnt++;else this._fRow.fRowCnt=0;k=c.frozenRows-(this._fRow.fRowCnt>0?this._fRow.fRowCnt:u.rowCount);si=c.frozenRows-(this._fRow.fRowCnt>0?this._fRow.fRowCnt:u.rowCount)-c._topRow.idx;d=c.frozenColumns;this._fRow.rowAdj=si>1;this._isFrozen(ft)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(this._fRow.rowAdj?k:k+1,d)):this.XLFreeze.freezeRows(this._fRow.rowAdj?k:1)}break;case"deleteColumn":for(this._delCells=[],l=[],ii=!1,ri=n.extend(!0,{},o[0]),f=0;f<=wt;f++){for(e=u.startCol;e<=ot;e++)g=nt=null,f==0&&(t.isNullOrUndefined(ri)||t.isNullOrUndefined(ri[e])||"isCHide"in ri[e]&&(this._deleteRule(e,i),ii=!0)),e<u.startCol+u.colCount&&(t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e])||(this._delCells.push({row:f,col:e,value:n.extend(!0,{},o[f][e],o[f][e].wrap?c._wrapColl[f][e]:y[f])}),this._clearFormula(f,e),o[f][e]={},t.isNullOrUndefined(this._delCells[this._delCells.length-1])||(rt=this._delCells.length-1,t.isNullOrUndefined(this._delCells[rt].value.picture)||(o[f][e].picture=this._delCells[rt].value.picture),t.isNullOrUndefined(this._delCells[rt].value.chart)||(o[f][e].chart=this._delCells[rt].value.chart)),l.push({row:f,col:e}),c._wrapColl[f]&&delete c._wrapColl[f][e])),t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e+u.colCount])||(o[f][e]=n.extend(!0,{},o[f][e+u.colCount]),o[f][e+u.colCount].wrap&&(this._wrapCollection(f,e,c._wrapColl[f][e+u.colCount],i),delete c._wrapColl[f][e+u.colCount]),t.isNullOrUndefined(o[f][e+u.colCount].picture)||(g=o[f][e+u.colCount].picture),t.isNullOrUndefined(o[f][e+u.colCount].chart)||(nt=o[f][e+u.colCount].chart),this._clearFormula(f,e+u.colCount),o[f][e+u.colCount]={},t.isNullOrUndefined(g)||(o[f][e+u.colCount].picture=g),t.isNullOrUndefined(nt)||(o[f][e+u.colCount].chart=nt),t.isNullOrUndefined(this._delCells[this._delCells.length-1])||(rt=this._delCells.length-1,t.isNullOrUndefined(this._delCells[rt].value.picture)||(o[f][e].picture=this._delCells[rt].value.picture),t.isNullOrUndefined(this._delCells[rt].value.chart)||(o[f][e].chart=this._delCells[rt].value.chart)),l.push({row:f,col:e+u.colCount}),this._refreshFormula(f,e,u.colCount,"delete","column",u.startCol,!1),at||this.XLComment&&this.XLComment._updateCmntFrmCntnr(f,e)),f==0&&ii&&(this._writeRule(e-u.colCount,i),ii=!1);for(s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row][l[s].col])===0&&(this._clearFormula(l[s].row,l[s].col),delete o[l[s].row][l[s].col]);l=[]}if(this._refreshHideRowColCollection(c.hideColsCollection,u.startCol,u.colCount,"column","delete"),this.model.allowFreezing&&this._isFrozen(ft)&&w<ft){if(gt>=ft)for(f=w;f<ft;f++)this._fCol.fColCnt++;else this._fCol.fColCnt=0;k=c.frozenRows;d=c.frozenColumns-(this._fCol.fColCnt>0?this._fCol.fColCnt:u.colCount);hi=c.frozenColumns-(this._fCol.fColCnt>0?this._fCol.fColCnt:u.colCount)-c._leftCol.idx;this._fCol.colAdj=hi>1;this._isFrozen(ut)?(this.XLFreeze.unfreezePanes(),this.XLFreeze.freezePanes(k,this._fCol.colAdj?d:d+1)):this.XLFreeze.freezeColumns(this._fCol.colAdj?d:1)}this._refreshFilterColl(i,u.startCol,u.colCount,"column","delete");break;case"shiftRight":for(f=u.startRow;f<wt;f++)for(e=ot,v=u.startCol;e>=v;e--)t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e])||(o[f][e+u.colCount]=n.extend(!0,{},o[f][e]),o[f][e].wrap&&(this._wrapCollection(f,e+u.colCount,c._wrapColl[f][e],i),delete c._wrapColl[f][e]),this._clearFormula(f,e),e>=w&&e<=gt?(this._checkIndicesInContainer(i,f,w,"rule")&&(st=this._dataContainer.sheets[i][f][w].rule),this._checkIndicesInContainer(i,f,w,"cFormatRule")&&(ht=this._dataContainer.sheets[i][f][w].cFormatRule),this._refreshValAndCF(f,e,st,ht,0,u.colCount,u.status),w<1||this.addClass(this.getCell(f,e)[0],this.XLFormat.getFormatClass(this.getCell(f,w-1)[0].className,!1))):delete o[f][e],this._refreshFormula(f,e+u.colCount,u.colCount,"insert","column",u.startCol,!0),this.XLEdit._refreshCalcEngine(f,e+u.colCount),this.XLEdit._refreshCalcEngine(f,e));if(this._isUndo&&this._delCells.length>0)for(h=this._delCells,ct=h[h.length-1].col-h[0].col,s=0,v=h.length;s<v;s++)o[h[s].row][h[s].col]=h[s].value,this._refreshFormula(h[s].row,h[s].col,ct,"insert","column",u.startRow,!1),this.XLEdit._refreshCalcEngine(h[s].row,h[s].col),at||this.XLComment&&this.XLComment._updateCmntFrmCntnr(h[s].row,h[s].col),h[s].value.wrap&&this._wrapCollection(h[s].row,h[s].col,h[s].height,i);break;case"shiftLeft":for(this._delCells=[],l=[],f=u.startRow;f<wt;f++){for(e=u.startCol;e<=ot;e++)e<u.startCol+u.colCount&&!t.isNullOrUndefined(o[f])&&(t.isNullOrUndefined(o[f][e])||(this._delCells.push({row:f,col:e,value:n.extend(!0,{},o[f][e]),height:o[f][e].wrap?c._wrapColl[f][e]:y[f]}),this._clearFormula(f,e),o[f][e].wrap&&delete c._wrapColl[f][e],o[f][e]={},l.push({row:f,col:e}))),t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e+u.colCount])||(o[f][e]=n.extend(!0,{},o[f][e+u.colCount]),o[f][e+u.colCount].wrap&&(this._wrapCollection(f,e,c._wrapColl[f][e+u.colCount],i),delete c._wrapColl[f][e+u.colCount]),tt=this.getCell(f+u.rowCount,e),it=this.getCell(f,e),tt&&(currText=tt[0].outerHTML,this.clearTextNode(tt)),it&&(remText=it[0].outerHTML,this.clearTextNode(it,this.XLEdit.getPropertyValue(f,e,"value2"))),l.push({row:f,col:e+u.colCount}),this._clearFormula(f,e+u.colCount),o[f][e+u.colCount]={},this._refreshFormula(f,e,u.colCount,"delete","column",u.startCol,!0),tt&&(tt[0].outerHTML=currText),it&&(it[0].outerHTML=remText)),this.XLEdit._refreshCalcEngine(f,e);for(s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row][l[s].col])===0&&(this._clearFormula(l[s].row,l[s].col),this.XLEdit._refreshCalcEngine(l[s].row,l[s].col),delete o[l[s].row][l[s].col]);l=[]}break;case"shiftBottom":for(vt=this.getSheet(i).columnsWidthCollection,y=this.getSheet(i).rowsHeightCollection,f=lt,v=u.startRow;f>=v;f--){for(et=this._checkIndicesInContainer(i,f,0,"wrapRow"),e=u.startCol;e<ei;e++)t.isNullOrUndefined(o[f])||t.isNullOrUndefined(o[f][e])||(t.isNullOrUndefined(o[f+u.rowCount])&&(o[f+u.rowCount]={}),et&&(yt=c._wrapColl[f][e],y[f+u.rowCount]=t.max([yt,y[f+u.rowCount]]),this._checkIndicesInContainer(i,f+u.rowCount,0,"wrapRow")||this.XLEdit._updateDataContainer({rowIndex:f+u.rowCount,colIndex:0},{dataObj:{wrapRow:!0}}),this._wrapCollection(f+u.rowCount,e,yt,i)),o[f+u.rowCount][e]=n.extend(!0,{},o[f][e]),this._clearFormula(f,e),f>=p&&f<=dt?(this._checkIndicesInContainer(i,p,e,"rule")&&(st=this._dataContainer.sheets[i][p][e].rule),this._checkIndicesInContainer(i,p,e,"cFormatRule")&&(ht=this._dataContainer.sheets[i][p][e].cFormatRule),this._refreshValAndCF(f,e,st,ht,u.rowCount,0,u.status),at||p<1||this.addClass(this.getCell(f,e)[0],this.XLFormat.getFormatClass(this.getCell(p-1,e)[0].className,!1))):delete o[f][e],et&&delete c._wrapColl[f][e],this._refreshFormula(f+u.rowCount,e,u.rowCount,"insert","row",u.startRow,!0)),this.XLEdit._refreshCalcEngine(f,e),this.XLEdit._refreshCalcEngine(f+u.rowCount,e);et&&(y[f]=t.max(this._getObjectValues(c._wrapColl[f])),y[f]||(y[f]=this.model.rowHeight),this.getObjectLength(c._wrapColl[f])||delete this._dataContainer.sheets[i][f][0].wrapRow);t.isNullOrUndefined(o[f])||this.getObjectLength(o[f])===0&&delete o[f]}if(this._isUndo&&this._delCells.length>0)for(h=this._delCells,ct=h[h.length-1].row-h[0].row,f=0,v=h.length;f<v;f++)b=h[f].row,pt=h[f].col,t.isNullOrUndefined(o[b])&&(o[b]={}),o[b][pt]=h[f].value,this._refreshFormula(b,pt,ct,"insert","row",u.startRow,!0),this.XLEdit._refreshCalcEngine(b,pt),et=this._checkIndicesInContainer(i,b,0,"wrapRow"),oi=h[f].value.wrap,(et||oi)&&(yt=oi?h[f].height:this.model.rowHeight,y[b]=t.max([yt,y[b]]),this._checkIndicesInContainer(i,b,0,"wrapRow")||this.XLEdit._updateDataContainer({rowIndex:b,colIndex:0},{dataObj:{wrapRow:!0}}),this._wrapCollection(b,pt,yt,i)),at||this.XLComment&&this.XLComment._updateCmntFrmCntnr(b,pt);break;case"shiftUp":for(l=[],vt=this.getSheet(i).columnsWidthCollection,y=this.getSheet(i).rowsHeightCollection,f=u.startRow;f<=lt;f++){for(kt=this._checkIndicesInContainer(i,f,0,"wrapRow"),et=this._checkIndicesInContainer(i,f+u.rowCount,0,"wrapRow"),e=u.startCol;e<ei;e++)f<u.startRow+u.rowCount&&!t.isNullOrUndefined(o[f])&&(t.isNullOrUndefined(o[f][e])||(this._delCells.push({row:f,col:e,value:n.extend(!0,{},o[f][e]),height:kt?c._wrapColl[f][e]:y[f]}),this._clearFormula(f,e),o[f][e]={},l.push({row:f,col:e}),kt&&delete c._wrapColl[f][e])),t.isNullOrUndefined(o[f+u.rowCount])?y[f+u.rowCount]=this.model.rowHeight:t.isNullOrUndefined(o[f+u.rowCount][e])||(t.isNullOrUndefined(o[f])&&(o[f]={}),o[f][e]=n.extend(!0,{},o[f+u.rowCount][e]),et&&(this._wrapCollection(f,e,c._wrapColl[f+u.rowCount][e],i),delete c._wrapColl[f+u.rowCount][e]),tt=this.getCell(f+u.rowCount,e),it=this.getCell(f,e),tt&&(currText=tt[0].outerHTML,this.clearTextNode(tt)),it&&(remText=it[0].outerHTML,this.clearTextNode(it,this.XLEdit.getPropertyValue(f,e,"value2"))),this._clearFormula(f+u.rowCount,e),o[f+u.rowCount][e]={},l.push({row:f+u.rowCount,col:e}),this._refreshFormula(f,e,u.rowCount,"delete","row",u.startRow,!0),tt&&(tt[0].outerHTML=currText),it&&(it[0].outerHTML=remText)),this.XLEdit._refreshCalcEngine(f,e);kt&&this.getObjectLength(c._wrapColl[f])<1&&delete this._dataContainer.sheets[i][f][0].wrapRow;et&&(this.XLEdit._updateDataContainer({rowIndex:f,colIndex:0},{dataObj:{wrapRow:!0}}),y[f+u.rowCount]=t.max(this._getObjectValues(c._wrapColl[f+u.rowCount])),y[f+u.rowCount]||(y[f+u.rowCount]=this.model.rowHeight),this.getObjectLength(c._wrapColl[f+u.rowCount])||delete this._dataContainer.sheets[i][f+u.rowCount][0].wrapRow);(kt||et)&&(y[f]=t.max(this._getObjectValues(c._wrapColl[f])),y[f]||(y[f]=this.model.rowHeight))}for(s=0,v=l.length;s<v;s++)this.getObjectLength(o[l[s].row][l[s].col])===0&&(this._clearFormula(l[s].row,l[s].col),delete o[l[s].row][l[s].col]),this.getObjectLength(o[l[s].row])===0&&delete o[l[s].row]}u.status.indexOf("insert")>-1&&(bt.rowIndex=bt.rowIndex+u.rowCount,bt.colIndex=bt.colIndex+u.colCount,this.getSheet(i).usedRange=bt)},_undoInsDelMerge:function(){if(this._isUndo){this._dupDetails=!0;for(var n=0,t=this._removeMergeColl.length;n<t;n++)this.mergeCenter=this._removeMergeColl[n].merge.isCenterAlign,this.mergeCells(this._removeMergeColl[n].merge.mRange,!0);this._dupDetails=!1}},_updateCommentColl:function(n){this.getSheet(n)._commentColl={};this._isInsdel=!0;this.XLComment._updateCmntArrowPos();this._isInsdel=!1},insertShiftRight:function(n,t){if(this.model.allowInsert&&!this.model.isReadOnly){var r,f=!1,u=this.getActiveSheetIndex(),i;this._isUndo?(r="shiftLeft",this._insDelStatus="delete"):(r="shiftRight",this._insDelStatus="insert");i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:r};this.model.allowFiltering&&this.XLFilter._checkFilterApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._checkTableApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._isFilterApplied||this._isTableApplied?this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630):(f=this._clearAllMergeCells(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r),f.isAlert?this._insertShiftRight(u,n,t,i):(this._insData={sheetIdx:u,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge())}},_insertShiftRight:function(t,i,r,u){var c=r.colIndex-i.colIndex+1,l=this.getRows(t)[1],a=this._getJSSheetHeader(t).find("col"),v=this._getContent(t).find("col"),o,s,e,f,h;if(this._isUndo){for(s=i.rowIndex;s<=r.rowIndex;s++)for(iTd=n(l[this._getRowIdx(s)]).find("td"),o=iTd.length-1,e=i.colIndex;e<=o-c;e++)iTd[e].outerHTML=iTd[e+c].outerHTML;for(f=o;f>o-c;f--)for(a.eq(f).remove(),v.eq(f).remove(),h=0;h<l.length;h++)n(l[this._getRowIdx(h)]).find("td:eq("+f+")").remove()}else this.XLScroll._createNewColumn(t,i,r,"shift");this.performSelection(i,r);this._refreshDataContainer(t,u);this._isUndo?this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"delete"):this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"insert");this.model.allowComments&&this._updateCommentColl(t);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._isUndoRedo||this._undoredoDetails(t,i,r,"insert","insertShiftRight");this._refreshRows(t)},insertShiftBottom:function(n,t){if(this.model.allowInsert&&!this.model.isReadOnly){var f=!1,r=this.getActiveSheetIndex(),u,i;if(u=this._isUndo?"shiftUp":"shiftBottom",i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:u},this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._checkTableApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._isFilterApplied||this._isTableApplied)if(this._isTotalRow)if(this._isUndoRedo)this._isUndoRedo=this._dupDetails=!0,this.deleteEntireRow(this._insRows.startRow,this._insRows.endRow),this.XLFormat._calculateTotalRow(r,null,!0,!1),this._isUndoRedo=!1;else return this._showAlertDlg("","TotalRowAlert","TotalRow",630),!0;else this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630);else f=this._clearAllMergeCells(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),f.isAlert?this._insertShiftBottom(r,n,t,i):(this._insData={sheetIdx:r,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge()}},_insertShiftBottom:function(t,i,r,u){var w=this.model.scrollSettings.allowVirtualScrolling,f,e,c,a;if(this._refreshDataContainer(t,u),w)this._refreshViewport(this.getSheet(t)._scrollTop,t);else{var h,s,l,v=this.getSheet(t).rowsHeightCollection,p=this.getRows(t),o=p[1],y=p[0];if(this._isUndo){for(o=this._getContent(t).find("tbody").get(0).rows,f=i.rowIndex,a=o.length;f<a;f++){if(h=f+(r.rowIndex-i.rowIndex+1),l=n(o[f]).find("td"),h<o.length)for(s=n(o[h]).find("td"),e=i.colIndex;e<=r.colIndex;e++)l[e].outerHTML=s[e].outerHTML,s[e].innerHTML="";o[f].style.height=v[f]+"px";y[f].style.height=v[f]+"px"}for(e=i.colIndex;e<=r.colIndex;e++)for(c=a-1,length=a-1-(r.rowIndex-i.rowIndex+1);c>length;c--)n(o[c]).remove(),n(y[c]).remove(),this.model.sheets[t].rowCount=this.model.sheets[t].rowCount-1;this.XLScroll._refreshScroller(1,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"all")}else{for(f=i.rowIndex;f<=r.rowIndex;f++)this.XLScroll._createNewRow(t,-1,-1,"insert");for(f=o.length-1;f>=i.rowIndex;f--){if(h=f-(r.rowIndex-i.rowIndex+1),l=n(o[f]).find("td"),h>=i.rowIndex)for(s=n(o[h]).find("td"),e=i.colIndex;e<=r.colIndex;e++)l[e].outerHTML=s[e].outerHTML,s[e].innerHTML="",l[e].className=s[e].className,s[e].className="e-rowcell e-wrapword";o[f].style.height=v[f]+"px";y[f].style.height=v[f]+"px"}}this._refreshRows(t)}this.XLScroll._getRowHeights(t,i.rowIndex);this.performSelection(i,r);this.model.allowComments&&this._updateCommentColl(t);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._isUndo?this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"delete"):this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"insert");this._isUndoRedo||this._dupDetails||this._undoredoDetails(t,i,r,"insert","insertShiftBottom")},insertEntireRow:function(t,i){var h,v,c,l;if(this.model.allowInsert&&!this.model.isReadOnly){var y=this.model.scrollSettings.allowVirtualScrolling,u,a,o,e,r=this.getActiveSheetIndex(),f=this.getSheet(r),k=f.rowsHeightCollection,p=f._isRowSelected,s=f._selectedCells,w=s[0].colIndex,b=s[s.length-1].colIndex;if(this._isUndo?(o="deleteRow",this._insDelStatus="delete"):(o="insertRow",this._insDelStatus="insert"),e={startCol:0,colCount:f.colCount,startRow:t,rowCount:i-t+1,status:o},this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,t,e.rowCount,0,f.colCount,o)){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(r,t,e.rowCount,-1,0,o),this._refreshDataContainer(r,e),y)this.model.allowFiltering&&this.XLFilter._updateFilterCollection(r,t,i-t,"row",this._insDelStatus),this._refreshViewport(this._isFrozen(f.frozenRows)?this._getContent(r).find(".e-content").scrollTop():f._scrollTop,r);else{if(this._isUndo){for(h=this.getRows(r),v=h[1],c=h[0],u=i;u>=t;u--)n(v[u]).remove(),n(c[u]).remove(),f.rowCount=f.rowCount-1;for(l=c.find("td"),u=0,a=l.length;u<a;u++)n(l[u]).text(u+1)}else for(u=t;u<=i;u++)this.XLScroll._createNewRow(r,u,0,"insert");this.model.allowFiltering&&this.XLFilter._updateFilterCollection(r,t,i-t,"row",this._insDelStatus);this.XLScroll._getRowHeights(r,t);this._refreshRows(r)}this._isFrozen(f.frozenRows)&&(t<f._frozenRows||i<f._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv();this._isUndo?(this._refreshAllMergeCells(r,t,e.rowCount,-1,0,"delete"),this._batchDeleteRow(t,i,r,!0)):(this._refreshAllMergeCells(r,t,e.rowCount,-1,0,"insert"),this._batchAddRow(t,i,r));p?this.XLSelection.selectRows(t,i):this.performSelection({rowIndex:t,colIndex:w},{rowIndex:i,colIndex:b});this.model.allowComments&&this._updateCommentColl(r);this._isUndoRedo||this._dupDetails||this._undoredoDetails(r,{rowIndex:t,colIndex:0},{rowIndex:i,colIndex:f.colCount-1},"insert","insertRow")}},insertEntireColumn:function(n,t){if(this.model.allowInsert&&!this.model.isReadOnly){var h=this.model.scrollSettings.allowVirtualScrolling,f,i=this.getActiveSheetIndex(),u,r=this.getSheet(i),l=r._isColSelected,e,o,s=r._selectedCells,a=s[0].rowIndex,v=s[s.length-1].rowIndex,c=r.columnsWidthCollection;if(this._isUndo?(this._insDelStatus="delete",f="deleteColumn"):(f="insertColumn",this._insDelStatus="insert"),!r._isTemplate||!(n<r._templateColCount||t<r._templateColCount)){if(u={startCol:n,colCount:t-n+1,startRow:0,rowCount:r.rowCount,status:f},this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(i,u.startRow,r.rowCount,n,u.colCount,f)){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(i,-1,0,n,u.colCount,f),f==="deleteColumn"&&h)for(j=t;j>=n;j--)c.splice(j,1),c.push(r.columnWidth);this._refreshDataContainer(i,u);e={rowIndex:a,colIndex:n};o={rowIndex:v,colIndex:t};h?this.refreshContent(i):this.XLScroll._createNewColumn(i,e,o,"insert");this._isUndo?this._refreshAllMergeCells(i,-1,0,n,u.colCount,"delete"):this._refreshAllMergeCells(i,-1,0,n,u.colCount,"insert");this.model.allowFiltering&&this.XLFilter._updateFilterCollection(i,n,t-n,"column",this._insDelStatus);this._isFrozen(r.frozenColumns)&&(n<r._frozenColumns||t<r._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv();this._isUndoRedo||this._undoredoDetails(i,e,o,"insert","insertColumn");this.model.allowComments&&this._updateCommentColl(i);l?this.XLSelection.selectColumns(n,t):this.performSelection(e,o);this._refreshRows(i);this._isAutoWHMode&&this._autoSSWidthHeight(i)}}},deleteShiftLeft:function(n,t){if(this.model.allowDelete&&!this.model.isReadOnly){var f=!1,u=this.getActiveSheetIndex(),r,i;this._isUndo?(this._insDelStatus="insert",r="shiftRight"):(this._insDelStatus="delete",r="shiftLeft");i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:r};this.model.allowFiltering&&this.XLFilter._checkFilterApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._checkTableApplied(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r);this._isFilterApplied||this._isTableApplied?this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630):(f=this._clearAllMergeCells(u,n.rowIndex,i.rowCount,n.colIndex,i.colCount,r),f.isAlert?f.isCancel||this._deleteShiftLeft(u,n,t,i):(this._insData={sheetIdx:u,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge())}},_deleteShiftLeft:function(t,i,r,u){var o,s,f,e,h,c=r.colIndex-i.colIndex+1,a=this.getRows(t)[1],l=[],v;if(this._isUndo)for(n.extend(!0,l,this._deletedText),o=i.rowIndex;o<=r.rowIndex;o++){for(h=this._getRowIdx(o),f=n(a[h]).find("td"),v=f.length-1,e=v-c;e>i.colIndex-1;e--)f[e+c].outerHTML=f[e].outerHTML;for(s=i.colIndex;s<=r.colIndex;s++)f[s].outerHTML=l.shift()}else for(this._insDelStatus="delete",o=i.rowIndex;o<=r.rowIndex;o++){for(h=this._getRowIdx(o),f=n(a[h]).find("td"),s=i.colIndex;s<=r.colIndex;s++)l.push(f[s].outerHTML);for(e=i.colIndex,length=f.length;e<length-c;e++)f[e].outerHTML=f[e+c].outerHTML}this.performSelection(i,r);this._refreshDataContainer(t,u);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._deletedText=l;this.model.allowComments&&this._updateCommentColl(t);this._isUndo?this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"insert"):this._refreshAllMergeCells(t,-1,0,i.colIndex,u.colCount,"delete");this._isUndoRedo||this._undoredoDetails(t,i,r,"delete","deleteShiftLeft");this._refreshRows(t)},deleteShiftUp:function(n,t){if(this.model.allowDelete&&!this.model.isReadOnly){var f=!1,r=this.getActiveSheetIndex(),u,i;if(u=this._isUndo?"shiftBottom":"shiftUp",i={startCol:n.colIndex,colCount:t.colIndex-n.colIndex+1,startRow:n.rowIndex,rowCount:t.rowIndex-n.rowIndex+1,status:u},this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._checkTableApplied(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),this._isFilterApplied||this._isTableApplied){if(this._isTotalRow)return;this._showAlertDlg("Alert","InsertDeleteAlert","InsertDeleteAlert",630)}else f=this._clearAllMergeCells(r,n.rowIndex,i.rowCount,n.colIndex,i.colCount,u),f.isAlert?f.isCancel||this._deleteShiftUp(r,n,t,i):(this._insData={sheetIdx:r,startCell:n,endCell:t,value:i},this._isUndoRedo?this._refreshMergeCells():this._showAlertDlg("Alert","MergeInsertAlert","MergeInsertDelete",498)),this._undoInsDelMerge()}},_deleteShiftUp:function(t,i,r,u){var b=this.model.scrollSettings.allowVirtualScrolling,f,e,y,a=[],c,s;if(this._refreshDataContainer(t,u),b)this._refreshViewport(this.getSheet(t)._scrollTop,t);else{var h,l,v=this.getSheet(t).rowsHeightCollection,p=this.getRows(t),o=p[1],w=p[0];if(!this._isUndo||this._isTotalRow)for(f=i.rowIndex,y=o.length;f<y;f++){if(c=f+(r.rowIndex-i.rowIndex+1),s=this._getRowIdx(f),h=n(o[s]).find("td"),c<o.length)for(l=n(o[this._getRowIdx(c)]).find("td"),e=i.colIndex;e<=r.colIndex;e++)a.push(h[e].outerHTML),h[e].outerHTML=l[e].outerHTML,l[e].innerHTML="";o[s].style.height=v[f]+"px";w[s].style.height=v[f]+"px"}else{for(n.extend(!0,a,this._deletedText),f=o.length-1;f>=i.rowIndex;f--){if(c=f-(r.rowIndex-i.rowIndex+1),s=this._getRowIdx(f),h=n(o[s]).find("td"),c>=i.rowIndex)for(l=n(o[this._getRowIdx(c)]).find("td"),e=i.colIndex;e<=r.colIndex;e++)h[e].outerHTML=l[e].outerHTML,l[e].innerHTML="";o[s].style.height=v[f]+"px";w[s].style.height=v[f]+"px"}for(f=i.rowIndex;f<=r.rowIndex;f++)for(h=n(o[this._getRowIdx(f)]).find("td"),e=i.colIndex;e<=r.colIndex;e++)h[e].outerHTML=a.shift()}this._refreshRows(t)}this.XLScroll._getRowHeights(t,i.rowIndex);this.performSelection(i,r);this.model.allowComments&&this._updateCommentColl(t);this.model.allowComments&&(this.XLComment._curCommentHCell=null);this._deletedText=a;this._isUndo?this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"insert"):this._refreshAllMergeCells(t,i.rowIndex,u.rowCount,-1,0,"delete");this._isUndoRedo||this._dupDetails||this._undoredoDetails(t,i,r,"delete","deleteShiftUp")},deleteEntireRow:function(t,i){if(this.model.allowDelete&&!this.model.isReadOnly){var k=this.model.scrollSettings.allowVirtualScrolling,u,v,s,r=this.getActiveSheetIndex(),f=this.getSheet(r),c=f._selectedCells,d=c[0].colIndex,g=c[c.length-1].colIndex;if(rowHeightColl=f.rowsHeightCollection,this._isUndo?(this._insDelStatus="insert",s="insertRow"):(s="deleteRow",this._insDelStatus="delete"),o={startCol:0,colCount:f.colCount,startRow:t,rowCount:i-t+1,status:s},!this._isUndoRedo&&(this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(r,t,o.rowCount,0,f.colCount,s))){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(r,t,o.rowCount,-1,0,s),this._refreshDataContainer(r,o),k)this._refreshViewport(this._isFrozen(f.frozenRows)?this._getContent(r).find(".e-content").scrollTop():this.getSheet(r)._scrollTop,r);else{var l,e,y,h=[],p,o,w=this.getRows(r),a=w[1],b=w[0];if(this._isUndo){for(n.extend(!0,h,this._deletedText),u=t;u<=i;u++)e=this._getRowIdx(u),p=h.pop(),n(a[e]).before(p),y=this.XLScroll._rowHeaderTemplate(1,rowHeightColl[u]),n(b[e]).before(y),f.rowCount=f.rowCount+1;this._refreshRows(r)}else for(u=i;u>=t;u--)e=this._getRowIdx(u),h.push(a[e].outerHTML),n(a[e]).remove(),n(b[e]).remove(),f.rowCount=f.rowCount-1,this.XLScroll._createNewRow(r,-1,-1,"insert");for(l=n(this.getRows(r)[0]).find("td"),u=0,v=l.length;u<v;u++)n(l[u]).text(u+1);this._refreshRows(r)}this._isFrozen(f.frozenRows)&&(t<f._frozenRows||i<f._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv();f._isRowSelected?this.XLSelection.selectRows(t,i):this.performSelection({rowIndex:t,colIndex:d},{rowIndex:i,colIndex:g});this._deletedText=h;this.model.allowComments&&this._updateCommentColl(r);this._isUndo?(this._refreshAllMergeCells(r,t,o.rowCount,-1,0,"insert"),this._batchAddRow(t,i,r,!0)):(this._refreshAllMergeCells(r,t,o.rowCount,-1,0,"delete"),this._batchDeleteRow(t,i,r));this.model.allowFiltering&&this.XLFilter._updateFilterCollection(r,t,i-t,"row",this._insDelStatus);this.XLScroll._getRowHeights(r,t);this._isUndoRedo||this._dupDetails||this._undoredoDetails(r,{rowIndex:t,colIndex:0},{rowIndex:i,colIndex:f.colCount-1},"delete","deleteRow")}},deleteEntireColumn:function(i,r){var h,g;if(this.model.allowDelete&&!this.model.isReadOnly){var u,f,p,w,tt=0,e=this.getActiveSheetIndex(),it=this.getFrozenColumns(),o=this.getSheet(e),a=this.getRows(e)[1],v=this._getContent(e).find("col"),b=this._getJSSheetHeader(e).find("col"),c=this._getJSSheetHeader(e).find("th"),nt=o._selectedCells,et=nt[0].rowIndex,ot=nt[nt.length-1].rowIndex,y,s=[],l,rt,k,ut=this.XLScroll._colGroupTemplate(1),d=o.columnsWidthCollection,ft=this.model.scrollSettings.allowVirtualScrolling,st=ft?this._getContent(e).find("tbody").get(1):this._getContent(e).find("tbody").get(0);if(this._isUndo?(y="insertColumn",this._insDelStatus="insert"):(y="deleteColumn",this._insDelStatus="delete"),!o._isTemplate||!(i<o._templateColCount||r<o._templateColCount)){if(l={startCol:i,colCount:r-i+1,startRow:0,rowCount:o.rowCount,status:y},!this._isUndoRedo&&(this.XLRibbon._isDirtySelect||this.model.allowFiltering&&this.XLFilter._checkFilterApplied(e,l.startRow,l.rowCount,0,o.colCount,y))){this._showAlertDlg("Alert","InsertDeleteAlert",440);return}if(this._clearAllMergeCells(e,-1,0,i,l.colCount,y),this._isUndo){for(s=n.extend(!0,s,this._deletedText),h=0,u=a.length-1;u>=0;u--){for(w=n(a[u]).find("td"),f=i;f<=r;f++)w.eq(f-h).before(s.pop()),h++;h=0}for(f=i;f<=r;f++)v.eq(f-h).before(s.pop()),c.eq(f-h).before("<th class='e-headercell'><div class='e-headercelldiv'><\/div><\/th>"),b.eq(f-h).before(s.pop()),h++;k=d.splice(0,i);t.merge(k,this._deletedDimension.reverse());t.merge(k,d);o.columnsWidthCollection=k;this._deletedDimension=[]}else{if(this._deletedDimension=[],this._isFrozen(it)&&it>=i){for(u=o._frozenColumns-1;u<o._fleftColIdx;u++)tt+=o.columnsWidthCollection[u];this._scrollContent({x:-tt})}for(f=r;f>=i;f--)s.push(b[f].outerHTML),s.push(v[f].outerHTML),this._deletedDimension.push(d.splice(f,1)[0]),b.eq(f).remove(),v.eq(f).remove(),b.parent().append(ut),v.parent().append(ut),d.push(o.columnWidth);for(u=0,p=a.length;u<p;u++)for(w=n(a[u]).find("td"),f=r;f>=i;f--)rt=this.XLScroll._columnTemplate(),n(a[u]).append(rt),s.push(w[f].outerHTML),n(st.rows[u]).find("td:eq("+f+")").remove()}for(this.XLScroll._getColWidths(e,i),this._isFrozen(o.frozenColumns)&&(i<o._frozenColumns||r<o._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv(),this.model.allowFiltering&&this.XLFilter._updateFilterCollection(e,i,r-i,"column",this._insDelStatus),o.colCount=v.length,c=this._getJSSheetHeader(e).find("th"),this._refreshDataContainer(e,l),u=0,p=c.length;u<p;u++)this._checkIndicesInContainer(e,0,u,"hCol")&&(g="e-hcol"),this._checkIndicesInContainer(e,0,u,"isCHide")&&(g+="e-hide"),this._removeClass(c[u],"e-hcol"),this._removeClass(c[u],"e-hide"),this.addClass(c[u],g),g="",n(c[u]).find("div").text(this._generateHeaderText(u+1));ft&&this.refreshContent(e);this._isUndo?this._refreshAllMergeCells(e,-1,0,i,l.colCount,"insert"):this._refreshAllMergeCells(e,-1,0,i,l.colCount,"delete");o._isColSelected?this.XLSelection.selectColumns(i,r):this.performSelection({rowIndex:et,colIndex:i},{rowIndex:ot,colIndex:r});this._deletedText=s;this.model.allowComments&&this._updateCommentColl(e);this._isUndoRedo||this._undoredoDetails(e,{rowIndex:0,colIndex:i},{rowIndex:o.rowCount-1,colIndex:r},"delete","deleteColumn");this._refreshRows(e)}}},_getSelectedRange:function(n,t){for(var r,e,o=[],u=this.swapRange([n.rowIndex,n.colIndex,t.rowIndex,t.colIndex]),i=u[0],f=u[2];i<=f;){for(r=u[1],e=u[3];r<=e;)o.push({rowIndex:i,colIndex:r}),r++;i++}return o},performSelection:function(n,t){var r=this.getActiveSheetIndex(),i,c=this.getSheet(r),u,f,e,o,s,h;this.getObjectLength(n)||(i=this._getRangeArgs(n,"object"),n={rowIndex:i[0],colIndex:i[1]},t={rowIndex:i[2],colIndex:i[3]});this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(r,"refresh","all");this.setActiveCell(n.rowIndex,n.colIndex);this.model.allowSelection&&(e=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge"),o=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"merge"),e&&(s=this.getRangeIndices(e.mRange),n={rowIndex:s[0],colIndex:s[1]}),o&&(h=this.getRangeIndices(o.mRange),t={rowIndex:h[2],colIndex:h[3]}),this.XLSelection.selectRange(n,t));this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();c._startCell=n;c._endCell=t;this.model.showRibbon&&this.XLRibbon._updateRibbonIcons();u=this.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"tableName",r);u&&(f=this._getTableID(u),this.isNumber(f)&&this.XLRibbon._designTabUpdate(f,n))},_checkRowCol:function(n,i){if(n!==0&&i!==0)return t.isNullOrUndefined(i)&&(i=n),{start:n,end:i}},hideRow:function(n,t){var i=this._checkRowCol(n,t);this._hideRow(i.start-1,i.end-1,"isRHide")},showRow:function(n,t){var i=this._checkRowCol(n,t);this._showRow(i.start,i.end,"isRHide")},hideColumn:function(n,t){var i=this._checkRowCol(n,t);this._hideColumn(i.start-1,i.end-1)},showColumn:function(n,t){var i=this._checkRowCol(n,t);this._showColumn(i.start,i.end)},_hideRow:function(n,i,r,u){var e=this.getActiveSheetIndex(),f=this.getSheet(e),a=this.getRows(e),y=a[1],p=a[0],h=this.model.scrollSettings,s=h.allowVirtualScrolling,v=f.hideRowsCollection,c=[],w=f.rowsHeightCollection,o,l;for(this._isUndoRedo||u||(this.XLEdit._updateDataContainer({rowIndex:n?n-1:n,colIndex:0},{dataObj:{hRow:!0}}),s||this.addClass(this._getJSSheetRowHeaderContent(e).find(".e-rowheader")[n?n-1:n],"e-hrow")),o=n;o<=i;o++)r==="isRHide"&&this.XLEdit._updateDataContainer({rowIndex:o,colIndex:0},{dataObj:{isRHide:!0}}),c.push(o),v.indexOf(o)===-1&&(v.push(o),s||(this._isRowViewable(e,o)&&(this.addClass(y[o],"e-r-hide"),this.addClass(p[o],"e-r-hide")),h.allowScrolling&&h.scrollMode===t.Spreadsheet.scrollMode.Infinite&&(!f._isImported||f._isLoaded)&&this.XLScroll._createNewRow(e,-1,-1,"insert")));this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(n,i,!0,!0);this._isFilter||this.XLScroll._getRowHeights(e,n);this._showHideRows(e,f,c,n,i,s,"hide");f._isImported&&!f._isLoaded||this._isFilter||this._isExport||(this.model.allowComments&&this.XLComment._updateCmntArrowPos(),this._isFrozen(f.frozenRows)&&(n<f._frozenRows||i<f._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv(),this.model.scrollSettings.allowScrolling&&!s&&this.XLScroll._refreshScroller(e,"refresh","vertical"),this._isUndoRedo||u||(f._activeCell.rowIndex=i+1,l={sheetIndex:e,reqType:"show-hide",action:"hide",operation:"row",bSelect:{startRow:n,endRow:i},aSelect:{startRow:i+1,endRow:i+1},addBRows:n?[n-1]:[n],remBRows:[],hideRows:c},this._completeAction(l),this._trigActionComplete(l)));u||(this.XLSelection.selectRow(i+1,e),this.model.allowAutoFill&&this.XLDragFill.hideAutoFillElement())},_showRow:function(i,r,u,f){var c,l,e=this.getActiveSheetIndex(),w=this._isUndoRedo?i:i-1>0?i-1:0,o=this.getSheet(e),b=this.getRows(e),k=b[1],a=b[0],v=[],d=[],it=o.rowsHeightCollection,g=o.hideRowsCollection,tt=n(this._getJSSheetHeader(e).find("colgroup")[0].outerHTML).attr("id","ss"),h=t.buildTag("table#wrapTable.e-table",{}),y=this._dataContainer.sheets[e],s=this.model.scrollSettings.allowVirtualScrolling,rt=o.columnsWidthCollection,nt=this.element.find(".e-spreadsheetcolumnheader"),p;for(s||(h.append(tt),this.element[0].insertBefore(h[0],this.element[0].childNodes[0])),this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(i,r,!0),j=w;j<=r;j++)c=g.indexOf(j),c>-1&&(u==="isRHide"&&delete y[j][0].isRHide,v.push(j),g.splice(c,1),s||(this._removeClass(k[j],"e-r-hide"),this._removeClass(a[j],"e-r-hide")),!this._isUndoRedo&&j>0&&!f?(d.push(j-1),delete y[j-1][0].hRow,s||this._removeClass(n(a[j-1]).find("td")[0],"e-hrow")):j!==0||f||(delete y[0][0].hRow,s||(nt.height(20.5),this._removeClass(nt[0],"e-hrow")))),s||(this._setWrapHeight(e,j,k,a,h,"visible"),h.remove()),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();this._isFilter||this.XLScroll._getRowHeights(e,w);this._showHideRows(e,o,v,i,r,s,"show");f||o._isImported&&!o._isLoaded||this._isUndoRedo||this._isFilter||(i<r?(this.setActiveCell(i,0),this.XLSelection.selectRows(i,r,e),l={startRow:i,endRow:r}):i>0&&(this.setActiveCell(i-1,0),this.XLSelection.selectRow(i-1,e),l={startRow:i-1,endRow:i-1}),this.XLDragFill.positionAutoFillElement(),p={sheetIndex:e,reqType:"show-hide",action:"show",operation:"row",bSelect:{startRow:i,endRow:r},aSelect:l,addBRows:[],remBRows:d,hideRows:v},this._completeAction(p),this._trigActionComplete(p));this._isFrozen(o.frozenRows)&&(i<o._frozenRows||r<o._frozenRows)&&this.XLFreeze._refreshFreezeRowDiv();this._isFilter||((!o._isImported||o._isLoaded)&&this.model.allowComments&&this.XLComment._updateCmntArrowPos(),this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(e,"refresh","vertical"))},_showHideRows:function(n,t,i,r,u,f,e){f&&(e==="show"&&this.refreshContent(n),this._refreshViewport(this._isFrozen(t.frozenRows)?t._contScrollTop:t._scrollTop,n));this._refreshSHMergeCells(n,i,u-r+1,"row",e);f&&e==="hide"&&this.refreshContent(n);t.selectedRange[0]<r&&t.selectedRange[2]>u&&(this.model.allowSelection&&this.XLSelection.selectRange(t._activeCell,t._activeCell),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement())},_colgroupRefresh:function(t){var i,r,u,f;this.model.allowResizing&&(i=this._getJSSheetHeader(t).find("colgroup"),r=this._getContent(t).find("colgroup"));u=n(i).clone();f=n(r).clone();n(r).remove();n(i).remove();n(u).prependTo(this._getJSSheetHeader(t).find(".e-table"));n(f).prependTo(this._getContent(t).find(".e-table"))},_updateFilterIcon:function(n,i,r){t.isNullOrUndefined(r)&&(r=this.getActiveSheetIndex());for(var o=this.getSheet(r).filterSettings.tableRange,u,e,f=0,s=o.length;f<s;f++)e=o[f].multifilterIdx,n>=e[0]&&n<=e[e.length-1]&&(u=o[f].startRow-1,this._isRowViewable(r,u)&&(i==="hide"?this.addClass(this.getCell(u,n).find(".e-filterspan")[0],"e-hide"):this._removeClass(this.getCell(u,n).find(".e-filterspan")[0],"e-hide")),this.XLEdit._updateDataContainer({rowIndex:u,colIndex:n},{dataObj:{isFilterVisible:i!="hide"}}))},_hideColumn:function(n,i){for(var e,a,o,v=!1,u=this.getActiveSheetIndex(),b=this._getJSSheetHeader(u).find("th"),k=this._getJSSheetHeader(u).find("col"),y,f=this.getSheet(u),d=f.hideColsCollection,s=[],h=[],g=this._getContent(u).find("col"),p=f._filterColl,nt,c=f.columnsWidthCollection,w=this.element.find(".e-spreadsheetcolumnheader"),l,r=n;r<=i;r++)if(this._getContent(u).find(".e-rowcell:nth-child("+(r+1)+")").addClass("e-soverflow"),y=this.XLEdit.getPropertyValue(0,r,"isCHide"),this._isColumnViewable(u,r)&&(v=!0),t.isNullOrUndefined(y))for(this.XLEdit._updateDataContainer({rowIndex:0,colIndex:r},{dataObj:{isCHide:!0}}),this._writeRule(r,u),v&&(this.addClass(b[r],"e-hide"),this.addClass(k[r],"e-hide"),this.addClass(g[r],"e-hide")),s.push(r),d[r]=c[r],c[r]=0,fltrKeys=this.getObjectKeys(p),e=0,a=fltrKeys.length;e<a;e++)t.isNullOrUndefined(p[fltrKeys[e]])||(nt=fltrKeys[e],t.isNullOrUndefined(this.XLEdit.getPropertyValue(fltrKeys[e],r,"isSpanHide"))&&this.XLEdit._updateDataContainer({rowIndex:fltrKeys[e],colIndex:r},{dataObj:{isSpanHide:!0}}));this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(n,i,!1,!0);this._isUndoRedo||(n?h.push(n-1):h.push(n),this._isColumnViewable(u,n)&&(n===0?(w.width(28),this.addClass(w[0],"e-hfcol"),this.XLEdit._updateDataContainer({rowIndex:0,colIndex:0},{dataObj:{hCol:!0}})):(this.XLEdit._updateDataContainer({rowIndex:0,colIndex:n-1},{dataObj:{hCol:!0}}),this.addClass(this._getJSSheetHeader(u).find("th:eq("+(n-1)+")")[0],"e-hcol"))));this._refreshSHMergeCells(u,s,i-n+1,"column","hide");this.XLScroll._getColWidths(u,n);this._isFrozen(f.frozenColumns)&&(n<f._frozenColumns||i<f._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv();this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(u,"refresh","horizontal");!f._isImported||f._isLoaded?(c.length-1===i?(this.XLSelection.selectColumn(i-1,u),this.setActiveCell(0,i-1),o={startCol:i-1,endCol:i-1}):(o={startCol:i+1,endCol:i+1},this.setActiveCell(0,i+1),this.XLSelection.selectColumn(i+1,u)),this.XLDragFill.positionAutoFillElement(),this._isUndoRedo||(l={sheetIndex:u,reqType:"show-hide",action:"hide",operation:"column",bSelect:{startCol:n,endCol:i},aSelect:o,hideCols:s,addBCols:h,remBCols:[]},this._completeAction(l),this._trigActionComplete(l)),this.model.allowComments&&this.XLComment._updateCmntArrowPos()):this.setActiveCell(0,0);this._browserDetails.name.indexOf("msie")>-1&&this._colgroupRefresh(u)},_showColumn:function(n,t){var i=this.getActiveSheetIndex(),u=this._isUndoRedo?n:n-1>0?n-1:0,r=this.getSheet(i),f=r.hideColsCollection,e=[],o=!1,h=[],c=this._getJSSheetHeader(i).find("th"),l=this._getContent(i).find("col"),a=this._getJSSheetHeader(i).find("col"),y=r.columnsWidthCollection,v=this.element.find(".e-spreadsheetcolumnheader"),s;for(this.model.allowCellFormatting&&this.XLFormat._refreshHiddenBorder(n,t),j=u;j<=t;j++)this._getContent(i).find(".e-rowcell:nth-child("+(j+1)+")").removeClass("e-soverflow"),j in f&&(this._deleteRule(j,i),this._isColumnViewable(i,j)&&(o=!0),o&&(this._removeClass(c[j],"e-hide"),this._removeClass(a[j],"e-hide"),this._removeClass(l[j],"e-hide"),l[j].style.width=f[j]+"px",a[j].style.width=f[j]+"px"),y[j]=f[j],delete f[j],delete this._dataContainer.sheets[i][0][j].isCHide,this.model.allowFiltering&&this._updateFilterIcon(j,"show",i),e.push(j),!this._isUndoRedo&&j>0?(o&&this._removeClass(c.get(j-1),"e-hcol"),delete this._dataContainer.sheets[i][0][j-1].hCol,h.push(j-1)):j===0&&(v.width(29),this._removeClass(v[0],"e-hfcol"),delete this._dataContainer.sheets[i][0][0].hCol));this._refreshSHMergeCells(i,e,t-n+1,"column","show");this.XLScroll._getColWidths(i,u);this._isUndoRedo||r._isImported&&!r._isLoaded||(n<t?(this.XLSelection.selectColumns(n,t,i),aSelect={startCol:n,endCol:t}):(this.XLSelection.selectColumn(u,i),aSelect={startCol:u,endCol:u}),this.XLDragFill.positionAutoFillElement(),s={sheetIndex:i,reqType:"show-hide",action:"show",operation:"column",bSelect:{startCol:n,endCol:t},aSelect:aSelect,addBCols:[],remBCols:h,hideCols:e},this._completeAction(s),this._trigActionComplete(s));this._browserDetails.name.indexOf("msie")>-1&&this._colgroupRefresh(i);(!r._isImported||r._isLoaded)&&this.model.allowComments&&this.XLComment._updateCmntArrowPos();this._isFrozen(r.frozenColumns)&&(n<r._frozenColumns||t<r._frozenColumns)&&this.XLFreeze._refreshFreezeColDiv();this.model.scrollSettings.allowScrolling&&this.XLScroll._refreshScroller(i,"refresh","horizontal")},_refreshHideRowColCollection:function(n,t,i,r,u){var f;if(r==="row"){for(f=0;f<n.length;f++)if(n[f]>=t+i){u==="insert"?n[f]+=i:n[f]-=i;break}}else for(coll=this.getObjectKeys(n),f=coll.length-1;f>=0;f--)if(coll[f]>=t+i){u==="insert"?(n[parseInt(coll[f])+i]=n[coll[f]],delete n[coll[f]]):(n[parseInt(coll[f])-i]=n[coll[f]],delete n[coll[f]]);break}},_destroySheet:function(n){this.element.find("#"+this._id+"_"+this.model.sheets[n].sheetInfo.value).empty()},_destroy:function(){var r,i=1,t;if(n("#"+this._id+"_sscustomformat").remove(),this.isImport||this._isNew){while(i<=this.model.sheetCount)delete n.templates[this._id+"JSONTemplate"+i],delete n.templates[this._id+"JSONRowHdrTemplate"+i],r=this.getSheet(i).sheetInfo.value,CalcEngine.unregisterGridAsSheet(r,r),i++;this.model.sheets=[];this.model.nameManager=[];this._sheets=[];this.getActivationPanel().empty();this.model.enablePivotTable&&(this.XLPivot._hasPvtField=!1);this.isDirty=!1;t=this.getCalcEngine();t.getFormulaInfoTable().clear();t.getDependentCells().clear();t.getDependentFormulaCells().clear();t.getNamedRanges().clear();t.getDependentNamedRangeCells().clear();this.isImport?(this._detachTable=null,this._updateFormulaCollection()):(document.getElementById(this._id+"_nmgrid")&&n("#"+this._id+"_nmgrid").ejGrid("option",{dataSource:[]}),this._dataContainer={sheets:{},hashCode:[],sharedData:[],cellType:[],valData:[],cFormatData:[]},this.XLRibbon._updateUseInFormulaTrgt(),this.XLEdit._refreshAutoComplete());this.element.append([this.getFocusTopElem(),this.getFocusRightElem(),this.getFocusBottomElem(),this.getFocusLeftElem(),this.getAutoFillElem(),this._getAutoFillOptElem()]);this.element.find(".e-spreadsheet-list .e-sheet").remove();document.getElementById(n("#"+this._id+"ddl"))&&n("#"+this._id+"ddl").data("ejDropDownList").destroy();n("#"+this._id+"ddl").remove();this._tableCnt=this._newSIndex=1;this.XLChart&&(this.XLChart._shapeCnt=1);CalcEngine._tokenCount=0;this._isVPRendered=!1}else this._wireEvents("_off"),this._destroySubControls(),this.element.empty(),this.element.css({height:"",width:"","min-height":"","min-width":""}),this.element.prop("tabindex",!1),this.element.removeEleEmptyAttrs(),this._removeClass(this.element[0],"e-spreadsheet"),document.getElementById(this._id+"_sshide")&&document.getElementById(this._id+"_sshide").remove(),n("#"+this._id+" _formatastable").parent().remove(),n("#"+this._id+" _cellstyles").parent().remove(),n("#"+this._id+"_Ribbon_Home_Font_BorderColor_popup").remove();this._isRibbonDestroyed=!0},_destroySubControls:function(){var r,u=this._id,t,f,i,o,e;if(t=n("span.e-"+u+"-ddl input.e-dropdownlist"),t.length)for(i=0,o=t.length;i<o;i++)f=n(t[i]).data("ejDropDownList"),f&&f.destroy();if(this.model.allowFiltering){e=n(".e-"+this._id+"_customddl");e.length&&e.ejDropDownList("destroy").remove();var s=n("#"+this._id+"_filter_custom_string_acString"),h=n("#"+this._id+"_filter_custom_number_acString"),c=n("#"+this._id+"_filter_custom_date_acString");s.length&&s.ejAutocomplete("destroy").remove();h.length&&h.ejNumericTextbox("destroy").remove();c.length&&c.ejDatePicker("destroy").remove()}n("#"+this._id+"_colordlg_cpicker").ejColorPicker("destroy").remove();this.model.showRibbon&&(this.XLRibbon._rbnDestroy({destroy:!0}),document.getElementById(this._id+"_nmgrid")&&n("#"+this._id+"_nmgrid").ejGrid("destroy"),n(".e-"+this._id+"-spltbtn").ejSplitButton("destroy"),n("#"+this._id+"_Ribbon").ejRibbon("destroy"));r=n(".e-"+u+"-dlg");r.length&&r.remove();this.model.allowFormulaBar&&n("#"+this._id+"_inputbox").ejAutocomplete("destroy");n("#"+this._id+"_AutoComplete").ejAutocomplete("destroy");this.model.allowAutoFill&&n("#"+this._id+"_dragfilloptionbtn").ejSplitButton("destroy");this.model.enableContextMenu&&(n("#"+this._id+"_contextMenuCell").ejMenu("destroy").remove(),n("#"+this._id+"_contextMenuColumnHeader").ejMenu("destroy").remove(),n("#"+this._id+"_contextMenuRowHeader").ejMenu("destroy").remove(),n("#"+this._id+"_contextMenuFooter").ejMenu("destroy").remove(),n(".e-"+u+"-cmenu").remove());this.model.allowFiltering&&(this._excelFilter.resetExcelFilter(),n("#"+this._id+"number_excelDlg").remove(),n("#"+this._id+"string_excelDlg").remove(),n("#"+this._id+"date_excelDlg").remove());n("#"+this._id+"_copyPaste").remove();n("#"+this._id+"_wait").ejWaitingPopup("destroy");n("#"+this._id+"_wait").remove()},_getXYPos:function(n,t,i,r){var e=this.element.offset().top,o=this.element.offset().left,s=t.height(),h=t.width(),u=n.offset().left-o,f=n.offset().top-e;return f+i+s>this._responsiveHeight?f=f-(f+i+s-this._responsiveHeight)+(e-6):f+=e,f<e&&(f+=e-f),u+r+h>this._responsiveWidth?u=u-(u+r+h-this._responsiveWidth)+(o-6):u+=o+r,u<o&&(u+=o-u),{xPos:u,yPos:f}},getValueRowCol:function(n,t,i){var n=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+n),r=this.getSheet(n);return n==-1?"#REF!":(r._isImported&&!r._isRequested&&(this._intrnlReq=!0,this._importSheet(n,!1)),this.XLEdit.getPropertyValue(t-1,i-1,"value",n))},setValueRowCol:function(n,i,r,u){if(r--,u--,r!==-2||u!==-2){var f,e,s={rowIndex:r,colIndex:u},h=!1,o,c;(typeof i=="string"&&(i=i.replace(/^\"|\"$/g,"")),n=this._getSheetIdxFromSheetValue(this._getLocStr("Sheet")+n),f=this.getRangeData({range:[r,u,r,u],property:["value","formatStr","type","thousandSeparator","decimalPlaces"],sheetIdx:n})[0],f.formatStr&&(isNaN(parseInt(i))&&!isNaN(Date.parse(i))&&(i=new Date(i)),e=this.XLFormat._format(i,{formatStr:f.formatStr,type:f.type,thousandSeparator:f.thousandSeparator,decimalPlaces:f.decimalPlaces})),f.type=="fraction"&&(e=this.XLFormat._format(i,{type:f.type})),e=t.isNullOrUndefined(e)?i:e,this._isInitLoad&&!this.isImport&&(h=!0),o={value2:e,calcValue:this.XLEdit._parseValue(i,{rowIndex:r,colIndex:u}).value},f.type&&(o.type=f.type),c={isRefCells:!0,calcValue:o.calcValue,value:f.value,rowIndex:r,colIndex:u},this._isInitLoad||this.isImport||this.XLEdit._EditCellDetails.rowIndex===r&&this.XLEdit._EditCellDetails.columnIndex===u||!this._trigger("cellSave",c))&&(this.XLEdit._updateDataContainer(s,{dataObj:o,sheetIdx:n,skipCell:h}),this.XLEdit._refreshCellAlignment({cellIdx:s,value:i,type:f.type}))}},getActiveCellElem:function(n){n=this._getSheetIndex(n);var t=this.getSheet(n);return this.getCell(t._activeCell.rowIndex,t._activeCell.colIndex,n)},_hlDlgOpen:function(){var f=this.getActiveSheetIndex(),e=this.getActiveCellElem(f),o;if(!e.length||!this.model.allowEditing)return!1;if(this.XLEdit._rangeHasProperty(this.getSheet(f).selectedRange,"cellType")){this._showAlertDlg("Alert","CellTypeAlert","CellTypeAlert",372);return}var t=this._id,c,l=n("#"+t+"_Ribbon_webAddress"),a=n("#"+t+"_Ribbon_cellAddress"),s=n("#"+t+"_Ribbon_findText"),i,r=this.XLEdit.getPropertyValue(e.parent("tr").index(),e[0].cellIndex,"hyperlink",f),v,h,u=n("#"+t+"_Ribbon_cellText");n("#"+t+"_HLDialog").ejDialog("open");this._responsiveHeight<365&&n("#"+this._id+"_HLDialog_wrapper").css("top","0px");h=n("#"+t+"_Ribbon_sheentName").data("ejTreeView");h.option("fields",{dataSource:this.XLRibbon._sheetData()});c=n("#"+t+"_HLDialogTab").data("ejTab");u.attr("disabled",!1);s.attr("disabled",!1);this.isUndefined(r)?c.model.selectedItemIndex===0?(l.val("http://"),u.val("")):(h.selectNode(f+1),u.val(h.getText(f+1)+"!A1"),a.val("A1")):(this.isUndefined(r.webAddr)?c.option({selectedItemIndex:1}):c.option({selectedItemIndex:0}),this.isUndefined(r.cellAddr)?(l.val(r.webAddr),a.val("A1")):(a.val(r.cellAddr.split("_")[0]),v=parseInt(r.cellAddr.split("_")[1])+1,h.selectNode(v),l.val("http://")));n.validator&&(n("#"+t+"_Form_Ribbon_cellAddress").validate().resetForm(),n("#"+t+"_Form_Ribbon_webAddress").validate().resetForm());s.val("");i=this.XLEdit.getPropertyValueByElem(e);this.isUndefined(i)||(o=this.XLEdit.getPropertyValueByElem(e,"type"),this.isFormula(i)||o&&o.indexOf("date")>-1||n.isNumeric(i)||o&&o.indexOf("time")>-1?(u.val(this._getLocStr("HyperLinkHide")),s.val(this._getLocStr("HyperLinkHide")),u.attr("disabled",!0),s.attr("disabled",!0)):(u.val(i),s.val(i)))},_setLink:function(i){var o,h,s,c,e,y,l,a=this.getActiveSheetIndex(),p,u,r=this.getActiveCell(a),f,v;e=this.getSheet(a).selectedRange;n("#"+this._id+"_HLDialog").length||this.XLRibbon._initHLDialog();v=n("#"+this._id+"_HLDialogTab").ejTab("option","selectedItemIndex");o=n("#"+this._id+"_Ribbon_cellText").val();h=n("#"+this._id+"_Ribbon_cellAddress").val();s=n("#"+this._id+"_Ribbon_findText").val();c=n("#"+this._id+"_Ribbon_webAddress").val();l=n("#"+this._id+"_Ribbon_sheentName").data("ejTreeView");y=this._getSheetIndexByName(l.getSelectedNode().text()||this._getSheetNames()[this.getActiveSheetIndex()-1].text);o.length||s.length||(o=l.getSelectedNode().text()+"!"+h,s=c);f=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex);this._prevText=t.isNullOrUndefined(f)?"":this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2");this._prevVal=t.isNullOrUndefined(f)?"":this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value");u=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"type")&&(this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"type").indexOf("date")>-1||this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"type").indexOf("time")>-1)?this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2"):n.isNumeric(f)||this.isFormula(f)?f:v===0?s:o;this._isUndoRedo&&(u=i[0].prevText);this.XLEdit._updateCellValue(r,u);(this.isFormula(u)||n.isNumeric(u))&&(u=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2"));p=v===0?{webAddr:c,text:u}:{cellAddr:h,text:u};this.setHyperlink(this._getAlphaRange(a,e[0],e[1],e[2],e[3]),p,y,i);this._dlgHLClick=!1},_getRangeArgs:function(n,i,r){return t.isNullOrUndefined(n)&&(n=this.getSheet(r).selectedRange),i===typeof n?n:typeof n=="object"?this._getAlphaRange(this.getActiveSheetIndex(),n[0],n[1],n[2],n[3]):this.getRangeIndices(n)},setHyperlink:function(i,r,u,f){var h;if(i=this._getRangeArgs(i,"string"),this.model.allowHyperlink&&!this.model.isReadOnly){if(h={range:i,address:r.webAddr,text:r.text,sheetIndex:u,reqType:"hyperlink",action:"add"},this.XLEdit._rangeHasProperty(i,"cellType")){this._showAlertDlg("Alert","CellTypeAlert","CellTypeAlert",372);return}if(this._trigActionBegin(h))return;i=h.range;r.webAddr=h.address;r.text=h.text;u=h.sheetIndex;var y,s,rt,p,d,b,g=this.getActiveSheetIndex(),ut=this.getSheet(g),w,nt,l=[],tt,c,e,a,o=this._getAlphaRangeCells(i),v={sheetIndex:this.getActiveSheetIndex(),reqType:"hyperlink"},it,k;if(rng=this._getRangeArgs(i,"object"),selCellObj=this._getSelectedCells(v.sheetIndex,rng).selCells,v.action=t.isNullOrUndefined(this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"hyperlink"))?"add":"edit",this._isUndoRedo)for(e=0,a=selCellObj.length;e<a;e++)!f||t.isNullOrUndefined(f[e])||t.isNullOrUndefined(f[e].prevLink)||(this.XLEdit._updateDataContainer({rowIndex:selCellObj[e].rowIndex,colIndex:selCellObj[e].colIndex},{dataObj:{hyperlink:f[e].prevLink}}),this._isRowViewable(u,selCellObj[e].rowIndex)&&(it=n(o[e]).text(),n(o[e]).find("a").remove(),o[e].lastChild?o[e].lastChild.textContent="":n(o[e]).text(""),e===0?t.isNullOrUndefined(this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink").cellAddr)?n(o[e]).append(t.buildTag("a",f[e].prevText,"",{href:this.XLEdit.getPropertyValueByElem(n(o[e]),"hyperlink").webAddr,target:"_blank"})):n(o[e]).append(t.buildTag("a",f[e].prevText,"")):t.isNullOrUndefined(this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink").cellAddr)?n(o[e]).append(t.buildTag("a",it,"",{href:this.XLEdit.getPropertyValueByElem(n(o[e]),"hyperlink").webAddr,target:"_blank"})):n(o[e]).append(t.buildTag("a",it,"")),n(o[e]).find("a").addClass("e-hyperlinks")),this._dupDetails=!0,this.XLFormat.format({style:{color:this._hlColor}}),this._dupDetails=!1);else{for(t.isNullOrUndefined(r.webAddr)?(s=r.cellAddr,y=t.isNullOrUndefined(r.text)?this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value2"):r.text,s.indexOf("!")>-1&&(w=s.split("!"),u=w[0].indexOf("=")>-1?this._getSheetIndexByName(w[0].split("=")[1]):this._getSheetIndexByName(w[0]),s=w[1]),s.indexOf("$")>-1&&(cellAdr=s.split("$").join("")),nt=t.isNullOrUndefined(y)?s:y):(d=r.webAddr,p=t.isNullOrUndefined(r.text)?this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value2"):r.text,nt=t.isNullOrUndefined(p)?d:p),this._dlgHLClick||(k=this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value2"),this._prevText=t.isNullOrUndefined(k)?"":k,this._prevVal=t.isNullOrUndefined(k)?"":this.XLEdit.getPropertyValue(selCellObj[0].rowIndex,selCellObj[0].colIndex,"value"),this.XLEdit._updateCellValue({rowIndex:selCellObj[0].rowIndex,colIndex:selCellObj[0].colIndex},nt)),e=0,a=selCellObj.length;e<a;e++)l.push({rowIndex:selCellObj[e].rowIndex,colIndex:selCellObj[e].colIndex,prevLink:this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink"),prevColor:this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"formats")});for(this.isUndefined(h.text)||this.XLEdit._updateCellValue(selCellObj[0],h.text),this.isUndefined(s)?this.updateUniqueData({hyperlink:{webAddr:d}},rng):this.updateUniqueData({hyperlink:{cellAddr:s+"_"+u}},rng),e=0,a=selCellObj.length;e<a;e++)c=this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"value2"),l[e].prevText=e===0?this._prevText:c,l[e].prevVal=e===0?this._prevVal:this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"value"),this._isRowViewable(g,selCellObj[e].rowIndex)&&(n(o.eq(e).find("a")).remove(),this.XLEdit._refreshTextNode(o[e]),b=!0),tt=this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink",g),tt.cellAddr?(c=e===0?y:c,b&&o.eq(e).append(t.buildTag("a",c,"")),l[e].curText=y):(c=e===0?p:c,b&&o.eq(e).append(t.buildTag("a",c,"",{href:tt.webAddr,target:"_blank"})),l[e].curText=p),l[e].curLink=this.XLEdit.getPropertyValue(selCellObj[e].rowIndex,selCellObj[e].colIndex,"hyperlink"),b&&n(o[e]).find("a").addClass("e-hyperlinks");this._dupDetails=!0;this.XLFormat.format({style:{color:this._hlColor}},i);this._dupDetails=!1;v.selectedCell=l;rt={sheetIndex:this.getActiveSheetIndex(),reqType:"hyperlink",selectedCell:v.selectedCell,action:v.action,adrress:r.webAddr};ut._isImported&&(!ut._isLoaded||this._isExport)||(this._completeAction(v),this._trigActionComplete(rt))}}},removeHyperlink:function(n,i,r,u,f){if(!this.model.allowHyperlink||this.model.isReadOnly)return!1;var e,c,s,a,v=[],b=this._dupDetails,o,h=this.getActiveSheetIndex(),p=this.getSheet(h),w=[],y,l={sheetIndex:h,reqType:"hyperlink",action:"delete",range:n};for(o=this._getMultiRangeCells(n),e=0,c=o.length;e<c;e++)f&&this._isHiddenRow(o[e].rowIndex)||(s={rowIndex:o[e].rowIndex,colIndex:o[e].colIndex,prevLink:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"hyperlink"),prevText:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"value2"),prevVal:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"value"),prevColor:this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"formats")},this._dupDetails=!0,s.prevLink&&(i?this.XLFormat.format({style:{"text-decoration":"underline"}},this._getAlphaRange(h,o[e].rowIndex,o[e].colIndex,o[e].rowIndex,o[e].colIndex)):(t.isNullOrUndefined(u)||this.isUndefined(u[e].prevColor)||(a=u[e].prevColor.color),this.XLFormat.format({style:{color:this.isUndefined(a)?"#444445":a,"text-decoration":"none"}},this._getAlphaRange(h,o[e].rowIndex,o[e].colIndex,o[e].rowIndex,o[e].colIndex))),s.curColor=this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"formats")),this._dupDetails=b,this.clearRangeData([o[e].rowIndex,o[e].colIndex,o[e].rowIndex,o[e].colIndex],["hyperlink"]),this._isUndoRedo||(s.curLink=this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"hyperlink")),this._isUndoRedo&&!this._dupDetails&&(t.isNullOrUndefined(u[e].prevText)||this.XLEdit._updateDataContainer({rowIndex:o[e].rowIndex,colIndex:o[e].colIndex},{dataObj:{value2:u[e].prevText,value:u[e].prevVal},sheetIdx:h})),this._isUndoRedo||(s.curText=this.XLEdit.getPropertyValue(o[e].rowIndex,o[e].colIndex,"value2")),!this._isUndoRedo||this._dupDetails||t.isNullOrUndefined(u[e].prevLink)||(this.XLEdit._updateDataContainer({rowIndex:o[e].rowIndex,colIndex:o[e].colIndex},{dataObj:{hyperlink:u[e].prevLink}}),y={rowIndex:u[e].rowIndex,colIndex:u[e].colIndex},this.XLSelection.selectRange(y,y),this._setLink([u[e]]),v.push(e)),w.push(s));for(e=0,c=v.length;e<c;e++)o.splice(v[e],1);l.selectedCell=w;l.reqType=t.isNullOrUndefined(r)?"hyperlink":"clear-link";p._isImported&&!p._isLoaded||this._isUndoRedo||this._dupDetails||this._isExport||(this._completeAction(l),this._trigActionComplete(l))},_removeHyperlink:function(n,t,i,r){var u=this.getActiveSheetIndex(),r=r?r:this.getSheet(u).selectedRange;this.removeHyperlink(this._getAlphaRange(u,r[0],r[1],r[2],r[3]),n==="clear",n,t,i)},_openLink:function(){var n=this.getActiveSheetIndex(),t=this.getSheetElement(n).find(".e-activecell");this._hlClick(this.XLEdit.getPropertyValue(t.closest("tr").index(),t[0].cellIndex,"hyperlink",n))},_hlClick:function(n){var r,f,t,e,s=this.getActiveSheetIndex(),h=this._getLocStr("HyperLinkAlert").split("-"),o,u,i=this.getSheet(s);this.model.enableContextMenu&&this.XLCMenu.hideCMenu();n.cellAddr?(u=n.cellAddr.split("_"),o=u[0].indexOf("$")>-1?u[0].split("$").join(""):u[0],r=this.getRangeIndices(o),t={rowIndex:r[0],colIndex:r[1]},e={rowIndex:r[2],colIndex:r[3]},f=Number(u[1]),this.gotoPage(f,!1),i._activeCell=t,this.XLSelection.selectRange(t,e,f),i._startCell=t,i._endCell=e,this.XLScroll._scrollSelectedPosition(f,t),this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement()):(t={rowIndex:i._activeCell.rowIndex,colIndex:i._activeCell.colIndex},i._startCell=t,i._endCell=t,this._isValidUrl(n.webAddr)?window.open(n.webAddr,"_blank"):this._showAlertDlg("Alert","HyperLinkAlert"))},_isValidUrl:function(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)},showWaitingPopUp:function(){n("#"+this._id+"_wait").data("ejWaitingPopup").show()},hideWaitingPopUp:function(){n("#"+this._id+"_wait").data("ejWaitingPopup").hide()},_getSelRange:function(n){var t,i,r=this.getActiveSheetIndex();return t=n[0],i=n[n.length-1],this._generateHeaderText(t.colIndex+1)+(t.rowIndex+1)+":"+this._generateHeaderText(i.colIndex+1)+(i.rowIndex+1)},_getSelectedCells:function(n,i){var u,r,f=this.getSheet(n?n:this.getActiveSheetIndex());return t.isNullOrUndefined(i)?(u=f._selectedCells,u.length>0?(i=this._getSelRange(u),r=this.getRangeIndices(i)):(r=[0,0,0,0],u=[{rowIndex:0,colIndex:0}])):(r=this._getRangeArgs(i,"object"),u=this._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]})),{range:r,selCells:u}},_getHiddenCells:function(i,r,u,f){var e=this._dataContainer.sheets[i],h,o,s;return t.isNullOrUndefined(f[u.rowIndex])&&(f[u.rowIndex]={}),t.isNullOrUndefined(f[u.rowIndex][u.colIndex])&&(f[u.rowIndex][u.colIndex]={value:{},text:""}),t.isNullOrUndefined(e[u.rowIndex])||(f[u.rowIndex][u.colIndex].value=n.extend(!0,{},e[u.rowIndex][u.colIndex]),h=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2",i),o=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"wrap",i),s=this.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"wrapRow",i),delete e[u.rowIndex][u.colIndex],f[u.rowIndex][u.colIndex].text=t.isNullOrUndefined(h)?"":h,(o||s)&&(t.isNullOrUndefined(e[u.rowIndex])&&(e[u.rowIndex]={}),t.isNullOrUndefined(e[u.rowIndex][u.colIndex])&&(e[u.rowIndex][u.colIndex]={}),o&&(e[u.rowIndex][u.colIndex].wrap=o),s&&(e[u.rowIndex][u.colIndex].wrapRow=s))),this._isRowViewable(i,r.rowIndex)&&(r=this.getCell(r.rowIndex,r.colIndex,i).empty()),f},_getRowSpan:function(n,i){for(var u=0,e=this.model.scrollSettings.allowVirtualScrolling,r=i[0].rowIndex,f=i[i.length-1].rowIndex;r<=f;r++)t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isRHide",n))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isFHide",n))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isFilterHide",n))&&(u=u+1);return u},_getColSpan:function(n,i){var u=0,e=this.model.scrollSettings.allowVirtualScrolling,o,r,f;for(e||(o=this._getJSSheetHeader(n).find("col")),r=i[0].colIndex,f=i[i.length-1].colIndex;r<=f;r++)t.isNullOrUndefined(this.XLEdit.getPropertyValue(0,r,"isCHide",n))&&(u=u+1);return u},_getHiddenRowColumnCount:function(n,i){var f=this.getRangeIndices(i),e=0,o=0,r,u,s=this.model.scrollSettings.allowVirtualScrolling,h;for(s||(h=this._getJSSheetHeader(n).find("col")),r=f[0];r<=f[2];r++)t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isRHide",n))&&t.isNullOrUndefined(this.XLEdit.getPropertyValue(r,0,"isFHide",n))||(e=e+1);for(u=f[1];u<=f[3];u++)(s||!s&&this._hasClass(h[u],"e-hide")||!t.isNullOrUndefined(this.XLEdit.getPropertyValue(0,u,"isCHide",n)))&&(o=o+1);return{hRow:e,hCol:o}},_updateMergeColl:function(n,i,r,u,f,e,o){var h=this.getSheet(n),s=h._mergeColl;t.isNullOrUndefined(s[i])?(s[i]={},s[i][r]={}):t.isNullOrUndefined(s[i][r])&&(s[i][r]={});s[i][r].type=u;f&&(s[i][r].isSamePosn=f);h.mergedCells.push({isCenterAlign:o,range:e})},mergeCells:function(i,r){if(!this.model.isReadOnly){var u,o,c=1,l=1,a,p=[],e=this.getActiveSheetIndex(),v=this.getSheet(e),b=n("#"+this._id+"_alertdlg"),f,h=!1,y,s=this._getRangeArgs(i,"object",e),w=s[2]-s[0]||s[3]-s[1];if(this.model.allowMerging&&(this.model.allowSelection||w)&&!(this.getSheetElement(e).find(".e-ss-activeimg").length>0)&&!this.model.isReadOnly){if(f=this._getSelectedCells(e,s).selCells,this._selMergeCells=[],this._mergeType="merge-cells",(!v._isImported||v._isLoaded)&&!this._isUndoRedo)if(this.performSelection(s),this.mergeCenter){for(h=!1,u=0,a=f.length;u<a;u++)o=this.XLEdit.getPropertyValue(f[u].rowIndex,f[u].colIndex,"merge",e),t.isNullOrUndefined(o)||(c=o.mSpan.rowSpan,l=o.mSpan.colSpan,(c>1||l>1)&&(y=this._getHiddenRowColumnCount(e,this.XLEdit.getPropertyValue(f[u].rowIndex,f[u].colIndex,"merge").mRange),this._unMergeAllCells(e,u,f,p,y.hRow,y.hCol),h=!0));!h||this._dupDetails||this._isUndoRedo||(t.isNullOrUndefined(i)&&(i=this._getSelRange(f)),details={sheetIndex:e,cells:f,range:i,reqType:"merge-cells",action:"un-merge",operation:"un-merge",mCells:p},this._completeAction(details),this._trigActionComplete(details));this.performSelection(s)}else for(u=0,a=f.length;u<a;u++)if(o=this.XLEdit.getPropertyValue(f[u].rowIndex,f[u].colIndex,"merge",e),t.isNullOrUndefined(o)||(c=o.mSpan.rowSpan,l=o.mSpan.colSpan),c===1&&l===1){h=!1;break}v._isImported&&!v._isLoaded||this._isUndoRedo||!this._rangeHasData(s)||r||h||!w?h||this._mergeCells(e,f,{},[]):this._showAlertDlg("","MergeCellsAlert","MergeCells",498);this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()}}},_mergeCells:function(i,r,u,f){var a,w,g=0,l=this._dataContainer.sheets[i],v,y,e,s,nt={},c,p,b,h=this.getSheet(i),k=this.XLEdit,d,it=h.columnsWidthCollection,o,tt;if(w=e=r[0].rowIndex,s=r[0].colIndex,this.model.scrollSettings.allowVirtualScrolling||(b=this._getJSSheetHeader(i).find("col")),(t.isNullOrUndefined(k.getPropertyValue(e,0,"isFRHide"))||t.isNullOrUndefined(k.getPropertyValue(e,0,"isRHide")))&&b&&b.eq(s).hasClass("e-fc-hide"))return{hideCell:[],mCells:[]};for(a={rowSpan:this._getRowSpan(i,r),colSpan:this._getColSpan(i,r)},t.isNullOrUndefined(l[e])||t.isNullOrUndefined(l[e][s])||(delete l[e][s].isMHide,delete l[e][s].mergeIdx),this._isRowViewable(i,e)&&(c=this.getCell(e,s),c[0].colSpan=a.colSpan,c[0].rowSpan=a.rowSpan,c[0].className=c[0].className.replace("e-mc-hide",""),this.mergeCenter&&c.addClass("e-calign "),c.hasClass("e-commentcell")&&this.model.allowComments&&this.XLComment._updateCmntArrowPos(c)),this._selMergeCells.push(r[0]),this._textClip(r[0].rowIndex,r[0].colIndex,"add"),this._textClip(r[0].rowIndex,r[0].colIndex,"delete","",!0),this._isRowViewable(i,r[0].rowIndex)&&this.addClass(this.getCell(r[0].rowIndex,r[0].colIndex)[0],"e-moverflow"),g=this._getRowHeight(r[0].rowIndex,i),o=1,tt=r.length;o<tt;o++)this._isRowViewable(i,r[o].rowIndex)&&(p=this.getCell(r[o].rowIndex,r[o].colIndex),this._hasClass(p[0],"e-mc-hide")||this.addClass(p[0],"e-mc-hide"),this.addClass(p[0],"e-moverflow")),w!==r[o].rowIndex&&h.hideRowsCollection.indexOf(r[o].rowIndex)==-1&&(g+=this._getRowHeight(r[o].rowIndex,i),w=r[o].rowIndex),this._textClip(r[o].rowIndex,r[o].colIndex,"add"),this._textClip(r[o].rowIndex,r[o].colIndex,"delete","",!0),u=this._getHiddenCells(i,{rowIndex:r[o].rowIndex,colIndex:r[o].colIndex},r[o],u),this.XLEdit._updateDataContainer({rowIndex:r[o].rowIndex,colIndex:r[o].colIndex},{dataObj:{isMHide:!0,mergeIdx:{rowIndex:e,colIndex:s}},sheetIdx:i}),this._selMergeCells.push(r[o]);return t.isNullOrUndefined(l[e])||n.extend(!0,nt,l[e][s]),y=this._getSelRange(r),h._activeCell=r[0],(!h._isImported||h._isLoaded)&&this.performSelection(r[0],r[r.length-1]),this.XLEdit._updateDataContainer({rowIndex:e,colIndex:s},{dataObj:{merge:{mSpan:a,isMerge:!0,mRange:y,isCenterAlign:this.mergeCenter}}}),this._updateMergeColl(i,e,s,this.mergeCenter?"center":"merge",null,y,this.mergeCenter),f.push({rowIndex:e,colIndex:s,prevObj:nt,curObj:n.extend(!0,{},l[e][s])}),k.getPropertyValue(e,s,"wrap")&&(d=this._getWrapCellHeight(i,e,s).rowHt,(this._getRowHeight(e,i)<=d||h._isImported||!h._isLoaded)&&this.setHeightToRows([{rowIndex:e,height:d}])),h._isImported&&!h._isLoaded||this._isUndoRedo||this._dupDetails||this._paste||this._mergeType!=="merge-cells"||(v={sheetIndex:i,cells:[{rowIndex:e,colIndex:s}],range:y,reqType:"merge-cells",action:"merge-all",hideCells:u,mCells:f},v.operation=this.mergeCenter?"merge-center":"merge-all",this._paste||(this._completeAction(v),this._trigActionComplete(v))),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),this.mergeCenter=!1,this._paste=!1,this.XLEdit._updateUsedRange(e+a.rowSpan,s+a.colSpan),{hideCells:u,mCells:f}},mergeAcrossCells:function(t,i){if(!this.model.isReadOnly){var u=this.getActiveSheetIndex(),f=this.getSheet(u),o=n("#"+this._id+"_alertdlg"),e,r;(r=this._getRangeArgs(t,"object",u),isMultiCell=r[2]-r[0]||r[3]-r[1],isMultiCol=r[3]-r[1],!this.model.allowMerging||this.getSheetElement(u).find(".e-ss-activeimg").length>0||!isMultiCell||this.model.isReadOnly)||(this._selMergeCells=[],e=this._getSelectedCells(u,r),this.isUndefined(t)||this.performSelection(r),!this._isUndoRedo&&this._rangeHasData(r)&&(!f._isImported||f._isLoaded)&&!i&&isMultiCol?this._showAlertDlg("","MergeCellsAlert","MergeAcrossCells",498):isMultiCol&&this._mergeAcrossCells(u,e.selCells),this.performSelection(r),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons())}},_mergeAcrossCells:function(i,r){var u,e,a,o,s=1,v=1,h=!0,c,y,p,w,b,l=[],f={mCells:[],hideCells:{}},k=this.getSheet(i);for(this._mergeType="merge-across",u=0,a=r.length;u<a;u++)if(o=this.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"merge",i),t.isNullOrUndefined(o)||(s=o.mSpan.rowSpan,v=o.mSpan.colSpan),s===1&&v===1){h=!1;break}else s>1&&(h=!1);if(!h)for(w=r[0].rowIndex,b=r[r.length-1].rowIndex,y=r[0].colIndex,p=r[r.length-1].colIndex,u=w;u<=b;u++){for(l=[],e=y;e<=p;e++)l.push({rowIndex:u,colIndex:e});f=this._mergeCells(i,l,f.hideCells,f.mCells)}k._isImported&&!k._isLoaded||this._isUndoRedo||this._dupDetails||(c={sheetIndex:i,cells:n.extend(!0,[],this._selMergeCells),range:this._getSelRange(this._selMergeCells),reqType:"merge-cells",action:"merge-across",operation:"merge-across",hideCells:f.hideCells,mCells:f.mCells},this._paste||(this._completeAction(c),this._trigActionComplete(c)),this._paste=!1);this.performSelection(r[0],r[r.length-1])},unmergeCells:function(n){var u,l;if(!this.model.isReadOnly){var r=this.getActiveSheetIndex(),e=this.getSheet(r),o=[],i,s,h,f,a=e._clrMergeColl,c=this._getRangeArgs(n,"object",r);if(this.model.allowMerging&&!(this.getSheetElement(r).find(".e-ss-activeimg").length>0)&&!this.model.isReadOnly){for(this._selMergeCells=[],i=this._getSelectedCells(r,c).selCells,u=0,l=i.length;u<l;u++)f=this.XLEdit.getPropertyValue(i[u].rowIndex,i[u].colIndex,"merge",r),this.isUndefined(f)||(h=this._getHiddenRowColumnCount(r,f.mRange),o=this._unMergeAllCells(r,u,i,o,h.hRow,h.hCol),a.push({rowIdx:i[u].rowIndex,colIdx:i[u].colIndex,mergeObj:f}));t.isNullOrUndefined(n)&&(n=this._getSelRange(i));this.performSelection(c);e._isImported&&!e._isLoaded||this._isUndoRedo||this._dupDetails||this._isExport||(s={sheetIndex:r,cells:i,range:n,reqType:"merge-cells",action:"un-merge",operation:"un-merge",mCells:o},this._completeAction(s),this._trigActionComplete(s));this.model.showRibbon&&this.XLRibbon._updateRibbonIcons()}}},_unMergeAllCells:function(i,r,u,f,e,o){var s,h,e,o,y,k,d=1,g=1,w,b=!1,l=this._dataContainer.sheets[i],rt={},p,nt,v,c,a,ut,tt,ft=this.getSheet(i),it;if(c=u[r].rowIndex,a=u[r].colIndex,rowhdrrows=this.getRows(i)[0],p=this.getCell(c,a),y=this.XLEdit.getPropertyValue(c,a,"merge",i),t.isNullOrUndefined(y)||(d=y.mSpan.rowSpan,g=y.mSpan.colSpan),g>1||d>1)for(tt=l[c][a],n.extend(!0,rt,tt),delete tt.merge,this._clearMergeColl(ft._mergeColl,c,a),this._isRowViewable(i,c)&&(p=this.getCell(c,a),this.XLEdit.getPropertyValue(c,a,"wrap",i)&&!this.XLEdit.getPropertyValue(c,a,"cellType",i)&&(k=p.find("#"+this._id+"_MergeWrap"),k.length&&(p[0].innerHTML=k[0].innerHTML,k.remove())),t.isNullOrUndefined(y.isCenterAlign)||p.removeClass("e-calign"),p[0].colSpan=p[0].rowSpan=1,it=p[0].offsetHeight,n(rowhdrrows[c]).height()<it&&this.XLEdit.getPropertyValue(c,a,"wrap")&&this.setHeightToRows([{rowIndex:c,height:it}]),this.XLScroll._getRowHeights(i,c)),f.push({rowIndex:c,colIndex:a,prevObj:rt,curObj:n.extend(!0,{},l[c][a])}),ut=[],s=c;s<c+d+e;s++)for(h=a;h<a+g+o;h++)this._selMergeCells.push({rowIndex:s,colIndex:h}),this._isRowViewable(i,s)&&(v=this.getCell(s,h,i),b=!0),t.isNullOrUndefined(this.XLEdit.getPropertyValue(s,h,"isMHide",i))||(this._isUndoRedo&&(w=this.XLEdit.getPropertyValue(s,h,"merge",i),t.isNullOrUndefined(w)||(w.mergeSpan.rowSpan>1||w.mergeSpan.colSpan>1)&&(ut.push({rowIndex:s,colIndex:h,rowSpan:w.mergeSpan.rowSpan,colSpan:w.mergeSpan.colSpan}),l[s][h].merge.mSpan={rowSpan:1,colSpan:1},v[0].rowSpan=1,v[0].colSpan=1)),mergeIdx=this.XLEdit.getPropertyValue(s,h,"mergeIdx",i),t.isNullOrUndefined(mergeIdx)||mergeIdx.rowIndex===c&&mergeIdx.colIndex===a&&(b&&(v.removeClass("e-mc-hide"),v[0].rowSpan=1,v[0].colSpan=1),delete l[s][h].isMHide,delete l[s][h].mergeIdx)),this._isUndoRedo&&!t.isNullOrUndefined(this._delCells)&&(t.isNullOrUndefined(this._delCells[s])||t.isNullOrUndefined(this._delCells[s][h])||t.isNullOrUndefined(l[s])||(nt=!t.isNullOrUndefined(l[s][h])&&l[s][h].overflow,l[s][h]=this._delCells[s][h].value,nt&&(l[s][h].overflow=nt),b&&v.text(this._delCells[s][h].text),y=this.XLEdit.getPropertyValue(s,h,"merge"),!t.isNullOrUndefined(y)&&y.isMerge&&this.mergeCells(y.mRange,!0))),b&&v.hasClass("e-commentcell")&&this.model.allowComments&&this.XLComment._updateCmntArrowPos(v),b&&(this._removeClass(v[0],"e-moverflow"),v.text().length>0?this._textClip(s,h,"add"):this._textClip(s,h,"delete")),t.isNullOrUndefined(l[s])||(this.getObjectLength(l[s][h])<1&&delete l[s][h],this.getObjectLength(l[s])<1&&delete l[s]);return f},_refreshMergeCells:function(){var i,t,r,n;for(this._dupDetails=!0,i=this._removeMergeColl,t=0,r=i.length;t<r;t++)this.unmergeCells(i[t].merge.mRange,!0);this._dupDetails=!1;n=this._insData;switch(n.value.status){case"shiftRight":this._insertShiftRight(n.sheetIdx,n.startCell,n.endCell,n.value);break;case"shiftBottom":this._insertShiftBottom(n.sheetIdx,n.startCell,n.endCell,n.value);break;case"shiftUp":this._deleteShiftUp(n.sheetIdx,n.startCell,n.endCell,n.value);break;case"shiftLeft":this._deleteShiftLeft(n.sheetIdx,n.startCell,n.endCell,n.value)}},_showHeadings:function(n,t){if(!this.model.isReadOnly){var t=t?t:this.getActiveSheetIndex(),i=this.getSheet(t),f=this._getJSSheetHeader(t),e=this._getContent(t).find(".e-content"),o=this._getJSSheetRowHeader(t),r=this.getFrozenRows(),u=this.getFrozenColumns();i.showHeadings=n;this._isDisplayHeader=!0;i.showHeadings?(o.show(),f.show(),e.removeClass("e-viewbrdr")):(o.hide(),f.hide(),e.addClass("e-viewbrdr"));this._heightWidthCalculation(t,{action:i._isLoaded?"":"initial"});this.model.showRibbon&&(checkObj=this.element.find("#"+this._id+"_Ribbon_PageLayout_Show_Headings").data("ejCheckBox"),checkObj&&(n?checkObj._checked():checkObj._unChecked()));this.model.allowFreezing&&i._isFreezed&&(this.XLFreeze.unfreezePanes(),this._isFrozen(r)&&this._isFrozen(u)?this.XLFreeze.freezePanes(r,u):this._isFrozen(r)?this.XLFreeze.freezeRows(r):this._isFrozen(u)&&this.XLFreeze.freezeColumns(u))}},showHeadings:function(n){this._showHeadings(n)},showGridlines:function(n){this._showGridlines(n)},_showGridlines:function(n,t){if(!this.model.isReadOnly){var t=t?t:this.getActiveSheetIndex(),i=this.getSheet(t),r=this._getContent(t).find(".e-rowcell");this.model.showRibbon&&(checkObj=this.element.find("#"+this._id+"_Ribbon_PageLayout_Show_Gridlines").data("ejCheckBox"),checkObj&&(n?checkObj._checked():checkObj._unChecked()));i.showGridlines=n;i.showGridlines?r.removeClass("e-hborder"):r.addClass("e-hborder")}},setSheetFocus:function(){this._hasClass(document.activeElement,"e-datepicker")||this.element.focus();this._isInitLoad||window.scrollTo(window.pageXOffset,window.pageYOffset)},_diffNumbers:function(n,t){return n-t},_isValidDate:function(n){var t,i;return/^\d{1,4}[\.|\/|-]\d{1,2}[\.|\/|-]\d{1,4}$/.test(n)?(n=n.replace(/0*(\d*)/gi,"$1"),t=n.split(/[\.|\/|-]/),t[0]=t[0]-1,t[2].length<4&&(t[2]=parseInt(t[2])<50?2e3+parseInt(t[2]):1900+parseInt(t[2])),i=new Date(t[2],t[0],t[1]),i.getDate()!=t[1]||i.getMonth()!=t[0]||i.getFullYear()!=t[2]?!1:!0):!1},_isValidTime:function(n){for(var t,r,i=0,o=!1,f,e,u=0,s=n.length;u<s;u++){if(t=n.substring(u,u+1),(t<"0"||t>"9")&&t!=":"&&t!=" "&&t!="a"&&t!="A"&&t!="p"&&t!="P"&&t!="m"&&t!="M")return!1;t==":"&&i++;(t=="p"||t=="P"||t=="a"||t=="A")&&(o=!0)}return i<1||i>2?!1:(r=n.substring(0,n.indexOf(":")),parseFloat(r)<0||parseFloat(r)>23)?!1:o&&(parseFloat(r)<1||parseFloat(r)>12)?!1:(f=i==2?n.substring(n.indexOf(":")+1,n.lastIndexOf(":")):n.substring(n.indexOf(":")+1,n.length),parseFloat(f)<0||parseFloat(f)>59)?!1:(e=i==2?n.substring(n.lastIndexOf(":")+1,n.length):"00",parseFloat(e)<0||parseFloat(e)>59)?!1:!0},_setXY:function(n,t){var i=0,r=0;return t=t?"page":"client",n.type==="mousemove"||n.type==="mousedown"||n.type==="mouseup"?(i=n[t+"X"],r=n[t+"Y"]):n.type==="touchmove"||n.type==="touchstart"||n.type==="touchend"?(i=n.originalEvent.changedTouches[0][t+"X"],r=n.originalEvent.changedTouches[0][t+"Y"]):(n.type==="MSPointerMove"||n.type==="pointermove"||n.type==="MSPointerUp"||n.type==="pointerup"||n.type==="MSPointerDown"||n.type==="pointerdown")&&(i=n.originalEvent[t+"X"],r=n.originalEvent[t+"Y"]),[i,r]},_getSelectedItems:function(n,i,r){var f,e,o,u;return n=n?n:this.getActiveSheetIndex(),u=this.getSheet(n),t.isNullOrUndefined(r)&&t.isNullOrUndefined(i)?(f=u._selectedCells,e=u._startCell,o=u._endCell,r=this._generateHeaderText(e.colIndex+1)+(e.rowIndex+1)+":"+this._generateHeaderText(o.colIndex+1)+(o.rowIndex+1)):(i=this.isUndefined(i)?this.getRangeIndices(r):i,f=this.getRange(i,n),r=this._generateHeaderText(i[1]+1)+(i[0]+1)+":"+this._generateHeaderText(i[3]+1)+(i[2]+1)),[f,r]},setBorder:function(n,t){if(this.model.allowCellFormatting&&!this.model.isReadOnly){var f="",e=!1,l=n.style,u=n.type,h=n.color,o,a,c,v,r,y,s=this._getContent(this.getActiveSheetIndex()).find("div:first-child");if(this.model.allowSelection||u!=="drawborder"&&u!=="drawbordergrid"){o=["bottom","top","left","right","outside","allborder"];a=["thickbox","thickbottom","topandbottom","topandthickbottom"];c={top:{top:""},right:{right:""},bottom:{bottom:""},left:{left:""},outside:{top:"",right:"",bottom:"",left:""},thickbox:{top:"2px solid",right:"2px solid",bottom:"2px solid",left:"2px solid"},thickbottom:{bottom:"2px solid"},topandbottom:{top:"1px solid",bottom:"1px solid"},topandthickbottom:{top:"1px solid",bottom:"2px solid"}};v={solid:"1px solid",dashed:"1px dashed",dotted:"1px dotted"};this.model.allowSelection&&(this.XLSelection._isGridBordering=this.XLSelection._isOutsideBordering=!1);switch(!0){case o.indexOf(u)>-1:e=u===o[5];r=c[e?o[4]:u];for(i in r)r[i]=v[l]+" "+h;e&&(r.isGridBorder=e);r.property=n;this.XLFormat.applyBorder(r,t);break;case a.indexOf(u)>-1:r=c[u];for(i in r)f="",y=r[i].split(" "),f=y.length===2?f+r[i]+" "+h:f+r[i]+" "+l+" "+h,r[i]=f;r.property=n;this.XLFormat.applyBorder(r,t);break;case u==="noborder":this.XLFormat.applyBorder("noborder",t);break;case u==="drawborder":this.XLSelection._isOutsideBordering=!0;s.removeClass("e-ss-cursor");s.addClass("e-ss-drwbrdrcursor");this.XLSelection._cleanUp(!0);break;case u==="drawbordergrid":this.XLSelection._isGridBordering=!0;s.removeClass("e-ss-cursor");s.addClass("e-ss-drwbrdrgridcursor");this.XLSelection._cleanUp(!0)}}}},clearBorder:function(n){this.model.isReadOnly||(n=this._getRangeArgs(n,"object"),this.XLFormat.removeStyle(n,{cellStyle:!0,tableStyle:!0,border:!0}))},clearHyperlinks:function(){this.model.allowClear&&!this.model.isReadOnly&&this._removeHyperlink("clear")},clearComments:function(n){this.model.allowClear&&!this.model.isReadOnly&&this.model.allowComments&&this.XLComment.deleteComment(r,n,!1,"clear")},clearAllFormat:function(i){if(this.model.allowClear&&!this.model.isReadOnly){var c,s=this.getActiveSheetIndex(),l=this._dataContainer.sheets[s],f=[],e,o,h=this.getSheet(s),r=this._getRangeArgs(i,"object"),a,u={sheetIndex:s,reqType:"clear-format",range:r};(u.bData=n.extend(!0,[],this.getRangeData({range:r,property:["format","tformats","type","formatStr","decimalPlaces","thousandSeparator","formats","hyperlink","cFormatRule"]})),this._dupDetails=!0,e=this.getObjectKeys(l),f[0]=r[0]>parseInt(e[0])?r[0]:parseInt(e[0]),f[2]=r[2]<parseInt(e[e.length-1])?r[2]:parseInt(e[e.length-1]),o=this.getObjectKeys(l[f[2]]),f[1]=r[1]>parseInt(o[0])?r[1]:parseInt(o[0]),f[3]=r[3]<parseInt(o[o.length-1])?r[3]:parseInt(o[o.length-1]),t.isNullOrUndefined(e))||(a=this._checkTableRange(this._getAlphaRange(s,f[0],f[1],f[2],f[3])),a.status!=="partial")&&(this.clearRangeData(r,["format","formatStr","decimalPlaces","thousandSeparator","formats","hyperlink","cFormatRule","border"],"",!1,u.reqType),this.clearBorder(i),this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(r),h._clrWrapColl=[],h._clrMergeColl=[],this._isPaste=!0,this.setWrapText("unwrap",r),this._isPaste=!1,this.unmergeCells(r),u.wrapColl=n.extend(!0,[],h._clrWrapColl),u.mergeColl=n.extend(!0,[],h._clrMergeColl),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),this._dupDetails=!1,this._isUndoRedo||(this._completeAction(u),c={sheetIndex:u.sheetIndex,reqType:u.reqType,range:u.range,prevData:u.bData,prevMergeColl:u.mergeColl,prevWrapColl:u.wrapColl},this._trigActionComplete(c)))}},clearContents:function(t){if(!this.model.isReadOnly){t=this._getRangeArgs(t,"object");var r=this.getActiveSheetIndex(),u,f=this.getRangeData({range:t,property:["value","value2","type","hyperlink"]}),i={sheetIndex:r,reqType:"clear-content",range:t,bData:n.extend(!0,[],f)};this.model.allowClear&&!this._isPropExists([t],"isReadOnly",r)&&(this.clearRangeData(t,["value","value2","hyperlink"],"",!1,i.reqType),this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(t),this._completeAction(i),u={sheetIndex:i.sheetIndex,reqType:i.reqType,range:i.range,prevData:i.bData},this._trigActionComplete(u),this.setSheetFocus(),this.model.allowFormulaBar&&this.updateFormulaBar())}},clearAll:function(i){if(!this.model.isReadOnly){var e,o,l,c,s=this.getActiveSheetIndex(),h=this.getSheet(s),f=[],u=this._getRangeArgs(i,"object"),r={sheetIndex:s,reqType:"clear-all",range:u},a=this._dataContainer.sheets[s];if(this.model.allowClear&&!this._isPropExists([u],"isReadOnly",s)&&(this._dupDetails=!0,e=this.getObjectKeys(a),f[0]=u[0]>parseInt(e[0])?u[0]:parseInt(e[0]),f[2]=u[2]<parseInt(e[e.length-1])?u[2]:parseInt(e[e.length-1]),o=this.getObjectKeys(a[f[2]]),f[1]=u[1]>parseInt(o[0])?u[1]:parseInt(o[0]),f[3]=u[3]<parseInt(o[o.length-1])?u[3]:parseInt(o[o.length-1]),c=this._getAlphaRange(s,f[0],f[1],f[2],f[3]),!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(o))){if(r.bData=n.extend(!0,[],this.getRangeData({range:u,property:["value","value2","hyperlink","merge","rule","cFormatRule","comment","format","formatStr","formats","tformat","decimalPlaces","thousandSeparator","type","borders","tborders"],sheetIdx:s})),r.bBorder=this.XLFormat.getHashCodeClassAsArray(u),isTable=this._checkTableRange(c),isTable.status==="full")r.tblObj=isTable.tableObj,r.tblObj.tblId=isTable.tblId,r.tblObj.header=!0,this.XLFormat.removeTable(r.tblObj.tblId);else if(isTable.status==="partial")return;this.clearRangeData(u,["value","value2","hyperlink","cFormatRule","comment","format","formats","formatStr","decimalPlaces","thousandSeparator"],"",!1);this.clearBorder(c);this.model.allowFiltering&&this.XLFilter.clearFilter("remove");h._clrMergeColl=[];h._clrWrapColl=[];this.model.allowConditionalFormats&&this.XLCFormat.refreshCFormat(u);this.model.allowDataValidation&&this.XLValidate.clearDV();this._isPaste=!0;this.setWrapText("unwrap",u);this._isPaste=!1;this.unmergeCells(u);r.mergeColl=n.extend(!0,[],h._clrMergeColl);r.wrapColl=n.extend(!0,[],h._clrWrapColl);this._dupDetails=!1;this.model.showRibbon&&(this.XLRibbon._updateRibbonIcons(),this.XLRibbon._toggleDesignTab(this.getActiveCell()));this._completeAction(r);l={sheetIndex:r.sheetIndex,reqType:r.reqType,range:r.range,prevData:r.bData,prevBorder:r.bBorder,tblObj:r.tblObj,mergeColl:r.mergeColl,wrapColl:r.wrapColl};this._trigActionComplete(l)}}},_checkTableRange:function(n,t){var e,o=this.getActiveSheetIndex(),s=this.model.sheets[o],r,u,h=this.getRangeIndices(n),i,f;return t?i=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"tableName"):(f=this.XLEdit._getPropWithCellIdx(h,"tableName"),f.length&&(i=f[0].value)),i?(r=this._getTableID(i),u=s.tableManager[r],tRange=u.range,e=this._getAlphaRange(o,tRange[0],tRange[1],tRange[2],tRange[3]),n===e?{status:"full",tableObj:u,tblId:r}:{status:"partial"}):{status:"no-table"}},_checkFilterRange:function(n,t){var u,s=this.getActiveSheetIndex(),h=this.getSheet(s),i,c=this.getRangeIndices(n),f,e,o=h.filterSettings.tableRange,r;if(t?f=this.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"isFilterHeader"):(e=this.XLEdit._getPropWithCellIdx(c,"isFilterHeader"),e.length&&(f=e[0].value)),f){for(r=0;r<o.length;r++)if(o[r].tableID===-1)return i=o[r],u=this._getAlphaRange(s,i.startRow-1,i.multifilterIdx[0],i.endRow,i.multifilterIdx[i.multifilterIdx.length-1]),n===u?{status:"full",tRange:u,tblId:-1}:{status:"partial"};return{status:"no-table"}}return{status:"no-table"}},clearTextNode:function(n,i){if(!t.isNullOrUndefined(n)&&!this.model.isReadOnly){var r=this.getActiveSheetIndex(),u=n[0].parentNode.rowIndex,f=n[0].cellIndex,o=this._dataContainer.sheets[r],e=n[0].childNodes[n[0].childNodes.length-1];(i=i||"",this._checkIndicesInContainer(r,u,f,"rule")&&o[u][f].rule.type==="list")||t.isNullOrUndefined(e)||e.hasChildNodes("a")||(n[0].lastChild.textContent=i)}},_isClassHasProperty:function(n,t,i){var r=this.XLFormat.getFormatFromHashCode(n);return r[t]&&r[t].toLowerCase()===i?!0:!1},_changeTargetWithOffset:function(t){var r,i=n(t.target),u=t.offsetX||t.pageX-i.offset().left;if(this._hasClass(document.activeElement,"e-datepicker")&&t.type==="mouseup"&&n("#"+this._id).focus(),i.is("a")&&(r=t.target,t.target=t.target.parentNode),i.is("#"+this._id+"_MergeWrap"))return i.parents().closest("td")[0];if(this._hasClass(i.parents().closest("td"),"e-cellreadonly"))return this._hasClass(i,"e-datepicker")&&t.type==="mouseup"&&i.focus(),i.parents().closest("td")[0];if(i.is("td")&&this._hasClass(i,"e-cellreadonly")&&i.find(".e-chk-image").length>0&&t.type==="mouseup")return n("#"+i.find(".e-checkbox")[0].id).ejCheckBox("instance")._checkedHandler(),t.target;if((u>t.target.offsetWidth||u<0)&&i.is("td")&&i.parents(".e-spreadsheetmainpanel").length&&this._hasClass(i,"e-rowcell")){var f=this.getSheet(this.getActiveSheetIndex()),e=this._getCellIdx(t.target),o=f._colWidthCollection[e.colIndex]+u,s=f._rowHeightCollection[e.rowIndex];return r&&this.addClass(r,"e-rmanchor"),this.getCell(this.XLShape._getCellIndexFromOffset(s,o).rowIndex,this.XLShape._getCellIndexFromOffset(s,o).colIndex)[0]}return r?(this._removeClass(r,"e-rmanchor"),r):(this._removeClass(i.find("a")[0],"e-rmanchor"),t.target)},_textClip:function(n,i,r,u,f){var g,e,v,o;if(this._canOverflow&&!this.XLEdit.getPropertyValue(n,i,"merge")&&!this.XLEdit.getPropertyValue(n,i,"wrap")){var p,w,y,a,nt,l,et,it,ct,ot,c,st,rt,ut=!1,d=!1,b=!1,ht=!1,s=this.XLEdit,h=this.getActiveSheetIndex(),ft=this.getSheet(h),k=ft._isLoaded||this.isImport,g=this.getCell(n,i),tt=s.getPropertyValue(n,i,"format",h);if(g&&(y=g[0]),this._isClassHasProperty(tt,"text-align","right")&&(b=!0),!(s.getPropertyValue(n,i,"cellType",h)>-1)){if(this._dupDetails||(this._dupDetails=ut=!0),r==="add"){if(!this.model.allowOverflow){this.addClass(y,"e-overflow");s._updateDataContainer({rowIndex:n,colIndex:i},{dataObj:{isOverflow:!1},skipCell:!0});ut&&(this._dupDetails=!1);return}if(this._hasClass(y,"e-overflow")&&this._removeClass(y,"e-overflow"),this.clearRangeData([n,i,n,i],["isOverflow"],"","","",!0),s.getPropertyValue(n,i+1,"value2",h)&&!b&&(d=!0),d||(ct=ft._rowHeightCollection,ot=ft._ofColWidthColl,rt=y?this.XLFormat.getFormatFromHashCode(this.XLFormat.getFormatClass(y.className)):{},u||(span=document.getElementById(this._id+"_emptySpan"),this.addClass(span,"e-rowcell e-wrapword"),this.addClass(span,tt),span.textContent=s.getPropertyValue(n,i,"value2",h),u="text-indent"in rt?Math.round(4/3*Number(rt[t.Spreadsheet.SupportedStyles.TextIndent].replace("pt",""))+this._detailsFromGlobalSpan(n,i,"width",span.textContent)):span.offsetWidth),this._refreshGlobalSpan(span),et=this.XLShape._getCellIndexFromOffset(null,ot[i]+u,h,!0),w=et.colIndex-i),!f&&s.getPropertyValue(n,i,"value2",h)&&(c=s.getPropertyValue(n,i,"overflow",h),!t.isNullOrUndefined(c)&&c.rowIndex===n))if(it=this.getCell(c.rowIndex,c.colIndex),it&&this.addClass(it[0],"e-overflow"),s._updateDataContainer({rowIndex:c.rowIndex,colIndex:c.colIndex},{dataObj:{isOverflow:!1},skipCell:!0}),c.colIndex<i)for(e=0,v=c.cellCount;e<=v;e++)e!==0&&this.clearRangeData([n,c.colIndex+e,n,c.colIndex+e],["overflow"],"","","",!0),e!==v&&(a=this.getCell(n,c.colIndex+e),k&&a&&this._removeClass(a[0],"e-ofbrdr"),this.clearRangeData([n,c.colIndex+e,n,c.colIndex+e],["isOfBrdr"],"","","",!0));else for(e=c.cellCount;e>0;e--)this.clearRangeData([n,c.colIndex-e,n,c.colIndex-e],["overflow"],"","","",!0),a=this.getCell(n,c.colIndex-e),k&&a&&this._removeClass(a[0],"e-ofbrdr"),this.clearRangeData([n,c.colIndex-e,n,c.colIndex-e],["isOfBrdr"],"","","",!0);if(b||d){for(e=i-1,v=i-w;e>=v;e--)if(l=s.getPropertyValue(n,e,"overflow",h),l&&l.colIndex!==i&&!ht&&(ht=!0,this._textClip(l.rowIndex,l.colIndex,"delete","",!0),g=this.getCell(l.rowIndex,l.colIndex),g&&this.addClass(g[0],"e-overflow")),s.getPropertyValue(n,e,"value2",h)){d=!0;break}}else for(e=1;e<=w;e++)if(s.getPropertyValue(n,i+e,"value2",h)||s.getPropertyValue(n,i+e,"merge",h)||s.getPropertyValue(n,i+e,"isMHide",h)||s.getPropertyValue(n,i+e,"overflow",h)&&s.getPropertyValue(n,i+e,"overflow",h).colIndex!==i){d=!0;break}if(d)this.addClass(y,"e-overflow"),s._updateDataContainer({rowIndex:n,colIndex:i},{dataObj:{isOverflow:!1},skipCell:!0});else if(w!==0)for(e=0;e<=w;e++)nt=b?i-e:i+e,e&&s._updateDataContainer({rowIndex:n,colIndex:nt},{dataObj:{overflow:{rowIndex:n,colIndex:i,cellCount:w}},skipCell:!0}),((!b||b&&e!==0)&&e!==w||e===w&&b)&&(k&&this._isRowViewable(h,n)&&this.addClass(this.getCell(n,nt)[0],"e-ofbrdr"),s._updateDataContainer({rowIndex:n,colIndex:nt},{dataObj:{isOfBrdr:!0},skipCell:!0}))}else if(r==="delete"){if(st=this._dataContainer.sheets[h],keys=this.getObjectKeys(st[n]),this._hasClass(y,"e-overflow"))this._removeClass(y,"e-overflow"),this.clearRangeData([n,i,n,i],["isOverflow"],"","","",!0);else if(b){if(l=s.getPropertyValue(n,i-1,"overflow",h),!t.isNullOrUndefined(l)&&l.colIndex===i)for(o=i-1,v=i-l.cellCount;o>=v;o--)this.clearRangeData([n,o,n,o],["overflow"],"","","",!0),k&&(a=this.getCell(n,o),a&&this._removeClass(a[0],"e-ofbrdr")),this.clearRangeData([n,o,n,o],["isOfBrdr"],"","","",!0)}else if(l=s.getPropertyValue(n,i+1,"overflow",h),!t.isNullOrUndefined(l)&&l.colIndex===i)for(o=i,v=i+1+l.cellCount;o<v;o++)o!==i&&this.clearRangeData([n,o,n,o],["overflow"],"","","",!0),o!==v&&(k&&(a=this.getCell(n,o),a&&this._removeClass(a[0],"e-ofbrdr")),this.clearRangeData([n,o,n,o],["isOfBrdr"],"","","",!0));if(!f&&this.model.allowOverflow){for(o=keys.indexOf(i.toString())-1;o>-1;o--)if(k&&(p=this.getCell(n,keys[o])),s.getPropertyValue(n,keys[o],"value2",h)||s.getPropertyValue(n,keys[o],"isMHide",h)){this._hasClass(p,"e-overflow")&&(p&&this._removeClass(p[0],"e-overflow"),this.clearRangeData([n,keys[o],n,keys[o]],["isOverflow"],"","","",!0),this._textClip(n,parseInt(keys[o]),"add"));break}for(o=keys.indexOf(i.toString())+1;o<keys.length;o++)if(k&&(p=this.getCell(n,keys[o])),s.getPropertyValue(n,keys[o],"value2",h)||s.getPropertyValue(n,keys[o],"isMHide",h)){tt=s.getPropertyValue(n,keys[o],"format",h);this._hasClass(p,"e-overflow")&&this._isClassHasProperty(tt,"text-align","right")&&(p&&this._removeClass(p[0],"e-overflow"),this.clearRangeData([n,keys[o],n,keys[o]],["isOverflow"],"","","",!0),this._textClip(n,parseInt(keys[o]),"add"));break}}}ut&&(this._dupDetails=!1)}}},selectAll:function(n){if(this.model.allowSelection){var y=[],w=[],k=[],b=[],r,i,s,g=!1,p=0,v=this.XLEdit,nt=this.getActiveCell(),e=nt.rowIndex,o=nt.colIndex,a=this.getActiveSheetIndex(),rt=this._dataContainer.sheets[a],d=this.getObjectKeys(rt),ut=parseInt(d[0]),ft=parseInt(d[d.length-1]),c=this.getSheet(a),tt=this._getUsedRangeFromSheet(a,!1),it=tt.rowCount+tt.colCount;if(c._startCell.rowIndex!==c._endCell.rowIndex||c._startCell.colIndex!==c._endCell.colIndex&&c._isMultiSelect){var f={rowIndex:c._startCell.rowIndex,colIndex:c._startCell.colIndex},u={rowIndex:c._endCell.rowIndex,colIndex:c._endCell.colIndex},l={rowIndex:c._startCell.rowIndex,colIndex:c._startCell.colIndex},h={rowIndex:c._endCell.rowIndex,colIndex:c._endCell.colIndex};for(g=!0,r=1;r<it;r++){for(i=l.colIndex;i<h.colIndex+2;i++)(v.getPropertyValue(l.rowIndex-1,i,"value2")||this._getDataObj(l.rowIndex-1,i,"mergeIdx",a))&&(f.colIndex=l.colIndex<i?l.colIndex:i,u.colIndex=h.colIndex>i?h.colIndex:i,f.rowIndex=l.rowIndex<l.rowIndex-1?l.rowIndex:l.rowIndex-1);for(i=l.rowIndex;i<h.rowIndex+2;i++)(v.getPropertyValue(i,h.colIndex+1,"value2")||this._getDataObj(i,h.colIndex+1,"mergeIdx",a))&&(u.rowIndex=h.rowIndex>i?h.rowIndex:i);for(i=h.colIndex;i>l.colIndex-2;i--)(v.getPropertyValue(h.rowIndex+1,i,"value2")||this._getDataObj(h.rowIndex+1,i,"mergeIdx",a))&&(u.rowIndex=h.rowIndex>h.rowIndex+1?h.rowIndex:h.rowIndex+1,f.colIndex=l.colIndex<i?l.colIndex:i);for(i=h.rowIndex;i>l.rowIndex-2;i--)(v.getPropertyValue(h.rowIndex+1,i,"value2")||this._getDataObj(h.rowIndex+1,i,"mergeIdx",a))&&(u.rowIndex=h.rowIndex>h.rowIndex+1?h.rowIndex:h.rowIndex+1,f.colIndex=l.colIndex<i?l.colIndex:i);if(u.colIndex===h.colIndex&&u.rowIndex===h.rowIndex&&f.rowIndex===l.rowIndex&&f.colIndex===l.colIndex)if(r===1){c._isRangeSelected=!0;break}else{c._isRangeSelected=!1;break}l={rowIndex:f.rowIndex,colIndex:f.colIndex};h={rowIndex:u.rowIndex,colIndex:u.colIndex}}}if(!c._isRangeSelected&&!g){var f={rowIndex:e,colIndex:o},u={rowIndex:e,colIndex:o},l={rowIndex:e,colIndex:o},h={rowIndex:e,colIndex:o};for(r=1;r<it+1;r++){for(i=-p;i<p+1;i++)(v.getPropertyValue(e+i,o+r,"value2")||this._getDataObj(e+i,o+r,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+i?u.rowIndex:e+i,u.colIndex=u.colIndex>o+r?u.colIndex:o+r);for((v.getPropertyValue(e+r,o+r,"value2")||this._getDataObj(e+r,o+r,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+r?u.rowIndex:e+r,u.colIndex=u.colIndex>o+r?u.colIndex:o+r),i=-p;i<p+1;i++)(v.getPropertyValue(e+r,o+i,"value2")||this._getDataObj(e+r,o+i,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+r?u.rowIndex:e+r,u.colIndex=u.colIndex>o+i?u.colIndex:o+i);if(!v.getPropertyValue(e,o,"value2")&&u.colIndex===h.colIndex&&u.rowIndex===h.rowIndex&&f.rowIndex===l.rowIndex&&f.colIndex===l.colIndex&&p===0){c._isRangeSelected=!0;break}for((v.getPropertyValue(e+r,o-r,"value2")||this._getDataObj(e+r,o-r,"mergeIdx",a))&&(u.rowIndex=u.rowIndex>e+r?u.rowIndex:e+r,f.colIndex=f.colIndex<o-r?f.colIndex:o-r),i=-p;i<p+1;i++)(v.getPropertyValue(e+i,o-r,"value2")||this._getDataObj(e+i,o-r,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e+i?f.rowIndex:e+i,f.colIndex=f.colIndex<o-r?f.colIndex:o-r,u.rowIndex=u.rowIndex>e+i?u.rowIndex:e+i);for((v.getPropertyValue(e-r,o-r,"value2")||this._getDataObj(e-r,o-r,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e-r?f.rowIndex:e-r,f.colIndex=f.colIndex<o-r?f.colIndex:o-r),i=-p;i<p+1;i++)(v.getPropertyValue(e-r,o+i,"value2")||this._getDataObj(e-r,o+i,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e-r?f.rowIndex:e-r,f.colIndex=f.colIndex<o+i?f.colIndex:o+i,u.colIndex=u.colIndex>o+i?u.colIndex:o+i);if((v.getPropertyValue(e-r,o+r,"value2")||this._getDataObj(e-r,o+r,"mergeIdx",a))&&(f.rowIndex=f.rowIndex<e-r?f.rowIndex:e-r,u.colIndex=u.colIndex>o+r?u.colIdx:o+r),u.colIndex===h.colIndex&&u.rowIndex===h.rowIndex&&f.rowIndex===l.rowIndex&&f.colIndex===l.colIndex)if(p!==0){c._isRangeSelected=!1;break}else{c._isRangeSelected=!0;break}l={rowIndex:f.rowIndex,colIndex:f.colIndex};h={rowIndex:u.rowIndex,colIndex:u.colIndex};p++;y.push(u.colIndex);w.push(f.rowIndex);k.push(u.rowIndex);b.push(f.colIndex)}for(b=t.dataUtil.mergeSort(t.distinct(b)),f.colIndex=b[b.length-1],s=b.length-1;s>-1;s--)if(b[s-1]===b[s]-1)f.colIndex=b[s-1];else break;for(k=t.dataUtil.mergeSort(t.distinct(k)),u.rowIndex=k[0],s=0,len=k.length-1;s<len;s++)if(k[s+1]===k[s]+1)u.rowIndex=k[s+1];else break;for(w=t.dataUtil.mergeSort(t.distinct(w)),f.rowIndex=w[w.length-1],s=w.length-1;s>-1;s--)if(w[s-1]===w[s]-1)f.rowIndex=w[s-1];else break;for(y=t.dataUtil.mergeSort(t.distinct(y)),u.colIndex=y[0],s=0,len=y.length-1;s<len;s++)if(y[s+1]===y[s]+1)u.colIndex=y[s+1];else break;for(s=0,len=y.length-1;s<len;s++)if(y[s+1]===y[s]+1)u.colIndex=y[s+1];else break}c._isEmptyActiveCell||(!c._isRangeSelected&&!d.length<1?(this.XLSelection.selectRange(f,u,a,n),c._isMultiSelect=!1,c._startCell=f,c._endCell=u,c._isRangeSelected=!0,c._isEmptyActiveCell=v.getPropertyValue(e,o,"value2")?!1:!0):(this.XLSelection.selectSheet(),c._isRangeSelected=!0))}},_getDataObj:function(n,t,i,r){var u=this._dataContainer.sheets[r?r:this.getActiveSheetIndex()];return u[n]&&u[n][t]?u[n][t][i]:!1},_getUsedRangeFromSheet:function(n,t){n=this._getSheetIndex(n);var u,e=this.getSheet(n),s=this._dataContainer,o=s.sheets[n],f=this.getObjectKeys(o),r={rowIndex:parseInt(f[0])||0,colIndex:0},i={rowIndex:parseInt(f[f.length-1])||0,colIndex:0};for(u=0,length=f.length;u<length;u++)colKeys=this.getObjectKeys(o[parseInt(f[u])]),u===0?(r.colIndex=parseInt(colKeys[0]),i.colIndex=parseInt(colKeys[colKeys.length-1])):(r.colIndex=r.colIndex<parseInt(colKeys[0])?r.colIndex:parseInt(colKeys[0]),i.colIndex=i.colIndex>parseInt(colKeys[colKeys.length-1])?i.colIndex:parseInt(colKeys[colKeys.length-1]));return i.rowIndex<e.usedRange.rowIndex&&(i.rowIndex=e.usedRange.rowIndex),i.colIndex<e.usedRange.colIndex&&(i.colIndex=e.usedRange.colIndex),t?this._getAlphaRange(n,r.rowIndex,r.colIndex,i.rowIndex,i.colIndex):{startCell:r,endCell:i,rowCount:i.rowIndex-r.rowIndex+1,colCount:i.colIndex-r.colIndex+1}},sheetRename:function(n){this.model.isReadOnly||this._updateSheetNames(n)},_isSubMenuOpen:function(){for(var i=["_formatastable","_cellstyles","_Ribbon_CElement","_contextMenuCell","_contextMenuColumnHeader","_contextMenuRowHeader","_contextMenuFooter"],t=0,r=i.length;t<r;){if(n("#"+this._id+i[t]).is(":visible"))return!0;t++}return!1},copySheet:function(n,i,r){if(!this.model.isReadOnly){var y=this._getSheetIndex(y),u,f,a,e,v=!1,c=2,h,s=this.model.sheets,o=this.element.find(".e-numericcontainer").children().eq(n-1),l=i;if(!r&&s[l].sheetInfo.text===o.text()){this.setSheetFocus();return}for(f=1,a=s.length;f<a;f++)s.length-1!==l&&s[l].sheetInfo.text===s[f].sheetInfo.text&&(u=f),o.text()===s[f].sheetInfo.text&&(h=f);if(r){for(o.text().match(".*[ ]+[(]+[0-9]+[)]$")===null?e=o.text()+" ("+c+")":o.text().lastIndexOf(" ")>-1&&(c=parseInt(o.text().substring(o.text().lastIndexOf("(")+1,o.text().lastIndexOf(")"))),e=o.text().substring(0,o.text().lastIndexOf(" "))+" ("+c+")");!v;){for(e=e.substring(0,e.lastIndexOf(" "))+" ("+c+")",f=1,a=s.length;f<a;f++)e===s[f].sheetInfo.text&&c++;c===parseInt(e.substring(e.lastIndexOf("(")+1,e.lastIndexOf(")")))&&(v=!0)}this._copySheetProcess(h,e);h=this.model.sheetCount;t.isNullOrUndefined(u)&&(u=h)}else!t.isNullOrUndefined(u)&&u>h&&(u=u-1);t.isNullOrUndefined(u)&&(u=l);r||u!==h?(this._swapSheetDtCntr(h,u),this.getPager().ejPager("option",{currentPage:l}),this.gotoPage(l,!1),this.setSheetFocus()):this.setSheetFocus()}},getHyperlink:function(n){return this.XLEdit.getPropertyValueByElem(n,"hyperlink",this.getActiveSheetIndex())},getComment:function(n){return this.XLEdit.getPropertyValueByElem(n,"comment",this.getActiveSheetIndex())},saveAsJSON:function(){var nt,u,tt,w;if(!this.model.isReadOnly){var y,c,e=1,i,f,s,b,o,l,a,r,k=[],it,v,d,p,g,t,h,rt=["_activeCell","_endCell","_startCell","colCount","rowHeight","columnWidth","columnsWidthCollection","rowsHeightCollection","rowCount","frozenColumns","frozenRows","styleIndex","usedRange","sheetName","dataAttribute","filterSettings","tableManager","sheetInfo","hideColsCollection","hideRowsCollection","mergedCells","showGridlines","showHeadings","isSheetProtected","shapeMngr","pivotMngr","chart","rangeSettings","cellTypes","startCell","primaryKey","showHeader","fieldAsColumnHeader","headerStyles","rows"],ut=["type","value","value2","decimalPlaces","format","formats","borders","formatStr","comment","hyperlink","rule","cFormatRule","wrap","merge","picture","chart","pivot","thousandSeparator","isLocked","align","isRHide"];this._isSaveAsJSON=!0;this._isExport=!0;this.model.exportSettings.allowExporting&&this.XLExport._renderAll();this._isExport=!1;y={dataContainer:n.extend(!0,{},this._dataContainer),model:n.extend(!0,{},this.model)};f=y.dataContainer;s=y.model;it=b=f.hashCode.length;v=f.sheetCellType;f.sheetCellType={};for(t in f.hashCode)r=f.hashCode[t],r.indexOf("e-border")>-1&&r.length<25&&k.push(r);for(t=0;t<k.length;t++)f.hashCode.splice(f.hashCode.indexOf(k[t]),1);t="sheets";for(o in f[t])for(l in f[t][o]){for(a in f[t][o][l]){for(r in f[t][o][l][a])["format","formats","borders"].indexOf(r)>-1&&(nt=this._dataContainer.hashCode[this._dataContainer[t][o][l][a][r]],f[t][o][l][a][r]=f.hashCode.indexOf(nt)),ut.indexOf(r)<0&&delete f[t][o][l][a][r];this.getObjectLength(f[t][o][l][a])||delete f[t][o][l][a]}this.getObjectLength(f[t][o][l])||delete f[t][o][l]}for(t in s)s[t]===this.defaults[t]||Object.prototype.toString.call(s[t])===Object.prototype.toString()?delete s[t]:Array.isArray(s[t])&&(s[t].length||delete s[t]);for(c=s.sheets;e<c.length;){i=c[e];for(t in i){switch(t){case"frozenColumns":case"frozenRows":i[t]===0&&delete i[t];break;case"fieldAsColumnHeader":case"isSheetProtected":i[t]||delete i[t];break;case"showHeadings":case"showGridlines":case"showHeader":i[t]&&delete i[t];break;case"filterSettings":for(r in i[t])r==="range"?this._isEmptyString(i[t][r])&&delete i[t][r]:delete i[t][r];break;case"sheetInfo":for(r in i[t])if(r!=="text"){if(r==="isVisible"&&!i[t][r])continue;delete i[t][r]}break;case"_startCell":case"_endCell":case"_activeCell":case"usedRange":for(r in i[t])i[t][r]===0&&delete i[t][r];break;case"columnWidth":i[t]===64&&delete i[t];break;case"rowHeight":i[t]===20&&delete i[t];break;case"primaryKey":i[t].length||delete i[t];break;case"startCell":i[t]==="A1"&&delete i[t]}rt.indexOf(t)<0||i[t]===null?delete i[t]:Object.prototype.toString.call(i[t])===Object.prototype.toString()?this.getObjectLength(i[t])||delete i[t]:Array.isArray(i[t])&&(i[t].length||delete i[t])}if(p=c[e].shapeMngr.picture,g={},this.getObjectLength(p)){h=0;for(t in p)g["picture"+h]=p[t],h++;c[e].shapeMngr.picture=n.extend(!0,{},g)}if(charts=c[e].shapeMngr.chart,chartMngr={},this.getObjectLength(charts)){h=0;for(t in charts)u=n.extend(!0,{},charts[t]),tt={commonSeriesOptions:{type:u.type,marker:u.marker},enable3D:u.enable3D,top:u.top,left:u.left,size:{width:u.width,height:u.height},title:u.title,legend:u.legend,primaryXAxis:u.xAxis,primaryYAxis:u.yAxis,dataSheetIdx:u.dataSheetIdx,animation:u.animation,isRowColSwitched:u.isRowColSwitched,colIndex:u.colIndex,rowIndex:u.rowIndex,theme:u.theme,range:this._getAlphaRange(e,u.range[0],u.range[1],u.range[2],u.range[3])},u.colIndex&&u.rowIndex?f.sheets[e][u.rowIndex][u.colIndex].chart=[]:f.sheets[e][u.activeCell.rowIndex][u.activeCell.colIndex].chart=[],chartMngr["chart"+h]=tt,h++;c[e].shapeMngr.chart=chartMngr}if(tables=c[e].tableManager,tbMngr={},this.getObjectLength(tables)){h=0;for(t in tables){w=n.extend(!0,{},tables[t]);delete w.format;for(r in s.nameManager)s.nameManager[r].name===w.name&&s.nameManager.splice(parseInt(r),1);tbMngr[h]=w;h++}c[e].tableManager=tbMngr}i.cellTypes=[];b=this.getObjectLength(v);b&&(f.sheetCellType[e]={});h=1;for(t in v)(r=v[t],this.getObjectLength(r))&&(d=r.id.split("_")[2],o=parseInt(d.match(/[0-9]+/)[0]),e===o&&(delete r.id,r.range=d.replace(/[0-9]+/,""),f.sheetCellType[e][h]={settings:r},v[t]={},h++));c[e]._scrollTop=this.getSheet(e)._scrollTop;c[e]._scrollLeft=this.getSheet(e)._scrollLeft;e++}return this._isSaveAsJSON=!1,y}},_isvalidRange:function(n){var t=new RegExp(/^\$?(?:\b[a-z]{1,3})\$?(?:\d{1,7}):\$?(?:\b[a-z]{1,3})\$?(?:\d{1,7})$/i);return t.test(n)},_renderFUpload:function(){this.element.append(t.buildTag("div","",{height:"0px"},{id:this._id+"_file"}));n("#"+this._id+"_file").ejUploadbox({width:"0px",height:"0px",uploadName:"file",autoUpload:!0,showFileDetails:!1,dialogAction:{content:this.element},saveUrl:this.model.importSettings.importMapper,fileSelect:n.proxy(this._fileSelect,this),complete:n.proxy(this._changeImport,this),error:n.proxy(this._importFailed,this)});n("#"+this._id+"_file_SelectButton").hide()},_fileSelect:function(t){if(t.files.length){var r=t.files[0],i=r.extension;if(this._uploadImage&&i===".xlsx"||!this._uploadImage&&((this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10)?i.indexOf("jpg")>-1||i.indexOf("png")>-1||i.indexOf("jpeg")>-1||i.indexOf("gif")>-1:r.rawFile.type.indexOf("image")>-1))return this._showAlertDlg("Alert","CorrectFormat","",290),this._uploadImage=!1,!1;if(this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10||this._uploadImage)this.showWaitingPopUp();else return n("#"+this._id+"_file").ejUploadbox("option","autoUpload",!1),this["import"]({file:r.rawFile,password:this._encrypt(this.model.importSettings.password),allowSheetOnDemand:this.model.importSettings.allowSheetOnDemand}),this._uploadImage=!1,!1;this._uploadImage=!1}},_changeImport:function(t){var r,i=n("#"+this._id+"_file").data("ejUploadbox");((this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10)?t.files[0].extension.indexOf("jpg")>-1||t.files[0].extension.indexOf("png")>-1||t.files[0].extension.indexOf("jpeg")>-1||t.files[0].extension.indexOf("gif")>-1:t.files.rawFile.type.indexOf("image")>-1)?(i.updialog.ejDialog("close"),this.XLShape._insertPicture(t),this.model.showRibbon&&this.XLRibbon._formatTabUpdate(),i.option("autoUpload",!0)):(r=this._browserDetails.name==="msie"&&parseInt(this._browserDetails.version)<10?t.responseText:t.xhr.response,i.updialog.ejDialog("close"),this._importSuccess(r));this.hideWaitingPopUp()},_dlgBeforeOpen:function(){var t=n("#"+this._id+"_PasswordDialog").data("ejDialog");this.hideWaitingPopUp();n("#"+this._id+"_workBookName").text("'"+n("#"+this._id+"_file").data("ejUploadbox")._files[0].name+"'"+this._getLocStr("Protect"))},_dlgOk:function(){var t,i=n("#"+this._id+"_PasswordDialog").data("ejDialog"),r=n("#"+this._id+"_xlpassword"),u=n("#"+this._id+"_confirmpassword");t=n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").data("ejToggleButton");i.model.title==="Protect Workbook"?r.val().length&&u.val().length?r.val()===u.val()?(this.model.exportSettings.password=r.val(),n("#"+this._id+"_AddSheet").addClass("e-disable"),n("#"+this._id+"_confirm").hide(),i.option("title",this._getLocStr("UnProtectWorkbook"))):(n("#"+this._id+"_confirm").show(),this._showAlertDlg("Alert","PasswordAlert1"),t&&t.option("toggleState",!1),i.option("title",this._getLocStr("ProtectWorkbook"))):(n("#"+this._id+"_confirm").show(),t&&t.option("toggleState",!1),i.option("title",this._getLocStr("ProtectWorkbook")),this._showAlertDlg("Alert","PasswordAlert2")):i.model.title==="Unprotect Workbook"&&(this.model.exportSettings.password===r.val()?(n("#"+this._id+"_AddSheet").removeClass("e-disable"),this.model.exportSettings.password=null,n("#"+this._id+"_confirm").show(),i.option("title",this._getLocStr("ProtectWorkbook"))):(i.option("title",this._getLocStr("UnProtectWorkbook")),t&&t.option("toggleState",!0),this._showAlertDlg("Alert","PasswordAlert3")));r.val("");u.val("");n("#"+this._id+"_PasswordDialog").ejDialog("close")},_passwordDlg:function(){var n,f,i,r,u,e;n=t.buildTag("div","","",{id:this._id+"_PasswordDialog"});u=t.buildTag("div.e-dlg-btnfields");e=t.buildTag("div.e-dlg-btnctnr");f="<div class= 'e-dlgctndiv'><table><tr class= 'e-dlgtd-fields'><td><label>"+this._getLocStr("Password")+":<\/label><\/td><td><input id ='"+this._id+"_xlpassword' type ='password' class = 'ejinputtext'/><\/td><\/tr><tr class= 'e-dlgtd-fields' id ='"+this._id+"_confirm'><td><label>"+this._getLocStr("ConfirmPassword")+"<\/label><\/td><td><input id ='"+this._id+"_confirmpassword' type ='password' class = 'ejinputtext'/><\/td><\/tr><\/table><\/div>";n.append(f);i=t.buildTag("input","","",{type:"submit"});r=t.buildTag("input");i.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgOk,this),enabled:!0,cssClass:"e-ss-okbtn"});r.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._dlgCancel,this),showRoundedCorner:!0,width:60});u.append(e.append(i,r));n.append(u);n.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("ProtectWorkbook"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg e-ss-pwddlg",close:t.proxy(this._dlgCancel,this)})},_importPasswordDlg:function(){var i,e,r,u,f,o;return i=t.buildTag("div","","",{id:this._id+"_ImportPasswordDialog"}),f=t.buildTag("div.e-dlg-btnfields"),o=t.buildTag("div.e-dlg-btnctnr"),e="<div class= 'e-dlgctndiv'><table><tr class= 'e-dlgtd-fields'><td><label id ='"+this._id+"_workBookName' ><\/label><\/td><\/tr><tr class= 'e-dlgtd-fields'><td><label>"+this._getLocStr("Password")+":<\/label><\/td><td><input id ='"+this._id+"_importpassword' type ='password' class = 'ejinputtext'/><\/td><\/tr><\/table><\/div>",i.append(e),r=t.buildTag("input","","",{type:"submit"}),u=t.buildTag("input"),r.ejButton({text:this._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._importDlgOk,this),enabled:!0}),u.ejButton({text:this._getLocStr("Cancel"),click:t.proxy(this._dlgCancel,this),showRoundedCorner:!0,width:60}),f.append(o.append(r,u)),i.append(f),i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:this._getLocStr("Password"),beforeOpen:n.proxy(this._dlgBeforeOpen,this),width:420,height:"auto",cssClass:"e-ss-dialog e-"+this._id+"-dlg",close:t.proxy(this._dlgCancel,this)}),i},_dlgCancel:function(){this._showDialog(this._id+"_Ribbon_Review_Changes_ProtectWorkbook");var t=n("#"+this._id+"_PasswordDialog").data("ejDialog");t.model.title==="Protect Workbook"?n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").ejToggleButton("option","toggleState",!1):t.model.title==="Unprotect Workbook"&&n("#"+this._id+"_Ribbon_Review_Changes_ProtectWorkbook").ejToggleButton("option","toggleState",!0);n("#"+this._id+"_confirmpassword").val("");n("#"+this._id+"_xlpassword").val("");n("#"+this._id+"_importpassword").val("");n("#"+this._id+"_PasswordDialog").ejDialog("close");n("#"+this._id+"_ImportPasswordDialog").ejDialog("close")},_importDlgOk:function(){var t={},i=n("#"+this._id+"_importpassword");this.model.importSettings.password=i.val();i.val("");n("#"+this._id+"_ImportPasswordDialog").ejDialog("close");t.file=n("#"+this._id+"_file").data("ejUploadbox")._files[0].rawFile;t.password=this._encrypt(this.model.importSettings.password);t.allowSheetOnDemand=this.model.importSettings.allowSheetOnDemand;this["import"](t)},lockCells:function(n,t){if(!this.model.isReadOnly){var i,r,u=this.getActiveSheetIndex(),f=this.getSheet(u);if(r=t!=!1,this.model.allowLockCell&&!f.isSheetProtected){if(n=this._getRangeArgs(n,"object",u),i={reqType:"lockCells",range:n,isLock:r},this._trigActionBegin(i))return;if(n=i.range,r=i.isLock,r?this.updateUniqueData({isLocked:!0},n):this.clearRangeData(n,["isLocked"]),this.model.showRibbon&&this.XLRibbon._updateRibbonIcons(),i={reqType:"lockCells",range:n,isLocked:r},this._trigActionComplete(i))return}}},protectSheet:function(t){if(!this.model.isReadOnly){var i,r,f,u=this.getActiveSheetIndex(),o=this.getSheet(u),e=this.XLRibbon;if(r=t!==!1,this.model.allowLockCell){if(i={reqType:"protectSheet",isProtect:t,sheetIdx:u},this._trigActionBegin(i))return;if(r=i.isProtect,o.isSheetProtected=r,this.model.showRibbon&&(f=n("#"+this._id+"_Ribbon_Review_Changes_LockCell").data("ejToggleButton"),f&&f.option("enabled",!r),r?e._disableRibbonIcons():e._enableRibbonIcons(),e._updateRibbonIcons()),o._showLockCellAlert=!0,this.model.allowFormulaBar&&this.updateFormulaBar(),this.model.allowUndoRedo&&(this.model.sheetCount>1?this._removeUndoRedoForCurSheet(u,"undo"):(this._undoCollection=[],this._redoCollection=[])),i={reqType:"protectSheet",isSheetProtected:t,sheetIdx:u},!this._isSheetNavigate&&this._trigActionComplete(i))return}}},_readOnly:function(){var r=this.XLRibbon,u=n("#"+this._id+"_FRDialog_FPDlgTab").data("ejTab"),t=this.element.find("#"+this._id+"_Ribbon_BackStage"),i=this.element.find("#"+this._id+"_inputbox");this.model.isReadOnly?(r._disableRibbonIcons(),r.enableRibbonItems(["Spreadsheet_Ribbon_Home_Clipboard_Copy","Spreadsheet_Ribbon_Review_Comments_ShowAllComments","Spreadsheet_Ribbon_Others_Editing_FindSelect"]),this.XLCMenu&&this.XLCMenu._disableMenuOpt(["Replace","GoTo","GoToSpecial","Formulas","Comments","CFormat","Constants","DataValidation"],"Ribbon_FindRep"),t.length&&(t.find("#saveas_backStageTab").hide(),t.find("#print_backStageTab").hide()),this.addClass(this.element.find("#"+this._id+"_AddSheet")[0],"e-disable"),i.length&&(i[0].disabled=!0)):(r._enableRibbonIcons(),this.XLCMenu&&this.XLCMenu._enableMenuOpt(["Replace","GoTo","GoToSpecial","Formulas","Comments","CFormat","Constants","DataValidation"],"Ribbon_FindRep"),t.length&&(t.find("#saveas_backStageTab").show(),t.find("#print_backStageTab").show()),this._removeClass(this.element.find("#"+this._id+"_AddSheet")[0],"e-disable"),i.length&&(i[0].disabled=!1))},_isPropExists:function(n,t,i,r){for(var u,f,h,e,c,s=0,o=!1;s<n.length;){for(u=this.swapRange(n[s]),f=u[0],h=u[2];f<=h;){for(e=u[1],c=u[3];e<=c;){if(this.XLEdit.getPropertyValue(f,e,t,i)){r||(t==="isLocked"?this._popUplockCellAlert():t==="isReadOnly"&&this._showAlertDlg("Alert","ReadOnly","",400));o=!0;break}e++}if(o)break;f++}if(o)break;s++}return o},_isCellProtected:function(n,t,i){return this.model.allowLockCell&&this.getSheet(this.getActiveSheetIndex()).isSheetProtected&&this.XLEdit.getPropertyValue(n,t,"isLocked")?(i&&this._popUplockCellAlert(),!0):this.XLEdit.getPropertyValue(n,t,"isReadOnly")?(this._showAlertDlg("Alert","ReadOnly","",400),!0):void 0},_popUplockCellAlert:function(){this.getSheet(this.getActiveSheetIndex())._showLockCellAlert&&this._showAlertDlg("Alert","LockAlert","",500)},_removeUndoRedoForCurSheet:function(n,t){var r=t==="undo"?this._undoCollection:this._redoCollection,i=r.length;if(i)while(i--)n===r[i].sheetIndex&&r.splice(i,1);t==="undo"&&this._removeUndoRedoForCurSheet(n,"redo")},_detailsFromGlobalSpan:function(i,r,u,f,e,o){var s,h,f=f||"K",c="e-rowcell e-wrapword ",l=this.getRangeData({range:[i,r,i,r],property:["format","border","wrap"]})[0],v=l.format,y=l.border,p=l.wrap,a;return a=!t.isNullOrUndefined(e),s=a?n("#"+this._id+"_emptyDiv"):n("#"+this._id+"_emptySpan"),e&&(s[0].style.width=e-4+"px"),t.isNullOrUndefined(v)||(c+=v+" "),t.isNullOrUndefined(y)?s[0].className.indexOf("e-rowcell")>-1&&(s[0].style.borderRight=0):c+=y+" ",t.isNullOrUndefined(p)||(c+="e-sswraptext"),this.addClass(s[0],c),s[0].className.indexOf("e-rowcell")>-1&&(s[0].style.padding=0),s.text(f),u==="height"?(h=s.outerHeight(),!o&&this.model.rowHeight>h&&(h=this.model.rowHeight)):(h=s.outerWidth(),!o&&this.model.columnWidth>h&&(h=this.model.columnWidth)),this._refreshGlobalSpan(null,a),h},_encrypt:function(n){if(!t.isNullOrUndefined(n)){for(var r="",i=0;i<n.length;++i)r+=String.fromCharCode(129^n.charCodeAt(i));return r}},_writeRule:function(n,t){var i,r,t=this.getSheetElement(t).index()+1;r="#"+this._id+" .e-sheet:nth-child("+t+") .e-content td.e-rowcell:nth-of-type("+(n+1)+")";i=document.getElementById(this._id+"_sshide");i.sheet.insertRule(r+"{display: none}",i.sheet.cssRules.length)},_deleteRule:function(n,t){var t=this.getSheetElement(t).index()+1,r,u,i,s;r=document.getElementById(this._id+"_sshide");var f=r.sheet.cssRules,e=" .e-sheet:nth-child("+t+") ",o=".e-rowcell:nth-of-type("+(n+1)+")";for(this._browserDetails.name==="msie"&&(e=" :nth-child("+t+").e-sheet ",o=":nth-of-type("+(n+1)+").e-rowcell"),u="#"+this._id+e+".e-content td"+o,i=0,s=f.length;i<s;i++)if(f[i].selectorText===u){r.sheet.deleteRule(i);break}},_refreshRowHeight:function(n,t){var i=this.XLEdit.getPropertyValue(t,0,"pHeight"),r=this.getSheet(n);this.isUndefined(i)||(this.XLEdit._updateDataContainer({rowIndex:t,colIndex:0},{dataObj:{cHeight:i,pHeight:r.rowsHeightCollection[t]}}),r.rowsHeightCollection[t]=i,this._isRowViewable(n,t)&&(this.getRows(n)[1][this._getRowIdx(t)].style.height=i+"px"))},_batchAddRow:function(n,t,i,r){var c,f,o,u,s,h=0,e=n,a=this.getSheet(i),l=this.getDataSettings(i);if(l)while(e<=t){while(h<l.length)f=l[h],u=f.range,s=f.batchChanges.deleted,e>u[0]&&e<=u[2]+1?(o=u[0]?this._getPosDiff(e,u[0]):e,!f.fieldAsColumnHeader&&f.showHeader&&(o=o-1),c=this._getRowData(e,u[1],u[3],f),f._jsonData.splice(o,0,c),f._isDataManager&&(r?s.length?s.pop():s.push(c):f.batchChanges.added.push(f._jsonData[o])),u[2]++):e<=u[0]&&(u[2]++,u[0]++),h++;h=0;e++}},_batchDeleteRow:function(n,t,i,r){var s,f,h,u,o,l,c=0,e=t,v=this.getSheet(i),a=this.getDataSettings(i);if(a)while(e>=n){while(c<a.length)f=a[c],u=f.range,o=f.batchChanges.added,e>=u[0]&&e<=u[2]?(h=u[0]?this._getPosDiff(e,u[0]):e,!f.fieldAsColumnHeader&&f.showHeader&&(h=h-1),s=f._jsonData.splice(h,1)[0],f._isDataManager&&(r?o.length?(l=o.indexOf(s),l>-1&&o.splice(l,1)):o.push(s):f.batchChanges.deleted.push(s)),u[2]--):e<u[0]&&(u[2]--,u[0]--),c++;c=0;e--}},_updateBatchDetails:function(t,i,r){var o,l,u,s,f,e,h,a=!0,c=0,v=this.getSheet(r);if(settings=this.getDataSettings(r),settings)while(c<settings.length){if(setting=settings[c],u=setting.range,u&&this.inRange(u,t,i)){h=setting.batchChanges.changed;o=u[0]?this._getPosDiff(t,u[0]):t;l=u[1]?this._getPosDiff(i,u[1]):i;!setting.fieldAsColumnHeader&&setting.showHeader&&(t===u[0]?a=!1:o=o-1);a&&(e=setting._jsonData[o],s=setting.fields[l],f=this.getRangeData({range:[t,i,t,i],valueOnly:!0,sheetIdx:r,skipFormula:!0})[0],(this.isUndefined(f)||this._isEmptyString(f))&&(f=null),e[s]!==f&&(e[s]=f,!setting.primaryKey||s!==setting.primaryKey||this.XLEdit.getPropertyValue(t,i,"isReadOnly",r)||this.isUndefined(f)||this.XLEdit._updateDataContainer({rowIndex:t,colIndex:i},{dataObj:{isReadOnly:!0}}),setting._isDataManager&&n.inArray(e,h)===-1&&n.inArray(e,setting.batchChanges.added)===-1&&h.push(e)));break}c++}},_getRowData:function(n,i,r,u){for(var f,s={},e=i,o=0,c=this.getSheet(this.getActiveSheetIndex()),h=u.fields;e<=r;)f=this.getRangeData({range:[n,e,n,e],valueOnly:!0,skipDateTime:!0})[0],this._isEmptyString(f)&&(f=null),u.primaryKey&&h[o]===u.primaryKey&&t.isNullOrUndefined(f)&&(f=0),s[h[o]]=f,e++,o++;return s},saveBatchChanges:function(n){var e,r,i,o,u=0,s=this,t=this.getSheet(n),f=this.getDataSettings(n);if(f)while(u<f.length)setting=f[u],setting._isDataManager&&(i=setting.batchChanges,e={sheetIdx:n,dataSetting:setting,batchChanges:i},o=this._trigger("beforeBatchSave",e),!o&&(i.changed.length||i.added.length||i.deleted.length)&&(r=setting._dataManager.saveChanges(i,setting.primaryKey,setting.query._fromTable),setting._isOffline||(this.showWaitingPopUp(),r.done(function(){t._resCnt++;t._reqCnt===t._resCnt&&s.hideWaitingPopUp()}),r.fail(function(){t._resCnt++;t._reqCnt===t._resCnt&&s.hideWaitingPopUp()})),t._reqCnt++,setting.batchChanges={added:[],changed:[],deleted:[]})),u++},setReadOnly:function(n){this.updateUniqueData({isReadOnly:!0},n)},removeReadOnly:function(n){this.clearRangeData(n,["isReadOnly"])},_updateCustomFormulas:function(n,t){var r=this._calcEngine,u;for(var i in n)t==="add"&&this.isUndefined(this.getCalcEngine().getLibraryFunctions().getItem(n[i].formulaName))&&!this.XLEdit._isNamedRange("="+n[i].formulaName)?(u=r.addCustomFunction(n[i].formulaName,n[i].functionName),this._formulaCollection.push({text:"="+n[i].formulaName,display:n[i].formulaName})):t==="delete"&&r.getCustomLibraryFunctions().contains(n[i].formulaName)?u=r.removeFunction(n[i].formulaName,n[i].functionName):this._showAlertDlg("Alert","CorrectFormula","FormulaAlert",372);return u},addCustomFormula:function(n,t){if(!this.model.isReadOnly){var i=this._updateCustomFormulas([{formulaName:n,functionName:t}],"add");i&&(this.model.customFormulas.push({formulaName:n,functionName:t}),this.XLEdit._refreshAutoComplete())}},removeCustomFormula:function(n,t){if(!this.model.isReadOnly){var r=this._updateCustomFormulas([{formulaName:n.toUpperCase(),functionName:t}],"delete"),i;if(r){i=this.model.customFormulas;for(key in i)i[key].formulaName===n&&i.splice(1,parseInt(key));this._updateFormulaCollection();this.XLEdit._refreshCalcEngine(null,null,!1,null,null);this.XLEdit._refreshAutoComplete()}}},getValueFromFormulaArg:function(n){var f=1,s,c=this._getSheetIndex(),e=this._calcEngine,r,t,o={},u=[],i,h;for(r=n.split(e.getParseArgumentSeparator()),i=0,h=r.length;i<h;i++)u=u.concat(r[i].indexOf(":")>-1?e.getCellsFromArgs(r[i]):[r[i]]);for(s in u)t=e.getValueFromArg(u[s]),o["arg"+f]=this.XLEdit._parseValue(t).value,u.indexOf(t)>-1&&t[0]==='"'&&t[t.length-1]==='"'&&(o["arg"+f]=t.substring(1,t.length-1)),f++;return o},getCalcEngine:function(){return this._calcEngine}});t.Spreadsheet.Locale=t.Spreadsheet.Locale||{};t.Spreadsheet.Locale["default"]=t.Spreadsheet.Locale["en-US"]={Cut:"Cut",Copy:"Copy",FormatPainter:"Format Painter",Paste:"Paste",PasteValues:"Paste Values Only",PasteSpecial:"Paste",Filter:"Filter",FilterContent:"Turn on filtering for the selected cells.",FilterSelected:"Filter by Selected Cell's value",Sort:"Sort",Clear:"Clear",ClearContent:"Delete everything in the cell, or remove just the formatting, contents, comments or hyperlinks.",ClearFilter:"Clear Filter",ClearFilterContent:"Clear the filter and sort state for the current range of data.",SortAtoZ:"Sort A to Z",SortAtoZContent:"Lowest to Highest.",SortZtoA:"Sort Z to A",SortZtoAContent:"Highest to Lowest.",SortSmallesttoLargest:"Sort Smallest to Largest",SortLargesttoSmallest:"Sort Largest to Smallest",SortOldesttoNewest:"Sort Oldest to Newest",SortNewesttoOldest:"Sort Newest to Oldest",Insert:"Insert",InsertTitle:"Insert Cells",InsertContent:"Add new cells, rows, or columns to your workbook.",MultipleInsertContent:"FYI: To insert multiple rows or columns at a time, select multiple rows or columns in the sheet, and click Insert.",InsertSBContent:"Add cells, rows, columns, or sheets to your workbook.",Delete:"Delete",DeleteTitle:"Delete Cells",DeleteContent:"Delete cells, rows, columns, or sheets from your workbook. ",MultipleDeleteContent:"FYI: To delete multiple rows or columns at a time, select multiple rows or columns in the sheet, and click Delete.",FindSelectTitle:"Find & Select",FindSelectContent:"Click to see options for finding text in your document.",CalculationOptions:"Calculation Options",CalcOptTitle:"Calculation Options",CalcOptContent:"Choose to calculate formulas automatically or manually.",CalcOptRecalcContent:"If you make a change that affects a value, Spreadsheet will automatically recalculate it.",CalculateSheet:"Calculate Sheet",CalculateNow:"Calculate Now",CalculateNowContent:"Calculate the entire workbook now.",CalculateNowTurnOffContent:"You only need to use this if automatic calculation is turned off.",CalculateSheetContent:"Calculate the active sheet now.",CalculateSheetTurnOffContent:"You only need to use this if automatic calculation is turned off.",Title:"Spreadsheet",ColorPicker:"Color Picker",Ok:"OK",Cancel:"Cancel",Alert:"We couldn't do this for the selected range of cells. Select a single cell within a range of data and then try again.",HeaderAlert:"The command could not be completed as you are attempting to filter with the filter header. Select a single cell in the filter range and try the command again.",FlashFillAlert:"All the data next to your selection was checked and there was no pattern for filling in values.",Formatcells:"Format Cells",FontFamily:"Font",FFContent:"Pick a new font for your text.",FontSize:"Font Size",FSContent:"Change the size of your text.",IncreaseFontSize:"Increase Font Size",IFSContent:"Make your text a bit bigger.",DecreaseFontSize:"Decrease Font Size",DFSContent:"Make your text a bit smaller.",Bold:"Bold",Italic:"Italic",Underline:"Underline",Linethrough:"Linethrough",FillColor:"Fill Color",FontColor:"Font Color",TopAlign:"Top Align",TopAlignContent:"Align text to the top.",MiddleAlign:"Middle Align",MiddleAlignContent:"Align text so that it is centered between the top and bottom of the cell.",BottomAlign:"Bottom Align",BottomAlignContent:"Align text to the bottom.",WrapText:"Wrap Text",WrapTextContent:"Wrap extra-long text into multiple lines so you can see all of it.",AlignLeft:"Align Left",AlignLeftContent:"Align your content to the left.",AlignCenter:"Center",AlignCenterContent:"Center your content.",AlignRight:"Align Right",AlignRightContent:"Align your content to the right.",IncreaseIndent:"Increase Indent",IncreaseIndentContent:"Move your content farther away from the cell border.",DecreaseIndent:"Decrease Indent",DecreaseIndentContent:"Move your content closer to the cell border.",Undo:"Undo",Redo:"Redo",NumberFormat:"Number Format",NumberFormatContent:"Choose the format for your cells, such as percentage, currency, date or time.",AccountingStyle:"Accounting Style",AccountingStyleContent:"Format as dollar accounting number format.",PercentageStyle:"Percent Style",PercentageStyleContent:"Format as a percent.",CommaStyle:"Comma Style",CommaStyleContent:"Format with a thousands separator.",IncreaseDecimal:"Increase Decimal",IncreaseDecimalContent:"Show more decimal places for a more precise value.",DecreaseDecimal:"Decrease Decimal",DecreaseDecimalContent:"Show fewer decimal places.",AutoSum:"AutoSum",AutoSumTitle:"Sum",AutoSumContent:"Automatically add a quick calculation to your worksheet, such as sum or average.",Fill:"Fill",ExportXL:"Excel",ExportCsv:"CSV",ExportPdf:"PDF",SaveXml:"Save XML",BackgroundColor:"Fill Color",BGContent:"Color the background of the cells to make them stand out.",ColorContent:"Change the color of your text.",Border:"Border",BorderContent:"Apply borders to the currently selected cells.",BottomBorder:"Bottom Border",TopBorder:"Top Border",LeftBorder:"Left Border",RightBorder:"Right Border",OutsideBorder:"Outside Borders",NoBorder:"No Border",AllBorder:"All Borders",ThickBoxBorder:"Thick Box Border",ThickBottomBorder:"Thick Bottom Border",TopandThickBottomBorder:"Top and Thick Bottom Border",DrawBorderGrid:"Draw Border Grid",DrawBorder:"Draw Border",TopandBottomBorder:"Top and Bottom Border",BorderColor:"Line Color",BorderStyle:"Line Style",Number:"Number is used for general display of numbers. Currency and Accounting offer specialized formatting for monetary value.",General:"General format cells have no specific number format.",Currency:"Currency formats are used for general monetary values. Use Accounting formats to align decimal points in a column.",Accounting:"Accounting formats line up the currency symbols and decimal points in a column.",Text:"Text format cells are treated as text even when a number is in the cell. The cell is displayed exactly as entered.",Percentage:"Percentage formats multiply the cell value by 100 and displays the result with a percent symbol.",CustomMessage:"Type number format code, using one of existing codes as a starting point.",Fraction:"Fraction is used to indicate a part of a whole number or a ratio between two numbers.",Scientific:"Scientific is used to represent a decimal number between 1 and 10 multiplied by ten, so the large numbers using less digits.",Type:"Type:",CustomFormatAlert:"Enter a valid format",Date:"Date formats display date and time serial numbers as date values.",Time:"Time formats display date and time serial numbers as date values.",File:"FILE",New:"New",Open:"Open",SaveAs:"Save As",Print:"Print",PrintContent:"Print the current sheet.",PrintSheet:"Print Sheet",PrintSelected:"Print Selected",PrintSelectedContent:"Select an area on the sheet you would like to print.",HighlightVal:"Format Invalid Data",ClearVal:"Clear Validation",Validation:"Validation",DataValidation:"Data Validation",DVContent:"Pick from a list of rules to limit the type of data that can be entered in a cell.",A4:"A4",A3:"A3",Letter:"Letter",PageSize:"Page Size",PageSizeContent:"Choose a page size for your document.",FormatCells:"FormatCells",ConditionalFormat:"Conditional Formatting",CFContent:"Easily spot trends and patterns in your data using colors to visually highlight important values.",And:"and",With:"with",GTTitle:"Greater Than",GTContent:"Format cells that are GREATER THAN:",LTTitle:"Less Than",LTContent:"Format cells that are LESS THAN:",BWTitle:"Between",BWContent:"Format cells that are BETWEEN:",EQTitle:"Equal To",EQContent:"Format cells that are EQUAL TO:",DateTitle:"A Date Occurring",DateContent:"Format cells that contain a DATE:",ContainsTitle:"Text That Contains",ContainsContent:"Format cells that contain the text:",GreaterThan:"Greater Than",LessThan:"Less Than",Between:"Between",EqualTo:"Equal To",TextthatContains:"Text that Contains",DateOccurring:"A Date Occurring",ClearRules:"Clear Rules",ClearRulesfromSelected:"Clear Rules from Selected Cells",ClearRulesfromEntireSheets:"Clear Rules from Entire Sheet",CellStyles:"Cell Styles",CellStylesContent:"A colorful style is a great way to make important data stand out on the sheet.",CellStyleHeaderText:"Good, Bad and Neutral/Titles and Headings/Themed Cell Styles",Custom:"Type the number format code, using one of the existing codes as starting point.",CellStyleGBN:"Normal/Bad/Good/Neutral",CellStyleTH:"Heading 4/Title",CellsStyleTCS:"20% - Accent1/20% - Accent2/20% - Accent3/20% - Accent4/60% - Accent1/60% - Accent2/60% - Accent3/60% - Accent4/Accent1/Accent2/Accent3/Accent4",Style:"Style",FormatAsTable:"Format As Table",FormatasTable:"Format as Table",FATContent:"Quickly convert a range of cells to a table with its own style.",FATHeaderText:"Light/Medium/Dark",FATNameDlgText:"Table Name:/My table has headers",InvalidReference:"The range you have specified is invalid",ResizeAlert:"The specified range is invalid. The top of the table must remain in the same row, and the resulting table must overlap the original table. Specify a valid range.",RangeNotCreated:"Increasing the row beyond the maximum sheet rowcount is restricted in Format as Table.",ResizeRestrictAlert:"Increase or decrease of column count and decrease of row count is restricted in Format as Table.",FATResizeTableText:"Enter new data range for your table:",FATReizeTableNote:"Note: The headers must remain in the same row and the resulting table range must overlap the original table range.",FormatAsTableAlert:"Cannot create a table with a single row. A table must have at least two rows, one for the table header, and one for data",FormatAsTableTitle:"Light 1/Light 2/Light 3/Light 5/Light 8/Light 9/Light 10/Light 12/Light 15/Light 16/Light 17/Light 19/Medium 8/Medium 9/Medium 10/Medium 12/Medium 22/Medium 23/Medium 24/Medium 26/Dark 1/Dark 2/Dark 3/Dark 5",NewTableStyle:"New Table Style",ResizeTable:"Resize Table",ResizeTableContent:"Resize this table by adding or removing rows and columns.",ConvertToRange:"Convert to Range",ConvertToRangeContent:"Convert this table into a normal range of cells.",ConverToRangeAlert:"Do you want to convert the table to a normal range?",TableID:"Table ID:",Table:"Table",TableContent:"Create a table to organize and analyze related data.",TableStyleOptions:"First Column/Last Column/Total Row/Filter Button",Format:"Format",NameManager:"Name Manager",NameManagerContent:"Create, edit, delete and find all the names used in the workbook.",NameManagerFormulaContent:"Names can be used in formulas as substitutes for cell references.",DefinedNames:"Defined Names",DefineName:"Define Name",DefineNameContent:"Define and apply names.",UseInFormula:"Use In Formula",UseInFormulaContent:"Choose a name used in this workbook and insert it into the current formula.",RefersTo:"Refers To",Name:"Name",Scope:"Scope",NMNameAlert:"The name that you entered is not valid./Reason for this can include:/The name does not begin with a letter or an underscore/The name contains a space or other invalid characters/The name conflicts with a spreadsheet built-in name or the name of another object in the workbook",NMUniqueNameAlert:"The name entered already exists. Enter a unique name.",NMRangeAlert:"Enter a valid range",FORMULAS:"FORMULAS",Value:"Values",DataValue:"Values:",Formula:"Formulas",MissingParenthesisAlert:"Your formula is missing a parenthesis--) or (. Check the formula, and then add the parenthesis in the appropriate place.",UnsupportedFile:"Unsupported File",IncorrectPassword:"Unable to open the file or worksheet with the given password",InvalidUrl:"Please specify proper URL",Up:"Up",Down:"Down",Sheet:"Sheet",Workbook:"Workbook",Rows:"By Rows",Columns:"By Columns",FindReplace:"Find Replace",FindnReplace:"Find and Replace",Find:"Find",Replace:"Replace",FindLabel:"Find what:",ReplaceLabel:"Replace with:",ReplaceAll:"Replace All",Close:"Close",FindNext:"Find Next",FindPrev:"Find Prev",Automatic:"Automatic",Manual:"Manual",Settings:"Settings",MatchCase:"Match case",MatchAll:"Match entire cell contents",Within:"Within:",Search:"Search:",Lookin:"Look in:",ShiftRight:"Shift cells right",ShiftBottom:"Shift cells down",EntireRow:"Entire row",EntireColumn:"Entire column",ShiftUp:"Shift cells up",ShiftLeft:"Shift cells left",Direction:"Direction:",GoTo:"Go To",GoToName:"Go to:",Reference:"Reference:",Special:"Special",Select:"Select",Comments:"Comments",Formulas:"Formulas",Constants:"Constants",RowDiff:"Row differences",ColDiff:"Column differences",LastCell:"Last cell",CFormat:"Conditional formats",Blanks:"Blanks",GotoError:"Error",GotoLogicals:"Logicals",GotoNumbers:"Numbers",GotoText:"Text",FindSelect:"Find & Select",Comment:"Comment",NewComment:"New",InsertComment:"Insert Comment",EditComment:"Edit",DeleteComment:"Delete Comment",DeleteCommentContent:"Delete the selected comment.",HideComment:"Hide Comment",Next:"Next",NextContent:"Jump to the next comment.",Previous:"Previous",PreviousContent:"Jump to the previous comment.",ShowHide:"Show/Hide Comment",ShowHideContent:"Show or hide the comment on the active cell.",ShowAll:"Show All Comments",ShowAllContent:"Display all comments in the sheet.",UserName:"User Name",Hide:"Hide",Unhide:"Unhide",Add:"Add",DropAlert:"Do you want to replace the existing data?",PutCellColor:"Put Selected Cell Color To The Top",PutFontColor:"Put Selected Font Color To The Top",WebPage:"Web Page",WorkSheet:"Worksheet Reference",SheetReference:"Sheet Reference",InsertHyperLink:"Insert Hyperlink",HyperLink:"Hyperlink",EditLink:"Editlink",OpenLink:"Openlink",HyperlinkText:"Text:",RemoveLink:"Removelink",WebAddress:"Web Address:",CellAddress:"Cell Reference:",SheetIndex:"Select a place in this document",ClearAll:"Clear All",ClearFormats:"Clear Formats",ClearContents:"Clear Contents",ClearComments:"Clear Comments",ClearHyperLinks:"Clear Hyperlinks",SortFilter:"Sort & Filter",SortFilterContent:"Organize your data so it's easier to analyze.",NumberStart:"Minimum:",NumberEnd:"Maximum:",DecimalStart:"Minimum:",DecimalEnd:"Maximum:",DateStart:"Start Date:",DateEnd:"End Date:",ListStart:"Source:",FreeText:"Show error after invalid data is entered",ListEnd:"Cell Reference:",TimeStart:"Start Time:",TimeEnd:"End Time:",TextLengthStart:"Minimum:",TextLengthEnd:"Maximum:",CommentFindEndAlert:"Spreadsheet reached the end of the workbook. Do you want to continue reviewing from the beginning of the workbook?",InsertSheet:"Insert",DeleteSheet:"Delete",RenameSheet:"Rename",MoveorCopy:"Move or Copy",HideSheet:"Hide",UnhideSheet:"Unhide",SheetRenameAlert:"That name is already taken. Try a different one.",SheetRenameEmptyAlert:"You typed an invalid name for a sheet. Make sure that:",SheetRenameEmptyCharExceedAlert:"The name that you type does not exceed 31 characters.",SheetRenameEmptySplCharAlert:"The name does not contain any of the following characters: ",SheetRenameEmptyBlankAlert:"You did not leave the name blank.",SheetDeleteAlert:"You can't undo deleting sheets, and you might be removing some data. If you don't need it, click OK to delete.",SheetDeleteErrorAlert:"A workbook must contain at least one visible worksheet. To hide, delete, or move the selected sheet, you must first insert a new sheet or unhide a sheet that is already hidden.",CtrlKeyErrorAlert:"That command cannot be used on multiple selections.",ClipboardAccessError:"Your browser can't access the clipboard, so use these shortcuts:",ClipboardAccessCutError:"Cut = Ctrl + X",ClipboardAccessCopyError:"Copy = Ctrl + C",ClipboardAccessPasteError:"Paste = Ctrl + V",MoveToEnd:"Move To End",Beforesheet:"Before sheet:",CreateaCopy:"Create a copy",AutoFillOptions:"Copy Cells/Fill Series/Fill Formatting Only/Fill Without Formatting/Flash Fill",NumberValidationMsg:"Enter only digits",DateValidationMsg:"Enter only date",Required:"Required",TimeValidationMsg:"The time you entered for the Time is invalid.",CellAddrsValidationMsg:"Reference is not valid.",PivotTable:"Pivot Table",PivotTableContent:"Easily arrange and summarize complex data in a PivotTable.",NumberTab:"Number",AlignmentTab:"Alignment",FontTab:"Font",FillTab:"Fill",TextAlignment:"Text alignment",Horizontal:"Horizontal:",Vertical:"Vertical:",Indent:"Indent",TextControl:"Text Control",FontGroup:"Font:",FontStyle:"Font style:",Size:"Size:",PSize:"Page size",Effects:"Effects:",StrikeThrough:"Strikethrough",Overline:"Overline",NormalFont:"Normal font",Preview:"Preview",PreviewText:"AaBbCcYyZz",Line:"Line",Presets:"Presets",None:"None",Outline:"Outline",AllSide:"All sides",InsCells:"Insert Cells",InsRows:"Insert Sheet Rows",InsCols:"Insert Sheet Columns",InsSheet:"Insert Sheet",DelCells:"Delete Cells",DelRows:"Delete Sheet Rows",DelCols:"Delete Sheet Columns",DelSheet:"Delete Sheet",HyperLinkAlert:"The address of this site is not valid.Check the address and try again.",ReplaceData:"All done. We made / replacements.",NotFound:"We couldn't find what you were looking for. Select settings tab for more ways to search",Data:"Data:",Allow:"Allow:",IgnoreBlank:"Ignore blank",NotFind:"Unable to find the match to replace",FreezeTopRow:"Freeze Top Row",FreezeFirstColumn:"Freeze First Column",UnFreezePanes:"Unfreeze Panes",DestroyAlert:"Are you sure you want to destroy the current workbook without saving and create a new workbook?",ImageValAlert:"Upload image files only",Pictures:"Pictures",PicturesTitle:"From File",PicturesContent:"Insert pictures from computer or from other computers that you are connected to.",ImportAlert:"Are you sure you want to destroy the current workbook without saving and open a new workbook?",UnmergeCells:"Unmerge Cells",MergeCells:"Merge Cells",MergeAcross:"Merge Across",MergeAndCenter:"Merge & Center",MergeAndCenterContent:"Combine and center the contents of the selected cells in a new larger cell.",MergeCellsAlert:"Merging Cells keeps only upper left cell value and discards the other values.",MergeInsertAlert:"This operation will causes some merged cells to unmerge. Do you wish to continue ?",Axes:"Axes",PHAxis:"Primary Horizontal",PVAxis:"Primary Vertical",AxisTitle:"Axis Title",CTNone:"None",CTCenter:"Center",CTFar:"Far",CTNear:"Near",DataLabels:"Data Labels",DLNone:"None",DLCenter:"Center",DLIEnd:"Inside End",DLIBase:"Inside Base",DLOEnd:"Outside End",ErrorBar:"Error Bars",Gridline:"Gridlines",PMajorH:"Primary Major Horizontal",PMajorV:"Primary Major Vertical",PMinorH:"Primary Minor Horizontal",PMinorV:"Primary Minor Vertical",Legend:"Legends",LNone:"None",LLeft:"Left",LRight:"Right",LBottom:"Bottom",LTop:"Top",ChartTitleDlgText:"Enter Title",ChartTitle:"Title",InvalidTitle:"You typed an invalid name for the Title.",CorrectFormat:"Select the correct Format File",ResetPicture:"Reset Picture",ResetPictureContent:"Discard all of the formatting changes made to this picture.",PictureBorder:"Picture Border",PictureBorderContent:"Pick the color, width, and line style for the outline of your shape.",ResetSize:"Reset Picture & Size",Height:"Height",Width:"Width",ThemeColor:"Theme Colors",NoOutline:"No Outline",Weight:"Weight",Dashes:"Dashes",ColumnChart:"2-D Column/3-D Column",ColumnChartTitle:"Insert Column Chart",ColumnChartContent:"Use this chart type to visually compare values across a few categories.",BarChart:"2-D Bar/3-D Bar",BarChartTitle:"Insert Bar Chart",BarChartContent:"Use this chart type to visually compare values across a few categories when the chart shows duration or the category text is long.",StockChart:"Radar",StockChartTitle:"Insert Radar Chart",StockChartContent:"Use this chart type to show values relative to a center point.",LineChart:"2-D Line",LineChartTitle:"Insert Line Chart",LineChartContent:"Use this chart type to show trends over time (years, months, and days) or categories.",AreaChart:"2-D Area/3-D Area",AreaChartTitle:"Insert Area Chart",AreaChartContent:"Use this chart type to show trends over time (years, months, and days) or categories. Use it to highlight the magnitude of change over time.",ComboChart:"Combo",PieChart:"Pie",PieChartTitle:"Insert Pie/Doughnut Chart",PieChartContent:"Use this chart type to show proportions of a whole. Use it when the total of your numbers is 100%.",ScatterChart:"Scatter",ScatterChartTitle:"Insert Scatter (X, Y) Chart",ScatterChartContent:"Use this chart type to show the relationship between sets of values.",ClusteredColumn:"Clustered Column",StackedColumn:"Stacked Column",Stacked100Column:"100% Stacked Column",Cluster3DColumn:"3-D Clustered Column",Stacked3DColumn:"3-D Stacked Column",Stacked100Column3D:"3-D 100% Stacked Column",ClusteredBar:"Clustered Bar",StackedBar:"Stacked Bar",Stacked100Bar:"100% Stacked Bar",Cluster3DBar:"3-D Clustered Bar",Stacked3DBar:"3-D Stacked Bar",Stacked100Bar3D:"3-D 100% Stacked Bar",Radar:"Radar",RadarMarkers:"Radar with Markers",LineMarkers:"Line with Markers",Area:"Area",StackedArea:"Stacked Area",Stacked100Area:"100% Stacked Area",Pie:"Pie",Pie3D:"3-D Pie",Doughnut:"Doughnut",Scatter:"Scatter",ChartRange:"Chart Range",XAxisRange:"Enter X-axis range:",YAxisRange:"Enter Y-axis range:",LegendRange:"Enter legend range:",YAxisMissing:"Enter Y-axis range to create chart",InvalidYAxis:"Y-axis range must be within the selected range",InvalidXAxis:"X-axis range must be within the selected range",InvalidLegend:"Legend range must be within the selected range",InvalidXAxisColumns:"X-axis range should be within a single column",FreezePanes:"Freeze Panes",FreezePanesContent:"Freeze a portion of the sheet to keep it visible while you scroll through the rest of the sheet.",PasteTitle:"Paste (Ctrl+V)",PasteContent:"Add content on the Clipboard to your document.",PasteSplitContent:"Pick a paste option, such as keeping formatting or pasting only content.",CutTitle:"Cut (Ctrl+X)",CutContent:"Remove the selection and put it on the Clipboard so you can paste it somewhere else.",CopyTitle:"Copy (Ctrl+C)",CopyContent:"Put a copy of the selection on the Clipboard so you can paste it somewhere else.",FPTitle:"Format Painter",FPContent:"Like the look of a particular selection? You can apply that look to other content in the document.",BoldTitle:"Bold (Ctrl+B)",BoldContent:"Make your text bold.",ItalicTitle:"Italic (Ctrl+I)",ItalicContent:"Italicize your text.",ULineTitle:"Underline (Ctrl+U)",ULineContent:"Underline your text.",LineTrTitle:"Strike Through (Ctrl+5)",LineTrContent:"Cross something out by drawing a strike through it.",UndoTitle:"Undo (Ctrl+Z)",UndoContent:"Undo your last action.",RedoTitle:"Redo (Ctrl+Y)",RedoContent:"Redo your last action.",TableTitle:"Table (Ctrl+T)",HyperLinkTitle:"Add a Hyperlink (Ctrl+K)",HyperLinkContent:"Create a link in your document for quick access to webpages and files. ",HyperLinkPlaceContent:"Hyperlinks can also take you to places in your document.",NewCommentTitle:"Insert a Comment",NewCommentContent:"Add a note about this part of the document.",RefreshTitle:"Refresh",RefreshContent:"Get the latest data from the source connected to the active cell",FieldListTitle:"Field List",FieldListContent:"Show or hide the Field List.",FieldListRemoveContent:"The field list allows you to add and remove fields from your PivotTable report",AddChartElement:"Add Chart Element",AddChartElementContent:"Add elements to the created chart.",SwitchRowColumn:"Switch Row/ Column",SwitchRowColumnContent:"Swap the data over the axis.",MergeAlert:"We can't do that to a merged cell.",UnhideDlgText:"Unhide Sheet:",ChartThemes:"Chart Themes",ChartThemesContent:"Pick a new theme for your chart.",ChangePicture:"Change Picture",ChangePictureContent:"Change to a different picture, preserving the formatting and size of the current picture.",ChangeChartType:"Change Chart Type",SelectData:"Select Data",SelectDataContent:"Change the data range included in the chart.",Sum:"Sum",Average:"Average",CountNumber:"Count Numbers",Max:"Max",Min:"Min",ChartType:"Change Chart Type",ChartTypeContent:"Change to a different chart type.",AllCharts:"All Charts",defaultfont:"Default",LGeneral:"General",LCurrency:"Currency",LAccounting:"Accounting",LDate:"Date",LTime:"Time",LPercentage:"Percentage",LFraction:"Fraction",LScientific:"Scientific",LText:"Text",LCustom:"Custom",FormatSample:"Sample",Category:"Category:",Top:"Top",Center:"Center",Bottom:"Bottom",Left:"Left (Indent)",Right:"Right",Justify:"Justify",GeneralTxt:"General format cells have no specific number format.",NegativeNumbersTxt:"Negative Numbers",ThousandSeparatorTxt:"Use 1000 Separator",DecimalPlacesTxt:"Decimal Places:",TextTxt:"Text format cells are treated as text even when a number is in the cell. The cell is displayed exactly as entered.",BoldItalic:"Bold Italic",Regular:"Regular",HyperLinkHide:"<<Selection in Document>>",InvalidSheetIndex:"Specify proper SheetIndex",HugeDataAlert:"File too large to open.",ImportExportUrl:"Give import/export URL and try again.",TitleColumnChart:"Clustered Column/Stacked Column/100% Stacked Column/3D Clustered Column/3D Stacked Column/ 3D 100% Stacked Column",TitleBarChart:"Clustered Bar/Stacked Bar/100% Stacked Bar/3D Clustered Bar/3D Stacked Bar/3D 100% Stacked Bar",TitleRadarChart:"Radar/Radar with Markers",TitleLineChart:"Line/Line with Markers",TitleAreaChart:"Area/Stacked Area/100% Stacked Area",TitlePieChart:"Pie/3D Pie/Doughnut",TitleScatterChart:"Scatter",BetweenAlert:"The Maximum must be greater or equal to the Minimum.",BorderStyles:"Solid/Dashed/Dotted",FPaneAlert:"Freeze Pane is not applied for the First Cell",ReplaceNotFound:"Spreadsheet cannot find a match.",BlankWorkbook:"Blank workbook",SaveAsExcel:"Save As Excel",SaveAsCsv:"Save As CSV",SaveAsPdf:"Save As PDF",Design:"DESIGN",NewName:"New Name",FormulaBar:"Formula Bar",NameBox:"Name Box",NumberValMsg:"Decimal values cannot be used for number conditions.",NumberAlertMsg:"Enter only digits.",ListAlert:"Cell range is incorrect, Please enter correct cell range.",ListValAlert:"The list source must be a delimited list, or a reference to single row or column.",ListAlertMsg:"The value you entered is not valid",AutoFillTitle:"AutoFillOptions",NewSheet:"New Sheet",FullSheetCopyPasteAlert:"We can't paste because the Copy area and paste area aren't the same size.",Heading:"Headings",Gridlines:"Gridlines",Firstsheet:"Scroll to the first sheet",Lastsheet:"Scroll to the last sheet",Nextsheet:"Scroll to the next sheet",Prevsheet:"Scroll to the previous sheet",ProtectWorkbook:"Protect Workbook",UnProtectWorkbook:"Unprotect Workbook",ProtectWBContent:"Keep others from making structural changes to your workbook",Password:"Password",ConfirmPassword:"Reenter password to proceed:",PasswordAlert1:"Confirmation password is not identical.",PasswordAlert2:"Please enter a password.",PasswordAlert3:"The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.",Protect:"is protected.",Lock:"LockCell",Unlock:"UnlockCell",Protectsheet:"Protect Sheet",ProtectSheetToolTip:"Prevent unwanted changes from others by limiting their ability to edit",Unprotect:"Unprotect Sheet",LockAlert:"The cell you are trying to change is on protected sheet. To make changes, click Unprotect Sheet in the Review tab.",InsertDeleteAlert:"This operation is not allowed. The operation is attempting to shift cells in a table/Filter range on your worksheet.",CreateRule:"New Rule",NewRule:"New Formatting Rule",NewRuleLabelContent:"Format values where this formula is true:",ReadOnly:"The range you are trying to change contains readonly cells.",CreatePivotTable:"Create PivotTable",Range:"Range:",ChoosePivotTable:"Choose where you want the PivotTable to be placed",NewWorksheet:"New Worksheet",ExistingWorksheet:"Existing Worksheet",Location:"Location:",Refresh:"Refresh",PivotRowsAlert:"This command requires at least two rows of source data. You cannot use the command on a selection in only one row.",PivotLabelsAlert:"The PivotTable field name is not valid, To create a PivotTable report, you must use data that is organized as a list with labeled columns. If you are changing the name of a PivotTable field, you must type a new name for the field.",FieldList:"Field List",MergeSortAlert:"To do this, all the merged cells need to be the same size.",FormulaSortAlert:"The sort range with formula cannot be sorted.",MergePreventInsertDelete:"This operation is not allowed. The operation is attempting to shift a merge cells on your worksheet.",FormulaRuleMsg:"Please enter correct format.",MovePivotTable:"Move PivotTable",MovePivotTableContent:"Move the PivotTable to another location in the workbook.",ClearAllContent:"Remove fields and filters.",ChangeDataSource:"Modify",ChangeDataSourceContent:"Change the source data for this PivotTable",ChangePivotTableDataSource:"Change PivotTable Data Source",TotalRowAlert:"This operation is not allowed. The operation is attempting to shift cells in a table on your worksheet. Click OK to proceed with entire row.",CellTypeAlert:"This operation is not allowed in cell type applied range.",PivotOverlapAlert:"A PivotTable report cannot overlap another PivotTable report",NoCellFound:"No cells were found",CorrectArgument:"Please enter the correct argument",CorrectFormula:"Please enter the correct formula",CorrectCellAddress:"Please enter the correct cell address",ChartType:"Chart Type",NumberValidationAlert:"The Maximum must be greater than or equal to Minimum",DateValidationAlert:"The End Date must be greater than or equal to Start Date",TimeValidationAlert:"The End Time must be greater than or equal to Start Time",NewRuleAlert:"There's a problem with this formula",DragAlert:"The command could not be completed as you are attempting to move cells within the filter range. Select a range out of the filter range and try the command again.",OR:"or",HOME:"HOME",INSERT:"INSERT",DATATAB:"DATA",PAGELAYOUT:"PAGE LAYOUT",REVIEW:"REVIEW",OTHERS:"OTHERS",FORMAT:"Format",DESIGN:"DESIGN",CHARTDESIGN:"Chart Design",ANALYZE:"Analyze"};t.Spreadsheet.scrollMode={Normal:"normal",Infinite:"infinite"};t.Spreadsheet.AutoFillOptions={CopyCells:"copycells",FillSeries:"fillseries",FillFormattingOnly:"fillformattingonly",FillWithoutFormatting:"fillwithoutformatting",FlashFill:"flashfill"};t.Spreadsheet.autoFillDirection={Up:"up",Right:"right",Down:"down",Left:"left"};t.Spreadsheet.pageSize={A4:"A4",A3:"A3",Letter:"Letter"};t.Spreadsheet.Actions={Sorting:"sorting",Selection:"selection",AutoFill:"autofill",CellNavigation:"cellnavigation",Filtering:"filtering"};t.Spreadsheet.exportType={Excel:"Excel",Csv:"Csv",Pdf:"Pdf"};t.Spreadsheet.CustomCellType={Button:"Button",CheckBox:"CheckBox",DropDownList:"DropDownList",DatePicker:"DatePicker"};t.Spreadsheet.CellType={String:"string",Number:"number",Custom:"custom",Formula:"formula",Time:"time",LongDate:"longdate",ShortDate:"shortdate",Scientific:"scientific",Fraction:"fraction",Text:"text",General:"general",Accounting:"accounting",Currency:"currency",Percentage:"percentage",Date:"date",DateTime:"datetime"};t.Spreadsheet.SupportedStyles={FontFamily:"font-family",FontSize:"font-size",FontStyle:"font-style",FontWeight:"font-weight",TextAlign:"text-align",TextDecoration:"text-decoration",VerticalAlign:"vertical-align",TextIndent:"text-indent"};t.Spreadsheet.Validation={">":"GreaterThan",">=":"GreaterOrEqualTo","<":"LessThan","<=":"LessThanOrEqualTo","==":"EqualTo","!=":"NotEqualTo","!":"Not","=":""};t.Spreadsheet.ValidationText={">":"greater than",">=":"greater than or equal to","<":"less than","<=":"less than or equal to","==":"equal to","!=":"not equal to","!":" not","=":""};t.Spreadsheet.msg=" ";t.Spreadsheet.getMsg=function(){return t.Spreadsheet.msg};t.Spreadsheet.SelectionType={Row:"row",Column:"column",Default:"default"};t.Spreadsheet.SelectionUnit={Single:"single",Range:"range",MultiRange:"multirange"};t.Spreadsheet.Align={Left:"left",Right:"right",Center:"center"};t.Spreadsheet.CFormatRule={GreaterThan:"greaterthan",LessThan:"lessthan",Between:"between",EqualTo:"equalto",TextContains:"textcontains",DateOccur:"dateoccur"};t.Spreadsheet.ContextMenu={Cell:"cell",RowHeader:"rowheader",ColumnHeader:"columnheader",Footer:"footer"};t.Spreadsheet.CFormatHighlightColor={RedFillwithDarkRedText:"redft",YellowFillwithDarkYellowText:"yellowft",GreenFillwithDarkGreenText:"greenft",RedFill:"redf",RedText:"redt"};t.Spreadsheet.BorderType={Top:"top",Left:"left",Right:"right",Bottom:"bottom",OutSide:"outside",AllBorder:"allborder",ThickBox:"thickbox",ThickBottom:"thickbottom",TopandBottom:"topandbottom",TopandThickBottom:"topandthickbottom"};t.Spreadsheet.ChartProperties={PrimaryHorizontal:"PHAxis",PrimaryVertical:"PVAxis",PrimaryHorizontalAxisTitle:"PHAxisTitle",PrimaryVerticalAxisTitle:"PVAxisTitle",TitleNone:"CTNone",TitleCenter:"CTCenter",TitleFar:"CTFar",TitleNear:"CTNear",DataLabelNone:"DLNone",DataLabelCenter:"DLCenter",DataLabelInsideBase:"DLIBase",DataLabelInsideEnd:"DLIEnd",DataLabelOutsideEnd:"DLOEnd",PrimaryMajorHorizontal:"PMajorH",PrimaryMajorVertical:"PMajorV",PrimaryMinorHorizontal:"PMinorH",PrimaryMinorVertical:"PMinorV",LegendsNone:"LNone",LegendsLeft:"LLeft",LegendsRight:"LRight",LegendsBottom:"LBottom",LegendsTop:"LTop"};t.Spreadsheet.HideTypes={Default:"default",Freeze:"freeze"}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.selection=function(n){this.XLObj=n;this._isRightClick=!1;this._colhdrClick=!1;this._rowhdrClick=!1;this._aFillDownHandler=!1;this._isOutsideBordering=!1;this._isGridBordering=!1;this._isRowSelected=!1;this._isColSelected=!1;this._isEndReached=!0;this._canTouchMove=!1};t.spreadsheetFeatures.selection.prototype={_selectionMouseDownHandler:function(i){var e,o,r=this.XLObj,f=r.getSheet(),u=i.target;r._isTouchEvt?(r._browserDetails.name==="msie"&&i.preventDefault(),(r._isSelected(i.target)||r._hasClass(i.target,"e-autofill"))&&(e=r._getBrowserEvt("move"),this._canTouchMove=!0),o=r._getBrowserEvt("end")):(i.preventDefault(),e=r._getBrowserEvt("move",!0),o=r._getBrowserEvt("end",!0)+" mouseleave");r._on(n(document),o,this._mouseUpHandler);i.which===3||i.button===2||r.model.selectionSettings.selectionUnit===t.Spreadsheet.SelectionUnit.Single?this._isRightClick=!0:e&&r._on(r.element,e,this._mouseMoveHandler);u.tagName=="TD"?(r.XLEdit._isFormulaEdit?(i.ctrlKey&&(this._clearBorder(r._arrayAsString(r._ctrlFormulaBorder)),r._ctrlKeyCount=r._formulaRange.length),r._dStartCell=r._getCellIdx(u)):i.shiftKey&&f._startCell.rowIndex!=-1?f._endCell=r._getCellIdx(u):(f._startCell=r._getCellIdx(u),f._activeCell=r._getCellIdx(u)),u.className.indexOf("e-rowheader")>-1&&(this._rowhdrClick=!0)):u.parentNode.tagName=="TH"?(i.shiftKey&&f._startCell.rowIndex!=-1?f._endCell={rowIndex:0,colIndex:u.parentNode.cellIndex}:(f._startCell={rowIndex:0,colIndex:u.parentNode.cellIndex},f._activeCell={rowIndex:0,colIndex:u.parentNode.cellIndex}),u.className.indexOf("e-headercelldiv")>-1&&(this._colhdrClick=!0)):u.className=="e-autofill"&&(this._aFillDownHandler=!0)},_mouseMoveHandler:function(i){var o,l,a,u=this,e=u.XLSelection,s=u.getActiveSheetIndex(),r=u.getSheet(s),f=i.target,v,h=u.model.selectionSettings.selectionType,c=t.Spreadsheet.SelectionType,y=n(i.target).get(0);if(!u._isTouchEvt||(u._isTouchMoveSel=!0,l=u._getOriginalEvt(i),f=document.elementFromPoint(l.clientX,l.clientY),f))if(n(f).hasClass("e-rowcell")||n(f).hasClass("e-rowheader")){if(this.XLSelection._isEndReached=!1,u._getContent(s).find("td").removeClass(u._ctrlFormulaBorder[u._ctrlKeyCount%6].join(" ")),u.XLEdit._isFormulaEdit){i.ctrlKey?(u._dEndCell=u._getCellIdx(f),e._processFormulaRange(u._ctrlFormulaBorder,!0)):(u._dEndCell=u._getCellIdx(f),e._processFormulaRange(u._ctrlFormulaBorder,!0));return}if(e._aFillDownHandler&&n(f).parents(".e-rowheadercontent").length===0){if(u.model.allowAutoFill){a=u._getCellIdx(i.target);r._isFreezed&&a.rowIndex<=r.frozenRows&&r._hiddenFreezeRows.indexOf(r.frozenRows)>-1?e._scrollCalculation(s,f,{position:"vertical",action:"Decrement"}):r._isFreezed&&a.colIndex<=r.frozenColumns&&r._hiddenFreezeCols.indexOf(r.frozenColumns)>-1?e._scrollCalculation(s,f,{position:"horizontal",action:"Decrement"}):u.XLDragFill._selectAutoFillRange(f);return}}else if(r._startCell=r._activeCell,r._endCell=u._getCellIdx(f),r._isFreezed&&u.XLFreeze._selectionScroll(),e._processBoundary(),n(f).parents(".e-spreadsheetcontentcontainer").length>0){if(i.ctrlKey&&u.model.selectionSettings.selectionType===t.Spreadsheet.SelectionType.Default&&u.model.selectionSettings.selectionUnit===t.Spreadsheet.SelectionUnit.MultiRange){u._getContent(u.getActiveSheetIndex()).find("td").removeClass("e-activecell e-focusright e-focusbottom");v=u.swapRange([r._startCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex]);u.getRange(v).addClass("e-ctrlselected");e._focusRange(r._startCell,r._endCell,u._selectionBorder);u.model.allowAutoFill&&u.XLDragFill.hideAutoFillElement();return}h===c.Row||e._rowhdrClick?e.selectRows(r._startCell.rowIndex,r._endCell.rowIndex):h===c.Column||e._colhdrClick?e.selectColumns(r._startCell.colIndex,r._endCell.colIndex):e.selectRange(r._startCell,r._endCell,f);r._isFreezed&&u.XLFreeze._refreshSelection()}else if(n(f).parents(".e-rowheadercontent").length>0)e._colhdrClick||e._rowhdrClick?(h===c.Column?e.selectColumns(0,r.colCount-1):e.selectRows(r._startCell.rowIndex,r._endCell.rowIndex),r._isFreezed&&u.XLFreeze._refreshSelection()):(o={position:"horizontal",action:"Decrement"},e._scrollCalculation(s,f,o));else return}else if(t.isNullOrUndefined(f.parentNode)||f.parentNode.tagName!="TH")if(y.id.indexOf("chart")<1&&(f.className.indexOf("e-hhandlespace")>-1||f.className.indexOf("e-hhandle")>-1||f.className.indexOf("e-hup")>-1||f.className.indexOf("e-hdown")>-1))o={position:"vertical",action:"Increment"},e._scrollCalculation(s,f,o);else if(y.id.indexOf("chart")<1&&(f.className.indexOf("e-vhandlespace")>-1||f.className.indexOf("e-vhandle")>-1||f.className.indexOf("e-vup")>-1||f.className.indexOf("e-vdown")>-1))o={position:"horizontal",action:"Increment"},e._scrollCalculation(s,f,o);else return;else r._endCell={rowIndex:0,colIndex:f.parentNode.cellIndex},r._startCell=r._activeCell,r._isFreezed&&u.XLFreeze._selectionScroll(),e._processBoundary(),e._colhdrClick||e._rowhdrClick?(h===c.Row?e.selectRows(0,r.rowCount-1):e.selectColumns(r._startCell.colIndex,r._endCell.colIndex),r._isFreezed&&u.XLFreeze._refreshSelection()):(o={position:"vertical",action:"Decrement"},e._scrollCalculation(s,f,o))},_mouseUpHandler:function(i){i.target=this._changeTargetWithOffset(i);var e,h,v,l,k,d,a,o,g,nt,y,tt,it,p=!0,r=this,u=r.XLSelection,s=r.getActiveSheetIndex(),f=r.getSheet(s),rt=f.selectedRange,ut=r.getSheetElement(s),w=r.model.selectionSettings.selectionType,ft=f._startCell,et=f._endCell,b=t.Spreadsheet.SelectionType,c=r._getJSSheetContent(s).find(".e-spreadsheetcontentcontainer > .e-content");if(r.XLEdit._isEdit||r.setSheetFocus(),r._isTouchEvt?(tt=r._getBrowserEvt("end"),u._canTouchMove&&(y=r._getBrowserEvt("move")),r._isTouchMoveSel=!1):(y=r._getBrowserEvt("move",!0),tt=r._getBrowserEvt("end",!0)+" mouseleave"),y&&r._off(r.element,y,u._mouseMoveHandler),r._off(n(document),tt,u._mouseUpHandler),r._isTouchEvt){if(!u._aFillDownHandler&&r._isTouchScroll||!u._canTouchMove&&!r._isUniqueTarget(r._touchArgs,i)){u._canTouchMove=r._isTouchScroll=!1;return}if(u._canTouchMove=r._isTouchScroll=!1,it=r._getOriginalEvt(i),e=document.elementFromPoint(it.clientX,it.clientY),!e){this.model.allowAutoFill&&this.XLDragFill.positionAutoFillElement();return}}if(e=e||i.target,h=n(e),e.tagName=="TD"||e.tagName=="INPUT"&&!h.parents(".e-formulabar").length||u._aFillDownHandler){if(h.parents(".e-rowheadercontent").length&&(u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor")),r._preventctrlkey=i.ctrlKey,r.XLEdit._isFormulaEdit){c.find("td").removeClass(r._ctrlFormulaBorder.join(" ").replace(/,/g," "));i.ctrlKey?(r._dEndCell=r._getCellIdx(e),u._processFormulaRange(r._formulaBorder)):(u._clearBorder(r._formulaBorder.join(" ").replace(/,/g," ")+" "+r._ctrlFormulaBorder.join(" ").replace(/,/g," ")),r._ctrlKeyCount=0,r._dEndCell=r._getCellIdx(e),u._processFormulaRange(r._formulaBorder),r._formulaRange=[]);r._formulaRange.push(r._getProperAlphaRange(s,r._dStartCell.rowIndex,r._dStartCell.colIndex,r._dEndCell.rowIndex,r._dEndCell.colIndex));return}if(u._aFillDownHandler){if(a=e.tagName==="TD"?r._getCellIdx(e):r._dautoFillCell,r.model.allowAutoFill&&(o=r.XLDragFill._getAutoFillRange(a)),!o||!o.fillRange){u._aFillDownHandler=!1;r.XLDragFill.positionAutoFillElement();return}if(k=r.swapRange(o.fillRange),r.model.allowLockCell&&r.getSheet(s).isSheetProtected&&r._isPropExists([k],"isLocked",s)&&(p=!1),p&&r._isPropExists([k],"isReadOnly",s)&&(p=!1),p)"direction"in o?(r._pStartCell=f._startCell,r._pEndCell=f._endCell,r._pFillCell=a,r.inRange(f.selectedRange,a.rowIndex,a.colIndex)?r.clearRangeData(null,null,n(u.getSelectedCells()).not(".e-autofillcell")):r.model.allowAutoFill&&r.XLDragFill.autoFill({dataRange:f.selectedRange,fillRange:o.fillRange,direction:o.direction,fillType:r.model.autoFillSettings.fillType}),f._startCell=o.startCell,f._endCell=o.endCell):u._aFillDownHandler=!1;else{u._aFillDownHandler=!1;r.XLSelection.selectRange(ft,et);r.XLDragFill.positionAutoFillElement();return}u.refreshSelection(r.swapRange([o.startCell.rowIndex,o.startCell.colIndex,o.endCell.rowIndex,o.endCell.colIndex]))}else if(u._isOutsideBordering||u._isGridBordering)if(l="1px "+r._borderStyle+" "+r._borderColor,u._isRightClick?f._endCell=f._startCell:(f._startCell=f._activeCell,f._endCell=r._getCellIdx(e),u._processBoundary()),h.parents(".e-spreadsheetcontentcontainer").length)g={top:l,right:l,bottom:l,left:l},u._isGridBordering&&(g.isGridBorder=!0),r.XLFormat.applyBorder(g,r.swapRange([f._startCell.rowIndex,f._startCell.colIndex,f._endCell.rowIndex,f._endCell.colIndex])),u._cleanUp(!0);else return;else if(e.tagName=="INPUT"&&h.parents("tr").length?f._endCell=u._isRightClick?f._startCell:r._getCellIdx(h.parents("td")[0]):u._isRightClick?f._endCell=f._startCell:(f._startCell=f._activeCell,f._endCell=r._getCellIdx(e),u._processBoundary()),h.parents(".e-spreadsheetcontentcontainer").length){if(i.ctrlKey&&r.model.selectionSettings.selectionType===t.Spreadsheet.SelectionType.Default&&r.model.selectionSettings.selectionUnit===t.Spreadsheet.SelectionUnit.MultiRange){c.find("td").removeClass("e-activecell e-focustop e-focusleft e-ctrlselected");rt=r.swapRange([f._startCell.rowIndex,f._startCell.colIndex,f._endCell.rowIndex,f._endCell.colIndex]);r.getRange(rt).addClass("e-selected");r.getCell(f._activeCell.rowIndex,f._activeCell.colIndex).addClass("e-activecell");u._focusRange(f._startCell,f._endCell,r._selectionBorder);r.model.allowAutoFill&&r.XLDragFill.hideAutoFillElement();r.getSheet(s)._selectedCells.push(r._getSelectedRange(r.getSheet(s)._startCell,r.getSheet(s)._endCell));r.model.showRibbon&&r.model.allowComments&&ut.find(".e-selected.e-commentcell").length&&r.XLRibbon._enableButtons(["Review_Comments_DeleteComment"],"ejButton");return}w===b.Row||u._rowhdrClick?u.selectRows(f._startCell.rowIndex,f._endCell.rowIndex):w===b.Column||u._colhdrClick?u.selectColumns(f._startCell.colIndex,f._endCell.colIndex):u.selectRange(f._startCell,f._endCell,e);f._isFreezed&&r.XLFreeze._refreshSelection()}else if(h.parents(".e-rowheadercontent").length)(u._colhdrClick||u._rowhdrClick)&&(w===b.Column?u.selectColumns(0,f.colCount-1):u.selectRows(f._startCell.rowIndex,f._endCell.rowIndex),u._hdrClick=!1),u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor");else return;e.tagName==="TD"&&r.model.showRibbon&&(nt=n("#"+r._id+"_Ribbon_clearfilter").data("ejButton"),nt&&r.XLRibbon._changeClrFltrStatus(nt,"button",r._getCellIdx(e)))}else u._aFillDownHandler||t.isNullOrUndefined(e.parentNode)||e.parentNode.tagName!="TH"?typeof e.className!="object"&&e.className&&e.className.indexOf("e-spreadsheetcolumnheader")>-1&&(u.selectSheet(!0),u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor")):(f._startCell=f._activeCell,f._endCell=u._isRightClick?f._startCell:{rowIndex:0,colIndex:e.parentNode.cellIndex},u._processBoundary(),(u._colhdrClick||u._rowhdrClick)&&(w===b.Row?u.selectRows(0,f.rowCount-1):u.selectColumns(f._startCell.colIndex,f._endCell.colIndex)),u._isOutsideBordering=u._isGridBordering=!1,c.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor").addClass("e-ss-cursor"));r.model.allowCellFormatting&&r.XLFormat._formatEnable&&r.XLFormat._fPMouseUp(i);r.model.showRibbon&&(r.XLEdit._isEdit?r.XLRibbon._disableRibbonIcons():r.XLRibbon._updateRibbonIcons());!r.model.allowAutoFill||u._isOutsideBordering||u._isGridBordering||r.XLDragFill.positionAutoFillElement(u._aFillDownHandler);u._isRightClick=u._aFillDownHandler=!1;u._colhdrClick=u._rowhdrClick=!1;r.model.showRibbon&&(v=n("#"+r._id+"_Ribbon_merge").data("ejSplitButton"),t.isNullOrUndefined(v)||!r.model.allowLockCell||f.isSheetProtected||(r.XLRibbon._isDirtySelect?v.option("enabled",!1):v.option("enabled",!0)));r.model.allowEditing&&this.XLEdit._isEdit&&(d=r.getSheet(s)._startCell,r.getCell(d.rowIndex,d.colIndex).find(".e-ss-input").focus())},_processBoundary:function(){var u,o,f,t,e,r,s=[],i=this.XLObj,c=i.getActiveSheetIndex(),h=i.getSheet(c),l=h._startCell,a=h._endCell,n=i.swapRange([l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]);for(h._startCell={rowIndex:n[0],colIndex:n[1]},h._endCell={rowIndex:n[2],colIndex:n[3]},t=i._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[0],colIndex:n[3]}),t=t.concat(i._getSelectedRange({rowIndex:n[0],colIndex:n[3]},{rowIndex:n[2],colIndex:n[3]})),t=t.concat(i._getSelectedRange({rowIndex:n[2],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]})),t=t.concat(i._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[1]})),u=t.length;u--;)if(f=t[u],e=i.XLEdit.getPropertyValue(t[u].rowIndex,t[u].colIndex,"mergeIdx",c),r=(f.rowIndex+":"+f.colIndex).toString(),o=i.hasSpan(f)&&s.indexOf(r)===-1&&(s.push(r),this._updateRange(f,n)),e&&(r=(e.rowIndex+":"+e.colIndex).toString(),s.indexOf(r)===-1&&(s.push(r),o=this._updateRange(e,n))),o)break;o&&this._processBoundary()},_updateRange:function(n,t){var r=this.XLObj,c=r.getActiveSheetIndex(),u=r.getSheet(c),i=t.slice(0),f=r._getMergedIdx(n.rowIndex,n.colIndex),e=n.rowIndex,o=n.colIndex,s=f.rowIndex,h=f.colIndex;return e<t[0]&&(t[0]=e),o<t[1]&&(t[1]=o),s>t[2]&&(t[2]=s),h>t[3]&&(t[3]=h),t[0]!=i[0]||t[1]!=i[1]||t[2]!=i[2]||t[3]!=i[3]?(u._startCell={rowIndex:t[0],colIndex:t[1]},u._endCell={rowIndex:t[2],colIndex:t[3]},!0):void 0},selectRange:function(n,t,i,r){var s,c,l,e,v,a,y,p,f,h,o=n,u=this.XLObj;if(u.model.allowSelection&&(u._isObject(n)||(n=u._getRangeArgs(n,"object"),o={rowIndex:n[0],colIndex:n[1]},t={rowIndex:n[2],colIndex:n[3]}),h=u.getActiveSheetIndex(),f=u.getSheet(h),y=u.model.scrollSettings.allowVirtualScrolling,y&&(f._goToCollection={multiple:!1,selected:[]}),p=f.selectedRange,e=u.swapRange([o.rowIndex,o.colIndex,t.rowIndex,t.colIndex]),v=!u.isImport&&(!f._isImported||f._isLoaded),!v||!u.model.beforeCellSelect||(s={prevRange:p,currRange:e,sheetIdx:h},i&&(s.target=i),u._intrnlReq||!u._trigger("beforeCellSelect",s)))){if(u._dStartCell=o,u._dEndCell=t,f.selectedRange=e.slice(0),this._cleanUp(!1),u.model.scrollSettings.allowScrolling&&y&&f._isColSelected&&(f._virtualRowIdx.indexOf(e[0])===-1&&(e[0]=f._virtualRowIdx[0]),f._virtualRowIdx.indexOf(e[2])===-1&&(e[2]=f._virtualRowIdx[f._virtualRowIdx.length-1])),a=u.isUndefined(r),a&&(c=u.getRange(e),l=c.length,l))while(l--)u.addClass(c[l],"e-selected");u.inRange(f.selectedRange,f._activeCell.rowIndex,f._activeCell.colIndex)||(f._activeCell={rowIndex:f.selectedRange[0],colIndex:f.selectedRange[1]});f._activeCell=u._getMergeParent(f._activeCell.rowIndex,f._activeCell.colIndex);u._isRowViewable(h,f._activeCell.rowIndex)&&u.addClass(u.getCell(f._activeCell.rowIndex,f._activeCell.colIndex)[0],"e-activecell");a&&(this._focusRange(o,t,u._selectionBorder),this._highlightHeader(e));f._selectedCells=u._getSelectedRange(o,t);u.model.allowFormulaBar&&u.updateFormulaBar();o.rowIndex===0&&t.rowIndex===f.rowCount-1&&(this._isColSelected=!0);o.colIndex===0&&t.colIndex===f.colCount-1&&(this._isRowSelected=!0);a&&(u.model.enableContextMenu||u.model.showRibbon)&&u.XLRibbon._dirtySelect(c);u._isMultiSelect=!0;u.model.showRibbon&&u.XLRibbon._updateRibbonIcons();u._isSheetNavigate||(f._isEmptyActiveCell=f._isRangeSelected=f._isRowSelected=f._isColSelected=f._isSheetSelected=!1);v&&u.model.cellSelected&&(s={selectedRange:f.selectedRange,target:i,sheetIdx:h},u._intrnlReq||u._trigger("cellSelected",s))}},selectRow:function(n){var i=this.XLObj,t=i.getSheet(i.getActiveSheetIndex());i.model.allowSelection&&(t._startCell={rowIndex:n,colIndex:0},t._endCell={rowIndex:n,colIndex:t.colCount-1},this.selectRange(t._startCell,t._endCell),this._selectRow(i._getRowIdx(n),"e-rowselected"),t._isRowSelected=!0)},selectRows:function(n,t){var i,r=this.XLObj;r.model.allowSelection&&(i=r.getSheet(r.getActiveSheetIndex()),i._startCell={rowIndex:n,colIndex:0},i._endCell={rowIndex:t,colIndex:i.colCount-1},this.selectRange(i._startCell,i._endCell),this._markHeaderSelection([i._startCell.rowIndex,i._startCell.colIndex,i._endCell.rowIndex,i._endCell.colIndex],"row"),i._isRowSelected=!0)},selectColumn:function(n){var t,i=this.XLObj;i.model.allowSelection&&(t=i.getSheet(i.getActiveSheetIndex()),t._startCell={rowIndex:0,colIndex:n},t._endCell={rowIndex:t.rowCount-1,colIndex:n},this.selectRange(t._startCell,t._endCell),this._selectColumn(n,"e-colselected"),t._isColSelected=!0)},selectColumns:function(n,t){var i,r=this.XLObj;r.model.allowSelection&&(i=r.getSheet(r.getActiveSheetIndex()),i._startCell={rowIndex:0,colIndex:n},i._endCell={rowIndex:i.rowCount-1,colIndex:t},this.selectRange(i._startCell,i._endCell),this._markHeaderSelection([i._startCell.rowIndex,i._startCell.colIndex,i._endCell.rowIndex,i._endCell.colIndex],"column"),i._isColSelected=!0)},selectSheet:function(n){var i=this.XLObj,t=i.getSheet(i.getActiveSheetIndex());i.model.allowSelection&&(n&&(t._activeCell={rowIndex:t._topRow.idx,colIndex:0}),t._startCell={rowIndex:0,colIndex:0},t._endCell={rowIndex:t.rowCount-1,colIndex:t.colCount-1},this.selectRange(t._startCell,t._endCell),i.element.find(".e-spreadsheetcolumnheader").addClass("e-sheetselected"),t._isSheetSelected=!0)},refreshSelection:function(n){var t=this.XLObj,i=t.getSheet(t.getActiveSheetIndex()),n=t._getRangeArgs(n,"object"),r=n[0],u=n[1],f=n[2],e=n[3];i._isRowSelected?this.selectRows(r,f):i._isColSelected?this.selectColumns(u,e):i._isSheetSelected?this.selectSheet():this.selectRange({rowIndex:r,colIndex:u},{rowIndex:f,colIndex:e})},getSelectedCells:function(n){return this.XLObj._getContent(this.XLObj._getSheetIndex(n))[0].querySelectorAll("td.e-selected")},_select:function(n,t){var i=this.XLObj.getCell(n.rowIndex,n.colIndex);i&&i.addClass(t)},_selectRow:function(n,t){var i=this.XLObj._getJSSheetRowHeaderContent(this.XLObj.getActiveSheetIndex()).find("td:eq("+n+")");i&&i.addClass(t)},_selectRows:function(n,t,i){var r,e,u,f=this.XLObj,h=f.getActiveSheetIndex(),s=f.getSheet(h),o=f._getJSSheetRowHeaderContent(h).find("td");if(e=f._getRowIdx(n),u=f._getRowIdx(t),e===-1)if(n<s._virtualRowIdx[0])e=0;else return;if(u===-1)if(r=s._virtualRowIdx.length-1,t>s._virtualRowIdx[r])u=r;else return;if(o=e!==u?o.slice(e,u+1):o.eq(u),r=o.length,r)while(r--)f.addClass(o[r],i)},_selectColumn:function(n,t){var i=this.XLObj._getJSSheetHeader(this.XLObj.getActiveSheetIndex()).find("th:eq("+n+")");i&&i.addClass(t)},_selectColumns:function(n,t,i){var u,f=this.XLObj,r=f._getJSSheetHeader(f.getActiveSheetIndex()).find("th");if(r=t!==n?r.slice(n,t+1):r.eq(t),u=r.length,u)while(u--)f.addClass(r[u],i)},_focusBorder:function(n,t,i){var r=this.XLObj,e=r.swapRange([n.rowIndex,n.colIndex,t.rowIndex,t.colIndex]),u=e[0],f=e[1],o=e[2],s=e[3];u&&r.getRange([u-1,f,u-1,s]).addClass(i[1]);r.getRange([u,s,o,s]).addClass(i[0]);r.getRange([o,f,o,s]).addClass(i[1]);f&&r.getRange([u,f-1,o,f-1]).addClass(i[0])},_focusRange:function(n,t,i){for(var u=4,r=this.XLObj,f=[r.getFocusTopElem(),r.getFocusRightElem(),r.getFocusBottomElem(),r.getFocusLeftElem()],e=["e-focustop ","e-focusright ","e-focusbottom ","e-focusleft "];u--;)elem=f[u][0],r._removeClass(elem),r.addClass(elem,e[u]+i[u]);this._refreshBorder(r.swapRange([n.rowIndex,n.colIndex,t.rowIndex,t.colIndex]))},_refreshBorder:function(n){n=n?n:this.XLObj.getSheet().selectedRange;for(var u,f,r="e-hide",a=4,v=n[0],y=n[1],i=this.XLObj,t=this._focusInfo(n),e=i.getFocusTopElem(),s=i.getFocusRightElem(),h=i.getFocusBottomElem(),o=i.getFocusLeftElem(),tt=[e,s,h,o],p=ttop=t.topLeft.top,w=lleft=tleft=t.topLeft.left,b=t.topRight.left+t.topRight.width-t.topLeft.left,c=t.topRight.top,k=t.topRight.left+t.topRight.width,d=t.bottomRight.top+t.bottomRight.height-c,l=t.bottomLeft.top+t.bottomLeft.height,g=t.bottomRight.left+t.bottomRight.width-t.bottomLeft.left,nt=l-ttop;a--;)i._removeClass(tt[a][0],r);i.model.selectionSettings.enableAnimation?(u=i.model.selectionSettings.animationType,f=i.model.selectionSettings.animationTime,v?e.animate({top:ttop.toString(),left:tleft.toString(),width:b.toString()},f,u):e.addClass(r),s.animate({top:c.toString(),left:k.toString(),height:d.toString()},f,u),h.animate({top:l.toString(),left:w.toString(),width:g.toString()},f,u),y?o.removeClass(r).animate({top:p.toString(),left:lleft.toString(),height:nt.toString()},f,u):o.addClass(r)):(v?e.css({top:ttop,left:tleft,width:b}):e.addClass(r),s.css({top:c,left:k,height:d}),h.css({top:l,left:w,width:g}),y?o.css({top:p,left:lleft,height:nt}):o.addClass(r))},_focusInfo:function(n){var i={},u=n[0],f=n[1],e=n[2],r=n[3],t=this.XLObj;return i.topLeft=t._getCellInfo({rowIndex:u,colIndex:f}),i.topRight=t._getCellInfo(f===r?{rowIndex:u,colIndex:r}:t._getMergedIdx(u,r)),i.bottomLeft=t._getCellInfo({rowIndex:e,colIndex:f}),i.bottomRight=t._getCellInfo(t._getMergedIdx(e,r)),i},_highlightHeader:function(n){this._selectRows(n[0],n[2],"e-rowhighlight");this._selectColumns(n[1],n[3],"e-colhighlight")},_hideShowSelElem:function(n){(xlObj=this.XLObj,method=n==="block"?"_removeClass":"addClass",xlObj.model.allowSelection)&&(xlObj[method](xlObj.getAutoFillElem()[0],"e-hide"),xlObj[method](xlObj.getFocusBottomElem()[0],"e-hide"),xlObj[method](xlObj.getFocusTopElem()[0],"e-hide"),xlObj[method](xlObj.getFocusLeftElem()[0],"e-hide"),xlObj[method](xlObj.getFocusRightElem()[0],"e-hide"))},_markHeaderSelection:function(n,t){var i,r,u=this.XLObj;if(n=u.swapRange(n),i=n[0],t==="row")for(r=n[2];i<=r;)u._isRowViewable(u.getActiveSheetIndex(),i)&&this._selectRow(u._getRowIdx(i),"e-rowselected"),i++;else for(i=n[1],r=n[3];i<=r;)this._selectColumn(i,"e-colselected"),i++},_processFormulaRange:function(n){var u,t=this.XLObj,f=t.getActiveSheetIndex(),i=t._dStartCell,r=t._dEndCell,e=t._getContent(f).find(".e-editedcell");this._focusBorder(i,r,n[t._ctrlKeyCount%6]);t.model.allowAutoFill&&(u=t._getAlphaRange(f,i.rowIndex,i.colIndex,r.rowIndex,r.colIndex),t.XLDragFill.hideAutoFillElement(),t.XLEdit._updateFormulaCellRange(u));t.XLEdit._isCellEdit?t.XLEdit._focusElements(e):t._getInputBox().focus()},_scrollCalculation:function(n,i,r){var s,c,e,o,f=this.XLObj,u,h;f.model.scrollSettings.allowVirtualScrolling||(u=f.getSheet(f.getActiveSheetIndex()),f.XLSelection._isEndReached=!0,s=setInterval(function(){if(e=f.XLScroll._hScroller(n),o=f.XLScroll._vScroller(n),!f.XLSelection._isEndReached){clearInterval(s);return}if(r.position==="horizontal")r.action=="Increment"?(c=Math.ceil(parseFloat(e.element.find(".e-hhandle").css("left")))+Math.ceil(parseFloat(e.element.find(".e-hhandle").width()))>=e.element.find(".e-hhandlespace").width()-2,c?f.model.scrollSettings.scrollMode!=t.Spreadsheet.scrollMode.Normal?f.XLScroll._scrollX(n):clearInterval(s):e.scroll(e.value()+u.columnWidth,!0),f.XLShape._shapeROStart||f.XLShape._shapeRSStart||(u._endCell.colIndex=u.colCount-1)):(h=e.value()-u.columnWidth,h<0&&(h=0),e.value()>=0&&e.scroll(h,!0),f.XLSelection._aFillDownHandler&&(u._endCell.colIndex=u._leftCol.idx),u._frozenColumns>1&&(u._startCell=u._activeCell,u._endCell.rowIndex=u.selectedRange[2]===u._startCell.rowIndex?u.selectedRange[0]:u.selectedRange[2],u._endCell.colIndex=u._fleftColIdx));else if(r.position==="vertical")if(r.action=="Increment")c=Math.ceil(parseFloat(o.element.find(".e-vhandle").css("top")))+Math.ceil(parseFloat(o.element.find(".e-vhandle").height()))>=o.element.find(".e-vhandlespace").height()-2,c?f.model.scrollSettings.scrollMode!=t.Spreadsheet.scrollMode.Normal?f.XLScroll._scrollY(n):clearInterval(s):o.scroll(o.value()+f.model.rowHeight,!0),f.XLShape._shapeROStart||f.XLShape._shapeRSStart||(u._endCell.rowIndex=u.rowCount-1);else if(h=o.value()-f.model.rowHeight,h<0&&(h=0),o.value()>0&&o.scroll(h,!0),!f.XLShape._shapeROStart&&!f.XLShape._shapeRSStart){if(u._topRow.idx<1&&u._ftopRowIdx+1===u._frozenRows)return;u._startCell=u._activeCell;u._endCell.rowIndex=u._frozenRows>1?u._ftopRowIdx:u._topRow.idx-1;u._endCell.colIndex=u._frozenRows>1?u.selectedRange[3]===u._startCell.colIndex?u.selectedRange[1]:u.selectedRange[3]:i.parentNode.cellIndex}f.XLShape._shapeROStart||f.XLShape._shapeRSStart||(f.XLSelection._aFillDownHandler?f.XLDragFill._selectAutoFillRange(null,u._endCell):f.XLSelection.selectRange(u._startCell,u._endCell))},200),f._browserDetails.name==="msie"&&f._browserDetails.version==="8.0"?(i.attachEvent("onmouseup",function(){clearInterval(s)}),document.attachEvent("onmouseup",function(){clearInterval(s)})):(i.addEventListener("mouseup",function(){clearInterval(s)}),document.addEventListener("mouseup",function(){clearInterval(s)})))},_cleanUp:function(n){var i,r,o=!1,u="e-hide",t=this.XLObj,f=t.getActiveSheetIndex(),s=t.getSheet(f),h=t.getFocusTopElem(),e=t.getSheetElement(f);for(t.model.allowAutoFill&&t.XLDragFill._autoFillCleanUp(),s._isSheetSelected&&!t.model.scrollSettings.allowVirtualScrolling&&(o=!0,e.detach()),r=e[0].querySelectorAll(".e-selected,.e-rowselected,.e-colselected,.e-rowhighlight,.e-colhighlight,.e-sheetselected,.e-activecell"),i=r.length;i--;)r[i].className=r[i].className.replace(new RegExp("e-activecell|e-selected|e-rowhighlight|e-colhighlight|e-rowselected|e-colselected|e-sheetselected","g"),"").replace(/ +/g," ");o&&t.getMainPanel(f).find(".e-spreadsheet-list").append(e);n&&h&&(t.addClass(h[0],u),t.addClass(t.getFocusRightElem()[0],u),t.addClass(t.getFocusBottomElem()[0],u),t.addClass(t.getFocusLeftElem()[0],u));s._selectedCells=[]},clearAll:function(n){this._cleanUp(!n)},_clearBorder:function(n){var t=this.XLObj;t._getContent(t.getActiveSheetIndex()).find("td").removeClass(n)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.filter=function(n){this.XLObj=n;this._isSearchEdit=!1;this._isDecimal=!1;this._colName="";this._colType="";this._tableId=""};t.spreadsheetFeatures.filter.prototype={_renderExcelFilter:function(){var n=this.XLObj,i={instance:n,showSortOptions:n.model.allowSorting,maxFilterLimit:n.model.sheets[n.getActiveSheetIndex()].filterSettings.maxFilterChoices,filterHandler:t.proxy(this._filterHandler,this),cancelHandler:t.proxy(this._cancelHandler,this),customFilterHandler:t.proxy(this._customFilterHandler,this),enableComplexBlankFilter:!1,blankValue:"",interDeterminateState:!0};n._excelFilter=new t.excelFilter(i);n.element.append(t.buildTag("div#"+n._id+"_filter_custom.e-filterdlg.e-"+n._id+"-dlg","",{display:"none"}))},_customFilterHandler:function(){var t=this.XLObj;this._isDecimal&&(n("#"+t._id+"number_CustomValue1").ejNumericTextbox("option",{decimalPlaces:2}),n("#"+t._id+"number_CustomValue2").ejNumericTextbox("option",{decimalPlaces:2}))},_renderFilterDialogs:function(t){var i=this.XLObj;document.getElementById(i._id+"_filter_custom").className.indexOf("e-dialog")<0&&this._renderCustomFilter();i._excelFilter.renderDialog(t);this._refreshCustomFilter(t);i.element.find(".e-excelfilter.e-dlgcontainer").hide();n(document.body).append(n("#"+i._id+t+"_excelDlg"))},_createSelection:function(n,t,i,r,u){for(var e=this.XLObj,c=e.getSheet(n).usedRange.rowIndex,o=i,s,h,f=i;f<=c;f++){if(s=e.XLEdit.getPropertyValue(f,0,"isHide"),h=e.XLEdit.getPropertyValue(f,r,"value2",n),e.XLEdit.getPropertyValue(f,r,"tableName",n))break;if(!s&&!e.XLEdit.getPropertyValue(f,r,"isMHide")&&!h&&f>=i)return{endRowIndex:f,filteredIndex:u};!s&&h?(o=f+1,u.push(f)):o=o}return{endRowIndex:o,filteredIndex:u}},_getSelectedRangeData:function(n,i,r,u){var o=this.XLObj,s=0,p=o.getActiveSheetIndex(),c=o.getSheet(p),b=[],v,f,h,l,k=[],y,d,g=[],a=o._dataContainer,e=a.sheets[p],w=o.getSheet(p)._multifilterIdx;for(r===-1&&(c.filterSettings.range=o._generateHeaderText(w[0]+1)+n.rowIndex+":"+o._generateHeaderText(w[w.length-1]+1)+(i.rowIndex+1)),c._multipleFiltering&&(i.colIndex=c._multifilterIdx[c._multifilterIdx.length-1]),f=n.rowIndex;f<=i.rowIndex;f++){for(temp={},h=n.colIndex;h<=i.colIndex;h++)v=o._generateHeaderText(h+1),f in e&&(!(s in e[f])||s in e[f]&&t.isNullOrUndefined(e[f][s].isRHide)&&t.isNullOrUndefined(e[f][s].isFHide))&&(!(s in e[f])||s in e[f]&&(t.isNullOrUndefined(e[f][s].isFilterHide)||!t.isNullOrUndefined(e[f][s].isFilterHide)&&e[f][s].filterID===r))&&(temp.idx=f,f in e&&h in e[f]?(l=e[f][h],h===u&&(y=o.XLEdit.getPropertyValue(f,h,"formats"),t.isNullOrUndefined(y)||(d={id:h,background:y["background-color"],foreground:y.color},k.push(d))),temp[v]=t.isNullOrUndefined(a.sharedData[l.value])?"":o._isDateTime(a.sharedData[l.value])||o.isFormula(a.sharedData[l.value])?l.value2:a.sharedData[l.value]):temp[v]=""),!(f in e)&&f<i.rowIndex&&(temp.idx=f,temp[v]="");o.getObjectLength(temp)>0&&(g.push(temp),b.push(f))}c._selectedCellColors=k;c._selectedRange={startRow:n.rowIndex,endRow:i.rowIndex,dataSourceIndexes:b};c.filterSettings.filteredRange=g},_getColumnType:function(t,i,r,u){for(var o="string",e,s,f=i;f<r;f++)if(e=this.XLObj.XLEdit.getPropertyValue(f,u,"value",t),s=this.XLObj.XLEdit.getPropertyValue(f,u,"type",t),s!="text"&&n.isNumeric(e))this._isDecimal||(this._isDecimal=e%1!=0),o="number";else return"string";return o},_getColumnByField:function(n,t){for(var u=this.XLObj,r=u.getSheet(n),i=0;i<r.columns.length;i++)if(r.columns[i].field===t)break;return i===r.columns.length?null:r.columns[i]},_checkEmptyText:function(n){for(var r=this.XLObj,u=r.model.sheets[n]._selectedCells,i=0,f=u.length;i<f;i++)if(!t.isNullOrUndefined(r.XLEdit.getPropertyValue(u[i].rowIndex,u[i].colIndex,"value",n)))return!0;return r._showAlertDlg("Alert","Alert",null,440),!1},_getFilterIcon:function(){var n=t.buildTag("span .e-icon","",{});return n.addClass("e-spanfilter e-filterspan e-ssfilter"),n},filterByActiveCell:function(){var n=this.XLObj,i=n.getActiveSheetIndex(),r;if(n.model.allowFiltering&&!n.model.isReadOnly){var t=n.model.sheets[i]._activeCell,u=n.getCell(t.rowIndex,t.colIndex),f=n.model.sheets[i]._selectedCells;this._checkEmptyText(i)&&(u.find("span").is(".e-ssfiltered, .e-ssfilter, .e-ssfilter-asc, .e-ssfiltered-asc, .e-ssfilter-dsc, .e-ssfiltered-dsc")?n._showAlertDlg("Alert","HeaderAlert","",440):(r=n.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"value",i),r=n._isDateTime(r)?n.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"value2",i):r,this._filterActiveCell(i,t,f,r)))}},_filterActiveCell:function(n,t,i,r,u){var f=this.XLObj,e=f.getSheet(n);e._activeCell=t;this._filterByValue(n,u,e.columns[t.colIndex].field,"or","equal",r,i);f.model.allowComments&&f.XLComment._updateCmntArrowPos()},_filterByValue:function(i,r,u,f,e,o,s){var c=this.XLObj,s,a,p,k,tt,it,d,g=-1,rt,w,h,v,ut=c.XLEdit.getColumnIndexByField(u),y=c.getSheet(i),b,nt,l;if(t.isNullOrUndefined(r)?s=s:(a=c.getRangeIndices(r),s=c._getSelectedRange({rowIndex:a[0]+1,colIndex:a[1]},{rowIndex:a[2],colIndex:a[3]})),p=s[0],!t.isNullOrUndefined(r)&&(w=c.XLEdit.getPropertyValue(p.rowIndex,p.colIndex,"value2",i),t.isNullOrUndefined(w)||w!==o))for(l=a[0];l<a[2];l++)if(w=c.XLEdit.getPropertyValue(l,ut,"value2",i),!t.isNullOrUndefined(w)&&w===o){p={rowIndex:l,colIndex:ut};break}for(v={currentFilteringColumn:u,action:"filter",predicated:f,requestType:"filterbycell",reqType:"filter",filteredValue:o,selCells:n.extend(!0,[],s),activeCell:p},h=this._applyFilterByValue(i,p,s,o),c._excelFilter._predicates[i]={},k={field:u,value:o,predicate:f,operator:e,matchcase:!1},{}.currentFilterCollection=o,c._excelFilter._predicates[i][u]=t.Predicate(u,e,o),y.filterSettings.filteredColumns.push(k),tt=t.DataManager(y.filterSettings.filteredColumns),it=(new t.Query).where("field",t.FilterOperators.equal,u),d=tt.executeLocal(it),l=0,rt=d.length;l<rt;l++)g=n.inArray(d[l],y.filterSettings.filteredColumns),g>-1&&y.filterSettings.filteredColumns.splice(g,1);if(y.filterSettings.filteredColumns.push(k),v.filteredcolumns=h.filteredColumns=y.filterSettings.filteredColumns,h.filteredColumns.length<1)for(b=h.multifilterIdx,l=b[0];l<=b[b.length-1];l++)nt=c._generateHeaderText(l+1),t.isNullOrUndefined(h.fColumns[nt])||(h.fColumns[nt]=[]);else h.fColumns[u]=n.extend(!0,[],h.filteredColumns);h.predicate=c._excelFilter._predicates[i];v.tableID=h.tableID;v.filteredCells=h.filteredCells;c.XLSelection._refreshBorder();v.operation="filterbycell";v.selRange=c._getAlphaRange(i,h.startRow-1,h.multifilterIdx[0],h.endRow,h.multifilterIdx[h.multifilterIdx.length-1]);c._processBindings(v)&&(y.filterSettings.filteredColumns=temp)},_applyFilterByValue:function(i,r,u){var s=this.XLObj,e=s.getSheet(i),b=[],v,h,y,tt,a,ft=s.getCell(r.rowIndex,r.colIndex)[0].className,c=e.filterSettings.tableRange,it=[],o,l,rt=!1,d,p,et=s.model.scrollSettings.allowVirtualScrolling,g=s.getSheet(i)._filterColl,w,k,nt,f,ut;for(a=s.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tableName",i),a=a?s._getTableID(a):-1,f=0,p=c.length;f<p;f++)if(c[f].tableID===a){l=f;break}if(!t.isNullOrUndefined(l)&&c[l].tableID===a&&c[l].selectedCellIndexes.indexOf(r.colIndex)!==-1&&c[f].startRow<=r.rowIndex&&c[f].endRow>=r.rowIndex)o=c[l],e.filterSettings.filteredRange=c[l].filteredRange,e._selectedRange=c[l].selectedRange;else{for(e._multipleFiltering=!1,e._multifilterIdx=[],s._dupDetails=!0,this.clearFilter("remove"),s._dupDetails=!1,w=s.getObjectKeys(g),f=w.length-1;f>=0;f--)for(k=s.getObjectKeys(g[f]),j=k.length-1;j>=0;j--)s._isRowViewable(i,w[f])&&(nt=s.getCell(w[f],k[j]),nt.find(".e-filterspan").remove(),nt.removeClass("e-filterhdr")),delete g[w[f]][k[j]];if(u.length<2||u[0].rowIndex===u[u.length-1].rowIndex){for(h=-1,y=u[u.length-1].rowIndex,f=u[0].rowIndex;f>=0;f--)if(t.isNullOrUndefined(s.XLEdit.getPropertyValue(f,u[0].colIndex,"value2"))){h=f;break}h=h===-1?1:h+2;y=this._createSelection(i,h,y,u[0].colIndex,[]).endRowIndex-1;v={rowIndex:y,colIndex:r.colIndex};this._getSelectedRangeData({rowIndex:h,colIndex:r.colIndex},v,-1,r.colIndex)}else h=r.rowIndex,y=this._createSelection(i,h,u[u.length-1].rowIndex,u[0].colIndex,[]).endRowIndex-1,v={rowIndex:y,colIndex:r.colIndex},this._getSelectedRangeData({rowIndex:h,colIndex:r.colIndex},v,-1,r.colIndex);for(ut=s.getSheet(i)._filterColl,f=u[0].colIndex,p=u[u.length-1].colIndex;f<=p;f++)b.push(f),tt=this._getFilterIcon(),h=h===0?1:h,d={rowIndex:h-1,colIndex:f},this._applyFilterIcon(d,tt),it.push(d);for(s.XLScroll._getColWidths(i,u[0].colIndex),b.length>1&&(e._multipleFiltering=!0),e._multifilterIdx=b,e._selectedCellIndexes=b,f=0,p=c.length;f<p;f++)if(c[f].tableID===a){l=f;rt=!0;break}rt?(o=c[l],o.startRow=r.rowIndex,o.endRow=v.rowIndex,o.multiFiltering=e._multipleFiltering,o.multifilterIdx=e._multifilterIdx,o.selectedCellIndexes=e._multifilterIdx,o.selectedRange=n.extend(!0,{},e._selectedRange),o.filteredRange=n.extend(!0,{},e.filterSettings.filteredRange),o.hiddenIdx=[],o.flterdIdxes=[],o.fColumns={},o.tableID=a,o.filterCollection=[]):(e.filterSettings.tableRange.push({filterCollection:[],startRow:h,endRow:v.rowIndex,tableID:-1,fColumns:{},flterdIdxes:[],multiFiltering:e._multipleFiltering,multifilterIdx:e._multifilterIdx,selectedCellIndexes:e._multifilterIdx,selectedRange:n.extend(!0,{},e._selectedRange),filteredRange:e.filterSettings.filteredRange,hiddenIdx:[]}),o=c[c.length-1]);o.filteredCells=it}return o},clearFilter:function(i){var r=this.XLObj,k;if(!r.model.isReadOnly){var d=!1,f=r.getActiveSheetIndex(),y,a=r.getSheet(f),p=n.extend(!0,{},a._filterColl),rt=r._dupDetails,g,l=a.filterSettings.tableRange,v=-1,u,e,nt,tt=[],b=r._dataContainer.sheets[f],o,h,c=r.getObjectKeys(p),s,w,it=[],ut=a.filterSettings.filteredRange,ft=a.filterSettings.filteredColumns,et=a.filterSettings.range;if(l.length){for(u=0;u<l.length;u++)if(l[u].tableID===-1){v=u;break}for(g=l[v].selectedRange,u=c.length-1;u>=0;u--)for(s=r.getObjectKeys(p[c[u]]),e=s.length-1;e>=0;e--)o=parseInt(c[u]),h=parseInt(s[u]),t.isNullOrUndefined(r.XLEdit.getPropertyValue(o,h,"tableName",f))&&(tt.push({rowIndex:o,colIndex:h}),fltrdCol=p[c[u]][s[e]],fltrdCol.status.indexOf("e-ssfiltered")>-1&&(y=r.model.sheets[f].columns[s[e]].field,it.push({fieldName:y,predicate:l[v].predicate,filterCollection:l[v].filterCollection,action:"filtering",tableID:-1,predicate:r._excelFilter._predicates[f][y]}),delete r._excelFilter._predicates[f][y],r._dupDetails=!0,this._clearFilterColumn(y,"","","Or","","",-1),r._dupDetails=!1,d=!0),i==="remove"&&(delete p[c[u]][s[e]],delete b[c[u]][s[e]].isFilterHeader,delete b[c[u]][s[e]].filterState,delete b[c[u]][s[e]].isFilterVisible,r._isRowViewable(f,o)&&(w=r.getCell(o,h),n.isNumeric(r.XLEdit.getPropertyValue(o,h))&&w.addClass(r._rAlign),w.find(".e-filterspan").remove(),r.addClass(w[0],"e-wrapword"),r.XLEdit.getPropertyValue(o,h,"isFilterWrap")&&r.setWrapText("wrap",r._getAlphaRange(f,o,h,o,h)),r._removeClass(w[0],"e-filterhdr"))));i==="remove"&&(r._dupDetails=rt,a._filterColl=p,v>-1&&(nt=l.splice(v,1)[0]),r.model.allowComments&&r.XLComment._updateCmntArrowPos(),r._isUndoRedo||r._dupDetails||(k={sheetIndex:f,operation:"remove-filter",status:i,process:"apply-filter",filteredCells:tt,requestType:"filter",reqType:"filter",fRange:r.getSheet(f).filterSettings.range,filterRange:nt,filterCollection:it,filteredCols:ft,fltrdRange:ut,selRange:g},r._completeAction(k),r._trigActionComplete(k)));d&&(n("#"+r._id+"_Ribbon_Data_SortFilter_ClearFilter").ejButton("disable"),n("#"+r._id+"_Ribbon_SortFilter").ejMenu("disableItemByID","Ribbon_ClearFilter"))}}},filter:function(n){var i=this.XLObj;if(i.model.allowFiltering&&!i.model.isReadOnly){var f=i.getActiveSheetIndex(),u=i.getSheet(f),o=!1,y=u._activeCell,e,c,h=u.filterSettings.tableRange,l,r,a,p,v,s;for(u._multipleFiltering=!1,u._multifilterIdx=[],e=i.XLEdit.getPropertyValue(y.rowIndex,y.colIndex,"tableName",f),t.isNullOrUndefined(e)||(e=i._getTableID(e)),r=0,a=h.length;r<a;r++)h[r].tableID===-1&&(o=!0),l=r;if(s={range:i._getRangeArgs(n,"string"),reqType:t.Spreadsheet.Actions.Filtering,sheetIndex:f},i._trigActionBegin(s))return!0;if(n=s.range,o&&(this.clearFilter("remove"),u.filterSettings.filteredRange=[],u._selectedRange={},u._selectedCellIndexes=[],u.filterSettings.filteredColumns=[],i._excelFilter._predicates[f]={}),!t.isNullOrUndefined(e)&&e>-1){for(p=h[l].startRow,c=h[l].multifilterIdx,r=0,a=c.length;r<colLen;r++)v=this._getFilterHeader(f,p,c[r]),!t.isNullOrUndefined(v)&&v.status.indexOf("e-ssfiltered")>-1&&this._clearFilterColumn(u.columns[r].field,"","","","","",e);this._clearFilterTableIcon(f,e);o=!0}if(o){if(s={sheetIdx:f,reqType:"clear-Filter"},i._trigActionComplete(s))return}else this._filterCellRange(f,n);i._isFiltered=!o;i.model.allowComments&&i.XLComment._updateCmntArrowPos()}},_applyFilterIcon:function(n,t){var r=this.XLObj,h=this.XLObj._rAlign,f=r.getActiveSheetIndex(),i=n.rowIndex,u=n.colIndex,c=r.getSheet(f),o=r._isRowViewable(f,i),e=c._filterColl,s=!1;o&&(activeEle=r.getCell(i,u,f),activeEle[0].insertBefore(t[0],activeEle[0].childNodes[activeEle[0].childNodes.length-1]),activeEle.addClass("e-filterhdr"),activeEle.removeClass("e-ralign"));r.XLEdit.getPropertyValue(i,u,"wrap",f)&&(s=!0,r.setWrapText("unwrap",r._getAlphaRange(f,i,u,i,u)));r.XLEdit._updateDataContainer({rowIndex:i,colIndex:u},{dataObj:{isFilterHeader:!0,filterState:"filter",isFilterVisible:!0,isFilterWrap:s},sheetIdx:f});r.isNumber(r.model.allowFiltering&&r.XLEdit.getPropertyValue(i,u,"value2",f))&&o&&r._removeClass(activeEle[0],h);i in e||(e[i]={});u in e[i]||(e[i][u]={});e[i][u].status="e-ssfilter";e[i][u].isTable=t[0].className.indexOf("e-ft")>-1},_postionFilterIcon:function(n,t){var i=this.XLObj,u=n||i.getActiveCellElem(),o=t||u.find(".e-filterspan"),f,e,r=i._getCellIdx(u[0]);i.model.allowResizing&&(f=i.XLResize._getContentWidth(r.colIndex,i.getActiveSheetIndex(),r.rowIndex,r.rowIndex),e=i.XLResize._getContentHeight(r.rowIndex,i.getActiveSheetIndex()))},_filterCellRange:function(n,i){var e=this.XLObj,u,w=!1,tt,it,b,rt,k=[],s=-1,ut=!1,ft=0,et,f,h,a,ot,y,v,p,o,r=e.getSheet(n),st=[],ht=!1,c,l=[],d=[],g=!1,nt={sheetIndex:n,reqType:"filter",operation:"apply-filter"};if(t.isNullOrUndefined(i)){if(!e.model.allowSelection)return;u=r._selectedCells}else y=e.getRangeIndices(i),u=e._getSelectedRange({rowIndex:y[0],colIndex:y[1]},{rowIndex:y[2],colIndex:y[3]});for(u.length<2&&(c=u,t.isNullOrUndefined(i)||e.performSelection(i,n),e.selectAll(!1),u=r._selectedCells,ht=!0),f=u[0].colIndex,a=u[u.length-1].colIndex;f<=a;f++){if(k.push(f),s=u[0].rowIndex,ht)r._isSheetSelected||(l.push(f),r._multifilterIdx.push(f),w=!0);else{if(!ut||k.length>0)for(h=s,ot=u[u.length-1].rowIndex;h<=ot;h++)rt=e._isRowVisible(n,h),rt&&(e.XLEdit.getPropertyValue(h,f,"value2",n)||l.length&&e.XLEdit.getPropertyValue(0,f,"isCHide",n))&&((s===-1||s>h)&&(s=h),ut=!0,w=!0,g=!0),s<h&&ft===0&&st.push(h);g&&(l.push(f),r._multifilterIdx.push(f),g=!1)}ft++}if(l.length>1&&(r._multipleFiltering=!0),d=[],w){for(f=0,a=l.length;f<a;f++)et=this._getFilterIcon(),this._applyFilterIcon({rowIndex:s,colIndex:l[f]},et),d.push({rowIndex:s,colIndex:l[f]});for(v={rowIndex:s+1,colIndex:u[0].colIndex},p={rowIndex:u[u.length-1].rowIndex},r._selectedRange={startRow:v.rowIndex,endRow:p.rowIndex,dataSourceIndexes:st},this._getSelectedRangeData(v,u[u.length-1],-1,v.colIndex),r._selectedCellIndexes=k,nt={sheetIndex:n,filteredCells:d,reqType:"filter",operation:"apply-filter",tableID:-1},b=r.filterSettings.tableRange,f=0,a=b.length;f<a;f++)b[f].tableID===-1&&(tt=!0,it=f);tt?(o=r.filterSettings.tableRange[it],o.startRow=v.rowIndex,o.endRow=p.rowIndex,o.multiFiltering=r._multipleFiltering,o.multifilterIdx=r._multifilterIdx,o.selectedCellIndexes=r._multifilterIdx,o.selectedRange=r._selectedRange,o.filteredRange=r.filterSettings.filteredRange,o.filteredColumns=r.filterSettings.filteredColumns,o.predicate=e._excelFilter._predicates[n],o.hiddenIdx=[],o.flterdIdxes=[],o.fColumns={},o.filterColumnName=[],o.filterCollection=[]):r.filterSettings.tableRange.push({filterCollection:[],startRow:v.rowIndex,endRow:p.rowIndex,tableID:-1,multiFiltering:r._multipleFiltering,multifilterIdx:r._multifilterIdx,selectedCellIndexes:r._multifilterIdx,selectedRange:r._selectedRange,filteredRange:r.filterSettings.filteredRange,filteredColumns:r.filterSettings.filteredColumns,fColumns:{},predicate:{},hiddenIdx:[],fltrdIdxes:[],filterColumnName:[]});e.XLScroll._getColWidths(n,r._multifilterIdx[0]);r._isImported&&!r._isLoaded||e._isExport||(i=c?[c[0].rowIndex,c[0].colIndex,c[c.length-1].rowIndex,c[c.length-1].colIndex]:e.isUndefined(i)?[u[0].rowIndex,u[0].colIndex,u[u.length-1].rowIndex,u[u.length-1].colIndex]:e.getRangeIndices(i),e._completeAction(nt),e._trigActionComplete(nt),t.isNullOrUndefined(i)||e.performSelection(i,n))}else e._showAlertDlg("Alert","Alert","",440)},openFilterDialog:function(n){var t,i=this.XLObj;i.model.isReadOnly||(typeof n=="string"&&(n=i.getRangeIndices(n)),t=i.getCell(n[0],n[1]).find("span.e-filterspan"),t.length>0&&this._filterClickHandler({target:t[0]}))},_filterClickHandler:function(i){var r=this.XLObj,tt,it,w=n(i.target),o=r.getActiveSheetIndex(),e=r.getSheet(o),st=!1,c,y,b,ht,l,rt,ut,a,ft,h,s,f,ct=[],lt={},et,ot,k,v,p,at=r.model.scrollSettings.allowVirtualScrolling,vt=n(i.target).position(),yt=r.getSheetElement(o).find(".e-spreadsheetcontentcontainer").position(),d,g,nt=["showItems","hideItems"],u;if(y=r._generateHeaderText(i.target.parentNode.cellIndex+1),this._isDecimal=!1,(!r.model.allowLockCell||!r.getSheet(o).isSheetProtected)&&!r.preventFilterPopup){if(w[0].className.indexOf("e-ssfiltered")>-1&&(st=!0),a=i.target.parentNode.cellIndex,w[0].className.indexOf("e-ssfilter")>-1){for(f=r.model.sheets[o].filterSettings.tableRange,tt=r._getCellIdx(w.parent()[0]),it=r.XLEdit.getPropertyValue(tt.rowIndex,tt.colIndex,"tableName"),h=t.isNullOrUndefined(it)?-1:parseInt(it.replace("e-table","")),u=0,l=f.length;u<l;u++)f[u].tableID===h&&(v=u,f[u].multiFiltering?(rt=f[u].multifilterIdx[0],ut=f[u].multifilterIdx[f[u].multifilterIdx.length-1]):rt=ut=i.target.parentNode.cellIndex,ot={rowIndex:f[u].startRow,colIndex:rt},k={rowIndex:f[u].endRow,colIndex:ut},e._multipleFiltering=f[u].multiFiltering,e._multifilterIdx=f[u].multifilterIdx,s=e._selectedRange=f[u].selectedRange,e.filterSettings.filteredRange=f[u].filteredRange,e._selectedCellIndexes=f[u].selectedCellIndexes);if(h===-1){if(p=this._createSelection(o,s.startRow,s.endRow,a,s.dataSourceIndexes),c=p.endRowIndex>s.endRow?p.endRowIndex-1:p.endRowIndex,s.endRow!=c)for(u=s.endRow+1;u<=c;u++)ft={field:y,value:r.XLEdit.getPropertyValue(u,a,"value2",o),matchcase:!1,operator:"equal",predicate:"or"},e.filterSettings.filteredColumns.push(ft),f[v].filteredColumns.push(ft),f[v].selectedRange.endRow=c;k={rowIndex:c,colIndex:a};f[v].selectedRange=e._selectedRange={startRow:ot.rowIndex,endRow:k.rowIndex,dataSourceIndexes:p.filteredIndex};f[v].endRow=c}for(this._getSelectedRangeData(ot,k,h,a),b=e.columns,ht=this._getColumnType(o,s.startRow,s.endRow,a),u=0,l=b.length;u<l;u++)if(b[u].field===y){r._$colType=ht;r._$curFieldName=b[u].field;break}for(r._showDialog(r._id+"_Filter",r._$colType),et=r._getXYPos(w,n("#"+r._id+r._$colType+"_excelDlg"),18,18),f=r.model.sheets[o].filterSettings.tableRange,u=0,l=f.length;u<l;u++)f[u].tableID===h&&(ct=f[u].filteredColumns,lt=f[u].predicate);r._excelFilter._predicates[o]=lt;this._isSearchEdit=!0;n.extend(!0,r._excelFilter._columnsFiltered,e._filteredColumns);r._phoneMode||r._tabMode?this._openNormalFilterDlg(y,r._$colType,h,v):r._excelFilter.openXFDialog({field:y,dataSource:e.filterSettings.filteredRange?e.filterSettings.filteredRange:e.dataSource,position:{X:et.xPos,Y:et.yPos},type:r._$colType,format:r._$colFormat,filteredColumns:ct,sortedColumns:[],key:o,tableID:h,selectedColors:e._selectedCellColors,isFiltered:st,blank:"",enableColor:!0,filteredByColor:e._filteredByColor})}d=n("#"+r._id+"string_MenuItem").data("ejMenu");g=n("#"+r._id+"number_MenuItem").data("ejMenu");d&&d[r.model.allowSorting?nt[0]:nt[1]](d.element.find("li:lt(4)"));g&&g[r.model.allowSorting?nt[0]:nt[1]](g.element.find("li:lt(4)"))}},_cancelHandler:function(){this._isSearchEdit=!1},applyFilter:function(n){var i=this.XLObj,u=t.Predicate(n.field,n.operator,n.value,!n.matchcase),e,f=[],r=i.getActiveSheetIndex();e=i.model.sheets[r].filterSettings.tableRange;i._isFiltered||i.XLFilter.filter(n.filterRange);t.isNullOrUndefined(i._excelFilter._predicates[r])&&(i._excelFilter._predicates[r]={},i._excelFilter._predicates[r][n.field]={});i._excelFilter._predicates[r][n.field]=u;f.push({actualFilterOperator:n.operator,actualFilterValue:n.value,actualPredicate:n.predicate,field:n.field,isCustom:!0,matchcase:n.matchcase,operator:n.operator,predicate:n.predicate,value:n.value});this._filterHandler({action:"filtering",fieldName:n.field,tableID:-1,ejpredicate:u,filterCollection:f})},_filterHandler:function(i){var d,b,it,s,k,f,a,y,rt,ut,ft;if(!i.originalEvent||(d=i.originalEvent.target.parentElement.className,!d||!(d.indexOf("hdr")>-1))){var f,a,e,et=!1,o=-1,g,h,u={},ot,r=this.XLObj,l=r.getActiveSheetIndex(),v=r.getSheet(l),st,nt,tt,c=[],p={},w;for(u.requestType=i.action==="sorting"||i.action==="filterbycolor"?i.action:"filtering",e=v.filterSettings.tableRange,r.XLFilter._isSearchEdit=!1,f=0,a=e.length;f<a;f++)e[f].tableID===i.tableID&&(n.extend(!0,c,e[f].filteredColumns),p=e[f].predicate,et=!0,o=f);if(u.tableID=i.tableID,i.action==="filtering"||i.action==="clearfiltering"){for(u.rowIndex=e[o].startRow-1,u.colIndex=r._generateColCount(i.fieldName)-1,ot=t.DataManager(c),st=(new t.Query).where("field",t.FilterOperators.equal,i.fieldName),nt=ot.executeLocal(st),u.filteredColumns=c,f=0,a=nt.length;f<a;f++)tt=n.inArray(nt[f],c),tt>=0&&c.splice(tt,1);i.action==="clearfiltering"?delete r._excelFilter._predicates[l][i.fieldName]:t.merge(c,i.filterCollection);p=r._excelFilter._predicates[l]}if(et)if(e[o].filteredColumns=c,e[o].filterCollection=i.filterCollection,e[o].predicate=p,e[o].action=i.action,c.length<1)for(b=e[o].multifilterIdx,f=b[0];f<=b[b.length-1];f++)it=r._generateHeaderText(f+1),t.isNullOrUndefined(e[o].fColumns[it])||(e[o].fColumns[it]=[]);else e[o].fColumns[i.fieldName]=n.extend(!0,[],c);if(h=v.filterSettings.tableRange[o].selectedRange,s=v.filterSettings.tableRange[o].selectedCellIndexes,k=v._filterColl,i.action==="filtering"||i.action==="clearfiltering")u.currentFilteringColumn=i.fieldName,u.ejpredicate=i.ejpredicate,u.filterCollection=n.extend(!0,[],i.filterCollection),u.action=i.action,u.reqType="filter",u.sheetIndex=l,u.filteredcolumns=c,u.predicate=p;else if(i.action==="sorting"){if(!r.model.allowSorting)return;if(u.requestType=u.action=i.action,g=r.XLEdit.getColumnIndexByField(i.sortDetails.field),r.XLSort._isSortByFilter=!0,r.XLSort.sortByRange(r.swapRange([h.startRow,s[0],h.endRow,s[s.length-1]]),i.sortDetails.field,i.sortDetails.direction,i.tableID))return;for(this._changeSortIcon({rowIndex:h.startRow-1,colIndex:g},i.sortDetails.direction),f=0,a=s.length;f<a;f++)s[f]!=g&&(k[h.startRow-1][s[f]].status.indexOf("-asc")>-1||k[h.startRow-1][s[f]].status.indexOf("-dsc")>-1)&&(k[h.startRow-1][s[f]].status="e-ssfilter",r._isRowViewable(l,h.startRow-1)&&(w=r.getCell(h.startRow-1,s[f]).find(".e-filterspan")[0],r._removeClass(w,"e-ssfilter-asc"),r._removeClass(w,"e-ssfilter-dsc"),r.addClass(w,"e-ssfilter")))}else{if(u.requestType=u.action=i.action,u.range=v._selectedRange,r.model.allowSorting&&r.XLSort._sortRangeAlert([h.startRow,s[0],h.endRow,s[s.length-1]]))return;i.action==="sortbycolor"?(u.sortColumn=i.sortDetails.field,u.operation=i.sortDetails.operation,y=i.sortDetails.color.replace("rgb(","").replace(")","").split(",")):(r._isUndoRedo?(u.filterColumn=i.columnName,u.operation=i.operation):(u.filterColumn=i.filterDetails.field,u.operation=i.filterDetails.operation,y=i.filterDetails.color.replace("rgb(","").replace(")","").split(",")),u.tableID=i.tableID,r.model.sheets[l]._filteredByColor=u.filterColumn);r._isUndoRedo||(rt=y[0],ut=y[1],ft=y[2]);u.operation==="sortbgcolor"||u.operation==="filterbgcolor"?u.bgcolor=r._isUndoRedo?i.bgcolor:this._convertrgbtohex(parseInt(rt),parseInt(ut),parseInt(ft)):u.fgcolor=r._isUndoRedo?i.fgcolor:this._convertrgbtohex(parseInt(rt),parseInt(ut),parseInt(ft))}u.oprType="filter";u.selRange=r._getAlphaRange(l,e[o].startRow-1,e[o].multifilterIdx[0],e[o].endRow,e[o].multifilterIdx[e[o].multifilterIdx.length-1]);i.action!=="sorting"&&r._processBindings(u)&&(c=temp);i.action==="clearfiltering"&&(r.XLRibbon._isFilterSelect.status=!1);r.model.allowComments&&r.XLComment._updateCmntArrowPos();r.XLSelection._refreshBorder();r.model.showRibbon&&r.XLRibbon._refreshRibbonIcons();r._isFrozen(r.getFrozenRows())&&r.XLFreeze._refreshFreezeRowDiv()}},_convertrgbtohex:function(n,t,i){return"#"+(16777216+(n<<16)+(t<<8)+i).toString(16).slice(1)},_clearFilterColumn:function(i,r,u,f,e,o,s){var c=this.XLObj,v,l={},h,k,w=c.getActiveSheetIndex(),a=c.getSheet(w),it=!1,d={},rt,ut,g,nt,y=a.filterSettings.tableRange,p=[],tt,b,ft;for(l.requestType=t.Grid.Actions.Filtering,l.currentFilterObject=[],n.isArray(r)||(r=n.makeArray(r)),n.isArray(u)||(u=n.makeArray(u)),this._currentFilterColumn=this._getColumnByField(w,i),b=0,ft=r.length;b<ft;b++)if(d={field:i,operator:r[b],value:u[b],matchcase:e,predicate:f,actualFilterValue:o},!it){for(h=0,k=y.length;h<k;h++)y[h].tableID===s&&(v=y[h],n.extend(!0,p,y[h].filteredColumns),c._excelFilter._predicates[w]=y[h].predicate,a.filterSettings.filteredRange=a.filterSettings.tableRange[h].filteredRange,a._selectedCellIndexes=y[h].selectedCellIndexes,a._selectedRange=y[h].selectedRange,a._multifilterIdx=y[h].multifilterIdx);for(rt=t.DataManager(p),ut=(new t.Query).where("field",t.FilterOperators.equal,d.field),g=rt.executeLocal(ut),h=0,k=g.length;h<k;h++)nt=n.inArray(g[h],p),nt!==-1&&p.splice(nt,1)}(tt=n.inArray(i,a._filteredColumns),tt>-1&&a._filteredColumns.splice(tt,1),c._isUndoRedo&&c.isUndefined(v))||(it=!0,delete c._excelFilter._predicates[w][i],v.filteredColumns=p,v.predicate=c._excelFilter._predicates[w],l.currentFilterObject.push(d),l.filterCollection=p,l.currentFilteringColumn=i,l.filteredcolumns=p,l.action="clearfiltering",l.reqType="filter",l.tableID=s,l.selRange=c._getAlphaRange(w,v.startRow-1,v.multifilterIdx[0],v.endRow,v.multifilterIdx[v.multifilterIdx.length-1]),c._processBindings(l)&&(a.filterSettings.filteredColumns.reverse().splice(0,r.length),a.filterSettings.filteredColumns.reverse()),c.model.allowComments&&c.XLComment._updateCmntArrowPos(),this.XLObj.XLSelection._refreshBorder())},_getFilterHeader:function(n,i,r){var f=this.XLObj,e=f.getSheet(n),u=e._filterColl;if(!t.isNullOrUndefined(u[i])&&!t.isNullOrUndefined(u[i][r]))return u[i][r]},_filterTable:function(i,r,u){var c=this.XLObj,e=c.getSheet(i),l=[],y=!1,p=!1,s,a,w,v,h,o,f,b;for(e._multipleFiltering=!1,e._multifilterIdx=[],h=u?u.endCell:n.extend(!0,{},e._endCell),o=u?u.startCell:n.extend(!0,{},e._startCell),f=o.colIndex;f<=h.colIndex;f++)v=this._getFilterHeader(i,o.rowIndex,f),!t.isNullOrUndefined(v)&&v.status.indexOf("e-ssfilter")>-1?y=!0:(a=this._getFilterIcon(),w="e-ft"+r,a.addClass(w),this._applyFilterIcon({rowIndex:o.rowIndex,colIndex:f},a),l.push(f),e._multifilterIdx.push(f));if(c.XLScroll._getColWidths(i,o.colIndex),!y)if(l.length>1&&(e._multipleFiltering=!0,p=!0),o.rowIndex=o.rowIndex+1,this._getSelectedRangeData(o,h,r,o.colIndex),c._isFATResize){if(s=e.filterSettings.tableRange,s.length)for(f=0,b=s.length;f<b;f++)if(s[f].tableID===r){s[f].endRow=h.rowIndex;break}c._isFATResize=!1}else e.filterSettings.tableRange.push({filterCollection:[],startRow:o.rowIndex,endRow:h.rowIndex,tableID:r,multiFiltering:p,multifilterIdx:l,selectedCellIndexes:l,selectedRange:n.extend(!0,{},e._selectedRange),filteredRange:e.filterSettings.filteredRange,filteredColumns:e.filterSettings.filteredColumns,fColumns:{},predicate:{},hiddenIdx:[],filterColumnName:[]})},_clearFilterTable:function(n,t,i){var e=this.XLObj.getSheet(n?n:this.getActiveSheetIndex()),u,r,f;for(u=e.filterSettings.tableRange,r=0,f=u.length;r<f;r++)u[r].tableID===t&&(this._clearAllFilter(n,r,i),f=u.length)},_clearAllFilter:function(i,r,u){var s=this.XLObj,a=s._dataContainer.sheets[i],c=s.getSheet(i),h=c.filterSettings.tableRange,l,y,f,p,w,e,o,v;for(c._selectedRange=h[r].selectedRange,e=h[r].multifilterIdx,o=h[r].startRow,f=0,p=e.length;f<p;f++)w=c.columns[e[f]].field,v=s.XLEdit.getPropertyValue(o-1,e[f],"filterState"),!t.isNullOrUndefined(v)&&v.indexOf("filtered")>-1&&this._clearFilterColumn(w,"","","Or","","",h[r].tableID),u||(s._isRowViewable(i,o-1)&&(l=s.getCell(o-1,e[f]),s.addClass(l[0],"e-wrapword"),y=l.find(".e-filterspan"),n(y).remove(),l.removeClass("e-filterhdr")),a[o-1][e[f]]&&(delete a[o-1][e[f]].isFilterHeader,delete a[o-1][e[f]].filterState),delete c._filterColl[o-1][e[f]]);u||(h.splice(r,1),len=h.length)},_clearFilterTableIcon:function(n,t){for(var i=this.XLObj,h,c,l=i.getSheet(n),u=l.filterSettings.tableRange,e,o,f,a,s,r=0,v=u.length;r<v;r++)if(u[r].tableID===t)for(l._selectedRange=u[r].selectedRange,l.filterSettings.filteredRange=u[r].filteredRange,e=u[r].multifilterIdx,o=u[r].startRow,f=0,a=e.length;f<a;f++)h=i.XLEdit.getPropertyValue(o-1,e[f],"isFilterVisible"),i._isRowViewable(n,o-1)&&(s=i.getCell(o-1,e[f]),c=s.find(".e-filterspan"),h?(c.hide(),i._removeClass(s[0],"e-filterhdr")):(i.addClass(s[0],"e-filterhdr"),c.show())),i.XLEdit._updateDataContainer({rowIndex:o-1,colIndex:e[f]},{dataObj:{isFilterVisible:!h}})},_insertFilterIcon:function(n,t,i){var r;r=this._getFilterIcon();i.tableID>-1&&this.XLObj.XLEdit._updateDataContainer({rowIndex:n,colIndex:t},{dataObj:{tableName:"e-table"+i.tableID}});this._applyFilterIcon({rowIndex:n,colIndex:t},r)},_changeFilterIcon:function(n,t,i){var f,s,h,c=!1,r=this.XLObj,u=n.rowIndex,e=n.colIndex,l=r._rAlign,o=r.getActiveSheetIndex();h=this._getFilterHeader(o,u,e).status;r._isRowViewable(o,u)&&(s=r.getCell(u,e),f=s.find(".e-filterspan")[0],s.removeClass(l),c=!0);t==="filter"?i.indexOf("filtered")<0&&(r.XLEdit._updateDataContainer({rowIndex:u,colIndex:e},{dataObj:{filterState:i.replace("filter","filtered")}}),r.getSheet(o)._filterColl[u][e].status=h.replace("e-ssfilter","e-ssfiltered"),c&&(f.className=f.className.replace("e-ssfilter","e-ssfiltered"))):(r.XLEdit._updateDataContainer({rowIndex:u,colIndex:e},{dataObj:{filterState:i.replace("filtered","filter")}}),r.getSheet(o)._filterColl[u][e].status=h.replace("e-ssfiltered","e-ssfilter"),c&&!r.isUndefined(f)&&(f.className=f.className.replace("e-ssfiltered","e-ssfilter")))},_changeSortIcon:function(n,t){var u=this.XLObj,h=u.getActiveSheetIndex(),r,i,e,o=!1,s=u.getSheet(h)._filterColl,f;i=s[n.rowIndex][n.colIndex].status;r=i.indexOf("e-ssfiltered")>-1?12:10;e=i.substr(0,r);u._isRowViewable(h,n.rowIndex)&&(f=u.getCell(n.rowIndex,n.colIndex).find(".e-filterspan")[0],i=f.className,r=i.indexOf("e-ssfilter")+r,o=!0);t==="ascending"?(s[n.rowIndex][n.colIndex].status=e+"-asc",o&&(f.className=i.substr(0,r)+"-asc")):(s[n.rowIndex][n.colIndex].status=e+"-dsc",o&&(f.className=i.substr(0,r)+"-dsc"))},_extendFilterRange:function(n,t){var o=this.XLObj,u,r=o.getSheet(o.getActiveSheetIndex()).filterSettings.tableRange,i,e,f;if(r.length)for(i=0,f=r.length;i<f;i++)if(r[i].tableID==n){if(r[i].endRow<t[2]&&(u=r[i].selectedRange.dataSourceIndexes,r[i].endRow=r[i].selectedRange.endRow=t[2],u[u.length-1]<r[i].endRow))for(e=u[u.length-1],f=r[i].endRow;e<f;e++)u.push(e+1);break}},_updateFilterIcons:function(t,i,r,u){for(var o=this.XLObj,f,s,h=n("#"+o._id+"numberSelectAll").ejCheckBox("instance"),l=h?!1:h.model.checked,c=n("#"+o._id+"stringSelectAll").ejCheckBox("instance"),a=c?!1:c.model.checked,e=t;e<=i;e++){s={rowIndex:e,colIndex:r};f=o.XLEdit.getPropertyValue(e,r,"filterState");f.indexOf("filtered")>-1&&(u=="clearfiltering"||l||a)?this._changeFilterIcon(s,"filtered",f):f.indexOf("filtered")<0&&u!="clearfiltering"&&this._changeFilterIcon(s,"filter",f);break}},_fltrRowHighlight:function(t,i,r){var f=this.XLObj,c=f.getActiveSheetIndex(),h=f._getJSSheetRowHeaderContent(c),l=h.find("table tr:gt("+(t-1)+"):lt("+(i-t+1)+")"),e=f.model.sheets[c].filterSettings.tableRange,a,u,s=f.model.sheets[c].filteredRowsCollection,o;if(f.model.scrollSettings.allowVirtualScrolling&&(l=h.find("table tr").filter(function(){return n(this).attr("idx")>=t&&n(this).attr("idx")<=i})),r==="clear"){if(l.find("td").removeClass("e-filterhiglight"),f.clearRangeData([t,0,i,0],["isFilterHighlight"]),s.length)for(o=0;o<s.length;o++)for(u=0,a=e.length;u<a;u++)s[o]>=e[u].startRow&&s[o]<=e[u].endRow&&!f.XLEdit.getPropertyValue(s[o],0,"isRHide")&&(f.updateUniqueData({isFilterHighlight:!0},[e[u].startRow,0,e[u].endRow,0]),f.model.scrollSettings.allowVirtualScrolling?h.find("table tr").filter(function(){return n(this).attr("idx")>=e[u].startRow&&n(this).attr("idx")<=e[u].endRow}).find("td").addClass("e-filterhiglight"):h.find("table tr:gt("+(e[u].startRow-1)+"):lt("+(e[u].endRow-e[u].startRow+1)+")").find("td").addClass("e-filterhiglight"))}else r==="add"&&(l.find("td").addClass("e-filterhiglight"),f.updateUniqueData({isFilterHighlight:!0},[t,0,i,0]))},_checkFilterApplied:function(n,t,i,r,u,f){var s=this.XLObj,l=s.getSheet(n),o=l.filterSettings.tableRange,h,e,c;for(s._isFilterApplied=!1,e=0,c=o.length;e<c;e++)if(h=!1,o[e].filteredColumns.length?(chkObj=s._checkFilterMerge(n,[o[e].startRow-1,o[e].multifilterIdx[0],o[e].endRow,o[e].multifilterIdx[o[e].multifilterIdx.length-1]],t,i,r,u,f,"filter",h),s._isFilterApplied=!chkObj.isAlert):s._isFilterApplied=!1,s._isFilterApplied)return!0;return!1},_updateFilterCollection:function(i,r,u,f,e){var l,h,a,p,d,g,c=this.XLObj,v=c.getSheet(i),w=v.filterSettings.tableRange,o,s,it=c.model.scrollSettings.allowVirtualScrolling,k,nt,tt,b,y;if(u=u+1,f==="row")for(l=0,p=w.length;l<p;l++)o=w[l],s=o.multifilterIdx,e==="insert"?r<=o.endRow&&(o.endRow=o.endRow+u,r<o.startRow?(o.startRow=o.startRow+u,o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u,isInsertBefore:!0})):o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u})):r<=o.endRow&&(o.endRow=o.endRow-u,r<o.startRow?(o.startRow=o.startRow-u,o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u,isInsertBefore:!0})):o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u})),startCell={rowIndex:o.startRow,colIndex:s[0]},endCell={rowIndex:o.endRow,colIndex:s[s.length-1]},this._getSelectedRangeData(startCell,endCell,o.tableID),o.selectedRange=n.extend(!0,{},v._selectedRange),o.filteredRange=n.extend(!0,{},v.filterSettings.filteredRange);else for(tt=c._dataContainer.sheets[i],b=0,l=0,p=w.length;l<p;l++){if(o=w[l],s=o.multifilterIdx,y=n.extend(!0,[],s),this._updateFilteredColumns(l,r,u,e),e==="insert"){if(r<=s[0]){for(h=s.length-1;h>=0;h--)s[b]=s[b]+u,b++;o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u,isInsertBefore:!0})}else if(r<=s[s.length-1])for(o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:u}),h=y[y.length-1],d=y[y.length-1]+u;h<=d;h++)s.indexOf(h)===-1&&s.push(h)}else if(r<=s[0]){for(h=0;h<s.length;h++)s[h]=s[h]-u;o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u,isInsertBefore:!0})}else if(r<=s[s.length-1]){for(a=r,g=s[s.length-1];a<=g;a++)nt=c._generateHeaderText(a+1),k=c.XLEdit.getPropertyValue(o.startRow-1,a,"filterState"),!t.isNullOrUndefined(k)&&k.indexOf("filtered")>-1&&this._clearFilterColumn(nt,"","","Or","","",o.tableID);s.splice(s.length-u,u);o.tableID>-1&&c.XLFormat._refreshTableRowCol({tid:o.tableID,pos:f,cnt:-u})}startCell={rowIndex:o.startRow,colIndex:s[0]};endCell={rowIndex:o.endRow,colIndex:s[s.length-1]};this._getSelectedRangeData(startCell,endCell,o.tableID);o.selectedRange=n.extend(!0,{},v._selectedRange);o.filteredRange=n.extend(!0,{},v.filterSettings.filteredRange);s.length<2&&(o.multiFiltering=!1)}},_updateFilteredColumns:function(t,i,r,u){var f=this.XLObj,k,nt=f.getActiveSheetIndex(),e=f.getSheet(nt).filterSettings.tableRange[t],y=n.extend(!0,[],e.filteredColumns),d=n.extend(!0,{},e.fColumns),l=n.extend(!0,{},e.fColumns),g,o,c,v;for(colIdxes=e.multifilterIdx,o=0,g=y.length;o<g;o++)colIdx=f.XLEdit.getColumnIndexByField(e.filteredColumns[o].field),i<=colIdx&&(u==="delete"?i===colIdx?y.splice(o,1):y[o].field=f._generateHeaderText(colIdx-r+1):y[o].field=f._generateHeaderText(colIdx+r+1));e.filteredColumns=y;var s,p,w,h,a,tt=f.getObjectKeys(e.fColumns),b=f.getObjectKeys(d);for(e.predicate=e.predicate,o=b.length-1;o>=0;o--)for(k=f.XLEdit.getColumnIndexByField(b[o]),c=i;c<i+r;c++)if(c<=k){for(s=n.extend(!0,[],d[b[o]]),v=0;v<s.length;v++)colIdx=f.XLEdit.getColumnIndexByField(s[v].field),c<=colIdx&&(u==="delete"?c===colIdx?s.splice(o,1):s[v].field=f._generateHeaderText(colIdx-r+1):s[v].field=f._generateHeaderText(colIdx+r+1));p=f.XLEdit.getColumnIndexByField(b[o]);h=f._generateHeaderText(p+1);u==="delete"?(w=p-r,c===p?(delete e.predicate[h],delete l[h]):(a=f._generateHeaderText(w+1),l[a]=s,delete l[h],e.predicate[a]=f._excelFilter.generatePredicate(s),delete e.predicate[h])):(w=p+r,a=f._generateHeaderText(w+1),l[a]=s,delete l[h],e.predicate[a]=f._excelFilter.generatePredicate(s),delete e.predicate[h])}e.fColumns=l},_renderCustomFilter:function(){var i=this.XLObj,r=i._id+"_filter_custom",u=n("#"+r),o=t.buildTag("div#"+r+"_content"),f=t.buildTag("input#"+r+"_filterBtn.e-filter",{},{},{type:"button",value:"Filter"}),e=t.buildTag("input#"+r+"_clearBtn.e-clear",{},{},{type:"button",value:"Clear"});u.append(o.append(t.buildTag("div.e-fltrbtndiv").append(f).append(e)));this._createButton("filter",f);this._createButton("clear",e);u.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("Filter"),width:"100%",height:"100%",cssClass:"e-ss-dialog e-"+i._id+"-dlg",open:function(){n("#"+i._id+"_formatdlg_okbtn").focus()},close:t.proxy(this._customFltrDlgClose,this)})},_customFltrDlgClose:function(){n("#"+this.XLObj._id+"_filter_custom_"+this._colType).hide()},_refreshCustomFilter:function(i){var e=this.XLObj,r=e._id+"_filter_custom",u=t.buildTag("input#"+r+"_"+i+"_ddinput.e-"+e._id+"_customddl",{},{},{type:"text"}),f=t.buildTag("input#"+r+"_"+i+"_acString.e-filterval",{},{height:"26px",width:"100%"},{type:"text"}),o,s=n("#"+r+"_content");s.prepend(t.buildTag("div#"+r+"_"+i,"",{display:"none"}).append(t.buildTag("div.e-operdiv").append(u)).append(t.buildTag("div.e-textdiv").append(f)));u.ejDropDownList({dataSource:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Less Than",value:"lessthan"},{text:"Less Than Or Equal",value:"lessthanorequal"},{text:"Greater Than",value:"greaterthan"},{text:"Greater Than Or Equal",value:"greaterthanorequal"},{text:"Between",value:"between"}],width:"100%",fields:{id:"value",text:"text",value:"value"},select:n.proxy(this._onNumFormatSelect,this),selectedItemIndex:0});switch(i){case"string":u.ejDropDownList("option",{dataSource:[{text:"Equal",value:"equal"},{text:"Not Equal",value:"notequal"},{text:"Starts With",value:"startswith"},{text:"Ends With",value:"endswith"},{text:"Contains",value:"contains"}],selectedItemIndex:0});f.ejAutocomplete({width:"100%",height:26,enableDistinct:!0,focusIn:function(){o=u.ejDropDownList("model.value")}});break;case"number":f.ejNumericTextbox({showSpinButton:!1,height:"26px",decimalPlaces:2,width:"100%"});break;case"boolean":$tchkBox.ejCheckBox({});break;case"date":f.ejDatePicker({width:"100%"})}},_createButton:function(n,i){var r=n=="filter"?t.proxy(this._fltrBtnHandler,this):t.proxy(this._fltrClrHandler,this);i.ejButton({size:"normal",type:"button",height:22,width:60,click:r,showRoundedCorner:!0})},_fltrBtnHandler:function(){var r=this.XLObj,e=r.getActiveSheetIndex(),i=r._id+"_filter_custom",u=n("#"+i+"_"+this._colType+"_ddinput").ejDropDownList("model.value"),f=n("#"+i+"_"+this._colType+"_acString").val();arg={action:"filtering",filterCollection:[{field:this._colName,matchcase:!0,operator:u,value:f,predicate:"or"}],fieldName:this._colName,ejpredicate:{field:this._colName,operator:u,value:f,isComplex:!1,ignoreCase:!1},tableID:this._tableId};r._excelFilter._predicates[e][this._colName]=t.Predicate(this._colName,u,f);this._filterHandler(arg);n("#"+i).ejDialog("close");n("#"+i+"_"+this._colType).hide()},_fltrClrHandler:function(){var i=this.XLObj,t=i._id+"_filter_custom",r=n("#"+t+"_"+this._colType+"_ddinput").ejDropDownList("model.value");this._clearFilterColumn(this._colName,"","","Or","","",this._tableId);n("#"+t).ejDialog("close");n("#"+t+"_"+this._colType).hide()},_openNormalFilterDlg:function(t,i,r,u){var e=this.XLObj,f=e._id+"_filter_custom";n("#"+f+"_"+i).show();n("#"+f).ejDialog("open");n("#"+f+"_"+i+"_ddinput").ejDropDownList("option",{selectedItemIndex:0});this._colName=t;this._colType=i;this._tableId=r;i==="string"&&n("#"+f+"_"+i+"_acString").ejAutocomplete("option",{fields:{key:this._colName,text:this._colName},dataSource:e.getSheet(e.getActiveSheetIndex()).filterSettings.tableRange[u].filteredRange})}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.ribbon=function(n){this.XLObj=n;this._appTabCollection={};this._tabCollection=[];this._contextualTabCollection=[];this._smallBtnHeight=25;this._mediumBtnHeight=35;this._bigBtnHeight=75;this._splitBtnHeight=75;this._dropDownHeight=25;this._ribbonState=!0;this._isSetModel=!1;this._isDesignTab=!0;this._isDirtySelect=!1;this._isMergeSelect=!1;this._isFilterSelect={};this._hasTitle="";this._isNmgrid="";this._isPanelVisible=!1;this._ctrlCreated=!1;this._homeBtnIds=["Home_Clipboard_Paste","Home_Font_IncreaseFontSize","Home_Font_DecreaseFontSize","Home_Alignment_DecreaseIndent","Home_Alignment_IncreaseIndent","Home_Number_IncreaseDecimal","Home_Number_DecreaseDecimal","Home_Actions_Undo","Home_Actions_Redo","Home_Number_Accounting","Home_Number_CommaStyle","Home_Number_Percentage","Home_Clipboard_Cut","Home_Clipboard_Copy"];this._homeSptBtnIds=["Home_Clipboard_PasteOptions","Home_Font_Border","Home_Styles_ConditionalFormatting","Home_Styles_FormatAsTable","Home_Styles_CellStyles","Others_Editing_FindSelect","Home_Editing_Clear","Home_Alignment_Merge","Home_Editing_SortFilter","Home_Editing_AutoSum"];this._homeToggleBtnIds=["Home_Font_Bold","Home_Font_Italic","Home_Font_Underline","Home_Font_StrikeThrough","Home_Alignment_AlignLeft","Home_Alignment_AlignRight","Home_Alignment_AlignCenter","Home_Alignment_TopAlign","Home_Alignment_MiddleAlign","Home_Alignment_BottomAlign","Home_Alignment_WrapText","Home_Clipboard_FormatPainter"];this._homeDdIds=["Home_Number_NumberFormat","Home_Font_FontSize","Home_Font_FontFamily"];this._homeCpIds=["Home_Font_FillColor","Home_Font_FontColor"];this._insertBtnIds=["Insert_Tables_PivotTable","Insert_Tables_Table","Insert_Links_Hyperlink","Insert_Illustrations_Pictures"];this._insertSptBtnIds=["Insert_Charts_ColumnChart","Insert_Charts_BarChart","Insert_Charts_StockChart","Insert_Charts_LineChart","Insert_Charts_AreaChart","Insert_Charts_PieChart","Insert_Charts_ScatterChart"];this._dataBtnIds=["Data_SortFilter_SortAtoZ","Data_SortFilter_SortZtoA","Data_SortFilter_Filter","Data_SortFilter_ClearFilter","Data_DataTools_DataValidation"];this._dataSptBtnIds=["Data_DataTools_DataValidationOptions"];this._pageLayChckBxIds=["PageLayout_Show_Headings","PageLayout_Show_Gridlines"];this._pageLayBtnIds=["PageLayout_PageLayout_PageSize","PageLayout_Print_Print","PageLayout_Print_PrintSelected"];this._pageLaySptBtnIds=["PageLayout_PageLayout_PageSizeOptions"];this._reviewTglBtnIds=["Review_Changes_ProtectSheet","Review_Changes_ProtectWorkbook","Review_Changes_LockCell"];this._cmntBtnIds=["Review_Comments_NewComment","Review_Comments_DeleteComment","Review_Comments_PreviousComment","Review_Comments_NextComment","Review_Comments_ShowHideComment"];this._cmntTglBtnIds=["Review_Comments_ShowAllComments"];this._othersBtnIds=["Others_Cells_InsertCell","Others_Cells_DeleteCell","Others_Formulas_NameManager","Others_Formulas_DefineName","Others_CalCulation_CalculateNow","Others_CalCulation_CalculateSheet"];this._othersSptBtnIds=["Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Editing_FindSelect","Others_Window_FreezePanes","Others_CalCulation_CalculationOptions"];this._contextualBtnIds=["Design_Tools_ResizeTable","Design_Tools_ConvertToRange"];this._contextualInputIds=["Ribbon_Design_Properties_TableName"];this._contextualCheckBoxIds=["Design_TableStyleOptions_FirstColumn","Design_TableStyleOptions_LastColumn","Design_TableStyleOptions_TotalRow","Design_TableStyleOptions_FilterColumn"];this._protectStateBtnIds=["Home_Clipboard_Cut","Home_Clipboard_Copy","Others_Editing_FindSelect","Home_Clipboard_Paste","Home_Clipboard_PasteOptions","Home_Actions_Undo","Home_Actions_Redo","Review_Changes_ProtectSheet","Review_Changes_ProtectWorkbook","PageLayout_Print_Print","PageLayout_Print_PrintSelected","Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Cells_InsertCell","Others_Cells_DeleteCell"];this._chartDesignBtnIds=["ChartDesign_Data_SwitchRowColumn","ChartDesign_Data_SelectData","ChartDesign_Type_ChangeChartType"];this._chartDesignSptBtnIds=["ChartDesign_ChartLayouts_AddChartElement"];this._chartDesignDdIds=["ChartDesign_ChartThemes_ChartThemes"];this._formatBtnIds=["Format_Adjust_ChangePicture"];this._formatSptBtnIds=["Format_Adjust_ResetPicture","Format_Border_PictureBorder"];this._pasteMenuData=[{id:"PasteSpecial",text:n._getLocStr("PasteSpecial"),parentId:null},{id:"PasteValues",text:n._getLocStr("PasteValues"),parentId:null}];this._fontFamily=[{value:"1",text:"Angsana New"},{value:"2",text:"Arial"},{value:"3",text:"Arial Black"},{value:"4",text:"Batang"},{value:"5",text:"Book Antiqua"},{value:"6",text:"Browallia New"},{value:"7",text:"Calibri"},{value:"8",text:"Cambria"},{value:"9",text:"Candara"},{value:"10",text:"Century"},{value:"11",text:"Comic Sans MS"},{value:"12",text:"Consolas"},{value:"13",text:"Constantia"},{value:"14",text:"Corbel"},{value:"15",text:"Cordia New"},{value:"16",text:"Courier"},{value:"17",text:"Courier New"},{value:"18",text:"DilleniaUPC"},{value:"19",text:"Dotum"},{value:"20",text:"FangSong"},{value:"21",text:"Garamond"},{value:"22",text:"Georgia"},{value:"23",text:"Gulim"},{value:"24",text:"GungSuh"},{value:"25",text:"KaiTi"},{value:"26",text:"JasmineUPC"},{value:"27",text:"Malgun Gothic"},{value:"28",text:"Mangal"},{value:"29",text:"Meiryo"},{value:"30",text:"Microsoft JhengHei"},{value:"31",text:"Microsoft YaHei"},{value:"32",text:"MingLiu"},{value:"33",text:"MingLiU_HKSCS"},{value:"34",text:"MS Gothic"},{value:"35",text:"MS Mincho"},{value:"36",text:"MS PGothic"},{value:"37",text:"MS PMincho"},{value:"38",text:"PMingliU"},{value:"39",text:"PMingLiU-ExtB"},{value:"40",text:"SimHei"},{value:"41",text:"SimSun"},{value:"42",text:"SimSun-ExtB"},{value:"43",text:"Tahoma"},{value:"44",text:"Times"},{value:"45",text:"Times New Roman"},{value:"46",text:"Trebuchet MS"},{value:"47",text:"Verdana"},{value:"48",text:"Yu Gothic"},{value:"49",text:"Yu Mincho"}];this._fontSize=[{value:"8pt",text:"8"},{value:"9pt",text:"9"},{value:"10pt",text:"10"},{value:"11pt",text:"11"},{value:"12pt",text:"12"},{value:"14pt",text:"14"},{value:"16pt",text:"16"},{value:"18pt",text:"18"},{value:"20pt",text:"20"},{value:"22pt",text:"22"},{value:"24pt",text:"24"},{value:"26pt",text:"26"},{value:"28pt",text:"28"},{value:"36pt",text:"36"},{value:"48pt",text:"48"},{value:"72pt",text:"72"}];this._mergeMenuData=[{id:"MergeAndCenter",text:n._getLocStr("MergeAndCenter"),parentId:null,sprite:"e-icon e-ss-mergecenter"},{id:"MergeAcross",text:n._getLocStr("MergeAcross"),parentId:null,sprite:"e-icon e-ss-mergeacross"},{id:"MergeCells",text:n._getLocStr("MergeCells"),parentId:null,sprite:"e-icon e-ss-merge"},{id:"UnmergeCells",text:n._getLocStr("UnmergeCells"),parentId:null,sprite:"e-icon e-ss-unmerge"}];this._sortFltrMenuData=[{id:"Ribbon_SortAtoZ",text:this.XLObj._getLocStr("SortAtoZ"),parentId:null,sprite:"e-icon e-ssdrop-sortatoz"},{id:"Ribbon_SortZtoA",text:this.XLObj._getLocStr("SortZtoA"),parentId:null,sprite:"e-icon e-ssdrop-sortztoa"},{id:"Ribbon_Filter",text:this.XLObj._getLocStr("Filter"),parentId:null,sprite:"e-icon e-ssdrop-filter"},{id:"Ribbon_ClearFilter",text:this.XLObj._getLocStr("ClearFilter"),parentId:null,sprite:"e-icon e-ssdrop-clearfilter"}];this._findMenuData=[{id:"Find",text:n._getLocStr("Find")+"...",parentId:null,sprite:"e-icon e-ss-find"},{id:"Replace",text:n._getLocStr("Replace")+"...",parentId:null,sprite:"e-icon e-ss-replace"},{id:"GoTo",text:n._getLocStr("GoTo")+"...",parentId:null,sprite:"e-icon e-ss-goto"},{id:"GoToSpecial",text:n._getLocStr("GoTo")+" "+n._getLocStr("Special")+"...",parentId:null},{id:"Formulas",text:n._getLocStr("Formulas"),parentId:null},{id:"Comments",text:n._getLocStr("Comments"),parentId:null},{id:"CFormat",text:n._getLocStr("ConditionalFormat"),parentId:null},{id:"Constants",text:n._getLocStr("Constants"),parentId:null},{id:"DataValidation",text:n._getLocStr("DataValidation"),parentId:null}];this._calcOptData=[{id:this.XLObj._id+"_CalcAuto",text:n._getLocStr("Automatic"),parentId:null,sprite:"e-icon e-ss-calcauto"},{id:this.XLObj._id+"_CalcManual",text:n._getLocStr("Manual"),parentId:null,sprite:"e-icon"}];this._valMenuData=[{id:"Validation",text:n._getLocStr("DataValidation")+"...",parentId:null,sprite:"e-icon e-ss-validation"},{id:"HighlightVal",text:n._getLocStr("HighlightVal"),parentId:null,sprite:"e-icon e-ss-hlval"},{id:"ClearHLVal",text:n._getLocStr("ClearFormats"),parentId:null,sprite:"e-icon e-ss-clearval"},{id:"ClearVal",text:n._getLocStr("ClearVal"),parentId:null,sprite:"e-icon e-ss-clearval"}];this._pageSizes=[{id:"A4",text:n._getLocStr("A4"),parentId:null,sprite:"e-icon e-ss-A4size"},{id:"A3",text:n._getLocStr("A3"),parentId:null,sprite:"e-icon e-ss-A3size"},{id:"Letter",text:n._getLocStr("Letter"),parentId:null,sprite:"e-icon e-ss-lettersize"}];this._viewMenuData=[{id:"freezePanes",text:n._getLocStr("FreezePanes"),parentId:null,sprite:"e-icon e-ss-frzpane"},{id:"FreezeTopRow",text:n._getLocStr("FreezeTopRow"),parentId:null,sprite:"e-icon e-ss-frzrow"},{id:"FreezeFirstColumn",text:n._getLocStr("FreezeFirstColumn"),parentId:null,sprite:"e-icon e-ss-frzcln"}];this._insertMenuData=[{id:"InsertCells",text:n._getLocStr("InsCells")+"...",parentId:null,sprite:"e-icon e-ssr-inscell"},{id:"InsertSheetRows",text:n._getLocStr("InsRows"),parentId:null,sprite:"e-icon e-ssr-insrow"},{id:"InsertSheetColumns",text:n._getLocStr("InsCols"),parentId:null,sprite:"e-icon e-ssr-inscol"},{id:"InsertSheet",text:n._getLocStr("InsSheet"),parentId:null,sprite:"e-icon e-ssr-inssheet"}];this._resetPicture=[{id:"resetpicture",text:n._getLocStr("ResetPicture"),parentId:null,sprite:"e-icon e-ss-resetpicture"},{id:"resetsize",text:n._getLocStr("ResetSize"),parentId:null,sprite:"e-icon e-ss-resetpicture"}];var t=n._getLocStr("BorderStyles").split("/");this._borderMenuData=[{id:"bottom",text:n._getLocStr("BottomBorder"),parentId:null,sprite:"e-icon e-ss-bottom"},{id:"top",text:n._getLocStr("TopBorder"),parentId:null,sprite:"e-icon e-ss-top"},{id:"left",text:n._getLocStr("LeftBorder"),parentId:null,sprite:"e-icon e-ss-left"},{id:"right",text:n._getLocStr("RightBorder"),parentId:null,sprite:"e-icon e-ss-right"},{id:"noborder",text:n._getLocStr("NoBorder"),parentId:null,sprite:"e-icon e-ss-noborder"},{id:"allborder",text:n._getLocStr("AllBorder"),parentId:null,sprite:"e-icon e-ss-allborder"},{id:"outside",text:n._getLocStr("OutsideBorder"),parentId:null,sprite:"e-icon e-ss-outside"},{id:"thickbox",text:n._getLocStr("ThickBoxBorder"),parentId:null,sprite:"e-icon e-ss-thickbox"},{id:"thickbottom",text:n._getLocStr("ThickBottomBorder"),parentId:null,sprite:"e-icon e-ss-thickbottom"},{id:"topandbottom",text:n._getLocStr("TopandBottomBorder"),parentId:null,sprite:"e-icon e-ss-topandbottom"},{id:"topandthickbottom",text:n._getLocStr("TopandThickBottomBorder"),parentId:null,sprite:"e-icon e-ss-topandthickbottom"},{id:"drawborder",text:n._getLocStr("DrawBorder"),parentId:null,sprite:"e-icon e-ss-drawborder"},{id:"drawbordergrid",text:n._getLocStr("DrawBorderGrid"),parentId:null,sprite:"e-icon e-ss-drawbordergrid"},{id:n._id+"_bordercolor",text:n._getLocStr("BorderColor"),parentId:null},{id:n._id+"_Ribbon_borderstyle",text:n._getLocStr("BorderStyle"),parentId:null},{id:n._id+"_Ribbon_bordercolor",text:"",parentId:n._id+"_bordercolor"},{id:"solid",text:t[0],parentId:n._id+"_Ribbon_borderstyle"},{id:"dashed",text:t[1],parentId:n._id+"_Ribbon_borderstyle"},{id:"dotted",text:t[2],parentId:n._id+"_Ribbon_borderstyle"}];this._cFormatMenuData=[{id:n._id+"_HLCellRules",text:"Highlight Cell Rules",parentId:null,sprite:"e-icon e-ss-hlcellrules"},{id:"greaterthan",text:n._getLocStr("GreaterThan")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-greaterthan"},{id:"lessthan",text:n._getLocStr("LessThan")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-lessthan"},{id:"between",text:n._getLocStr("Between")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-between"},{id:"equalto",text:n._getLocStr("EqualTo")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-equalto"},{id:"textcontains",text:n._getLocStr("TextthatContains")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-textcontains"},{id:"dateoccur",text:n._getLocStr("DateOccurring")+"...",parentId:n._id+"_HLCellRules",sprite:"e-icon e-ss-dateoccur"},{id:n._id+"_CreateRule",text:n._getLocStr("CreateRule"),parentId:null,sprite:"e-icon e-ss-createrule"},{id:n._id+"_ClearRules",text:n._getLocStr("ClearRules"),parentId:null,sprite:"e-icon e-ss-clearrules"},{id:"clearselected",text:n._getLocStr("ClearRulesfromSelected"),parentId:n._id+"_ClearRules"},{id:"clearall",text:n._getLocStr("ClearRulesfromEntireSheets"),parentId:n._id+"_ClearRules"}];this._textAlign=[{value:"1",text:"Left"},{value:"2",text:"Center"},{value:"3",text:"Right"}];this._verticalAlign=[{value:"1",text:"Top"},{value:"2",text:"Middle"},{value:"3",text:"Bottom"}];this._actions=[{value:"Greater",text:"greater than"},{value:"GreaterOrEqual",text:"greater or equal to"},{value:"Less",text:"less than"},{value:"LessOrEqual",text:"less than or equal to"},{value:"Equal",text:"equal to"},{value:"NotEqual",text:"not equal to"},{value:"Between",text:"between"},{value:"NotBetween",text:"not between"}];this._types=[{value:"number",text:"Number"},{value:"decimal",text:"Decimal"},{value:"date",text:"Date"},{value:"time",text:"Time"},{value:"text",text:"TextLength"},{value:"list",text:"List"}];this._cFormatData={greaterthan:["GTTitle","GTContent"],lessthan:["LTTitle","LTContent"],between:["BWTitle","BWContent"],equalto:["EQTitle","EQContent"],textcontains:["ContainsTitle","ContainsContent"],dateoccur:["DateTitle","DateContent"]};this._styles=[{value:"redft",text:"Light Red Fill with Dark Red Text"},{value:"yellowft",text:"Yellow Fill with Dark Yellow Text"},{value:"greenft",text:"Green Fill with Dark Green Text"},{value:"redf",text:"Red Fill"},{value:"redt",text:"Red Text"}];this._currentCFormat="";this._addrList=[];this._within=[{value:"sheet",text:n._getLocStr("Sheet")},{value:"workbook",text:n._getLocStr("Workbook")}];this._sType=[{value:"columns",text:n._getLocStr("Columns")},{value:"rows",text:n._getLocStr("Rows")}];this._vType=[{value:"value",text:n._getLocStr("Value")},{value:"formula",text:n._getLocStr("Formula")},{value:"comment",text:n._getLocStr("Comments")}];this._direction=[{value:"down",text:n._getLocStr("Down")},{value:"up",text:n._getLocStr("Up")}];this._gotoRBtnSet1=["Comments","Blanks","LastCell","Formulas","Constants"];this._gotoRBtnSet2=["RowDiff","ColDiff","CFormat","DataValidation"];this._gotoChkBox=["GotoNumbers","GotoText","GotoLogicals","GotoError"];this._numberFormat=[{value:"1",text:"General"},{value:"2",text:"Number"},{value:"3",text:"Currency"},{value:"4",text:"Accounting"},{value:"5",text:"Percentage"},{value:"6",text:"Text"},{value:"7",text:"Shortdate"},{value:"8",text:"Longdate"},{value:"9",text:"Time"},{value:"10",text:"Scientific"},{value:"11",text:"Fraction"},{value:"12",text:"Custom"}];this._deleteMenuData=[{id:"DeleteCells",text:n._getLocStr("DelCells")+"...",parentId:null,sprite:"e-icon e-ssr-delcell"},{id:"DeleteSheetRows",text:n._getLocStr("DelRows"),parentId:null,sprite:"e-icon e-ssr-delrow"},{id:"DeleteSheetColumns",text:n._getLocStr("DelCols"),parentId:null,sprite:"e-icon e-ssr-delcol"},{id:"DeleteSheet",text:n._getLocStr("DelSheet"),parentId:null,sprite:"e-icon e-ssr-delsheet"}];this._clearMenuData=[{id:"Clear_All",text:n._getLocStr("ClearAll"),parentId:null,sprite:"e-icon e-ss-clear"},{id:"Clear_Formats",text:n._getLocStr("ClearFormats"),parentId:null,sprite:"e-icon e-ss-clearformat"},{id:"Clear_Contents",text:n._getLocStr("ClearContents"),parentId:null},{id:"Clear_Comments",text:n._getLocStr("ClearComments"),parentId:null},{id:"Clear_Hyperlinks",text:n._getLocStr("ClearHyperLinks"),parentId:null}];this._autosumMenuData=[{id:"Sum",text:n._getLocStr("Sum"),parentId:null,sprite:"e-icon e-ss-autosum"},{id:"Average",text:n._getLocStr("Average"),parentId:null},{id:"Count",text:n._getLocStr("CountNumber"),parentId:null},{id:"Max",text:n._getLocStr("Max"),parentId:null},{id:"Min",text:n._getLocStr("Min"),parentId:null}];this._chartThemes=[{value:"flatlight",text:"Flat Light"},{value:"flatdark",text:"Flat Dark"},{value:"azure",text:"Azure"},{value:"azuredark",text:"Azure Dark"},{value:"lime",text:"Lime"},{value:"limedark",text:"Lime Dark"},{value:"saffron",text:"Saffron"},{value:"saffrondark",text:"Saffron Dark"}];this._isCustomCellStyleReset=!1;this.allButtonIds=["Home_Clipboard_Paste","Home_Font_IncreaseFontSize","Home_Font_DecreaseFontSize","Home_Alignment_DecreaseIndent","Home_Alignment_IncreaseIndent","Home_Number_IncreaseDecimal","Home_Number_DecreaseDecimal","Home_Actions_Undo","Home_Actions_Redo","Home_Number_Accounting","Home_Number_CommaStyle","Home_Number_Percentage","Home_Clipboard_Cut","Home_Clipboard_Copy","Insert_Tables_PivotTable","Insert_Tables_Table","Insert_Links_Hyperlink","Insert_Illustrations_Pictures","Data_SortFilter_SortAtoZ","Data_SortFilter_SortZtoA","Data_SortFilter_Filter","Data_SortFilter_ClearFilter","Data_DataTools_DataValidation","PageLayout_PageLayout_PageSize","PageLayout_Print_Print","PageLayout_Print_PrintSelected","Review_Comments_NewComment","Review_Comments_DeleteComment","Review_Comments_PreviousComment","Review_Comments_NextComment","Review_Comments_ShowHideComment","Others_Cells_InsertCell","Others_Cells_DeleteCell","Others_Formulas_NameManager","Others_Formulas_DefineName","Others_CalCulation_CalculateNow","Others_CalCulation_CalculateSheet","Design_Tools_ResizeTable","Design_Tools_ConvertToRange","ChartDesign_Data_SwitchRowColumn","ChartDesign_Data_SelectData","ChartDesign_Type_ChangeChartType","Format_Adjust_ChangePicture"];this.allSplitButtonIds=["Home_Clipboard_PasteOptions","Home_Font_Border","Home_Styles_ConditionalFormatting","Home_Styles_FormatAsTable","Home_Styles_CellStyles","Others_Editing_FindSelect","Home_Editing_Clear","Home_Alignment_Merge","Home_Editing_SortFilter","Home_Editing_AutoSum","Insert_Charts_ColumnChart","Insert_Charts_BarChart","Insert_Charts_StockChart","Insert_Charts_LineChart","Insert_Charts_AreaChart","Insert_Charts_PieChart","Insert_Charts_ScatterChart","Data_DataTools_DataValidationOptions","PageLayout_PageLayout_PageSizeOptions","Others_Cells_InsertCellOptions","Others_Cells_DeleteCellOptions","Others_Editing_FindSelect","Others_Window_FreezePanes","Others_CalCulation_CalculationOptions","ChartDesign_ChartLayouts_AddChartElement","Format_Adjust_ResetPicture","Format_Border_PictureBorder"];this.allToggleButtonIds=["Home_Font_Bold","Home_Font_Italic","Home_Font_Underline","Home_Font_StrikeThrough","Home_Alignment_AlignLeft","Home_Alignment_AlignRight","Home_Alignment_AlignCenter","Home_Alignment_TopAlign","Home_Alignment_MiddleAlign","Home_Alignment_BottomAlign","Home_Alignment_WrapText","Home_Clipboard_FormatPainter","Review_Comments_ShowAllComments","Review_Changes_ProtectSheet","Review_Changes_ProtectWorkbook","Review_Changes_LockCell"];this.allDropDownIds=["ChartDesign_ChartThemes_ChartThemes","Home_Number_NumberFormat","Home_Font_FontSize","Home_Font_FontFamily"];this.colorPickerIds=["Home_Font_FillColor","Home_Font_FontColor"];this.checkBoxIds=["PageLayout_Show_Headings","PageLayout_Show_Gridlines","Design_TableStyleOptions_FirstColumn","Design_TableStyleOptions_LastColumn","Design_TableStyleOptions_TotalRow","Design_TableStyleOptions_FilterColumn"];this.InputIds=["Ribbon_Design_Properties_TableName"];this._fileMenuData=[{id:"File",text:n._getLocStr("File"),parentId:null},{id:"New",text:n._getLocStr("New"),parentId:"File",sprite:"e-icon e-ss-newsheet"},{id:"Open",text:n._getLocStr("Open")+"...",parentId:"File",sprite:"e-icon e-ss-open"},{id:"Save",text:n._getLocStr("SaveAs"),parentId:"File",sprite:"e-icon e-ss-saveas"},{id:"Print",text:n._getLocStr("Print"),parentId:"File",sprite:"e-icon e-ssm-print"},{id:"ExportXL",text:n._getLocStr("ExportXL"),parentId:"Save",sprite:"e-icon e-ssm-exportxl"},{id:"ExportCsv",text:n._getLocStr("ExportCsv"),parentId:"Save",sprite:"e-icon e-ssm-exportcsv"},{id:"ExportPdf",text:n._getLocStr("ExportPdf"),parentId:"Save",sprite:"e-icon e-ssm-exportpdf"},{id:"PrintSheet",text:n._getLocStr("PrintSheet"),parentId:"Print",sprite:"e-icon e-ssm-print"},{id:"PrintSelected",text:n._getLocStr("PrintSelected"),parentId:"Print",sprite:"e-icon e-ssm-printselected"}];this._isAppTabCreate=!1;this._isHomeTabCreate=!1;this._isInsertTabCreate=!1;this._isDataTabCreate=!1;this._isPageLayoutTabCreate=!1;this._isReviewTabCreate=!1;this._isOthersTabCreate=!1;this._isDesignTabCreate=!1;this._isFormatTabCreate=!1;this._isChartTabCreate=!1;this._analyzeTabCreate=!1;this._isHomeTabTrgt=!1;this._isInsertTabTrgt=!1;this._isDataTabTrgt=!1;this._isPageLayoutTrgtTab=!1;this._isReviewTabTrgt=!1;this._isOthersTabTrgt=!1;this._isDesignTabTrgt=!1;this._isFormatTabTrgt=!1;this._isChartTabTrgt=!1;this._analyzeTabTrgt=!1};t.spreadsheetFeatures.ribbon.prototype={_renderChartTypeDialog:function(){var i,u,f,e,o,s,h,c,l,a,n=this.XLObj,r=n._id+"_charttypedlg";return i=t.buildTag("div#"+r+".e-chartdialog","",{},{overflow:"hidden"}),u=t.buildTag("div#"+r+"_allcharttab.e-chtdlgtab"),l=t.buildTag("div.e-dlg-fields e-dlgctndiv"),s=t.buildTag("ul .e-ul","",""),c=t.buildTag("a",n._getLocStr("AllCharts"),{},{href:"#"+n._id+"_allchart"}),h=t.buildTag("li",c),i.append(l.append(u.append(s.append(h)))),o=t.buildTag("div#"+r+"_btndiv.e-dlg-btnfields"),a=t.buildTag("div.e-dlg-btnctnr"),f=t.buildTag("input#"+r+"_okbtn","",{},{type:"button"}),e=t.buildTag("input#"+r+"_cantn","",{},{type:"button"}),f.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._chartTypeOk,this),enabled:!0,cssClass:"e-ss-okbtn"}),e.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._chartTypeCancel,this),showRoundedCorner:!0,width:60}),o.append(a.append(f,e)),i.append(o),n.element.append(i),u.ejTab({cssClass:"e-ss-dlgtab",width:"100%",height:"auto"}),this._renderAllChartTab(),i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("ChartType"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-charttype-dlg e-ss-mattab e-"+n._id+"-dlg",close:t.proxy(this._dialogClose,this)}),i},_renderAllChartTab:function(){var u,f,w,s,a,i,v,b,k=[],y="",d="",h=this.XLObj,r=h._id,p=r+"_chartdlg_allcharttab",c=["Column-6","Bar-6","Radar-2","Line-2","Area-3","Pie-3","Scatter-1"],l,e,o;for($leftdiv=t.buildTag("div#"+p+"_content.e-ss-leftdiv",""),a=t.buildTag("div#"+p+"_content.e-chtdlgcontent e-ss-rightdiv","",{overflow:"auto",float:"right"}),$listUl=t.buildTag("ul #"+p+"_list .e-ul"),e=0,o=c.length;e<o;e++)i=c[e].split("-")[0],d+="<li><span class='e-icon e-ss-dlg"+i.toLowerCase()+"chart'><\/span>"+i+"<\/li>",k.push(i);for($listUl.append(n(d)),l=t.buildTag("div#"+r+"_allchart_table.e-ss-maindiv","",{cellspacing:"0",cellpadding:"0",display:"inline-flex",width:"100%"}),n("#"+r+"_allchart").append(l),l.append($leftdiv.append($listUl)),this._createChartList(k),l.append(a),f=0,o=c.length;f<o;f++){for(s=c[f].split("-"),b=h._getLocStr("Title"+s[0]+"Chart").split("/"),i=s[0].toLowerCase(),v=t.buildTag("div#"+r+"_"+i+"chart"),u=1,w=parseInt(s[1]);u<=w;u++)y+="<div class='e-chartimg e-dlg"+i+"chart"+u+"' title='"+b[u-1]+"'><\/div>";a.append(v.append(y));n("#"+r+"_"+i+"chart").find(".e-dlg"+i+"chart1").addClass("e-chartselect");v.hide();y=""}h._on(n("#"+r+"_allchart").find(".e-chartimg"),"click",h._allChartType);n("#"+r+"_columnchart").show()},_createChartList:function(i){var r=this.XLObj,f=r._id+"_chartdlg_allcharttab",s=n("#"+r._id+"_allchart").height(),u,e=n("#"+f+"_list"),o=t.buildTag("div.e-ss-drpdiv");u=t.buildTag("input#"+f+"_input");n("#"+r._id+"_allchart").prepend(o.append(u));u.ejDropDownList({dataSource:i,width:"100%",fields:{id:"value",text:"text",value:"text"},select:n.proxy(this._onChartChange,this),selectedItemIndex:0});e.ejListBox({selectedItemIndex:0,width:"120",height:"250",fields:{text:"text",value:"value"},select:n.proxy(this._onChartChange,this),allowMultiSelection:!1})},_onChartChange:function(t){for(var r=this.XLObj,u=t.value?t.value.toLowerCase():t.text.toLowerCase(),f=["column","bar","radar","line","area","pie","scatter"],i=0;i<f.length;i++)n("#"+r._id+"_"+f[i]+"chart").hide();n("#"+r._id+"_"+u+"chart").show();n("#"+r._id+"_allchart").find(".e-chartimg").removeClass("e-chartselect");n("#"+r._id+"_"+u+"chart").find(".e-dlg"+u+"chart1").addClass("e-chartselect")},_initValDialog:function(){var i,r,u,f,e,o,s,h,n=this.XLObj,c,l;i=t.buildTag("div#"+n._id+"_ValDialog");r=t.buildTag("div#"+n._id+"_ValDialog_valDlgTab");c=t.buildTag("div.e-dlg-fields e-dlgctndiv");o=t.buildTag("ul .e-ul");h=t.buildTag("a","Settings",{},{href:"#"+n._id+"_Validation"});s=t.buildTag("li",h);o.append(s);r.append(o);i.append(c.append(r));e=t.buildTag("div#"+n._id+"btnDiv.e-dlg-btnfields");l=t.buildTag("div.e-dlg-btnctnr");u=t.buildTag("input#"+n._id+"Dialog_OkBtn","",{},{type:"button"});f=t.buildTag("input#"+n._id+"Dialog_CancelBtn","",{},{type:"button"});u.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._valDlgBtnClick,this,"ok"),enabled:!0,cssClass:"e-ss-okbtn"});f.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._valDlgBtnClick,this,"cancel"),showRoundedCorner:!0,width:60});e.append(l.append(u,f));n.element.append(i.append(e));r.ejTab({width:"100%",height:"auto",cssClass:"e-ss-dlgtab"});this._renderValDialog();i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("DataValidation"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-valdlg e-ss-mattab e-"+n._id+"-dlg",close:t.proxy(this._dialogClose,this)});this._dialogValidate("_ValDialog")},_initCFDialog:function(){var n=this.XLObj,i,e,r,u,f,o;return i=t.buildTag("div#"+n._id+"_CFDialog"),n.element.append(i),e=t.buildTag("div#"+n._id+"_CondFormat.e-dlgctndiv"),i.append(e),f=t.buildTag("div#"+n._id+"cfBtnDiv.e-dlg-btnfields"),o=t.buildTag("div.e-dlg-btnctnr"),r=t.buildTag("input#"+n._id+"cfDialog_OkBtn","",{},{type:"button"}),u=t.buildTag("input#"+n._id+"cfDialog_CancelBtn","",{},{type:"button"}),r.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:"25%",click:t.proxy(this._dlgCFOk,this),enabled:!0,cssClass:"e-ss-okbtn"}),u.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._dlgCFCancel,this),showRoundedCorner:!0,width:"25%"}),f.append(o.append(r,u)),i.append(f),i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("ConditionalFormat"),width:"auto",cssClass:"e-ss-dialog e-ss-cfdlg e-"+n._id+"-dlg",close:t.proxy(this._dialogClose,this)}),i},_initHLDialog:function(){var i=this.XLObj,r,u,f,e,o,s,h,c,l;r=t.buildTag("div#"+i._id+"_HLDialog");u=t.buildTag("div#"+i._id+"_HLDialogTab");l=t.buildTag("div.e-dlg-fields e-dlgctndiv");f=t.buildTag("ul .e-ul");o=t.buildTag("a",i._getLocStr("WebPage"),{},{href:"#"+i._id+"_Web"});e=t.buildTag("li",o);f.append(e);o=t.buildTag("a",i._getLocStr("WorkSheet"),{},{href:"#"+i._id+"_Doc"});e=t.buildTag("li",o);f.append(e);u.append(f);r.append(l.append(u));s=t.buildTag("div#"+i._id+"hlBtnDiv.e-dlg-btnfields");$btnctnr=t.buildTag("div.e-dlg-btnctnr");h=t.buildTag("input#"+i._id+"hlDialog_OkBtn","",{},{type:"button"});c=t.buildTag("input#"+i._id+"hlDialog_CancelBtn","",{},{type:"button"});h.ejButton({text:i._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgHLOk,this),enabled:!0,cssClass:"e-ss-okbtn"});c.ejButton({text:i._getLocStr("Cancel"),click:t.proxy(this._dlgHLCancel,this),showRoundedCorner:!0,width:60});s.append($btnctnr.append(h,c));r.append(s);r.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("InsertHyperLink"),width:"auto",cssClass:"e-ss-dialog e-ss-hyperlinkdlg e-ss-mattab e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),open:t.proxy(function(){var t=n("#"+i._id+"_Ribbon_webAddress"),r=n("#"+i._id+"_Ribbon_cellAddress");t.focus().setInputPos(t.val().length);r.focus().setInputPos(r.val().length)})});u.ejTab({width:"100%",itemActive:t.proxy(this._hlTabChange,this),cssClass:"e-ss-dlgtab"});this._renderHLDialog()},_initFRDialog:function(){var i=this.XLObj,e,o,s,h,c,l,y,f,r,p,u,a,v;e=t.buildTag("div#"+i._id+"_FRDialog");o=t.buildTag("div#"+i._id+"_FRDialog_FPDlgTab");p=t.buildTag("div.e-dlg-fields e-dlgctndiv");f=t.buildTag("ul .e-ul");u=t.buildTag("a",i._getLocStr("Find"),{},{href:"#"+i._id+"_Find"});r=t.buildTag("li",u);f.append(r);u=t.buildTag("a",i._getLocStr("Replace"),{},{href:"#"+i._id+"_Replace"});r=t.buildTag("li",u);f.append(r);u=t.buildTag("a",i._getLocStr("Settings"),{},{href:"#"+i._id+"_Settings"});r=t.buildTag("li",u);f.append(r);o.append(f);e.append(p.append(o));l=t.buildTag("div#"+i._id+"btnFRDiv.e-dlg-btnfields");y=t.buildTag("div.e-dlg-btnctnr");a=t.buildTag("input#"+i._id+"FR_ReplaceBtn","",{"margin-left":0},{type:"button"});v=t.buildTag("input#"+i._id+"FR_ReplaceAllBtn","",{},{type:"button"});s=t.buildTag("input#"+i._id+"FR_NextBtn","",{},{type:"button"});h=t.buildTag("input#"+i._id+"FR_PrevBtn","",{},{type:"button"});c=t.buildTag("input#"+i._id+"FR_CloseBtn","",{},{type:"button"});a.ejButton({text:i._getLocStr("Replace"),showRoundedCorner:!0,width:55,click:t.proxy(this._btnFROnClick,this,"FR_ReplaceBtn"),enabled:!0}).css("visibility","hidden");v.ejButton({text:i._getLocStr("ReplaceAll"),showRoundedCorner:!0,click:t.proxy(this._btnFROnClick,this,"FR_ReplaceAllBtn"),enabled:!0}).css("visibility","hidden");s.ejButton({text:i._getLocStr("FindNext"),showRoundedCorner:!0,width:69,click:t.proxy(this._btnFROnClick,this,"FR_NextBtn"),enabled:!0});h.ejButton({text:i._getLocStr("FindPrev"),showRoundedCorner:!0,width:69,click:t.proxy(this._btnFROnClick,this,"FR_PrevBtn"),enabled:!0});c.ejButton({text:i._getLocStr("Close"),click:t.proxy(this._btnFROnClick,this,"FR_CloseBtn"),showRoundedCorner:!0,width:47});l.append(y.append(a,v,s,h,c));e.append(l);e.ejDialog({showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("FindnReplace"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-mattab e-ss-frdlg e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),open:t.proxy(function(){i._phoneMode?(n("#"+i._id+"FR_ReplaceBtn").hide(),n("#"+i._id+"FR_ReplaceAllBtn").hide()):(n("#"+i._id+"FR_ReplaceBtn").show(),n("#"+i._id+"FR_ReplaceAllBtn").show());var t=n("#"+i._id+"_Ribbon_textFind");t.focus().setInputPos(t.val().length)})});o.ejTab({width:"100%",itemActive:t.proxy(this._findTabChange,this),cssClass:"e-ss-dlgtab"})},_initGoToDialog:function(){var n=this.XLObj,i,e,h,r,u,f,o,s,c;i=t.buildTag("div#"+n._id+"_GoDialog");e=t.buildTag("div#"+n._id+"_GoToDlgTab");c=t.buildTag("div.e-dlg-fields e-dlgctndiv");r=t.buildTag("ul .e-ul");f=t.buildTag("a",n._getLocStr("GoTo"),{},{href:"#"+n._id+"_GoTo"});u=t.buildTag("li",f);r.append(u);f=t.buildTag("a",n._getLocStr("GoTo")+" "+n._getLocStr("Special"),{},{href:"#"+n._id+"_GoToSp"});u=t.buildTag("li",f);r.append(u);e.append(r);i.append(c.append(e));h=t.buildTag("div#"+n._id+"btnDiv.e-dlg-btnfields");$btnctnr=t.buildTag("div.e-dlg-btnctnr");i.append(h.append($btnctnr));o=t.buildTag("input#"+n._id+"Dialog_GoOkBtn","",{},{type:"button"});s=t.buildTag("input#"+n._id+"Dialog_GoCancelBtn","",{},{type:"button"});o.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:"23%",click:t.proxy(this._gotoBtnClick,this,"ok"),cssClass:"e-ss-okbtn"});s.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._gotoBtnClick,this,"cancel"),showRoundedCorner:!0,width:60});$btnctnr.append(o,s);n.element.append(i)},_initPvtDialog:function(){var n=this.XLObj,i,r,u,f,e;i=t.buildTag("div#"+n._id+"_PvtDialog");n.element.append(i);i.append(t.buildTag("div#"+n._id+"_Pivot.e-dlgctndiv"));f=t.buildTag("div#"+n._id+"pvtBtnDiv.e-dlg-btnfields");e=t.buildTag("div.e-dlg-btnctnr");r=t.buildTag("input#"+n._id+"PvtDialog_OkBtn");u=t.buildTag("input#"+n._id+"PvtDialog_CancelBtn");r.ejButton({text:n._getLocStr("Ok"),showRoundedCorner:!0,width:"25%",click:t.proxy(this._dlgPvtOk,this),enabled:!0,cssClass:"e-ss-okbtn"});u.ejButton({text:n._getLocStr("Cancel"),click:t.proxy(this._dlgPvtCancel,this),showRoundedCorner:!0,width:"25%"});f.append(e.append(r,u));i.append(f);i.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:n._getLocStr("CreatePivotTable"),width:"auto",cssClass:"e-ss-dialog e-"+n._id+"-dlg e-ss-pvtdlg",close:t.proxy(this._dialogClose,this)})},_dialogClose:function(){this.XLObj.setSheetFocus()},_beforeDlgClose:function(t){var i=n("#"+this.XLObj._id+"_nmgrid_dialogEdit_overLay");i.length&&(t.cancel=!0)},_homeTabObj:function(){var n,f=this.XLObj,u="imagetop",r={id:"home",text:f._getLocStr("HOME"),groups:[]},i=f._id,e=f.model;n={text:"Clipboard",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Home_Clipboard_Paste","paste","textandimage","e-icon e-ssr-paste",45,this._mediumBtnHeight,"PasteTitle","PasteContent",!1,u),this._generateSplitBtn("Home_Clipboard_PasteOptions","Paste","textandimage",i+"_Ribbon_Paste",{dataSource:this._pasteMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,45,this._mediumBtnHeight,"bottom","","dropdown","e-ssr-pastesbtn","PasteTitle","PasteSplitContent")]},{groups:[this._generateBtn("Home_Clipboard_Cut","Cut","textandimage","e-icon e-ssr-cut",58,this._smallBtnHeight,"CutTitle","CutContent"),this._generateBtn("Home_Clipboard_Copy","Copy","textandimage","e-icon e-ssr-copy",67,this._smallBtnHeight,"CopyTitle","CopyContent"),this._generateToggleBtn("Home_Clipboard_FormatPainter","FormatPainter","textandimage","e-icon e-ss-formatpainter","FPTitle",110,this._smallBtnHeight,"FPContent")]}]};r.groups.push(n);n={text:"Font",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateDD("Home_Font_FontFamily","FontFamily",this._fontFamily,"7",150,this._smallBtnHeight,"FontFamily","FFContent"),this._generateDD("Home_Font_FontSize","FontSize",this._fontSize,"11pt",65,this._smallBtnHeight,"FontSize","FSContent"),this._generateBtn("Home_Font_IncreaseFontSize","IncreaseFontSize","imageonly","e-icon e-ss-increasefontsize","",this._smallBtnHeight,"IncreaseFontSize","IFSContent"),this._generateBtn("Home_Font_DecreaseFontSize","DecreaseFontSize","imageonly","e-icon e-ss-decreasefontsize","",this._smallBtnHeight,"DecreaseFontSize","DFSContent")]},{groups:[this._generateToggleBtn("Home_Font_Bold","Bold","imageonly","e-icon e-ss-bold","BoldTitle","",this._smallBtnHeight,"BoldContent"),this._generateToggleBtn("Home_Font_Italic","Italic","imageonly","e-icon e-ss-italic","ItalicTitle","",this._smallBtnHeight,"ItalicContent"),this._generateToggleBtn("Home_Font_Underline","Underline","imageonly","e-icon e-ss-underline","ULineTitle","",this._smallBtnHeight,"ULineContent"),this._generateToggleBtn("Home_Font_StrikeThrough","Linethrough","imageonly","e-icon e-ss-linethrough","LineTrTitle",25,this._smallBtnHeight,"LineTrContent",!0),this._generateSplitBtn("Home_Font_Border","Border","imageonly",i+"_Ribbon_Border",{dataSource:this._borderMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-bottom",!0,37,this._smallBtnHeight,"","","","e-borderbtn","Border","BorderContent"),this._generateCustomControl(i+"_Ribbon_Home_Font_FillColor","BackgroundColor","BackgroundColor","BGContent"),this._generateCustomControl(i+"_Ribbon_Home_Font_FontColor","FontColor","Color","ColorContent")]}]};r.groups.push(n);n={text:"Alignment",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateToggleBtn("Home_Alignment_TopAlign","TopAlign","imageonly","e-icon e-ss-topalign","TopAlign","","","TopAlignContent"),this._generateToggleBtn("Home_Alignment_MiddleAlign","MiddleAlign","imageonly","e-icon e-ss-middlealign","MiddleAlign","","","MiddleAlignContent"),this._generateToggleBtn("Home_Alignment_BottomAlign","BottomAlign","imageonly","e-icon e-ss-bottomalign","BottomAlign","","","BottomAlignContent",!0),this._generateToggleBtn("Home_Alignment_WrapText","WrapText","textandimage","e-icon e-ss-wraptext","WrapText",85,25,"WrapTextContent")]},{groups:[this._generateToggleBtn("Home_Alignment_AlignLeft","AlignLeft","imageonly","e-icon e-ss-alignleft","AlignLeft","","","AlignLeftContent"),this._generateToggleBtn("Home_Alignment_AlignCenter","AlignCenter","imageonly","e-icon e-ss-aligncenter","AlignCenter","","","AlignCenterContent"),this._generateToggleBtn("Home_Alignment_AlignRight","AlignRight","imageonly","e-icon e-ss-alignright","AlignRight","","","AlignRightContent",!0),this._generateSplitBtn("Home_Alignment_Merge","MergeAndCenter","textandimage",i+"_Ribbon_Merge",{dataSource:this._mergeMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-merge",!1,136,25,"right","","","e-spreadsheet e-mergebtn","MergeAndCenter","MergeAndCenterContent")]},{groups:[this._generateBtn("Home_Alignment_DecreaseIndent","DecreaseIndent","imageonly","e-icon e-ss-decreaseindent","",this._smallBtnHeight,"DecreaseIndent","DecreaseIndentContent"),this._generateBtn("Home_Alignment_IncreaseIndent","IncreaseIndent","imageonly","e-icon e-ss-increaseindent","",this._smallBtnHeight,"IncreaseIndent","IncreaseIndentContent")]}]};r.groups.push(n);n={text:"Actions",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Home_Actions_Undo","Undo","textandimage","e-icon e-ss-undo",40,this._bigBtnHeight,"UndoTitle","UndoContent",!1,u,""),this._generateBtn("Home_Actions_Redo","Redo","textandimage","e-icon e-ss-redo",40,this._bigBtnHeight,"RedoTitle","RedoContent",!1,u,"")]}]};r.groups.push(n);n={text:"Number",alignType:t.Ribbon.alignType.rows,enableGroupExpander:!0,content:[{groups:[this._generateDD("Home_Number_NumberFormat","NumberFormat",this._numberFormat,"1",125,this._smallBtnHeight,"NumberFormat","NumberFormatContent")]},{groups:[this._generateBtn("Home_Number_Accounting","AccountingStyle","imageonly","e-icon e-ss-accounting","",this._smallBtnHeight,"AccountingStyle","AccountingStyleContent"),this._generateBtn("Home_Number_Percentage","PercentageStyle","imageonly","e-icon e-ss-percentage","",this._smallBtnHeight,"PercentageStyle","PercentageStyleContent"),this._generateBtn("Home_Number_CommaStyle","CommaStyle","imageonly","e-icon e-ss-comma","",this._smallBtnHeight,"CommaStyle","CommaStyleContent",!0),this._generateBtn("Home_Number_IncreaseDecimal","IncreaseDecimal","imageonly","e-icon e-ss-increasedecimal","",this._smallBtnHeight,"IncreaseDecimal","IncreaseDecimalContent"),this._generateBtn("Home_Number_DecreaseDecimal","DecreaseDecimal","imageonly","e-icon e-ss-decreasedecimal","",this._smallBtnHeight,"DecreaseDecimal","DecreaseDecimalContent")]}]};r.groups.push(n);n={text:"Styles",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateSplitBtn("Home_Styles_ConditionalFormatting","ConditionalFormat","textandimage",i+"_CFormat",{dataSource:this._cFormatMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-condformat",!1,75,this._splitBtnHeight,"bottom",u,"dropdown","e-spreadsheet e-cformatbtn","ConditionalFormat","CFContent"),this._generateSplitBtn("Home_Styles_FormatAsTable","FormatasTable","textandimage",i+"_formatastable","","e-icon e-ssr-formatastable",!1,65,this._splitBtnHeight,"bottom",t.ImagePosition.ImageTop,"dropdown","e-spreadsheet e-formatastablebtn","FormatAsTable","FATContent"),this._generateSplitBtn("Home_Styles_CellStyles","CellStyles","textandimage",i+"_cellstyles","","e-icon e-ssr-cellstyles",!1,55,this._splitBtnHeight,"bottom",t.ImagePosition.ImageTop,"dropdown","e-spreadsheet e-cellstylebtn","CellStyles","CellStylesContent")]}]};r.groups.push(n);n={text:"Editing",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Home_Editing_SortFilter","SortFilter","textandimage",i+"_Ribbon_SortFilter",{dataSource:this._sortFltrMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-sortfilter",!1,50,this._splitBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-sortfltrbtn","SortFilter","SortFilterContent")]},{groups:[this._generateSplitBtn("Home_Editing_AutoSum","AutoSum","textandimage",i+"_Ribbon_AutoSum",{dataSource:this._autosumMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-autosum",!1,100,25,"right","","","e-spreadsheet e-autosumbtn","AutoSumTitle","AutoSumContent"),this._generateSplitBtn("Home_Editing_Clear","Clear","textandimage",i+"_Ribbon_Clear",{dataSource:this._clearMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-clear",!1,80,25,"right","","dropdown","e-spreadsheet e-clearbtn","Clear","ClearContent")]}]};r.groups.push(n);this._tabCollection.push(r)},_insertTabObj:function(){var n,f=this.XLObj,u="imagetop",r={id:"insert",text:f._getLocStr("INSERT"),groups:[]},i=f._id;n={text:"Tables",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Insert_Tables_PivotTable","PivotTable","textandimage","e-icon e-ssr-pivottable",65,this._bigBtnHeight,"PivotTable","PivotTableContent",!1,u),this._generateBtn("Insert_Tables_Table","Table","textandimage","e-icon e-ssr-table",50,this._bigBtnHeight,"Table","TableContent",!1,u)]}]};r.groups.push(n);n={text:"Illustrations",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Insert_Illustrations_Pictures","Pictures","textandimage","e-icon e-ssr-pictures",50,this._bigBtnHeight,"PicturesTitle","PicturesContent",!1,u,"")]}]};r.groups.push(n);n={text:"Links",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Insert_Links_Hyperlink","HyperLink","textandimage","e-icon e-ssr-hyperlink",60,this._bigBtnHeight,"HyperLinkTitle",["HyperLinkContent","HyperLinkPlaceContent"],!1,u,"")]}]};r.groups.push(n);n={text:"Charts",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateSplitBtn("Insert_Charts_ColumnChart","ColumnChart","imageonly",i+"_Ribbon_ColumnChart","","e-icon e-ss-colchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","ColumnChartTitle","ColumnChartContent"),this._generateSplitBtn("Insert_Charts_BarChart","BarChart","imageonly",i+"_Ribbon_BarChart","","e-icon e-ss-barchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","BarChartTitle","BarChartContent"),this._generateSplitBtn("Insert_Charts_StockChart","StockChart","imageonly",i+"_Ribbon_StockChart","","e-icon e-ss-stockchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","StockChartTitle","StockChartContent")]},{groups:[this._generateSplitBtn("Insert_Charts_LineChart","LineChart","imageonly",i+"_Ribbon_LineChart","","e-icon e-ss-linechart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","LineChartTitle","LineChartContent"),this._generateSplitBtn("Insert_Charts_AreaChart","AreaChart","imageonly",i+"_Ribbon_AreaChart","","e-icon e-ss-areachart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","AreaChartTitle","AreaChartContent"),this._generateSplitBtn("Insert_Charts_PieChart","PieChart","imageonly",i+"_Ribbon_PieChart","","e-icon e-ss-piechart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","PieChartTitle","PieChartContent")]},{groups:[this._generateSplitBtn("Insert_Charts_ScatterChart","ScatterChart","imageonly",i+"_Ribbon_ScatterChart","","e-icon e-ss-scterchart",!1,41,this._smallBtnHeight,"bottom","ej.ImagePosition.ImageTop","dropdown","e-spreadsheet e-chartbtn","ScatterChartTitle","ScatterChartContent")]}]};r.groups.push(n);this._tabCollection.push(r)},_dataTabObj:function(){var n,r=this.XLObj,i={id:"data",text:r._getLocStr("DATATAB"),groups:[]};n={text:"Sort & Filter",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Data_SortFilter_SortAtoZ","SortAtoZ","textandimage","e-icon e-ssr-sortatoz",90,this._smallBtnHeight,"SortAtoZ","SortAtoZContent",!1,"","e-datapadding"),this._generateBtn("Data_SortFilter_SortZtoA","SortZtoA","textandimage","e-icon e-ssr-sortztoa",90,this._smallBtnHeight,"SortZtoA","SortZtoAContent",!1,"","e-datapadding")]},{groups:[this._generateBtn("Data_SortFilter_Filter","Filter","textandimage","e-icon e-ssr-filter",60,this._smallBtnHeight,"Filter","FilterContent",!1,"","e-datapadding"),this._generateBtn("Data_SortFilter_ClearFilter","ClearFilter","textandimage","e-icon e-ss-clearfilter",90,this._smallBtnHeight,"ClearFilter","ClearFilterContent",!1,"","e-datapadding")]}]};i.groups.push(n);n={text:"Data Tools",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Data_DataTools_DataValidation","Validation","imageonly","e-icon e-ssr-validation",70,39,"DataValidation","DVContent",!1,"imagetop"),this._generateSplitBtn("Data_DataTools_DataValidationOptions","DataValidation","textandimage",r._id+"_Ribbon_Validation",{dataSource:this._valMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,70,this._mediumBtnHeight,"bottom","","dropdown","e-ssr-validationsbtn","DataValidation","DVContent")]}]};i.groups.push(n);this._tabCollection.push(i)},_pageTabObj:function(){var n,r=this.XLObj,u="imagetop",i={id:"pagelayout",text:r._getLocStr("PAGELAYOUT"),groups:[]};n={text:"Show",alignType:t.Ribbon.alignType.rows,width:105,content:[{groups:[{contentID:r._id+"_Ribbon_pagesetupleft",type:t.Ribbon.type.custom,height:80},]}]};i.groups.push(n);n={text:"Page Layout",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("PageLayout_PageLayout_PageSize","size","imageonly","e-icon e-ssr-pagesize",65,44,"size","PageSizeContent",!1,u,""),this._generateSplitBtn("PageLayout_PageLayout_PageSizeOptions","PageSize","textandimage",r._id+"_Ribbon_PageSize",{dataSource:this._pageSizes,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,65,this._mediumBtnHeight,"bottom","","dropdown","e-ssr-pagesizesbtn","PageSize","PageSizeContent")]}]};i.groups.push(n);n={text:"Print",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("PageLayout_Print_Print","Print","textandimage","e-icon e-ssr-print",50,this._bigBtnHeight,"Print","PrintContent",!1,u,"")]},{groups:[this._generateBtn("PageLayout_Print_PrintSelected","PrintSelected","textandimage","e-icon e-ssr-printselected",55,this._bigBtnHeight,"PrintSelected","PrintSelectedContent",!0,u,"")]}]};i.groups.push(n);this._tabCollection.push(i)},_reviewTabObj:function(){var n,u=this.XLObj,i="imagetop",r={id:"review",text:u._getLocStr("REVIEW"),groups:[]};n={text:"Comments",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Review_Comments_NewComment","New","textandimage","e-icon e-ssr-newcmnt",49,this._bigBtnHeight,"NewCommentTitle","NewCommentContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_DeleteComment","Delete","textandimage","e-icon e-ssr-deletecmnt",49,this._bigBtnHeight,"DeleteComment","DeleteCommentContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_PreviousComment","Previous","textandimage","e-icon e-ssr-previouscmnt",49,this._bigBtnHeight,"Previous","PreviousContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_NextComment","Next","textandimage","e-icon e-ssr-nextcmnt",49,this._bigBtnHeight,"Next","NextContent",!1,i)]},{groups:[this._generateBtn("Review_Comments_ShowHideComment","ShowHide","textandimage","e-icon e-ssr-showhidecmnt",160,this._smallBtnHeight,"ShowHide","ShowHideContent",!1,"imageLeft","e-ssr-cmntcolbtn"),this._generateToggleBtn("Review_Comments_ShowAllComments","ShowAll","textandimage","e-icon e-ssr-showallcmnt","ShowAll",155,this._smallBtnHeight,"ShowAllContent",!1,"e-ssr-cmntcolbtn")]}]};r.groups.push(n);n={text:"Changes",alignType:t.Ribbon.alignType.row,content:[{groups:[this._generateToggleBtn("Review_Changes_ProtectSheet","Protectsheet","textandimage","e-icon e-ssr-protectsheet","Protectsheet",60,this._bigBtnHeight,"ProtectSheetToolTip",!1,"e-ssr-protectsheetbtn","imagetop","Unprotect"),this._generateToggleBtn("Review_Changes_ProtectWorkbook","ProtectWorkbook","textandimage","e-icon e-ssr-protect","ProtectWorkbook",60,this._bigBtnHeight,"ProtectWBContent",!1,"e-ssr-cmntcolbtn","imagetop"),this._generateToggleBtn("Review_Changes_LockCell","Lock","textandimage","e-icon e-ssr-protlockcell","lock",90,this._smallBtnHeight,"Lock",!1,"e-ssr-lockbtn","","Unlock","e-icon e-ssr-protunlockcell"),]},]};r.groups.push(n);this._tabCollection.push(r)},_otherTabObj:function(){var n,r=this.XLObj,u="imagetop",i={id:"others",text:r._getLocStr("OTHERS"),groups:[]},f=r._id,e=t.ContentType;n={text:"Window",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Others_Window_FreezePanes","FreezePanes","textandimage",r._id+"_Ribbon_FPane",{dataSource:this._viewMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-frzpane",!1,55,this._splitBtnHeight,"bottom",u,"dropdown","e-spreadsheet e-fpanebtn","FreezePanes","FreezePanesContent")]}]};i.groups.push(n);n={text:r._getLocStr("Formula"),alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Others_Formulas_NameManager","NameManager",e.TextAndImage,"e-icon e-ssr-namemngr",55,this._bigBtnHeight,"NameManager",["NameManagerContent","NameManagerFormulaContent"],!1,u,"")]},{groups:[this._generateBtn("Others_Formulas_DefineName","DefineName",e.TextAndImage,"e-icon e-ssr-definename",110,25,"DefineName","DefineNameContent"),this._generateSplitBtn("Others_Formulas_UseInFormula","UseInFormula","textandimage",r._id+"_nmuseinformula","","e-icon e-ssr-useformula",!1,125,25,t.ArrowPosition.Bottom,t.ImagePosition.ImageLeft,"dropdown","e-spreadsheet e-useinformulabtn","UseInFormula","UseInFormulaContent")]}]};i.groups.push(n);n={text:"Cells",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Others_Cells_InsertCell","Insert","imageonly","e-icon e-ssr-insert",54,40,"InsertTitle",["InsertContent","MultipleInsertContent"],!1,u),this._generateSplitBtn("Others_Cells_InsertCellOptions","Insert","textandimage",f+"_Ribbon_Ins",{dataSource:this._insertMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,54,this._mediumBtnHeight,"bottom","","dropdown","e-insertsbtn","InsertTitle","InsertSBContent")]},{groups:[this._generateBtn("Others_Cells_DeleteCell","Delete","imageonly","e-icon e-ssr-delete",54,40,"DeleteTitle",["DeleteContent","MultipleDeleteContent"],!1,u),this._generateSplitBtn("Others_Cells_DeleteCellOptions","Delete","textandimage",f+"_Ribbon_Del",{dataSource:this._deleteMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"",!1,54,this._mediumBtnHeight,"bottom","","dropdown","e-deletesbtn","DeleteTitle",["DeleteContent","MultipleDeleteContent"])]}]};i.groups.push(n);n={text:"Editing",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateSplitBtn("Others_Editing_FindSelect","FindSelect","textandimage",f+"_Ribbon_FindRep",{dataSource:this._findMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-findselect",!1,55,this._splitBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-findbtn","FindSelectTitle","FindSelectContent")]}]};i.groups.push(n);n={text:"Calculation",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Others_CalCulation_CalculationOptions","CalculationOptions","textandimage",f+"_Ribbon_CalcOpt",{dataSource:this._calcOptData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ss-calcopt",!1,67,this._splitBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-coptbtn","CalcOptTitle",["CalcOptContent","CalcOptRecalcContent"])]},{groups:[this._generateBtn("Others_CalCulation_CalculateNow","CalculateNow",e.TextAndImage,"e-icon e-ss-calcnow",110,30,"CalculateNow",["CalculateNowContent","CalculateNowTurnOffContent"]),this._generateBtn("Others_CalCulation_CalculateSheet","CalculateSheet",e.TextAndImage,"e-icon e-ss-calcsheet",110,30,"CalculateSheet",["CalculateSheetContent","CalculateSheetTurnOffContent"])]}]};i.groups.push(n);this._tabCollection.push(i)},_renderRibbon:function(i){var r=this.XLObj,e=r._id,o=r.element,h=r.model,u=t.buildTag("div","","",{id:e+"_Ribbon"}),c=[r._getLocStr("HOME"),r._getLocStr("INSERT"),r._getLocStr("DATATAB"),r._getLocStr("PAGELAYOUT"),r._getLocStr("REVIEW"),r._getLocStr("OTHERS")],s,f;if(i?o.prepend(u):o.append(u),h.ribbonSettings.applicationTab.type==="menu"&&o.append(t.buildTag("ul","","",{id:e+"_Menu"})),click=t.SplitButton.prototype._documentClick,t.SplitButton.prototype._documentClick=function(t){n(t.target).is(".e-formatastable")||n(t.target).is(".e-formatastable-adaptive")||click.call(this,t)},s=[r._getLocStr("HOME"),r._getLocStr("INSERT"),r._getLocStr("PAGELAYOUT"),r._getLocStr("DATATAB"),r._getLocStr("OTHERS"),r._getLocStr("FORMAT"),r._getLocStr("DESIGN"),r._getLocStr("CHARTDESIGN"),r._getLocStr("ANALYZE")],r.model.ribbonSettings.enableOnDemand&&!r._isRibbonDestroyed)this._createTrgtElement(r._getLocStr("HOME"));else for(f=0;f<s.length;f++)this._createTrgtElement(s[f],u);if(this._menuCustomize(),this._homeTabObj(),this._insertTabObj(),this._dataTabObj(),this._pageTabObj(),this._reviewTabObj(),this._otherTabObj(),this._contextualTabObj(),u.attr("style","overflow:hidden"),u.height(0),u.width(0),u.ejRibbon({width:"100%",allowResizing:!0,applicationTab:this._appTabCollection,tabs:this._tabCollection,contextualTabs:this._contextualTabCollection,tabClick:n.proxy(this._onTabClick,this),tabSelect:n.proxy(this._onTabSelect,this),create:n.proxy(this._onControlCreated,this),collapse:n.proxy(this._onCollapse,this),backstageItemClick:n.proxy(this._onBackStageItemClick,this),groupExpand:n.proxy(this._onGroupExpander,this),pinState:n.proxy(this._onRibbonPin,this),expand:n.proxy(this._onRibbonExpand,this),groupClick:n.proxy(this._onRibbonGroupClick,this),_destroyed:n.proxy(this._rbnDestroy,this),enableOnDemand:r.model.ribbonSettings.enableOnDemand,beforeTabClick:n.proxy(this._onBeforeTabClick,this)}),u.css("height","auto"),u.width("100%"),h.scrollSettings.isResponsive&&(u.ejRibbon("option",{allowResizing:!0}),(r._phoneMode||r._tabMode)&&r._orientation==="landscape"&&u.ejRibbon("collapse")),r.model.ribbonSettings.enableOnDemand&&!r._isRibbonDestroyed)this._homeTabControls(),this._updateRibCustomCss(r._getLocStr("HOME")),this._isHomeTabCreate=!0,this._hideRibbonElem(r._getLocStr("HOME"));else for(this._isHomeTabCreate=!0,this._isInsertTabCreate=!0,this._isDataTabCreate=!0,this._isPageLayoutTabCreate=!0,this._isReviewTabCreate=!0,this._isOthersTabCreate=!0,this._isDesignTabCreate=!0,this._isFormatTabCreate=!0,this._isChartTabCreate=!0,this._analyzeTabCreate=!0,this._isAppTabCreate=!0,n("#"+e+"_Ribbon_review_Comments_5").css("vertical-align","middle"),f=0;f<6;f++)f!==1&&f!==4&&this._updateRibCustomCss(c[f]),this._hideRibbonElem(c[f]);this._hideOtherControls()},_createTabControls:function(t){var i=this.XLObj;switch(t){case i._getLocStr("HOME"):this._isHomeTabCreate||(this._homeTabControls(),this._isHomeTabCreate=!0,i._on(n("#"+i._id+"_cellstyles"),"click",i._cellStyleClick),i._on(n("#"+i._id+"_formatastable"),"click",i._formatAsTableClick),this._updateRibCustomCss(t),this._hideRibbonElem(t));break;case i._getLocStr("INSERT"):this._isInsertTabCreate||(this._isInsertTabCreate=!0,i._on(n(".e-"+i._id+".e-chartcell"),"click",i._chartClickHandler),this._hideRibbonElem(t));break;case i._getLocStr("DATATAB"):this._isDataTabCreate||(this._isDataTabCreate=!0,this._updateRibCustomCss(t),this._hideRibbonElem(t));break;case i._getLocStr("PAGELAYOUT"):this._isPageLayoutTabCreate||(this._pageTabControls(),this._isPageLayoutTabCreate=!0,this._updateRibCustomCss(t),this._hideRibbonElem(t));break;case i._getLocStr("REVIEW"):this._isReviewTabCreate||(n("#"+i._id+"_Ribbon_review_Comments_5").css("vertical-align","middle"),this._isReviewTabCreate=!0,this._hideRibbonElem(t));break;case i._getLocStr("OTHERS"):this._isOthersTabCreate||(this._othersTabControls(),this._isOthersTabCreate=!0,this._updateRibCustomCss(t),i._on(n("#"+i._id+"_nmuseinformula"),"click",".e-nmuseinformularow",i._useInFormulaClick),this._hideRibbonElem(t));break;case i._getLocStr("FORMAT"):this._isFormatTabCreate||(this._isFormatTabCreate=!0);break;case i._getLocStr("DESIGN"):this._isDesignTabCreate||(this._isDesignTabCreate=!0);break;case i._getLocStr("CHARTDESIGN"):this._isChartTabCreate||(this._isChartTabCreate=!0);break;case i._getLocStr("ANALYZE"):this._analyzeTabCreate||(this._isFormatTabCreate=!0)}},_createTrgtElement:function(t,i){var r=this.XLObj,i=i?i:n("#"+r._id+"_Ribbon");switch(t){case r._getLocStr("HOME"):this._isHomeTabTrgt||this._homeTabTrgtElem();this._isHomeTabTrgt=!0;break;case r._getLocStr("INSERT"):this._isInsertTabTrgt||this._onTabCreate();this._isInsertTabTrgt=!0;break;case r._getLocStr("DATATAB"):this._isDataTabTrgt||this._dataTabTrgtElem();this._isDataTabTrgt=!0;break;case r._getLocStr("PAGELAYOUT"):this._isPageLayoutTabTrgt||this._pageTabTrgtElem(i);this._isPageLayoutTabTrgt=!0;break;case r._getLocStr("OTHERS"):this._isOthersTabTrgt||this._othersTabTrgtElem();this._isOthersTabTrgt=!0;break;case r._getLocStr("CHARTDESIGN"):this._isChartTabTrgt||this._renderChartDesignTab();this._isChartTabTrgt=!0;break;case r._getLocStr("ANALYZE"):this._analyzeTabTrgt||this._renderAnalyzeTab();this._analyzeTabTrgt=!0;break;case r._getLocStr("FORMAT"):this._isFormatTabTrgt||this._renderFormatTab();this._isFormatTabTrgt=!0;break;case r._getLocStr("DESIGN"):this._isDesignTabTrgt||this._renderDesignTab();this._isDesignTabTrgt=!0}},_onTabCreate:function(){var i=this.XLObj,u=i._id,t=i.element,r=n("#"+i._id+"_Ribbon");t.append(this._chartType("ColumnChart",6,2,2,["column","stackingcolumn","stackingcolumn100","column","stackingcolumn","stackingcolumn100"],["ClusteredColumn","StackedColumn","Stacked100Column","Cluster3DColumn","Stacked3DColumn","Stacked100Column3D"]));t.append(this._chartType("BarChart",6,2,2,["bar","stackingbar","stackingbar100","bar","stackingbar","stackingbar100"],["ClusteredBar","StackedBar","Stacked100Bar","Cluster3DBar","Stacked3DBar","Stacked100Bar3D"]));t.append(this._chartType("StockChart",2,2,2,["radar","radar"],["Radar","RadarMarkers"]));t.append(this._chartType("LineChart",2,2,3,["line","line"],["Line","LineMarkers"]));t.append(this._chartType("AreaChart",3,3,3,["Area","stackingarea","stackingarea100"],["Area","StackedArea","Stacked100Area"]));t.append(this._chartType("PieChart",3,3,4,["pie","pie","doughnut"],["Pie","Pie3D","Doughnut"]));t.append(this._chartType("ScatterChart",1,2,2,["scatter"],["Scatter"]));r.append("<div id='"+i._id+"_nmuseinformula' class='e-nmuseinformula' style='width:125px'><\/div>")},_rbnDestroy:function(i){var r=this.XLObj,u=r._id,s="#"+u+"_Ribbon_Home_Font_FillColor",h="#"+u+"_Ribbon_Home_Font_FontColor",c="#"+u+"_Ribbon_PictureColor",e="#"+u+"_Ribbon_Home_Font_BorderColor",l="#"+u+"_Ribbon_BorderCP",a=n("#"+u+"_Ribbon").ejRibbon("instance"),v=a.getTabText(a.model.selectedItemIndex),y=r.model.ribbonSettings.enableOnDemand;if(n(s).data("ejColorPicker")&&n(s).ejColorPicker("destroy"),n(h).data("ejColorPicker")&&n(h).ejColorPicker("destroy"),n(c).data("ejColorPicker")&&n(c).ejColorPicker("destroy"),n(e).data("ejColorPicker")&&n(e).ejColorPicker("destroy"),n("#"+u+"_Ribbon_Home_Font_BorderColor_Presets").parent().remove(),n(l).data("ejColorPicker")&&n(l).ejColorPicker("destroy"),i&&!i.destroy){if(r._off(n("#"+u+"_cellstyles"),"click",r._cellStyleClick),r._off(n("#"+u+"_formatastable"),"click",r._formatAsTableClick),n(e)[0].style.display="none",r._off(n(".e-"+u+".e-chartcell"),"click",r._chartClickHandler),!y||this._isHomeTabTrgt&&v===r._getLocStr("HOME")){var u=r._id,f=r.element,p=u+"_Ribbon_",o=p+"Home_Font_";f.append(t.buildTag("input","",{display:"none"},{id:o+"FillColor",type:"text"}));f.append(t.buildTag("input","",{display:"none"},{id:o+"FontColor",type:"text"}));f.append(t.buildTag("input","",{display:"none"},{id:o+"BorderColor",type:"text"}));f.append(t.buildTag("div.e-spreadsheet e-formatastable","",{display:"none"},{id:r._id+"_formatastable"}));r.element.append(this._renderCellStyles())}else this._isHomeTabTrgt=!1;!y||this._isInsertTabTrgt&&v===r._getLocStr("INSERT")?this._onTabCreate():this._isInsertTabTrgt=!1;this._isHomeTabCreate=this._isInsertTabCreate=this._isDataTabCreate=this._isPageLayoutTabCreate=this._isReviewTabCreate=!1;this._isOthersTabCreate=this._isDesignTabCreate=this._isFormatTabCreate=this._isChartTabCreate=this._analyzeTabCreate=this._isAppTabCreate=!1;r._isRibbonDestroyed=!0}else n(document.body).append(n("#"+u+" _formatastable").parent()),n(document.body).append(n("#"+u+" _cellstyles").parent())},_updateRibCustomCss:function(n){var r=this.XLObj,i=r._id,y,p,w,b,u,s,a,t=0,k,h="Options",e,o,c,f,v;switch(n){case r._getLocStr("HOME"):var d="e-ssr-colpickHprt",g="_Ribbon_Home_Font",nt="_Ribbon_home_Font_Home_Font_",tt="_Ribbon_home_Clipboard_Home_Clipboard_Paste",st=["e-mergebtn","e-borderbtn","e-autosumbtn"],it=[i+nt+"FontFamily",i+nt+"FontSize"],rt=["e-ssr-fontfamily","e-ssr-fontsize"];for(c=[i+tt+h],o=[i+tt],e=[i+"_Ribbon_home_Clipboard_1"],f=[" e-ssr-pastebtnHprt"],r.addClass(document.getElementById(i+g+"_FillColorWrapper").children[0],d),r.addClass(document.getElementById(i+g+"_FontColorWrapper").children[0],d),b=r.element[0].querySelectorAll(".e-ssr-colpickHprt .e-color-container,.e-ssr-colpickHprt .e-select");t<4;)r.addClass(b[t],"e-ssr-colorcontainer"),t++;for(t=0;t<3;)r.addClass(document.querySelectorAll("."+st[t])[0].parentNode,"e-ssr-horizontalprt"),t++;for(t=0;t<2;)r.addClass(document.getElementById(it[t]),rt[t]),t++;break;case r._getLocStr("DATATAB"):v="_Ribbon_data_DataTools_Data_DataTools_DataValidation";c=[i+v+h];o=[i+v];e=[i+"_Ribbon_data_DataTools_1"];f=[" e-ssr-dtvaldtnHprt"];break;case r._getLocStr("PAGELAYOUT"):var ut="_Ribbon_pagelayout_PageLayout_PageLayout_PageLayout_PageSize",ft="_Ribbon_PageLayout_Show_",it=["ej"+i+ft+"Headings","ej"+i+ft+"Gridlines"],rt=["e-vheading","e-vgridlines"];for(c=[i+ut+h],o=[i+ut],e=[i+"_Ribbon_pagelayout_PageLayout_1"],f=[" e-ssr-pagesizebtnHprt"," e-ssr-sizebtnHprt"],t=0;t<2;)r.addClass(document.getElementById(it[t]),rt[t]),t++;break;case r._getLocStr("OTHERS"):var et="InsertCell",l="_Ribbon_others_Cells_Others_Cells_",ot="DeleteCell";c=[i+l+et+h,i+l+ot+h];o=[i+l+et,i+l+ot];e=[i+"_Ribbon_others_Cells_1",i+"_Ribbon_others_Cells_2"];f=[" e-ssr-insertbtnHprt"," e-ssr-deletebtnHprt"]}for(t=0,k=e.length;t<k;)a=document.getElementById(e[t]),w=document.getElementById(o[t]),y=document.getElementById(o[t]),p=document.getElementById(c[t]),u=document.createElement("span"),u.className="e-ssr-verticalHparent"+f[t],u.style.display="inherit",a.insertBefore(u,w),u.appendChild(y),u.appendChild(p),f[0]===" e-ssr-pagesizebtnHprt"&&(s=document.createElement("span"),s.className="e-ssr-verticalHparent"+f[t+1],s.style.display="inherit",s.appendChild(u),a.appendChild(s)),t++},_hideOtherControls:function(){for(var t=0,i=["CElement","Paste","Border","Merge","SortFilter","Clear","ColumnChart","BarChart","Validation","PageSize","FPane","Ins","Del","FindRep","PastePic","PictureBorder","AutoSum","ResetPic","PictureBorder","StockChart","LineChart","AreaChart","PieChart","ScatterChart","color_Presets","PictureColor_Presets","Home_Font_BorderColor_Presets"],r=i.length;t--;)n("#"+this._id+"_Ribbon_"+i[t]).hide();for(t=0,i=["CFormat","formatastable","cellstyles","ctxtmenu"],r=i.length;t--;)n("#"+this._id+"_"+i[t]).hide()},_renderAppTab:function(){var i,n=this.XLObj,r=[];i="<div id='"+n._id+"_backstagetabnew' style='display:none' class='e-ssr-bstabnew'><div class='e-ssr-bscontent' title='"+n._getLocStr("BlankWorkbook")+"'><div class='e-ssr-bsnewtmpl' ><button id='"+n._id+"_bstab_new_blank' type='button' class = 'e-rbn-button' ><\/button><\/div><\/div><\/div>";i=i.concat("<div id='"+n._id+"_backstagetabsaveas' style='display:none' class='e-ssr-bstabsaveas'><div class='e-ssr-bscontent'><div class='e-ssr-bssaveasopt'><button id='"+n._id+"_bstab_saveas_excel' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("SaveAsExcel")+"<\/span><\/div><div class='e-ssr-bssaveasopt'><button id='"+n._id+"_bstab_saveas_csv' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("SaveAsCsv")+"<\/span><\/div><div class='e-ssr-bssaveasopt'><button id='"+n._id+"_bstab_saveas_pdf' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("SaveAsPdf")+"<\/span><\/div><\/div><\/div>");i=i.concat("<div id='"+n._id+"_backstagetabprint' style='display:none' class='e-ssr-bstabprint'><div class='e-ssr-bscontent'><div class='e-ssr-bsprintopt'><button id='"+n._id+"_bstab_print_sheet' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("PrintSheet")+"<\/span><\/div><div class='e-ssr-bsprintopt'><button id='"+n._id+"_bstab_print_selected' type='button' class = 'e-rbn-button'><\/button><span>"+n._getLocStr("PrintSelected")+"<\/span><\/div><\/div><\/div>");n.element.append(i);r.push({id:"new",text:n._getLocStr("New"),itemType:t.Ribbon.itemType.tab,contentID:n._id+"_backstagetabnew"});r.push({id:"open",text:n._getLocStr("Open")+"...",itemType:t.Ribbon.itemType.tab});r.push({id:"saveas",text:n._getLocStr("SaveAs"),itemType:t.Ribbon.itemType.tab,contentID:n._id+"_backstagetabsaveas"});r.push({id:"print",text:n._getLocStr("Print"),itemType:t.Ribbon.itemType.tab,contentID:n._id+"_backstagetabprint"});this._appTabCollection={type:t.Ribbon.applicationTabType.backstage,backstageSettings:{text:n._getLocStr("File"),headerWidth:124,height:n._responsiveHeight-2,width:n._responsiveWidth-3,pages:r}}},_onBackStageItemClick:function(t){var i,e,r,f,u;if(this._isAppTabCreate||(this._appTabControls(),this._isAppTabCreate=!0),i=this.XLObj,f=i.model.ribbonSettings.applicationTab,i.XLEdit._isEdit&&i.XLEdit.saveCell(),i.XLComment&&i.XLComment._isCommentEdit&&i.XLComment._updateCurCmntVal(),i._isSheetRename&&!i._updateSheetNames(null,!1)){i.element.find("#"+i._id+"_Ribbon").ejRibbon("hideBackstage");return}if(f.type==="menu"){if(e={element:t.element},i._trigger("menuClick",e))return;t.ID==="Open"?(i.XLEdit._isEdit&&i.XLEdit.saveCell(),this._bSBtnClickHandler(t.ID.toLowerCase(),t)):this._bSBtnClickHandler(t.ID.toLowerCase(),t)}if(f.type==="backstage")if(t.type==="backstageItemClick"){if(r={id:t.id,text:t.text,type:t.type,target:t.target,prop:t.model},i._trigger("menuClick",r))return;t.id==="open_backStageTab"&&(i.XLEdit._isEdit&&i.XLEdit.saveCell(),this._bSBtnClickHandler("open",t))}else{if(r={e:t.e,type:t.type,status:t.status,target:t.target,id:t.target.id},i._trigger("menuClick",r))return;n("#"+i._id+"_Ribbon").ejRibbon("hideBackstage");i._phoneMode&&n("#"+i._id+"_Ribbon").ejRibbon("goToMainContent");u=t.model.prefixIcon;this._bSBtnClickHandler(u.indexOf("blank")>-1?u.split("-")[2]:u.split("-")[3],t)}},_bSBtnClickHandler:function(i,r){var u=this.XLObj,f=u.getActiveSheetIndex();if(arg={id:r.id||r.ID||r.target.id,status:r.status,prop:r.model,model:u.model},!u._trigger("ribbonClick",arg)){n("#"+u._id+"_Ribbon").ejRibbon("hideBackstage");switch(i){case"open":if(u.isDirty)u._showAlertDlg("confirm","ImportAlert","Open",470);else{if(u.model.importSettings.importMapper.length<1){u._showAlertDlg("Alert","ImportExportUrl");return}n("#"+u._id+"_file .e-uploadinput").click();u._browserDetails.name!="msie"&&u._browserDetails.name!="edge"&&n("#"+u._id+"_Ribbon_BackStage").show();n("#"+u._id+"_Ribbon").find(".e-backstagetitlecontent").text("").append("Open")}break;case"new":case"blank":u._isSheetsDirty()&&u._showAlertDlg("confirm","DestroyAlert","New",470);break;case"exportxl":u.XLExport["export"](t.Spreadsheet.exportType.Excel);break;case"exportcsv":u.XLExport["export"](t.Spreadsheet.exportType.Csv);break;case"exportpdf":u.XLExport["export"](t.Spreadsheet.exportType.Pdf);break;case"print":case"printsheet":u.XLPrint.printSheet(f);break;case"printselected":u.XLPrint.printSelection(f)}}},_contextualTabObj:function(){var r=this.XLObj,n=r._id,u="imagetop",i;i={backgroundColor:"#FCFBEB",borderColor:"#F2CC1C",tabs:[{id:"design",text:r._getLocStr("Design"),groups:[{text:"Properties",alignType:t.Ribbon.alignType.rows,type:"custom",contentID:n+"_Ribbon_Design_Properties_TableProperties"},{text:"Tools",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Design_Tools_ResizeTable","ResizeTable","textandimage","e-icon e-ssr-resizetable",101,this._smallBtnHeight,"ResizeTable","ResizeTableContent"),this._generateBtn("Design_Tools_ConvertToRange","ConvertToRange","textandimage","e-icon e-ssr-range",130,this._smallBtnHeight,"ConvertToRange","ConvertToRangeContent")]}]},{text:"Table Style Options",alignType:t.Ribbon.alignType.rows,type:"custom",contentID:n+"_Ribbon_Design_TableStyleOptions"}]}]};this._contextualTabCollection.push(i);i={backgroundColor:"#EAF6BD",borderColor:"#90AA3C",tabs:[{id:"chartdesign",text:r._getLocStr("CHARTDESIGN"),groups:[{text:"Chart Layouts",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("ChartDesign_ChartLayouts_AddChartElement","AddChartElement","textandimage",n+"_Ribbon_CElement","","e-icon e-ssr-celements",!0,65,this._bigBtnHeight,"bottom","imagetop","dropdown","e-spreadsheet e-chartlayoutbtn","AddChartElement","AddChartElementContent")]}]},{text:"Data",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("ChartDesign_Data_SwitchRowColumn","SwitchRowColumn","textandimage","e-icon e-ssr-srcolumn",72,this._bigBtnHeight,"SwitchRowColumn","SwitchRowColumnContent","","imagetop"),this._generateBtn("ChartDesign_Data_SelectData","SelectData","textandimage","e-icon e-ssr-selectdata",50,this._bigBtnHeight,"SelectData","SelectDataContent",!1,u)]}]},{text:"Type",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("ChartDesign_Type_ChangeChartType","ChartType","textandimage","e-icon e-ssr-charttype",65,this._bigBtnHeight,"ChartType","ChartTypeContent",!1,u)]}]},{text:"Chart Themes",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateDD("ChartDesign_ChartThemes_ChartThemes","ChartThemes",this._chartThemes,"1",130,this._smallBtnHeight,"ChartThemes","ChartThemesContent")]}]},{text:"Size",alignType:t.Ribbon.alignType.columns,content:[{groups:[{contentID:n+"_Ribbon_ChartDesign_Size_ChartSize",enableSeparator:!0,type:t.Ribbon.type.custom,height:80}]}]}]}]};this._contextualTabCollection.push(i);i={backgroundColor:"#FCFBEB",borderColor:"#F2CC1C",tabs:[{id:"format",text:r._getLocStr("FORMAT"),groups:[{text:"Adjust",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Format_Adjust_ChangePicture","ChangePicture","textandimage","e-icon e-ssr-changepicture",120,this._mediumBtnHeight,"ChangePicture","ChangePictureContent"),this._generateSplitBtn("Format_Adjust_ResetPicture","ResetPicture","textandimage",n+"_Ribbon_ResetPic",{dataSource:this._resetPicture,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"},"e-icon e-ssr-resetpicture",!1,120,this._mediumBtnHeight,"left","","dropdown","e-ss-resetpictbtn","ResetPicture","ResetPictureContent")]}]},{text:"Border",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateSplitBtn("Format_Border_PictureBorder","PictureBorder","textandimage",n+"_Ribbon_PictureBorder","","e-icon e-ssr-pictureborder",!1,120,this._mediumBtnHeight,"left","","dropdown","e-ss-pictbrdrbtn","PictureBorder","PictureBorderContent")]}]},{text:"Size",alignType:t.Ribbon.alignType.columns,type:"custom",contentID:n+"_Ribbon_Format_Size_PictureSize"}]}]};this._contextualTabCollection.push(i);i={backgroundColor:"#FCF0F7",borderColor:"#C9599C",tabs:[{id:"analyze",text:r._getLocStr("ANALYZE"),groups:[{text:"PivotTable",alignType:t.Ribbon.alignType.rows,type:"custom",contentID:n+"_pvttableproperties"},{text:"DataSource",alignType:t.Ribbon.alignType.rows,content:[{groups:[this._generateBtn("Analyze_DataSource_Refresh","Refresh","textandimage","e-icon e-ssr-datarefresh",50,this._bigBtnHeight,"RefreshTitle","RefreshContent",!1,u),this._generateBtn("Analyze_DataSource_ChangeDataSource","ChangeDataSource","textandimage","e-icon e-ssr-changedatasource",50,this._bigBtnHeight,"ChangeDataSource","ChangeDataSourceContent",!1,u)]}]},{text:"Actions",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateBtn("Analyze_Actions_ClearAll","ClearAll","textandimage","e-icon e-ssr-pivotclearall",70,this._smallBtnHeight,"ClearAll","ClearAllContent",!1,"","e-datapadding"),this._generateBtn("Analyze_Actions_MovePivotTable","MovePivotTable","textandimage","e-icon e-ssr-movepivottable",120,this._smallBtnHeight,"MovePivotTable","MovePivotTableContent",!1,"","e-datapadding")]}]},{text:"Show",alignType:t.Ribbon.alignType.columns,content:[{groups:[this._generateToggleBtn("Analyze_Show_FieldList","FieldList","textandimage","e-icon e-ssr-fieldlist","FieldListTitle",50,this._bigBtnHeight,["FieldListContent","FieldListRemoveContent"],!1,"",u,null,null,!0)]}]}]}]};this._contextualTabCollection.push(i)},_onRibbonPin:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r;this._ribbonState=!0;t.action="toggleBtn";i.model._isActPanelVisible=this._isPanelVisible;i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t);i.model._isActPanelVisible&&i._refreshActivationPanel();i.getSheet(i.getActiveSheetIndex())._isRibCollapsed=!1},_onRibbonExpand:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r;t.action="toggleBtn";t.type==="expand"&&t.clickType==="dblclick"||i._phoneMode?(this._ribbonState=!0,i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t),this.XLObj.model._isActPanelVisible&&i._refreshActivationPanel(),i.getSheet(i.getActiveSheetIndex())._isRibCollapsed=!1):this.XLObj.model._isActPanelVisible&&(i.getActivationPanel().hide(),this._isPanelVisible=i.model._isActPanelVisible,i.model._isActPanelVisible=!1,i._heightWidthCalculation(i.getActiveSheetIndex(),u,t))},_onRibbonGroupClick:function(t){var i=this.XLObj,u,r;i._phoneMode&&(n(t.target).parents(".e-resizegroupdiv").length>0||t.target.className.indexOf("e-resizegroupdiv")>-1||t.target.className.indexOf("e-ribdownarrow")>-1||t.target.className.indexOf("e-ribuparrow")>-1||t.target.className.indexOf("e-ribleftarrow")>-1)&&(u=n.extend(!0,{},i.model.scrollSettings),this._ribbonState=!0,t.action="toggleBtn",i.model._isActPanelVisible=this._isPanelVisible,i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t),i.model._isActPanelVisible&&i._refreshActivationPanel())},_hideTabs:function(){for(var r=n("#"+this.XLObj._id+"_Ribbon").ejRibbon("instance"),i=["",this.XLObj._getLocStr("Design"),this.XLObj._getLocStr("CHARTDESIGN"),this.XLObj._getLocStr("FORMAT"),this.XLObj._getLocStr("ANALYZE")],t=i.length;t=t-1;)r.hideTab(i[t])},_renderDesignTab:function(){var i=this.XLObj,r="",u=i._getLocStr("TableStyleOptions").split("/"),t=i._id+"_Ribbon_Design_TableStyleOptions";i.element.append("<input id="+i._id+'_tableid type="text" style = "display:none"/>');r="<div id="+i._id+'_Ribbon_Design_Properties_TableProperties><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell">Table Name:<\/div><\/div><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell"><input type="text" id='+i._id+'_Ribbon_Design_Properties_TableName class="ejinputtext" style="width:86px;opacity:0.7;height: 18px;text-indent: 3px;padding-left: 0px;box-sizing: content-box;" /><\/div><\/div><\/div>';r=r+"<div id="+t+'><div class="e-tablestyleoptionsrow" ><div class="e-tablestyleoptionscell"><input id='+t+'_FirstColumn type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_FirstColumn">'+u[0]+'<\/label><\/div><div class="e-tablestyleoptionscell" ><input id='+t+'_LastColumn type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_LastColumn">'+u[1]+'<\/label><\/div><\/div><div class="e-tablestyleoptionsrow" ><div class="e-tablestyleoptionscell"><input id='+t+'_TotalRow type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_TotalRow">'+u[2]+'<\/label><\/div><div class="e-tablestyleoptionscell" ><input id='+t+'_FilterColumn type="checkbox" /><label class="e-tablestyleoptionslabel" for="'+t+'_FilterColumn">'+u[3]+"<\/label><\/div><\/div><\/div>";i.element.append(r);n("#"+t+"_FirstColumn").ejCheckBox({change:this._ribbonClickHandler});n("#"+t+"_LastColumn").ejCheckBox({change:this._ribbonClickHandler});n("#"+t+"_TotalRow").ejCheckBox({change:this._ribbonClickHandler});n("#"+t+"_FilterColumn").ejCheckBox({change:this._ribbonClickHandler})},_renderFormatTab:function(){var u=this.XLObj,f=u._id,e=u.element,i=f+"_Ribbon",r=i+"_Format_Size_";e.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"_ResetPic"}));e.append(this._borderPicture());e.append("<div id="+r+"PictureSize class= e-ss-numeric style='display:none'><table><tr><td style='padding-right:4px;'>"+u._getLocStr("Height")+": <\/label><\/td><td style='padding-bottom:3px;'><input id='"+r+"PictureHeight' type='text' /><\/td><\/tr><tr><td><labe>"+u._getLocStr("Width")+": <\/label><\/td><td><input id='"+r+"PictureWidth' type='text' /><\/td><\/tr><\/table><\/div>");n("#"+r+"PictureHeight").ejNumericTextbox({name:"numeric",value:100,minValue:25,incrementStep:5,change:n.proxy(this._pictureSizeChange,this,"PictureWidth")});n("#"+r+"PictureWidth").ejNumericTextbox({name:"numeric",value:100,minValue:25,incrementStep:5,change:n.proxy(this._pictureSizeChange,this,"PictureHeight")});n("#"+i+"_PictureColor").ejColorPicker({modelType:"palette",presetType:"basic",cssClass:"e-ss-colorpicker e-ss-menuclrpkr",change:this._ribbonClickHandler});n("#"+i+"_PictureColorWrapper").hide();n("#"+i+"_PictureColor_popup").css({display:"block"});n("#"+f+"picturecolor ul li").find("a").remove();n("#"+f+"picturecolor ul li").append(n("#"+i+"_PictureColor_popup"))},_renderAnalyzeTab:function(){var n=this.XLObj;n.element.find("#"+n._id+"_Ribbon_analyze_PivotTable_content").width(132);n.element.find("#"+n._id+"_pvttableproperties").length||n.element.append("<div id="+n._id+'_pvttableproperties style="display:none" ><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell">PivotTable Name:<\/div><\/div><div class="e-tablepropertiesrow" ><div class="e-tablepropertiescell"><input type="text" id='+n._id+'_Ribbon_Analyze_PivotTable_PivotTableName class="ejinputtext" style="width:106px;opacity:0.7;height: 18px;text-indent: 3px;" /><\/div><\/div><\/div>')},_renderChartDesignTab:function(){var u=this.XLObj,r=u.element,i=u._id,t=i+"_Ribbon_ChartDesign_Size_";r.append("<input id="+i+'_chart type="text" style="display:none;"/>');r.append(this._chartElementTag());r.append("<div id="+t+"ChartSize class= e-ss-numeric style='width: 180;height: 80;'><table><tr><td><label class ='e-icon e-ssr-chartheight' style='width:25;height:25;display: visible' id = "+i+"_Ribbon_chartheightlbl /><\/td><td><input id='"+t+"ChartHeight' type='text' /><\/td><\/tr><tr><td><label class ='e-icon e-ssr-chartwidth' style='width: 180;height: 80;' id = "+i+"_Ribbon_chartwidthlbl /><\/td><td><input id='"+t+"ChartWidth' type='text' /><\/td><\/tr><\/table><\/div>");n("#"+t+"ChartWidth").ejNumericTextbox({name:"numeric",value:200,minValue:180,decimalPlaces:1,incrementStep:5,change:this._ribbonClickHandler});n("#"+t+"ChartHeight").ejNumericTextbox({name:"numeric",value:200,minValue:180,decimalPlaces:1,incrementStep:5,change:this._ribbonClickHandler})},_renderNameManagerDlg:function(){var i=this.XLObj,r="<div id = '"+i._id+"_nmdlg' style=display:'none'; ><div class='e-dlgctndiv' style='width: 100%;' ><div class='e-dlg-fields e-nmdlg-content' style='width: 100%;'><div class='e-ss-nm-dlg-grid'><div id='"+i._id+"_nmgrid' style=display:'none';><\/div><\/div><\/div><div class='e-dlg-fields'><label class='e-dlg-fields'>"+i._getLocStr("RefersTo")+":<\/label><input type='text' class='e-nmrange ejinputtext' id='"+i._id+"_nmrange' disabled='true' /><\/div><div class='e-dlg-btnfields' ><div class='e-dlg-btnctnr'><button id='"+i._id+"_nmclose' >"+i._getLocStr("Close")+"<\/button><\/div><\/div><\/div><\/div>";r=r+"<script id='"+i._id+"_nmeditortemplate' class='e-hide' type='text/template' ><div class='e-dlg-fields e-dlgctndiv'><table cellpadding='0' cellspacing='0'><tr><td>"+i._getLocStr("Name")+":<\/td><td><input id='"+i._id+"_nmgridname' type='text' class='ejinputtext' name='name' value='{{: name}}'/><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+i._getLocStr("Scope")+":<\/td><td><input class='e-nmscope ejinputtext' id='"+i._id+"_nmgridscope' type='text' disabled='disabled' name='scope' value='Workbook'/><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+i._getLocStr("Comment")+":<\/td><td><textarea id='"+i._id+"_nmgridcomment' class='e-ss-textarea' style=' resize: none; height: 44px; width: 100%;' name='comment' value='{{: comment}}'>{{: comment}}<\/textarea><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+i._getLocStr("RefersTo")+":<\/td><td><input type='text' class='ejinputtext' id='"+i._id+"_nmgridrefersto' name = 'refersto' value='{{: refersto}}' /><\/td><\/tr><\/table><\/div><\/script>";i.element.append(r);n("#"+i._id+"_nmclose").ejButton({showRoundedCorner:!0,width:68,click:n.proxy(this._nmdlgClose,i)});this._renderNMGrid();n("#"+i._id+"_nmdlg").ejDialog({enableResize:!1,showOnInit:!1,title:i._getLocStr("NameManager"),enableModal:!0,width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-nmdlg e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),beforeClose:t.proxy(this._beforeDlgClose,this),open:t.proxy(this._nmDlgOpen,this)})},_renderNMGrid:function(){var i=this.XLObj;n("#"+i._id+"_nmgrid").ejGrid({dataSource:i.model.nameManager.slice(0),pageSettings:{pageSize:6},allowScrolling:!0,allowSorting:!0,enableAltRow:!1,isResponsive:!0,cssClass:"e-ss-dialog ej-ssgrid e-"+i._id+"-dlg",selectionType:t.Grid.SelectionType.Single,editSettings:{allowAdding:!0,allowDeleting:!1,editMode:t.Grid.EditMode.DialogTemplate,dialogEditorTemplateID:"#"+i._id+"_nmeditortemplate"},toolbarSettings:{showToolbar:!0,toolbarItems:[t.Grid.ToolBarItems.Add]},actionBegin:n.proxy(this._nmActionBegin,i),actionComplete:n.proxy(this._nmActionComplete,i),rowSelected:n.proxy(this._nmRecordSelected,i),columns:[{field:"name",headerText:i._getLocStr("Name"),isPrimaryKey:!0,width:100},{field:"refersto",headerText:i._getLocStr("RefersTo"),width:120},{field:"scope",headerText:i._getLocStr("Scope"),width:80},{field:"comment",headerText:i._getLocStr("Comment"),width:100}]})},_updateNMRange:function(){var t=this.XLObj;n("#"+t._id+"_nmgridEditForm").find("#"+t._id+"_nmgridrefersto").val("="+t._getDollarAlphaRange(t.getSheet(t.getActiveSheetIndex()).selectedRange,!0))},_nmdlgClose:function(){n("#"+this._id+"_nmdlg").ejDialog("close")},_nmRecordSelected:function(t){n("#"+this._id+"_nmdlg").find(".e-nmrange").val(t.data.refersto)},_nmDlgOpen:function(){var t=this.XLObj,i,r;i=n("#"+t._id+"_nmgrid").ejGrid("instance");r=t._phoneMode?6:10;i.getPager()&&i.option({pageSettings:{pageSize:r}});this._isNmgrid==="DefineName"&&(n("#"+t._id+"_nmgrid").ejGrid("instance").addRecord(),n("#"+t._id+"_nmgridEditForm input")[0].focus());this._isNmgrid=""},_nmActionBegin:function(n){var t=0,u=!1,f,e,r,i=this.getSheet(this.getActiveSheetIndex());if(n.requestType==="save"&&n.data.refersto){if(r=n.data,r.sheetIndex=this._getSheetIndexByName(n.data.refersto.split("!")[0].replace(/[=\']/g,"")),n.cancel=!0,!r.sheetIndex){this._showAlertDlg("Alert","InvalidSheetIndex","NMRangeAlert",275);return}if(i._nmEdit)for(e in i._nmValue){for(f=this.model.nameManager.length;t<f;){if(this.model.nameManager[t].name===i._nmValue.name){this.model.nameManager.splice(t,1);this._calcEngine.removeNamedRange(i._nmValue.name);break}t++}for(t=this._formulaCollection.length;t--;)if(this._formulaCollection[t].display===i._nmValue.name){u=!0;this._formulaCollection.splice(t,1);break}if(u)break}this.XLRibbon._validateNamedRange(r.name,r.refersto)?n.cancel=!1:u&&this.model.nameManager.push(i._nmValue)}n.requestType==="beginedit"&&(i._nmEdit=!0,i._nmValue={name:n.model.dataSource[n.model.selectedRowIndex].name,refersto:n.model.dataSource[n.model.selectedRowIndex].refersto,comment:n.model.dataSource[n.model.selectedRowIndex].comment,sheetIndex:n.model.dataSource[n.model.selectedRowIndex].sheetIndex,scope:n.model.dataSource[n.model.selectedRowIndex].scope})},_nmActionComplete:function(t){var r=n("#"+this._id+"_nmgrid").data("ejGrid"),f=t.requestType,i,u;switch(f){case"add":i=n("#"+this._id+"_nmgrid_dialogEdit").data("ejDialog");i.model.open=n.proxy(this.XLRibbon._updateNMRange(),this);i.option("allowDraggable",!1);i.option("title",this._getLocStr("NewName"));u=n("#"+this._id+"_nmgridEditForm").find("input[type='button']:first");u.data("ejButton").option({text:"OK",cssClass:"e-ss-okbtn"});u.parent().addClass("e-dlg-btnfields").css("text-align","right");break;case"save":this.XLRibbon._addNamedRange(r,t.data.name,t.data.refersto,t.data.comment,t.data.sheetIndex);break;case"delete":this.XLRibbon._removeNamedRange(r,t.data.name);break;case"cancel":r.element.focus()}},_updateNamedRanges:function(n,t,i){var r=this.XLObj;t=r.XLEdit._parseSheetRef(t,!0);r._calcEngine.addNamedRange(n,t.replace("=",""));r._formulaCollection.push({text:"="+n,display:n});i||r.XLEdit._refreshAutoComplete()},_updateUseInFormulaTrgt:function(){for(var i=0,t=this.XLObj,r="",e=n("#"+t._id+"_nmuseinformula"),u=t.model.nameManager,f=u.length;i<f;)r=r+"<div class='e-nmuseinformularow' style = 'color:#333333'>"+u[i].name+"<\/div>",i++;f?n("#"+t._id+"_Ribbon_Others_Formulas_UseInFormula").ejSplitButton("enable"):n("#"+t._id+"_Ribbon_Others_Formulas_UseInFormula").ejSplitButton("disable");e.html("<div>"+r+"<\/div>")},addNamedRange:function(t,i,r,u){var f=this.XLObj,e;f._showDialog(f._id+"_Ribbon_Others_NameManager");e=n("#"+f._id+"_nmgrid").data("ejGrid");this._validateNamedRange(t,i)&&(e.addRecord({name:t,refersto:i,comment:r?r:"",scope:"WorkBook",sheetIndex:u}),e.refreshContent())},_addNamedRange:function(n,t,i,r,u){var f=this.XLObj;f.model.nameManager=n.model.dataSource.slice(0);this._updateNamedRanges(t,i);this._updateUseInFormulaTrgt();f._isSheetNavigate||f._trigActionComplete({sheetIndex:u,reqType:"named-range",name:t,refersTo:i,comment:r})},removeNamedRange:function(t){if(t){var i=n("#"+this.XLObj._id+"_nmgrid").data("ejGrid");i.option("editSettings",{allowDeleting:!0});i.deleteRecord("name",{name:t});i.option("editSettings",{allowDeleting:!1})}},_removeNamedRange:function(n,t){var r,u,i=this.XLObj,f=i.model.nameManager[i.model.nameManager.length-1];if(i.model.nameManager=n.model.dataSource.slice(0),u=i.model.nameManager,i._calcEngine.removeNamedRange(t),i._updateFormulaCollection(),r=u.length,r)while(r--)i._formulaCollection.push({text:"="+u[r].name,display:u[r].name});this._updateUseInFormulaTrgt()},_validateNamedRange:function(t,i){var e,o,s,a,u,r=this.XLObj,h="NMRangeAlert",c="NMNameAlert",l="NMUniqueNameAlert",f;if(e=this._validateDollarRange(i),t&&t.length>0&&(o=/^([a-zA-Z_0-9]){0,255}$/.test(t)&&this._validateLibraryFunctions(t)),s=this._validateNameManager(t),r._isUndoRedo||e&&o&&s)return!0;a=n("#"+r._id+"_alertdlg");e?o?(u=r._getLocStr(l),f=l):(u=r._getLocStr(c).split("/")[0],f=c):(u=r._getLocStr(h),f=h);r._showAlertDlg("Alert","T-"+u,f,370)},_validateLibraryFunctions:function(n){var i,r=[],u=this.XLObj.getCalcEngine().getLibraryFunctions();n=t.isNullOrUndefined(n)?"":n.toString().toUpperCase();for(i in u.items)r.push(i);for(i=r.length;i--;)if(r[i]===n)return!1;return!0},_validateNameManager:function(n){var i=0,r=this.XLObj.model.nameManager,u=r.length;for(n=t.isNullOrUndefined(n)?"":n.toString().toUpperCase();i<u;){if(r[i].name.toUpperCase()===n)return!1;i++}return!0},_validateDollarRange:function(n){try{if(n&&n.indexOf("!")>-1)return n=n.split("!")[1].replace(/\$/g,""),this.XLObj.getRangeIndices(n),!0}catch(t){return!1}},_renderFormatAsTable:function(){for(var f,a,it,e=this.XLObj,u=0,at=[11,19],rt=0,l="",ut="",i="w:bold",r="c:#FFFFFF",t="c:#000000",p="c:#2F75B5",w="c:#ED7D31",b="c:#FFC000",o="1px solid #000000",s="1px solid #2f75b5",h="1px solid #ED7D31",c="1px solid #FFC000",k="b:#D9D9D9",v="b:#DDEBF7",d="b:#FCE4D6",g="b:#FFF2CC",ft="b:#000000",et="b:#FFE2C6",ot="b:#FFF1BF",y="b:#000000",st="b:#D7D7D7",nt="b:#FFC000",tt="b:#5B9BD5",ht="b:#Ed7D31",ct="hl?"+i+";"+t+";bo:tb-"+o+"&cl?"+k+";"+t+","+t+"&cb?b-"+o+"/hl?"+i+";bo:tb-"+s+";"+p+"&cl?"+v+";"+p+","+p+"&cb?b-"+s+"/hl?"+i+";bo:tb-"+h+";"+w+"&cl?"+d+";"+w+","+w+"&cb?b-"+h+"/hl?"+i+";bo:tb-"+c+";"+b+"&cl?"+g+";"+b+","+b+"&cb?b-"+c+"/hl?"+i+";"+ft+";"+r+";bo:o-"+o+"&cl?bo:t-"+o+";"+t+"&cb?o-"+o+"/hl?bo:o-"+s+";"+i+";"+tt+";"+r+"&cl?bo:t-"+s+";"+t+"&cb?o-"+s+"/hl?"+i+";b:#EB7E2F;"+r+";bo:o-"+h+"&cl?bo:t-"+h+";"+t+"&cb?o-"+h+"/hl?"+i+";"+nt+";"+r+";bo:o-"+c+"&cl?bo:t-"+c+";"+t+"&cb?o-"+c+"/hl?"+i+";bo:gb-"+o+";"+t+"&cl?"+k+";"+t+","+t+"&cb?gb-"+o+"/hl?"+i+";bo:gb-"+s+";"+t+"&cl?"+v+";"+t+","+t+"&cb?gb-"+s+"/hl?"+i+";bo:gb-"+h+";"+t+"&cl?"+d+";"+t+","+t+"&cb?gb-"+h+"/hl?"+i+";bo:gb-"+c+";"+t+"&cl?"+g+";"+t+","+t+"&cb?gb-"+c+"/hl?"+i+";"+ft+";"+r+"&cl?b:#A6A6A6;"+t+","+k+";"+t+"/hl?"+i+";"+tt+";"+r+"&cl?b:#BDD7EE;"+t+","+v+";"+t+"/hl?"+i+";"+ht+";"+r+"&cl?b:#F8CBAD;"+t+","+d+";"+t+"/hl?"+i+";"+nt+";"+r+"&cl?b:#FFE699;"+t+","+g+";"+t+"/hl?"+i+";"+st+";"+t+";bo:gb-"+o+"&cl?b:#A7A7A7;"+t+","+st+";"+t+"&cb?gb-"+o+"/hl?"+i+";b:#DBECF6;"+t+";bo:gb-"+s+"&cl?b:#BED8F1;"+t+","+v+";"+t+"&cb?gb-"+s+"/hl?"+i+";"+et+";"+t+";bo:gb-"+h+"&cl?b:#F6CAAD;"+t+","+et+";"+t+"&cb?gb-"+h+"/hl?"+i+";"+ot+";"+t+";bo:gb-"+c+"&cl?b:#FDE18D;"+t+","+ot+";"+t+"&cb?gb-"+c+"/hl?"+i+";"+y+";"+r+"&cl?b:#404040;"+r+",b:#737373;"+r+"/hl?"+i+";"+y+";"+r+"&cl?b:#2F75B5;"+r+","+tt+";"+r+"/hl?"+i+";"+y+";"+r+"&cl?b:#C65911;"+r+","+ht+";"+r+"/hl?"+i+";"+y+";"+r+"&cl?b:#BF8F00;"+r+","+nt+";"+r,lt=e._getLocStr("FATHeaderText").split("/"),vt=e._getLocStr("FormatAsTableTitle").split("/"),yt=["Light1","Light2","Light3","Light5","Light8","Light9","Light10","Light12","Light15","Light16","Light17","Light19","Medium8","Medium9","Medium10","Medium12","Medium22","Medium23","Medium24","Medium26","Dark1","Dark2","Dark3","Dark5"],ct=ct.split("/");u<24;)l=l+e._renderDIV("e-formatastablecell",'<div class="e-ss-cellstyles-'+(u+1)+'" ><\/div>'),u===at[rt]&&(l+="<\/br>",rt++),u++;for(u=0,l=l.split("<\/br>");u<lt.length*2;)ut+=e._renderDIV(u%2==0?"e-formatastableheader":"e-formatastablecontent",u%2==0?lt[u/2]:l[0]),u%2!=0&&l.shift(),u++;for(f=document.getElementById(e._id+"_formatastable"),f.innerHTML=ut,f=n(f),a=f.find(".e-formatastablecell"),u=0,it=a.length;u<it;)n(a[u]).attr("id","Table Style "+yt[u]),n(a[u]).attr("title","Table Style "+vt[u]),u++;return e.XLFormat&&(e.XLFormat._formatAsTableStyle=e._FATStyles.TableStyleLight1),f.find(".e-formatastableheader:eq(0)").append("<span id ='"+e._id+"_formatastable_back' class = 'e-formatastable-back e-icon e-ss-leftarrow'/>"),f.data("ejMenu").model.open=function(){f.scrollTop(0)},f},_renderFATNameDlg:function(){var r,i=this.XLObj,u=i._getLocStr("FATNameDlgText").split("/"),f={showRoundedCorner:!0,width:"27%",click:n.proxy(this._fatNameDlgBtnClick,this)};r="<div id="+i._id+'_fatnamedlg><div class="e-dlg-fields e-dlgctndiv e-ss-nmdlg"><table cellspacing="0" cellpadding="0"><tr><td>'+u[0]+'<\/td><td><input id="'+i._id+'_fatname" class="ejinputtext" /><\/td><\/tr><tr class="e-dlgtd-fields"><td><\/td><td><input type="checkbox" id="'+i._id+'_fatheader" style="background-color:#ffffff"/> <label for="'+i._id+'_fatheader" class="e-ss-fathdr">'+u[1]+'<\/label><\/td><\/tr><\/table><\/div><div class="e-dlg-btnfields"><div class="e-dlg-btnctnr"><button id='+i._id+"_fatnamedlgok>"+i._getLocStr("Ok")+"<\/button><button id="+i._id+"_fatnamedlgcancel>"+i._getLocStr("Cancel")+"<\/button><\/div><\/div><\/div>";i.element.append(r);n("#"+i._id+"_fatheader").ejCheckBox();n("#"+i._id+"_fatnamedlgok").ejButton(f);n("#"+i._id+"_fatnamedlgok").ejButton("option","cssClass","e-ss-okbtn");n("#"+i._id+"_fatnamedlgcancel").ejButton(f);n("#"+i._id+"_fatnamedlg").ejDialog({showOnInit:!1,width:"auto",showRoundedCorner:!0,title:i._getLocStr("FormatAsTable"),enableModal:!0,enableResize:!1,cssClass:"e-ss-dialog e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this)})},_renderChartNameDlg:function(){var r,i=this.XLObj,f=i._getLocStr("ChartTitleDlgText"),u={showRoundedCorner:!0,width:"23%",click:n.proxy(this._chartNameDlgBtnClick,this)};r="<div id="+i._id+'_chartnamedlg ><div class="e-dlg-fields e-dlgctndiv"><table cellpadding="0" cellspacing="0"><tr><td>'+f+'<\/td><td><input id="'+i._id+'_chartname" class="ejinputtext" /><\/td><\/tr><\/table><\/div><div class="e-dlg-btnfields"><div class="e-dlg-btnctnr"><button id='+i._id+"_chartnamedlgok >"+i._getLocStr("Ok")+"<\/button><button id="+i._id+"_chartnamedlgcancel>"+i._getLocStr("Cancel")+"<\/button><\/div><\/div>";i.element.append(r);n("#"+i._id+"_chartnamedlgok").ejButton(u);n("#"+i._id+"_chartnamedlgok").ejButton("option","cssClass","e-ss-okbtn");n("#"+i._id+"_chartnamedlgcancel").ejButton(u);n("#"+i._id+"_chartnamedlg").ejDialog({showOnInit:!1,width:"334px",minHeight:"auto",showRoundedCorner:!0,title:i._getLocStr("ChartTitle"),enableModal:!0,enableResize:!1,cssClass:"e-ss-dialog e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this)})},_renderFATResizeTableDlg:function(){var i=this.XLObj,r={showRoundedCorner:!0,width:"15%",click:n.proxy(this._fatResizeTableBtnClick,this)},u="<div id="+i._id+'_fatresizetabledlg ><div class="e-dlgctndiv"><table><tr><td>'+i._getLocStr("FATResizeTableText")+'<\/td><td style="width: 50%;"><input id="'+i._id+'_fatresizetablerange" class="ejinputtext" style="margin-left: 2px;"><\/td><\/tr><\/table><div class="e-dlg-fields">'+i._getLocStr("FATReizeTableNote")+'<\/div><\/div><div class="e-dlg-btnfields"><div class="e-dlg-btnctnr"><button id='+i._id+"_fatresizetabledlgok >"+i._getLocStr("Ok")+"<\/button><button id="+i._id+"_fatresizetabledlgcancel >"+i._getLocStr("Cancel")+"<\/button><\/div><\/div><\/div>";i.element.append(u);n("#"+i._id+"_fatresizetabledlgok").ejButton(r);n("#"+i._id+"_fatresizetabledlgok").ejButton("option","cssClass","e-ss-okbtn");n("#"+i._id+"_fatresizetabledlgcancel").ejButton(r);n("#"+i._id+"_fatresizetabledlg").ejDialog({showOnInit:!1,width:"494px",showRoundedCorner:!0,title:i._getLocStr("ResizeTable"),enableModal:!0,enableResize:!1,cssClass:"e-ss-dialog e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this)})},_fatResizeTableBtnClick:function(t){var r=this.XLObj,h,f=document.getElementById(r._id+"_fatresizetablerange").value,o=r.getActiveSheetIndex(),e,i=document.getElementById(r._id+"_tableid").value,u=r.getSheet(o).tableManager,c,s;e={sheetIndex:o,reqType:"format-table",action:"Design_Tools_ResizeTable",tableId:i};canclose=!0;t.model.text===r._getLocStr("Ok")&&(r._isvalidRange(f)?(f=f.indexOf(":")!=-1?r.getRangeIndices(f):[],h=this._validateResizeRange(f,u[i].range),h?r._showAlertDlg("Alert",h,"",500):(e.beforeRange=n.extend(!0,[],u[i].range),u[i].totalRow?(c=n("#"+r._id+"_Ribbon_Design_TableStyleOptions_TotalRow").data("ejCheckBox"),r._dupDetails=!0,c.option("checked",!1),u[i].range=[f[0],f[1],f[2]-1,f[3]]):u[i].range=f,this._isFilterSelect.isFiltered&&r.XLFilter._clearFilterTable(o,parseInt(i),!0),r.XLFormat._createTable(i,{format:u[i].format}),r.XLFilter._extendFilterRange(i,u[i].range),u[i].range[2]==f[2]-1&&(r._dupDetails=!0,c.option("checked",!0)),u[i].firstColumn&&(r._dupDetails=!0,s=r._getProperAlphaRange(o,u[i].range[0]+1,u[i].range[1],u[i].range[2],u[i].range[1]),r.XLFormat.format({style:{"font-weight":"bold"}},s),r._dupDetails=!1),u[i].lastColumn&&(r._dupDetails=!0,s=r._getProperAlphaRange(o,u[i].range[0]+1,u[i].range[3],u[i].range[2],u[i].range[3]),r.XLFormat.format({style:{"font-weight":"bold"}},s),r._dupDetails=!1),e.afterRange=f,e.format=u[i].format,e.formatName=u[i].formatName,e.header=n.extend(!0,{},r.model.sheets[o]._header),e.isFilter=u[i].isFilter,e.firstColumn=u[i].firstColumn,e.lastColumn=u[i].lastColumn,e.totalRow=u[i].totalRow,r.XLSelection.selectRange(u[i].range),r._completeAction(e),r._trigActionComplete(e))):(canclose=!1,r._showAlertDlg("Alert","InvalidReference","",375)));canclose&&n("#"+r._id+"_fatresizetabledlg").ejDialog("close")},_fatNameDlgBtnClick:function(t){var r,i=this.XLObj,u=i._id;n("#"+u+"_fatnamedlg").ejDialog("close");t.model.text===i._getLocStr("Ok")&&(r={header:n("#"+u+"_fatheader").ejCheckBox("checked"),name:document.getElementById(u+"_fatname").value,format:i.XLFormat._formatAsTableStyle.format},i.XLFormat._formatAsTableStyle.formatName&&(r.formatName=i.XLFormat._formatAsTableStyle.formatName),i.XLFormat.createTable(r))},_validateResizeRange:function(n,t){var i=this.XLObj;if(n.length){if(n[0]!=t[0]||n[1]!=t[1])return"ResizeAlert";if(n[3]!=t[3]||n[2]<t[2])return"ResizeRestrictAlert";if(n[2]>i.getSheet(i.getActiveSheetIndex()).rowCount)return"RangeNotCreated"}else return"InvalidReference"},_chartNameDlgBtnClick:function(t,i){var e,u,r=this.XLObj,h=r.getActiveSheetIndex(),s=r.getSheet(h).shapeMngr.chart[r.XLEdit.getPropertyValue(r.XLShape._picCellIdx.rowIndex,r.XLShape._picCellIdx.colIndex,"chart")[0]],f,o=r._id,c=document.getElementById(o+"_chart").value;if(e=n("#"+c).data("ejChart"),u={sheetIndex:h,reqType:"shape",shapeType:"chart",cid:c,rowIndex:r.XLShape._picCellIdx.rowIndex,colIndex:r.XLShape._picCellIdx.colIndex,prev:{},cur:{}},f=i||document.getElementById(o+"_chartname").value,t.model.text===r._getLocStr("Ok")){if(!f.length){r._showAlertDlg("Alert","InvalidTitle","InvalidChartTitleActn",375);return}switch(r._hasTitle){case"PX":e.option("primaryXAxis",{title:{text:f}});s.xAxis.title.text=f;u.action="PX";break;case"PY":e.option("primaryYAxis",{title:{text:f}});s.yAxis.title.text=f;u.action="PY";break;case"CT":e.option("title",{text:f});s.title.text=f;u.action="CT"}}u.prev.text=r._cOpt.prevText;r._hasTitle=="CT"&&(u.prev.align=r._cOpt.prevAlign,u.cur.align=r._cOpt.curAlign);u.cur.text=f;r._completeAction(u);r._trigActionComplete(u);r._cOpt={};document.getElementById(o+"_chartname").value="";n("#"+o+"_chartnamedlg").ejDialog("close")},_designTabUpdate:function(t,i){var r=this.XLObj;if(r.model.showRibbon&&!r._phoneMode){var u=r._id,e,o=n("#"+r._id+"_Ribbon").ejRibbon("instance"),f=r.getSheet(r.getActiveSheetIndex()).tableManager;o.showTab(r._getLocStr("Design"));this._isDesignTab&&!o._isCollapsed&&o.option({selectedItemIndex:this._getTabIndex("design")});document.getElementById(r._id+"_Ribbon_Design_Properties_TableName")&&(document.getElementById(r._id+"_Ribbon_Design_Properties_TableName").value=f[t].name);document.getElementById(r._id+"_tableid")&&(document.getElementById(r._id+"_tableid").value=t);this._isSetModel=!0;n("#"+u+"_Ribbon_Design_TableStyleOptions_TotalRow").data("ejCheckBox").option({checked:f[t].totalRow?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_FirstColumn").data("ejCheckBox").option({checked:f[t].firstColumn?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_LastColumn").data("ejCheckBox").option({checked:f[t].lastColumn?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_FilterColumn").data("ejCheckBox").option({enabled:r.model.allowFiltering?!0:!1});n("#"+u+"_Ribbon_Design_TableStyleOptions_FilterColumn").data("ejCheckBox").option({checked:f[t].isFilter?!0:!1});this._isSetModel=!1;e=n("#"+r._id+"_Ribbon_Data_SortFilter_ClearFilter").data("ejButton");e&&this._changeClrFltrStatus(e,"button",i)}},_formatTabUpdate:function(){var t=this.XLObj;if(t.model.showRibbon&&!t._phoneMode){var i=n("#"+t._id+"_Ribbon").ejRibbon("instance"),r=t.element.find("#"+t._id+"_Ribbon_Format_Size_PictureHeight"),u=t.element.find("#"+t._id+"_Ribbon_Format_Size_PictureWidth");i.showTab(t._getLocStr("FORMAT"));t._shapeChange=!0;r.length&&r.ejNumericTextbox("option","value",t.element.find(".e-ss-activeimg").height());u&&u.ejNumericTextbox("option","value",t.element.find(".e-ss-activeimg").width());t.model.showRibbon&&!i._isCollapsed&&i.option({selectedItemIndex:t.XLRibbon._getTabIndex("format")});t._shapeChange=!1}},_analyzeTabUpdate:function(){var t=this.XLObj,r,i;if(!t.model.enablePivotTable)return!1;r=t.element.find("#"+t._id+"_Ribbon_Analyze_PivotTable_PivotTableName");i=n("#"+t._id+"_Ribbon").data("ejRibbon");r.length&&r.val(t.XLPivot.names[t._getContent(t.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id]);i.showTab(t._getLocStr("ANALYZE"));i._isCollapsed||i.option({selectedItemIndex:t.XLRibbon._getTabIndex("analyze")})},_chartDesignTabUpdate:function(t){var i=this.XLObj,u;if(i.model.showRibbon&&!i._phoneMode){var r=n("#"+i._id+"_Ribbon").data("ejRibbon"),o=t.get(0).id,s=t.get(0).offsetLeft,h=t.get(0).offsetTop,f=t.ejChart("model"),e=r.element.find("#"+i._id+"_Ribbon_ChartDesign_ChartThemes_ChartThemes");u=i._getIdxWithOffset(h,s,!0);i.XLShape._picCellIdx={rowIndex:u.rowIdx,colIndex:u.colIdx};r.showTab(i._getLocStr("CHARTDESIGN"));r._isCollapsed||r.option({selectedItemIndex:i.XLRibbon._getTabIndex("chartdesign")});document.getElementById(i._id+"_chart").value=o;this._isSetModel=!0;this._setShapeWidthHeight({height:f.size.height,width:f.size.width,shapeType:"chart"});e.length&&e.ejDropDownList("setSelectedValue",t.ejChart("option","theme"));this._isSetModel=!1;i.model.allowFormulaBar&&i.updateFormulaBar()}},_setShapeWidthHeight:function(t){var i=this.XLObj,r,u;t.shapeType=="chart"?(r=n("#"+i._id+"_Ribbon_ChartDesign_Size_ChartWidth").data("ejNumericTextbox"),u=n("#"+i._id+"_Ribbon_ChartDesign_Size_ChartHeight").data("ejNumericTextbox")):(r=n("#"+i._id+"_Ribbon_Format_Size_PictureWidth").data("ejNumericTextbox"),u=n("#"+i._id+"_Ribbon_Format_Size_PictureHeight").data("ejNumericTextbox"));i._shapeChange=!0;i.model.showRibbon&&(u.option({value:t.height}),r.option({value:t.width}));i._shapeChange=!1},changeDimension:function(t){var u=this.XLObj,h=u.getActiveSheetIndex(),o,c,e,s,f,i={sheetIndex:h,reqType:"shape",rowIndex:u.XLShape._picCellIdx.rowIndex,colIndex:u.XLShape._picCellIdx.colIndex,actionType:"shapechange"},r;t.shapeType=="picture"?(o=u.getSheetElement(h).find(".e-ss-activeimg"),f=o.length?o[0]:n("#"+t.id),i.prev={width:f.width(),height:f.height()},c=n("#"+t.id),e={width:t.width,height:t.height},c.css(e),i.action="picturesize",i.shapeType="picture",i.cur={width:f.width(),height:f.height()}):(r=n("#"+t.id).data("ejChart"),i.prev={width:r.model.size.width,height:r.model.size.height},e={width:t.width.toString(),height:t.height.toString()},s=r.element,r.option("size",e),s[0].style.height=t.height+"px",s[0].style.width=t.width+"px",i.action="width",i.shapeType="chart",i.cid=t.id,i.cur={width:r.model.size.width,height:r.model.size.height});u._completeAction(i);u._trigActionComplete(i);this._setShapeWidthHeight(t)},_toggleDesignTab:function(i){var r=this.XLObj,f,u,e=r.getActiveSheetIndex();r.model.showRibbon&&(u=n("#"+r._id+"_Ribbon").data("ejRibbon"),(t.isNullOrUndefined(r.XLEdit.getPropertyValue(i.rowIndex,i.colIndex,"tableName"))||r.getSheetElement(e).find(".e-ss-activeimg").length)&&(u.hideTab(r._getLocStr("Design")),u._isCollapsed||u.option({selectedItemIndex:1})));f=n("#"+r._id+"_Ribbon_Data_SortFilter_ClearFilter").data("ejButton");this._changeClrFltrStatus(f,"button",i)},_toggleChartDesignTab:function(){this._toggleContextualTab(this.XLObj._getLocStr("CHARTDESIGN"))},_toggleFormatTab:function(){this._toggleContextualTab(this.XLObj._getLocStr("FORMAT"))},_toggleAnalyzeTab:function(){this._toggleContextualTab(this.XLObj._getLocStr("ANALYZE"))},_toggleContextualTab:function(t){var r=this.XLObj,i;r.model.showRibbon&&(i=n("#"+r._id+"_Ribbon").data("ejRibbon"),i.hideTab(t),i._isCollapsed||i.option({selectedItemIndex:1}))},_getTabIndex:function(t){if(this.XLObj.model.showRibbon){for(var u=n("#"+this.XLObj._id+"_Ribbon").ejRibbon("model"),r=u.tabs,f=u.contextualTabs,i=0;i<f.length;)r=r.concat(f[i].tabs),i++;for(i=r.length;i--;)if(r[i].id===t)return++i}},_getFormatAsTableInput:function(n){var h=this.XLObj,t,r,e,i,o=0,u=0,c=[],s={hl:"headerLayout",cl:"contentLayout",hb:"headerBorder",cb:"contentBorder"},f={};for(n=n.split("&");o<n.length;){if(e=n[o].split("?"),t=e[0],r=e[1],t==="hl")f[s[t]]=h._getStyleAsJSON(r,!0);else if(t==="cl"){for(i=r.split(",");u<i.length;)c.push(i[u].length?h._getStyleAsJSON(i[u],!0):{}),u++;f[s[t]]=c}else t==="cb"&&(i=r.split("-"),f[s[t]]={border:this._getBorderObj(i[0],i[1])});o++}return f},_getBorderObj:function(n,t){var r,i={t:{top:""},r:{right:""},b:{bottom:""},l:{left:""},o:{top:"",right:"",bottom:"",left:""},tb:{top:"",bottom:""},gb:{top:"",right:"",bottom:"",left:""}};for(r in i[n])i[n][r]=t;return n==="gb"&&(i[n].isGridBorder=!0),i[n]},_renderCellStyles:function(){for(var s,r,t=0,e=4,o=[],h="e-cellstylecell ",i="",u=this.XLObj,f=u._dataContainer.hashCode,l=u._getLocStr("CellStyleHeaderText").split("/"),v=u._getLocStr("CellStyleGBN").split("/"),y=[f[0],f[1],f[2],f[3]],p=u._getLocStr("CellStyleTH").split("/"),a=f.slice(4,6),w=u._getLocStr("CellsStyleTCS").split("/"),b=f.slice(6,18),c;t<e;)r=v[t],i=i+u._renderDIV(h+y[t],r,r),t++;for(o.push(i),i="",t=0,e=2;t<e;)r=p[t],i=t===1?i+'<div class="'+h+a[t]+'" style="font-size: 11pt;" title="'+r+'">'+r+"<\/div>":i+u._renderDIV(h+a[t],r,r),t++;for(o.push(i),i="",t=0,e=12;t<e;)r=w[t],i=i+u._renderDIV(h+b[t],r,r),t++;for(o.push(i),i="",t=0;t<l.length*2;)s=t%2,i=i+u._renderDIV(s===0?"e-cellstyleheader":"e-cellstylecontent",s===0?l[t/2]:o[0]),s!=0&&o.shift(),t++;return c=n("<div id="+u._id+'_cellstyles class="e-spreadsheet e-cellstyles" style="display:none;">'+i+"<\/div>"),c.find(".e-cellstyleheader:eq(0)").append("<span id ='"+u._id+"_cellstyles_back' class = 'e-cellstyles-back e-icon e-ss-leftarrow'/>"),c},_homeTabTrgtElem:function(){var r=this.XLObj,u=r._id,n=r.element,i=u+"_Ribbon_",f=i+"Home_Font_";n.append(t.buildTag("input","",{display:"none"},{id:f+"FillColor",type:"text"}));n.append(t.buildTag("input","",{display:"none"},{id:f+"FontColor",type:"text"}));n.append(t.buildTag("input","",{display:"none"},{id:f+"BorderColor",type:"text"}));n.append(t.buildTag("div.e-spreadsheet e-formatastable","",{display:"none"},{id:r._id+"_formatastable"}));n.append(this._renderCellStyles());n.append(t.buildTag("ul","",{display:"none"},{id:u+"_Ribbon_Merge"}));n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"Paste"}));n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"Border"}));n.append(t.buildTag("ul.e-spreadsheet","",{display:"none"},{id:u+"_CFormat"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"Clear"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"SortFilter"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"AutoSum"}))},_pageTabTrgtElem:function(i){var f=this.XLObj,a=f._id,p=f.element,e,o,s,h,c,l,v,y,r=a+"_Ribbon_",u=r+"PageLayout_Show_";i=f.isUndefined(i)?n("#"+a+"_Ribbon").data("ejRibbon").element:i;p.append(t.buildTag("ul","",{display:"none"},{id:r+"PageSize"}));e=t.buildTag("div","",{width:"140",height:"80",display:"none"},{id:r+"pagesetup"});o=t.buildTag("div","",{width:"70",height:"80",float:"left"},{id:r+"pagesetupleft"});s=t.buildTag("table");tr=t.buildTag("tr");tr1=t.buildTag("tr");h=t.buildTag("td","",{padding:"6px 0px 6px 6px"});c=t.buildTag("td","",{padding:"6px 0px 6px 6px"});l=t.buildTag("td","",{padding:"6px 0px 6px 6px"});td12=t.buildTag("td","",{padding:"6px 0px 6px 6px"});v=t.buildTag("label.e-viewlinlbl","",{width:"40"},{id:r+"pagesetup_viewgrdlnlbl","for":u+"Gridlines"});y=t.buildTag("label.e-viewhdrlbl","",{width:"40",display:"visible"},{id:r+"pagesetup_viewhdrlbl","for":u+"Headings"});headerVchk=t.buildTag("input","","",{id:u+"Headings"});gridVchk=t.buildTag("input","","",{id:u+"Gridlines"});h.append(gridVchk);c.append(v);tr.append(h).append(c);l.append(headerVchk);td12.append(y);tr1.append(l).append(td12);s.append(tr1).append(tr);o.append(s);e.append(o);i.append(e)},_othersTabTrgtElem:function(){var r=this.XLObj,u=r._id,n=r.element,i=u+"_Ribbon_";n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"FPane"}));n.append(t.buildTag("ul","",{width:"auto"},{id:i+"Ins"}));n.append(t.buildTag("ul","",{width:"auto"},{id:i+"Del"}));n.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:i+"FindRep"}));n.append(t.buildTag("ul","",{display:"none"},{id:i+"CalcOpt"}))},_dataTabTrgtElem:function(){var n=this.XLObj;n.element.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:n._id+"_Ribbon_Validation"}))},_formatTabTrgtElem:function(){var n=this.XLObj;n.element.append(t.buildTag("ul","",{width:"auto",display:"none"},{id:n._id+"_Ribbon_ResetPic"}))},_onBeforeTabClick:function(n){this.XLObj.model.ribbonSettings.enableOnDemand&&this._createTrgtElement(n.activeHeader.innerText)},_onTabClick:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r=t.activeHeader.innerText;i._trigger("beforeTabClick",t);t.prevActiveIndex!==-1&&i.model.allowComments&&i.model.allowEditing&&(i.XLEdit._isEdit||i.XLComment._isCommentEdit||i._isSheetRename||!i.getSheet(i.getActiveSheetIndex()).isSheetProtected)&&!this._isDirtySelect&&this._enableRibbonIcons(t.activeIndex);i.model.ribbonSettings.enableOnDemand&&this._createTabControls(r);i._trigger("tabClick",t)},_onCollapse:function(t){var i=this.XLObj,u=n.extend(!0,{},i.model.scrollSettings),r;(this._ribbonState||t.isMobile)&&(i._phoneMode||(this._ribbonState=!1),t.action="toggleBtn",i._isAutoWHMode?(this._refreshBackstageHeight(),r=i._getElementDimension(),i.element.css({height:r.height,width:r.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),u,t),i.model._isActPanelVisible&&i._refreshActivationPanel(),i.getSheet(i.getActiveSheetIndex())._isRibCollapsed=!0)},_onTabSelect:function(t){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()),f,u;i.model.showRibbon&&(i.XLEdit._isEdit||i.model.allowComments&&i.XLComment._isCommentEdit||i._isSheetRename||r.isSheetProtected?this._disableRibbonIcons():this._enableRibbonIcons(),this._updateRibbonIcons(),i.model.isReadOnly&&i._readOnly(),i._phoneMode&&(f=n.extend(!0,{},i.model.scrollSettings),this._ribbonState=!0,t.action="toggleBtn",i.model._isActPanelVisible=this._isPanelVisible,i._isAutoWHMode?(this._refreshBackstageHeight(),u=i._getElementDimension(),i.element.css({height:u.height,width:u.width})):i._heightWidthCalculation(i.getActiveSheetIndex(),f,t)));i.XLEdit.getPropertyValue(r._activeCell.rowIndex,r._activeCell.colIndex,"tableName")&&(this._isDesignTab=t.activeIndex==this._getTabIndex("design")||t.activeIndex==this._getTabIndex("format")||t.activeIndex==this._getTabIndex("chartdesign"));i._trigger("tabSelect",t)},_valDTypeOnChange:function(t){var i=this.XLObj;n.validator&&n("#"+i._id+"_Form_ValDialog").validate().resetForm();t.value==="Between"||t.value==="NotBetween"?(n("#"+i._id+"_Ribbon_lbMax").show(),n("#"+i._id+"_Ribbon_btnMax").show(),n("#"+i._id+"_Ribbon_lbMin").text(i._getLocStr("NumberStart"))):(n("#"+i._id+"_Ribbon_lbMax").hide(),n("#"+i._id+"_Ribbon_btnMax").hide(),n("#"+i._id+"_Ribbon_lbMin").text(i._getLocStr("DataValue")));this._dialogValidate("_ValDialog")},_valTypeOnChange:function(t){var i=this.XLObj,r=n("#"+i._id+"_Ribbon_ddAction").data("ejDropDownList");r.enable();t.value==="List"?(n("#"+i._id+"_Ribbon_lbMax").hide(),n("#"+i._id+"_Ribbon_btnMax").hide(),r.disable()):(r._selectedValue==="Between"||r._selectedValue==="NotBetween")&&(n("#"+i._id+"_Ribbon_lbMax").show(),n("#"+i._id+"_Ribbon_btnMax").show());n("#"+i._id+"_Ribbon_lbMin").text(i._getLocStr(t.selectedText+"Start"));n("#"+i._id+"_Ribbon_lbMax").text(i._getLocStr(t.selectedText+"End"));this._dialogValidate("_ValDialog")},_valDlgBtnClick:function(t){var i=this.XLObj,f,e;if(t==="ok"&&n.validator&&n("#"+i._id+"_Form_ValDialog").valid()){var s=n("#"+i._id+"_Ribbon_blank").data("ejCheckBox"),h=n("#"+i._id+"_Ribbon_freetext").data("ejCheckBox").isChecked(),o=n("#"+i._id+"_Ribbon_ddType").data("ejDropDownList"),v=n("#"+i._id+"_Ribbon_ddAction").data("ejDropDownList");if(o._selectedValue==="List"){var r=n("#"+i._id+"_Ribbon_btnMin").val(),a=r,c,u,f=n("#"+i._id+"_alertdlg"),l;if(r.indexOf("=")>-1){if(r=r.split("=")[1],r.indexOf("!")>-1&&(c=r.split("!"),e=i._getSheetIndexByName(c[0]),r=c[1]),e===!1){i._renderAlertDlgContent(f,"Alert",i._getLocStr("ListAlert"),"ListValidation");i._alertDialog.element.ejDialog("open")&&f.focus();return}if(r.indexOf("$")>-1&&(r=r.split("$").join("")),r.indexOf(":")<0&&(r=r+":"+r),e=i.isUndefined(e)?i.getActiveSheetIndex():e,l=i.getSheet(e),u=i.getRangeIndices(r),isNaN(u[0])||isNaN(u[1])||isNaN(u[2])||isNaN(u[3])||l.colCount<=u[3]||l.rowCount<=u[2]){i._renderAlertDlgContent(f,"Alert",i._getLocStr("ListAlert"),"ListValidation");i._alertDialog.element.ejDialog("open")&&f.focus();return}if(u[2]===u[0]||u[3]===u[1])i.XLValidate.applyDVRules(null,["list",a],this._types[o.selectedIndexValue].value,s.isChecked(),h);else{i._renderAlertDlgContent(f,"Alert",i._getLocStr("ListValAlert"),"ListValidation");i._alertDialog.element.ejDialog("open")&&f.focus();return}}else i.XLValidate.applyDVRules(null,["list",a],this._types[o.selectedIndexValue].value,s.isChecked(),h)}else i.XLValidate.applyDVRules(null,[this._actions[v.selectedIndexValue].value,n("#"+i._id+"_Ribbon_btnMin").val(),n("#"+i._id+"_Ribbon_btnMax").val()],this._types[o.selectedIndexValue].value,s.isChecked(),h);i._setddlCell()}else n.validator||(t="cancel");(t==="cancel"||t==="ok"&&n.validator&&n("#"+i._id+"_Form_ValDialog").valid())&&(n("#"+i._id+"_Ribbon_ddType").data("ejDropDownList").option({selectedItemIndex:0}),n("#"+i._id+"_Ribbon_ddAction").data("ejDropDownList").option({selectedItemIndex:6}),n("#"+i._id+"_Ribbon_blank").data("ejCheckBox").option({checked:!0}),n("#"+i._id+"_Ribbon_freetext").data("ejCheckBox").option({checked:!0}),n("#"+i._id+"_Ribbon_btnMin").val(""),n("#"+i._id+"_Ribbon_btnMax").val(""),n("#"+i._id+"_ValDialog").ejDialog("close"),i.setSheetFocus())},_renderValDialog:function(){var i=this.XLObj,h,e,v,o,c,u,a,y,p;if(n("#"+i._id+"_Ribbon_MainDiv").length<1){h=t.buildTag("div.e-dlgctndiv","",{},{height:"100%"});e=t.buildTag("div.e-dlg-fields","",{},{id:i._id+"_Ribbon_MainDiv"});n("#"+i._id+"_Validation").append(h);n("#"+i._id+"_Validation").append(e);o=t.buildTag("label.e-dlg-fields",i._getLocStr("Allow"));e.append(o);c=t.buildTag("input.e-"+i._id+"-ddl","","",{id:i._id+"_Ribbon_ddType",type:"text"});e.append(c);c.ejDropDownList({dataSource:this._types,fields:{id:"Types",text:"text",value:"text"},selectedItemIndex:1,cssClass:"e-"+i._id+"-ddl",width:"100%",change:n.proxy(this._valTypeOnChange,this)});var s=t.buildTag("input#"+i._id+"_Ribbon_blank"),l=t.buildTag("label",i._getLocStr("IgnoreBlank"),{},{"for":i._id+"_Ribbon_blank"}),f=t.buildTag("table"),u=t.buildTag("tr"),r=t.buildTag("td","",{},{width:30});r.append(s);u.append(r);r=t.buildTag("td");r.append(l);u.append(r);f.append(u);s.ejCheckBox();s=t.buildTag("input#"+i._id+"_Ribbon_freetext");l=t.buildTag("label#"+i._id+"_Ribbon_lblfreetext",i._getLocStr("FreeText"),{},{"for":i._id+"_Ribbon_lblfreetext"});u=t.buildTag("tr#"+i._id+"_val_freetext");r=t.buildTag("td","",{},{width:30});r.append(s);u.append(r);r=t.buildTag("td");r.append(l);u.append(r);f.append(u);e.append(f);s.ejCheckBox({checked:!0});o=t.buildTag("label.e-dlg-fields").text(i._getLocStr("Data"));e.append(o);a=t.buildTag("input.e-"+i._id+"-ddl","","",{id:i._id+"_Ribbon_ddAction",type:"text"});e.append(a);a.ejDropDownList({dataSource:this._actions,fields:{id:"Types",text:"text",value:"value"},selectedItemIndex:6,cssClass:"e-"+i._id+"-ddl",width:"100%",change:n.proxy(this._valDTypeOnChange,this)});v=t.buildTag("div.e-dlgctndiv e-dlg-fields","",{},{id:i._id+"_Ribbon_SubDiv"});f=t.buildTag("table");u=t.buildTag("tr");r=t.buildTag("td");o=t.buildTag("label.e-dlg-fields","","",{id:i._id+"_Ribbon_lbMin"}).text(i._getLocStr("NumberStart"));f.append(u.append(r.append(o)));u=t.buildTag("tr");r=t.buildTag("td");y=t.buildTag("input.ejinputtext","",{width:"100%"},{id:i._id+"_Ribbon_btnMin",type:"text",name:i._id+"_valMin"});f.append(u.append(r.append(y)));u=t.buildTag("tr");r=t.buildTag("td");o=t.buildTag("label.e-dlg-fields","","",{id:i._id+"_Ribbon_lbMax"}).text(i._getLocStr("NumberEnd"));f.append(u.append(r.append(o)));u=t.buildTag("tr");r=t.buildTag("td");p=t.buildTag("input.ejinputtext","",{width:"100%"},{id:i._id+"_Ribbon_btnMax",type:"text",name:i._id+"_valMax"});f.append(u.append(r.append(p)));h.append(e,v.append(f));n("#"+i._id+"_Ribbon_SubDiv").wrapInner('<form id="'+i._id+'_Form_ValDialog" onsubmit="return false"><\/form>')}},_dialogValidate:function(t,i){var f=this.XLObj,e=f._id,l,tt=n("#"+e+"_Form"+t),o,r,a,v,s,y,p,u,w,b,h,k=!0,c,d,g,nt;if(n.validator){tt.validate({errorElement:"div",wrapper:"div",errorPlacement:function(n,t){n.insertAfter(t.closest("input"));n.children().addClass("e-dlg-field-validation-error");n.css({position:"relative"});n.offset({left:t.offset().left,top:t.offset().top+19})},onfocusout:function(n){this.element(n)}});c=n("#"+e+"_Ribbon_ddAction").ejDropDownList("getValue");switch(t){case"_ValDialog":l=n("#"+e+"_Ribbon_ddType").data("ejDropDownList");o=l.getSelectedValue();break;case"_CFDialog":o=i===e+"_CreateRule"?"formulaRule":i.charAt(0).toUpperCase()+i.slice(1).toLowerCase();break;case"_GoToDiv":o="cellAddr";break;case"_Ribbon_PvtRange":case"_Ribbon_PvtLocation":case"_Ribbon_cellAddress":o="cellAddr";break;case"_Ribbon_webAddress":o="webAddr"}for(n("#"+e+"_Form"+t).validate().resetForm(),u=[],p=n("#"+e+"_Form"+t).find("input").length,y={required:!0,date:!0,messages:{date:f._getLocStr("DateValidationMsg"),required:f._getLocStr("RequiredField")}},v={required:!0,celladdr:!0},w={required:!0,numberVal:!0},g={required:!0,number:!0,messages:{required:f._getLocStr("RequiredField"),number:f._getLocStr("NumberValidationMsg")}},b={required:!0,time:!0},s={required:!0},d={required:!0,betweentype:!0},nt={required:!0,formularule:!0},n.validator.addMethod("time",function(n){return n===""||n.match(/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?(\s(AM|am|PM|pm))?$/)},f._getLocStr("TimeValidationMsg")),n.validator.addMethod("date",function(n,t){var i=n.split("/");return this.optional(t)||!/Invalid|NaN/.test(new Date(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())?n:i[1]+"/"+i[0]+"/"+i[2]))},f._getLocStr("DateValidationMsg")),n.validator.addMethod("celladdr",function(t,i){var f,o=n(i).data("parentID"),r=n("#"+o).data("ejSpreadsheet"),u,e;return n("#"+r._id+"_Ribbon_sheentName").length&&(u=n("#"+r._id+"_Ribbon_sheentName").ejTreeView("option","selectedNode")),(r.isUndefined(u)||u<0)&&(u=r.getActiveSheetIndex()),t.indexOf("=")>-1&&(t=t.split("=")[1]),t.indexOf("!")>-1&&(h=t.split("!"),u=r._getSheetIndexByName(h[0]),t=h[1]),u<1&&(k=!1),e=r.getSheet(u),t.indexOf("$")>-1&&(t=t.split("$").join("")),f=r.getRangeIndices(t),f=e.colCount<=f[3]||e.rowCount<=f[2]?null:t,(t.match(/^(?:\bxfXF[a-zA-D]|xX[a-eA-E][a-zA-Z]|[a-wA-W][a-zA-Z]{2}|[a-zA-Z]{2}|[a-zA-Z])\$?(?:104857[0-6]|10485[0-6]\d|1048[0-4]\d{2}|104[0-7]\d{3}|10[0-3]\d{4}|[1-9]\d{1,5}|[1-9]):(?:\bxfXF[a-zA-D]|xX[a-eA-E][a-zA-Z]|[a-wA-W][a-zA-Z]{2}|[a-zA-Z]{2}|[a-zA-Z])\$?(?:104857[0-6]|10485[0-6]\d|1048[0-4]\d{2}|104[0-7]\d{3}|10[0-3]\d{4}|[1-9]\d{1,5}|[1-9])$/)||t.match(/^(?:\bxfXF[a-zA-D]|xX[a-eA-E][a-zA-Z]|[a-wA-W][a-zA-Z]{2}|[a-zA-Z]{2}|[a-zA-Z])\$?(?:104857[0-6]|10485[0-6]\d|1048[0-4]\d{2}|104[0-7]\d{3}|10[0-3]\d{4}|[1-9]\d{1,5}|[1-9])$/)&&k)&&f},f._getLocStr("CellAddrsValidationMsg")),n.validator.addMethod("betweentype",function(t,i){var e=i.id.split("_")[0],f=n("#"+i.id.split("_")[0]+"_Ribbon_ddType").ejDropDownList("getSelectedValue"),r=n("#"+e+"_Ribbon_btnMin").val(),u=n("#"+i.id.split("_")[0]+"_Ribbon_btnMax").val();return(r===""||u===""||parseFloat(r)>parseFloat(u))&&(t=null),f==="Date"&&Date.parse(r)>Date.parse(u)&&(t=null),f==="Time"&&new Date("01/01/1990 "+r).getTime()>new Date("01/01/1990 "+u).getTime()&&(t=null),t},f._getLocStr("BetweenAlert")),n.validator.addMethod("numberVal",function(t){if(n.isNumeric(t))return parseFloat(t)%1!=0&&(t=null),n.validator.messages.numberVal=f._getLocStr("NumberValMsg"),t;n.validator.messages.numberVal=f._getLocStr("NumberAlertMsg")},n.validator.messages.numberVal),n.validator.addMethod("formularule",function(n){return n===""||n.startsWith("=")&&n.indexOf("!")<0},f._getLocStr("FormulaRuleMsg")),r=0,a=p;r<a;r++){u[r]=n("#"+e+"_Form"+t).find("input")[r].id;switch(o){case"Date":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",y);break;case"Time":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",b);break;case"Number":case"TextLength":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",w);break;case"Decimal":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",g);break;case"List":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",s);break;case"cellAddr":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",v);break;case"webAddr":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",s);break;case"formulaRule":n("#"+u[r]).rules("remove");n("#"+u[r]).rules("add",nt)}o!=="List"&&(c==="Between"||c==="NotBetween")&&n("#"+e+"_Ribbon_btnMax").rules("add",d)}}},_renderCFDialog:function(i){var u,o,f,e,s,r=this.XLObj,h;s=n("#"+r._id+"_CFDialog").data("ejDialog");i.ID===r._id+"_CreateRule"?s.option({title:r._getLocStr("NewRule")}):s.option({title:r._getLocStr(this._cFormatData[i.ID][0])});n("#"+r._id+"_Ribbon_CFSubDiv").length<1&&(o=t.buildTag("div.e-dlg-fields","",{},{id:r._id+"_Ribbon_CFSubDiv"}),f=t.buildTag("label.e-dlg-fields").text(r._getLocStr("With")),o.append(f),h=t.buildTag("input.e-"+r._id+"-ddl","",{},{id:r._id+"_Ribbon_ddStyle",type:"text"}),o.append(h),h.ejDropDownList({dataSource:this._styles,fields:{id:"Types",text:"text",value:"value"},selectedItemIndex:0,cssClass:"e-"+r._id+"-ddl",width:"100%",change:n.proxy(this._ddOnChange,this)}),n("#"+r._id+"_CondFormat").append(o),n("#"+r._id+"_CondFormat").addClass("e-cfdiv"));n("#"+r._id+"_Ribbon_CFMainDiv").length>0&&n("#"+r._id+"_Ribbon_CFMainDiv").remove();u=t.buildTag("div.e-dlg-fields","","",{id:r._id+"_Ribbon_CFMainDiv"});n("#"+r._id+"_CondFormat").prepend(u);i.ID=="between"&&(e=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_input2",type:"text"}),u.prepend(e),f=t.buildTag("label.e-dlg-fields").text(r._getLocStr("And")).css("display","table"),u.prepend(f));e=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_input1",type:"text"});u.prepend(e);f=i.ID===r._id+"_CreateRule"?t.buildTag("label.e-dlg-fields").text(r._getLocStr("NewRuleLabelContent")):t.buildTag("label.e-dlg-fields").text(r._getLocStr(this._cFormatData[i.ID][1]));u.prepend(f);(i.ID==="aboveavg"||i.ID==="belowavg")&&e.hide();n("#"+r._id+"_Ribbon_CFMainDiv").wrapInner('<form id="'+r._id+'_Form_CFDialog" onsubmit="return false"><\/form>');this._dialogValidate("_CFDialog",i.ID)},_dlgCFOk:function(){var t=this.XLObj,i,r;n("#"+t._id+"_Form_CFDialog").valid()&&(i=n("#"+t._id+"_Ribbon_ddStyle").data("ejDropDownList"),r=t.XLRibbon._currentCFormat===t._id+"_CreateRule"?"formularule":t.XLRibbon._currentCFormat,t.XLCFormat._cFormat(r,n("#"+t._id+"_Ribbon_input1").val(),n("#"+t._id+"_Ribbon_input2").val(),i.getSelectedValue()),n("#"+t._id+"_CFDialog").ejDialog("close"),t.setSheetFocus())},_dlgCFCancel:function(){var t=this.XLObj;n("#"+t._id+"_Form_CFDialog").validate().resetForm();n("#"+t._id+"_CFDialog").ejDialog("close");t.setSheetFocus()},_sheetData:function(){var r=this.XLObj,u=[],t=[],n,f,i=r._getSheetNames();for(t[0]={id:1,name:r._getLocStr("SheetReference"),hasChild:!0,expanded:!0},n=1,f=i.length;n<=f;n++)i[n-1].isVisible&&(u[n]=i[n-1].text,t[n]={id:n+1,pid:1,name:u[n],hasChild:!0,expanded:!0});return t},_renderHLDialog:function(){var i=this.XLObj,c,u,f,s,h,o,e,r,l;n("#"+i._id+"_Ribbon_WebDiv").length<1&&(c=t.buildTag("div.e-dlgctndiv","",{},{id:i._id+"_Ribbon_WebDiv"}),e=t.buildTag("table","",{},{cellpadding:0,cellspacing:0}),r=t.buildTag("tr"),$td=t.buildTag("td","",{width:"32%"}),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("HyperlinkText")),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_findText",type:"text"}),r.append($td.append(f)),r=t.buildTag("tr.e-dlgtd-fields"),$td=t.buildTag("td"),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("WebAddress"),"",{id:i._id+"_Ribbon_address"}),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_webAddress",type:"text"}),r.append($td.append(f)),n("#"+i._id+"_Web").append(c.append(e)),s=t.buildTag("div.e-dlgctndiv","","",{id:i._id+"_Ribbon_DocDiv"}),l=t.buildTag("div.e-dlg-fields"),e=t.buildTag("table"),r=t.buildTag("tr"),$td=t.buildTag("td","",{width:"32%"}),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("HyperlinkText")),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_cellText",type:"text"}),r.append($td.append(f)),r=t.buildTag("tr.e-dlgtd-fields"),$td=t.buildTag("td"),e.append(r.append($td)),u=t.buildTag("label",i._getLocStr("CellAddress")),$td.append(u),$td=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:i._id+"_Ribbon_cellAddress",type:"text"}),f.data("parentID",i._id),r.append($td.append(f)),o=t.buildTag("div.e-dlg-fields","","",{id:i._id+"_Ribbon_Sheet"}),s.append(l.append(e),o),u=t.buildTag("label",i._getLocStr("SheetIndex")),o.append(u),h=t.buildTag("div","","",{id:i._id+"_Ribbon_sheentName"}),o.append(h),h.ejTreeView({fields:{id:"id",parentId:"pid",text:"name",hasChild:"hasChild",dataSource:this._sheetData(),expanded:"expanded"},nodeSelect:n.proxy(this._sheetSelect,i),height:90}),n("#"+i._id+"_Doc").append(s),n("#"+i._id+"_Ribbon_cellAddress").wrap("<form id='"+i._id+"_Form_Ribbon_cellAddress' onsubmit='return false'><\/form>"),this._dialogValidate("_Ribbon_cellAddress"),n("#"+i._id+"_Ribbon_webAddress").wrap("<form id='"+i._id+"_Form_Ribbon_webAddress' onsubmit='return false'><\/form>"),this._dialogValidate("_Ribbon_webAddress"))},_sheetSelect:function(t){var i,u,f=this._getSheetNames(),r=n("#"+this._id+"_Ribbon_cellAddress"),e=n("#"+this._id+"hlDialog_OkBtn").data("ejButton"),o=n("#"+this._id+"_Ribbon_cellText");if(t.model.selectedNode>0)for(r.attr("disabled",!1),e.enable(),r.focus().setInputPos(1),i=0,u=f.length;i<u;i++)f[i].text===o.val().split("!")[0]&&o.val(t.value+"!"+r.val());else r.attr("disabled",!0),e.disable()},_dlgHLOk:function(){var t=this.XLObj;n("#"+t._id+"_Form_Ribbon_cellAddress").valid()&&n("#"+t._id+"_Form_Ribbon_webAddress").valid()&&(this.XLObj._dlgHLClick=!0,t._setLink(),this._dlgHLCancel())},_dlgHLCancel:function(){n("#"+this.XLObj._id+"_HLDialog").ejDialog("close")},_renderFRDialog:function(){var h,f,c,l,s,e,a,r=this.XLObj,o,u,i;n("#"+r._id+"_Ribbon_FindDiv").length<1&&(h=t.buildTag("div.e-dlgctndiv e-ss-finddiv","",{height:"auto"},{id:r._id+"_Ribbon_FindDiv"}),n("#"+r._id+"_Find").append(h),o=t.buildTag("table"),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td","",{width:"30%"}),o.append(u.append(i)),f=t.buildTag("label",r._getLocStr("FindLabel"),"",{id:r._id+"_Ribbon_lbFind"}),i.append(f),i=t.buildTag("td"),c=t.buildTag("input.ejinputtext","","",{id:r._id+"_Ribbon_textFind",type:"text"}),i.append(c),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),f=t.buildTag("label",r._getLocStr("ReplaceLabel"),"",{id:r._id+"_Ribbon_lbReplace"}),i.append(f),i=t.buildTag("td"),l=t.buildTag("input.ejinputtext","","",{id:r._id+"_Ribbon_textReplace",type:"text"}),i.append(l),u.append(i),h.append(o),n("#"+r._id+"_Ribbon_lbReplace").hide(),n("#"+r._id+"_Ribbon_textReplace").hide(),a=t.buildTag("div.e-dlgctndiv e-ss-stgdiv","",{},{id:r._id+"_Ribbon_SettingsDiv"}),o=t.buildTag("table"),u=t.buildTag("tr"),i=t.buildTag("td","",{width:"50%"}),o.append(u.append(i)),s=t.buildTag("input#"+r._id+"_Ribbon_Case"),f=t.buildTag("label",r._getLocStr("MatchCase"),{},{"for":r._id+"_Ribbon_Case"}),i.append(s),i.append(f),s.ejCheckBox(),i=t.buildTag("td"),s=t.buildTag("input#"+r._id+"_Ribbon_AllContent"),f=t.buildTag("label",r._getLocStr("MatchAll"),{},{"for":r._id+"_Ribbon_AllContent"}),i.append(s),s.ejCheckBox(),i.append(f),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),f=t.buildTag("label").text(r._getLocStr("Within")),i.append(f),i=t.buildTag("td"),f=t.buildTag("label").text(r._getLocStr("Search")),i.append(f),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddWithin",type:"text"}),i.append(e),e.ejDropDownList(r._generateEJDD(this._within,{id:"Types",text:"text",value:"value"},0,110,25)),i=t.buildTag("td"),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddSearch",type:"text"}),i.append(e),e.ejDropDownList(r._generateEJDD(this._sType,{id:"Types",text:"text",value:"value"},0,120,25)),u.append(i),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),f=t.buildTag("label",r._getLocStr("Lookin")),i.append(f),i=t.buildTag("td"),f=t.buildTag("label",r._getLocStr("Replace")+" "+r._getLocStr("Direction")),u.append(i.append(f)),u=t.buildTag("tr.e-dlgtd-fields"),i=t.buildTag("td"),o.append(u.append(i)),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddLookin",type:"text"}),i.append(e),e.ejDropDownList(r._generateEJDD(this._vType,{id:"Types",text:"text",value:"value"},0,110,25,"Type")),i=t.buildTag("td"),e=t.buildTag("input","","",{id:r._id+"_Ribbon_ddDirection",type:"text"}),u.append(i.append(e)),e.ejDropDownList(r._generateEJDD(this._direction,{id:"Types",text:"text",value:"value"},0,120,25)),n("#"+r._id+"_Settings").append(a.append(o)))},_frTypeChange:function(t,i){t==="Type"&&i.value==="comment"?(n("#"+this._id+"_Ribbon_textReplace").attr("disabled",!0),n("#"+this._id+"FR_ReplaceBtn").ejButton("disable"),n("#"+this._id+"FR_ReplaceAllBtn").ejButton("disable")):(n("#"+this._id+"_Ribbon_textReplace").prop("disabled",!1),n("#"+this._id+"FR_ReplaceBtn").ejButton("enable"),n("#"+this._id+"FR_ReplaceAllBtn").ejButton("enable"))},_hlTabChange:function(t){var i=this.XLObj,s=n("#"+i._id+"_Ribbon_sheentName").data("ejTreeView"),r=i.getActiveSheetIndex(),h=n("#"+i._id+"_Doc"),c=n("#"+i._id+"_Web"),l=n("#"+i._id+"_Ribbon_webAddress"),f=n("#"+i._id+"_Ribbon_findText"),u=n("#"+i._id+"_Ribbon_cellAddress"),e=n("#"+i._id+"_Ribbon_cellText"),a=i.getActiveCell(r),o=i.XLEdit.getPropertyValue(a.rowIndex,a.colIndex,"hyperlink",r);switch(t.activeIndex){case 0:l.focus().setInputPos(l.val().length);f.val(e.val());h.hide();c.show();n("#"+i._id+"hlDialog_OkBtn").ejButton("enable");break;case 1:u.val().length||u.val("A1");h.show();c.hide();o&&o.cellAddr&&(r=parseInt(o.cellAddr.split("_")[1]));s.selectNode(r+1);f.val().length?e.val(f.val()):e.val(s.getText(r+1)+"!A1");u.focus().setInputPos(u.val().length)}},_findTabChange:function(t){var r,i=this.XLObj;switch(t.activeIndex){case 0:r=n("#"+i._id+"_Ribbon_FindDiv");n("#"+i._id+"_Ribbon_lbReplace").hide();n("#"+i._id+"_Ribbon_textReplace").hide();n("#"+i._id+"FR_ReplaceBtn").css("visibility","hidden");n("#"+i._id+"FR_ReplaceAllBtn").css("visibility","hidden");n("#"+i._id+"_Find").append(r);n("#"+i._id+"FR_PrevBtn").show();n("#"+i._id+"FR_NextBtn").show();n("#"+i._id+"_Ribbon_textFind").focus().setInputPos(n("#"+i._id+"_Ribbon_textFind").val().length);i._phoneMode?(n("#"+i._id+"FR_ReplaceBtn").hide(),n("#"+i._id+"FR_ReplaceAllBtn").hide()):(n("#"+i._id+"FR_ReplaceBtn").show(),n("#"+i._id+"FR_ReplaceAllBtn").show());break;case 1:r=n("#"+i._id+"_Ribbon_FindDiv");n("#"+i._id+"_Ribbon_lbReplace").show();n("#"+i._id+"_Ribbon_textReplace").show();n("#"+i._id+"FR_ReplaceBtn").css("visibility","visible").show();n("#"+i._id+"FR_ReplaceAllBtn").css("visibility","visible").show();i._phoneMode?(n("#"+i._id+"FR_PrevBtn").hide(),n("#"+i._id+"FR_NextBtn").hide()):(n("#"+i._id+"FR_PrevBtn").show(),n("#"+i._id+"FR_NextBtn").show());n("#"+i._id+"_Replace").append(r);n("#"+i._id+"_Ribbon_textFind").focus().setInputPos(n("#"+i._id+"_Ribbon_textFind").val().length);break;case 2:n("#"+i._id+"FR_PrevBtn").hide();n("#"+i._id+"FR_NextBtn").hide();n("#"+i._id+"FR_ReplaceBtn").css("visibility","hidden");n("#"+i._id+"FR_ReplaceAllBtn").css("visibility","hidden");n("#"+i._id+"_Ribbon_ddWithin").focus();i._phoneMode?n("#"+i._id+"_Ribbon_SettingsDiv").find("td:eq(1)").hide():n("#"+i._id+"_Ribbon_SettingsDiv").find("td:eq(1)").show()}},_gotoTabChange:function(t){var i=this.XLObj;t.activeIndex==0&&n("#"+i._id+"_textRef").focus().setInputPos(n("#"+i._id+"_textRef").val().length)},_btnFROnClick:function(t){var i=this.XLObj;i.showWaitingPopUp();var r=i.getActiveSheetIndex(),c=i.getSheet(r)._startCell.rowIndex,l=i.getSheet(r)._startCell.colIndex,u=n("#"+i._id+"_Ribbon_Case").data("ejCheckBox").isChecked(),f=n("#"+i._id+"_Ribbon_AllContent").data("ejCheckBox").isChecked(),e=this._within[n("#"+i._id+"_Ribbon_ddWithin").data("ejDropDownList").selectedIndexValue].value,s=this._sType[n("#"+i._id+"_Ribbon_ddSearch").data("ejDropDownList").selectedIndexValue].value,o=this._vType[n("#"+i._id+"_Ribbon_ddLookin").data("ejDropDownList").selectedIndexValue].value,a=this._direction[n("#"+i._id+"_Ribbon_ddDirection").data("ejDropDownList").selectedIndexValue].value,h;switch(t){case"FR_NextBtn":case"FR_PrevBtn":i.XLSearch._findCount=0;h=t==="FR_NextBtn"?i.XLSearch._findNext(n("#"+i._id+"_Ribbon_textFind").val(),r,u,f,o,e,s):i.XLSearch._findPrev(n("#"+i._id+"_Ribbon_textFind").val(),r,u,f,o,e,s);h||(i.XLSearch._updateSelection(c,l,r),i.hideWaitingPopUp(),i._showAlertDlg("Alert","NotFound"));break;case"FR_ReplaceBtn":i.XLSearch._replaceData(n("#"+i._id+"_Ribbon_textFind").val(),n("#"+i._id+"_Ribbon_textReplace").val(),r,u,f,o,a,e,s);break;case"FR_ReplaceAllBtn":i.XLSearch._replaceAllData(n("#"+i._id+"_Ribbon_textFind").val(),n("#"+i._id+"_Ribbon_textReplace").val(),u,f,o,e);break;case"FR_CloseBtn":n("#"+i._id+"_FRDialog").ejDialog("close");i.setSheetFocus()}i.hideWaitingPopUp()},_renderGoToDialog:function(){var f,o,u,s,e,i=this.XLObj,r;n("#"+i._id+"_GoToDlgTab").ejTab({width:"100%",itemActive:t.proxy(this._gotoTabChange,this),cssClass:"e-ss-dlgtab"});n("#"+i._id+"_GoToDiv").length<1&&(f=t.buildTag("div.e-dlgctndiv","",{},{id:i._id+"_GoToDiv"}),n("#"+i._id+"_GoTo").append(f),r=t.buildTag("div.e-dlg-fields"),u=t.buildTag("label.e-dlg-fields",i._getLocStr("GoToName")),s=t.buildTag("ul#"+i._id+"_GotoAddr"),f.append(r.append(u,s)),n("#"+i._id+"_GotoAddr").ejListBox({dataSource:this._addrList,height:"120",width:"100%",selected:n.proxy(this._gotoValChange,this),fields:{id:"Types",text:"text",value:"value"}}),r=t.buildTag("div.e-dlg-fields"),u=t.buildTag("label.e-dlg-fields",i._getLocStr("Reference")),e=t.buildTag("input.ejinputtext","","",{id:i._id+"_textRef",type:"text"}),e.data("parentID",i._id),f.append(r.append(u,e)),o=t.buildTag("div#"+i._id+"_GoToSpDiv.e-dlgctndiv","",""),r=t.buildTag("div.e-dlg-fields e-dlgctndiv"),n("#"+i._id+"_GoToSp").append(o.append(r)),n("#"+i._id+"_GoToSp").css({overflow:"auto",height:"auto"}),u=t.buildTag("label.e-dlg-fields").text(i._getLocStr("Select")).css("display","table"),r.append(u),this._renderGotoSp(r,this._gotoRBtnSet1,this._gotoRBtnSet2,this._gotoChkBox),n("#"+i._id+"_GoDialog").ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,width:"auto",allowKeyboardNavigation:!1,title:i._getLocStr("GoTo"),cssClass:"e-ss-dialog e-ss-gotodlg e-ss-mattab e-"+i._id+"-dlg",close:t.proxy(this._dialogClose,this),open:t.proxy(function(){var t=n("#"+i._id+"_textRef");t.focus().setInputPos(t.val().length)})}),n("#"+i._id+"_GoToDiv").wrapInner('<form id="'+i._id+'_Form_GoToDiv" onsubmit="return false"><\/form>'),this._dialogValidate("_GoToDiv"))},_renderGotoSp:function(i,r,u,f){for(var l,c,s,e,h=this.XLObj,v=h._id+"_gotoSpDiv",a,y=t.buildTag("table"),o=0;o<r.length;o++)s=t.buildTag("tr","",{height:35}),e=t.buildTag("td"),l=t.buildTag("input#"+v+"_"+r[o],"",{},{type:"radio",name:"gotospecial"}),e.append(l),s.append(e),l.ejRadioButton({size:"medium",change:n.proxy(this._rBtnOnClick,this,r[o])}),e=t.buildTag("td","",{width:100}),c=t.buildTag("label",h._getLocStr(r[o]),{},{"for":v+"_"+r[o]}),e.append(c),s.append(e),h.isUndefined(u[o])||(e=t.buildTag("td"),l=t.buildTag("input#"+v+"_"+u[o],"",{},{type:"radio",name:"gotospecial"}),e.append(l),s.append(e),l.ejRadioButton({size:"medium",change:n.proxy(this._rBtnOnClick,this,u[o])}),e=t.buildTag("td"),c=t.buildTag("label",h._getLocStr(u[o]),{},{"for":v+"_"+u[o]}),e.append(c),s.append(e)),y.append(s);for(o=0;o<f.length;o=o+2)s=t.buildTag("tr"),e=t.buildTag("td"),a=t.buildTag("input#"+h._id+"_"+f[o]),e.append(a),s.append(e),e=t.buildTag("td"),c=t.buildTag("label",h._getLocStr(f[o]),{},{"for":h._id+"_"+f[o]}),e.append(c),s.append(e),a.ejCheckBox({checked:!0,enabled:!1}),e=t.buildTag("td"),a=t.buildTag("input#"+h._id+"_"+f[o+1]),e.append(a),s.append(e),e=t.buildTag("td"),c=t.buildTag("label",h._getLocStr(f[o+1]),{},{"for":h._id+"_"+f[o+1]}),e.append(c),s.append(e),a.ejCheckBox({checked:!0,enabled:!1}),y.append(s);i.append(y);n("#"+v+"_Blanks").ejRadioButton("option",{checked:!0})},_renderPvtDialog:function(){var r=this.XLObj,s,e,o,u,i,f;n("#"+r._id+"_Ribbon_PvtDiv").length<1&&(s=t.buildTag("div.e-dlgctndiv","",{},{id:r._id+"_Ribbon_PvtDiv"}),o=t.buildTag("table","",{},{cellpadding:0,cellspacing:0}),u=t.buildTag("tr.e-ss-changerange"),i=t.buildTag("td",""),e=t.buildTag("label",r._getLocStr("Range")),i.append(e),u.append(i),i=t.buildTag("td",""),f=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_PvtRange",type:"text"}),f.data("parentID",r._id),u.append(i.append(f)),o.append(u),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),e=t.buildTag("label",r._getLocStr("ChoosePivotTable")),i.append(e),i.attr("colspan",2),o.append(u.append(i)),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),i.attr("colspan",2),f=t.buildTag("input#"+r._id+"_dlg_newsheet","",{},{type:"radio",name:"sheet"}),i.append(f),e=t.buildTag("label"," "+r._getLocStr("NewWorksheet")),i.append(e),o.append(u.append(i)),f.ejRadioButton({size:"medium",checked:!0,change:n.proxy(this._rBtnPvtOnClick,this,"new")}),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),i.attr("colspan",2),f=t.buildTag("input#"+r._id+"_dlg_existsheet","",{},{type:"radio",name:"sheet"}),i.append(f),e=t.buildTag("label"," "+r._getLocStr("ExistingWorksheet")),i.append(e),o.append(u.append(i)),f.ejRadioButton({size:"medium",change:n.proxy(this._rBtnPvtOnClick,this,"existing")}),u=t.buildTag("tr.e-ss-movepvttbl"),i=t.buildTag("td"),e=t.buildTag("label",r._getLocStr("Location")),i.append(e),u.append(i),i=t.buildTag("td"),f=t.buildTag("input.ejinputtext","",{},{id:r._id+"_Ribbon_PvtLocation",type:"text"}),f.data("parentID",r._id),u.append(i.append(f)),o.append(u),n("#"+r._id+"_Pivot").append(s.append(o)),n("#"+r._id+"_Ribbon_PvtLocation").wrap("<form id='"+r._id+"_Form_Ribbon_PvtLocation' onsubmit='return false'><\/form>").prop("disabled",!0),this._dialogValidate("_Ribbon_PvtLocation"),n("#"+r._id+"_Ribbon_PvtRange").wrap("<form id='"+r._id+"_Form_Ribbon_PvtRange' onsubmit='return false'><\/form>"),this._dialogValidate("_Ribbon_PvtRange"))},_dlgPvtOk:function(){var t=this.XLObj,r=n("#"+t._id+"_PvtDialog"),i;n("#"+t._id+"_Form_Ribbon_PvtRange").valid()&&n("#"+t._id+"_Form_Ribbon_PvtLocation").valid()&&(i=t.XLPivot._checkRange(n("#"+t._id+"_Ribbon_PvtRange").val(),n("#"+t._id+"_Ribbon_PvtLocation").val()),i.isRows?t._showAlertDlg("Alert","PivotRowsAlert","",450):i.isHeader?t._showAlertDlg("Alert","PivotLabelsAlert","",550):i.isOverlap?t._showAlertDlg("Alert","PivotOverlapAlert","",450):(n("#"+t._id+"_PvtDialog").ejDialog("close"),r.find(".e-ss-changerange:visible").length&&r.find(".e-ss-movepvttbl:visible").length?t.XLPivot.createPivotTable(n("#"+t._id+"_Ribbon_PvtRange").val(),n("#"+t._id+"_Ribbon_PvtLocation").val(),null):r.find(".e-ss-changerange:visible").length?t.XLPivot._changeDataSource():t.XLPivot._movePivotTable()))},_dlgPvtCancel:function(){var t=this.XLObj;n("#"+t._id+"_PvtDialog").ejDialog("close");t.setSheetFocus()},_rBtnPvtOnClick:function(t){var r=this.XLObj,u=n("#"+r._id+"_Ribbon_PvtRange"),i=n("#"+r._id+"_Ribbon_PvtLocation");i.prop("disabled",t==="new");t==="new"?(u.focus().setInputPos(u.val().length),n("#"+this.XLObj._id+"_Form_Ribbon_PvtLocation").validate().resetForm()):i.setInputPos(i.val().length)},_rBtnOnClick:function(t){var r=this.XLObj,i;if(t==="Formulas"||t==="Constants")for(i=0;i<this._gotoChkBox.length;i++)n("#"+r._id+"_"+this._gotoChkBox[i]).data("ejCheckBox").option({enabled:!0});else for(i=0;i<this._gotoChkBox.length;i++)n("#"+r._id+"_"+this._gotoChkBox[i]).data("ejCheckBox").option({enabled:!1})},_gotoValChange:function(t){n("#"+this.XLObj._id+"_textRef").val(t.model.value)},_getAddrFromDollarAddr:function(n){var i,t;return n.indexOf("!")>-1&&(t=n.split("!"),i=this.XLObj._getSheetIndexByName(t[0]),n=t[1]),n.indexOf("$")>-1&&(n=n.split("$").join("")),n.indexOf(":")<0&&(n=n+":"+n),n=n.replace("=",""),[i,n]},_gotoBtnClick:function(t){var i=this.XLObj,r;switch(t){case"ok":n("#"+i._id+"_Form_GoToDiv").valid()&&(r=n("#"+i._id+"_GoToDlgTab").data("ejTab"),r.model.selectedItemIndex?i.XLSearch._applyGoToRule(n("#"+i._id+"_GoToSpDiv").find(".e-circle_01").parents("div")[0].id.split("ej"+i._id+"_gotoSpDiv_")[1].toLowerCase(),n("#"+i._id+"_"+this._gotoChkBox[0]).data("ejCheckBox").isChecked(),n("#"+i._id+"_"+this._gotoChkBox[1]).data("ejCheckBox").isChecked(),n("#"+i._id+"_"+this._gotoChkBox[2]).data("ejCheckBox").isChecked(),n("#"+i._id+"_"+this._gotoChkBox[3]).data("ejCheckBox").isChecked()):i.XLSearch.goTo(n.trim(n("#"+i._id+"_textRef").val().toString())),n("#"+i._id+"_GoDialog").ejDialog("close"));break;case"cancel":n.validator&&n("#"+i._id+"_Form_GoToDiv").validate().resetForm();n("#"+i._id+"_GoDialog").ejDialog("close")}i.setSheetFocus()},_borderPicture:function(){var n=this.XLObj;return"<ul id="+n._id+"_Ribbon_PictureBorder style='display:none' class='e-ss-pictureborder'><li id='"+n._id+"picturecolor'><a>"+n._getLocStr("ThemeColor")+"<\/a><ul><li><input id='"+n._id+"_Ribbon_PictureColor'><\/input><\/li><\/ul><\/li><li id='nooutline' class='picturecolor'><a>"+n._getLocStr("NoOutline")+"<\/a><\/li><li id='weight' class='picturecolor'><a>"+n._getLocStr("Weight")+"<\/a><ul><li id='1px'><a>1px<\/a><\/li><li id='2px'><a>2px<\/a><\/li><li id='3px'><a>3px<\/a><\/li><\/ul><\/li><li id='dashes' class='picturecolor'><a>"+n._getLocStr("Dashes")+"<\/a><ul><li id='solid'><a><div style='border:2px solid black'><\/div><\/a><\/li><li id='dotted'><a><div style='border:2px dotted black'><\/div><\/a><\/li><li id='dashed'><a><div style='border:2px dashed black'><\/div><\/a><\/li><\/ul><\/li><\/ul>"},_chartElementTag:function(){var n=this.XLObj,t="<ul id="+n._id+'_Ribbon_CElement class="e-spreadsheet" style="display:none">';return t+='<li class="axes" id="Axes"><a><span class="e-ss-chartimg e-icon e-ss-axes"><\/span>'+n._getLocStr("Axes")+'<\/a><ul><li class="phaxis e-ss-cmenuitem" id="PHAxis"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-phaxis"><\/span>'+n._getLocStr("PHAxis")+'<\/a><\/li><li class="pvaxis e-ss-cmenuitem" id="PVAxis"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pvaxis"><\/span>'+n._getLocStr("PVAxis")+"<\/a><\/li><\/ul><\/li>",t+='<li class="axistitle" id="AxisTitle"><a><span class="e-ss-chartimg e-icon e-ss-axistitle"><\/span>'+n._getLocStr("AxisTitle")+'<\/a><ul><li class="phaxistitle e-ss-cmenuitem" id="PHAxisTitle"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-phaxistitle"><\/span>'+n._getLocStr("PHAxis")+'<\/a><\/li><li class="pvaxistitle e-ss-cmenuitem" id="PVAxisTitle"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pvaxistitle"><\/span>'+n._getLocStr("PVAxis")+"<\/a><\/li><\/ul><\/li>",t+='<li class="charttitle" id="ChartTitle"><a><span class="e-ss-chartimg e-icon e-ss-charttitle"><\/span>'+n._getLocStr("ChartTitle")+'<\/a><ul><li class="ctnone e-ss-cmenuitem" id="CTNone"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctnone"><\/span>'+n._getLocStr("CTNone")+'<\/a><\/li><li class="ctcenter e-ss-cmenuitem" id="CTCenter"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctcenter"><\/span>'+n._getLocStr("CTCenter")+'<\/a><\/li><li class="ctfar e-ss-cmenuitem" id="CTFar"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctfar"><\/span>'+n._getLocStr("CTFar")+'<\/a><\/li><li class="ctnear e-ss-cmenuitem" id="CTNear"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ctnear"><\/span>'+n._getLocStr("CTNear")+"<\/a><\/li><\/ul><\/li>",t+='<li class="datalabels" id="DataLabels"><a><span class="e-ss-chartimg e-icon e-ss-datalabels"><\/span>'+n._getLocStr("DataLabels")+'<\/a><ul><li class="dlnone e-ss-cmenuitem" id="DLNone"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dlnone"><\/span>'+n._getLocStr("DLNone")+'<\/a><\/li><li class="dlcenter e-ss-cmenuitem" id="DLCenter"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dlcenter"><\/span>'+n._getLocStr("DLCenter")+'<\/a><\/li><li class="dliend e-ss-cmenuitem" id="DLIEnd"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dliend"><\/span>'+n._getLocStr("DLIEnd")+'<\/a><\/li><li class="dlibase e-ss-cmenuitem" id="DLIBase"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dlibase"><\/span>'+n._getLocStr("DLIBase")+'<\/a><\/li><li class="dloend e-ss-cmenuitem" id="DLOEnd"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-dloend"><\/span>'+n._getLocStr("DLOEnd")+"<\/a><\/li><\/ul><\/li>",t+='<li class="gridline" id="Gridline"><a><span class="e-ss-chartimg e-icon e-ss-gridline"><\/span>'+n._getLocStr("Gridline")+'<\/a><ul><li class="pmajorh e-ss-cmenuitem" id="PMajorH"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pmajorh"><\/span>'+n._getLocStr("PMajorH")+'<\/a><\/li><li class="pmajorv e-ss-cmenuitem" id="PMajorV"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pmajorv"><\/span>'+n._getLocStr("PMajorV")+'<\/a><\/li><li class="pminorh e-ss-cmenuitem" id="PMinorH"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pminorh"><\/span>'+n._getLocStr("PMinorH")+'<\/a><\/li><li class="pminorv e-ss-cmenuitem" id="PMinorV"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-pminorv"><\/span>'+n._getLocStr("PMinorV")+"<\/a><\/li><\/ul><\/li>",t+('<li class="legend" id="Legend"><a><span class="e-ss-chartimg e-icon e-ss-legend"><\/span>'+n._getLocStr("Legend")+'<\/a><ul><li class="lnone e-ss-cmenuitem" id="LNone"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lnone"><\/span>'+n._getLocStr("LNone")+'<\/a><\/li><li class="lright e-ss-cmenuitem" id="LRight"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lright"><\/span>'+n._getLocStr("LRight")+'<\/a><\/li><li class="lleft e-ss-cmenuitem" id="LLeft"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lleft"><\/span>'+n._getLocStr("LLeft")+'<\/a><\/li><li class="lbottom e-ss-cmenuitem" id="LBottom"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-lbottom"><\/span>'+n._getLocStr("LBottom")+'<\/a><\/li><li class="ltop e-ss-cmenuitem" id="LTop"><a class="e-ss-chartlayout"><span class="e-ss-chartimg e-icon e-ss-ltop"><\/span>'+n._getLocStr("LTop")+"<\/a><\/li><\/ul><\/li>")},_cpClickHandler:function(t){var i=this.XLObj;t==="Ribbon_Home_Font_FillColor"?i.XLFormat.format({style:{"background-color":n("#"+i._id+"_Ribbon_Home_Font_FillColor").ejColorPicker("option","value")}}):t==="Ribbon_Home_Font_FontColor"&&i.XLFormat.format({style:{color:n("#"+i._id+"_Ribbon_Home_Font_FontColor").ejColorPicker("option","value")}});i.setSheetFocus()},_ribbonClickHandler:function(i){var rt,ci,kt,nt,dt,c,l,li,et,ht,g,ot,st,at,ut,tt,gt={},r=n("#"+this._id.split("_Ribbon")[0]).data("ejSpreadsheet"),f=r.getActiveSheetIndex(),e=r.getSheet(f),a={},o={},h=this._id.split("_"),y=t.Spreadsheet.SupportedStyles,ai,ct,wi,p,v=e._selectedCells,d,b,k,yt,ni,vt,ti,pt,vi,yi,wt,ii,it,bt,ri,s,ui,fi,ei,w,ft,u,bi,lt,oi,hi;if(!r._shapeChange&&!r.XLRibbon._isSetModel){if(r._isRibbonClick=!0,ct=r._getJSSheetContent(f).find(".e-spreadsheetcontentcontainer > .e-content"),wi=r.getMainPanel(),rt=n("#"+r._id+"_Ribbon_Home_Number_NumberFormat").data("ejDropDownList"),ut=n("#"+r._id+"_Ribbon_Home_Font_FontSize").data("ejDropDownList"),at=n(r.getCell(e._activeCell.rowIndex,e._activeCell.colIndex)),r.model.allowSelection&&r.model.allowFormatAsTable&&r.model.allowCellFormatting&&(r.XLFormat._formatEnable||r.XLSelection._isOutsideBordering||r.XLSelection._isGridBordering)&&(r._id+"_Ribbon_Home_Font_BorderColor"===this._id||r._id+"_Ribbon_bordercolor"===i.ID||r._borderStyles.indexOf(i.ID)>-1||(r.XLSelection._isGridBordering=r.XLSelection._isOutsideBordering=r.XLFormat._formatEnable=!1,n("#"+r._id+"_Ribbon_Home_Clipboard_FormatPainter").ejToggleButton("option",{toggleState:!1}),(i.type==="itemSelected"||i.type==="click")&&!r.isUndefined(i.model.prefixIcon)&&(i.model.prefixIcon.split("e-ss-")[1]===i.ID||i.model.prefixIcon.indexOf("e-ss-drawborder")>-1||i.model.prefixIcon.indexOf("e-ss-drawbordergrid")>-1)&&(r.XLSelection._isGridBordering=r.XLSelection._isOutsideBordering=!0),ct.addClass("e-ss-cursor"),ct.removeClass("e-ss-drwbrdrcursor e-ss-drwbrdrgridcursor e-ss-fpcursor"),r.XLSelection._cleanUp(!0))),ai={Id:this._id,isChecked:i.isChecked,status:i.status,prop:i.model,model:r.model},r._trigger("ribbonClick",ai)){r.model.showRibbon&&r.XLRibbon._updateRibbonIcons();return}!t.isNullOrUndefined(r._getAutoFillOptElem())&&r.model.autoFillSettings.showFillOptions&&(r._getAutoFillOptElem().addClass("e-hide"),n("#"+r._id+"_ctxtmenu").hide());switch(this._id){case r._id+"_Ribbon_Home_Clipboard_Cut":r.XLClipboard.cut();break;case r._id+"_Ribbon_Home_Clipboard_Copy":r.XLClipboard.copy();break;case r._id+"_Ribbon_Home_Clipboard_Paste":case r._id+"_Ribbon_Home_Clipboard_PasteOptions":r.XLClipboard._isSpecial=!(i.ID==="PasteValues");r.XLClipboard.paste();break;case r._id+"_Ribbon_Home_Actions_Undo":r.XLClipboard._triggerKeyDown(90,!0);break;case r._id+"_Ribbon_Home_Actions_Redo":r.XLClipboard._triggerKeyDown(89,!0);break;case r._id+"_Ribbon_Home_Alignment_WrapText":r._textFormatting("wrapText");break;case r._id+"_Ribbon_exportXL":r.XLExport["export"](t.Spreadsheet.exportType.Excel);break;case r._id+"_Ribbon_exportCsv":r.XLExport["export"](t.Spreadsheet.exportType.Csv);break;case r._id+"_Ribbon_exportPdf":r.XLExport["export"](t.Spreadsheet.exportType.Pdf);break;case r._id+"_Ribbon_PageLayout_Print_Print":r.XLPrint.printSheet(f);break;case r._id+"_Ribbon_PageLayout_Print_PrintSelected":r.XLPrint.printSelection(f);break;case r._id+"_Ribbon_new":r._cellFormatHandler(this._id.replace(r._id+"_Ribbon_",""),i.selectedText);break;case r._id+"_Ribbon_Home_Font_Bold":o[y.FontWeight]=i.model.toggleState?"bold":"normal";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_Italic":o[y.FontStyle]=i.model.toggleState?"italic":"normal";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_Underline":case r._id+"_Ribbon_Home_Font_StrikeThrough":d=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(at[0].className))["text-decoration"]||"";h.indexOf("StrikeThrough")>-1?h[h.indexOf("StrikeThrough")]="line-through":h.indexOf("Underline")>-1&&(h[h.indexOf("Underline")]="underline");i.model.toggleState?(d=d.replace("none",""),o[y.TextDecoration]=d?d.indexOf("underline")<0?d+" "+h[h.length-1]:h[h.length-1]+" "+d:h[h.length-1]):(d=n.trim(d.replace(h[h.length-1],"")),o[y.TextDecoration]=d.length?d:"none");a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_FontSize":o[y.FontSize]=i.value;a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_IncreaseFontSize":case r._id+"_Ribbon_Home_Font_DecreaseFontSize":this._id==r._id+"_Ribbon_Home_Font_IncreaseFontSize"?(st=t.isNullOrUndefined(ut.selectedIndexValue)?6:ut.selectedIndexValue+1,t.isNullOrUndefined(r.XLRibbon._fontSize[st])||ut.option({selectedItemIndex:st})):this._id==r._id+"_Ribbon_Home_Font_DecreaseFontSize"&&(st=t.isNullOrUndefined(ut.selectedIndexValue)?4:ut.selectedIndexValue-1,t.isNullOrUndefined(r.XLRibbon._fontSize[st])||ut.option({selectedItemIndex:st}));break;case r._id+"_Ribbon_Home_Alignment_AlignLeft":case r._id+"_Ribbon_Home_Alignment_AlignRight":case r._id+"_Ribbon_Home_Alignment_AlignCenter":g=n(this.element.parents("div").eq(1)).find(".e-text-align");t.isNullOrUndefined(g[0])?this.element.addClass("e-text-align"):(n("#"+g[0].id).ejToggleButton("option","toggleState",!1),g.removeClass("e-text-align"),g[0].id!=this.element[0].id&&this.element.addClass("e-text-align"));o[y.TextAlign]=i.model.toggleState?h[h.length-1].split("Align")[1]:"left";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Alignment_DecreaseIndent":case r._id+"_Ribbon_Home_Alignment_IncreaseIndent":if(ni=0,ti=!1,v.length<2)pt=r.getActiveCell(),b=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(r.getCell(pt.rowIndex,pt.colIndex)[0].className)),vt=y.TextIndent in b?this._id===r._id+"_Ribbon_Home_Alignment_IncreaseIndent"?Number(b[y.TextIndent].replace("pt",""))+6:Number(b[y.TextIndent].replace("pt",""))-6:this._id===r._id+"_Ribbon_Home_Alignment_DecreaseIndent"?-6:6,r.XLRibbon._applyTextIndent(pt,b,vt,this);else{for(k=0,yt=v.length;k<yt;k++)b=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(r.getCell(v[k].rowIndex,v[k].colIndex)[0].className)),b[y.TextAlign]=="right"&&ni++;for(ni===v.length&&(ti=!0),k=0,yt=v.length;k<yt;k++)b=r.XLFormat.getFormatFromHashCode(r.XLFormat.getFormatClass(r.getCell(v[k].rowIndex,v[k].colIndex)[0].className)),ti||(b[y.TextAlign]="left"),vt=y.TextIndent in b?this._id===r._id+"_Ribbon_Home_Alignment_IncreaseIndent"?Number(b[y.TextIndent].replace("pt",""))+6:Number(b[y.TextIndent].replace("pt",""))-6:this._id===r._id+"_Ribbon_Home_Alignment_DecreaseIndent"?-6:6,r.XLRibbon._applyTextIndent(v[k],b,vt,this)}r.XLSelection.refreshSelection();r.XLDragFill.positionAutoFillElement();break;case r._id+"_Ribbon_Home_Alignment_TopAlign":case r._id+"_Ribbon_Home_Alignment_MiddleAlign":case r._id+"_Ribbon_Home_Alignment_BottomAlign":g=n(this.element.parents("div").eq(1)).find(".e-vertical-align");t.isNullOrUndefined(g[0])?this.element.addClass("e-vertical-align"):(n("#"+g[0].id).ejToggleButton("option","toggleState",!1),g.removeClass("e-vertical-align"),g[0].id!=this.element[0].id&&this.element.addClass("e-vertical-align"));o[y.VerticalAlign]=i.model.toggleState?h[h.length-1].split("Align")[0]:"bottom";a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_Home_Font_FontFamily":o[y.FontFamily]=i.text;a.style=o;r.XLFormat.format(a);break;case r._id+"_Ribbon_PageLayout_Show_Headings":r.showHeadings(i.isChecked);break;case r._id+"_Ribbon_PageLayout_Show_Gridlines":r.showGridlines(i.isChecked);break;case r._id+"_Ribbon_PageLayout_PageLayout_PageSize":case r._id+"_Ribbon_PageLayout_PageLayout_PageSizeOptions":vi=t.isNullOrUndefined(i.ID)?i.model.prefixIcon.substring(12):i.ID;r.XLPrint._printSetting(vi);break;case r._id+"_Ribbon_Home_Number_NumberFormat":a.type=i.text.toLowerCase();a.type!=="custom"?r.XLFormat.format(a):r._showDialog(r._id+"_FormatCells");break;case r._id+"_Ribbon_Home_Number_IncreaseDecimal":case r._id+"_Ribbon_Home_Number_DecreaseDecimal":at.data("type")!="number"&&n.isNumeric(r.XLEdit.getPropertyValueByElem(at))&&(r.XLRibbon._isSetModel=!0,rt.option({selectedItemIndex:1}),r.XLRibbon._isSetModel=!1);r.XLFormat.updateDecimalPlaces(h[h.length-1]);break;case r._id+"_Ribbon_Home_Number_Accounting":case r._id+"_Ribbon_Home_Number_Percentage":this._id===r._id+"_Ribbon_Home_Number_Accounting"?rt.option({selectedItemIndex:3}):rt.option({selectedItemIndex:4});a.type=rt.selectedTextValue.toLowerCase();break;case r._id+"_Ribbon_Home_Number_CommaStyle":rt.option({selectedItemIndex:1});a.type=rt.selectedTextValue.toLowerCase();break;case r._id+"_Ribbon_Data_SortFilter_SortAtoZ":r.XLSort._sortHandler("SortAtoZ");break;case r._id+"_Ribbon_Data_SortFilter_SortZtoA":r.XLSort._sortHandler("SortZtoA");break;case r._id+"_Ribbon_Data_SortFilter_Filter":r.XLFilter.filter();break;case r._id+"_Ribbon_Data_SortFilter_ClearFilter":ot=r.XLEdit.getPropertyValue(r.getActiveCell().rowIndex,r.getActiveCell().colIndex,"tableName");t.isNullOrUndefined(ot)?r.XLFilter.clearFilter():(s=r._getTableID(ot),r.XLFilter._clearFilterTable(r.getActiveSheetIndex(),s,!0));break;case r._id+"_Ribbon_Home_Font_BorderColor":gt=n("#"+r._id+"_Ribbon_BorderColor").data("ejColorPicker");t.isNullOrUndefined(gt)||gt.hide();t.isNullOrUndefined(i.value)||(r._borderColor=i.value);break;case r._id+"_Ribbon_Home_Font_Border":r._borderStyles.indexOf(i.ID)<0?t.isNullOrUndefined(i.ID)?i.ID=i.model.prefixIcon.substring(12):i.ID.indexOf("bordercolor")<0&&n(this.element).find(".e-icon ").removeClass().addClass("e-icon e-ss-"+i.ID)&&this.option({prefixIcon:"e-icon e-ss-"+i.ID}):r.XLRibbon._updateBordeStyle(i);ci=r._borderColor||"#000000";c=e._startCell;l=e._endCell;yi=r._getAlphaRange(f,c.rowIndex,c.colIndex,l.rowIndex,l.colIndex);r.model.allowSelection&&(r.XLSelection._isOutsideBordering||r.XLSelection._isGridBordering)?!(r._borderStyles.indexOf(i.ID)>-1)&&i.ID.indexOf("bordercolor")<0&&(r.XLSelection._isOutsideBordering=r.XLSelection._isGridBordering=!1):r.setBorder({type:i.ID,color:ci,style:r._borderStyle},yi);break;case r._id+"_Ribbon_Data_DataTools_DataValidation":case r._id+"_Ribbon_Data_DataTools_DataValidationOptions":r._showDialog(this._id);i.ID=="ClearVal"?r.XLValidate.clearDV():i.ID=="HighlightVal"?r.XLValidate.highlightInvalidData():i.ID=="ClearHLVal"?r.XLValidate.clearHighlightedValData():(n("#"+r._id+"_ValDialog").ejDialog("open"),n.validator&&n("#"+r._id+"_Form_ValDialog").validate().resetForm(),n("#"+r._id+"_Ribbon_ddType_wrapper").focus(),wt=r.XLEdit.getPropertyValueByElem(r.getActiveCellElem(f),"rule"),wt?(ii=wt.customVal,it=ii.split("_"),ii.indexOf("list")>-1?(n("#"+r._id+"_Ribbon_ddType").ejDropDownList("option","selectedItemIndex",5),n("#"+r._id+"_Ribbon_btnMin").val(it[0])):(r.XLRibbon._types.filter(function(n,t){if(it[4]===n.value)return bt=t,!0}),n("#"+r._id+"_Ribbon_ddType").ejDropDownList("option","selectedItemIndex",bt),r.XLRibbon._actions.filter(function(n,t){if(it[0]===n.value)return bt=t,!0}),n("#"+r._id+"_Ribbon_ddAction").ejDropDownList("option","selectedItemIndex",bt),n("#"+r._id+"_Ribbon_btnMin").val(it[1].replace("^","")),n("#"+r._id+"_Ribbon_btnMax").val(it[2].replace("^",""))),n("#"+r._id+"_Ribbon_blank").ejCheckBox("option","checked",!wt.required),n("#"+r._id+"_Ribbon_freetext").ejCheckBox("option","checked",JSON.parse(it[it.length-3]))):(n("#"+r._id+"_Ribbon_ddType").ejDropDownList("option","selectedItemIndex",1),n("#"+r._id+"_Ribbon_ddAction").ejDropDownList("option","selectedItemIndex",6),n("#"+r._id+"_Ribbon_btnMin").val(""),n("#"+r._id+"_Ribbon_btnMax").val(""),n("#"+r._id+"_Ribbon_blank").ejCheckBox("option","checked",!0),n("#"+r._id+"_Ribbon_freetext").ejCheckBox("option","checked",!0)));break;case r._id+"_Ribbon_Home_Styles_ConditionalFormatting":if(!i.ID.length)break;r.XLRibbon._currentCFormat=i.ID;i.ID.startsWith("clear")?i.ID==="clearselected"?r.XLCFormat.clearCF(r.getSheet(f).selectedRange):r.XLCFormat.clearCF():i.ID.indexOf("_HLCellRules")>0||i.ID.indexOf("_ClearRules")>0||i.ID.indexOf("_CreateRule")<-1||(r._showDialog(this._id),r.XLRibbon._renderCFDialog(i));break;case r._id+"_Ribbon_Others_Editing_FindSelect":r._showDialog(this._id);kt=n("#"+r._id+"_GoToDlgTab").data("ejTab");ri=n("#"+r._id+"_FRDialog_FPDlgTab").data("ejTab");switch(i.ID){case"Find":r._responsiveHeight<365&&n("#"+r._id+"_FRDialog_wrapper").css("top","0px");n("#"+r._id+"_FRDialog").ejDialog("open");r.XLRibbon._refreshFRDlg();ri.option({selectedItemIndex:0});n("#"+r._id+"_Ribbon_textFind").focus().setInputPos(n("#"+r._id+"_Ribbon_textFind").val().length);r.model.isReadOnly?n("#"+r._id+"_FRDialog_FPDlgTab").ejTab("option",{disabledItemIndex:[1,2]}):n("#"+r._id+"_FRDialog_FPDlgTab").ejTab("option",{enabledItemIndex:[1,2]});break;case"Replace":r._responsiveHeight<365&&n("#"+r._id+"_FRDialog_wrapper").css("top","0px");n("#"+r._id+"_FRDialog").ejDialog("open");r.XLRibbon._refreshFRDlg();ri.option({selectedItemIndex:1});n("#"+r._id+"_Ribbon_textFind").focus().setInputPos(n("#"+r._id+"_Ribbon_textFind").val().length);break;case"GoTo":n("#"+r._id+"_GoDialog").ejDialog("open");kt.option({selectedItemIndex:0});n("#"+r._id+"_textRef").focus().setInputPos(n("#"+r._id+"_Ribbon_textFind").val().length);n.validator&&n("#"+r._id+"_Form_GoToDiv").validate().resetForm();break;case"GoToSpecial":n("#"+r._id+"_GoDialog").ejDialog("open");kt.option({selectedItemIndex:1});n("#"+r._id+"_Blanks").focus();break;default:r.XLSearch._applyGoToRule(i.ID.toLowerCase(),!0,!0,!0,!0)}break;case r._id+"_Ribbon_Others_CalCulation_CalculationOptions":switch(i.ID){case r._id+"_CalcAuto":r.XLEdit.calcOption(!0);break;case r._id+"_CalcManual":r.XLEdit.calcOption(!1)}break;case r._id+"_Ribbon_Others_CalCulation_CalculateNow":r.XLEdit.calcNow();break;case r._id+"_Ribbon_Others_CalCulation_CalculateSheet":r.XLEdit.calcNow(r.getActiveSheetIndex());break;case r._id+"_Ribbon_Home_Clipboard_FormatPainter":if(!i.model.toggleState)return r.performSelection(r.getActiveCell(),r.getActiveCell()),!1;r.XLFormat._formatEnable=!0;ct.removeClass("e-ss-cursor");ct.addClass("e-ss-fpcursor");r.XLFormat._formatPainter();break;case r._id+"_Ribbon_Design_Tools_ConvertToRange":r.XLFormat.convertToRange({alert:!0});break;case r._id+"_Ribbon_Design_Tools_ResizeTable":s=parseInt(document.getElementById(r._id+"_tableid").value);u=e.tableManager[s].range;r._showDialog(r._id+"_Ribbon_Design_Tools_ResizeTable");n("#"+r._id+"_fatresizetablerange").val(r._getAlphaRange(f,u[0],u[1],u[2],u[3]));n("#"+r._id+"_fatresizetabledlg").ejDialog("open");break;case r._id+"_Ribbon_Design_TableStyleOptions_FirstColumn":case r._id+"_Ribbon_Design_TableStyleOptions_LastColumn":tt=e.tableManager;s=document.getElementById(r._id+"_tableid").value;s in tt&&(u=tt[s].range,u=this._id===r._id+"_Ribbon_Design_TableStyleOptions_FirstColumn"?r._getProperAlphaRange(f,u[0]+1,u[1],u[2],u[1]):r._getProperAlphaRange(f,u[0]+1,u[3],u[2],u[3]),this._id===r._id+"_Ribbon_Design_TableStyleOptions_FirstColumn"?(i.isChecked?tt[s].firstColumn=!0:delete tt[s].firstColumn,dt="firstColumn"):(i.isChecked?tt[s].lastColumn=!0:delete tt[s].lastColumn,dt="lastColumn"),r._dupDetails=!0,r.XLFormat.format({style:{"font-weight":i.isChecked?"bold":"normal"}},u),r._dupDetails=!1,et={sheetIndex:f,reqType:"format-table",action:"firstlastcolumn",range:u,check:i.isChecked,id:i.model.id,tableId:parseInt(s),prop:dt},r._completeAction(et),r._trigActionComplete(et));break;case r._id+"_Ribbon_Design_TableStyleOptions_TotalRow":s=document.getElementById(r._id+"_tableid").value;s in e.tableManager&&r.XLFormat._calculateTotalRow(f,s,i.isChecked,i.isChecked);break;case r._id+"_Ribbon_Design_TableStyleOptions_FilterColumn":if(!r.model.allowFiltering)return;tt=e.tableManager;s=document.getElementById(r._id+"_tableid").value;r.XLFilter._clearFilterTableIcon(f,parseInt(document.getElementById(r._id+"_tableid").value));tt[s].isFilter=i.isChecked;et={sheetIndex:f,reqType:"format-table",action:"filtericon",id:i.model.id,check:i.isChecked,tableId:parseInt(s)};r._completeAction(et);r._trigActionComplete(et);break;case r._id+"_Ribbon_Insert_Tables_Table":r._showDialog(this._id);r.XLRibbon._openFATDlg();break;case r._id+"_Ribbon_Review_Comments_NewComment":n("#"+r._id+"_Ribbon_Review_Comments_NewComment").text()===r._getLocStr("NewComment")?r.XLComment.setComment():r.XLComment.editComment();break;case r._id+"_Ribbon_Review_Comments_DeleteComment":r.XLComment.deleteComment();break;case r._id+"_Ribbon_Review_Comments_ShowAllComments":r.XLComment.showAllComments();break;case r._id+"_Ribbon_Review_Comments_ShowHideComment":r.XLComment.showHideComment();break;case r._id+"_Ribbon_Review_Comments_NextComment":r.XLComment.findNextComment();break;case r._id+"_Ribbon_Review_Comments_PreviousComment":r.XLComment.findPrevComment();break;case r._id+"_Ribbon_Insert_Links_Hyperlink":r._showDialog(this._id);break;case r._id+"_Ribbon_Home_Editing_SortFilter":switch(i.ID){case"Ribbon_SortAtoZ":case"Ribbon_SortZtoA":r.model.allowSorting&&r.XLSort._sortHandler(i.ID);break;case"Ribbon_Filter":r.model.allowFiltering&&r.XLFilter.filter();break;default:ot=r.getCell(r.getActiveCell().rowIndex,r.getActiveCell().colIndex)[0].className;ot.indexOf("e-table")<0?r.XLFilter.clearFilter():(s=r._getTableID(ot),r.XLFilter._clearFilterTable(r.getActiveSheetIndex(),parseInt(s),!0))}break;case r._id+"_Ribbon_Others_Cells_InsertCell":case r._id+"_Ribbon_Others_Cells_InsertCellOptions":if(v.length<1)return;c=v[0];l=v[v.length-1];switch(i.ID){case"InsertCells":r._getJSSheetRowHeaderContent(f).find(".e-rowselected").length?r.insertEntireRow(c.rowIndex,l.rowIndex):r._getJSSheetHeader(f).find(".e-colselected").length?(r._insDelStatus="insert",r.insertEntireColumn(c.colIndex,l.colIndex)):r._showDialog(this._id);break;case"InsertSheetRows":r.insertEntireRow(c.rowIndex,l.rowIndex);break;case"InsertSheetColumns":r._insDelStatus="insert";r.insertEntireColumn(c.colIndex,l.colIndex);break;case"InsertSheet":r.insertSheet();break;default:r.element.find(".e-rowselected").length>0?r.insertEntireRow(c.rowIndex,l.rowIndex):r.element.find(".e-colselected").length>0?(r._insDelStatus="insert",r.insertEntireColumn(c.colIndex,l.colIndex)):r.insertShiftBottom(c,l)}break;case r._id+"_Ribbon_Others_Cells_DeleteCell":case r._id+"_Ribbon_Others_Cells_DeleteCellOptions":if(v.length<1)return;c=v[0];l=v[v.length-1];switch(i.ID){case"DeleteCells":r._getJSSheetRowHeaderContent(f).find(".e-rowselected").length?r.deleteEntireRow(c.rowIndex,l.rowIndex,[]):r._getJSSheetHeader(f).find(".e-colselected").length?(r._insDelStatus="delete",r.deleteEntireColumn(c.colIndex,l.colIndex,[])):r._showDialog(this._id);break;case"DeleteSheetRows":r.deleteEntireRow(c.rowIndex,l.rowIndex,[]);break;case"DeleteSheetColumns":r._insDelStatus="delete";r.deleteEntireColumn(c.colIndex,l.colIndex,[]);break;case"DeleteSheet":r.deleteSheet(f);break;default:r.element.find(".e-rowselected").length>0?r.deleteEntireRow(c.rowIndex,l.rowIndex):r.element.find(".e-colselected").length>0?(r._insDelStatus="insert",r.deleteEntireColumn(c.colIndex,l.colIndex)):r.deleteShiftUp(c,l)}break;case r._id+"_Ribbon_Home_Editing_Clear":u=e.selectedRange;switch(i.ID){case"Clear_All":u=r._getAlphaRange(f,u[0],u[1],u[2],u[3]);r.clearAll(u);break;case"Clear_Formats":u=r._getAlphaRange(f,u[0],u[1],u[2],u[3]);r.clearAllFormat(u);break;case"Clear_Contents":u=r._getAlphaRange(f,u[0],u[1],u[2],u[3]);r.clearContents(u);break;case"Clear_Comments":r.clearComments(f);break;default:r.clearHyperlinks()}r.model.allowSelection&&r.XLSelection._clearBorder(r._arrayAsString(r._cutFocus),f);break;case r._id+"_Ribbon_Insert_Tables_PivotTable":if(r._showDialog(this._id),w=n("#"+r._id+"_PvtDialog"),e=r.getSheet(f),li={sheetIndex:f,model:r.model.sheets},r._trigger("_createPivotTable",li))return;n("#"+r._id+"_Ribbon_PvtRange").val("");n("#"+r._id+"_Ribbon_PvtLocation").val("");e._selectedCells.length>1?(u=e.selectedRange,n("#"+r._id+"_Ribbon_PvtRange").val(e.sheetInfo.text+"!$"+r._generateHeaderText(u[1]+1)+"$"+(u[0]+1)+":$"+r._generateHeaderText(u[3]+1)+"$"+(u[2]+1))):r.isUndefined(r.XLEdit.getPropertyValueByElem(r.getActiveCellElem()))||(r.selectAll(!1),n("#"+r._id+"_Ribbon_PvtRange").val(e.sheetInfo.text+"!$"+r._generateHeaderText(e._startCell.colIndex+1)+"$"+(e._startCell.rowIndex+1)+":$"+r._generateHeaderText(e._endCell.colIndex+1)+"$"+(e._endCell.rowIndex+1)));w.find(".e-ss-changerange").show();w.find(".e-ss-movepvttbl").show();w.data("ejDialog").option("title",r._getLocStr("CreatePivotTable"));n("#"+r._id+"_dlg_newsheet").click();w.ejDialog("open");break;case r._id+"_Ribbon_Analyze_Show_FieldList":i.model.toggleState?(r.XLPivot._displayActPanel=!0,r.getActivationPanel().find("#"+r._id+"_PivotTableSchema_"+r._getContent(f).find(".e-ss-activepivot")[0].id).show(),r.showActivationPanel()):(r.hideActivationPanel(),r.XLPivot._displayActPanel=!1);break;case r._id+"_Ribbon_Analyze_Actions_ClearAll":ui=r.element.find(".e-ss-activepivot")[0].id;fi=n("#"+ui).data("ejPivotGrid");ei=n("#"+r._id+"_PivotTableSchema_"+ui).data("ejPivotSchemaDesigner");r.XLPivot._clearFilters(fi,ei);ei.model.pivotControl=fi;break;case r._id+"_Ribbon_Analyze_Actions_MovePivotTable":w=n("#"+r._id+"_PvtDialog");f=r.getActiveSheetIndex();w.find(".e-ss-movepvttbl").show();w.find(".e-ss-changerange").hide();ft=r.getSheet(f).pivotMngr.pivot[r.element.find(".e-ss-activepivot")[0].id];n("#"+r._id+"_Ribbon_PvtLocation").val(r.getSheet(f).sheetInfo.text+"!$"+r._generateHeaderText(ft.colIndex+1)+"$"+(ft.rowIndex+1));w.data("ejDialog").option("title",r._getLocStr("MovePivotTable"));n("#"+r._id+"_dlg_existsheet").click();w.ejDialog("open");break;case r._id+"_Ribbon_Analyze_DataSource_Refresh":r.XLPivot.refreshDataSource();break;case r._id+"_Ribbon_Analyze_DataSource_ChangeDataSource":w=n("#"+r._id+"_PvtDialog");w.find(".e-ss-changerange").show();w.find(".e-ss-movepvttbl").hide();ft=r.getSheet(f).pivotMngr.pivot[r.element.find(".e-ss-activepivot")[0].id];u=ft.dataRange;bi=r.XLPivot._getSheetIdxFromName(ft.dataSheetName);n("#"+r._id+"_Ribbon_PvtRange").val(ft.dataSheetName+"!$"+r._generateHeaderText(u[1]+1)+"$"+(u[0]+1)+":$"+r._generateHeaderText(u[3]+1)+"$"+(u[2]+1));w.data("ejDialog").option("title",r._getLocStr("ChangePivotTableDataSource"));w.ejDialog("open");break;case r._id+"_Ribbon_ChartDesign_Type_ChangeChartType":r._showDialog(this._id);r.XLRibbon._refreshChartTypeDlg();break;case r._id+"_Ribbon_Insert_Illustrations_Pictures":if(r.model.importSettings.importMapper.length<1){r._showAlertDlg("Alert","ImportExportUrl","",266);return}r._uploadImage=!0;n("#"+r._id+"_file .e-uploadinput").click();r.XLRibbon._toggleFormatTab();break;case r._id+"_Ribbon_Others_Formulas_NameManager":r.XLRibbon._openNameManagerDlg();r.XLRibbon._isNmgrid="NameManager";break;case r._id+"_Ribbon_Others_Formulas_DefineName":r._showDialog(r._id+"_Ribbon_Others_NameManager");lt=n("#"+r._id+"_nmgrid").data("ejGrid");lt.getContentTable().find("td").addClass("e-ss-emptyrecord");lt.model.dataSource.length<1?lt.getContentTable().find("td").addClass("e-ss-emptyrecord"):lt.getContentTable().find(".e-ss-emptyrecord").removeClass("e-ss-emptyrecord");r.XLRibbon._refreshNMDlg();r.XLRibbon._isNmgrid="DefineName";break;case r._id+"_Ribbon_Others_Window_FreezePanes":switch(i.ID){case"freezePanes":r.XLFreeze.freezePanes();break;case"FreezeTopRow":r.XLFreeze.freezeTopRow();break;case"FreezeFirstColumn":r.XLFreeze.freezeLeftColumn();break;case"UnFreezePanes":r.XLFreeze.unfreezePanes()}break;case r._id+"_Ribbon_Home_Alignment_Merge":t.isNullOrUndefined(i.ID)&&(r.mergeCenter=!0,r.mergeCells());switch(i.ID){case"MergeCells":r.mergeCells();break;case"MergeAcross":r.mergeAcrossCells();break;case"MergeAndCenter":r.mergeCenter=!0;r.mergeCells();break;case"UnmergeCells":r.unmergeCells(e.selectedRange)}break;case r._id+"_Ribbon_Home_Editing_AutoSum":nt=e.selectedRange;i.type==="click"?r.XLRibbon.autoSum("SUM",r._getAlphaRange(f,nt[0],nt[1],nt[2],nt[3])):r.XLRibbon.autoSum(i.ID.toUpperCase(),r._getAlphaRange(f,nt[0],nt[1],nt[2],nt[3]));break;case r._id+"_Ribbon_ChartDesign_ChartLayouts_AddChartElement":r.XLChart.updateChartElement(null,i.ID);break;case r._id+"_Ribbon_ChartDesign_Size_ChartWidth":r.XLRibbon._changeChartSize("height",i.value);break;case r._id+"_Ribbon_ChartDesign_Size_ChartHeight":r.XLRibbon._changeChartSize("width",i.value);break;case r._id+"_Ribbon_ChartDesign_Data_SwitchRowColumn":r.XLChart.switchRowColumn();break;case r._id+"_Ribbon_PictureColor":case r._id+"_Ribbon_Format_Border_PictureBorder":if(["weight","dashes",r._id+"picturecolor",""].indexOf(i.ID)===-1){ht=r.getSheetElement(f).find(".e-ss-activeimg");oi=new RegExp("\\be-shapebdr.*?\\b","g");o=ht[0].className.match(oi)?r.XLShape._getImgStyleFromHashCode(ht[0].className.match(oi)[0]):{"border-color":"transparent","border-width":"1px","border-style":"solid"};var si=o["border-color"],pi=o["border-width"],o=o["border-style"];if(ht[0]){switch(!0){case this._id.indexOf("PictureColor")>-1:si=i.value;break;case i.ID.indexOf("px")>-1:pi=i.ID;break;case i.ID==="nooutline":si="transparent";break;default:o=i.ID}r.XLShape.changePictureBorder(ht[0].id,pi,o,si)}}break;case r._id+"_Ribbon_Format_Adjust_ResetPicture":r.XLShape.resetPicture(null,i.ID);break;case r._id+"_Ribbon_Format_Adjust_ChangePicture":r._uploadImage=!0;r.XLShape._changePicture=!0;r.element.find("#"+r._id+"_file .e-uploadinput").click();r.XLRibbon._toggleFormatTab();break;case r._id+"_Ribbon_ChartDesign_Data_SelectData":r._showDialog(this._id);cid=document.getElementById(r._id+"_chart").value;p=r.XLChart._getShapeObj(cid,"chart");n("#"+r._id+"_crxaxis").val(p.xRange?r._getAlphaRange(f,p.xRange[0],p.xRange[1],p.xRange[2],p.xRange[3]):"");n("#"+r._id+"_cryaxis").val(p.yRange?r._getAlphaRange(f,p.yRange[0],p.yRange[1],p.yRange[2],p.yRange[3]):"");n("#"+r._id+"_crlaxis").val(p.lRange?r._getAlphaRange(f,p.lRange[0],p.lRange[1],p.lRange[2],p.lRange[3]):"");r._selectDataval={xRange:n("#"+r._id+"_crxaxis").val(),yRange:n("#"+r._id+"_cryaxis").val(),lRange:n("#"+r._id+"_crlaxis").val()};n("#"+r._id+"_chartrangedlg").ejDialog("open");n("#"+r._id+"_crxaxis").focus().setInputPos(0);break;case r._id+"_Ribbon_ChartDesign_ChartThemes_ChartThemes":r.XLChart.changeTheme(r.element.find("#"+r._id+"_chart").val(),this._selectedValue);break;case r._id+"_Ribbon_Review_Changes_LockCell":r.lockCells(null,i.model.toggleState);break;case r._id+"_Ribbon_Review_Changes_ProtectSheet":r.protectSheet(i.model.toggleState);break;case r._id+"_Ribbon_Review_Changes_ProtectWorkbook":r._showDialog(this._id);hi=n("#"+r._id+"_PasswordDialog").data("ejDialog");r.model.exportSettings.password||(hi.option("title",r._getLocStr("ProtectWorkbook")),n("#"+r._id+"_confirm").show());hi.open()}(this._id.indexOf("Comment")<0&&this._id.indexOf("FindSelect")<0||r.XLSearch._isApplied)&&(r.setSheetFocus(),r.XLSearch._isApplied=!1);r._isRibbonClick=!1}},_applyTextIndent:function(n,i,r,u){var f=this.XLObj,v=f.getActiveSheetIndex(),y={},e=t.Spreadsheet.SupportedStyles,p,w,b,h,c,o,s,l=f.getCell(n.rowIndex,n.colIndex),a=f.getSheet(v);if(c=f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value2"),o=f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"value"),!(u._id.indexOf("DecreaseIndent")<0)||!f._hasClass(l[0],"e-sswraptext")||!(Math.round(4/3*r)+f._detailsFromGlobalSpan(n.rowIndex,n.colIndex,"width","W")>a.columnsWidthCollection[n.colIndex])){if(f.isFormula(o)&&(o=c),!i[e.TextIndent]&&u._id===f._id+"_Ribbon_Home_Alignment_DecreaseIndent"||r<0)return!1;i[e.TextIndent]=r+"pt";(i[e.TextAlign]==="center"||f.isNumber(o)&&!i[e.TextAlign])&&(i[e.TextAlign]="left");y.style=i;f.XLFormat.format(y,[n.rowIndex,n.colIndex,n.rowIndex,n.colIndex]);!i[e.TextIndent]||f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"merge")||f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"mergeIdx")||(s=l.outerHeight(),s>=f.model.rowHeight&&(l.parent().outerHeight(s),a.rowsHeightCollection[n.rowIndex]=s,f._fRowHtColl[n.rowIndex]=s,f._setRowHdrHeight(v,n.rowIndex)),p=f._detailsFromGlobalSpan(n.rowIndex,n.colIndex,"width",c,null,!0),b=4/3*r,w=Math.round(b+p),h=a.columnsWidthCollection[n.colIndex],f.XLResize&&f.isNumber(o)&&u._id===f._id+"_Ribbon_Home_Alignment_IncreaseIndent"&&w>=h&&f.XLResize.setColWidth(n.colIndex,8+h))}},_changeChartSize:function(t,i){if(!this._ctrlCreated){var r=this.XLObj,c,s=r.XLEdit.getPropertyValue(r.XLShape._picCellIdx.rowIndex,r.XLShape._picCellIdx.colIndex,"chart")[0],f=document.getElementById(r._id+"_chart").value,u=n("#"+f).ejChart("instance"),o=n("#"+f),h=r.XLChart._getShapeObj(f,"chart"),e={sheetIndex:r.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:t,cid:f,rowIndex:r.XLShape._picCellIdx.rowIndex,colIndex:r.XLShape._picCellIdx.colIndex,prev:{width:u.model.size.width,height:u.model.size.height}};c=u.model.size;t==="height"?(u.option("size",{width:i.toString()}),s.width=i,h.width=i,o[0].style.width=i+"px",e.cur={width:i.toString(),height:u.model.size.height}):(u.option("size",{height:i.toString()}),s.height=i,h.height=i,o[0].style.height=i+"px",e.cur={width:u.model.size.width,height:i.toString()});r.XLChart._afterChartRefresh();r._completeAction(e);r._trigActionComplete(e);r.XLShape._shapeType="chart";r.XLShape._updateShapeObj(o[0]);r.XLShape._shapeType="img"}},_updateBordeStyle:function(n){var t=this.XLObj;t._borderStyle=n.ID&&n.ID.length>0&&n.ID},_colorPickerHandler:function(t,i){var u,r=this.XLObj,f;i.type==="open"?(n("#"+r._id+"_"+t+"_popup").find(".e-buttons, .e-button").hide(),n("#"+r._id+"_"+t+"_popup").focus()):i.type==="change"&&(u=r.XLFormat,f=n("#"+r._id+"_"+t).data("ejColorPicker"),t==="Ribbon_Home_Font_FontColor"?(u.format({style:{color:i.value}}),n("#"+r._id+"_Ribbon_home_Font_Color").find(".e-selected-color").css("background-color",i.value)):(u.format({style:{"background-color":i.value}}),n("#"+r._id+"_Ribbon_home_Font_Background").find(".e-selected-color").css("background-color",i.value)),f.hide(),r._dupDetails=!0,f.setValue(i.value),r._dupDetails=!1)},updateRibbonIcons:function(){this._updateRibbonIcons()},_updateRibbonIcons:function(){var i=this.XLObj,k=i.getActiveSheetIndex(),e=i.getSheet(k),r,a,b;if(this.XLObj.model.showRibbon&&(!e._isImported||e._isLoaded)){var y,p,d,w,v,u,o,s=n("#"+i._id+"_Ribbon_Home_Number_NumberFormat").data("ejDropDownList"),h,c=n("#"+i._id+"_Ribbon_Home_Font_FontSize").data("ejDropDownList"),g=!1;n("#"+i._id+"_Ribbon_Home_Font_FontSize").css("width","auto");var l=n("#"+i._id+"_Ribbon_Home_Font_FontFamily").data("ejDropDownList"),f=-1,nt=n("#"+i._id+"_Ribbon").data("ejRibbon"),tt=nt.getTabText(nt.model.selectedItemIndex);switch(tt){case i._getLocStr("HOME"):if(o=e._activeCell,w=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"wrap"),d=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"merge"),format=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"format"),v=i.XLEdit.getPropertyValue(o.rowIndex,o.colIndex,"type"),t.isNullOrUndefined(i.XLFormat)||(u=i.XLFormat.getFormatFromHashCode(format)),i.isUndefined(w)&&(w=!1),n("#"+i._id+"_Ribbon_Home_Alignment_WrapText").ejToggleButton("option",{toggleState:w}),i.isUndefined(d)?(n("#"+i._id+"_Ribbon_Home_Alignment_Merge").removeClass("e-ss-active"),n("#"+i._id+"_Ribbon_Home_Alignment_Mergedrpbtn").removeClass("e-ss-active")):(n("#"+i._id+"_Ribbon_Home_Alignment_Merge").addClass("e-ss-active"),n("#"+i._id+"_Ribbon_Home_Alignment_Mergedrpbtn").addClass("e-ss-active")),["date"].indexOf(v)>-1&&(v="custom"),v)for(f=-1,r=0,a=this._numberFormat.length;r<a;r++)if(v===this._numberFormat[r].text.toLowerCase()){f=r;break}if(t.isNullOrUndefined(s)||(s._initValue=!0,f>-1?s.option({selectedItemIndex:f}):!t.isNullOrUndefined(s.selectedIndexValue)&&s.selectedIndexValue!=0&&s.option({selectedItemIndex:0}),s._initValue=!1),u){if(f=-1,!t.isNullOrUndefined(u["font-size"]))for(r=0,a=this._fontSize.length;r<a;r++)if(u["font-size"]===this._fontSize[r].value){f=r;break}if(!t.isNullOrUndefined(c)&&(c._initValue=!0,f>-1?c.option({selectedItemIndex:f})||(f=-1):!t.isNullOrUndefined(c.selectedIndexValue)&&c.selectedIndexValue!=3&&c.option({selectedItemIndex:3}),c._initValue=!1,f=-1,!t.isNullOrUndefined(u["font-family"])))for(r=0,a=this._fontFamily.length;r<a;r++)if(u["font-family"]===this._fontFamily[r].text.toLowerCase()){f=r;break}t.isNullOrUndefined(l)||(l._initValue=!0,f>-1?l.option({selectedItemIndex:f}):!t.isNullOrUndefined(l.selectedIndexValue)&&l.selectedIndexValue!=6&&l.option({selectedItemIndex:6}),l._initValue=!1);n("#"+i._id+"_Ribbon_Home_Font_Bold").length&&(u["font-weight"]=="bold"?n("#"+i._id+"_Ribbon_Home_Font_Bold").data("ejToggleButton").option("toggleState",!0):n("#"+i._id+"_Ribbon_Home_Font_Bold").data("ejToggleButton").option("toggleState",!1));n("#"+i._id+"_Ribbon_Home_Font_Italic").length&&(u["font-style"]=="italic"?n("#"+i._id+"_Ribbon_Home_Font_Italic").data("ejToggleButton").option("toggleState",!0):n("#"+i._id+"_Ribbon_Home_Font_Italic").data("ejToggleButton").option("toggleState",!1));u["text-decoration"]=u["text-decoration"]||"";n("#"+i._id+"_Ribbon_Home_Font_Underline").length&&n("#"+i._id+"_Ribbon_Home_Font_Underline").data("ejToggleButton").option("toggleState",u["text-decoration"].indexOf("underline")!==-1);n("#"+i._id+"_Ribbon_Home_Font_StrikeThrough").length&&n("#"+i._id+"_Ribbon_Home_Font_StrikeThrough").data("ejToggleButton").option("toggleState",u["text-decoration"].indexOf("line-through")!==-1);this._tglAlignBtn(n(i.element).find(".e-text-align"),u,"text-align");g=this._tglAlignBtn(n(i.element).find(".e-vertical-align"),u,"vertical-align").isVertical;g||(h=i.element.find("#"+i._id+"_Ribbon_Home_Alignment_BottomAlign"),h.length&&(h.data("ejToggleButton").option("toggleState",!0),h.addClass("e-vertical-align")));i.getSheetElement(k).find(".e-ss-activeimg").length>0&&(h=i.element.find("#"+i._id+"_Ribbon_Home_Alignment_Merge"),h.length&&h.data("ejSplitButton").option("enabled",!1))}break;case i._getLocStr("REVIEW"):b=n("#"+i._id+"_Ribbon_Review_Changes_LockCell");!i.model.allowLockCell||i.XLComment&&i.XLComment._isCommentEdit||i.XLEdit._isEdit||i._isSheetRename||!b.length||(p=b.data("ejToggleButton"),y=i.XLEdit.getPropertyValue(e._activeCell.rowIndex,e._activeCell.colIndex,"isLocked"),i.isUndefined(y)&&(y=!1),p.option("toggleState",y),n("#"+i._id+"_Ribbon_Review_Changes_ProtectSheet").length&&n("#"+i._id+"_Ribbon_Review_Changes_ProtectSheet").data("ejToggleButton").option("toggleState",e.isSheetProtected),e.isSheetProtected?p.disable():p.enable());e.isSheetProtected&&i.model.allowLockCell||!i.model.allowComments||i.XLComment._isCommentEdit||i.XLEdit._isEdit||i._isSheetRename||i.XLComment._updateCmntRibIcons(i.getActiveCell())}!i.model.allowLockCell||e.isSheetProtected||!i.model.allowComments||i.XLComment._isCommentEdit||i._isSheetRename||this._refreshRibbonIcons(tt);i.model.isReadOnly&&i._readOnly()}},_tglAlignBtn:function(n,i,r){var e=!1,u,f=this.XLObj;return t.isNullOrUndefined(n[0])||(u=f.element.find("#"+n[0].id),u.length&&u.data("ejToggleButton").option("toggleState",!1),n.removeClass("e-"+r)),t.isNullOrUndefined(i[r])||(u=r==="vertical-align"?f.element.find("#"+f._id+"_Ribbon_Home_Alignment_"+i[r].charAt(0).toUpperCase()+i[r].slice(1)+"Align"):f.element.find("#"+f._id+"_Ribbon_Home_Alignment_Align"+i[r].charAt(0).toUpperCase()+i[r].slice(1)),u.length&&(u.data("ejToggleButton").option("toggleState",!0),u.addClass("e-"+r)),r==="vertical-align"&&(e=!0)),{isVertical:e}},_disableButtons:function(n,i){for(var e=-1,f,r=this.XLObj,u=0,o=n.length;u<o;u++)r.model.allowLockCell&&(r.XLEdit._isEdit||r._isSheetRename||!r.getSheet(r.getActiveSheetIndex()).isSheetProtected||(e=this._protectStateBtnIds.indexOf(n[u]))),e===-1&&(f=r.element.find("#"+r._id+"_Ribbon_"+n[u]),f.length&&!t.isNullOrUndefined(f.data(i))&&f.data(i).disable())},_enableButtons:function(n,i){for(var e=0,f,r=this.XLObj,u=0,o=n.length;u<o;u++)r.model.allowLockCell&&!r._isSheetRename&&r.getSheet(r.getActiveSheetIndex()).isSheetProtected&&(e=this._protectStateBtnIds.indexOf(n[u])),e>-1&&(f=r.element.find("#"+r._id+"_Ribbon_"+n[u]),f.length&&!t.isNullOrUndefined(f.data(i))&&f.data(i).enable())},_disableInputs:function(t,i){for(var r=0,u=t.length;r<u;r++)n("#"+this.XLObj._id+"_"+t[r]).attr("disabled",i)},_enableRibbonIcons:function(t){if(this.XLObj.model.showRibbon){var c,i=this.XLObj,r=n("#"+i._id+"_Ribbon").data("ejRibbon"),l=i.getActiveSheetIndex(),f=i.getSheet(l)._filterColl,h,u,e,o,s;c=t?t:r.model.selectedItemIndex;switch(r.getTabText(c)){case i._getLocStr("HOME"):this._enableButtons(this._homeBtnIds,"ejButton");this._enableButtons(this._homeSptBtnIds,"ejSplitButton");this._enableButtons(this._homeToggleBtnIds,"ejToggleButton");this._enableButtons(this._homeDdIds,"ejDropDownList");this._enableButtons(this._homeCpIds,"ejColorPicker");i._removeClass(r.element.find("#"+r._id+"_Number_e-groupexpander")[0],"e-disable");break;case i._getLocStr("INSERT"):this._enableButtons(this._insertBtnIds,"ejButton");this._enableButtons(this._insertSptBtnIds,"ejSplitButton");break;case i._getLocStr("DATATAB"):this._enableButtons(this._dataBtnIds,"ejButton");this._enableButtons(this._dataSptBtnIds,"ejSplitButton");break;case i._getLocStr("PAGELAYOUT"):this._enableButtons(this._pageLayBtnIds,"ejButton");this._enableButtons(this._pageLaySptBtnIds,"ejSplitButton");this._enableButtons(this._pageLayChckBxIds,"ejCheckBox");n("#"+r._id+"_pagesetup_viewhdrlbl").eq(0).removeClass("e-disable");n("#"+r._id+"_pagesetup_viewgrdlnlbl").eq(0).removeClass("e-disable");break;case i._getLocStr("REVIEW"):i.model.allowComments&&!i.XLComment._isCommentEdit&&i.XLComment._updateCmntRibIcons();this._enableButtons(this._reviewTglBtnIds,"ejToggleButton");break;case i._getLocStr("OTHERS"):this._enableButtons(this._othersBtnIds,"ejButton");this._enableButtons(this._othersSptBtnIds,"ejSplitButton");break;case i._getLocStr("Design"):this._enableButtons(this._contextualBtnIds,"ejButton");this._enableButtons(this._contextualCheckBoxIds,"ejCheckBox");this._disableInputs(this._contextualInputIds,!1)}for(i.XLClipboard._copyBackup.cells||i.XLClipboard._copyBackup.elem||(i.XLRibbon._disableButtons(["Home_Clipboard_Paste"],"ejButton")||i.XLRibbon._disableButtons(["Home_Clipboard_PasteOptions"],"ejSplitButton"),i.isPasteValuesOnly&&n("#"+i._id+"_Ribbon_Paste").data("ejMenu").disableItemByID("PasteSpecial")),n.isEmptyObject(f)&&this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton"),s=i.getObjectKeys(f),u=0,o=s.length;u<o;u++)for(h=i.getObjectKeys(f[s[u]]),e=0,o=h.length;e<o;e++)f[s[u]][h[e]].status.indexOf("e-ssfiltered")<0&&this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton");i._updateUndoRedoIcons()}},_disableRibbonIcons:function(){var t=this.XLObj,i;if(t.model.showRibbon){i=n("#"+t._id+"_Ribbon").data("ejRibbon");switch(i.getTabText(i.model.selectedItemIndex)){case t._getLocStr("HOME"):this._disableButtons(this._homeBtnIds,"ejButton");this._disableButtons(this._homeSptBtnIds,"ejSplitButton");this._disableButtons(this._homeToggleBtnIds,"ejToggleButton");this._disableButtons(this._homeDdIds,"ejDropDownList");this._disableButtons(this._homeCpIds,"ejColorPicker");t.addClass(i.element.find("#"+i._id+"_Number_e-groupexpander"),"e-disable");break;case t._getLocStr("INSERT"):this._disableButtons(this._insertBtnIds,"ejButton");this._disableButtons(this._insertSptBtnIds,"ejSplitButton");break;case t._getLocStr("DATATAB"):this._disableButtons(this._dataBtnIds,"ejButton");this._disableButtons(this._dataSptBtnIds,"ejSplitButton");break;case t._getLocStr("PAGELAYOUT"):this._disableButtons(this._pageLayBtnIds,"ejButton");this._disableButtons(this._pageLaySptBtnIds,"ejSplitButton");this._disableButtons(this._pageLayChckBxIds,"ejCheckBox");n("#"+i._id+"_pagesetup_viewhdrlbl:eq(0)").addClass("e-disable");n("#"+i._id+"_pagesetup_viewgrdlnlbl:eq(0)").addClass("e-disable");break;case t._getLocStr("REVIEW"):this._disableButtons(this._cmntBtnIds,"ejButton");this._disableButtons(this._cmntTglBtnIds,"ejToggleButton");this._disableButtons(this._reviewTglBtnIds,"ejToggleButton");break;case t._getLocStr("OTHERS"):this._disableButtons(this._othersBtnIds,"ejButton");this._disableButtons(this._othersSptBtnIds,"ejSplitButton");break;case this.XLObj._getLocStr("Design"):this._disableButtons(this._contextualBtnIds,"ejButton");this._disableButtons(this._contextualCheckBoxIds,"ejCheckBox");this._disableInputs(this._contextualInputIds,!0)}}},_capitalize:function(n){return n[0].toUpperCase()+n.slice(1)},_generateToggleBtn:function(n,i,r,u,f,e,o,s,h,c,l,a,v,y){var p=s instanceof Array?this.XLObj._getLocStr(s[0])+"<br /><br />"+this.XLObj._getLocStr(s[1]):this.XLObj._getLocStr(s);return{id:n,toolTip:this.XLObj._getLocStr(i),type:t.Ribbon.type.toggleButton,enableSeparator:h,toggleButtonSettings:{width:e,height:o,contentType:r,cssClass:c,toggleState:y,defaultPrefixIcon:u,activePrefixIcon:v?v:u,defaultText:this.XLObj._getLocStr(i),activeText:a?this.XLObj._getLocStr(a):this.XLObj._getLocStr(i),imagePosition:l=="imagetop"?t.ImagePosition.ImageTop:t.ImagePosition.ImageLeft,click:this._ribbonClickHandler},customToolTip:{title:this.XLObj._getLocStr(f),content:"<h6>"+p+"<\/h6>"}}},_generateBtn:function(n,i,r,u,f,e,o,s,h,c,l){var a=s instanceof Array?this.XLObj._getLocStr(s[0])+"<br /><br />"+this.XLObj._getLocStr(s[1]):this.XLObj._getLocStr(s);return{id:n,text:this.XLObj._getLocStr(i),toolTip:this.XLObj._getLocStr(i),cssClass:l,enableSeparator:h,buttonSettings:{type:t.Ribbon.type.button,contentType:r,width:f,height:e,imagePosition:c=="imagetop"?t.ImagePosition.ImageTop:t.ImagePosition.ImageLeft,prefixIcon:u,click:this._ribbonClickHandler},customToolTip:{title:this.XLObj._getLocStr(o),content:"<h6>"+a+"<\/h6>"}}},_generateDD:function(n,i,r,u,f,e,o,s){return{id:n,text:this.XLObj._getLocStr(i),toolTip:this.XLObj._getLocStr(i),type:t.Ribbon.type.dropDownList,dropdownSettings:{dataSource:r,value:u,change:this._ribbonClickHandler,width:f,height:e-1,cssClass:"e-"+this.XLObj._id+"-ddl"},customToolTip:{title:this.XLObj._getLocStr(o),content:"<h6>"+this.XLObj._getLocStr(s)+"<\/h6>"}}},_generateCustomControl:function(n,i,r,u){return{type:t.Ribbon.type.custom,contentID:n,toolTip:this.XLObj._getLocStr(i),click:this._ribbonClickHandler,change:this._ribbonClickHandler,customToolTip:{title:this.XLObj._getLocStr(r),content:"<h6>"+this.XLObj._getLocStr(u)+"<\/h6>"}}},_generateSplitBtn:function(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w){var b=w instanceof Array?this.XLObj._getLocStr(w[0])+"<br /><br />"+this.XLObj._getLocStr(w[1]):this.XLObj._getLocStr(w);return{id:i,toolTip:this.XLObj._getLocStr(r),text:this.XLObj._getLocStr(r),type:t.Ribbon.type.splitButton,cssClass:y+" e-"+this.XLObj._id+"-spltbtn",enableSeparator:s,splitButtonSettings:{contentType:u,targetID:f,arrowPosition:l=="bottom"?t.ArrowPosition.Bottom:t.ArrowPosition.Right,imagePosition:a=="imagetop"?t.ImagePosition.ImageTop:t.ImagePosition.ImageLeft,buttonMode:v=="dropdown"?t.ButtonMode.Dropdown:t.ButtonMode.Split,fields:e,prefixIcon:o,click:this._ribbonClickHandler,itemSelected:this._ribbonClickHandler,height:c,width:h,beforeOpen:n.proxy(this._splitBeforeOpen,this,i),close:i==="Others_Cells_InsertCellOptions"||i==="Others_Cells_DeleteCellOptions"||i==="Data_DataTools_DataValidationOptions"||i==="Home_Clipboard_PasteOptions"?n.proxy(this._splitbtnClose,this,i):null},customToolTip:{title:this.XLObj._getLocStr(p),content:"<h6>"+b+"<\/h6>"}}},_splitBeforeOpen:function(t,i){var r=this.XLObj,u;t==="Home_Editing_SortFilter"?this._sfbeforeOpen(i):t==="Others_Cells_InsertCellOptions"||t==="Others_Cells_DeleteCellOptions"?this._insdelbeforOpen(i):t==="Others_Window_FreezePanes"?this._fpbeforeOpen(i):t==="ChartDesign_ChartLayouts_AddChartElement"?this._celementpbeforeOpen(i):t==="Data_DataTools_DataValidationOptions"||t==="Home_Clipboard_PasteOptions"?this._validpasteOpen(i):t==="Home_Editing_Clear"?this._clearbeforeOpen(i):t==="Home_Styles_FormatAsTable"?(u=document.getElementById(r._id+"_formatastable"),u&&(!u||u.children.length)||this._renderFormatAsTable(),r.XLFormat._resizeFormatTableMenu()):t==="Home_Styles_CellStyles"?r.XLFormat._resizeStyleMenu():t==="Home_Font_Border"?r.XLFormat._resizeBorderMenu(i):t==="Home_Styles_ConditionalFormatting"&&(r._phoneMode?n("#"+r._id+"_CFormat").find("ul").addClass("e-adaptive"):n("#"+r._id+"_CFormat").find("ul").removeClass("e-adaptive"))},_splitbtnClose:function(n){this.XLObj.element.find("#"+this.XLObj._id+"_Ribbon_"+n).parents("div.e-controlpadding").siblings().children("button").removeClass("e-active")},_fpbeforeOpen:function(){var i=this.XLObj,r=n("#"+i._id+"_Ribbon_FPane").data("ejMenu"),t=r.model.fields.dataSource.slice(0);i.getSheet()._isFreezed?(t[0].id="UnFreezePanes",t[0].text=i._getLocStr("UnFreezePanes")):(t[0].id="freezePanes",t[0].text=i._getLocStr("FreezePanes"));r.option("fields",{id:"id",dataSource:t,parentId:"parentId"})},_sfbeforeOpen:function(){var t=this.XLObj,i=n("#"+t._id+"_Ribbon_SortFilter").data("ejMenu");t.model.allowFiltering||i.disableItemByID("Ribbon_Filter");t.model.allowSorting||(i.disableItemByID("Ribbon_SortAtoZ"),i.disableItemByID("Ribbon_SortZtoA"));this._refreshRibbonIcons()},_validpasteOpen:function(n){var t=this.XLObj;n.model.targetID===t._id+"_Ribbon_Validation"?t.element.find("#"+t._id+"_Ribbon_Data_DataTools_DataValidation").addClass("e-active"):t.element.find("#"+t._id+"_Ribbon_Home_Clipboard_Paste").addClass("e-active")},_insdelbeforOpen:function(t){var i=this.XLObj,r=n("#"+i._id+"_Ribbon_Ins").data("ejMenu"),u=n("#"+i._id+"_Ribbon_Del").data("ejMenu"),h=["DeleteCells","DeleteSheetRows","DeleteSheetColumns"],c=["InsertCells","InsertSheetRows","InsertSheetColumns"],e,o,s,f;if(t.model.targetID===i._id+"_Ribbon_Ins"?i.element.find("#"+i._id+"_Ribbon_Others_Cells_InsertCell").addClass("e-active"):i.element.find("#"+i._id+"_Ribbon_Others_Cells_DeleteCell").addClass("e-active"),e=i.element.find(".e-colselected").length?"disableItemByID":"enableItemByID",r&&r[e]("InsertSheetRows"),u&&u[e]("DeleteSheetRows"),o=i.element.find(".e-rowselected").length?"disableItemByID":"enableItemByID",r&&r[o]("InsertSheetColumns"),u&&u[o]("DeleteSheetColumns"),s=i.model.exportSettings.password?"disableItemByID":"enableItemByID",r&&r[s]("InsertSheet"),u&&u[s]("DeleteSheet"),i.getSheet(i.getActiveSheetIndex()).isSheetProtected)for(f=0;f<3;f++)u&&u.disableItemByID(h[f]),r&&r.disableItemByID(c[f]);else u&&u.enableItemByID("DeleteCells"),r&&r.enableItemByID("InsertCells")},_celementpbeforeOpen:function(){var t=this.XLObj;if(chartEle=n("#"+t._id+"_chart").val(),chType=t.XLChart._getShapeObj(chartEle,"chart").type,cEleMenuObj=n("#"+t._id+"_Ribbon_CElement").data("ejMenu"),pieChart=["Axes","AxisTitle","Gridline"],radarChart=["AxisTitle","PMinorH","PMinorV"],menuEle=["Axes","AxisTitle","Gridline","PMinorH","PMinorV"],i,len=0,cEleMenuObj)return!1;for(i=0,len=menuEle.length;i<len;i++)cEleMenuObj.enableItemByID(menuEle[i]);if(chType==="pie"||chType==="doughnut")for(i=0,len=pieChart.length;i<len;i++)cEleMenuObj.disableItemByID(pieChart[i]);else if(chType==="radar")for(i=0,len=radarChart.length;i<len;i++)cEleMenuObj.disableItemByID(radarChart[i])},_clearbeforeOpen:function(){var i=this.XLObj,t=0,u=n("#"+i._id+"_Ribbon_Clear").data("ejMenu"),r=["Clear_Hyperlinks","Clear_Comments"];if(i.model.allowLockCell)if(i.getSheet(i.getActiveSheetIndex()).isSheetProtected)while(t<r.length)u.disableItemByID(r[t]),t++;else while(t<r.length)u.enableItemByID(r[t]),t++},_changeClrFltrStatus:function(n,t){var i=this.XLObj,r=i.getActiveSheetIndex();i.isUndefined(n)||(this._isFilterSelect.isFiltered?t==="menu"?n._id.indexOf("Ribbon")>-1?n.enableItemByID("Ribbon_ClearFilter"):n.enableItemByID("ClearFilter"):n.enable():t==="menu"?n._id.indexOf("Ribbon")>-1?n.disableItemByID("Ribbon_ClearFilter"):n.disableItemByID("ClearFilter"):n.disable())},_onControlCreated:function(){this._ctrlCreated=!0;xlRbn=n("#"+this.XLObj._id+"_Ribbon").ejRibbon("instance");this.XLObj.model.ribbonSettings.enableOnDemand||(this._homeTabControls(),this._othersTabControls(),this._pageTabControls(),this._appTabControls());this._hideTabs();this._ctrlCreated=!1},_appTabControls:function(){var r=this.XLObj,u=r.element,i=r._id,t={height:158,width:163,text:r._getLocStr("BlankWorkbook"),contentType:"textandimage",imagePosition:"imagetop",prefixIcon:"e-ss-blank",click:n.proxy(this._onBackStageItemClick,this)};n("#"+i+"_bstab_new_blank").ejButton(t);delete t.text;t.height=t.width=72;t.prefixIcon="e-icon e-ss-exportxl";n("#"+i+"_bstab_saveas_excel").ejButton(t);t.prefixIcon="e-icon e-ss-exportcsv";n("#"+i+"_bstab_saveas_csv").ejButton(t);t.prefixIcon="e-icon e-ss-exportpdf";n("#"+i+"_bstab_saveas_pdf").ejButton(t);t.prefixIcon="e-icon e-ss-print";n("#"+i+"_bstab_print_sheet").ejButton(t);t.prefixIcon="e-icon e-ss-printselected";n("#"+i+"_bstab_print_selected").ejButton(t)},_othersTabControls:function(){var n=this.XLObj;!n.model.allowInsert&&n.model.scrollSettings.allowScrolling&&(this._disableButtons(["Others_Cells_InsertCellOptions"],"ejSplitButton"),this._disableButtons(["Others_Cells_InsertCell"],"ejButton"));!n.model.allowDelete&&n.model.scrollSettings.allowScrolling&&(this._disableButtons(["Others_Cells_DeleteCellOptions"],"ejSplitButton"),this._disableButtons(["Others_Cells_DeleteCell"],"ejButton"))},_pageTabControls:function(){var t=this.XLObj,r=t._id,i=r+"_Ribbon_pagesetup",u=r+"_Ribbon_PageLayout_Show_";n("#"+i+"left").show();n("#"+u+"Headings").ejCheckBox({change:this._ribbonClickHandler,checked:!0});n("#"+u+"Gridlines").ejCheckBox({change:this._ribbonClickHandler,checked:!0});n("#"+i+"_viewhdrlbl").text(t._getLocStr("Heading"));n("#"+i+"_viewgrdlnlbl").text(t._getLocStr("Gridlines"))},_homeTabControls:function(){var u=this.XLObj,i=u._id,f=u.element,r=i+"_Ribbon_",t=r+"Home_Font_";n("#"+t+"FillColor").ejColorPicker({value:"#FFFF00",modelType:"palette",showSwitcher:!1,cssClass:"e-ss-colorpicker",toolIcon:"e-ss-backgroundcolor",open:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FillColor"),change:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FillColor"),select:n.proxy(this._cpClickHandler,this,"Ribbon_Home_Font_FillColor")});n("#"+t+"FontColor").ejColorPicker({value:"#FF0000",modelType:"palette",showSwitcher:!1,cssClass:"e-ss-colorpicker",toolIcon:"e-ss-fontcolor",open:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FontColor"),change:n.proxy(this._colorPickerHandler,this,"Ribbon_Home_Font_FontColor"),select:n.proxy(this._cpClickHandler,this,"Ribbon_Home_Font_FontColor")});n("#"+t+"BorderColor").ejColorPicker({modelType:"palette",presetType:"basic",cssClass:"e-ss-colorpicker e-ss-menuclrpkr",change:this._ribbonClickHandler});n("#"+t+"BorderColorWrapper").hide();n("#"+i+"_bordercolor ul li").find("a").remove();n("#"+i+"_bordercolor ul li").append(n("#"+t+"BorderColor_popup"));n("#"+t+"BorderColor_popup").css({display:"block"});n("#"+r+"BorderCP").ejColorPicker({value:"#278787",displayInline:!0,modelType:"picker"});n("#"+r+"BorderCP_Presets").hide();n("#"+i+"_CFormat").width(200);n("#"+r+"Border").addClass("e-spreadsheet e-border");n("#"+t+"FontColor_Presets").css({top:"40px"});n("#"+t+"FillColor_Presets").css({top:"40px"});this._disableButtons(["Home_Clipboard_Paste"],"ejButton");this._disableButtons(["Home_Clipboard_PasteOptions","Others_Formulas_UseInFormula"],"ejSplitButton");n("#"+t+"FillColor_popup").find(".e-buttons, .e-button").hide();n("#"+t+"FontColor_popup").find(".e-buttons, .e-button").hide()},_hideRibbonElem:function(t){var f=this.XLObj,o=f._id,s=n("#"+f._id+"_Ribbon").data("ejRibbon"),i=f.model,r=s.element,u=o+"_Ribbon",y=u+"_home_Clipboard_Home_Clipboard_",e=u+"_home_Alignment_Home_Alignment_",p=u+"_separator_Home_Alignment_",a=u+"_home_Styles_Home_Styles_",b=u+"_home_Font_Home_Font_",k=u+"_home_Number_Home_Number_",w=u+"_home_Editing_Home_Editing_",h=u+"_insert_",v=u+"_data_",d=u+"_pagelayout_PageLayout",g=u+"_review_Changes_Review_Changes_",c=u+"_others_",l;i.allowFormulaBar||f.hideFormulaBar();switch(t){case f._getLocStr("HOME"):i.allowAutoSum||i.allowFiltering||i.allowUndoRedo||i.allowSorting||i.allowClipboard||i.allowFormatPainter||i.allowCellFormatting||i.allowMerging||i.allowWrap||i.allowConditionalFormats||i.allowFormatAsTable||s.hideTab(f._getLocStr("HOME"));i.allowFormatPainter||r.find("#"+y+"FormatPainter").hide();i.allowClipboard||(r.find("#"+u+"_home_Clipboard_1").hide(),r.find("#"+y+"Cut").hide(),r.find("#"+y+"Copy").hide());i.allowClipboard||i.allowFormatPainter||r.find("#"+u+"_home_Clipboard").hide();i.allowCellFormatting||(r.find("#"+u+"_home_Font").hide(),r.find("#"+u+"_home_Number").hide(),r.find("#"+e+"TopAlign").hide(),r.find("#"+e+"MiddleAlign").hide(),r.find("#"+e+"BottomAlign").hide(),r.find("#"+p+"BottomAlign").hide(),r.find("#"+e+"AlignLeft").hide(),r.find("#"+e+"AlignCenter").hide(),r.find("#"+e+"AlignRight").hide(),r.find("#"+p+"AlignRight").hide(),r.find("#"+e+"DecreaseIndent").hide(),r.find("#"+e+"IncreaseIndent").hide(),r.find("#"+p+"IncreaseIndent").hide(),r.find("#"+a+"CellStyles").hide(),i.allowConditionalFormats||i.allowFormatAsTable||r.find("#"+u+"_home_Styles").hide());i.allowCellFormatting&&(i.formatSettings.allowFontFamily||r.find("#"+b+"FontFamily").hide(),i.formatSettings.allowDecimalPlaces||(r.find("#"+k+"IncreaseDecimal").hide(),r.find("#"+k+"DecreaseDecimal").hide(),r.find("#"+u+"_separator_Home_Number_CommaStyle").hide()),i.formatSettings.allowCellBorder||r.find("#"+b+"Border").hide());i.allowMerging||r.find("#"+e+"Merge").hide();i.allowWrap||r.find("#"+e+"WrapText").hide();i.allowUndoRedo||r.find("#"+u+"_home_Actions").hide();i.allowFormatAsTable||r.find("#"+a+"FormatAsTable").hide();i.allowConditionalFormats||i.allowFormatAsTable||i.allowCellFormatting||r.find("#"+u+"_home_Styles").hide();i.allowConditionalFormats||r.find("#"+a+"ConditionalFormatting").hide();i.allowEditing&&(i.allowAutoSum||r.find("#"+w+"AutoSum").hide(),i.allowSorting||i.allowFiltering||r.find("#"+f._id+"_Ribbon_home_Editing_1").hide());i.allowAutoSum||r.find("#"+w+"AutoSum").hide();i.allowClear||r.find("#"+w+"Clear").hide();break;case f._getLocStr("INSERT"):i.allowFormatAsTable||i.allowPictures||i.allowHyperlink||i.allowCharts||s.hideTab(f._getLocStr("INSERT"));i.enablePivotTable||i.allowFormatAsTable?i.enablePivotTable||r.find("#"+h+"Tables_Insert_Tables_PivotTable").hide():(r.find("#"+h+"Tables").hide(),r.find("#"+a+"FormatAsTable").hide(),r.find("#"+h+"Tables_Insert_Tables_PivotTable").hide());i.pictureSettings.allowPictures||r.find("#"+h+"Illustrations").hide();i.allowHyperlink||r.find("#"+h+"Links").hide();i.allowCharts||r.find("#"+h+"Charts").hide();i.allowFormatAsTable||i.enablePivotTable||r.find("#"+h+"Tables").hide();break;case f._getLocStr("DATATAB"):i.allowDataValidation||i.allowFiltering||i.allowSorting||s.hideTab(f._getLocStr("DATATAB"));i.allowFiltering||r.find("#"+v+"SortFilter_2").hide();i.allowSorting||r.find("#"+v+"SortFilter_1").hide();i.allowDataValidation||r.find("#"+v+"DataTools").hide();i.allowFiltering||i.allowSorting||r.find("#"+v+"Sort").hide();break;case f._getLocStr("PAGELAYOUT"):i.printSettings.allowPrinting||s.hideTab(f._getLocStr("PAGELAYOUT"));i.printSettings.allowPrinting||r.find("#"+d+"Print_Print").hide();i.printSettings.allowPageSize||r.find("#"+d).hide();i.allowComments||i.allowLockCell||s.hideTab(f._getLocStr("REVIEW"));i.allowLockCell||(r.find("#"+g+"ProtectSheet").hide(),r.find("#"+g+"LockCell").hide());i.allowComments||r.find("#"+u+"_review_Comments").hide();break;case f._getLocStr("OTHERS"):i.allowFreezing||i.allowInsert||i.allowDelete||i.allowSearching||s.hideTab(f._getLocStr("OTHERS"));i.allowInsert||i.allowDelete||r.find("#"+c+"Cells").hide();i.allowInsert||r.find("#"+c+"Cells_1").hide();i.allowDelete||r.find("#"+c+"Cells_2").hide();i.allowFreezing||(f._phoneMode?r.find("#"+c+"Window_1").hide():r.find("#"+c+"Window").hide());i.allowSearching||r.find("#"+c+"Editing").hide()}i.allowImport||r.find("#open_backStageTab").hide();i.serverEvents?(l=i.serverEvents,l.indexOf("excelExporting")<0&&!i.exportSettings.excelUrl&&r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").hide(),l.indexOf("csvExporting")<0&&!i.exportSettings.csvUrl&&r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").hide(),l.indexOf("pdfExporting")<0&&!i.exportSettings.pdfUrl&&r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").hide(),l.length||i.exportSettings.excelUrl||i.exportSettings.csvUrl||i.exportSettings.pdfUrl||r.find("#saveas_backStageTab").hide()):(i.exportSettings.excelUrl||r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(0)").hide(),i.exportSettings.csvUrl||r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(1)").hide(),i.exportSettings.pdfUrl||r.find("#"+o+"_backstagetabsaveas .e-ssr-bssaveasopt:eq(2)").hide(),i.exportSettings.allowExporting&&(i.exportSettings.excelUrl||i.exportSettings.csvUrl||i.exportSettings.pdfUrl)||r.find("#saveas_backStageTab").hide());i.printSettings.allowPrinting||r.find("#print_backStageTab").hide()},_pictureSizeChange:function(t,i){var u=this.XLObj,f,o=u.getActiveSheetIndex(),r=u.getSheetElement(o).find(".e-ss-activeimg"),e={sheetIndex:o,reqType:"shape",shapeType:"picture",action:"picturesize",name:t,id:n(r).attr("id"),prev:{},cur:{}};u._shapeChange||this._isSetModel||(e.prev={width:r.width(),height:r.height()},t==="PictureHeight"?(f=parseInt(r.height()*i.value/r.width()),r.css({width:i.value,height:f}),e.cur={width:i.value,height:f}):(f=parseInt(r.width()*i.value/r.height()),r.css({height:i.value,width:f}),e.cur={height:i.value,width:f}),this._isSetModel=!0,n("#"+u._id+"_Ribbon_Format_Size_"+t).ejNumericTextbox("option",{value:f}),this._isSetModel=!1,u._completeAction(e),u._trigActionComplete(e),u.XLShape._updateShapeObj(r[0]))},_chartTypeOk:function(){var i=this.XLObj,o=i.element.find("#"+i._id+"_chart").val(),u=n("#"+o).data("ejChart"),f,t,e,s,h,r;e=n("#"+i._id+"_allchart").find(".e-chartselect:eq(0)").attr("class").split(" ")[1];t=e.split("e-dlg")[1].split("chart");s=["e-dlgcolumnchart4","e-dlgcolumnchart5","e-dlgcolumnchart6","e-dlgbarchart4","e-dlgbarchart5","e-dlgbarchart6","e-dlgpiechart2"];h=["e-dlgstockchart2","e-dlglinechart2","dlgradarchart2"];r={type:t[0],enable3D:!1,marker:{visible:!1}};(t[0]==="column"||t[0]==="bar"||t[0]==="area")&&(t[1]==="1"||t[1]==="4"?r.type=t[0]:t[1]==="2"||t[1]==="5"?r.type="stacking"+t[0]:(t[1]==="3"||t[1]==="6")&&(r.type="stacking"+t[0]+"100"));s.indexOf(e)>-1&&(r.enable3D=!0);h.indexOf(e)>-1&&(r.marker={visible:!0});e==="e-dlgpiechart3"&&(r.type="doughnut");f={sheetIndex:i.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:"chartType",chartId:o};f.prev={chartType:u.model.series[0].type,enable3D:u.model.enable3D,marker:u.model.series[0].marker.visible};i.XLChart.refreshChart(o,r);f.cur={chartType:u.model.series[0].type,enable3D:u.model.enable3D,marker:u.model.series[0].marker.visible};n("#"+i._id+"_charttypedlg").ejDialog("close");i._completeAction(f);i._trigActionComplete(f)},_chartTypeCancel:function(){var t=this.XLObj;n("#"+t._id+"_charttypedlg").ejDialog("close");t.setSheetFocus()},_chartType:function(t,i,r,u,f,e){for(var v,y,l,c,a,p="<div class='e-chartheader'><span>",s="<div class='e-chartcontent'<\/div>",w=t.toLowerCase(),b={visible:!1},h=this.XLObj,k=h._getLocStr(t).split("/"),o=0;o<i;o++)v="<div class='e-"+h._id+" e-chartcell e-"+w+(o+1)+"' title="+h._getLocStr(e[o])+"><\/div>",s+=v,o===r&&(s+="<\/div>"+p+k[1]+"<\/span><\/div><div class='e-chartcontent'<\/div>");for(c=n("<div id="+h._id+"_Ribbon_"+t+" class='e-ss-dialog e-ss-chart e-ss-"+h._id+"' style='height:auto;'>"+p+k[0]+"<\/span><\/div>"+s+"<\/div>"),y=c.find(".e-chartcell"),o=0;o<i;o++)l=n(y[o]),a=f[o],l.data({type:a,enable3D:!1,marker:b}),o>u&&l.data({type:a,enable3D:!0,marker:b});s=n(c).find(".e-"+w+"2");(t==="StockChart"||t==="LineChart")&&s.data({marker:{visible:!0}});t==="PieChart"&&s.data({enable3D:!0});h.element[0].appendChild(c[0])},autoSum:function(i,r){var nt;if(this.XLObj.model.allowAutoSum){var f=this.XLObj,b=f.XLEdit,s=f.getActiveSheetIndex(),k=f.getActiveCell(s),tt=!1,a;if(!t.isNullOrUndefined(k)){var l,d,y=f.getActiveCell(s),p,g=f._getRangeArgs(r,"object"),o=f._getSelectedCells(s,g).selCells,c=o.length-1,it=o[c].rowIndex-o[0].rowIndex,rt=o[c].colIndex-o[0].colIndex,v={sheetIndex:s,range:r,reqType:"auto-sum",oprType:i,updCell:[]},u,e,w,ut=f.getRangeData({range:[o[0].rowIndex,o[0].colIndex,o[c].rowIndex,o[c].colIndex],valueOnly:!0}).length,h=f._dataContainer.sheets[s];if(c!==0&&ut)if(it===0&&rt>0){for(p=f._getAlphaRange(s,o[0].rowIndex,o[0].colIndex,o[c].rowIndex,o[c].colIndex),u=o[c].rowIndex,e=o[c].colIndex+1,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2");!t.isNullOrUndefined(a)&&a!="";)e++,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2");e===f.getSheet(s).colCount&&f.XLScroll._createNewColumn(s,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"insert");f._isUndoRedo||v.updCell.push({rowIndex:u,colIndex:e,pObj:{},pValue:t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,e,"value2"))?"":f.XLEdit.getPropertyValue(u,e,"value2")});t.isNullOrUndefined(h[u])&&(h[u]={});t.isNullOrUndefined(h[u][e])&&(h[u][e]={});f._isUndoRedo||n.extend(!0,v.updCell[0].pObj,h[u][e]);f._isRowViewable(s,u)&&(w=f.getCell(u,e,s),w.addClass("e-ralign"));b._updateCellValue({rowIndex:u,colIndex:e},"="+i+"("+p+")");"COUNT".indexOf(i)<0&&f._autosumFormatUpdate(f.getRangeData({range:[o[0].rowIndex,o[0].colIndex,o[0].rowIndex,o[0].colIndex]})[0],[u,e,u,e],!1,!1)}else{for(d=o[c].colIndex-o[0].colIndex,u=o[c].rowIndex+1,l=0;l<=d;l++)for(e=o[l].colIndex,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2"),nt=u;!t.isNullOrUndefined(a)&&a!="";)u++,nt=u,a=this.XLObj.XLEdit.getPropertyValue(u,e,"value2");for(l=0;l<=d;l++)e=o[l].colIndex,u=nt,p=f._getAlphaRange(s,o[0].rowIndex,e,o[c].rowIndex,e),o[c].rowIndex===f.getSheet(s).rowCount-1&&f.XLScroll._createNewRow(s,-1,-1,"insert"),f._isUndoRedo||v.updCell.push({rowIndex:u,colIndex:e,pObj:{},pValue:t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,e,"value2"))?"":f.XLEdit.getPropertyValue(u,e,"value2")}),t.isNullOrUndefined(h[u])&&(h[u]={}),t.isNullOrUndefined(h[u][e])&&(h[u][e]={}),f._isUndoRedo||n.extend(!0,v.updCell[l].pObj,h[u][e]),f._isRowViewable(s,u)&&(w=f.getCell(u,e,s),w.addClass("e-ralign")),b._updateCellValue({rowIndex:u,colIndex:e},"="+i+"("+p+")"),"COUNT".indexOf(i)<0&&f._autosumFormatUpdate(f.getRangeData({range:[o[0].rowIndex,o[l].colIndex,o[0].rowIndex,o[l].colIndex]})[0],[u,e,u,e],!1,!1)}else u=k.rowIndex,e=k.colIndex,v.updCell.push({rowIndex:u,colIndex:e,pObj:{},pValue:t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,e,"value2"))?"":f.XLEdit.getPropertyValue(u,e,"value2")}),t.isNullOrUndefined(h[u])&&(h[u]={}),t.isNullOrUndefined(h[u][e])&&(h[u][e]={}),n.extend(!0,v.updCell[0].pObj,h[u][e]),f._isRowViewable(s,y.rowIndex)||f.XLScroll._scrollSelectedPosition(s,y),b.editCell(y.rowIndex,y.colIndex,!0),f.model.allowFormulaBar&&f._getInputBox().val("="+i+"()"),f._isRowViewable(s,u)&&(f.XLEdit._editElem.text("="+i+"()"),f.XLEdit._editElem.focusEnd()),tt=!0;f.performSelection({rowIndex:g[0],colIndex:g[1]},{rowIndex:u,colIndex:e});f._isUndoRedo||tt||(f._completeAction(v),f._trigActionComplete(v))}}},_openNameManagerDlg:function(){var i=this.XLObj,t;i._showDialog(i._id+"_Ribbon_Others_NameManager");t=n("#"+i._id+"_nmgrid").data("ejGrid");t.getContentTable().find("td").addClass("e-ss-emptyrecord");t.model.dataSource.length<1?t.getContentTable().find("td").addClass("e-ss-emptyrecord"):t.getContentTable().find(".e-ss-emptyrecord").removeClass("e-ss-emptyrecord");this._refreshNMDlg();i._browserDetails.name=="msie"&&t.refreshContent();n("#"+i._id+"_nmgrid").focus()},_openFATDlg:function(){var t=this.XLObj;n("#"+t._id+"_fatnamedlg").ejDialog("open");n("#"+t._id+"_fatheader").ejCheckBox("option","checked",!1);n("#"+t._id+"_fatname").val("Table"+t._tableCnt).focus().setInputPos(n("#"+t._id+"_fatname").val().length)},_dirtySelect:function(){var e=this.XLObj,y=e.getActiveSheetIndex(),n,i=e.getSheet(y).filterSettings.tableRange,b=!1,r=!1,p=!1,h=!1,c=!1,l=!1,w=!1,o=!1,s=!1,u=!1,f=!1,k=-2,a=!1,v=!1,t,d;if(!e.model.allowLockCell||!e.getSheet(y).isSheetProtected){if(n=e.getSheet(y)._selectedCells,n.length>0)for(t=0,d=i.length;t<d;t++){if(f=o=h=c=a=!1,u=s=l=w=v=!1,i[t].startRow-1<=n[0].rowIndex&&i[t].endRow>=n[n.length-1].rowIndex?f=!0:i[t].startRow-1>n[0].rowIndex&&n[n.length-1].rowIndex>=i[t].startRow-1&&i[t].endRow>=n[n.length-1].rowIndex?o=!0:i[t].startRow-1<=n[0].rowIndex&&n[0].rowIndex<=i[t].endRow&&i[t].endRow<n[n.length-1].rowIndex?o=!0:i[t].startRow-1>n[n.length-1].rowIndex?h=!0:i[t].endRow<n[0].rowIndex?c=!0:i[t].endRow<n[n.length-1].rowIndex&&i[t].startRow>n[0].rowIndex?a=!0:f=!1,i[t].multifilterIdx[0]<=n[0].colIndex&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]>=n[n.length-1].colIndex?u=!0:i[t].multifilterIdx[0]>n[0].colIndex&&n[n.length-1].colIndex>=i[t].multifilterIdx[0]&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]>=n[n.length-1].colIndex?s=!0:i[t].multifilterIdx[0]<=n[0].colIndex&&n[0].colIndex<=i[t].multifilterIdx[i[t].multifilterIdx.length-1]&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]<n[n.length-1].colIndex?s=!0:i[t].multifilterIdx[0]>n[n.length-1].colIndex?l=!0:i[t].multifilterIdx[i[t].multifilterIdx.length-1]<n[0].colIndex?w=!0:i[t].multifilterIdx[0]>n[0].colIndex&&i[t].multifilterIdx[i[t].multifilterIdx.length-1]<n[n.length-1].colIndex?v=!0:u=!1,(o&&s||o&&u||f&&s||o&&!w&&!l||s&&!h&&!c||a&&v||f&&v||u&&a)&&(r=!0,e.XLSelection._isRowSelected&&f&&(r=!1),e.XLSelection._isColSelected&&u&&(r=!1),r))break;if(!r){if(k=t,(h||c||l)&&(r=!1,b=!1),f&&u){p=!0;break}if(!f&&!u){b=!0;break}}}this._isDirtySelect=r;this._isMergeSelect=p||r;this._isFilterSelect={status:p,tableIdx:k,isFiltered:!1}}},_refreshRibbonIcons:function(){var t=this.XLObj,e=t.getActiveSheetIndex(),i=n("#"+t._id+"_contextMenuCell").data("ejMenu"),o=["Home_Editing_SortFilter","Home_Editing_Clear","Home_Styles_FormatAsTable"],s=["Insert_Tables_Table","Design_Tools_ConvertToRange","Data_SortFilter_Filter","Data_SortFilter_ClearFilter"],h=n("#"+t._id+"_Ribbon_Home_Alignment_Merge").data("ejSplitButton"),r,l,f,u,c;if(!t.XLEdit._isEdit&&t.getSheetElement(e).find(".e-ss-activeimg").length<1&&h&&h.option("enabled",!this._isMergeSelect),this._isDirtySelect?(this._disableButtons(o,"ejSplitButton"),this._disableButtons(s,"ejButton"),i&&i.disableItemByID("Sort")):t.XLEdit._isEdit||(this._enableButtons(o,"ejSplitButton"),this._enableButtons(s,"ejButton"),!t.model.isReadOnly&&i&&t.model.allowSorting&&i.enableItemByID("Sort")),r=t.getSheet(e).filterSettings.tableRange[this._isFilterSelect.tableIdx],this._isFilterSelect.status&&r){for(l=!1,f=r.multifilterIdx,u=0,c=f.length;u<c;u++)if(filterVal=t.XLEdit.getPropertyValue(r.startRow-1,f[u],"filterState"),filterVal&&filterVal.indexOf("filtered")>-1){this._isFilterSelect.isFiltered=!0;break}this._isFilterSelect.isFiltered?this._enableButtons(["Data_SortFilter_ClearFilter"],"ejButton"):this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton")}else this._disableButtons(["Data_SortFilter_ClearFilter"],"ejButton");this._isHomeTabCreate&&n("#"+t._id+"_Ribbon_SortFilter").ejMenu("disableItemByID","Ribbon_ClearFilter")},_onGroupExpander:function(n){var t=this.XLObj;if(!t.model.isReadOnly&&!t.XLEdit._isEdit)switch(n.target.id){case t._id+"_Ribbon_Number_e-groupexpander":t._showDialog(t._id+"_FormatCells")}},disableRibbonItems:function(n){var e=this.XLObj,i,u,r,f,t;if(!e.model.isReadOnly)for(r=0,f=n.length;r<f;r++){u=n[r].split("_")[2].toUpperCase();t=n[r].split("_Ribbon_")[1];do{switch(u){case"HOME":this._homeBtnIds.indexOf(t)>-1?(i="ejButton",this._homeBtnIds.splice(this._homeBtnIds.indexOf(t),1)):this._homeSptBtnIds.indexOf(t)>-1?(i="ejSplitButton",this._homeSptBtnIds.splice(this._homeSptBtnIds.indexOf(t),1)):this._homeToggleBtnIds.indexOf(t)>-1?(i="ejToggleButton",this._homeToggleBtnIds.splice(this._homeToggleBtnIds.indexOf(t),1)):this._homeDdIds.indexOf(t)>-1?(i="ejDropDownList",this._homeDdIds.splice(this._homeDdIds.indexOf(t),1)):this._homeCpIds.indexOf(t)>-1&&(i="ejColorPicker",this._homeCpIds.splice(this._homeCpIds.indexOf(t),1));break;case"INSERT":this._insertBtnIds.indexOf(t)>-1?(i="ejButton",this._insertBtnIds.splice(this._insertBtnIds.indexOf(t),1)):this._insertSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._insertSptBtnIds.splice(this._insertSptBtnIds.indexOf(t),1));break;case"DATA":this._dataBtnIds.indexOf(t)>-1?(i="ejButton",this._dataBtnIds.splice(this._dataBtnIds.indexOf(t),1)):this._dataSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._dataSptBtnIds.splice(this._dataSptBtnIds.indexOf(t),1));break;case"PAGELAYOUT":this._pageLayBtnIds.indexOf(t)>-1?(i="ejButton",this._pageLayBtnIds.splice(this._pageLayBtnIds.indexOf(t),1)):this._pageLaySptBtnIds.indexOf(t)>-1?(i="ejSplitButton",this._pageLaySptBtnIds.splice(this._pageLaySptBtnIds.indexOf(t),1)):this._pageLayChckBxIds.indexOf(t)>-1&&(i="ejCheckBox",this._pageLayChckBxIds.splice(this._pageLayChckBxIds.indexOf(t),1));break;case"REVIEW":this._cmntBtnIds.indexOf(t)>-1?(i="ejButton",this._cmntBtnIds.splice(this._cmntBtnIds.indexOf(t),1)):this._cmntTglBtnIds.indexOf(t)>-1?(i="ejToggleButton",this._cmntTglBtnIds.splice(this._cmntTglBtnIds.indexOf(t),1)):this._reviewTglBtnIds.indexOf(t)>-1&&(i="ejToggleButton",this._reviewTglBtnIds.splice(this._reviewTglBtnIds.indexOf(t),1));break;case"OTHERS":this._othersBtnIds.indexOf(t)>-1?(i="ejButton",this._othersBtnIds.splice(this._othersBtnIds.indexOf(t),1)):this._othersSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._othersSptBtnIds.splice(this._othersSptBtnIds.indexOf(t),1));break;case"FORMAT":this._formatBtnIds.indexOf(t)>-1?(i="ejButton",this._formatBtnIds.splice(this._formatBtnIds.indexOf(t),1)):this._formatSptBtnIds.indexOf(t)>-1&&(i="ejSplitButton",this._formatSptBtnIds.splice(this._formatSptBtnIds.indexOf(t),1));break;case"DESIGN":this._contextualBtnIds.indexOf(t)>-1?(i="ejButton",this._contextualBtnIds.splice(this._contextualBtnIds.indexOf(t),1)):this._contextualCheckBoxIds.indexOf(t)>-1?(i="ejCheckBox",this._contextualCheckBoxIds.splice(this._contextualCheckBoxIds.indexOf(t),1)):this._contextualInputIds.indexOf(t)>-1&&(i=!0);break;case"CHARTDESIGN":this._chartDesignBtnIds.indexOf(t)>-1?(i="ejButton",this._chartDesignBtnIds.splice(this._chartDesignBtnIds.indexOf(t),1)):this._chartDesignSptBtnIds.indexOf(t)>-1?(i="ejSplitButton",this._chartDesignSptBtnIds.splice(this._chartDesignSptBtnIds.indexOf(t),1)):this._chartDesignDdIds.indexOf(t)>-1&&(i="ejDropDownList",this._chartDesignDdIds.splice(this._chartDesignDdIds.indexOf(t),1))}this._disableButtons([t],i)}while((t==="PageLayout_PageLayout_PageSize"||t==="Home_Clipboard_Paste"||t==="Others_Cells_InsertCell"||t==="Others_Cells_DeleteCell"||t==="Data_DataTools_DataValidation")&&(t=t+"Options"))}},enableRibbonItems:function(n){for(var e=this.XLObj,i,u,t,r=0,f=n.length;r<f;r++){u=n[r].split("_")[2].toUpperCase();t=n[r].split("_Ribbon_")[1];do{switch(u){case"HOME":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._homeBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1?(i="ejSplitButton",this._homeSptBtnIds.push(t)):this.allToggleButtonIds.indexOf(t)>-1?(i="ejToggleButton",this._homeToggleBtnIds.push(t)):this.allDropDownIds.indexOf(t)>-1?(i="ejDropDownList",this._homeDdIds.push(t)):this.colorPickerIds.indexOf(t)>-1&&(i="ejColorPicker",this._homeCpIds.push(t));break;case"INSERT":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._insertBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._insertSptBtnIds.push(t));break;case"DATA":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._dataBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._dataSptBtnIds.push(t));break;case"PAGELAYOUT":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._pageLayBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1?(i="ejSplitButton",this._pageLaySptBtnIds.push(t)):this.checkBoxIds.indexOf(t)>-1&&(i="ejCheckBox",this._pageLayChckBxIds.push(t));break;case"REVIEW":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._cmntBtnIds.push(t)):this.allToggleButtonIds.indexOf(t)>-1&&n[r].split("_")[4]==="ShowAllComment"?(i="ejToggleButton",this._cmntTglBtnIds.push(t)):this.allToggleButtonIds.indexOf(t)>-1&&(i="ejToggleButton",this._reviewTglBtnIds.push(t));break;case"OTHERS":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._othersBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._othersSptBtnIds.push(t));break;case"FORMAT":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._formatBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1&&(i="ejSplitButton",this._formatSptBtnIds.push(t));break;case"DESIGN":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._contextualBtnIds.push(t)):this.checkBoxIds.indexOf(t)>-1?(i="ejCheckBox",this._contextualCheckBoxIds.push(t)):this._contextualInputIds.indexOf(t)>-1&&(i=!0);break;case"CHARTDESIGN":this.allButtonIds.indexOf(t)>-1?(i="ejButton",this._chartDesignBtnIds.push(t)):this.allSplitButtonIds.indexOf(t)>-1?(i="ejSplitButton",this._chartDesignSptBtnIds.push(t)):this.allDropDownIds.indexOf(t)>-1&&(i="ejDropDownList",this._chartDesignDdIds.push(t))}this._enableButtons([t],i)}while((t==="PageLayout_PageLayout_PageSize"||t==="Home_Clipboard_Paste"||t==="Others_Cells_InsertCell"||t==="Others_Cells_DeleteCell"||t==="Data_DataTools_DataValidation")&&(t=t+"Options"))}},_refreshFRDlg:function(){var t=this.XLObj;t._dlgWidth<365?(n("#"+t._id+"_Ribbon_lbFind").text("Find"),n("#"+t._id+"_Ribbon_lbReplace").text("Replace")):(n("#"+t._id+"_Ribbon_lbFind").text("Find What"),n("#"+t._id+"_Ribbon_lbReplace").text("Replace With"))},_refreshChartTypeDlg:function(){var t=this.XLObj;n("#"+t._id+"_charttypedlg").ejDialog("open");n("#"+t._id+"_chartdlg_allcharttab_list").ejListBox("refresh")},_refreshNMDlg:function(){var t=this.XLObj,i;n("#"+t._id+"_nmdlg").ejDialog("open");i=n("#"+t._id+"_nmgrid").data("ejGrid");i._refreshScroller({requestType:"refresh"})},_menuCustomize:function(){var r=this.XLObj,f=r._id,u=r.model.ribbonSettings.applicationTab,i=u.menuSettings;u.type==="menu"?(i.isAppend?this._fileMenuData=this._fileMenuData.concat(i.dataSource):i.dataSource.length&&(this._fileMenuData=[{id:"File",text:r._getLocStr("File"),parentId:null},].concat(i.dataSource)),this._appTabCollection={type:t.Ribbon.ApplicationTabType.Menu,menuItemID:f+"_Menu",menuSettings:{click:n.proxy(this._onBackStageItemClick,this),openOnClick:!1,fields:{dataSource:this._fileMenuData,id:"id",parentId:"parentId",text:"text",spriteCssClass:"sprite"}}}):i.isAppend?(this._renderAppTab(),this._appTabCollection.backstageSettings.pages=this._appTabCollection.backstageSettings.pages.concat(i.dataSource)):i.dataSource.length?this._appTabCollection={type:t.Ribbon.applicationTabType.backstage,backstageSettings:{text:r._getLocStr("File"),headerWidth:124,height:r._responsiveHeight,width:r.model.scrollSettings.width,pages:i.dataSource}}:this._renderAppTab()},_refreshBackstageHeight:function(){var n=this.XLObj,i=n.element.find("#"+n._id+"_Ribbon").data("ejRibbon"),r=n._isAutoWHMode?n._responsiveHeight:n._responsiveHeight-2;i.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&(i.setModel({applicationTab:{backstageSettings:{height:r,width:n._isAutoWHMode?n._responsiveWidth:n._responsiveWidth-2}}}),i.element.find(".e-responsivebackstagecontent .e-resbackstagecontent").css({height:r-(10+i.element.find(".e-backstagerestop").outerHeight())}))},hideMenu:function(){var t=this.XLObj;t.model.isReadOnly||(t.model.ribbonSettings.applicationTab.type==="menu"?n("#"+t._id+"_Menu").hide():t.element.find("#"+t._id+"_Ribbon").find(".e-backstagetab").hide())},showMenu:function(){var t=this.XLObj;t.model.isReadOnly||(t.model.ribbonSettings.applicationTab.type==="menu"?n("#"+t._id+"_Menu").show():t.element.find("#"+t._id+"_Ribbon").find(".e-backstagetab").show())},addTab:function(n,t,i){var r=this.XLObj;r.model.isReadOnly||r.element.find("#"+r._id+"_Ribbon").ejRibbon("addTab",n,t,i)},addTabGroup:function(n,t,i){var r=this.XLObj;r.model.isReadOnly||r.element.find("#"+r._id+"_Ribbon").ejRibbon("addTabGroup",n,t,i)},addContextualTabs:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+this.XLObj._id+"_Ribbon").ejRibbon("addContextualTabs",n,t)},removeTab:function(n,i){var r=this.XLObj,u;r.model.isReadOnly||(t.isNullOrUndefined(n)&&i?(u=r.element.find("#"+r._id+"_Ribbon .e-apptab"),u.length&&(u.find("a").empty(),u.find(".e-menu-wrap").remove(),u.hide(),r.element.find("#"+r._id+"_Ribbon_BackStage").remove())):r.element.find("#"+r._id+"_Ribbon").ejRibbon("removeTab",n))},removeTabGroup:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+i._id+"_Ribbon").ejRibbon("removeTabGroup",n,t)},addBackStageItem:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+i._id+"_Ribbon").ejRibbon("addBackStageItem",n,t)},removeBackStageItem:function(n){var t=this.XLObj;t.model.isReadOnly||t.element.find("#"+t._id+"_Ribbon").ejRibbon("removeBackStageItem",n)},updateBackStageItem:function(n,t){var i=this.XLObj;i.model.isReadOnly||i.element.find("#"+i._id+"_Ribbon").ejRibbon("updateBackStageItem",t,n)},removeMenuItem:function(t){var r=this.XLObj,i,u;r.model.isReadOnly||(i=n("#"+r._id+"_Menu"),u=i.data("ejMenu"),u.remove(["#"+i.find("li").eq(t).attr("id")]))},updateMenuItem:function(t,i){var f=this.XLObj,r,u;f.model.isReadOnly||(r=n("#"+f._id+"_Menu"),u=r.data("ejMenu"),u.insertBefore(t,"#"+r.find("li").eq(i).attr("id")),u.remove(["#"+r.find("li").eq(i+1).attr("id")]))},addMenuItem:function(t,i){var u=this.XLObj,r,f;u.model.isReadOnly||(r=n("#"+u._id+"_Menu"),f=r.data("ejMenu"),f.insertAfter(t,"#"+r.find("li").eq(i).attr("id")))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.freezepane=function(n){this.XLObj=n;this._hfreeze=null;this._vfreeze=null};t.spreadsheetFeatures.freezepane.prototype={_setHFreeze:function(n){this._hfreeze=n},_getHFreeze:function(){return this._hfreeze},_setVFreeze:function(n){this._vfreeze=n},_getVFreeze:function(){return this._vfreeze},_initFreeze:function(){var t,i,u="div",f="e-hide",r=this.XLObj,o=r.getSheet(),e=r.getMainPanel().find(".e-spreadsheet-list")[0];t=document.createElement(u);t.id=r._id+"_hfreeze";t.className="e-frow "+f;e.appendChild(t);this._setHFreeze(n(t));i=document.createElement(u);i.id=r._id+"_vfreeze";i.className="e-fcol "+f;e.appendChild(i);this._setVFreeze(n(i))},_refreshFreeze:function(){var u="px",r="e-hide",n=this.XLObj,i=n.getSheet(),t=this._getHFreeze()[0];t||this._initFreeze();n._isFrozen(n.getFrozenRows())?(n._removeClass(t,r),t.style.top=i._fDivTop,t.style.width=n.model._isActPanelVisible?n._getJSSheetContent(n.getActiveSheetIndex()).width()-(i.showHeadings?n._rowHeaderWidth:0)+10+u:i._vPortWth+(i.showHeadings?n._rowHeaderWidth:0)-4+u):n.addClass(t,r);t=this._getVFreeze()[0];n._isFrozen(n.getFrozenColumns())?(n._removeClass(t,r),t.style.left=i._fDivLeft,t.style.height=i._vPortHgt+(i.showHeadings?n._colHeaderHeight:0)-4+u):n.addClass(t,r)},freezeTopRow:function(){var n=this.XLObj.getSheet();(this.XLObj._isFrozen(n.frozenRows)||this.XLObj._isFrozen(n.frozenColumns))&&this.unfreezePanes();this._freeze(n._topRow.idx+1)},freezeLeftColumn:function(){var n=this.XLObj.getSheet();this.XLObj._isFrozen(n.frozenColumns)&&this.unfreezePanes();this._freeze(null,n._leftCol.idx+1)},freezeRows:function(n){var t=this.XLObj.getSheet();(this.XLObj._isFrozen(t.frozenRows)||this.XLObj._isFrozen(t.frozenColumns))&&this.unfreezePanes();this._freeze(n)},freezeColumns:function(n){var t=this.XLObj.getSheet();this.XLObj._isFrozen(t.frozenColumns)&&this.unfreezePanes();this._freeze(null,n)},freezePanes:function(n,t){var i,r=this.XLObj;r.isNumber(n)||(i=r._toIntrnlRange(n),n=i[0],t=i[1]);this._freeze(n,t)},unfreezePanes:function(){this._freeze();this._refreshSelection()},_freeze:function(n,i){var h,o,c,r,f,e,s=crefresh=!0,u=this.XLObj;u.model.allowFreezing&&(h="px",c="e-hide",r=u.getSheet(),e=this._getHFreeze()[0],t.isNullOrUndefined(n)?(o=u.getFrozenRows()+1,u._isFrozen(o-1)?(n=0,this._showFreezeRow(o-1,r._ftopRowIdx-1),u.model.scrollSettings.allowVirtualScrolling&&u.refreshContent(),u.addClass(e,c),r._isFreezed=!1):s=!1):((n===0||n<r._topRow.idx||n>r._bottomRow.idx)&&(n=u._getMidCell().rowIdx),f=u._getIdxWithOffset(n).yOffset,r._topRow.idx===n&&r._scrollTop!==f&&u.XLScroll._vScroller().scroll(f),u._removeClass(e,c),r._isFreezed=!0,e.style.top=r._fDivTop=f-r._scrollTop+(r.showHeadings?u._colHeaderHeight-2:0)+h,e.style.width=r._vPortWth+(r.showHeadings?u._rowHeaderWidth:0)-4+h,r._contScrollTop=r._scrollTop),s&&(r._ftopRowIdx=n,r._frozenHeight=u._getRowOffsetTop(r,n),r.paneTopLeftCell=u.getAlphaRange(n,r._fleftColIdx),u.setFrozenRows(n),r._frozenRows=n+1),e=this._getVFreeze()[0],t.isNullOrUndefined(i)?(o=u.getFrozenColumns()+1,u._isFrozen(o-1)?(i=0,this._showFreezeCol(o-1,r._fleftColIdx-1),u.addClass(e,c),r._isFreezed=!1):crefresh=!1):((i===0||i<r._leftCol.idx||i>r._rightCol.idx)&&(i=u._getMidCell().colIdx),f=u._getIdxWithOffset(null,i).xOffset,r._leftCol.idx===i&&r._scrollLeft!==f&&u.XLScroll._hScroller().scroll(f),f=f+(r.showHeadings?u._rowHeaderWidth:0)-1,u._removeClass(e,c),r._isFreezed=!0,e.style.left=r._fDivLeft=f-r._scrollLeft+h,e.style.height=r._vPortHgt+(r.showHeadings?u._colHeaderHeight:0)-4+h,r._contScrollLeft=r._scrollLeft),crefresh&&(r._fleftColIdx=i,r._frozenWidth=u._getColOffsetLeft(r,i),r.paneTopLeftCell=u.getAlphaRange(r._ftopRowIdx,i),u.setFrozenColumns(i),r._frozenColumns=i+1),(s||crefresh)&&(u.XLScroll._refreshScroller(null,null,s&&crefresh?"all":s?"vertical":"horizontal"),s&&u.XLScroll._vScroller().scroll(u._isFrozen(u.getFrozenRows())?0:r._contScrollTop),crefresh&&u.XLScroll._hScroller().scroll(u._isFrozen(u.getFrozenColumns())?0:r._contScrollLeft)))},_frozenScrollHandler:function(n){var o,f,h=0,r=this.XLObj,u=r.XLScroll,i=r.getSheet(),e=r.getActiveSheetIndex(),s=u._vScroller(e),c=u._hScroller(e);if(n.model.orientation===t.ScrollBar.Orientation.Vertical){if(n.reachedEnd=Math.ceil(parseFloat(s.element.find(".e-vhandle").css("top")))+Math.ceil(parseFloat(s.element.find(".e-vhandle").height()))>=s.element.find(".e-vhandlespace").height()-2,n.reachedEnd&&r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite){if(o=(n.scrollTop-i._scrollTop)/i.rowHeight,i._bottomRow.idx+o>=i.rowCount-1)if(r.model.scrollSettings.allowVirtualScrolling)for(i._virtualBlockCnt++,i.rowCount+=i._virtualBlockRowCnt;h<i._virtualBlockRowCnt;)i.rowsHeightCollection.push(i.rowHeight),h++;else r.XLScroll._scrollBottom(e);r.XLScroll._refreshScroller(e,"refresh","vertical")}u._isIntrnlScroll?(this._scrollFreeze(u._scrollIdx),u._scrollIdx=0,i._scrollTop=n.scrollTop):n.scrollTop==i._scrollTop||n.reachedEnd&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Infinite||(f=this._ensureFreezeScrollPos(n),r.isUndefined(f.resetTo)?(this._scrollFreeze(f.rowIdx),i._scrollTop=n.scrollTop):(u._isIntrnlScroll=!0,u._scrollIdx=f.rowIdx,u._vScroller().scroll(f.resetTo),u._isIntrnlScroll=!1))}else n.reachedEnd=Math.ceil(parseFloat(c.element.find(".e-hhandle").css("left")))+Math.ceil(parseFloat(c.element.find(".e-hhandle").width()))>=r.element.find(".e-hhandlespace").width()-2,o=(n.scrollLeft-i._scrollLeft)/i.columnWidth,(n.reachedEnd||r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&i._rightCol.idx+o>=i.colCount-1)&&(r.XLScroll._scrollRight(e),r.XLScroll._refreshScroller(e,"refresh","horizontal")),u._isIntrnlScroll?(this._scrollFreeze(null,u._scrollIdx),u._scrollIdx=0,i._scrollLeft=n.scrollLeft):n.scrollLeft==i._scrollLeft||n.reachedEnd&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Infinite||(f=this._ensureFreezeScrollPos(n),r.isUndefined(f.resetTo)?(this._scrollFreeze(null,f.colIdx),i._scrollLeft=n.scrollLeft):(u._isIntrnlScroll=!0,u._scrollIdx=f.colIdx,u._hScroller().scroll(f.resetTo),u._isIntrnlScroll=!1));r.model.allowComments&&r.XLComment._updateCmntArrowPos()},_ensureFreezeScrollPos:function(n){var i,r={},e=[t.Spreadsheet.HideTypes.Freeze],f=this.XLObj,u=f.getSheet();return n.model.orientation===t.ScrollBar.Orientation.Vertical?(i=n.scrollTop+u._frozenHeight,retVal=f._getIdxWithOffset(i,null,!0,e),r.rowIdx=retVal.rowIdx,i!==retVal.yOffset&&(r.resetTo=retVal.yOffset-u._frozenHeight)):(i=n.scrollLeft+u._frozenWidth,retVal=f._getIdxWithOffset(null,i,!0,e),r.colIdx=retVal.colIdx,i!==retVal.xOffset&&(r.resetTo=retVal.xOffset-u._frozenWidth)),r},_scrollFreeze:function(n,t){var r,u=this.XLObj,i=u.getSheet();n&&i._ftopRowIdx!==n?(i._ftopRowIdx<n?(r=n-i._ftopRowIdx==1?i._ftopRowIdx:n-1,this._hideFreezeRow(i._ftopRowIdx,r),this._refreshShape(i._ftopRowIdx,r,!0)):(r=i._ftopRowIdx-n==1?n:i._ftopRowIdx-1,this._showFreezeRow(n,r),this._refreshShape(n,r,!0)),u.model.scrollSettings.allowVirtualScrolling&&u.refreshContent(),i._ftopRowIdx=n,i.paneTopLeftCell=u.getAlphaRange(n,i._fleftColIdx)):t&&i._fleftColIdx!==t&&(i._fleftColIdx<t?(r=t-i._fleftColIdx==1?i._fleftColIdx:t-1,this._hideFreezeCol(i._fleftColIdx,r),this._refreshShape(i._fleftColIdx,r)):(r=i._fleftColIdx-t==1?t:i._fleftColIdx-1,this._showFreezeCol(t,r),this._refreshShape(t,r)),i._fleftColIdx=t,i.paneTopLeftCell=u.getAlphaRange(i._ftopRowIdx,t));this._refreshSelection()},_refreshShape:function(t,i,r){var u,f,h,o,c,l,v,s=this.XLObj,p=s.getActiveSheetIndex(),e=s.getSheet(p),a=e.shapeMngr,y=e.pivotMngr;for(v=r?[t,0,i,e.colCount]:[0,t,e.rowCount,i],f=s.getRangeData({range:v,property:["picture","chart"]}),u=0;u<f.length;u++)f[u].picture&&(c=f[u].picture[s.getObjectLength(f[u].picture)],o=r?a.picture[c].rowIndex:a.picture[c].colIndex,this._freezeShape(n("#"+c)[0],r?e._hiddenFreezeRows.indexOf(o)>-1:e._hiddenFreezeCols.indexOf(o)>-1)),f[u].chart&&(h=f[u].chart[s.getObjectLength(f[u].chart)],o=r?a.chart[h].rowIndex:a.chart[h].colIndex,this._freezeShape(n("#"+h)[0],r?e._hiddenFreezeRows.indexOf(o)>-1:e._hiddenFreezeCols.indexOf(o)>-1)),f[u].pivot&&(l=f[u].pivot[s.getObjectLength(f[u].pivot)],o=r?y.pivot[l].rowIndex:y.pivot[l].colIndex,this._freezeShape(n("#"+l)[0],r?e._hiddenFreezeRows.indexOf(o)>-1:e._hiddenFreezeCols.indexOf(o)>-1))},_freezeShape:function(n,t){var i=this.XLObj;t?i.addClass(n,"e-hide"):i._removeClass(n,"e-hide")},_hideFreezeRow:function(n,t){for(var r,i=this.XLObj,e=i.model.scrollSettings,h=e.allowScrolling&&e.allowVirtualScrolling,u=i.getActiveSheetIndex(),o=i.getRows(u),c=o[0],l=o[1],f=i.getSheet(u),s=f.usedRange;n<=t;){for(r=0,f._hiddenFreezeRows.indexOf(n)===-1&&f._hiddenFreezeRows.push(n),!h&&i._isRowViewable(u,n)&&(i.addClass(l[n],"e-r-hide"),i.addClass(c[n],"e-r-hide"));r<s.colIndex;)i.XLCellNav._isMergedCell({rowIndex:n,colIndex:r})&&(i._refreshSHMergeCells(u,[n],1,"row","hide"),r=s.colIndex),r++;n++}},_showFreezeRow:function(n,t){for(var u,r,i=this.XLObj,o=i.model.scrollSettings,c=o.allowScrolling&&o.allowVirtualScrolling,f=i.getActiveSheetIndex(),s=i.getRows(f),l=s[0],a=s[1],e=i.getSheet(),h=e.usedRange;n<=t;){if(r=0,u=e._hiddenFreezeRows.indexOf(n),i.model.allowFiltering&&(isFHide=this._refreshFiltering(n)),u>-1)for(e._hiddenFreezeRows.splice(u,1),c||!i._isRowViewable(f,n)||isFHide||(i._removeClass(a[n],"e-r-hide"),i._removeClass(l[n],"e-r-hide"));r<h.colIndex;)i.XLCellNav._isMergedCell({rowIndex:n,colIndex:r})&&(i._refreshSHMergeCells(f,[n],1,"row","show"),r=h.colIndex),r++;n++}},_refreshFiltering:function(n){var i=this.XLObj,u=i.getActiveSheetIndex(),r=i.getSheet();return t.isNullOrUndefined(i.XLEdit.getPropertyValue(n,0,"isFilterHide",u))?!1:(r._filterHRowsColl.indexOf(n)===-1&&r._filterHRowsColl.push(n),!0)},_hideFreezeCol:function(n,t){for(var s,f,o="e-fcol-hide",i=n,r=this.XLObj,h=r.getActiveSheetIndex(),e=r.getSheet(),a=e.usedRange,c=r.model.scrollSettings.allowVirtualScrolling?e._virtualRowIdx:e._rowIdxColl,l=r._getJSSheetHeader(h),v=r._getContent(h),p=l.find("th"),w=l.find("col"),b=v.find("col"),y=l.find("table"),u=r._getWidth(n,t);i<=t;){for(f=0,e._hiddenFreezeCols.indexOf(i)===-1&&e._hiddenFreezeCols.push(i),r.addClass(p[i],o),r.addClass(w[i],o),r.addClass(b[i],o);f<a.rowIndex;)r.XLCellNav._isMergedCell({rowIndex:f,colIndex:i})&&(r._refreshSHMergeCells(h,[i],1,"column","hide"),f=a.rowIndex),f++;i++}if(s=r.getRange([c[0],n,c[c.length-1],t]),i=s.length,i)while(i--)r.addClass(s[i],o);u=y.width()-u;y.width(u);v.find(".e-table").width(u)},_getWidth:function(n,t){for(var i=0,r=this.XLObj.getSheet();n<=t;n++)i+=r.columnsWidthCollection[n];return i},_showFreezeCol:function(n,t){for(var o,f,e="e-fcol-hide",r=n,i=this.XLObj,h=i.getActiveSheetIndex(),u=i.getSheet(),c=i._getJSSheetHeader(h),a=i._getContent(h),y=c.find("th"),v=u.usedRange,l=i.model.scrollSettings.allowVirtualScrolling?u._virtualRowIdx:u._rowIdxColl,p=c.find("col"),w=a.find("col"),b=c.find("table"),s=i._getWidth(0,u.colCount-1)-(u._frozenColumns-1<n?i._getWidth(u._frozenColumns-1,n):0);r<=t;){for(f=0,o=u._hiddenFreezeCols.indexOf(r),o>-1&&(u._hiddenFreezeCols.splice(o,1),i._removeClass(y[r],e),i._removeClass(p[r],e),i._removeClass(w[r],e));f<v.rowIndex;)i.XLCellNav._isMergedCell({rowIndex:f,colIndex:r})&&(i._refreshSHMergeCells(h,[r],1,"column","show"),f=v.rowIndex),f++;r++}if(cells=i.getRange([l[0],n,l[l.length-1],t]),r=cells.length,r)while(r--)i._removeClass(cells[r],e);b.width(s);a.find(".e-table").width(s)},_refreshSelection:function(){var i,f,r,e,o=!1,u=this.XLObj,n=u.getSheet(),t=n.selectedRange,s=t[2],h=t[3],c=t[0],l=t[1];if(n._endCell.rowIndex+1>=n._frozenRows&&n._endCell.rowIndex<n._ftopRowIdx&&n._startCell.rowIndex<n._frozenRows-1)s=n._frozenRows-2,o=!0;else if(i=t[0],f=t[2],n._frozenRows-1<=i)while(i<=f)if(i<n._ftopRowIdx)i++;else{c=i;break}if(t[3]+1>=n._frozenColumns&&t[3]<n._fleftColIdx&&t[1]<n._frozenColumns-1)h=n._frozenColumns-2,o=!0;else if(r=t[1],e=t[3],n._frozenColumns-1<=r)while(r<=e)if(r<n._fleftColIdx)r++;else{l=r;break}i==f+1||r==e+1?u.XLSelection._hideShowSelElem("hide"):(u.XLSelection._refreshBorder([c,l,s,h]),o?u.addClass(u.getAutoFillElem()[0],"e-hide"):u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement())},_selectionScroll:function(){var i,r,u,f=hiddenWth=0,t=this.XLObj,n=t.getSheet(),e=t.getActiveSheetIndex();if(t._isFrozen(n.frozenRows))if(n._startCell.rowIndex+1<n._frozenRows&&n._endCell.rowIndex+1>n._frozenRows&&n.selectedRange[2]<n._ftopRowIdx){if(n._ftopRowIdx+1-n._frozenRows>0){for(r=n._endCell.rowIndex-n._ftopRowIdx,n._endCell.rowIndex=n._frozenRows-1+r,i=n._frozenRows-1;i<n._ftopRowIdx;i++)f+=n.rowsHeightCollection[i];t._scrollContent({y:-f})}}else n.selectedRange[2]-n._endCell.rowIndex>0&&n._ftopRowIdx>n._frozenRows-1&&!n._isColSelected&&n._endCell.rowIndex<n._frozenRows-1&&n.selectedRange[2]-n.selectedRange[0]>0&&n.selectedRange[2]>=n._ftopRowIdx-1&&(n._endCell.rowIndex=n._ftopRowIdx-1,u=t.getCell(n._frozenRows-2,n._endCell.colIndex)[0],t.XLSelection._scrollCalculation(e,u,{position:"vertical",action:"Decrement"}));if(t._isFrozen(n.frozenColumns))if(n._startCell.colIndex+1<n._frozenColumns&&n._endCell.colIndex+1>n._frozenColumns&&n.selectedRange[3]<n._fleftColIdx){if(n._fleftColIdx+1-n._frozenColumns>0){for(r=n._endCell.colIndex-n._fleftColIdx,n._endCell.colIndex=n._frozenColumns-1+r,i=n._frozenColumns-1;i<n._fleftColIdx;i++)hiddenWth+=n.columnsWidthCollection[i];t._scrollContent({x:-hiddenWth})}}else n.selectedRange[3]-n._endCell.colIndex>0&&n._fleftColIdx>n._frozenColumns-1&&!n._isRowSelected&&n._endCell.colIndex<n._frozenColumns-1&&n.selectedRange[3]-n.selectedRange[1]>0&&n.selectedRange[3]>=n._fleftColIdx-1&&(n._endCell.colIndex=n._fleftColIdx-1,u=t.getCell(n._frozenColumns-2,n._endCell.colIndex)[0],t.XLSelection._scrollCalculation(e,u,{position:"horizontal",action:"Decrement"}))},_refreshFColResize:function(n){var u,f="px",i=this.XLObj,s=i.getActiveSheetIndex(),t=i.getSheet(),e=i.getFrozenColumns()+1,h=this._getVFreeze()[0],r=t._frozenWidth,o=parseInt(this._getVFreeze()[0].style.left);i.XLScroll._getColWidths(s,n);t._frozenWidth=i._getColOffsetLeft(t,e-1);u=r>t._frozenWidth?r-t._frozenWidth:t._frozenWidth-r;n<e-1&&(h.style.left=t._fDivLeft=r>=t._frozenWidth?o-u+f:o+u+f)},_refreshFRowResize:function(n){var u,f="px",i=this.XLObj,s=i.getActiveSheetIndex(),t=i.getSheet(),e=i.getFrozenRows()+1,h=this._getHFreeze()[0],r=t._frozenHeight,o=parseInt(this._getHFreeze()[0].style.top);i.XLScroll._getRowHeights(s,n);t._frozenHeight=i._getRowOffsetTop(t,e-1);u=r>t._frozenHeight?r-t._frozenHeight:t._frozenHeight-r;n<e-1&&(h.style.top=t._fDivTop=r>=t._frozenHeight?o-u+f:o+u+f)},_refreshFreezeRowDiv:function(){var n=this.XLObj;sheet=n.getSheet();sheet._fDivTop=n._getIdxWithOffset(sheet._frozenRows-1).yOffset-sheet._contScrollTop+(sheet.showHeadings?n._colHeaderHeight-2:0)+"px";sheet._frozenHeight=n._getRowOffsetTop(sheet,sheet._frozenRows-1);this._refreshFreeze()},_refreshFreezeColDiv:function(){var n=this.XLObj;sheet=n.getSheet();sheet._fDivLeft=n._getColOffsetLeft(sheet,sheet._frozenColumns-1)-sheet._contScrollLeft+(sheet.showHeadings?n._rowHeaderWidth:0)-1+"px";sheet._frozenWidth=n._getColOffsetLeft(sheet,sheet._frozenColumns-1);this._refreshFreeze()}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.math={toFraction:function(n){if(this.isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this.getPlaceValue(t,i),f=this.getGcd(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},toExponential:function(n,t){if(this.isNumber(n)){var i,r=Number(n);return t=t||2,t>20&&(t=20),i=r.toExponential(t).split("e+"),i[0]+"E+"+this.padZeros(i[1])}return null},toAccounting:function(i,r,u){if(this.isNumber(r)&&i){var e,o,s=t.widgetBase.formatting(i,r,u),f=this._currencySymbol,h=n.trim(s.replace(f,"")),c=s.indexOf(f);!c||r<0&&c===1?(e=f,o=Number(r)?h:"-"):(e=Number(r)?h:"-",o=f);r=e+" "+o}return r},intToDate:function(n){return new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime())},getGcd:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this.getGcd(t,n%t)},isNumber:function(n){return n-parseFloat(n)>=0},isTime:function(n){return n?n.toString().indexOf(":")!==-1:!1},isFormula:function(n){var t,i;return n&&!n.toString().indexOf("=")&&n.length>1?(t=n.split("(").length-1,i=n.split(")").length-1,t===i):!1},getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},padZeros:function(n,i,r){return this.isNumber(n)?(i=this.isNumber(i)?i:2,r=t.isNullOrUndefined(t.Spreadsheet.autoFillDirection[r])?t.Spreadsheet.autoFillDirection.Left:t.Spreadsheet.autoFillDirection[r],r===t.Spreadsheet.autoFillDirection.Left?n<=this.maxValue(i)?Array(i-this.getDigits(n)+1).join("0")+n.toString():n.toString():n<this.minValue(i)?n.toString()+Array(i-this.getDigits(n)+1).join("0"):n.toString()):null},maxValue:function(n){return this.isNumber(n)?Number(Array(n+1).join("9")):null},minValue:function(n){return this.isNumber(n)?Number("1"+Array(n).join("0")):null},getDigits:function(n){return this.isNumber(n)?n.toString().length:null},_round:function(n,t){return Number(Math.round(n+"e"+t)+"e-"+t)},_parseTime:function(n){var u,t,i=0,r=3,f={},e;if(this.isTime(n))for(n=n.toString(),t=n.split(" "),u=t.length;i<u;){if(this.isTime(t[i]))for(e=t[i].split(":");r<6;)f[this._datePattern[r]]=e[r-3]||"0",r++;i++}return f},_dateToInt:function(n,t){var r=new Date("01/01/1900"),u=this._isDateTime(n)?n:new Date(n),f=u.getTime()-r.getTime(),i=f/864e5+2;return t?i%1:i},_defTimeFormat:function(n){return[n.getHours(),n.getMinutes(),n.getSeconds()].join(":")},_isDate:function(n){var i={};return t.isNullOrUndefined(t.parseDate(n.toString()))||(n=this._dateToInt(n.toString())),/^((0?[1-9]|1[012])[-.](0?[1-9]|[12][0-9]|3[01])[-.](19|20)?[0-9]{2})*$/.test(n.toString())?(n=n.toString().replace("-","/","g"),n=this._dateToInt(n.toString()),i.text=n,i.isDate=!0):(i.text=n,i.isDate=!1),i},_defDateFormat:function(n){return[n.getMonth()+1,n.getDate(),n.getFullYear()].join("/")},_isCellReference:function(n){return/^[a-z]{1,3}\d{1,7}$/gi.test(n)?"relative":/^\$[a-z]{1,3}\$\d{1,7}$/gi.test(n)?"absolute":/^((\$[a-z]{1,3})\d{1,7}|[a-z]{1,3}(\$\d{1,7}))$/gi.test(n)?"mixed":!1},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_decimalCnt:function(n){var t;return this.isNumber(n)&&(n=Number(n),t=n.toString(),t.indexOf(this._decimalSeparator)>-1)?(fixVal=n.toFixed(),t.length-fixVal.length-1):0},_getPosDiff:function(n,t){return n>t?n-t:t-n}}}(jQuery,Syncfusion),function(n,t,r){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.resizing=function(t){this.XLObj=t;this._$visualElem=n();this._currentHCell=-1;this._colMinWidth=15;this._rowMinHeight=20;this._allowStart=!1;this._resizeStart=!1;this._resizeType="";this._tableY=null;this._oldWidth=null;this._orgX=null;this._orgY=null;this._extra=null;this._initialTableWidth=null;this._resizeElt=null;this._tableX=null;this._oldHeight=null;this._initialTableHeight=null;this._resizerowId=0};t.spreadsheetFeatures.resizing.prototype={getColWidth:function(n){return this.XLObj.getSheet(this.XLObj.getActiveSheetIndex()).columnsWidthCollection[n]},getRowHeight:function(n){return this.XLObj.getSheet(this.XLObj.getActiveSheetIndex()).rowsHeightCollection[n]},setColWidth:function(n,t){if(this.XLObj.model.allowResizing){var i=this.XLObj.getActiveSheetIndex();this._currentHCell=n;this._resizeColumnUsingDiff(t,this.XLObj.getSheet(i).columnsWidthCollection[n],[n]);this.XLObj.XLScroll._getColWidths(i,n);this.XLObj.XLSelection.refreshSelection()}},setRowHeight:function(n,t){var r=this.XLObj,i;this.XLObj.model.allowResizing&&(i=this.XLObj.getActiveSheetIndex(),this._currentHCell=n,this._resizeRowUsingDiff(t,this.XLObj.getSheet(i).rowsHeightCollection[n],[n]))},_headerMouseDown:function(n){n.preventDefault();this._colMouseDown(n)},_colMouseDown:function(t){var u,r=this.XLObj,i={};if(u=r._setXY(t,navigator.userAgent.indexOf("WebKit")>-1),this._orgX=u[0]+document.documentElement.scrollLeft,this._orgY=u[1],r._isTouchEvt&&this._mouseHover(t),this._allowStart&&(n(t.target).css("cursor")==="col-resize"||r._isTouchEvt)){if(i.event=t,i.target=t.target,i.colIndex=this._currentHCell,i.oldWidth=t.target.getBoundingClientRect().width,i.reqType="column-resize",r._trigger("resizeStart",i))return;t.button!==2&&this._start(this._orgX,this._orgY);this._resizeType="Col";t.preventDefault()}},_mouseHover:function(t){var s,i=this.XLObj,r=t.target,c=i.getActiveSheetIndex(),o=i._getJSSheetHeader(c);if(!this._$visualElem.is(":visible")&&(i._hasClass(r,"e-headercelldiv")&&(r=r.parentNode),i._hasClass(r,"e-headercell"))){var e=r,u=e.getBoundingClientRect(),h=i._setXY(t),f=h[0],l=h[1];if(s=n(o.find(".e-table")[0]).width()+n(o.find(".e-columnheader")[0]).offset().left,(f>=u.left+document.documentElement.scrollLeft+e.offsetWidth-(i._isTouchEvt?15:5)||f<=u.left+(i._isTouchEvt?13:3))&&f<s&&f>=u.left&&l<=u.top+document.documentElement.scrollTop+r.offsetHeight){if(this._currentHCell=o.find(".e-headercell").index(e),this._currentHCell<1&&f<u.left+e.offsetWidth-(i._isTouchEvt?15:5)||this._preventColResize(this._currentHCell,!1))return;i.addClass(r,"e-ss-colresize");this._allowStart=!0}else i._removeClass(n(".e-ss-colresize")[0],"e-ss-colresize"),this._allowStart=!1,this._currentHCell=-1}},_preventColResize:function(n,t){this._currentHCell=n;var r=this.XLObj,c=r.getActiveSheetIndex(),u=[],s=r.getSheet(c).pivotMngr.pivot,u=r.getObjectKeys(s),f,o,h,e,i,l=u.length;if(u.length)for(i=0;i<l;i++)return f=s[u[i]].colIndex,h=r.element.find("#"+u[i]).data("ejPivotGrid"),e=h.calculateCellWidths().columnWidths.length,e||(e=3),o=f+e,t?this._currentHCell>=f&&this._currentHCell<o:this._currentHCell>=f&&this._currentHCell<=o},_start:function(i){var r=this.XLObj,f,e=r.getActiveSheetIndex(),o=r._getJSSheetHeader(e),c=o.find(".e-columnheader"),s=c.find(".e-headercell"),u,h;(this._currentHCell>-1&&this._currentHCell<s.length&&(u=s[this._currentHCell]),t.isNullOrUndefined(u))||(h=u.getBoundingClientRect(),this._tableY=h.top+parseInt(navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollTop:document.documentElement.scrollTop),this._allowStart?(this._$visualElem=n(document.createElement("div")),f=r._getJSSheetContent(e).height()+o.height(),this._$visualElem.addClass("e-reSizeColbg").appendTo(r.element).css({height:f+"px"}).addClass("e-ss-colresize"),this._$visualElem.css({left:i-1,top:this._tableY}),this._oldWidth=u.offsetWidth,this._extra=i-this._orgX,this._resizeStart=!0):this._currentHCell=-1)},_cMouseMove:function(n){if(this._resizeStart){var t=this.XLObj._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0];t+=document.documentElement.scrollLeft;n.preventDefault();this._moveVisual(t);this.XLObj.addClass(n.target,"e-ss-colresize")}else this._mouseHover(n)},_reSize:function(t){var f,i=this.XLObj,s,r=i.getActiveSheetIndex(),e,l=i._getJSSheetHeader(r),h=l.find(".e-colselected"),c=h.length,u,o=[];if(this._initialTableWidth=i._getJSSheetHeader(r).find(".e-headercontent").width(),this._getResizableCell(),this._currentHCell>-1&&this._resizeStart){for(f=i.getSheet(r).columnsWidthCollection[this._currentHCell],c>0&&(u=h[0].cellIndex),e=0;e<c;e++)this._currentHCell===u&&(s=!0),o.push(u),u++;s||(o=[this._currentHCell]);this._resizeColumnUsingDiff(t-this._orgX+f,f,o);i._isAutoWHMode&&i._autoSSWidthHeight();i.model.allowAutoFill&&(i.XLDragFill.positionAutoFillElement(),i.XLDragFill.hideAutoFillOptions());n("#"+i._id+"ddlspan").length&&i._ddlPosition()}i.XLScroll._getRowHeights(r,this._currentHCell);i.model.allowFreezing&&i.XLFreeze._refreshFColResize(this._currentHCell);i.model.allowSelection&&i.XLSelection._refreshBorder();this._removeVisualElem()},_resizeColumnUsingDiff:function(t,i,r){var h,f,c,l,a,v,p,w,u=this.XLObj,y={},o=u.getActiveSheetIndex(),b=u._getJSSheetHeader(o),e,k,d,s,g;if(t>0){for(t=t>this._colMinWidth?t:this._colMinWidth,e=0,k=r.length;e<k;e++){if(u.XLEdit.getPropertyValue(0,r[e],"wrapCol")&&u.XLEdit.getPropertyValue(0,r[e],"wrapWidth")>t){u._dupDetails=!0;continue}if(p=b.find("col:eq("+r[e]+")"),w=u._getJSSheetContent(o).find(".e-spreadsheetcontentcontainer").find("col:eq("+r[e]+")"),p.outerWidth(t),w.width(t),u.getSheet(o).columnsWidthCollection[r[e]]=t,t<i)for(a=u._getContent(o).find(".e-rowcell:nth-child("+(r[e]+1)+")"),s=0,d=a.length;s<d;s++)f=u._getCellIdx(a[s]),c=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2"),c&&(u._refreshGlobalSpan(),h=n("#"+u._id+"_emptySpan"),u.addClass(h[0],"e-rowcell"),h.text(c),l=h.outerWidth(),u._refreshGlobalSpan(),t<l&&(u._textClip(f.rowIndex,f.colIndex,"delete"),u._textClip(f.rowIndex,f.colIndex,"add",l)));else for(v=u._getContent(o).find(".e-rowcell.e-ofbrdr:nth-child("+(r[e]+1)+")"),s=0,g=v.length;s<g;s++)f=u._getCellIdx(v[s]),u._textClip(f.rowIndex,f.colIndex,"delete","",!0),u._textClip(f.rowIndex,f.colIndex,"add","",!0)}b.find(".e-columnheader").css("cursor","default");u._dupDetails||(y={sheetIndex:o,cols:r,newWidth:t,oldWidth:i,reqType:"resize-column"},i!==t&&(u._completeAction(y),u._trigActionComplete(y)));u._dupDetails&&(u._dupDetails=!1);u.XLScroll._getColWidths(o,r[0]);u.model.scrollSettings.allowScrolling&&(u.XLScroll._refreshScroller(o,"refresh","all"),u.XLScroll._getFirstColumn(o))}},_calculateWidth:function(){for(var t=this.XLObj,i=t._getJSSheetHeader(t.getActiveSheetIndex()).find("col"),r=0,n=0;n<i.length;n++)r+=i.eq(n).width();return r},_cMouseUp:function(n){if(this._resizeStart){var r,i=this.XLObj,u=this._currentHCell,f=i.getSheet(i.getActiveSheetIndex()).columnsWidthCollection,t={};if(r=i._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0],r+=document.documentElement.scrollLeft,t.event=n,t.target=n.target,t.oldWidth=f[u],t.colIndex=this._currentHCell,this._reSize(r),t.newWidth=f[u],t.reqType="column-resize",this.XLObj._trigger("resizeEnd",t))return;i.element.find("#"+i._id+"ddl").ejDropDownList("hidePopup")}},_getResizableCell:function(n){for(var i=this.XLObj,r=i.getActiveSheetIndex(),o=i._getJSSheetHeader(r).find(".e-columnheader"),u=o.find(".e-headercell"),s=navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollLeft:document.documentElement.scrollLeft,f,e,t=0,h=u.length;t<h;t++)if(e=u[t].getBoundingClientRect(),f=e.left+s+5,f>this._orgX){i.isUndefined(n)?this._currentHCell=t-1:n.target=i._getJSSheetHeader(r).find("th:eq("+(t-1)+")")[0];return}},_moveVisual:function(n){var i=this.XLObj,t=i._getJSSheetHeader(i.getActiveSheetIndex()).find(".e-headercontent")[0].getBoundingClientRect();t.left+document.documentElement.scrollLeft+t.width<n||n<t.left+document.documentElement.scrollLeft?this._$visualElem.remove():this._currentHCell>-1&&this._$visualElem.css({left:n-1,top:this._tableY})},_rowMouseDown:function(t){var f,r,u,i={},e=this.XLObj;if(e._isTouchEvt&&this._rowMouseHover(t),this._allowStart&&n(t.target).css("cursor")==="row-resize"){if(u=e._setXY(t,navigator.userAgent.indexOf("WebKit")>-1),f=u[0],r=u[1],r+=document.documentElement.scrollTop,i.event=t,i.target=t.target,i.rowIndex=this._currentHCell,i.oldHeight=t.target.getBoundingClientRect().height,i.reqType="row-resize",this.XLObj._trigger("resizeStart",i))return;t.button!==2&&this._rowStart(f,r);this._resizeType="Row";t.preventDefault()}return!1},_rowMouseHover:function(t){var r;if(!this._$visualElem.is(":visible")&&(r=n(t.target),r.hasClass("e-rowheader"))){var i=this.XLObj,o=i.getActiveSheetIndex(),h=i._getJSSheetRowHeaderContent(o),e=r.get(0),u=e.getBoundingClientRect(),s=i._setXY(t),c=s[0],f=s[1],l=i._getJSSheetRowHeader(o).find(".e-table").height()+h.find("tbody").offset().top;if((f>=u.top+document.documentElement.scrollTop+e.offsetHeight-(i._isTouchEvt?8:5)||f<=u.top+(i._isTouchEvt?8:3))&&f<l&&f>=u.top&&c<=u.left+document.documentElement.scrollLeft+t.target.offsetWidth){if(this._resizeElt=r.parent(),this._currentHCell=i.model.scrollSettings.allowVirtualScrolling?parseInt(this._resizeElt.attr("idx")):this._resizeElt[0].rowIndex,this._currentHCell<1&&f<u.top+e.offsetHeight-(i._isTouchEvt?8:5)||this._preventRowResize(this._currentHCell,!1))return;r.addClass("e-ss-rowresize");this._allowStart=!0}else n(".e-ss-rowresize").removeClass("e-ss-rowresize"),this._allowStart=!1,this._currentHCell=-1;this._resizerowId=t.target.parentNode.getAttribute("idx")}},_preventRowResize:function(n,t){this._currentHCell=n;var r=this.XLObj,c=r.getActiveSheetIndex(),u=[],s=r.getSheet(c).pivotMngr.pivot,u=r.getObjectKeys(s),f,o,h,e,i,l=u.length;if(u.length)for(i=0;i<l;i++)return f=s[u[i]].rowIndex,h=r.element.find("#"+u[i]).data("ejPivotGrid"),e=h._rowCount,e||(e=4),o=f+e,t?this._currentHCell>=f&&this._currentHCell<o:this._currentHCell>=f-1&&this._currentHCell<=o},_rowStart:function(t,i){var r=this.XLObj,f=r.getActiveSheetIndex(),e=this._resizeElt[0].rowIndex,o=r._getJSSheetRowHeader(f).find(".e-rowheader"),u,s,h;(this._currentHCell>-1&&e<o.length&&(u=o[e]),u)&&(s=u.getBoundingClientRect(),this._tableX=s.left+parseInt(navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollLeft:document.documentElement.scrollLeft),this._allowStart?(this._$visualElem=n(document.createElement("div")),h=r._getJSSheetContent(f).width(),this._$visualElem.addClass("e-reSizeRowbg").appendTo(r.element).css({width:h+"px"}).addClass("e-ss-rowresize"),this._$visualElem.css({top:i-3,left:this._tableX}),this._oldHeight=u.offsetHeight,this._orgX=t,this._orgY=i,this._extra=i-this._orgY,this._resizeStart=!0):this._currentHCell=-1)},_rMouseMove:function(t){if(this._resizeStart){var i=this.XLObj._setXY(t,navigator.userAgent.indexOf("WebKit")>-1)[1];i+=document.documentElement.scrollTop;t.preventDefault();n(t.target).addClass("e-ss-rowresize");this._moveRowVisual(i)}else this._rowMouseHover(t)},_rowResize:function(t,i){var u,r=this.XLObj,f=r.getActiveSheetIndex(),p=r.getRows(f)[1],s=!1,h,w=r._getJSSheetRowHeaderContent(f),l=w.find(".e-rowselected"),a=l.length,e,v,c=[],y=0,o;if(this._initialTableHeight=r._getJSSheetRowHeader(f).find(".e-rowheadercontent").height(),this._getResizableRowCell(),s=n(p[this._currentHCell]).find(".e-sswraptext").length>0,this._currentHCell>-1&&this._resizeStart){for(o=0;o<=this._resizerowId;o++)r.XLEdit.getPropertyValue(o,0,"isRHide")&&y++;if(u=r.getSheet(f).rowsHeightCollection[this._currentHCell+y],!s||s&&i-this._orgY+u>u){for(a>0&&(e=l[0].parentNode.rowIndex),h=0;h<a;h++)this._currentHCell===e&&(v=!0),c.push(e),e++;v||(c=[this._currentHCell]);this._resizeRowUsingDiff(i-this._orgY+u,u,c)}r.model.allowAutoFill&&(r.XLDragFill.positionAutoFillElement(),r.XLDragFill.hideAutoFillOptions());r._isAutoWHMode&&r.model.showRibbon&&r._autoSSWidthHeight(f,!0)}r.model.allowSelection&&r.XLSelection._refreshBorder();this._removeVisualElem()},_resizeRowUsingDiff:function(n,t,r){var u=this.XLObj,f=u.getActiveSheetIndex(),o={},s=u._getJSSheetRowHeaderContent(f),l,a,v,e,h,c;if(n>0){for(n=n>this._rowMinHeight?n:this._rowMinHeight,i=0,l=r.length;i<l;i++)e=r[i],h=u.model.scrollSettings.allowVirtualScrolling?u.getSheet(f)._virtualRowIdx.indexOf(e):e,c=this._getContentHeight(e,f)<=n,u._isRowViewable(f,e)&&(u._isUndoRedo||c)&&(a=s.find("tr:eq("+h+")"),v=u._getJSSheetContent(f).find(".e-content").find("tr:eq("+h+")"),a.outerHeight(n),v.height(n)),(u._isUndoRedo||c)&&(u.getSheet(f).rowsHeightCollection[e]=n);u.XLScroll._getRowHeights(f,r[0]);s.find("tbody").css("cursor","default");s.find("tbody").children().css("cursor","default");u._dupDetails||(o={sheetIndex:f,rows:r,newHeight:n,oldHeight:t,reqType:"resize-row"},t!==n&&(u._completeAction(o),u._trigActionComplete(o)));u.model.allowFreezing&&u.XLFreeze._refreshFRowResize(e);u.model.scrollSettings.allowScrolling&&(u.XLScroll._refreshScroller(f,"refresh","all"),u.XLScroll._getFirstRow(f))}},_findRowsHeight:function(n){for(var t=this.XLObj,i=t.getActiveSheetIndex(),f=t.getSheet(i),e=t._getJSSheetContent(i).find("tbody").children(),r,u=0,o=n.length;u<o;u++)r=n[u],t._sheets[i]._Rows[0]&&(f.rowsHeightCollection[r]=e.eq(r).height())},_calculateHeight:function(){for(var t=this.XLObj,i=t.getRows(t.getActiveSheetIndex())[0],r=0,n=0,u=i.length;n<u;n++)r+=i.eq(n).height();return r},_rMouseUp:function(t){if(this._resizeStart){var r=this.XLObj,u=this._currentHCell,f=r.getSheet(r.getActiveSheetIndex()).rowsHeightCollection,i={},e=r._setXY(t,navigator.userAgent.indexOf("WebKit")>-1);if(x=e[0],y=e[1],y+=document.documentElement.scrollTop,i.event=t,i.target=t.target,i.oldHeight=f[u],i.rowIndex=this._currentHCell,this._rowResize(x,y),i.newHeight=f[u],i.reqType="row-resize",this.XLObj._trigger("resizeEnd",i))return;n("#"+this.XLObj._id+"ddlspan").length&&this.XLObj._ddlPosition()}},_getResizableRowCell:function(t){for(var r=this.XLObj,e=r.getActiveSheetIndex(),u=r._getJSSheetContent(e).find(".e-rowheader"),c=navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollTop:document.documentElement.scrollTop,o,f,s=1,h,i=0,l=u.length;i<l;i++)if(f=u[i].getBoundingClientRect(),f.top===0&&s++,o=f.top+c+5,o>this._orgY){r.isUndefined(t)?(h=n(u[i-1]).is(":visible")?i-1:i-s,this._currentHCell=r._getCellIdx(u[h]).rowIndex):t.target=r._getJSSheetRowHeader(e).find("tr:eq("+i+") td")[0];return}},_moveRowVisual:function(n){var i=this.XLObj,t=i._getJSSheetContent(i.getActiveSheetIndex()).find(".e-rowheadercontent")[0].getBoundingClientRect();t.top+document.documentElement.scrollTop+t.height<n||n<t.top+document.documentElement.scrollTop?this._$visualElem.remove():this._currentHCell>-1&&this._$visualElem.css({top:n-3,left:this._tableX})},_apMouseDown:function(t){var i,r=this.XLObj;return r._isTouchEvt&&this._apMouseHover(t),this._allowStart&&n(t.target).closest("div").css("cursor")==="col-resize"&&(i=r._setXY(t,navigator.userAgent.indexOf("WebKit")>-1)[0],i+=document.documentElement.scrollLeft,t.button!==2&&this._apStart(i),this._resizeType="AP",t.preventDefault()),!1},_apMouseHover:function(t){var i=this.XLObj;if(!this._$visualElem.is(":visible")){var r=n(t.target),e=r.get(0),u=i.getActivationPanel()[0].getBoundingClientRect(),f=i._setXY(t)[0];f<=u.left+(i._isTouchEvt?20:4)&&f>=u.left?(r.parent().addClass("e-ss-apresize"),this._allowStart=!0):(i.element.find(".e-ss-apresize").removeClass("e-ss-apresize"),this._allowStart=!1)}},_apStart:function(t){var i=this.XLObj,f=i.getActivationPanel()[0],e=f.getBoundingClientRect(),r=i.getActiveSheetIndex(),u;this._tableY=e.top+parseInt(navigator.userAgent.indexOf("WebKit")>-1?document.body.scrollTop:document.documentElement.scrollTop);this._allowStart&&(this._$visualElem=n(document.createElement("div")),u=i._getJSSheetContent(r).height()+i._getJSSheetHeader(r).height(),this._$visualElem.addClass("e-reSizeAPbg").appendTo(i.element).css({height:u+"px"}).addClass("e-ss-apresize"),this._$visualElem.css({left:t,top:this._tableY}),this._resizeStart=!0)},_apMouseMove:function(n){if(this._resizeStart){var i=this.XLObj,t=i._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0];t+=document.documentElement.scrollLeft;n.preventDefault();this._apMoveVisual(t)}else this._apMouseHover(n)},_apMouseUp:function(n){if(this._resizeStart){var i=this.XLObj,t=i._setXY(n,navigator.userAgent.indexOf("WebKit")>-1)[0];t+=document.documentElement.scrollLeft;this._apReSize(t)}},_apMoveVisual:function(n){this._$visualElem.css({left:n-5,top:this._tableY})},_apReSize:function(t){var i=this.XLObj,s=i.model.activationPanelWidth,f=0,r=n.extend(!0,{},i.model.scrollSettings),e=i.getActivationPanel(),o,u;r.width=i._responsiveWidth;r.height=i._responsiveHeight;i.model.activationPanelWidth=Math.abs(r.width-(t-i.element.offset().left));i.model.enablePivotTable&&(u=i.getActivationPanel().data("ejScroller"),f=i.getActivationPanel().find(".e-vscrollbar").length?20:2,e.find(".e-ss-pivotfield").width(i.model.activationPanelWidth-f),e.find("#"+i._id+"_PivotField").width(i.model.activationPanelWidth-f),s>i.model.activationPanelWidth?(u.option({width:i.model.activationPanelWidth-1}),i._setSheetWidthHeight(i.getActiveSheetIndex(),{width:r.width,height:r.height},null,"resize")):(i._setSheetWidthHeight(i.getActiveSheetIndex(),{width:r.width,height:r.height},null,"resize"),u.option({width:i.model.activationPanelWidth-1})),o=i.getActivationPanel().find("#"+i._id+"_PivotTableSchema_"+i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).data("ejPivotSchemaDesigner"),o._reSizeHandler(),u.refresh());this._removeVisualElem()},_removeVisualElem:function(){var n=this.XLObj;this._$visualElem.remove();n.element.find(".e-reSizeRowbg").remove();this._resizeStart=!1;this._currentHCell=-1;this._resizeType="";this._allowStart=!1;n.model.allowComments&&n.XLComment._updateCmntArrowPos()},fitWidth:function(n){var t=this.XLObj,r=t.getActiveSheetIndex(),i,u;if(t.model.allowResizing){for(i=0,u=n.length;i<u;i++)this._fitWidth(n[i],0,t.getSheet(r).usedRange.rowIndex);t.model.scrollSettings.allowScrolling&&(t.XLScroll._getColWidths(r,n[0]+1),t.XLScroll._refreshScroller(r,"refresh","horizontal"));t.model.allowSelection&&t.XLSelection._refreshBorder();t.model.allowComments&&t.XLComment._updateCmntArrowPos(null,r,{colIndex:n[i]})}},_resizeToFitWidth:function(t){var i=this.XLObj,f=n(t.target),r=i.getActiveSheetIndex(),u=i.getSheet(r).usedRange.rowIndex;this._getResizableCell(t);this._fitWidth(t.target.cellIndex,0,u);i.model.scrollSettings.allowScrolling&&(i.XLScroll._getColWidths(i.getActiveSheetIndex(),t.target.cellIndex+1),i.XLScroll._refreshScroller(r,"refresh","horizontal"));i.model.allowSelection&&i.XLSelection._refreshBorder();i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement();i.model.allowComments&&i.XLComment._updateCmntArrowPos(null,r,{colIndex:t.target.cellIndex})},_fitWidth:function(t,i,r){var u=this.XLObj,f=u.getActiveSheetIndex(),o=u._getJSSheetHeader(f).find(".e-headercell")[t],a=n(o).children(".e-headercelldiv"),e=0,h=0,s=0,c=u.getSheet(f),l;r=r?r:c.usedRange.rowIndex;s=this._getContentWidth(t,f,i,r);h=this._getHeaderContentWidth(a,f);s>1&&(e=h>s?h:s,l={target:o,sheetIndex:f,colIndex:t,newWidth:e,oldWidth:o.offsetWidth,reqType:"resize-fit-width"},e>0&&(e<20&&(e=30),this._applyWidth(o,f,t,e),u.model.allowFreezing&&u.XLFreeze._refreshFColResize(t),u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement(),c._isImported&&!c._isLoaded||u._isUndoRedo||u._dupDetails||u._isExport||(u._completeAction(l),u._trigActionComplete(l))));u.XLEdit._updateDataContainer({rowIndex:0,colIndex:t},{dataObj:{isFitWidth:!0}})},_applyWidth:function(n,t,i,r){var u=this.XLObj;u._getJSSheetHeader(t).find("col:eq("+i+")").width(r);u._getJSSheetContent(t).find("col:eq("+(i+1)+")").width(r);u.getSheet(t).columnsWidthCollection[i]=r;u.getSheet(t).columns[i].width=r},_getContentWidth:function(n,i,u,f){for(var c=0,s,h,l=this.XLObj,a=l._dataContainer.sheets[i],o,e=u;e<=f;e++)t.isNullOrUndefined(a[e])||(s=a[e][n]),t.isNullOrUndefined(s)?(s={},h={spanWidth:0,paddingWidth:0}):h=this._getCalculatedCellWidth(i,s),o=l._detailsFromGlobalSpan(e,n,"width",l.XLEdit.getPropertyValue(e,n,"value2"),r,!0),o=o+h.spanWidth+h.paddingWidth+4,o>c&&(c=o);return c},_getCalculatedCellWidth:function(n,t){var i=0,r=0;return"isFilterHeader"in t?"isFilterVisible"in t&&(i+=17):i+=0,r=3,{spanWidth:i,paddingWidth:r}},_getHeaderContentWidth:function(n){var i=0,r=t.buildTag("span",{},{}),u=n.html();return r.html(u),n.html(r),i=n.find("span:first").width(),i=i+10,n.html(u),i},fitHeight:function(n){var i=this.XLObj,u,r,f;if(i.model.allowResizing){for(u=i.getActiveSheetIndex(),r=0,f=n.length;r<f;r++)t.isNullOrUndefined(i.XLEdit.getPropertyValue(n[r],0,"wrapRow"))&&this._fitHeight(n[r],n[r]),i._setRowHdrHeight(u,n[r]);i.model.scrollSettings.allowScrolling&&(i.XLScroll._getRowHeights(u,n[0]),i.XLScroll._refreshScroller(u,"refresh","vertical"));i.model.allowSelection&&i.XLSelection._refreshBorder();i.model.allowComments&&i.XLComment._updateCmntArrowPos(null,u,{rowIndex:n[0]})}},_resizeToFitHeight:function(n){var t=this.XLObj,i=t.getActiveSheetIndex(),r=n.target.parentNode.rowIndex,u;u=t.model.scrollSettings.allowVirtualScrolling?t.getSheet(i)._virtualRowIdx[r]:r;this._getResizableRowCell(n);this._fitHeight(r,u);t._setRowHdrHeight(i,u);t.model.scrollSettings.allowScrolling&&(t.XLScroll._getRowHeights(t.getActiveSheetIndex(),u),t.XLScroll._refreshScroller(i,"refresh","vertical"));t.model.allowSelection&&t.XLSelection._refreshBorder();t.model.allowAutoFill&&t.XLDragFill.positionAutoFillElement();t.model.allowComments&&t.XLComment._updateCmntArrowPos(null,i,{rowIndex:r})},_fitHeight:function(i,r){var u=this.XLObj,f=u.getActiveSheetIndex(),s=u.getSheet(f),l=u._getJSSheetRowHeader(f).find(".e-rowheader")[i],e=0,h=0,o,a=t.buildTag("span",{},{height:20,width:30}),c;h=this._getContentHeight(r,f,u.XLEdit.getPropertyValue(r,0,"wrapRow"));a.html(r+1);u.element.append(a);o=u.element.find("span:last").outerHeight(!0);u.element.find("span:last").remove();o=o+4;e=h<o?o:h;c={target:l,sheetIndex:f,rowIndex:r,newHeight:e,oldHeight:s.rowsHeightCollection[i],reqType:"resize-fit-height"};u._isRowViewable(f,r)&&(n(l.parentElement).height(e),n(u._getContent(f).find("tr")[i]).height(e));u.getSheet(f).rowsHeightCollection[r]=e;u.model.allowFreezing&&u.XLFreeze._refreshFRowResize(i);u.model.scrollSettings.allowScrolling&&u.XLScroll._refreshScroller(f,"refresh","all");s._isImported&&!s._isLoaded||u._dupDetails||u._isExport||(u._completeAction(c),u._trigActionComplete(c));u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement();u.XLEdit._updateDataContainer({rowIndex:r,colIndex:0},{dataObj:{isFitHeight:!0}})},_getContentHeight:function(n,t,i){for(var u=this.XLObj,e=0,o,a=u._formatRegx,h=u.getSheet(t),s=u.getObjectKeys(u._dataContainer.sheets[t][n]),v=h.rowsHeightCollection[n],c=h.columnsWidthCollection,f=0,l=s.length;f<l;f++)o=u._detailsFromGlobalSpan(n,s[f],"height",u.XLEdit.getPropertyValue(n,s[f],"value2"),i?c[f]:r,!0),o>e&&(e=o);return e+3},_setRowHdrHeightResize:function(i,r){for(var f=this.XLObj,e=f.getRows(i),o=e[0],s=f.getSheet(i).usedRange.rowIndex,u=0;u<=s;u++)t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,r,"mergeIdx"))&&t.isNullOrUndefined(f.XLEdit.getPropertyValue(u,r,"merge"))&&f._isRowViewable(i,u)&&(tdHeight=f._detailsFromGlobalSpan(u,r,"height",f.XLEdit.getPropertyValue(u,r,"value2")),n(o[u]).height(tdHeight))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.editing=function(n){this.XLObj=n;this._EditCellDetails={value:null,rowIndex:-1,columnIndex:-1,fieldName:null,cell:null};this._isEdit=!1;this._isFEdit=!1;this._isFormulaEdit=!1;this._isFBarFocused=!1;this._skipHTML=!1;this._editElem=null;this._filterIcon=null;this._isCellEdit=!0;this._validOperators=["+","-","*","/",","];this._invalidOperators=["%"];this._validCharacters=["+","-","*","/",",","(","="];this._textDecoration=!1;this._editCell=null;this._acPosition={left:0,top:0};this._isValidation=!1};t.spreadsheetFeatures.editing.prototype={getCurrentEditCellData:function(){var r,n,t=this.XLObj,i;return this._isEdit?(r=t.element.find("#"+t._id+"_Edit"),n=r.text(),i=t._getCellIdx(this._editCell[0]),this.getPropertyValue(i.rowIndex,i.colIndex,"type")!="text"&&t.isNumber(n)&&(n=parseFloat(n)),n):null},getColumnIndexByField:function(n){for(var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()),t=0,u=r.columns.length;t<u;t++)if(r.columns[t].field===n)break;return t},_processEditing:function(){this._editElem||(this._editElem=t.buildTag("div.e-field e-ss-input","",{},{id:this.XLObj._id+"_Edit",contenteditable:!0}),this._editElem.data("parentID",this.XLObj._id))},editCell:function(t,i,r){var u=this.XLObj,o,f,c,e,l,a,s,h,v;u.model.allowEditing&&u.model.allowSelection&&!u._isCellProtected(t,i,!0)&&!u.model.isReadOnly&&((u=this.XLObj,v=u.element.find("#"+u._id+"_ValElem"),h={rowIndex:t,colIndex:i},o=u.getActiveSheetIndex(),f=u.getSheet(o),l=u.getActiveCell(o),u._isRowViewable(o,t)&&(this._textDecoration=u.getCell(t,i).find("a").css("text-decoration")==="none"),s=u.getCell(t,i),column=f.columns[i],this._editCell=s,e={columnName:column.field,value:u.getRangeData({range:[t,i,t,i],valueOnly:!0,sheetIdx:o,skipDateTime:!0})[0],columnObject:column,cell:s,rowIndex:t,colIndex:i},u._trigger("cellEdit",e))||(u._cureditedCell=e.value,this._isValidation&&(v.rules("remove"),this._isValidation=!1),(l.rowIndex!==t||l.colIndex!==i)&&(f._activeCell=h,f._startCell.rowIndex<=t&&f._startCell.colIndex<=i&&f._endCell.rowIndex>=t&&f._endCell.colIndex>=i?u.XLSelection.selectRange(f._startCell,f._endCell):u.XLSelection.selectRange(h,h),u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement()),this._EditCellDetails={rowIndex:t,value:e.value,columnIndex:i,fieldName:column.field,cell:s},r||(e.value=""),a=e.value,this._renderBulkEditObject(e,s,a),this.getPropertyValue(f._activeCell.rowIndex,f._activeCell.colIndex,"rule",o)&&u.model.allowDataValidation&&u.XLValidate._setValidation(),c=n("#"+u._id+"_Edit"),this.getPropertyValue(t,i,"hyperlink",o)&&c.addClass("e-hyperlinks"),this._textDecoration&&c.css("text-decoration","none"),u.model.allowComments&&s.hasClass("e-commentcell")&&u.XLComment._visibleCmntCnt(s),e.cell.addClass(u._browserDetails.name==="msie"?"e-editedcell e-msie-edit":"e-editedcell"),u.isFormula(e.value)&&this._processFormulaEditRange(e.value),u.model.allowKeyboardNavigation&&(u.XLCellNav._isNavigate=!1),u.model.enableContextMenu&&n("#"+u._id+"_contextMenuCell").data("ejMenu")._contextMenuEvents("_off")))},_renderBulkEditObject:function(i,r,u){var s,a,f=this.XLObj,v=r.height(),o=f.getActiveSheetIndex(),h=r.find(".e-filterspan"),l=f._getJSSheetContent(o).find(".e-spreadsheetcontentcontainer > .e-content"),y=f.XLFormat.getFormatClass(r[0].className),c,e;({})[i.columnObject.field]=i.value;h.length&&(a={filterIcon:h,rowIndex:h.parentsUntil("table").eq(1).index(),colIndex:h.parent().index()},this._filterIcon=a);s=r.height();this._refreshTextNode(r[0]);r.hasClass("e-sswraptext")&&v!==s&&r.height(v);e=this._editElem;e.text("");t.isNullOrUndefined(u)||e.text(f.isNumber(u)?f._getlocaleNumVal(u,!0):u);l.append(e);c=f._isClassHasProperty(y,"text-align","right")?{right:l.width()-r[0].offsetLeft-r[0].offsetWidth+2,left:"",maxWidth:r[0].offsetLeft+r[0].offsetWidth+2}:{left:r[0].offsetLeft+2,right:"",maxWidth:l.width()-(r.offset().left-(f.element.offset().left+n(f.getRows(o)[0][0]).width()))-2};e.css({left:c.left,right:c.right,top:r[0].offsetTop+1,"-webkit-user-select":"text",cursor:"text","min-height":s-1,height:"auto",lineHeight:"normal",wordWrap:"break-word",position:"absolute",minWidth:r.width(),whiteSpace:"pre-wrap"});this._editCell.hasClass("e-sswraptext")?(e.css({width:r.width(),maxWidth:""}),n(f.getRows(o)[1][r.parent().attr("idx")]).height(f.model.sheets[o].rowsHeightCollection[r.parent().attr("idx")]),f.XLScroll._getRowHeights(o,r.parent().index())):e.css({width:"",maxWidth:c.maxWidth});e.show();this._refreshEditForm(r,e,i.value,u,s);this._isEdit=!0;f.model.showRibbon&&f.XLRibbon._disableRibbonIcons()},_refreshEditForm:function(t,i,r,u){var h,e,c={},f=this.XLObj,l=document.getElementById(f._id+"EditForm"),a=n(l).find("input,select"),o=f._dataContainer.sheets[f.getActiveSheetIndex()],s=t.parent().index();o&&o[s]&&o[s][t[0].cellIndex]&&(c=o[s][t[0].cellIndex]);i[0].className="";e=this.getPropertyValueByElem(t,"type")||"";!f.isNumber(u)||e.indexOf("text")>-1||i.addClass("e-ralign");(e.indexOf("date")>-1||e.indexOf("time")>-1)&&i.addClass("e-ralign");i.css({border:"none",outline:"none"});this.XLObj.model.allowCellFormatting&&(h=f.XLFormat.getFormatClass(t[0].className));i.addClass(h);f.model.allowCellFormatting&&(i.css({color:t.css("color")}),i.css({"background-color":t.css("background-color")}));i.on("keyup",{xlObj:f},function(t){var i=t.data.xlObj;i.XLEdit._isFormulaEdit=!n(t.target).text().indexOf("=");i.XLEdit._isFormulaEdit&&i.XLEdit._processFormulaEditRange(n(t.target).text());i.model.allowFormulaBar&&i._getInputBox().val(n(t.target).text());i.XLEdit._isCellEdit=!0});i.on("focus",{xlObj:f},function(n){var t=n.data.xlObj;t.XLEdit._isCellEdit=!0});f._setFormulaSuggElem(n("#"+f._id+"_AutoComplete_suggestion"));i.focusEnd()},_renderAutoComplete:function(t,i,r,u){var f=this.XLObj,e=u?" e-cell-ac e-ss-editinput":"";t.ejAutocomplete({dataSource:f._formulaCollection,value:i,cssClass:"e-ss-autocomplete"+e,width:"100%",height:r,htmlattributes:u?{display:"none"}:"",delaySuggestionTimeout:10,minCharacter:2,popupWidth:"170px",popupHeight:"150px",showEmptyResultText:!1,autoFocus:!0,template:"<span class='e-icon e-ss-function'> <\/span><div> ${display} <\/div>",select:n.proxy(this._formulaSelect,f),open:n.proxy(this._formulaSuggestionStatus,f),close:n.proxy(this._formulaSuggestionStatus,f)});t.data("ejAutocomplete")._bubbleEvent(!0)},_refreshAutoComplete:function(){var t=this.XLObj,i,r,u="ejAutocomplete",f="dataSource";r=n("#"+t._id+"_inputbox").data(u);i=n("#"+t._id+"_AutoComplete").data(u);t.model.allowFormulaBar&&r&&r.option(f,t._formulaCollection);i&&i.option(f,t._formulaCollection)},_captureEditing:function(){var t=this.XLObj,i,f,e,r,u=document.activeElement,o=t.getActiveCell();u&&u.tagName==="DIV"&&t._isRowViewable(null,o.rowIndex)&&(i=t.element.find("#"+t._id+"_AutoComplete"),i.val(n(u).text()),i.data("ejAutocomplete").search(),f=t.getActiveCellElem(),e=t.element.find("#"+t._id+"_Edit")[0],r=f[0].getBoundingClientRect(),this._acPosition.left=r.left+window.pageXOffset,this._acPosition.top=r.top+window.pageYOffset+n(e).height(),n("#"+t._id+"_AutoComplete_suggestion").css({left:this._acPosition.left,top:this._acPosition.top}))},saveCell:function(){var t=this.XLObj,p,a,v,b,o,s,h,it,k,c,d,g,nt,w,rt,r,u,ut,e,f,l,i,tt,ot,ft,et,y;if(t.model.allowEditing&&!t.model.isReadOnly&&(tt=!1,ft=["ABS","LEFT","RIGHT","TRIM","UPPER","VALUE"],this._isEdit)){if(f=t.getActiveSheetIndex(),l=t.getSheet(f),ot=t.getRows(f),v=n("#"+t._id+"EditForm"),d=this._editCell,k=l.columns[this._EditCellDetails.columnIndex],g=t.element.find("#"+t._id+"_ValElem"),et=t.element.find("#"+t._id+"_Edit")[0],y=n(et).html(),nt=t._getCellIdx(d[0]),i=nt.rowIndex,r=nt.colIndex,u={columnName:k.field,value:this.getCurrentEditCellData(),prevValue:this._EditCellDetails.value,columnObject:k,rowIndex:i,colIndex:r,cell:d,isRefCells:!1},t.model.allowDataValidation&&this._isValidation){if(g.val(u.value),v.css("display","block"),!v.validate().element(g[0]))return v.css("display","none"),!1;v.css("display","none");u.hasValidation=!0}if(u.value!==u.prevValue&&t._trigger("cellSave",u))return;if(h=t.getRangeData({range:[i,r,i,r],property:["type","formatStr","decimalPlaces"]})[0],t.isFormula(u.value)&&!this._formulaValidate(u.value))return;if(ut=this._EditCellDetails.value||"",e={sheetIndex:f,rowIndex:i,colIndex:r,cValue:u.value,reqType:"edit",iconName:"",pValue:ut},e.prevHeight=l.rowsHeightCollection[i],t._dupDetails=!0,this._updateCellValue({rowIndex:i,colIndex:r},u.value),t._dupDetails=!1,this.getPropertyValue(i,r,"wrap",f)&&(rHgt=t._getWrapCellHeight(f,i,r),t._wrapCollection(i,r,rHgt.cellHt,f),t._getRowHeight(i,f)<rHgt.rowHt&&(t.setHeightToRows([{rowIndex:i,height:rHgt.rowHt}]),t.model.allowAutoFill&&t.XLDragFill.positionAutoFillElement()),this._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{}})),t.XLEdit.getPropertyValue(i,r,"isFilterHeader")&&t._removeClass(u.cell[0],t._rAlign),this._textDecoration&&u.cell.find("a").css("text-decoration","none"),u.hasValidation&&(e.hasValidation=!0),t.isFormula(u.value)&&(!t.getObjectLength(h)||h.type==="general")&&(e.operation="formula",s=u.value,s=t.XLDragFill._parseFormula(s),ft.indexOf(s[0])===-1)){for(j=0,it=s.length;j<it;j++)if(o=s[j],o!="("&&s[j+1]!="(")break;o.indexOf(":")>-1&&(o=o.split(":")[0]);t._isCellReference(o)&&(o=o.replace(/\$/g,""),fRange=t.getRangeIndices(o),fObj=t.getRangeData({range:fRange,property:["type","formatStr","decimalPlaces"]})[0],t.getObjectLength(fObj)&&fObj.type!=h.type&&fObj.type!=="general"&&(t._dupDetails=!0,tt=!0,t.XLFormat.format(fObj,t._getAlphaRange(t.getActiveSheetIndex(),i,r,i,r)),t._dupDetails=!1,e.prevFrmtObj=t.getObjectLength(h)?h:{type:"general"},e.curFrmtObj=fObj))}if(t._setRowHdrHeight(f,i),t.model.allowFormulaBar&&t.updateFormulaBar(),t.model.scrollSettings.allowScrolling&&t.XLScroll._getRowHeights(f,i),this._isEdit=this._isFormulaEdit=!1,u.cell.removeClass("e-editedcell e-msie-edit"),t.model.allowKeyboardNavigation&&(t.XLCellNav._isNavigate=!0),t.model.showRibbon&&(t.XLRibbon._enableRibbonIcons(),t.XLRibbon._updateRibbonIcons()),t._updateUndoRedoIcons(),t.model.allowInsert||(t.XLRibbon._disableButtons(["Others_Cells_InsertCellOptions"],"ejSplitButton"),t.XLRibbon._disableButtons(["Others_Cells_InsertCell"],"ejButton")),t.model.allowDelete||(t.XLRibbon._disableButtons(["Others_Cells_DeleteCellOptions"],"ejSplitButton"),t.XLRibbon._disableButtons(["Others_Cells_DeleteCell"],"ejButton")),e.cFormatRule=w=this.getPropertyValue(i,r,"cFormatRule",f),t._dupDetails=!0,t.model.allowConditionalFormats&&w){for(p=0,rt=w.length;p<rt;p++)c=w[p].split("_"),c[0]!=="formularule"&&t.XLCFormat._cFormat(c[0],c[2],c[3],c[4],t._generateHeaderText(r+1)+(i+1));t.XLCFormat.refreshCFormat(t._getAlphaRange(f,i,r,i,r))}return t._dupDetails=!1,e.endCell=l._endCell,e.startCell=l._startCell,a=t.getActiveCellElem(),a&&(t.model.allowComments&&a.hasClass("e-commentcell")&&t.XLComment._visibleCmntCnt(a,!0),a.hasClass("e-hlcell")&&t.XLValidate.highlightInvalidData()),this._shiftKeyEnabled=this._isFBarFocused=!1,t._ctrlKeyCount=0,!this._isFormulaEdit&&t.model.allowSelection&&t.XLSelection._clearBorder(t._formulaBorder.join(" ").replace(/,/g," ")+" "+t._ctrlFormulaBorder.join(" ").replace(/,/g," ")),t.model.allowFormulaBar&&(b=n("#"+t._id+"_inputbox").data("ejAutocomplete"),b&&b.hide()),this._editElem.hide(),t.setSheetFocus(),t._browserDetails.name==="mozilla"&&(y=y.slice(0,-4)),y.indexOf("\n")>-1&&(e.altwrap=!0,this._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{altTxt:!0}})),this.getPropertyValue(i,r,"altTxt",f)&&(this.getPropertyValue(i,r,"wrap",f)||t.wrapText([i,r,i,r]),y.match(/\n/g)||this._clearDataContainer({cellIdx:{rowIndex:i,colIndex:r},property:["altTxt"]})),e.newHeight=l.rowsHeightCollection[i],t.XLScroll._getRowHeights(f,i),t.model.enableContextMenu&&n("#"+t._id+"_contextMenuCell").data("ejMenu")._contextMenuEvents("_on"),(u.value!==u.prevValue||tt)&&(t._completeAction(e),t._trigActionComplete(e)),!0}},_formulaValidate:function(n){var f,h,t,e,o,c,l,s,u,a,i=n,r=this.XLObj,v=["TODAY","NOW","TRUE","FALSE","ROW","COLUMN","SHEET","SHEETS"];if(!this._isNamedRange(n)&&(c=i.length,e=i.split("(").length,o=i.split(")").length,s=r.getCalcEngine().getLibraryFunctions(),i.startsWith("=")&&c>1)){if(t=i=i.substring(1),e!==o){r._showAlertDlg("Alert","MissingParenthesisAlert","FormulaAlert",440);return}if(e===1&&o===1&&r.isUndefined(s.getItem(t.toUpperCase()))&&!this._isValidCell(i)&&!(t.substring(0,u)=="TRUE"||t.substring(0,u)=="FALSE")){r._showAlertDlg("Alert","CorrectFormula","FormulaAlert",372);return}do{if(u=t.indexOf("("),a=t.indexOf(")"),v.indexOf(t.substring(0,u).toUpperCase())<0&&u+1===a){r._showAlertDlg("Alert","CorrectArgument","FormulaAlert",372);return}t=t.substring(u+1);t.indexOf(",")>-1&&(t=t.substring(t.indexOf(",")+1))}while(t.indexOf("(")>-1);for(splitStr=i.split(","),f=0,h=splitStr.length;f<h;f++)if(splitStr[f].indexOf("(")>-1&&(l=splitStr[f].split("("),r.isUndefined(s.getItem(l[0].toUpperCase())))){r._showAlertDlg("Alert","CorrectFormula","FormulaAlert",372);return}}return!0},_isValidCell:function(n){for(var u=this.XLObj,f,r,e,s=!0,h,t,o=["<=",">=","<",">","=","+","-","/","*","^","&"],i=0,c=o.length;i<c;i++){if(n.indexOf(o[i])>-1)for(r=n.split(o[i]),t=0,e=r.length;t<e;t++)if(r[t].length){if(e==t+1&&r[t].length)return!0}else return!1;if(n.indexOf("%")>-1&&n.split("%").length==2)return!0}return n=n.trim(),n=n.startsWith("=")?n.substring(1):n,n.indexOf("!")>-1&&(f=n.split("!"),n=f[1],u._getSheetIndexByName(f[0])<1&&(s=!1)),h=n.indexOf(":")>-1?u._isvalidRange(n):u._isvalidRange(n+":"+n),h&&s},updateValue:function(n,t,i,r){var u=this.XLObj,f,e;u.model.isReadOnly||(f=u.getRangeIndices(n),e={rowIndex:f[0],colIndex:f[1]},u._isPublic=!0,u.model.allowCellFormatting&&u.XLFormat._hasFormat(i)&&(u.XLFormat._createFormatClass(u.XLFormat.getFormatFromHashCode(i),i),u.XLFormat._updateFormatClass(e,i)),this._updateCellValue(e,t,i,r),u._isPublic=!1)},updateCellValue:function(n,t,i,r){var u=this.XLObj;u._isPublic=!0;u.model.allowCellFormatting&&u.XLFormat._hasFormat(i)&&(u.XLFormat._createFormatClass(u.XLFormat.getFormatFromHashCode(i),i),u.XLFormat._updateFormatClass(n,i));this._updateCellValue(n,t,i,r);u._isPublic=!1},_updateCellValue:function(n,t,i,r){var u=this.XLObj;if(n&&!u.model.isReadOnly){var f=n.colIndex,e=n.rowIndex,r=u._getSheetIndex(r),o=u.getActiveCell();u.isFormula(t)?(this._refreshCalcEngine(e,f,!0,t,r),this._updateDataContainer({rowIndex:e,colIndex:f},{dataObj:{value:t},sheetIdx:r}),u._isFormulaSuggestion=!1):(this._updateCell({rowIndex:e,colIndex:f},t,r),this._refreshCalcEngine(e,f,!1,null,r));u._isPublic&&(u.model.allowDataValidation&&this.getPropertyValue(e,f,"isHighlight",r)&&u.XLValidate.highlightInvalidData(),u.model.allowConditionalFormats&&u.XLCFormat.refreshCFormat([e,f,e,f]),u.model.allowComments&&u.XLComment._updateCmntArrowPos(),o.rowIndex===e&&o.colIndex===f&&(u.model.showRibbon&&u.XLRibbon._updateRibbonIcons(),u.model.allowFormulaBar&&u.updateFormulaBar()))}},updateCell:function(n,t,i){var r=this.XLObj;r._isPublic=!0;this._updateCell(n,t,i);r._isPublic=!1},_updateCell:function(n,i,r){var u=this.XLObj;if(n&&!u.model.isReadOnly){r=u._getSheetIndex(r);var h,c=u.getSheet(r),f=n.rowIndex,o=n.colIndex,l=t.Spreadsheet.CellType,a,v=this.getPropertyValue(f,o,"value2")||"",y=c.rowsHeightCollection[f],s=this._parseValue(i,n),e=u.getRangeData({range:[f,o,f,o],property:["formatStr","type","thousandSeparator","decimalPlaces"],sheetIdx:r})[0];u.model.isReadOnly||(e.type&&e.type!=l.General&&(s.type=e.type,delete s.formatStr),(e.formatStr||e.type===l.Scientific||e.type===l.Fraction)&&(s.value2=u.XLFormat._format(s.value,{formatStr:e.formatStr,type:e.type,thousandSeparator:e.thousandSeparator,decimalPlaces:e.decimalPlaces})),this._updateDataContainer(n,{dataObj:s,sheetIdx:r}),u._isPublic&&(h=u._getWrapCellHeight(r,f,o),(this.getPropertyValue(f,o,"wrap")||h.cellHt>c.rowsHeightCollection[f])&&(u._isRowViewable(r,f)?u.setHeightToRows([{rowIndex:f,height:h.rowHt}]):(c.rowsHeightCollection[f]=h.rowHt,u.XLScroll._getRowHeights(r,f)))),a={sheetIndex:r?r:u.getActiveSheetIndex(),rowIndex:f,colIndex:o,reqType:"edit",cValue:i,pValue:v?v:"",prevHeight:y,newHeight:c.rowsHeightCollection[f]},u._isPublic&&!u._dupDetails&&(u._completeAction(a),u._trigActionComplete(a)))}},_parseValue:function(i,r){var p;r&&this.getPropertyValue(r.rowIndex,r.colIndex,"type")=="text"||(p=this.XLObj._getlocaleNumVal(i),i=this.XLObj.isNumber(i)?Number(i):t.isNullOrUndefined(i)?"":typeof i=="object"&&!this.XLObj._isDateTime(i)?JSON.stringify(i):i);var h,f,w,l,b,a,y,k,o,e=this.XLObj,c=e.model.locale,s=t.Spreadsheet.CellType,d=t.Spreadsheet.Align.Right,u=typeof i=="object"&&!this.XLObj._isDateTime(i)?JSON.stringify(i):i+"",v=s.General,g=u.indexOf(e._currencySymbol);if(p&&(i=p),(g===0||g>-1&&g===u.length-1)&&(f=t.parseFloat(u,10,c),f))return o=u.indexOf(e._decimalSeparator)>-1?e._decimalCnt(f):0,{type:s.Currency,value:f,value2:u,formatStr:e._getFormatString(s.Currency,o),decimalPlaces:o,align:d};if(u.indexOf(e._percentSymbol)>-1&&(f=n.trim(u).replace(e._percentSymbol,""),e.isNumber(f)))return o=u.indexOf(e._decimalSeparator)>-1?e._decimalCnt(f):0,{type:s.Percentage,value:Number(f)/100,value2:u,formatStr:e._getFormatString(s.Percentage,o),decimalPlaces:o,align:d};if(y=t.preferredCulture(c),w=y.numberFormat[","]||",",a=new RegExp("\\"+w+"\\d{3}"),u.indexOf(e._decimalSeparator)>-1&&a.test(u)&&(f=t.parseFloat(u,10,c),f))return o=u.substr(u.indexOf(e._decimalSeparator)+1).length,o>2&&(o=2),u=t.format(f,"N"+o,c),{type:s.Number,value:f,value2:u,formatStr:e._getFormatString(s.Number,o),decimalPlaces:o,thousandSeparator:!0};if(u.indexOf(w)>-1)if(a.test(u)){if(f=t.parseInt(u,10,c),f)return o=0,u=t.format(f,"N"+o,c),{type:s.Number,value:f,value2:u,formatStr:e._getFormatString(s.Number,o),decimalPlaces:o,thousandSeparator:!0}}else i=u;l=y.calendar.patterns;b=!0;a=y.calendar._parseRegExp;for(h in l)if(a&&l[h]in a?f=new RegExp(a[l[h]].regExp).exec(u):(b=!1,f=t.parseDate(u,l[h],c)),f)break;return f&&(b&&(f=t.parseDate(u,l[h],c)),f)?(h==="T"||h==="t"||e.XLFormat._customFormatSpecifierType[h]===s.Time?(f.setYear(1990),f.setMonth(0),f.setDate(1),v=s.Time):v=h==="d"?s.ShortDate:h==="D"?s.LongDate:s.Date,k="{0:"+l[h]+"}",u=e.XLFormat._format(f,{type:v,formatStr:k}),{type:v,value:f,value2:u,formatStr:k,align:d}):((u.toLowerCase()==="true"||u.toLowerCase()==="false")&&(i=u=u.toUpperCase()),{type:v,value:i,value2:u})},updateCellWithContainer:function(n,i,r,u){var f=this.XLObj;if(!f.model.isReadOnly){for(var o,h,s,e,c,a=0,y=0,r=f._getSheetIndex(r),i=i?i:f.getSheet(r).selectedRange,l=f._getSelectedRange({rowIndex:i[0],colIndex:i[1]},{rowIndex:i[2],colIndex:i[3]}),v=l.length;a<v;)c=l[a],s=c.rowIndex,u&&f._isHiddenRow(s)||(h=c.colIndex,e=n[y],o=f.getCell(s,h,r),this._updateDataContainer(c,{dataObj:e}),this._refreshCalcEngine(s,h,f.isFormula(e.value),e.value),o&&e.format&&f.addClass(o[0],e.format),o&&e.hyperlink&&o.html(t.buildTag("a.e-hyperlinks",e.value2,"","cellAdr"in e.hyperlink?{href:"#"}:{href:e.hyperlink.webAdr,target:"_blank"})),e.comment&&f.XLComment.setComment([s,h,s,h],null,!1),e.border&&f.XLFormat.applyBorder(f.XLFormat.getBorderFromHashCode(e.border),f._getAlphaRange(r,s,h,s,h)),o&&(e.rule&&e.rule.isApply?f.addClass(o[0],"e-hlcell"):f._removeClass(o[0],"e-hlcell")),y++),a++;f.model.allowConditionalFormats&&f.XLCFormat.refreshCFormat(i)}},_refreshCellAlignment:function(n){n=n||{};var o,s,f=t.Spreadsheet.Align,i=this.XLObj,r=n.cellIdx.rowIndex,u=n.cellIdx.colIndex,e=this.getPropertyValue(r,u,"merge");f in n||(n.value=t.isNullOrUndefined(n.value)?this.getPropertyValue(r,u,"value"):n.value,i.isFormula(n.value)&&(n.value=i.XLEdit.getPropertyValue(r,u,"calcValue")),n.type=n.type?n.type:this.getPropertyValue(r,u,"type"),n.align=!i.isNumber(n.value)&&typeof n.value!="object"||n.type===t.Spreadsheet.CellType.Text||e&&e.isCenterAlign?i._isBool(n.value)||e&&e.isCenterAlign?f.Center:f.Left:f.Right);o=this.getPropertyValue(r,u,"align");i._isInitLoad&&!i.isImport&&(s=!0);(!n.align||o&&o!=n.align)&&i.clearRangeData([r,u,r,u],["align"],"","","",s);n.align&&this._updateDataContainer(n.cellIdx,{dataObj:{align:n.align},skipCell:s})},_editingHandler:function(i){var it,r,e,u,o,b,c,s,h,rt,l,k,p,d,ot,g,nt,a,st,lt,v,f,ut,ht,ft,w,tt,y,ct,et;if(!n(i.target).parents(".e-backstagecontent").length)if(r=this.XLObj,!(i.keyCode===61||!i.shiftKey&&i.keyCode===32||i.keyCode>=48&&i.keyCode<=59||i.keyCode>=65&&i.keyCode<=90||i.keyCode>=96&&i.keyCode<=111||i.keyCode===173||i.keyCode>=186&&i.keyCode<=192||i.keyCode>=219&&i.keyCode<=222)||i.ctrlKey||i.altKey)if(i.keyCode!==113||i.shiftKey||i.ctrlKey)if(i.keyCode===27&&this._isEdit)e=r.getActiveSheetIndex(),u=r.getSheet(e),s=u._activeCell.rowIndex,h=u._activeCell.colIndex,o=r.getCell(s,h),b=r._dataContainer.sheets[e],r.XLEdit.getPropertyValue(s,h,"wrap")&&r.XLEdit.getPropertyValue(s,h,"merge")&&(ht=r.getCell(s,h,e),ft=ht.find("#"+r._id+"_MergeWrap")[0]),c=s in b&&h in b[s]?b[s][h]:c,w=c?typeof c.value2=="string"?c.value2:r._dataContainer.sharedData[c.value]:"",r.isFormula(w)&&(w=this.getPropertyValue(s,h,"value2")),r.element.find("#"+r._id+"_Edit").hide(),it=r._isRowViewable(e,s),it?(ft?ft.innerHTML=w:this._refreshTextNode(o[0],w),r.setSheetFocus(),r._setRowHdrHeight(e,u._selectedCells[0].rowIndex)):r.model.allowFormulaBar&&r.updateFormulaBar(),this._isFormulaEdit&&n("#"+r._id+"_AutoComplete").data("ejAutocomplete").suggestionList.hide(),this._isEdit=this._isFormulaEdit=this._isFBarFocused=!1,r._getContent(e).find("td").removeClass(r._formulaBorder.join(" ").replace(/,/g," ")+" "+r._ctrlFormulaBorder.join(" ").replace(/,/g," ")),it&&(r.model.allowComments&&o.hasClass("e-commentcell")&&r.XLComment._visibleCmntCnt(o,!0),r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement(),o.removeClass("e-editedcell e-msie-edit")),r.model.showRibbon&&r.XLRibbon._enableRibbonIcons(),r._getContent(r.getActiveSheetIndex()).find(".e-error").remove(),t.isNullOrUndefined(r.XLCellNav)||(r.XLCellNav._isNavigate=!0);else if(i.keyCode===46)if(this._isEdit)r._ctrlKeyCount>0&&(r._ctrlKeyCount=0,r._formulaRange=[],r.XLSelection._clearBorder(r._formulaBorder.join(" ").replace(/,/g," ")+" "+r._ctrlFormulaBorder.join(" ").replace(/,/g," ")));else{if(r._preventctrlkey){r._showAlertDlg("Alert","CtrlKeyErrorAlert","CtrlKeyErrorAction",450);return}if(e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),lt=new RegExp("\\be-format.*?\\b","g"),v,f=u._selectedCells,text=r.getRangeData({range:[f[0].rowIndex,f[0].colIndex,f[f.length-1].rowIndex,f[f.length-1].colIndex]}),r.model.allowLockCell&&u.isSheetProtected&&r._isPropExists([u.selectedRange],"isLocked",e))return;if(r._isPropExists([u.selectedRange],"isReadOnly",e))return;if(!this._isEdit){for(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),tt=r.model.sheets[e].tableManager,ct=r.getObjectKeys(tt),g=0,nt=r.getObjectLength(tt);g<nt;g++)if(y=tt[ct[g]].range,r.XLClipboard._compareRange([f[0].rowIndex,f[0].colIndex,f[f.length-1].rowIndex,f[f.length-1].colIndex],y)){st=r._getAlphaRange(e,y[0],y[1],y[2],y[3]);r.clearAll(st);return}for(r._hasClass(o,"e-readonly")||r.clearRangeData(null,["value2","value","hyperlink"]),rt=f[0].rowIndex,p=0,ot=f.length;p<ot;p++)if(l=f[p].rowIndex,k=f[p].colIndex,r._textClip(l,k,"delete"),!this.getPropertyValue(l,k,"isReadOnly")){if(r.model.allowFormulaBar&&r._getInputBox().val(""),v=this.getPropertyValue(l,k,"cFormatRule"),r.model.allowConditionalFormats&&v&&v.length)for(d=0,nt=v.length;d<nt;d++)a=v[d].split("_"),r.XLCFormat._cFormat(a[0],a[2],a[3],a[4],a[5]);rt!==l&&(r._setRowHdrHeight(e,l),rt++)}r.XLSelection._refreshBorder()}ut={sheetIndex:e,range:[f[0].rowIndex,f[0].colIndex,f[f.length-1].rowIndex,f[f.length-1].colIndex],bData:text,reqType:"clear-content"};r._completeAction(ut);r._trigActionComplete(ut)}else i.ctrlKey||i.shiftKey||i.keyCode!==8?(i.keyCode!==13||i.altKey)&&i.keyCode!==9||!this._isEdit||!r.model.allowKeyboardNavigation||r.XLCellNav._isNavigate||this._isFormulaEdit?i.keyCode===13&&i.altKey&&this._isEdit&&(i.preventDefault(),et=r.element.find("#"+r._id+"_Edit"),et.focus(),et.altEnter()):(i.preventDefault(),t.isNullOrUndefined(r.XLCellNav)||(r.XLCellNav._isNavigate=!0)):(e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this._isEdit||r._hasClass(o,"e-readonly")||r._hasClass(o,"e-cellreadonly")||(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this.editCell(u._activeCell.rowIndex,u._activeCell.colIndex,!1),r._setRowHdrHeight(e,u._activeCell.rowIndex),r.model.allowFormulaBar&&r._getInputBox().val("")));else e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this._isFEdit=!0,this._isEdit||r._hasClass(o,"e-readonly")||r._hasClass(o,"e-cellreadonly")||(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),r.XLCellNav._navToCell(u._activeCell.rowIndex,u._activeCell.colIndex),this.editCell(u._activeCell.rowIndex,u._activeCell.colIndex,!0));else e=r.getActiveSheetIndex(),u=r.getSheet(e),o=r.getCell(u._activeCell.rowIndex,u._activeCell.colIndex),this._isEdit||r._hasClass(o,"e-readonly")||r._hasClass(o,"e-cellreadonly")||(r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom"),r.XLCellNav._navToCell(u._activeCell.rowIndex,u._activeCell.colIndex),this.editCell(u._activeCell.rowIndex,u._activeCell.colIndex,!1))},_focusElements:function(t){n(t).not(":hidden").focus().setInputPos(n(t).text().length)},_updateUsedRange:function(n,t){var r=this.XLObj,i=r.getSheet(r.getActiveSheetIndex()).usedRange;i.rowIndex<n&&(i.rowIndex=n);i.colIndex<t&&(i.colIndex=t)},_updateDataContainer:function(i,r){var g,pt,k,l,w,nt,et,ot,st,o,f,c,h,tt,v,y,ht,ct,lt,at,wt,p,it,d,bt,kt,rt,b,vt,ut,yt=!1,s=r.dataObj,u=this.XLObj,a=u._getSheetIndex(r.sheetIdx),ft=u.getSheet(a),dt,gt,e;if(!r.skipCell&&u._isRowViewable(a,i.rowIndex)&&(k=u.getCell(i.rowIndex,i.colIndex,a),l=k[0]),s){ot=t.Spreadsheet.CellType;st=t.Spreadsheet.Align;p=u._dataContainer;v=i.colIndex;y=i.rowIndex;h=u._cellProp;it=p.sheets[a];y in it?(d=it[y],v in d?o=d[v]:d[v]=o={}):(d=it[y]={},d[v]=o={});l&&(u._hasClass(l,"e-sswraptext")&&(u._removeClass(l,"e-sswraptext"),u.addClass(l,"e-sswraptext")),this.getPropertyValue(i.rowIndex,i.colIndex,"wrap",a)&&this.getPropertyValue(i.rowIndex,i.colIndex,"merge",a)&&(w=k.find("#"+u._id+"_MergeWrap")[0],w&&(b=w.lastChild,b?b.nodeType===1?(u._hasClass(b,"e-hyperlinks")&&(b.textContent=""),u._hasClass(b,"e-comment")&&(b.lastChild.textContent="")):b.textContent="":w.textContent="",nt=w.innerHTML,w.remove())));for(e in s){c=s[e];switch(e){case h[0]:case h[4]:case h[5]:case h[11]:f=p.sharedData.indexOf(c);f===-1&&(f=p.sharedData.push(c),f--);o[e]=f;ft._isLoaded&&e===h[0]&&!u._intrnlUpdate&&(yt=!0);break;case h[1]:if(rt=this.getPropertyValue(y,v,"value2",a),s.type&&s.type!=ot.General&&s.type!=ot.Text?o[e]=s.value2:(f=p.sharedData.indexOf(s.value2),f===-1&&(f=p.sharedData.push(s.value2),f--),o[e]=f),l&&!("cellType"in s)){if(wt=l.getElementsByTagName("a"),wt.length)this._refreshTextNode(l,s.value2);else if(o[h[24]]>-1){if(lt=p.sheetCellType[o[h[24]]],at=lt.id,n("#"+at).length===0)return;if(s.value2)switch(lt.type){case"Button":n("#"+at).ejButton("instance").option("text",s.value2)}}else ht=s.value2.toString().length>7&&!isNaN(new Date(s.value2).valueOf()),ct=["true","yes","false","no"].indexOf(s.value2.toString().toLowerCase())>-1,u.model.allowCellType&&u.model.allowAutoCellType&&(ht||ct)?ht?(u.XLCellType._rangeCellTypes([{type:"DatePicker",range:u._getAlphaRange(a,y,v,y,v)}],a,!0),n("#"+u._dataContainer.sheetCellType[o[h[24]]].id).ejDatePicker("instance").option("value",s.value2)):ct&&(u.XLCellType._rangeCellTypes([{type:"CheckBox",range:u._getAlphaRange(a,y,v,y,v)}],a,!0),n("#"+u._dataContainer.sheetCellType[o[h[24]]].id).ejCheckBox("instance").option("checked",["true","yes"].indexOf(s.value2.toString().toLowerCase())>-1?!0:!1)):this._skipHTML?l.innerHTML.concat(s.value2):this._refreshTextNode(l,s.value2);this._refreshCellAlignment({cellIdx:i,value:s.value,type:s.type})}u.model.allowOverflow&&u._canOverflow?(rt||s.value2)&&(vt=t.isNullOrUndefined(rt)?!0:rt.length<=s.value2.length?!0:!1,u._textClip(y,v,vt?"add":"delete"),!vt&&s.value2.length>0&&u._textClip(y,v,"add")):u._canOverflow&&u.refreshOverflow([y,v,y,v],a);o.isDirty=!0;break;case h[2]:o[e]=p.cellType.indexOf(s.type);break;case h[3]:for(g=0,pt=c.length;g<pt;)f=p.cFormatData.indexOf(c[g]),f===-1&&(f=p.cFormatData.push(c[g]),f--),o[e]?o[e].indexOf(f)===-1&&o[e].push(f):o[e]=[f],g++;break;case h[6]:f=p.valData.indexOf(c.customVal);f===-1&&(f=p.valData.push(c.customVal),f--);o[e]=JSON.parse(JSON.stringify(c));o[e].customVal=f;break;case h[7]:case h[8]:l&&(bt=e===h[8]?"e-border":"e-format",kt=new RegExp("\\b"+bt+".*?\\b","g"),l.className=l.className.replace(kt,""),u.addClass(l,c));f=p.hashCode.indexOf(c);f===-1&&(f=p.hashCode.push(c),f--);o[e]=f;break;case h[9]:case h[10]:case h[26]:o[e]?o[e].indexOf(c)===-1&&o[e].push(c):o[e]=[c];break;case h[12]:o[e]=c;l&&(c===st.Center?u.addClass(l,u._cAlign):c===st.Right?u.addClass(l,u._rAlign):n(l).removeClass(u._rAlign+" "+u._cAlign));break;case h[14]:case h[16]:ut=u.XLFormat.getFormatHashCode(c);f=p.hashCode.indexOf(ut);f===-1&&(u.XLFormat._createFormatClass(c,ut),f=p.hashCode.push(ut),f--);o[e]=f;break;case h[15]:case h[17]:c=u.XLFormat._getBorderHashCode(c,!0);f=p.hashCode.indexOf(c);f===-1&&(f=p.hashCode.push(c),f--);o[e]=f;break;default:o[e]=c}}if(this._updateUsedRange(i.rowIndex,i.colIndex),yt&&(u.model.allowCharts&&u.XLChart._refreshChartElements(y,v,a),u.model.allowConditionalFormats&&u.XLCFormat._refreshCFormatFormula(y,v,a),u._updateBatchDetails(y,v,a),yt=!1),l&&this.getPropertyValue(i.rowIndex,i.colIndex,"wrap",a)&&this.getPropertyValue(i.rowIndex,i.colIndex,"merge",a)&&(dt=this.getPropertyValue(i.rowIndex,i.colIndex,"merge",a),gt=ft._rowHeightCollection[i.rowIndex+dt.mSpan.rowSpan]-ft._rowHeightCollection[i.rowIndex]||Math.floor(k.height()),u._isRowViewable(a,i.rowIndex)&&(et=this.getPropertyValue(i.rowIndex,i.colIndex,"value2",a),this._refreshTextNode(l),nt=nt?nt.concat(s.value2||et):s.value2||et,w=k.find("#"+u._id+"_MergeWrap")[0],w||(l.innerHTML="<div id ="+u._id+"_MergeWrap style = 'border :0px;overflow: hidden;max-height:"+(gt-1)+"px'>"+l.innerHTML.concat(nt||"")+"<\/div>",w=k.find("#"+u._id+"_MergeWrap")[0]),child=w.children,child.length)))for(e=0;e<child.length;e++)u._hasClass(w.children[e],"e-comment")&&(w.children[e].lastChild.textContent=this.getPropertyValue(i.rowIndex,i.colIndex,"comment",a).value),u._hasClass(w.children[e],"e-hyperlinks")&&(w.lastChild.textContent="",w.children[e].textContent=this.getPropertyValue(i.rowIndex,i.colIndex,"value2",a));(Object.keys?Object.keys(o).length:u.getObjectLength(o))===3&&(tt=u.getRangeData({range:[y,v,y,v],property:h.slice(0,3)})[0],tt.value===""&&tt.value2===""&&tt.type===t.Spreadsheet.CellType.General&&u.clearRangeData([y,v,y,v],h.slice(0,3)));!ft._isLoaded||u.isDirty||u._intrnlReq||u.isImport||(u.isDirty=!0)}else l&&this._refreshTextNode(l)},_clearDataContainer:function(i){var y,u,p,o,l,d,a,w,b,g=!1,e=this.XLObj,c=e._getSheetIndex(i.sheetIdx),s=e._cellProp,r=i.cellIdx.rowIndex,f=i.cellIdx.colIndex,k=i.property||[],nt=!1,tt,v,it=e._dataContainer,h=it.sheets[c];if(k.length&&r in h&&f in h[r]){for(a=h[r][f],y=k.length,!i.skipCell&&e._isRowViewable(c,r)&&(u=e.getCell(r,f,c));y--;){value=null;b=!1;o=k[y];switch(o){case s[0]:value=this.getPropertyValue(r,f,o,c);e._updateBatchDetails(r,f,c);b=!0;break;case s[1]:d=this.getPropertyValue(r,f,"value2");u&&this._refreshTextNode(u[0]);d&&(g=!0);break;case s[3]:value=this.getPropertyValue(r,f,o,c);value&&u&&n(u).removeClass("e-redft e-yellowft e-greenft e-redf e-redt");break;case s[7]:case s[8]:value=this.getPropertyValue(r,f,o,c);value&&u&&e._removeClass(u[0],value);break;case s[14]:value=this.getPropertyValue(r,f,o,c);value&&value["text-align"]&&value["text-align"]==="right"&&u&&e._removeClass(u[0],"e-rightalign");break;case s[12]:value=a[o];value&&u&&e._removeClass(u[0],value===t.Spreadsheet.Align.Center?e._cAlign:e._rAlign);break;case s[13]:if(value=a[o],value&&u){if(w=u[0].lastChild.textContent,i.status==="clear-content"){u[0].lastChild.textContent="";break}else if(i.status==="clear-format"){p=u.find("a");e._hasClass(p[0],"e-hyperlinks")&&p.css({color:"#444445","text-decoration":"none"}).removeClass("e-hyperlinks");break}u.find("a").remove();t.isNullOrUndefined(u[0].lastChild)?u[0].textContent=w:u[0].lastChild.textContent=w}break;case s[18]:value=a[o];value&&u&&(u.removeClass("e-filterhdr"),u.find(".e-filterspan").remove());break;case s[21]:e.XLComment&&e.XLComment.deleteComment([r,f,r,f]);break;case s[5]:case s[22]:case s[23]:nt||(value=this.getPropertyValue(r,f),v={decimalPlaces:0,thousandSeparator:!1,formatStr:"",type:"general",value:value},v.value2=tt=e.XLFormat._getFormattedValue(r,f,v,value),e.XLEdit._updateDataContainer({rowIndex:r,colIndex:f},{dataObj:v}),nt=!0);break;case s[25]:delete h[r][f][o]}i.status==="clear-content"&&o==="hyperlink"?this.getPropertyValue(r,f,o,c)&&(delete h[r][f][o].webAddr,delete h[r][f][o].cellAddr):delete h[r][f][o];o==="wrap"&&u&&(l=u.find("#"+e._id+"_MergeWrap"),l.length&&(u[0].innerHTML=l[0].innerHTML,l.remove()));b&&(this._refreshCalcEngine(r,f,!1,value),e.model.allowCharts&&(e.XLChart._refreshChartElements(r,f,c),e.XLChart._afterChartRefresh()))}g&&e._textClip(r,f,"delete");e.getObjectLength(h[r][f])||delete h[r][f];e.getObjectLength(h[r])||delete h[r]}},getPropertyValue:function(i,r,u,f){var e,o,s,l,y,p,h=this.XLObj,c=h._dataContainer,a=c.sheets,v=h._cellProp;if(f=h._getSheetIndex(f),h._intrnlUpdate||this._refreshContainer(i,f),a[f]&&a[f][i]&&a[f][i][r]&&(o=a[f][i][r],o)){u=u||"value";s=o[u];switch(u){case"value":case"range":case"thousandSeparator":case"calcValue":e=c.sharedData[s];break;case"format":case"border":e=c.hashCode[s];break;case"value2":p=t.Spreadsheet.CellType;e=!h.isUndefined(o.type)&&[p.General,p.Text].indexOf(c.cellType[o.type])===-1?o.value2:c.sharedData[o.value2];break;case"type":e=c.cellType[o.type];break;case"cFormatRule":for(l=y=0,e=[],h.isUndefined(s)||(y=s.length);l<y;)o[u][l]in c.cFormatData&&e.push(c.cFormatData[o[u][l]]),l++;break;case"rule":h.isUndefined(s)||(e={},n.extend(!0,e,s),e.customVal=c.valData[e.customVal]);break;case v[14]:case v[15]:case v[16]:case v[17]:h.isUndefined(s)||(e=c.hashCode[s],e=e.indexOf("e-format")===-1?h.XLFormat.getBorderFromHashCode(e,!0):h.XLFormat.getFormatFromHashCode(e));break;default:e=s}}return e},_refreshContainer:function(n,t){var r,i=this.XLObj,u=i.getSheet(t);!u._isImported&&u._hasDataSrc&&(i._intrnlUpdate=!0,i.model.scrollSettings.allowVirtualScrolling?(r=i._getBlockInfo(n,t,!0),u._virtualDataMngrLoadedBlks.indexOf(r.orgIdx)===-1&&(u._virtualDataMngrLoadedBlks.push(r.orgIdx),this._ensureDataMngr(r.orgRange,t)),u._virtualDataLoadedBlks.indexOf(r.orgIdx)===-1&&(u._virtualDataLoadedBlks.push(r.orgIdx),i._canOverflow=!1,i._refreshDataSrc(r.orgRange,t),i._refreshCellData(r.orgRange,t),i._canOverflow=!0,i._refreshOverflow(r.orgRange))):u._isLoaded||u._isDataMoved||(u._isDataMoved=!0,i._canOverflow=!1,i._refreshDataSrc(null,t),i._refreshCellData(null,t),i._canOverflow=!0,i._refreshOverflow()),i._intrnlUpdate=!1)},_ensureDataMngr:function(n,i){var e,u,r,o=0,h=this.XLObj,s=h.getDataSettings(i),c,f;if(s)for(c=s.length;o<c;)r=s[o],h._inRow(r.range,n[0])&&r._dataManager&&(u=this._getQueryPropWithValues(n.slice(0),r.range),f=t.pvt.filterQueries(r.query.queries,"onSkip"),e=u.skip||0,r._skip&&(e+=r._skip),e&&(f.length?f[0].e.nos=e:r.query.skip(e)),f=t.pvt.filterQueries(r.query.queries,"onTake"),u.take&&(f.length?f[0].e.nos=u.take:r.query.take(u.take)),r._dataManager.dataSource.async=!1,promise=r._dataManager.executeQuery(r.query),promise.done(function(n){if(len=n.result.length,len)for(k=0;k<len;)r._jsonData[u.skip+k]=n.result[k],k++}),r._dataManager.dataSource.async=!0),o++},_getQueryPropWithValues:function(n,t){var i,r={},u=this.XLObj;return i=n[0]-t[0],r.skip=i,t[2]<n[2]&&(n[2]=t[2]),u._inRow(t,n[2])&&(i=n[2]-n[0]+1,r.take=i),r},getPropertyValueByElem:function(n,i,r){if(!t.isNullOrUndefined(n[0])){var u;return u=n.hasClass("e-hyperlinks")?this.XLObj._getCellIdx(n.parent()[0]):this.XLObj._getCellIdx(n[0]),this.getPropertyValue(u.rowIndex,u.colIndex,i,r)}},_getPropWithCellIdx:function(n,t,i,r){for(var f,o=[],u=n[0],h=n[2],c=n[3],e=this.XLObj,i=e._getSheetIndex(i),s=e._dataContainer.sheets[i];u<=h;){if(s[u])for(minc=n[1];minc<=c;)s[u][minc]&&(f=this.getPropertyValue(u,minc,t,i),e.isUndefined(f)||(r?e.isFormula(f)&&o.push({rowIdx:u,colIdx:minc,value:f}):o.push({rowIdx:u,colIdx:minc,value:f}))),minc++;u++}return o},_refreshCalcEngine:function(n,i,r,u,f){var l,h,e,s=this.XLObj,f=s._getSheetIndex(f),c=s.getSheet(f),o=s._calcEngine;r?(u=this._parseSheetRef(u),l=new ValueChangedArgs(n+1,i+1,u),o.valueChanged(c.sheetInfo.value,l),s._applyFormula(f,n,i)):(h=CalcEngine.getSheetFamilyItem(c.sheetInfo.value),e=RangeInfo.getAlphaLabel(i+1)+(n+1),o.isSheetMember()&&!t.isNullOrUndefined(h.parentObjectToToken)&&(e=h.parentObjectToToken.getItem(c.sheetInfo.value)+e),o.getFormulaInfoTable().containsKey(e)&&(o.getFormulaInfoTable().remove(e),o.getDependentCells().contains(e)&&o.clearFormulaDependentCells(e)),o.refresh(e))},_parseSheetRef:function(n,t){for(var u,i=0,f=this.XLObj,h=f.model.sheetCount,e=[],s=[],r=f._getSheetNames(),o='(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)';i<r.length;)s.push(r[i].text),i++;for(i=0;i<h;i++)r[i].value!==r[i].text&&(u=new RegExp(r[i].text+o,"gi"),n.match(u)&&(n=n.replace(u,i+"/"),e.push(i)),s.indexOf(r[i].value)<0&&n.indexOf(r[i].value)>-1&&!t&&(u=new RegExp(r[i].value+o,"gi"),n.match(u)&&(n=n.replace(u,f._newSIndex+"/"),e.push(f._newSIndex))));for(i=0;i<e.length;)u=new RegExp(e[i]+"/"+o,"gi"),n=n.replace(u,e[i]===f._newSIndex?f._generateSheetName(f._newSIndex):r[e[i]].value),i++;return n},_refreshTextNode:function(n,i){var u=this.XLObj,r;i=t.isNullOrUndefined(i)?"":i;u.isUndefined(n)||(r=n.lastChild,r&&(r.nodeType===3||r.nodeType===1&&r.tagName==="A")?u._browserDetails.name==="msie"&&u._browserDetails.version==="8.0"?r.nodeValue=i:r.textContent=i:n.appendChild(document.createTextNode(i)))},_formulaSelect:function(n){var t=value=n.text;this.XLEdit._isNamedRange(value)||t.slice(1)=="TRUE"||t.slice(1)=="FALSE"||(t+="(");this.XLEdit._editElem.text(t);this.model.allowFormulaBar&&this._getInputBox().val(t);this.XLEdit._editElem.focusEnd();this._isFormulaSuggestion=!1;this.XLCellNav._canKeyBoardNavigate=!1},_isNamedRange:function(n){var i=this.XLObj.model.nameManager,t=i.length;if(n=n.slice(1),t)while(t--)if(i[t].name.toUpperCase()===n.toUpperCase())return!0;return!1},_formulaBoxInputChange:function(n){var r=this.getActiveSheetIndex(),t=this.getSheet(r)._activeCell,i=this.element.find("#"+this._id+"_Edit");this.XLEdit._isFormulaEdit=!n.target.value.indexOf("=");this.XLEdit._isFormulaEdit&&this.XLEdit._processFormulaEditRange(n.target.value,!0);this.XLEdit._isEdit||(this.XLCellNav._navToCell(t.rowIndex,t.colIndex),this.XLEdit.editCell(t.rowIndex,t.colIndex,!0),i=this.element.find("#"+this._id+"_Edit"));i.text(n.target.value);n.target.focus();this.XLEdit._isCellEdit=!1},_formulaSuggestionStatus:function(n){this._isFormulaSuggestion=n.type==="open"},_updateFormulaCellRange:function(n,t){var u,r=this.XLObj,f=r.element.find("#"+r._id+"_Edit").not(":hidden"),i=f.text(),e=i[i.length-1];t&&this._validCharacters.indexOf(e)===-1?i=i+",":(u=this._getCharPosition(i),u>-1&&(i=i.substr(0,[u+1])));n=i+n;f.text(n);this._editElem.focusEnd();r.model.allowFormulaBar&&r._getInputBox().val(n)},_getCharPosition:function(n){for(var t=n.length;t--;)if(this._validCharacters.indexOf(n[t])>-1)return t;return-1},_processFormulaEditRange:function(t,i){var u,e,f=0,r=this.XLObj,o=r.XLDragFill._parseFormula(t),s=o.length;for(r._ctrlKeyCount=0,r._formulaRange=[],r.XLSelection._clearBorder(r._arrayAsString(r._ctrlFormulaBorder.concat(r._formulaBorder)));f<s;){if(u=o[f],this._invalidOperators.indexOf(u)>-1)break;r._isCellReference(u)&&(u=u.replace(/\$/g,""),o[f+1]===":"&&(f++,r._isCellReference(o[f+1])&&(u=u+":"+o[f+1],f++)),this._updateFormulaEditRange(u,r._ctrlKeyCount),r._ctrlKeyCount++);f++}e=t.charAt(t.length-1);e==="("&&t.split("(").length===2?(r._isFormulaSuggestion=!1,r.model.allowFormulaBar&&r._getInputBox().val(t),i?n("#"+r._id+"_inputbox_suggestion").hide():r._getFormulaSuggElem().hide()):e===")"&&r.isFormula(t)&&(r.XLEdit._isFormulaEdit=!1,r._formulaRange=[],r._ctrlKeyCount=0);e===":"?(r._shiftKeyEnabled=!0,r._ctrlKeyCount--):this._validOperators.indexOf(e)>-1&&(r._dStartCell=r.getSheet(r.getActiveSheetIndex())._activeCell,r._shiftKeyEnabled=!1)},_updateFormulaEditRange:function(n,t){var i=this.XLObj,r=i.getRangeIndices(n);i._formulaRange[t]=n;i._dStartCell={rowIndex:r[0],colIndex:r[1]};i._dEndCell={rowIndex:r[2],colIndex:r[3]};i.XLSelection._focusBorder(i._dStartCell,i._dEndCell,i._formulaBorder[t%6])},calcOption:function(t){var i=this.XLObj,u,f,e,r,o;if(!i.model.isReadOnly){for(e=i.getActiveSheetIndex(),t?(n("#"+i._id+"_CalcAuto").find("span").addClass("e-ss-calcauto"),n("#"+i._id+"_CalcManual").find("span").removeClass("e-ss-calcauto")):(n("#"+i._id+"_CalcManual").find("span").addClass("e-ss-calcauto"),n("#"+i._id+"_CalcAuto").find("span").removeClass("e-ss-calcauto")),r=1,o=i._sheets.length;r<o;r++)u=i._calcEngine,t?(u.setCalculatingSuspended(!1),f=i.getSheet(r).usedRange,i.setActiveSheetIndex(r),u.grid=i.model.sheets[r].sheetInfo.value,u.refreshRange(RangeInfo.cells(1,1,f.rowIndex+1,f.colIndex+1))):u.setCalculatingSuspended(!0);i.setActiveSheetIndex(e)}},calcNow:function(n){var t=this.XLObj;if(!t.model.isReadOnly){var i=1,r,u,e=t._sheets.length,o=t.getActiveSheetIndex(),f;for(n&&(i=n,e=n+1);i<e;)r=t._calcEngine,r.setCalculatingSuspended(!1),u=t.getSheet(i).usedRange,t.setActiveSheetIndex(i),r.grid=t.model.sheets[i].sheetInfo.value,r.refreshRange(RangeInfo.cells(1,1,u.rowIndex+1,u.colIndex+1)),r.setCalculatingSuspended(!0),i++;t.setActiveSheetIndex(o);f={sheetIndex:o,reqType:"calc-now"};t._completeAction(f);t._trigActionComplete(f)}},_rangeHasProperty:function(n,t,i){n&&(i=this.XLObj.getRangeData({range:n,property:[t]}));for(var r=0,u=i.length;r<u;){if(!this.XLObj.isUndefined(i[r][t]))return!0;r++}},saveEditingValue:function(){var c=this.XLObj;if(!c.model.isReadOnly){var r,u,t,f,n,i,l,a,e,o={},s,v,y,p=c._dataContainer,h;for(f=Object.getOwnPropertyNames(p.sheets),o.EditedData=[],t=0,l=f.length;t<l;t++)for(conSheet=p.sheets[f[t]],e=Object.getOwnPropertyNames(conSheet),r=0,v=e.length;r<v;r++)for(n=parseInt(e[r]),s=Object.getOwnPropertyNames(conSheet[n]),u=0,y=s.length;u<y;u++)i=parseInt(s[u]),conSheet[n][i].isDirty&&(h=parseInt(f[t]),a={SheetIndex:h,Value:this.getPropertyValue(n,i,"value2",h),CellIndex:{RowIndex:n,ColIndex:i}},delete conSheet[n][i].isDirty,o.EditedData.push(a));return o}}};n.fn.focusEnd=function(){var r;n(this).focus();var u=n("<span />").appendTo(n(this)),f=u.get(0),t=null,i=null;return document.selection?(t=document.body.createTextRange(),t.moveToElementText(f),t.select()):window.getSelection&&(r=this[0],t=document.createRange(),i=window.getSelection(),t.setStart(r,1),t.collapse(!0),i.removeAllRanges(),i.addRange(t),r.focus()),u.remove(),this};n.fn.altEnter=function(){var n,t,i,u,f,e,r;n=window.getSelection();t=n.anchorNode;i=n.anchorOffset;u=t.textContent;f=u.slice(0,i);e=u.slice(i)||" ";t.textContent=f+"\n"+e;r=document.createRange();r.setStart(t,i+1);r.setEnd(t,i+1);n.removeAllRanges();n.addRange(r)};n.fn.setCursorPosition=function(n){var u=this,t,i,r;u.focus();t=u[0].firstChild;i=document.createRange();t&&(i.setStart(t,n),i.setEnd(t,n));r=window.getSelection();r.removeAllRanges();r.addRange(i)}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.validation=function(n){this.XLObj=n;this._ruleSymbols={Greater:">",GreaterOrEqual:">=",Less:"<",LessOrEqual:"<=",Equal:"==",NotEqual:"!=",Between:">=&&<=&&=",NotBetween:">=&&<=&&!"};this._isErrorVisible=!1};t.spreadsheetFeatures.validation.prototype={_setValidation:function(){this.XLObj.model.allowDataValidation&&n.validator&&(this._initValidator(),this._setValidationToField())},_initValidator:function(){var i=n("#"+this.XLObj._id+"EditForm");t.isOnWebForms&&n.data(i[0],"validator",null);i.validate({errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,r){var u=n("#"+n(r).data("id")).data("ejSpreadsheet"),o=u._getJSSheetContent(u.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content"),f=u.XLEdit._editCell,e=n(i).addClass("e-error");o.append(e);e.prepend(t.buildTag("div.e-errortail e-toparrow"));e.css({left:f[0].offsetLeft,top:f[0].offsetTop+f.height()});u.XLValidate._isErrorVisible=!0}})},_setValidationToField:function(){var n=this.XLObj,i=n.XLEdit.getPropertyValueByElem(n.getActiveCellElem(),"rule"),r;delete i.type;delete i.isApply;delete i.isHighlight;n.element.find("#"+n._id+"_ValElem").rules("add",i);r=n.element.find("#"+n._id+"EditForm").validate();t.isNullOrUndefined(i.required)||(r.settings.messages[name]={},r.settings.messages[name].required=n.XLEdit._EditCellDetails.fieldName+(n.XLEdit._EditCellDetails.rowIndex+1)+" is required");n.XLEdit._isValidation=!0},applyDVRules:function(n,r,u,f,e){var h,a,p,c={},o=this.XLObj,l=o.getActiveSheetIndex(),w=o.getSheet(l),b=!1,k,s,d,g,nt,tt,y,v;switch(u){case"decimal":if(parseFloat(r[1])>parseFloat(r[2])){o._showAlertDlg("Alert","NumberValidationAlert","",400);return}break;case"date":if(new Date(r[1])>new Date(r[2])){o._showAlertDlg("Alert","DateValidationAlert","",400);return}break;case"time":if(g=Date.parse("01/01/1990 "+r[1]),nt=Date.parse("01/01/1990 "+r[2]),r[2]&&r[2].length&&g>nt){o._showAlertDlg("Alert","TimeValidationAlert","",400);return}break;default:if(parseInt(r[1])>parseInt(r[2])){o._showAlertDlg("Alert","NumberValidationAlert","",400);return}}if(!o.model.isReadOnly&&o.model.allowDataValidation&&(o.model.allowSelection||!t.isNullOrUndefined(n))){k=o._getRangeArgs(n,"object");s=o._getSelectedCells(l,k).selCells;o._showDialog(o._id+"_Ribbon_Data_DataTools_DataValidation");c.required=!f;(r[0]!="Between"||r[0]!="NotBetween")&&r.length<3&&r.push("");switch(u){case"number":r.push("parseInt");c.digits=!0;r.push("number");break;case"decimal":r.push("parseFloat");c.number=!0;r.push("decimal");break;case"date":r.push("parseDate");c.date=!0;r.push("date");break;case"time":r.push("parseTime");r.push("time");break;case"text":r[1]="^"+r[1];r[2]="^"+r[2];r.push("length");r.push("text");break;case"list":tt=r[1];r=[];r.push(tt);r.push("list")}for(r.push(e),r.push(n?n:o._getSelectedItems(l,n)[1]),r.push(l),c.customVal=r.join("_"),c.isApply=!1,c.type=u,y=[],v={},i=0,len=s.length;i<len;i++)v={rowIndex:s[i].rowIndex,colIndex:s[i].colIndex,prevRule:o.XLEdit.getPropertyValue(s[i].rowIndex,s[i].colIndex,"rule")},o._isRowViewable(l,s[i].rowIndex)&&(a=o.getCell(s[i].rowIndex,s[i].colIndex),a.hasClass("e-hlcell")&&(b=!0),a.removeData("rule"),a.removeClass("e-hlcell")),o.XLEdit._updateDataContainer({rowIndex:s[i].rowIndex,colIndex:s[i].colIndex},{dataObj:{rule:c}}),o.model.actionComplete!==null&&(v.newRule=o.XLEdit.getPropertyValue(s[i].rowIndex,s[i].colIndex,"rule")),y.push(v);b===!0&&this.highlightInvalidData();w._isImported&&!w._isLoaded||o._isUndoRedo||o._isExport||(d=r[2]==""?[r[0],r[1]]:[r[0],r[1],r[2]],h={showErrorAlert:r[5],values:d,required:!c.required,rule:c,sheetIndex:l,reqType:"validation",operation:"apply-validation",selectedCell:y,range:o._getAlphaRange(l,s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex)},p={showErrorAlert:h.showErrorAlert,values:h.values,isRequired:h.required,rule:h.rule,sheetIndex:h.sheetIndex,reqType:h.reqType,operation:h.operation,selectedCell:h.selectedCell,range:h.range},o._completeAction(h),o._trigActionComplete(p))}},clearDV:function(n){var i=this.XLObj,o,r,s,e,f,u,h;if(i.model.allowDataValidation&&!i.model.isReadOnly&&i.model.allowSelection){for(e=i.getActiveSheetIndex(),f={sheetIndex:e,reqType:"validation",operation:"clear-validation",selectedCell:[]},s=i._getRangeArgs(n,"object"),r=i._getSelectedCells(e,s).selCells,u=0,h=r.length;u<h;u++)f.selectedCell.push({rowIndex:r[u].rowIndex,colIndex:r[u].colIndex,rules:i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"rule")}),i.clearRangeData([r[u].rowIndex,r[u].colIndex,r[u].rowIndex,r[u].colIndex],["rule"]),i._isRowViewable(e,r[u].rowIndex)&&(o=i.getCell(r[u].rowIndex,r[u].colIndex),t.isNullOrUndefined(i._ddlCell)||(i.element.find("#"+i._id+"ddl").ejDropDownList("hidePopup"),i.element.find("#"+i._id+"ddlspan").remove(),i._ddlCell=null),f.hlStatus=o.hasClass("e-hlcell"),o.removeClass("e-hlcell"));f.range=i._getAlphaRange(e,r[0].rowIndex,r[0].colIndex,r[r.length-1].rowIndex,r[r.length-1].colIndex);i._isUndoRedo||i._dupDetails||(i._completeAction(f),i._trigActionComplete(f))}},clearHighlightedValData:function(n){var r=this.XLObj,i,o,s,f,u,h,e;if(r.model.allowDataValidation&&!r.model.isReadOnly){for(f=r.getActiveSheetIndex(),o=r._getRangeArgs(n,"object"),i=r._getSelectedCells(f,o).selCells,u=0,h=i.length;u<h;u++)r._isRowViewable(f,i[u].rowIndex)&&(s=r.getCell(i[u].rowIndex,i[u].colIndex),s.removeClass("e-hlcell")),t.isNullOrUndefined(r.XLEdit.getPropertyValue(i[u].rowIndex,i[u].colIndex,"rule"))||(r._dataContainer.sheets[f][i[u].rowIndex][i[u].colIndex].rule.isApply=!1);r._isUndoRedo||(e={sheetIndex:f,reqType:"validation",operation:"cl-hl-data",range:t.isNullOrUndefined(n)?this.XLObj._getAlphaRange(1,i[0].rowIndex,i[0].colIndex,i[i.length-1].rowIndex,i[i.length-1].colIndex):n},r._completeAction(e),r._trigActionComplete(e))}},_checkValidation:function(n,i,r,u){var f=this.XLObj,v,c,e,l,a,o,s,h;if(u=f._getSheetIndex(u),!JSON.parse(i[i.length-3])&&!r)return!0;if(n=this._convertValueByType(n,i[4]),i[1]=this._convertValueByType(i[1],i[4]),i[2]=this._convertValueByType(i[2],i[4]),n.length){if(i[i.length-4]==="list"){for(a=!1,i[0].indexOf(",")>-1?c=i[0].split(","):i[0].indexOf("=")>-1?(e=i[0].split("=")[1],c=e.indexOf("!")>-1?e.split("!")[1].indexOf("$")>-1?f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e.split("!")[1].split("$").join("")),valueOnly:!0}):e.indexOf("$")>-1?f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e.split("$").join("")),valueOnly:!0}):f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e.split("!")[1]),valueOnly:!0}):f.getRangeData({sheetIdx:u,range:f.getRangeIndices(e),valueOnly:!0})):c=n,l=0,v=c.length;l<v;l++)if(a=c[l].toString()===n,a)break;return t.Spreadsheet.msg=f._getLocStr("ListAlertMsg"),a}return i[0]=this._ruleSymbols[i[0]],i[1].indexOf("=")>-1&&(o=i[1].replace("=",""),s=this.getRangeIndices(o+":"+o),i[1]=f.XLEdit.getPropertyValue(s[0],s[1],null,u).toString()),i[2].indexOf("=")>-1&&(o=i[2].replace("=",""),s=this.getRangeIndices(o+":"+o),i[2]=f.XLEdit.getPropertyValue(s[0],s[1],null,u).toString()),i[0].length<=2?(t.Spreadsheet.msg="The "+i[4]+" should be "+t.Spreadsheet.ValidationText[i[0]]+" "+i[1].replace("^",""),f.operators[i[0]](f.parse[i[3]](n),f.parse[i[3]](i[1]))):(h=[],h=i[0].split("&&"),t.Spreadsheet.msg="The "+i[4]+" should"+t.Spreadsheet.ValidationText[h[2]]+" be between "+i[1].replace("^","")+" and "+i[2].replace("^",""),f.operators[h[2]](f.operators[h[0]](f.parse[i[3]](n),f.parse[i[3]](i[1]))&&f.operators[h[1]](f.parse[i[3]](n),f.parse[i[3]](i[2]))))}return!0},_convertValueByType:function(t,i){if(t.length){var r=this.XLObj;switch(i){case"number":case"decimal":r._isValidDate(t)&&(t=r._dateToInt(t));break;case"date":n.isNumeric(t)&&(t=r.intToDate(t).toString())}}return t},highlightInvalidData:function(n){var u=this.XLObj,l,a,r,h,s,i,o,f,e,c;if(u.model.allowDataValidation&&!u.model.isReadOnly){for(f=u.getActiveSheetIndex(),o=u._getRangeArgs(n,"object"),r=u._getSelectedCells(f,o).selCells,n=u._getAlphaRange(f,o[0],o[1],o[2],o[3]),i=0,l=r.length;i<l;i++)(e=u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"rule",f),e)&&(u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,null,f)&&!t.isNullOrUndefined(e)?(a=u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"type",f)==="datetime"||u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"type",f)==="time"?u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,"value2",f).toString():u.XLEdit.getPropertyValue(r[i].rowIndex,r[i].colIndex,null,f).toString(),s=e?!this._checkValidation(a,e.customVal.split("_"),!0,f):!1,u._dataContainer.sheets[f][r[i].rowIndex][r[i].colIndex].rule.isApply=s):t.isNullOrUndefined(e)||(s=e.required),u._isRowViewable(f,r[i].rowIndex)&&(h=u.getCell(r[i].rowIndex,r[i].colIndex,f),s?h.addClass("e-hlcell"):h.removeClass("e-hlcell")),u.XLEdit._updateDataContainer({rowIndex:r[i].rowIndex,colIndex:r[i].colIndex},{dataObj:{isHighlight:!0},sheetIdx:f}));u._isUndoRedo||(c={sheetIndex:f,reqType:"validation",operation:"hl-data",range:n},u._completeAction(c),u._trigActionComplete(c))}},_replaceRule:function(n,t){this.XLObj._dataContainer.cFormatData[n]=t},_addDVMethod:function(){t.isNullOrUndefined(n.validator)||n.validator.addMethod("customVal",function(t,i,r){var u=n("#"+n(i).data("id")).data("ejSpreadsheet"),f=u._getJSSheetContent(u.getActiveSheetIndex()).find(".e-spreadsheetcontentcontainer > .e-content");return(f.find(".e-error").remove(),u.model.showRibbon&&n("#"+u._id+"_Ribbon_freetext").length&&!n("#"+u._id+"_Ribbon_freetext").data("ejCheckBox").isChecked())?!0:u.XLValidate._checkValidation(t,r.split("_"))},t.Spreadsheet.getMsg)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.dragFill=function(n){this.XLObj=n;this._customList=[["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["January","February","March","April","May","June","July","August","September","October","November","December"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]];this._property=["value","value2","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","format","rule"];this._fillInfo=null;this._verticalFill=!1;this._uniqueOBracket=String.fromCharCode(129);this._uniqueCBracket=String.fromCharCode(130);this._uniqueCSeparator=String.fromCharCode(131);this._uniqueCOperator=String.fromCharCode(132);this._uniquePOperator=String.fromCharCode(133);this._uniqueSOperator=String.fromCharCode(134);this._uniqueMOperator=String.fromCharCode(135);this._uniqueDOperator=String.fromCharCode(136);this._uniqueModOperator=String.fromCharCode(137);this._uniqueConcateOperator=String.fromCharCode(138)};t.spreadsheetFeatures.dragFill.prototype={positionAutoFillElement:function(n){var l,r,u,f,s,t,e=0,o=0,a=0,h=0,v=0,c=0,i=this.XLObj,y="e-hide";if(i.model.allowAutoFill&&i.model.allowSelection){if(s=i.getActiveSheetIndex(),t=i.getSheet(s),t._isRowSelected)a=-3,h=-1,v=5,c=4,r=t.selectedRange[2],u=t.selectedRange[1],o=i._isFrozen(t.frozenColumns)?i._getContent(s).find(".e-content").scrollLeft():t._scrollLeft;else if(t._isColSelected)h=-3,c=5,r=t.selectedRange[0],u=t.selectedRange[3],e=i._isFrozen(t.frozenRows)?i._getContent(s).find(".e-content").scrollTop():t._scrollTop;else{if(t._isSheetSelected){this.hideAutoFillElement();return}a=-3;h=-3;v=1;c=3;r=t.selectedRange[2];u=t.selectedRange[3]}l=i._getMergedIdx(r,u);r=l.rowIndex;u=l.colIndex;f=i._getCellInfo({rowIndex:r,colIndex:u});t._isColSelected||(e+=f.height);t._isRowSelected||(o+=f.width);e+=f.top;o+=f.left;i.getAutoFillElem()&&i.getAutoFillElem().removeClass(y).css({top:Math.round(e)+a,left:Math.round(o)+h});i.model.autoFillSettings.showFillOptions&&n&&i.model.allowEditing&&!i.model.isReadOnly&&i._getAutoFillOptElem().removeClass(y).css({top:e+v,left:o+c});t._autoFillCell=i._dautoFillCell={rowIndex:r,colIndex:u}}},hideAutoFillElement:function(){var n=this.XLObj.getAutoFillElem();n&&n.addClass("e-hide")},hideAutoFillOptions:function(){var n=this.XLObj._getAutoFillOptElem();n&&(n.find("button").data("ejSplitButton")._hidePopup(),n.addClass("e-hide"))},autoFill:function(n){var i=this.XLObj;if(n=n||{},i.model.allowAutoFill&&n.dataRange&&n.fillRange&&n.direction&&i.model.allowEditing&&!i.model.isReadOnly){var r,f=i.getActiveSheetIndex(),e=i.getSheet(f),u=t.Spreadsheet.AutoFillOptions;if(this._fillInfo=this._getFillInfo(n),n.fillType=n.fillType||this._fillInfo.fillType,this._verticalFill=n.direction==="down"||n.direction==="up",n.sheetIdx=f,n.dataRange=i._toIntrnlRange(n.dataRange,f),n.fillRange=i._toIntrnlRange(n.fillRange,f),r={sheetIndex:n.sheetIdx,reqType:"auto-fill",direction:n.direction,range:n.fillRange,bRange:n.dataRange,bData:i.getRangeData({range:n.fillRange}),bFormat:i.model.allowCellFormatting&&i.XLFormat.getHashCodeClassAsArray(n.fillRange)},r.rowSel=e._isRowSelected,r.colSel=e._isColSelected,!i._trigger("autoFillBegin",n)){switch(n.fillType){case u.FillSeries:case u.FillWithoutFormatting:this._fillSeries(n);break;case u.CopyCells:case u.FillFormattingOnly:this._copyCells(n);break;case u.FlashFill:r.actionType="flash-fill";r.bdData=i.getRangeData({range:n.dataRange});this._flashFill(n);r.adData=i.getRangeData({range:n.dataRange})}r.aData=i.getRangeData({range:n.fillRange});i.model.allowCellFormatting&&(r.aFormat=i.XLFormat.getHashCodeClassAsArray(n.fillRange));n.isKeyFill||this.positionAutoFillElement(!0);i._completeAction(r);i._trigActionComplete(r);i._trigger("autoFillComplete",n)}}},_updateFillValues:function(n,t,i,r,u,f,e,o,s,h){var c,l,a,v;return n?(c={rowIndex:t,colIndex:i+h},l={rowIndex:r,colIndex:i+h},a={rowIndex:f,colIndex:e+h},v={rowIndex:o,colIndex:e+h}):(c={rowIndex:t+h,colIndex:i},l={rowIndex:t+h,colIndex:u},a={rowIndex:f+h,colIndex:e},v={rowIndex:f+h,colIndex:s}),patrnRange=[c.rowIndex,c.colIndex,l.rowIndex,l.colIndex],fillRange=[a.rowIndex,a.colIndex,v.rowIndex,v.colIndex],{patrnRange:patrnRange,fillRange:fillRange}},_fillSeries:function(n){for(var u,ot,o,i,rt,k,h,v,s,st,c,d,g,ht,l,ut,y,ft,p,ct,f,e,et=0,w={},r=this.XLObj,nt=t.Spreadsheet.autoFillDirection,tt=t.Spreadsheet.CellType,lt=n.dataRange[0],at=n.dataRange[1],vt=n.dataRange[2],yt=n.dataRange[3],pt=n.fillRange[0],wt=n.fillRange[1],bt=n.fillRange[2],kt=n.fillRange[3],it=[nt.Down,nt.Up].indexOf(n.direction)>-1,b=[nt.Up,nt.Left].indexOf(n.direction)>-1,dt=it?yt-at:vt-lt,a=n.fillType===t.Spreadsheet.AutoFillOptions.FillSeries;et<=dt;){if(rt=this._updateFillValues(it,lt,at,vt,yt,pt,wt,bt,kt,et),k=rt.patrnRange,h=rt.fillRange,o=this._getPattern(k,{isRFill:b,isVFill:it}),v=r.getRangeData({range:k,property:["hyperlink","rule","cFormatRule","type","formatStr","decimalPlaces","wrap"]}),st=v.length,!o)return;for(ot=o.length,r.clearRangeData(h,[a?"formatStr":null,"hyperlink",a?"cFormatRule":null,"rule"]),a&&(r.model.allowCellFormatting&&r.XLFormat.removeStyle(h),y=r.getRangeData({range:k,property:["format","formats"]})),p=r._getSelectedRange({rowIndex:h[0],colIndex:h[1]},{rowIndex:h[2],colIndex:h[3]}),ct=p.length,b&&(p=p.reverse(),o=o.reverse(),o=this._ensurePattern(o),v=v.reverse(),a&&(y=y.reverse())),c=0;c<ct;){w={};f=p[c];i=o[c%ot];r.isNumber(i)&&(i=o[i]);switch(i.type){case tt.Number:u=r._round(i.regVal.a+i.regVal.b*i.i,5);b?i.i--:i.i++;break;case tt.String:u=i.val[i.i%i.val.length];i.i++;break;case tt.Formula:for(ut=!1,u="=",d=0,ht=i.val.length;d<ht;)s=i.val[d],r._isObject(s)?(ut=!0,l=r._round(s.a+s.b*i.i,0),u+=l<1?"#REF!":it?s.c+(s.b?l:"$"+l):(s.b?r._generateHeaderText(l):"$"+r._generateHeaderText(l))+s.c):u+=s,d++;ut&&b?i.i--:i.i++;break;case tt.Custom:u=r._round(i.regVal.a+i.regVal.b*i.i,0);u<0&&(u=u%i.len+i.len);u>=i.len&&(u=u%i.len);u=i.val[u];b?i.i--:i.i++}g=c%st;e=v[g];r._dupDetails=!0;r.XLEdit.updateCellValue(f,u,a?y[g].format:null);r._dupDetails=!1;a&&(r.model.allowCellFormatting&&e.type&&e.type!="general"&&this._updateNFormat(e,f.rowIndex,f.colIndex),r.model.allowConditionalFormats&&e.cFormatRule&&this._updateCFormat(f,e.cFormatRule),ft=y[g].formats,ft&&(w.formats=ft));r.model.allowHyperlink&&e.hyperlink&&this._updateHyperlinkTag(e.hyperlink,f);r.model.allowDataValidation&&e.rule&&(w.rule=e.rule);r.getObjectLength(w)&&r.XLEdit._updateDataContainer(f,{dataObj:w});r.model.allowWrap&&e.wrap&&r.setWrapText("wrap",[f.rowIndex,f.colIndex,f.rowIndex,f.colIndex]);c++}et++}},_copyCells:function(n){for(var e,s,p,r,k,l,d,h,a,v,g,w,u,f,o={},i=this.XLObj,vt=i.getActiveSheetIndex(),nt=0,b=t.Spreadsheet.autoFillDirection,it=n.dataRange[0],rt=n.dataRange[1],ut=n.dataRange[2],ft=n.dataRange[3],ot=n.fillRange[0],st=n.fillRange[1],ht=n.fillRange[2],ct=n.fillRange[3],et=[b.Down,b.Up].indexOf(n.direction)>-1,lt=[b.Up,b.Left].indexOf(n.direction)>-1,at=et?ft-rt:ut-it,tt=n.fillType===t.Spreadsheet.AutoFillOptions.FillFormattingOnly,c,y;nt<=at;){if(k=this._updateFillValues(et,it,rt,ut,ft,ot,st,ht,ct,nt),p=k.patrnRange,r=k.fillRange,i.model.allowCellFormatting)if(r[0]==r[2])for(c=[1];c<=[3];c++)i.XLEdit.getPropertyValue(r[0],c,"tformats")||i.XLEdit.getPropertyValue(r[0],c,"formats")||i.XLFormat.removeStyle([r[0],c,r[2],c]);else for(y=r[0];y<=r[2];y++)i.XLEdit.getPropertyValue(y,r[1],"tformats")||i.XLEdit.getPropertyValue(r[0],c,"formats")||i.XLFormat.removeStyle([y,r[1],y,r[3]]);if(tt?l=i.getRangeData({range:p,property:["cFormatRule","type","decimalPlaces","formatStr"]}):(w=["value","value2","type","formatStr","decimalPlaces","thousandSeparator","hyperlink"],i.model.allowConditionalFormats&&w.push("cFormatRule"),i.model.allowDataValidation&&w.push("rule"),i.clearRangeData(r,w),l=i.getRangeData({range:p,property:["value","hyperlink","rule","cFormatRule","type","decimalPlaces","formatStr"]})),h=i.getRangeData({range:p,property:["format","formats"]}),d=h.length,v=i._getSelectedRange({rowIndex:r[0],colIndex:r[1]},{rowIndex:r[2],colIndex:r[3]}),g=v.length,e=0,lt&&(v=v.reverse(),h=h.reverse(),tt||(l=l.reverse())),tt)while(e<g)o={},s=e%d,f=v[e],u=l[s],i.model.allowCellFormatting&&(i.XLFormat._updateFormatClass(f,h[s].format),this._updateNFormat(u,f.rowIndex,f.colIndex)),a=h[s].formats,a&&(o.formats=a),i.getObjectLength(o)&&i.XLEdit._updateDataContainer(f,{dataObj:o}),i.model.allowConditionalFormats&&u.cFormatRule&&this._updateCFormat(f,u.cFormatRule),e++;else while(e<g)o={},s=e%d,f=v[e],u=l[s],i._dupDetails=!0,i.XLEdit.updateCellValue(f,u.value,h[s].format),i._dupDetails=!1,i.model.allowCellFormatting&&u.type&&u.type!="general"&&this._updateNFormat(u,f.rowIndex,f.colIndex),i.model.allowHyperlink&&u.hyperlink&&this._updateHyperlinkTag(u.hyperlink,f),a=h[s].formats,a&&(o.formats=a),i.model.allowDataValidation&&u.rule&&(o.rule=u.rule),i.getObjectLength(o)&&i.XLEdit._updateDataContainer(f,{dataObj:o}),i.model.allowConditionalFormats&&u.cFormatRule&&this._updateCFormat(f,u.cFormatRule),e++;nt++}},_flashFill:function(n){var o,f,e,t=this.XLObj,s=n.dataRange[0],h=n.dataRange[2],i=n.fillRange[0],c=n.fillRange[1],r=n.fillRange[2],l=n.fillRange[3],u=this._getFlashFillPattern(n.dataRange,"left");if(u)for(f=t.getRangeData({range:[i,u.colIndex,r,u.colIndex],valueOnly:!0,skipDateTime:!0}),u.subStr>-1&&(f=this._splitString(f," ",u.subStr)),o=t._getSelectedRange({rowIndex:i,colIndex:c},{rowIndex:r,colIndex:l}),e=o.length;e--;)t.XLEdit._updateCellValue(o[e],f[e]);else i>s&&(i=s),r<h&&(r=h),t._getAutoFillOptElem().addClass("e-hide"),t.updateUniqueData({value:"",value2:"",type:"general"},[i,c,r,l]),t._showAlertDlg("Alert","FlashFillAlert")},_getFlashFillPattern:function(n,i){var u,f,c,y,e,l,r=0,o=-1,a=this.XLObj,s=a.getRangeData({range:n,valueOnly:!0,skipDateTime:!0}),p=s.length,v=n[0],w=t.Spreadsheet.autoFillDirection.Right,h=i===w;if(s.join().replace(/,/g,"").length){for(l=s[0].toString(),r=n[1],r===0&&(h=!0),h?r++:r--;r>-1;)if(f=a.XLEdit.getPropertyValue(v,r),f=a.isUndefined(f)?"":f.toString(),f.length){if(f===l)if(p>1){if(u=this._matchData(v,r,s),u)return u}else return{colIndex:r,subStr:o};for(c=f.split(" "),y=c.length,e=0;e<y;){if(l===c[e])if(o=e,p>1){if(u=this._matchData(v,r,s),u)return o>u.subStr&&(u.subStr=o),u}else return{colIndex:r,subStr:o};e++}h?r++:r--}else break;if(!h)return this._getFlashFillPattern(n,w)}},_matchData:function(n,i,r){for(var u,o=!1,s,f,h,l,e=1,c=-1,a=r.length;e<a;){if(o=!1,s=r[e].toString(),f=this.XLObj.XLEdit.getPropertyValue(n+e,i),f=t.isNullOrUndefined(f)?"":f.toString(),s===f){o=!0;e++;continue}for(h=f.split(" "),l=h.length,u=0;u<l;){if(s===h[u]){c<u&&(c=u);o=!0;break}u++}e++}if(o&&e===a)return{colIndex:i,subStr:c}},_splitString:function(n,t,i){for(var e,u,f=n.length,r;f--;){for(r=i,e=n[f].split(t);r>-1;){if(u=e[r],u)break;r--}n[f]=u}return n},_getPattern:function(n,i){var u,o,s,a,l,v,w,b,h,e,y=0,f=[],k=this.XLObj,c=t.Spreadsheet.CellType,p=this._getDataPattern(n),d=p.length,r;if(p){while(y<d){r=p[y];switch(r.type){case c.Number:for(o=f.length,e=r.val.length,h=i.isRFill?-1:e,e===1&&r.val.push(r.val[0]+1),a=this._getPredictionValue(r.val),s={regVal:a,type:r.type,i:h},f.push(s),u=1;u<e;)f.push(o),u++;break;case c.String:for(o=f.length,s={val:r.val,type:r.type,i:0},f.push(s),u=1,e=r.val.length;u<e;)f.push(o),u++;break;case c.Formula:if(e=r.val.length,r=this._getFormulaPattern(r.val,i),h=i.isRFill?-1:e,r.isInPattern)for(o=f.length,s={val:r.val,type:c.Formula,i:h},f.push(s),u=1;u<e;)f.push(o),u++;else for(u=0,h=i.isRFill?-1:1;u<e;)f.push({val:r.val[u],type:c.Formula,i:h}),u++;break;default:if(r.type.indexOf(c.Custom)>-1)for(o=f.length,e=r.val.length,h=i.isRFill?-1:e,l=this._customList[Number(r.type.replace(c.Custom,""))],b=l.indexOf(r.val[0])===-1,v=k.toArrayLowerCase(l.slice(0)),w=k.toArrayLowerCase(r.val),a=this._getCustomPredictionValue(w,v),s={val:b?v:l,regVal:a,i:h,type:c.Custom,len:l.length},f.push(s),u=1;u<e;)f.push(o),u++}y++}return f}},_getCustomPredictionValue:function(n,t){for(var r=0,i=[],u=n.length;r<u;)i.push(t.indexOf(n[r])),r++;return i.length===1&&i.push(i[0]+1),this._getPredictionValue(i)},_getDataPattern:function(n){var i,r,u=0,t={},f=[],e=this.XLObj.getRangeData({range:n,valueOnly:!0,skipDateTime:!0}),o=e.length;if(o){while(u<o)i=e[u],r=this._getType(i),u===0?t={val:[i],type:r}:r===t.type?t.val.push(i):(f.push(t),t={val:[i],type:r}),u++;return f.push(t),f}},_getFormulaPattern:function(n,t){for(var r,o,f,s,c=this.XLObj,e=[],i=0,h=n.length,u;i<h;)e.push(this._parseFormula(n[i])),i++;if(s=this._isInPattern(e,t.isVFill),s){for(r=e[0],i=r.length;i--;)f=r[i],u=c._isCellReference(f),u&&u!=="absolute"&&(r[i]=this._getCellRefPrediction(f,t,null,u));return{isInPattern:s,val:r}}for(i=0;i<h;){for(r=e[i],o=r.length;o--;)f=r[o],u=c._isCellReference(f),u&&u!=="absolute"&&(e[i][o]=this._getCellRefPrediction(f,t,h,u));i++}return{isInPattern:s,val:e}},_getCellRefPrediction:function(n,t,i,r){n=n.toUpperCase();var f="",s=new RegExp("[a-z$]","gi"),h=new RegExp("[0-9$]","g"),e=t.isVFill?n.replace(h,f):n.replace(s,f),u=t.isVFill?Number(n.replace(s,f)):this.XLObj._generateColCount(n.replace(h,f)),o=[u],c=n[0]==="$";return i&&i!==1?o.push(u+i):o.push(u+1),u=this._getPredictionValue(o),r&&r==="mixed"&&(c===t.isVFill?e="$"+e:u.b=0),u.c=e,u},_isInPattern:function(n,t){var o,i,s,a,r,u,h,c,f=this.XLObj,e="",v=0,l=1,y=n.length,p=new RegExp("[0-9$]","g"),w=new RegExp("[a-z$]","gi");if(y===1)return!1;while(l<y){if(o=n[v],s=n[l],i=o.length,a=s.length,i!==a)return!1;while(i--)if(r=o[i],u=s[i],f._isCellReference(r)===f._isCellReference(u)){if(t?(h=Number(r.replace(w,e)),c=Number(u.replace(w,e))):(h=f._generateColCount(r.replace(p,e)),c=f._generateColCount(u.replace(p,e))),h!==c-1)return!1}else if(r!==u)return!1;v++;l++}return!0},_parseFormula:function(n){var t,i,f,u=0,r=[];for(n=this._markSpecialChar(n.replace("=","")),n=n.split(/\(|\)|,|:|\+|-|\*|\/|%|&/g),f=n.length;u<f;){if(t=n[u],!t){u++;continue}t.length===1?r.push(this._isUniqueChar(t)?this._getUniqueCharVal(t):t):(i=t[0],t.indexOf("!")>0?(this._isUniqueChar(i)&&(r.push(this._getUniqueCharVal(i)),t=t.substr(1)),i=t.indexOf("!")+1,r.push(t.substr(0,i)),r.push(t.substr(i))):this._isUniqueChar(i)?(r.push(this._getUniqueCharVal(i)),r.push(t.substr(1))):r.push(t));u++}return r},_getUniqueCharVal:function(n){switch(n){case this._uniqueOBracket:return"(";case this._uniqueCBracket:return")";case this._uniqueCSeparator:return",";case this._uniqueCOperator:return":";case this._uniquePOperator:return"+";case this._uniqueSOperator:return"-";case this._uniqueMOperator:return"*";case this._uniqueDOperator:return"/";case this._uniqueModOperator:return"%";case this._uniqueConcateOperator:return"&"}return""},_isUniqueChar:function(n){var t=n.charCodeAt(n);return t>=129&&t<=138},_markSpecialChar:function(n){return n=n.replace(/\(/g,"("+this._uniqueOBracket).replace(/\)/g,")"+this._uniqueCBracket),n=n.replace(/,/g,","+this._uniqueCSeparator).replace(/:/g,":"+this._uniqueCOperator),n=n.replace(/\+/g,"+"+this._uniquePOperator).replace(/-/g,"-"+this._uniqueSOperator),n=n.replace(/\*/g,"*"+this._uniqueMOperator).replace(/\//g,"/"+this._uniqueDOperator),n=n.replace(/&/g,"&"+this._uniqueConcateOperator),n.replace(/%/g,"%"+this._uniqueModOperator)},_getPredictionValue:function(n){for(var t=0,i=0,u=0,f=0,r=0,e=n.length,o,s;t<e;)i=i+t,u=u+Number(n[t]),f=f+t*Number(n[t]),r=r+t*t,t++;return o=this.XLObj._round((u*r-i*f)/(e*r-i*i),5),s=this.XLObj._round((e*f-i*u)/(e*r-i*i),5),{a:o,b:s}},_getType:function(n){var i=this._isCustomType(n),r=t.Spreadsheet.CellType,u=this.XLObj;return i?i=i:u.isFormula(n)?i=r.Formula:u.isNumber(n)&&(i=r.Number),i||r.String},_isCustomType:function(n){n=n+"";n=n.toLowerCase();for(var i=this._customList.length;i--;)if(this.XLObj.toArrayLowerCase(this._customList[i].slice(0)).indexOf(n)>-1)return t.Spreadsheet.CellType.Custom+i;return!1},_ensurePattern:function(n){for(var i,u=-1,r=n.length;r--;)i=n[r],this.XLObj._isObject(i)?(u=r,i.type===t.Spreadsheet.CellType.String&&(i.val=i.val.reverse())):n[r]=u;return n},_selectAutoFillRange:function(n,t){n&&(t=this.XLObj._getCellIdx(n));var u,f,r=this.XLObj,i=this._getAutoFillRange(t);if(i){for(this._autoFillCleanUp(),f=r.getRange([i.startCell.rowIndex,i.startCell.colIndex,i.endCell.rowIndex,i.endCell.colIndex]),u=f.length;u--;)r.addClass(f[u],"e-autofillcell");r.XLSelection._focusRange(i.startCell,i.endCell,r._autofillBorder);r._dautoFillCell=t}},_getAutoFillRange:function(n){var o=t.Spreadsheet.autoFillDirection,a=this.XLObj,r=a.getSheet(a.getActiveSheetIndex()),y=r._startCell,p=r._endCell,s=r._autoFillCell,c=r.selectedRange,f=c[0],e=c[1],u=c[2],i=c[3],v=a.inRange(c,n.rowIndex,n.colIndex),h={rowIndex:f,colIndex:e},l={rowIndex:u,colIndex:i};if(n.rowIndex<s.rowIndex){if(r._isFreezed&&n.rowIndex<=r.frozenRows&&r._hiddenFreezeRows.indexOf(r.frozenRows)>-1&&(n.rowIndex=r._ftopRowIdx),f-n.rowIndex>n.colIndex-i&&f-n.rowIndex>e-n.colIndex)return v?{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i}}:{startCell:l,endCell:{rowIndex:n.rowIndex,colIndex:e},fillRange:[n.rowIndex,e,f-1,i],direction:o.Up};if(n.colIndex>s.colIndex)return{startCell:h,endCell:{rowIndex:u,colIndex:n.colIndex},fillRange:[f,i+1,u,n.colIndex],direction:o.Right};if(n.colIndex<s.colIndex)return v?{startCell:h,endCell:l}:{startCell:l,endCell:{rowIndex:f,colIndex:n.colIndex},fillRange:[f,n.colIndex,u,e-1],direction:o.Left}}else{if(n.colIndex>s.colIndex)return n.rowIndex-u>n.colIndex-i?{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i},fillRange:[u+1,e,n.rowIndex,i],direction:o.Down}:{startCell:h,endCell:{rowIndex:u,colIndex:n.colIndex},fillRange:[f,i+1,u,n.colIndex],direction:o.Right};if(n.colIndex<s.colIndex)return r._isFreezed&&n.colIndex<=r.frozenColumns&&r._hiddenFreezeCols.indexOf(r.frozenColumns)>-1&&(n.colIndex=r._fleftColIdx),n.rowIndex-u>i-n.colIndex||n.rowIndex-f>i-n.colIndex&&n.rowIndex!==u?{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i},fillRange:[u+1,e,n.rowIndex,i],direction:o.Down}:v?{startCell:h,endCell:l}:{startCell:l,endCell:{rowIndex:f,colIndex:n.colIndex},fillRange:[f,n.colIndex,u,e-1],direction:o.Left};if(n.rowIndex>s.rowIndex)return{startCell:h,endCell:{rowIndex:n.rowIndex,colIndex:i},fillRange:[u+1,e,n.rowIndex,i],direction:o.Down};if(n.rowIndex===s.rowIndex&&n.colIndex===s.colIndex)return{startCell:y,endCell:p}}},_getDirection:function(n,i,r){var u=t.Spreadsheet.autoFillDirection;if(r=this.XLObj.isUndefined(r)?this._verticalFill:r,r){if(i.rowIndex<n.rowIndex)return u.Up;if(i.rowIndex>n.rowIndex)return u.Down;if(i.colIndex>n.colIndex)return u.Right;if(i.colIndex<n.colIndex)return u.Left}else{if(i.colIndex>n.colIndex)return u.Right;if(i.colIndex<n.colIndex)return u.Left;if(i.rowIndex<n.rowIndex)return u.Up;if(i.rowIndex>n.rowIndex)return u.Down}return null},_getFillRange:function(n,i,r,u){var f=t.Spreadsheet.autoFillDirection;switch(u){case f.Up:return[r.rowIndex,n.colIndex,n.rowIndex-1,i.colIndex];case f.Right:return[n.rowIndex,i.colIndex+1,i.rowIndex,r.colIndex];case f.Down:return[i.rowIndex+1,n.colIndex,r.rowIndex,i.colIndex];case f.Left:return[n.rowIndex,r.colIndex,i.rowIndex,n.colIndex-1]}return null},_autoFillOptionClick:function(t){var r,i,u,f,e,o,s,h=n("#"+t.model.targetID).find("#"+t.ID).find(">>");this._hasClass(h[0],"e-ss-fillselect")||(r=this.XLDragFill,i=this.getSheet(this.getActiveSheetIndex()),u=r._getDirection(this._pEndCell,this._pFillCell),f=this.swapRange([this._pStartCell.rowIndex,this._pStartCell.colIndex,this._pEndCell.rowIndex,this._pEndCell.colIndex]),e=r._getFillRange(this._pStartCell,this._pEndCell,this._pFillCell,u),o=i._startCell,s=i._endCell,this._isUndo=!0,this._performUndoRedo(),i._isColSelected||i._isRowSelected||(i._startCell=o,i._endCell=s,this.XLSelection.selectRange(i._startCell,i._endCell)),r.positionAutoFillElement(!0),r.autoFill({dataRange:f,fillRange:e,direction:u,fillType:t.ID}),r._fillInfo.fillType=t.ID,this._isUndo=!1)},_autoFillCleanUp:function(){var i,n,r,u,f="e-hide",t=this.XLObj,e=t.getAutoFillElem(),o=t._getAutoFillOptElem();for(e&&t.addClass(e[0],f),o&&t.addClass(o[0],f),r=t._getContent(t.getActiveSheetIndex())[0].querySelectorAll("td.e-autofillcell"),i=r.length;i--;)u=r[i],n=u.className,n=n.replace(/e-autofillcell|e-blur/g,""),n=n.replace(/ +/g," "),u.className=n},_autoFillClick:function(){var f,r=0,u="e-ss-fillselect",i=n("#"+this._id+"_ctxtmenu").find("li"),t=i.find("."+u);for(t.length&&(t=t[0],this._removeClass(t,u),this.addClass(t,"e-ss-filloption")),i.show(),f=this.XLDragFill._fillInfo.disableItems.length;r<f;)n(i[this.XLDragFill._fillInfo.disableItems[r]]).hide(),r++;i.filter("#"+this.XLDragFill._fillInfo.fillType).find("span").addClass(u)},_fillRange:function(n,i){var c,v,l,r,u,o,s,f={isKeyFill:!0},e=this.XLObj,a=e.getActiveSheetIndex(),y=e.getSheet(a),h=t.Spreadsheet.autoFillDirection;if(i=i?i:y.selectedRange,r=i[0],u=i[1],o=i[2],s=i[3],c=this._getDirection({rowIndex:r,colIndex:u},{rowIndex:o,colIndex:s},n),v=n?c===h.Down:c===h.Right,e.isRange(i)&&v)n?(f.dataRange=[r,u,r,s],f.fillRange=[r+1,u,o,s]):(f.dataRange=[r,u,o,u],f.fillRange=[r,u+1,o,s]);else{if(n){if(!r)return;f.dataRange=[r-1,u,r-1,s]}else{if(!u)return;f.dataRange=[r,u-1,o,u-1]}f.fillRange=i}(f.direction=n?h.Down:h.Right,f.fillType=t.Spreadsheet.AutoFillOptions.CopyCells,l=e.swapRange(f.fillRange),e.model.allowLockCell&&y.isSheetProtected&&e._isPropExists([l],"isLocked",a))||e._isPropExists([l],"isReadOnly",a)||this.autoFill(f)},_getFillInfo:function(n){var e,i,o=!0,u=t.Spreadsheet.AutoFillOptions.CopyCells,s=[],r=this.XLObj,h=t.Spreadsheet.autoFillDirection,c=[h.Down,h.Up].indexOf(n.direction)>-1,f=r.getRangeData({range:n.dataRange,valueOnly:!0,skipDateTime:!0}),l=f.join().replace(/,/g,"").length;if(r.isRange(n.dataRange)&&l){for(e=f.length;e--;)if(i=f[e],r.isNumber(i)||r.isFormula(i)||this._isCustomType(i)){o=!1;u=r.model.autoFillSettings.fillType;break}}else i=f[0],(r.isNumber(i)||r.isFormula(i)||this._isCustomType(i))&&(o=!1,u=r.model.autoFillSettings.fillType);return(!l||o)&&(s.push(1),u=n.fillType=="fillseries"?u:n.fillType),(!c||c&&n.dataRange[1]!==n.dataRange[3])&&s.push(4),{fillType:u,disableItems:s}},_updateHyperlinkTag:function(i,r){var f,u=this.XLObj,e=u.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"value2");u._isRowViewable(u.getActiveSheetIndex(),r.rowIndex)&&(f=u.getCell(r.rowIndex,r.colIndex),f[0].lastChild.nodeType===3&&n(f[0].lastChild).remove(),f.append(t.buildTag("a.e-hyperlinks",e,"",i.webAddr?{href:i.webAddr,target:"_blank"}:{href:"#"})));u.XLEdit._updateDataContainer(r,{dataObj:{hyperlink:i}})},_updateCFormat:function(n,t){var i,r=0,u=this.XLObj,f=t.length;for(u._dupDetails=!0;r<f;)i=t[r].split("_"),u.XLCFormat._cFormat(i[0],i[2],i[3],i[4],null,null,[n.rowIndex,n.colIndex,n.rowIndex,n.colIndex]),r++;u._dupDetails=!1},_updateNFormat:function(n,t,i){var u={type:n.type},r=this.XLObj;n.type!="general"&&(n.formatStr&&(u.formatStr=n.formatStr),"decimalPlaces"in n&&(u.decimalPlaces=n.decimalPlaces));r._dupDetails=!0;r.XLFormat.format(u,r._getAlphaRange(r.getActiveSheetIndex(),t,i,t,i));r._dupDetails=!1}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cellNavigation=function(n){this.XLObj=n;this._canKeyBoardNavigate=!0;this._isNavigate=!0};t.spreadsheetFeatures.cellNavigation.prototype={_selectionKeyDownHandler:function(n){var v,w,o,b,y,nt,et,tt,ft,g=[],i=this.XLObj,k=i.getActiveSheetIndex(),r=i.getSheet(k),e=n.keyCode,d=n.shiftKey,it=n.ctrlKey,s={keyCode:e,shiftKey:d,ctrlKey:it,altKey:n.altKey},rt=!1,u=r._activeCell,a=r._endCell,h=r.rowCount,l=r.colCount,ut=i._dataContainer,p,f,c=r.usedRange;if((e===9&&this._canKeyBoardNavigate||e===13)&&!it){if(n.preventDefault(),v=i.XLEdit.getCurrentEditCellData(),i.isFormula(v)&&!i.XLEdit._formulaValidate(v))return;if(i.XLEdit._isFormulaEdit&&!i._isFormulaSuggestion)if(v.length>1)if(this._isValidParameter(v))i.isFormula(v)||(v=v+")",i.XLEdit._editElem.text(v),i.model.allowFormulaBar&&i._getInputBox().val(v)),i.XLEdit.saveCell(),i._getContent(k).find("td").removeClass(i._formulaBorder.join(" ").replace(/,/g," ")+" "+i._ctrlFormulaBorder.join(" ").replace(/,/g," ")),i.XLSelection._cleanUp(),i.XLSelection.selectRange(r._activeCell,r._activeCell),i.XLEdit._isFormulaEdit=!1,i._formulaRange=[],i._ctrlKeyCount=0;else{i._showAlertDlg("Alert","MissingParenthesisAlert","FormulaAlert",440);return}else i.XLEdit.saveCell(),i.XLEdit._isFormulaEdit=!1;else e===9&&i.XLEdit._isEdit&&i.XLEdit.saveCell();w=r.selectedRange;ft=r._isRowSelected||r._isColSelected;ft?w[0]===w[2]||w[1]===w[3]?g.push({rowIndex:w[0],colIndex:w[1]}):g=r._selectedCells:g=r._selectedCells;g.length&&(g.length===1||!ft&&this._isRangeMerged(g)?r._isRowSelected?d?u.colIndex>0&&this._navigateRow("Backward",s):u.colIndex<39&&this._navigateRow("Forward",s):r._isColSelected?d?u.rowIndex>0&&this._navigateCol("Backward",s):u.rowIndex<39&&this._navigateCol("Forward",s):d?e===9&&u.colIndex>0?this._navigateCell(u.rowIndex,u.colIndex-1,s):e===13&&u.rowIndex>0&&this._navigateCell(u.rowIndex-1,u.colIndex,s):e===9&&u.colIndex<l?this._navigateCell(u.rowIndex,u.colIndex+1,s):e===13&&u.rowIndex<h&&this._navigateCell(u.rowIndex+1,u.colIndex,s):d?e===9?this._navigateRange("ShiftTab",s):this._navigateRange("ShiftEnter",s):e===9?this._navigateRange("Tab",s):this._navigateRange("Enter",s))}else if((e===37||e===38&&!i._isFormulaSuggestion||e===39||e===40&&!i._isFormulaSuggestion)&&this._isNavigate)if(n.preventDefault(),i.XLEdit._isFormulaEdit)y=i.swapRange([i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex]),i.getRange([y[0]?y[0]-1:y[0],y[1]?y[1]-1:y[1],y[2],y[3]]).removeClass(i._formulaBorder[i._ctrlKeyCount%6].join(" ")+" "+i._ctrlFormulaBorder[i._ctrlKeyCount%6].join(" ")),it&&(o=i._dStartCell,e===37&&o.colIndex>0?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:0}:e===38&&o.rowIndex>0?i._dStartCell=i._dEndCell={rowIndex:0,colIndex:o.colIndex}:e===39&&o.colIndex<r.colCount?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:r.colCount}:e===40&&o.rowIndex<h&&(i._dStartCell=i._dEndCell={rowIndex:r.colCount,colIndex:o.colIndex})),d||i._shiftKeyEnabled?(b=i._dEndCell,o=i._dStartCell,e===37&&o.colIndex>0?i._dStartCell={rowIndex:o.rowIndex,colIndex:o.colIndex-1}:e===38&&o.rowIndex>0?i._dStartCell={rowIndex:o.rowIndex-1,colIndex:o.colIndex}:e===39&&b.colIndex<r.colCount?i._dEndCell={rowIndex:b.rowIndex,colIndex:b.colIndex+1}:e===40&&b.rowIndex<r.rowCount&&(i._dEndCell={rowIndex:b.rowIndex+1,colIndex:b.colIndex})):(o=i._dStartCell,e===37&&o.colIndex>0?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:o.colIndex-1}:e===38&&o.rowIndex>0?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex-1,colIndex:o.colIndex}:e===39&&o.colIndex<r.colCount?i._dStartCell=i._dEndCell={rowIndex:o.rowIndex,colIndex:o.colIndex+1}:e===40&&o.rowIndex<r.rowCount&&(i._dStartCell=i._dEndCell={rowIndex:o.rowIndex+1,colIndex:o.colIndex})),i.XLSelection._processFormulaRange(i._ctrlFormulaBorder),i._formulaRange[i._ctrlKeyCount]=i._getProperAlphaRange(k,i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex);else if(it){if(e===37&&u.colIndex>0){if(p=ut.sheets[k][u.rowIndex],f=u.colIndex-1,p&&f<c.colIndex)if(i.XLEdit.getPropertyValue(u.rowIndex,f+1,"value2")&&i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")){while(i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<=c.colIndex)f--;l=f+1}else{while(!i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<c.colIndex&&f>0)f--;l=f}else if(i.XLEdit.getPropertyValue(u.rowIndex,c.colIndex,"value2"))l=c.colIndex;else{for(f=c.colIndex;f>0&&!i.XLEdit.getPropertyValue(u.rowIndex,f,"value2");)f--;l=f}this._navigateCell(u.rowIndex,l,s)}else if(e===38&&u.rowIndex>0){if(p=ut.sheets[k],f=u.rowIndex-1,f<=c.rowIndex)if(p[f]&&i.XLEdit.getPropertyValue(f+1,u.colIndex,"value2")&&i.XLEdit.getPropertyValue(f,u.colIndex,"value2")){while(i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f<=c.rowIndex)f--;h=f+1}else{while(!i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f>0)f--;h=f}else if(i.XLEdit.getPropertyValue(c.rowIndex,u.colIndex,"value2"))h=c.rowIndex;else{for(f=c.rowIndex;f>0&&!i.XLEdit.getPropertyValue(f,u.colIndex,"value2");)f--;h=f}this._navigateCell(h,u.colIndex,s)}else if(e===39&&u.colIndex<l-1){if(p=ut.sheets[k][u.rowIndex],f=u.colIndex+1,p&&f<=c.colIndex)if(i.XLEdit.getPropertyValue(u.rowIndex,f-1,"value2")&&i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")){while(i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<=c.colIndex)f++;l=f-1}else{while(!i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")&&f<c.colIndex)f++;l=i.XLEdit.getPropertyValue(u.rowIndex,f,"value2")?f:r.colCount}else l=r.colCount;l===r.colCount&&--l;this._navigateCell(u.rowIndex,l,s)}else if(e===40&&u.rowIndex<h-1){if(p=ut.sheets[k],f=u.rowIndex+1,f<c.rowIndex)if(p[f]&&i.XLEdit.getPropertyValue(f-1,u.colIndex,"value2")&&i.XLEdit.getPropertyValue(f,u.colIndex,"value2")){while(i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f<=c.rowIndex)f++;h=f-1}else{while(!i.XLEdit.getPropertyValue(f,u.colIndex,"value2")&&f<r.rowCount)f++;h=f}else h=r.rowCount-1;h===r.rowCount&&--h;this._navigateCell(h,u.colIndex,s)}}else if(d){if(e===37&&a.colIndex>0?r._endCell={rowIndex:a.rowIndex,colIndex:a.colIndex-1}:e===38&&a.rowIndex>0?(rt=!0,r._endCell={rowIndex:a.rowIndex-1,colIndex:a.colIndex},tt={rowIndex:a.rowIndex-1,colIndex:a.colIndex}):e===39&&a.colIndex<l?r._endCell={rowIndex:a.rowIndex,colIndex:a.colIndex+1}:e===40&&a.rowIndex<h&&(rt=!0,r._endCell={rowIndex:a.rowIndex+1,colIndex:a.colIndex}),(r.rowCount===r._endCell.rowIndex||r.colCount===r._endCell.colIndex)&&i.model.scrollSettings.scrollMode==="normal")return;if((r.rowCount===r._endCell.rowIndex||r.colCount===r._endCell.colIndex)&&!i.model.scrollSettings.allowScrolling)return;i.model.scrollSettings.allowScrolling&&(r.rowCount===r._endCell.rowIndex&&e===40?i._scrollContent({x:0,y:+i.model.rowHeight}):r.colCount-1===r._endCell.colIndex&&e===39&&i._scrollContent({x:+i.model.columnWidth,y:0}));this._isHiddenCell(r._endCell)&&(nt={rowIndex:r._endCell.rowIndex,colIndex:r._endCell.colIndex},this._skipHiddenRowsAndCols(nt,s),r._endCell.rowIndex=nt.rowIndex,r._endCell.colIndex=nt.colIndex);(i.XLEdit.getPropertyValue(r._endCell.rowIndex,r._endCell.colIndex,"isMHide")||i.XLEdit.getPropertyValue(r._endCell.rowIndex,r._endCell.colIndex,"merge")||rt&&i._isPropExists([[r._endCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex]],"merge")||i._isPropExists([[r._endCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex]],"isMHide"))&&(rt=!1,i.XLSelection._processBoundary());(r._endCell.colIndex<=r._leftCol.idx||r._endCell.colIndex>=r._rightCol.idx||r._endCell.rowIndex<=r._topRow.idx||r._endCell.rowIndex>=r._bottomRow.idx)&&this._scrollToCell(r._endCell,s);!t.isNullOrUndefined(tt)&&e==38&&i.XLEdit.getPropertyValue(tt.rowIndex,tt.colIndex,"mergeIdx")?(et=r._startCell,r._startCell=r._endCell,r._endCell=et,i.XLSelection.selectRange(r._startCell,r._endCell)):i.XLSelection.selectRange(r._startCell,r._endCell);i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement()}else if(s={keyCode:e,shiftKey:!1,ctrlKey:!1,altKey:!1},e===37&&u.colIndex>0)this._navigateCell(u.rowIndex,u.colIndex-1,s);else if(e===38&&u.rowIndex>0)this._navigateCell(u.rowIndex-1,u.colIndex,s);else if(e===39&&u.colIndex<l)this._navigateCell(u.rowIndex,u.colIndex+1,s);else if(e===40&&u.rowIndex<h)this._navigateCell(u.rowIndex+1,u.colIndex,s);else return!1},_navigateCell:function(r,u,f){var p,d,g,w,b,nt,tt=hiddenWth=0,s={rowIndex:r,colIndex:u},o=this.XLObj,c=o.getActiveSheetIndex(),e=o.getSheet(c),a=o._getContent(c),h=a.find("#hscrollBar").data("ejScrollBar"),l=a.find("#vscrollBar").data("ejScrollBar"),y=a.find(".e-content"),it=o.XLEdit,v=!1,k=y[0].offsetWidth;if((e.rowCount!==s.rowIndex&&e.colCount!==s.colIndex||o.model.scrollSettings.scrollMode!=="normal")&&(e.rowCount!==s.rowIndex||!o.model.scrollSettings.allowVirtualScrolling)&&(e.rowCount!==s.rowIndex&&e.colCount!==s.colIndex||o.model.scrollSettings.allowScrolling)){if(e.rowCount===s.rowIndex&&(o.XLScroll._scrollY(c),v=!0),o._isAutoWHMode||e.colCount!==s.colIndex||o.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Infinite||(o.XLScroll._scrollX(c),v=!0),e._isFreezed)if(e._frozenRows-1<=r&&r<e._ftopRowIdx){for(i=r;i<e._ftopRowIdx;i++)tt+=e.rowsHeightCollection[i];o._scrollContent({y:-tt})}else if(e._frozenColumns-1<=u&&u<e._fleftColIdx){for(i=u;i<e._fleftColIdx;i++)hiddenWth+=e.columnsWidthCollection[i];o._scrollContent({x:-hiddenWth})}for(g=o.getCell(s.rowIndex,s.colIndex),this._isHiddenCell(s)&&this._skipHiddenRowsAndCols(s,f),b=it.getPropertyValue(e._activeCell.rowIndex,e._activeCell.colIndex,"merge"),b&&it.getPropertyValue(s.rowIndex,s.colIndex,"mergeIdx")&&this._updateMergeRange(b,s,f),e._activeCell=e._endCell=e._startCell=s,(o.XLEdit.getPropertyValue(s.rowIndex,s.colIndex,"mergeIdx")||o.hasSpan(s))&&(o.XLSelection._processBoundary(),e._activeCell=e._startCell,g=o.getCell(e._activeCell.rowIndex,e._activeCell.colIndex),d=!0),cellInfo=o._getCellInfo(s,c),w=e._leftCol.idx>0?e._leftCol.idx-1:e._leftCol.idx,o.model.scrollSettings.allowScrolling&&e._bottomRow.idx<=s.rowIndex&&(f.keyCode===40||f.keyCode===13&&!f.shiftKey)&&!v?(l._scrollData.step=1,f.ctrlKey&&f.keyCode===40?o.XLScroll._scrollSelectedPosition(c,o.getActiveCell(c)):l.scroll(l.value()+(o._isFrozen(e.frozenRows)?o._getRowHeight(e._ftopRowIdx,c):cellInfo.height),!0)):o.model.scrollSettings.allowScrolling&&!o._isFrozen(e.frozenRows)&&e._topRow.idx>s.rowIndex&&(f.keyCode===38||f.keyCode===13&&f.shiftKey)&&!v&&!o._hasClass(a.find("tr").eq(s.rowIndex)[0],"e-fr-hide")&&(l._scrollData.step=-1,s.rowIndex>0?f.ctrlKey?l.scroll(cellInfo.top,!0):l.scroll(l.value()-cellInfo.height,!0):l.scroll(0)),o.model.scrollSettings.allowScrolling&&u>=e._rightCol.idx&&k<=e._colWidthCollection[e._activeCell.colIndex]-e._colWidthCollection[w]+cellInfo.width&&(f.keyCode===39||f.keyCode===9&&!f.shiftKey)&&!v?(h._scrollData.step=1,f.ctrlKey&&f.keyCode===39?h.scroll(cellInfo.left+cellInfo.width-h._scrollData.handleSpace,!0):h.scroll(h.value()+(o._isFrozen(e.frozenColumns)?o._getColWidth(e._fleftColIdx,c):cellInfo.width),!0)):o.model.scrollSettings.allowScrolling&&!o._isFrozen(e.frozenColumns)&&w>=s.colIndex&&(f.keyCode===37||f.keyCode===9&&f.shiftKey)&&!v?(h._scrollData.step=-1,s.colIndex>0?f.ctrlKey?h.scroll(cellInfo.left,!0):h.scroll(h.value()-cellInfo.width,!0):h.scroll(0)):o.model.scrollSettings.allowScrolling&&f.ctrlKey&&!v&&(f.keyCode===37?h.scroll(cellInfo.left,!0):f.keyCode===38?l.scroll(cellInfo.top,!0):f.keyCode===39?h.scroll(cellInfo.left-h._scrollData.handleSpace,!0):o.XLScroll._scrollSelectedPosition(c,o.getActiveCell(c))),p=a.find("col"),nt=n(o.getRows(c)[1]),rowIdx=e._startCell.rowIndex,colIdx=e._startCell.colIndex,(k>=cellInfo.left||y.offset().left+k>=cellInfo.left+cellInfo.width)&&(f.keyCode==39||f.keyCode==9&&!f.shiftKey)?o.XLSelection.selectRange(e._startCell,e._startCell):!p.eq(colIdx).hasClass("e-fc-hide")||f.keyCode==37||f.keyCode==9&&f.shiftKey?o.XLSelection.selectRange(e._startCell,e._endCell):!nt.eq(rowIdx).hasClass("e-fr-hide")&&(f.keyCode==38||f.keyCode==13&&f.shiftKey)?o.XLSelection.selectRange(e._startCell,e._endCell):(y.offset().top+y[0].offsetHeight>=cellInfo.top||y.offset().top+y[0].offsetHeight>=cellInfo.top+cellInfo.height)&&(f.keyCode==40||f.keyCode==13&&!f.shiftKey)&&o.XLSelection.selectRange(e._startCell,e._endCell),d&&(f.keyCode===37||f.shiftKey&&f.keyCode===9?s.colIndex=e._startCell.colIndex:f.keyCode===38||f.shiftKey&&f.keyCode===13?s.rowIndex=e._startCell.rowIndex:f.keyCode===39||f.keyCode===9?s.colIndex=e._endCell.colIndex:(f.keyCode===40||f.keyCode===13)&&(s.rowIndex=e._endCell.rowIndex),e._activeCell=s),e._startCell=s;(f.keyCode===37||f.shiftKey&&f.keyCode===9)&&o._hasClass(p[e._startCell.colIndex],"e-c-hide");)o._removeClass(p[e._startCell.colIndex],"e-fc-hide"),e._startCell.colIndex--;while((f.keyCode===38||f.shiftKey&&f.keyCode===13)&&o._hasClass(a.find("tr")[e._startCell.rowIndex],"e-r-hide"))o._removeClass(a.find("tr")[e._startCell.rowIndex],"e-fr-hide"),e._startCell.rowIndex--;while((f.keyCode===39||f.keyCode===9)&&o._hasClass(p[e._startCell.colIndex],"e-c-hide"))e._startCell.colIndex++;while((f.keyCode===40||f.keyCode===13)&&o._hasClass(a.find("tr")[e._startCell.rowIndex],"e-r-hide"))e._startCell.rowIndex++;rIdx=e._startCell.rowIndex;cIdx=e._startCell.colIndex;o.model.selectionSettings.selectionType==="row"?o.XLSelection.selectRows(rIdx,rIdx):o.model.selectionSettings.selectionType==="column"&&o.XLSelection.selectColumns(cIdx,cIdx);o.model.showRibbon&&o.XLRibbon._updateRibbonIcons();o.model.allowAutoFill&&o.XLDragFill.positionAutoFillElement();e._isFreezed&&(o.XLSelection.selectRange({rowIndex:rIdx,colIndex:cIdx},{rowIndex:rIdx,colIndex:cIdx}),o.model.allowAutoFill&&o.XLDragFill.positionAutoFillElement())}},_navToCell:function(n,t){var u=this.XLObj,e=u.getActiveSheetIndex(),r=u.getSheet(),f=hiddenWth=0;if(r._isFreezed)if(n<r._ftopRowIdx||t<r._fleftColIdx){if(r._frozenRows-1<=n&&n<r._ftopRowIdx){for(i=n;i<r._ftopRowIdx;i++)f+=r.rowsHeightCollection[i];u._scrollContent({y:-f})}if(r._frozenColumns-1<=t&&t<r._fleftColIdx){for(i=t;i<r._fleftColIdx;i++)hiddenWth+=r.columnsWidthCollection[i];u._scrollContent({x:-hiddenWth})}}else{if(r._frozenRows-1<=n&&n>r._bottomRow.idx){for(i=r._bottomRow.idx;i<n;i++)f+=r.rowsHeightCollection[i];u._scrollContent({y:+f})}if(r._frozenColumns-1<=t&&t>r._rightCol.idx){for(i=r._rightCol.idx;i<t;i++)hiddenWth+=r.columnsWidthCollection[i];u._scrollContent({x:+hiddenWth})}}},_navigateRange:function(n,t){var c=this.XLObj,h=c.getSheet(c.getActiveSheetIndex()),r=h._startCell,u=h._endCell,i=h._activeCell,f=r.rowIndex<u.rowIndex?r.rowIndex:u.rowIndex,e=r.rowIndex>u.rowIndex?r.rowIndex:u.rowIndex,o=r.colIndex<u.colIndex?r.colIndex:u.colIndex,s=r.colIndex>u.colIndex?r.colIndex:u.colIndex;if(n=="Tab")if(i.colIndex<s)this._navigateRow("Forward",t);else if(i.rowIndex<e)this._updateActiveCell(i.rowIndex+1,o,t,n);else if(i.rowIndex==e&&i.colIndex==s)this._updateActiveCell(f,o,t,n);else return!1;else if(n=="Enter")if(i.rowIndex<e)this._navigateCol("Forward",t);else if(i.colIndex<s)this._updateActiveCell(f,i.colIndex+1,t,n);else if(i.rowIndex==e&&i.colIndex==s)this._updateActiveCell(f,o,t,n);else return!1;else if(n=="ShiftTab")if(i.colIndex>o)this._navigateRow("Backward",t);else if(i.rowIndex>f)this._updateActiveCell(i.rowIndex-1,s,t,n);else if(i.rowIndex==f&&i.colIndex==o)this._updateActiveCell(e,s,t,n);else return!1;else if(i.rowIndex>f)this._navigateCol("Backward",t);else if(i.colIndex>o)this._updateActiveCell(e,i.colIndex-1,t,n);else if(i.rowIndex==f&&i.colIndex==o)this._updateActiveCell(e,s,t,n);else return!1},_navigateRow:function(n,t){var i,r,u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex())._activeCell;n==="Forward"?(i=1,r="Tab"):(i=-1,r="ShiftTab");this._updateActiveCell(f.rowIndex,f.colIndex+i,t,r)},_navigateCol:function(n,t){var i,r,u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex())._activeCell;n==="Forward"?(i=1,r="Enter"):(i=-1,r="ShiftEnter");this._updateActiveCell(f.rowIndex+i,f.colIndex,t,r)},_updateActiveCell:function(n,t,i,r){var u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex()),e=f._activeCell;u._removeClass(u.getCell(e.rowIndex,e.colIndex),"e-activecell");f._activeCell={rowIndex:n,colIndex:t};i&&this._isHiddenCell(f._activeCell)&&this._skipHiddenRowsAndCols(f._activeCell,i,!0,r);this._isMergedCell(f._activeCell)&&this._skipMergedCells(f._activeCell,i);this._scrollToCell(f._activeCell,i);u.addClass(u.getCell(f._activeCell.rowIndex,f._activeCell.colIndex),"e-activecell");u.model.allowFormulaBar&&u.updateFormulaBar();u.setSheetFocus()},_isValidParameter:function(n){var t=n.indexOf("(");return t>-1?(n=n.split("("),n[1].length>0):!0},_skipHiddenRowsAndCols:function(n,t,i,r){var e=this.XLObj,u=e.getSheet(e.getActiveSheetIndex()),f=!0;i?this._navigateRange(r,t):((t.keyCode===37||t.keyCode===9&&t.shiftKey||t.keyCode===39&&t.ctrlKey)&&n.colIndex?n.colIndex--:(t.keyCode===38||t.keyCode===13&&t.shiftKey||t.keyCode===40&&t.ctrlKey)&&n.rowIndex?n.rowIndex--:(t.keyCode===39||t.keyCode===9||t.keyCode===37&&t.ctrlKey)&&n.colIndex<u.colCount?n.colIndex++:(t.keyCode===40||t.keyCode===13||t.keyCode===38&&t.ctrlKey)&&n.rowIndex<u.rowCount?n.rowIndex++:f=!1,this._isHiddenCell(n)&&f?this._skipHiddenRowsAndCols(n,t):f||((t.keyCode===37||t.keyCode===9&&t.shiftKey)&&!n.colIndex?n.colIndex=t.keyCode===37&&t.shiftKey?u._endCell.colIndex+1:u._startCell.colIndex:(t.keyCode===38||t.keyCode===13&&t.shiftKey)&&!n.rowIndex&&(n.rowIndex=t.keyCode===38&&t.shiftKey?u._endCell.rowIndex+1:u._startCell.rowIndex)))},_isHiddenCell:function(n){return this.XLObj.XLEdit.getPropertyValue(0,n.colIndex,"isCHide")||this.XLObj.XLEdit.getPropertyValue(n.rowIndex,0,"isRHide")||!1},_isMergedCell:function(n){return this.XLObj.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"isMHide")||!1},_skipMergedCells:function(n,t){var u=this.XLObj,f=u.getSheet(u.getActiveSheetIndex()),i=f._startCell,r=f._endCell,e=!0,o=u._rcRegx;minr=i.rowIndex<r.rowIndex?i.rowIndex:r.rowIndex;maxr=i.rowIndex>r.rowIndex?i.rowIndex:r.rowIndex;minc=i.colIndex<r.colIndex?i.colIndex:r.colIndex;maxc=i.colIndex>r.colIndex?i.colIndex:r.colIndex;t.shiftKey&&t.keyCode===9?n.colIndex--:t.keyCode===9?n.colIndex++:t.shiftKey&&t.keyCode===13?n.rowIndex--:t.keyCode===13?n.rowIndex++:e=!1;n.colIndex>maxc?(n.colIndex=minc,n.rowIndex=n.rowIndex===maxr?minr:n.rowIndex+1):n.colIndex<minc?(n.colIndex=maxc,n.rowIndex=n.rowIndex===minr?maxr:n.rowIndex-1):n.rowIndex>maxr?(n.rowIndex=minr,n.colIndex=n.colIndex===maxc?minc:n.colIndex+1):n.rowIndex<minr&&(n.rowIndex=maxr,n.colIndex=n.colIndex===minc?maxc:n.colIndex-1);this._isMergedCell(n)&&e&&this._skipMergedCells(n,t)},_updateMergeRange:function(n,t,i){var f=this.XLObj,r=n.mSpan.colSpan-1,u=n.mSpan.rowSpan-1;i.shiftKey||i.keyCode!==39&&i.keyCode!==9?i.shiftKey||i.keyCode!==40&&i.keyCode!==13||(t.rowIndex=t.rowIndex+u):t.colIndex=t.colIndex+r},_isRangeMerged:function(n){var i,r={},u=this.XLObj,f=n[0],t=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"merge");if(t&&(r={rowIndex:n[0].rowIndex+t.mSpan.rowSpan-1,colIndex:n[0].colIndex+t.mSpan.colSpan-1},i=u._getSelectedRange(n[0],r),i.length===n.length))return!0},_scrollToCell:function(n,t){var f=this.XLObj,o=f.getActiveSheetIndex(),i=f._getCellInfo(n,o),r=f.getSheet(o),s=f._getContent(o),h=s.find(".e-content"),u=s.find("#hscrollBar").data("ejScrollBar"),e=s.find("#vscrollBar").data("ejScrollBar");(f.model.scrollSettings.scrollMode!=="normal"||r.colCount-1!==n.colIndex)&&(r._bottomRow.idx>0&&n.rowIndex>r._bottomRow.idx-1&&r.rowCount-1>n.rowIndex&&t.keyCode===40?e.scroll(e.value()+i.height,!0):n.rowIndex-1<r._topRow.idx&&t.keyCode===38?(e._scrollData.step=-1,n.rowIndex>0?e.scroll(i.top,!0):e.scroll(0)):n.colIndex<r._leftCol.idx?n.colIndex>0?u.scroll(u.value()-i.width,!0):u.scroll(0):h[0].offsetWidth<=i.left+i.width&&(t.keyCode===39?r.colCount===n.colIndex+1?f.XLScroll._scrollX(o):u.scroll(u.value()+i.width,!0):t.keyCode===37&&(u._scrollData.step=-1,u.scroll(i.left,!0))))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cellType=function(n){this.XLObj=n;this._isIntrnlUpdate=!1};t.spreadsheetFeatures.cellType.prototype={_renderControls:function(i,r,u,f,e){var ft,ot,tt,s,k,p;if(f){var h,l,v,it,o=this.XLObj,et=o._browserDetails.name,a,c=o._getSheetIndex(u),rt=o.getCell(i,r,c),st=o.getSheet(c),nt=o.XLEdit.getPropertyValue(i,r,"value2",c),d=f.type,g=o._generateHeaderText(r+1),w=f.text||o.XLEdit.getPropertyValue(i,r,"value2",c)||f.type+g+(i+1),b=o._dataContainer.sheetCellType,ct=o._getColWidth(r,u),ht=o._getRowHeight(i,u),ut=o.XLEdit.getPropertyValue(i,r,"cellType"),y=ut>-1?ut:o.getObjectLength(b);o._textClip(i,r,"delete","",!0);o._textClip(i,r,"add","");rt&&(l=rt[0]);o.addClass(l,"e-cellreadonly");o._dupDetails||(ut?f.isChecked=b[y].isChecked:st.cellTypes.push({range:o._getAlphaRange(u,i,r,i,r),settings:f}));switch(d){case"Button":h=o._id+"_btn_"+c+g+(i+1);o.XLFormat._writeCssRules("e-btncls"+i+r,"border: 0px; vertical-align: middle;padding: 0px;color:"+f.color+";background:"+f["background-color"]+";",!0,!0);l&&(l.innerHTML="<button id ="+h+' class = "e-btncls'+i+r+'"><\/button>');l&&(et==="mozilla"||et==="msie")&&(o.addClass(l,"e-btnhgt"),o.addClass(rt.parents(".e-table")[0],"e-btnhgt"));e||(v={type:d,id:h,text:w,color:f.color||"","background-color":f["background-color"]||""},b[y]=v,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{cellType:y},sheetIdx:c}));n("#"+h).ejButton({type:"button",width:"100%",height:"100%",text:w,create:n.proxy(this._onButtonCreate),click:n.proxy(this.onButtonClick),cssClass:f["class"]||""});break;case"CheckBox":h=o._id+"_chk_"+c+g+(i+1);l&&(l.innerHTML="<input id ="+h+' style = "" />');e||(v={type:d,id:h,text:w,isChecked:f.isChecked||nt&&nt.toLowerCase()==="true"||!1},b[y]=v,it=o.XLEdit._parseValue(v.isChecked,{rowIndex:i,colIndex:r}),it.cellType=y,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:it,sheetIdx:c}),l&&(l.lastChild.textContent=""));n("#"+h).ejCheckBox({text:"",size:"small",change:n.proxy(this.onActiveStateChange),checked:v.isChecked,cssClass:f["class"]||""});break;case"DropDownList":if(a=f.dataSourceSheetIndex||c,h=o._id+"_drpdwn_"+c+g+(i+1),dataRange=f.dataSourceRange&&o.getRangeIndices(f.dataSourceRange),l&&(l.innerHTML="<input id ="+h+" />"),a===c||o.getSheet(a)._isLoaded||o._initSheet(a),o.isUndefined(f.selectedIndex)&&w)for(ft=f.dataSource=f.dataSource||o.getRangeData({range:dataRange,sheetIdx:a}),ot=f.field=f.field||"value2",tt=ft.length;--tt>=0;)if(ft[tt][ot]===w){f.selectedIndex=tt;break}if(e||(v={type:d,id:h,text:w,style:"",dataSource:f.dataSource||"",dataSourceRange:f.dataSourceRange||"",selectedIndex:f.selectedIndex>-1?f.selectedIndex:-1,dataSourceSheetIndex:a},b[y]=v,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{cellType:y},sheetIdx:c})),f.dataSourceRange)if(s=o._getSelectedRange({rowIndex:dataRange[0],colIndex:dataRange[1]},{rowIndex:dataRange[2],colIndex:dataRange[3]}),k=o.XLEdit._getPropWithCellIdx([s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex],"ddlRange",a),k.length===0)o.updateUniqueData({ddlRange:[{rowIndex:i,colIndex:r,sheetIndex:c}]},[s[0].rowIndex,s[0].colIndex,s[s.length-1].rowIndex,s[s.length-1].colIndex],"",a);else for(p=0;p<s.length;p++)k=o.XLEdit.getPropertyValue(s[p].rowIndex,s[p].colIndex,"ddlRange",a),k?(k.push({rowIndex:i,colIndex:r}),o.XLEdit._updateDataContainer({rowIndex:s[p].rowIndex,colIndex:s[p].colIndex},{dataObj:{ddlRange:k},sheetIdx:a})):o.XLEdit._updateDataContainer({rowIndex:s[p].rowIndex,colIndex:s[p].colIndex},{dataObj:{ddlRange:[{rowIndex:i,colIndex:r}]},sheetIdx:a});n("#"+h).ejDropDownList({width:"100%",height:o.model.rowHeight-1,change:n.proxy(this.onActiveValueChange),dataSource:f.dataSource||o.getRangeData({range:dataRange,sheetIdx:a}),fields:{text:f.field||"value2"},watermarkText:f.watermarkText||"Select an option",cssClass:f["class"]||"",selectedIndex:f.selectedIndex>-1?f.selectedIndex:-1,beforePopupShown:n.proxy(this._onBeforePopupOpen)});break;case"DatePicker":h=o._id+"_dp_"+c+g+(i+1);l&&(l.innerHTML="<input id ="+h+' style = "height:'+(ht-1)+'px" />');e||(v={type:d,id:h,text:w,style:""},b[y]=v,o.XLEdit._updateDataContainer({rowIndex:i,colIndex:r},{dataObj:{cellType:y},sheetIdx:c}));n("#"+h).ejDatePicker({width:"100%",height:o.model.rowHeight-1,value:f.value||nt&&t.parseDate(nt)||new Date,create:n.proxy(this._onDateCreate),change:n.proxy(this.onDateChange),cssClass:f["class"]||""})}}},addCellTypes:function(n,t,i){var r=this.XLObj;r.model.allowCellType&&(r.model.isReadOnly||(Array.isArray(n)&&(n=r._getAlphaRange(i,n[0],n[1],n[2],n[3])),this._rangeCellTypes([{range:n,settings:t}],i,!0)))},_rangeCellTypes:function(i,r,u){var y,at,b,vt,ut,st,ht,o,yt;if(i){var f=this.XLObj,it,ft,p,k=[],ct=f._browserDetails.name,s=f._getSheetIndex(r),nt,ot=f._dataContainer,v,e,l,w,tt,h,et,rt,d=f.getSheet(s),g,lt=0,c,a;for((u||!d._isLoaded)&&(lt=d.cellTypes.length,t.merge(d.cellTypes,i),i=d.cellTypes),y=lt,at=d.cellTypes.length;y<at;y++)if(et=f.getRangeIndices(i[y].range),e=i[y].settings,v=f._getSelectedRange({rowIndex:et[0],colIndex:et[1]},{rowIndex:et[2],colIndex:et[3]}),v.length===1)f._dupDetails=!0,this._renderControls(v[0].rowIndex,v[0].colIndex,s,e),f._dupDetails=!1;else{for(b=0,vt=v.length;b<vt;b++){p=e.dataSourceSheetIndex||s;c=v[b].rowIndex;a=v[b].colIndex;f._textClip(c,a,"delete","",!0);f._textClip(c,a,"add");rt=f.getObjectLength(ot.sheetCellType);f._isRowViewable(s,c)&&(l=f.getCell(c,a,s)[0]);text=e.text||f.XLEdit.getPropertyValue(c,a,"value2",s)||e.type+f._generateHeaderText(v[b].colIndex+1)+(v[b].rowIndex+1);l&&(l.innerHTML="");f._hasClass(l,"e-cellreadonly")||f.addClass(l,"e-cellreadonly");ft=f._generateHeaderText(a+1);switch(e.type){case"Button":w=f._id+"_btn"+y+"_"+s+ft+(c+1);f.XLFormat._writeCssRules("e-btncls"+c+a,"border: 0px; vertical-align: middle; padding: 0px;color:"+(e.color||"")+";background:"+(e["background-color"]||"")+";",!0,!0);l&&(l.innerHTML="<button id ="+w+' type="button" class = "e-btncls'+c+a+'"><\/button>');(l&&ct==="mozilla"||ct==="msie")&&(f.addClass(l,"e-btnhgt"),f.addClass($cell.parents(".e-table")[0],"e-btnhgt"));(u||!d._isLoaded)&&(nt={type:e.type,id:w,text:text,color:e.color||"","background-color":e["background-color"]||""},it={cellType:rt});break;case"CheckBox":w=f._id+"_chk"+y+"_"+s+ft+(c+1);l&&(l.innerHTML="<input id ="+w+" />");(u||!d._isLoaded)&&(nt={type:e.type,id:w,text:"",isChecked:e.isChecked||!1},it=f.XLEdit._parseValue(e.isChecked||f.XLEdit.getPropertyValue(c,a,"value2")||"false",{rowIndex:c,colIndex:a}),it.cellType=rt);l&&(l.lastChild.textContent="");break;case"DropDownList":if(w=f._id+"_drpdwn"+y+"_"+s+ft+(c+1),l&&(l.innerHTML="<input id ="+w+" value = "+text+" />"),nt={type:e.type,id:w,style:"",dataSource:e.dataSource||"",dataSourceRange:e.dataSourceRange||"",selectedIndex:e.selectedIndex>-1?e.selectedIndex:"",dataSourceSheetIndex:p},tt=f.getRangeIndices(e.dataSourceRange),h=f._getSelectedRange({rowIndex:tt[0],colIndex:tt[1]},{rowIndex:tt[2],colIndex:tt[3]}),u||!d._isLoaded){if(e.dataSourceRange)if(ut=f.XLEdit._getPropWithCellIdx([h[0].rowIndex,h[0].colIndex,h[h.length-1].rowIndex,h[h.length-1].colIndex],"ddlRange",p),ut.length===0)f.updateUniqueData({ddlRange:[{rowIndex:c,colIndex:a,sheetIndex:s}]},[h[0].rowIndex,h[0].colIndex,h[h.length-1].rowIndex,h[h.length-1].colIndex],"",p);else for(o=0;o<h.length;o++)ut=f.XLEdit.getPropertyValue(h[o].rowIndex,h[o].colIndex,"ddlRange",p),ut?(ut.push({rowIndex:c,colIndex:a,sheetIndex:s}),f.XLEdit._updateDataContainer({rowIndex:h[o].rowIndex,colIndex:h[o].colIndex},{dataObj:{ddlRange:ut},sheetIdx:p})):f.XLEdit._updateDataContainer({rowIndex:h[o].rowIndex,colIndex:h[o].colIndex},{dataObj:{ddlRange:[{rowIndex:c,colIndex:a,sheetIndex:s}]},sheetIdx:p});if(p===s||f.getSheet(p)._isLoaded||f._initSheet(p),f.isUndefined(e.selectedIndex)&&text)for(st=e.dataSource||f.getRangeData({range:tt,sheetIdx:p}),e.dataSource||(e.dataSource=st),ht=e.field||"value2",e.field||(e.field=ht),o=st.length;--o>=0;){if(st[o][ht]===text){nt.selectedIndex=o;break}o==0&&delete nt.selectedIndex}it={cellType:rt}}break;case"DatePicker":w=f._id+"_dp"+y+"_"+s+ft+(c+1);l&&(l.innerHTML="<input id ="+w+" value = "+text+' style = "height:'+(f._getRowHeight(c,s)-1)+'px" />');(u||!d._isLoaded)&&(nt={type:e.type,id:w,style:""},it={cellType:rt})}(u||!d._isLoaded)&&(ot.sheetCellType[rt]=nt,f.XLEdit._updateDataContainer({rowIndex:c,colIndex:a},{dataObj:it,sheetIdx:s}));f._checkIndicesInContainer(s,v[b].rowIndex,v[b].colIndex,"cellType")&&(g=ot.sheetCellType[ot.sheets[s][v[b].rowIndex][v[b].colIndex].cellType],g.type==="CheckBox"&&g.isChecked&&k.push({type:g.type,id:g.id}),g.type==="DropDownList"&&g.selectedIndex>-1&&k.push({type:g.type,id:g.id,selectedIndex:g.selectedIndex}))}switch(e.type){case"Button":n("[id^='"+f._id+"_btn"+y+"_"+s+"']").ejButton({type:"button",width:"100%",height:"100%",text:text,create:n.proxy(this._onButtonCreate),click:n.proxy(this.onButtonClick),cssClass:i["class"]||""});break;case"CheckBox":n("[id^='"+f._id+"_chk"+y+"_"+s+"']").ejCheckBox({change:n.proxy(this.onActiveStateChange),checked:!1,cssClass:i["class"]||""});break;case"DropDownList":n("[id^='"+f._id+"_drpdwn"+y+"_"+s+"']").ejDropDownList({width:"100%",height:f.model.rowHeight-1,change:n.proxy(this.onActiveValueChange),dataSource:e.dataSource||f.getRangeData({range:tt,sheetIdx:p}),fields:{text:e.field||"value2"},watermarkText:e.watermarkText||"Select an option",cssClass:e["class"]||"",selectedIndex:e.selectedIndex>-1?e.selectedIndex:"",beforePopupShown:n.proxy(this._onBeforePopupOpen)});break;case"DatePicker":n("[id^='"+f._id+"_dp"+y+"_"+s+"']").ejDatePicker({width:"100%",height:f.model.rowHeight-1,value:e.value||new Date,create:n.proxy(this._onDateCreate),change:n.proxy(this.onDateChange),cssClass:i["class"]||""})}for(o=0,yt=k.length;o<yt;o++)this._isIntrnlUpdate=!0,k[o].type==="CheckBox"?n("#"+k[o].id).length&&n("#"+k[o].id).ejCheckBox("instance").option("checked",!0):k[o].type==="DropDownList"&&n("#"+k[o].id).length&&n("#"+k[o].id).ejDropDownList("instance").option("selectedIndex",k[o].selectedIndex),this._isIntrnlUpdate=!1}}},removeCellTypes:function(n,t){var r=this.XLObj;if(!r.model.isReadOnly){var i,e=t||r.getActiveSheetIndex(),f=r._getRangeArgs(n,"object"),u=r.XLEdit._getPropWithCellIdx(f,"cellType",t);for(i=0,len=u.length;i<len;i++)this._removeControls(u[i].rowIdx,u[i].colIdx,t)}},_removeControls:function(n,t,i,r){var e,u=this.XLObj,f=i||u.getActiveSheetIndex(),o=u._dataContainer,f=u.getActiveSheetIndex();r||(delete o.sheetCellType[o.sheets[f][n][t].cellType],delete o.sheets[f][n][t].cellType);u._isRowViewable(f,n)&&(e=u.getCell(n,t,i)[0],e.innerHTML=u.XLEdit.getPropertyValue(n,t,"value2",f)||"",u._removeClass(e,"e-cellreadonly"))},onActiveValueChange:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");if(!t.model.isReadOnly){var f=t._dataContainer,o=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(o[0]),r=t._getRowIdx(i.rowIndex,e),u=i.colIndex;f.sheetCellType[f.sheets[e][r][u].cellType].selectedIndex=n.itemId;t.XLEdit._updateDataContainer({rowIndex:r,colIndex:u},{dataObj:t.XLEdit._parseValue(n.value,{rowIndex:r,colIndex:u})});n.cellIndex=i;n.cellType="dropdownlist";t._trigger("cellSave",n);t.model.allowFormulaBar&&t.updateFormulaBar()}},onActiveStateChange:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");if(!t.model.isReadOnly&&!t.XLCellType._isIntrnlUpdate){var u=t._dataContainer,f,o=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(o[0]),s=t._getRowIdx(i.rowIndex,e),r=i.colIndex;u.sheetCellType[u.sheets[e][i.rowIndex][r].cellType].isChecked=n.isChecked;f=["yes","no"].indexOf(t.XLEdit.getPropertyValue(i.rowIndex,r,"value2").toString().toLowerCase())>-1?n.isChecked?"YES":"NO":n.isChecked.toString().toUpperCase();t.XLEdit._updateDataContainer({rowIndex:i.rowIndex,colIndex:r},{dataObj:t.XLEdit._parseValue(f,{rowIndex:i.rowIndex,colIndex:r})});n.cellIndex=i;n.cellType="checkbox";t._trigger("cellSave",n);t.model.allowFormulaBar&&t.updateFormulaBar()}},_onDateCreate:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet"),o=t._dataContainer,f=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(f[0]),r=t._getRowIdx(i.rowIndex,e),u=i.colIndex;t.XLEdit._updateDataContainer({rowIndex:r,colIndex:u},{dataObj:t.XLEdit._parseValue(n.model.value.toLocaleString().split(", ")[0],{rowIndex:r,colIndex:u})})},onDateChange:function(n){var i=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");if(!i.model.isReadOnly){var s=i._dataContainer,e=this.element.closest("td"),o=i.getActiveSheetIndex(),r=i._getCellIdx(e[0]),u=i._getRowIdx(r.rowIndex,o),f=r.colIndex;i.XLEdit._updateDataContainer({rowIndex:u,colIndex:f},{dataObj:i.XLEdit._parseValue(n.model.value.toLocaleString().split(t.isNullOrUndefined(n.model.value.toLocaleString().match(/[,]/))?" ":", ")[0],{rowIndex:u,colIndex:f})});n.cellIndex=r;n.cellType="datepicker";i._trigger("cellSave",n)}},_onButtonCreate:function(n){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet"),o=t._dataContainer,f=this.element.closest("td"),e=t.getActiveSheetIndex(),i=t._getCellIdx(f[0]),r=t._getRowIdx(i.rowIndex,e),u=i.colIndex;t.XLEdit._updateDataContainer({rowIndex:r,colIndex:u},{dataObj:t.XLEdit._parseValue(n.model.text,{rowIndex:r,colIndex:u})})},onButtonClick:function(t){var i=this.element.closest(".e-spreadsheet").data("ejSpreadsheet");i.model.isReadOnly||(t.cellIndex=i._getCellIdx(n(t.target).closest("td")[0]),t.cellType="button",i._trigger("cellClick",t))},_onBeforePopupOpen:function(){var t=this.element.closest(".e-spreadsheet").data("ejSpreadsheet"),r=t.getActiveSheetIndex(),f=t._dataContainer,s=this.element.closest("td"),e=t._getCellIdx(s[0]),h=t._getRowIdx(e.rowIndex,r),c=e.colIndex,i=f.sheetCellType[f.sheets[r][h][c].cellType],u=i.dataSourceSheetIndex||r,o;t.getSheet(u)._isLoaded||t._initSheet(u);o=i.dataSource||t.getRangeData({range:t.getRangeIndices(i.dataSourceRange),sheetIdx:u});n("#"+i.id).ejDropDownList("instance").option("dataSource",o);n("#"+i.id).ejDropDownList("instance").option("selectedItemIndex",i.selectedIndex)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cellFormatting=function(n){this.XLObj=n;this._formatEnable=!1;this._thousandSeparator=t.preferredCulture(this.XLObj.model.locale).numberFormat[","];this._formatAsTableStyle={};this._rowLength=null;this._colLength=null;this._getFormat=null;this._getEformatClass=null;this._borderPosition=["top","right","bottom","left"];this._cellObj=null;this._isFAT=!1;this._customFormatSpecifierType={};this._customFontFamily={}};t.spreadsheetFeatures.cellFormatting.prototype={format:function(i,r){var u=this.XLObj,yt,v;if(u.model.allowCellFormatting&&!u.model.isReadOnly){var f,e,y,b,rt,ct,ut,ft,h,g,a,k,c,et,nt,l,lt,ot=0,d={},at=[],tt="style",it="format",s=u.getActiveSheetIndex(),o=u.getSheet(s),wt=u._rAlign,p=u._dataContainer,w={sheetIndex:s,reqType:"cell-format"},pt=u._dupDetails,st=!1,vt=o.rowsHeightCollection,ht=0;if((y=u._getMultiRangeCells(r),g=y.length,!u._trigger("beforeCellFormat",{sheetIndex:s,format:i,cells:y}))&&g){if(i=this._getFormatObj(i),tt in i||it in i){for(w.oprType=(tt in i)?"style":"format",lt=y[g-1].colIndex;ot<g;){if(e=y[ot],k={sheetIndex:s,format:i,cell:e},this._cellObj={},f={rowIndex:e.rowIndex,colIndex:e.colIndex,beforeFormat:{},afterFormat:{},bRowHeight:u.model.allowResizing&&u.XLResize.getRowHeight(e.rowIndex)},d=t.isNullOrUndefined(p.sheets[s][f.rowIndex])?{}:t.isNullOrUndefined(p.sheets[s][f.rowIndex][f.colIndex])?{}:p.sheets[s][f.rowIndex][f.colIndex],u._isRowViewable(s,e.rowIndex)&&(ft=u.getCell(e.rowIndex,e.colIndex),h=ft[0]),tt in i&&(f.prevClass=u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,it),f.prevClass=f.prevClass?f.prevClass:"",l=this._getExtendedFormat(e,i.style),l.format["text-align"]&&l.format["text-align"].toLowerCase()==="right"&&!u._hasClass(h,"e-rightalign")?u.addClass(h,"e-rightalign"):(!l.format["text-align"]||l.format["text-align"].toLowerCase()!=="right")&&u._hasClass(h,"e-rightalign")&&u._removeClass(h,"e-rightalign"),this._cellObj.formats=n.extend(!0,{},l.format),rt=u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"tformats"),rt&&(l.format=n.extend(rt,l.format)),this._cellObj.format=f.className=this._createFormatClass(l.format),f.beforeFormat=n.extend(!0,{},d),("font-family"in i.style||"font-size"in i.style)&&!u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"isMHide")&&t.isNullOrUndefined(u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"merge"))&&(nt=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex),u.model.allowResizing&&(u.isNumber(nt)||u._isDateTime(nt)||u.isTime(nt))&&(et=u.XLResize._getContentWidth(f.colIndex,s,f.rowIndex,f.rowIndex)+2,et>o.columnsWidthCollection[f.colIndex]&&u.setWidthToColumns([{colIndex:f.colIndex,width:et}])),u.model.allowSelection&&u.XLSelection._refreshBorder(),st=!0),k.cssClass=l.className),it in i&&i.type&&(a=u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex),a=t.isNullOrUndefined(a)?"":a,this._cellObj.value=a,this._cellObj.type=i.type,this._cellObj.formatStr=i.format.formatStr,this._cellObj.decimalPlaces=i.format.decimalPlaces,this._cellObj.thousandSeparator=i.format["thousandSeparator"]?!0:!1,this._cellObj.canUpdate=!0,f.beforeFormat=n.extend(!0,{},d),a=this._getFormattedValue(f.rowIndex,f.colIndex,this._cellObj,a),k.value=this._cellObj.value,k.value2=this._cellObj.value2=t.isNullOrUndefined(a)?"":a+"",delete this._cellObj.canUpdate,f.beforeFormat.Oprtype=this._cellObj.type),u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2")&&u._textClip(f.rowIndex,f.colIndex,"delete"),u.XLEdit._updateDataContainer(f,{dataObj:this._cellObj}),tt in i&&("font-family"in i.style||"font-size"in i.style)&&!u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"isMHide")){if(b=o.columnsWidthCollection[f.colIndex],u.XLEdit.getPropertyValue(e.rowIndex,e.colIndex,"merge")&&u._isRowViewable(s,e.rowIndex)){if(h.colSpan>1)for(v=e.colIndex+1,yt=e.colIndex+h.colSpan;v<yt;v++)b=b+o.columnsWidthCollection[v];if(c=u._detailsFromGlobalSpan(f.rowIndex,f.colIndex,"height",u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2"),b),h.rowSpan>1)for(v=e.rowIndex;v<e.rowIndex+h.rowSpan;v++)ht=ht+vt[v];c=c-(ht-vt[e.rowIndex])}else c=u._detailsFromGlobalSpan(f.rowIndex,f.colIndex,"height",u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2"),b);(u.XLEdit.getPropertyValue(f.rowIndex,0,"wrapRow")?o.rowsHeightCollection[f.rowIndex]<c:!0)&&c>=u.model.rowHeight&&(h&&ft.parent().outerHeight(c),o.rowsHeightCollection[f.rowIndex]=c,u.XLEdit._updateDataContainer({rowIndex:f.rowIndex,colIndex:0},{dataObj:{pHeight:o.rowsHeightCollection[f.rowIndex],cHeight:c}}),u._fRowHtColl[f.rowIndex]=c,st=!0,u.model.allowFreezing&&(u.XLFreeze._refreshFRowResize(e.rowIndex),u.XLFreeze._refreshFColResize(e.colIndex)))}ct=u._getCellInfo(e);u._dupDetails=!0;it in i&&["text","general"].indexOf(this._cellObj.type)===-1&&(ut=u._detailsFromGlobalSpan(e.rowIndex,e.colIndex,"width",this._cellObj.value2),ut>ct.width&&u.XLResize.setColWidth(e.colIndex,ut),u.model.allowFreezing&&u.XLFreeze._refreshFColResize(e.colIndex));u._dupDetails=!1;u._dupDetails=pt;o._isColSelected&&o.selectedRange[1]<=f.colIndex&&f.colIndex<=o.selectedRange[3]&&(o._columnStyles[f.colIndex]=n.extend(!0,o._columnStyles[f.colIndex],this._cellObj));o._isRowSelected&&o.selectedRange[0]<=f.rowIndex&&f.rowIndex<=o.selectedRange[2]&&(o._rowStyles[f.rowIndex]=n.extend(!0,o._rowStyles[f.rowIndex],this._cellObj));this._cellObj=null;d=t.isNullOrUndefined(p.sheets[s][f.rowIndex])?{}:t.isNullOrUndefined(p.sheets[s][f.rowIndex][f.colIndex])?{}:p.sheets[s][f.rowIndex][f.colIndex];f.afterFormat=n.extend(!0,{},d);f.afterFormat.Oprtype=f.beforeFormat.Oprtype;f.aRowHeight=u.model.allowResizing&&u.XLResize.getRowHeight(e.rowIndex);at.push(f);u._trigger("cellFormatting",k);u.XLEdit.getPropertyValue(f.rowIndex,f.colIndex,"value2")&&u._textClip(f.rowIndex,f.colIndex,"add");lt===f.colIndex&&u._setRowHdrHeight(s,f.rowIndex);ot++}w.selectedCell=at;w.range=o.selectedRange;u.XLScroll._getRowHeights(s,y[0].rowIndex);st&&(!o._isImported||o._isLoaded)&&u.model.allowComments&&!u._isExport&&u.XLComment._updateCmntArrowPos(null,s)}"border"in i&&!u._isMultiRange(r)?this.applyBorder(i.border,r,w):o._isImported&&!o._isLoaded||u._isUndoRedo||u._dupDetails||u._isSort||u._isExport||(u._completeAction(w),u._trigActionComplete(w))}}},_getFormattedValue:function(n,i,r,u){var o,f=this.XLObj,e={},u=t.isNullOrUndefined(u)?"":f.XLEdit.getPropertyValue(n,i);return t.isNullOrUndefined(u)&&(u=""),f.isFormula(u)&&(u=f.XLEdit.getPropertyValue(n,i,"calcValue"),r.canUpdate=!1),["text","general"].indexOf(r.type)!==-1?(f._isDateTime(u)&&(o=f.XLEdit.getPropertyValue(n,i,"type"),u=f._dateToInt(u,o===t.Spreadsheet.CellType.Time),r.value=u),r.type===t.Spreadsheet.CellType.Text?e.align="":f.isNumber(u)&&f.XLEdit.getPropertyValue(n,i,"align")!="right"&&(e.align=t.Spreadsheet.Align.Right),"align"in e&&(e.cellIdx={rowIndex:n,colIndex:i},f.XLEdit._refreshCellAlignment(e))):u=this._format(u,{formatStr:r.formatStr,type:r.type,thousandSeparator:r.thousandSeparator,decimalPlaces:r.decimalPlaces,cellObj:r}),u},_format:function(n,i){var u=this.XLObj,e=i.formatStr,r=u.isUndefined(n)?"":n,l=i.type||"",f=t.Spreadsheet.CellType,h=u.model.locale,a=["."].indexOf(this._thousandSeparator)>-1?"\\":"",v=new RegExp(a+this._thousandSeparator,"g");n=r.toString();switch(l){case f.Accounting:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.toAccounting(e,r,h));break;case f.Currency:case f.Number:case f.Percentage:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.formatting(e,r,h),!i.thousandSeparator&&[f.Number,f.Percentage].indexOf(l)>-1&&this._thousandSeparator&&(r=r.replace(v,"")));break;case f.Scientific:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.toExponential(r,i.decimalPlaces));break;case f.Fraction:u._isDateTime(r)&&(r=u._dateToInt(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r));u.isNumber(r)&&(r=u.toFraction(r),r="numerator"in r?r.integer+" "+r.numerator+"/"+r.denominator:r.integer);break;case f.LongDate:case f.ShortDate:case f.Date:case f.Time:case f.DateTime:u.isNumber(r)?(r=u.intToDate(r),this._cellObj&&this._cellObj.canUpdate&&(this._cellObj.value=r)):u._isDateTime(r)||(r=t.parseDate(r));u._isDateTime(r)&&(r=u.formatting(e,r,h));break;case f.String:var c=e.indexOf("\\"),o=e.indexOf("#"),s=e.split("\\").join("");o<0&&(o=e.indexOf("0"));c<o?r=s.substr(c,s.length-1)+n:c>o&&(r=n+s.substr(o+1,s.length))}return t.isNullOrUndefined(r)?n:r},createTable:function(i,r){var u=this.XLObj;if(u.model.allowFormatAsTable&&(u.model.allowSelection||!t.isNullOrUndefined(r))&&!u.model.isReadOnly){t.isNullOrUndefined(i.format)&&(i.format=this._getTableLayoutFromName(i.formatName).format);t.isNullOrUndefined(i.showHeaderRow)&&(i.showHeaderRow=!0);var o,p,d,f,k,c,s,v=i.name||"",h=u.getActiveSheetIndex(),e=u.getSheet(h),w=e.tableManager,l=e._startCell,a=e._endCell,g="formatName",b={sheetIndex:h,tableStyle:i,reqType:"format-table"},nt=i.format||this._getTableLayoutFromName(i.formatName).format,y={format:nt},it=u._dupDetails,tt=u.element.find("#"+u._id+"_Ribbon_tsofiltercolumn");if(p={range:t.isNullOrUndefined(r)?[l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]:r,sheetIndex:b.sheetIndex,tableStyle:b.tableStyle,reqType:b.reqType},!u._trigActionBegin(p)&&nt)return(i=b.tableStyle,this._isFAT=!0,r=u._getRangeArgs(r,"object"),f=u._isUndoRedo?n.merge([],r):r?r:e.selectedRange,i.name&&!u.XLRibbon._validateNamedRange(i.name,u._getDollarAlphaRange(f,!0))&&!u.XLClipboard._isCut)?void 0:(k=u.XLEdit.getPropertyValue(f[0],f[1],"tableName")||"",(!e._isImported||e._isLoaded)&&(d=u.getRange(f),o={sheetIndex:h,reqType:"format-table",beforeFormat:this.getHashCodeClassAsArray(),beforeRange:n.extend(!0,[],f),pcells:d,beforeRangeHeader:u.getRangeData({range:[f[0],f[1],f[0],f[3]]})},c=i.header?[f[0],f[1],f[2],f[3]]:[f[0],f[1],f[2]+1,f[3]],o.beforeRangeData=u.getRangeData({range:c}),o.beforeMergeRange=u.XLEdit._getPropWithCellIdx(c,"merge",h),u._dupDetails=!0,o.beforeMergeRange.length&&u.unmergeCells(u._getAlphaRange(h,c[0],c[1],c[2],c[3])),u._dupDetails=!1),g in i&&(y[g]=i.formatName),"showHeaderRow"in i&&(y.showHeaderRow=i.showHeaderRow),k?(this._formatAsTableStyle=y,u._dupDetails=!0,this._createTable(u._getTableID(k),y),u._dupDetails=!1,u._undoCollection.pop(),u._undoCollection.pop()):(s=u.XLClipboard._isCut?parseInt(i.tblId):u.getObjectLength(w)+1,v=v.length?v:"Table"+s,u.model.sheets[h]._header[s]={header:i.header},e._isLoaded&&(i.header?(r?(e._startCell={rowIndex:r[0],colIndex:r[1]},e._endCell={rowIndex:r[2],colIndex:r[3]},u.XLSelection.selectRange(e._startCell,e._endCell),u.model.allowAutoFill&&(!e._isImported||e._isLoaded)&&u.XLDragFill.positionAutoFillElement()):r=u.swapRange([l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]),r[0]===r[2]&&(f=r,f[2]=f[2]+1)):(u._isUndoRedo?f=n.extend(!0,[],r):(f=r?r:u.swapRange([l.rowIndex,l.colIndex,a.rowIndex,a.colIndex]),r=f),u.model.allowDragAndDrop&&u.XLDragDrop._moveRangeTo(f,[f[0]+1,f[1],f[2]+1,f[3]],["value","value2","type","formatStr","decimalPlaces","thousandSeparator","range","format","border","borders","comment","hyperlink","picture","cFormatRule","rule","chart","isLocked","wrap","formats","tformats","tborders","tableName"]),e._startCell={rowIndex:f[0],colIndex:f[1]},e._endCell={rowIndex:f[2]+1,colIndex:f[3]},u.XLSelection.selectRange(e._startCell,e._endCell),u.model.allowAutoFill&&(!e._isImported||e._isLoaded)&&u.XLDragFill.positionAutoFillElement(),f[2]=f[2]+1)),"dataSource"in i&&u.updateRange(h,{showHeader:"showHeader"in i?i.showHeader:!0,startCell:u._getAlphaRange(h,r[0],r[1],r[0],r[1]),dataSource:i.dataSource}),u.updateUniqueData({tableName:"e-table"+s},r),w[s]={name:v,range:f,showHeaderRow:i.showHeaderRow},i.fnNumber&&(w[s].fnNumber=i.fnNumber),w[s].isFilter=i.showHeaderRow,u.XLRibbon._isDesignTab=!0,u._dupDetails=!0,this._createTable(s,y),i.showHeaderRow&&u.model.allowFiltering&&u.XLFilter._filterTable(h,s,{startCell:{rowIndex:r[0],colIndex:r[1]},endCell:{rowIndex:r[2],colIndex:r[3]}}),u._dupDetails=!1,this._updateTblStyleOptns(s,i),e._isImported&&!e._isLoaded||i.hideTab||u.XLRibbon._designTabUpdate(s,{rowIndex:r[0],colIndex:r[1]}),u.model.allowComments&&u.XLComment._updateCmntArrowPos()),(!e._isImported||e._isLoaded)&&(u.XLRibbon._dirtySelect(u.getRange(r)),o.tableID=s,o.tableStyle=i,o.afterRange=f,u._dupDetails=it,p={pCells:o.pcells,reqType:o.reqType,sheetIndex:o.sheetIndex,tableID:o.tableID,tableStyle:o.tableStyle},u._isPaste||u._isUndoRedo||u._dupDetails||u._isExport||(u._completeAction(o),u._trigActionComplete(p))),tt.length&&tt.ejCheckBox("option",{checked:!0}),u.XLRibbon.addNamedRange(v,u._getDollarAlphaRange(r,!0),null,h),e._isLoaded&&u.XLSelection._refreshBorder(),this._isFAT=!1,i.name)}},_createTable:function(t,i){var f,s,h,u,c,tt,it,rt,k,d,e,g,a=1,ut="format",ht=ut+"s",lt="t"+ht,ft="border",et="tableName",nt="e-table"+t,ot=!1,r=this.XLObj,o=r.getActiveSheetIndex(),ct=r.getSheet(o),y=ct.tableManager[t],p=y.range,v=p[0],w=p[1],st=p[2],b=p[3],at=r.element.find("#"+r._id+"_Ribbon_tsofiltercolumn");if(y[ut]=i.format,i.formatName&&(y["formatName"]=i.formatName),y.showHeaderRow&&(i.showHeaderRow=y.showHeaderRow),this.removeStyle(p,{tableStyle:!0,border:!0,sheetIdx:o}),i.showHeaderRow&&"headerLayout"in i.format&&(u=n.extend(!0,{},i.format.headerLayout),ft in u&&(c=r._getProperAlphaRange(o,v,w,v,b),r._intrnlReq=!0,this.applyBorder(u.border,c),r._intrnlReq=!1,delete u.border)),ot=r.getObjectLength(u)>0,f=v,s=w,h=b,i.showHeaderRow)while(s<=h)d=!1,e={},cellIdx={rowIndex:f,colIndex:s},tt=r.XLEdit.getPropertyValue(f,s,"value2")||"",it="Column"+a,r.XLEdit.getPropertyValue(f,s,et,o)!==nt&&(e.tableName=nt,d=!0),tt.length?tt.toLowerCase()===it.toLowerCase()&&a++:(r.XLEdit._updateCell(cellIdx,it),a++),ot&&(k=this._getExtendedFormat(cellIdx,u,this._isFAT),e.format=this._createFormatClass(k.format),e.tformats=u,d=!0),d&&r.XLEdit._updateDataContainer(cellIdx,{dataObj:e,sheetIdx:o}),s++;if("contentLayout"in i.format)for(rt=i.format.contentLayout.length,a=0,f=i.showHeaderRow?v+1:v,s=st;f<=s;){if(u=n.extend(!0,{},i.format.contentLayout[a%rt]),ft in u&&(c=r._getProperAlphaRange(o,f,w,f,b),r._intrnlReq=!0,this.applyBorder(u.border,c),r._intrnlReq=!1,delete u.border),r.getObjectLength(u))for(h=w,l=b;h<=l;)e={},cellIdx={rowIndex:f,colIndex:h},g=n.extend({},u),r.XLEdit.getPropertyValue(f,h,et,o)!==nt&&(e.tableName=nt),g.color&&r.XLEdit.getPropertyValue(f,h,"hyperlink")&&delete g.color,k=this._getExtendedFormat(cellIdx,g,this._isFAT),e.format=this._createFormatClass(k.format),e.tformats=u,r.XLEdit._updateDataContainer(cellIdx,{dataObj:e,sheetIdx:o}),h++;f++;a++}"contentBorder"in i.format&&(c=r._getProperAlphaRange(o,v+1,w,st,b),r._intrnlReq=!0,this.applyBorder(n.extend({},i.format.contentBorder.border),c),r._intrnlReq=!1);r.XLClipboard._isCut||r._tableCnt++},_updateTblStyleOptns:function(n,t){var i,r,e="firstColumn",o="lastColumn",h="bold",c="normal",l="totalRow",s="isFilter",u=this.XLObj,f=u._getSheetIndex(),v=u.getSheet(f),a=v.tableManager;n in a&&(i=a[n],r=i.range,i[s]=s in t?t.isFilter:"showHeaderRow"in t?t.showHeaderRow:!0,u.model.allowFiltering&&!i[s]&&u.XLFilter._clearFilterTableIcon(f,n),u._dupDetails=!0,e in t&&(i[e]=t.firstColumn,this.format({style:{"font-weight":i[e]?h:c}},u._getProperAlphaRange(f,r[0]+1,r[1],r[2],r[1]))),o in t&&(i[o]=t.lastColumn,this.format({style:{"font-weight":i[o]?h:c}},u._getProperAlphaRange(f,r[0]+1,r[3],r[2],r[3]))),u._dupDetails=!1,l in t&&(i[l]=t.totalRow))},removeTable:function(t){var i=this.XLObj;if(i.model.allowFormatAsTable&&!i.model.isReadOnly){var r,c,l,e,a,o,u=0,s=i.getActiveSheetIndex(),h=i.getSheet(s).tableManager,f=h[t].range,y=h[t].name,v=i.element.find("#"+i._id+"_Ribbon_tsofiltercolumn");if(t in h){if(i.clearRangeData(f,["tableName"]),r=i._getSelectedRange({rowIndex:f[0],colIndex:f[1]},{rowIndex:f[2],colIndex:f[3]}),c=r.length,c)while(u<c)l=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"formats"),e=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"tformats"),a=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"borders"),o=i.XLEdit.getPropertyValue(r[u].rowIndex,r[u].colIndex,"tborders"),e&&(n.extend(e,l),i.XLEdit._updateDataContainer(r[u],{dataObj:{formats:e}})),o&&(n.extend(o,a),i.XLEdit._updateDataContainer(r[u],{dataObj:{borders:o}})),i.XLEdit._clearDataContainer({cellIdx:{rowIndex:r[u].rowIndex,colIndex:r[u].colIndex},property:["tformats","tborders"]}),u++;i.model.allowFiltering&&!i._isFATResize&&i.XLFilter._clearFilterTable(s,parseInt(t));delete h[t];delete i.model.sheets[s]._header[t];i.XLRibbon.removeNamedRange(y);v.length&&v.ejCheckBox("option",{checked:!1});i.XLRibbon._toggleDesignTab(i.getActiveCell(s))}}},_renameTable:function(t){var i=this.XLObj,h=i.getActiveSheetIndex(),u=i.getSheet(h).tableManager,r=i._getTableID(t),f,e,o,c=n("#"+i._id+"_Ribbon").data("ejRibbon"),s;r&&(s=document.getElementById(i._id+"_Ribbon_Design_Properties_TableName")&&document.getElementById(i._id+"_Ribbon_Design_Properties_TableName").value,f=u[r].name,f!=s&&(e=i._getDollarAlphaRange(u[r].range,!0),i.XLRibbon._validateNamedRange(s,e)&&(o={sheetIndex:h,reqType:"format-table",action:"renaming",range:e,tableId:parseInt(r),prevName:f},i.XLRibbon.removeNamedRange(f),u[r].name=s,i.XLRibbon.addNamedRange(u[r].name,e,null,h),o.newName=u[r].name,c.showTab(i._getLocStr("Design")),i._completeAction(o),i._trigActionComplete(o))))},_getTableLayoutFromName:function(n){if(n)return this.XLObj._FATStyles[n]},_getTableIdxFromName:function(n){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()).tableManager,t=i.getObjectLength(r);if(t)while(t--)if(r[t].name===n)return t;return-1},convertToRange:function(n){var t=this.XLObj;t.model.isReadOnly||(n.alert?t._showAlertDlg("","ConverToRangeAlert","ConvertToRange",498):this._convertToRange(n))},_convertToRange:function(t){var r=this.XLObj,e=t.sheetIdx||r.getActiveSheetIndex(),h=r.getSheet(e),u,o,f=r.getSheet(e).tableManager,s=h.filterSettings.tableRange;for(u=t.tableId||r._getTableID(null,document.getElementById(r._id+"_Ribbon_Design_Properties_TableName")&&document.getElementById(r._id+"_Ribbon_Design_Properties_TableName").value),i=0;i<s.length;i++)s[i].tableID==u&&(tableId=i);r.getObjectLength(f)&&(o={sheetIndex:e,reqType:"format-table",action:"Design_Tools_ConvertToRange",beforeFormat:r.XLFormat.getHashCodeClassAsArray(),tableID:u,name:f[u].name,format:f[u].format,formatName:f[u].formatName,tableRange:s[tableId],beforeRange:f[u].range,isFilter:f[u].isFilter,header:n.extend(!0,[],h._header[u]),firstColumn:f[u].firstColumn,lastColumn:f[u].lastColumn,totalRow:f[u].totalRow,fnNumber:f[u].fnNumber});r.isNumber(u)&&r.XLFormat.removeTable(u);r.model.showRibbon&&r.XLRibbon._toggleDesignTab(r.getActiveCell());r._completeAction(o);r._trigActionComplete(o)},_calculateTotalRow:function(r,u,f,e,o){var s=this.XLObj,v,d=[],g=[],w,y,h,b=!1,p,rt=s.getSheet(r),l=rt.tableManager,nt,k,tt=s._id+"_Ribbon_Design_TableStyleOptions_TotalRow",et=n("#"+tt).data("ejCheckBox"),c,a,it=s._isUndo,ut=s._isUndoRedo,ft=s._dupDetails;if(u=u||parseInt(document.getElementById(s._id+"_tableid").value),h=l[u].range,d.push(s.getRangeData({range:[h[2]+1,h[1],h[2]+1,h[3]]})),w=s._getProperAlphaRange(r,h[0]+1,h[3],h[2],h[3]),v=s._getSelectedRange({rowIndex:h[2]+1,colIndex:h[1]},{rowIndex:h[2]+1,colIndex:h[3]}),f){if(c={rowIndex:h[2]+1,colIndex:h[1]},a={rowIndex:h[2]+1,colIndex:h[3]},s._dupDetails=s._isTotalRow=!0,s._insRows={startRow:c.rowIndex,endRow:a.rowIndex},s._isUndo=!1,!o&&(s._isUndoRedo?s.insertEntireRow(c.rowIndex,a.rowIndex):nt=s.insertShiftBottom(c,a),nt))return;if(s._isUndo=it,s._isUndoRedo=ut,s._dupDetails=s._isTotalRow=!1,!s._isFilterApplied||s._insDelStatus=="insert"){if(v.length>1&&s.XLEdit._updateCellValue(v[0],f?"Total":""),!l[u].fnNumber&&f){if(p=t.distinct(s.getRangeData({range:s.getRangeIndices(w),valueOnly:!0})),p=p.filter(Boolean),i=p.length,i){while(i--)if(!s.isNumber(p[i])){b=!0;break}}else b=!0;l[u].fnNumber=b?103:109}s.XLEdit._updateCellValue(v[v.length-1],f?"=SUBTOTAL("+l[u].fnNumber+","+w+")":"");l[u].range[2]+=1;s._insDelStatus==""}}else c={rowIndex:h[2],colIndex:h[1]},a={rowIndex:h[2],colIndex:h[3]},s._dupDetails=s._isTotalRow=!0,s.model.allowFiltering&&s.XLFilter._checkFilterApplied(r,c.rowIndex,1,c.colIndex,1,"filter"),s._checkTableApplied(r,c.rowIndex,1,c.colIndex,1,"filter"),s._isFilterApplied||s._isTableApplied?(s._intrnlReq=!0,s._isUndo=!1,s.deleteEntireRow(c.rowIndex,a.rowIndex),s._isUndo=it,s._intrnlReq=!1,e=!1):s._deleteShiftUp(r,c,a,{startCol:c.colIndex,colCount:a.colIndex-c.colIndex+1,startRow:c.rowIndex,rowCount:a.rowIndex-c.rowIndex+1,status:"shiftUp"}),s._isTotalRow=!1,l[u].range[2]-=1;s._dupDetails=ft;f?l[u].totalRow=!0:"totalRow"in l[u]&&delete l[u].totalRow;y=l[u].range;s.XLFormat._createTable(u,{format:l[u].format});g.push(s.getRangeData({range:[y[2]+1,y[1],y[2]+1,y[3]]}));k={sheetIndex:r,reqType:"format-table",action:"totalrow",range:w,check:f,id:tt,cell:v,tmgr:l,tableId:u,pcells:d[0],curCells:g[0],fnNumber:l[u].fnNumber,isShift:e};o&&(s._dupDetails=s._isUndoRedo=!1);s._dupDetails||(s._completeAction(k),s._trigActionComplete(k));s._dupDetails=!1},_updateTotalRow:function(n,t,i,r,u){var f=this.XLObj,o=f.getSheet(n),e=o.tableManager;e[t].fnNumber=i;u&&f._clearFormula(r[2],r[3]);f.XLEdit._updateCellValue({rowIndex:r[2],colIndex:r[3]},"=SUBTOTAL("+e[t].fnNumber+","+f._getAlphaRange(val.sheetIndex,r[0]+1,r[3],r[2]-1,r[3])+")")},customFormatParser:function(n){if(this.XLObj.model.allowCellFormatting){var i,f,e,o={},h=t.Spreadsheet.CellType,r="{0:",u="}",c="N",a="P",s=".",l="0";return n=t.isNullOrUndefined(n)?"":n.toString(),Number(n)===0?(n.indexOf(s)>-1?(e=n.split(s),i=r+c+e[1].length+u):i=r+"D"+n.length+u,f=h.Number):!n.indexOf("#")&&n.indexOf(",")>-1&&n.lastIndexOf(l)===n.length-1?(n.indexOf(s)>-1?(e=n.split(s),i=r+c+e[1].length+u):i=r+c+l+u,o.thousandSeparator=!0,f=h.Number):n.lastIndexOf("%")===n.length-1&&Number(n.replace(/%/g,""))===0?(n.indexOf(s)>-1?(e=n.split(s),i=r+a+--e[1].length+u):i=r+a+l+u,f=h.Percentage):/^[dMy/\-\s,]+$/.test(n)?(i=r+n+u,f=h.Date):/^[hmst:\s]+$/.test(n)?(i=r+n+u,f=h.Time):n.indexOf("\\")>-1&&(o.formatStr=n,o.type="string"),i&&(o.formatStr=i,o.type=f),o}},addCustomFormatSpecifier:function(n,i,r){var e,u=t.Spreadsheet.CellType,f=t.cultures[this.XLObj.model.locale];if([u.Date,u.DateTime,u.LongDate,u.ShortDate,u.Time].indexOf(r)>-1){for(e in f.calendar.patterns)if(f.calendar.patterns[e]==i)return;n||(n="cDFrmt"+Object.keys(f.calendar.patterns).length);f.calendar.patterns[n]=i;this._customFormatSpecifierType[n]=r}},addFontFamily:function(i){var s,r,h=i,e=this._customFontFamily,f=this.XLObj,u=49,o;if(i=i.toLowerCase(),f.isUndefined(e[i])){for(s in e)o=parseInt(e[s]),o>u&&(u=o);u++;f.model.showRibbon&&(r=n("#"+f._id+"_Ribbon_Home_Font_FontFamily").data("ejDropDownList"),ddDataSrc=n.extend(!0,[],f.XLRibbon._fontFamily),ddDataSrc.push({text:h,value:u}),r&&(selectedIdx=r.model.selectedItemIndex,r.option({dataSource:ddDataSrc}),r._initValue=!0,r.selectItemByIndex(selectedIdx),r._initValue=!1,f.XLRibbon._fontFamily=ddDataSrc));e[i]=u+"";t.Spreadsheet.FontFamily[i]=u+""}},removeFontFamily:function(i){var e,r,o=this._customFontFamily,u=this.XLObj,f,s;if(u.model.showRibbon)for(r=n("#"+u._id+"_Ribbon_Home_Font_FontFamily").data("ejDropDownList"),f=n.extend(!0,[],u.XLRibbon._fontFamily),e=0;e<f.length;e++)if(f[e].text===i){f.splice(e,1);r&&(s=r.model.selectedItemIndex,r.option({dataSource:f}),r._initValue=!0,r.selectItemByIndex(s),r._initValue=!1);u.XLRibbon._fontFamily=f;break}i=i.toLowerCase();u.isUndefined(o[i])||(delete o[i],u.isUndefined(t.Spreadsheet.FontFamily[i])||delete t.Spreadsheet.FontFamily[i])},applyBorder:function(i,r,u){var f=this.XLObj,e,o;f.model.allowCellFormatting&&f.model.formatSettings.allowCellBorder&&!f.model.isReadOnly&&(e=f.getActiveSheetIndex(),o=f.getSheet(e),r=f._getRangeArgs(r,"object",e),(!o._isImported||o._isLoaded)&&(u||(u={sheetIndex:e,reqType:"cell-format",process:"border",options:n.extend(!0,{},i)}),u.range=r,u.beforeFormat=this.getHashCodeClassAsArray(r),u.property=i.property,delete i.property),f.getObjectLength(i)?i.isGridBorder?this._applyAllBorderCss(i,r,u):this._applyBorderCss(i,r,u):this.removeStyle(r,{cellStyle:!0,border:!0,sheetIdx:e}),o._isImported&&!o._isLoaded||f._isUndoRedo||(f._refreshRangeTRHght(e,r),t.isNullOrUndefined(i.tableID)&&!this._dupDetails&&(u.afterFormat=this.getHashCodeClassAsArray(r),f._intrnlReq||(f._completeAction(u),f._trigActionComplete(u)))))},updateDecimalPlaces:function(i,r){var u=this.XLObj;if(u.model.allowCellFormatting&&u.model.formatSettings.allowDecimalPlaces&&!u.model.isReadOnly){var p,h,w,l,s,e,f,a=0,o={},v,c=u.getActiveSheetIndex(),k=u.getSheet(c),d=u._dataContainer,y={action:"decimal",reqType:"cell-format",sheetIndex:c,oprType:"format"},b=[];for(r=u._getRangeArgs(r,"object"),l=u._getSelectedCells(c,r).selCells,p=l.length;a<p;)s=l[a].rowIndex,e=l[a].colIndex,f=u.getRangeData({range:[s,e,s,e]})[0],h={rowIndex:s,colIndex:e,afterFormat:{},beforeFormat:{}},v=u._dataContainer.sheets[c][s][e],n.extend(!0,h.beforeFormat,v),u.isNumber(f.value)&&(u.isUndefined(f.decimalPlaces)&&(f.decimalPlaces=u._decimalCnt(f.value)),o.type=f.type===t.Spreadsheet.CellType.General?t.Spreadsheet.CellType.Number:f.type,o.decimalPlaces=f.decimalPlaces=i==="DecreaseDecimal"?f.decimalPlaces>0?f.decimalPlaces-1:f.decimalPlaces:f.decimalPlaces+1,o.formatStr=u._getFormatString(o.type,o.decimalPlaces),w=this._format(f.value,{formatStr:o.formatStr,type:o.type,thousandSeparator:f.thousandSeparator,decimalPlaces:o.decimalPlaces}),o.value2=w,u.XLResize&&u.XLResize._getContentWidth(e,c,0,u.getSheet(c).usedRange.rowIndex)>=k.columnsWidthCollection[e]-5&&(u._dupDetails=!0,u.XLResize._fitWidth(e),u._dupDetails=!1,u.XLSelection.refreshSelection(),u.model.allowAutoFill&&u.XLDragFill.positionAutoFillElement()),u.XLEdit._updateDataContainer({rowIndex:s,colIndex:e},{dataObj:o}),h.beforeFormat.Oprtype=o.type),f=u.getRangeData({range:[s,e,s,e]})[0],v=u._dataContainer.sheets[c][s][e],n.extend(!0,h.afterFormat,v),h.afterFormat.Oprtype=h.beforeFormat.Oprtype,b.push(h),a++;y.selectedCell=b;u._isUndoRedo||(u._completeAction(y),u._trigActionComplete(y))}},getFormatClass:function(n,t){var i=t?"e-border":"e-format",r=new RegExp("\\b"+i+".*?\\b","g");return n.indexOf(i)!==-1?n.match(r)[0]:""},getHashCodeClassAsArray:function(n){var r,e,u,t=0,f={format:[]},i=this.XLObj,o=i.getActiveSheetIndex(),s=["topborder","leftborder"];for(n=i._toIntrnlRange(n,o),n=n?i.swapRange(n):i.getSheet(o).selectedRange,r=i.getRange(n),e=r.length;t<e;)u=r[t].className,f.format.push(this.getFormatClass(u)+" "+this.getFormatClass(u,!0)),t++;for(t=2;t--;)f[s[t]]=this._getBorderArray(n,s[t]);return f},_getBorderArray:function(n,t){var i,r=0,u=[],o=this.XLObj,f="topborder",s=t===f?n[0]-1:n[1]-1,e;if(s>=0)for(e=t===f?o.getRange([n[0]-1,n[1],n[0]-1,n[3]]):o.getRange([n[0],n[1]-1,n[2],n[1]-1]),i=e.length;r<i;)u.push(this.getFormatClass(e[r].className,!0)),r++;else for(i=t===f?n[3]-n[1]+1:n[2]-n[0]+1;i--;)u.push("");return u},removeStyle:function(t,i){var f=this.XLObj;if(!f.model.isReadOnly){i=i||{cellStyle:!0,tableStyle:!0,format:!0,border:!0};var w,g,e,r,o,b,l,h,u,c,s,k,a,y,d=0,v=this._borderPosition,nt=f._getSheetIndex(i.sheetIdx),p=f.getSheet(nt);for(t=f._getRangeArgs(t,"object"),w=f._getSelectedCells(nt,t).selCells,g=w.length;d<g;)a=!1,r=w[d],i.skipHiddenRow&&f._isHiddenRow(r.rowIndex,i.sheetIdx)||(i.format&&(i.cellStyle&&i.tableStyle?f.XLEdit._clearDataContainer({cellIdx:r,property:["format","formats","tformats"]}):(i.cellStyle&&f._hasCellStyle(r.rowIndex,r.colIndex,i.sheetIdx)||i.tableStyle&&f._isTableRange(r.rowIndex,r.colIndex,i.sheetIdx))&&(k=[i.cellStyle?"formats":"tformats"],b=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,i.cellStyle?"tformats":"formats",i.sheetIdx),b?(o=this.getFormatHashCode(b),this._updateFormatClass(r,o)):k.push("format"),f.XLEdit._clearDataContainer({cellIdx:r,property:k}))),i.border&&(i.cellStyle&&i.tableStyle?(l=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"borders",i.sheetIdx)||{},h=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(h,l),v[0]in h&&r.rowIndex&&(e=r.rowIndex-1,o=f.XLEdit.getPropertyValue(e,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(e,r.colIndex,s,u,"bottom","bottom",!0),a=!0),v[1]in h&&(y=!0,e=r.colIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.colCount&&(c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),v[3]in s&&(u.right!=s.left&&(u.right=s.left,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)),y=!1)),y&&(delete u.right,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),v[2]in h&&(y=!0,e=r.rowIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.rowCount&&(c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),v[0]in s&&(u.bottom!=s.top&&(u.bottom=s.top,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)),y=!1)),y&&(delete u.bottom,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),v[3]in h&&r.colIndex&&(e=r.colIndex-1,o=f.XLEdit.getPropertyValue(r.rowIndex,e,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,e,s,u,"right","right",!0),a=!0),a&&f.XLEdit._clearDataContainer({cellIdx:r,property:["borders","tborders"]})):i.cellStyle?(l=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"borders",i.sheetIdx)||{},h=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tborders",i.sheetIdx)||{},v[0]in l&&r.rowIndex&&(e=r.rowIndex-1,o=f.XLEdit.getPropertyValue(e,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),"bottom"in s?l.bottom===u.bottom&&("top"in h?(u.bottom=h.top,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:e,colIndex:r.colIndex},o,!0)):s.bottom!=u.bottom&&(u.bottom=s.bottom,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:e,colIndex:r.colIndex},o,!0))):this._remStyle(e,r.colIndex,s,u,"top","bottom"),a=!0),v[1]in l&&(e=r.colIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.colCount?(c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),"left"in s?l.right===u.right&&("right"in h?(u.right=h.right,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):s.left!=u.right&&(u.right=s.left,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0))):this._remStyle(r.rowIndex,r.colIndex,h,u,"right","right")):this._remStyle(r.rowIndex,r.colIndex,h,u,"right","right"),a=!0),v[2]in l&&(e=r.rowIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.rowCount?(c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),"top"in s?l.bottom===u.bottom&&("bottom"in h?(u.bottom=h.bottom,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):s.top!=u.bottom&&(u.bottom=s.top,o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0))):this._remStyle(r.rowIndex,r.colIndex,h,u,"bottom","bottom")):this._remStyle(r.rowIndex,r.colIndex,h,u,"bottom","bottom"),a=!0),v[3]in l&&r.colIndex&&(e=r.colIndex-1,o=f.XLEdit.getPropertyValue(r.rowIndex,e,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),"right"in s?l.left===u.right&&("left"in h?(u.right=h.left,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:r.rowIndex,colIndex:e},o,!0)):s.right!=u.right&&(u.right=s.right,o=this._getBorderHashCode(u),this._updateFormatClass({rowIndex:r.rowIndex,colIndex:e},o,!0))):this._remStyle(r.rowIndex,e,h,u,"left","right"),a=!0),a&&f.XLEdit._clearDataContainer({cellIdx:r,property:["borders"]})):i.tableStyle&&(l=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"borders",i.sheetIdx)||{},h=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"tborders",i.sheetIdx)||{},"top"in h&&!("top"in l)&&r.rowIndex&&(e=r.rowIndex-1,o=f.XLEdit.getPropertyValue(e,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(e,r.colIndex,s,u,"bottom","bottom",!0),a=!0),"right"in h&&!("right"in l)&&(e=r.colIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.colCount?(c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,r.colIndex,s,u,"left","right",!0)):(delete u.right,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),"bottom"in h&&!("bottom"in l)&&(e=r.rowIndex+1,o=f.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),e<p.rowCount?(c=f.XLEdit.getPropertyValue(e,r.colIndex,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(e,r.colIndex,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,r.colIndex,s,u,"top","bottom",!0)):(delete u.bottom,f.getObjectLength(u)?(o=this._getBorderHashCode(u),this._updateFormatClass(r,o,!0)):f.XLEdit._clearDataContainer({cellIdx:r,property:["border"]})),a=!0),"left"in h&&!("left"in l)&&r.colIndex&&(e=r.colIndex-1,o=f.XLEdit.getPropertyValue(r.rowIndex,e,"border",i.sheetIdx),u=this.getBorderFromHashCode(o),c=f.XLEdit.getPropertyValue(r.rowIndex,e,"borders",i.sheetIdx)||{},s=f.XLEdit.getPropertyValue(r.rowIndex,e,"tborders",i.sheetIdx)||{},n.extend(s,c),this._remStyle(r.rowIndex,e,s,u,"right","right",!0),a=!0),a&&f.XLEdit._clearDataContainer({cellIdx:r,property:["tborders"]})))),d++}},_remStyle:function(n,t,i,r,u,f,e){var o=this.XLObj;u in i?e&&i[u]==r[f]||(r[f]=i[u],this._updateFormatClass({rowIndex:n,colIndex:t},this._getBorderHashCode(r),!0)):(delete r[f],o.getObjectLength(r)?this._updateFormatClass({rowIndex:n,colIndex:t},this._getBorderHashCode(r),!0):o.XLEdit._clearDataContainer({cellIdx:{rowIndex:n,colIndex:t},property:["border"]}))},_refreshStyles:function(t,i,r){for(var e,f,o,h="format",s="border",a=!i||i===h,v=!i||i===s,u=this.XLObj,c=u._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]}),l=c.length;l--;)cellIdx=c[l],a&&(e=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"formats")||{},f=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"tformats")||{},n.extend(f,e),u.getObjectLength(f)?(o=this._createFormatClass(f),this._updateFormatClass(cellIdx,o,!1)):u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,h)&&u.XLEdit._clearDataContainer({cellIdx:cellIdx,property:[h]})),v&&(e=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"borders")||{},f=u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,"tborders")||{},n.extend(f,e),u.getObjectLength(f)?(o=this._getBorderHashCode(f),this._updateFormatClass(cellIdx,o,!0)):u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,s)&&(r,style=this.getBorderFromHashCode(hCode),"right"in style,u.XLEdit.getPropertyValue(cellIdx.rowIndex,cellIdx.colIndex,s)&&u.XLEdit._clearDataContainer({cellIdx:cellIdx,property:[s]})))},updateFormat:function(n,t){var r=this.XLObj,i,u,f,e;if(!r.model.isReadOnly){for(f=["topborder","leftborder"],e=n.format,t=r._getRangeArgs(t,"object"),u=r._getSelectedCells(r.getActiveSheetIndex(),t).selCells,i=u.length;i--;)this._updateHashCodeClass(u[i],e[i]);for(i=2;i--;)this._updateBorderClass(t,n[f[i]],f[i])}},_updateBorderClass:function(n,t,i){var r,u,f=this.XLObj,e="topborder",o=i===e?n[0]-1:n[1]-1;if(o>=0)for(u=i===e?f._getSelectedRange({rowIndex:n[0]-1,colIndex:n[1]},{rowIndex:n[0]-1,colIndex:n[3]}):f._getSelectedRange({rowIndex:n[0],colIndex:n[1]-1},{rowIndex:n[2],colIndex:n[1]-1}),r=u.length;r--;)this._updateFormatClass(u[r],t[r],!0)},updateUniqueFormat:function(n,i,r){var f=this.XLObj,o,s,i,e,c,u,h,l,a;if(!f.model.isReadOnly){for(o=f.getActiveSheetIndex(),s=f.getSheet(o),i=f._getRangeArgs(i,"object"),e=f._getSelectedCells(o,i).selCells,u=e.length;u--;)c=f._isUndoRedo?t.isNullOrUndefined(n[u].format)?"e-format":n[u].format:n,this._updateFormatClass(e[u],c),f.XLEdit._updateDataContainer(e[u],{dataObj:{formats:this.getFormatFromHashCode(c)},sheetIdx:o}),(r=="Title"||r=="Heading 4")&&(f._isRowViewable(o,e[u].rowIndex)&&(l=f.getCell(e[u].rowIndex,e[u].colIndex)),h=f._detailsFromGlobalSpan(e[u].rowIndex,e[u].colIndex,"height",f.XLEdit.getPropertyValue(e[u].rowIndex,e[u].colIndex,"value2"),s.columnsWidthCollection[e[u].colIndex]),a=f._isUndo?f.model.rowHeight:s.rowsHeightCollection[e[u].rowIndex],h>=a&&(l&&l.parent().outerHeight(h),f.XLEdit._updateDataContainer({rowIndex:e[u].rowIndex,colIndex:0},{dataObj:{pHeight:s.rowsHeightCollection[e[u].rowIndex],cHeight:h}}),s.rowsHeightCollection[e[u].rowIndex]=h),f.model.allowFreezing&&f.XLFreeze._refreshFRowResize(e[u].rowIndex));f._refreshRangeTRHght(o,f.swapRange(i))}},_hasFormat:function(n){return n?!t.isNullOrUndefined(n.match(/e-format|e-border/)):!1},getFormatHashCode:function(n){var i,u,t="",r=0,f="background-color",e="color",o="font-family",s="font-size",h=["font-style","text-decoration","vertical-align","text-align","font-weight"],l=h.length,a=["FontStyle","TextDecoration","VerticalAlign","TextAlign","FontWeight"],c="text-indent";for(t=(f in n)?n[f].replace("#",""):"6N",t+=(e in n)?n[e].replace("#",""):"6N",(o in n)?(i=this._getStyleCode("FontFamily",n[o]),t+=i||"2N"):t+="2N",t+=(s in n)?this._getFontCode(n[s]):"2N";r<l;)u=h[r],u in n?(i=this._getStyleCode(a[r],n[u]),t+=i||"1N"):t+="1N",r++;return t.endsWith("N")||(t=t+"N"),c in n&&(t+=n[c].replace(/pt|-|\+/g,"")),"e-format"+t},getFormatFromHashCode:function(n){var t,f,e,o,s,h,c,l,u,a,i,r={},v="e-format";if(n=n||"",!n.indexOf(v)){for(e="pt",t=f=0,a=["FontStyle","TextDecoration","VerticalAlign","TextAlign"],c=["font-style","text-decoration","vertical-align","text-align"],l=c.length,i=n.replace(v,"").split("N"),i[t].length===1?t++:(r["background-color"]="#"+i[t].slice(0,6),i[t]=i[t].substr(6)),i[t].length===1?t++:(r.color="#"+i[t].slice(0,6),i[t]=i[t].substr(6)),u=i[t].length,u===1?t++:(s="FontFamily",o="font-family",u===2?(r[o]=this._getCodeStyle(s,i[t].slice(0,1)+"1N"),t++):(r[o]=this._getCodeStyle(s,i[t].slice(0,2)),i[t]=i[t].substr(2))),u=i[t].length,u===1?t++:(h="font-size",u===2?(r[h]=i[t].slice(0,1)+e,t++):(r[h]=i[t].slice(0,2)+e,i[t]=i[t].substr(2)));f<l;)i[t].length===1?t++:(r[c[f]]=this._getCodeStyle(a[f],i[t].slice(0,1)),i[t]=i[t].substr(1)),f++;i[t]==="2"&&(r["font-weight"]="bold");t++;i[t]&&(r["text-indent"]=i[t]+e)}return r},getBorderFromHashCode:function(n,t){var r,i=0,u={},e="e-border",f=this._borderPosition;return n=n||"",n.indexOf(e)||(r=n.replace(e,"").split("N"),r[i].length>1?(u[f[1]]=this._concatBorderCode(r[i]),r[i]=r[i].substr(8)):i+=3,r[i].length>1?(u[f[2]]=this._concatBorderCode(r[i]),t&&(r[i]=r[i].substr(8))):i+=3,t&&(r[i].length>1?(u[f[0]]=this._concatBorderCode(r[i]),r[i]=r[i].substr(8)):i+=3,r[i].length>1&&(u[f[3]]=this._concatBorderCode(r[i])))),u},_formatPainter:function(){var n=this.XLObj,f,e,h;if(n.model.allowFormatPainter&&n.model.allowCellFormatting){var c=n.getActiveSheetIndex(),t,i,o=0,s=n.getSheet(c),r=s._startCell,u=s._endCell;for(this._rowLength=u.rowIndex-r.rowIndex+1,this._colLength=u.colIndex-r.colIndex+1,f=this._rowLength,e=this._colLength,h=n.getRangeData({range:[r.rowIndex,r.colIndex,u.rowIndex,u.colIndex],property:["value","value2","type","wrap","formatStr","thousandSeparator","decimalPlaces","cFormatRule","hyperlink","format","cellType"]}),this._getEformatClass=new Array(f),t=0;t<f;t++)for(this._getEformatClass[t]=new Array(e),i=0;i<e;i++)this._getEformatClass[t][i]={rangeData:h[o]},o++}},_fPMouseUp:function(){var s,b,d,n=this.XLObj,e=n.getActiveSheetIndex(),p=n.getSheet(e),g=n._getContent(e).find("div.e-content"),k=0,nt,u=p._selectedCells,tt=p._startCell,it=p._endCell,h,c,i=0,rt=0,l,a,ut,ft,w,et=it.rowIndex-tt.rowIndex,ot=it.colIndex-tt.colIndex,o,ht=n.XLEdit,r,v=p.selectedRange,y=n.getRangeData({range:v,property:["wrap","hyperlink","value","value2","cFormatRule","format","cellType","formats","formatStr","decimalPlaces","thousandSeparator","type"]}),f={sheetIndex:e,reqType:"format-painter",range:v,beforeData:y,bFormat:this.getHashCodeClassAsArray(v),unwrapCells:[],wrapCells:[]},st=n.element.find("#"+n._id+"_Ribbon_Home_Clipboard_FormatPainter");for(n._dupDetails=!0,h=0;h<=et;h++){for(rt++,c=0;c<=ot;c++){if(k++,o=n._getAlphaRange(e,u[i].rowIndex,u[i].colIndex,u[i].rowIndex,u[i].colIndex),cell=u[i],r=this._getEformatClass[h][c],this.removeStyle([u[i].rowIndex,u[i].colIndex,u[i].rowIndex,u[i].colIndex],{cellStyle:!0,tableStyle:!1,format:!0}),s={type:r.rangeData.type?r.rangeData.type:"general"},r.rangeData.format&&(s.style=this.getFormatFromHashCode(r.rangeData.format)),r.rangeData.formatStr&&(s.formatStr=r.rangeData.formatStr),r.rangeData.decimalPlaces&&(s.decimalPlaces=r.rangeData.decimalPlaces),r.rangeData.thousandSeparator&&(s.thousandSeparator=r.rangeData.thousandSeparator),this.format(s,o),r.rangeData.cellType&&(b=n._dataContainer.sheetCellType[r.rangeData.cellType],b.text="",n.XLCellType._renderControls(u[i].rowIndex,u[i].colIndex,e,b)),!t.isNullOrUndefined(r.rangeData.cFormatRule))for(w=0,ft=r.rangeData.cFormatRule.length;w<ft;w++)nt=r.rangeData.cFormatRule[w],a=nt.split("_"),ut=a[5],a[a.indexOf(ut)]=o,n._dataContainer.cFormatRule=a.join("_"),l=n._dataContainer.cFormatRule.split("_"),n.XLCFormat._cFormat(l[0],l[2],l[3],l[4],l[5]);if(y[i].wrap&&!r.rangeData.wrap?(n.setWrapText("unwrap",o),f.wrapCells.push({rowIndex:u[i].rowIndex,colIndex:u[i].colIndex})):!y[i].wrap&&r.rangeData.wrap&&(n.setWrapText("wrap",o),f.unwrapCells.push({rowIndex:u[i].rowIndex,colIndex:u[i].colIndex})),r.rangeData.hyperlink&&!y[i].hyperlink?this.format({style:{"text-decoration":"underline",color:n._hlColor}},o):!r.rangeData.hyperlink&&y[i].hyperlink&&(this.format({style:{"text-decoration":"none"}},o),n.addClass(n.getCell(cell.rowIndex,cell.colIndex,e).find("a"),ht.getPropertyValue(cell.rowIndex,cell.colIndex,"format",e))),i++,k===ot+1){k=0;break}this._colLength===c+1&&(c=-1)}if(rt===et+1)break;this._rowLength===h+1&&(h=-1)}this._formatEnable=!1;g.addClass("e-ss-cursor");g.removeClass("e-ss-fpcursor");st.length&&st.ejToggleButton("option",{toggleState:!1});n._dupDetails=!1;f.afterData=n.getRangeData({range:v,property:["wrap","hyperlink","value","value2","cFormatRule","format","cellType","formats","formatStr","decimalPlaces","thousandSeparator","type"]});f.aFormat=this.getHashCodeClassAsArray(v);n.XLSelection.refreshSelection();n.XLDragFill.positionAutoFillElement();d={sheetIndex:f.sheetIndex,currData:f.afterData,currFormat:f.aFormat,reqType:f.reqType,range:f.range,prevData:f.beforeData,prevFormat:f.bFormat,unwrapCells:f.unwrapCells,wrapCells:f.wrapCells};n._isUndoRedo||(n._completeAction(f),n._trigActionComplete(d))},_getFormatObj:function(n){if("type"in n||"formatStr"in n){var t={},i="thousandSeparator";t.formatStr="formatStr"in n?n.formatStr:this.XLObj._getFormatString(n.type,n.decimalPlaces);t.decimalPlaces="decimalPlaces"in n?n.decimalPlaces:["currency","accounting","number"].indexOf(n.type)!==-1?parseInt(t.formatStr.replace(/{0:|[A-Z]|}/g,"")):0;i in n?t[i]=n[i]:n.type==="number"&&(t[i]=!0);n.format=t}return"style"in n&&n.style.border&&(n.border=n.style.border,delete n.style.border,this.XLObj.getObjectLength(n.style)||delete n.style),n},_createFormatClass:function(n,t,i){var r,u=this.XLObj._dataContainer.hashCode;return(t=t||this.getFormatHashCode(n),u.indexOf(t)!==-1)?t:(r=this._getCssPropertyAsString(n),this._writeCssRules(t,r,i),u.push(t),t)},_writeCssRules:function(n,t,i,r){var u=document.getElementById(this.XLObj._id+"_sscustomformat"),f=".e-spreadsheet .e-spreadsheetmainpanel ."+n+" {"+t+"}";r||(u.styleSheet?u.styleSheet.cssText+=f:u.appendChild(document.createTextNode(f)));i&&(f=f.replace(".e-spreadsheetmainpanel ",""),u.styleSheet?u.styleSheet.cssText+=f:u.appendChild(document.createTextNode(f)))},_getCssPropertyAsString:function(n){var t="",i,r,u;if("border"in n){i=n.border;for(r in i)n["border-"+r]=i[r];delete n.border}for(u in n)t=t+(u+":"+n[u]+";");return t},_splitBorderCode:function(n){return n=n.split(" "),n[0].replace("px","")+this._getStyleCode("BorderStyle",n[1])+n[2].replace("#","")},_concatBorderCode:function(n){return n.substr(0,1)+"px "+this._getCodeStyle("BorderStyle",n.substr(1,1))+" #"+n.substr(2,6)},_getCodeStyle:function(n,i){n=t.Spreadsheet[n];for(var r in n)if(n.hasOwnProperty(r)&&n[r]===i)return r},_getStyleCode:function(n,i){return i=i||"",t.Spreadsheet[n][i.toLowerCase()]},_getFontCode:function(n){var t=n.replace(/pt|-|\+/g,"");return t.length===2?t:t.length===1?t+"1N":"2N"},_getExtendedFormat:function(t,i,r){var u=this.XLObj.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"formats")||{};return r?(n.extend(i,u),{format:i}):u["text-indent"]&&i["text-align"]?(delete u["text-indent"],delete u["text-align"],n.extend(i,u),{format:i}):(n.extend(u,i),{format:u})},_updateHashCodeClass:function(n,t){var i,r,u=this.XLObj,f={},e=u._formatRegx,o=u._borderRegx;t&&(i=t.indexOf("e-format")>-1,r=t.indexOf("e-border")>-1,i&&(f.format=t.match(e)[0]),r&&(f.border=t.match(o)[0]),(i||r)&&u.XLEdit._updateDataContainer({rowIndex:n.rowIndex,colIndex:n.colIndex},{dataObj:f}))},_updateFormatClass:function(n,t,i){t&&(t.indexOf("e-format")>-1||t.indexOf("e-border")>-1)&&this.XLObj.XLEdit._updateDataContainer(n,{dataObj:i?{border:t}:{format:t}})},_applyBorderCss:function(n,t){var e=this._borderPosition,h=e[0],o=e[1],s=e[2],c=e[3],i=t[0],r=t[1],u=t[2],f=t[3];h in n&&(i?this._updateBorder([i-1,r,i-1,f],n,s,!0):this._updateBorderObj([i,r,i,f],n,h));o in n&&this._updateBorder([i,f,u,f],n,o);s in n&&this._updateBorder([u,r,u,f],n,s);c in n&&(r?this._updateBorder([i,r-1,u,r-1],n,o,!0):this._updateBorderObj([i,r,u,r],n,c))},_applyAllBorderCss:function(n,t){var u=this._borderPosition[1],f=this._borderPosition[2],i=t[0],r=t[1],e=t[2],o=t[3];this._updateBorder(t,n,u+" "+f);i&&this._updateBorder([i-1,r,i-1,o],n,f,!0);r&&this._updateBorder([i,r-1,e,r-1],n,u,!0)},_updateBorderObj:function(n,t,i){for(var r,o,u,f,e=n[0],s=n[2];e<=s;){for(r=n[1],o=n[3];r<=o;)f={rowIndex:e,colIndex:r},u=this._extendBorderObj(f,this._parseBorder(t,i).border,this._isFAT),this.XLObj.XLEdit._updateDataContainer(f,{dataObj:this._isFAT?{tborders:u}:{borders:u}}),r++;e++}},_updateBorder:function(t,i,r,u){var v,tt,p,w,h,c,l,b,k,o,e,d,s,g=!1,nt=!1,f=this._borderPosition,y=t[0],it=t[2],rt=i.isGridBorder,a=this.XLObj;for(delete i.isGridBorder;y<=it;){for(v=t[1],tt=t[3];v<=tt;){if(l={rowIndex:y,colIndex:v},p=y,w=v,u?(nt=r===f[2],nt?p++:w++,o=this._parseBorder(i,nt?f[0]:f[3]).border):o=this._parseBorder(i,r).border,rt?u||(e=this._extendBorderObj(l,i,this._isFAT),g=!0):u?(b={rowIndex:p,colIndex:w},e=this._extendBorderObj(b,o,this._isFAT),a.XLEdit._updateDataContainer(b,{dataObj:this._isFAT?{tborders:e}:{borders:e},skipCell:i.skipCell})):(e=this._extendBorderObj(l,this._parseBorder(i,r).border,this._isFAT),g=!0),g&&a.XLEdit._updateDataContainer(l,{dataObj:this._isFAT?{tborders:e}:{borders:e},skipCell:i.skipCell}),!(u&&a.hasSpan(l))){if(h=l.colIndex,r===f[1]&&u&&h)while(h){if(!a.XLEdit.getPropertyValue(0,h,"isCHide"))break;h--}if(c=l.rowIndex,r===f[2]&&u&&c)while(c){if(!a.XLEdit.getPropertyValue(c,0,"isRHide"))break;c--}s=a.XLEdit.getPropertyValue(c,h,"border");s=s?this.getBorderFromHashCode(s):a.XLEdit.getPropertyValue(c,h,"borders")||{};u?(e={},f[1]in s&&(e[f[3]]=s[f[1]]),f[2]in s&&(e[f[0]]=s[f[2]]),o=this._isFAT?n.extend(o,e):n.extend(e,o)):o=this._isFAT?n.extend(o,s):n.extend(s,o);d=this._parseBorder(o,f[1]+" "+f[2],u);k=this._getBorderHashCode(d.border);this._createFormatClass(d,k);this._updateFormatClass({rowIndex:c,colIndex:h},k,!0)}v++}y++}},_extendBorderObj:function(t,i,r){var f=this.XLObj,u=f.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,r?"tborders":"borders")||{};return n.extend(u,i),u},_getBorderHashCode:function(n,t){var i="",r="1N1N6N",u=this._borderPosition,f=u[0],e=u[1],o=u[2],s=u[3];return i=e in n?this._splitBorderCode(n[e]):r,i+=o in n?this._splitBorderCode(n[o]):r,t&&(i+=f in n?this._splitBorderCode(n[f]):r,i+=s in n?this._splitBorderCode(n[s]):r),"e-border"+i},_parseBorder:function(n,t,i){var r,u,e={border:{}},f=this._borderPosition;for(t=t.split(" "),r=t.length;r--;)u=key=t[r],i&&(u=key===f[1]?f[3]:f[0]),value=n[u],value&&(e.border[key]=value);return e},_refreshTableRowCol:function(n){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()),u=r.tableManager,t=u[n.tid];t&&(n.isInsertBefore?n.pos==="row"?(t.range[0]+=n.cnt,t.range[2]+=n.cnt):(t.range[1]+=n.cnt,t.range[3]+=n.cnt):(n.pos==="row"?t.range[2]=t.range[2]+n.cnt:t.range[3]=t.range[3]+n.cnt,i._dupDetails=!0,i.XLFormat._createTable(n.tid,{format:t.format}),i._dupDetails=!1))},_refreshHiddenBorder:function(n,t,i,r){var c,u,s,e,o,b,k,p,g,nt,h,tt,l,v,d,a,w,y,f=this.XLObj.XLEdit,it=this.XLObj.getSheet().usedRange;if(i?(h="bottom",v="top",tt="isRHide",it=it.colIndex):(h="right",v="left",tt="isCHide",it=it.rowIndex),r){for(p=n,g=t;g++;)if(e=i?g:0,o=i?0:g,!f.getPropertyValue(e,o,tt))break;while(p){if(e=i?p:0,o=i?0:p,!f.getPropertyValue(e,o,tt))break;p--}for(c=0;c<=it;c++)i?(e=p,u=b=n,s=o=k=c):(o=p,u=e=b=c,s=k=n),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),d=f.getPropertyValue(e,o,"borders"),a=f.getPropertyValue(u,s,"borders"),w=f.getPropertyValue(e,o,"tborders"),y=f.getPropertyValue(b,k,"tborders"),(!d||d&&!d[h])&&(a&&a[v]||(!w||w&&!w[h])&&y&&y[v])&&(nt=f.getPropertyValue(e,o,"border"),l=this.getBorderFromHashCode(nt),delete l[h],w&&w[h]&&(l[h]=w[h]),l.bottom||l.right?(nt=this._getBorderHashCode(l),f._updateDataContainer({rowIndex:e,colIndex:o},{dataObj:{border:nt}})):f._clearDataContainer({cellIdx:{rowIndex:e,colIndex:o},property:["border"]})),i?(k=p,u=e=g,s=o=b=c):(b=p,s=o=g,u=e=k=c),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),eCelBrdr=f.getPropertyValue(u,s,"borders"),eTblBrdr=f.getPropertyValue(e,o,"tborders"),(!d||d&&!d[h])&&(eCelBrdr&&eCelBrdr[v]||(!w||w&&!w[h])&&eTblBrdr&&eTblBrdr[v])&&(l={},(d||f.getPropertyValue(k,b,"border"))&&(nt=f.getPropertyValue(k,b,"border"),l=this.getBorderFromHashCode(nt)),l[h]=eCelBrdr&&eCelBrdr[v]?eCelBrdr[v]:eTblBrdr[v],nt=this._getBorderHashCode(l),f._updateDataContainer({rowIndex:k,colIndex:b},{dataObj:{border:nt}}))}else{if(e=i?n-1:0,o=i?0:n-1,f.getPropertyValue(e,o,tt)){for(p=n-1;p;){if(e=i?p:0,o=i?0:p,!f.getPropertyValue(e,o,tt))break;p--}for(c=0;c<=it;c++)i?(e=p,s=o=k=c,u=b=n-1):(o=p,u=e=b=c,s=k=n-1),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),d=f.getPropertyValue(e,o,"borders"),a=f.getPropertyValue(u,s,"borders"),w=f.getPropertyValue(e,o,"tborders"),y=f.getPropertyValue(b,k,"tborders"),l=this.getBorderFromHashCode(f.getPropertyValue(e,o,"border")),(!d||d&&!d[h]||d&&d[h]!==(l&&l[h]))&&(!w||w&&!w[h]||w&&w[h]&&(f.getPropertyValue(e,o,"border")!==this._getBorderHashCode(w)||a&&a[v]))&&(a&&a[v]||l&&l[h]&&(!a||a&&!a[v])||y&&y[v])&&(e=i?u:s,o=i?s:u,this._showHiddenBorder(p,e,o,c,i));for(c=0;c<=it;c++)i?(e=u-1,u=b=n,s=k=o=c):(o=s-1,u=e=b=c,s=k=n),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),a=f.getPropertyValue(e,o,"borders"),eCelBrdr=f.getPropertyValue(u,s,"borders"),y=f.getPropertyValue(e,o,"tborders"),eTblBrdr=f.getPropertyValue(b,k,"tborders"),l=this.getBorderFromHashCode(f.getPropertyValue(e,o,"border")),(!a||a&&!a[h]||a&&a[h]!==(l&&l[h]))&&(!y||y&&!y[h]||y&&y[h]&&f.getPropertyValue(b,k,"border")!==this._getBorderHashCode(y))&&(eCelBrdr&&eCelBrdr[v]||l&&l[h]&&(!eCelBrdr||eCelBrdr&&!eCelBrdr[v])||eTblBrdr&&eTblBrdr[v])&&(e=i?u:s,o=i?s:u,this._showHiddenBorder(n-1,e,o,c,i))}for(n;n<t;n++)if(g=n+1,i?(e=g,o=s=0,u=n):(o=g,e=u=0,s=n),f.getPropertyValue(e,o,tt)||f.getPropertyValue(u,s,tt))for(c=0;c<=it;c++)i?(u=g,s=o=c,e=n):(u=e=c,s=g,o=n),f.getPropertyValue(u,s,"isMHide")&&(u=f.getPropertyValue(u,s,"mergeIdx"),s=u.colIndex,u=u.rowIndex),a=f.getPropertyValue(e,o,"borders"),eCelBrdr=f.getPropertyValue(u,s,"borders"),y=f.getPropertyValue(e,o,"tborders"),eTblBrdr=f.getPropertyValue(u,s,"tborders"),l=this.getBorderFromHashCode(f.getPropertyValue(e,o,"border")),(!a||a&&!a[h]||a&&a[h]!==(l&&l[h]))&&(!y||y&&!y[h]||y&&y[h]&&(f.getPropertyValue(e,o,"border")!==this._getBorderHashCode(y)||eCelBrdr&&eCelBrdr[v]))&&(eCelBrdr&&eCelBrdr[v]||l&&l[h]&&(!eCelBrdr||eCelBrdr&&!eCelBrdr[v])||eTblBrdr&&eTblBrdr[v])&&(u=i?s:u,this._showHiddenBorder(n,g,u,c,i))}},_showHiddenBorder:function(n,t,i,r,u){var c,l,a,v,y,p,f,w,e,b,k,d,s,h,o=this.XLObj.XLEdit;u?(a=t,p=r,l=v=i,c=y=n,f="bottom",h="top"):(v=t,y=r,c=a=i,l=p=n,f="right",h="left");w=o.getPropertyValue(c,l,"border");e=this.getBorderFromHashCode(w);e[f]&&delete e[f];s=o.getPropertyValue(c,l,"tborders");k=o.getPropertyValue(a,v,"borders");d=o.getPropertyValue(a,v,"tborders");b=o.getPropertyValue(y,p,"borders");b&&b[f]?e[f]=b[f]:k&&k[h]?e[f]=k[h]:(s&&s[f]||d&&d[h])&&(e[f]=s&&s[f]?s[f]:d[h]);e.bottom||e.right?(w=this._getBorderHashCode(e),o._updateDataContainer({rowIndex:y,colIndex:p},{dataObj:{border:w}})):o._clearDataContainer({cellIdx:{rowIndex:c,colIndex:l},property:["border"]})},_resizeFormatTableMenu:function(){var t=this.XLObj,i=document.getElementById(t._id+"_formatastable");t._tabMode||t._phoneMode?(n("#"+t._id+"_Ribbon").append(n("#"+t._id+"_formatastable").parent()),t._removeClass(i,"e-formatastable"),t.addClass(i,"e-formatastable-adaptive"),i.style.height=t._dlgHeight+"px"):(t._removeClass(i,"e-formatastable-adaptive"),t.addClass(i,"e-formatastable"))},_resizeStyleMenu:function(){var t=this.XLObj,i=document.getElementById(t._id+"_cellstyles");t._tabMode||t._phoneMode?(n("#"+t._id+"_Ribbon").append(n("#"+t._id+"_cellstyles").parent()),t._removeClass(i,"e-cellstyles"),t.addClass(i,"e-cellstyles-adaptive"),i.style.height=t._dlgHeight+"px"):(t._removeClass(i,"e-cellstyles-adaptive"),t.addClass(i,"e-cellstyles"),i.style.height="auto")},_resizeBorderMenu:function(t){var i=this.XLObj,r=i.element.find(".e-bordercontainer"),u;i._phoneMode&&(n("#"+i._id+"_Ribbon").append(n("#"+i._id+"_Ribbon_Border").parent()),r.length?r.show():(this._createBorderDiv(),i.element.find(".e-bordercontainer").show()),i.addClass(r[0],"e-border e-adaptive"),t.cancel=!0,u=n("#"+i._id+"_Ribbon_Home_Font_Border").ejSplitButton("instance"),u.contstatus=!0)},_createBorderDiv:function(){for(var i=this.XLObj,f="<div class='e-ss-bdr-header'><span id ='"+i._id+"_border_back' class = 'e-border-back e-icon e-ss-leftarrow'/><\/div><div class='e-ss-border-content'>",e="",o=t.buildTag("div#"+i._id+"_bordercontainer.e-bordercontainer",{},{display:"none",height:i._responsiveHeight-2}),u=i.XLRibbon._borderMenuData,r=0;r<13;r++)e+="<div class = 'e-bordercell' id="+u[r].id+">"+i._renderDIV("e-ss-border "+u[r].sprite+" e-ss-menu","",u[r].text)+"<\/div>";f+=e+"<\/div>";o.append(n(f));n("#"+i._id+"_Ribbon").append(o);i._on(n("#"+i._id+"_bordercontainer"),"click",i._borderSelectionClick)}};t.Spreadsheet.FontFamily={"angsana new":"11N",arial:"21N","arial black":"31N",batang:"41N","book antiqua":"51N","browallia new":"61N",calibri:"71N",cambria:"81N",candara:"91N",century:"10","comic sans ms":"11",consolas:"12",constantia:"13",corbel:"14","cordia new":"15",courier:"16","courier new":"17",dilleniaupc:"18",dotum:"19",fangsong:"20",garamond:"21",georgia:"22",gulim:"23",gungsuh:"24",kaiti:"25",jasmineupc:"26","malgun gothic":"27",mangal:"28",meiryo:"29","microsoft jhenghei":"30","microsoft yahei":"31",mingliu:"32",mingliu_hkscs:"33","ms gothic":"34","ms mincho":"35","ms pgothic":"36","ms pmincho":"37",pmingliu:"38","pmingliu-extb":"39",simhei:"40",simsun:"41","simsun-extb":"42",tahoma:"43",times:"44","times new roman":"45","trebuchet ms":"46",verdana:"47","yu gothic":"48","yu mincho":"49"};t.Spreadsheet.FontStyle={normal:"1",italic:"2",oblique:"3"};t.Spreadsheet.TextAlign={left:"1",right:"2",center:"3",justify:"4"};t.Spreadsheet.VerticalAlign={top:"1",middle:"2",bottom:"3"};t.Spreadsheet.TextDecoration={none:"1",underline:"2",overline:"3","line-through":"4","line-through underline":"5"};t.Spreadsheet.FontWeight={normal:"1",bold:"2"};t.Spreadsheet.BorderStyle={solid:"1",dashed:"2",dotted:"3"};t.Spreadsheet.CellFormat={number:"{0:N2}",currency:"{0:C2}",accounting:"{0:C2}",percentage:"{0:P2}",shortdate:"{0:M/d/yyyy}",longdate:"{0:dddd, MMMM dd, yyyy}",time:"{0:h:mm:ss tt}",scientific:"{0:N2}"}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.cFormat=function(n){this.XLObj=n};t.spreadsheetFeatures.cFormat.prototype={getCFRule:function(n,t){var u=this.XLObj,h=u.getActiveSheetIndex(),f=u.XLEdit.getPropertyValue(n,t,["cFormatRule"]),e=[],s=u._dataContainer.cFormatData,i,r,o;if(f)for(r=0,o=f.length;r<o;r++)i=s[f[r]].split("_"),e.push({action:i[0],inputs:[i[2],i[3]],color:i[4],range:i[5],isApplied:JSON.parse(i[7])});return e},setCFRule:function(n){var t=this.XLObj,i,r;t.model.isReadOnly||t.model.allowConditionalFormats&&(i=n.inputs[0],r=n.inputs[1],this._cFormat(n.action,i,r,n.color,n.range,t.getActiveSheetIndex()))},_updateCFormatRule:function(n,t){return n.indexOf("true")>-1?n.replace("true",t):n.replace("false",t)},_getRuleIndex:function(n,i){if(t.isNullOrUndefined(i))return-1;for(var r=0,u=i.length;r<u;r++)if(i[r]===n)return r;return-1},_refreshCFormatFormula:function(n,t,i){var u=this.XLObj,f=u.getSheet(i)._cFormatFormula,r,e;u.isUndefined(f[n])||u.isUndefined(f[n][t])||(r=f[n][t][0].Formula,this._applyFormulaValues(r.referCell,r.cFColor,"formularule",r.addr,i,e,r.applyCell))},_applyFormulaValues:function(n,i,r,u,f,e,o,s,h){var c=this.XLObj,v,l,b,y,st,ht,ut=c.getSheet(f),p,k,d,tt,g,ct=!0,lt=-1,ft,a=[],it,w,nt,et,ot,o,n,rt;if(v=t.isNullOrUndefined(e)&&t.isNullOrUndefined(u)?ut._selectedCells:t.isNullOrUndefined(u)?c._getMultiRangeCells(e):c._getMultiRangeCells(u),u=c._getAlphaRange(f,v[0].rowIndex,v[0].colIndex,v[v.length-1].rowIndex,v[v.length-1].colIndex),c.isUndefined(r))w=c._calcEngine,rt=new ValueChangedArgs(-1,-1,n),w.valueChanged(ut.sheetInfo.value,rt),n=w.getFormulaInfoTable().getItem("!"+(f-1)+"!-1").getFormulaValue()==="TRUE"?!0:!1,g=c._isBool(n)?n:!1,tt="formularule_"+r+"_"+n+"__"+i+"_"+u+"_"+c.getActiveSheetIndex(),this._applyCFormatRule({rowIndex:o.rowIndex,colIndex:o.colIndex},tt,lt,g,ct,i);else{if(d=["<=",">=","<",">","="],n.startsWith("=")&&(n=n.substr(1)),n.indexOf("==")>-1)return c._showAlertDlg("Alert","NewRuleAlert","",430),!0;for(l=0,y=d.length;l<y;l++)n.indexOf(d[l])>-1&&(a=n.split(d[l]),it=d[l]);if(a.length||(a[0]=n),st=a.slice(),s==="paste"){for(n="",l=0,y=a.length;l<y;l++)c._isvalidRange(a[l]+":"+a[l])&&(o=c._getMultiRangeCells(a[l]),et=e[0]-h.rowIndex,ot=e[1]-h.colIndex,a[l]=c._getAlphaRange(f,o[0].rowIndex+et,o[0].colIndex+ot,o[0].rowIndex+et,o[0].colIndex+ot));n=y===2?a[0]+it+a[1]:a[0]}for(ht=this._formulaCellRefer(a,v),l=0,y=v.length;l<y;l++){for(p=v[l].rowIndex,k=v[l].colIndex,nt=this._formulaCellRange({rowIndex:p,colIndex:k},ht,st,it,f),formula=nt.formula,w=c._calcEngine,rt=new ValueChangedArgs(-1,-1,formula),w.valueChanged(ut.sheetInfo.value,rt),ft=w.getFormulaInfoTable().getItem("!"+(f-1)+"!-1").getFormulaValue()==="TRUE"?!0:!1,g=c._isBool(ft)?ft:!1,tt="formularule_"+it+"_"+n+"/"+formula+"__"+i+"_"+u+"_"+c.getActiveSheetIndex(),b=0;b<c.getObjectLength(nt)-1;b++)this._formulaCellUpdate({rowIndex:nt["referCell"+b].rowIndex,colIndex:nt["referCell"+b].colIndex},{rowIndex:p,colIndex:k},n,formula,u,i,f);this._applyCFormatRule({rowIndex:p,colIndex:k},tt,lt,g,ct,i);!g&&c._isRowViewable(f,p)&&c.getCell(p,k,f).removeClass("e-redft e-yellowft e-greenft e-redf e-redt")}}},_formulaCellUpdate:function(n,t,i,r,u,f,e){var l=this.XLObj,h=l.getSheet(e)._cFormatFormula,o,c=n.rowIndex,s=n.colIndex;c in h?(o=h[c],s in o?o[s].push({Formula:{applyCell:t,formula:i,referCell:r,addr:u,cFColor:f}}):(o[s]=[],o[s].push({Formula:{applyCell:t,formula:i,referCell:r,addr:u,cFColor:f}}))):(o=h[c]={},o[s]=[],o[s].push({Formula:{applyCell:t,formula:i,referCell:r,addr:u,cFColor:f}}))},_formulaCellRange:function(n,t,i,r,u){for(var e=this.XLObj,y=0,c,l=[],p=0,w=e.getObjectLength(t),o,s,h,a={},v={},f=0;f<w;f++)e._isObject(t["range"+f])?(s=n.rowIndex+t["range"+f].rowIndex,h=n.colIndex+t["range"+f].colIndex,a["range"+f]=e._getAlphaRange(u,s,h,s,h)):(s=n.rowIndex,h=n.colIndex,a["range"+f]=t["range"+f]),v["referCell"+f]={rowIndex:s,colIndex:h};for(c=0;c<i.length;c++){for(o=e.XLDragFill._parseFormula("="+i[c]),f=0,len=o.length;f<len;f++)e._isvalidRange(o[f]+":"+o[f])&&(o[f]=a["range"+y],y++);l[p]=o.join("");p++}return formula=e.isUndefined(r)?"="+l[0]:"="+l[0]+r+l[1],v.formula=formula,v},_formulaCellRefer:function(n,t){for(var u=this.XLObj,i,c=0,e,l=[],r,a,o,s,v={},h,f=0;f<n.length;f++)if(u.isFormula("="+n[f]))for(e=u.XLDragFill._parseFormula(n[f]),i=0,len=e.length;i<len;i++)u._isvalidRange(e[i]+":"+e[i])&&(l[c]=e[i],c++);else l[c]=n[f],c++;for(n=l,i=0;i<n.length;i++){if(r=n[i].startsWith("=")?n[i].split("=")[1]:n[i],a=r.split("$").length,u._isvalidRange(n[i]+":"+n[i])){u._isvalidRange(r+":"+r)&&(r.indexOf("$")<0?h="RCRefer":r.startsWith("$")&&a===3?h="CellRefer":r.startsWith("$")&&a===2?h="RRefer":!r.startsWith("$")&&r.indexOf("$")>-1&&(h="CRefer"));n[i].indexOf("$")>-1&&(n[i]=n[i].split("$").join(""));formulaCell=u._getMultiRangeCells(n[i]);switch(h){case"RCRefer":o=formulaCell[0].rowIndex-t[0].rowIndex;s=formulaCell[0].colIndex-t[0].colIndex;break;case"RRefer":o=formulaCell[0].rowIndex-t[0].rowIndex;s=formulaCell[0].colIndex;break;case"CRefer":o=formulaCell[0].rowIndex;s=formulaCell[0].colIndex-t[0].colIndex;break;case"CellRefer":o=formulaCell[0].rowIndex;s=formulaCell[0].colIndex}n[i]={rowIndex:o,colIndex:s}}v["range"+i]=n[i]}return v},_clearCFormula:function(n,t,i){var u=this.XLObj,e=[],h=[],c=0,s,r,o,a=u.XLEdit.getPropertyValue(n,t,"cFormatRule"),f,l;if(sheetData=u.getSheet(i)._cFormatFormula,a&&a[0].split("_")[0]==="formularule"&&(input=a[0].split("_")[2].split("/")[1],input.startsWith("=")&&(input=input.substr(1)),u.isFormula("="+input))){for(l=["<=",">=","<",">","="],r=0,o=l.length;r<o;r++)input.indexOf(l[r])>-1&&(e=input.split(l[r]));for(e.length||(e[0]=input),r=0,o=e.length;r<o;r++)if(u.isFormula("="+e[r]))for(s=u.XLDragFill._parseFormula(e[r]),j=0;j<s.length;j++)u._isvalidRange(s[j]+":"+s[j])&&(h[c]=s[j],c++);else h[c]=e[r],c++;for(r=0,o=h.length;r<o;r++)f=u._getMultiRangeCells(h[r])[0],u.isUndefined(sheetData[f.rowIndex])||(u.isUndefined(sheetData[f.rowIndex][f.colIndex])||delete sheetData[f.rowIndex][f.colIndex],u.getObjectLength(sheetData[f.rowIndex])||delete sheetData[f.rowIndex])}},_cFormat:function(n,i,r,u,f,e,o,s,h){var c=this.XLObj,y,l;if(c.model.allowConditionalFormats){c.showWaitingPopUp();e=e?e:c.getActiveSheetIndex();t.isNullOrUndefined(n)&&(n="lessthan");var a=c.getSheet(e),p=o?c._getRangeArgs(o,"object"):c._getRangeArgs(f,"object"),v={cFAction:n,input1:i,input2:r,cFColor:u,sheetIndex:e,reqType:"cond-format",action:"add",range:f,data:p};switch(n){case"greaterthan":this._applyGLEValues(">",i,u,n,f,e,o);break;case"greaterequalto":this._applyGLEValues(">=",i,u,n,f,e,o);break;case"lessthan":this._applyGLEValues("<",i,u,n,f,e,o);break;case"lessequalto":this._applyGLEValues("<=",i,u,n,f,e,o);break;case"equalto":this._applyGLEValues("==",i,u,n,f,e,o);break;case"notequalto":this._applyGLEValues("!=",i,u,n,f,e,o);break;case"between":this._applyBetweenValues("=",i,r,u,n,f,e,o);break;case"notbetween":this._applyBetweenValues("!",i,r,u,n,f,e,o);break;case"textcontains":this._applyContainsValues(i,u,n,f,e,o);break;case"dateoccur":this._applyDateContainsValues(i,u,n,f,e,o);break;case"formularule":i.indexOf("/")>-1&&(i=i.split("/")[1]);l=this._applyFormulaValues(i,u,n,f,e,o,y,s,h)}a._isImported&&!a._isLoaded||c._isUndoRedo||s==="paste"||c._dupDetails||c._isExport||l||(c._completeAction(v),c._trigActionComplete(v));c.hideWaitingPopUp()}},clearCF:function(n){var i=this.XLObj,o,a,h,s,c;if(!i.model.isReadOnly){var r=i.getActiveSheetIndex(),u,f,e={sheetIndex:r,reqType:"cond-format",action:"clear",rule:[]},l=i.getSheet(r);if(i.model.allowConditionalFormats){for(h=i._dataContainer.cFormatData,e.selection=!i.isUndefined(n),n=n?i._getRangeArgs(n,"object"):[0,0,l.rowCount-1,l.colCount-1],s=i._getSelectedCells(r,n).selCells,o=0,a=s.length;o<a;o++)u=s[o].rowIndex,f=s[o].colIndex,t.isNullOrUndefined(i._dataContainer.sheets[r][u])||t.isNullOrUndefined(i._dataContainer.sheets[r][u][f])||t.isNullOrUndefined(i._dataContainer.sheets[r][u][f].cFormatRule)||(e.rule.push(this.getCFRule(u,f)),this._clearCFormula(u,f,r),i.clearRangeData([u,f,u,f],["cFormatRule"]));c=e.selection?"clear_"+r+"_"+i._getSelectedItems()[1]:"clear_"+r+"_entire";h.indexOf(c)===-1&&h.push(c);i._isUndoRedo||i._dupDetails||(i._completeAction(e),i._trigActionComplete(e))}}},_getValueForCFormat:function(n,t){var u=this.XLObj,i=n.rowIndex,r=n.colIndex,o=u.getRangeData({range:[i,r,i,r],sheetIdx:t}),f=u.XLEdit.getPropertyValue(i,r),e=u.XLEdit.getPropertyValue(i,r,"value2");return f=f?f.toString():"",(e&&typeof e=="string"&&!o.formatStr&&f[0]==="="||u.XLEdit.getPropertyValue(i,r,"type")==="datetime"||u.XLEdit.getPropertyValue(i,r,"type")==="shortdate"||u.XLEdit.getPropertyValue(i,r,"type")==="longdate"||u.XLEdit.getPropertyValue(i,r,"type")==="time")&&(f=e),f},_applyGLEValues:function(i,r,u,f,e,o,s){var h=this.XLObj,c,k,v,y,l,ft,rt,et,nt,tt=new RegExp(/[^.0-9]+/g),vt=new RegExp(/[^.-a-zA-Z 0-9]+/g),ot=h.getSheet(o),st=ot._startCell,ht=ot._endCell,d,p=r,w,ct,b=[],lt,g,a,it,ut,at;if(rangeData=s?h._getRangeArgs(s,"object"):h._getRangeArgs(e,"object"),k=h._getSelectedCells(o,rangeData).selCells,p.startsWith("=")){for(p=p.substr(1),g=["<=",">=","<",">","="],a=0,it=g.length;a<it;a++)p.indexOf(g[a])>-1&&(b=b.split(g[a]),lt=g[a]);b.length||(b[0]=p);ct=this._formulaCellRefer(b,k)}for(a=0,it=k.length;a<it;a++)if(v=k[a].rowIndex,y=k[a].colIndex,r.startsWith("=")&&(ut=h._calcEngine,w=this._formulaCellRange({rowIndex:v,colIndex:y},ct,b,lt,o),at=new ValueChangedArgs(-1,-1,w.formula),ut.valueChanged(h.getSheet(o).sheetInfo.value,at),r=ut.getFormulaInfoTable().getItem("!0!-1").getFormulaValue(),l=h._isBool(r)?r==="TRUE"?!0:!1:!1,t.isNullOrUndefined(r)&&(r="0")),!h.XLEdit.getPropertyValue(v,y,"isMHide")&&!h.XLEdit.getPropertyValue(v,y,"isFilterHide")){if(c=this._getValueForCFormat({rowIndex:v,colIndex:y},o),nt=h.XLEdit.getPropertyValue(v,y,"type")?h.XLEdit.getPropertyValue(v,y,"type"):"general",ft=!0,et=-1,t.isNullOrUndefined(c)||!c.length)n.isNumeric(r)&&(l=r>0?f==="lessthan"||f==="lessequalto"||f==="notequalto":r<0?f==="greaterthan"||f==="greaterequalto"||f==="notequalto":f==="equalto"||f==="lessequalto"||f==="greaterequalto");else if(n.isNumeric(r))if(n.isNumeric(c))c=parseFloat(c),l=h.operators[i](c,parseFloat(r.replace(vt,"")));else if(h._isValidDate(c))l=h.operators[i](h._dateToInt(c),parseFloat(r));else if(h._isValidTime(c))continue;else l=h.operators[i](c.toLowerCase(),r.toLowerCase());else r.lastIndexOf("%")===r.length-1&&n.isNumeric(r.replace(tt,""))?l=nt==="percentage"?h.operators[i](parseFloat(c),parseFloat(r.replace(tt,""))):n.isNumeric(c)?h.operators[i](parseFloat(c),0):h.operators[i](c.length,0):r.indexOf("$")===0&&n.isNumeric(r.replace(tt,""))?l=nt==="accounting"||nt!=="currency"||n.isNumeric(c)?h.operators[i](parseFloat(c),parseFloat(r.replace(tt,""))):(h.operators[i](c.length,0)||h._isValidDate(c))&&!h._isValidTime(c):h._isValidDate(r)?h._isValidDate(c)?l=h.operators[i](h._dateToInt(new Date(c)),h._dateToInt(new Date(r))):h._isValidTime(c)||(l=n.isNumeric(c)?h.operators[i](parseFloat(c),h._dateToInt(r)):h.operators[i](c.length,h._dateToInt(r))):l=h._isValidTime(r)?h._isValidTime(c)?h.operators[i](h.parse.parseTime(c),h.parse.parseTime(r)):n.isNumeric(c)?h.operators[i](parseFloat(c),0):h.operators[i](c.length,0):h.operators[i](c.toLowerCase(),r.toLowerCase());if(t.isNullOrUndefined(e)&&(e=h._generateHeaderText(st.colIndex+1)+(st.rowIndex+1)+":"+h._generateHeaderText(ht.colIndex+1)+(ht.rowIndex+1)),rt=f+"_"+i+"_"+r+"__"+u+"_"+e+"_"+h.getActiveSheetIndex(),p.startsWith("="))for(r=p.substr(1),rt=f+"_"+i+"_"+r+"__"+u+"_"+e+"_"+h.getActiveSheetIndex(),d=0;d<h.getObjectLength(w)-1;d++)this._formulaCellUpdate({rowIndex:w["referCell"+d].rowIndex,colIndex:w["referCell"+d].colIndex},{rowIndex:v,colIndex:y},r,w.formula,e,u,o);this._applyCFormatRule({rowIndex:v,colIndex:y},rt,et,l,ft,u)}},_applyBetweenValues:function(i,r,u,f,e,o,s,h){var c=this.XLObj,l,w,k,a,d,g,nt,y,v=new RegExp(/[^.0-9]+/g),b=new RegExp(/[^.-a-zA-Z 0-9]+/g),et,tt=c.getSheet(s),it=tt._startCell,rt=tt._endCell,p,ut;for(c.operators["<"](c.isNumber(r)?parseFloat(r):r,c.isNumber(u)?parseFloat(u):u)||(k=u,u=r,r=k),w=t.isNullOrUndefined(h)&&t.isNullOrUndefined(o)?c.getSheet(s)._selectedCells:c._getSelectedCells(s,o).selCells,p=0,ut=w.length;p<ut;p++)if(rowIdx=w[p].rowIndex,colIdx=w[p].colIndex,!c.XLEdit.getPropertyValue(rowIdx,colIdx,"isMHide")&&!c.XLEdit.getPropertyValue(rowIdx,colIdx,"isFilterHide")){if(l=this._getValueForCFormat({rowIndex:rowIdx,colIndex:colIdx},s),y=c.XLEdit.getPropertyValue(rowIdx,colIdx,"type")?c.XLEdit.getPropertyValue(rowIdx,colIdx,"type"):"general",d=!0,nt=-1,t.isNullOrUndefined(l)||!l.length)n.isNumeric(r)&&n.isNumeric(u)&&(a=r>0&&u>0||r<0&&u<0?e==="notbetween":e==="between");else if(n.isNumeric(r.replace(b,""))&&n.isNumeric(u.replace(b,""))&&y!=="percentage"&&y!=="currency"&&y!=="accounting")if(r=r.replace(b,""),u=u.replace(b,""),n.isNumeric(l))a=c.operators[i](parseFloat(l)>=parseFloat(r)&&parseFloat(l)<=parseFloat(u));else if(c._isValidDate(l))a=c.operators[i](c._dateToInt(l)>=parseFloat(r)&&et<=parseFloat(u));else if(c._isValidTime(l))continue;else a=c.operators[i](l.toLowerCase()>=r.toLowerCase()&&l.toLowerCase()<=u.toLowerCase());else if(r.lastIndexOf("%")===r.length-1&&n.isNumeric(r.replace(v,""))&&u.lastIndexOf("%")===u.length-1&&n.isNumeric(u.replace(v,""))&&y==="percentage")a=c.operators[i](parseFloat(l)>=parseFloat(r.replace(v,""))&&parseFloat(l)<=parseFloat(u.replace(v,"")));else if(r.indexOf("$")===0&&n.isNumeric(r.replace(v,""))&&u.indexOf("$")===0&&n.isNumeric(u.replace(v,""))&&(y==="accounting"||y!=="currency"))a=c.operators[i](parseFloat(l)>=parseFloat(r.replace(v,""))&&parseFloat(l)<=parseFloat(u.replace(v,"")));else if(c._isValidDate(r)&&c._isValidDate(u)){var ft=c._dateToInt(new Date(l)),ot=c._dateToInt(new Date(r)),st=c._dateToInt(new Date(u));a=c.operators[i](ft>=ot&&ft<=st)}else a=c._isValidTime(r)&&c._isValidTime(u)&&c._isValidTime(l)?c.operators[i](c.parse.parseTime(l)>=c.parse.parseTime(r)&&c.parse.parseTime(l)<=c.parse.parseTime(u)):n.isNumeric(l)?c.operators[i](parseFloat(l)>=parseFloat(r)&&parseFloat(l)<=parseFloat(u)):c.operators[i](l.toLowerCase()>=r.toLowerCase()&&l.toLowerCase()<=u.toLowerCase());t.isNullOrUndefined(o)&&(o=c._generateHeaderText(it.colIndex+1)+(it.rowIndex+1)+":"+c._generateHeaderText(rt.colIndex+1)+(rt.rowIndex+1));g=e+"_"+i+"_"+r+"_"+u+"_"+f+"_"+o+"_"+c.getActiveSheetIndex();this._applyCFormatRule({rowIndex:rowIdx,colIndex:colIdx},g,nt,a,d,f)}},_applyContainsValues:function(i,r,u,f,e,o){var s=this.XLObj,h,a,c,v,y,p,w=new RegExp(/[^.-a-zA-Z 0-9]+/g),b=s.getSheet(e),k=b._startCell,d=b._endCell,l,g;for(a=t.isNullOrUndefined(o)&&t.isNullOrUndefined(f)?s.getSheet(e)._selectedCells:s._getSelectedCells(e,f).selCells,l=0,g=a.length;l<g;l++)(rowIdx=a[l].rowIndex,colIdx=a[l].colIndex,s.XLEdit.getPropertyValue(rowIdx,colIdx,"isMHide")||s.XLEdit.getPropertyValue(rowIdx,colIdx,"isFilterHide"))||(h=this._getValueForCFormat({rowIndex:rowIdx,colIndex:colIdx},e),type=s.XLEdit.getPropertyValue(rowIdx,colIdx,"type")?s.XLEdit.getPropertyValue(rowIdx,colIdx,"type"):"general",v=!0,p=-1,t.isNullOrUndefined(h)||!h.length?c=!1:n.isNumeric(i.replace(w,""))?(i=i.replace(w,""),s._isValidDate(h)&&(h=s._dateToInt(h).toString()),c=h.indexOf(i)>-1):s._isValidDate(i)?(s._isValidDate(h)&&(h=s._dateToInt(h).toString()),c=h.indexOf(s._dateToInt(i))>-1):s._isValidTime(i)?(s._isValidTime(h)&&(h=s._dateToInt("01/01/1990 "+h).toString()),c=h.indexOf(s._dateToInt("01/01/1990 "+i))>-1):c=h.toLowerCase().indexOf(i.toLowerCase())>-1,t.isNullOrUndefined(f)&&(f=s._generateHeaderText(k.colIndex+1)+(k.rowIndex+1)+":"+s._generateHeaderText(d.colIndex+1)+(d.rowIndex+1)),y=u+"__"+i+"__"+r+"_"+f+"_"+s.getActiveSheetIndex(),this._applyCFormatRule({rowIndex:rowIdx,colIndex:colIdx},y,p,c,v,r))},_applyDateContainsValues:function(n,i,r,u,f,e){var o=this.XLObj,h,l=!1,a,v,y=o.getSheet(f),p=y._startCell,w=y._endCell,c,s,b,k,d;for(c=t.isNullOrUndefined(e)&&t.isNullOrUndefined(u)?o.getSheet(f)._selectedCells:o._getSelectedCells(f,u).selCells,s=0,b=c.length;s<b;s++)(rowIdx=c[s].rowIndex,colIdx=c[s].colIndex,o.XLEdit.getPropertyValue(rowIdx,colIdx,"isMHide")||o.XLEdit.getPropertyValue(rowIdx,colIdx,"isFilterHide"))||(h=this._getValueForCFormat({rowIndex:rowIdx,colIndex:colIdx},f),v=-1,t.isNullOrUndefined(h)||!h.length?l=!1:o._isValidDate(n)&&(k=new Date(h),d=new Date(n),l=k-d==0),t.isNullOrUndefined(u)&&(u=o._generateHeaderText(p.colIndex+1)+(p.rowIndex+1)+":"+o._generateHeaderText(w.colIndex+1)+(w.rowIndex+1)),a=r+"__"+n+"__"+i+"_"+u+"_"+o.getActiveSheetIndex(),this._applyCFormatRule({rowIndex:rowIdx,colIndex:colIdx},a,v,l,!0,i))},refreshCFormat:function(n){var t=this.XLObj,v=t._dupDetails,u,i,o,c,f,s,r,a,l,e,h;if(!t.model.isReadOnly&&(t._dupDetails=!0,t.model.allowConditionalFormats)){for(o=[],c=t.getActiveSheetIndex(),s=t._getSelectedCells(c,n).selCells,u=0,a=s.length;u<a;u++){if(e=s[u].rowIndex,h=s[u].colIndex,r=t.XLEdit.getPropertyValue(e,h,"cFormatRule"),!t.isUndefined(r)&&r.length)for(i=0,l=r.length;i<l;i++)r[i]=r[i].replace("_true","").replace("_false",""),o.indexOf(r[i])<0&&o.push(r[i]);t._isRowViewable(c,e)&&t.getCell(e,h,c).removeClass("e-redft e-yellowft e-greenft e-redf e-redt");t.clearRangeData([e,h,e,h],["cFormatRule"],s[u])}for(i=0,l=o.length;i<l;i++)f=o[i].split("_"),this._cFormat(f[0],f[2],f[3],f[4],f[5]);t._dupDetails=v}},_applyCFormatRule:function(n,t,i,r,u,f){var o=this.XLObj,a=o.getActiveSheetIndex(),s=n.rowIndex,h=n.colIndex,v,y,e=o.XLEdit.getPropertyValue(s,h,"cFormatRule"),c,p,b=!0,l,k;if(this._getRuleIndex(t+"_true",e)>-1&&(i=this._getRuleIndex(t+"_true",e)),this._getRuleIndex(t+"_false",e)>-1&&(i=this._getRuleIndex(t+"_false",e)),i>-1&&(c=e[i],p=o._dataContainer.cFormatData.indexOf(this._updateCFormatRule(c,r)),p>-1?o._dataContainer.sheets[a][s][h].cFormatRule[i]=p:(o._dataContainer.cFormatData.push(this._updateCFormatRule(c,r)),o._dataContainer.sheets[a][s][h].cFormatRule[i]=o._dataContainer.cFormatData.length-1)),e=o.XLEdit.getPropertyValue(s,h,"cFormatRule"),o._isRowViewable(a,s)&&(v=!0,y=o.getCell(s,h)),!o.isUndefined(e)&&e.length>0&&(!(t+"_true"===e[i]||t+"_false"===e[i])||e.length>1)){for(l=0,k=e.length;l<k;l++)c=e[l].split("_");v&&r&&y.removeClass("e-redft e-yellowft e-greenft e-redf e-redt").addClass("e-"+f)}else v&&r&&y.removeClass("e-redft e-yellowft e-greenft e-redf e-redt").addClass("e-"+f);if(e&&e.length){var d=o.getRangeIndices(t.split("_")[5]),g=o.getRangeIndices(e[0].split("_")[5]),w=t.split("_");w.splice(6,1);w.splice(5,1);e[0].indexOf(w.join("_"))>-1&&o.inRange(g,d[0],d[1])&&(b=!1)}b&&this._getRuleIndex(t+"_true",e)<0&&this._getRuleIndex(t+"_false",e)<0&&o.XLEdit._updateDataContainer(n,{dataObj:{cFormatRule:[t+"_"+r]},skipCell:!r})}}}(jQuery,Syncfusion),function(n,t,i){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.clipboard=function(n){this.XLObj=n;this._cutCells=[];this._copyCells=[];this._copyBackup={};this._cData="";this._isCut=!1;this._copyRange=[];this._isSpecial=!n.isPasteValuesOnly;this._isShape=!1};t.spreadsheetFeatures.clipboard.prototype={copy:function(){this._triggerKeyDown(67,!0)},cut:function(){this.XLObj.model.isReadOnly||this._triggerKeyDown(88,!0)},paste:function(){this.XLObj.model.isReadOnly||this._triggerKeyDown(86,!0)},_initCopyPaste:function(){var i=this.XLObj._id,r=t.buildTag("div",{},{position:"fixed",top:-1e3,left:-1e3},{id:i+"_copyPaste"});n("body").append(r);r.append(t.buildTag("textarea ."+i+"_copyTxt",{},{width:1,height:1,overflow:"hidden",opacity:0,resize:"none",cursor:"default"},{id:i+"_hiddenTxt"}))},_copyPasteHandler:function(t){var u,i=this.XLObj,f=i.getActiveSheetIndex(),r=i.getSheet(f);if(i._isUndoRedo=!1,!i.model.allowEditing&&(t.keyCode===88||t.keyCode===86))return!1;if((t.keyCode===67||t.keyCode===88||t.keyCode===86)&&i._preventctrlkey){i._showAlertDlg("Alert","CtrlKeyErrorAlert","CtrlKeyErrorAction",450);return}if(t.ctrlKey){if(t.keyCode===67)this._getClipboard(t),this._cutCells=[],n.extend(!0,this._copyCells,r._selectedCells),this._copyCells.length||(this._copyCells=[i.XLShape._picCellIdx]),setTimeout(function(){i.setSheetFocus()},0);else if(t.keyCode===88){if(u=r._selectedCells,i.model.allowLockCell&&r.isSheetProtected&&i._isPropExists([r.selectedRange],"isLocked",f))return;if(u.length&&i._isPropExists([r.selectedRange],"isReadOnly",f))return;this._copyCells=[];n.extend(!0,this._cutCells,u);this._cutCells.length||(this._cutCells=[i.XLShape._picCellIdx]);this._getClipboard(t);setTimeout(function(){i.setSheetFocus()},0)}else if(t.keyCode===86){if(i.isUndefined(t.bubbles)||(this._isSpecial=!i.isPasteValuesOnly),this._cData.length||this._copyBackup.elem)n("#"+i._id+"_hiddenTxt").val(this._cData);else if(t.originalEvent)n("#"+i._id+"_hiddenTxt").select();else{n("#"+i._id+"_hiddenTxt").val("");i._showAlertDlg("Alert",["ClipboardAccessError","ClipboardAccessCutError","ClipboardAccessCopyError","ClipboardAccessPasteError"],"ClipboardAccessError",450);return}setTimeout(function(){i.XLClipboard._setClipboard()},0)}}else t.keyCode===27&&i.element.find(".e-cdata").length&&(i.element.find("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),n("#"+i._id+"_hiddenTxt").val(""),this._cData="",this._copyCells=[])},_triggerKeyDown:function(t,i){var u=this.XLObj,r;u.setSheetFocus();r=n.Event("keydown");r.keyCode=t;r.ctrlKey=i;n("#"+u._id).trigger(r)},_getClipboard:function(t){var i=this.XLObj,r=i.getActiveSheetIndex(),e=i.getSheet(r),o=e._startCell,s=e._endCell,f=i._getContent(r).find(".e-selected"),h=i.getActiveCellElem(r)[0],u;i.model.allowClipboard&&(i.XLClipboard._copyBackup.cells||!i.model.showRibbon||i.model.isReadOnly||(i.XLRibbon._enableButtons(["Home_Clipboard_Paste"],"ejButton"),i.XLRibbon._enableButtons(["Home_Clipboard_PasteOptions"],"ejSplitButton"),i.isPasteValuesOnly&&n("#"+i._id+"_Ribbon_Paste").data("ejMenu").disableItemByID("PasteSpecial")),f.length?(this._copyBackup={cells:[],border:i.model.allowCellFormatting&&i.XLFormat.getHashCodeClassAsArray(),table:[],filterRange:[]},u=this._getSelectedData(o,s),i.element.find(".e-cdata").length&&i.element.find("td.e-cutright, td.e-cutbottom").removeClass("e-cutright e-cutbottom"),n(f).addClass("e-cdata"),i.XLSelection._focusBorder(o,s,i._cutFocus),this._cData=f.length<2&&!u.length?u=" ":u,this._isCut=!1,n("#"+i._id+"_hiddenTxt").val(u).select(),navigator.platform.toLowerCase().indexOf("mac")>-1&&document.execCommand("copy"),this._copyBackup.actCellPos={top:h.offsetTop,left:h.offsetLeft},this._copyBackup.cells[0].cell.wrap&&(this._copyBackup.cells[0].cell.wrap=""),t.keyCode==67&&(this._copyBackup.copypaste=!0),this._isShape=!1):(this._isShape=!0,this._copyBackup={elem:i.getSheetElement(r).find(".e-ss-activeimg"),isCut:t.keyCode===88,sIdx:r}))},_getSelectedData:function(t,i){var u=this.XLObj,h="",f,r,e,c=u.getActiveSheetIndex(),v,s,b,a;for(t.rowIndex>=i.rowIndex&&(v=t,t=i,i=v),this._copyRange=[],this._copyRange.push(u.getActiveSheetIndex()),this._copyRange.push(u._getSelectedItems()[1]),f=t.rowIndex;f<=i.rowIndex;f++)if(f!==t.rowIndex&&(h+="\n"),t.colIndex<=i.colIndex)for(r=t.colIndex;r<=i.colIndex;r++)cData=u.getRangeData({range:[f,r,f,r],property:["type","value","value2"]})[0],e=u.getObjectLength(cData)?cData.type!=="general"?cData.value2:cData.value:"",this._updateCBackupData(f,r),h+=r!==i.colIndex?e+"\t":e;else for(r=i.colIndex;r<=t.colIndex;r++)cData=u.getRangeData({range:[f,r,f,r],property:["type","value","value2"]})[0],e=u.getObjectLength(cData)?cData.type!=="general"?cData.value2:cData.value:"",this._updateCBackupData(f,r),h+=r!==t.colIndex?e+"\t":e;var y=u.model.sheets[c].tableManager,o,l,p=[],w=u.model.sheets[c].selectedRange;for(s=1,b=u.getObjectLength(y);s<=b;s++)if(o=n.extend(!0,{},y[s]),l=o.range,this._compareRange(w,l)){p.push(o.name);o.header=!0;o.tblId=s;this._copyBackup.table.push({tblName:p,tblObj:o,range:l});break}return a=u.getRangeIndices(u.model.sheets[c].filterSettings.range),this._compareRange(w,a)&&(this._copyBackup.filterRange=a),h},_updateCBackupData:function(t,i){var e=this.XLObj,o=e.getActiveSheetIndex(),u,f=e._dataContainer.sheets[o],r,s=new RegExp("\\be-format.*?\\b","g");t in f&&i in f[t]?(r=n.extend(!0,{},f[t][i]),u=r.format?r.format:""):(r={},u="");this._copyBackup.cells.push({cell:r,format:u})},_setClipboard:function(){var r=this.XLObj,tr,ct,yt,yr,pu,ir,ci,wu,tf,bu,rr,li,bi,ku,s,f,ur,pr,wr,pt,uu,fr,at,ai,br,kr,gt,er,tu,or,iu,ru,ki;if(!r.model.isReadOnly){var ot,yi,rt,sr,uu,fu,gu,eu,e,lt,st=[],a=[],it,ou=new RegExp("\\be-format.*?\\b","g"),k,ni=!1,g,u=r.getActiveSheetIndex(),h={cSheetIndex:this._copyRange[0],pSheetIndex:u,sheetIndex:u},ri=[],ui=r.getSheet(u)._startCell,fi=r.getSheet(u)._endCell,p,nt,ut=0,c,ft,ei,hr,pi,v={},d,cr,ti,su=new RegExp("\\be-shapebdr.*?\\b","g"),hu=["solid","dashed","dotted"],nf,y=ui.rowIndex<fi.rowIndex?ui.rowIndex:fi.rowIndex,lr,wi,di=this._copyBackup.table,bt,gi,nr,b=ui.colIndex<fi.colIndex?ui.colIndex:fi.colIndex,l=r._dataContainer,o,kt,ar,oi,dt=this._copyCells.length,vt=this._cutCells.length;if(r.isPasteValuesOnly&&(this._isSpecial=!1),this._copyRange.length){if(lt=r.swapRange(r.getRangeIndices(this._copyRange[1])),oi=r._getSelectedRange({rowIndex:lt[0],colIndex:lt[1]},{rowIndex:lt[2],colIndex:lt[3]}),ot=[y,b,y+(lt[2]-lt[0]),b+(lt[3]-lt[1])],ar=r._getSelectedRange({rowIndex:ot[0],colIndex:ot[1]},{rowIndex:ot[2],colIndex:ot[3]}),r.model.allowLockCell&&r.getSheet(u).isSheetProtected&&r._isPropExists([ot],"isLocked",u))return;if(r._isPropExists([ot],"isReadOnly",u))return}if(y===0&&b===0&&dt===this.XLObj.model.rowCount*this.XLObj.model.columnCount||dt!==this.XLObj.model.rowCount*this.XLObj.model.columnCount){var cu=r.model.sheets[u],lu=r.model.sheets[this._copyBackup.sIdx],si=r.getSheetElement(u).find(".e-activecell"),ht=r.getSheet(this._copyBackup.sIdx||this._copyRange[0]||u).shapeMngr,hi,tt,au,vu,yu,vr,w=this._copyRange[0];if(this._isShape){if(!this._isSpecial)return!1;ct=r.XLShape._picCellIdx;yt=r.getActiveCell(u);d=this._copyBackup.elem;tr=d[0].id;it=tr.indexOf("picture")>-1?"picture":"chart";h={sheetIndex:u,cSheetIndex:this._copyBackup.sIdx,pSheetIndex:u,operation:"shape",cShapeId:tr,reqType:this._copyBackup.isCut?"cut-paste":"copy-paste"};e=n.extend(!0,{},l.sheets[this._copyBackup.sIdx][ct.rowIndex][ct.colIndex]);a=r.getCell(yt.rowIndex,yt.colIndex);n.extend(!0,v,ht[it][tr]);h.cutCell={rowIndex:ct.rowIndex,colIndex:ct.colIndex,obj:e,shapeObj:n.extend(!0,{},v)};d=r.element.find("#"+v.id);it==="picture"?(tt=d[0].className,tt.indexOf("e-shapebdr")>-1?(tt=d[0].className.match(su)[0],bt=tt.replace("e-shapebdr","").split("N"),gi=bt[2],r.XLShape._createPicture(u,yt,ht.sharedPics[v.data],a[0].offsetTop,a[0].offsetLeft,v.width,v.height,null,"#"+gi,hu[parseInt(bt[1])-1],bt[0]+"px"),r.model.showRibbon&&r.XLRibbon._formatTabUpdate()):(r.XLShape._createPicture(u,yt,ht.sharedPics[v.data],a[0].offsetTop,a[0].offsetLeft,v.width,v.height),r.model.showRibbon&&r.XLRibbon._formatTabUpdate())):(o=v.range,o=r._getAlphaRange(u,o[0],o[1],o[2],o[3]),o.indexOf(":")===-1&&(o=o+":"+o),v.top=a[0].offsetTop,v.left=a[0].offsetLeft,r.XLChart.createChart(o,n.extend(!0,{},v)));this._isShape=this._copyBackup.isCut?!1:!0;this._cutCells=[];r._isUndoRedo||(e=n.extend(!0,{},l.sheets[u][yt.rowIndex][yt.colIndex]),v=n.extend(!0,{},cu.shapeMngr[it][e[it][0]]),h.pShapeId=e[it][0],h.pasteCell={rowIndex:yt.rowIndex,colIndex:yt.colIndex,obj:e,shapeObj:v},rt={sheetIndex:h.sheetIndex,cutCell:h.cutCell,pasteSheetIndex:h.pSheetIndex,operation:h.operation,reqType:h.reqType,pasteShapeId:h.pShapeId,pasteCell:h.pasteCell},rt.reqType==="cut-paste"?(rt.cutSheetIndex=h.cSheetIndex,rt.cutShapeId=h.cShapeId):(rt.copySheetIndex=h.cSheetIndex,rt.copyshapeId=h.cShapeId),r._completeAction(h),r._trigActionComplete(rt),this._copyBackup.isCut&&(e=n.extend(!0,{},l.sheets[this._copyBackup.sIdx][ct.rowIndex][ct.colIndex]),e[it].some(function(n,t){return d[0].id===lu.shapeMngr[it][e[it][t]].id?(objIdx=t,!0):!1}),Object.keys(e).length<2&&e[it].length<2?(delete l.sheets[this._copyBackup.sIdx][ct.rowIndex][ct.colIndex],r.getObjectLength(l.sheets[this._copyBackup.sIdx][ct.rowIndex])<1&&delete l.sheets[this._copyBackup.sIdx][ct.rowIndex]):e[it].length<2?delete e[it]:e[it].splice(objIdx,1),delete lu.shapeMngr[it][h.cShapeId]));this._copyBackup.isCut&&d.remove()}else{if(ni=this._cData===n("#"+r._id+"_hiddenTxt").val()&&this._copyRange.length>0,ni){if(r.model.allowLockCell&&r.getSheet(u).isSheetProtected&&r._isPropExists([ot],"isLocked",u))return;if(r._isPropExists([ot],"isReadOnly",u))return}if(pu=[],h.reqType=vt>0?"cut-paste":"copy-paste",r.element.find(".e-selected").hasClass("e-readonly")){r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom");return}if(h.text=st=n("#"+r._id+"_hiddenTxt").val().length?n("#"+r._id+"_hiddenTxt").val().split("\n"):[],this._cData.length<1&&h.text.length<1)return;if(ni||st[st.length-1]!==""||st.splice(st.length-1,1),yr=[],pu=[],ni?(h.isSpecial=this._isSpecial,o=r.getRangeIndices(this._copyRange[1]),r.setActiveSheetIndex(this._copyRange[0]),h.cutBorder={range:o,prevBorder:r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(o)},r.setActiveSheetIndex(u)):h.isSpecial=!1,vt){for(vr=[],w=this._copyRange[0],di.length||this._cutPasteBorder(lt,ot),p=0;p<vt;p++)f=this._cutCells[p].rowIndex,s=this._cutCells[p].colIndex,k=r.getCell(f,s,w),nf=r.XLEdit.getPropertyValue(f,s,"tableName")||"",a={rowIndex:f,colIndex:s,prevObj:{},newObj:{},shapes:[]},t.isNullOrUndefined(l.sheets[w][f])?a.prevObj={}:n.extend(!0,a.prevObj,l.sheets[w][f][s]),e=t.isNullOrUndefined(l.sheets[w][f])?{}:n.extend(!0,{},l.sheets[w][f][s]),k&&k[0]?("merge"in a.prevObj||(r.XLEdit._updateCellValue({rowIndex:f,colIndex:s},"","",w),r._refreshRowHeight(w,f)),"wrap"in e&&(ei=r._generateHeaderText(s+1)+(f+1),r._dupDetails=!0,r.setActiveSheetIndex(w),r.setWrapText("unwrap",ei+":"+ei),r.setActiveSheetIndex(u),r._dupDetails=!1),"cellType"in e&&r.model.allowCellType&&r.XLCellType._removeControls(f,s,w,!0),k.removeClass("e-hyperlinks e-redft e-yellowft e-greenft e-redf e-redt"),k.find("a").remove(),k.hasClass("e-commentcell")&&r.XLComment.deleteComment([f,s,f,s],w),r.model.allowCellFormatting&&!r.XLRibbon._isDirtySelect&&(di.length?r.XLFormat.removeStyle(o):r.XLFormat.removeStyle(o,{cellStyle:!0,tableStyle:!0,format:!0})),f in l.sheets[w]&&s in l.sheets[w][f]&&(t.isNullOrUndefined(l.sheets[w][f][s])||(gu=l.sheets[w][f][s].overflow),delete l.sheets[w][f][s],r._textClip(f,s,"delete")),k[0].className.match(ou)&&(k[0].className=k[0].className.replace(ou,"")),t.isNullOrUndefined(l.sheets[w][f])?a.newObj={}:n.extend(!0,a.newObj,l.sheets[w][f][s]),r._setRowHdrHeight(w,r._getCellIdx(k[0]).rowIndex)):r.getObjectLength(e)&&(eu=r.getObjectKeys(e),r.clearRangeData([f,s,f,s],eu),r.model.allowCellType&&"cellType"in e&&delete l.sheetCellType[l.sheets[w][f][s].cellType]),vr.push(a);for(c=0,ft=di.length;c<ft;c++)bu=r.getActiveSheetIndex(),r.gotoPage(w,!1),lr=n.trim(di[c].tblName),r.XLFormat.removeTable(r._getTableID(null,lr,w)),r.gotoPage(bu,!1);r.model.allowCellFormatting&&r.XLFormat.removeStyle(o,{cellStyle:!0,tableStyle:!0,format:!0});r.setActiveSheetIndex(w);r.setActiveSheetIndex(u);h.cutCells=vr;h.cfat={table:lr,range:o};yu=!0;r.element.find(".e-cdata").length&&r.element.find(".e-cutright, .e-cutbottom").removeClass("e-cutright e-cutbottom")}else{if(rr=[],this._isSpecial)for(p=0;p<dt;p++)f=this._copyCells[p].rowIndex,s=this._copyCells[p].colIndex,a={rowIndex:f,colIndex:s,prevObj:{},newObj:{}},t.isNullOrUndefined(l.sheets[u][f])||n.extend(!0,a.prevObj,l.sheets[u][f][s]),rr.push(a);else rr=this._copyCells;h.cutCells=rr}if(st.length?hi=[y,b,y+st.length-1,b+st[0].split("\t").length-1]:(hi=[y,b,y,b],p=nt=1),h.pasteBorder={range:hi,prevBorder:r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(hi)},dt)for(ur=[],r.XLFormat.removeStyle(ot,{border:!0,cellStyle:!0,format:!0}),li=0,ku=ar.length;li<ku;li++)bi=ar[li],f=oi[li].rowIndex,s=oi[li].colIndex,ur=r.XLEdit.getPropertyValue(f,s,"borders",this._copyRange[0]),r.isUndefined(ur)||r.XLFormat.applyBorder(ur,[bi.rowIndex,bi.colIndex,bi.rowIndex,bi.colIndex]);for(uu=r._getContTBody(u).find("rows"),p=0,au=st.length;p<au;p++){for(a=st[p].split("\t"),nt=0,vu=a.length;nt<vu;nt++){if(k=uu[r._getRowIdx(y+p)]?r.getCell(y+p,b+nt)[0]:i,t.isNullOrUndefined(k)?(cu.colCount<=b+nt?r.XLScroll._createNewColumn(u,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"insert"):r.model.scrollSettings.allowScrolling&&!r.model.scrollSettings.allowVirtualScrolling&&r.XLScroll._createNewRow(u,-1,-1,"insert"),r.XLScroll._refreshScroller(u,"refresh","all"),k=r.getCell(y+p,b+nt)):k=n(k),g={rowIndex:y+p,colIndex:b+nt},g.prevObj=t.isNullOrUndefined(l.sheets[u][y+p])?{}:n.extend(!0,{},l.sheets[u][y+p][b+nt]),t.isNullOrUndefined(g.prevObj)||(delete g.prevObj.isMHide,delete g.prevObj.mergeIdx),this._isCut&&ni)return;if(currentCellIdx={rowIndex:y+p,colIndex:b+nt},this._isSpecial&&ni)if(f=currentCellIdx.rowIndex,s=currentCellIdx.colIndex,wu=oi[ut].rowIndex,tf=oi[ut].colIndex,tt=r._dataContainer.hashCode[this._copyBackup.cells[ut].format],"merge"in this._copyBackup.cells[ut].cell||t.isNullOrUndefined(tt)||r.addClass(k,tt),e=n.extend(!0,{},this._copyBackup.cells[ut].cell),f in l.sheets[u]||(l.sheets[u][f]={}),s in l.sheets[u][f]?"comment"in l.sheets[u][f][s]&&r.getCell(f,s).removeClass("e-commentcell"):l.sheets[u][f][s]={},e){if(gt=n.extend(!0,{},r.XLEdit.getPropertyValue(f,s,"merge")),pr=r.XLEdit.getPropertyValue(f,s,"isMHide"),wr=n.extend(!0,{},r.XLEdit.getPropertyValue(f,s,"mergeIdx")),delete e.overflow,delete e.isOverflow,delete e.tableName,n.extend(!0,l.sheets[u][f][s],e),pt=l.sheets[u][f][s],r.getObjectLength(gt)?pt.merge=gt:delete pt.merge,r.getObjectLength(wr)?pt.mergeIdx=wr:delete pt.mergeIdx,r.isUndefined(pr)?delete pt.isMHide:pt.isMHide=pr,r.XLEdit.getPropertyValue(f,s,"value2")&&(r._textClip(f,s,"delete"),r._textClip(f,s,"add")),ci=e.value2&&typeof e.value2=="string"&&!e.formatStr?l.sharedData[e.value][0]==="="?l.sharedData[e.value]:e.value2:l.sharedData[e.value],e.type===3&&(ci=this._getUpdatedCellFormula(ci,this._copyCells[ut],{rowIdx:f,colIdx:s})),"merge"in e||(r.XLEdit._updateCellValue(currentCellIdx,ci),cHeight=r.XLEdit.getPropertyValue(wu,0,h.reqType==="copy-paste"?"cHeight":"pHeight",this._copyRange[0]),r.isUndefined(cHeight)||(r.XLEdit._updateDataContainer({rowIndex:currentCellIdx.rowIndex,colIndex:0},{dataObj:{pHeight:r.getSheet(u).rowsHeightCollection[currentCellIdx.rowIndex],cHeight:cHeight}}),r.getSheet(u).rowsHeightCollection[currentCellIdx.rowIndex]=cHeight,r._isRowViewable(u,currentCellIdx.rowIndex)&&(r.getRows(u)[1][r._getRowIdx(currentCellIdx.rowIndex)].style.height=cHeight+"px"))),"merge"in e){fr=0;gt=e.merge;o=r.getRangeIndices(gt.mRange);var dr=o[2]-o[0],gr=o[3]-o[1],rf=r.getSheet(u)._selectedCells,nu=r._getAlphaRange(u,g.rowIndex,g.colIndex,g.rowIndex+dr,g.colIndex+gr),vi,uf=fi.rowIndex-ui.rowIndex,ff=fi.colIndex-ui.colIndex;if(at=r._getSelectedRange({rowIndex:g.rowIndex,colIndex:g.colIndex},{rowIndex:g.rowIndex+dr,colIndex:g.colIndex+gr}),oi.length>=rf.length||!((ff+1)%(gr+1)==0&&(uf+1)%(dr+1)==0)){for(c=0,ft=at.length;c<ft;c++)t.isNullOrUndefined(r.XLEdit.getPropertyValue(at[c].rowIndex,at[c].colIndex,"isMHide"))&&(ai=r.XLEdit.getPropertyValue(at[c].rowIndex,at[c].colIndex,"merge"),fr++,t.isNullOrUndefined(ai)||(ai&&(br=ai.mSpan.rowSpan,kr=ai.mSpan.colSpan),t.isNullOrUndefined(br)||t.isNullOrUndefined(kr)||(fr+=parseInt(br)*parseInt(kr)-1),ai.isCenterAlign&&r._isRowViewable(u,at[c].rowIndex)&&r.getCell(at[c].rowIndex,at[c].colIndex).addClass("e-calign").removeClass("e-ralign")));if(at.length===fr&&vt){for(var du=!1,vi=r._getSelectedCells(w,gt.mRange).range,wt,ii=r._dataContainer.sheets[w],et=vi[0];et<=vi[2];et++)for(wt=vi[1];wt<=vi[3];wt++)r._isRowViewable(w,et)&&r.getCell(et,wt,w).text(""),t.isNullOrUndefined(ii[et])&&(ii[et]={}),t.isNullOrUndefined(ii[et][wt])&&(ii[et][wt]={}),du?(ii[et][wt].isMHide=!0,ii[et][wt].mergeIdx={rowIndex:o[0],colIndex:o[1]}):(ii[et][wt].merge=gt,du=!0);r.setActiveSheetIndex(w);r._unMergeAllCells(this._copyRange[0],0,r._getSelectedRange({rowIndex:o[0],colIndex:o[1]},{rowIndex:o[2],colIndex:o[3]}),[],0,0);r.setActiveSheetIndex(u)}r._paste=!0;r._dupDetails=!0;r.isUndefined(g.prevObj.merge)||r.unmergeCells(g.prevObj.merge.mRange);r.unmergeCells(nu);r.mergeCenter=gt.isCenterAlign;r.isUndefined(vi)||vi!=="1"?r.mergeCells(nu,!0):r.mergeAcrossCells(nu,!0);r._dupDetails=!1;r.XLEdit._updateCellValue(currentCellIdx,ci);t.isNullOrUndefined(tt)||r.addClass(k,tt)}else{er=n.extend(!0,{},e);er.value=er.value2=ci;t.isNullOrUndefined(tt)||r.getCell(o[0],o[1],this._copyRange[0]).addClass(tt);r.XLEdit._updateDataContainer({rowIndex:o[0],colIndex:o[1]},{dataObj:er});r._showAlertDlg("Alert","MergeAlert","",250);return}}if("hyperlink"in e&&(ir=e.hyperlink,k&&(ir&&!ir.webAddr?k.html(t.buildTag("a.e-hyperlinks",r.XLEdit.getPropertyValue(f,s,"value2"),"",{href:"#"})):k.html(t.buildTag("a.e-hyperlinks",r.XLEdit.getPropertyValue(f,s,"value2"),"",{href:ir.webAddr,target:"_blank"})))),"comment"in e&&(r._removeClass(k,"e-commentcell"),r.XLComment.setComment([f,s,f,s],null,!1)),"cFormatRule"in e)for(hr=n.extend(!0,[],e.cFormatRule),e.cFormatRule=[],c=0,ft=hr.length;c<ft;c++)pi=r._dataContainer.cFormatData[hr[c]].split("_"),r.XLCFormat._cFormat(pi[0],pi[2],pi[3],pi[4],null,null,[f,s,f,s],"paste",this._copyCells[ut]);if(r._isPaste=!0,"wrap"in e&&(r._dupDetails=!0,ei=r._generateHeaderText(s+1)+(f+1),r.setWrapText("wrap",ei+":"+ei),r._dupDetails=!1),"cellType"in e&&(sr=r._dataContainer.sheetCellType[e.cellType],sr.text="",r.model.allowCellType&&r.XLCellType._renderControls(f,s,u,sr,!vt)),r._isPaste=!0,"picture"in e)for(delete pt.picture,c=0,ft=e.picture.length;c<ft;c++)a=dt?this._copyCells[ut]:this._cutCells[ut],kt=this._copyBackup.actCellPos,ti=r.getRangeData([a.rowIndex,a.colIndex,a.rowIndex,a.colIndex],"","",this._copyRange[0])[0],(!r.isUndefined(ti.picture)&&ti.picture.indexOf(e.picture[c])>-1||!dt)&&(n.extend(!0,v,ht.picture[e.picture[c]]),d=r.element.find("#"+v.id),v.rowIndex===a.rowIndex&&v.colIndex===a.colIndex&&(d=r.element.find("#"+v.id),tt=d[0].className,tt.indexOf("e-shapebdr")>-1?(tt=d[0].className.match(su)[0],bt=tt.replace("e-shapebdr","").split("N"),gi=bt[2],r.XLShape._createPicture(u,currentCellIdx,ht.sharedPics[v.data],parseInt(d.css("top"))-kt.top+si[0].offsetTop,parseInt(d.css("left"))-kt.left+si[0].offsetLeft,v.width,v.height,null,"#"+gi,hu[parseInt(bt[1])-1],bt[0]+"px")):r.XLShape._createPicture(u,currentCellIdx,ht.sharedPics[v.data],parseInt(d.css("top"))-kt.top+si[0].offsetTop,parseInt(d.css("left"))-kt.left+si[0].offsetLeft,v.width,v.height),this._copyRange[0]===u&&(l.sheets[u][y+p][b+nt].picture[c]=r.getObjectKeys(ht.picture)[r.getObjectLength(ht.picture)-1]),vt&&d.remove()));if("chart"in e)for(delete pt.chart,ti=r.getRangeData([f,s,f,s]),c=0,ft=e.chart.length;c<ft;c++)a=dt?this._copyCells[ut]:this._cutCells[ut],kt=this._copyBackup.actCellPos,ti=r.getRangeData([a.rowIndex,a.colIndex,a.rowIndex,a.colIndex])[0],(!r.isUndefined(ti.chart)&&ti.chart.indexOf(e.chart[c])>-1||!dt)&&(n.extend(!0,v,ht.chart[e.chart[c]]),d=r.element.find("#"+v.id),v.rowIndex===a.rowIndex&&v.colIndex===a.colIndex&&(o=v.range,o=r._getAlphaRange(u,o[0],o[1],o[2],o[3]),o.indexOf(":")<0&&(o=o+":"+o),v.top=parseInt(d.css("top"))-kt.top+si[0].offsetTop,v.left=parseInt(d.css("left"))-kt.left+si[0].offsetLeft,r.XLChart.createChart(o,v),l.sheets[u][y+p][b+nt].chart[c]=r.getObjectKeys(ht.chart)[r.getObjectLength(ht.chart)-1],vt&&d.remove()));"rule"in e&&e.rule.type==="list"&&r._setddlCell();r._isPaste=!1}else r.XLEdit._updateCellValue(currentCellIdx,""),t.isNullOrUndefined(l.sheets[u][f])||delete l.sheets[u][f][s];else yi=r.XLEdit._parseValue(a[nt],currentCellIdx),yi.type=="time"||yi.type=="datetime"?(fu=r._dateToInt(yi.value),r.XLEdit._updateCellValue(currentCellIdx,fu)):r.XLEdit._updateCellValue(currentCellIdx,yi.value),a[nt].indexOf("=")>-1&&r.XLEdit._updateCellValue(currentCellIdx,k.html());ut++;g.newObj=t.isNullOrUndefined(l.sheets[u][y+p])?{}:n.extend(!0,{},l.sheets[u][y+p][b+nt]);t.isNullOrUndefined(g.newObj)&&(g.newObj={});yr.push(g)}t.isNullOrUndefined(k)||(r._setRowHdrHeight(u,r._getCellIdx(k[0]).rowIndex),r.model.allowFreezing&&r.getSheet(u)._isFreezed&&r.XLFreeze._refreshFRowResize(r._getCellIdx(k[0]).rowIndex))}if(st.length<1&&(p=1),vt&&(this._isCut=yu,this._cutCells=[],this._cData=""),this._isSpecial&&ni){for(tu=this._copyBackup.table,iu=r.getSheet(u).tableManager,o=r.getRangeIndices(this._copyRange[1]),c=0,ft=tu.length;c<ft;c++)wi=this._copyBackup.table[c].range,or=n.extend(!0,{},this._copyBackup.table[c].tblObj),this._copyBackup.copypaste&&(or.name="Table"+r._tableCnt),r._dupDetails=!0,r.XLFormat.createTable(or,r._getAlphaRange(this._copyRange[0],wi[0]+y-o[0],wi[1]+b-o[1],y-o[0]+wi[2],b-o[1]+wi[3])),r._dupDetails=!1,ru=this._isCut?or.tblId:this.XLObj.getObjectLength(iu),ri.push(iu[ru]),ri[c].id=ru,ri[c].totalRow&&r.XLFormat._updateTotalRow(u,ri[c].id,tu[0].tblObj.fnNumber,ri[c].range,!0);hi=[y,b,p+y-1,nt+b-1];vt&&this._copyBackup.filterRange.length>0&&this._copyRange[0]===u&&(ki=this._copyBackup.filterRange,r.XLFilter.clearFilter(),cr=r._generateHeaderText(ki[1]+b-o[1]+1)+(ki[0]+y-o[0]+1)+":"+r._generateHeaderText(b-o[1]+ki[3]+1)+(y-o[0]+ki[2]+1),r.XLFilter.filter(cr));h.pasteBorder.newBorder=r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(hi);r.setActiveSheetIndex(this._copyRange[0]);h.cutBorder.newBorder=r.model.allowCellFormatting&&r.XLFormat.getHashCodeClassAsArray(o);r.setActiveSheetIndex(u)}h.pfat={table:this._copyBackup.table,range:o,minRowIdx:y,minColIdx:b,ptable:ri};h.pfilter=cr;h.pasteCells=yr;r.XLSelection.selectRange({rowIndex:y,colIndex:b},{rowIndex:p+y-1,colIndex:nt+b-1});r.getSheet(u)._startCell={rowIndex:y,colIndex:b};r.getSheet(u)._endCell={rowIndex:p+y-1,colIndex:nt+b-1};r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement();h.sheetIndex=u;r.setSheetFocus();r.model.showRibbon&&r.XLRibbon._updateRibbonIcons();rt={sheetIndex:h.sheetIndex,pasteCells:h.pasteCells,reqType:h.reqType,isSpecial:h.isSpecial,cutCells:h.cutCells,pasteSheetIndex:h.pSheetIndex};rt.reqType==="cut-paste"?rt.cutSheetIndex=h.cSheetIndex:rt.copySheetIndex=h.cSheetIndex;r._isUndoRedo||(r._completeAction(h),r._trigActionComplete(rt));nr=h.cutCells.length<1?y:h.cutCells[0].rowIndex;r.XLScroll._getRowHeights(u,y<nr?y>0?y-1:0:nr>0?nr-1:0)}r._isPaste=!1;this._isCut=!1;r.XLSelection._refreshBorder();r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement();r.getSheet(u)._isFreezed&&r.XLFreeze._refreshSelection()}else r._showAlertDlg("Alert","FullSheetCopyPasteAlert","",375)}},_getUpdatedCellFormula:function(n,t,i){for(var f=this.XLObj,c=/([A-Z].*?[0-9])/g,l=i.rowIdx-t.rowIndex,a=i.colIdx-t.colIndex,r=f.XLDragFill._parseFormula(n),e,o,s,u=0,h=r.length;u<h;u++)r[u].match(c)&&(e=r[u].trim().match(/(\d+|\D+)/g),o=f._generateColCount(e[0])+a,s=parseInt(e[1])+l,r[u]=s>0&&o>0?f._generateHeaderText(o)+s.toString():"#REF!");return r=r.join(""),"="+r},_compareRange:function(n,t){return n[0]<=t[0]&&n[1]<=t[1]&&n[2]>=t[2]&&n[3]>=t[3]},_cutPasteBorder:function(n,t){var r,u,s,h,c,i=this.XLObj,l=i.getActiveSheetIndex(),f=[],e=[],o=[];for(i.XLFormat.removeStyle(t,{cellStyle:!0,border:!0,format:!0,sheetIdx:l}),e=i._getSelectedRange({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]}),o=i._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]}),r=0,c=o.length;r<c;r++)u=o[r],h=e[r].rowIndex,s=e[r].colIndex,f=i.XLEdit.getPropertyValue(h,s,"borders",this._copyRange[0]),i.isUndefined(f)||i.XLFormat.applyBorder(f,[u.rowIndex,u.colIndex,u.rowIndex,u.colIndex]);i.setActiveSheetIndex(this._copyRange[0]);i.XLFormat.removeStyle(n,{cellStyle:!0,border:!0,format:!0});i.setActiveSheetIndex(l)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.comments=function(n){this.XLObj=n;this._isCommentEdit=!1;this._isShowAllComments=!1;this._curCommentHCell=null};t.spreadsheetFeatures.comments.prototype={setComment:function(n,i,r,u){var f=this.XLObj,a;if(f.model.allowComments&&f.model.allowEditing&&!f.model.isReadOnly){var g,p=!1,y,c,e,o,w,v,b,s,h,k,d=[],l={sheetIndex:f.getActiveSheetIndex(),reqType:"comment"};if(s=f.getActiveSheetIndex(),h=f.getSheet(s),f.model.allowLockCell&&h.isSheetProtected)return!1;if(n)rng=f._getRangeArgs(n,"object"),e=rng[0],o=rng[1],c={rowIndex:e,colIndex:o};else{if(!f.model.allowSelection)return;c=f.getActiveCell(s);e=c.rowIndex;o=c.colIndex}if(a={reqType:"beforeEditComment",cellIndex:c,value:i,sheetIdx:s,disable:!1},f._trigger("beforeEditComment",a)&&(a.disable=!0),i=a.value,!f._isCellProtected(e,o,!1)){if(!f.isUndefined(f.XLEdit.getPropertyValue(e,o,"cellType"))){f._showAlertDlg("Alert","CellTypeAlert","CellTypeAlert",372);return}f.model.showRibbon&&(f._isPaste?!f.XLClipboard._cutCells.length:!0)&&f._commentCount++;f._isRibbonClick||(l.action="add",d.push(c),l.selectedCell=d,l.selectedCell[0].prevComment=f.XLEdit.getPropertyValue(e,o,"comment"));f._isAutoWHMode||f.XLClipboard._copyCells.length||h._isFreezed||f.XLScroll._scrollSelectedPosition(s,c);e in h._commentColl||(h._commentColl[e]={});h._commentColl[e][o]={isComment:!0};r=t.isNullOrUndefined(r)?!0:r;u=t.isNullOrUndefined(u)?!0:u;b=(f.model.userName.length>0?f.model.userName:f._getLocStr("UserName"))+":\n";g=f.XLEdit.getPropertyValue(e,o,"comment",s);t.isNullOrUndefined(i)?a.disable&&f.XLEdit._updateDataContainer(c,{dataObj:{comment:{value:b,isVisible:t.isNullOrUndefined(f.XLEdit.getPropertyValue(e,o,"comment",s))?r:f.XLEdit.getPropertyValue(e,o,"comment",s).isVisible}}}):(u&&(i=b+i),f.XLEdit._updateDataContainer(c,{dataObj:{comment:{value:i,isVisible:t.isNullOrUndefined(f.XLEdit.getPropertyValue(e,o,"comment",s))?r:f.XLEdit.getPropertyValue(e,o,"comment",s).isVisible}}}));w=t.isNullOrUndefined(f.XLEdit.getPropertyValue(e,o,"comment",s))?(f.model.userName.length>0?f.model.userName:f._getLocStr("UserName"))+":\n":f.XLEdit.getPropertyValue(e,o,"comment",s).value;!f.model.allowComments||f.XLEdit._isEdit||f._isSheetRename||(f._isRowViewable(s,e)&&(y=f.getCell(e,o),y.prepend(t.buildTag("span.e-comment",t.buildTag("span.e-celltoparrow")).append(t.buildTag("textarea.e-comment-txtarea",w,{"z-index":10}))).addClass("e-commentcell"),this._updateCmntArrowPos(y),v=y.find(".e-comment-txtarea"),this._updateCmtAreaPos(y,v),v.focus().setInputPos(v.val().length),p=!0,a.disable&&(v[0].disabled=!0)),(!h._isImported||h._isLoaded)&&(k=f.XLEdit.getPropertyValue(e,o,"comment",s),t.isNullOrUndefined(k)||(k.value=w)),r&&p?(v.focus(),!this._curCommentHCell||t.isNullOrUndefined(f.XLEdit.getPropertyValueByElem(this._curCommentHCell,"comment"))||f.XLEdit.getPropertyValueByElem(this._curCommentHCell,"comment").isVisible||(this._curCommentHCell.find(".e-comment-txtarea").hide(),this._curCommentHCell=null),f.model.allowDragAndDrop&&!f.XLDragDrop._isDragAndDropped&&this._updateCurrentCell(e,o),a.disable?this._updateCmntRibIcons():(this._isCommentEdit=!0,f.model.showRibbon&&f.XLRibbon._disableRibbonIcons())):p&&(this._isShowAllComments||f.XLEdit.getPropertyValue(e,o,"comment",s).isVisible||v.hide(),f.model.showRibbon&&(!h._isImported||h._isLoaded)&&f.model.allowDragAndDrop&&!f.XLDragDrop._isDragAndDropped&&this._updateCmntRibIcons(f.XLClipboard._isSpecial?f.getActiveCell():{rowIndex:e,colIndex:o})),f._isRibbonClick||f._isUndoRedo||f._hasComment||f._isExport||f._dupDetails||(l.selectedCell[0].curComment=f.XLEdit.getPropertyValue(e,o,"comment"),l.showUserName=u,l.showEditPanel=r,f._completeAction(l),f._trigActionComplete(l)))}}},_updateCmtAreaPos:function(n,t){var r=this.XLObj,u=r.getActiveSheetIndex(),s=r._getContent(u).find("#hscrollBar").offset(),f=r._getContent(u).find("#vscrollBar").offset(),h=r._getJSSheetHeader(u).offset(),i=t.offset(),e=t.height(),o=t.width();r.model.scrollSettings.allowScrolling&&(i.top+e+5>s.top&&i.left+o<f.left?t.css({top:-77}):i.left+o>f.left&&i.top+e+5>s.top?t.css({left:-136,top:-81}):i.top+e>h.top&&i.left+o>f.left&&t.css({left:-137,top:n.height()+8}))},deleteComment:function(i,r,u,f){var e=this.XLObj,o;if(e.model.allowComments&&!e.model.isReadOnly){var v,l=[],a=[],h=r||e.getActiveSheetIndex(),s,c={sheetIndex:h,reqType:"comment",action:"delete",range:i};for(i=e._getRangeArgs(i,"object"),s=e._getSelectedCells(r,i).selCells,o=0;o<s.length;o++)e.XLEdit.getPropertyValue(s[o].rowIndex,s[o].colIndex,"comment",r)&&l.push(s[o]);if(e.model.allowComments){for(o=0;o<s.length;o++)if(rowIdx=s[o].rowIndex,colIdx=s[o].colIndex,cmnt=e.XLEdit.getPropertyValue(rowIdx,colIdx,"comment",r),!t.isNullOrUndefined(cmnt)){if(v=n(s[o]),u&&e._isHiddenRow(rowIdx)){s.splice(o,1);continue}e.model.showRibbon&&e._commentCount&&e._commentCount--;a.push({rowIndex:rowIdx,colIndex:colIdx,prevComment:cmnt,currComment:{}});e._isRowViewable(h,rowIdx)&&e.getCell(rowIdx,colIdx,h).removeClass("e-commentcell").find(".e-comment").remove();e.getSheet(h)._commentColl[rowIdx]&&delete e.getSheet(h)._commentColl[rowIdx][colIdx];delete e._dataContainer.sheets[h][rowIdx][colIdx].comment}c.selectedCell=a;e.model.showRibbon&&l.length&&e.model.allowDragAndDrop&&!e.XLDragDrop._isDragAndDropped&&e.XLComment._updateCmntRibIcons();c.reqType=t.isNullOrUndefined(f)?"comment":"clear-comment";e._isUndoRedo||e._dupDetails||(e._completeAction(c),e._trigActionComplete(c))}}},editComment:function(n){var i=this.XLObj,r,f,u,e;if(i.model.allowComments&&!i.model.isReadOnly){if(u=i.getActiveSheetIndex(),i.model.allowLockCell&&i.getSheet(u).isSheetProtected)return!1;t.isNullOrUndefined(n)&&(n=i.getActiveCell());f=i.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"comment",u);r={reqType:"beforeEditComment",cellIndex:n,value:f.value,sheetIndex:u,isDisable:!1};i._trigger("beforeEditComment",r)&&(r.disable=!0);f.value=r.value;i.XLEdit._updateDataContainer(n,{dataObj:{comment:{value:f.value,isVisible:f.isVisible}}});i.XLEdit._isEdit||i._isSheetRename||(i.model.allowComments&&(t.isNullOrUndefined(i.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"comment"))||(i._isAutoWHMode||i.XLScroll._scrollSelectedPosition(u,n),i._isRowViewable(u,n.rowIndex)&&(e=i.getCell(n.rowIndex,n.colIndex).find(".e-comment-txtarea"),e.text(r.data),e.css("display","inline-table").focus().setInputPos(e.text().length)),r.disable||(this._isCommentEdit=!0))),i.model.showRibbon&&!r.disable&&i.XLRibbon._disableRibbonIcons())}},showHideComment:function(n){var i=this.XLObj;if(i.model.allowComments&&!i.model.isReadOnly){var s=i.getActiveSheetIndex(),r,u,e,o=!1,f=!1;r=t.isNullOrUndefined(n)?i.getActiveCell():i._getCellIdx(n[0]);u=i.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"comment");t.isNullOrUndefined(u)||(i._isRowViewable(s,r.rowIndex)&&(e=i.getCell(r.rowIndex,r.colIndex).find(".e-comment-txtarea"),o=!0),u.isVisible?(o&&e.hide(),f=!1):(o&&e.css("display","inline-table"),this._curCommentHCell=null,f=!0));i.isUndefined(f)||(u.isVisible=f)}},showAllComments:function(){var t=this.XLObj,r;if(t.model.allowComments){for(var h=t.getActiveSheetIndex(),u,f,e,o=n("#"+t._id+"_Ribbon_Review_Comments_ShowAllComments").data("ejToggleButton"),s=["Review_Comments_PreviousComment","Review_Comments_NextComment"],c=this._isShowAllComments?!1:!0,i=1;i<=t.model.sheetCount;i++)for(u=t.getSheet(i)._commentColl,rowKeys=t.getObjectKeys(u),j=0;j<rowKeys.length;j++){for(colKeys=t.getObjectKeys(u[rowKeys[j]]),r=0;r<colKeys.length;r++)t._isRowViewable(h,parseInt(rowKeys[j]))&&(f=t.getCell(parseInt(rowKeys[j]),parseInt(colKeys[r]),i).find(".e-comment-txtarea"),this._isShowAllComments?f.hide():f.css("display","inline-table")),t.XLEdit.getPropertyValue(rowKeys[j],colKeys[r],"comment",i).isVisible=!this._isShowAllComments;j==0&&(e=!0)}this._isShowAllComments=!this._isShowAllComments;t.model.showRibbon&&o&&o.model.toggleState?t.XLRibbon._disableButtons(s,"ejButton"):t.model.showRibbon&&e&&t.XLRibbon._enableButtons(s,"ejButton")}},findPrevComment:function(){var i=this.XLObj,o,u,y,c,l,a,f,r,e,s,p,h,v;if(i.model.allowComments&&!i.model.isReadOnly){for(o=i.getActiveSheetIndex(),p=n("#"+i._id+"_Ribbon_Review_Comments_NewComment"),f=o;f>0;f--)if(u=i.getSheet(f),i.getObjectLength(u._commentColl))for(f!==o&&i.gotoPage(f,!1),i.model.showRibbon&&(v=i.XLRibbon._getTabIndex("review"),v&&n("#"+i._id+"_Ribbon").ejRibbon("option","selectedItemIndex",v)),y=u.rowCount-1,c=u.colCount-1,f!==o&&this._updateCurrentCell(y-1,c-1),l=u._activeCell.rowIndex,a=u._activeCell.colIndex,r=l;r>=0;r--)for(r!==l&&(a=c-1),e=a;e>=0;e--)if(i.XLEdit.getPropertyValue(r,e,"comment",o)&&(u._hiddenFreezeRows.indexOf(r)>-1&&u._isFreezed?i.XLSearch._freezeScroll(r,e,u):i._isRowViewable(o,r)||i._scrollContent({y:i._getRowOffsetTop(u,r)},!0)),i._isRowViewable(o,r)){if(s=n(i.getCell(r,e)),h=n(s.find(".e-comment-txtarea")),u._activeCell.rowIndex!==r&&u._activeCell.colIndex!==e&&!t.isNullOrUndefined(i.XLEdit.getPropertyValueByElem(s,"comment"))&&i.XLEdit.getPropertyValueByElem(s,"comment").isVisible&&h.hide(),s.hasClass("e-commentcell")&&!h.is(":visible"))return h.css("display","inline-table").focus()&&this._updateCurrentCell(r,e),this._updateCommentsBtns(p),i.setSheetFocus(),!0;this._isShowAllComments||this._isCommentEdit||!s.hasClass("e-commentcell")||i.XLEdit.getPropertyValueByElem(s,"comment").isVisible||h.hide()}f===0&&i._showAlertDlg("","CommentFindEndAlert","findPrevComment",630)}},_updateCommentsBtns:function(n){var t=this.XLObj;t.model.showRibbon&&(t.XLRibbon._enableButtons(["Review_Comments_DeleteComment","Review_Comments_ShowHideComment"],"ejButton"),n.find(".e-icon").removeClass("e-ssr-newcmnt").addClass("e-ssr-editcmnt"),n.find(".e-btntxt").text(t._getLocStr("EditComment")))},findNextComment:function(){var i=this.XLObj;if(i.model.allowComments&&!i.model.isReadOnly){for(var u,c,l,v,y,r,o,e,h,a,p=!1,s=i.getActiveSheetIndex(),w=n("#"+i._id+"_Ribbon_Review_Comments_NewComment"),f=s;f<=i.model.sheetCount;f++)if(u=i.getSheet(f),i.getObjectLength(u._commentColl))for(f!==s&&i.gotoPage(f,!1),i.model.showRibbon&&(a=i.XLRibbon._getTabIndex("review"),a&&n("#"+i._id+"_Ribbon").ejRibbon("option","selectedItemIndex",a)),f!==s&&this._updateCurrentCell(0,0),c=u._activeCell.rowIndex,l=u._activeCell.colIndex,v=u.rowCount-1,y=u.colCount-1,r=c;r<v;r++)for(r!==c&&(l=0),o=l;o<y;o++){if(i.XLEdit.getPropertyValue(r,o,"comment",s)&&(u._isFreezed?i.XLSearch._freezeScroll(r,o,u):i._isRowViewable(s,r)||i._scrollContent({y:i._getRowOffsetTop(u,r)},!0),p=!i.getActiveCellElem()),i._isRowViewable(s,r)&&(e=n(i.getCell(r,o)),h=n(e.find(".e-comment-txtarea")),p||i.getActiveCellElem()[0]===e[0]||t.isNullOrUndefined(i.XLEdit.getPropertyValueByElem(e,"comment"))||!i.XLEdit.getPropertyValueByElem(e,"comment").isVisible||h.hide(),e.hasClass("e-commentcell")&&!h.is(":visible")))return h.css("display","inline-table").focus(),this._updateCurrentCell(r,o),this._updateCommentsBtns(w),i.setSheetFocus(),!0;this._isShowAllComments||this._isCommentEdit||!e.hasClass("e-commentcell")||i.XLEdit.getPropertyValueByElem(e,"comment").isVisible||h.hide()}f===i.model.sheetCount+1&&i._showAlertDlg("","CommentFindEndAlert","findNextComment",630)}},_commentMouseMove:function(i){var e=this.XLObj,r,f,u;(r=i.target.tagName==="TD"?n(i.target):n(i.target).parent("td"),r.length)&&(f=r.find(".e-comment-txtarea"),this._isCommentEdit||(t.isNullOrUndefined(this._curCommentHCell)||r!==this._curCommentHCell&&(u=e.XLEdit.getPropertyValueByElem(this._curCommentHCell,"comment"),t.isNullOrUndefined(u)||u.isVisible||(this._curCommentHCell.find(".e-comment-txtarea").hide(),this._curCommentHCell=null)),r[0].tagName==="TD"&&r.hasClass("e-commentcell")&&(f.css("display","inline-table"),this._curCommentHCell=r)))},_commentMouseDownHandler:function(t){var i=this.XLObj,r=i.getActiveCell(),o=i.getActiveSheetIndex(),u,f,e;i._isRowViewable(o,r.rowIndex)&&(u=i.getCell(r.rowIndex,r.colIndex,o),e=n(u.find(".e-comment-txtarea")),u.hasClass("e-commentcell")&&e.get()[0]!==t.target&&(f=i.XLEdit.getPropertyValue(r.rowIndex,r.colIndex,"comment"),this._isCommentEdit&&this._updateCurCmntVal(r),this._isShowAllComments||i.isUndefined(f)||f.isVisible||e.hide()));i._hasClass(t.target,"e-comment-txtarea")&&!t.target.disabled&&(n(t.target).focus().css("z-index",10)&&(this._isCommentEdit=!0),this._updateCurrentCell(n(t.target).parents("td").parent().index(),n(t.target).parents("td").index()),i.model.showRibbon&&i.XLRibbon._disableRibbonIcons())},_updateCmntRibIcons:function(t){var f,i=this.XLObj,e=["Review_Comments_ShowHideComment","Review_Comments_DeleteComment"],u=i.getActiveSheetIndex(),l=i.getSheetElement(u),r=n("#"+i._id+"_Ribbon_Review_Comments_NewComment"),h=i.getActiveCell(),o=i.getSheet(u),c=o._selectedCells,s=o.selectedRange;t=i.model.allowDragAndDrop&&!i.XLDragDrop._isDragAndDropped?t?t:h:{rowIndex:i._dStartCell.rowIndex,colIndex:i._dStartCell.colIndex};i.XLRibbon._enableButtons(["Review_Comments_NewComment"],"ejButton");i.XLRibbon._enableButtons(i.XLRibbon._cmntTglBtnIds,"ejToggleButton");f=i.XLEdit.getPropertyValue(t.rowIndex,t.colIndex,"comment",u);f?(i.XLRibbon._enableButtons(e,"ejButton"),r.find(".e-icon").removeClass("e-ssr-newcmnt").addClass("e-ssr-editcmnt"),r.find(".e-btntxt").text(i._getLocStr("EditComment"))):(r.find(".e-icon").removeClass("e-ssr-editcmnt").addClass("e-ssr-newcmnt"),r.find(".e-btntxt").text(i._getLocStr("NewComment")),i.XLRibbon._disableButtons(e,"ejButton"));this._isShowAllComments||i._commentCount===0?i.XLRibbon._disableButtons(["Review_Comments_PreviousComment","Review_Comments_NextComment"],"ejButton"):i.XLRibbon._enableButtons(["Review_Comments_PreviousComment","Review_Comments_NextComment"],"ejButton");c.length&&i.inRange(s,t.rowIndex,t.colIndex)&&i.XLEdit._rangeHasProperty(s,"comment")&&i.XLRibbon._enableButtons(["Review_Comments_DeleteComment"],"ejButton")},_updateCurCmntVal:function(n,i){i=t.isNullOrUndefined(i)?"":i;var r=this.XLObj,h=t.isNullOrUndefined(n)?r.getActiveCell():n,o,c=[],l="User Name:",s=!1,e={sheetIndex:r.getActiveSheetIndex(),reqType:"comment"},u=h.rowIndex,f=h.colIndex;r._isRowViewable(e.sheetIndex,u)&&(o=r.getCell(u,f,r.getActiveSheetIndex()).find(".e-comment-txtarea"),s=!0,o.scrollTop(0));c.push({rowIndex:u,colIndex:f});e.action=t.isNullOrUndefined(r.XLEdit.getPropertyValue(u,f,"comment"))?"add":"edit";e.selectedCell=c;e.selectedCell[0].prevComment=r.XLEdit.getPropertyValue(u,f,"comment");s&&(l=o.css("z-index",9).val());r.XLEdit._updateDataContainer({rowIndex:u,colIndex:f},{dataObj:{comment:{value:l,isVisible:r.isUndefined(r.XLEdit.getPropertyValue(u,f,"comment"))?this._isShowAllComments:r.XLEdit.getPropertyValue(u,f,"comment").isVisible}}});!s||this._isShowAllComments||r.XLEdit.getPropertyValue(u,f,"comment").isVisible||o.hide();r.setSheetFocus();this._isCommentEdit=!1;r.XLCellNav._isNavigate=!0;r.model.showRibbon&&r.XLRibbon._enableRibbonIcons();r.XLEdit._updateUsedRange(u,f);e.selectedCell[0].curComment=r.XLEdit.getPropertyValue(u,f,"comment");r._isUndoRedo||i==="paste"||(r._completeAction(e),r._trigActionComplete(e))},_updateCurrentCell:function(n,t,i){var r=this.XLObj,u={rowIndex:n,colIndex:t},f;i=i?i:r.model.activeSheetIndex;f=r.getSheet(i);f._activeCell=u;r.model.allowSelection&&r.XLSelection.selectRange(u,u,i);f._startCell=f._endCell=u;r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement()},_visibleCmntCnt:function(n,t){n.find(".e-comment")[t?"show":"hide"]()},_updateCmntArrowPos:function(t,i,r){var o,l,u,c,e,s,f=this.XLObj,i=f._getSheetIndex(i),h=f.getSheet(i),a=t||f._getContent(i).find(".e-commentcell");if(r=r||{},f.model.allowComments)for(o=0,l=a.length;o<l;o++)if((s=n(a[o]),u=f._getCellIdx(s[0]),!(u.rowIndex<r.rowIndex)&&!(u.colIndex<r.colIndex))&&(e=s.find(".e-comment"),f._isInsdel&&(u.rowIndex in h._commentColl||(h._commentColl[u.rowIndex]={}),h._commentColl[u.rowIndex][u.colIndex]={isComment:!0}),e.length)){if(c=f._getCellInfo(u,i),h.columnsWidthCollection[u.colIndex]<5){e.hide();continue}e.is(":hidden")&&e.show();e.css({top:c.top+"px",left:c.left+s.width()+"px"})}},_updateCmntFrmCntnr:function(n,t){var i=this.XLObj;i.XLEdit.getPropertyValue(n,t,"comment")&&(i._isRowViewable(null,t)&&i.getCell(n,t).hasClass("e-commentcell")&&this.deleteComment([n,t,n,t]),this.setComment([n,t,n,t],null,!1))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.contextmenu=function(n){this.XLObj=n;this._clrFltrEnable=!1;this._isMenuOpened=!1;this._uniqueClass=n._id+"-cmenu";this._selColor="";this._changedDataSource=!1;this._rowCellMenuDataMobile=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"PasteSpecial",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"FormatCells",text:n._getLocStr("FormatCells")+"...",parentId:null,spriteCssClass:"e-icon e-ss-formatcells"},{id:"BackgroundColor",text:n._getLocStr("BackgroundColor"),parentId:null,spriteCssClass:"e-icon e-ss-backgroundcolor"},{id:"FontColor",text:n._getLocStr("FontColor"),parentId:null,spriteCssClass:"e-icon e-ss-fontcolor"},];this._headerMenuDataMobile=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"PasteSpecial",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"Insert",text:n._getLocStr("Insert"),parentId:null},{id:"Delete",text:n._getLocStr("Delete"),parentId:null},{id:"Hide",text:n._getLocStr("Hide"),parentId:null},{id:"Unhide",text:n._getLocStr("Unhide"),parentId:null},];this._rowCellMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"Paste",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"PasteSpecial",text:n._getLocStr("PasteSpecial"),parentId:"Paste"},{id:"PasteValues",text:n._getLocStr("PasteValues"),parentId:"Paste"},{id:"Insert",text:n._getLocStr("Insert")+"...",parentId:null},{id:"Delete",text:n._getLocStr("Delete")+"...",parentId:null},{id:"Filter",text:n._getLocStr("Filter"),parentId:null,spriteCssClass:"e-icon e-ss-filter"},{id:"ClearFilter",parentId:"Filter",text:n._getLocStr("ClearFilter"),spriteCssClass:"e-icon e-ss-filternone"},{id:"FilterSelected",parentId:"Filter",text:n._getLocStr("FilterSelected"),spriteCssClass:"e-icon e-ss-filter"},{id:"Sort",text:n._getLocStr("Sort"),parentId:null,spriteCssClass:"e-icon e-ss-sortatoz"},{id:"SortAtoZ",parentId:"Sort",text:n._getLocStr("SortAtoZ"),spriteCssClass:"e-icon e-ss-sortatoz"},{id:"SortZtoA",parentId:"Sort",text:n._getLocStr("SortZtoA"),spriteCssClass:"e-icon e-ss-sortztoa"},{id:"PutCellColor",parentId:"Sort",text:n._getLocStr("PutCellColor"),spriteCssClass:""},{id:"PutFontColor",parentId:"Sort",text:n._getLocStr("PutFontColor"),spriteCssClass:""},{id:"ctxComment",parentId:null,text:n._getLocStr("Comment")},{id:"ctxInsrtCmnt",text:n._getLocStr("InsertComment"),parentId:"ctxComment",spriteCssClass:"e-icon e-ss-newcmnt"},{id:"ctxEditCmnt",text:n._getLocStr("EditComment"),parentId:"ctxComment",spriteCssClass:"e-icon e-ss-editcmnt"},{id:"ctxDeleteCmnt",text:n._getLocStr("DeleteComment"),parentId:"ctxComment",spriteCssClass:"e-icon e-ss-deletecmnt"},{id:"ctxShwHdCmnt",text:n._getLocStr("ShowHide"),parentId:"ctxComment",spriteCssClass:"e-icon"},{id:"FormatCells",text:n._getLocStr("FormatCells")+"...",parentId:null,spriteCssClass:"e-icon e-ss-formatcells"},{id:"CmHyperLink",text:n._getLocStr("HyperLink"),parentId:null,spriteCssClass:"e-icon e-ss-hyperlink"},{id:"HyperLink",text:n._getLocStr("HyperLink")+"...",parentId:"CmHyperLink",spriteCssClass:"e-icon e-ss-hyperlink"},{id:"EditLink",text:n._getLocStr("EditLink")+"...",parentId:"CmHyperLink"},{id:"OpenLink",text:n._getLocStr("OpenLink"),parentId:"CmHyperLink"},{id:"RemoveLink",text:n._getLocStr("RemoveLink"),parentId:"CmHyperLink",spriteCssClass:"e-icon e-ss-removelink"},{id:"ClearContents",text:n._getLocStr("ClearContents"),parentId:null,spriteCssClass:"e-icon e-ss-clear"}];this._rowHeaderMenuData=this._columnHeaderMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"Paste",text:n._getLocStr("Paste"),parentId:null,spriteCssClass:"e-icon e-ss-paste"},{id:"PasteSpecial",text:n._getLocStr("PasteSpecial"),parentId:"Paste"},{id:"PasteValues",text:n._getLocStr("PasteValues"),parentId:"Paste"},{id:"Insert",text:n._getLocStr("Insert"),parentId:null},{id:"Delete",text:n._getLocStr("Delete"),parentId:null},{id:"ClearContents",text:n._getLocStr("ClearContents"),parentId:null,spriteCssClass:"e-icon e-ss-clear"},{id:"Hide",text:n._getLocStr("Hide"),parentId:null},{id:"Unhide",text:n._getLocStr("Unhide"),parentId:null}];this._footerMenuData=[{id:"InsertSheet",text:n._getLocStr("InsertSheet"),parentId:null},{id:"DeleteSheet",text:n._getLocStr("DeleteSheet"),parentId:null,spriteCssClass:"e-icon e-ss-delete"},{id:"RenameSheet",text:n._getLocStr("RenameSheet"),parentId:null,spriteCssClass:"e-icon "},{id:"MoveorCopy",text:n._getLocStr("MoveorCopy")+"...",parentId:null,spriteCssClass:"e-icon "},{id:"HideSheet",text:n._getLocStr("HideSheet"),parentId:null,spriteCssClass:"e-icon "},{id:"UnhideSheet",text:n._getLocStr("UnhideSheet"),parentId:null,spriteCssClass:"e-icon "},{id:"ProtectSheet",text:n._getLocStr("Protectsheet"),parentId:null,spriteCssClass:"e-icon e-ss-cmenuprotect"}];this._chartMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"ChartType",text:n._getLocStr("ChangeChartType")+"...",parentId:null},{id:"SelectData",text:n._getLocStr("SelectData")+"...",parentId:null}];this._imgMenuData=[{id:"Cut",text:n._getLocStr("Cut"),parentId:null,spriteCssClass:"e-icon e-ss-cut"},{id:"Copy",text:n._getLocStr("Copy"),parentId:null,spriteCssClass:"e-icon e-ss-copy"},{id:"ChangePicture",text:n._getLocStr("ChangePicture"),parentId:null}];this._pivotMenuData=[{id:"Refresh",text:n._getLocStr("Refresh"),parentId:null,spriteCssClass:"e-icon e-ss-pivotrefresh"}];this._protectRowMenuIds=["Insert","Delete","Filter","ctxComment","Sort","LockCells","CmHyperLink","FormatCells","ClearContents"];this._prtctHeaderIds=["Insert","Delete","Hide","Unhide","ClearContents"];this._footerIds=["InsertSheet","DeleteSheet","RenameSheet","MoveorCopy","HideSheet","UnhideSheet"]};t.Menu.prototype._calculateContextMenuPosition=function(t){var e=this.element.get(0).id,u=this.element.data("id"),f=n("#"+u).data("ejSpreadsheet"),i,r;return locationX=t.clientX+this.element.width()<n(window).width()?t.pageX:t.pageX-this.element.width(),i=f&&e.indexOf(u+"_contextMenuFooter")>-1?f.element.height():n(window).height(),locationY=t.clientY+this.element.height()<i?t.pageY:t.clientY>this.element.height()?t.pageY-this.element.height():i-this.element.outerHeight(),r=n("body").css("position")!="static"?n("body").offset():{left:0,top:0},locationX-=r.left,locationY-=r.top,{X:locationX,Y:locationY}};t.spreadsheetFeatures.contextmenu.prototype={_initContextMenu:function(){var n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none",width:"auto"},{id:this.XLObj._id+"_contextMenuCell"});this._createMenu(n,this.XLObj._phoneMode||this.XLObj._tabMode?this._rowCellMenuDataMobile:this._rowCellMenuData,"#"+this.XLObj._id+" .e-spreadsheetcontentcontainer");n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none"},{id:this.XLObj._id+"_contextMenuColumnHeader"});this._createMenu(n,this._columnHeaderMenuData,"#"+this.XLObj._id+" .e-spreadsheetheader .e-headercontent");n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none"},{id:this.XLObj._id+"_contextMenuRowHeader"});this._createMenu(n,this._rowHeaderMenuData,"#"+this.XLObj._id+" .e-rowheadercontent")},_initCMenuFooter:function(){var n=t.buildTag("ul .e-spreadsheet e-"+this._uniqueClass," ",{display:"none"},{id:this.XLObj._id+"_contextMenuFooter"});n.data("id",this.XLObj._id);this._createMenu(n,this._footerMenuData,"#"+this.XLObj._id+" .e-pagercontainer")},_createMenu:function(i,r,u){i.ejMenu({fields:{dataSource:r,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.ContextMenu,openOnClick:!1,beforeOpen:n.proxy(this._beforeOpen,this),close:n.proxy(this._menuClose,this),click:n.proxy(this._menuClick,this),contextMenuTarget:u})},hideCMenu:function(){var t=this.XLObj;t.model.enableContextMenu&&(n("#"+t._id+"_contextMenuCell").data("ejMenu").element.hide(),n("#"+t._id+"_contextMenuColumnHeader").data("ejMenu").element.hide(),n("#"+t._id+"_contextMenuRowHeader").data("ejMenu").element.hide(),n("#"+t._id+"_contextMenuFooter").data("ejMenu").element.hide())},_getCMenuObj:function(i){var r=this.XLObj;switch(i){case t.Spreadsheet.ContextMenu.Cell:return n("#"+r._id+"_contextMenuCell").data("ejMenu");case t.Spreadsheet.ContextMenu.RowHeader:return n("#"+r._id+"_contextMenuRowHeader").data("ejMenu");case t.Spreadsheet.ContextMenu.ColumnHeader:return n("#"+r._id+"_contextMenuColumnHeader").data("ejMenu");case t.Spreadsheet.ContextMenu.Footer:return n("#"+r._id+"_contextMenuFooter").data("ejMenu")}},addItem:function(t,i,r,u){if(t&&!this.XLObj.model.isReadOnly){var c=this._getCMenuObj(t),s=!1,f,e,h,o;f=n.extend(!0,[],c.model.fields.dataSource);switch(r){case"insert":n.merge(f,i);s=!0;break;case"insertbefore":for(e=i.length,o=u-1||0;e>0;)f.splice(o,0,i[e-1]),e--;s=!0;break;case"insertafter":for(e=i.length,h=0,o=u||f.length;h<e;)f.splice(o,0,i[h]),h++,o++;s=!0}s&&this.changeDataSource(t,f)}},removeItem:function(t,i){if(t&&!this.XLObj.model.isReadOnly){var e=this._getCMenuObj(t),r,u,f=[];for(u=n.extend(!0,[],e.model.fields.dataSource),r=0,length=u.length;r<length;r++)i.indexOf(r+1)==-1&&f.push(u[r]);this.changeDataSource(t,f)}},enableItem:function(n,t){if(n&&!this.XLObj.model.isReadOnly){var r=this._getCMenuObj(n),i;if(t&&t.length>0)for(i=0,length=t.length;i<length;i++)r.enableItemByID(r.element.find("li:eq("+(t[i]-1)+")")[0].id);else r.enable()}},disableItem:function(n,t){if(n&&!this.XLObj.model.isReadOnly){var r=this._getCMenuObj(n),i;if(t&&t.length>0)for(i=0,length=t.length;i<length;i++)r.disableItemByID(r.element.find("li:eq("+(t[i]-1)+")")[0].id);else r.disable()}},changeDataSource:function(n,i){if(n&&!this.XLObj.model.isReadOnly&&i){var r=this._getCMenuObj(n);this._changedDataSource=!0;switch(n){case t.Spreadsheet.ContextMenu.Cell:this._rowCellMenuDataMobile=this._rowCellMenuData=i;break;case t.Spreadsheet.ContextMenu.RowHeader:this._headerMenuDataMobile=this._rowHeaderMenuData=i;break;case t.Spreadsheet.ContextMenu.ColumnHeader:this._headerMenuDataMobile=this._columnHeaderMenuData=i;break;case t.Spreadsheet.ContextMenu.Footer:this._footerMenuData=i}r&&r.option("fields",{dataSource:i})}},_updateContextMenuItems:function(i){var r=this.XLObj,d,g,ht=n("#"+r._id+"_contextMenuColumnHeader").data("ejMenu"),ct=n("#"+r._id+"_contextMenuRowHeader").data("ejMenu"),ut,nt=i[0],h=r.getActiveSheetIndex(),v=r.getSheet(h),st=!t.isNullOrUndefined(r.getActiveCellElem())&&r.getActiveCellElem().length>0?r.getActiveCellElem():i,f=r._phoneMode||r._tabMode?this._rowCellMenuDataMobile:this._rowCellMenuData,u=n("#"+r._id+"_contextMenuCell").data("ejMenu"),e=n("#"+r._id+"_contextMenuFooter").data("ejMenu"),a=r.getActiveCell(h),ft,c,s,et,it,b,p,ot,k,rt,o;if(i.hasClass("e-rowcell")||i.hasClass("e-hyperlinks")){var l,y=[],lt=r._getJSSheetHeader(h).find("th"),at=r._getJSSheetRowHeader(h).find("td"),tt=r.XLEdit.getPropertyValue(v._activeCell.rowIndex,v._activeCell.colIndex),w=r._getCellIdx(r._hasClass(i,"e-hyperlinks")?i.parents("td")[0]:nt);if(this._isMenuOpened=!0,r.model.allowLockCell&&v.isSheetProtected&&r.XLEdit.getPropertyValue(w.rowIndex,w.colIndex,"isLocked",h))this._disableMenuOpt(this._protectRowMenuIds);else{if(i.hasClass("e-hyperlinks")&&(i=i.parents("td"),nt=i[0]),r.model.allowHyperlink?(this._enableMenuOpt(["CmHyperLink"]),et=r.XLEdit.getPropertyValue(w.rowIndex,w.colIndex,"hyperlink",h),it=["EditLink","OpenLink","RemoveLink"],t.isNullOrUndefined(et)?(this._disableMenuOpt(it),this._enableMenuOpt(["HyperLink"])):(this._enableMenuOpt(it),this._disableMenuOpt(["HyperLink"]))):this._disableMenuOpt(["CmHyperLink"]),r.model.allowFiltering){if(u.enableItemByID("Filter"),s=r.model.sheets[h].filterSettings.tableRange,b=r.getCell(a.rowIndex,a.colIndex,h)[0],s.length>0){for(ft=b.className.indexOf("e-table")>-1?b.className[b.className.indexOf("e-table")+7]:-1,p=0,ot=s.length;p<ot;p++)if(s[p].tableID===parseInt(ft)){c=p;break}!t.isNullOrUndefined(c)&&a.rowIndex<s[c].selectedRange.endRow+1&&a.rowIndex>s[c].selectedRange.startRow-2&&a.colIndex<s[c].multifilterIdx[s[c].multifilterIdx.length-1]+1&&a.colIndex>s[c].multifilterIdx[0]-1&&(d=r.getCell(s[c].selectedRange.startRow-1,a.colIndex,h).find("span"),d.length&&d[0].className.indexOf("e-ssfiltered")>-1&&(u.enableItemByID("ClearFilter"),this._clrFltrEnable=!0))}this._clrFltrEnable||u.disableItemByID("ClearFilter")}else u.disableItemByID("Filter");r.model.allowInsert&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?u.enableItemByID("Insert"):u.disableItemByID("Insert");r.model.allowDelete&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?u.enableItemByID("Delete"):u.disableItemByID("Delete");(r.XLClipboard._copyBackup.cells||r.XLClipboard._copyBackup.elem)&&!r.model.isReadOnly?(this._enableMenuOpt(["Paste"]),r.isPasteValuesOnly&&u.disableItemByID("PasteSpecial")):this._disableMenuOpt(["Paste"]);r.model.allowSorting?this._enableMenuOpt(["Sort"]):this._disableMenuOpt(["Sort"]);r.model.allowClear?this._enableMenuOpt(["ClearContents"]):this._disableMenuOpt(["ClearContents"]);r.model.allowCellFormatting?this._enableMenuOpt(["FormatCells"]):this._disableMenuOpt(["FormatCells"]);r._phoneMode||r._tabMode||(y=!t.isNullOrUndefined(tt)&&n.isNumeric(tt)?[r._getLocStr("SortSmallesttoLargest"),r._getLocStr("SortLargesttoSmallest")]:t.isNullOrUndefined(t.parseDate(tt))?[r._getLocStr("SortAtoZ"),r._getLocStr("SortZtoA")]:[r._getLocStr("SortOldesttoNewest"),r._getLocStr("SortNewesttoOldest")],r.model.allowComments?(u.element.find("#ctxComment").hasClass("e-disable-item")&&this._enableMenuOpt(["ctxComment"]),k=r.getSheetElement(r.getActiveSheetIndex()).find(".e-selected"),rt=k.length>1?st:i,rt.hasClass("e-commentcell")?(this._disableMenuOpt(["ctxInsrtCmnt"]),r.XLEdit.getPropertyValueByElem(rt,"comment").isVisible?(l=n.extend(f[19],{text:r._getLocStr("HideComment")}),u.remove(["#"+f[19].id]),u.insert([l],"#"+f[15].id)):(l=n.extend(f[19],{text:r._getLocStr("ShowHide")}),u.remove(["#"+f[19].id]),u.insert([l],"#"+f[15].id)),this._enableMenuOpt(["ctxEditCmnt","ctxDeleteCmnt","ctxShwHdCmnt"])):(this._enableMenuOpt(["ctxInsrtCmnt"]),this._disableMenuOpt(["ctxEditCmnt","ctxDeleteCmnt","ctxShwHdCmnt"])),k.filter(nt).length>0&&k.filter(".e-commentcell").length>0&&this._enableMenuOpt(["ctxDeleteCmnt"])):this._disableMenuOpt(["ctxComment"]),f[11].text!==y[0]&&(l=n.extend(f[11],{text:y[0],spriteCssClass:f[11].sprite}),u.remove(["#"+f[11].id]),u.insertBefore([l],"#"+f[13].id)),f[12].text!==y[1]&&(l=n.extend(f[12],{text:y[1],spriteCssClass:f[12].sprite}),u.remove(["#"+f[12].id]),u.insertBefore([l],"#"+f[13].id)));r.model.showRibbon&&r.XLRibbon._dirtySelect(r._getContent(r.getActiveSheetIndex()).find(".e-selected"))}r.model.allowInsert?e.enableItemByID("InsertSheet"):e.disableItemByID("InsertSheet");r.model.allowDelete?e.enableItemByID("DeleteSheet"):e.disableItemByID("DeleteSheet");r.model.allowClipboard?this._enableMenuOpt(["Cut","Copy"]):this._disableMenuOpt(["Cut","Copy"]);(r.XLClipboard._copyBackup.cells||r.XLClipboard._copyBackup.elem)&&!r.model.isReadOnly?this._enableMenuOpt(["Paste"],o):this._disableMenuOpt(["Paste"],o)}else if(i.hasClass("e-link")){if(g=e.model.fields.dataSource.slice(0),r._isSheetRename&&!r._updateSheetNames()){args.cancel=!0;return}ut=r.model.allowLockCell&&v.isSheetProtected?r._getLocStr("Unprotect"):r._getLocStr("Protectsheet");g[6].text=ut;e.option("fields",{id:"id",dataSource:g,parentId:"parentId"});this._isMenuOpened=!0;r._isCommentEdit&&r.XLComment._updateCurCmntVal();i.not("a.e-currentitem, a.e-PP, a.e-NP").hasClass("e-numericitem")&&r.gotoPage(i.data("index"));r.model.exportSettings.password?this._disableMenuOpt(this._footerIds,"contextMenuFooter"):(r._getSheetNames(!1).length>0?e.enableItemByID("UnhideSheet"):e.disableItemByID("UnhideSheet"),r._getSheetNames(!0).length>1?(e.enableItemByID("DeleteSheet"),e.enableItemByID("HideSheet"),e.enableItemByID("MoveorCopy")):(e.disableItemByID("DeleteSheet"),e.disableItemByID("HideSheet"),e.disableItemByID("MoveorCopy")));r.model.allowLockCell?e.enableItemByID("ProtectSheet"):e.disableItemByID("ProtectSheet")}else(i.hasClass("e-headercelldiv")||i.hasClass("e-headercell")||i.hasClass("e-rowheader"))&&(o=i.hasClass("e-rowheader")?"contextMenuRowHeader":"contextMenuColumnHeader",r.model.allowClipboard?this._enableMenuOpt(["Cut","Copy"],o):this._disableMenuOpt(["Cut","Copy"],o),(r.XLClipboard._copyBackup.cells||r.XLClipboard._copyBackup.elem)&&!r.model.isReadOnly?this._enableMenuOpt(["Paste"],o):this._disableMenuOpt(["Paste"],o),r.model.allowLockCell&&v.isSheetProtected?this._disableMenuOpt(this._prtctHeaderIds,o):(r.model.allowClear?this._enableMenuOpt(["ClearContents"],o):this._disableMenuOpt(["ClearContents"],o),r.model.allowInsert&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?this._enableMenuOpt(["Insert"],o):this._disableMenuOpt(["Insert"],o),r.model.allowDelete&&r.model.scrollSettings.allowScrolling&&r.model.scrollSettings.scrollMode!==t.Spreadsheet.scrollMode.Normal?this._enableMenuOpt(["Delete"],o):this._disableMenuOpt(["Delete"],o),this._enableMenuOpt(["Hide","Unhide"],o)),r.model.showRibbon&&r.XLRibbon._dirtySelect(r._getContent(r.getActiveSheetIndex()).find(".e-selected")));r.model.allowInsert&&t.isNullOrUndefined(r.model.exportSettings.password)?this._enableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter"):this._disableMenuOpt(["InsertSheet","MoveorCopy"],"contextMenuFooter");r.model.exportSettings.password?this._disableMenuOpt(["RenameSheet"]):this._enableMenuOpt(["RenameSheet"]);r.model.allowDelete&&r._getSheetNames(!0).length>1?this._enableMenuOpt(["DeleteSheet"],"contextMenuFooter"):this._disableMenuOpt(["DeleteSheet"],"contextMenuFooter");r.model.allowEditing?this._enableMenuOpt(["RenameSheet"],"contextMenuFooter"):this._disableMenuOpt(["RenameSheet"],"contextMenuFooter");r.model.isReadOnly&&(this._disableMenuOpt(["Cut","Insert","Delete","ClearContents"],"contextMenuColumnHeader"),this._disableMenuOpt(["Cut","Insert","Delete","ClearContents"],"contextMenuRowHeader"),this._disableMenuOpt(["Cut","Insert","Delete","Filter","Sort","ctxComment","FormatCells","CmHyperLink","ClearContents"],"contextMenuCell"))},_beforeOpen:function(i){var r=this.XLObj,s=r.XLResize,v,w,c,l;if(!r.model.enableContextMenu||i.events.type=="mousedown"&&i.target.id.indexOf("_picture")>-1||n(i.target).hasClass("e-numericitem")&&r.model.isReadOnly)return i.cancel=!0,!1;this._clrFltrEnable=!1;this.hideCMenu();var y=n("#"+r._id+"_contextMenuColumnHeader").data("ejMenu"),p=n("#"+r._id+"_contextMenuRowHeader").data("ejMenu"),a=i.target,b={target:a},u=n(a),o=r.getActiveSheetIndex(),h=r.getSheet(o),k=!t.isNullOrUndefined(r.getActiveCellElem())&&r.getActiveCellElem().length>0?r.getActiveCellElem():u,f=r._phoneMode||r._tabMode?this._rowCellMenuDataMobile:this._rowCellMenuData,e=n("#"+r._id+"_contextMenuCell").data("ejMenu"),d=n("#"+r._id+"_contextMenuFooter").data("ejMenu"),g=r.getActiveCell(o);r._trigger("beforeOpen",b)||((r.XLEdit._isEdit||r.model.allowComments&&r.XLComment._isCommentEdit||u.hasClass("e-filterspan")||i.events.which===1&&u.hasClass("e-hyperlinks")||u.parents("div").hasClass("e-vscroll")||u.parents("div").hasClass("e-hscroll")||n(a.parentNode).hasClass("e-pagercontainer")&&!u.hasClass("e-link")||!t.isNullOrUndefined(r.XLResize)&&r.XLResize._resizeStart||i.target.id.indexOf("Sheet_RenamePanel")>-1||u.parents().hasClass("e-grid")||u.hasClass("e-autofill"))&&(i.cancel=!0),s&&s._preventColResize(u.parent()[0].cellIndex,!0)&&u.hasClass("e-headercelldiv")&&(i.cancel=!0),s&&s._preventRowResize(parseInt(u.parent().attr("idx")),!0)&&u.hasClass("e-rowheader")&&(i.cancel=!0),u.hasClass("e-rowcell")||u.hasClass("e-hyperlinks")?(v=r._getJSSheetHeader(o).find("th"),w=r._getJSSheetRowHeader(o).find("td"),t.isNullOrUndefined(r.XLEdit.getPropertyValueByElem(r.getCell(h._activeCell.rowIndex,h._activeCell.colIndex),"range"))?n(v[u.index()]).hasClass("e-colselected")||n(w[u.parent().index()]).hasClass("e-rowselected")?(f=n(v[u.index()]).hasClass("e-colselected")?this._columnHeaderMenuData:this._rowHeaderMenuData,JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&this._changedDataSource&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"})):JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"}):(c=r.model.sheets[o].rangeSettings[r.XLEdit.getPropertyValueByElem(r.getCell(h._activeCell.rowIndex,h._activeCell.colIndex),"range")],e.option("fields",{dataSource:c.contextMenuSettings.dataSource,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"}),e.option("width",c.contextMenuSettings.width),e.option("height",c.contextMenuSettings.height))):u.hasClass("e-ss-imgvisual")||u.hasClass("e-ss-object")||u.closest("div").hasClass("e-ss-object")?(l=n.extend(!0,[],this._chartMenuData),this._isMenuOpened=!0,l=this.XLObj.model.showRibbon?this._chartMenuData:l.splice(0,2),f=r.XLShape._shapeType==="chart"?l:this._imgMenuData,JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"})):u.hasClass("e-ss-pivot")||u.closest("div").hasClass("e-ss-pivot")?(f=this._pivotMenuData,JSON.stringify(f)!==JSON.stringify(i.model.fields.dataSource)&&e.option("fields",{dataSource:f,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"})):(u.hasClass("e-headercelldiv")||u.hasClass("e-headercell")||u.hasClass("e-rowheader"))&&(r._phoneMode||r._tabMode?(y.option("fields",{dataSource:this._headerMenuDataMobile}),p.option("fields",{dataSource:this._headerMenuDataMobile})):this._changedDataSource&&(y.option("fields",{dataSource:this._columnHeaderMenuData}),p.option("fields",{dataSource:this._rowHeaderMenuData}))),this._changedDataSource||this._updateContextMenuItems(u),i.cancel&&(this._isMenuOpened=!1))},_menuClick:function(n){this.XLObj._trigger("contextMenuClick",n)||this._processCMenu(n.ID,n.events.element)},_menuClose:function(){this._isMenuOpened=!1},_processCMenu:function(i,r){var k,f,u=this.XLObj,e=u.getActiveSheetIndex(),a,v,s=u.getSheet(e),y,p,h,c,o=s._selectedCells,w,b,l;switch(i){case"Cut":u.XLClipboard.cut();break;case"Copy":u.XLClipboard.copy();break;case"PasteSpecial":case"PasteValues":u.XLClipboard._isSpecial=!(i==="PasteValues");u.XLClipboard.paste();break;case"Insert":u._insDelStatus="insert";s._isColSelected?(h=u._getJSSheetHeader(e).find(".e-colhighlight"),u.insertEntireColumn(h[0].cellIndex,h[h.length-1].cellIndex)):s._isRowSelected?(c=u._getJSSheetRowHeader(e).find(".e-rowhighlight"),a=u._getCellIdx(c[0]),v=u._getCellIdx(c[c.length-1]),u.insertEntireRow(a.rowIndex,v.rowIndex)):u._showDialog(u._id+"_Ribbon_Others_Cells_InsertCellOptions");break;case"Delete":h=n(u._getJSSheetHeader(e).find("tr")[0]).find(".e-colselected");c=n(u.getRows(e)[0]).find(".e-rowselected");r.parentElement.id.indexOf("ColumnHeader")>-1||s._isColSelected?(h=u._getJSSheetHeader(e).find(".e-colhighlight"),u.deleteEntireColumn(h[0].cellIndex,h[h.length-1].cellIndex,[])):r.parentElement.id.indexOf("RowHeader")>-1||s._isRowSelected?(c=u._getJSSheetRowHeader(e).find(".e-rowhighlight"),a=u._getCellIdx(c[0]),v=u._getCellIdx(c[c.length-1]),u.deleteEntireRow(a.rowIndex,v.rowIndex,[])):u._showDialog(u._id+"_Ribbon_Others_Cells_DeleteCellOptions");break;case"FilterSelected":u._showDialog(u._id+"_Ribbon_Data_SortFilter_Filter");u.XLFilter.filterByActiveCell();this._clrFltrEnable=!1;break;case"ClearFilter":y=u.getActiveCell(e);w=u.XLEdit.getPropertyValue(y.rowIndex,y.colIndex,"tableName");b=t.isNullOrUndefined(w)?-1:parseInt(w.replace("table",""));b>-1?(p=u.model.sheets[e].columns[y.colIndex].field,u.XLFilter._clearFilterColumn(p,"","","","","",b),delete u._excelFilter._predicates[e][p]):u.XLFilter.clearFilter("apply");this._clrFltrEnable=!1;break;case"SortAtoZ":case"SortZtoA":case"SortSmallesttoLargest":case"SortLargesttoSmallest":case"SortOldesttoNewest":case"SortNewesttoOldest":case"PutCellColor":case"PutFontColor":u.model.allowSorting&&u.XLSort._sortHandler(i);break;case"ClearContents":l=u.model.sheets[e].selectedRange;u.clearContents(u._getAlphaRange(e,l[0],l[1],l[2],l[3]));break;case"InsertSheet":u.insertSheet();break;case"DeleteSheet":u.deleteSheet(e);break;case"RenameSheet":u._renameSheet();break;case"MoveorCopy":u._showDialog(u._id+"_MoveorCopy");break;case"Hide":s._isColSelected&&u._hideColumn(o[0].colIndex,o[o.length-1].colIndex);s._isRowSelected&&u._hideRow(o[0].rowIndex,o[o.length-1].rowIndex,"isRHide");break;case"Unhide":s._isColSelected&&u._showColumn(o[0].colIndex,o[o.length-1].colIndex);s._isRowSelected&&u._showRow(o[0].rowIndex,o[o.length-1].rowIndex,"isRHide");break;case"HyperLink":case"EditLink":u._showDialog(u._id+"_Ribbon_Insert_Links_Hyperlink");break;case"RemoveLink":u._removeHyperlink();break;case"OpenLink":u._openLink();break;case"ctxInsrtCmnt":u._dupDetails=!0;u.XLComment.setComment();u._dupDetails=!1;break;case"ctxEditCmnt":u.XLComment.editComment();break;case"ctxDeleteCmnt":u.XLComment.deleteComment();break;case"ctxShwHdCmnt":u.XLComment.showHideComment();break;case"ChangePicture":u._uploadImage=!0;u.XLShape._changePicture=!0;u.element.find("#"+u._id+"_file .e-uploadinput").click();break;case"ChartType":u._showDialog(u._id+"_Ribbon_ChartDesign_Type_ChangeChartType");u.XLRibbon._refreshChartTypeDlg();break;case"SelectData":u._showDialog(u._id+"_Ribbon_ChartDesign_Data_SelectData");k=document.getElementById(u._id+"_chart").value;f=u.XLChart._getShapeObj(k,"chart");n("#"+u._id+"_crxaxis").val(f.xRange?u._getAlphaRange(e,f.xRange[0],f.xRange[1],f.xRange[2],f.xRange[3]):"");n("#"+u._id+"_cryaxis").val(f.yRange?u._getAlphaRange(e,f.yRange[0],f.yRange[1],f.yRange[2],f.yRange[3]):"");n("#"+u._id+"_crlaxis").val(f.lRange?u._getAlphaRange(e,f.lRange[0],f.lRange[1],f.lRange[2],f.lRange[3]):"");u._selectDataval={xRange:n("#"+u._id+"_crxaxis").val(),yRange:n("#"+u._id+"_cryaxis").val(),lRange:n("#"+u._id+"_crlaxis").val()};n("#"+u._id+"_chartrangedlg").ejDialog("open");break;case"HideSheet":u.hideSheet();break;case"UnhideSheet":u._showDialog(u._id+"_UnhideSheet");break;case"ProtectSheet":u.protectSheet(!s.isSheetProtected);break;case"FormatCells":u._showDialog(u._id+"_FormatCells");break;case"Refresh":u.XLPivot.refreshDataSource();break;case"BackgroundColor":n("#"+this.XLObj._id+"_colordlg").ejDialog("open");this._selColor={action:"bg-color",color:""};break;case"FontColor":n("#"+this.XLObj._id+"_colordlg").ejDialog("open");this._selColor={action:"color",color:""}}},_disableMenuOpt:function(t,i){var e=i||"contextMenuCell",u=n("#"+this.XLObj._id+"_"+e).data("ejMenu"),r,f;if(u)for(r=0,f=t.length;r<f;r++)u.disableItemByID(t[r])},_enableMenuOpt:function(t,i){var e=i||"contextMenuCell",u=n("#"+this.XLObj._id+"_"+e).data("ejMenu"),r,f;if(u)for(r=0,f=t.length;r<f;r++)u.enableItemByID(t[r])},_initColorDialog:function(){var r=this.XLObj,i=r._id+"_colordlg";if(!n("#"+i).length){var u=t.buildTag("div#"+i+".e-colordlg e-"+r._id+"-dlg ","",{display:"none"}),f=t.buildTag("div#"+i+"_dlgcontent .e-colordlgcontent"),h=t.buildTag("input#"+i+"_cpicker"),c=t.buildTag("div#"+i+"_condiv .e-dlg-btnctnr"),e=t.buildTag("input#"+this._id+"_dialog_Ok"),o=t.buildTag("input#"+this._id+"_dialog_Can","",{"margin-left":10}),s=t.buildTag("div#"+i+"_dlgbtncontent .e-dlg-btnfields");f.append(h);u.append(f);r.element.append(u);u.ejDialog({showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,title:r._getLocStr("ColorPicker"),width:"240",height:"auto",minHeight:0,cssClass:"e-ss-dialog e-"+r._id+"-dlg"});n("#"+i+"_cpicker").ejColorPicker({value:"#278787",modelType:"palette",presetType:"basic",cssClass:"e-ss-colorpicker e-ss-menuclrpkr",select:n.proxy(this._cpClickHandler,this),showApplyCancel:!1});n("#"+i+"_cpickerWrapper").hide();f.append(n("#"+i+"_cpicker_popup").css("display","block"));e.ejButton({text:r._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._colorOkClick,this),enabled:!0});o.ejButton({text:r._getLocStr("Cancel"),showRoundedCorner:!0,width:60,click:t.proxy(this._colorCanClick,this)});s.append(c.append(e,o));u.append(s)}},_cpClickHandler:function(n){this._selColor.color=n.value},_colorOkClick:function(){var t=this.XLObj;t.XLFormat.format({style:this._selColor.action==="bg-color"?{"background-color":this._selColor.color}:{color:this._selColor.color}});t.setSheetFocus();n("#"+t._id+"_colordlg").ejDialog("close")},_colorCanClick:function(){n("#"+this.XLObj._id+"_colordlg").ejDialog("close")}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.sorting=function(n){this.XLObj=n;this._isSortByFilter=!1};t.spreadsheetFeatures.sorting.prototype={_sortHandler:function(n){var e,v,y,p,w,b,k,l,s,h,d,o,a={},g="",r={},i=this.XLObj,tt=i._formatRegx,c=i.getActiveSheetIndex(),u=i.getSheet(c),f=u._selectedCells,nt;if(g=u.columns[u._activeCell.colIndex].field,this._isSortByFilter=!1,n!="PutCellColor"&&n!="PutFontColor"){if(!i.model.allowSorting||!u._selectedCells.length)return;if(f.length===1&&i.selectAll(),b=n==="Ribbon_SortZtoA"||n==="SortZtoA"?t.sortOrder.Descending:t.sortOrder.Ascending,k=i.XLEdit.getPropertyValue(u._activeCell.rowIndex,u._activeCell.colIndex,"tableName",c)||"",l=i._getTableID(k),t.isNullOrUndefined(l)){if(r=u.selectedRange.slice(0),s=r[0],h=r[1],s===r[2])return;for(p=i.XLEdit.getPropertyValue(s,h),e=s+1;e<=r[2];e++)if(!i._isHiddenRow(e)){w=i.XLEdit.getPropertyValue(e,h);break}v=i.isNumber(p)?t.Spreadsheet.CellType.Number:t.Spreadsheet.CellType.String;y=i.isNumber(w)?t.Spreadsheet.CellType.Number:t.Spreadsheet.CellType.String;i.XLEdit.getPropertyValue(s,h,"merge")||i.XLEdit.getPropertyValue(e,h,"merge")||i.XLEdit.getPropertyValue(r[0],r[1],"calcValue")||(v!=y||i.XLEdit.getPropertyValue(r[0],r[1],"wrap")||i.XLEdit.getPropertyValue(r[0],r[1],"isFilterHeader"))&&r[0]++}else r=u.tableManager[l].range.slice(0),r[0]++;this.sortByRange(r,g,b)}else nt=f.length===1?this._selectSortRange(c,f[0]):u._startCell.rowIndex,d=i._getAlphaRange(c,nt,f[0].colIndex,f.length===1?f[0].rowIndex:u._endCell.rowIndex,f[0].colIndex),o=i.XLEdit.getPropertyValue(u._activeCell.rowIndex,u._activeCell.colIndex,"formats"),i.isUndefined(o)||(o["background-color"]&&(a["background-color"]=o["background-color"].toLowerCase()),o.color&&(a.color=o.color.toLowerCase()),this.sortByColor(n,a,d));f.length===1&&(i.XLSelection.selectRange(f[0],f[0],c),u._startCell=u._endCell=f[0],i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement())},_selectSortRange:function(n,t){for(var u=this.XLObj,r=u.getSheet(n).filterSettings.tableRange,i=0,f=r.length;i<f;i++)if(r[i].multifilterIdx.indexOf(t.colIndex)>-1&&t.rowIndex>r[i].startRow-1&&t.rowIndex<r[i].endRow+1)return r[i].startRow;return u.selectAll(),u.getSheet(n)._selectedCells[0].rowIndex},sortByColor:function(n,i,r){var f=this.XLObj;if(r=f._getRangeArgs(r,"object"),f.model.allowSorting&&!this._sortRangeAlert(r)&&!f.model.isReadOnly){var o=f.getActiveSheetIndex(),u={oprType:n},e,s,c=f.getSheet(o),h;h=c.columns[r[1]].field;t.isNullOrUndefined(i)||(n==="PutCellColor"?(i["background-color"]&&(i=i["background-color"]),u.operation="sortbgcolor",u.bgcolor=i):(i.color&&(i=i.color),u.operation="sortfgcolor",u.fgcolor=i),u.requestType=u.action="sortbycolor",u.sortColumn=h,u.selRange={startCell:{rowIndex:r[0],colIndex:r[1]},endCell:{rowIndex:r[2],colIndex:r[3]}},u.rangeData=f.getRangeDataAsObject(u.selRange.startCell,u.selRange.endCell,!0)[0],u.sortRange=r,e=r[0],t.isNullOrUndefined(e)||(s=f.XLFilter._createSelection(o,e,r[2],r[1],[]).endRowIndex,e=n==="PutCellColor"||n==="PutFontColor"?e:e,u.range=f.model.sheets[o]._selectedRange={startRow:e,endRow:s,dataSourceIndexes:[]},f._processBindings(u)))}},_getSortColorRange:function(n){var r=this.XLObj,i=r.getCell(n.rowIndex,n.colIndex),u=!1,s,t,e=0,h=!1,f=n.rowIndex,o=n.colIndex;if(i.text().length<1){for(t=f;t<f+2;t++)if(i=r.getCell(t,o),i.is(":visible")&&i.text().length>0){u=!0;e=t;break}if(!u){for(t=f;t>f-2;t--)t>-1&&(i=r.getCell(t,o),i.text().length===0&&t>0&&(i=r.getCell(t-1,o),i.text().length==0&&(h=!0)));if(!h)for(t=f-2;t>0;t--)if(i=r.getCell(t,o),i.is(":visible")&&i.text().length===0){s=t+1;u=!0;e=s;break}}}else for(t=f;t>=0;t--){if(i=r.getCell(t,o),i.is(":visible")&&i.text().length===0){s=t+1;u=!0;e=s;break}u||t!=0||(e=t,u=!0)}if(u)return e;r._showAlertDlg("Alert","Alert",null,630)},_sortRangeAlert:function(n){for(var u,s,t=this.XLObj,i=i?i:t.getActiveSheetIndex(),e,o=t.getSheet(i)._mergeColl,n=t._getRangeArgs(n,"object"),f=t.getObjectKeys(o),r=0,h=f.length;r<h;r++)for(cKeys=t.getObjectKeys(o[f[r]]),u=0,s=cKeys.length;u<s;u++)if(e=t._dataContainer.sheets[i][f[r]][cKeys[u]].merge,mRange=t.getRangeIndices(e.mRange),n[0]<=mRange[0]&&n[2]>=mRange[2]||n[0]>=mRange[0]&&n[2]<mRange[2])return t._showAlertDlg("Alert","MergeSortAlert","",380),!0;return t.XLEdit._rangeHasProperty(n,"calcValue")?(t._showAlertDlg("Alert","FormulaSortAlert","",315),!0):!1},sortByRange:function(n,i,r){var u=this.XLObj;if(u.model.allowSorting&&!u.model.isReadOnly){var c,l=u.getActiveSheetIndex(),o=0,a=[],f={},v=[],e,y,s,h=u._getJSSheetHeader(l).find(".e-colselected").length;if(u.model.allowSorting){if(n=u._getRangeArgs(n,"object"),this._sortRangeAlert(n))return!0;if(this._isSortByFilter&&h<1){for(s=this._isSortByFilter?n[0]-1:n[0],y=u._getAlphaRange(l,s,n[1],s+1,n[3]),e=u._getAlphaRangeCells(y).find(".e-filterspan"),c=e.length;o<c;)v.push({colIndex:e[o].parentNode.cellIndex,rowIndex:e.eq(o).parents("tr").index()}),o++;e.length&&(n[0]=this._isSortByFilter?n[0]:n[0]+1)}return a=u.getRangeDataAsObject({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]},!0)[0],f.requestType=t.Spreadsheet.Actions.Sorting,f.range=n,f.columnName=i,f.rangeData=a,f.action="sorting",f.sortDirection=r,f.filterIcon=v,f.isSortByFilter=this._isSortByFilter,f.colSelected=h,u._processBindings(f),h&&this._isSortByFilter&&u.XLFilter._changeSortIcon({rowIndex:n[0]-1,colIndex:n[1]},r),!1}}},_sortComplete:function(n){var t=this.XLObj,i=n.range,r=this._swapSortedDatas(n),u=r[1];t._dupDetails=!0;n.rangeData=r[0];t.model.allowComments&&t.XLComment.deleteComment(i,null,!0,"comment");t._removeHyperlink(null,null,!0,i);t.clearRangeData(i,["value","value2","type","formatStr","decimalPlaces","thousandSeparator","comment","hyperlink","format"],null,!0);t.model.allowCellFormatting&&t.XLFormat.removeStyle(i,{cellStyle:!0,tableStyle:!0,format:!0,skipHiddenRow:!0});t.XLEdit.updateCellWithContainer(u,i,null,!0);this._refreshRowHeight(i,u);t._dupDetails=!1},_refreshRowHeight:function(n,t){for(var i,u,f=0,s=0,r=this.XLObj,e=r._getSheetIndex(),o=r.getSheet(e),h=r._getJSSheetContent(e).find(".e-content"),c=r._getJSSheetRowHeaderContent(e);n[0]+f<=n[2];){for(i=n[0]+f,u=(f-s)*(n[3]-n[1]+1);o.hideRowsCollection.indexOf(i)>-1||o._hiddenFreezeRows.indexOf(i)>-1&&i<n[2];)i++&&f++&&s++;r.model.scrollSettings.allowVirtualScrolling||(h.find("tr:eq("+i+")").height(t[u].rheight),c.find("tr:eq("+i+")").height(t[u].rheight));t[u]&&(o.rowsHeightCollection[i]=t[u].rheight);f++}r.XLScroll._getRowHeights(e,i);r.model.scrollSettings.allowVirtualScrolling&&r.refreshContent(e);o._isFreezed&&r.XLFreeze._refreshFreezeRowDiv()},_swapSortedDatas:function(t){for(var a,u,f,o=0,e=0,v=0,y=[],s=[],h=[],c=this.XLObj.getSheet(),p=t.model.currentViewData,b=p.length,k=this.XLObj._generateColCount(t.columnName)-1,w,i=t.range,l=i[3]-i[1]+1,d=k-i[1],r=this.XLObj.getRangeData({range:i,property:["value","value2","type","formatStr","formats","decimalPlaces","thousandSeparator","range","format","comment","hyperlink","rule"],skipHiddenRow:!0});i[0]+e<=i[2];){for(rowIdx=i[0]+e,u=(e-v)*(i[3]-i[1]+1);(c.hideRowsCollection.indexOf(rowIdx)>-1||c._hiddenFreezeRows.indexOf(rowIdx)>-1)&&rowIdx<i[2];)rowIdx++&&e++&&v++;r[u]&&(r[u].rheight=c.rowsHeightCollection[rowIdx]);e++}for(n.extend(!0,y,r),s.push(y);o<b;){for(a=p[o][t.columnName],f=d,w=r.length;f<w;){if(r[f].value===a){u=this._getMinIdx(f,l);h=h.concat(r.splice(u,l));break}f+=l}o++}return s.push(h),s},_getMinIdx:function(n,t){var i,r;if(i=r=t,n<t)return 0;while(i<=n){if(r+=t,r>n)return i;i+=t}}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.dragAndDrop=function(n){this.XLObj=n;this._isDragAndDropStart=!1;this._dragAndDropCell={rowIndex:0,colIndex:0};this._isDragAndDropped=!1;this._allowDragAndDrop=!1;this._target=null;this._cellIdx={}};t.spreadsheetFeatures.dragAndDrop.prototype={moveRangeTo:function(n,t){this._moveRangeTo(n,t)},_moveRangeTo:function(i,r,u){var f=this.XLObj,g,e,o;if(f.model.allowDragAndDrop&&!f.model.isReadOnly&&f.model.allowEditing){var s,l,p,w,c,a,v,b,h,nt,k=[],d=[],tt=[],y;for(s=f.getActiveSheetIndex(),l=f.getSheet(s),i=f.swapRange(f._toIntrnlRange(i,s)),r=f.swapRange(f._toIntrnlRange(r,s)),r[2]=r[0]+(i[2]-i[0]),r[3]=r[1]+(i[3]-i[1]),c={rowIndex:r[0],colIndex:r[1]},a={rowIndex:r[2],colIndex:r[3]},p=f.getRangeData({range:i,property:u||["value","value2","type","formatStr","decimalPlaces","thousandSeparator","range","format","border","borders","comment","hyperlink","picture","cFormatRule","rule","chart","isLocked","wrap","formats","tformats","tborders","isFilterHeader","filterState","isFilterVisible","tableName"]}),f.model.allowCellFormatting&&(w=f.XLFormat.getHashCodeClassAsArray(i)),f.model.allowConditionalFormats&&(v=f.XLEdit.getPropertyValue(i[0],i[1],"cFormatRule")),!f.isUndefined(v)&&v.length>0&&(h=v[0].split("_"),v={action:h[0],inputs:[h[2],h[3]],color:h[4],range:h[5]}),e=i[0];e<=i[2];e++)for(k.push({rowIndex:e,height:l.rowsHeightCollection[e]}),o=i[1];o<=i[3];o++)f.XLEdit.getPropertyValue(e,o,"wrap")&&f.setWrapText("unwrap",f._getAlphaRange(s,e,o,e,o));if(details={sheetIndex:s,reqType:"reorder-cells",sourceData:n.extend(!0,[],p),sourceRange:i,destinationRange:r,sourceFormat:w,destinationFormat:f.model.allowCellFormatting&&f.XLFormat.getHashCodeClassAsArray(r),destinationData:f.getRangeData({range:r}),sourceCFormat:v,sourceHeight:k},f.XLRibbon._isDirtySelect){f._showAlertDlg("Alert","DragAlert",null,440);f.performSelection(i);return}if(isTable=f._checkTableRange(f._getAlphaRange(s,i[0],i[1],i[2],i[3])),y=f._checkFilterRange(f._getAlphaRange(s,i[0],i[1],i[2],i[3])),f._dupDetails=!0,isTable.status==="full")details.tblObj=isTable.tableObj,details.tblObj.tblId=isTable.tblId,details.tblObj.header=!0,f.XLFormat.removeTable(isTable.tblId),f.XLFormat.removeStyle(isTable.range);else if(y.status==="full")details.tRange=y.tRange,f.XLFilter.clearFilter("remove");else if(isTable.status==="partial"||y.status==="partial"||f.XLRibbon._isFilterSelect.isFiltered){f._showAlertDlg("Alert","DragAlert",null,440);f.performSelection(i);return}for(f.model.allowComments&&f.XLComment.deleteComment(),f.clearRangeData(i,u||["value2","value","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","isFilterHeader","filterState","isFilterVisible","tableName","rule","wrap","comment"]),f.clearRangeData(r,u||["value2","value","type","formatStr","decimalPlaces","thousandSeparator","hyperlink","rule","wrap","comment"]),t.isNullOrUndefined(f._ddlCell)||(f.element.find("#"+f._id+"ddl").ejDropDownList("hidePopup"),f.element.find("#"+f._id+"ddlspan").remove(),f._ddlCell=null),f.model.allowCellFormatting&&!f.XLRibbon._isDirtySelect&&(f.XLFormat.removeStyle(i),f.XLFormat.removeStyle(r,{cellStyle:!0,format:!0,border:!0})),f.model.allowConditionalFormats&&f.XLCFormat.clearCF(i,!0),p[0].cFormatRule=[],details.tblObj&&(details.tblObj.destrange=f._getAlphaRange(s,r[0],r[1],r[2],r[3]),f.XLClipboard._isCut=!0,f.XLFormat.createTable(details.tblObj,details.tblObj.destrange),f.XLClipboard._isCut=!1),f.updateData(p,r),y.tRange&&(f.XLFilter.filter(f._getAlphaRange(s,r[0],r[1],r[2],r[3])),f._dupDetails=!1),details.tblObj&&details.tblObj.totalRow&&f.XLFormat._updateTotalRow(s,details.tblObj.tblId,details.tblObj.fnNumber,r,!1),f.model.allowCellFormatting&&f.XLFormat.updateFormat(w,r),f.model.allowConditionalFormats&&!f.isUndefined(h)&&(nt=f._getAlphaRange(1,r[0],r[1],r[2],r[3]),b={action:h[0],inputs:[h[2],h[3]],color:h[4],range:nt},details.destinationCFormat=b,f.XLCFormat.setCFRule(b)),g=0,e=r[0];e<=r[2];e++)for(tt.push({rowIndex:e,height:l.rowsHeightCollection[e]}),d.push({rowIndex:f._getRowIdx(e),height:k[g].height}),g++,o=r[1];o<=r[3];o++)f.XLEdit.getPropertyValue(e,o,"wrap")&&(f.XLEdit._clearDataContainer({cellIdx:{rowIndex:e,colIndex:o},property:["wrap"]}),f.setWrapText("wrap",f._getAlphaRange(s,e,o,e,o)));f.setHeightToRows(d);details.destHeight=d;details.prevDestRowHt=tt;f.setActiveCell(c.rowIndex,c.colIndex);f.model.allowSelection&&(c.rowIndex||a.rowIndex!==l.rowCount-1?c.colIndex||a.colIndex!==l.colCount-1?f.XLSelection.selectRange(c,a):f.XLSelection.selectRows(c.rowIndex,a.rowIndex):f.XLSelection.selectColumns(c.colIndex,a.colIndex),l._isFreezed&&f.XLFreeze._refreshSelection());f._dupDetails=!1;f._isUndoRedo||!f.XLFormat||f.XLFormat._isFAT||(f._completeAction(details),f._trigActionComplete(details))}},_dMouseHover:function(n){var r,e,o,s,h,i,l,u,f,a=n.target,t=this.XLObj,v=t.getActiveSheetIndex(),c=t.getSheet(v).selectedRange;if(t._hasClass(a,"e-rowcell")&&(r=t._getCellIdx(a)),r&&t.inRange(c,r.rowIndex,r.colIndex)&&(r.rowIndex===c[0]||r.rowIndex===c[2]||r.colIndex===c[1]||r.colIndex===c[3])&&!t._isTouchEvt&&(i=n.target.getBoundingClientRect(),l=t._setXY(n),u=l[0],f=l[1],e=u-t.getFocusLeftElem().offset().left,e=e>=0&&e<=5,o=f-t.getFocusTopElem()[0].getBoundingClientRect().top,o=o>=0&&o<=5,s=t.getFocusRightElem().offset().left-u,s=s>=0&&s<=5,h=t.getFocusBottomElem()[0].getBoundingClientRect().top-f,h=h>=0&&h<=5,e&&u<=i.left+5&&u>=i.left||o&&f<=i.top+5&&f>=i.top||s&&u>=i.right-5&&u<=i.right||h&&f>=i.bottom-5&&f<=i.bottom)){t.addClass(a,"e-cursormove");this._isDragAndDropStart=!0;return}this._isDragAndDropStart&&!t._isTouchEvt&&(t._getContent(v).find(".e-cursormove").removeClass("e-cursormove"),this._isDragAndDropStart=!1)},_dragtouch:function(n,t){var r,u,f,e,i=this.XLObj;r=n-i.getFocusLeftElem().offset().left;u=t-i.getFocusTopElem().offset().top;f=i.getFocusRightElem().offset().left-n;e=i.getFocusBottomElem().offset().top-t;this._isDragAndDropStart=r>=-10&&r<=10||u>=-5&&u<=0||f>=-10&&f<=10||e>=-5&&e<=0?!0:!1},_dMouseDown:function(n){var t=this.XLObj,r,u,i;!t.model.isReadOnly&&t.model.allowEditing&&((u=t.getActiveSheetIndex(),i=t.getSheet(u),n.preventDefault(),n.stopImmediatePropagation(),r=t.swapRange([i._startCell.rowIndex,i._startCell.colIndex,i._endCell.rowIndex,i._endCell.colIndex]),n.target.nodeName==="TD"&&(this._dragAndDropCell=t._getCellIdx(n.target)),t._dStartCell={rowIndex:r[0],colIndex:r[1]},t._dEndCell={rowIndex:r[2],colIndex:r[3]},t._trigger("dragStart",{sheetIndex:u,target:n.target,currentCell:this._dragAndDropCell,dragAndDropRange:{startCell:i._startCell,endCell:i._endCell}}))||(this._allowDragAndDrop=!0))},_dMouseMove:function(n){if(this._allowDragAndDrop){var i=this.XLObj,e=i.getActiveSheetIndex(),t=i.getSheet(e),u=n.target,r=i._getCellIdx(u),f;if(i._isTouchEvt&&(f=i._getOriginalEvt(n),u=document.elementFromPoint(f.clientX,f.clientY),u.parentNode&&u.parentNode.attributes.getNamedItem("idx")&&(r=i._getCellIdx(u))),i._trigger("drag",{sheetIndex:e,target:u,currentCell:r,dragAndDropRange:{startCell:t._startCell,endCell:t._endCell}}))return;i._isFrozen(t.frozenRows)&&this._isDragAndDropped&&t._frozenRows-1<t._ftopRowIdx&&t._startCell.rowIndex>t._frozenRows-1&&r.rowIndex<t._frozenRows-1&&(r.rowIndex=t._ftopRowIdx);i._isFrozen(t.frozenColumns)&&this._isDragAndDropped&&t._frozenColumns-1<t._fleftColIdx&&t._startCell.colIndex>t._frozenColumns-1&&r.colIndex<t._frozenColumns-1&&(r.colIndex=t._fleftColIdx);this._cellIdx=r;i.XLSelection._focusBorder(t._startCell,t._endCell,i._thinBorder);this._updateDCells(r);t._isFreezed?this._refreshFocusRange():i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder)}else this.XLObj._isTouchEvt||this._dMouseHover(n)},_refreshFocusRange:function(){var t=this.XLObj,n=t.getSheet(),u=t._dEndCell.colIndex,f=t._dEndCell.rowIndex,i=t._dStartCell.colIndex,r=t._dStartCell.rowIndex;n._frozenRows-1<n._ftopRowIdx&&(n._startCell.rowIndex<n._frozenRows-1?f>=n._frozenRows-1&&(f<n._ftopRowIdx?f=n._frozenRows-2:f>n._ftopRowIdx&&r<n._ftopRowIdx&&(r=n._ftopRowIdx)):r=r<n._ftopRowIdx&&r>n._frozenRows-1?n._ftopRowIdx:t._dStartCell.rowIndex);n._frozenColumns-1<n._fleftColIdx&&(n._startCell.colIndex<n._frozenColumns-1?u>=n._frozenColumns-1&&(u<n._fleftColIdx?u=n._frozenColumns-2:u>n._fleftColIdx&&i<n._fleftColIdx&&(i=n._fleftColIdx)):i=i<n._fleftColIdx&&i>n._frozenColumns-1?n._fleftColIdx:t._dStartCell.colIndex);t.XLSelection._focusRange({rowIndex:r,colIndex:i},{rowIndex:f,colIndex:u},t._autofillBorder)},_dMouseUp:function(t){var f,s;if(this._isDragAndDropped){var i=this.XLObj,o=!0,u=i.getActiveSheetIndex(),r=i.getSheet(u),h=n("#vscrollBar").data("ejScrollBar"),c=n("#hscrollBar").data("ejScrollBar"),l=!1,e=[i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex],a={rowIndex:-1,colIndex:-1},v={sheetIndex:u,isAlert:!1,target:t.target,currCell:this._dragAndDropCell,dragAndDropRange:{startCell:r._startCell,endCell:r._endCell}},y=i._arrayAsString(i._thinBorder);if(i.model.scrollSettings.allowScrolling&&i._dEndCell.rowIndex>r.rowCount){for(f=0,s=i._dEndCell.rowIndex-i._dStartCell.rowIndex;f<s;f++)i.XLScroll._createNewRow(u,-1,-1,"insert");h._scrollData.step=1;h.scroll(r._scrollTop+(i._dEndCell.rowIndex-i._dStartCell.rowIndex)*r.rowHeight)}if(i._dEndCell.colIndex>r.colCount){for(f=0,s=i._dEndCell.colIndex-i._dStartCell.colIndex;f<s;f++)i.XLScroll._createNewColumn(u,a,a,"insert");c._scrollData.step=1;c.scroll(r._scrollLeft+(i._dEndCell.colIndex-i._dStartCell.colIndex)*r.columnWidth)}if(this._target=t.target,i._isUniqueRange(r.selectedRange,i.swapRange(e)))this._preventDrop(r);else{if(i.model.allowLockCell&&r.isSheetProtected&&i._isPropExists([e,r.selectedRange],"isLocked",u)&&(o=!1),o&&i._isPropExists([e,r.selectedRange],"isReadOnly",u)&&(o=!1),!o){this._preventDrop(r);i.XLSelection._clearBorder(y);this._allowDragAndDrop=this._isDragAndDropStart=this._isDragAndDropped=!1;return}l=i._trigger("beforeDrop",v);v.isAlert||l||!i._rangeHasData(e)?i._rangeHasData(e)?this._preventDrop(r):(this.moveRangeTo([r._startCell.rowIndex,r._startCell.colIndex,r._endCell.rowIndex,r._endCell.colIndex],[i._dStartCell.rowIndex,i._dStartCell.colIndex,i._dEndCell.rowIndex,i._dEndCell.colIndex]),r._startCell=i._dStartCell,r._endCell=i._dEndCell,r._isFreezed&&i.XLFreeze._refreshSelection()):i._showAlertDlg("","DropAlert","Drop",498)}i.XLSelection._clearBorder(y);i.model.allowAutoFill&&i.XLDragFill.positionAutoFillElement()}this._allowDragAndDrop=this._isDragAndDropStart=this._isDragAndDropped=!1},_scrollHover:function(t){var u,f,s,i=this.XLObj,h=i.getActiveSheetIndex(),r=i.getSheet(h),c=this._cellIdx.colIndex,l=this._cellIdx.rowIndex,a=i.XLScroll,e=a._vScroller(h),o=a._hScroller(h);n(t.target).parents(".e-vscrollbar").length>0?f=setInterval(function(){u=r._scrollLeft+(i._isFrozen(r.frozenColumns)?r.columnsWidthCollection[r._fleftColIdx]:r.columnWidth);o._scrollData.step=1;o.scroll(u);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:l,colIndex:r._rightCol.idx-1});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):t.target.className.indexOf("e-rowheader")>-1?f=setInterval(function(){u=r._scrollLeft-r.columnWidth;o._scrollData.step=-1;u>-1?o.scroll(u):o.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:l,colIndex:r._leftCol.idx});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):n(t.target).parents(".e-spreadsheetfooter").length>0||t.target.className.indexOf("e-spreadsheetfooter")>-1||n(t.target).parents(".e-hscrollbar").length>0?f=setInterval(function(){i.model.scrollSettings.allowVirtualScrolling?r._isVirtualEndReached?e.scroll(r._scrollTop):e.scroll(r._scrollTop+(i._isFrozen(r.frozenRows)?r.rowsHeightCollection[r._ftopRowIdx]:r.rowHeight)):(e._scrollData.step=1,e.scroll(r._scrollTop+(i._isFrozen(r.frozenRows)?r.rowsHeightCollection[r._ftopRowIdx]:r.rowHeight)));i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:r._bottomRow.idx-1,colIndex:c});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):t.target.className.indexOf("e-headercell")>-1?f=setInterval(function(){u=r._scrollTop-r.rowHeight;e._scrollData.step=-1;u>-1?e.scroll(u):e.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:r._topRow.idx,colIndex:c});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);return},200):t.target.className.indexOf("e-rowcell")>-1&&(s=i._getCellIdx(t.target),i._isFrozen(r.frozenRows)&&s.rowIndex<r._frozenRows-1&&r._startCell.rowIndex>=r._frozenRows-1&&(f=setInterval(function(){if(i._dStartCell.rowIndex>r._ftopRowIdx||!i.XLDragDrop._isDragAndDropped||r._frozenRows-1===r._ftopRowIdx){(i._dStartCell.colIndex>r._fleftColIdx||!i.XLDragDrop._isDragAndDropped||r._frozenColumns-1===r._fleftColIdx)&&clearInterval(f);return}u=r._scrollTop-r.rowHeight;e._scrollData.step=-1;u>-1?e.scroll(u):e.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:r._ftopRowIdx,colIndex:i.XLDragDrop._cellIdx.colIndex});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);i.XLDragDrop._refreshFocusRange();return},200)),i._isFrozen(r.frozenColumns)&&s.colIndex<r._frozenColumns-1&&r._startCell.colIndex>=r._frozenColumns-1&&(f=setInterval(function(){if(i._dStartCell.colIndex>r._fleftColIdx||!i.XLDragDrop._isDragAndDropped||r._frozenColumns-1===r._fleftColIdx){(i._dStartCell.rowIndex>r._ftopRowIdx||!i.XLDragDrop._isDragAndDropped||r._frozenRows-1===r._ftopRowIdx)&&clearInterval(f);return}u=r._scrollLeft-r.columnWidth;o._scrollData.step=-1;u>-1?o.scroll(u):o.scroll(0);i.XLSelection._focusBorder(r._startCell,r._endCell,i._thinBorder);i.XLDragDrop._updateDCells({rowIndex:i.XLDragDrop._cellIdx.rowIndex,colIndex:r._fleftColIdx});i.XLSelection._focusRange(i._dStartCell,i._dEndCell,i._autofillBorder);i.XLDragDrop._refreshFocusRange();return},200)));i._browserDetails.name==="msie"&&i._browserDetails.version==="8.0"?(t.target.attachEvent("onmouseleave",function(){clearInterval(f);return}),document.attachEvent("onmouseleave",function(){clearInterval(f);return}),t.target.attachEvent("onmouseup",function(){clearInterval(f);return})):(t.target.addEventListener("mouseleave",function(){clearInterval(f);return}),document.addEventListener("mouseleave",function(){clearInterval(f);return}),t.target.addEventListener("mouseup",function(){clearInterval(f);i.XLDragDrop._dMouseUp(t);return}))},_preventDrop:function(n){var t=this.XLObj;t.XLSelection._focusRange(n._startCell,n._endCell,t._selectionBorder);t._dStartCell=n._startCell;t._dEndCell=n._endCell},_updateDCells:function(n){var t=this.XLObj,u=t.getActiveSheetIndex(),i=t.getSheet(u),r=t.isRange(i.selectedRange);i._isColSelected&&t.inRange(i.selectedRange,0,i._startCell.colIndex)||(n.rowIndex<this._dragAndDropCell.rowIndex&&t._dStartCell.rowIndex?(t._dStartCell.rowIndex=t._dStartCell.rowIndex-(this._dragAndDropCell.rowIndex-n.rowIndex),t._dEndCell.rowIndex=r?t._dEndCell.rowIndex-(this._dragAndDropCell.rowIndex-n.rowIndex):t._dStartCell.rowIndex):n.rowIndex>this._dragAndDropCell.rowIndex&&(t._dStartCell.rowIndex=t._dStartCell.rowIndex+(n.rowIndex-this._dragAndDropCell.rowIndex),t._dEndCell.rowIndex=r?t._dEndCell.rowIndex+(n.rowIndex-this._dragAndDropCell.rowIndex):t._dStartCell.rowIndex));i._isRowSelected&&t.inRange(i.selectedRange,i._startCell.rowIndex,0)||(n.colIndex<this._dragAndDropCell.colIndex&&t._dStartCell.colIndex?(t._dStartCell.colIndex=t._dStartCell.colIndex-(this._dragAndDropCell.colIndex-n.colIndex),t._dEndCell.colIndex=r?t._dEndCell.colIndex-(this._dragAndDropCell.colIndex-n.colIndex):t._dStartCell.colIndex):n.colIndex>this._dragAndDropCell.colIndex&&(t._dStartCell.colIndex=t._dStartCell.colIndex+(n.colIndex-this._dragAndDropCell.colIndex),t._dEndCell.colIndex=r?t._dEndCell.colIndex+(n.colIndex-this._dragAndDropCell.colIndex):t._dStartCell.colIndex));this._dragAndDropCell=n;this._isDragAndDropped=!0}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.exporting=function(n){this.XLObj=n};t.spreadsheetFeatures.exporting.prototype={"export":function(i){var r=this.XLObj,u,y,s,f,e,h,c,l,p,a,o,v;if(r.model.exportSettings.allowExporting&&!r.model.isReadOnly)if(r._isExport=!0,this._renderAll(),r._isExport=!1,u=r.model.exportSettings,h=i===t.Spreadsheet.exportType.Excel?u.excelUrl:i===t.Spreadsheet.exportType.Csv?u.csvUrl:u.pdfUrl,c=this.getExportProps(),o={exportType:i,url:h,customParams:{}},l=t.raiseWebFormsServerEvents?i.toLowerCase()+"Exporting":"",t.raiseWebFormsServerEvents&&r.model.serverEvents&&r.model.serverEvents.indexOf(l)>-1){if(p={model:n.extend(!0,{},r.model),originalEventType:l},a={sheetModel:c.model,sheetData:c.data,password:u.password?r._encrypt(u.password):""},r._trigger("onExport",o))return;r.getObjectLength(o.customParams)&&n.extend(a,o.customParams);t.raiseWebFormsServerEvents(l,p,a);setTimeout(function(){t.isOnWebForms=!0},1e3)}else{if(t.isNullOrUndefined(h)){r._showAlertDlg("Alert","ImportExportUrl","",266);return}if(!u.allowExporting||r.isUndefined(h))return;if(r._trigger("onExport",o))return;h=o.url;y={action:h,method:"post"};s=t.buildTag("form","",null,y);f={name:"sheetData",type:"hidden",value:c.data};e=t.buildTag("input","",null,f);s.append(e);f={name:"sheetModel",type:"hidden",value:c.model};e=t.buildTag("input","",null,f);s.append(e);f={name:"Password",type:"hidden",value:r._encrypt(u.password)};e=t.buildTag("input","",null,f);s.append(e);for(v in o.customParams)f={name:v,type:"hidden",value:o.customParams[v]},e=t.buildTag("input","",null,f),s.append(e);n("body").append(s);s.submit()}},_dropElements:function(n){var r=n.sheets,f=["_spreadSheetPager","dataSource","rangeSettings"],u,t,i;n.undoCollection=[];for(u in r){i=r[u];for(t in i)f.indexOf(t)>-1&&(i[t]=null)}return n},_getRequriedProp:function(n){for(var f=this.XLObj,r={},u,i=["sheetCount","activeSheetIndex","nameManager"],s,o,h,t=0,e=i.length;t<e;t++)r[i[t]]=n[i[t]];f.model.allowCellFormatting&&f.getObjectLength(f.XLFormat._customFontFamily)>0&&(r.customFontFamily=f.XLFormat._customFontFamily);o=n.sheets;r.sheets=[];i=["_activeCell","_endCell","_startCell","colCount","columnsWidthCollection","rowsHeightCollection","rowCount","frozenColumns","frozenRows","usedRange","dataAttribute","filterSettings","tableManager","sheetInfo","hideColsCollection","hideRowsCollection","showGridlines","showHeadings","isSheetProtected","shapeMngr","chart","pivotMngr","topLeftCell","paneTopLeftCell"];for(t in o)for(r.sheets[t]={},h=r.sheets[t],s=o[t],u=0,e=i.length;u<e;u++)h[i[u]]=s[i[u]];return r},getExportProps:function(){var s=this.XLObj,r,e,u,l,y,a,v,o,p=n.extend(!0,{},s._dataContainer),i={},h=[],t,f={},c;for(s._refreshHashCode(p.hashCode),i=JSON.parse(JSON.stringify(s.model)),r=1;r<i.sheets.length;r++){for(f={},pivot={},n.extend(!0,f,i.sheets[r].shapeMngr.chart),h=s.getObjectKeys(f),i.sheets[r].shapeMngr.chart={},e=0,l=h.length;e<l;e++)if(t=f[h[e]].id,a=n("#"+t).data("ejChart"),a){for(a.model.event=null,v=JSON.parse(JSON.stringify(a.model)),o=v.series,u=0,y=o.length;u<y;u++)delete o[u].dataSource,delete o[u].query,o[u].fill=jQuery.type(o[u].fill)=="array"?o[u].fill[0].color:o[u].fill;i.sheets[r].shapeMngr.chart[t]=v;c=f[t].range;i.sheets[r].shapeMngr.chart[t].range=s._generateHeaderText(c[1]+1)+(c[0]+1)+":"+s._generateHeaderText(c[3]+1)+(c[2]+1);i.sheets[r].shapeMngr.chart[t].top=f[t].top;i.sheets[r].shapeMngr.chart[t].left=f[t].left;i.sheets[r].shapeMngr.chart[t].height=f[t].height;i.sheets[r].shapeMngr.chart[t].width=f[t].width}for(h=s.getObjectKeys(i.sheets[r].pivotMngr.pivot),e=0,l=h.length;e<l;e++)t=h[e],pivotObj=n("#"+t).data("ejPivotGrid"),pivotObj&&(i.sheets[r].pivotMngr.pivot[t].rows=pivotObj.getOlapReport().rows,i.sheets[r].pivotMngr.pivot[t].columns=pivotObj.getOlapReport().columns,i.sheets[r].pivotMngr.pivot[t].filters=pivotObj.getOlapReport().filters,i.sheets[r].pivotMngr.pivot[t].values=pivotObj.getOlapReport().values)}return i.sheets.shift(),{model:JSON.stringify(this._getRequriedProp(i)),data:JSON.stringify(p)}},_renderAll:function(){for(var r,i,u,n=this.XLObj,f=n.getSheets(),e=n.getActiveSheetIndex(),t=1;t<f.length;t++)if(i=f[t],n.model.importSettings.allowSheetOnDemand&&i._isImported&&!i._isRequested&&n._importSheet(t,!1),i._isLoaded||n.gotoPage(t),n.model.scrollSettings.allowVirtualScrolling&&!i._isImported&&i._hasDataSrc)for(r=1;r<=i._virtualBlockCnt;r++)i._virtualDataLoadedBlks.indexOf(r)===-1&&(i._virtualDataLoadedBlks.push(r),u=this._getRange(r,t),n._refreshDataSrc(u,t),n._refreshCellData(u,t));n.hideWaitingPopUp();n.gotoPage(e)},_getRange:function(n,t){var u=this.XLObj,i=u.getSheet(t),r=[0,0,0,i.colCount-1];return r[0]=i._virtualBlockRowCnt*(n-1),r[2]=i._virtualBlockRowCnt*n-1,r}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.findnreplace=function(n){this.XLObj=n;this._findCount=0;this._isApplied=!1;this.caseSen={"true":function(n){return n.toString()},"false":function(n){return n.toString().toLowerCase()}};this.isEMatch={"true":function(n,t){return n==t},"false":function(n,t){if(!n.length||t.length)return n.indexOf(t)>-1}}};t.spreadsheetFeatures.findnreplace.prototype={replaceAllBySheet:function(n,t,i,r){this.XLObj.model.allowSearching&&this.XLObj.model.allowEditing&&!this.XLObj.model.isReadOnly&&this._replaceAllData(n,t,i,r,"value","sheet")},replaceAllByBook:function(n,t,i,r){this.XLObj.model.allowSearching&&this.XLObj.model.allowEditing&&!this.XLObj.model.isReadOnly&&this._replaceAllData(n,t,i,r,"value","workbook")},findNext:function(n,i,r){t.isNullOrUndefined(r)&&(r=this.XLObj.getActiveSheetIndex());this._findNext(n,r,i.isCSen,i.isEMatch,i.type,i.mode,i.searchBy)},findPrevious:function(n,i,r){t.isNullOrUndefined(r)&&(r=this.XLObj.getActiveSheetIndex());this._findPrev(n,r,i.isCSen,i.isEMatch,i.type,i.mode,i.searchBy)},_findNext:function(n,t,i,r,u,f,e){var s,h,y,ct,tt,w,b,a,p,ot,it,rt,v,k,d,lt,ut,ft,g=[],l=e==="rows",c=this.XLObj,st=!1,nt=t?t:c.getActiveSheetIndex(),ht=c.getSheet(nt),et=ht._activeCell,o={sheetIndex:t,value:n,isCaseSensitive:i,isEntireMatch:r,searchBy:e,mode:f,findType:u,reqType:"findNext"};if(lt={sheetIndex:o.sheetIndex,value:o.value,isCaseSensitive:o.isCaseSensitive,isEntireMatch:o.isEntireMatch,searchBy:o.searchBy,mode:o.mode,findType:o.findType,reqType:o.reqType},!c._intrnlReq&&c._trigActionBegin(lt))return!0;if(c.model.allowEditing&&c.XLEdit._isEdit&&c.XLEdit.saveCell(),n=o.value,t=o.sheetIndex,i=o.isCaseSensitive,r=o.isEntireMatch,u=o.findType,f=o.mode,e=o.searchBy,w=ht._selectedCells,ot=w.length,p=ht.usedRange,ot===1||f==="workbook"?g=[et.rowIndex,et.colIndex,p.rowIndex+1,p.colIndex+1]:(st=!0,b=w[ot-1],g=[et.rowIndex,et.colIndex,b.rowIndex+1,b.colIndex+1]),a=g[0],v=g[1],k=g[2],d=g[3],l||(tt=a,a=v,v=tt,tt=k,k=d,d=tt),f==="sheet"){for(s=a;s<k;s++)for(s!==a&&(b=w[0],v=st?l?b.colIndex:b.rowIndex:0),h=v;h<d;h++)if(ut=this._compareValues(l?s:h,l?h:s,nt,n,i,r,u),ut&&!(s===a&&h===v))return(this._updateSelection(l?s:h,l?h:s),this._findCount++,o={reqType:"findNext",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0}else for(y=nt,ct=c.model.sheetCount;y<=ct;y++)for(p=c.model.sheets[y].usedRange,y!==nt&&(v=0,a=0,k=l?p.rowIndex:p.colIndex,d=l?p.colIndex:p.rowIndex),s=a;s<k+1;s++)for(s!==a&&(v=0),h=v;h<d+1;h++)if(ut=this._compareValues(l?s:h,l?h:s,y,n,i,r,u),ut&&!(y===nt&&s===a&&h===v))return(this._updateSelection(l?s:h,l?h:s,y),this._findCount++,c._intrnlReq=!1,o={reqType:"findNext",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0;return this._findCount?!1:(it=0,rt=0,ft=f==="sheet"?nt:1,st&&(b=w[0],rt=w[0].rowIndex,it=w[0].colIndex),this._updateSelection(rt,it,ft),this._findCount++,this._compareValues(rt,it,ft,n,i,r,u)?!0:(c._intrnlReq=!0,this._findNext(n,ft,i,r,u,f,e)))},_findPrev:function(n,t,i,r,u,f,e){var s,h,p,it,k,a,nt,rt,ut,ft,v,y,tt,ct,w,st=!1,d=[],lt=0,at=0,l=e==="rows",et,c=this.XLObj,g=t?t:c.getActiveSheetIndex(),ht=c.getSheet(g),b=ht.usedRange,ot=ht._activeCell,o={sheetIndex:t,value:n,isCaseSensitive:i,isEntireMatch:r,searchBy:e,mode:f,findType:u,reqType:"findPrevious"};if(ct={sheetIndex:o.sheetIndex,value:o.value,isCaseSensitive:o.isCaseSensitive,isEntireMatch:o.isEntireMatch,searchBy:o.searchBy,mode:o.mode,findType:o.findType,reqType:o.reqType},c._trigActionBegin(ct))return!0;if(c.model.allowEditing&&c.XLEdit._isEdit&&c.XLEdit.saveCell(),n=o.value,t=o.sheetIndex,i=o.isCaseSensitive,r=o.isEntireMatch,u=o.findType,f=o.mode,e=o.searchBy,nt=ht._selectedCells,rt=nt.length,rt===1||f==="workbook"?d=[ot.rowIndex,ot.colIndex,b.rowIndex+1,b.colIndex+1]:(a=nt[rt-1],d=[ot.rowIndex,ot.colIndex,a.rowIndex,a.colIndex],st=!0),v=d[0],y=d[1],tt=d[2],w=d[3],l||(et=v,v=y,y=et,et=tt,tt=w,w=et),f==="sheet"){for(st&&(a=nt[0],lt=l?a.rowIndex:a.colIndex,at=l?a.colIndex:a.rowIndex),s=v;s>=lt;s--)for(s!==v&&(y=w),h=y;h>=at;h--)if(it=this._compareValues(l?s:h,l?h:s,g,n,i,r,u),it&&!(s===v&&h===y))return(this._updateSelection(l?s:h,l?h:s),this._findCount++,o={reqType:"findPrevious",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0}else for(p=g;p>=1;p--)for(b=c.model.sheets[p].usedRange,p!==g&&(tt=l?b.rowIndex:b.colIndex,w=l?b.colIndex:b.rowIndex,y=w,v=tt),s=v;s>=0;s--)for(s!==v&&(y=w+1),h=y;h>=0;h--)if(it=this._compareValues(l?s:h,l?h:s,p,n,i,r,u),it&&!(p===g&&s===v&&h===y))return(this._updateSelection(l?s:h,l?h:s,p),this._findCount++,o={reqType:"findPrevious",activeCell:c.getActiveCellElem()},c._trigActionComplete(o))?void 0:!0;return this._findCount?!1:(k=f==="sheet"?g:c.model.sheetCount,ft=c.model.sheets[k].usedRange.rowIndex,ut=c.model.sheets[k].usedRange.colIndex,st&&(a=nt[rt-1],ft=a.rowIndex,ut=a.colIndex),this._updateSelection(ft,ut,k),this._findCount++,this._compareValues(ft,ut,k,n,i,r,u)?!0:this._findPrev(n,k,i,r,u,f,e))},_compareValues:function(n,t,i,r,u,f,e){var o=this.XLObj,s=o.XLEdit.getPropertyValue(n,t,null,i)?o.XLEdit.getPropertyValue(n,t,null,i).toString():"",h=o.isFormula(s)||e==="formula"&&s==="=",c=o._isDateTime(o.XLEdit.getPropertyValue(n,t,"value",i));return s=e==="value"?c?s?this.caseSen[u](o.XLEdit.getPropertyValue(n,t,"value2",i)):"":s&&!h?this.caseSen[u](s):"":e==="formula"?h?this.caseSen[u](s):"":o.XLEdit.getPropertyValue(n,t,"comment",i)?this.caseSen[u](o.XLEdit.getPropertyValue(n,t,"comment",i).value):"",r=this.caseSen[u](r),this.isEMatch[f](s,r)},_replace:function(n,t,i,r,u){var f=this.XLObj,o=f.getActiveSheetIndex();if(f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,"isLocked",o))return!1;var e=f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,null,t)?f.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,null,t).toString():"",s=new RegExp(i.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),h=e!==""&&i!==""?u?e.replace(i,r):e.replace(s,r):r;t===o||f.gotoPage(t);f.XLEdit._updateCellValue(n,h)},_replaceData:function(n,t,i,r,u,f,e,o,s){var v,y,h=this.XLObj,c=i?i:h.model.activeSheetIndex,p=h.getSheet(c),l=p._activeCell.rowIndex,a=p._activeCell.colIndex,w;if(!h.model.allowEditing)return!1;if(h.model.allowLockCell&&h.XLEdit.getPropertyValue(l,a,"isLocked",c)){h._popUplockCellAlert();return}h.model.allowEditing&&h.XLEdit._isEdit&&h.XLEdit.saveCell();this._compareValues(l,a,c,n,r,u,f)?(y=f==="formula"?"value":"value2",v={sheetIndex:c,reqType:"find-replace",operation:"replace",rowIndex:l,colIndex:a,sIndex:i},v.prevData={value:h.XLEdit.getPropertyValue(l,a,y)},this._replace({rowIndex:l,colIndex:a},i,n,t,r),v.newData={value:h.XLEdit.getPropertyValue(l,a,y)},this._findCount=0,w=e==="up"?this._findPrev(n,c,r,u,f,o,s):this._findNext(n,c,r,u,f,o,s),w||this._updateSelection(l,a,c),h._isUndoRedo||(h._completeAction(v),h._trigActionComplete(v))):h._showAlertDlg("Alert","ReplaceNotFound","")},_replaceAllData:function(t,i,r,u,f,e){var w,a,l,g=[],it=0,rt=!1,nt,o=this.XLObj,ut=o.model.sheetCount,v=o.model.activeSheetIndex,b=o.getSheet(v),y=b.usedRange,ft=b._activeCell.rowIndex,et=b._activeCell.colIndex,s,h,c,k,d,tt=0,p;if(w={sheetIndex:v,reqType:"find-replace",operation:"replaceAll",isCSen:r,isEMatch:u},a=f==="formula"?"value":"value2",!o.model.allowEditing)return!1;if(o._dupDetails=!0,o.model.allowEditing&&o.XLEdit._isEdit&&o.XLEdit.saveCell(),e==="sheet")if(o.model.allowLockCell&&b.isSheetProtected)rt=!0;else for(s=0,k=y.rowIndex+1;s<k;s++)for(h=0,d=y.colIndex+1;h<d;h++)this._compareValues(s,h,v,t,r,u,f)&&(l={rowIndex:s,colIndex:h,prevData:{value:o.XLEdit.getPropertyValue(s,h,a)},sheetIndex:v},this._replace({rowIndex:s,colIndex:h},v,t,i,r),tt++,l.newData={value:o.XLEdit.getPropertyValue(s,h,a)},g.push(l));else for(c=1;c<=ut;c++){if(nt=o.model.sheets[c],o.model.allowLockCell&&nt.isSheetProtected){it++;continue}for(y=nt.usedRange,s=0,k=y.rowIndex+1;s<k;s++)for(h=0,d=y.colIndex+1;h<d;h++)this._compareValues(s,h,c,t,r,u,f)&&(l={rowIndex:s,colIndex:h,prevData:{value:o.XLEdit.getPropertyValue(s,h,a,c)},sheetIndex:c},this._replace({rowIndex:s,colIndex:h},c,t,i,r),tt++,l.newData={value:o.XLEdit.getPropertyValue(s,h,a)},g.push(l))}if(rt||it===ut){o._popUplockCellAlert();return}o._dupDetails=!1;w.selectedCell=g;this._updateSelection(ft,et);o._isUndoRedo||(o._completeAction(w),o._trigActionComplete(w));o.hideWaitingPopUp();p=o._getLocStr("ReplaceData").split("/");p="T-"+p[0]+tt+" "+p[1];n("#"+o._id+"_FRDialog").ejDialog("close");o._showAlertDlg("Alert",p,"",325)},_updateSelection:function(n,t,i){var u={rowIndex:n,colIndex:t},r=this.XLObj,e=r.getActiveSheetIndex(),f=r.getSheet(e);i||(i=e);i&&i!==e&&r.gotoPage(i,!1);r.getSheetElement(e).find(".e-selected:visible").length<2||!r.inRange(f.selectedRange,n,t)?(r.setActiveCell(u.rowIndex,u.colIndex,i),r.XLSelection.selectRange(u,u),f._startCell=u,f._endCell=u):r.XLCellNav._updateActiveCell(n,t);r.model.scrollSettings.allowScrolling&&(r._isFrozen(f.frozenRows)||r._isFrozen(f.frozenColumns)?this._freezeScroll(u.rowIndex,u.colIndex,f):r.XLScroll._scrollSelectedPosition(i,r.getActiveCell(i)));r.model.allowAutoFill&&r.XLDragFill.positionAutoFillElement()},_getSelRangeDetails:function(n){var t=n[n.length-1].rowIndex-n[0].rowIndex,i=n[n.length-1].colIndex-n[0].colIndex,r=n[0].rowIndex,u=n[0].colIndex;return[t,i,r,u]},goTo:function(t){var i=this.XLObj;if(!i.model.isReadOnly){i._showDialog(i._id+"_Ribbon_Others_Editing_FindSelect");t.startsWith("=")&&(t=t.split("=")[1]);var h,f,c=i.getActiveSheetIndex(),u=i.getSheet(c),r,e,o=i._getDollarAlphaRange(u.selectedRange),s=i.XLRibbon._getAddrFromDollarAddr(t);t=s[1];s[0]&&i.gotoPage(s[0],!1);t=i.getRangeIndices(t);rangeCells=i._getSelectedRange({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]});r=rangeCells[0];e=rangeCells[rangeCells.length-1];i.setActiveCell(r.rowIndex,r.colIndex);i.model.allowSelection&&i.XLSelection.selectRange(r,e);i._isFrozen(u.frozenRows)||i._isFrozen(u.frozenColumns)?this._freezeScroll(r.rowIndex,r.colIndex,u):i.XLScroll._scrollSelectedPosition(i.getActiveSheetIndex(),r);i.XLDragFill.positionAutoFillElement();u._startCell=r;u._endCell=e;i.setSheetFocus();h=n.grep(i.XLRibbon._addrList,function(n){return n.value===o});h.length<1&&(i.XLRibbon._addrList.push({value:o,text:o}),f=n("#"+i._id+"_GotoAddr").data("ejListBox"),i.XLRibbon._addrList=JSON.parse(JSON.stringify(i.XLRibbon._addrList)),f.model.dataSource=i.XLRibbon._addrList,f.option("fields",{dataSource:i.XLRibbon._addrList}))}},goToSpecial:function(n,t){this._applyGoToRule(n,t.isNumber,t.isText,t.isLogical,t.isError)},_applyGoToRule:function(n,t,i,r,u){var e=this.XLObj,o,f;e.showWaitingPopUp();switch(n){case"blanks":this._applyGotoBlanks();break;case"formulas":this._applyGotoFormulas(t,i,r,u);break;case"comments":this._applyGotoComments();break;case"datavalidation":this._applyGotoValidation();break;case"cformat":this._applyGotoCFormat();break;case"lastcell":o=e.getActiveSheetIndex();f=e.model.sheets[o].usedRange;e.XLSelection.selectRange({rowIndex:f.rowIndex,colIndex:f.colIndex},{rowIndex:f.rowIndex,colIndex:f.colIndex});this._updateSelection(f.rowIndex,f.colIndex,o);break;case"constants":this._applyGotoConstants(t,i,r,u);break;case"rowdiff":this._applyGotoRowDiff();break;case"coldiff":this._applyGotoColDiff()}e.hideWaitingPopUp()},_applyGotoBlanks:function(){var f,e,s,i,h,o=!1,l=[],r,n=this.XLObj,u=n.getActiveSheetIndex(),a=n.model.sheets[u].usedRange,v,y=a.rowIndex,p=a.colIndex,t=n.getSheet(u),w=t._selectedCells,b=0,k=0,c={sheetIndex:u,reqType:"find-replace",operation:"blanks"};for(t._goToCollection={multiple:!1,selected:[]},w.length>1&&(r=this._getSelRangeDetails(w),y=r[0],p=r[1],b=r[2],k=r[3],t._goToCollection.multiple=!0),f=0;f<=y;f++){for(e=0;e<=p;e++)rIdx=f+b,cIdx=e+k,v=n.XLEdit.getPropertyValue(rIdx,cIdx)?n.XLEdit.getPropertyValue(rIdx,cIdx).toString():"",n._isRowViewable(u,rIdx)&&(s=n.getCell(rIdx,cIdx,u),o=!0),v.length?o&&s.removeClass("e-selected"):(l.push({rowIndex:rIdx,colIndex:cIdx,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&t._goToCollection.selected.push(rIdx+":"+cIdx),o&&(s.addClass("e-selected"),i=[rIdx,cIdx]));o=!1}h=t._goToCollection.selected.length;(n._isFrozen(t.frozenRows)||n._isFrozen(t.frozenColumns))&&(h&&(i=t._goToCollection.selected[h-1].split(":")),i.length&&this._freezeScroll(i[0],i[1],t));c.selectedCell=l;n._isUndoRedo||(n._completeAction(c),n._trigActionComplete(c))},_applyGotoComments:function(){var e,o,c,r,s,h=!1,a=[],u,n=this.XLObj,f=n.getActiveSheetIndex(),v=n.getSheet(f).usedRange,y,p=v.rowIndex,w=v.colIndex,i=n.getSheet(f),b=i._selectedCells,k=0,d=0,l={sheetIndex:f,reqType:"find-replace",operation:"comments"};for(i._goToCollection={multiple:!1,selected:[]},this._isApplied=!1,b.length>1&&(u=this._getSelRangeDetails(b),p=u[0],w=u[1],k=u[2],d=u[3],i._goToCollection.multiple=!0),e=0;e<=p;e++){for(o=0;o<=w;o++)rIdx=e+k,cIdx=o+d,y=n.XLEdit.getPropertyValue(rIdx,cIdx,"comment"),n._isRowViewable(f,rIdx)&&(c=n.getCell(rIdx,cIdx,f),h=!0),t.isNullOrUndefined(y)?h&&c.removeClass("e-selected"):(a.push({rowIndex:rIdx,colIndex:cIdx,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(rIdx+":"+cIdx),h&&(c.addClass("e-selected"),this._isApplied=!0,r=[rIdx,cIdx]));h=!1}s=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(s&&(r=i._goToCollection.selected[s-1].split(":")),r.length&&this._freezeScroll(r[0],r[1],i));this._isApplied||s||n._showAlertDlg("Alert","NoCellFound","",200);l.selectedCell=a;!n._isUndoRedo&&this._isApplied&&(n._completeAction(l),n._trigActionComplete(l))},_applyGotoFormulas:function(i,r,u,f){var p,l,k,s,c,a,w,b=!1,nt=[],v,e=this.XLObj,y=e.getActiveSheetIndex(),tt,o,it,rt=e.model.sheets[y].usedRange,ut=rt.rowIndex,ft=rt.colIndex,h=e.getSheet(y),et=h._selectedCells,ot=0,d=0,g={sheetIndex:y,reqType:"find-replace",operation:"formulas"};for(h._goToCollection={multiple:!1,selected:[]},this._isApplied=!1,et.length>1&&(v=this._getSelRangeDetails(et),ut=v[0],ft=v[1],ot=v[2],d=v[3],h._goToCollection.multiple=!0),p=0;p<=ut;p++){for(l=0;l<=ft;l++)s=p+ot,c=l+d,tt=t.isNullOrUndefined(e.XLEdit.getPropertyValue(s,c))?"":e.XLEdit.getPropertyValue(s,l+d).toString(),o=t.isNullOrUndefined(e.XLEdit.getPropertyValue(s,c,"value2"))?"":e.XLEdit.getPropertyValue(s,c,"value2").toString(),it=tt.charAt(0)==="="&&typeof o=="string",e._isRowViewable(y,s)&&(k=e.getCell(s,c,y),b=!0),it&&(i&&n.isNumeric(o)||r&&!(o.toLowerCase()==="true"||o.toLowerCase()==="false")&&!n.isNumeric(o)&&!(o.length!==0&&o.indexOf("#")===0&&o.lastIndexOf("?")===o.length-1&&o.length>0)||u&&(o.toLowerCase()==="true"||o.toLowerCase()==="false")||f&&o.length!==0&&e._calcEngine.getErrorStrings().indexOf(o)>-1)?(nt.push({rowIndex:s,colIndex:c,isApply:!0}),e.model.scrollSettings.allowVirtualScrolling&&h._goToCollection.selected.push(s+":"+c),b&&(k.addClass("e-selected"),this._isApplied=!0,a=[s,c])):b&&k.removeClass("e-selected");b=!1}w=h._goToCollection.selected.length;(e._isFrozen(h.frozenRows)||e._isFrozen(h.frozenColumns))&&(w&&(a=h._goToCollection.selected[w-1].split(":")),a.length&&this._freezeScroll(a[0],a[1],h));this._isApplied||w||e._showAlertDlg("Alert","NoCellFound","",200);g.selectedCell=nt;!e._isUndoRedo&&this._isApplied&&(e._completeAction(g),e._trigActionComplete(g))},_applyGotoValidation:function(){var s,h,a,r,u,f,c,l=!1,y=[],e,n=this.XLObj,o=n.getActiveSheetIndex(),p=n.model.sheets[o].usedRange,w,b=p.rowIndex,k=p.colIndex,i=n.getSheet(o),d=i._selectedCells,g=0,nt=0,v={sheetIndex:o,reqType:"find-replace",operation:"validations"};for(this._isApplied=!1,i._goToCollection={multiple:!1,selected:[]},d.length>1&&(e=this._getSelRangeDetails(d),b=e[0],k=e[1],g=e[2],nt=e[3],i._goToCollection.multiple=!0),s=0;s<=b;s++){for(h=0;h<=k;h++)r=s+g,u=h+nt,w=n.XLEdit.getPropertyValue(r,u,"rule"),n._isRowViewable(o,r)&&(a=n.getCell(r,u,o),l=!0),t.isNullOrUndefined(w)?l&&a.removeClass("e-selected"):(y.push({rowIndex:r,colIndex:u,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(r+":"+u),l&&(a.addClass("e-selected"),this._isApplied=!0,f=[r,u]));l=!1}c=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(c&&(f=i._goToCollection.selected[c-1].split(":")),f.length&&this._freezeScroll(f[0],f[1],i));this._isApplied||c||n._showAlertDlg("Alert","NoCellFound","",200);v.selectedCell=y;!n._isUndoRedo&&this._isApplied&&(n._completeAction(v),n._trigActionComplete(v))},_applyGotoCFormat:function(){var s,h,a,r,u,f,c,l=!1,p=[],e,n=this.XLObj,o=n.getActiveSheetIndex(),w=n.model.sheets[o].usedRange,v,b=w.rowIndex,k=w.colIndex,i=n.getSheet(o),d=i._selectedCells,g=0,nt=0,y={sheetIndex:o,reqType:"find-replace",operation:"conditions"};for(this._isApplied=!1,i._goToCollection={multiple:!1,selected:[]},d.length>1&&(e=this._getSelRangeDetails(d),b=e[0],k=e[1],g=e[2],nt=e[3],i._goToCollection.multiple=!0),s=0;s<=b;s++){for(h=0;h<=k;h++)r=s+g,u=h+nt,v=n.XLEdit.getPropertyValue(r,u,"cFormatRule"),n._isRowViewable(o,r)&&(a=n.getCell(r,u,o),l=!0),!t.isNullOrUndefined(v)&&v.length?(p.push({rowIndex:r,colIndex:u,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(r+":"+u),l&&(a.addClass("e-selected"),this._isApplied=!0,f=[r,u])):l&&a.removeClass("e-selected");l=!1}c=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(c&&(f=i._goToCollection.selected[c-1].split(":")),f.length&&this._freezeScroll(f[0],f[1],i));this._isApplied||c||n._showAlertDlg("Alert","NoCellFound","",200);y.selectedCell=p;!n._isUndoRedo&&this._isApplied&&(n._completeAction(y),n._trigActionComplete(y))},_applyGotoConstants:function(i,r,u,f){var v,y,d,o,s,l,p,w=!1,et=[],g,a,e=this.XLObj,b=e.getActiveSheetIndex(),h,k,nt=e.model.sheets[b].usedRange,tt=nt.rowIndex,it=nt.colIndex,c=e.getSheet(b),rt=c._selectedCells,ut=0,ft=0;for(this._isApplied=!1,c._goToCollection={multiple:!1,selected:[]},rt.length>1&&(a=this._getSelRangeDetails(rt),tt=a[0],it=a[1],ut=a[2],ft=a[3],c._goToCollection.multiple=!0),v=0;v<=tt;v++){for(y=0;y<=it;y++)o=v+ut,s=y+ft,h=t.isNullOrUndefined(e.XLEdit.getPropertyValue(o,s))?"":e.XLEdit.getPropertyValue(o,s).toString(),k=t.isNullOrUndefined(e.XLEdit.getPropertyValue(o,s,"value2"))?"":e.XLEdit.getPropertyValue(o,s,"value2").toString(),g=h.charAt(0)==="="&&typeof k=="string",e._isRowViewable(b,o)&&(d=e.getCell(o,s,b),w=!0),!g&&(i&&n.isNumeric(h)||r&&!(h.toLowerCase()==="true"||h.toLowerCase()==="false")&&!n.isNumeric(h)&&h.length>0||u&&(h.toLowerCase()==="true"||h.toLowerCase()==="false")||f&&k.length!==0&&k.indexOf("#")===0)?(et.push({rowIndex:o,colIndex:s,isApply:!0}),e.model.scrollSettings.allowVirtualScrolling&&c._goToCollection.selected.push(o+":"+s),w&&(d.addClass("e-selected"),this._isApplied=!0,l=[o,s])):w&&d.removeClass("e-selected");w=!1}p=c._goToCollection.selected.length;(e._isFrozen(c.frozenRows)||e._isFrozen(c.frozenColumns))&&(p&&(l=c._goToCollection.selected[p-1].split(":")),l.length&&this._freezeScroll(l[0],l[1],c));this._isApplied||p||e._showAlertDlg("Alert","NoCellFound","",200)},_applyGotoColDiff:function(){var o,s,a,t,r,u,h,c=!1,y=[],f,n=this.XLObj,e=n.getActiveSheetIndex(),p=n.model.sheets[e].usedRange,w,b=p.rowIndex,k=p.colIndex,i=n.getSheet(e),d=i._selectedCells,l=0,g=0,v={sheetIndex:e,reqType:"find-replace",operation:"coldiff"},nt;if(this._isApplied=!1,i._goToCollection={multiple:!1,selected:[]},d.length>1)for(f=this._getSelRangeDetails(d),b=f[0],k=f[1],l=f[2],g=f[3],i._goToCollection.multiple=!0,o=0;o<=k;o++){for(t=o+g,nt=n.XLEdit.getPropertyValue(l,t)?n.XLEdit.getPropertyValue(l,t).toString():"",s=0;s<=b;s++)r=s+l,w=n.XLEdit.getPropertyValue(r,t)?n.XLEdit.getPropertyValue(r,t).toString():"",n._isRowViewable(e,r)&&(a=n.getCell(r,t,e),c=!0),w===nt?c&&a.removeClass("e-selected"):(y.push({rowIndex:r,colIndex:t,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&i._goToCollection.selected.push(r+":"+t),c&&(a.addClass("e-selected"),this._isApplied=!0,u=[r,t]));c=!1}h=i._goToCollection.selected.length;(n._isFrozen(i.frozenRows)||n._isFrozen(i.frozenColumns))&&(h&&(u=i._goToCollection.selected[h-1].split(":")),u.length&&this._freezeScroll(u[0],u[1],i));this._isApplied||h||n._showAlertDlg("Alert","NoCellFound","",200);v.selectedCell=y;!n._isUndoRedo&&this._isApplied&&(n._completeAction(v),n._trigActionComplete(v))},_applyGotoRowDiff:function(){var f,e,c,i,o,s=!1,a=[],r,n=this.XLObj,u=n.getActiveSheetIndex(),v=n.model.sheets[u].usedRange,y,p=v.rowIndex,w=v.colIndex,t=n.getSheet(u),b=t._selectedCells,k=0,h=0,d,l={sheetIndex:u,reqType:"find-replace",operation:"rowdiff"};if(this._isApplied=!1,t._goToCollection={multiple:!1,selected:[]},b.length>1)for(r=this._getSelRangeDetails(b),p=r[0],w=r[1],k=r[2],h=r[3],t._goToCollection.multiple=!0,f=0;f<=p;f++){for(rIdx=f+k,d=n.XLEdit.getPropertyValue(rIdx,h)?n.XLEdit.getPropertyValue(rIdx,h).toString():"",e=0;e<=w;e++)cIdx=e+h,y=n.XLEdit.getPropertyValue(rIdx,cIdx)?n.XLEdit.getPropertyValue(rIdx,cIdx).toString():"",n._isRowViewable(u,rIdx)&&(c=n.getCell(rIdx,cIdx,u),s=!0),y===d?s&&c.removeClass("e-selected"):(a.push({rowIndex:rIdx,colIndex:cIdx,isApply:!0}),n.model.scrollSettings.allowVirtualScrolling&&t._goToCollection.selected.push(rIdx+":"+cIdx),s&&(c.addClass("e-selected"),this._isApplied=!0,i=[rIdx,cIdx]));s=!1}o=t._goToCollection.selected.length;(n._isFrozen(t.frozenRows)||n._isFrozen(t.frozenColumns))&&(o&&(i=t._goToCollection.selected[o-1].split(":")),i.length&&this._freezeScroll(i[0],i[1],t));this._isApplied||o||n._showAlertDlg("Alert","NoCellFound","",200);l.selectedCell=a;!n._isUndoRedo&&this._isApplied&&(n._completeAction(l),n._trigActionComplete(l))},_freezeScroll:function(n,t,i){var r,u=this.XLObj;r=u._getIdxWithOffset(n,t,!1,["freeze"]);(i._ftopRowIdx>n||n>i._bottomRow.idx)&&u._scrollContent({y:r.yOffset-i._frozenHeight+1},!0);(i._fleftColIdx>t||t>i._rightCol.idx)&&u._scrollContent({x:r.xOffset-i._frozenWidth+1},!0)}}}(jQuery,Syncfusion);$.fn.setInputPos=function(n,t){return t||(t=n),$(this).is(":visible")?this.each(function(){if(this.setSelectionRange)this.focus(),this.setSelectionRange(n,t);else if(this.createTextRange){var i=this.createTextRange();i.collapse(!0);i.moveEnd("character",t);i.moveStart("character",n);i.select()}}):void 0},function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.shape=function(n){this.XLObj=n;this._imgX=0;this._imgY=0;this._imgOffsetleft=0;this._imgOffsetTop=0;this._shapeType="img";this._shapeROStart=!1;this._shapeRSStart=!1;this._imgRSWStart=!1;this._imgRSEStart=!1;this._imgRSNStart=!1;this._imgRSSStart=!1;this._changePicture=!1;this._picCellIdx={};this._insertShape=!1};t.spreadsheetFeatures.shape.prototype={_insertPicture:function(n){var i=this.XLObj,u=i._browserDetails.name==="msie"&&parseInt(i._browserDetails.version)<10?n.responseText:n.xhr.response,f,e,s,h,o,l;if(u.startsWith("Invalid"))i._showAlertDlg("Alert","ImageValAlert");else if(f=i.getActiveSheetIndex(),e=i.getSheet(f),this._changePicture)this.changePicture(null,u);else{var r=i.getActiveCell(),c=i.model.pictureSettings,a=c.height,v=c.width;t.isNullOrUndefined(r)&&(o=i.element.find(".e-ss-activeimg").get(0),l=this._getCellIndexFromOffset(o.offsetTop,o.offsetLeft));s=e._colWidthCollection[r.colIndex];h=e._rowHeightCollection[r.rowIndex];this._insertShape=!0;this._createPicture(f,r,u,h,s,v,a)}},changePicture:function(t,i){var u=this.XLObj,s=u.getActiveSheetIndex(),a=u.getSheet(s),r,h,c,l,f,e,o;r=t?n("#"+t).get(0):u.getSheetElement(s).find(".e-ss-activeimg").get(0);h=r.offsetLeft;c=r.offsetTop;l=this._getCellIndexFromOffset(c,h);f=a.shapeMngr;n(r).css("background-image","url('"+i+"')");e=f.picture[r.id];o={sheetIndex:s,reqType:"shape",shapeType:"picture",action:"changepicture",id:n(r).attr("id"),cell:l,prev:{img:f.sharedPics[e.data],data:e.data,pcIdx:r.id},cur:{img:i,pcIdx:r.id}};f.sharedPics.indexOf(i)===-1&&f.sharedPics.push(i);e.data=f.sharedPics.indexOf(i);o.cur.data=e.data;this._changePicture=!1;u.setSheetFocus();u._completeAction(o);u._trigActionComplete(o)},setPicture:function(n,t,i,r,u,f){var e=this.XLObj,o,s,h,c,l;if(e.model.pictureSettings.allowPictures&&!e.model.isReadOnly)return(n=e._getRangeArgs(n,"object"),o=n[0],s=n[1],e.model.allowLockCell&&e._isCellProtected(o,s,!1))?void 0:(h=e.getActiveSheetIndex(),l=e.model.pictureSettings,r=r?r:l.height,i=i?i:l.width,e._isRowViewable(h,o)?(c=e.getCell(o,s)[0],u=u?u:c.offsetTop,f=f?f:c.offsetLeft):(u=u?u:0,f=f?f:0),this._createPicture(h,{rowIndex:o,colIndex:s},t,u,f,i,r))},resetPicture:function(i,r){var f=this.XLObj,u,s,e,o;u=i?n("#"+i):f.element.find(".e-ss-activeimg");s=new RegExp("\\be-shapebdr.*?\\b","g");e={sheetIndex:f.getActiveSheetIndex(),reqType:"shape",shapeType:"picture",action:"resetpicture",id:n(u).attr("id"),actionType:r};f._dupDetails=!0;t.isNullOrUndefined(u[0].className.match(s))||(o=f.XLShape._getImgStyleFromHashCode(u[0].className.match(s)[0]));e.prev=o?{bcolor:o["border-color"],bstyle:o["border-style"],bwidth:o["border-width"]}:{};u[0].className=u[0].className.replace(s,"");e.cur={bcolor:u.css("border-color"),bstyle:u.css("border-style"),bwidth:u.css("border-width")};r!="resetpicture"&&(e.prev.width=u.css("width"),e.prev.height=u.css("height"),u.css({width:f.model.pictureSettings.width,height:f.model.pictureSettings.height}),e.cur.width=u.css("width"),e.cur.height=u.css("height"),f.XLShape._updateShapeObj(u[0]),f._hasClass(u[0],"e-ss-activeimg")&&f.XLRibbon._formatTabUpdate());f._dupDetails=!1;f._completeAction(e);f._trigActionComplete(e)},_createPicture:function(n,i,r,u,f,e,o,s,h,c,l,a){var w,d,g;h=h?h:"transparent";c=c?c:"solid";l=l?l:"1px";var v=this.XLObj,k,b=v.getSheet(n),y={sheetIndex:n,targetCell:i,top:u,left:f,width:e,height:o,bcolor:h,bstyle:c,bwidth:l,reqType:"picture",add:"add"},p;if(k={sheetIndex:y.sheetIndex,targetCell:y.targetCell,top:y.top,left:y.left,width:y.width,height:y.height,bcolor:y.bcolor,bstyle:y.bstyle,bwidth:y.bwidth,reqType:"picture",action:"add"},!v._trigActionBegin(k))return b._isImported||(this._insertShape=!0),u=y.top,f=y.left,e=y.width,o=y.height,s=t.isNullOrUndefined(s)?v.model.allowCharts&&v.XLChart._shapeCnt:s,v._isExport&&(a.cnt=s),p=v._id+"_picture"+s,i||(i=this._getCellIndexFromOffset(u,f,n)),d=i.rowIndex,g=i.colIndex,!v._isUndoRedo&&v.model.allowCharts&&v.XLChart._shapeCnt++,this._updateShapeMngr(i,{picture:{data:r,id:p,height:o,width:e,left:f,top:u,rowIndex:d,colIndex:g,bwidth:l,bcolor:h,bstyle:c}},"picture"),v._isExport||this._refreshPictureElement({top:u,left:f,width:e,height:o,bcolor:h,bstyle:c,bwidth:l,imgData:r,cnt:s,sheetIdx:n}),v.setSheetFocus(),b._isImported&&!b._isLoaded||v._isUndoRedo||v._isPaste||v.XLClipboard._isShape||v._isExport||(w={sheetIndex:n,reqType:"shape",shapeType:"picture",action:"remove",id:p,actCell:i,img:r,cnt:s},w.position={top:u,left:f,height:o,width:e},v._completeAction(w),v._trigActionComplete(w)),v.model.showRibbon&&v.XLRibbon._formatTabUpdate(),p},_refreshPictureElement:function(i){var r=this.XLObj,u,f,e;r._getJSSheetContent(i.sheetIdx).find(".e-spreadsheetcontentcontainer > .e-content").append(t.buildTag("div.e-ss-object","","",{id:r._id+"_picture"+i.cnt}));u=n("#"+r._id+"_picture"+i.cnt);u.data("parentID",r._id);u.css({"background-image":"url('"+i.imgData+"')",height:i.height,width:i.width,left:i.left,top:i.top});f=i.bwidth+" "+i.bstyle+" "+i.bcolor;e=this._getImgBorderHashCode({"border-color":i.bcolor,"border-style":i.bstyle,"border-width":i.bwidth});r.model.allowCellFormatting&&r.XLFormat._writeCssRules(e,r.XLFormat._getCssPropertyAsString({border:{left:f,right:f,top:f,bottom:f}}));u.addClass(e);this._selectImg(u)},_shapeMouseDown:function(t){var i,f;t.preventDefault();i=this.XLObj;f=document.activeElement.id;i._isTouchEvt&&this._imgMouseMove(t);(f.indexOf("PictureHeight")>-1||f.indexOf("PictureWidth")>-1)&&i.setSheetFocus();var u,s=t.target.id,r=n(t.target),h=r.get(0),e=h.offsetLeft,o=h.offsetTop,c=i._setXY(t);this._selectImg(r);this._picCellIdx=this._getCellIndexFromOffset(o,e);this._imgOffsetleft=e;this._imgOffsetTop=o;this._imgX=c[0];this._imgY=c[1];this._shapeType=s.indexOf("chart")>-1?"chart":"img";r.css("cursor")==="move"?this._shapeROStart=!0:(r.css("cursor")==="col-resize"||r.css("cursor")==="row-resize")&&(this._shapeRSStart=!0,i._getContent(i.getActiveSheetIndex()).find(".e-ss-imgvisual").css({left:e,top:o,height:r.height(),width:r.width()}));this._shapeType==="chart"&&(u=i.XLChart._getShapeObj(s,this._shapeType),i.getActiveSheetIndex()===u.dataSheetIdx&&i.XLChart._focusChartRange(u.xAxis.range,u.yAxis.range,u.legend.range));i.model.enableContextMenu&&i.XLCMenu._isMenuOpened&&i.XLCMenu.hideCMenu()},_imgKeyDown:function(n){var r=this.XLObj,s=r.getActiveSheetIndex(),t=r._getContent(s).find(".e-ss-activeimg"),i=t.get(0),e=i.offsetLeft,o=i.offsetTop,u,f,h;if(this._shapeType=t[0].id.indexOf("chart")>-1?"chart":"img",this._picCellIdx=this._getCellIndexFromOffset(o,e),n.shiftKey||n.ctrlKey)n.shiftKey&&!n.ctrlKey&&(n.keyCode===39||n.keyCode===38?(n.preventDefault(),u=t.height()+2,f=t.width()+2,u<400&&f<600&&t.css({width:f,height:u}),this._updateShapeObj(i),r.XLRibbon._formatTabUpdate()):(n.keyCode===37||n.keyCode===40)&&(n.preventDefault(),u=t.height()-2,f=t.width()-2,u>40&&f>60&&t.css({width:f,height:u}),this._updateShapeObj(i),r.XLRibbon._formatTabUpdate()));else{switch(n.keyCode){case 39:n.preventDefault();t.css({left:e+2});this._updateShapeObj(i);break;case 37:n.preventDefault();e>1&&t.css({left:e-2});this._updateShapeObj(i);break;case 38:n.preventDefault();o>1&&t.css({top:o-2});this._updateShapeObj(i);break;case 40:n.preventDefault();t.css({top:o+2});this._updateShapeObj(i)}this._onKeyscrollShape(s,t,n)}n.keyCode===46&&(n.preventDefault(),h=!1,r.XLClipboard._isShape&&(r.XLClipboard._isShape=!1,h=!0),this._deleteShape(s,t),h&&(r.XLClipboard._isShape=!0))},_shapeMouseUp:function(t){var r=this.XLObj,o={};if(!r._isExport){var l,a,c="chart",f,s=r.getActiveSheetIndex(),v=r.getSheet(s),y=r._getContent(s),u=y.find(".e-ss-activeimg"),h=y.find(".e-ss-imgvisual"),e=n(t.target),i=e.get(0);if((e.hasClass("e-ss-picture")||e[0].id.indexOf(r._id+"_picture")>-1)&&r.model.showRibbon&&r.XLRibbon._formatTabUpdate(),i.id.indexOf(c)>-1&&i.id.indexOf("Ribbon")<0&&(i=i.id.indexOf("_svg")>-1?n(i).parents(".e-ss-object").get(0):i),u.length<1&&(this._shapeROStart=!1),i.className.indexOf("e-ss-imgvisual")>-1||i.className.indexOf("e-ss-object")>-1||(this._shapeROStart&&(i=u[0]),this._shapeRSStart&&(i=h[0])),this._shapeROStart)r._isTouchEvt&&(a=r._getOriginalEvt(t),i=document.elementFromPoint(a.clientX,a.clientY)),r._isUndoRedo||(parseInt(u.css("top"))!==i.offsetTop||parseInt(u.css("left"))!==i.offsetLeft)&&(f={sheetIndex:s,reqType:"shape",shapeType:"chart",action:"edit",actionType:"reorder",id:n(u).attr("id"),visualImg:h,trgt:e},f.prev={top:parseInt(u.css("top")),left:parseInt(u.css("left")),height:parseInt(u.css("height")),width:parseInt(u.css("width"))},f.cur={top:i.offsetTop,left:i.offsetLeft,height:e.height(),width:e.width()},u[0].id.indexOf(c)>-1&&(l=r._getIdxWithOffset(f.cur.top,f.cur.left,!0),v.shapeMngr[c][u[0].id].rowIndex=l.rowIdx,v.shapeMngr[c][u[0].id].colIndex=l.colIdx),r._checkIndicesInContainer(s,this._picCellIdx.rowIndex,this._picCellIdx.colIndex)&&(f.obj=n.extend(!0,{},r._dataContainer.sheets[s][this._picCellIdx.rowIndex][this._picCellIdx.colIndex]),r._completeAction(f),r._trigActionComplete(f))),u.css({left:i.offsetLeft,top:i.offsetTop}),this._updateShapeObj(i),h.removeClass("e-ss-picture").hide();else if(this._shapeRSStart&&(r._isUndoRedo||(r._isTouchEvt&&(i=h[0]),i.className.indexOf("e-ss-imgvisual")<0&&h.length>0&&this._shapeROStart&&(i=h[0]),e=n(i),(parseInt(u.css("height"))!==e.height()||parseInt(u.css("width"))!==e.width())&&r._checkIndicesInContainer(s,this._picCellIdx.rowIndex,this._picCellIdx.colIndex)&&(f={sheetIndex:s,reqType:"shape",shapeType:"chart",action:"edit",actionType:"resize",id:n(u).attr("id"),visualImg:h,trgt:e},f.prev={top:parseInt(u.css("top")),left:parseInt(u.css("left")),height:parseInt(u.css("height")),width:parseInt(u.css("width"))},f.cur={top:i.offsetTop,left:i.offsetLeft,height:e.height(),width:e.width()},f.obj=n.extend(!0,{},r._dataContainer.sheets[s][this._picCellIdx.rowIndex][this._picCellIdx.colIndex]),r._completeAction(f),r._trigActionComplete(f))),f&&u.css({left:i.offsetLeft,top:i.offsetTop,height:e.height(),width:e.width()}),this._updateShapeObj(i),h.removeClass("e-ss-picture").hide(),this._shapeType==="img"&&r.model.showRibbon&&r.XLRibbon._formatTabUpdate(),this._shapeType===c&&(r.XLChart.resizeChart(u.attr("id"),e.height(),e.width()),r.model.showRibbon&&r.XLRibbon._chartDesignTabUpdate(n("#"+u.attr("id")))),o.event=t,o.target=t.target,f&&f.cur&&f.prev&&(o.newHeight=f.cur.height,o.newWidth=f.cur.width,o.oldHeight=f.prev.height,o.oldWidth=f.prev.width),o.reqType=i.id.indexOf(c)>-1?"chart-resize":"picture-resize",this.XLObj._trigger("resizeEnd",o))){this._refreshImgResizing();this._shapeRSStart=!1;return}this._refreshImgResizing();this._shapeROStart=this._shapeRSStart=!1}},_imgMouseMove:function(n){var i=this.XLObj,s={};if(i._getContent(i.getActiveSheetIndex()).find(".e-ss-activeimg").length){n.preventDefault();var p=i.getActiveSheetIndex(),h=i._getContent(p),u=h.find(".e-ss-activeimg"),t=h.find(".e-ss-imgvisual"),c=u.get(0),o=c.getBoundingClientRect(),w=i._setXY(n),f=w[0],e=w[1],r,l,a;if(this._shapeROStart){if(this.XLObj._trigger("dragShape",n))return;t.show();c.id.indexOf("picture")>-1&&t.addClass("e-ss-picture");l=f-(this._imgX-this._imgOffsetleft);a=e-(this._imgY-this._imgOffsetTop);l>-1&&a>-1&&t.css({left:l,top:a,height:u.height(),width:u.width()})}else{var v=t.width(),y=t.height(),b=c.offsetWidth,k=c.offsetHeight,d=i._getJSSheetContent(p).find(".e-spreadsheetcontentcontainer > .e-content"),g=h.find(".e-hscrollbar").data("ejScrollBar"),nt=h.find(".e-vscrollbar").data("ejScrollBar");if(this._shapeRSStart){if(s.event=n,s.target=n.target,s.height=u.height(),s.width=u.width(),s.reqType=c.id.indexOf("chart")>-1?"chart-resize":"picture-resize",this.XLObj._trigger("resizeStart",s)){this._shapeRSStart=!1;return}if(t.show(),c.id.indexOf("picture")>-1&&t.addClass("e-ss-picture"),u.css("cursor")==="col-resize"||u.css("cursor")==="row-resize")switch(!0){case this._imgRSWStart:r=this._imgX-f;l=t[0].offsetLeft-r;l>-1&&(t.css({width:v+r,left:l}),this._imgX=f);break;case this._imgRSEStart:r=this._imgX-f;i.model.scrollSettings.allowScrolling&&v-r+t[0].offsetLeft+5<d.width()+g.value()&&(t.css({width:v-r}),this._imgX=f);break;case this._imgRSNStart:r=this._imgY-e;a=t[0].offsetTop-r;a>-1&&(t.css({height:y+r,top:a}),this._imgY=e);break;case this._imgRSSStart:r=this._imgY-e;i.model.scrollSettings.allowScrolling&&y-r+t[0].offsetTop+5<d.height()+nt.value()&&(t.css({height:y-r}),this._imgY=e)}}else this._refreshImgResizing(),f<=o.left+(i._isTouchEvt?20:4)&&f>=o.left?(u.addClass("e-ss-imgcresize"),this._imgRSWStart=!0):f<=o.left+b&&f>=o.left+b-(i._isTouchEvt?20:4)?(u.addClass("e-ss-imgcresize"),this._imgRSEStart=!0):h.find(".e-ss-imgcresize").removeClass("e-ss-imgcresize"),e<=o.top+(i._isTouchEvt?20:4)&&e>=o.top?(u.addClass("e-ss-imgrresize"),this._imgRSNStart=!0):e<=o.top+k&&e>=o.top+k-(i._isTouchEvt?20:4)?(u.addClass("e-ss-imgrresize"),this._imgRSSStart=!0):h.find(".e-ss-imgrresize").removeClass("e-ss-imgrresize")}}},_deleteShape:function(n,t){var l,i=this.XLObj,r=this._picCellIdx,s=i._dataContainer,a=i.getSheet(n),h=a.shapeMngr,e=s.sheets[n][r.rowIndex][r.colIndex],o,p=t.data("parentID"),v=t.get(0).id.replace(p+"_",""),u=v.replace(/[0-9]/g,""),c=t.get(0),y,f=h[u][e[u][0]];i._isUndoRedo||i._isPaste||i.XLClipboard._isShape||(o={sheetIndex:n,id:c.id,picIndex:c.id,reqType:"shape",shapeType:u,action:"create",options:f,range:f.range,img:h.sharedPics[f.data],bcolor:f.bcolor,bstyle:f.bstyle,bwidth:f.bwidth},o.actCell={rowIndex:r.rowIndex,colIndex:r.colIndex},o.position={height:f.height,width:f.width,top:f.top,left:f.left},o.cnt=v.replace(/[a-z]/g,""),i._completeAction(o),i._trigActionComplete(o));e[u].some(function(n,t){return c.id===h[u][e[u][t]].id?(y=t,!0):!1});Object.keys(e).length<2&&e[u].length<2?(delete s.sheets[n][r.rowIndex][r.colIndex],i.getObjectLength(s.sheets[n][r.rowIndex])<1&&delete s.sheets[n][r.rowIndex]):e[u].length<2?delete e[u]:e[u].splice(y,1);delete h[u][c.id];l={rowIndex:r.rowIndex,colIndex:r.colIndex};n===i._getSheetIndex()&&(i.setActiveCell(r.rowIndex,r.colIndex),i.performSelection(l,l));t.remove();i.model.allowFormulaBar&&i.updateFormulaBar();i.model.showRibbon&&(u==="picture"?i.XLRibbon._toggleFormatTab():i.XLRibbon._toggleChartDesignTab());a._isChartBorderDrawn&&i.XLChart._clearChartRange(i._arrayAsString(i._chartBorder))},_selectImg:function(n){this.XLObj._getContent(this.XLObj.getActiveSheetIndex()).find(".e-ss-activeimg").removeClass("e-ss-activeimg");n.addClass("e-ss-activeimg");this.XLObj.XLSelection._cleanUp(!0);this.XLObj.model.allowFormulaBar&&this.XLObj.updateFormulaBar()},_refreshImgResizing:function(){this._imgRSEStart=!1;this._imgRSWStart=!1;this._imgRSNStart=!1;this._imgRSSStart=!1},_getShapePropeties:function(n,t,i){for(var r,u=this.XLObj.XLEdit.getPropertyValue(n.rowIndex,n.colIndex,i);r in u;)return u[r].id===t?u[r]:void 0},_updateShapeMngr:function(t,i,r,u){var s,h={},f=this.XLObj,o=u||f.getActiveSheetIndex(),e=f.getSheet(o).shapeMngr,c=e[r];c[i[r].id]=n.extend(!0,{},i[r]);r==="picture"&&(e.sharedPics.indexOf(i[r].data)<0&&e.sharedPics.push(i[r].data),s=e.sharedPics.indexOf(i[r].data),c[i[r].id].data=s);(f._isPaste||this._insertShape||f.XLClipboard._isShape||f.isImport||!f.getSheet(o)._isUpdated)&&(h[r]=i[r].id,f.XLEdit._updateDataContainer(t,{dataObj:h,sheetIdx:o}),this._insertShape=!1)},_updateShapeObj:function(t){var f,e=this.XLObj,s=e.getActiveSheetIndex(),h=e._dataContainer,o,u,r=this._shapeType==="img"?"picture":"chart",i=this._picCellIdx,l=e.getSheet(s).shapeMngr,c,a={},v=e._getContent(s).find(".e-ss-activeimg");(e.getObjectLength(this._picCellIdx)||(i=this._picCellIdx=this._getCellIndexFromOffset(t.offsetTop,t.offsetLeft)),f=v.length?v:n("#"+t.id),u=h.sheets[s][i.rowIndex][i.colIndex],u&&u[r])&&(o=l[r][f[0].id],u[r].some(function(n,t){return f[0].id===l[r][u[r][t]].id?(c=t,!0):!1}),a[r]=u[r][c],e.getObjectLength(u)<2&&u[r].length<2?delete h.sheets[s][i.rowIndex][i.colIndex]:u[r].length<2?delete h.sheets[s][i.rowIndex][i.colIndex][r]:h.sheets[s][i.rowIndex][i.colIndex][r].splice(c,1),this._picCellIdx=i=this._getCellIndexFromOffset(t.offsetTop,t.offsetLeft),o.height=f.height(),o.width=f.width(),o.left=f[0].offsetLeft,o.top=f[0].offsetTop,o.rowIndex=i.rowIndex,o.colIndex=i.colIndex,e.XLEdit._updateDataContainer({rowIndex:i.rowIndex,colIndex:i.colIndex},{dataObj:a}))},changePictureBorder:function(i,r,u,f){var e=this.XLObj,v=e.getActiveSheetIndex(),o=n("#"+i)[0],y=o.offsetLeft,p=o.offsetTop,s,w=this._getCellIndexFromOffset(p,y),b=e.getSheet(v).shapeMngr,l,k,a=new RegExp("\\be-shapebdr.*?\\b","g"),h,c;l=b.picture[o.id];s={sheetIndex:v,reqType:"shape",shapeType:"picture",action:"border",id:n(e.getSheetElement(v).find(".e-ss-activeimg")).attr("id"),prevClass:t.isNullOrUndefined(o.className.match(a))?o.className:o.className.match(a)[0],picIdx:k,cellIdx:w};h=r+" "+u+" "+f;c=this._getImgBorderHashCode({"border-color":f,"border-style":u,"border-width":r});e.model.allowCellFormatting&&e.XLFormat._writeCssRules(c,e.XLFormat._getCssPropertyAsString({border:{left:h,right:h,top:h,bottom:h}}));l.bcolor=f;l.bstyle=u;l.bwidth=r;o.className.match(a)&&(o.className=o.className.replace(a,""));n(o).addClass(c);s.curClass=c;s.borderProp=this._getImgStyleFromHashCode(c);e._dupDetails||e._isUndoRedo||(e._completeAction(s),e._trigActionComplete(s))},_getCellIndexFromOffset:function(n,i,r,u){var f,h,o=0,s={},c=this.XLObj,e=c.getSheet(c._getSheetIndex(r));if(!t.isNullOrUndefined(n))for(s.rowIndex=c._getMinRowIdx(e),f=0,h=e._rowHeightCollection.length;f<h;f++)if(o=e._rowHeightCollection[f],o>n){s.rowIndex=f-1;break}if(!t.isNullOrUndefined(i))for(s.colIndex=0,f=0,o=0,h=e.columnsWidthCollection.length;f<h;f++)if(o+=e.columnsWidthCollection[f]===0&&u?e.hideColsCollection[f]:e.columnsWidthCollection[f],o>i){s.colIndex=f;break}return s},_getImgBorderHashCode:function(n){var i=this.XLObj,t="";return"border-width"in n&&(t=parseInt(n["border-width"])+"N"),i.model.allowCellFormatting&&"border-style"in n&&(t=t+i.XLFormat._getStyleCode("BorderStyle",n["border-style"])+"N"),"border-color"in n&&(t=t+n["border-color"].replace("#","")),"e-shapebdr"+t},_getImgStyleFromHashCode:function(n){var i=this.XLObj,t={};return n=n||"",n=n.replace("e-shapebdr","").split("N"),n.length>1&&(t["border-width"]=n[0]+"px",t["border-style"]=["","solid","dashed","dotted"][n[1]],t["border-color"]="#"+n[2]),t},_scrollShape:function(n,t,i,r){var f={position:"none",action:"none"},u=this.XLObj,e=u._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content");parseInt(t.css("width"))+(t.offset().left-u._getContent(n).find(".e-content").offset().left)>u._getContent(n).find(".e-content").width()&&this._imgX<=i?f={position:"horizontal",action:"Increment"}:t.offset().left-e.offset().left<=0?f={position:"horizontal",action:"Decrement"}:parseInt(t.css("height"))+(t.offset().top-u._getContent(n).find(".e-content").offset().top)>u._getContent(n).find(".e-content").height()&&this._imgY<=r?f={position:"vertical",action:"Increment"}:t.offset().top-e.offset().top<=0&&(f={position:"vertical",action:"Decrement"});u.XLSelection._scrollCalculation(n,t.get(0),f)},_onKeyscrollShape:function(n,t,i){var r=this.XLObj,u=r._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content"),f=r._getContent(n).find("#hscrollBar").ejScrollBar("instance"),e=r._getContent(n).find("#vscrollBar").ejScrollBar("instance");u.offset().top+u[0].offsetHeight<=t.offset().top+t[0].offsetHeight&&(i.keyCode===40||i.keyCode===13&&!i.shiftKey)?e.scroll(e.value()+2,!0):t.offset().top-r.model.sheets[n]._frozenHeight<=u.offset().top&&(i.keyCode===38||i.keyCode===13&&i.shiftKey)&&e.value()-2>=0&&e.scroll(e.value()-2,!0);u[0].offsetWidth<=t.offset().left+t[0].offsetWidth&&(i.keyCode===39||i.keyCode===9&&!i.shiftKey)?f.scroll(f.value()+2,!0):t.offset().left-r.model.sheets[n]._frozenWidth<=u.offset().left&&(i.keyCode===37||i.keyCode===9&&i.shiftKey)&&f.value()-2>=0&&f.scroll(f.value()-2,!0)}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.chart=function(n){this.XLObj=n;this._shapeCnt=1};t.spreadsheetFeatures.chart.prototype={createChart:function(n,i){var r=this.XLObj;if(r.model.allowCharts&&!r.model.isReadOnly){i=i||{};var o,e,f,c,l,u,s,a="chart",v,y=r._getSheetIndex(i.sheetIdx),h=r.getSheet(y),p;if(r._isUndoRedo&&(p=i.id.split("_"),o=p[p.length-1].replace(/[a-z]/g,"")),n=r._getRangeArgs(n,"object"),t.isNullOrUndefined(i.top)||t.isNullOrUndefined(i.left)||(i.activeCell=r.XLShape._getCellIndexFromOffset(i.top,i.left)),i.activeCell||(i.activeCell=h._activeCell),r.isRange(n)&&i.activeCell)return l=r._getCellInfo(i.activeCell),i.id=o?r._id+"_"+a+o:r._id+"_"+a+this._shapeCnt,i.type=i.type?i.type:"column",i.animation=i.animation?i.animation:!1,i.range=n,i.dataSheetIdx=i.dataSheetIdx?i.dataSheetIdx:y,i.height=i.height?i.height:r.model.chartSettings.height,i.width=i.width?i.width:r.model.chartSettings.width,i.top=i.top?i.top:l.top+2,i.left=i.left?i.left:l.left+2,i.isRowColSwitched=i.isRowColSwitched?i.isRowColSwitched:!1,v=r._getIdxWithOffset(i.top,i.left,!0),i.rowIndex=v.rowIdx,i.colIndex=v.colIdx,i.isResponsive=!1,i.canResize=!1,r.isUndefined(i.xRange)&&(s=this._processChartRange(n,i.dataSheetIdx),i.xRange=s.xRange,i.yRange=s.yRange,i.lRange=s.lRange),f=this._processChartSeries(i),i.series&&(r.XLClipboard._copyCells.length||r.XLClipboard._copyCells.length)&&(f.series=i.series),i.xRange=f.xRange,i.yRange=f.yRange,i.lRange=f.lRange,r.getActiveSheetIndex()===i.dataSheetIdx&&this._focusChartRange(f.xRange,f.yRange,f.lRange),e=this._renderBaseElem(a,i.top,i.left,o),e.ejChart(this._processChartOptions(i,f.series)),this._afterChartRefresh(),u=e.ejChart("model"),i.theme=u.theme,i.title={text:u.title.text.length?u.title.text:"",align:u.title.textAlignment},i.xAxis={min:u.primaryXAxis.range.min,max:u.primaryXAxis.range.max,interval:u.primaryXAxis.range.interval,title:{text:u.primaryXAxis.title.text.length?u.primaryXAxis.title.text:""},range:f.xRange},i.yAxis={min:u.primaryYAxis.range.min,max:u.primaryYAxis.range.max,interval:u.primaryYAxis.range.interval,title:{text:u.primaryYAxis.title.text.length?u.primaryYAxis.title.text:""},range:f.yRange},i.legend={visible:u.legend.visible,range:f.lRange,position:u.legend.position},h._isImported||(r.XLShape._insertShape=!0),r.XLShape._updateShapeMngr(i.activeCell,{chart:i},"chart"),i.theme.indexOf("dark")>-1&&e.addClass("e-ss-charttheme"),r.model.showRibbon&&!i.hideTab&&r.XLRibbon._chartDesignTabUpdate(e),r._on(e,t.eventType.mouseDown,r._mouseDownHandler),r._on(e,t.eventType.mouseMove,r._mouseMove),r.setSheetFocus(),r._isSheetNavigate||h._isImported&&!h._isLoaded||r._isUndoRedo||r._isPaste||r.XLClipboard._isShape||(c={sheetIndex:y,reqType:"shape",shapeType:"chart",action:"remove",options:i,range:i.range,id:i.id,position:{top:i.top,left:i.left}},r._completeAction(c),r._trigActionComplete(c)),i.id}},resizeChart:function(i,r,u){var f={},e=n("#"+i),o=e.ejChart("model"),s=this.XLObj;s.model.isReadOnly||e.length&&(f.height=!t.isNullOrUndefined(r)&&r>180?r.toString():"180",f.width=!t.isNullOrUndefined(u)&&u>180?u.toString():"180",e.ejChart("option",{size:f}),this._afterChartRefresh(),s.XLRibbon._setShapeWidthHeight({height:o.size.height,width:o.size.width,shapeType:"chart"}))},refreshChart:function(t,i){var e=this.XLObj,r,u,f;if(e.model.allowCharts&&!e.model.isReadOnly&&(u="marker",f=this._getShapeObj(t,"chart"),f)){for(r in i)f[r]=i[r];i.type&&(i.commonSeriesOptions={type:i.type},delete i.type);u in i&&(i.commonSeriesOptions?i.commonSeriesOptions.marker={visible:i.marker.visible}:i.commonSeriesOptions={marker:i.marker},delete i[u]);n("#"+t).ejChart("option",i)}},_processChartOptions:function(n,t){var r=yVisiblity=!1,i={commonSeriesOptions:{type:n.type,enableAnimation:n.animation},series:t,canResize:n.canResize,size:{height:n.height.toString(),width:n.width.toString()},enableRotation:!1,depth:100,wallSize:2,tilt:0,rotation:34,perspectiveAngle:90,sideBySideSeriesPlacement:!0};return n.enable3D&&(i.enable3D=!0),n.marker&&(i.commonSeriesOptions.marker=n.marker),n.theme&&(i.theme=n.theme),i.title=n.title||{},this.XLObj.getObjectLength(i.title)>0&&(i.title.textAlignment=n.title.align,delete i.title.align),i.legend=n.legend||{},n.xAxis&&n.xAxis.minorGridLines&&(r=n.xAxis.minorGridLines.visible),n.yAxis&&n.yAxis.minorGridLines&&(yVisiblity=n.yAxis.minorGridLines.visible),i.primaryYAxis=n.primaryYAxis||{labelFormat:this._chartYAxisFormat(n.yRange),minorTicksPerInterval:5,minorGridLines:{visible:yVisiblity},minorTickLines:{visible:!1}},i.primaryXAxis=n.primaryXAxis||{labelFormat:this._chartYAxisFormat(n.xRange),minorTicksPerInterval:5,minorGridLines:{visible:r},minorTickLines:{visible:!1},valueType:"category"},i},_chartYAxisFormat:function(n){if(!t.isNullOrUndefined(n)){var u=this.XLObj,i,r=t.globalize.preferredCulture().numberFormat.currency.symbol;return i=u.XLEdit.getPropertyValue(n[0],n[1],"type"),i==="accounting"?r+" {value}":i==="currency"?r+"{value}":i==="percentage"?"{value}%":"{value}"}},_processChartRange:function(n,i){var s=this.XLObj,l,f,h,r=n[0],u=n[1],o=n[2],e=n[3],c=s.XLEdit.getPropertyValue(r,e,null,i),y=s.XLEdit.getPropertyValue(o,u,null,i),p=s.XLEdit.getPropertyValue(r,u,null,i),a=r===o,v=u===e;return!s.isUndefined(p)||a||v?t.isNullOrUndefined(y)||s.isNumber(y)||a||v?(f=[r,u,o,e],t.isNullOrUndefined(c)||s.isNumber(c)||s._isDateTime(c)?t.isNullOrUndefined(p)&&(a||v)&&(h=[r,u,r,e],a?(f[1]=f[1]+1,h[3]=h[1]):f[0]=f[0]+1):(h=[r,u,r,e],f[0]=f[0]+1)):t.isNullOrUndefined(c)||s.isNumber(c)?(l=[r,u,o,u],f=[r,u+1,o,e]):(l=[r+1,u,o,u],f=[r+1,u+1,o,e],h=[r,u+1,r,e]):(l=[r+1,u,o,u],f=[r+1,u+1,o,e],h=[r,u+1,r,e]),{xRange:l,yRange:f,lRange:h}},_processChartSeries:function(n){n=n||{};var t=this.XLObj,a,b,i=n.xRange,r=n.yRange,u=n.lRange,f,k,e,o,v,y,p,w,s,d,h=0,c=0,g=[],l=["value2"];for(k=t.getRangeData({range:r,valueOnly:!0,sheetIdx:n.dataSheetIdx,skipFormula:!0}),v=r[2]-r[0]+1,y=r[3]-r[1]+1,n.isRowColSwitched?(f=u?t._toArrayData(t.getRangeData({range:u,property:l,sheetIdx:n.dataSheetIdx})):this._getVirtualXValues(y+1),i&&(e=t._toArrayData(t.getRangeData({range:i,property:l,sheetIdx:n.dataSheetIdx}))),o=v):(f=i?t._toArrayData(t.getRangeData({range:i,property:l,sheetIdx:n.dataSheetIdx})):this._getVirtualXValues(v+1),u&&(e=t._toArrayData(t.getRangeData({range:u,property:l,sheetIdx:n.dataSheetIdx}))),o=y),b=f.length,d=n.isRowColSwitched?1:o;h<o;){for(s=0,p=[],c=n.isRowColSwitched?c:h;s<b;)a=k[c],p.push({x:f[s],y:t.isNumber(a)?Number(a):0}),c+=d,s++;w={points:p};e&&(w.name=e[h]);g.push(w);h++}return{series:g,xRange:n.isRowColSwitched?u:i,yRange:r,lRange:n.isRowColSwitched?i:u}},_getVirtualXValues:function(n){for(var t=1,i=[];t<n;)i.push(t.toString()),t++;return i},_focusChartRange:function(n,t,i){var r=this.XLObj,u=r._chartBorder;this._clearChartRange(r._arrayAsString(u));i&&r.XLSelection._focusBorder({rowIndex:i[0],colIndex:i[1]},{rowIndex:i[2],colIndex:i[3]},u[0]);n&&r.XLSelection._focusBorder({rowIndex:n[0],colIndex:n[1]},{rowIndex:n[2],colIndex:n[3]},u[1]);r.XLSelection._focusBorder({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]},u[2]);r.getSheet(r.getActiveSheetIndex())._isChartBorderDrawn=!0},_clearChartRange:function(n){var t=this.XLObj;t.XLSelection._clearBorder(n);t.getSheet(t.getActiveSheetIndex())._isChartBorderDrawn=!1},_renderBaseElem:function(i,r,u,f){f=t.isNullOrUndefined(f)?this._shapeCnt:f;var e=this.XLObj,o=n("<div id='"+e._id+"_"+i+f+"' class='e-ss-object' style='top:"+r+"px;left:"+u+"px; min-height:180px; min-width:180px' ><\/div>");return o.data("parentID",e._id),e._getContent(e.getActiveSheetIndex()).find(".e-content").first().append(o),e.XLShape._selectImg(o),e._isUndoRedo||this._shapeCnt++,o},_refreshChartElements:function(n,t,i){for(var u,f,r,e=this.XLObj,o=1,s=e.model.sheetCount+1;o<s;){if(u=e.getSheet(o).shapeMngr.chart,f=e.getObjectLength(u),f)while(f--)r=u[e.getObjectKeys(u)[f]],r.dataSheetIdx===i&&(this.XLObj.inRange(r.range,n,t)||this.XLObj._inRow(r.range,n)||this.XLObj._inColumn(r.range,t))&&this._refreshChart(r);o++}},_refreshChart:function(t){if(n("#"+t.id).length!==0){var i=n("#"+t.id).data("ejChart"),u={xRange:t.xRange,yRange:t.yRange,lRange:t.lRange,isRowColSwitched:t.isRowColSwitched,dataSheetIdx:t.dataSheetIdx},r;i.model.series.length=0;r=this._processChartSeries(u);i.option({series:r.series,primaryXAxis:{labelFormat:this._chartYAxisFormat(t.xRange)},primaryYAxis:{labelFormat:this._chartYAxisFormat(t.yRange)}})}},switchRowColumn:function(t){var i=this.XLObj;if(!i.model.isReadOnly){var u,f=t||document.getElementById(i._id+"_chart").value,e=n("#"+f).ejChart("instance"),r=i.XLChart._getShapeObj(f,"chart"),o={sheetIndex:i.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:"srcolumn",cid:f,rowIndex:i.XLShape._picCellIdx.rowIndex,colIndex:i.XLShape._picCellIdx.colIndex};e.model.series.length=0;r.isRowColSwitched=!r.isRowColSwitched;obj={xRange:r.xRange,yRange:r.yRange,lRange:r.lRange,isRowColSwitched:r.isRowColSwitched,dataSheetIdx:r.dataSheetIdx};u=i.XLChart._processChartSeries(obj);e.option({series:u.series});i.getActiveSheetIndex()===r.dataSheetIdx&&i.XLChart._focusChartRange(u.xRange,u.yRange,u.lRange);r.xAxis.range=u.xRange;r.yAxis.range=u.yRange;r.legend.range=u.lRange;i._completeAction(o);i._trigActionComplete(o)}},updateChartElement:function(r,u,f){var o=this.XLObj;if(!o.model.isReadOnly){o._showDialog(o._id+"_chartname");var a,c=r||document.getElementById(o._id+"_chart").value,h,s,e=n("#"+c).ejChart("instance"),l=o.getActiveSheetIndex();details={sheetIndex:l,reqType:"shape",shapeType:"chart",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex};dataVal=o.getSheet(l).shapeMngr.chart[o.XLEdit.getPropertyValue(o.XLShape._picCellIdx.rowIndex,o.XLShape._picCellIdx.colIndex,"chart")[0]];f?h={model:{text:o._getLocStr("Ok")}}:f="";switch(u){case"PHAxis":details.visibility=!e.model.primaryXAxis.visible;e.option("primaryXAxis",{visible:details.visibility});dataVal.xAxis.visible=details.visibility;details.action=u;break;case"PVAxis":details.visibility=!e.model.primaryYAxis.visible;e.option("primaryYAxis",{visible:details.visibility});dataVal.yAxis.visible=details.visibility;details.action=u;break;case"PHAxisTitle":o._cOpt.prev={text:dataVal.xAxis.title.text};e.model.primaryXAxis.title.text.length!=0?(e.option("primaryXAxis",{title:{text:""}}),dataVal.xAxis.title.text="",details={sheetIndex:l,reqType:"shape",shapeType:"chart",action:"PX",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex,prev:{text:o._cOpt.prev.text},cur:{text:""}},o._completeAction(details),o._trigActionComplete(details)):(o._hasTitle="PX",document.getElementById(o._id+"_chartname").value=dataVal.xAxis.title.text,f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.xAxis.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f),o._cOpt={prevText:dataVal.title.text,prevAlign:e.model.title.textAlignment,curAlign:e.model.title.textAlignment});break;case"PVAxisTitle":o._cOpt.prev={text:dataVal.yAxis.title.text};e.model.primaryYAxis.title.text.length!=0?(e.option("primaryYAxis",{title:{text:""}}),dataVal.yAxis.title.text="",details={sheetIndex:l,reqType:"shape",shapeType:"chart",action:"PY",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex,prev:{text:o._cOpt.prev.text},cur:{text:""}},o._completeAction(details),o._trigActionComplete(details)):(o._hasTitle="PY",document.getElementById(o._id+"_chartname").value=dataVal.yAxis.title.text,f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.yAxis.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f),o._cOpt={prevText:dataVal.title.text,prevAlign:e.model.title.textAlignment,curAlign:e.model.title.textAlignment});break;case"CTNone":o._cOpt.prev={text:dataVal.title.text};e.model.title.text.length&&(e.option("title",{text:""}),dataVal.title.text="",details={sheetIndex:l,reqType:"shape",shapeType:"chart",action:"CT",cid:c,rowIndex:o.XLShape._picCellIdx.rowIndex,colIndex:o.XLShape._picCellIdx.colIndex,prev:{text:o._cOpt.prev.text},cur:{text:""}},o._completeAction(details),o._trigActionComplete(details));break;case"CTCenter":o._hasTitle="CT";o._cOpt={prevText:e.model.title.text,prevAlign:e.model.title.textAlignment};document.getElementById(o._id+"_chartname").value=dataVal.title.text;f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f);e.option("title",{textAlignment:"center"});o._cOpt.curAlign=e.model.title.textAlignment;dataVal.title.align="center";break;case"CTFar":o._hasTitle="CT";o._cOpt={prevText:e.model.title.text,prevAlign:e.model.title.textAlignment};document.getElementById(o._id+"_chartname").value=dataVal.title.text;f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f);e.option("title",{textAlignment:"far"});o._cOpt.curAlign=e.model.title.textAlignment;dataVal.title.align="far";break;case"CTNear":o._hasTitle="CT";o._cOpt={prevText:e.model.title.text,prevAlign:e.model.title.textAlignment};document.getElementById(o._id+"_chartname").value=dataVal.title.text;f.length<1?(n("#"+o._id+"_chartnamedlg").ejDialog("open"),n("#"+o._id+"_chartname").focus().setInputPos(dataVal.title.text.length)):o.XLRibbon._chartNameDlgBtnClick(h,f);e.option("title",{textAlignment:"near"});o._cOpt.curAlign=e.model.title.textAlignment;dataVal.title.align="near";break;case"DLNone":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},a=e.model.series[0].marker.dataLabel.visible,i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:a,verticalTextAlignment:"far",textPosition:"top"}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:a};dataVal.series=e.model.series;break;case"DLCenter":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"center",textPosition:"middle",offset:{y:0}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"center",tPosn:"middle"};dataVal.series=e.model.series;break;case"DLIBase":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"far",textPosition:"bottom",offset:{y:0}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"far",tPosn:"bottom"};dataVal.series=e.model.series;break;case"DLIEnd":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"near",textPosition:"top",offset:{y:-10}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"near",tPosn:"top"};dataVal.series=e.model.series;break;case"DLOEnd":for(s=[],details.action="DL",details.prev={series:n.extend(!0,[],e.model.series)},i=0;i<e.model.series.length;i++)s.push({marker:{dataLabel:{visible:!0,verticalTextAlignment:"near",textPosition:"top",offset:{y:0}}}});e.option({series:s});details.cur={series:n.extend(!0,[],e.model.series)};dataVal.dataLabel={visible:!0,vAlign:"near",tPosn:"top"};dataVal.series=e.model.series;break;case"PMajorH":details.visibility=!e.model.primaryYAxis.majorGridLines.visible;e.option("primaryYAxis",{majorGridLines:{visible:details.visibility}});dataVal.yAxis.majorGridLines={visible:details.visibility};details.action=u;break;case"PMajorV":details.visibility=!e.model.primaryXAxis.majorGridLines.visible;e.option("primaryXAxis",{majorGridLines:{visible:details.visibility}});dataVal.xAxis.majorGridLines={visible:details.visibility};details.action=u;break;case"PMinorH":details.visibility=!e.model.primaryYAxis.minorGridLines.visible;e.option("primaryYAxis",{minorGridLines:{visible:details.visibility},minorTicksPerInterval:5,minorTickLines:{visible:details.visibility}});dataVal.yAxis.minorGridLines={visible:details.visibility};details.action=u;break;case"PMinorV":details.visibility=!e.model.primaryXAxis.minorGridLines.visible;e.option("primaryXAxis",{minorGridLines:{visible:details.visibility},minorTicksPerInterval:5,minorTickLines:{visible:details.visibility}});dataVal.xAxis.minorGridLines={visible:details.visibility};details.action=u;break;case"LNone":details.visibility=!1;e.option("legend",{visible:details.visibility});dataVal.legend.visible=details.visibility;details.action=u;break;case"LLeft":details.prev={position:e.model.legend.position};e.option("legend",{position:"left",visible:!0});dataVal.legend.position="left";details.cur={position:e.model.legend.position};details.action="Legend";break;case"LRight":details.prev={position:e.model.legend.position};e.option("legend",{position:"right",visible:!0});dataVal.legend.position="right";details.cur={position:e.model.legend.position};details.action="Legend";break;case"LBottom":details.prev={position:e.model.legend.position};e.option("legend",{position:"bottom",visible:!0});dataVal.legend.position="bottom";details.cur={position:e.model.legend.position};details.action="Legend";break;case"LTop":details.prev={position:e.model.legend.position};e.option("legend",{position:"top"});dataVal.legend.position="top";details.cur={position:e.model.legend.position};details.action="Legend"}t.isNullOrUndefined(details.action)||(o._completeAction(details),o._trigActionComplete(details))}},changeTheme:function(t,i){var r=this.XLObj,t=t||r.element.find("#"+r._id+"_chart").val(),u;u={sheetIndex:r.getActiveSheetIndex(),reqType:"shape",action:"chartTheme",chartId:t};u.prev={theme:n("#"+t).data("ejChart").model.theme};i&&i.indexOf("dark")>-1?n("#"+t).addClass("e-ss-charttheme"):n("#"+t).removeClass("e-ss-charttheme");r.XLChart.refreshChart(t,{theme:i});u.cur={theme:i};r._completeAction(u);r._trigActionComplete(u)},changeType:function(t,i){var u=this.XLObj,r=n("#"+t).data("ejChart"),f={sheetIndex:u.getActiveSheetIndex(),reqType:"shape",shapeType:"chart",action:"chartType",chartId:t};f.prev={chartType:r.model.series[0].type,enable3D:r.model.enable3D,marker:r.model.series[0].marker.visible};u.XLChart.refreshChart(t,i);f.cur={chartType:r.model.series[0].type,enable3D:r.model.enable3D,marker:r.model.series[0].marker.visible};n("#"+u._id+"_charttypedlg").ejDialog("close");u._completeAction(f);u._trigActionComplete(f)},_getShapeObj:function(n,t){var i=this.XLObj,r=i.getSheet(i.getActiveSheetIndex()).shapeMngr[t],u=i.getObjectLength(r);if(u)return r[n]},_validateChartRange:function(n,t,i,r){var u=this.XLObj;if(!i)return{msg:u._getLocStr("YAxisMissing")};if(!(u.inRange(n,i[0],i[1])||u.inRange(n,i[2],i[3])))return{msg:u._getLocStr("InvalidYAxis")};if(t)if(u.inRange(n,t[0],t[1])||u.inRange(n,n[2],n[3])){if(t[3]-t[1]!=0)return{msg:u._getLocStr("InvalidXAxisColumns")}}else return{msg:u._getLocStr("InvalidXAxis")};return r&&!(u.inRange(n,r[0],r[1])||u.inRange(n,r[2],r[3]))?{msg:u._getLocStr("InvalidLegend")}:{status:!0}},_renderChartRangeDialog:function(){var t=this.XLObj,i={width:"25%",showRoundedCorner:!0,click:n.proxy(this._chartRangeDlgBtnClick,this)},r=n("<div id='"+t._id+"_chartrangedlg'><div class='e-dlgctndiv e-dlg-fields'><table cellpadding='0' cellspacing='0'><tr class='e-dlgtd-fields'><td>"+t._getLocStr("XAxisRange")+"<\/td><td><input type='text' class='ejinputtext' id='"+t._id+"_crxaxis'/><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+t._getLocStr("YAxisRange")+"<\/td><td><input type='text' class='ejinputtext' id='"+t._id+"_cryaxis' /><\/td><\/tr><tr class='e-dlgtd-fields'><td>"+t._getLocStr("LegendRange")+"<\/td><td><input type='text' class='ejinputtext' id='"+t._id+"_crlaxis'/><\/td><\/tr><\/table><\/div><div class='e-dlg-btnfields' ><div class='e-dlg-btnctnr'><button id='"+t._id+"_crok' >"+t._getLocStr("Ok")+"<\/button><button id='"+t._id+"_crcancel'>"+t._getLocStr("Cancel")+"<\/button><\/div><\/div><\/div>");t.element.append(r);r.ejDialog({width:310,height:"auto",enableResize:!1,showOnInit:!1,enableModal:!0,cssClass:"e-ss-dialog e-"+t._id+"-dlg e-ss-chartrange",title:t._getLocStr("ChartRange")});n("#"+t._id+"_crok").ejButton(i);n("#"+t._id+"_crok").ejButton("option","cssClass","e-ss-okbtn");n("#"+t._id+"_crcancel").ejButton(i)},_chartRangeDlgBtnClick:function(t){var r,u,f,e,i=this.XLObj;t.model.text===i._getLocStr("Ok")&&(r=document.getElementById(i._id+"_chart").value,u=n("#"+i._id+"_crxaxis").val(),f=n("#"+i._id+"_cryaxis").val(),e=n("#"+i._id+"_crlaxis").val(),this.changeDataRange(r,u,f,e));!0&&n("#"+i._id+"_chartrangedlg").ejDialog("close")},changeDataRange:function(t,i,r,u){var l,o,f=this.XLObj,w,s,h,c,v=f._getSheetIndex(f.getActiveSheetIndex()),y=f.getSheet(v),a,p,e;o=this._getShapeObj(t,"chart");i.length&&(s=f.getRangeIndices(i));r.length&&(h=f.getRangeIndices(r));u.length&&(c=f.getRangeIndices(u));p={xRange:i,yRange:r,lRange:u};l=this._validateChartRange(o.range,s,h,c);l.status?(o.xRange=s,o.yRange=h,o.lRange=c,this._refreshChart(o),e=n("#"+t).ejChart("model"),o.xAxis={min:e.primaryXAxis.range.min,max:e.primaryXAxis.range.max,interval:e.primaryXAxis.range.interval,title:{text:e.primaryXAxis.title.text.length?e.primaryXAxis.title.text:""},range:s},o.yAxis={min:e.primaryYAxis.range.min,max:e.primaryYAxis.range.max,interval:e.primaryYAxis.range.interval,title:{text:e.primaryYAxis.title.text.length?e.primaryYAxis.title.text:""},range:h},o.legend={visible:e.legend.visible,range:c},f.getActiveSheetIndex()===o.dataSheetIdx&&this._focusChartRange(s,h,c)):(w=!1,f._showAlertDlg("Alert","T-"+l.msg,"",400));y._isImported&&!y._isLoaded||f._isUndoRedo||f._isExport||(a={sheetIndex:v,reqType:"shape",shapeType:"chart",action:"selectData",id:t,prev:f._selectDataval,cur:p},f._completeAction(a),f._trigActionComplete(a))},_afterChartRefresh:function(){var t=this.XLObj,n,i;t.model.allowFormulaBar&&(n=t.element.find(".e-formulabar")[0],i=parseInt(n.style.width)-1,n.style.width="0px",n.style.width=i+"px")}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.print=function(n){this.XLObj=n;this._printHeight=950;this._pageHeight=970;this._pageWidth=750;this._marginTop=30;this._marginBottom=150;this._printRowLabels=!1;this._isPrintSelection=!1;this._stRow=0;this._stColumn=0};t.spreadsheetFeatures.print.prototype={_printSetting:function(n){this.XLObj.model.pageSize=n;switch(n){case t.Spreadsheet.pageSize.A4:this._printHeight=950;this._pageHeight=970;this._pageWidth=750;this._marginTop=30;this._marginBottom=150;break;case t.Spreadsheet.pageSize.A3:this._printHeight=1350;this._pageHeight=1330;this._pageWidth=860;this._marginTop=30;this._marginBottom=150;break;case t.Spreadsheet.pageSize.Letter:this._printHeight=1040;this._pageHeight=920;this._pageWidth=860;this._marginTop=30;this._marginBottom=60}},printSelection:function(){var i=this.XLObj;if(i.model.printSettings.allowPrinting&&!i.model.isReadOnly){var e,h,u=i.getActiveSheetIndex(),s=i.getSheet(u)._selectedCells,r=s[0],o=s[s.length-1],c=o.colIndex-r.colIndex,f=t.buildTag("table"),l=t.buildTag("colgroup"),v=i._getContent(u).find("col"),a=t.buildTag("div#printDiv");for(i._refreshTemplates(u,!0,r.colIndex,r.colIndex+c+1),i._isPrint=!0,e=r.colIndex;e<o.colIndex;e++)n(v[e].outerHTML).attr("id","cc").appendTo(l);h=i.getRangeData({range:[r.rowIndex,r.colIndex,o.rowIndex,o.colIndex],property:["value","value2","format","border","type","isFilterHide","isRHide","isFHide","isMHide","merge","hRow","wrap","overflow","align","hyperlink","cFormatRule","rule"],sheetIdx:u,withRowIdx:!0});f.html(i._renderData(h,u,r.colIndex,c+1,!0));l.insertBefore(f.find("tbody"));this._stRow=r.rowIndex;this._stCol=r.colIndex;this._isPrintSelection=!0;i._isPrint=!1;this._printRowLabels?this._calculateTabCount(a,u,f):this._constructSheet(a,u,f,f[0].rows);i._refreshTemplates(u,!0)}},printSheet:function(){var i=this.XLObj;if(i.model.printSettings.allowPrinting&&!i.model.isReadOnly){var e,o,s,h=t.buildTag("div#printDiv"),r=i.getActiveSheetIndex(),u=i.getSheet(r),l=u.columnsWidthCollection,a=i._getContent(r).find("col"),f=t.buildTag("table"),c=t.buildTag("colgroup");for(i._refreshTemplates(r,!0,0,u.usedRange.colIndex+1),i._isPrint=!0,e=0,o=l.length;e<o;e++)n(a[e].outerHTML).attr("id","cc").appendTo(c);s=i.getRangeData({range:[0,0,u.usedRange.rowIndex,u.usedRange.colIndex],property:["value","value2","format","border","type","isFilterHide","isRHide","isFHide","isMHide","merge","hRow","wrap","overflow","align","hyperlink","cFormatRule","rule"],sheetIdx:r,withRowIdx:!0});f.html(i._renderData(s,r,0,u.usedRange.colIndex+1,!0));c.insertBefore(f.find("tbody"));this._printRowLabels?this._calculateTabCount(h,r,f):this._constructSheet(h,r,f,f[0].rows);i._isPrint=!1;i._refreshTemplates(r,!0)}},_calculateTabCount:function(){for(var i=this.XLObj,u=[],t=0,r=i.getSheet(i.getActiveSheetIndex()).columnsWidthCollection,n=0,f=r.length;n<f;n++)t+=r[n],t>=this._pageWidth&&(u.push({tCount:1,cellCount:n}),t=0)},_calculateCellRowCount:function(n,t,i){for(var o=this.XLObj,b=o.getActiveSheetIndex(),s=o.getSheet(b),h=s.columnsWidthCollection,c=s.rowsHeightCollection,f,l=0,a=0,v=12,y=40,p=0,w=0,u,r=t,e=h.length;r<e;r++)if(l+=h[r],l>=this._pageWidth){w=v=r;break}else f=Math.floor((this._pageWidth-l)/s.columnWidth),w=v=h.length+f;for(u=i,e=c.length;u<e;u++)if(a+=c[u],a>=this._pageHeight){p=y=u;break}else f=Math.floor((this._pageHeight-a)/o.model.rowHeight),p=y=c.length+f;return{startCell:t,endCell:w,startRow:i,endRow:p,cellCount:v,rowCount:y}},_constructSheet:function(n,i,r,u){var o=t.buildTag("div .e-spreadsheet","",{}),c=t.buildTag("div .e-spreadsheetmainpanel","",{}),e=0,f=this._calculateCellRowCount(u,0,0),s=u[0].cells.length,h=u.length;e=Math.ceil(s/f.cellCount);e=e*Math.ceil(h/f.rowCount);e==1&&(f.rowCount=u.length);o.append(c);this._constructPrintableElement(i,n,o.find(".e-spreadsheetmainpanel"),r,u,h,s,e,f.cellCount,f.rowCount,f.startRow,f.startCell,f.endRow,f.endCell)},_constructPrintableElement:function(i,r,u,f,e,o,s,h,c,l,a,v,y,p){for(var ft,ct,d,lt,et=!1,ut,k=this.XLObj,g=k.getSheet(i),at=t.buildTag("div"),nt,kt,ot=!1,st,ht=!0,vt=!1,yt=!1,pt=0,tt,w,it,rt,wt,b,gt=k._getContent(i).find("col"),ni=g.columnsWidthCollection,dt=g.rowsHeightCollection,bt=h;bt>0;bt--){for(nt=this._calculateCellRowCount(e,v,a),v=nt.startCell,p=nt.endCell,a=nt.startRow,y=nt.endRow,c=nt.cellCount,l=nt.rowCount,ut=this._constructTable(i,v,p),g.showHeadings&&this._constructHeaders(v,p,y,ut),kt=this._isPrintSelection?a<this._stRow?this._stRow:a:a,w=a;w<y;w++){for(t.isNullOrUndefined(f[0].rows[w])?(ht=!1,d=t.buildTag("tr","",{height:k.model.rowHeight})):(st=dt[w],ht=!0,d=st>0?t.buildTag("tr","",{height:st}):t.buildTag("tr","",{height:k.model.rowHeight})),ht&&(vt=k.XLEdit.getPropertyValue(w,0,"isRHide"),t.isNullOrUndefined(vt)||k.addClass(d[0],"e-r-hide")),it=v;it<p;it++)g.showHeadings&&!et&&(lt='<td class="{0}">{1}<\/td>',n(String.format(lt,"e-rowcell e-header",w+1)).appendTo(d),et=!0),n(e[w]).length>0&&n(e[w].cells[it]).length>0?(rt=n(e[w].cells[it].outerHTML).attr("id","ss"),rt.appendTo(d)):(rt=t.buildTag("td.e-rowcell"),rt.appendTo(d)),yt=k.XLEdit.getPropertyValue(0,it,"isCHide"),t.isNullOrUndefined(yt)||k.addClass(rt[0],"e-col-hide");et=!1;ut.append(d)}if(r.append(ut),y<o)a=y,y=y+l;else if(y>=o){if(p>=s)break;a=0;y=l;v=p;p=p+c}}for(w=r.find("table").length-1;w>=0;--w)tt=n(r.find("table")[w]),ot||this._checkEmptyRow(i,tt,"first"),pt=g.showHeadings?tt.find("tr.empty").length+1:tt.find("tr.empty").length,(tt.find("tr").length!==pt||ot)&&(n(tt.get(0).outerHTML).attr("id","cc").appendTo(at),ot=!0);for(b=at.find("table"),w=b.length-1;w>=0;--w)b.length-1!==w?(k.model.pageSize===t.Spreadsheet.pageSize.A4&&b.eq(w).css({"margin-top":300,"margin-bottom":300}),k.model.pageSize===t.Spreadsheet.pageSize.A3&&b.eq(w).css({"margin-top":120,"margin-bottom":110}),k.model.pageSize===t.Spreadsheet.pageSize.Letter&&(g.showHeadings?b.eq(w).css({"margin-top":70,"margin-bottom":50}):b.eq(w).css({"margin-top":0,"margin-bottom":50}))):b.length-1===w&&b.eq(w).css({"margin-top":30,"margin-bottom":g.showHeadings?20:0}),w||(b.length>1&&b.eq(w).css({"margin-top":120,"margin-bottom":0}),this._checkEmptyRow(i,b.eq(w),"last")),n(b[w].outerHTML).attr("id","cc").appendTo(u);for(ft=n("head").find("link"),ct=[],w=0,wt=ft.length;w<wt;w++)if(ft[w].href.indexOf("ej.pivotintegration.css")>-1){ct.push(ft[w]);break}u=u.parent();k._trigger("_pivotPrint",{element:u});this._isPrintSelection=!1;this.print(u,ct,i)},_checkEmptyRow:function(t,i,r){for(var o,e,f=i.find("tr"),s,h,c,u=f.length-1;u>=0;--u)if(o=n(f[u]).find(".e-rowcell").length,e=n(f[u]).find(".e-rowcell:empty").length,e=this.XLObj.getSheet(t).showHeadings?e+1:e,s=n(f[u]).find('td[class *= "e-format"]').length,h=n(f[u]).find('td[class *= "e-border"]').length,c=n(f[u]).find('td[class *= "e-mc-hide"]').length,e===o&&s<1&&h<1&&c<1)n(f[u]).addClass("empty");else{n(f[u]).addClass("nonempty");break}r==="last"&&(i.find("tr.empty").find("td").removeClass("e-rowcell"),i.find("tr.empty").find("td.e-header").text(""))},_constructTable:function(i,r,u){var e=t.buildTag("colgroup"),s=this.XLObj,l=t.buildTag("div","",{height:this._printHeight,"margin-top":this._marginTop,"margin-bottom":this._marginBottom}),h=t.buildTag("table.e-table","",{height:this._printHeight,"margin-top":this._marginTop,"margin-bottom":this._marginBottom}),c=s._getContent(s.getActiveSheetIndex()).find("col"),o,f;for(s.getSheet(i).showHeadings&&(o='<col class="{0}" style= "width: 30px;" >{1}<\/col>',n(o).appendTo(e)),f=r;f<u;f++)n(c[f]).length>0?n(c[f].outerHTML).attr("id","cc").appendTo(e):(o='<col style= "width: 64px;" ><\/col>',n(o).appendTo(e));return h.append(e),l.append(h),h},_constructHeaders:function(i,r,u,f){var o=this.XLObj,w=o.getActiveSheetIndex(),h=t.buildTag("tr","",{height:30}),c,l,s,a,v,y=!1,b=o._getContent(w).find("col"),p="e-rowcell",e;for(this._isPrintSelection&&i<this._stCol&&(r=r+(this._stCol-i),i=this._stCol),c='<td class="{0}">{1}<\/td>',l='<div class = "{0}" > {1}<\/div>',e=i;e<=r;e++)y?(s=o._generateHeaderText(e),p=t.isNullOrUndefined(o.XLEdit.getPropertyValue(0,e-1,"isCHide"))?"e-rowcell e-headercell":"e-rowcell e-col-hide"):(s="",y=!0),a=String.format(l,"e-headercelldiv",s),v=String.format(c,p,a),n(h[0]).append(v);f.append(h)},print:function(i,r,u){var o=this.XLObj,f,e,c,s,h,l;o.model.printSettings.allowPrinting&&!o.model.isReadOnly&&((f=window.open("","print","'height=452,width=1024,tabbar=no"),o.isUndefined(f))||(h=t.buildTag("div"),l=i.clone(),h.append(l),f.document.write("<!DOCTYPE html>"),o._browserDetails.name==="msie"?(s="",r.length>0&&n(r).each(function(t,i){n(i).attr("href",i.href);s+=i.outerHTML}),f.document.write("<html><head><\/head><body>"+s+h[0].innerHTML+"<\/body><\/html>")):(s="",f.document.write("<html><head>"),r.length>0&&n(r).each(function(t,i){n(i).attr("href",i.href);s+=i.outerHTML}),f.document.writeln(s+"<\/head><body>"),f.document.writeln(h[0].innerHTML+"<\/body><\/html>")),n(f.document.head).append("<style><\/style>"),e=o.model.sheets[u].showGridlines?".e-spreadsheet .e-table{table-layout: fixed; width: 100%;}.e-spreadsheet .e-rowcell {border: 1px solid #000000;line-height: 14px;overflow: hidden;white-space: pre;vertical-align: bottom;}.e-spreadsheet .e-table{border-collapse: collapse}":".e-spreadsheet .e-table{table-layout: fixed; width: 100%;}.e-spreadsheet .e-rowcell {line-height: 14px;overflow: hidden;white-space: pre;vertical-align: bottom;}.e-spreadsheet .e-table{border-collapse: collapse}",e=e.concat(n(document).find("style#"+this.XLObj._id+"_sscustomformat").text()),c=n(f.document.head).find("style"),e=e.concat(".e-spreadsheet .e-fr-hide { display: none !important;}.e-spreadsheet .e-fc-hide { display: none !important;}.e-spreadsheet .e-sswraptext {word-break: break-all; white-space: normal;}.e-spreadsheet .e-headercell{text-align:center;}.e-spreadsheet .e-ralign{text-align:right;}.e-spreadsheet .e-calign{text-align:center;}"),e=e.concat(".e-spreadsheet .e-hyperlinks { text-decoration: underline;}"),c.append(e),f.focus(),n("#print").remove(),setTimeout(function(){(o._browserDetails.name==="msie"?!o.getObjectLength(f)||t.isNullOrUndefined(f.window)||t.isNullOrUndefined(f.location):t.isNullOrUndefined(f.window)||t.isNullOrUndefined(f.location))||(f.print(),f.location.reload());setTimeout(function(){f.close()},2e3)},2e3)))}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.scroller=function(n){this.XLObj=n;this._isIntrnlScroll=!1};t.spreadsheetFeatures.scroller.prototype={_getColWidths:function(n,t){var i,s=this.XLObj,r=s.getSheet(n),u=r.columnsWidthCollection,f=r._colWidthCollection,e,o=r._ofColWidthColl;for(t||(t=1),i=t,len=u.length;i<len;i++)f[i]=f[i-1]+u[i-1],e=u[i-1]===0?r.hideColsCollection[i-1]:u[i-1],o[i]=o[i-1]+e},_getRowHeights:function(n,t,i){var r,e=this.XLObj,o=e.getSheet(n),f=o.rowsHeightCollection,u=o._rowHeightCollection,s=o.hideRowsCollection;for(t||(t=1),r=t,len=f.length;r<len;r++)u[r]=u[r-1]+(s.indexOf(r-1)>-1?0:f[r-1]);u[u.length-1]=u[u.length-2]+(s.indexOf(f.length-1)===-1?f[f.length-1]:0);!i&&e.model.scrollSettings.allowScrolling&&(e.model.scrollSettings.allowVirtualScrolling&&e._refreshVrtlBlocks(n),this._refreshScroller(n,"refresh","vertical"))},_createScroller:function(i,r,u){var f=this.XLObj,e=!0,l=f._getContent(i),h=t.buildTag("div#vscrollBar"),o=t.buildTag("div#hscrollBar"),s=f.getSheet(i),c=f.model.scrollSettings.isResponsive?r.width-2:r.width;s._contWidth=c-18;f.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal&&(s._contWidth>f._getEntireColWidth(i)&&(e=!1),o[0].style.display=e?"block":"none");l.append(h).append(o);f._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").width(s._contWidth).height(r.height-(e?18:0));h.ejScrollBar({orientation:"vertical",height:r.height-(e?18:0),minimum:0,viewportsize:r.height,infiniteScrolling:!0,scroll:n.proxy(this._scrollSpreadY,this)});o.ejScrollBar({orientation:"horizontal",width:c-17,minimum:0,infiniteScrolling:!0,viewportsize:r.width,scroll:n.proxy(this._scrollSpreadX,this)});u!="initial"&&this._refreshScroller(i,"initial","all")},_hScroller:function(n){return this.XLObj._getContent(this.XLObj._getSheetIndex(n)).find("#hscrollBar").data("ejScrollBar")},_vScroller:function(n){return this.XLObj._getContent(this.XLObj._getSheetIndex(n)).find("#vscrollBar").data("ejScrollBar")},_refreshScroller:function(n,i,r){var c,s,l,h,b,k,a=0,e=this.XLObj,n=e._getSheetIndex(n),o=e.getSheet(n),f=this._hScroller(n),y=o.columnWidth,p=o.rowHeight,u=this._vScroller(n),w=e.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal,d=e._getContent(n),g=d.find(".e-content")[0],v;if(w&&f&&u&&d.find("table").length&&(this._refreshContHgt(n),r=r==="horizontal"?"all":r),f&&(r==="all"||r==="horizontal")){if(c=g.offsetWidth,s=e._getWidth(0,o.colCount-1,n)-o._frozenWidth,s<c+2*y&&!w)for(b=Math.floor((c+y*5-s)/y),v=0;v<b;v++)this._createNewColumn(n,{rowIndex:-1,colIndex:-1},{rowIndex:-1,colIndex:-1},"insert"),s=s+y;f._scrollData.handleSpace=c-2*f.model.buttonSize;a=e._isFrozen(e.getFrozenColumns())?e._getColOffsetLeft(o,e.getFrozenColumns())-o._contScrollLeft:0;f._scrollData.handle=Math.floor((c-a)/s*f._scrollData.handleSpace);f._scrollData.handle<15&&(f._scrollData.handle=15);f._scrollData.scrollable=f.model.maximum=s-(c-a);f._scrollData.onePx=f._scrollData.scrollable/(f._scrollData.handleSpace-f._scrollData.handle)||1;f["e-hhandle"].width(f._scrollData.handle);f.model.scrollLeft=f._scrollData.handleSpace-f._scrollData.handle}if(u&&(r==="all"||r==="vertical")){if(l=g.offsetHeight,h=e._getMaxHgt(n,!0,!0)-o._frozenHeight,!w&&h<l+2*p)for(k=Math.floor((l+p*5-h)/p),v=0;v<k;v++)this._createNewRow(n,-1,-1,"insert"),h=h+p;u._scrollData.handleSpace=l-2*u.model.buttonSize;a=e._isFrozen(e.getFrozenRows())?e._getRowOffsetTop(o,e.getFrozenRows())-o._contScrollTop:0;u._scrollData.handle=Math.floor((l-a)/h*u._scrollData.handleSpace);u._scrollData.handle<15&&(u._scrollData.handle=15);u._scrollData.handle>u._scrollData.handleSpace&&e.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Normal&&(u._scrollData.handle=u._scrollData.handleSpace);u._scrollData.scrollable=u.model.maximum=h-(l-a);u._scrollData.onePx=u._scrollData.scrollable/(u._scrollData.handleSpace-u._scrollData.handle);u["e-vhandle"].height(u._scrollData.handle);u.model.scrollTop=u._scrollData.handleSpace-u._scrollData.handle}},_refreshContHgt:function(n){var t,i,e,l,o="px",a="none",v="block",y="width",f="height",r=this.XLObj,p=r.getSheet(n),u=r._getEntireColWidth(n),s=r._getContent(n),h=s.find(".e-content"),c=s.find("#hscrollBar")[0].style;t=h[0].offsetHeight;i=c.display===a&&p._contWidth<u;(i||c.display===v&&p._contWidth>u)&&(c.display=i?v:a,t=i?t-18:t+19,i=!0);i&&(l=t-2*this._vScroller(n).model.buttonSize+o,t+=o,e=s.find("#vscrollBar"),h[0].style[f]=t,r._getJSSheetRowHeaderContent(n)[0].style[f]=t,e[0].style[f]=t,e.find(".e-vhandlespace")[0].style[f]=l);u+=o;h.find("table")[0].style[y]=u;r._getJSSheetHeader(n).find("table")[0].style[y]=u},_changeTopSpread:function(n,t,i,r){var f=n.value(),u=f+i;t.step=i;(t.enableRTL?u<t.scrollable:u>t.scrollable)&&(u=t.scrollable);(t.enableRTL?u>0:u<0)&&(u=0);n.scroll(u,r)},_spreadMouseWheel:function(i){var r=this.XLObj,e,f=this._vScroller(r.getActiveSheetIndex()),u,o;t.isNullOrUndefined(f)||(r._filterClose(i.target),i.stopImmediatePropagation(),i.preventDefault(),r.element.find(".e-excelfilter.e-dlgcontainer").is(":visible")||r._isSubMenuOpen()||r._isSheetRename)||(r.model.allowComments&&r.XLComment._isCommentEdit&&(e=r.getActiveCell(),t.isNullOrUndefined(e)||r.XLComment._updateCurCmntVal({rowIndex:e.rowIndex,colIndex:e.colIndex})),r.model.allowDataValidation&&n("#"+r._id+"ddl").ejDropDownList("hidePopup"),u=0,o=i,i=i.originalEvent,i.wheelDelta?(u=-i.wheelDelta/120,window.opera&&parseFloat(window.opera.version,10)<10&&(u=-u)):i.detail&&(u=i.detail/3),u)&&(this._changeTopSpread(f,f._scrollData,u*f._scrollData.scrollOneStepBy,"wheel")&&(i.preventDefault?i.preventDefault():o.preventDefault()),n.data(this,"timer",setTimeout(function(){r._trigger("scrollStop",{originalEvent:i,scrollData:f._scrollData,reqType:"vertical",position:f.model.value})},250)))},_scrollSpreadX:function(n){var t=this.XLObj;t.getSheet()._isFreezed&&t._isFrozen(t.getFrozenColumns())?(t.XLFreeze._frozenScrollHandler(n),this._getFirstColumn(t.getActiveSheetIndex())):this._spreadHS(n)},_scrollDirection:function(n,t){var i=this.XLObj,n=i._getContent(i.getActiveSheetIndex()).find("#"+n).ejScrollBar("instance");n.value()<t?n._scrollData.step=1:n.value()>t&&(n._scrollData.step=-1);n.scroll(t)},_spreadHS:function(n){var e,i=this.XLObj,u=i.getActiveSheetIndex(),r=i.getSheet(u),f=this._hScroller(u),o=i._getContent(u),s=o.find(".e-content"),c=o.find("col"),r=i.getSheet(u),h=(n.scrollLeft-r._scrollLeft)/r.columnWidth;if(n.reachedEnd=Math.ceil(parseFloat(f.element.find(".e-hhandle").css("left")))+Math.ceil(parseFloat(f.element.find(".e-hhandle").width()))>=i.element.find(".e-hhandlespace").width()-2,e=n.scrollLeft,i.model.enableContextMenu&&i.XLCMenu.hideCMenu(),i.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&n.scrollData.step>-1&&!i._scrollReverse)if(n.reachedEnd&&r._leftCol.idx+h<=r.colCount)n.cancel=!0,this._scrollRight(u),e=(f._scrollData.handleSpace-f._scrollData.handle)*f._scrollData.onePx,this._refreshScroller(u,"refresh","horizontal"),f.element.find(".e-hhandle").css("left",f._scrollData.handleSpace-(f._scrollData.handle+1)),f.value(e);else if(r._leftCol.idx+h>r.colCount&&n.scrollLeft>=r._scrollLeft&&n.scrollLeft>0&&r.colCount<i._maxColCnt){while(n.scrollLeft>r._colWidthCollection[r._colWidthCollection.length-1])this._scrollRight(u);this._refreshScroller(u,"refresh","horizontal")}r._scrollLeft=n.scrollLeft=e;i._scrollReverse=!1;s.scrollLeft(n.scrollLeft);r._scrollLeft=s.scrollLeft();f.value(n.scrollLeft);this._getFirstColumn(u);i._refreshViewVar(null,n.scrollLeft,u)},_scrollSpreadY:function(n){var u,f,h,c,e,s=0,i=this.XLObj,r=i.getActiveSheetIndex(),o=i.getSheet(r);o._isFreezed&&i._isFrozen(i.getFrozenRows())?(i.XLFreeze._frozenScrollHandler(n),this._getFirstRow(i.getActiveSheetIndex())):(c=i.getDigits(o._bottomRow.idx),this.XLObj.model.scrollSettings.allowVirtualScrolling?this._scrollHandler(n):this._spreadVS(n),this.XLObj.model.allowComments&&this.XLObj.XLComment._isCommentEdit&&(e=this.XLObj.getActiveCell(),t.isNullOrUndefined(e)||this.XLObj.XLComment._updateCurCmntVal({rowIndex:e.rowIndex,colIndex:e.colIndex})),u=i.getDigits(o._bottomRow.idx),h=u-c,h&&(u>3&&(s=(u-3)*10),f=i._rowHeaderWidth+s,i._getJSSheetRowHeaderContent(r).find("col").width(f),i._getJSSheetRowHeader(r).width(f),i._getJSSheetHeader(r).find(".e-spreadsheetcolumnheader").width(f-1),i._getJSSheetContent(r).find(".e-spreadsheetcontentcontainer > .e-content").width(o._contWidth-s)))},_scrollHandler:function(n){var y,c,s,h,p,f,l,k,w,b,d,a,e=hgt=height=0,o=isRefreshed=!1,r=this.XLObj,u=r.getActiveSheetIndex(),i=r.getSheet(u),tt=r.getActiveCell(u),g=n.scrollTop>=i._scrollTop,it=this._vScroller(u),nt=(n.scrollTop-i._scrollTop)/i.rowHeight+1,v=r._getContent(u).find(".e-content");if(n.scrollTop===i._scrollTop||i._bottomRow.idx+nt>i.rowCount){if(g&&n.scrollTop>0&&r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&i.rowCount<r._maxRowCnt){s=i.rowCount;do{i._virtualBlockCnt++;i.rowCount+=i._virtualBlockRowCnt;for(y in i._columnStyles)for(c=i._virtualBlockRowCnt;c<i.rowCount;)r.XLEdit._updateDataContainer({rowIndex:c,colIndex:parseInt(y)},{dataObj:i._columnStyles[y]}),c++;while(e<i._virtualBlockRowCnt)i.rowsHeightCollection.push(i.rowHeight),i.hideRowsCollection.indexOf(s)===-1&&i._hiddenFreezeRows.indexOf(s)===-1?(i._rowIdxColl.push(s),hgt=i._rowHeightCollection[i._rowHeightCollection.length-1]+i.rowHeight,i._virtualTBodyHgt+=i.rowHeight):hgt=i._rowHeightCollection[i._rowHeightCollection.length-1],i._rowHeightCollection.push(hgt),s++,e++;e=0}while(n.scrollTop+i._virtualBlockRowCnt*i.rowHeight>i._rowHeightCollection[i._rowHeightCollection.length-1]);this._refreshScroller(u,"refresh","vertical");i._scrollTop=n.scrollTop;r._refreshViewport(n.scrollTop,u);v.scrollTop(n.scrollTop);i._scrollTop=v.scrollTop();o=!0}}else prop=["value","value2","comment","hyperlink","format","border","type","isFilterHide","filterState","isMHide","isFHide","merge","isFilterHeader","isFilterVisible","text","general","cFormatRule","wrap","wrapRow","rule","align","isOverflow","isOfBrdr","altTxt"],p=r._getRowHdrTBody(u),h=r._getContTBody(u),g?(n.scrollTop>=i._virtualContTBodyOffset.bottom&&n.scrollTop<=i._virtualBottomTBodyOffset.bottom?(height=i._virtualTopTBodyOffset.bottom-i._virtualTopTBodyOffset.top,i._virtualTopTBodyOffset.top=i._virtualContTBodyOffset.top,i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.bottom,i._virtualContTBodyOffset.top=i._virtualBottomTBodyOffset.top,i._virtualContTBodyOffset.bottom=i._virtualBottomTBodyOffset.bottom,i._virtualContBlockIdx++,i._virtualContBlockIdx===i._virtualBlockCnt?(i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom=0,i._isVirtualEndReached=!0):(i._virtualBottomTBodyOffset.top=i._virtualBottomTBodyOffset.bottom,k=r._getRowIdx(i._virtualContBlockIdx*i._virtualBlockRowCnt,u,!0),w=r._getRowIdx(i._virtualContBlockIdx*i._virtualBlockRowCnt+(i._virtualBlockRowCnt-1),u,!0),i._virtualBottomTBodyOffset.bottom=r._getRowOffsetBottom(w,u),a=i._rowIdxColl.slice(i._rowIdxColl.indexOf(k),i._rowIdxColl.indexOf(w)+1),f=r.getRangeData({property:prop,sheetIdx:u,rowIdxs:a,withRowIdx:!0}),p.append(r._renderRowHdr(f.rowIdx,u)),h.append(r._renderData(f,u)),i._virtualRowIdx=i._virtualRowIdx.concat(f.rowIdx),o=!0),i._isVirtualTopReached||(r._removeRange(0,i._virtualBlockRowCnt),i._virtualRowIdx.splice(0,i._virtualBlockRowCnt),i._virtualTopTBodyHgt+=height),i._virtualBottomTBodyHgt=i._virtualTBodyHgt-(i._virtualTopTBodyHgt+Math.floor(parseFloat(window.getComputedStyle(h[0],null).height))),r._refreshTBodiesHgt(),i._isVirtualTopReached=!1):!i._isVirtualEndReached&&n.scrollTop>=i._virtualBottomTBodyOffset.bottom&&(r._refreshViewport(n.scrollTop,u),o=isRefreshed=!0),r.model.allowCellType&&r.XLCellType._rangeCellTypes(i.cellTypes,u)):n.scrollTop+n.model.viewportsize<i._virtualContTBodyOffset.top&&n.scrollTop+n.model.viewportsize>=i._virtualTopTBodyOffset.top?(height=i._virtualBottomTBodyOffset.bottom-i._virtualBottomTBodyOffset.top,i._virtualBottomTBodyOffset.top=i._virtualContTBodyOffset.top,i._virtualBottomTBodyOffset.bottom=i._virtualContTBodyOffset.bottom,i._virtualContTBodyOffset.top=i._virtualTopTBodyOffset.top,i._virtualContTBodyOffset.bottom=i._virtualTopTBodyOffset.bottom,i._virtualContBlockIdx--,i._virtualTopTBodyOffset.bottom=i._virtualContTBodyOffset.top,i._virtualContBlockIdx===1?(i._virtualTopTBodyOffset.top=0,i._isVirtualTopReached=!0):(b=r._getRowIdx((i._virtualContBlockIdx-2)*i._virtualBlockRowCnt,u,!0),d=r._getRowIdx((i._virtualContBlockIdx-2)*i._virtualBlockRowCnt+(i._virtualBlockRowCnt-1),u,!0),i._virtualTopTBodyOffset.top=r._getRowOffsetTop(i,b),a=i._rowIdxColl.slice(i._rowIdxColl.indexOf(b),i._rowIdxColl.indexOf(d)+1),f=r.getRangeData({property:prop,sheetIdx:u,rowIdxs:a,withRowIdx:!0}),p.prepend(r._renderRowHdr(f.rowIdx,u)),h.prepend(r._renderData(f,u)),i._virtualRowIdx=f.rowIdx.concat(i._virtualRowIdx),o=!0),i._isVirtualEndReached||(r._removeRange(i._virtualContBlockIdx===1?2*i._virtualBlockRowCnt:3*i._virtualBlockRowCnt,i._virtualBlockRowCnt),i._virtualRowIdx.splice(i._virtualContBlockIdx===1?2*i._virtualBlockRowCnt:3*i._virtualBlockRowCnt,i._virtualBlockRowCnt),i._virtualBottomTBodyHgt+=height),i._virtualTopTBodyHgt=i._virtualTBodyHgt-(i._virtualBottomTBodyHgt+Math.floor(parseFloat(window.getComputedStyle(h[0],null).height))),r._refreshTBodiesHgt(),i._isVirtualEndReached=!1,r.model.allowCellType&&r.XLCellType._rangeCellTypes(i.cellTypes,u)):!i._isVirtualTopReached&&n.scrollTop+n.model.viewportsize<=i._virtualTopTBodyOffset.top&&(r._refreshViewport(n.scrollTop,u),o=isRefreshed=!0),isRefreshed||r._refreshViewVar(n.scrollTop,null,u),i._scrollTop=n.scrollTop;if(v.scrollTop(n.scrollTop),i._scrollTop=v.scrollTop(),this._getFirstRow(u),r.model.allowSelection&&(i._isRowSelected||i._isColSelected||i._isSheetSelected)&&(r.XLSelection.refreshSelection(),r.XLDragFill.positionAutoFillElement()),o){for(r.XLComment&&r.XLComment._updateCmntArrowPos(r._getContent(u).find(".e-commentcell")),l=r.getObjectKeys(r._dataContainer.sheets[u][0]),r._dupDetails=!0,e=0,len=l.length;e<len;e++)fitWidth=r.XLEdit.getPropertyValue(0,l[e],"isFitWidth"),t.isNullOrUndefined(fitWidth)||r.XLResize._fitWidth(l[e]);r._dupDetails=!1}},_spreadVS:function(n){var e,r=this.XLObj,f=r.getActiveSheetIndex(),u=r.getSheet(f),i=this._vScroller(f),h=r._getJSSheetContent(f).find(".e-spreadsheetcontentcontainer > .e-content"),c=(n.scrollTop-u._scrollTop)/u.rowHeight;if(n.reachedEnd=Math.ceil(parseFloat(i.element.find(".e-vhandle").css("top")))+Math.ceil(parseFloat(i.element.find(".e-vhandle").height()))>=i.element.find(".e-vhandlespace").height()-2,e=n.scrollTop,r.model.enableContextMenu&&r.XLCMenu.hideCMenu(),r.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&n.scrollData.step>-1&&!r._scrollReverse)if(n.reachedEnd&&u._bottomRow.idx+c<=u.rowCount){var l=!1,a=!1,s=this,o;!r.isUndefined(n.scrollData.target)&&r._hasClass(n.scrollData.target,"e-vdown")&&(o=setInterval(function(){l=!0;for(var n=0;n<20;n++)s._scrollBottom(f);e=(i._scrollData.handleSpace-i._scrollData.handle)*i._scrollData.onePx;s._refreshScroller(f,"refresh","vertical");i.element.find(".e-vhandle").css("top",i._scrollData.handleSpace-i._scrollData.handle);i.scroll(e);clearInterval(o);return},1e3),r._browserDetails.name==="msie"&&r._browserDetails.version==="8.0"?(i.element.find(".e-vdown")[0].attachEvent("onmouseup",function(){clearInterval(o);return}),document.attachEvent("onmouseup",function(){clearInterval(o);return})):(i.element.find(".e-vdown")[0].addEventListener("mouseup",function(){clearInterval(o);return}),document.addEventListener("mouseup",function(){clearInterval(o);return})),a=!0);n.cancel=!0;l&&a||(this._scrollBottom(f,(n.scrollTop-u._scrollTop)/20+1),e=(i._scrollData.handleSpace-i._scrollData.handle)*i._scrollData.onePx,s._refreshScroller(f,"refresh","vertical"),i.element.find(".e-vhandle").css("top",i._scrollData.handleSpace-i._scrollData.handle),i.value(e))}else u._bottomRow.idx+c>u.rowCount-1&&n.scrollTop>=u._scrollTop&&n.scrollTop>0&&u.rowCount<r._maxRowCnt&&(this._scrollBottom(f,(n.scrollTop-u._scrollTop)/20+1),this._refreshScroller(f,"refresh","vertical"));n.scrollTop=u._scrollTop=e;r._scrollReverse=!1;h.scrollTop(n.scrollTop);u._scrollTop=h.scrollTop();this._getFirstRow(f)},_scrollX:function(i){var e,u=this.XLObj,r=this._hScroller(i),o,s=[1],h=u._getContent(i).find("colgroup"),f=u.getSheet(i);for(u.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&this._scrollRight(i),r.model.maximum=r.model.maximum+f.columnWidth,r._scrollData.scrollable=r._scrollData.scrollable+f.columnWidth,this._refreshScroller(i,"refresh","horizontal"),r.element.find(".e-hhandle").css("left",r._scrollData.handleSpace-(r._scrollData.handle+1)),o=(r._scrollData.handleSpace-r._scrollData.handle)*r._scrollData.onePx,r.value(o),e=0,len=u.model.sheets[i]._fCol;e<len;e++)s.push(s[s.length-1]+n(h.find("col")[e]).width());f._isFreezed&&u._isFrozen(u.getFrozenColumns())?r.scroll(r.value()+u._getColWidth(f._fleftColIdx,i),!0):u._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").scrollLeft(o,r._scrollData.onePx);f._scrollLeft=o;this._getFirstColumn(i)},_scrollY:function(i){var f,u=this.XLObj,r=this._vScroller(i),e,o=[1],s=u.getRows(i)[1];for(u.model.scrollSettings.scrollMode===t.Spreadsheet.scrollMode.Infinite&&this._scrollBottom(i),r.model.maximum=r.model.maximum+u.model.rowHeight,r._scrollData.scrollable=r._scrollData.scrollable+u.model.rowHeight,this._refreshScroller(i,"refresh","vertical"),r.element.find(".e-vhandle").css("top",r._scrollData.handleSpace-(r._scrollData.handle+1)),e=(r._scrollData.handleSpace-r._scrollData.handle)*r._scrollData.onePx,r.value(e),f=0,len=u.model.sheets[i]._fRow;f<len;f++)o.push(o[o.length-1]+n(s[f]).height());u._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer > .e-content").scrollTop(e,r._scrollData.onePx);this._getFirstRow(i)},_getFirstRow:function(n){var i=this.XLObj,t=i.getSheet(n),r,u,f,e=t._rowHeightCollection;r=i._getContent(n).find(".e-content").scrollTop();u=i._getIdxWithOffset(r,null,!0,null,n).rowIdx;t._topRow={idx:u,value:e[u]};f=i._getIdxWithOffset(r+t._vPortHgt,null,!0,null,n).rowIdx||t.rowCount-1;t._bottomRow={idx:f,value:e[f]};t.topLeftCell=i.getAlphaRange(t._topRow.idx,t._leftCol.idx)},_getFirstColumn:function(n){var i=this.XLObj,t=i.getSheet(n),r,u,f,e=t._colWidthCollection;r=i._getContent(n).find(".e-content").scrollLeft();u=i._getIdxWithOffset(null,r,!0,null,n).colIdx;t._leftCol={idx:u,value:e[u]};f=i._getIdxWithOffset(null,r+t._vPortWth,!0,null,n).colIdx||t.colCount-1;t._rightCol={idx:f,value:e[f]};t.topLeftCell=i.getAlphaRange(t._topRow.idx,t._leftCol.idx)},scrollToCell:function(n){var u,f,o=0,s=0,i=this.XLObj,r=i.getRangeIndices(n),e=i.getActiveSheetIndex(),t=i.getSheet(e);u=r[0]>t.rowCount?i._getRowOffsetBottom(t.rowCount-1,e)+(r[0]-t.rowCount)*t.rowHeight:i._getRowOffsetBottom(r[0]-1,e);f=r[1]>t.colCount?i._getWidth(0,t.colCount-1)+(r[1]-t.colCount)*t.columnWidth:i._getWidth(0,r[1]-1);i._isFrozen(t.frozenRows)&&(o=i._getRowOffsetTop(t,t._frozenRows-1));i._isFrozen(t.frozenColumns)&&(s=i._getColOffsetLeft(t,t._frozenColumns-1));i._scrollContent({x:(f?f:0)-t._scrollLeft-s,y:(u?u:0)-t._scrollTop-o})},_scrollSelectedPosition:function(n,t){if(!this.XLObj._isExport){var s,h,c=0,u=this.XLObj,r=this._hScroller(n),f=this._vScroller(n),i=u._getCellInfo(t),o=u.getSheet(n),e=u._getJSSheetContent(n).find(".e-spreadsheetcontentcontainer > .e-content"),l=u._dupDetails,a=Math.ceil(parseFloat(f.element.find(".e-vhandle").css("top")))+f._scrollData.handle>=f._scrollData.handleSpace,v=Math.ceil(parseFloat(r.element.find(".e-hhandle").css("left")))+r._scrollData.handle>=r._scrollData.handleSpace;u.isUndefined(r)||parseInt(i.width)+(i.left-e.offset().left)>e.width()&&(s=i.left-(r._scrollData.handleSpace+r.model.buttonSize),s<0?r.scroll(0):(v&&(u._scrollReverse=!0),(parseInt(i.width)+i.left>r._scrollData.handleSpace+r.model.buttonSize*2||i.left-e.offset().left<=0)&&s!=0&&r.scroll(i.left+i.width+1-(r._scrollData.handleSpace+r.model.buttonSize*2)),u._scrollReverse=!1));u.isUndefined(f)||(parseInt(i.height)+(i.top-e.offset().top)>e.height()||i.top-e.offset().top<=0)&&(t.rowIndex<o._topRow.idx||t.rowIndex>o._bottomRow.idx)&&(!t.rowIndex<o._bottomRow.idx&&t.rowIndex<o.rowCount-1&&(c=i.height),h=i.top+c-(f._scrollData.handleSpace+f.model.buttonSize),h<0?f.scroll(0):(a&&(u._scrollReverse=!0),f.scroll(i.top+i.height+1-(f._scrollData.handleSpace+f.model.buttonSize*2)),u._scrollReverse=!1));u._dupDetails=l}},_rowTemplate:function(n,t){for(var i,e="",u=this.XLObj,o=u.getSheet(n),r=0,f=u.model.sheets[n].colCount;r<f;r++)i="e-rowcell",o.showGridlines||(i=i.concat(" e-hborder")),o._hiddenFreezeCols.indexOf(r)>-1&&(i+=" e-fcol-hide"),e+=String.format('<td class="{0}" style="{2}" >{1}<\/td>',i,"");return String.format("<tr style='{0}' idx=\"{1}\">"+e+"<\/tr>","height:"+u.model.rowHeight+"px;",t-1)},_rowHeaderTemplate:function(n,t){var i,t=t?t:this.XLObj.model.rowHeight;return i=String.format('<td class="{0}" >{1}<\/td>',"e-rowheader",n),String.format("<tr style='{0}' idx=\"{1}\">"+i+"<\/tr>","height:"+t+"px;",n-1)},_columnTemplate:function(){var n="e-rowcell e-wrapword",t=this.XLObj,i=t.getActiveSheetIndex();return t.getSheet(i).showGridlines||(n=n.concat(" e-hborder")),String.format('<td class="{0}" style="{2}" >{1}<\/td>',n,"")},_colGroupTemplate:function(n,t){var t=t?t:this.XLObj.getSheet(n).columnWidth;return String.format("<col style = '{0}'><\/col>","width:"+t+"px;")},_columnHeaderTemplate:function(n){var t,i;return t=this.XLObj._generateHeaderText(n),i=String.format('<div class = "{0}" > {1}<\/div>',"e-headercelldiv",t),String.format('<th class="{0}" >{1}<\/th>',"e-headercell",i)},_createNewRow:function(t,i,r,u){var s,h,l,e,a,f=this.XLObj,y=f.model.scrollSettings.allowVirtualScrolling,p=f.XLSelection,o=f.getSheet(t),w,c,v;if(y?(s=f._getContent(t).find("tbody")[1],e=f._getJSSheetRowHeaderContent(t).find("tbody")[1]):(s=f._getContent(t).find("tbody")[0],e=f._getJSSheetRowHeaderContent(t).find("tbody")[0]),l=this._rowTemplate(t,parseInt(e.lastChild.textContent)+1),i===-1||r>-1&&i>-1&&u==="shift"?(n(e).append(this._rowHeaderTemplate(parseInt(e.lastChild.textContent)+1)),n(s).append(l),u=="shift"&&(n(s).find("tr:last td:last").remove(),w=f._getRowIdx(i),n(s).find("tr: eq(' + rowElemIdx + ') td:eq(' + (colIdx - 1) + ')").after(this._columnTemplate()))):(h=s.insertRow(i),n(h).height(f.model.rowHeight),n(h).append(n(l)[0].innerHTML),h=e.insertRow(i),n(h).height(f.model.rowHeight),n(h).append("<td class='e-rowheader'><\/td>")),o.rowCount=f.model.sheets[t].rowCount+1,o.rowsHeightCollection.push(f.model.rowHeight),i>-1){for(a=n(e).find("td"),c=0,v=a.length;c<v;c++)n(a[c]).text(c+1);f.XLScroll._getRowHeights(t,i+1)}o._rowHeightCollection.push(o._rowHeightCollection[o._rowHeightCollection.length-1]+f.model.rowHeight);f.model.allowSelection&&(o._isColSelected||o._isSheetSelected)&&p.refreshSelection();f._refreshRows(t)},_createNewColumn:function(i,r,u,f){var e,s,l,o=this.XLObj,h=o.getSheet(i),st=o.XLSelection,c,d,nt,tt,ft,v,a,p,it,et,ot,rt,w=!1,b,y,ht=h.columnsWidthCollection,ct=o.model.scrollSettings.allowVirtualScrolling,ut,k,g;for(c=o._getContTBody(i)[0],d=o._getJSSheetHeader(i).find("tr")[0],nt=o._getJSSheetContent(i).find(".e-spreadsheetcontentcontainer colgroup"),tt=o._getJSSheetHeader(i).find("colgroup"),ft=h.colCount,y=h.filterSettings.tableRange,e=0,l=y.length;e<l;e++)if(rt=y[e].multifilterIdx,r.colIndex>rt[0]&&u.colIndex<rt[rt.length-1]){w=!0;b=y[e].startRow-1;y=y[e];break}if(r.colIndex===-1||r.colIndex>-1&&r.rowIndex>-1&&f==="shift"){if(r.colIndex===-1&&f==="insert"){for(p=this._columnHeaderTemplate(ft+1,i),n(d).append(p),v=this._colGroupTemplate(i),tt.append(v),e=0,l=c.rows.length;e<l;e++)a=this._columnTemplate(e),n(c.rows[o._getRowIdx(e,i,!1,!0)]).append(a);nt.append(v)}if(f==="shift"){for(ut=ft,e=r.colIndex;e<=u.colIndex;e++)p=this._columnHeaderTemplate(ut+1,i),n(d).append(p),v=this._colGroupTemplate(i),tt.append(v),nt.append(v),ut=ut+1;for(e=0,l=c.rows.length;e<l;e++)for(s=r.colIndex;s<=u.colIndex;s++)a=this._columnTemplate(e),n(c.rows[o._getRowIdx(e)]).append(a);if(o._insDelStatus.indexOf("insert")>-1)for(e=r.rowIndex;e<=u.rowIndex;e++)for(s=r.colIndex;s<=u.colIndex;s++)n(c).find("tr:eq("+o._getRowIdx(e)+") td:last").remove(),a=this._columnTemplate(e),n(c).find("tr").eq(o._getRowIdx(e)).find("td:eq("+s+")").before(a),w&&e===b&&o.model.allowFiltering&&o.XLFilter._insertFilterIcon(e,s,y,b,w);else for(e=r.rowIndex;e<=u.rowIndex;e++)for(s=u.colIndex;s>=r.colIndex;s--)n(c).find("tr:eq("+o._getRowIdx(e)+") td:eq("+s+")").remove(),a=this._columnTemplate(e),n(c).find("tr:eq("+o._getRowIdx(e)+")").append(a),w&&e===b&&o.model.allowFiltering&&o.XLFilter._insertFilterIcon(e,s,y,b,w)}h.colCount=h.colCount+1;h.columnsWidthCollection.push(h.columnWidth)}else{if(h._isTemplate&&(r.colIndex<h._templateColCount||u.colIndex<h._templateColCount))return;if(g=n.extend(!0,[],o.getSheet(i).columnsWidthCollection),o._insDelStatus.indexOf("insert")>-1){for(k=g.splice(0,r.colIndex),e=r.colIndex;e<=u.colIndex;e++)p=this._columnHeaderTemplate(e+1,i),n(d).find("th:eq("+e+")").before(p),v=this._colGroupTemplate(i),k.push(h.columnWidth),tt.find("col:eq("+e+")").before(v),nt.find("col:eq("+e+")").before(v);for(t.merge(k,g),h.columnsWidthCollection=k,e=0,l=c.rows.length;e<l;e++)for(s=r.colIndex;s<=u.colIndex;s++)a=this._columnTemplate(e),n(c.rows[o._getRowIdx(e)]).find("td:eq("+s+")").before(a),w&&e===b&&o.model.allowFiltering&&o.XLFilter._insertFilterIcon(e,s,y,b,w);h.colCount=h.colCount+1}else{for(k=g.splice(0,r.colIndex),e=u.colIndex;e>=r.colIndex;e--)n(d).find("th:eq("+e+")").remove(),tt.find("col:eq("+e+")").remove(),nt.find("col:eq("+e+")").remove();for(g.splice(0,u.colIndex-r.colIndex+1),t.merge(k,g),h.columnsWidthCollection=k,e=0,l=c.rows.length;e<l;e++)for(s=u.colIndex;s>=r.colIndex;s--)n(c.rows[o._getRowIdx(e)]).find("td:eq("+s+")").remove();h.colCount=h.colCount-1}for(et=n(d).find("th>.e-headercelldiv"),e=0,l=et.length;e<l;e++)n(et[e]).text(o._generateHeaderText(e+1))}ot=n.trim(n(p).text());it=n(a).text();h.columns.push({field:ot,type:it!=null?it.getDay?"date":typeof it:null,width:n(a).width()});o.XLScroll._getColWidths(i,r.colIndex>-1?r.colIndex:h.colCount-2);o.model.allowSelection&&(h._isRowSelected||h._isSheetSelected)&&st.refreshSelection();o._refreshTemplates(i,!0)},_insertColHeaders:function(t,i,r){var f=this._columnHeaderTemplate(i+1,t),u;n(r).append(f);u=this._colGroupTemplate(t);n(r.parentNode.previousSibling).append(u)},_scrollBottom:function(n,t){var i=this.XLObj.getSheet(n),r,u;if(t)this._createRows(i.rowCount-1,i.rowCount+t,n);else{this._createNewRow(n,-1,-1,"insert");for(r in i._columnStyles)u=parseInt(r),this.XLObj.XLEdit._updateDataContainer({rowIndex:i.rowCount-1,colIndex:u},{dataObj:i._columnStyles[r]})}},_createRows:function(n,t,i){for(var r=this.XLObj,i=i||r.getActiveSheetIndex(),e=r.getSheet(i),o=r.getSheetElement(i),u=n,f=t;u<f;u++)this._createNewRow(i,-1,-1,"insert")},_scrollRight:function(n){var r={rowIndex:-1,colIndex:-1},t,u,i;this._createNewColumn(n,r,r,"insert");t=this.XLObj.getSheet(n);for(i in t._rowStyles)u=parseInt(i),this.XLObj.XLEdit._updateDataContainer({rowIndex:u,colIndex:t.colCount-1},{dataObj:t._rowStyles[i]})},_refreshRowCol:function(n,t){t=this.XLObj._getSheetIndex(t);var i,r=this.XLObj.getSheet(t),u=!1;if(r.colCount<n[3]+1){for(i=n[3]-(r.colCount-1);i--;)this._scrollRight(t);u=!0}if(r.rowCount<n[2]+1){for(i=n[2]-(r.rowCount-1);i--;)this._scrollBottom(t);u=!0}u&&this._refreshScroller(t,"refresh","all")}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.formatCellDialog=function(n){this.XLObj=n;this._categories=[{value:"General",text:n._getLocStr("LGeneral")},{value:"Number",text:n._getLocStr("NumberTab")},{value:"Currency",text:n._getLocStr("LCurrency")},{value:"Accounting",text:n._getLocStr("LAccounting")},{value:"Date",text:n._getLocStr("LDate")},{value:"Time",text:n._getLocStr("LTime")},{value:"Percentage",text:n._getLocStr("LPercentage")},{value:"Fraction",text:n._getLocStr("LFraction")},{value:"Scientific",text:n._getLocStr("LScientific")},{value:"Text",text:n._getLocStr("LText")},{value:"Custom",text:n._getLocStr("LCustom")}];this._selValue="General"};t.spreadsheetFeatures.formatCellDialog.prototype={_renderCellFrmtDlg:function(){var i=this.XLObj,y=i._id,r=y+"_formatdlg",e,u,f,o,l,a,s,v,h,c;e=t.buildTag("div#"+r);u=t.buildTag("div#"+r+"_formattab");f=t.buildTag("div.e-dlg-fields e-dlgctndiv");o=t.buildTag("ul .e-ul");l=t.buildTag("a",i._getLocStr("NumberTab"),{},{href:"#"+r+"_number"});a=t.buildTag("li",l);o.append(a);u.append(o);f.append(u);s=t.buildTag("div.e-dlg-btnfields");v=t.buildTag("div.e-dlg-btnctnr");h=t.buildTag("input#"+r+"_okbtn");c=t.buildTag("input#"+r+"_cantn");h.ejButton({text:i._getLocStr("Ok"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgCFOk,this),cssClass:"e-ss-okbtn"});c.ejButton({text:i._getLocStr("Cancel"),showRoundedCorner:!0,width:60,click:t.proxy(this._dlgCFCancel,this)});s.append(v.append(h,c));f.append(t.buildTag("div#"+r+"_format_dataMnger","",{display:"none"}));i.element.append(e.append(f,s));u.ejTab({width:"100%",height:"auto",cssClass:"e-ss-dlgtab",allowKeyboardNavigation:!1});this._renderNumberTab();e.ejDialog({enableModal:!0,showOnInit:!1,enableResize:!1,allowKeyboardNavigation:!1,title:i._getLocStr("Formatcells"),width:"auto",height:"auto",cssClass:"e-ss-dialog e-ss-mattab e-ss-fcdlg e-"+i._id+"-dlg",open:function(){n("#"+i._id+"_formatdlg_okbtn").focus()}})},_renderNumberTab:function(){var f=this.XLObj,i=f._id+"_fdlg_nTab",it=this._categories,p,w,b,k,s,e,r,u,c,l,a,v,y,d,g;p=[{text:"Wednesday, March 14, 2012",value:"{0:dddd, MMMM dd, yyyy}"},{text:"3/14/2012",value:"{0:M/d/yyyy}"},{text:"March 03",value:"{0:MMMM dd}"},{text:"2012 March",value:"{0:yyyy MMMM}"},{text:"3/14/12 1:30 PM",value:"{0:dd/MM/yyyy h:mm tt}"}];w=[{text:"0",type:"default"},{text:"0.00",type:"default"},{text:"#,##0",type:"default"},{text:"#,##00.00",type:"default"},{text:"0%",type:"default"},{text:"0.00%",type:"default"},{text:"MM/dd/yyyy",type:"default"},{text:"d-MMM",type:"default"},{text:"h:mm",type:"default"},{text:"mm:ss",type:"default"}];b=[{text:"1:30:55 PM",value:"{0:h:mm:ss tt}"},{text:"1:30 PM",value:"{0:h:mm tt}"},{text:"13:30:55",value:"{0:h:mm:ss}"},{text:"1:30",value:"{0:hh:mm}"}];var rt=t.buildTag("div.e-ss-maindiv"),nt=t.buildTag("div.e-ss-topdiv","",{display:"inline-flex",width:"100%"}),tt=t.buildTag("div.e-ss-centerdiv","",{display:"inline-flex",width:"100%"}),h=t.buildTag("div.e-ss-lefttopdiv",""),o=t.buildTag("div.e-ss-righttopdiv","",{float:"right"});k=t.buildTag("label.e-dlg-fields",f._getLocStr("FormatSample"));o.append(k);nt.append(h,o);h=t.buildTag("div.e-ss-leftdiv","");o=t.buildTag("div.e-ss-rightdiv","",{float:"right"});s=t.buildTag("input#"+i+"_sinput.ejinputtext","",{},{disabled:"disabled"});o.append(s);$div=t.buildTag("div#div"+i,"");e=t.buildTag("table","",{"white-space":"normal"});r=t.buildTag("tr#"+i+"_decimal.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("DecimalPlacesTxt")),"",{width:"103px"});e.append(r.append(u));r=t.buildTag("tr#"+i+"_decimaldrop.e-fdlg-num-options");u=t.buildTag("td");s=t.buildTag("input#"+i+"_decimalplace","");o.append($div.append(e.append(r.append(u.append(s)))));r=t.buildTag("tr#"+i+"_tseparator.e-fdlg-num-options");u=t.buildTag("td","","",{colspan:"2"});$chkelem=t.buildTag("input#"+i+"_kseptr");e.append(r.append(u.append($chkelem)));r=t.buildTag("tr#"+i+"_dtypes.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("Type")));c=t.buildTag("ul#"+i+"_datetypes");e.append(r.append(u.append(c)));r=t.buildTag("tr#"+i+"_ttypes.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("Type")));l=t.buildTag("ul#"+i+"_timetypes");e.append(r.append(u.append(l)));r=t.buildTag("tr#"+i+"_custom.e-fdlg-num-options");u=t.buildTag("td",t.buildTag("label.e-dlg-fields",f._getLocStr("Type")));a=t.buildTag("input#"+i+"_custominput.ejinputtext");v=t.buildTag("ul#"+i+"_customtypes");y=t.buildTag("button#"+i+"_delBtn",f._getLocStr("Delete"),{},{type:"button"});d=t.buildTag("div",y);e.append(r.append(u.append(a,v,d)));f._on(a,"keydown",this._validateCustomFormat);g=t.buildTag("div#"+i+"_typeinfo.e-ss-fcgdiv","",{});o.append($div);tt.append(h,o);n("#"+f._id+"_formatdlg_number").append(rt.append(nt,tt,g));e.find(".e-fdlg-num-options").hide();this._createNumList(it,h);s.ejNumericTextbox({name:"numeric",value:2,height:27,width:"100%",minValue:0,maxValue:30,change:n.proxy(this._refreshFrmtPropChanges,this)});$chkelem.ejCheckBox({change:n.proxy(this._refreshFrmtPropChanges,this)});$chkelem.parent().append(t.buildTag("label.e-dlg-fields",f._getLocStr("ThousandSeparatorTxt"),{"margin-left":6}));c.ejListBox({selectedItemIndex:"0",dataSource:p,fields:{text:"text",value:"value"},width:"100%",height:"120",selected:n.proxy(this._refreshFrmtPropChanges,this)});l.ejListBox({selectedItemIndex:"0",dataSource:b,fields:{text:"text",value:"value"},width:"100%",height:"120",selected:n.proxy(this._refreshFrmtPropChanges,this)});v.ejListBox({selectedItemIndex:"0",dataSource:w,fields:{text:"text",value:"value"},width:"100%",height:"100",selected:n.proxy(this._refreshFrmtPropChanges,this)});n("#"+i+"_datetypes_container").addClass("e-ss-datetypes");n("#"+i+"_timetypes_container").addClass("e-ss-timetypes");n("#"+i+"_customtypes_container").addClass("e-ss-customtypes");y.ejButton({showRoundedCorner:!0,width:60,click:n.proxy(this._customFormatDelete,this)})},_initFormatCellDlg:function(){var t=this.XLObj;if(!t.model.allowCellFormatting)return!1;n("#"+t._id+"_formatdlg").ejDialog("open");this._updateFormtdata();n("#"+t._id+"_formatdlg_format_dataMnger").removeData()},_updateFormtdata:function(){var i=this.XLObj,s=i.getActiveCell(),r=n("#"+i._id+"_fdlg_nTab_list").data("ejListBox"),w=n("#"+i._id+"_fdlg_nTab_decimalplace").data("ejNumericTextbox"),a=n("#"+i._id+"_fdlg_nTab_datetypes").data("ejListBox"),v=n("#"+i._id+"_fdlg_nTab_timetypes").data("ejListBox"),b=n("#"+i._id+"_fdlg_nTab_input").data("ejDropDownList"),u=n("#"+i._id+"_fdlg_nTab_customtypes").data("ejListBox"),t,y,p,f,e,o,h,c,l;r&&r._refreshScroller();t=i.getRangeData({range:[s.rowIndex,s.colIndex,s.rowIndex,s.colIndex]})[0];y="decimalPlaces"in t?t.decimalPlaces:2;p="thousandSeparator"in t?t.thousandSeparator:!1;f="type"in t?t.type.indexOf("date")>-1?"date":t.type:"general";"formatStr"in t?(e=a.getIndexByValue(t.formatStr),o=v.getIndexByValue(t.formatStr),i.isUndefined(e)&&i.isUndefined(o)&&["date"].indexOf(f)>-1&&(h=u.model.dataSource,c=t.formatStr.replace(/^\{0\:|\}$/g,""),i._isValueAlreadyExist(h,"text",c)||(h.push({text:c,type:"custom"}),u._setModel({dataSource:h})),l=u.getIndexByText(c),f="custom")):e=o=0;r&&r.selectItemByValue(n.camelCase("-"+f));a.selectItemByIndex(e>-1?e:0);v.selectItemByIndex(o>-1?o:0);u.selectItemByIndex(l>-1?l:0);f==="string"&&(r.selectItemByIndex(10),u.selectItemByText(t.formatStr));w.option("value",y);n("#"+i._id+"_fdlg_nTab_kseptr").ejCheckBox({checked:p});this._onNumFormatSelect({value:r?r.model.value:b.model.value})},_onNumFormatSelect:function(t){var i=this.XLObj,r="#"+i._id+"_fdlg_nTab_",f=n("#"+i._id+"_fdlg_nTab_typeinfo"),u;n("#"+i._id+"_formatdlg_number").find(".e-fdlg-num-options").hide();value=t.value;switch(value){case"Number":i.model.formatSettings.allowDecimalPlaces&&n(r+"decimal, "+r+"tseparator, "+r+"decimaldrop").show();break;case"Currency":case"Accounting":case"Percentage":case"Scientific":n(r+"decimal").show();n(r+"decimaldrop").show();break;case"Date":n(r+"dtypes").show();n("#"+i._id+"_fdlg_nTab_datetypes").data("ejListBox")._refreshScroller();break;case"Time":n(r+"ttypes").show();n("#"+i._id+"_fdlg_nTab_timetypes").data("ejListBox")._refreshScroller();break;case"Custom":n(r+"custom").show();n("#"+i._id+"_fdlg_nTab_customtypes").data("ejListBox")._refreshScroller()}u=this._getFormattedText(value);n("#"+i._id+"_fdlg_nTab_decimalplace").data("ejNumericTextbox").option("maxValue",value==="Scientific"?20:30);n("#"+i._id+"_fdlg_nTab_sinput").val(u);f.text(i._getLocStr(value));this._selValue=value},_getFormattedText:function(i){var f,o,r,e=0,u=this.XLObj,c=u.getActiveCell(),v=n("#"+u._id+"_fdlg_nTab_decimalplace").data("ejNumericTextbox"),y=n("#"+u._id+"_fdlg_nTab_datetypes").data("ejListBox"),l={Number:"0:N",Currency:"0:C",Accounting:"0:C",Percentage:"0:P",Scientific:"0:N"},p=n("#"+u._id+"_fdlg_nTab_timetypes").data("ejListBox"),h=t.Spreadsheet.CellType,a=t.Spreadsheet.CellFormat,s=n("#"+u._id+"_fdlg_nTab_customtypes").data("ejListBox");u.model.formatSettings.allowDecimalPlaces&&(e=v.getValue());r=u.XLEdit.getPropertyValue(c.rowIndex,c.colIndex)||"";o=n("#"+u._id+"_fdlg_nTab_kseptr").ejCheckBox("checked");switch(i){case"Number":case"Currency":case"Accounting":case"Percentage":f="{"+l[i]+e+"}";u._isDateTime(r)&&(r=u._dateToInt(r));r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,thousandSeparator:o,type:h[i],decimalPlaces:e}));break;case"Date":f=y.getSelectedItems()[0].value;i=f===a.longdate?"longdate":f===a.shortdate?"shortdate":"date";r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,type:i}));break;case"Time":f=p.getSelectedItems()[0].value;r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,type:h[i]}));e=0;break;case"Scientific":f="{"+l[i]+e+"}";u._isDateTime(r)&&(r=u._dateToInt(r));r=u.XLFormat._format(r,u.XLFormat._getFormatObj({formatStr:f,thousandSeparator:o,type:h[i],decimalPlaces:e}));break;case"Fraction":u._isDateTime(r)&&(r=u._dateToInt(r));r=u.toFraction(r);r&&(r=t.isNullOrUndefined(r.numerator)?r.integer:r.integer+" "+r.numerator+"/"+r.denominator);break;case"General":case"Text":u._isDateTime(r)&&(r=u._dateToInt(r));break;case"Custom":cValue=s.getSelectedItems()[0].text;formatObj=u.XLFormat.customFormatParser(cValue);n("#"+u._id+"_fdlg_nTab_custominput").val(cValue);r=u.XLFormat._format(r,formatObj);s.getSelectedItems()[0].index>-1&&n("#"+u._id+"_fdlg_nTab_delBtn").data("ejButton")._setModel({enabled:s.model.dataSource[s.getSelectedItems()[0].index].type==="custom"})}return n("#"+u._id+"_formatdlg_format_dataMnger").data("NumFormat",i==="Custom"?formatObj:{type:i.toLowerCase(),decimalPlaces:e,thousandSeparator:o,formatStr:f}),r},_refreshFrmtPropChanges:function(){var i=this.XLObj,t;t=this._getFormattedText(this._selValue);n("#"+i._id+"_fdlg_nTab_sinput").val(t)},_dlgCFCancel:function(){var t=this.XLObj;n("#"+t._id+"_formatdlg").ejDialog("close");t.model.showRibbon&&t.XLRibbon._updateRibbonIcons();t.setSheetFocus()},_dlgCFOk:function(t){var i=this.XLObj,r=n("#"+i._id+"_formatdlg_format_dataMnger").data();t&&this._selValue==="Custom"&&this._validateCustomFormat()||(i.getObjectLength(r.NumFormat)&&i.XLFormat.format(r.NumFormat),i.model.showRibbon&&i.XLRibbon._updateRibbonIcons(),n("#"+i._id+"_formatdlg").ejDialog("close"),i.setSheetFocus())},_customFormatDelete:function(){var t=n("#"+this.XLObj._id+"_fdlg_nTab_customtypes").data("ejListBox"),i=t.model.dataSource;i.splice(t.model.selectedItemIndex,1);t._setModel({dataSource:i});t.selectItemByIndex(0);this._refreshFrmtPropChanges()},_validateCustomFormat:function(t){var i=t?this:this.XLObj,u,r,f,e=n("#"+i._id+"_fdlg_nTab_custominput").val(),o=i.XLFormat.customFormatParser(e);if(!t||t.keyCode===13)if(i.getObjectLength(o))u=n("#"+i._id+"_fdlg_nTab_customtypes").data("ejListBox"),r=u.model.dataSource,i._isValueAlreadyExist(r,"text",e)||(r.push({text:e,type:"custom"}),u._setModel({dataSource:r})),n("#"+i._id+"_formatdlg_format_dataMnger").data("NumFormat",o),t&&i.XLCellFrmtDlg._dlgCFOk();else return f=n("#"+i._id+"_alertdlg"),i._renderAlertDlgContent(f,"Alert",i._getLocStr("CustomFormatAlert")),f.ejDialog("open"),!0},_createNumList:function(i,r){var u=this.XLObj,f=u._id+"_fdlg_nTab",s,e,o,h=t.buildTag("div.e-ss-drpdiv");e=t.buildTag("input#"+f+"_input");h.append(e);n("#"+u._id+"_formatdlg_number").prepend(h);e.ejDropDownList({dataSource:i,cssClass:"e-ss-num-format",width:"100%",fields:{id:"value",text:"text",value:"text"},select:n.proxy(this._onNumFormatSelect,this),selectedItemIndex:0});s=t.buildTag("label#"+f+"_clabel.e-dlg-fields",u._getLocStr("Category"));u.element.find(".e-ss-lefttopdiv").append(s);o=t.buildTag("ul#"+f+"_list");r.append(o);o.ejListBox({selectedItemIndex:"0",width:"120",height:"250",dataSource:i,fields:{text:"text",value:"value"},select:n.proxy(this._onNumFormatSelect,this),allowMultiSelection:!1})}}}(jQuery,Syncfusion),function(n,t){t.spreadsheetFeatures=t.spreadsheetFeatures||{};t.spreadsheetFeatures.pivot=function(n){this.XLObj=n;this._pivotCnt=1;this._hasPvtField=!1;this._displayActPanel=!0;this.names={}};t.spreadsheetFeatures.pivot.prototype={createPivotTable:function(t,i,r,u,f){var e=this.XLObj,c;if(e.model.enablePivotTable&&!e.model.isReadOnly){var l=e.XLRibbon,h=e.getActiveSheetIndex(),s=[],a,v,y,o,p=0,w=0,b;if(e._showDialog(e._id+"_Ribbon_Insert_Tables_PivotTable"),o=l._getAddrFromDollarAddr(t),a=e.model.sheets[o[0]].sheetInfo.text,t=e.getRangeIndices(o[1]),v=e.getRangeDataAsJSON({rowIndex:t[0],colIndex:t[1]},{rowIndex:t[2],colIndex:t[3]},!1,o[0]),n("#"+e._id+"_dlg_existsheet").data("ejRadioButton").model.checked||e.isImport||!e.getSheet(h)._isLoaded?(o=l._getAddrFromDollarAddr(i),s=e.getRangeIndices(o[1]),e._isExport||h===o[0]||(e.gotoPage(o[0],!1),h=o[0])):(e.insertSheet(),h=e.getActiveSheetIndex(),s=[2,0]),e.isUndefined(f)&&(f={}),w=e.model.sheets[o[0]]._rowHeightCollection[s[0]],p=e.model.sheets[o[0]]._colWidthCollection[s[1]],e.hideActivationPanel(),r&&r.length){if(e.getObjectKeys(this.names).indexOf(r)>-1)do r=r+this._pivotCnt,this._pivotCnt++;while(e.getObjectKeys(this.names).indexOf(r)>-1)}else do r="PivotTable"+this._pivotCnt,this._pivotCnt++;while(e.getObjectKeys(this.names).indexOf(r)>-1);return c=e._id+"_"+r,this.names[c]=r,f.pvtRange=s,f.sheetIdx=h,f.temp=o[0],f.datasource=v,e.getSheet(h)._isUpdated||this._updatePivotMngr({},{pivot:{id:c,top:w,left:p,rowIndex:s[0],colIndex:s[1],dataRange:t,dataSheetName:a,sheetIdx:h}}),this._refreshPivotElement(t,i,r,u,f),b=e.element.find("#"+c).data("ejPivotGrid"),this._refreshRowColumn(s,b),e.showActivationPanel(),y={sheetIndex:f.sheetIdx,reqType:"shape",shapeType:"pivot",range:f.pvtRange,ID:c,dataSource:f.datasource},e._trigActionComplete(y),c}},_refreshRowColumn:function(n,t){var r=this.XLObj,o=r.getActiveSheetIndex(),s=r.getSheet(o),f=[],u,t,i,e;for(u=t._rowCount,e=t.calculateCellWidths().rowHeight,f=t.calculateCellWidths().columnWidths,colCount=f.length,u||(u=4),i=n[0];i<u+n[0];i++)r.XLResize.setRowHeight(i,e);if(colCount>0)for(i=0;i<colCount+n[1];i++)r.XLResize.setColWidth(i+n[1],f[i]);else for(i=0;i<3+n[1];i++)r.XLResize.setColWidth(i+n[1],81);s._isFreezed&&(r.XLFreeze._refreshFreezeRowDiv(),r.XLFreeze._refreshFreezeColDiv())},_refreshPivotElement:function(i,r,u,f,e){var o=this.XLObj,s,h,c,l,a;l=o.model.sheets[e.sheetIdx]._rowHeightCollection[e.pvtRange[0]];a=o.model.sheets[e.sheetIdx]._colWidthCollection[e.pvtRange[1]];c={dataSource:{data:e.datasource},enableToolTipAnimation:!1,cellDoubleClick:n.proxy(this._cellDblClick,this),enableCellDoubleClick:!0,renderSuccess:n.proxy(this._renderSuccess,this),drillSuccess:n.proxy(this._renderSuccess,this)};t.isNullOrUndefined(f)||(c.dataSource={data:e.datasource,rows:f.rows,columns:f.columns,values:f.values,filters:f.filters});o.getSheetElement(o.getActiveSheetIndex()).find(".e-ss-activepivot").removeClass("e-ss-activepivot");s=t.buildTag("div.e-ss-pivot","","",{id:o._id+"_"+u});s.css({left:a-2,top:l-2}).addClass("e-ss-activepivot");o._getContent(e.sheetIdx).find(".e-content").append(s);this._hasPvtField||o.getActivationPanel().append(t.buildTag("div","",{overflow:"hidden"},{id:o._id+"_PivotField"}));o.element.find("#"+o._id+"_PivotField").append(t.buildTag("div.e-ss-pivotfield","","",{id:o._id+"_PivotTableSchema_"+o._id+"_"+u}));h=o.element.find("#"+o._id+"_PivotTableSchema_"+o._id+"_"+u);o.getActivationPanel().find("#"+h[0].id).show();s.ejPivotGrid(c);h.find("#"+o._id+"_PivotTableSchema_"+o._id+"_"+u+"_schemaFieldTree").data("ejTreeView").option("allowDragAndDrop",!1);h.css({float:"left",width:o.model.activationPanelWidth-20});h.find(".schemaFieldList").css({height:150});this._hasPvtField||(o.getActivationPanel().ejScroller({width:o.model.activationPanelWidth,height:o._getContent(e.sheetIdx).height(),scroll:n.proxy(this._pivotScroll,this)}),this._hasPvtField=!0);this._clearBackgroundData(s.data("ejPivotGrid"),o.getSheet(e.sheetIdx).pivotMngr.pivot[s[0].id],e.sheetIdx,"update");o.XLRibbon&&o.XLRibbon._analyzeTabUpdate();o.XLSelection._cleanUp(!0);o.getActivationPanel().data("ejScroller").refresh()},deletePivotTable:function(n){var u=this._getPivotIDFromName(n),t=this.XLObj,f,e=t._dataContainer,r,i;if(t.model.enablePivotTable&&!t.model.isReadOnly)for(i=1,len=t.model.sheetCount;i<=len;i++)t._getContent(i).find("#"+u).length&&(r=t.getSheet(i).pivotMngr.pivot[u],f=e.sheets[i][r.rowIndex][r.colIndex],t.getObjectLength(f)<2&&f.pivot.length<2?delete e.sheets[i][r.rowIndex][r.colIndex]:f.pivot.length<2&&delete e.sheets[i][r.rowIndex][r.colIndex].pivot,delete t.getSheet(i).pivotMngr.pivot[u],t._getContent(i).find("#"+u).remove(),t.hideActivationPanel(),t.getActivationPanel().find("#"+t._id+"_PivotTableSchema_"+u).remove(),t.XLRibbon._toggleAnalyzeTab(),t._trigActionComplete({ID:u,rowIndex:r.rowIndex,colIndex:r.colIndex,reqType:"shape",shapeType:"pivot",sheetIndex:i}))},refreshDataSource:function(n,t){var i=this.XLObj,r,f,e,u,o;i.model.enablePivotTable&&!i.model.isReadOnly&&(n&&t?(r=i.element.find("#"+i._id+"_"+n),r&&(f=r[0].id)):(t=i.getActiveSheetIndex(),r=i._getContent(t).find(".e-ss-activepivot"),f=r[0].id),e=r.data("ejPivotGrid"),e&&(u=i.getSheet(t).pivotMngr.pivot[f].dataRange,o=i.getRangeDataAsJSON({rowIndex:u[0],colIndex:u[1]},{rowIndex:u[2],colIndex:u[3]},!1,i._getSheetIndexByName(i.getSheet(t).pivotMngr.pivot[f].dataSheetName)),e.model.dataSource.data=o,e.refreshPivotGrid()))},clearPivotFieldList:function(n){var t=this.XLObj,i=this._getPivotIDFromName(n);t.model.enablePivotTable&&!t.model.isReadOnly&&this._clearFilters(t.element.find("#"+i).data("ejPivotGrid"),t.getActivationPanel().find("#"+t._id+"_PivotTableSchema_"+i).data("ejPivotSchemaDesigner"))},_cellDblClick:function(n){if(n.selectedData.length){var t=this.XLObj,i=t.XLFormat,r;t.insertSheet();r=t.getActiveSheetIndex();t.updateRange(r,{dataSource:n.selectedData,startCell:"A1",showHeader:!0});i.createTable({header:!0,name:"Table"+t._tableCnt,format:i._getTableLayoutFromName("TableStyleMedium9").format,formatName:"TableStyleMedium9"},"A1:"+t._generateHeaderText(t.getObjectLength(n.selectedData[0]))+(n.selectedData.length+1))}},_dragMove:function(){var i=this.XLObj,t,r=i.getActivationPanel().data("ejScroller"),f=i.element.find(".e-spreadsheetactpanel"),u=f.offset().top;f.height()+u-45<n(".e-dragedNode").offset().top?t=setInterval(function(){f.height()+u-45<n(".e-dragedNode").offset().top&&r.scrollY(r.model.scrollTop+25)},300):u+45>n(".e-dragedNode").offset().top&&(t=setInterval(function(){u+45>n(".e-dragedNode").offset().top&&r.scrollY(r.model.scrollTop-25)},300));i._browserDetails.name==="msie"&&i._browserDetails.version==="8.0"?(n(".e-dragedNode")[0].attachEvent("onmouseup",function(){clearInterval(t)}),document.attachEvent("onmouseup",function(){clearInterval(t)})):(n(".e-dragedNode")[0].addEventListener("mouseup",function(){clearInterval(t)}),document.addEventListener("mouseup",function(){clearInterval(t)}))},_renderSuccess:function(i){i.type==="drillSuccess"&&(i=i.gridObj);var r=this.XLObj,e=r.getActiveSheetIndex(),o,s,u,f=i,h=[];r._isExport||this._clearBackgroundData(i,r.getSheet(e).pivotMngr.pivot[i._id],e,"update");r.element.find("#"+r._id+"_PivotTableSchema_"+i._id).ejPivotSchemaDesigner({pivotControl:i,layout:t.PivotSchemaDesigner.Layouts.Excel,dragMove:n.proxy(this._dragMove,this),fieldItemDropped:n.proxy(this._fieldItemDropped,this)});u=r.getSheet(e).pivotMngr.pivot[i._id];s=f._rowCount;o=f.getJSONRecords().length/f._rowCount;h=[u.rowIndex,u.colIndex,u.rowIndex+s,u.colIndex+o];this._refreshRowColumn(h,f);n(".e-spreadsheet .e-pivotgrid th[role='columnheader'").addClass("e-ss-pivottableheader");n(".e-spreadsheet .e-pivotgrid tr:last th.rgtot").addClass("e-ss-pivottableheader");r.XLDragFill.hideAutoFillElement()},_clearBackgroundData:function(n,t,i,r){var u=this.XLObj,f,e,o,s;f=n.getJSONRecords().length/n._rowCount;e=n._rowCount;o=!e||isNaN(e)?t.rowIndex+17:t.rowIndex+e;s=!f||isNaN(f)?t.colIndex+2:t.colIndex+f-1;r&&r!=="update"?u.getRange([t.rowIndex,t.colIndex,o,s],i).removeClass("e-readOnly"):u.getRange([t.rowIndex,t.colIndex,o,s],i).removeClass("e-readOnly").addClass("e-readonly");u._dupDetails=!0;u.clearRangeData([t.rowIndex,t.colIndex,o,s],["value","value2","hyperlink","cFormatRule","comment","format","formats"],"",!1);u._dupDetails=!1},_fieldItemDropped:function(n){if(n.axis==="filter"){var t=this.XLObj,u=t.getActiveSheetIndex(),r,i;for(i=t._getContent(u).find(".e-ss-activepivot").data("ejPivotGrid"),pivot=t.getSheet(u).pivotMngr.pivot[i._id];pivot.rowIndex<=i.getOlapReport().filters.length;)pivot.rowIndex=pivot.rowIndex+1,r=t.getCell(pivot.rowIndex,pivot.colIndex)[0],i.element.css({left:r.offsetLeft-2,top:r.offsetTop-2})}},_updatePivotMngr:function(t,i){var r=this.XLObj,u=r.getSheet(r.getActiveSheetIndex()).pivotMngr,f=u.pivot;f[i.pivot.id]=n.extend(!0,{},i.pivot);r.XLEdit._updateDataContainer({rowIndex:i.pivot.rowIndex,colIndex:i.pivot.colIndex},{dataObj:{pivot:i.pivot.id}})},_pivotMouseDown:function(t){var i=this.XLObj;t.preventDefault();i.getActivationPanel().find("#"+i._id+"_PivotTableSchema_"+t.target.id).show();i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot").removeClass("e-ss-activepivot");n(t.target).hasClass("e-ss-pivot")?n(t.target).addClass("e-ss-activepivot"):n(t.target).parents("e-ss-object").addClass("e-ss-activepivot");i.XLSelection._cleanUp(!0);i.showActivationPanel()},_pivotScroll:function(t){var i=this.XLObj,r=i.getActivationPanel().find("#"+i._id+"_PivotTableSchema_"+i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id).data("ejPivotSchemaDesigner");t.source==="thumb"&&(n(".e-dragedNode").length||r._isDragging||this.XLObj.XLResize._allowStart)&&(t.cancel=!0)},_pivotMouseUp:function(t){var i=this.XLObj,r=n(t.target),u=n("#"+i._id+"_Ribbon").data("ejRibbon");i.model.showRibbon&&(i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot").length&&(r.hasClass("e-ss-pivot")||r.parents(".e-ss-pivot").length)?i.XLRibbon._analyzeTabUpdate():!i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot").length&&(u.model.selectedItemIndex===i.XLRibbon._getTabIndex("analyze")||u.isVisible("Analyze"))&&i.XLRibbon._toggleAnalyzeTab())},_changePvtName:function(){var n=this.XLObj,t=n.element.find("#"+n._id+"_Ribbon_Analyze_PivotTable_PivotTableName").val();this.names[n._getContent(n.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id]=t;n._trigActionComplete({pvtName:t,reqType:"shape",shapeType:"pivot",sheetIndex:n.getActiveSheetIndex(),ID:n._getContent(n.getActiveSheetIndex()).find(".e-ss-activepivot")[0].id})},_checkRange:function(n,t){var i=this.XLObj,d=i.getActiveCell(),v,y=d.rowIndex,p=d.colIndex,w,r=[],b=i._getContent(i.getActiveSheetIndex()).find(".e-ss-activepivot"),e,u,h,c={isHeader:!1,isRows:!1},k,s,o,g,l,a,nt,tt,f;if(e=i.XLRibbon._getAddrFromDollarAddr(n),v=e[0],r=i.getRangeIndices(e[1]),y=r[0],p=r[1],n.length)for(u=0,h=r[3]-p+1;u<h;u++)w=i.XLEdit.getPropertyValue(y,p+u,"value",v),(i.isUndefined(w)||w=="")&&(c.isHeader=!0);if(y===r[2]&&(c.isRows=!0),t.length)for(e=i.XLRibbon._getAddrFromDollarAddr(t),v=e[0],r=i.getRangeIndices(e[1]),u=1,h=i.model.sheetCount;u<=h;u++)for(k=i.model.sheets[u].pivotMngr.pivot,s=i.getObjectKeys(k),o=0,g=s.length;o<g;o++)if((!b.length||b.length&&s[o]!==b[0].id)&&(l=i.element.find("#"+s[o]).data("ejPivotGrid"),f=k[s[o]],colCount=l.getJSONRecords().length/l.rowCount,a=l.rowCount,nt=!a||isNaN(a)?f.rowIndex+17:f.rowIndex+a-1,tt=!colCount||isNaN(colCount)?f.colIndex+2:f.colIndex+colCount-1,r[0]>=f.rowIndex&&r[0]<=nt&&r[1]>=f.colIndex&&r[1]<=tt)){c.isOverlap=!0;break}return c},_updateSheetName:function(n){for(var t=this.XLObj,r,u,e,o=t.getSheet(t.getActiveSheetIndex()).sheetInfo.text,i=1,f=t.model.sheetCount;i<=f;i++)for(r=t.getSheet(i).pivotMngr.pivot,u=t.getObjectKeys(r),j=0,e=u.length;j<e;j++)r[u[j]].dataSheetName===o&&(r[u[j]].dataSheetName=n)},_getSheetIdxFromName:function(n){for(var i=this.XLObj,t=1,r=i.model.sheetCount;t<=r;t++)if(i.model.sheets[t].sheetInfo.text==n)return t},_changeDataSource:function(){var t=this.XLObj,o=t.getActiveSheetIndex(),i=t._getContent(o).find(".e-ss-activepivot")[0].id,e=n("#"+i).data("ejPivotGrid"),s,r,h,u,f;r=t.XLRibbon._getAddrFromDollarAddr(n("#"+t._id+"_Ribbon_PvtRange").val());h=t.model.sheets[r[0]].sheetInfo.text;range=t.getRangeIndices(r[1]);f=t.getSheet(t.getActiveSheetIndex()).pivotMngr.pivot[i];f.dataRange=range;f.dataSheetName=h;u=t.getRangeDataAsJSON({rowIndex:range[0],colIndex:range[1]},{rowIndex:range[2],colIndex:range[3]},!1,r[0]);e.getOlapReport().data=u;s=n("#"+t._id+"_PivotTableSchema_"+i).data("ejPivotSchemaDesigner");e.model.dataSource.data=u;this._clearFilters(e,s);t._trigActionComplete({sheetIndex:o,dataRange:f.dataRange,ID:i,pvtData:u,reqType:"shape",shapeType:"pivot"})},_getPivotIDFromName:function(n){for(var t in this.names)if(n===this.names[t])return t},_clearFilters:function(t,i){var u=this.XLObj,r=t.getOlapReport();r.rows=[];r.columns=[];r.values=[];r.filters=[];t.refreshPivotGrid();i.model.pivotControl=t;n(i.element).html("");i._load();u._refreshActivationPanel()},_movePivotTable:function(){var t=this.XLObj,u=t.getActiveSheetIndex(),f=t._getContent(u).find(".e-ss-activepivot"),o=f[0].id,r,s=f.data("ejPivotGrid"),a,h,e,c,i,l,v=!0,y,w,b,p;if(r=t.getSheet(u).pivotMngr.pivot[o],n("#"+t._id+"_dlg_existsheet").data("ejRadioButton").model.checked?(v=!1,a=n("#"+t._id+"_Ribbon_PvtLocation").val().split("!"),h=this._getSheetIdxFromName(a[0]),i=t.getRangeIndices(t.XLRibbon._getAddrFromDollarAddr(a[1])[1]),u!==h&&(t._getContent(h).find(".e-content").append(f),t.gotoPage(h,!1),t.XLSelection._cleanUp(!0),v=!0),r.rowIndex=i[0],r.colIndex=i[1]):(t.insertSheet(),u=t.getActiveSheetIndex(),t._getContent(u).find(".e-content").append(f),i=[2,0]),v&&(l=t.getActiveSheetIndex(),t.getSheet(l).pivotMngr.pivot[o]={},n.extend(!0,t.getSheet(l).pivotMngr.pivot[o],r),l!==u&&delete t.getSheet(u).pivotMngr.pivot[o]),c=t.getCell(i[0],i[1]),!c&&t.model.scrollSettings.allowVirtualScrolling&&(p=t.getSheet(t.getActiveSheetIndex()),t._scrollContent({y:p._rowHeightCollection[i[0]+1]-p._scrollTop}),c=t.getCell(i[0],i[1])),e=c[0],f.css({left:e.offsetLeft-2,top:e.offsetTop-2}),s.getOlapReport().filters.length)while(r.rowIndex<=s.getOlapReport().filters.length)r.rowIndex=r.rowIndex+1,e=t.getCell(r.rowIndex,r.colIndex)[0],f.css({left:e.offsetLeft-2,top:e.offsetTop-2});b=s._rowCount;w=s.calculateCellWidths().columnWidths.length;y=[i[0],i[1],i[0]+b,i[1]+w];this._refreshRowColumn(y,s);t._trigActionComplete({sheetIndex:u,newRange:y,ID:o,reqType:"shape",shapeType:"pivot"})}}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejReportViewer","ej.ReportViewer",{_rootCSS:"e-reportviewer",element:null,model:null,validTags:["div"],defaults:{reportServiceUrl:"",reportServerId:"",reportPath:"",reportServerUrl:"",dataSources:[],parameters:[],exportSettings:{exportOptions:31,excelFormat:"excel97to2003",pptFormat:"powerpoint97to2003",wordFormat:"doc"},toolbarSettings:{items:1023,showToolbar:!0,templateId:"",click:"",showTooltip:!0},locale:"en-US",printMode:!1,renderMode:3,printOption:"Default",enablePageCache:!1,enablePageVirtualization:!1,pageSettings:{height:0,width:0,orientation:null,paperSize:null,margins:{top:0,right:0,bottom:0,left:0}},processingMode:"remote",zoomFactor:1,isResponsive:!0,reportLoaded:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,renderingBegin:null,renderingComplete:null,reportError:null,reportExport:null,drillThrough:null,reportPrint:null,viewReportClick:null,destroy:null,enableNotificationBar:!0,enableDropDownSearch:!1},dataTypes:{dataSources:"array",parameters:"array",toolbarSettings:{showToolbar:"boolean"}},_dataSources:null,_svg:!0,_authenticationToken:null,_dataRefresh:!1,_isForwardDirection:!1,_isSelectedPage:!1,_refresh:!1,_isToolbarClick:!1,_printMode:!1,_pageSetup:!1,_pageModel:null,_currentPage:1,_pageLayoutPage:1,_machineCulture:null,_reportParameters:null,_reportDataSources:null,_reporDataSets:null,_zoomLevel:2,_preZoomVal:1,_actionUrl:null,_isDocumentMap:!1,_isPageDocMap:!1,_pageDocMapFlag:!1,_childReportAuthentication:null,_parents:[],_parentPageXY:null,_browserInfo:null,_isDevice:!1,_zoomVal:1,_originX:0,_originY:0,_paperName:null,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_paperOrientation:null,_pageCache:[],_printPageCache:[],_paperSetup:{paperHeight:null,paperWidth:null,MarginTop:0,MarginRight:0,MarginBottom:0,MarginLeft:0},_reportAction:{reportLoad:"ReportLoad",getDataSourceCredential:"GetDataSourceCredential",validateDSCredential:"ValidateDSCredential",updateDSCredential:"UpdateDSCredential",getParameters:"GetParameters",setParameters:"SetParameters",updateParameters:"UpdateParameters",updateDataSource:"UpdateDataSource",getPageModel:"GetPageModel",getPrintModel:"GetPrintModel",drillDown:"DrillDown",clearCache:"ClearCache",documentMap:"DocumentMap",drillThrough:"DrillThrough",sorting:"Sorting"},_parameters:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")},_dataSources:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")},_tags:[{tag:"parameters",attr:["",[{tag:"parameter",attr:["name","labels","values","nullable"]}]]},{tag:"dataSources",attr:["",[{tag:"datasource",attr:["name","value"]}]]}],_setModel:function(n){var u=!1,f=!1,t,i,r;for(t in n)switch(t){case"reportPath":case"reportServerUrl":case"reportServiceUrl":u=!0;break;case"dataSources":this._refresh=!0;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:n[t],parameters:this.model.parameters}),"_getDataSourceCredential");break;case"parameters":this._refresh=!0;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:n.parameters}),"_setParameters");break;case"processingMode":f=!0;break;case"zoomFactor":this._zoomContainer(n[t],!1);break;case"printMode":this._updatePreviewLayout(n[t],!1);break;case"toolbarSettings":this._updateToolbarmodel();break;case"locale":this._setCultureInfo();break;case"renderMode":this._reInit();break;case"pageSettings":for(i in n[t])switch(i){case"height":this._paperSetup.paperHeight=n[t][i];this._paperName="Custom";break;case"width":this._paperSetup.paperWidth=n[t][i];this._paperName="Custom";break;case"orientation":this._paperOrientation=n[t][i];break;case"paperSize":this._paperName=n[t][i];break;case"margins":for(r in n[t][i])switch(r){case"top":this._paperSetup.MarginTop=n[t][i][r];break;case"bottom":this._paperSetup.MarginBottom=n[t][i][r];break;case"left":this._paperSetup.MarginLeft=n[t][i][r];break;case"right":this._paperSetup.MarginRight=n[t][i][r]}}this._printMode&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode,PageSetup:this._paperSetup}),this._printMode?"_getPreviewModel":"_getPageModel")}f&&!u&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential");u&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_reportReload")},_reInit:function(){this._destroy();this._init()},_destroyEJObjects:function(t){for(var f,e,u,i,r=0;r<t.length;r++)f=n(t[r]),e=f.data("ejWidgets"),e&&(u=f.data(e[0]),u&&(i=u.element.find(".e-js"),i&&i.length>0&&this._destroyEJObjects(i),i=null,u.destroy()))},_destroy:function(){var t=this.element.find(".e-js");t&&t.length>0&&this._destroyEJObjects(t);t=null;this._clearPageCache();n("#"+this._id+"_exportForm").remove();n("#"+this._id+"_toolbar_exportListTip").remove();n("#"+this._id+"_toolbar_fittoPagePopup").remove();n("#"+this._id+"_device_toolbarContainer").remove();n("#"+this._id+"_rptTooltip").remove();n(this.element).find(".e-reportviewer-viewer").remove();n("#"+this._id+"_pageInfoPopup").remove();n("#"+this._id+"_printPageIframe").remove();this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_clearCurrentServerCache")},_destroyExistingObj:function(){n("#"+this._id+"_printPageSetup").remove();this._parents.length>0&&this._parents.pop()},_init:function(){this._svg=window.SVGSVGElement?!0:!1;this._actionUrl=this.model.reportServiceUrl+"/PostReportAction";this._authenticationToken=this._getAuthenticationToken();this._browserInfo=t.browserInfo();this._destroyExistingObj();this._renderViewer();this._initViewer();this._on(n(window),"resize",this._viewerResize);this.model.reportServiceUrl&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.reportLoad,controlId:this._id,reportPath:this.model.reportPath,reportServerUrl:this.model.reportServerUrl,processingMode:this.model.processingMode}),"_reportLoaded")},_initViewer:function(){this._wireEvents();this._initToolbar();this._clearPageCache();this._currentPage=1;this._pageLayoutPage=this._currentPage;this._setPageSettings();this._refresh||(this._preZoomVal=1,this._zoomLevel=2);this._isDocumentMap=!1;this._printMode=this.model.printMode;this._isPageDocMap=!1;this._pageDocMapFlag=!1;var n=this.model.toolbarSettings;n.templateId||(this._showToolbar(n.showToolbar),this._showPrintButton(n.items&t.ReportViewer.ToolbarItems.Print),this._showRefreshButton(n.items&t.ReportViewer.ToolbarItems.Refresh),this._showZoomControl(n.items&t.ReportViewer.ToolbarItems.Zoom),this._showFittoPage(n.items&t.ReportViewer.ToolbarItems.FittoPage),this._showExportControls(n.items&t.ReportViewer.ToolbarItems.Export),this._showPrintPageSetupButton(n.items&t.ReportViewer.ToolbarItems.PageSetup),this._showExportList(),this._showPageNavigationControls(n.items&t.ReportViewer.ToolbarItems.PageNavigation),this._showParameterBlock(n.items&t.ReportViewer.ToolbarItems.Parameters),this._showPreviewButton(n.items&t.ReportViewer.ToolbarItems.PrintLayout),this._showDrillThrough(this._parents.length>0),this._showDocumentMap(!1));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0)},_setPageSettings:function(){var r=!1,t=0,i=0,n;this._paperName=null;this._paperOrientation=null;this._paperSetup.paperHeight=null;this._paperSetup.paperWidth=null;this._paperSetup.MarginBottom=0;this._paperSetup.MarginLeft=0;this._paperSetup.MarginRight=0;this._paperSetup.MarginTop=0;this.model.pageSettings&&this.model.pageSettings.height>0&&(i=this.model.pageSettings.height,r=!0);this.model.pageSettings&&this.model.pageSettings.width>0&&(t=this.model.pageSettings.width,r=!0);this.model.pageSettings.paperSize?(this._paperName=this.model.pageSettings.paperSize,n=this._getPaperSize(this.model.pageSettings.paperSize),r&&(t>0&&(n.width=t),i>0&&(n.height=i),this._paperName="Custom"),this._paperOrientation=this.model.pageSettings.orientation=="Landscape"?"Landscape":"Portrait",this.model.pageSettings.orientation=="Landscape"?(this._paperSetup.paperHeight=n.width,this._paperSetup.paperWidth=n.height):(this._paperSetup.paperHeight=n.height,this._paperSetup.paperWidth=n.width)):r&&(t>0&&(this._paperSetup.paperWidth=t),i>0&&(this._paperSetup.paperHeight=i),this._paperName="Custom");this.model.pageSettings&&this.model.pageSettings.margins&&(this.model.pageSettings.margins.left>0&&(this._paperSetup.MarginLeft=this.model.pageSettings.margins.left),this.model.pageSettings.margins.right>0&&(this._paperSetup.MarginRight=this.model.pageSettings.margins.right),this.model.pageSettings.margins.bottom>0&&(this._paperSetup.MarginBottom=this.model.pageSettings.margins.bottom),this.model.pageSettings.margins.top>0&&(this._paperSetup.MarginTop=this.model.pageSettings.margins.top))},_renderPageInfoPopup:function(){var i=n("#"+this._id+"_pageInfoPopup"),r,f;i.length>0||(i=t.buildTag("div.e-reportviewer-pagepopupinfo","",{"WHITE-SPACE":"nowrap"},{id:this._id+"_pageInfoPopup"}),r=t.buildTag("input.e-reportviewer-pagenumber e-reportviewer-elementalignments ejinputtext","",{},{type:"text",value:this._currentPage,id:this._id+"_popupPageNo"}),r.css("height","25.5px"),r.css("width","25px"),r.css("background-color","black"),r.css("color","white"),r.css("border-color","black"),f=t.buildTag("span.e-reportviewer-popuptotalpage","",{},{}),f.append(" / "+this._pageModel.TotalPages),i.append(r),i.append(f),n("body").append(i),this._on(n("#"+this._id+"_popupPageNo"),"click",this._popupClick),this._on(n("#"+this._id+"_popupPageNo"),"keypress",this._onkeyPress));i.css("display")=="block"?(i.stop().fadeIn(),i.stop().fadeOut(3e3),i.hide(3e3)):(i.show(),i.stop().fadeIn(),i.stop().fadeOut(3e3),i.hide(3e3));var u=n("#"+this._id+"_viewerContainer"),e=u.offset().left+u.width()/2-i.width()/2,o=u.offset().top+u.height()/2-i.height()/2;i.css({left:e,top:o});this._updatePageNo()},_renderToolTip:function(){var i=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),r=t.buildTag("span.e-reportviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),u=t.buildTag("span.e-reportviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});i.append(r);i.append(u);n("body").append(i)},_renderToolBar:function(i){var r,u,e,f,o,s,h;this.model.toolbarSettings.templateId?(h=n("#"+this.model.toolbarSettings.templateId),i.append(h),h.ejToolbar({enableSeparator:!0,height:h.height(),click:this.model.toolbarSettings.click}),h.css("display","block")):(r=t.buildTag("div.e-reportviewer-toolbarcontainer .e-reportviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(r),this._isDevice?(u=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(u,"export"),this._appendToolbarItems(u,"gotoparent"),this._appendToolbarItems(u,"zoomin"),this._appendToolbarItems(u,"zoomout"),this._appendToolbarItems(u,"pagefit"),this._appendToolbarItems(u,"refresh"),this._appendToolbarItems(u,"parameter"),this._renderNavigationItems(r),r.append(u)):(e=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(e,"print"),this._appendToolbarItems(e,"export"),this._appendToolbarItems(e,"preview"),this._appendToolbarItems(e,"pagesetup"),r.append(e),f=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(f,"gotofirst"),this._appendToolbarItems(f,"gotoprevious"),this._appendToolbarItems(f,"gotopage"),this._appendToolbarItems(f,"gotonext"),this._appendToolbarItems(f,"gotolast"),this._appendToolbarItems(f,"gotoparent"),r.append(f),o=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(o,"zoomin"),this._appendToolbarItems(o,"zoomout"),this._appendToolbarItems(o,"zoom"),this._appendToolbarItems(o,"pagefit"),r.append(o),s=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(s,"refresh"),this._appendToolbarItems(s,"documentmap"),this._appendToolbarItems(s,"parameter"),r.append(s),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"80px",change:this._zoomValChange,selectedItem:2})),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this)}))},_renderNavigationItems:function(i){var r=t.buildTag("div.e-device-reportviewer-toolbarcontainer .e-reportviewer-viewer","",{},{id:this._id+"_device_toolbarContainer"}),u=t.buildTag("ul.e-reportviewer-toolbarul","",{}),f;this._appendToolbarItems(u,"gotofirst");this._appendToolbarItems(u,"gotoprevious");this._appendToolbarItems(u,"gotopage");this._appendToolbarItems(u,"gotonext");this._appendToolbarItems(u,"gotolast");r.append(u);n("body").append(r);f=t.buildTag("span.e-device-reportviewer-toolbarspan","",{display:"block",float:"right"},{id:this._id+"_device_toolbarspan"});f.addClass("e-icon e-toolbar-res-arrow e-reportviewer-toolbarul e-ul e-horizontal");f.css("padding","3px");i.append(f);r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this)});r.removeClass("e-toolbarspan").addClass("e-abs-position");r.css("display","none");r.css("z-index","1001")},_appendToolbarItems:function(n,i){var r,f=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],o,s,h,c,l,a,v,y,p,w,b,u,e,k,d,g,nt,tt,it;switch(i){case"print":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});o=t.buildTag("span.e-reportviewer-icon e-reportviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(o);break;case"export":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});e=t.buildTag("span.e-reportviewer-icon e-reportviewer-export","",{},{id:this._id+"_ejtb_export"});r.append(e);break;case"pagesetup":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});s=t.buildTag("span.e-reportviewer-icon e-reportviewer-pagesetup","",{},{id:this._id+"_ejtb_PageSetup"});r.append(s);break;case"gotofirst":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});h=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotofirst","",{});r.append(h);break;case"gotolast":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});c=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotolast","",{});r.append(c);break;case"gotonext":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});l=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotonext","",{});r.append(l);break;case"gotoprevious":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});a=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotoprevious","",{});r.append(a);break;case"gotoparent":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});v=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotoparent","",{});r.append(v);break;case"gotopage":r=t.buildTag("div.e-reportviewer-tbpage","",{display:"block"},{});y=t.buildTag("input.e-reportviewer-pagenumber e-reportviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"});p=t.buildTag("span.e-reportviewer-labelpageno","",{},{});r.append(y);r.append(p);break;case"zoomin":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});w=t.buildTag("span.e-reportviewer-icon e-reportviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(w);break;case"zoomout":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});b=t.buildTag("span.e-reportviewer-icon e-reportviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(b);break;case"zoom":r=t.buildTag("div.e-reportviewer-ejdropdownlist","",{},{});u=t.buildTag("select.e-reportviewer-tbdiv e-reportviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"});u.append("<option>50%<\/option>");u.append("<option>75%<\/option>");u.append("<option Selected>100%<\/option>");u.append("<option>125%<\/option>");u.append("<option>150%<\/option>");u.append("<option>200%<\/option>");u.append("<option>400%<\/option>");r.append(u);break;case"pagefit":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});e=t.buildTag("span.e-reportviewer-icon e-reportviewer-pagefit","",{},{id:this._id+"_ejtb_fittopage"});r.append(e);break;case"preview":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_preview"});k=t.buildTag("span.e-reportviewer-icon e-reportviewer-preview","",{},{});r.append(k);break;case"refresh":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{});d=t.buildTag("span.e-reportviewer-icon e-reportviewer-refresh","",{},{id:this._id+"_toolbar_refresh"});r.append(d);break;case"documentmap":r=t.buildTag("li.e-reportviewer-toolbarli","",{display:"none"},{id:this._id+"_ejtb_documentmap"});g=t.buildTag("span.e-reportviewer-icon e-reportviewer-documentmap","",{});r.append(g);break;case"parameter":r=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_parameter"});nt=t.buildTag("span.e-reportviewer-icon e-reportviewer-parameter","",{});r.append(nt);break;case"pdf":r=t.buildTag("li.e-reportviewer-popupli e-pdf","",{},{id:this._id+"_pdf"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-pdf","",{},{});$spanTag.append(f.toolbar.exportformat.Pdf);r.append($spanTag);break;case"xls":r=t.buildTag("li.e-reportviewer-popupli e-excel","",{},{id:this._id+"_xls"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-excel","",{},{});$spanTag.append(f.toolbar.exportformat.Excel);r.append($spanTag);break;case"word":r=t.buildTag("li.e-reportviewer-popupli e-word","",{},{id:this._id+"_word"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-word","",{},{});$spanTag.append(f.toolbar.exportformat.Word);r.append($spanTag);break;case"html":r=t.buildTag("li.e-reportviewer-popupli e-html","",{},{id:this._id+"_html"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-html","",{},{});$spanTag.append(f.toolbar.exportformat.Html);r.append($spanTag);break;case"ppt":r=t.buildTag("li.e-reportviewer-popupli e-ppt","",{},{id:this._id+"_ppt"});$spanTag=t.buildTag("span .e-reportviewer-popupspan e-ppt","",{},{});$spanTag.append(f.toolbar.exportformat.PPT);r.append($spanTag);break;case"fittopage":r=t.buildTag("li.e-reportviewer-popupli","",{},{id:this._id+"_fittoPage"});break;case"fittopagewidth":r=t.buildTag("li.e-reportviewer-popupli e-fitpagewidth","",{"padding-right":"5px",width:"auto"},{id:this._id+"_pageWidth",isSelect:"false"});tt=t.buildTag("span.e-reportviewer-icon e-reportviewer-emptyconetent","",{"padding-right":"4px",cursor:"pointer"},{id:this._id+"Pagewidthspan",fitType:"PAGEWIDTH"});r.append(tt);r.append(f.toolbar.fittopage.pageWidth);break;case"fittowholepage":r=t.buildTag("li.e-reportviewer-popupli e-fitpageheight","",{"padding-right":"5px",width:"auto"},{id:this._id+"_pageHeight",isSelect:"false"});it=t.buildTag("span.e-reportviewer-icon e-reportviewer-emptyconetent","",{"padding-right":"4px",cursor:"pointer"},{id:this._id+"pageheightSpan",fitType:"WHOLEPAGE"});r.append(it);r.append(f.toolbar.fittopage.pageHeight)}n.append(r)},_renderToolTipExport:function(){var n=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-icon e-reportviewer-exporttip","",{display:"none"},{id:this._id+"_toolbar_exportListTip"});return this._appendToolbarItems(n,"pdf"),this._appendToolbarItems(n,"xls"),this._appendToolbarItems(n,"word"),this._appendToolbarItems(n,"html"),this._appendToolbarItems(n,"ppt"),n},_renderPageFitPopup:function(){var n=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-icon e-reportviewer-fittopagetip","",{display:"none"},{id:this._id+"_toolbar_fittoPagePopup"});return this._appendToolbarItems(n,"fittopagewidth"),this._appendToolbarItems(n,"fittowholepage"),n},_renderFitopagePopup:function(){var r=n("#"+this._id+"_pageviewOuterline"),u=n("#"+this._id+"_viewerContainer"),t=n("#"+this._id+"_pageWidth"),i=n("#"+this._id+"_pageHeight"),f=u.width(),e=u.height(),o=r.width(),s=r.height();e>s&&i.attr("isSelect")=="false"?i.css("opacity","0.4"):i.css("opacity","1");f>o&&t.attr("isSelect")=="false"?t.css("opacity","0.4"):t.css("opacity","1")},_showPrintPageSetupButton:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-pagesetup").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-pagesetup").parent().css("display","none")},_renderPrintPageSetup:function(){var i=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],c=null,l=null,h=t.buildTag("div","",{display:"table"},{id:this._id+"_printPageSetup"}),gt=t.buildTag("div","",{display:"table-row"},{id:this._id+"_paperSetup"}),r=t.buildTag("table","",{},{"border-collapse":"collapse"}),ni=t.buildTag("div","",{},{id:this._id+"_defaultSetup",display:"table-row"}),o=n("#"+this._id+".e-reportviewer")[0].getBoundingClientRect(),ti=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),ii=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),u=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),ri=t.buildTag("td.e-reportviewer-pagesetupheader","",{"padding-top":"0px"},{colspan:"8"}),ui=t.buildTag("td.e-reportviewer-pagesetupcontent","",{},{colspan:"12"}),a,v,y,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,ct,lt,at,vt,yt,bt,kt,kr;gt.append(r);r.append(ti);r.append(ii);r.append(u);ti.append(ri);ii.append(ui);h.append(gt);h.append(ni);var fi=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),f=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),e=t.buildTag("tr.e-reportviewer-pagesetuptr","",{});r.append(fi);r.append(f);r.append(e);a=t.buildTag("td.e-reportviewer-pagesetupheader","",{},{colspan:"8"});fi.append(a);var ei=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),s=t.buildTag("tr.e-reportviewer-pagesetuptr","",{}),oi=t.buildTag("td.e-reportviewer-pagesetupheader","",{},{colspan:"8"});ei.append(oi);r.append(ei);r.append(s);this._browserInfo.name=="msie"&&this._browserInfo.version==8?(c=o.right,l=o.bottom):(c=o.width,l=o.height);h.ejDialog({width:400,position:{X:o.left+c/3+20,Y:(o.top+l/2)/2},enableModal:!1,title:i.toolbar.pagesetup.headerText,enableResize:!1,enablePersistance:!1,close:n.proxy(this._pageSettingClose,this)});v=t.buildTag("div","",{"font-weight":"bold",width:"100%"},{id:this._id+"_paperSizeLabel"});y=t.buildTag("div.e-reportviewer-ejdropdownlist","",{},{});v.append(i.pagesetupDialog.paperSize);ri.append(v);$paperSizeDDl=t.buildTag("select","",{},{id:this._id+"_PaperSize"});$paperSizeDDl.append('<option value="A3">A3<\/option>');$paperSizeDDl.append('<option value="A4">A4<\/option>');$paperSizeDDl.append('<option value="B4(JIS)">B4(JIS)<\/option>');$paperSizeDDl.append('<option value="B5(JIS)">B5(JIS)<\/option>');$paperSizeDDl.append('<option value="Envelope #10">Envelope #10<\/option>');$paperSizeDDl.append('<option value="Envelope Monarch">Envelope Monarch<\/option>');$paperSizeDDl.append('<option value="Executive">Executive<\/option>');$paperSizeDDl.append('<option value="Legal">Legal<\/option>');$paperSizeDDl.append('<option value="Letter">Letter<\/option>');$paperSizeDDl.append('<option value="Tabloid">Tabloid<\/option>');$paperSizeDDl.append('<option value="Custom">Custom<\/option>');y.append($paperSizeDDl);$paperSizeDDl.ejDropDownList({height:"32px",selectedIndex:10,watermarkText:"Select Option",change:n.proxy(this._setUpChange,this),enableIncrementalSearch:!0});ui.append(y);var si=t.buildTag("span","",{},{id:this._id+"_widthLabel"}),hi=t.buildTag("div","",{},{}),ci=t.buildTag("span","",{},{id:this._id+"_heightLabel"}),li=t.buildTag("div","",{},{}),p=t.buildTag("span","",{},{id:this._id+"_heightUnitLabel"}),w=t.buildTag("span","",{},{id:this._id+"_widthUnitLabel"}),ai=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperHeight"}),vi=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperWidth"});li.append(ai);hi.append(vi);ci.append(i.pagesetupDialog.height+" ");p.append(i.pagesetupDialog.unit+" ");si.append(i.pagesetupDialog.width+" ");w.append(i.pagesetupDialog.unit+" ");u.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));b=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});b.append(ci);u.append(b);k=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});k.append(li);u.append(k);d=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});d.append(p);u.append(d);u.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));g=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});g.append(si);u.append(g);nt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});nt.append(hi);u.append(nt);tt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});tt.append(w);u.append(tt);ai.ejNumericTextbox({decimalPlaces:2,enableStrictMode:!0,width:"75px",minValue:1,enable:!1});vi.ejNumericTextbox({decimalPlaces:2,enableStrictMode:!0,width:"75px",minValue:1,enable:!1});var yi=t.buildTag("div","",{"font-weight":"bold"},{id:this._id+"_marginheader"}),pi=t.buildTag("span","",{},{id:this._id+"_topLabel"}),wi=t.buildTag("div","",{},{}),bi=t.buildTag("span","",{},{id:this._id+"_topUnitLabel"}),ki=t.buildTag("span","",{},{id:this._id+"_rightLabel"}),di=t.buildTag("div","",{},{}),gi=t.buildTag("span","",{},{id:this._id+"_rightUnitLabel"}),nr=t.buildTag("div","",{},{id:this._id+"_bottomLabel"}),tr=t.buildTag("div","",{},{}),ir=t.buildTag("span","",{},{id:this._id+"_bottomUnitLabel"}),rr=t.buildTag("span","",{},{id:this._id+"_leftLabel"}),ur=t.buildTag("div","",{},{}),fr=t.buildTag("span","",{},{id:this._id+"_leftUnitLabel"});yi.append(i.pagesetupDialog.margins);a.append(yi);var er=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginTop"}),or=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginRight"}),sr=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginBottom"}),hr=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginLeft"});pi.append(i.pagesetupDialog.top+" ");bi.append(i.pagesetupDialog.unit+" ");wi.append(er);ki.append(i.pagesetupDialog.right+" ");gi.append(i.pagesetupDialog.unit+" ");di.append(or);nr.append(i.pagesetupDialog.bottom+" ");ir.append(i.pagesetupDialog.unit+" ");tr.append(sr);rr.append(i.pagesetupDialog.left+" ");fr.append(i.pagesetupDialog.unit+" ");ur.append(hr);f.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));it=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});it.append(pi);f.append(it);rt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});rt.append(wi);f.append(rt);ut=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"50px"});ut.append(bi);f.append(ut);f.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));ft=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});ft.append(ki);f.append(ft);et=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});et.append(di);f.append(et);ot=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});ot.append(gi);f.append(ot);e.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));st=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"15px"});st.append(nr);e.append(st);ht=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});ht.append(tr);e.append(ht);ct=t.buildTag("td .e-reportviewer-pagesetupcontent","",{width:"10px"});ct.append(ir);e.append(ct);e.append(t.buildTag("td .e-reportviewer-pagesetupcontent","",{width:"3px"}));lt=t.buildTag("td .e-reportviewer-pagesetupcontent","",{width:"15px"});lt.append(rr);e.append(lt);at=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"75px"});at.append(ur);e.append(at);vt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"10px"});vt.append(fr);e.append(vt);er.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});or.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});sr.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});hr.ejNumericTextbox({decimalPlaces:2,width:"75px",minValue:0,maxValue:22});yt=t.buildTag("div","",{"font-weight":"bold"},{id:this._id+"_orientationLabel"});yt.append(i.pagesetupDialog.orientation);oi.append(yt);var pt=t.buildTag("div","",{float:"left"},{}),cr=t.buildTag("div","",{float:"left"},{}),lr=t.buildTag("div","",{float:"left"},{id:this._id+"_portraitLabel"}),ar=t.buildTag("input","",{},{type:"radio",id:this._id+"_portrait",value:"Portrait"});cr.append(ar);lr.append(" "+i.pagesetupDialog.portrait);pt.append(cr);pt.append(lr);ar.ejRadioButton({name:"orientation",checked:!0,size:"small"});var wt=t.buildTag("div","",{float:"left"},{}),vr=t.buildTag("div","",{float:"left"},{}),yr=t.buildTag("div","",{float:"left"},{id:this._id+"_landscapeLabel"}),pr=t.buildTag("input","",{},{type:"radio",id:this._id+"_landscape",value:"Landscape"});vr.append(pr);yr.append(" "+i.pagesetupDialog.landscape);wt.append(vr);wt.append(yr);s.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));bt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"90px"},{colspan:"3"});bt.append(pt);s.append(bt);s.append(t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"3px"}));kt=t.buildTag("td.e-reportviewer-pagesetupcontent","",{width:"90px"},{colspan:"3"});kt.append(wt);s.append(kt);pr.ejRadioButton({name:"orientation",size:"small"});var dt=t.buildTag("div","",{"padding-top":"10px",float:"right","padding-right":"13px","padding-bottom":"20px"},{}),wr=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"min-width":"65px"},{type:"button",value:i.pagesetupDialog.doneButton,id:this._id+"_Submit"}),br=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"margin-left":"6px","min-width":"65px"},{type:"button",value:i.pagesetupDialog.cancelButton,id:this._id+"_Cancel"});wr.ejButton({showRoundedCorner:!0,height:30,click:n.proxy(this._pageSetupSubmit,this)});br.ejButton({showRoundedCorner:!0,height:30,click:n.proxy(this._pageSetupCancel,this)});dt.append(wr);dt.append(br);ni.append(dt);$paperSizeDDl.data("ejDropDownList")&&(kr=h[0].clientWidth-n(p.parent())[0].clientWidth-n(w.parent())[0].clientWidth,$paperSizeDDl.data("ejDropDownList")._setModel({width:kr}));this._browserInfo.name=="msie"?n("#"+this._id+"_PaperSize_input").css("margin-top","-2px"):(this._browserInfo.name=="opera"||this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome"||this._browserInfo.name=="mozilla")&&n("#"+this._id+"_PaperSize_input").css("padding-bottom","3px")},_renderViewerBlockinDevice:function(n){var i=t.buildTag("div.e-reportviewer-viewer e-reportviewer-viewerblock e-reportviewer-blockstyle","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var r=t.buildTag("div.e-reportviewer-viewerblockcellcontent","",{margin:"1px",padding:"1px",width:"99%",height:"99%",display:"inline-table"}),e=t.buildTag("div.e-reportviewer-viewerblockcontent","",{width:"100%",height:"auto"}),u=t.buildTag("div.e-reportviewer-viewreport","",{width:"100%",height:"30px","border-left":"0px",padding:"10px 0"}),f=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{},{type:"button",value:t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale].viewButton:t.ReportViewer.Locale["en-us"].viewButton,id:this._id+"_viewReportClick","data-role":"none"});return u.append(f),r.append(e),r.append(u),f.ejButton({showRoundedCorner:!0}),i.append(r),i},_renderViewerBlockinWeb:function(n){var i=t.buildTag("div.e-reportviewer-viewer e-reportviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var f=t.buildTag("table.e-reportviewer-viewerblockcellcontent e-reportviewer-blockcontainer","",{margin:"1px",padding:"5px 5px 10px"}),r=t.buildTag("tr","",{width:"100%"}),o=t.buildTag("td.e-reportviewer-viewerblockcontent","",{}),e=t.buildTag("td.e-reportviewer-viewreport","",{}),u=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{},{type:"button",value:t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale].viewButton:t.ReportViewer.Locale["en-US"].viewButton,id:this._id+"_viewReportClick","data-role":"none"});return u.ejButton({height:32,cssClass:"e-accent"}),e.append(u),r.append(o),r.append(e),f.append(r),u.ejButton({showRoundedCorner:!0}),i.append(f),i},_renderViewerContainer:function(n){var i=t.buildTag("div","",{},{id:this._id+"_reportviewerContainer"}),v;n.append(i);var r=t.buildTag("div.e-reportviewer-viewer e-reportviewer-scrollcontainer e-reportviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),f=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),y=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),e=t.buildTag("div.e-reportviewer-pageviewcontainer","",{},{id:this._id+"_pageviewOuterContainer"}),o=t.buildTag("div.e-reportviewer-pageouterline","",{},{id:this._id+"_pageviewOuterline"}),u=t.buildTag("div.e-reportviewer-pageview","",{"background-color":"#FFFFFF"},{id:this._id+"_pageviewContainer"}),s=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewheaderContainer"}),p=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewbodyContainer"}),h=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewfooterContainer"}),c=t.buildTag("div.pageHeaderBorder","",{position:"relative","background-color":"#FFFFFF"}),l=t.buildTag("div.pageBodyBorder","",{position:"relative","background-color":"#FFFFFF"}),a=t.buildTag("div.pageFooterBorder","",{position:"relative","background-color":"#FFFFFF"});return this._printMode&&(s.css("overflow","hidden"),h.css("overflow","hidden")),c.append(s),l.append(p),a.append(h),u.append(c),u.append(l),u.append(a),f.append(y),r.append(f),o.append(u),e.append(o),r.append(e),this._isDevice?this._renderViewerBlockinDevice(r):(v=t.buildTag("div.e-reportviewer-documentmapcontainer","",{display:"none"},{id:this._id+"_documentmapContainer"}),i.append(v)),i.append(r),i},_renderViewer:function(){var e=this.element.height(),o=this.element.width(),n=t.buildTag("div.e-reportviewer-viewer","",{}),u,i,f,r;this.element[0].style.height||this.element[0].parentElement.clientHeight==0||(this._isHeight=!0);this.element[0].style.width||this.element[0].parentElement.clientWidth==0||(this._isWidth=!0);e===0&&this.element[0].parentElement.clientHeight!=0?this.element.height(this.element[0].parentElement.clientHeight):this._browserInfo.name=="msie"&&this._browserInfo.version==8&&this.element[0].style.height.indexOf("%")!=-1&&(u=parseInt(this.element[0].style.height),i=this.element[0].parentElement.clientHeight,i=i/100*u,this.element.height(i));o===0&&this.element[0].parentElement.clientWidth!=0?this.element.width(this.element[0].parentElement.clientWidth):this._browserInfo.name=="msie"&&this._browserInfo.version==8&&this.element[0].style.width.indexOf("%")!=-1&&(f=parseInt(this.element[0].style.width),r=this.element[0].parentElement.clientWidth,r=r/100*f,this.element.width(r));this.element.append(n);this._isDevice=this.model.renderMode&t.ReportViewer.RenderMode.Mobile&&this.model.renderMode&t.ReportViewer.RenderMode.Desktop?this._isMobileDevice():this.model.renderMode&t.ReportViewer.RenderMode.Mobile?!0:!1;this._renderToolBar(n);this._isDevice||(this._renderViewerBlockinWeb(n),this._renderToolTip());this._renderViewerContainer(n)},_renderCredentialBlock:function(i){for(var f,s,h,c,l,v,r=t.buildTag("table","",{},{}),e=0;e<i.length;e++){var u=i[e],o=t.buildTag("tr","",{},{}),a=t.buildTag("td","",{},{colspan:this._isDevice?"1":"5"});a.html(this._isDevice?"Specify the "+u.Name+":":u.Prompt);o.append(a);this._isDevice?(r.append(o),r.append('<tr height="4px"/>'),s=t.buildTag("tr","",{},{}),this._appendCredentialItems(s,"namelbl",u),h=t.buildTag("tr","",{},{}),this._appendCredentialItems(h,"nametxt",u),c=t.buildTag("tr","",{},{}),this._appendCredentialItems(c,"passwdlbl",u),l=t.buildTag("tr","",{},{}),this._appendCredentialItems(l,"passwdtxt",u),r.append(s),r.append(h),r.append(c),r.append(l),r.append('<tr height="6px"/>')):(f=t.buildTag("tr","",{},{}),this._appendCredentialItems(f,"namelbl",u),this._appendCredentialItems(f,"nametxt",u),f.append(t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{width:"7px"},{})),this._appendCredentialItems(f,"passwdlbl",u),this._appendCredentialItems(f,"passwdtxt",u),r.append(o),r.append('<tr height="6px"/>'),r.append(f),r.append('<tr height="6px"/>'))}this._wiredViewClickEvent(i);v=n("#"+this._id+"_viewBlockContainer").find(".e-reportviewer-viewerblockcontent");v.html(r)},_wiredViewClickEvent:function(t){this._on(n("#"+this._id+"_viewReportClick"),"click",{ds:t},this._viewReportCredentialClick)},_unwiredViewClickEvent:function(){this._off(n("#"+this._id+"_viewReportClick"),"click",this._viewReportCredentialClick)},_appendCredentialItems:function(n,i,r){var u,f,e;switch(i){case"namelbl":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});u.append("Login Name ");break;case"nametxt":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});f=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",autocomplete:"off",id:r.ControlId+"_loginName"});u.append(f);break;case"passwdlbl":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});u.append("Password ");break;case"passwdtxt":u=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{});e=t.buildTag("input.e-reportviewer-textbox","",{},{type:"password",autocomplete:"off",id:r.ControlId+"_password"});u.append(e)}n.append(u)},_viewReportCredentialClick:function(t){for(var f=t.data.ds,i=[],r=0;r<f.length;r++){var u=f[r],e=n("#"+u.ControlId+"_loginName").val(),o=n("#"+u.ControlId+"_password").val();i.push({Name:u.Name,UserName:e,Password:o})}this._dataSources=i;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.validateDSCredential,datasoures:i}),"_validateDSCredential")},_renderParameterBlock:function(i){var u=t.buildTag("table","",{},{isViewClick:!1}),l,c,f,e,r,h,o,s,a;if(this._isDevice&&u.css("width","100%"),i!=null&&i.length>0){if(l=n("#"+this._id+"_viewBlockContainer").find(".e-reportviewer-viewerblockcontent"),c=this._onRenderingBegin({reportParameters:n.extend(!0,{},i),parameterBlock:n("#"+this._id+"_viewBlockContainer")}),!c)for(l.html(u),f=0;f<i.length;f++)e=i[f],this._isDevice?(u.append('<tr class="e-reportviewer-tr"/>'),r=t.buildTag("tr","",{},{}),u.append(r),o=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),o.append(e.Prompt+"  "),r.append(o),r=t.buildTag("tr","",{},{}),u.append(r),s=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{"min-width":"130px","max-width":"185px"},{}),r.append(s),h=t.buildTag("div","",{width:"100%",display:"flex","white-space":"nowrap"},{id:e.ControlId+"_div"}),s.append(h)):(f%2==0?(f!=0?u.append('<tr style="height: 15px;"/>'):u.append('<tr class="e-reportviewer-tr"/>'),r=t.buildTag("tr","",{},{}),u.append(r)):(a=t.buildTag("td","",{},{}),r.append(a)),o=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),o.append(e.Prompt+"  "),r.append(o),s=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{"min-width":"130px","max-width":"185px","padding-right":"20px"},{}),r.append(s),h=t.buildTag("div","",{width:"100%",display:"flex","white-space":"nowrap"},{id:e.ControlId+"_div"}),s.append(h)),this._renderParameterElements(e,h)}else this._showParameterBlock(!1);return u.append('<tr class="e-reportviewer-tr"/>'),this._onRenderingComplete({reportParameters:n.extend(!0,{},i)}),this._on(n("#"+this._id+"_viewReportClick"),"click",{params:i},this._viewReportParamsClick),c},_renderParameterElements:function(i,r){var e,f,o,h,s,ft,k,l,c,u,g,nt,tt,it,y,a,w,rt,b,ut,p;if(i.IsMultiValue){if(h=[],n("#"+i.ControlId+"_popup_wrapper").length>0&&n("#"+i.ControlId+"_popup_wrapper").remove(),s=t.buildTag("select","",{},{id:i.ControlId,name:i.Name,"sf-name":i.Name}),i.AvailableLabels){for(ft=n("<input id ="+i.ControlId+"_check type='checkbox'/>"),k=t.buildTag("div","",{"border-bottom":"1px solid #c8c8c8"}),k.append(ft),c=n.extend(i.DefaultValuesfields,!0),i.Values&&i.Values.length>0&&(c=i.Values),u=0;u<i.AvailableLabels.length;u++)o=n('<option value="'+i.AvailableValues[u]+'">'+i.AvailableLabels[u]+"<\/option>"),jQuery.inArray(i.AvailableValues[u],c)!=-1&&h.push(u),s.append(o);r.append(s);s.ejDropDownList({cssClass:"e-reportviewer-param",width:"100%",showCheckbox:!0,selectedIndices:h,watermarkText:"Select Option",change:i.IsDependent?this._paramsChangeEvent:"",popupHide:i.IsDependent?this._paramsChangeEvent:"",enableFilterSearch:this.model.enableDropDownSearch,headerTemplate:k[0].outerHTML});n("#"+i.ControlId+"_check").ejCheckBox({cssClass:"e-reportviewer-paramcheckbox",size:"small",text:"Select All",change:this._onCheckAll});l=n(n("#"+i.ControlId+"_check")).siblings(".e-text");l[0].className=l[0].className+" e-reportviewer-paramcheckbox";l.css("font-size","14px");l.css("width","69%");l.css("padding-left","15.5%")}else if(i.DefaultValues){for(o=n('<option value="parameter_SelectAll">Select All<\/option>"'),s.append(o),c=n.extend(i.DefaultValuesfields,!0),i.Values&&i.Values.length>0&&(c=i.Values),u=0;u<i.DefaultValues.length;u++)o=n('<option value="'+i.DefaultValues[u]+'">'+i.DefaultValues[u]+"<\/option>"),jQuery.inArray(i.DefaultValues[u],c)!=-1&&h.push(u+1),s.append(o);i.DefaultValues.length==h.length&&h.push(0);r.append(s);s.ejDropDownList({cssClass:"e-reportviewer-param",width:"100%",showCheckbox:!0,selectedIndices:h,watermarkText:"Select Option",change:i.IsDependent?this._paramsChangeEvent:"",popupHide:i.IsDependent?this._paramsChangeEvent:"",checkChange:this._selectionChanged,enableFilterSearch:this.model.enableDropDownSearch})}}else if(i.AvailableValues!=null){var d=t.buildTag("select","",{},{id:i.ControlId,name:i.Name,data:"select","sf-name":i.Name}),v=9999,et=!1;for(u=0;u<i.AvailableLabels.length;u++)i.AvailableLabels[u]!="Select a value"?(o=n('<option value="'+i.AvailableValues[u]+'">'+i.AvailableLabels[u]+"<\/option>"),i.AvailableLabels[u]==i.Label&&(v=u),d.append(o)):i.AvailableLabels[u]=="Select a value"&&(et=!0);et&&(v=v-1);r.append(d);g={cssClass:"e-reportviewer-param",width:"100%",watermarkText:"Select a Value",change:i.IsDependent?this._paramsChangeEvent:"",popupHide:i.IsDependent?this._paramsChangeEvent:"",enableIncrementalSearch:!0,enableFilterSearch:this.model.enableDropDownSearch};v!=9999&&(g.selectedIndex=v);d.ejDropDownList(g)}else i.DataType=="DateTime"?(nt=t.buildTag("input.e-reportviewer-textbox e-reportviewer-DateTime","",{},{type:"text",id:i.ControlId,maxlength:"256",name:i.Name}),r.append(nt),tt=i.Label.indexOf("-")?i.Label.replace(/\-/g,"/"):i.Label,nt.ejDatePicker({cssClass:"e-reportviewer-param",width:i.IsNullable?"75%":"100%",value:i.Label!=null&&i.Label.length>0?new Date(tt?tt:i.Label):null,change:i.IsDependent?this._paramsChangeEvent:"",locale:this.model.locale!=this._machineCulture?this._machineCulture:this.model.locale}),i.IsNullable&&(e=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),f=t.buildTag("input","",{},{type:"checkbox",name:"chkDateTime",id:i.ControlId+"~chk",value:this._id}),e.append(f),e.append(" <span class=e-reportviewer-label>Null<\/span>"),r.append(" "),r.append(e),i.Label!=null&&i.Label.length>0?f.ejCheckBox({change:this._paramNullChange}):(f.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkDateTime",!0)))):i.DataType=="Boolean"?(it=t.buildTag("table","",{},{}),y=t.buildTag("tr","",{},{}),it.append(y),a=!1,i.Label!=null&&i.Label.length>0&&i.Label.toLowerCase()=="true"&&(a=!0),w=t.buildTag("td","",{},{}),rt=t.buildTag("input","",{},{type:"radio",name:i.Name,id:i.ControlId+"_01"}),w.append(rt),w.append(" <span>True<\/span>"),rt.ejRadioButton({checked:a}),y.append(w),y.append("<td width=10px/>"),b=t.buildTag("td","",{},{}),ut=t.buildTag("input","",{},{type:"radio",name:i.Name,id:i.ControlId+"_02"}),b.append(ut),b.append(" <span>False<\/span>"),i.Label!=null&&i.Label.length>0&&(a=!a),ut.ejRadioButton({checked:a}),y.append(b),r.append(it),i.IsNullable&&(e=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),f=t.buildTag("input","",{},{type:"checkbox",name:"chkRadio",id:i.ControlId+"~chk",value:this._id}),e.append(f),e.append(" <span class=e-reportviewer-label>Null<\/span>"),r.append(" "),r.append(e),f.ejCheckBox({change:this._paramNullChange}),i.Label!=null&&i.Label.length>0?f.ejCheckBox({change:this._paramNullChange}):(f.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkRadio",!0)))):(p=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",autocomplete:"off",id:i.ControlId,maxlength:"256",name:i.Name,value:i.Label}),r.append(p),i.IsNullable?(p.css("width","75%"),e=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),f=t.buildTag("input","",{},{type:"checkbox",name:"chkTextbox",id:i.ControlId+"~chk",value:this._id}),e.append(f),e.append(" <span class=e-reportviewer-label>Null<\/span>"),r.append(" "),r.append(e),f.ejCheckBox({change:this._paramNullChange}),i.Label!=null&&i.Label.length>0?f.ejCheckBox({change:this._paramNullChange}):(f.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkTextbox",!0))):p.css("width","96%"),i.IsDependent&&this._on(p,"change",this._paramsChangeEvent))},_onCheckAll:function(t){var r=t.model.id.substring(0,t.model.id.indexOf("_check")),i=n("#"+r).ejDropDownList("instance");t.isChecked?i.checkAll():i.uncheckAll()},_selectionChanged:function(){var t=this._activeItem,n;if(this.selectedIndexValue==0&&this.selectedTextValue=="Select All")if(this.checkedStatus)for(n=1;n<this.listitems.length;n++)this._setModel({selectedIndex:n});else for(n=1;n<this.listitems.length;n++)this.unselectItemsByIndices(n);else this._selectedIndices.length==this.listitems.length-1&&(this.checkedStatus?this._setModel({selectedIndex:0}):this.unselectItemsByIndices(0));this._activeItem=t},_updateParamElements:function(t){var f=this._onRenderingBegin({reportParameters:n.extend(!0,{},t)}),r,i,u,e;if(!f)for(r=0;r<t.length;r++)i=t[r],u=n("#"+i.ControlId+"_div"),i.IsMultiValue||i.AvailableValues!=null||i.DataType=="Boolean"?(u.empty(),i.Labels=i.Values=null,this._renderParameterElements(i,u)):i.DataType=="DateTime"?(e=n("#"+i.ControlId).data("ejDatePicker"),e.setModel({value:i.Label})):n("#"+i.ControlId).val(i.Label);return this._onRenderingComplete({reportParameters:n.extend(!0,{},t)}),f},_paramsChangeEvent:function(t){var h=this._id.substr(0,this._id.lastIndexOf("Param")-1),e=n("#"+h).data("ejReportViewer"),r={Name:"",Labels:[],Values:[]},u=n("#"+this._id),f,o,s;if(r.Name=u.attr("name"),this.pluginName=="ejDropDownList"){if(r.Name==i&&(r.Name=u.attr("sf-name")),this.model.showCheckbox)for(f=0;f<this.model.selectedIndices.length;f++)r.Labels.push(this.selectOptionItems[this.model.selectedIndices[f]].text),r.Values.push(this.selectOptionItems[this.model.selectedIndices[f]].value);else r.Labels.push(this.selectOptionItems[this.model.selectedIndex].text),r.Values.push(this.selectOptionItems[this.model.selectedIndex].value);if(t.type!="popupHide")return}else this.pluginName=="ejDatePicker"?(o=u.data("ejDatePicker").getValue(),r.Labels.push(o),r.Values.push(o)):this.pluginName=="ejRadioButton"?(s=data("ejRadioButton").model.checked,r.Labels.push(s),r.Values.push(s)):(r.Labels.push(u.val()),r.Values.push(u.val()));e.doAjaxPost("POST",e._actionUrl,JSON.stringify({reportAction:e._reportAction.updateParameters,updateParam:r}),"_updateParameters")},_viewReportParamsClick:function(t){this._showloadingIndicator(!0);var r=t.data.params,i=this._getParameterJson(r,!0);i&&(this._viewReportEnableDisable(!0),this._refresh=!0,n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcontent table:first").attr("isviewclick","true"),this._onViewReportClick(i),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:i}),"_setParameters"))},_viewReportEnableDisable:function(t){n("#"+this._id+"_viewReportClick").attr("disabled",t)},_getDefaultParameters:function(n){for(var i,f,r=[],u=[],t=0;t<n.length;n++)if(n[t].DefaultValues){for(i=0;i<n[t].DefaultValues.length;i++)u.push(n[0].DefaultValues[i]),r.push(n[0].DefaultValues[i]);f=[{Name:n[t].Name,Values:r,Labels:u,Nullable:n[t].IsNullable}];this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:f}),"_setParameters")}},_getParameterJson:function(t,i){for(var a,v,h,c,o,w,y,k,l,d,b=[],p=0;p<t.length;p++){var r=t[p],u=[],f=[],s=!1,e;if(r.IsMultiValue)for(a=n("#"+r.ControlId).data("ejDropDownList"),v=a._selectedIndices,h=0;h<v.length;h++)f.push(a.selectOptionItems[v[h]].text),u.push(a.selectOptionItems[v[h]].value);else if(r.AvailableValues!=null)r.IsNullable&&(s=r.IsNullable),c=n("#"+r.ControlId).data("ejDropDownList").getSelectedValue(),o=n("#"+r.ControlId).data("ejDropDownList").getSelectedItem(),c=c==""?r.Value:c,o=o&&n(o).text()==""?r.Label:n(o).text(),f.push(o),u.push(c);else if(r.DataType=="DateTime")e=n("#"+r.ControlId+"_div").find(".e-chkbox-wrap").attr("aria-checked"),e=="true"?s=!0:(w=n("#"+r.ControlId).data("ejDatePicker").getValue(),f.push(w),u.push(w));else if(r.DataType=="Boolean")y=n("#"+r.ControlId+"_01").data("ejRadioButton"),k=n("#"+r.ControlId+"_02").data("ejRadioButton"),e=n("#"+r.ControlId+"_div").find(".e-chkbox-wrap").attr("aria-checked"),e=="true"?s=!0:(y.model.checked||k.model.checked)&&(f.push(y.model.checked),u.push(y.model.checked));else if(e=n("#"+r.ControlId+"_div").find(".e-chkbox-wrap").attr("aria-checked"),e=="true")s=!0;else{if(l=n("#"+r.ControlId).val(),i)if(r.DataType!="Float"||l.match("^[-+]?[0-9]+.[0-9]+$")){if(r.DataType=="Integer"&&!l.match("^[-+]?[0-9]+$"))return alert("Please give the integer data type input"),!1}else return alert("Please give the float data type input"),!1;f.push(l);u.push(l)}d={Name:r.Name,Values:u,Labels:f,Nullable:s};b.push(d)}return b},_paramNullChange:function(t){var i=t.model.id.split("~"),r=n("#"+t.model.value).data("ejReportViewer");r._paramElementDisable(i[0],t.model.name,t.isChecked)},_paramElementDisable:function(t,i,r){var u,f,e;i=="chkDateTime"?(u=n("#"+t).data("ejDatePicker"),r?u.disable():u.enable()):i=="chkTextbox"?r?(n("#"+t).attr("disabled","disabled"),n("#"+t).css("opacity","0.45")):(n("#"+t).removeAttr("disabled"),n("#"+t).css("opacity","1")):i=="chkRadio"&&(f=n("#"+t+"_01").data("ejRadioButton"),e=n("#"+t+"_02").data("ejRadioButton"),r?(f.disable(),e.disable()):(f.enable(),e.enable()))},_selectparamToolItem:function(t){if(!this.model.toolbarSettings.templateId){var i=n("#"+this._id+"_toolbarContainer").data("ejToolbar");t?i.selectItemByID(this._id+"_ejtb_parameter"):i.deselectItemByID(this._id+"_ejtb_parameter")}},_showParameterBlock:function(t){t?(n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display","block"),n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-parameter").parent().css("display","block")):(n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display","none"),n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-parameter").parent().css("display","none"));this._isDevice&&(this._showViewerBlock(t),this._showViewerPage(!t))},_toggleParameterBlock:function(){if(this._selectparamToolItem(!(n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display")=="block")),n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").toggle(),this._setContainerSize(),this._isDevice){var t=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display")=="block";this._showViewerBlock(t);this._showViewerPage(!t)}},_renderExceptionBlock:function(i){var r;this._resetExceptionBlock();n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").css("display","none");r=t.buildTag("table.errmsg e-reportviewer-blockcontainer","",{});r[0].style.cssText="padding: 6px 0px 5px 20px !important";var u=t.buildTag("tr","",{},{}),f=t.buildTag("td","",{width:"100%"},{}),e=t.buildTag("td","",{width:"100%"},{}),o=t.buildTag("span.e-reportviewer-icon e-reportviewer-close","",{},{id:this._id+"_closebutton",title:"Close this message"});u.append(f);u.append(e);e.append(o);f.append("<span>Report Viewer encountered some issues loading this report. Please click <a id="+this._id+"_viewBlockContainer_errmsg href=javascript:void(0); >here<\/a> to see the error details<\/span>");r.append(u);n("#"+this._id+"_viewBlockContainer").append(r);this._on(n("#"+this._id+"_viewBlockContainer_errmsg"),"click",{err:i},this._errorPopupblock);this._on(n("#"+this._id+"_closebutton"),"click",this._closeException)},_closeException:function(){n("#"+this._id+"_viewBlockContainer table.errmsg").remove();this._setContainerSize()},_errorPopupblock:function(n){alert(n.data.err)},_resetExceptionBlock:function(){n("#"+this._id+"_viewBlockContainer table.errmsg").remove()},_renderExcpetion:function(n){this._showloadingIndicator(!1);this._renderExceptionBlock(n);this._showViewerBlock(!0)},_showExceptionResult:function(n,t){!n&&this.model.enableNotificationBar&&(this._isDevice?alert(t):(this._renderExceptionBlock(t),this._showViewerBlock(!0)))},_setContainerSize:function(){var f=n("#"+this._id).height(),i=0,t,r,u;this._isDevice||(t=n("#"+this._id+"_viewBlockContainer"),t.length>0&&t.css("display").toLowerCase()=="block"&&(i=n("#"+this._id+"_viewBlockContainer").height()));r=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();u=f-i-r-4;n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_setPageSize:function(t,i,r,u){var e=null,o=null,s=t+r+u+3,f;n("#"+this._id+"_pageviewContainer").css({width:i+"px",height:s+"px"});n("#"+this._id+"_pageviewheaderContainer").css({width:i+"px",height:r+"px"});n("#"+this._id+"_pageviewfooterContainer").css({width:i+"px",height:u+"px"});n("#"+this._id+"_pageviewbodyContainer").css({height:t+"px",width:i+"px"});f=n("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect();this._browserInfo.name=="msie"&&this._browserInfo.version==8?(e=f.right-f.left,o=f.bottom-f.top):(e=f.width,o=f.height);n("#"+this._id+"_pageviewOuterline").css({width:e+"px",height:o+"px"})},_renderPageModels:function(t){n("#"+this._id+"_pageviewheaderContainer").empty();n("#"+this._id+"_pageviewfooterContainer").empty();n("#"+this._id+"_pageviewbodyContainer").empty();t&&(t.ReportStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer"),t.ReportStyleModel,!1),t.HeaderStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer .pageHeaderBorder"),t.HeaderStyleModel,!1),t.FooterStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer .pageFooterBorder"),t.FooterStyleModel,!1),t.BodyStyleModel&&this._applyPageStyle(n("#"+this._id+"_pageviewContainer .pageBodyBorder"),t.BodyStyleModel,!1),t.HeaderModel&&t.HeaderModel.length>0&&(this._renderPageControls(t.HeaderModel,n("#"+this._id+"_pageviewheaderContainer"),!1,null),this._printMode&&n("#"+this._id+"_pageviewheaderContainer").css("overflow","hidden")),t.FooterModel&&t.FooterModel.length>0&&(this._renderPageControls(t.FooterModel,n("#"+this._id+"_pageviewfooterContainer"),!1,null),this._printMode&&n("#"+this._id+"_pageviewfooterContainer").css("overflow","hidden")),t.PageModel&&t.PageModel.length>0&&this._renderPageControls(t.PageModel,n("#"+this._id+"_pageviewbodyContainer"),!1,null));n(".txtToggle_"+this._id).length>0&&this._drillAction();n(".drillAction_"+this._id).length>0&&this._drillThroughAction();n(".txtSorting_"+this._id).length>0&&this._sortingAction();this._isDocumentMap&&!this._printMode&&(this._documentMapAction(),this._isDocumentMap=!1,this._pageDocMapFlag=!0);this._parentPageXY&&(n("#"+this._id+"_viewerContainer").animate({scrollTop:this._parentPageXY.y,scrollLeft:this._parentPageXY.x},1e3),this._parentPageXY=null);this.model.printMode?n("#"+this._id+"_pageviewContainer").css({"padding-left":this._pageModel.MarginLeft,"padding-top":this._pageModel.MarginTop,"padding-right":this._pageModel.MarginRight,"padding-bottom":this._pageModel.MarginBottom}):n("#"+this._id+"_pageviewContainer").css("padding","0px")},_applyPageStyle:function(n,t,i){var r=i?"PrintImage":"GetResource";t.BackgroundColor&&n.css("background-color",t.BackgroundColor);t.BackgroundSrc&&n.css("background-image","url("+this.model.reportServiceUrl+"/"+r+"/?key="+t.BackgroundSrc+"&resourcetype=sfimg&isPrint="+i+")");t.Border&&this._applyBorderStyle(t.Border,n)},_renderPageControls:function(n,i,r,u){var e=t.buildTag("div","",{},{}),o,f,s,h;for(i.html(e),o=0;o<n.length;o++)f=n[o],f.ItemType=="TextBoxModel"?(s=this._renderTextBoxControl(f,!1,null,r,u),e.append(s)):f.ItemType=="LineModel"?(h=this._renderLineControl(f,null,r,u),e.append(h)):f.ItemType=="ImageModel"?this._renderImageControl(f,!1,e,null,r,u):f.ItemType=="TablixModel"?this._renderTablixControl(f,!1,{},e,null,r,u):f.ItemType=="GaugeModel"?this._renderGaugeControl(f,!1,!1,{},e,null,r,u):f.ItemType=="RectangleModel"?this._renderRectangleControl(f,!1,e,null,r,u):f.ItemType=="ChartModel"?this._renderChartControl(f,!1,!1,{},e,null,r,u):f.ItemType=="MapModel"?this._renderMapControl(f,!1,e,null,r,u):f.ItemType=="SubReportModel"&&this._renderSubReportControl(f,!1,e,null,r,u)},_controlKeyGenerator:function(n,i,r,u){var f=t.isNullOrUndefined(i)?"":"^"+i;return r&&(f=f.length==0?"^"+u:f+"_"+u),n+f},_applyBorderStyle:function(n,t){n.Default&&(t.css("border-width",n.Default.Thickness+"px"),t.css("border-color",n.Default.BorderBrush),t.css("border-style",n.Default.BorderStyle));n.LeftBorder&&(t.css("border-left-width",n.LeftBorder.Thickness+"px"),t.css("border-left-color",n.LeftBorder.BorderBrush),t.css("border-left-style",n.LeftBorder.BorderStyle));n.RightBorder&&(t.css("border-right-width",n.RightBorder.Thickness+"px"),t.css("border-right-color",n.RightBorder.BorderBrush),t.css("border-right-style",n.RightBorder.BorderStyle));n.TopBorder&&(t.css("border-top-width",n.TopBorder.Thickness+"px"),t.css("border-top-color",n.TopBorder.BorderBrush),t.css("border-top-style",n.TopBorder.BorderStyle));n.BottomBorder&&(t.css("border-bottom-width",n.BottomBorder.Thickness+"px"),t.css("border-bottom-color",n.BottomBorder.BorderBrush),t.css("border-bottom-style",n.BottomBorder.BorderStyle))},_applyTextStyle:function(t,i,r,u,f){var v=0,y=0,p=0,w=0,o=0,s=0,h=0,c=0,b,l,e,a;if(t.Padding&&(t.Padding.Top&&(i.css("padding-top",t.Padding.Top),v=t.Padding.Top),t.Padding.Right&&(i.css("padding-right",t.Padding.Right),y=t.Padding.Right),t.Padding.Bottom&&(i.css("padding-bottom",t.Padding.Bottom),p=t.Padding.Bottom),t.Padding.Left&&(i.css("padding-left",t.Padding.Left),w=t.Padding.Left)),t.TextBoxBackgroundColor&&i.css("backgroundColor",t.TextBoxBackgroundColor),t.VerticalAlign&&t.VerticalAlign!="Default"&&i.css("vertical-align",t.VerticalAlign),t.Border&&(t.Border.Default&&(i.css({"border-width":t.Border.Default.Thickness+"px","border-color":t.Border.Default.BorderBrush,"border-style":t.Border.Default.BorderStyle}),o=s=h=c=t.Border.Default.Thickness),t.Border.LeftBorder&&(i.css({"border-left-width":t.Border.LeftBorder.Thickness+"px","border-left-color":t.Border.LeftBorder.BorderBrush,"border-left-style":t.Border.LeftBorder.BorderStyle}),c=t.Border.LeftBorder.Thickness),t.Border.RightBorder&&(i.css({"border-right-width":t.Border.RightBorder.Thickness+"px","border-right-color":t.Border.RightBorder.BorderBrush,"border-right-style":t.Border.RightBorder.BorderStyle}),s=t.Border.RightBorder.Thickness),t.Border.TopBorder&&(i.css({"border-top-width":t.Border.TopBorder.Thickness+"px","border-top-color":t.Border.TopBorder.BorderBrush,"border-top-style":t.Border.TopBorder.BorderStyle}),o=t.Border.TopBorder.Thickness),t.Border.BottomBorder&&(i.css({"border-bottom-width":t.Border.BottomBorder.Thickness+"px","border-bottom-color":t.Border.BottomBorder.BorderBrush,"border-bottom-style":t.Border.BottomBorder.BorderStyle}),h=t.Border.BottomBorder.Thickness)),b=i.get(0).tagName,b.toLowerCase()=="td"){var g=parseFloat(w,10)+parseFloat(y,10),nt=parseFloat(v,10)+parseFloat(p,10),tt=parseFloat(c,10)+parseFloat(s,10),it=parseFloat(o,10)+parseFloat(h,10),k=parseFloat(u,10)-(g+tt),d=parseFloat(t.CanGrow?t.Height:f,10)-(nt+it);if(i.css("width",k+"px"),i.css("height",d+"px"),!t.ToggleInfo){for(l=n(r).children(),e=0;e<l.length;e++)a=n(l[e]),a.hasClass("e-reportviewer-usersort")||a.width(k);n(r).height(d)}}},_renderTablixControl:function(i,r,u,f,e,o,s){var y=this,tt=i.Height,ot=i.Width,p=y._controlKeyGenerator(y._id+"_"+i.Name,e,o,s),b=t.buildTag("div","",{},{id:p,title:i.Tooltip}),w={},ct,lt,d,v,at,g,nt,c,it,rt,vt,l,ut,k,a,h,ft,st,ht,et;if(f.append(b),w.top=i.Top,w.left=i.Left,r?(tt=u.height,ct=parseFloat(b.css("border-left-width"),10)+parseFloat(b.css("border-right-width"),10),lt=parseFloat(b.css("border-top-width"),10)+parseFloat(b.css("border-bottom-width"),10),ot=ot-ct,tt=tt-lt,w.position="relative"):w.position="absolute",w.width=ot,w.height=tt,d=t.buildTag("table","",{"border-collapse":"collapse","font-size":"8pt"},{cellspacing:"0",cellpadding:"0"}),v={},b.append(d),i.BackgroundColor&&(v["background-color"]=i.BackgroundColor),i.StyleVal&&(i.StyleVal.Font&&(i.StyleVal.Font.FontFamily&&(v["font-family"]=i.StyleVal.Font.FontFamily),i.StyleVal.Font.FontSize&&(v["font-size"]=i.StyleVal.Font.FontSize),i.StyleVal.Font.FontStyle&&(v["font-style"]=i.StyleVal.Font.FontStyle),i.StyleVal.Font.FontWeight&&(v["font-weight"]=i.StyleVal.Font.FontWeight+" !important")),v.color=i.StyleVal.TextColor?i.StyleVal.TextColor:"black",i.StyleVal.TextDecoration&&(v["text-decoration"]=i.StyleVal.TextDecoration)),i.Padding&&(i.Padding.Left&&(v["padding-left"]=i.Padding.Left),i.Padding.Right&&(v["padding-right"]=i.Padding.Right),i.Padding.Top&&(v["padding-top"]=i.Padding.Top),i.Padding.Bottom&&(v["padding-bottom"]=i.Padding.Bottom)),i.TextAlign&&(v["text-align"]=i.TextAlign),i.VerticalAlign&&(v["vertical-align"]=i.VerticalAlign),at=o?"PrintImage":"GetResource",i.BackgroundImageSrc&&(v["background-image"]="url("+this.model.reportServiceUrl+"/"+at+"/?key="+i.BackgroundImageSrc+"&resourcetype=sfimg&isPrint="+o+")"),i.Border&&(g=i.Border.TopBorder,i.Border.TopBorder=null,this._applyBorderStyle(i.Border,d),g&&(w["border-top-width"]=g.Thickness+"px",w["border-top-color"]=g.BorderBrush,w["border-top-style"]=g.BorderStyle),i.Border.TopBorder=g),d.css(v),b.css(w),i.CellModels&&i.CellModels.length>0){for(nt=t.buildTag("tr","",{padding:"0px",margin:"0px",height:"0px",visibility:"collapse"},{}),i.Border&&(i.Border.TopBorder&&i.Border.TopBorder.BorderStyle!="None"||i.Border.Default&&i.Border.Default.BorderStyle!="None")&&nt.css("visibility","visible"),d.append(nt),it=null,rt=null,c=0;c<i.CellModels[0].length;c++)vt=t.buildTag("td","",{padding:"0px",margin:"0px",width:i.ColWidths[c]+"px"},{rowSpan:"1",colSpan:"1"}),nt.append(vt);for(l=0;l<i.CellModels.length;l++){for(ut=t.buildTag("tr","",{padding:"0px",margin:"0px","text-align":"left",height:i.RowHeights[l]+"px"},{vAlign:"top"}),d.append(ut),k=i.CellModels[l],c=0;c<k.length;c++)if(a=t.buildTag("td","",{padding:"0px",margin:"0px","text-align":"left",height:"100%"},{rowSpan:"1",colSpan:"1"}),ut.append(a),h=k[c].ItemModel,h){var yt=k[c].Border,pt=k[c].RowSpan,wt=k[c].ColSpan;h.Hidden||(yt&&y._applyBorderStyle(yt,a),h.ItemType=="TextBoxModel"?(ft=y._renderTextBoxControl(h,!0,p+"tablixRow"+l+"xCol"+c,o,s),ft.css("max-height","99.9% !important"),a.css("height",i.RowHeights[l]+"px"),y._applyTextStyle(h,a,ft,i.ColWidths[c],i.RowHeights[l]),a.append(ft)):h.ItemType=="LineModel"?(st=y._renderLineControl(h,p+"tablixRow"+l+"xCol"+c,o,s),st.css("position","relative"),a.append(st)):h.ItemType=="ImageModel"?y._renderImageControl(h,!0,a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="TablixModel"?y._renderTablixControl(h,!0,{height:i.RowHeights[l]},a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="GaugeModel"?y._renderGaugeControl(h,!1,!0,{height:i.RowHeights[l]},a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="RectangleModel"?y._renderRectangleControl(h,!0,a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="ChartModel"?this._renderChartControl(h,!1,!0,{height:i.RowHeights[l]},a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="MapModel"?this._renderMapControl(h,!1,a,p+"tablixRow"+l+"xCol"+c,o,s):h.ItemType=="SubReportModel"&&y._renderSubReportControl(h,!0,a,p+"tablixRow"+l+"xCol"+c,o,s));pt>1&&a.attr("rowspan",pt);wt>1&&a.attr("colspan",wt)}else a.css("display","none");k[0].FixedData&&(it==null&&rt==null&&(ht=t.buildTag("div","",{top:i.Top,left:i.Left,position:"absolute"},{id:p+"_headertable"}),b.addClass("fixed-data"),f.append(ht),et=t.buildTag("table","",{"border-collapse":"collapse","font-size":"8pt"},{cellspacing:"0",cellpadding:"0"}),ht.append(et)),it=n(nt).clone(),rt=n(ut).clone(!0),et.append(it),et.append(rt))}}},_renderTextBoxControl:function(n,i,r,u,f){var nt=this._controlKeyGenerator(this._id+"_"+n.Name,r,u,f),l=t.buildTag("div","",{},{id:nt,title:n.ToolTip}),h={},g,y,p,k,d;if(i?i&&(h["word-wrap"]="break-word",h["white-space"]="pre-wrap"):(h.position="absolute",h.top=n.Top,h.left=n.Left,h.width=n.Width,h.height=n.Height,this._applyTextStyle(n,l,null,null,null)),n.CanGrow||(h.overflow="hidden"),g=u?"PrintImage":"GetResource",n.BackgroundSrc&&(h["background-image"]="url("+this.model.reportServiceUrl+"/"+g+"/?key="+n.BackgroundSrc+"&resourcetype=sfimg&isPrint="+u+")"),n.ToggleInfo&&!this._printMode){var tt=n.IsToggle?"e-reportviewer-collapsetoggle":"e-reportviewer-expandtoggle",w=t.buildTag("div."+tt+" txtToggle_"+this._id,"",{display:"block",width:"14px",height:"14px","margin-Top":"1px"},{}),v={};this._browserInfo.name=="msie"?(v["margin-right"]="1px",v.float="left"):(this._browserInfo.name=="opera"||this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome"||this._browserInfo.name=="mozilla"||this._browserInfo.name=="edge")&&(v.display="table",v["margin-right"]="2px",v.float="left");w.data("drillObj",n.ToggleInfo);w.css(v);l.append(w);h.display=this._browserInfo.name=="msie"?"inline-block":"flex";h["word-wrap"]="inherit";h["white-space"]="inherit"}if(n.WritingMode!="Default"&&n.WritingMode=="Vertical"&&(this._browserInfo.name=="msie"?h["writing-mode"]="tb-rl":h.transform="rotate(90deg)"),n.ActionInfo&&(l.data("actionObj",n.ActionInfo),l.addClass("drillAction_"+this._id+" e-reportviewer-drillhover")),n.Paragraphval)for(y=0;y<n.Paragraphval.length;y++){var b=t.buildTag("div.e-reportviewer-paragrap","",{}),o={},e=n.Paragraphval[y];for(p=0;p<e.Runs.length;p++){var s=e.Runs[p],a=t.buildTag("span","",{}),c={};c["white-space"]=n.ToggleInfo&&!u?"inherit":"pre-wrap";s.ActionInfo&&(a.data("actionObj",s.ActionInfo),a.addClass("drillAction_"+this._id+" e-reportviewer-drillhover"));s.Style.Font.FontFamily&&(c["font-family"]=s.Style.Font.FontFamily);s.Style.Font.FontSize&&(c["font-size"]=s.Style.Font.FontSize);s.Style.Font.FontStyle&&(c["font-style"]=s.Style.Font.FontStyle);s.Style.Font.FontWeight&&(c["font-weight"]=s.Style.Font.FontWeight);c.color=s.Style.TextColor?s.Style.TextColor:"black";s.Style.TextDecoration&&(c["text-decoration"]=s.Style.TextDecoration);s.RunText&&(s.IsHtmlText?a.append(s.RunText):a.text(s.RunText).text());s.IsHtmlText&&s.RunText!=null&&s.RunText.indexOf("<p>")>-1&&(a.find("p:first").css("padding-top","12px"),a.find("p").css({"padding-bottom":"12px",margin:"0px"}));this._browserInfo.name=="mozilla"&&s.Style!=null&&s.Style.Font!=null&&s.Style.Font.FontSize!=null&&(c["line-height"]=s.Style.Font.FontSize*1.17+"px");a.css(c);b.append(a)}i||(o["word-wrap"]="break-word");e.TextAlignment&&(o["text-align"]=e.TextAlignment);n.Direction!="Default"&&n.Direction!="LTR"&&(o["text-align"]="right");n.VerticalAlign!="Default"&&n.CanGrow&&(o["vertical-align"]=n.VerticalAlign);e.LeftIndent&&(o["padding-left"]=e.LeftIndent);e.RightIndent&&(e.TextAlignment=="Right"?(o["padding-right"]=e.RightIndent,o.float="right"):o["padding-right"]=e.RightIndent);e.SpaceBefore&&(o["padding-top"]=e.SpaceBefore);e.SpaceAfter&&(o["padding-bottom"]=e.SpaceAfter);e.LineHeight&&(o["line-height"]=e.LineHeight+"px");e.ListStyle&&(o["list-style-type"]=e.ListStyle);e.HangingIndent&&(o["text-indent"]=e.HangingIndent);i&&(o["min-width"]="99.9%");e.ListLevel&&e.ListLevel!=0&&n.Direction!="RTL"?o["margin-left"]=e.ListLevel*"30":e.ListLevel!=0&&n.Direction=="RTL"&&(o["margin-Right"]=e.ListLevel*"30",o.direction="rtl");e.ListStyle=="Numbered"&&e.ListLevel>=1?e.ListLevel==1||e.ListLevel==4||e.ListLevel==7?(o.display="list-item",o["list-style-type"]="decimal"):e.ListLevel==2||e.ListLevel==5||e.ListLevel==8?(o.display="list-item",o["list-style-type"]="lower-roman"):(e.ListLevel==3||e.ListLevel==6||e.ListLevel==9)&&(o.display="list-item",o["list-style-type"]="lower-alpha"):e.ListStyle=="Bulleted"&&e.ListLevel>=1&&(o.display="list-item",o["list-style-type"]=e.ListStyle);b.css(o);l.append(b)}return n.Sorting&&(k="sortingUpDown",k=n.Sorting.Sorting=="UpDown"?"sortingUpDown":n.Sorting.Sorting=="Up"?"sortingUp":"sortingDown",d=t.buildTag("div.e-reportviewer-"+k+" txtSorting_"+this._id+" e-reportviewer-usersort","",{display:"block",width:"14px",height:"14px","padding-right":"1px","margin-Top":"1px",float:"right","vertical-align":"middle",position:"absolute",left:n.Width-14<0?"80%":n.Width-14+"px",top:"10%"},{}),d.data("sortingObj",n.Sorting),l.append(d),h.position="relative"),l.css(h),l},_renderChartControl:function(i,r,u,f,e,o,s,h){var wt,d,bt,kt,dt,ut,v,tt,c,vt,st,g,it,ht,ft,k,p,et,y,b,w,ct,yt,lt,pt,nt;if(i.ChartAreas){var rt=i.Height,ot=i.Width,at="chartCtrl";for(r&&(this._id=o,i.Top=0,i.Left=0),wt=this._controlKeyGenerator(this._id+"_"+i.Name,o,s,h),d=t.buildTag("div","",{},{id:wt,title:i.ToolTip}),e.append(d),d.css("position","absolute"),i.ChartStyle&&(i.ChartStyle.Border&&this._applyBorderStyle(i.ChartStyle.Border,d),i.ChartStyle.FillStyle&&(d.css("background-color",i.ChartStyle.FillStyle.BackgroundColor),this._applyBackgroundGradientStyle(i.ChartStyle.FillStyle,d)),st=s?"PrintImage":"GetResource",i.BackgroundImge&&d.css({"background-image":"url("+this.model.reportServiceUrl+"/"+st+"/?key="+i.BackgroundImge+"&resourcetype=sfimg&isPrint="+s+")","background-size":"100% 100%"})),u&&(at=o,rt=f.height,bt=parseFloat(d.css("border-left-width"),10)+parseFloat(d.css("border-right-width"),10),kt=parseFloat(d.css("border-top-width"),10)+parseFloat(d.css("border-bottom-width"),10),ot=ot-bt,rt=rt-kt,d.css("position","relative")),dt=rt/i.ChartAreas.length,i.Top&&d.css("top",i.Top),i.Left&&d.css("left",i.Left),ot&&d.css("width",ot),rt&&d.css("height",rt),ut=0;ut<i.ChartAreas.length;ut++){for(v=i.ChartAreas[ut],tt=null,tt=s?t.buildTag("div","",{},{id:at+"_"+this._id+"_"+i.Name+"_"+v.Name+"_"+h,title:i.ToolTip}):t.buildTag("div","",{},{id:at+"_"+this._id+"_"+i.Name+"_"+v.Name,title:i.ToolTip}),d.append(tt),tt.css("height",dt),tt.ejChart(),c=tt.data("ejChart"),vt=c.model.series[0],c.model.series.pop(vt),c.model.chartClick=this._onReporClick,v.Style&&(v.Style.FillStyle&&v.Style.FillStyle.BackgroundColor!="#00ffffff"&&(c.model.chartArea.background=v.Style.FillStyle.BackgroundColor),st=s?"PrintImage":"GetResource",v.BackgroundImg&&(c.model.backGroundImageUrl=this.model.reportServiceUrl+"/"+st+"/?key="+v.BackgroundImg+"&resourcetype=sfimg&isPrint="+s),v.Style.Border&&v.Style.Border.Default?(v.Style.Border.Default.BorderBrush&&(c.model.chartArea.border.color=v.Style.Border.Default.BorderBrush),v.Style.Border.Default.BorderStyle=="Default"||v.Style.Border.Default.BorderStyle=="None"?(c.model.chartArea.border.width=0,c.model.chartArea.border.opacity=0):c.model.chartArea.border.width=v.Style.Border.Default.Thickness):(c.model.chartArea.border.opacity=1,c.model.chartArea.border.color="Transparent")),ut==0&&i.ChartTiles.length>0&&(g=i.ChartTiles[ut],g.Caption&&g.Visible&&(c.model.title.text=g.Caption,g.Style&&(g.Style.Color&&(c.model.title.font.color=g.Style.Color),g.Style.Font&&(g.Style.Font.FontFamily&&(c.model.title.font.fontFamily=g.Style.Font.FontFamily),g.Style.Font.FontStyle&&(c.model.title.font.fontStyle=g.Style.Font.FontStyle),g.Style.Font.FontWeight&&(c.model.title.font.fontWeight=g.Style.Font.FontWeight),g.Style.Font.FontSize!=0&&(c.model.title.font.size=g.Style.Font.FontSize+"px"))))),it=0;it<v.ChartSeries.length;it++){var a=v.ChartSeries[it],l=n.extend(!0,{},vt),gt=l.points[0];for(l.points=[],l.type=a.Type,l.name=a.Legend&&a.Legend.LegendText?a.Legend.LegendText:a.Label,l.name=l.name==""&&a.Name=="EmptySeriesName"?a.Name:l.name,a.Type=="explodedpie"?(l.type="pie",l.explodeAll=!0,l.explodeOffset=8):a.Type=="explodeddoughnut"&&(l.type="doughnut",l.explodeAll=!0,l.explodeOffset=10),l.isStacking=a.Type=="stackingcolumn"?!0:!1,l.isStacking&&(c.model.legendBoundsCalculate=this._legendOrder),ht=[],ft=0;ft<a.PointValues.length;ft++){if(k=n.extend(!0,{},gt),p=a.PointValues[ft],k.YValues=[],k.X=p.X?k.x=p.X:k.x=0,p.Y?(k.Y=k.y=p.Y,k.YValues.push(k.Y)):(k.Y=k.y=0,k.YValues.push(k.Y)),p.Low&&k.YValues.push(p.Low),p.High&&k.YValues.push(p.High),p.Start&&k.YValues.push(p.Start),p.End&&k.YValues.push(p.End),a.Type=="bubble"&&(k.size=.5),p.ChartDataLabel&&(k.text=p.ChartDataLabel.Label),p.ActionInfo&&ht.push(p.ActionInfo),i.ColorPalette=="Custom")for(c.model.colors=[],et=0;et<i.CustomPaletteColors.length;et++)c.model.colors[et]=i.CustomPaletteColors[et];else!a.Type=="doughnut"||!a.Type=="pie"?c.model.colors=[]:p.Style&&p.Style.Color&&(c.model.colors[ft]=p.Style.Color);p.Style&&p.Style.Color&&(k.fill=p.Style.Color,l.fill=p.Style.Color);i.CustomPaletteColors&&i.ColorPalette&&i.ColorPalette=="Custom"?l.fill=i.CustomPaletteColors[it]:p.Style!=null&&p.Style.Color==null&&(l.fill=c.model.colors[it]);l.points.push(k)}ht.length>0&&(c.model.pointRegionClick=this._drillThroughClick,c.ejreportid=this._id,tt.data(c._id+"actionObj_Series"+it,ht),c.model.pointRegionMouseMove=function(i){if(t.isNullOrUndefined(n("#"+this._id).data(this._id+"actionObj_Series"+i.data.region.SeriesIndex)))return!1;n("#"+this._id+"_svg_Series"+i.data.region.SeriesIndex+"_Point"+i.data.region.Region.PointIndex).css("cursor","pointer")});l.visibility=a.Visibility?"visible":"hide";l.tooltip.format=" x: #point.x#<br/>y: #point.y#";l.tooltip.visible=!0;l.enableAnimation=!1;a.Style&&a.Style.Border&&a.Style.Border.Default&&(a.Style.Border.Default.BorderBrush&&(l.border.color=a.Style.Border.Default.BorderBrush),a.Style.Border.Default.Thickness!=0&&(l.border.width=a.Style.Border.Default.Thickness),a.Style.Border.Default.BorderStyle=="Dashed"?l.border.dashArray="2,4":a.Style.Border.Default.BorderStyle=="Dotted"&&(l.border.dashArray="2,2"));a.DataPointsStyle&&a.DataPointsStyle.length>0&&(a.Type=="scatter"?(y=a.DataPointsStyle[0],l.marker.shape=y.ChartMarker&&y.ChartMarker.MarkerType?y.ChartMarker.MarkerType:"Circle",y.ChartMarker.Color&&(l.marker.fill=y.ChartMarker.Color),y.ChartMarker.BorderColor&&(l.marker.border.color=y.ChartMarker.BorderColor),y.ChartMarker.Borderwidth&&(l.marker.border.width=y.ChartMarker.Borderwidth==0?2:y.ChartMarker.Borderwidth),l.marker.size.height=y.ChartMarker.Size?l.marker.size.width=parseInt(y.ChartMarker.Size==0||y.ChartMarker.Size<6)?6:y.ChartMarker.Size:l.marker.size.width=10,l.marker.visible=!0):(y=a.DataPointsStyle[0],y.ChartMarker&&(y.ChartMarker.MarkerType&&(l.marker.shape=y.ChartMarker.MarkerType),y.ChartMarker.Color&&(l.marker.fill=y.ChartMarker.Color),y.ChartMarker.BorderColor&&(l.marker.border.color=y.ChartMarker.BorderColor),y.ChartMarker.Borderwidth&&(l.marker.border.width=y.ChartMarker.Borderwidth==0?2:y.ChartMarker.Borderwidth),y.ChartMarker.Size&&(l.marker.size.height=l.marker.size.width=parseInt(y.ChartMarker.Size==0||y.ChartMarker.Size<6)?6:y.ChartMarker.Size)),l.marker.visible=a.Visibility&&y.ChartMarker&&y.ChartMarker.MarkerType?!0:!1,a.PointValues.length>0&&a.PointValues[0].ChartDataLabel&&(l.marker.dataLabel.visible=!1,b=a.PointValues[0].ChartDataLabel,l.marker.dataLabel.visible=b.Visible,b.Visible&&(l.marker.dataLabel.connectorLine.type="line",l.marker.dataLabel.connectorLine.width=.5,l.marker.dataLabel.textPosition=l.isStacking?b.Position&&b.Position=="Default"?"middle":b.Position:b.Position&&b.Position=="Default"?"top":b.Position,l.marker.dataLabel.font.color=b.TextColor?b.TextColor:"Black",b.Font&&(l.marker.dataLabel.font.fontFamily=b.Font.FontFamily,l.marker.dataLabel.font.fontStyle=b.Font.FontStyle,l.marker.dataLabel.font.fontWeight=b.Font.FontWeight,l.marker.dataLabel.font.size=b.Font.FontSize+"px"),b.BorderStyle&&b.BorderStyle!="None"&&(l.marker.dataLabel.border.color=b.BorderColor,l.marker.dataLabel.border.width=b.BorderWidth,l.marker.dataLabel.shape="Rectangle"),b.BackGroundColor&&b.BackGroundColor!="Transparent"&&(l.marker.dataLabel.fill=b.BackGroundColor,l.marker.dataLabel.shape="Rectangle")))));c.model.series.push(l)}if(i.ChartLegends&&i.ChartLegends.length>0?(w=i.ChartLegends[0],c.model.legend.visible=w.Visibilty,w.Alignment&&(c.model.legend.alignment=w.Alignment),w.Position&&(c.model.legend.position=w.Position),w.Style&&(w.Style.Color&&(c.model.legend.font.color=w.Style.Color),w.Style.Font&&(w.Style.Font.FontFamily&&(c.model.legend.font.fontFamily=w.Style.Font.FontFamily),w.Style.Font.FontStyle&&(c.model.legend.font.fontStyle=w.Style.Font.FontStyle),w.Style.Font.FontWeight&&(c.model.legend.font.fontWeight=w.Style.Font.FontWeight),w.Style.Font.FontSize!=0&&(c.model.legend.font.size=w.Style.Font.FontSize+"px")),w.Style.Border&&w.Style.Border.Default&&(w.Style.Border.Default.BorderBrush&&(c.model.legend.border.color=w.Style.Border.Default.BorderStyle=="Default"?"transparent":w.Style.Border.Default.BorderBrush),w.Style.Border.Default.Thickness!=0&&(c.model.legend.border.width=w.Style.Border.Default.Thickness)))):c.model.legend.visible=!1,c.model.series.length>0&&c.model.series[0].type!="polar"&&c.model.series[0].type!="radar"){for(ct=0;ct<v.ChartAreaXAxis.length;ct++)yt=v.ChartAreaXAxis[ct],yt.Name.toString().toLowerCase()=="primary"&&this._applyAxis(yt,c.model.primaryXAxis,i.IsLabelIndex,"XAxis","primary",c.model.series[0].type,v.Chart3D?v.Chart3D.Enabled:null);for(lt=0;lt<v.ChartAreaYAxis.length;lt++)pt=v.ChartAreaYAxis[lt],pt.Name.toString().toLowerCase()=="primary"&&this._applyAxis(pt,c.model.primaryYAxis,i.IsLabelIndex,"YAxis","primary",c.model.series[0].type,v.Chart3D?v.Chart3D.Enabled:null)}v.Chart3D&&v.Chart3D.Enabled&&(c.model.enable3D=v.Chart3D.Enabled,c.model.depth=v.Chart3D.DepthRatio,c.model.wallSize=v.Chart3D.WallThickness,c.model.tilt=0,c.model.rotation=20,c.model.perspectiveAngle=v.Chart3D.Perspective==0?90:v.Chart3D.Perspective,c.model.crosshair.visible=!0);a&&a.PointValues.length<=0&&(c.model.legend.visible=!1,c.model.primaryXAxis.visible=!1,c.model.primaryYAxis.visible=!1,c.model.series=[],c.model.chartArea.visible=!1,nt=i.ChartNoDataMessage,c.model.title.text==""&&(c.model.title.text=" "),nt.Caption&&nt.Visible&&(c.model.title.subTitle.textAlignment="center",c.model.title.subTitle.text=nt.Caption,nt.Style&&(nt.Style.Color&&(c.model.title.subTitle.font.color=nt.Style.Color),nt.Style.Font&&(nt.Style.Font.FontFamily&&(c.model.title.subTitle.font.fontFamily=nt.Style.Font.FontFamily),nt.Style.Font.FontStyle&&(c.model.title.subTitle.font.fontStyle=nt.Style.Font.FontStyle),nt.Style.Font.FontWeight&&(c.model.title.subTitle.font.fontWeight=nt.Style.Font.FontWeight),nt.Style.Font.FontSize!=0&&(c.model.title.subTitle.font.size=nt.Style.Font.FontSize+"px")))));c.redraw()}}},_legendOrder:function(n){n.model.legendCollection.reverse()},_chartAreaDisplayText:function(n){n.data.text=="0"&&(n.data.text="")},_applyBackgroundGradientStyle:function(n,t){var i;switch(n.BackgroundGradientType){case"LeftRight":i="to right";t.css("background","linear-gradient("+i+","+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"TopBottom":t.css("background","linear-gradient("+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"Center":t.css("background","radial-gradient("+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"DiagonalLeft":i="to bottom right";t.css("background","linear-gradient("+i+","+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"DiagonalRight":i="to bottom left";t.css("background","linear-gradient("+i+","+n.BackgroundColor+", "+n.BackgroundGradientEndcolor+")");break;case"HorizontalCenter":t.css("background","linear-gradient("+n.BackgroundColor+","+n.BackgroundGradientEndcolor+", "+n.BackgroundColor+")");break;case"VerticalCenter":t.css("background","linear-gradient(90deg,"+n.BackgroundColor+","+n.BackgroundGradientEndcolor+", "+n.BackgroundColor+")")}},_applyAxis:function(t,i,r,u,f,e,o){var l,s,c,h;if(e=="pie"||o||(i.labelPlacement="onticks"),u=="XAxis"&&t.Labels&&t.Labels.length>0)for(i.crosshairLabel.visible=!0,i.valueType="category",i.isIndexed=r,i.labelBorder.width=1,i.labelBorder.color="grey",l=i.multiLevelLabels[0],i.multiLevelLabels.pop(l),s=0;s<t.Labels.length;s++)for(c=0;c<t.Labels[s].Categories.length;c++)h=n.extend(!0,{},l),h.visible=!0,h.text=t.Labels[s].Categories[c].Text,h.start=t.Labels[s].Categories[c].Start,h.end=t.Labels[s].Categories[c].End,h.level=t.Labels[s].Index,i.multiLevelLabels.push(h);t.ChartAxisTitle&&(t.ChartAxisTitle.Caption&&(i.title.text=t.ChartAxisTitle.Caption),t.ChartAxisTitle.TextColor&&(i.title.font.color=t.ChartAxisTitle.TextColor),t.ChartAxisTitle.Font&&(t.ChartAxisTitle.Font.FontSize&&(i.title.font.size=t.ChartAxisTitle.Font.FontSize),t.ChartAxisTitle.Font.FontFamily&&(i.title.font.fontFamily=t.ChartAxisTitle.Font.FontFamily),t.ChartAxisTitle.Font.FontStyle&&(i.title.font.fontStyle=t.ChartAxisTitle.Font.FontStyle)));t.Maximum!=null&&t.Maximum!="NaN"&&t.Maximum!=0&&t.Minimum!=null&&t.Minimum!="NaN"&&(i.setRange=!0,i.range.min=t.Minimum,i.range.max=t.Maximum);t.Interval!="NaN";t.IntervalType;i.font.color=t.LabelColor?t.LabelColor:"Black";i.labelFormat=t.LabelFormat;t.LabelFont&&(i.font.fontFamily=t.LabelFont.FontFamily,i.font.size=t.LabelFont.FontSize,i.font.fontStyle=t.LabelFont.FontStyle=="Default"?"Normal":t.LabelFont.FontStyle,i.font.fontWeight=t.LabelFont.FontWeight);t.ChartMajorGridLines&&this._applyGridLines(t.ChartMajorGridLines,i.majorGridLines);t.ChartMinorGridLines&&this._applyGridLines(t.ChartMinorGridLines,i.minorGridLines);t.ChartMajorTickMarks&&this._applyTickMarks(t.ChartMajorTickMarks,i.majorTickLines);t.ChartMinorTickMarks&&this._applyTickMarks(t.ChartMinorTickMarks,i.minorTickLines);i.minorTicksPerInterval==null&&(i.minorTicksPerInterval=1);t.Labels!=null&&t.Labels.length>0?i.labelIntersectAction="trim":t.LabelsAutoFitEnabled?i.labelIntersectAction=t.PrExventWordWrap&&t.PrExventLabelOffset?t.AllowLabelRotation!="none"?t.AllowLabelRotation:"trim":t.PrExventLabelOffset?"wrapByWord":"multipleRows":t.Angle?i.labelRotation=t.Angle:i.labelIntersectAction="wrap";t.LineColor&&(i.axisLine.color=t.LineColor);t.LineWidth&&(i.axisLine.width=t.LineWidth);t.HideEndLabels&&(i.edgeLabelPlacement="hide");t.VisibleStatus=="True"||f=="primary"&&t.VisibleStatus=="Auto"?(i.visible=!0,i.axisLine.visible=!0):(i.visible=!1,i.axisLine.visible=!1);i.rangePadding="none"},_applyGridLines:function(n,t){t.visible=n.Enabled;n.Enabled&&n.Style&&n.Style.Default&&(n.Style.Default.BorderBrush&&(t.color=n.Style.Default.BorderBrush),t.width=n.Style.Default.BorderStyle=="None"?t.width:n.Style.Default.Thickness,n.Style.Default.BorderStyle=="Dashed"?t.dashArray="2,4":n.Style.Default.BorderStyle=="Dotted"&&(t.dashArray="2,2"))},_applyTickMarks:function(n,t){t.visible=n.Enabled;n.Style&&n.Style.Default&&(n.Style.Default.BorderBrush&&(t.color=n.Style.Default.BorderBrush),n.Style.Default.Thickness&&(t.width=n.Style.Default.Thickness));n.Length&&(t.size=n.Length)},_renderImageControl:function(n,i,r,u,f,e){var c=this._controlKeyGenerator(this._id+"_"+n.Name,u,f,e),s=t.buildTag("div","",{},{id:c,title:n.ToolTip}),o={},h;r.append(s);o.position=i&&n.IsTablixChild?"relative":"absolute";o.top=n.Top;o.left=n.Left;o.width=n.Width;o.height=n.Height;o.overflow="hidden";o["padding-left"]=n.PaddingLeft;o["padding-right"]=n.PaddingRight;o["padding-top"]=n.PaddingTop;o["padding-bottom"]=n.PaddingBottom;n.ActionInfo&&(s.data("actionObj",n.ActionInfo),s.addClass("drillAction_"+this._id+" e-reportviewer-drillhover"));n.Border&&!n.IsTablixChild&&this._applyBorderStyle(n.Border,s);h=t.buildTag("img","",{width:n.ImageWidth,height:n.ImageHeight},{src:f?"":this.model.reportServiceUrl+"/GetResource/?key="+n.ImageUrl+"&resourcetype=sfimg&isPrint="+f,imgUrl:this.model.reportServiceUrl+"/GetResource/?key="+n.ImageUrl+"&resourcetype=sfimg&isPrint="+f});s.append(h);s.css(o)},_renderRectangleControl:function(n,i,r,u,f,e){var h=this._controlKeyGenerator(this._id+"_"+n.Name,u,f,e),s=t.buildTag("div","",{},{id:h,title:n.ToolTip}),c={},a,l,o,v,y;if(r.append(s),c.position=i?"relative":"absolute",c.top=n.Top,c.left=n.Left,c.width=n.Width,c.height=n.Height,c["background-color"]=n.BackgroundColor,a=f?"PrintImage":"GetResource",n.BackgroundImageSrc&&(c["background-image"]="url("+this.model.reportServiceUrl+"/"+a+"/?key="+n.BackgroundImageSrc+"&resourcetype=sfimg&isPrint="+f+")"),n.Border&&!i&&this._applyBorderStyle(n.Border,s),n.IsTablixChild&&n.ReportModels&&n.ReportModels.length>0)for(l=0;l<n.ReportModels.length;l++)o=n.ReportModels[l],o&&(o.ItemType=="TextBoxModel"?(v=this._renderTextBoxControl(o,!1,h+"_"+o.Name,f,e),s.append(v)):o.ItemType=="LineModel"?(y=this._renderLineControl(o,h+"_"+o.Name,f,e),s.append(y)):o.ItemType=="ImageModel"?this._renderImageControl(o,!1,s,h+"_"+o.Name,f,e):o.ItemType=="TablixModel"?this._renderTablixControl(o,!1,{},s,h+"_"+o.Name,e):o.ItemType=="GaugeModel"?this._renderGaugeControl(o,!1,!1,{},s,h+"_"+o.Name,f,e):o.ItemType=="RectangleModel"?this._renderRectangleControl(o,!1,s,h+ + '_'+o.Name,f,e):o.ItemType=="ChartModel"?this._renderChartControl(o,!1,!1,{},s,h+"_"+o.Name,f,e):o.ItemType=="MapModel"?this._renderMapControl(o,!1,s,h+"_"+o.Name,f,e):o.ItemType=="SubReportModel"&&this._renderSubReportControl(o,!1,s,h+ + '_'+o.Name,f,e));s.css(c)},_renderMapControl:function(i,r,u,f,e,o){var a=i.MapProperties,h,l,p,k,b,v,rt,w,nt,s,c,d,g,tt,ft;r&&(this._id=f,i.Top=0,i.Left=0);var it=this._controlKeyGenerator(this._id+"_"+i.Name,f,e,o),y=t.buildTag("div","",{},{id:it}),ut=0;if(u.append(y),y.css("position","absolute"),y.css("top",i.Top),y.css("left",i.Left),y.css("height",i.Height),y.css("width",i.Width),a.Background&&a.Background.BackgroundColor&&y.css("background-color",a.Background.BackgroundColor),i.IsTablixChild&&y.css("position","relative"),a.ActionInfo&&(y.data("actionObj",a.ActionInfo),y.addClass("drillAction_"+this._id+" e-reportviewer-drillhover")),a.Border&&this._applyBorderStyle(a.Border,y),h=a.MapTitles,h&&h.length>0)for(l=0;l<h.length;l++)p=t.buildTag("div","",{},{id:it+"_"+h[l].Name}),p.css("position","relative"),p.css("left","1px"),p.css("height",h[l].Style.Font.FontSize-3*h[l].Border.Thickness),p.css("width",i.Width-3*h[l].Border.Thickness),p.css("text-align","center"),p.css("background-color",h[l].BackGround.BackgroundColor),p.css("border-color",h[l].Border.BorderBrush),p.css("border-width",h[l].Border.Thickness),p.css("border-style",h[l].Border.BorderStyle),k=t.buildTag("span","",{},{id:it+"_"+h[l].Name+"_"+l}),k.css("font-family",h[l].Style.Font.FontFamily),k.css("font-size",h[l].Style.Font.FontSize/1.33),k.css("font-style",h[l].Style.Font.FontStyle),k.css("font-weight",h[l].Style.Font.FontWeight),k.append(h[l].Text),p.append(k),y.append(p);if(a.MapViewport){if(b=a.MapViewport,v=t.buildTag("div","",{},{id:it+"_"+i.Name}),y.append(v),v.css("left","1px"),v.css("top","1px"),h&&h.length>0){for(rt=0;rt<h.length;rt++)ut=ut+h[rt].Style.Font.FontSize;v.css("height",i.Height-ut-3*b.Border.Thickness);v.css("top","10px")}else v.css("height",i.Height-3*b.Border.Thickness);if(v.css("width",i.Width-3*b.Border.Thickness),v.css("background-color",b.BackGround.BackgroundColor),v.css("border-color",b.Border.BorderBrush),v.css("border-width",b.Border.Thickness),v.css("border-style",b.Border.BorderStyle),v.ejMap({layers:[{layerType:"geometry"}]}),w=v.data("ejMap"),w.model.zoomSettings.minValue=1,w.model.zoomSettings.level=1,w.model.zoomSettings.enableZoom=!1,w.model.centerPosition=[b.MapView.CenterX,b.MapView.CenterY],a.MapPolygonLayers&&a.MapPolygonLayers.length>0)for(nt=0;nt<a.MapPolygonLayers.length;nt++)s=a.MapPolygonLayers[nt],c=n.extend(!0,{},w.model.layers[0]),c.layerType="geometry",c.enableSelection=!1,c.enableMouseHover=!1,c.shapeData=s.MapFields,s.MapBindingFieldPairs&&(c.shapePropertyPath=s.MapBindingFieldPairs.FieldName),c.shapeDataPath="Value",c.dataSource=i.MapModelData,i.MapModelData&&i.MapModelData.length>0&&i.MapModelData[0].ShapeActionInfo&&(w.ejreportid=this._id,w.model.shapeSelected=this._drillThroughClick,c.enableSelection=!0,c.enableMouseHover=!0,w.model.mouseover=function(t){t.originalEvent.data&&t.originalEvent.data.ShapeActionInfo&&n(t.originalEvent.shape).css("cursor","pointer")}),s.ShapeSettings&&(d=n.extend(!0,{},c.shapeSettings),d.colorValuePath=s.ShapeSettings.ShapeColorValuePath,d.valuePath=s.ShapeSettings.ShapeValuePath,s.ShapeColorMappings&&s.ShapeColorMappings.length>1?d.colorMappings={equalColorMapping:s.ShapeColorMappings}:(d.autoFill=!0,d.colorPalette="palette1"),c.shapeSettings=d),s.MapCenterPointRules&&s.MapCenterPointRules.length>0&&s.MapCenterPointRules.MapSizeRule&&(g=n.extend(!0,{},c.bubbleSettings),g.maxValue=s.BubbleSettings.MaxSize,g.minValue=s.BubbleSettings.MinSize,g.colorValuePath=s.BubbleSettings.ColorValuePath==null?"Value":s.BubbleSettings.ColorValuePath,g.valuePath=s.BubbleSettings.ValuePath,s.BubbleColorMappings&&s.BubbleColorMappings.length>1&&(g.colorMappings={equalColorMapping:s.BubbleColorMappings}),c.bubbleSettings=g),s.MapPolygonTemplate&&(tt=n.extend(!0,{},c.labelSettings),tt.showLabels=!0,s.ShapeSettings&&(tt.labelPath=s.ShapeSettings.LabelPath),tt.enableSmartLabel=!1,c.labelSettings=tt),a.MapLegends&&a.MapLegends.length>0&&(ft=n.extend(!0,{},c.legendSettings),ft.showLegend=!0,c.legendSettings=ft),w.model.layers[nt]=c;w.refresh();v.css("position","relative")}},_renderGaugeControl:function(n,i,r,u,f,e,o,s){var h=n.GaugePanel,p,c,l,a,y,v,w,b,k;i&&(this._id=e,n.Top=0,n.Left=0);p=this._controlKeyGenerator(this._id+"_"+n.Name,e,o,s);c=t.buildTag("div","",{},{id:p});f.append(c);c.css("position","absolute");l=n.Height;a=n.Width;n.Top&&c.css("top",n.Top);n.Left&&c.css("left",n.Left);y="Horizontal";v=0;h.RadialGauges&&h.RadialGauges.length>0&&(v=v+h.RadialGauges.length);h.LinearGauges&&h.LinearGauges.length>0&&(v=v+h.LinearGauges.length);h.Indicator&&h.Indicator.length>0&&(v=v+h.Indicator.length);w=o?"PrintImage":"GetResource";h.GaugeFrame&&h.GaugeFrame.FrameImage&&c.css("background-image","url("+this.model.reportServiceUrl+"/"+w+"/?key="+h.GaugeFrame.FrameImage+"&resourcetype=sfimg&isPrint="+o+")");h.Border&&this._applyBorderStyle(h.Border,c);r&&(_parentID=e,l=u.height,b=parseFloat(c.css("border-left-width"),10)+parseFloat(c.css("border-right-width"),10),k=parseFloat(c.css("border-top-width"),10)+parseFloat(c.css("border-bottom-width"),10),a=a-b,l=l-k);v!=0&&(l>a?(l=l/v,y="Vertical"):a=a/v);h.GaugeLabel&&this._renderGaugeLabels(h.GaugeLabel,c,n.Name,e,o,s);h.RadialGauges&&h.RadialGauges.length>0&&this._renderRadialGauge(h.RadialGauges,c,n.Name,y,a,l,e,o,s);h.LinearGauges&&h.LinearGauges.length>0&&this._renderLinearGauge(h.LinearGauges,c,n.Name,y,a,l,e,o,s);h.Indicator&&h.Indicator.length>0&&this._renderIndicator(h.Indicator,c,n.Name,a,l,e,o,s);r?c.css({position:"relative",width:a,height:l,"background-color":h.BackgroundColor}):c.css({width:n.Width,height:n.Height,"background-color":h.BackgroundColor})},_renderIndicator:function(n,i,r,u,f,e,o,s){function c(n,t,i){var u=document.createElementNS(rt,t);for(var r in i)i.hasOwnProperty(r)&&u.setAttribute(r,i[r]);n.appendChild(u)}for(var k,rt="http://www.w3.org/2000/svg",ut=0;ut<n.length;ut++){var nt=document.createElementNS(rt,"svg"),h=document.createElementNS(rt,"g"),w=u<f?u:f,b=n[ut],ft=t.buildTag("div","",{width:u,height:f,top:"0px",left:"0px"},{id:this._controlKeyGenerator(this._id+"_"+r+"_"+b.Name,e,o,s),title:b.ToolTip}),p=t.buildTag("div","",{width:"20px",height:"20px",position:"relative",display:"block"});for(nt.setAttributeNS(null,"style","display: block;margin:auto"),k=0;k<b.IndicatorState.length;k++){var et=b.IndicatorState[k].IndicatorStyle,tt=b.IndicatorState[k].StartValue.Value,it=b.IndicatorState[k].EndValue.Value,ot=tt,st=it;if(tt>=it&&(tt=st,it=ot),b.IndicatorData.Value>=tt&&b.IndicatorData.Value<=it){var a=b.IndicatorState[k].FillColor,l="display: block;",y=17,v=17;switch(et){case"ArrowDown":c(h,"path",{fill:a,stroke:"lightgray",d:"M7.60501098632813,16.3990020751953L14.06298828125,10.0289993286133 10.3890075683594,10.0289993286133 10.3890075683594,2.32599639892578 4.61099243164063,2.32599639892578 4.61099243164063,10.0289993286133 1.14801025390625,10.0289993286133 7.60501098632813,16.3990020751953z"});y=16;v=19;l=l+"margin-left:.5px;";break;case"ArrowDownIncline":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.5499877929688,13.8919982910156L13.6119995117188,4.822998046875 11.0130004882813,7.42100524902344 5.5670166015625,1.9739990234375 1.48101806640625,6.05900573730469 6.92901611328125,11.5059967041016 4.47900390625,13.9550018310547 13.5499877929688,13.8919982910156z"});y=v=16;l=l+"margin-left:.5px;";break;case"ArrowSide":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.1960144042969,8.43499755859375L8.8280029296875,1.97899627685547 8.8280029296875,5.65299987792969 1.125,5.65299987792969 1.125,11.4300003051758 8.8280029296875,11.4300003051758 8.8280029296875,14.8919982910156 15.1960144042969,8.43499755859375z"});l=l+"margin-left:.5px;";break;case"ArrowUp":c(h,"path",{fill:a,stroke:"lightgray",d:"M7.27099609375,1.47299957275391L0.81500244140625,7.84200286865234 4.48800659179688,7.84200286865234 4.48800659179688,15.5439987182617 10.2659912109375,15.5439987182617 10.2659912109375,7.84200286865234 13.7279968261719,7.84200286865234 7.27099609375,1.47299957275391z"});y=16;l=l+"margin-left:.5px;";break;case"ArrowUpIncline":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.0830078125,2.04299926757813L4.0159912109375,1.98199462890625 6.61300659179688,4.58000183105469 1.16598510742188,10.0269927978516 5.25100708007813,14.1119995117188 10.697998046875,8.66499328613281 13.14599609375,11.1130065917969 13.0830078125,2.04299926757813z"});y=15;v=16;l=l+"margin-left:.5px;";break;case"BoxesAllFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});l=l+"margin-top:2.5px;";break;case"BoxesNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"BoxesOneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"BoxesThreeFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"BoxesTwoFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"});v=16;break;case"Circle":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});y=v=17;l=l+"margin-left:0.5px;";break;case"Flag":c(h,"path",{fill:a,stroke:"lightgray",d:"M1.53518676757813,1.97268676757813L1.71956861019135,1.87765264511108 2.22404956817627,1.65059661865234 3.90132141113281,1.14869689941406 5.98302745819092,1.16354370117188 6.99305105209351,1.58242082595825 7.88519287109375,2.39169311523438 9.55474090576172,4.09454298019409 11.1795692443848,5.14020156860352 12.5349636077881,5.63535928726196 13.3962097167969,5.68670654296875 13.5080919265747,5.78957939147949 13.3250951766968,6.16205215454102 12.1980743408203,7.28895568847656 10.2623682022095,8.2137336730957 9.06851482391357,8.33354949951172 7.76519775390625,8.08270263671875 5.64992141723633,7.59151554107666 4.50045776367188,7.73744964599609 4.02486801147461,8.11925792694092 3.93121337890625,8.335693359375 1.53518676757813,1.97268676757813z"});y=16;v=15;break;case"QuartersAllFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-left:0.5px;";break;case"QuartersNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-left:0.5px;";break;case"QuartersOneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M1.2958984375,8.71868896484375L1.864914894104,11.5364475250244 3.41652679443359,13.8374519348145 5.71757793426514,15.3888282775879 8.534912109375,15.9577026367188 11.353235244751,15.3888282775879 13.6545295715332,13.8374519348145 15.2060127258301,11.5364475250244 15.77490234375,8.71868896484375 15.2060127258301,5.90094757080078 13.6545295715332,3.59995269775391 11.353235244751,2.04858016967773 8.534912109375,1.47970581054688 5.71757793426514,2.04858016967773 3.41652679443359,3.59995269775391 1.864914894104,5.90094757080078 1.2958984375,8.71868896484375"});c(h,"path",{fill:a,d:"M8.57321166992188,1.86428833007813L11.3244533538818,2.38370847702026 13.4967041015625,3.80480575561523 14.9227085113525,5.96914529800415 15.4352111816406,8.71829223632813 15.5302124023438,8.7222900390625 8.57321166992188,8.7222900390625 8.57321166992188,1.86428833007813z"});l=l+"margin-top:0.5px;";break;case"QuartersThreeFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M16.033203125,9.3330078125L15.4643287658691,12.150749206543 13.9129524230957,14.4517440795898 11.6119480133057,16.003116607666 8.794189453125,16.5719909667969 5.97586584091187,16.003116607666 3.6745719909668,14.4517440795898 2.12308931350708,12.150749206543 1.55419921875,9.3330078125 2.12308931350708,6.51524877548218 3.6745719909668,4.2142448425293 5.97586584091187,2.66286897659302 8.794189453125,2.093994140625 11.6119480133057,2.66286897659302 13.9129524230957,4.2142448425293 15.4643287658691,6.51524877548218 16.033203125,9.3330078125"});c(h,"path",{fill:"white",d:"M8.75729370117188,2.4794921875L6.00546979904175,2.99834585189819 3.83292007446289,4.41925430297852 2.40680551528931,6.58378267288208 1.894287109375,9.33349609375 1.79928588867188,9.33648681640625 8.75729370117188,9.33648681640625 8.75729370117188,2.4794921875z"});l=l+"margin-top:0.5px;";break;case"QuartersTwoFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.1328125,8.3330078125L14.563796043396,11.150749206543 13.0121841430664,13.4517440795898 10.7111330032349,15.003116607666 7.893798828125,15.5719909667969 5.07547521591187,15.003116607666 2.7741813659668,13.4517440795898 1.22269868850708,11.150749206543 0.65380859375,8.3330078125 1.22269868850708,5.51524877548218 2.7741813659668,3.2142448425293 5.07547521591187,1.66286897659302 7.893798828125,1.093994140625 10.7111330032349,1.66286897659302 13.0121841430664,3.2142448425293 14.563796043396,5.51524877548218 15.1328125,8.3330078125"});c(h,"path",{fill:"white",d:"M7.81930541992188,1.45999145507813L5.0907883644104,1.99271726608276 2.95392227172852,3.42375564575195 1.56049299240112,5.59241724014282 1.06228637695313,8.3380126953125 1.57205629348755,11.0836029052734 2.99092483520508,13.252254486084 5.1532301902771,14.6832828521729 7.893310546875,15.2160034179688 7.81930541992188,1.45999145507813z"});l=l+"margin-top:0.5px;margin-left:0.5px;";break;case"SignalMeterFourFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterThreeFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterOneFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterTwoFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"});c(h,"path",{fill:a,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"});c(h,"path",{fill:"none",stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"});v=19;l=l+"margin-top:-10px;;margin-left:0.5px;";break;case"StarQuartersAllFilled":c(h,"path",{fill:a,stroke:"lightgray",d:"M6.41500854492188,6.37100219726563L1.56698608398438,7.07400512695313 5.07501220703125,10.4939880371094 4.24700927734375,15.3210144042969 8.58200073242188,13.0409851074219 12.9169921875,15.3210144042969 12.0899963378906,10.4939880371094 15.5979919433594,7.07400512695313 10.75,6.37100219726563 8.58200073242188,1.97698974609375 6.41500854492188,6.37100219726563z"});break;case"StarQuartersNoneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M6.41500854492188,6.37100219726563L1.56698608398438,7.07400512695313 5.07501220703125,10.4939880371094 4.24700927734375,15.3210144042969 8.58200073242188,13.0409851074219 12.9169921875,15.3210144042969 12.0899963378906,10.4939880371094 15.5979919433594,7.07400512695313 10.75,6.37100219726563 8.58200073242188,1.97698974609375 6.41500854492188,6.37100219726563z"});break;case"StarQuartersOneFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.64109802246094,1.97750854492188L10.80810546875,6.37149047851563 15.6560974121094,7.07449340820313 12.1490936279297,10.4945068359375 12.9761047363281,15.3204956054688 8.64109802246094,13.0404968261719 4.30610656738281,15.3204956054688 5.13409423828125,10.4945068359375 1.6260986328125,7.07449340820313 6.47309875488281,6.37149047851563 8.64109802246094,1.97750854492188z"});c(h,"path",{fill:a,stroke:"none",d:"M6.22300720214844,6.37100219726563L1.50100708007813,7.07400512695313 5.07099914550781,10.4939880371094 4.06300354003906,15.531005859375 7.08399963378906,13.864013671875 7.072998046875,4.968994140625 6.22300720214844,6.37100219726563z"});break;case"StarQuartersThreeFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.60209655761719,1.97750854492188L10.7691040039063,6.37149047851563 15.6170959472656,7.07449340820313 12.110107421875,10.4945068359375 12.9371032714844,15.3204956054688 8.60209655761719,13.0404968261719 4.26710510253906,15.3204956054688 5.0950927734375,10.4945068359375 1.58709716796875,7.07449340820313 6.43409729003906,6.37149047851563 8.60209655761719,1.97750854492188z"});c(h,"path",{fill:a,stroke:"none",d:"M6.40199279785156,6.37100219726563L1.58700561523438,7.07400512695313 5.11000061035156,10.4939880371094 4.28999328613281,15.3210144042969 8.49000549316406,13.0989990234375 10.6970062255859,14.27099609375 10.6970062255859,6.2239990234375 8.60200500488281,1.97698974609375 6.40199279785156,6.37100219726563z"});break;case"StarQuartersTwoFilled":c(h,"path",{fill:"none",stroke:"lightgray",d:"M8.17819213867188,1.97750854492188L10.34521484375,6.37149047851563 15.1932067871094,7.07449340820313 11.6861877441406,10.4945068359375 12.5132141113281,15.3204956054688 8.17819213867188,13.0404968261719 3.84320068359375,15.3204956054688 4.67120361328125,10.4945068359375 1.1632080078125,7.07449340820313 6.01019287109375,6.37149047851563 8.17819213867188,1.97750854492188z"});c(h,"path",{fill:a,stroke:"none",d:"M6.010009765625,6.37100219726563L1.16299438476563,7.07400512695313 4.67098999023438,10.4939880371094 3.84298706054688,15.3210144042969 7.83499145507813,13.2219848632813 7.90399169921875,2.53201293945313 6.010009765625,6.37100219726563z"});break;case"ThreeSignsCircle":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-top:1px;margin-left:0.5px;";break;case"ThreeSignsDiamond":c(h,"path",{fill:a,stroke:"lightgray",d:"M1.08401489257813,8.01901245117188L8.10400390625,15.1589965820313 15.2929992675781,8.01901245117188 8.10400390625,0.878997802734375 1.08401489257813,8.01901245117188z"});y=16;l=l+"margin-top:3px;margin-left:1px;";break;case"ThreeSignsTriangle":c(h,"path",{fill:a,stroke:"lightgray",d:"M0.83099365234375,14.2340087890625L15.7950134277344,14.2340087890625 8.31298828125,1.27499389648438 0.83099365234375,14.2340087890625z"});l=l+"margin-top:1px;";break;case"ThreeSymbolCheck":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M12.15869140625,4.38958740234375L11.3836975097656,3.86260986328125 10.7337036132813,3.98660278320313 6.94171142578125,9.57958984375 5.19769287109375,7.83660888671875 4.53570556640625,7.83660888671875 3.87469482421875,8.49859619140625 3.87469482421875,9.16061401367188 6.5546875,11.8416137695313 7.1536865234375,12.1086120605469 7.71771240234375,11.7735900878906 12.28369140625,5.03860473632813 12.15869140625,4.38958740234375"});l=l+"margin-top:1px;margin-left:0.5px;";break;case"ThreeSymbolCross":c(h,"path",{fill:a,stroke:"lightgray",d:"M1.10299682617188,7.94601440429688L1.66799592971802,10.7435569763184 3.20874404907227,13.0283813476563 5.49386739730835,14.569019317627 8.2919921875,15.1340026855469 8.2919921875,15.1340026855469 11.0901165008545,14.569019317627 13.3752403259277,13.0283813476563 14.9159889221191,10.7435569763184 15.4809875488281,7.94601440429688 15.4809875488281,7.94601440429688 14.9159889221191,5.14773225784302 13.3752403259277,2.86226272583008 11.0901165008545,1.32116842269897 8.2919921875,0.756011962890625 8.2919921875,0.756011962890625 5.49386739730835,1.32116842269897 3.20874404907227,2.86226272583008 1.66799592971802,5.14773225784302 1.10299682617188,7.94601440429688"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M10.0479125976563,7.94430541992188L11.9789123535156,6.0133056640625 11.9789123535156,5.31130981445313 10.9259033203125,4.25729370117188 10.222900390625,4.25729370117188 8.2908935546875,6.18930053710938 6.35989379882813,4.25729370117188 5.65689086914063,4.25729370117188 4.60488891601563,5.31130981445313 4.60488891601563,6.0133056640625 6.534912109375,7.94430541992188 4.60488891601563,9.87728881835938 4.60488891601563,10.5783081054688 5.65689086914063,11.6322937011719 6.35989379882813,11.6322937011719 8.2908935546875,9.70028686523438 10.2239074707031,11.6322937011719 10.9259033203125,11.6322937011719 11.9789123535156,10.5783081054688 11.9789123535156,9.87728881835938 10.0479125976563,7.94430541992188z"});l=l+"margin-top:3px;margin-left:1px;";break;case"ThreeSymbolExclamation":c(h,"path",{fill:a,stroke:"lightgray",d:"M0.983001708984375,7.94601440429688L1.54785919189453,10.7435569763184 3.08837127685547,13.0283813476563 5.37344741821289,14.569019317627 8.1719970703125,15.1340026855469 8.1719970703125,15.1340026855469 10.9699649810791,14.569019317627 13.2547416687012,13.0283813476563 14.7951431274414,10.7435569763184 15.3599853515625,7.94601440429688 15.3599853515625,7.94601440429688 14.7951431274414,5.14773225784302 13.2547416687012,2.86226272583008 10.9699649810791,1.32116842269897 8.1719970703125,0.756011962890625 8.1719970703125,0.756011962890625 5.37344741821289,1.32116842269897 3.08837127685547,2.86226272583008 1.54785919189453,5.14773225784302 0.983001708984375,7.94601440429688"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M7.59280395507813,9.60159301757813L8.71978759765625,9.60159301757813 9.00180053710938,9.60159301757813 9.12579345703125,2.8916015625 7.143798828125,2.8916015625 7.31280517578125,9.60159301757813 7.59280395507813,9.60159301757813z"});c(h,"path",{fill:"white",stroke:"lightgray",d:"M8.96728515625,10.69140625L8.17428588867188,10.3753967285156 7.37130737304688,10.6924133300781 7.03228759765625,11.4764099121094 7.37530517578125,12.244384765625 8.17428588867188,12.54541015625 8.96328735351563,12.244384765625 9.310302734375,11.4764099121094 8.96728515625,10.69140625"});l=l+"margin-top:3px;margin-left:1px;";break;case"ThreeSymbolUnCircledCheck":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.8515930175781,2.2255859375L12.6495971679688,1.402587890625 12.1062202453613,1.29134368896484 11.6416015625,1.59561157226563 5.755615234375,10.32958984375 3.04959106445313,7.60760498046875 2.53897094726563,7.39609527587891 2.02459716796875,7.60760498046875 0.997589111328125,8.64260864257813 0.785346984863281,9.15935516357422 0.997589111328125,9.6776123046875 5.1575927734375,13.8635864257813 6.0845947265625,14.2785949707031 6.96060180664063,13.755615234375 14.0445861816406,3.2406005859375 14.1565895080566,2.69297027587891 13.8515930175781,2.2255859375"});y=v=16;l=l+"margin-top:3px;margin-left:.5px;";break;case"ThreeSymbolUnCircledCross":c(h,"path",{fill:a,stroke:"lightgray",d:"M9.36907958984375,6.86331176757813L12.423095703125,3.71530151367188 12.6540832519531,3.14280700683594 12.423095703125,2.5703125 10.7581176757813,0.851287841796875 10.2026062011719,0.613548278808594 9.6470947265625,0.851287841796875 6.59613037109375,4.00131225585938 3.5421142578125,0.851287841796875 2.98759841918945,0.613548278808594 2.43310546875,0.851287841796875 0.768096923828125,2.5703125 0.537109375,3.14205169677734 0.768096923828125,3.71530151367188 3.82012939453125,6.86331176757813 0.768096923828125,10.0133056640625 0.537109375,10.5845413208008 0.768096923828125,11.1572875976563 2.43310546875,12.8763122558594 2.98723220825195,13.1140518188477 3.5421142578125,12.8763122558594 6.59613037109375,9.72628784179688 9.6480712890625,12.8763122558594 10.2027282714844,13.1140518188477 10.7581176757813,12.8763122558594 12.423095703125,11.1572875976563 12.6540832519531,10.5845413208008 12.423095703125,10.0133056640625 9.36907958984375,6.86331176757813z"});y=v=16;l=l+"margin-top:5px;margin-left:1.5px;";break;case"ThreeSymbolUnCircledExclamation":c(h,"path",{fill:"none",stroke:"none",d:"M0.983001708984375,7.94601440429688L1.54785919189453,10.7435569763184 3.08837127685547,13.0283813476563 5.37344741821289,14.569019317627 8.1719970703125,15.1340026855469 8.1719970703125,15.1340026855469 10.9699649810791,14.569019317627 13.2547416687012,13.0283813476563 14.7951431274414,10.7435569763184 15.3599853515625,7.94601440429688 15.3599853515625,7.94601440429688 14.7951431274414,5.14773225784302 13.2547416687012,2.86226272583008 10.9699649810791,1.32116842269897 8.1719970703125,0.756011962890625 8.1719970703125,0.756011962890625 5.37344741821289,1.32116842269897 3.08837127685547,2.86226272583008 1.54785919189453,5.14773225784302 0.983001708984375,7.94601440429688"});c(h,"path",{fill:a,stroke:"none",d:"M7.59280395507813,9.60159301757813L8.71978759765625,9.60159301757813 9.00180053710938,9.60159301757813 9.12579345703125,2.8916015625 7.143798828125,2.8916015625 7.31280517578125,9.60159301757813 7.59280395507813,9.60159301757813z"});c(h,"path",{fill:a,stroke:"none",d:"M8.96728515625,10.69140625L8.17428588867188,10.3753967285156 7.37130737304688,10.6924133300781 7.03228759765625,11.4764099121094 7.37530517578125,12.244384765625 8.17428588867188,12.54541015625 8.96328735351563,12.244384765625 9.310302734375,11.4764099121094 8.96728515625,10.69140625"});l=l+"margin-top:1px;margin-left:1px;";break;case"TrafficLight":c(h,"path",{fill:"black",stroke:"lightgray",d:"M3.83200073242188,1.46800231933594L2.76542282104492,1.68336224555969 1.89412689208984,2.27062797546387 1.3065185546875,3.14157843589783 1.09100341796875,4.20799255371094 1.09100341796875,4.20799255371094 1.09100341796875,13.3419952392578 1.3065185546875,14.4091548919678 1.89412689208984,15.2807502746582 2.76542282104492,15.8684692382813 3.83200073242188,16.0839996337891 3.83200073242188,16.0839996337891 12.9670104980469,16.0839996337891 14.0340003967285,15.8684692382813 14.9052505493164,15.2807502746582 15.4926300048828,14.4091548919678 15.7080078125,13.3419952392578 15.7080078125,13.3419952392578 15.7080078125,4.20799255371094 15.4926300048828,3.14157843589783 14.9052505493164,2.27062797546387 14.0340003967285,1.68336224555969 12.9670104980469,1.46800231933594 12.9670104980469,1.46800231933594 3.83200073242188,1.46800231933594z"});c(h,"path",{fill:a,d:"M3.78421020507813,8.77540588378906L4.14698934555054,6.97894716262817 5.13620376586914,5.51202392578125 6.60316896438599,4.52304029464722 8.39920043945313,4.160400390625 10.1958141326904,4.52304029464722 11.6630783081055,5.51202392578125 12.6524028778076,6.97894716262817 13.0151977539063,8.77540588378906 12.6524028778076,10.5718555450439 11.6630783081055,12.0387744903564 10.1958141326904,13.027756690979 8.39920043945313,13.3903961181641 6.60316896438599,13.027756690979 5.13620376586914,12.0387744903564 4.14698934555054,10.5718555450439 3.78421020507813,8.77540588378906"});y=v=18;l=l+"margin-top:3px;margin-left:.5px;";break;case"TrafficLightUnrimmed":c(h,"path",{fill:a,stroke:"lightgray",d:"M15.3310852050781,8.3330078125L14.7622108459473,11.150749206543 13.2108383178711,13.4517440795898 10.9098434448242,15.003116607666 8.09210205078125,15.5719909667969 5.27377843856812,15.003116607666 2.97248458862305,13.4517440795898 1.42100191116333,11.150749206543 0.85211181640625,8.3330078125 1.42100191116333,5.51524877548218 2.97248458862305,3.2142448425293 5.27377843856812,1.66286897659302 8.09210205078125,1.093994140625 10.9098434448242,1.66286897659302 13.2108383178711,3.2142448425293 14.7622108459473,5.51524877548218 15.3310852050781,8.3330078125"});l=l+"margin-top:3px;margin-left:.5px;";break;case"TriangleDash":c(h,"path",{fill:a,stroke:"lightgray",d:"M13.9800109863281,7.56300354003906L0.501007080078125,7.56300354003906 0.501007080078125,4.67400360107422 13.9800109863281,4.67400360107422 13.9800109863281,7.56300354003906z"});y=15;v=9;break;case"TriangleDown":c(h,"path",{fill:a,stroke:"lightgray",d:"M14.06201171875,0.788002014160156L7.60501098632813,7.15699768066406 1.14801025390625,0.788002014160156 14.06201171875,0.788002014160156z"});y=15;v=9;l=l+"margin-top:3px;margin-left:.5px;";break;case"TriangleUp":c(h,"path",{fill:a,stroke:"lightgray",d:"M0.89599609375,7.30400085449219L7.35198974609375,0.93499755859375 13.8089904785156,7.30400085449219 0.89599609375,7.30400085449219z"});y=15;v=9;l=l+"margin-top:3px;margin-left:.5px;"}p.css({width:y+"px",height:v+"px"});nt.setAttributeNS(null,"style",l);nt.appendChild(h);break}}p.append(nt);ft.append(p);i.append(ft);var d=p.width(),g=p.height(),ht=d<g?d:g;w=w/ht;this._browserInfo.name=="msie"?p.css("transform","scale("+w+","+w+")"):this._browserInfo.name=="opera"?p.css("-o-transform","scale("+w+","+w+")"):this._browserInfo.name=="mozilla"?p.css("-ms-transform","scale("+w+","+w+")"):(this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome")&&p.css("-webkit-transform","scale("+w+","+w+")");d<g?p.css({left:"50%","margin-left":-(d/2),top:"50%","margin-top":-(d/2)}):p.css({left:"50%","margin-left":-(g/2),top:"50%","margin-top":-(g/2)})}},_renderGaugeLabels:function(n,i,r,u,f,e){for(var o,c,s,h=0;h<n.length;h++)o=n[h],c=t.buildTag("div","",{},{id:this._controlKeyGenerator(this._id+"_"+r+"_"+o.Name,u,f,e),title:o.ToolTip}),c.css({position:"absolute",top:o.Top,left:o.Left,width:o.length+10,height:o.Height+10,"background-color":o.BackgroundColor,"border-color":o.Style.BorderColor,"border-style":o.Style.BorderStyle,"border-width":o.Style.BorderWidth}),s=document.createElement("span"),s.innerHTML=o.Text,s.style.fontFamily=o.Font.FontFamily,s.style.fontSize=o.Font.FontSize,s.style.fontStyle=o.Font.FontStyle,s.style.fontWeight=o.Font.FontWeight,s.style.textAlign=o.TextAlign,s.style.color=o.TextColor,s.style.textDecoration=o.TextDecoration,c.append(s),i.append(c)},_renderRadialGauge:function(i,r,u,f,e,o,s,h,c){for(var lt,v,at,ot,ut,ft,a,l,vt,yt,ht,p,y,pt,wt,ct,w,k,et,it,st=0;st<i.length;st++){var d=i[st],g=d.GaugeFrame,rt=t.buildTag("div","",{},{id:this._controlKeyGenerator(this._id+"_"+u+"_"+d.Name,s,h,c),title:d.ToolTip});if(r.append(rt),rt.ejCircularGauge(),lt=h?"PrintImage":"GetResource",g.FrameImage&&rt.css("background-image","url("+this.model.reportServiceUrl+"/"+lt+"/?key="+g.FrameImage+"&resourcetype=sfimg&isPrint="+h+")"),v=rt.data("ejCircularGauge"),at=v.model.scales[0],v.model.scales.pop(v.model.scales[0]),ot=e<o?e/2-g.FrameWidth:o/2-g.FrameWidth,v.model.radius=ot,v.model.width=e,v.model.height=o,v.model.backgroundColor=d.BackgroundColor,v.model.enableAnimation=!1,d.ScaleProperties&&d.ScaleProperties.length>0)for(ut=d.ScaleProperties.length,ft=0;ft<ut;ft++){if(a=d.ScaleProperties[ft],l=n.extend(!0,{},at),l.radius=ot*((ut-ft)/ut)-g.FrameWidth,l.startAngle=a.StartAngle+90,l.sweepAngle=a.SweepAngle,l.showRanges=!0,l.showScaleBar=!0,l.maximum=a.Maximum,l.minimum=a.Minimum,l.border.color=a.BorderColor,l.border.width=a.BorderWidth,l.showPointers=!0,l.showTicks=!0,l.showLabels=!0,l.showIndicators=!0,l.backgroundColor=a.ScaleWidth==0?"Transparent":a.BackgroundColor,l.shadowOffset=a.ShadowOffset,a.ScaleInterval!=0?l.majorIntervalValue=a.ScaleInterval:(l.majorIntervalValue=Math.round((l.maximum-l.minimum)/10),l.minorIntervalValue=Math.round(l.majorIntervalValue/4)),a.RadialPointer&&a.RadialPointer.length>0)for(vt=l.pointers[0],l.pointers.pop(l.pointers[0]),yt=a.RadialPointer.length,ht=0;ht<yt;ht++){p=n.extend(!0,{},vt);y=a.RadialPointer[ht];p.value=y.Value;p.length=ot*((ut-ft)/ut)-30;p.backgroundColor=y.BackgroundColor;p.type=y.Type=="Needle"?"needle":"marker";p.showBackNeedle=!1;p.width=y.Width;p.border.width=y.BorderWidth;p.border.color=y.BorderColor;switch(y.NeedleStyle){case"Rectangular":p.needleType="rectangle";break;case"Arrow":p.needleType="arrow";break;default:p.needleType="triangle"}p.markerType=y.MarkerStyle=="wedge"||y.MarkerStyle=="triangle"||y.MarkerStyle=="circle"||y.MarkerStyle=="diamond"||y.MarkerStyle=="pentagon"||y.MarkerStyle=="trapezoid"?y.MarkerStyle.toLowerCase():"rectangle";p.distanceFromScale=y.distanceFromScale;l.pointerCap.backgroundColor=y.CapBackGroundColor;l.pointerCap.radius=y.CapRadius/3;l.pointers.push(p)}else l.pointers=[];if(a.Range&&a.Range.length>0)for(pt=l.ranges[0],l.ranges.pop(l.ranges[0]),wt=a.Range.length,ct=0;ct<wt;ct++)w=n.extend(!0,{},pt),k=a.Range[ct],w.distanceFromScale=k.DistanceFromScale,w.backgroundColor=k.BackgroundColor,k.EndValue==0&&k.StartValue==0?(w.startValue=70,w.endValue=100):(w.startValue=k.StartValue,w.endValue=k.EndValue),w.startWidth=k.StartWidth,w.endWidth=k.EndWidth,w.border.color=k.BorderColor,w.border.width=k.BorderWidth,l.ranges.push(w);else l.ranges=[];var b=a.TickMark,nt=l.ticks[0],tt=l.ticks[1];l.ticks.pop(l.ticks[0]);l.ticks.pop(l.ticks[1]);b.MajorTickHide||(nt.type="major",nt.width=b.MajorTickWidth+1,nt.distanceFromScale=b.MajorTickDistanceFromScale,nt.height=b.MajorTickLength-2,nt.color=b.MajorTickColor==null?"black":b.MajorTickColor,nt.placement="near",l.ticks.push(nt));b.MinorTickHide||(tt.type="minor",tt.width=b.MinorTickWidth,tt.distanceFromScale=b.MinorTickDistanceFromScale,tt.height=b.MinorTickLength-1,tt.color=b.MinorTickColor==null?"black":b.MinorTickColor,tt.placement="near",l.ticks.push(tt));et=a.Label;it=l.labels[0];l.labels.pop(l.labels[0]);it.font.fontFamily=et.FontFamily;it.font.size=et.FontSize;it.font.fontStyle=et.FontStyle;it.distanceFromScale=et.DistanceFromScale;it.color=et.Color;l.labels.push(it);l.indicators=null;v.model.scales.push(l)}v.refresh();v.contextEl.beginPath();v.contextEl.arc(e/2,o/2,ot,0,2*Math.PI,!1);v.contextEl.fillStyle="transparent";v.contextEl.fill();v.contextEl.lineWidth=g.FrameWidth;v.contextEl.strokeStyle=g.FrameColor!=null?g.FrameColor:"Transparent";v.contextEl.stroke();v.contextEl.closePath();h&&(rt.append("<img src="+v.contextEl.canvas.toDataURL("image/png")+" width=100% height=100%/>"),n(v.contextEl.canvas).remove());rt.css({width:e,height:o,float:f=="Horizontal"?"left":"top"})}},_renderLinearGauge:function(i,r,u,f,e,o,s,h,c){for(var y,ct,v,lt,at,ot,a,l,ht,vt,ut,w,k,yt,pt,st,b,d,it,nt,rt=0;rt<i.length;rt++){y=i[rt];rt%2!=0&&(ct=t.buildTag("div","",{width:f=="Horizontal"?"3px":e-p.FrameWidth*2,float:f=="Horizontal"?"left":"top",height:f=="Horizontal"?o-p.FrameWidth*2:"3px"},{}),r.append(ct));var p=y.GaugeFrame,tt=t.buildTag("div","",{},{id:this._controlKeyGenerator(this._id+"_"+u+"_"+y.Name,s,h,c),title:y.ToolTip}),wt=h?"PrintImage":"GetResource";if(p.FrameImage&&tt.css("background-image","url("+this.model.reportServiceUrl+"/"+wt+"/?key="+p.FrameImage+"&resourcetype=sfimg&isPrint="+h+")"),r.append(tt),tt.ejLinearGauge(),v=tt.data("ejLinearGauge"),lt=v.model.scales[0],v.model.scales.pop(v.model.scales[0]),v.model.width=e-p.FrameWidth*2,v.model.height=o-p.FrameWidth*2,v.model.enableAnimation=!1,v.model.backgroundColor=y.BackgroundColor,v.model.orientation=y.Orientation,v.model.orientation=y.Orientation=="Horizontal"?y.Orientation:y.Orientation=="Vertical"?y.Orientation:e>o?"Horizontal":"Vertical",y.ScaleProperties&&y.ScaleProperties.length>0){for(at=y.ScaleProperties.length,ot=0;ot<at;ot++){if(a=y.ScaleProperties[ot],l=n.extend(!0,{},lt),l.maximum=a.Maximum,l.minimum=a.Minimum,l.length=v.model.orientation=="Horizontal"?e/100*85:o/100*85,l.border.color=a.BorderColor,l.border.width=a.BorderWidth,l.backgroundColor=a.BackgroundColor,l.shadowOffset=a.ShadowOffset,l.width=v.model.orientation=="Vertical"?v.model.width/4:v.model.height/4,a.PointerType&&a.PointerType=="thermometer"&&(l.type=a.PointerType),a.LinearPointer&&a.LinearPointer.length>0)for(a.PointerType!="thermometer"?(ht=n.extend(!0,{},l.markerPointers[0]),l.markerPointers.pop(l.markerPointers[0])):(ht=n.extend(!0,{},l.barPointers[0]),l.barPointers.pop(l.barPointers[0])),vt=a.LinearPointer.length,ut=0;ut<vt;ut++)w=n.extend(!0,{},ht),k=a.LinearPointer[ut],w.value=k.MarkerValue,w.length=k.MarkerLength,w.backgroundColor=k.MarkerBackgroundColor,w.width=k.MarkerWidth,w.border.width=k.MarkerBorderWidth,w.border.color=k.MarkerBorderColor,w.type=k.MarkerStyle.toLowerCase(),w.distanceFromScale=k.MarkerDistanceFromScale,a.PointerType!="thermometer"?l.markerPointers.push(w):(l.showBarPointers=!0,l.barPointers.push(w),l.markerPointers[ut].opacity=0);else l.markerPointers=[],l.barPointers=[];if(a.Range&&a.Range.length>0)for(yt=n.extend(!0,{},l.ranges[0]),l.ranges.pop(l.ranges[0]),pt=a.Range.length,st=0;st<pt;st++)b=n.extend(!0,{},yt),d=a.Range[st],b.distanceFromScale=d.DistanceFromScale,b.backgroundColor=d.BackgroundColor,b.startValue=d.StartValue,b.startWidth=d.StartWidth,b.endValue=d.EndValue,b.endWidth=d.EndWidth,b.border.color=d.BorderColor,b.border.width=d.BorderWidth,l.ranges.push(b);else l.ranges=[];var g=a.TickMark,ft=l.ticks[0],et=l.ticks[1];l.ticks.pop(l.ticks[0]);l.ticks.pop(l.ticks[1]);ft.type="majorInterval";ft.width=g.MajorTickWidth;ft.height=g.MajorTickLength/2;ft.color=g.MajorTickColor==null?"black":g.MajorTickColor;l.ticks.push(ft);et.type="minorInterval";et.width=g.MinorTickWidth;et.height=g.MinorTickLength*2;et.color=g.MinorTickColor==null?"black":g.MinorTickColor;l.ticks.push(et);it=a.Label;nt=l.labels[0];l.labels.pop(l.labels[0]);nt.font.fontFamily=it.LinearLabelFontFamily;nt.font.size=it.LinearLabelFontSize;nt.font.fontStyle=it.LinearLabelFontStyle;nt.distanceFromScale=it.LinearLabelDistanceFromScale;nt.textColor=it.TextColor;l.labels.push(nt);l.indicators=null;l.customLabels=[];v.model.scales.push(l)}v.refresh();h&&(tt.append("<img src="+v.contextEl.canvas.toDataURL("image/png")+" width=100% height=100%/>"),n(v.contextEl.canvas).remove());tt.css({width:f=="Horizontal"?e-p.FrameWidth*2-3:e-p.FrameWidth*2,height:f=="Horizontal"?o-p.FrameWidth*2:o-p.FrameWidth*2-3,float:f=="Horizontal"?"left":"top","border-color":p.FrameColor!=null?p.FrameColor:"Transparent","border-width":p.FrameWidth,"border-style":"solid","background-color":y.BackgroundColor})}}},_renderLineControl:function(n,i,r,u){var l="http://www.w3.org/2000/svg",a=this._controlKeyGenerator(this._id+"_"+n.Name,i,r,u),c=t.buildTag("div","",{},{id:a}),s={},h,f,e,o;return s.position="absolute",s.top=n.Top,s.left=n.Left,s.width=n.Width==0?"11.00064":n.Width,s.height=n.Height==0?"16.00128":n.Height,c.css(s),this._svg?(h=document.createElementNS(l,"svg"),h.setAttributeNS(null,"width",n.Width==0?"11.00064":n.Width),h.setAttributeNS(null,"height",n.Height==0?"16.00128":n.Height),f=document.createElementNS(l,"line"),f.setAttributeNS(null,"x1",n.X1==0?n.LineWidth:n.X1-n.LineWidth),f.setAttributeNS(null,"y1",n.Y1==0?n.LineWidth:n.Y1-n.LineWidth),f.setAttributeNS(null,"x2",n.X2==0?n.LineWidth:n.X2-n.LineWidth),f.setAttributeNS(null,"y2",n.Y2==0?n.LineWidth:n.Y2-n.LineWidth),f.setAttributeNS(null,"stroke",n.LineColor),f.setAttributeNS(null,"stroke-width",n.LineWidth),f.setAttributeNS(null,"shape-rendering","crispEdges"),n.LineStyle=="Dashed"?f.setAttributeNS(null,"stroke-dasharray",""+n.LineWidth*2+","+n.LineWidth*2+""):n.LineStyle=="Dotted"&&f.setAttributeNS(null,"stroke-dasharray",n.LineWidth),h.appendChild(f),c.append(h)):(document.namespaces.add("v","urn:schemas-microsoft-com:vml"),document.createStyleSheet().cssText="v\\:fill, v\\:path, v\\:polyline, v\\:line, v\\:rect,v\\:shape,v\\:oval, v\\:stroke{ behavior:url(#default#VML); display: inline-block; } ",e=document.createElement("<v:line id='line' from='"+n.X1+","+n.Y1+"' to='"+n.X2+","+n.Y2+"' strokecolor='"+n.LineColor+"' strokeweight='"+n.LineWidth+"pt'><v:stroke dashstyle='dot'><\/v:stroke><\/v:line>"),o=document.createElement("v:stroke"),n.LineStyle=="Dotted"?o.setAttribute("dashstyle","dot"):n.LineStyle=="Dashed"?o.setAttribute("dashstyle","dash"):o.setAttribute("dashstyle","solid"),o.outerHTML=o.outerHTML,e.appendChild(o),e.style.position="absolute",e.style.width=n.Width,e.style.height=n.Height,e.style.visibility="visible",c.append(e)),c},_renderSubReportControl:function(n,i,r,u,f,e){var h=this._controlKeyGenerator(this._id+"_"+n.Name,u,f,e),o=t.buildTag("div","",{},{id:h,title:n.ToolTip}),c,s,l,a;if(r.append(o),o.css("position",i?"relative":"absolute"),o.css("top",n.Top),o.css("left",n.Left),o.css("width",n.Width),o.css("height",n.Height),o.css("background-color",n.BackgroundColor),n.Padding&&(n.Padding.Left&&o.css("padding-left",n.Padding.Left),n.Padding.Right&&o.css("padding-right",n.Padding.Right),n.Padding.Top&&o.css("padding-top",n.Padding.Top),n.Padding.Bottom&&o.css("padding-bottom",n.Padding.Bottom)),n.Style&&(n.Style.Font&&(n.Style.Font.FontFamily&&o.css("font-family",n.Style.Font.FontFamily),n.Style.Font.FontSize&&o.css("font-size",n.Style.Font.FontSize),n.Style.Font.FontStyle&&o.css("font-style",n.Style.Font.FontStyle),n.Style.Font.FontWeight&&o.css("font-weight",n.Style.Font.FontWeight)),o.css("color",n.Style.TextColor?n.Style.TextColor:"black"),n.Style.TextDecoration&&o.css("text-decoration",n.Style.TextDecoration)),n.LineHeight&&o.css("line-height",n.LineHeight),n.TextAlign&&o.css("text-align",n.TextAlign),n.VerticalAlign&&o.css("vertical-align",n.VerticalAlign),n.Border&&!i&&this._applyBorderStyle(n.Border,o),n.ReportItemModels&&n.ReportItemModels.length>0)for(c=0;c<n.ReportItemModels.length;c++)s=n.ReportItemModels[c],s&&(s.ItemType=="TextBoxModel"?(l=this._renderTextBoxControl(s,!1,h+"_"+s.Name,f,e),o.append(l)):s.ItemType=="LineModel"?(a=this._renderLineControl(s,h+"_"+s.Name,f,e),o.append(a)):s.ItemType=="ImageModel"?this._renderImageControl(s,!1,o,h+"_"+s.Name,f,e):s.ItemType=="TablixModel"?this._renderTablixControl(s,!1,{},o,h+"_"+s.Name,e):s.ItemType=="GaugeModel"?this._renderGaugeControl(s,!1,!1,{},o,h+"_"+s.Name,f,e):s.ItemType=="RectangleModel"?this._renderRectangleControl(s,!1,o,h+ +'_'+s.Name,f,e):s.ItemType=="ChartModel"?this._renderChartControl(s,!1,!1,{},o,h+"_"+s.Name,f,e):s.ItemType=="MapModel"?this._renderMapControl(s,!1,o,h+"_"+s.Name,f,e):s.ItemType=="SubReportModel"&&this._renderSubReportControl(s,!1,o,h+ +'_'+s.Name,f,e))},doAjaxPost:function(t,i,r,u){var f=this,e=u,o=[],s=[],c,h;if(f._onAjaxRequest({headerReq:o,jsonArray:s,inVokemethod:u}),s.length>0){for(c=jQuery.parseJSON(r),h=0;h<s.length;h++)c[s[h].Key]=s[h].Value;r=JSON.stringify(c)}n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,beforeSend:function(n){if((e=="_getPageModel"||e=="_getPreviewModel")&&(f._isToolbarClick?f._showNavigationIndicator(!0):f._showloadingIndicator(!0)),n.setRequestHeader("ejAuthenticationToken",f._authenticationToken),o.length>0)for(var t=0;t<o.length;t++)n.setRequestHeader(o[t].Key,o[t].Value);f.model.reportServerId&&n.setRequestHeader("ejServerInstance",f.model.reportServerId)},success:function(n){if(n&&typeof n.Data!="undefined"&&(n=n.Data),typeof n=="string"&&n.indexOf("Sf_Exception")!=-1){f._renderExcpetion(e+":"+n);return}typeof n=="object"&&f._onAjaxSuccess(n);f[e](n)},error:function(n){if(e!="_clearCurrentServerCache"){if(n.readyState==0)return;f._onAjaxFailure(n);alert("Exception"+n.responseText)}}})},_reportLoaded:function(n){var t;typeof n=="object"&&n.isReportLoad?n?(this._reportParameters=n.parameters,this._reportDataSources=n.dataSources,this._reporDataSets=n.dataSets,this._machineCulture=n.currentCulture,this._onReportLoaded(),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")):(this._renderExcpetion("Could not load the report"),t=this._onReportError({errmsg:"Could not load the report"}),this._showExceptionResult(t,"Could not load the report")):(this._renderExcpetion("Report Loaded:"+n),t=this._onReportError({errmsg:"Report Loaded:"+n,innerMessage:n}),this._showExceptionResult(t,"Report Loaded:"+n))},_getDataSourceCredential:function(n){t.isNullOrUndefined(n)||n=="Sf_legacy"?this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.updateDataSource}),"_updateDataSource"):(this._renderCredentialBlock(n),this._showViewerBlock(!0));this._showloadingIndicator(!1);this._setContainerSize();this._showloadingIndicator(!0)},_validateDSCredential:function(n){n=="Sf_legacy"?(this._showloadingIndicator(!1),this._showViewerBlock(!1),this._setContainerSize(),this._showloadingIndicator(!0),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.updateDSCredential,datasoures:this._dataSources}),"_updateDSCredential"),this._dataSources=null,this._unwiredViewClickEvent()):alert(n)},_updateDSCredential:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.updateDataSource}),"_updateDataSource")},_getParameters:function(n){var t,i;n!="Sf_legacy"?(t=this._renderParameterBlock(n),t?(this._setContainerSize(),this._getDefaultParameters(n)):(this._showViewerBlock(!0),this._showloadingIndicator(!1),this._setContainerSize(),this._showloadingIndicator(!0),i=this._getParameterJson(n,!1),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:i}),"_setParameters"))):(this._showParameterBlock(!1),this._isForwardDirection=!0,this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_setParameters:function(t){var i=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcontent table:first").attr("isviewclick");typeof t=="boolean"&&(t==!1?(this._showloadingIndicator(!0),this._setContainerSize(),this._isDevice&&(this._showViewerBlock(!1),this._showViewerPage(!0),this._selectparamToolItem(!1)),this._currentPage=1,this._clearPageCache(),this._isForwardDirection=!0,this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")):(this._showloadingIndicator(!1),i=="true"&&(this._viewReportEnableDisable(!1),alert("Please select the parameter values."))))},_updateParameters:function(n){n!="Sf_legacy"&&this._updateParamElements(n)},_updateDataSource:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getParameters}),"_getParameters")},_getPageModel:function(n){var t=n,i;if(this._showNavigationIndicator(!1),this._showloadingIndicator(!1),this._viewReportEnableDisable(!1),t){if(t==="IsDrillDown"||t==="IsSorting")return;t.isDocumentMap&&(this._isDocumentMap=this._isPageDocMap=t.isDocumentMap);t.errmsg&&t.errmsg.length>0?(i=this._onReportError({errmsg:t.errmsg}),this._showExceptionResult(i,t.errmsg)):this._resetExceptionBlock();t.pgmodel&&t.pgmodel.PageData&&(this._pageModel=t.pgmodel,this._isToolbarClick||this._enableToolbarItems(),this._onRenderingBegin(),this._gotoPage(this._currentPage),this._pageLayoutPage=this._currentPage,this._onRenderingComplete(),this._refresh=!1,this._dataRefresh=!1);t.pgsetting&&this._updatePageSetup(t.pgsetting);(this.model.enablePageVirtualization||this.model.enablePageCache)&&(this._storePageCache(this._currentPage),this._renderPages())}},_getPreviewModel:function(n){this._showNavigationIndicator(!1);this._showloadingIndicator(!1);n&&(n.isDocumentMap&&(this._isDocumentMap=n.isDocumentMap,this._isPageDocMap=this._isDocumentMap,this._pageDocMapFlag=!1),n.pgmodel&&n.pgmodel.PageData&&(this._pageModel=n.pgmodel,this._isToolbarClick||(this._selectPreviewToolItem(!0),this._enableToolbarItems()),this._gotoPage(this._currentPage),this._refresh=!1,this._initialPageSetup(n)),(this.model.enablePageVirtualization||this.model.enablePageCache)&&(this._storePageCache(this._currentPage),this._renderPages()))},_getPrintModel:function(n){n&&n.PageData&&n.PageData.length>0&&(this.model.printOption=="None"?this._renderSilentPrinting(n):this._printReport(n))},_documentMapModel:function(n){n&&n.indexOf("<ul id=treeViewID>")!=-1&&(this._showDocumentMap(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.DocumentMap),this._containerSplit(n))},_drillThroughModel:function(t){var r={x:n("#"+this._id+"_viewerContainer").scrollLeft(),y:n("#"+this._id+"_viewerContainer").scrollTop()},i=this._cloneReportViewerProperties();this._parents.push({pagePos:r,parentPro:i});this._setInitialization();this._authenticationToken=i._childReportAuthentication;this._unwireEvents();this._initViewer();this._reportLoaded(t)},_gotoParentReportModel:function(){this._setParentReportViewerProperties();var n=this._currentPage;this._unwireEvents();this._initViewer();this._currentPage=n;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getParameters}),"_getParameters")},_clearCurrentServerCache:function(){},_print:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPrintModel}),"_getPrintModel")},_printReport:function(i){var u=i,c=u.PaperHeight,e=u.PaperWidth,w=u.MarginTop,b=u.MarginLeft,k=n("head").find("link"),l=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version)<=9,r=this.model.printOption=="Default"?window.open("","pint","tabbar=no,scrollbars = yes,resizable = yes"):window.open("","_blank"),a="<style>h1 {display:block;height:0px;page-break-after:always;}@page { size:"+e+"px "+c+"px; margin:0px;}@media print{ div {-webkit-print-color-adjust: exact;} #header, #footer { display:none } }<\/style>",v=!0,o,s,f,h,y,p;if(r!=null){for(r.document.write("<!DOCTYPE html>"),r.printDelay=500,v=this._onReportPrint({printWind:r,isStyleLoad:!0}),o=this._browserInfo.name==="msie"?'<body style="width:'+e+'px">':"<body>",v?(s="",k.each(function(t,i){n(i).attr("href",i.href);s+=i.outerHTML}),r.document.write("<html><head>"+s+a+"<\/head>"+o)):r.document.write("<html><head>"+a+"<\/head>"+o),f=0;f<u.TotalPages;f++)h=u.PageData[f],t.isNullOrUndefined(h)||(r.document.write('<div style="position:relative;height:'+c+"px;width:"+e+"px;"+(this._browserInfo.name=="mozilla"?"page-break-inside:avoid":"")+';">'),y=this._renderPrintContainer(h,w,b,f),r.document.write(y),r.document.write("<\/div>"),l?l&&f<u.TotalPages&&r.document.write("<h1><\/h1>"):r.document.write("<h1><\/h1>"));p=r.printDelay&&r.printDelay===parseInt(r.printDelay,10)?r.printDelay:500;r.document.write("<\/body><\/html>");r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},300))},p)}},_renderSilentPrinting:function(i){var f=i,l=f.PaperHeight,o=f.PaperWidth,w=f.MarginTop,b=f.MarginLeft,k=n("head").find("link"),a=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version)<=9,v="<style>h1 {display:block;height:0px;page-break-after:always;}@page { size:"+o+"px "+l+"px; margin:0px;}@media print{ div {-webkit-print-color-adjust: exact;} #header, #footer { display:none } }<\/style>",u=n("#"+this._id+"_printPageIframe"),r,s,h,e,c,y,p;if(u.length>0||(u=n('<iframe id="'+(this._id+"_printPageIframe")+'"><\/iframe>'),u.css({height:".0001px",width:".0001px",backgroundColor:"Transparent",border:"none"}),n("body").append(u)),r=u[0].contentWindow?u[0].contentWindow:u[0].contentDocument.document?u[0].contentDocument.document:u[0].contentDocument,r!=null){for(r.document.open(),r.document.write("<!DOCTYPE html>"),r.printDelay=500,isCssLoad=this._onReportPrint({printFrame:r,isStyleLoad:!0}),s=this._browserInfo.name==="msie"?'<body style="width:'+o+'px">':"<body>",isCssLoad?(h="",k.each(function(t,i){n(i).attr("href",i.href);h+=i.outerHTML}),r.document.write("<html><head>"+h+v+"<\/head>"+s)):r.document.write("<html><head>"+v+"<\/head>"+s),e=0;e<f.TotalPages;e++)c=f.PageData[e],t.isNullOrUndefined(c)||(r.document.write('<div style="position:relative;height:'+l+"px;width:"+o+"px;"+(this._browserInfo.name=="mozilla"?"page-break-inside:avoid":"")+';">'),y=this._renderPrintContainer(c,w,b,e),r.document.write(y),r.document.write("<\/div>"),a?a&&e<f.TotalPages&&r.document.write("<h1><\/h1>"):r.document.write("<h1><\/h1>"));p=r.printDelay&&r.printDelay===parseInt(r.printDelay,10)?r.printDelay:500;r.document.write("<\/body><\/html>");r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.window.close()},300))},p)}},_renderPrintContainer:function(i,r,u,f){var e=document.createElement("div"),o,s,h,v,c,l,a,y,p;return document.body.appendChild(e),n(e).css({overflow:"auto",width:"1px",height:"1px"}),o=t.buildTag("div","",{position:"relative","background-color":"transparent"}),n(e).append(o),s=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.HeaderHeight+"px"},{}),h=t.buildTag("div.pageHeaderBorder","",{position:"relative","background-color":"#FFFFFF",left:u,top:r}),h.append(s),o.append(h),v=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.Height+"px"},{}),c=t.buildTag("div.pageBodyBorder","",{position:"relative","background-color":"#FFFFFF",left:u,top:r}),c.append(v),o.append(c),l=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.FooterHeight+"px"},{}),a=t.buildTag("div.pageFooterBorder","",{position:"relative","background-color":"#FFFFFF",left:u,top:r}),a.append(l),o.append(a),this._printMode&&(s.css("overflow","hidden"),l.css("overflow","hidden")),i.ReportStyleModel&&this._applyPageStyle(o,i.ReportStyleModel,!0),i.HeaderStyleModel&&this._applyPageStyle(h,i.HeaderStyleModel,!0),i.FooterStyleModel&&this._applyPageStyle(a,i.FooterStyleModel,!0),i.BodyStyleModel&&this._applyPageStyle(c,i.BodyStyleModel,!0),i.HeaderModel&&i.HeaderModel.length>0&&this._renderPageControls(i.HeaderModel,s,!0,"Print"+f),i.FooterModel&&i.FooterModel.length>0&&this._renderPageControls(i.FooterModel,l,!0,"Print"+f),i.PageModel&&i.PageModel.length>0&&this._renderPageControls(i.PageModel,v,!0,"Print"+f),y=n(e).find("img"),y.each(function(t,i){n(i).attr("src",i.attributes.imgUrl.value)}),p=e.innerHTML.replace(/PrintImage/g,"GetResource"),document.body.removeChild(e),p},_showPrintButton:function(t){t?n("#"+this._id+"_toolbar_Print").parent().css("display","block"):n("#"+this._id+"_toolbar_Print").parent().css("display","none")},_exportMenuClick:function(t){var i,r=n(t.target);r&&(r.hasClass("e-pdf")?i="PDF":r.hasClass("e-word")?i="Word_"+this.model.exportSettings.wordFormat:r.hasClass("e-excel")?i="Excel_"+this.model.exportSettings.excelFormat:r.hasClass("e-html")?i="Html":r.hasClass("e-ppt")&&(i="PPT_"+this.model.exportSettings.pptFormat),this._exportReport(i))},_exportReport:function(t){var r=null,f,u,i,e,o,s,h;t&&t.length>0&&(f=this.model.reportServiceUrl+"/PostReportAction",n("#"+this._id+"_exportForm").length>0?(u=n("#"+this._id+"_exportForm"),u.attr("action",f),n("#"+this._id+"_exportKey").val(this._authenticationToken),n("#"+this._id+"_exportRes").val(t),r={exportAction:u},this._onReportExport(r),u.submit()):(i=document.createElement("form"),n(i).attr({id:this._id+"_exportForm",method:"post",action:f,"data-ajax":"false"}),e=document.createElement("input"),n(e).attr({type:"hidden",id:this._id+"_exportKey",name:"controlID",value:this._authenticationToken}),o=document.createElement("input"),n(o).attr({type:"hidden",id:this._id+"_exportRes",name:"resourcetype",value:t}),s=document.createElement("input"),n(s).attr({type:"hidden",id:this._id+"_exportPrint",name:"isPrint",value:!1}),h=document.createElement("input"),n(h).attr({type:"hidden",id:this._id+"_exportfileName",name:"reportName",value:""}),n(i).append(e),n(i).append(o),n(i).append(s),n(i).append(h),n("body").append(i),n(i).hide(),r={exportAction:i},this._onReportExport(r),n(i).submit()));n("#"+this._id+"_toolbar_exportListTip").hide()},_showExportList:function(){this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Html?n("#"+this._id+"_html").css("display","block"):n("#"+this._id+"_html").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Word?n("#"+this._id+"_word").css("display","block"):n("#"+this._id+"_word").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Excel?n("#"+this._id+"_xls").css("display","block"):n("#"+this._id+"_xls").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Pdf?n("#"+this._id+"_pdf").css("display","block"):n("#"+this._id+"_pdf").css("display","none");this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.PPT?n("#"+this._id+"_ppt").css("display","block"):n("#"+this._id+"_ppt").css("display","none")},_showExportControls:function(t){t?n("#"+this._id+"_toolbarContainer .e-reportviewer-export").parent().css("display","block"):n("#"+this._id+"_toolbarContainer .e-reportviewer-export").parent().css("display","none")},_showTooltip:function(){var t=n("#"+this._id+"_toolbar_exportListTip"),r,i;t.length>0||(t=this._renderToolTipExport(),n("body").append(t),this._showExportList(),this._on(n("#"+this._id+"_toolbar_exportListTip .e-reportviewer-popupli"),"click",this._exportMenuClick));t.css("display")=="block"?t.css("display","none"):t.css("display","block");r=n("#"+this._id+"_toolbarContainer .e-reportviewer-export").height();i=n(n("#"+this._id+"_toolbarContainer .e-reportviewer-export")[0]).offset();t.css({top:i.top+r-3,left:i.left-5})},_updatePageNavigation:function(t,i){var r=this._isDevice?"_device_toolbarContainer":"_toolbarContainer";t>1&&t<i?(n("#"+this._id+r+" .e-reportviewer-gotofirst").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").removeClass("e-reportviewer-disabled")):t==1&&t<i?(n("#"+this._id+r+" .e-reportviewer-gotofirst").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").removeClass("e-reportviewer-disabled")):t==i&&i!=1?(n("#"+this._id+r+" .e-reportviewer-gotofirst").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").removeClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").addClass("e-reportviewer-disabled")):(n("#"+this._id+r+" .e-reportviewer-gotofirst").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotoprevious").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotonext").addClass("e-reportviewer-disabled"),n("#"+this._id+r+" .e-reportviewer-gotolast").addClass("e-reportviewer-disabled"))},_gotoRenderPage:function(){this._onRenderingBegin();this._pageModel=this._retrievePageCache(this._currentPage);this._gotoPage(this._currentPage);this._onRenderingComplete();this._refresh=!1;(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._renderPages()},_gotoFirstPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._pageModel.TotalPages>0&&(this._currentPage=1,this._refresh=!1,this._isForwardDirection=!0,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoLastPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._pageModel.TotalPages>0&&(this._currentPage=this._pageModel.TotalPages,this._refresh=!1,this._isForwardDirection=!1,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoNextPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._currentPage<this._pageModel.TotalPages&&(this._currentPage=this._currentPage+1,this._refresh=!1,this._isForwardDirection=!0,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoPreviousPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._currentPage>1&&(this._currentPage=this._currentPage-1,this._refresh=!1,this._isForwardDirection=!1,this._isSelectedPage=!1,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoPageNo:function(n){if(this._pageModel&&this._pageModel.TotalPages){var t=parseInt(n);t>=1&&t<=this._pageModel.TotalPages&&this._currentPage!=t&&(this._currentPage=t,this._refresh=!1,this._isForwardDirection=!1,this._isSelectedPage=!0,(this.model.enablePageVirtualization||this.model.enablePageCache)&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))}},_gotoPage:function(t){var u,f,r,i;this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0&&(u=parseInt(t),this._updatePageNavigation(u,this._pageModel.TotalPages),this._pageModel.TotalPages>0&&this._pageModel.TotalPages&&(f=this._isDevice?"_device_toolbarContainer":"_toolbarContainer",n("#"+this._id+f+" span.e-reportviewer-labelpageno").html(" / "+this._pageModel.TotalPages),n("#"+this._id+"_txtpageNo").val(u)),r=n("#"+this._id+"_viewerContainer").find(".e-js"),r&&r.length>0&&this._destroyEJObjects(r),r=null,i=this._pageModel.PageData[0],this._renderPageModels(i),i&&this._setPageSize(i.Height,i.Width,i.HeaderHeight,i.FooterHeight))},_onkeyPress:function(t){if(t.keyCode==13)try{var i=parseInt(n(t.currentTarget).val());this._gotoPageNo(i)}catch(r){}if(t.keyCode>31&&(t.keyCode<48||t.keyCode>57))return!1},_showPageNavigationControls:function(t){t?n("#"+this._id+"_txtpageNo").parents(".e-reportviewer-toolbarul").css("display","block"):n("#"+this._id+"_txtpageNo").parents(".e-reportviewer-toolbarul").css("display","none")},_showPrintPageSetup:function(){var r=n("#"+this._id+"_printPageSetup"),t,i;r.length>0?t=n("#"+this._id+"_printPageSetup").data("ejDialog"):(this._renderPrintPageSetup(),this._bindPageSetupModel(),n("#"+this._id+"_landscape").data("ejRadioButton").model.change=n.proxy(this._orientationChanged,this),n("#"+this._id+"_portrait").data("ejRadioButton").model.change=n.proxy(this._orientationChanged,this));t&&t.model&&(i=t.isOpen(),i?n("#"+this._id+"_printPageSetup").ejDialog("close"):(n("#"+this._id+"_printPageSetup").ejDialog("open"),this._bindPageSetupModel()));this._enableToolbarContents(!1)},_pageSettingClose:function(){this._enableToolbarContents(!0)},_updatePageSetup:function(n){t.isNullOrUndefined(n)||(this._paperSetup.paperHeight=this._paperSetup.paperHeight?this._paperSetup.paperHeight:(n.PaperHeight/96).toFixed(2),this._paperSetup.paperWidth=this._paperSetup.paperWidth?this._paperSetup.paperWidth:(n.PaperWidth/96).toFixed(2),this._paperSetup.MarginTop=this._paperSetup.MarginTop&&this._paperSetup.MarginTop>0?this._paperSetup.MarginTop:(n.MarginTop/96).toFixed(2),this._paperSetup.MarginRight=this._paperSetup.MarginRight&&this._paperSetup.MarginRight>0?this._paperSetup.MarginRight:(n.MarginRight/96).toFixed(2),this._paperSetup.MarginBottom=this._paperSetup.MarginBottom&&this._paperSetup.MarginBottom>0?this._paperSetup.MarginBottom:(n.MarginBottom/96).toFixed(2),this._paperSetup.MarginLeft=this._paperSetup.MarginLeft&&this._paperSetup.MarginLeft>0?this._paperSetup.MarginLeft:(n.MarginLeft/96).toFixed(2),this._paperOrientation=parseFloat(this._paperSetup.paperHeight)<parseFloat(this._paperSetup.paperWidth)?"Landscape":"Portrait",this._paperName=this._paperName?this._paperName:this._paperOrientation=="Landscape"?this._getPaperName(this._paperSetup.paperHeight,this._paperSetup.paperWidth):this._getPaperName(this._paperSetup.paperWidth,this._paperSetup.paperHeight))},_initialPageSetup:function(n){t.isNullOrUndefined(n.pgmodel.PaperHeight)||(this._paperSetup.paperHeight=this._paperSetup.paperHeight?this._paperSetup.paperHeight:(n.pgmodel.PaperHeight/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.PaperWidth)||(this._paperSetup.paperWidth=this._paperSetup.paperWidth?this._paperSetup.paperWidth:(n.pgmodel.PaperWidth/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginTop)||(this._paperSetup.MarginTop=this._paperSetup.MarginTop&&this._paperSetup.MarginTop>0?this._paperSetup.MarginTop:(n.pgmodel.MarginTop/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginRight)||(this._paperSetup.MarginRight=this._paperSetup.MarginRight&&this._paperSetup.MarginRight>0?this._paperSetup.MarginRight:(n.pgmodel.MarginRight/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginBottom)||(this._paperSetup.MarginBottom=this._paperSetup.MarginBottom&&this._paperSetup.MarginBottom>0?this._paperSetup.MarginBottom:(n.pgmodel.MarginBottom/96).toFixed(2));t.isNullOrUndefined(n.pgmodel.MarginLeft)||(this._paperSetup.MarginLeft=this._paperSetup.MarginLeft&&this._paperSetup.MarginLeft>0?this._paperSetup.MarginLeft:(n.pgmodel.MarginLeft/96).toFixed(2))},_bindPageSetupModel:function(){var t=n("#"+this._id+"_paperHeight").data("ejNumericTextbox"),i=n("#"+this._id+"_paperWidth").data("ejNumericTextbox"),r=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox"),u=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox"),f=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox"),e=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox"),o=n("#"+this._id+"_PaperSize").data("ejDropDownList");o.selectItemByText(this._paperName);t.option("value",this._paperSetup.paperHeight?this._paperSetup.paperHeight:1);i.option("value",this._paperSetup.paperWidth?this._paperSetup.paperWidth:1);u.option("value",this._paperSetup.MarginTop);f.option("value",this._paperSetup.MarginRight);e.option("value",this._paperSetup.MarginBottom);r.option("value",this._paperSetup.MarginLeft);this._paperOrientation=="Landscape"?n("#"+this._id+"_landscape").data("ejRadioButton").option("checked",!0):n("#"+this._id+"_portrait").data("ejRadioButton").option("checked",!0)},_orientationChanged:function(i){var e=n("#"+this._id+"_paperHeight").data("ejNumericTextbox"),o=n("#"+this._id+"_paperWidth").data("ejNumericTextbox"),s=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox"),h=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox"),c=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox"),l=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox"),u,f,r,a;e&&o&&(u=e.getValue(),f=o.getValue(),this._paperName=="Custom"?i.model.id==this._id+"_portrait"&&u>f||i.model.id==this._id+"_landscape"&&u<f?(e.option("value",u),o.option("value",f)):(e.option("value",f),o.option("value",u)):(e.option("value",f),o.option("value",u)),i.model.id==this._id+"_landscape"&&i.model.checked==!0?(r=s.getValue(),s.option("value",h.getValue()),a=l.getValue(),l.option("value",r),r=c.getValue(),c.option("value",a),h.option("value",r),this._paperOrientation=t.ReportViewer.Orientation.Landscape):(r=c.getValue(),c.option("value",h.getValue()),a=l.getValue(),l.option("value",r),r=s.getValue(),s.option("value",a),h.option("value",r),this._paperOrientation=t.ReportViewer.Orientation.Portrait))},_setUpChange:function(t){var e=t.value,f=0,r=n("#"+this._id+"_paperHeight").data("ejNumericTextbox"),u=n("#"+this._id+"_paperWidth").data("ejNumericTextbox"),o=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox"),s=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox"),h=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox"),c=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox"),i=this._getPaperSize(e);e=="Custom"?this._paperOrientation=="Portrait"&&i.height>i.width||this._paperOrientation=="Landscape"&&i.height<i.width?(r.option("value",i.height),u.option("value",i.width)):(r.option("value",i.width),u.option("value",i.height)):this._paperOrientation=="Landscape"?(r.option("value",i.width),u.option("value",i.height)):(r.option("value",i.height),u.option("value",i.width));s.getValue()||s.option("value",f.toFixed(2));h.getValue()||h.option("value",f.toFixed(2));c.getValue()||c.option("value",f.toFixed(2));o.getValue()||o.option("value",f.toFixed(2));e=="Custom"?(r.enable(),u.enable()):(r.disable(),u.disable())},_getPaperName:function(n,t){return n==11.7&&t==16.5?"A3":n==8.27&&t==11.69?"A4":n==10.12&&t==14.33?"B4(JIS)":n==7.17&&t==10.12?"B5(JIS)":n==4.13&&t==9.5?"Envelope #10":n==3.88&&t==7.5?"Envelope Monarch":n==7.25&&t==10.5?"Executive":n==8.5&&t==14?"Legal":n==8.5&&t==11?"Letter":n==11&&t==17?"Tabloid":"Custom"},_getPaperSize:function(t){var u={},i,r;switch(t){case"A3":r=11.7;i=16.5;break;case"A4":r=8.27;i=11.69;break;case"B4(JIS)":r=10.12;i=14.33;break;case"B5(JIS)":r=7.17;i=10.12;break;case"Envelope #10":r=4.13;i=9.5;break;case"Envelope Monarch":r=3.88;i=7.5;break;case"Executive":r=7.25;i=10.5;break;case"Legal":r=8.5;i=14;break;case"Letter":r=8.5;i=11;break;case"Tabloid":r=11;i=17;break;case"Custom":i=n("#"+this._id+"_paperHeight").data("ejNumericTextbox").getValue();r=n("#"+this._id+"_paperWidth").data("ejNumericTextbox").getValue()}return u.height=i,u.width=r,u},_pageSetupSubmit:function(){var i=n("#"+this._id+"_paperHeight").data("ejNumericTextbox").getValue(),r=n("#"+this._id+"_paperWidth").data("ejNumericTextbox").getValue(),u=n("#"+this._id+"_paperMarginTop").data("ejNumericTextbox").getValue(),f=n("#"+this._id+"_paperMarginRight").data("ejNumericTextbox").getValue(),e=n("#"+this._id+"_paperMarginBottom").data("ejNumericTextbox").getValue(),o=n("#"+this._id+"_paperMarginLeft").data("ejNumericTextbox").getValue(),s;this._paperSetup.paperHeight=t.isNullOrUndefined(i)?null:i;this._paperSetup.paperWidth=t.isNullOrUndefined(r)?null:r;this._paperSetup.MarginTop=t.isNullOrUndefined(u)?null:u;this._paperSetup.MarginRight=t.isNullOrUndefined(f)?null:f;this._paperSetup.MarginBottom=t.isNullOrUndefined(e)?null:e;this._paperSetup.MarginLeft=t.isNullOrUndefined(o)?null:o;s=n("#"+this._id+"_PaperSize").data("ejDropDownList");this._paperName=s.model.value;this._paperOrientation=i<r?"Landscape":"Portrait";this._pageSetup=!0;this.model.pageSettings.height=this._paperSetup.paperHeight;this.model.pageSettings.width=this._paperSetup.paperWidth;this.model.pageSettings.orientation=this._paperOrientation;this.model.pageSettings.paperSize=this._paperName;this.model.pageSettings.margins.top=this._paperSetup.MarginTop;this.model.pageSettings.margins.right=this._paperSetup.MarginRight;this.model.pageSettings.margins.bottom=this._paperSetup.MarginBottom;this.model.pageSettings.margins.left=this._paperSetup.MarginLeft;t.isNullOrUndefined(i)||t.isNullOrUndefined(r)||t.isNullOrUndefined(u)||t.isNullOrUndefined(f)||t.isNullOrUndefined(e)||t.isNullOrUndefined(o)||(u+e>=i||o+f>=r?alert("The margins are overlapped or they are off the paper.Enter a different margin size."):n("#"+this._id+"_ejtb_preview").hasClass("e-active")?t.isNullOrUndefined(this._paperSetup.paperWidth)||t.isNullOrUndefined(this._paperSetup.paperHeight)||(this._updatePreviewLayout(!this._id._printMode,!0),n("#"+this._id+"_printPageSetup").ejDialog("close")):n("#"+this._id+"_printPageSetup").ejDialog("close"))},_pageSetupCancel:function(){var t=n("#"+this._id+"_printPageSetup").ejDialog("close")},_showFittoPage:function(t){t?n("#"+this._id+"_ejtb_fittopage").parents("li.e-reportviewer-toolbarli").css("display","block"):n("#"+this._id+"_ejtb_fittopage").parents("li.e-reportviewer-toolbarli").css("display","none")},_resetPage:function(){var i=null,r=null,t=n("#"+this._id+"_pageviewContainer"),u=n("#"+this._id+"_pageviewOuterline");u.css({width:t.width(),height:t.height()});this._applyPageTransform(t,this._preZoomVal,this._preZoomVal);this._browserInfo.name=="msie"&&this._browserInfo.version==8?(i=t[0].getBoundingClientRect().right,r=t[0].getBoundingClientRect().bottom):(i=t[0].getBoundingClientRect().width,r=t[0].getBoundingClientRect().height);u.css({width:i,height:r})},_fitToPage:function(t){var f=null,e=null;this._resetPage();var a=n("#"+this._id+"_viewerContainer"),i=n("#"+this._id+"_pageviewContainer"),o=n("#"+this._id+"_pageviewOuterline"),s=a.width(),h=a.height(),c=o.width(),l=o.height(),r=1,u=1;return this._browserInfo.name=="msie"&&this._browserInfo.version==8?(f=i[0].getBoundingClientRect().right,e=i[0].getBoundingClientRect().bottom):(f=i[0].getBoundingClientRect().width,e=i[0].getBoundingClientRect().height),t=="fitToPage"?(r=(s-40)/c*this._preZoomVal,u=(h-40)/l*this._preZoomVal,h>l&&(u=this._preZoomVal),s>c&&(r=this._preZoomVal),this._applyPageTransform(i,r,u,t),o.css({width:f,height:e})):t=="wholepage"?h<l&&(u=(h-40)/l*this._preZoomVal,this._applyPageTransform(i,this._preZoomVal,u,t),r=this._preZoomVal,o.css({width:f,height:e})):t=="fitToWidth"&&s<c&&(r=(s-40)/c*this._preZoomVal,this._applyPageTransform(i,r,this._preZoomVal,t),u=this._preZoomVal,o.css({width:f,height:e})),{scalX:r,scalY:u}},_selectDropDownIndex:function(t){var i=n(n("#"+this._id+"_toolbar_zoomSelection_popup li")[t]);i.addClass("e-active");n("#"+this._id+"_toolbar_zoomSelection_input").val(i.text())},_applyDropDownVal:function(t,i,r){if(r){var u=t.scalX>t.scalY?t.scalY:t.scalX;n("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(u*100)+"%");n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else i?(n("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(t.scalX*100)+"%"),n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(n("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(t.scalY*100)+"%"),n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_pageFitMenuClick:function(t){var o;if(o=n(t.target).hasClass("e-reportviewer-icon")?n(t.target).attr("fitType"):t.target.className,o){var f=n("#"+this._id+"_pageWidth"),r=f.find("span.e-reportviewer-icon"),u=n("#"+this._id+"_pageHeight"),e=u.find("span.e-reportviewer-icon"),s=n("#"+this._id+"_viewerContainer"),h=n("#"+this._id+"_pageviewOuterline"),l=n("#"+this._id+"_pageviewContainer"),a=s.width(),v=s.height(),c=h.width(),y=h.height(),p=l.width(),b=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i,w=o;switch(w){case"FITTOPAGE":i=this._fitToPage("fitToPage");this._applyDropDownVal(i,!1,!0);break;case"PAGEWIDTH":case"e-reportviewer-popupli e-fitpagewidth":if(f.attr("isSelect")=="true")u.attr("isSelect")=="true"?(i=this._fitToPage("fitToPage"),this._applyDropDownVal(i,!1,!0)):(this._resetPage(),this._selectDropDownIndex(this._zoomLevel)),r.removeClass("e-reportviewer-pagefittopage"),r.addClass("e-reportviewer-emptyconetent"),f.attr("isSelect","false");else{if(a>c){u.attr("isSelect")=="true"&&c!=p&&(i=this._fitToPage("fitToWidth"),this._applyDropDownVal(i,!0,!1),f.attr("isSelect","true"),r.addClass("e-reportviewer-pagefittopage"),r.removeClass("e-reportviewer-emptyconetent"),e.addClass("e-reportviewer-emptyconetent"),e.removeClass("e-reportviewer-pagefittopage"),u.attr("isSelect","false"));return}u.attr("isSelect")=="true"?(i=this._fitToPage("fitToPage"),this._applyDropDownVal(i,!1,!0)):(i=this._fitToPage("fitToWidth"),this._applyDropDownVal(i,!0,!1));f.attr("isSelect","true");r.addClass("e-reportviewer-pagefittopage");r.removeClass("e-reportviewer-emptyconetent")}break;case"WHOLEPAGE":case"e-reportviewer-popupli e-fitpageheight":if(u.attr("isSelect")=="true")f.attr("isSelect")=="true"?(i=this._fitToPage("fitToWidth"),this._applyDropDownVal(i,!0,!1)):(this._resetPage(),this._selectDropDownIndex(this._zoomLevel)),e.addClass("e-reportviewer-emptyconetent"),e.removeClass("e-reportviewer-pagefittopage"),u.attr("isSelect","false");else{if(v>y)return;i=this._fitToPage("fitToPage");this._applyDropDownVal(i,!1,!0);e.addClass("e-reportviewer-pagefittopage");e.removeClass("e-reportviewer-emptyconetent");u.attr("isSelect","true");r.removeClass("e-reportviewer-pagefittopage");r.addClass("e-reportviewer-emptyconetent");f.attr("isSelect","false")}}n("#"+this._id+"_toolbar_fittoPagePopup").hide()}},_showFitToPagetip:function(){var t=n("#"+this._id+"_toolbar_fittoPagePopup"),r,i;t.length>0||(t=this._renderPageFitPopup(),n("body").append(t),this._on(n("#"+this._id+"_toolbar_fittoPagePopup li.e-reportviewer-popupli"),"click",this._pageFitMenuClick));t.css("display")=="block"?t.css("display","none"):(t.css("display","block"),this._renderFitopagePopup());r=n("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit").height();i=n(n("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit")[0]).offset();t.css({top:i.top+r-3,left:i.left-5})},_zoomValChange:function(t){var r=n(this.element).closest(".e-reportviewer"),i=r.ejReportViewer("instance"),u=parseInt(t.value)/100;i._zoomLevel=t.itemId;i._zoomContainer(u,!1)},_zoomIn:function(){if(this._zoomLevel>=6?this._zoomLevel=6:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t.selectItemsByIndices(this._zoomLevel)}},_zoomOut:function(){if(this._zoomLevel<=0?this._zoomLevel=0:this._zoomLevel--,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t.selectItemsByIndices(this._zoomLevel)}},_mobileLayoutZoomChange:function(){this._zoomContainer([.5,.75,1,1.25,1.5,2,4][this._zoomLevel],!1)},_zoomInContainer:function(t,i){var e=i,s=n("#"+this._id+"_viewerContainer"),f=n("#"+this._id+"_pageviewContainer"),o=n("#"+this._id+"_pageviewOuterline"),r,u;t&&(this._zoomVal=this._zoomVal+e);r=f.width();u=f.height();this.model.printMode&&(r=r+(this._pageModel.MarginLeft+this._pageModel.MarginRight),u=u+(this._pageModel.MarginTop+this._pageModel.MarginBottom));this._applyPageTransform(f,this._zoomVal,this._zoomVal);o.css({width:r*this._zoomVal,height:u*this._zoomVal})},_zoomOutContainer:function(t,i){var e=i,s=n("#"+this._id+"_viewerContainer"),r=n("#"+this._id+"_pageviewContainer"),o=n("#"+this._id+"_pageviewOuterline"),u,f;t&&(this._zoomVal=this._zoomVal-e);u=r.width();f=r.height();this._applyPageTransform(r,this._zoomVal,this._zoomVal);o.css({width:u*this._zoomVal,height:f*this._zoomVal})},_applyPageTransform:function(t,i,r,u){var f="scale("+i+","+r+")",e;if(this._browserInfo.name=="msie"){this._browserInfo.version=="8.0"?t.css({zoom:i}):t.css({"-ms-transform":f,"-ms-transform-origin":"0 0"});this._setZoomScrollerIE();e=n("#"+this._id+"_viewerContainer");switch(u){case"fitToPage":e.css({"overflow-x":"hidden","overflow-y":"hidden"});break;case"wholepage":e.css({"overflow-y":"hidden"});break;case"fitToWidth":e.css({"overflow-x":"hidden"})}}else this._browserInfo.name=="opera"?t.css({"-o-transform":f,"-o-transform-origin":"0 0"}):this._browserInfo.name=="mozilla"?this._browserInfo.version=="11.0"?t.css({transform:f,"transform-origin":"0 0"}):t.css({"-moz-transform":f,"-moz-transform-origin":"0 0"}):(this._browserInfo.name=="webkit"||this._browserInfo.name=="chrome")&&t.css({"-webkit-transform":f,"-webkit-transform-origin":"0 0"})},_zoomContainer:function(t,i){var r;this._zoomVal=t;var e=n("#"+this._id+"_pageWidth"),o=n("#"+this._id+"_pageHeight"),u=e.find("span.e-reportviewer-icon"),f=o.find("span.e-reportviewer-icon");if((e.attr("isSelect")=="true"||o.attr("isSelect")=="true")&&this._resetPage(),u&&(u.removeClass("e-reportviewer-pagefittopage"),u.addClass("e-reportviewer-emptyconetent")),f&&(f.addClass("e-reportviewer-emptyconetent"),f.removeClass("e-reportviewer-pagefittopage")),r=Math.abs(this._preZoomVal-t),r==0)return!1;this._preZoomVal>t?this._zoomOutContainer(i,r):this._zoomInContainer(i,r);this._preZoomVal=t},_setZoomScrollerIE:function(t){if(this._browserInfo.name=="msie"&&this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0){var i=n("#"+this._id+"_viewerContainer"),r=this._pageModel.PageData[0],s=r.Height,u=r.Width,h=r.HeaderHeight,c=r.FooterHeight,f=s+h+c,e=i.height(),o=i.width();f=f*t;u=u*t;i.css({overflow:"hidden"});i.css({"overflow-x":"Auto"});i.css({"overflow-y":"Auto"});f<e&&u<o?(i.css({"overflow-x":"hidden"}),i.css({"overflow-y":"hidden"})):u<o?i.css({"overflow-x":"hidden"}):f<e&&i.css({"overflow-y":"hidden"})}},_showZoomControl:function(t){t?(n("#"+this._id+"_toolbar_zoomin").parents("li.e-reportviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-reportviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-reportviewer-ejdropdownlist").css("display","block")):(n("#"+this._id+"_toolbar_zoomin").parents("li.e-reportviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-reportviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-reportviewer-ejdropdownlist").css("display","none"))},_refreshReport:function(){this._refresh=!0;this._dataRefresh=!0;this._unwireEvents();this._initViewer();this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSourceCredentials:this.model.dataSourceCredentials,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential")},_showRefreshButton:function(t){t?n("#"+this._id+"_toolbar_refresh").parent().css("display","block"):n("#"+this._id+"_toolbar_refresh").parent().css("display","none")},_wireEvents:function(){this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._on(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._on(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick));this._on(n("#"+this._id+"_viewerContainer"),"scroll",this._scrollPage);this._on(n("#"+this._id+"_pageviewOuterContainer"),"click",this._viewerClick);this._on(n(document),"click",this._onReporClick);this._isDevice||(this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseover",this._showIconToolTip),this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseout",this._hideIconToolTip))},_unwireEvents:function(){this.model.toolbarSettings.templateId||(this._off(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._off(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._off(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick));this._off(n("#"+this._id+"_viewerContainer"),"scroll",this._scrollPage);this._off(n("#"+this._id+"_pageviewOuterContainer"),"click",this._viewerClick);this._off(n(document),"click",this._onReporClick);this._off(n("#"+this._id+"_viewReportClick"),"click",this._viewReportParamsClick);this._off(n(window),"resize",this._viewerResize);this._isDevice||(this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseover",this._showIconToolTip),this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-reportviewer-tbpage"),"mouseout",this._hideIconToolTip))},_onReporClick:function(t){var i,u,r,f;n(t.target).hasClass("e-reportviewer-export")||n(n(t.target).children()).hasClass("e-reportviewer-export")?n("#"+this._id+"_toolbar_exportListTip").css("display")!="block"&&n("#"+this._id+"_toolbar_exportListTip").css("display","none"):n("#"+this._id+"_toolbar_exportListTip").css("display","none");n(t.target).hasClass("e-reportviewer-pagefit")||n(n(t.target).children()).hasClass("e-reportviewer-pagefit")?n("#"+this._id+"_toolbar_fittoPagePopup").css("display")!="block"&&n("#"+this._id+"_toolbar_fittoPagePopup").css("display","none"):n("#"+this._id+"_toolbar_fittoPagePopup").css("display","none");this._isDevice&&(i=n("#"+this._id+"_device_toolbarContainer"),u=t.target,!i.is(":visible")&&n(u).hasClass("e-device-reportviewer-toolbarspan")||n(u).closest("#"+this._id+"_device_toolbarContainer").hasClass("e-device-reportviewer-toolbarcontainer")?(i.css("display","block"),r=n("#"+this._id+"_toolbarContainer")[0].getBoundingClientRect(),f=i[0].getBoundingClientRect(),i.css("left",r.left+r.width-f.width+"px"),i.css("top",+r.top+r.height+"px")):i.css("display","none"))},_onToolbarItemClick:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_toolbarClick:function(t){var i=t.target;if(this._isToolbarClick){if(this._isPageDialogOpened())return;n("#"+this._id+"_rptTooltip").css("display","none");n(i).hasClass("e-reportviewer-toolbarli")&&(i=n(i).find("span"));n(i).hasClass("e-reportviewer-print")?this._print():n(i).hasClass("e-reportviewer-export")?this._showTooltip():n(i).hasClass("e-reportviewer-pagesetup")?this._showPrintPageSetup():n(i).hasClass("e-reportviewer-gotofirst")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoFirstPage():n(i).hasClass("e-reportviewer-gotolast")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoLastPage():n(i).hasClass("e-reportviewer-gotonext")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoNextPage():n(i).hasClass("e-reportviewer-gotoprevious")&&!n(i).hasClass("e-reportviewer-disabled")?this._gotoPreviousPage():n(i).hasClass("e-reportviewer-gotoparent")?this._gotoParentReport():n(i).hasClass("e-reportviewer-documentmap")&&!this._printMode?this._documentMapClick():n(i).hasClass("e-reportviewer-zoomin")?this._zoomIn():n(i).hasClass("e-reportviewer-zoomout")?this._zoomOut():n(i).hasClass("e-reportviewer-pagefit")?this._showFitToPagetip():n(i).hasClass("e-reportviewer-preview")?this._printlayout():n(i).hasClass("e-reportviewer-refresh")?this._refreshReport():n(i).hasClass("e-reportviewer-parameter")&&this._toggleParameterBlock()}},_showToolbar:function(t){t?n("#"+this._id+"_toolbarContainer").css("display","block"):n("#"+this._id+"_toolbarContainer").css("display","none")},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");this._refresh?t.selectItemsByIndices(t.model.selectedIndex):t.selectItemsByIndices(2);t.disable();n("#"+this._id+"_txtpageNo").attr("disabled","disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotofirst").addClass("e-reportviewer-disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotoprevious").addClass("e-reportviewer-disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotonext").addClass("e-reportviewer-disabled");n("#"+this._id+"_toolbarContainer .e-reportviewer-gotolast").addClass("e-reportviewer-disabled")}},_enableToolbarItems:function(){this._isToolbarClick=!0;this.model.toolbarSettings.templateId||this._isDevice||(n("#"+this._id+"_txtpageNo").removeAttr("disabled"),n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable())},_enableToolbarContents:function(t){t?(n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable(),n("#"+this._id+"_txtpageNo").attr("readonly",!1)):(n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").disable(),n("#"+this._id+"_txtpageNo").attr("readonly",!0))},_showIconToolTip:function(t){n("#"+this._id+"_rptTooltip").css("display")=="none"&&this._showTooltipContent(t)},_hideIconToolTip:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_viewpopupBlockNone:function(n){return t.isNullOrUndefined(n)||n.length==0||n.css("display")!="block"?!1:!0},_isPageDialogOpened:function(){var i=n("#"+this._id+"_printPageSetup").data("ejDialog");return!t.isNullOrUndefined(i)&&i.isOpen()?!0:!1},_showTooltipContent:function(t){var r=t.target,i,u,f;this.model.toolbarSettings.showTooltip&&!this._isDevice&&(f=!0,n(r).hasClass("e-reportviewer-toolbarli")&&(r=n(r).find("span")),(this._viewpopupBlockNone(n("#"+this._id+"_toolbar_fittoPagePopup"))||this._viewpopupBlockNone(n("#"+this._id+"_toolbar_exportListTip"))||this._isPageDialogOpened())&&(f=!1),n(r).hasClass("e-reportviewer-print")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-print")[0].getBoundingClientRect(),u=this._getTootipText("print")):n(r).hasClass("e-reportviewer-export")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-export")[0].getBoundingClientRect(),u=this._getTootipText("export")):n(r).hasClass("e-reportviewer-gotofirst")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotofirst")[0].getBoundingClientRect(),u=this._getTootipText("first")):n(r).hasClass("e-reportviewer-gotolast")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotolast")[0].getBoundingClientRect(),u=this._getTootipText("last")):n(r).hasClass("e-reportviewer-gotonext")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotonext")[0].getBoundingClientRect(),u=this._getTootipText("next")):n(r).hasClass("e-reportviewer-gotoprevious")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotoprevious")[0].getBoundingClientRect(),u=this._getTootipText("previous")):n(r).hasClass("e-reportviewer-documentmap")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-documentmap")[0].getBoundingClientRect(),u=this._getTootipText("documentmap")):n(r).hasClass("e-reportviewer-zoomin")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-zoomin")[0].getBoundingClientRect(),u=this._getTootipText("zoomin")):n(r).hasClass("e-reportviewer-zoomout")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-zoomout")[0].getBoundingClientRect(),u=this._getTootipText("zoomout")):n(r).hasClass("e-reportviewer-preview")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-preview")[0].getBoundingClientRect(),u=this._getTootipText("preview")):n(r).hasClass("e-reportviewer-refresh")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-refresh")[0].getBoundingClientRect(),u=this._getTootipText("refresh")):n(r).hasClass("e-reportviewer-parameter")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-parameter")[0].getBoundingClientRect(),u=this._getTootipText("parameter")):n(r).hasClass("e-reportviewer-gotoparent")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-gotoparent")[0].getBoundingClientRect(),u=this._getTootipText("back")):n(r).hasClass("e-reportviewer-tbpage")||n(r).hasClass("e-reportviewer-pagenumber")||n(r).hasClass("e-reportviewer-labelpageno")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-tbpage")[0].getBoundingClientRect(),u=this._getTootipText("pageIndex")):n(r).hasClass("e-reportviewer-ejdropdownlist")||n(r).hasClass("e-dropdownlist")||n(r).hasClass("e-select")||n(r).hasClass("e-down-arrow")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-ejdropdownlist")[0].getBoundingClientRect(),u=this._getTootipText("zoom")):n(r).hasClass("e-reportviewer-pagefit")?(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit")[0].getBoundingClientRect(),u=this._getTootipText("fittopage")):n(r).hasClass("e-reportviewer-pagesetup")&&(i=n("#"+this._id+"_toolbarContainer .e-reportviewer-pagesetup")[0].getBoundingClientRect(),u=this._getTootipText("pagesetup")),u&&f&&(n("#"+this._id+"_rptTooltip_Header").html(u.header),n("#"+this._id+"_rptTooltip_Content").html(u.content),this._browserInfo.name=="msie"&&this._browserInfo.version==8?n("#"+this._id+"_rptTooltip").css({top:i.top+(i.bottom-i.top)+5,left:i.left+(i.right-i.left)/2,display:"block",position:"fixed"}):n("#"+this._id+"_rptTooltip").css({top:i.top+i.height+5,left:i.left+i.width/2,display:"block",position:"fixed"})))},_getTootipText:function(n){var i=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],r="",u="";switch(n){case"print":r=i.toolbar.print.headerText;u=i.toolbar.print.contentText;break;case"export":r=i.toolbar.exportformat.headerText;u=i.toolbar.exportformat.contentText;break;case"first":r=i.toolbar.first.headerText;u=i.toolbar.first.contentText;break;case"previous":r=i.toolbar.previous.headerText;u=i.toolbar.previous.contentText;break;case"next":r=i.toolbar.next.headerText;u=i.toolbar.next.contentText;break;case"last":r=i.toolbar.last.headerText;u=i.toolbar.last.contentText;break;case"zoomin":r=i.toolbar.zoomIn.headerText;u=i.toolbar.zoomIn.contentText;break;case"zoomout":r=i.toolbar.zoomOut.headerText;u=i.toolbar.zoomOut.contentText;break;case"preview":r=i.toolbar.printLayout.headerText;u=i.toolbar.printLayout.contentText;break;case"documentmap":r=i.toolbar.documentMap.headerText;u=i.toolbar.documentMap.contentText;break;case"refresh":r=i.toolbar.refresh.headerText;u=i.toolbar.refresh.contentText;break;case"parameter":r=i.toolbar.parameter.headerText;u=i.toolbar.parameter.contentText;break;case"back":r=i.toolbar.back.headerText;u=i.toolbar.back.contentText;break;case"pageIndex":r=i.toolbar.pageIndex.headerText;u=i.toolbar.pageIndex.contentText;break;case"zoom":r=i.toolbar.zoom.headerText;u=i.toolbar.zoom.contentText;break;case"fittopage":r=i.toolbar.fittopage.headerText;u=i.toolbar.fittopage.contentText;break;case"pagesetup":r=i.toolbar.pagesetup.headerText;u=i.toolbar.pagesetup.contentText}return{header:r,content:u}},_drillAction:function(){n._data(n(".txtToggle_"+this._id).get(0),"events")==i&&this._on(n(".txtToggle_"+this._id),"click",this._drillClick)},_drillClick:function(t){var i=n(t.currentTarget).data("drillObj");i&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.drillDown,pageindex:this._currentPage,toggleInfo:i,refresh:!1,dataRefresh:!1,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")},_sortingAction:function(){n._data(n(".txtSorting_"+this._id).get(0),"events")==i&&this._on(n(".txtSorting_"+this._id),"click",this._sortingClick)},_sortingClick:function(t){var i=n(t.currentTarget).data("sortingObj");i&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.sorting,pageindex:this._currentPage,sortingInfo:i,refresh:!1,dataRefresh:!1,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")},_showDocumentMap:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-documentmap").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-documentmap").parent().css("display","none")},_appendDocumentMapDiv:function(){if(this._isDevice){var i=n("#"+this._id+"_documentmapContainer");i.length==0&&(i=t.buildTag("div.e-reportviewer-documentmappopup","",{display:"none"},{id:this._id+"_documentmapContainer"}),n("body").append(i))}},_selectDocMapToolItem:function(t){if(!this.model.toolbarSettings.templateId){var i=n("#"+this._id+"_toolbarContainer").data("ejToolbar");t?i.selectItemByID(this._id+"_ejtb_documentmap"):i.deselectItemByID(this._id+"_ejtb_documentmap")}},_documentMapClick:function(){var t,i;this._isDevice?(i=n("#"+this._id+"_documentmapContainer"),i.css("display")=="block"?(this._pageDocMapFlag=!0,i.css("display","none"),this._selectDocMapToolItem(!1)):(this._pageDocMapFlag=!1,i.css("display","block"),this._selectDocMapToolItem(!0))):(t=n("#"+this._id+"_reportviewerContainer").data("ejSplitter"),n(t.panes[0]).hasClass("collapsed")?(this._pageDocMapFlag=!0,t.expand(0),this._selectDocMapToolItem(!0)):(this._pageDocMapFlag=!1,t.collapse(0),this._selectDocMapToolItem(!1)))},_showDocumentMapContainer:function(t){if(this._isDevice)t?n("#"+this._id+"_documentmapContainer").css("display","block"):n("#"+this._id+"_documentmapContainer").css("display","none");else{var i=n("#"+this._id+"_reportviewerContainer").data("ejSplitter");t?i.expand(0):i.collapse(0)}},_documentMapAction:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.documentMap}),"_documentMapModel")},_containerSplit:function(i){var r=n("#"+this._id+"_viewerContainer");this._appendDocumentMapDiv();i=i.replace("treeViewID",this._id+"_ejtreeView");n("#"+this._id+"_documentmapContainer").css("height","100%");n("#"+this._id+"_documentmapContainer").html(i);n("#"+this._id+"_ejtreeView").css("display","none");n("#"+this._id+"_ejtreeView").ejTreeView({height:r.height(),nodeSelect:this._pageNavigate});this._isDevice?n("#"+this._id+"_documentmapContainer").css({position:"absolute",left:r.offset().left,top:r.offset().top,height:r.height(),width:r.width()/6}):n("#"+this._id+"_reportviewerContainer").ejSplitter({height:r.height()+1,orientation:t.Orientation.Horizontal,properties:[{paneSize:140},{}]});n("#"+this._id+"_ejtreeView").css("display","block");this._selectDocMapToolItem(!0)},_pageNavigate:function(t){try{var i=JSON.parse(n(t.currentElement).attr("id")),r=this._id.replace("_ejtreeView",""),u=n("#"+r).data("ejReportViewer");u._isDevice&&(n("#"+r+"_documentmapContainer").css("display","none"),this._selectDocMapToolItem(!1));u._gotoPageNo(i.PageNo);n("#"+r+"_viewerContainer").animate({scrollTop:i.TopPos-12,scrollLeft:i.LeftPos-12},"600")}catch(f){}},_showDrillThrough:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-gotoparent").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-gotoparent").parent().css("display","none")},_drillThroughAction:function(){n._data(n(".drillAction_"+this._id).get(0),"events")==i&&this._on(n(".drillAction_"+this._id),"click",this._drillThroughClick)},_drillThroughClick:function(i){var u=null,r=null,f,e,s,o;if(this.pluginName=="ejChart"){if(r=n("#"+this.ejreportid).data("ejReportViewer"),n("#"+this._id+"_svg_TrackToolTip").css("display","none"),f=n("#"+this._id).data(this._id+"actionObj_Series"+i.data.region.SeriesIndex),t.isNullOrUndefined(f))return!1;u=f[i.data.region.Region.PointIndex]}else if(this.pluginName=="ejMap"){if(r=n("#"+this.ejreportid).data("ejReportViewer"),i.originalEvent[0]==null||t.isNullOrUndefined(i.originalEvent[0].data))return;u=i.originalEvent[0].data.ShapeActionInfo}else r=this,u=n(i.currentTarget).data("actionObj");u&&(e={actionInfo:n.extend(!0,{},u)},s=r._onDrillThrough(e),s||(u.Hyperlink?window.open(u.Hyperlink):u.ReportName&&(o=e.actionInfo,r._childReportAuthentication=r._getAuthenticationToken(),r._showloadingIndicator(!0),r.doAjaxPost("POST",r._actionUrl,JSON.stringify({reportAction:r._reportAction.drillThrough,reportName:o.ReportName,parameters:o.Parameters,authKey:r._childReportAuthentication}),"_drillThroughModel"))))},_gotoParentReport:function(){this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_gotoParentReportModel")},_setInitialization:function(){this._dataSources=null;this._authenticationToken=null;this._childReportAuthentication=null;this._refresh=!1;this._isToolbarClick=!1;this._pageModel=null;this._currentPage=1;this._reportParameters=null;this._reportDataSources=null;this._reporDataSets=null;this._zoomLevel=2;this._isDocumentMap=!1},_cloneReportViewerProperties:function(){var t={};return t.model=n.extend(!0,{},this.model),t._dataSources=n.extend(!0,{},this._dataSources),t._authenticationToken=this._authenticationToken,t._childReportAuthentication=this._childReportAuthentication,t._refresh=this._refresh,t._isToolbarClick=this._isToolbarClick,t._pageModel=n.extend(!0,{},this._pageModel),t._currentPage=this._currentPage,t._reportParameters=n.extend(!0,{},this._reportParameters),t._reportDataSources=n.extend(!0,{},this._reportDataSources),t._reporDataSets=n.extend(!0,{},this._reporDataSets),t._zoomLevel=this._zoomLevel,t._preZoomVal=this._preZoomVal,t._isDevice=this._isDevice,t._originX=this._originX,t._originY=this._originY,t._printMode=this._printMode,t._pageSetup=this._pageSetup,t._isDocumentMap=this._isDocumentMap,t},_setParentReportViewerProperties:function(){var t=this._parents[this._parents.length-1],n=t.parentPro;this.model=n.model;this._dataSources=n._dataSources;this._authenticationToken=n._authenticationToken;this._childReportauthentication=n._childReportAuthentication;this._refresh=n._refresh;this._isToolbarClick=n._isToolbarClick;this._pageModel=n._pageModel;this._currentPage=n._currentPage;this._reportParameters=n._reportParameters;this._reportDataSources=n._reportDataSources;this._reporDataSets=n._reporDataSets;this._zoomLevel=n._zoomLevel;this._isDocumentMap=n._isDocumentMap;this._preZoomVal=n._preZoomVal;this._printMode=n._printMode;this._originX=n._originX;this._originY=n._originY;this._parentPageXY=t.pagePos;this._parents.pop()},_printlayout:function(){this._updatePreviewLayout(!this._printMode,this._pageSetup)},_selectPreviewToolItem:function(t){if(!this.model.toolbarSettings.templateId){var i=n("#"+this._id+"_toolbarContainer").data("ejToolbar");t?i.selectItemByID(this._id+"_ejtb_preview"):i.deselectItemByID(this._id+"_ejtb_preview")}},_updatePreviewLayout:function(t,i){if(this._printMode=t,this._isSelectedPage=!1,this._printMode?(this._currentPage=1,this._pageLayoutPage=this._currentPage):this._currentPage=this._pageLayoutPage,this._selectPreviewToolItem(this._printMode),this._isPageDocMap&&!this._isDocumentMap&&this._showDocumentMapContainer(this._printMode?!1:this._pageDocMapFlag),this.model.printMode=this._printMode,i){var u=n("#"+this._id+"_PaperSize").data("ejDropDownList"),r=this._getPaperSize(u.model.value),f=n("#"+this._id+"_landscape").data("ejRadioButton"),e=n("#"+this._id+"_portrait").data("ejRadioButton");u.model.value=="Custom"?this._paperOrientation=="Portrait"&&r.height>r.width||this._paperOrientation=="Landscape"&&r.height<r.width?(this._paperSetup.paperHeight=r.height,this._paperSetup.paperWidth=r.width):(this._paperSetup.paperHeight=r.width,this._paperSetup.paperWidth=r.height):this._paperOrientation=="Landscape"?(this._paperSetup.paperHeight=r.width,this._paperSetup.paperWidth=r.height):(this._paperSetup.paperHeight=r.height,this._paperSetup.paperWidth=r.width);this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode,PageSetup:this._paperSetup}),this._printMode?"_getPreviewModel":"_getPageModel")}else this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,dataRefresh:this._dataRefresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel")},_showPreviewButton:function(t){t?n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-preview").parent().css("display","block"):n("#"+this._id+"_toolbarContainer").find(".e-reportviewer-preview").parent().css("display","none")},_setCultureInfo:function(){var i=this.model.locale,s=n("#"+this._id+"Pagewidthspan"),h=n("#"+this._id+"pageheightSpan"),e=n("#"+this._id+"_pageWidth"),o=n("#"+this._id+"_pageHeight"),f,r,u;if(n("#"+this._id+"_viewReportClick").val(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].viewButton:t.ReportViewer.Locale["en-US"].viewButton),n("#"+this._id+"_pdf").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Pdf:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Pdf),n("#"+this._id+"_xls").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Excel:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Excel),n("#"+this._id+"_word").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Word:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Word),n("#"+this._id+"_html").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.Html:t.ReportViewer.Locale["en-US"].toolbar.exportformat.Html),n("#"+this._id+"_ppt").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.exportformat.PPT:t.ReportViewer.Locale["en-US"].toolbar.exportformat.PPT),f=n("#"+this._id+"_printPageSetup").data("ejDialog"),f&&f.setTitle(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.pagesetup.headerText:t.ReportViewer.Locale["en-US"].toolbar.pagesetup.headerText),n("#"+this._id+"_Submit").val(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.doneButton:t.ReportViewer.Locale["en-US"].pagesetupDialog.doneButton),n("#"+this._id+"_Cancel").val(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.cancelButton:t.ReportViewer.Locale["en-US"].pagesetupDialog.cancelButton),n("#"+this._id+"_heightLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.height+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.height+" "),n("#"+this._id+"_widthLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.width+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.width+" "),n("#"+this._id+"_topLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.top+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.top+" "),n("#"+this._id+"_bottomLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.bottom+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.bottom+" "),n("#"+this._id+"_rightLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.right+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.right+" "),n("#"+this._id+"_leftLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.left+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.left+" "),n("#"+this._id+"_heightUnitLabel","#"+this._id+"_widthUnitLabel","#"+this._id+"_topUnitLabel","#"+this._id+"_rightUnitLabel","#"+this._id+"_bottomUnitLabel","#"+this._id+"_leftUnitLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.unit+" ":t.ReportViewer.Locale["en-US"].pagesetupDialog.unit+" "),n("#"+this._id+"_portraitLabel").html(t.ReportViewer.Locale[i]?" "+t.ReportViewer.Locale[i].pagesetupDialog.portrait:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.portrait),n("#"+this._id+"_landscapeLabel").html(t.ReportViewer.Locale[i]?" "+t.ReportViewer.Locale[i].pagesetupDialog.landscape:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.landscape),n("#"+this._id+"_paperSizeLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.paperSize:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.paperSize),n("#"+this._id+"_marginheader").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.margins:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.margins),n("#"+this._id+"_orientationLabel").html(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].pagesetupDialog.orientation:" "+t.ReportViewer.Locale["en-US"].pagesetupDialog.orientation),e.html(s),e.append(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.fittopage.pageWidth:t.ReportViewer.Locale["en-US"].toolbar.fittopage.pageWidth),o.html(h),o.append(t.ReportViewer.Locale[i]?t.ReportViewer.Locale[i].toolbar.fittopage.pageHeight:t.ReportViewer.Locale["en-US"].toolbar.fittopage.pageHeight),r=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").find(".e-reportviewer-DateTime"),r&&r.length>0)for(u=0;u<r.length;u++)n("#"+n(r[u]).attr("id")).data("ejDatePicker").setModel({locale:this.model.locale})},_renderPages:function(){var t,i,n;if(this.model.enablePageVirtualization||this.model.enablePageCache){if(t=this._printMode?this._printPageCache:this._pageCache,t.length-1<this._pageModel.TotalPages)for(n=this._currentPage+1;n<=this._pageModel.TotalPages;n++)t[n]=null;if(_pageNos=[],i=this._isForwardDirection?this._currentPage+1:this._currentPage-1,this._isSelectedPage)for(n=i;n<=this._pageModel.TotalPages;this._isForwardDirection?n++:n--)if(t[n]==null&&typeof t[n]!="undefined"){if(_pageNos.push(n),_pageNos.length==2&&(n=n>this._currentPage?n:this._currentPage,this._isForwardDirection=!0),_pageNos.length==4)break}else typeof t[n]=="undefined"&&(n=this._currentPage,this._isForwardDirection=!0);else for(n=i;n<=this._pageModel.TotalPages&&n>1;this._isForwardDirection?n++:n--)if(t[n]==null&&(typeof t[n]!="undefined"&&_pageNos.push(n),_pageNos.length==3))break;this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,pageVirtualization:this.model.enablePageVirtualization,dataRefresh:this._dataRefresh,pageNumbers:_pageNos,pageInit:this._isToolbarClick,isPrint:this._printMode}),"_getRenderedPages")}},_getRenderedPages:function(n){if(n.pgmodel.length>0)for(var t=0;t<n.pgmodel.length;t++)n.pgmodel[t]&&n.pgmodel[t].Value.PageData&&(this._pageModel=n.pgmodel[t].Value,this._storePageCache(n.pgmodel[t].Key))},_storePageCache:function(n){this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0&&(this._pageContains(n)||(this.model.enablePageVirtualization||this.model.enablePageCache)&&(this._printMode?this._printPageCache[n]=this._pageModel:this._pageCache[n]=this._pageModel))},_retrievePageCache:function(n){return this._printMode?this._printPageCache[n]:this._pageCache[n]},_pageContains:function(n){var i=this._printMode?this._printPageCache[n]:this._pageCache[n];return!t.isNullOrUndefined(i)},_clearPageCache:function(){this._pageCache=[];this._printPageCache=[]},_itemfadeToggle:function(n){n.fadeToggle()},_popupClick:function(){var t=n("#"+this._id+"_pageInfoPopup");t.fadeIn();t.finish()},_containerScrollStop:function(){var t=n("#"+this._id+"_pageInfoPopup");t.finish().fadeIn();t.finish().fadeOut(3e3)},_viewerClick:function(){n("#"+this._id+"_toolbar_exportListTip").css("display","none")},_pinchAndSwipe:function(n){switch(n.type){case"pinchin":this._zoomOut();break;case"pinchout":this._zoomIn();break;case"swipeleft":this._gotoNextPage();this._isDevice&&this._updatePageNo();break;case"swiperight":this._gotoPreviousPage();this._isDevice&&this._updatePageNo()}},_scrollPage:function(t){var i=n(t.target),u=this._orginY=i.scrollTop(),r;if(this._orginX=i.scrollLeft(),r=n("#"+this._id+"_reportviewerContainer").offset().top,n(".fixed-data").each(function(){var f=n(this).height(),t=n(this).offset().top,e=n(this).position().top,o=f+t-r,i,u;t<=r&&!(o<=r)?(i=r-t,u=e+i,n(this).next("div").css({top:u,visibility:"visible"})):n(this).next("div").css("visibility","collapse")}),this._isDevice)if(u+i.innerHeight()>=i[0].scrollHeight){if(i.scrollTop(2),!this._pageModel||this._currentPage==this._pageModel.TotalPages)return;this._gotoNextPage();this._updatePageNo()}else if(u==0){if(i.scrollTop(2),!this._pageModel||this._currentPage==1)return;this._gotoPreviousPage();this._updatePageNo()}},_showViewerBlock:function(t){if(t){n("#"+this._id+"_viewBlockContainer").css("display","block");var i=n("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else n("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&n("#"+this._id+"_viewBlockContainer.e-reportviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){n("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t});n("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-reportviewer-waitingpopup")},_showloadingIndicator:function(t){t?(n("#"+this._id+"_loadingIndicator").css("display","block"),n("#"+this._id+"_pageviewOuterContainer").css("display","none")):(n("#"+this._id+"_loadingIndicator").css("display","none"),n("#"+this._id+"_pageviewOuterContainer").css("display","block"));n("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t});n("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-reportviewer-waitingpopup")},_isMobileDevice:function(){return/windows phone|android|iphone/i.test(navigator.userAgent.toLowerCase())},_getAuthenticationToken:function(){function n(){function n(){return((1+Math.random())*65536|0).toString(16).substring(1)}return(n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()).toUpperCase()}return n()+"^"+this._id},_updateToolbarmodel:function(){this._showToolbar(this.model.toolbarSettings.showToolbar);this._showPrintButton(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Print);this._showRefreshButton(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Refresh);this._showZoomControl(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Zoom);this._showFittoPage(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.FittoPage);this._showExportControls(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Export);this._showExportList();this._showPageNavigationControls(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.PageNavigation);this._showParameterBlock(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.Parameters);this._showPreviewButton(model.toolbarSettings.items&t.ReportViewer.ToolbarItems.PrintLayout);this._showPrintPageSetupButton(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.PageSetup)},_viewerResize:function(){var t=this;this.model.isResponsive&&(this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){var e=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,o=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,i=n(t.element).height(),r=n(t.element).width(),u,f;o.indexOf("%")!=-1?(t._isPercentHeight=parseInt(o),u=t._isHeight?n(t.element).parent().height():i,i=t._isHeight?u:u/100*t._isPercentHeight):t.element[0].parentElement.clientHeight!=0&&t._isPercentHeight!=-1?i=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&t.element[0].parentElement.clientHeight!=0?i=t.element[0].parentElement.clientHeight:t._browserInfo.name=="msie"&&t._browserInfo.version==8&&t.element[0].parentElement.clientHeight!=0&&(i=t.element[0].parentElement.clientHeight);t.element.height(i);e.indexOf("%")!=-1?(t._isPercentWidth=parseInt(e),f=t._isWidth?n(t.element).parent().width():r,r=t._isWidth?f:f/100*t._isPercentWidth):t.element[0].parentElement.clientWidth!=0&&t._isPercentWidth!=-1?r=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&t.element[0].parentElement.clientWidth!=0?r=t.element[0].parentElement.clientWidth:t._browserInfo.name=="msie"&&t._browserInfo.version==8&&t.element[0].parentElement.clientWidth!=0&&(r=t.element[0].parentElement.clientWidth);t.element.width(r);t._setContainerSize()},200))},_showViewerPage:function(t){t?n("#"+this._id+"_pageviewOuterline").css("display","block"):n("#"+this._id+"_pageviewOuterline").css("display","none");this._isDevice&&n("#"+this._id+"_pageviewOuterline").css("z-index",t?"10":"0")},_updatePageNo:function(){n("#"+this._id+"_popupPageNo").val(this._currentPage);n("#"+this._id+"_pageInfoPopup .e-reportviewer-popuptotalpage").html(" / "+this._pageModel.TotalPages)},_reportReload:function(){this._refresh=!0;this._unwireEvents();this._initViewer();this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.reportLoad,controlId:this._id,reportPath:this.model.reportPath,reportServerUrl:this.model.reportServerUrl,processingMode:this.model.processingMode}),"_reportLoaded")},getDataSetNames:function(){return n.extend(!0,{},this._reporDataSets)},getParameters:function(){return n.extend(!0,{},this._reportParameters)},gotoPageIndex:function(n){this._gotoPageNo(n)},gotoLastPage:function(){this._gotoLastPage()},gotoFirstPage:function(){this._gotoFirstPage()},gotoNextPage:function(){this._gotoNextPage()},gotoPreviousPage:function(){this._gotoPreviousPage()},print:function(){this._print()},printLayout:function(){this._printlayout()},exportReport:function(n){this._exportReport(n)},refresh:function(){this._refreshReport()},fitToPage:function(){this._fitToPage("fitToPage")},fitToPageWidth:function(){this._fitToPage("fitToWidth")},fitToPageHeight:function(){this._fitToPage("wholepage")},_onReportLoaded:function(){this._trigger("reportLoaded")},_onRenderingBegin:function(n){return this._trigger("renderingBegin",n)},_onAjaxRequest:function(n){this._trigger("ajaxBeforeLoad",n)},_onAjaxSuccess:function(n){this._trigger("ajaxSuccess",n)},_onAjaxFailure:function(n){this._trigger("ajaxError",n)},_onRenderingComplete:function(n){this._trigger("renderingComplete",n)},_onReportError:function(n){return this._trigger("reportError",n)},_onViewReportClick:function(n){return this._trigger("viewReportClick",n)},_onDrillThrough:function(n){return this._trigger("drillThrough",n)},_onReportExport:function(n){this._trigger("reportExport",n)},_onReportPrint:function(n){return this._trigger("reportPrint",n),n.isStyleLoad}});t.ReportViewer.ExportOptions={Excel:1,Html:2,Pdf:4,Word:8,PPT:16,All:31};t.ReportViewer.ExcelFormats={Excel97to2003:"excel97to2003",Excel2007:"excel2007",Excel2010:"excel2010",Excel2013:"excel2013"};t.ReportViewer.PPTFormats={PowerPoint97to2003:"powerpoint97to2003",PowerPoint2007:"powerpoint2007",PowerPoint2010:"powerpoint2010",PowerPoint2013:"powerpoint2013"};t.ReportViewer.WordFormats={Doc:"doc",Dot:"dot",Docx:"docx",Word2007:"word2007",Word2010:"word2010",Word2013:"word2013",Word2007Dotx:"word2007dotx",Word2010Dotx:"word2010dotx",Word2013Dotx:"word2013dotx",Word2007Docm:"word2007docm",Word2010Docm:"word2010docm",Word2013Docm:"word2013docm",Word2007Dotm:"word2007dotm",Word2010Dotm:"word2010dotm",Word2013Dotm:"word2013dotm",Rtf:"rtf",Txt:"txt",EPub:"epub",Html:"html",Xml:"xml",Automatic:"automatic"};t.ReportViewer.ProcessingMode={Remote:"remote",Local:"local"};t.ReportViewer.Orientation={Portrait:"Portrait",Landscape:"Landscape"};t.ReportViewer.PaperSize={A3:"A3",A4:"A4",B4_JIS:"B4(JIS)",B5_JIS:"B5(JIS)",Envelope_10:"Envelope #10",Envelope_Monarch:"Envelope Monarch",Executive:"Executive",Legal:"Legal",Letter:"Letter",Tabloid:"Tabloid",Custom:"Custom"};t.ReportViewer.ToolbarItems={Export:1,Zoom:2,PageNavigation:4,Refresh:8,Print:16,DocumentMap:32,Parameters:64,PrintLayout:128,FittoPage:256,PageSetup:512,All:1023};t.ReportViewer.RenderMode={Default:3,Mobile:1,Desktop:2};t.ReportViewer.PrintOptions={Default:"Default",NewTab:"NewTab",None:"None"};t.ReportViewer.Locale={};t.ReportViewer.Locale["en-US"]={toolbar:{print:{headerText:"Print",contentText:"Print the report."},exportformat:{headerText:"Export",contentText:"Select the exported file format.",Pdf:"PDF",Excel:"Excel",Word:"Word",Html:"Html",PPT:"PPT"},first:{headerText:"First",contentText:"Go to the first page of the report."},previous:{headerText:"Previous",contentText:"Go to the previous page of the report."},next:{headerText:"Next",contentText:"Go to the next page of the report."},last:{headerText:"Last",contentText:"Go to the last page of the report."},documentMap:{headerText:"Document Map",contentText:"Show or hide the document map."},parameter:{headerText:"Parameter",contentText:"Show or hide the parameters pane."},zoomIn:{headerText:"Zoom-In",contentText:"Zoom in to the report."},zoomOut:{headerText:"Zoom-Out",contentText:"Zoom out of the report."},refresh:{headerText:"Refresh",contentText:"Refresh the report."},printLayout:{headerText:"Print Layout",contentText:"Change between print layout and normal modes."},pageIndex:{headerText:"Page Number",contentText:"Current page number to view."},zoom:{headerText:"Zoom",contentText:"Zoom in or out on the report."},back:{headerText:"Back",contentText:"Go back to the parent report."},fittopage:{headerText:"Fit to Page",contentText:"Fit the report page to the container.",pageWidth:"Page Width",pageHeight:"Whole Page"},pagesetup:{headerText:"Page Setup",contentText:"Choose page setup option to change paper size, orientation and margins."}},pagesetupDialog:{paperSize:"Paper Size",height:"Height",width:"Width",margins:"Margins",top:"Top",bottom:"Bottom",right:"Right",left:"Left",unit:"in",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",doneButton:"Done",cancelButton:"Cancel"},viewButton:"View Report"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPdfViewer","ej.PdfViewer",{_rootCSS:"e-pdfviewer",_requiresID:!0,element:null,model:null,validTags:["div"],defaults:{serviceUrl:"",hyperlinkOpenState:1,serverActionSettings:{load:"Load",fileUpload:"FileUpload",print:"Load",download:"Download"},documentPath:null,toolbarSettings:{toolbarItem:63,showTooltip:!0},enableHyperlink:!0,enableTextSelection:!0,pdfService:1,locale:"en-US",pageChange:"",documentLoad:"",hyperlinkClick:"",beforePrint:"",afterPrint:"",zoomchange:"",bufferStart:"",bufferEnd:"",annotationAdd:"",annotationRemove:"",annotationPropertiesChange:"",annotationResize:"",isResponsive:!0,pageClick:"",allowClientBuffering:!1,documentUnload:"",ajaxRequestFailure:"",annotationType:null,enableTextMarkupAnnotations:!0,enableHighlightAnnotation:!0,enableStrikethroughAnnotation:!0,enableUnderlineAnnotation:!0,strikethroughSettings:{color:"#ff0000",author:"Guest",opacity:1,subject:"Strikethrough",modifiedDate:null,isLocked:!1},underlineSettings:{color:"#00ff00",author:"Guest",opacity:1,subject:"Underline",modifiedDate:null,isLocked:!1},highlightSettings:{color:"#ffff00",author:"Guest",opacity:1,subject:"Highlight",modifiedDate:null,isLocked:!1}},_isToolbarClick:!1,_curYPos:0,_curXPos:0,_curDown:!1,_pageModel:null,_currentPage:1,_zoomLevel:2,_preZoomVal:1,_fitType:null,_higherZoomIndex:0,_lowerZoomIndex:0,_actionUrl:null,_isDevice:!1,_contextMenu:!1,_zoomVal:1,_currentPageBackup:0,_zoomValBackup:0,_zoomLevelBackup:0,_fitTypeBackup:null,_scrollTop:0,_bgRenderTimer:0,_renderCount:0,_prevDiff:-1,_pointerCount:0,_searchText:null,_selectedIndex:0,_searchPageIndex:0,_isRenderedByPinch:!1,_isPinchLimitReached:!1,_isRerenderCanvasCreated:!1,_isPrinting:!1,_isContainImage:!1,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_isFindboxPresent:!1,_isTextSearch:!1,_isTextHighlighted:!1,_isRequestFired:!1,_isPageScrollHighlight:!1,_isPageScrolledForSearch:!1,_searchAjaxRequestState:null,_isPrevSearch:!1,_isMatchCase:!1,_isPrintHidden:!1,_isNavigationHidden:!1,_isMagnificationHidden:!1,_isDownloadHidden:!1,_isTextSearchHidden:!1,_isZoomCntlHidden:!1,_isDownloadCntlHidden:!1,_isToolbarHidden:!1,_viewerAction:{getPageModel:"GetPageModel"},_scrollTimer:null,_isDestroyed:!1,_pdfService:null,_toolbar:null,_printIframe:null,_currentPrintPage:0,_abortPrinting:!1,_isWindowResizing:!1,_ejViewerInstance:null,_isAutoZoom:!1,_ejDropDownInstance:null,_clientx:null,_clienty:null,_curPosX:null,_curPosY:null,_previousBounds:null,_topValue:!1,_clearText:!1,_timers:null,_scrollMove:null,_rangePosition:null,_selectedRanges:null,_longTouch:!1,_ranges:!1,_touchcontextMenu:!1,_selectionNodes:null,_selectionRange:null,_touched:!1,_lockTimer:null,_timer:null,_displaySearch:!1,_isCopyRestrict:!1,_isPrintRestrict:!1,_isTargetPage:!1,_targetPage:0,_isBuffering:!1,_isBufferStart:!1,_pagesGot:null,_isPrintingProcess:!1,_isRequestSuccess:!1,_fileId:null,_isFormFields:!1,_imageObj:null,_isJsondataAvailable:!1,_highestWidth:0,_horizontalResolution:null,_isAsynchronousDownload:!0,_searchedText:null,_annotationActive:!1,_isHighlight:!1,_isUnderline:!1,_isStrikeout:!1,_drawColor:null,_selectedAnnotation:null,_selectedAnnotationObject:null,_isPopupNoteFocused:!1,_colorpickerObject:null,_toolbarColorpickerObject:null,_isBackwardSelection:!1,_isPropertiesWindowOpen:!1,_isAnnotationSelected:!1,_currentAnnotationRectangle:[],_currentAnnotationRectangleBackup:[],_annotationBackupNoteSave:[],_isPopupNoteVisible:!1,_isUnderlineEnabled:!1,_isHighlightEnabled:!1,_isStrikeOutEnabled:!1,_isContextMenuPresent:!1,_isDefaultColorSet:!1,_isTextSelection:!1,_colorPickerStatus:null,_annotationsDeletedNo:null,_selectedValue:null,pageCount:0,currentPageNumber:this._currentPage,zoomPercentage:100,fileName:this._pdfFileName,isDocumentEdited:!1,_init:function(){var i;if(this._actionUrl=this.model.serviceUrl+"/"+this.model.serverActionSettings.load,this._renderViewer(),this._initViewer(),this._createContextMenu(),this._createHighlightContextMenu(),this._createWaterDropDiv(),this._createTouchContextMenu(),this._createPopupMenu(),this._createNote(),this._createPropertiesMenu(),this._createColorPalette(),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._ejDropDownInstance=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),this._getPdfService(this.model.pdfService),this.model.serviceUrl){if(i={},i.viewerAction="GetPageModel",i.controlId=this._id,i.pageindex="1",i.isInitialLoading="true",this.model.documentPath){var r=this.model.documentPath,u=r.split("base64,")[1],f=!1,e=!1;u||(this.model.documentPath.indexOf("\\")!=-1||this.model.documentPath.indexOf("/")!=-1?(f=!0,e=!0,this.model.documentPath.toLowerCase().endsWith(".pdf")||(r=this.model.documentPath+".pdf")):(i.newFileName=r,this._fileName=i.newFileName));i.file=r}i.id=this._createGUID();this._fileId=i.id;this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(i),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}),"_getPageModel")}this._printIframe=document.createElement("iframe")},_getPdfService:function(n){this._pdfService=n==1?t.PdfViewer.PdfService.Local:t.PdfViewer.PdfService.Remote},_initViewer:function(){this._wireEvents();this._initToolbar();this._currentPage=1;this._textMarkupAnnotationList=[];this._newAnnotationList=[];this._colorModifiedAnnotationList=[];this._existingAnnotationsModified=[];this._deletedAnnotationList=[];this._undoAnnotationCollection=[];this._redoAnnotationCollection=[];this._deletedAnnotationCollection=[];this._recentOperation=[];this._annotationsDeletedNo=[];this._redoActions=[];this._totalAnnotations=[];var i=this.model.toolbarSettings;i.templateId||(this._showToolbar(!0),this._showPrintButton(i.toolbarItem&t.PdfViewer.ToolbarItems.PrintTools),this._showZoomControl(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showFittoPage(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showPageNavigationControls(i.toolbarItem&t.PdfViewer.ToolbarItems.PageNavigationTools),this._showDownloadButton(i.toolbarItem&t.PdfViewer.ToolbarItems.DownloadTool),this._showTextSearchButton(i.toolbarItem&t.PdfViewer.ToolbarItems.TextSearchTool),this._showTextMarkupButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.TextMarkupAnnotationTools));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0);this._on(n("#"+this._id+"e-pdf-viewer"),"keydown",this._keyboardShortcutFind)},_unLoad:function(){var i,t;for(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),n("#"+this._id+"_txtpageNo").val(0),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoom"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_search"),i=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i._selectItemByIndex(0),i.disable(),clearTimeout(this._scrollTimer),t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;this._renderedCanvasList&&(this._renderedCanvasList.length=0);this._showloadingIndicator(!1);this._showPageLoadingIndicator(!1);this._raiseClientEvent("documentUnload",null)},_destroy:function(){this._isDestroyed=!0;n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0");n("#"+this._id+"_txtpageNo").val(0);clearTimeout(this._scrollTimer);this._unwireEvents();for(var t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;n("#"+this._id+"_pageviewContainer").remove();n("#"+this._id+"_toolbarContainer").remove();n("#"+this._id+"_viewerContainer").remove();n("#"+this._id+"_viewBlockContainer").remove();n("#"+this._id+"_toolbar_zoomSelection_popup_wrapper").remove();n("#"+this._id+"_rptTooltip").remove();n("#"+this._id+"_loadingIndicator_WaitingPopup").remove();n("#"+this._id+"_viewerContainer_WaitingPopup").remove();n("#"+this._id+"_WaitingPopup").remove();n(this.element).find(".e-pdfviewer-viewer").remove();this._renderedCanvasList.length=0;this._raiseClientEvent("destroy",null)},_renderToolTip:function(){var n=t.buildTag("div.e-pdfviewer-tbdiv e-pdfviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),i=t.buildTag("span.e-pdfviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),r=t.buildTag("span.e-pdfviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});return n.append(i),n.append(r),n},_renderToolBar:function(i){var r,f,e,u,o,h,c,l,s;this.model.toolbarSettings.templateId?(s=document.getElementById(this.model.toolbarSettings.templateId),i.append(s),s.ejToolbar({enableSeparator:!0,height:s.height(),click:this.model.toolbarSettings.click,isResponsive:!0}),s.css("display","block")):(r=t.buildTag("div.e-pdfviewer-toolbarcontainer .e-pdfviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(r),this._isDevice?(f=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(f,"zoomin"),this._appendToolbarItems(f,"zoomout"),this._appendToolbarItems(f,"fitWidth"),this._appendToolbarItems(f,"fitPage"),r.append(f)):(e=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{}),this._appendToolbarItems(e,"gotoprevious"),this._appendToolbarItems(e,"gotonext"),this._appendToolbarItems(e,"gotopage"),r.append(e),u=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_zoomul"}),this._appendToolbarItems(u,"zoomin"),this._appendToolbarItems(u,"zoomout"),this._appendToolbarItems(u,"zoom"),this._appendToolbarItems(u,"fitWidth"),this._appendToolbarItems(u,"fitPage"),r.append(u),o=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_textmarkupul"}),this._appendToolbarItems(o,"underline"),this._appendToolbarItems(o,"strikeout"),this._appendToolbarItems(o,"highlight"),r.append(o),h=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_downloadul"}),this._appendToolbarItems(h,"download"),r.append(h),c=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_printul"}),this._appendToolbarItems(c,"print"),r.append(c),l=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_searchul"}),this._appendToolbarItems(l,"search"),r.append(l),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",cssClass:"e-pdfviewer-ddl",change:this._zoomValChange,selectedItem:0})),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this),isResponsive:!0,overflowClose:n.proxy(this._overflowToolbarClose,this)}),this._toolbar=n("#"+this._id+"_toolbarContainer").data("ejToolbar"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-responsive-toolbar").addClass("e-pdfviewer-responsivesecondarytoolbar"),n("#"+this._id+"_pdfviewer_searchul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_textmarkupul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_downloadul").removeClass("e-separator"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-toolbarspan"))},_appendToolbarItems:function(n,i){var r,g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o,s,h,c,l,a,v,y,p,w,b,k,d;switch(i){case"print":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_Print"});o=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(o);break;case"download":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_download"});s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-download","",{},{id:this._id+"_toolbar_download"});r.append(s);break;case"gotofirst":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotofirst"});h=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotofirst","",{});r.append(h);break;case"gotolast":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotolast"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotolast","",{});r.append(c);break;case"gotonext":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotonext"});l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotonext","",{});r.append(l);break;case"gotoprevious":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotoprevious"});a=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotoprevious","",{});r.append(a);break;case"gotopage":r=t.buildTag("div.e-pdfviewer-tbpage","",{display:"block"},{});v=t.buildTag("input.e-pdfviewer-pagenumber e-pdfviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"});y=t.buildTag("span.e-pdfviewer-labelpageno","",{},{});r.append(v);r.append(y);break;case"zoomin":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomin"});p=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(p);break;case"zoomout":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomout"});w=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(w);break;case"zoom":r=t.buildTag("div.e-pdfviewer-ejdropdownlist","",{},{id:this._id+"_pdfviewer_toolbar_zoom"});var u=t.buildTag("select.e-pdfviewer-tbdiv e-pdfviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"}),g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],nt=g.contextMenu.auto.contentText;u.append("<option Selected>"+nt+"<\/option>");u.append("<option>50%<\/option>");u.append("<option>75%<\/option>");u.append("<option>100%<\/option>");u.append("<option>125%<\/option>");u.append("<option>150%<\/option>");u.append("<option>200%<\/option>");u.append("<option>400%<\/option>");r.append(u);break;case"fitWidth":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitWidth"});b=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitwidth","",{},{id:this._id+"_fitWidth"});r.append(b);break;case"fitPage":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitPage"});k=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitpage","",{},{id:this._id+"_fitPage"});r.append(k);break;case"search":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_search"});d=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-find","",{},{id:this._id+"_find"});r.append(d);break;case"highlight":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-highlight","",{},{id:this._id+"_pdfviewer_toolbar_highlight"});var tt=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-highlight-markup","",{},{id:this._id+"_highlight_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_highlight_dropdown"}),e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_highlight_dropdown_arrow"});f.append(e);r.append(tt);r.append(f);break;case"underline":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-underline","",{},{id:this._id+"_pdfviewer_toolbar_underline"});var it=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-underline-markup","",{},{id:this._id+"_underline_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_underline_dropdown"}),e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_underline_dropdown_arrow"});f.append(e);r.append(it);r.append(f);break;case"strikeout":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-strikeout","",{},{id:this._id+"_pdfviewer_toolbar_strikeout"});var rt=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-strikeout-markup","",{},{id:this._id+"_strikeout_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_strikeout_dropdown"}),e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_strikeout_dropdown_arrow"});f.append(e);r.append(rt);r.append(f)}n.append(r)},_renderViewerBlockinWeb:function(n){var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var r=t.buildTag("table.e-pdfviewer-viewerblockcellcontent","",{margin:"1px",padding:"5px 5px 10px"}),u=t.buildTag("tr","",{width:"100%"}),f=t.buildTag("td.e-pdfviewer-viewerblockcontent","",{});return u.append(f),r.append(u),i.append(r),i},_renderViewerContainer:function(n){var r=t.buildTag("div","",{},{id:this._id+"_pdfviewerContainer"});n.append(r);var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-scrollcontainer e-pdfviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),u=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),f=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),e=t.buildTag("div","",{},{id:this._id+"_pageviewContainer"});return u.append(f),i.append(u),i.append(e),this._isDevice&&this._renderViewerBlockinDevice(i),r.append(i),r},_renderViewer:function(){var u=this.element.height(),f=this.element.width(),n=t.buildTag("div.e-pdfviewer-viewer","",{},{id:this._id+"e-pdf-viewer"}),i,r;this.element[0].style.height||this.element[0].parentElement.clientHeight==0||(this._isHeight=!0);this.element[0].style.width||this.element[0].parentElement.clientWidth==0||(this._isWidth=!0);u===0&&this.element[0].parentElement.clientHeight!=0&&this.element.height(this.element[0].parentElement.clientHeight);f===0&&this.element[0].parentElement.clientWidth!=0&&this.element.width(this.element[0].parentElement.clientWidth);this.element.append(n);this._renderToolBar(n);this._isDevice||(this._renderViewerBlockinWeb(n),i=this._renderToolTip());r=this._renderViewerContainer(n);r.append(i);this._renderSearchBox()},_renderSearchBox:function(){var r=t.buildTag("div.e-pdfviewer-searchbox e-pdfviewer-arrow","",{},{id:this._id+"_pdfviewer_searchbox"}),i=t.buildTag("ul.e-pdfviewer-toolbarul-search","",{}),c,l;r.append(i);var u=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-inputcontainer","",{},{}),a=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Find : ",{float:"left","padding-top":"1px","margin-right":"5px",width:"29px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{}),v=t.buildTag("input.e-pdfviewer-searchinput e-pdfviewer-elementalignments ejinputtext","",{width:"150px"},{id:this._id+"_pdfviewer_searchinput"});u.append(a);u.append(v);var f=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-previous","",{float:"left"},{id:this._id+"_pdfviewer_previous_search"}),e=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-next","",{float:"left"},{id:this._id+"_pdfviewer_next_search"}),h=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-close","",{float:"left","margin-left":"4px"},{id:this._id+"_pdfviewer_close_search"}),y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-prevfind","",{},{id:this._id+"_prevfind"});f.append(y);n(f).css({"pointer-events":"none",opacity:"0.6"});n(e).css({"pointer-events":"none",opacity:"0.6"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-nextfind","",{},{id:this._id+"_nextfind"});e.append(c);var o=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-checkboxcontainer","",{float:"left"},{}),s=t.buildTag("input","",{},{type:"checkbox"}),p=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Match case",{float:"left","padding-top":"3px","margin-left":"5px","margin-top":"4px",width:"67.5px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{});o.append(s);o.append(p);l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closefind","",{},{id:this._id+"_closefind"});h.append(l);i.append(u);i.append(f);i.append(e);i.append(o);i.append(h);r.ejToolbar({enableSeparator:!1,isResponsive:!1,width:"400px",hide:!0});s.ejCheckBox({cssClass:"e-pdfviewer-match-checkbox",id:this._id+"_search_matchcase",size:t.CheckboxSize.Medium,change:n.proxy(this._matchcase,this)});s.ejCheckBox("disable");n("#"+this._id+"_pdfviewerContainer").append(r)},_createColorPalette:function(){var i=t.buildTag("div.e-pdfviewer-colorpicker","",{},{id:this._id+"_pdfviewer_colorpicker"});n("#"+this._id+"_pdfviewerContainer").append(i);i.ejColorPicker({displayInline:!0,modelType:"palette",change:n.proxy(this._setDrawColor,this)});this._toolbarColorpickerObject=i.data("ejColorPicker")},_setContainerSize:function(){var f=document.getElementById(this._id).clientHeight,i=0,t,r,u;this._isDevice||(t=n("#"+this._id+"_viewBlockContainer"),t.css("display").toLowerCase()=="block"&&(i=t.height()));r=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();u=f-i-r-4;n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_setPageSize:function(t,i,r){r=0;var f=n("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect(),u=this;this._renderPreviousPage=!1;n("#"+this._id+"_viewerContainer").unbind("scroll").on("scroll",function(){u._computeCurrentPage(t)});n("#"+this._id+"_pageviewContainer").mouseup(function(n){u._raiseClientEvent("pageClick",n)});this._scrollTimer=setInterval(function(){u._pageviewscrollchanged(t)},500);u._backgroundPage=1;this._previousZoom=1;u._previousPage=u._currentPage;this._pageLocation=[];this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._textDivs=[];this._textContents=[];this._searchMatches=[];this._searchCollection=[];this._pageLocation[1]=0;this._searchedPages=[];this._canvascount=this._totalPages;this._pointers=[];this._imageObj=[];this._pagesGot=[];this._imageSrcCollection=[];this._selectionPages=[];this._designPageCanvas()},_designPageCanvas:function(){var o=5,l=n("#"+this._id+"_pageviewContainer"),c=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewOuterline"),a=c.width(),w=c.height(),v=this._pageWidth,b=this._pageHeight,s=1,i,h,e,y,r,f;for(s=(a-25)/v,s=Math.min(1,s),this._zoomVal=s,i=1;i<=this._totalPages;i++){h=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight)/2:(this.element.width()-this._pageSize[i-1].PageWidth)/2;h<0&&(h=5);e=t.buildTag("div","",{},{id:this._id+"pageDiv_"+i});l.append(e);e.css("position","absolute");e.css("top",this._zoomVal*o);e.css("left",h+"px");this._pageLocation[i]=o;var u=document.createElement("canvas");u.id=this._id+"_secondarycanvas_"+i;u.className="e-pdfviewer-secondarycanvas";u.style.position="absolute";u.style.left=0;u.style.top=0;u.style.backgroundColor="transparent";e.append(u);y=this;r=document.createElement("canvas");r.id=this._id+"pagecanvas_"+i;r.className="e-pdfviewer-pageCanvas";this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(r.width=this._zoomVal*this._pageSize[i-1].PageHeight,r.height=this._zoomVal*this._pageSize[i-1].PageWidth,r.style.height=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageHeight+"px"):(r.style.height=this._zoomVal*this._pageSize[i-1].PageHeight+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.height=this._zoomVal*this._pageSize[i-1].PageHeight,r.width=this._zoomVal*this._pageSize[i-1].PageWidth);r.style.backgroundColor="white";e.append(r);u.height=r.height;u.width=r.width;u.style.height=r.height+"px";u.style.width=r.width+"px";f=document.createElement("div");f.id=this._id+"selectioncanvas_"+i;f.className="e-pdfviewer-selectiondiv";f.style.height=r.height+"px";f.style.width=r.width+"px";f.style.position="absolute";f.style.left=0;f.style.top=0;f.style.backgroundColor="transparent";f.style.zIndex="2";e.append(f);n("#"+this._id+"pageDiv_"+i).ejWaitingPopup({showOnInit:!0,appendTo:"#"+this._id+"pageDiv_"+i,target:"#"+this._id+"pageDiv_"+i});n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").appendTo(n("#"+this._id+"pageDiv_"+i)).css({left:"0px",top:"0px","background-color":"#dbdbdb"});o=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?parseFloat(o)+parseFloat(this._pageSize[i-1].PageWidth)+8:parseFloat(o)+parseFloat(this._pageSize[i-1].PageHeight)+8}this._cummulativeHeight=o},_computeCurrentPage:function(){var u=0,i=0,h=document.getElementById(this._id+"_viewerContainer"),r=h.scrollTop,t;this._zoomVal!=1&&(r=r+this._currentPage*(8-this._zoomVal*8));var e=0,f=0,o={currentPageNumber:0};for(t=0;t<this._totalPages;t++){if(this._isDestroyed)return;if(u>r&&r>=0){i=t;var s=parseFloat(u)-parseFloat(r),c=this.element[0].parentElement.clientHeight-s,l=document.getElementById(this._id+"_viewerContainer");this.element[0].parentElement.clientHeight<this._pageSize[t-1].PageHeight*this._zoomVal+this._pageSize[t].PageHeight*this._zoomVal&&parseInt(this._pageLocation[t]*this._zoomVal)<l.scrollTop&&c>s&&(i=parseFloat(i)+1,this._renderPreviousPage=!0);this._renderPreviousPage=!1;break}else u=this._pageSize[t].PageRotation==90||this._pageSize[t].PageRotation==270?parseFloat(u)+parseFloat(this._pageSize[t].PageWidth*this._zoomVal)+8:parseFloat(u)+parseFloat(this._pageSize[t].PageHeight*this._zoomVal)+8;i=r>=0?t+1:1}n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages);e=document.getElementById(this._id+"_txtpageNo").value;n("#"+this._id+"_txtpageNo").val(i);this._updatePageNavigation(i,this._totalPages);f=document.getElementById(this._id+"_txtpageNo").value;o.currentPageNumber=f;this._currentPage=i;this.currentPageNumber=this._currentPage;e!=f&&this._raiseClientEvent("pageChange",o)},_pageviewscrollchanged:function(){var s=0,h=n("#"+this._id+"_viewerContainer").scrollTop(),c,o,f,l,r,e,u;this._isTargetPage&&this.model.allowClientBuffering&&(this._isTargetPage=!1,this._isBuffering=!0,this._targetPage<=this._totalPages&&(this._isBufferStart||(this._raiseClientEvent("bufferStart",this._isBuffering),this._isBufferStart=!0),c={viewerAction:this._viewerAction.getPageModel,pageindex:this._targetPage.toString(),enableOfflineMode:!0,isPageScrolled:"false"},u=this,this._ajaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(c),traditional:!0,success:function(n){var f,e,r,t;if(jsondata=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),jsondata=jsondata.pdf,f=0,e=!1,jsondata){for(t=u._targetPage;t<=u._totalPages;t++)if(r=jsondata[t],r)u._pageContents[parseInt(r.currentpage)]=JSON.stringify(r),u._pageText[parseInt(r.currentpage)]=r.pageContents,u._pagesGot.push(parseInt(r.currentpage)),f++;else{e=!0;break}if(r==i&&!e)for(t=u._targetPage;t<=u._totalPages;t++)u._pagesGot.indexOf(t)&&f++;u._targetPage=f?u._targetPage+f:u._targetPage;u._targetPage>=u._totalPages&&(u._raiseClientEvent("bufferEnd",this._isBuffering),u._isBufferStart=!1);u._isTargetPage=!0;u._isBuffering=!1}},error:function(){}})));h==this._previousPosition&&(s=this._currentPage,this._totalPages&&this._previousPage!=s&&(o=parseInt(s),this._previousPage=s,o>=1&&o<=this._totalPages&&(this._isJsondataAvailable?(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(o)):(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0")),this._currentPage=o,this._updatePageNavigation(this._currentPage,this._totalPages),this._renderedCanvasList.indexOf(parseInt(this._currentPage))!=-1||this._scrollTriggered&&!this.model.allowClientBuffering||this._pageContents[parseInt(this._currentPage)]||this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))))));this._renderedCanvasList.indexOf(parseInt(this._currentPage))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&this._currentPage<=this._totalPages&&(this._pageContents[parseInt(this._currentPage)]?(e=this._pageContents[parseInt(this._currentPage)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));f=parseInt(this._currentPage)+1;this.model.allowClientBuffering?this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(l=!0,this._isPrintingProcess||(r.isPageScrolled=!1)),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r),l):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages?this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0&&(this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));this._previousPosition=h;u=this;setTimeout(function(){var r;if(n(".e-pdfviewer-formFields").show(),u.model){var f=t.PdfViewer.Locale[u.model.locale]?t.PdfViewer.Locale[u.model.locale]:t.PdfViewer.Locale["default"],i=f.contextMenu.auto.contentText,e=n("#"+u._id+"_toolbar_zoomSelection").data("ejDropDownList"),o=n("#container_toolbar_zoomSelection_hidden").val();n("#"+u._id+"_toolbar_zoomSelection_popup li")[0].innerHTML=i;r=e.selectedIndex();r==0&&isNaN(parseFloat(o))&&(n("#"+u._id+"_toolbar_zoomSelection_hidden").val(i),u._ejDropDownInstance.model.value=i);u._searchBoxLocalization()}u._selectionRange==null||u._displaySearch||(u._selectionNodes.addRange(u._selectionRange),u._selectionRange=null,u._selectionNodes=null)},5e3)},_doAjaxPostscroll:function(t,i,r,u){var f=this;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,success:function(n){var t;typeof n=="object"?f._drawPdfPage(JSON.stringify(n)):f._drawPdfPage(n);f._scrollTriggered=!1;u&&f.model.allowClientBuffering&&(t=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),f._pagesGot.push(parseInt(t.currentpage)),parseInt(t.currentpage)<=f._totalPages&&(f._targetPage=t.currentpage+1,f._isTargetPage=!0))},error:function(n){n.readyState!=0&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_drawPdfPage:function(r){var ci=r,o,vt,p,u,g,ot,s,nt,st,a,h,rt,pt,ui,ut,k,f,ft,ii,at,c,e;if(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),o=parseInt(r.currentpage),this._isWindowResizing||this._showPageLoadingIndicator(o,!0),vt=r.imagestream,p=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage)),(this._pageSize[o-1].PageRotation==90||this._pageSize[o-1].PageRotation==270)&&(p.width=this._zoomVal*this._pageSize[o-1].PageWidth,p.height=this._zoomVal*this._pageSize[o-1].PageHeight,p.style.height=this._zoomVal*this._pageSize[o-1].PageHeight+"px",p.style.width=this._zoomVal*this._pageSize[o-1].PageWidth+"px"),p){if(u=p.getContext("2d"),this._pageContents[parseInt(r.currentpage)]=ci,this._pageText[parseInt(r.currentpage)]=r.pageContents,this._imageObj=[],n("#"+this._id+"selectioncanvas_"+o).hasClass("text_container")?this._resizeSelection(r,o,u):(this._textSelection(r,o,u),this._textMarkupAnnotationList[parseInt(r.currentpage)]=r.textMarkupAnnotation,this._textMarkupAnnotationList[parseInt(r.currentpage)]&&(this._totalAnnotations[o]=r.textMarkupAnnotation.slice())),n("#"+this._id+"selectioncanvas_"+o).hasClass("input_container")?this._generateFormFields(r,o):this._createFormFields(r,o),navigator.userAgent.indexOf("Firefox")!=-1)for(g=vt.textelements,ot=0;ot<g.length;ot++)if(s=g[ot],nt=s.textureBrushs,nt){var li=s.texturFields[0].Image,it="data:image/png;base64,"+li,ri=new Image;ri.src=it;this._imageSrcCollection.push(ri.src)}for(this._isTextSearch&&(e=this,setTimeout(function(){e._isPageScrollHighlight=!0;e._isPageScrolledForSearch=!0;e._highlightOtherOccurrences()},100)),st=n("#"+this._id+"selectioncanvas_"+o).children(),k=0;k<st.length;k++)st[k].hasAttribute("href")&&n(st[k]).remove();var w=r.linkannotation,yt=r.annotpagenum,ht=this;if(this.model.enableHyperlink)for(a=0;a<w.length;a++){if(h=document.createElement("a"),h.id="linkdiv_"+a,rt=w[a].AnnotRectangle,h.style.background="transparent",h.style.position="absolute",h.style.left=this._convertPointToPixel(rt.Left*this._zoomVal)+"px",h.style.top=this._convertPointToPixel(rt.Top*this._zoomVal)+"px",h.style.width=this._convertPointToPixel(rt.Width*this._zoomVal)+"px",h.style.height=this._convertPointToPixel(rt.Height*this._zoomVal)+"px",h.style.color="transparent",w[a].URI.indexOf("mailto:")!=-1?(pt=w[a].URI.substring(w[a].URI.indexOf("mailto:"),w[a].URI.length),h.title=pt,h.setAttribute("href",pt)):(h.title=w[a].URI,h.setAttribute("href",w[a].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(h.target="_self",h.onclick=function(){var n={hyperlink:this.href};ht._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(h.target="_blank",h.onclick=function(){var n={hyperlink:this.href};ht._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(h.onclick=function(){var n={hyperlink:this.href};return ht._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),yt[a]!=i){var ai=this._pageSize[o-1].PageHeight,vi=this._convertPointToPixel(w[a].AnnotLocation),yi=ai-vi,pi=parseFloat(this._pageLocation[yt[a]]*this._zoomVal)+parseFloat(yi*this._zoomVal);h.name=pi;h.onclick=function(){var n=document.getElementById(ht._id+"_viewerContainer");return n.scrollTop=this.name,!1}}yt[a]!=null&&(ui=document.getElementById(this._id+"selectioncanvas_"+o),ui.appendChild(h))}this._textMarkupAnnotationList[o]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[o],o);var v=parseInt(r.currentpage),wt=[],fi=[],wi=[],ei=[],oi=[],bi,b=navigator.userAgent,d,si=0,bt=[],g=vt.textelements;for(ut=0;ut<g.length;ut++){var s=g[ut],kt=s.color,l=s.matrix;l!=null&&(l=l.Elements);var dt=s.brush,y=s.pathValue,ki=s.iscliping,hi=s.restorecanvas,it=s.imagedata,tt=s.fillrule,di=s.isFillandStroke,gi=s.fillcolor,gt=s.strokecolor,ni=s.linewidth,ti=s.linecap,ct=s.linearGradientBrush,nt=s.textureBrushs,lt=s.charID,tr=s.rectvalue;if(y!=null?(y=y.split(";"),lt&&(bt[lt]=y)):y==null&<&&(y=bt[lt]),hi==!1&&u.save(),y!=i&&u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),y!=null){for(u.beginPath(),k=0;k<y.length;k++)f=y[k],ft=f[0],ft=="M"?(f=f.substring(1,f.length),f=f.split(" "),u.moveTo(f[0],f[1])):ft=="L"?(f=f.substring(1,f.length),f=f.split(" "),u.lineTo(f[0],f[1])):ft=="C"?(f=f.substring(1,f.length),f=f.split(" "),u.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5])):ft=="Z"&&u.closePath();ki==!0?(tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(tt)),u.clip()):di==i?dt=="Fill"?(u.fillStyle=ct!=i?this._getGradientBrush(ct,u):nt!=i?this._createTextureBrush(nt,u,s):kt,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill()):dt=="FillandStroke"?(u.fillStyle=kt,u.fill(),u.strokeStyle=gt,u.stroke()):dt=="Stroke"?(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=kt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke(),u.fillStyle=ct!=i?this._getGradientBrush(ct,u):nt!=i?this._createTextureBrush(nt,u,s):gi,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill())}if(hi&&u.restore(),it!=i)if((d=b.indexOf("Firefox"))!=-1||(d=b.indexOf("Chrome"))!=-1||(d=b.indexOf("Safari"))!=-1||(d=b.indexOf("AppleWebKit"))!=-1){wt.push(it);fi.push(l);oi.push(g);ei.push(ut);bi=this._zoomVal;this._isContainImage=!0;break}else ii=new Image,ii.src=it,u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),u.drawImage(ii,0,0,1,1)}if((d=b.indexOf("Firefox"))!=-1||(d=b.indexOf("Chrome"))!=-1||(d=b.indexOf("Safari"))!=-1||(d=b.indexOf("AppleWebKit"))!=-1)for(at=0;at<wt.length;at++)this._imageRendering(g,wi,wt,fi,u,at,oi,ei,bt,p,v,si),si++;if(c=p,e=this,this._pageSize[v-1].PageRotation!=0&&!(it!=i&&b.indexOf("Firefox")!=-1)){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var nr=c.toDataURL(),u=c.getContext("2d"),et=new Image;et.onload=function(){u.clearRect(0,0,c.width,c.height);e._pageSize[v-1].PageRotation==90||e._pageSize[v-1].PageRotation==270?(c.width=e._zoomVal*e._pageSize[v-1].PageHeight,c.height=e._zoomVal*e._pageSize[v-1].PageWidth,c.style.height=e._zoomVal*e._pageSize[v-1].PageWidth+"px",c.style.width=e._zoomVal*e._pageSize[v-1].PageHeight+"px"):(c.width=e._zoomVal*e._pageSize[v-1].PageWidth,c.height=e._zoomVal*e._pageSize[v-1].PageHeight,c.style.width=e._zoomVal*e._pageSize[v-1].PageWidth+"px",c.style.height=e._zoomVal*e._pageSize[v-1].PageHeight+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(e._pageSize[v-1].PageRotation/2*Math.PI/2);u.drawImage(et,-et.width/2,-et.height/2);u.restore()};et.src=nr}return this._showPageLoadingIndicator(o,!1),c}},_convertPointToPixel:function(n){return this._horizontalResolution?parseFloat(n)*(this._horizontalResolution/72):parseFloat(n)*(96/72)},_getRandomNum:function(){return((1+Math.random())*65536|0).toString(16).substring(1)},_createGUID:function(){return"Syncfusion_PDFviewer_"+(this._getRandomNum()+this._getRandomNum()+"-"+this._getRandomNum()+"-4"+this._getRandomNum().substr(0,3)+"-"+this._getRandomNum()+this._getRandomNum()+this._getRandomNum()).toLowerCase()},_createFormFields:function(t,i){var f=t.PdfRenderedFields,p=navigator.userAgent,h=this,u,r,l,c,v,s,o,y,e,w,b,k,a;if(f!=null)for(u=0;u<f.length;u++)if(f[u].PageIndex+1==i){if(l=f[u].LineBounds,f[u].Name=="Textbox")r=document.createElement("input"),r.type="text",e=f[u].BackColor,c=f[u].FontColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].FieldName),v=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",f[u].MaxLength>0&&n(r).attr("maxlength",f[u].MaxLength),f[u].InsertSpaces&&n(r).css("letter-spacing",v),f[u].Text!=""?n(r).val(f[u].Text):n(r).val("");else if(f[u].Name=="Password")r=document.createElement("input"),r.type="password",e=f[u].BackColor,c=f[u].FontColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].FieldName),v=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",f[u].MaxLength>0&&n(r).attr("maxlength",f[u].MaxLength),f[u].InsertSpaces&&n(r).css("letter-spacing",v),f[u].Text!=""?n(r).val(f[u].Text):n(r).val("");else if(f[u].Name=="RadioButton")r=document.createElement("input"),r.type="radio",n(r).css("border-width",f[u].BorderWidth),f[u].Selected==!0&&n(r).prop("checked",!0),n(r).val(f[u].Value),n(r).attr("name",f[u].GroupName),n(r).css("cursor","pointer"),p.indexOf("Chrome")!=-1&&n(r).css("-webkit-apperance","none");else if(f[u].Name=="CheckBox")r=document.createElement("input"),r.type="checkbox",n(r).css("border-width",f[u].BorderWidth),f[u].Selected==!0?n(r).prop("checked",!0):p.indexOf("Chrome")!=-1&&n(r).css("-webkit-appearance","none"),n(r).attr("name",f[u].GroupName),e=f[u].BackColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("cursor","pointer");else if(f[u].Name=="DropDown"){for(r=document.createElement("select"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].Text),f[u].SelectedValue==""&&(o=document.createElement("option"),o.id="dropdownhide",n(o).css("display","none"),o.selected="selected",o.innerHTML="",r.appendChild(o)),s=0;s<f[u].TextList.length;s++)o=document.createElement("option"),o.className="e-dropdownSelect",f[u].SelectedValue==f[u].TextList[s]?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[u].TextList[s],r.appendChild(o);e=f[u].BackColor;n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")")}else if(f[u].Name=="ListBox")for(r=document.createElement("select"),n(r).attr("multiple","multiple"),n(r).attr("name",f[u].Text),s=0;s<f[u].TextList.length;s++){for(o=document.createElement("option"),o.className="e-pdfviewer-ListBox",y=0;y<f[u].SelectedList.length;y++)f[u].SelectedList[y]==s&&n(o).prop("selected",!0);o.innerHTML=f[u].TextList[s];r.appendChild(o);e=f[u].BackColor;n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")")}f[u].Font!=null&&((f[u].Font.Bold||f[u].Font.Italic||f[u].Font.Strikeout||f[u].Font.Underline)&&(f[u].Font.Italic&&(r.style.fontStyle="italic"),f[u].Font.Bold&&(r.style.fontWeight="Bold")),n(r).css("font-family",f[u].Font.Name),w=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",n(r).css("font-size",w));r.id=this._id+"input_"+i+"_"+u;r.className="e-pdfviewer-formFields";r.style.margin="0px";r.style.zIndex=1e3;r.style.left=this._convertPointToPixel(l.X*this._zoomVal)+"px";r.style.top=this._convertPointToPixel(l.Y*this._zoomVal)+"px";r.style.width=this._convertPointToPixel(l.Width*this._zoomVal)+"px";r.style.height=this._convertPointToPixel(l.Height*this._zoomVal)+"px";r.style.position="absolute";b=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("input_container");b.appendChild(r);h=this;a=navigator.userAgent.indexOf("Chrome")!=-1;n(r).on("focus",function(t){var r=n(t.target).attr("type"),e=n(t.target)[0].type,i=n(t.target).css("background-color"),u=i.lastIndexOf(","),f=i.slice(0,u+1)+0+")";(r="checkbox"&&a)&&n(t.target).css("-webkit-appearance","");n(t.target).css("background-color",f);k=t.target.style.borderWidth;n(t.target).css("border-width","0");h._isFormFields=!0});n(r).on("blur",function(t){var e=n(t.target).attr("type"),o=n(t.target)[0].type,i,r,u,f;i=a?n(t.target).css("background-color"):t.target.style["background-color"];r=i.lastIndexOf(",");e=="checkbox"&&n(t.target).prop("selected")==!0?(u=i.slice(0,r+1)+0+")",n(t.target).css("background-color",u)):(f=i.slice(0,r+1)+.2+")",n(t.target).css("background-color",f));n(t.target).css("border-width",k);h._isFormFields=!1});n(r).on("change",function(){h.isDocumentEdited=!0});n(r).unbind("click").on("click touchstart",function(t){var u=n(t.target).attr("type"),o=n(t.target)[0].type,e,f,r,i;if(u=="password"||u=="text"){n(t.target).select();i=n(t.target)[0];n(i).on("keypress",function(t){var u=n(i).attr("maxlength"),r;n(i).val().length>u-2&&(r=n(i).val()+String.fromCharCode(t.keyCode),n(i).val(r),n(i).blur())});n(i).on("keyup",function(){var r=n(i).val(),u=h._pageContents[h._currentPage],f=JSON.parse(u),e=f.PdfRenderedFields,t=i.id.split("_"),o=t[t.length-1];h.isDocumentEdited=r!=e[o].Text?!0:!1});n(i).unbind("change").on("change",function(){var t=n(i).val();n(i).val(t)})}if(u=="radio"){for(e=n(t.target).attr("name"),f=n(".e-pdfviewer-formFields:radio"),r=0;r<f.length;r++)n(f[r]).attr("name")==e&&n(f[r]).prop("checked",!1);n(t.target).prop("checked",!0)}else if(u=="checkbox")n(t.target).prop("checked")==!0?(n(t.target).prop("checked",!0),a&&n(t.target).css("-webkit-appearance","")):(n(t.target).prop("checked",!1),a&&n(t.target).css("-webkit-appearance","none"));else if(o=="select-one"){h.isDocumentEdited=!0;i=n(t.target)[0];n(i).unbind("change").on("change",function(t){for(var u=n(t.target)[0],f=u.options[u.selectedIndex].text,r=u.children,i=0;i<r.length;i++)r[i].text==f?n(r[i]).prop("selected",!0):n(r[i]).prop("selected",!1)})}})}},_saveFormFieldsValue:function(){var s={},h={},r,c,l,p,a,y,i,o,f,t,e,u,v;if(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("visibility",""),r=n(".e-pdfviewer-formFields"),r!=null)for(i=0;i<r.length;i++)if(r[i].type=="text"||r[i].type=="password")s[r[i].name]=r[i].value;else if(r[i].type=="radio"&&n(r[i]).prop("checked")==!0)s[r[i].name]=r[i].value;else if(r[i].type=="checkbox")s[r[i].name]=n(r[i]).prop("checked")==!0?n(r[i]).prop("checked"):n(r[i]).prop("checked");else if(r[i].type=="select-one")s[r[i].name]=r[i].options[r[i].selectedIndex].text;else if(r[i].type=="select-multiple"){for(c=[],l=n(r[i]).children(),f=0;f<l.length;f++)n(l[f]).prop("selected")==!0&&c.push(l[f].text);c=JSON.stringify(c);s[r[i].name]=c}for(p=[],i=1;i<=this._totalPages;i++){if(o=[],a=this._textMarkupAnnotationList[i],a)for(f=0;f<a.length;f++)if(t=a[f],t)for(e=t.Opacity,t.TextMarkupAnnotationType=="Highlight"&&(e=e*.5),t.Author==null&&(t.Author=this.model.strikethroughSettings.author),u=0;u<t.Bounds.length;u++)v={index:t.index,colorA:t.Opacity*255,colorR:t.Color.R,colorG:t.Color.G,colorB:t.Color.B,opacity:e,type:t.TextMarkupAnnotationType,author:t.Author,subject:t.Subject,text:t.note,xPosition:t.Bounds[u].X,yPosition:t.Bounds[u].Y,height:t.Bounds[u].Height,width:t.Bounds[u].Width},o.push(v);p[i-1]=o}for(y=[],i=1;i<=this._totalPages;i++){for(o=[],y[i-1]=o,f=0;f<this._newAnnotationList[i-1].length;f++)for(t=this._newAnnotationList[i-1][f],e=t.opacity,t.type=="Highlight"&&(e=e*.5),u=0;u<t.bounds.length;u++)v={type:t.type,xPosition:t.bounds[u].xPosition,yPosition:t.bounds[u].yPosition,height:t.bounds[u].height,width:t.bounds[u].width,colorA:t.colorA,colorR:t.colorR,colorG:t.colorG,colorB:t.colorB,opacity:e,author:t.author,subject:t.subject,text:t.note},o.push(v);y[i-1]=o}h.savetextMarkupAnnotation=JSON.stringify(y);h.existingAnnotations=JSON.stringify(p);h.savedFields=JSON.stringify(s);h.id=this._fileId;this._saveAs("POST",this.model.serviceUrl,JSON.stringify(h))},_saveAs:function(t,i,r){var u=this;n.ajax({type:t,url:i+"/"+this.model.serverActionSettings.download,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,async:this._isAsynchronousDownload,success:function(n){n&&u._save(n)},error:function(n){u._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_generateFormFields:function(t,i){var f=t.PdfRenderedFields,r,h,u,c,l,a,s,o,e,v;if(f!=null)for(r=0;r<f.length;r++)if(h=f[r].LineBounds,u=document.getElementById(this._id+"input_"+i+"_"+r),f[r].PageIndex+1==i){if(f[r].Name=="Password"||f[r].Name=="Textbox")e=f[r].BackColor,c=f[r].FontColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(u).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(u).css("border-width",f[r].BorderWidth),l=this._convertPointToPixel(f[r].Font.Height*this._zoomVal)+"px",f[r].MaxLength>0&&n(u).attr("maxlength",f[r].MaxLength),f[r].InsertSpaces&&n(u).css("letter-spacing",l),a=n(u).val(),n(u).val(a);else if(f[r].Name=="RadioButton")n(u).css("border-width",f[r].BorderWidth),n(u).prop("checked")==!0&&n(u).prop("checked",!0),n(u).attr("name",f[r].GroupName),n(u).css("cursor","pointer");else if(f[r].Name=="CheckBox")n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(u).css("border-width",f[r].BorderWidth),n(u).prop("checked")==!0&&n(u).prop("checked",!0),n(u).css("cursor","pointer");else if(f[r].Name=="DropDown")for(n(u).css("border-width",f[r].BorderWidth),f[r].SelectedValue==""&&(o=n(u).children()[0],o.id="dropdownhide",n(o).css("display","none"),n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=""),s=0;s<f[r].TextList.length;s++)o=n(u).children()[0].id=="dropdownhide"?n(u).children()[s+1]:n(u).children()[s],n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=f[r].TextList[s],e=f[r].BackColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");else if(f[r].Name=="ListBox")for(n(u).attr("multiple","multiple"),s=0;s<f[r].TextList.length;s++)o=n(u).children()[s],n(o).prop("selected")==!0?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[r].TextList[s],e=f[r].BackColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");f[r].Font!=null&&((f[r].Font.Bold||f[r].Font.Italic||f[r].Font.Strikeout||f[r].Font.Underline)&&(f[r].Font.Italic&&(u.style.fontStyle="italic"),f[r].Font.Bold&&(u.style.fontWeight="Bold")),n(u).css("font-family",f[r].Font.Name),v=this._convertPointToPixel(f[r].Font.Height*this._zoomVal)+"px",n(u).css("font-size",v));u.style.margin="0px";u.style.zIndex=1e3;u.style.left=this._convertPointToPixel(h.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(h.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(h.Width*this._zoomVal)+"px";u.style.height=this._convertPointToPixel(h.Height*this._zoomVal)+"px";u.style.position="absolute"}},_textSelection:function(t,i,r){for(var f,p,w,b,k,v,c,l,d,ut=navigator.userAgent.indexOf("Edge")!=-1,g=document.documentMode||/Edge/.test(navigator.userAgent),nt=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,s=t.selection,y=[],a=[],e=0;e<s.length;e++){var h=" ",o=s[e].LineBounds,u=document.createElement("DIV");u.id=this._id+"text_"+i+"_"+e;u.className="e-pdfviewer-textLayer";f=s[e].Line;f=f.replace(/</g,"<");f=f.replace(/>/g,">");var tt=new RegExp("[\x00-€]+"),it=tt.test(f),rt=this._isRtl(f);!it&&rt?(p=new RegExp(String.fromCharCode(160),"g"),f=f.replace(p," "),f=f.split("").reverse().join(""),a.push(f)):a.push(s[e].Line.toString());g&&!nt?u.innerHTML=f:((this._previousBounds==parseInt(o.Y)||this._previousBounds==parseInt(o.Y+1)||this._previousBounds==parseInt(o.Y-1))&&(h=document.getElementById(this._id+"text_"+i+"_"+(e-1)),h.innerHTML!=" "&&(h.innerHTML=h.innerHTML.replace(/(\r\n|\n|\r)/gm,""))),this._previousBounds=parseInt(o.Y),u.innerHTML=f+"\r\n");w=f.replace(/ +/g," ");w!=" "&&(u.style.whiteSpace="pre");u.style.background="transparent";u.style.position="absolute";u.style.left=this._convertPointToPixel(o.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(o.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(o.Width*this._zoomVal)+"px";u.style.color="transparent";u.style.fontSize=this._convertPointToPixel(o.Height*this._zoomVal)+"px";u.style.fontFamily="sans-serif";u.style.opacity="0.2";u.style.transformOrigin="0%";r.fontFamily="sans-serif";r.fontSize=u.style.fontSize;r.font=u.style.fontSize+" "+u.style.fontFamily;b=r.measureText(s[e].Line).width;k=parseFloat(u.style.width)/b;u.style.transform="scaleX("+k+")";v=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("text_container");v.appendChild(u);c=v.getBoundingClientRect();l=u.getBoundingClientRect();(l.width+l.left>=c.width+c.left||l.width>c.width)&&(n(u).css("width","auto"),d=u.clientWidth,n(u).css("width",d+"px"));y.push(u)}this._previousBounds=null;this._textDivs[i]=y;this._textContents[i]=a},_resizeSelection:function(t,i,r){for(var e,u,c,l,a,v,y,o=t.selection,f=0;f<o.length;f++)if(e=o[f].LineBounds,u=document.getElementById(this._id+"text_"+i+"_"+f),u){c=o[f].Line;u.style.position="absolute";u.style.left=this._convertPointToPixel(e.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(e.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(e.Width*this._zoomVal)+"px";l=c.replace(/ +/g," ");l!=" "&&(u.style.whiteSpace="pre");u.style.transformOrigin="0%";u.style.opacity="0.2";u.style.fontSize=this._convertPointToPixel(e.Height*this._zoomVal)+"px";r.font=u.style.fontSize+" "+u.style.fontFamily;r.fontSize=u.style.fontSize;a=r.measureText(o[f].Line).width;v=parseFloat(u.style.width)/a;u.style.transform="scaleX("+v+")";var p=document.getElementById(this._id+"selectioncanvas_"+i),s=p.getBoundingClientRect(),h=u.getBoundingClientRect();(h.width+h.left>=s.width+s.left||h.width>s.width)&&(n(u).css("width","auto"),y=u.clientWidth,n(u).css("width",y+"px"))}},_maintainSelection:function(){var n=this._selectionNodes,t=document.createRange(),i,r;n.anchorNode!=null&&(i=n.anchorNode.compareDocumentPosition(n.focusNode),r=!1,(!i&&n.anchorOffset>n.focusOffset||i===Node.DOCUMENT_POSITION_PRECEDING)&&(r=!0),r?(t.setStart(n.focusNode,n.focusOffset),t.setEnd(n.anchorNode,n.anchorOffset)):(t.setStart(n.anchorNode,n.anchorOffset),t.setEnd(n.focusNode,n.focusOffset)),this._selectionRange=t);n.removeAllRanges()},_showPageLoadingIndicator:function(t,i){i?n("#"+this._id+"pageDiv_"+t+"_WaitingPopup").css("display","block"):n("#"+this._id+"pageDiv_"+t+"_WaitingPopup").css("display","none")},_imageRendering:function(n,t,r,u,f,e,o,s,h,c,l,a){var y=this._zoomVal,p=new Image,v=this,w=navigator.userAgent;p.onload=function(){for(var nt,d,ht,st,e,rt,pt=!1,g=0;g<u.length;g++)if(pt==!1)for(nt=u[g],f.setTransform(nt[0]*y,nt[1]*y,nt[2]*y,nt[3]*y,nt[4]*y,nt[5]*y),t[a]!=i&&f.drawImage(t[a],0,0,1,1),d=s[g],d=d+1,ht=o[g];d<ht.length;){var p=ht[d],ct=p.color,b=p.matrix;b!=null&&(b=b.Elements);var lt=p.brush,k=p.pathValue,kt=p.iscliping,wt=p.restorecanvas,bt=p.imagedata,tt=p.fillrule,dt=p.isFillandStroke,gt=p.fillcolor,at=p.strokecolor,vt=p.linewidth,yt=p.linecap,ft=p.linearGradientBrush,et=p.textureBrushs,ot=p.charID,ti=p.rectvalue;if(k!=null?(k=k.split(";"),ot&&(h[ot]=k)):k==null&&ot&&(k=h[ot]),wt==!1&&f.save(),k!=i&&f.setTransform(b[0]*y,b[1],b[2],b[3]*y,b[4]*y,b[5]*y),k!=null){for(f.beginPath(),st=0;st<k.length;st++)e=k[st],rt=e[0],rt=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):rt=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):rt=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):rt=="Z"&&f.closePath();kt==!0?(tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(tt)),f.clip()):dt==i?lt=="Fill"?(f.fillStyle=ft!=i?v._getGradientBrush(ft,f):et!=i?v._createTextureBrush(et,f,p):ct,tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(tt)),f.fill()):lt=="FillandStroke"?(f.fillStyle=ct,f.fill(),f.strokeStyle=at,f.stroke()):lt=="Stroke"?(f.strokeStyle=at,f.lineWidth=vt,f.lineCap=yt,f.stroke()):(f.strokeStyle=ct,f.lineWidth=vt,f.lineCap=yt,f.stroke()):(f.strokeStyle=at,f.lineWidth=vt,f.lineCap=yt,f.stroke(),f.fillStyle=ft!=i?v._getGradientBrush(ft,f):et!=i?v._createTextureBrush(et,f,p):gt,tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(tt)),f.fill())}if(wt&&f.restore(),bt!=i){pt=!0;r.pop();u.pop();o.pop();s.pop();r.push(bt);u.push(b);o.push(n);s.push(d);g=-1;a++;break}d++}else v._imageRendering(n,t,r,u,f,g,o,s,h,c,l,a),a++;if(d==n.length&&v._pageSize[l-1].PageRotation!=0){var w=document.getElementById(v._id+"pagecanvas_"+l),ni=w.toDataURL(),it=w.getContext("2d"),ut=new Image;ut.onload=function(){it.clearRect(0,0,w.width,w.height);v._pageSize[l-1].PageRotation==90||v._pageSize[l-1].PageRotation==270?(w.width=v._zoomVal*v._pageSize[l-1].PageHeight,w.height=v._zoomVal*v._pageSize[l-1].PageWidth,w.style.height=v._zoomVal*v._pageSize[l-1].PageWidth+"px",w.style.width=v._zoomVal*v._pageSize[l-1].PageHeight+"px"):(w.width=v._zoomVal*v._pageSize[l-1].PageWidth,w.height=v._zoomVal*v._pageSize[l-1].PageHeight,w.style.width=v._zoomVal*v._pageSize[l-1].PageWidth+"px",w.style.height=v._zoomVal*v._pageSize[l-1].PageHeight+"px");it.save();it.translate(w.width/2,w.height/2);it.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);it.drawImage(ut,-ut.width/2,-ut.height/2);it.restore()};ut.src=ni}};p.src=r[e];t.push(p);this._imageObj.push(p)},_createTextureBrush:function(n,t,i){var e=i.texturFields[0].Image,u=i.texturFields[0].Width,f=i.texturFields[0].Height,o="data:image/png;base64,"+e,r=new Image;navigator.userAgent.indexOf("Firefox")!=-1?(r.src=this._imageSrcCollection[0],this._loadimages(r,u,f,t),this._imageSrcCollection.shift()):(r.src=o,this._loadimages(r,u,f,t))},_loadimages:function(n,t,i,r){var u=document.createElement("canvas"),e=u.getContext("2d"),f;return u.width=t,u.height=i,e.drawImage(n,0,0,n.width,n.height,0,0,u.width,u.height),f=r.createPattern(u,"repeat"),r.fillStyle=f,r.fill(),f},_getGradientBrush:function(n,t){for(var i,s,r=n.Rectangle,f=n.InterpolationColors,h=f.Colors,e=f.Positions,o=t.createLinearGradient(r.X,r.Y,r.Width,r.Height),u=0;u<e.length;u++)i=h[u],i=i.split(","),s=this._rgb2Color(i[0],i[1],i[2]),o.addColorStop(e[u],s);return o},_rgb2Color:function(n,t,i){return"#"+this._byte2Hex(n)+this._byte2Hex(t)+this._byte2Hex(i)},_byte2Hex:function(n){var t="0123456789ABCDEF";return String(t.substr(n>>4&15,1))+t.substr(n&15,1)},_doAjaxPost:function(t,i,r,u){var f=this,e=u;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);this._ajaxRequestState=n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,success:function(n){var i,r,t,u,o,s;typeof n=="object"&&(n=JSON.stringify(n));i=JSON.parse(n);r=i.pagecount;r==0?f._unLoad():(typeof n=="object"?f[e](JSON.stringify(n)):f[e](n),t=i.filename.split("\\"),u=t.length>1?t[t.length-1]:f._fileName!=""&&f._fileName!=null?f._fileName:null,o={fileName:u},f._raiseClientEvent("documentLoad",o),f.model.allowClientBuffering&&(s=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),f._pagesGot.push(parseInt(s.currentpage))))},error:function(n){(e=="_clearCurrentServerCache"||n.readyState!=0)&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_raiseClientEvent:function(i,r){var f=this.model[i],e=[],u;e=r===null?"":r;f&&(typeof f=="string"&&(f=t.util.getObject(f,window)),n.isFunction(f)&&(i=="pageChange"?u={currentPageNumber:parseInt(r.currentPageNumber)}:i=="zoomChange"?u={previousZoomPercentage:r.previousZoomPercentage,currentZoomPercentage:r.currentZoomPercentage}:i=="hyperlinkClick"?u={hyperlink:r.hyperlink}:i=="pageClick"?u={XCoordinate:r.offsetX,YCoordinate:r.offsetY}:i=="bufferStart"?u={isBuffering:!0}:i=="bufferEnd"?u={isBuffering:!1}:i=="documentLoad"?u={fileName:r.fileName}:i=="ajaxRequestFailure"?u={message:r}:i=="annotationAdd"?u={annotationSettings:r.annotationSettings,annotationID:r.annotationId,pageID:r.pageId,annotationBound:r.annotationBound,annotationType:r.annotationType}:i=="annotationRemove"?u={annotationID:r.annotationId,pageID:r.pageId,annotationType:r.annotationType}:i=="annotationPropertiesChange"?u={annotationID:r.annotationId,pageID:r.pageId,annotationType:r.annotationType,isColorChanged:r.isColorChanged,isOpacityChanged:r.isOpacityChanged}:i=="annotationResize"&&(u={annotationSettings:r.annotationSettings,annotationID:r.annotationID,pageID:r.pageID,annotationBound:r.annotationBound,annotationType:r.annotationType}),this._trigger(i,u)))},_getPageModel:function(i){var r,u;if(this._on(n(window),"resize",this._viewerResize),i&&(this._isJsondataAvailable=!0),(i==""||i==null)&&(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0")),r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),r){for(this._pageWidth=r.pagewidth,this._pageHeight=r.pageheight,this._imageUrl=r.imageurl,this._pageSize=r.pagesize,this._totalPages=r.pagecount,this.pageCount=this._totalPages,this._pdfFileName=r.filename,this.fileName?this._pdfFileName=this.fileName:this._pdfFileName&&(this.fileName=this._pdfFileName),this._currentPage=r.currentpage,this._restrictionSummary=r.restrictionSummary,this._horizontalResolution=r.horizontalResolution,this._isRestrictionEnabled(),this._isPrintRestrict?this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"):this._isPrintRestrict||this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_Print"),this.currentPageNumber=this._currentPage,this._isToolbarClick||this._enableToolbarItems(),this._gotoPage(this._currentPage),this._toolbarResizeHandler(),this._setSearchToolbarTop(),this._resizeSearchToolbar(),this._drawPdfPage(i),u=0;u<this._totalPages;u++)this._newAnnotationList[u]=[],this._colorModifiedAnnotationList[u]=[],this._deletedAnnotationList[u]=[],this._existingAnnotationsModified[u]=[],this._redoAnnotationCollection[u]=[],this._annotationsDeletedNo[u]=0,this._totalAnnotations[u+1]=[];this._showNavigationIndicator(!1);this._showloadingIndicator(!1)}},_isRestrictionEnabled:function(){if(this._restrictionSummary)for(var n=0;n<this._restrictionSummary.length;n++)switch(this._restrictionSummary[n]){case"Print":this._isPrintRestrict=!0;break;case"CopyContent":this._isCopyRestrict=!0;break;default:this._isPrintRestrict=!1;this._isCopyRestrict=!1}},_print:function(){this._abortPrinting=!1;this._isPrintingProcess=!0;this._raiseClientEvent("beforePrint",null);this._showPrintLoadingIndicator(!0);this._setViewerForPrint();this._scrollPageByPage()},_setViewerForPrint:function(){this._isPrinting=!0;this._currentPageBackup=this._currentPage;this._scrollTop=n("#"+this._id+"_viewerContainer").scrollTop();this._zoomValBackup=this._zoomVal;this._zoomLevelBackup=this._zoomLevel;this._zoomVal!=1&&(this._zoomVal=1,this._zoomLevel=2,this._fitTypeBackup=this._fitType,this._zoomContainer(this._zoomVal,!1))},_scrollPageByPage:function(){for(var i,t,r,n=1;n<=this._totalPages;n++)if(this._scrollTriggered=!1,i=this._scrollToPageNo(n),i)break;this._isPrinting=!1;i||(t=navigator.userAgent,t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("Firefox")!=-1?(r=this,setTimeout(function(){r._printPages()},1e3)):this._printPages(),this._raiseClientEvent("afterPrint",null))},_scrollToPageNo:function(n){var r=this._currentPage,t,i;if(this._totalPages&&(t=parseInt(n),t>=1&&t<=this._totalPages))return this._currentPage=t,i=document.getElementById(this._id+"_viewerContainer"),i.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._scrollPage(this._pageHeight)},_scrollPage:function(){var n,i;return this._scrollTriggered=!0,n={},n.viewerAction=this._viewerAction.getPageModel,n.pageindex=this._currentPage.toString(),n.id=this._fileId,i=this.model.serviceUrl+"/"+this.model.serverActionSettings.print,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostPrint("POST",i,JSON.stringify(n)):this._doAjaxPostPrint("POST",this.model.serviceUrl,JSON.stringify({jsonResult:n})),!0},_printPages:function(){var o=navigator.userAgent,i=this,s=this._printIframe,u,t,p,d,g,nt,rt,w,it,v;for(s.name="printFrame",s.style.position="absolute",s.style.top="-100000000px",document.body.appendChild(s),u=s.contentWindow?s.contentWindow:s.contentDocument.document?s.contentDocument.document:s.contentDocument,u.document.open(),o.indexOf("Edge")==-1?o.indexOf("Chrome")!=-1||o.indexOf("Safari")!=-1||o.indexOf("Firefox")!=-1?(u.document.write("<!DOCTYPE html>"),u.document.write("<html moznomarginboxes mozdisallowselectionprint><head><style>html, body { height: 100%; } img { height: 100%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(u.document.write("<!DOCTYPE html>"),u.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(u.document.write("<!DOCTYPE html>"),u.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")),t=1;t<=i._totalPages;t++){var y="",c="",e=document.getElementById(this._id+"pagecanvas_"+t),k=document.getElementById(this._id+"selectioncanvas_"+t),f=document.getElementById(this._id+"_secondarycanvas_"+t);if(y=e.toDataURL(),p=f.toDataURL(),window.innerWidth<screen.width?(c=i._zoomVal,i._topValue=!0,d=i._pageContents[parseInt(t)],g=i._printPdfPages(d),y=g.toDataURL(),p=f.toDataURL()):c=1,o.indexOf("Firefox")==-1&&i._pageSize[t-1].PageWidth>i._pageSize[t-1].PageHeight){var l=e.getContext("2d"),a=f.getContext("2d"),h=new Image;l.clearRect(0,0,e.width,e.height);e.width=i._pageSize[t-1].PageHeight;e.height=i._pageSize[t-1].PageWidth;e.style.height=i._pageSize[t-1].PageWidth+"px";e.style.width=i._pageSize[t-1].PageHeight+"px";l.save();l.translate(e.width/2,e.height/2);l.rotate(-Math.PI/2);h.src=y;l.drawImage(h,-h.width/2,-h.height/2);l.restore();y=e.toDataURL();a.clearRect(0,0,f.width,f.height);f.width=i._pageSize[t-1].PageHeight;f.height=i._pageSize[t-1].PageWidth;f.style.height=i._pageSize[t-1].PageWidth+"px";f.style.width=i._pageSize[t-1].PageHeight+"px";a.save();a.translate(f.width/2,f.height/2);a.rotate(-Math.PI/2);h.src=p;a.drawImage(h,-h.width/2,-h.height/2);a.restore();p=f.toDataURL()}for(u.document.write('<div style="margin:0px;width:816px;height:1056px;position:relative"><img src="'+y+'" id="image_'+t+'" /><img src="'+p+'" id = "secimage_'+t+'" style="margin:0px;top:0px;left:0px;position:absolute;width:816px;height:1056px;z-index:2" /><div id="fields_'+t+'"><\/div><\/div><br/>'),nt=n(k).find(".e-pdfviewer-formFields").length,rt=2,w=0;w<nt;w++){var tt="",b=n(k).find(".e-pdfviewer-formFields")[w],r=b.cloneNode(!0);b.type=="select-one"&&(tt=b.selectedIndex,it=r.children,n(it[tt]).prop("selected",!0));var ut=i._pageSize[t-1].PageWidth,ft=i._pageSize[t-1].PageHeight,et=ft/1056,ot=ut/816,st=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0;(st||o.indexOf("Edge")!=-1)&&(n(r).css("left",parseFloat(n(r).css("left"))+"px"),n(r).css("top",parseFloat(n(r).css("top"))-6+"px"));window.innerWidth<screen.width&&(n(r).css("left",parseFloat(n(r).css("left"))/c+"px"),n(r).css("top",parseFloat(n(r).css("top"))/c+"px"));n(r).css("left",parseFloat(n(r).css("left"))/ot+"px");n(r).css("top",parseFloat(n(r).css("top"))/et+"px");n(r).css("width",parseFloat(n(r).css("width"))/c+"px");n(r).css("height",parseFloat(n(r).css("height"))/c+"px");n(u.document.getElementById("fields_"+t)).append(r)}}if(this._topValue=!1,u.document.write("<\/center><\/body><\/html>"),navigator.userAgent.match("Firefox")?window.frames.printFrame.close():u.document.close(),o.indexOf("Edge")==-1)if(o.indexOf("Chrome")!=-1||o.indexOf("Safari")!=-1||o.indexOf("Firefox")!=-1)i=this,setTimeout(function(){window.frames.printFrame.focus();window.frames.printFrame.print();document.body.removeChild(s)},500);else{v=n("iframe")[0];try{v.contentWindow.document.execCommand("print",!1,null)}catch(ht){v.contentWindow.print()}}else{v=n("iframe")[0];try{v.contentWindow.document.execCommand("print",!1,null)}catch(ht){v.contentWindow.print()}}this._restoreViewer()},_printCancel:function(){this._abortPrinting=!0;this._restoreViewer();this._raiseClientEvent("afterPrint",null)},_restoreViewer:function(){var n,t,i,r;for(this._isPrintingProcess=!1,this._currentPage=this._currentPageBackup,this._zoomVal=this._zoomValBackup,this._zoomLevel=this._zoomLevelBackup,n=1;n<=this._totalPages;n++)t=document.getElementById(this._id+"pagecanvas_"+n),this._pageSize[n-1].PageWidth>this._pageSize[n-1].PageHeight&&(t.style.height=this._pageSize[n-1].PageHeight+"px",t.style.width=this._pageSize[n-1].PageWidth+"px",t.width=this._pageSize[n-1].PageWidth,t.height=this._pageSize[n-1].PageHeight,this._renderedCanvasList.length=0);this._fitTypeBackup==null?this._zoomContainer(this._zoomVal,!1):(i=this._fitToPage(this._fitTypeBackup),this._applyDropDownVal(i,!0,!1),this._updatePageFitModel(this._fitType));r=document.getElementById(this._id+"_viewerContainer");r.scrollTop=this._scrollTop;this._showPrintLoadingIndicator(!1)},_doAjaxPostPrint:function(i,r,u){var e=JSON.parse(u),o,f;this._pdfService==t.PdfViewer.PdfService.Local?this._currentPrintPage=e.pageindex:(o=e.jsonResult,this._currentPrintPage=o.pageindex);this.model.allowClientBuffering&&this._isBuffering&&this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);f=this;n.ajax({type:i,url:r,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:u,traditional:!0,success:function(n){var i,u,r;(typeof n=="object"?f._printPdfPages(JSON.stringify(n)):f._printPdfPages(n),f._scrollTriggered=!1,f._abortPrinting)||(parseFloat(f._currentPrintPage)<f.pageCount?(i={},i.viewerAction=f._viewerAction.getPageModel,i.pageindex=(parseFloat(f._currentPrintPage)+1).toString(),i.id=f._fileId,u=f.model.serviceUrl+"/"+f.model.serverActionSettings.print,f._pdfService==t.PdfViewer.PdfService.Local?f._doAjaxPostPrint("POST",u,JSON.stringify(i)):f._doAjaxPostPrint("POST",f.model.serviceUrl,JSON.stringify({jsonResult:i}))):(r=navigator.userAgent,r.indexOf("Chrome")!=-1||r.indexOf("Safari")!=-1||r.indexOf("Firefox")!=-1?setTimeout(function(){f._printPages()},1e3):f._printPages(),f._raiseClientEvent("afterPrint",null)))},error:function(n){n.readyState!=0&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_printPdfPages:function(r){var ht=0,ti=r,a,ct,e,l,k,ft,nt,y,s,d,st,o,f;if(jsondata=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),a=parseInt(jsondata.currentpage),this._showPageLoadingIndicator(a,!0),ct=jsondata.imagestream,e=parseInt(jsondata.currentpage),this._renderedCanvasList.indexOf(e)==-1&&this._renderedCanvasList.push(parseInt(jsondata.currentpage)),this._pageContents[a]||(this._textMarkupAnnotationList[parseInt(jsondata.currentpage)]=jsondata.textMarkupAnnotation),this._pageContents[parseInt(jsondata.currentpage)]=ti,(this._textMarkupAnnotationList[a]||this._newAnnotationList[pageIndex-1])&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[a],a),this._topValue==!0){var lt=parseInt(jsondata.currentpage),l=document.createElement("canvas"),at=this._pageSize[lt-1].PageHeight,vt=this._pageSize[lt-1].PageWidth;l.style.visibility="hidden";l.style.width=vt+"px";l.style.height=at+"px";l.style.backgroundColor="white";l.className="e-pdfviewer-pageCanvas";l.height=at;l.width=vt}else l=document.getElementById(this._id+"pagecanvas_"+parseInt(jsondata.currentpage));(this._pageSize[e-1].PageRotation==90||this._pageSize[e-1].PageRotation==270)&&(l.height=this._zoomVal*this._pageSize[e-1].PageHeight,l.width=this._zoomVal*this._pageSize[e-1].PageWidth,l.style.width=this._zoomVal*this._pageSize[e-1].PageWidth+"px",l.style.height=this._zoomVal*this._pageSize[e-1].PageHeight+"px");var u=l.getContext("2d"),ut=[],yt=[],ii=[],w=navigator.userAgent,g,pt=[];for(this._regenerateFormFields(jsondata,a),k=n("#"+this._id+"selectioncanvas_"+a).children(),y=0;y<k.length;y++)(k[y].hasAttribute("href")||n(k[y]).hasClass("e-pdfviewer-formFields"))&&n(k[y]).remove();for(this._createFormFields(jsondata,a),ft=ct.textelements,nt=0;nt<ft.length;nt++){var h=ft[nt],et=h.color,c=h.matrix;c!=null&&(c=c.Elements);var wt=h.brush,v=h.pathValue,ri=h.iscliping,bt=h.restorecanvas,ot=h.imagedata,b=h.fillrule,ui=h.isFillandStroke,fi=h.fillcolor,kt=h.strokecolor,dt=h.linewidth,gt=h.linecap,tt=h.linearGradientBrush,it=h.textureBrushs,rt=h.charID;if(v!=null?(v=v.split(";"),rt&&(pt[rt]=v)):v==null&&rt&&(v=pt[rt]),bt==!1&&u.save(),v!=i&&u.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]),v!=null){for(u.beginPath(),y=0;y<v.length;y++)s=v[y],d=s[0],d=="M"?(s=s.substring(1,s.length),s=s.split(" "),u.moveTo(s[0],s[1])):d=="L"?(s=s.substring(1,s.length),s=s.split(" "),u.lineTo(s[0],s[1])):d=="C"?(s=s.substring(1,s.length),s=s.split(" "),u.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])):d=="Z"&&u.closePath();ri==!0?(b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(b)),u.clip()):ui==i?wt=="Fill"?(u.fillStyle=tt!=i?this._getGradientBrush(tt,u):it!=i?this._createTextureBrush(it,u,h):et,b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(b)),u.fill()):wt=="FillandStroke"?(u.fillStyle=et,u.fill(),u.strokeStyle=kt,u.stroke()):(u.strokeStyle=et,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke(),u.fillStyle=tt!=i?this._getGradientBrush(tt,u):it!=i?this._createTextureBrush(it,u,h):fi,b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(b)),u.fill())}bt&&u.restore();ot!=i&&((g=w.indexOf("Firefox"))==-1&&(g=w.indexOf("Chrome"))==-1&&(g=w.indexOf("Safari"))==-1&&(g=w.indexOf("AppleWebKit"))==-1||this._topValue?(st=new Image,st.src=ot,u.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]),u.drawImage(st,0,0,1,1)):(ut.push(ot),yt.push(c),this._printWinImageRendering(ut,yt,ii,u,l,ht,e),ht++))}if(o=l,f=this,this._pageSize[e-1].PageRotation!=0&&!(ut.length!=0&&(w.indexOf("Firefox")!=-1||w.indexOf("Chrome")!=-1))){o=document.getElementById(this._id+"pagecanvas_"+parseInt(jsondata.currentpage));var ni=o.toDataURL(),u=o.getContext("2d"),p=new Image;w.indexOf("Firefox")!=-1?(p.onload=function(){u.clearRect(0,0,o.width,o.height);f._pageSize[e-1].PageRotation==90||f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight,o.height=f._zoomVal*f._pageSize[e-1].PageWidth,o.style.height=f._zoomVal*f._pageSize[e-1].PageWidth+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageHeight+"px"):(o.width=f._zoomVal*f._pageSize[e-1].PageWidth,o.height=f._zoomVal*f._pageSize[e-1].PageHeight,o.style.height=f._zoomVal*f._pageSize[e-1].PageHeight+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageWidth+"px");u.save();u.translate(o.width/2,o.height/2);u.rotate(f._pageSize[e-1].PageRotation/2*Math.PI/2);u.drawImage(p,-p.width/2,-p.height/2);u.restore()},p.src=ni):(u.clearRect(0,0,o.width,o.height),f._pageSize[e-1].PageRotation==90||f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight,o.height=f._zoomVal*f._pageSize[e-1].PageWidth,o.style.height=f._zoomVal*f._pageSize[e-1].PageWidth+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageHeight+"px"):(o.width=f._zoomVal*f._pageSize[e-1].PageWidth,o.height=f._zoomVal*f._pageSize[e-1].PageHeight,o.style.height=f._zoomVal*f._pageSize[e-1].PageHeight+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageWidth+"px"),u.save(),u.translate(o.width/2,o.height/2),u.rotate(f._pageSize[e-1].PageRotation/2*Math.PI/2),p.src=ni,u.drawImage(p,-p.width/2,-p.height/2),u.restore())}return this._showPageLoadingIndicator(a,!1),o},_printWinImageRendering:function(n,t,r,u,f,e,o){var s=this,h=new Image;h.onload=function(){var f=t[e];if(u.setTransform(f[0],f[1],f[2],f[3],f[4],f[5]),r[e]!=i&&u.drawImage(r[e],0,0,1,1),r.length-1==e&&s._pageSize[o-1].PageRotation!=0){var n=document.getElementById(s._id+"pagecanvas_"+o),l=n.toDataURL(),h=n.getContext("2d"),c=new Image;c.onload=function(){h.clearRect(0,0,n.width,n.height);s._pageSize[o-1].PageRotation==90||s._pageSize[o-1].PageRotation==270?(n.width=s._zoomVal*s._pageSize[o-1].PageHeight,n.height=s._zoomVal*s._pageSize[o-1].PageWidth,n.style.height=s._zoomVal*s._pageSize[o-1].PageWidth+"px",n.style.width=s._zoomVal*s._pageSize[o-1].PageHeight+"px"):(n.width=s._zoomVal*s._pageSize[o-1].PageWidth,n.height=s._zoomVal*s._pageSize[o-1].PageHeight,n.style.width=s._zoomVal*s._pageSize[o-1].PageWidth+"px",n.style.height=s._zoomVal*s._pageSize[o-1].PageHeight+"px");h.save();h.translate(n.width/2,n.height/2);h.rotate(s._pageSize[o-1].PageRotation/2*Math.PI/2);h.drawImage(c,-c.width/2,-c.height/2);h.restore()};c.src=l}};h.src=n[e];r.push(h)},_showPrintButton:function(t){t?(n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isPrintHidden=!1):(n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isPrintHidden=!0)},_showDownloadButton:function(t){t?(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isDownloadHidden=!1):(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isDownloadHidden=!0)},_updatePageNavigation:function(n,t){n>1&&n<t?(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):n==1&&n<t?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):n==t&&t!=1?(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast"));this._isJsondataAvailable||(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast"));this.currentPageNumber=this._currentPage},_gotoFirstPage:function(){if(this._totalPages&&this._totalPages>0){this._currentPage=1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoLastPage:function(){if(this._totalPages&&this._totalPages>0){this._currentPage=this._totalPages;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoNextPage:function(){if(this._totalPages&&this._currentPage<this._totalPages){this._currentPage=this._currentPage+1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPreviousPage:function(){if(this._totalPages&&this._currentPage>1){this._currentPage=this._currentPage-1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPageNo:function(n){var i={currentPageNumber:0},r=n,f=this._currentPage,t,u;this._totalPages&&(t=parseInt(n),t>=1&&t<=this._totalPages&&this._currentPage!=t&&(this._currentPage=t,u=document.getElementById(this._id+"_viewerContainer"),u.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._pageviewscrollchanged(this._pageHeight),this._updatePageNavigation(this._currentPage,this._totalPages)));f!=r&&(i.currentPageNumber=r,this._raiseClientEvent("pageChange",i))},_gotoPage:function(t){this._setPageSize(this._pageHeight,this._pageWidth,null,null);var i=parseInt(t);this._updatePageNavigation(i,this._totalPages);this._totalPages>0&&this._totalPages&&(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(i))},_allowOnlyNumbers:function(n){return(n.which<48||n.which>57)&&n.which!=8&&n.which!=13?!1:!0},_onkeyPress:function(t){if(t.which==13){t.preventDefault();try{var i=parseInt(n(t.currentTarget).val());i>0&&i<=this.pageCount?this._gotoPageNo(i):n(t.currentTarget).val(this.currentPageNumber)}catch(r){}}},_showPageNavigationControls:function(t){t?(n("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","block"),n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","1px"),this._isNavigationHidden=!1):(n("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","none"),this._isNavigationHidden=!0,!this._isPrintHidden&&this._isNavigationHidden&&this._isMagnificationHidden&&n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","0px"))},_showFittoPage:function(t){t?(n("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_fitPage").parents("ul.e-pdfviewer-toolbarul").css("display","block")):(n("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_fitPage").parents("ul.e-pdfviewer-toolbarul").css("display","none"))},_resetPage:function(){var t=n("#"+this._id+"_pageviewContainer"),r=n("#"+this._id+"_pageviewOuterline");t[0]!=i&&(r.css({width:t.width(),height:t.height()}),r.css({width:t[0].getBoundingClientRect().width,height:t[0].getBoundingClientRect().height}))},_applyFitToWidth:function(){this._isAutoZoom=!1;_scaleXY=this._fitToPage("fitToWidth");this._applyDropDownVal(_scaleXY,!0,!1);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_applyFitToPage:function(){this._isAutoZoom=!1;_scaleXY=this._fitToPage("fitToPage");this._applyDropDownVal(_scaleXY,!1,!0);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_updatePageFitModel:function(n){n=="fitToWidth"?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage")):n=="fitToPage"&&(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"))},_applyFitToWidthAuto:function(){_scaleXY=this._fitToAuto("fitToWidth");this._applyDropDownValAuto(_scaleXY,!0,!1)},_fitToAuto:function(){this._resetPage();var r=n("#"+this._id+"_viewerContainer"),o=n("#"+this._id+"_pageviewContainer"),s=n("#"+this._id+"_pageviewOuterline");if(r[0]!=i){var f=r.width(),h=r.height(),e=this._pageWidth,c=this._pageHeight,t=1,u=1;return t=(f-25)/e,this._isAutoZoom&&(t=Math.min(1,t),t==1&&(this._zoomLevelBackup=this._zoomLevel=3)),window.innerWidth>=screen.width&&(this._isWindowResizing=!1),u=t,this._zoomVal=t,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),this._initRerendering(),this._updateZoomButtons(),{scalX:t,scalY:u}}},_fitToPage:function(t){var f,v,r,a;if(this._pageSize!=i){this._resetPage();var h=n("#"+this._id+"_viewerContainer"),y=n("#"+this._id+"_pageviewContainer"),p=n("#"+this._id+"_pageviewOuterline"),o=h.width(),c=h.height();if(t=="fitToWidth")for(f=0;f<this._pageSize.length;f++)v=0,pageWidth=this._pageSize[f].PageRotation==90||this._pageSize[f].PageRotation==270?this._pageSize[f].PageHeight:this._pageSize[f].PageWidth,pageWidth>this._highestWidth&&(this._highestWidth=pageWidth);else this._highestWidth=this._pageWidth;var s=this._highestWidth,l=this._pageHeight,u=1,e=1;if(this._fitType=t,t=="fitToPage"){u=(o-25)/s;e=c/l;c>l&&(e=this._preZoomVal);o>s&&(u=this._preZoomVal);u=e;this._zoomVal=u;this._zoomInContainer();this._calculateZoomLevel(this._zoomVal);r=this;a=document.getElementById(this._id+"_viewerContainer");n("#"+this._id+"_viewerContainer").on("mousewheel DOMMouseScroll",function(t){var i=document.getElementById(r._id+"_viewerContainer"),u=n("#"+r._id+"_pdfviewer_toolbar_fitPage").attr("aria-disabled");u=="true"&&(t.originalEvent.wheelDelta>0||t.originalEvent.detail<0?r._currentPage>1&&(i.scrollTop=parseFloat(r._pageLocation[r._currentPage-1]*r._zoomVal)):r._currentPage!=r._totalPages&&(i.scrollTop=parseFloat(r._pageLocation[r._currentPage+1]*r._zoomVal)),t.preventDefault())});n(window).on("keydown",function(t){var i=document.getElementById(r._id+"_viewerContainer"),u=n("#"+r._id+"_pdfviewer_toolbar_fitPage").attr("aria-disabled");u=="true"&&(r._currentPage>1&&t.keyCode=="38"?i.scrollTop=parseFloat(r._pageLocation[r._currentPage-1]*r._zoomVal):r._currentPage!=r._totalPages&&t.keyCode=="40"&&(i.scrollTop=parseFloat(r._pageLocation[r._currentPage+1]*r._zoomVal)))});a.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal)}else t=="fitToWidth"&&(u=(o-25)/s,e=u,this._zoomVal=u,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal));return this._updateZoomButtons(),{scalX:u,scalY:e}}},_selectDropDownIndex:function(t){var i=n(n("#"+this._id+"_toolbar_zoomSelection_popup li")[t]);i.addClass("e-active");n("#"+this._id+"_toolbar_zoomSelection_input").val(i.text())},_applyDropDownVal:function(t,r,u){if(t!=i)if(u){var f=t.scalX>t.scalY?t.scalY:t.scalX;n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(f*100)+"%");this._ejDropDownInstance.model.value=Math.round(f*100)+"%";this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else r?(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalX*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalX*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalY*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_applyDropDownValAuto:function(i){if(this._isAutoZoom){var u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],r=u.contextMenu.auto.contentText;n("#"+this._id+"_toolbar_zoomSelection_hidden").val(r);this._ejDropDownInstance.model.value=r}else n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(i.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(i.scalY*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")},_showFitToPagetip:function(){var t=n("#"+this._id+"_toolbar_fittoPagePopup"),r,i;t.length>0||(t=this._renderPageFitPopup(),n("body").append(t),this._on(n("#"+this._id+"_toolbar_fittoPagePopup li.e-pdfviewer-popupli"),"click",this._pageFitMenuClick));t.css("display")=="block"?t.css("display","none"):t.css("display","block");r=n("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0].getBoundingClientRect();i=n(n("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0]).offset();t.css({top:i.top+r.height-3,left:i.left-5})},_zoomValChange:function(r){var o,s,u,h,e,f;this._ejViewerInstance||(o=this._id.split("_toolbar")[0],s=n("#"+o),ejViewerInstance=s.ejPdfViewer("instance"));h=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"];e=h.contextMenu.auto.contentText;r.value!=i?(r.value==e?(ejViewerInstance.model.isResponsive=!0,u=1,ejViewerInstance._zoomLevel=3,ejViewerInstance._isAutoZoom=!0):(u=parseInt(r.value)/100,ejViewerInstance.model.isResponsive=!1,ejViewerInstance._zoomLevel=r.itemId,ejViewerInstance._isAutoZoom=!1),ejViewerInstance._zoomContainer(u,!1)):r.target.innerHTML!=i&&(f=r.target.innerHTML,r.target.innerHTML==e?(ejViewerInstance.model.isResponsive=!0,u=1,ejViewerInstance._isAutoZoom=!0):(f=f.substring(0,f.length-1),u=parseInt(f)/100,ejViewerInstance.model.isResponsive=!1,ejViewerInstance._isAutoZoom=!1),ejViewerInstance._zoomContainer(u,!1))},_zoomIn:function(){if(this._zoomLevel>=7?this._zoomLevel=7:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}this.model.isResponsive=!1},_zoomOut:function(){if(this._zoomLevel<=1?this._zoomLevel=1:this._zoomLevel--,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}this.model.isResponsive=!1},_zoomInContainer:function(t,i){var d=i,p=n("#"+this._id+"_viewerContainer"),w=n("#"+this._id+"_pageviewContainer"),h,l,f,e,c,s,k,v,r,y;this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+d);var it=w.width(),rt=w.height(),a={currentZoomPercentage:0,previousZoomPercentage:0},b=document.getElementById(this._id+"_viewerContainer"),g=b.scrollTop,nt=g/this._previousZoom*this._zoomVal,ut="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++){l=0;this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(h=(this.element.width()-this._pageSize[r-1].PageHeight*this._zoomVal)/2,l=this._pageSize[r-1].PageHeight):(h=(this.element.width()-this._pageSize[r-1].PageWidth*this._zoomVal)/2,l=this._pageSize[r-1].PageWidth);(h<0||this._fitType=="fitToWidth"&&l==this._highestWidth)&&(h=5);var u=document.getElementById(this._id+"pagecanvas_"+r),o=document.getElementById(this._id+"_secondarycanvas_"+r),tt=u.getContext("2d");this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(u.height=this._pageSize[r-1].PageWidth*this._zoomVal,u.width=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.height=this._pageSize[r-1].PageWidth*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageHeight*this._zoomVal+"px",f=this._pageSize[r-1].PageWidth*this._zoomVal,e=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px"):(u.height=this._pageSize[r-1].PageHeight*this._zoomVal,u.width=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.height=this._pageSize[r-1].PageHeight*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageWidth*this._zoomVal+"px",f=this._pageSize[r-1].PageHeight*this._zoomVal,e=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px");tt.clearRect(0,0,u.clientWidth,u.clientHeight);c=n("#"+this._id+"pageDiv_"+r);c[0].style.top=this._pageLocation[r]*this._zoomVal+"px";c[0].style.left=h+"px";c[0].style.width=e+"px";c[0].style.height=f+"px";s=document.getElementById(this._id+"selectioncanvas_"+r);s.style.height=u.height+"px";s.style.width=u.width+"px";s.style.position="absolute";s.style.left=0;s.style.top=0;s.style.backgroundColor="transparent";s.style.zIndex="2";this._isAutoZoom||(n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"}),k=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup"),v=k.childNodes[0],v.style.top=(u.height-v.clientHeight)/2+"px")}if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?p.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):p.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].onload=null;n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;b.scrollTop=nt;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._preZoomVal=this._zoomVal;this._previousZoom=this._zoomVal;a.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);a.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",a);this.zoomPercentage=Math.round(this._zoomVal*100);this._highestWidth=0;y=[];this._selectedAnnotationObject&&(y.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,y))},_zoomOutContainer:function(t,i){var k=i,y=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewContainer"),c,f,e,h,s,b,a,r,v;this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+k);var tt=p.width(),it=p.height(),l={currentZoomPercentage:0,previousZoomPercentage:0},w=document.getElementById(this._id+"_viewerContainer"),d=w.scrollTop,g=d/this._previousZoom*this._zoomVal,rt="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++){c=this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(this.element.width()-this._pageSize[r-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[r-1].PageWidth*this._zoomVal)/2;c<0&&(c=5);var u=document.getElementById(this._id+"pagecanvas_"+r),nt=u.getContext("2d"),o=document.getElementById(this._id+"_secondarycanvas_"+r);this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(u.height=this._pageSize[r-1].PageWidth*this._zoomVal,u.width=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.height=this._pageSize[r-1].PageWidth*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageHeight*this._zoomVal+"px",f=this._pageSize[r-1].PageWidth*this._zoomVal,e=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px"):(u.height=this._pageSize[r-1].PageHeight*this._zoomVal,u.width=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.height=this._pageSize[r-1].PageHeight*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageWidth*this._zoomVal+"px",f=this._pageSize[r-1].PageHeight*this._zoomVal,e=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.width=e+"px",u.style.height=f+"px",o.width=e,o.height=f,o.style.width=e+"px",o.style.height=f+"px");nt.clearRect(0,0,u.clientWidth,u.clientHeight);h=n("#"+this._id+"pageDiv_"+r);h[0].style.top=this._pageLocation[r]*this._zoomVal+"px";h[0].style.left=c+"px";h[0].style.width=e+"px";h[0].style.height=f+"px";s=document.getElementById(this._id+"selectioncanvas_"+r);s.style.height=u.height+"px";s.style.width=u.width+"px";s.style.position="absolute";s.style.left=0;s.style.top=0;s.style.backgroundColor="transparent";s.style.zIndex="2";n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"});b=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup");a=b.childNodes[0];a.style.top=(u.height-a.clientHeight)/2+"px"}if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?y.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):y.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].onload=null;n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;w.scrollTop=g;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;l.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);l.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",l);this.zoomPercentage=Math.round(this._zoomVal*100);v=[];this._selectedAnnotationObject&&(v.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,v))},_zoomContainer:function(n,t){if(this._fitType=null,this._zoomVal=n,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isAutoZoom&&this._renderedCanvasList&&this._isWindowResizing)this._applyFitToWidthAuto(),n=this._zoomVal;else{var i=Math.abs(this._preZoomVal-n);if(i==0)return!1;this._preZoomVal>n?this._zoomOutContainer(t,i):this._zoomInContainer(t,i)}this._preZoomVal=n;this._updateZoomButtons()},_calculateZoomLevel:function(n){var r;this._calculateZoomArrayValues();for(var u=n,t=0,i=this._zoomArray.length-1;t<=i&&!(t==0&&i==0);)r=Math.round((t+i)/2),this._zoomArray[r]<=u?t=r+1:this._zoomArray[r]>=u&&(i=r-1);this._lowerZoomIndex=i;this._higherZoomIndex=t;this._zoomLevel=this._lowerZoomIndex},_applyLowerZoomIndex:function(){var t=0,n;for(this._calculateZoomArrayValues(),n=0;n<this._zoomArray.length;n++)this._preZoomVal!=this._zoomArray[n]&&t++;t==this._zoomArray.length&&(this._zoomLevel=this._lowerZoomIndex);this._fitType=null},_applyHigherZoomIndex:function(){var t=0,n;for(this._calculateZoomArrayValues(),n=0;n<this._zoomArray.length;n++)this._preZoomVal!=this._zoomArray[n]&&t++;t==this._zoomArray.length&&(this._zoomLevel=this._higherZoomIndex);this._fitType=null},_calculateZoomArrayValues:function(){var t,r,n;if(this._zoomArray==i)for(t=document.getElementById(this._id+"_toolbar_zoomSelection_popup").getElementsByTagName("li"),r=[],this._zoomArray=r,n=0;n<t.length;n++)r.push(parseInt(t[n].textContent)/100)},_updateZoomButtons:function(){this._zoomVal<=.5?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin")):this._zoomVal==4?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout")):(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin"))},_showZoomControl:function(t){t?(n("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","block"),this._isMagnificationHidden=!1):(n("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","none"),this._isMagnificationHidden=!0)},_fitToAutoSize:function(){for(var o,e,r,h,c,a,v,y,it=this._zoomVal,p=n("#"+this._id+"_viewerContainer"),w=n("#"+this._id+"_pageviewContainer"),rt=w.width(),ut=w.height(),l={currentZoomPercentage:0,previousZoomPercentage:0},b=document.getElementById(this._id+"_viewerContainer"),nt=b.scrollTop,tt=nt/this._previousZoom*this._zoomVal,ft="scale("+this._zoomVal+","+this._zoomVal+")",i=1;i<=this._totalPages;i++){o=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[i-1].PageWidth*this._zoomVal)/2;(this._isAutoZoom&&this._zoomVal<1||o<0)&&(o=5);var s=document.getElementById(this._id+"pagecanvas_"+i),d=document.getElementById(this._id+"_secondarycanvas_"+i),g=s.getContext("2d"),u,f;if(this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(u=this._pageSize[i-1].PageWidth*this._zoomVal,f=this._pageSize[i-1].PageHeight*this._zoomVal):(u=this._pageSize[i-1].PageHeight*this._zoomVal,f=this._pageSize[i-1].PageWidth*this._zoomVal),s.style.height=u+"px",s.style.width=f+"px",d.style.width=f+"px",d.style.height=u+"px",e=n("#"+this._id+"pageDiv_"+i),e[0].style.top=this._pageLocation[i]*this._zoomVal+"px",e[0].style.left=o+"px",e[0].style.width=f+"px",e[0].style.height=u+"px",r=document.getElementById(this._id+"selectioncanvas_"+i),r.style.height=u+"px",r.style.width=f+"px",r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.backgroundColor="transparent",r.style.zIndex="2",h=this._pageContents[parseInt(i)],h&&this._renderedCanvasList.indexOf(i)!=-1){for(jsondata=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(h):JSON.parse(h.d),c=n("#"+this._id+"selectioncanvas_"+i).children(),k=0;k<c.length;k++)n(c[k]).hasClass("e-pdfviewer-textLayer")&&(n(c[k]).remove(),n("#"+this._id+"selectioncanvas_"+i).removeClass("text_container"));n("#"+this._id+"selectioncanvas_"+i).hasClass("text_container")?this._resizeSelection(jsondata,i,g):this._textSelection(jsondata,i,g)}n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").css({display:"none",height:u+"px",width:f+"px",left:"0px",top:"0px"});a=document.getElementById(this._id+"pageDiv_"+i+"_WaitingPopup");a&&(v=a.childNodes[0],v.style.top=(s.height-v.clientHeight)/2+"px")}this._zoomVal<1?p.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):p.css({"-ms-scroll-limit-y-max":""});n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;b.scrollTop=tt;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;this._preZoomVal=this._zoomVal;l.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);l.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",l);this.zoomPercentage=Math.round(this._zoomVal*100);y=[];this._selectedAnnotationObject&&(y.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,y))},_initRerendering:function(){var n,u,t,i,r;this._isRerenderCanvasCreated||(this._designNewCanvas(),n=[],u=this._currentPage,n.push(parseInt(this._currentPage)),this._renderedCanvasList?(t=parseInt(this._currentPage)-1,this._renderedCanvasList.indexOf(t)!=-1&&n.push(t),i=parseInt(this._currentPage)+1,this._renderedCanvasList.indexOf(i)!=-1&&n.push(i)):(t=parseInt(this._currentPage)-1,n.push(t),i=parseInt(this._currentPage)+1,n.push(i)),this._rerenderCanvasList=n,!0&&(r=this,clearInterval(r._scrollTimer),r._bgRenderTimer=setInterval(function(){r._rerenderCanvas(u)},10)),this._renderedCanvasList.length=0)},_designNewCanvas:function(){for(var f,t=1;t<=this._totalPages;t++){var o=document.getElementById(this._id+"pageDiv_"+t),e=document.getElementById(this._id+"pagecanvas_"+t),i=document.createElement("canvas"),r,u;this._pageSize[t-1].PageRotation==90||this._pageSize[t-1].PageRotation==270?(r=this._pageSize[t-1].PageWidth*this._zoomVal,u=this._pageSize[t-1].pageHeight*this._zoomVal):(r=this._pageSize[t-1].PageHeight*this._zoomVal,u=this._pageSize[t-1].PageWidth*this._zoomVal);i.style.visibility="hidden";i.style.width=u+"px";i.style.height=r+"px";i.style.backgroundColor="white";i.height=r;i.width=u;i.id=e.id;i.className="e-pdfviewer-pageCanvas";e.id=this._id+"oldcanvas_"+t;o.appendChild(i);n(i).css({"user-select":"none"});f=document.getElementById(this._id+"_secondarycanvas_"+t);f.style.width=u+"px";f.style.height=r+"px";f.width=u;f.height=r}this._isRerenderCanvasCreated=!0},_replaceOldCanvas:function(){for(var t,n=1;n<=this._totalPages;n++){var i=document.getElementById(this._id+"pageDiv_"+n),r=document.getElementById(this._id+"pagecanvas_"+n),u=document.getElementById(this._id+"oldcanvas_"+n);r.style.visibility="visible";i.removeChild(u)}this._isRerenderCanvasCreated=!1;t=this;clearInterval(t._bgRenderTimer);t._scrollTimer=setInterval(function(){t._pageviewscrollchanged(t._pageHeight)},500)},_rerenderCanvas:function(t){var i,r;if(this._renderedCanvasList.indexOf(parseInt(t))==-1&&t<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t))!=-1?(i=this._pageContents[parseInt(t)],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1):this._renderedCanvasList.indexOf(parseInt(t)-1)==-1&&t-1<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t)-1)!=-1?(i=this._pageContents[parseInt(t)-1],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1):this._renderedCanvasList.indexOf(parseInt(t)+1)==-1&&t+1<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t)+1)!=-1&&(i=this._pageContents[parseInt(t)+1],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1),this._renderCount==this._rerenderCanvasList.length){for(this._replaceOldCanvas(),r=1;r<=this._totalPages;r++)this._renderedCanvasList.indexOf(r)==-1&&n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block"});this._renderCount=0;this._rerenderCanvasList.length=0}},_rerenderPdfPage:function(r){var si=r,v,ti,nt,a,e,tt,at,ii,o,b,it,p,f,rt,ni,ht,c,s;for(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),v=parseInt(r.currentpage),ti=r.imagestream,this._pageContents[parseInt(r.currentpage)]=si,this._regenerateFormFields(r,v),nt=n("#"+this._id+"selectioncanvas_"+v).children(),p=0;p<nt.length;p++)(nt[p].hasAttribute("href")||n(nt[p]).hasClass("e-pdfviewer-formFields"))&&n(nt[p]).remove();this._createFormFields(r,v);var w=r.linkannotation,ct=r.annotpagenum,lt=this;if(this.model.enableHyperlink)for(a=0;a<w.length;a++){if(e=document.createElement("a"),e.id="linkdiv_"+a,tt=w[a].AnnotRectangle,e.style.background="transparent",e.style.position="absolute",e.style.left=this._convertPointToPixel(tt.Left*this._zoomVal)+"px",e.style.top=this._convertPointToPixel(tt.Top*this._zoomVal)+"px",e.style.width=this._convertPointToPixel(tt.Width*this._zoomVal)+"px",e.style.height=this._convertPointToPixel(tt.Height*this._zoomVal)+"px",e.style.color="transparent",w[a].URI.indexOf("mailto:")!=-1?(at=w[a].URI.substring(w[a].URI.indexOf("mailto:"),w[a].URI.length),e.title=at,e.setAttribute("href",at)):(e.title=w[a].URI,e.setAttribute("href",w[a].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(e.target="_self",e.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(e.target="_blank",e.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(e.onclick=function(){var n={hyperlink:this.href};return lt._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),ct[a]!=i){var hi=this._pageSize[v-1].PageHeight,ci=this._convertPointToPixel(w[a].AnnotLocation),li=hi-ci,ai=parseFloat(this._pageLocation[ct[a]]*this._zoomVal)+parseFloat(li*this._zoomVal);e.name=ai;e.onclick=function(){var n=document.getElementById("container_viewerContainer");return n.scrollTop=this.name,!1}}ct[a]!=null&&(ii=document.getElementById(this._id+"selectioncanvas_"+v),ii.appendChild(e))}this._textMarkupAnnotationList[v]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[v],v);o=parseInt(r.currentpage);b=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));(this._pageSize[o-1].PageRotation==90||this._pageSize[o-1].PageRotation==270)&&(b.height=this._zoomVal*this._pageSize[o-1].PageHeight,b.width=this._zoomVal*this._pageSize[o-1].PageWidth,b.style.width=this._zoomVal*this._pageSize[o-1].PageWidth+"px",b.style.height=this._zoomVal*this._pageSize[o-1].PageHeight+"px");var u=b.getContext("2d"),vt=[],ri=[],vi=[],ui=[],fi=[],yi,k=navigator.userAgent,d,ei=0,yt=[],ft=ti.textelements;for(it=0;it<ft.length;it++){var h=ft[it],pt=h.color,l=h.matrix;l!=null&&(l=l.Elements);var wt=h.brush,y=h.pathValue,pi=h.iscliping,oi=h.restorecanvas,bt=h.imagedata,g=h.fillrule,wi=h.isFillandStroke,bi=h.fillcolor,kt=h.strokecolor,dt=h.linewidth,gt=h.linecap,et=h.linearGradientBrush,ot=h.textureBrushs,st=h.charID;if(y!=null?(y=y.split(";"),st&&(yt[st]=y)):y==null&&st&&(y=yt[st]),oi==!1&&u.save(),y!=i&&u.setTransform(l[0]*this._zoomVal,l[1],l[2],l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),y!=null){for(u.beginPath(),p=0;p<y.length;p++)f=y[p],rt=f[0],rt=="M"?(f=f.substring(1,f.length),f=f.split(" "),u.moveTo(f[0],f[1])):rt=="L"?(f=f.substring(1,f.length),f=f.split(" "),u.lineTo(f[0],f[1])):rt=="C"?(f=f.substring(1,f.length),f=f.split(" "),u.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5])):rt=="Z"&&u.closePath();pi==!0?(g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(g)),u.clip()):wi==i?wt=="Fill"?(u.fillStyle=et!=i?this._getGradientBrush(et,u):ot!=i?this._createTextureBrush(ot,u,h):pt,g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(g)),u.fill()):wt=="FillandStroke"?(u.fillStyle=pt,u.fill(),u.strokeStyle=kt,u.stroke()):wt=="Stroke"?(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=pt,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke(),u.fillStyle=et!=i?this._getGradientBrush(et,u):ot!=i?this._createTextureBrush(ot,u,h):bi,g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(g)),u.fill())}if(oi&&u.restore(),bt!=i)if((d=k.indexOf("Firefox"))!=-1||(d=k.indexOf("Chrome"))!=-1||(d=k.indexOf("Safari"))!=-1||(d=k.indexOf("AppleWebKit"))!=-1){vt.push(bt);ri.push(l);fi.push(ft);ui.push(it);yi=this._zoomVal;this._isContainImage=!0;break}else ni=new Image,ni.src=bt,u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),u.drawImage(ni,0,0,1,1)}if((d=k.indexOf("Firefox"))!=-1||(d=k.indexOf("Chrome"))!=-1||(d=k.indexOf("Safari"))!=-1||(d=k.indexOf("AppleWebKit"))!=-1)for(ht=0;ht<vt.length;ht++)this._imageRenderingPinch(ft,vi,vt,ri,u,ht,fi,ui,yt,b,o,ei),ei++;if(c=b,s=this,this._pageSize[o-1].PageRotation!=0){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var ki=c.toDataURL(),u=c.getContext("2d"),ut=new Image;ut.onload=function(){u.clearRect(0,0,c.width,c.height);s._pageSize[o-1].PageRotation==90||s._pageSize[o-1].PageRotation==270?(c.width=s._zoomVal*s._pageSize[o-1].PageHeight,c.height=s._zoomVal*s._pageSize[o-1].PageWidth,c.style.height=s._zoomVal*s._pageSize[o-1].PageWidth+"px",c.style.width=s._zoomVal*s._pageSize[o-1].PageHeight+"px"):(c.width=s._zoomVal*s._pageSize[o-1].PageWidth,c.height=s._zoomVal*s._pageSize[o-1].PageHeight,c.style.height=s._zoomVal*s._pageSize[o-1].PageHeight+"px",c.style.width=s._zoomVal*s._pageSize[o-1].PageWidth+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(s._pageSize[o-1].PageRotation/2*Math.PI/2);u.drawImage(ut,-ut.width/2,-ut.height/2);u.restore()};ut.src=ki}return this._showPageLoadingIndicator(v,!1),c},_regenerateFormFields:function(t,i){var u=t.PdfRenderedFields,r,c,f,o,h,e,s;if(u!=null)for(r=0;r<u.length;r++)if(u[r].PageIndex+1==i)if(c=u[r].LineBounds,f=document.getElementById(this._id+"input_"+i+"_"+r),u[r].Name=="Textbox")o=n(f).attr("name"),u[r].FieldName==o&&(u[r].Text=n(f).val());else if(u[r].Name=="Password")o=n(f).attr("name"),u[r].FieldName==o&&(u[r].Text=n(f).val());else if(u[r].Name=="RadioButton")o=n(f).attr("name"),u[r].GroupName==o&&(u[r].Selected=n(f).prop("checked")==!0?!0:!1);else if(u[r].Name=="CheckBox")o=n(f).attr("name"),u[r].GroupName==o&&(u[r].Selected=n(f).prop("checked")==!0?!0:!1);else if(u[r].Name=="DropDown"){if(o=n(f).attr("name"),u[r].Text==o)for(u[r].SelectedValue==""&&(s=n(f).children()[0],s.id="dropdownhide",n(s).prop("selected")==!0&&(u[r].SelectedValue="")),e=0;e<u[r].TextList.length;e++)s=n(f).children()[0].id=="dropdownhide"?n(f).children()[e+1]:n(f).children()[e],n(s).prop("selected")==!0&&(u[r].SelectedValue=u[r].TextList[e])}else if(u[r].Name=="ListBox")for(h=0,e=0;e<u[r].TextList.length;e++)s=n(f).children()[e],n(s).prop("selected")==!0&&(u[r].SelectedList[h]=e,h++)},_imageRenderingPinch:function(n,t,r,u,f,e,o,s,h,c,l,a){var y=this,v=y._zoomVal,p=new Image;p.onload=function(){for(var d,g,et,ft,e,tt,at=!1,k=0;k<u.length;k++)if(at==!1)for(d=u[k],f.setTransform(d[0]*v,d[1]*v,d[2]*v,d[3]*v,d[4]*v,d[5]*v),t[a]!=i&&f.drawImage(t[a],0,0,1,1),g=s[k],g=g+1,et=o[k];g<et.length;){var p=et[g],ot=p.color,w=p.matrix;w!=null&&(w=w.Elements);var st=p.brush,b=p.pathValue,pt=p.iscliping,vt=p.restorecanvas,yt=p.imagedata,nt=p.fillrule,wt=p.isFillandStroke,bt=p.fillcolor,ht=p.strokecolor,ct=p.linewidth,lt=p.linecap,it=p.linearGradientBrush,rt=p.textureBrushs,ut=p.charID;if(b!=null?(b=b.split(";"),ut&&(h[ut]=b)):b==null&&ut&&(b=h[ut]),vt==!1&&f.save(),b!=i&&f.setTransform(w[0]*v,w[1],w[2],w[3]*v,w[4]*v,w[5]*v),b!=null){for(f.beginPath(),ft=0;ft<b.length;ft++)e=b[ft],tt=e[0],tt=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):tt=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):tt=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):tt=="Z"&&f.closePath();pt==!0?(nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(nt)),f.clip()):wt==i?st=="Fill"?(f.fillStyle=it!=i?y._getGradientBrush(it,f):rt!=i?y._createTextureBrush(rt,f,p):ot,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill()):st=="FillandStroke"?(f.fillStyle=ot,f.fill(),f.strokeStyle=ht,f.stroke()):st=="Stroke"?(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ot,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke(),f.fillStyle=it!=i?y._getGradientBrush(it,f):rt!=i?y._createTextureBrush(rt,f,p):bt,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill())}if(vt&&f.restore(),yt!=i){at=!0;r.pop();u.pop();o.pop();s.pop();r.push(yt);u.push(w);o.push(n);s.push(g);k=-1;a++;break}g++}else y._imageRenderingPinch(n,t,r,u,f,k,o,s,h,c,l,a),a++};p.src=r[e];t.push(p)},_touchStart:function(t){var u=t.touches,i,r;u.length>1&&t.preventDefault();i=n(t.target).parents(".e-pdfviewer.e-js");r=i.ejPdfViewer("instance");r._touched=!1},_touchMove:function(t){var u=t.touches,f,i,r;u.length>1&&(f=n(t.target).parents(".e-pdfviewer.e-js"),i=f.ejPdfViewer("instance"),i._touched=!0,i._isRerenderCanvasCreated||(n(".e-pdfviewer-formFields").hide(),r=Math.sqrt(Math.pow(u[0].clientX-u[1].clientX,2)+Math.pow(u[0].clientY-u[1].clientY,2)),i._prevDiff>-1?r>i._prevDiff?i._pinchOut(t):r<i._prevDiff&&i._pinchIn(t):i._zoomVal<2?i._prevDiff!=-1&&r>i._prevDiff&&i._pinchIn(t):i._prevDiff==-1&&i._zoomVal>2&&r>i._prevDiff&&i._pinchIn(t),i._prevDiff=r))},_touchEnd:function(t){var s=n(t.target).parents(".e-pdfviewer.e-js"),i=s.ejPdfViewer("instance"),r,o,f,e,u;i._prevDiff=-1;i._isRenderedByPinch&&(i._renderedCanvasList.length!=0&&(i._isRerenderCanvasCreated||(i._designNewCanvas(),r=[],o=i._currentPage,r.push(parseInt(i._currentPage)),f=parseInt(i._currentPage)-1,i._renderedCanvasList.indexOf(f)!=-1&&r.push(f),e=parseInt(i._currentPage)+1,i._renderedCanvasList.indexOf(e)!=-1&&r.push(e),i._rerenderCanvasList=r,u=i,window.clearInterval(u._scrollTimer),u._bgRenderTimer=setInterval(function(){u._rerenderCanvas(o)},10),i._renderedCanvasList.length=0)),i._isRenderedByPinch=!1)},_pointerdown:function(n){n.originalEvent.pointerType=="touch"&&(this._pointerCount=this._pointerCount+1,this._pointerCount<=2&&(n.preventDefault(),this._pointers.push(n.originalEvent),this._pointerCount==2&&(this._pointerCount=0)))},_pointermove:function(n){var i,t,r,u;if(n.originalEvent.pointerType=="touch"&&this._pointers.length==2){for(n.preventDefault(),i=0;i<this._pointers.length;i++)if(n.originalEvent.pointerId==this._pointers[i].pointerId){this._pointers[i]=n.originalEvent;break}this._isRerenderCanvasCreated||(t=Math.sqrt(Math.pow(this._pointers[0].clientX-this._pointers[1].clientX,2)+Math.pow(this._pointers[0].clientY-this._pointers[1].clientY,2)),this._prevDiff>-1&&(t>this._prevDiff?this._pinchOut(n):t<this._prevDiff&&this._pinchIn(n)),r=document.getElementById(this._id+"_viewerContainer"),u=r.scrollTop,u==0||(t>this._prevDiff?this._pinchOut(n):t<this._prevDiff&&this._pinchIn(n)),this._prevDiff=t)}},_pointerup:function(n){var t,f,r,u,i;n.originalEvent.pointerType=="touch"&&(this._pointers=[],this._pointerCount=0,this._prevDiff=-1,this._isRenderedByPinch&&(n.preventDefault(),this._renderedCanvasList.length!=0&&(this._isRerenderCanvasCreated||(this._designNewCanvas(),t=[],f=this._currentPage,t.push(parseInt(this._currentPage)),r=parseInt(this._currentPage)-1,this._renderedCanvasList.indexOf(r)!=-1&&t.push(r),u=parseInt(this._currentPage)+1,this._renderedCanvasList.indexOf(u)!=-1&&t.push(u),this._rerenderCanvasList=t,i=this,window.clearInterval(i._scrollTimer),i._bgRenderTimer=setInterval(function(){i._rerenderCanvas(f)},10),this._renderedCanvasList.length=0)),this._isRenderedByPinch=!1))},_pinchOut:function(){this._isAutoZoom=!1;this._zoomVal=this._zoomVal+.01;this._zoomVal>2&&(this._zoomVal=this._zoomVal+.01);this._zoomVal>4&&(this._zoomVal=4,this._isPinchLimitReached=!0);this._zoomVal<=4?(this._isPinchLimitReached||(this._fitType=null,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(this._zoomVal*100)+"%"),this._ejDropDownInstance.model.value=this._zoomVal*100+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"),this._updateZoomButtons(),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=4},_pinchIn:function(){this._isAutoZoom=!1;this._zoomVal=this._zoomVal-.01;this._zoomVal<4&&this._zoomVal>2&&(this._zoomVal=this._zoomVal-.01);this._zoomVal<.5&&(this._zoomVal=.5,this._isPinchLimitReached=!0);this._zoomVal>=.5?(this._isPinchLimitReached||(this._fitType=null,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(this._zoomVal*100)+"%"),this._ejDropDownInstance.model.value=this._zoomVal*100+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"),this._updateZoomButtons(),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=.5},_textSearch:function(){this._clearAllOccurrences();this._selectedIndex=0;this._isTextSearch=!0;this._searchedPages=[];this._searchCollection=[];var t=n("#"+this._id+"_pdfviewer_searchinput").val();if(this._searchText=t,this._searchText&&this._searchText!=""?this._enableSearchIcons():this._disableSearchIcons(),t==""||t==" "||!t)return!0;this._searchPageIndex=parseInt(this._currentPage);this._initSearch(this._searchPageIndex);this._highlightOtherOccurrences()},_disableSearchIcons:function(){n("#"+this._id+"_pdfviewer_previous_search").css({"pointer-events":"none",opacity:"0.6"});n("#"+this._id+"_pdfviewer_next_search").css({"pointer-events":"none",opacity:"0.6"});var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");t.disable()},_enableSearchIcons:function(){n("#"+this._id+"_pdfviewer_previous_search").css({"pointer-events":"",opacity:""});n("#"+this._id+"_pdfviewer_next_search").css({"pointer-events":"",opacity:""});var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");t.enable()},_prevSearch:function(){this._searchText&&(this._clearAllOccurrences(),this._isPrevSearch=!0,this._isTextSearch=!0,this._selectedIndex=this._selectedIndex-1,this._selectedIndex<0?(this._searchPageIndex=this._searchPageIndex-1,this._searchPageIndex<1&&(this._searchPageIndex=parseInt(this._totalPages)),this._initSearch(this._searchPageIndex)):this._highlightText(this._searchPageIndex,this._selectedIndex),this._highlightOtherOccurrences())},_nextSearch:function(){this._searchText&&(this._clearAllOccurrences(),this._isPrevSearch=!1,this._isTextSearch=!0,this._selectedIndex=this._selectedIndex+1,this._searchCollection[this._searchPageIndex]?this._selectedIndex>=this._searchCollection[this._searchPageIndex].length?(this._selectedIndex=0,this._searchPageIndex=this._searchPageIndex<this._totalPages?this._searchPageIndex+1:1,this._initSearch(this._searchPageIndex)):this._highlightText(this._searchPageIndex,this._selectedIndex):(this._searchPageIndex=this._currentPage,this._selectedIndex=0,this._initSearch(this._searchPageIndex)),this._highlightOtherOccurrences())},_matchcase:function(){var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");this._isMatchCase=t.model.checkState=="check"?!0:!1;this._textSearch()},_searchKeypressHandler:function(t){t.which==13&&(t.preventDefault(),this._searchText=n("#"+this._id+"_pdfviewer_searchinput").val(),this._searchMatches[this._searchPageIndex]&&this._searchText!=""?this._searchMatches[this._searchPageIndex].length==0?this._initSearch(this._searchPageIndex):this._nextSearch():this._searchText!=""&&(this._searchPageIndex=this._currentPage,this._selectedIndex=0,this._initSearch(this._searchPageIndex)))},_initSearch:function(n){var t=this._searchText.length,i=this._searchText;this._getPossibleMatches(n,i,t)},_getPossibleMatches:function(t,i,r){var f,u,h,o;if(n("#"+this._id+"_pdfviewer_searchinput").hasClass("e-pdfviewer-nooccurrence")||n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader"),this._pageText[parseInt(t)]||t!=this._searchPageIndex||(this._isRequestFired=!0,f={},f.viewerAction=this._viewerAction.getPageModel,f.pageindex=t.toString(),f.id=this._fileId,n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader"),this._doAjaxPostSearch(JSON.stringify(f),t)),u=this._pageText[t],u){this._isMatchCase||(u=u.toLowerCase(),i=i.toLowerCase());var s=[],e=-r,c=new RegExp("[\x00-€]+"),l=c.test(u),a=this._isRtl(u);for(!l&&a&&(h=new RegExp(String.fromCharCode(160),"g"),u=u.replace(h," "),i=i.split("").reverse().join(""),i=i.replace(/\s/g," "));;){if(e=u.indexOf(i,e+r),e==-1)break;s.push(e)}this._searchMatches[t]=s;t==this._searchPageIndex?(this._selectedIndex<0&&this._isPrevSearch&&(this._selectedIndex=this._searchMatches[t].length-1),(this._isRequestFired&&this._searchMatches[t].length!=0||this._renderedCanvasList.indexOf(t)==-1&&this._searchMatches[t].length!=0)&&(this._gotoPageNo(t),this._isPageScrolledForSearch=!0),this._searchMatches[t].length==0?(t!=this._totalPages?(this._searchedPages.indexOf(parseInt(t))==-1&&this._searchedPages.push(t),this._isPrevSearch?(this._searchPageIndex=this._searchPageIndex-1,this._searchPageIndex<=0&&(this._searchPageIndex=this._totalPages)):this._searchPageIndex=this._searchPageIndex+1):(this._searchedPages.indexOf(parseInt(t))==-1&&this._searchedPages.push(t),this._searchPageIndex=this._isPrevSearch?this._searchPageIndex-1:1),this._searchedPages.length!=this._totalPages||this._searchMatches[t].length!=0?this._initSearch(this._searchPageIndex):(n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-nooccurrence"),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),this._isRequestFired=!1)):this._isRequestFired?(n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),o=this,setTimeout(function(){o._convertMatches(t,r);o._isRequestFired=!1;o._isPageScrolledForSearch=!1},100)):this._convertMatches(t,r)):this._searchMatches[t].length!=0&&this._convertMatches(t,r);this._isRequestFired||this._isPageScrollHighlight||(this._isPageScrolledForSearch=!1)}},_convertMatches:function(n,t){for(var f,s,i=0,h=this._searchMatches[n],u=this._textDivs[n],r=0,e=u.length-1,c=[],o=0,l=h.length;o<l;o++){if(f=h[o],this._isPageScrolledForSearch)while(i!=e&&f>=r+u[i].textContent.split("\n")[0].length)r+=u[i].textContent.split("\n")[0].length,i++;else while(i!=e&&f>=r+u[i].textContent.length)r+=u[i].textContent.length,i++;for(s={begin:{divId:i,offsetValue:f-r}},f+=t;i!=e&&f>r+u[i].textContent.length;)r+=u[i].textContent.length,i++;s.end={divId:i,offsetValue:f-r};c.push(s)}this._searchCollection[n]=c;this._highlightText(n,this._selectedIndex)},_highlightText:function(n){for(var s,a,h=this._searchCollection[n],u=this._textDivs[n],t=null,c,f,v=h.length,o=0;o<v;o++){var l=h[o],r=l.begin,e=l.end;if(o==this._selectedIndex&&n==this._searchPageIndex?(f="e-pdfviewer-texthighlight",c=r.divId):f="e-pdfviewer-text-highlightother",t&&r.divId===t.divId?this._addSpanForSearch(t.divId,t.offsetValue,r.offsetValue,n,u,null):(t!==null&&this._addSpanForSearch(t.divId,t.offsetValue,i,n,u,null),this._beginText(r,u,n,null)),r.divId==e.divId)this._addSpanForSearch(r.divId,r.offsetValue,e.offsetValue,n,u,f);else{for(this._addSpanForSearch(r.divId,r.offsetValue,i,n,u,f),s=r.divId+1,a=e.divId;s<a;s++)this._addSpanForSearch(s,0,i,n,u,f+" middle");this._beginText(e,u,n,f)}t=e}t&&this._addSpanForSearch(t.divId,t.offsetValue,i,n,u,null);n==this._searchPageIndex&&this._scrollToSearchStr(u[c],{y:-70,x:-400});this._isTextHighlighted=!0},_beginText:function(n,t,i,r){var u=n.divId;t[u].textContent="";this._addSpanForSearch(u,0,n.offsetValue,i,t,r)},_addSpanForSearch:function(t,i,r,u,f,e){var h,c=this._textContents[u],a=c[t].length,v=new RegExp("[\x00-€]+"),l=this._isRtl(c[t]),s,o;if(l){if(h=c[t].substring(i,r),s=document.createTextNode(h),e){this._isTextHighlighted=!0;o=document.createElement("span");o.className=e+" e-pdfviewer-textLayer";n(o).hasClass("middle")&&(f[t].textContent="");n(o).prepend(s);n(f[t]).prepend(o);return}n(f[t]).prepend(s)}else{if(h=c[t].substring(i,r),s=document.createTextNode(h),e){this._isTextHighlighted=!0;o=document.createElement("span");o.className=e+" e-pdfviewer-textLayer";n(o).hasClass("middle")&&(f[t].textContent="");o.appendChild(s);f[t].appendChild(o);return}f[t].appendChild(s)}},_isRtl:function(n){var t=new RegExp("^[^A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\\u2C00-\\uFB1C\\uFDFE-\\uFE6F\\uFEFD-\\uFFFF]*[\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC]");return t.test(n)},_scrollToSearchStr:function(n,t){for(var i=n.offsetParent,r=n.offsetTop+n.clientTop,u=n.offsetLeft+n.clientLeft;i.id!=this._id+"_viewerContainer";)r+=i.offsetTop,u+=i.offsetLeft,i=i.offsetParent;t&&(r+=t.y,u+=t.x,this._zoomVal>1.5&&(i.scrollLeft=u));i.scrollTop=r},_highlightOtherOccurrences:function(){for(var i,t=1;t<=this._totalPages;t++)this._renderedCanvasList.indexOf(t)!=-1&&t!=this._searchPageIndex&&this._initSearch(t);this._isPageScrollHighlight=!1;i=this;setTimeout(function(){n("#"+i._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader")},100)},_clearAllOccurrences:function(){var e,u,r,f,t;for(this._searchedText="",e=document.getElementById(this._id+"custom-menu"),n(e).hide(),this._isTextHighlighted=!1,this._isTextSearch=!1,this._searchAjaxRequestState!=null&&(this._searchAjaxRequestState.abort(),this._searchAjaxRequestState=null),this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-nooccurrence"),u=1;u<=this._totalPages;u++)if(this._renderedCanvasList.indexOf(parseInt(u))!==-1){if(r=this._textDivs[u],f=this._textContents[u],!r||r==i)break;for(t=0;t<r.length;t++)r[t].textContent=f[t],this._isFindboxPresent||(r[t].textContent="",r[t].textContent=f[t]+"\r\n")}},_doAjaxPostSearch:function(i,r){var u=this;this._searchAjaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:i,traditional:!0,success:function(n){var i;i=typeof n=="object"?JSON.stringify(n):n;jsondata=typeof n=="object"?u._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(JSON.stringify(n)):JSON.parse(JSON.stringify(n).d):u._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(n):JSON.parse(n.d);u._pageContents[parseInt(jsondata.currentpage)]=i;u._pageText[parseInt(jsondata.currentpage)]=jsondata.pageContents;u._initSearch(r)},error:function(n){u._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_keyboardShortcutFind:function(n){n.ctrlKey&&n.which==70&&(n.preventDefault(),this._isTextSearchHidden||this._displaySearchBox())},_setSearchToolbarTop:function(){var n=document.getElementById(this._id+"_pdfviewer_searchbox");n.style.top="0px"},_searchBoxLocalization:function(){var r=n("#"+this._id+"_pdfviewer_searchbox").find(".e-pdfviewer-label")[0],u=n("#"+this._id+"_pdfviewer_searchbox").find(".e-pdfviewer-label")[1],i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=i.contextMenu.Find.contentText,e=i.contextMenu.matchCase.contentText;n(r).text(f);n(u).text(e)},_displaySearchBox:function(){this._isToolbarHidden||(n("#"+this._id+"_pdfviewer_searchbox").css("display")=="none"?(this._searchBoxLocalization(),this._clearSelector(),this._displaySearch=!0,n("#"+this._id+"_pdfviewer_searchbox").css({position:"absolute",display:"block"}),this._resizeSearchToolbar(),n("#"+this._id+"_pdfviewer_searchinput").focus().select(),this._isFindboxPresent=!0):(this._displaySearch=!1,this._isFindboxPresent=!1,this._clearAllOccurrences(),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),n("#"+this._id+"_pdfviewer_searchbox").css({display:"none"})))},_showTextSearchButton:function(t){t?(n("#"+this._id+"_find").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isTextSearchHidden=!1):(n("#"+this._id+"_find").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isFindboxPresent&&this._displaySearchBox(),this._isTextSearchHidden=!0)},_renderTextMarkupAnnotation:function(n,t){var s=document.getElementById(this._id+"_secondarycanvas_"+t),i=s.getContext("2d"),o,r,f,e,u;if(i.setLineDash([]),n)for(o=0;o<n.length;o++)if(r=n[o],r.TextMarkupAnnotationType=="StrikeOut"){for(f=r.Color,r.isLocked=this.model.strikethroughSettings.isLocked,e=0;e<r.Bounds.length;e++)u=r.Bounds[e],i.globalAlpha=r.Opacity,i.beginPath(),i.moveTo(this._convertPointToPixel(u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height/2)*this._zoomVal),i.lineTo(this._convertPointToPixel(u.Width+u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height/2)*this._zoomVal),i.strokeStyle="rgb("+f.R+","+f.G+","+f.B+")",i.closePath(),i.msFillRule="nonzero",i.stroke();i.lineWidth=r.BorderWidth;i.save()}else if(r.TextMarkupAnnotationType=="Highlight"){for(r.isLocked=this.model.highlightSettings.isLocked,e=0;e<r.Bounds.length;e++)u=r.Bounds[e],i.beginPath(),i.rect(this._convertPointToPixel(u.X)*this._zoomVal,this._convertPointToPixel(u.Y)*this._zoomVal,this._convertPointToPixel(u.Width)*this._zoomVal,this._convertPointToPixel(u.Height)*this._zoomVal),i.lineWidth=r.BorderWidth,f=r.Color,i.globalAlpha=r.Opacity*.5,i.closePath(),i.fillStyle="rgb("+f.R+","+f.G+","+f.B+")",i.msFillRule="nonzero",i.fill();i.save()}else if(r.TextMarkupAnnotationType=="Underline"){for(r.isLocked=this.model.underlineSettings.isLocked,f=r.Color,e=0;e<r.Bounds.length;e++)u=r.Bounds[e],i.globalAlpha=r.Opacity,i.beginPath(),i.moveTo(this._convertPointToPixel(u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height)*this._zoomVal),i.lineTo(this._convertPointToPixel(u.Width+u.X)*this._zoomVal,this._convertPointToPixel(u.Y+u.Height)*this._zoomVal),i.lineWidth=r.BorderWidth,i.closePath(),i.strokeStyle="rgb("+f.R+","+f.G+","+f.B+")",i.msFillRule="nonzero",i.stroke();i.save()}this._newAnnotationList[t-1]&&this._newAnnotationList[t-1].length!=0&&this._renderNewAnnotations(this._newAnnotationList[t-1],i)},_renderNewAnnotations:function(n,t){for(var i,u,r,f=0;f<n.length;f++)if(i=n[f],i.type=="StrikeOut"){for(t.globalAlpha=i.opacity,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.moveTo(r.xPosition*this._zoomVal,(r.yPosition+r.height/2)*this._zoomVal),t.lineTo((r.xPosition+r.width)*this._zoomVal,(r.yPosition+r.height/2)*this._zoomVal),t.strokeStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.closePath(),t.msFillRule="nonzero",t.stroke();t.save()}else if(i.type=="Highlight"){for(t.globalAlpha=i.opacity*.5,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.rect(r.xPosition*this._zoomVal,r.yPosition*this._zoomVal,r.width*this._zoomVal,r.height*this._zoomVal),t.closePath(),t.fillStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.msFillRule="nonzero",t.fill();t.save()}else if(i.type=="Underline"){for(t.globalAlpha=i.opacity,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.moveTo(r.xPosition*this._zoomVal,(r.yPosition+r.height)*this._zoomVal),t.lineTo((r.xPosition+r.width)*this._zoomVal,(r.yPosition+r.height)*this._zoomVal),t.strokeStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.closePath(),t.msFillRule="nonzero",t.stroke();t.save()}},_addAnnotation:function(n){var t=document.getElementById(this._id+"_secondarycanvas_"+this._currentPage),r=t.getContext("2d"),i;t.style.zIndex="2";i=window.getSelection().toString();switch(n){case"StrikeOut":window.getSelection().toString()?(this._drawStrikeOutAnnotation(),this._isHighlight=!1,this._annotationActive=!0):(this._annotationActive=!0,this._isHighlight=!1,this._isStrikeout=!0,this._isUnderline=!1);break;case"Underline":window.getSelection().toString()?(this._drawUnderlineAnnotation(),this._annotationActive=!0,this._isHighlight=!1):(this._annotationActive=!0,this._isHighlight=!1,this._isUnderline=!0,this._isStrikeout=!1);break;case"Highlight":window.getSelection().toString()?(this._drawHighlightAnnotation(),this._annotationActive=!0,this._isHighlight=!0):(this._annotationActive=!0,this._isHighlight=!0,this._isUnderline=!1,this._isStrikeout=!1)}},_initHighlight:function(){this._isHighlightEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._addAnnotation("Highlight"),this._isHighlightEnabled=!0,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._isHighlight=!0)},_initStrikeOut:function(){this._isStrikeOutEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._addAnnotation("StrikeOut"),this._isStrikeOutEnabled=!0,this._isUnderlineEnabled=!1,this._isHighlightEnabled=!1,this._isStrikeout=!0)},_initUnderline:function(){this._isUnderlineEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._addAnnotation("Underline"),this._isUnderlineEnabled=!0,this._isHighlightEnabled=!1,this._isStrikeOutEnabled=!1,this._isUnderline=!0)},_getPagePosition:function(n){var t=document.getElementById(this._id+"selectioncanvas_"+n);return pagePosition=t.getBoundingClientRect()},_getTextNodes:function(n,t){var u=[],i=document.createRange(),f=n.getRangeAt(0),c=f.getBoundingClientRect(),s,y,h,e,r,o;if(n.anchorNode==n.focusNode)this._isBackwardSelection?(i.setStart(n.focusNode,n.focusOffset),i.setEnd(n.anchorNode,n.anchorOffset)):n.anchorOffset<n.focusOffset?(i.setStart(n.anchorNode,n.anchorOffset),i.setEnd(n.focusNode,n.focusOffset)):(i.setStart(n.focusNode,n.focusOffset),i.setEnd(n.anchorNode,n.anchorOffset)),s=i.getBoundingClientRect(),u.push(s);else if(this._isBackwardSelection)this._getAnnotationOffsets(f,n.focusNode,n.anchorNode,n.focusOffset,n.anchorOffset,u);else{var l=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,a=navigator.userAgent.indexOf("Edge")!=-1,v=document.documentMode||/Edge/.test(navigator.userAgent);if(l||a||v){for(y=!1,r=0;r<this._textDivs[t].length;r++)o=this._textDivs[t][r].textContent,o==n.anchorNode.data&&(h=r),o==n.focusNode.data&&(e=r),r!=this._textDivs[t].length-1||e||(e=this._textDivs[t].length-1);h<e?this._getAnnotationOffsets(f,n.anchorNode,n.focusNode,n.anchorOffset,n.focusOffset,u):this._getAnnotationOffsets(f,n.focusNode,n.anchorNode,n.focusOffset,n.anchorOffset,u)}else this._getAnnotationOffsets(f,n.anchorNode,n.focusNode,n.anchorOffset,n.focusOffset,u)}return{rectangleBound:c,bounds:u}},_getAnnotationOffsets:function(n,t,i,r,u,f){var c=parseInt(t.parentNode.id.split("text_")[1]),p=parseInt(t.parentNode.id.split("text_"+c+"_")[1]),s=parseInt(i.parentNode.id.split("text_")[1]),w=parseInt(i.parentNode.id.split("text_"+s+"_")[1]),b,k,v,d,e,g,o,l,h,a,y,nt;for(this._isFindboxPresent&&this._clearAllOccurrences(),d=c!=s&&this._isBackwardSelection?s:c,e=d;e<=s;e++){if(g=this._textDivs[e],e==c)v=p;else if(this._isBackwardSelection)v=0;else break;for(o=v;o<this._textDivs[e].length;o++){for(l=g[o],h=document.createRange(),b=o==p?r:0,k=o==w?u:l.textContent.length,a=0;a<l.childNodes.length;a++)y=l.childNodes[a],h.setStart(y,b),h.setEnd(y,k);if(nt=h.getBoundingClientRect(),h.detach(),f.push(nt),e==s&&o==w)break}}},_drawStrikeOutAnnotation:function(){var f,w,e,b,k,r,d;if(this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation){if(window.getSelection().toString()){var h=window.getSelection(),t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l,g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,nt=navigator.userAgent.indexOf("Edge")!=-1,tt=document.documentMode||/Edge/.test(navigator.userAgent);(g||nt||tt)&&(t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l=parseInt(h.focusNode.parentNode.id.split("text_")[1]),t<l?this._isBackwardSelection=!1:t>l&&(this._isBackwardSelection=!0));var v=[],y=this._getTextNodes(h,t),i=this._drawColor?this._drawColor:this.model.strikethroughSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var it=new Date,rt=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:it.toLocaleString(),c={type:"StrikeOut",bounds:[],author:this.model.strikethroughSettings.author,subject:this.model.strikethroughSettings.subject,modifiedDate:rt,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.strikethroughSettings.opacity,note:"",pageNumber:t,isLocked:this.model.strikethroughSettings.isLocked};for(r=0;r<y.bounds.length;r++){pagePosition=this._getPagePosition(t);var u=y.bounds[r],a=u.left-pagePosition.left,f=u.top-pagePosition.top;f>this._pageSize[t-1].PageHeight&&(t++,pagePosition=this._getPagePosition(t),f=u.top-pagePosition.top);var p=document.getElementById(this._id+"_secondarycanvas_"+t),ut=p.getBoundingClientRect(),o=p.getContext("2d");o.beginPath();f=f-1.2*this._zoomVal;o.moveTo(a,f+u.height/2);o.lineTo(a+u.width,f+u.height/2);o.closePath();o.strokeStyle=i;o.stroke();w={xPosition:a/this._zoomVal,yPosition:f/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};c.bounds.push(w)}for(this._newAnnotationList[t-1].push(c),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(c))),e={},e.annotationSettings=this.model.strikethroughSettings,e.annotationId=this._totalAnnotations[t].length-1,e.pageId=t,e.annotationBound=c.bounds,e.annotationType="StrikeOut",this._raiseClientEvent("annotationAdd",e),b=this._newAnnotationList[t-1].length-1,v.push(b),k={operation:"AddedStrikeOut",pageNumber:t,indexes:v},this._recentOperation.push(k),this._redoActions=[],r=0;r<this._totalPages;r++)d=[],this._redoAnnotationCollection[r]=d;window.getSelection().removeAllRanges();this.isDocumentEdited=!0}n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawUnderlineAnnotation:function(){var f,w,e,b,k,r,d;if(this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&window.getSelection().toString()){var h=window.getSelection(),t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l,g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,nt=navigator.userAgent.indexOf("Edge")!=-1,tt=document.documentMode||/Edge/.test(navigator.userAgent);(g||nt||tt)&&(t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l=parseInt(h.focusNode.parentNode.id.split("text_")[1]),t<l?this._isBackwardSelection=!1:t>l&&(this._isBackwardSelection=!0));var v=[],i=this._drawColor?this._drawColor:this.model.underlineSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var y=this._getTextNodes(h,t),it=new Date,rt=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:it.toLocaleString(),c={type:"Underline",bounds:[],author:this.model.underlineSettings.author,subject:this.model.underlineSettings.subject,modifiedDate:rt,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.underlineSettings.opacity,note:"",pageNumber:t,isLocked:this.model.underlineSettings.isLocked};for(r=0;r<y.bounds.length;r++){pagePosition=this._getPagePosition(t);var u=y.bounds[r],a=u.left-pagePosition.left,f=u.top-pagePosition.top;f>this._pageSize[t-1].PageHeight&&(t++,pagePosition=this._getPagePosition(t),f=u.top-pagePosition.top);var p=document.getElementById(this._id+"_secondarycanvas_"+t),ut=p.getBoundingClientRect(),o=p.getContext("2d");o.beginPath();f=f-1.2*this._zoomVal;o.moveTo(a,f+u.height);o.lineTo(a+u.width,f+u.height);o.closePath();o.strokeStyle=i;o.stroke();w={xPosition:a/this._zoomVal,yPosition:f/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};c.bounds.push(w)}for(this._newAnnotationList[t-1].push(c),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(c))),e={},e.annotationSettings=this.model.underlineSettings,e.annotationId=this._totalAnnotations[t].length-1,e.pageId=t,e.annotationBound=c.bounds,e.annotationType="Underline",this._raiseClientEvent("annotationAdd",e),b=this._newAnnotationList[t-1].length-1,v.push(b),k={operation:"AddedUnderline",pageNumber:t,indexes:v},this._recentOperation.push(k),this._redoActions=[],r=0;r<this._totalPages;r++)d=[],this._redoAnnotationCollection[r]=d;this.isDocumentEdited=!0;window.getSelection().removeAllRanges();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawHighlightAnnotation:function(){var e,w,f,b,k,r,d;if(this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation){if(window.getSelection().toString()){var h=window.getSelection(),t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l,g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,nt=navigator.userAgent.indexOf("Edge")!=-1,tt=document.documentMode||/Edge/.test(navigator.userAgent);(g||nt||tt)&&(t=parseInt(h.anchorNode.parentNode.id.split("text_")[1]),l=parseInt(h.focusNode.parentNode.id.split("text_")[1]),t<l?this._isBackwardSelection=!1:t>l&&(this._isBackwardSelection=!0));var a=[],v=this._getTextNodes(h,t),i=this._drawColor?this._drawColor:this.model.highlightSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var it=new Date,rt=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:it.toLocaleString(),c={type:"Highlight",bounds:[],author:this.model.highlightSettings.author,subject:this.model.highlightSettings.subject,modifiedDate:rt,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.highlightSettings.opacity,note:"",pageNumber:t,isLocked:this.model.highlightSettings.isLocked};for(r=0;r<v.bounds.length;r++){pagePosition=this._getPagePosition(t);var u=v.bounds[r],y=u.left-pagePosition.left,e=u.top-pagePosition.top;e>this._pageSize[t-1].PageHeight&&(t++,pagePosition=this._getPagePosition(t),e=u.top-pagePosition.top);var p=document.getElementById(this._id+"_secondarycanvas_"+t),ut=p.getBoundingClientRect(),o=p.getContext("2d");o.beginPath();e=e-1.2*this._zoomVal;o.rect(y,e,u.width,u.height);o.closePath();o.globalAlpha=.5;o.fillStyle=i;o.fill();w={xPosition:y/this._zoomVal,yPosition:e/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};c.bounds.push(w)}for(this._newAnnotationList[t-1].push(c),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(c))),f={},f.annotationSettings=this.model.highlightSettings,f.annotationId=this._totalAnnotations[t].length-1,f.pageId=t,f.annotationBound=c.bounds,f.annotationType="Highlight",this._raiseClientEvent("annotationAdd",f),b=this._newAnnotationList[t-1].length-1,a.push(b),k={operation:"AddedHighlight",pageNumber:t,indexes:a},this._recentOperation.push(k),this._redoActions=[],r=0;r<this._totalPages;r++)d=[],this._redoAnnotationCollection[r]=d;this.isDocumentEdited=!0;window.getSelection().removeAllRanges()}n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawAnnotationRect:function(n,t,i,r,u){var e=document.getElementById(this._id+"_secondarycanvas_"+n),f;e&&(f=e.getContext("2d"),f.beginPath(),f.setLineDash([4]),f.globalAlpha=1,f.rect(t,i,r,u),f.closePath(),f.strokeStyle="blue",f.stroke(),f.save())},_drawAnnotSelectRect:function(n,t){var o=t[t.length-1],f,e,u,r,i;if(this._selectedAnnotation=o,this._selectedAnnotationObject={},this._selectedAnnotationObject.annotation=o,this._selectedAnnotationObject.pageIndex=n,f=this._getAnnotation(t,n),f.isExistingAnnotation)for(e=this._textMarkupAnnotationList[n][f.currentAnnotationIndex],r=0;r<e.Bounds.length;r++)i=e.Bounds[r],this._drawAnnotationRect(n,this._convertPointToPixel(i.X)*this._zoomVal,this._convertPointToPixel(i.Y)*this._zoomVal,this._convertPointToPixel(i.Width)*this._zoomVal,this._convertPointToPixel(i.Height)*this._zoomVal);else if(u=t[0],u.bounds)for(r=0;r<u.bounds.length;r++)i=u.bounds[r],this._drawAnnotationRect(n,(i.xPosition-.5)*this._zoomVal,(i.yPosition-.5)*this._zoomVal,(i.width+.5)*this._zoomVal,(i.height+.5)*this._zoomVal);this._isAnnotationSelected=!0},_clearRectOnClick:function(n){var t=document.getElementById(this._id+"_secondarycanvas_"+n),i=t.getContext("2d");i.setLineDash([]);i.clearRect(0,0,t.width,t.height);this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[n],n);this._isAnnotationSelected=!1;this._selectedAnnotationObject=null},_onCanvasMousedown:function(t,i,r){var f=t.getContext("2d"),e=parseInt(i-n(t.parentNode).offset().left),o=parseInt(r-n(t.parentNode).offset().top),u=f.getImageData(e,o,1,1).data;this._annotationColor=this._rgb2Color(u[0],u[1],u[2])},_showPopupNote:function(t){var o=document.getElementById(this._id+"_note_content"),i=this._currentAnnotationRectangle[0],e,r,u;if(i.note){o.textContent=i.note;var s=i.Color?i.Color.R:i.colorR,h=i.Color?i.Color.G:i.colorG,c=i.Color?i.Color.B:i.colorB,f=document.getElementById(this._id+"_author_content");f.style.borderBottom="1px solid black";f.style.fontWeight="bold";e=i.Author?i.Author:i.author;e;f.textContent=e;o.style.backgroundColor="rgb("+s+","+h+","+c+")";r=n("#"+this._id+"_popup_note");u=this._setPopupMenuPosition(t,r);r.css({display:"block","background-color":"rgb("+s+","+h+","+c+")",position:"absolute"});r.show();r.offset({top:u.y+5,left:u.x+5}).show();r.show();r.offset({top:u.y+5,left:u.x+5}).show();r.show()}},_showPopupMenu:function(t){var v,s,h,c,f,l,a,r,e,u;if(!this._isPropertiesWindowOpen){if(this._isPopupNoteVisible=!0,n("#"+this._id+"_popup_note").hide(),document.getElementById(this._id+"_popupinnercontent").innerText="",v=document.getElementById(this._id+"highlight-menu"),n(v).hide(),this._isContextMenuPresent=!1,s=document.getElementById(this._id+"_popupinnercontent"),n(s).focus(),s.contentEditable=!0,l=this._currentAnnotationRectangle.length>0?this._currentAnnotationRectangle:this._currentAnnotationRectangleBackup,this._annotationBackupNoteSave=l,a=this._getAnnotation(l,this._AnnotationPage),a.isExistingAnnotation)r=this._textMarkupAnnotationList[this._AnnotationPage][a.currentAnnotationIndex],h=r.Author,c=r.ModifiedDate,r.note&&(f=r.note);else for(e=0;e<this._currentAnnotations.length;e++){u=this._currentAnnotations[e];h=u.author;c=u.modifiedDate;u.note&&(f=u.note);break}document.getElementById(this._id+"_username").innerText=h;document.getElementById(this._id+"_currentTime").innerText=c;f&&(document.getElementById(this._id+"_popupinnercontent").innerText=f);var i=document.getElementById(this._id+"_popupmenu"),y=n(i),o=this._setPopupMenuPosition(t,y);n(i).show();n(i).offset({top:o.y,left:o.x}).show();n(i).show();n(i).offset({top:o.y,left:o.x}).show();n(i).show()}},_saveNote:function(){var e,t,f,i,n;e=this._annotationBackupNoteSave?this._annotationBackupNoteSave:this._currentAnnotationRectangle.length>0?this._currentAnnotationRectangle:this._currentAnnotationRectangleBackup;var r=new Date,o=this._getAnnotation(e,this._AnnotationPage),u=document.getElementById(this._id+"_popupinnercontent");if(o.isExistingAnnotation)t=this._textMarkupAnnotationList[this._AnnotationPage][o.currentAnnotationIndex],t.note!=u.textContent&&(n=t.TextMarkupAnnotationType,n=="Highlight"?t.ModifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:r.toLocaleString():n=="Underline"?t.ModifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:r.toLocaleString():n=="StrikeOut"&&(t.ModifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:r.toLocaleString()),t.note=u.textContent);else for(f=0;f<this._currentAnnotations.length;f++){i=this._currentAnnotations[f];i.note!=u.textContent&&(n=i.type,n=="Highlight"?i.modifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:r.toLocaleString():n=="Underline"?i.modifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:r.toLocaleString():n=="StrikeOut"&&(i.modifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:r.toLocaleString()),i.note=u.textContent);break}u.innerText=""},_setPropertiesWindowLocale:function(t){var i=t.propertyWindow.appearance.contentText,r=t.propertyWindow.general.contentText,u=t.propertyWindow.color.contentText,f=t.propertyWindow.opacity.contentText,e=t.propertyWindow.author.contentText,o=t.propertyWindow.subject.contentText,s=t.propertyWindow.modified.contentText,h=t.propertyWindow.ok.contentText,c=t.propertyWindow.cancel.contentText,l=t.propertyWindow.locked.contentText;this._replaceTextLocale(n("#"+this._id+"_appearanceli").children("a")[0],i);this._replaceTextLocale(n("#"+this._id+"_generalli").children("a")[0],r);this._replaceTextLocale(n("#"+this._id+"_colorspan")[0],u);this._replaceTextLocale(n("#"+this._id+"_opacityspan")[0],f);this._replaceTextLocale(n("#"+this._id+"_authorspan")[0],e);this._replaceTextLocale(n("#"+this._id+"_subjectspan")[0],o);this._replaceTextLocale(n("#"+this._id+"_modifiedspan")[0],s);this._replaceTextLocale(n("#"+this._id+"_ok")[0],h);this._replaceTextLocale(n("#"+this._id+"_cancel")[0],c);this._replaceTextLocale(n("#"+this._id+"_lockedprop")[0],l)},_showPropertiesMenu:function(){var e,k,d,o,l,a,v,y,p,w,u,i,s,r,b,g,h,f,c;if(this._isPropertiesWindowOpen=!0,e=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],this._setPropertiesWindowLocale(e),k=document.getElementById(this._id+"highlight-menu"),n(k).hide(),this._isContextMenuPresent=!1,d=n("#"+this._id+"_PropertiesDialogTab").data("ejTab"),d.showItem(0),w=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage),w.isExistingAnnotation)i=this._textMarkupAnnotationList[this._AnnotationPage][w.currentAnnotationIndex],o={r:i.Color.R,g:i.Color.G,b:i.Color.B},l=i.Opacity,a=i.Author,v=i.Subject,y=i.ModifiedDate,p=i.isLocked,u=i.TextMarkupAnnotationType;else for(s=0;s<this._currentAnnotations.length;s++){r=this._currentAnnotations[s];o={r:r.colorR,g:r.colorG,b:r.colorB};l=r.opacity;a=r.author;v=r.subject;y=r.modifiedDate;p=r.isLocked;u=r.type;break}this._colorpickerObject.option("value",this._rgb2Color(o.r,o.g,o.b));f=n("#"+this._id+"_slider").data("ejSlider");b=parseInt(l*100);f.option("value",b);n("#"+this._id+"_opacity").val(b+"%");n("#"+this._id+"_author_input").val(a);n("#"+this._id+"_subject_input").val(v);g=document.getElementById(this._id+"_modifieddate").childNodes[0];g.textContent=y;n("#"+this._id+"_containerDialogTab").ejDialog({title:u+" Properties"});h=n("#"+this._id+"_containerDialogTab_title").children("span")[0];u=="Highlight"?h.textContent=e.propertyWindow.highlightProperties.contentText:u=="StrikeOut"?h.textContent=e.propertyWindow.strikeOutProperties.contentText:u=="Underline"&&(h.textContent=e.propertyWindow.underlineProperties.contentText);n("#"+this._id+"_containerDialogTab").ejDialog("open");n("#"+this.id+"_colorpicker").ejColorPicker("show");p?(this._colorpickerObject.option("enabled",!1),document.getElementById(this._id+"_opacity").disabled=!0,n("#"+this._id+"_opacity").addClass("e-disable"),f=n("#"+this._id+"_slider").data("ejSlider"),f.disable(),document.getElementById(this._id+"_author_input").disabled=!0,n("#"+this._id+"_author_input").addClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!0,n("#"+this._id+"_subject_input").addClass("e-disable"),c=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),c.option("checked",!0)):(this._colorpickerObject.option("enabled",!0),document.getElementById(this._id+"_opacity").disabled=!1,n("#"+this._id+"_opacity").removeClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!1,n("#"+this._id+"_author_input").removeClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!1,n("#"+this._id+"_subject_input").removeClass("e-disable"),f=n("#"+this._id+"_slider").data("ejSlider"),f.enable(),c=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),c.option("checked",!1))},_lockProperties:function(){var i=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),t;i.model.checkState=="check"?(this._colorpickerObject.option("enabled",!1),document.getElementById(this._id+"_opacity").disabled=!0,n("#"+this._id+"_opacity").addClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!0,n("#"+this._id+"_author_input").addClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!0,n("#"+this._id+"_subject_input").addClass("e-disable"),t=n("#"+this._id+"_slider").data("ejSlider"),t.disable()):(this._colorpickerObject.option("enabled",!0),document.getElementById(this._id+"_opacity").disabled=!1,n("#"+this._id+"_opacity").removeClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!1,n("#"+this._id+"_author_input").removeClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!1,n("#"+this._id+"_subject_input").removeClass("e-disable"),t=n("#"+this._id+"_slider").data("ejSlider"),t.enable())},_setDrawColor:function(n){this._isDefaultColorSet&&(this._drawColor=this._toolbarColorpickerObject.hexCodeToRGB(n.value),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._isDefaultColorSet=!1)},_createNote:function(){var r=n("#"+this._id+"_viewerContainer"),i=t.buildTag("div.e-pdfviewer-annotation-note","",{display:"none"},{id:this._id+"_popup_note"}),u=t.buildTag("div.e-pdfviewer-annotation-authorcontent","",{},{id:this._id+"_author_content"}),f=t.buildTag("div.e-pdfviewer-annotation-notecontent","",{},{id:this._id+"_note_content"});i.append(u);i.append(f);r.append(i)},_createPopupMenu:function(){var p=n("#"+this._id+"_viewerContainer"),r=document.createElement("DIV"),u,f,c,v,l,o,s,y,e,i,h,a;r.id=this._id+"_popupmenu";r.className="e-pdfviewer-popupmenu";p.append(r);u=document.createElement("DIV");u.className="e-pdfviewer-header";u.id=this._id+"_popupheader";r.appendChild(u);f=document.createElement("DIV");f.className="e-pdfviewer-username";f.id=this._id+"_username";f.innerHTML="Guest";u.appendChild(f);c=t.buildTag("div.e-pdfviewer-closepopup","",{},{id:this._id+"_popup_close"});v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closeicon");c[0].appendChild(v[0]);u.appendChild(c[0]);l=this;n(".e-pdfviewer-closeicon").on("click touchend",function(){l._saveNote();n(".e-pdfviewer-popupmenu").hide();l._isPopupNoteVisible=!1});o=document.createElement("DIV");s=document.createElement("DIV");o.className="e-pdfviewer-currenttime";s.id=this._id+"_currentTime";y=new Date;s.innerHTML=y.toLocaleString();o.appendChild(s);r.appendChild(o);e=document.createElement("DIV");e.className="e-pdfviewer-content";e.id=this._id+"_popupcontent";i=document.createElement("DIV");i.className="e-pdfviewer-innercontent";i.id=this._id+"_popupinnercontent";i.innerText=" ";i.style.width="366.667px";i.style.height="132.073px";i.style.overflow="hidden";i.style.overflowY="auto";e.appendChild(i);r.appendChild(e);h=document.createElement("DIV");h.className="e-pdfviewer-footer";h.id=this._id+"_popupfooter";r.appendChild(h);a=document.getElementById(this._id+"_popupmenu");i.addEventListener("paste",function(n){n.preventDefault();var t=n.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,t)});this._on(n(a),"mousedown touchstart",this._popupNoteMousedown);this._on(n(a),"mouseup touchend",this._popupNoteMouseup);this._on(n(window),"touchmove mousemove",this._movePopupNote)},_popupNoteMousedown:function(n){if(n.type=="touchstart"&&(n=n.originalEvent.changedTouches[0]),n.which!=3||n.type=="touchstart"){this._isPopupNoteFocused=!0;var t=document.getElementById(this._id+"_popupmenu");this._xpos=n.clientX-t.offsetLeft;this._ypos=n.clientY-t.offsetTop}},_popupNoteMouseup:function(){this._enableSelection();this._isPopupNoteFocused=!1},_movePopupNote:function(t){var u,i;if(t.preventDefault(),t.type=="touchmove"&&(t=t.originalEvent.changedTouches[0]),this._isPopupNoteFocused||t.type=="touchmove"){u=document.getElementById(this._id+"_viewerContainer");i=document.getElementById(this._id+"_popupmenu");this._isContextMenuPresent=!0;var r=t.clientX-this._xpos,f=t.clientY-this._ypos,e=this._calulateCurrentPosition(f,i),o=parseFloat(n(i).css("width")),s=parseFloat(n(i).css("height"));r>0&&r+o<=u.clientWidth&&(i.style.left=r+"px");e&&(i.style.top=f+"px")}},_calulateCurrentPosition:function(t,i){for(var f,e,r=5,o=parseFloat(n(i).css("height")),u=1;u<=this._totalPages;u++)f=this._pageSize[u-1].PageHeight*this._zoomVal,u==this._AnnotationPage&&t>r&&t+o<f+r&&(e=r),r+=f;if(e)return!0},_createPropertiesMenu:function(){var ti=n("#"+this._id+"_pageviewContainer"),vt=document.createElement("div"),w,b,r,ni,k,c,d,g,nt,tt,u,it,rt,ut,i,l,pt,f,a,ft,et,ot,e,v,st,ht,ct,o,s,lt,at,y,wt;vt.id=this._id+"_containerDialogTab";var yt=document.createElement("div"),p=t.buildTag("div","",{height:"auto"},{id:this._id+"_PropertiesDialogTab"}),bt=document.createElement("ul");bt.innerHTML="<li id= '"+this._id+"_appearanceli'><a href=#"+this._id+"_apperanceProperties>Appearance<\/a><\/li><li id= '"+this._id+"_generalli'><a href=#"+this._id+"_generalProperties>General<\/a><\/li>";w=t.buildTag("div","",{},{id:this._id+"_apperanceProperties"});b=t.buildTag("div","",{},{id:this._id+"_generalProperties"});yt.appendChild(p[0]);p[0].appendChild(bt);p[0].appendChild(w[0]);p[0].appendChild(b[0]);r=document.createElement("div");r.style.paddingBottom="11px";var kt=t.buildTag("button.e-pdfviewer-properties-okbtn","OK",{float:"right","margin-right":"18px"},{id:this._id+"_ok"}),dt=t.buildTag("button.e-pdfviewer-properties-cancelbtn","Cancel",{float:"right"},{id:this._id+"_cancel"}),gt=t.buildTag("input","",{},{type:"checkbox"}),h=document.createElement("label");h.id=this._id+"_lockedprop";h.className="e-pdfviewer-properties-label";h.style.marginRight="18px";h.innerHTML="Locked";r.appendChild(gt[0]);r.appendChild(h);r.appendChild(dt[0]);r.appendChild(kt[0]);gt.ejCheckBox({cssClass:"e-pdfviewer-lockedcheckbox",id:this._id+"_lockedcheckbox",size:t.CheckboxSize.Small,change:n.proxy(this._lockProperties,this)});w[0].style.height="300px";b[0].style.height="300px";yt.appendChild(r);vt.appendChild(yt);ti.append(vt);kt.ejButton({showRoundedCorner:!0,size:"small"});dt.ejButton({showRoundedCorner:!0,size:"small"});n("#"+this._id+"_PropertiesDialogTab").ejTab({});ni=this.element.width();ni>=500?n("#"+this._id+"_containerDialogTab").ejDialog({showOnInit:!1,width:"500px",enableResize:!1,close:n.proxy(this._closePropertiesWindow,this)}):n("#"+this._id+"_containerDialogTab").ejDialog({showOnInit:!1,width:"auto",enableResize:!1,close:n.proxy(this._closePropertiesWindow,this)});k=document.createElement("div");c=document.createElement("div");c.className="e-pdfviewer-color-container";k.appendChild(c);d=document.createElement("div");d.className="e-pdfviewer-color-span";g=document.createElement("div");g.className="e-pdfviewer-color-picker";c.appendChild(d);c.appendChild(g);nt=document.createElement("SPAN");nt.id=this._id+"_colorspan";nt.innerHTML="Color:";d.appendChild(nt);tt=document.createElement("input");tt.type="text";tt.id=this._id+"_colorpicker";g.appendChild(tt);u=document.createElement("div");u.className="e-pdfviewer-opacity-container";k.appendChild(u);it=document.createElement("div");it.className="e-pdfviewer-opacity-span";rt=document.createElement("div");rt.className="e-pdfviewer-opacity-field";u.appendChild(it);u.appendChild(rt);ut=document.createElement("SPAN");ut.id=this._id+"_opacityspan";ut.innerHTML="Opacity:";it.appendChild(ut);i=document.createElement("input");i.type="text";i.id=this._id+"_opacity";i.className="e-inputchangeval";i.value="100%";i.style.width="50px";i.style.height="20px";rt.appendChild(i);l=document.createElement("div");l.className="e-pdfviewer-slider-control";l.style.width="100px";u.appendChild(l);pt=document.createElement("DIV");pt.id=this._id+"_slider";l.appendChild(pt);w.append(k);n("#"+this._id+"_colorpicker").ejColorPicker({modelType:"palette"});n("#"+this._id+"_colorpicker").ejColorPicker("hide");this._colorpickerObject=n("#"+this._id+"_colorpicker").data("ejColorPicker");n("#"+this._id+"_slider").ejSlider({cssClass:"e-pdfviewer-opacity-slider",value:100,minValue:0,maxValue:100,incrementStep:1,showRoundedCorner:!0,change:this._slidervaluechange,slide:this._slidervaluechange});f=document.createElement("div");f.style.border="0px";a=document.createElement("div");a.className="e-pdfviewer-author-container";f.appendChild(a);ft=document.createElement("div");ft.className="e-pdfviewer-author-span";a.appendChild(ft);et=document.createElement("SPAN");et.id=this._id+"_authorspan";et.innerHTML="Author:";ft.appendChild(et);ot=document.createElement("div");ot.className="e-pdfviewer-author-inputdiv";a.appendChild(ot);e=document.createElement("input");e.id=this._id+"_author_input";e.className="e-pdfviewer-author-input";ot.appendChild(e);v=document.createElement("div");v.className="e-pdfviewer-subject-container";f.appendChild(v);st=document.createElement("div");st.className="e-pdfviewer-subject-span";v.appendChild(st);ht=document.createElement("SPAN");ht.id=this._id+"_subjectspan";ht.innerHTML="Subject:";st.appendChild(ht);ct=document.createElement("div");ct.className="e-pdfviewer-subject-inputdiv";v.appendChild(ct);o=document.createElement("input");o.id=this._id+"_subject_input";o.className="e-pdfviewer-subject-input";ct.appendChild(o);s=document.createElement("div");s.className="e-pdfviewer-modifieddate-container";s.style.height="18.67px";f.appendChild(s);lt=document.createElement("div");lt.className="e-pdfviewer-modified-labeldiv";at=document.createElement("SPAN");at.id=this._id+"_modifiedspan";at.innerHTML="Modified:";lt.appendChild(at);s.appendChild(lt);y=document.createElement("div");y.className="e-pdfviewer-modifieddate-labeldiv";y.id=this._id+"_modifieddate";wt=document.createElement("SPAN");wt.innerHTML="";y.appendChild(wt);s.appendChild(y);b.append(f);n("#"+this._id+"_containerDialogTab_title").addClass("e-pdfviewer-propertiestitle");n("#"+this._id+"_containerDialogTab").addClass("e-pdfviewer-propertiestab");n("#"+this._id+"_PropertiesDialogTab").addClass("e-pdfviewer-innertab");n("#"+this._id+"_apperanceProperties").addClass("e-pdfviewer-appearanceprop");n("#"+this._id+"_generalProperties").addClass("e-pdfviewer-generalprop");n("#"+this._id+"_appearanceli").addClass("e-pdfviewer-tab-li");n("#"+this._id+"_generalli").addClass("e-pdfviewer-tab-li");n(i).addClass("e-pdfviewer-elementalignments");n(i).addClass("ejinputtext");n(e).addClass("e-pdfviewer-elementalignments");n(e).addClass("ejinputtext");n(o).addClass("e-pdfviewer-elementalignments");n(o).addClass("ejinputtext");this._tabObject=n("#"+this._id+"_PropertiesDialogTab").data("ejTab");this._on(n("#"+this._id+"_ok"),"click",this._applyAnnotationProperties);this._on(n("#"+this._id+"_cancel"),"click",this._cancelAnnotationProperties)},_applyAnnotationProperties:function(){var e=this._tabObject,i=this._colorpickerObject.rgb,r=parseInt(n("#"+this._id+"_opacity").val().split("%")[0])/100,u=n("#"+this._id+"_author_input").val(),f=n("#"+this._id+"_subject_input").val(),t=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage);this._changeAnnotationProperties(i,r,u,f,t.currentAnnotationIndex,this._AnnotationPage,t.isExistingAnnotation);n("#"+this._id+"_containerDialogTab").ejDialog("close")},_cancelAnnotationProperties:function(){n("#"+this._id+"_containerDialogTab").ejDialog("close")},_getAnnotation:function(n,t){for(var f,h,u,i=this._textMarkupAnnotationList[t],e=[],o=null,s=!1,r=0;r<n.length;r++)if(i)for(f=0;f<i.length;f++)n[r]==i[f]&&(e.push(i[f]),o=f,s=!0);for(i=this._newAnnotationList[t-1],r=0;r<n.length;r++){if(i)for(u=0;u<i.length;u++)n[r]==i[u]&&(e.push(i[u]),o=u,s=!1,h=i[u]);if(n[r]==h)break}return this._currentAnnotations=e,{currentAnnotationIndex:o,isExistingAnnotation:s}},_changeAnnotationProperties:function(t,i,r,u,f,e,o){var g=document.getElementById(this._id+"_secondarycanvas_"+e),tt=g.getContext("2d"),v,s,a,k,b,d,nt;tt.clearRect(0,0,g.width,g.height);this._selectedAnnotationObject=null;var y=!1,p=!1,h,w,c={},l=new Date;for(this._drawAnnotSelectRect(e,this._currentAnnotationRectangleBackup),o?(s=this._textMarkupAnnotationList[e][f],(s.Color.R!=t.r||s.Color.G!=t.g||s.Color.B!=t.b||s.Opacity!=i||s.Author!=r||s.Subject!=u)&&(a={},a=JSON.parse(JSON.stringify(s)),this._colorModifiedAnnotationList[e-1].push(a),s.Color.R!=t.r||s.Color.G!=t.g||s.Color.B!=t.b?y=!0:s.Opacity!=i&&(p=!0),s.Color.R=t.r,s.Color.G=t.g,s.Color.B=t.b,s.Color.A=t.a,s.Opacity=i,s.Author=r,s.Subject=u,h=s.TextMarkupAnnotationType,h=="Highlight"?s.ModifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:l.toLocaleString():h=="Underline"?s.ModifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:l.toLocaleString():h=="StrikeOut"&&(s.ModifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:l.toLocaleString()),w=f,this._totalAnnotations[e][f]=JSON.parse(JSON.stringify(s)),v={},v.index=f,v.annotation=s,v.action="propertyChanged",this._existingAnnotationsModified[e-1].push(v),b={operation:"propertiesModifiedForExistingAnnot",pageNumber:this._AnnotationPage,indexes:f},this._recentOperation.push(b)),k=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),s.isLocked=k.model.checkState=="check"?!0:!1):(s=this._newAnnotationList[e-1][f],(s.colorR!=t.r||s.colorG!=t.g||s.colorB!=t.b||s.opacity!=i||s.author!=r||s.subject!=u)&&(a={},a=JSON.parse(JSON.stringify(s)),this._colorModifiedAnnotationList[e-1].push(a),s.colorR!=t.r||s.colorG!=t.g||s.colorB!=t.b?y=!0:s.opacity!=i&&(p=!0),s.colorR=t.r,s.colorG=t.g,s.colorB=t.b,s.opacity=i,s.colorA=s.opacity*255,s.author=r,s.subject=u,h=s.type,h=="Highlight"?s.modifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:l.toLocaleString():h=="Underline"?s.modifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:l.toLocaleString():h=="StrikeOut"&&(s.modifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:l.toLocaleString()),w=this._textMarkupAnnotationList[e]?this._textMarkupAnnotationList[e].length+f:f,this._totalAnnotations[e][w]=JSON.parse(JSON.stringify(s)),k=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),s.isLocked=k.model.checkState=="check"?!0:!1,b={operation:"propertiesModifiedForNewAnnot",pageNumber:this._AnnotationPage,indexes:f},this._recentOperation.push(b))),(y||p)&&(c.isColorChanged=y,c.isOpacityChanged=p,c.annotationType=h,c.annotationId=w,c.pageId=e,this._raiseClientEvent("annotationPropertiesChange",c)),this._redoActions=[],d=0;d<this._totalPages;d++)nt=[],this._redoAnnotationCollection[d]=nt;this.isDocumentEdited=!0;this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[e],e)},_slidervaluechange:function(t){var i=t.value,r=this._id.split("_slider")[0];n("#"+r+"_opacity").val(i+"%")},_deleteAnnotation:function(){var u,f,o,s,e,t,c;if(this._isAnnotationSelected){var i,h=[],r={},n=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage);if(n.isExistingAnnotation){for(i=this._textMarkupAnnotationList[this._AnnotationPage],u=i[n.currentAnnotationIndex],r.annotationType=u.TextMarkupAnnotationType,this._deletedAnnotationList[this._AnnotationPage-1].push(u),f={},f.index=u.Index,r.annotationId=u.Index,r.pageId=this._AnnotationPage,f.annotation=u,f.action="deleted",this._existingAnnotationsModified[this._AnnotationPage-1].push(f),this._annotationsDeletedNo[this._AnnotationPage-1]=this._annotationsDeletedNo[this._AnnotationPage-1]+1,t=0;t<i.length;t++)i[t]!=u&&h.push(i[t]);e={operation:"existingAnnotationDeleted",pageNumber:this._AnnotationPage,indexes:n.currentAnnotationIndex};this._recentOperation.push(e);this._textMarkupAnnotationList[this._AnnotationPage]=h;this._totalAnnotations[this._AnnotationPage].splice(n.currentAnnotationIndex,1)}else i=this._newAnnotationList[this._AnnotationPage-1],o=i[n.currentAnnotationIndex],r.annotationType=o.type,this._deletedAnnotationList[this._AnnotationPage-1].push(o),this._newAnnotationList[this._AnnotationPage-1].splice(n.currentAnnotationIndex,1),s=this._textMarkupAnnotationList[this._AnnotationPage]?this._textMarkupAnnotationList[this._AnnotationPage].length+n.currentAnnotationIndex:n.currentAnnotationIndex,r.annotationId=s,r.pageId=this._AnnotationPage,this._totalAnnotations[this._AnnotationPage].splice(s,1),e={operation:"newAnnotationDeleted",pageNumber:this._AnnotationPage,indexes:n.currentAnnotationIndex},this._recentOperation.push(e);for(this._redoActions=[],t=0;t<this._totalPages;t++)c=[],this._redoAnnotationCollection[t]=c;this._raiseClientEvent("annotationRemove",r);this.isDocumentEdited=!0;this._clearRectOnClick(this._AnnotationPage);this._isAnnotationSelected=!1}},_createHighlightContextMenu:function(){var i=document.createElement("div"),r=n("#"+this._id+"_pageviewContainer"),t,u;i.id=this._id+"highlight-menu";i.className="e-pdfviewer-highlight-menu";r.append(i);t=document.createElement("ol");t.className="highlightorderedList";i.appendChild(t);u=window.getSelection().toString();n(t).append("<li class='popupnoteli'><a href='javascript:void(0);' class='popupnote' id = '"+this._id+"_openPopup'>Open Pop-Up Note<\/a><\/li>");n(t).append("<li class='deleteAnnotationli'><a href='javascript:void(0);' id='"+this._id+"_deleteannot' class='deleteAnnotation'>Delete <\/a><\/li>");n(t).append("<li class='Propertiesli'><a href='javascript:void(0);' class='Properties' id = '"+this._id+"_propAnnot'>Properties.... <\/a><\/li>")},_setPopupMenuPosition:function(t,i){var e;t.type=="touchstart"&&i[0].id==this._id+"_popupmenu"&&(t=t.originalEvent.changedTouches[0]);var r={},f={},u={};return u.x=i.outerWidth(),u.y=i.outerHeight(),r.x=t.pageX,r.y=t.pageY,f.x=r.x+u.x>n(window).width()+n(window).scrollLeft()?r.x-u.x:r.x,f.y=r.y+u.y>n(window).height()+n(window).scrollTop()?r.y-u.y:r.y,i[0].id==this._id+"_popupmenu"&&(e=document.getElementById(this._id+"_viewerContainer"),f.x+u.x>e.clientWidth&&(f.x=f.x-u.x/4)),f},_setHighLightContextMenuPostion:function(t){var f=n("#"+this._id+"custom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.pageX,i.y=t.pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x-r.x:i.x,u.y=i.y+r.y>n(window).height()+n(window).scrollTop()?i.y-r.y:i.y,u},_onViewerKeypress:function(n){n.ctrlKey&&n.which==26||n.ctrlKey&&n.keyCode==26?this._isPropertiesWindowOpen||this._undo():(n.ctrlKey&&n.which==25||n.ctrlKey&&n.keyCode==25)&&(this._isPropertiesWindowOpen||this._redo())},_undo:function(){var n=this._recentOperation.pop(),t,i;if(n){if(n.operation=="AddedHighlight"||n.operation=="AddedUnderline"||n.operation=="AddedStrikeOut"){for(t=0;t<n.indexes.length;t++)i=this._newAnnotationList[n.pageNumber-1].pop(),this._redoAnnotationCollection[n.pageNumber-1].push(i);this._redoActions.push(n)}else n.operation=="propertiesModifiedForExistingAnnot"||n.operation=="propertiesModifiedForNewAnnot"?(this._undoModifiedProperty(n),this._redoActions.push(n)):(n.operation=="existingAnnotationDeleted"||n.operation=="newAnnotationDeleted")&&(this._undoDeletedItem(n),this._redoActions.push(n));this._clearRectOnClick(n.pageNumber)}},_undoModifiedProperty:function(n){var t,r,i;n.operation=="propertiesModifiedForExistingAnnot"?(t=this._textMarkupAnnotationList[n.pageNumber][n.indexes],r=JSON.parse(JSON.stringify(t)),this._redoAnnotationCollection[n.pageNumber-1].push(r),i=this._colorModifiedAnnotationList[n.pageNumber-1].pop(),t.Color.R=i.Color.R,t.Color.G=i.Color.G,t.Color.B=i.Color.B,t.Opacity=i.Opacity,this._existingAnnotationsModified[n.pageNumber-1].pop()):(t=this._newAnnotationList[n.pageNumber-1][n.indexes],r=JSON.parse(JSON.stringify(t)),this._redoAnnotationCollection[n.pageNumber-1].push(r),i=this._colorModifiedAnnotationList[n.pageNumber-1].pop(),t.colorR=i.colorR,t.colorG=i.colorG,t.colorB=i.colorB,t.opacity=i.opacity,t.colorA=i.colorA)},_undoDeletedItem:function(n){var t,r,i;n.operation=="existingAnnotationDeleted"?(t=this._deletedAnnotationList[n.pageNumber-1].pop(),this._textMarkupAnnotationList[n.pageNumber].splice(n.indexes,0,t),this._totalAnnotations[n.pageNumber].splice(n.indexes,0,t),this._existingAnnotationsModified[n.pageNumber-1].pop()):(t=this._deletedAnnotationList[n.pageNumber-1].pop(),r=this._newAnnotationList[n.pageNumber-1].splice(n.indexes,0,t),i=this._textMarkupAnnotationList[n.pageNumber]?this._textMarkupAnnotationList[n.pageNumber].length+n.indexes:n.indexes,this._totalAnnotations[n.pageNumber].splice(i,0,t))},_redo:function(){var n=this._redoActions.pop(),t,i;if(n){if(this._recentOperation.push(n),n.operation=="AddedHighlight"||n.operation=="AddedUnderline"||n.operation=="AddedStrikeOut")for(t=0;t<n.indexes.length;t++)i=this._redoAnnotationCollection[n.pageNumber-1].pop(),this._newAnnotationList[n.pageNumber-1].push(i);else n.operation=="propertiesModifiedForExistingAnnot"||n.operation=="propertiesModifiedForNewAnnot"?this._redoModifiedProperty(n):(n.operation=="existingAnnotationDeleted"||n.operation=="newAnnotationDeleted")&&this._redoDeletedItem(n);this._clearRectOnClick(n.pageNumber)}},_redoModifiedProperty:function(n){var r;if(n.operation=="propertiesModifiedForExistingAnnot"){var t=this._textMarkupAnnotationList[n.pageNumber][n.indexes],u=JSON.parse(JSON.stringify(t)),i=this._redoAnnotationCollection[n.pageNumber-1].pop();this._colorModifiedAnnotationList[n.pageNumber-1].push(u);t.Color.R=i.Color.R;t.Color.G=i.Color.G;t.Color.B=i.Color.B;t.Opacity=i.Opacity;r={};r.index=n.indexes;r.annotation=t;r.action="propertyChanged";this._existingAnnotationsModified[n.pageNumber-1].push(r)}else{var t=this._newAnnotationList[n.pageNumber-1][n.indexes],u=JSON.parse(JSON.stringify(t)),i=this._redoAnnotationCollection[n.pageNumber-1].pop();this._colorModifiedAnnotationList[n.pageNumber-1].push(u);t.colorR=i.colorR;t.colorG=i.colorG;t.colorB=i.colorB;t.opacity=i.opacity;t.colorA=i.colorA}},_redoDeletedItem:function(n){var t,i,r;n.operation=="existingAnnotationDeleted"?(t=this._textMarkupAnnotationList[n.pageNumber],i=t[n.indexes],this._deletedAnnotationList[n.pageNumber-1].push(i),this._textMarkupAnnotationList[n.pageNumber].splice(n.indexes,1),this._totalAnnotations[n.pageNumber].splice(n.indexes,1)):(t=this._newAnnotationList[n.pageNumber-1],i=t[n.indexes],this._deletedAnnotationList[n.pageNumber-1].push(i),this._newAnnotationList[n.pageNumber-1].splice(n.indexes,1),r=this._textMarkupAnnotationList[n.pageNumber]?this._textMarkupAnnotationList[n.pageNumber].length+n.indexes:n.indexes,this._totalAnnotations[n.pageNumber].splice(r,1))},_displayColorPicker:function(t){var i=document.getElementById(this._id+"_pdfviewer_colorpicker");n(i).css("display")!="none"||this._isToolbarColorPicker?this._colorPickerStatus==t?(i.style.display="none",this._isToolbarColorPicker=!1):(t=="Highlight"?this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color):t=="Underline"?this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color):t=="StrikeOut"&&this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color),this._colorPickerStatus=t,this._isDefaultColorSet=!0):(i.style.display="block",this._isToolbarColorPicker=!0,this._colorPickerStatus!=t&&(this._drawColor=null,t=="Highlight"?this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color):t=="Underline"?this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color):t=="StrikeOut"&&this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color)),this._colorPickerStatus=t,this._isDefaultColorSet=!0)},_setPickerPosition:function(t){var r=n("#"+this._id+"_toolbarContainer"),i,u,f,e;this._toolbarColorpickerObject.refresh();i=document.getElementById(this._id+"_pdfviewer_colorpicker");u=i.getBoundingClientRect();n("#"+this._id+"_pdfviewer_textmarkupul").parent()[0]==r[0]?(i.style.top="0px",i.style.left=t.parentNode.offsetLeft+t.offsetLeft-r[0].offsetLeft-u.width+t.clientWidth+"px"):(f=document.getElementById(this._id+"_toolbarContainer_hiddenlist"),secondaryToolbarPosition=f.getBoundingClientRect(),e=document.getElementById(this._id+"_pdfviewer_textmarkupul").getBoundingClientRect(),i.style.top=secondaryToolbarPosition.bottom-e.bottom+"px",i.style.left=t.parentNode.parentNode.offsetLeft-r[0].offsetLeft+t.offsetLeft-u.width+t.clientWidth+"px")},_showTextMarkupButtons:function(t){t?(n("#"+this._id+"_pdfviewer_textmarkupul").css("display","block"),n("#"+this._id+"_pdfviewer_zoomul").addClass("e-separator")):(n("#"+this._id+"_pdfviewer_textmarkupul").css("display","none"),n("#"+this._id+"_pdfviewer_zoomul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_colorpicker").css("display","none"),this._isToolbarColorPicker=!1)},_wireEvents:function(){var r=navigator.userAgent.indexOf("Chrome")!=-1,u=navigator.userAgent.indexOf("Firefox")!=-1,o=navigator.userAgent.indexOf("Safari")!=-1,f=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,s=navigator.userAgent.indexOf("Edge")!=-1,e=document.documentMode||/Edge/.test(navigator.userAgent),t=this,i;this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._on(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._on(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_toolbarContainer"),"mousedown",this._onToolBarContainerMouseDown),this._on(n(".e-pdfviewer-ejdropdownlist"),"mousedown",this._onToolBarContainerMouseDown),this._on(n("#"+this._id+"_viewerContainer"),"mousewheel",this._onContainerScroll),this._on(n(window),"keypress",this._onViewerKeypress),document.documentMode||f?(this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._on(n("#"+this._id+"_viewerContainer"),"dblclick",this._selectingTextOnDblClick),this._on(n("#"+this._id+"_viewerContainer"),"click",this._selectingTextOnClick)):e||(u?this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy):r&&(this._on(n("#"+this._id+"_viewerContainer"),"touchstart",this._onTextContainerTouch),this._on(n("#"+this._id+"_viewerContainer"),"touchmove",this._onTextContainerTouchMove),this._on(n("#"+this._id+"_viewerContainer"),"touchend",this._onTextContainerTouchEnd)),this._on(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._on(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),this._on(n("#"+this._id+"_viewerContainer"),"mouseleave",this._onTextContainerMouseLeave),this._on(n("#"+this._id+"_viewerContainer"),"mouseenter",this._onTextContainerMouseEnter),this._on(n("#"+this._id+"_viewerContainer"),"mouseover",this._onTextContainerMouseIn),this._on(n("#"+this._id+"_viewerContainer"),"dragstart",this._onTextContainerDragStart)),r||u||f||s||e?(this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.copy",this._copySelectedText),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.googleSearch",this._openInNewTab),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.e-highlight-text",this._drawHighlightAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.e-strikeout-text",this._drawStrikeOutAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.deleteAnnotation",this._deleteAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.popupnote",this._showPopupMenu),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.Properties",this._showPropertiesMenu),this._on(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick)):o&&this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp));n(window).on("keydown",function(i){i.ctrlKey&&(i.keyCode==65||i.keyCode==97)?i.preventDefault():i.keyCode==46&&(t._currentAnnotationRectangleBackup.length==0||t._isPropertiesWindowOpen||t._isPopupNoteVisible||(t._deleteAnnotation(),n("#"+t._id+"_popupmenu").hide(),t._isPopupNoteVisible=!1))});i=document.getElementById(this._id+"_viewerContainer");n("#"+this._id+"_viewerContainer").css({"touch-action":"pan-x pan-y"});n("#"+this._id+"_pdfviewerContainer").css({"touch-action":"pan-x pan-y",position:"relative"});(navigator.userAgent.match("Firefox")||navigator.userAgent.match("Chrome"))&&(i.addEventListener("touchstart",this._touchStart),i.addEventListener("touchmove",this._touchMove),i.addEventListener("touchleave",this._touchEnd),i.addEventListener("touchend",this._touchEnd),i.addEventListener("touchcancel",this._touchEnd));this._on(n("#"+this._id+"_pdfviewer_searchinput"),"input",this._textSearch);this._on(n("#"+this._id+"_pdfviewer_searchinput"),"keypress",this._searchKeypressHandler);this._on(n("#"+this._id+"_pdfviewer_previous_search"),"click",this._prevSearch);this._on(n("#"+this._id+"_pdfviewer_next_search"),"click",this._nextSearch);this._on(n("#"+this._id+"_pdfviewer_close_search"),"click ",this._displaySearchBox);this._on(n("#"+this._id+"_viewerContainer"),"pointerdown",this._pointerdown);this._on(n("#"+this._id+"_viewerContainer"),"pointermove",this._pointermove);this._on(n("#"+this._id+"_viewerContainer"),"pointerup",this._pointerup);this._on(n("#"+this._id+"_viewerContainer"),"pointerleave",this._pointerup);this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip);this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip)},_unwireEvents:function(){var e=navigator.userAgent.indexOf("Chrome")!=-1,i=navigator.userAgent.indexOf("Firefox")!=-1,o=navigator.userAgent.indexOf("Safari")!=-1,r=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,u=navigator.userAgent.indexOf("Edge")!=-1,f=document.documentMode||/Edge/.test(navigator.userAgent),t;this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._off(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._off(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._off(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_viewerContainer"),"mousewheel",this._onContainerScroll),this._off(n(window),"keypress",this._onViewerKeypress));t=document.getElementById(this._id+"_viewerContainer");document.documentMode||u||r||f?(this._off(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._off(n("#"+this._id+"_viewerContainer"),"dblclick",this._selectingTextOnDblClick),this._off(n("#"+this._id+"_viewerContainer"),"click",this._selectingTextOnClick)):(i&&this._off(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._off(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._off(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),this._off(n("#"+this._id+"_viewerContainer"),"mouseleave",this._onTextContainerMouseLeave),this._off(n("#"+this._id+"_viewerContainer"),"mouseover",this._onTextContainerMouseIn),this._off(n("#"+this._id+"_viewerContainer"),"touchstart",this._onTextContainerTouch),this._off(n("#"+this._id+"_viewerContainer"),"touchend",this._onTextContainerTouchEnd),this._off(n("#"+this._id+"_viewerContainer"),"touchmove",this._onTextContainerTouchMove),this._off(n("#"+this._id+"_viewerContainer"),"dragstart",this._onTextContainerDragStart),this._off(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick));(e||i||r||f||u)&&(this._off(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._off(n("#"+this._id+"_pageviewContainer"),"click","a.copy",this._copySelectedText),this._off(n("#"+this._id+"_pageviewContainer"),"click","a.googleSearch",this._openInNewTab),this._off(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp));(navigator.userAgent.match("Firefox")||navigator.userAgent.match("Chrome"))&&(t.removeEventListener("touchstart",this._touchStart),t.removeEventListener("touchmove",this._touchMove),t.removeEventListener("touchleave",this._touchEnd),t.removeEventListener("touchend",this._touchEnd),t.removeEventListener("touchcancel",this._touchEnd));this._off(n("#"+this._id+"_viewerContainer"),"pointerdown",this._pointerdown);this._off(n("#"+this._id+"_viewerContainer"),"pointermove",this._pointermove);this._off(n("#"+this._id+"_viewerContainer"),"pointerup",this._pointerup);this._off(n("#"+this._id+"_viewerContainer"),"pointerleave",this._pointerup);this._off(n("#"+this._id+"_pdfviewer_searchinput"),"input",this._textSearch);this._off(n("#"+this._id+"_pdfviewer_searchinput"),"keypress",this._searchKeypressHandler);this._off(n("#"+this._id+"_pdfviewer_previous_search"),"click",this._prevSearch);this._off(n("#"+this._id+"_pdfviewer_next_search"),"click",this._nextSearch);this._off(n("#"+this._id+"_pdfviewer_close_search"),"click ",this._displaySearchBox);this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip);this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip);this._off(n(window),"resize",this._viewerResize)},_onContainerScroll:function(n){document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1;this._isPropertiesWindowOpen&&n.preventDefault()},_closePropertiesWindow:function(){this._isPropertiesWindowOpen=!1},_onToolBarContainerMouseDown:function(n){return n.preventDefault(),!1},_onToolbarItemClick:function(t){t.target.id==this._id+"_txtpageNo"&&n("#"+this._id+"_txtpageNo").select();n("#"+this._id+"_rptTooltip").css("display","none")},_selectingTextOnClick:function(n){this._timers&&this._clientx==n.clientX&&this._clienty==n.clientY&&(clearTimeout(this._timers),this._timers=null,this._selectingEntireLine(n))},_selectingEntireLine:function(t){var i,u=[],v=t.target,y=v.getBoundingClientRect(),p=n(".e-pdfviewer-textLayer").length,r,o,s,c;if(n(t.target).hasClass("e-pdfviewer-textLayer")){for(r=0;r<p;r++){var w=n(".e-pdfviewer-textLayer")[r].getBoundingClientRect(),f=parseInt(w.top),e=parseInt(y.top);(f==e||f+1==e||f-1==e)&&(o=n(".e-pdfviewer-textLayer")[r].id,o!=""&&u.push(o))}s=window.getSelection();s.removeAllRanges();var i=document.createRange(),b=u.length-1,l=document.getElementById(u[0]),h=document.getElementById(u[b]),a=h.childNodes.length;a>0?(c=h.childNodes[a-1],i.setStart(l,0),i.setEnd(c,c.length)):(i.setStart(l,0),i.setEnd(h,1));s.addRange(i)}},_selectingTextOnDblClick:function(n){this._clientx=n.clientX;this._clienty=n.clientY;this._isAnnotationSelected?(this._showPopupMenu(n),this._clearSelector(n)):this._getElementTouch(n.target,n.clientX,n.clientY);this._timers=setTimeout(function(){this._timers=null},200)},_onTextContainerMouseIn:function(n){if(this.Clicked)return n.preventDefault(),!1},_onTextContainerMouseUp:function(i){var y,c,p,u,s,r,l,f,ft,et,v,tt,b,rt,k,e,st,d,nt,o;if(document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._isDefaultColorSet=!1,s=i.target,p=n("#"+this._id+"_popupinnercontent"),s==p[0]?p.focus():p.blur(),this._isPopupNoteFocused=!1,this._isPropertiesWindowOpen||i.target.id==this._id+"_popupinnercontent"||i.target.id==this._id+"_popupcontent")i.preventDefault();else{if(this._curDown=!1,u=[],s=i.target,this._currentAnnotationRectangle=[],r=document.getElementById(this._id+"custom-menu"),l=document.getElementById(this._id+"highlight-menu"),i.target.className!="popupnoteli"&&i.target.className!="deleteAnnotationli"&&i.target.className!="Propertiesli"&&i.target.className!="e-pdfviewer-highlight-menu"&&n(l).hide(),this._isContextMenuPresent=!1,f=parseInt(i.target.id.split("text_")[1])||parseInt(i.target.id.split("selectioncanvas_")[1])||parseInt(i.target.id.split("_secondarycanvas_")[1]),f&&this.model.enableTextMarkupAnnotations){for(e=1;e<=this._totalPages;e++)(this._textMarkupAnnotationList[e]||this._newAnnotationList[e-1])&&this._clearRectOnClick(e);ft=document.getElementById(this._id+"_secondarycanvas_"+f);this._onCanvasMousedown(ft,i.pageX,i.pageY);this._contextClickPosition(i,f)}if(window.getSelection().toString()||this._currentAnnotationRectangle.length!=0&&(y=this._currentAnnotationRectangle[0],c=y.TextMarkupAnnotationType?y.TextMarkupAnnotationType:y.type,c=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle)):c=="Highlight"&&this.model.enableHighlightAnnotation?(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle)):c=="Underline"&&this.model.enableUnderlineAnnotation&&(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle))),et=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,v=window.getSelection().toString(),i.type=="contextmenu")if(tt=window.getSelection(),tt.anchorNode){var h=tt.getRangeAt(0),w=h.cloneContents(),a=w.childNodes,ot=h.startContainer.parentNode.className,it=n(w).find("span");if(it.length>0&&(it[0].className=="e-pdfviewer-texthighlight e-pdfviewer-textLayer"||it[0].className=="e-pdfviewer-text-highlightother e-pdfviewer-textLayer")&&h.startContainer.id&&u.push(h.startContainer.id),et&&n(w).children().length==0&&(ot=="e-pdfviewer-textLayer"?u.push(h.startContainer.parentElement.id):u.push(h.startContainer.id)),w.childElementCount==0)ot=="e-pdfviewer-textLayer"?u.push(h.startContainer.parentElement.id):u.push(h.startContainer.id);else if(a.length>0)if(a[0].className=="e-waitingpopup e-js")for(b=0;b<a.length;b++)for(rt=n(a[b]).find(".text_container").children(),k=0;k<rt.length;k++)u.push(rt[k].id);else for(e=0;e<a.length;e++)st=a[e].id,u.push(st);for(d=0;d<u.length;d++)if((n(s).hasClass("e-pdfviewer-text-highlightother")||n(s).hasClass("e-pdfviewer-texthighlight"))&&(s=s.parentElement),s.id==u[d]){this._contextMenu=!0;break}else this._contextMenu=!1}else this._contextMenu=!1;if(v!=""&&i.which==3&&this._contextMenu&&i.type=="contextmenu"&&!this._isCopyRestrict){i.preventDefault();this._searchedText="";var g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],ht=g.contextMenu.copy.contentText,ut=g.contextMenu.googleSearch.contentText,ct=g.toolbar.highlight.headerText,lt=g.toolbar.strikeout.headerText;n(r).find("li a.copy").text(ht);n(r).find("li a.googleSearch").text(ut);n(r).find("li a.e-highlight-text").text(ct);n(r).find("li a.e-strikeout-text").text(lt);v.length>20?(nt=v.substring(0,18),str=nt+"...",n(r).find("li a.googleSearch").text(ut+"'"+str+"'")):n(r).find("li a.googleSearch").text(ut+"'"+v+"'");o=this._setContextMenuPostion(i);this.model.enableTextMarkupAnnotations?(this.model.enableHighlightAnnotation?n("#"+this._id+"_highlight_contextmenu").removeClass("e-disable"):n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),this.model.enableStrikethroughAnnotation?n("#"+this._id+"_strikeout_contextmenu").removeClass("e-disable"):n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")):(n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable"));n(r).show();n(r).offset({top:o.y,left:o.x}).show();n(r).show();n(r).offset({top:o.y,left:o.x}).show();this._contextMenu=!1}else i.which==3&&i.type=="contextmenu"&&!this._isCopyRestrict&&(n(i.target).hasClass("e-pdfviewer-text-highlightother e-pdfviewer-textLayer")||n(i.target).hasClass("e-pdfviewer-texthighlight e-pdfviewer-textLayer"))?(i.preventDefault(),this._searchedText=i.target.innerHTML,this._searchedText.length>20?(nt=this._searchedText.substring(0,18),str=nt+"...",n(r).find("li a.googleSearch").text("Search Google For '"+str+"'")):n(r).find("li a.googleSearch").text("Search Google For '"+this._searchedText+"'"),o=this._setContextMenuPostion(i),this.model.enableTextMarkupAnnotations?(this.model.enableHighlightAnnotation?n("#"+this._id+"_highlight_contextmenu").removeClass("e-disable"):n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),this.model.enableStrikethroughAnnotation?n("#"+this._id+"_strikeout_contextmenu").removeClass("e-disable"):n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")):(n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")),n(r).show(),n(r).offset({top:o.y,left:o.x}).show(),n(r).show(),n(r).offset({top:o.y,left:o.x}).show(),this._contextMenu=!1):n(r).has(i.target).length==0&&(n(r).hide(),i.type!="contextmenu"||this._contextMenu?this._contextMenu&&i.preventDefault():this._clearSelector(),i.type=="contextmenu"&&(i.which!=3||this._contextMenu||i.type!="contextmenu"||this._currentAnnotationRectangle.length==0&&"#000000"==this._annotationColor?n(l).hide():(this.model.enableTextMarkupAnnotations&&(c=="StrikeOut"&&this.model.enableStrikethroughAnnotation?this._showAnnotationContextMenu(i,l):c=="Highlight"&&this.model.enableHighlightAnnotation?this._showAnnotationContextMenu(i,l):c=="Underline"&&this.model.enableUnderlineAnnotation&&this._showAnnotationContextMenu(i,l)),i.preventDefault())));this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation())}},_replaceTextLocale:function(n,t){n.textContent=t},_showAnnotationContextMenu:function(i,r){var u;n("#"+this._id+"_popup_note").hide();n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;var f=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],e=f.contextMenu.openPopup.contentText,o=f.contextMenu.Delete.contentText,s=f.contextMenu.properties.contentText;this._replaceTextLocale(n("#"+this._id+"_openPopup")[0],e);this._replaceTextLocale(n("#"+this._id+"_deleteannot")[0],o);this._replaceTextLocale(n("#"+this._id+"_propAnnot")[0],s);u=this._setHighLightContextMenuPostion(i);this._isContextMenuPresent=!0;n(r).show();n(r).offset({top:u.y,left:u.x}).show();n(r).show();n(r).offset({top:u.y,left:u.x}).show()},_contextClickPosition:function(n,t){var a,u,o,v,s,i,l,r,e;this._currentAnnotationRectangleBackup=[];u=[];o=!1;t&&(v=document.getElementById(this._id+"_secondarycanvas_"+t),a=v.getBoundingClientRect());var h=n.clientX-a.left,c=n.clientY-a.top,f=this._newAnnotationList[t-1];for(s=0;s<f.length;s++)for(r=f[s],e=0;e<r.bounds.length;e++)if(i=r.bounds[e],h>=i.xPosition*this._zoomVal&&h<=(i.xPosition+i.width)*this._zoomVal&&c>=i.yPosition*this._zoomVal&&c<=(i.yPosition+i.height)*this._zoomVal)this._currentAnnotationRectangle.push(f[s]),this._currentAnnotationRectangleBackup.push(f[s]),o=!0,u.push(r);else{if(o){o=!1;break}this._isPopupNoteVisible||(this._currentAnnotationRectangleBackup=[]);this._currentAnnotationRectangle=[]}if(f=this._textMarkupAnnotationList[t],f)for(l=0;l<f.length;l++)for(r=f[l],e=0;e<r.Bounds.length;e++){var i=r.Bounds[e],y=this._convertPointToPixel(i.X),p=this._convertPointToPixel(i.Y),w=this._convertPointToPixel(i.Width),b=this._convertPointToPixel(i.Height);if(h>=y*this._zoomVal&&h<=(y+w)*this._zoomVal&&c>=p*this._zoomVal&&c<=(p+b)*this._zoomVal)this._currentAnnotationRectangle.push(r),this._currentAnnotationRectangleBackup.push(r),o=!0,u.push(r);else{if(o){o=!1;break}this._isPopupNoteVisible||(this._currentAnnotationRectangleBackup=[]);this._currentAnnotationRectangle=[]}}u.length>1&&(u=this._compareAnnotations(u));this._currentAnnotationRectangle=u;this._currentAnnotationRectangleBackup=u},_compareAnnotations:function(n){for(var i,f,t=0;t<n.length;t++){if(t==n.length-1)break;var r=n[t].bounds?n[t].bounds:n[t].Bounds,o=r[0].X?r[0].X:r[0].xPosition,s=r[0].Y?r[0].Y:r[0].yPosition,u=n[t+1].bounds?n[t+1].bounds:n[t+1].Bounds,e=u[0].X?u[0].X:u[0].xPosition,h=u[0].Y?u[0].Y:u[0].yPosition;o<e||s<h?(i=e,f=n[t+1]):(i=o,f=n[t]);i&&t==n.length-2&&i==o&&i==e&&(i=e,f=n[t+1])}return n=[],n.push(f),n},_setContextMenuPostion:function(t){var f=n("#"+this._id+"custom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.pageX,i.y=t.pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x-r.x:i.x,u.y=i.y+r.y>n(window).height()+n(window).scrollTop()?i.y-r.y:i.y,u},_createWaterDropDiv:function(){var f=n("#"+this._id+"_pageviewContainer"),u=document.createElement("DIV"),r,i,t;u.id=this._id+"droplet1";u.className="e-pdfviewer-droplet1";r=document.createElement("DIV");r.id=this._id+"droplet2";r.className="e-pdfviewer-droplet2";f.append(u);f.append(r);i=n("#"+this._id+"_viewerContainer");t=this;n("#"+this._id+"droplet2").on("touchmove",function(r){var e,v,y,f,u,s,h,c;if(t.model.enableTextSelection){t._enableSelection();var o=window.getSelection(),l=parseInt(o.anchorNode.parentNode.id.split("text_")[1]),a=parseInt(o.focusNode.parentNode.id.split("text_")[1]);(l!=parseInt(t._selectionStartPage)||a!=parseInt(t._selectionStartPage))&&t._annotationActive||(t._longTouch=!0,e=n(i).scrollTop(),n("#"+t._id+"touchcustom-menu").hide(),r.preventDefault(),s=n("#"+t._id+"droplet1").offset(),r.type=="touchmove"&&(v=r.originalEvent.changedTouches[0].clientX,y=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",0),f=r.originalEvent.changedTouches[0].clientX,u=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",1e3)),u>=s.top?(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e+30):offset=range.startOffset):n(i).scrollTop(e+30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!0)):(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e-30):offset=range.startOffset):n(i).scrollTop(e-30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!1)),n(parent).hasClass("e-pdfviewer-textLayer")&&(c=n("#"+t._id+"droplet2").width(),n("#"+t._id+"droplet2").offset({top:u+window.scrollY,left:f-c})))}else t.model.enableTextSelection||t._disableSelection()});n("#"+this._id+"droplet1").on("touchmove",function(r){var e,v,y,f,u,s,h,c;if(t.model.enableTextSelection){t._enableSelection();var o=window.getSelection(),l=parseInt(o.anchorNode.parentNode.id.split("text_")[1]),a=parseInt(o.focusNode.parentNode.id.split("text_")[1]);(l!=parseInt(t._selectionStartPage)||a!=parseInt(t._selectionStartPage))&&t._annotationActive||(e=n(i).scrollTop(),n("#"+t._id+"touchcustom-menu").hide(),r.preventDefault(),s=n("#"+t._id+"droplet2").offset(),r.type=="touchmove"&&(t._longTouch=!0,v=r.originalEvent.changedTouches[0].clientX,y=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",0),f=r.originalEvent.changedTouches[0].clientX,u=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",1e3)),u<=s.top?(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e-30):offset=range.startOffset):n(i).scrollTop(e-30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!1)):(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e+30):offset=range.startOffset):n(i).scrollTop(e+30)),parent=textNode.parentElement,h=t._selectingTextByTouch(parent,f,u,!0)),n(r.target).css("z-index",1e3),n(parent).hasClass("e-pdfviewer-textLayer")&&(c=n("#"+t._id+"droplet1").width(),n("#"+t._id+"droplet1").offset({top:u+window.scrollY,left:f-c})))}else t.model.enableTextSelection||t._disableSelection()})},_disableSelection:function(){this.model.enableTextSelection||n("#"+this._id+"_viewerContainer").attr("unselectable","on").css({"-moz-user-select":"-moz-none","-moz-user-select":"none","-o-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none","user-select":"none"}).bind("selectstart",function(){return!1})},_enableSelection:function(){this.model.enableTextSelection&&n("#"+this._id+"_viewerContainer").removeAttr("unselectable").css({"-moz-user-select":"text","-moz-user-select":"text","-o-user-select":"text","-khtml-user-select":"text","-webkit-user-select":"text","-ms-user-select":"text","user-select":"text"}).bind("selectstart",function(){return!0})},_selectingTextByTouch:function(n,t,i,r){var f,e,s,h,c,o,u;if(n.nodeType==n.TEXT_NODE)for(u=n.ownerDocument.createRange(),f=window.getSelection(),u.selectNodeContents(n),e=0,s=u.endOffset;e<s;){if(u.setStart(n,e),u.setEnd(n,e+1),u.getBoundingClientRect().left<=t&&u.getBoundingClientRect().right>=t&&u.getBoundingClientRect().top<=i&&u.getBoundingClientRect().bottom>=i)return h=u.toString(),c=u.getBoundingClientRect(),f.anchorNode!=null&&f.anchorNode.parentNode.className=="e-pdfviewer-textLayer"&&r?(u.setStart(f.anchorNode,f.anchorOffset),f.removeAllRanges(),f.addRange(u),f.extend(n,e)):f.anchorNode==null||r||(u.setEnd(f.focusNode,f.focusOffset),f.removeAllRanges(),f.addRange(u)),u.detach(),h;e+=1}else for(o=0;o<n.childNodes.length;o++){if(u=n.childNodes[o].ownerDocument.createRange(),u.selectNodeContents(n.childNodes[o]),u.getBoundingClientRect().left<=t&&u.getBoundingClientRect().right>=t&&u.getBoundingClientRect().top<=i&&u.getBoundingClientRect().bottom>=i)return u.detach(),this._selectingTextByTouch(n.childNodes[o],t,i,r);u.detach()}return null},_onTextContainerTouchMove:function(t){if(n(t.target).hasClass("e-pdfviewer-textLayer")&&this._lockTimer){var i=t.originalEvent.changedTouches[0].clientX,r=t.originalEvent.changedTouches[0].clientY,u=document.getElementById(this._id+"touchcustom-menu");parseInt(i)!=parseInt(this._curPosX)&&parseInt(r)!=parseInt(this._curPosY)&&(n(".text_container").css("visibility","hidden"),n(".e-pdfviewer-formFields").css("visibility","visible"),n(u).hide(),t.preventDefault())}},_setTouchContextMenu:function(t){var f=n("#"+this._id+"touchcustom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.originalEvent.changedTouches[0].pageX,i.y=t.originalEvent.changedTouches[0].pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x:i.x-r.x/2,i.y&&(u.y=i.y-r.y),u},_onTextContainerTouch:function(t){var r=t.originalEvent.touches.length,i;if(this._curPosX=t.originalEvent.changedTouches[0].clientX,this._curPosY=t.originalEvent.changedTouches[0].clientY,!this._lockTimer)return i=this,this._timer=setTimeout(function(){i._onlongtouch(t)},1e3),this._lockTimer=!0,n(t.target).hasClass("e-pdfviewer-textLayer")?(t.preventDefault(),n(".text_container").css("visibility",""),!1):void 0},_onlongtouch:function(t){var i,r;t.type=="touchstart"&&t.target.id!=this._id+"droplet2"||t.target.id!=this._id+"droplet2"&&this.model.enableTextSelection?(this._enableSelection(),this._longTouch=!0,n(".text_container").css("visibility",""),this._curXPos=t.originalEvent.changedTouches[0].clientX,this._curYPos=t.originalEvent.changedTouches[0].clientY,i=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),this._selectionStartPage=i,this._isPropertiesWindowOpen||i&&this.model.enableTextMarkupAnnotations&&this._contextClickPosition(t.originalEvent.changedTouches[0],i),this._isAnnotationSelected&&this._selectedAnnotation==this._currentAnnotationRectangle[0]||(r=this._getElementTouch(t.target,this._curXPos,this._curYPos,!0),i&&this._clearRectOnClick(i)),t.preventDefault()):this.model.enableTextSelection||this._disableSelection()},_onTextContainerTouchEnd:function(t){var ut,p,w,f,e,i,r,ft,b,tt,k,d,ot,g,h,a,nt;t.preventDefault();var o=[],v=t.target,y,pt=t.originalEvent.touches.length;if(this._timer&&this.model.enableTextSelection){this._enableSelection();ut=n("a.popupnote");p=n("#"+this._id+"_popupinnercontent");document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1;v==p[0]?p.focus():p.blur();v.id!=this._id+"highlight-menu"&&v!=ut[0]&&v!=p[0]&&(this._isPropertiesWindowOpen||(w=document.getElementById(this._id+"highlight-menu"),n(w).hide(),this._isContextMenuPresent=!1,r=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),r&&this.model.enableTextMarkupAnnotations&&this._contextClickPosition(t.originalEvent.changedTouches[0],r),this._currentAnnotationRectangleBackup.length!=0&&this._isAnnotationSelected&&this._selectedAnnotation==this._currentAnnotationRectangleBackup[0]&&(window.getSelection().removeAllRanges(),i=document.getElementById(this._id+"touchcustom-menu"),n(i).hide(),this._waterDropletDivHide()),this._longTouch&&this._isAnnotationSelected&&this._currentAnnotationRectangleBackup.length!=0&&this._selectedAnnotation==this._currentAnnotationRectangleBackup[0]&&(this.model.enableTextMarkupAnnotations&&(f=this._currentAnnotationRectangleBackup[0],e=f.TextMarkupAnnotationType?f.TextMarkupAnnotationType:f.type,e=="StrikeOut"&&this.model.enableStrikethroughAnnotation?this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w):e=="Highlight"&&this.model.enableHighlightAnnotation?this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w):e=="Underline"&&this.model.enableUnderlineAnnotation&&this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w)),this._longTouch=!1),this._isContextMenuPresent||(r=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),r&&this.model.enableTextMarkupAnnotations&&(this._clearRectOnClick(r),ft=document.getElementById(this._id+"_secondarycanvas_"+r),this._onCanvasMousedown(ft,t.originalEvent.changedTouches[0].pageX,t.originalEvent.changedTouches[0].pageY),this._contextClickPosition(t.originalEvent.changedTouches[0],r)),window.getSelection().toString()||this._currentAnnotationRectangle.length!=0&&(f=this._currentAnnotationRectangle[0],e=f.TextMarkupAnnotationType?f.TextMarkupAnnotationType:f.type,e=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle)):e=="Highlight"&&this.model.enableHighlightAnnotation?(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle)):e=="Underline"&&this.model.enableUnderlineAnnotation&&(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle))))));clearTimeout(this._timer);this._lockTimer=!1;var i=document.getElementById(this._id+"touchcustom-menu"),wt=t.originalEvent.changedTouches[0].clientX,bt=t.originalEvent.changedTouches[0].clientY,u=window.getSelection();if(u.anchorNode){y=u.getRangeAt(0);var et=y.cloneContents(),s=et.childNodes,ct=y.startContainer.parentElement.className;if(et.childElementCount!=0||this._longTouch){if(s.length>0)if(s[0].className=="e-waitingpopup e-js")for(b=0;b<s.length;b++)for(tt=n(s[b]).find(".text_container").children(),k=0;k<tt.length;k++)o.push(tt[k].id);else for(d=0;d<s.length;d++)ot=s[d].id,o.push(ot)}else ct=="e-pdfviewer-textLayer"?o.push(y.startContainer.parentElement.id):o.push(y.startContainer.id);for(g=0;g<o.length;g++)if(v.id==o[g]){this._touchcontextMenu=!0;break}else this._touchcontextMenu=!1}else this._touchcontextMenu=!1;if(this._rangePosition&&this._longTouch){n(".text_container").css("visibility","");var lt=n(i).outerHeight(),at=n(i).outerWidth(),it=this._rangePosition.width/2,vt=window.getSelection().toString();this._ranges||this._touchcontextMenu||t.target.id==this._id+"droplet1"||t.target.id==this._id+"droplet2"?(t.target.id==this._id+"droplet1"||t.target.id==this._id+"droplet2"?(n(i).show(),h=this._setTouchContextMenu(t),n(i).show(),n(i).offset({top:h.y,left:h.x}).show(),this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation())):this._annotationActive||(n(i).show(),n(i).offset({top:this._rangePosition.top-lt+window.scrollY,left:this._rangePosition.left+it-at/2})),this._ranges=!1,n(".text_container").css("visibility","")):n(t.target).hasClass("copy")||n(t.target).hasClass("googleSearch")?n(i).hide():(n(i).hide(),this._waterDropletDivHide());this._longTouch=!1}else n(i).hide(),this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation());if(this._annotationActive){if(this._touchcontextMenu){var u=window.getSelection(),c=document.createRange(),st=u.anchorNode.compareDocumentPosition(u.focusNode),ht=!1;(!st&&u.anchorOffset>u.focusOffset||st===Node.DOCUMENT_POSITION_PRECEDING)&&(ht=!0);ht?(c.setStart(u.focusNode,u.focusOffset),c.setEnd(u.anchorNode,u.anchorOffset)):(c.setStart(u.anchorNode,u.anchorOffset),c.setEnd(u.focusNode,u.focusOffset));var lt=n(i).outerHeight(),at=n(i).outerWidth(),yt=c.getBoundingClientRect(),l=c.getClientRects(),rt=l.length-1,kt=yt.width/2,a=document.getElementById(this._id+"droplet1"),nt=document.getElementById(this._id+"droplet2"),it=n(a).outerWidth(),dt=n(a).outerHeight(),vt=window.getSelection().toString();vt!=""&&(h=this._setTouchContextMenu(t),n(a).show(),n(a).offset({top:l[0].top+window.scrollY,left:l[0].left-it}).show(),n(nt).show(),n(nt).offset({top:l[rt].top+window.scrollY,left:l[rt].left+l[rt].width-it}).show(),n(i).show(),n(i).offset({top:h.y,left:h.x}).show());t.preventDefault()}}else n(i).css("display")!="none"||t.target.id==this._id+"droplet2"||t.target.id==this._id+"droplet1"||t.target.className=="copy"||t.target.className=="googleSearch"||n("#"+this._id+"custom-menu").css("display")!="none"||this._touched||this._touchcontextMenu||(this._clearSelector(),this._clearText=!0);this._clearText&&(n(i).hide(),this._waterDropletDivHide(),this._clearText=!1)}else this.model.enableTextSelection||(a=document.getElementById(this._id+"droplet1"),nt=document.getElementById(this._id+"droplet2"),n(a).hide(),n(nt).hide(),this._disableSelection())},_onTextContainerMouseDown:function(t){var i,r;t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection?this.model.enableTextSelection||this._disableSelection():(this._enableSelection(),n(".text_container").css("visibility",""),i=t.target,this._waterDropletDivHide(),n("#"+this._id+"touchcustom-menu").hide(),this._curYPos=t.clientY,this._curXPos=t.clientX,n(t.target).hasClass("text_container")||n(t.target).hasClass("e-pdfviewer-viewercontainer")||t.which==3||(this._curDown=!0,r=t.target.id.split("text_")[1],r&&(this._selectedValue=r.split("_")[0]),this._selectionStartPage=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1])),n("#"+this._id+"custom-menu").css("display")!="none"||t.which==3||n(i).hasClass("e-pdfviewer-secondarycanvas")||this._clearSelector(),n("#"+this._id+"_viewerContainer").focus(),n(i).hasClass("e-pdfviewer-formFields")||n(i).hasClass("e-pdfviewer-ListBox")||this._isFormFields||n(i).hasClass("e-dropdownSelect")||t.preventDefault())},_onTextContainerclick:function(t){this._waterDropletDivHide();var i=t.target;t.originalEvent.detail==2&&n(i).hasClass("e-pdfviewer-textLayer")&&this.model.enableTextSelection&&(t.preventDefault(),this._enableSelection(),this._getElementTouch(i,t.clientX,t.clientY,!1),this._annotationActive&&!this._isAnnotationSelected&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation()),this._isAnnotationSelected&&(this._showPopupMenu(t),this._clearSelector(t)),t.preventDefault());t.originalEvent.detail==3&&n(i).hasClass("e-pdfviewer-textLayer")&&this.model.enableTextSelection?(this._enableSelection(),this._annotationActive||this._selectingEntireLine(t)):this.model.enableTextSelection||this._disableSelection()},_onTextContainerMouseMove:function(t){var i,e,r,u,o,s,h,f,c,l;t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection||(t.preventDefault(),this._enableSelection(),this._currentAnnotationRectangle=[],i=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1]),i&&!this._isPropertiesWindowOpen&&(e=document.getElementById(this._id+"_secondarycanvas_"+i),this._onCanvasMousedown(e,t.pageX,t.pageY),this.model.enableTextMarkupAnnotations&&(this._isPopupNoteVisible||this._isContextMenuPresent||(this._contextClickPosition(t,i),this._currentAnnotationRectangle.length!=0?(r=this._currentAnnotationRectangle[0],u=r.TextMarkupAnnotationType?r.TextMarkupAnnotationType:r.type,u=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):u=="Underline"&&this.model.enableUnderlineAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):u=="Highlight"&&this.model.enableHighlightAnnotation&&(this._showPopupNote(t),t.target.style.cursor="pointer")):(n("#"+this._id+"_popup_note").css({display:"none"}),t.target.style.cursor="auto")))),n(".text_container").css("visibility",""),h=t.target,f=t.target.id.split("text_")[1],f&&(c=f.split("_")[0],this._isTextSelection=c==this._selectedValue?!0:!1),window.getSelection().toString()?this._selectionPages.indexOf(i)==-1&&i&&i!=0&&this._selectionPages.push(i):this._selectionPages=[],this.pageY=t.pageY,this._curDown==!0&&n("#"+this._id+"custom-menu").css("display")=="none"&&(o=t.clientY,s=t.clientX,(this._currentAnnotationRectangle.length==0||this._annotationActive&&this._isTextSelection)&&(l=this._getWordAtPoint(h,s,o)),t.preventDefault()))},_onTextContainerMouseLeave:function(t){var r,i,u;if(t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection)this.model.enableTextSelection||this._disableSelection();else if(this._enableSelection(),this._curDown==!0){r=this;t.preventDefault();i=n("#"+this._id+"_viewerContainer");u=n(i).offset().top;this._scrollMove=t.clientY>u?setInterval(function(){n(i).animate({scrollTop:n(i).scrollTop()+200},"fast")},500):setInterval(function(){n(i).animate({scrollTop:n(i).scrollTop()-200},"fast")},500);n(window).on("mouseup",function(n){return this._curDown=!1,r._onMouseClickedOutside(n),n.preventDefault(),n.stopPropagation(),!1})}},_onTextContainerMouseEnter:function(n){n.target.id==this._id+"_popupinnercontent"||n.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection?this.model.enableTextSelection||this._disableSelection():(this._enableSelection(),this._scrollMove&&clearInterval(this._scrollMove))},_onMouseClickedOutside:function(n){this._curDown=!1;this._scrollMove&&clearInterval(this._scrollMove);n.preventDefault();n.stopPropagation()},_onTextContainerDragStart:function(n){n.preventDefault()},_clearSelector:function(){window.getSelection&&(window.getSelection().removeAllRanges?window.getSelection().removeAllRanges():document.selection&&document.selection.empty())},_createContextMenu:function(){var i=document.createElement("div"),r=n("#"+this._id+"_pageviewContainer"),t,u;i.id=this._id+"custom-menu";i.className="e-pdfviewer-custom-menu";r.append(i);t=document.createElement("ol");t.className="orderedList";i.appendChild(t);u=window.getSelection().toString();n(t).append("<li><a href='javascript:void(0);' class='copy'>Copy<\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' class='googleSearch'>Search Google For <\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' id = '"+this._id+"_highlight_contextmenu' class='e-highlight-text'>Highlight Text <\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' id = '"+this._id+"_strikeout_contextmenu' class='e-strikeout-text'>Strikethrough Text <\/a><\/li>")},_createTouchContextMenu:function(){var t=document.createElement("div"),i=n("#"+this._id+"_pageviewContainer"),r;t.id=this._id+"touchcustom-menu";t.className="e-pdfviewer-touchcustom-menu";i.append(t);r=window.getSelection().toString();n(t).append("<div class='e-pdfviewer-touchCopy'><a href='javascript:void(0);' class='copy'>Copy<\/a><\/div>");n(t).append("<div class='e-pdfviewer-touchDot'><a href='javascript:void(0);' class='googleSearch'>Search<\/a><\/div>")},_onTextKeyboardCopy:function(n){n.ctrlKey&&n.keyCode==67&&(n.preventDefault(),this._isCopyRestrict||this._copySelectedText(n))},_copySelectedText:function(t){var e,c,f,i;if(!this._isCopyRestrict&&this._searchedText&&this._searchedText.length>0&&this._searchedText!=""&&this.model.enableTextSelection){if(this._enableSelection(),window.clipboardData&&window.clipboardData.setData)return f=clipboardData.setData("Text",this._searchedText),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),f;i=document.createElement("textarea");n(i).css("contenteditable","true");i.textContent=this._searchedText;i.style.position="fixed";document.body.appendChild(i);i.select();try{return document.execCommand("copy")}catch(o){console.warn("Copy to clipboard failed.",o)}finally{i&&document.body.removeChild(i);n("#"+this._id+"custom-menu").hide()}t.preventDefault()}else if(!this._isCopyRestrict&&this.model.enableTextSelection){if(this._enableSelection(),e=window.getSelection().getRangeAt(0).toString(),c=navigator.userAgent.indexOf("Firefox")>-1,window.clipboardData&&window.clipboardData.setData)return f=clipboardData.setData("Text",e),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),f;if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var r=window.getSelection(),u=document.createRange(),s=r.anchorNode.compareDocumentPosition(r.focusNode),h=!1;(!s&&r.anchorOffset>r.focusOffset||s===Node.DOCUMENT_POSITION_PRECEDING)&&(h=!0);h?(u.setStart(r.focusNode,r.focusOffset),u.setEnd(r.anchorNode,r.anchorOffset)):(u.setStart(r.anchorNode,r.anchorOffset),u.setEnd(r.focusNode,r.focusOffset));i=document.createElement("textarea");n(i).css("contenteditable","true");i.textContent=e;i.style.position="fixed";document.body.appendChild(i);i.select();r.removeAllRanges();r.addRange(u)}try{return document.execCommand("copy")}catch(o){console.warn("Copy to clipboard failed.",o)}finally{document.body.removeChild(i);n("#"+this._id+"custom-menu").hide()}t.preventDefault()}},_openInNewTab:function(){var t,i,r;t=this._searchedText&&this._searchedText.length>0&&this._searchedText!=""?this._searchedText:window.getSelection().toString();i="http://www.google.com/search?q="+t;r=window.open(i,"_blank");r.focus();n("#"+this._id+"custom-menu").hide()},_waterDropletDivHide:function(){n(document.getElementById(this._id+"droplet1")).hide();n(document.getElementById(this._id+"droplet2")).hide()},_getWordAtPoint:function(n,t,i){var o,u,s,f,h,c,e,r;if(!this._isPopupNoteFocused){if(n.nodeType==n.TEXT_NODE)for(o=!1,this._isBackwardSelection=!1,r=n.ownerDocument.createRange(),u=window.getSelection(),u.anchorNode!=null&&(s=u.anchorNode.compareDocumentPosition(u.focusNode),(!s&&u.anchorOffset>u.focusOffset||s===Node.DOCUMENT_POSITION_PRECEDING)&&(o=!0,this._isBackwardSelection=!0)),r.selectNodeContents(n),f=0,h=r.endOffset;f<h;){if(r.setStart(n,f),r.setEnd(n,f+1),r.getBoundingClientRect().left<=t&&r.getBoundingClientRect().right>=t&&r.getBoundingClientRect().top<=i&&r.getBoundingClientRect().bottom>=i)return c=r.toString(),u.anchorNode!=null&&u.anchorNode.parentNode.className=="e-pdfviewer-textLayer"&&r.setStart(u.anchorNode,u.anchorOffset),u.removeAllRanges(),u.addRange(r),o?u.extend(n,f):u.extend(n,f+1),r.detach(),this._isTextSelection=!0,c;f+=1}else for(e=0;e<n.childNodes.length;e++){if(r=n.childNodes[e].ownerDocument.createRange(),r.selectNodeContents(n.childNodes[e]),r.getBoundingClientRect().left<=t&&r.getBoundingClientRect().right>=t&&r.getBoundingClientRect().top<=i&&r.getBoundingClientRect().bottom>=i)return r.detach(),this._isTextSelection=!0,this._getWordAtPoint(n.childNodes[e],t,i);r.detach()}return this._isTextSelection=!1,null}},_getElementTouch:function(t,i,r,u){var y,h,l,o,a,s,f;if(t.nodeType==t.TEXT_NODE)for(y=window.getSelection(),f=t.ownerDocument.createRange(),f.selectNodeContents(t),h=0,l=f.endOffset;h<l;){if(f.setStart(t,h),f.setEnd(t,h+1),f.getBoundingClientRect().left<=i&&f.getBoundingClientRect().right>=i&&f.getBoundingClientRect().top<=r&&f.getBoundingClientRect().bottom>=r){var d=f.toString(),p=t.textContent,e=[],c,l;for(s=0;s<p.length;s++)p[s]==" "&&e.push(s);for(o=0;o<e.length;o++){if(h==e[o]&&(c=e[o],l=e[o]),e[0]>h){c=0;l=e[o];break}h>e[o]&&h<e[o+1]?(c=e[o],l=e[o+1]):h>e[o]&&(e[o+1]||(c=e[o]))}if(this.startelem=c,this.endelem=l,c==0?f.setStart(t,c):f.setStart(t,c+1),f.setEnd(t,l),y.removeAllRanges(),y.addRange(f),u){a=f.getBoundingClientRect();this._rangePosition=a;this._ranges=!0;this._selectedRanges=f;var v=document.getElementById(this._id+"droplet1"),w=document.getElementById(this._id+"droplet2"),b=n(v).width(),k=n(v).height();n(v).show();n(v).offset({top:a.top+window.scrollY+k/2,left:a.left-b}).show();n(w).show();n(w).offset({top:a.top+window.scrollY+k/2,left:a.left+a.width-b}).show()}return f.detach(),d}h+=1}else for(s=0;s<t.childNodes.length;s++){if(f=t.childNodes[s].ownerDocument.createRange(),f.selectNodeContents(t.childNodes[s]),f.getBoundingClientRect().left<=i&&f.getBoundingClientRect().right>=i&&f.getBoundingClientRect().top<=r&&f.getBoundingClientRect().bottom>=r)return f.detach(),this._getElementTouch(t.childNodes[s],i,r,u);f.detach()}return null},_toolbarClick:function(t){var e=t.target,i=t.target,u,f,r;if(this._isToolbarClick)if(n("#"+this._id+"_rptTooltip").css("display","none"),n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")||n(i).hasClass("e-pdfviewer-toolbar-underline")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")||n(i).hasClass("e-pdfviewer-dropdown-wrapper")||n(i).hasClass("e-pdfviewer-dropdown-arrow")||(this._selectionNodes=window.getSelection(),this._maintainSelection(),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1),(n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")||n(i).hasClass("e-pdfviewer-toolbar-underline")||n(i).hasClass("e-pdfviewer-toolbar-strikeout"))&&(document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1),this._displaySearch=!1,this._isDefaultColorSet=!1,n(i).hasClass("e-pdfviewer-toolbarli")&&(i=n(i).find("span")),n(i).hasClass("e-pdfviewer-print"))this._isPrintRestrict||this._print();else if(n(i).hasClass("e-pdfviewer-download"))this._isAsynchronousDownload=!0,this._saveFormFieldsValue();else if(n(i).hasClass("e-pdfviewer-gotofirst")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoFirstPage();else if(n(i).hasClass("e-pdfviewer-gotolast")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoLastPage();else if(n(i).hasClass("e-pdfviewer-gotonext")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoNextPage();else if(n(i).hasClass("e-pdfviewer-gotoprevious")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoPreviousPage();else if(n(i).hasClass("e-pdfviewer-zoomin"))this._applyLowerZoomIndex(),this._zoomIn();else if(n(i).hasClass("e-pdfviewer-zoomout"))this._applyHigherZoomIndex(),this._zoomOut();else if(n(i).hasClass("e-pdfviewer-fitpage")||n(i).hasClass("e-pdfviewer-fitwidth")){u=i;f=n(u).attr("id");switch(f){case this._id+"_fitWidth":this._applyFitToWidth();break;case this._id+"_fitPage":this._applyFitToPage()}}else n(i).hasClass("e-pdfviewer-find")?this._displaySearchBox():n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")?this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color),this._isDefaultColorSet=!0,this._initHighlight()):n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-underline")?this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color),this._isDefaultColorSet=!0,this._initUnderline()):n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")?this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color),this._isDefaultColorSet=!0,this._initStrikeOut()):(n(i).hasClass("e-pdfviewer-dropdown-wrapper")||n(i).hasClass("e-pdfviewer-dropdown-arrow"))&&(r=n(i).parents(".e-pdfviewer-toolbarli"),r.hasClass("e-pdfviewer-toolbar-underline")?this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&(this._displayColorPicker("Underline"),this._setPickerPosition(r[0]),this._isUnderlineEnabled=!1,this._initUnderline()):r.hasClass("e-pdfviewer-toolbar-highlight")?this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation&&(this._displayColorPicker("Highlight"),this._setPickerPosition(r[0]),this._isHighlightEnabled=!1,this._initHighlight()):r.hasClass("e-pdfviewer-toolbar-strikeout")&&this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation&&(this._displayColorPicker("StrikeOut"),this._setPickerPosition(r[0]),this._isStrikeOutEnabled=!1,this._initStrikeOut()))},_save:function(n){var i=this.fileName.indexOf("\\")==-1?this.fileName:this.fileName.replace(/^.*[\\\/]/,"");var t=navigator.userAgent,r=this._base64toBlob(n.DocumentStream,"application/pdf",512);t.indexOf("Edge")==-1?t.indexOf("Firefox")!=-1||t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("AppleWebKit")!=-1?this._download(r,"",i):window.navigator.msSaveOrOpenBlob(r,i):window.navigator.msSaveOrOpenBlob(r,i)},_base64toBlob:function(n,t,i){var e,o,r,f,s,u,h;for(t=t||"",i=i||512,e=atob(n),o=[],r=0;r<e.length;r+=i){for(f=e.slice(r,r+i),s=new Array(f.length),u=0;u<f.length;u++)s[u]=f.charCodeAt(u);h=new Uint8Array(s);o.push(h)}return new Blob(o,{type:t})},_createBlob:function(n,t){if(typeof Blob!="undefined")return new Blob([n],{type:t});warn('The "Blob" constructor is not supported.')},_download:function(n,t,i){var u=URL.createObjectURL(n),r=document.createElement("a"),f;r.click?(r.href=u,r.target="_parent","download"in r&&(r.download=i),(document.body||document.documentElement).appendChild(r),r.click(),r.parentNode.removeChild(r)):(window.top===window&&u.split("#")[0]===window.location.href.split("#")[0]&&(f=u.indexOf("?")===-1?"?":"&",u=u.replace(/#|$/,f+"$&")),window.open(u,"_parent"))},_showToolbar:function(t){t?(n("#"+this._id+"_toolbarContainer").css("display","block"),this._setSearchToolbarTop(),this._isToolbarHidden=!1):(n("#"+this._id+"_toolbarContainer").css("display","none"),this._isFindboxPresent&&this._displaySearchBox(),this._isToolbarHidden=!0)},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(0);t.disable();n("#"+this._id+"_txtpageNo").attr("disabled","disabled");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast")}},_enableToolbarItems:function(){this._isToolbarClick=!0;this.model.toolbarSettings.templateId||this._isDevice||(n("#"+this._id+"_txtpageNo").removeAttr("disabled"),n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable())},_showIconToolTip:function(t){n("#"+this._id+"_rptTooltip").css("display")=="none"&&this._showTooltipContent(t)},_hideIconToolTip:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_viewpopupBlockNone:function(n){return n.css("display")=="block"?!1:!0},_showTooltipContent:function(t){var i=t.target,r,u,l,f,o,a,v,y,p,w,b,k,d,g,ft,s,h,nt,tt,it,rt,ut,c,e,et;if(this.model.toolbarSettings.showTooltip&&!this._isDevice){if(l=!0,n(i).hasClass("e-pdfviewer-toolbarli")&&(i=n(i).find("span")),f=n(i).prev(),n(i).hasClass("e-pdfviewer-print")&&(o=n("#"+this._id+"_toolbarContainer .e-pdfviewer-print")[0],r=o?o.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-print")[0].getBoundingClientRect(),u=this._getTootipText("print")),n(i).hasClass("e-pdfviewer-download"))o=n("#"+this._id+"_toolbarContainer .e-pdfviewer-download")[0],r=o?o.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-download")[0].getBoundingClientRect(),u=this._getTootipText("download");else if(n(i).hasClass("e-pdfviewer-gotofirst")||n(f).hasClass("e-pdfviewer-gotofirst"))a=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotofirst")[0],r=a?a.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotofirst")[0].getBoundingClientRect(),u=this._getTootipText("first");else if(n(i).hasClass("e-pdfviewer-gotolast")||n(f).hasClass("e-pdfviewer-gotolast"))v=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotolast")[0],r=v?v.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotolast")[0].getBoundingClientRect(),u=this._getTootipText("last");else if(n(i).hasClass("e-pdfviewer-gotonext")||n(f).hasClass("e-pdfviewer-gotonext"))y=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotonext")[0],r=y?y.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotonext")[0].getBoundingClientRect(),u=this._getTootipText("next");else if(n(i).hasClass("e-pdfviewer-gotoprevious")||n(f).hasClass("e-pdfviewer-gotoprevious"))p=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotoprevious")[0],r=p?p.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotoprevious")[0].getBoundingClientRect(),u=this._getTootipText("previous");else if(n(i).hasClass("e-pdfviewer-zoomin")||n(f).hasClass("e-pdfviewer-zoomin"))w=n("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomin")[0],r=w?w.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-zoomin")[0].getBoundingClientRect(),u=this._getTootipText("zoomin");else if(n(i).hasClass("e-pdfviewer-zoomout")||n(f).hasClass("e-pdfviewer-zoomout"))b=n("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomout")[0],r=b?b.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-zoomout")[0].getBoundingClientRect(),u=this._getTootipText("zoomout");else if(n(i).hasClass("e-pdfviewer-tbpage")||n(i).hasClass("e-pdfviewer-pagenumber")||n(i).hasClass("e-pdfviewer-labelpageno"))k=n("#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage")[0],r=k?k.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-tbpage")[0].getBoundingClientRect(),u=this._getTootipText("pageIndex");else if(n(i).hasClass("e-pdfviewer-ejdropdownlist")||n(i).hasClass("e-dropdownlist")||n(i).hasClass("e-select")||n(i).hasClass("e-down-arrow"))d=n("#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist")[0],r=d?d.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-ejdropdownlist")[0].getBoundingClientRect(),u=this._getTootipText("zoom"),l=this._viewpopupBlockNone(n("#"+this._id+"_toolbar_zoomSelection_popup_list_wrapper"));else if(n(i).hasClass("e-pdfviewer-fitwidth")||n(i).hasClass("e-pdfviewer-fitpage")||n(f).hasClass("e-pdfviewer-fitwidth")||n(f).hasClass("e-pdfviewer-fitpage")){g=i;ft=n(g).attr("id");switch(ft){case this._id+"_fitWidth":s=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0];r=s?s.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitwidth")[0].getBoundingClientRect();u=this._getTootipText("fittoWidth");break;case this._id+"_fitPage":h=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0];r=h?h.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitpage")[0].getBoundingClientRect();u=this._getTootipText("fittopage");break;default:nt=n(g).prev();n(nt).hasClass("e-pdfviewer-fitwidth")?(s=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0],r=s?s.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitwidth")[0].getBoundingClientRect(),u=this._getTootipText("fittoWidth")):n(nt).hasClass("e-pdfviewer-fitpage")&&(h=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0],r=h?h.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitpage")[0].getBoundingClientRect(),u=this._getTootipText("fittopage"))}}else n(i).hasClass("e-pdfviewer-find")?this._isFindboxPresent||(tt=n("#"+this._id+"_toolbarContainer .e-pdfviewer-find")[0],r=tt?tt.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-find")[0].getBoundingClientRect(),u=this._getTootipText("search")):n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")?(it=n("#"+this._id+"_toolbarContainer .e-pdfviewer-highlight-markup")[0],r=it?it.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-highlight-markup")[0].getBoundingClientRect(),u=this._getTootipText("highlight")):n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")?(rt=n("#"+this._id+"_toolbarContainer .e-pdfviewer-strikeout-markup")[0],r=rt?rt.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-strikeout-markup")[0].getBoundingClientRect(),u=this._getTootipText("strikeout")):(n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-underline"))&&(ut=n("#"+this._id+"_toolbarContainer .e-pdfviewer-underline-markup")[0],r=ut?ut.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-underline-markup")[0].getBoundingClientRect(),u=this._getTootipText("underline"));u&&l&&(c=this._viewerMaxZindex(),n("#"+this._id+"_rptTooltip_Header").html(u.header),n("#"+this._id+"_rptTooltip_Content").html(u.content),e=document.getElementById(this._id+"_toolbarContainer").getBoundingClientRect(),et=this.element[0].clientWidth,et<r.left+2*r.width?u.header=="Zoom"?n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:r.top-e.top-21,left:r.left-e.left-2*r.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:r.top-e.top-21,left:r.left-e.left-3*r.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:r.top-e.top-21,left:r.left-e.left+r.width/2,display:"block",position:"absolute"}))}},_viewerMaxZindex:function(){var u=this.element.parents(),i,r,t;return i=n("body").children(),index=i.index(this.popup),i.splice(index,1),n(i).each(function(n,t){u.push(t)}),r=n(this.model.target).children(),cindex=r.index(this.popup),r.splice(cindex,1),n(r).each(function(n,t){u.push(t)}),t=Math.max.apply(t,n.map(u,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_getTootipText:function(n){var i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],r="",u="";switch(n){case"print":r=i.toolbar.print.headerText;u=i.toolbar.print.contentText;break;case"download":r=i.toolbar.download.headerText;u=i.toolbar.download.contentText;break;case"first":r=i.toolbar.first.headerText;u=i.toolbar.first.contentText;break;case"previous":r=i.toolbar.previous.headerText;u=i.toolbar.previous.contentText;break;case"next":r=i.toolbar.next.headerText;u=i.toolbar.next.contentText;break;case"last":r=i.toolbar.last.headerText;u=i.toolbar.last.contentText;break;case"zoomin":r=i.toolbar.zoomIn.headerText;u=i.toolbar.zoomIn.contentText;break;case"zoomout":r=i.toolbar.zoomOut.headerText;u=i.toolbar.zoomOut.contentText;break;case"pageIndex":r=i.toolbar.pageIndex.headerText;u=i.toolbar.pageIndex.contentText;break;case"zoom":r=i.toolbar.zoom.headerText;u=i.toolbar.zoom.contentText;break;case"fittoWidth":r=i.toolbar.fitToWidth.headerText;u=i.toolbar.fitToWidth.contentText;break;case"fittopage":r=i.toolbar.fitToPage.headerText;u=i.toolbar.fitToPage.contentText;break;case"search":r=i.toolbar.search.headerText;u=i.toolbar.search.contentText;break;case"highlight":r=i.toolbar.highlight.headerText;u=i.toolbar.highlight.contentText;break;case"strikeout":r=i.toolbar.strikeout.headerText;u=i.toolbar.strikeout.contentText;break;case"underline":r=i.toolbar.underline.headerText;u=i.toolbar.underline.contentText}return{header:r,content:u}},_setInitialization:function(){this._canvascount=0;this._fileName="";this._isToolbarClick=!1;this._pageModel=null;this._currentPage=1;this._zoomLevel=2;this._pageImageStream=null;this._pageWidth;this._pageHeight;this._pageLocation=[];this._scrollTriggered=!1;this._previousPage=1;this._totalPages;this._previousPosition;this._cummulativeHeight;this._backgroundPage=1;this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._searchMatches=[];this._pagePrinted=!1;this._printingPage=1;this._printingTimer;this._previousZoom=1;this._renderPreviousPage=!1;this._pageSize;this._eventpreviouszoomvalue;this._eventzoomvalue;this._pdfFileName;this._zoomArray=[];this._rerenderCanvasList=[];this._ajaxRequestState=null},_showViewerBlock:function(t){if(t){n("#"+this._id+"_viewBlockContainer").css("display","block");var i=n("#"+this._id+"_viewBlockContainer .e-pdfviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else n("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&n("#"+this._id+"_viewBlockContainer.e-pdfviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){n("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t,appendTo:"#"+this._id+"_viewerContainer"});n("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showloadingIndicator:function(t){t?(n("#"+this._id+"_loadingIndicator").css("display","block"),n("#"+this._id+"_pageviewOuterContainer").css("display","none")):(n("#"+this._id+"_loadingIndicator").css("display","none"),n("#"+this._id+"_pageviewOuterContainer").css("display","block"));n("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t,appendTo:"#"+this._id+"_loadingIndicator"});n("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showPrintLoadingIndicator:function(t){n("#"+this._id+"e-pdf-viewer").css({position:"relative"});n("#"+this._id+"e-pdf-viewer").ejWaitingPopup({showOnInit:t,text:"Preparing document for printing...",cssClass:"e-pdfviewer-waitingpopup-print",appendTo:"#"+this._id+"e-pdf-viewer"})},_viewerResize:function(){var t=this,s=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,h=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,u=n(t.element).height(),r=n(t.element).width(),e,o,f;h.indexOf("%")!=-1?(t._isPercentHeight=parseInt(h),e=t._isHeight?n(t.element).parent().height():u,u=t._isHeight?e:e/100*t._isPercentHeight):t.element[0].parentElement.clientHeight!=0&&t._isPercentHeight!=-1?u=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&t.element[0].parentElement.clientHeight!=0&&(u=t.element[0].parentElement.clientHeight);t.element.height(u);s.indexOf("%")!=-1?(t._isPercentWidth=parseInt(s),o=t._isWidth?n(t.element).parent().width():r,r=t._isWidth?o:o/100*t._isPercentWidth):t.element[0].parentElement.clientWidth!=0&&t._isPercentWidth!=-1?r=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&t.element[0].parentElement.clientWidth!=0&&(r=t.element[0].parentElement.clientWidth);t.element.width(r);t._toolbar._activeItem=i;t._toolbar._reSizeHandler();r<=500?n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:r/2-307/2+"px",Y:u/2+"px"},width:"auto"}):n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:r/2-250+"px",Y:u/2+"px"},width:"500px"});n("#"+t._id+"_pdfviewer_searchul").removeClass("e-separator");n("#"+t._id+"_pdfviewer_downloadul").removeClass("e-separator");document.getElementById(t._id+"_pdfviewer_colorpicker").style.display="none";t._isToolbarColorPicker=!1;f=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_printul").parent()[0]!=f[0]&&(this._isDownloadCntlHidden||(f.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),this._isDownloadCntlHidden=!0));n("#"+this._id+"_pdfviewer_downloadul").parent()[0]!=f[0]&&this._isDownloadCntlHidden&&(this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._isDownloadCntlHidden=!1);t._toolbarResizeHandler();t._resizeSearchToolbar();t.model.isResponsive&&t._renderedCanvasList.length>0&&t._isAutoZoom&&t._applyFitToWidthAuto();t._fitType!="fitToWidth"||t.model.isResponsive||t._applyFitToWidth();t._isWindowResizing=!0;t._applyLeftPosition()},_applyLeftPosition:function(){for(var t,i,n=1;n<=this._totalPages;n++)t=this._fitType=="fitToWidth"||this._isAutoZoom&&this._zoomVal<1?5:this._pageSize[n-1].PageRotation==90||this._pageSize[n-1].PageRotation==270?(this.element.width()-this._pageSize[n-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[n-1].PageWidth*this._zoomVal)/2,t<0&&(t=5),i=document.getElementById(this._id+"pageDiv_"+n),i&&(i.style.left=t+"px")},_toolbarResizeHandler:function(){var t=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_searchul").parent()[0]!=t[0]&&(this._isZoomCntlHidden=!0,t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_searchul").css({float:"left"}),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_textmarkupul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_zoomul")[0]));n("#"+this._id+"_pdfviewer_zoomul").parent()[0]==t[0]&&this._isZoomCntlHidden&&(t.append(n("#"+this._id+"_pdfviewer_zoomul")[0]),t.append(n("#"+this._id+"_pdfviewer_textmarkupul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_searchul").css({float:"right"}),n("#"+this._id+"_pdfviewer_textmarkupul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),this._isZoomCntlHidden=!1)},_overflowToolbarClose:function(){document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1},_resizeSearchToolbar:function(){var t=document.getElementById(this._id+"_pdfviewer_searchbox"),r,e,f,o,u,i;t&&(r=n("#"+this._id+"_toolbarContainer .e-pdfviewer-find")[0],r||(r=n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-find")[0]),e=r.getBoundingClientRect(),f=document.getElementById("e-pdfviewer-arrow-responsive"),f&&document.head.removeChild(f),n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")?(o=document.getElementById(this._id+"_toolbarContainer"),t.style.left="0px",i=n("#"+this._id+"_pdfviewer_searchinput")[0],i.style.width="150px",t.style.width="400px"):(t.style.left=r.parentNode.parentNode.offsetLeft-r.parentNode.parentNode.parentNode.offsetLeft-2+"px",i=n("#"+this._id+"_pdfviewer_searchinput")[0],i.style.width="150px",t.style.width="400px"),u=document.getElementById(this._id+"e-pdf-viewer"),u.clientWidth<t.offsetLeft+t.clientWidth?(i=n("#"+this._id+"_pdfviewer_searchinput")[0],this._isZoomCntlHidden?(i.style.width=parseInt(i.style.width)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px",t.style.width=parseInt(t.style.width)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"):t.style.left=parseInt(t.style.left)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"):n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")&&(t.style.left=parseInt(t.style.left)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"),this._responsiveArrow(e,t))},_responsiveArrow:function(t,i){var r=document.createElement("Style"),f,u;r.id="e-pdfviewer-arrow-responsive";document.head.appendChild(r);style=r.sheet;!navigator.userAgent.match("Firefox")&&style?(f=i.getBoundingClientRect(),u=t.left-f.left,style.addRule(".e-pdfviewer-arrow::before","left:"+u+"px"),style.addRule(".e-pdfviewer-arrow::after","left:"+u+"px")):n("#"+this._id+"_pdfviewer_searchbox").removeClass("e-pdfviewer-arrow")},goToPage:function(n){this._gotoPageNo(n)},goToLastPage:function(){this._gotoLastPage()},goToFirstPage:function(){this._gotoFirstPage()},goToNextPage:function(){this._gotoNextPage()},goToPreviousPage:function(){this._gotoPreviousPage()},print:function(){this._print()},abortPrint:function(){this._printCancel()},showPrintTools:function(n){this._showPrintButton(n)},showDownloadTool:function(n){this._showDownloadButton(n)},showTextSearchTool:function(n){this._showTextSearchButton(n)},showPageNavigationTools:function(n){this._showPageNavigationControls(n)},showMagnificationTools:function(n){this._showZoomControl(n);this._showFittoPage(n)},showTextMarkupAnnotationTools:function(n){this._showTextMarkupButtons(n)},showToolbar:function(n){this._showToolbar(n)},unload:function(){this._unLoad()},load:function(r){var h,o,e,u,s,f;if(n("#"+this._id+"_viewerContainer").scrollTop(0),this._showloadingIndicator(!0),this.isDocumentEdited=!1,this._fitType=null,this.model.isResponsive=!0,this._isAutoZoom=!0,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_search"),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._isHighlightEnabled=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._annotationActive=!1,this._zoomVal=1,this._zoomLevel=3,this.fileName=null,this._fileName="",h=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o=h.contextMenu.auto.contentText,n("#"+this._id+"_toolbar_zoomSelection_hidden").val(o),this._ejDropDownInstance.model.value=o,this._initToolbar(),r)for(e=this._canvascount;e>=1;)n("#"+this._id+"pageDiv_"+e).remove(),e--;window.clearInterval(this._scrollTimer);u={};u.viewerAction="GetPageModel";u.controlId=this._id;u.pageindex="1";u.isInitialLoading="true";s=r.split("base64,")[1];s==i?(this._fileName=r,u.newFileName=this._fileName,this._fileId=this._createGUID(),u.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(u),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:u}),"_getPageModel")):(f=this.model.serviceUrl,u.uploadedFile=s,this._fileId=this._createGUID(),u.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?(f=this.model.serviceUrl+"/"+this.model.serverActionSettings.fileUpload,this._doAjaxPost("POST",f,JSON.stringify(u),"_getPageModel")):(f=f.replace(this.model.serverActionSettings.load,this.model.serverActionSettings.fileUpload),this._doAjaxPost("POST",f,JSON.stringify({jsonResult:u}),"_getPageModel")))},fitToPage:function(){this._applyFitToPage()},fitToWidth:function(){this._applyFitToWidth()},download:function(n){this._isAsynchronousDownload=typeof n=="boolean"?n:!0;this._saveFormFieldsValue()},zoomIn:function(){this._applyLowerZoomIndex();this._zoomIn()},zoomOut:function(){this._applyHigherZoomIndex();this._zoomOut()},zoomTo:function(i){i<50?i=50:i>400&&(i=400);var r=parseInt(i)/100,u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=u.contextMenu.auto.contentText;i==f?(r=1,this.model.isResponsive=!0):(i=i+"%",this.model.isResponsive=!1);this._calculateZoomLevel(r);this._zoomContainer(r,!1);n("#"+this._id+"_toolbar_zoomSelection_hidden").val(i);this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active");this._ejDropDownInstance.model.value=i},undo:function(){this._isPropertiesWindowOpen||this._undo()},redo:function(){this._isPropertiesWindowOpen||this._redo()},addAnnotation:function(n){n==t.PdfViewer.AnnotationType.Highlight?this._addAnnotation("Highlight"):n==t.PdfViewer.AnnotationType.Underline?this._addAnnotation("Underline"):n==t.PdfViewer.AnnotationType.Strikethrough&&this._addAnnotation("StrikeOut")}});t.PdfViewer.ToolbarItems={MagnificationTools:1,PageNavigationTools:2,PrintTools:4,DownloadTool:8,TextSearchTool:16,TextMarkupAnnotationTools:32,All:63};t.PdfViewer.PdfService={Local:1,Remote:2};t.PdfViewer.LinkTarget={Default:1,NewTab:2,NewWindow:4};t.PdfViewer.AnnotationType={Underline:1,Strikethrough:2,Highlight:4};t.PdfViewer.Locale=t.PdfViewer.Locale||{};t.PdfViewer.Locale["default"]=t.PdfViewer.Locale["en-US"]={toolbar:{print:{headerText:"Print",contentText:"Print the PDF document."},download:{headerText:"Download",contentText:"Download the PDF document."},first:{headerText:"First",contentText:"Go to the first page of the PDF document."},previous:{headerText:"Previous",contentText:"Go to the previous page of the PDF document."},next:{headerText:"Next",contentText:"Go to the next page of the PDF document."},last:{headerText:"Last",contentText:"Go to the last page of the PDF document."},zoomIn:{headerText:"Zoom-In",contentText:"Zoom in to the PDF document."},zoomOut:{headerText:"Zoom-Out",contentText:"Zoom out of the PDF document."},pageIndex:{headerText:"Page Number",contentText:"Current page number to view."},zoom:{headerText:"Zoom",contentText:"Zoom in or out on the PDF document."},fitToWidth:{headerText:"Fit to Width",contentText:"Fit the PDF page to the width of the container."},fitToPage:{headerText:"Fit to Page",contentText:"Fit the PDF page to the container."},search:{headerText:"Search Text",contentText:"Search text in the PDF pages."},highlight:{headerText:"Highlight Text",contentText:"Highlight text in the PDF pages."},strikeout:{headerText:"Strikethrough Text",contentText:"Strikethrough text in the PDF pages."},underline:{headerText:"Underline Text",contentText:"Underline text in the PDF pages."}},contextMenu:{copy:{contentText:"Copy"},googleSearch:{contentText:"Search google"},openPopup:{contentText:"Open Pop-Up Note"},Delete:{contentText:"Delete"},properties:{contentText:"Properties...."},Find:{contentText:"Find:"},matchCase:{contentText:"matchCase"},auto:{contentText:"Auto"}},propertyWindow:{underlineProperties:{contentText:"Underline Properties"},strikeOutProperties:{contentText:"StrikeOut Properties"},highlightProperties:{contentText:"Highlight Properties"},appearance:{contentText:"Appearance"},general:{contentText:"General"},color:{contentText:"Color:"},opacity:{contentText:"Opacity:"},author:{contentText:"Author:"},subject:{contentText:"Subject:"},modified:{contentText:"Modified:"},ok:{contentText:"OK"},cancel:{contentText:"Cancel"},locked:{contentText:"Locked"}}}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejGanttChart","ej.GanttChart",{element:null,model:null,_rootCSS:"e-ganttchart",keyConfigs:{focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",firstRowSelection:"36",lastRowSelection:"35",leftArrow:"37",rightArrow:"39",upArrow:"38",downArrow:"40",moveCellRight:"9",moveCellLeft:"shift+9",selectedRowExpand:"alt+40",totalRowExpand:"ctrl+40",selectedRowCollapse:"alt+38",totalRowCollapse:"ctrl+38"},defaults:{childPropertyName:"",taskIdMapping:"",taskNameMapping:"",startDateMapping:"",endDateMapping:"",childMapping:"",finishDateMapping:"",durationMapping:"",milestoneMapping:"",progressMapping:"",predecessorMapping:"",resourceInfoMapping:"",resourceNameMapping:"",resourceCollection:[],holidays:[{day:null,label:null,background:null}],stripLines:[{day:null,label:null,lineStyle:"dotted",lineColor:"#169dd7",lineWidth:2}],enableTaskbarTooltip:!0,enableTaskbarDragTooltip:!0,highlightWeekends:!0,scheduleStartDate:null,scheduleEndDate:null,enableProgressBarResizing:!0,rowHeight:30,progressbarHeight:100,connectorlineWidth:1,dateFormat:"MM/dd/yyyy",locale:"en-US",taskbarBackground:"#DE8080",progressbarBackground:"#C44647",weekendBackground:"#F2F2F2",connectorLineBackground:"#383838",parentTaskbarBackground:"#383838",parentProgressbarBackground:"#1C1C1C",selectedItem:null,selectedRowIndex:-1,perDayWidth:null,perMonthWidth:null,perWeekWidth:null,perHourWidth:null,queryTaskbarInfo:null,taskbarTemplate:"",progressbarTemplate:null,parenttaskbarTemplate:"",parentprogressbarTemplate:null,milestoneTemplate:"",flatRecords:[],updatedRecords:[],ids:[],currentViewData:[],scheduleWeeks:[],scheduleYears:[],scheduleMonths:[],scheduleDays:[],scheduleHours:[],projectStartDate:null,projectEndDate:null,tooltipTemplate:"",tooltipTemplateId:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",progressbarTooltipTemplate:"",showTaskNames:!0,leftTaskLabelMapping:"",rightTaskLabelMapping:"",LeftTaskLabelTemplate:"",rightTaskLabelTemplate:"",showProgressStatus:!0,showResourceNames:!0,enableRowHover:!1,includeWeekend:!1,allowZooming:!1,readOnly:!1,allowGanttChartEditing:!0,allowKeyboardNavigation:!0,renderBaseline:!1,baselineColor:"#fba41c ",editSettings:{allowEditing:!1,allowAdding:!1,allowDeleting:!1,editMode:"normal",dialogEditorTemplateId:null},scheduleHeaderSettings:{weekHeaderFormat:"MMM dd , yyyy",dayHeaderFormat:"",weekendBackground:"#F2F2F2",yearHeaderFormat:"yyyy",monthHeaderFormat:"MMM",hourHeaderFormat:"HH",minuteHeaderFormat:"mm",scheduleHeaderType:"week",weekStartDay:0},workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",localizedDays:null,localizedMonths:null,columnHeaderTexts:null,predecessorEditingTexts:null,enablePredecessorEditing:!0,taskbarClick:null},updateHighlightWeekends:function(n){var t=this;t.model.highlightWeekends=n;t.model.highlightWeekends==!0?t._renderWeekends():t._$weekendsContainer.remove()},updateWeekendBackground:function(n){var t=this;t.model.weekendBackground=n;t._$weekendsContainer.remove();t._renderWeekends()},showTooltip:function(n){var t=this;t.model.enableTaskbarTooltip=n;t._createTaskbarTemplate();t._refresh()},showEditingTooltip:function(n){var t=this;t.model.enableTaskbarDragTooltip=n;t._createTaskbarTemplate();t._refresh()},updateConnectorLineBackground:function(n){var t=this;t.model.connectorLineBackground=n;t._createConnectorLineTemplate()},updateConnectorlineWidth:function(n){var t=this;t.model.connectorlineWidth=parseInt(n);t._createConnectorLineTemplate()},updateEditedRecordEndDate:function(n){var t=this;t._currentEditedRecord.endDate=n},updateEditedRecordDuration:function(n){var t=this;t._currentEditedRecord.duration=n},updateTaskbarBackground:function(n){var t=this;t.model.taskbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateProgressbarBackground:function(n){this.model.progressbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateParentTaskbarBackground:function(n){this.model.parentTaskbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateParentProgressbarBackground:function(n){this.model.parentProgressbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateRenderTaskNames:function(n){var t=this;t.model.showTaskNames=n;t._createTaskbarTemplate();t._refresh()},refreshLeftTaskLabelMapping:function(n){var t=this;t.model.leftTaskLabelMapping=n;t._createTaskbarTemplate();t._refresh()},refreshRightTaskLabelMapping:function(n){var t=this;t.model.rightTaskLabelMapping=n;t._createTaskbarTemplate();t._refresh()},refreshLeftTaskLabelTemplate:function(n){var t=this;t.model.leftTaskLabelTemplate=n;t._createTaskbarTemplate();t._refresh()},refreshRightTaskLabelTemplate:function(n){var t=this;t.model.rightTaskLabelTemplate=n;t._createTaskbarTemplate();t._refresh()},updateRendeProgressStatus:function(n){var t=this;t.model.showProgressStatus=n;t._createTaskbarTemplate();t._refresh()},updateRenderResourceNames:function(n){var t=this;t.model.showResourceNames=n;t._createTaskbarTemplate();t._refresh()},changeMilestoneTemplate:function(n){var t=this;t.model.milestoneTemplate=n;t._createTaskbarTemplate();t._refresh()},changeTaskbarTemplate:function(n){var t=this;t.model.taskbarTemplate=n;t._createTaskbarTemplate();t._refresh()},changeParentTaskbarTemplate:function(n){var t=this;t.model.parentTaskbarTemplate=n;t._createTaskbarTemplate();t._refresh()},ganttChartEditing:function(n){var t=this;t.model.allowGanttChartEditing=n},updateReadOnly:function(n){var t=this;t.model.readOnly=n},resizeProgressbar:function(n){var t=this;t.model.enableProgressBarResizing=n},updateAllowKeyboardNavigation:function(n){this.model.allowKeyboardNavigation=n},updateProgressbarHeight:function(n){var t=this;this.model.progressbarHeight=n;t._createTaskbarTemplate();t._refresh()},updateBaselineColor:function(n){var t=this;this.model.baselineColor=n;t._createTaskbarTemplate();t._refresh()},updateRenderBaseline:function(n){var t=this;this.model.renderBaseline=n;t._createTaskbarTemplate();t._refresh();t._createConnectorLineTemplate()},focusGanttElement:function(){if(t.browserInfo().name=="msie")try{this.element[0].setActive()}catch(n){}else this.element[0].focus()},_getYearWidth:function(){for(var i=this,n=0,t=0,n=0;n<this.model.scheduleYears.length;n++)t+=this._getTemplateYearWidth(this.model.scheduleYears[n]);return t},_getMonthWidth:function(){for(var r,e,u,h,o=this,c=o.model,n,s=c.scheduleMonths,i=0,f=0;f<s.length;f++)r=s[f],n=typeof r=="object"?new Date(r):t.parseDate(r,this.model.dateFormat,this.model.locale),e=new Date(n.getFullYear(),n.getMonth()+1,0),u=e.getDate(),n.getTime()===o.model.scheduleMonths[0].getTime()?(h=e.getDate()-n.getDate(),i+=this.model.perDayWidth*(h+1)):u==31?i+=this.model.perDayWidth*31:u==30?i+=this.model.perDayWidth*30:u==28&&(i+=this.model.perDayWidth*28);return i},_getWeekWidth:function(){return this.model.perDayWidth*7},_getNumberOftWeeks:function(n,t){var i=new Date(n),u=new Date(t),r=[];do r.push(new Date(i)),i.setDate(i.getDate()+7);while(!(i>u));return r},_getHeight:function(){return this._containerHeight},_setHeight:function(n){this._containerHeight=n},getGanttChartRows:function(){return this._ganttChartRows},getUpdatedRecords:function(){return this.model.flatRecords},setUpdatedRecords:function(n,t,i,r){var u=this;u.model.currentViewData=n;u.model.updatedRecords=t;u.model.flatRecords=i;u.model.ids=r},_getFormatedDate:function(n,i,r){return t.format(n,i,r)},_getViewportHeight:function(){var n=this,t=n._$headerContainer;return n.element.height()-t.height()-parseFloat(t.css("border-bottom-width"))},updateViewPortHeight:function(){var n=this;n._viewportHeight=n._getViewportHeight()},_init:function(){var r=this,u=r.model,f=u.scheduleHeaderSettings.scheduleHeaderType,e,o;r.element.addClass("e-ganttchart-core");r.element.attr("tabindex","0");r._initPrivateProperties();r._initialize();r._renderGanttChart();r._$bodyContainerParent.append(r._$bodyContainer);r._$bodyContainer.append(r._$bodyContent);r._$ganttChartContainer.append(r._$bodyContainerParent);n(r._$bodyContainer).css({height:r._viewportHeight+"px"});r.model.enableVirtualization&&n(r._$bodyContent).css({height:u.rowHeight*u.updatedRecords.length+"px"});f=="week"?n(r._$bodyContent).css({width:u.scheduleWeeks.length*r._scheduleWeekWidth+"px"}):f=="year"?n(r._$bodyContent).css({width:r._scheduleYearWidth+"px"}):f=="month"?n(r._$bodyContent).css({width:r._scheduleMonthWidth+"px"}):f=="day"?n(r._$bodyContent).css({width:u.scheduleDays.length*u.perHourWidth*24+"px"}):f=="hour"&&n(r._$bodyContent).css({width:u.scheduleHours.length*u.perMinuteWidth*r._totalInterval+"px"});r.createGridLinesTable();r.renderGanttRecords();e=t.buildTag("div");e.append(r._$bodyContent);r._$bodyContainer.append(e);r._$bodyContainer.ejScroller({width:r.element.width()-1,enableTouchScroll:!1,height:r._getViewportHeight(),scroll:function(n){var t=n.scrollTop;n.requestType="scroll";n.delta=t;t!=i?r.onScrollHelper(t,!0)===!1&&(n.cancel=!0):r._handleScroll(n)}});r._$bodyContainer.ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""});r._$bodyContainer.ejScroller("refresh");o=r._$bodyContainer.ejScroller("isHScroll");o?r._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):r._$bodyContainer.find("div.e-content").addClass("e-borderbox");r._wireEvents()},reRenderGanttChart:function(t,i){var r=this,u=r.model,f=u.scheduleHeaderSettings.scheduleHeaderType;r._wireEvents();u.perDayWidth=t;u.flatRecords=i;r._scheduleWeekWidth=r._getWeekWidth();r._scheduleYearWidth=r._getYearWidth();r._scheduleMonthWidth=r._getMonthWidth();n(r._$headerContainer).empty();n(r._$scheduleDiv).empty();r._renderGanttChart();r._$bodyContainerParent.append(r._$bodyContainer);r._$bodyContainer.append(r._$bodyContent);r._$ganttChartContainer.append(r._$bodyContainerParent);f=="week"?n(r._$bodyContent).css({width:u.scheduleWeeks.length*r._scheduleWeekWidth+"px"}):f=="year"?n(r._$bodyContent).css({width:r._scheduleYearWidth+"px"}):f=="month"?n(r._$bodyContent).css({width:r._scheduleMonthWidth+"px"}):f=="day"?n(r._$bodyContent).css({width:u.scheduleDays.length*u.perHourWidth*24+"px"}):f=="hour"&&n(r._$bodyContent).css({width:u.scheduleHours.length*u.perMinuteWidth*r._totalInterval+"px"})},_initPrivateProperties:function(){var t=this;t._viewportHeight=0;t._prevScrollTop=0;t._scrollTop=0;t._vScrollDir=1;t._$ganttChartContainer=null;t._$headerContainer=null;t._$bodyContainer=null;t._$bodyContent=null;t._$dependencyViewContainer=null;t._$secondaryCanvas=null;t._$ganttViewTable=null;t._$ganttViewTablebody=null;t._weekdays=[];t._rowMargin=0;t._renderedRange=null;t._visibleRange=null;t._vTop=null;t._vBottom=null;t._rTop=null;t._rBottom=null;t._vscrollDist=0;t._containerHeight=0;t._id=this.element.attr("id");t._ganttChartRows=null;t._filteredRecords=[];t._sortedRecords=[];t._tempSortedRecords=[];t._scheduleHours=[];t._scheduleMinutes=[];t._updateScheduleWidth();t._totalMonthWidth=0;t._tempFilteredRecords=[];t._prevLeft=0;t._allowDragging=!1;t._leftResizing=!1;t._rightResizing=!1;t._progressResizing=!1;t._editingContainer=null;t._allowExpandCollapse=!0;t._leftResizer=null;t._taskbarItem=null;t._progressbarItem=null;t._progressResizer=null;t._rightResizer=null;t._manualRightResizer=null;t._tasknameContainer=null;t._mousePosX=0;t._currMousePosX=0;t._currMousePosY=0;t._prevItem={};t._parentCollectionPreviousValues=[];t._mouseTarget=null;t._mouseDown=!1;t._$scheduleDiv=null;t._leftResizerGripper=null;t._rightResizerGripper=null;t._progressHandle=null;t._progressHandleChild=null;t._currentEditedRecord={taskId:null,taskName:null,startDate:null,endDate:null,duration:null,isMilestone:!1,status:null,predecessor:null,resourceInfo:null,parentItem:null,isSelected:!1,childRecords:null,hasChildRecords:!1,expanded:!1,level:0,left:0,width:0,progressWidth:0,item:null,baselineLeft:0,baselineWidth:0,baselineStartDate:null,baselineEndDate:null,isReadOnly:!1,hasFilteredChildRecords:!0,serialNumber:null,taskbarBackground:null,progressbarBackground:null,parentProgressbarBackground:null,parentTaskbarBackground:null,cellBackgroundColor:null,rowBackgroundColor:null,treeMappingName:[],dragState:!0,isSelected:!1,durationUnit:""};t._mouseHoverTooltip=document.getElementById(this.model.tooltipTemplate);t._progressBarTooltipID=document.getElementById(this.model.progressbarTooltipTemplateId);t._taskbarEditingTooltipID=document.getElementById(this.model.taskbarEditingTooltipTemplateId);t._scrollBarHeight=18;t._windowWidth=n(window).width();t._windowHeight=n(window).height();t._editingItem=null;t._editingTarget=null;t.tooltipState=null;t._visibleRecordsCount=0;t._tooltipTimer;t._$gridLinesTablebody=null;t._leftConnectorPoint=null;t._rightConnectorPoint=null;t._childLeftConnectorPoint=null;t._childRightConnectorPoint=null;t._editPredecessor=!1;t._connectorPointX=null;t._connectorPointY=null;t._predecessorTooltip=null;t._totalCollapsedRecordCount=0;t._milesStoneWidth=0;t._connectorPointWidth=0;t._newXYPos=!0;t._posX1=null;t._posY1=null},_updateScheduleWidth:function(){var n=this;n._scheduleWeekWidth=n._getWeekWidth();n._numOfWeeks=n._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate);n._scheduleYearWidth=n._getYearWidth();n._scheduleMonthWidth=n._getMonthWidth();n._totalWeekWidth=n._scheduleWeekWidth*n._numOfWeeks.length;n._balanceWidth=n._totalWeekWidth-n._scheduleMonthWidth;n._scheduleMonthWidth+=n._balanceWidth},_initialize:function(){var n=this;n._$ganttChartContainer=t.buildTag("div.e-ganttviewercontainer#ganttviewercontainer"+n._id,"",{width:"100%"},{});n._$headerContainer=t.buildTag("div.e-ganttviewerheaderContainer#ganttviewerheaderContainer"+n._id,"",{"border-right-style":"solid","border-right-width":"1px"},{});n._$bodyContainer=t.buildTag("div.e-ganttviewerbodyContianer#ganttviewerbodyContianer"+n._id,"",{"-ms-touch-action":"none"},{});n._$bodyContainerParent=t.buildTag("div.e-ganttviewerbodyContianerparent#ganttviewerbodyContianerParent"+n._id,"",{"-ms-touch-action":"none","border-right-style":"solid","border-right-width":"1px","box-sizing":"border-box",width:"auto",height:"auto"},{});n._$bodyContent=t.buildTag("div.e-ganttviewerbodyContent#ganttviewerbodyContent"+n._id,"",{},{});n._$dependencyViewContainer=t.buildTag("div.e-ganttviewerbodyContianer-dependencyViewContainer#dependencyViewContainer"+n._id,"",{"z-index":"4",position:"absolute"},{});n._$secondaryCanvas=t.buildTag("div.e-ganttviewerbodyContianer-secondaryCanvas","",{"z-index":"3",position:"absolute"},{});n._$stripLineContainer=t.buildTag("div.e-ganttviewerbodyContianer-stripLines","",{"z-index":"6",position:"absolute"},{});n._$weekendsContainer=t.buildTag("div.e-ganttviewerbodyContianer-weekendsContainer","",{"z-index":"1",position:"absolute"},{});n._$ganttViewTable=t.buildTag("table.e-ganttviewerbodyContianer-ganttViewTable#ganttViewTable"+n._id,"",{"z-index":"5",position:"absolute"},{cellspacing:"0px"});n._$scheduleDiv=t.buildTag("div.e-gantt-schedule-container#gantt-schedule"+n._id+"","",{},{})},_getScheduleLength:function(n){var t=this,i=t.model;switch(n){case"week":return i.scheduleWeeks.length*t._scheduleWeekWidth;case"year":return t._scheduleYearWidth;case"month":return t._scheduleMonthWidth;case"day":return i.scheduleDays.length*t.model.perHourWidth*24;case"hour":return i.scheduleHours.length*i.perMinuteWidth*t._totalInterval;default:return i.scheduleWeeks.length*t._scheduleWeekWidth}},_renderGanttChart:function(){var i=this,r=i.model,f,e,o=r.scheduleHeaderSettings.scheduleHeaderType,s,u;if(i._createSchedule(i._getDateType(r.scheduleStartDate),i._getDateType(r.scheduleEndDate)),i._viewportHeight=i._getViewportHeight(),i._$ganttViewTable.css("width",i._getScheduleLength(o)+"px"),f=t.buildTag("colgroup","",{},{}),e=n(document.createElement("col")),e.css("width",i._getScheduleLength(o)+"px"),f.append(e),i._$ganttViewTable.append(f),i._createTooltipTemplate(),i._createEditingTooltipTemplate(),i._createProgressbarTooltipTemplate(),i._createTaskbarTemplate(),i._createConnectorLineTemplate(),i._updateCurrentViewData(),i.model.highlightWeekends==!0&&r.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Week&&i._renderWeekends(),i._$stripLineContainer.empty(),i.model.stripLines!=null&&this._renderStripLines(i.model.stripLines),i._$secondaryCanvas.empty(),i.model.holidays!=null)for(s=i.model.holidays.length,u=0;u<s;u++)i._renderHoliday(i.model.holidays[u])},renderConnectorLines:function(t){var i=this,r=n.render[i._id+"ConnectorLineTemplate"](t);n(i._$dependencyViewContainer).empty();i._$dependencyViewContainer.append(r);i._$bodyContent.append(i._$dependencyViewContainer)},clearConnectorLines:function(){n(this._$dependencyViewContainer).empty()},clearSelection:function(n){var t=this,r=t.model,i;(r.selectedRowIndex!=-1||n==-1)&&(i=t.getGanttChartRows(),i.removeClass("e-gantt-mouseclick"))},appendConnectorLine:function(t){var i=this,r=n.render[i._id+"ConnectorLineTemplate"](t);i._$dependencyViewContainer.append(r)},setCollapsedRecordCount:function(n){this._totalCollapsedRecordCount=n},getCollapsedRecordCount:function(){return this._totalCollapsedRecordCount},removeConnectorline:function(n){this.element.find("#ConnectorLine"+n).remove()},_wireEvents:function(){var i=this,r=jQuery.uaMatch(navigator.userAgent);t.isTouchDevice()?(i._on(i.element,"touchstart",".e-gantt-milestone-container,.e-childContainer",this._mouseHover),i._on(i.element,"touchstart",".e-childContainer,.e-gantt-milestone-container,.e-parentContainer",i._mousedown),n(document.body).bind("touchmove",n.proxy(i.handleMouseMove,i)),i._on(i.element,"touchleave",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseLeave),n(i._$bodyContainer).bind("touchend",n.proxy(i._handleMouseUp,i)),i._on(i.element,"tap",i._cellClickHandler)):(i._on(i.element,"mouseenter",".e-gantt-milestone-container,.e-childContainer,.e-parentContainer",this._mouseHover),i._on(i.element,"mouseleave",".e-gantt-milestone-container,.e-childContainer,.e-parentContainer",this._mouseLeave),i._on(i.element,"click",i._cellClickHandler),i._on(i.element,"mouseenter",".taskbarresizer-left",i._resizerleftOver),i._on(i.element,"mouseenter",".taskbarresizer-right",i._resizerrightOver),i._on(i.element,"mouseenter",".progressbarresizer-right",i._progressresizerOver),i._on(i.element,"mouseenter",".e-connectorpoint-left",i._dragLeftOver),i._on(i.element,"mouseenter",".e-connectorpoint-right",i._dragRightOver),t.browserInfo().name!="msie"?i._on(i.element,"mousedown",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._mousedown):i._on(i.element,"mousedown",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._mousedown),n(i._$bodyContainer).bind("mouseup",n.proxy(i._handleMouseUp,i)),n(document).bind("mouseup",n.proxy(i._tooltipMouseup,i)),i._on(i.element,"mouseenter",".e-stripline",i._stripLineMouseOver),i._on(i.element,"mouseleave",".e-stripline",i._stripLineMouseLeave),r.browser.toLowerCase()=="chrome"&&(i._on(i.element,"touchstart",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseHover),i._on(i.element,"touchstart",".e-childContainer,.e-gantt-milestone-container",i._mousedown),i._on(i.element,"touchleave",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseLeave),n(document.body).bind("touchmove",n.proxy(i.handleMouseMove,i)),i._on(i.element,"touchleave",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._handleMouseUp),n(i._$bodyContainer).bind("touchend",n.proxy(i._handleMouseUp,i)),n(i._$bodyContainer).bind("touchleave",n.proxy(i._handleMouseUp,i))));i._enableEditingEvents()},_enableEditingEvents:function(){var n=this,i=n.model;i.editSettings.allowEditing&&i.editSettings.editMode==="normal"?t.isTouchDevice?n._on(this.element,"doubletap",".e-ganttviewerbodyContent",n._editdblClickHandler):n._on(this.element,"dblclick",".e-ganttviewerbodyContent",n._editdblClickHandler):t.isTouchDevice?n._off(this.element,"doubletap",".e-ganttviewerbodyContent",n._editdblClickHandler):n._off(this.element,"dblclick",".e-ganttviewerbodyContent",n._editdblClickHandler)},updateEditSettings:function(n){var i=this;n&&(n.editMode&&(i.model.editSettings.editMode=n.editMode),t.isNullOrUndefined(n.allowAdding)||(i.model.editSettings.allowAdding=n.allowAdding),t.isNullOrUndefined(n.allowEditing)||(i.model.editSettings.allowEditing=n.allowEditing),t.isNullOrUndefined(n.allowDeleting)||(i.model.editSettings.allowDeleting=n.allowDeleting),t.isNullOrUndefined(n.beginEditAction)||(i.model.editSettings.beginEditAction=n.beginEditAction),i._enableEditingEvents())},_editdblClickHandler:function(){var n=this,i={};n.model.editSettings.editMode==="normal"&&!model.readOnly&&n.model.editSettings.allowEditing&&(i.requestType=t.TreeGrid.Actions.BeginEdit,n._trigger("actionBegin",i))},_enableRowHover:function(){var n=this;n.model.enableRowHover?n._on(n.element,"mouseleave mouseenter","#ganttviewerbodyContent,.e-ganttviewerbodyContent tr,.e-ganttviewerbodyContent"+n._id,n._rowHover):n._on(n.element,"mouseleave mouseenter","#ganttviewerbodyContent,.e-ganttviewerbodyContent tr,.e-ganttviewerbodyContent"+n._id)},_stripLineMouseLeave:function(){window.clearTimeout(this._tooltipTimer);this._clearTooltip()},_stripLineMouseOver:function(i){i.target.style.cursor="pointer";var r=this,h=r.model,u=n(i.target),c,f,e,l,o=0,s=0;r._clearTooltip();c=u.hasClass("e-striplinespan")?u[0].parentNode:u[0];f=c.id.match(/(\d+|[A-z]+)/g);(i.type=="mouseenter"||i.type=="mousemove")&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?(o=i.originalEvent.pageX,s=i.originalEvent.pageY):(i.originalEvent.clientX||i.originalEvent.clientY)&&(o=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop),e=t.buildTag("table.e-tooltiptable","",{width:"auto"},{cellspacing:"2px",cellpadding:"2px"}),l=t.buildTag("tbody","<tr><td>"+h.stripLines[f[1]].day+"<\/td><\/tr><tr><td>"+h.stripLines[f[1]].label+"<\/td><\/tr>",{},{}),e.append(l),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",e,{position:"absolute","z-index":r._getMaxZIndex()+1},{}),setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700))},_tooltipMouseup:function(){var n=this;n._mouseTarget==null||t.isTouchDevice()||n._handleMouseUp(n._mouseTarget)},_clearTooltip:function(){var t=this;t._mouseHoverTooltip&&n(t._mouseHoverTooltip).remove();n(".e-editingtooltip").remove();n("#tooltipgantt").remove();n(".e-progressbartooltip").remove();t._mouseHoverTooltip=null},_mouseWheel:function(n){if(this.model.allowZooming){var r=this,i={},t=null;if(n=n.originalEvent,n.preventDefault(),n.wheelDelta?t=-n.wheelDelta/120:n.detail&&(t=n.detail/3),!t)return;i.requestType="scroll";i.delta=t;r._enbleZooming(i)}},_resizerrightOver:function(n){var t=this,i=n.target,r=i.parentNode;t.model.allowGanttChartEditing==!0&&t.model.readOnly==!1&&(this._mouseDown==!1&&(n.target.style.cursor="w-resize"),t._setEditingElements(r))},_resizerrightLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_resizerleftOver:function(n){var t=this,i=n.target,r=i.parentNode;t.model.allowGanttChartEditing==!0&&t.model.readOnly==!1&&(this._mouseDown==!1&&(n.target.style.cursor="e-resize"),t._setEditingElements(r))},_resizerleftLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_progressresizerOver:function(t){var i=this,r=t.target,u=r.parentNode;i.model.allowGanttChartEditing==!0&&i.model.readOnly==!1&&(i.model.enableProgressBarResizing?(i._mouseDown==!1&&n(r).prev(".e-gantt-childtaskbar").has(".e-gantt-childtaskbar-progress").length>0&&(r.style.cursor="col-resize"),i._setEditingElements(u)):r.style.cursor="move")},_progressresizerLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_secondMouseOverConnectorPoint:function(t,i){var r=this,v,y,p,u,a;if(r._mouseDown&&r._falseLine||i&&r._falseLine){var e=n(t.target),w=r.getGanttChartRows(),v=e.closest("tr.e-ganttrowcell"),y=w.index(v),p=r.model.currentViewData[y],h=r._editingItem,c=p,f,l,o,s=r.model.predecessorText;if(r._prevItem.predecessorTarget==="Start"?f=h.taskId+"S":r._prevItem.predecessorTarget==="Finish"&&(f=h.taskId+"F"),e.hasClass("e-connectortouchpoint")?e.parent().hasClass("e-connectorpoint-left")?(f+="S",o=s.Start):e.parent().hasClass("e-connectorpoint-right")&&(f+="F",o=s.Finish):e.hasClass("e-connectorpoint-left")?(f+="S",o=s.Start):e.hasClass("e-connectorpoint-right")&&(f+="F",o=s.Finish),r._predecessorTooltip&&($table=r._predecessorTooltip.find("table"),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(c.taskName),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(o)),u={},u.requestType="validatePredecessor",u.fromItem=h,u.toItem=c,l=u.toItem.item[r.model.predecessorMapping]?u.toItem.item[r.model.predecessorMapping]+","+f:f,u.predecessor=f,u.currentRecord=c,u.predecessorString=[],u.predecessorString.push(l),a=r._completeAction(u),r._predecessorTooltip&&($td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)"),a?($td.removeClass(),$td.addClass("e-predecessor-true")):($td.removeClass(),$td.addClass("e-predecessor-false"))),i)return u}},_dragLeftOver:function(t){var i=this,r=t.target,u=r.parentNode;t.type=="touchmove"&&n(t.target).hasClass("e-connectortouchpoint")&&(u=r.parentNode.parentNode);i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&i.model.readOnly==!1&&(this._mouseDown==!1&&(r.style.cursor="pointer"),i._setEditingElements(u));n(u).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragLeftLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.enablePredecessorEditing&&n.model.readOnly==!1&&n._removeEditingElements()},_dragRightOver:function(t){var i=this,r=t.target,u=r.parentNode;t.type=="touchmove"&&n(t.target).hasClass("e-connectortouchpoint")&&(u=r.parentNode.parentNode);i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&i.model.readOnly==!1&&(this._mouseDown==!1&&(r.style.cursor="pointer"),i._setEditingElements(u));n(u).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragRightLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.enablePredecessorEditing&&n.model.readOnly==!1&&n._removeEditingElements()},_setEditingElements:function(t){var i=this,r;if(i._editingTarget&&!i._editPredecessor&&n(t).find(i._editingTarget).length==0)return!0;n(t).hasClass("e-childContainer")&&(i._leftResizerGripper=t.querySelector(".taskbarresizer-left"),i._rightResizerGripper=t.querySelector(".taskbarresizer-right"),r=t.querySelector(".progressbarresizer-right"),i._progressHandle=r&&r.firstChild,i._progressHandleChild=r&&r.childNodes[1],n(i._leftResizerGripper).addClass("gripper"),n(i._rightResizerGripper).addClass("gripper"),i.model.progressMapping&&i.model.enableProgressBarResizing&&(n(i._progressHandle).addClass("e-progresshandle"),n(i._progressHandleChild).addClass("e-progresshandleafter")));i.model.enablePredecessorEditing&&(n(t).hasClass("e-childContainer")&&i.model.predecessorMapping&&!i._falseLine?(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-gantt-milestone-container")&&i.model.predecessorMapping&&!i._falseLine?(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-childContainer")&&i.model.predecessorMapping&&i._falseLine?(i._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._childRightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-gantt-milestone-container")&&i.model.predecessorMapping&&i._falseLine?(i._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._childRightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-parentContainer")&&i.model.predecessorMapping&&!i._falseLine&&(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover"),n(t).hasClass("e-manualparenttaskbar")&&(n(i._leftConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"))))},_removeEditingElements:function(){var t=this;n(t._leftResizerGripper).removeClass("gripper");n(t._rightResizerGripper).removeClass("gripper");t.model.progressMapping&&(n(t._progressHandle).removeClass("e-progresshandle"),n(t._progressHandleChild).removeClass("e-progresshandleafter"));t.model.enablePredecessorEditing&&(t.model.predecessorMapping&&t._mouseDown==!1&&(n(t._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(t._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null),(t.model.predecessorMapping&&t._leftConnectorPoint!==null&&t._mouseDown==!0||t._childLeftConnectorPoint)&&(n(t._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),n(t._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),t._predecessorTooltip&&($table=t._predecessorTooltip.find("table"),$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(""),$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(""),$td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)").removeClass(),$td.addClass("e-predecessor-false"))))},refreshHeight:function(){var n=this;n._$bodyContainer.ejScroller("refresh")},_mousedown:function(i){var r,s,o;if(i.which==2||i.which==3)return!1;r=this;r._clearTooltip();r._mouseDown=!0;args={};var f=n(i.target),l=r.getGanttChartRows(),h=f.closest("tr.e-ganttrowcell"),c=l.index(h),e=r.model.currentViewData[c],a=e.parentItem,u=f[0].parentNode,v=jQuery.uaMatch(navigator.userAgent),y=this.model;t.isNullOrUndefined(e)||(i.type=="touchstart"&&(i.preventDefault(),n(".e-connectortouchpoint").addClass("e-enableconnectortouchpoint")),r._editingItem=e,r._editingTarget=f,r._allowExpandCollapse=!0,u=n(u).hasClass("progressbarresizer-right")?u.parentNode:n(u).hasClass("e-gantt-childtaskbar-progress")?n(u).closest("div.e-childContainer"):n(u).hasClass("progressbarhandler")?f.closest(".e-childContainer")[0]:n(u).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container"),(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-parentContainer")||n(u).hasClass("e-gantt-milestone-container"))&&(n(h).addClass("e-editmode"),r._mouseTarget=i),r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container")||n(u).hasClass("e-parentContainer"))&&((i.target.style.cursor=="e-resize"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone"))||i.type=="touchstart"&&i.target.className=="taskbarresizer-left")&&(r._updateEditingType(),r._leftResizing=!0),(i.target.style.cursor=="w-resize"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-parentContainer"))||i.type=="touchstart"&&i.target.className=="taskbarresizer-right")&&(r._updateEditingType(),r._rightResizing=!0),s=n(i.target).closest(".progressbarresizer-right"),((i.target.style.cursor=="col-resize"||s.length&&s[0].style.cursor=="col-resize")&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone"))||i.type=="touchstart"&&i.target.className=="progressbarresizer-right")&&(r._updateEditingType(),r._progressResizing=!0),o=n(i.target).closest("[style*='cursor: move']"),((i.target.style.cursor=="move"||o.length&&o[0].style.cursor=="move")&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container"))||n(f[0]).hasClass("e-gantt-manualparenttaskbar"))&&(r._updateEditingType(),r._allowDragging=!0),(i.target.style.cursor==""&&(o.length&&o[0].style.cursor==""||o.length==0)&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container"))||e.isAutoSchedule&&n(f).hasClass("e-gantt-manualparenttaskbar"))&&(r._updateEditingType(),i.target.className=="taskbarresizer-left e-icon"||i.target.className=="taskbarresizer-left e-icon gripper"?r._leftResizing=!0:i.target.className=="taskbarresizer-right e-icon"||i.target.className=="taskbarresizer-right e-icon gripper"?r._rightResizing=!0:i.target.className=="progressbarhandler e-progresshandle"||i.target.className=="e-progresshandler-element"||i.target.className=="e-progresshandlerafter-element"||i.target.className=="progressbarresizer-right"?r._progressResizing=!0:(i.target.className=="e-gantt-childtaskbar-progress progressbar"||i.target.className=="e-tasklabel"||i.target.className=="e-gantt-childtaskbar"||i.target.className=="e-gantt-milestone milestone-top"||i.target.className=="e-gantt-milestone milestone-bottom"||n(i.target).hasClass("e-gantt-milestone")||n(i.target).closest(".e-gantt-milestone").length>0||n(i.target).closest(".e-gantt-childtaskbar").length>0)&&(r._allowDragging=!0)),r.model.enablePredecessorEditing&&(i.target.style.cursor=="pointer"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container")||n(u).hasClass("e-parentContainer"))||i.type=="touchstart"&&(i.target.className=="e-connectorpoint-right"||i.target.className=="e-connectorpoint-left"||i.target.className=="e-connectorpoint-right e-connectorpoint-hover"||i.target.className=="e-connectorpoint-left e-connectorpoint-hover"))&&(r._updateEditingType(),r._editPredecessor=!0,f.hasClass("e-connectorpoint-left")||f.hasClass("e-connectorpoint-left e-connectorpoint-hover")?r._prevItem.predecessorTarget="Start":(f.hasClass("e-connectorpoint-right")||f.hasClass("e-connectorpoint-right e-connectorpoint-hover"))&&(r._prevItem.predecessorTarget="Finish")),i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(r._posX1=r._currMousePosX=i.originalEvent.pageX,r._posY1=r._currMousePosY=i.originalEvent.pageY,r.dragPosX=i.originalEvent.pageX):i.originalEvent.clientX||i.originalEvent.clientY?(r._posX1=r.dragPosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,r._posY1=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(r._posX1=r._currMousePosX=i.originalEvent.changedTouches[0].pageX,r._posY1=r._currMousePosY=i.originalEvent.changedTouches[0].pageY,r.dragPosX=i.originalEvent.changedTouches[0].pageX),r._prevItem.left=e.left,r._prevItem.status=e.status,r._prevItem.duration=e.duration,r._prevItem.startDate=e.startDate,r._prevItem.endDate=e.endDate,r._prevItem.width=e.width,r._parentCollectionPreviousValues=r._getParentCollectionPreviousValues(e),r.model.enablePredecessorEditing&&(r._connectorPointX=r._currMousePosX-r._$bodyContent.offset().left,r._connectorPointY=r._currMousePosY-r._$bodyContent.offset().top),n(r._$bodyContainer).bind("mousemove",n.proxy(r.handleMouseMove,r))),r._appendTooltip(f,c),r._trigger("clearColumnMenu"))},_getParentCollectionPreviousValues:function(n){var r=n,i={},u=[];do parentItem=r.parentItem,t.isNullOrUndefined(parentItem)||(i.left=parentItem.left,i.status=parentItem.status,i.duration=parentItem.duration,i.startDate=parentItem.startDate,i.endDate=parentItem.endDate,i.width=parentItem.width,i.index=parentItem.index,i.isAutoSchedule||(i.manualLeft=parentItem.manualLeft,i.manualStartDate=parentItem.manualStartDate,i.manualEndDate=parentItem.manualEndDate,i.manualDuration=parentItem.manualDuration),u.push(i),r=parentItem,i={});while(r.parentItem);return u},handleMouseMove:function(n){this._updateOnmouseMove(n)},_handleMouseUp:function(i){var r=this,u={},p=r.getGanttChartRows(),a,c,v=0,f,w=r._posX1,b=r._posY1,o,s,y,l,e,h;t.isNullOrUndefined(i.pageX)?(o=i.originalEvent.changedTouches[0].pageX,s=i.originalEvent.changedTouches[0].pageY,t.isNullOrUndefined(r._predecessorTooltip)||(i.target=document.elementFromPoint(o,s))):(o=i.pageX,s=i.pageY);(n(i.target).hasClass("e-connectorpoint-left")||n(i.target).hasClass("e-connectorpoint-right")||n(i.target).hasClass("e-connectortouchpoint"))&&r._falseLine&&!n(i.target).parent().hasClass("e-parentContainer")&&(r._trigger("cancelEditCell"),n(i.target).hasClass("e-connectortouchpoint")&&(i.target=n(i.target).parent()),e=r._secondMouseOverConnectorPoint(i,!0),u.currentRecord=e.currentRecord,u.fromItem=e.fromItem,u.toItem=e.toItem,u.predecessor=e.predecessor,u.predecessorString=e.predecessorString,u.requestType="validatePredecessor",r._trigger("actionBegin",u)||e.predecessorValidation&&(e.requestType="drawConnectorLine",r._completeAction(e)));r._editingTarget!=null&&r._editingItem!=null&&(a=r._editingTarget,c=a.closest("tr.e-ganttrowcell"),v=p.index(c),f=r._editingItem,n(c).hasClass("e-editmode")&&(n(c).removeClass("e-editmode"),r._mouseTarget=null));n("#ganttviewerbodyContianer"+r._id).unbind("mousemove");r._mouseDown=!1;r._clearTooltip();w!=o||b!=s?(r._editingTarget=null,r._editingItem=null,r._$ganttChartContainer[0].style.cursor="auto",f!=null&&(r._allowDragging||r._leftResizing||r._rightResizing||r._progressResizing)&&(u.editingFields={startdate:f.startDate,enddate:f.endDate,progress:f.status,duration:f.duration,durationunit:f.durationUnit},u.data=f,u.previousData=r._prevItem,u.dragging=r._allowDragging,u.leftResizing=r._leftResizing,u.rightResizing=r._rightResizing,u.progressResizing=r._progressResizing,r._taskbarEdited(u)),u.cancel&&(r._getPrevItem(f,v),f.parentItem&&r._getParentPreviousValue(),r.model.predecessorMapping&&(u.dragging||u.rightResizing||u.leftResizing)&&(u.requestType="updateConnectors",u.ganttRecord=f,r._trigger("actionComplete",u))),r._updateEditingType(),r._falseLine&&r._falseLine.remove(),r._falseLine=null,r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,n(r._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),n(r._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),r._leftConnectorPoint=null,r._rightConnectorPoint=null,r._childRightConnectorPoint=null,r._childLeftConnectorPoint=null,r._trigger("clearColumnMenu")):(r._newXYPos=!1,r._$ganttChartContainer[0].style.cursor="auto",r._allowDragging=!1,r._falseLine&&r._falseLine.remove(),r._falseLine=null,f&&r.model.enableTaskbarTooltip&&(r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,y={ttipstartDate:this._getFormatedDate(f.startDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(f.endDate,this.model.dateFormat,this.model.locale),ttipduration:f.duration,ttipprogress:f.status.toString(),ttiptaskname:f.taskName,ttipdurationunit:f.durationUnit},l=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),r.model.tooltipTemplate||r.model.tooltipTemplateId?r.model.tooltipTemplate?(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="Template",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](f),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)):r.model.tooltipTemplateId&&(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="TemplateID",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](f),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)):(r.tooltipState="",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](y),{},{}),l.append(h),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",l,{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r._mouseHoverTooltip.innerHTML="<table>"+l[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)),n(r._mouseHoverTooltip).addClass("customTooltip"),r._trigger("clearColumnMenu")));i.type=="touchend"&&n(".e-connectortouchpoint").removeClass("e-enableconnectortouchpoint")},getChildCount:function(n,t){var r,u=this,i;if(!n.hasChildRecords)return 0;for(i=0;i<n.childRecords.length;i++)r=n.childRecords[i],t++,r.hasChildRecords&&(t=u.getChildCount(r,t));return t},criticalDataMapping:function(n,i,r,u){i==!0&&(this.model.isCriticalPathEnable=!0,t.isNullOrUndefined(n)||(this.model.criticalPathCollection=n,this.model.detailPredecessorCollection=r,this.collectionTaskId=u));i==!1&&(this.model.isCriticalPathEnable=!1)},criticalPathColor:function(n,i,r,u){i==!0&&(t.isNullOrUndefined(n)||(this._refresh(),t.isNullOrUndefined(r)||this.criticalConnectorLine(n,r,!0,u)));i==!1&&(this.criticalConnectorLine(n,r,!1,u),this._refresh())},criticalConnectorLine:function(n,t,i,r){var e,u,o,f,s,h;if(i==!1)this.element.find(".e-line").removeClass("e-criticalconnectorline"),this.element.find(".connectorline-rightarrow").removeClass("e-criticalconnectorlinerightarrow"),this.element.find(".connectorline-leftarrow").removeClass("e-criticalconnectorlineleftarrow");else if(t.length!=0)for(e=0,o=[],s=0;s<this.model.criticalPathCollection.length;s++)if(e=r.indexOf(this.model.criticalPathCollection[s]),u=t[e],e!=-1&&u.to)for(o=u.to.split(","),h=0;h<o.length;h++)f=parseInt(o[h]),n.indexOf(f)!=-1&&(this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".e-line").addClass("e-criticalconnectorline"),this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".connectorline-rightarrow").addClass("e-criticalconnectorlinerightarrow"),this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".connectorline-leftarrow").addClass("e-criticalconnectorlineleftarrow"))},_getCollapsedParentItem:function(n){var t=n.parentItem;return t?this._getExpandStatus(t)===!0?t:this._getCollapsedParentItem(t):null},updateScrollBar:function(){var n=this,t=n.model,u,r,f,s,e;if(r=n.getExpandedRecords(t.updatedRecords),f=r.indexOf(t.selectedItem),t.selectedItem&&f!=-1){var i=f*t.rowHeight,h=i+t.rowHeight,o,c=n._$bodyContainer.children(".e-content").length;o=c?n._$bodyContainer.children(".e-content").scrollTop():n._$bodyContainer.scrollTop();(n._$bodyContainer.ejScroller("isHScroll")||n.element.find(".e-borderbox").length>0)&&(u=18);s=i<o;e=o+n._viewportHeight-u<h;(s||e)&&(i+n._viewportHeight>r.length*t.rowHeight&&(i=r.length*t.rowHeight-n._viewportHeight,e&&(i+=u)),n._$bodyContainer.ejScroller("scrollY",i,!0),t.enableVirtualization&&n.focusGanttElement())}},getExpandedRecords:function(n){var t=this;return n.filter(function(n){return t._getExpandStatus(n)==!0})},_keyPressed:function(n,t,i,r){var u=this,f=this.model,e,s=f.updatedRecords,l=u.getExpandedRecords(s),c;if(r.stopImmediatePropagation(),r.preventDefault(),!f.allowKeyboardNavigation)return!0;switch(n){case"downArrow":s.length>0&&f.selectedItem&&(lastRowIndex=s.length-1,f.selectedRowIndex!=lastRowIndex&&(e=l.indexOf(f.selectedItem),c=l[e+1],e=s.indexOf(c),c&&e<=lastRowIndex&&!u._rowSelectingEventTrigger(f.selectedRowIndex,e)&&(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(f.selectedRowIndex))));break;case"upArrow":f.selectedRowIndex!==0&&s.length>0&&f.selectedItem&&(e=l.indexOf(f.selectedItem),c=l[e-1],e=s.indexOf(c),u._rowSelectingEventTrigger(f.selectedRowIndex,e)||(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(f.selectedRowIndex)));break;case"firstRowSelection":s.length>0&&(u._rowSelectingEventTrigger(f.selectedRowIndex,0)||(u.selectRows(0),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(0)));break;case"lastRowSelection":s.length>0&&(lastRowIndex=l.length-1,c=l[lastRowIndex],e=s.indexOf(c),u._rowSelectingEventTrigger(f.selectedRowIndex,e)||(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(e)));break;case"rightArrow":var a=u.model.selectedRowIndex,h=u.model.updatedRecords[a],o={},v;o.data=h;o.recordIndex=a;o.expanded=!0;h&&(u._rowSelectingEventTrigger()||!h.hasChildRecords||h.expanded||(a>=0&&(v=u._trigger("expanding",o)),f.enableVirtualization&&u.focusGanttElement()));break;case"leftArrow":var a=u.model.selectedRowIndex,h=u.model.updatedRecords[a],o={},v;o.data=h;o.recordIndex=a;o.expanded=!1;h&&!u._rowSelectingEventTrigger()&&h.hasChildRecords&&h.expanded&&(a>=0&&u._trigger("collapsing",o),f.enableVirtualization&&u.focusGanttElement());break;case"deleteRecord":f.editSettings.allowDeleting&&f.selectedRowIndex>=0&&(u._trigger("deleteRow"),u.focusGanttElement());break;case"totalRowCollapse":o={};o.requestType="collapseAll";u._trigger("expandAllCollapseAllRequest",o);break;case"totalRowExpand":o={};o.requestType="expandAll";u._trigger("expandAllCollapseAllRequest",o)}return!0},_rowSelectingEventTrigger:function(n,t){var r=this,u=r.model,i={};if(u.selectionMode=="row")return i.previousIndex=n,i.recordIndex=t,r._trigger("rowSelecting",i)},_rowSelectedEventTrigger:function(n){var t=this,i;t.model.selectionMode=="row"&&(i={data:t.model.selectedItem,target:"ejGanttChart",recordIndex:n},t._trigger("rowSelected",i))},_updateEditingType:function(){var n=this;n._leftResizing=!1;n._allowDragging=!1;n._rightResizing=!1;n._progressResizing=!1;n._editPredecessor=!1},_getHolidaysCount:function(n,t){for(var u=this,r=this.model.holidays,f=0,i=0;i<r.length;i++)u._getDateFromFormat(r[i].day)>=n&&u._getDateFromFormat(r[i].day)<=t&&(f+=1);return f},updateConnectorLineOffset:function(n){var u,a=this.model,i=n.predecessor,v=[],o,s,h,c,l=a.includeWeekend,r,f,t,e;if(i){for(t=0;t<i.length;t++)i[t].to===n.taskId.toString()&&(u=a.flatRecords[a.ids.indexOf(i[t].from)],r=a.flatRecords[a.ids.indexOf(i[t].to)],o=new Date(u.startDate),s=new Date(u.endDate),h=new Date(r.startDate),c=new Date(r.endDate),i[t].predecessorsType=="FS"&&(r.left<u.left+u.width?(f=(u.left+u.width-r.left)/this.model.perDayWidth,f=r.isMilestone==!0?f-1:f,i[t].offset=Math.round(-f)):r.left>u.left+u.width?(f=(r.left-(u.left+u.width))/this.model.perDayWidth,f>=0&&(i[t].offset=Math.round(f))):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(s,new Date(h)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(s,h)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(h),s),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(h,s))),i[t].predecessorsType=="SS"&&(r.left<u.left?(f=(u.left-r.left)/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left>u.left?(f=(r.left-u.left)/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(o,new Date(h)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(o,h)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(h),o),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(h,o))),i[t].predecessorsType=="SF"&&(r.left+r.width<u.left?(f=(u.left-(r.left+r.width))/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left+r.width>u.left?(f=(r.left+r.width-u.left)/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(o,new Date(c)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(o,c)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(c),o),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(c,o))),i[t].predecessorsType=="FF"&&(r.left+r.width<u.left+u.width?(f=(u.left+u.width-(r.left+r.width))/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left+r.width>u.left+u.width?(f=(r.left+r.width-(u.left+u.width))/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(s,new Date(c)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(s,c)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(c),s),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(c,s))),i[t].offset<0?v.push(i[t].from+""+i[t].predecessorsType+""+i[t].offset+"d"):i[t].offset>=1?v.push(i[t].from+""+i[t].predecessorsType+"+"+i[t].offset+"d"):v.push(i[t].from+""+i[t].predecessorsType));v.length>0&&(n.item[a.predecessorMapping]=v.join(","))}},_calculateWeekendDays:function(n,t){var i=0;for(n=new Date(n);n<t;)n.setDate(n.getDate()+1),(n.getDay()===0||n.getDay()==6)&&++i;return i},_getPrevItem:function(n,t){var i=this,r;n.left=i._prevItem.left;n.width=i._prevItem.width;n.startDate=i._prevItem.startDate;n.endDate=i._prevItem.endDate;n.duration=i._prevItem.duration;n.status=i._prevItem.status;n.progressWidth=this._getProgressWidth(n.width,n.status);this.refreshRow(t);r={};r.index=t;this._refreshRow(r)},_getParentPreviousValue:function(){for(var u,i=this,n,t,f=i.model,e=i._parentCollectionPreviousValues.length,r=0;r<e;r++)n=i._parentCollectionPreviousValues[r],t=n.index,parentItem=f.updatedRecords[t],parentItem.left=n.left,parentItem.width=n.width,parentItem.startDate=n.startDate,parentItem.endDate=n.endDate,parentItem.duration=n.duration,parentItem.status=n.status,parentItem.progressWidth=this._getProgressWidth(parentItem.width,parentItem.status),this.refreshRow(t),u={},u.index=t,this._refreshRow(u)},_enableLeftResizing:function(i,r){var u=this,o=this.model,f=o.scheduleHeaderSettings.scheduleHeaderType,e=t.Gantt.ScheduleHeaderType;i.target.style.cursor="e-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.left-=u._mousePosX,r.width+=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.left+30<r.left+r.width&&r.left+u._mousePosX<=this._prevItem.left+this._prevItem.width&&(r.left+=u._mousePosX,r.width-=u._mousePosX));this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.width=f==e.Day?r.width<u.model.perHourWidth?u.model.perHourWidth:r.width:f==e.Hour?r.width<u.model.perMinuteWidth?u.model.perMinuteWidth:r.width:r.width<u.model.perDayWidth?u.model.perDayWidth:r.width;r.progressWidth=u._getProgressWidth(r.width,r.status);r.left=this._prevItem.left+this._prevItem.width-r.width;u._setItemPosition(r)},_enableProgressResizing:function(i,r){var u=this,f,e;i.target.style.cursor="col-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u._progressResizer&&(u._progressHandle=u._progressResizer&&u._progressResizer.firstChild,u._progressHandleChild=u._progressResizer&&u._progressResizer.childNodes[1]);u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.progressWidth-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.progressWidth+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.progressWidth=r.progressWidth>r.width?r.width:r.progressWidth;r.progressWidth=r.progressWidth<0?0:r.progressWidth;f=r.width-r.progressWidth;e=f<=4?4-f:0;n(u._progressbarItem).css({width:r.progressWidth+"px","border-top-right-radius":e+"px","border-bottom-right-radius":e+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._progressHandle).addClass("e-progresshandle");n(u._progressHandleChild).addClass("e-progresshandleafter")},_enableRightResizing:function(i,r){var u=this,f=this.model;i.target.style.cursor="w-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.width-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.width+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.width=f.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Day?r.width<u.model.perHourWidth?u.model.perHourWidth:r.width:f.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Hour?r.width<u.model.perMinuteWidth?u.model.perMinuteWidth:r.width:r.width<u.model.perDayWidth?u.model.perDayWidth:r.width;r.hasChildRecords?n(u._manualRightResizer).css({left:r.width-parseInt(u._manualRightResizer.style.borderRightWidth.replace("px",""))+"px"}):(r.progressWidth=u._getProgressWidth(r.width,r.status),n(u._tasknameContainer).css({left:r.left+"px",width:r.width+"px"}));n(u._taskbarItem).css({left:r.left+"px",width:r.width+"px"});n(u._progressbarItem).css({width:r.progressWidth+"px"});n(u._rightResizer).css({left:r.left+r.width-u._resizerRightAdjust+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._leftConnectorPoint).css({left:r.left-u._connectorPointWidth+"px"});n(u._rightConnectorPoint).css({left:r.left+r.width+"px"})},_enableDragging:function(i,r){var u=this;i.target.style.cursor="move";n(i.target.parentNode).hasClass("e-parentContainer")&&(u._allowExpandCollapse=!1);this.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.left-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.left+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.left=r.left<0?0:r.left;n(u._taskbarItem).css({left:r.left+"px"});n(u._rightResizer).css({left:r.left+r.width-u._resizerRightAdjust+"px"});n(u._leftResizer).css({left:r.left+2+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._tasknameContainer).css({left:r.left+"px",width:r.width+"px"});n(u._leftConnectorPoint).css({left:r.left-u._connectorPointWidth+"px"});n(u._rightConnectorPoint).css({left:r.left+r.width+"px"})},_appendTooltip:function(i,r){var u=this,h,o,l=n(i),s=this.model,e=u.model.currentViewData[r],p=u.model.columnHeaderTexts,a=u.model.predecessorEditingTexts,c,v,y,f;e!=null&&(c=l[0],n(l[0]).hasClass("progressbarresizer-right")&&(c=l.closest(".e-childContainer")[0]),(n(c).hasClass("e-parentContainer")||n(c).hasClass("e-childContainer"))&&(u._editingContainer=c,u._leftResizer=u._editingContainer.querySelector(".e-connectorpoint-left"),u._taskbarItem=u._editingContainer.querySelector(".taskbarresizer-left"),u._progressbarItem=u._editingContainer.querySelector(".e-gantt-childtaskbar"),u._progressResizer=u._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),u._rightResizer=u._editingContainer.querySelector(".progressbarresizer-right")),this.model.enableTaskbarDragTooltip&&!l.hasClass("e-parentContainer")&&(this._progressResizing==!0?(u._$ganttChartContainer[0].style.cursor="col-resize",o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),f=t.buildTag("tbody","",{},{}),f[0].innerHTML="<tr><td>"+p.status+" : "+e.status+"%<\/td><\/tr>",o.append(f),u.model.progressbarTooltipTemplate?(u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),f=t.buildTag("tbody",n.render[u._id+"progressbarTooltipTemplate"](e),{},{}),u._progressBarTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u.model.progressbarTooltipTemplateId?(u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),f=t.buildTag("tbody",n.render[u._id+"progressbarTooltipTemplate"](e),{},{}),u._progressBarTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"",o,{position:"absolute","z-index":u._getMaxZIndex()+1},{onselectstart:"return false"}),u._progressBarTooltipID&&(n(document.body).append(u._progressBarTooltipID),u._updateTooltipPosition(u._progressBarTooltipID,u._currMousePosX,u._currMousePosY,!0))):this._editPredecessor===!0&&u.model.enablePredecessorEditing?(v=s.predecessorText,u._predecessorTooltip===null&&(u._predecessorTooltip=t.buildTag("div.e-tooltipganttpredecessor#predecessortooltip"+u._id+"","",{top:u._currMousePosY+10+"px",left:u._currMousePosX+10+"px",position:"absolute","z-index":u._getMaxZIndex()+1},{onselectstart:"return false"}),o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),f=t.buildTag("tbody","",{},{}),y="<tr><td class='e-predecessor-false'><\/td><td >"+a.fromText+":<\/td><td class='e-tooltiptaskname'>"+e.taskName+"<\/td><td>"+v[u._prevItem.predecessorTarget]+"<\/td> <\/tr><tr><td><\/td><td>"+a.toText+":<\/td><td class='e-tooltiptaskname'><\/td><td><\/td><\/tr>",n(f).html(y),o.append(f),u._predecessorTooltip.append(o),n(document.body).append(u._predecessorTooltip),u._updateTooltipPosition(u._predecessorTooltip,u._currMousePosX,u._currMousePosY))):(u._leftResizing==!0||u._rightResizing==!0||u._allowDragging==!0)&&(u._leftResizing==!0?(u._$ganttChartContainer[0].style.cursor="e-resize",h={ttipstartDate:this._getFormatedDate(e.startDate,s.dateFormat,s.locale),ttipduration:e.duration,ttipdurationunit:e.durationUnit}):u._rightResizing==!0?(u._$ganttChartContainer[0].style.cursor="w-resize",h={ttipendDate:this._getFormatedDate(e.endDate,s.dateFormat,s.locale),ttipduration:e.duration,ttipdurationunit:e.durationUnit}):u._allowDragging==!0&&(u._$ganttChartContainer[0].style.cursor="move",h={ttipstartDate:this._getFormatedDate(e.startDate,s.dateFormat,s.locale),ttipendDate:this._getFormatedDate(e.endDate,s.dateFormat,s.locale)}),o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),u.model.taskbarEditingTooltipTemplate?(u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),u.tooltipState="editingTemplateID",f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](e),{},{}),u._taskbarEditingTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u.model.taskbarEditingTooltipTemplateId?(u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),u.tooltipState="editingTemplate",f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](e),{},{}),u._taskbarEditingTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):(u.tooltipState="",h&&(f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](h),{},{}),o.append(f)),u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"",o,{position:"absolute","z-index":u._getMaxZIndex()+1},{})),u._taskbarEditingTooltipID&&(n(document.body).append(u._taskbarEditingTooltipID),u._updateTooltipPosition(u._taskbarEditingTooltipID,u._currMousePosX,u._currMousePosY,!0)))))},_setItemPosition:function(t){var i=this;n(i._leftResizer).css({left:t.left+2+"px"});n(i._rightResizer).css({left:t.left+t.width-i._resizerRightAdjust+"px"});n(i._taskbarItem).css({left:t.left+"px",width:t.width+"px"});n(i._progressbarItem).css({width:t.progressWidth+"px"});n(i._progressResizer).css({left:t.left+t.progressWidth-10+"px"});n(i._tasknameContainer).css({left:t.left+"px",width:t.width+"px"});n(i._leftConnectorPoint).css({left:t.left-i._connectorPointWidth+"px"});n(i._rightConnectorPoint).css({left:t.left+t.width+"px"})},_getTemplate:function(t){var i,r;return typeof t!="object"?(i=n.parseHTML(this.model.tooltipTemplate),i[0]):(r=n(t)[0].innerHTML,i=n.parseHTML(r),i[1])},_updateOnmouseMove:function(i){var r=this,o={},s,e=r._editingTarget?r._editingTarget:null,c=r.getGanttChartRows(),h=e?e.closest("tr.e-ganttrowcell"):null,l=c.index(h),u=r._editingItem,f=e?e[0].parentNode:null;r._newXYPos=!0;f=n(f).hasClass("progressbarresizer-right")?f.parentNode:n(f).hasClass("e-gantt-childtaskbar-progress")?n(f).closest("div.e-childContainer")[0]:n(f).hasClass("progressbarhandler")?e.closest(".e-childContainer")[0]:n(f).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0];u!=null&&(r._trigger("cancelEditCell"),o.editingFields={startdate:u.startDate,enddate:u.endDate,progress:u.status,duration:u.duration,durationunit:u.durationUnit},o.rowData={rowData:u},r._taskbarEditing(o),o.cancel||(i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(r._mousePosX=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(r._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(r._mousePosX=i.originalEvent.targetTouches[0].pageX,s=i.originalEvent.targetTouches[0].pageY),e.hasClass("e-gantt-milestone")||n(f).hasClass("e-gantt-milestone")?n(h).hasClass("e-editmode")&&this._editMilestone(i):(n(f).hasClass("e-childContainer")?(r._editingContainer=f,r._leftResizer=r._editingContainer.querySelector(".taskbarresizer-left"),r._taskbarItem=r._editingContainer.querySelector(".e-gantt-childtaskbar"),r._progressbarItem=r._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),r._progressResizer=r._editingContainer.querySelector(".progressbarresizer-right"),r._rightResizer=r._editingContainer.querySelector(".taskbarresizer-right"),r.model.predecessorMapping&&r.model.enablePredecessorEditing&&(r._leftConnectorPoint=f.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=f.querySelector(".e-connectorpoint-right"),r.model.allowGanttChartEditing&&(n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")))):n(f).hasClass("e-parentContainer")&&!u.isAutoSchedule&&(r._editingContainer=f,r._taskbarItem=r._editingContainer.querySelector(".e-gantt-manualparenttaskbar"),r._rightResizer=r._editingContainer.querySelector(".taskbarresizer-right"),r._manualRightResizer=r._editingContainer.querySelector(".e-gantt-manualparenttaskbar-right")),n(h).hasClass("e-editmode")&&(n(e[0]).closest("e-gantt-manualparenttaskbar")||n(f).hasClass("e-gantt-milestone-container")||n(f).hasClass("e-childContainer"))&&(r._leftResizing==!0?(r._enableLeftResizing(i,u),r._updateEditedItem(u,"leftResizing")):r._progressResizing==!0&&r.model.enableProgressBarResizing&&r.model.progressMapping?((r._editingTarget.hasClass("e-progresshandlerafter-element")||r._editingTarget.hasClass("progressbarhandler e-progresshandle")||r._editingTarget.hasClass("e-progresshandler-element")||r._editingTarget.hasClass("progressbarresizer-right"))&&r._editingTarget.prev(".e-gantt-childtaskbar").find(".e-tasklabel").text(""),r._enableProgressResizing(i,u),r._updateEditedItem(u,"progressResizing")):r._rightResizing==!0?(r._enableRightResizing(i,u),r._updateEditedItem(u,"rightResizing")):r._allowDragging==!0?(r._enableDragging(i,u),r._updateEditedItem(u,"dragging")):r._editPredecessor==!0&&r._drawFalseLine(i,u))),r._clearTooltip(),r._appendTooltip(e,l)));t.isNullOrUndefined(i.pageX)&&i.type=="touchmove"&&r._predecessorTooltip&&(t.isNullOrUndefined(i.pageX)?(x2=i.originalEvent.changedTouches[0].pageX,y2=i.originalEvent.changedTouches[0].pageY,i.target=document.elementFromPoint(x2,y2)):(x2=i.pageX,y2=i.pageY),n(i.target).hasClass("e-connectorpoint-left")||n(i.target).hasClass("e-connectortouchpoint")?r._dragLeftOver(i):n(i.target).hasClass("e-connectorpoint-right")?r._dragRightOver(i):(r._mouseLeave(),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")))},_editMilestone:function(i){var r=this,f=r._editingTarget,e=f.hasClass("milestone-top")||f.hasClass("milestone-bottom")?f[0].parentNode:f.closest(".e-gantt-milestone"),o=r.getGanttChartRows(),s=f.closest("tr.e-ganttrowcell"),h=o.index(s),u=r._editingItem;u!=null&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?r._mousePosX=i.originalEvent.pageX:i.originalEvent.clientX||i.originalEvent.clientY?r._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft:(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(r._mousePosX=i.originalEvent.targetTouches[0].pageX,posy=i.originalEvent.targetTouches[0].pageY),i.target.style.cursor="move",r.dragPosX>r._mousePosX?(r._mousePosX=r.dragPosX-r._mousePosX,u.left>0&&(u.left-=r._mousePosX)):(r._mousePosX-=r.dragPosX,u.left+=r._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,u.left=u.left<0?0:u.left,n(e).css({left:u.left+"px"}),n(r._leftConnectorPoint).css({left:u.left-r._connectorPointWidth+"px"}),n(r._rightConnectorPoint).css({left:u.left+r._milesStoneWidth+"px"}),r._updateEditedItem(u,"dragging"),r._appendTooltip(f,h))},_updateEditedItem:function(n,i){var l=this,r=l.model,f=r.scheduleHeaderSettings.scheduleHeaderType,o=t.Gantt.ScheduleHeaderType,it=t.Gantt.DurationUnit,a=n._getFormatedDate(r.projectStartDate,r.dateFormat,r.locale),a=n._getDateFromFormat(a,r.dateFormat,r.locale),rt=n.startDate.getHours(),ut=n.startDate.getMinutes(),s,h,u,c,v,y,nt,tt,k,d,g,e;switch(i){case"dragging":if(s=n.left%r.perDayWidth,h=(n.left-s)/r.perDayWidth,u=s/r.perDayWidth,(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c=f==o.Day||f==o.Hour?24:r.secondsPerDay/3600,c&&u!=1)var p=1/c,w=u/p,b=Math.round(w*60);a=n._startDateUpdate(a,h,b,r.workingTimeRanges,f);n.startDate=new Date(a);e={};e.startDate=n.startDate;e.duration=n.duration;e.durationUnit=n.durationUnit;e.record=n;l._calculateEndDate(e);n.endDate=l._currentEditedRecord.endDate;r.startDateMapping&&(n.item[r.startDateMapping]=n.startDate);r.endDateMapping&&(n.item[r.endDateMapping]=n.endDate);break;case"leftResizing":if(nt="Resizing",s=n.left%r.perDayWidth,h=(n.left-s)/r.perDayWidth,u=s/r.perDayWidth,(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c=f==o.Day||f==o.Hour?24:r.secondsPerDay/3600,c&&u>0)var p=1/c,w=u/p,b=Math.round(w*60);a=n._startDateUpdate(a,h,b,r.workingTimeRanges,f);n.startDate=new Date(a);n.startDate.getTime()==n.endDate.getTime()&&t.isNullOrUndefined(n.isMilestone)&&n.isMilestone==!1&&n.duration==0&&(n.duration=1);e={};e.startDate=n.startDate;e.endDate=n.endDate;e.durationUnit=n.durationUnit;e.record=n;l._calculateDuration(e);n.duration=l._currentEditedRecord.duration;r.startDateMapping&&(n.item[r.startDateMapping]=n.startDate);r.durationMapping&&(n.item[r.durationMapping]=n.duration);break;case"rightResizing":if(nt="Resizing",f==o.Day||f==o.Hour?(tt=new Date(n.startDate),k=new Date(n.startDate),k.setHours(0,0,0,0),d=tt.getTime()-k.getTime(),g=d>0?n.width+d/864e5*r.perDayWidth:n.width,s=g%r.perDayWidth,h=(g-s)/r.perDayWidth,c=24):(s=n.width%r.perDayWidth,h=(n.width-s)/r.perDayWidth,c=r.secondsPerDay/3600),u=s/r.perDayWidth,v=new Date(n.startDate),(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c&&u>0)var p=1/c,w=u/p,b=Math.round(w*60);y=n._endDateUpdate(v,h-1,b,r.workingTimeRanges,f);n.endDate=new Date(y);e={};e.startDate=v;e.endDate=y;e.durationUnit=n.durationUnit;e.record=n;l._calculateDuration(e);n.duration=l._currentEditedRecord.duration;r.endDateMapping&&(n.item[r.endDateMapping]=n.endDate);r.durationMapping&&(n.item[r.durationMapping]=n.duration);break;case"progressResizing":n.status=l._getProgressPercent(n.width,n.progressWidth);r.progressMapping&&(n.item[r.progressMapping]=n.status)}},_calculateEndDate:function(n){var t=this;return t._trigger("calculateEndDate",n)},_calculateDuration:function(n){var t=this;return t._trigger("calculateDuration",n)},_drawFalseLine:function(n){var i=this,f=n.pageX,e=n.pageY,u=i._connectorPointX;y1=i._connectorPointY;t.isNullOrUndefined(n.pageX)?(x2=n.originalEvent.changedTouches[0].pageX-i._$bodyContent.offset().left,y2=n.originalEvent.changedTouches[0].pageY-i._$bodyContent.offset().top,f=Math.round(n.originalEvent.changedTouches[0].pageX),e=Math.round(n.originalEvent.changedTouches[0].pageY)):(x2=n.pageX-i._$bodyContent.offset().left,y2=n.pageY-i._$bodyContent.offset().top);var o=Math.sqrt((u-x2)*(u-x2)+(y1-y2)*(y1-y2)),s=Math.atan2(y2-y1,x2-u)*180/Math.PI,r="rotate("+s+"deg)";i._falseLine&&i._falseLine.remove();i._falseLine=t.buildTag("div.e-gantt-falseLine#ganttfalseline"+i._id,"",{},{});i._falseLine.css({"transform-origin":"0% 100%",right:"auto",position:"absolute",transform:r,"-ms-transform":r,"-moz-transform":r,"-webkit-transform":r,"-o-transform":r,"border-top-width":"2px","border-top-style":"dashed","z-index":"5"}).width(o-3).offset({left:u,top:y1});t.browserInfo().name=="msie"&&t.browserInfo().version<9||i._$bodyContent.append(i._falseLine);i._updateTooltipPosition(i._predecessorTooltip,f,e)},_mouseLeave:function(){var t=this;n(".progressbarresizer-right").css({"background-image":"none"});window.clearTimeout(t._tooltipTimer);t._clearTooltip();this._mouseDown==!1&&t._newXYPos?(n(t._leftResizerGripper).removeClass("gripper"),n(t._rightResizerGripper).removeClass("gripper"),t.model.progressMapping&&(n(t._progressHandle).removeClass("e-progresshandle"),n(t._progressHandleChild).removeClass("e-progresshandleafter")),t.model.predecessorMapping&&t.model.enablePredecessorEditing&&(n(t._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(t._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null)):t._mouseDown&&t._falseLine&&t.model.allowGanttChartEditing==!0&&t.model.enablePredecessorEditing&&t.model.readOnly==!1&&t._removeEditingElements()},_getMaxZIndex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==i||t==null)&&(t=1),t},_getOffsetRect:function(n){var r=n.getBoundingClientRect(),t=document.body,i=document.documentElement,u=window.pageYOffset||i.scrollTop||t.scrollTop,f=window.pageXOffset||i.scrollLeft||t.scrollLeft,e=i.clientTop||t.clientTop||0,o=i.clientLeft||t.clientLeft||0,s=r.top+u-e,h=r.left+f-o;return{top:Math.round(s),left:Math.round(h)}},_updateTooltipPosition:function(n,t,i,r){if(n&&n.length>0){var u=this,e=u._getOffsetRect(u._$bodyContainer[0]),o=e.top+u._$bodyContainer.height(),s=e.left+u._$bodyContainer.width(),h=u.model.rowHeight,f=0;t+n.width()+30>s?(f=t-n.width()-30,n.css("left",f+"px")):r?n.css("left",t+"px"):n.css("left",t+15+"px");r||i+n.height()+30>o?(f=r?i-n.height()-h:i-n.height()-30,n.css("top",f+"px")):n.css("top",i+10+"px")}},_mouseHover:function(i){var e=n(i.target),r=this,o=0,s=0,y=r.getGanttChartRows(),p=e.closest("tr.e-ganttrowcell"),f=e[0].parentNode,c,w=y.index(p),u=r.model.currentViewData[w],v,l,a,h;if(i.target.className=="e-parentContainer"||i.target.className=="e-gantt-milestone-container"||i.target.className=="e-childContainer")return!0;f=n(f).hasClass("e-gantt-childtaskbar-progress")?n(f).closest("div.e-childContainer")[0]:e.hasClass("e-tasklabel")?e.closest(".e-childContainer")[0]:n(f).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0];r._clearTooltip();r._newXYPos||(r._newXYPos=!0,r._mouseLeave());r._rightResizing==!1&&r._leftResizing==!1&&r._progressResizing==!1&&r._mouseDown==!1&&(r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(e.is(".e-gantt-childtaskbar,.e-tasklabel, .e-gantt-manualparenttaskbar")||e.closest(".e-gantt-childtaskbar").length)&&(i.target.style.cursor="move"),(i.type=="mouseenter"||i.type=="mousemove"||i.type=="touchstart")&&(i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(o=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(o=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(o=i.originalEvent.changedTouches[0].pageX,s=i.originalEvent.changedTouches[0].pageY),r._posX1=o,r._posY1=s,n(f).hasClass("e-childContainer")&&r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(r._leftResizerGripper=f.querySelector(".taskbarresizer-left"),r._rightResizerGripper=f.querySelector(".taskbarresizer-right"),c=f.querySelector(".progressbarresizer-right"),r._progressHandle=c&&c.firstChild,r._progressHandleChild=c&&c.childNodes[1],n(r._leftResizerGripper).addClass("gripper"),n(r._rightResizerGripper).addClass("gripper"),r.model.progressMapping&&r.model.enableProgressBarResizing&&(n(r._progressHandle).addClass("e-progresshandle"),n(r._progressHandleChild).addClass("e-progresshandleafter"))),(n(f).hasClass("e-childContainer")||n(f).hasClass("e-parentContainer"))&&r.model.predecessorMapping&&r.model.allowGanttChartEditing&&r.model.enablePredecessorEditing&&r.model.readOnly==!1?(r._leftConnectorPoint=f.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=f.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover"),n(f).hasClass("e-parentContainer")&&!u.isAutoSchedule&&(n(r._leftConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"))):(n(f).hasClass("e-gantt-milestone")||n(f).hasClass("e-gantt-milestone-container"))&&r.model.predecessorMapping&&r.model.allowGanttChartEditing&&r.model.enablePredecessorEditing&&r.model.readOnly==!1&&(a=f.parentNode,r._leftConnectorPoint=a.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=a.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")),u&&r.model.enableTaskbarTooltip&&!t.isTouchDevice()&&!n(e).hasClass("e-connectorpoint-hover")&&(r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,v=(n(e).hasClass("e-gantt-parenttaskbar-innerdiv")||n(e[0].parentNode).hasClass("e-gantt-parenttaskbar-innerdiv"))&&!u.isAutoSchedule?{ttipscheduleStartDate:this._getFormatedDate(u.manualStartDate,this.model.dateFormat,this.model.locale),ttipscheduleEndDate:this._getFormatedDate(u.manualEndDate,this.model.dateFormat,this.model.locale),ttipduration:u.manualDuration,ttipprogress:u.status.toString(),ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit}:n(e).hasClass("e-gantt-manualparenttaskbar")||n(e).hasClass("e-gantt-manualparenttaskbar-left")||n(e).hasClass("e-gantt-manualparenttaskbar-right")&&!u.isAutoSchedule?{ttipstartDate:this._getFormatedDate(u.startDate,this.model.dateFormat,this.model.locale),ttipsubtaskStartDate:this._getFormatedDate(u.manualStartDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(u.endDate,this.model.dateFormat,this.model.locale),ttipsubtaskEndDate:this._getFormatedDate(u.manualEndDate,this.model.dateFormat,this.model.locale),ttipduration:u.duration,ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit}:{ttipstartDate:this._getFormatedDate(u.startDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(u.endDate,this.model.dateFormat,this.model.locale),ttipduration:u.duration,ttipprogress:u.status.toString(),ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit},l=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),r.model.tooltipTemplate||r.model.tooltipTemplateId?r.model.tooltipTemplate?(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="Template",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](u),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)):r.model.tooltipTemplateId&&(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="TemplateID",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](u),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)):(r.tooltipState="",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](v),{},{}),l.append(h),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",l,{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r._mouseHoverTooltip.innerHTML="<table>"+l[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)),n(r._mouseHoverTooltip).addClass("customTooltip"))))},_createEditingTooltipTemplate:function(){var t=this,f,r=t.model.columnHeaderTexts,h=t.model.durationUnitTexts,e={_getStartDate:t._tooltipStartDate,_getEndDate:t._tooltipEndDate,_getTaskName:t._tooltipTaskName,_getProgress:t._tooltipProgress,_checkDuration:t._checkDuration},o=t.model.taskbarEditingTooltipTemplateId,s=t.model.taskbarEditingTooltipTemplate,i,u;e["_"+t._id+"getDuration"]=n.proxy(t._tooltipDuration,t);n.views.helpers(e);o?i=n("#"+o)[0].innerHTML:s?i=s:(i="<tr class='e-tooltip_rowcell'>",f="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='width:40px;text-align:left;' colspan='3';>{{:ttiptaskname}}<\/td>{{/if}}<\/tr><tr>{{if ~_getStartDate()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.startDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipstartDate}}<\/td> {{/if}}<\/tr><tr>{{if ~_getEndDate()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.endDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipendDate}}<\/td>{{/if}}<\/tr><tr>{{if ~_checkDuration()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.duration+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:~_"+t._id+"getDuration(#data)}}<\/td>{{/if}}<\/tr><tr>{{if ~_getProgress()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.status+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipprogress}}%<\/td>{{/if}}",i+=f,i+="<\/tr>");u={};u[t._id+"editingTooltipTemplate"]=i;n.templates(u)},_createProgressbarTooltipTemplate:function(){var t=this,u=t.model.progressbarTooltipTemplateId,f=t.model.progressbarTooltipTemplate,i,r;u?i=n("#"+t.model.progressbarTooltipTemplateId)[0].innerHTML:t.model.progressbarTooltipTemplate&&(i=t.model.progressbarTooltipTemplate);r={};r[t._id+"progressbarTooltipTemplate"]=i;n.templates(r)},_createTooltipTemplate:function(){var t=this,f,i=t.model.columnHeaderTexts,s=t.model.durationUnitTexts,e={_getStartDate:t._tooltipStartDate,_getSubtaskStartDate:t._tooltipSubtaskStartDate,_getScheduleStartDate:t._tooltipScheduleStartDate,_getEndDate:t._tooltipEndDate,_getSubtaskEndDate:t._tooltipSubtaskEndDate,_getScheduleEndDate:t._tooltipScheduleEndDate,_getTaskName:t._tooltipTaskName,_getProgress:t._tooltipProgress,_checkDuration:t._checkDuration},o=t.model.tooltipTemplateId,h=t.model.tooltipTemplate,r,u;e["_"+t._id+"getDuration"]=n.proxy(t._tooltipDuration,t);n.views.helpers(e);o?r=n("#"+t.model.tooltipTemplateId)[0].innerHTML:t.model.tooltipTemplate?r=t.model.tooltipTemplate:(r="<tr class='e-tooltip_rowcell'>",f="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='width:40px;text-align:left;' colspan='3';>{{:ttiptaskname}}<\/td>{{/if}}<\/tr>{{if ~_getStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.startDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipstartDate}}<\/td> {{/if}}<\/tr>{{if ~_getSubtaskStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.subTasksStartDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipsubtaskStartDate}}<\/td><\/tr>{{/if}}{{if ~_getScheduleStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.scheduleStartDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipscheduleStartDate}}<\/td><\/tr>{{/if}}{{if ~_getEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.endDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipendDate}}<\/td>{{/if}}<\/tr>{{if ~_getSubtaskEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.subTasksEndDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipsubtaskEndDate}}<\/td><\/tr>{{/if}}{{if ~_getScheduleEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.scheduleEndDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipscheduleEndDate}}<\/td><\/tr>{{/if}}{{if ~_checkDuration()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.duration+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:~_"+t._id+"getDuration(#data)}}<\/td>{{/if}}<\/tr>{{if ~_getProgress()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.status+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipprogress}}%<\/td>{{/if}}",r+=f,r+="<\/tr>");u={};u[t._id+"tooltipTemplate"]=r;n.templates(u)},_checkDuration:function(){return this.data.ttipduration},_tooltipTaskName:function(){return this.data.ttiptaskname},_tooltipProgress:function(){return this.data.ttipprogress},_tooltipStartDate:function(){return this.data.ttipstartDate},_tooltipSubtaskStartDate:function(){return this.data.ttipsubtaskStartDate},_tooltipScheduleStartDate:function(){return this.data.ttipscheduleStartDate},_tooltipEndDate:function(){return this.data.ttipendDate},_tooltipSubtaskEndDate:function(){return this.data.ttipsubtaskEndDate},_tooltipScheduleEndDate:function(){return this.data.ttipscheduleEndDate},_tooltipDuration:function(n){var r="",t;return n.ttipduration!=null&&n.ttipduration!=i&&(r+=n.ttipduration+" "),n.ttipdurationunit!=null&&n.ttipdurationunit!=i&&(t=n.ttipduration!=1,r+=n.ttipdurationunit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.ttipdurationunit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r},_getDurationUnits:function(){var n=this;return n.model.durationUnit==t.Gantt.DurationUnit.Hour?"hours":n.model.durationUnit==t.Gantt.DurationUnit.Minute?"minutes":"days"},_cellClickHandler:function(t){var f=n(t.target),v=f.closest("tr.e-ganttrowcell"),r=this,i=this.model,o={},u,s,y=f[0],h=r.getGanttChartRows(),c,e,l,a;if(s=u=h.index(f.parent()),u==-1&&(s=u=h.index(v)),!(n(y).hasClass("e-parentTask")||n(y).closest(".e-parentTask").length>0)||f.hasClass("e-connectorpoint-left")||f.hasClass("e-connectorpoint-right")){if(u!=-1&&i.allowSelection){if(e=i.currentViewData[u],u=i.updatedRecords.indexOf(e),i.selectionMode=="row"){if(r._rowSelectingEventTrigger(i.selectedRowIndex,u))return;r.selectRows(u);r.focusGanttElement();r._rowSelectedEventTrigger(u)}i.selectionMode=="cell"&&(r.model.selectedItem=e)}}else c=h.index(v),e=i.currentViewData[c],recordIndex=i.updatedRecords.indexOf(e),r._allowExpandCollapse&&e&&e.hasChildRecords&&(r._trigger("cancelEditCell"),i.selectedRowIndex!==recordIndex&&i.allowSelection&&recordIndex!==-1&&(r._rowSelectingEventTrigger(i.selectedRowIndex,recordIndex)||(r.selectRows(recordIndex),r._rowSelectedEventTrigger(recordIndex))),r._expandCollapse(c));i.taskbarClick&&(f.is(".e-childContainer,.e-gantt-milestone-container,.e-parentContainer")||(l=f.closest(".e-childContainer,.e-gantt-milestone-container,.e-parentContainer"),l.length&&(o={},a=i.currentViewData[s],s=i.updatedRecords.indexOf(a),o.data=a,o.index=s,o.taskbarElement=l[0],o.target=f[0],this._trigger("taskbarClick",o))))},getRowByIndex:function(i,r){var e,o;try{var u=this,f=u.getGanttChartRows(),s=n(f),h=n();return u.model.enableVirtualization&&(e=u.model.updatedRecords[i],i=u.model.currentViewData.indexOf(e)),t.isNullOrUndefined(r)?(u.model.enableVirtualization&&(o=u.model.updatedRecords[r],r=u.model.currentViewData.indexOf(o)),n(f[i])):n(s.slice(i,r))}catch(c){return n()}},selectRows:function(n){var t=this,r=this.model,f=t.getGanttChartRows(),i,u;r.allowSelection&&r.selectionMode!="cell"&&(t.prevSelectedItem&&(t.prevSelectedItem.isSelected=!1),f.removeClass("e-gantt-mouseclick"),u=t.getRowByIndex(n),t.model.allowSelection&&u.addClass("e-gantt-mouseclick"),t.model.selectedRowIndex=n,i=t.model.updatedRecords[n],i&&(i.isSelected=!0),t.model.selectedItem=i,t.prevSelectedItem=i)},updateSelectedItem:function(t){var i=this,r=n(i.getGanttChartRows());r.removeClass("e-gantt-mouseclick");i.model.updatedRecords[t].isSelected=!0;i.model.selectedItem=i.model.updatedRecords[t];this._refresh();i._rowSelectedEventTrigger(t)},ganttrowHover:function(t){var r=this,i;r.model.enableRowHover&&(i=r.getGanttChartRows(),i.removeClass("e-gantt_mousehover").addClass("e-gantt_mouseleave"),n(i[t]).addClass("e-gantt_mousehover").removeClass("e-gantt_mouseleave"))},_rowHover:function(t){var i=this,e=n(t.target),f,u={},r,o;return i.model.enableRowHover?(f=n(i.getGanttChartRows()),r=f.index(e.parent()),r==-1&&(o=e.closest("tr.e-ganttrowcell"),r=f.index(o)),u.index=r,t.type=="mouseenter"?(u.reason="mouseenter",i.addRowHover(r)):(u.reason="mouseleave",i.removeRowHover()),i._trigger("rowHover",u),!1):!1},addRowHover:function(t){var i=this.getGanttChartRows();t!=null&&t!=-1&&n(i[t]).addClass("e-enablerowhover")},removeRowHover:function(){var n=this.getGanttChartRows();n.removeClass("e-enablerowhover")},updateHeight:function(i){var r=this,f=r.model,u;r._setScrollTop();r._containerHeight=i;n("#ganttviewerbodyContent"+r._id+"").css({height:r._containerHeight+"px"});f.stripLines&&n(r.element).find(".e-stripline,.e-stripLines").css({height:i+"px"});f.holidays&&n(r.element).find(".e-holidays,.e-holiday").css({height:i+"px"});n(".e-secondary_canvas").css({height:i+"px"});n(r.element).find(".e-weekends").css({height:i+"px"});u=".e-holiday-label";t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(u=".e-holiday-label-ie8");i<r._viewportHeight?i<=f.rowHeight?n(r.element).find(u).css({top:-i-30}):n(r.element).find(u).css({top:i/2}):n(r.element).find(u).css({top:r._viewportHeight/2});i==0&&r._$bodyContent.css({height:"1px"});r._$bodyContainer.ejScroller("refresh");parseInt(r._$bodyContainer.css("height"))!=r._viewportHeight&&r._$bodyContainer.css("height",r._viewportHeight)},_completeAction:function(n){var t=this;return n.vscrollExsist=t._$bodyContainer.ejScroller("isVScroll"),t._trigger("actionComplete",n),n.requestType==="validatePredecessor"?n.predecessorValidation:void 0},_taskbarEditing:function(n){var t=this;t._trigger("taskbarEditing",n)},_taskbarEdited:function(n){var t=this;t._trigger("taskbarEdited",n)},_queryTaskbarinfo:function(n){this._trigger("queryTaskbarInfo",n);this._updateTaskbarItems(n)},_refreshRow:function(n){var t=this;t._trigger("refreshRow",n)},_enbleZooming:function(n){var t=this;t._trigger("zooming",n)},_updateManualTaskbarItem:function(n,i){var y=i.querySelector(".e-gantt-parenttaskbar-innerdiv"),o=i.querySelector(".e-gantt-parenttaskbar-progress"),s=i.querySelector(".e-gantt-manualparenttaskbar"),h=i.querySelector(".e-gantt-manualparenttaskbar-left"),c=i.querySelector(".e-gantt-manualparenttaskbar-right"),l=i.querySelector(".taskbarresizer-right"),u=y.style,e=o&&o.style,f=s&&s.style,p=h&&h.style,a=c&&c.style,w=l&&l.style,v,r;v=n.model.renderBaseline?model.taskbarHeight-9:model.taskbarHeight-10;r=v/5;t.isNullOrUndefined(n.manualParentTaskbarBackground)||f.backgroundColor==n.manualParentTaskbarBackground||(f.backgroundColor=n.manualParentTaskbarBackground,p.borderColor=n.manualParentTaskbarBackground,a.borderColor=n.manualParentTaskbarBackground);f.width=n.data.width+"px";f.left=n.data.left+"px";a.left=n.data.width-parseInt(r)+"px";w.left=n.data.width-parseInt(r)+"px";n.data.width==n.data.manualWidth&&n.data.left==n.data.manualLeft?(e.width=n.data.progressWidth-r*2+"px",u.width=n.data.manualWidth-r*2+"px",u.left=n.data.manualLeft+r+"px"):n.data.left==n.data.manualLeft?(u.left=n.data.manualLeft+r+"px",e.width=n.data.progressWidth-r+"px",u.width=n.data.manualWidth-r+"px"):(e.width=n.data.progressWidth+"px",u.width=n.data.manualWidth+"px",u.left=n.data.manualLeft+"px")},_updateTaskbarItems:function(t){var g=this.getGanttChartRows(),nt=this.model.currentViewData.indexOf(t.data),i=g[nt],f,e,c,a,v,y,p,w,b;if(i){if(n(i).find(".e-gantt-milestone-container").closest("div").length>0&&(e=n(i).find(".e-gantt-milestone-container").closest("div")[0]),n(i).find(".e-baselinebar").closest("div").length>0&&(c=n(i).find(".e-baselinebar").closest("div")[0]),n(i).find(".e-parentContainer").closest("div").length>0){var f=n(i).find(".e-parentContainer").closest("div")[0],tt=f.querySelector(".e-gantt-parenttaskbar-innerdiv"),k=f.querySelector(".e-gantt-parenttaskbar-progress"),o=tt.style,r=k&&k.style;o.backgroundColor!=t.parentTaskbarBackground&&(o.backgroundColor=t.parentTaskbarBackground);r&&r.backgroundColor!=t.parentProgressbarBackground&&(r.backgroundColor=t.parentProgressbarBackground);o.borderColor!=t.parentTaskbarBorder&&(o.borderColor=t.parentTaskbarBorder);r&&r.borderColor!=t.parentProgressbarBorder&&(r.borderColor=t.parentProgressbarBorder);!t.data.isAutoSchedule&&t.data.hasChildRecords&&this._updateManualTaskbarItem(t,f);r&&r.borderColor!=t.parentProgressbarBorder&&(r.borderColor=t.parentProgressbarBorder)}else if(n(i).find(".e-childContainer").closest("div").length>0){var f=n(i).find(".e-childContainer").closest("div")[0],it=f.querySelector(".e-gantt-childtaskbar"),u=f.querySelector(".e-gantt-childtaskbar-progress"),s=it.style,h=u&&u.style,d=u&&u.querySelector(".e-tasklabel"),l=d&&d.style;s.backgroundColor!=t.taskbarBackground&&(s.backgroundColor=t.taskbarBackground);u&&h.backgroundColor!=t.progressbarBackground&&(h.backgroundColor=t.progressbarBackground);s.borderColor!=t.taskbarBorder&&(s.borderColor=t.taskbarBorder);u&&h.borderColor!=t.progressbarBorder&&(h.borderColor=t.progressbarBorder);l&&l.color!=t.taskbarTextColor&&(l.color=t.taskbarTextColor)}n(e).length>0&&(a=e.querySelector(".e-gantt-milestone.milestone-top"),v=e.querySelector(".e-gantt-milestone.milestone-bottom"),a&&v?(y=a.style,p=v.style,p.borderBottomColor!=t.milestoneBackground&&y.borderTopColor!=t.milestoneBackground&&(p.borderTopColor=t.milestoneBackground,y.borderBottomColor=t.milestoneBackground)):this.model.milestoneTemplate&&(w=e.querySelector(".e-gantt-milestone"),w.style.backgroundColor!=t.milestoneBackground&&(w.style.backgroundColor=t.milestoneBackground)));n(c).hasClass("e-baselinebar")&&(b=c.style,b.backgroundColor!=t.baselineBackground&&(b.backgroundColor=t.baselineBackground))}},_expandCollapse:function(n){var i=this,t={},r=i.model.currentViewData[n];t.data=r;t.recordIndex=i.model.updatedRecords&&i.model.updatedRecords.indexOf(r);t.source="ganttChart";t.expanded=!r.expanded;r&&(t.expanded?i._trigger("expanding",t):i._trigger("collapsing",t))},_getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this._getExpandStatus(t.parentItem):!0:!0},onScrollHelper:function(t,i){var r=this,u,f,e;if(!r._$bodyContainer.ejScroller("isVScroll"))return!1;r._mouseLeave();i||r._$bodyContainer.ejScroller("option","scrollTop",t);u=model.rowHeight;n("#"+this._$ganttViewTablebody[0].id).find("tr:first")[0]&&(u=n("#"+this._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height);f=parseInt(r.model.updatedRecords.length*u)-(r._viewportHeight-18);t>f&&(t=f);t<0&&(t=0);e={scrollTop:t};r._handleScroll(e);this.model.isCriticalPathEnable==!0&&this.model.enableVirtualization==!0&&this.criticalConnectorLine(this.model.criticalPathCollection,this.model.detailPredecessorCollection,!0,this.collectionTaskId)},_handleScroll:function(n){var t=this,n=n||{},f=t._$headerContainer,o=t._$bodyContainer,r=t._prevLeft,u,e;n.scrollTop!==i&&(t._scrollTop=n.scrollTop);n.scrollLeft!==i&&(r=n.scrollLeft);u=r-t._prevLeft;e=t._scrollTop-t._prevScrollTop;u?f.scrollLeft(r):f.scrollLeft(t._prevLeft);t.model.enableVirtualization&&(t._vscrollDist=Math.abs(t._scrollTop-t._prevScrollTop),t._vscrollDist&&(t._vScrollDir=t._prevScrollTop<=t._scrollTop?1:-1,t._updateCurrentViewData(),t.renderGanttRecords(),t._prevScrollTop=t._scrollTop));n.requestType="scroll";n.delta=t._scrollTop;t._prevLeft=r;t._prevScrollTop=t._scrollTop;u===0&&e!==0&&t._completeAction(n)},refreshHelper:function(n,t,r){var u=this;u.model.currentViewData=n;u.model.updatedRecords=t;u._totalCollapsedRecordCount=r!=i?r:0;t&&(u._refresh(),u._setHeight(t.length*u.model.rowHeight),u.updateHeight((t.length-u._totalCollapsedRecordCount)*u.model.rowHeight))},_setScrollTop:function(){var n=this,r=this.model,i=n._scrollTop,t;r.enableVirtualization&&i!==0&&n.model.currentViewData.length*n.model.rowHeight<n._viewportHeight&&(t=i-(n._viewportHeight-n.model.currentViewData.length*n.model.rowHeight),t<0&&(t=0),n._$bodyContainer.ejScroller("scrollY",t,!0))},refreshGridLinesTable:function(n){var t=this;t._$gridLinesTablebody.empty().append(t._createGridLinesTableRow(n));t._$bodyContainer.ejScroller("refresh");parseInt(t._$bodyContainer.css("height"))!=t._viewportHeight&&t._$bodyContainer.css("height",t._viewportHeight)},_refresh:function(){var i=this,r=i.model,u=n.render[i._id+"_CustomTemplate2"](i.model.currentViewData);i._$ganttViewTablebody=n("#ganttViewTablebody"+i._id+"");i._$ganttViewTablebody.empty().append(u);r.enableVirtualization?i._$gridLinesTablebody.empty().append(i._createGridLinesTableRow(i.model.currentViewData.length)):i._$gridLinesTablebody.empty().append(i._createGridLinesTableRow(i.model.currentViewData.length-i._totalCollapsedRecordCount));i._$ganttViewTablebody[0]!=null?this._ganttChartRows=n(i._$ganttViewTablebody[0].childNodes):(i._$ganttViewTablebody=t.buildTag("tbody.e-gantt-viewer-ganttViewTablebody#ganttViewTablebody"+i._id+"",u,{},{}),i._ganttChartRows=n(i._$ganttViewTablebody[0].childNodes));r.queryTaskbarInfo&&i._eventBindings()},refreshRow:function(t){var i=this,u=this.model,f=n(i.getGanttChartRows()[t]),r=i.model.currentViewData[t];!u.allowSelection&&r&&(r.isSelected=!1);t!=-1&&r&&(f.replaceWith(n.render[i._id+"_CustomTemplate2"](r)),i._setGanttChartRows(n(i._$ganttViewTablebody[0].childNodes)));u.queryTaskbarInfo&&i._refreshedRowEventBinding(t)},_refreshedRowEventBinding:function(t){var a=n(this.getGanttChartRows()),r,i={},u,e,o,s,f,h,c,l;r=a[t];n(r).hasClass("e-ganttrowcell")&&(f=n(r).find("td.e-chartcell").has("div.e-childContainer,div.e-parentContainer,div.e-gantt-milestone")[0].firstChild,n(r).find(".e-gantt-milestone-container").closest("div").length>0&&(h=n(r).find(".e-gantt-milestone-container").closest("div")[0]),n(r).find(".e-baselinebar").closest("div").length>0&&(l=n(r).find(".e-baselinebar").closest("div")[0]),n(f).hasClass("e-parentContainer")?(s=f.querySelector(".e-gantt-parenttaskbar-innerdiv"),o=f.querySelector(".e-gantt-parenttaskbar-progress")):n(f).hasClass("e-childContainer")&&(e=f.querySelector(".e-gantt-childtaskbar"),u=f.querySelector(".e-gantt-childtaskbar-progress"),c=u&&u.querySelector(".e-tasklabel")),i.data=this.model.currentViewData[t],i.taskbar=r,i.taskbarBackground=e!=null?e.style.backgroundColor:null,i.progressbarBackground=u!=null?u.style.backgroundColor:null,i.parentTaskbarBackground=s!=null?s.style.backgroundColor:null,i.parentProgressbarBackground=o!=null?o.style.backgroundColor:null,i.parentProgressbarBorder=o!=null?o.style.border:null,i.progressbarBorder=u!=null?u.style.border:null,i.taskbarBorder=e!=null?e.style.border:null,i.parentTaskbarBorder=s!=null?s.style.border:null,i.taskbarTextColor=c!=null?c.style.color:null,i.baselineBackground=l!=null?l.style.backgroundColor:null,i.milestoneBackground=h!=null?h.style.backgroundColor:null,this._queryTaskbarinfo(i))},refreshScroller:function(n){var t=this,r,u,i,f,e;t._$bodyContainer.find("div.e-content").removeClass("e-borderbox");u=t._$bodyContainer.ejScroller("option","scrollTop");i=t._$bodyContainer.ejScroller("option","scrollLeft");t._$bodyContainer.ejScroller("option",{width:n});t._$bodyContainer.ejScroller("refresh");r=t.getMaxScrollWidth();i>r&&(i=r>0?r:0);f=t._$bodyContainer.ejScroller("isHScroll");f?t._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):t._$bodyContainer.find("div.e-content").addClass("e-borderbox");e=t._$bodyContainer.ejScroller("isVScroll");e&&t._$bodyContainer.ejScroller("scrollY",u,!0);t._$bodyContainer.ejScroller("option","scrollLeft",i);t._$headerContainer.scrollLeft(i)},getMaxScrollWidth:function(){var n=this;return n._$bodyContainer.children(".e-content").children().width()-n._$bodyContainer.children(".e-content").width()},refreshStripLines:function(n){var t=this;n&&(this.model.stripLines=n);t._$stripLineContainer.empty();this._renderStripLines(this.model.stripLines)},refreshHolidays:function(n){var t=this,r,i;if(n&&(t.model.holidays=n),t._$secondaryCanvas.empty(),t.model.holidays!=null)for(r=t.model.holidays.length,i=0;i<r;i++)t._renderHoliday(t.model.holidays[i])},renderNewAddedRow:function(t,i){var r=this,f=r.model,u=n.render[this._id+"_CustomTemplate2"](i);r._ganttChartRows.length!=0?r._ganttChartRows.length==t?r.getGanttChartRows().eq(t-1).after(u):r.getGanttChartRows().eq(t).before(u):r._refresh();r._setGanttChartRows(n(r._$ganttViewTablebody[0].childNodes));r._$gridLinesTablebody.empty().append(r._createGridLinesTableRow(r.model.updatedRecords.length-r._totalCollapsedRecordCount));f.enableVirtualization===!1?r._setHeight((r.model.updatedRecords.length-r._totalCollapsedRecordCount)*r.model.rowHeight):r._setHeight(r.model.updatedRecords.length*r.model.rowHeight);r.updateHeight(r._containerHeight)},_setGanttChartRows:function(n){this._ganttChartRows=n},refreshChartHeader:function(i,r){var u=this,s=u.model,f=s.scheduleHeaderSettings.scheduleHeaderType,l,v,h,e,c,a,o,y;u._updateScheduleWidth();f=="hour"?u._createScheduleTopHourTemplate():f=="day"?u._createScheduleTopDayTemplate():f=="week"?u._createScheduleWeekTemplate():f=="month"?u._createScheduleTopMonthTemplate():f=="year"&&u._createScheduleYearTemplate();i=i==null?new Date:i;r=r==null?new Date(null):r;u._$scheduleDiv.empty();o=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"});l=t.buildTag("colgroup","",{},{});v=n(document.createElement("col"));v.css("width",u._getScheduleLength(f)+"px");l.append(v);h=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});f=="week"?e=t.buildTag("tr",n.render[this._id+"ScheduleWeekTemplate"](s.scheduleWeeks),{},{}):f=="year"?e=t.buildTag("tr",n.render[this._id+"ScheduleYearTemplate"](s.scheduleYears),{},{}):f=="month"?e=t.buildTag("tr",n.render[this._id+"ScheduleTopMonthTemplate"](s.scheduleMonths),{},{}):f=="day"?e=t.buildTag("tr",n.render[this._id+"ScheduleTopDayTemplate"](s.scheduleDays),{},{}):f=="hour"&&(e=t.buildTag("tr",n.render[this._id+"ScheduleTopHourTemplate"](s.scheduleHours),{},{}));c=t.buildTag("th.schedule","",{},{});a=t.buildTag("div.schedule","",{width:"20px"},{});c.append(a);e.append(c);h.append(e);o.append(l);o.append(h);u._$scheduleDiv.append(o);e=null;f=="hour"?u._createMinuteTemplate():f=="day"?u._createScheduleHourTemplate():f=="week"?u._createScheduleDayTemplate():f=="month"?u._createScheduleBottomWeekTemplate():f=="year"&&u._createScheduleMonthTemplate();o=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"});h=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});y=u._getScheduleMonth(new Date(s.scheduleYears[0]),r);f=="week"&&(e=t.buildTag("tr",n.render[this._id+"_CustomTemplate1"](u.model.scheduleWeeks),{},{}));f=="year"&&(e=t.buildTag("tr",n.render[this._id+"ScheduleMonthTemplate"](y),{},{}));f=="month"&&(u._numOfWeeks=u._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate),e=t.buildTag("tr",n.render[this._id+"ScheduleBottomWeekTemplate"](u._numOfWeeks),{},{}));f=="day"&&(e=t.buildTag("tr",n.render[this._id+"scheduleHourTemplate"](u._getScheduleHours()),{},{}));f=="hour"&&(e=t.buildTag("tr",n.render[this._id+"scheduleMinuteTemplate"](u._getScheduleMinutes()),{},{}));c=t.buildTag("th.schedule","",{},{});a=t.buildTag("div.schedule","",{width:"20px"},{});c.append(a);e.append(c);h.append(e);o.append(l);o.append(h);u._$scheduleDiv.append(o)},refreshContainersWidth:function(){var t=this,i,f=this.model,e=f.scheduleHeaderSettings.scheduleHeaderType,u,r;if(i=t._getScheduleLength(e),$gridLineContainerTable=n("#ganttgridLinesTable"+t._id),t._$bodyContent.width(i),t.refreshWeekEndContainer(),$gridLineContainerTable.width(i),$gridLineContainerTable.children("col").width(i),t._$ganttViewTable.width(i),t._$ganttViewTable.children("col").width(i),t._createTaskbarTemplate(),t._updateCurrentViewData(),t._$secondaryCanvas.empty(),t._$stripLineContainer.empty(),t.model.stripLines!=null&&this._renderStripLines(t.model.stripLines),t.model.holidays!=null)for(u=t.model.holidays.length,r=0;r<u;r++)t._renderHoliday(t.model.holidays[r])},refreshWeekEndContainer:function(){var n=this,l=n.model,i=0,o=n.model.perDayWidth+1,s=n.model.updatedRecords.length*this.model.rowHeight,a=n.model.scheduleWeeks.length,h,c,u=l.scheduleHeaderSettings.weekStartDay,v=u>=0&&u<7?u:0,f=6-v,y=f+1==7?0:f+1,r=n._$weekendsContainer.children(".e-secondary_canvas"),e;for(r.empty(),e=0;e<a;e++)h=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*y+"px",width:o+"px",height:s+"px","background-color":this.model.weekendBackground},{}),c=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*f+"px",width:o+"px",height:s+"px","background-color":this.model.weekendBackground},{}),r.append(h),r.append(c),i=i+this._scheduleWeekWidth;n._$weekendsContainer.append(r)},deleteChartRows:function(n,t){for(var r=this,u=r.getGanttChartRows(),i=n;i<n+t;i++)u.splice(i,1)},_eventBindings:function(){var v=n(this.getGanttChartRows()),y=v.length,i,t={},u,f,e,h,o,r,c,l,a,s;if(y!=0)for(s=0;s<y;s++)i=v[s],n(i).hasClass("e-ganttrowcell")&&(r=n(i).find("td.e-chartcell").has("div.e-childContainer,div.e-parentContainer,div.e-gantt-milestone")[0].firstChild,n(i).find(".e-gantt-milestone-container").closest("div").length>0&&(c=n(i).find(".e-gantt-milestone-container").closest("div")[0]),n(i).find(".e-baselinebar").closest("div").length>0&&(a=n(i).find(".e-baselinebar").closest("div")[0]),n(r).hasClass("e-parentContainer")?(o=r.querySelector(".e-gantt-parenttaskbar-innerdiv"),e=r.querySelector(".e-gantt-parenttaskbar-progress"),h=r.querySelector(".e-gantt-manualparenttaskbar")):n(r).hasClass("e-childContainer")&&(f=r.querySelector(".e-gantt-childtaskbar"),u=r.querySelector(".e-gantt-childtaskbar-progress"),l=u&&u.querySelector(".e-tasklabel")),t.data=this.model.currentViewData[s],t.taskbar=i,t.taskbarBackground=f!=null?f.style.backgroundColor:null,t.progressbarBackground=u!=null?u.style.backgroundColor:null,t.parentTaskbarBackground=o!=null?o.style.backgroundColor:null,t.parentProgressbarBackground=e!=null?e.style.backgroundColor:null,t.parentProgressbarBorder=e!=null?e.style.border:null,t.progressbarBorder=u!=null?u.style.border:null,t.taskbarBorder=f!=null?f.style.border:null,t.parentTaskbarBorder=o!=null?o.style.border:null,t.taskbarTextColor=l!=null?l.style.color:null,t.baselineBackground=a!=null?a.style.backgroundColor:null,t.milestoneBackground=c!=null?c.style.backgroundColor:null,t.data.hasChildRecords&&!t.data.isAutoSchedule&&(t.manualParentTaskbarBackground=h!=null?h.style.backgroundColor:null),this._queryTaskbarinfo(t))},_updateCurrentViewData:function(){var t=this,i=0;this.model.enableVirtualization?(this._getRenderedRowRange(),this.model.currentViewData=this.model.updatedRecords.slice(t._renderedRange.top,t._renderedRange.bottom),t._vscrollDist!==0&&(i=t._scrollTop,i-=t._rowMargin,n("#ganttViewTable"+t._id+"").css({top:i+"px"}),n("#ganttgridLinesTable"+t._id+"").css({top:i+"px"})),t._vTop=t._visibleRange.top,t._vBottom=t._visibleRange.bottom,t._rTop=t._renderedRange.top,t._rBottom=t._renderedRange.bottom):this.model.currentViewData=this.model.updatedRecords},renderGanttRecords:function(){var n=this;n._refresh();n._$ganttViewTable.append(n._$ganttViewTablebody);n._$bodyContent.append(n._$ganttViewTable)},_getRenderedRowRange:function(){var n=this,t,i;return n._getVisibleRowRange(),t=n._visibleRange.top,i=n._visibleRange.bottom,n._renderedRange={top:t,bottom:i},n._renderedRange},_getVisibleRowRange:function(){var n=this,r=n._scrollTop/n.model.rowHeight,f=r-Math.floor(r),t,i,u;n._rowMargin=f*n.model.rowHeight;t=Math.floor(r);u=n.model.updatedRecords.length;i=n._getrowposition(n._scrollTop+n._viewportHeight);t=Math.max(0,t);i=Math.min(u,i);n._visibleRange={top:t,bottom:i}},_getrowposition:function(n){return Math.ceil(n/this.model.rowHeight)},_getDateType:function(n){return n instanceof Date?n:n!=null?t.parseDate(n,this.model.dateFormat,this.model.locale):null},_getDateFromFormat:function(n){return typeof n=="object"?new Date(n):n?t.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):t.parseDate(n,this.model.dateFormat,this.model.locale):void 0},_createScheduleTopDayTemplate:function(){var t=this,r=t.model,f=r.scheduleHeaderSettings.dayHeaderFormat==""&&r.scheduleHeaderSettings.scheduleHeaderType=="day"?"ddd":r.scheduleHeaderSettings.dayHeaderFormat,e={renderDayTop:n.proxy(t._getDaySplit,t)},i,u;n.views.helpers(e);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:"+t.model.perHourWidth*24+"px;'>";td="<div class='e-schedule-week-headercell-content' style='width:"+(t.model.perHourWidth*24-1)+"px;box-sizing:border-box;margin:auto;white-space:nowrap;'>{{:~renderDayTop('"+f+"',#data)}}<\/div><\/div>";i+=td;i+="<\/th>";u={};u[t._id+"ScheduleTopDayTemplate"]=i;n.templates(u)},_getDaySplit:function(n,i){var r=new Date(i),f=this,u=f.model;switch(n){case"D":case"d":return r.getDate();case"DD":case"dd":return("0"+r.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(r,n,u.locale)}return t.format(r,n,u.locale)},_createScheduleTopMonthTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.monthHeaderFormat,o={renderMonthTop:n.proxy(t._getMonthsplit,t),setMonthWidth:n.proxy(t._setMonthWidth,t),isLastMonth:n.proxy(t._checkLastMonthWidth,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:{{:~setMonthWidth(#data)}}px;'>";u="<div class='e-schedule-week-headercell-content' style='box-sizing:border-box;-moz-box-sizing:border-box;margin:auto;white-space:nowrap;width:{{:~setMonthWidth(#data)-1}}px;'>{{:~renderMonthTop('"+e+"',#data)}}<\/div>{{if ~isLastMonth(#data)}}<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;'><div class='e-schedule-week-headercell-content' style='box-sizing:border-box;-moz-box-sizing:border-box;margin:auto;white-space:nowrap;width:"+(t._balanceWidth-1)+"px;'><\/div><\/th>{{/if}}";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleTopMonthTemplate"]=i;n.templates(r)},_setMonthWidth:function(n){var e=this,i,u,r,f;return(i=typeof n=="object"?new Date(n):t.parseDate(n,this.model.dateFormat,this.model.locale),u=new Date(i.getFullYear(),i.getMonth()+1,0),r=u.getDate(),i.getTime()===e.model.scheduleMonths[0].getTime())?(f=u.getDate()-i.getDate(),this.model.perDayWidth*(f+1)):r==31?this.model.perDayWidth*31:r==30?this.model.perDayWidth*30:r==28?this.model.perDayWidth*28:r==29?this.model.perDayWidth*29:void 0},_checkLastMonthWidth:function(n){var t=this;return n==t.model.scheduleMonths[t.model.scheduleMonths.length-1]&&t._balanceWidth>0?!0:!1},_getMonthsplit:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_createScheduleYearTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.yearHeaderFormat,o={renderYear:n.proxy(t._getYearsplit,t),getYearWidth:n.proxy(t._getTemplateYearWidth,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:{{:~getYearWidth(#data)}}px;'>";u="<div class='e-schedule-week-headercell-content' style='margin:auto;white-space:nowrap;width:{{:~getYearWidth(#data)-1}}px;box-sizing:border-box;-moz-box-sizing:border-box;'>{{:~renderYear('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleYearTemplate"]=i;n.templates(r)},_getYearsplit:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_getMonthWidthForYearMode:function(n){for(var u,o=this,e=o.model,n,i=0,f=n.getMonth();f<12;f++){u=n;n=typeof u=="object"?new Date(u):t.parseDate(u,e.dateFormat,e.locale);var s=new Date(n.getFullYear(),n.getMonth()+1,0),h=n.getDate(),r=s.getDate();h!=1?i+=r-n.getDate():r==31?i+=31:r==30?i+=30:r==28?i+=28:r==29&&(i+=29);n=new Date(n.getFullYear(),f+1,1)}return i},_getTemplateYearWidth:function(n){var i=n.getFullYear(),t=this._getMonthWidthForYearMode(n);return t*this.model.perDayWidth},_createScheduleWeekTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.weekHeaderFormat,o={renderWeek:n.proxy(t._getWeeksplit,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:"+t._scheduleWeekWidth+"px;'>";u="<div class='e-schedule-week-headercell-content' style='width:"+(t._scheduleWeekWidth-1)+"px;box-sizing:border-box;margin:auto;white-space:nowrap;'>{{:~renderWeek('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleWeekTemplate"]=i;n.templates(r)},_getWeeksplit:function(n,i){var u=new Date(i),f=this,e=f.model,r;return r=t.format(u,n,e.locale),r.toLowerCase().replace(/(-(\w)|(^| )(\w)|:(\w)|,(\w)|\/(\w)|\.(\w))/g,function(n){return n.toUpperCase()})},_createScheduleHourTemplate:function(){var t=this,f=t.model,u,e=f.scheduleHeaderSettings.hourHeaderFormat,o={renderHour:n.proxy(t._getHourTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perHourWidth+"px;'>";u="<div class='e-schedule-day-headercell-content' style='width:"+(t.model.perHourWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"scheduleHourTemplate"]=i;n.templates(r)},_createScheduleTopHourTemplate:function(){var t=this,e=t.model,r=e.minuteInterval,o,i,s=e.scheduleHeaderSettings.hourHeaderFormat,h={renderHour:n.proxy(t._getHourTemplate,t)},u,f;r==30&&(i=2);r==15&&(i=4);r==5&&(i=12);r==1&&(i=60);t._totalInterval=i;n.views.helpers(h);u="<th class='e-schedule-hour-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perMinuteWidth*i+"px;'>";o="<div class='e-schedule-hour-headercell-content' style='width:"+(t.model.perMinuteWidth*i-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+s+"',#data)}}<\/div>";u+=o;u+="<\/th>";f={};f[t._id+"ScheduleTopHourTemplate"]=u;n.templates(f)},_createMinuteTemplate:function(){var t=this,f=t.model,u,e=f.scheduleHeaderSettings.minuteHeaderFormat,o={renderHour:n.proxy(t._getHourTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-hour-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perMinuteWidth+"px;'>";u="<div class='e-schedule-hour-headercell-content' style='width:"+(t.model.perMinuteWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"scheduleMinuteTemplate"]=i;n.templates(r)},_getHourTemplate:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_createScheduleBottomWeekTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.weekHeaderFormat,o={renderWeek:n.proxy(t._getMonthWeekTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perWeekWidth+"px;'>";u="<div class='e-schedule-day-headercell-content' style='position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;padding-left:2px;width:"+(t.model.perWeekWidth-1)+"px;'>{{:~renderWeek('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleBottomWeekTemplate"]=i;n.templates(r)},_getMonthWeekTemplate:function(n,i){var r=new Date(i),u=this,f=u.model;switch(n){case"d":case"dd":case"ddd":default:return t.format(r,n,f.locale)}},_createScheduleMonthTemplate:function(){var t=this,u=t.model,f=u.scheduleHeaderSettings.monthHeaderFormat,e={renderMonth:n.proxy(t._getMonthTemplate,t),getMonthWidth:n.proxy(t._setMonthWidthYearMode,t)},r,i;n.views.helpers(e);r="<th class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:{{:~getMonthWidth(#data)}}px;'><div class='e-schedule-day-headercell-content' style='position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;width:{{:~getMonthWidth(#data)-1}}px;'>{{:~renderMonth('"+f+"',#data)}}<\/div><\/th>";i={};i[t._id+"ScheduleMonthTemplate"]=r;n.templates(i)},_getMonthTemplate:function(n,i){var r=new Date(i),f=this,u=f.model;switch(n){case"M":case"m":return("0"+r.getDate()).slice(-2);case"MM":case"mm":return r.getDate();case"MMM":case"mmm":case"MMMM":case"mmmm":return t.format(r,n,u.locale);default:return t.format(r,n,u.locale)}},_setMonthWidthYearMode:function(n){var f=this,i=new Date(n),r=new Date(i.getFullYear(),i.getMonth()+1,0),u=i.getDate(),t=r.getDate();return u!=1?this.model.perDayWidth*(t-i.getDate()):t==31?this.model.perDayWidth*31:t==30?this.model.perDayWidth*30:t==28?this.model.perDayWidth*28:t==29?this.model.perDayWidth*29:void 0},_getHeaderWeek:function(n,t){var i=new Date(t),r;return i.setDate(i.getDate()+n),r=i.getDay(),r==0||r==6?!0:void 0},_createScheduleDayTemplate:function(){var t=this,e,u=t.model,i=u.scheduleHeaderSettings.dayHeaderFormat==""&&u.scheduleHeaderSettings.scheduleHeaderType=="day"?"ddd":u.scheduleHeaderSettings.dayHeaderFormat,o={renderDay:n.proxy(t._getDayTemplate,t),_getHeader:n.proxy(t._getHeaderWeek,t)},r,f;n.views.helpers(o);r="<th class='e-schedule-day-headercell {{if ~_getHeader(0,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(0,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>";e="<div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(0,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',0,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(1,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(1,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(1,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',1,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(2,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(2,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(2,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',2,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(3,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(3,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(3,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',3,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(4,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(4,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(4,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',4,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(5,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(5,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(5,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',5,#data)}}<\/div><th class='e-schedule-day-headercell {{if ~_getHeader(6,#data)}} e-headercell-weekend {{/if}}' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;{{if ~_getHeader(6,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;{{if ~_getHeader(6,#data)}} background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"{{/if}}'>{{:~renderDay('"+i+"',6,#data)}}<\/div>";r+=e;r+="<\/th>";f={};f[t._id+"_CustomTemplate1"]=r;n.templates(f)},_getDayTemplate:function(n,i,r){var u=new Date(r),e=this,f=e.model;u.setDate(u.getDate()+i);switch(n){case"D":case"d":return u.getDate();case"DD":case"dd":return("0"+u.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(u,n,f.locale);case"":return n="ddd",t.format(u,n,f.locale)[0].toUpperCase();default:return t.format(u,n,f.locale).toUpperCase()}},_getScheduleMonth:function(n,t){var f=this,i=f.model,r=[],u;for(t=t.getMonth()<11?new Date(t.getFullYear(),11,31):t,endMonth=new Date(n.getFullYear(),11,31)<new Date(i.scheduleEndDate)?12:new Date(i.scheduleEndDate).getMonth()+1,u=n.getMonth();n<t;u++)r.push(n),n=new Date(n.getFullYear(),n.getMonth()+1,1);return r},_createSchedule:function(i,r){var u=this,a=u.model,e=a.scheduleHeaderSettings.scheduleHeaderType,c,v,s,f,h,l,o,y;i=i==null?new Date:i;r=r==null?new Date(null):r;u._createScheduleWeekTemplate();u._createScheduleYearTemplate();u._createScheduleTopMonthTemplate();u._createScheduleTopDayTemplate();u._createScheduleTopHourTemplate();o=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"});c=t.buildTag("colgroup","",{},{});v=n(document.createElement("col"));v.css("width",u._getScheduleLength(e)+"px");c.append(v);s=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});e=="week"?f=t.buildTag("tr",n.render[this._id+"ScheduleWeekTemplate"](u.model.scheduleWeeks),{},{}):e=="year"?f=t.buildTag("tr",n.render[this._id+"ScheduleYearTemplate"](u.model.scheduleYears),{},{}):e=="month"?f=t.buildTag("tr",n.render[this._id+"ScheduleTopMonthTemplate"](u.model.scheduleMonths),{},{}):e=="day"?f=t.buildTag("tr",n.render[this._id+"ScheduleTopDayTemplate"](u.model.scheduleDays),{},{}):e=="hour"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleTopHourTemplate"](u.model.scheduleHours),{},{}));h=t.buildTag("th.schedule","",{},{});l=t.buildTag("div.schedule","",{width:"20px"},{});h.append(l);f.append(h);s.append(f);o.append(c);o.append(s);u._$scheduleDiv.append(o);f=null;u._createScheduleDayTemplate();u._createScheduleMonthTemplate();u._createScheduleBottomWeekTemplate();u._createMinuteTemplate();u._createScheduleHourTemplate();o=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"});s=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});y=u._getScheduleMonth(new Date(a.scheduleYears[0]),r);e=="week"&&(f=t.buildTag("tr",n.render[this._id+"_CustomTemplate1"](a.scheduleWeeks),{},{}));e=="year"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleMonthTemplate"](y),{},{}));e=="month"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleBottomWeekTemplate"](u._numOfWeeks),{},{}));e=="day"&&(f=t.buildTag("tr",n.render[this._id+"scheduleHourTemplate"](u._getScheduleHours()),{},{}));e=="hour"&&(f=t.buildTag("tr",n.render[this._id+"scheduleMinuteTemplate"](u._getScheduleMinutes()),{},{}));h=t.buildTag("th.schedule","",{},{});l=t.buildTag("div.schedule","",{width:"20px"},{});h.append(l);f.append(h);s.append(f);o.append(c);o.append(s);u._$scheduleDiv.append(o);u._$headerContainer.append(u._$scheduleDiv);u._$ganttChartContainer.append(u._$headerContainer);n("#"+u._id).append(u._$ganttChartContainer)},_getScheduleHours:function(){var n=this,r=n.model,t=new Date(n.model.projectStartDate),i=new Date(r.projectEndDate);n._scheduleHours=[];i.setHours(24);do n._scheduleHours.push(new Date(t)),t.setHours(t.getHours()+1);while(!(t.getTime()>=i.getTime()));return n._scheduleHours},_getScheduleMinutes:function(){var n=this,i=n.model,t=new Date(n.model.projectStartDate),r=new Date(i.projectEndDate);r.setMinutes(60);t.setMinutes(00);n._scheduleMinutes=[];do n._scheduleMinutes.push(new Date(t)),t.setMinutes(t.getMinutes()+i.minuteInterval);while(!(t.getTime()>=r.getTime()));return n._scheduleMinutes},createGridLinesTable:function(){var i=this,f=i.model,u,c=f.scheduleHeaderSettings.scheduleHeaderType,r,s,o,e,h;u=t.buildTag("table.e-ganttgridLinesTable#ganttgridLinesTable"+i._id,"",{"z-index":"2",position:"absolute"},{cellspacing:"0px"});o=t.buildTag("colgroup","",{},{});e=n(document.createElement("col"));switch(c){case"week":r=f.scheduleWeeks.length;u.css("width",r*i._scheduleWeekWidth+"px");e.css("width",r*this._scheduleWeekWidth+"px");break;case"year":r=f.scheduleYears.length;u.css("width",i._scheduleYearWidth+"px");e.css("width",this._scheduleYearWidth+"px");break;case"month":r=f.scheduleMonths.length;u.css("width",i._scheduleMonthWidth+"px");e.css("width",this._scheduleMonthWidth+"px");break;case"day":r=f.scheduleDays.length;u.css("width",r*i.model.perHourWidth*24+"px");e.css("width",r*i.model.perHourWidth*24+"px");break;case"hour":r=f.scheduleHours.length;u.css("width",r*i.model.perMinuteWidth*i._totalInterval+"px");e.css("width",r*i.model.perMinuteWidth*i._totalInterval+"px")}o.append(e);u.append(o);s=i._createGridLinesTableRow(f.updatedRecords.length);h=t.buildTag("tbody.e-gantt-viewer-gridLinesTablebody#gridLinesTablebody"+i._id+"",s,{},{});i._$gridLinesTablebody=h;u.append(i._$gridLinesTablebody);i._$bodyContent.append(u)},_createGridLinesTableRow:function(n){for(var r=this,t="",i=0;i<n;i++)t+="<tr style='display:table-row;height:"+this.model.rowHeight+"px'><td class='e-ganttgridlines'><\/td><\/tr>";return t},_SelectState:function(){var t=this,n=this.model;return n.allowSelection?!0:!1},_getFontSize:function(){var i=this,r=i.model,u=r.taskbarHeight,n,t;return n=70*u/100,t=n%1,t==.5?n:t<.5?Math.floor(n):Math.ceil(n)},_getLeftTaskLabel:function(){var r=this,i=r.model,n="",u=i._columns.length,t;if(this.model.leftTaskLabelMapping==this.model.resourceNameMapping)n="{{:~_resources(#data)}}";else if(this.model.leftTaskLabelMapping==this.model.predecessorMapping)n="{{:predecessorsName}}";else for(t=0;t<u;t++)if(this.model.leftTaskLabelMapping==i._columns[t].mappingName){n="{{:"+i._columns[t].field+"}}";break}return n==""&&(n="{{:"+this.model.leftTaskLabelMapping+"}}"),n},_getRightTaskLabel:function(){var r=this,i=r.model,n="",u=i._columns.length,t;if(this.model.rightTaskLabelMapping==this.model.resourceNameMapping)n="{{:~_resources(#data)}}";else if(this.model.rightTaskLabelMapping==this.model.predecessorMapping)n="{{:predecessorsName}}";else for(t=0;t<u;t++)if(this.model.rightTaskLabelMapping==i._columns[t].mappingName){n="{{:"+i._columns[t].field+"}}";break}return n==""&&(n="{{:"+this.model.rightTaskLabelMapping+"}}"),n},_getMargin:function(){var t=this,i=this.model.taskbarHeight,n;return n=(i-t._fontSize-3)/2,Math.floor(n)},_getResizerLeftAdjust:function(){var t=this,r=this.model.taskbarHeight,u=t._fontSize,f=t._resizerMargin,n,i;return n=r/50,i=n%1,n=i<.5?Math.floor(n):Math.ceil(n),n<0?0:n},_createTaskbarTemplate:function(){var i=this,r=i.model,l,d=r.scheduleHeaderSettings.scheduleHeaderType,ii,g=4,u,ot,oi=0,f,o=0,s=0,nt=0,tt=0,e=0,a=!1,v=!1,st="",wt="",bt="",ht="",ct=r.baselineColor,h=r.taskbarTemplate,lt,kt=!1,ri=!1,at=r.parentTaskbarTemplate,vt,ui=!1,yt=r.milestoneTemplate,fi=!1,it="",y=r.leftTaskLabelTemplate,rt=!1,ut="",p=r.rightTaskLabelTemplate,ft=!1,et="",si={_SelectState:n.proxy(i._SelectState,i),_getType:i._getTypedata,_expander:i._addRecordExpandCollapse,_milestoneMapping:i._isMilestone,_resources:n.proxy(i._getResourceInfo,i),_rowClassName:t.TreeGrid._getrowClassName,_expandStatus:n.proxy(i._getExpandStatusRecord,i),_borderRadius:i._getBorderRadius},dt,b,ei,k,c,w,ti;i._fontSize=i._getFontSize();i._resizerRightAdjust=i._fontSize*.8;i._resizerMargin=i._getMargin();i._resizerLeftAdjust=i._getResizerLeftAdjust();d=="week"?l=r.scheduleWeeks.length*i._scheduleWeekWidth:d=="year"?l=i._scheduleYearWidth:d=="month"?l=i._scheduleMonthWidth:d=="day"?l=r.scheduleDays.length*r.perHourWidth*24:d=="hour"&&(l=r.scheduleHours.length*r.perMinuteWidth*i._totalInterval);r.renderBaseline?(r.taskbarHeight+g<=r.rowHeight?(dt=r.taskbarHeight,ot=0):(dt=r.taskbarHeight-g,ot=-4),u=dt,oi=0,f=r.rowHeight-g-5):(u=r.taskbarHeight,f=r.rowHeight-10);e=u/5;o=Math.floor(r.taskbarHeight/2);i._milesStoneWidth=o*2;i._connectorPointWidth=s=u/2;nt=s/2;tt=s-s/2;n.views.helpers(si);r.progressMapping||(this.model.showProgressStatus=!1);r.resourceInfoMapping||(r.showResourceNames=!1);h&&(c=t.buildTag("div","",{},{}),w=h.charAt(0),kt=!0,b="",lt=h.charAt(0)=="#"?n(h)[0].innerHTML:h,lt=lt.replace(/src/gi,i._id+"src"),n(c[0]).html(lt),n(c[0].childNodes).each(function(){var s,f,i,e,o;n(this).hasClass("e-gantt-template-taskbar")?(s="e-gantt-childtaskbar "+n(this).attr("class"),n(this).css({height:u+"px"}).attr("class",s),f="",n(this.childNodes).each(function(){var e,t,i;n(this).hasClass("e-gantt-template-progressbar")?(ri=!0,e="e-gantt-childtaskbar-progress "+n(this).attr("class"),n(this).css({height:r.progressbarHeight*(u/100)+"px",position:"absolute",top:"-1px",left:"-1px"}).attr("class",e),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+t.substr(i+7),f+=t):f+=this.nodeName=="#comment"?"":this.nodeName=="#text"?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),i=n(this).clone().empty()[0].outerHTML,e=i.indexOf("style"),i=i.substr(0,e+7)+"left:{{:left}}px;width:{{:width}}px;"+i.substr(e+7),o=t.browserInfo().name=="msie"&&t.browserInfo().version<9?i.indexOf("<\/"+this.tagName+">"):i.indexOf("<\/"+this.tagName.toLowerCase()+">"),i=i.substr(0,o)+f+i.substr(o),b+=i):b+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),b=b.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));at&&(c=t.buildTag("div","",{},{}),ei=at.charAt(0),ui=!0,k="",vt=ei=="#"?n(at)[0].innerHTML:at,vt=vt.replace(/src/gi,i._id+"src"),n(c[0]).html(vt),n(c[0].childNodes).each(function(){var s,f,i,e,o;n(this).hasClass("e-gantt-template-taskbar")?(n(this).addClass("e-parentTask"),s="e-gantt-parenttaskbar-innerdiv e-parentTask"+n(this).attr("class"),n(this).css({height:u+"px"}).attr("class",s),f="",n(this.childNodes).each(function(){var e,t,i;n(this).hasClass("e-gantt-template-progressbar")?(e="e-gantt-parenttaskbar-progress e-parentTask "+n(this).attr("class"),n(this).css({height:r.progressbarHeight*(u/100)+"px",top:"-1px",left:"-1px",position:"absolute","z-index":"3"}).attr("class",e),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+t.substr(i+7),f+=t):f+=this.nodeName=="#comment"?"":this.nodeName=="#text"?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),i=n(this).clone().empty()[0].outerHTML,e=i.indexOf("style"),i=i.substr(0,e+7)+"left:{{:left}}px;width:{{:width}}px;"+i.substr(e+7),o=t.browserInfo().name=="msie"&&t.browserInfo().version<9?i.indexOf("<\/"+this.tagName+">"):i.indexOf("<\/"+this.tagName.toLowerCase()+">"),i=i.substr(0,o)+f+i.substr(o),k+=i):k+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),k=k.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));yt&&(c=t.buildTag("div","",{},{}),w=yt.charAt(0),fi=!0,h=w=="#"?n(yt)[0].innerHTML:yt,h=h.replace(/src/gi,i._id+"src"),n(c[0]).html(h),n(c[0].childNodes).each(function(){var u,t,i;n(this).hasClass("e-gantt-template-milestone")?(u="e-gantt-milestone "+n(this).attr("class"),n(this).css({width:r.taskbarHeight-3+"px",position:"absolute","z-index":"3"}).attr("class",u),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"left:{{:left}}px;"+t.substr(i+7),it+=t):it+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),it=it.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));y&&(w=y.charAt(0),w=="#"?n(y)[0]&&(ut=n(y)[0].innerHTML):ut=document.getElementById(y)?n("#"+y)[0].innerHTML:y,rt=!0);p&&(w=p.charAt(0),w=="#"?n(p)[0]&&(et=n(p)[0].innerHTML):et=document.getElementById(p)?n("#"+p)[0].innerHTML:p,ft=!0);this.model.leftTaskLabelMapping&&rt==!1&&(a=!0,st=i._getLeftTaskLabel());this.model.rightTaskLabelMapping&&ft==!1&&(v=!0,ht=i._getRightTaskLabel());this.model.taskbarHeight<45&&(wt="<div class='e-connectortouchpoint' style='right:0px;width:20px;margin-top:"+(s-20)/2+"px;height:20px;border-radius:10px'><\/div>",bt="<div class='e-connectortouchpoint' style='left:0px;width:20px;margin-top:"+(s-20)/2+"px;height:20px;border-radius:10px'><\/div>");var gt=Math.round(-((this.model.rowHeight-1)/2)),ni="<tr class='{{:~_rowClassName()}} {{if isSelected && ~_SelectState()}}e-ganttrowcell {{:~_expander()}} e-gantt-mouseclick{{else}}e-ganttrowcell {{:~_expander()}}{{/if}}' id='chartrowcell"+i._id+"' style='display:{{:~_expandStatus(#data)}};background-color:{{if rowBGColor }}{{:rowBGColor}}{{else}} none{{/if}};height:"+r.rowHeight+"px;'>",pt="{{:~_borderRadius()}}";ii="{{if ~_getType()}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{if !isAutoSchedule}}{{if left<manualLeft}}{{:left-10}}{{else}}{{:manualLeft-10}}{{/if}}{{else}}{{:left-10}}{{/if}}px;overflow:hidden;text-overflow: ellipsis;'><div class='e-taskbarname' style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;margin-right:30px;height:"+f+"px;font-weight:bold'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' vertical-align='middle' style='width:"+l+"px;'><div class='e-parentContainer{{if !isAutoSchedule}} e-manualParenttaskbar{{/if}}' style='height:"+(this.model.taskbarHeight-1)+"px;z-index:3;'>{{if !isAutoSchedule}}<div class='e-gantt-manualparenttaskbar {{:~_expander()}}' style='left: {{:left}}px;height:"+e+"px; width: {{:width}}px;'><div class='e-gantt-manualparenttaskbar-left' style='height:"+u+"px;border-left-width:"+e+"px;border-bottom:"+e+"px solid transparent;'><\/div><div class='e-gantt-manualparenttaskbar-right' style='left:{{:width - "+parseInt(e)+"}}px;height:"+u+"px;border-right-width:"+e+"px;border-bottom:"+e+"px solid transparent;'><\/div><div class='taskbarresizer-right' style='left:{{:width -"+e+"}}px;width:"+e+"px;height:"+u+"px;font-size:"+i._fontSize+"px;position:absolute;z-index:10;'><\/div><\/div>{{/if}}{{if "+ui+"}}"+k+"{{else}}<div class='e-gantt-parenttaskbar-innerdiv {{:~_expander()}} e-parentTask' style='margin-top:{{if !isAutoSchedule}}"+e*2+"{{/if}}px;background-color:{{if parentTaskbarBackground }}{{:parentTaskbarBackground}}{{else}} "+this.model.parentTaskbarBackground+"{{/if}}; left:{{if isAutoSchedule}}{{:left}}{{else}}{{:manualLeft}}{{/if}}px;width:{{if isAutoSchedule}}{{:width}}{{else}}{{:manualWidth}}{{/if}}px;height:{{if isAutoSchedule}}"+u+"{{else}}"+e*3+"{{/if}}px;'><div class='e-gantt-parenttaskbar-progress {{:~_expander()}} e-parentTask progressbar' id='progressbar' style='top:-1px;border-style:{{if progressWidth}}solid{{else}}none{{/if}}; left:-1px;width:{{:progressWidth}}px;position:absolute;background-color:{{if parentProgressbarBackground }}{{:parentProgressbarBackground}}{{else}} "+this.model.parentProgressbarBackground+"{{/if}};z-index:3;border-top-right-radius:{{if isAutoSchedule}}"+pt+"{{else}}"+e+"{{/if}}px;border-bottom-right-radius:{{if isAutoSchedule}}"+pt+"{{else}}"+e+"{{/if}}px;height:{{if isAutoSchedule}}"+u+"{{else}}"+e*3+"{{/if}}px;'><\/div><\/div>{{/if}}<\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}<div class='e-baselinebar' style='margin-top:"+ot+"px;left:{{:baselineLeft}}px;width:{{:baselineWidth}}px;height:"+g+"px;background-color: "+ct+";position:absolute;z-index:3;box-sizing:border-box;-moz-box-sizing:border-box;'><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='left:{{if (left+width)>(manualLeft+manualWidth)}}{{:left+width+30}}{{else}}{{:manualLeft+manualWidth+30}}{{/if}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;position:absolute;background-color:transparent;font-weight:bold;height:"+(this.model.rowHeight-1)+"px;'><div class='e-resourcename' style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;outline:none;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{else ~_milestoneMapping()}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{:left-10}}px;overflow:hidden;text-overflow:ellipsis;'><div class='e-taskbarname' style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' style='width:"+l+"px;'><div class='e-gantt-milestone-container' style=height:"+(this.model.taskbarHeight-1)+"px;><div class='e-connectorpoint-left' style='left:{{:left-"+s+"}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px;'>"+wt+"<\/div>{{if "+fi+"}}"+it+"{{else}}<div class='e-gantt-milestone' style='position:absolute;left:{{:left}}px;'><div class='e-gantt-milestone milestone-top' style='border-right-width:"+o+"px;border-left-width:"+o+"px;border-bottom-width:"+o+"px; border-right-color:transparent;border-left-color:transparent;border-style:none solid solid;border-top: none;'><\/div><div class='e-gantt-milestone milestone-bottom' style='top:"+o+"px;border-right-width:"+o+"px; border-left-width:"+o+"px; border-top-width:"+o+"px; border-right-color:transparent;border-left-color:transparent;border-style:solid solid none; border-bottom: none;'><\/div><\/div>{{/if}}<div class='e-connectorpoint-right' style='left:{{:(left+"+o*2+")}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px;'>"+bt+"<\/div><\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate}}<div class='e-baseline-gantt-milestone-container' ><div class='e-baseline-gantt-milestone' style='position:absolute;left:{{:baselineRight}}px;z-index:2;'><div class='e-baseline-gantt-milestone baseline-milestone-top' style='z-index:2;top:"+-this.model.taskbarHeight+"px;border:"+o+"px solid transparent;border-top: none;border-bottom-color: "+ct+";'><\/div><div class='e-baseline-gantt-milestone baseline-milestone-bottom' style='z-index:2;top:"+(o-this.model.taskbarHeight)+"px;border:"+o+"px solid transparent;border-bottom: none;border-top-color: "+ct+";'><\/div><\/div><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='margin-top:5px;left:{{:left+56}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;height:"+(this.model.rowHeight-1)+"px;position:absolute;background-color:transparent;'><div class='e-resourcename' style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{else}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{:left-10}}px;overflow:hidden;text-overflow: ellipsis;'><div class='e-taskbarname' style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' style='width:"+l+"px;'><div class='e-childContainer' style='height:"+(this.model.taskbarHeight-1)+"px;'><div class='e-connectorpoint-left' style='left:{{:left-"+s+"}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px'>"+wt+"<\/div><div class='taskbarresizer-left e-icon' style='left:{{:left+2-"+i._resizerLeftAdjust+"}}px;width:10px;margin-top:"+i._resizerMargin+"px;height:"+u+"px;font-size:"+i._fontSize+"px;'><\/div>{{if "+kt+"}}"+b+"{{else}}<div class='e-gantt-childtaskbar {{if isCritical}} e-criticaltaskbar{{/if}} {{if !isAutoSchedule}} manualchildtaskbar{{/if}}' style='left:{{:left}}px;width:{{:width}}px;height:"+u+"px;background-color:{{if taskbarBackground }}{{:taskbarBackground}}{{else}} "+this.model.taskbarBackground+"{{/if}};'><div class='e-gantt-childtaskbar-progress {{if isAutoSchedule}} progressbar{{else}} manualprogressbar{{/if}} {{if isCritical}} e-criticalprogressbar{{/if}}' id='progressbar' style='border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;text-align:right;line-height:"+(u-1)+"px;height:"+this.model.progressbarHeight*(u/100)+"px; top:-1px;left:-1px;position:absolute;background-color:{{if progressbarBackground }}{{:progressbarBackground}}{{else}} "+this.model.progressbarBackground+"{{/if}};border-top-right-radius:"+pt+"px;border-bottom-right-radius:"+pt+"px;'>{{if "+this.model.showProgressStatus+"}}<span class='e-tasklabel' style='line-height:"+(u-1)+"px'>{{:status}}%<\/span>{{/if}}<\/div><\/div>{{/if}}{{if "+(!kt||ri)+"}}<div class='progressbarresizer-right' style='left:{{:left+progressWidth-10}}px;width:20px;margin-top:"+(u-5)+"px;height:15px;position:absolute;z-index:5;'><div class='progressbarhandler' style='top:10px;position:absolute;z-index:-1;'><div class='e-progresshandler-element'><\/div><\/div><div class='progressbarhandler' style='top:5px;position:absolute;z-index:-1;'><div class='e-progresshandlerafter-element'><\/div><\/div><\/div>{{/if}}<div class='taskbarresizer-right e-icon' style='left:{{:left+width-"+i._resizerRightAdjust+"}}px;width:10px;height:"+u+"px;font-size:"+i._fontSize+"px;position:absolute;z-index:2;margin-top:"+i._resizerMargin+"px;'><\/div><div class='e-connectorpoint-right' style='left:{{:left+width}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px'>"+bt+"<\/div><\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}<div class='e-baselinebar' style='margin-top:"+ot+"px;left:{{:baselineLeft}}px;width:{{:baselineWidth}}px;height:"+g+"px;background-color: "+ct+";position:absolute;z-index:3;box-sizing:border-box;-moz-box-sizing:border-box;'><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='left:{{:left+width+30}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;height:"+(this.model.rowHeight-1)+"px;position:absolute;text-align:left;background-color:transparent;'><div class='e-resourcename' style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{/if}}";ni+=ii;ni+="<\/tr>";ti={};ti[this._id+"_CustomTemplate2"]=ni;n.templates(ti)},_getResourceInfo:function(n){var t=null,u,i,r;if(n.resourceInfo!=null){if(u=n.resourceInfo.length,u>0){for(i=0;i<u;i++)r=n.resourceInfo[i][this.model.resourceUnitMapping],t==null?(t=n.resourceInfo[i][this.model.resourceNameMapping],r!=100&&(t+="["+r+"%]")):(t+=" , "+n.resourceInfo[i][this.model.resourceNameMapping],r!=100&&(t+="["+r+"%]"));return t}return String.empty}return String.empty},_getrowClassName:function(){var n="gridrowtaskId",t=this;return t.data.parentItem&&(n+=t.data.parentItem.taskId.toString()),n+="level",n+t.data.level.toString()},_getExpandStatusRecord:function(n){var t=this;return t._getExpandStatus(n)?"table-row":"none"},_isMilestone:function(){return this.data.isMilestone?!0:!1},_addRecordExpandCollapse:function(){return this.data.expanded?"e-chartexpand":!this.data.expanded&&this.data.hasChildRecords?"e-chartcollapse":!1},_getTypedata:function(){return this.data.hasChildRecords},_getBorderRadius:function(){var n=this,t=n.data.width-n.data.progressWidth;return t<=4?4-t:0},_getHeightValue:function(){return this.data.ParentIndex*this.data.RowHeight>this.data.ChildIndex*this.data.RowHeight?this.data.ParentIndex*this.data.RowHeight-this.data.ChildIndex*this.data.RowHeight:this.data.ChildIndex*this.data.RowHeight-this.data.ParentIndex*this.data.RowHeight},_createConnectorLineTemplate:function(){var u=this,t=u.model.connectorlineWidth>4?4:u.model.connectorlineWidth,o,r,i=u.model.connectorLineBackground,h={_getWidthVal:u._getWidth,_getTop:u._getPredecessorTop,_getPosition:u._getParentPosition,_setContainerWidthSSType2:u._getContainerWidthSSType2,_setInnerChildWidthSSType2:u._getInnerChildWidthSSType2,_setInnerElementLeftSSType2:u._getInnerElementLeftSSType2,_setInnerElementWidthSSType2:u._getInnerElementWidthSSType2,_isMilestone:u._isTaskMilestone,_isMilestoneParent:u._isMilestoneParent,_getHeightValue:u._getHeightValue},f,s,e;u.model.renderBaseline?(o=0,r=u.model.rowHeight/2-o):r=u.model.rowHeight/2;n.views.helpers(h);f="<div id='ConnectorLine{{:ConnectorLineId}}' style='background-color=black'>";s="{{if ~_getPosition()=='FSType1'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:(ChildLeft - (ParentLeft + ParentWidth + 20))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType1'><div class='e-line' style='left:{{if milestoneParent}}-7px{{else}}0px{{/if}};width:{{if milestoneParent}}{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-2}}px{{else}}{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px{{/if}};border-top:"+t+"px solid "+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px;width:0px;border-right:"+t+"px solid "+i+";border-top:{{:~_getHeightValue()-"+t+"}}px solid "+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px;width:10px;border-top:"+t+"px solid "+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth + 10))}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FSType2'}}<div style='left:{{:ParentLeft}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:~_getWidthVal()}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType2'><div class='e-line' style='left:{{if milestoneParent}}{{:ParentWidth-7}}px{{else}}{{:ParentWidth}}px{{/if}};width:{{if milestoneParent}}17px{{else}}10px{{/if}};border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:ParentWidth+10-"+t+"}}px;border-left:"+t+"px solid;width:0px;border-top:{{:~_getHeightValue()-14-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30 )}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:0px;border-top:{{:14-"+t+"}}px solid;border-left:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 10))}}px;border-left: 10px solid "+i+";border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;top:{{:-6-"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FSType3'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ParentWidth+ChildWidth}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType3'><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;top:{{:-5-"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='width:"+t+"px;border-top:{{:~_getHeightValue()-14-"+t+"}}px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='width:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30)}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30)}}px;width:0px;border-left:"+t+"px solid;height:{{:14-"+t+"}}px;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 14)}}px;width:16px;{{else}}left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 20)}}px;width:10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><\/div>{{else ~_getPosition()=='FSType4'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:(ChildLeft - (ParentLeft + ParentWidth + 20))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType4'><div class='connectorline-rightarrow' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth + 10))}}px;border-left: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth) - 20)}}px;top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;left:{{:(ChildLeft - (ParentLeft + ParentWidth) - 20)}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;{{/if}}top:-13px;width:{{if ~_isMilestoneParent()}}{{:(ChildLeft-(ParentLeft + ParentWidth+20 )+ 6)+"+t+"}}px;{{else}}{{:(ChildLeft-(ParentLeft + ParentWidth + 20))+"+t+"}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType4'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ChildLeft-ParentLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType4'><div class='connectorline-rightarrow' style='left:{{:ChildLeft-ParentLeft}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:ChildLeft-ParentLeft}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType3'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ParentLeft-ChildLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType3'><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:ParentLeft-ChildLeft+20}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType2'}}<div style='left:{{:~_setInnerElementLeftSSType2()}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:~_setContainerWidthSSType2()}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType2'><div class='e-line' style='width:{{:~_setInnerChildWidthSSType2()}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:{{:~_setInnerElementWidthSSType2()}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:~_setInnerElementWidthSSType2()}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType1'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:ParentLeft-ChildLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType1'><div class='e-line' style='width:{{:ParentLeft-ChildLeft+20}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType1'}}<div class='FFtype1' style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft + ChildWidth)-(ParentLeft + ParentWidth))+30}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType1'><div class='e-line' style='left:{{if ~_isMilestoneParent()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))-10}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))}}px;{{/if}}width:{{if ~_isMilestoneParent()}}30px;{{else}}20px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestoneParent()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;{{/if}}width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}4px;{{else}}10px;{{/if}}width:{{if ~_isMilestone()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+16}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+10}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType2'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType2'><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;{{/if}}width:{{if ~_isMilestoneParent()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+26}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+4}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+10}}px;{{/if}}width:{{if ~_isMilestone()}}16px;{{else}}10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))-6}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType3'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType3'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:4px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+16}}px;{{else}}left:10px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+10}}px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))-6}}px;width:26px;{{else}}left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))}}px;width:20px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType4'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType4'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))-6}}px;{{else}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+4}}px;width:16px;{{else}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+10}}px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+26}}px;{{else}}width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType4'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType4'><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+4}}px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+10}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+14}}px;width:16px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType3'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft)-(ChildLeft + ChildWidth))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType3'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:4px;width:16px;{{else}}left:10px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:20px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:20px;top:-13px;width:{{:(ChildLeft-(ParentLeft + ParentWidth + 20))+"+t+"}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType1'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:ChildLeft+ChildWidth+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType1'><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;width:0px;border-left:"+t+"px solid;border-top:{{:15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+(15-"+t+")}}px;width:16px;{{else}}left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;width:10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+4}}px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+10}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType2'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType2'><div class='e-line' style='left:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:0px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;{{else}}left:10px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))-20}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}-6px;{{else}}0px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{/if}}";f+=s;f+="<\/div>";e={};e[this._id+"ConnectorLineTemplate"]=f;n.templates(e)},_isTaskMilestone:function(){return this.data.milestoneChild?!0:!1},_isMilestoneParent:function(){return this.data.milestoneParent?!0:!1},_getInnerChildWidthSSType2:function(){return this.data.ParentLeft+this.data.ParentWidth<this.data.ChildLeft?10:this.data.ParentLeft==this.data.ChildLeft?20:this.data.ParentLeft+this.data.ParentWidth>=this.data.ChildLeft?10:this.data.ChildLeft-this.data.ParentLeft},_getInnerElementLeftSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?this.data.ParentLeft-20:this.data.ParentLeft-10},_getInnerElementWidthSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?10:this.data.ChildLeft-this.data.ParentLeft},_getContainerWidthSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?20:this.data.ChildLeft-this.data.ParentLeft},_getPredecessorTop:function(){return this.data.ParentIndex>this.data.ChildIndex?!0:!1},_getParentPosition:function(){if(this.data.ParentIndex<this.data.ChildIndex){if(this.data.Type=="FF")return this.data.ChildLeft+this.data.ChildWidth>=this.data.ParentLeft+this.data.ParentWidth?"FFType2":"FFType1";if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft>this.data.ParentLeft+this.data.ParentWidth+25){if(this.data.Type=="FS")return"FSType1";if(this.data.Type=="SF")return"SFType1";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="FF")return"FFType2"}else if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft<this.data.ParentLeft+this.data.ParentWidth||this.data.ParentLeft==this.data.ChildLeft||this.data.ParentLeft>this.data.ChildLeft){if(this.data.ParentLeft>this.data.ChildLeft+this.data.ChildWidth+25&&this.data.Type=="SF")return"SFType2";if(this.data.ParentLeft>this.data.ChildLeft){if(this.data.Type=="SS")return"SSType1";if(this.data.Type=="SF")return"SFType1";if(this.data.Type=="FF")return"FFType1"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&this.data.Type=="FF")return"FFType2";if(this.data.Type=="FS")return"FSType2";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="FF")return"FFType1";if(this.data.Type=="SF")return"SFType1"}else if(this.data.ParentLeft<this.data.ChildLeft){if(this.data.Type=="FS")return"FSType2";if(this.data.Type=="FF")return"FFType2";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="SF")return"SFType1"}}else if(this.data.ParentIndex>this.data.ChildIndex)if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FS")return 30>=this.data.ChildLeft-(this.data.milestoneParent?this.data.ParentLeft+this.data.ParentWidth+4:this.data.ParentLeft+this.data.ParentWidth)?"FSType3":"FSType4";if(this.data.ParentLeft<this.data.ChildLeft||this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="SS")return"SSType4";if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&this.data.Type=="FF")return"FFType4"}else if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft<this.data.ParentLeft+this.data.ParentWidth||this.data.ParentLeft==this.data.ChildLeft||this.data.ParentLeft>this.data.ChildLeft){if(this.data.ChildLeft+this.data.ChildWidth<=this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FF")return"FFType3";if(this.data.Type=="SF")return this.data.ChildLeft+this.data.ChildWidth+25<this.data.ParentLeft?"SFType3":"SFType4";if(this.data.Type=="SS")return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4";if(this.data.Type=="SS")return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}if(this.data.Type=="FS")return"FSType3"}else if(this.data.ParentLeft<this.data.ChildLeft){if(this.data.Type=="FS")return"FSType3";if(this.data.Type=="SS")return"SSType4";if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4"}return!1},_getWidth:function(){return this.data.ChildLeft+this.data.ChildWidth<this.data.ParentLeft+this.data.ParentWidth?this.data.ParentWidth:this.data.ChildWidth+this.data.ParentWidth},_renderWeekends:function(){for(var n=this,l=n.model,i=0,o=n.model.perDayWidth+1,r=n.model.updatedRecords.length*this.model.rowHeight,a=n.model.scheduleWeeks.length,s,h,u=t.buildTag("div.e-secondary_canvas","",{height:r+"px"},{}),f=l.scheduleHeaderSettings.weekStartDay,v=f>=0&&f<7?f:0,e=6-v,y=e+1==7?0:e+1,c=0;c<a;c++)s=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*y+"px",width:o+"px",height:r+"px","background-color":this.model.weekendBackground},{}),h=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*e+"px",width:o+"px",height:r+"px","background-color":this.model.weekendBackground},{}),u.append(s),u.append(h),i=i+this._scheduleWeekWidth;n._$weekendsContainer.html(u);n._$bodyContent.append(n._$weekendsContainer)},_renderStripLines:function(n){for(var u,h,r=this,f=r.model.updatedRecords.length*this.model.rowHeight,c=n.length,e,o,l=r.model.projectStartDate,a=this.model.perDayWidth,s=t.buildTag("div.e-stripLines","",{height:f+"px"},{}),i=0;i<c;i++)e=this._getDateFromFormat(n[i].day),o=(e-this._getDateFromFormat(l))/864e5*a,n[i].lineWidth=n[i].lineWidth>30?30:n[i].lineWidth,u=t.buildTag("div.e-stripline#stripline"+[i]+"","",{left:o+"px",width:"1px",height:f+"px","border-left-width":n[i].lineWidth+"px","border-left-color":n[i].lineColor,"border-left-style":n[i].lineStyle},{}),h=t.buildTag("span.e-striplinespan",n[i].label,{"background-color":n[i].lineColor},{}),n[i].day&&n[i].day.length>0&&(n[i].label&&n[i].label.length>0&&u.append(h),s.append(u));r._$stripLineContainer.append(s);r._$bodyContent.append(r._$stripLineContainer)},_getProgressWidth:function(n,t){return n*t/100},_getProgressPercent:function(n,t){return Math.ceil((t/n*100).toFixed(2))},_renderHoliday:function(n){var i=this,a=i.model.scheduleHeaderSettings.scheduleHeaderType,c=this._getDateFromFormat(n.day),v=i.model.scheduleWeeks.length,y=i.model.scheduleMonths.length,p=i.model.scheduleYears.length,w=i.model.scheduleDays.length,o=0,u,s,f,e,l=i.model.updatedRecords.length,h,r;o=(c-this._getDateFromFormat(i.model.projectStartDate))/864e5*this.model.perDayWidth;h=l*this.model.rowHeight;u=n.label!=null?n.label.length:0;n.background==null&&(n.background="white");r=".e-holiday-label";t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(r=".e-holiday-label-ie8");s=i.model.scheduleHeaderSettings.scheduleHeaderType!="day"?t.buildTag("div"+r,n.label,{top:i._getHolidayLabelHeight(u)+"px"},{}):t.buildTag("div"+r,n.label,{bottom:i._getHolidayLabelHeight(u)+"px"},{});f=t.buildTag("div.e-secondary-canvas-holiday");e=t.buildTag("div.e-holidays","",{left:o+"px",width:i.model.perDayWidth+"px",height:h+"px","background-color":n.background},{});n.label!=null&&e.append(s);f.append(e);i._$secondaryCanvas.append(f);i._$bodyContent.append(i._$secondaryCanvas)},_getHolidayLabelHeight:function(){var n=this,r=n.model,t=n._getHeight(),i=r.updatedRecords.length*n.model.rowHeight;return t>0?t/2:n._viewportHeight<i?n._viewportHeight/2:i/2},_destroy:function(){var t=this;t.element.off();n(document.body).unbind("touchmove",n.proxy(t.handleMouseMove,t));n(document).unbind("mouseup",n.proxy(t._tooltipMouseup,t));n(document.body).bind("touchmove",n.proxy(t.handleMouseMove,t));t.element.empty().removeClass("e-ganttchart-core e-ganttchart"+t.model.cssClass)}});t.GanttChart.contextMenuItem={taskDetails:"Task Details....",add:"Add new task",indent:"Indent",outdent:"Outdent",Delete:"Delete"};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}}}(jQuery,Syncfusion),function(n,t){t.widget("ejRadialMenuBase","ej.RadialMenuBase",{_tags:[{tag:"items",attr:["imageName","imagePath","imageUrl","windows.text","flat.text","text","click","touch","enabled","badge.enabled","badge.value","type","sliderSettings.ticks","sliderSettings.strokeWidth","sliderSettings.labelSpace",[{tag:"items",attr:["imageName","imagePath","imageUrl","windows.text","flat.text","text","click","touch","enabled"]}]]}],defaults:{radius:150,cssClass:"",enableAnimation:!0,open:null,close:null,items:[]},dataTypes:{radius:"number",enableAnimation:"boolean",items:"array"},_initialization:function(){var t,i;if(this.element.addClass(this.model.cssClass),this._svgLink="http://www.w3.org/2000/svg",this.model.items.length<1)for(this._radialItems=n(this.element.find(">ul").children()),t=0;t<this._radialItems.length;t++)if(this.model.items.push(this._itemsObjectCollection(n(this._radialItems[t]))),n(this._radialItems[t]).find("ul").children().length>0)for(this._nestedRadialItems=n(this._radialItems[t]).find("ul").children(),this.model.items[t].items=[],i=0;i<this._nestedRadialItems.length;i++)this.model.items[t].items.push(this._itemsObjectCollection(n(this._nestedRadialItems[i])));this._itemCount=this.model.items.length;n(this.element.children()).remove();this._startXY=this.model.radius;this._diameter=2*this.model.radius},_itemsObjectCollection:function(t){var i={},r={};return n(this._tags[0].attr).each(function(n,u){var f,e,o;typeof u=="string"&&(f=u.split("."),f.length==1?i[u]=t.attr("data-ej-"+u):(e=f[0],o=f[1],i[e]||(r={}),r[o]=t.attr("data-ej-"+u.replace(".","-")),i[e]=r))}),i},_createSVGElement:function(){var t=document.createElementNS(this._svgLink,"svg");return this.model.radius!=null&&(t.setAttribute("width",this._diameter),t.setAttribute("height",this._diameter)),n(t)},_createGroupElement:function(t){var i=document.createElementNS(this._svgLink,"g");return t&&i.setAttribute("id",t),n(i)},_createImageElement:function(n,i,r,u,f){if(!t.isNullOrUndefined(r.imageUrl)||!t.isNullOrUndefined(r.imagePath))return imgLoc=r.imageUrl?r.imageUrl:this.model.renderMode.toLowerCase()!="flat"?r.imagePath+"/"+this.model.renderMode.toLowerCase()+"/"+r.imageName:r.imagePath+"/"+this.model.renderMode.toLowerCase()+"/"+r.imageName,image=document.createElementNS(this._svgLink,"image"),image.setAttribute("width",n),image.setAttribute("height",i),image.setAttributeNS("http://www.w3.org/1999/xlink","href",imgLoc),image.setAttribute("x",u),image.setAttribute("y",f),image},_createTextElement:function(n,t,i,r){var u=document.createElementNS(this._svgLink,"text");return u.setAttribute("x",n),u.setAttribute("y",t),u.setAttribute("class",i),u.textContent=r,u},_createPathElement:function(n,t,i){var r=document.createElementNS(this._svgLink,"path");return r.setAttribute("index",n),r.setAttribute("d",t),r.setAttribute("class",i),r},_createPolygonElement:function(n,t){var i=document.createElementNS(this._svgLink,"polygon");return i.setAttribute("points","10,10 0,10 5,5"),i.setAttribute("index",n),i.setAttribute("fill","#FFFFFF"),i.setAttribute("transform",t),i},_createCircleElement:function(n,t,i,r){var u=document.createElementNS(this._svgLink,"circle");return u.setAttribute("cx",n),u.setAttribute("cy",t),u.setAttribute("r",i),u.setAttribute("class",r),u},_calculateRadialArc:function(n,t,i,r,u){for(var a,l,h=0,e=2*Math.PI*h,o=2*Math.PI*(h+1/n),s=.5*t*Math.min(this._diameter,this._diameter),v=i*t*Math.min(this._diameter,this._diameter),c=r*s,y=u*s,p=360/n,w=p/2,b=[],k=[],d=[],g=[],nt=[],tt=[],it=[],rt=[],ut=[],ft=[],et=[],ot=[],st=[],ht=[],f=0;f<n;f++)a=-.5*Math.PI,e=e+a,o=o+a-1e-6,ht[f]=o-e<Math.PI?0:1,l=(e+o)/2,b[f]=this._startXY+s*Math.cos(e),k[f]=this._startXY+s*Math.sin(e),d[f]=this._startXY+s*Math.cos(o),g[f]=this._startXY+s*Math.sin(o),nt[f]=this._startXY+v*Math.cos(l),tt[f]=this._startXY+v*Math.sin(l),it[f]=this._startXY+c*Math.cos(e),rt[f]=this._startXY+c*Math.sin(e),ut[f]=this._startXY+c*Math.cos(o),ft[f]=this._startXY+c*Math.sin(o),et[f]=this._startXY+y*Math.cos(l),ot[f]=this._startXY+y*Math.sin(l),st[f]=w,h+=1/n,e=2*Math.PI*h,o=2*Math.PI*(h+1/n),w+=p;return{x1:b,y1:k,x2:d,y2:g,midx:nt,midy:tt,dStartX:it,dStartY:rt,dEndX:ut,dEndY:ft,dmidx:et,dmidy:ot,deg:st,longArc:ht,radius:s,dradius:c}},_renderRadialMenu:function(){var n,l,a;this._radialSVG=this._createSVGElement();this._radialChildSVG=this._createSVGElement();this._childArcGroup=this._createGroupElement("childarcgroup");this._polygonGroup=this._createGroupElement("polygongroup");this._polygonGroup.attr("transform","translate(-10,-10)");this._radialArcGroup=this._createGroupElement("outerarcpathgroup");this._menuItemsArcGroup=this._createGroupElement("arcpathgroup");this._menuItemsGroup=this._createGroupElement("menuitemsgroup");this._menuItemsGroup.attr("transform","translate(-10,-5)");this._menuItemsArcPaths=this._createGroupElement("menuitemsarcpaths");this._menuItemsPaths=this._createGroupElement("itemspathgroup");this._radialSVGDiv=t.buildTag("div#"+this._id+"_svgdiv."+this._prefix+"abs").css("height",this._diameter);this._radialCircleSVGDiv=t.buildTag("div#"+this._id+"_circlesvgdiv."+this._prefix+"abs "+this._prefix+"displaynone");this._radialChildSVGDiv=t.buildTag("div#"+this._id+"_childsvgdiv."+this._prefix+"abs "+this._prefix+"displaynone");var i=this._calculateRadialArc(this._itemCount,1,.28,.8,.95),r=this._calculateRadialArc(this._itemCount,.79,null,.97,null),u=this._calculateRadialArc(this._itemCount,.8,null,.3,null),f=this._calculateRadialArc(1,1,.28,.8,null),v=this._pathDirection(f.x1[0],f.y1[0],f.radius,f.longArc[0],f.x2[0],f.y2[0],f.dEndX[0],f.dEndY[0],f.dradius,f.dStartX[0],f.dStartY[0]),h=20;for(n=0;n<this._itemCount;n++){var c=this._pathDirection(i.x1[n],i.y1[n],i.radius,i.longArc[n],i.x2[n],i.y2[n],i.dEndX[n],i.dEndY[n],i.dradius,i.dStartX[n],i.dStartY[n]),y=this._pathDirection(r.x1[n],r.y1[n],r.radius,r.longArc[n],r.x2[n],r.y2[n],r.dEndX[n],r.dEndY[n],r.dradius,r.dStartX[n],r.dStartY[n]),p=this._pathDirection(u.x1[n],u.y1[n],u.radius,u.longArc[n],u.x2[n],u.y2[n],u.dEndX[n],u.dEndY[n],u.dradius,u.dStartX[n],u.dStartY[n]),e=this.model.items[n],o=this._createGroupElement(),s=this._enableItem(e,o);this._menuItemsArcPaths.append(this._createPathElement(n,y,""+this._prefix+"arcbgcolor"));this._menuItemsPaths.append(this._createPathElement(n,p,s.itemPathClass));this._menuItemsArcGroup.append(this._createPathElement(n,c,s.arcPathClass));o.attr({cursor:"context-menu",index:n});o.append(this._createImageElement(h,h,e,i.midx[n],i.midy[n]-h/2));o.append(this._createTextElement(i.midx[n]+10,i.midy[n]+25,s.textClass,s.dataText));e.badge&&(e.badge.enabled=="true"||e.badge.enabled==!0)&&o.append(this._createCircleElement(i.midx[n]+25,i.midy[n]-10,10,""+this._prefix+"badgecircle")).append(this._createTextElement(i.midx[n]+25,i.midy[n]-7,""+this._prefix+"badgetext",e.badge.value));this._menuItemsGroup.append(o);(e.items||e.type&&e.type.toLowerCase()==(this.model.renderMode?t.mobile:t).RadialMenu.ItemType.Slider)&&(l=i.deg[n]>270?"translate("+(i.dmidx[n]+5)+","+(i.dmidy[n]+15)+")rotate("+i.deg[n]+")":"translate("+(i.dmidx[n]+10)+","+(i.dmidy[n]+10)+")rotate("+i.deg[n]+")",this._childArcGroup.append(this._createPathElement(n,c,""+this._prefix+"childdefault")),this._polygonGroup.append(this._createPolygonElement(n,l)))}a=this._createCircleElement(this._startXY,this._startXY,this._startXY/3.5,""+this._prefix+"circlebgcolor");this._radialArcGroup.append(this._createPathElement(1,v,""+this._prefix+"outerdefault"));this._radialChildSVG.append(this._menuItemsPaths).append(this._menuItemsArcGroup).append(this._childArcGroup).append(this._polygonGroup).append(this._menuItemsArcPaths).append(this._menuItemsGroup).append(a);this._radialContainer.append(this._radialSVGDiv.append(this._radialCircleSVGDiv.append(this._radialSVG.append(this._radialArcGroup))).append(this._radialChildSVGDiv.append(this._radialChildSVG)))},_ejMenuBaseItemsRemove:function(){this._menuChildSVGDiv=t.buildTag("div#"+this._id+"_menuchildsvgdiv."+this._prefix+"abs");this.model.enableAnimation?(this._radialChildSVGDiv.removeClass(""+this._prefix+"radialshow").addClass(""+this._prefix+"scalehide"),this._radialChildAnimate(),this._menuChildSVGDiv.addClass(""+this._prefix+"scaleshow")):this._radialChildSVGDiv.addClass(""+this._prefix+"displaynone");this._radial.removeClass(this.model.imageClass).addClass(""+this._prefix+"backarrow "+this.model.backImageClass+"")},_renderRadialChildMenu:function(n){var t,c;this._menuChildSVG=this._createSVGElement();this._childItemsGroup=this._createGroupElement("childitemsgroup");this._childItemsGroup.attr("transform","translate(-10,-10)");this._childItemArcGroup=this._createGroupElement();this._childItemsArcPaths=this._createGroupElement("childitemsarcpaths");this._childItemsPaths=this._createGroupElement();var e=n.items.length,i=this._calculateRadialArc(e,1,.28,.8,null),r=this._calculateRadialArc(e,.79,null,.97,null),u=this._calculateRadialArc(e,.8,null,.3,null),s=20;for(t=0;t<e;t++){var l=this._pathDirection(i.x1[t],i.y1[t],i.radius,i.longArc[t],i.x2[t],i.y2[t],i.dEndX[t],i.dEndY[t],i.dradius,i.dStartX[t],i.dStartY[t]),a=this._pathDirection(r.x1[t],r.y1[t],r.radius,r.longArc[t],r.x2[t],r.y2[t],r.dEndX[t],r.dEndY[t],r.dradius,r.dStartX[t],r.dStartY[t]),v=this._pathDirection(u.x1[t],u.y1[t],u.radius,u.longArc[t],u.x2[t],u.y2[t],u.dEndX[t],u.dEndY[t],u.dradius,u.dStartX[t],u.dStartY[t]),f=this._createGroupElement(),h=n.items[t],o=this._enableItem(h,f);this._childItemArcGroup.append(this._createPathElement(t,l,o.arcPathClass));this._childItemsArcPaths.append(this._createPathElement(t,a,""+this._prefix+"arcbgcolor"));this._childItemsPaths.append(this._createPathElement(t,v,o.itemPathClass));f.attr({cursor:"context-menu",index:t});f.append(this._createImageElement(s,s,h,i.midx[t],i.midy[t]-s/2));f.append(this._createTextElement(i.midx[t]+10,i.midy[t]+25,o.textClass,o.dataText));this._childItemsGroup.append(f)}c=this._createCircleElement(this._startXY,this._startXY,this._startXY/3.5,""+this._prefix+"circlebgcolor");this._radialSVGDiv.append(this._menuChildSVGDiv.append(this._menuChildSVG.append(this._childItemsPaths).append(this._childItemArcGroup).append(this._childItemsArcPaths).append(this._childItemsGroup).append(c)))},_radialSliderHandler:function(n){this.updateBadgeValue(this._index,n.value);this._data={value:n.value,oldValue:n.oldValue,index:this._index};this._eventsTrigger(this._data,this.model.renderMode?"touch":"click")},_isRSText:function(n){return n==this._prefix+"ticks-text"||n==this._prefix+"dynamic-text"?!0:!1},_pathDirection:function(n,t,i,r,u,f,e,o,s,h,c){return"M "+n+" "+t+" A "+i+" "+i+" 0 "+r+" 1 "+u+" "+f+" L "+e+" "+o+" A "+s+" "+s+" 1 "+r+" 0 "+h+" "+c+" z"},_enableItem:function(n,t){var u=this._prefix+"itembgcolor",f=this._prefix+"default",i=""+this._prefix+"textcolor",r=this.model.renderMode?n[this.model.renderMode].text:n.text;return n.enabled=="false"||n.enabled==!1?(t.attr("class",this._prefix+"itemdisabled"),{itemPathClass:this._prefix+"itembgcolor "+this._prefix+"pathdisabled",arcPathClass:this._prefix+"default "+this._prefix+"pathdisabled",dataText:r,textClass:i}):{itemPathClass:u,arcPathClass:f,dataText:r,textClass:i}},_windowsMenuShow:function(){this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"displaynone "+this._prefix+"radialhide").addClass(this._prefix+"radialshow"),this._radialChildSVGDiv.removeClass(this._prefix+"displaynone "+this._prefix+"radialhide").addClass(this._prefix+"radialshow")):(this._radialCircleSVGDiv.removeClass(this._prefix+"displaynone"),this._radialChildSVGDiv.removeClass(this._prefix+"displaynone"));this._openCloseTrigger("open")},_windowsMenuHide:function(n){this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"radialshow").addClass(this._prefix+"radialhide"),this._radialChildSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"scaleshow").addClass(this._prefix+"radialhide"),setTimeout(function(){n._radialCircleSVGDiv.addClass(n._prefix+"displaynone");n._radialChildSVGDiv.addClass(n._prefix+"displaynone")},160)):(this._radialCircleSVGDiv.addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.addClass(this._prefix+"displaynone"));this._openCloseTrigger("close")},_windowsInnerMenuHide:function(n){this._radial.removeClass(this._prefix+"backarrow "+this.model.backImageClass+"").addClass(this.model.imageClass);this.model.enableAnimation?(this._menuChildSVGDiv.removeClass(this._prefix+"scaleshow").addClass(this._prefix+"scalehide"),setTimeout(function(){n._menuChildSVGDiv.remove()},150),setTimeout(function(){n._radialChildSVGDiv.removeClass(n._prefix+"scalehide "+n._prefix+"displaynone").addClass(n._prefix+"scaleshow")},200)):(this._menuChildSVGDiv.remove(),this._radialChildSVGDiv.removeClass(this._prefix+"displaynone"))},_eventsTrigger:function(n,t){var i=this.model[t];this.model[t]=this._childTarget&&this.model.items[n.index].items[n.childIndex][t]?this.model.items[n.index].items[n.childIndex][t]:!this._childTarget&&this.model.items[n.index][t]?this.model.items[n.index][t]:this.model[t];this.model[t]&&this._trigger(t,n);this.model[t]=i},_openCloseTrigger:function(n){this.model[n]&&this._trigger(n)},_menuEnabledDisabled:function(t,i){var r=this;n.isArray(t)&&n.each(t,function(t,u){n.isArray(u)?n.each(u,function(t,f){n.isArray(f)?n.each(f,function(n,t){r.model.items[u].items[t].enabled=i=="disabled"?!1:!0}):((!r.model.renderMode||r.model.renderMode&&(r.model.renderMode=="windows"||r.model.renderMode=="flat"))&&r._menuItems(r,f,i),u=f)}):r._menuItems(r,u,i)})},_ejMenuItem:function(i,r,u){var f=n(this._menuItemsGroup.find("g")[r]),e=n(this._menuItemsPaths.find("path")[r]),o=n(this._radialChildSVGDiv.find("#arcpathgroup path")[r]);u=="disabled"?(e.attr("class",""+this._prefix+"itembgcolor "+this._prefix+"pathdisabled"),o.attr("class",""+this._prefix+"default "+this._prefix+"pathdisabled"),f.attr("class",""+this._prefix+"itemdisabled"),!t.isNullOrUndefined(this._radialChildSVGDiv)&&n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).length>0&&(n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).attr("class",this._prefix+"itemdisabled"),n(this._radialChildSVGDiv.find("#childarcgroup path[index='"+r+"']")).attr("class",this._prefix+"itemdisabled"))):(e.attr("class",""+this._prefix+"itembgcolor"),o.attr("class",""+this._prefix+"default"),f.removeAttr("class"),!t.isNullOrUndefined(this._radialChildSVGDiv)&&n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).length>0&&n(this._radialChildSVGDiv.find("#polygongroup polygon[index='"+r+"']")).removeAttr("class"),n(this._radialChildSVGDiv.find("#childarcgroup path[index='"+r+"']")).attr("class",this._prefix+"childdefault"))},_ejMenuHide:function(n){this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"radialshow").addClass(this._prefix+"radialhide"),this._radialChildSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"scaleshow").addClass(this._prefix+"radialhide"),setTimeout(function(){n._radialCircleSVGDiv.addClass(n._prefix+"displaynone").removeClass(n._prefix+"radialshow "+n._prefix+"radialhide "+n._prefix+"scaleshow "+n._prefix+"scalehide");n._radialChildSVGDiv.addClass(n._prefix+"displaynone").removeClass(n._prefix+"radialshow "+n._prefix+"radialhide "+n._prefix+"scaleshow "+n._prefix+"scalehide")},160)):(this._radialCircleSVGDiv.addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.addClass(this._prefix+"displaynone"));this._openCloseTrigger("close")},_ejInnerMenuHide:function(n){this._radial.removeClass(this._prefix+"backarrow "+this.model.backImageClass+"").addClass(this.model.imageClass);this.model.enableAnimation?(this._radialCircleSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"radialhide "+this._prefix+"scaleshow "+this._prefix+"scalehide").addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.removeClass(this._prefix+"radialshow "+this._prefix+"radialhide "+this._prefix+"scaleshow "+this._prefix+"scalehide").addClass(this._prefix+"displaynone"),this._menuChildSVGDiv.removeClass(this._prefix+"scaleshow").addClass(this._prefix+"radialhide"),setTimeout(function(){n._menuChildSVGDiv.removeClass(n._prefix+"radialhide").remove()},150)):(this._radialCircleSVGDiv.addClass(this._prefix+"displaynone"),this._radialChildSVGDiv.addClass(this._prefix+"displaynone"),this._menuChildSVGDiv.remove());this._openCloseTrigger("close")},_currentBadgeEle:function(t){return this.model.renderMode=="android"?n(this._imageBadgeGroup.find("g")[t]):n(this._menuItemsGroup.find("g")[t])},_badge:function(n){return this._currentBadgeEle(n).find("."+this._prefix+"badgetext,."+this._prefix+"badgecircle")},show:function(){this.element.removeClass(this._prefix+"displaynone")},hide:function(){this.element.addClass(this._prefix+"displaynone")},showMenu:function(){this._showMenu()},hideMenu:function(){this._hideMenu()},enableItemByIndex:function(n){this._menuItems(this,n,"enabled")},enableItemsByIndices:function(n){this._menuEnabledDisabled(n,"enabled")},disableItemByIndex:function(n){this._menuItems(this,n,"disabled")},disableItemsByIndices:function(n){this._menuEnabledDisabled(n,"disabled")},updateBadgeValue:function(n,t){this.model.items[n].badge.value=t;this._currentBadgeEle(n).children("text."+this._prefix+"badgetext").html(t)},showBadge:function(n){this._badge(n).show()},hideBadge:function(n){this._badge(n).hide()},_setModel:function(n){n.items&&(this.model.items=n.items);this._refresh()},_refresh:function(){this._destroy();this._init()},_destroy:function(){t.listenEvents([document,document],[t.endEvent(),t.startEvent()],[this._targetClick,this._targetDown],!0);this.element.removeAttr("class style").children().remove()}})}(jQuery,Syncfusion),function($,ej){ej.widget("ejRadialMenu","ej.RadialMenu",{_rootCSS:"e-radialmenu",element:null,model:null,validTags:["div"],_setFirst:!0,defaults:{imageClass:"e-radialimage",backImageClass:"e-backimage",targetElementId:null,click:null,select:null,autoOpen:!1,position:{x:null,y:null}},dataTypes:{autoOpen:"boolean"},_init:function(){this._id=this.element[0].id;ej.browserInfo().name=="msie"&&ej.browserInfo().version<9||(this._initialization(),this._prefix="e-",this._renderRadial(),this._wireEvents())},_renderRadial:function(){this._radial=ej.buildTag("div.e-radial e-abs "+this.model.imageClass+"").css({left:this._startXY-22+"px",top:this._startXY-22+"px"});this._radialContainer=ej.buildTag("div.e-rel").css({height:this._diameter,width:this._diameter});this.element.append(this._radialContainer.append(this._radial)).addClass("e-radialmenu e-overlow e-user-select e-abs");this._radialInitialPosition();this._renderRadialMenu();var n=this._childArcGroup.children(),t=this._polygonGroup.children();this._on(n,"mouseenter",this._arcOverHandler);this._on(n,"mouseleave",this._arcOverHandler);this._on(t,"mouseenter",this._arcOverHandler);this._on(t,"mouseleave",this._arcOverHandler);this._itemsEvents(this._menuItemsGroup.children(),this._menuItemsPaths.children(),this._menuItemsArcGroup.children())},_wireEvents:function(){var n=$(document);this._radialClick=$.proxy(this._showMenu,this);this._targetDown=$.proxy(this._targetDownHandler,this);this._targetClick=$.proxy(this._targetClickHandler,this);this._itemClick=$.proxy(this._itemClickHandler,this);ej.listenEvents([this._radial,this._radialSVGDiv,n,n],[ej.endEvent(),ej.endEvent(),ej.endEvent(),ej.startEvent()],[this._radialClick,this._itemClick,this._targetClick,this._targetDown],!1)},_itemsEvents:function(n,t,i){this._on(n,"mouseenter",this._itemOverHandler);this._on(n,"touchstart",this._itemOverHandler);this._on(n,"mouseleave",this._itemOverHandler);this._on(n,"touchend",this._itemOverHandler);this._on(t,"mouseenter",this._itemOverHandler);this._on(t,"touchstart",this._itemOverHandler);this._on(t,"mouseleave",this._itemOverHandler);this._on(t,"touchend",this._itemOverHandler);this._on(i,"mouseenter",this._itemOverHandler);this._on(i,"touchstart",this._itemOverHandler);this._on(i,"mouseleave",this._itemOverHandler);this._on(i,"touchend",this._itemOverHandler)},_showMenu:function(){this._radial.hasClass("e-backarrow")?this._windowsInnerMenuHide(this):this._radialCircleSVGDiv.hasClass("e-displaynone")?this._windowsMenuShow():this._windowsMenuHide(this);this._childTarget=!1},_itemClickHandler:function(e){var targetEle=$(e.target),currentItem;if(targetEle.attr("class")=="e-active"||e.target.tagName=="polygon"||!ej.isNullOrUndefined(e.type)&&e.type=="touchend"&&targetEle.attr("class")=="e-childdefault")if(this._index=parseInt(targetEle.attr("index")),this._ejMenuBaseItemsRemove(),currentItem=this.model.items[this._index],currentItem.type&¤tItem.type.toLowerCase()==ej.RadialMenu.ItemType.Slider){var ticks=currentItem.sliderSettings.ticks?eval(currentItem.sliderSettings.ticks):[8,9,11,13,16,20,26,36,72],value=currentItem.badge.value?parseInt(currentItem.badge.value):10,stroke=currentItem.sliderSettings.strokeWidth?parseInt(currentItem.sliderSettings.strokeWidth):1,labelSpace=currentItem.sliderSettings.labelSpace?parseInt(currentItem.sliderSettings.labelSpace):22;this._menuChildSVGDiv.ejRadialSlider({showInnerCircle:!1,enableAnimation:!1,radius:this.model.radius-29,inline:!0,strokeWidth:stroke,labelSpace:labelSpace,value:value,ticks:ticks,change:$.proxy(this._radialSliderHandler,this)});this._radialSVGDiv.append(this._menuChildSVGDiv)}else this._renderRadialChildMenu(currentItem),this._childTarget=!0,this._itemsEvents(this._childItemsGroup.children(),this._childItemsPaths.children(),this._childItemArcGroup.children());this._eventAction(e);this._event&&(this._eventsTrigger(this._data,"click"),this._eventsTrigger(this._data,"select"));this._event=!1},_eventAction:function(n){var t=$(n.target),u=t.attr("class"),f=n.target.tagName,i,r;u=="e-itembgcolor"||u=="e-default"?(i=t.index(),r=this._childTarget?$(this._childItemsGroup.children()[t.index()]).text():$(this._menuItemsGroup.children()[t.index()]).text(),this._event=!0,this._data=this._childTarget?{index:this._index,childIndex:i,text:r}:{index:i,text:r,childIndex:null}):(f!="text"||this._isRSText(u))&&f!="image"||(i=t.parent().index(),r=t.parent().text(),this._event=!0,this._data=this._childTarget?{index:this._index,childIndex:i,text:r}:{index:i,text:r,childIndex:null})},_radialInitialPosition:function(){this._targetElement=$("#"+this.model.targetElementId+"");this.model.autoOpen?(this.model.position.x!=null&&this.model.position.y!=null?this.element.css({top:this.model.position.y,left:this.model.position.x}):this.model.targetElementId&&this.element.css({top:this._targetElement.height()/2-this.model.radius+"px",left:this._targetElement.width()/2-this.model.radius+"px"}),this.show()):this.hide()},_radialChildAnimate:function(){var n=this;setTimeout(function(){n._radialChildSVGDiv.removeClass("e-scalehide e-scaleshow").addClass("e-displaynone")},150)},_arcOverHandler:function(n){var t=$(n.target),i=parseInt(t.attr("index")),r=$(this._childArcGroup.find("path[index="+i+"]")),u=$(this._polygonGroup.find("polygon[index="+i+"]"));n.type=="mouseenter"?(u.attr("fill","#808080"),t.attr("class")=="e-childdefault"?t.attr("class","e-active"):r.attr("class","e-active")):(u.attr("fill","#FFFFFF"),t.attr("class")=="e-active"?t.attr("class","e-childdefault"):r.attr("class","e-childdefault"))},_itemOverHandler:function(n){var t=$(n.currentTarget).index(),i=this._childTarget?$(this._childItemsArcPaths.children()[t]):$(this._menuItemsArcPaths.children()[t]);n.type=="mouseenter"||n.type=="touchstart"?i.attr("class","e-childdefault"):i.attr("class","e-arcbgcolor")},_targetDownHandler:function(n){var t=$(n.target);!t.hasClass("e-rel")&&$(t.closest(".e-radialmenu")).length&&n.preventDefault()},_targetClickHandler:function(n){var r=$(n.target),u=n.clientX,f=n.clientY,t,i,e=$(r.closest(".e-radialmenu")).length,o=this._radialCircleSVGDiv.hasClass("e-displaynone"),s,h;this.model.targetElementId?(t=this._targetElement.width(),i=this._targetElement.height()):(t=window.innerWidth,i=window.innerHeight);e==0&&$(r.closest(this._targetElement)).length==0&&this.model.targetElementId?o?this.hide():this.hideMenu():this.model.position.x&&this.model.position.y?this.element.css({top:this.model.position.y,left:this.model.position.x}):$(r.closest("div.e-radial")).length==0&&o?(s=u>t-this.model.radius?t-this._diameter:u>this.model.radius?u-this.model.radius:0,h=f>i-this.model.radius?i-this._diameter:f>this.model.radius?f-this.model.radius:0,this.element.css({top:h+"px",left:s+"px"})):e==0&&this.hideMenu()},_menuItems:function(n,t,i){this._ejMenuItem(n,t,i)},_hideMenu:function(){this._radial.hasClass("e-backarrow")?this._ejInnerMenuHide(this):this._ejMenuHide(this)},setPosition:function(n,t){this.element.css({top:t+"px",left:n+"px"});this.show()},menuHide:function(){this._hideMenu()},enableItem:function(n){this._ejMenuEnabledDisabled(n,"enabled")},disableItem:function(n){this._ejMenuEnabledDisabled(n,"disabled")},enableItems:function(n){this._ejMenuEnabledDisabled(n,"enabled")},disableItems:function(n){this._ejMenuEnabledDisabled(n,"disabled")},_ejMenuEnabledDisabled:function(n,t){var i=this,r=$.isArray(n)?n:$.makeArray(n);$.each(r,function(n,r){$.each(i.model.items,function(n,u){u.text.toLowerCase()==r.toLowerCase()&&i._menuItems(this,n,t);u.items&&$.each(u.items,function(n,i){i.text.toLowerCase()==r.toLowerCase()&&(i.enabled=t=="disabled"?!1:!0)})})})}});ej.RadialMenu.ItemType={Default:"default",Slider:"slider"};$.extend(!0,ej.RadialMenu.prototype,ej.RadialMenuBase.prototype)}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};ejSignature=function(n){function t(t,i){return n.call(this),this._rootCSS="e-signature",this.PluginName="ejSignature",this.id="null",this.validTags=["div"],this.model=null,this.defaults={strokeColor:"#000000",height:"100%",width:"100%",enabled:!0,strokeWidth:2,backgroundColor:"#ffffff",showRoundedCorner:!0,saveImageFormat:"png",isResponsive:!1,saveWithBackground:!1,backgroundImage:null,change:null,mouseDown:null,mouseMove:null,mouseUp:null},t&&(t.jquery||(t=$("#"+t)),t.length)?$(t).ejSignature(i).data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype.clear=function(){this.model.saveWithBackground?this._setBackgroundImage(this.model.backgroundImage):this._canvasContext.clearRect(0,0,this._canvasContext.canvas.width,this._canvasContext.canvas.height);this._refresh()},t.prototype.save=function(n){var i,t=navigator.userAgent,u=this._canvas[0].toDataURL("image/"+this.model.saveImageFormat+""),r;i=ej.isNullOrUndefined(n)?Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,6)+"."+this.model.saveImageFormat:n+"."+this.model.saveImageFormat;r=this._dataURLtoBlob(u);t.indexOf("Edge")==-1?t.indexOf("Firefox")!=-1||t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("AppleWebKit")!=-1?this._download(r,i):window.navigator.msSaveOrOpenBlob(r,i):window.navigator.msSaveOrOpenBlob(r,i)},t.prototype._dataURLtoBlob=function(n){for(var i=n.split(","),f=i[0].match(/:(.*?);/)[1],r=atob(i[1]),t=r.length,u=new Uint8Array(t);t--;)u[t]=r.charCodeAt(t);return new Blob([u],{type:f})},t.prototype._download=function(n,t){var r=URL.createObjectURL(n),i=document.createElement("a");i.href=r;i.target="_parent";i.download=t;(document.body||document.documentElement).appendChild(i);i.click();i.parentNode.removeChild(i)},t.prototype.undo=function(){var t=this,n;this.incStep>0&&(this.incStep--,n=new Image,n.src=this.storeSnap[this.incStep],n.onload=function(){var i=document.getElementById(t.element[0].id).children[0],r=i.getContext("2d");r.clearRect(0,0,i.width,i.height);r.drawImage(n,0,0)})},t.prototype.redo=function(){var t=this,n;this.incStep<this.storeSnap.length-1&&(this.incStep++,n=new Image,n.src=this.storeSnap[this.incStep],n.onload=function(){var i=document.getElementById(t.element[0].id).children[0],r=i.getContext("2d");r.clearRect(0,0,i.width,i.height);r.drawImage(n,0,0)})},t.prototype.show=function(){this.element.css("display","block")},t.prototype.hide=function(){this.element.css("display","none")},t.prototype.enable=function(){this.element.removeClass("e-disable").attr({"aria-disabled":!1})},t.prototype.disable=function(){this.element.addClass("e-disable").attr({"aria-disabled":!0})},t.prototype._init=function(){this._initialize();this._render();this._wireEvents(!1)},t.prototype._initialize=function(){this._canvas=ej.buildTag("canvas","",{},{});this.element.append(this._canvas);this._canvas[0].getContext&&(this._canvasContext=this._canvas[0].getContext("2d"));this._setProperties(this.model.backgroundColor);this.model.backgroundImage&&this._setBackgroundImage(this.model.backgroundImage);this.model.saveWithBackground||this._toSaveData();this._resizeCanvas();this._setRoundedCorner(this.model.showRoundedCorner);this.model.enabled||this.disable();this.strokeMinimumWidth=1},t.prototype._setBackgroundImage=function(n){if(this.model.saveWithBackground){var i=this,t=new Image;t.src=n;t.onload=function(){var n=document.getElementById(i.element[0].id).children[0],r=n.getContext("2d");r.globalCompositeOperation="source-over";r.drawImage(t,0,0,n.width,n.height);i._toSaveData()}}else this._canvasContext.canvas.style.backgroundImage="url("+n+")"},t.prototype._setProperties=function(n){ej.isNullOrUndefined(this.model.height&&this.model.width)||this.element.css({height:this.model.height,width:this.model.width});this._canvasContext.canvas.style.backgroundColor=n;this._canvasContext.canvas.style.backgroundSize="100% 100%";this._canvasContext.canvas.style.msTouchAction="none";this._canvasContext.canvas.style.touchAction="none"},t.prototype._resizeCanvas=function(){this._canvasContext.canvas.width=this.element.innerWidth();this._canvasContext.canvas.height=this.element.innerHeight();this._canvasContext.scale(1,1);this.model.isResponsive&&this._restore()},t.prototype._restore=function(){var t=this,n=new Image;ej.isNullOrUndefined(this.incStep)||(n.src=this.storeSnap[this.incStep],n.onload=function(){var i=document.getElementById(t.element[0].id).children[0],r=i.getContext("2d");r.clearRect(0,0,i.width,i.height);r.drawImage(n,0,0,i.width,i.height)})},t.prototype._refresh=function(){this._canvasContext.fillStyle=this.model.strokeColor;this.points=[];this._lastVelocity=0;this._lastWidth=(this.strokeMinimumWidth+this.model.strokeWidth)/2},t.prototype._setModel=function(n){for(var t in n)switch(t){case"height":this._changeHeight(n[t]);break;case"width":this._changeWidth(n[t]);break;case"showRoundedCorner":this._setRoundedCorner(n[t]);break;case"backgroundColor":this._setProperties(n[t]);break;case"backgroundImage":this._setBackgroundImage(n[t]);break;case"enabled":this._disabled(!n[t]);break;case"isResponsive":this._resizeCanvas()}},t.prototype._changeHeight=function(n){this.element.css("height",n.toString());this._changeHeightWidth()},t.prototype._changeWidth=function(n){this.element.css("width",n.toString());this._changeHeightWidth()},t.prototype._changeHeightWidth=function(){this._resizeCanvas();this.model.isResponsive||this._restore()},t.prototype._setRoundedCorner=function(n){n==!0?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},t.prototype._disabled=function(n){n==!0?this.disable():this.enable()},t.prototype._render=function(){this.element.addClass(" e-signature e-select e-widget").attr("role","signature")},t.prototype._drawStartHandler=function(n){if(n.which===1||n.which===0){if(ej.blockDefaultActions(n),this._mouseButtonDown=!0,(ej.browserInfo().name=="chrome"||"webkit")&&n.type=="touchstart"){var t=n.originalEvent.targetTouches[0];this._beginStroke(t)}else this._beginStroke(n);this._on(this._canvas,ej.eventType.mouseMove,this._drawMove);this._on($(document),ej.eventType.mouseUp,this._drawEnd);this._trigger("mouseDown",{value:n})}},t.prototype._drawMoveHandler=function(n){if(ej.blockDefaultActions(n),this._mouseButtonDown)if((ej.browserInfo().name=="chrome"||"webkit")&&n.type=="touchmove"){var t=n.originalEvent.targetTouches[0];this._updateStroke(t)}else this._updateStroke(n);this._trigger("mouseMove",{value:n})},t.prototype._drawEndHandler=function(n){ej.blockDefaultActions(n);this._mouseButtonDown&&(this._mouseButtonDown=!1,this._endStroke());this._off(this._canvas,ej.eventType.mouseMove,this._drawMove);this._toSaveData();this._off($(document),ej.eventType.mouseUp,this._drawEnd);this._trigger("mouseUp",{value:n});this._trigger("change",{isInteraction:!0,lastImage:this.storeSnap[this.incStep]})},t.prototype._toSaveData=function(){if(ej.isNullOrUndefined(this.incStep)?(this.incStep=-1,this.incStep++,this.storeSnap=[]):this.incStep++,this.incStep<this.storeSnap.length&&(this.storeSnap.length=this.incStep),this.incStep>0){var n=ej.buildTag("canvas","",{},{}),t=n[0].getContext("2d");n[0].height=this._canvas.height();n[0].width=this._canvas.width();t.drawImage(this._canvas[0],0,0,n[0].width,n[0].height);this.storeSnap.push(n[0].toDataURL())}else this.storeSnap.push(this._canvas[0].toDataURL())},t.prototype._beginStroke=function(n){this._refresh();this._updateStroke(n)},t.prototype._updateStroke=function(n){var t=this._createPoint(n);this._addPoint(t)},t.prototype._drawStroke=function(n){var t=this._canvasContext,i=(this.strokeMinimumWidth+this.model.strokeWidth)/2;t.beginPath();this._pointDraw(n.x,n.y,i);t.closePath();t.fill()},t.prototype._endStroke=function(){var t=this.points.length>2,n=this.points[0];!t&&n&&this._drawStroke(n)},t.prototype._createDelegates=function(){this._drawStart=$.proxy(this._drawStartHandler,this);this._drawMove=$.proxy(this._drawMoveHandler,this);this._drawEnd=$.proxy(this._drawEndHandler,this)},t.prototype._wireEvents=function(n){var t=n?"off":"on";this._createDelegates();this._on(this._canvas,ej.eventType.mouseDown,this._drawStart);this._wireResizeEvents()},t.prototype._wireResizeEvents=function(){$(window).bind("resize",$.proxy(this._resizeCanvas,this))},t.prototype._destroy=function(){this.element.removeClass("e-signature e-js e-select e-widget").removeAttr("role style signature");this.model.showRoundedCorner&&this.element.removeClass("e-corner");this._off(this._canvas,(ej.eventType.mouseDown,ej.eventType.mouseMove,ej.eventType.mouseUp));$(window).unbind("resize",$.proxy(this._resizeCanvas,this));this.element.empty()},t.prototype._createPoint=function(n){var t=this._canvas[0].getBoundingClientRect();return this._point(n.clientX-t.left,n.clientY-t.top,undefined)},t.prototype._addPoint=function(n){var t=this.points,i,r,u;t.push(n);t.length>2&&(t.length===3&&t.unshift(t[0]),i=this._calculateCurveControlPoints(t[0],t[1],t[2]).cp2,r=this._calculateCurveControlPoints(t[1],t[2],t[3]).cp1,u=this._bezierCurve(t[1],i,r,t[2]),this._addCurve(u),t.shift())},t.prototype._calculateCurveControlPoints=function(n,t,i){var f=n.x-t.x,e=n.y-t.y,o=t.x-i.x,s=t.y-i.y,u={x:(n.x+t.x)/2,y:(n.y+t.y)/2},r={x:(t.x+i.x)/2,y:(t.y+i.y)/2},y=Math.sqrt(f*f+e*e),h=Math.sqrt(o*o+s*s),p=u.x-r.x,w=u.y-r.y,c=h/(y+h),l={x:r.x+p*c,y:r.y+w*c},a=t.x-l.x,v=t.y-l.y;return{cp1:this._point(u.x+a,u.y+v,0),cp2:this._point(r.x+a,r.y+v,0)}},t.prototype._addCurve=function(n){var r=this.startPoint,t,i;t=this._pointVelocityCalc(r);t=.7*t+(.7-1)*this._lastVelocity;i=Math.max(this.model.strokeWidth/(t+1),this.strokeMinimumWidth);this._curveDraw(n,this._lastWidth,i);this._lastVelocity=t;this._lastWidth=i},t.prototype._pointDraw=function(n,t,i){var r=this._canvasContext;r.moveTo(n,t);r.arc(n,t,i,0,2*Math.PI,!1)},t.prototype._curveDraw=function(n,t,i){var l=this._canvasContext,a,y,o,r,s,h,u,c,v,f,e,p=i-t;for(a=Math.floor(this._bezierLengthCalc()),l.beginPath(),o=0;o<a;o++)r=o/a,s=r*r,h=s*r,u=1-r,c=u*u,v=c*u,f=v*this.startPoint.x,f+=3*c*r*this.control1.x,f+=3*u*s*this.control2.x,f+=h*this.endPoint.x,e=v*this.startPoint.y,e+=3*c*r*this.control1.y,e+=3*u*s*this.control2.y,e+=h*this.endPoint.y,y=t+h*p,this._pointDraw(f,e,y);l.closePath();l.fill()},t.prototype._point=function(n,t,i){return this.x=n,this.y=t,this.time=i||(new Date).getTime(),{x:this.x,y:this.y,time:this.time}},t.prototype._pointVelocityCalc=function(n){return this.time!==n.time?Math.sqrt(Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2))/(this.time-n.time):1},t.prototype._bezierCurve=function(n,t,i,r){this.startPoint=n;this.control1=t;this.control2=i;this.endPoint=r},t.prototype._bezierLengthCalc=function(){for(var e=10,o=0,t,i,r,s,h,u,f,n=0;n<=e;n++)t=n/e,i=this._bezierPoint(t,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),r=this._bezierPoint(t,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y),n>0&&(u=i-s,f=r-h,o+=Math.sqrt(u*u+f*f)),s=i,h=r;return o},t.prototype._bezierPoint=function(n,t,i,r,u){return t*(1-n)*(1-n)*(1-n)+3*i*(1-n)*(1-n)*n+3*r*(1-n)*n*n+u*n*n*n},t}(ej.WidgetBase);ej.widget("ejSignature","ej.Signature",new ejSignature);window.ejSignature=null;ej.Signature.SaveImageFormat={PNG:"png",JPG:"jpg",BMP:"bmp",TIFF:"tiff"};__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)};SpellCheck=function(n){function t(){n.apply(this,arguments);this.rootCSS="e-spellcheck";this.PluginName="ejSpellCheck";this._id="null";this.defaults={locale:"en-US",misspellWordCss:"e-errorword",ignoreSettings:{ignoreAlphaNumericWords:!0,ignoreHtmlTags:!0,ignoreEmailAddress:!0,ignoreMixedCaseWords:!0,ignoreUpperCase:!0,ignoreUrl:!0,ignoreFileNames:!0},dictionarySettings:{dictionaryUrl:"",customDictionaryUrl:""},maxSuggestionCount:6,ajaxDataType:"jsonp",ignoreWords:[],contextMenuSettings:{enable:!0,menuItems:[{id:"IgnoreAll",text:"Ignore All"},{id:"AddToDictionary",text:"Add to Dictionary"}]},isResponsive:!0,enableValidateOnType:!1,controlsToValidate:null,actionSuccess:null,actionBegin:null,actionFailure:null,start:null,complete:null,contextOpen:null,contextClick:null,dialogBeforeOpen:null,dialogOpen:null,dialogClose:null,validating:null,targetUpdating:null};this.dataTypes={locale:"string",misspellWordCss:"string",ignoreSettings:{ignoreAlphaNumericWords:"boolean",ignoreHtmlTags:"boolean",ignoreEmailAddress:"boolean",ignoreMixedCaseWords:"boolean",ignoreUpperCase:"boolean",ignoreUrl:"boolean",ignoreFileNames:"boolean"},dictionarySettings:{dictionaryUrl:"string",customDictionaryUrl:"string",customDictionaryPath:"string"},maxSuggestionCount:"number",ajaxDataType:"string",ignoreWords:"array",contextMenuSettings:{enable:"boolean",menuItems:"array"}};this._localizedLabels=null;this._statusFlag=!0;this._words=[];this._inputWords=[];this._controlIds=[];this._control=[];this._targetStatus=!0;this._statusMultiTarget=!1;this._changeAllWords=[];this._subElements=[];this._iframeStatus=!1;this._elementStatus=!0;this._suggestedWordCollection=[];this._ignoreStatus=!0;this.model=this.defaults}return __extends(t,n),t.prototype._init=function(){ej.isNullOrUndefined(this.element)||this._renderSpellCheck()},t.prototype._renderSpellCheck=function(){this._initLocalize();this._renderControls()},t.prototype._initLocalize=function(){this._localizedLabels=this._getLocalizedLabels()},t.prototype._renderControls=function(){var r,t,n,i,u;if(ej.isNullOrUndefined(this.model.controlsToValidate))this._addAttributes(this,this.element);else{for($(this.element).attr("style","display:none"),this._controlIds=this.model.controlsToValidate.split(","),r=!1,t=0;t<this._controlIds.length;t++)if(n=$(this._controlIds[t]),n.length>0)if(r=!0,n.length>1)for(i=0;i<n.length;i++)u=$(n[i]),this._addAttributes(this,u);else this._addAttributes(this,n);this._elementStatus=this._statusFlag=r}this.model.isResponsive&&this._on($(window),"resize",$.proxy(this._resizeSpellCheck,this))},t.prototype._addAttributes=function(n,t){$(t).addClass("e-spellcheck");t[0].spellcheck=!1;n._addEventListeners(n,t)},t.prototype._addEventListeners=function(n,t){n._isIframe(t)?($(t)[0].contentWindow.document.addEventListener("input",function(){n._changeStatus(n)},!1),n.model.contextMenuSettings.enable&&($(t)[0].contentWindow.document.addEventListener("mousedown",function(){n._elementRightClick(n)},!1),$(document)[0].addEventListener("mousedown",function(){n._elementRightClick(n)},!1),$(t)[0].contentWindow.document.addEventListener("keydown",function(t){n._spellValidateOnType(t)},!1))):(t[0].addEventListener("input",function(){n._changeStatus(n)},!1),n.model.contextMenuSettings.enable&&n._on($(document),"mousedown",$.proxy(n._elementRightClick,n)),n._on($(t[0]),"keydown","",this._spellValidateOnType))},t.prototype._changeStatus=function(n){n._statusFlag=!0;ej.isNullOrUndefined(n.model.controlsToValidate)||(n._controlIds=n.model.controlsToValidate.split(","),n._targetStatus=!0)},t.prototype._isIframe=function(n){return $(n)[0].tagName==="IFRAME"},t.prototype._resizeSpellCheck=function(){var n=!ej.isNullOrUndefined(this._spellCheckWindow)&&this._spellCheckWindow.parents().find(".e-spellcheck.e-dialog-wrap"),t=!ej.isNullOrUndefined(this._spellCheckWindow)&&n.length>0&&this._spellCheckWindow.data("ejDialog"),i,r,u;this.model.isResponsive?!ej.isNullOrUndefined(this._spellCheckWindow)&&n.length>0&&this._spellCheckWindow.ejDialog("isOpen")&&(t._dialogPosition(),i=this._spellCheckWindow.find(".e-suggesteditems").data("ejListBox"),i.refresh(!0),r=this._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller"),setTimeout(function(){n.find(".e-dialog-scroller").width(n.width()-2);n.find(".e-suggestionlist .e-content").width(n.find(".e-suggestionlist .e-content").width()-2);r.refresh()},4)):t._dialogPosition();!ej.isNullOrUndefined(this._alertWindow)&&this._alertWindow.data("ejDialog")&&(u=!ej.isNullOrUndefined(this._alertWindow)&&this._alertWindow.data("ejDialog"),u._dialogPosition())},t.prototype.showInDialog=function(){this._statusFlag?this._renderDialogWindow():this._alertWindowRender("show")},t.prototype.validate=function(){var t,n,i,r,u,e,f,o,s;if(this._statusFlag){if(t=[],this.model.contextMenuSettings.enable&&!ej.isNullOrUndefined(this.model.dictionarySettings.dictionaryUrl)){if(n="",this._controlIds.length>0&&!this._currentActiveElement&&this.model.enableValidateOnType||this._controlIds.length>0&&(!this.model.enableValidateOnType||!this._statusMultiTarget)){for(i=0;i<this._controlIds.length;i++)if(r=$(this._controlIds[i]),r.length>0)for(u=0;u<r.length;u++)e=$(r[u]),f="",f=this._elementTextProcess(this,e),n=n===""?n.concat(f):n.concat(" "+f)}else this.model.enableValidateOnType&&this._currentActiveElement?n=this._elementTextProcess(this,$(this._currentActiveElement)):(this._isIframe(this.element)&&$(this.element).contents().find("body").addClass("e-spellcheck"),n=this._elementTextProcess(this,this.element));if(t=this._filteringDiffWords(this,n),this._splitWords(n,this),o={targetSentence:n,requestType:"validate"},this._trigger("actionBegin",o))return!1;t.length>0?this._ajaxRequest(this,t.join(" "),"validateOnType"):t.length!==0||this._ignoreStatus?ej.isNullOrUndefined(this._errorWordDetails)?this.model.enableValidateOnType||this._alertWindowRender("show"):(s=this._filterErrorData(this,this._errorWordDetails),this._validateOnTypeOperations(this,s,n,"validateOnType")):(this._splitInputWords(n,this),t=ej.dataUtil.distinct(this._inputWords),this._ajaxRequest(this,t.join(" "),"validateOnType"))}}else this._alertWindowRender("show")},t.prototype._filteringDiffWords=function(n,t){var f=n._inputWords,r=[],i,e,u;for(n._splitInputWords(t,n),i=n._inputWords,u=0;u<i.length;u++)e=f.indexOf(i[u]),e===-1&&r.push(i[u]);return i.length!==f.length&&r.length!==0&&i.length===r.length&&(r=i),r},t.prototype._elementTextProcess=function(n,t){return this.model.contextMenuSettings.enable&&this.model.enableValidateOnType&&(this._controlIds.length>0?t[0].nodeType==9&&t[0].nodeName=="#document"&&(t=$(this._controlIds[0])):t=$(this.element[0])),n._isIframe(t)?$(t).contents().find("body").text():ej.isNullOrUndefined($(t)[0].value)?($(t)[0].innerText||$(t)[0].textContent).trim():$(t)[0].value.trim()},t.prototype._splitWords=function(n,t){var i=n.split(/[^0-9a-zA-Z\'_]/);i=i.filter(function(n){return/\S/.test(n)});t._words=i},t.prototype._splitInputWords=function(n,t){var i=n.split(" ");t._inputWords=i},t.prototype.spellCheck=function(n,t){var i={targetSentence:n,misspelledWordCss:t,requestType:"spellCheck"};if(this._trigger("actionBegin",i))return!1;this._misspelledWordCss=t;this._ajaxRequest(this,n,"spellCheck")},t.prototype.ignoreAll=function(n,t){var i;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""?!1:(i={ignoreWord:n,targetContent:t,requestType:"ignoreAll"},this._trigger("validating",i))?!1:(this.model.ignoreWords.push(n),this._updateErrorContent(n,t,null,"ignoreAll",null))},t.prototype.ignore=function(n,t,i){var r;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""?!1:(r={ignoreWord:n,targetContent:t,requestType:"ignore"},this._trigger("validating",r))?!1:this._updateErrorContent(n,t,null,"ignore",i)},t.prototype.change=function(n,t,i,r){var u;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""||ej.isNullOrUndefined(i)||i===""?!1:(u={changableWord:n,targetContent:t,changeWord:i,requestType:"changeWord"},this._trigger("validating",u))?!1:this._updateErrorContent(n,t,i,"changeWord",r)},t.prototype.changeAll=function(n,t,i){var u,r;return ej.isNullOrUndefined(n)||n===""||ej.isNullOrUndefined(t)||t===""||ej.isNullOrUndefined(i)||i===""?!1:(u={changableWord:n,targetContent:t,changeWord:i,requestType:"changeAll"},this._trigger("validating",u))?!1:(r={},r.ErrorWord=n,r.ReplaceWord=i,this._changeAllWords.push(r),this._updateErrorContent(n,t,i,"changeAll",null))},t.prototype.addToDictionary=function(n){if(ej.isNullOrUndefined(n)||n==="")return!1;var t={customWord:n,requestType:"addToDictionary"};if(this._trigger("validating",t))return!1;this._customWord=JSON.stringify({customWord:n});this._ajaxRequest(this,null,"addToDictionary")},t.prototype._updateErrorContent=function(n,t,i,r,u){var s,f,o,h,e,c;if(t.indexOf(n)!==-1){if(f='<span class="errorspan '+this.model.misspellWordCss+'">'+n+"<\/span>",o=r==="ignoreAll"||r==="addToDictionary"||r==="ignore"?n:i,r==="ignoreAll"||r==="addToDictionary"||r==="changeAll")t=t.replace(new RegExp(f,"g"),o);else if(r==="ignore"||r==="changeWord")if(ej.isNullOrUndefined(u))t=t.replace(f,o);else{for(h=[],e=t.indexOf(f);e!==-1;)h.push(e),e=t.indexOf(f,++e);c=h[u];t=t.substr(0,c)+o+t.substr(c+f.length)}s={resultHTML:t}}else s=!1;return s},t.prototype._renderDialogWindow=function(){this._dialogWindowRendering();this._showDialog()},t.prototype._dialogWindowRendering=function(){var n=this,u,t;this._spellCheckWindow=ej.buildTag("div.e-spellcheckdialog#"+this._id+"ErrorCorrectionWindow");var f=ej.buildTag("div.e-dialogdiv"),e=ej.buildTag("div.e-row e-labelrow").append(ej.buildTag("div.e-labelcell").append(ej.buildTag("label.e-dictionarylabel",this._localizedLabels.NotInDictionary+":"))),i=ej.buildTag("div.e-row e-sentencerow"),o=ej.buildTag("div.e-cell e-sentencecell").append(ej.buildTag("div.e-sentence","",{},{id:this._id+"_Sentences",name:"sentences",contenteditable:"false"}));i.append(o);var s=ej.buildTag("div.e-buttoncell"),h=ej.buildTag("button.e-btnignoreonce",this._localizedLabels.IgnoreOnceButtonText,{},{id:this._id+"_IgnoreOnce"}).attr("type","button"),c=ej.buildTag("button.e-btnignoreall",this._localizedLabels.IgnoreAllButtonText,{},{id:this._id+"_IgnoreAll"}).attr("type","button"),l=ej.buildTag("button.e-btnaddtodictionary",this._localizedLabels.AddToDictionary,{},{id:this._id+"_AddToDictionary"}).attr("type","button");i.append(s.append(h).append(c).append(l));var a=ej.buildTag("div.e-row e-labelrow").append(ej.buildTag("div.e-labelcell").append(ej.buildTag("label.e-lablesuggestions",this._localizedLabels.SuggestionLabel+":"))),r=ej.buildTag("div.e-row e-suggestionsrow"),v=ej.buildTag("div.e-cell e-suggestioncell").append(ej.buildTag("ul.e-suggesteditems","",{},{id:this._id+"_Suggestions"}));r.append(v);var y=ej.buildTag("div.e-buttoncell"),p=ej.buildTag("button.e-btnchange",this._localizedLabels.ChangeButtonText,{},{id:this._id+"_Change"}).attr("type","button"),w=ej.buildTag("button.e-btnchangeall",this._localizedLabels.ChangeAllButtonText,{},{id:this._id+"_ChangeAll"}).attr("type","button"),b=ej.buildTag("button.e-btnclose",this._localizedLabels.CloseButtonText,{},{id:this._id+"_Close"}).attr("type","button");for(r.append(y.append(p).append(w).append(b)),f.append(e).append(i).append(a).append(r),this._spellCheckWindow.append(f),this._spellCheckWindow.ejDialog({width:462,minHeight:305,enableModal:!0,enableResize:!1,showOnInit:!1,allowKeyboardNavigation:!1,target:$("body"),title:this._localizedLabels.SpellCheckButtonText+":",close:function(){n._close()},cssClass:"e-spellcheck",isResponsive:this.model.isResponsive}),u=[".e-btnignoreonce",".e-btnignoreall",".e-btnaddtodictionary",".e-btnchange",".e-btnchangeall",".e-btnclose"],t=0;t<u.length;t++)this._spellCheckWindow.find(u[t]).ejButton({width:this.model.isResponsive?"100%":140,click:function(t){t.model.text===n._localizedLabels.CloseButtonText?n._close():n._changeErrorWord(t)},cssClass:"e-spellbuttons"});this._spellCheckWindow.find(".e-sentence").append(ej.buildTag("div.e-sentencescroller").append(ej.buildTag("div").append(ej.buildTag("div.e-sentencecontent","",{},{id:this._id+"_SentenceContent"}))));this._spellCheckWindow.find(".e-sentence .e-sentencescroller").ejScroller({height:"100%",scrollerSize:20});this._spellCheckWindow.find(".e-suggesteditems").ejListBox({width:"100%",height:"100%",dataSource:null,selectedIndex:0,cssClass:"e-suggestionlist"})},t.prototype._alertWindowRender=function(n){this._renderAlertWindow(n);this._elementStatus||this._alertWindow.find(".e-alerttext").html(this._localizedLabels.NotValidElement);this._alertWindow.ejDialog("open")},t.prototype._renderAlertWindow=function(n){var t=this;this._alertWindow=ej.buildTag("div.e-alertdialog#"+this._id+"alertWindow");this._elementStatus||this._alertWindow.addClass("e-missingalert");var r=ej.buildTag("div.e-alertbtn","",{"text-align":"center"}).append(ej.buildTag("button.e-alertbutton e-alertspellok",this._localizedLabels.Ok,{},{id:this._id+"alertok"}).attr("type","button")),i=ej.buildTag("div.e-alerttextdiv"),u=ej.buildTag("div.e-alertnotifydiv").append(ej.buildTag("div.e-alertnotification e-icon e-notification")),f=ej.buildTag("div.e-alerttext",this._localizedLabels.CompletionPopupMessage,{"text-align":"left",padding:"5px"});i.append(u).append(f);this._alertWindow.append(i).append(r);this.element.append(this._alertWindow);this._alertWindow.find(".e-alertbutton").ejButton({showRoundedCorner:!0,width:this._elementStatus?"70px":"100px",click:function(){t._alertClose()},cssClass:"e-flat"});this._alertWindow.ejDialog({width:this._elementStatus?240:420,minHeight:140,showOnInit:!1,enableModal:!0,title:this._localizedLabels.CompletionPopupTitle,enableResize:!1,allowKeyboardNavigation:!1,target:n==="validating"?".e-spellcheckdialog":$("body"),cssClass:this._elementStatus?"e-spellalert":"e-spellalert e-elementmissing",close:function(){t._alertClose()},isResponsive:this.model.isResponsive})},t.prototype._renderContextMenu=function(){var n=this,r,i,t,u;if(this._contextMenu=ej.buildTag("ul#"+n._id+"contextMenu"),ej.isNullOrUndefined(n.model.controlsToValidate))r=n._isIframe(this.element)?n.element.contents()[0]:"."+n.model.misspellWordCss;else{for(i=!1,t=0;t<n._controlIds.length;t++)u=n._isIframe($(n._controlIds[t])),u&&(i=!0);r=i?$(n._controlIds[0]).contents()[0]:"."+n.model.misspellWordCss}this._contextMenu.ejMenu({fields:{id:"id",text:"text",parentId:"parentId"},menuType:ej.MenuType.ContextMenu,openOnClick:!1,width:"auto",cssClass:"e-spellmenu",click:function(t){n._onMenuSelect(t)}})},t.prototype._contextMenuPosition=function(n,t){var r,i,f,u,e,o;return!ej.isNullOrUndefined(t._activeElement)&&t._isIframe($(t.element))?(f=ej.isNullOrUndefined(t.model.controlsToValidate)?$(t.element):$(t._control[0].controlId),r=(n.clientX==undefined?0:n.clientX)+f.offset().left,i=(n.clientY==undefined?0:n.clientY)+f.offset().top,u=$(t._contextMenu).attr("style","visibility: visible;display:block;").height(),e=$(t._contextMenu).width(),i=i+u<$(document).scrollTop()+$(window).height()?i:i-u<0?i:i-u,r=r+e<$(document).scrollLeft()+$(window).width()?r:r-e):(r=n.clientX+t._contextMenu.width()<$(window).width()?n.pageX:n.pageX-t._contextMenu.width(),i=n.clientY+t._contextMenu.height()<$(window).height()?n.pageY:n.clientY>t._contextMenu.height()?n.pageY-t._contextMenu.height():$(window).height()-t._contextMenu.outerHeight(),o=$("body").css("position")!=="static"?$("body").offset():{left:0,top:0},r-=o.left,i-=o.top),{X:r,Y:i}},t.prototype._showDialog=function(){var a={spellCheckDialog:this._spellCheckWindow,requestType:"dialogBeforeOpen"},t,n,u,f,e,r,o,i,s,h,c,l;if(this._trigger("dialogBeforeOpen",a))return!1;if(this._spellCheckWindow.ejDialog("open"),t="",this._controlIds.length>0){for(u=0;u<this._controlIds.length;u++)if(f=$(this._controlIds[u]),f.length>0)for(e=0;e<f.length;e++)r=$(f[e]),this._activeElement=this._isIframe(r)?$(r).contents().find("body")[0]:$(r)[0],this._removeSpan(this),this._subElements.push(r[0]);t=this._inputTextProcess(this,$(this._subElements[0]),t);this._proElements=this._subElements.length>0&&$(this._subElements[0]);this._currentTargetElement=n=$(this._subElements[0]);this._subElements=this._subElements.slice(1)}else n=this.element,this._activeElement=this._isIframe(n)?this._getIframeElement(n):$(n)[0],this._removeSpan(this),t=this._inputTextProcess(this,n,t);if(o="",this.element=ej.isNullOrUndefined(this.model.controlsToValidate)?this.element:n,this.element.length>0&&(o=this._isIframe(this.element)?$(this.element).contents().find("body").html():$(n)[0].tagName==="TEXTAREA"||$(n)[0].tagName==="INPUT"?$(n)[0].value:$(n)[0].innerHTML),i=this._filteringDiffWords(this,t),this._splitWords(t,this),!ej.isNullOrUndefined(this.model.controlsToValidate)&&(s={previousElement:null,currentElement:n,targetHtml:o},this._trigger("targetUpdating",s)))return this._close(),!1;if((this._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML=o,h={targetText:t,requestType:"dialogOpen"},this._trigger("dialogOpen",h))||(c={targetSentence:t,requestType:"spellCheck"},this._trigger("actionBegin",c)))return!1;i.length>0?this._ajaxRequest(this,i.join(" "),"spellCheckDialog"):i.length!==0||this._ignoreStatus?ej.isNullOrUndefined(this._errorWordDetails)?this._alertWindowRender("show"):(l=this._filterErrorData(this,this._errorWordDetails),this._dialogModeOperations(this,l,t,"spellCheckDialog")):(this._splitInputWords(t,this),i=ej.dataUtil.distinct(this._inputWords),this._ajaxRequest(this,i.join(" "),"spellCheckDialog"))},t.prototype._getIframeElement=function(n){return $(n).contents().find("body")[0]},t.prototype._inputTextProcess=function(n,t,i){var r,u;return n._isIframe(t)?(r=$(t).contents().find("body").text(),i=i===""?r:i+r):(u=ej.isNullOrUndefined($(t)[0].value)?($(t)[0].innerText||$(t)[0].textContent).trim():$(t)[0].value.trim(),i=i===""?u:i+" "+u),i},t.prototype._ajaxRequest=function(n,t,i){var r=i==="addToDictionary"?n._customWord:this._getModelValues(this,t);$.ajax({url:i==="addToDictionary"?this.model.dictionarySettings.customDictionaryUrl:this.model.dictionarySettings.dictionaryUrl,data:{data:r},contentType:"application/json; charset=utf-8",dataType:this.model.ajaxDataType,crossDomain:!0,success:function(r){var u,p,e,o,f,w,s,b,nt,k,v,h,d,y,l,a,c,g;if(i==="addToDictionary"?ej.isNullOrUndefined(n._errorWordDetails)||ej.isNullOrUndefined(n._currentElement)?u=[]:(u=n._errorWordDetails,n._filterData(r.toString(),n),n._errorWordDetails=n._errorWordsData):u=n._updateErrorDetails(n,r),e=t,u.length>0){if(i==="spellCheckDialog"||i==="validateOnType"||i==="validateOnRender")f=n._filterErrorData(n,u),f.length>0?i==="spellCheckDialog"?n._dialogModeOperations(n,f,e,i):(i==="validateOnType"||i==="validateOnRender")&&n._validateOnTypeOperations(n,f,e,i):(i==="spellCheckDialog"&&n._spellCheckWindow.ejDialog("isOpen")&&n._spellCheckWindow.ejDialog("close"),n._alertWindowRender("validating"));else if(i==="spellCheck"){if(u.length>0){for(w=n._getFilterData(u,n),f=ej.dataUtil.distinct(w),s=0;s<f.length;s++)b=(new ej.Query).where("ErrorWord",ej.FilterOperators.equal,f[s]),nt=new ej.DataManager(u).executeLocal(b),f.length>0&&(p='<span class="errorspan '+(!ej.isNullOrUndefined(n._misspelledWordCss)&&n._misspelledWordCss!==""?n._misspelledWordCss:n.model.misspellWordCss)+'">'+f[s]+"<\/span>",k=new RegExp(f[s],"gi"),e=e.replace(k,p));o={resultHTML:e,errorWordDetails:u,requestType:"spellCheck"};n._misspelledWordCss=null}else o={resultHTML:e,errorWordDetails:u,requestType:"spellCheck"};n._trigger("actionSuccess",o)}else if(i==="addToDictionary"&&(ej.isNullOrUndefined(n._currentElement)||(v=$(n._currentElement)[0].tagName==="IFRAME"?$(n._currentElement).contents().find("body").html():$(n._currentElement).html().trim()),h=n._updateErrorContent(r,v,null,"addToDictionary",null),!ej.isNullOrUndefined(v))){if(!ej.isNullOrUndefined(n._spellCheckWindow)&&n._spellCheckWindow.find(".e-btnaddtodictionary").hasClass("e-select"))d=n._spellCheckWindow.find(".e-suggesteditems"),y=n._spellCheckWindow.find(".e-sentence .e-sentencecontent"),n._errorWordsData.length>0?(y[0].innerHTML=h.resultHTML,n._replaceErrorText(y,r.toString()),n._listBoxDataUpdate(n)):(d.ejListBox({dataSource:null}),n._statusFlag=!1,n._alertWindowRender("validating"));else if(!ej.isNullOrUndefined(n._contextMenu)){if(n._isIframe(n.element)?$(n.element).contents().find("body").html(h.resultHTML):$(n._currentElement)[0].innerHTML=h.resultHTML,n._controlIds.length>0)for(l=0;l<n._controlIds.length;l++)for(a=$(n._controlIds[l]),c=0;c<a.length;c++)$(n._currentElement)[0]!==$(a[c])[0]&&(g=$(a[c]),n._replaceErrorText(g,r.toString()));n._renderMenu(n)}o={resultHTML:h.resultHTML,errorWordDetails:r,requestType:"addToDictionary"};n._trigger("actionSuccess",o)}}else n._subElements.length>0?n._updateTargetText(n):(i==="spellCheckDialog"&&n._spellCheckWindow.ejDialog("isOpen")&&n._spellCheckWindow.ejDialog("close"),i==="spellCheck"&&(o={resultHTML:t,errorWordDetails:u,requestType:"spellCheck"},n._trigger("actionSuccess",o)),i==="validateOnType"&&n._removeSpan(n),i!=="spellCheck"&&i!=="addToDictionary"&&n._alertWindowRender("load"))},error:function(t,r,u){var f={errorMessage:u,requestType:i};n._trigger("actionFailure",f)}})},t.prototype._suggestionsRequest=function(n,t,i,r){var u;u=r==="validateByMenu"||r==="suggestionsUpdate"?JSON.stringify({requestType:"getSuggestions",errorWord:i}):n._getModelValues(n,i);$.ajax({url:n.model.dictionarySettings.dictionaryUrl,data:{data:u},contentType:"application/json; charset=utf-8",dataType:n.model.ajaxDataType,crossDomain:!0,success:function(u){var f={},o,s,e,h,c;if(f.ErrorWord=i,f.SuggestedWords=u[i],n._suggestedWordCollection.push(f),r==="validateByMenu"){if(o=u[i],s={selectedErrorWord:i,requestType:"contextOpen"},n._trigger("contextOpen",s))return!1;n._contextMenuDisplay(n,o)}else r==="validateByDialog"?(e=n._updateErrorDetails(n,u),e.length>0?(h=n._filterErrorData(n,e),n._splitWords(t[0].innerText,n),n._processNode(n,t[0],h,"spellCheckDialog"),n._activeElement=t[0],n._changeAllErrors(n),n._listBoxDataUpdate(n)):n._subElements.length>0?n._updateTargetText(n):n._completionCheck(n)):r==="suggestionsUpdate"&&(c=u[t[0].innerText],n._dialogSuggestionsUpdate(n,c))}})},t.prototype._filterErrorData=function(n,t){var i=n._getFilterData(t,n);return ej.dataUtil.distinct(i)},t.prototype._updateErrorDetails=function(n,t){var i=[],r;if(ej.isNullOrUndefined(n._errorWordDetails))i=n._errorWordDetails=ej.isNullOrUndefined(n.model)?t:n.model.ajaxDataType==="json"?t.Data:t;else if(t.length>0)if(n._ignoreStatus)for(r=0;r<t.length;r++)n._errorWordDetails.push(t[r]),i=n._errorWordDetails;else i=n._errorWordDetails=t,n._ignoreStatus=!0;else i=n._errorWordDetails;return i},t.prototype._contextMenuDisplay=function(n,t){var i,e,r,h,l,a,o,u,s,f,c;if(ej.isNullOrUndefined(n._contextMenu)&&n._renderContextMenu(),i=n._contextMenu.data("ejMenu"),e=n.model.contextMenuSettings.menuItems,t.length>0){for(r=[],h=n.model.maxSuggestionCount<t.length?n.model.maxSuggestionCount:t.length,r=n._convertData(t.slice(0,h),"menuData"),l=r.length,a=r[h-1].id,o=0;o<e.length;o++)r.push(e[o]);for(i.option("fields.dataSource",r),u=i.element.find(".e-list"),s=0;s<l;s++)$(u[s]).addClass("e-errorsuggestions");for(f=0;f<u.length;f++)u[f].attributes.id.value===a&&$(u[f]).addClass("e-separator")}else i.option("fields.dataSource",e);c=n._contextMenuPosition(n._menuEvents,n);$(i.element).css({left:c.X,top:c.Y});$(i.element).css("display","block")},t.prototype._dialogSuggestionsUpdate=function(n,t){var u=n._spellCheckWindow.find(".e-suggesteditems"),f=$("#"+n._id+"_Suggestions").data("ejListBox"),i,e,r;t.length>0?(n._spellCheckWindow.find(".e-btnchange").hasClass("e-disable")&&n._spellCheckWindow.find(".e-btnchangeall").hasClass("e-disable")&&(n._spellCheckWindow.find(".e-btnchange").removeClass("e-disable"),n._spellCheckWindow.find(".e-btnchangeall").removeClass("e-disable")),e=n.model.maxSuggestionCount<t.length?n.model.maxSuggestionCount:t.length,i=t.slice(0,e)):(n._spellCheckWindow.find(".e-btnchange").addClass("e-disable"),n._spellCheckWindow.find(".e-btnchangeall").addClass("e-disable"),i=[n._localizedLabels.NoSuggestionMessage]);u.ejListBox({selectedIndex:null});u.ejListBox({dataSource:n._convertData(i,"dictionaryData"),selectedIndex:0});ej.isNullOrUndefined(f)||f.refresh();r=n._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller");!ej.isNullOrUndefined(r)&&r.isVScroll()&&$(n._spellCheckWindow.find("."+n.model.misspellWordCss)).get(0).scrollIntoView(!1)},t.prototype._replaceErrorText=function(n,t){for(var u,r=$(n).find(".errorspan"),i=0;i<r.length;i++)u=r[i].innerText||r[i].textContent,u===t&&$(r[i]).replaceWith(u)},t.prototype._dialogModeOperations=function(n,t,i,r){var o={errorWords:n._errorWordDetails,targetText:i,requestType:r},u=n._spellCheckWindow.find(".e-sentence .e-sentencecontent"),f,e;if(t.length>0){if(n._removeSpan(n),n._processNode(n,u[0],t,r),this._trigger("start",o))return!1;f=n._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller");f.refresh();n._listBoxDataUpdate(n)}else e=n._spellCheckWindow.find(".e-suggesteditems"),r==="spellCheckDialog"&&(u[0].innerHTML=i),e.ejListBox({dataSource:null}),n._statusFlag=!1,this._alertWindowRender("load")},t.prototype._validateOnTypeOperations=function(n,t,i,r){var e,f,o,s,h,c,u;if(t.length>0){if(this._controlIds.length>0&&!this._currentActiveElement&&this.model.enableValidateOnType||this._controlIds.length>0&&(!this.model.enableValidateOnType||!this._statusMultiTarget))for(u=0;u<n._controlIds.length;u++)for(e=$(this._controlIds[u]),f=0;f<e.length;f++)o=n._isIframe($(e[f]))?n._getIframeElement($(e[f])):$(e[f])[0],n._activeElement=n._currentActiveElement=o,n._removeSpan(n),n._processNode(n,o,t,r),s={},s.controlId=n._controlIds[u],s.errorHtml=o.innerHTML,n._control.push(s);else this.model.enableValidateOnType&&this._currentActiveElement?(n._removeSpan(n),n._processNode(n,this._currentActiveElement,t,r),this._statusMultiTarget=!1):n._isIframe(n.element)?(h=n._getIframeElement(n.element),n._activeElement=h,n._removeSpan(n),n._processNode(n,h,t,r)):(n._removeSpan(n),n._processNode(n,$(n.element)[0],t,r));if(n._statusFlag=!0,c=this._controlIds.length>0?{errorWords:n._errorWordDetails,targetControls:this._control,requestType:r}:{errorWords:n._errorWordDetails,targetText:$(n.element)[0].innerText,requestType:r},this._trigger("start",c))return!1;if(n._isIframe(this.element))n._bindBeforeOpen(n,$(this.element).contents().find("body"));else if(n._controlIds.length>0)for(u=0;u<n._controlIds.length;u++)n._bindBeforeOpen(n,$(n._controlIds[u]));else n._bindBeforeOpen(n,$(this.element))}else n._removeSpan(n),n._statusFlag=!1;this.model.enableValidateOnType&&n.setCursorPosition(n._currentCursorTarget)},t.prototype._bindBeforeOpen=function(n,t){n._on($(t).find("."+this.model.misspellWordCss),"contextmenu",$.proxy(n._contextOpen,n))},t.prototype._contextOpen=function(n){var i=$(n.target),t,r,u;i.hasClass("errorspan")?(n.preventDefault(),t=this,r=t._selectedValue=i[0].innerText,t._selectedTarget=i[0],t._menuEvents=n,u=t._filterSuggestions(t,r),u.length>0?t._contextMenuDisplay(t,u[0].SuggestedWords):t._suggestionsRequest(t,null,r,"validateByMenu")):this._elementRightClick(n)},t.prototype._processNode=function(n,t,i,r){for(var b,k,c,u,p,s=n._filterTextNodes(n,t),e=0;e<s.length;e++){var o=s[e],w=[s[e]],h=s[e].data,l=!1,a=!1,v=!1;if(n.model.ignoreSettings.ignoreUrl&&(b=/^((http|ftp|https)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/,l=b.test(o.wholeText),l&&(v=l)),n.model.ignoreSettings.ignoreEmailAddress&&(k=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i,a=k.test(o.wholeText),a&&(v=a)),!v)for(c=0;c<n._words.length;c++)for(u=0;u<i.length;u++)if(n._words[c]===i[u]&&!ej.isNullOrUndefined(h.match(new RegExp("\\b"+i[u]+"\\b","gi")))&&h.indexOf(i[u])!==-1){var d=h.indexOf(i[u]),g=i[u].length,f=o.splitText(d),y=document.createElement("span");y.className=r==="validateOnType"?"errorspan "+this.model.misspellWordCss:"errorspan";p=document.createTextNode(i[u]);y.appendChild(p);o.parentNode.insertBefore(y,f);f.data=f.data.substr(g);o=f;w.push(p);w.push(f);h=f.data}}},t.prototype._spellValidateOnType=function(n){var i,t;if(this.model.enableValidateOnType&&this.model.contextMenuSettings.enable&&(i={events:n,requestType:"validate"},this._trigger("validating",i),this._statusMultiTarget=!1,this._currentActiveElement=i.events.currentTarget,i.events.cancelable===!0)){if(t=n.keyCode,t>=16&&t<=31)return;if(t>=37&&t<=40)return;(t===32||t===13)&&(this._statusMultiTarget=!0,this._triggerSpelling())}},t.prototype._triggerSpelling=function(){var n=this;setTimeout(function(){n.getCursorPosition();n.validate()},2)},t.prototype.getCursorPosition=function(){var n,o,r,i,t,f,u,e;if(this.model.enableValidateOnType&&this.model.contextMenuSettings.enable){if(n=this,o=String.fromCharCode(7),this._controlIds.length>0)for(f=0;f<this._controlIds.length;f++)u=$(this._controlIds[f]),this._isIframe(u)?(r=u[0].contentDocument.getSelection(),i=u[0].contentDocument.getSelection(),t=u[0].contentDocument.createRange()):(r=document.getSelection(),i=document.getSelection(),t=document.createRange());else this._isIframe(this.element)?(r=this.element[0].contentDocument.getSelection(),i=this.element[0].contentDocument.getSelection(),t=this.element[0].contentDocument.createRange()):(r=document.getSelection(),i=document.getSelection(),t=document.createRange());return e=r.getRangeAt(0),e.deleteContents(),e.insertNode(document.createTextNode(o)),$(e.startContainer.parentElement).hasClass("errorspan")&&(this.model.controlsToValidate?n._normalizeTextNodes(this._currentActiveElement):n._normalizeTextNodes($(n.element)[0])),n._currentCursorTarget=n._getActiveTarget(n,o),t.collapse(!0),t.setStart(n._currentCursorTarget.node,n._currentCursorTarget.offset),t.setEnd(n._currentCursorTarget.node,n._currentCursorTarget.offset),i.removeAllRanges(),i.addRange(t),n._currentCursorTarget}},t.prototype._getActiveTarget=function(n,t){var r,u,f,i;for(r=this.model.enableValidateOnType?n._filterTextNodes(n,this._currentActiveElement):n._filterTextNodes(n,$(n.element)[0]),u=null,f=null,i=0;i<r.length;i++)if(r[i].data.indexOf(t)>-1)return f=r[i],u=r[i].data.indexOf(t),r[i].data=r[i].data.replace(t,""),{node:f,offset:u}},t.prototype.setCursorPosition=function(n){var o,s,a,i,b,e,c,r,u,v,f,p,t,w;if(this._controlIds.length>0)for(t=0;t<this._controlIds.length;t++)a=$(this._controlIds[t]),this._isIframe(a)?(o=a[0].contentDocument.getSelection(),s=a[0].contentDocument.createRange()):(o=document.getSelection(),s=document.createRange());else this._isIframe(this.element)?(o=this.element[0].contentDocument.getSelection(),s=this.element[0].contentDocument.createRange()):(o=document.getSelection(),s=document.createRange());if(o.getRangeAt&&o.rangeCount&&(b=String.fromCharCode(7),n)){for(i=this.model.controlsToValidate?this._filterTextNodes(this,this._currentActiveElement):this._filterTextNodes(this,$(this.element)[0]),e=n.node,c=n.offset,t=0;t<i.length;t++)i[t]===e&&(r=t);if(u="",r===undefined){var l="",h="",y="",u="",k="",d=!1,g=!1;for(v=0;v<e.length;v++)f=e.data.charAt(v),f.charCodeAt(0)!=160?f.charCodeAt(0)!=32?l===""?u=u+f:f!=b&&(h=h+f):(l=u+f,h=f):(l=u+f,y=" "+y+f);for(u=u+h,k=l.trim(),t=0;t<i.length;t++){if(i[t].data===u&&(r=t),i[t].data===l&&(r=t),i[t].data===h&&h!=""&&(r=t,d=!0),i[t].data===u&&(r=t,g=!0),i[t].data===k&&(r=t),i[t].data===u&&i[t+1]!==undefined&&i[t+1].data.charCodeAt(0)===160){r=t;break}if(i[t].data===u&&i[t+1]!==undefined&&i[t+1].data.charCodeAt(1)===160&&y.length>=1){r=t;break}if((i[t].data===l||i[t].data===u)&&i[t+1]==undefined){p=document.createTextNode("");i.push(p);this._currentActiveElement.appendChild(p);r=t+1;c=i[r].data.length;e=i[r];break}}}for(t=r;t<i.length-1;t++){if(c<=i[t].data.length){e=i[t];break}if(d===!1||h===undefined||h==="")c-=i[t].data.length,e=i[t+1];else{c=1;e=i[t];break}}w=e;s.collapse(!0);s.setStart(w,c);s.setEnd(w,c);o.removeAllRanges();o.addRange(s)}},t.prototype._normalizeTextNodes=function(n){n.normalize();return},t.prototype._filterTextNodes=function(n,t){function r(n){for(var t,u=0;u<n.childNodes.length;u++)t=n.childNodes[u],t.nodeType===3?i.push(t):t.childNodes&&r(t)}var i=[];return r(t),i},t.prototype._removeSpan=function(n){var r,i,t,u;for(n.model.enableValidateOnType?n._currentActiveElement&&(r=n._currentActiveElement):r=!ej.isNullOrUndefined(n.model.controlsToValidate)||n._isIframe(n.element)?n._activeElement:n.element[0],i=$(r).find("span.errorspan"),t=0;t<i.length;t++)u=i[t].innerText||i[t].textContent,$(i[t]).replaceWith(u)},t.prototype._getFilterData=function(n,t){var u=[],i,r;for(t._errorWordsData=t._errorWordDetails=n,i=0;i<t.model.ignoreWords.length;i++)t._filterData(t.model.ignoreWords[i],t);for(r=0;r<t._errorWordsData.length;r++)u.push(t._errorWordsData[r].ErrorWord);return u},t.prototype._filterData=function(n,t){var i=(new ej.Query).where("ErrorWord",ej.FilterOperators.notEqual,n);t._errorWordsData=new ej.DataManager(t._errorWordsData).executeLocal(i)},t.prototype._formHtml=function(n,t){for(var r,u,i=0;i<n.length;i++)r='<span class="errorspan">'+n[i]+"<\/span>",u=new RegExp("\\b"+n[i]+"\\b","gi"),t=t.replace(u,r);return t},t.prototype._listBoxDataUpdate=function(n){var t=n._spellCheckWindow.find(".e-sentence .e-sentencecontent").find(".errorspan"),i,r;$(t[0]).addClass(this.model.misspellWordCss);t.length>0?(i=n._filterSuggestions(n,t[0].innerText),i.length>0?n._dialogSuggestionsUpdate(n,i[0].SuggestedWords):n._suggestionsRequest(n,t,t[0].innerText,"suggestionsUpdate")):!ej.isNullOrUndefined(this.model.controlsToValidate)&&n._targetStatus?n._updateTargetText(n):(r=n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML,n._validationComplete(n,r))},t.prototype._filterSuggestions=function(n,t){var i=[],r,u;return n._suggestedWordCollection.length>0&&(r=(new ej.Query).where("ErrorWord",ej.FilterOperators.equal,t),u=new ej.DataManager(n._suggestedWordCollection).executeLocal(r),i=u),i},t.prototype._validationComplete=function(n,t){n._updateTargetString(n);var i={targetElement:n._currentTargetElement,targetText:t,requestType:"changeErrorWord"};if(this._trigger("complete",i))return!1;n._statusFlag=!1;n._alertWindowRender("validating")},t.prototype._onMenuSelect=function(n){var o=n.events.ID.split("_"),f=!1,c,t,r,l,a,s,h,i,e,u,v,y,p,w;if(ej.isNullOrUndefined(this.model.controlsToValidate))f=this._isIframe(this.element);else for(i=0;i<this._controlIds.length;i++)c=this._isIframe($(this._controlIds[i])),c&&(f=!0),f&&(this.element=$(this._controlIds[0]));if(t=f?this.element:this._selectedTarget.parentElement,this._activeElement=t,r="",r=this._isIframe($(t))?$(t).contents().find("body").html():$(t).html().trim(),l={selectedOption:o[0],requestType:"menuSelect",targetContent:r,selectedValue:this._selectedValue},this._trigger("contextClick",l))return!1;switch(o[0]){case"AddToDictionary":a=(this._selectedTarget.innerText||this._selectedTarget.textContent).trim();this._currentElement=$(t);this.addToDictionary(a);break;case"IgnoreAll":if(s=(this._selectedTarget.innerText||this._selectedTarget.textContent).trim(),h=this.ignoreAll(s,r),r=h.resultHTML,$(t).html(h.resultHTML),this._controlIds.length>0)for(i=0;i<this._controlIds.length;i++)for(e=$(this._controlIds[i]),u=0;u<e.length;u++)$(t)[0]!==$(e[u])[0]&&(v=$(e[u]),this._replaceErrorText(v,s));this._renderMenu(this);break;default:y=o[0];p=$(n.element).hasClass("e-errorsuggestions");p&&(this._selectedTarget.innerHTML=y,w=document.createTextNode(this._selectedTarget.innerText||this._selectedTarget.textContent),this._selectedTarget.parentNode.insertBefore(w,this._selectedTarget),$(this._selectedTarget).remove(),r=$(t).html());this._renderMenu(this)}},t.prototype._renderMenu=function(n){var t,i,f,u,r;if(n._controlIds.length>0){for(i=0;i<n._controlIds.length;i++)if(t=n._getErrorLength(n,$(n._controlIds[i])),t>0)break}else t=n._getErrorLength(n,$(n.element));if(t===0&&(f={targetElement:n._currentTargetElement,requestType:"validate"},n._trigger("complete",f)))return!1;n._statusFlag=t>0?!0:!1;u=n._contextMenu.data("ejMenu");$(u.element).is(":visible")&&u.hide();r=ej.isNullOrUndefined(n._activeElement)?n.element:n._activeElement;n._isIframe($(r))?n._bindBeforeOpen(n,$(r).contents().find("body")):n._bindBeforeOpen(n,$(r))},t.prototype._getErrorLength=function(n,t){var i=n._isIframe(t)?$(t).contents().find("body")[0]:$(t);return $(i).find(".errorspan").length},t.prototype._getElement=function(){for(var t=document.getElementsByTagName("span"),r=this._selectedValue,i=[],n=0;n<t.length;n++)t[n].textContent===r&&i.push(t[n]);return i},t.prototype._alertClose=function(){!ej.isNullOrUndefined(this._alertWindow)&&this._alertWindow.parents().find(".e-alertdialog").length>0&&(this._alertWindow.ejDialog("close"),this._alertWindow.parents().find(".e-alertdialog").remove(),this._close())},t.prototype._close=function(){var t,i,n,u,r,f;if(!ej.isNullOrUndefined(this._spellCheckWindow)&&this._spellCheckWindow.parents().find(".e-spellcheck.e-dialog-wrap").length>0){for(t=this._spellCheckWindow.find(".e-sentence .e-sentencecontent"),i=$(t[0]).find("span.errorspan"),n=0;n<i.length;n++)u=i[n].innerText||i[n].textContent,$(i[n]).replaceWith(u);if(this._updateTargetString(this),r=t.html(),f=ej.isNullOrUndefined(this.model.controlsToValidate)?{updatedText:t.text(),updatedHtml:r,requestType:"dialogClose"}:{updatedText:t.text(),targetElement:this._currentTargetElement,updatedHtml:r,requestType:"dialogClose"},this._trigger("dialogClose",f))return!1;this._spellCheckWindow.ejDialog("isOpen")&&this._spellCheckWindow.ejDialog("close");this._spellCheckWindow.parents().find(".e-spellcheck.e-dialog-wrap").remove();this._changeAllWords=[];ej.isNullOrUndefined(this.model.controlsToValidate)||(this._controlIds=this.model.controlsToValidate.split(","),this._subElements=[])}},t.prototype._changeErrorWord=function(n){var r=$("#"+this._id+"_Suggestions").ejListBox("option","value"),f=this._spellCheckWindow.find(".e-sentence .e-sentencecontent"),u=this._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML,i=$(this._spellCheckWindow.find(".e-sentence .e-sentencecontent").find("."+this.model.misspellWordCss)[0]).text().trim(),t;r=r===this._localizedLabels.NoSuggestionMessage?i:r;n.model.text===this._localizedLabels.AddToDictionary?(this._currentElement=$(f),this.addToDictionary(i)):n.model.text===this._localizedLabels.IgnoreOnceButtonText?(t=this.ignore(i,u,null),t!==!1&&this._updateErrorWord(this,t,n,i,null,"ignore")):n.model.text===this._localizedLabels.IgnoreAllButtonText?(t=this.ignoreAll(i,u),t!==!1&&this._updateErrorWord(this,t,n,i,null,"ignoreAll")):n.model.text===this._localizedLabels.ChangeButtonText?(t=this.change(i,u,r,null),t!==!1&&this._updateErrorWord(this,t,n,i,r,"change")):n.model.text===this._localizedLabels.ChangeAllButtonText&&(t=this.changeAll(i,u,r),t!==!1&&this._updateErrorWord(this,t,n,i,r,"changeAll"))},t.prototype._convertData=function(n,t){for(var r=[],i=0;i<n.length;i++)t==="dictionaryData"?r.push({field:n[i]}):t==="menuData"&&r.push({id:n[i],text:n[i]});return r},t.prototype._updateErrorWord=function(n,t,i,r,u,f){var o=this._spellCheckWindow.find(".e-suggesteditems"),e,s,h;n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML=t.resultHTML;e=this._spellCheckWindow.find(".e-sentence .e-sentencecontent").find(".errorspan");e.length>0?n._targetUpdate(n,e,r,f,u):!ej.isNullOrUndefined(this.model.controlsToValidate)&&n._targetStatus?n._updateTargetText(n):(ej.isNullOrUndefined(this.model.controlsToValidate)||$(this._proElements).html(n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML),h=[this._localizedLabels.NoSuggestionMessage],o.ejListBox({selectedItemIndex:null}),o.ejListBox({dataSource:this._convertData(h,"dictionaryData"),selectedItemIndex:0}),s=$("#"+this._id+"_Suggestions").data("ejListBox"),s.refresh(),n._validationComplete(n,t.resultHTML))},t.prototype._targetUpdate=function(n,t,i,r,u){var f,h,o,e,s;if(r==="changeAll")for(f=0;f<t.length;f++)h=t[f].innerText||t[f].textContent,h===i&&$(t[f]).replaceWith(u);for(o=0;o<this.model.ignoreWords.length;o++)for(e=0;e<t.length;e++)s=t[e].innerText||t[e].textContent,s===n.model.ignoreWords[o]&&$(t[e]).replaceWith(s);n._listBoxDataUpdate(n)},t.prototype._updateTargetText=function(n){var f,t,i,e,r,o,u,s;if(n._updateTargetString(n),f=ej.isNullOrUndefined(n.model.controlsToValidate)?$("#"+n._id):$(n._proElements),n._proElements=$(n._subElements[0]),n._proElements.length>0||n._subElements.length>0){if(t=$(n._subElements[0]),n._currentTargetElement=t,i=$(t)[0].tagName==="TEXTAREA"||$(t)[0].tagName==="INPUT"?$(t)[0].value:$(t)[0].innerHTML,e={previousElement:f,currentElement:t,targetHtml:i,requestType:"updateText"},n._trigger("targetUpdating",e))return n._close(),!1;n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML=i;n._subElements=n._subElements.slice(1);r=n._spellCheckWindow.find(".e-sentence .e-sentencecontent");o=n._filteringDiffWords(n,r[0].innerText);n._suggestionsRequest(n,r,o.toString(),"validateByDialog")}else u=n._spellCheckWindow.find(".e-sentence .e-sentencecontent").find(".errorspan"),u.length===0&&n._subElements.length>0?n._updateTargetText(n):u.length>0?(s=n._spellCheckWindow.find(".e-sentence .e-sentencescroller").data("ejScroller"),s.refresh(),n._listBoxDataUpdate(n)):n._completionCheck(n)},t.prototype._updateTargetString=function(n){var t=ej.isNullOrUndefined(n.model.controlsToValidate)?$("#"+n._id):$(n._proElements),i;t.length>0&&(i=n._spellCheckWindow.find(".e-sentence .e-sentencecontent")[0].innerHTML,n._isIframe(t)?t.contents().find("body").html(i):$(t)[0].tagName==="INPUT"?t.val(i):t.html(i))},t.prototype._completionCheck=function(n){n._subElements=n._subElements.slice(1);n._subElements.length===0&&(n._targetStatus=!1);n._validationComplete(n,"")},t.prototype._changeAllErrors=function(n){for(var u,t,i=$(n._activeElement).find(".errorspan"),r=0;r<i.length;r++)for(u=i[r].innerText||i[r].textContent,t=0;t<n._changeAllWords.length;t++)u===n._changeAllWords[t].ErrorWord&&$(i[t]).replaceWith(n._changeAllWords[t].ReplaceWord)},t.prototype._setModel=function(n){var f=this,t,u,i,r;for(t in n)if(n.hasOwnProperty(t))switch(t){case"locale":this.model.locale=n[t];this._localizedLabels=ej.getLocalizedConstants("ej.SpellCheck",this.model.locale);break;case"misspellWordCss":this.model.misspellWordCss=n[t];this.model.contextMenuSettings.enable&&(u=$(this.element[0]).find("span.errorspan").attr("class").toString().split(" ")[1],$(this.element[0]).find("span.errorspan").removeClass(u).addClass(this.model.misspellWordCss));break;case"contextMenuSettings":$.extend(this.model.contextMenuSettings,n[t]);this.model.contextMenuSettings.enable?(this.validate(),this._renderControls()):(ej.isNullOrUndefined(this._contextMenu)||this._contextMenu.parent().remove(),this._removeSpan(this));break;case"ignoreSettings":$.extend(this.model.ignoreSettings,n[t]);this._ignoreStatus=!1;this._statusFlag=!0;this.model.contextMenuSettings.enable&&(this.validate(),this._renderControls());break;case"dictionarySettings":$.extend(this.model.dictionarySettings,n[t]);break;case"maxSuggestionCount":this.model.maxSuggestionCount=n[t];break;case"ignoreWords":this.model.ignoreWords=n[t];this.model.contextMenuSettings.enable&&this.validate();break;case"controlsToValidate":if(this.model.controlsToValidate=n[t],ej.isNullOrUndefined(this.model.controlsToValidate))for($(this.element).attr("style","display:block"),i=0;i<this._controlIds.length;i++)r=$(this._controlIds[i]),r.removeClass("e-spellcheck"),r[0].spellcheck=!0,r[0].addEventListener("input",function(){f._statusFlag=!1},!1);this._renderControls();break;case"isResponsive":this.model.isResponsive=n[t];this._renderControls();break;case"enableValidateOnType":this.model.enableValidateOnType=n[t];this._renderControls()}},t.prototype._getModelValues=function(n,t){var i={ignoreAlphaNumericWords:n.model.ignoreSettings.ignoreAlphaNumericWords,ignoreEmailAddress:n.model.ignoreSettings.ignoreEmailAddress,ignoreHtmlTags:n.model.ignoreSettings.ignoreHtmlTags,ignoreMixedCaseWords:n.model.ignoreSettings.ignoreMixedCaseWords,ignoreUpperCase:n.model.ignoreSettings.ignoreUpperCase,ignoreUrl:n.model.ignoreSettings.ignoreUrl,ignoreFileNames:n.model.ignoreSettings.ignoreFileNames};return JSON.stringify({requestType:"checkWords",model:i,text:t})},t.prototype._getLocalizedLabels=function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)},t.prototype._elementRightClick=function(n){if(!ej.isNullOrUndefined(this._contextMenu)&&!$(n.target).hasClass("e-menulink")){var t=this._contextMenu.data("ejMenu");ej.isNullOrUndefined(t)||$(t.element).is(":visible")&&t.hide()}},t}(ej.WidgetBase);ej.widget("ejSpellCheck","ej.SpellCheck",new SpellCheck);ej.SpellCheck.Locale=ej.SpellCheck.Locale||{};ej.SpellCheck.Locale["default"]=ej.SpellCheck.Locale["en-US"]={SpellCheckButtonText:"Spelling",NotInDictionary:"Not in Dictionary",SuggestionLabel:"Suggestions",IgnoreOnceButtonText:"Ignore Once",IgnoreAllButtonText:"Ignore All",AddToDictionary:"Add to Dictionary",ChangeButtonText:"Change",ChangeAllButtonText:"Change All",CloseButtonText:"Close",CompletionPopupMessage:"Spell check is complete",CompletionPopupTitle:"Spell check",Ok:"OK",NoSuggestionMessage:"No suggestions available",NotValidElement:"Specify the valid control id or class name to spell check"};ej.Ej3DRender=function(){},function(n){var r;ej.Ej3DRender.Polygons=[];ej.Ej3DRender.prototype={matrix3D:function(){},vector3D:function(){},BSPTreeBuilder:function(){},Graphics3D:function(){},polygon3D:function(){}};r=new ej.Ej3DRender;r.vector3D.prototype={x:"",y:"",z:"",Epsilon:1e-5,isValid:function(n){return!isNaN(n.x)&&!isNaN(n.y)&&!isNaN(n.z)},vector3D:function(n,t){this.x=n.x;this.y=n.y;this.z=t},vector3D:function(n,t,i){return this.x=n,this.y=t,this.z=i,{x:n,y:t,z:i}},vector3DMinus:function(n,t){return this.vector3D(n.x-t.x,n.y-t.y,n.z-t.z)},vector3DPlus:function(n,t){return this.vector3D(n.x+t.x,n.y+t.y,n.z+t.z)},vector3DMultiply:function(n,t){var i=n.y*t.z-t.y*n.z,r=n.z*t.x-t.z*n.x,u=n.x*t.y-t.x*n.y;return this.vector3D(i,r,u)},vector3dAND:function(n,t){return n.x*t.x+n.y*t.y+n.z*t.z},vector3DStarMultiply:function(n,t){var i=n.x*t,r=n.y*t,u=n.z*t;return this.vector3D(i,r,u)},getLength:function(n){var t=this.vector3dAND(n,n);return Math.sqrt(t)},normalize:function(){var n=this.getLength();x/=n;y/=n;z/=n},getNormal:function(n,t,i){var f=this.vector3DMinus(n,t),e=this.vector3DMinus(i,t),u=this.vector3DMultiply(f,e),r=this.getLength(u);return r<this.Epsilon&&(r=0),{x:u.x/r,y:u.y/r,z:u.z/r}}};r.matrix3D.prototype={MATRIX_SIZE:4,matrix3D:function(n){for(var i=[],t=0;t<n;t++)i[t]=this.createArray(n);return i},isAffine:function(n){return n[0][3]==0&&n[1][3]==0&&n[2][3]==0&&n[3][3]==1},createArray:function(n){var t=[];for(index=0;index<n;++index)t[index]=0;return t},getIdentity:function(){for(var t=this.matrix3D(this.MATRIX_SIZE),n=0;n<this.MATRIX_SIZE;n++)t[n][n]=1;return t},getInvertal:function(n){for(var t,i=this.getIdentity(),r=0;r<this.MATRIX_SIZE;r++)for(t=0;t<this.MATRIX_SIZE;t++)i[r][t]=this.getMinor(n,r,t);return i=this.transposed(i),this.getMatrixMultiple(1/this.getDeterminant(n),i)},getMatrixMultiple:function(n,t){for(var r,i=0;i<t.length;i++)for(r=0;r<t[i].length;r++)t[i][r]=t[i][r]*n;return t},getMatrixVectorMutiple:function(n,t){var r=n[0][0]*t.x+n[1][0]*t.y+n[2][0]*t.z+n[3][0],u=n[0][1]*t.x+n[1][1]*t.y+n[2][1]*t.z+n[3][1],f=n[0][2]*t.x+n[1][2]*t.y+n[2][2]*t.z+n[3][2],i;return this.isAffine(n)||(i=1/(n[0][3]*t.x+n[1][3]*t.y+n[2][3]*t.z+n[3][3]),r*=i,u*=i,f*=i),{x:r,y:u,z:f}},getMatrixVectorAnd:function(n,t){var i=n[0][0]*t.x+n[1][0]*t.y+n[2][0]*t.z,u=n[0][1]*t.x+n[1][1]*t.y+n[2][1]*t.z,f=n[0][2]*t.x+n[1][2]*t.y+n[2][2]*t.z;return r.vector3D.prototype.vector3D(i,u,f)},getMatrixAdd:function(n,t){for(var i,u=this.matrix3D(4),r=0;r<4;r++)for(i=0;i<4;i++)u[r][i]=n[r][i]+t[r][i];return u},getMatrixMultiplication:function(n,t){for(var i,f,r,o,e=this.getIdentity(),u=0;u<this.MATRIX_SIZE;u++)for(i=0;i<this.MATRIX_SIZE;i++){for(f=0,r=0;r<this.MATRIX_SIZE;r++)f+=n[r][i]*t[u][r],o=f;e[u][i]=f}return e},getMatrixEqual:function(n,t){for(var i,u=!0,r=0;r<n.length;r++)for(i=0;i<n.length;i++)n[r][i]!=t[r][i]&&(u=!1);return u},getMatrixNotEqual:function(n,t){for(var i,u=!0,r=0;r<n.length;r++)for(i=0;i<n.length;i++)n[r][i]!=t[r][i]&&(u=!1);return!u},getMinor:function(n,t,i){return((t+i)%2==0?1:-1)*this.getDeterminant(this.getMMtr(n,t,i))},getMMtr:function(n,t,i){for(var o,u,s,f=n.length-1,e=this.createArray(f),r=0;r<f;r++)for(o=r>=t?r+1:r,e[r]=this.createArray(f),u=0;u<f;u++)s=u>=i?u+1:u,e[r][u]=n[o][s];return e},getDeterminant:function(n){var u=n.length,r=0,i,t,f;if(u<2)r=n[0][0];else for(i=1,t=0;t<u;t++)f=this.getMMtr(n,t,0),r+=i*n[t][0]*this.getDeterminant(f),i=i>0?-1:1;return r},transform:function(n,t,i){var r=this.getIdentity();return r[3][0]=n,r[3][1]=t,r[3][2]=i,r},turn:function(n){var t=this.getIdentity();return t[0][0]=Math.cos(n),t[2][0]=-Math.sin(n),t[0][2]=Math.sin(n),t[2][2]=Math.cos(n),t},tilt:function(n){var t=this.getIdentity();return t[1][1]=Math.cos(n),t[2][1]=Math.sin(n),t[1][2]=-Math.sin(n),t[2][2]=Math.cos(n),t},transposed:function(n){for(var t,r=this.getIdentity(),i=0;i<this.MATRIX_SIZE;i++)for(t=0;t<this.MATRIX_SIZE;t++)r[i][t]=n[t][i];return r},shear:function(n,t,i,r,u,f){var e=this.getIdentity();return e[0]=n,e[0]=t,e[1]=i,e[1]=r,e[2]=u,e[2]=f,e}};r.Graphics3D.prototype={addVisual:function(n){return n==null||f.test(n)?-1:(n.Graphics3D=this,e.add(n))},getVisualCount:function(){return ej.Ej3DRender.Polygons.length()},remove:function(n){ej.Ej3DRender.Polygons.Remove(n)},clearVisual:function(){ej.Ej3DRender.Polygons=null},getVisual:function(){return ej.Ej3DRender.Polygons},prepareView:function(n,t,i,r,u,f){arguments.length==0?e.build():(ej.Ej3DRender.transform==null?ej.Ej3DRender.transform=ej.EjSvgRender.chartTransform3D.transform3D(u):ej.Ej3DRender.transform.mViewport=u,ej.Ej3DRender.tree||(ej.Ej3DRender.tree=[]),ej.Ej3DRender.transform.Rotation=i,ej.Ej3DRender.transform.Tilt=r,ej.Ej3DRender.transform.Depth=t,ej.Ej3DRender.transform.PerspectiveAngle=n,ej.EjSvgRender.chartTransform3D.transform(ej.Ej3DRender.transform),ej.Ej3DRender.tree[f._id]=e.build())},view:function(n,i,r,u,f,e,o){var h=32767,s;if(arguments.length==2){if(n==null)return;s=t.vector3D(0,0,h);this.drawBspNode3D(ej.Ej3DRender.tree[i._id],s,n,i)}else{if(n==null)return;ej.Ej3DRender.transform==null?ej.Ej3DRender.transform=ej.EjSvgRender.chartTransform3D.transform3D(f):ej.Ej3DRender.transform.mViewport=f;ej.Ej3DRender.transform.Rotation=r;ej.Ej3DRender.transform.Tilt=u;ej.Ej3DRender.transform.Depth=o;ej.Ej3DRender.transform.PerspectiveAngle=e;ej.EjSvgRender.chartTransform3D.transform(ej.Ej3DRender.transform);s=t.vector3D(0,0,h);this.drawBspNode3D(ej.Ej3DRender.tree[i._id],s,n,i)}},draw3DElement:function(n,t){n.Plane.element?n.Plane.element.tag=="text"||n.Plane.element.tag=="dataLabel"?f.drawText(n.Plane,t):n.Plane.element.tag=="polyline"?f.drawPolyLine(n.Plane,t):n.Plane.element.tag=="template"?f.drawTemplate(n.Plane,t):f.drawLine(n.Plane,t):f.draw(n.Plane,t)},drawBspNode3D:function(n,i,r,u){if(n!=null&&ej.Ej3DRender.transform!=null)for(;;){var e=t.vector3dAND(f.getNormal(ej.EjSvgRender.chartTransform3D.result(ej.Ej3DRender.transform),n.Plane.VectorPoints),i);if(e>n.Plane.D){if(n.Front!=null&&this.drawBspNode3D(n.Front,i,r,u),this.draw3DElement(n,u),n.Back!=null){n=n.Back;continue}}else if(n.Back!=null&&this.drawBspNode3D(n.Back,i,r,u),this.draw3DElement(n,u),n.Front!=null){n=n.Front;continue}break}}};r.BSPTreeBuilder.prototype={EPSILON:.0005,Polygon:[],add:function(n){return ej.Ej3DRender.Polygons.push(n),ej.Ej3DRender.Polygons.length-1},remove:function(n){ej.Ej3DRender.Polygons.splice(n,1)},clear:function(){ej.Ej3DRender.Polygons=[]},count:function(){return ej.Ej3DRender.Polygons.length},getNext:function(n,t){return n>=t?n-t:n<0?n+t:n},getNodeCount:function(n){return n==null?0:1+this.getNodeCount(n.Back)+this.getNodeCount(n.Front)},vector3DIndexClassification:function(n,t,i){return{index:t,result:i,vector:n,isCuttingBackPoint:!1,cuttingBackPairIndex:null,alreadyCuttedBack:!1,isCuttingFrontPoint:!1,cuttingFrontPairIndex:null,alreadyCuttedFront:!1}},classifyPoint:function(n,t){var i="OnPlane",u=-t.D-r.vector3D.prototype.vector3dAND(n,t.normal);return u>this.EPSILON?i="OnBack":u<-this.EPSILON&&(i="OnFront"),i},classifyPolygon:function(n,t){var i=t.Points,f,h,s;if(i==null)return"Unknown";var e=0,o=0,u=0,c=n.normal,l=n.D;for(f=0,h=i.length;f<h;f++)if(s=-l-r.vector3D.prototype.vector3dAND(i[f],c),s>this.EPSILON?e++:s<-this.EPSILON?o++:u++,e>0&&o>0)break;return u==i.length?"OnPlane":o+u==i.length?"ToRight":e+u==i.length?"ToLeft":"Unknown"},splitPolygon:function(i,r){var w=[],b=[],rt,v,e,k,ut,u,o,ft;if(i.Points!=null){var l=[],s=[],h=[],k,d,g=i.Points.length;for(u=0;u<g;u++){var nt=i.Points[u],y=i.Points[this.getNext(u+1,g)],p=this.classifyPoint(nt,r),a=this.classifyPoint(y,r),c=this.vector3DIndexClassification(nt,l.length,p);if(l.push(c),p!=a&&p!="OnPlane"&&a!="OnPlane"){var it=t.vector3DMinus(nt,y),et=t.vector3DMinus(t.vector3DStarMultiply(r.normal,-r.D),y),ot=t.vector3dAND(et,r.normal),st=ot/t.vector3dAND(r.normal,it),ht=t.vector3DPlus(y,t.vector3DStarMultiply(it,st)),tt=this.vector3DIndexClassification(ht,l.length,"OnPlane");l.push(tt);s.push(tt);h.push(tt)}else if(p=="OnPlane"){if(rt=i.Points[this.getNext(u-1,g)],v=this.classifyPoint(rt,r),v==a)continue;if(v!="OnPlane"&&a!="OnPlane")s.push(c),h.push(c);else if(v=="OnPlane")switch(a){case"OnBack":s.push(c);break;case"OnFront":h.push(c)}else if(a=="OnPlane")switch(v){case"OnBack":s.push(c);break;case"OnFront":h.push(c)}}}if(h.length!=0||s.length!=0){for(u=0;u<s.length-1;u+=2)e=s[u],o=s[u+1],e.CuttingBackPoint=!0,o.CuttingBackPoint=!0,e.CuttingBackPairIndex=o.index,o.CuttingBackPairIndex=e.index;for(u=0;u<h.length-1;u+=2)e=h[u],o=h[u+1],e.CuttingFrontPoint=!0,o.CuttingFrontPoint=!0,e.CuttingFrontPairIndex=o.index,o.CuttingFrontPairIndex=e.index;for(u=0;u<s.length-1;u++)(e=s[u],e.alreadyCuttedBack)||(k=this.cutOutBackPolygon(l,e),k.length>2&&(ut=f.polygon3D(k,i),w.push(n.extend({},ut))));for(u=0;u<h.length-1;u++)(o=h[u],o.alreadyCuttedFront)||(d=this.cutOutFrontPolygon(l,o),d.length>2&&(ft=f.polygon3D(d,i),b.push(n.extend({},ft))))}}else w.push(i),b.push(i);return{BackP:w,FrontP:b}},cutOutFrontPolygon:function(n,t){var i,o,r,u,f,e;for(points=[],i=t;;)if(i.alreadyCuttedFront=!0,points.push(i.vector),o=n[i.CuttingFrontPairIndex],i.CuttingFrontPoint)if(o.alreadyCuttedFront)if(r=n[this.getNext(i.index-1,n.length)],u=n[this.getNext(i.index+1,n.length)],r.result!="OnFront"||r.alreadyCuttedFront){if(u.result!="OnFront"||u.alreadyCuttedFront)return points;i=u}else i=r;else i=o;else if(f=n[this.getNext(i.index-1,n.length)],e=n[this.getNext(i.index+1,n.length)],f.result=="OnBack"||f.alreadyCuttedFront){if(e.result=="OnBack"||e.alreadyCuttedFront)return points;i=e}else i=f;return points},cutOutBackPolygon:function(n,t){for(var f=[],i=t,e,r,u;;)if(i.alreadyCuttedBack=!0,f.push(i.vector),e=n[i.CuttingBackPairIndex],i.CuttingBackPoint)if(e.alreadyCuttedBack)if(r=n[this.getNext(i.index-1,n.length)],u=n[this.getNext(i.index+1,n.length)],r.result!="OnBack"||r.alreadyCuttedBack){if(u.result!="OnBack"||u.alreadyCuttedBack)return f;i=u}else i=r;else i=e;else if(r=n[this.getNext(i.index-1,n.length)],u=n[this.getNext(i.index+1,n.length)],r.result=="OnFront"||r.alreadyCuttedBack){if(u.result=="OnFront"||u.alreadyCuttedBack)return f;i=u}else i=r;return f},build:function(){var f,e,o,i,s,h,c,n,l,t,r,u;if(arguments[0]){if(f=arguments[0],f.length<1)return null;for(e={Back:null,Front:null,Plane:null},o=f[0],e.Plane=o,i=[],s=[],h=1,c=f.length;h<c;h++)if(n=f[h],n!=o){l=this.classifyPolygon(o,n);switch(l){case"OnPlane":case"ToRight":s.push(n);break;case"ToLeft":i.push(n);break;case"Unknown":if(n.element&&(n.element.tag=="line"||n.element.tag=="text"))i.push(n);else{for(t=this.splitPolygon(n,o),r=0;r<t.BackP.length;r++)t.BackP[r].Name=t.BackP[r].Name+"back",i.push(t.BackP[r]);for(u=0;u<t.FrontP.length;u++)t.FrontP[u].Name=t.FrontP[u].Name+"front",s.push(t.FrontP[u])}}}return i.length>0&&(e.Back=this.build(i)),s.length>0&&(e.Front=this.build(s)),e}return this.build(ej.Ej3DRender.Polygons)}};r.polygon3D.prototype={epsilon:1e-5,normal:{x:0,y:0,z:0},a:this.normal?this.normal.x:0,b:this.normal?this.normal.y:0,c:this.normal?this.normal.z:0,vector:new(new ej.Ej3DRender).vector3D,polygon3D:function(n,t,i,r,u,f,e,o){var h,s;if(arguments.length==3)this.calcNormal(arguments[0],arguments[1],arguments[2]);else return arguments.length==2?(n=arguments[0],this.calcNormal(n[0],n[1],n[2]),this.vectorPoints=n,this.calcNormal(this.vectorPoints),s=arguments[1],s.Normal=this.normal,s.normal=this.normal,s.Points=n,s.VectorPoints=this.vectorPoints,s.IsSplitted=!0,s.d=this.d,s.D=this.d,s):(this.calcNormal(n[0],n[1],n[2]),this.vectorPoints=n,this.calcNormal(this.vectorPoints),h={Tag:"path",Parent:arguments[arguments.length-1]},s={Normal:this.normal,normal:this.normal,Points:n,VectorPoints:this.vectorPoints,Index:i,Tag:t,Name:o?o:null,StrokeThickness:u,Opacity:f,Fill:e,d:this.d,D:this.d},arguments.length!=1&&(s.Element=h),s)},createLine:function(n,i,r,u,f,e){var s=n.width,o=[];return o[0]=t.vector3D(i,r,e),o[1]=t.vector3D(i+s,f+s,e),o[2]=t.vector3D(u,f,e),this.line3D(n,o)},createPolyline:function(n,i){if(n.length==2){var r=n[1];n.push(t.vector3D(r.x,r.y,r.z))}return this.polyLine3D(i,n)},polyLine3D:function(n,t){var i=this.polygon3D(t);return i.element=n,i},line3D:function(n,t){var i=this.polygon3D(t);return i.element=n,i},text3D:function(n,t){var i=this.polygon3D(t);return i.element=n,i},createCylinder:function(n,r,u,f,e,o,s,h,c,l,a,v){var y=0,it,rt,k,b=24,d=360/b,g=Math.PI/180,ut=parseFloat((n.z+r.z)/2),w=[],p=[],nt=[],tt=[],ft=r.y-n.y<r.z-n.z?parseFloat((r.y-n.y)/2):parseFloat((r.z-n.z)/2),et=r.x-n.x<r.z-n.z?parseFloat((r.x-n.x)/2):parseFloat((r.z-n.z)/2),ot=parseFloat((n.x+r.x)/2),st=parseFloat((n.y+r.y)/2);switch(e){case"bar":case"stackingbar":case"stackingbar100":for(b++;b--;)rt=parseFloat(st+ft*Math.cos(y*d*g)),k=parseFloat(ut+ft*Math.sin(y*d*g)),p[y]={Y:rt,Z:k},nt.push(t.vector3D(n.x,p[y].Y,p[y].Z)),tt.push(t.vector3D(r.x,p[y].Y,p[y].Z)),y>0&&(vts=[t.vector3D(n.x,p[y-1].Y,p[y-1].Z),t.vector3D(r.x,p[y-1].Y,p[y-1].Z),t.vector3D(r.x,p[y].Y,p[y].Z),t.vector3D(n.x,p[y].Y,p[y].Z)],w[y+1]=this.polygon3D(vts,u,f,s,0,c,s,"_"+(y+1).toString()+"_"+a,v),i.addVisual(w[y+1])),y++;break;case"column":case"stackingcolumn":case"stackingcolumn100":for(b++;b--;)it=parseFloat(ot+et*Math.cos(y*d*g)),k=parseFloat(ut+et*Math.sin(y*d*g)),p[y]={X:it,Z:k},nt.push(t.vector3D(p[y].X,n.y,p[y].Z)),tt.push(t.vector3D(p[y].X,r.y,p[y].Z)),y>0&&(vts=[t.vector3D(p[y-1].X,n.y,p[y-1].Z),t.vector3D(p[y-1].X,r.y,p[y-1].Z),t.vector3D(p[y].X,r.y,p[y].Z),t.vector3D(p[y].X,n.y,p[y].Z)],w[y+1]=this.polygon3D(vts,u,f,s,0,c,s,"_"+(y+1).toString()+"_"+a,v),i.addVisual(w[y+1])),y++}return w[0]=this.polygon3D(tt,u,f,o,0,c,s,"_0_"+a,v),w[1]=this.polygon3D(nt,u,f,o,h,c,s,"_1_"+a,v),i.addVisual(w[0]),i.addVisual(w[1]),w},createBox:function(n,r,u,f,e,o,s,h,c,l,a,v){var y=[],p=[t.vector3D(n.x,n.y,n.z),t.vector3D(r.x,n.y,n.z),t.vector3D(r.x,r.y,n.z),t.vector3D(n.x,r.y,n.z)],w=[t.vector3D(n.x,n.y,r.z),t.vector3D(r.x,n.y,r.z),t.vector3D(r.x,r.y,r.z),t.vector3D(n.x,r.y,r.z)],b=[t.vector3D(n.x,n.y,r.z),t.vector3D(r.x,n.y,r.z),t.vector3D(r.x,n.y,n.z),t.vector3D(n.x,n.y,n.z)],k=[t.vector3D(n.x,r.y,r.z),t.vector3D(r.x,r.y,r.z),t.vector3D(r.x,r.y,n.z),t.vector3D(n.x,r.y,n.z)],d=[t.vector3D(n.x,n.y,n.z),t.vector3D(n.x,n.y,r.z),t.vector3D(n.x,r.y,r.z),t.vector3D(n.x,r.y,n.z)],g=[t.vector3D(r.x,n.y,n.z),t.vector3D(r.x,n.y,r.z),t.vector3D(r.x,r.y,r.z),t.vector3D(r.x,r.y,n.z)],v;return arguments[10]?(y[0]=this.polygon3D(p,u,f,o,h,c,s,"_0_"+a,v),y[1]=this.polygon3D(w,u,f,o,h,c,s,"_1_"+a,v),y[2]=this.polygon3D(b,u,f,o,h,c,s,"_2_"+a,v),y[3]=this.polygon3D(k,u,f,o,h,c,s,"_3_"+a,v),y[4]=this.polygon3D(d,u,f,o,h,c,s,"_4_"+a,v),y[5]=this.polygon3D(g,u,f,o,h,c,s,"_5_"+a,v)):(v=arguments[arguments.length-1],y[0]=this.polygon3D(p,u,f,o,h,c,s,"_0_"+f,v),y[1]=this.polygon3D(w,u,f,o,h,c,s,"_1_"+f,v),y[2]=this.polygon3D(b,u,f,o,h,c,s,"_2_"+f,v),y[3]=this.polygon3D(k,u,f,o,h,c,s,"_3_"+f,v),y[4]=this.polygon3D(d,u,f,o,h,c,s,"_4_"+f,v),y[5]=this.polygon3D(g,u,f,o,h,c,s,"_5_"+f,v)),l?(i.addVisual(y[0]),i.addVisual(y[1]),i.addVisual(y[2]),i.addVisual(y[3]),i.addVisual(y[4]),i.addVisual(y[5])):(i.addVisual(y[5]),i.addVisual(y[4]),i.addVisual(y[0]),i.addVisual(y[1]),i.addVisual(y[2]),i.addVisual(y[3])),y},calcNormal:function(){var n,r;if(arguments.length>=3){var u=arguments[0],e=arguments[1],o=arguments[2],s=t.vector3DMinus(u,e),h=t.vector3DMinus(o,e),f=t.vector3DMultiply(s,h),i=t.getLength(f);i<this.epsilon&&(i=1);this.normal=t.vector3D(f.x/i,f.y/i,f.z/i);this.d=-(this.normal.x*u.x+this.normal.y*u.y+this.normal.z*u.z);arguments[3]&&(arguments[3].normal=this.normal,arguments.d=this.d)}else for(n=arguments[0],this.calcNormal(n[0],n[1],n[2],arguments[1]),r=3;r<n.length&&this.test();r++)this.calcNormal(n[r],n[0],n[r/2])},test:function(){return!t.isValid(this.normal)},transform:function(n,i){var r,f;if(i.Points!=null){for(r=0;r<i.Points.length;r++)i.VectorPoints[r]=i.Points[r]=u.getMatrixVectorMutiple(n,i.Points[r]);this.calcNormal(i.VectorPoints,i)}else f=n*i.normal*-i.d,i.normal=u.getMatrixVectorAnd(n,i.normal),t.normalize(normal),i.d=-(i.normal&f)},getPoint:function(n,i,r,u){var f;if(typeof n==double)return f=-(r.x*n+r.y*i+u)/r.z,t.vector3D(n,i,f);var e=n,o=i,s=t.vector3DMinus(t.vector3DStarMultiply(r,-u),e),h=t.vector3dAND(s,r),c=h/t.vector3dAND(r,o);return t.vector3DPlus(e,t.vector3DStarMultiply(o*c))},getNormal:function(n,i){var f,r;if(i!=null)for(f=t.getNormal(u.getMatrixVectorMutiple(n,i[0]),u.getMatrixVectorMutiple(n,i[1]),u.getMatrixVectorMutiple(n,i[2])),r=3;r<i.length&&!t.isValid(f)&&i[r/2];r++){var e=u.getMatrixVectorMutiple(n,i[r]),o=u.getMatrixVectorMutiple(n,i[0]),s=u.getMatrixVectorMutiple(n,i[r/2]);f=t.getNormal(e,o,s)}else f=u.getMatrixVectorAnd(n,normal),t.normalize();return f},createTextElement:function(n,t,i,r){var u=[],f=n.x,e=n.y,o=t.Width,s=t.Height;return u[0]=this.vector.vector3D(f,e,n.z),u[1]=this.vector.vector3D(f+o,e+s+r,n.z),u[2]=this.vector.vector3D(f+o+i,e+s+r,n.z),this.text3D(t,u)},redraw:function(){},drawPolyLine:function(n,t){var u=ej.Ej3DRender.transform,r=ej.EjSvgRender.utils._getStringBuilder(),f=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[0],u),i,e;for(r.append("M "+f.x+" "+f.y+" "),i=0;i<n.VectorPoints.length;i++)lineSegment=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[i],u),r.append("L "+lineSegment.x+" "+lineSegment.y+" ");direction=r.toString();e={id:n.element.id,"stroke-dasharray":n.element.dashArray,"stroke-width":n.element.width,stroke:n.element.stroke,d:direction};t.svgRenderer.drawPath(e,n.element.child)},drawLine:function(n,t){var i=ej.Ej3DRender.transform;if(i!=null){var r=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[0],i),u=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[2],i),f={id:n.element.id,x1:r.x,y1:r.y,x2:u.x,y2:u.y,"stroke-dasharray":n.element.dashArray,"stroke-width":n.element.width,stroke:n.element.stroke,opacity:n.element.opacity};t.svgRenderer.drawLine(f,n.element.child)}},drawTemplate:function(n,t){var i=n.element,u=ej.Ej3DRender.transform,r;u!=null&&(r=ej.EjSvgRender.chartTransform3D.toScreen(n.VectorPoints[0],u),ej.EjSeriesRender.prototype.drawLabelTemplate(i.Label.series,i.Label.series.points[i.Label.pointIndex],i.Label.pointIndex,{X:r.x,Y:r.y},t))},drawText:function(t,i){var r=t.element,o=ej.Ej3DRender.transform,c,p;if(o!=null){var e=ej.EjSvgRender.chartTransform3D.toScreen(t.VectorPoints[0],o),s=e.x,h=e.y;if(r.tag=="text")c={id:r.id,x:s,y:h,fill:r.font.color,"font-size":r.font.size,"font-family":r.font.fontFamily,"font-style":r.font.fontStyle,"font-weight":r.font.fontWeight,opacity:r.font.opacity,"text-anchor":r.TextAnchor,cursor:"default",transform:r.Angle?"rotate("+r.Angle+","+s+","+h+")":null},i.svgRenderer.drawText(c,t.element.Label.Text,t.element.child,t.element.Label);else{var u=r.series,l=u.yAxis&&u.yAxis.labelFormat?u.yAxis.labelFormat:"",w=r.point.text?r.point.text:r.point.y+l.substring(l.indexOf("}")+1),a=ej.EjSvgRender.utils._measureText(w,null,u.marker.dataLabel.font),f=u.marker.dataLabel.margin,b=a.width+f.left+f.right,v=a.height+f.top+f.bottom,y={X:e.x,Y:e.y};p=u.marker.dataLabel.shape?u.marker.dataLabel.shape:u.marker.dataLabel.shape?marker.dataLabel.shape:"None";n.each(i.model.symbolShape,function(n){p.toLowerCase()==n.toLowerCase()&&(symbolName=n)});var k=y.X-f.left/2+f.right/2,d=y.Y-f.top/2-v/f.top+f.bottom/2,g=n.inArray(u,i.model.series);ej.EjSeriesRender.prototype.dataLabelSymbol(g,u,r.pointIndex,k,d,b,v,symbolName,i)}}},draw:function(i,r){var o,s,h;if(i.VectorPoints!=null&&!(i.VectorPoints.length<=0)){var c=ej.Ej3DRender.transform,l=ej.EjSvgRender.utils._getStringBuilder(),u=i.Fill,v=r.svgRenderer.checkColorFormat(u);if(v||(u=r.colorNameToHex(u)),o={Segments:null,StartPoint:null},c!=null)for(o.StartPoint=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[0],c),l.append("M "+o.StartPoint.x+" "+o.StartPoint.y+" "),s=0;s<i.VectorPoints.length;s++)lineSegment=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[s],c),l.append("L "+lineSegment.x+" "+lineSegment.y+" ");direction=l.toString();var f="Light",e=2*(Math.abs(t.vector3dAND(i.normal,t.vector3D(0,0,1)))-1),a=2*(Math.abs(t.vector3dAND(i.normal,t.vector3D(0,1,0)))-1),y=2*(Math.abs(t.vector3dAND(i.normal,t.vector3D(1,0,0)))-1);e==y?(f="ZLight",u=this.applyZLight(u,r)):a==e||e!=0&&a<e?(f="XLight",u=this.applyXLight(u,r)):e<0?(f="ZLight",u=this.applyZLight(u,r)):(f="Light",u=u);r.model.AreaType=="none"&&(i.StrokeThickness=0);h={id:r.svgObject.id+"_"+i.Name,name:f,fill:u,stroke:i.Stroke,"stroke-width":i.StrokeThickness,opacity:i.Opacity,d:direction};r.svgRenderer.drawPath(h,i.Element.Parent);r.model.previousID&&r.model.touchCross&&n("#"+h.id).insertAfter(n("#"+r.model.previousID));r.model.previousID=h.id}},applyXLight:function(n,t){var i=t.svgRenderer.hexToRGB(n);return i.R=parseInt(i.R*.7),i.G=parseInt(i.G*.7),i.B=parseInt(i.B*.7),t.svgRenderer.hexFromRGB(i)},applyZLight:function(n,t){var i=t.svgRenderer.hexToRGB(n);return i.R=parseInt(i.R*.9),i.G=parseInt(i.G*.9),i.B=parseInt(i.B*.9),t.svgRenderer.hexFromRGB(i)},update:function(t,i,r){var u,s;if(i.VectorPoints!=null&&!(i.VectorPoints.length<=0)){i.VectorPoints=t;var f=ej.Ej3DRender.transform,e=ej.EjSvgRender.utils._getStringBuilder(),h=i.Fill,o={Segments:null,StartPoint:null};if(f!=null)for(o.StartPoint=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[0],f),e.append("M "+o.StartPoint.x+" "+o.StartPoint.y+" "),u=0;u<i.VectorPoints.length;u++)lineSegment=ej.EjSvgRender.chartTransform3D.toScreen(i.VectorPoints[u],f),e.append("L "+lineSegment.x+" "+lineSegment.y+" ");direction=e.toString();n(r.chartObj.chart3D).find("#"+r.chartObj.svgObject.id+"_"+i.Name).length>0&&(s=n(r.chartObj.chart3D).find("#"+r.chartObj.svgObject.id+"_"+i.Name)[0],r.chartObj.svgRenderer._setAttr(n(s),{d:direction}))}}};var r=new ej.Ej3DRender,t=new r.vector3D,u=new r.matrix3D,e=new r.BSPTreeBuilder,f=new r.polygon3D,i=new r.Graphics3D}(jQuery);ej.Ej3DAxisRenderer=function(){};ej.Ej3DSeriesRender=function(){};ej.Ej3DChart=function(){};ej.series3DTypes={},function(n){ej.Ej3DAxisRenderer.prototype={_drawAxes:function(n,t,i){t.majorGridLines.visible&&this._drawGridLines3D(t,i);t.visible&&t.majorTickLines.visible&&this._renderTicks3D(t,t.majorTickLines.size,t.majorTickLines.width,i);t.visible&&(this._drawAxisLabel(t,i),this._drawMultiLevelLabel(n,t,i),this._drawAxisTitle(t))},_drawAxisTitle:function(t){var i,c,l,e,u,o,s;if(t.title.visible){i=t.title.font;this.gAxisTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"axisTitle_"+t.name});var h=t._opposed,p={Width:n(this.svgObject).width(),Height:n(this.svgObject).height()},w=10,f=ej.EjSvgRender.chartTransform3D.transform3D(p);f.mViewport=p;f.Rotation=0;f.Tilt=0;f.Depth=100;f.PerspectiveAngle=90;ej.EjSvgRender.chartTransform3D.transform(f);var b=ej.EjSvgRender.chartTransform3D.result,k=ej.Ej3DRender.prototype.matrix3D.prototype,d=t.orientation.toLowerCase(),a=!1;for(c=0;c<this.model._axes.length;c++)if(currentAxis=this.model._axes[c],currentAxis.orientation.toLowerCase()==d)for(l=0;l<currentAxis.multiLevelLabels.length;l++)if(currentAxis.multiLevelLabels[l].visible){a=!0;break}if(d=="horizontal"){var g=this.model.elementSpacing+t._LableMaxWidth.height,v=ej.EjSvgRender.utils._measureText(t.title.text,t.width,t.title.font).height/2,r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={Text:t.title.text,location:{x:t.width/2,y:g+v+t.majorTickLines.size+t.axisLine.width+this.model.wallSize+t._multiLevelLabelHeight},axes:t};this._trigger("axesTitleRendering",r);i=t.title.font;e=r.data.location.x+t.x;u=h?t.y-r.data.location.y:r.data.location.y+t.y;element={Width:v.width,Height:v.height,Label:r.data,TextAnchor:"middle",tag:"text",font:i,id:this.svgObject.id+"axisTitle",child:this.chart3D};a?(o={id:this.svgObject.id+"axisTitle",x:e,y:u,fill:i.color,"font-size":i.size,"font-family":i.fontFamily,"font-style":i.fontStyle,"font-weight":i.fontWeight,opacity:i.opacity,"text-anchor":"middle"},s=ej.EjSvgRender.chartTransform3D.toScreen({x:e,y:u,z:0},f,b,k),o.x=s.x,o.y=s.y,this.svgRenderer.drawText(o,r.data.Text,this.gAxisTitleEle),this.svgRenderer.append(this.gAxisTitleEle,this.svgObject)):this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(e,u,0),element,10,10))}else{var y=ej.EjSvgRender.utils._measureText(t.title.text,t.height,t.title.font),e=h?t.x+(4*this.model.elementSpacing+t._LableMaxWidth.width+t.majorTickLines.size+t.axisLine.width+this.model.wallSize+t._multiLevelLabelHeight):t.x-(3*this.model.elementSpacing+t._LableMaxWidth.width+t.majorTickLines.size+t.axisLine.width+this.model.wallSize+t._multiLevelLabelHeight),r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={Text:t.title.text,location:{x:y.width/2,y:0},axes:t};this._trigger("axesTitleRendering",r);i=t.title.font;var u=r.data.location.y+(t.y+t.height)+t.height/-2,tt=h?90:-90,nt=h?25:-25;element={Width:y.width,Height:y.height,Angle:-90,Label:r.data,TextAnchor:"middle",tag:"text",font:i,id:this.svgObject.id+"_YAxisTitle",child:this.chart3D};a?(o={id:id,x:e,y:u,fill:i.color,"font-size":i.size,"font-family":i.fontFamily,"font-style":i.fontStyle,"font-weight":i.fontWeight,opacity:i.opacity,"text-anchor":"middle",transform:"rotate(-90,"+e+","+(h?u+w:u-w)+")"},s=ej.EjSvgRender.chartTransform3D.toScreen({x:e,y:u,z:0},f,b,k),o.x=s.x+nt,o.y=s.y,this.svgRenderer.drawText(o,r.data.Text,this.gAxisTitleEle),this.svgRenderer.append(this.gAxisTitleEle,this.svgObject)):this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(e,u,0),element,10,10))}}},_drawMultiLevelLabel:function(t,i,r){var ft,et,d,w,rt,oi,ot,si;this.gMultiLevelEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_axisMultiLevelLabels_"+t});var d,v,g,e,c,ni,nt,o,s,y,ti=0,hi,ii,ci=i.multiLevelLabels.length,st=this.model,ht=st.elementSpacing,f=10,u=0,h=0,ri,tt,yt,pt,wt,bt,b=st.m_AreaBounds,p,it=i.visibleRange,kt,ct=st.wallSize,k=i._opposed,ui=r.axes[i.name]._validCross,dt,lt=i.orientation.toLowerCase(),fi=ui?i.y:b.Y+(!k&&b.Height),gt,li=ui?i.x:b.X+(k&&b.Width),l,rt,at=[],vt,ut,ei={Width:n(this.svgObject).width(),Height:n(this.svgObject).height()},a=ej.EjSvgRender.chartTransform3D.transform3D(ei);for(a.mViewport=ei,a.Rotation=0,a.Tilt=0,a.Depth=100,a.PerspectiveAngle=st.perspectiveAngle,ej.EjSvgRender.chartTransform3D.transform(a),ft=ej.EjSvgRender.chartTransform3D.result,et=ej.Ej3DRender.prototype.matrix3D.prototype,d=0;d<ci;d++)if(e=i.multiLevelLabels[d],id=this.svgObject.id+"_"+i.name+"MultiLevelLabels_"+t+"_"+d,e.text!=""&&e.visible){if(level=e._level,tt="middle",c=e.font,ut=e.border.width,maximumTextWidth=e.maximumTextWidth,gt=e.textAlignment.toLowerCase(),actualText=text=e.text,y=e.textOverflow.toLowerCase(),p=ej.EjSvgRender.utils._measureText(e.text,b.Width,e.font),ni=(e.end-e.start)/2,nt=(e.start+ni-it.min)/it.delta,o=(e.start-it.min)/it.delta,s=(e.end-it.min)/it.delta,i.isInversed&&(nt=isNaN(nt)?0:1-nt,o=isNaN(o)?0:1-o,s=isNaN(s)?0:1-s),lt=="horizontal"?(u=Math.round(i.width*nt)+b.X+i.plotOffset,h=k?fi-ct-i.majorTickLines.size-ht-f/2-i._LableMaxWidth.height:fi+ct+i.majorTickLines.size+ht+i._LableMaxWidth.height,o=Math.round(i.width*o)+b.X+i.plotOffset,s=Math.round(i.width*s)+b.X+i.plotOffset,g=maximumTextWidth?maximumTextWidth:s-o-f):(h=Math.round(i.plotOffset+i.y+i.height*(1-nt)),u=k?i.x+ct+i.majorTickLines.size+i.axisLine.width+ht/2+i._LableMaxWidth.width+i.multiLevelLabelHeight[level]/2:li-ct-i.majorTickLines.size-ht/2-i._LableMaxWidth.width-i.multiLevelLabelHeight[level]/2,o=Math.round(i.plotOffset+i.y+i.height*(1-o)),s=Math.round(i.plotOffset+i.y+i.height*(1-s)),g=maximumTextWidth?maximumTextWidth:i.multiLevelLabelHeight[level]+f),h=k?h-i.prevHeight[level]:h+i.prevHeight[level],gt=="far"?(u=u+g/2-ut/2,tt="end"):gt=="near"&&(tt="start",u=u-g/2+ut/2),w=ej.EjAxisRenderer.prototype._triggerMultiLevelLabelsRendering(actualText,u,h,y,c,e.border,this),text=actualText=w.text,u=w.location.x,h=w.location.y,y=w.textOverflow.toLowerCase(),c=w.font,c.color=c.color?c.color:i.multiLevelLabelsFontColor,hi=w.border,ii=w.border.type.toLowerCase(),ut=w.border.width,l={id:id,x:u,y:h,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,"text-anchor":tt},y!="none"&&(text=ej.EjAxisRenderer.prototype.textOverflowMultiLevelLabels(i,g,text,y,c,p,{x:u,y:h},null,this)),y=="wrap"||y=="wrapandtrim")for(newY=h,v=0;v<text.length;v++)p=ej.EjSvgRender.utils._measureText(text[v],null,c),v!=0&&(newY=k?newY-p.height:newY+p.height),ri={Width:p.width,Height:p.height,Label:{Text:text[v]},TextAnchor:tt,tag:"text",font:c,id:id+"_"+v,child:this.chart3D},l.id=l.id+"_"+v,rt=ej.EjSvgRender.chartTransform3D.toScreen({x:u,y:newY+f/2,z:0},a,ft,et),l.x=rt.x,l.y=rt.y,this.svgRenderer.drawText(l,text[v],this.gMultiLevelEle);if(u=lt=="horizontal"?u:k?u+f:u-f,y!="wrap"&&y!="wrapandtrim"&&(ri={Width:p.width,Height:p.height,Label:{Text:text},TextAnchor:tt,tag:"text",font:c,id:id,child:this.chart3D},rt=ej.EjSvgRender.chartTransform3D.toScreen({x:u,y:h+f/2,z:0},a,ft,et),l.x=rt.x,l.y=rt.y,this.svgRenderer.drawText(l,text,this.gMultiLevelEle)),oi=lt=="horizontal"?{bounds:{x:o,y:h-f,height:i.multiLevelLabelHeight[level],width:g},axisIndex:t,multiLevelLabel:e}:{bounds:{x:u-width/2-f/2,y:s,height:o-s,width:width},axisIndex:t,multiLevelLabel:e},this.model.multiLevelLabelRegions.push(oi),ii!="none"&&ut>0){for(id=this.svgObject.id+"_"+i.name+"MultiLevelLabelsBorder_"+t+"_"+d,ot=h-f+i.multiLevelLabelHeight[level]+f/2,si=e.border.color?e.border.color:i.multiLevelLabelsColor,lt=="horizontal"?(yt={x1:o,y1:h-f,x2:s,y2:h-f},pt={x1:o,y1:ot,x2:s,y2:ot},wt={x1:o,y1:h-f,x2:o,y2:ot},bt={x1:s,y1:h-f,x2:s,y2:ot}):(width=i.multiLevelLabelHeight[level],yt={x1:u-width/2-f/2,y1:s,x2:u+width/2+f/2,y2:s},pt={x1:u-width/2-f/2,y1:o,x2:u+width/2+f/2,y2:o},wt={x1:u-width/2-f/2,y1:s,x2:u-width/2-f/2,y2:o},bt={x1:u+width/2+f/2,y1:s,x2:u+width/2+f/2,y2:o}),vt=0;vt<4;vt++){switch(vt){case 0:newId=id+"_top";value=yt;break;case 1:newId=id+"_bottom";value=pt;break;case 2:newId=id+"_left";value=wt;break;case 3:newId=id+"_right";value=bt}at[0]=ej.Ej3DRender.prototype.vector3D.prototype.vector3D(value.x1,value.y1,ti);at[1]=ej.Ej3DRender.prototype.vector3D.prototype.vector3D(value.x2,value.y2,ti);kt=ej.EjSvgRender.chartTransform3D.toScreen(at[0],a,ft,et);dt=ej.EjSvgRender.chartTransform3D.toScreen(at[1],a,ft,et);l={id:newId,x1:kt.x,y1:kt.y,x2:dt.x,y2:dt.y,stroke:si,"stroke-width":ut};this.svgRenderer.drawLine(l,this.gMultiLevelEle)}this.svgRenderer.append(this.gMultiLevelEle,this.svgObject)}}},_drawAxisLabel:function(n,t){for(var a=n.visibleLabels.length,f=this.model.m_AreaBounds,u=n._opposed,c=t.axes[n.name]._validCross,l=c?n.y:f.Y+(!u&&f.Height),v=c?n.x:f.X+(u&&f.Width),r=0;r<a;r++)if(!ej.util.isNullOrUndefined(n.visibleLabels[r].Text)){var e=0,o=0,y=0,p=0,s,h=ej.EjSvgRender.utils._measureText(n.visibleLabels[r].Text,this.model.m_AreaBounds.Width,n.font),i=(n.visibleLabels[r].Value-n.visibleRange.min)/n.visibleRange.delta;i=n.isInversed?1-i:i;i=isNaN(i)?0:i;n.orientation.toLowerCase()=="horizontal"?(y=e=Math.round(n.width*i)+this.model.m_AreaBounds.X+n.plotOffset,o=u?l-this.model.wallSize-n.majorTickLines.size-this.model.elementSpacing/2:l+this.model.wallSize+n.majorTickLines.size+this.model.elementSpacing,s="middle"):(o=p=Math.round(n.plotOffset+n.y+h.height/4+n.height*(1-i)),e=u?n.x+n.majorTickLines.size+n.axisLine.width+this.model.elementSpacing/2:v-this.model.wallSize-n.majorTickLines.size-this.model.elementSpacing/2,s=u?"start":"end");element={Width:h.width,Height:h.height,Label:n.visibleLabels[r],TextAnchor:s,tag:"text",font:n.font,id:this.svgObject.id+n.orientation+r,child:this.chart3D};this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(e,o,0),element,10,10))}},_renderTicks3D:function(n,t,i,r){for(var s,f,o,y=n.visibleLabels.length,h=this.model.m_AreaBounds,p=n.y,e=0;e<y;e++){var c=0,l=0,a=0,v=0,u=(n.visibleLabels[e].Value-n.visibleRange.min)/n.visibleRange.delta;if(u=n.isInversed?1-u:u,u=isNaN(u)?0:u,n.orientation.toLowerCase()=="horizontal"?l=c=Math.round(n.width*u)+h.X+n.plotOffset:a=v=Math.round(n.plotOffset+n.height*(1-u)+n.y),f=this._calculatePosition3D(n,n.tickLinesPosition,t,i,c,a,l,v,r),o={width:n.majorTickLines.width,stroke:n.majorTickLines.color,child:this.chart3D,tag:"line"},o.id=this.svgObject.id+n.name+"_majorTickLines_"+e,this.graphics.addVisual(this.polygon.createLine(o,f.X1,f.Y1,f.X2,f.Y2,0)),n.minorGridLines.visible&&n.minorTicksPerInterval>0&&e<y-1)for(minorTicks=n.visibleRange.interval/(n.minorTicksPerInterval+1),s=0;s<n.minorTicksPerInterval;s++)u=ej.EjSvgRender.utils._valueToCoefficient(n,n.visibleLabels[e].Value+minorTicks*(s+1)),u=isNaN(u)?0:u,n.orientation.toLowerCase()=="horizontal"?c=l=Math.round(n.plotOffset+h.Width*u+h.X):a=v=Math.round(n.plotOffset+h.Height*(1-u))+n.y,f=this._calculatePosition3D(n,n.tickLinesPosition,t,i,c,a,l,v,r),o={width:n.minorTickLines.width,stroke:n.minorTickLines.color,child:this.chart3D,tag:"line"},o.id=this.svgObject.id+n.name+"_minorTickLines_"+e+s,this.graphics.addVisual(this.polygon.createLine(o,f.X1,f.Y1,f.X2,f.Y2,0))}},_calculatePosition3D:function(n,t,i,r,u,f,e,o,s){var w=n.orientation,h=n._opposed,t="outside",c=this.model.m_AreaBounds,v=s.axes[n.name]._validCross,y=v?n.y:c.Y+(!h&&c.Height),p=v?n.x:c.X+(h&&c.Width),a,l;if(n.orientation.toLowerCase()=="horizontal"){switch(t){case"inside":f=h?r:0;o=h?f+i:i;break;case"outside":f=0;o=h?i:f+i}l=h?y-this.model.wallSize-i:y+this.model.wallSize-i/2;a=n.x;f+=l;o+=l;u=e=u}else{switch(t){case"inside":u=0;e=h?i:u+i;break;case"outside":u=0;e=h?u+i:i}a=h?p+this.model.wallSize:p-this.model.wallSize-i;l=this.model.m_AreaBounds.Y;u+=a;e+=a;f=o=f}return{X1:u,Y1:f,X2:e,Y2:o}},_drawGridLines3D:function(t,i){var v,u,a,b,c,r,f,y,h;if(t!=null){var p=t.visibleLabels.length,w,k=t._opposed,nt=t.orientation,d=i.axes[t.name]._validCross,l,e,o,s;if(nt.toLowerCase()=="horizontal")for(u=0;u<p;u++){r=ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[u].Value);r=isNaN(r)?0:r;e=l=Math.round(t.width*r)+this.model.m_AreaBounds.X+t.plotOffset;o=this.model.m_AreaBounds.Y;s=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height;var a=this.model.depth>2?this.model.depth-2:1,g=d?t.y:this.model.m_AreaBounds.Y+(!k&&this.model.m_AreaBounds.Height),f={opacity:t.majorGridLines.opacity,width:t.majorGridLines.width,stroke:t.majorGridLines.color,child:this.chart3D,tag:"line"};if(f.id=this.svgObject.id+t.name+"_gridlines_"+u,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),v=n.extend({},f),v.id=this.svgObject.id+t.name+"_parallelGridlines_"+u,h=this.polygon.createLine(v,e,0,e,-a,g),this.polygon.transform(this.matrixobj.tilt(parseFloat(Math.PI/2)),h),this.graphics.addVisual(h),t.minorGridLines.visible&&t.minorTicksPerInterval>0&&u<p-1)for(w=t.visibleRange.interval/(t.minorTicksPerInterval+1),c=0;c<t.minorTicksPerInterval;c++)r=ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[u].Value+w*(c+1)),r=isNaN(r)?0:r,e=l=Math.round(this.model.m_AreaBounds.Width*r)+this.model.m_AreaBounds.X,o=this.model.m_AreaBounds.Y,s=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height,f={opacity:t.minorGridLines.opacity,width:t.minorGridLines.width,stroke:t.minorGridLines.color,child:this.chart3D,tag:"line"},f.id=this.svgObject.id+t.name+"_minorgridlines_"+u+c,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),v=n.extend({},f),v.id=this.svgObject.id+t.name+"_parallelMinorGridlines_"+u+c,h=this.polygon.createLine(v,e,0,e,-a,g),this.polygon.transform(this.matrixobj.tilt(parseFloat(Math.PI/2)),h),this.graphics.addVisual(h);index++}else for(u=0;u<p;u++){if(r=(t.visibleLabels[u].Value-t.visibleRange.min)/t.visibleRange.delta,r=t.isInversed?1-r:r,r=isNaN(r)?0:r,l=this.model.m_AreaBounds.X,o=Math.round(t.height*(1-r))+.5,o+=t.y,e=l+this.model.m_AreaBounds.Width,s=o,a=this.model.depth>2?this.model.depth-2:1,f={opacity:t.majorGridLines.opacity,width:t.majorGridLines.width,stroke:t.majorGridLines.color,axisName:t.name,child:this.chart3D,tag:"line"},f.id=this.svgObject.id+t.name+"_gridlines_"+u,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),b=d?t.x:this.model.m_AreaBounds.X+(k&&this.model.m_AreaBounds.Width+1),y=n.extend({},f),y.id=this.svgObject.id+t.name+"_parallelGridlines_"+u,h=this.polygon.createLine(y,-a,s,0,s,b),this.polygon.transform(this.matrixobj.turn(parseFloat(-Math.PI/2)),h),this.graphics.addVisual(h),t.minorGridLines.visible&&t.minorTicksPerInterval>0&&u<p-1)for(w=t.visibleRange.interval/(t.minorTicksPerInterval+1),c=0;c<t.minorTicksPerInterval;c++)r=ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[u].Value+w*(c+1)),r=isNaN(r)?0:r,l=this.model.m_AreaBounds.X,o=Math.round(t.height*(1-r))+.5,o+=t.y,e=l+this.model.m_AreaBounds.Width,s=o,f={opacity:t.minorGridLines.opacity,width:t.minorGridLines.width,stroke:t.minorGridLines.color,axisName:t.name,child:this.chart3D,tag:"line"},f.id=this.svgObject.id+t.name+"_minorgridlines_"+u+c,this.graphics.addVisual(this.polygon.createLine(f,l,o,e,s,a)),y=n.extend({},f),y.id=this.svgObject.id+t.name+"_parallelMinorGridlines_"+u+c,h=this.polygon.createLine(y,-a,s,0,s,b),this.polygon.transform(this.matrixobj.turn(parseFloat(-Math.PI/2)),h),this.graphics.addVisual(h);index++}}}};ej.Ej3DSeriesRender.prototype={_getSegmentDepth:function(n){var u=this.chartObj.model.depth,i,r,t;if(this.chartObj.model._sideBySideSeriesPlacement)t=u/4,i=t,r=t*3;else{var e=n.position-1,f=n.all,t=u/(f*2+f+1);i=t+t*e*3;r=i+t*2}return{Start:i,End:r,Delta:r-i}},createSegment:function(n,t,i,r,u,f,e,o,s){return{StartValue:t,EndValue:i,depth:r,radius:u,index:f,YData:e,Center:n,inSideRadius:o,ActualEndValue:i,ActualStartValue:t,pointIndex:s}},calculateSize:function(t,i){var r=t.chartObj.model.legend,o=0,s=0,u=t.chartObj.model.title,h=t.chartObj.model.title.subTitle,e=t.chartObj.model._titleLocation,l=t.chartObj.model._subTitleLocation,a=t.chartObj.model.title.textOverflow,v=t.chartObj.model.title.subTitle.textOverflow,p=u.text&&u.visible&&u.enableTrim&&(a=="wrap"||a=="wrapandtrim")?!0:!1,y,f,c;return subTitleEnable=h.text&&h.visible&&h.enableTrim&&(v=="wrap"||v=="wrapandtrim")?!0:!1,r.visible&&r.position.toLowerCase()!="custom"&&(r.position.toLowerCase()=="right"||r.position.toLowerCase()=="left"?o=(r.position.toLowerCase()=="right"?t.chartObj.model.margin.right:t.chartObj.model.margin.left)+t.chartObj.model.LegendViewerBounds.Width:s=(r.position.toLowerCase()=="top"?t.chartObj.model.margin.top:t.chartObj.model.margin.bottom)+t.chartObj.model.LegendViewerBounds.Height),i.actualWidth=n(t.chartObj.svgObject).width()-o,y=i.actualWidth*.5+(r.position.toLowerCase()==="left"?o:0),p||subTitleEnable?(f=e.size.height+(subTitleEnable?l.size.height:0)+s,i.actualHeight=n(t.chartObj.svgObject).height()-f,c=i.actualHeight*.5+(r.position.toLowerCase()==="top"?f:e.size.height+(subTitleEnable?l.size.height:0))):(f=(u.text&&u.visible?e.Y:0)+s,i.actualHeight=n(t.chartObj.svgObject).height()-f,c=i.actualHeight*.5+(r.position.toLowerCase()==="top"?f:u.text&&u.visible?e.Y:0)),{centerX:y,centerY:c}},createPoints:function(t,i){var r;t.segments=[];var y=this.calculateSize(i,t),e=0,nt=this._calculateVisiblePoints(t).visiblePoints,p=t._visiblePoints.length;for(j=0;j<p;j++)e+=nt[j].YValues[0];var w=360/e,b=n.inArray(t,i.chartObj.model._visibleSeries),rt=this.chartObj.model._visibleSeries.length,tt=i.chartObj.model.innerRadius[b],k=i.chartObj._getYValues(t._visiblePoints),it=i.chartObj.model.depth,c,l=0,a=0,s=0,d,u,f,o,v,g=0,h=i.chartObj.model.circularRadius[b];for(r=0;r<p;r++)(t._visiblePoints[r].visible||t._visiblePoints[r].gapMode)&&(d=n.inArray(t._visiblePoints[r],t._visiblePoints),u=Math.abs(k[r]),a=Math.abs(u)*(Math.PI*2/e),f={},f.x=0,f.y=0,u!=0&&((t.explodeIndex==t._visiblePoints[r].actualIndex||t.explodeAll)&&(o={X:0,Y:0},o.X=Math.cos(2*Math.PI*(s+u/2)/e),o.Y=Math.sin(2*Math.PI*(s+u/2)/e),f.x=.01*h*o.X*t.explodeOffset,f.y=.01*h*o.Y*t.explodeOffset),c=i.chartObj.vector.vector3D(f.x+y.centerX,f.y+y.centerY,0),v=this.createSegment(c,parseFloat(w*s),parseFloat(w*u),it,h,r,u,tt,d,t),v.visible=t._visiblePoints[r].gapMode?!1:!0,t.segments.push(v)),t.marker.dataLabel.visible&&this._addPieDataLabel(g,k[r],l,l+a,r,h,this._isChartRotated(i)?i.chartObj.model.depth+5:0,c,t._visiblePoints[r]),g++,l+=a,s+=u);return t.segments},_addPieDataLabel:function(n,t,i,r,u,f,e,o,s){var h=(i+r)/2;s.symbolLocation={x:0,y:0,radius:0,angle:0,StartDepth:0};s.symbolLocation.x=n;s.symbolLocation.y=t;s.symbolLocation.radius=f;s.symbolLocation.angle=h;s.symbolLocation.center=o;s.startDepth=e},_isChartRotated:function(n){var t=Math.abs(n.chartObj.model.tilt%360),i=Math.abs(n.chartObj.model.rotattion%360);return(t>90&&t<270)^(i>90&&i<270)?!0:!1},createSector:function(n,t,i,r){var o=parseInt(Math.ceil(n.ActualEndValue/6)),v=Math.PI/180,s=0,it=[],h=t.chartObj.model.depth,b,k,nt,tt,d,g,l,a,u,p,w;if(o<1)return null;var c=[],y=n.ActualEndValue/o,f=[],e=[];for(u=0;u<o+1;u++)b=parseFloat(n.Center.x+n.radius*Math.cos((n.ActualStartValue+u*y)*v)),k=parseFloat(n.Center.y+n.radius*Math.sin((n.ActualStartValue+u*y)*v)),f[u]={X:b,Y:k},nt=parseFloat(n.Center.x+n.inSideRadius*Math.cos((n.ActualStartValue+u*y)*v)),tt=parseFloat(n.Center.y+n.inSideRadius*Math.sin((n.ActualStartValue+u*y)*v)),e[u]={X:nt,Y:tt},it.push({X:b,Y:k});for(d=[],u=0;u<o;u++)vts=[t.chartObj.vector.vector3D(f[u].X,f[u].Y,0),t.chartObj.vector.vector3D(f[u].X,f[u].Y,h),t.chartObj.vector.vector3D(f[u+1].X,f[u+1].Y,h),t.chartObj.vector.vector3D(f[u+1].X,f[u+1].Y,0)],d[u]=t.chartObj.polygon.polygon3D(vts,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D),s++;if(c[1]=d,n.inSideRadius>0){for(g=[],u=0;u<o;u++)vts=[t.chartObj.vector.vector3D(e[u].X,e[u].Y,0),t.chartObj.vector.vector3D(e[u].X,e[u].Y,h),t.chartObj.vector.vector3D(e[u+1].X,e[u+1].Y,h),t.chartObj.vector.vector3D(e[u+1].X,e[u+1].Y,0)],g[u]=t.chartObj.polygon.polygon3D(vts,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D),s++;c[3]=g}for(l=[],a=[],u=0;u<o+1;u++)l.push(t.chartObj.vector.vector3D(f[u].X,f[u].Y,0)),a.push(t.chartObj.vector.vector3D(f[u].X,f[u].Y,h));if(n.inSideRadius>0)for(u=o;u>-1;u--)l.push(t.chartObj.vector.vector3D(e[u].X,e[u].Y,0)),a.push(t.chartObj.vector.vector3D(e[u].X,e[u].Y,h));else l.push(n.Center),a.push(t.chartObj.vector.vector3D(n.Center.x,n.Center.y,h));return c[0]=[],c[0].push(t.chartObj.polygon.polygon3D(l,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,c[0].push(t.chartObj.polygon.polygon3D(a,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,n.inSideRadius>0?(p=[t.chartObj.vector.vector3D(f[0].X,f[0].Y,0),t.chartObj.vector.vector3D(f[0].X,f[0].Y,h),t.chartObj.vector.vector3D(e[0].X,e[0].Y,h),t.chartObj.vector.vector3D(e[0].X,e[0].Y,0)],w=[t.chartObj.vector.vector3D(f[o].X,f[o].Y,0),t.chartObj.vector.vector3D(f[o].X,f[o].Y,h),t.chartObj.vector.vector3D(e[o].X,e[o].Y,h),t.chartObj.vector.vector3D(e[o].X,e[o].Y,0)],c[2]=[],c[2].push(t.chartObj.polygon.polygon3D(p,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,c[2].push(t.chartObj.polygon.polygon3D(w,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++):(p=[t.chartObj.vector.vector3D(f[0].X,f[0].Y,0),t.chartObj.vector.vector3D(f[0].X,f[0].Y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,0)],w=[t.chartObj.vector.vector3D(f[o].X,f[o].Y,0),t.chartObj.vector.vector3D(f[o].X,f[o].Y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,h),t.chartObj.vector.vector3D(n.Center.x,n.Center.y,0)],c[2]=[],c[2].push(t.chartObj.polygon.polygon3D(p,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++,c[2].push(t.chartObj.polygon.polygon3D(w,this,n.index,i.borderColor,i.borderWidth,i.opacity,i.interior,s.toString()+"_Region_Series_"+r+"_Point_"+n.index,t.chartObj.chart3D)),s++),c},createPolygons:function(t,i,r){var s,f=[],a,v,h,y,e,p=n.inArray(t,i.chartObj.model._visibleSeries),o,c,u,l;for(s=t.segments&&r?t.segments:this.createPoints(t,i),y=s.length,o=0;o<y;o++)if(a=s[o],a.visible&&(h=s[o].pointIndex,v=i.chartObj.setStyle(i,t,p,h),typeof i.chartObj.model.pointColors[h]=="object"&&(v.interior=i.chartObj.model.pointColors[h][0].color),e=this.createSector(a,i,v,p),e!=null))for(u=0;u<e.length;u++)if(f[u]||(f[u]=[]),e[u]!=null)for(c=0;c<e[u].length;c++)f[u].push(e[u][c]);if(r)return f;for(u=0;u<f.length;u++)for(l=0;l<f[u].length;l++)i.chartObj.graphics.addVisual(f[u][l])},draw3DDataLabel:function(t,i,r){var e=t.marker.dataLabel.connectorLine.height,w,o,g,c,v,nt;if(this.chartObj.model.AreaType=="none"){u={x:0,y:0};var l=r.text?r.text:r.y,y=n.inArray(t,this.chartObj.model.series),f=n.extend({},ej.EjSvgRender.commonChartEventArgs);if(f.data={text:l,location:{x:h,y:s},series:t,pointIndex:i,seriesIndex:y},this.chartObj._trigger("displayTextRendering",f),f.data.Text=f.data.text,o=ej.EjSvgRender.utils._measureText(l,null,t.marker.dataLabel.font),t.type.toLowerCase()=="doughnut"||t.type.toLowerCase()=="pie"){var tt=Math.min(t.actualWidth,t.actualHeight)/2,b=r.symbolLocation.center,k=r.symbolLocation.radius*t._coefficient;ej.util.isNullOrUndefined(e)&&(e=ej.EjSvgRender.utils._measureText(f.data.text,null,t.marker.dataLabel.font).height);t!=null&&t.labelPosition!="inside"?radius=r.symbolLocation.radius+e:t!=null&&(radius=k+(r.symbolLocation.radius-k)/2);h=u.X=b.x+radius*Math.cos(r.symbolLocation.angle);s=u.Y=b.y+radius*Math.sin(r.symbolLocation.angle)}}else{var d=t.yAxis.labelFormat?t.yAxis.labelFormat:"",y=n.inArray(t,this.chartObj.model.series),l=r.text?r.text:r.y+d.substring(d.indexOf("}")+1),p=0,f=n.extend({},ej.EjSvgRender.commonChartEventArgs);f.data={text:l,location:{x:h,y:s},series:t,pointIndex:i};this.chartObj._trigger("displayTextRendering",f);f.data.Text=f.data.text;var o=ej.EjSvgRender.utils._measureText(l,null,t.marker.dataLabel.font),u=ej.EjSvgRender.utils.Transform3DToVisible(t,r.symbolLocation.x,r.symbolLocation.y,this.chartObj),e=t.marker.dataLabel.connectorLine.height?t.marker.dataLabel.connectorLine.height:0,a=6.28*(1-90/360),s=u.Y,h=u.X;this.chartObj.model.requireInvertedAxes?(h=r.x>0?u.X-Math.sin(a)*e:u.X+Math.sin(a)*e,p=-o.height/3):s=r.y>0?u.Y+Math.sin(a)*e:u.Y+Math.sin(-a)*e}g=this._getSegmentDepth(t);t.marker.dataLabel.shape.toLowerCase()=="none"||r.marker.dataLabel.template||f.data.Text==""||(c={tag:"dataLabel",series:t,point:r,pointIndex:i,id:this.chartObj.svgObject.id+y+"_DataLabel"+i,child:this.chartObj.chart3D},this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(h,s,r.symbolLocation.z?r.symbolLocation.z:0),c,0,-o.height)));w=r.marker.dataLabel.template?"template":"text";c={Width:o.width,Height:o.height,Label:f.data,TextAnchor:"middle",tag:w,font:t.marker.dataLabel.font,Angle:t.marker.dataLabel.angle,id:this.chartObj.svgObject.id+"_SeriesText"+i+y,child:this.chartObj.chart3D};this.chartObj.model.AreaType!="none"?(t.marker.dataLabel.connectorLine.height&&t.marker.dataLabel.connectorLine.height>0&&(v=[],v.push({x:u.X,y:u.Y+p,z:r.symbolLocation.z}),v.push({x:h,y:s+p,z:r.symbolLocation.z}),this.drawLineSegment(v,i,t)),this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(h,s,r.symbolLocation.z),c,0,-o.height))):(t.labelPosition.toLowerCase()!="inside"&&this.updateConnectorLine(r,i,t,u,e),nt={x:t.actualWidth,y:t.actualHeight},this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(u.X,u.Y,-1),c,0,-o.height)))},updateConnectorLine:function(n,t,i,r,u){var e=[],f=n.symbolLocation,o=f.center.x+Math.cos(f.angle)*f.radius,s=f.center.y+Math.sin(f.angle)*f.radius,h;e.push({x:o,y:s});h=f.radius+u;o=f.center.x+Math.cos(f.angle)*h;s=f.center.y+Math.sin(f.angle)*h;e.push({x:o,y:s});i.marker.dataLabel.connectorLine.type=="bezier"&&(e=this.getBezierApproximation(e,256,i));this.drawLineSegment(e,t,i)},getBezierApproximation:function(n,t,i){for(var f,u=[],r=0;r<=t;r++)f=r/t,u.push(this.GetBezierPoint(f,n,0,n.length,i));return u},drawLineSegment:function(t,i,r){for(var f=[],u=0;u<t.length;u++)f.push(this.chartObj.vector.vector3D(t[u].x,t[u].y,t[u].z?t[u].z:0));var e=n.inArray(r,this.chartObj.model._visibleSeries),o=this.chartObj.model.AreaType=="none"?this.chartObj.model.pointColors[i]:this.chartObj.model.seriesColors[e],s=r.marker.dataLabel.connectorLine.stroke?r.marker.dataLabel.connectorLine.stroke:o,h={width:r.marker.dataLabel.connectorLine.width,stroke:s,child:this.chartObj.chart3D,tag:"polyline",id:this.chartObj.svgObject.id+"_"+e+"_"+i};this.chartObj.graphics.addVisual(this.chartObj.polygon.createPolyline(f,h))}};ej.ejCircularSeries={draw:function(t,r,u){if(seriesLength=r.chartObj.model._visibleSeries.length,seriesIndex=n.inArray(t,r.chartObj.model._visibleSeries),r._calculateVisiblePoints(t),r.calculateSize(r,t),u=="pie"?(t._size=t.pieCoefficient,t._coefficient=seriesIndex==0?0:t._size):(t._size=t.doughnutSize,t._coefficient=t.doughnutCoefficient),r.chartObj.model.circularRadius.length>1){for(i=seriesIndex;i<r.chartObj.model.circularRadius.length;i++)if(!ej.util.isNullOrUndefined(r.chartObj.model.circularRadius[i])){r.chartObj.model.circularRadius[seriesIndex]=r.chartObj.model.circularRadius[i]*t._size;break}}else r.chartObj.model.circularRadius[seriesIndex]=(1-.03)*Math.min(t.actualWidth/2,t.actualHeight/2)*t._size;r.chartObj.model.innerRadius[seriesIndex]=t._coefficient*r.chartObj.model.circularRadius[seriesIndex];r.createPolygons(t,r)},doAnimation:function(t,i){var r=this;t.count=0;n.each(t.segments,function(r,u){var f=u.radius,e=u.inSideRadius;t.animate=!0;n(i.chartObj.element).each(function(){u.radius=0;u.inSideRadius=0}).animate({Radius:f,InsideRadius:e},{duration:1e3,queue:!1,step:function(n,r){var e,f,o;for(r.prop.toString()==="Radius"?u.radius=n:u.inSideRadius=n,e=i.createPolygons(t,i,!0),f=0;f<e.length;f++)for(o=0;o<e[f].length;o++)i.chartObj.polygon.update(e[f][o].VectorPoints,e[f][o],i)},complete:function(){i.chartObj.model.AnimationComplete=!0;var r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={series:t};i.chartObj._trigger("animationComplete",r)}})})}};ej.series3DTypes.doughnut=ej.ejCircularSeries;ej.series3DTypes.pie=ej.ejCircularSeries;ej.ej3DStackingColumn={draw:function(n,t,i,r){var f=t._isVisiblePoints(n),u;for(this.createSegments(n,t,r),u=0;u<f.length;u++)f[u].visible&&(n._visiblePoints[u].plans=null,ej.ej3DColumnSeries.update(n,n._visiblePoints[u],u,t))},createSegments:function(n,t,i){var c=t.chartObj._getXValues(n._visiblePoints),e,o,f,u,r;if(c!=null)for(o=t.getSideBySideInfo(n,i),f=t._getSegmentDepth(n),e=o.Delta/2,u=t._isVisiblePoints(n),r=0;r<u.length;r++){var s=c[r]+o.Start,a=c[r]+o.End,l=n.stackedValue.StartValues[r],h=n.stackedValue.EndValues[r];if(ej.ej3DColumnSeries._setData(s,h,a,l,f.Start,f.End,t,u[r]),n.marker.dataLabel.visible){u[r].symbolLocation={x:0,y:0,z:0};switch(n.marker.dataLabel.textPosition){case"top":u[r].symbolLocation.x=s+e;u[r].symbolLocation.y=h;u[r].symbolLocation.z=f.Start+f.Delta/2;break;case"bottom":u[r].symbolLocation.x=s+e;u[r].symbolLocation.y=l-.2;u[r].symbolLocation.z=f.Start+(f.End-f.Start)/2;break;default:u[r].symbolLocation.x=s+e;u[r].symbolLocation.y=h+(l-h)/2;u[r].symbolLocation.z=f.Start}}}},doAnimation:function(t,i){var r=this;n.each(t._visiblePoints,function(r,u){var f=u.Top,e=u.Bottom;n(u).each(function(){u.Top=0;u.Bottom=0}).animate({Top:f,Bottom:e},{duration:1200,queue:!1,step:function(n,f){f.prop.toString()==="Top"&&(u.Top=n);f.prop.toString()==="Bottom"&&(u.Bottom=n);ej.ej3DColumnSeries.update(t,u,r,i)},complete:function(){i.chartObj.model.AnimationComplete=!0;var r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={series:t};i.chartObj._trigger("animationComplete",r)}})})}};ej.series3DTypes.stackingcolumn=ej.ej3DStackingColumn;ej.series3DTypes.stackingbar=ej.ej3DStackingColumn;ej.series3DTypes.stackingbar100=ej.ej3DStackingColumn;ej.series3DTypes.stackingcolumn100=ej.ej3DStackingColumn;ej.ej3DColumnSeries={draw:function(n,t,i,r){var f=t._isVisiblePoints(n),u;for(this.createSegments(n,t,r),u=0;u<f.length;u++)f[u].visible&&(n._visiblePoints[u].plans=null,this.update(n,n._visiblePoints[u],u,t))},update:function(t,i,r,u){var v=t.xAxis._valueType.toLowerCase(),l=n.inArray(t,u.chartObj.model._visibleSeries),y=v=="logarithmic"?null:1,p=v=="logarithmic"?!0:!1,w=p?Math.log(i.Left,y):i.Left,b=p?Math.log(i.Right,y):i.Right,e=t.yAxis.visibleRange.min,k=t.yAxis.visibleRange.max,o=t.xAxis.visibleRange.min,s=t.xAxis.visibleRange.max,d,a;if(w>=o&&w<=s||b>=o&&b<=s){d=i.Top<0?i.Top>e?i.Top:e:t.yAxis.valueType&&t.yAxis.valueType.toLowerCase()=="logarithmic"?i.Top:i.Top<k?i.Top:k;var h=ej.EjSvgRender.utils.Transform3DToVisible(t,i.Left>o?i.Left:o,d,u.chartObj),c=ej.EjSvgRender.utils.Transform3DToVisible(t,s>i.Right?i.Right:s,e>i.Bottom?e:i.Bottom,u.chartObj),g=u.chartObj.vector.vector3D(Math.min(h.X,c.X),Math.min(h.Y,c.Y),i.StartDepth),nt=u.chartObj.vector.vector3D(Math.max(h.X,c.X),Math.max(h.Y,c.Y),i.EndDepth),f=u.chartObj.setStyle(u,t,l,r);f.interior.indexOf("url")>=0&&(f.interior=u.chartObj.model.seriesColors[l][0].color);a="Region_Series_"+l+"_Point_"+r;t.columnFacet=="cylinder"?u.chartObj.polygon.createCylinder(g,nt,this,r,t.type,f.borderColor,f.interior,f.borderWidth,f.opacity,u.chartObj.model.requireInvertedAxes,a,u.chartObj.chart3D):t.columnFacet=="rectangle"&&u.chartObj.polygon.createBox(g,nt,this,r,t.type,f.borderColor,f.interior,f.borderWidth,f.opacity,u.chartObj.model.requireInvertedAxes,a,u.chartObj.chart3D)}},_setData:function(){var n=arguments;point=arguments[arguments.length-1];sender=arguments[arguments.length-2];point.Left=n[0];point.Bottom=n[3];point.Top=n[1];point.Right=n[2];point.StartDepth=n[4];point.EndDepth=n[5];point.XRange=sender.getDoubleRange(point.Left,point.Right);isNaN(point.Top)||isNaN(point.Bottom)||(point.YRange=sender.getDoubleRange(point.Top,point.Bottom))},createSegments:function(n,t,i){var f=t.chartObj._getXValues(n._visiblePoints),c=t.chartObj._getYValues(n._visiblePoints),e,u,r;if(f!=null)for(e=t.getSideBySideInfo(n,i),u=t._getSegmentDepth(n),crossValue=t.chartObj._getXCrossValue(n,n.xAxis,i),median=e.Delta/2,visiblePoints=n._visiblePoints,cons=.2,r=0;r<visiblePoints.length;r++){var o=f[r]+e.Start,l=f[r]+e.End,s=c[r],h=crossValue;if(this._setData(o,s,l,h,u.Start,u.End,t,visiblePoints[r]),XData=f[r],YData=c[r],n.marker.dataLabel.visible){visiblePoints[r].symbolLocation={x:0,y:0,z:0};switch(n.marker.dataLabel.textPosition){case"top":visiblePoints[r].symbolLocation.x=o+median;visiblePoints[r].symbolLocation.y=s;visiblePoints[r].symbolLocation.z=u.Start+u.Delta/2;break;case"bottom":visiblePoints[r].symbolLocation.x=o+median;visiblePoints[r].symbolLocation.y=h-cons;visiblePoints[r].symbolLocation.z=u.Start+(u.End-u.Start)/2;break;default:visiblePoints[r].symbolLocation.x=o+median;visiblePoints[r].symbolLocation.y=Math.abs(h-s)/2;visiblePoints[r].symbolLocation.z=u.Start}}}},doAnimation:function(t,i){var r=this;n.each(t._visiblePoints,function(u,f){var e=f.Top;n(f).each(function(){f.Top=0}).animate({Top:e},{duration:1200,queue:!1,step:function(n,e){e.prop.toString()==="Top"&&(f.Top=n);r.update(t,f,u,i)},complete:function(){i.chartObj.model.AnimationComplete=!0;var r=n.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={series:t};i.chartObj._trigger("animationComplete",r)}})})}};ej.series3DTypes.column=ej.ej3DColumnSeries;ej.series3DTypes.bar=ej.ej3DColumnSeries;ej.Ej3DChart.prototype={renderSeries:function(t,i,r){var i,u,f,e,o;(ej.Ej3DSeriesRender.prototype.chartObj=t,n.extend(ej.Ej3DSeriesRender.prototype,ej.EjSeriesRender.prototype),u=new ej.Ej3DSeriesRender,f=n.extend({},ej.EjSvgRender.commonChartEventArgs),f.data={series:i},u.chartObj._trigger("seriesRendering",f),e=i.type.toLowerCase(),o=ej.series3DTypes[e],ej.util.isNullOrUndefined(o))||(o.draw(i,u,e,r),i.marker.dataLabel.visible&&n.each(i._visiblePoints,function(r,f){f.marker=n.extend(!0,{},i.marker,f.marker);f.visible&&(ej.util.isNullOrUndefined(f.marker)||f.marker.dataLabel&&f.marker.dataLabel.visible)&&u.draw3DDataLabel(i,r,f,t)}))},update3DWall:function(t,i){var u,r,f;if(t.model.AreaType=="cartesianaxes")for(n.extend(ej.Ej3DRender.prototype,this),this.updateBackWall(t),u=0;u<t.model._axes.length;u++)r=t.model._axes[u],f=r._opposed,r.orientation.toLowerCase()=="vertical"?f?this.updateRightWall(t,r,i):this.updateLeftWall(t,r,i):f?this.updateTopWall(t,r,i):this.updateBottomWall(t,r,i)},updateTopWall:function(n,t,i){var e=0,r=n.model.m_AreaBounds,u=i.axes[t.name]._validCross?t.y:r.Y,o,s,f;for(e=n.model.wallSize<u?u-n.model.wallSize:-(n.model.wallSize-u),o=n.vector.vector3D(r.X+r.Width,-n.model.depth,u-.1),s=n.vector.vector3D(r.X,-.1,e),topSideWallPlans=n.polygon.createBox(o,s,this,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"TopWallBrush",n.chart3D),f=0;f<topSideWallPlans.length;f++)n.polygon.transform(n.matrixobj.tilt(parseFloat(Math.PI/2)),topSideWallPlans[f])},updateRightWall:function(n,t,i){var f=i.axes[t.name]._validCross?t.x:n.model.m_AreaBounds.X+n.model.m_AreaBounds.Width,r={left:-n.model.depth,top:n.model.m_AreaBounds.Y,bottom:n.model.m_AreaBounds.Height+n.model.m_AreaBounds.Y,right:0},e=n.vector.vector3D(r.left,r.top,f+1.5),o=n.vector.vector3D(r.right,r.bottom,f+n.model.wallSize),u;for(rightSideWallPlans=n.polygon.createBox(e,o,n,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"RightWallBrush",n.chart3D),u=0;u<rightSideWallPlans.length;u++)n.polygon.transform(n.matrixobj.turn(parseFloat(-Math.PI/2)),rightSideWallPlans[u])},updateBackWall:function(n){var t=n.model.m_AreaBounds,i=n.vector.vector3D(t.X,t.Y,n.model.depth==0?1.5:n.model.depth+n.model.wallSize),r=n.vector.vector3D(t.X+t.Width,t.Y+t.Height,n.model.depth==0?1.5:n.model.depth);n.polygon.createBox(i,r,n,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"BackWallBrush",n.chart3D)},updateLeftWall:function(n,t,i){var r={left:-n.model.depth,top:n.model.m_AreaBounds.Y,bottom:n.model.m_AreaBounds.Height+n.model.m_AreaBounds.Y,right:0},f=i.axes[t.name]._validCross?t.x:n.model.m_AreaBounds.X,e=n.vector.vector3D(r.left,r.top,f-.1),o=n.vector.vector3D(r.right,r.bottom,f-n.model.wallSize),u;for(leftSideWallPlans=n.polygon.createBox(e,o,this,0,"Graphics3D","#e2e1e1","#e2e1e1",0,.15,!1,"LeftWallBrush",n.chart3D),u=0;u<leftSideWallPlans.length;u++)n.polygon.transform(n.matrixobj.turn(parseFloat(-Math.PI/2)),leftSideWallPlans[u])},updateBottomWall:function(n,t,i){var r=n.model.m_AreaBounds,f=i.axes[t.name]._validCross?t.y:r.Y+r.Height,e=n.vector.vector3D(r.X+r.Width,-n.model.depth,n.model.wallSize+f),o=n.vector.vector3D(r.X,-.1,f+1),u;for(bottomSideWallPlans=n.polygon.createBox(o,e,this,0,"Graphics3D","#D3D3D3","#D3D3D3",0,.15,!1,"BottomWallBrush",n.chart3D),u=0;u<bottomSideWallPlans.length;u++)n.polygon.transform(n.matrixobj.tilt(parseFloat(Math.PI/2)),bottomSideWallPlans[u])}}}(jQuery);ej.EjVmlRender=function(n){var t=document,r,i;this.vmlNamespace="urn:schemas-microsoft-com:vml";this.vmStyle="#default#VML";t.namespaces.add("v","urn:schemas-microsoft-com:vml");this.isdocmode8=t.documentMode===8;t.getElementById("vml_chart")||(r=this.isdocmode8?"v\\:fill, v\\:path, v\\:polyline, v\\:line, v\\:rect,v\\:shape,v\\:oval, v\\:stroke{ behavior:url(#default#VML); display: inline-block; } ":"v\\:*{ behavior:url(#default#VML); display: inline-block; } ",i=t.createStyleSheet(),i.owningElement.id="vml_chart",i.cssText=r);this._rootId=jQuery(n).attr("id");this.svgObj=t.createElement("div");this.svgObj.style.position="relative";this.svgObj.setAttribute("id",this._rootId+"_vml");this.changeOptions={id:"id",fill:"fillcolor",stroke:"strokecolor","stroke-width":"strokeweight",d:"path","font-size":"font-size","font-family":"font-family","font-style":"font-style","font-weight":"font-weight",points:"points"}},function(n){ej.EjVmlRender.prototype={drawPath:function(t,i){var r=t.d.split(" "),f,e,o,u;n.inArray("A",r)!=-1&&(f=parseFloat(r[4]),e=parseFloat(r[5]),t.d=this.drawArc(f,e,t));n("#"+t.id).length>0?(t.d=this.changePathValue(t.d),this.applyVMLStyle(n("#"+t.id),t)):(t.d=this.changePathValue(t.d),o=document.createElement("v:shape"),u=n(o),this.applyVMLStyle(u,t),u.appendTo(i))},createLegendSvg:function(n){var t=document;return this._rootId=jQuery(n).attr("id"),this.legendsvgObj=t.createElement("div"),this.legendsvgObj.style.position="relative",this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_vml"),this.legendsvgObj},drawPolyline:function(t,i){var f=t.points.split(" "),u,r;n("#"+t.id).length>0?(t.points=this.changePathValue(t.points),this.applyVMLStyle(n("#"+t.id),t)):(t.points=this.changePathValue(t.points),u=document.createElement("v:polyline"),r=n(u),this.applyVMLStyle(r,t),r.appendTo(i))},setFillAttribute:function(t,i){var r=document.createElement("v:fill"),f=i["fill-opacity"]?i["fill-opacity"]:i.opacity,u,e;f=ej.util.isNullOrUndefined(f)?i.opacity?i.opacity:1:f;u=i.fill;u=="none"||ej.util.isNullOrUndefined(u)?u=="none"?(r.setAttribute("type","gradient"),r.setAttribute("color",i.color),r.setAttribute("color2",i.color2),r.setAttribute("colors",i.colors),r.setAttribute("angle",i.angle),f=i.fill_opacity):f=.1:u.match("gradient")?(e=u.replace("gradient",""),r.setAttribute("type","gradient"),r.setAttribute("colors",e)):n(t).attr("fillcolor",u);r.setAttribute("opacity",f);n(r).appendTo(t)},setStrokeAttribute:function(t,i){var f=i.stroke,r,u;f=="transparent"&&(i.opacity=.1);i.name&&n(t).attr("name",i.name);r=i.opacity;r&&(u=document.createElement("v:stroke"),u.setAttribute("opacity",r),n(u).appendTo(t))},changePathValue:function(n){var t,i,r;if(!n.d){for(t=n.split(" "),i=0;i<t.length;i++)r=t[i].match(/\d+/g),r!=null&&(t[i]=Math.round(parseFloat(t[i])));return t.join(" ")}},drawArc:function(n,t,i){var u=0,f=0,s=i.start,o=i.end,o=Number(Math.PI.toFixed(2))==Number((o+s).toFixed(2))?o-.01:o,e=i.r||n||t,l=Math.cos(s),a=Math.sin(s),h=Math.cos(o),v=Math.sin(o),r=i.innerR,y=.08/e,p=r&&.1/r||0,c;return o-s==0?"":(2*Math.PI-o+s<y?h=-y:o-s<p&&(h=Math.cos(s+p)),c=["wa",u-e,f-e,u+e,f+e,u+e*l,f+e*a,u+e*h,f+e*v],i.open&&!r&&c.push("e",M,u,f),c.push("at",u-r,f-r,u+r,f+r,u+r*h,f+r*v,u+r*l,f+r*a,"x","e"),c.join(" "))},changeVMLStyle:function(t,i){var r=this,u=i.stroke;t.css("width",i.width).css("visibility",i.visibility).css("height",i.height).css("position","absolute").css("left",i.x).css("top",i.y);n.each(i,function(n,u){(r.changeOptions[n]!=null||r.changeOptions[n]!=undefined)&&((n=="d"||n=="points")&&(u=r.changePathValue(i[n]).toLowerCase()),u!="transparent"||i.fill_opacity||(i[n]=u="white",n!="fill"||i.hasOwnProperty("opacity")&&i.opacity||(i.opacity=.1)),i.fill_opacity&&(i.opacity=i.fill_opacity),t[0].tagName==="SPAN"?n=="fill"?t.css("color",u):n=="id"?t.attr(r.changeOptions[n],u):t.css(r.changeOptions[n],u):r.isdocmode8?t.get(0)[r.changeOptions[n]]=u:t.get(0).setAttribute(r.changeOptions[n],u))});(i.hasOwnProperty("fill-opacity")||i.hasOwnProperty("opacity")||i.hasOwnProperty("fill"))&&(t[0].tagName==="SPAN"||(r.setFillAttribute(t,i),i.hasOwnProperty("stroke")&&(i.stroke=u,i.fill_opacity&&(i.opacity=i.fill_opacity),r.setStrokeAttribute(t,i))))},applyVMLStyle:function(n,t){n[0].tagName!=="SPAN"&&(ej.util.isNullOrUndefined(t.width)&&(t.width="1000px"),ej.util.isNullOrUndefined(t.height)&&(t.height="1000px"));ej.util.isNullOrUndefined(t.x)&&(t.x="0px");ej.util.isNullOrUndefined(t.y)&&(t.y="0px");this.changeVMLStyle(n,t)},drawLine:function(t,i){var r,u;if(n("#"+t.id).length>0)r=t.x1+","+t.y1,u=t.x2+","+t.y2,n(t).attr("from",r).attr("to",u),this.applyVMLStyle(n("#"+t.id),t);else{var e=document.createElement("v:line"),f=n(e),r=t.x1+","+t.y1,u=t.x2+","+t.y2;f.attr("from",r).attr("to",u);this.applyVMLStyle(f,t);f.appendTo(i)}},drawCircle:function(t,i){if(n("#"+t.id).length>0)t.x=t.cx-t.r,t.y=t.cy-t.r,t.width=t.height=2*t.r,this.applyVMLStyle(n("#"+t.id),t);else{var u=document.createElement("v:oval"),r=n(u);t.x=t.cx-t.r;t.y=t.cy-t.r;t.width=t.height=2*t.r;this.applyVMLStyle(r,t);n("#"+t.id).length==0&&r.appendTo(i)}},drawEllipse:function(t,i){if(n("#"+t.id).length>0)t.x=t.cx-t.rx,t.y=t.cy-t.ry,t.width=2*t.rx,t.height=2*t.ry,this.applyVMLStyle(n("#"+t.id),t);else{var u=document.createElement("v:oval"),r=n(u);t.x=t.cx-t.rx;t.y=t.cy-t.ry;t.width=2*t.rx;t.height=2*t.ry;this.applyVMLStyle(r,t);r.appendTo(i)}},drawRect:function(t,i){if(n("#"+t.id).length>0)this.applyVMLStyle(n("#"+t.id),t);else{var u=document.createElement("v:rect"),r=n(u);this.applyVMLStyle(r,t);r.appendTo(i)}},drawCylinder:function(t,r,u){var a=t.x,v=t.y,d=t.width,vt=t.height,yt=t.id,s,f,e,h,g,c,nt,tt,it,rt,ut,ft,y,p,w,et,ot,b,k,st,ht,ct,lt,l=t.fill,dt=ej.EjSvgRender.prototype.checkColorFormat(l),kt,at;dt||(l=ej.datavisualization.Chart.prototype.colorNameToHex(t.fill));var gt=t.opacity,pt={svgRenderer:ej.EjSvgRender.prototype},wt=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(l,pt),bt=ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(l,pt),o=65535;for(u.isColumn==!0?(t.rx=f=d/2,t.ry=e=f/4,h=g=a+f,tt=c=v-e,ft=k=y=v+vt-e,it=h+f,nt=ut=b=h-f,sa1=-Math.round(o*180),ea1=Math.round(o*180),et=Math.round(o*360),ot=-Math.round(o*180),gradientAngle="90",u.stacking==!0&&(u.isLastSeries||(c=v+e)),rt=c):(t.ry=e=vt/2,t.rx=f=e/4,it=nt=g=a+f,b=h=a+d+f,sa1=Math.round(o*90),ea1=Math.round(o*180),et=Math.round(o*270),ot=-Math.round(o*180),y=c=v+e,k=rt=c+e,tt=ft=y-e,gradientAngle="0",u.stacking==!0&&(u.isLastSeries||(h=a+d-f)),ut=h),delete t.x,delete t.y,t.width=1e3,t.x=0,t.y=0,delete t.stacking,t.height=1e3,delete t.isColumn,t.fill=wt,t.fill_opacity=gt,t.stroke=wt,t["stroke-width"]=0,i=1;i<=4;i++)i%2==0?(st=g,ht=c,ct=ut,lt=ft,p=et,w=ot):(st=h,ht=y,ct=it,lt=rt,p=sa1,w=ea1),i<3&&(p=o,w=23592600),i<4&&(s=["M",Math.round(b),Math.round(k)]),s.push("ae",Math.round(st),Math.round(ht),Math.round(f),Math.round(e),p,w),i>2&&(s.push("l",Math.round(ct),Math.round(lt)),t.fill="none",t.color=l,t.color2=l,t.colors="30% "+bt+",70% "+bt,t.angle=gradientAngle),i!=3&&(s.push("e"),s=s.join(" "),t.d=s,t.id=yt+"_Region_"+(i-1).toString(),i==4&&(t.id=yt+"_Region_"+(i-2).toString()),kt=document.createElement("v:shape"),at=n(kt),this.applyVMLStyle(at,t),at.appendTo(r)),b=nt,k=tt},_getAttrVal:function(t,i,r){i=i=="x"?"left":i;i=i=="y"?"top":i;var u=n(t).attr(i),f=u?u:n(t).css(i);return f!=null?f:r},_setAttr:function(t,i){var r,u,f;i.transform&&(r=i.transform,u=r.slice(r.indexOf("(")+1,r.indexOf(")")).split(","),i.x=u[0],i.y=u[1]);f=n(t);f.length>0&&this.changeVMLStyle(f,i)},createGradientElement:function(n,t){var i,f,r,u;if(Object.prototype.toString.call(t)=="[object Array]")for(i="gradient ",f="",r=0,u=t.length-1;u>=0,r<t.length;r++,u--)i+=f+t[r].colorStop+" "+t[u].color,f=",";else i=t;return i},setSpanAttr:function(t,i,r){var e=t["font-size"]>0?t["font-size"]+"px":t["font-size"],u={size:e,fontStyle:t["font-style"],fontFamily:t["font-family"]},f=ej.EjSvgRender.utils._measureText(i,null,u);n(r).css("white-space","nowrap");t["text-anchor"]==="middle"?t.x=Math.round(t.x-f.width/2):t["text-anchor"]==="end"&&(t.x=Math.round(t.x-f.width));t.y=Math.round(t.y-u.size.replace("px",""));this.applyVMLStyle(r,t)},drawText:function(t,i,r,u){var c=document,v=n("#"+t.id),f,y,l,e,s,o,h,a,p;if(v.length>0)this._textAttrReplace(t,i,u,v);else if(t.id.indexOf("YAxisTitle")>0&&!this.isdocmode8)t.on=!0,f=document.createElement("v:line"),f.style.behavior="url(#default#VML)",f.style.display="inline-block",y=ej.EjSvgRender.utils._measureText(i,null,null),f.setAttribute("to",(t.x-1).toString()+","+(t.y-y.width/2).toString()),f.setAttribute("from",t.x.toString()+","+t.y.toString()),l=document.createElement("v:path"),l.setAttribute("textpathok",!0),e=document.createElement("v:textpath"),e.setAttribute("on",!0),e.setAttribute("string",i),e.style["font-style"]=t["font-style"],e.style["font-size"]=t["font-size"],e.style["font-family"]=t["font-family"],f.appendChild(l),f.appendChild(e),n(f).appendTo(r);else{if(s=c.createElement("span"),o=n(s),jQuery.type(i)=="array")for(this.setSpanAttr(t,i,o),h=0;h<i.length;h++)a=c.createElement("span"),n(a).html(i[h]),n(a).appendTo(s),p=c.createElement("br"),n(p).appendTo(s);else this.setSpanAttr(t,i,o),o.html(i);o.appendTo(r)}},_textAttrReplace:function(t,i,r,u){var f,e,o;if(jQuery.type(i)=="array")if(f=n("#"+t.id).children("span"),this.setSpanAttr(t,i,u),f.length>0&&f.length==i.length)for(e=0;e<f.length;e++)o=f[e],n(o).text(i[e]);else n("#"+t.id).remove(),this.drawText(t,i,this.gTransToolEle,r);else this.setSpanAttr(t,i,u),u.text(i)},drawImage:function(t,i){var u=document.createElement("img"),r=n(u);r.css({position:"absolute"});n.each(t,function(n,t){n=="href"&&(n="src");r.attr(n,t)});r.appendTo(i)},createDefs:function(){},createGroup:function(t){var i=document.createElement("div"),r;return ej.util.isNullOrUndefined(t.transform)||(r=t.transform.slice(t.transform.indexOf("(")+1,t.transform.indexOf(")")).split(","),n(i).css({position:"absolute",left:r[0]+"px",top:r[1]+"px"})),t.cursor&&n(i).css({cursor:t.cursor}),n.each(t,function(t,r){t!=="transform"&&t!="clip-path"&&n(i).attr(t,r)}),i},createText:function(t,i){var r=document.createElement("span");return n(r).attr(t),ej.util.isNullOrUndefined(i)||(r.textContent=i),r},drawAxesBoundsClipPath:function(t,i,r){var u,e=n(t),f;e.removeAttr("clip-path");f=this._getTransform(i.xAxis,i.yAxis,r);u={id:t.id+"_ClipRect",x:0,y:0,width:f.width,height:f.height,fill:"white","stroke-width":1,stroke:"transparent"};this.drawClipPath(u,t);e.attr("clip-path","url(#"+u.id+")")},getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},round:function(n,t,i){return t*(i?Math.ceil(n/t):Math.floor(n/t))},hexFromRGB:function(t){var r=t.R,u=t.G,f=t.B;if(t.A)return"rgba("+r.toString()+","+u.toString()+","+f.toString()+","+t.A+")";var r=t.R,u=t.G,f=t.B,i=[r.toString(16),u.toString(16),f.toString(16)];return n.each(i,function(n,t){t.length===1&&(i[n]="0"+t)}),"#"+i.join("").toUpperCase()},hexToRGB:function(n){var i=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.test(n),t;return i==!0?(t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(n),t?{R:parseInt(t[1]),G:parseInt(t[2]),B:parseInt(t[3]),A:t[4]}:null):(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),t?{R:parseInt(t[1],16),G:parseInt(t[2],16),B:parseInt(t[3],16)}:null)},checkColorFormat:function(n){return/(rgba?\((?:\d{1,3}[,\)]){3}(?:\d+\.\d+\))?)|(^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$)/gmi.test(n)},createDelegate:function(n,t){return function(i){t.apply(n,[i,this])}},drawClipPath:function(t,i){if(t.id.indexOf("ChartAreaClipRect")==-1){var r=Math.round(t.x)+"px",u=Math.round(t.y)+"px",f=Math.round(t.width)+Math.round(t.x)+"px",e=Math.round(t.y)+Math.round(t.height)+"px",o="rect("+u+" "+f+" "+e+" "+r+")";n(i).css("position","absolute").css("clip",o)}},drawCircularClipPath:function(t,i){var r=Math.round(t.r),u=Math.round(t.cx),f=Math.round(t.cy);if(t.id.indexOf("_ClipRect")==-1){var e=u-r+"px",o=f-r+"px",s=u+r+"px",h=f+r+"px",c="rect("+o+" "+s+" "+h+" "+e+")";n(i).css("position","absolute").css("clip",c)}},append:function(t,i){n(t).appendTo(i)}}}(jQuery);ej.EjCanvasRender=function(n){this.svgObj=document.createElement("canvas");this._rootId=jQuery(n).attr("id");this.svgObj.setAttribute("id",this._rootId+"_canvas");this.ctx=this.svgObj.getContext("2d")},function(n){ej.EjCanvasRender.prototype={drawPath:function(n,t,i){var h=n.hasStackingInnerRadius?n.hasStackingInnerRadius:!1,p=n.d,u=p.split(" "),c=n["stroke-width"],l,o,s,a,r,f,e,v,y;if(n.lgndCtx){for(a=this.lgndCtx,this.lgndCtx=t!=undefined?t:this.lgndCtx,this.lgndCtx.save(),this.lgndCtx.beginPath(),i&&this.lgndCtx.translate(i[0],i[1]),this.lgndCtx.globalAlpha=n.opacity?n.opacity:n["fill-opacity"],this.lgndCtx.lineWidth=n["stroke-width"],this.lgndCtx.strokeStyle=n.stroke,r=0;r<u.length;r=r+3){f=parseFloat(u[r+1]);e=parseFloat(u[r+2]);switch(u[r]){case"M":this.lgndCtx.moveTo(f,e);break;case"L":this.lgndCtx.lineTo(f,e);break;case"C":this.lgndCtx.bezierCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]),parseFloat(u[r+5]),parseFloat(u[r+6]));r=r+4;break;case"A":this.lgndCtx.arc(parseFloat(u[r-5]),parseFloat(u[r-4]),f,0,2*Math.PI,!1);r=r+5;break;case"a":this.lgndCtx.beginPath();v=parseFloat(u[r-2])+f;y=u[r-1];this.lgndCtx.arc(v,y,f,0,2*Math.PI,!1);r=r+5;break;case"Z":this.lgndCtx.fillStyle=n.fill;this.lgndCtx.fill();r=r-2;break;case"Q":this.lgndCtx.quadraticCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]));r=r+2}}n.fill!="none"&&n.fill!=undefined&&(this.lgndCtx.fillStyle=n.fill,this.lgndCtx.fill());this.lgndCtx.stroke();this.lgndCtx.restore();this.lgndCtx=a}else{for(l=this.ctx,this.ctx=t!=undefined?t:this.ctx,this.ctx.save(),this.ctx.beginPath(),i&&this.ctx.translate(i[0],i[1]),this.ctx.globalAlpha=n.opacity?n.opacity:n["fill-opacity"],o=!0,this.ctx.lineWidth=c,s=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1,s&&this.ctx.setLineDash(s),this.ctx.strokeStyle=n.stroke,r=0;r<u.length;r=r+3){f=parseFloat(u[r+1]);e=parseFloat(u[r+2]);switch(u[r]){case"M":n.innerR&&!h||n.cx||this.ctx.moveTo(f,e);break;case"L":(!n.innerR||h)&&this.ctx.lineTo(f,e);break;case"C":this.ctx.bezierCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]),parseFloat(u[r+5]),parseFloat(u[r+6]));r=r+4;break;case"A":n.innerR?o&&(this.ctx.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),this.ctx.arc(n.x,n.y,n.innerR,n.end,n.start,!n.counterClockWise),o=!1):n.cx?this.ctx.arc(n.cx,n.cy,n.radius,0,2*Math.PI,n.counterClockWise):(this.ctx.moveTo(n.x,n.y),this.ctx.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),this.ctx.lineTo(n.x,n.y));r=r+5;break;case"Q":this.ctx.bezierCurveTo(f,e,parseFloat(u[r+1]),parseFloat(u[r+2]),parseFloat(u[r+3]),parseFloat(u[r+4]));r=r+2;break;case"z":this.ctx.closePath()}}n.fill!="none"&&n.fill!=undefined&&(this.ctx.fillStyle=n.fill,this.ctx.fill());c>0&&this.ctx.stroke();this.ctx.restore();this.ctx=l}},drawRect:function(n,t){var r=this.ctx,i=n.rx;this.ctx=t?t.canvas?t:this.ctx:this.ctx;this.ctx.save();this.ctx.beginPath();this.ctx.globalAlpha=n.opacity;this.ctx.lineWidth=n["stroke-width"];dashArray=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1;dashArray&&this.ctx.setLineDash(dashArray);this.ctx.strokeStyle=n.stroke;this.ctx.rect(n.x,n.y,n.width,n.height);i!=null&&i>=0?this.drawCornerRadius(n):(n.fill=="none"&&(n.fill="transparent"),this.ctx.fillStyle=n.fill,this.ctx.fillRect(n.x,n.y,n.width,n.height),this.ctx.stroke());n.id.indexOf("Series")>=0&&this.ctx.clip();this.ctx.restore();this.ctx=r},drawCylinder:function(n,t,i){var bt=this.ctx,s,l,pt,h,o;this.ctx=t?t.canvas?t:this.ctx:this.ctx;this.ctx.save();s=ej.datavisualization.Chart.prototype.colorNameToHex(n.fill);l={svgRenderer:ej.EjSvgRender.prototype};"use strict";var o,k,d,a=Math.PI,kt=2*a+.1,r,u,g,v,y,nt,p,tt,it,w,rt,ut,ft,et,ot,st,ht,ct,lt,at,vt,yt,f=n.x,e=n.y,c=n.width,b=n.height,wt=kt;for(this.ctx.fillStyle=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(s,l),this.ctx.lineWidth=0,this.ctx.strokeStyle=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(s,l),this.ctx.globalAlpha=n.opacity,i.isColumn==!0?(ht=f,lt=c+f,at=ct=0,r=c/2,u=r/4,v=g=f+r,w=y=e-u,tt=f,p=f+c,nt=it=e+b-u,st=0,ot=a,vt=-r,yt=u,(i.stacking=!0)&&(i.isLastSeries||(w=y=e+u))):(ht=lt=0,ct=b+e,at=e,u=b/2,r=u/4,tt=g=f+r,p=v=f+c+r,it=e+b,w=e,nt=y=e+u,st=a/2,ot=a*1.5,(i.stacking=!0)&&(i.isLastSeries||(p=v=f+c-r)),u=-u,r=-r,vt=r,yt=-u),pt=ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(s,l),h=this.ctx.createLinearGradient(ht,at,lt,ct),h.addColorStop(0,s),h.addColorStop(.3,pt),h.addColorStop(.7,pt),h.addColorStop(1,s),j=1;j<=4;j++){for(o=0,j<4?this.ctx.beginPath():"",j%2==0?(rt=v,ut=nt,ft=tt,et=w):(rt=g,ut=y,ft=p,et=it),j==4&&(r=vt,u=yt,this.ctx.fillStyle=h),j>2&&(o=st,wt=ot);o<=wt;o+=.1)k=rt-r*Math.cos(o),d=ut+u*Math.sin(o),o===0?this.ctx.moveTo(k,d):this.ctx.lineTo(k,d);j>2&&this.ctx.lineTo(ft,et);j!=3&&(this.ctx.stroke(),this.ctx.fill())}n.id.indexOf("Series")>=0&&this.ctx.clip();this.ctx.restore();this.ctx=bt},drawCornerRadius:function(n){var t=n.rx,i=n.x,r=n.y,u=n.width,f=n.height;n.fill=="none"&&(n.fill="transparent");this.ctx.fillStyle=n.fill;u<2*t&&(t=u/2);f<2*t&&(t=f/2);this.ctx.beginPath();this.ctx.moveTo(i+u-t,r);this.ctx.arcTo(i+u,r,i+u,r+f,t);this.ctx.arcTo(i+u,r+f,i,r+f,t);this.ctx.arcTo(i,r+f,i,r,t);this.ctx.arcTo(i,r,i+u,r,t);this.ctx.closePath();this.ctx.fill();this.ctx.stroke()},createGradientElement:function(n,t){var u,o=this.ctx,f,i,e,r;if(Object.prototype.toString.call(t)=="[object Array]"){for(f=o.createLinearGradient(0,0,0,this.svgObj.height),i=0;i<=t.length-1;i++)e=t[i].color,r=t[i].colorStop.slice(0,-1),r=parseInt(r)/100,f.addColorStop(r,e);u=f}else u=t;return u},drawLine:function(n){this.ctx.save();this.ctx.beginPath();this.ctx.lineWidth=n["stroke-width"];this.ctx.strokeStyle=n.stroke;this.ctx.moveTo(n.x1,n.y1);this.ctx.lineTo(n.x2,n.y2);this.ctx.stroke();this.ctx.restore()},drawText:function(t,i){var l,u,o,r,a,s,v,f;ej.util.isNullOrUndefined(t["font-weight"])||t["font-weight"].toLowerCase()!="regular"||(t["font-weight"]="normal");var h=t["font-style"].toLowerCase()+" "+t["font-weight"]+" "+t["font-size"]+" "+t["font-family"],e=t["text-anchor"],c=t.opacity!==undefined?t.opacity:1;if(e=="middle"&&(e="center"),t.lgndCtx)this.lgndCtx.save(),this.lgndCtx.fillStyle=t.fill,this.lgndCtx.font=h,this.lgndCtx.textAlign=e,this.lgndCtx.globalAlpha=c,t["dominant-baseline"]=="middle"&&(this.lgndCtx.textBaseline="center"),t.labelRotation?(this.lgndCtx.translate(t.x,t.y),this.lgndCtx.rotate(t.labelRotation*Math.PI/180),this.lgndCtx.fillText(i,0,0)):this.lgndCtx.fillText(i,t.x,t.y),this.lgndCtx.restore();else{if(this.ctx.save(),this.ctx.fillStyle=t.fill,this.ctx.font=h,this.ctx.textAlign=e,this.ctx.globalAlpha=c,t.baseline&&(this.ctx.textBaseline=t.baseline),t.labelRotation)o=0,r=t.labelRotation,r&&t.id.indexOf("XLabel")!=-1?(a="rotate("+t.labelRotation.toString()+"deg)",n(t).attr("rotateAngle",a),s=this.createText(t,i),n(document.body).append(s),v=s.getBoundingClientRect(),n(s).remove(),o=v.height,r<0&&(r=360+r),f=t.transform.split(","),t.labelPosition=="outside"?this.ctx.translate(parseFloat(f[1]),parseFloat(f[2])+o/2):this.ctx.translate(parseFloat(f[1]),parseFloat(f[2])-o/2),this.ctx.textAlign="center",this.ctx.rotate(r*(Math.PI/180)),this.ctx.fillText(i,0,0)):(this.ctx.translate(t.x,t.y),this.ctx.rotate(t.labelRotation*Math.PI/180),this.ctx.fillText(i,0,0));else if(typeof i=="object"&&t.isTrackball)for(l=i.length,u=0;u<l;u++)this.ctx.fillText(i[u],t.x,t.y+(Number(parseInt(t["font-size"]))+t.padding)*u);else this.ctx.fillText(i,t.x,t.y);this.ctx.restore()}},drawZoomRect:function(t,i){var r={left:0,top:0},f=n("<div id="+t.id+"><\/div>"),u=i.model.m_AreaBounds;t.x<u.X||t.x+r.left+t.width>r.left+n(this.svgObj).width()-20?(width=this.prevWidth,x=this.prevX):(width=this.prevWidth=t.width,x=this.prevX=t.x+r.left);t.y<u.Y||t.y+r.top+t.height>r.top+u.Y+u.Height?(height=this.prevHeight,y=this.prevY):(height=this.prevHeight=t.height,y=this.prevY=t.y+r.top);n(f).css({width:width,height:height,top:y,left:x,"background-color":t.fill,"border-style":"solid",position:"absolute","border-color":t.stroke,"border-width":t["stroke-width"]});document.getElementById("chartContainer_"+this._rootId).appendChild(f[0])},zoomButton:function(t,i,r){var l=r.svgObj?r.svgObj:r.svgObject,y=r._rootId?r._rootId:r._id,o,e,c,f,s,h,a,v,u;o=i=="zoom"?"_Zoom":i=="zoomIn"?"_ZoomIn":"_ZoomOut";e={left:0,top:0};n("#"+t.zoomId).length<=0?(u=n("<div id="+l.id+o+"Btn><\/div>"),n(u).css({width:t.width,height:t.height,top:t.top+e.top,left:t.left+e.left,"background-color":t.fill,"border-style":"solid",position:"absolute","border-radius":"0.4em","border-color":t.fill,"box-sizing":"content-box","z-index":2e3}),c="http://www.w3.org/2000/svg",f=document.createElementNS(c,"svg"),f.setAttribute("id",t.zoomId),f.setAttribute("width",25),f.setAttribute("height",25),i=="zoom"?(s="M26.101,22.893l-6.605-6.174c1.414-2.781,0.897-6.267-1.496-8.504c-2.901-2.711-7.448-2.56-10.161,0.341 c-2.712,2.9-2.56,7.45,0.341,10.163c2.426,2.266,6,2.523,8.694,0.853l6.579,6.151L26.101,22.893z M10.186,16.571 c-1.715-1.604-1.805-4.293-0.203-6.009c1.605-1.715,4.295-1.805,6.009-0.201c1.715,1.603,1.805,4.293,0.202,6.007 C14.59,18.084,11.901,18.175,10.186,16.571",h="translate(-3,-3)"):i=="zoomIn"?(s="M9.0983096,4.2999878L9.0983096,9.3999634 3.9983783,9.3999634 3.9983783,12.699951 9.0983096,12.699951 9.0983096,17.799988 12.398249,17.799988 12.398249,12.699951 17.49818,12.699951 17.49818,9.5 12.398249,9.5 12.398249,4.2999878z M10.998276,0C14.298215,0 17.49818,1.3999634 19.69813,4.1999512 22.79809,8.0999756 22.79809,13.5 19.998144,17.399963L28.597992,28.299988 23.898081,32 15.398205,21.199951C10.898271,23.099976 5.5983606,21.899963 2.3983956,17.899963 -1.4015366,13.099976 -0.60156059,6.0999756 4.1983567,2.3999634 6.1983276,0.79998779 8.5983163,0 10.998276,0z",h="translate(4,4) scale(0.6)"):(s="M3.9983433,9.5L3.9983433,12.799988 17.598165,12.799988 17.598165,9.5z M10.998234,0C14.298169,0 17.498131,1.3999634 19.698108,4.1999512 22.798034,8.0999756 22.798034,13.5 19.998092,17.399963L28.597994,28.299988 23.898054,32 15.398188,21.199951C10.898259,23.099976 5.5983546,21.899963 2.398393,17.899963 -1.4015351,13.099976 -0.60155994,6.0999756 4.1983522,2.3999634 6.1983207,0.79998779 8.5983074,0 10.998234,0z",h="translate(4,4) scale(0.6)"),a={id:o+"Path",fill:t.iconColor,transform:h,d:s},v=document.createElementNS(c,"path"),n(v).attr(a).appendTo(f),u[0].appendChild(f),document.getElementById("chartContainer_"+y).appendChild(u[0])):(u=document.getElementById(l.id+o+"Btn"),n(u).css({top:t.top+e.top,left:t.left+e.left}))},panButton:function(t,i){var s=i.svgObj?i.svgObj:i.svgObject,c=i._rootId?i._rootId:i._id,f={left:0,top:0},e,u,o,h,r;n("#"+t.panId).length<=0?(r=n("<div id="+s.id+"_PanBtn><\/div>"),n(r).css({width:t.width,height:t.height,top:t.top+f.top,left:t.left+f.left,"background-color":t.fill,"border-style":"solid",position:"absolute","border-radius":"0.4em","border-color":t.fill,"box-sizing":"content-box","z-index":2e3}),e="http://www.w3.org/2000/svg",u=document.createElementNS(e,"svg"),u.setAttribute("id",t.panId),u.setAttribute("width",25),u.setAttribute("height",25),o={id:"panPath",fill:t.iconColor,transform:"translate(-3,-3)"},o.points="26.105,16 21.053,12.211 21.053,14.737 17.263,14.737 17.263,10.947 19.834,10.947 16.044,5.895 12.255,10.947 14.737,10.947 14.737,14.737 10.947,14.737 10.947,12.211 5.895,16 10.947,19.789 10.947,17.263 14.737,17.263 14.737,21.053 12.255,21.053 16.044,26.105 19.834,21.053 17.263,21.053 17.263,17.263 21.053,17.263 21.053,19.789",h=document.createElementNS(e,"polygon"),n(h).attr(o).appendTo(u),r[0].appendChild(u),document.getElementById("chartContainer_"+c).appendChild(r[0])):(r=document.getElementById(s.id+"_PanBtn"),n(r).css({top:t.top+f.top,left:t.left+f.left}))},resetZoom:function(t,i){var l=i.svgObj?i.svgObj:i.svgObject,w=i._rootId?i._rootId:i._id,e={left:0,top:0},f,r,o,a,s,v,h,y,c,p,u;n("#"+t.resetZoomId).length<=0?(u=n("<div id="+l.id+"_ResetZoom><\/div>"),n(u).css({width:t.width,height:t.height,top:t.top+e.top,left:t.left+e.left,"background-color":t.fill,"border-style":"solid","border-radius":"0.4em",position:"absolute","border-color":t.fill,"box-sizing":"content-box","z-index":2e3}),f="http://www.w3.org/2000/svg",r=document.createElementNS(f,"svg"),r.setAttribute("id",t.resetZoomId),r.setAttribute("width",25),r.setAttribute("height",25),o={id:"p1",fill:t.iconColor,transform:"translate(-3,-3)"},o.points="11.895,18.398 8.061,22.23 5.796,19.967 5.796,26.283 12.112,26.283 9.848,24.018 13.682,20.186",a=document.createElementNS(f,"polygon"),n(a).attr(o).appendTo(r),s={id:"p2",fill:t.iconColor,transform:"translate(-3,-3)"},s.points="19.691,6.072 21.955,8.337 18.121,12.172 19.908,13.959 23.742,10.123 26.007,12.389 26.007,6.072",v=document.createElementNS(f,"polygon"),n(v).attr(s).appendTo(r),h={id:"p3",fill:t.iconColor,transform:"translate(-3,-3)"},h.points="11.895,13.958 13.682,12.172 9.848,8.337 12.112,6.072 5.796,6.072 5.796,12.389 8.061,10.123",y=document.createElementNS(f,"polygon"),n(y).attr(h).appendTo(r),c={id:"p4",fill:t.iconColor,transform:"translate(-3,-3)"},c.points="19.908,18.396 18.121,20.186 21.955,24.018 19.691,26.283 26.007,26.283 26.007,19.967 23.741,22.23",p=document.createElementNS(f,"polygon"),n(p).attr(c).appendTo(r),u[0].appendChild(r),document.getElementById("chartContainer_"+w).appendChild(u[0])):(u=document.getElementById(l.id+"_ResetZoom"),n(u).css({top:t.top+e.top,left:t.left+e.left}))},drawCrosshairLine:function(t,i){var r=n("<div id="+t.id+"><\/div>");n(r).css({width:t.width,height:t.height,left:t.left,top:t.top,"border-style":t.style,opacity:t.opacity,visibility:"visible","border-color":t.stroke,"border-width":t["stroke-width"],position:t.position});n(i).append(r[0])},drawCrosshairlabel:function(t,i,r){var e=n("#"+this._rootId).offset(),f={left:0,top:0},u;n("#"+t.id).length>0?(u=document.getElementById(t.id),n(u).css({width:t.width-5,height:t.height-5,left:i.x+f.left-5,top:i.y+f.top-15,visibility:"visible",display:t.display}),document.getElementById(t.id).textContent=r):(u=n("<div id="+t.id+" style='position: absolute; z-index: 13000;'><\/div>"),n(u).css({color:i.fill,"font-family":i["font-family"],"font-size":i["font-size"],"font-weight":i["font-weight"],"font-style":i["font-style"],"background-color":t.fill,"border-style":"solid","border-color":t.stroke,"border-width":t["stroke-width"],opacity:t["fill-opacity"],"text-align":"center"}),document.getElementById(this._rootId).appendChild(u[0]))},createCrosshairCanvas:function(){var i=document.getElementById(this._rootId+"_canvas"),u=n("#"+this._rootId).offset(),t,r={left:0,top:0};return n("#secondCanvas").length?t=document.getElementById("secondCanvas"):(t=document.createElement("canvas"),n(document).find("#"+this.svgObj.id+"_CrosshairGroup").append(t),n(t).attr({id:"secondCanvas",width:i.width,height:i.height,top:r.top,left:r.left}),n(t).css({width:i.width,height:i.height,top:r.top,left:r.left})),t},drawTrackToolTip:function(t,i,r,u){var s={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop},h,e,o,f;if(n("#"+t.id).length>0)if(f=document.getElementById(t.id),n(f).css({left:t.x+s.left,top:t.y+s.top,visibility:"visible","border-box":"content-box","background-color":t.fill,color:i.fill,"border-color":t.stroke,"border-width":t["stroke-width"]}),jQuery.type(r)=="array"){for(h=0,e="",o=0;o<r.length;o++)e=e+r[o]+"<\/br>";n("#"+t.id).html(e)}else n("#"+t.id).html(r);else f=n("<div id="+t.id+" style='position: absolute; z-index: 13000;'><\/div>"),n(f).css({color:i.fill,"font-family":i["font-family"],"font-size":i["font-size"],"font-weight":i["font-weight"],"font-style":i["font-style"],width:t.width,height:t.height-u-2*t["stroke-width"],"background-color":t.fill,"border-style":"solid","text-align":"center",padding:"0px","padding-top":u/2+"px","padding-bottom":u/2+"px","border-color":t.stroke,"border-width":t["stroke-width"],opacity:t["fill-opacity"]}),document.getElementById(this._rootId).appendChild(f[0])},trackSymbol:function(t,i,r,u,f){var l=f.model.m_AreaBounds,ht=n("#"+this._rootId).offset(),d,b,h,g,nt,tt,v,e,o,w,s;if(i.startX>=l.X&&i.startX<=l.X+l.Width&&i.startY>=l.Y&&i.startY<=l.Y+l.Height)if(b=t.SeriesIndex,g=t.PointIndex,f.model.series[b].type.toLowerCase()=="bubble"&&(nt=f.model.series[b]._visiblePoints[g],h=nt.radius*2+5,t.Style.BorderColor=t.Style.Color),f.model.series[b].type.toLowerCase()=="scatter"&&ej.util.isNullOrUndefined(u))tt={cx:i.startX-2,cy:i.startY-2,r:t.ShapeSize.width/2,fill:t.Style.Color,opacity:t.Style.Opacity,stroke:t.Style.BorderColor},this.drawCircle(tt,null);else{n("#canvas_trackSymbol").length>0?(v=n("#canvas_trackSymbol"),n(v).css({visibility:"visible",display:"block"})):v=n("<div id=canvas_trackSymbol><\/div>");var y={left:i.startX,top:i.startY},c=n("<div id="+t.ID+"><\/div>"),a=y.left-(h||t.ShapeSize.width),p=y.top-(h||t.ShapeSize.height);n(c).css({left:a,top:p,"box-sizing":"content-box",position:"absolute",visibility:"visible",opacity:t.Style.Opacity,"z-index":200});e=t.ShapeSize;t.symbol=c;o={};switch(r.toLowerCase()){case"circle":n(c).css({width:h||t.ShapeSize.width+"px",height:h||t.ShapeSize.height+"px",left:h?a+h/2:a+t.ShapeSize.width/2-t.Style.BorderWidth+"px",top:h?p+h/2:p+t.ShapeSize.height/2-t.Style.BorderWidth+"px","border-style":"solid","background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth,"border-radius":"100%"});break;case"rectangle":n(c).css({width:t.ShapeSize.width,height:t.ShapeSize.height,left:a+t.ShapeSize.width/2-t.Style.BorderWidth/2,top:p+t.Style.BorderWidth/2,"border-style":"solid","background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth});break;case"diamond":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+i.startX+" "+(i.startY+-t.ShapeSize.height/2)+" L "+(i.startX+t.ShapeSize.width/2)+" "+i.startY+" L "+i.startX+" "+(i.startY+t.ShapeSize.height/2)+" L "+(i.startX+-t.ShapeSize.width/2)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"triangle":s="M "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+" L "+i.startX+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"invertedtriangle":var s="M "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+" L "+i.startX+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/2)+"z",ft=i.startX,et=i.startY,ot="rotate(180,"+ft+","+et+")";o.direction=s;o.rotate=ot;this.drawSvgShape(t,o);break;case"cross":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+(i.startX+e.width/2)+" "+i.startY+" M "+i.startX+" "+(i.startY+e.height/2)+" L "+i.startX+" "+(i.startY+-e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"star":s="M "+(i.startX+e.width/3)+" "+(i.startY+-e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/6)+" L "+(i.startX+e.width/2)+" "+(i.startY+e.height/6)+" L "+(i.startX+-e.width/3)+" "+(i.startY+-e.height/2)+" L "+i.startX+" "+(i.startY+e.height/2)+" L "+(i.startX+e.width/3)+" "+(i.startY+-e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"hexagon":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+(i.startX+-e.width/4)+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/4)+" "+(i.startY+-e.height/2)+" L "+(i.startX+e.width/2)+" "+i.startY+" L "+(i.startX+e.width/4)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/4)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"wedge":s="M "+(i.startX-e.width)+" "+i.startY+" L "+(i.startX+e.width)+" "+(i.startY+-e.height/2)+" L "+(i.startX+3*(e.width/4))+" "+i.startY+" L "+(i.startX+e.width)+" "+(i.startY+e.height/2)+" L "+(i.startX-e.width)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"trapezoid":s="M "+(i.startX+-e.width/2)+" "+i.startY+" L "+(i.startX+-e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX+-e.width/2+e.width)+" "+(i.startY+-e.height/2)+" L "+(i.startX+-e.width/2+e.width)+" "+(i.startY+e.height/2)+" L "+(i.startX+-e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX+-e.width/2)+" "+i.startY+"z";o.direction=s;this.drawSvgShape(t,o);break;case"uparrow":s="M "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX-e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+i.startX+" "+(i.startY-e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2+e.height)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"downarrow":s="M "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2)+" L "+(i.startX+e.width/2-e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX+e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+i.startX+" "+(i.startY-e.height/2+e.height)+" L "+(i.startX-e.width/2)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2+e.height/2)+" L "+(i.startX-e.width/2+e.width/4)+" "+(i.startY-e.height/2)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"leftarrow":s="M "+(i.startX-e.width/2+e.width)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2+e.width)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/2)+" L "+(i.startX-e.width/2)+" "+i.startY+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2+e.width)+" "+(i.startY+e.height/4)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"rightarrow":s="M "+(i.startX-e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/4)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+-e.height/2)+" L "+(i.startX-e.width/2+e.width)+" "+i.startY+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/2)+" L "+(i.startX-e.width/2+e.width/2)+" "+(i.startY+e.height/4)+" L "+(i.startX-e.width/2)+" "+(i.startY+e.height/4)+"z";o.direction=s;this.drawSvgShape(t,o);break;case"pentagon":var h=Math.sqrt(e.height*e.height+e.width*e.width)/2,k=ej.EjSvgRender.utils._getStringBuilder();for(w=0;w<=5;w++){var st=w*72,it=Math.PI/180*st,rt=h*Math.cos(it),ut=h*Math.sin(it);w==0?k.append("M "+(i.startX+rt)+" "+(i.startY+ut)+" "):k.append("L "+(i.startX+rt)+" "+(i.startY+ut)+" ")}k.append("z");s=k.toString();o.direction=s;this.drawSvgShape(t,o);break;case"ellipse":n(c).css({width:t.ShapeSize.width,height:t.ShapeSize.height/2,"border-style":"solid",left:a+t.ShapeSize.height/2-t.Style.BorderWidth/2,top:i.startY+y.top-t.ShapeSize.height+4,"background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth,"-moz-border-radius":"50%","-webkit-border-radius":"50%","border-radius":"50%","border-box":"content-box"});break;case"horizline":n(c).css({width:t.ShapeSize.width,height:0,"border-style":"solid",left:a+t.ShapeSize.width/2,top:i.startY+y.top-1,"border-color":t.Style.BorderColor,"border-width":"2px","border-box":"content-box"});break;case"vertline":n(c).css({width:0,height:t.ShapeSize.height,"border-style":"solid",left:i.startX+y.left-1,top:p+t.ShapeSize.height/2-2,"border-color":t.Style.BorderColor,"border-width":"2px","border-box":"content-box"});break;default:n(c).css({width:t.ShapeSize.width,height:t.ShapeSize.height,"border-style":"solid","background-color":t.Style.Color,"border-color":t.Style.BorderColor,"border-width":t.Style.BorderWidth,"border-radius":"50px"})}v[0].appendChild(c[0]);d=document.getElementById(this.svgObj.id+"_CrosshairGroup")||document.getElementById("chartContainer_"+this._rootId);d.appendChild(v[0])}},drawSvgShape:function(t,i){var f=document.getElementById(this._rootId+"_canvas"),e={left:0,top:0},o="http://www.w3.org/2000/svg",r=document.createElementNS(o,"svg"),u,s;r.setAttribute("id","mySVG");r.setAttribute("width",n(f).width());r.setAttribute("height",n(f).height());n(t.symbol).css({left:e.left+"px",top:e.top+"px"});u={id:"svgPath","fill-opacity":t.Style.Opacity,"stroke-width":t.Style.BorderWidth,fill:t.Style.Color,transform:i.rotate,stroke:t.Style.BorderColor};u.d=i.direction;s=document.createElementNS(o,"path");n(s).attr(u).appendTo(r);t.symbol[0].appendChild(r)},drawCircle:function(n,t){var r,i,u;n.lgndCtx?(u=this.lgndCtx,this.lgndCtx=t!=undefined?t:this.lgndCtx,this.lgndCtx.save(),this.lgndCtx.beginPath(),this.lgndCtx.arc(n.cx,n.cy,n.r,0,2*Math.PI),this.lgndCtx.fillStyle=n.fill,this.lgndCtx.globalAlpha=n.opacity,this.lgndCtx.fill(),this.lgndCtx.lineWidth=n["stroke-width"],this.lgndCtx.strokeStyle=n.stroke,this.lgndCtx.stroke(),this.lgndCtx.restore(),this.lgndCtx=u):(r=this.ctx,this.ctx=t!=undefined?t:this.ctx,this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.cx,n.cy,n.r,0,2*Math.PI),this.ctx.fillStyle=n.fill,this.ctx.globalAlpha=n.opacity,this.ctx.fill(),this.ctx.lineWidth=n["stroke-width"],i=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1,i&&this.ctx.setLineDash(i),this.ctx.strokeStyle=n.stroke,this.ctx.stroke(),this.ctx.restore(),this.ctx=r)},drawPolyline:function(n){var i,t;for(this.ctx.save(),this.ctx.beginPath(),i=n.points.split(" "),t=0;t<i.length-1;t++){var r=i[t].split(","),u=r[0],f=r[1];t==0?this.ctx.moveTo(u,f):this.ctx.lineTo(u,f)}this.ctx.lineWidth=n["stroke-width"];this.ctx.strokeStyle=n.stroke;this.ctx.stroke();this.ctx.restore()},drawPolygon:function(){},setFillAttribute:function(){},setStrokeAttribute:function(){},changePathValue:function(){},drawArc:function(){},changeVMLStyle:function(){},applyVMLStyle:function(){},drawEllipse:function(n,t){var f=this.ctx;this.ctx=t!=undefined?t:this.ctx;var i=Math.max(n.rx,n.ry),r=n.rx/i,u=n.ry/i;n.lgndCtx?(this.lgndCtx.save(),this.lgndCtx.beginPath(),this.lgndCtx.translate(n.rx,n.ry),this.lgndCtx.scale(r,u),this.lgndCtx.arc(n.cx-n.rx,n.cy*2-n.rx,n.rx,0,2*Math.PI,!1),this.lgndCtx.fillStyle=n.fill,this.lgndCtx.fill(),this.lgndCtx.restore(),this.lgndCtx.lineWidth=n["stroke-width"],this.lgndCtx.strokeStyle=n.stroke,this.lgndCtx.stroke(),this.lgndCtx.restore()):(this.ctx.save(),this.ctx.beginPath(),this.ctx.translate(n.cx,n.cy),this.ctx.save(),this.ctx.scale(r,u),this.ctx.arc(0,0,i,0,2*Math.PI,!1),this.ctx.fillStyle=n.fill,this.ctx.fill(),this.ctx.restore(),this.ctx.lineWidth=n["stroke-width"],this.ctx.strokeStyle=n.stroke,this.ctx.stroke(),this.ctx.restore(),this.ctx=f)},_getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},_setAttr:function(){},setSpanAttr:function(){},_textAttrReplace:function(){},drawImage:function(n){this.ctx.save();var t=new Image;t.src=n.href;this.ctx.drawImage(t,n.x,n.y,n.width,n.height);this.ctx.restore()},createDefs:function(){},createGroup:function(){},createText:function(t,i){var r=document.createElement("div");return n(r).css({transform:t.rotateAngle,"font-family":parseFloat(t["font-family"]),"font-size":parseFloat(t["font-size"])*1.1,position:"absolute"}),ej.util.isNullOrUndefined(i)||(r.textContent=i),r},drawAxesBoundsClipPath:function(n,t){var i=t},getAttrVal:function(){},hexFromRGB:function(){},createDelegate:function(){},drawClipPath:function(){},drawCircularClipPath:function(){},append:function(t,i){n(t).appendTo(i)},createLegendCanvas:function(n){return this.legendsvgObj=document.createElement("canvas"),this._rootId=jQuery(n).attr("id"),this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_canvas"),this.lgndCtx=this.legendsvgObj.getContext("2d"),this.legendsvgObj}}}(jQuery);ej.EjSvgRender=function(n){var t,i;if(this.svgLink="http://www.w3.org/2000/svg",this.svgObj=document.createElementNS(this.svgLink,"svg"),this._rootId=jQuery(n).attr("id"),t=this._rootId+"_svg",$(document).find("#"+t).length>0){i=0;do i++;while($(document).find("#"+this._rootId+"_svg"+i).length>0);t=this._rootId+"_svg"+i}this.svgObj.setAttribute("id",t)},function(n){function t(n,t,i,r){var u=r*Math.PI/180,f=n+i*Math.cos(u),e=t+i*Math.sin(u);return[f,e]}ej.EjSvgRender.prototype={drawPath:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"path");n(r).attr(t).appendTo(i)}},createLegendSvg:function(n){return this.svgLink="http://www.w3.org/2000/svg",this.legendsvgObj=document.createElementNS(this.svgLink,"svg"),this._rootId=jQuery(n).attr("id"),this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_svg"),this.legendsvgObj},drawPolyline:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"polyline");n(r).attr(t).appendTo(i)}},drawLine:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"line");n(r).attr(t);n(r).appendTo(i)}},drawPolygon:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"polygon");n(r).attr(t);n(r).appendTo(i)}},drawCircle:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"circle");n(r).attr(t).appendTo(i)}},drawEllipse:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"ellipse");n(r).attr(t).appendTo(i)}},drawRect:function(t,i){if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var r=document.createElementNS(this.svgLink,"rect");n(r).attr(t).appendTo(i)}},drawCylinder:function(t,i,r){var k,et,a;if(n("#"+t.id).length>0)n("#"+t.id).attr(t);else{var it=t.x,d=t.y,v=t.id,f=t.fill,ot=f,st=this.checkColorFormat(f);st||(f=ej.datavisualization.Chart.prototype.colorNameToHex(f));var c,l,y,p,s,e,w,g,rt=2,nt,b,ut=0,ft=0,tt={svgRenderer:this};if(r.isColumn==!0){var u=t.width/2,h=t.height,o=u/4;s=nt=it;e=d-o;b=e;c=2*u;l=0;y=0;p=h;w=s;g=e+h;ut=100;(r.stacking=!0)&&(r.isLastSeries||(e=b=d+o,p=h-u/2))}else{var o=t.height/2,h=t.width,u=o/4;e=b=d;s=nt=it+u;c=0;l=2*o;y=h;p=0;w=s+h;g=e;ft=100;(r.stacking=!0)&&(r.isLastSeries||(w=s+h-u*2,y=h-u*2))}for(delete t.x,delete t.y,delete t.width,delete t.height,delete t.isColumn;rt--;)direction="M"+s.toString()+","+e.toString(),direction+="a"+u.toString()+","+o.toString()+" 0 1,0 "+c.toString()+","+l.toString(),direction+="a"+u.toString()+","+o.toString()+" 0 1,0 "+(-1*c).toString()+","+(-1*l).toString(),t.d=direction,t.id=v+"_Region_"+rt,t.fill=ej.Ej3DRender.prototype.polygon3D.prototype.applyZLight(f,tt),this.drawPath(t,i),s=w,e=g;direction="M"+nt.toString()+","+b.toString();direction+="a"+u.toString()+","+o.toString()+" 0 1,0 "+c.toString()+","+l.toString();direction+="l"+y.toString()+" "+p.toString();direction+="a"+u.toString()+","+o.toString()+" 0 1,1 "+(-1*c).toString()+","+(-1*l).toString()+" z";t.d=direction;t.id=v+"_Region_2";ot.indexOf("url")==-1&&(k=v.substring(0,v.indexOf("P")),n("#"+k).length==0&&(et={id:k,x1:"0%",y1:"0%",x2:ut.toString()+"%",y2:ft.toString()+"%"},a=[],a[0]={colorStop:"0%",color:f},a[1]={colorStop:"30%",color:ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(f,tt)},a[2]={colorStop:"70%",color:ej.Ej3DRender.prototype.polygon3D.prototype.applyXLight(f,tt)},a[3]={colorStop:"100%",color:f},this.drawGradient(et,a,i)),t.fill="url(#"+k+")");this.drawPath(t,i)}},createGradientElement:function(n,t,i,r,u,f,e){var o,s,h;return Object.prototype.toString.call(t)=="[object Array]"?(s={id:this.svgObj.id+"_"+n+"Gradient",x1:i+"%",y1:r+"%",x2:u+"%",y2:f+"%"},h="#"+this.svgObj.id+"_"+n+"Gradient",this.drawGradient(s,t,e),o="url(#"+this.svgObj.id+"_"+n+"Gradient)"):o=t,o},drawGradient:function(t,i,r){var o=this.createDefs(),f=document.createElementNS(this.svgLink,"linearGradient"),u,e;for(n(f).attr(t),u=0;u<i.length;u++)e=document.createElementNS(this.svgLink,"stop"),n(e).attr({offset:i[u].colorStop,"stop-color":i[u].color,"stop-opacity":1}),n(e).appendTo(f);n(f).appendTo(o);n(o).appendTo(r)},drawText:function(t,i,r,u){var e,o,h,f,s,c;if(n("#"+t.id).length>0)this._textAttrReplace(t,i,u);else{if(e=document.createElementNS(this.svgLink,"text"),o=n(e),jQuery.type(i)=="array")for(h=0,o.attr(t),f=0;f<i.length;f++)s=document.createElementNS(this.svgLink,"tspan"),s.textContent=i[f],n(s).attr({x:t.x,dy:h}),n(s).appendTo(e),c=ej.EjSvgRender.utils._measureText(i[f],null,u),h=c.height+2;else e.textContent=i,o.attr(t);o.appendTo(r)}},_textAttrReplace:function(t,i,r){var f,e,u,o,s;if(n("#"+t.id).attr(t),jQuery.type(i)=="array")if(f=n("#"+t.id).children("tspan"),e=0,f.length>0&&f.length==i.length)for(u=0;u<f.length;u++)o=f[u],n(o).attr({x:t.x,dy:e}),o.textContent=i[u],s=ej.EjSvgRender.utils._measureText(i[u],null,r),e=s.height+2;else n("#"+t.id).remove(),this.drawText(t,i,this.gTransToolEle,r);else n("#"+t.id).text(i)},drawImage:function(t,i){var r=document.createElementNS(this.svgLink,"image");r.setAttributeNS(null,"height",t.height);r.setAttributeNS(null,"width",t.width);r.setAttributeNS("http://www.w3.org/1999/xlink","href",t.href);r.setAttributeNS(null,"x",t.x);r.setAttributeNS(null,"y",t.y);r.setAttributeNS(null,"id",t.id);r.setAttributeNS(null,"visibility",t.visibility);ej.util.isNullOrUndefined(t.clippath)&&ej.util.isNullOrUndefined(t.preserveAspectRatio)||(r.setAttributeNS(null,"clip-path",t.clippath),r.setAttributeNS(null,"preserveAspectRatio",t.preserveAspectRatio));n(r).appendTo(i)},createDefs:function(){return document.createElementNS(this.svgLink,"defs")},createClipPath:function(t){var i=document.createElementNS(this.svgLink,"clipPath");return n(i).attr(t),i},createForeignObject:function(t){var i=document.createElementNS(this.svgLink,"foreignObject");return n(i).attr(t),i},createGroup:function(t){var i=document.createElementNS(this.svgLink,"g");return n(i).attr(t),i},createPattern:function(n,t){var r=document.createElementNS(this.svgLink,t);for(var i in n)n.hasOwnProperty(i)&&r.setAttribute(i,n[i]);return r},createText:function(t,i){var r=document.createElementNS(this.svgLink,"text");return n(r).attr(t),ej.util.isNullOrUndefined(i)||(r.textContent=i),r},createPath:function(t){var i=document.createElementNS(this.svgLink,"path");return n(i).attr(t),i},createCircle:function(t){var i=document.createElementNS(this.svgLink,"circle");return n(i).attr(t),i},createLine:function(t){var i=document.createElementNS(this.svgLink,"line");return n(i).attr(t),i},_getAttrVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u:r},hexFromRGB:function(t){var r=t.R,u=t.G,f=t.B,i;return t.A?"rgba("+r.toString()+","+u.toString()+","+f.toString()+","+t.A+")":(i=[r.toString(16),u.toString(16),f.toString(16)],n.each(i,function(n,t){t.length===1&&(i[n]="0"+t)}),"#"+i.join("").toUpperCase())},checkColorFormat:function(n){return/(rgba?\((?:\d{1,3}[,\)]){3}(?:\d+\.\d+\))?)|(^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$)/gmi.test(n)},hexToRGB:function(n){var i=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.test(n),t;return i==!0?(t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(n),t?{R:parseInt(t[1]),G:parseInt(t[2]),B:parseInt(t[3]),A:t[4]}:null):(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),t?{R:parseInt(t[1],16),G:parseInt(t[2],16),B:parseInt(t[3],16)}:null)},createDelegate:function(n,t){return function(i){t.apply(n,[i,this])}},drawClipPath:function(t,i){if(n(i).find("#"+t.id).length>0)n(i).find("#"+t.id).attr(t);else{var r=this.createDefs(),u=this.createClipPath({id:t.id});this.drawRect(t,u);this.append(u,r);this.append(r,i)}},drawCircularClipPath:function(n,t){var i=this.createDefs(),r=this.createClipPath({id:n.id});this.drawCircle(n,r);this.append(r,i);this.append(i,t)},append:function(t,i){n(t).appendTo(i)},_setAttr:function(t,i){n(t).attr(i)}};ej.EjSvgRender.commonChartEventArgs={cancel:!1,data:null};ej.EjSvgRender.utils={_decimalPlaces:function(n){var t=(""+n).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},_getLabelContent:function(n,t,i){switch(t._categoryValueType){case"number":var r=ej.util.isNullOrUndefined(t.labelFormat)?null:t.labelFormat.match("{value}");return ej.util.isNullOrUndefined(t.labelFormat)?t.labels[Math.floor(n)]:r!=null?t.labelFormat.replace("{value}",t.labels[Math.floor(n)]):ej.format(t.labels[Math.floor(n)],t.labelFormat,i);case"date":return ej.format(new Date(t.labels[Math.floor(n)]),ej.util.isNullOrUndefined(t.labelFormat)?"dd/MM/yyyy":t.labelFormat,i);case"string":return t.labels[Math.floor(n)];default:return""}},_getSeriesTemplateSize:function(t,i,r,u,f){var t,i,a=f.model.AreaType,o=f._id,v=n.inArray(r,f.model._visibleSeries),s,h,e,c,l;s=n("#template_group_"+o).length!=0?n("#template_group_"+o):n("<div><\/div>").attr("id","template_group_"+o);s.css("position","relative").css("z-index",1e3);h=n("#"+r.marker.dataLabel.template).clone();n(h).attr("id",r.marker.dataLabel.template+"_"+v+"_"+i+"_"+o);e=n(h);e.css("position","absolute");t.count=1;c={series:r,point:t};e.html(e.html().parseTemplate(c));l=a=="cartesianaxes"||!r.enableAnimation||r.type.toLowerCase()=="pyramid"||r.type.toLowerCase()=="funnel"?"block":"none";e.css("display",l).appendTo(n(s));n(s).appendTo("#"+o);t.size={height:e.height(),width:e.width()};u?((ej.util.isNullOrUndefined(r.LeftLabelMaxHeight)||r.LeftLabelMaxHeight<t.size.height)&&(r.LeftLabelMaxHeight=t.size.height),(ej.util.isNullOrUndefined(r.LeftLabelMaxWidth)||r.LeftLabelMaxWidth<t.size.width)&&(r.LeftLabelMaxWidth=t.size.width)):((ej.util.isNullOrUndefined(r.RightLabelMaxHeight)||r.RightLabelMaxHeight<t.size.height)&&(r.RightLabelMaxHeight=t.size.height),(ej.util.isNullOrUndefined(r.RightLabelMaxWidth)||r.RightLabelMaxWidth<t.size.width)&&(r.RightLabelMaxWidth=t.size.width))},getMinPointsDelta:function(t,i,r){var f=i,u=Number.MAX_VALUE;return n.each(f.model._visibleSeries,function(i,e){var o,h,s;e.visibility.toLowerCase()=="visible"&&t.name==e._xAxisName&&(o=ej.DataManager(e.points,ej.Query().sortBy("xValue")).executeLocal(),o.length!=1||f.currentSeries&&f.currentSeries._yAxisName.toLowerCase()!=e._yAxisName.toLowerCase()?n.each(o,function(n,t){if(n>0&&t.xValue){var i=t.xValue-o[n-1].xValue;i!=0&&(u=Math.min(u,i))}}):(h=ej.util.isNullOrUndefined(r)?e.xAxis.visibleRange.min:r,s=o[0].xValue-h,s!=0&&(u=Math.min(u,s))))}),u==Number.MAX_VALUE&&(u=1),u},_getSeriesMaxLabel:function(t){var i={width:0,height:0},o=n(this.svgObject).width(),e=[],f,r,s,u;if(t.labels.length>0){for(r=0;r<t.labels.length;r++)u=this._measureText(t.visibleLabels[r],o,t.marker.dataLabel.font),i.width<u.width&&(i.width=u.width),i.height<u.height&&(i.height=u.height);t.LabelMaxHeight=i.height;t.LabelMaxWidth=i.width}else for(e.push(t.rightsidePoints),e.push(t.leftsidePoints),f=0;f<e.length;f++){for(r=0;r<e[f].length;r++)s=e[f][r].text?e[f][r].text:e[f][r].y,u=this._measureText(s,o,t.marker.dataLabel.font),i.width<u.width&&(i.width=u.width),i.height<u.height&&(i.height=u.height);f==0?(t.RightLabelMaxHeight=i.height,t.RightLabelMaxWidth=i.width):(t.LeftLabelMaxHeight=i.height,t.LeftLabelMaxWidth=i.width)}},_getMaxLabelWidth:function(t,r){var f,b,d,et,g,nt,o,ht,tt,y,k,p,it,ot,gt,ni;this.chartObj=r;var u={width:0,height:0,maxHeight:0,maxWidth:0},h="",yt=1,ti=r.svgRenderer.vmlNamespace,c=t.visibleRange,w=t.labelIntersectAction&&!r.model.enable3D?t.labelIntersectAction.toLowerCase():"",ut=t.labelPlacement,ii=t.opposedPosition,st=t.orientation.toLowerCase(),pt=r.model.requireInvertedAxes?st=="vertical":st=="horizontal",wt=t.roundingPlaces,l=t.labelRotation,st=t.orientation,v=0,s=[],ft=t.visibleLabels,ri=ft.length;if(t.visible){for(f=0;f<ri;f++)t.visibleLabels[f].y=0,b=this._measureText(t.visibleLabels[f].Text,n(this.svgObject).width(),t.font,t.labelRotation),u.width<b.width&&(u.width=b.width,h=t.visibleLabels[f].Text),u.height<b.height&&(u.height=b.height);if(t.enableTrim&&(d=t.maximumLabelWidth,u.width=u.width>d?d:u.width),u.rows=1,u.maxWidth=u.width,u.maxHeight=u.height,!ti&&(l||w)&&(et=0,w=="rotate45"?et=45:w=="rotate90"&&(et=90),l=l!=null||st=="vertical"?l:et,t.rotationValue=l,l)){if(h=ej.isNullOrUndefined(h)?"":h,labeltextWidth=this._measureText(h,n(this.svgObject).width(),t.font,t.labelRotation),t.enableTrim&&labeltextWidth.width>d&&h!="")for(o=h,g=1;g<o.toString().length;g++)if(o=o.toString().substring(0,g)+"... ",nt=this._measureText(o,n(r.svgObject).width(),t.font),nt.width>=d){o=o.toString().substring(0,g-1)+"... ";h=o;break}maxSize=this.rotatedLabel(t,r,l,h);t.labelIntersectAction&&t.labelIntersectAction.toLowerCase()=="multiplerows"&&(v=u.height+maxSize.height);u.height=maxSize.height;u.width=maxSize.width}if(t.labelIntersectAction)if(w=="wrap"||w=="wrapbyword")ut=ut?ut:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,ut.toLowerCase()=="betweenticks"?(tt=1+(t.labels.length>1?-.5:0),tt=wt?parseFloat(tt.toFixed(wt)):parseFloat(tt.toFixed(ej.EjSvgRender.utils._decimalPlaces(c.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(c.interval))),ht=Math.ceil((tt-c.min)/(c.max-c.min)*t.length)):ht=Math.ceil(t.length/ft.length),y=Math.round(u.width/ht),u.rows=l?y-yt:y+yt,u.height=u.height+y*u.height;else if(w=="multiplerows"){var ui=r._getLegendSpace(),fi=r.model.border.width,vi=r.model._axes[1],ei=n(r.svgObject).width()-r.model.margin.left-r.model.margin.right,oi=t.title.text==""||!t.visible?0:this._measureText(t.title.text,ei,t.title.font).height+2*r.model.elementSpacing,si=r.model.elementSpacing+oi+t.majorTickLines.size+t.axisLine.width,hi=r._getYValues(r.model._visibleSeries[0].points),ci=Math.max.apply(Math,hi),bt=r.model._axes[1],b=this._measureText(ci,n(this.svgObject).width(),bt.font,bt.labelRotation),li=ui.rightLegendWidth+si+b.width+r.model.margin.right+r.model.margin.left+2*fi,kt=n(r.svgObject).width()-li;if(pt){for(k=0,f=0;f<ft.length;f++){var e=ft[f],ct=!1,dt=!1;v=Math.max(v,k);k=e.y=u.height;var o=this._measureText(e.Text,n(this.svgObject).width(),t.font),nt=o.width,a=o.height,lt=Math.abs(Math.floor((e.Value-c.min)/c.delta*kt));for(p=0;p<s.length&&!ct;p++)for(it=0;s[p]&&it<s[p].length;it++){var rt=s[p][it],at=Math.abs(Math.floor((rt.Value-c.min)/c.delta*kt)),ai=this._measureText(rt.Text,n(this.svgObject).width(),t.font).width,vt=at+ai/2;if(vt>lt-nt/2&&!ej.util.isNullOrUndefined(e.y))k=e.y+a,e.y+=a,p+1==s.length&&(ct=!0);else if(it+1==s[p].length){ct=!0;break}}e.y=k;y=k/a-1;s[y]==undefined&&(s[y]=[]);s[y].push(e)}v=s.length*a;u.height=u.height>v?u.height:v;u.rows=ii?Math.round((v+a)/a):Math.round(v/a);u.rows=l?u.rows-1:u.rows;u.rows<1&&(u.rows=1)}if(!pt){for(ot=0,f=0;f<t.visibleLabels.length;f++){for(e=t.visibleLabels[f],o=this._measureText(e.Text,n(this.svgObject).width(),t.font),nt=o.width,a=o.height,lt=Math.abs(Math.floor((e.Value-t.visibleRange.min)/t.visibleRange.delta*t.length)),i=0;i<f;i++)rt=t.visibleLabels[i],at=Math.abs(Math.floor((rt.Value-t.visibleRange.min)/t.visibleRange.delta*t.length)),gt=this._measureText(rt.Text,n(this.svgObject).width(),t.font).height,vt=at+gt/2,vt>lt-a/2&&t.visibleLabels[i].y==e.y&&(ot=e.y+nt,e.y=ot,dt=!0);ni=ot}u.width=u.width+ni+(dt?5:0)}}}return u},rotatedLabel:function(n,t,i,r){var f={"font-size":n.font.size,transform:"rotate("+i+",0,0)","font-family":n.font.fontFamily,"font-style":n.font.fontStyle,rotateAngle:"rotate("+i+"deg)","text-anchor":"middle"},u=t.svgRenderer.createText(f,r),e=Math.ceil(this._measureBounds(u,t).height),o=Math.ceil(this._measureBounds(u,t).width);return{height:e,width:o}},_getTransform:function(n,t,i){var r,u,f,e;return i?(r=t.x,u=n.y,f=t.width,e=n.height):(r=n.x,u=t.y,f=n.width,e=t.height),{x:r,y:u,width:f,height:e}},_calculateroundedCorner:function(n,t,i,r,u){var f=n.x,e=n.y,h=5,c=this.chartObj.model.enableCanvasRendering&&!u?h/4:0,o=n.width,s=n.height,v=n.cornerRadius,a,y,p,w,l;return typeof v!="object"?a=y=p=w=v:(a=v.topLeft,y=v.bottomLeft,p=v.topRight,w=v.bottomRight),a=ej.util.isNullOrUndefined(n.rx)?a:n.rx,y=ej.util.isNullOrUndefined(n.rx)?y:n.rx,p=ej.util.isNullOrUndefined(n.ry)?p:n.ry,w=ej.util.isNullOrUndefined(n.ry)?w:n.ry,l="M "+f+" "+(a+e)+" Q "+f+" "+e+" "+(f+a)+" "+e+" ",t&&i=="top"&&(l+="L "+(f+o/2-h/2+c)+" "+e+" L "+(f+o/2+c-r)+" "+(e-h)+" L "+(f+o/2+h/2+c)+" "+e+" "),l+="L "+(f+o-p)+" "+e+" Q "+(f+o)+" "+e+" "+(f+o)+" "+(e+p)+" ",t&&i=="right"&&(l+="L "+(f+o)+" "+(e+s/2-h/2+c)+" L "+(f+o+h)+" "+(e+s/2+c-r)+" L "+(f+o)+" "+(e+s/2+h/2+c)+" "),l+="L "+(f+o)+" "+(e+s-w)+" Q "+(f+o)+" "+(e+s)+" "+(f+o-w)+" "+(e+s)+" ",t&&i=="bottom"&&(l+="L "+(f+o/2-h/2+c)+" "+(e+s)+" L "+(f+o/2+c-r)+" "+(e+s+h)+" L "+(f+o/2+h/2+c)+" "+(e+s)+" "),l+="L "+(f+y)+" "+(e+s)+" Q "+f+" "+(e+s)+" "+f+" "+(e+s-y)+" ",t&&i=="left"&&(l+="L "+f+" "+(e+s/2-h/2+c)+" L "+(f-h)+" "+(e+s/2+c-r)+" L "+f+" "+(e+s/2+h/2+c)+" "),l+("L "+f+" "+(a+e)+" z")},browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},_measureText:function(t,i,r){var s=n(document).find("#measureTex"),u,e,o,f,v;n("#measureTex").css("display","block");s.length==0?(u=document.createElement("text"),n(u).attr({id:"measureTex"}),document.body.appendChild(u)):u=s[0];var h=null,c=null,l=null,a=null;if(typeof t=="string"&&(t.indexOf("<")>-1||t.indexOf(">")>-1)){for(e=t.split(" "),o=0;o<e.length;o++)e[o].indexOf("<br/>")==-1&&(e[o]=e[o].replace(/[<>]/g,"&"));t=e.join(" ")}return u.innerHTML=t,r!=undefined&&r.size==undefined&&(f=r,f=f.split(" "),h=f[0],c=f[1],l=f[2],a=f[3]),r!=null&&(u.style.fontSize=r.size>0?r.size+"px":r.size?r.size:c,u.style.fontStyle&&(u.style.fontStyle=r.fontStyle?r.fontStyle:h),u.style.fontFamily=r.fontFamily?r.fontFamily:l,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(u.style.fontWeight=r.fontWeight?r.fontWeight:a)),u.style.backgroundColor="white",u.style.position="absolute",u.style.top=-100,u.style.left=0,u.style.visibility="hidden",u.style.whiteSpace="nowrap",i&&(u.style.maxwidth=i+"px"),v={width:u.offsetWidth,height:u.offsetHeight},n("#measureTex").css("display","none"),v},_trimText:function(n,t,i){var f,r,e,u;for(r=n.toString(),e=r.length,u=1;u<e;u++)if(r=n.substring(0,u)+"...",f=ej.EjSvgRender.utils._measureText(r,null,i).width,f>=t)return r.substring(0,u-1)+"... ";return n},_measureBounds:function(t,i){i.model.enableCanvasRendering?n(document.body).append(t):(i.svgRenderer.append(t,i.svgObject),i.svgRenderer.append(i.svgObject,i.element));var r=t.getBoundingClientRect(),u={left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.right-r.left,height:r.bottom-r.top};return n(t).remove(),u},_drawAxesBoundsClipPath:function(t,i,r){var u,s=n(t),f=this._getTransform(i.xAxis,i.yAxis,r.model.requireInvertedAxes),h=r.model.AreaType=="polaraxes"?n(r.svgObject).width():f.width,c=r.model.AreaType=="polaraxes"?n(r.svgObject).height():f.height,e=r.model.requireInvertedAxes?i.yAxis.plotOffset:i.xAxis.plotOffset,o=r.model.requireInvertedAxes?i.xAxis.plotOffset:i.yAxis.plotOffset;r.model.AreaType=="polaraxes"?(u={id:t?t.id+"_ClipRect":"",cx:r.model.centerX,cy:r.model.centerY,r:r.model.Radius,fill:"white","stroke-width":1,stroke:"transparent"},r.svgRenderer.drawCircularClipPath(u,t)):(u={id:t?t.id+"_ClipRect":"",x:0-e,y:0-o,width:h+2*e,height:c+2*o,fill:"white","stroke-width":1,stroke:"transparent"},r.svgRenderer.drawClipPath(u,t));s.attr("clip-path","url(#"+u.id+")")},_getStringBuilder:function(){var n=[],t=0;return{append:function(i){return n[t++]=i,this},remove:function(t,i){return n.splice(t,i||1),this},insert:function(t,i){return n.splice(t,0,i),this},toString:function(t){return n.join(t||"")}}},_addRegion:function(t,i,r,u,f){var s=r.type,e=n.inArray(r,t.model._visibleSeries),o;e>=0&&(o={SeriesIndex:e,Region:{PointIndex:f,Bounds:i},type:s},t.model.chartRegions.push(o))},AddRegion:function(n,t,i){if(i){var r={isStripLine:i,Region:{Bounds:t}};n.model.chartRegions.push(r)}},_getSvgXY:function(n,t,i,r){var u,f;return r.model.requireInvertedAxes?(u=n+i.yAxis.x,f=t+i.xAxis.y):(u=n+i.xAxis.x,f=t+i.yAxis.y),{X:u,Y:f}},_getPoint:function(n,t){var f=n.xValue,e=t.type=="boxandwhisker"?n.YValues:n.YValues[0],o=t._isTransposed?t.xAxis.height:t.xAxis.width,i,r,u;return yLength=t._isTransposed?t.yAxis.width:t.yAxis.height,n.location={},t._hiloTypes&&(i=n.YValues[1],i=t.yAxis._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(i==0?1:i,t.xAxis.logBase):i,i=this._getPointXY(i,t.yAxis.visibleRange,t.yAxis.isInversed),n.location.low=(t._isTransposed?i:1-i)*yLength),r=t.xAxis._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(f==0?1:f,t.xAxis.logBase):f,u=t.yAxis._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(e==0?1:e,t.xAxis.logBase):e,r=this._getPointXY(r,t.xAxis.visibleRange,t.xAxis.isInversed),u=this._getPointXY(u,t.yAxis.visibleRange,t.yAxis.isInversed),n.location.X=t._isTransposed?u*yLength:r*o,n.location.Y=t._isTransposed?(1-r)*o:(1-u)*yLength,n.location},_getPointXY:function(n,t,i){var r=0;return r=(n-t.min)/t.delta,i?1-r:r},_dateTimeLabelFormat:function(n){var t="d";return n.toLowerCase()=="years"?t="MMM, yyyy":n.toLowerCase()=="months"?t="dd, MMM":n.toLowerCase()=="days"?t="MM/dd/yyyy":n.toLowerCase()=="hours"?t="dd, hh:mm":n.toLowerCase()=="seconds"||n.toLowerCase()=="minutes"?t="hh:mm:ss":n.toLowerCase()=="milliseconds"&&(t="hh:mm:ss:tt"),t},_getFontString:function(n){return n==null&&(n={}),n.FontFamily||(n.FontFamily="Arial"),n.FontStyle||(n.FontStyle="Normal"),n.Size||(n.Size="12px"),n.FontStyle+" "+n.Size+" "+n.FontFamily},_valueToVector:function(n,t){return this._coefficientToVector(this._valueToPolarCoefficient(n,t))},TransformToVisible:function(n,t,i,r){t=n.xAxis._valueType=="logarithmic"&&t>0?Math.log(t,n.xAxis.logBase):t;i=n.xAxis._valueType=="logarithmic"&&i>0?Math.log(i,n.yAxis.logBase):i;var u=r.model.Radius*this._valueToCoefficient(n.yAxis,i),f=this._valueToVector(n.xAxis,t);return{X:r.model.centerX+u*f.X,Y:r.model.centerY+u*f.Y}},Transform3DToVisible:function(n,t,i,r){var u,f;if(n.xAxis!=null&&n.yAxis!=null){if(u=n.xAxis._valueType.toLowerCase(),f=u=="logarithmic"?!0:!1,t=t=f&&t>0?math.log(t,xlogarithmicBase):t,i=i,r.model.requireInvertedAxes){var e=r.model.m_AreaBounds.X,o=r.model.m_AreaBounds.Y,s=e+n.yAxis.width*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,i,r),h=o+n.xAxis.height*(1-ej.EjSvgRender.utils._valueToCoefficient(n.xAxis,t,r));return{X:s,Y:h}}var e=n.xAxis.x,o=n.yAxis.y,t=e+Math.round(n.xAxis.width*ej.EjSvgRender.utils._valueToCoefficient(n.xAxis,t,r)),i=o+Math.round(n.yAxis.height*(1-ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,i,r)));return{X:t,Y:i}}return new Point(0,0)},_valueToPolarCoefficient:function(n,t){var u=n.visibleRange.min,i,r;return n._valueType!="category"?(i=n.visibleRange.max-n.visibleRange.interval-n.visibleRange.min,r=n.visibleLabels.length-1):(i=n.visibleRange.delta,r=n.visibleLabels.length),result=(t-u)/i,result*=1-1/r,n.isInversed?result:1-result},_coefficientToVector:function(n){var t=Math.PI*(1.5-2*n);return{X:Math.cos(t),Y:Math.sin(t)}},_valueToCoefficient:function(n,t,i){var r;return r=i&&i.model.AreaType=="polaraxes"?t:n._valueType&&n._valueType.toLowerCase()=="logarithmic"?ej.EjSvgRender.utils._logBase(t==0?1:t,n.logBase):t,r=(r-n.visibleRange.min)/n.visibleRange.delta,n.isInversed?1-r:r},_getBoundingClientRect:function(t,i,r,u){var f=t.getBoundingClientRect(),s=n("#"+i.svgObject.id)[0].getBoundingClientRect(),e,o,h,c;return u?(e=this._getTransform(r.xAxis,r.yAxis,!0).x,o=this._getTransform(r.xAxis,r.yAxis,!0).y):(e=this._getTransform(r.xAxis,r.yAxis,!1).x,o=this._getTransform(r.xAxis,r.yAxis,!1).y),h=f.left-(e+s.left),c=f.top-(o+s.top),{x:h,y:c,width:f.right-f.left,height:f.bottom-f.top}},_minMax:function(n,t,i){return n>i?i:n<t?t:n},_inside:function(n,t){return n===""?!1:n<=t.max&&n>=t.min},_logBase:function(n,t){return Math.log(n)/Math.log(t)},_correctRect:function(n,t,i,r){return{X:Math.min(n,i),Y:Math.min(t,r),Width:Math.abs(i-n),Height:Math.abs(r-t)}},_getValuebyPoint:function(n,t,i){var f=this.chartObj.model.requireInvertedAxes?i.xAxis.height:i.xAxis.width,e=this.chartObj.model.requireInvertedAxes?i.yAxis.width:i.yAxis.height,r=i.xAxis.isInversed?1-n/f:n/f,u=i.yAxis.isInversed?1-t/e:t/e;return r=r*i.xAxis.visibleRange.delta+i.xAxis.visibleRange.min,u=u*i.yAxis.visibleRange.delta+i.yAxis.visibleRange.min,r=i.xAxis._valueType=="logarithmic"?Math.pow(i.xAxis.logBase,r):r,u=i.yAxis._valueType=="logarithmic"?Math.pow(i.yAxis.logBase,u):u,{PointX:r,PointY:u}}};ej.EjSvgRender.chartTransform3D={ToRadial:Math.PI/180,transform3D:function(n){return this.vector||(this.vector=new(new ej.Ej3DRender).vector3D,this.matrixobj=new(new ej.Ej3DRender).matrix3D,this.bsptreeobj=new(new ej.Ej3DRender).BSPTreeBuilder,this.polygon=new(new ej.Ej3DRender).polygon3D),{mViewport:n,Rotation:0,Tilt:0,Depth:0,PerspectiveAngle:0,needUpdate:!0,centeredMatrix:this.matrixobj.getIdentity(),Perspective:this.matrixobj.getIdentity(),resultMatrix:this.matrixobj.getIdentity(),viewMatrix:this.matrixobj.getIdentity(),Depth:0}},transform:function(n){this.setCenter(this.vector.vector3D(n.mViewport.Width/2,n.mViewport.Height/2,n.Depth/2),n);this.setViewMatrix(this.matrixobj.transform(0,0,n.Depth),n);this.setViewMatrix(this.matrixobj.getMatrixMultiplication(n.viewMatrix,this.matrixobj.turn(-this.ToRadial*n.Rotation)),n);this.setViewMatrix(this.matrixobj.getMatrixMultiplication(n.viewMatrix,this.matrixobj.tilt(-this.ToRadial*n.Tilt)),n);this.updatePerspective(n.PerspectiveAngle,n);n.needUpdate=!0},updatePerspective:function(n,t){var i=(t.mViewport.Width+t.mViewport.Height)*Math.tan(this.degreeToRadianConverter((180-Math.abs(n%181))/2))+t.Depth/1;t.Perspective[0][0]=i;t.Perspective[1][1]=i;t.Perspective[2][3]=1;t.Perspective[3][3]=i},degreeToRadianConverter:function(n){return n*Math.PI/180},toScreen:function(n,t,i,r){var i=i?i:this.result;return r?(this.matrixobj=r,n=r.getMatrixVectorMutiple(i(t,r),n)):n=this.matrixobj.getMatrixVectorMutiple(i(t),n),{x:n.x,y:n.y}},setViewMatrix:function(n,t){t.viewMatrix!=n&&(t.viewMatrix=n,t.needUpdate=!0)},setCenteredMatrix:function(n,t){t.viewMatrix!=n&&(t.centeredMatrix=n,t.needUpdate=!0)},result:function(n,t){return(this.matrixobj||(this.matrixobj=t),!n.needUpdate)?n.resultMatrix:(n.resultMatrix=this.matrixobj.getMatrixMultiplication(this.matrixobj.getInvertal(n.centeredMatrix),n.Perspective),n.resultMatrix=this.matrixobj.getMatrixMultiplication(n.resultMatrix,n.viewMatrix),n.resultMatrix=this.matrixobj.getMatrixMultiplication(n.resultMatrix,n.centeredMatrix),n.needUpdate=!1,n.resultMatrix)},setCenter:function(n,t){t.centeredMatrix=this.matrixobj.transform(-n.x,-n.y,-n.z);t.needUpdate=!0},toPlane:function(n,t,i){var r=this.vector.vector3D(n.x,n.y,0),u=this.vector.vector3DPlus(r,vector.vector3D(0,0,1));return r=this.vector.vector3DMultiply(i.centeredMatrix,r),u=this.vector.vector3DMultiply(i.centeredMatrix,u),r=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.Perspective),r),u=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.Perspective),u),r=this.polygon.getPoint(r,this.vector.vector3DMinus(u-r)),r=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.viewMatrix),r),this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.centeredMatrix),r)}};ej.EjSvgRender.chartSymbol={_drawSeriesType:function(n,t,i){var r=i.model.series[t.SeriesIndex].type.toLowerCase(),u=i.legendItem.drawType;r=ej.util.isNullOrUndefined(u)?r:u;switch(r){case ej.datavisualization.Chart.Type.Line:return ej.util.isNullOrUndefined(u)?this._drawLine(n,t,i,i.gLegendItemEle):this._drawStraightLine(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StepLine:return this._drawStepLine(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StackingArea:case ej.datavisualization.Chart.Type.StackingArea100:case ej.datavisualization.Chart.Type.Area:case ej.datavisualization.Chart.Type.RangeArea:return this._drawArea(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StepArea:return this._drawStepArea(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Bar:case ej.datavisualization.Chart.Type.StackingBar100:case ej.datavisualization.Chart.Type.StackingBar:return this._drawBar(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Pie:return this._drawPie(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Doughnut:return this._drawDoughnut(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Hilo:return this._drawHilo(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.HiloOpenClose:return this._drawHiloOpenClose(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Candle:return this._drawCandle(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Pyramid:return this._drawPyramid(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Funnel:return this._drawFunnel(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Spline:return this._drawSpline(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.SplineArea:return this._drawSplineArea(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.RangeColumn:return this._drawRangeColumn(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Bubble:case ej.datavisualization.Chart.Type.Scatter:return this._drawCircle(n,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Column:case ej.datavisualization.Chart.Type.StackingColumn:case ej.datavisualization.Chart.Type.StackingColumn100:case ej.datavisualization.Chart.Type.Waterfall:return this._drawColumn(n,t,i,i.gLegendItemEle);default:return this._drawRectangle(n,t,i,i.gLegendItemEle)}},_drawCircle:function(n,t,i,r){var o=i.svgRenderer,h=i.svgObject,f=t.ShapeSize,e=Math.sqrt(f.height*f.height+f.width*f.width)/2,u=t.Style,s={id:t.ID,cx:n.startX,cy:n.startY,r:e,fill:u.Color,"stroke-width":u.BorderWidth,stroke:u.BorderColor,opacity:u.Opacity,visibility:u.Visibility,lgndCtx:t.context};return o.drawCircle(s,r),n.startX-e},_drawLeftArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2+u.width)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2+u.width)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX-u.width/2)+" "+n.startY+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2+u.width)+" "+(n.startY+u.height/4)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawRightArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX-u.width/2+u.width)+" "+n.startY+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width/2+u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX-u.width/2)+" "+(n.startY+u.height/4)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawUpArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX-u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+n.startX+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2+u.height)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawDownArrow:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2-u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+n.startX+" "+(n.startY-u.height/2+u.height)+" L "+(n.startX-u.width/2)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2+u.height/2)+" L "+(n.startX-u.width/2+u.width/4)+" "+(n.startY-u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawCross:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+u.width/2)+" "+n.startY+" M "+n.startX+" "+(n.startY+u.height/2)+" L "+n.startX+" "+(n.startY+-u.height/2);e={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawHorizLine:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+u.width/2)+" "+n.startY;e={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawVertLine:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+n.startX+" "+(n.startY+u.height/2)+" L "+n.startX+" "+(n.startY+-u.height/2);e={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawTriangle:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+(n.startY+u.height/2)+" L "+n.startX+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawInvertedTriangle:function(n,t,i,r){var f=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,e="M "+(n.startX+u.width/2)+" "+(n.startY-u.height/2)+" L "+n.startX+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width/2)+" "+(n.startY-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY-u.height/2)+" z";var h=n.startX,c=n.startY,o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:e};f.drawPath(o,r)},_drawHexagon:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+-u.width/4)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/4)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+n.startY+" L "+(n.startX+u.width/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+n.startY+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawWedge:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX-u.width)+" "+n.startY+" L "+(n.startX+u.width)+" "+(n.startY+-u.height/2)+" L "+(n.startX+3*(u.width/4))+" "+n.startY+" L "+(n.startX+u.width)+" "+(n.startY+u.height/2)+" L "+(n.startX-u.width)+" "+n.startY+" z";e={"stroke-linecap":"miter","stroke-miterlimit":u.width/4,id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawPentagon:function(n,t,i,r){for(var l,a,v=i.svgRenderer,p=i.svgObject,u=t.ShapeSize,o=Math.sqrt(u.height*u.height+u.width*u.width)/2,f=ej.EjSvgRender.utils._getStringBuilder(),e=0;e<=5;e++){var y=e*72,s=Math.PI/180*y,h=o*Math.cos(s),c=o*Math.sin(s);e==0?f.append("M "+(n.startX+h)+" "+(n.startY+c)+" "):f.append("L "+(n.startX+h)+" "+(n.startY+c)+" ")}f.append("z");l=f.toString();a={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:l};v.drawPath(a,r)},_drawStar:function(n,t,i,r){var o=i.svgRenderer,u=t.ShapeSize,s=i.svgObject,f,e;f="M "+(n.startX+u.width/3)+" "+(n.startY+-u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/6)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/6)+" L "+(n.startX+-u.width/3)+" "+(n.startY+-u.height/2)+" L "+n.startX+" "+(n.startY+u.height/2)+" L "+(n.startX+u.width/3)+" "+(n.startY+-u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawRectangle:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/2)+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawTrapezoid:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/4)+" L "+(n.startX+-u.width/2+u.width)+" "+(n.startY+-u.height/2)+" L "+(n.startX+-u.width/2+u.width)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+(n.startY+u.height/4)+" L "+(n.startX+-u.width/2)+" "+n.startY+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawDiamond:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;f="M "+(n.startX+-u.width/2)+" "+n.startY+" L "+n.startX+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+n.startY+" L "+n.startX+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2)+" "+n.startY+" z";e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,d:f};o.drawPath(e,r)},_drawEllipse:function(n,t,i,r){var f=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,e=n.startX,o=n.startY,s={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,lgndCtx:t.context,cx:e,cy:o,rx:u.width,ry:u.height/2};f.drawEllipse(s,r)},_drawImage:function(n,t,i,r){var f=i.svgRenderer,e=i.svgObject,u=t.ShapeSize,o=n.startX+-u.width/2,s=n.startY+-u.width/2,h=u.width,c=u.height,l={id:e.id+"_image"+t.PointIndex,height:c,width:h,href:t.Imageurl,x:o,y:s,visibility:"visible",lgndCtx:t.context};f.drawImage(l,r)},_drawStraightLine:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/10)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10),o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawLine:function(n,t,i,r){var o=i.svgRenderer,l=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,s;if(i.model.enableCanvasRendering===!0){e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/10)+" L "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" M "+(n.startX+Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10);var s={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},h="M "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" a "+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+2*Math.floor(u.width/3)+" 0 a"+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+-2*Math.floor(u.width/3)+" 0",c={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:h,lgndCtx:!0};o.drawPath(s,r);o.drawPath(c,r)}else e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/10)+" L "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" M "+(n.startX+Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10)+" M "+(n.startX-Math.floor(u.width/3))+" "+(n.startY+u.height/10)+" a "+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+2*Math.floor(u.width/3)+" 0 a"+Math.floor(u.width/3)+" "+Math.floor(u.width/3)+" 0 1 0 "+-2*Math.floor(u.width/3)+" 0",s={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},o.drawPath(s,r);return n.startX+-u.width/2+-f/4},_drawColumn:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX-3*(u.width/5))+" "+(n.startY-u.height/5)+" L "+(n.startX+3*(-u.width/10))+" "+(n.startY-u.height/5)+" L "+(n.startX+3*(-u.width/10))+" "+(n.startY+u.height/2)+" L "+(n.startX-3*(u.height/5))+" "+(n.startY+u.height/2)+" Z M "+(n.startX+-u.width/10-u.width/20)+" "+(n.startY-u.height/4-f/2)+" L "+(n.startX+u.width/10+u.width/20)+" "+(n.startY-u.height/4-f/2)+" L "+(n.startX+u.width/10+u.width/20)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/10-u.width/20)+" "+(n.startY+u.height/2)+" Z M "+(n.startX+3*(u.width/10))+" "+n.startY+" L "+(n.startX+3*(u.width/5))+" "+n.startY+" L "+(n.startX+3*(u.width/5))+" "+(n.startY+u.height/2)+" L "+(n.startX+3*(u.width/10))+" "+(n.startY+u.height/2)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX-3*(u.width/5)},_drawRangeColumn:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/5)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+-u.width/5)+" "+(n.startY-u.height/2-f/4)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2+-f/4)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2+f/4)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/5},_drawBar:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY-3*(u.height/5))+" L "+(n.startX+3*(u.width/10))+" "+(n.startY-3*(u.height/5))+" L "+(n.startX+3*(u.width/10))+" "+(n.startY-3*(u.height/10))+" L "+(n.startX-u.width/2+-f/4)+" "+(n.startY-3*(u.height/10))+" Z M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY-u.height/5+f/20)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY-u.height/5+f/20)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/10+f/20)+" L "+(n.startX-u.width/2+-f/4)+" "+(n.startY+u.height/10+f/20)+" Z M "+(n.startX-u.width/2+-f/4)+" "+(n.startY+u.height/5+f/10)+" L "+(n.startX+-u.width/4)+" "+(n.startY+u.height/5+f/10)+" L "+(n.startX+-u.width/4)+" "+(n.startY+u.height/2+f/10)+" L "+(n.startX-u.width/2+-f/4)+" "+(n.startY+u.height/2+f/10)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawStepLine:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2-f/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2+u.width/10)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2+u.width/10)+" "+n.startY+" L "+(n.startX+-u.width/10)+" "+n.startY+" L "+(n.startX+-u.width/10)+" "+(n.startY+u.height/2)+" L "+(n.startX+u.width/5)+" "+(n.startY+u.height/2)+" L "+(n.startX+u.width/5)+" "+(n.startY+-u.height/2)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2)+"L "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" L"+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/2),o={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2-f/4},_drawSpline:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;return f="M "+(n.startX-u.width/2)+" "+(n.startY+u.height/5)+" Q "+n.startX+" "+(n.startY-u.height)+" "+n.startX+" "+(n.startY+u.height/5)+" M "+n.startX+" "+(n.startY+u.height/5)+" Q "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" "+(n.startX+u.width/2)+" "+(n.startY-u.height/2),e={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth*2,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:f,lgndCtx:!0},o.drawPath(e,r),n.startX-u.width/2},_drawSplineArea:function(n,t,i,r){var o=i.svgRenderer,s=i.svgObject,u=t.ShapeSize,f,e;return f="M "+(n.startX-u.width/2)+" "+(n.startY+u.height/5)+" Q "+n.startX+" "+(n.startY-u.height)+" "+n.startX+" "+(n.startY+u.height/5)+" Z M "+n.startX+" "+(n.startY+u.height/5)+" Q "+(n.startX+u.width/2)+" "+(n.startY+u.height/2)+" "+(n.startX+u.width/2)+" "+(n.startY-u.height/2)+" Z",e={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:f,lgndCtx:!0},o.drawPath(e,r),n.startX-u.width/2},_drawArea:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX-u.width/2-f/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/4+-f/8)+" "+(n.startY-u.height/2)+" L "+n.startX+" "+(n.startY+u.height/4)+" L "+(n.startX+u.width/4+f/8)+" "+(n.startY+-u.height/2+u.height/4)+" L "+(n.startX+u.height/2+f/4)+" "+(n.startY+u.height/2)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX-u.width/2-f/4},_drawStepArea:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/2)+" L "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+-u.height/2)+" L "+(n.startX-u.width/4)+" "+(n.startY-u.height/2)+" L "+(n.startX-u.width/4)+" "+(n.startY-u.height/4)+" L "+(n.startX+u.width/4)+" "+(n.startY-u.height/4)+" L "+(n.startX+u.width/4)+" "+n.startX+" L "+(n.startX+u.width/2+f/4)+" "+n.startY+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/2)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawPyramid:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/4)+" "+(n.startY+u.height/2+f/8)+" L "+n.startX+" "+(n.startY+-u.height/2+-f/8)+" L "+(n.startX+u.width/2+f/4)+" "+(n.startY+u.height/2+f/8)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/4},_drawFunnel:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2+-f/5)+" "+(n.startY+-u.height/2+-f/4)+" L "+(n.startX+-u.width/5)+" "+(n.startY+u.height/4)+" L "+(n.startX+-u.width/5)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+u.width/5)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+u.width/5)+" "+(n.startY+u.height/4)+" L "+(n.startX+u.width/2+f/5)+" "+(n.startY+-u.height/2+-f/4)+" Z",o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.BorderColor,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2+-f/5},_drawCandle:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+-u.width/2)+" "+(n.startY+u.height/4+f/8)+" L "+(n.startX+u.width/2)+" "+(n.startY+u.height/4+f/8)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2+f/8)+" L "+(n.startX+-u.width/2)+" "+(n.startY+-u.height/2+f/8)+" Z M "+n.startX+" "+(n.startY+-u.height/2+f/8)+" L "+n.startX+" "+(n.startY+-u.height/2+-f/4)+" M "+n.startX+" "+(n.startY+u.height/4+f/8)+" L "+n.startX+" "+(n.startY+u.height/4+f/2),o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+-u.width/2},_drawHilo:function(n,t,i,r){var s=i.svgRenderer,h=i.svgObject,u=t.ShapeSize,f=t.ElementSpace,e,o;return e="M "+(n.startX+u.width/2)+" "+(n.startY+u.height/2+f/4)+" L "+(n.startX+u.width/2)+" "+(n.startY+-u.height/2+-f/4),o={id:t.ID,fill:t.Style.Color,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:e,lgndCtx:!0},s.drawPath(o,r),n.startX+u.width/2},_drawHiloOpenClose:function(n,i,r,u){var h=r.svgRenderer,c=r.svgObject,f=i.ShapeSize,l=t(18,12,4.0710678118654755,270),e=i.ElementSpace,o,s;return o="M "+n.startX+" "+(n.startY-3*(f.height/10))+" L "+(n.startX-f.width/2-e/4)+" "+(n.startY-3*(f.height/10))+" M "+n.startX+" "+(n.startY-f.height/2-e/4)+" L "+n.startX+" "+(n.startY+f.height/2+e/4)+" M "+n.startX+" "+(n.startY+3*(f.height/10))+" L "+(n.startX+f.width/2+e/4)+" "+(n.startY+3*(f.height/10)),s={id:i.ID,fill:"transparent","stroke-width":i.Style.BorderWidth,stroke:i.Style.Color,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:o,lgndCtx:!0},h.drawPath(s,u),n.startX-f.width/2},_drawDoughnut:function(n,i,r,u){var o=r.svgRenderer,v=r.svgObject,e=i.ShapeSize,a=i.ElementSpace,f=Math.sqrt(e.height*e.width)/2,c,l;f=f+a/5;var s=t(n.startX,n.startY,f,270),h=t(n.startX+e.width/10,n.startY,f,270),a=i.ElementSpace;return path="M "+n.startX+" "+n.startY+" L "+(n.startX+f)+" "+n.startY+" A "+f+" "+f+" 0 1 1 "+s[0]+" "+s[1]+" Z M "+(n.startX+e.width/10)+" "+(n.startY-e.height/10)+" L"+(n.startX+f)+" "+(n.startY-e.height/10)+" A "+f+" "+f+" 0 0 0 "+h[0]+" "+h[1]+" Z",c={id:i.ID,fill:i.Style.Color,"stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:path,lgndCtx:!0},l={id:i.ID,cx:n.startX,cy:n.startY,r:f/2,lgndCtx:!0,fill:"white","stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility},o.drawPath(c,u),o.drawCircle(l,u),n.startX-f},_drawPie:function(n,i,r,u){var c=r.svgRenderer,a=r.svgObject,e=i.ShapeSize,l=i.ElementSpace,f=Math.sqrt(e.height*e.width)/2,h;f=f+l/5;var o=t(n.startX,n.startY,f,270),s=t(n.startX+e.width/10,n.startY,f,270),l=i.ElementSpace;return path="M "+n.startX+" "+n.startY+" L "+(n.startX+f)+" "+n.startY+" A "+f+" "+f+" 0 1 1 "+o[0]+" "+o[1]+" Z M "+(n.startX+e.width/10)+" "+(n.startY-e.height/10)+" L"+(n.startX+f)+" "+(n.startY-e.height/10)+" A "+f+" "+f+" 0 0 0 "+s[0]+" "+s[1]+" Z",h={id:i.ID,fill:i.Style.Color,"stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:path,lgndCtx:!0},c.drawPath(h,u),n.startX-f}};ej.EjSvgRender.seriesPalette={defaultMetro:["#E94649","#F6B53F","#6FAAB0","#C4C24A","#FB954F","#005277","#8BC652","#69D2E7","#E27F2D","#6A4B82"],defaultHighContrast:["#F93A00","#44E2D6","#DDD10D","#0AA368","#0556CB","#AB40B2","#5F930A","#D12E41","#E0670E","#008FFF"],defaultOffice:["#005277","#8BC652","#6A4B82","#E94649","#6FAAB0","#F7B74F","#C4C24A","#EF863F","#69D2E7","#FFD13E"],defaultMaterial:["#663AB6","#EB3F79","#F8AB1D","#B82E3D","#049CB1","#F2424F","#C2C924","#3DA046","#074D67","#02A8F4"],defaultGradient:{borderColors:["#F34649","#F6D321","#6EB9B0","#CBC26A","#FBAF4F","#E2CDB1","#FFC0B7","#68E1E6","#E1A62D","#9C6EBF"],seriesColors:[[{color:"#F34649",colorStop:"0%"},{color:"#B74143",colorStop:"100%"}],[{color:"#F6D321",colorStop:"0%"},{color:"#F6AE26",colorStop:"100%"}],[{color:"#6EB9B0",colorStop:"0%"},{color:"#3F77BD",colorStop:"100%"}],[{color:"#CBC26A",colorStop:"0%"},{color:"#9AAD21",colorStop:"100%"}],[{color:"#FBAF4F",colorStop:"0%"},{color:"#F07542",colorStop:"100%"}],[{color:"#E2CDB1",colorStop:"0%"},{color:"#AAA089",colorStop:"100%"}],[{color:"#8BC652",colorStop:"0%"},{color:"#6F9E41",colorStop:"100%"}],[{color:"#68E1E6",colorStop:"0%"},{color:"#3D9CBE",colorStop:"100%"}],[{color:"#E1A62D",colorStop:"0%"},{color:"#B66824",colorStop:"100%"}],[{color:"#9C6EBF",colorStop:"0%"}],[{color:"#593F6D",colorStop:"100%"}]]},blueMetro:["#005378","#006691","#007EB5","#0D97D4","#00AEFF","#14B9FF","#54CCFF","#87DBFF","#ADE5FF","#C5EDFF"],blueGradient:{seriesColors:[[{color:"#005277",colorStop:"0%"},{color:"#00304F",colorStop:"100%"}],[{color:"#006590",colorStop:"0%"},{color:"#004068",colorStop:"100%"}],[{color:"#007DB4",colorStop:"0%"},{color:"#00558B",colorStop:"100%"}],[{color:"#0D97D4",colorStop:"0%"},{color:"#057FC7",colorStop:"100%"}],[{color:"#00ADFE",colorStop:"0%"},{color:"#008BE9",colorStop:"100%"}],[{color:"#14B8FE",colorStop:"0%"},{color:"#0798EB",colorStop:"100%"}],[{color:"#53CBFF",colorStop:"0%"},{color:"#35AFEB",colorStop:"100%"}],[{color:"#86DAFF",colorStop:"0%"},{color:"#64C0EC",colorStop:"100%"}],[{color:"#ACE5FF",colorStop:"0%"},{color:"#8DCEED",colorStop:"100%"}],[{color:"#C4ECFF",colorStop:"0%"}],[{color:"#A3D1E6",colorStop:"100%"}]],borderColors:["#005277","#006590","#007DB4","#0D97D4","#00ADFE","#14B8FE","#53CBFF","#86DAFF","#ACE5FF","#C4ECFF"]},greenMetro:["#496612","#597B15","#709A1B","#87B62A","#9AD926","#A6DC37","#BCE654","#C8E780","#D5EFA5","#E2F3BE"],greenGradient:{seriesColors:[[{color:"#5C7F16",colorStop:"0%"},{color:"#384C08",colorStop:"100%"}],[{color:"#6A9319",colorStop:"0%"},{color:"#486009",colorStop:"100%"}],[{color:"#739D1C",colorStop:"0%"},{color:"#57760B",colorStop:"100%"}],[{color:"#90B546",colorStop:"0%"},{color:"#6E9215",colorStop:"100%"}],[{color:"#9AD826",colorStop:"0%"},{color:"#75A010",colorStop:"100%"}],[{color:"#A5DB36",colorStop:"0%"},{color:"#8EB91D",colorStop:"100%"}],[{color:"#BBE554",colorStop:"0%"},{color:"#A4C849",colorStop:"100%"}],[{color:"#C8E780",colorStop:"0%"},{color:"#B4D072",colorStop:"100%"}],[{color:"#D4EEA5",colorStop:"0%"},{color:"#BFD593",colorStop:"100%"}],[{color:"#E1F2BD",colorStop:"0%"}],[{color:"#C8D7A8",colorStop:"100%"}]],borderColors:["#5C7F16","#6A9319","#739D1C","#90B546","#9AD826","#A5DB36","#BBE554","#C8E780","#D4EEA5","#E1F2BD"]},sandleMetro:["#6C450C","#82520D","#A36812","#C07F1F","#E69719","#E89A2B","#EEB564","#F3CB93","#F7DEB4","#F9E6CA"],sandleGradient:{seriesColors:[[{color:"#7F602F",colorStop:"0%"},{color:"#512D04",colorStop:"100%"}],[{color:"#986827",colorStop:"0%"},{color:"#673803",colorStop:"100%"}],[{color:"#A16C1F",colorStop:"0%"},{color:"#8A4B05",colorStop:"100%"}],[{color:"#BF812A",colorStop:"0%"},{color:"#AD630D",colorStop:"100%"}],[{color:"#E49519",colorStop:"0%"},{color:"#B86607",colorStop:"100%"}],[{color:"#E7992A",colorStop:"0%"},{color:"#D7780D",colorStop:"100%"}],[{color:"#EDB463",colorStop:"0%"},{color:"#D98F31",colorStop:"100%"}],[{color:"#F2CA92",colorStop:"0%"},{color:"#DAAC6F",colorStop:"100%"}],[{color:"#F6DDB3",colorStop:"0%"},{color:"#DABE8F",colorStop:"100%"}],[{color:"#F8E5C9",colorStop:"0%"}],[{color:"#DDBE92",colorStop:"100%"}]],borderColors:["#7F602F","#986827","#A16C1F","#BF812A","#E49519","#E7992A","#EDB463","#F2CA92","#F6DDB3","#F8E5C9"]}};ej.EjSvgRender.themes={flatlight:{highlightColor:"black",background:"transparent",legend:{font:{color:"#282828"},title:{font:{color:"#282828"}}},title:{font:{color:"#565656"},subTitle:{font:{color:"#565656"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",borderWidth:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#565656"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultMetro,colors:ej.EjSvgRender.seriesPalette.defaultMetro},flatdark:{highlightColor:"white",background:"#111111",legend:{font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}}},title:{font:{color:"#C9C9C9"},subTitle:{font:{color:"#C9C9C9"}}},primaryXAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryX:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},primaryYAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryY:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:0,ry:0,fill:"#B5B5B5",border:{color:"#B5B5B5",width:1},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#C9C9C9"}}},errorBar:{fill:"#ffffff",cap:{fill:"#ffffff"}},connectorLine:{color:"#C9C9C9"}},crosshair:{line:{width:1,color:"White"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultMetro,colors:ej.EjSvgRender.seriesPalette.defaultMetro},gradientlight:{highlightColor:"black",background:"transparent",legend:{font:{color:"#282828"},title:{font:{color:"#282828"}}},title:{font:{color:"#565656"},subTitle:{font:{color:"#565656"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#282828",axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},crosshairLabel:{rx:3,ry:3,fill:"#3D3D3D",border:{color:"#3D3D3D",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#565656"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.defaultGradient.seriesColors},gradientdark:{highlightColor:"white",background:"#111111",legend:{font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}}},title:{font:{color:"#C9C9C9"},subTitle:{font:{color:"#C9C9C9"}}},primaryXAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryX:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},primaryYAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryY:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#C9C9C9",axisLine:{color:"#AAAAAA"},font:{color:"#C9C9C9"},title:{font:{color:"#C9C9C9"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#C9C9C9"}}},errorBar:{fill:"#ffffff",cap:{fill:"#ffffff"}},connectorLine:{color:"#C9C9C9"}},crosshair:{line:{width:1,color:"White"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.defaultGradient.seriesColors},highcontrast01:{highlightColor:"white",background:"#111111",legend:{font:{color:"#ffffff"},title:{font:{color:"#ffffff"}}},title:{font:{color:"#ffffff"},subTitle:{font:{color:"#ffffff"}}},primaryXAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#ffffff",axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryX:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},primaryYAxis:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},labelBorder:{color:"#AAAAAA"},multiLevelLabelsColor:"#AAAAAA",multiLevelLabelsFontColor:"#ffffff",axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},secondaryY:{majorGridLines:{color:"#333333"},majorTickLines:{color:"#AAAAAA"},minorGridLines:{color:"#333333"},minorTickLines:{color:"#AAAAAA"},axisLine:{color:"#AAAAAA"},font:{color:"#ffffff"},title:{font:{color:"#ffffff"}},crosshairLabel:{rx:3,ry:3,fill:"#B5B5B5",border:{color:"#B5B5B5",width:2},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#444444"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#ffffff"}}},errorBar:{fill:"#ffffff",cap:{fill:"#ffffff"}},connectorLine:{color:"#C9C9C9"}},crosshair:{line:{width:1,color:"White"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultHighContrast,colors:ej.EjSvgRender.seriesPalette.defaultHighContrast},material:{highlightColor:"black",background:"transparent",legend:{font:{color:"#333333"},title:{font:{color:"#333333"}}},title:{font:{color:"#333333"},subTitle:{font:{color:"#333333"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",borderWidth:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#333333"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultMaterial,colors:ej.EjSvgRender.seriesPalette.defaultMaterial},office365:{highlightColor:"black",background:"transparent",legend:{font:{color:"#333333"},title:{font:{color:"#333333"}}},title:{font:{color:"#333333"},subTitle:{font:{color:"#333333"}}},primaryXAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryX:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},primaryYAxis:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},labelBorder:{color:"#8E8E8E"},multiLevelLabelsColor:"#8E8E8E",multiLevelLabelsFontColor:"#333333",axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",borderWidth:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},secondaryY:{majorGridLines:{color:"#DFDFDF"},majorTickLines:{color:"#8E8E8E"},minorGridLines:{color:"#DFDFDF"},minorTickLines:{color:"#8E8E8E"},axisLine:{color:"#8E8E8E"},font:{color:"#333333"},title:{font:{color:"#333333"}},crosshairLabel:{rx:0,ry:0,border:{color:"#3D3D3D",width:1},fill:"#3D3D3D",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"13px",fontWeight:"regular",opacity:1,color:"#DBDBDB"}}},commonSeriesOptions:{marker:{dataLabel:{font:{color:"#333333"}}},errorBar:{fill:"#000000",cap:{fill:"#000000"}},connectorLine:{color:"#565656"}},crosshair:{line:{width:1,color:"Black"}},seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.defaultOffice,colors:ej.EjSvgRender.seriesPalette.defaultOffice}};n.extend(ej.EjSvgRender.themes,{azure:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueMetro,colors:ej.EjSvgRender.seriesPalette.blueMetro},azuredark:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueMetro,colors:ej.EjSvgRender.seriesPalette.blueMetro},"gradient-azure":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.blueGradient.seriesColors},"gradient-azuredark":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.blueGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.blueGradient.seriesColors},lime:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenMetro,colors:ej.EjSvgRender.seriesPalette.greenMetro},limedark:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenMetro,colors:ej.EjSvgRender.seriesPalette.greenMetro},"gradient-lime":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.greenGradient.seriesColors},"gradient-limedark":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.greenGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.greenGradient.seriesColors},saffron:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleMetro,colors:ej.EjSvgRender.seriesPalette.sandleMetro},saffrondark:{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleMetro,colors:ej.EjSvgRender.seriesPalette.sandleMetro},"gradient-saffron":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.sandleGradient.seriesColors},"gradient-saffrondark":{seriesBorderDefaultColors:ej.EjSvgRender.seriesPalette.sandleGradient.borderColors,colors:ej.EjSvgRender.seriesPalette.sandleGradient.seriesColors}})}(jQuery);ej.axisTypes={};ej.EjAxisRenderer=function(){};_sideBySeriesPadding=function(n,t,i,r){for(var u,f,o=ej.DataManager(n.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),s=!1,h=o.length,c=r.orientation.toLowerCase(),e=0;e<h;e++)if(u=o[e].type.toLowerCase(),u.indexOf("column")!=-1||u.indexOf("bar")!=-1||u.indexOf("waterfall")!=-1||u=="candle"||u.indexOf("hilo")!=-1||u.indexOf("box")!=-1){s=!0;break}return n.model.AreaType!="polaraxes"&&s?(r.m_minPointsDelta=undefined,f=ej.EjSvgRender.utils.getMinPointsDelta(r,n,t)*.5,t=t-f,i=i+f>Number.MAX_VALUE?Number.MAX_VALUE:i+f,r.padding=f):r.padding=0,{startPadding:t,endPadding:i}};ej.EjStripline=function(n){this.chart=n},function(n){function t(t,i){var r=function(){};return r.prototype=new t,n.extend(r.prototype,i),r}var i,r,u,f,e;ej.EjAxisRenderer.prototype={_seriesMinMax:function(t,i,r,u,f){var st=i.orientation.toLowerCase(),pt=r.length,ht,w,e,g,nt,et,ot,c,s,k,d,bt,kt,l,dt,vt,gt,yt,tt;if(f.seriesCollection=ej.util.isNullOrUndefined(f.seriesCollection)?{}:f.seriesCollection,pt>0&&t.model._hasSeriesPoints&&r[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){var ct,a,lt,v,ni={maxX:null,minX:null},ti={maxY:null,minY:null},p=ni.maxX,y=ni.minX,h=ti.maxY,o=ti.minY,at,it,rt,ut;for(e=0;e<pt;e++){if(at=r[e].visibility.toLowerCase(),it=r[e].points.length,ht=0,at==="visible")for(r[e]._visiblePoints=[],c=0;c<it;c++)w=r[e].points[c],w.x!=null&&w.x!=undefined&&(w.y!=null&&w.y!=undefined||w.showIntermediateSum||w.showTotalSum||w.isEmpty==!1)&&(r[e]._visiblePoints[ht]=w,r[e]._visiblePoints[ht].actualIndex=c,ht++);i.maxPointLength=it}for(e=0;e<pt;e++)if(rt=r[e]._visiblePoints.length,g=r[e],rt>0&&(at=r[e].visibility.toLowerCase(),it=r[e].points.length,at==="visible"&&it>0))if(st=="horizontal"&&!t.model.requireInvertedAxes||st=="vertical"&&t.model.requireInvertedAxes){for(lt=ct=r[e]._visiblePoints[0].xValue,c=0;c<rt;c++)s=r[e]._visiblePoints[c].xValue,lt>s&&(lt=s),ct<s&&(ct=s);r[e].minX=lt;r[e].maxX=ct;(y===null||y===undefined)&&rt>0&&(p=r[e].maxX,y=r[e].minX);y>r[e].minX&&(y=r[e].minX);p<r[e].maxX&&(p=r[e].maxX)}else{var ii=g.type.toLowerCase().indexOf("spline")!=-1,ft,wt,ri,ui=0,b=r[e]._visiblePoints;for(ii&&(nt=g._name=g.name||"series"+e,f.seriesCollection[nt]={},b=ej.ejSplineSeries.prototype._isVisiblePoints(g),wt=f.seriesCollection[nt].naturalSpline=ej.ejSplineSeries.prototype.naturalSpline(b),f.seriesCollection[nt].controlPoints=[],ri=ej.ejSplineSeries.prototype.getBezierControlPoints),v=a=b[0].YValues[0],c=0;c<b.length;c++)if(s=b[c],r[e]._hiloTypes)for(k=0;k<2;k++)a>s.YValues[k]&&(a=s.YValues[k]),v<s.YValues[k]&&(v=s.YValues[k]);else if(g.type.toLowerCase()=="boxandwhisker"){for(et=b[c].YValues[0][0],ot=b[c].YValues[0][0],d=0;d<s.YValues[0].length;d++)et>s.YValues[0][d]&&(et=s.YValues[0][d]),ot<s.YValues[0][d]&&(ot=s.YValues[0][d]);a=et>a?a:et;v=ot<v?v:ot}else ii?c!=0&&s.visible&&b[c-1].visible?(f.seriesCollection[nt].controlPoints.push(ri(b[c-1],s,wt[c-1],wt[c],0)),ft=f.seriesCollection[nt].controlPoints[ui++],a=Math.min(a,s.YValues[0],ft.controlPoint1.YValues[0],ft.controlPoint2.YValues[0]),v=Math.max(v,s.YValues[0],ft.controlPoint1.YValues[0],ft.controlPoint2.YValues[0])):(a=Math.min(a,s.YValues[0]||null),v=Math.max(v,s.YValues[0]||null)):(a>s.YValues[0]&&(a=s.YValues[0]),v<s.YValues[0]&&(v=s.YValues[0]));r[e].minY=a;r[e].maxY=v;(o===null||o===undefined)&&rt>0&&(h=r[e].maxY,o=r[e].minY);o>r[e].minY&&(o=r[e].minY);h<r[e].maxY&&(h=r[e].maxY);ut=r[e].type;(ut=="column"||ut=="bar")&&i.startFromZero&&(o=o<0?o:0)}st=="horizontal"&&!t.model.requireInvertedAxes||st=="vertical"&&t.model.requireInvertedAxes?(this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[i.name]&&(l=this.chartObj.model.indicatorRange[i.name],(o>l.min||o==null)&&(o=l.min),(h<l.max||h==null)&&(h=l.max)),p==y&&(p+=1),u=="double"?(bt=_sideBySeriesPadding(t,y,p,i),y=bt.startPadding,p=bt.endPadding,deltaX=p-y,i.range=this._getDoubleAutoRange(i,y,p,deltaX)):i.range=this._getLogAutoRange(i,y,p,p-y)):(this.chartObj.model.stackedValue[i.name]&&(l=this.chartObj.model.stackedValue[i.name],kt=!0,o>l.min&&(o=l.min),h<l.max&&(h=l.max)),this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[i.name]&&(l=this.chartObj.model.indicatorRange[i.name],(o>l.min||o==null)&&(o=l.min),(h<l.max||h==null)&&(h=l.max)),h==o&&(h<0?h=0:h<=1&&h>0?o=0:(o=0,h+=1)),ut!="column"&&ut!="bar"||i.startFromZero||(dt=i.range&&i.range.max||h,vt=i.range&&i.range.interval||this.calculateNumericNiceInterval(dt-o,i,null,dt),h+=vt,o-vt<0&&o>0||kt?o=0:o-=vt),gt=h-o,kt=!1,i.range=u=="double"?this._getDoubleAutoRange(i,o,h,gt):this._getLogAutoRange(i,o,h,gt))}else i.setRange?(min=i.range.min==null||i.range.min==undefined?0:i.range.min,max=i.range.max==null||i.range.max==undefined?5:i.range.max,delta=max-min,i.range=this._getDoubleAutoRange(i,min,max,delta)):i.range={min:0,max:5,interval:1,Delta:4};yt=n.extend({},ej.EjSvgRender.commonChartEventArgs);yt.data={range:i.range,axis:i};this.chartObj._trigger("axesRangeCalculate",yt);tt=yt.data.range;i.range={min:tt.min,max:tt.max,interval:tt.interval,delta:tt.max-tt.min}},_calculateTrendLineRange:function(n,t,i){for(var f,u,e,r,c,s,h,l=i.length,o=0;o<l;o++)if(u=i[o],e=u.trendlines,n.model.AreaType=="cartesianaxes"&&(t.name==u._xAxisName||t.name==u._yAxisName))for(s=e.length,f=0;f<s;f++)r=e[f],r.visibility.toLowerCase()==="visible"&&(t.name==u._xAxisName?(h=r.type.toLowerCase(),options=new ej.trendlineTypes[h],options.calculateTrendLineSegment(u,r,t,n)):t.name==u._yAxisName&&!t.setRange&&r.points&&r.points.length>1&&(c=r.points.length-1,t.range.min=t.range.min>r.minY?r.minY:t.range.min,t.range.max=t.range.max<r.maxY?r.maxY:t.range.max));return!1},AlignRangeStart:function(n,t,i){var r=new Date(n),u,f,e,o,s,h,c;return i.toLowerCase()=="days"?(u=Math.floor(Math.floor(n.getDate()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),u,0,0,0)):i.toLowerCase()=="hours"?(f=Math.floor(Math.floor(n.getHours()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),f,0,0)):i.toLowerCase()=="milliseconds"?(e=Math.floor(Math.floor(n.getMilliseconds()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),e)):i.toLowerCase()=="seconds"?(o=Math.floor(Math.floor(n.getSeconds()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),o,0)):i.toLowerCase()=="minutes"?(s=Math.floor(Math.floor(n.getMinutes()/t)*t),r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),s,0,0)):i.toLowerCase()=="months"?(h=Math.floor(Math.floor(n.getMonth()/t)*t),r=new Date(n.getFullYear(),h,n.getDate(),0,0,0)):i.toLowerCase()=="years"&&(c=Math.floor(Math.floor(n.getFullYear()/t)*t),r=new Date(c,n.getMonth(),n.getDate(),0,0,0)),r},_increaseDateTimeInterval:function(n,t,i){var r=new Date(n);return i.toLowerCase()=="days"?r.setDate(n.getDate()+t):i.toLowerCase()=="hours"?r.setHours(n.getHours()+t):i.toLowerCase()=="milliseconds"?r.setMilliseconds(n.getMilliseconds()+t):i.toLowerCase()=="seconds"?r.setSeconds(n.getSeconds()+t):i.toLowerCase()=="minutes"?r.setMinutes(n.getMinutes()+t):i.toLowerCase()=="months"?r.setMonth(n.getMonth()+t):i.toLowerCase()=="years"&&r.setYear(n.getFullYear()+t),r},_calculatePadding:function(n){var t=typeof n.range.min=="string"&&!isNaN(Date.parse(n.range.min))?Date.parse(n.range.min):n.range.min.getTime(),i=typeof n.range.max=="string"&&!isNaN(Date.parse(n.range.max))?Date.parse(n.range.max):n.range.max.getTime(),d=this._increaseDateTimeInterval(new Date(t),n.range.interval,n._intervalType).getTime()-t,r=n.rangePadding.toLowerCase(),b,h,c,l,f,a,v,e,y,u,k,o,p,s,w;if(!this.chartObj.zoomed&&!n.setRange)if(t=new Date(t),i=new Date(i),b=n._intervalType.toLowerCase(),n.rangePadding.toLowerCase()=="none")t=t.getTime(),i=i.getTime();else if(r=="additional"||r=="round")switch(b){case"years":h=t.getFullYear();c=i.getFullYear();n.rangePadding.toLowerCase()=="additional"?(t=new Date(h-n.range.interval,1,1,0,0,0).getTime(),i=new Date(c+n.range.interval,1,1,0,0,0).getTime()):(t=new Date(h,0,0,0,0,0).getTime(),i=new Date(c,11,30,23,59,59).getTime());break;case"months":l=t.getMonth();f=i.getMonth();r=="round"?(t=new Date(t.getFullYear(),l,0,0,0,0).getTime(),i=new Date(i.getFullYear(),f,new Date(i.getFullYear(),i.getMonth(),0).getDate(),23,59,59).getTime()):(t=new Date(t.getFullYear(),l+-n.range.interval,1,0,0,0).getTime(),i=new Date(i.getFullYear(),f+n.range.interval,f==2?28:30,0,0,0).getTime());break;case"days":a=t.getDate();v=i.getDate();r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),a,0,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),v,23,59,59).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),a+-n.range.interval,0,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),v+n.range.interval,0,0,0).getTime());break;case"hours":e=t.getHours()/n.range.interval*n.range.interval;y=i.getHours()+(t.getHours()-e);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),e,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),y,59,59).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),e+-n.range.interval,0,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),y+n.range.interval,0,0).getTime());break;case"minutes":u=t.getMinutes()/n.range.interval*n.range.interval;k=i.getMinutes()+(t.getMinutes()-u);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHour(),u,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHour(),k,59).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),u+-n.range.interval,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),u+n.range.interval,0).getTime());break;case"seconds":o=t.getSeconds()/n.range.interval*n.range.interval;p=i.getSeconds()+(t.getSeconds()-o);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),o,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHour(),i.getMinutes(),p,0).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),o+-n.range.interval,0).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),i.getMinutes(),p+n.range.interval,0).getTime());break;case"milliseconds":s=t.getMilliseconds()/n.range.interval*n.range.interval;w=i.getMilliseconds()+(t.getMilliseconds()-s);r=="round"?(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),s).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),i.getMinutes(),i.getSeconds(),w).getTime()):(t=new Date(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),s+-n.range.interval).getTime(),i=new Date(i.getFullYear(),i.getMonth(),i.getDay(),i.getHours(),i.getMinutes(),i.getSeconds(),w+n.range.interval).getTime())}n.actualRange.interval=d;n.actualRange.min=t;n.actualRange.max=i;n._interval=n.range.interval;n.actualRange.delta=n.actualRange.max-n.actualRange.min;n.range.min=new Date(t);n.range.max=new Date(i);this._calculateVisibleRange(n)},_calculateVisibleRange:function(t,i,r){var e,u,f,o,s;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);o=new Date(u);s=new Date(f);u==f&&(o=new Date(Date.parse(o)-2592e6),s=new Date(Date.parse(s)+2592e6));var c=Math.min(o.getTime(),s.getTime()),l=Math.max(o.getTime(),s.getTime()),h=t.enableAutoIntervalOnZooming?this.calculateDateTimeNiceInterval(t,o,s):{interval:t._interval,intervalType:t._intervalType},a=this._increaseDateTimeInterval(o,h.interval,h.intervalType).getTime()-c;if(r)return{min:c,max:l,interval:a};t._intervalType=h.intervalType;t.visibleRange.min=c;t.visibleRange.max=l;t.visibleRange.interval=a;t.visibleRange.delta=Math.abs(t.visibleRange.max-t.visibleRange.min);t._interval=h.interval}},_calculateAxisLabels:function(t){for(var u,f=t.enableAutoIntervalOnZooming?t.visibleRange.min:t.actualRange.min,r,i=this.chartObj.zoomed||t.zoomed||!t.setRange?this.AlignRangeStart(new Date(f),t._interval,t._intervalType).getTime():t.visibleRange.min;i<=t.visibleRange.max;)i>=t.visibleRange.min&&i<=t.visibleRange.max&&(u=ej.format(new Date(i),t.labelFormat?t.labelFormat:ej.EjSvgRender.utils._dateTimeLabelFormat(t._intervalType),this.chartObj.model.locale),r=n.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={label:{Text:u,Value:i},axis:t},this.chartObj._trigger("axesLabelRendering",r),t.visibleLabels.push({Value:i,Text:r.data.label.Text})),i=this._increaseDateTimeInterval(new Date(i),t._interval,t._intervalType).getTime(),t.visibleLabels[t.visibleLabels.length-1]=t.visibleLabels[t.visibleLabels.length-1];t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},calculateDateTimeNiceInterval:function(n,t,i){var u=Math.abs((t.getTime()-i.getTime())/864e5),r=this.calculateNumericNiceInterval(u/365,n,"years"),f,e,o,s;return r>=1?{interval:r,intervalType:"Years"}:(r=this.calculateNumericNiceInterval(u/30,n,"months"),r>=1)?{interval:r,intervalType:"Months"}:(r=this.calculateNumericNiceInterval(u,n,"days"),r>=1)?{interval:r,intervalType:"Days"}:(f=u*24,r=this.calculateNumericNiceInterval(f,n,"hours"),r>=1)?{interval:r,intervalType:"Hours"}:(e=u*1440,r=this.calculateNumericNiceInterval(e,n,"minutes"),r>=1)?{interval:r,intervalType:"Minutes"}:(o=u*86400,r=this.calculateNumericNiceInterval(o,n,"seconds"),r>=1)?{interval:r,intervalType:"Seconds"}:(s=u*864e5,r=this.calculateNumericNiceInterval(s,n,"milliseconds"),r>=1?{interval:r,intervalType:"Milliseconds"}:void 0)},calculateNumericNiceInterval:function(n,t,i,r){var o=this.GetActualDesiredIntervalsCount(t,t.length),u=n/o,f,e;if(t._valueType=="double"&&t.desiredIntervals!=null)return u;var h=Math.pow(10,Math.floor(ej.EjSvgRender.utils._logBase(u,10))),s=[10,5,2,1],c=r||t.range&&t.range.max;for(f=0;f<s.length;f++){if(e=h*s[f],o<n/e)return t._valueType=="datetime"?!ej.util.isNullOrUndefined(t.intervalType)&&t.intervalType.toLowerCase()==i?Math.ceil(u):u:ej.util.isNullOrUndefined(t.range)||ej.util.isNullOrUndefined(t.range.max)?u:u>c?e:u;u=e}return u},GetActualDesiredIntervalsCount:function(n,t){if(ej.util.isNullOrUndefined(n.desiredIntervals)){var i=(n.orientation.toLowerCase()=="horizontal"?.533:1)*n.maximumLabels;return Math.max(t*(i/100),1)}return n.desiredIntervals},_calculateRange:function(t,i){var o,c,y,p,s,r,l,a,u,f,v,b,e,k,w,h;if(!this.chartObj.zoomed){if(o=new Date,i.length>0&&this.chartObj.model._hasSeriesPoints&&i[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){for(r={maxX:null,minX:null},l={maxY:null,minY:null},u=0;u<i.length;u++){if(a=i[u].points.length,a>0&&i[u].visibility.toLowerCase()==="visible"&&i[u].points.length>0){for(s=c=i[u].points[0].xValue,p=y=i[u].points[0].YValues[0],f=0;f<a;f++)s!=null&&s!=undefined?(s>i[u].points[f].xValue&&(s=i[u].points[f].xValue),c<i[u].points[f].xValue&&(c=i[u].points[f].xValue)):s=c=i[u].points[f+1].xValue,y>i[u].points[f].YValues[0]&&(y=i[u].points[f].YValues[0]),p<i[u].points[f].YValues[0]&&(p=i[u].points[f].YValues[0]);i[u].minX=s;i[u].maxX=c;i[u].minY=y;i[u].maxY=p;(!t.maxPointLength||t.maxPointLength<a)&&(t.maxPointLength=a)}(r.minX=r.minX==null&&typeof i[u].minX!="number"?i[u].minX:r.minX)>i[u].minX&&(r.minX=typeof i[u].minX!="number"?i[u].minX:r.minX);(r.maxX=r.maxX==null&&typeof i[u].maxX!="number"?i[u].maxX:r.maxX)<i[u].maxX&&(r.maxX=typeof i[u].maxX!="number"?i[u].maxX:r.maxX);l.minY>i[u].minY&&(l.minY=i[u].minY);l.maxY<i[u].maxY&&(l.maxY=i[u].maxY)}this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[t.name]&&(v=this.chartObj.model.indicatorRange[t.name],(r.minX>new Date(v.min)||r.minX==null)&&(r.minX=new Date(v.min)),(r.maxX<new Date(v.max)||r.maxX==null)&&(r.maxX=new Date(v.max)));r.minX=r.minX==null?o:r.minX;r.maxX=r.maxX==null?new Date((new Date).setMonth(o.getMonth()+5)):r.maxX;r.minX==r.maxX&&(r.minX=new Date(Date.parse(r.minX)-2592e6),r.maxX=new Date(Date.parse(r.maxX)+2592e6));b=_sideBySeriesPadding(this.chartObj,Date.parse(r.minX),Date.parse(r.maxX),t);r.minX=new Date(b.startPadding);r.maxX=new Date(b.endPadding);e=this.calculateDateTimeNiceInterval(t,r.minX,r.maxX);t._intervalType=t.intervalType?t.intervalType:e.intervalType;t.intervalType=="auto"&&(t._intervalType=t.intervalType=e.intervalType);(t.setAxisInterval==null||t.setAxisInterval==undefined)&&(t.setAxisInterval=t.range&&t.range.interval?!0:!1);t._setInterval&&!this.chartObj._chartResize&&t.range&&t._setInterval!=t.range.interval&&(t._setInterval=null);t.setRange?((t.actual_Range==null||t.actual_Range==undefined)&&(t.range.max||(t.range.max=r.maxX),t.range.min||(t.range.min=r.minX),typeof t.range.min=="string"&&t.range.min.indexOf("/Date(")!=-1&&(t.range.min=new Date(parseInt(t.range.min.substr(6)))),typeof t.range.max=="string"&&t.range.max.indexOf("/Date(")!=-1&&(t.range.max=new Date(parseInt(t.range.max.substr(6)))),new Date(t.range.min).getTime()==new Date(t.range.max).getTime()&&(t.range.max=new Date(Date.parse(t.range.max)+864e5)),e=this.calculateDateTimeNiceInterval(t,new Date(t.range.min),new Date(t.range.max)),t._intervalType=t.intervalType?t.intervalType:e.intervalType,t.setAxisInterval||(t.range.interval=e.interval,t._setInterval=e.interval),t.actual_Range=n.extend(!0,{},t.range),t.setRange=!0),k=t._setInterval?e.interval:t.range.interval||t.actual_Range.interval,t.range={min:t.actual_Range.min,max:t.actual_Range.max,interval:k}):t.range={min:r.minX,max:r.maxX,interval:e.interval}}else t.setRange?(t.range.min=t.range.min===null||t.range.min===undefined?o:t.range.min,t.range.max=t.range.max===null||t.range.max===undefined?new Date((new Date).setMonth(o.getMonth()+5)):t.range.max,t.range.interval=t.range.interval===null||t.range.interval===undefined?1:t.range.interval,t._intervalType="Months"):(t.range={min:o,max:new Date((new Date).setMonth(o.getMonth()+5)),interval:1},t._intervalType="Months");w=n.extend({},ej.EjSvgRender.commonChartEventArgs);w.data={range:t.range,axis:t};this.chartObj._trigger("axesRangeCalculate",w);h=w.data.range;t.range={min:h.min,max:h.max,interval:h.interval,delta:h.max-h.min}}},_calculateRanges:function(n,t,i){this.chartObj=n;this._calculateRange(t,i);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._calculatePadding(t);this._calculateAxisLabels(t)}};i=t(ej.EjAxisRenderer);ej.axisTypes.datetime=i;r=t(ej.EjAxisRenderer,{_calculateRange:function(n,t,i,r){n.zoomed||this._seriesMinMax(n,t,i,"double",r)},_getDoubleAutoRange:function(t,i,r){var e,u,f;return t.setRange?(ej.util.isNullOrUndefined(t.range.max)&&(t.range.max=r),ej.util.isNullOrUndefined(t.range.min)&&(t.range.min=i),t.actual_Range=n.extend(!0,{},t.range),t.setRange=!0):t.range={min:i,max:r},e=t.range.max-t.range.min,u=this.calculateNumericNiceInterval(e,t),ej.EjSvgRender.utils._decimalPlaces(u)>20&&(f=u.toString(),u=parseFloat(f.substring(0,f.indexOf("."))+f.substring(f.indexOf("."),22))),(ej.util.isNullOrUndefined(t.range.interval)||t.range.interval<0)&&(t.range.interval=u),t.range.delta=e,t.range},_calculatePadding:function(n,t,i){var e=i.min,u=i.max,s=t.rangePadding.toLowerCase(),r=i.interval,o,h,f;t.setRange||n.zoomed||(s=="normal"?(o=0,e<0?(e=0,o=i.min+i.min/20,h=r+o%r,.365*r>=h&&(o-=r),o%r<0&&(o=o-r-o%r)):(o=e<5/6*u?0:e-(u-e)/2,o%r>0&&(o-=o%r)),f=u>0?u+(u-e)/20>Number.MAX_VALUE?Number.MAX_VALUE:u+(u-e)/20:u-(u-e)/20,h=r-f%r,.365*r>=h&&(f=f+r>Number.MAX_VALUE?Number.MAX_VALUE:f+r),f%r>0&&(f=f+r-f%r>Number.MAX_VALUE?Number.MAX_VALUE:f+r-f%r),o<=0&&(r=this.calculateNumericNiceInterval(f-o,t),f=Math.ceil(f/r)*r>Number.MAX_VALUE?Number.MAX_VALUE:Math.ceil(f/r)*r),e=t.roundingPlaces?parseFloat(o.toFixed(t.roundingPlaces)):parseFloat(o.toFixed(ej.EjSvgRender.utils._decimalPlaces(r)==0?1:ej.EjSvgRender.utils._decimalPlaces(r))),u=t.roundingPlaces?parseFloat(f.toFixed(t.roundingPlaces)):parseFloat(f.toFixed(ej.EjSvgRender.utils._decimalPlaces(r)==0?1:ej.EjSvgRender.utils._decimalPlaces(r)))):(s=="additional"||s=="round")&&(e=Math.floor(e/r)*r,u=Math.ceil(u/r)*r>Number.MAX_VALUE?Number.MAX_VALUE:Math.ceil(u/r)*r,s=="additional"&&(e-=r,u=u+r>=Number.MAX_VALUE?Number.MAX_VALUE:u+r)));t.actualRange.min=e;t.actualRange.max=u;t.actualRange.interval=r;t.range.min=e;t.range.max=u;t.range.interval=r;t.actualRange.delta=u-e>=Number.MAX_VALUE?u:u-e;this._calculateVisibleRange(t)},_calculateVisibleRange:function(t,i,r){var e,u,f,o,s;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){if(e=t.actualRange,t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor,t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition,t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta),u<e.min&&(f=f+(e.min-u),u=e.min),f>e.max&&(u=u-(f-e.max),f=e.max),o=Math.abs(f-u),s=t.enableAutoIntervalOnZooming?this.calculateNumericNiceInterval(o,t):t.actualRange.interval,r)return{min:Math.min(u,f),max:Math.max(u,f),delta:o,interval:s};t.visibleRange.min=Math.min(u,f);t.visibleRange.max=Math.max(u,f);t.visibleRange.delta=o;t.visibleRange.interval=s;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateAxisLabels:function(t,i){for(var r,e=i.roundingPlaces,h,l,s,f,c=this.chartObj.model.locale,v=i.labelFormat,o,a=20,u=t.zoomed||i.zoomed||i.padding?i.visibleRange.min-i.visibleRange.min%i.visibleRange.interval:i.visibleRange.min;u<=i.visibleRange.max;u+=i.visibleRange.interval)ej.EjSvgRender.utils._inside(u,i.visibleRange)&&(h=u.toString().split(0).length-1>10?10:20,u=parseFloat(u.toFixed(!e&&e>h?e:h)),l=e?u:parseFloat(u.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),f=e?parseFloat(u.toFixed(e)):parseFloat(u.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),r=i.labelFormat,r?r.match("{value}")!=null?f=r.replace("{value}",f):(r.indexOf("e")==0||r.indexOf("E")==0)&&r.indexOf("ej.format")==-1?(o=r.match(/(\d+)/g),o=o==null?6:o>a?a:o,f=f.toExponential(o)):(r.indexOf("ej.format")!=-1&&(r=r.substring(r.indexOf("(")+1,r.indexOf(")"))),f=ej.format(f,r,c)):f=i.isStacked100?f+"%":c?f.toLocaleString(c):f,s=n.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={label:{Text:f,Value:u},axis:i},t._trigger("axesLabelRendering",s),i.visibleLabels.push({Value:l,Text:s.data.label.Text}));i._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(i,this.chartObj)},_calculateRanges:function(n,t,i,r){this.chartObj=n;this._calculateRange(n,t,i,r);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._calculatePadding(n,t,t.range);t.maximumLabels>0&&this._calculateAxisLabels(n,t)}});ej.axisTypes.double=r;u=t(ej.EjAxisRenderer,{_getRoundValue:function(n,t,i){return(i?Math.ceil(n/t):Math.floor(n/t))*t},calculateLogNiceInterval:function(n,t){for(var u,e=this.GetActualDesiredIntervalsCount(t,t.length),i=n,o=Math.pow(10,Math.floor(ej.EjSvgRender.utils._logBase(i,10))),f=[10,5,2,1],r=0;r<f.length;r++){if(u=o*f[r],e<n/u)return i;i=u}return i},_getLogAutoRange:function(t,i,r,u){var s=ej.EjSvgRender.utils._logBase(i,t.logBase),o,f,e,h;return s=n.isNumeric(s)?s:i,o=ej.EjSvgRender.utils._logBase(r,t.logBase),o=n.isNumeric(o)?o:r,f=this._getRoundValue(s,1,!1),e=this._getRoundValue(o,1,!0),f==0&&e==0&&(f=ej.EjSvgRender.utils._logBase(r-r/2,t.logBase),e=ej.EjSvgRender.utils._logBase(r+r/2,t.logBase)),u=e-f,h=this.calculateLogNiceInterval(u,t),t.actual_Range={min:f,max:e,interval:h,Delta:u},f=Math.pow(t.logBase,Math.floor(s)),e=Math.pow(t.logBase,Math.ceil(o)),u=e-f,t.setRange?(ej.util.isNullOrUndefined(t.range.interval)&&(t.range.interval=h),ej.util.isNullOrUndefined(t.range.max)&&(t.range.max=e),ej.util.isNullOrUndefined(t.range.min)&&(t.range.min=f),t.actual_Range=n.extend(!0,{},t.range),ej.util.isNullOrUndefined(t.actual_Range.max)||(t.actual_Range.max=ej.EjSvgRender.utils._logBase(t.actual_Range.max,t.logBase),t.actual_Range.max=this._getRoundValue(t.actual_Range.max,1,!0)),ej.util.isNullOrUndefined(t.range.min)||(t.actual_Range.min=ej.EjSvgRender.utils._logBase(t.actual_Range.min,t.logBase),t.actual_Range.min=this._getRoundValue(t.actual_Range.min,1,!1)),t.setRange=!0,t.range):t.range={min:f,max:e,interval:h,Delta:u}},_calculateLogRange:function(n,t,i,r){n.zoomed||this._seriesMinMax(n,t,i,"logarithmic",r)},_calculateLogPadding:function(n,t,i){var r=i.min,u=i.max,f=i.interval;t.actualRange.min=r;t.actualRange.max=u;t.actualRange.interval=f;t.actualRange.delta=u-r;this._calculateVisibleRange(t)},_calculateVisibleRange:function(t,i,r){var e,u,f;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);var s=Math.abs(f-u),o=t.enableAutoIntervalOnZooming?this.calculateLogNiceInterval(s,t):t.visibleRange.interval,h=ej.util.isNullOrUndefined(t.roundingPlaces)?ej.EjSvgRender.utils._decimalPlaces(t.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(t.visibleRange.interval):t.roundingPlaces;if(o=parseFloat(t.visibleRange.interval.toFixed(h)),r)return{min:Math.min(u,f),max:Math.max(u,f),interval:o};t.visibleRange.interval=o;t.visibleRange.min=Math.min(u,f);t.visibleRange.max=Math.max(u,f);t.visibleRange.delta=s;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateAxisLabels:function(t,i){for(var e=i.roundingPlaces,o,u,s,f,r=t.zoomed||i.zoomed?i.visibleRange.min-i.visibleRange.min%i.visibleRange.interval:i.visibleRange.min;r<=i.visibleRange.max;r+=i.visibleRange.interval)ej.EjSvgRender.utils._inside(r,i.visibleRange)&&(o=i.labelFormat?i.labelFormat.match("{value}"):null,u=Math.pow(i.logBase,r),tempPlace=u.toString().split(0).length-1>10?10:20,u=parseFloat(u.toFixed(!e&&e>tempPlace?e:tempPlace)),s=i.labelFormat?o!=null?i.labelFormat.replace("{value}",u):ej.format(u,i.labelFormat,t.model.locale):u,f=n.extend({},ej.EjSvgRender.commonChartEventArgs),f.data={label:{Text:s,Value:r},axis:i},t._trigger("axesLabelRendering",f),i.visibleLabels.push({Value:r,Text:f.data.label.Text}));i._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(i,this.chartObj)},_calculateRanges:function(n,t,i,r){this.chartObj=n;this._calculateLogRange(n,t,i,r);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._calculateLogPadding(n,t,t.actual_Range);this._calculateAxisLabels(n,t)}});ej.axisTypes.logarithmic=u;f=t(ej.EjAxisRenderer,{_calculateCategoryRange:function(t,i){var b=this.chartObj.model.legendCollapsed==undefined?!this.chartObj.zoomed:this.chartObj.model.legendCollapsed,e,h,r,o,l,v;if(!this.chartObj.model.excludeDataUpdate||b){var u={maxX:null,minX:0},f=[],s,a,c,y,p=t.isIndexed,w=this.chartObj.model.locale;if(i.length>0&&this.chartObj.model._hasSeriesPoints&&i[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){for(e=0;e<i.length;e++){for(pointsLength=i[e].points.length,h=0;h<pointsLength;h++)s=i[e]._xAxisValueType=="date"?ej.format(new Date(i[e].points[h].x),ej.util.isNullOrUndefined(t.labelFormat)?"dd/MM/yyyy":t.labelFormat,w):i[e].points[h].x,p?f[h]=e==0?s:f[h]+", "+s:(y=n.inArray(s,f),y<0&&f.push(s));(!t.maxPointLength||t.maxPointLength<pointsLength)&&(t.maxPointLength=pointsLength)}for(r=0;r<i.length;r++){for(i[r]._pointCollection=[],o=0;o<i[r].points.length;o++)i[r]._pointCollection.push(i[r].points[o].x),s=i[r]._xAxisValueType=="date"?ej.format(new Date(i[r].points[o].x),ej.util.isNullOrUndefined(t.labelFormat)?"dd/MM/yyyy":t.labelFormat,w):i[r].points[o].x,i[r].points[o].xValue=p?o:n.inArray(s,f);i[r].minX=0;i[r].maxX=i[r]._xAxisValueType=="date"?i[r]._pointCollection.length-1:f.length-1;r==0&&(u.maxX=i[r].maxX,t.labels=i[r]._xAxisValueType=="date"?i[r]._pointCollection:f,t._categoryValueType=i[r]._xAxisValueType);u.maxX<i[r].maxX&&(u.maxX=i[r].maxX,t.labels=[],t.labels=f)}this.chartObj.model.indicatorRange&&this.chartObj.model.indicatorRange[t.name]&&(l=this.chartObj.model.indicatorRange[t.name],(u.minX>l.min||u.minX==null)&&(u.minX=l.min),(u.maxX<l.max||u.maxX==null)&&(u.maxX=l.max));u.minX==u.maxX&&t.labelPlacement&&t.labelPlacement.toLowerCase()=="onticks"&&(u.maxX+=1);c=u.maxX-u.minX;a=t.setRange&&t.range.interval?Math.ceil(t.range.interval):this._calculateActualInterval(c,t);t.range={min:u.minX,max:u.maxX,interval:a,Delta:c}}else v=t.labels.length,v>0?(c=v-1,a=this._calculateActualInterval(c,t),t.range={min:0,max:v-1,interval:a,Delta:c}):t.range||(t.range={min:0,max:6,interval:1,Delta:6})}},_calculateActualInterval:function(n,t){return t.categoryInterval==null?Math.max(1,Math.floor(n/this.GetActualDesiredIntervalsCount(t,t.length))):t.categoryInterval},_applyRangePadding:function(n){var t,i;this.chartObj.zoomed||this.chartObj._scrollBarEnabled||(t=0,this.chartObj.model.AreaType!=="polaraxes"&&(t=n.labelPlacement===null||n.labelPlacement===undefined||n.labelPlacement===""?-.5:n.labelPlacement.toLowerCase()=="betweenticks"?-.5:0),t<0?(n.range.min=n.range.min+t,n.range.max=n.range.max-t,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range):(i=_sideBySeriesPadding(this.chartObj,n.range.min,n.range.max,n),n.range.min=i.startPadding,n.range.max=i.endPadding,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range));this._calculateVisibleRange(n)},_calculateVisibleRange:function(t,i,r){var e,u,f,o;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);var o=Math.abs(f-u),s=this._calculateActualInterval(o,t),h=Math.min(u,f),c=Math.max(u,f);if(r)return{min:h,max:c,interval:s};o=Math.abs(f-u);t.visibleRange.interval=s;t.visibleRange.min=h;t.visibleRange.max=c;t.visibleRange.delta=o;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateAxisLabels:function(t){for(var f=t.visibleRange.interval,i=t.visibleRange.min-t.visibleRange.min%t.range.interval,u,r;i<=t.visibleRange.max;i+=f)ej.EjSvgRender.utils._inside(i,t.visibleRange)&&(u=Math.round(i),t.visibleLabels.push({Value:u,Text:ej.EjSvgRender.utils._getLabelContent(u,t,this.chartObj.model.locale)}),r=n.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={label:t.visibleLabels[t.visibleLabels.length-1],axis:t},this.chartObj._trigger("axesLabelRendering",r),t.visibleLabels[t.visibleLabels.length-1]=r.data.label);t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},_calculateRanges:function(n,t,i){this.chartObj=n;this._calculateCategoryRange(t,i);n.model._drawTrendline&&this._calculateTrendLineRange(n,t,i);this._applyRangePadding(t);this._calculateAxisLabels(t)}});ej.axisTypes.category=f;e=t(ej.EjAxisRenderer,{_calculateDateTimeCategoryRange:function(t,i){for(var v={minX:0,MaxX:null},w=[],a=[],f,tt,nt,it,d,c,s,rt=[],e,o,h,l,g,r,p,b,ut,k,ft,y,u=0;u<i.length;u++){for(i[u]._pointCollection=[],s=[],i[u]._points=[],i[u]._xPoints=[],i[u]._yPoints=[],g=i[u].points.length,b=0;b<g;b++)s.push(new Date(i[u].points[b].x).getTime()),i[u]._xPoints.push(new Date(i[u].points[b].x).getTime()),i[u]._yPoints.push(i[u].points[b].y);for(s.sort(function(n,t){return n-t}),ej.isNullOrUndefined(t.intervalType)&&(d=this.calculateDateTimeNiceInterval(t,new Date(Math.min.apply(null,s)),new Date(Math.max.apply(null,s))),t.intervalType=d.intervalType.toLowerCase()),r=0;r<s.length;r++){if(f=new Date(s[r]),i[u]._points.push(f.getTime()),ut=n.inArray(s[r],i[u]._xPoints),i[u].points[r].y=i[u].points[r].YValues[0]=i[u]._yPoints[ut],i[u]._pointCollection.push(new Date(i[u].points[r].x)),u==0)i[u].points[r].xValue=r;else for(k=0;k<=u-1;k++)if(nt=n.inArray(new Date(i[u].points[r].x).getTime(),i[k]._points),nt>=0)i[u].points[r].xValue=nt;else if(k=u){i[u].points[r].xValue=t.maxPointLength-1+(r+1);break}if(tt=u==0?-1:n.inArray(f.getTime(),rt),tt<0){switch(t.intervalType){case"auto":w.push(f.getTime());break;case"years":o=f.getFullYear();break;case"months":l=f.getFullYear();e=f.getMonth();r<=0?o=r+1:(h=new Date(s[r-1]).getFullYear(),o+=l!=h?12-c+e:e-c);c=e;break;case"days":l=f.getMonth();e=f.getDate();r<=0?o=r+1:(h=new Date(s[r-1]).getMonth(),o+=l!=h?new Date(f.getFullYear(),h,0).getDate()-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),1),ft=new Date(f.getFullYear(),h,0).getDate(),o=y>ft?a[a.length-1]+1:o));c=e;break;case"hours":l=f.getDate();e=f.getHours();r<=0?o=r+1:(h=new Date(s[r-1]).getDate(),o+=l!=h?24-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),24),o=y>24?a[a.length-1]+1:o));c=e;break;case"minutes":l=f.getHours();e=f.getMinutes();r<=0?o=r+1:(h=new Date(s[r-1]).getHours(),o+=l!=h?60-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),1440),o=y>60?a[a.length-1]+1:o));c=e;break;case"seconds":l=f.getMinutes();e=f.getSeconds();r<=0?o=r+1:(h=new Date(s[r-1]).getMinutes(),o+=l!=h?60-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),86400),o=y>60?a[a.length-1]+1:o));c=e;break;case"milliseconds":l=f.getSeconds();e=f.getMilliseconds();r<=0?o=r+1:(h=new Date(s[r-1]).getSeconds(),o+=l!=h?1e3-c+e:e-c,l==h&&(y=this._diffDate(f,new Date(s[r-1]),864e5),o=y>1e3?a[a.length-1]+1:o));c=e}t.intervalType!="auto"&&w.push(f.getTime());a.push(o);rt.push(new Date(s[r]).getTime())}}(!t.maxPointLength||t.maxPointLength<g)&&(t.maxPointLength=g)}for(p=0;p<i.length;p++)t.setRange||(t.range={min:null,max:null,interval:null}),ej.isNullOrUndefined(t.m_minPointsDelta)||(t.m_minPointsDelta=undefined),i[p].minX=ej.isNullOrUndefined(t.range.min)?0:t.range.min<v.minX?0:t.range.min,i[p].maxX=ej.isNullOrUndefined(t.range.max)?w.length-1:t.range.max>w.length-1?w.length-1:t.range.max,p==0&&(v.MaxX=i[p].maxX,v.minX=i[p].minX,t.labels=w,t.dateLabels=a,t._categoryValueType="date");v.minX==v.MaxX&&t.labelPlacement.toLowerCase()=="onticks"&&(v.MaxX+=1);it=v.MaxX-v.minX;d=t.range.interval==null||t.range.interval==undefined?1:t.range.interval<1?1:Math.ceil(t.range.interval);t.range={min:v.minX,max:v.MaxX,interval:d,Delta:it}},_diffDate:function(n,t,i){var r,u;return r=864e5,u=Math.abs(n.getTime()-t.getTime())/r,Math.round(u*i)},_calculateAxisLabels:function(t){for(var u=t.visibleRange.interval,y=[],a=0,f,r,i,s,h,p,e,v,c,l,o=t.visibleRange.min-t.visibleRange.min%t.range.interval;o<=t.visibleRange.max;o+=u)if(ej.EjSvgRender.utils._inside(o,t.visibleRange)){if(r=Math.round(o),i=t.dateLabels,t.intervalType!="auto"&&a>0&&u>1)if(r>i.length-1&&(r=i.length-1),s=i[a],h=f+u,v=n.inArray(s,i),c=n.inArray(h,i),v>0&&Math.abs(s-f)==u&&s>f)r=v,f=i[r];else for(e=0;e<e+1;e++)if(h+=e==0?e:1,c=n.inArray(h,i),c>0){r=c;f=i[r];break}a++;ej.util.isNullOrUndefined(i)||(i[i.length-1]-i[r]>=u&&t.visibleRange.max<o+u&&(t.visibleRange.max+=o+u-t.visibleRange.max),p=n.inArray(i[r],y));(p<0||t.intervalType=="auto")&&r<t.labels.length&&(t.intervalType!="auto"&&(f=i[r],y.push(f)),t.visibleLabels.push({Value:r,Text:ej.EjSvgRender.utils._getLabelContent(r,t,this.chartObj.model.locale)}),l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={label:t.visibleLabels[t.visibleLabels.length-1],axis:t},this.chartObj._trigger("axesLabelRendering",l),t.visibleLabels[t.visibleLabels.length-1]=l.data.label)}t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},_calculateActualInterval:function(n,t){return t.categoryInterval==null?Math.max(1,Math.floor(n/this.GetActualDesiredIntervalsCount(t,t.length))):t.categoryInterval},_applyRangePadding:function(n){var t,i;this.chartObj.zoomed||this.chartObj._scrollBarEnabled||(t=0,this.chartObj.model.AreaType!=="polaraxes"&&(t=n.labelPlacement===null||n.labelPlacement===undefined?-.5:n.labelPlacement.toLowerCase()=="betweenticks"?-.5:0),t<0?(n.range.min=n.range.min+t,n.range.max=n.range.max-t,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range):(i=_sideBySeriesPadding(this.chartObj,n.range.min,n.range.max,n),n.range.min=i.startPadding,n.range.max=i.endPadding,n.range.delta=n.range.max-n.range.min,n.actualRange=n.range));this._calculateVisibleRange(n)},_calculateVisibleRange:function(t,i,r){var e,u,f,o;if(this.chartObj=i?i:this.chartObj,t.visibleRange=r?t.visibleRange:n.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&this.chartObj.model.AreaType!="polaraxes"&&!this.chartObj.model.disableZoom){t.zoomFactor=t.zoomFactor>1?1:t.zoomFactor<0?0:t.zoomFactor;t.zoomPosition=t.zoomPosition<0?0:t.zoomPosition>1?1:t.zoomPosition;e=t.actualRange;t.isInversed?(u=t.actualRange.max-t.zoomPosition*t.actualRange.delta,f=u-t.zoomFactor*t.actualRange.delta):(u=t.actualRange.min+t.zoomPosition*t.actualRange.delta,f=u+t.zoomFactor*t.actualRange.delta);u<e.min&&(f=f+(e.min-u),u=e.min);f>e.max&&(u=u-(f-e.max),f=e.max);var o=Math.abs(f-u),s=this._calculateActualInterval(o,t),h=Math.min(u,f),c=Math.max(u,f);if(r)return{min:h,max:c,interval:s};o=Math.abs(f-u);t.visibleRange.interval=s;t.visibleRange.min=h;t.visibleRange.max=c;t.visibleRange.delta=o;t.zoomed=this.chartObj.zoomed===null||this.chartObj.zoomed===undefined?!0:this.chartObj.zoomed}},_calculateRanges:function(n,t,i){this.chartObj=n;this._calculateDateTimeCategoryRange(t,i);this._applyRangePadding(t);this._calculateAxisLabels(t)}});ej.axisTypes.datetimecategory=e;ej.EjAxisRenderer.prototype={_drawGridLines:function(n,t,i){this.model.AreaType=="cartesianaxes"?t.orientation.toLowerCase()=="horizontal"?this._drawXAxisGridLine(n,t,i):this._drawYAxisGridLine(n,t,i):t.orientation.toLowerCase()=="horizontal"&&n==0?(this._drawPolarGridLine(t),this._drawPolarLabels(t)):n==1&&this._drawPolarCircle(t)},_drawAxes:function(n,t){this.model.AreaType=="cartesianaxes"&&(t.visible&&t.orientation.toLowerCase()=="horizontal"&&(this._drawXAxisLabels(n,t),this._drawXTitle(n,t)),t.visible&&t.orientation.toLowerCase()=="vertical"&&(this._drawYAxisLabels(n,t),this._drawYTitle(n,t)))},_getSharpPath:function(n){return n%2==0?0:.5},_drawAxisLine:function(t){var u=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLine"}),h=ej.EjSvgRender.utils._getStringBuilder(),v=this.model.centerX,y=this.model.centerY,p=this.model.centerX,w=this.model.centerY-this.model.Radius,b="M "+v+" "+y+" L "+p+" "+w,f,i;if(t.visible&&t.axisLine.visible&&(f={id:this.svgObject.id+"_YAxisLines",fill:"none","stroke-width":t.axisLine.width,stroke:t.axisLine.color,opacity:t.axisLine.opacity,"stroke-dasharray":t.axisLine.dashArray,d:b},this.svgRenderer.drawPath(f,u),n(u).appendTo(this.gPolarAxisEle)),t.visible&&t.majorTickLines.visible){for(u=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisMajorTicks"}),i=0;i<t.visibleLabels.length;i++){var k=t.visibleLabels[i],c=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,k.Value,this),r={};r.X1=this.model.centerX;r.Y1=this.model.centerY-c;r.X2=r.X1-t.majorTickLines.size;r.Y2=r.Y1;h.append("M "+r.X1+" "+r.Y1+" L "+r.X2+" "+r.Y2+" ")}yMajorTickDir=h.toString();f={id:this.svgObject.id+"_YAxisMajorTicks",fill:"none","stroke-width":t.majorTickLines.width,stroke:t.majorTickLines.color,d:yMajorTickDir};this.svgRenderer.drawPath(f,u);n(u).appendTo(this.gPolarAxisEle)}if(t.visible){var u=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLabels"}),e=t.font,l,a,d=t.visibleLabels.length;for(i=0;i<d;i++){var c=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,t.visibleLabels[i].Value,this),s=t.visibleLabels[i].Text,o=ej.EjSvgRender.utils._measureText(s,null,t.font),g=this.model.centerX-t.majorTickLines.size-this.model.elementSpacing/3,nt=this.model.centerY-c+o.height/5,f={id:this.svgObject.id+"_"+t.name+"_YLabel_"+i,x:g,y:nt,fill:e.color,"font-size":e.size,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,opacity:e.opacity,"text-anchor":"end"};this.svgRenderer.drawText(f,s,u);a=f.x-o.width;l={x:a,y:f.y,width:o.width,height:o.height};t.visibleLabels[i].region={bounds:l,labelText:s}}n(u).appendTo(this.gPolarAxisEle)}},_drawPolarLabels:function(t){var u,i,h,s;if(!t.visible)return 0;var v=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels"}),y=this.model.Radius+t.majorTickLines.size,e=t.font,p=t.visibleLabels.length,w,b,k,l;for(u=0;u<p;u++)if(i=ej.EjSvgRender.utils._valueToPolarCoefficient(t,t.visibleLabels[u].Value),h=ej.EjSvgRender.utils._valueToVector(t,t.visibleLabels[u].Value),!isNaN(h.X)&&!isNaN(h.Y)){var c=t.visibleLabels[u].Text,r=this.model.centerX+y*h.X,o=this.model.centerY+y*h.Y,a=r<this.model.centerX?"end":r>this.model.centerX?"start":"middle",f=ej.EjSvgRender.utils._measureText(c,this.model.m_AreaBounds.Height,t.font);i==.25?(r-=this.model.elementSpacing/2,o+=f.height/4):i==.5?o+=f.height:i==.75?(r+=this.model.elementSpacing/2,o+=f.height/4):i==1||i==0?o-=f.height/2:.25<i&&i<.5?(r-=this.model.elementSpacing/2,o+=f.height/2):.5<i&&i<=.75?(r+=this.model.elementSpacing/2,o+=f.height/2):0<i&&i<.25?r-=this.model.elementSpacing/2:r+=this.model.elementSpacing/2;u==0&&(w=r);u==p-1&&t._valueType!="category"&&(l=ej.EjSvgRender.utils._measureText(c,null,e).width,l+=r,l>w&&(c=""));s={id:this.svgObject.id+"_"+t.name+"_XLabel_"+u,x:r,y:o,fill:e.color,"font-size":e.size,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,opacity:e.opacity,"text-anchor":a};this.svgRenderer.drawText(s,c,v);k=a=="middle"?s.x-f.width/2:a=="end"?s.x-f.width:s.x;b={x:k,y:s.y,width:f.width,height:f.height};t.visibleLabels[u].region={bounds:b,labelText:c}}n(v).appendTo(this.gXaxisEle)},_drawPolarCircle:function(t){var s,o,i,h,u,f,r,e,l,a,v,c;if(t.majorGridLines.visible)if(s=ej.EjSvgRender.utils._getStringBuilder(),o=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisGrid"}),this.model.isPolar)for(i=0;i<t.visibleLabels.length;i++){var h=t.visibleLabels[i],u=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,h.Value,this),c={id:this.svgObject.id+"_YAxisGridLines_"+i,cx:this.model.centerX,cy:this.model.centerY,r:u,fill:"transparent","stroke-width":t.majorGridLines.width,stroke:t.majorGridLines.color,opacity:this.vmlRendering?.3:t.majorGridLines.opacity};this.svgRenderer.drawCircle(c,o)}else{for(i=0;i<t.visibleLabels.length;i++)for(h=t.visibleLabels[i],u=this.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,h.Value,this),f=0;f<this.model._axes[0].visibleLabels.length;f++)r=this.model._axes[0],e=ej.EjSvgRender.utils._valueToVector(r,r.visibleLabels[f].Value),isNaN(e.X)||isNaN(e.Y)||(l=f+1<r.visibleLabels.length?ej.EjSvgRender.utils._valueToVector(r,r.visibleLabels[f+1].Value):ej.EjSvgRender.utils._valueToVector(r,r.visibleLabels[0].Value),a={X:this.model.centerX+u*e.X,Y:this.model.centerY+u*e.Y},v={X:this.model.centerX+u*l.X,Y:this.model.centerY+u*l.Y},s.append("M "+a.X+" "+a.Y+" L "+v.X+" "+v.Y+" "));t.majorGridLines.visible&&(yMajorGridDir=s.toString(),c={id:this.svgObject.id+"_YAxisGridLines",fill:"none","stroke-width":t.majorGridLines.width,stroke:t.majorGridLines.color,opacity:t.majorGridLines.opacity,"stroke-dasharray":t.majorGridLines.dashArray,d:yMajorGridDir},this.svgRenderer.drawPath(c,o))}n(o).appendTo(this.gYaxisEle)},_drawPolarGridLine:function(t){var i=this.model,o=i.legend,ft=ej.EjSvgRender.utils._measureText(o.title.text,null,o.title.font).height,e=o.position.toLowerCase(),a=0,k=0,d=ej.EjSvgRender.utils._getStringBuilder(),g=ej.EjSvgRender.utils._getStringBuilder(),nt=o.border.width,v,y,p,u,r,tt=t.visibleLabels.length,it=i.border.width,s=i.title,h=i.title.subTitle,rt=s.enableTrim&&(s.textOverflow=="wrap"||s.textOverflow=="wrapandtrim")?!0:!1,ut=h.text!=""&&h.visible&&h.enableTrim&&(h.textOverflow=="wrap"||h.textOverflow=="wrapandtrim")?!0:!1,c,et,w,f,b,l;if(o.visible&&e!="custom"&&(e=="right"||e=="left"?a=(e=="right"?i.margin.right:i.margin.left)+i.LegendActualBounds.Width+(nt+it)*2:k=(e=="top"?i.margin.top:i.margin.bottom)+i.LegendActualBounds.Height+ft+(nt+it)*2),v=(i.title.text&&i.title.visible?i._titleLocation.Y+(rt?i._titleLocation.size.height:0)+(ut?i._subTitleLocation.size.height:0):0)+k,y=i.svgWidth-a,p=i.svgHeight-v,i.centerX=y*.5+(e==="left"?a:0),i.centerY=p*.5+(e==="top"?v:s.text&&s.visible?i._titleLocation.Y+(rt?i._titleLocation.size.height:0)+(ut?i._subTitleLocation.size.height:0):0),c=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisGrid"}),i.finalSize={width:y,height:p},i.Radius=Math.min(i.finalSize.width,i.finalSize.height)/2-2*i.elementSpacing-t.majorTickLines.size-t._LableMaxWidth.maxHeight,et=0,t.majorGridLines.visible)for(f=0;f<tt;f++)u=ej.EjSvgRender.utils._valueToVector(t,t.visibleLabels[f].Value),r={},r.X1=i.centerX,r.Y1=i.centerY,r.X2=i.centerX+i.Radius*u.X,r.Y2=i.centerY+i.Radius*u.Y,d.append("M "+r.X1+" "+r.Y1+" L "+r.X2+" "+r.Y2+" ");if(t.visible&&t.majorTickLines.visible)for(w=i.Radius,f=0;f<tt;f++)u=ej.EjSvgRender.utils._valueToVector(t,t.visibleLabels[f].Value),r={},r.X1=i.centerX+w*u.X,r.Y1=i.centerY+w*u.Y,r.X2=r.X1+t.majorTickLines.size*u.X,r.Y2=r.Y1+t.majorTickLines.size*u.Y,b="M "+r.X1+" "+r.Y1+" L "+r.X2+" "+r.Y2+" ",b.indexOf("NaN")==-1&&g.append(b);t.majorGridLines.visible&&(xMajorGridDir=d.toString(),l={id:this.svgObject.id+"_XAxisGridLines",fill:"none","stroke-width":t.majorGridLines.width,stroke:t.majorGridLines.color,opacity:t.majorGridLines.opacity,"stroke-dasharray":t.majorGridLines.dashArray,d:xMajorGridDir},xMajorGridDir.indexOf("NaN")==-1&&(this.svgRenderer.drawPath(l,c),n(c).appendTo(this.gXaxisEle)));t.visible&&t.majorTickLines.visible&&(xMajorTickDir=g.toString(),l={id:this.svgObject.id+"_XAxisMajorTicks",fill:"none","stroke-width":t.majorTickLines.width,stroke:t.majorTickLines.color,d:xMajorTickDir},this.svgRenderer.drawPath(l,c),n(c).appendTo(this.gXaxisEle))},_drawXAxisTickLine:function(t,i,r,u){var vt,yt,ft=ej.EjSvgRender.utils._getStringBuilder(),pt=ej.EjSvgRender.utils._getStringBuilder(),nt,h=Math.floor(i.x),oi=Math.floor(i.x+i.width),o=i._opposed,et,c=[],wt=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),k=i.labelBorder,ot,f,tt,it,y,e,p,a,ii,rt,ht,b,s,ct,v,l,ti,lt,at;for(isCrossesAt=u.axes[i.name]._validCross,t==0||isCrossesAt||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?t==0||isCrossesAt||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?f=ot=i._y?i.showNextToAxisLine?i.y:i._y:Math.floor(i.y+i.majorTickLines.size-5):(f=o?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size),ot=o?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size)):(f=o?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),ot=o?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height)),r||(tt=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisTicklines_"+t})),i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,it=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,y=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&it<0&&(y=y>0?i.visibleLabels.length+1:y),e=0;e<y;e++)if(et=i.visibleLabels[e]?i.visibleLabels[e].Value:i.visibleLabels[e-1].Value+i.range.interval,p=i.labels.length>0&&it<0?et+it:et,p=i.roundingPlaces?p:parseFloat(p.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(p,i.visibleRange)){if(i.hidePartialLabels&&(e==0||e==y-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(a=this._getSharpPath(i.minorTickLines.width),ii=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){s=p;var bt=i.visibleRange.max,st=i.visibleRange.min,kt=Math.pow(i.logBase,s-i.visibleRange.interval),ri=Math.pow(i.logBase,s),ui=(ri-kt)/(i.minorTicksPerInterval+1),fi=kt+ui;for(s=ej.EjSvgRender.utils._logBase(fi,i.logBase),b=0;b<i.minorTicksPerInterval;b++)s<bt&&s>st&&(nt=Math.ceil((s-st)/(bt-st)*i.width),i.minorTickLines&&i.minorTickLines.visible&&(ht=Math.floor(nt+h),rt=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?Math.floor(f-i.minorTickLines.size):Math.floor(i.minorTickLines.size+f):o?Math.floor(f+i.minorTickLines.size):f-Math.floor(i.minorTickLines.size),ft.append("M "+(ht+a)+" "+(rt+a)+" L "+(ht+a)+" "+(f+a)+" ")))}else for(b=0,s=p;b<i.minorTicksPerInterval;b++)s+=i.visibleRange.interval/(i.minorTicksPerInterval+1),s<i.visibleRange.max&&s>i.visibleRange.min&&(nt=Math.ceil((s-i.visibleRange.min)/(i.visibleRange.max-i.visibleRange.min)*i.width),i.minorTickLines&&i.minorTickLines.visible&&(rt=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?Math.floor(f-i.minorTickLines.size):Math.floor(i.minorTickLines.size+f):o?Math.floor(f+i.minorTickLines.size):Math.floor(f-i.minorTickLines.size),ct=Math.floor(nt+h),ft.append("M "+(ct+a)+" "+(rt+a)+" L "+(ct+a)+" "+(f+a)+" ")));if(i.majorTickLines.visible||i.majorGridLines.visible||k.width>0){var ut=this._getSharpPath(i.majorTickLines.width),si=this._getSharpPath(i.majorGridLines.width),dt=c[e]=this.pointX=Math.ceil(ej.EjSvgRender.utils._getPointXY(p,i.visibleRange,i.isInversed)*i.width);i.majorTickLines.visible&&(v=i.majorTickLines.size+i.axisLine.width/2,l=i.tickLinesPosition=="inside"&&i.labelPosition=="inside"||i.tickLinesPosition=="inside"&&i.labelPosition!="inside"?o?f+v:f-v:(o?f-v:v+f)-(wt?o?this.model.scrollerSize:-this.model.scrollerSize:0),pt.append("M "+(Math.floor(dt+h)+ut)+" "+(Math.floor(l)+ut)+" L "+(Math.floor(dt+h)+ut)+" "+(Math.floor(f+(o?-i.axisLine.width/2:i.axisLine.width/2))+ut)+" "))}}if(k.width>0){var w=ej.EjSvgRender.utils._getStringBuilder(),gt=wt?this.model.scrollerSize:0,v=i.axisLine.width,l,e,d,ni=i.labelPosition.toLowerCase(),hi=this.model.m_AreaBounds.X,ci=this.model.m_AreaBounds.Width,ei=k.width,g=i._LableMaxWidth.height+i.axisLine.width/2+2,y=i.visibleLabels.length;for(i.tickLinesPosition==ni&&(g+=i.majorTickLines.size),ni=="inside"?(l=o?f+v:f+v,endY=o?f+g:f-g):(l=o?f-v:v+f+(i.zoomFactor<1&&this.model.zooming.enableScrollbar&&t==0?this.model.scrollerSize:0),endY=o?f-g-gt:f+g+gt),e=0;e<y;e++)d=(c[c.length-1]-c[c.length-2])/2,!ej.util.isNullOrUndefined(c[e])&&c.length>=1&&!isNaN(d)&&(i._valueType=="category"&&i.labelPlacement.toLowerCase()=="betweenticks"?(startX=c[e]+h,endX=c[e]+d*2+h):(startX=c[e]-d+h,endX=c[e]+d+h),endX=Math.floor(endX),endY=Math.floor(endY),startX=Math.floor(startX),l=Math.floor(l),startX<i.x?w.append("M "+Math.floor(h)+" "+endY+" L "+endX+" "+endY+" "):endX>i.width+i.x?(w.append("M "+startX+" "+l+" L "+startX+" "+endY+" L "+Math.floor(i.width+h)+" "+endY+" "),endX-ei<=i.width+i.x&&w.append("M "+Math.floor(i.width+h)+" "+endY+" L "+(i.x+i.width)+" "+l)):(e==0&&w.append("M "+i.x+" "+endY+" L "+startX+" "+endY+" "),w.append("M "+startX+" "+l+" L "+startX+" "+endY+" L "+endX+" "+endY+" "),e==y-1&&w.append("M "+endX+" "+l+" L "+endX+" "+endY+" M "+endX+" "+endY+" L "+(i.x+i.width)+" "+endY)));ti={id:this.svgObject.id+"_XAxisLabelBorder_"+t,fill:"transparent","stroke-width":k.width,stroke:k.color,d:w.toString()};this.svgRenderer.drawPath(ti,r);n(r).appendTo(this.gXaxisEle)}i.minorTickLines.visible&&i.visible&&i.minorTicksPerInterval>0&&(yt=ft.toString(),lt={id:this.svgObject.id+"_XAxisMinorTicks_"+t,fill:"none","stroke-width":i.minorTickLines.width,stroke:i.minorTickLines.color,d:yt},r?this.svgRenderer.drawPath(lt,r):this.svgRenderer.drawPath(lt,tt));i.majorTickLines.visible&&i.visible&&(vt=pt.toString(),at={id:this.svgObject.id+"_XAxisMajorTicks_"+t,fill:"none","stroke-width":i.majorTickLines.width,stroke:i.majorTickLines.color,d:vt},r?this.svgRenderer.drawPath(at,r):this.svgRenderer.drawPath(at,tt));i.tickLinesPosition=="inside"&&n(tt).appendTo(this.gXaxisEle)},_drawXAxisGridLine:function(t,i,r){var ct,lt,ut=ej.EjSvgRender.utils._getStringBuilder(),at=ej.EjSvgRender.utils._getStringBuilder(),w,f=[],vt=this.model.elementSpacing+5,ft,l=i._opposed,b=Math.floor(i.x),ni=Math.floor(i.x+i.width),d=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisGrid_"+t}),g=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisAlternateGridBand_"+t}),yt=r.axes[i.name]._validCross,a,k,tt,s,c,ii,h,st,p,o,it,rt,dt,u,e,gt,ht;if(t==0||yt||i.labelPosition!="inside"||i.tickLinesPosition!="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?i.labelPosition!="inside"||i.tickLinesPosition=="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?t==0||yt||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?(a=Math.floor(i.y),k=Math.floor(i.y)):(a=l?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size),k=l?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size)):a=k=l?Math.floor(i.y-i._LableMaxWidth.height)+vt:i.showNextToAxisLine?Math.floor(i.y+i._LableMaxWidth.height)-vt:Math.floor(i.y+i._LableMaxWidth.height):(a=l?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),k=l?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height)),i.visible&&i.axisLine.visible){var pt=i.axisLine.offset>0?i.axisLine.offset:0,nt=this._getSharpPath(i.axisLine.width),ti={id:this.svgObject.id+"_XAxisLine_"+t,x1:b-i.plotOffset+nt+pt,y1:a+nt,x2:ni+i.plotOffset-pt+nt,y2:k+nt,"stroke-dasharray":i.axisLine.dashArray,"stroke-width":i.axisLine.width,stroke:i.axisLine.color,opacity:i.axisLine.opacity||1};r.axes[i.name]._lineOption=[ti,this.gXaxisEle]}else r.axes[i.name]._lineOption=[null,this.gXaxisEle];for(i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,tt=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,s=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&tt<0&&(s=s>0?i.visibleLabels.length+1:s),u=0;u<s;u++)if(ft=i.visibleLabels[u]?i.visibleLabels[u].Value:i.visibleLabels[u-1].Value+i.range.interval,c=i.labels.length>0&&tt<0?ft+tt:ft,c=i.roundingPlaces?c:parseFloat(c.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(c,i.visibleRange)){if(i.hidePartialLabels&&(u==0||u==s-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(ii=this._getSharpPath(i.minorTickLines.width),h=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){o=c;var wt=i.visibleRange.max,et=i.visibleRange.min,bt=Math.pow(i.logBase,o-i.visibleRange.interval),ri=Math.pow(i.logBase,o),kt=(ri-bt)/(i.minorTicksPerInterval+1),ot=bt+kt;for(o=ej.EjSvgRender.utils._logBase(ot,i.logBase),p=0;p<i.minorTicksPerInterval;p++)o<wt&&o>et&&(w=Math.ceil((o-et)/(wt-et)*i.width),i.minorGridLines&&i.minorGridLines.visible&&(st=Math.floor(w+b),ut.append("M "+(st+h)+" "+(a+h)+" L "+(st+h)+" "+(Math.floor(l?this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height:this.model.m_AreaBounds.Y)+h)+" "))),ot+=kt,o=ej.EjSvgRender.utils._logBase(ot,i.logBase)}else for(p=0,o=c;p<i.minorTicksPerInterval;p++)o+=i.visibleRange.interval/(i.minorTicksPerInterval+1),o<i.visibleRange.max&&o>i.visibleRange.min&&(w=Math.ceil((o-i.visibleRange.min)/(i.visibleRange.max-i.visibleRange.min)*i.width),i.minorGridLines&&i.minorGridLines.visible&&ut.append("M "+(Math.floor(w+b)+h)+" "+(a+h)+" L "+(Math.floor(w+b)+h)+" "+(Math.floor(l?this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height:this.model.m_AreaBounds.Y)+h)+" "));if(i.majorTickLines.visible||i.majorGridLines.visible){var fi=this._getSharpPath(i.majorTickLines.width),v=this._getSharpPath(i.majorGridLines.width),ui=this.pointX=Math.ceil(ej.EjSvgRender.utils._getPointXY(c,i.visibleRange,i.isInversed)*i.width),y=Math.floor(ui+b);if(i.zoomed&&(f[0]=i.x),u==0&&y==Math.floor(this.model.m_AreaBounds.X)){f.push(y+v);continue}if(u==s-1&&this.model.chartArea.border.color!="transparent"&&this.model.chartArea.border.width>0){if(y==Math.floor(this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width))continue;i.zoomed&&(f[s]=y+v)}if(i.majorGridLines.visible&&at.append("M "+(y+v)+" "+(Math.floor(this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height)+v)+" L "+(y+v)+" "+(Math.floor(this.model.m_AreaBounds.Y)+v)+" "),i._valueType.toLowerCase()!="category"&&u==s-1)continue;f.push(y+v)}}if(i.alternateGridBand.odd.fill!="transparent"||i.alternateGridBand.even.fill!="transparent"){for(it=this.model.m_AreaBounds.Height,f.length===0&&(rt={id:this.svgObject.id+"_XAxis"+t+"_Alternateeven0",x:i.x,y:Math.floor(this.model.m_AreaBounds.Y),width:i.width,height:it,fill:i.alternateGridBand.even.fill,opacity:i.alternateGridBand.even.opacity,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",stroke:"transparent"},this.svgRenderer.drawRect(rt,g)),u=1;u<f.length;u+=2)e=f[u+1]-f[u],e=e||i.labelPlacement.toLowerCase()=="onticks"?e:i.width+i.x-f[u],u==f.length-1&&i.zoomed&&(e=this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width-f[f.length-1]-i.plotOffset),dt={id:this.svgObject.id+"_XAxis"+t+"_Alternateodd"+[u],x:f[u],y:Math.floor(this.model.m_AreaBounds.Y),width:e,height:it,fill:i.alternateGridBand.odd.fill,opacity:i.alternateGridBand.odd.opacity,stroke:"transparent","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},e>0&&this.svgRenderer.drawRect(dt,g);for(u=0;u<f.length;u+=2)e=f[u+1]-f[u],e=e||i.labelPlacement.toLowerCase()=="onticks"?e:i.width+i.x-f[u],u==0&&i.zoomed&&(e=f[1]-i.x),u==f.length-1&&i.zoomed&&(e=this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width-f[f.length-1]-i.plotOffset),rt={id:this.svgObject.id+"_XAxis"+t+"_Alternateeven"+[u],x:f[u],y:Math.floor(this.model.m_AreaBounds.Y),width:e,height:it,fill:i.alternateGridBand.even.fill,opacity:i.alternateGridBand.even.opacity,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",stroke:"transparent"},e>0&&this.svgRenderer.drawRect(rt,g);n(g).appendTo(d)}i.minorGridLines.visible&&i.minorTicksPerInterval>0&&(lt=ut.toString(),gt={id:this.svgObject.id+"_XAxisMinorGridLines_"+t,fill:"none","stroke-width":i.minorGridLines.width,stroke:i.minorGridLines.color,"stroke-dasharray":i.minorGridLines.dashArray,d:lt},this.svgRenderer.drawPath(gt,d));ct=at.toString();i.majorGridLines.visible&&(ht={id:this.svgObject.id+"_XAxisMajorGridLines_"+t,fill:"none","stroke-width":i.majorGridLines.width,stroke:i.majorGridLines.color,opacity:i.majorGridLines.opacity,"stroke-dasharray":i.majorGridLines.dashArray,d:ct},ht.d!=""&&this.svgRenderer.drawPath(ht,d));n(d).appendTo(this.svgObject)},_drawYAxisTickLine:function(t,i,r,u){var at="",vt="",et=0,yt=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),o=i._opposed,ot,c=[],rt=i.labelBorder,st,e,ut,y,v,b,l,ii,k,s,ft,nt,ui,d,f,gt,ni,ti;t==1||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?t==1||u||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?e=st=i.showNextToAxisLine?!i.showNextToAxisLine&&i.tickLinesPosition=="inside"?i.x+i.majorTickLines.size:i.x:i._x:(e=Math.floor(i.x+i.majorTickLines.size),st=Math.floor(i.x+i.majorTickLines.size)):(e=!o&&!u?Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing):i.showNextToAxisLine?i.x:Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing),st=!o&&!u?Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing):i.showNextToAxisLine?i.x:Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing));var h=Math.floor(i.y+i.height),fi=Math.floor(i.y),ht=ej.EjSvgRender.utils._getStringBuilder(),pt=ej.EjSvgRender.utils._getStringBuilder(),ei=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTicklines_"+t});for(i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,ut=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,y=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&ut<0&&(y=y>0?i.visibleLabels.length+1:y),f=0;f<y;f++)if(ot=i.visibleLabels[f]?i.visibleLabels[f].Value:i.visibleLabels[f-1].Value+i.range.interval,v=i.labels.length>0&&ut<0?ot+ut:ot,v=i.roundingPlaces?v:parseFloat(v.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(v,i.visibleRange)){if(i.hidePartialLabels&&(f==0||f==i.visibleLabels.length-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(l=this._getSharpPath(i.minorTickLines.width),ii=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){s=v;var wt=i.visibleRange.max,ct=i.visibleRange.min,bt=Math.pow(i.logBase,s-i.visibleRange.interval),ri=Math.pow(i.logBase,s),kt=(ri-bt)/(i.minorTicksPerInterval+1),lt=bt+kt;for(s=ej.EjSvgRender.utils._logBase(lt,i.logBase),k=0;k<i.minorTicksPerInterval;k++)s<wt&&s>ct&&(b=Math.ceil((s-ct)/(wt-ct)*i.height),i.minorTickLines&&i.minorTickLines.visible&&i.minorTickLines.visible&&(ft=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?i.minorTickLines.size:-i.minorTickLines.size:o?-i.minorTickLines.size:i.minorTickLines.size,ht.append("M "+(Math.floor(ft+e)+l)+" "+(Math.floor(b*-1+h)+l)+" L "+(e+l)+" "+(Math.floor(b*-1+h)+l)+" "))),lt+=kt,s=ej.EjSvgRender.utils._logBase(lt,i.logBase)}else for(k=0,s=v;k<i.minorTicksPerInterval;k++)s+=i.visibleRange.interval/(i.minorTicksPerInterval+1),s<i.visibleRange.max&&s>i.visibleRange.min&&(b=(s-i.visibleRange.min)/i.visibleRange.delta*i.height,i.minorTickLines.visible&&(ft=i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?o?i.minorTickLines.size:-i.minorTickLines.size:o?-i.minorTickLines.size:i.minorTickLines.size,ht.append("M "+(Math.floor(ft+e)+l)+" "+(Math.floor(b*-1+h)+l)+" L "+(e+l)+" "+(Math.floor(b*-1+h)+l)+" ")));(i.majorTickLines.visible||i.majorGridLines.visible||rt.width>0)&&(nt=this._getSharpPath(i.minorTickLines.width),ui=this._getSharpPath(i.majorGridLines.width),et=c[f]=ej.EjSvgRender.utils._getPointXY(v,i.visibleRange,i.isInversed)*i.height,i.majorTickLines.visible&&(i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||i.tickLinesPosition!="inside"&&i.labelPosition=="inside"?d=(o?i.majorTickLines.size+i.axisLine.width/2:-(i.majorTickLines.size+i.axisLine.width/2))+(yt?o?this.model.scrollerSize:o-this.model.scrollerSize:0):(i.tickLinesPosition=="inside"&&i.labelPosition!="inside"||i.tickLinesPosition=="inside"&&i.labelPosition=="inside")&&(d=o?-(i.majorTickLines.size+i.axisLine.width/2):i.majorTickLines.size+i.axisLine.width/2),pt.append("M "+(Math.floor(d+e)+nt)+" "+(Math.floor(et*-1+h)+nt)+" L "+(Math.floor(e+(o?i.axisLine.width/2:i.axisLine.width/2))+nt)+" "+(Math.floor(et*-1+h)+nt)+" ")))}if(rt.width>0){var tt=ej.EjSvgRender.utils._getStringBuilder(),d=i.axisLine.width/2,f,p,w,a,it,dt=yt?this.model.scrollerSize:0,g=i._LableMaxWidth.maxWidth+10;for(i.tickLinesPosition==i.labelPosition&&(g+=i.majorTickLines.size),a=Math.floor(e-g),a=i.labelPosition=="outside"?o?Math.floor(e+g)+dt:Math.floor(e-g)-dt:o?Math.floor(e-g):Math.floor(e+g),f=0;f<y;f++)it=(c[c.length-1]-c[c.length-2])/2,!ej.util.isNullOrUndefined(c[f])&&c.length>1&&!isNaN(it)&&(i._valueType=="category"&&i.labelPlacement.toLowerCase()=="betweenticks"?(p=Math.floor(c[f]*-1+h),w=Math.floor(c[f]*-1-it*2+h)):(p=Math.floor(c[f]*-1+it+h),w=Math.floor(c[f]*-1-it+h)),p>h?tt.append("M "+a+" "+h+" L "+a+" "+w+" "):w<this.model.m_AreaBounds.Y?tt.append("M "+Math.floor(d+e)+" "+p+" L "+a+" "+p+" L "+a+" "+this.model.m_AreaBounds.Y+" "):(tt.append("M "+Math.floor(d+e)+" "+p+" L "+a+" "+p+" L "+a+" "+w+" "),f==y-1&&tt.append("M "+Math.floor(d+e)+" "+w+" L "+a+" "+w+" ")));gt={id:this.svgObject.id+"_YAxisLabelBorder_"+t,fill:"none","stroke-width":rt.width,stroke:rt.color,d:tt.toString()};this.svgRenderer.drawPath(gt,r);n(r).appendTo(this.gYaxisEle)}i.minorTickLines.visible&&i.visible&&i.minorTicksPerInterval>0&&(vt=ht.toString(),ni={id:this.svgObject.id+"_YAxisMinorTicks_"+t,fill:"none","stroke-width":i.minorTickLines.width,stroke:i.minorTickLines.color,d:vt},this.svgRenderer.drawPath(ni,r));i.majorTickLines.visible&&i.visible&&(at=pt.toString(),ti={id:this.svgObject.id+"_YAxisMajorTicks_"+t,fill:"none","stroke-width":i.majorTickLines.width,stroke:i.majorTickLines.color,d:at},this.svgRenderer.drawPath(ti,r))},_drawYAxisGridLine:function(t,i,r){var ht="",ct="",lt=0,nt,s=Math.floor(i.y+i.height),ii=Math.floor(i.y),b=i._opposed,f=[],tt=i.name.replace(/[^a-zA-Z0-9]/g,""),at=r.axes[tt]._validCross,k,d,pt,ut,wt,h,v,ui,o,y,e,ei,c,ot,gt,u,a,p,ni,ti,st;t==1||at||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?t==1||at||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?(k=Math.floor(i.x),d=Math.floor(i.x)):(k=b?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size),d=b?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size)):(k=b?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing),d=b?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing));var it=ej.EjSvgRender.utils._getStringBuilder(),vt=ej.EjSvgRender.utils._getStringBuilder(),w=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisGrid_"+t}),rt=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisAlternateGridBand_"+t});if(i.visible&&i.axisLine.visible){var yt=i.axisLine.offset>0?i.axisLine.offset:0,g=this._getSharpPath(i.axisLine.width),ri={id:this.svgObject.id+tt+"_YAxisLine_"+t,x1:k+g,y1:ii-i.plotOffset+yt+g,x2:d+g,y2:s+i.plotOffset-yt+g,"stroke-width":i.axisLine.width,"stroke-dasharray":i.axisLine.dashArray,stroke:i.axisLine.color,opacity:i.axisLine.opacity||1};r.axes[i.name]._lineOption=[ri,this.gYaxisEle]}else r.axes[i.name]._lineOption=[null,this.gYaxisEle];for(i.axisBottomLine&&i.axisBottomLine.visible&&(pt={id:this.svgObject.id+tt+"_YAxisBottomLine_"+t,x1:this.model.m_AreaBounds.X,y1:s,x2:this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width,y2:s,"stroke-width":i.axisBottomLine.width,stroke:i.axisBottomLine.color},this.svgRenderer.drawLine(pt,w)),i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,ut=i.labels.length>0&&i.labelPlacement.toLowerCase()=="betweenticks"?-.5:0,wt=i.visibleLabels.length,u=0;u<wt;u++)if(nt=i.visibleLabels[u].Value,h=i.labels.length>0&&ut<0?nt+ut:nt,h=i.roundingPlaces?h:parseFloat(h.toFixed(ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)==0?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(h,i.visibleRange)){if(i.hidePartialLabels&&(u==0||u==i.visibleLabels.length-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(ui=this._getSharpPath(i.minorTickLines.width),o=this._getSharpPath(i.minorGridLines.width),i._valueType=="logarithmic"){e=h;var bt=i.visibleRange.max,ft=i.visibleRange.min,kt=Math.pow(i.logBase,e-i.visibleRange.interval),fi=Math.pow(i.logBase,e),dt=(fi-kt)/(i.minorTicksPerInterval+1),et=kt+dt;for(e=ej.EjSvgRender.utils._logBase(et,i.logBase),y=0;y<i.minorTicksPerInterval;y++)e<bt&&e>ft&&(v=Math.ceil((e-ft)/(bt-ft)*i.height),i.minorGridLines.visible&&it.append("M "+(Math.floor(this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" L "+(Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" ")),et+=dt,e=ej.EjSvgRender.utils._logBase(et,i.logBase)}else for(y=0,e=h;y<i.minorTicksPerInterval;y++)e+=i.visibleRange.interval/(i.minorTicksPerInterval+1),e<i.visibleRange.max&&e>i.visibleRange.min&&(v=(e-i.visibleRange.min)/i.visibleRange.delta*i.height,i.minorGridLines.visible&&it.append("M "+(Math.floor(this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" L "+(Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+o)+" "+(Math.floor(v*-1+s)+o)+" "));if((i.majorTickLines.visible||i.majorGridLines.visible)&&(ei=this._getSharpPath(i.minorTickLines.width),c=this._getSharpPath(i.majorGridLines.width),i.majorGridLines.visible)){lt=ej.EjSvgRender.utils._getPointXY(h,i.visibleRange,i.isInversed)*i.height;var oi=Math.floor(this.model.m_AreaBounds.X)+c,l=Math.floor(lt*-1+s),si=Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+c;if(u==0){if(l==Math.floor(this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height))continue;i.zoomed&&(f[0]=l+c)}if(u==i.visibleLabels.length-1&&this.model.chartArea.border.color!="transparent"&&this.model.chartArea.border.width>0&&l==Math.floor(this.model.m_AreaBounds.Y)){f.push(l+c);continue}if(vt.append("M "+oi+" "+(l+c)+" L "+si+" "+(l+c)+" "),u==0)continue;f.push(l+c)}}if(i.alternateGridBand.odd.fill!="transparent"||i.alternateGridBand.even.fill!="transparent"){for(ot=this.model.m_AreaBounds.Width,i.zoomed&&(f[f.length]=i.y),u=1;u<f.length;u+=2)a=f[0]-f[1],u==f.length-1&&i.zoomed&&(p=f[f.length-2]-i.y,a=p),gt={id:this.svgObject.id+"_YAxisAlternateodd"+[u],x:Math.floor(this.model.m_AreaBounds.X),y:f[u],width:ot,height:a,fill:i.alternateGridBand.odd.fill,opacity:i.alternateGridBand.odd.opacity,stroke:"transparent","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.svgRenderer.drawRect(gt,rt);for(u=0;u<f.length;u+=2)a=f[0]-f[1],u==f.length-1&&i.zoomed&&(p=f[f.length-2]-i.y,a=p),u==0&&i.zoomed&&(p=i.y+i.height-f[0]-i.plotOffset,a=p),ni={id:this.svgObject.id+"_YAxisAlternateeven"+[u],x:Math.floor(this.model.m_AreaBounds.X),y:f[u],width:ot,height:a,fill:i.alternateGridBand.even.fill,opacity:i.alternateGridBand.even.opacity,stroke:"transparent","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.svgRenderer.drawRect(ni,rt);n(rt).appendTo(w)}i.minorGridLines.visible&&i.minorTicksPerInterval>0&&(ct=it.toString(),ti={id:this.svgObject.id+"_YAxisMinorGridLines_"+t,fill:"none","stroke-width":i.minorGridLines.width,stroke:i.minorGridLines.color,"stroke-dasharray":i.minorGridLines.dashArray,d:ct},this.svgRenderer.drawPath(ti,w));ht=vt.toString();i.majorGridLines.visible&&(st={id:this.svgObject.id+"_YAxisMajorGridLines_"+t,fill:"none","stroke-width":i.majorGridLines.width,opacity:i.majorGridLines.opacity,"stroke-dasharray":i.majorGridLines.dashArray,stroke:i.majorGridLines.color,d:ht},st.d!=""&&this.svgRenderer.drawPath(st,w));n(w).appendTo(this.svgObject)},textOverflowMultiLevelLabels:function(n,t,i,r,u,f,e,o,s){var h=e.y,c=0;if(r=="wrap"||r=="wrapandtrim"){for(collection=s._wrap(n,t,i,r,u,f),textCollection=collection.text,rows=textCollection.length,j=0;j<rows;j++)e.y+=f.height,s.model.enable3D||(e.id+="_"+j,s.svgRenderer.drawText(e,textCollection[j],o)),r=="wrapandtrim"&&textCollection[j].indexOf("...")>-1&&(s.model.enable3D&&c==0&&(e.y-=f.height),unTrimmedText=collection.unTrimmedText,f=ej.EjSvgRender.utils._measureText(textCollection[j],null,u),bounds={X:e.x-f.width/2,Y:e.y,Width:f.width,Height:f.height},s.model.axisMultiLevelLabelRegions.push({trimText:textCollection[j],labelText:unTrimmedText[c],Bounds:bounds}),c++);return textCollection}return i=r=="trim"?ej.EjSvgRender.utils._trimText(actualText,t,u):actualText,s.model.enable3D||(h=e.y+f.height),n.orientation.toLowerCase()=="vertical"&&(h=e.y-f.height/4),f=ej.EjSvgRender.utils._measureText(i,null,u),bounds={X:e.x-f.width/2,Y:h,Width:f.width,Height:f.height},s.model.axisMultiLevelLabelRegions.push({trimText:i,labelText:actualText,Bounds:bounds}),i},_triggerMultiLevelLabelsRendering:function(t,i,r,u,f,e,o){var s=n.extend({},ej.EjSvgRender.commonChartEventArgs);return s.data={text:t,location:{x:i,y:r},textOverflow:u,font:f,border:e},o._trigger("multiLevelLabelRendering",s),s.data},_drawXAxisMultiLevelLabels:function(t,i){var d,u,r,at,ut,h,f,c,l,e,w,o,g,st,v,ft,nt,ht=this.svgObject.id,b=i.visibleRange,tt=this.svgRenderer.createGroup({id:ht+"_XAxisMultiLevelLabels_"+t,"clip-path":"url(#"+this.svgObject.id+"_XAxis_Clippath_"+t+")"}),it=this.model.m_AreaBounds,k=i.opposedPosition,y,a=i.labelPosition.toLowerCase(),vt=i.labelBorder,s=10,rt=i._isScroll?this.model.scrollerSize:0,ct,p,lt,ot,et;for(e=i.majorTickLines.size+i._LableMaxWidth.height+vt.width,clipX=it.X,clipY=i.y+e+rt,clipWidth=it.Width,clipHeight=i._multiLevelLabelHeight+s-2,k?clipY=a=="outside"?i.y-e-i._multiLevelLabelHeight-s/2-rt:i.y+e-s/2:a=="inside"&&(clipY=i.y-e-i._multiLevelLabelHeight),ct={id:this.svgObject.id+"_XAxis_Clippath_"+t,x:clipX,y:clipY,width:clipWidth,height:clipHeight,fill:"white","stroke-width":1,stroke:"Gray"},this.svgRenderer.drawClipPath(ct,tt),d=0;d<i.multiLevelLabels.length;d++)if(f=i.multiLevelLabels[d],f.visible&&(f.start>=b.min&&f.start<=b.max||f.end>=b.min&&f.end<=b.max||f.start<b.min&&f.end>b.max)){if(c=f.font,v=f.border,y=v.width,level=f._level,g=f.textOverflow.toLowerCase(),ft=v.type.toLowerCase(),nt=f.textAlignment.toLowerCase(),l=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.start,b,i.isInversed)*i.width),w=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.end,b,i.isInversed)*i.width),i.isInversed&&(l=l-w,w=l+w,l=w-l),actualText=f.text,h=ej.EjSvgRender.utils._measureText(actualText,null,c),ut=ej.util.isNullOrUndefined(f.maximumTextWidth)?w-l-y-s:f.maximumTextWidth-s,at=1,count=0,u=l+i.x+s/2,r=e+i.y,r=k?a=="outside"?i.y-e-i.multiLevelLabelHeight[level]-s-i.prevHeight[level]-rt:i.y+e-s/2+i.prevHeight[level]:a=="inside"?i.y-e-i.multiLevelLabelHeight[level]-i.prevHeight[level]:e+i.y+i.prevHeight[level]+rt,this.model.enableCanvasRendering&&(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(clipX,clipY,clipWidth,clipHeight),this.svgRenderer.ctx.clip()),nt=="center"?(u+=ut/2,anchor="middle"):nt=="far"?(u=u+ut-y/2,anchor="end"):(anchor="start",u+=y/2),p=this._triggerMultiLevelLabelsRendering(actualText,u,r,g,c,f.border,this),actualText=p.text,u=p.location.x,r=p.location.y,g=p.textOverflow.toLowerCase(),c=p.font,v=p.border,ft=p.border.type.toLowerCase(),y=p.border.width,o={id:ht+"_XAxisMultiLevelLabels_Text_"+t+"_"+d,x:u,y:ft=="curlybrace"?r+10:r,fill:c.color?c.color:i.multiLevelLabelsFontColor,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,"text-anchor":anchor},text=actualText,g!="none"&&(text=this.textOverflowMultiLevelLabels(i,ut,text,g,c,h,o,tt,this)),g!="wrap"&&g!="wrapandtrim"&&(o.y+=h.height,h.height<i.multiLevelLabelHeight[level]&&(o.y=o.y+i.multiLevelLabelHeight[level]/2-h.height/2),this.svgRenderer.drawText(o,text,tt)),r=k?a=="inside"?e+i.y+i.prevHeight[level]-s/2:i.y-e-i.multiLevelLabelHeight[level]-s+2-i.prevHeight[level]-rt:a=="inside"?i.y-e-i.multiLevelLabelHeight[level]-3-i.prevHeight[level]:e+i.y+i.prevHeight[level]+rt,u=l+i.x,r+=y,height=i.multiLevelLabelHeight[level]+s/2,width=ut+s+y,lt={bounds:{x:u,y:r,height:height,width:width},axisIndex:t,multiLevelLabel:f},this.model.multiLevelLabelRegions.push(lt),path="",braceGap=(width+y-h.width)/2-2,ft=="rectangle")st={id:ht+"_XAxisMultiLevelLabels_Rect_"+t+"_"+d,x:u,y:r,width:width,height:height,fill:"transparent",stroke:v.color?v.color:i.multiLevelLabelsColor,"stroke-width":y},this.svgRenderer.drawRect(st,tt);else{switch(ft){case"withouttopandbottomborder":path="M "+u+" "+r+" L "+u+" "+(r+height)+" M "+(u+width)+" "+r+" L "+(u+width)+" "+(r+height);break;case"withouttopborder":labelHeight=!k&&a=="outside"||k&&a=="inside"?height:0;path="M "+u+" "+(r+labelHeight)+" L "+(u+width)+" "+(r+labelHeight)+" M "+u+" "+r+" L "+u+" "+(r+height)+" M "+(u+width)+" "+r+" L "+(u+width)+" "+(r+height);break;case"brace":nt=="near"?(et=o.x,ot=o.x+h.width+2):nt=="center"?(et=o.x-h.width/2-2<=it.X+l?it.X+l+s:o.x-h.width/2-2,ot=o.x+h.width/2+2>it.X+w?it.X+w-s:o.x+h.width/2+2):(et=o.x-h.width-2,ot=o.x);path=!k&&a=="outside"||k&&a=="inside"?"M "+u+" "+r+" L "+u+" "+(r+height/2)+" M "+u+" "+(r+height/2)+" L "+(et-2)+" "+(r+height/2)+" M "+ot+" "+(r+height/2)+" L "+(u+width)+" "+(r+height/2)+" M "+(u+width)+" "+(r+height/2)+" L "+(u+width)+" "+r:"M "+u+" "+(r+height)+" L "+u+" "+(r+height/2)+" M "+u+" "+(r+height/2)+" L "+et+" "+(r+height/2)+" M "+ot+" "+(r+height/2)+" L "+(u+width)+" "+(r+height/2)+" M "+(u+width)+" "+(r+height)+" L "+(u+width)+" "+(r+height/2);break;case"curlybrace":r=i.y+e+i.prevHeight[level];path=width<30?"M "+(u+width/2-5)+" "+(r+10)+" L "+(u+width/2)+" "+(r+15)+" L "+(u+width/2+5)+" "+(r+10):k?"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+width/2-5)+" "+(r+10)+" L "+(u+width/2)+" "+(r+15)+" L "+(u+width/2+5)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r:nt=="center"?"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+width/2-5)+" "+(r+10)+" L "+(u+width/2)+" "+(r+15)+" L "+(u+width/2+5)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r:nt=="near"?"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+15)+" "+(r+15)+" L "+(u+15+5)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r:"M "+u+" "+r+" C "+u+" "+r+" "+(u+5)+" "+(r+10)+" "+(u+10)+" "+(r+10)+" L "+(u+width-20)+" "+(r+10)+" L "+(u+width-15)+" "+(r+15)+" L "+(u+width-10)+" "+(r+10)+" L "+(u+width-10)+" "+(r+10)+" C "+(u+width-10)+" "+(r+10)+" "+(u+width)+" "+(r+5)+" "+(u+width)+" "+r}path&&(st={id:ht+"_XAxisMultiLevelLabels_Rect_"+t+"_"+d,d:path,stroke:v.color?v.color:i.multiLevelLabelsColor,"stroke-width":v.width,fill:"none"},this.svgRenderer.drawPath(st,tt))}this.model.enableCanvasRendering&&this.svgRenderer.ctx.restore();n(tt).appendTo(this.gXaxisEle)}},_drawYAxisMultiLevelLabels:function(t,i){var y,r,u,ot,nt,p,f,s,c,k,w,o=5,tt,e,d,g,it=this.svgObject.id,a=i.visibleRange,b=this.svgRenderer.createGroup({id:it+"_YAxisMultiLevelLabels_"+t,"clip-path":"url(#"+this.svgObject.id+"_YAxis_Clippath_"+t+")"}),ht=this.model.m_AreaBounds,l=i.opposedPosition,v=i.labelPosition.toLowerCase(),st=i.labelBorder,rt=i._multiLevelLabelHeight,h=i.majorTickLines.size+i._LableMaxWidth.width+st.width+2*o,ut=i._isScroll?this.model.scrollerSize:0,ft,et;for(clipY=i.y,clipWidth=rt+o,clipHeight=i.height+o,clipX=l?v=="outside"?i.x+h-o+ut:i.x-rt-h+o:v=="outside"?i.x-rt-h-ut:i.x+h-o,ft={id:this.svgObject.id+"_YAxis_Clippath_"+t,x:clipX,y:i.y,width:clipWidth,height:clipHeight,fill:"white","stroke-width":1,stroke:"Gray"},this.svgRenderer.drawClipPath(ft,b),y=0;y<i.multiLevelLabels.length;y++)if(f=n.extend(!0,{},this.model.multiLevelLabelsDefault,i.multiLevelLabels[y]),f.visible&&(f.start>=a.min&&f.start<=a.max||f.end>=a.min&&f.end<=a.max||f.start<a.min&&f.end>a.max)){if(s=f.font,e=f.border,level=f._level,maximumTextWidth=f.maximumTextWidth,w=f.textOverflow.toLowerCase(),d=e.type.toLowerCase(),g=f.textAlignment.toLowerCase(),c=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.start,a,i.isInversed)*i.height),endY=Math.ceil(ej.EjSvgRender.utils._getPointXY(f.end,a,i.isInversed)*i.height),i.isInversed&&(c=c-endY,endY=c+endY,c=endY-c),actualText=f.text,p=ej.EjSvgRender.utils._measureText(actualText,null,s),nt=endY-c-e.width,space=ej.util.isNullOrUndefined(maximumTextWidth)?i.multiLevelLabelHeight[level]+o:maximumTextWidth-o,ot=1,count=0,textX=0,r=i.x-h-i.prevHeight[level]-i.multiLevelLabelHeight[level]/2+e.width-o/2,u=i.height+i.y-c-nt/2,r=l?v=="outside"?i.x+h+i.multiLevelLabelHeight[level]/2+i.prevHeight[level]+e.width+ut:i.x-h-i.multiLevelLabelHeight[level]/2-i.prevHeight[level]+e.width+o/2:v=="inside"?i.x+h+i.multiLevelLabelHeight[level]/2+i.prevHeight[level]-o/2:r+textX-ut,this.model.enableCanvasRendering&&(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(clipX,clipY,clipWidth,clipHeight),this.svgRenderer.ctx.clip()),u=g=="far"?u+nt/2-p.height/2:g=="near"?u-nt/2+p.height:u+p.height/4,data=this._triggerMultiLevelLabelsRendering(actualText,r,u,w,s,f.border,this),actualText=data.text,r=data.location.x,u=data.location.y,w=data.textOverflow,s=data.font,e=data.border,d=e.type.toLowerCase(),borderWidth=e.width,k={id:it+"_YAxisMultiLevelLabels_Text_"+t+"_"+y,x:d=="curlybrace"?l?r+textX+10:r+textX-10:r+textX,y:u,fill:s.color?s.color:i.multiLevelLabelsFontColor,"font-size":s.size,"font-family":s.fontFamily,"font-style":s.fontStyle,"font-weight":s.fontWeight,opacity:s.opacity,"text-anchor":"middle"},text=actualText,w!="none"&&(text=this.textOverflowMultiLevelLabels(i,space,text,w,s,p,k,b,this)),w!="wrap"&&w!="wrapandtrim"&&this.svgRenderer.drawText(k,text,b),r=r-o/2-i.multiLevelLabelHeight[level]/2,u=i.y+i.height-endY+e.width,height=endY-c,width=i.multiLevelLabelHeight[level]+o,path="",braceGap=(width+e.width-rt)/2-2,et={bounds:{x:r,y:u,height:height,width:width},axisIndex:t,multiLevelLabel:f},this.model.multiLevelLabelRegions.push(et),d=="rectangle")tt={id:it+"_YAxisMultiLevelLabels_Rect_"+t+"_"+y,x:r,y:u,width:width,height:height,fill:"transparent",stroke:e.color?e.color:i.multiLevelLabelsColor,"stroke-width":e.width},this.svgRenderer.drawRect(tt,b);else{switch(d){case"withouttopandbottomborder":path="M "+r+" "+(u+height)+" L "+(r+width)+" "+(u+height)+" M "+r+" "+u+" L "+(r+width)+" "+u;break;case"withouttopborder":labelWidth=!l&&v=="outside"||l&&v=="inside"?0:width;path="M "+r+" "+(u+height)+" L "+(r+width)+" "+(u+height)+" M "+r+" "+u+" L "+(r+width)+" "+u+" M "+(r+labelWidth)+" "+(u+height)+" L "+(r+labelWidth)+" "+u;break;case"brace":value1=k.y-p.height/2-4;value2=k.y+p.height/4+2;path=!l&&v=="outside"||l&&v=="inside"?"M "+(r+width)+" "+u+" L "+(r+width/2)+" "+u+" M "+(r+width/2)+" "+u+" L "+(r+width/2)+" "+value1+" M "+(r+width/2)+" "+value2+" L "+(r+width/2)+" "+(u+height)+" M "+(r+width/2)+" "+(u+height)+" L "+(r+width)+" "+(u+height):"M "+r+" "+u+" L "+(r+width/2)+" "+u+" M "+(r+width/2)+" "+u+" L "+(r+width/2)+" "+value1+" M "+(r+width/2)+" "+value2+" L "+(r+width/2)+" "+(u+height)+" M "+(r+width/2)+" "+(u+height)+" L "+r+" "+(u+height);break;case"curlybrace":r=i.x-h-i.prevHeight[level];newHeight=height-10;height<30?l?(r=i.x+h+i.prevHeight[level],newHeight=height-10,path=" M "+(r+10)+" "+(u+newHeight/2)+" L "+(r+15)+" "+(u+newHeight/2+5)+" L "+(r+10)+" "+(u+newHeight/2+10)):path="M "+(r-10)+" "+(u+height/2-5)+" L "+(r-15)+" "+(u+height/2)+" L "+(r-10)+" "+(u+height/2+5):l?(r=i.x+h+i.prevHeight[level],newHeight=height-10,path="M "+r+" "+u+" C "+r+" "+u+" "+(r+10)+" "+u+" "+(r+10)+" "+(u+10)+" L "+(r+10)+" "+(u+newHeight/2)+" L "+(r+15)+" "+(u+newHeight/2+5)+" L "+(r+10)+" "+(u+newHeight/2+10)+" L "+(r+10)+" "+(u+newHeight)+" C"+(r+10)+" "+(u+newHeight)+" "+(r+5)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10)):path=g=="center"?"M "+r+" "+u+" C "+r+" "+u+" "+(r-10)+" "+u+" "+(r-10)+" "+(u+10)+" L "+(r-10)+" "+(u+newHeight/2)+" L "+(r-15)+" "+(u+newHeight/2+5)+" L "+(r-10)+" "+(u+newHeight/2+10)+" L "+(r-10)+" "+(u+newHeight)+" C "+(r-10)+" "+(u+newHeight)+" "+(r-5)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10):g=="far"?"M "+r+" "+u+" C "+r+" "+u+" "+(r-10)+" "+u+" "+(r-10)+" "+(u+10)+" L "+(r-10)+" "+(u+newHeight-10)+" L "+(r-15)+" "+(u+newHeight-5)+" L "+(r-10)+" "+(u+newHeight)+" L "+(r-10)+" "+(u+newHeight)+" C"+(r-10)+" "+(u+newHeight)+" "+(r-10)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10):"M "+r+" "+u+" C "+r+" "+u+" "+(r-10)+" "+u+" "+(r-10)+" "+(u+10)+" L "+(r-15)+" "+(u+10+5)+" L "+(r-10)+" "+(u+10+10)+" L "+(r-10)+" "+(u+newHeight)+" C"+(r-10)+" "+(u+newHeight)+" "+(r-5)+" "+(u+newHeight+10)+" "+r+" "+(u+newHeight+10)}path&&(tt={id:it+"_YAxisMultiLevelLabels_Rect_"+t+"_"+y,d:path,stroke:e.color?e.color:i.multiLevelLabelsColor,"stroke-width":e.width,fill:"none"},this.svgRenderer.drawPath(tt,b))}this.model.enableCanvasRendering&&this.svgRenderer.ctx.restore();n(b).appendTo(this.gYaxisEle)}},_drawXAxisLabels:function(t,i){var ft=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels_"+t,cursor:"default"}),hr=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels_"+t,cursor:"default"}),v=[],vi,y=this.model.m_AreaBounds,fi,rr=i.name.replace(/[^a-zA-Z0-9]/g,""),yi=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),h=i._opposed,pi=i._valueType,ei=3,wi=i.alignment.toLowerCase(),lt,u,f,e,l,g,yt,w,nt,li,o,r,nr,ai,ht,ut,tr,bt,kt,a,wt,dt,ct,et;for(t==0||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.y==y.Height+y.Y||i.y==y.Y?t==0||i.labelPosition=="inside"||i.tickLinesPosition!="inside"||i.y==y.Height+y.Y||i.y==y.Y?(i._y=Math.floor(i.y),i.y=i.showNextToAxisLine?Math.floor(i.y):h?Math.floor(y.Y):Math.floor(y.Height+y.Y)):i.y=h?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size):i.y=h?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),u=0;u<i.visibleLabels.length;u++)if(f=i.visibleLabels[u],e=f.displayText=ej.util.isNullOrUndefined(f.displayText)?f.Text:f.displayText,ej.EjSvgRender.utils._inside(f.Value,i.visibleRange)){var gt,ni,bi,at,ki,st=i.width/i.visibleLabels.length,ur=i.maximumLabelWidth,vt=i.visibleRange,d=y.Width;ej.isNullOrUndefined(i.valueType)||u<i.visibleLabels.length-1&&i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="betweenticks"&&(at=i.visibleLabels[u+1],f.Value-=.5,ki=at.Value-.5);l=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(f.Value,vt,i.isInversed)*i.width));ej.isNullOrUndefined(i.valueType)||(u<i.visibleLabels.length-1&&i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="betweenticks"?(bi=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(ki,vt,i.isInversed)*i.width)),gt=u==0?i.x+l+(i.majorTickLines.width-.5):i.x+l+(i.majorTickLines.width+.5),ni=i.x+bi+(i.majorTickLines.width+.5),st=ni-gt):i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="betweenticks"?(st=i.width+i.x-ni,gt=ni):i.valueType.toLowerCase()=="datetimecategory"&&i.labelIntersectAction=="wrap"&&i.labelPlacement.toLowerCase()=="onticks"&&(st=i.width/i.labels.length));i._gap=gt;var nt=ej.EjSvgRender.utils._measureText(e,d,i.font),s=nt.width,c=nt.height,di=i._LableMaxWidth,tt=di.height,it=di.rows,fr=this.svgRenderer.vmlNamespace,rt=i.axisLine.width,b=i.font,gi=i.labelIntersectAction,ti=i.labelPlacement.toLowerCase(),oi=i.rotationValue,k=0,ii=!1;this.edgeLabel=!1;var er=y.Width,or=y.X,ut=i.labelIntersectAction.toLowerCase(),sr=n(this.svgObject).width(),si;if(ut=="trim"||i.enableTrim)if(ti=="onticks"&&u!=i.visibleLabels.length-1){for(var at=i.visibleLabels[u+1],hi=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(at.Value,vt,i.isInversed)*i.width)),ri=ej.EjSvgRender.utils._measureText(at.Text,d,i.font).width,p=hi-ri/2,k=0,ci=!1;p<l+s/2&&k<2;)for(k++,ri>s?(otherLabel=trimLabel=at,ci=!1):(trimLabel=f,ci=!0),g=trimLabel.displayText=trimLabel.Text.toString(),w=1;w<g.length;w++)if(g=trimLabel.displayText.substring(0,w)+"... ",newTextWidth=ej.EjSvgRender.utils._measureText(g,d,b).width,ci){if(p=hi-ri/2,p<l+newTextWidth/2){w-1!=0&&(g=g.toString().substring(0,w-1)+"... ");s=newTextWidth;e=trimLabel.displayText=g;break}}else if(p=hi-newTextWidth/2,p<l+s/2){w-1!=0&&(g=g.toString().substring(0,w-1)+"... ");ri=newTextWidth;trimLabel.displayText=g;break}}else if(ti=="betweenticks"&&(yt=i.enableTrim?ur:st,s>yt&&e!="")){for(w=1;w<e.toString().length;w++)if(e=f.displayText.toString().substring(0,w)+"... ",s=ej.EjSvgRender.utils._measureText(e,d,b).width,s>=yt){if(e=e.toString().substring(0,w-1)+"... ",f.displayText=e,u==i.visibleLabels.length-1&&l+i.x+s/2>sr&&yt==st){yt-=s/2;w=1;continue}break}f.displayText=e}if(nt=ej.EjSvgRender.utils._measureText(f.displayText,d,b),li=nt.width/2,si=i.majorGridLines.width>i.majorTickLines.width?i.majorGridLines.width:i.majorTickLines.width,!ej.util.isNullOrUndefined(f.Text)){if(lt=wi=="near"?l+i.x+si+(pi=="category"&&ti!="onticks"?-(i.width/i.actualRange.delta)/2+ei:-nt.width-ei):wi=="far"?l+i.x+(pi=="category"&&ti!="onticks"?+(i.width/i.actualRange.delta/2)-nt.width:+si+ei):l+i.x-li,i.labelPosition=="inside"&&i.tickLinesPosition=="inside"||i.labelPosition=="inside"&&i.tickLinesPosition!="inside"&&i.labelIntersectAction=="multiplerows"?o=h?i.y+i.majorTickLines.size+c/2+rt/2+tt/(2*it)-5:i.y-i.majorTickLines.size-rt/2-tt/(2*it)+5:i.labelPosition=="inside"&&i.tickLinesPosition!="inside"?o=h?i.y+c/2+rt/2+tt/(2*it)-5:i.y-rt/2-tt/(2*it)+5:i.labelPosition!="inside"&&i.tickLinesPosition!="inside"||i.labelPosition!="inside"&&i.tickLinesPosition=="inside"&&i.labelIntersectAction=="multiplerows"?(o=h?i.y-i.majorTickLines.size+c/2-rt/2-tt/(2*it)-5:i.y+i.majorTickLines.size+rt/2+tt/(2*it)+5,o=o+(yi?h?-this.model.scrollerSize:this.model.scrollerSize:0)):i.labelPosition!="inside"&&i.tickLinesPosition=="inside"&&(o=h?i.y+c/2-rt/2-tt/(2*it)-5:i.y+rt/2+tt/(2*it)+5,o=o+(yi?h?-this.model.scrollerSize:this.model.scrollerSize:0)),i.labelPosition=="inside"&&i.tickLinesPosition!="inside"?(i.labelRotation==90||i.labelIntersectAction=="rotate90")&&(o=h?o:o-i.majorTickLines.size):i.labelPosition!="inside"&&i.tickLinesPosition=="inside"?(i.labelRotation==90||i.labelIntersectAction=="rotate90")&&(o=h?o-i.majorTickLines.size:o-i.majorTickLines.size):i.labelPosition=="inside"&&i.tickLinesPosition=="inside"&&(i.labelRotation==90||i.labelIntersectAction=="rotate90")&&(o=h?o:o-i.majorTickLines.size),r={id:this.svgObject.id+"_"+rr+"_XLabel_"+u,x:lt,y:o,fill:b.color,"font-size":b.size,"font-family":b.fontFamily,"font-style":b.fontStyle,"font-weight":b.fontWeight,opacity:b.opacity},i.edgeLabelPlacement){nr=i.edgeLabelPlacement.toLowerCase();ai=i.visibleLabels.length-1;switch(nr){case"shift":u==0?r.x<i.x&&(ht=i.x-r.x,r.x=lt=r.x+ht,this.diff=ht,this.edgeLabel=!0):u==ai&&r.x+nt.width>i.x+i.width&&(ht=r.x+nt.width-(i.x+i.width),r.x=lt=r.x-ht,this.diff=ht,this.edgeLabel=!0);break;case"hide":(u==0&&r.x<i.x||u==ai&&r.x+s>er+or)&&(e="")}}if(oi==0||fr||this.labelRotation(i,lt+li,o,r,f,oi),i.labelIntersectAction||i.enableTrim)if(this.diff=ej.util.isNullOrUndefined(this.diff)?0:this.diff,ut=i.labelIntersectAction.toLowerCase(),ut!="none"||i.enableTrim){if(ut=="wrap"||ut=="wrapbyword"){var pt=this.rowscalculation(e.toString(),d,i,st,r),k=pt.length,ui="";for(r.y=i.labelPosition!="inside"?h?r.y+c:r.y-c:h?r.y-c:r.y-c*k,a=0;a<pt.length;a++)i.labelPosition!="inside"?(r.y=h?r.y-c:r.y+c,this.svgRenderer.drawText(r,pt[a],ft)):(r.y=h?r.y+c:r.y+c,this.svgRenderer.drawText(r,pt[a],ft),k-=1),ui=ui+pt[a];fi=ej.EjSvgRender.utils._measureText(e,null,b);tr=fi.height*k;vi={x:r.x,y:r.y,width:fi.width,height:k*tr};i.visibleLabels[u].region={bounds:vi,labelText:f.Text,displayText:ui};i.visibleLabels[u].displayText=ui;this.model.xAxisLabelRegions.push(i.visibleLabels[u].region);continue}else if(ut=="hide")for(wt=i.visibleLabels.length-1,bt=0;bt<u;bt++){ct=i.visibleLabels[bt];et=0;d=y.Width;var ir=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(ct.Value,vt,i.isInversed)*i.width)),ot=ej.EjSvgRender.utils._measureText(ct.displayText,d,i.font).width,p=ir+(i.isInversed?-ot/2:ot/2);p=bt==0?p+this.diff:p;kt=ot==0?ot:s;(u!=wt||u==wt&&s<=ot)&&(kt=kt/2);ut=="hide"&&(i.isInversed?p<l+kt:p>l-kt)&&(f.displayText=e="")}else if(ut=="multiplerows"){for(a=0;a<v.length&&!ii;a++)for(wt=i.visibleLabels.length-1,u!=wt&&(s=s/2),dt=0;v[a]&&dt<v[a].length;dt++){ct=v[a][dt];et=0;d=y.Width;var ir=Math.abs(Math.floor(ej.EjSvgRender.utils._getPointXY(ct.Value,vt,i.isInversed)*i.width)),ot=ej.EjSvgRender.utils._measureText(ct.displayText,d,i.font).width,p=ir+(i.isInversed?-ot/2:ot/2);if((this.edgeLabel||v.length==1)&&(p=p+this.diff),i.isInversed?p<l+s:p>l-s)if(h){et=i.labelPosition!="inside"?r.y-c:r.y+c;r.y=et;a+1==v.length&&(ii=!0);k++;break}else{et=i.labelPosition!="inside"?r.y+c:r.y-c;r.y=et;a+1==v.length&&(ii=!0);k++;break}else if(dt+1==v[a].length){ii=!0;break}}et==undefined?(v[0]==undefined&&(v[0]=[]),v[0].push(f)):(v[k]==undefined&&(v[k]=[]),v[k].push(f))}}else{this.svgRenderer.drawText(r,e,ft);i.visibleLabels[u].region=this.calculateRegion(e,b,r,f);this.model.xAxisLabelRegions.push(i.visibleLabels[u].region);i.labelPosition=="inside"?n(ft).appendTo(this.gXaxisTickEle):n(ft).appendTo(this.gXaxisEle);continue}this.edgeLabel||this.zoomed||i.zoomed||oi||gi=="rotate90"||gi=="rotate45"||!(l+i.x+s/2>n(this.svgObject).width())||(n(r).attr("x",n(this.svgObject).width()-2),n(r).attr("text-anchor","end"));i.visibleLabels[u].y=r.y;this.model.enableCanvasRendering&&i.labelPosition=="inside"&&(i.labelIntersectAction=="rotate45"||i.labelIntersectAction=="rotate90")&&(r.y=r.y-s);this.svgRenderer.drawText(r,e,ft);i.visibleLabels[u].region=this.calculateRegion(e,b,r,f);this.model.xAxisLabelRegions.push(i.visibleLabels[u].region)}}n(ft).appendTo(this.gXaxisEle)},calculateRegion:function(n,t,i,r){var u=ej.EjSvgRender.utils._measureText(n,null,t),f={x:i.x,y:i.y,width:u.width,height:u.height};return{bounds:f,trimText:n,labelText:r.Text}},rowscalculation:function(n,t,i,r,u){var h=ej.EjSvgRender.utils._measureText,s=i.font,d=h(n,t,s),c=d.width,g=c/2,e=n.toString(),nt=e.length,a=[],f=0,tt=i.labelIntersectAction,v=n.split(" "),k=v.length,l,w,y,o,p,b;if(this.edgeLabel&&(r=f==0?r-this.diff:r),c>r&&(u.x=u.x+g,line=0,this.edgeLabel&&(u.x=f==0?u.x-this.diff:u.x+this.diff)),tt=="wrap"){if(c>r)for(l=1;l<=e.length;l++)n=e.substring(0,l),c=h(n,t,s).width,c>r&&(line=line+1,n=e.substring(0,l-1),a[f]=n,e=e.slice(l-1,nt),currentTextCollextion=e.split(" "),e=v.indexOf(currentTextCollextion[0])>-1?e:"-"+e,w=h(n,t,s).width,line==1&&(u.x=u.x-w/2),f++,l=0);u.x=i.valueType=="datetimeCategory"&&i.labelPlacement.toLowerCase()=="betweenticks"?i._gap:u.x;a[f]=n}else{for(y=0,f=0;f<k;f++)if(o=v[f],p=h(o,t,s).width,p<r&&c>r){while(f<k)if(p=h(o,t,s).width,b=v[f+1]?h(v[f+1],t,s).width:0,p+b<=r&&b>0)o=o.concat(" "+v[f+1]),f++;else{y=Math.max(y,p);break}a.push(o)}else if(c>r)o=ej.EjSvgRender.utils._trimText(o,r,s),w=h(o,t,s).width,y=Math.max(y,w),a.push(o);else{a.push(n);break}u.x=u.x-y/2}return a},labelRotation:function(t,i,r,u,f,e,o){var v=t._opposed,h=f.displayText?f.displayText:f.Text,c=e>360?e-360:e<-360?e+360:e,l="rotate("+c+","+i+","+r+")",y,s,a;n(u).attr("transform",l);n(u).attr("labelRotation",c);n(u).attr("labelPosition",t.labelPosition);y=this.svgRenderer.createText(u,h);s=Math.ceil(ej.EjSvgRender.utils._measureBounds(y,this).height-ej.EjSvgRender.utils._measureText(h,null,t.font).height);s=t._LableMaxWidth.height-s-ej.EjSvgRender.utils._measureText(h,null,t.font).height;a=t.labelPosition!="inside"?v?s/2:-s/2:v?-s/2:s/2;l="rotate("+c+","+i+","+(r+a)+")";this.edgeLabel&&e==90&&(r=o==0?u.y+this.diff:u.y-this.diff);n(u).attr({transform:l,y:r+a})},_drawYAxisLabels:function(t,i){var ui=i.name.replace(/[^a-zA-Z0-9]/g,""),ht=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLabels_"+t,cursor:"default"}),y,ut,u=i._opposed,k,ft,s=this.model.m_AreaBounds,hi=this.model.requireInvertedAxes,bt=i._isScroll&&!(i.scrollbarSettings.pointsLength!=null&&i.scrollbarSettings.pointsLength<i.maxPointLength),kt=i.alignment.toLowerCase(),dt=3,d,h,e,ct,o,nt,r,ii,vt,g,ri,tt,wt,it,et,rt;for(t==1||(i.labelPosition!="inside"||i.tickLinesPosition!="inside")&&(i.labelPosition!="inside"||i.tickLinesPosition=="inside")||i.x==s.Width+s.X||i.x==s.X?t==1||i.x==s.Width+s.X&&i.x!=s.X||i.labelPosition=="inside"||i.tickLinesPosition!="inside"?(i._x=Math.floor(i.x),i.x=i.showNextToAxisLine?Math.floor(i.x):u?Math.floor(s.X+s.Width):Math.floor(s.X)):(i._x=Math.floor(i.x),i.x=u?Math.floor(i.x+i.majorTickLines.size):i.showNextToAxisLine?Math.floor(i.x-i.majorTickLines.size):Math.floor(s.X)):i.x=u?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):i.showNextToAxisLine?Math.floor(i.x):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing),h=0;h<i.visibleLabels.length;h++)if(e=i.visibleLabels[h],ct=i.visibleRange,ej.EjSvgRender.utils._inside(e.Value,ct)){var lt=Math.abs(ej.EjSvgRender.utils._getPointXY(e.Value,ct,i.isInversed)*i.height),fi=ej.EjSvgRender.utils._measureText(e.Text,s.Height,i.font),l=fi.height,c=i.font,ei=i.visibleRange,p=i.axisLine.width,gt=i._LableMaxWidth,ci=gt.height,li=gt.rows,ni=s.Width,ti=i.maximumLabelWidth,f=e.displayText=e.Text,oi=ej.EjSvgRender.utils._measureText(f,ni,i.font),b=oi.width,c=i.font,a=i.labelRotation,at;if(i.labelPosition=="inside"&&i.tickLinesPosition=="inside"?(o=u?i.x-i.majorTickLines.size-p/2-5:i.x+p/2+5+i.majorTickLines.size,nt=u?"end":"start"):i.labelPosition=="inside"&&i.tickLinesPosition!="inside"?(o=u?i.x-p/2-5:i.x+p/2+5,nt=u?"end":"start"):i.tickLinesPosition=="inside"&&i.labelPosition!="inside"?(o=u?p/2+i.x+5:i.x-p/2-5,nt=u?"start":"end",o=o-(bt?u?-this.model.scrollerSize:this.model.scrollerSize:0)):(o=u?i.majorTickLines.size+p/2+i.x+5:i.x-p/2-5-i.majorTickLines.size,nt=u?"start":"end",o=o-(bt?u?-this.model.scrollerSize:this.model.scrollerSize:0)),at=i.majorGridLines.width>i.majorTickLines.width?i.majorGridLines.width:i.majorTickLines.width,d=kt=="far"?-lt+(i.y+i.height)-at-dt:kt=="near"?-lt+(i.y+i.height)+l/2+at+dt:-lt+(i.y+i.height)+l/4,r={id:this.svgObject.id+"_"+ui+"_YLabel_"+h,x:o,y:d,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,"text-anchor":!ej.util.isNullOrUndefined(a)&&a!=0?"middle":nt},i.edgeLabelPlacement){ii=i.edgeLabelPlacement.toLowerCase();vt=i.visibleLabels.length-1;switch(ii){case"shift":h==0?r.y>i.y+i.height&&(g=r.y-(i.y+i.height),r.y=d=r.y-g,this.diff=g,this.edgeLabel=!0):h==vt&&r.y-l/2<i.y&&(g=i.y-(r.y-l/2),r.y=d=r.y+g,this.diff=g,this.edgeLabel=!0);break;case"hide":(h==0&&r.y>i.y+i.height||h==vt&&r.y-l/2<s.Y)&&(f=e.Text="")}}if(!ej.util.isNullOrUndefined(a)&&a!=0&&!this.svgRenderer.vmlNamespace){o=i.labelPosition!="inside"?u?o+b/2:o-b/2:u?o-b/2:o+b/2;var f=e.displayText?e.displayText:e.Text,yt=a>360?a-360:a<-360?a+360:a,pt="rotate("+yt+","+o+","+d+")";n(r).attr("transform",pt);n(r).attr("labelRotation",yt);ri=this.svgRenderer.createText(r,f);tt=Math.ceil(ej.EjSvgRender.utils._measureBounds(ri,this).width-ej.EjSvgRender.utils._measureText(f,null,i.font).width);wt=i.labelPosition!="inside"?u?tt/2:-tt/2:u?-tt/2:tt/2;pt="rotate("+yt+","+(o+wt)+","+d+")";n(r).attr({transform:pt,x:o+wt})}if(i.labelIntersectAction||i.enableTrim){if(et!="none"||i.enableTrim){if(i.enableTrim&&b>ti&&f!=""){for(it=1;it<f.toString().length;it++)if(f=e.displayText.toString().substring(0,it-1)+"...",b=ej.EjSvgRender.utils._measureText(f,ni,c).width,b>=ti){f=f.toString().substring(0,it-1)+"...";break}e.displayText=f}}else{this.svgRenderer.drawText(r,e.Text,ht);y=ej.EjSvgRender.utils._measureText(f,null,c);ft=i.opposedPosition?r.x:r.x-y.width;k={x:ft,y:r.y,width:y.width,height:y.height};ut={bounds:k,trimText:f,labelText:e.Text};i.visibleLabels[h].region={bounds:k,trimText:f,labelText:e.Text};this.model.yAxisLabelRegions.push(ut);continue}for(et=i.labelIntersectAction.toLowerCase(),rt=0;rt<h;rt++){var w=i.visibleLabels[rt],ot=0,si=Math.abs(ej.EjSvgRender.utils._getPointXY(w.Value,ei,i.isInversed)*i.height),st=ej.EjSvgRender.utils._measureText(w.Text,s.Height,c).height,v=si*-1+(i.y+i.height)+st/4;v=v+(i.isInversed?st/2:-st/2);this.edgeLabel&&(v=rt==0?v-st/4:v);et=="hide"&&w.Text.toString()!=""&&(i.isInversed?v>r.y-l/4:v<r.y+l/4)?f=e.Text="":et=="multiplerows"&&(i.isInversed?v>r.y-l/4:v<r.y+l/4)&&w.x==r.x&&(u?(ot=i.labelPosition!="inside"?w.x+i._LableMaxWidth.maxWidth+5:w.x-i._LableMaxWidth.maxWidth-5,r.x=ot):(ot=i.labelPosition!="inside"?w.x-i._LableMaxWidth.maxWidth-5:w.x+i._LableMaxWidth.maxWidth+5,r.x=ot))}}i.visibleLabels[h].x=r.x;this.svgRenderer.drawText(r,f,ht);y=ej.EjSvgRender.utils._measureText(f,null,c);ft=u?r.x:r.x-y.width;k={x:ft,y:r.y,width:y.width,height:y.height};ut={bounds:k,trimText:f,labelText:e.Text};i.visibleLabels[h].region={bounds:k,trimText:f,labelText:e.Text};this.model.yAxisLabelRegions.push(ut)}n(ht).appendTo(this.gYaxisEle)},trimText:function(n,t,i){return t--,n=n.substring(0,t-i.length),n+i},_drawXTitle:function(t,i){var ft,f,w,o,ot,st;if(i.title.text!=""&&i.title.text&&i.title.visible){var d=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisTitle_"+t,cursor:"default"}),yt=this.model.elementSpacing+i._LableMaxWidth.height,u=ej.EjSvgRender.utils._measureText(i.title.text,i.width,i.title.font),e=u.height/2,nt=i._opposed,l=i.title.text,b=i._LableMaxWidth,p="middle",r=this.model.elementSpacing,tt=i.title.enableTrim,a=i._isScroll||this.model.zooming.enableScrollbar&&i.scrollbarSettings.visible&&(i.zoomFactor<1||i.zoomPosition>0),v=i.title.maximumTitleWidth,k=i.title.position.toLowerCase(),ut=i.title.alignment.toLowerCase(),w,s=i.tickLinesPosition.toLowerCase(),h=i.labelPosition.toLowerCase(),c=this.model.m_AreaBounds,it=i.title.offset,g,rt,y=this.model.scrollerSize;if(tt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v)))for(ft=v?v:i.width-r*2;u.width>ft;)if(l=this.trimText(l,l.length,"..."),u=ej.EjSvgRender.utils._measureText(l,i.width,i.title.font),l=="..."){l="";break}if(f=n.extend({},ej.EjSvgRender.commonChartEventArgs),w=r+b.height+e+i._multiLevelLabelHeight+i.majorTickLines.size+i.axisLine.width,s=="inside"&&h=="inside"&&(t==0||i.y==c.Height+c.Y||i.y==c.Y)?w=k=="inside"?r+b.height+e+i._multiLevelLabelHeight+i.majorTickLines.size+i.axisLine.width:r+e+i.axisLine.width:(t==0||i.y==c.Width+c.X||i.y==c.X)&&s!="inside"&&h=="inside"?w=k=="inside"?r+b.height+e+i._multiLevelLabelHeight+i.axisLine.width:r+i.majorTickLines.size+i.axisLine.width:(t==0||i.y==c.Width+c.X||i.y==c.X)&&s=="inside"&&h!="inside"?w=k=="inside"?r+e+i.majorTickLines.size+i.axisLine.width:r+b.height+e+i._multiLevelLabelHeight+i.axisLine.width:s!="inside"&&h!="inside"||t!=1?w=k=="inside"?r:r+b.height+e+i.majorTickLines.size+i.axisLine.width+i._multiLevelLabelHeight:s=="inside"||h!="inside"||i.showNextToAxisLine||(w=k=="inside"?r+b.height+e+i._multiLevelLabelHeight+i.axisLine.width:r+e+i.majorTickLines.size+i.axisLine.width+r+r),ut=="far"?(g=i.x+i.width+it,p="end"):ut=="near"?(g=i.x+it,p="start"):g=i.x+i.width/2+it,f.data={title:i.title.text,location:{x:g,y:w},axes:i},this._trigger("axesTitleRendering",f),rt=k=="inside"?(nt?s=="inside"&&h=="outside"?i.y+f.data.location.y-(a?y:0)-i.majorTickLines.size:i.y+f.data.location.y-(a?y:0):s=="outside"&&h=="inside"?(a?y:0)+(i.y-f.data.location.y)+i.majorTickLines.size:(a?y:0)+(i.y-f.data.location.y))+u.height/3.5:(nt?s=="inside"&&h=="outside"?i.y-f.data.location.y-(a?y:0)-i.majorTickLines.size:i.y-f.data.location.y-(a?y:0):s=="outside"&&h=="inside"?(a?y:0)+(f.data.location.y+i.y)-i.majorTickLines.size:(a?y:0)+(f.data.location.y+i.y))+u.height/3.5,o={id:this.svgObject.id+"_XAxisTitle_"+t,x:f.data.location.x,y:rt,fill:i.title.font.color,"font-size":i.title.font.size,"font-family":i.title.font.fontFamily,"font-style":i.title.font.fontStyle,"font-weight":i.title.font.fontWeight,opacity:i.title.font.opacity,"text-anchor":p},this.model.enableCanvasRendering){var ht=jQuery.uaMatch(navigator.userAgent),ct=!!navigator.userAgent.match(/Trident\/7\./),et=ht.browser.toLowerCase();et=="msie"||ct||(o.y=nt?o.y+e/2+1:o.y+e/2+(et=="mozilla"?1:-2))}if(n(this.svgObject).find("#"+this.svgObject.id+"_XAxisTitle_"+t).length>0)n(this.svgObject).find("#"+this.svgObject.id+"_XAxisTitle_"+t).attr(o);else if(tt){if(tt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v))){var lt=p=="middle"?o.x-u.width/2:p=="end"?o.x-u.width:o.x,at={X:lt,Y:o.y,Width:u.width,Height:u.height},vt={Bounds:at,trimText:l,labelText:i.title.text};this.model.xAxisTitleRegion.push(vt);this.svgRenderer.drawText(o,l,d)}}else this.svgRenderer.drawText(o,f.data.title,d);this.model.enableCanvasRendering||(ot=p=="start"?0:p=="end"?u.width:u.width/2,st={id:this.svgObject.id+"_XAxisTitleBorder_"+t,x:f.data.location.x-ot-r,y:rt-u.height+u.height/4,width:u.width+2*r,height:u.height,fill:"transparent","class":"e-xaxistitleborder"},this.svgRenderer.drawRect(st,d));n(d).appendTo(this.gXaxisEle)}},_drawYTitle:function(t,i){var u,et,w,ut,o,st,ht,ct,lt;if(i.title.text!=""&&i.title.text&&i.title.visible){var e=i._opposed,r=this.model.elementSpacing,p="middle",ft=this.model.series.isTransposed,h=i.majorTickLines.size,b=i.title.position.toLowerCase(),c=i._LableMaxWidth,l=this.model.m_AreaBounds,s,f=i.axisLine,g=i.tickLinesPosition.toLowerCase(),k=i.labelPosition.toLowerCase(),a=i.title.text,nt=i.title.enableTrim,pt=this.model.requireInvertedAxes,y,at=i._isScroll,v=i.title.maximumTitleWidth,tt=i.title.offset,it=i.title.alignment.toLowerCase(),d=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTitleGroup_"+t,cursor:"default"}),rt=ej.EjSvgRender.utils._measureText(i.title.text,i.height,i.title.font);if(g=="inside"&&k=="inside"&&(t==1||i.x==l.Width+l.X||i.x==l.X)?s=b=="inside"?e?i.x-(3*r+c.width+i._multiLevelLabelHeight+h+f.width):i.x+(3*r+c.width+i._multiLevelLabelHeight+h+f.width):e?i.x+(3*r+f.width-5):i.x-(3*r+f.width):(t==1||i.x==l.Width+l.X||i.x==l.X)&&g!="inside"&&k=="inside"?s=b=="inside"?e?i.x-(3*r+c.width+axis._multiLevelLabelHeight+f.width):i.x+(3*r+c.width+i._multiLevelLabelHeight+f.width):e?i.x+(3*r+h+f.width):i.x-(3*r+h+f.width):(t==1||i.x==l.Width+l.X||i.x==l.X)&&g=="inside"&&k!="inside"?s=b=="inside"?e?i.x-(3*r+h+f.width):i.x+(3*r+h+f.width)+(i.showNextToAxisLine?k=="inside"?-i._multiLevelLabelHeight:i._multiLevelLabelHeight:-r):e?i.x+(3*r+i._multiLevelLabelHeight+c.width+f.width):i.x-(3*r+c.width+f.width+i._multiLevelLabelHeight):(i.tickLinesPosition!="inside"&&i.labelPosition!="inside"||t!=1)&&(s=b=="inside"?e?i.x-(r+f.width+h):i.x+(r+(i.showNextToAxisLine?0:c.width)+f.width+h):e?i.x+(3*r+i._multiLevelLabelHeight+c.width+h+f.width):i.x-(3*r+c.width+i._multiLevelLabelHeight+h+f.width)),u=ej.EjSvgRender.utils._measureText(a,i.height,i.title.font),nt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v)))for(et=v?v:i.height-r*2;u.width>et;)if(a=this.trimText(a,a.length,"..."),u=ej.EjSvgRender.utils._measureText(a,i.height,i.title.font),a=="..."){a="";break}if(s=i.opposedPosition?s:s-(at?this.model.scrollerSize:0),document.documentMode===8&&(s=e?s+u.width/2-r:s-u.width/2+r),w=n.extend({},ej.EjSvgRender.commonChartEventArgs),w.data={title:i.title.text,location:{x:rt.width/2,y:0},axes:i},this._trigger("axesTitleRendering",w),y=w.data.location.y+(i.y+i.height)+i.height/-2,it=="near"?(y=i.y+i.height-tt,p=e||ft?"end":"start"):it=="far"?(y=i.y-tt,p=e||ft?"start":"end"):it=="center"&&(y=i.y+i.height/2-tt),ut=e?90:-90,o={id:this.svgObject.id+"_YAxisTitle_"+t,x:s,y:y,fill:i.title.font.color,labelRotation:ut,transform:"rotate("+ut+","+s+","+y+")","font-size":i.title.font.size,"font-family":i.title.font.fontFamily,"font-style":i.title.font.fontStyle,"font-weight":i.title.font.fontWeight,opacity:i.title.font.opacity,"text-anchor":p,"dominant-baseline":"middle"},this.model.enableCanvasRendering){var vt=jQuery.uaMatch(navigator.userAgent),yt=!!navigator.userAgent.match(/Trident\/7\./),ot=vt.browser.toLowerCase();ot=="msie"||yt||(o.x=e?o.x-rt.height/4+1:o.x+rt.height/4+(ot=="mozilla"?1:-2))}n(this.svgObject).find("#"+this.svgObject.id+"_YAxisTitle_"+t).length>0?n(this.svgObject).find("#"+this.svgObject.id+"_YAxisTitle_"+t).attr(o):nt?nt&&(ej.util.isNullOrUndefined(v)||v>0||isNaN(v))&&(st=this.svgRenderer.vmlNamespace?{X:o.x-u.width/2,Y:o.y+u.height/2,Width:u.width,Height:u.height}:{X:o.x-u.height/2,Y:o.y+u.width/2,Width:u.height/2,Height:u.width},ht={Bounds:st,trimText:a,labelText:i.title.text},this.model.yAxisTitleRegion.push(ht),this.svgRenderer.drawText(o,a,d)):this.svgRenderer.drawText(o,w.data.title,d);this.model.enableCanvasRendering||(ct=p=="start"?u.width:p=="end"?0:u.width/2,lt={id:this.svgObject.id+"_YAxisTitleBorder_"+t,x:o.x-u.height+u.height/2,y:o.y-ct-r,width:u.height,height:u.width+2*r,fill:"transparent","class":"e-yaxistitleborder"},this.svgRenderer.drawRect(lt,d));n(d).appendTo(this.gYaxisEle)}}};ej.EjStripline.prototype={_drawStripline:function(n,t,i,r){var u=t.start<n.range.min?n.range.min:t.start,f=t.end>n.range.max?n.range.max:t.end,e=0,c=0,ft=0,o=0,w=0,k=0,h=0,p=0,l=0,a=0,s,d,v,et,g,nt,tt,ot,it,rt,ut,st,y,b;if(t.visible&&(this.model._stripeline=!0,s=t.zIndex=="over"?this.gStriplineOver:this.gStriplineBehind,s=ej.util.isNullOrUndefined(s)?"":s,d=!0,n.orientation.toLowerCase()=="horizontal"?(v=0,t.startFromAxis?(et=ej.util.isNullOrUndefined(t.offset)?n.visibleRange.min:n.visibleRange.min+t.offset,v=(et-n.visibleRange.min)/n.visibleRange.delta*n.width+n.x,p=(et+(ej.util.isNullOrUndefined(t.width)?0:t.width)-n.visibleRange.min)/n.visibleRange.delta*n.width):ej.util.isNullOrUndefined(u)&&(ej.util.isNullOrUndefined(f)||ej.util.isNullOrUndefined(t.width))?d=!1:(u=jQuery.type(u)=="date"?u.getTime():u,ej.util.isNullOrUndefined(f)||jQuery.type(f)!="date"||(f=f.getTime()),v=ej.EjSvgRender.utils._getPointXY(u,n.visibleRange,n.isInversed)*n.width+n.x,g=ej.EjSvgRender.utils._getPointXY(f,n.visibleRange,n.isInversed)*n.width+n.x,nt=ej.EjSvgRender.utils._getPointXY(u+(ej.util.isNullOrUndefined(t.width)?0:t.width),n.visibleRange,n.isInversed)*n.width+n.x,p=(n.isInversed?g<nt:g>nt)?Math.abs(v-g):Math.abs(v-nt)),h=p,c=this.chart.model.m_AreaBounds.Height,e=n.isInversed?v-p:v,o=this.chart.model.m_AreaBounds.Y,ft=-90,tt=ej.EjSvgRender.utils._measureText(t.text,null,t.font).height,t.textAlignment=="middletop"?(l=e+tt,a=Math.abs(o+c/2)):t.textAlignment=="middlecenter"?(l=Math.floor(e+h/2)+tt/3,a=Math.abs(o+c/2)):t.textAlignment=="middlebottom"&&(l=e+h-tt,a=Math.abs(o+c/2))):(t.startFromAxis?(ot=ej.util.isNullOrUndefined(t.offset)?n.visibleRange.min:n.visibleRange.min+t.offset,w=n.y+n.height-(ot-n.visibleRange.min)/n.visibleRange.delta*n.height,p=(ot+(ej.util.isNullOrUndefined(t.width)?0:t.width)-n.visibleRange.min)/n.visibleRange.delta*n.height,k=p):ej.util.isNullOrUndefined(u)&&(ej.util.isNullOrUndefined(f)||ej.util.isNullOrUndefined(t.width))?d=!1:(u=jQuery.type(u)=="date"?u.getTime():u,ej.util.isNullOrUndefined(f)||jQuery.type(f)!="date"||(f=f.getTime()),w=n.y+n.height-ej.EjSvgRender.utils._getPointXY(u,n.visibleRange,n.isInversed)*n.height,it=n.y+n.height-ej.EjSvgRender.utils._getPointXY(ej.util.isNullOrUndefined(f)?0:f,n.visibleRange,n.isInversed)*n.height,rt=n.y+n.height-ej.EjSvgRender.utils._getPointXY(u+(ej.util.isNullOrUndefined(t.width)?0:t.width),n.visibleRange,n.isInversed)*n.height,k=(n.isInversed?it>rt:it<rt)?Math.abs(w-it):Math.abs(w-rt)),c=k,e=this.chart.model.m_AreaBounds.X,h=this.chart.model.m_AreaBounds.Width,o=w+(n.isInversed?0:-k),ut=ej.EjSvgRender.utils._measureText(t.text,h,t.font).height,t.textAlignment=="middletop"?(l=e+h/2,a=o+ut):t.textAlignment=="middlecenter"?(l=e+h/2,a=Math.abs(o+c/2)+ut/3):t.textAlignment=="middlebottom"&&(l=e+h/2,a=o+c-ut)),d))if(ej.util.isNullOrUndefined(t.imageUrl)){var ht={id:s.id+"_striplineRect_"+i+"_"+r,x:e,y:o,width:h,height:c,fill:t.color,opacity:t.opacity,"stroke-width":t.borderWidth,stroke:t.borderWidth==0?"transparent":t.borderColor},ct={id:s.id+"_striplineRectText_"+i+"_"+r,x:l,y:a,fill:t.font.color,transform:"rotate("+ft+","+l+","+a+")",labelRotation:ft,"font-size":t.font.size,"font-family":t.font.fontFamily,"font-style":t.font.fontStyle,"font-weight":t.font.fontWeight,opacity:t.font.opacity,"text-anchor":"middle"},lt={X:e,Y:o,Width:h,Height:c},at=t.zIndex=="over"?!0:!1;ej.EjSvgRender.utils.AddRegion(this.chart,lt,at);this.chart.model.enableCanvasRendering?(y=this.chart.svgObject.getContext("2d"),b=n.orientation.toLowerCase()=="horizontal"?{X:n.x,Y:o,Width:n.width,Height:this.chart.model.m_AreaBounds.Height}:{X:e,Y:n.y,Width:this.chart.model.m_AreaBounds.Width,Height:n.height},y.save(),y.beginPath(),y.rect(b.X,b.Y,b.Width,b.Height),y.clip(),this.svgRenderer.drawRect(ht,s),this.svgRenderer.drawText(ct,t.text,s),y.closePath(),y.restore()):(this.svgRenderer.drawRect(ht,s),this.svgRenderer.drawText(ct,t.text,s))}else st={height:c,width:h,href:t.imageUrl,x:e,y:o,id:s.id+"_backImage",visibility:"visible",preserveAspectRatio:"none"},this.svgRenderer.drawImage(st,s)}}}(jQuery);ej.EjLegendRender=function(n){this.chartObj=n},function(n){ej.EjLegendRender.prototype={sumofArray:function(n){for(var i=0,r=n.length,t=0;t<r;t++)i+=n[t];return i},legendRectSpace:function(n,t){var r=n.Width-10,u=n.Height-10,i=!1;return Math.ceil(t.Width)>=r&&Math.ceil(t.Height)>=u&&(i=!0),i},drawLegendTitle:function(){var f=this.chartObj,e=f.model,h=e.legend,c=e.LegendBounds,l=e.elementSpacing,u=h.title,a=ej.EjSvgRender.utils._measureText,t=u.font,i=c.Width,o=a(u.text,null,t),r=o.width,v=o.height,y=u.textAlignment.toLowerCase(),n=0,p=l+v/2,s;switch(y){case"far":n=i-r-n;break;case"center":n=i/2-r/2}n<0&&(n=0,i=r);i<r+n&&(i=r+n);s={id:f.svgObject.id+"_LegendTitleText",x:n,y:p,fill:t.color,"font-size":t.size,"font-style":t.fontStyle,"font-family":t.fontFamily,"font-weight":t.fontWeight,"text-anchor":"start",lgndCtx:!0};f.svgRenderer.drawText(s,u.text,this.chartObj.gLegendEle)},drawLegendItem:function(t,i,r){var u=this.chartObj,o=u.model,v=o.legend,y=v.textOverflow.toLowerCase(),ht=v.textWidth,c=o.LegendBounds,ut=o.elementSpacing,ct=v.border.width,vt=ej.EjSvgRender.utils._measureText,yt=ej.EjSvgRender,p=u.svgRenderer,l=t.Font,pt=o.symbolShape,wt=o.enableCanvasRendering,w=v.itemStyle,a=vt(t.Text,c.Width,l).height,b={startX:i+w.width/2,startY:r+(a>w.height?a:w.height)/2},d=t.PointIndex,ft=t.SeriesIndex,et=d?d:ft,ot=o.series[ft],bt=u.svgObject,g=t.LegendStyle,ni=jQuery.uaMatch(navigator.userAgent),ti=!!navigator.userAgent.match(/Trident\/7\./),lt,h,nt,at,s=ot.type.toLowerCase(),e,tt,it,rt,st,f;for(name in pt)if(t.Shape.toLowerCase()==name.toLowerCase()){e=name.toLowerCase()=="seriestype"?"SeriesType":name;break}if(e=="SeriesType"&&((s=="radar"||s=="polar")&&(tt=ot.drawType,e=tt.capitalizeFirstString()),s=="scatter"&&(tt=ot.marker.shape,e=tt.capitalizeFirstString()),t.drawType&&(e="SeriesType"),u.vmlRendering&&(s=="pie"||s=="doughnut"||s=="pieofpie")&&(e="Circle")),e=="None"&&(e=s=="pie"||s=="doughnut"||s=="pieofpie"?"Circle":"Rectangle"),et=ej.util.isNullOrUndefined(d)?ft:d,u.gLegendItemEle=p.createGroup({id:bt.id+"_Legend"+et,cursor:"pointer"}),t.CommonEventArgs.data.gLegendItemEle=u.gLegendItemEle,nt=n.extend(!0,{},t.CommonEventArgs.data),nt.model=u.model,at=nt.style,!t.CommonEventArgs.cancel){if(startLocation=yt.chartSymbol["_draw"+e](b,at,nt,u.gLegendItemEle),lt=g.Color&&g.Color.toString().toLowerCase()!=="gray"&&wt?l.color:g.Color&&g.Color.toLowerCase()!=="gray"?l.color:"gray",h=t,st=h.Text.length,(v.shape=="seriestype"||v.shape=="seriesType")&&(i+=ut/2),f={id:this.chartObj.svgObject.id+"_LegendItemText"+et,x:w.width+i+ut/2,y:b.startY,fill:lt,"font-size":l.size,"font-style":l.fontStyle,"font-family":l.fontFamily,"font-weight":l.fontWeight,"text-anchor":"start",lgndCtx:!0},f.y=b.startY+a/4,y=="wrap"||y=="wrapandtrim")for(f.y=f.y-a,k=0;k<st;k++)f.y=f.y+a,p.drawText(f,h.Text[k],u.gLegendItemEle),y=="wrapandtrim"&&(it={x:f.x+c.X,y:f.y+c.Y,height:a*st,width:ht},rt={bounds:it,trimText:h.Text,labelText:h.displayText},o.legendTextRegion.push(rt));else y=="trim"&&(it={x:f.x+c.X,y:f.y+c.Y,height:a+ut,width:ht},rt={bounds:it,trimText:h.Text,labelText:h.displayText},o.legendTextRegion.push(rt)),p.drawText(f,h.Text,u.gLegendItemEle);p.append(u.gLegendItemEle,u.gLegendEle);legendbound={X:c.X+ct,Y:c.Y+ct};i=startLocation?startLocation:i;var kt={X:i,Y:r,_Width:t.Bounds._Width,Width:t.Bounds.Width,Height:t.Bounds.Height},dt={LegendBound:legendbound,ItemBound:kt},gt={LegendItem:t,Location:b,SymbolShape:e,Style:t.CommonEventArgs.data.style,Bounds:dt};o.legendRegion.push(gt)}},drawLegend:function(t){var o=this.chartObj,u=o.model,e=u.legend,ai=u.LegendViewerBounds,i=u.LegendBounds,r=u.LegendActualBounds,gt=u.AreaType,l=e.position.toLowerCase(),lt=e.alignment.toLowerCase(),h=u.elementSpacing,vi=u.svgWidth,yi=u.svgHeight,nt=u.title,pi=nt.font.size,d=nt.subTitle,wi=nt.subTitle.font.size,rt=e.title,c=e.border.width,ni=ej.EjSvgRender.utils._measureText,ti=u.margin,p=u.border.width,y=u.legendCollection,at=y.length,w=vi-p*2,g=yi-p*2,k=e.itemPadding>0?e.itemPadding:0,vt=10,ut=10,bi=d.text==""||!d.visible||!nt.visible?0:ni(d.text,w-ti.left-ti.right,d.font).height+h,ii=u._titleLocation?u._titleLocation.Y:0+bi,ri=ni(rt.text,null,rt.font),ft=ri.height,ki=ri.width,ui=u._rowDefinitions,yt=0,fi,et,ei=u._columnDefinitions,di=this.sumofArray(ui.farSizes),gi=this.sumofArray(ui.nearSizes),fr=this.sumofArray(ei.farSizes),nr=this.sumofArray(ei.nearSizes),tt=!1,a=u.m_AreaBounds,ot=e.enableScrollbar,f=n(o.legendContainer),tr=n("#ScrollerParent_vertical_"+o._id).length>0?18:0,ir=n("#ScrollerParent_horizontal_"+o._id).length>0?18:0,rr=n(o.legendSvgContainer),oi=1.2,si=10,pt=10,nt=u.title,d=u.title.subTitle,wt=nt.visible?parseInt(pi)*oi:0,st=d.visible?parseInt(wi)*oi:0,wt=u.titleWrapTextCollection&&u.titleWrapTextCollection.length>1?u._titleLocation._height*u.titleWrapTextCollection.length-1:wt,st=u.subTitleWrapTextCollection&&u.subTitleWrapTextCollection.length>1?u._subTitleLocation.size.height:st,ht,hi,bt,kt,s,it;if(u.legend.border&&!d.text&&(st=0,pt=5),l=="right"||l=="left"?vt=10:ut=ot?g>200?10:g>100?5:0:10,ai.Height+=ft,i.Height+=ft,e.visible){if(l!="custom"){if(gt=="cartesianaxes")switch(l){case"bottom":i.Y=a.Y+a.Height+nr-h/2+ir;break;case"top":i.Y=ii==0?p+h:wt+si+st+pt+h;break;case"right":i.X=a.X+a.Width+di+h*2;break;case"left":i.X=a.X-gi-r.Width-h/2-c*2-tr}else switch(l){case"bottom":i.Y=g-(r.Height+c)-h*2;break;case"top":i.Y=ii==0?p+h:wt+si+st+pt+h;break;case"right":i.X=w-r.Width-h*2;break;case"left":i.X=p+h*2}if(!u.enable3D&>=="cartesianaxes"&&t._crossAxisOverlap!=null)for(ht=0,hi=u._axes.length;ht<hi;ht++){var v=u._axes[ht],b=t.axes[v.name]._bounds,ct=v.orientation.toLowerCase()==="horizontal";l=="top"&&ct&&v._opposed&&v.y-b<i.Y+i.Height?i.Y-=i.Y+i.Height-v.y+b:l=="bottom"&&ct&&!v._opposed&&v.y+b>i.Y?i.Y+=v.y+b-i.Y:l=="left"&&!ct&&v._opposed&&v.x-b<i.X+i.Width?i.X+=v.x+b-i.X:l=="right"&&!ct&&!v._opposed&&v.x+b>i.X&&(i.X-=i.X+i.Width-v.x+b)}if(l=="left"||l=="right")if(ot)switch(lt){case"center":i.Y=a.Height/2-r.Height/2+a.Y-c;break;case"near":i.Y=a.Y;break;case"far":i.Y=a.Y+a.Height-r.Height-c*2}else switch(lt){case"center":i.Y=g/2-(r.Height+c*2)/2+h/2;break;case"near":i.Y=p+h*2;break;case"far":i.Y=g-(r.Height+c)-h*2}else switch(lt){case"center":i.X=w/2-(r.Width+c*2)/2+h/2;break;case"near":i.X=p+h*2;break;case"far":i.X=w-(r.Width+c)-h*2}}else i.Y=e.location.y<g?e.location.y:0,i.X=e.location.x<w?e.location.x:0;if(ot)if(l=="right"||l=="left"){if(i.Y<a.Y||r.Height+c*2>=a.Height)for(bt=c*2,s=0;s<at;s++)if(bt+=y[s].Bounds.Height+k,bt>a.Height){r.Height=a.Height-c*2;i.Y=a.Y;break}}else if(c*2+r.Width>=w)for(kt=c*2,s=0;s<at;s++)if(kt+=y[s].Bounds.Width+k,kt>w){r.Width=w-c*2-r.vScrollSize-p*2;i.X=w/2-(r.Width+c*2)/2+h/2;break}for(o.legendSvgContainer.height=i.Height,o.legendSvgContainer.width=Math.max(ki,i.Width),currentX=fi=vt,currentY=et=ut,rt.text!=""&&rt.text&&(this.drawLegendTitle(),currentY=et=ut+ft),s=0;s<at;s++)(e.rowCount<e.columnCount||e.rowCount==e.columnCount)&&(l=="top"||l=="bottom"||l=="custom")?(currentX+y[s].Bounds.Width>i.Width+fi&&(currentX=vt,currentY+=y[s].Bounds.Height+k),this.drawLegendItem(y[s],currentX,currentY),currentX+=y[s].Bounds.Width+k):(currentY+y[s].Bounds.Height+k+ft+p>i.Height+et&&(currentY=et,currentX+=yt+k),this.drawLegendItem(y[s],currentX,currentY),currentY+=y[s].Bounds.Height+k,yt=Math.max(yt,y[s].Bounds.Width));var ci=o.legendContainer[0].offsetLeft,li=n("#"+o._id).offset(),dt=o.vmlRendering?ci<=0?i.X:ci-li.left:n(o.svgObject).offset().left-li.left,ur=o.vmlRendering?dt:i.X+(dt<=0?0:dt);f.attr("style","");e._ejScroller&&n("#"+f[0].id).ejScroller("instance").destroy();f.show();f.css({position:"absolute",background:e.background,left:ur,top:i.Y,width:r.Width,height:r.Height,"border-width":e.border.width,"border-color":e.border.color,"border-style":"solid"});f.addClass("e-legendborder");rr.css({height:i.Height,width:i.Width});i.Height=i.Height-(20-ut*2);it=this.legendRectSpace(i,r);ot&&(e._ejScroller?!it&&(i.Width>Math.ceil(r.Width)||i.Height>Math.ceil(r.Height))?(n("#"+f[0].id).ejScroller({scrollTop:o.scrolltop,scrollLeft:o.scrollleft,height:r.Height,width:r.Width}),tt=!0,i.Height>Math.ceil(r.Height)&&r.vScrollSize==0&&(vScrollSize=f[0].offsetWidth+c*5-f[0].clientWidth,f.css({width:r.Width+vScrollSize}))):e._ejScroller=!1:!it&&i.Width>Math.ceil(r.Width)&&i.Height>Math.ceil(r.Height)?(f.css({overflow:"scroll"}),tt=!0):(!it&&i.Height>Math.ceil(r.Height)&&r.vScrollSize>=0&&(f[0].style.overflowY="scroll",f[0].style.overflowX="hidden",r.vScrollSize==0&&(vScrollSize=f[0].offsetWidth-c*2-f[0].clientWidth,f.css({width:r.Width+vScrollSize})),tt=!0),!it&&i.Width>Math.ceil(r.Width)&&r.hScrollSize>=0&&(f[0].style.overflowX="scroll",f[0].style.overflowY="hidden",r.hScrollSize==0&&(hScrollSize=f[0].offsetHeight-c*2-f[0].clientHeight,f.css({height:r.Height+hScrollSize})),tt=!0)));o.svgRenderer.append(o.gLegendEle,o.legendSvgContainer);tt||f.css({width:r.Width-r.vScrollSize,height:r.Height-r.hScrollSize});e._ejScroller||(o.scrolltop!=undefined&&f.scrollTop(o.scrolltop),o.scrollleft!=undefined&&f.scrollLeft(o.scrollleft))}else f.hide()}}}(jQuery);ej.seriesTypes={};ej.EjSeriesRender=function(){};ej.indicatorTypes={};ej.EjIndicatorRender=function(){};ej.trendlineTypes={};ej.EjTrendLineRenderer=function(){},function(t){function r(n,i){var r=function(){};return r.prototype=new n,t.extend(r.prototype,i),r}ej.EjTrendLineRenderer.prototype={draw:function(n,i,r){var u,f;return this.chartObj=r,u=t.inArray(n,i.trendlines),n._isTransposed=r.model.requireInvertedAxes,n.xAxis=i.xAxis,n.yAxis=i.yAxis,f=n.type.toLowerCase(),f=="linear"||f=="movingaverage"?this.calculateLineDirection(n,i,u):this.calculateSplineDirection(n,i,u),!1},calculateSplineDirection:function(n,t,i){for(var a="",h=ej.EjSvgRender.utils._getStringBuilder(),v=!0,c=n.points,y=ej.EjSeriesRender.prototype.naturalSpline(c),r=null,u=null,p=-1,l,g=c.length,f=0;f<g;f++){if(l=f,u=c[f],r!=null){var w=null,b=null,k=ej.EjSeriesRender.prototype.getBezierControlPoints(r,u,y[p],y[l],0);w=k.controlPoint1;b=k.controlPoint2;var d=ej.EjSvgRender.utils._getPoint(r,n),e=ej.EjSvgRender.utils._getPoint(u,n),o=ej.EjSvgRender.utils._getPoint(w,n),s=ej.EjSvgRender.utils._getPoint(b,n),nt=this.chartObj;v?(h.append("M "+d.X+" "+d.Y+" C "+o.X+" "+o.Y+" "+s.X+" "+s.Y+" "+e.X+" "+e.Y+" "),v=!1):h.append("C "+o.X+" "+o.Y+" "+s.X+" "+s.Y+" "+e.X+" "+e.Y+" ")}r=u;p=l}return a=h.toString(),this._drawLinePath(n,t,a,i),!1},calculateLineDirection:function(n,t,i){for(var r,e,u=ej.EjSvgRender.utils._getStringBuilder(),o=!1,s,h=n.points.length,f=0;f<h;f++)s=n.points[f],r=ej.EjSvgRender.utils._getPoint(s,n),o?u.append("L "+r.X+" "+r.Y+" "):(u.append("M "+r.X+" "+r.Y+" "),u.append("L "+r.X+" "+r.Y+" "),o=!0);return e=u.toString(),this._drawLinePath(n,t,e,i),!1},_drawLinePath:function(n,t,i,r){var u=[],f;return u[0]=n.xAxis.x,u[1]=n.yAxis.y,i!=""&&(f={id:this.chartObj.svgObject.id+"_"+n.seriesIndex+"_"+r+"_"+n.name.replace(/[^a-zA-Z ]/g,""),fill:"none","stroke-dasharray":n.dashArray,"stroke-width":n.width,stroke:n.fill,opacity:n.opacity,d:i},n.id=f.id,this.chartObj.svgRenderer.drawPath(f,t.gTrendGroupEle,u)),this.chartObj.svgRenderer.append(t.gTrendGroupEle,this.chartObj.gTrendlinesGroupEle[n.seriesIndex]),!1},calculateTrendLineSegment:function(n,i,r,u){var s=u.model,r,f=t.extend([],n.points),o=i.type.toLowerCase(),e;i.backwardForecast=i.backwardForecast<0?0:i.backwardForecast;i.forwardForecast=i.forwardForecast<0?0:i.forwardForecast;f=f.sort(function(n,t){return n.xValue>t.xValue?1:t.xValue>n.xValue?-1:0});switch(o){case"linear":this.updateTrendSource(f,i);this.calculateLinearTrendline(n,i,r);break;case"exponential":this.updateExponentialTrendSource(f,i);this.calculateExponentialTrendline(n,i,r);break;case"logarithmic":this.updateLogarithmicTrendSource(f,i);this.calculateLogarithmicTrendline(n,i,r);break;case"power":this.updatePowerTrendSource(f,i);this.calculatePowerTrendline(n,i,r);break;case"polynomial":e=n.points.length;i.polynomialOrder=e<=i.polynomialOrder?e:i.polynomialOrder;i.polynomialOrder=i.polynomialOrder<2?2:i.polynomialOrder;i.polynomialOrder=i.polynomialOrder>6?6:i.polynomialOrder;e>1&&(this.updateTrendSource(f,i),this.calculatePolynomialTrendline(n,i,r));break;case"movingaverage":this.updateMovingAverageTrendSource(f,i);this.calculateMovingAverageTrendline(n,i,r)}return n.points.length>1&&this.calculateTrendLineRange(i,r),!1},updateTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(u),t.yValues.push(i.y));return this.calculateSumXAndYValue(t),!1},calculateLinearTrendline:function(n,t,i){var f=t.xValues.length,r,u,e,o;return t.points=[],f>1&&(i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),u=this._increaseDateTimeInterval(t.xPoints[f-1],t.forwardForecast,i._intervalType)):(r=t.xPoints[0]-t.backwardForecast,u=t.xPoints[f-1]+t.forwardForecast),e=t.slope*r+t._intercept,o=t.slope*u+t._intercept,t.points.push({x:r,xValue:r,y:e,YValues:[],visible:!0}),t.points.push({x:u,xValue:u,y:o,YValues:[],visible:!0}),t.points[0].YValues[0]=t.points[0].y,t.points[1].YValues[0]=t.points[1].y),!1},calculateTrendLineRange:function(n,t){var i=n.points.length,u,r;for(n.minY=n.points[0].y,n.maxY=n.points[i-1].y,t.setRange||(n.backwardForecast>0&&t._valueType!="category"&&i>1&&(t.range.min=t.range.min>n.points[0].x?n.points[0].x:t.range.min,t.visibleRange.min=t.range.min),n.forwardForecast>0&&i>1&&(t.range.max=t.range.max<n.points[i-1].x?n.points[i-1].x:t.range.max,t.visibleRange.max=t.range.max)),r=0;r<i;r++)u=n.points[r].y,n.minY=Math.min(n.minY,u),n.maxY=Math.max(n.maxY,u);return!1},calculateSumXAndYValue:function(n){for(var y=n.points,e=n.xPoints.length,u=n.type.toLowerCase(),r,a,i=0,o=0,f=0,l=0,v=0,s=0,h=n.xValues,c=n.yValues,t=0;t<e;t++)i=i+h[t],o=o+c[t],s=s+h[t]*c[t],l=l+h[t]*c[t],f=f+h[t]*h[t],v=v+c[t]*c[t];if(ej.util.isNullOrUndefined(n.intercept)||u!="linear"&&u!="exponential"&&u!="polynomial")r=(e*l-i*o)/(e*f-i*i),a=u=="exponential"||u=="power"?Math.exp((o-r*i)/e):(o-r*i)/e,n._intercept=a;else{switch(u){case"polynomial":r=(s-Math.log(n.intercept)*i)/f*3;break;case"linear":r=(s-n.intercept*i)/f;break;case"exponential":r=(s-Math.log(n.intercept)*i)/f}n._intercept=n.intercept}return n.slope=r,!1},_increaseDateTimeInterval:function(n,t,i){var r=new Date(n);return i.toLowerCase()=="days"?r.setDate(n.getDate()+t):i.toLowerCase()=="hours"?r.setHours(n.getHours()+t):i.toLowerCase()=="milliseconds"?r.setMilliseconds(n.getMilliseconds()+t):i.toLowerCase()=="seconds"?r.setSeconds(n.getSeconds()+t):i.toLowerCase()=="minutes"?r.setMinutes(n.getMinutes()+t):i.toLowerCase()=="months"?r.setMonth(n.getMonth()+t):i.toLowerCase()=="years"&&r.setYear(n.getFullYear()+t),r}};ej.ejLinear=r(ej.EjTrendLineRenderer);ej.trendlineTypes.linear=ej.ejLinear;ej.Exponential=r(ej.EjTrendLineRenderer,{updateExponentialTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(u),t.yValues.push(Math.log(i.y)));return this.calculateSumXAndYValue(t),!1},calculateExponentialTrendline:function(n,t,i){var e=t.xValues.length,r,u,f,o,s,h,c=Math.round(e/2);if(t.points=[],e>1){i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=r.getTime(),u=t.xPoints[c-1],s=u.getTime(),f=this._increaseDateTimeInterval(t.xPoints[e-1],t.forwardForecast,i._intervalType),h=f.getTime()):(r=o=t.xPoints[0]-t.backwardForecast,u=s=t.xPoints[c-1],f=h=t.xPoints[e-1]+t.forwardForecast);var l=t._intercept*Math.exp(t.slope*r),a=t._intercept*Math.exp(t.slope*u),v=t._intercept*Math.exp(t.slope*f);t.points.push({x:r,xValue:o,y:l,YValues:[],visible:!0});t.points.push({x:u,xValue:s,y:a,YValues:[],visible:!0});t.points.push({x:f,xValue:h,y:v,YValues:[],visible:!0});t.points[0].YValues[0]=t.points[0].y;t.points[1].YValues[0]=t.points[1].y;t.points[2].YValues[0]=t.points[2].y}return!1}});ej.trendlineTypes.exponential=ej.Exponential;ej.Logarithmic=r(ej.EjTrendLineRenderer,{updateLogarithmicTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(Math.log(u)),t.yValues.push(i.y));return this.calculateSumXAndYValue(t),!1},calculateLogarithmicTrendline:function(n,t,i){var e=t.xValues.length,r,u,f,o,s,h,c=Math.round(e/2);if(t.points=[],e>1){i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=r.getTime(),u=t.xPoints[c-1],s=u.getTime(),f=this._increaseDateTimeInterval(t.xPoints[e-1],t.forwardForecast,i._intervalType),h=f.getTime()):(r=o=t.xPoints[0]-t.backwardForecast,u=s=t.xPoints[c-1],f=h=t.xPoints[e-1]+t.forwardForecast);var l=t._intercept+t.slope*Math.log(r),a=t._intercept+t.slope*Math.log(u),v=t._intercept+t.slope*Math.log(f);t.points.push({x:r,xValue:o,y:l,YValues:[],visible:!0});t.points.push({x:u,xValue:s,y:a,YValues:[],visible:!0});t.points.push({x:f,xValue:h,y:v,YValues:[],visible:!0});t.points[0].YValues[0]=t.points[0].y;t.points[1].YValues[0]=t.points[1].y;t.points[2].YValues[0]=t.points[2].y}return!1}});ej.trendlineTypes.logarithmic=ej.Logarithmic;ej.Power=r(ej.EjTrendLineRenderer,{updatePowerTrendSource:function(n,t){var f=n.length,i,u,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],r=0;r<f;r++)i=n[r],i.isEmpty||(t.xPoints.push(i.xValue),u=typeof i.xValue=="number"?i.xValue:Date.parse(i.xValue),t.xValues.push(Math.log(u)),t.yValues.push(Math.log(i.y)));return this.calculateSumXAndYValue(t),!1},calculatePowerTrendline:function(n,t,i){var e=t.xValues.length,r,u,f,o,s,h,l=Math.round(e/2),c;if(t.points=[],e>1){i._valueType.toLowerCase()=="datetime"?(r=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=r.getTime(),u=t.xPoints[l-1],s=u.getTime(),f=this._increaseDateTimeInterval(t.xPoints[e-1],t.forwardForecast,i._intervalType),h=f.getTime()):(c=t.xPoints[0]-t.backwardForecast,r=o=c>-1?c:0,u=s=t.xPoints[l-1],f=h=t.xPoints[e-1]+t.forwardForecast);var a=t._intercept*Math.pow(r,t.slope),v=t._intercept*Math.pow(u,t.slope),y=t._intercept*Math.pow(f,t.slope);t.points.push({x:r,xValue:o,y:a,YValues:[],visible:!0});t.points.push({x:u,xValue:s,y:v,YValues:[],visible:!0});t.points.push({x:f,xValue:h,y:y,YValues:[],visible:!0});t.points[0].YValues[0]=t.points[0].y;t.points[1].YValues[0]=t.points[1].y;t.points[2].YValues[0]=t.points[2].y}return!1}});ej.trendlineTypes.power=ej.Power;ej.Polynomial=r(ej.EjTrendLineRenderer,{calculatePolynomialTrendline:function(n,t,i){var f=t.polynomialOrder,c,l,e,s,h,a,o,v,u,r;for(t.polynomialSlopes=new Array(f+1),c=t.xValues.length,u=0;u<c;u++)for(o=t.xValues[u],l=t.yValues[u],r=0;r<=f;++r)t.polynomialSlopes[r]||(t.polynomialSlopes[r]=0),t.polynomialSlopes[r]+=Math.pow(o,r)*l;for(e=new Array(1+2*f),s=new Array(f+1),h=0;h<f+1;h++)s[h]=new Array(3);for(a=0,u=0;u<c;++u)for(o=1,v=t.xValues[u],r=0;r<e.length;++r)e[r]||(e[r]=0),e[r]+=o,o*=v,++a;for(u=0;u<=f;++u)for(r=0;r<=f;++r)s[u][r]=e[u+r];return this.gaussJordanEliminiation(s,t.polynomialSlopes)||(t.polynomialSlopes=null),this.createPolynomialSegments(n,i,t),!1},createPolynomialSegments:function(n,t,i){var f=i.polynomialSlopes,e,u,c;if(f!=null){var o=i.xValues.length,a=Math.round(o/2),s=1,r,l=f.length,h=t._valueType.toLowerCase();for(i.points=[],e=1;e<=l;e++)e==1?(h=="datetime"?(u=this._increaseDateTimeInterval(i.xPoints[0],-i.backwardForecast,t._intervalType),r=u.getTime()):u=r=i.xPoints[0]-i.backwardForecast,c=this.getPolynomialYValue(f,r)):e==f.length?(h=="datetime"?(u=this._increaseDateTimeInterval(i.xPoints[o-1],i.forwardForecast,t._intervalType),r=u.getTime()):u=r=i.xPoints[o-1]+i.forwardForecast,c=this.getPolynomialYValue(f,r)):(s+=(o+i.forwardForecast)/f.length,h=="category"?u=r=i.xPoints[0]+(s-1):(u=r=i.xPoints[parseInt(s)-1],h=="datetime"&&o>s&&(r=u.getTime())),c=this.getPolynomialYValue(f,r)),(e==1||e==f.length||h=="category"||o>s)&&(i.points.push({x:u,xValue:r,y:c,YValues:[],visible:!0}),i.points[i.points.length-1].YValues[0]=i.points[i.points.length-1].y)}return!1},getPolynomialYValue:function(n,t){for(var r=0,i=0;i<n.length;i++)r+=n[i]*Math.pow(t,i);return r},gaussJordanEliminiation:function(n,t){for(var p,v,i,s,o,u,f,w,e=n.length,h=new Array(e),c=new Array(e),l=new Array(e),a=0;a<e;++a)l[a]=0;for(u=0;u<e;++u){var y=0,f=0,r=0;for(i=0;i<e;++i)if(l[i]!=1)for(o=0;o<e;++o)l[o]==0&&Math.abs(n[i][o])>=y&&(y=Math.abs(n[i][o]),f=i,r=o);if(++l[r],f!=r){for(i=0;i<e;++i)s=n[(f,i)],n[f][i]=n[r][i],n[r][i]=s;p=t[f];t[f]=t[r];t[r]=p}if(c[u]=f,h[u]=r,n[r][r]==0)return!1;for(v=1/n[r][r],n[r][r]=1,i=0;i<e;++i)n[r][i]*=v;for(t[r]*=v,i=0;i<e;++i)if(i!=r){for(s=n[i][r],n[i][r]=0,o=0;o<e;++o)n[i][o]-=n[r][o]*s;t[i]-=t[r]*s}}for(u=e-1;u>=0;--u)if(c[u]!=h[u])for(f=0;f<e;++f)w=n[(f,c[u])],n[f][c[u]]=n[f][h[u]],n[f][h[u]]=w;return!0}});ej.trendlineTypes.polynomial=ej.Polynomial;ej.MovingAverage=r(ej.EjTrendLineRenderer,{updateMovingAverageTrendSource:function(n,t){var u=n.length,i,r;for(t.xPoints=[],t.xValues=[],t.yValues=[],i=0;i<u;i++)t.xPoints.push(n[i].xValue),t.xValues.push(i+1),r=n[i].isEmpty?null:n[i].y,t.yValues.push(r);return!1},calculateMovingAverageTrendline:function(n,t){var o=t.xPoints.length,i=t.period>=o?o-1:t.period,u,f,r,s,e,h,c;for(i=i<2?2:i,t.points=[],u=0;u<o-1;u++){for(r=s=e=0,f=u;s<i;f++)s++,ej.util.isNullOrUndefined(t.yValues[f])&&e++,r+=t.yValues[f];r=i-e<=0?null:r/(i-e);ej.util.isNullOrUndefined(r)||isNaN(r)||(h=t.xPoints[i-1+u],t.points.push({x:h,xValue:h,y:r,YValues:[],visible:!0}),c=t.points.length,t.points[c-1].YValues[0]=t.points[c-1].y)}}});ej.trendlineTypes.movingaverage=ej.MovingAverage;ej.EjIndicatorRender.prototype={draw:function(n,i){var f,s,h,e,c,u,r,o;if(this.chartObj=i,f=null,this.chartObj.model.AreaType=="cartesianaxes"&&(s=n.xAxis.x,h=n.yAxis.y,f="translate("+s+","+h+")"),e=t.inArray(n,this.chartObj.model.indicators),c={id:this.chartObj.svgObject.id+"_indicatorGroup_"+e,transform:f},this.gIndicatorGroupEle=this.chartObj.svgRenderer.createGroup(c),n._points.length>0)for(u=0;u<n.segment.length;u++)r=n.segment[u],o={fill:r.fill,width:r.width,opacity:n.opacity},r.isIndicator=!0,r.xAxis=n.xAxis,r.yAxis=n.yAxis,r.type=="line"?this.calculateDirection(r,o,e):this.drawColumn(r,o,n)},_drawLinePath:function(n,t,i,r){if(i!=""){var u={name:"line",id:this.chartObj.svgObject.id+"_"+r+"_"+n.name,fill:"none","stroke-dasharray":n.dashArray,"stroke-width":t.width,stroke:t.fill,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,opacity:t.opacity,d:i};this.chartObj.svgRenderer.drawPath(u,this.gIndicatorGroupEle)}this.chartObj.svgRenderer.append(this.gIndicatorGroupEle,this.chartObj.gIndicatorEle)},calculateDirection:function(n,t,i){var f=0,e=0,r,u;this.chartObj.model.enableCanvasRendering&&(f=n.xAxis.x,e=n.yAxis.y);n.points=ej.DataManager(n.points,ej.Query().sortBy("xValue")).executeLocal();var c=ej.EjSeriesRender.prototype._isVisiblePoints(n),l,o=ej.EjSvgRender.utils._getStringBuilder(),s=!1,h;for(u=0;u<c.length;u++)h=c[u],h.visible?(r=ej.EjSvgRender.utils._getPoint(h,n),s?o.append("L "+(r.X+f)+" "+(r.Y+e)+" "):(o.append("M "+(r.X+f)+" "+(r.Y+e)+" "),s=!0)):s=!1;l=o.toString();this._drawLinePath(n,t,l,i)},drawColumn:function(n,i,r){var f=n,l=t.inArray(r,this.chartObj.model.indicators),e,y,c;f.index=l;var p=Math.max(n.yAxis.visibleRange.min,0),w={Start:-.35,End:.35},o=ej.EjSeriesRender.prototype._isVisiblePoints(f),s=this,b=s.chartObj;for(e=0;e<o.length;e++){var k=e,h=o[e],a=h.YValues[0],d=p;if(h.visible){var v=ej.EjSeriesRender.prototype.calculateSides(h,w),g=v.x1,nt=v.x2,u=ej.EjSeriesRender.prototype.getRectangle(g,a,nt,d,f,b),tt=Math.min(0,u.Width),it=Math.min(0,u.Height);u.Width<.0001&&(u.Width=.0001);(tt==0||it==0)&&u.Width>0&&(options={id:this.chartObj.svgObject.id+"_"+l+"_"+f.name,x:u.X+s.chartObj.canvasX,y:u.Y+s.chartObj.canvasY,width:u.Width,height:u.Height,fill:o[e].fill?o[e].fill:i.fill,"stroke-width":f.border.width,plot:a<0?"negative":"positive",opacity:f.histogram.opacity,stroke:o[e].fill?o[e].fill:f.border.color},this.chartObj.svgRenderer.drawRect(options,this.gIndicatorGroupEle),c=ej.EjSvgRender.utils._getSvgXY(u.X,u.Y,f,s.chartObj),y={X:c.X,Y:c.Y,Width:u.Width,Height:u.Height},this._addRegion(s.chartObj,y,f,h,k))}}this.chartObj.svgRenderer.append(this.gIndicatorGroupEle,this.chartObj.gIndicatorEle)},_addRegion:function(n,t,i,r,u){var e=i.type,f;i.index>=0&&(f={SeriesIndex:i.index,Region:{PointIndex:u,Bounds:t},type:e,isIndicator:!0},n.model.chartRegions.push(f))},calculateSegment:function(n,i){var o,v,b,y,a,p,s,w,e,l;if(this.chartObj=i,n.segment=[],n.xRange={},n.yRange={},n.period=parseInt(n.period),n.period<n._points.length&&n.period>0){for(o=t.extend(!0,{},n),o.name="upperseries",o.fill=n.upperLine.fill,o.width=n.upperLine.width,o.type="line",v=0;v<n._points.length;v++)n._points[v].YValues.length=1,n._points[v].YValues[0]=n._points[v].y=70;for(o.points=t.extend(!0,[],n._points),b=i._getXValues(o.points),y=i._getYValues(o.points),n.xRange.min=Math.min.apply(Math,b),n.xRange.max=Math.max.apply(Math,b),n.yRange.min=Math.min.apply(Math,y),n.yRange.max=Math.max.apply(Math,y),n.segment.push(o),a=t.extend(!0,{},n),a.name="lowerSeries",a.width=n.lowerLine.width,a.fill=n.lowerLine.fill,a.type="line",p=0;p<n._points.length;p++)n._points[p].YValues[0]=n._points[p].y=30;a.points=t.extend(!0,[],n._points);y=i._getYValues(a.points);n.yRange.min=Math.min(Math.min.apply(Math,y),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,y),n.yRange.max);n.segment.push(a);s=t.extend(!0,{},n);s.name="signalSeries";s.width=n.width;s.fill=n.fill;s.type="line";var u=0,f=0,h=0,c=0,r=n.period;for(f=n._points[0].close,e=1;e<=r;++e)u=n._points[e].close,u>f?h+=u-f:u<f&&(c+=f-u),f=u,n._points[e-1].YValues[0]=n._points[e-1].y=null;for(h=h/r,c=c/r,n._points[r].YValues[0]=n._points[r].y=100-100/(1+h/c),l=r+1;l<n._points.length;l++)u=n._points[l].close,u>f?(h=(h*(r-1)+(u-f))/r,c=c*(r-1)/r):u<f&&(c=(c*(r-1)+(f-u))/r,h=h*(r-1)/r),f=u,n._points[l].YValues[0]=n._points[l].y=100-100/(1+h/c);for(s.points=t.extend(!0,[],n._points),w=[],e=r,l=0;e<s.points.length;e++,l++)w[l]=s.points[e].y;n.yRange.min=Math.min(Math.min.apply(Math,w),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,w),n.yRange.max);n.segment.push(s);this.calculateIndicatorRange(i,n)}},calculateIndicatorRange:function(n,t){n.model.indicatorRange[t.xAxisName]==undefined?(n.model.indicatorRange[t.xAxisName]={},n.model.indicatorRange[t.xAxisName]={min:t.xRange.min,max:t.xRange.max}):(n.model.indicatorRange[t.xAxisName].min>t.xRange.min&&(n.model.indicatorRange[t.xAxisName].min=t.xRange.min),n.model.indicatorRange[t.xAxisName].max<t.xRange.max&&(n.model.indicatorRange[t.xAxisName].max=t.xRange.max));n.model.indicatorRange[t.yAxisName]===undefined?(n.model.indicatorRange[t.yAxisName]={},n.model.indicatorRange[t.yAxisName]={min:t.yRange.min,max:t.yRange.max}):(n.model.indicatorRange[t.yAxisName].min>t.yRange.min&&(n.model.indicatorRange[t.yAxisName].min=t.yRange.min),n.model.indicatorRange[t.yAxisName].max<t.yRange.max&&(n.model.indicatorRange[t.yAxisName].max=t.yRange.max))}};ej.ejRSI=r(ej.EjIndicatorRender);ej.indicatorTypes.rsi=ej.ejRSI;ej.ejMACD=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var f,o,y,r,e,u,l,h,b,k,p,w;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};var d=n._points.length,a=n.longPeriod,g=n.shortPeriod,nt=n.trigger,ut=a-g,it=[],tt=[],s=[],c=[],v=[],rt=a+nt;if(rt<=n._points.length&&rt-2>=0&&g<=a&&g>0){for(it=this.calculateEMA(n._points,g,!0),tt=this.calculateEMA(n._points,a,!0),e=0;e<tt.length;e++)s.push(it[e+ut]-tt[e]);for(f=t.extend(!0,{},n),f.name="macdSeries",f.fill=n.macdLine.fill,f.width=n.macdLine.width,f.type="line",f.xAxis=n.xAxis,f.yAxis=n.yAxis,y=a-1,r=0,e=0;r<d;r++)r<y?n._points[r].YValues[0]=n._points[r].y=null:(n._points[r].YValues[0]=n._points[r].y=s[e],e+=1);for(f.points=t.extend(!0,[],n._points),c=this.calculateEMA(s,nt,!1),o=t.extend(!0,{},n),o.name="signalSeries",o.fill=n.fill,o.width=n.width,o.type="line",o.xAxis=n.xAxis,o.yAxis=n.yAxis,y=a+nt-2,r=0,e=0;r<d;r++)r<y?n._points[r].YValues[0]=n._points[r].y=null:(n._points[r].YValues[0]=n._points[r].y=c[e],e+=1);for(o.points=t.extend(!0,[],n._points),u=t.extend(!0,{},n),u.border={},u.name="histogramSeries",u.fill=n.histogram.fill,u.opacity=n.histogram.opacity,u.fill=n.histogram.fill,u.border=n.histogram.border,u.type="column",u.xAxis=n.xAxis,u.yAxis=n.yAxis,l=0,h=y;h<d;l++,h++)v.push(s[l+(nt-1)]-c[l]);for(l=0,h=y;h<d;l++,h++)n._points[h].YValues[0]=n._points[h].y=v[l];u.points=t.extend(!0,[],n._points);xValues=i._getXValues(f.points);n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);switch(n.macdType){case"line":n.yRange.min=Math.min.apply(Math,s);n.yRange.max=Math.max.apply(Math,s);n.segment.push(f);p=Math.min.apply(Math,c);w=Math.max.apply(Math,c);n.yRange.min=n.yRange.min<p?n.yRange.min:p;n.yRange.max=n.yRange.max>w?n.yRange.max:w;n.segment.push(o);break;case"histogram":b=Math.min.apply(Math,v);k=Math.max.apply(Math,v);n.yRange.min=n.yRange.min<b?n.yRange.min:b;n.yRange.max=n.yRange.max>k?n.yRange.max:k;n.segment.push(u);break;case"both":b=Math.min.apply(Math,v);k=Math.max.apply(Math,v);n.yRange.min=n.yRange.min<b?n.yRange.min:b;n.yRange.max=n.yRange.max>k?n.yRange.max:k;n.segment.push(u);n.yRange.min=Math.min.apply(Math,s);n.yRange.max=Math.max.apply(Math,s);n.segment.push(f);p=Math.min.apply(Math,c);w=Math.max.apply(Math,c);n.yRange.min=n.yRange.min<p?n.yRange.min:p;n.yRange.max=n.yRange.max>w?n.yRange.max:w;n.segment.push(o)}this.calculateIndicatorRange(i,n)}},calculateEMA:function(n,t,i){var f=0,e=0,h=n.length,s=[],o=[],c=2/(t+1),r,u;if(i){for(r=0;r<t;r++)s.push(n[r].close),f=f+s[r];for(e=f/t,o.push(e),u=e,j=t;j<h;j++)u=(n[j].close-u)*c+u,o.push(u)}else{for(r=0;r<t;r++)s.push(n[r]),f=f+s[r];for(e=f/t,o.push(e),u=e,j=t;j<h;j++)u=(n[j]-u)*c+u,o.push(u)}return o}});ej.indicatorTypes.macd=ej.ejMACD;ej.ejSMA=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var r,a,e,f,o;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};r=t.extend(!0,{},n);r.name="trendSeries";r.width=n.width;r.fill=n.fill;r.type="line";var h=[],v=[],c=[],s,l=n._points.length,u=n.period;if(!(u<=0)&&!(l<u)){for(f=0;f<l;f++)h.push(n._points[f].close);for(a=h.length;a>=u;){for(s=0,o=0;o<u;o++)s=s+h[o];s=s/u;v.push(s);h.splice(0,1);a=h.length}for(e=0;e<l;e++)n._points[e].YValues[0]=e<u-1?n._points[e].y=null:n._points[e].y=v[e-(u-1)];for(r.points=t.extend(!0,[],n._points),xValues=i._getXValues(r.points),f=u-1,o=0;f<r.points.length;f++,o++)c[o]=r.points[f].y;n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);n.yRange.min=Math.min.apply(Math,c);n.yRange.max=Math.max.apply(Math,c);n.segment.push(r);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.sma=ej.ejSMA;ej.ejEMA=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var a,u,s,f,e;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};trendSeries=t.extend(!0,{},n);trendSeries.name="trendSeries";trendSeries.type="line";trendSeries.xAxis=n.xAxis;trendSeries.yAxis=n.yAxis;var l=[],o=[],h=n._points.length,r=n.period,c=0;if(!(h<r)&&!(r<=0)){for(a=2/(r+1),f=0;f<r;f++)l.push(n._points[f].close),c=c+l[f];for(o.push(c/r),e=r;e<h;e++)o.push((n._points[e].close-o[e-r])*a+o[e-r]);for(u=0;u<h;u++)u<r-1?n._points[u].YValues[0]=n._points[u].y=null:u>=r-1&&(n._points[u].YValues[0]=n._points[u].y=o[u-(r-1)]);for(trendSeries.points=t.extend(!0,[],n._points),xValues=i._getXValues(trendSeries.points),s=[],f=r,e=0;f<trendSeries.points.length;f++,e++)s[e]=trendSeries.points[f].y;n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);n.yRange.min=Math.min.apply(Math,s);n.yRange.max=Math.max.apply(Math,s);n.segment.push(trendSeries);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.ema=ej.ejEMA;ej.ejSTOCHASTIC=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){function d(t,i,r){n._points.length>=t+i&&g(t,i,r)}function g(t,i,r){for(var v,h,o,c,u,l=t+(i-1),e=[],a=[],f,s=0;s<n._points.length;s++)v=p[s].y,e.push(v);for(h=e.length;h>=l;){for(f=0,o=t-1;o<t+i-1;o++)f=f+e[o];f=f/i;a.push(f.toFixed(2));e.splice(0,1);h=e.length}for(c=l-1,u=0;u<n._points.length;u++)r[u].YValues[0]=u<c?r[u].y=null:r[u].y=Number(a[u-c])}function nt(t,i,r){n._points.length>t&&tt(t,i,r)}function tt(t,i,r){for(var f,a=t+i,e=[],h=[],o,s,c=0,l=0,u=0;u<t-1;++u)h.push(0),e.push(0);for(u=t-1;u<n._points.length;++u){for(s=Number.MAX_VALUE,o=Number.MIN_VALUE,f=0;f<t;++f)s=Math.min(s,b[u-f]),o=Math.max(o,w[u-f]);h.push(o);e.push(s)}for(u=0;u<a-1;++u)r[u].YValues.length=1,r[u].YValues[0]=r[u].y=null;for(u=t-1;u<n._points.length;++u)c=0,l=0,c+=k[u]-e[u],l+=h[u]-e[u],r[u].YValues.length=1,r[u].YValues[0]=r[u].y=c/l*100}var r,c,u,f,e,v,o,s,h;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};var l=n.kPeriod,y=n.dPeriod,a=n.period;if(!(a<1)&&!(y<1)&&!(l<1)&&!(a>n._points.length)&&!(y>n._points.length)&&!(l>n._points.length)){for(r=t.extend(!0,{},n),r.name="upperseries",r.type="line",r.fill=n.upperLine.fill,r.width=n.upperLine.width,c=0;c<n._points.length;c++)n._points[c].YValues.length=1,n._points[c].YValues[0]=n._points[c].y=80;for(r.points=t.extend(!0,[],n._points),u=i._getXValues(r.points),f=i._getYValues(r.points),n.xRange.min=Math.min.apply(Math,u),n.xRange.max=Math.max.apply(Math,u),n.yRange.min=Math.min.apply(Math,f),n.yRange.max=Math.max.apply(Math,f),n.segment.push(r),e=t.extend(!0,{},n),e.name="lowerSeries",e.width=n.lowerLine.width,e.fill=n.lowerLine.fill,e.type="line",v=0;v<n._points.length;v++)n._points[v].YValues[0]=n._points[v].y=20;e.points=t.extend(!0,[],n._points);u=i._getXValues(e.points);f=i._getYValues(e.points);n.xRange.min=Math.min(Math.min.apply(Math,u),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,u),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,f),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,f),n.yRange.max);n.segment.push(e);o=t.extend(!0,{},n);o.name="periodSeries";o.width=n.periodLine.width;o.fill=n.periodLine.fill;o.type="line";var w=[],b=[],k=[],p=[];for(s=0;s<n._points.length;s++)b[s]=n._points[s].low,w[s]=n._points[s].high,k[s]=n._points[s].close;nt(a,l,n._points);p=n._points;d(a,l,n._points);p=n._points;o.points=t.extend(!0,[],n._points);u=i._getXValues(o.points);f=i._getYValues(o.points);n.xRange.min=Math.min(Math.min.apply(Math,u),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,u),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,f),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,f),n.yRange.max);n.segment.push(o);h=t.extend(!0,{},n);h.name="trendSeries";h.width=n.width;h.fill=n.fill;h.type="line";d(a+l-1,y,n._points);h.points=t.extend(!0,[],n._points);n.segment.push(h);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.stochastic=ej.ejSTOCHASTIC;ej.ejbollingerBand=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var v,ft,d,f,e,l,tt,o,s,it,h,c,rt,r,a;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};var b=0,g=0,nt=n._points.length,ut=n.standardDeviations,w=n.period,u=Math.round(w),y=[],p=[],k=[];if(u<nt&&u>0){for(r=0;r<u;r++)b+=n._points[r].close;for(v=b/w,r=0;r<nt;++r)if(r>=u-1&&r<nt){r-w>=0?(ft=n._points[r].close-n._points[r-u].close,b=b+ft,v=b/w,y[r]=v,p[r]=Math.pow(n._points[r].close-v,2),g+=p[r]-p[r-u]):(y[r]=v,p[r]=Math.pow(n._points[r].close-v,2),g+=p[r]);var et=Math.sqrt(g/w),ot=y[r]-ut*et,st=y[r]+ut*et;if(r+1==u)for(d=0;d<u-1;d++)k[d]={X:n._points[d].X,mb:y[r],lb:ot,ub:st,visible:!0};k[r]={X:n._points[r].X,mb:y[r],lb:ot,ub:st,visible:!0}}else r<w-1&&(y[r]=v,p[r]=Math.pow(n._points[r].close-v,2),g+=p[r]);for(f=t.extend(!0,{},n),f.name="upperseries",f.fill=n.upperLine.fill,f.width=n.upperLine.width,f.type="line",e=0;e<n._points.length;e++)e>=u-1?(n._points[e].YValues.length=1,n._points[e].YValues[0]=n._points[e].y=k[e].ub):n._points[e].YValues[0]=n._points[e].y=null;for(f.points=t.extend(!0,[],n._points),l=i._getXValues(f.points),tt=[],r=u;r<f.points.length;r++)tt.push(f.points[r].y);for(a=tt,n.xRange.min=Math.min.apply(Math,l),n.xRange.max=Math.max.apply(Math,l),n.yRange.min=Math.min.apply(Math,a),n.yRange.max=Math.max.apply(Math,a),n.segment.push(f),o=t.extend(!0,{},n),o.name="lowerSeries",o.width=n.lowerLine.width,o.fill=n.lowerLine.fill,o.type="line",s=0;s<n._points.length;s++)s>=u-1?(n._points[s].YValues.length=1,n._points[s].YValues[0]=n._points[s].y=k[s].lb):n._points[s].YValues[0]=n._points[s].y=null;for(o.points=t.extend(!0,[],n._points),l=i._getXValues(o.points),it=[],r=u;r<o.points.length;r++)it.push(o.points[r].y);for(a=it,n.xRange.min=Math.min(Math.min.apply(Math,l),n.xRange.min),n.xRange.max=Math.max(Math.max.apply(Math,l),n.xRange.max),n.yRange.min=Math.min(Math.min.apply(Math,a),n.yRange.min),n.yRange.max=Math.max(Math.max.apply(Math,a),n.yRange.max),n.segment.push(o),h=t.extend(!0,{},n),h.name="trendSeries",h.width=n.width,h.fill=n.fill,h.type="line",c=0;c<n._points.length;c++)c>=u-1?(n._points[c].YValues.length=1,n._points[c].YValues[0]=n._points[c].y=k[c].mb):n._points[c].YValues[0]=n._points[c].y=null;for(h.points=t.extend(!0,[],n._points),l=i._getXValues(h.points),rt=[],r=u;r<h.points.length;r++)rt.push(h.points[r].y);a=rt;n.xRange.min=Math.min(Math.min.apply(Math,l),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,l),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,a),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,a),n.yRange.max);n.segment.push(h);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.bollingerband=ej.ejbollingerBand;ej.ejATR=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var o,s,h,c,u,f,y,v,r;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};o=[];s=h=c=0;var l,p=0,a,e=n.period;if(!(e<=0)&&!(e>n._points.length)){for(r=0;r<e;r++)s=n._points[r].high-n._points[r].low,r>0&&(h=Math.abs(n._points[r].high-n._points[r-1].close),c=Math.abs(n._points[r].low-n._points[r-1].close)),l=Math.max(s,h,c),p+=l,a=p/e,o[r]={X:n._points[r].X,YValues:a};for(r=e;r<n._points.length;++r)s=n._points[r].high-n._points[r].low,h=Math.abs(n._points[r].high-n._points[r-1].close),c=Math.abs(n._points[r].low-n._points[r-1].close),l=Math.max(s,h,c),a=(o[r-1].YValues*(e-1)+l)/e,o[r]={X:n._points[r].X,YValues:a};for(u=t.extend(!0,{},n),u.name="trendSeries",u.width=n.width,u.fill=n.fill,u.type="line",f=0;f<n._points.length;f++)f>=e-1?(n._points[f].YValues.length=1,n._points[f].YValues[0]=n._points[f].y=o[f].YValues):n._points[f].YValues[0]=n._points[f].y=null;for(u.points=t.extend(!0,[],n._points),y=i._getXValues(u.points),v=[],r=e;r<u.points.length;r++)v.push(u.points[r].y);n.xRange.min=Math.min.apply(Math,y);n.xRange.max=Math.max.apply(Math,y);n.yRange.min=Math.min.apply(Math,v);n.yRange.max=Math.max.apply(Math,v);n.segment.push(u);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.atr=ej.ejATR;ej.ejaccumulationDistribution=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var e,o,r,s,h,u,f,c,l;for(this.chartObj=i,n.segment=[],n.xRange={},n.yRange={},e=[],o=0,r=0;r<n._points.length;r++)s=n._points[r].close,h=(s-n._points[r].low-(n._points[r].high-s))/(n._points[r].high-n._points[r].low),o+=(isNaN(h)?0:h)*n._points[r].volume,e[r]=o;for(u=t.extend(!0,{},n),u.name="trendseries",u.fill=n.fill,u.width=n.width,u.type="line",f=0;f<n._points.length;f++)n._points[f].YValues[0]=n._points[f].y=e[f];u.points=t.extend(!0,[],n._points);c=i._getXValues(u.points);l=i._getYValues(u.points);n.xRange.min=Math.min.apply(Math,c);n.xRange.max=Math.max.apply(Math,c);n.yRange.min=Math.min.apply(Math,l);n.yRange.max=Math.max.apply(Math,l);n.segment.push(u);this.calculateIndicatorRange(i,n)}});ej.indicatorTypes.accumulationdistribution=ej.ejaccumulationDistribution;ej.ejTMA=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var o,y,p,r,s,u;this.chartObj=i;n.segment=[];n.xRange={};n.yRange={};o=t.extend(!0,{},n);o.name="trendSeries";o.width=n.width;o.fill=n.fill;o.type="line";var l=[],w=[],b=[],h=[],v=[],e=0,c,a=n._points.length,f=n.period;if(!(f<1)&&f<a){for(s=0;s<a;s++)l.push(n._points[s].close);for(y=l.length;y>=f;){for(e=0,u=0;u<f;u++)e=e+l[u];e=e/f;w.push(parseFloat(e.toFixed(2)));l.splice(0,1);y=l.length}for(r=0;r<a;r++)if(r<f-1){for(e=0,u=0;u<r+1;u++)e=e+n._points[u].close;e=e/(r+1);h[r]=parseFloat(e.toFixed(2))}else h[r]=w[r-(f-1)];for(p=h.length;p>=f;){for(c=0,u=0;u<f;u++)c=c+h[u];c=c/f;b.push(c);h.splice(0,1);p=h.length}for(r=0;r<a;r++)n._points[r].YValues[0]=r<f-1?n._points[r].y=null:n._points[r].y=b[r-(f-1)];for(o.points=t.extend(!0,[],n._points),xValues=i._getXValues(o.points),s=f-1,u=0;s<o.points.length;s++,u++)v[u]=o.points[s].y;n.xRange.min=Math.min.apply(Math,xValues);n.xRange.max=Math.max.apply(Math,xValues);n.yRange.min=Math.min.apply(Math,v);n.yRange.max=Math.max.apply(Math,v);n.segment.push(o);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.tma=ej.ejTMA;ej.ejMomentum=r(ej.EjIndicatorRender,{calculateSegment:function(n,i){var e,c,l,o,a,f,p,s,v,r,h,u,y;if(this.chartObj=i,n.segment=[],n.xRange={},n.yRange={},e=t.extend(!0,{},n),e.name="upperseries",e.fill=n.upperLine.fill,e.width=n.upperLine.width,e.type="line",c=n.period,l=n._points.length,c>0&&c<l-1){for(r=0;r<l;r++)n._points[r].YValues.length=1,n._points[r].YValues[0]=n._points[r].y=100;for(e.points=t.extend(!0,[],n._points),o=i._getXValues(e.points),a=i._getYValues(e.points),n.xRange.min=Math.min.apply(Math,o),n.xRange.max=Math.max.apply(Math,o),n.yRange.min=Math.min.apply(Math,a),n.yRange.max=Math.max.apply(Math,a),n.segment.push(e),f=t.extend(!0,{},n),f.name="trendSeries",f.width=n.width,f.fill=n.fill,f.type="line",p=[],s=n.period,u=0;u<n._points.length;++u)v=n._points,u<s||(n._points[u].YValues[0]=n._points[u].y=v[u].close/v[u-s].close*100);for(r=0;r<s&&r<n._points.length;r++)n._points[r].YValues[0]=n._points[r].y=null;for(f.points=t.extend(!0,[],n._points),o=i._getXValues(f.points),h=[],u=s,y=0;u<f.points.length;u++,y++)h[y]=f.points[u].y;n.xRange.min=Math.min(Math.min.apply(Math,o),n.xRange.min);n.xRange.max=Math.max(Math.max.apply(Math,o),n.xRange.max);n.yRange.min=Math.min(Math.min.apply(Math,h),n.yRange.min);n.yRange.max=Math.max(Math.max.apply(Math,h),n.yRange.max);n.segment.push(f);this.calculateIndicatorRange(i,n)}}});ej.indicatorTypes.momentum=ej.ejMomentum;ej.EjSeriesRender.prototype={getOrigin:function(n,t,i){if(i.axes[t.xAxis.name]._validCross){var r=n.chartObj._getCrossAxis(n.chartObj.model._axes,!0,t.xAxis.crossesInAxis);if(n.chartObj.model.requireInvertedAxes?t.xAxis.name:t.yAxis.name===r.name)return t.xAxis._crossValue}return Math.max(t.yAxis.visibleRange.min,0)},setLineSeriesStyle:function(n){var i=t.inArray(n,this.chartObj.model._visibleSeries),r=this.chartObj.model.seriesColors[i],u=this.chartObj.svgRenderer.createGradientElement(this.getSeriesName(n)+i,r,0,0,0,t(this.chartObj.svgObject).height(),this.chartObj.gSeriesEle),f=this.chartObj.model.seriesBorderColors[i];return{SeriesInterior:u,SeriesBorder:f}},getSeriesName:function(n){return n.name?n.name.replace(/\s/g,""):"series"},drawAreaPath:function(n,i,r,u){var l=this.chartObj.model.requireInvertedAxes,e=t.inArray(n,this.chartObj.model._visibleSeries),h=null,a=this.chartObj.model.AreaType,o=n.border,s,c,f;a=="cartesianaxes"&&(s=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,l),h="translate("+s.x+","+s.y+")");c={id:this.chartObj.svgObject.id+"_SeriesGroup_"+e,transform:h};this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(c);r!=""&&(f={id:this.chartObj.svgObject.id+"_Series"+e,fill:i.SeriesInterior,"fill-opacity":n.opacity,"stroke-width":o.width,stroke:o.color,"stroke-dasharray":o.dashArray,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,d:r},this.chartObj.dragPoint?(f.id=this.chartObj.svgObject.id+"_PreviewSeries"+e,f["fill-opacity"]=.6,this.chartObj.model.enableCanvasRendering?this.chartObj.svgRenderer.drawPath(f,this.chartObj.canvasElement,u):this.chartObj.svgRenderer.drawPath(f,this.chartObj.gPreviewSeriesGroupEle,u)):this.chartObj.svgRenderer.drawPath(f,this.gSeriesGroupEle,u))},setAreaSeriesStyle:function(n){var r=t.inArray(n,this.chartObj.model._visibleSeries),s=Math.max.apply(0,t.map(n.points,function(n){return n.YValues[0]})),h=Math.min.apply(0,t.map(n.points,function(n){return n.YValues[0]})),u=Math.min.apply(0,t.map(n.points,function(n){return n.xValue})),f={xValue:u,YValues:[]},i;f.YValues[0]=h;i={xValue:u,YValues:[]};i.YValues[0]=s;var e=ej.EjSvgRender.utils._getPoint(f,n),o=ej.EjSvgRender.utils._getPoint(i,n),c=this.chartObj.model.seriesColors[r],l=this.chartObj.svgRenderer.createGradientElement(this.getSeriesName(n)+r,c,e.X,e.Y,o.X,o.Y,this.chartObj.gSeriesEle);return{SeriesInterior:l}},naturalSpline:function(n){var h=n.length,f=0,i=[],u=[],t,s,r;for(i[0]=u[0]=0,i[n.length-1]=0,t=1;t<h-1;t++){var e=n[t].xValue-n[t-1].xValue,c=n[t+1].xValue-n[t-1].xValue,o=n[t+1].xValue-n[t].xValue,l=n[t+1].YValues[f]-n[t].YValues[f]||null,a=n[t].YValues[f]-n[t-1].YValues[f];e==0||c==0||o==0?(i[t]=0,u[t]=0):(s=1/(e*i[t-1]+2*c),i[t]=-s*o,u[t]=s*(6*(l/o-a/e)-e*u[t-1]))}for(r=h-2;r>=0;r--)i[r]=i[r]*i[r+1]+u[r];return i},getBezierControlPoints:function(n,t,i,r,u){var o,s,f=1/3,e=t.xValue-n.xValue;e=e*e;var h=2*parseFloat(n.xValue)+parseFloat(t.xValue),c=parseFloat(n.xValue)+2*parseFloat(t.xValue),l=2*n.YValues[u]+t.YValues[u],a=n.YValues[u]+2*t.YValues[u],v=f*(l-f*e*(i+.5*r)),y=f*(a-f*e*(.5*i+r));return o={xValue:h*f,YValues:[v]},s={xValue:c*f,YValues:[y]},{controlPoint1:o,controlPoint2:s}},improveChartPerformance:function(n){for(var l=[],r=n.xAxis.visibleRange,u=n.yAxis.visibleRange,i=n.pointCollection&&n.dragPoint?n.pointCollection:n.points,a=this.chartObj.model.m_AreaBounds,f,b=r.max-r.min,k=u.max-u.min,e=Math.abs(b*1/a.Width),o=Math.abs(k*1/a.Height),v=i[0]&&i[0].X>e?0:e,y=i[0]&&i[0].y>o?0:o,s=0,h=0,p,t,d=i.length,w=0,c=0;c<d;c++)t=i[c],t.fill&&(n.pointFill=!0),p=t.isEmpty===null||t.isEmpty===undefined?!1:t.isEmpty,t.visible=t.visible===null||t.visible===undefined?!0:t.visible,t.xValue===null||t.xValue===undefined?(t.isEmpty=!0,t.visible=!1,t.xValue=r.min):(t.isEmpty=p,jQuery.type(t.xValue)=="date"&&(t.xValue=t.xValue.getTime())),t.YValues[0]==null||t.YValues[0]=="undefined"||t.YValues[0]===""?(t.isEmpty=!0,t.visible=!1,t.YValues[0]=u.min):(t.isEmpty=t.isEmpty,t.visible=t.isEmpty?!t.isEmpty:t.visible),s=t.xValue,h=t.YValues[0],(Math.abs(v-s)>=e||Math.abs(y-h)>=o||n.enableSmartLabels)&&(l[w]=t,v=s,y=h,w++);return f=this._calculateEmptyPoints(n,l),n._visiblePoints=f,f},_isVisiblePoints:function(n){for(var t=n.pointCollection&&n.dragPoint?n.pointCollection:n.points,r,f,u=ej.util.isNullOrUndefined,e=t.length,i=0;i<e;i++)f=u(t[i].isEmpty)?!1:t[i].isEmpty,t[i].visible=u(t[i].visible)?!0:t[i].visible,u(t[i].xValue)?(t[i].isEmpty=!0,t[i].visible=!1,t[i].xValue=n.xAxis?n.xAxis.visibleRange.min:null):t[i].isEmpty=f,t[i].YValues[0]==null||t[i].YValues[0]=="undefined"||!n.isIndicator&&n._hiloTypes&&(t[i].YValues[1]==undefined||t[i].YValues[1]==null)?(t[i].isEmpty=!0,t[i].visible=!1):(t[i].isEmpty=t[i].isEmpty,t[i].visible=t[i].isEmpty?!t[i].isEmpty:t[i].visible),u(t[i].x)||jQuery.type(t[i].xValue)=="date"&&(t[i].xValue=t[i].xValue.getTime());return r=n.emptyPointSettings?this._calculateEmptyPoints(n,t):t,n.type.toLowerCase()=="waterfall"&&this.chartObj.calculateWaterfallSeriesPoints(r),n._visiblePoints=r,r},_calculateEmptyPoints:function(n,i,r){var e,c=n.emptyPointSettings,l=c.style,v=l.color,s=ej.util.isNullOrUndefined,y=l.border.color,p=l.border.width,h=c.displayMode.toLowerCase(),w=c.visible,a=i.length,f,o=[],u;if(e=t.extend(!0,{},i,e),seriesType=n.type.toLowerCase(),e.length=i.length,h=seriesType=="boxandwhisker"?"gap":h,w)if(h!="gap")for(u=0;u<a;u++)if(e[u].actualIndex=s(r)?u:r.model._isPieOfPie?e[u].actualIndex:u,f=e[u],f.isEmpty&&(!s(f.x)||n._xAxisValueType=="string")){v!=""&&(f.fill=v);y!=""&&(f.border=f.border?f.border:{},f.border.color=y,f.border.width=p);switch(h){case"average":n._hiloTypes?t.each(f.YValues,function(n,t){t=((e[u-1]?e[u-1].YValues[n]:0)+(e[u+1]?e[u+1].isEmpty?0:e[u+1].YValues[n]:0))/2;f.YValues[n]=t;ej.EjSeriesRender.prototype._sethlocPoint(n,f,t)}):(value=((e[u-1]?e[u-1].y:0)+(e[u+1]?e[u+1].isEmpty?0:e[u+1].y:0))/2,f.YValues[0]=value,f.y=value);break;case"zero":n._hiloTypes?t.each(f.YValues,function(n){f.y=0;f.YValues[n]=0;ej.EjSeriesRender.prototype._sethlocPoint(n,f,0)}):(f.YValues[0]=0,f.y=0)}f.isEmpty=!1;f.visible=!0;o.push(f)}else s(e[u].x)&&n._xAxisValueType!="string"||o.push(f);else for(u=0;u<a;u++)e[u].actualIndex=s(r)?u:r.model._isPieOfPie?e[u].actualIndex:u,o[u]=e[u];else for(u=0;u<a;u++)e[u].actualIndex=u,e[u].visible&&o.push(e[u]);return o},_sethlocPoint:function(n,t,i){switch(n){case 0:t.high=i;break;case 1:t.low=i;break;case 2:t.open=i;break;case 3:t.close=i}},_calculatePolarAxesSegment:function(n){var r=n._visiblePoints,l=ej.EjSvgRender.utils._getStringBuilder(),nt=t.inArray(n,this.chartObj.model._visibleSeries),c,e=this.chartObj.model.centerX,o=this.chartObj.model.centerY,rt=this._getSeriesPosition(n),h,ct,w,et,ot,tt,it,lt,st,i,u,b,ut,ht,bt,ft,kt,g;if(c=t.extend(!0,{},n.marker.size,c),c.width<=10&&(c.width=c.height=1.5*this.chartObj.model.elementSpacing),n.drawType.toLowerCase()=="column"){h=0;ct={id:this.chartObj.svgObject.id+"_SeriesGroup_"+nt};this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(ct);w=n.xAxis.visibleRange.interval;n.xAxis.labelPlacement=n.xAxis.labelPlacement?n.xAxis.labelPlacement:"betweenticks";et=0;(n.xAxis._valueType!="category"||n.xAxis._valueType=="category"&&n.xAxis.labelPlacement=="onticks")&&(et=w/2);ot=n.xAxis.isInversed?0:1;w=w/rt.all;var lt=w,s=n._visiblePoints,dt=n.xAxis._valueType!="category"?s.length-1:s.length;for(tt=0;tt<dt;tt++)it=temp=s[tt].xValue-n.xAxis.visibleRange.min+(w*rt.pos-et),it=it/this.chartObj.model.sumofYValues,point=s[tt],lt=n.xAxis.visibleRange.interval/rt.all,point.startAngle=2*Math.PI*it,point.endAngle=2*Math.PI*(it+lt/this.chartObj.model.sumofYValues);s[s.length-1].startAngle||(s[s.length-1].startAngle=s[0].startAngle,s[s.length-1].endAngle=s[0].endAngle)}for(st=!1,i=0;i<r.length;i++)if(r[i].visible){if(n.drawType.toLowerCase()=="line")u=ej.EjSvgRender.utils.TransformToVisible(n,r[i].xValue,r[i].y,this.chartObj),i<r.length-1&&r[i+1].visible?(b=ej.EjSvgRender.utils.TransformToVisible(n,r[i+1].xValue,r[i+1].y,this.chartObj),l.append("M "+u.X+" "+u.Y+" L "+b.X+" "+b.Y+" ")):i==r.length-1&&n.isClosed&&(b=ej.EjSvgRender.utils.TransformToVisible(n,r[0].xValue,r[0].y,this.chartObj),l.append("M "+u.X+" "+u.Y+" L "+b.X+" "+b.Y+" "));else if(n.drawType.toLowerCase()=="column"){var w=n.xAxis.visibleRange.interval,ot=n.xAxis.isInversed?0:1,w=w/rt.all,f=this.chartObj.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,r[i].y),at=-.5*Math.PI,k=r[i].startAngle+at,d=r[i].endAngle+at-1e-6,a,v,y,p;if(n.isStacking){ut=n.stackedValue.StartValues[i];ht=n.stackedValue.EndValues[i];f=ut==ht?0:this.chartObj.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,ht);a=e+f*Math.cos(k);v=o+f*Math.sin(k);y=e+f*Math.cos(d);p=o+f*Math.sin(d);h=this.chartObj.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(n.yAxis,ut==0&&n.yAxis.visibleRange.min!=0?n.yAxis.visibleRange.min:ut);var vt=e+h*Math.cos(k),yt=o+h*Math.sin(k),pt=e+h*Math.cos(d),wt=o+h*Math.sin(d);direction=this.chartObj.model.isPolar?"M "+a+" "+v+" A "+f+" "+f+" 0 0 "+ot+" "+y+" "+p+" L "+pt+" "+wt+" A "+h+" "+h+" 1 0 0 "+vt+" "+yt+" z":"M "+a+" "+v+" L "+y+" "+p+" L "+pt+" "+wt+" L "+vt+" "+yt+" z"}else a=e+f*Math.cos(k),v=o+f*Math.sin(k),y=e+f*Math.cos(d),p=o+f*Math.sin(d),direction=this.chartObj.model.isPolar?"M "+a+" "+v+" A "+f+" "+f+" 0 0 "+ot+" "+y+" "+p+" L "+e+" "+o+" z":"M "+a+" "+v+" L "+y+" "+p+" L "+e+" "+o+" z";if(bt=this.chartObj.svgRenderer.createGradientElement(this.getSeriesName(n)+"_"+nt+i,this.chartObj.model.seriesColors[nt],0,0,0,100,this.chartObj.gSeriesEle),ft=n.border,options={id:this.chartObj.svgObject.id+"_Series"+nt+"_Point"+i,fill:bt,stroke:ft.color,"stroke-dasharray":ft.dashArray,"stroke-width":ft.width,seriesIndex:nt,opacity:n.opacity,pointIndex:i,d:direction,start:r[i].startAngle-1.57,end:r[i].endAngle-1.57,radius:f,innerR:h},this.chartObj.model.isPolar&&(options.x=e,options.y=o,g={PointIndex:i,StartAngle:r[i].startAngle,EndAngle:r[i].endAngle,CenterX:e,CenterY:o,Radius:f,DRadius:h}),n.type=="radar"){var gt={x:e,y:o},ni={x:a,y:v},ti={x:y,y:p};g={PointIndex:i,Line1:gt,Line2:ni,Line3:ti};kt=h?!0:!1;options.hasStackingInnerRadius=kt}point=n._visiblePoints[i];(!ej.util.isNullOrUndefined(n.marker)&&n.marker.visible||!ej.util.isNullOrUndefined(n.marker)&&n.marker.dataLabel.visible)&&(point.symbolLocation={X:(a+y)/2,Y:(v+p)/2});this.chartObj.svgRenderer.drawPath(options,this.gSeriesGroupEle)}else u=ej.EjSvgRender.utils.TransformToVisible(n,r[i].xValue,r[i].y,this.chartObj),i==0||st?l.append("M "+u.X+" "+u.Y+" "):i==r.length-1?n.isClosed?(b=ej.EjSvgRender.utils.TransformToVisible(n,r[0].xValue,r[0].y,this.chartObj),l.append("L "+u.X+" "+u.Y+" z")):l.append("L "+u.X+" "+u.Y+" L "+e+" "+o):r[i+1].visible?l.append("L "+u.X+" "+u.Y+" "):l.append("L "+u.X+" "+u.Y+" L "+e+" "+o+" z"),st=r[i+1]&&r[i+1].visible?!1:!0;n.regionAdded||n.drawType.toLowerCase()=="column"||(g={X:u.X-c.width/2,Y:u.Y-c.height/2,Width:c.width,Height:c.height},ej.EjSvgRender.utils._addRegion(this.chartObj,g,n,r[i],i));!n.regionAdded&&n.drawType.toLowerCase()=="column"&&this.chartObj.model.enableCanvasRendering&&ej.EjSvgRender.utils._addRegion(this.chartObj,g,n,null,null)}return n.regionAdded||n.drawType.toLowerCase()!="column"||this.chartObj.model.enableCanvasRendering||ej.EjSvgRender.utils._addRegion(this.chartObj,g,n,null,null),l.toString()},_calculateVisiblePoints:function(n,i){for(var r,h=[],s=[],a,o=ej.util.isNullOrUndefined,c=o(i)?n.points:i.model._isPieOfPie?n.pieCollections[n.collectionIndex]:n.points,f,l=c.length,u,e=0;e<l;e++)u=c[e],o(u._visibility)&&(u._visibility="visible"),u.actualIndex=o(i)?e:i.model._isPieOfPie?u.actualIndex:e,u.visible=u.isEmpty?!1:u.visible,o(u.visible)&&(u.visible=!0),u.y<0&&(u.YValues[0]=Math.abs(u.YValues[0])),o(u.x)&&n._xAxisValueType!="string"&&(u.visible=!1,u.isEmpty=!0),o(u.y)&&(u.visible=!1,u.isEmpty=!0);if(f=t.extend(!0,{},c,f),f.length=l,n.emptyPointSettings.visible)for(emptyPoints=this._calculateEmptyPoints(n,f,i),a=emptyPoints.length,r=0;r<a;r++)emptyPoints[r].visible?(emptyPoints[r].visible=emptyPoints[r]._visibility=="hidden"?!1:!0,s.push(emptyPoints[r]),emptyPoints[r].visible&&h.push(emptyPoints[r])):(emptyPoints[r].y=((emptyPoints[r-1]?emptyPoints[r-1].y:0)+(emptyPoints[r+1]?emptyPoints[r+1].y:0))/2,isNaN(emptyPoints[r].y)&&(emptyPoints[r].y=((emptyPoints[r-2]?emptyPoints[r-2].y:0)+(emptyPoints[r+2]?emptyPoints[r+2].y:0))/2),emptyPoints[r].YValues[0]=emptyPoints[r].y,o(emptyPoints[r].x)&&n._xAxisValueType!="string"||(emptyPoints[r].gapMode=!0,h.push(emptyPoints[r])));else for(r=0;r<l;r++)s.push(f[r]),f[r].visible&&(f[r].visible=f[r]._visibility=="hidden"?!1:!0,f[r].visible&&h.push(f[r]));if(n.visibility=="hidden")for(e=0;e<s.length;e++)s[e].visible=!1;return n._visiblePoints=h,n.visiblePoints=s,{visiblePoints:h,legendPoints:s}},getMinMaxValue:function(n,t,i){var u=Math.min(n.x,t.x),f=Math.min(n.y,t.y),e=Math.max(n.x,t.x),o=Math.max(n.y,t.y),r;switch(i){case 0:case 360:r=o;break;case 90:r=u;break;case 180:r=f;break;case 270:r=e}return r},pieDoughnutCenter:function(n){var p=n.startAngle,w=n.endAngle,y,v,e,r;this.chartObj.model.centerCount++;var i=t.inArray(n,this.chartObj.model._visibleSeries),o=[-630,-540,-450,-360,-270,-180,-90,0,90,180,270,360,450,540,630],u=[],nt=this.chartObj.model.circleCenterX[i],tt=this.chartObj.model.circleCenterY[i];if(n.startAngle<n.endAngle)for(r=0;r<o.length;r++)o[r]>p&&o[r]<w&&(u[u.length]=o[r]%360<0?o[r]%360+360:o[r]%360);else for(r=0;r<o.length;r++)o[r]<p&&o[r]>w&&(u[u.length]=o[r]%360<0?o[r]%360+360:o[r]%360);if(this.chartObj.model.centerCount==1){var f=this.chartObj.model.circularRadius[i],b=2*Math.PI*(p-90)/360,k=2*Math.PI*(w-90)/360,a={x:this.chartObj.model.circleCenterX[i],y:this.chartObj.model.circleCenterY[i]},s={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(b),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(b)},h={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(k),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(k)};switch(u.length){case 0:var it=Math.abs(a.x-s.x)>Math.abs(a.x-h.x)?s.x:h.x,rt=Math.abs(a.y-s.y)>Math.abs(a.y-h.y)?s.y:h.y,e={x:(a.x+it)/2,y:(a.y+rt)/2};this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i]+(this.chartObj.model.circleCenterX[i]-e.x);this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i]+(this.chartObj.model.circleCenterY[i]-e.y);break;case 1:y=2*Math.PI*(u[0]-90)/360;v={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(y),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(y)};switch(u[0]){case 0:case 360:c={x:s.x,y:v.y};l={x:h.x,y:a.y};break;case 90:c={x:a.x,y:h.y};l={x:v.x,y:s.y};break;case 180:c={x:h.x,y:a.y};l={x:s.x,y:v.y};break;case 270:c={x:v.x,y:s.y};l={x:a.x,y:h.y}}e={x:(c.x+l.x)/2,y:(c.y+l.y)/2};this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i]+(this.chartObj.model.circleCenterX[i]-e.x>=f?0:this.chartObj.model.circleCenterX[i]-e.x);this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i]+(this.chartObj.model.circleCenterY[i]-e.y>=f?0:this.chartObj.model.circleCenterY[i]-e.y);break;case 2:var d=2*Math.PI*(u[0]-90)/360,y=2*Math.PI*(u[1]-90)/360,v={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(y),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(y)},g={x:this.chartObj.model.circleCenterX[i]+f*Math.cos(d),y:this.chartObj.model.circleCenterY[i]+f*Math.sin(d)},c,l;c=u[0]==90&&u[1]==180||u[0]==270&&u[1]==0?{x:g.x,y:v.y}:{x:v.x,y:g.y};l=u[0]==90||u[0]==270?{x:this.getMinMaxValue(s,h,u[0]),y:this.getMinMaxValue(s,h,u[1])}:{x:this.getMinMaxValue(s,h,u[1]),y:this.getMinMaxValue(s,h,u[0])};e={x:Math.abs(c.x-l.x)/2>=f?0:(c.x+l.x)/2,y:Math.abs(c.y-l.y)/2>=f?0:(c.y+l.y)/2};this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i]+(e.x==0?0:this.chartObj.model.circleCenterX[i]-e.x>=f?0:this.chartObj.model.circleCenterX[i]-e.x);this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i]+(e.y==0?0:this.chartObj.model.circleCenterY[i]-e.y>=f?0:this.chartObj.model.circleCenterY[i]-e.y)}}for(r=0;r<n.points.length;r++)i<this.chartObj.model._visibleSeries.length&&this.chartObj.model.centerCount>1&&this.chartObj.model._visibleSeries[i+1].startAngle==p&&this.chartObj.model._visibleSeries[i+1].endAngle==w&&(this.chartObj.model.circleCenterX[i]=this.chartObj.model.circleCenterX[i+1],this.chartObj.model.circleCenterY[i]=this.chartObj.model.circleCenterY[i+1]),this.chartObj.model.startX[r]=this.chartObj.model.startX[r]-(nt-this.chartObj.model.circleCenterX[i]),this.chartObj.model.startY[r]=this.chartObj.model.startY[r]-(tt-this.chartObj.model.circleCenterY[i])},_drawEmptyPieOfPie:function(n){var u=-.5*Math.PI,f=2*Math.PI+-.5*Math.PI-1e-6,i=n.model.circleCenterX[1],r=n.model.circleCenterY[1],t=n.model.circularRadius[1],o="M "+(i+t*Math.cos(u))+" "+(r+t*Math.sin(u))+" A "+t+" "+t+" 0 1 1 "+(i+t*Math.cos(f))+" "+(r+t*Math.sin(f))+" z",e=n.model.theme.toLowerCase();return{id:n.svgObject.id+"_Series0_EmptyCircle",fill:"none","stroke-width":1.5,stroke:e.indexOf("dark")>=0||e.indexOf("contrast")>=0?" #FFFFFF":"#000000","stroke-dasharray":"",d:o,opacity:1,radius:t,start:0-1.57,end:2*Math.PI-1.57,cx:i,cy:r}},calculatingSliceAngle:function(n,i){var e=this.chartObj?this.chartObj:i,r=e.model,w=r.legend,f=t.inArray(n,r._visibleSeries),b=w.position.toLowerCase(),st=r.LegendActualBounds,it=n._visiblePoints,wt=it.length,rt=0,o,ut=0,ht=w.border.width,ct=r.border.width,u,a=r.margin,lt=r.elementSpacing,l=0,v=r.title.subTitle.text?r.title.subTitle:"",et,yt,ot,nt,c,y,tt,s,pt,p,d,g,h;for(r.arcData=[],n.rightsidePoints=[],n.leftsidePoints=[],n.labels=[],r.sumofYValues=0,r.midPoint=0,type=n.type.toLowerCase(),gapWidthValue=n.gapWidth,h=0;h<it.length;h++)r.sumofYValues+=it[h].YValues[0];o=n.endAngle!=null&&type!="pieofpie"?n.endAngle-n.startAngle:360;o=o!=360&&o!=-360?o%360:o;n.startAngle&&type!="pieofpie"?(n.startAngle=n.startAngle%360,n.endAngle=n.startAngle+o,l=n.startAngle?r.sumofYValues/360*n.startAngle:0,l=l/r.sumofYValues,r.itemCurrentXPos=l):n.endAngle=o;w.visible&&b!="custom"&&(b=="right"||b=="left"?rt+=st.Width+ht*2+lt:ut+=st.Height+ht*2+lt);var at=r.title.text&&r.title.visible?r._titleLocation.size.height+r.elementSpacing+(v==""?0:v.text&&v.visible&&v.enableTrim&&(v.textOverflow=="wrap"||v.textOverflow=="wrapandtrim")?r._subTitleLocation.size.height:0):0,ft=.1*Math.min(t(e.svgObject).width(),t(e.svgObject).height()),k=t(e.svgObject).width()-(rt+a.left+a.right+ct*2)-(type=="pieofpie"?gapWidthValue:0),vt=t(e.svgObject).height()-(ut+at+a.top+a.bottom+ct*2);for(f=e.model._isPieOfPie?n.collectionIndex:f,type=="pieofpie"&&(k<ft&&(et=ft-k,k=ft),gapWidthValue=et?gapWidthValue-et:t(e.svgObject).width()>=gapWidthValue?gapWidthValue:0),yt=type=="pieofpie"?f==0?.25:.25*3:.5,r.circleCenterX[f]=k*yt+(f==1&&type=="pieofpie"?gapWidthValue:0)+a.left+(w.visible&&b==="left"?rt:0),r.circleCenterY[f]=vt*.5+a.top+at+(w.visible&&b==="top"?ut:0),ej.util.isNullOrUndefined(e.model.pieGapWidth)||e.model.pieGapWidth==0||(r.circleCenterX[f]=f==0?r.circleCenterX[f]+e.model.pieGapWidth/2:r.circleCenterX[f]-e.model.pieGapWidth/2),n.startAngle=type=="pieofpie"?0:n.startAngle,o=n.endAngle-n.startAngle,ot=o/180,nt=o/4*(Math.PI/180),c=0;c<wt;c++)u=n._visiblePoints[c],(u.visible||u.gapMode)&&(y=type=="pieofpie"?u.actualIndex:c,c==0&&f==0&&type=="pieofpie"?(tt=2*Math.PI*l,s=ot*Math.PI*(u.YValues[0]/r.sumofYValues)+tt,s=isNaN(s)?tt:s,p=(s+tt)/2,u.start=u.startAngle=nt-p,u.end=u.endAngle=nt+p,u.midAngle=nt):(u.startAngle=c==0?2*Math.PI*l:type=="pieofpie"?n.pieCollections[f][c-1].endAngle:s,s=u.endAngle=ot*Math.PI*(u.YValues[0]/r.sumofYValues)+u.startAngle,s=u.endAngle=isNaN(s)?u.startAngle:s,u.start=u.startAngle,u.end=u.endAngle,u.midAngle=(u.endAngle+u.startAngle)/2),u.pointIndex=y,pt=-.5*Math.PI,u.radian=u.midAngle%(2*Math.PI),n.labelPosition.toLowerCase()=="outsideextended"&&type!="pieofpie"&&(u.radian<Math.PI?n.rightsidePoints.push(u):n.leftsidePoints.push(u)),l+=u.YValues[0]/r.sumofYValues,p=u.midAngle+pt,(u.actualIndex==n.explodeIndex||n.explodeAll)&&!e.vmlRendering?(r.startX[y]=r.circleCenterX[f]+Math.cos(p)*n.explodeOffset,r.startY[y]=r.circleCenterY[f]+Math.sin(p)*n.explodeOffset):(r.startX[y]=r.circleCenterX[f],r.startY[y]=r.circleCenterY[f]));if(n.labelPosition.toLowerCase()=="outsideextended"&&(n.rightsidePoints=ej.DataManager(n.rightsidePoints,ej.Query().sortBy("radian")).executeLocal(),n.leftsidePoints=ej.DataManager(n.leftsidePoints,ej.Query().sortBy("radian")).executeLocal()),n.marker.dataLabel.template)if(n.labelPosition.toLowerCase()=="outsideextended"){for(d=0;d<n.rightsidePoints.length;d++)ej.EjSvgRender.utils._getSeriesTemplateSize(n.rightsidePoints[d],n.rightsidePoints[d].pointIndex,n,!1,e);for(g=0;g<n.leftsidePoints.length;g++)ej.EjSvgRender.utils._getSeriesTemplateSize(n.leftsidePoints[g],n.leftsidePoints[g].pointIndex,n,!0,e)}else for(h=0;h<n._visiblePoints.length;h++)ej.EjSvgRender.utils._getSeriesTemplateSize(n._visiblePoints[h],n._visiblePoints[h].actualIndex,n,!0,e);else ej.EjSvgRender.utils._getSeriesMaxLabel(n);return n.finalSize={width:k,height:vt},n.finalSize},_drawHiloPath:function(n,i,r,u,f,e){var l=t.inArray(n,this.chartObj.model._visibleSeries),a={name:n.type,id:this.chartObj.svgObject.id+"_Series"+l+"_Point"+f,fill:"none","stroke-dasharray":n.dashArray,"stroke-width":i.borderWidth,stroke:r,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,opacity:n.opacity,d:u},o,s,h,c;this.chartObj.svgRenderer.drawPath(a,this.gSeriesGroupEle);h=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.chartObj.model.requireInvertedAxes);x=Math.min(e.point2.X,e.point1.X)+h.x-i.borderWidth;y=Math.min(e.point2.Y,e.point1.Y)+h.y;e.point1.Y!=e.point2.Y?(o=i.borderWidth+i.borderWidth/2,s=Math.abs(e.point1.Y-e.point2.Y)):(o=Math.abs(e.point2.X-e.point1.X),s=i.borderWidth+i.borderWidth/2);c={X:x,Y:y,Width:o,Height:s};ej.EjSvgRender.utils._addRegion(this.chartObj,c,n,null,f)},isIntersec:function(n,t){return t.Bottom<n.Top||t.Right<n.Left||t.Top>n.Bottom||t.Left>n.Right?!1:!0},IntersectWith:function(n,r,u,f,e){var c=this,h,o,s;if((ej.util.isNullOrUndefined(n.model.rightsidebounds[e])||ej.util.isNullOrUndefined(n.model.leftsidebounds[e]))&&(n.model.leftsidebounds[e]=[],n.model.rightsidebounds[e]=[],n.model.leftsidebounds[e].points=[],n.model.rightsidebounds[e].points=[]),f=="outsideExtended"){for(i=e;i<n.model.bounds.length;i++)if(n.model._visibleSeries[i].labelPosition.toLowerCase()=="outsideextended"){if(!ej.util.isNullOrUndefined(n.model.bounds[i].points.left)&&n.model.bounds[i].points.left.length>0)for(h=n.model.bounds[i].points.left.length,o=h-1;o>=0&&!ej.util.isNullOrUndefined(n.model.bounds[i].points.left[o]);o--)n.model.leftsidebounds[i].points[o]=n.model.bounds[i].points.left[o];if(!ej.util.isNullOrUndefined(n.model.bounds[i].points.right)&&n.model.bounds[i].points.right.length>0)for(h=n.model.bounds[i].points.right.length,k=0;k<h&&!ej.util.isNullOrUndefined(n.model.bounds[i].points.right[k]);k++)n.model.rightsidebounds[i].points[k]=n.model.bounds[i].points.right[k]}}else if(n.model.bounds[e].points.length>0||e>=0)for(i=e;i<n.model.bounds.length&&!ej.util.isNullOrUndefined(n.model.bounds[i]);i++)if(n.model._visibleSeries[i].labelPosition.toLowerCase()!="outsideextended")for(h=n.model.bounds[i].points.length,o=0;o<h&&!ej.util.isNullOrUndefined(n.model.bounds[i].points[o]);o++)n.model.bounds[i].points[o].X<n.model.circleCenterX[e]?t.inArray(n.model.bounds[i].points[o],n.model.leftsidebounds[i].points)==-1&&(n.model.leftsidebounds[i].points[o]=n.model.bounds[i].points[o]):t.inArray(n.model.bounds[i].points[o],n.model.rightsidebounds[i].points)==-1&&(n.model.rightsidebounds[i].points[o]=n.model.bounds[i].points[o]);for(i=e;i<n.model.bounds.length&&!ej.util.isNullOrUndefined(n.model.bounds[i]);i++)if(n.model.leftsidebounds[i].points.length>0&&(bounds=n.model.leftsidebounds[i].points,bounds.length>0))for(o=bounds.length-1;o>=0;o--)if(s=bounds[o],!(ej.util.isNullOrUndefined(s)&&s!=u))if(s.SeriesIndex==u.SeriesIndex&&s.PointIndex==u.PointIndex)if(r.smartLabelPosition=="outside")continue;else break;else if(this.isIntersec(s,u))return!0;for(i=e;i<n.model.bounds.length&&!ej.util.isNullOrUndefined(n.model.bounds[i]);i++)if(bounds=n.model.rightsidebounds[i].points,bounds.length>0)for(o=bounds.length-1;o>=0;o--)if(s=bounds[o],!(ej.util.isNullOrUndefined(s)&&s!=u))if(s.SeriesIndex==u.SeriesIndex&&s.PointIndex==u.PointIndex)if(r.smartLabelPosition=="outside")continue;else break;else if(this.isIntersec(s,u))return!0;return!1},_calculateArcData:function(n,t,i,r,u,f){var u=n.model._isPieOfPie?f:u,ct=r._visiblePoints,ut=i.actualIndex,l=n,p=-.5*Math.PI,e,o,it,rt;r.type.toLowerCase()=="doughnut"&&r._visiblePoints.length==1&&Math.abs(r.endAngle-r.startAngle)==360&&r.startAngle%90!=0?(e=parseFloat((i.startAngle+p).toFixed(3)),o=parseFloat((i.endAngle+p).toFixed(3))-1e-6):(e=i.startAngle+p,o=i.endAngle+p-1e-6);var ft=r.endAngle-r.startAngle,w=o-e<Math.PI?0:1,tt=(e+o)/2;ej.util.isNullOrUndefined(i.currentMidAngle)&&(i.currentMidAngle=(e+o)/2);var b,h,c,v=ft>0?1:0,w=v?o-e<Math.PI?0:1:o-e>-1*Math.PI?0:1,s=l.model.circularRadius[u],a=l.model.innerRadius[u];(ut==r.explodeIndex||r.explodeAll)&&!l.vmlRendering?(h=l.model.circleCenterX[u]+Math.cos(tt)*r.explodeOffset,c=l.model.circleCenterY[u]+Math.sin(tt)*r.explodeOffset):(h=l.model.circleCenterX[u],c=l.model.circleCenterY[u]);var k=h+s*Math.cos(e),d=c+s*Math.sin(e),y=h+s*Math.cos(o),g=c+s*Math.sin(o);if(r.type.toLowerCase()=="doughnut"){var et=h+a*Math.cos(e),ot=c+a*Math.sin(e),nt=h+a*Math.cos(o),st=c+a*Math.sin(o),ht=v?0:1;e<0&&Math.round(i.endAngle-i.startAngle)==6&&(nt=nt-.01,y=y-.01);b="M "+k+" "+d+" A "+s+" "+s+" 0 "+w+" "+v+" "+y+" "+g+" L "+nt+" "+st+" A "+a+" "+a+" 1 "+w+" "+ht+" "+et+" "+ot+" z"}else(i.endAngle-i.startAngle).toFixed(4)==(2*Math.PI).toFixed(4)?(it=h,rt=c,b="M "+k+" "+d+" A "+s+" "+s+" 0 "+w+" "+v+" "+y+" "+g):b="M "+k+" "+d+" A "+s+" "+s+" 0 "+w+" "+v+" "+y+" "+g+" L "+h+" "+c+" z";return{Direction:b,centerX:it,centerY:rt}},getXCordinate:function(n,t,i){return n+t*Math.cos(i)},getYCordinate:function(n,t,i){return n+t*Math.sin(i)},getDoubleRange:function(n,t){var i,r;n>t?(i=t,r=n):(i=n,r=t);var u=r-i,f=(i+r)/2,e=isNaN(i)||isNaN(r);return{Start:i,End:r,Delta:u,Median:f,IsEmpty:e}},isDependentSeries:function(n){var t=n.type.toLowerCase(),i=this.chartObj.model.requireInvertedAxes;return!i||i&&n.isTransposed?t.indexOf("bar")!=-1&&!n._isTransposed||t.indexOf("column")!=-1||t.indexOf("waterfall")!=-1||t.indexOf("hilo")!=-1||t.indexOf("candle")!=-1||t.indexOf("boxandwhisker")!=-1?!0:!1:t.indexOf("bar")!=-1?!0:!1},getPointXYOrgin:function(n,t,i,r){var e=r.model.requireInvertedAxes,u,f;return i.isTransposed&&e||i._isTransposed?(u=(1-ej.EjSvgRender.utils._valueToCoefficient(i.xAxis,n))*i.xAxis.height,f=ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,t)*i.yAxis.width,{X:f,Y:u}):(u=ej.EjSvgRender.utils._valueToCoefficient(i.xAxis,n)*i.xAxis.width,f=(1-ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,t))*i.yAxis.height,{X:u,Y:f})},getRectangle:function(n,t,i,r,u,f){var e=this.getPointXYOrgin(n,t,u,f),o=this.getPointXYOrgin(i,r,u,f);return ej.EjSvgRender.utils._correctRect(e.X,e.Y,o.X,o.Y)},calculateMean:function(n,t,i){var u,f,l,a,v,y,e,o,tt,p,it,rt,w,ut,ft,et,ot=0,c=0,s=[],r=0,b,h,ct;for(n.length>1&&n.sort(function(n,t){return n-t}),b=0;b<n.length;b++)ot=ot+n[b];c=ot/n.length;c=parseInt(c.toFixed(2));s[r]=c;r++;t.boxPlotMode.toLowerCase()=="normal"?(u=n.length%2==0?n.slice(0,n.length/2):n.slice(0,Math.floor(n.length/2)),a=Math.floor(u.length/2),e=u.length%2==0?(u[a-1]+u[a])/2:u[a],e=n.length<=3?n[0]:e,s[r]=e,r++,f=n.length%2==0?n.slice(n.length/2,n.length):n.slice(Math.ceil(n.length/2),n.length),v=Math.floor(f.length/2),o=f.length%2==0?(f[v-1]+f[v])/2:f[v],o=n.length<=3?n[n.length-1]:o,s[r]=o,r++):(t.boxPlotMode.toLowerCase()=="exclusive"||t.boxPlotMode.toLowerCase()=="inclusive")&&(tt=t.boxPlotMode.toLowerCase()=="exclusive"?(n.length+1)/4:(n.length-1)/4,p=Math.floor(tt),it=tt-p,ft=t.boxPlotMode.toLowerCase()=="exclusive"?p-1:p,u=(1-it)*n[ft]+it*n[ft+1],u=n.length<=3?n[0]:u,e=u,s[r]=e,r++,rt=t.boxPlotMode.toLowerCase()=="exclusive"?3*(n.length+1)/4:3*(n.length-1)/4,w=Math.floor(rt),ut=rt-w,et=t.boxPlotMode.toLowerCase()=="exclusive"?w-1:w,f=(1-ut)*n[et]+ut*n[et+1],f=n.length<=3?n[n.length-1]:f,o=f,s[r]=o,r++);y=Math.floor(n.length/2);l=n.length%2==0?(n[y-1]+n[y])/2:n[y];s[r]=l;r++;var st=o-e,lt=o+1.5*st,at=e-1.5*st,k=n[n.length-1],d=n[0],g=[],ht=0,nt=0;for(h=0;h<n.length;h++)lt<n[h]&&(ht++,g[nt]=n[h],nt++,k=n[h-ht]),at>n[h]&&(g[nt]=n[h],nt++,d=n[h+1]);return s[r]=d,r++,s[r]=k,r++,ct={Minimum:d,LowerQuartile:e,midvalue:l,UpperQuartile:o,Maximum:k,boxAverage:c,outliers:g},t._visiblePoints[i].boxPlotValues=ct,t._visiblePoints[i].boxPlotValues.quartileValues=s,{Minimum:d,LowerQuartile:e,midvalue:l,UpperQuartile:o,Maximum:k,boxAverage:c,outliers:g}},calculateBoxAndWhiskerPath:function(n,t,i,r,u,f,e){var y,p,b,k,d;u._visiblePoints[e].boxPlotLocation=[];u._visiblePoints[e].dataLabelLocation=[];var h=0,o=this,w=u._isTransposed,g=this.chartObj.model.requireInvertedAxes,s,l,a,v,c;for(y=0;y<u._visiblePoints[e].boxPlotValues.quartileValues.length;y++)l={xValue:f.xValue,YValues:u._visiblePoints[e].boxPlotValues.quartileValues[y]},a=ej.EjSvgRender.utils._getPoint(l,u),u._visiblePoints[e].boxPlotLocation[h]=a,u._visiblePoints[e].boxPlotLocation[h].xValue=l.xValue,u._visiblePoints[e].boxPlotLocation[h].YValues=l.YValues,u._visiblePoints[e].dataLabelLocation[h]=w?{X:a.X,Y:t.Y+t.Height/2+5}:{X:t.X+t.Width/2,Y:a.Y},h++;for(p=0;p<r.outliers.length;p++)v={xValue:f.xValue,YValues:r.outliers[p]},c=ej.EjSvgRender.utils._getPoint(v,u),u._visiblePoints[e].boxPlotLocation[h]=c,u._visiblePoints[e].boxPlotLocation[h].xValue=v.xValue,u._visiblePoints[e].boxPlotLocation[h].YValues=v.YValues,u._visiblePoints[e].boxPlotLocation[h].outlier=!0,w?c.Y=t.Y+t.Height/2:c.X=t.X+t.Width/2,u._visiblePoints[e].dataLabelLocation[h]=w?{X:c.X-u.outlierSettings.size.height,Y:t.Y+t.Height/2+u.outlierSettings.size.width,outlier:!0}:{X:t.X+t.Width/2,Y:c.Y,outlier:!0},h++;return s=u._visiblePoints[e].boxPlotLocation,u._isTransposed?(b="M "+(o.chartObj.canvasX+s[4].X)+" "+(o.chartObj.canvasY+t.Y)+" L "+(s[4].X+o.chartObj.canvasX)+" "+(t.Height+t.Y+o.chartObj.canvasY)+" M "+(o.chartObj.canvasX+s[4].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" L "+(o.chartObj.canvasX+s[1].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" z",k="M "+(o.chartObj.canvasX+s[5].X)+" "+(o.chartObj.canvasY+t.Y)+" L "+(o.chartObj.canvasX+s[5].X)+" "+(t.Height+t.Y+o.chartObj.canvasY)+" M "+(o.chartObj.canvasX+s[5].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" L "+(o.chartObj.canvasX+s[2].X)+" "+(o.chartObj.canvasY+t.Y+t.Height/2)+" z"):(b="M "+(o.chartObj.canvasX+t.X)+" "+(o.chartObj.canvasY+s[4].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width)+" "+(o.chartObj.canvasY+s[4].Y)+" M "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[4].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[1].Y)+" z",k="M "+(o.chartObj.canvasX+t.X)+" "+(o.chartObj.canvasY+s[5].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width)+" "+(o.chartObj.canvasY+s[5].Y)+" M "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[5].Y)+" L "+(o.chartObj.canvasX+t.X+t.Width/2)+" "+(o.chartObj.canvasY+s[2].Y)+" z"),d=u._isTransposed?"M "+(o.chartObj.canvasX+s[0].X-5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2-5)+" L "+(o.chartObj.canvasX+s[0].X+5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2+5)+" M "+(o.chartObj.canvasX+s[0].X+5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2-5)+" L "+(o.chartObj.canvasX+s[0].X-5)+" "+(o.chartObj.canvasY+t.Y+t.Height/2+5)+" z":"M "+(o.chartObj.canvasX+t.X+t.Width/2-5)+" "+(o.chartObj.canvasY+s[0].Y-5)+" L "+(o.chartObj.canvasX+t.X+t.Width/2+5)+" "+(o.chartObj.canvasY+s[0].Y+5)+" M "+(o.chartObj.canvasX+t.X+t.Width/2-5)+" "+(o.chartObj.canvasY+s[0].Y+5)+" L "+(o.chartObj.canvasX+t.X+t.Width/2+5)+" "+(o.chartObj.canvasY+s[0].Y-5)+" z",{upperWhisker:k,lowerWhisker:b,mean:d}},calculateSides:function(n,t){var i=n.xValue+t.Start,r=n.xValue+t.End;return{x1:i,x2:r}},_getSeriesPosition:function(n){var o,s,i,r,u,f,t,e;if(ej.util.isNullOrUndefined(n.position)||this.chartObj.model.legendCollapsed){for(i=0,r=[],u=0;u<this.chartObj.model._visibleSeries.length;u++)t=this.chartObj.model._visibleSeries[u],t.visibility.toLowerCase()==="visible"&&t.drawType.toLowerCase()=="column"&&r.push(t);for(f=0;f<r.length;f++)t=r[f],t._xAxisName==this.chartObj.model._axes[0].name&&t._yAxisName==this.chartObj.model._axes[1].name&&(t.isStacking?(o||(s=i,i++,o=!0),t.position=s):(t.position=i,i++));for(e=0;e<r.length;e++)r[e].all=i}return{all:n.all,pos:n.position}},getSideBySidePositions:function(n,i){var o=this,e=[],f=o.chartObj.model,r,u=j=k=0,h=f._visibleSeries.length,s,c;return(ej.util.isNullOrUndefined(n.position)||f.legendCollapsed||!i.spacingCalculated)&&(s=f.requireInvertedAxes?f.vAxes:f.hAxes,c=f.requireInvertedAxes?f.hAxes:f.vAxes,t.each(s,function(n,t){var c=[],s,l,a,n;for(r=[],j=0;j<h;j++)s=f._visibleSeries[j],s.visibility.toLowerCase()==="visible"&&o.isDependentSeries(s)&&t.name==s._xAxisName&&c.push(s);for(l=c.length,j=0;j<l;j++)n=f.requireInvertedAxes?c[j].yAxis.columnIndex:c[j].yAxis.rowIndex,r[n]||(r[n]=[],c[j].yAxis.position=null),r[n].push(c[j]);for(u=0;u<r.length;u++)if(!ej.util.isNullOrUndefined(r[u]))for(r[u].all=0,j=0;j<r[u].length;j++)s=r[u][j],s.type.toLowerCase().indexOf("stacking")!=-1?s.stackingGroup?ej.util.isNullOrUndefined(e[s.stackingGroup])?(r[u].all++,s.position=r[u].all,e[s.stackingGroup]=r[u].all):s.position=e[s.stackingGroup]:ej.util.isNullOrUndefined(s.yAxis.position)||f.legendCollapsed?(r[u].all++,s.position=r[u].all,s.yAxis.position=r[u].all,f.legendCollapsed=!1):s.position=s.yAxis.position:(r[u].all++,s.position=r[u].all);for(a=l>0&&c[0].columnWidth,k=0;k<l;k++)n=f.requireInvertedAxes?c[k].yAxis.columnIndex:c[k].yAxis.rowIndex,c[k].all=r[n].all,i.needSpace=i.needSpace||a!=c[k].columnWidth}),i.needSpace&&this.chartObj.model._sideBySideSeriesPlacement&&this._getColumnSpacing(r,i),i.spacingCalculated=!0),{all:n.all,pos:n.position}},getSideBySideInfo:function(n,t){var f;ej.util.isNullOrUndefined(n.xAxis.m_minPointsDelta)&&(this.chartObj.currentSeries=n,n.xAxis.m_minPointsDelta=ej.EjSvgRender.utils.getMinPointsDelta(n.xAxis,this.chartObj));var c=n.columnSpacing,e=n.columnWidth,o=this.getSideBySidePositions(n,t),l=o.pos,s=o.all,u=t.needSpace&&this.chartObj.model._sideBySideSeriesPlacement,r=n.xAxis.m_minPointsDelta*(u?1:e),h=u?t[n.name||n._name].loc:(l-1)/s-.5,i=this.getDoubleRange(h,h+(u?e:1)/s);return this.chartObj.model._sideBySideSeriesPlacement?(i.IsEmpty||(i=this.getDoubleRange(i.Start*r,i.End*r),f=c*i.Delta,i=this.getDoubleRange(i.Start+f/2,i.End-f/2)),i):this.getDoubleRange(-r/2,r/2)},_getColumnSpacing:function(n,t){for(var u=j=0,o,i,f,h,e,c=n.length;u<c;u++){var s=0,r={};for(o=n[u].length;j<o;j++)(i=n[u][j]).type.toLowerCase().indexOf("stacking")==-1?s+=i.columnWidth/i.all:r[f=i.stackingGroup]={width:Math.max(i.columnWidth,r[f]?r[f].width:0),all:i.all};for(h in r)s+=r[h].width/r[h].all;for(e=(1-s)/2-.5,j=0,o=n[u].length;j<o;j++)(i=n[u][j]).type.toLowerCase().indexOf("stacking")==-1?(t[i.name||(i._name="series"+u+j)]={loc:e},e+=i.columnWidth/i.all):r[f=i.stackingGroup].loc==null?(t[i.name||(i._name="series"+u+j)]={loc:e+(r[f].width-i.columnWidth)/2/i.all},r[f].loc=t[i.name||i._name].loc+i.columnWidth/2/i.all,e+=r[f].width/i.all):t[i.name||i._name]={loc:r[f].loc-i.columnWidth/2/i.all}}},draw:function(n,i){var k,s,r,d,o,h,p,v,u,i;if(this.chartObj=n,s=ej.EjSvgRender.utils._getStringBuilder(),i.animationType="path",r=i,d=this.setLineSeriesStyle(r),r.sorting&&(r.points=ej.DataManager(r.points,ej.Query().sortBy("xValue")).executeLocal()),o=this.improveChartPerformance(r),r.pointFill){var y=t.inArray(r,this.chartObj.model._visibleSeries),e,w,b,l,a,it=this.chartObj.model.requireInvertedAxes,g=0,f=this.chartObj,o=r._visiblePoints,nt=r._visiblePoints.length-1,tt=ej.EjSvgRender.utils._getTransform(r.xAxis,r.yAxis,it),rt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+y,transform:"translate("+tt.x+","+tt.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(rt),u=0;u<nt;u++)(b=o[u],c=o[u+1],e||(e=this.chartObj.setStyle(this,r,y,u)),c.visible&&b.visible&&(l=ej.EjSvgRender.utils._getPoint(b,r),a=ej.EjSvgRender.utils._getPoint(c,r),s.append("M "+(l.X+f.canvasX)+" "+(l.Y+f.canvasY)+" L "+(a.X+f.canvasX)+" "+(a.Y+f.canvasY)+" ")),w=this.chartObj.setStyle(this,r,y,u+1),w.interior==e.interior&&u!=nt-1&&c.visible)||(i={name:r.type,id:this.chartObj.svgObject.id+"_Series"+y+"_Point"+g,"stroke-dasharray":e.dashArray,fill:"none","stroke-width":e.width,"stroke-linecap":r.lineCap,"stroke-linejoin":r.lineJoin,stroke:e.interior,opacity:e.opacity,d:s.toString()},this.chartObj.svgRenderer.drawPath(i,this.gSeriesGroupEle),g++,s=ej.EjSvgRender.utils._getStringBuilder(),e=w)}else{for(h=null,v=-1,u=0;u<o.length;u++)if(p=o[u],p.visible){if(h!=null&&o.length>v+1){var c=o[v+1],l=ej.EjSvgRender.utils._getPoint(h,r),a=ej.EjSvgRender.utils._getPoint(c,r),f=this.chartObj;s.append("M "+(l.X+f.canvasX)+" "+(l.Y+f.canvasY)+" L "+(a.X+f.canvasX)+" "+(a.Y+f.canvasY)+" ")}h=p;v=u}else h=null;k=s.toString();this._drawLinePath(r,d,k)}this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},doCircularAnimation:function(n,i,r,u){var f=i.type.toLowerCase();if(f=="pie"||f=="doughnut"||f=="pieofpie"){var e=this,s,h,o=i.points[0]?i.points[0].startAngle:0,c=n.model._isPieOfPie?i.collectionIndex:0;visiblePoints=i.emptyPointSettings.visible?i.visiblePoints:i._visiblePoints;t.each(visiblePoints,function(r,l){s=l.startAngle;h=l.endAngle;n.model._radius=n.model._isPieOfPie?n.model.circularRadius[c]:n.model.circularRadius[u];l.startAngle=0;l.endAngle=l.startAngle;n.model.Radius=0;var a=t(n.gSeriesEle).find("#"+n.svgObject.id+"_SeriesGroup_"+u)[c].childNodes[r];f=="pie"||f=="pieofpie"?t(a).each(function(){this.StartAngle=o;this.EndAngle=o}).animate({StartAngle:s,EndAngle:h,pieRadius:n.model._radius},{duration:1200,queue:!1,step:function(f,o){if(o.prop.toString()==="StartAngle"?(l.startAngle=f,l.endAngle=l.startAngle):o.prop.toString()=="pieRadius"&&n.model?n.model.Radius=f:l.endAngle=f,n.model){var s=e._calculateArcData(n,r,l,i,u,c);n.svgRenderer._setAttr(t(a),{d:s.Direction});n.model.Radius=n.model._radius}},complete:function(){e.circularAnimationComplete(r,n,i)}}):t(a).each(function(){this.StartAngle=o;this.EndAngle=o}).animate({StartAngle:s,EndAngle:h},{duration:1200,queue:!1,step:function(f,o){if(o.prop.toString()==="StartAngle"?(l.startAngle=f,l.endAngle=l.startAngle):l.endAngle=f,n.model){var s=e._calculateArcData(n,r,l,i,u);n.svgRenderer._setAttr(t(a),{d:s.Direction});n.model.Radius=n.model._radius}},complete:function(){e.circularAnimationComplete(r,n,i)}})})}},circularAnimationComplete:function(n,i,r){if(!ej.util.isNullOrUndefined(i.model)){var e,f,u=t.inArray(r,i.model._visibleSeries),o;if(i.gSeriesTextEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gSeriesTextEle[u].id),{visibility:"visible"}),i.gSymbolGroupEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gSymbolGroupEle[u].id),{visibility:"visible"}),i.gDataLabelEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gDataLabelEle[u].id),{visibility:"visible"}),r.marker.dataLabel.template)for(o=t(i.element[0].childNodes[0].childNodes),f=0;f<o.length;f++)t(o[f]).css("display","block");i.gConnectorEle[u]&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gConnectorEle[u].id),{visibility:"visible"});i.gConnectorLinesGroup&&i.svgRenderer._setAttr(t(i.gSeriesEle).find("#"+i.gConnectorLinesGroup.id),{visibility:"visible"});i.model.AnimationComplete=!0;r.AnimationComplete=!0;e=t.extend({},ej.EjSvgRender.commonChartEventArgs);e.data={series:r};i._trigger("animationComplete",e)}},_doLineSymbol:function(n,i,r,u,f,e){if(n.tagName!="defs"){var y=parseInt(r*i),o=this.chartObj==undefined?e:this.chartObj,s=ej.EjSvgRender.utils._getBoundingClientRect(n,o,u,f),l=s.x+s.width/2,a=s.y+s.height/2,v,h=t(n),c=o.svgRenderer._getAttrVal(h,"transform");c=ej.util.isNullOrUndefined(c)?" ":c;o.svgRenderer._setAttr(h,{transform:"scale(0)"});h.delay(y).animate({scales:1},{duration:200,step:function(n){v=n;o.svgRenderer._setAttr(h,{transform:"translate("+l+" "+a+") scale("+v+") translate("+-l+" "+-a+")"+c})}})}},animateSymbol:function(n,i,r,u,f){if(n.tagName!="defs"){var s=this.chartObj==undefined?f:this.chartObj,e=ej.EjSvgRender.utils._getBoundingClientRect(n,s,r,u),c=e.x+e.width/2,l=e.y+e.height/2,a,h=t(n),o=s.svgRenderer._getAttrVal(h,"transform");o=ej.util.isNullOrUndefined(o)?" ":o;h.delay(i).each(function(){this.scale=.5}).animate({scales:1},{duration:500,step:function(n){a=n;s.svgRenderer._setAttr(h,{transform:"translate("+c+" "+l+") scale("+a+") translate("+-c+" "+-l+")"+o})}})}},animateCylinder:function(n,i,r,u){var e,f;i.isTransposed&&r?(e=u[0].width.animVal.value,n.model.series[0].type.indexOf("bar")>-1?(n.svgRenderer._setAttr(t(u),{x:e}),t(u).animate({x:0},2e3,function(){})):(f=u[0].height.animVal.value,n.svgRenderer._setAttr(t(u),{y:0}),t(u).animate({y:parseFloat(n.svgRenderer._getAttrVal(u,"y")),height:parseFloat(n.svgRenderer._getAttrVal(u,"height"))},{duration:2e3,step:function(i){n.svgRenderer._setAttr(t(u),{y:f-i});n.svgRenderer._setAttr(t(u),{height:i})}}))):n.model.series[0].type.indexOf("bar")>-1?t(u).animate({width:parseFloat(n.svgRenderer._getAttrVal(u,"width"))},{duration:2e3,step:function(i){n.svgRenderer._setAttr(t(u),{width:i})}}):(f=u[0].height.animVal.value,n.svgRenderer._setAttr(t(u),{y:f}),t(u).animate({y:0},2e3,function(){}))},animateRect:function(n,i,r,u){var f=ej.EjSvgRender.utils._getBoundingClientRect(n,u,i,r),e,o,h,c,l,s=t(n);i.isTransposed&&r||r?(u.svgRenderer._getAttrVal(s,"plot")==="negative"?(e=f.x+f.width,o=f.y+f.height):(e=f.x,o=f.y),h=") scale(",c=",1) translate("):(u.svgRenderer._getAttrVal(s,"plot")==="negative"?(e=f.x,o=f.y):(e=f.x+f.width,o=f.y+f.height),h=") scale(1,",c=") translate(");s.animate({scales:1},{duration:1e3,complete:function(){i.type.toLowerCase()=="waterfall"&&t("#"+u.svgObject.id+"_SeriesGroup_waterfallLine_"+i.index).attr("visibility","visible")},step:function(n){l=n;u.svgRenderer._setAttr(s,{transform:"translate("+e+" "+o+h+l+c+-e+" "+-o+")"})}})},animateStackingRect:function(n,i,r,u){var f,e,o,s,h=t(n),c,l,a,v=ej.EjSvgRender.utils._getBoundingClientRect(n,u,i,r);i.isTransposed&&r||r?(c=ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,0)*i.yAxis.width,f=c,e=v.y,o=") scale(",s=",1) translate("):(l=(1-ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,0))*i.yAxis.height,f=v.x,e=l,o=") scale(1,",s=") translate(");h.animate({scales:1},{duration:1e3,step:function(n){a=n;u.svgRenderer._setAttr(h,{transform:"translate("+f+" "+e+o+a+s+-f+" "+-e+")"})}})},_doLineAnimation:function(n,i){if(n.model.requireInvertedAxes){var r=parseFloat(n.svgRenderer._getAttrVal(i,"height"));t(i).animate({clipRectHeight:parseFloat(n.svgRenderer._getAttrVal(i,"height"))},{duration:2e3,step:function(u){n.svgRenderer._setAttr(t(i),{y:r-u});n.svgRenderer._setAttr(t(i),{height:u})}})}else t(i).animate({clipRectWidth:parseFloat(n.svgRenderer._getAttrVal(i,"width"))},{duration:2e3,step:function(r){n.svgRenderer._setAttr(t(i),{width:r})}})},_drawLinePath:function(n,i,r){var h=this.chartObj.model.requireInvertedAxes,f,e=t.inArray(n,this.chartObj.model._visibleSeries),o=null,s,u;this.chartObj.model.AreaType=="cartesianaxes"&&(f=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,h),o="translate("+f.x+","+f.y+")");s={id:this.chartObj.svgObject.id+"_SeriesGroup_"+e,transform:o};this.chartObj.gSeriesGroupEle=this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(s);r!=""&&r.indexOf("NaN")==-1&&(u={name:n.type,id:this.chartObj.svgObject.id+"_Series"+e,fill:"none","stroke-dasharray":n.dashArray,"stroke-width":n.width,stroke:i.SeriesInterior,"stroke-linecap":n.lineCap,"stroke-linejoin":n.lineJoin,opacity:n.opacity,d:r},this.chartObj.dragPoint?(u.id=this.chartObj.svgObject.id+"_PreviewSeries"+e,u.opacity=.6,this.chartObj.model.enableCanvasRendering?this.chartObj.svgRenderer.drawPath(u,this.chartObj.canvasElement,o):this.chartObj.svgRenderer.drawPath(u,this.chartObj.gPreviewSeriesGroupEle)):this.chartObj.svgRenderer.drawPath(u,this.gSeriesGroupEle))},drawDataLabel:function(n,i,r,u,f,e,o,s){var bt,a;r.marker=r.marker?r.marker:{};var w=n.yAxis.labelFormat,d,ct=20,ii=n.yAxis.valueType,b,kt=n._visiblePoints[i].boxPlotValues;value=n.type.toLowerCase()=="waterfall"&&(r.showIntermediateSum||r.showTotalSum)?r.waterfallSum:r.y;r.text?b=r.text:w?w.indexOf("{value}")>-1?b=w.replace("{value}",value):w.indexOf("e")==0||w.indexOf("E")==0?(d=w.match(/(\d+)/g),d=d==null?6:d>ct?ct:d,b=value.toExponential(d)):b=ej.format(value,w,this.chartObj.model.locale):b=value;var y=this.chartObj,ot=y.model,g=t.inArray(n,ot._visibleSeries),lt,p,ft=t.extend(!0,{},n.marker,r.marker),k=ft.dataLabel,c=k.font,dt=k.textPosition.toLowerCase(),at=n.type.toLowerCase(),gt=ej.util.isNullOrUndefined(c.size)?"11px":c.size,ni=ej.util.isNullOrUndefined(c.fontStyle)?"Normal":c.fontStyle,ti=ej.util.isNullOrUndefined(c.fontFamily)?"Segoe UI":c.fontFamily,vt={size:gt,fontStyle:ni,fontFamily:ti},v=ej.EjSvgRender.utils._measureText(b,null,vt),yt=this.textPosition(n,g,r,v,at,u,f,e,i,o),h=t.extend({},ej.EjSvgRender.commonChartEventArgs);h.data={text:b,location:{x:yt.x+y.canvasX,y:yt.y+y.canvasY},seriesIndex:g,pointIndex:i};y._trigger("displayTextRendering",h);var pt=ft.dataLabel.offset.y==undefined?ft.dataLabel.offset:ft.dataLabel.offset.y,wt=ft.dataLabel.offset.x,v=ej.EjSvgRender.utils._measureText(h.data.text,null,vt);if(h.data.location.y=dt=="bottom"?h.data.location.y+pt:h.data.location.y-pt,wt&&(h.data.location.x=h.data.location.x+wt),!h.cancel){var nt={id:y.svgObject.id+"_SeriesText"+i+g,x:h.data.location.x,y:h.data.location.y,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,type:n.type,"text-anchor":"middle"},l=k.margin,et=v.width+l.left+l.right,tt=v.height+l.top+l.bottom,st={X:h.data.location.x,Y:h.data.location.y};if(ej.util.isNullOrUndefined(k.template)){lt=k.shape?k.shape:"None";t.each(ot.symbolShape,function(n){lt.toLowerCase()==n.toLowerCase()&&(p=n)});var it=h.data.location.x-l.left/2+l.right/2,rt=h.data.location.y-l.top/2-tt/l.top+l.bottom/2,ut=k.angle,ht=ut>360?ut-360:ut<-360?ut+360:ut;ot.enableCanvasRendering&&ut%360!=0&&(nt.y-=v.height/4,nt.baseline="middle");n._enableSmartLabels&&(r.dataLabel={textX:nt.x,textY:nt.y,x:it,y:rt,width:et,height:tt},r.margin={top:l.top,bottom:l.bottom});r.y!=r.low||r.y===undefined&&r.low===undefined?at.toLowerCase()=="boxandwhisker"&&kt.midvalue!=r.y?(bt={id:y.svgObject.id+"_SeriesText"+i+g,x:ej.util.isNullOrUndefined(s)?h.data.location.x:it,y:ej.util.isNullOrUndefined(s)?h.data.location.y:rt,fill:c.color,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,opacity:c.opacity,type:n.type,"text-anchor":"middle"},a=r.textOptionsBoxValues.length,r.textOptionsBoxValues[a]=bt,r.textOptionsBoxValues[a].angle=ht,r.textOptionsBoxValues[a].drawText=h.data.text,r.textOptionsBoxValues[a].index=i,r.textOptionsBoxValues[a].xPos=ej.util.isNullOrUndefined(s)?it:it-l.left/2+l.right/2,r.textOptionsBoxValues[a].yPos=ej.util.isNullOrUndefined(s)?rt:rt-l.top/2-tt/l.top+l.bottom/2,r.textOptionsBoxValues[a].seriesIndex=g,r.textOptionsBoxValues[a].width=p=="None"?v.width:et,r.textOptionsBoxValues[a].height=p=="None"?v.height:tt,r.textOptionsBoxValues[a].symbolName=p):(r.textOptions=nt,r.textOptions.angle=ht,r.drawText=h.data.text,r.index=i,r.xPos=it,r.yPos=rt,r.seriesIndex=g,r.width=p=="None"?v.width:et,r.height=p=="None"?v.height:tt,r.symbolName=p):(r.xPosLow=it,r.yPosLow=rt,r.widthLow=p=="None"?v.width:et,r.heightLow=p=="None"?v.height:tt,r.textOptionsLow=nt,r.textOptionsLow.angle=ht,r.drawTextLow=h.data.text)}else st.X-=y.canvasX,st.Y-=y.canvasY,this.drawLabelTemplate(n,r,i,st,y)}},updateSmartLabelPosition:function(n,i,r,u,f,e,o,s,h,c){var a=[],d=h,y=d.model,dt=y.legend,ri=y.LegendActualBounds,ui=dt.position.toLowerCase(),g=new ej.seriesTypes[n.type.toLowerCase()],rt="",pt="",et=u.connector.connectorX,ot=u.connector.connectorY,v=u.midPoint.midX,p=u.midPoint.midY,li=u.doughnutMidPoint.dMidX,ai=u.doughnutMidPoint.dMidY,b=e.startX,st=e.startY,fi=t.extend(!0,{},n.marker,i.marker),wt=fi.dataLabel.template?0:4,ht,ct,it=f,ei=n.startAngle>n.endAngle?-.01:.01,gt=fi.dataLabel.connectorLine.type.toLowerCase(),lt,hi=n.type.toLowerCase(),w=y._isPieOfPie?y.circularRadius[n.collectionIndex]:y.circularRadius[c],ni=hi=="pieofpie"?"inside":n.labelPosition.toLowerCase(),oi,ut,ft,at,si,nt,bt,tt,vt,ti,kt,ii,yt;if(ej.util.isNullOrUndefined(y.bounds[c])&&(y.bounds[c]=[],y.bounds[c].points=[],ni=="outsideextended"&&(y.bounds[c].points.left=[],y.bounds[c].points.right=[])),ni=="inside"&&ej.util.isNullOrUndefined(i.smartLabelPosition)){positionX=(v+b)/2;positionY=(p+st)/2;positionX=(v+positionX)/2;positionY=(p+positionY)/2;l=i.isIntersected&&y.bounds[c].points[r]?y.bounds[c].points[r]:v>b?{X:positionX,Y:positionY,Left:positionX,Top:positionY,Right:positionX+s.width,Bottom:positionY+s.height,SeriesIndex:c,PointIndex:r}:{X:positionX,Y:positionY,Left:positionX-s.width,Top:positionY,Right:positionX,Bottom:positionY+s.height,SeriesIndex:c,PointIndex:r};do(ct=!1,this.IntersectWith(d,i,l,"inside",c))&&((lt=l.Left,oi=it*180/Math.PI,oi>=270)||(it+=ei,i.isIntersected=!0,l.Angle=it,v>b?(l.X=l.Left=g.getXCordinate(b,w+o,it),l.Right=l.X+s.width):(l.X=l.Right=g.getXCordinate(b,w+o,it),l.Left=l.Right-s.width),l.Y=l.Top=g.getYCordinate(st,w+o,it),l.Bottom=l.Y+s.height,ct=!0));while(ct);v>b&&l.X<b&&(l.Right=lt,l.Left=lt-s.width);y.bounds[c].points[r]=l;i.isIntersected&&y.bounds[c].points[r].Angle&&(positionX=g.getXCordinate(b,w+o,y.bounds[c].points[r].Angle),positionY=g.getYCordinate(st,w+o,y.bounds[c].points[r].Angle),ut=g.getXCordinate(b,w+o/3,f),ft=g.getYCordinate(st,w+o/3,f),a.push({X:v,Y:p}),a.push({X:ut,Y:ft}),a.push({X:positionX,Y:positionY}),i.isIntersected&>=="bezier"&&!d.vmlRendering&&(pt=g.drawBezierSegment(a,n,r,d,c)),rt="M "+v+" "+p+" L "+ut+" "+ft+" M "+ut+" "+ft+" L "+positionX+" "+positionY)}else if(ni=="outside"||i.smartLabelPosition=="outside"){l=v>=b?{X:et,Y:ot,Left:et,Top:ot,Right:et+s.width,Bottom:ot+s.height,SeriesIndex:c,PointIndex:r}:{X:et,Y:ot,Left:et-s.width,Top:ot,Right:et,Bottom:ot+s.height,SeriesIndex:c,PointIndex:r};do(ct=!1,this.IntersectWith(d,i,l,"outside",c))&&(lt=l.Left,it+=ei,i.isIntersected=!0,v>b?(l.X=l.Left=g.getXCordinate(b,w+o,it),l.Right=l.X+s.width):(l.X=l.Right=g.getXCordinate(b,w+o,it),l.Left=l.Right-s.width),l.Y=l.Top=g.getYCordinate(st,w+o,it),l.Bottom=l.Y+s.height,ct=!0);while(ct);v>b&&l.X<b&&(l.Right=lt,l.Left=lt-s.width);y.bounds[c].points[r]=l;ut=g.getXCordinate(b,w+o/3,f);ft=g.getYCordinate(st,w+o/3,f);a.push({X:v,Y:p});a.push({X:ut,Y:ft});a.push({X:l.X,Y:l.Y});positionX=l.X;positionY=l.Y;o>0&&(v<b?(ht=l.X-y.elementSpacing,positionX=ht-wt):(ht=l.X+y.elementSpacing,positionX=ht+wt),a.push({X:ht,Y:l.Y}));gt!="bezier"||d.vmlRendering?rt="M "+v+" "+p+" L "+ut+" "+ft+" M "+ut+" "+ft+" L "+l.X+" "+l.Y+" M "+l.X+" "+l.Y+" L "+ht+" "+l.Y:pt=g.drawBezierSegment(a,n,r,d,c)}else{at=v;si=p;v=v+Math.cos(f)*-(w/10);p=p+Math.sin(f)*-(w/10);nt=w/4;a.push({X:v,Y:p});v=v+Math.cos(f)*nt;p=p+Math.sin(f)*nt;a.push({X:v,Y:p});bt=dt.visible&&ui=="left"?y.margin.left+ri.Width:0;tt=y.circleCenterX[c];v<b?(v=(tt-w-nt*2-n.LeftLabelMaxWidth>0?tt-w-nt*2+bt:n.LeftLabelMaxWidth>at?at:n.LeftLabelMaxWidth+bt)-s.width/2,vt=a[1].X-n.LeftLabelMaxWidth,kt=tt-w-nt*2-n.LeftLabelMaxWidth>0?nt:n.LeftLabelMaxWidth>at?0:vt>3*(nt/2)?nt:vt/2,connectorLineEdge=+s.width/2):(ti=dt.visible&&ui=="right"?y.margin.right+ri.Width:0,v=(tt+w+nt*2+n.RightLabelMaxWidth<t(d.svgObject).width()-ti?tt+w+nt*2-bt:tt+w+n.RightLabelMaxWidth>t(d.svgObject).width()?at:t(d.svgObject).width()-n.RightLabelMaxWidth-ti)+s.width/2,vt=t(d.svgObject).width()-n.RightLabelMaxWidth-a[1].X,kt=tt+w+nt*2+n.RightLabelMaxWidth<t(d.svgObject).width()?nt:tt+w+n.RightLabelMaxWidth>t(d.svgObject).width()?0:vt>3*(nt/2)?nt:vt/2,connectorLineEdge=-s.width/2);ii=Math.sqrt(Math.pow(at-v,2)+Math.pow(si-p,2))/10;yt=v<b?!0:!1;v=yt?v+ii:v-ii;var vi=yt?1:-1,u=yt?y.bounds[c].points.left:y.bounds[c].points.right,l={X:v,Y:p,Left:v,Top:p,Right:v+s.width,Bottom:p+s.height,index:r,SeriesIndex:c,PointIndex:r},ci=n.endAngle>n.startAngle?!0:!1;if(this.IntersectWith(d,i,l,"outsideExtended",c)&&(a.push(v<b?{X:v+kt+connectorLineEdge,Y:p}:{X:v-kt+connectorLineEdge,Y:p}),p=ci||n.startAngle==null?u[u.length-1].Y+s.height+2:yt?u[u.length-1].Y-s.height-2:u[u.length-1].Y+s.height+2,l.Y=p,l.Top=p,l.Bottom=p+s.height),a.push({X:v+connectorLineEdge,Y:p}),tt<a[0].X&&a[1].X>a[2].X&&(a[2].X=a[1].X),tt>a[0].X&&a[1].X<a[2].X&&(a[2].X=a[1].X),yt?(y.bounds[c].points.left.push(l),a[a.length-1].X>a[a.length-2].X&&(a[a.length-2].X=a[a.length-1].X)):(y.bounds[c].points.right.push(l),a[a.length-1].X<a[a.length-2].X&&(a[a.length-2].X=a[a.length-1].X)),rt=ej.EjSvgRender.utils._getStringBuilder(),gt!="bezier"||d.vmlRendering){for(k=0;k<a.length;k++)k==a.length-1?rt.append(" "):rt.append("M "+a[k].X+" "+a[k].Y+" L "+a[k+1].X+" "+a[k+1].Y+" ");rt=rt.toString()}else pt=g.drawBezierSegment(a,n,r,d,c);positionX=a[a.length-1].X+(v<b?-wt:wt);positionY=a[a.length-1].Y}return{positionX:positionX,positionY:positionY,connectorDirection:rt,isInterSected:i.isIntersected,bezierPath:pt}},updateLabelPosition:function(n,i,r,u,f,e,o,s,h,c){var l=[],a=h,ft=new ej.seriesTypes[n.type.toLowerCase()],d="",y=u.connector.connectorX,w=u.connector.connectorY,v=u.midPoint.midX,p=u.midPoint.midY,ot=u.doughnutMidPoint.dMidX,st=u.doughnutMidPoint.dMidY,tt=e.startX,ht=e.startY,rt=t.extend(!0,{},n.marker,i.marker),it=rt.dataLabel.template?0:4,nt,b=a.model.circularRadius[c],et=type=="pieofpie"?"inside":n.labelPosition.toLowerCase(),g,ut;if(l.push({X:v,Y:p}),l.push({X:y,Y:w}),positionX=y,positionY=w,et=="outside")o>0&&(y<tt?(nt=y-a.model.elementSpacing,positionX=nt-it):(nt=y+a.model.elementSpacing,positionX=nt+it),l.push({X:nt,Y:w})),rt.dataLabel.connectorLine.type.toLowerCase()!="bezier"||a.vmlRendering?d="M "+v+" "+p+" L "+y+" "+w+" M "+y+" "+w+" L "+nt+" "+w:ft.drawBezierSegment(l,n,r,a,c);else if(et=="outsideextended"){if(labelX=v,labelY=p,v=v+Math.cos(f)*-(b/10),p=p+Math.sin(f)*-(b/10),l=[],g=b/4,l.push({X:v,Y:p}),y=v+Math.cos(f)*g,w=p+Math.sin(f)*g,l.push({X:y,Y:w}),ut=a.model.legend.visible&&(a.model.legend.position.toLowerCase()=="left"||a.model.legend.position.toLowerCase()=="right")?a.model.elementSpacing:0,y=v<tt?a.model.centerX-b-g*2-n.LeftLabelMaxWidth>0?a.model.centerX-b-g*2+ut:n.LeftLabelMaxWidth>labelX?labelX:n.LeftLabelMaxWidth:a.model.centerX+b+g*2+n.RightLabelMaxWidth<t(a.svgObject).width()?a.model.centerX+b+g*2-ut:a.model.centerX+b+n.RightLabelMaxWidth>t(a.svgObject).width()?labelX:t(a.svgObject).width()-n.RightLabelMaxWidth,l.push({X:y,Y:w}),d=ej.EjSvgRender.utils._getStringBuilder(),rt.dataLabel.connectorLine.type.toLowerCase()!="bezier"||a.vmlRendering){for(k=0;k<l.length;k++)k==l.length-1?d.append(" "):d.append("M "+l[k].X+" "+l[k].Y+" L "+l[k+1].X+" "+l[k+1].Y+" ");d=d.toString()}else ft.drawBezierSegment(l,n,r,a,c);positionX=l[l.length-1].X+(v<tt?-it:it);positionY=l[l.length-1].Y}else n.type.toLowerCase()=="doughnut"?(positionX=(v+ot)/2,positionY=(p+st)/2):(positionX=(v+tt)/2,positionY=(p+ht)/2,positionX=(v+positionX)/2,positionY=(p+positionY)/2);return{positionX:positionX,positionY:positionY,connectorDirection:d,points:l[l.length-1]}},updateSmartLabel:function(n,i,r,u){var e=!0,h="",c=i.labelPosition.toLowerCase(),p=t.extend(!0,{},i.marker,u.marker),f=p.dataLabel,o=n.model.m_AreaBounds,b=n.model.svgHeight,w=i.type.toLowerCase(),l,a,s,v,y;return u._labelPlacement="",c=="inside"||c=="outsideextended"?this.calculateInsideConnectorLines(r,u,i,n):this.compareDataLabels(u,r,n.model.outsideDataRegionPoints,i,n),l=n.model.enableCanvasRendering&&!f.template?n.pyrX:0,a=n.model.enableCanvasRendering&&!f.template?n.pyrY:0,w=="pyramid"?(n.model.actualHeight<u.yPos-a||u.xPos-l>o.Width&&u._labelPlacement=="insideoverlap"||n.model.legend.position=="right"&&f.template&&u.xPos+u.width>o.Width+n.model.LegendActualBounds.Width)&&(e=!1,u.drawTextacc=""):(u.yPos-a<0||u.xPos-l>o.Width&&u._labelPlacement=="insideoverlap"||n.model.legend.position=="right"&&f.template&&u.xPos+u.width>o.Width+n.model.LegendActualBounds.Width)&&(e=!1,u.drawTextacc=""),(c=="outside"||u._labelPlacement=="insideoverlap")&&e&&(h=this.drawConnectorLines(r,u,i,n)),f.template&&(s=t("#"+u.id),e?(v=u._labelPlacement=="insidenooverlap"?u.textOptionsacc.x+n.pyrX-u.width/2:u.textOptionsacc.x+n.pyrX,y=u._labelPlacement=="insidenooverlap"?u.textOptionsacc.y+n.pyrY:u.textOptionsacc.y+n.pyrY-n.model.elementSpacing,s.css("left",v).css("top",y),s.css("height",u.height).css("overflow","hidden")):s.css("display","none")),{xPos:u.xPos,yPos:u.yPos,textOptionsacc:u.textOptionsacc,connectorDirection:h.connectorDirection,bezierPath:h.bezierdir,drawTextacc:u.drawTextacc}},compareDataLabels:function(n,i,r,u,f){for(var l,nt,p=t.extend(!0,{},u.marker,n.marker),a=p.dataLabel,w,o,b,e,k,v,s=f.model.elementSpacing,h=p.dataLabel.margin,tt=u._visiblePoints.length,c=u.labelPosition.toLowerCase(),d=f.model.enableCanvasRendering?f.pyrX:0,g=f.model.enableCanvasRendering?f.pyrY:0,y=0,it=r.length;y<it;y++)if(w=r[y],o=this.isCollide(w,n,u),o.state)if(c=="inside"||c=="outsideextended")for(n.textOptionsacc.y=n.yPos=n.textOptionsacc.y+o.height,positionPoint=a.template?{x:n.xPos,y:n.yPos}:{x:n.xPos-d,y:n.yPos-g},l=0,nt=tt;l<nt;l++)b=f.isPointInPolygon(f.model.chartRegions[0].Region[l].Polygon,positionPoint),b&&(n.textOptionsacc.x=n.xPos=n.textOptionsacc.x+n.width,positionPoint=a.template?{x:n.xPos,y:n.yPos}:{x:n.xPos-d,y:n.yPos-g});else n._labelPlacement="outside",n.textOptionsacc.y=n.yPos=u.type.toLowerCase()=="pyramid"?n.yPos+o.height+s/2:n.yPos+o.height-s/2,n.textOptionsacc.y=n.textOptionsacc.y+n.height/4-s/2+h.top/2-h.bottom/2;e=a.angle;k=e>360?e-360:e<-360?e+360:e;v="rotate("+k+","+n.textOptionsacc.x+","+n.textOptionsacc.y+")";t(n.textOptionsacc).attr("transform",v);t(n.textOptionsacc).attr("labelRotation",e);t(n.textOptionsacc).attr({transform:v});(c=="inside"||c=="outsideextended")&&(n.yPos=n.yPos+s/4,n.textOptionsacc.y=n.textOptionsacc.y+n.height/4+h.top/2-h.bottom/2);r[r.length]=n},calculateInsideConnectorLines:function(n,i,r,u){var s=i.Polygon,h=t.extend(!0,{},r.marker,i.marker),f=h.dataLabel,c=f.font,e,l=u.model.enableCanvasRendering?u.pyrX:0,a=u.model.enableCanvasRendering?u.pyrY:0,o=70,v=ej.EjSvgRender.utils._measureText(i.drawTextacc,null,c),y=f.template?{x:i.xPos,y:i.yPos}:{x:i.xPos+v.width/2-l,y:i.yPos-i.height/2-a},p=u.isPointInPolygon(s,y);p?i._labelPlacement="insidenooverlap":(i._labelPlacement="insideoverlap",i.textOptionsacc["text-anchor"]="start",e=i.startX+o<u.model.m_AreaBounds.Width?o:u.model.m_AreaBounds.Width-i.startX,i.textOptionsacc.x=i.xPos=i.startX+e,i.textOptionsacc.y=i.yPos=i.yLocation,u.model.enableCanvasRendering&&!f.template&&(i.textOptionsacc.x+=u.pyrX,i.textOptionsacc.y+=u.pyrY,i.xPos+=u.pyrX,i.yPos+=u.pyrY),this.compareDataLabels(i,n,u.model.outsideDataRegionPoints,r,u))},drawConnectorLines:function(n,i,r,u){var h="",v=new ej.seriesTypes[r.type.toLowerCase()],f=r._visiblePoints[n].startX,e=r._visiblePoints[n].startY,o="",y=t.inArray(r,u.model._visibleSeries),p=t.extend(!0,{},r.marker,i.marker),c=p.dataLabel,s=i.textOptionsacc.y-u.model.elementSpacing/2,l=u.model.enableCanvasRendering?u.pyrX:0,a=u.model.enableCanvasRendering?u.pyrY:0,w=[{X:f+l,Y:e+a},{X:i.textOptionsacc.x,Y:s}];return c.connectorLine.type.toLowerCase()!="bezier"||u.vmlRendering?(o="M "+f+" "+e+" L "+i.textOptionsacc.x+" "+s,u.model.enableCanvasRendering&&!c.template&&(o="M "+f+" "+e+" L "+(i.textOptionsacc.x-l)+" "+(s-a))):h=v.drawBezierSegment(w,r,n,u,y),{connectorDirection:o,bezierdir:h}},isCollide:function(n,t,i){var u=0,f=0,e=i.type.toLowerCase(),r;return r=!(n.yPos+n.height<t.yPos||n.yPos>t.yPos+t.height||n.xPos+n.width/2<t.xPos-t.width/2||n.xPos-n.width>t.xPos+t.width),r&&e=="pyramid"?(f=n.yPos+n.height-t.yPos,u=n.xPos+n.width-t.xPos):r&&e=="funnel"&&(f=n.yPos-(t.yPos+t.height),u=n.xPos+n.width-t.xPos),{state:r,height:f,width:u}},trimText:function(n,t,i){t--;var r=t-i.length;return trimmedText=n.substr(0,r),trimmedText+i},trimfunction:function(n,t,i,r,u,f){for(var n,i;t<i;)if(n=this.trimText(n,n.length,r),i=ej.EjSvgRender.utils._measureText(n,u,f).width,n==r){n="";break}return n},calculatePosition:function(n,t,i,r,u){var f,e,o,s;return f=t.x+i/2-r,e=t.y-u,o=t.x-i/2-r,s=t.y-u,{rightEndX:f,rightEndY:e,leftEndX:o,leftEndY:s}},textOption:function(n,i,r,u,f,e,o,s,h,c,l){var a;if(a=i.model._isPieOfPie?t.extend(!0,{},n.marker,l.marker):t.extend(!0,{},n.marker,n._visiblePoints[e].marker),!a.dataLabel.template){t("#"+i.svgObject.id+"series"+c+"_PointText"+e).remove();var y={id:i.svgObject.id+"series"+c+"_PointText"+e,x:s+u,y:h+r.height/4+f,fill:a.dataLabel.font.color,"font-size":a.dataLabel.font.size,"font-family":a.dataLabel.font.fontFamily,"font-style":a.dataLabel.font.fontStyle,"font-weight":a.dataLabel.font.fontWeight,opacity:a.dataLabel.font.opacity,"text-anchor":o,cursor:"default",degree:a.dataLabel.angle},v=a.dataLabel.angle,w=v>360?v-360:v<-360?v+360:v,p="rotate("+w+","+s+","+h+")";t(y).attr("transform",p);t(y).attr("labelRotation",v);t(y).attr({transform:p})}return y},labelTrim:function(n,t,i,r,u,f,e,o,s,h){var k=-.5*Math.PI,rt=.5*Math.PI,p=this.calculatePosition(n,t,i,u,f),v=n.model.series[s].startAngle,a=n.model.series[s].endAngle,ut=n.model.chartRegions.length<n.model._visibleSeries.length?n.model.chartRegions[0].Region:n.model.chartRegions[s].Region,c,l,b,d,y,tt="...",nt=a-v,s=n.model._isPieOfPie?h:s,w,it,g;if(nt<0?(a=a/360,w=a?2*Math.PI*(a<0?1+a:a):0):w=v?2*Math.PI*(n.model.itemCurrentXPos<0?1+n.model.itemCurrentXPos:n.model.itemCurrentXPos):0,v=(Math.atan2(p.rightEndY,p.rightEndX)-k-w)%(2*Math.PI),v<0&&(v=2*Math.PI+v),a=(Math.atan2(p.leftEndY,p.leftEndX)-k-w)%(2*Math.PI),a<0&&(a=2*Math.PI+a),c=parseFloat(e.start.toFixed(14)),l=parseFloat(e.end.toFixed(14)),nt>0?(ej.util.isNullOrUndefined(n.firstStartAngle[0])&&n.firstStartAngle.push(c),c=n.firstStartAngle[0]<0?n.model._isPieOfPie?c:2*Math.PI+c:c,l=n.firstStartAngle[0]<0?n.model._isPieOfPie?l:2*Math.PI+l:l):(c=c<0?n.model._isPieOfPie?c:2*Math.PI+c:c,l=l<0?n.model._isPieOfPie?l:2*Math.PI+l:l),c-=w,l-=w,c>2*Math.PI&&l>2*Math.PI?(v=v+2*Math.PI,a=a+2*Math.PI):c<2*Math.PI&&l>2*Math.PI&&(v<Math.PI/2&&(v=v+2*Math.PI),a<Math.PI/2&&(a=a+2*Math.PI)),v<0&&(a>0||a==null)&&(c=c<0?2*Math.PI+c:c,l=l<=0?2*Math.PI+l:l),b=n.model.circleCenterX[s]<t.x?Math.sqrt(Math.pow(Math.abs(p.rightEndX),2)+Math.pow(Math.abs(p.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(p.leftEndX),2)+Math.pow(Math.abs(p.leftEndY),2)),nt<0&&(l=[c,c=l][0]),a>=c&&a<=l&&v>=c&&v<=l&&b<=n.model.circularRadius[s]&&b>0)d=!0;else for(d=!1;!d;){if(r=this.trimText(r,r.length,tt),r==tt){r="";break}datalabeltWidth=ej.EjSvgRender.utils._measureText(r,null,o);y=this.calculatePosition(n,t,datalabeltWidth.width,u,f);startangle=(Math.atan2(y.rightEndY,y.rightEndX)-k-w)%(2*Math.PI);startangle<0&&(startangle=2*Math.PI+startangle);a=(Math.atan2(y.leftEndY,y.leftEndX)-k-w)%(2*Math.PI);a<0&&(a=2*Math.PI+a);b=n.model.circleCenterX[s]<t.x?Math.sqrt(Math.pow(Math.abs(y.rightEndX),2)+Math.pow(Math.abs(y.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(y.leftEndX),2)+Math.pow(Math.abs(y.leftEndY),2));c>2*Math.PI&&l>2*Math.PI&&n.model._isPieOfPie?(g=c-2*Math.PI,c=g,it=l-2*Math.PI,l=it):c!=0&&c<2*Math.PI&&l>=2*Math.PI&&n.model._isPieOfPie&&(g=c-2*Math.PI,c=g);a>=c&&a<=l&&startangle>=c&&startangle<=l&&b<=n.model.circularRadius[s]&&b>0&&(d=!0)}return r},drawDataLabelAcc:function(n,i,r,u,f,e){var hi=u.marker,li,ru,ut,cr,uu,tt,wi,lr,ar,dt,cu,wt,gt,ei,ni,oi,di,ur,et,fu,eu,ht,ct,si,vr,er,ou;if(u.visible&&(hi&&hi.dataLabel&&hi.dataLabel.visible||(!hi||!hi.dataLabel)&&i.marker.dataLabel.visible)){var o=n,c=i.type.toLowerCase(),it=new ej.seriesTypes[c],yt=ej.util.isNullOrUndefined,k=c=="pieofpie"?"inside":i.labelPosition.toLowerCase(),h=o.model,su=h.title,ot=ej.EjSvgRender.utils._measureText,gi=h.elementSpacing,pt=i.marker,st=pt.dataLabel,v=st.margin,d=st.font,ti=st.connectorLine,ii=ti.type.toLowerCase(),or=h.legend,b=or.position.toLowerCase(),ci=h.LegendActualBounds,yr=yt(u.text)?u.y:u.text,nr=st.enableWrap,pr=yr,y=h._isPieOfPie?e:f,a,sr,g,rt,p=0,ri,tr,w=0,ir;if((c=="pyramid"||c=="funnel")&&k=="outsideextended"&&(k="inside"),g=t.extend({},ej.EjSvgRender.commonChartEventArgs),g.data={text:yr,series:i,pointIndex:r},o._trigger("displayTextRendering",g),sr={size:d.size,fontStyle:d.fontStyle,fontFamily:d.fontFamily},rt=ot(g.data.text,null,sr),ri=rt.width+v.left+v.right,tr=rt.height+v.top+v.bottom,c=="pyramid"||c=="funnel"){var wr=h.title.text?ot(h.title.text,t(this.svgObject).width()-h.margin.left-h.margin.right,h.title.font):0,hr=o.model.title.subTitle.text?ej.EjSvgRender.utils._measureText(o.model.title.subTitle.text,t(this.svgObject).width()-o.model.margin.left-o.model.margin.right,o.model.title.subTitle.font):0,cr=o.model.title.subTitle.text===""?0:hr.height,ht=gi+h.margin.left+(b==="left")?ci.Width:0,ct=(b==="top"?ci.Height:0)+(h.title.text&&h.title.visible?h._titleLocation.Y+wr.height+cr:h.margin.top+gi);ri=ri+10;li={X:u.xLocation+o.pyrX,Y:u.yLocation+o.pyrY};p=u.xLocation;w=u.yLocation;ut=u.marker?u.marker:pt;ut=t.extend(!0,{},pt,ut);a=u.connectorLine;symbolPos={positionX:p,positionY:w}}if(c!="pyramid"&&c!="funnel"){var hu=-.5*Math.PI,ft=u.midAngle+hu,br,kr,dr,wt,rr,wr=h.title.text?ot(h.title.text,t(this.svgObject).width()-h.margin.left-h.margin.right,h.title.font):0,hr=o.model.title.subTitle.text?ej.EjSvgRender.utils._measureText(o.model.title.subTitle.text,t(this.svgObject).width()-o.model.margin.left-o.model.margin.right,o.model.title.subTitle.font):0,cr=o.model.title.subTitle.text===""?0:hr.height,ui,lt,at,ai,gr,nu,tu,vi,iu,yi=h.circularRadius[y];ui=yt(ti.height)?ot(g.data.text,null,d).height:ti.height;ru=o.model._isPieOfPie?u.actualIndex:i._visiblePoints[r].actualIndex;(ru==i.explodeIndex||i.explodeAll)&&!o.vmlRendering?(lt=h.circleCenterX[y]+Math.cos(ft)*i.explodeOffset,at=h.circleCenterY[y]+Math.sin(ft)*i.explodeOffset):(lt=h.circleCenterX[y],at=h.circleCenterY[y]);ai=it.getXCordinate(lt,yi,ft);ai=u.y!=0?ai:parseFloat(ai.toFixed(12));gr=it.getYCordinate(at,yi,ft);nu=it.getXCordinate(lt,h.innerRadius[f],ft);tu=it.getYCordinate(at,h.innerRadius[f],ft);vi=this.getXCordinate(lt,yi+ui,ft);vi=u.y!=0?vi:vi.toFixed(12);iu=this.getYCordinate(at,yi+ui,ft);st.template?size=u.size:(ut=u.marker?u.marker:pt,ut=t.extend(!0,{},pt,ut),shape=ut.dataLabel.shape,size=ot(g.data.text,t(o.svgObject).width(),d),shape.toLowerCase()!="none"&&(size.height=size.height+v.top+v.bottom,size.width=size.width+v.left+v.right));br={midX:ai,midY:gr};kr={dMidX:nu,dMidY:tu};dr={connectorX:vi,connectorY:iu};wt={midPoint:br,doughnutMidPoint:kr,connector:dr};rr={startX:lt,startY:at};i._enableSmartLabels?(position=it.updateSmartLabelPosition(i,u,r,wt,ft,rr,ui,size,n,f),p=position.positionX,w=position.positionY,symbolPos={positionX:p,positionY:w,isInterSected:position.isInterSected},a=o.model._isPieOfPie?"":position.connectorDirection):(position=it.updateLabelPosition(i,u,r,wt,ft,rr,ui,size,n,f),p=position.positionX,w=position.positionY,a=position.connectorDirection)}var pi=k!="inside"&&k!="insidenooverlap"||(c=="pyramid"||c=="funnel")&&k=="outside"?p<h.circleCenterX[y]?"end":"start":"middle",wi=k=="inside"||k=="insidenooverlap"?0:p<h.circleCenterX[y]?-rt.width:rt.width,ht=0,ct=0,s;if((c=="pie"||c=="doughnut"||c=="pieofpie")&&k=="inside"&&(pi=a!=""?p<h.circleCenterX[y]?"end":"start":"middle"),(c=="pyramid"||c=="funnel")&&k=="outside"&&(pi="start"),cr=o.model.title.subTitle.text===""?0:hr.height,this.chartObj&&h.enableCanvasRendering&&(c=="pyramid"||c=="funnel")&&(ht=(b==="left"?ci.Width:0)+gi+h.margin.left,ct=(b==="top"?ci.Height:0)+(su.text?h._titleLocation.Y+wr.height+cr:h.margin.top+gi)),r=o.model._isPieOfPie?u.actualIndex:r,s=this.textOption(i,o,rt,ht,ct,r,pi,p,w,f,u),st.template)li=yt(li)?{X:p,Y:w}:li,uu=u.actualIndex,it.drawLabelTemplate(i,u,uu,li,n),ii=="bezier"&&position.bezierPath!=""&&n.svgRenderer.drawPolyline(position.bezierPath,n.gConnectorEle[f]);else{if(t.each(h.symbolShape,function(n){ut=u.marker?u.marker:pt;ut=t.extend(!0,{},pt,ut);shape=ut.dataLabel.shape;shape.toLowerCase()==n.toLowerCase()&&(symbolName=n)}),p=ht+p-v.left/2+v.right/2+wi/2,w=ct+w-v.top/2+v.bottom/2,(c=="pyramid"||c=="funnel")&&(u.xPos=symbolPos.positionX+ht,u.yPos=symbolPos.positionY+ct,u.width=symbolName=="None"?rt.width:ri,u.height=symbolName=="None"?rt.height:tr,u.symbolName=st.template?"none":symbolName,u.textOptionsacc=s,u.drawTextacc=g.data.text),h.enableCanvasRendering&&s.degree%360!=0&&(s.y-=rt.height/4,s.baseline="middle"),i._enableSmartLabels){var nt=h.m_AreaBounds.Width+h.m_AreaBounds.X+h.margin.left,bt=k,fi=h.enableCanvasRendering,l=typeof g.data.text=="string"?g.data.text:g.data.text.toString(),bi=ot(l,l.length,d).width,ki,kt,vt=0,di=0;or.visible?(b=="left"||b=="right")&&(ki=ci):ki={Width:0};c=="pie"||c=="doughnut"||c=="pieofpie"?((bt=="outside"||bt=="outsideextended"||a!="")&&(kt=h.circleCenterX[y]<s.x?nt-s.x:b=="left"?s.x-h.margin.left-h.elementSpacing*2-ki.Width:s.x-h.margin.left,l=this.trimfunction(l,kt,bi,"...",nt,d),or.visible&&(b=="top"||b=="bottom")&&(l=this._overlapLegend(s,l,n,f))),bt=="inside"&&a==""&&(l=this.labelTrim(o,s,bi,l,lt,at,u,d,f,e),l!=""||o.model._isPieOfPie||(u.smartLabelPosition="outside",position=it.updateSmartLabelPosition(i,u,r,wt,ft,rr,ui,size,n,f),symbolPos={positionX:position.positionX,positionY:position.positionY,isInterSected:position.isInterSected},l=g.data.text,a=position.connectorDirection,pi=h.circleCenterX[y]<position.positionX?"start":"end",s=this.textOption(i,o,rt,ht,ct,r,pi,position.positionX,position.positionY,f,u),kt=h.circleCenterX[y]<position.positionX?b=="right"?nt-s.x-ki:nt-s.x:b=="left"?s.x-ki:s.x,l=this.trimfunction(l,kt,bi,"...",nt,d),delete u.smartLabelPosition))):(c=="pyramid"||c=="funnel")&&(position=it.updateSmartLabel(n,i,r,u),p=position.xPos,w=position.yPos,a=position.connectorDirection,s=position.textOptionsacc,l=u.drawTextacc,(a!=""||ii=="bezier")&&l!=""&&(l=l.toString(),kt=b=="right"?fi?nt-s.x:nt-s.x-o.pyrX:b=="left"?fi?nt-s.x:nt-s.x-o.pyrX:b=="top"?fi?nt-s.x:nt-s.x-o.pyrX:fi?nt-s.x:nt-s.x-o.pyrX,kt<bi&&(l=this.trimfunction(l,kt,bi,"...",nt,d))));tt=ot(l,null,d);c=="pie"||c=="doughnut"||c=="pieofpie"?wi=(k=="inside"||k=="insidenooverlap")&&!symbolPos.isInterSected&&a==""?0:p<h.circleCenterX[y]?-tt.width:tt.width:(c=="pyramid"||c=="funnel")&&(wi=u._labelPlacement=="insidenooverlap"?0:tt.width);c=="pie"||c=="doughnut"||c=="pieofpie"?(p=ht+symbolPos.positionX-v.left/2+v.right/2+wi/2,w=ct+symbolPos.positionY-v.top/2+v.bottom/2):(p=p-v.left/2+v.right/2+wi/2,w=w-v.top/2+v.bottom/2);lr=t("#"+o.svgObject.id+"_dataLabel_series"+f+"_point_"+r);ar=t("#"+o.svgObject.id+"_connectorLine_series"+f+"_point_"+r);l!=""?(lr.show(),ar.show(),nr||it.dataLabelSymbol(f,i,r,p,w,ri,tr,symbolName,o),ii!="bezier"||position.bezierPath==""||ej.util.isNullOrUndefined(position.bezierPath)||n.svgRenderer.drawPolyline(position.bezierPath,n.gConnectorEle[f])):(lr.hide(),ar.hide(),a="");nr||o.svgRenderer.drawText(s,l,o.gSeriesTextEle[f]);dt=ot(l,l.length,d);cu=ot(g.data.text,null,d);(c=="pie"||c=="doughnut"||c=="pieofpie")&&(bt=="inside"&&position.connectorDirection==""?(gt=s.x-tt.width/2,ni=s.x+tt.width/2,ei=s.y-tt.height/2,oi=s.y+tt.height/2):(h.circleCenterX[y]<s.x?(gt=s.x,ni=s.x+tt.width):(gt=s.x-tt.width,ni=s.x),ei=s.y-tt.height/2,oi=s.y+tt.height/3),wt={centerX:h.circleCenterX[y],minX:gt,minY:ei,maxX:ni,maxY:oi,width:dt.width,height:dt.height,labelPosition:bt});(c=="funnel"||c=="pyramid")&&(vt=b=="left"?vt:0,di=0,(a!=""||ii=="bezier")&&(gt=s.x-vt,ni=s.x+tt.width-vt,ei=s.y-tt.height,oi=s.y),wt=fi?{minX:gt+vt,maxX:ni+vt,minY:ei+di,maxY:oi+di,width:dt.width,height:dt.height,labelPosition:bt}:{minX:gt+o.pyrX+vt,maxX:ni+o.pyrX+vt,minY:ei+o.pyrY+di,maxY:oi+o.pyrY+di,width:dt.width,height:dt.height,labelPosition:bt});accDataLabelRegion={bounds:wt,trimmedText:l,text:g.data.text,type:c,font:d};o.accDataLabelRegion.type=c;o.accDataLabelRegion.connectorDirection=a;ej.util.isNullOrUndefined(o.accDataLabelRegion[y])&&(o.accDataLabelRegion[y]=[]);o.accDataLabelRegion[y].length<i._visiblePoints.length&&o.accDataLabelRegion[y].push(accDataLabelRegion);yt(r)||!i.explode||fi||o.accDataLabelRegion[y].splice(r,1,accDataLabelRegion);e==1&&o.accDataLabelRegion[y].length==i._visiblePoints.length&&(o.accDataLabelRegion[f]=t.merge(t.merge([],o.accDataLabelRegion[0]),o.accDataLabelRegion[1]))}else nr||(it.dataLabelSymbol(f,i,r,p,w,ri,tr,symbolName,o),o.svgRenderer.drawText(s,g.data.text,o.gSeriesTextEle[f]));if(nr)if(ur=ot(pr,null,sr),fu=5,et=this.updateWrappedText(s,pr,ur,u,c,lt,at,yi,h.innerRadius[f],k,st,ii=="bezier"?i._enableSmartLabels?yt(position.bezierPath)?"":position.bezierPath.points:position.points:a),l=et.text,s.x=parseFloat(et.x),s.y=parseFloat(et.y),l!=""&&(eu=s["text-anchor"]=="start"?parseFloat(s.x+et.width/2):yt(a)||a==""?parseFloat(s.x):parseFloat(s.x-et.width/2),it.dataLabelSymbol(f,i,r,eu,s.y+et.height/2-ur.height/2-fu,et.width,et.height,symbolName,o)),yt(a)||a==""||((c=="funnel"||c=="pyramid")&&(ht=h.enableCanvasRendering?this.chartObj.pyrX:0,ct=h.enableCanvasRendering?this.chartObj.pyrY:0),si=a.split(" "),vr=k=="outsideextended"&&(c=="pie"||c=="doughnut")?si.length-2:si.length,si[vr-1]=s.y-ct+(et.height/2-ur.height),si[vr-2]=s.x-ht,a=si.toString().replace(/,/g," ")),a=et.exceed==!1?"":a,(h.enableCanvasRendering||this.chartObj.vmlRendering)&&typeof l=="object")for(var fr=0,lu=s.y,au=s.x;fr<l.length;fr++)s.y=parseFloat(lu)+fr*rt.height,s.x=au,o.svgRenderer.drawText(s,l[fr],o.gSeriesTextEle[f]);else o.svgRenderer.drawText(s,l,o.gSeriesTextEle[f])}(c=="pyramid"||c=="funnel")&&st.template&&i._enableSmartLabels&&(position=it.updateSmartLabel(n,i,r,u),p=position.xPos,w=position.yPos,a=position.connectorDirection);ir=jQuery.type(h.pointColors[u.actualIndex])=="array"?h.pointColors[u.actualIndex][0].color:h.pointColors[u.actualIndex];ir=u.fill?jQuery.type(u.fill)=="array"?u.fill[0].color:u.fill:ir;er=[];er[0]=ht;er[1]=ct;(ii!="bezier"||o.vmlRendering||c=="pyramid"||c=="funnel")&&a!=""&&a&&(ou={id:o.svgObject.id+"_connectorLine_series"+f+"_point_"+r,stroke:ti.color?ti.color:ir,"stroke-width":ti.width,d:a},o.svgRenderer.drawPath(ou,o.gConnectorEle[f],er))}},_overlapLegend:function(n,t,i,r){var h=i.svgHeight,v=i.svgWidth,y=i.model.LegendActualBounds,f=i.model.elementSpacing,e=i.model.series[r].marker.dataLabel.margin,c=i.model.series[r].marker.dataLabel.shape,p=c!="none"?e.top:0,w=c!="none"?e.bottom:0,b=ej.EjSvgRender.utils._measureText((t,n)).height,l=n.y+b+w,k=n.y-p,d=i.model.legend.position.toLowerCase(),g=i.model.title,s=g.subTitle,e=i.model.margin,nt=i.model.border.width,tt=s.text==""?0:ej.EjSvgRender.utils._measureText(s.text,v-e.left-e.right,s.font).height+f,a=i.model._titleLocation?i.model._titleLocation.Y:0+tt,u=t,o;return d=="bottom"?(o=h-i.model.LegendActualBounds.Height-f,u=l>o?"":u):(o=a==0?nt+f:a+f,u=k<o+y.Height?"":u),l>h&&(u=""),u},updateWrappedText:function(n,i,r,u,f,e,o,s,h,c,l,a){var w=this.chartObj,v=u,g={},wt=r.width,lt=r.height,ni,y,k,ti=n.x,ii=n.y,bt,b,nt=ti,ot=!0,at=w.model.m_AreaBounds.X,d=ii,tt,et,it,st,vt,pt,dt,ft,p,rt;if(ej.util.isNullOrUndefined(a)||a==""||(typeof a=="object"?(it=a.X,st=a.Y):(tt=a.split(" "),et=c=="outsideextended"?tt.length-2:l.connectorLine.type.toLowerCase()=="bezier"?tt.length-2:tt.length,tt[et-1].indexOf(",")>-1?(vt=tt[et].split(","),it=vt[0],st=vt[1]):(it=tt[et-2],st=tt[et-1]))),f=="pie"||f=="doughnut"){if(c=="inside"){var h=ej.util.isNullOrUndefined(h)?0:h,yt=-.5*Math.PI,ht=v.startAngle+yt,ct=v.endAngle+yt,ut=v.midAngle+yt,ri=180/Math.PI*ut%360,ei=180/Math.PI*ht%360,oi=180/Math.PI*ct%360,kt=f=="doughnut"?.75:.5;nt=this.getXCordinate(e,s*kt,ut);d=this.getYCordinate(o,s*kt,ut);startPointX=this.getXCordinate(e,s,ht);startPointY=this.getYCordinate(o,s,ht);endPointX=this.getXCordinate(e,s,ct);endPointY=this.getYCordinate(o,s,ct);midPointX=this.getXCordinate(e,s,ut);midPointY=this.getYCordinate(o,s,ut);innerCenterX=this.getXCordinate(e,h,ut);innerCenterY=this.getYCordinate(o,h,ut);segmentBounds=this.getSegementMinMax([startPointX,endPointX,f=="doughnut"?innerCenterX:e,midPointX],[startPointY,endPointY,f=="doughnut"?innerCenterY:o,midPointY]);segmentBounds.width=segmentBounds.height>s?segmentBounds.height:segmentBounds.width;b=segmentBounds.width*.75}else if((c=="outside"||c=="outsideextended")&&(f=="pie"||f=="doughnut")&&a!=""){var si=w.model.m_AreaBounds,ui=at,fi=w.svgWidth-at;b=it<=e?it-ui:fi-it;nt=it;d=st}}else if(pt=w.svgWidth,c=="outside")b=pt-it;else if(b=v.width,dt=w.isPointInPolygon(v.Polygon,{x:nt+wt,y:d}),!dt){b=f=="funnel"?v.Polygon[3].x-v.Polygon[4].x:v.Polygon[1].x-v.Polygon[0].x;bt=v.Polygon[3].y-v.Polygon[0].y;var gt=Math.round(wt/b)*lt,ot=gt>=bt-10||b<=50?!0:!1;ot?b=pt-nt-at:(n["text-anchor"]="middle",nt=(f=="funnel"?v.Polygon[4].x:v.Polygon[0].x)+b/2+(w.model.enableCanvasRendering?w.pyrX:0),d=(v.Polygon[0].y+v.Polygon[3].y)/2-gt/2+(w.model.enableCanvasRendering?w.pyrY:0),v._labelPlacement="insidenooverlap")}if(c!="inside"&&a==""&&ej.util.isNullOrUndefined(a))y="";else{for(maxWidth=l.maximumLabelWidth!=null?l.maximumLabelWidth:parseFloat(b),y=i,wrapText=w._rowsCalculation({text:y.toString(),font:l.font},maxWidth,ni),y=wrapText.textCollection,k=t.extend([],y),ft=0;ft<k.length-1;ft++)k[ft+1]=k[ft].concat("<br/>",k[ft+1]);k=k[k.length-1]}return p=ej.EjSvgRender.utils._measureText(k,b,l.font),p.height+=lt/2,(f=="pie"||f=="doughnut")&&c=="inside"&&(d=d-p.height/2+lt/2,y=p.height>segmentBounds.height?"":y,y=p.width>segmentBounds.width?"":y,y==""&&(p.width=0,p.height=0)),g=this.currentBoundary=="undefined"?"undefined":this.currentBoundary,this.currentBoundary={X:nt-p.width/2,Y:parseFloat(d),Height:p.height,Width:p.width},!g||v._labelPlacement=="insidenooverlap"?firstSegment=this.currentBoundary:(rt=this.checkOverlapping(w,this.currentBoundary,g,f,y,firstSegment,ri,c,{startAngle:ht,endAngle:ct,radius:s,centerX:e,centerY:o}),rt[1]&&rt[2]!=""?(g=rt[0],nt=g.X+g.Width/2,d=g.Y,y=rt[2],p.height=rt[0].Height,p.width=rt[0].Width):y=rt[2]),ot=y==""?!1:ot,this.currentBoundary=y==""?g:this.currentBoundary,{text:y,x:nt,y:d,exceed:ot,height:p.height,width:p.width}},checkOverlapping:function(n,t,i,r,u,f,e,o,s){var c=10,l=!1,h,y,a,p,v,w,b;return h=this.getOverlapArea(t,i),l=h.overlap,y=h.xOverlap,a=h.yOverlap,l&&(r=="pie"||r=="doughnut"?o.toLowerCase()=="inside"?(p=y>=a?"Y":"X",p=="X"?(v=e>0&&e<180?-1:1,t.X+=v*(y+c)):(v=e>90&&e<270?-1:1,t.Y+=v*(a+c))):t.Y-=a+c:t.Y=r=="funnel"?i.Y-t.Height-c:i.Y+i.Height+c),(r=="pie"||r=="doughnut"||r=="pieofpie")&&o.toLowerCase()=="inside"?(h=this.getOverlapArea(t,f),u=h.overlap==!0?"":u,l=h.overlap==!0?!0:l,w=this.checkSegmentExceeding(t,s),u=w?u:""):r=="funnel"?t.Y+t.Height>=i.Y&&(u=""):r=="pyramid"&&t.Y+t.Height<=i.Y+i.Height&&(u=""),b=n.model.m_AreaBounds,[{X:t.X,Y:t.Y,Height:t.Height,Width:t.Width},l,u]},getOverlapArea:function(n,t){var i=Math.max(0,Math.min(n.X+n.Width,t.X+t.Width)-Math.max(n.X,t.X)),r=Math.max(0,Math.min(n.Y+n.Height,t.Y+t.Height)-Math.max(n.Y,t.Y)),u=i*r;return overlap=u>0?!0:!1,{overlap:overlap,xOverlap:i,yOverlap:r}},getSegementMinMax:function(n,t){var i,r,u,f,e,o;return n.sort(function(n,t){return n-t}),t.sort(function(n,t){return n-t}),i=n[0],r=n[3],u=t[0],f=t[3],e=r-i,o=f-u,{minX:i,maxX:r,minY:u,maxY:f,width:e,height:o}},checkSegmentExceeding:function(n,t){var u=!1,o=n.X+n.Width/2,s=n.Y+n.Height/2,f=o-t.centerX,e=s-t.centerY,i=Math.atan2(e,f),h=Math.abs(Math.sqrt(f*f+e*e)),r;return h<=t.radius&&(r=2*Math.PI,i=i<0?r+i:i,t.startAngle=t.startAngle<0?r+t.startAngle:t.startAngle,t.endAngle=t.endAngle<0?r+t.endAngle:t.endAngle,i<=t.endAngle&&i>=t.startAngle?u=!0:(i<=r&&i>=t.startAngle&&t.endAngle<t.startAngle||i>0&&i<=t.endAngle&&t.startAngle>t.endAngle)&&(u=!0)),u},drawBezierSegment:function(n,t,i,r,u){for(var h,e,o,s=ej.EjSvgRender.utils._getStringBuilder(),c=new ej.seriesTypes[t.type.toLowerCase()],f=0;f<=16;f++)h=f/16,e=c.GetBezierPoint(h,n,0,n.length,t),s.append(e.X+","+e.Y+" ");if(o={id:r.svgObject.id+"_bezierLine_series"+u+"_point"+i,stroke:t.marker.dataLabel.connectorLine.color?t.marker.dataLabel.connectorLine.color:r.model.pointColors[i],"stroke-width":t.marker.dataLabel.connectorLine.width,fill:"none",points:s.toString()},t._enableSmartLabels)return o;r.svgRenderer.drawPolyline(o,r.gConnectorEle)},GetBezierPoint:function(n,t,i,r,u){var o=new ej.seriesTypes[u.type.toLowerCase()];if(r==1)return t[i];var f=o.GetBezierPoint(n,t,i,r-1,u),e=o.GetBezierPoint(n,t,i+1,r-1,u),c=f.X?f.X:f.x,l=f.Y?f.Y:f.y,a=e.X?e.X:e.x,v=e.Y?e.Y:e.y,s=(1-n)*c+n*a,h=(1-n)*l+n*v;return f.x?{x:s,y:h}:{X:s,Y:h}},drawLabelTemplate:function(n,i,r,u,f){var rt,ut,s,ht,ct,lt,l,ft,et,d,at,vt;f&&(this.chartObj=f);var nt=this.chartObj.model.m_AreaBounds.X,tt=this.chartObj.model.m_AreaBounds.Y,ot=this.chartObj.model.m_AreaBounds.Width,st=this.chartObj.model.m_AreaBounds.Height,p=t.inArray(n,this.chartObj.model._visibleSeries),g=this.chartObj.model.AreaType,a=this.chartObj.model.series[p],w=0,it=0,v=this.chartObj._id,c=t.extend(!0,{},n.marker,i.marker),k={interior:c.dataLabel.fill,opacity:c.dataLabel.opacity,borderColor:c.dataLabel.border.color,borderWidth:c.dataLabel.border.width},b,h,y,pt=this.chartObj.model.chartRegions[r]?this.chartObj.model.chartRegions[r].type:"";if(g!="none"||this.chartObj.model.enable3D){if(rt=t("#template_group_"+v).length!=0?t("#template_group_"+v):t("<div><\/div>").attr("id","template_group_"+v),rt.css("position","relative").css("z-index",1e3),t("#"+c.dataLabel.template).length==0)return;ut=t("#"+c.dataLabel.template).clone();t(ut).attr("id",c.dataLabel.template+"_"+p+"_"+r+"_"+v);s=t(ut);s.css("position","absolute");ht=i.x;i.dataLabeltemplate=!0;i.id=c.dataLabel.template+"_"+p+"_"+r+"_"+v;n.xAxis._valueType.toLowerCase()=="datetime"&&(i.x=ej.format(new Date(i.xValue),ej.util.isNullOrUndefined(n.xAxis.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(n.xAxis._intervalType):n.xAxis.labelFormat,this.chartObj.model.locale));n.xAxis._valueType.toLowerCase()=="category"&&(i.x=ej.EjSvgRender.utils._getLabelContent(r,n.xAxis,this.chartObj.model.locale));i.count=1;ct={series:n,point:i};s.html(s.html().parseTemplate(ct));i.x=ht;lt=g=="cartesianaxes"||!n.enableAnimation||n.type.toLowerCase()=="pyramid"||n.type.toLowerCase()=="funnel"?"block":"none";s.css("display",lt).appendTo(t(rt));t(rt).appendTo("#chartContainer_"+v);l=this.chartObj.model.m_AreaBounds;g!="cartesianaxes"||this.chartObj.model.enable3D||(w=l.X+(this.chartObj.model.requireInvertedAxes?a.yAxis.plotOffset:a.xAxis.plotOffset),it=a.yAxis.y);h=s.width()/2;y=s.height();b=ej.util.isNullOrUndefined(k)&&k.interior?k.interior:g=="none"?this.chartObj.model.pointColors[r]:this.chartObj.model.seriesColors[p]}else b=ej.util.isNullOrUndefined(k)&&k.interior?k.interior:this.chartObj.model.pointColors[r],h=this.chartObj.model.circleCenterX[p]>u.X?i.size.width:0,s=t("#template_group_"+v).find("#"+c.dataLabel.template+"_"+p+"_"+r+"_"+v),i.id=c.dataLabel.template+"_"+p+"_"+r+"_"+v,y=this.chartObj.model.enable3D?0:i.size.height/2;if((a.type=="hilo"||a.type=="hiloopenclose"||a.type=="candle")&&(b=a._visiblePoints[r]._hiloFill),b=jQuery.type(b)=="array"?b[0].color:b,a.type.indexOf("bar")!=-1)var e=u.X+w-h,o=u.Y+(this.chartObj.model.enable3D?0:l.Y)-y+a.xAxis.plotOffset,yt=u.X+w+h;else var e=u.X+w-h,o=it+u.Y-y,yt=u.X+w+h;ft=s[0].style.backgroundColor;s.css("left",e).css("top",o).css("background-color",ft!=""?ft:b).css("display","block").css("cursor","default");this.chartObj.model.AreaType!="cartesianaxes"?(i.xPos=e-this.chartObj.pyrX,i.yPos=o-this.chartObj.pyrY,i.textOptionsacc={x:e-this.chartObj.pyrX,y:o-this.chartObj.pyrY}):i.y==i.low?(i.xPosLow=e,i.yPosLow=o,i.textOptionsLow={x:e,y:o},i.dataLabelLow={textX:e,textY:o,x:e,y:o}):(i.xPos=e,i.yPos=o,i.seriesIndex=p,i.textOptions={x:e,y:o},i.dataLabel={textX:e,textY:o,x:e,y:o},i.margin={top:0,bottom:0,left:0,right:0});i.height=s.outerHeight();i.width=s.outerWidth();et=leftWidth=rightWidth=0;d=0;g=="cartesianaxes"&&(e>w+l.Width||o+y>l.Y+l.Height||e<w||o<it||e>w+l.Width||o>it+l.Height||yt>l.Width+l.X)&&(h=s.outerWidth(),e<nt&&(leftWidth=nt-e),st+tt<o+y&&(at=o+y-(st+tt),d=y-at),o<tt&&(et=tt-o),ot+nt<e+h&&(vt=e+h-(ot+nt),rightWidth=h-vt),rightWidth=rightWidth==0?h:rightWidth,d=d==0?y:d,document.getElementById(s[0].id).style.clip="rect("+et+"px,"+rightWidth+"px,"+d+"px,"+leftWidth+"px)")},animateLabelTemplate:function(n){for(var i,u=t.inArray(n,this.chartObj.model._visibleSeries),f=n._visiblePoints.length,r=0;r<f;r++)i=n.marker.dataLabel.template+"_"+u+"_"+r+"_"+this.chartObj._id,i=t("#"+i),i.css("display","none"),i.delay(1e3).fadeIn(300)},textPosition:function(n,i,r,u,f,e,o,s,h,c){var yt=t.extend(!0,{},n.marker,r.marker),ct=yt.dataLabel,v=ct.horizontalTextAlignment.toLowerCase(),y=ct.verticalTextAlignment.toLowerCase(),a=ct.textPosition.toLowerCase(),pt=n._visiblePoints.length,ot=s,l=10,st=3,nt=ct.margin,g=n.yAxis.isInversed,tt=this.chartObj._getXCrossValue(n,n.xAxis,c),it=f.indexOf("bar")!=-1||f.indexOf("column")!=-1&&f!="rangecolumn"?this.chartObj.model.requireInvertedAxes?"bar":"column":f,d,lt,at,b,ft,ht,vt,et;if(it=="column"||it=="stackingcolumn"||it=="stackingcolumn100")d=this.chartObj.model.chartRegions[ot].Region.Bounds,lt=c.axes[n.xAxis.name]._validCross||!1,w=d.Height,p=d.Width,lt?(b=Math.abs((g?n.yAxis.visibleRange.min:n.yAxis.visibleRange.max)-tt)/n.yAxis.visibleRange.delta*n.yAxis.height,a=="bottom"?o=o<=b?o+w-nt.bottom:o-w+u.height-nt.bottom:a=="middle"?o<b?o+=w/2+u.height/4:o-=w/2:o<b&&g||o<b&&!g?o-=l+u.height/1:o+=l+u.height/1):a=="bottom"?o=r.y>tt&&!n.yAxis.isInversed||r.y<tt&&n.yAxis.isInversed?o+w-nt.bottom:u.height+nt.bottom:a=="middle"?r.y>tt&&!n.yAxis.isInversed||r.y<tt&&n.yAxis.isInversed?o+=w/2+u.height/4:o-=w/2:r.y>tt&&n.yAxis.isInversed||r.y<tt&&!n.yAxis.isInversed?o+=l:o-=l,v&&v=="far"?e+=p/2:v&&v=="near"&&(e-=p/2),y&&y=="near"?o+=a=="bottom"?l:l-st:y&&y=="far"&&(o-=a=="bottom"?l:l);else if(it.indexOf("bar")!=-1){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,p=d.Width,lt=c.axes[n.xAxis.name]._validCross||!1,w=d.Height;o=o+u.height/4;lt?(at=n.xAxis._crossValue||0,b=Math.abs(g?n.yAxis.visibleRange.max:n.yAxis.visibleRange.min-at)/n.yAxis.visibleRange.delta*n.yAxis.width,a=="bottom"?e=e<b&&!g||e>=b&&g?e+p-u.width:e-p+nt.left:a=="middle"?e=e<b&&!g||e>=b&&g?e+p/2-u.width/2:e-p/2-u.width/2:e<b&&!g||e>=b&&g?e-=l+u.width/1:e+=l+u.width/1):a=="bottom"?r.y>0&&!n.yAxis.isInversed||r.y<0&&n.yAxis.isInversed?e=nt.left+u.width/4:e+=p-u.height-nt.right:a=="middle"?r.y>0&&!n.yAxis.isInversed||r.y<0&&n.yAxis.isInversed?e-=p/2+u.width/2:e+=p/2:r.y>=0&&!n.yAxis.isInversed||r.y<0&&n.yAxis.isInversed?e+=u.width/4+l:e-=u.width/4+l;v&&v=="far"?e+=a=="bottom"?u.width-u.width/4:u.width/4+l:v&&v=="near"?e-=a=="bottom"?u.width/4:l-u.width/4-st:e+=u.width/4;y&&y=="near"?o+=w/2:y&&y=="far"&&(o-=w/2)}else if(it=="rangecolumn"){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,rt=0,ut=0;r.high!=r.y&&(rt=d.Height,ut=d.Width);this.chartObj.model.requireInvertedAxes?a=="top"?e=e-ut+(l+u.width/1):a=="bottom"?e=e-ut-(2*u.width+l):a=="middle"&&(e=e-ut):a=="top"?o+=rt-l:a=="bottom"?o=o+rt+(2*u.height+l):a=="middle"&&(o=o+rt);v&&v.toLowerCase()=="far"?e+=d.Width/2:v&&v.toLowerCase()=="near"&&(e-=d.Width/2);y&&y.toLowerCase()=="near"?o+=l-st:y&&y.toLowerCase()=="far"&&(o-=l)}else if(it=="boxandwhisker"){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,rt=0,ut=0;this.chartObj.model.requireInvertedAxes?a=="top"?e=e-ut+(l+u.width/1):a=="bottom"?e=e-ut-(2*u.width+l):a=="middle"&&(e=e-ut):a=="top"?o+=rt-st:a=="bottom"?o+=rt+l+u.width/2:a=="middle"&&(o+=rt+l);v&&v.toLowerCase()=="far"?e+=2*u.width:v&&v.toLowerCase()=="near"&&(e-=2*u.width);y&&y.toLowerCase()=="near"?o=a=="top"?o+l:o-l:y&&y.toLowerCase()=="far"&&(o=a=="top"?o-l:o+l)}else if(f=="waterfall"){var d=this.chartObj.model.chartRegions[ot].Region.Bounds,w=d.Height,p=d.Width,k=r.waterfallSum<0||!r.showIntermediateSum&&!r.showTotalSum&&r.y<0;switch(a){case"bottom":n.isTransposed?e=n.yAxis.isInversed?e+p-(l+u.height/1)-(k?p:0):e-p+(l+u.height/1)+(k?p:0):o=n.yAxis.isInversed?o-u.height+nt.bottom+(k?w:0):o+w-nt.bottom-(k?w:0);break;case"middle":n.isTransposed?e=n.yAxis.isInversed?e+p/2-(k?p:0):e-(p/2+u.width/4)+(k?p:0):o=n.yAxis.isInversed?o-w/2+(k?w:0):o+(w/2+u.height/4)-(k?w:0);break;default:n.isTransposed?e=n.yAxis.isInversed?e-(l+u.height/1)-(k?p:0):e+(l+u.height/1)+(k?p:0):o=n.yAxis.isInversed?o+(l+u.height/1)+(k?w:0):o-(l+u.height/1)-(k?w:0)}v&&v=="far"?e+=p/2:v&&v=="near"&&(e-=p/2);y&&y=="near"?o+=a=="bottom"?u.height/3:u.height+l:y&&y=="far"&&(o-=a=="bottom"?u.height/3:l+u.height/2)}else if(f=="polar"||f=="radar")o+=u.height/4,a=="bottom"?o+=u.height:a=="top"&&(o-=u.height),v&&v=="far"?e+=u.width:v&&v=="near"&&(e-=u.width),y&&y=="near"?o+=u.height/2:y&&y=="far"&&(o-=u.height/2);else{if(it=="rangearea"&&r.high!=r.y)if(this.chartObj.model.series.length==1)et=this.chartObj.model.chartRegions[i][h].region.length,o=this.chartObj.model.chartRegions[i][h].region[et-1].Y,e=this.chartObj.model.chartRegions[i][h].region[et-1].X;else{for(ft=0,ht=0;ht<i;ht++)vt=this.chartObj.model.series[ht].type,ft=vt!="rangearea"?ft+this.chartObj.model.series[ht].points.length:ft+1;et=this.chartObj.model.chartRegions[ft][h].region.length;o=this.chartObj.model.chartRegions[ft][h].region[et-1].Y;e=this.chartObj.model.chartRegions[ft][h].region[et-1].X}this.chartObj.model.requireInvertedAxes?a=="top"?e+=l:a=="bottom"&&(e-=l+u.width/1):a=="bottom"?o+=2*u.height+l:a=="top"&&(o-=l);v&&v=="far"?e+=u.width+l:v&&v=="near"&&(e-=u.width+l);y&&y=="near"?o+=l-st:y&&y=="far"&&(o-=l)}return{x:e,y:o}},changeCrossHairSymbol:function(n,i,r,u,f){var e,o,h,s;return ej.util.isNullOrUndefined(i)||(e={},n=t.extend(!0,{},f.marker,n),e=t.extend(!0,{},this.chartObj.model.crosshair.marker,e),o=f.points[r],h=f.type.toLowerCase(),ej.util.isNullOrUndefined(e.shape)&&(e.shape=n.shape,h=="bubble"&&(e.border.color=o.border&&o.border.color?o.border.color:f.border.color,e.border.width=o.border&&o.border.width?o.border.width:f.border.width)),(!this.chartObj.model.crosshair.visible||ej.util.isNullOrUndefined(e.fill))&&f.type.toLowerCase()!="bubble"&&f.type.toLowerCase()!="scatter"&&(e.fill=e.shape.toLowerCase()=="cross"||e.shape.toLowerCase()=="horizline"||e.shape.toLowerCase()=="vertline"?jQuery.type(this.chartObj.model.seriesColors[u])=="array"?this.chartObj.model.seriesColors[u][0].color:this.chartObj.model.seriesColors[u]:n.border.color),f.type.toLowerCase()!="bubble"||this.chartObj.model.enableCanvasRendering?(e.size.width<=n.size.width&&(e.size.width=n.size.width+2),e.size.height<=n.size.height&&(e.size.height=n.size.height+2),(ej.util.isNullOrUndefined(e.border.color)||!this.chartObj.model.crosshair.visible)&&(ej.util.isNullOrUndefined(n.fill)?h=="scatter"?(e.border.color=o.border&&o.border.color?o.border.color:f.border.color,e.border.width=o.border&&o.border.width?o.border.width:f.border.width):e.border.color=o.fill?o.fill:jQuery.type(this.chartObj.model.seriesColors[u])=="array"?this.chartObj.model.seriesColors[u][0].color:this.chartObj.model.seriesColors[u]:e.border.color=jQuery.type(n.fill)=="array"?n.fill._gradientStop[0].color:n.fill)):(s=t(this.chartObj.gSeriesEle).find("#"+this.chartObj.svgObject.id+"_Series"+u+"_Point"+r)[0].getBoundingClientRect(),e.size.width=(s.right-s.left)/2+15,e.size.height=(s.bottom-s.top)/2+15)),f._trackMarker=e,e},dataLabelSymbol:function(n,i,r,u,f,e,o,s,h,c){var l=h,y,p,v;if(s!="None"){y=l.model._isPieOfPie?ej.ejChart._getPieOfPiePoint(r,i):i._visiblePoints[r];p={startX:u,startY:f};h.model.enable3D||(v=c?c:l.gDataLabelEle[n]);v=l.model.enableCanvasRendering?null:v;var a=t.extend(!0,{},i.marker,y.marker),w={interior:a.dataLabel.fill,opacity:a.dataLabel.opacity,borderColor:a.dataLabel.border.color,borderWidth:a.dataLabel.border.width},b={style:w,gradientName:"symbol",symbolEle:v,width:e,height:o,point:y,location:p,seriesIndex:n,pointIndex:r,element:a,symbolName:s,id:l.svgObject.id+"_dataLabel_series"+n+"_"+r};this.drawSymbolStyle(b,l)}},drawSymbolStyle:function(n,i){var r=i,tt,it,rt,f=n.style,ot=n.gradientName,o=n.symbolEle,st=n.width,lt=n.dashArray,ht=n.height,l=n.point,c=n.location,v=n.seriesIndex,ct=n.visibility,w=n.pointIndex,ut=n.element,y=n.symbolName,d=n.trackSymbol,g=r.model.enableCanvasRendering,ft=r.model.AreaType=="polaraxes",e=r.model.series[v],p,b,et,u,a,s,h;if(f!=null&&(f.borderColor!=""&&(tt=f.borderColor?f.borderColor:"transparent"),rt=f.opacity,it=f.borderWidth<0?0:f.borderWidth),p=null,f.interior?p=ej.util.isNullOrUndefined(f.interior._gradientStop)?f.interior:f.interior._gradientStop:l.fill?p=jQuery.type(l.fill)=="array"?l.fill[0].color:l.fill:(b=r.model.pointColors,p=r.model.AreaType!="none"?e.type.toLowerCase()=="waterfall"&&e.positiveFill&&(l.y>0||l.waterfallSum>0)?e.positiveFill:r.model.seriesColors[v]:jQuery.type(b[w])=="array"?b[w][0].color:b[w]),r.symbolColorName=r.svgRenderer.createGradientElement(ot+v,p,0,0,0,t(r.svgObject).height(),o),et={dashArray:n.dashArray,ShapeSize:{width:st,height:ht},Style:{BorderColor:tt,BorderWidth:it,Opacity:rt,Visibility:ct,Color:r.symbolColorName},PointIndex:w,SeriesIndex:v,Imageurl:ut.imageUrl,Image:ut.image,ID:n.id},u=t.extend({},ej.EjSvgRender.commonChartEventArgs),u.data={location:c,style:et},r._trigger("symbolRendering",u),!u.cancel)if(g)c.startY=r.model.requireInvertedAxes?c.startY:c.startY+(e.yAxis.y?e.yAxis.y-r.canvasY:0),c.startX=r.model.requireInvertedAxes?c.startX:c.startX+(e.xAxis.x?e.xAxis.x-r.canvasX:0),u.data.location.startY=c.startY,ej.util.isNullOrUndefined(d)?r.model.AreaType=="cartesianaxes"?(o=r.svgRenderer.ctx,r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.model.requireInvertedAxes?r.svgRenderer.ctx.rect(e.yAxis.x,e.xAxis.y,e.yAxis.width,e.xAxis.height):r.svgRenderer.ctx.rect(e.xAxis.x,e.yAxis.y,e.xAxis.width,e.yAxis.height),r.svgRenderer.ctx.clip(),ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,u.data.style,r,o),r.svgRenderer.ctx.restore()):(g&&ft&&(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.svgRenderer.ctx.arc(r.model.centerX,r.model.centerY,r.model.Radius,0,2*Math.PI,!1),r.svgRenderer.ctx.clip()),ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,u.data.style,r,o),g&&ft&&r.svgRenderer.ctx.restore()):(a=u.data.style.PointIndex,s=u.data.style.SeriesIndex,r.model.series[s].highlightSettings.enable||t("#"+r._id+"_selection_"+s+"_"+a+"_canvas").length==0&&r.svgRenderer.trackSymbol(u.data.style,u.data.location,y,d,r));else{var a=u.data.style.PointIndex,s=u.data.style.SeriesIndex,nt=e.type,k;e.highlightSettings.enable&&d&&!r.model.crosshair.visible?(f=t.extend(!0,u.data.style),h=e.highlightSettings,f.Style.Color=h.pattern.toLowerCase()=="none"||h.pattern==""?h.color!=""?h.color:f.Style.Color:"url(#"+h.pattern.toLowerCase()+"_Highlight_2D_"+s+")",f.Style.Opacity=h.opacity,f.Style.BorderColor=h.border.color,f.Style.BorderWidth=h.border.width,k=nt=="bubble"?t("#"+this.chartObj.svgObject.id+"_Series"+s+"_Point"+a).attr("class"):t("#"+this.chartObj.svgObject.id+"_Series"+s+"_Point"+a+"_symbol").attr("class"),k!="SelectionStyleseries"+s&&ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,f,r,r.model.enable3D?i.chart3D:o)):(k=nt=="scatter"?t("#"+r.svgObject.id+"_Series"+s+"_Point"+a+"_symbol").attr("class"):t("#"+r.svgObject.id+"_Series"+s+"_Point"+a).attr("class"),k!="SelectionStyleseries"+s&&ej.EjSvgRender.chartSymbol["_draw"+y](u.data.location,u.data.style,r,r.model.enable3D?i.chart3D:o))}!i.chart3D&&nt!="pieofpie"&&r.model.AreaType=="none"&&t(o).children().not("defs").length>r.model._visibleSeries[v]._visiblePoints.length&&t(o.childNodes[n.pointIndex]).replaceWith(t(o.childNodes[t(o.childNodes).length-1]))},drawSymbol:function(n,i,r,u,f,e,o,s){var c,v,y,p,w,g,nt,it;ej.util.isNullOrUndefined(this.chartObj)&&(this.chartObj=e);var h=i._visiblePoints[r],l=i.type.toLowerCase(),tt=l=="boxandwhisker"?s:r,rt=l=="bubble"||l=="scatter"?i.border.dashArray:"",b="None",a=this.changeCrossHairSymbol(h.marker?h.marker:i.marker,o,r,n,i);if(c=l.toLowerCase()=="boxandwhisker"?a?a:t.extend(!0,{},i.outlierSettings,h.outlierSettings,i.border,h.border):a?a:t.extend(!0,{},i.marker,h.marker),t.each(this.chartObj.model.symbolShape,function(n){c.shape.toLowerCase()==n.toLowerCase()&&(b=n)}),b!="None"){v=this.chartObj.model.AreaType=="cartesianaxes"?{startX:u+this.chartObj.canvasX,startY:f+this.chartObj.canvasY}:{startX:u,startY:f};l=="scatter"?(y=h.border&&h.border.color?h.border.color:i.border.color,p=h.border&&h.border.width?h.border.width:i.border.width,w={interior:c.fill,opacity:c.opacity,borderColor:y,borderWidth:p}):l=="boxandwhisker"?(y=h.border&&h.border.color?h.border.color=="transparent"?this.chartObj._saturationColor(i.fill,-.6):h.border.color:i.border.color=="transparent"?this.chartObj._saturationColor(i.fill,-.6):i.border.color,p=h.border&&h.border.width?h.border.width:i.border.width,w={interior:i.fill,opacity:i.opacity,borderColor:y,borderWidth:p}):w={interior:c.fill,opacity:c.opacity,borderColor:c.border.color,borderWidth:c.border.width};var ut=o?this.chartObj.gTrackerEle:this.chartObj.gSymbolGroupEle[n],ft=o?this.chartObj.svgObject.id+"_trackSymbol_"+n+"_"+tt:this.chartObj.svgObject.id+"_Series"+n+"_Point"+tt+"_symbol",et=o?"TrackSymbol":"symbol",k=c.size.width,d=c.size.height,ot={style:w,gradientName:et,symbolEle:ut,width:k,height:d,point:h,location:v,seriesIndex:n,pointIndex:r,element:c,visibility:h.visible?"visible":"hidden",symbolName:b,trackSymbol:o,id:ft,dashArray:rt};this.drawSymbolStyle(ot,this.chartObj,o);i.type.toLowerCase()=="scatter"&&(g=i.xAxis.x,nt=i.yAxis.y,this.chartObj.model.enableCanvasRendering&&(g=0,nt=0),it={X:g+v.startX-d/2,Y:nt+v.startY-k/2,Height:d,Width:k},ej.EjSvgRender.utils._addRegion(this.chartObj,it,i,null,r))}},chartAreaType:"cartesianAxes",requireInvertedAxes:!1,stackingSeries:!1,hiloTypes:!1};ej.ejLineSeries=r(ej.EjSeriesRender);ej.seriesTypes.line=ej.ejLineSeries;ej.ejStepLineSeries=r(ej.EjSeriesRender,{draw:function(n,t){var r=this.chartObj=n,v,e;t.animationType="path";var y=ej.EjSvgRender.utils._getStringBuilder(),i=t,w=this.setLineSeriesStyle(i);i.sorting&&(i.points=ej.DataManager(i.points,ej.Query().sortBy("xValue")).executeLocal());var u=this.improveChartPerformance(i),f=null,s="M",h,p,c,l,a,o=-1;for(e=0;e<u.length;e++)h=u[e],h.visible?(f!=null&&(u.length>o+1&&(p={xValue:u[o+1].xValue,YValues:[f.YValues[0]]},c=ej.EjSvgRender.utils._getPoint(f,i),l=ej.EjSvgRender.utils._getPoint(p,i),a=ej.EjSvgRender.utils._getPoint(u[o+1],i),r=this.chartObj,y.append(s+" "+(c.X+r.canvasX)+" "+(c.Y+r.canvasY)+" L "+(l.X+r.canvasX)+" "+(l.Y+r.canvasY)+" L "+(a.X+r.canvasX)+" "+(a.Y+r.canvasY)+" ")),s="L"),f=h,o=e):(f=null,s="M");v=y.toString();this._drawLinePath(i,w,v);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.ejStepAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var f,h,k,w,u;this.chartObj=n;t.animationType="path";var p=this.chartObj.model.requireInvertedAxes,b,s=ej.EjSvgRender.utils._getStringBuilder(),e=t,d=this.setAreaSeriesStyle(e);e.sorting&&(e.points=ej.DataManager(e.points,ej.Query().sortBy("xValue")).executeLocal());var o=this.improveChartPerformance(e),c=0,v=null,l;e.xAxis._valueType.toLowerCase()=="category"&&e.xAxis.labelPlacement.toLowerCase()!="onticks"&&(c=.5);var g=ej.EjSeriesRender.prototype.getOrigin(this,e,i),a=null,y=!0,r=this.chartObj;for(f=0;f<=o.length;f++)f<o.length?o[f].visible?(l={xValue:o[f].xValue-c,YValues:[o[f].y]},u=ej.EjSvgRender.utils._getPoint(l,e),a||(a={xValue:o[f].xValue-c,YValues:[g]},h=ej.EjSvgRender.utils._getPoint(a,e),s.append("M "+(h.X+r.canvasX)+" "+(h.Y+r.canvasY)+" ")),v!=null&&(k={xValue:l.xValue,YValues:[v.YValues[0]]},w=ej.EjSvgRender.utils._getPoint(k,e),y&&(s.append("L "+(point2.X+r.canvasX)+" "+(point2.Y+r.canvasY)+" "),y=!1),s.append("L "+(w.X+r.canvasX)+" "+(w.Y+r.canvasY)+" L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" "),(c==0&&f==o.length-1||f<o.length-1&&!o[f+1].visible)&&(c>0?(l={xValue:o[f].xValue+c,YValues:[o[f].y]},u=ej.EjSvgRender.utils._getPoint(l,e),p?s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.Y+r.canvasX)+" "+(h.X+r.canvasY)+" "):s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.X+r.canvasX)+" "+(h.Y+r.canvasY)+" ")):p?s.append("L "+(h.X+r.canvasY)+" "+(u.Y+r.canvasX)+" "):s.append("L "+(u.X+r.canvasX)+" "+(h.Y+r.canvasY)+" "),a=null,v=null,y=!0)),a&&(point2=u,v=l)):(a=null,v=null,y=!0):o[f-1].visible&&c>0&&(l={xValue:o[f-1].xValue+c,YValues:[o[f-1].y]},u=ej.EjSvgRender.utils._getPoint(l,e),p?s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.Y+r.canvasX)+" "+(h.X+r.canvasY)+" "):s.append("L "+(u.X+r.canvasX)+" "+(u.Y+r.canvasY)+" L "+(u.X+r.canvasX)+" "+(h.Y+r.canvasY)+" "));b=s.toString();this.drawAreaPath(e,d,b);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.steparea=ej.ejStepAreaSeries;ej.seriesTypes.stepline=ej.ejStepLineSeries;ej.ejColumnSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var v,e,h,a,c,s,d,tt,it,w;this.chartObj=n;v=this.chartObj.model.requireInvertedAxes;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var u=i,o=u.cornerRadius,y=t.inArray(u,this.chartObj.model._visibleSeries),rt=ej.EjSeriesRender.prototype.getOrigin(this,u,r),b=this.getSideBySideInfo(u,r);u.dragSettings.enable&&(u.sidebysideInfo=b);var p=this._isVisiblePoints(u),k=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,v),ut,ft={id:this.chartObj.svgObject.id+"_SeriesGroup_"+y,transform:"translate("+k.x+","+k.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(ft),e=this,h=0;h<p.length;h++)if(a=h,c=p[h],ut=p[h].marker,s=c.YValues[0],d=rt,c.visible){var g=e.calculateSides(c,b),et=g.x1,ot=g.x2,l=this.chartObj.setStyle(e,u,y,a),f=e.getRectangle(et,s,ot,d,u,n),st=Math.min(0,f.Width),ht=Math.min(0,f.Height),nt;(st==0||ht==0)&&f.Width>0&&(i={id:e.chartObj.svgObject.id+"_Series"+y+"_Point"+a,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,cornerRadius:o,fill:l.interior,"stroke-width":l.borderWidth,plot:s<0?"negative":"positive",opacity:l.opacity,stroke:l.borderColor,"stroke-dasharray":l.dashArray},tt={isColumn:!0,stacking:!1,isLastSeries:!0},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,tt):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(it=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=it,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),w=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),nt={X:w.X,Y:w.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,nt,u,c,a));c.symbolLocation=v?{X:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.Y+f.Height:f.Y}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},isRegion:!0});ej.seriesTypes.column=ej.ejColumnSeries;ej.ejStackingColumnSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,s,d,g,y;this.chartObj=n;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var p=this.chartObj.model.requireInvertedAxes,u=i,o=u.cornerRadius,a=t.inArray(u,this.chartObj.model._visibleSeries),nt=this.getSideBySideInfo(u,r),tt=this._isVisiblePoints(u),w=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,p),it={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+w.x+","+w.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(it),e=this,s=0;s<tt.length;s++){var v=s,l=u._visiblePoints[s],rt=u.stackedValue.StartValues[s],h=u.stackedValue.EndValues[s];if(l.visible){var b=e.calculateSides(l,nt),ut=b.x1,ft=b.x2,c=this.chartObj.setStyle(e,u,a,v),f=e.getRectangle(ut,h,ft,rt,u,n),et=Math.min(0,f.Width),ot=Math.min(0,f.Height),k,st=u.type=="stackingcolumn100"?!0:!1;(et==0||ot==0)&&f.Width>0&&(i={id:e.chartObj.svgObject.id+"_Series"+a+"_Point"+v,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,fill:c.interior,cornerRadius:o,"stroke-width":c.borderWidth,plot:h<0?"negative":"positive",opacity:c.opacity,stroke:c.borderColor,"stroke-dasharray":c.dashArray},d={isColumn:!0,stacking:st,isLastSeries:u.stackedValue.stackedSeries},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,d):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(g=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=g,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),y=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),k={X:y.X,Y:y.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,k,u,l,v));l.symbolLocation=p?{X:h<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.xAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:h<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.xAxis._crossValue||0)?f.Y+f.Height:f.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0,isRegion:!0});ej.seriesTypes.stackingcolumn=ej.ejStackingColumnSeries;ej.seriesTypes.stackingcolumn100=ej.ejStackingColumnSeries;ej.seriesTypes.rangecolumn=ej.ejRangeColumnSeries;ej.ejRangeColumnSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,c,g,p;this.chartObj=n;i.animationType="rect";var w=this.chartObj.model.requireInvertedAxes,f=i,s=f.cornerRadius,v=t.inArray(f,this.chartObj.model._visibleSeries),nt=this.getSideBySideInfo(f,r),b=this._isVisiblePoints(f),a=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,w),tt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+v,transform:"translate("+a.x+","+a.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(tt),e=this,c=0;c<b.length;c++){var y=c,o=b[c],h=o.YValues[0],it=o.YValues[1];if(o.visible){var k=e.calculateSides(o,nt),rt=k.x1,ut=k.x2,l=this.chartObj.setStyle(e,f,v,y),u=e.getRectangle(rt,h,ut,it,f,n),ot=e.chartObj.model.m_AreaBounds.Width,ft=Math.min(0,u.Width),et=Math.min(0,u.Height),d;(ft==0||et==0)&&(i={id:e.chartObj.svgObject.id+"_Series"+v+"_Point"+y,x:u.X+e.chartObj.canvasX,y:u.Y+e.chartObj.canvasY,width:u.Width,height:u.Height,cornerRadius:s,fill:l.interior,"stroke-width":l.borderWidth,opacity:l.opacity,stroke:l.borderColor,"stroke-dasharray":l.dashArray},typeof s!="object"&&s>0||s.topLeft>0||s.bottomLeft>0||s.topRight>0||s.bottomRight>0?(g=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=g,f.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle,a.y),e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle,a.y),p=ej.EjSvgRender.utils._getSvgXY(u.X,u.Y,f,e.chartObj),d={X:p.X,Y:p.Y,Width:u.Width,Height:u.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,d,f,o,y));f.type.toLowerCase()=="waterfall"&&(h=o.waterfallSum?o.waterfallSum:o.y);o.symbolLocation=w?{X:h<0&&!f.yAxis.isInversed||f.yAxis.isInversed&&h>0?u.X:u.X+u.Width,Y:u.Y+u.Height/2}:{X:u.X+u.Width/2,Y:h<0&&!f.yAxis.isInversed||f.yAxis.isInversed&&h>0?u.Y+u.Height:u.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0,isRegion:!0});ej.seriesTypes.rangecolumn=ej.ejRangeColumnSeries;ej.ejBoxandwhiskerSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var ut,wt,u,a,rt,w;this.chartObj=n;ut=this.chartObj.model.requireInvertedAxes;i.animationType="rect";var f=i,l=t.inArray(f,this.chartObj.model._visibleSeries),ni=ej.EjSeriesRender.prototype.getOrigin(this,f,r),bt=this.getSideBySideInfo(f,r),b=this._isVisiblePoints(f),ft=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,ut),kt,et=0,dt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+l,transform:"translate("+ft.x+","+ft.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(dt),u=this,a=0;a<b.length;a++){var h=a,ot,v,k,st,d,ht,ct,o,e,lt,at,l,gt,vt,y,g,nt,p,yt,s,tt,pt,it,c=b[a];if(kt=b[a].marker,ot=c.YValues[0],v=u.calculateMean(ot,f,h),k=v.UpperQuartile,st=v.LowerQuartile,c.visible&&(d=u.calculateSides(c,bt),ht=d.x1,ct=d.x2,o=this.chartObj.setStyle(u,f,l,h),e=u.getRectangle(ht,k,ct,st,f,n),lt=Math.min(0,e.Width),at=Math.min(0,e.Height),l=t.inArray(f,this.chartObj.model._visibleSeries),wt=this.chartObj.setStyle(this,f,l,a),gt=ej.EjSvgRender.utils._getStringBuilder(),vt={xValue:c.xValue,YValues:v.midvalue},y=ej.EjSvgRender.utils._getPoint(vt,f),rt=o.borderColor=="transparent"?this.chartObj._saturationColor(o.interior,-.6):o.borderColor,g,(lt==0||at==0)&&e.Width>0)){for(i={id:u.chartObj.svgObject.id+"_Series"+l+"_Point"+h,x:e.X+u.chartObj.canvasX,y:e.Y+u.chartObj.canvasY,width:e.Width,height:e.Height,fill:o.interior,"stroke-width":o.borderWidth,plot:k<0?"negative":"positive",opacity:o.opacity,stroke:rt,"stroke-dasharray":o.dashArray},nt={id:this.chartObj.svgObject.id+"_Series"+l+"_Point"+h+"_median",x1:f._isTransposed?y.X+u.chartObj.canvasX:e.X+u.chartObj.canvasX,y1:f._isTransposed?e.Y+u.chartObj.canvasY:y.Y+u.chartObj.canvasY,x2:f._isTransposed?y.X+u.chartObj.canvasX:e.X+e.Width+u.chartObj.canvasX,y2:f._isTransposed?e.Y+e.Height+u.chartObj.canvasY:y.Y+u.chartObj.canvasY,"stroke-width":o.borderWidth,stroke:rt},u.chartObj.svgRenderer.drawRect(i,u.gSeriesGroupEle),u.chartObj.svgRenderer.drawLine(nt,u.gSeriesGroupEle),p=u.calculateBoxAndWhiskerPath(i,e,nt,v,f,c,h),i.d=p.lowerWhisker,i.id=i.id+"_whisker",u.chartObj.svgRenderer.drawPath(i,u.gSeriesGroupEle),i.d=p.upperWhisker,u.chartObj.svgRenderer.drawPath(i,u.gSeriesGroupEle),f.showMedian==!0&&(i.d=p.mean,u.chartObj.svgRenderer.drawPath(i,u.gSeriesGroupEle)),w=0;w<v.outliers.length;w++)yt={xValue:c.xValue,YValues:v.outliers[w]},s=ej.EjSvgRender.utils._getPoint(yt,f),s.X=f._isTransposed?s.X:e.X+e.Width/2,s.Y=f._isTransposed?e.Y+e.Height/2:s.Y,this.drawSymbol(l,f,h,s.X,s.Y,null,null,et),et++,tt=ej.EjSvgRender.utils._getSvgXY(s.X,s.Y,f,u.chartObj),pt={X:tt.X-f.outlierSettings.size.width/2,Y:tt.Y-f.outlierSettings.size.height/2,Width:f.outlierSettings.size.width,Height:f.outlierSettings.size.height},ej.EjSvgRender.utils._addRegion(u.chartObj,pt,f,c,h);it=ej.EjSvgRender.utils._getSvgXY(e.X,e.Y,f,u.chartObj);g={X:it.X,Y:it.Y,Width:e.Width,Height:e.Height};ej.EjSvgRender.utils._addRegion(u.chartObj,g,f,c,h)}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},isRegion:!0});ej.seriesTypes.boxandwhisker=ej.ejBoxandwhiskerSeries;ej.ejWaterfallSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var o,v,w,c,u,f,y,b,l,p,k,e;ej.ejRangeColumnSeries.prototype.draw.call(this,n,i,r);i.animationType="rect";var a=this.chartObj.model.chartRegions,s=[],d=this.chartObj.model.m_AreaBounds,h=t.inArray(i,this.chartObj.model._visibleSeries);for(i.index=h,o=0,v=0;o<a.length;o++)h==a[o].SeriesIndex&&(s[v]=a[o],v+=1);for(w={id:this.chartObj.svgObject.id+"_SeriesGroup_waterfallLine_"+h},this.connectorLineGroup=this.chartObj.svgRenderer.createGroup(w),e=0;e<s.length-1;e++)c=ej.EjSvgRender.utils._getStringBuilder(),u=s[e].Region.Bounds,f=s[e+1].Region.Bounds,i.isTransposed?(x1=Math.ceil(u.X),w1=Math.ceil(u.Width),x2=Math.ceil(f.X),w2=Math.ceil(f.Width),l=Math.ceil(u.X+u.Width),p=Math.ceil(f.X+f.Width),x=l==p?u.X+u.Width:x1==x2?u.X:x1==p?u.X:u.X+u.Width,c.append("M "+x+" "+(u.Y+u.Height)+" L "+x+" "+f.Y)):(b=Math.ceil(u.Y),h1=Math.ceil(u.Height),y2=Math.ceil(f.Y),h2=Math.ceil(f.Height),l=Math.ceil(u.Y+u.Height),y=b==y2?u.Y:l==y2?f.Y:f.Y+f.Height,c.append("M "+u.X+" "+y+" L "+(f.X+f.Width)+" "+y)),lDirection=c.toString(),lDirection!=""&&u.Height>=0&&(k={id:this.chartObj.svgObject.id+"_waterFall_"+h+"_connectorLine_"+e,fill:"none","stroke-dasharray":i.connectorLine.dashArray,"stroke-width":i.connectorLine.width,stroke:i.connectorLine.color,opacity:i.connectorLine.opacity,d:lDirection},this.chartObj.svgRenderer.drawPath(k,this.connectorLineGroup));this.chartObj.svgRenderer.append(this.connectorLineGroup,this.chartObj.gSeriesEle);i.enableAnimation&&!i._animatedSeries&&this.chartObj.svgRenderer._setAttr(this.connectorLineGroup,{visibility:"hidden"})},hiloTypes:!1,isRegion:!0});ej.seriesTypes.waterfall=ej.ejWaterfallSeries;ej.ejStackingBarSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,s,d,g,nt,y;this.chartObj=n;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var p=this.chartObj.model.requireInvertedAxes,u=i,o=u.cornerRadius,a=t.inArray(u,this.chartObj.model._visibleSeries),tt=this.getSideBySideInfo(u,r),w=this._isVisiblePoints(u),b=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,p),it={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+b.x+","+b.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(it),e=this,s=0;s<w.length;s++){var v=s,l=w[s],h=u.stackedValue.EndValues[s],rt=u.stackedValue.StartValues[s];if(l.visible){var k=e.calculateSides(l,tt),ut=k.x1,ft=k.x2,c=this.chartObj.setStyle(e,u,a,v),f=e.getRectangle(ut,h,ft,rt,u,n),et=Math.min(0,f.Width),ot=Math.min(0,f.Height),st=u.type=="stackingbar100"?!0:!1;(et==0||ot==0)&&(i={id:e.chartObj.svgObject.id+"_Series"+a+"_Point"+v,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,cornerRadius:o,fill:c.interior,"stroke-width":c.borderWidth,opacity:c.opacity,stroke:c.borderColor,"stroke-dasharray":c.dashArray},g={isColumn:!1,stacking:st,isLastSeries:u.stackedValue.stackedSeries},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,g):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(nt=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=nt,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),y=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),d={X:y.X,Y:y.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,d,u,l,v));l.symbolLocation=p?{X:h<(u.yAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.yAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:h<(u.yAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&h>(u.yAxis._crossValue||0)?f.Y+f.Height:f.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0,requireInvertedAxes:!0,isRegion:!0});ej.seriesTypes.stackingbar=ej.ejStackingBarSeries;ej.seriesTypes.stackingbar100=ej.ejStackingBarSeries;ej.ejBarSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var e,h,g,nt,tt,y;this.chartObj=n;i.animationType="rect";i.columnFacet=="cylinder"&&(i.animationType="cylinder");var p=this.chartObj.model.requireInvertedAxes,u=i,o=u.cornerRadius,a=t.inArray(u,this.chartObj.model._visibleSeries),it=ej.EjSeriesRender.prototype.getOrigin(this,u,r),ht=t.extend(!0,{},this.chartObj.model.seriesStyle,u.style),w=this.getSideBySideInfo(u,r);u.dragSettings.enable&&(u.sidebysideInfo=w);var b=this._isVisiblePoints(u),k=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,p),rt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+k.x+","+k.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(rt),e=this,h=0;h<b.length;h++){var v=h,c=b[h],s=c.YValues[0],ut=it;if(c.visible){var d=e.calculateSides(c,w),ft=d.x1,et=d.x2,l=this.chartObj.setStyle(e,u,a,v),f=e.getRectangle(ft,s,et,ut,u,n),ot=Math.min(0,f.Width),st=Math.min(0,f.Height);(ot==0||st==0)&&(i={id:e.chartObj.svgObject.id+"_Series"+a+"_Point"+v,x:f.X+e.chartObj.canvasX,y:f.Y+e.chartObj.canvasY,width:f.Width,height:f.Height,cornerRadius:o,fill:l.interior,"stroke-width":l.borderWidth,plot:s<0?"negative":"positive",opacity:l.opacity,stroke:l.borderColor,"stroke-dasharray":l.dashArray},nt={isColumn:!1,stacking:!1,isLastSeries:!0},u.columnFacet=="cylinder"?e.chartObj.svgRenderer.drawCylinder(i,e.gSeriesGroupEle,nt):typeof o!="object"&&o>0||o.topLeft>0||o.bottomLeft>0||o.topRight>0||o.bottomRight>0?(tt=ej.EjSvgRender.utils._calculateroundedCorner(i),i.d=tt,u.animationType="path",e.chartObj.svgRenderer.drawPath(i,e.gSeriesGroupEle)):u.columnFacet=="rectangle"&&e.chartObj.svgRenderer.drawRect(i,e.gSeriesGroupEle),y=ej.EjSvgRender.utils._getSvgXY(f.X,f.Y,u,e.chartObj),g={X:y.X,Y:y.Y,Width:f.Width,Height:f.Height},ej.EjSvgRender.utils._addRegion(e.chartObj,g,u,c,v));c.symbolLocation=p?{X:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.X:f.X+f.Width,Y:f.Y+f.Height/2}:{X:f.X+f.Width/2,Y:s<(u.xAxis._crossValue||0)&&!u.yAxis.isInversed||u.yAxis.isInversed&&s>(u.xAxis._crossValue||0)?f.Y+f.Height:f.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},requireInvertedAxes:!0,isRegion:!0});ej.seriesTypes.bar=ej.ejBarSeries;ej.ejStackingAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t){var e,h,f;this.chartObj=n;t.animationType="path";var c,u=ej.EjSvgRender.utils._getStringBuilder(),i=t,y=this.setAreaSeriesStyle(i),r=this._isVisiblePoints(i),l=Math.max(t.yAxis.visibleRange.min,i.stackedValue.StartValues[0]),o=this.chartObj.canvasX,s=this.chartObj.canvasY,h={xValue:r[0].xValue,YValues:[l]},f=ej.EjSvgRender.utils._getPoint(h,i),a=0,v=i.stackedValue.EndValues.length;for(u.append("M "+(f.X+o)+" "+(f.Y+s)+" "),j=0;j<=v;j++)if(j!=v&&r[j].visible)currentPoint={xValue:r[j].xValue,YValues:[i.stackedValue.EndValues[j]]},r[j].visible&&(point1=r[j].location=ej.EjSvgRender.utils._getPoint(currentPoint,i),u.append("L "+(point1.X+o)+" "+(point1.Y+s)+" "),r[j].YValues[0]=currentPoint.YValues[0]);else{for(l=i.stackedValue.StartValues[j+1],e=j-1;e>=a;e--)currentPoint={xValue:r[e].xValue,YValues:[i.stackedValue.StartValues[e]]},point1=ej.EjSvgRender.utils._getPoint(currentPoint,i),u.append("L "+(point1.X+o)+" "+(point1.Y+s)+" ");r[j+1]&&r[j+1].visible&&(h={xValue:r[j+1].xValue,YValues:[i.stackedValue.StartValues[j+1]]},f=ej.EjSvgRender.utils._getPoint(h,i),u.append("M "+(f.X+o)+" "+(f.Y+s)+" "));a=j+1}c=u.toString();this.drawAreaPath(i,y,c);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0});ej.seriesTypes.stackingarea=ej.ejStackingAreaSeries;ej.seriesTypes.stackingarea100=ej.ejStackingAreaSeries;ej.ejAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var y,f,l,a,e,w,v;this.chartObj=n;t.animationType="path";var o=ej.EjSvgRender.utils._getStringBuilder(),r=t,b=this.setAreaSeriesStyle(r),p=this.chartObj;r.sorting&&(r.points=ej.DataManager(r.points,ej.Query().sortBy("xValue")).executeLocal());var u=this.chartObj.dragPoint?r.pointCollection:this._isVisiblePoints(r),h=ej.EjSeriesRender.prototype.getOrigin(this,r,i),s,c=[];if(c[0]=p.canvasX,c[1]=p.canvasY,u.length>0){for(f=0;f<u.length;f++)u[f].visible&&(u.length>f+1?(s||(s={xValue:u[f].xValue,YValues:[h]},e=ej.EjSvgRender.utils._getPoint(s,r),o.append("M "+e.X+" "+e.Y+" ")),e=ej.EjSvgRender.utils._getPoint(u[f],r),o.append("L "+e.X+" "+e.Y+" "),u[f+1].visible||(point={xValue:u[f].xValue,YValues:[h]},l=ej.EjSvgRender.utils._getPoint(point,r),a=ej.EjSvgRender.utils._getPoint(s,r),o.append("L "+l.X+" "+l.Y+" L "+a.X+" "+a.Y+" "),s=null)):u[f-1]&&u[f-1].visible&&(e=ej.EjSvgRender.utils._getPoint(u[f],r),o.append("L "+e.X+" "+e.Y+" ")));w={xValue:u[u.length-1].xValue,YValues:[h]};v=ej.EjSvgRender.utils._getPoint(w,r);u.length>1&&o.append("L "+v.X+" "+v.Y+" ");y=o.toString();this.drawAreaPath(r,b,y,c)}this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.area=ej.ejAreaSeries;ej.ejRangeAreaSeries=r(ej.EjSeriesRender,{draw:function(n,i){var w,u,a,v,s,l,o,h,r,y,f,p;this.chartObj=n;i.animationType="path";var c=ej.EjSvgRender.utils._getStringBuilder(),e=i,b=this.setAreaSeriesStyle(e),d=t.inArray(e,this.chartObj.model._visibleSeries);for(e.points=ej.DataManager(e.points,ej.Query().sortBy("xValue")).executeLocal(),u=this._isVisiblePoints(e),a=[],a[0]=this.chartObj.canvasX,a[1]=this.chartObj.canvasY,s=[],r=0;r<u.length;r++)if(s[r]={Region:{PointIndex:r},SeriesIndex:d,region:[]},u[r].visible&&(v||(l=u[r].low,v={xValue:u[r].xValue,YValues:[l]},o=ej.EjSvgRender.utils._getPoint(v,e),c.append("M "+o.X+" "+o.Y+" ")),o=ej.EjSvgRender.utils._getPoint(u[r],e),c.append("L "+o.X+" "+o.Y+" "),s[r].region.push({X:o.X,Y:o.Y}),r!=0&&s[r-1].region.push({X:o.X,Y:o.Y}),r+1<u.length&&!u[r+1].visible)){for(h=r;h>=0;h--)if(u[h].visible)l=u[h].low,y={xValue:u[h].xValue,YValues:[l]},f=ej.EjSvgRender.utils._getPoint(y,e),c.append("L "+f.X+" "+f.Y+" "),s[h].region.push({X:f.X,Y:f.Y}),h!=0&&s[h-1].region.push({X:f.X,Y:f.Y});else break;v=null}for(r=u.length-1;r>=0;r--)if(u[r].visible)l=u[r].low,y={xValue:u[r].xValue,YValues:[l]},f=ej.EjSvgRender.utils._getPoint(y,e),c.append("L "+f.X+" "+f.Y+" "),s[r].region.push({X:f.X,Y:f.Y}),r!=0&&s[r-1].region.push({X:f.X,Y:f.Y});else if(u.length>r&&u[r].visible){f=ej.EjSvgRender.utils._getPoint(u[r],e);c.append("L "+f.X+" "+f.Y+" ");break}else if(r!=u.length-1){for(p=0,k=r-1;k>=0;k--)if(u[k].visible)p++;else if(!u[k].visible)break;r=r-p}w=c.toString();this.chartObj.model.chartRegions.push(s);this.drawAreaPath(e,b,w,a);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.rangearea=ej.ejRangeAreaSeries;ej.ejSplineSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var o,h;i.seriesCollection||(i.seriesCollection={},t._name=ej.util.isNullOrUndefined(t.name)?"":t.name.replace(/ /g,""));i.seriesCollection[t._name]||(i.seriesCollection[t._name]={});this.chartObj=n;t.animationType="path";var r=t,c="",l=ej.EjSvgRender.utils._getStringBuilder(),nt=this.setLineSeriesStyle(r),s=this.chartObj.dragPoint?r.pointCollection:this._isVisiblePoints(r),a=i.seriesCollection[r._name].naturalSpline||this.naturalSpline(s),f=null,e=null,v=-1,tt=0,it=i.seriesCollection[r._name].controlPoints||[];for(o=0;o<s.length;o++)if(h=o,e=s[o],e.visible){if(f!=null){var y=null,p=null,w=it[tt++]||this.getBezierControlPoints(f,e,a[v],a[h],0);y=w.controlPoint1;p=w.controlPoint2;var b=ej.EjSvgRender.utils._getPoint(f,r),k=ej.EjSvgRender.utils._getPoint(e,r),d=ej.EjSvgRender.utils._getPoint(y,r),g=ej.EjSvgRender.utils._getPoint(p,r),u=this.chartObj;l.append("M "+(b.X+u.canvasX)+" "+(b.Y+u.canvasY)+" C "+(d.X+u.canvasX)+" "+(d.Y+u.canvasY)+" "+(g.X+u.canvasX)+" "+(g.Y+u.canvasY)+" "+(k.X+u.canvasX)+" "+(k.Y+u.canvasY)+" ")}f=e;v=h}else f=null;c=l.toString();this._drawLinePath(r,nt,c);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.spline=ej.ejSplineSeries;ej.ejSplineAreaSeries=r(ej.EjSeriesRender,{draw:function(n,t,i){var ht,f,c,l;i.seriesCollection||(i.seriesCollection={},t._name=ej.util.isNullOrUndefined(t.name)?"":t.name.replace(/ /g,""));i.seriesCollection[t._name]||(i.seriesCollection[t._name]={});this.chartObj=n;t.animationType="path";var w=this.chartObj.model.requireInvertedAxes,r=t,b="",e=ej.EjSvgRender.utils._getStringBuilder(),ft=this.setAreaSeriesStyle(r);r.sorting&&(r.points=ej.DataManager(r.points,ej.Query().sortBy("xValue")).executeLocal());var u=this.chartObj.dragPoint?r.pointCollection:this._isVisiblePoints(r),k=i.seriesCollection[r._name].naturalSpline||this.naturalSpline(u),s=null,h=null,d=-1,et=ej.EjSeriesRender.prototype.getOrigin(this,r,i),a=null,y=!0,g=this.chartObj,p=[],ot=0,st=i.seriesCollection[r._name].controlPoints||[];for(p[0]=g.canvasX,p[1]=g.canvasY,ht=0,f=0;f<u.length;f++)if(c=f,h=u[f],h.visible){if(a||(a={xValue:u[f].xValue,YValues:[et]},l=ej.EjSvgRender.utils._getPoint(a,r)),s!=null){var nt=null,tt=null,it=st[ot++]||this.getBezierControlPoints(s,h,k[d],k[c],0);nt=it.controlPoint1;tt=it.controlPoint2;var o=ej.EjSvgRender.utils._getPoint(s,r),v=ej.EjSvgRender.utils._getPoint(h,r),rt=ej.EjSvgRender.utils._getPoint(nt,r),ut=ej.EjSvgRender.utils._getPoint(tt,r);y&&(w?e.append("M "+l.X+" "+o.Y+" L "+o.X+" "+o.Y+" "):e.append("M "+o.X+" "+l.Y+" L "+o.X+" "+o.Y+" "),y=!1);e.append("C "+rt.X+" "+rt.Y+" "+ut.X+" "+ut.Y+" "+v.X+" "+v.Y+" ");(c==u.length-1||c<u.length-1&&!u[f+1].visible)&&(w?e.append("L "+l.X+" "+v.Y+" "):e.append("L "+v.X+" "+l.Y+" "),a=null,y=!0)}s=h;d=c}else s=null;b=e.toString();this.drawAreaPath(r,ft,b,p);this.chartObj.dragPoint?this.chartObj.svgRenderer.append(this.chartObj.gPreviewSeriesGroupEle,this.chartObj.gSeriesEle):this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.splinearea=ej.ejSplineAreaSeries;ej.ejScatterSeries=r(ej.EjSeriesRender,{draw:function(n,i){var f,r,s;this.chartObj=n;f=i;i.animationType="scatter";var h=t.inArray(i,this.chartObj.model._visibleSeries),e=this._isVisiblePoints(f),c=e.length,o,u;for(r=0;r<c;r++)o=e[r],s=r,u=ej.EjSvgRender.utils._getPoint(o,i),this.drawSymbol(h,i,s,u.X,u.Y)}});ej.seriesTypes.scatter=ej.ejScatterSeries;ej.ejBubbleSeries=r(ej.EjSeriesRender,{createBubbleGroup:function(n){var r=t.inArray(n,this.chartObj.model.series),u=this.chartObj.model.m_AreaBounds.X,f=this.chartObj.model.m_AreaBounds.Y,i=n._isTransposed,e=i?u:n.xAxis.x,o=i?f:n.yAxis.y,s={id:this.chartObj.svgObject.id+"_SeriesGroup_"+r,transform:"translate("+e+","+o+")"};this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(s)},draw:function(i,r){var u,f,o,s,nt,ut,ht;this.chartObj=i;r.animationType="bubble";u=r;f=u.cornerRadius;u.points=ej.DataManager(u.points,ej.Query().sortBy("xValue")).executeLocal();var tt=t.inArray(u,this.chartObj.model._visibleSeries),k=this._isVisiblePoints(u),h=1,d=r.bubbleOptions,ct=d.radiusMode.toLowerCase(),a,v,it=i.model.m_AreaBounds,c=i.model._visibleSeries,e=0,rt=Math.max(it.Height,it.Width),y,p,g;if(ct=="minmax")g=rt/100,a=d.minRadius*g,v=d.maxRadius*g,p=v-a,e=Math.max.apply(0,t.map(k,function(n){return n.YValues[h]}));else for(maxValue=rt/10,a=v=1,p=maxValue*v,m=0;m<c.length;m++)if(c[m].type.toLowerCase()=="bubble"&&c[m].visibility=="visible"&&c[m].bubbleOptions.radiusMode.toLowerCase()=="auto")for(points=c[m]._visiblePoints,n=0;n<points.length;n++)e=e<points[n].YValues[h]?points[n].YValues[h]:e;for(this.createBubbleGroup(u),o=0;o<k.length;o++)if(s=k[o],nt=o,s.visible){y=u.bubbleOptions.radiusMode.toLowerCase()=="minmax"?a+p*Math.abs(s.YValues[h]/e):p*Math.abs(s.YValues[h]/e);var w=ej.EjSvgRender.utils._getPoint(s,u),l=this.chartObj.setStyle(this,u,tt,nt),r={id:this.chartObj.svgObject.id+"_Series"+tt+"_Point"+nt,cx:w.X+this.chartObj.canvasX,cy:w.Y+this.chartObj.canvasY,r:y,fill:l.interior,cornerRadius:f,"stroke-width":l.borderWidth,"stroke-dasharray":l.dashArray,opacity:l.opacity,stroke:l.borderColor};typeof f!="object"&&f>0||f.topLeft>0||f.bottomLeft>0||f.topRight>0||f.bottomRight>0?(ut=ej.EjSvgRender.utils.calculateroundedCorner(r),r.d=ut,cSer.chartObj.svgRenderer.drawPath(r,cSer.gSeriesGroupEle)):s.radius=y;this.chartObj.svgRenderer.drawCircle(r,this.gSeriesGroupEle);var lt=w.X,at=w.Y,b=y,ft,et,ot,st;et=lt-b+(u.isTransposed?this.chartObj.model.m_AreaBounds.X:u.xAxis.x);ot=at-b+(u.isTransposed?this.chartObj.model.m_AreaBounds.Y:u.yAxis.y);st=2*b;ft=2*b;ht={X:et,Y:ot,Width:ft,Height:st};ej.EjSvgRender.utils._addRegion(this.chartObj,ht,u,null,o)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}});ej.seriesTypes.bubble=ej.ejBubbleSeries;ej.ejhiloSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var p,f,e,l,a,s,h,k;this.chartObj=n;i.animationType="hilo";p=this.chartObj.model.requireInvertedAxes;f=i;f.points=ej.DataManager(f.points,ej.Query().sortBy("xValue")).executeLocal();var w=this._isVisiblePoints(f),o=this.getSideBySideInfo(f,r),u=null,c=t.inArray(f,this.chartObj.model._visibleSeries),b=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,p),d={id:this.chartObj.svgObject.id+"_SeriesGroup_"+c,transform:"translate("+b.x+","+b.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(d),e=0;e<w.length;e++)if(u=w[e],l=e,u.visible){if(a="",ej.util.isNullOrUndefined(u.YValues[0])||ej.util.isNullOrUndefined(u.YValues[1]))continue;var g=this.chartObj.setStyle(this,f,c,l),nt=this.chartObj.setHiloStyle(f,l,c),v={},y={};u.YValues[0]<u.YValues[1]?(v={xValue:u.xValue+o.Median,YValues:[u.YValues[0]]},y={xValue:u.xValue+o.Median,YValues:[u.YValues[1]]}):(v={xValue:u.xValue+o.Median,YValues:[u.YValues[1]]},y={xValue:u.xValue+o.Median,YValues:[u.YValues[0]]});s=ej.EjSvgRender.utils._getPoint(v,f);h=ej.EjSvgRender.utils._getPoint(y,f);a="M "+(s.X+this.chartObj.canvasX)+" "+(s.Y+this.chartObj.canvasY)+" L "+(h.X+this.chartObj.canvasX)+" "+(h.Y+this.chartObj.canvasY)+" ";k={point1:s,point2:h};this._drawHiloPath(f,g,nt,a,e,k)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.hilo=ej.ejhiloSeries;ej.ejhiloopencloseSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var et,u,a,o,g,w,b,h,c,ht,ct,k,d,lt;this.chartObj=n;et=this.chartObj.model.requireInvertedAxes;i.animationType="hilo";u=i;u.points=ej.DataManager(u.points,ej.Query().sortBy("xValue")).executeLocal();var ot=this._isVisiblePoints(u),e=this.getSideBySideInfo(u,r),f=null,l=this.chartObj.model.palette,p=t.inArray(u,this.chartObj.model._visibleSeries),st=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,et),at={id:this.chartObj.svgObject.id+"_SeriesGroup_"+p,transform:"translate("+st.x+","+st.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(at),o=0;o<ot.length;o++)if(g=o,f=ot[o],f.visible){var s="",vt=ej.util.isNullOrUndefined(u.drawMode)?!0:u.drawMode.toLowerCase()=="both"||u.drawMode.toLowerCase()=="open"?!0:!1,yt=ej.util.isNullOrUndefined(u.drawMode)?!0:u.drawMode.toLowerCase()=="both"||u.drawMode.toLowerCase()=="close"?!0:!1,nt={},tt={},v={},y={};if(f.YValues[0]<f.YValues[1]?(nt={xValue:f.xValue+e.Median,YValues:[f.YValues[0]]},tt={xValue:f.xValue+e.Median,YValues:[f.YValues[1]]},v={xValue:f.xValue,YValues:[f.YValues[2]]},y={xValue:f.xValue,YValues:[f.YValues[3]]}):(nt={xValue:f.xValue+e.Median,YValues:[f.YValues[1]]},tt={xValue:f.xValue+e.Median,YValues:[f.YValues[0]]},v={xValue:f.xValue,YValues:[f.YValues[2]]},y={xValue:f.xValue,YValues:[f.YValues[3]]}),u.fill=u.isFill?u.fill:null,f.YValues[2]<f.YValues[3]?u.bearFillColor=a=ej.util.isNullOrUndefined(u.bearFillColor)?u.fill?u.fill:l&&l.length>0?l[p]:"#339933":u.bearFillColor:u.bullFillColor=a=ej.util.isNullOrUndefined(u.bullFillColor)?u.fill?u.fill:l&&l.length>0?l[p]:"#E51400":u.bullFillColor,w=this.chartObj.setStyle(this,u,p,g,a),b=this.chartObj.setHiloStyle(u,g,p,a),f.fill?a=jQuery.type(f.interior)=="array"?f.fill[0]:f.fill:f._hiloFill=a,h=this.chartObj.canvasX,c=this.chartObj.canvasY,vt){var pt={xValue:v.xValue+e.Median,YValues:v.YValues},it=ej.EjSvgRender.utils._getPoint(pt,u),wt={xValue:v.xValue+e.Start,YValues:v.YValues},rt=ej.EjSvgRender.utils._getPoint(wt,u);s="M "+(it.X+h)+" "+(it.Y+c)+" L "+(rt.X+h)+" "+(rt.Y+c)+" ";ht={point1:it,point2:rt};this._drawHiloPath(u,w,b,s,o,ht);s=""}if(yt){var bt={xValue:y.xValue+e.Median,YValues:y.YValues},ut=ej.EjSvgRender.utils._getPoint(bt,u),kt={xValue:y.xValue+e.End,YValues:y.YValues},ft=ej.EjSvgRender.utils._getPoint(kt,u);s="M "+(ut.X+h)+" "+(ut.Y+c)+" L "+(ft.X+h)+" "+(ft.Y+c)+" ";ct={point1:ut,point2:ft};this._drawHiloPath(u,w,b,s,o,ct);s=""}k=ej.EjSvgRender.utils._getPoint(nt,u);d=ej.EjSvgRender.utils._getPoint(tt,u);s="M "+(k.X+h)+" "+(k.Y+c)+" L "+(d.X+h)+" "+(d.Y+c)+" ";lt={point1:k,point2:d};this._drawHiloPath(u,w,b,s,o,lt)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.hiloopenclose=ej.ejhiloopencloseSeries;ej.ejCandleSeries=r(ej.EjSeriesRender,{draw:function(n,i,r){var rt,f,y,o,b,v,g,ht,it,at;this.chartObj=n;i.animationType="hilo";rt=this.chartObj.model.requireInvertedAxes;f=i;f.points=ej.DataManager(f.points,ej.Query().sortBy("xValue")).executeLocal();var ut=this._isVisiblePoints(f),e=this.getSideBySideInfo(f,r),u=null,l=this.chartObj.model.palette,a=t.inArray(f,this.chartObj.model._visibleSeries),ft=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,rt),vt={id:this.chartObj.svgObject.id+"_SeriesGroup_"+a,transform:"translate("+ft.x+","+ft.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(vt),o=0;o<ut.length;o++)if(u=ut[o],b=o,u.visible){var et="",k={},d={},s={},h={};u.YValues[0]<u.YValues[1]?(k={xValue:u.xValue+e.Median,YValues:[u.YValues[0]]},d={xValue:u.xValue+e.Median,YValues:[u.YValues[1]]},s={xValue:u.xValue,YValues:[u.YValues[2]]},h={xValue:u.xValue,YValues:[u.YValues[3]]}):(k={xValue:u.xValue+e.Median,YValues:[u.YValues[1]]},d={xValue:u.xValue+e.Median,YValues:[u.YValues[0]]},s={xValue:u.xValue,YValues:[u.YValues[2]]},h={xValue:u.xValue,YValues:[u.YValues[3]]});u.YValues[2]<u.YValues[3]?(s={xValue:u.xValue,YValues:[u.YValues[2]]},h={xValue:u.xValue,YValues:[u.YValues[3]]},f.bearFillColor=y=ej.util.isNullOrUndefined(f.bearFillColor)?l&&l.length>0?l[a]:"#339933":f.bearFillColor):(s={xValue:u.xValue,YValues:[u.YValues[3]]},h={xValue:u.xValue,YValues:[u.YValues[2]]},f.bullFillColor=y=ej.util.isNullOrUndefined(f.bullFillColor)?l&&l.length>0?l[a]:"#E51400":f.bullFillColor);v=this.chartObj.setStyle(this,f,a,b,y);g=this.chartObj.setHiloStyle(f,b,a,y);u.style&&u.style.interior?y=jQuery.type(u.style.interior)=="array"?u.style.interior[0]:u.style.interior:u._hiloFill=g;var nt=ej.EjSvgRender.utils._getPoint(k,f),tt=ej.EjSvgRender.utils._getPoint({xValue:s.xValue+e.Median,YValues:[s.YValues[0]]},f),ot=ej.EjSvgRender.utils._getPoint({xValue:h.xValue+e.Median,YValues:[h.YValues[0]]},f),st=ej.EjSvgRender.utils._getPoint(d,f),p=this.chartObj.canvasX,w=this.chartObj.canvasY;et="M "+(nt.X+p)+" "+(nt.Y+w)+" L "+(tt.X+p)+" "+(tt.Y+w)+" M "+(ot.X+p)+" "+(ot.Y+w)+" L "+(st.X+p)+" "+(st.Y+w)+" ";ht={point1:nt,point2:tt};this._drawHiloPath(f,v,g,et,o,ht);var yt={xValue:h.xValue+e.Start,YValues:h.YValues},ct=ej.EjSvgRender.utils._getPoint(yt,f),pt={xValue:s.xValue+e.End,YValues:s.YValues},lt=ej.EjSvgRender.utils._getPoint(pt,f),c=ej.EjSvgRender.utils._correctRect(ct.X,ct.Y,lt.X,lt.Y),wt={id:this.chartObj.svgObject.id+"_Series"+a+"_Point"+o,x:c.X+this.chartObj.canvasX,y:c.Y+this.chartObj.canvasY,width:c.Width,height:c.Height,fill:v.interior,"stroke-width":v.borderWidth,"stroke-dasharray":v.dashArray,stroke:v.borderColor};this.chartObj.svgRenderer.drawRect(wt,this.gSeriesGroupEle);it=ej.EjSvgRender.utils._getSvgXY(c.X,c.Y,f,this.chartObj);at={X:it.X,Y:it.Y,Width:c.Width,Height:c.Height};ej.EjSvgRender.utils._addRegion(this.chartObj,at,f,u,o)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0});ej.seriesTypes.candle=ej.ejCandleSeries;ej.ejPieOfPieSeries=r(ej.EjSeriesRender,{draw:function(n,t){this.chartObj=n;var i=new ej.seriesTypes.pie;i.draw(n,t)},chartAreaType:"None"});ej.seriesTypes.pieofpie=ej.ejPieOfPieSeries;ej.ejPieSeries=r(ej.EjSeriesRender,{draw:function(n,r){var p,d,g,l,nt,tt,it,rt,s,h,ft,u,et,ot,y;this.chartObj=n;var f=r,w=[],b=r.type.toLowerCase(),e=r.collectionIndex,st=e==0?f.pieCoefficient:f.pieOfPieCoefficient,k=this._calculateVisiblePoints(r,this.chartObj).visiblePoints,c=this.calculatingSliceAngle(f),u=t.inArray(f,this.chartObj.model._visibleSeries),ht=this.chartObj.model._visibleSeries.length,o=this.chartObj.model._visibleSeries[u];if(o._pieCoefficient=o.pieCoefficient,this.chartObj.model.circularRadius.length>1){for(i=u;ej.util.isNullOrUndefined(o.zOrder)?i<this.chartObj.model.circularRadius.length:i>=0;ej.util.isNullOrUndefined(o.zOrder)?i++:i--)if(!ej.util.isNullOrUndefined(this.chartObj.model.circularRadius[i])){this.chartObj.model.circularRadius[u]=this.chartObj.model.circularRadius[i]*o._pieCoefficient;break}}else b=="pieofpie"&&o.splitMode!=""?this.chartObj.model.circularRadius[e]=.25*st*Math.min(c.width,c.height):this.chartObj.model.circularRadius[u]=.5*o._pieCoefficient*Math.min(c.width,c.height);if(p=Math.min(c.width,c.height),p<0)return p;for(d=Math.abs(f.endAngle-f.startAngle),d<270&&this.pieDoughnutCenter(f),g={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u},this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(g),l=f.enableAnimation&&!f._animatedSeries?"hidden":"visible",nt={id:this.chartObj.svgObject.id+"_TextGroup_"+u,visibility:l},this.chartObj.gSeriesTextEle||(this.chartObj.gSeriesTextEle=[]),this.chartObj.gSeriesTextEle[u]=e==1?this.chartObj.gSeriesTextEle[0]:this.chartObj.svgRenderer.createGroup(nt),tt={id:this.chartObj.svgObject.id+"_symbolGroup_"+u,visibility:l},this.chartObj.gSymbolGroupEle||(this.chartObj.gSymbolGroupEle=[]),this.chartObj.gSymbolGroupEle[u]=this.chartObj.svgRenderer.createGroup(tt),it={id:this.chartObj.svgObject.id+"_connectorGroup_"+u,visibility:l},this.chartObj.gConnectorEle||(this.chartObj.gConnectorEle=[]),this.chartObj.gConnectorEle[u]=this.chartObj.svgRenderer.createGroup(it),rt={id:this.chartObj.svgObject.id+"_DataLabel_"+u,visibility:l},this.chartObj.gDataLabelEle||(this.chartObj.gDataLabelEle=[]),this.chartObj.gDataLabelEle[u]=e==1?this.chartObj.gDataLabelEle[0]:this.chartObj.svgRenderer.createGroup(rt),s=0;s<k.length;s++)if((pointIndex=this.chartObj.model._isPieOfPie?k[s].actualIndex:s,!isNaN(f._visiblePoints[s].startAngle))&&(h=f._visiblePoints[s],h.visible)){var v=this._calculateArcData(this.chartObj,pointIndex,h,f,u,e),ut=v.Direction.split(" "),a=this.chartObj.setStyle(this,f,u,s);ft=f.startAngle<f.endAngle?!1:!0;r={id:this.chartObj.svgObject.id+"_Series"+u+"_Point"+pointIndex,fill:a.interior,"stroke-width":a.borderWidth,stroke:a.borderColor,"stroke-dasharray":a.dashArray,"stroke-linecap":f.lineCap,"stroke-linejoin":f.lineJoin,d:v.Direction,opacity:a.opacity,radius:b=="pieofpie"?this.chartObj.model.circularRadius[e]:this.chartObj.model.circularRadius[u],start:h.startAngle-1.57,end:h.endAngle-1.57,pointIndex:pointIndex,counterClockWise:ft,innerR:0,cx:v.centerX,cy:v.centerY,x:ut[12],y:ut[13]};this.chartObj.svgRenderer.drawPath(r,this.gSeriesGroupEle);y={PointIndex:pointIndex,StartAngle:h.startAngle,EndAngle:h.endAngle,StartX:this.chartObj.model.startX[pointIndex],StartY:this.chartObj.model.startY[pointIndex],PieSeriesIndex:e,SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};w.push(y)}u=this.chartObj.model._isPieOfPie?e:u;this.chartObj.model._isPieOfPie&&e==1&&o.pieCollections[0].length>0&&o.pieCollections[1].length==0&&(et=this._drawEmptyPieOfPie(this.chartObj),this.chartObj.svgRenderer.drawPath(et,this.gSeriesGroupEle));ot={Radius:this.chartObj.model.circularRadius[u],CenterX:this.chartObj.model.circleCenterX[u],CenterY:this.chartObj.model.circleCenterY[u]};y={Series:f,SeriesData:ot,Region:w,SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};this.chartObj.model.chartRegions.push(y);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"None"});ej.seriesTypes.pie=ej.ejPieSeries;ej.ejDoughnutSeries=r(ej.EjSeriesRender,{draw:function(n,r){var y,k,l,d,g,nt,tt,h,o,s,c,ut,ft,v;this.chartObj=n;var f=r,b=[],et=this._calculateVisiblePoints(r).visiblePoints,a=this.calculatingSliceAngle(f),ot=et.length,u=t.inArray(f,this.chartObj.model._visibleSeries),at=this.chartObj.model._visibleSeries.length,at=this.chartObj.model._visibleSeries.length,e=this.chartObj.model._visibleSeries[u];if(e._doughnutSize=e.doughnutSize,e._doughnutCoefficient=e.doughnutCoefficient,this.chartObj.model.circularRadius.length>1){for(i=u;ej.util.isNullOrUndefined(e.zOrder)?i<this.chartObj.model.circularRadius.length:i>=0;ej.util.isNullOrUndefined(e.zOrder)?i++:i--)if(!ej.util.isNullOrUndefined(this.chartObj.model.circularRadius[i])){this.chartObj.model.circularRadius[u]=this.chartObj.model.circularRadius[i]*e._doughnutSize;break}}else this.chartObj.model.circularRadius[u]=.5*e._doughnutSize*Math.min(a.width,a.height);if(y=Math.min(a.width,a.height),y<0)return y;k=Math.abs(f.endAngle-f.startAngle);k<270&&this.pieDoughnutCenter(f);this.chartObj.model.innerRadius[u]=e._doughnutCoefficient*this.chartObj.model.circularRadius[u];var vt=ej.util.isNullOrUndefined(this.chartObj.model.roundingPlaces)?2:this.chartObj.model.roundingPlaces,u=t.inArray(f,this.chartObj.model._visibleSeries),st={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u};if(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(st),l=f.enableAnimation&&!f._animatedSeries?"hidden":"visible",d={id:this.chartObj.svgObject.id+"_TextGroup_"+u,visibility:l},this.chartObj.gSeriesTextEle||(this.chartObj.gSeriesTextEle=[]),this.chartObj.gSeriesTextEle[u]=this.chartObj.svgRenderer.createGroup(d),g={id:this.chartObj.svgObject.id+"_symbolGroup_"+u,visibility:l},this.chartObj.gSymbolGroupEle||(this.chartObj.gSymbolGroupEle=[]),this.chartObj.gSymbolGroupEle[u]=this.chartObj.svgRenderer.createGroup(g),nt={id:this.chartObj.svgObject.id+"_connectorGroup_"+u,visibility:l},this.chartObj.gConnectorEle||(this.chartObj.gConnectorEle=[]),this.chartObj.gConnectorEle[u]=this.chartObj.svgRenderer.createGroup(nt),tt={id:this.chartObj.svgObject.id+"_DataLabel_"+u,visibility:l},this.chartObj.gDataLabelEle||(this.chartObj.gDataLabelEle=[]),this.chartObj.gDataLabelEle[u]=this.chartObj.svgRenderer.createGroup(tt),f._doughnutSize>0&&e._doughnutCoefficient>=0&&f._doughnutSize<=1&&e._doughnutCoefficient<=1)for(h=0;h<ot;h++)if(o=f._visiblePoints[h],s=h,o.visible){var p=0,w=0,ht=this._calculateArcData(this.chartObj,s,o,f,u);if((o.actualIndex==f.explodeIndex||f.explodeAll)&&!this.chartObj.vmlRendering){var it=-.5*Math.PI,ct=o.startAngle+it,lt=o.endAngle+it-1e-6,rt=(ct+lt)/2;p=this.chartObj.model.circleCenterX[u]+Math.cos(rt)*f.explodeOffset;w=this.chartObj.model.circleCenterY[u]+Math.sin(rt)*f.explodeOffset}c=this.chartObj.setStyle(this,f,u,s);ut=f.startAngle<f.endAngle?!1:!0;r={id:this.chartObj.svgObject.id+"_Series"+u+"_Point"+s,fill:c.interior,"stroke-width":c.borderWidth,stroke:c.borderColor,"stroke-dasharray":c.dashArray,"stroke-linecap":f.lineCap,opacity:c.opacity,"stroke-linejoin":f.lineJoin,d:ht.Direction,start:o.startAngle-1.57,end:o.endAngle-1.57,pointIndex:s,radius:this.chartObj.model.circularRadius[u],innerR:this.chartObj.model.innerRadius[u],counterClockWise:ut,x:p!=0?p:this.chartObj.model.circleCenterX[u],y:w!=0?w:this.chartObj.model.circleCenterY[u]};this.chartObj.svgRenderer.drawPath(r,this.gSeriesGroupEle);v={PointIndex:h,StartAngle:o.startAngle,EndAngle:o.endAngle,StartX:this.chartObj.model.startX[s],StartY:this.chartObj.model.startY[s],SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};b.push(v)}ft={Radius:this.chartObj.model.circularRadius[u],DRadius:this.chartObj.model.innerRadius[u],CenterX:this.chartObj.model.circleCenterX[u],CenterY:this.chartObj.model.circleCenterY[u]};v={Series:f,SeriesData:ft,Region:b,SeriesIndex:t.inArray(f,this.chartObj.model._visibleSeries)};this.chartObj.model.chartRegions.push(v);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"None"});ej.seriesTypes.doughnut=ej.ejDoughnutSeries;ej.ejPyramidSeries=r(ej.EjSeriesRender,{draw:function(n,i){var a,ot,e,s,wt,ii,bt,kt,dt,gt,h,f,p,it;this.chartObj=n;var r=n.model,o,st=this,d=r.LegendActualBounds,u=i,w=this._calculateVisiblePoints(u).visiblePoints,rt=w.length,ht=[],ut=[],ct=r.legend,g=u.marker.dataLabel,l=ct.position.toLowerCase(),nt=ct.border.width,tt=0,c=r.title,b=r.title.subTitle,lt=r.border.width,at=c.text!=""&&c.visible&&c.enableTrim?!0:!1,vt=b.text!=""&&b.visible&&b.enableTrim?!0:!1,ft=r.title.text&&r.title.visible?ej.EjSvgRender.utils._measureText(r.title.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.font):0,et=r.title.subTitle.text&&r.title.subTitle.visible?ej.EjSvgRender.utils._measureText(r.title.subTitle.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.subTitle.font):0,yt=n.model.title.text==""||!n.model.title.visible?0:at&&c.textOverflow=="wrap"?ft.height*n.model.titleWrapTextCollection.length:at&&c.textOverflow=="wrapandtrim"?ft.height*n.model.titleWrapTextCollection.length:ft.height,pt=n.model.title.subTitle.text==""||!n.model.title.subTitle.visible?0:vt&&b.textOverflow=="wrap"?et.height*n.model.subTitleWrapTextCollection.length:vt&&b.textOverflow=="wrapandtrim"?et.height*n.model.subTitleWrapTextCollection.length:et.height,k=r.margin.left+r.elementSpacing+lt*2+r.elementSpacing+r.margin.right+(l==="right"||l==="left"?d.Width+2*nt:0),ni=(r.title.text&&r.title.visible?r._titleLocation.Y+yt+pt:r.elementSpacing)+lt*2+r.margin.top+r.elementSpacing+r.elementSpacing+(l==="top"||l==="bottom"?d.Height+2*nt+r.elementSpacing:0);if(g.visible&&g.shape!="none"&&u.labelPosition=="outside"&&(k=k+(g.margin.left+g.margin.right)),r.chartRegions=[],r.sumofYValues=0,u.labelPosition.toLowerCase()==="outside"){for(a=0;a<rt;a++)ot=ej.EjSvgRender.utils._measureText(ej.util.isNullOrUndefined(w[a].text)?w[a].y:w[a].text,null,u.marker.dataLabel.font).width,tt<ot&&(tt=ot);r.textSize=tt}u._enableSmartLabels?(r.actualWidth=(t(n.svgObject).width()-k)*.8,r.resWidth=(t(n.svgObject).width()-k-r.actualWidth)/2):(r.actualWidth=t(n.svgObject).width()-k-tt,r.resWidth=0);e=t.inArray(u,r._visibleSeries);r.actualHeight=t(n.svgObject).height()-ni;var ti=n.model.title.subTitle.text==""?0:pt,v=n.pyrX=(l==="left"?d.Width+2*nt:0)+r.elementSpacing+r.margin.left,y=n.pyrY=(l==="top"?d.Height+2*nt:0)+(c.text&&c.visible?r._titleLocation.Y+yt+ti:r.margin.top+r.elementSpacing);for(ut[0]=v,ut[1]=y,s=0;s<rt;s++)r.sumofYValues+=w[s].YValues[0];for(wt={id:n.svgObject.id+"_DataLabel_"+e,transform:"translate("+v+","+y+")"},n.gDataLabelEle=[],n.gDataLabelEle[e]=n.svgRenderer.createGroup(wt),ii=ej.util.isNullOrUndefined(r.roundingPlaces)?2:r.roundingPlaces,bt={id:n.svgObject.id+"_SeriesGroup_"+e,transform:"translate("+v+","+y+")"},this.gSeriesGroupEle=n.svgRenderer.createGroup(bt),kt={id:n.svgObject.id+"_textGroup_"+e,transform:"translate("+v+","+y+")"},n.gSeriesTextEle=[],n.gSeriesTextEle[e]=n.svgRenderer.createGroup(kt),dt={id:n.svgObject.id+"_symbolGroup_"+e,transform:"translate("+v+","+y+")"},n.gSymbolGroupEle=[],n.gSymbolGroupEle[e]=n.svgRenderer.createGroup(dt),gt={id:n.svgObject.id+"_connectorGroup_"+e,transform:"translate("+v+","+y+")"},n.gConnectorEle=[],n.gConnectorEle[e]=n.svgRenderer.createGroup(gt),u.pyramidMode.toLowerCase()=="linear"?this.calculateLinearSegments(u):this.calculateSurfaceSegments(u),s=0;s<rt;s++)h=s,o=u._visiblePoints[s],o.visible&&(f=this._getPyramidData(u,h),p=n.setStyle(this,u,0,h),i={id:n.svgObject.id+"_Series"+e+"_Point"+h,fill:p.interior,"stroke-width":p.borderWidth,stroke:p.borderColor,"stroke-dasharray":p.dashArray,"stroke-linecap":u.lineCap,"stroke-linejoin":u.lineJoin,opacity:p.opacity,pointIndex:h,d:f.Direction},n.svgRenderer.drawPath(i,this.gSeriesGroupEle,ut),u.marker.dataLabel.template&&ej.EjSvgRender.utils._getSeriesTemplateSize(o,h,u,!0,n),o.xLocation=f.PositionX,o.yLocation=f.PositionY,o.connectorLine=f.Connector,o.startX=f.startX,o.startY=f.startY,o.Polygon=f.Polygon,it={PointIndex:h,Line1:f.Line1,Line2:f.Line2,Line3:f.Line3,Line4:f.Line4,Polygon:f.Polygon},ht.push(it));it={Series:u,Region:ht,SeriesIndex:t.inArray(u,r._visibleSeries)};r.chartRegions.push(it);this.gSeriesGroupEle&&(t(this.gSeriesGroupEle.childNodes[h]).bind("mousemove",function(n){n.target=st.gSeriesGroupEle.childNodes[h];st.chartObj.chartInteractiveBehavior(n)}),n.svgRenderer.append(this.gSeriesGroupEle,n.gSeriesEle))},_getPyramidData:function(n,i){var r=this.chartObj.model,h=n._visiblePoints[i].marker,it=n._visiblePoints[i].actualIndex,a=n.explodeIndex==it||n.explodeAll?n.explodeOffset:0,c=r.resWidth,w=r.pyramidData[i].CurrY,v=r.pyramidData[i].CurrY+r.pyramidData[i].Height,b=.5*(1-r.pyramidData[i].CurrY),k=.5*(1-v),et=n.points[i],o={x:c+a+b*r.actualWidth,y:w*r.actualHeight},u={x:c+a+(1-b)*r.actualWidth,y:w*r.actualHeight},f={x:c+a+(1-k)*r.actualWidth,y:v*r.actualHeight},l={x:c+a+k*r.actualWidth,y:v*r.actualHeight},rt="M "+o.x+" "+o.y+" L "+u.x+" "+u.y+" L "+f.x+" "+f.y+" L "+l.x+" "+l.y+" z",ut=[{x:o.x,y:o.y},{x:u.x,y:u.y},{x:f.x,y:f.y},{x:l.x,y:l.y}],e,s,d,g,y,p;if(h&&h.dataLabel&&h.dataLabel.visible||(!h||!h.dataLabel)&&n.marker.dataLabel.visible)if(d=(u.x+f.x)/2,g=(u.y+f.y)/2,n.labelPosition.toLowerCase()==="outside"){e=(u.x+f.x)/2;s=(u.y+f.y)/2;y=(this.chartObj.model.legend.position.toLowerCase()=="left"||this.chartObj.model.legend.position.toLowerCase()=="right"?this.chartObj.model.LegendActualBounds.Width:0)+this.chartObj.model.elementSpacing+this.chartObj.model.margin.left;p=ej.util.isNullOrUndefined(n.marker.dataLabel.connectorLine.height)?n._enableSmartLabels?t(this.chartObj.svgObject).width()-(y+e+c+2*this.chartObj.model.elementSpacing):t(this.chartObj.svgObject).width()-(y+e+this.chartObj.model.textSize+this.chartObj.model.elementSpacing):n.marker.dataLabel.connectorLine.height;var nt=this.getXCordinate(e,p,0),tt=this.getYCordinate(s,p,0),ft="M "+e+" "+s+" L "+nt+" "+tt;e=nt;s=tt}else e=(o.x+u.x)/2,s=(f.y+o.y)/2;return{Direction:rt,PositionX:e,PositionY:s,Connector:ft,Line1:o,Line2:u,Line3:f,Line4:l,startX:d,startY:g,Polygon:ut}},calculateLinearSegments:function(n){var f=0,i=this.chartObj.model,t,u;i.pyramidData=[];var r=n.gapRatio>=0?n.gapRatio<=1?n.gapRatio:1:0,o=1/(i.sumofYValues*(1+r/(1-r))),e=n._visiblePoints.length;for(t=0;t<e;t++)(n._visiblePoints[t].visible||n._visiblePoints[t].gapMode)&&(u=o*n._visiblePoints[t].YValues[0],i.pyramidData[t]={CurrY:f,Height:u},f+=r/(e-1)+u)},calculateSurfaceSegments:function(n){var r=n._visiblePoints.length,u=this.chartObj.model,e,t,c;u.pyramidData=[];var i=0,o=[],f=[],l=n.gapRatio>=0?n.gapRatio<=1?n.gapRatio:1:0,s=l/(r-1),h=this.getSurfaceHeight(0,u.sumofYValues);for(t=0;t<r;t++)(n._visiblePoints[t].visible||n._visiblePoints[t].gapMode)&&(o[t]=i,f[t]=this.getSurfaceHeight(i,Math.abs(n._visiblePoints[t].YValues[0])),i+=f[t]+s*h);for(e=1/(i-s*h),t=0;t<r;t++)(n._visiblePoints[t].visible||n._visiblePoints[t].gapMode)&&(c=e*o[t],u.pyramidData[t]={CurrY:c,Height:e*f[t]})},getSurfaceHeight:function(n,t){var i=this.solveQuadraticEquation(1,2*n,-t);return i?i:0},solveQuadraticEquation:function(n,t,i){var r,u,f,e;if(n!=0){if(f=t*t-4*n*i,f>=0)return e=Math.sqrt(f),r=(-t-e)/(2*n),u=(-t+e)/(2*n),Math.max(r,u)}else if(t!=0)return r=-i/t,u=-i/t,Math.max(r,u);return!1},chartAreaType:"None"});ej.seriesTypes.pyramid=ej.ejPyramidSeries;ej.ejFunnelSeries=r(ej.EjSeriesRender,{draw:function(n,i){var st,gt,l,a,h,ni,ti,ii,ri,ht,rt,e,lt,c,f,y,ut;this.chartObj=n;var r=n.model,at=r.legend,v=at.position.toLowerCase(),g=r.LegendActualBounds,s,vt=this,u=i,p=this._calculateVisiblePoints(u).visiblePoints,w=p.length,yt=[],nt=u.marker,tt=at.border.width,ft=[],it=0,b=n.model.title.text==""?"":r.title,k=n.model.title.subTitle.text==""?"":r.title.subTitle,pt=r.border.width,wt=b.text!=""&&b.visible&&b.enableTrim?!0:!1,bt=k.text!=""&&k.visible&&k.enableTrim?!0:!1,et=r.title.text&&r.title.visible?ej.EjSvgRender.utils._measureText(r.title.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.font):0,ot=r.title.subTitle.text&&r.title.subTitle.visible?ej.EjSvgRender.utils._measureText(r.title.subTitle.text,t(this.svgObject).width()-r.margin.left-r.margin.right,r.title.subTitle.font):0,kt=n.model.title.text==""||!n.model.title.visible?0:wt&&b.textOverflow=="wrap"?et.height*n.model.titleWrapTextCollection.length:wt&&b.textOverflow=="wrapandtrim"?et.height*n.model.titleWrapTextCollection.length:et.height,dt=n.model.title.subTitle.text==""||!n.model.title.subTitle.visible?0:bt&&k.textOverflow=="wrap"?ot.height*n.model.subTitleWrapTextCollection.length:bt&&k.textOverflow=="wrapandtrim"?ot.height*n.model.subTitleWrapTextCollection.length:ot.height,d=r.margin.left+r.elementSpacing+r.elementSpacing+r.margin.right+pt*2+(v==="right"||v==="left"?g.Width+2*tt:0),ui=(r.title.text&&r.title.visible?r._titleLocation.Y+kt+dt:r.elementSpacing)+r.margin.top+pt*2+r.elementSpacing+r.elementSpacing+(v==="top"||v==="bottom"?g.Height+2*tt+r.elementSpacing:0);if(nt.visible&&nt.shape!="none"&&u.labelPosition=="outside"&&(d=d+(nt.margin.left+nt.margin.right)),r.chartRegions=[],r.sumofYValues=0,u.labelPosition.toLowerCase()==="outside"){for(e=0;e<w;e++)st=ej.EjSvgRender.utils._measureText(ej.util.isNullOrUndefined(p[e].text)?p[e].y:p[e].text,null,u.marker.dataLabel.font).width,it<st&&(it=st);r.textSize=it}for(u._enableSmartLabels?(r.actualWidth=(t(n.svgObject).width()-d)*.8,r.resWidth=(t(n.svgObject).width()-d-r.actualWidth)/2):(r.actualWidth=t(n.svgObject).width()-d-it,r.resWidth=0),gt=n.model.title.subTitle.text==""?0:dt,r.actualHeight=t(n.svgObject).height()-ui,l=n.pyrX=(v==="left"?g.Width+2*tt:0)+r.elementSpacing+r.margin.left,a=n.pyrY=(v==="top"?g.Height+2*tt:0)+(r.title.text&&r.title.visible?r._titleLocation.Y+kt+gt:r.margin.top+r.elementSpacing),ft[0]=l,ft[1]=a,h=0;h<w;h++)r.sumofYValues+=p[h].YValues[0];var si=ej.util.isNullOrUndefined(r.roundingPlaces)?2:r.roundingPlaces,o=t.inArray(u,r._visibleSeries),fi={id:n.svgObject.id+"_SeriesGroup_"+o,transform:"translate("+l+","+a+")"};this.gSeriesGroupEle=n.svgRenderer.createGroup(fi);ni={id:n.svgObject.id+"_DataLabel_"+o,transform:"translate("+l+","+a+")"};n.gDataLabelEle=[];n.gDataLabelEle[o]=n.svgRenderer.createGroup(ni);ti={id:n.svgObject.id+"_textGroup_"+o,transform:"translate("+l+","+a+")"};n.gSeriesTextEle=[];n.gSeriesTextEle[o]=n.svgRenderer.createGroup(ti);ii={id:n.svgObject.id+"_symbolGroup_"+o,transform:"translate("+l+","+a+")"};n.gSymbolGroupEle=[];n.gSymbolGroupEle[o]=n.svgRenderer.createGroup(ii);ri={id:n.svgObject.id+"_connectorGroup_"+o,transform:"translate("+l+","+a+")"};n.gConnectorEle=[];n.gConnectorEle[o]=n.svgRenderer.createGroup(ri);ht=0;rt=r;rt.funnelData=[];var ct=u.gapRatio>=0?u.gapRatio<=1?u.gapRatio:1:0,ei=1/(rt.sumofYValues*(1+ct/(1-ct))),oi=ct/w;for(e=w-1;e>=0;e--)(u._visiblePoints[e].visible||u._visiblePoints[e].gapMode)&&(lt=ei*u._visiblePoints[e].YValues[0],rt.funnelData[e]={CurrY:ht,Height:lt},ht+=lt+oi);for(h=0;h<w;h++)c=h,s=u._visiblePoints[h],s.visible&&(f=this._getFunnelData(u,c,n),y=n.setStyle(this,u,0,c),i={id:n.svgObject.id+"_Series"+o+"_Point"+c,fill:y.interior,"stroke-width":y.borderWidth,stroke:y.borderColor,"stroke-dasharray":y.dashArray,"stroke-linecap":u.lineCap,"stroke-linejoin":u.lineJoin,opacity:y.opacity,pointIndex:c,d:f.Direction},n.svgRenderer.drawPath(i,this.gSeriesGroupEle,ft),u.marker.dataLabel.template&&ej.EjSvgRender.utils._getSeriesTemplateSize(s,c,u,!0,n),s.xLocation=f.PositionX,s.yLocation=f.PositionY,s.connectorLine=f.Connector,s.startX=f.startX,s.startY=f.startY,s.Polygon=f.Polygon,ut={PointIndex:c,Line1:f.Line1,Line2:f.Line2,Line3:f.Line3,Line4:f.Line4,Line5:f.Line5,Line6:f.Line6,Polygon:f.Polygon},yt.push(ut));ut={Series:u,Region:yt,SeriesIndex:t.inArray(u,r._visibleSeries)};r.chartRegions.push(ut);this.gSeriesGroupEle&&t(this.gSeriesGroupEle.childNodes[c]).bind("mousemove",function(n){n.target=vt.gSeriesGroupEle.childNodes[c];vt.chartObj.chartInteractiveBehavior(n)});n.svgRenderer.append(this.gSeriesGroupEle,n.gSeriesEle)},_getFunnelData:function(n,i){var e=this.chartObj.model,pt=n._visiblePoints[i],tt=pt.marker,et=n.marker,ot=n.funnelWidth,st=n.funnelHeight,r=e.actualHeight,c=e.actualWidth,ht=e.elementSpacing,wt,bt=e.legend.position.toLowerCase(),ii=pt.actualIndex,kt,s=e.resWidth,dt,ct,gt,l=n.explodeIndex==ii||n.explodeAll?n.explodeOffset:0,rt,ut,d,lt,at,it,g,ft,a,vt,yt,h,w,ni,ti,v,u,f,b,nt,k,y,o,p;return o=st.indexOf("%")!=-1?r*(parseInt(st)/100):parseInt(st),p=ot.indexOf("%")!=-1?c*(parseInt(ot)/100):parseInt(ot),g=e.funnelData[i].CurrY*r,a=g+e.funnelData[i].Height*r,y=p+(c-p)*((r-o-g)/(r-o)),rt=c/2-y/2,lt=rt+y,y=a>r-o||r==o?p:p+(c-p)*((r-o-a)/(r-o)),d=c/2-y/2,it=d+y,g>=r-o?(rt=d=ut=c/2-p/2,lt=it=at=c/2+p/2):a>r-o&&(ut=d=c/2-y/2,at=it=ut+y,ft=r-o),v={x:s+l+rt,y:g},u={x:s+l+lt,y:g},b={x:s+l+it,y:a},nt={x:s+l+d,y:a},f={x:s+l+it,y:a},k={x:s+l+d,y:a},ft&&(f={x:s+l+at,y:ft},k={x:s+l+ut,y:ft}),kt="M "+v.x+" "+v.y+" L "+u.x+" "+u.y+" L "+f.x+" "+f.y+" L "+b.x+" "+b.y+" L "+nt.x+" "+nt.y+" L "+k.x+" "+k.y+" z",dt=[{x:v.x,y:v.y},{x:u.x,y:u.y},{x:f.x,y:f.y},{x:b.x,y:b.y},{x:nt.x,y:nt.y},{x:k.x,y:k.y}],(tt&&tt.dataLabel&&tt.dataLabel.visible||(!tt||!tt.dataLabel)&&et.dataLabel.visible)&&(h,w,ni=(u.x+f.x)/2,ti=(u.y+f.y)/2,n.labelPosition.toLowerCase()==="outside"?(h=(u.x+f.x)/2,w=(u.y+f.y)/2,wt=(bt=="left"||bt=="right"?e.LegendActualBounds.Width:0)+ht+e.margin.left,ct=ej.util.isNullOrUndefined(et.dataLabel.connectorLine.height)?n._enableSmartLabels?t(this.chartObj.svgObject).width()-(wt+h+s+2*ht):t(this.chartObj.svgObject).width()-(h+e.textSize+ht):et.dataLabel.connectorLine.height,vt=this.getXCordinate(h,ct,0),yt=this.getYCordinate(w,ct,0),gt="M "+h+" "+w+" L "+vt+" "+yt,h=vt,w=yt):(h=(v.x+u.x)/2,w=(v.y+b.y)/2)),{Direction:kt,PositionX:h,PositionY:w,Connector:gt,Line1:v,Line2:u,Line3:f,Line4:b,Line5:nt,Line6:k,startX:ni,startY:ti,Polygon:dt}},chartAreaType:"None"});ej.seriesTypes.funnel=ej.ejFunnelSeries;ej.ejPolarSeries=r(ej.EjSeriesRender,{draw:function(n,t){var r,o,s,u,f;this.chartObj=n;var h=this,i=t,c=this._isVisiblePoints(i),e=this.setLineSeriesStyle(i);if(i.drawType.toLowerCase()=="column"){r=i.xAxis.visibleRange;r.interval=1;o=i.xAxis._valueType=="category"?r.max:r.max-1;this.chartObj.model.sumofYValues=0;s=r.interval;u=r.min;do this.chartObj.model.sumofYValues+=r.interval,u+=r.interval;while(u<=o)}f=this._calculatePolarAxesSegment(i);i.drawType.toLowerCase()=="area"?this.drawAreaPath(i,e,f):i.drawType.toLowerCase()=="line"&&this._drawLinePath(i,e,f);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"PolarAxes"});ej.seriesTypes.polar=ej.ejPolarSeries;ej.ejRadarSeries=r(ej.EjSeriesRender,{draw:function(n,t){var r,o,s,u,f;this.chartObj=n;var h=this,i=t,c=this._isVisiblePoints(i),e=this.setLineSeriesStyle(i);if(i.drawType.toLowerCase()=="column"){r=i.xAxis.visibleRange;r.interval=1;o=i.xAxis._valueType=="category"?r.max:r.max-1;this.chartObj.model.sumofYValues=0;s=r.interval;u=r.min;do this.chartObj.model.sumofYValues+=r.interval,u+=r.interval;while(u<=o)}f=this._calculatePolarAxesSegment(i);i.drawType.toLowerCase()=="area"?this.drawAreaPath(i,e,f):i.drawType.toLowerCase()=="line"&&this._drawLinePath(i,e,f);this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},doAnimation:function(n,i){var r=i.chartObj;n.regionAdded=!0;r.model._radius=r.model.Radius;r.model.Radius=0;var e=i,u=t.inArray(n,r.model._visibleSeries),f=t(r.gSeriesEle).find("#"+e.gSeriesGroupEle.id)[0].childNodes[0];t(f).animate({Radius:r.model._radius},{duration:1200,queue:!1,step:function(i){if(ej.util.isNullOrUndefined(r.model))t(f).stop(!0,!0);else{r.model.Radius=i;var u=e._calculatePolarAxesSegment(n);n.drawType.toLowerCase()!="column"&&r.svgRenderer._setAttr(t(f),{d:u});r.model.Radius=r.model._radius}},complete:function(){if(!ej.util.isNullOrUndefined(r.model)){n.regionAdded=!1;r.svgRenderer._setAttr(t(r.gSeriesEle).find("#"+r.svgObject.id+"_TextGroup_"+u),{visibility:"visible"});r.svgRenderer._setAttr(t(r.gSeriesEle).find("#"+r.svgObject.id+"_symbolGroup_"+u),{visibility:"visible"});r.svgRenderer._setAttr(t(r.gSeriesEle).find("#"+r.svgObject.id+"_DataLabel_"+u),{visibility:"visible"});r.model.AnimationComplete=!0;var i=t.extend({},ej.EjSvgRender.commonChartEventArgs);i.data={series:n};r._trigger("animationComplete",i)}}})},chartAreaType:"PolarAxes"});ej.seriesTypes.radar=ej.ejRadarSeries}(jQuery);ej.ejChart={},function($){String.prototype.parseTemplate=function(){var str=this;for($.each(arguments[0],function(n,t){t.count>0?$.each(t,function(t,i){var r=new RegExp("#"+n+"."+t+"#","gm");str=str.replace(r.source,i)}):str=str.replace(new RegExp("\\#"+n+"\\#","gm"),t)});str.indexOf("ej.")>=0;)substr=str.substring(str.indexOf("ej."),str.indexOf(")")+1),str=str.replace(substr,eval(substr));return str};String.prototype.capitalizeFirstString=function(){return this.charAt(0).toUpperCase()+this.slice(1)};var Gradient=function(n){this._gradientStop=[];for(var t=0;t<n.length;t++)this._gradientStop.push(n[t])};ej.ejChart={_renderSfChart:function(){var t=window.SVGSVGElement?!0:!1,n=this.model.enableCanvasRendering;return $("#chartContainer_"+this._id).remove(),t?(this.renderer=new ej.EjSvgRender(this.element),n?(this.svgRenderer=new ej.EjCanvasRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element)):(this.svgRenderer=new ej.EjSvgRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element)),this._appendChartElements(),n||this.legendContainer.find("svg").attr("class","e-designerhide"),this._createChart(),$(this.svgObject).appendTo(this.element)):(n=!1,this.svgRenderer=new ej.EjVmlRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.renderer=new ej.EjVmlRender(this.element),this._appendChartElements(),this._createChart(),$(this.svgObject).appendTo(this.chartContainer)),!0},_appendChartElements:function(){this.legendContainer=$("<div><\/div>").attr("id","legend_"+this._id).css("height","0px");this.scrollerContainer=$("<div><\/div>").attr("id","legend_Scroller"+this._id).css("height","0px");this.chartContainer=$("<div><\/div>").css("position","relative").attr("id","chartContainer_"+this._id);this.axisScroll=$("<div><\/div>").attr("id","axisScrollbar_"+this._id).css("height","0px");this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer);$(this.scrollerContainer).appendTo(this.legendContainer);$(this.axisScroll).appendTo(this.chartContainer);$(this.legendContainer).appendTo(this.chartContainer);$(this.chartContainer).appendTo(this.element)},setSvgSize:function(n){var t=n,e=$(t.element).height(),i=450,f=ej.isTouchDevice()?250:600,o=$(t.element).width(),s=$(t.chartContainer).height(),r,u;t.model.size.width?(r=t.model.size.width,f=typeof r=="string"&&r.indexOf("%")!=-1?o/100*parseInt(r):parseInt(r)):o>0&&(f=o);$(t.svgObject).width(f);t.model.size.height?(u=t.model.size.height,i=typeof u=="string"&&u.indexOf("%")!=-1?this.vmlRendering?i:e/100*parseInt(u):parseInt(u)):e>0?i=e:$(t.svgObject).css("display","block");$(t.svgObject).height(i);$("#"+t._id).css("overflow","hidden");t.svgObject.width=f;t.svgObject.height=i},setModelProperties:function(n){var i,c,o,r,s,h,u,t,e,f;if(n||this.setSvgSize(this),this.svgWidth=$(this.svgObject).width(),this.svgHeight=$(this.svgObject).height(),this.chartCross={visible:n?this.chartCross.visible:this.model.crosshair.visible,mArea:this.model.crosshair.type},this.serAnimation=[],this.model.series&&!n)for(s=!1,this.model._drawTrendline=!1,u=0;u<this.model.series.length;u++)for(this.model.series[u]=ej.copyObject({},this.model.commonSeriesOptions,this.model.series[u]),r=this.model.series[u],this.serAnimation.push(r.enableAnimation===null||r.enableAnimation===undefined?this.model.commonSeriesOptions.enableAnimation:r.enableAnimation),i=r.trendlines,c=i.length,t=0;t<c;t++)if(i[t]=ej.copyObject({},this.model.trendlineDefaults,i[t]),i[t]._visibility=i[t].visibility,i[t].visibility.toLowerCase()=="visible"){if(this.model._drawTrendline=!0,h=i[t].type.toLowerCase(),!ej.util.isNullOrUndefined(r.points))for(e=0;e<r.points.length;e++)if(o=r.points[e],ej.util.isNullOrUndefined(o.y)||o.y==0){s=!0;break}i[t].isNull=s&&(h=="power"||h=="exponential")?!0:!1}if(this.model.indicators)for(f=0;f<this.model.indicators.length;f++)this.model.indicators[f]=ej.copyObject({},this.model.indicatorDefaults,this.model.indicators[f])},_createChart:function(){var r,n,i,t;if(this.svgObject=this.svgRenderer.svgObj,r=$.extend({},ej.EjSvgRender.commonChartEventArgs),this._trigger("load",r),this.setTheme(ej.EjSvgRender.themes,this.model.theme),n=this.model,n.series[0]&&n.series[0]._isdesigntime){for(n.series[0]={},n.series[0].points=[],i=[],t=1;t<=10;t++)i.push({x:t,y:Math.floor(Math.random()*-30)+40});n.series[0].points=i}this.vmlRendering=this.svgRenderer.vmlNamespace?!0:!1;($(this.element).is(":visible")||$(this.element).css("visibility")!="hidden"||$(this.element).css("display")!="none")&&(this.bindEvents(),this.bindTo())},setTheme:function(n,t){var i=t.toLowerCase();(i.indexOf("azure")>=0||i.indexOf("lime")>=0||i.indexOf("saffron")>=0)&&i.indexOf("gradient")==-1&&i.indexOf("dark")==-1?n[i]=$.extend(!0,{},n.flatlight,n[i]):(i.indexOf("azuredark")>=0||i.indexOf("limedark")>=0||i.indexOf("saffrondark"))>=0&&i.indexOf("gradient")==-1?n[i]=$.extend(!0,{},n.flatdark,n[i]):(i.indexOf("azure")>=0||i.indexOf("lime")>=0||i.indexOf("saffron")>=0)&&i.indexOf("gradient")>=0&&i.indexOf("dark")==-1?n[i]=$.extend(!0,{},n.gradientlight,n[i]):(i.indexOf("azuredark")>=0||i.indexOf("limedark")>=0||i.indexOf("saffrondark")>=0)&&i.indexOf("gradient")>=0?n[i]=$.extend(!0,{},n.gradientdark,n[i]):i.indexOf("high")>=0?n[i]=$.extend(!0,{},n.highcontrast01,n[i]):i.indexOf("material")>=0||i.indexOf("office")>=0?n[i]=$.extend(!0,{},n.material,n[i]):n[i]||(i="flatlight");this.model=this.model._themeChanged?ej.copyObject({},this.model,n[i]):ej.copyObject({},n[i],this.model)},_drawBackInterior:function(){if(this.model.backInterior&&this.model.backInterior._gradientStop){var n={id:this.svgObject.id+"_backGradient",x1:"0%",y1:"0%",x2:"0%",y2:$(this.svgObject).height()+"%"};this.svgRenderer.drawGradient(n,this.model.backInterior._gradientStop)}},_drawBackImage:function(){var n={height:$(this.svgObject).height(),width:$(this.svgObject).width(),href:this.model.backGroundImageUrl,x:0,y:0,id:this.svgObject.id+"_backImage",visibility:"visible",preserveAspectRatio:"none"};this.svgRenderer.drawImage(n,this.svgObject)},_getDataType:function(n){var t=typeof n;return t==="number"||t==="string"?t:jQuery.type(n)=="date"?"date":n==null?null:!1},addedXYValues:function(n){var f,e,r,s,h,u,t,c,o,i;if(n=n?n:!1,f=this.model.series[0].type.toLowerCase(),ej.seriesTypes[f].prototype.chartAreaType=="cartesianAxes"?this.model.AreaType="cartesianaxes":ej.seriesTypes[f].prototype.chartAreaType=="None"?this.model.AreaType="none":(this.model.isPolar=f=="polar"?!0:!1,this.model.AreaType="polaraxes"),!n){for(r=0;r<this.model.series.length;r++)if(this.model.series[r].visibility=="visible"){if(s=!1,h=!1,this.model.series[r].dataSource&&this.model.series[r].dataSource.length!=0)for(t=this.model.series[r],t._xAxisValueType=null,e=t.points.length,i=0,c=e;i<c;i++)u=t.points[i].x,u!=null&&u!=undefined&&(t._xAxisValueType===null||t._xAxisValueType===undefined)&&(t._xAxisValueType=this._getDataType(u)),t._xAxisValueType!="string"&&(t.points[i].xValue=t.points[i].x);else for(this.model.series[r]=$.extend(!0,{},this.model.commonSeriesOptions,this.model.series[r]),t=this.model.series[r],this.model.primaryXAxis.valueType=="datetime"&&(h=!0),e=t.points.length,k=0;k<e;k++)t.points[k].YValues=[],isNaN(parseFloat(t.points[k].x))||/^-?[0-9]*\.?[0-9]+$/.test(t.points[k].x)!=!0||this.model.primaryXAxis.valueType=="category"||this.model.AreaType=="none"?t.points[k].xValue=t.points[k].x:h?(t.points[k].xValue=new Date(t.points[k].x),t.points[k].x=new Date(t.points[k].x)):(t.points[k].xValue=parseFloat(t.points[k].x),t.points[k].x=parseFloat(t.points[k].x)),s||(u=t.points[k].x,ej.util.isNullOrUndefined(u)||(t._xAxisValueType=this._getDataType(u),s=!0)),t._hiloTypes?(ej.util.isNullOrUndefined(t.points[k].high)||(t.points[k].YValues[0]=t.points[k].high,t.points[k].y=t.points[k].high),ej.util.isNullOrUndefined(t.points[k].low)||(t.points[k].YValues[1]=t.points[k].low),ej.util.isNullOrUndefined(t.points[k].open)||(t.points[k].YValues[2]=t.points[k].open),ej.util.isNullOrUndefined(t.points[k].close)||(t.points[k].YValues[3]=t.points[k].close)):(t.points[k].YValues[0]=t.points[k].y,ej.util.isNullOrUndefined(t.points[k].size)||(t.points[k].YValues[1]=t.points[k].size));if(t.type.toLowerCase()=="waterfall")this.calculateWaterfallSeriesPoints(t.points);else if(t._previousType&&t._previousType.toLowerCase()=="waterfall")for(o=t.points,i=0;i<o.length;i++)o[i].waterfallSum=undefined,o[i].textOptions=null}this._setInternalValues()}},calculateWaterfallSeriesPoints:function(n){for(var r=0,i=0,u=0,t=0;t<n.length;t++)n[t].isEmpty?(n[t].YValues[1]=0,n[t].YValues[0]=0):(i+=n[t].showIntermediateSum||n[t].showTotalSum?0:n[t].y,n[t].showIntermediateSum?(n[t].YValues[1]=r,n[t].YValues[0]=i,n[t].waterfallSum=i-r,r=i):n[t].showTotalSum?(n[t].YValues[1]=0,n[t].YValues[0]=i,n[t].waterfallSum=i):(n[t].YValues[1]=u,n[t].YValues[0]=u+n[t].y,u=i))},_setInternalValues:function(){for(var n,t,i=0;i<this.model.series.length;i++)if(n=this.model.series[i],this.model.AreaType=="cartesianaxes"&&ej.seriesTypes[n.type.toLowerCase()].prototype.chartAreaType=="cartesianAxes"?(n._zOrder=n.zOrder?n.zOrder:0,this.model._visibleSeries.push(n)):this.model.AreaType=="none"&&ej.seriesTypes[n.type.toLowerCase()].prototype.chartAreaType=="None"?(n._zOrder=n.zOrder?n.zOrder:0,this.model._visibleSeries.push(n)):this.model.AreaType=="polaraxes"&&ej.seriesTypes[n.type.toLowerCase()].prototype.chartAreaType=="PolarAxes"&&(n._zOrder=n.zOrder?n.zOrder:0,this.model._visibleSeries.push(n)),(n._yAxisName||n._xAxisName)&&this.model._axes)for(t=0;t<this.model._axes.length;t++)n._yAxisName&&n._yAxisName==this.model._axes[t].name&&(this.model._axes[t].orientation=this.model._axes[t].orientation?this.model._axes[t].orientation:this.model.requireInvertedAxes?"horizontal":"vertical"),n._xAxisName&&n._xAxisName==this.model._axes[t].name&&(this.model._axes[t].orientation=this.model._axes[t].orientation?this.model._axes[t].orientation:this.model.requireInvertedAxes?"vertical":"horizontal")},setHiloStyle:function(n,t,i,r){var f=n.points[t],u;return interior=f.fill?f.fill:n.fill?n.fill:r,u=interior?interior:this.model.seriesColors[i],seriesInterior=jQuery.type(u)=="array"?u[0].color:u},setStyle:function(n,t,i,r,u){var f=t._visiblePoints[r],o,v,y,p,w,h,e=f.border,c=t.border,l,a,s,b;return t._hiloTypes&&(h=t.isFill?t.fill:null),n.chartObj.model.AreaType=="cartesianaxes"?(f.fill?o=f.fill:t.type.toLowerCase()=="waterfall"?((f.showIntermediateSum||f.showTotalSum)&&f.waterfallSum>0||f.y>0&&!f.showIntermediateSum&&!f.showTotalSum)&&(o=t.positiveFill?t.positiveFill:u):o=h?h:u,l=o?o:this.model.seriesColors[i],a=n.chartObj.model.requireInvertedAxes?this.svgRenderer.createGradientElement(n.getSeriesName(t)+"_"+i+r,l,0,0,100,0,n.gSeriesGroupEle):this.svgRenderer.createGradientElement(n.getSeriesName(t)+"_"+i+r,l,0,0,0,100,n.gSeriesGroupEle)):(s=this.model.pointColors,o=f.fill?f.fill:jQuery.type(s[r])=="array"?s[r][0].color:s[r],b=this.svgRenderer.createGradientElement(n.getSeriesName(t)+r,o,0,0,0,$(n.svgObject).height()||parseFloat(this.model.size.height),n.chartObj.gSeriesEle)),v=e&&e.color?e.color:c.color,y=e&&e.width?e.width:c.width,w=f.opacity?f.opacity:t.opacity,width=f.width?f.width:t.width,p=e&&e.dashArray?e.dashArray:c.dashArray,{interior:a?a:b,borderColor:v,borderWidth:y,width:width,opacity:w,dashArray:p}},colorNameToHex:function(n){var t=n,i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",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",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:"#ff00ff",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",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#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:"#6b8e23",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return Object.prototype.toString.call(t)=="[object Array]"?t:typeof i[t.toLowerCase()]!="undefined"?i[t.toLowerCase()]:t},_getLocalizedLabels:function(){return ej.getLocalizedConstants(this.sfType,this.model.locale)},_setCulture:function(n){this.culture=ej.preferredCulture(n)},draw:function(n){var f,tt,kt,ot,st,u,v,y,it,c,i,e,d,b,ti,r,l,p,oi,rt,ft,ht,ct,lt,g,at,si,ut,yt,a,o,nt,s,h,hi,pt,w,wt,ci,t,bt;for(this.removeMultiRect(),f={},f.axes={},this._drawBackInterior(),this.model.chartRegions=[],this.model.outsideDataRegionPoints=[],this.model.regionCount=null,this.model.circularRadius=[],this.model.innerRadius=[],this.model.bounds=[],this.accDataLabelRegion=[],this.model.rightsidebounds=[],this.model.leftsidebounds=[],this.model.excludeDataUpdate=n,this.model.yAxisLabelRegions=[],this.model.xAxisLabelRegions=[],this.model.axisMultiLevelLabelRegions=[],this.model.multiLevelLabelRegions=[],this.model.minhightwidth=!1,this.model._isPieOfPie=!1,n||(this.model._visibleSeries=[]),this.model.stackedValue={},this.model._locale=this.model.locale||"en-US",this._setCulture(this.model._locale),this._localizedLabels=this._getLocalizedLabels(),tt=this.model.series.length,this.model._sideBySideSeriesPlacement=ej.util.isNullOrUndefined(this.model.sideBySideSeriesPlacement)?this.model.enable3D?!1:!0:this.model.sideBySideSeriesPlacement,t=0;t<tt;t++)r=this.model.series[t],kt=r.type.toLowerCase(),r._isTransposed=kt.indexOf("bar")==-1?r.isTransposed:!r.isTransposed;for(tt>0&&this.addedXYValues(n),this.model.AreaType=this.model.AreaType||"cartesianaxes",this._isEjScroller(),ot=$.extend({},ej.EjSvgRender.commonChartEventArgs),ot.data={},this._trigger("preRender",ot),this.gLegendEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_Legend"}),this.gTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_ChartTitle",cursor:"default"}),this.gSubTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_ChartsubTitle",cursor:"default"}),this._createAxisLabelAndRange(),t=0;t<this.model._axes.length;t++)f.axes[this.model._axes[t].name]={};for(this._initializeSeriesColors(),this._calculateLegendBounds(),this.legendRender=new ej.EjLegendRender(this),st=$.extend({},ej.EjSvgRender.commonChartEventArgs),st.data={legendBounds:this.model.LegendBounds},this._trigger("legendBoundsCalculate",st),e=0;e<this.model.indicators.length;e++)if(u=this.model.indicators[e],u._points=[],u.xAxisName=u.xAxisName?u.xAxisName:this.model._axes[0].name,u.yAxisName=u.yAxisName?u.yAxisName:this.model._axes[1].name,u.isIndicator=!0,u.dataSource)u._hiloTypes=!0,this._processJsonData(u.dataSource,u),u._points=u.points;else if(u.points.length>0)for(t=0;t<u.points.length;t++)u._points=u.points,u._points[t].xValue=u.points[t].x,u._points[t].YValues=[],u._points[t].YValues[0]=u.points[t].close;else if(u.seriesName!="")for(v=0;v<this.model._visibleSeries.length;v++)r=this.model._visibleSeries[v],u.seriesName==r.name&&(u._points=$.extend(!0,[],r.points));for(c=0;c<this.model._axes.length;c++)if(this.model._axes[c].valueType&&this.model._axes[c].valueType.toLowerCase()=="category")for(t=0;t<this.model.indicators.length;t++)if(u=this.model.indicators[t],this.model._axes[c].name==u.xAxisName)for(e=0;e<u._points.length;e++)u._points[e].xValue=e;for(this.model.indicatorRange=[],v=0;v<this.model.indicators.length;v++)u=this.model.indicators[v],u._points.length>0&&(p=u.type.toLowerCase(),y=new ej.indicatorTypes[p],y.calculateSegment(u,this));for(l=0;l<this.model._visibleSeries.length;l++)for(y=this.model._visibleSeries[l],t=0;t<y.points.length;t++)typeof y.points[t].xValue=="string"&&y.points[t].xValue.indexOf("/Date(")!=-1&&(y.points[t].xValue=new Date(parseInt(y.points[t].xValue.substr(6))));this.model.hAxes=[];this.model.vAxes=[];var k=this,dt=!1,gt=!1;for(this._arrangeAxis(),this.model.crosshairLabelVisibility=!1,c=0;c<this.model._axes.length;c++){i=this.model._axes[c];this.model.crosshairLabelVisibility=i.crosshairLabel.visible||this.model.crosshairLabelVisibility;var h=[],tt=this.model.series.length,ni=this.model._axes[c].orientation.toLowerCase(),li=this.model._axes[c].rangePadding.toLowerCase();if(li=="auto")for(ni=="vertical"&&(i.rangePadding=this.model.requireInvertedAxes?"none":"normal"),ni=="horizontal"&&(i.rangePadding=this.model.requireInvertedAxes?"normal":"none"),e=0;e<tt;e++)if(p=this.model.series[e].type.toLowerCase(),p.indexOf("100")!=-1&&i.name==this.model.series[e]._yAxisName){i.rangePadding="round";break}for(d=0;d<i.stripLine.length;d++)i.stripLine[d]=$.extend(!0,{},this.model.stripLineDefault,i.stripLine[d]),i.stripLine[d].zIndex.toLowerCase()=="over"?dt=!0:gt=!0;for(b=i.orientation.toLowerCase(),ti=this.model._visibleSeries.length-1,e=0;e<this.model._visibleSeries.length;++e){ti-=1;r=this.model._visibleSeries[e];this.model._hasSeriesPoints=r.points.length>0||this.model._hasSeriesPoints;r.xAxisName||(r._xAxisName=k.model._axes[0].name);r.yAxisName||(r._yAxisName=k.model._axes[1].name);r._xAxisName=r._xAxisName?r._xAxisName:r.xAxisName?r.xAxisName:k.model._axes[0].name;r._yAxisName=r._yAxisName?r._yAxisName:r.yAxisName?r.yAxisName:k.model._axes[1].name;var ii=r._xAxisName.toLowerCase(),ri=r._yAxisName.toLowerCase(),ui=i.name.toLowerCase();if((ii||ri)&&(ii==ui||ri==ui)){if(b=="horizontal"&&i.valueType&&i.valueType.toString()=="datetime")for(l=0;l<r.points.length;l++)typeof r.points[l].xValue!="string"||isNaN(Date.parse(r.points[l].xValue))||(r.points[l].xValue=new Date(Date.parse(r.points[l].xValue)));else r._xAxisValueType!="string"||i.valueType||(i._valueType=b=="horizontal"&&!this.model.requireInvertedAxes?"category":b=="vertical"&&this.model.requireInvertedAxes?"category":"double"),r._xAxisValueType!="date"||i.valueType||(i._valueType=b=="horizontal"&&!this.model.requireInvertedAxes?"datetime":b=="vertical"&&this.model.requireInvertedAxes?"datetime":"double");this.model._visibleSeries[e].visibility.toLowerCase()=="visible"&&h.push(r)}}if(b==(this.model.requireInvertedAxes?"horizontal":"vertical")){var fi=!1,ei=!1,tt=h.length;for(i.isStacked100=h.length>0?!0:!1,t=0;t<tt;t++)p=h[t].type.toLowerCase(),ej.seriesTypes[p].prototype.stackingSeries||this.model.AreaType=="polaraxes"&&h[t].drawType.toLowerCase()=="column"&&h[t].isStacking?p.indexOf("100")==-1||fi?p.indexOf("100")!=-1||ei||(this._calculateStackingValues(h,i,f),ei=!0,i.isStacked100=!1):(this._calculateStackingCumulativeValues(h,i,f),fi=!0):i.isStacked100=!1}for(it=i.scrollbarSettings,it.visible&&(it.pointsLength!=null||it.range.min!=null||it.range.max!=null)&&(this.model.isLazyZooming=!0),i._valueType=i._valueType?i._valueType:i.valueType?i.valueType:"double",oi=new ej.axisTypes[i._valueType.toLowerCase()],rt=0;rt<h.length;rt++)for(ft=0;ft<h[rt].trendlines.length;ft++)if(h[rt].trendlines[ft].visibility=="visible"){this.model._drawTrendline=!0;break}oi._calculateRanges(k,i,h,f)}if(k._chartResize=!1,ht=$.extend({},ej.EjSvgRender.commonChartEventArgs),ht.data={axes:this.model._axes},this._trigger("axesLabelsInitialize",ht),this.model.isLazyZooming?0:this._updateScroll(),(this.svgHeight!=this.model.svgHeight||this.svgWidth!=this.model.svgWidth)&&(ct=ej.util.isNullOrUndefined(this.prevHeight)?this.svgHeight:this.prevHeight,lt=ej.util.isNullOrUndefined(this.prevWidth)?this.svgWidth:this.prevWidth,s=$.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={currentHeight:ct,currentWidth:lt,newHeight:this.model.svgHeight,newWidth:this.model.svgWidth},this._trigger("beforeResize",s),s.cancel?(this.model.enableCanvasRendering&&(this.svgRenderer.svgObj.width=s.data.currentWidth,this.svgRenderer.svgObj.height=s.data.currentHeight),this.model.svgWidth=s.data.currentWidth,this.model.svgHeight=s.data.currentHeight,$(this.svgObject).width(s.data.currentWidth),$(this.svgObject).height(s.data.currentHeight)):(this.model.enableCanvasRendering&&(this.svgRenderer.svgObj.width=s.data.newWidth,this.svgRenderer.svgObj.height=s.data.newHeight),this.model.svgWidth=s.data.newWidth,this.model.svgHeight=s.data.newHeight,$(this.svgObject).width(s.data.newWidth),$(this.svgObject).height(s.data.newHeight))),this._calculateAreaBounds(f),this.model.enable3D&&(g=new ej.Ej3DRender,this.vector=new g.vector3D,this.matrixobj=new g.matrix3D,this.bsptreeobj=new g.BSPTreeBuilder,this.polygon=new g.polygon3D,this.graphics=new g.Graphics3D,this.chart3D=this.svgRenderer.createGroup({id:this.svgObject.id+"_Chart3D"}),ej.Ej3DRender.Polygons=[]),this.model.AreaType!="none"){for(this._calculateAxisSize(f),t=0,nt=this.model._axes.length;t<nt;t++)this._validateCrossing(this.model._axes[t])&&this._axisCrossing(this.model._axes[t],!1,f);if(f._crossAxisOverlap){for(t=0,nt=this.model._axes.length;t<nt;t++)f.axes[this.model._axes[t].name]._validCross&&this._axisCrossing(this.model._axes[t],!0,f);f._crossAxisOverlap=!1}if(at=$.extend({},ej.EjSvgRender.commonChartEventArgs),at.data={areaBounds:this.model.m_AreaBounds},this._trigger("chartAreaBoundsCalculate",at),this._drawChartAreaRect(),this.model.title.text!=""&&this.model.title.text&&this.model.title.visible&&this._drawTitle(),this.gXaxisEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxis"}),this.gYaxisEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxis"}),this.gPolarAxisEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_AxisLine"}),this.model.enable3D?($.extend(ej.Ej3DAxisRenderer.prototype,this),this.chartaxis=new ej.Ej3DAxisRenderer(this)):($.extend(ej.EjAxisRenderer.prototype,this),this.chartaxis=new ej.EjAxisRenderer(this)),a=this.chartaxis,this.model.xAxisTitleRegion=[],this.model.yAxisTitleRegion=[],this.model.enable3D){for(o=0;o<this.model._axes.length;o++)a._drawAxes(o,this.model._axes[o],f);ej.Ej3DChart.prototype.update3DWall(this,f)}else for(o=0;o<this.model._axes.length;o++)a._drawGridLines(o,this.model._axes[o],f);this.model.requireInvertedAxes?(this.svgRenderer.append(this.gYaxisEle,this.svgObject),this.svgRenderer.append(this.gXaxisEle,this.svgObject)):(this.svgRenderer.append(this.gXaxisEle,this.svgObject),this.svgRenderer.append(this.gYaxisEle,this.svgObject));var ai=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.X,vi=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.Y,yi=this.model.AreaType=="polaraxes"?$(this.svgObject).width():this.model.m_AreaBounds.Width,pi=this.model.AreaType=="polaraxes"?$(this.svgObject).height():this.model.m_AreaBounds.Height,vt={id:this.svgObject.id+"_ChartAreaClipRect",x:ai,y:vi,width:yi,height:pi,fill:"white","stroke-width":1,stroke:"Gray"};this.svgRenderer.drawClipPath(vt,this.svgObject);this._setZoomProperties()}else this._drawChartAreaRect(),vt={id:this.svgObject.id+"_ChartAreaClipRect",x:0,y:0,width:$(this.svgObject).width(),height:$(this.svgObject).height(),fill:"white","stroke-width":1,stroke:"Gray"},this.svgRenderer.drawClipPath(vt,this.svgObject),this.model.title.text!=""&&this.model.title.text&&this.model.title.visible&&this._drawTitle();for(gt&&this.model.AreaType=="cartesianaxes"&&!this.model.enable3D&&(this.gStriplineBehind=this.svgRenderer.createGroup({id:this.svgObject.id+"_StriplineBehind","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"}),this._renderStripline("behind")),this.model.initSeriesRender&&(this.seriesRender(f),this.indicatorRender()),si=this.model.annotations.length,$("#annotation_group_"+this._id).empty(),ut=0;ut<si;ut++)yt=this.model.annotations[ut],yt.visible&&this.annotationRender(yt,ut);if(this.model.AreaType=="polaraxes"&&this.model._axes[1].visible&&!this.model.enable3D&&this.chartaxis._drawAxisLine(this.model._axes[1]),this.model.AreaType==="cartesianaxes"&&(this.model.requireInvertedAxes?(this.svgRenderer.append(this.gYaxisEle,this.svgObject),this.svgRenderer.append(this.gXaxisEle,this.svgObject)):(this.svgRenderer.append(this.gXaxisEle,this.svgObject),this.svgRenderer.append(this.gYaxisEle,this.svgObject)),this.gXaxisTickEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisTick"}),this.gYaxisTickEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTick"})),$.extend(ej.EjAxisRenderer.prototype,this),this.chartaxis=new ej.EjAxisRenderer(this),a=this.chartaxis,dt&&this.model.AreaType=="cartesianaxes"&&!this.model.enable3D&&(this.gStriplineOver=this.svgRenderer.createGroup({id:this.svgObject.id+"_StriplineOver","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"}),this._renderStripline("over")),!this.model.enable3D)for(o=0,nt=this.model._axes.length;o<nt;o++){var i=this.model._axes[o],et=f.axes[i.name]._lineOption,wi=f.axes[i.name]._validCross;this.model.AreaType.toLowerCase()=="cartesianaxes"&&(a._drawAxes(o,i),et[0]&&this.svgRenderer.drawLine(et[0],et[1]),i.orientation.toLowerCase()==="horizontal"?(a._drawXAxisTickLine(o,i,this.model.enableCanvasRendering?null:f.axes[i.name]._lineOption[1],f),a._drawXAxisMultiLevelLabels(o,i)):(a._drawYAxisTickLine(o,i,this.model.enableCanvasRendering?null:et[1],wi),a._drawYAxisMultiLevelLabels(o,i)),i._crossValue=null)}if(!this.resetZooming&&(this.model._chartAreaZoom||this.panning)&&this._enableZoomingButtons(),this.resetZooming=!1,(this.svgHeight!=this.model.svgHeight||this.svgWidth!=this.model.svgWidth)&&(this.prevHeight=this.model.svgHeight,this.prevWidth=this.model.svgWidth,s=$.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={height:this.prevHeight,width:this.prevWidth,prevHeight:ct,prevWidth:lt,originalHeight:this.svgHeight,originalWidth:this.svgWidth},this._trigger("afterResize",s)),h=this.model._visibleSeries,hi=$.grep(h,function(n){return n.selectionSettings.enable==!0}),hi.length==0?(this.model.selectionEnable=!1,this._removeSelection()):this.model.selectionEnable=!0,pt=this.remove_duplicates(this.model.selectedDataPointIndexes),this.model.selectionEnable)for(this._removeSelection(),this.model._isStateChaged=!0,ci=pt.length,t=0;t<ci;t++)w=pt[t],r=this.model._visibleSeries[w.seriesIndex],r&&(wt=r.selectionSettings.mode,(wt!="series"&&r.points[w.pointIndex]||wt=="series")&&this.segmentSelection(w.event,w.legendData,w.seriesIndex,w.pointIndex,w.data));this.chartUpdating=!1;bt=$.extend({},ej.EjSvgRender.commonChartEventArgs);bt.data={model:this.model};this._trigger("loaded",bt)},remove_duplicates:function(n){for(var i=[],r=[],e=n.length,u,f,o=this.model._visibleSeries,t=0;t<e;t++)f=o[n[t].seriesIndex],u=f?f.selectionSettings.mode:"",u=="series"?(i.indexOf(n[t].seriesIndex)>-1||r.push(n[t]),i.push(n[t].seriesIndex)):u=="cluster"?(i.indexOf(n[t].pointIndex)>-1||r.push(n[t]),i.push(n[t].pointIndex)):(n[t]in i||r.push(n[t]),i.push(n[t]));return r},_setZoomProperties:function(){for(var n,t,i,r,u=0;u<this.model._axes.length;u++)n=this.model._axes[u],r=n.orientation.toLowerCase(),t=n.zoomFactor.toFixed(3),i=n.zoomPosition.toFixed(3),r=="horizontal"&&(t!=this._xZoomFactor()||i!=this._xZoomPosition())&&(this._xZoomFactor(n.zoomFactor.toFixed(3)),this._xZoomPosition(n.zoomPosition.toFixed(3))),r=="vertical"&&(t!=this._yZoomFactor()||i!=this._yZoomPosition())&&(this._yZoomFactor(n.zoomFactor.toFixed(3)),this._yZoomPosition(n.zoomPosition.toFixed(3)))},annotationRender:function(n,t){var ft=this._id,p=!1,d=this.model.series[0],l=d.type.toLowerCase(),o=this.model.m_AreaBounds.X,h=this.model.m_AreaBounds.Y,tt=this.model.m_AreaBounds.Width,it=this.model.m_AreaBounds.Height,oi=this.model.margin.left,li=this.model.margin.top,ri=$.inArray(d,this.model._visibleSeries),et=this.model.circularRadius[ri],ot=this.model.circleCenterX[ri],st=this.model.circleCenterY[ri],si=$(document),ht,pt,wt,ui,hi,f,i,r,k,ct,fi,ei,ut,w,b,yt,v,nt,e,s,c,u,at;n=$.extend(!0,{},this.model.annotationsDefault,n);ht=$("#annotation_group_"+ft).length!=0?$("#annotation_group_"+ft):$("<div><\/div>").attr("id","annotation_group_"+ft);ht.css({position:"absolute",left:"0px",top:"0px"});pt=n.content;wt=$("#"+pt);wt.get(0).tagName=="SCRIPT"&&(wt=$($("#"+pt)[0].innerHTML));ui=wt.clone();hi="annotation_"+ft+"_"+pt+"_"+t;$(ui).attr("id",hi);f=$(ui);f.css({position:"absolute","z-index":2e3});var rt=n.region.toLowerCase(),vt=n.coordinateUnit.toLowerCase(),a=typeof n.x=="string"||typeof n.x=="object"?Date.parse(n.x):n.x,g=n.y,bt=n.horizontalAlignment.toLowerCase(),kt=n.verticalAlignment.toLowerCase();if(vt=="pixels")rt=="series"?tt+o+oi>a+o&&it+h+li>g+h&&(i=a+o,r=g+h):rt=="chart"&&$(this.svgObject).width()>a&&$(this.svgObject).height()>g&&(i=a,r=g),f.css({left:i,top:r}),p=!0;else if(vt=="points")if(point={x:a,y:g},this.model.AreaType=="polaraxes")w=this.model._axes[0],b=this.model._axes[1],a>=w.visibleRange.min&&a<=w.visibleRange.max&&g>=b.visibleRange.min&&g<=b.visibleRange.max&&(k=this.TransformToVisibleAnnotation(w,b,a,g,this),f.css({left:k.X,top:k.Y}),p=!0);else if(l=="pyramid"||l=="funnel")ct=d.points[a],f.css({left:ct.xLocation+this.pyrX,top:ct.yLocation+this.pyrY}),p=!0;else if(l=="pie"||l=="doughnut"||l=="pieofpie"){ct=d._visiblePoints[a];var ai=a,dt,gt,ci=new ej.seriesTypes[l],ni=ct?ct.currentMidAngle:0;(ai==d.explodeIndex||d.explodeAll)&&!chartObj.vmlRendering?(dt=ot+Math.cos(ni)*d.explodeOffset,gt=st+Math.sin(ni)*d.explodeOffset):(dt=ot,gt=st);fi=ci.getXCordinate(dt,et,ni);ei=ci.getYCordinate(gt,et,ni);positionX=(fi+dt)/2;positionY=(ei+gt)/2;positionX=(fi+positionX)/2;positionY=(ei+positionY)/2;f.css({left:positionX,top:positionY});p=!0}else{var vi=n.xAxisName,yi=n.yAxisName,pi=this.model._axes.length;for(ut=0;ut<pi;ut++)this.model._axes[ut].name==vi&&(w=this.model._axes[ut]),this.model._axes[ut].name==yi&&(b=this.model._axes[ut]);w||(w=this.model._axes[0]);b||(b=this.model._axes[1]);this.model.requireInvertedAxes?(point.x=point.y+(point.y=point.x,0),k=this._getAnnotationPoint(point,b,w),f.css({left:k.X+o,top:k.Y+w.y})):(k=this._getAnnotationPoint(point,w,b),f.css({left:k.X+o,top:k.Y+b.y}));p=!0}else{if(f.css("display","block").appendTo($(ht)),$(ht).appendTo("#chartContainer_"+ft),width=f.outerWidth(),height=f.outerHeight(),rt=="chart"){switch(bt){case"middle":i=$(this.svgObject).width()/2-width/2;break;case"left":i=0;break;case"right":i=$(this.svgObject).width()-width}switch(kt){case"middle":r=$(this.svgObject).height()/2-height/2;break;case"top":r=0;break;case"bottom":r=$(this.svgObject).height()-height}}else if(l=="pie"||l=="doughnut"||l=="pieofpie"){i=ot;r=st;switch(bt){case"middle":i=ot-width/2;break;case"left":i=ot-et;break;case"right":i=ot+et-width}switch(kt){case"middle":r=st-height/2;break;case"top":r=st-et;break;case"bottom":r=st+et}}else{switch(bt){case"middle":i=o+tt/2-width/2;break;case"left":i=o;break;case"right":i=o+tt-width}switch(kt){case"middle":r=h+it/2-height/2;break;case"top":r=h;break;case"bottom":r=h+it-height}}(l=="pyramid"||l=="funnel")&&(i-=oi);f.css({left:i,top:r})}if(i=parseFloat(f.css("left")),r=parseFloat(f.css("top")),vt!="none"&&p){f.css("display","block").appendTo($(ht));$(ht).appendTo("#chartContainer_"+ft);width=f.outerWidth();height=f.outerHeight();switch(bt){case"middle":i-=width/2;break;case"left":i-=width}switch(kt){case"middle":r-=height/2;break;case"top":r-=height}}yt=n.margin;i=i+yt.left-yt.right;r=r+yt.top-yt.bottom;commonEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs);commonEventArgs.data={content:f.html(),location:{x:i,y:r},opacity:n.opacity,angle:n.angle};this._trigger("annotationRendering",commonEventArgs);f.html(commonEventArgs.data.content);f.css({left:commonEventArgs.data.location.x,top:commonEventArgs.data.location.y,opacity:commonEventArgs.data.opacity});v=commonEventArgs.data.angle;v&&f.css({"-ms-transform":"rotate("+v+"deg)","-webkit-transform":"rotate("+v+"deg)","-moz-transform":"rotate("+v+"deg)","-o-transform":"rotate("+v+"deg)","-transform":"rotate("+v+"deg)"});var lt=f.attr("id"),y=u=s=e=0,ti=$("#"+this._id).width(),ii=$("#"+this._id).height();p&&v==0&&(rt=="series"||vt=="points")?(tt+o<i+width&&(nt=i+width-(tt+o),e=width-nt),i<o&&(s=o-i),it+h<r+height&&(c=r+height-(it+h),u=height-c),r<h&&(y=h-r),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)"):p&&v==0&&rt=="chart"?(ti<i+width&&(nt=i+width-ti,e=width-nt),i<0&&(s=width+i,s=s==0?width:s),ii<r+height&&(c=r+height-ii,u=height-c),r<0&&(y=height+r,y=y==0?height:y),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)"):p&&v==90&&(rt=="series"||vt=="points")?(at=document.getElementById(lt).getBoundingClientRect(),i=at.left-$(this.svgObject).offset().left+si.scrollLeft(),r=at.top-$(this.svgObject).offset().top+si.scrollTop(),it+h<r+width&&(nt=r+width-(it+h),e=width-nt),i<o&&(c=o-i,u=height-c),r<h&&(s=h-r),tt+o<i+height&&(c=i+height-(tt+o),y=c),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)"):p&&v==90&&rt=="chart"&&(at=document.getElementById(lt).getBoundingClientRect(),i=at.left-$(this.svgObject).offset().left,r=at.top-$(this.svgObject).offset().top,ii<r+width&&(nt=r+width-ii,e=width-nt),i<0&&(c=0-i,u=height-c,u=u==0?height:u),r<0&&(s=0-r,s=s==0?width:s),ti<i+height&&(c=i+height-ti,y=c),e=e==0?width:e,u=u==0?height:u,document.getElementById(lt).style.clip="rect("+y.toString()+"px,"+e.toString()+"px,"+u.toString()+"px,"+s+"px)")},TransformToVisibleAnnotation:function(n,t,i,r,u){i=n._valueType=="logarithmic"&&i>0?Math.log(i,n.logBase):i;r=n._valueType=="logarithmic"&&r>0?Math.log(r,t.logBase):r;var f=u.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,r,this),e=ej.EjSvgRender.utils._valueToVector(n,i);return{X:u.model.centerX+f*e.X,Y:u.model.centerY+f*e.Y}},_getAnnotationPoint:function(n,t,i){var o=this.model.requireInvertedAxes,r=n.x,u=n.y,f=t._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(r==0?1:r,t.logBase):r,e=i._valueType=="logarithmic"?ej.EjSvgRender.utils._logBase(u==0?1:u,t.logBase):u;return f=ej.EjSvgRender.utils._getPointXY(f,t.visibleRange,t.isInversed)*t.width,e=(1-ej.EjSvgRender.utils._getPointXY(e,i.visibleRange,i.isInversed))*i.height,n.location={X:f,Y:e},n.location},indicatorRender:function(){var e,i,n,r,u,t,o,f,s;for($(this.svgObject).find("#"+this.svgObject.id+"_IndicatorCollection").length>0&&$(this.svgObject).find("#"+this.svgObject.id+"_IndicatorCollection").remove(),e={id:this.svgObject.id+"_IndicatorCollection","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.gIndicatorEle=this.svgRenderer.createGroup(e),i=0;i<this.model.indicators.length&&this.model.indicators[i].visible&&this.model.indicators[i]._points.length>0;i++){for(n=this.model.indicators[i],u=0;u<this.model._axes.length;u++)t=this.model._axes[u],t.name&&t.orientation.toLowerCase()=="horizontal"&&t.name.toLowerCase()==n.xAxisName.toLowerCase()?n.xAxis=t:t.name&&t.orientation.toLowerCase()=="vertical"&&t.name.toLowerCase()==n.yAxisName.toLowerCase()&&(n.yAxis=t);o=n.type.toLowerCase();r=new ej.indicatorTypes[o];this.model.enableCanvasRendering?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(this.model.m_AreaBounds.X,n.yAxis.y,n.xAxis.width,n.yAxis.height),this.svgRenderer.ctx.clip(),r.draw(n,this),this.svgRenderer.ctx.restore()):r.draw(n,this);f=r.gIndicatorGroupEle;f&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(f,n,this);this.vmlRendering||this.model.enableCanvasRendering||n.enableAnimation&&(!n._animatedSeries||n.type!=n._previousType)&&(this.svgRenderer.append(this.gIndicatorEle,this.svgObject),s=$(this.gIndicatorEle).find("#"+this.svgObject.id+"_indicatorGroup_"+i+"_ClipRect").children(),ej.EjSeriesRender.prototype._doLineAnimation(this,s),this.model.AnimationComplete=!0,n._animatedSeries=!0,n._previousType=n.type);this.svgRenderer.append(this.gIndicatorEle,this.svgObject)}},doAnimation:function(n){var i=this,ot=i.model,f=ot.requireInvertedAxes,st=n.type.toLowerCase(),l=$.inArray(n,ot._visibleSeries),a=this.svgObject.id+"_SeriesGroup_"+l,p=$(i.gSymbolGroupEle)[l].childNodes,w=p.length,it=$(i.gDataLabelEle)[l].childNodes,b=it.length,rt=$(i.gConnectorEle)[l].childNodes,ut=rt.length,ft=$(i.gErrorBarGroupEle)[l]==undefined?undefined:$(i.gErrorBarGroupEle)[l].childNodes,ht=ej.util.isNullOrUndefined(ft)?0:ft.length,o=n.animationType,k,d,et,g,nt,v,s,e,y,tt,ct=0,lt,h,u=ej.EjSeriesRender.prototype,c,r,t;i.gSeriesGroupEle=$("#"+a)[0];switch(o){case"rect":if(e=$(this.gSeriesEle).find("#"+a).children("rect"),y=e.length,st=="boxandwhisker"){for(et=$(this.gSeriesEle).find("#"+a).children("line"),g=$(this.gSeriesEle).find("#"+a).children("path"),d=2e3/g.length,c=0;c<et.length;c++)u._doLineSymbol(et[c],d,c,n,f,i),u._doLineSymbol(e[c],d,c,n,f,i);for(r=0;r<g.length;r++)u._doLineSymbol(g[r],d,r,n,f,i)}else for(t=0;t<y;t++)st.indexOf("stacking")>-1?u.animateStackingRect(e[t],n,f,i):u.animateRect(e[t],n,f,i);nt=v=k=500;break;case"path":tt=$(i.gSeriesEle).find("#"+a+"_ClipRect").children();u._doLineAnimation(i,tt);nt=2e3/w;v=2e3/b;k=2e3/ht;break;case"scatter":for(t=0;t<w;t++)lt=Math.floor(Math.random()*(20-ct)+ct),h=parseInt(lt*50),u.animateSymbol(p[t],h,n,f,i);break;case"bubble":for(e=$(this.gSeriesGroupEle).children().not("defs"),h=0,t=0;t<e.length;t++)u.animateSymbol(e[t],h,n,f,i);for(t=0;t<w;t++)u.animateSymbol(p[t],h,n,f,i);for(t=0;t<b;t++)u.animateSymbol(it[t],h,n,f,i);for(t=0;t<ut;t++)u.animateSymbol(rt[t],h,n,f,i);break;case"hilo":for(e=$(this.gSeriesGroupEle).children().not("defs"),y=e.length,time=2e3/y,t=0;t<y;t++)u._doLineSymbol(e[t],time,t,n,f,i);v=2e3/b;break;case"cylinder":tt=$(i.gSeriesEle).find("#"+a+"_ClipRect").children();u.animateCylinder(i,n,f,tt);nt=v=k=500}if(o!="bubble"){for(r=0;r<w;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(p[r],nt,s,n,f,i);for(r=0;r<b;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(it[r],v,s,n,f,i);for(time=2e3/ut,r=0;r<ut;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(rt[r],time,s,n,f,i)}if(n.errorBar.visibility=="visible")for(r=0;r<ht;r++)s=o=="rect"||o=="stackingRect"?2:r,u._doLineSymbol(ft[r],k,s,n,f,i)},_animationElements:function(n,t,i){var r=this,f,u;if(n._previousType=ej.util.isNullOrUndefined(n._previousType)?n.type:n._previousType,!n.enableAnimation||this.vmlRendering||this.model.enableCanvasRendering||n._animatedSeries&&n.type==n._previousType||(ej.EjSeriesRender.prototype.doCircularAnimation(this,n,t,i),n._previousType=n.type,n._animatedSeries=r.isSplitted?!1:!0),r.isSplitted=!1,this.drawAccDisplayText(t,n,i),n.enableAnimation&&n._visiblePoints.length>0&&n.AnimationComplete&&!this.vmlRendering&&!this.model.enableCanvasRendering){if(r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gSeriesTextEle[i].id),{visibility:"visible"}),r.gSymbolGroupEle&&r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gSymbolGroupEle[i].id),{visibility:"visible"}),n.marker.dataLabel.template)for(f=$(r.element[0].childNodes[0].childNodes),u=0;u<f.length;u++)$(f[u]).css("display","block");r.gConnectorEle&&r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gConnectorEle[i].id),{visibility:"visible"});r.gDataLabelEle&&r.svgRenderer._setAttr($(r.gSeriesEle).find("#"+r.gDataLabelEle[i].id),{visibility:"visible"})}},_appendConnectorElements:function(n){var i=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),t=i[n],r=t.type.toLowerCase();t.visibility=="visible"&&!this.model.enable3D&&t.connectorLine&&(t.connectorLines||this.model.AreaType=="none")&&(this.svgRenderer.append(this.gConnectorEle[n],this.gSeriesEle),t.connectorLines=!1)},_appendDataLabelElement:function(n){var t,i;t=this.model._visibleSeries[n];i=ej.util.isNullOrUndefined(t.zOrder)?i:t.zOrder;t.visibility!="visible"||this.model.enable3D||(this.svgRenderer.append(this.gSymbolGroupEle[n],this.gSeriesEle),this.model.enable3D||this.model.enableCanvasRendering||(this.gDataLabelEle[n].childNodes.length>0&&this.svgRenderer.append(this.gDataLabelEle[n],this.gSeriesEle),this.gSeriesTextEle[n].childNodes.length>0&&this.svgRenderer.append(this.gSeriesTextEle[n],this.gSeriesEle)));this.vmlRendering||t.visibility!="visible"||this.model.enableCanvasRendering||this.model.enable3D||(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element))},_accSeriesDraw:function(n,t,i){var e=this,r=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),o=$.inArray(r[n],this.model._visibleSeries),u,f,s;this.model._visibleSeries[o]=r[n]=$.extend(!0,t,r[n]);u=$.extend({},ej.EjSvgRender.commonChartEventArgs);u.data={series:t};this._trigger("seriesRendering",u);f=new ej.seriesTypes[i.toLowerCase()];s=f.draw(e,t);s||(this.model.minhightwidth=!0,e._animationElements(t,f,o))},_splitSeries:function(n){var t=[],e,i,h,r,p;t[0]=$.extend(!0,[],n._visiblePoints);t[1]=[];for(var f=n,c=parseInt(f.splitValue),s=f.splitMode.toLowerCase(),l=t[0].length,u=0,o=0,a=[],r=0,v=0,y;r!=l;)v+=t[0][r].y,r++;if(s=="position"){for(r=l-1;r>=0&&o!=c;r--)u=u+t[0][r].y,t[1][o]=t[0][r],o++,t[0].splice(r,1);t[1].reverse()}else if(s=="value"||s=="percentage")for(i=0;i<t[0].length;i++)y=s=="value"?t[0][i].y:Math.round(t[0][i].y/v*100),y<c&&(u=u+t[0][i].y,t[1][o]=t[0][i],o++,t[0].splice(i,1),i=-1);else if(s=="indexes"){for(e=JSON.parse("["+f.splitValue+"]"),e=e.filter(function(n,t,i){return i.indexOf(n)==t}),e.sort(),i=0;i<t[0].length;i++)for(h=0;h<e.length;h++)i==e[h]&&(u=u+t[0][i].y,t[1][o]=t[0][i],o++);for(r=0;r<e.length;r++)p=e[r]-r,t[0].splice(p,1)}t[1].length>0&&(a[0]=u,valueType=f._xAxisValueType,t[0].unshift({_visibility:"visible",visible:!0,text:"Others",x:valueType=="string"?"Others":u,xValue:valueType=="string"?f.points.length:u,y:u,YValues:a,fill:this.model.colors[(f.points.length+1)%this.model.colors.length],isFill:!1,actualIndex:f.points.length}));this.isSplitted=!0;f.pieCollections=t},_calculateGapWidth:function(n){var o=0,s=0,r,u,h,c=.1*Math.min($(this.svgObject).width(),$(this.svgObject).width()),t,i,f,e;for(ej.EjSeriesRender.prototype._calculateVisiblePoints(n).visiblePoints,this._splitSeries(n),this.chartObj=this,t=0;t<2;t++)r=t==0?n.pieCoefficient:n.pieOfPieCoefficient,n._visiblePoints=n.pieCollections[t],n.collectionIndex=t,h=n.gapWidth,i=ej.EjSeriesRender.prototype.calculatingSliceAngle(n,this.chartObj),f=i.width<c?.25*r*c:.25*r*Math.min(i.width,i.height),u=this.model.circleCenterX[t],t==0?o=u+f:s=u-f;return e=s-o-h,this.model.pieGapWidth=e>0?e:0,n.pieCollections[0].length>0&&n.pieCollections[1].length>0&&n.connectorLine.width>0&&this.drawPieofPieConnectors(i,n),n},seriesRender:function(n){var u,v,y,tt,gt,rt,it,ut,w,yt,pt,wt,bt,h,t,ni,ct,ti,g,e,s,b,r,st,ft,et,ii,kt,f,a,ri,k,ui,o,c,dt,fi,lt,ei,p,at,i,vt,si,hi;if(this.model.allPoints=[],this.model.markerRegion=[],this.model.circleCenterX=[],this.model.circleCenterY=[],this.model.startX=[],this.model.startY=[],this.model.centerCount=0,this.gTrendlinesGroupEle=null,!n)for(n={_crossAxisOverlap:!1,axes:{}},i=0;i<this.model._axes.length;i++)n.axes[this.model._axes[i].name]={};u=this;$(this.svgObject).find("#"+this.svgObject.id+"_SeriesCollection").length>0&&$(this.svgObject).find("#"+this.svgObject.id+"_SeriesCollection").remove();var ci={id:this.svgObject.id+"_SeriesCollection","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},nt=this.model.enable3D,d=this.model.AreaType,ot=this.model.enableCanvasRendering,li=this.model._axes.length;for(this.gSeriesEle=this.svgRenderer.createGroup(ci),f=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),v=f.length,i=0;i<v;i++)if(f[i].visibility=="visible")for(this.model.series[i]._enableSmartLabels=ej.util.isNullOrUndefined(this.model.series[i].enableSmartLabels)?this.model.AreaType=="none"?!0:!1:this.model.series[i].enableSmartLabels,ej.util.isNullOrUndefined(f[i].xAxis)||(f[i].xAxis=null,f[i].yAxis=null),c=0;c<li;c++){var l=this.model._axes[c],st=i,ht=l.orientation.toLowerCase();l.name&&ht=="horizontal"&&l.name.toLowerCase()==f[i]._xAxisName.toLowerCase()?f[i].xAxis=l:l.name&&ht=="vertical"&&l.name.toLowerCase()==f[i]._yAxisName.toLowerCase()&&(f[i].yAxis=l);this.model.requireInvertedAxes&&(l.name&&ht=="vertical"&&l.name.toLowerCase()==f[i]._xAxisName.toLowerCase()?f[i].xAxis=l:l.name&&ht=="horizontal"&&l.name.toLowerCase()==f[i]._yAxisName.toLowerCase()&&(f[i].yAxis=l))}if(v>0){var r=f[0],gt=r.type.toLowerCase(),ai=r.visibility.toLowerCase();if(gt!="pieofpie"||ai!="visible"||nt)for(rt=v;rt>0&&d=="none";rt--)st=rt-1,y=f[rt-1],tt=y.visibility.toLowerCase(),e=y.type.toLowerCase(),tt!=="visible"||nt||e!="pie"&&e!="doughnut"?d!="none"||tt!=="visible"||ot||ej.Ej3DChart.prototype.renderSeries(this,y):this._accSeriesDraw(st,y,e);else{for(this.model._isPieOfPie=!0,r=this._calculateGapWidth(r),a=0;a<2;a++)r.collectionIndex=a,r._visiblePoints=r.pieCollections[a],this._accSeriesDraw(0,r,gt);r._visiblePoints=$.merge(r.pieCollections[0],r.pieCollections[1]);this.model.pieGapWidth=null;r.collectionIndex=0}}for(it=0;it<v;it++){var st=it,y=f[it],tt=y.visibility.toLowerCase(),e=y.type.toLowerCase();d!="none"||tt!=="visible"||nt||st!==0||e!="pyramid"&&e!="funnel"?tt!=="visible"||nt||d=="none"?nt||d=="none"?d!="cartesianaxes"||tt!=="visible"||ot||ej.Ej3DChart.prototype.renderSeries(this,y,n):this.svgRenderer.append(this.svgObject,this.element):(this.renderSeries(y,n),d=="cartesianaxes"&&this.model.series[it].type!="boxandwhisker"&&this._renderTrendline(u,y)):this._accSeriesDraw(st,y,e)}if(this.model.AreaType!="none"){for(yt=this.model.enableCanvasRendering,pt=this.model.m_AreaBounds,i=0;i<v;i++)if(r=this.model.series[i],ut=r._visiblePoints,r._enableSmartLabels&&this.model.AreaType=="cartesianaxes")for(w=r.type.toLowerCase(),w=="column"||w=="stackingcolumn"||w=="bar"||w=="stackingbar"||w=="waterfall"||w=="stackingbar100"||w=="stackingcolumn100"||w=="rangecolumn"?this.cartesianColumnSmartLabels(r,ut,i):w!="boxandwhisker"&&this.cartesianSmartLabels(r,ut,i),c=0;c<ut.length;c++)t=ut[c],t.hide=!1,wt=yt?t.xPos-this.canvasX:t.xPos,bt=yt?t.yPos-this.canvasY:t.yPos,(wt-t.width/2<0||wt+t.width/2>pt.Width||bt+t.height/2>pt.Height||bt-t.height/2<0)&&(t.hide=!0);for(g=u.model.m_AreaBounds.X,i=0;i<v;i++)if(r=f[i],r.visibility=="visible")for(ct=r._visiblePoints.length,h=0;h<ct;h++)t=r._visiblePoints[h],ni=t.marker&&t.marker.dataLabel&&t.marker.dataLabel.visible,(r.marker.dataLabel.visible||ni)&&(!(t.connectorFlag||t.newConnectorFlag)||t.hide||t.drawText==""||r.visibility!="visible"||ej.util.isNullOrUndefined(t.textOptions)||(r.connectorLine=!0,u.model.enableCanvasRendering?(u.svgRenderer.ctx.save(),u.model.requireInvertedAxes?u.svgRenderer.ctx.rect(g+r.yAxis.plotOffset,r.xAxis.y,r.yAxis.width,r.xAxis.height):u.svgRenderer.ctx.rect(g,r.yAxis.y,r.xAxis.width,r.yAxis.height),u.svgRenderer.ctx.clip(),this.drawConnectorLines(i,h,t),u.svgRenderer.ctx.restore()):r._enableSmartLabels&&this.drawConnectorLines(i,h,t)));for(g=u.model.m_AreaBounds.X,i=0;i<v;i++)if(r=f[i],e=r.type.toLowerCase(),r.visibility=="visible"&&!this.model.enable3D)for(ct=r._visiblePoints.length,h=0;h<ct;h++)if(t=r._visiblePoints[h],ti=t.marker&&t.marker.dataLabel&&t.marker.dataLabel.visible,(r.marker.dataLabel.visible||ti)&&!t.hide&&!t.dataLabeltemplate&&r.visibility=="visible"&&!ej.util.isNullOrUndefined(t.textOptions)&&!t.hide){if(t.textOptions.transform="rotate("+t.textOptions.angle+","+t.xPos+","+t.yPos+")",t.textOptions.labelRotation=t.textOptions.angle,u.model.enableCanvasRendering){if(u.svgRenderer.ctx.save(),u.model.requireInvertedAxes?u.svgRenderer.ctx.rect(g+r.yAxis.plotOffset,r.xAxis.y,r.yAxis.width,r.xAxis.height):u.svgRenderer.ctx.rect(g,r.yAxis.y,r.xAxis.width,r.yAxis.height),u.svgRenderer.ctx.save(),u.svgRenderer.ctx.clip(),e.toLowerCase()=="boxandwhisker")for(r.showMedian==!0&&t.textOptionsBoxValues!=""&&(ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[0].xPos,t.textOptionsBoxValues[0].yPos,t.textOptionsBoxValues[0].width,t.textOptionsBoxValues[0].height,t.textOptionsBoxValues[0].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[0],t.textOptionsBoxValues[0].drawText,this.gSeriesTextEle[i])),s=1;s<t.textOptionsBoxValues.length;s++)ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[s].xPos,t.textOptionsBoxValues[s].yPos,t.textOptionsBoxValues[s].width,t.textOptionsBoxValues[s].height,t.textOptionsBoxValues[s].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[s],t.textOptionsBoxValues[s].drawText,this.gSeriesTextEle[i]);else ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPos,t.yPos,t.width,t.height,t.symbolName,this),this.svgRenderer.drawText(t.textOptions,t.drawText,this.gSeriesTextEle);u.svgRenderer.ctx.restore()}else ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPos,t.yPos,t.width,t.height,t.symbolName,this,this.gDataLabelEle[i]),this.svgRenderer.drawText(t.textOptions,t.drawText,this.gSeriesTextEle[i]);if(e=="rangecolumn"||e=="rangearea")t.textOptionsLow.transform="rotate("+t.textOptionsLow.angle+","+t.xPosLow+","+t.yPosLow+")",t.textOptionsLow.labelRotation=t.textOptionsLow.angle,u.model.enableCanvasRendering?(u.svgRenderer.ctx.save(),u.model.requireInvertedAxes?u.svgRenderer.ctx.rect(g+r.yAxis.plotOffset,r.xAxis.y,r.yAxis.width,r.xAxis.height):u.svgRenderer.ctx.rect(g,r.yAxis.y,r.xAxis.width,r.yAxis.height),u.svgRenderer.ctx.clip(),ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPosLow,t.yPosLow,t.widthLow,t.heightLow,t.symbolName,this),this.svgRenderer.drawText(t.textOptionsLow,t.drawTextLow,this.gSeriesTextEle),u.svgRenderer.ctx.restore()):(ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.xPosLow,t.yPosLow,t.widthLow,t.heightLow,t.symbolName,this,this.gDataLabelEle[i]),this.svgRenderer.drawText(t.textOptionsLow,t.drawTextLow,this.gSeriesTextEle[i]));else if(e.toLowerCase()=="boxandwhisker")for(r.showMedian==!0&&t.textOptionsBoxValues!=""&&(ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[0].xPos,t.textOptionsBoxValues[0].yPos,t.textOptionsBoxValues[0].width,t.textOptionsBoxValues[0].height,t.textOptionsBoxValues[0].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[0],t.textOptionsBoxValues[0].drawText,this.gSeriesTextEle[i])),s=1;s<t.textOptionsBoxValues.length;s++)ej.EjSeriesRender.prototype.dataLabelSymbol(i,r,h,t.textOptionsBoxValues[s].xPos,t.textOptionsBoxValues[s].yPos,t.textOptionsBoxValues[s].width,t.textOptionsBoxValues[s].height,t.textOptionsBoxValues[s].symbolName,this),this.svgRenderer.drawText(t.textOptionsBoxValues[s],t.textOptionsBoxValues[s].drawText,this.gSeriesTextEle[i])}if(this.model.AreaType!="none"){for(i=0;i<v;i++)this._appendConnectorElements(i);for(p=this.model._visibleSeries.length,i=0;i<p;i++)this._appendDataLabelElement(i)}}else{for(b=v-1;b>=0;b--)r=this.model._visibleSeries[b],e=r.type.toLowerCase(),(e=="pie"||e=="doughnut")&&this.model.minhightwidth&&this._appendConnectorElements(b);if(p=this.model._visibleSeries.length,p>0&&e=="pieofpie")this._appendDataLabelElement(0);else for(b=v-1;b>=0;b--)r=this.model._visibleSeries[b],e=r.type.toLowerCase(),(e=="pie"||e=="doughnut")&&this.model.minhightwidth&&this._appendDataLabelElement(b)}for(p=this.model._visibleSeries.length,ft=0;ft<p;ft++)o=this.model._visibleSeries[ft],e=o.type.toLowerCase(),o._previousType=ej.util.isNullOrUndefined(o._previousType)?o.type:o._previousType,this.vmlRendering||o.visibility!="visible"||this.model.enableCanvasRendering||this.model.enable3D||this.model.AreaType=="none"||(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element),et=new ej.seriesTypes[o.type.toLowerCase()],et.chartObj=u,et.gSeriesGroupEle=$("#"+this.svgObject.id+"_SeriesGroup_"+ft)[0],o.enableAnimation&&(!o._animatedSeries||o._previousType!=o.type)&&this.model.AreaType!="none"&&(o._animatedSeries=!0,o._previousType=o.type,ii=$("#template_group_"+this._id),kt=o.marker.dataLabel,ii.children().length!=0&&kt.visible&&kt.template&&et.animateLabelTemplate(o),e=="polar"||e=="radar"?ej.ejRadarSeries.prototype.doAnimation(o,et):this.doAnimation(o)));if(f=this.model._visibleSeries,p=f.length,!this.model.enableCanvasRendering&&!this.model.enable3D)for(a=0;a<p;a++)f[a].visibility.toLowerCase()=="visible"&&this.gTrendlinesGroupEle&&this.gTrendlinesGroupEle[a]&&this.gTrendlinesGroupEle[a].childElementCount!=0&&this.svgRenderer.append(this.gTrendlinesGroupEle[a],this.svgObject);for(i=0;i<p;i++)for(r=this.model._visibleSeries[i],ri=r.trendlines,dt=r.trendlines.length,c=0;c<dt;c++)k=ri[c],k.visibility&&(ui=k.type.toLowerCase(),o=new ej.trendlineTypes[ui],k.visibility.toLowerCase()==="visible"&&k.points&&k.points.length>1&&r.enableAnimation&&!this.vmlRendering&&(!r._animatedTrendline||k._previousType!=k.type)&&(k._previousType=k.type,fi=$(this.svgObject).find("#"+this.svgObject.id+"_TrendGroup_"+i+"_"+c+"_ClipRect").children(),ej.EjSeriesRender.prototype._doLineAnimation(this,fi),r._animatedTrendline=dt-1==i?!0:!1));for(p=this.model._visibleSeries.length,at=this.svgObject.id,i=0;i<p;i++){var lt=$("#"+at+"_SeriesGroup_"+i),oi=$("#"+at+"_SeriesGroup_waterfallLine_"+i),ei=$("#"+at+"_symbolGroup_"+i);lt.length>0&&ei.length>0&&ei.insertAfter(lt);lt.length>0&&oi.length>0&&oi.insertAfter(lt)}this.model.AnimationComplete=!0;vt=$.extend({},ej.EjSvgRender.commonChartEventArgs);vt.data={series:o};this._trigger("animationComplete",vt);ot&&(this.svgRenderer.append(this.svgObject,this.element),this.panning&&$("#"+this._id+"_canvas").css({cursor:"pointer"}));nt&&!ot&&(this.svgRenderer.append(this.chart3D,this.svgObject),si={Width:$(this.svgObject).width(),Height:$(this.svgObject).height()},this.graphics.prepareView(this.model.perspectiveAngle,this.model.depth,this.model.rotation,this.model.tilt,si,this),this.graphics.view(this.svgObject,this),this.svgRenderer.append(this.svgObject,this.element));this.svgRenderer.vmlNamespace&&this.svgRenderer.append(this.gSeriesEle,this.svgObject);d=="polaraxes"&&this.svgRenderer.append(this.gPolarAxisEle,this.svgObject);$(this.svgObject).find("#"+this.svgObject.id+"_StriplineOver").length>0&&(hi=$(this.svgObject).find("#"+this.svgObject.id+"_StriplineOver").detach(),hi.appendTo(this.svgObject));this._renderScrollbar();this.legendRender.drawLegend(n);u.model.initSeriesRender=!0},_calculateZoomValue:function(n,t,i,r){var l=this.model,o,s,h,u,f,e=i.scrollbarSettings.range,c=i._valueType.toLowerCase();c=="datetime"?(u=Date.parse(ej.util.isNullOrUndefined(e.min)?n:new Date(e.min)),f=Date.parse(ej.util.isNullOrUndefined(e.max)?t:new Date(e.max))):(u=parseFloat(ej.util.isNullOrUndefined(e.min)?n:e.min),f=parseFloat(ej.util.isNullOrUndefined(e.max)?t:e.max));u=Math.min(u,n);f=Math.max(f,t);o=f-u;r.isRTL?(s=(f-t)/o,h=(t-n)/o):(s=(n-u)/o,h=(t-n)/o);r.scrollRange={min:u,max:f,delta:f-u};r._previousStart=n;r._previousEnd=t;r.zoomPosition=s;r.zoomFactor=h},_renderScrollbar:function(){var r=this.model,y=r.scrollerSize,g=$("#"+this._id).offset(),b=$(this.svgObject).offset().left-g.left,p,e,i,o,s,l,k=r._axes,nt=k.length,w,tt=r.zooming.enableScrollbar,f,it=r.AreaType,u,h,a,d,t,c,n,v;for(r.scrollObj=r.scrollObj?r.scrollObj:[],n=0;n<nt;n++)i=k[n],valueType=i._valueType,u=i.scrollbarSettings,f=u.range,w=i.isInversed,isZoomAble=it=="cartesianaxes"&&!r.enable3D,l=i._opposed,h=u.pointsLength,c=i.orientation.toLowerCase(),o=i.zoomFactor,a=$("#scrollbar_"+this.axisScroll[0].id+n).length,s=i.zoomPosition,isZoomAble&&(i._isScroll&&r.isLazyZooming||(o<1||s>0)&&tt)?(e=i.x+(c=="vertical"?-y+(l?y:0):0)+(b<=0?0:b),p=i.y+(c=="horizontal"?i.height+(l?-y:0):0),posY=p-(c=="horizontal"?0:i.plotOffset),width=i.plotOffset+(c=="horizontal"?i.width:i.height),t=r.scrollObj,isRedraw=f.min!=null||f.max!=null?t[n]?t[n].actualRange.min!=f.min||t[n].actualRange.max!=f.max:!1:t[n]?t[n].actualRange!=u.pointsLength:!1,this.scrollDraw=t[n]?t[n].x!=e||t[n].y!=p||t[n].width!=width:this.scrollDraw,v={orientation:i.orientation,index:n,width:width,x:e,y:posY,opposed:l,isRTL:w,parent:this.axisScroll,enableResize:u.canResize},r.isLazyZooming?(a==0||this.scrollDraw||isRedraw)&&($("#scrollbar_"+this.axisScroll[0].id+n).remove(),f.min!=null||f.max!=null?(d=t[n]&&t[n].scrollRange?t[n].scrollRange:i.visibleRange,!this.scrollDraw||isRedraw?(t[n]={isVirtual:!0,valueType:valueType,scrollRange:d},t[n].actualRange=$.extend(t[n].actualRange,u.range),$.extend(t[n],v),valueType=="datetime"?(t[n].startDateTime=new Date(i.visibleRange.min),t[n].endDateTime=new Date(i.visibleRange.max)):(t[n].startValue=i.visibleRange.min,t[n].endValue=i.visibleRange.max),this._calculateZoomValue(i.visibleRange.min,i.visibleRange.max,i,this.model.scrollObj[n])):(t[n].width=width,t[n].x=e,t[n].y=posY)):h>=i.maxPointLength&&(o=i.maxPointLength/h,s=w?1-i.zoomPosition:i.zoomPosition,!this.scrollDraw||isRedraw?(t[n]={isVirtual:!0,zoomPosition:s,zoomFactor:o,scrollRange:{min:0,max:h-1,delta:h-1},valueType:"double"},t[n].actualRange=u.pointsLength,$.extend(t[n],v),t[n].startValue=0,t[n].endValue=i.maxPointLength):(t[n].width=width,t[n].x=e,t[n].y=posY)),this.model.scrollObj[n]&&(this.scrollbarContainer=new ej.EjSvgScrollbarRender(this.axisScroll,this.model.scrollObj[n]),this.scrollbarContainer._initializeScrollbarVariables(this.model.scrollObj[n]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[n]))):u.visible&&(t=r.scrollObj,(a==0||this.scrollDraw)&&($("#scrollbar_"+this.axisScroll[0].id+n).remove(),t[n]={zoomPosition:s,zoomFactor:o,valueType:valueType,scrollRange:i.actualRange,isZooming:!0},$.extend(t[n],v),t[n].valueType=="datetime"?(t[n].startDateTime=new Date(t[n].scrollRange.min),t[n].endDateTime=new Date(t[n].scrollRange.max)):(t[n].startValue=t[n].scrollRange.min,t[n].endValue=t[n].scrollRange.max),this.scrollbarContainer=new ej.EjSvgScrollbarRender(this.axisScroll,this.model.scrollObj[n]),this.scrollbarContainer._initializeScrollbarVariables(this.model.scrollObj[n]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[n])))):a>0&&$("#scrollbar_"+this.axisScroll[0].id+n).remove();this.scrollDraw=!1},_renderTrendline:function(n,t){var f=$.inArray(t,n.model.series),g=n.model.requireInvertedAxes?t.yAxis.x:t.xAxis.x,nt=n.model.requireInvertedAxes?t.xAxis.y:t.yAxis.y,tt="translate("+g+","+nt+")",it={id:n.svgObject.id+"_TrendlinesGroup_"+f,"clip-path":"url(#"+n.svgObject.id+"_TrendlinesGroup_"+f+"_ClipRect)"},p=t.trendlines,e,c,l,w,a,i,u,o,s,h,r="",rt=p.length,b,v,y,k,d;for(n.gTrendlinesGroupEle||(n.gTrendlinesGroupEle=[]),n.gTrendlinesGroupEle[f]=n.svgRenderer.createGroup(it),u=0;u<rt;u++)if(i=p[u],i.seriesIndex=f,i.isTrendLine=!0,i.trendlineIndex=u,i.visibility.toLowerCase()==="visible"&&!i.isNull&&i.points&&i.points.length>1){b={id:n.svgObject.id+"_TrendGroup_"+f+"_"+u,transform:tt,"clip-path":"url(#"+n.svgObject.id+"_TrendGroup_"+f+"_"+u+"_ClipRect)"};t.gTrendGroupEle=null;t.gTrendGroupEle=n.svgRenderer.createGroup(b);v=i.type.toLowerCase();a=new ej.trendlineTypes[v];o=i.slope;s=i._intercept;switch(v){case"linear":r="y = "+o.toFixed(4)+"x + "+s.toFixed(4);break;case"exponential":r="y = "+s.toFixed(3)+"e^"+o.toFixed(4)+"x";break;case"logarithmic":r="y = "+o.toFixed(3)+"ln(x) + "+s.toFixed(4);break;case"power":r="y = "+s.toFixed(3)+"x^"+o.toFixed(4);break;case"polynomial":for(l=i.polynomialSlopes,w=l.length,r="y = ",e=w-1;e>=0;e--)h=l[e],r+=h>0?"+"+h:"-"+Math.abs(h),e!=0&&(r+="x^"+e+" ")}i.equation=r;y=$.extend({},ej.EjSvgRender.commonChartEventArgs);k=i.points[0];d=i.points[i.points.length-1];y.data={series:t,trendline:i,forwardForecastPoints:d,backwardForecastPoints:k};this._trigger("trendlineRendering",y);n.model.enableCanvasRendering?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(n.model.m_AreaBounds.X,t.yAxis.y,t.xAxis.width,t.yAxis.height),this.svgRenderer.ctx.clip(),this.svgRenderer.ctx.beginPath(),a.draw(i,t,n),this.svgRenderer.ctx.restore()):(a.draw(i,t,n),c=t.gTrendGroupEle,c&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(c,t,this))}},_renderStripline:function(n){var u,i,r,t;for($.extend(ej.EjStripline.prototype,this),this.chartstripline=new ej.EjStripline(this),u=this.chartstripline,this.model._stripeline=!1,i=0;i<this.model._axes.length;i++)for(r=this.model._axes[i],t=0;t<r.stripLine.length;t++)r.stripLine[t].zIndex.toLowerCase()==n&&u._drawStripline(r,r.stripLine[t],i,t);n=="over"&&this.model._stripeline?this.svgRenderer.append(this.gStriplineOver,this.svgObject):this.model._stripeline&&this.svgRenderer.append(this.gStriplineBehind,this.svgObject)},renderSeries:function(n,t){for(var a,w,b,k,v,e,f,y,d,r,tt,it=this,i=$.inArray(n,this.model._visibleSeries),o=0;o<n.points.length;o++)typeof n.points[o].x=="string"&&n.points[o].x.indexOf("/Date(")!=-1&&(n.points[o].x=new Date(parseInt(n.points[o].x.substr(6))));n.xAxis=n.xAxis===null||n.xAxis===undefined?this.model._axes[0]:n.xAxis;n.yAxis=n.yAxis===null||n.yAxis===undefined?this.model._axes[1]:n.yAxis;var u=n.type.toLowerCase(),g=n.drawType.toLowerCase(),p,f=null,s;if(this.model.AreaType=="cartesianaxes"?(a=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),f="translate("+a.x+","+a.y+")",s="visible"):s=n.enableAnimation&&!n._animatedSeries?"hidden":"visible",w={id:this.svgObject.id+"_TextGroup_"+i,transform:f,visibility:s},b={id:this.svgObject.id+"_DataLabel_"+i,transform:f,visibility:s},p=u!="scatter"?{id:this.svgObject.id+"_symbolGroup_"+i,transform:f,visibility:s}:{id:this.svgObject.id+"_SeriesGroup_"+i,transform:f},k={id:this.svgObject.id+"_ConnectorGroup_"+i,transform:f,visibility:s},this.gSymbolGroupEle||(this.gSymbolGroupEle=[]),this.gSymbolGroupEle[i]=this.svgRenderer.createGroup(p),this.gSeriesTextEle||(this.gSeriesTextEle=[]),this.gSeriesTextEle[i]=this.svgRenderer.createGroup(w),this.gConnectorEle||(this.gConnectorEle=[]),this.gConnectorEle[i]=this.svgRenderer.createGroup(k),this.gDataLabelEle||(this.gDataLabelEle=[]),this.gDataLabelEle[i]=this.svgRenderer.createGroup(b),v=$.extend({},ej.EjSvgRender.commonChartEventArgs),v.data={series:n},this._trigger("seriesRendering",v),e=new ej.seriesTypes[u],this.model.enableCanvasRendering&&this.model.AreaType!="none"?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.model.requireInvertedAxes?(f=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),this.canvasX=f.x,this.canvasY=f.y,this.svgRenderer.ctx.rect(n.yAxis.x,n.xAxis.y,n.yAxis.width,n.xAxis.height)):(this.canvasX=n.xAxis.x,this.canvasY=n.yAxis.y,this.svgRenderer.ctx.rect(n.xAxis.x,n.yAxis.y,n.xAxis.width,n.yAxis.height)),this.svgRenderer.ctx.clip(),e.draw(this,n,t),this.svgRenderer.ctx.restore()):this.model.enableCanvasRendering&&this.model.AreaType=="polaraxes"?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.arc(this.model.centerX,this.model.centerY,this.model.Radius,0,2*Math.PI,!1),this.svgRenderer.ctx.clip(),this.canvasX=this.canvasY=0,e.draw(this,n),this.svgRenderer.ctx.restore()):(this.canvasX=this.canvasY=0,this.model.AreaType=="cartesianaxes"?e.draw(this,n,t):this.model.AreaType=="polaraxes"&&n._xAxisName==this.model._axes[0].name&&n._yAxisName==this.model._axes[1].name&&e.draw(this,n)),y=this.model.series[i].errorBar,d=this.model.AreaType,y.visibility=="visible"&&d=="cartesianaxes"&&this.model.series[i].type!="boxandwhisker"&&this.renderErrorBar(y,n),r=e.gSeriesGroupEle,r&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this),!(u=="candle"||u=="hilo"||u=="hiloopenclose"||u=="boxandwhisker")){var c=this,l,h=c.model.AreaType.toLowerCase(),nt=ej.seriesTypes[u].prototype.isRegion;u=="scatter"||$.each(n._visiblePoints,function(t,r){if(r.visible&&r.x!==""&&(r.marker&&r.marker.visible||n.marker.visible)){if(l=h=="polaraxes"&&g=="column"||nt?r.symbolLocation:h!="polaraxes"?ej.EjSvgRender.utils._getPoint(r,n):ej.EjSvgRender.utils.TransformToVisible(n,r.xValue,r.y,c),h=="polaraxes")var u=n.yAxis.labelFormat?n.yAxis.labelFormat:"",f=r.text?r.text:r.y+u.substring(u.indexOf("}")+1),o=ej.EjSvgRender.utils._measureText(f,null,n.marker.dataLabel.font);(h=="polaraxes"&&n._xAxisName==c.model._axes[0].name&&n._yAxisName==c.model._axes[1].name||h=="cartesianaxes")&&e.drawSymbol(i,n,t,l.X,l.Y)}});u!="scatter"?(n.marker.visible&&(r=this.gSymbolGroupEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this)),n.marker.dataLabel.visible&&(r=this.gSeriesTextEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this),r=this.gDataLabelEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this)),!ej.util.isNullOrUndefined(this.gConnectorEle)&&this.gConnectorEle.length>0&&(r=this.gConnectorEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this))):(r=this.gSymbolGroupEle[i],ej.EjSvgRender.utils._drawAxesBoundsClipPath(r,n,this),this.svgRenderer.append(r,this.gSeriesEle),(n.tooltip.visible||u=="scatter")&&(tt=this.model.enableCanvasRendering?this.model.series[i].points:$(this.gSymbolGroupEle).children().not("defs"),this.vmlRendering?(this.cloneSeriesEle=$(this.gSeriesEle).clone(),this.cloneobj=$(this.element).clone(),this.svgclone=$(this.svgObject).clone(),$(document.body).append(this.cloneobj),this.svgRenderer.append(this.cloneSeriesEle,this.svgclone),this.svgRenderer.append(this.svgclone,this.cloneobj)):(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element)),this.vmlRendering&&($(this.cloneobj).remove(),$(this.svgclone).remove())))}this.drawDisplayText(e,n,t)},renderErrorBar:function(n,t){var s=this,yi=s.model,o=t,v,u,pi,rr,y,ur,fr,dr,vt=o._visiblePoints,wi=vt.length,pt=s.canvasX,wt=s.canvasY,dt=$.inArray(o,yi._visibleSeries),gr=null,ft,er=ej.EjSvgRender.utils._getTransform(o.xAxis,o.yAxis,yi.requireInvertedAxes),bt,kt,d=yi.requireInvertedAxes,or,sr,hr,cr,lr=s.svgObject.id,hi=s.model.m_AreaBounds,gr="translate("+er.x+","+er.y+")",ci,ar,p,vr,li,et,h,c,bi,yr,a,i,r,f,e,yt,pr,wr,ai,vi,ot,st,gt,ni,w,b,ki,di,br,kr,ti,ii,ri,ui,fi,ei,oi,si,rt,lt,k,ut,g,nt,gi,nr,l,tt,it,at,ht,ct,tr,ir;for(ar={id:lr+"_ErrorBarGroup_"+dt,transform:gr,"clip-path":"url(#"+lr+"_ChartAreaClipRect)"},ej.util.isNullOrUndefined(s.gErrorBarGroupEle)&&(s.gErrorBarGroupEle=[]),ci=s.gErrorBarGroupEle[dt]=s.svgRenderer.createGroup(ar),commonEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs),commonEventArgs.data={errorBar:n},this._trigger("errorBarRendering",commonEventArgs),p=commonEventArgs.data.errorBar,v=p.type,u=p.mode,pi=p.direction,rr=p.fill,y=p.cap,ur=p.cap.fill,fr=p.cap.width,dr=p.cap.length,bt=p.verticalErrorValue,kt=p.horizontalErrorValue,or=p.verticalPositiveErrorValue,sr=p.verticalNegativeErrorValue,hr=p.horizontalPositiveErrorValue,cr=p.horizontalNegativeErrorValue,ft=0;ft<wi;ft++)if(vt[ft].isEmpty==!1&&vt[ft].visible==!0){vr={id:s.svgObject.id+"_ErrorBarGroup_"+dt+"_Point"+ft};errorBarPointGroup=s.svgRenderer.createGroup(vr);li=ft;et=vt[ft];h=et.YValues[0];c=et.xValue;bi=vt[ft].YValues[0];yr=vt[ft].xValue;a=v.indexOf("column")||v.indexOf("bar")>-1?et.symbolLocation:et.location;ej.util.isNullOrUndefined(a)&&(a=ej.EjSvgRender.utils._getPoint(et,o));ot=a.X;st=a.Y;switch(v){case"fixedValue":g=et;(u=="vertical"||u=="both")&&(g.YValues[0]=h+bt,i=ej.EjSvgRender.utils._getPoint(g,o),g.YValues[0]=h-bt,r=ej.EjSvgRender.utils._getPoint(g,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(g.YValues[0]=h,g.xValue=c,g.xValue=c+kt,f=ej.EjSvgRender.utils._getPoint(g,o),g.xValue=c-kt,e=ej.EjSvgRender.utils._getPoint(g,o));g.YValues[0]=h;g.xValue=c;break;case"percentage":nt=et;gi=bt/100*h;nr=kt/100*c;(u=="vertical"||u=="both")&&(nt.YValues[0]=h+gi,i=ej.EjSvgRender.utils._getPoint(nt,o),nt.YValues[0]=h-gi,r=ej.EjSvgRender.utils._getPoint(nt,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(nt.YValues[0]=h,nt.xValue=c,nt.xValue=c+nr,f=ej.EjSvgRender.utils._getPoint(nt,o),nt.xValue=c-nr,e=ej.EjSvgRender.utils._getPoint(nt,o));nt.YValues[0]=h;nt.xValue=c;break;case"standardDeviation":l=et;yt=s.meanCalculation(u,vt);pr=yt.verMean;wr=yt.horMean;ai=yt.verStandSquareRoot;vi=yt.horStandSquareRoot;(u=="vertical"||u=="both")&&(gt=bt*ai,l.YValues[0]=pr,w=ej.EjSvgRender.utils._getPoint(l,o),h=l.YValues[0],l.YValues[0]=h+gt,i=ej.EjSvgRender.utils._getPoint(l,o),l.YValues[0]=h-gt,r=ej.EjSvgRender.utils._getPoint(l,o),d?w.Y=i.Y=r.Y=a.Y:w.X=i.X=r.X=a.X,w.X=w.X+pt,w.Y=w.Y+wt);(u=="horizontal"||u=="both")&&(ni=kt*vi,l.xValue=wr,b=ej.EjSvgRender.utils._getPoint(l,o),d?b.X=a.X:b.Y=a.Y,l.YValues[0]=bi,c=l.xValue,l.xValue=c+ni,f=ej.EjSvgRender.utils._getPoint(l,o),l.xValue=c-ni,e=ej.EjSvgRender.utils._getPoint(l,o),b.X=b.X+pt,b.Y=b.Y+wt);l.YValues[0]=bi;l.xValue=yr;break;case"standardError":tt=et;yt=s.meanCalculation(u,vt);ai=yt.verStandSquareRoot;vi=yt.horStandSquareRoot;(u=="vertical"||u=="both")&&(gt=bt*ai,ki=gt/Math.sqrt(wi),tt.YValues[0]=h+ki,i=ej.EjSvgRender.utils._getPoint(tt,o),tt.YValues[0]=h-ki,r=ej.EjSvgRender.utils._getPoint(tt,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(ni=kt*vi,di=ni/Math.sqrt(wi),tt.YValues[0]=h,tt.xValue=c,tt.xValue=c+di,f=ej.EjSvgRender.utils._getPoint(tt,o),tt.xValue=c-di,e=ej.EjSvgRender.utils._getPoint(tt,o));tt.YValues[0]=h;tt.xValue=c;ft=li;break;case"custom":it=et;(u=="vertical"||u=="both")&&(it.YValues[0]=h+or,i=ej.EjSvgRender.utils._getPoint(it,o),it.YValues[0]=h-sr,r=ej.EjSvgRender.utils._getPoint(it,o),d?i.Y=r.Y=a.Y:i.X=r.X=a.X);(u=="horizontal"||u=="both")&&(it.YValues[0]=h,it.xValue=c,it.xValue=c+hr,f=ej.EjSvgRender.utils._getPoint(it,o),it.xValue=c-cr,e=ej.EjSvgRender.utils._getPoint(it,o));it.YValues[0]=h;it.xValue=c}y.visible==!0&&((u=="vertical"||u=="both")&&(br={verHighvalue:i,verLowvalue:r}),(u=="horizontal"||u=="both")&&(kr={horHighvalue:f,horLowvalue:e}),at=s.renderCap(y,u,br,kr,d),ti=at.verHighCapX1,ii=at.verHighCapX2,ri=at.verLowCapX1,ui=at.verLowCapX2,fi=at.horHighCapY1,ei=at.horHighCapY2,oi=at.horLowCapY1,si=at.horLowCapY2);ot=ot+pt;st=st+wt;(u=="vertical"||u=="both")&&(i.X=i.X+pt,i.Y=i.Y+wt,r.X=r.X+pt,r.Y=r.Y+wt);(u=="horizontal"||u=="both")&&(f.X=f.X+pt,f.Y=f.Y+wt,e.X=e.X+pt,e.Y=e.Y+wt);pi=="both"?((u=="vertical"||u=="both")&&(v!="standardDeviation"?rt="M "+ot+" "+st+" L "+i.X+" "+i.Y+" M "+ot+" "+st+" L "+r.X+" "+r.Y+" ":v=="standardDeviation"&&(rt="M "+w.X+" "+w.Y+" L "+i.X+" "+i.Y+" M "+w.X+" "+w.Y+" L "+r.X+" "+r.Y+" "),lt=d?y.visible?"M "+i.X+" "+i.Y+" L "+i.X+" "+ti+" M "+i.X+" "+i.Y+" L "+i.X+" "+ii+" M "+r.X+" "+r.Y+" L "+r.X+" "+ri+" M "+r.X+" "+r.Y+" L "+r.X+" "+ui+" ":"":y.visible?"M "+i.X+" "+i.Y+" L "+ti+" "+i.Y+" M "+i.X+" "+i.Y+" L "+ii+" "+i.Y+" M "+r.X+" "+r.Y+" L "+ri+" "+r.Y+" M "+r.X+" "+r.Y+" L "+ui+" "+r.Y+" ":"",ht=rt,ct=lt),(u=="horizontal"||u=="both")&&(v!="standardDeviation"?k="M "+ot+" "+st+" L "+f.X+" "+f.Y+" M "+ot+" "+st+" L "+e.X+" "+e.Y+" ":v=="standardDeviation"&&(k="M "+b.X+" "+b.Y+" L "+f.X+" "+f.Y+" M "+b.X+" "+b.Y+" L "+e.X+" "+e.Y+" "),ut=d?y.visible?"M "+f.X+" "+f.Y+" L "+fi+" "+f.Y+" M "+f.X+" "+f.Y+" L "+ei+" "+f.Y+" M "+e.X+" "+e.Y+" L "+oi+" "+e.Y+" M "+e.X+" "+e.Y+" L "+si+" "+e.Y+" ":"":y.visible?"M "+f.X+" "+f.Y+" L "+f.X+" "+fi+" M "+f.X+" "+f.Y+" L "+f.X+" "+ei+" M "+e.X+" "+e.Y+" L "+e.X+" "+oi+" M "+e.X+" "+e.Y+" L "+e.X+" "+si+" ":"",ht=k,ct=ut),u=="both"&&(k+=rt,ut+=lt,ht=k,ct=ut)):pi=="plus"?((u=="vertical"||u=="both")&&(v!="standardDeviation"?rt="M "+ot+" "+st+" L "+i.X+" "+i.Y+" ":v=="standardDeviation"&&(rt="M "+w.X+" "+w.Y+" L "+i.X+" "+i.Y+" "),lt=d?y.visible?"M "+i.X+" "+i.Y+" L "+i.X+" "+ti+" M "+i.X+" "+i.Y+" L "+i.X+" "+ii+" ":"":y.visible?"M "+i.X+" "+i.Y+" L "+ti+" "+i.Y+" M "+i.X+" "+i.Y+" L "+ii+" "+i.Y+" ":"",ht=rt,ct=lt),(u=="horizontal"||u=="both")&&(v!="standardDeviation"?k="M "+ot+" "+st+" L "+f.X+" "+f.Y+" ":v=="standardDeviation"&&(k="M "+b.X+" "+b.Y+" L "+f.X+" "+f.Y+" "),ut=d?y.visible?"M "+f.X+" "+f.Y+" L "+fi+" "+f.Y+" M "+f.X+" "+f.Y+" L "+ei+" "+f.Y+" ":"":y.visible?"M "+f.X+" "+f.Y+" L "+f.X+" "+fi+" M "+f.X+" "+f.Y+" L "+f.X+" "+ei+" ":"",ht=k,ct=ut),u=="both"&&(k+=rt,ut+=lt,ht=k,ct=ut)):((u=="vertical"||u=="both")&&(v!="standardDeviation"?rt="M "+ot+" "+st+" L "+r.X+" "+r.Y+" ":v=="standardDeviation"&&(rt="M "+w.X+" "+w.Y+" L "+r.X+" "+r.Y+" "),lt=d?y.visible?"M "+r.X+" "+r.Y+" L "+r.X+" "+ri+" M "+r.X+" "+r.Y+" L "+r.X+" "+ui+" ":"":y.visible?"M "+r.X+" "+r.Y+" L "+ri+" "+r.Y+" M "+r.X+" "+r.Y+" L "+ui+" "+r.Y+" ":"",ht=rt,ct=lt),(u=="horizontal"||u=="both")&&(v!="standardDeviation"?k="M "+ot+" "+st+" L "+e.X+" "+e.Y+" ":v=="standardDeviation"&&(k="M "+b.X+" "+b.Y+" L "+e.X+" "+e.Y+" "),ut=d?y.visible?"M "+e.X+" "+e.Y+" L "+oi+" "+e.Y+" M "+e.X+" "+e.Y+" L "+si+" "+e.Y+" ":"":y.visible?"M "+e.X+" "+e.Y+" L "+e.X+" "+oi+" M "+e.X+" "+e.Y+" L "+e.X+" "+si+" ":"",ht=k,ct=ut),u=="both"&&(k+=rt,ut+=lt,ht=k,ct=ut));tr={id:s.svgObject.id+"_ErrorBar_"+dt+"_Point"+li,d:ht,stroke:rr,"stroke-width":n.width,opacity:n.opacity};ir={id:s.svgObject.id+"_ErrorBarCap_"+dt+"_Point"+li,d:ct,stroke:ur,"stroke-width":fr};s.model.enableCanvasRendering?(this.svgRenderer.ctx.rect(hi.X,hi.Y,hi.Width,hi.Height),this.svgRenderer.ctx.clip(),s.svgRenderer.drawPath(tr,null),s.svgRenderer.drawPath(ir,null)):(s.svgRenderer.drawPath(tr,errorBarPointGroup),s.svgRenderer.drawPath(ir,errorBarPointGroup),s.svgRenderer.append(errorBarPointGroup,ci))}s.svgRenderer.append(ci,s.gSeriesEle);ej.EjSvgRender.utils._drawAxesBoundsClipPath(ci,o,s)},meanCalculation:function(n,t){for(var r=temp1=0,f,a,v,e,o,l,s,h,c,y,p,w,b,k,d,g,nt,tt,u=t.length,i=0;i<u;i++)n=="vertical"?(f=r+t[i].y,r=f):n=="horizontal"?(f=temp1+t[i].xValue,temp1=f):(a=r+t[i].y,r=a,v=temp1+t[i].xValue,temp1=v);for(e=r/u,o=temp1/u,l=u-1,i=0;i<u;i++)n=="vertical"?(s=t[i].y-e,h=Math.pow(s,2),c=r+h,r=c):n=="horizontal"?(s=t[i].xValue-o,h=Math.pow(s,2),c=temp1+h,temp1=c):(y=t[i].y-e,w=Math.pow(y,2),b=r+w,r=b,p=t[i].xValue-o,horSquareEachDiv=Math.pow(p,2),k=temp1+horSquareEachDiv,temp1=k);return d=r/l,nt=Math.sqrt(d),g=temp1/l,tt=Math.sqrt(g),{verStandSquareRoot:nt,horStandSquareRoot:tt,verMean:e,horMean:o}},renderCap:function(n,t,i,r,u){var e,o,f,s,h,c,l,a,v,y,p,w,b,k,d;return e=this.canvasX,o=this.canvasY,f=n.length/2,(t=="vertical"||t=="both")&&(s=i.verHighvalue,h=i.verLowvalue),(t=="horizontal"||t=="both")&&(c=r.horHighvalue,l=r.horLowvalue),(t=="vertical"||t=="both")&&(u?(a=s.Y+o+f,v=s.Y+o-f,y=h.Y+o+f,p=h.Y+o-f):(a=s.X+e-f,v=s.X+e+f,y=h.X+e-f,p=h.X+e+f)),(t=="horizontal"||t=="both")&&(u?(w=c.X+e+f,b=c.X+e-f,k=l.X+e+f,d=l.X+e-f):(w=c.Y+o-f,b=c.Y+o+f,k=l.Y+o-f,d=l.Y+o+f)),{verHighCapX1:a,verHighCapX2:v,verLowCapX1:y,verLowCapX2:p,horHighCapY1:w,horHighCapY2:b,horLowCapY1:k,horLowCapY2:d}},drawDisplayText:function(n,t,i){var r=this,u,a=t.type.toLowerCase(),h=r.model.AreaType.toLowerCase(),c=ej.seriesTypes[a].prototype.isRegion,v=t.drawType.toLowerCase(),f,l=!1,o=$.inArray(t,r.model._visibleSeries),e,s;ej.util.isNullOrUndefined(r.model.regionCount)&&(r.model.regionCount=-1);e=r.model.enableCanvasRendering;s=r.model.AreaType.toLowerCase()=="polaraxes";$.each(t._visiblePoints,function(a,y){var p=r.model.series[o].type.toLowerCase(),b,w;if(t._visiblePoints[a].textOptionsBoxValues=[],f=y.marker,u=h=="polaraxes"&&v=="column"||c?p.toLowerCase()=="boxandwhisker"?y.dataLabelLocation:y.symbolLocation:h!="polaraxes"?ej.EjSvgRender.utils._getPoint(y,t):ej.EjSvgRender.utils.TransformToVisible(t,y.xValue,y.y,r),y.visible&&(f&&f.dataLabel&&f.dataLabel.visible||(!f||!f.dataLabel)&&t.marker.dataLabel.visible)){for(c&&r.model.regionCount++,p=r.model.series[o].type.toLowerCase(),b=0;b<r.model._axes.length;b++)if(r.model._axes[b].zoomFactor<1||r.model._axes[b].zoomPosition>0){l=!0;break}if((r.zoomed||t.xAxis._isScroll||l)&&(p=="column"||p=="stackingcolumn"||p=="stackingcolumn100"))for(b=0;b<r.model.chartRegions.length;b++)o==r.model.chartRegions[b].SeriesIndex&&a==r.model.chartRegions[b].Region.PointIndex&&(e&&r.model.AreaType=="cartesianaxes"?(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.model.requireInvertedAxes?r.svgRenderer.ctx.rect(t.yAxis.x,t.xAxis.y,t.yAxis.width,t.xAxis.height):r.svgRenderer.ctx.rect(t.xAxis.x,t.yAxis.y,t.xAxis.width,t.yAxis.height),r.svgRenderer.ctx.clip(),n.drawDataLabel(t,a,y,u.X,u.Y,b,i),r.svgRenderer.ctx.restore()):n.drawDataLabel(t,a,y,u.X,u.Y,b,i));else if(e&&r.model.AreaType=="cartesianaxes"){if(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.model.requireInvertedAxes?r.svgRenderer.ctx.rect(t.yAxis.x,t.xAxis.y,t.yAxis.width,t.xAxis.height):r.svgRenderer.ctx.rect(t.xAxis.x,t.yAxis.y,t.xAxis.width,t.yAxis.height),r.svgRenderer.ctx.clip(),r.model.chartRegions[r.model.regionCount]||p.indexOf("column")==-1&&p.indexOf("bar")==-1&&p.indexOf("waterfall")==-1){if(p.toLowerCase()=="boxandwhisker")for(w=0;w<u.length;w++)y.y=y.boxPlotLocation[w].YValues,n.drawDataLabel(t,a,y,u[w].X,u[w].Y,r.model.regionCount,i,u[w].outlier);else n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i);(p=="rangecolumn"||p=="rangearea")&&(y.y=y.low,n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i),y.y=y.high)}r.svgRenderer.ctx.restore()}else{if(e&&s&&(r.svgRenderer.ctx.save(),r.svgRenderer.ctx.beginPath(),r.svgRenderer.ctx.arc(r.model.centerX,r.model.centerY,r.model.Radius,0,2*Math.PI,!1),r.svgRenderer.ctx.clip(),u.X-=r.canvasX,u.Y-=r.canvasY),p=="column"||p=="stackingcolumn"||p=="stackingcolumn100")r.model.chartRegions[r.model.regionCount]&&n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i);else if(p.toLowerCase()=="boxandwhisker")for(w=0;w<u.length;w++)y.y=y.boxPlotLocation[w].YValues,n.drawDataLabel(t,a,y,u[w].X,u[w].Y,r.model.regionCount,i,u[w].outlier);else n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i);(p=="rangecolumn"||p=="rangearea")&&(y.y=y.low,n.drawDataLabel(t,a,y,u.X,u.Y,r.model.regionCount,i),y.y=y.high);e&&s&&r.svgRenderer.ctx.restore()}}})},cartesianSmartLabels:function(n,t){var b=t.length,k,d,r,o,v,p,w,l,a,i,y,g,c,u,f,e,s,h;for(connectorFlag=!1,this.processCount=1,this.posObj={top:[],rightTop:[],left:[],leftTop:[],right:[],rightTop:[],rightBottom:[],leftBottom:[],bottom:[]},o=0;o<this.model.series.length;o++)if(k=this.model.series[o].marker.size.width,d=this.model.series[o].marker.size.height,this.model.series[o].marker.visible)for(v=0;v<this.model.series[o]._visiblePoints.length;v++)i=this.model.series[o]._visiblePoints[v],p=i.location,this.model.markerRegion[this.model.markerRegion.length]={seriesIndex:o,xPos:p.X+this.canvasX,yPos:p.Y+this.canvasY,width:k,height:d};for(g=10,u=this.model.m_AreaBounds,y=0;y<b;y++)i=t[y],i.hide=!1,s=i.xPos,h=i.yPos,f=i.width,e=i.height,s-f/2<0&&s>-f/2&&(c=s-f/2,i.textOptions.x=i.xPos=s+Math.abs(c)+10,i.newConnectorFlag=!0),s+f/2>u.Width&&s+f/2<u.Width+f/2&&(c=s-f/2,i.textOptions.x=i.xPos=u.Width-f/2-10,i.newConnectorFlag=!0),h+f/2>u.Height&&h+e/2<u.Height+e/2&&(c=h+e/2-u.Height,i.yPos=h-c-10,i.textOptions.y=i.yPos+5,i.newConnectorFlag=!0),h-e/2<0&&h>-e/2&&(c=h-e/2,i.yPos=i.yPos+Math.abs(c)+10,i.textOptions.y=i.yPos+5,i.newConnectorFlag=!0);for(r=0;r<b;r++){if(ej.util.isNullOrUndefined(t[r].yPos))continue;else this.model.allPoints[this.model.allPoints.length]=t[r];connectorFlag=!1;this.compareDataLabels(r,t,0,this.processCount);i=t[r];i.connectorFlag=connectorFlag;t[r].dataLabeltemplate?(w=$("#"+t[r].id),l=t[r].xPos,a=this.model.enableCanvasRendering?t[r].yPos+this.model.m_AreaBounds.Y:t[r].yPos,w.css("left",l).css("top",a),this.model.AreaType=="cartesianaxes"&&(u=this.model.m_AreaBounds,xPosition=u.X+(this.model.requireInvertedAxes?n.yAxis.plotOffset:n.xAxis.plotOffset),yPosition=n.yAxis.y,f=t[r].width,e=t[r].height,(l>xPosition+u.Width||l+f<xPosition||a+e<yPosition||a+e>u.Y+u.Height||this.zoomed&&(l<xPosition||a<yPosition||l>xPosition+u.Width||a>yPosition+u.Height))&&w.remove())):this.storeDataLabelPositions(i)}},storeDataLabelPositions:function(n){var i=n.position,t=this.posObj;switch(i){case"top":t.top[this.processCount-1]=n;this.processCount=1;break;case"rightTop":t.rightTop[this.processCount-1]=n;this.processCount=1;break;case"right":t.right[this.processCount-1]=n;this.processCount=1;break;case"rightBottom":t.rightBottom[this.processCount-1]=n;this.processCount=1;break;case"bottom":t.bottom[this.processCount-1]=n;this.processCount=1;break;case"left":t.left[this.processCount-1]=n;this.processCount=1;break;case"leftBottom":t.leftBottom[this.processCount-1]=n;this.processCount=1;break;case"leftTop":t.leftTop[this.processCount-1]=n}},cartesianColumnSmartLabels:function(n,t){var u=t.length,i,f,r;for(connectorFlag=!1,this.processCount=1,i=0;i<u;i++){if(ej.util.isNullOrUndefined(t[i].yPos))continue;else this.model.allPoints[this.model.allPoints.length]=t[i];n._enableSmartLabels&&(connectorFlag=!1,this.compareColumnDataLabels(n,i,t,0,this.processCount));f=n._visiblePoints[i];t[i].dataLabeltemplate&&(r=$("#"+t[i].id),r.css("left",t[i].xPos).css("top",t[i].yPos))}},compareColumnDataLabels:function(n,t,i,r){for(var h=this.model.allPoints.length-1,f,u,e,o=n.type.toLowerCase(),s=0;s<h;s++)f=this.model.allPoints[s],u=this.model.allPoints[this.model.allPoints.length-1],this.currentCollideLabel=f,e=5,collide=this.isCollide(f,u),textPosition=n.marker.dataLabel.textPosition,collide.state&&(o=="column"||o=="stackingcolumn"||o=="rangecolumn"||o=="waterfall"?(u.textOptions.y=textPosition=="top"||textPosition=="middle"?u.yPos=u.yPos+collide.height+e:u.yPos=u.yPos-collide.height-e,u.textOptions.y=u.textOptions.y+e+u.margin.top/2-u.margin.bottom/2):u.textOptions.x=textPosition=="top"||textPosition=="middle"?u.xPos=f.xPos-f.width/2-u.width/2-e:u.xPos=f.xPos+f.width/2+u.width/2+e,this.compareColumnDataLabels(n,t,i,r,this.processCount))},compareDataLabels:function(n,t,i,r){for(var h=this.model.allPoints.length,f,e,u,o=this.posObj,s=0;s<h;s++)if(e=this.model.allPoints[s],u=this.model.allPoints[h-1],this.currentCollideLabel=e,f=10,collide=this.isCollide(e,u,s),collide.state||collide.marker){connectorFlag=!0;switch(i){case 0:this.processCount>1&&this.resetValues(u);collide.marker?(this.prevLabel=collide.markerRegion,this.processCount=1):ej.util.isNullOrUndefined(this.prevLabel)?(this.prevLabel=e,this.processCount=1):(checkCollide=this.isCollide(this.prevLabel,u),checkCollide.state||(this.prevLabel=e,this.processCount=1));this.resetValues(u);r>1&&o.right[this.processCount-2]?(e=o.right[this.processCount-2],u.textOptions.x=u.xPos=e.xPos+(e.width/2+u.width/2+f)):u.textOptions.x=u.xPos=this.prevLabel.xPos+(this.prevLabel.width/2+u.width/2+f);i+=1;u.position="right";this.compareDataLabels(n,t,i,this.processCount);break;case 1:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos+this.prevLabel.width/2+u.width/2+f;r>1&&o.rightBottom[this.processCount-2]?(e=o.rightBottom[this.processCount-2],u.textOptions.y=u.yPos=e.yPos+this.canvasY+e.height+f):u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="rightBottom";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 2:this.resetValues(u);u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;r>1&&o.bottom[this.processCount-2]?(e=o.bottom[this.processCount-2],u.textOptions.y=u.yPos=e.yPos+u.height+f):u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="bottom";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 3:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos-this.prevLabel.width/2-u.width/2-f;r>1&&o.leftBottom[this.processCount-2]?(e=o.leftBottom[this.processCount-2],u.textOptions.y=u.yPos=e.yPos+this.canvasY+e.height+f):u.textOptions.y=u.yPos=u.location.Y+this.canvasY+u.height+f/2;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="leftBottom";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 4:this.resetValues(u);r>1&&o.left[this.processCount-2]?(e=o.left[this.processCount-2],u.textOptions.x=u.xPos=e.xPos-e.width/2-u.width/2-f):u.textOptions.x=u.xPos=this.prevLabel.xPos-this.prevLabel.width/2-u.width/2-f;u.position="left";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 5:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos-this.prevLabel.width/2-u.width/2-f;r>1&&o.leftTop[this.processCount-2]?(e=o.leftTop[this.processCount-2],u.textOptions.y=u.yPos=e.yPos-(u.height+f)):u.textOptions.y=u.yPos=this.prevLabel.yPos-u.height-f;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="leftTop";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 6:this.resetValues(u);r>1&&o.top[r-2]?(e=o.top[r-2],u.textOptions.y=u.yPos=e.yPos-(u.height+f)):u.textOptions.y=u.yPos=this.prevLabel.yPos-this.processCount*(u.height+f);u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;i+=1;u.position="top";this.compareDataLabels(n,t,i,this.processCount);break;case 7:this.resetValues(u);u.textOptions.x=u.xPos=this.prevLabel.xPos+this.prevLabel.width/2+u.width/2+f;r>1&&o.rightTop[this.processCount-2]?(e=o.rightTop[this.processCount-2],u.textOptions.y=u.yPos=e.yPos-u.height-f):u.textOptions.y=u.yPos=this.prevLabel.yPos-u.height-f;u.textOptions.y=u.textOptions.y+f/2+u.margin.top/2-u.margin.bottom/2;u.position="rightTop";i+=1;this.compareDataLabels(n,t,i,this.processCount);break;case 8:i=0;this.processCount+=1;this.compareDataLabels(n,t,i,this.processCount)}}},drawPieofPieConnectors:function(n,t){var d=t.enableAnimation&&!t._animatedSeries?"hidden":"visible",i,s,r,k;this.model.enableCanvasRendering||(this.gConnectorLinesGroup?this.gConnectorLinesGroup.childNodes.length>0:this.gConnectorLinesGroup=this.svgRenderer.createGroup({id:this.svgObject.id+"_connectorLineGroup",visibility:d}),$(this.gConnectorLinesGroup.childNodes).remove());var f=[],e=[],h=[],u=[],c=-.5*Math.PI,v,o;for(i=0;i<2;i++){if(o=t.pieCollections[i],v=i==0?t.pieCoefficient:t.pieOfPieCoefficient,f[i]=.25*v*Math.min(n.width,n.height),e[i]=this.model.circleCenterX[i],e[i]=i==0?e[i]+this.model.pieGapWidth/2:e[i]-this.model.pieGapWidth/2,h[i]=this.model.circleCenterY[i],o[0].start>0&&o[0].end<Math.PI&&i==0)var y=o[0].start+c,p=o[0].end+c-1e-6,l=e[i]+f[i]*Math.cos(y),a=h[i]+f[i]*Math.sin(y),w=e[i]+f[i]*Math.cos(p),b=h[i]+f[i]*Math.sin(p);else l=e[i]+f[i]*Math.cos(c),a=h[i]+f[i]*Math.sin(c),w=l,b=a+f[i]*2;u.push({X1:l,Y1:a,X2:w,Y2:b})}for(s=t.connectorLine,r=0;r<2;r++)k={id:this.svgObject.id+"_connectorLine"+r,x1:r==0?u[r].X1:u[r-1].X2,y1:r==0?u[r].Y1:u[r-1].Y2,x2:r==0?u[r+1].X1:u[r].X2,y2:r==0?u[r+1].Y1:u[r].Y2,stroke:s.color,"stroke-width":s.width,opacity:s.opacity,"stroke-dasharray":s.dashArray},this.svgRenderer.drawLine(k,this.gConnectorLinesGroup);this.svgRenderer.append(this.gConnectorLinesGroup,this.gSeriesEle)},drawConnectorLines:function(n,t,i){var c=!1,e=!0,o=i.xPos,s=i.yPos,h=this.model.m_AreaBounds,u=i.location?i.location:i.symbolLocation,r;if(u.Y>i.textOptions.y?r=i.textOptions.y:(c=!0,r=i.textOptions.y-i.height/2),i.dataLabeltemplate?(r=i.yPos-this.model.m_AreaBounds.Y+i.height,i.textOptions.x=i.textOptions.x-this.model.m_AreaBounds.X+i.width/4+this.canvasX):(o>h.Width||o+i.width<0||s-i.height>h.Height||s+i.height<0)&&(e=!1),e){var l="M "+(u.X+this.canvasX)+" "+(u.Y+this.canvasY)+" L "+i.textOptions.x+" "+r,f=this.model.series[n].marker.dataLabel.connectorLine,a=ej.util.isNullOrUndefined(f.color)?this.model.series[n].fill:f.color,v={id:this.svgObject.id+"_dataLabelConnectorLine_series"+n+"_"+t,stroke:a,"stroke-width":f.width,d:l};this.model.series[n].connectorLines=!0;this.svgRenderer.drawPath(v,this.gConnectorEle[n])}},resetValues:function(n){n.textOptions.y=n.dataLabel.textY;n.yPos=n.dataLabel.y;n.textOptions.x=n.dataLabel.textX;n.xPos=n.dataLabel.x},isCollide:function(n,t){var h=0,c=0,r=!1,f=!1,l=n.seriesIndex?this.model.series[n.seriesIndex].marker.dataLabel.border.width:0,u;l+=t.seriesIndex?this.model.series[t.seriesIndex].marker.dataLabel.border.width:0;var e=this.model.series,i=e[n.seriesIndex],a=e[t.seriesIndex],o=n.xPos,s=n.yPos,v=t.xPos,y=t.yPos;if(n.xPos+=i.xAxis.x,n.yPos+=i.yAxis.y,t.xPos+=a.xAxis.x,t.yPos+=a.yAxis.y,n!=t&&(r=!(n.yPos+n.height<t.yPos||n.yPos>t.yPos+t.height||n.xPos+n.width/2+l<t.xPos-t.width/2||n.xPos-n.width/2>t.xPos+t.width/2),r&&(c=n.yPos+n.height-t.yPos,h=n.xPos+n.width-t.xPos),n.xPos=o,n.yPos=s),!r)for(u=0;u<this.model.markerRegion.length;u++)if(n=this.model.markerRegion[u],i=e[n.seriesIndex],o=n.xPos,s=n.yPos,n.xPos+=i.xAxis.x,t.yPos+=i.yAxis.y,f=!(n.yPos+n.height<t.yPos-t.height/2||n.yPos>t.yPos+t.height||n.xPos+n.width<t.xPos||n.xPos>t.xPos+t.width),f)break;return n.xPos=o,n.yPos=s,t.xPos=v,t.yPos=y,{state:r,marker:f,markerRegion:n,width:h,height:c}},drawAccDisplayText:function(n,t,i){var f=this,h=t._visiblePoints.length,e,o,u,r,s;if(f.firstStartAngle=[],type=t.type.toLowerCase(),type!="pyramid"&&type!="funnel"&&type!="pieofpie"&&(t.leftsidePoints.length>0||t.rightsidePoints.length>0)){for(e=t.rightsidePoints.length,o=t.leftsidePoints.length,r=0;r<e;r++)t.rightsidePoints[r].index=r,n.drawDataLabelAcc(f,t,t.rightsidePoints[r].pointIndex,t.rightsidePoints[r],i);for(u=o-1;u>=0;u--)t.leftsidePoints[u].index=u,n.drawDataLabelAcc(f,t,t.leftsidePoints[u].pointIndex,t.leftsidePoints[u],i)}else for(r=0;r<h;r++)(t._visiblePoints[r].index=r,s=type=="pieofpie"?t._visiblePoints[r].actualIndex:r,isNaN(t._visiblePoints[r].startAngle)&&t.type.toLowerCase()=="pie"&&t.type.toLowerCase=="pieofpie")||n.drawDataLabelAcc(f,t,s,t._visiblePoints[r],i,t.collectionIndex);(t.type.toLowerCase()=="pyramid"||t.type.toLowerCase()=="funnel")&&(this.svgRenderer.append(this.gConnectorEle,this.gSeriesEle),this.svgRenderer.append(this.gSymbolGroupEle,this.gSeriesEle),this.svgRenderer.append(this.gDataLabelEle,this.gSeriesEle),this.svgRenderer.append(this.gSeriesTextEle,this.gSeriesEle),this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.vmlRendering||this.svgRenderer.append(this.svgObject,this.element))},_processOData:function(n){var t=this,i=n.type.toLowerCase(),r=n.dataSource.executeQuery(n.query);r.done(function(r){var f,e,u,o;for(t._processJsonData(r.result,n),n.visibility="visible",$(t.svgObject).empty(),$(t.legendSvgContainer).empty(),t.model.enableCanvasRendering&&(t.svgRenderer.ctx.clearRect(0,0,t.svgObject.width,t.svgObject.height),$("#canvas_trackSymbol").remove()),f=!0,e=i!="pie"||i!="doughnut"?0:t.model.series.length-1,u=e;o=i!="pie"||i!="doughnut"?u<t.model.series.length:u>=0;i!="pie"||i!="doughnut"?u++:u--)if(t.model.series[u].dataSource&&t.model.series[u].visibility=="hidden"){f=!1;break}f&&t.draw()});r.fail(function(){var r,i;for(n.visibility="visible",$(t.svgObject).empty(),$(t.legendSvgContainer).empty(),r=!0,i=0;i<t.model.series.length;i++)if(t.model.series[i].dataSource&&t.model.series[i].visibility=="hidden"){r=!1;break}r&&t.draw()})},_processJsonData:function(n,t){var r,u,f,e,d,l,g,a,nt,v,tt,y,it,p,rt,b,o,ut,w,i;t.points.length>0&&(t.points.length=0);var k=[],at=t.dataSource,s=t.xName,c=t.yName,et=t.pointColorMappingName,ot=t.marker&&t.marker.dataLabel.textMappingName,ht=[],ct=[],ft=t.type.toLowerCase(),h=n.length,lt,st;for(r=0;r<h;r++)typeof n[r][s]=="string"&&n[r][s].indexOf("/Date(")!=-1?(n[r][s]=new Date(parseInt(n[r][s].substr(6))),k[r]=n[r][s]?n[r][s]:r):k[r]=n[r][s]!=null&&n[r][s]!=undefined?n[r][s]:null,ht[r]=n[r][et]!=null&&n[r][et]!=undefined?n[r][et]:null,ct[r]=n[r][ot]!=null&&n[r][ot]!=undefined?n[r][ot]:null;if(u=[],f=0,t._hiloTypes){for(e=[],d=t.high,l=0;l<h;l++)e[l]=n[l][d]===null||n[l][d]===undefined?n[l][d]:parseFloat(n[l][d]);for(u[f]=e,f=f+1,e=[],g=t.low,a=0;a<h;a++)e[a]=n[a][g]===null||n[a][g]===undefined?n[a][g]:parseFloat(n[a][g]);if(u[f]=e,f=f+1,t.type.toLowerCase()!=="hilo"){for(e=[],nt=t.open,v=0;v<h;v++)e[v]=n[v][nt]===null||n[v][nt]===undefined?n[v][nt]:parseFloat(n[v][nt]);for(u[f]=e,f=f+1,e=[],tt=t.close,y=0;y<h;y++)e[y]=n[y][tt]===null||n[y][tt]===undefined?n[y][tt]:parseFloat(n[y][tt]);if(u[f]=e,f=f+1,t.volume){for(e=[],it=t.volume,p=0;p<h;p++)e[p]=n[p][it]===null||n[p][it]===undefined?n[p][it]:parseFloat(n[p][it]);u[f]=e}}}if(c){if(rt=[],t.type=="boxandwhisker")for(o=0;o<h;o++)for(rt[o]=[],b=0;b<n[o][c].length;b++)rt[o][b]=n[o][c][b]?parseFloat(n[o][c][b]):n[o][c][b];else for(o=0;o<h;o++)rt[o]=n[o][c]?parseFloat(n[o][c]):n[o][c];if(u[f]=rt,f=f+1,t.type.toLowerCase()=="bubble"){for(e=[],ut=t.size,w=0;w<h;w++)e[w]=n[w][ut]===null||n[w][ut]===undefined?n[w][ut]:parseFloat(n[w][ut]);u[f]=e}}for(lt=k.length,st=u.length,i=0;i<lt;i++)t.points[i]={x:k[i],xValue:k[i],y:u[0][i],YValues:[],_visibility:i==this.model._hiddenPointIndex[i]?"hidden":null,visible:!0,fill:ht[i],text:ct[i]},ft=="bubble"?(t.points[i].YValues[0]=u[0][i],t.points[i].size=t.points[i].YValues[1]=u[1][i]):t._hiloTypes&&st>1?(t.points[i].high=t.points[i].YValues[0]=u[0][i],t.points[i].low=t.points[i].YValues[1]=u[1][i],ft!="hilo"&&ft!="rangecolumn"&&ft!="waterfall"&&st>3&&(t.points[i].open=t.points[i].YValues[2]=u[2][i],t.points[i].close=t.points[i].YValues[3]=u[3][i],t.volume&&(t.points[i].volume=t.points[i].YValues[4]=u[4][i]))):t.points[i].YValues[0]=u[0][i]},bindTo:function(n){var o,f,r,e,u,i,t;for($("#"+this.svgObject.id+"_CrosshairVertical").remove(),$("#"+this.svgObject.id+"_CrosshairHorizontal").remove(),$.finish?($(".ejTooltip"+this._id).finish(),$(".tooltipDiv"+this._id).finish()):($(".ejTooltip"+this._id).stop(!0,!0),$(".tooltipDiv"+this._id).stop(!0,!0)),$(document).find('[id*="_TrackToolTip"]').remove(),$("#template_group_"+this._id).remove(),this.element[0].id||this._createChartId(),this.model.primaryXAxis._valueType=null,this.model.primaryXAxis.position=null,this.model.primaryYAxis._valueType=null,this.model.primaryYAxis.position=null,this.model.requireInvertedAxes=!1,this.model._hiddenPointIndex=[],o=this.model.series.length,f=this.model.axes.length,t=0;t<f;t++)r=this.model.axes[t],r._valueType=null,r.position=null;if(this.model._axes)for(f=this.model._axes.length,e=0;e<f;e++)r=this.model._axes[e],r._valueType=null,r.position=null,r.zoomFactor=r._pointsLength&&r._pointsLength!=r.scrollbarSettings.pointsLength?1:r.zoomFactor;for(t=0;t<o;t++)i=this.model.series[t],i.position=null,i.fill&&this.model.seriesColors&&i.fill!=this.model.seriesColors[t]&&(this.model.series[t].isFill=!0);if(this.model.AreaType&&this.model.AreaType=="none")for(i=this.model.series[0],t=0;i.points&&t<i.points.length;t++)u=i.points[t],u._visibility=u._visibility?u._visibility:null,u._visibility=="hidden"&&this.model.AreaType=="none"&&this.model.series.length==1&&(this.model._hiddenPointIndex[t]=t),u.fill&&this.model.pointColors&&u.fill!=this.model.pointColors[t]&&(u.isFill=!0),u.isFill||(u.fill=null);if(this.model.enable3D&&(ej.Ej3DRender.transform=null),this.model.series){if(i=this.model.series,this.setModelProperties(n),!n)for(t=0;t<i.length;t++)(i[t].visibility==null||i[t].visibility==undefined)&&(i[t].visibility="visible"),i[t].type&&(i[t]._hiloTypes=ej.seriesTypes[i[t].type.toLowerCase()].prototype.hiloTypes),i[t].points||(i[t].points=[]),i[t].dataSource&&(i[t].dataSource instanceof ej.DataManager?(i[t].visibility="hidden",!ej.isNullOrUndefined(i[t].query)&&i[t].query instanceof ej.Query||(i[t].query=ej.Query()),this._processOData(i[t])):i[t].dataSource.length>0&&this._processJsonData(i[t].dataSource,i[t]));$(this.svgObject).width()>0&&this.draw(n)}},_createChartId:function(){var i=!1,n=0,t=$(this.element)[0].className.split(" ")[0];do $("#"+t+"_"+n).length||($(this).attr("_id",t+"_"+n),$(this.element).attr("id",t+"_"+n),i=!0),n++;while(!i)},calculateHeight:function(n){var i=$(n.svgObject),r=n.model.size.height,u=$(n.element).height(),t=u/100*parseInt(r);return i.height(t),t},calculateWidth:function(n){var i=$(n.svgObject),r=n.model.size.width,u=$(n.element).width(),t=u/100*parseInt(r);return i.width(t),t},selectedStyle:function(n){for(var r=$("#"+n._id).find('[class*="Selection"]'),i=[],t=0;t<r.length;t++)i[t]=[],i[t].id=r[t].id,i[t].className=$("#"+i[t].id).attr("class");return $("[id $= Def ]").length>0&&(i.pattern=$("[id $= Def ]")),i},chartResize:function(){var n=this,i=$(n.svgObject),t=this.selectedStyle(n),r,u,f;this.removeMultiRect();this._chartResize=!0;this.model.enableCanvasRendering&&($("[id*="+this._id+"_Selection_]").remove(),$("#canvas_trackSymbol").remove(),r=n.svgObject.getContext("2d"),r.clearRect(0,0,this.svgRenderer.svgObj.width,this.svgRenderer.svgObj.height),typeof n.model.size.width=="string"&&n.model.size.width.indexOf("%")!=-1?(u=n.calculateWidth(n),this.svgRenderer.svgObj.width=u):this.svgRenderer.svgObj.width=$("#"+this._id).width(),typeof n.model.size.height=="string"&&n.model.size.height.indexOf("%")!=-1?(f=n.calculateHeight(n),this.svgRenderer.svgObj.height=f):this.svgRenderer.svgObj.height=ej.util.isNullOrUndefined(this.model.size.height)?"450":parseInt($(n.element).height()));this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){var u,r;if(!ej.util.isNullOrUndefined(n.model)&&(typeof n.model.size.width=="string"&&n.model.size.width.indexOf("%")!=-1?n.calculateWidth(n):i.width($(n.element).width()),typeof n.model.size.height=="string"&&n.model.size.height.indexOf("%")!=-1?n.calculateHeight(n):i.height($(n.element).height()),$(n.svgObject).width()>0)){for($(n.svgObject).empty(),$(n.legendSvgContainer).empty(),$("#template_group_"+n._id).remove(),$("#annotation_group_"+n._id).remove(),n.disableAnimation(),u=0;u<n.model.series.length;u++)n.model.series[u].regionAdded=!1;for(n.draw(),r=0;r<t.length;r++)$("#"+t[r].id).attr("class",t[r].className);t.pattern&&n.svgRenderer.append(t.pattern,n.svgObject);n.zoomed&&!n.vmlRendering&&n._enableZoomingButtons();n.enableAnimation()}},500)},isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},isWindows:function(){if(!ej.getBooleanVal($("head"),"data-ej-android")&&!ej.getBooleanVal($("head"),"data-ej-ios")&&!ej.getBooleanVal($("head"),"data-ej-ios7")&&!ej.getBooleanVal($("head"),"data-ej-flat"))return this._windows()},_windows:function(){return/trident|windows phone/i.test(navigator.userAgent.toLowerCase())||ej.getBooleanVal($("head"),"data-ej-windows",!1)===!0},bindResizeEvents:function(){if(this.model._resizeEventRegistered)return 0;ej.isTouchDevice()&&this._isOrientationSupported()?this._on($(window),"orientationchange",this.chartResize):this._on($(window),"resize",this.chartResize);this.model._resizeEventRegistered=!0},removeResizeEvents:function(){this.model._resizeEventRegistered&&(ej.isTouchDevice()&&this._isOrientationSupported()?this._off($(window),"orientationchange",this.chartResize):this._off($(window),"resize",this.chartResize),this.model._resizeEventRegistered=!1)},_isOrientationSupported:function(){return"orientation"in window&&"onorientationchange"in window},_calculatePinchZoomPosition:function(n){var i=this.model.m_AreaBounds,f,l=this.model._axes,t,a=n.originalEvent.touches?n.originalEvent.touches[0]:n.originalEvent,r=a.pageX,u=a.pageY,e=this.previousPanTouch,o,s,h,c=0,v=l.length;if(r>i.X&&r<i.X+i.Width&&u>i.Y&&u<i.Y+i.Height){if(e||(e=this.previousPanTouch={pageX:r,pageY:u}),ej.isTouchDevice()||this.model.zooming.enableDeferredZoom)return this.oPreviousCoords={x:this.previousPanTouch.pageX,y:this.previousPanTouch.pageY},this.chartMouseMove(n);for(;c<v;c++)t=l[c],s=t.orientation.toLowerCase()=="horizontal",h=s?(e.pageX-r)/t.width*t.zoomFactor:(e.pageY-u)/t.height*t.zoomFactor,f=t.zoomPosition,t.zoomPosition=this._ensureValueInMinMax(s?f+h:f-h,0,1-t.zoomFactor),o=o||f!=t.zoomPosition;this.previousPanTouch={pageX:r,pageY:u};o&&!this.chartUpdating&&(this.redraw(!0,o,n.target),this._enableZoomingButtons())}},_calculateTouchDistance:function(n,t){for(var r=[],i=0,u=t.length;i<u;i++)n[i]==null&&(n[i]=t[i]),r[i]={},i>0&&(r[i].scaleX=n[0].pageX!=n[1].pageX&&(t[0].pageX-t[1].pageX)/(n[0].pageX-n[1].pageX),r[i].scaleY=n[0].pageY!=n[1].pageY&&(t[0].pageY-t[1].pageY)/(n[0].pageY-n[1].pageY),r[i].center={x:(n[0].pageX+t[0].pageX)/2,y:(n[1].pageY+t[1].pageY)/2});return r},_ensureValueInMinMax:function(n,t,i){return n<t?t:n>i?i:n},_calculatePinchZoomFactor:function(n,t,i){var v=this.model,e=v._axes,u=!0,o,s,y,p,h,r,c,w,b=v.m_AreaBounds,l,a=1e4,f=0,k=e.length;if(t=t=="x"?"horizontal":t=="y"?"vertical":null,this.previousScale!=null){for(;f<k;f++)if(!t||e[f].orientation===t){if(r=e[f],s=r.orientation=="horizontal"?n[1].scaleX:n[1].scaleY,!s)break;l=r.orientation=="horizontal"?this.previousScale[1].scaleX:this.previousScale[1].scaleY;c=r.zoomFactor;w=r.zoomPosition;h=this._ensureValueInMinMax(1/r.zoomFactor,1,a);p=this._ensureValueInMinMax(h+h*(s-l)/l,1,a);y=r.orientation=="horizontal"?n[1].center.x/b.Width:1-n[1].center.y/b.Height;r.zoomFactor=this._ensureValueInMinMax(1/p,1/a,1);r.zoomPosition=this._ensureValueInMinMax(w+(c-r.zoomFactor)*y,0,1-r.zoomFactor);o=o||c!=r.zoomFactor;u=u&&r.zoomFactor==1}!o||u||this.chartUpdating?u&&this.zoomed&&!this.chartUpdating&&(this.redraw(!0,!0,i),this.zoomed=!1,this._removeZoomkit()):(this.zoomed=!0,this.redraw(!0,!0,i),this._enableZoomingButtons())}this.previousScale=n},_addTouchPointer:function(n,t,i,r){for(r=n.length;r--;)if(t.pointerId==n[r].pointerId)return i&&(n[r]=t),0;n.push(t)},_removeTouchPointer:function(n,t,i){for(i=n&&n.length;i--;)if(t.pointerId==n[i].pointerId)return n.splice(i,1),0},_copyTouches:function(n){for(var i=[],t=0,r=n.length;t<r;t++)i[t]={pageX:n[t].pageX,pageY:n[t].pageY};return i},_initEventParams:function(){return{touches:[],movements:[]}},_pointerPinchStart:function(n){var t=n.originalEvent,i,u=this.model,r=u.m_AreaBounds,s=$(this.element).offset(),f=this.eventParams||(this.eventParams=this._initEventParams()),e=(t.pageX||t.changedTouches[0].pageX)-s.left,o=(t.pageY||t.changedTouches[0].pageY)-s.top;this.model.selectionEnable&&(this.cancelEvent(n),t.preventDefault());!u.enable3D&&u.AreaType=="cartesianaxes"&&t.pointerType!="mouse"&&t.pointerType!=4&&u.zooming.enable&&u.zooming.enablePinching&&(t.touches||t.pointerId)?(i=n.target.id,i.indexOf("ResetZoom")!=-1?this.resetZoom(n):i.indexOf("panIcon")!=-1?this.startPan(n):i.indexOf("ZoomIcon")!=-1?this.startZoom(n):i.indexOf("ZoomOut")!=-1||i.indexOf("ZoomIn")!=-1?this.startZoomInOut(n):e>r.X&&e<r.X+r.Width&&o>r.Y&&o<r.Y+r.Height?(t.touches?f.touches=this._copyTouches(t.touches):this._addTouchPointer(f.touches,{pageX:e,pageY:o,pointerId:t.pointerId}),f.touches.length<2&&this.chartMouseDown(n)):this.chartMouseDown(n)):this.chartMouseDown(n)},_removeInteractions:function(){$("[id*=_TrackSymbol]").remove();this._removeTrackBall();this._removeHighlight();$("#"+this.svgObject.id+"_TrackToolTip").hide();$("#"+this._id+"_tooltip").remove()},_pinchGestureMove:function(n){var r=n.originalEvent.changedTouches[0],u=n.originalEvent.touches,t=this.model,f=$(this.element).offset(),i=t.m_AreaBounds,e=r.pageX-f.left,o=r.pageY-f.top;this.eventParams=this.eventParams||this._initEventParams(t,r);!t.enable3D&&t.AreaType=="cartesianaxes"&&r.pointerType!="mouse"&&r.pointerType!=4&&t.zooming.enable&&t.zooming.enablePinching&&u?e>i.X&&e<i.X+i.Width&&o>i.Y&&o<i.Y+i.Height?(this._removeInteractions(),u.length>1?this._calculatePinchZoomFactor(this._calculateTouchDistance(this.eventParams.touches,u),t.zooming.type,n.target):this.doPan||this.panning?this._calculatePinchZoomPosition(n):this.chartMouseMove(n)):this.chartMouseMove(n):this.chartMouseMove(n)},_pointerPinchMove:function(n){var u,h=0,i=n.originalEvent,c=$(this.element).offset(),e=i.pageX-c.left,o=i.pageY-c.top,f=this.model,l=this.eventParams||this._initEventParams(f,i),t=l.touches,s=this.previousPointerMove,a=t.length,r=l.movements;if(s!=null&&s.pageX==i.pagex&&s.pageY==i.pageY&&s.pointerId==n.pointerId)return!1;if(!f.enable3D&&f.AreaType=="cartesianaxes"&&i.pointerType!="mouse"&&i.pointerType!=4&&f.zooming.enable&&f.zooming.enablePinching){if(u=f.m_AreaBounds,e>u.X&&e<u.X+u.Width&&o>u.Y&&o<u.Y+u.Height)if(this._addTouchPointer(t,{pageX:e,pageY:o,pointerId:i.pointerId}),t&&t.length>1){for(;h<a;h++)this._addTouchPointer(r,t[h],!1);this._addTouchPointer(r,{pageX:e,pageY:o,pointerId:i.pointerId},!0);r[0].pageX==t[0].pageX&&r[1].pageX==t[1].pageX&&r[0].pageY==t[0].pageY&&r[1].pageY==r[1].pageY||this._calculatePinchZoomFactor(this._calculateTouchDistance(t,r),this.model.zooming.type,n.target)}else this.doPan||this.panning?this._calculatePinchZoomPosition(n):this.chartMouseMove(n);else t.length>0&&this._removeTouchPointer(t,n),r.length>0&&this._removeTouchPointer(r,n),this.chartMouseMove(n);this.previousPointerMove={pageX:e,pageY:o,pointerId:i.pointerId}}else this.chartMouseMove(n)},_pointerPinchEnd:function(n){var i=this.model,t=n.originalEvent,r=this.eventParams||(this.eventParams=this._initEventParams(i,t)),u=t.type.indexOf("leave")!=-1||t.type.indexOf("out")!=-1||t.type.indexOf("Out")!=-1;!i.enable3D&&i.AreaType=="cartesianaxes"&&t.pointerType!="mouse"&&t.pointerType!=4&&i.zooming.enable&&i.zooming.enablePinching&&(t.touches||t.pointerId)?(this.continuePinching!=null&&this.svgObject.removeChild(this.svgObject.firstChild),this.continuePinching=this.previousPanTouch=this.previousScale=null,t.touches?(this.eventParams=null,this.chartMouseUp(n),u&&this.chartMouseLeave(n)):(this._removeTouchPointer(r.touches,{pointerId:t.pointerId}),r.movements.length>0&&this._removeTouchPointer(r.movements,{pointerId:t.pointerId}),r.touches.length==0&&(this.chartMouseUp(n),u&&this.chartMouseLeave(n),this.eventParams=null))):(this.chartMouseUp(n),u&&this.chartMouseLeave(n))},_appendStyle:function(n){var i="#"+n+".e-canvas * {touch-action:none; -ms-touch-action:none}",r=document.head||document.body,t=document.createElement("style");t.type="text/css";t.appendChild(document.createTextNode(i));r.appendChild(t)},bindEvents:function(){var f=jQuery.uaMatch(navigator.userAgent),i=ej.EjSvgRender.utils.browserInfo(),t=i.isMSPointerEnabled,n=i.pointerEnabled,e=t?n?"pointerdown":"MSPointerDown":"touchstart mousedown",o=t?n?"pointerup":"MSPointerUp":"touchend mouseup",s=t?n?"pointermove":"MSPointerMove":"touchmove mousemove",h=t?n?"pointerleave":"MSPointerOut":"touchleave mouseleave",r,u;this.model.browserInfo=i;window.navigator.maxTouchPoints>1&&window.PointerEvent||window.PointerEventsPolyfill?(this._on(this.element,"pointerup pointerleave",this._pointerPinchEnd),this._on(this.element,"pointerdown",this._pointerPinchStart),this._on(this.element,"pointermove",this._pointerPinchMove),this._appendStyle(this.element[0].id)):window.TouchEvent?(this._on(this.element,"touchstart",this._pointerPinchStart),this._on(this.element,"touchmove",this._pinchGestureMove),this._on(this.element,"touchend",this._pointerPinchEnd),this._on($(this.element),"mousedown",this.chartMouseDown),this._on($(this.element),"mousemove",this.chartMouseMove),this._on(this.element,"mouseleave",this.chartMouseLeave),this._on($(document),"mouseup",this.chartMouseUp),this._appendStyle(this.element[0].id)):window.navigator.msMaxTouchPoints&&window.navigator.msPointerEnabled?(this._on(this.element,"MSPointerUp",this._pointerPinchEnd),this._on(this.element,"mouseleave",this.chartMouseLeave),this._on(this.element,"MSPointerDown",this._pointerPinchStart),this._on(this.element,"MSPointerMove",this._pointerPinchMove),this._appendStyle(this.element[0].id)):(this._on(this.element,s,this.chartMouseMove),this._on(this.element,h,this.chartMouseLeave),this._on($(document),o,this.chartMouseUp),this._on($(this.element),e,this.chartMouseDown));this._on($(this.element),"click",this.chartMouseClick);this._on($(this.element),"contextmenu",this.chartRightClick);this._on($(this.element),"dblclick",this.chartMouseDoubleClick);(this.model.canResize||this.model.isResponsive)&&this.bindResizeEvents();r=this.model.zooming.enable||this.model.commonSeriesOptions.dragSettings.enable?"none":"pan-y";$(this.element).css({"ms-touch-action":r,"touch-action":r,"content-zooming":"none"});$(this.element).css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"});u=f.browser.toLowerCase()=="mozilla"?n?"mousewheel":"DOMMouseScroll":"mousewheel";this._on(this.element,u,this.chartMouseWheel)},calZoomFactors:function(n,t,i,r){var u,f;return n==1?(u=1,f=0):(u=ej.EjSvgRender.utils._minMax(1/n,0,1),f=r+(i-u)*t),{zoomMFactor:u,zoomMPosition:f}},doMouseWheelZoom:function(n,t,i){if(n>=1){var r=this.calZoomFactors(n,t,i.zoomFactor,i.zoomPosition);if(i.zoomPosition!=r.zoomMPosition||i.zoomFactor!=r.zoomMFactor)return this.zoomed=!0,i.zoomPosition=r.zoomMPosition,i.zoomFactor=r.zoomMPosition+r.zoomMFactor>1?1-r.zoomMPosition:r.zoomMFactor,!0}return!1},enableAnimation:function(){for(var t,n=0;n<this.model.series.length;n++)t=this.model.series[n],t.enableAnimation=this.serAnimation[n]},disableAnimation:function(){for(var t,n=this,i=0;i<n.model.series.length;i++)n.model.series[i].enableAnimation=!1;for(t=0;t<n.model.indicators.length;t++)n.model.indicators[t].enableAnimation=!1},_removeTrackBall:function(){var t="#"+this.svgObject.id,n;$("#"+this.svgObject.id+"_trackSymbol").remove();$(document).find("#measureTex").remove();this.chartCross.visible&&(n=$(this.svgObject).find(t+"_AxisCrossToolTip"),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),n=$(this.svgObject).find(t+"_CrosshairVertical"),this.svgRenderer._setAttr($(n),{d:"M 0 0"}),n=$(this.svgObject).find(t+"_CrosshairHorizontal"),this.svgRenderer._setAttr($(n),{d:"M 0 0"}),n=$(this.svgObject).find(t+"_TrackAxisToolTip"),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),n=$(this.svgObject).find(t+"_Tracker"),this.svgRenderer._setAttr($(n),{d:"M 0 0"}),n=$(this.svgObject).find('[id*="_TrackToolTip"]'),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),n=$(this.svgObject).find('[id*="_TrackToolTip"]').children(),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),$(n).css("visibility","hidden"),n=$(this.svgObject).find('[id*="_trackSymbol_"]'),this.svgRenderer._setAttr($(n),{visibility:"hidden"}),$(document).find('[id*="_TrackToolTipTemplate_"]').attr("visibility","hidden"),$(document).find('[id*="_TrackToolTipTemplate_"]').css("display","none"),$(t+"_CrosshairVertical").css("display","none"),$(t+"_CrosshairHorizontal").css("display","none"),$("#"+this._id).find('[id*="canvas_AxisToolTipRect"]').css("visibility","hidden"),$("#"+this._id).find('[id*="canvas_Tracker"]').remove(),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden"),$("#"+this._id).find('[id*="_gTooltip_"]').remove(),$("#secondCanvas").remove(),$("#"+this._id).find('[id*="_trackball_grouping_tooltip"]').remove())},enableTrackBall:function(){this.model.crosshair.visible=this.chartCross.visible;this.model.crosshair.type=this.chartCross.mArea},disableTrackBall:function(){this.model.crosshair.visible=!1;this._removeTrackBall()},_enableZoomingButtons:function(){var n=this.svgObject.id,u,t,f,r,i;if(this.model.AreaType!="cartesianaxes"&&($("#"+n+"_ResetZoom").remove(),$("#"+n+"_PanBtn").remove(),$("#"+n+"_ZoomBtn").remove(),$("#"+n+"_ZoomInBtn").remove(),$("#"+n+"_ZoomOutBtn").remove()),this.model.AreaType=="cartesianaxes")for(this._removeZoomkit(),u=this.model.zooming.toolbarItems,t=u.length,i=t-1;i>=0;i--){f=u[i];r=t-i;switch(f){case"reset":this.resetZoomButton(r);break;case"pan":this.panButton(r);break;case"zoom":case"zoomIn":case"zoomOut":this.zoomButton(r,f);break;default:t=t-1}}},chartMouseWheel:function(n){var t,o,u,i,h,c,e;if($("#"+this.svgObject.id+"_TrackToolTip").hide(),this.model.zooming.enableMouseWheel&&this.model.AreaType=="cartesianaxes"&&!this.model.enable3D&&!this.vmlRendering&&ej.util.isNullOrUndefined(this.model.isLazyZooming)){t=this;this.zoomed=!1;var f=!1,r="#"+t.svgObject.id,e=jQuery.uaMatch(navigator.userAgent),l=!!navigator.userAgent.match(/Trident\/7\./),s=n.originalEvent.wheelDelta,a=e.browser.toLowerCase()=="mozilla"?l?s/120>0?1:-1:-n.originalEvent.detail/3>0?1:-1:s/120>0?1:-1;for(u=0;u<this.model._axes.length;u++)i=this.model._axes[u],(i.orientation.toLowerCase()=="vertical"&&(t.model.zooming.type.toLowerCase()=="y"||t.model.zooming.type.trim().toLowerCase()=="x,y")||i.orientation.toLowerCase()=="horizontal"&&(t.model.zooming.type.toLowerCase()=="x"||t.model.zooming.type.trim().toLowerCase()=="x,y"))&&(h=Math.max(1/ej.EjSvgRender.utils._minMax(i.zoomFactor,0,1),1),c=Math.max(h+.25*a,1),f=f|t.doMouseWheelZoom(c,.5,i)),i.zoomFactor!=1&&i.zoomPosition!=0&&(o=!0);this._updateScroll();this.disableAnimation();this.disableTrackBall();f&&(this.model.legendCollapsed=!1,this.zoomed=!0,t.redraw(!0));this.model._chartAreaZoom=!0;this._enableZoomingButtons();this.mouseWheelCoords={x:n.originalEvent.pageX,y:n.originalEvent.pageY};o||($(r+"_ResetZoom").remove(),$(r+"_PanBtn").remove(),$(r+"_ZoomBtn").remove(),$(r+"_ZoomInBtn").remove(),$(r+"_ZoomOutBtn").remove(),this.enableAnimation(),this.panning=!1);e=jQuery.uaMatch(navigator.userAgent);n.preventDefault&&e.browser=="chrome"&&this.model.zooming.enable&&n.preventDefault();n.returnValue=!1}$(".tooltipDiv"+this._id).remove()},getAxisMultiLevelLabelsData:function(n){var f=this.calMousePosition(n),s=this.model.multiLevelLabelRegions.length,t,r,u,e,o,i;for(this.mousemoveX=f.X,this.mousemoveY=f.Y,i=0;i<s;i++)if(t=this.model.multiLevelLabelRegions[i],r=t.bounds.x,u=t.bounds.y,e=t.bounds.height,o=t.bounds.width,this.mousemoveX>=r&&this.mousemoveX<=r+o&&this.mousemoveY<=u+e&&this.mousemoveY>=u)return data={location:{x:this.mousemoveX,y:this.mousemoveY},axis:this.model._axes[t.axisIndex],multiLevelLabel:t.multiLevelLabel}},getAxisLabelData:function(n){var c=this.calMousePosition(n),e=n.target.id,r,u,f,s,h,o,l,a=this.model._axes.length,t,i;if(this.mousemoveX=c.X,this.mousemoveY=c.Y,this.model.AreaType=="cartesianaxes"||this.model.AreaType=="polaraxes")if(this.model.enable3D){if(e.indexOf("horizontal")>=0||e.indexOf("vertical")>=0)for(t=0;t<a;t++)for(o=this.model._axes[t].visibleLabels.length,i=0;i<o;i++)if(e==this.svgObject.id+this.model._axes[t].orientation+i)return{location:{x:this.mousemoveX,y:this.mousemoveY},index:i,axis:this.model._axes[t],text:this.model._axes[t].visibleLabels[i].Text}}else for(t=0;t<a;t++)if(o=this.model._axes[t].visibleLabels.length,l=this.model._axes[t].visible,l)for(i=0;i<o;i++)if(r=this.model._axes[t].visibleLabels[i].region,!ej.util.isNullOrUndefined(r)&&(u=r.bounds.x,f=r.bounds.y,s=r.bounds.width,h=r.bounds.height,u=this.vmlRendering&&e.indexOf("_YLabel_")>=0?this.model._axes[t].opposedPosition?u:u+s:u,this.mousemoveX>=u&&this.mousemoveX<=u+s&&(this.vmlRendering?this.mousemoveY<=f+h&&this.mousemoveY>=f:this.mousemoveY>=f-h&&this.mousemoveY<=f)))return{location:{x:this.mousemoveX,y:this.mousemoveY},index:i,axis:this.model._axes[t],text:r.labelText}},getLegendData:function(n){var t=this.calMousePosition(n);t.X-=parseFloat($(this.element).css("padding-left"));t.Y-=parseFloat($(this.element).css("padding-top"));var u=this.model.legend._ejScroller,f=u?$("#legend_"+this._id).ejScroller("instance").model.scrollTop:$("#legend_"+this._id).scrollTop(),e=u?$("#legend_"+this._id).ejScroller("instance").model.scrollLeft:$("#legend_"+this._id).scrollLeft();this.scrolltop=f;this.scrollleft=e;this.mousemoveX=t.X+e;this.mousemoveY=t.Y+f;var o=n.target.id,s=this.mousemoveX,h=this.mousemoveY,r=this._id,i;return(!ej.util.isNullOrUndefined(o)&&this.svgRenderer._getAttrVal($(n.target).parents(":eq(1)"),"id")==this.svgObject.id+"_Legend"||this.model.enableCanvasRendering&&o=="legend_"+r+"_canvas"||this.vmlRendering)&&($.each(this.model.legendRegion,function(n,t){s>=t.Bounds.LegendBound.X+t.Bounds.ItemBound.X&&s<=t.Bounds.LegendBound.X+t.Bounds.ItemBound.X+t.Bounds.ItemBound._Width&&(h>=t.Bounds.LegendBound.Y+t.Bounds.ItemBound.Y-t.Bounds.ItemBound.Height/4&&h<=t.Bounds.LegendBound.Y+t.Bounds.ItemBound.Y+t.Bounds.ItemBound.Height?(i=t,$("#legend_"+r+"_canvas").css("cursor","pointer")):$("#legend_"+r+"_canvas").css("cursor","default"))}),!ej.util.isNullOrUndefined(i))?{legendItem:i,series:this.model._visibleSeries[i.LegendItem.SeriesIndex]}:!1},get3DSeriesPoint:function(n){var i=this.mousemoveX,r=this.mousemoveY,e=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.X,o=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.Y,s=this.model.AreaType=="polaraxes"?$(this.svgObject).width():this.model.m_AreaBounds.Width,h=this.model.AreaType=="polaraxes"?$(this.svgObject).height():this.model.m_AreaBounds.Height,u,t,f;if(i>e&&i<e+s&&r>o&&r<o+h&&(u=$(n.target)[0].nodeName,(u=="path"||u=="shape")&&$(n.target)[0].id.indexOf("Region")>1))return index=$(n.target)[0].id.match(/(\d+)/g),pointIndex=parseInt(index[index.length-1]),seriesIndex=parseInt(index[index.length-2]),t={},t.Region={},t.Region.PointIndex=pointIndex,t.SeriesIndex=seriesIndex,f={},f.pointIndex=pointIndex,region={region:t,pointData:f,location:{x:i,y:r}}},GetSeriesPoint:function(n){for(var c,r,l,y,i,k,d,u=this.mousemoveX,f=this.mousemoveY,o,t=this,a=t.model.indicators,v=t.model._visibleSeries,e=0;e<a.length&&a[e].segment;e++)v=v.concat(a[e].segment);if(t.model.enable3D)return this.get3DSeriesPoint(n);var w=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.X,b=this.model.AreaType=="polaraxes"?0:this.model.m_AreaBounds.Y,g=this.model.AreaType=="polaraxes"?$(this.svgObject).width():this.model.m_AreaBounds.Width,nt=this.model.AreaType=="polaraxes"?$(this.svgObject).height():this.model.m_AreaBounds.Height;if(this.model.AreaType=="cartesianaxes"||this.model.AreaType=="polaraxes"){if(u>w&&u<w+g&&f>b&&f<b+nt&&$.each(this.model.chartRegions,function(i,e){var k,rt,ut,h,d,et,vt,y,b,l,a,s,p,g;if(ej.util.isNullOrUndefined(e.SeriesIndex)){if(r=t.model.chartRegions,vt={},!e.isStripLine){var ht=e.length,yt=t.model.requireInvertedAxes,pt=yt?t.model.series[e[ht-1].SeriesIndex]._xAxisName:t.model.series[e[ht-1].SeriesIndex]._yAxisName;for(b=0;b<t.model._axes.length;b++)if(pt==t.model._axes[b].name){y=t.model._axes[b];break}for(l=0;l<r.length;l++)for(a=0;a<r[l].length;a++)s=[],line1=r[l][a].region,line1[0]&&s.push({x:line1[0].X+y.x,y:line1[0].Y+y.y}),line1[1]&&s.push({x:line1[1].X+y.x,y:line1[1].Y+y.y}),line1[2]&&s.push({x:line1[2].X+y.x,y:line1[2].Y+y.y}),line1[3]&&s.push({x:line1[3].X+y.x,y:line1[3].Y+y.y}),p={x:u,y:f},g=t.isPointInPolygon(s,p),g&&(o=r[l][a])}}else if(k=v[e.SeriesIndex],t.model.AreaType=="polaraxes"&&k.drawType.toLowerCase()=="column"&&n.target){if(t.model.enableCanvasRendering){if(k.type.toLowerCase()=="polar"){var h=e.Region.Bounds,ct=-.5*Math.PI,lt=h.innerRadius,nt,tt;nt=u-h.CenterX;tt=f-h.CenterY;var ot=t.model._visibleSeries[e.SeriesIndex],at=ot.startAngle,wt=ot.endAngle,it=at?2*Math.PI*(t.model.itemCurrentXPos<0?1+t.model.itemCurrentXPos:t.model.itemCurrentXPos):0,w=(Math.atan2(tt,nt)-ct-it)%(2*Math.PI);w<0&&h.PointIndex!=0&&(w=2*Math.PI+w);rt=parseFloat(h.StartAngle.toFixed(14));ut=parseFloat(h.EndAngle.toFixed(14));rt-=it;ut-=it;w>=rt&&w<=ut&&(i=h.PointIndex,c=Math.sqrt(Math.pow(Math.abs(nt),2)+Math.pow(Math.abs(tt),2)),c<=h.Radius&&c>lt&&(d={Region:{PointIndex:i},SeriesIndex:e.SeriesIndex,type:e.type},o=d))}else if(k.type.toLowerCase()=="radar"&&(h=e.Region.Bounds,h.Line1)){line1=h.Line1;line2=h.Line2;line3=h.Line3;for(var s=[{x:line1.x,y:line1.y},{x:line2.x,y:line2.y},{x:line3.x,y:line3.y},],p={x:u,y:f},g=!1,ft=!1,l=-1,st=s.length,a=st-1;++l<st;a=l)(s[l].y<=p.y&&p.y<s[a].y||s[a].y<=p.y&&p.y<s[l].y)&&p.x<(s[a].x-s[l].x)*(p.y-s[l].y)/(s[a].y-s[l].y)+s[l].x&&(ft=!ft);g=ft;g&&(i=h.PointIndex,d={Region:{PointIndex:i},SeriesIndex:e.SeriesIndex,type:e.type},o=d)}}else if(et=$(n.target)[0].nodeName,(et=="path"||et=="shape")&&$($(n.target).parent())[0].id==t.svgObject.id+"_SeriesGroup_"+e.SeriesIndex)return i=$(n.target)[0].id.match(/(\d+)/g),pointIndex=parseInt(i[i.length-1]),e={Region:{PointIndex:pointIndex},SeriesIndex:e.SeriesIndex,type:e.type},o=e,!1}else u>=e.Region.Bounds.X&&u<=e.Region.Bounds.X+e.Region.Bounds.Width&&f>e.Region.Bounds.Y&&f<e.Region.Bounds.Y+e.Region.Bounds.Height&&(o=e)}),o)return{region:o,location:{x:u,y:f}}}else if(t=this,l=t.model.chartRegions,l.length>0&&(l[0].Series.type.toLowerCase()=="pyramid"||l[0].Series.type.toLowerCase()=="funnel")){if(y=$(n.target)[0].nodeName,(y=="path"||y=="shape")&&$($(n.target).parent())[0].id==t.svgObject.id+"_SeriesGroup_"+l[0].SeriesIndex)return r=t.model.chartRegions[0],index=$(n.target)[0].id.match(/(\d+)/g),index=parseInt(index[index.length-1]),r.Region.PointIndex=index,i={},i.pointIndex=index,o={region:r,pointData:i,location:{x:u,y:f}};r=l[0];var s=this.pyrX,h=this.pyrY,i={},p;for(e=0;e<r.Region.length;e++)if(line1=r.Region[e].Line1,line2=r.Region[e].Line2,line3=r.Region[e].Line3,line4=r.Region[e].Line4,l[0].Series.type.toLowerCase()=="pyramid"?p=[{x:line1.x+s,y:line1.y+h},{x:line2.x+s,y:line2.y+h},{x:line3.x+s,y:line3.y+h},{x:line4.x+s,y:line4.y+h}]:(line5=r.Region[e].Line5,line6=r.Region[e].Line6,p=[{x:line1.x+s,y:line1.y+h},{x:line2.x+s,y:line2.y+h},{x:line3.x+s,y:line3.y+h},{x:line4.x+s,y:line4.y+h},{x:line5.x+s,y:line5.y+h},{x:line6.x+s,y:line6.y+h}]),k={x:u,y:f},d=this.isPointInPolygon(p,k),d)return i.pointIndex=r.Region[e].PointIndex,r.Region.PointIndex=i.pointIndex,o={region:r,pointData:i,location:{x:u,y:f}}}else return $.each(t.model.chartRegions,function(n,r){var g=-.5*Math.PI,w=r.SeriesData,l=r.Region,nt=t.model._visibleSeries[r.SeriesIndex].type.toLowerCase()=="doughnut"?w.DRadius:0,k,d,tt,p,h,v,e,s,it,rt,ut;k=u-w.CenterX;d=f-w.CenterY;var a=t.model._visibleSeries[r.SeriesIndex],b=a.startAngle,y=a.endAngle;if(b=b<0?b+360:b,y=y<0?y+360:y,tt=a.endAngle-a.startAngle,tt<0){for(y=y/360,p=y?2*Math.PI*(y<0?1+y:y):0,h=(Math.atan2(d,k)-g-p)%(2*Math.PI),h<0&&(h=2*Math.PI+h),i=[],v=0;v<l.length;v++)if(e=parseFloat(l[v].StartAngle.toFixed(14)),s=parseFloat(l[v].EndAngle.toFixed(14)),e=e<0?2*Math.PI+e:e,s=s<0?2*Math.PI+s:s,e-=p,s-=p,e=parseFloat(e.toFixed(14)),s=parseFloat(s.toFixed(14)),a.startAngle>=0&&a.endAngle<=0&&(e=e<=0?2*Math.PI+e:e,s=s<0?2*Math.PI+s:s),h<=e&&h>=s){i.push(l[v]);break}}else for(p=b?2*Math.PI*(t.model.itemCurrentXPos<0?1+t.model.itemCurrentXPos:t.model.itemCurrentXPos):0,h=(Math.atan2(d,k)-g-p)%(2*Math.PI),h<0&&(h=t.model._isPieOfPie?h:2*Math.PI+h),i=[],v=0;v<l.length;v++)if(e=parseFloat(l[v].StartAngle.toFixed(14)),s=parseFloat(l[v].EndAngle.toFixed(14)),e=e<0?t.model._isPieOfPie?e:2*Math.PI+e:e,s=s<0?2*Math.PI+s:s,e-=p,s-=p,e=parseFloat(e.toFixed(14)),s=parseFloat(s.toFixed(14)),a.startAngle<0&&(a.endAngle>-1||a.endAngle==null)&&(e=e<0?2*Math.PI+e:e,s=s<=0?2*Math.PI+s:s),h+2*Math.PI<s&&a.type=="pieofpie"&&(h=h+2*Math.PI),h>=e&&h<=s){i.push(l[v]);break}i.length>0&&(it=a.explodeAll||a.explodeIndex==i[0].PointIndex,it?(rt=u-i[0].StartX,ut=f-i[0].StartY,i.length>0&&(c=Math.sqrt(Math.pow(Math.abs(rt),2)+Math.pow(Math.abs(ut),2)),c<=w.Radius&&c>nt&&(l.PointIndex=i[0].PointIndex,l.SeriesIndex=i[0].SeriesIndex,o={region:r,pointData:i,location:{x:u,y:f}}))):(c=Math.sqrt(Math.pow(Math.abs(k),2)+Math.pow(Math.abs(d),2)),c<=w.Radius&&c>nt&&(l.PointIndex=i[0].PointIndex,l.SeriesIndex=i[0].SeriesIndex,o={region:r,pointData:i,location:{x:u,y:f}})))}),o},isPointInPolygon:function(n,t){for(var u=!1,i=-1,f=n.length,r=f-1;++i<f;r=i)(n[i].y<=t.y&&t.y<n[r].y||n[r].y<=t.y&&t.y<n[i].y)&&t.x<(n[r].x-n[i].x)*(t.y-n[i].y)/(n[r].y-n[i].y)+n[i].x&&(u=!u);return u},mousePosition:function(n){if(!ej.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!ej.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=undefined){if(!ej.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},calMousePosition:function(n){var u=jQuery.uaMatch(navigator.userAgent),t=this.mousePosition(n),i,r,f;return n.pageX=t.x,n.pageY=t.y,f=u.browser.toLowerCase(),i=n.pageX-$(this.svgObject).offset().left,r=n.pageY-$(this.svgObject).offset().top,{X:i,Y:r}},calTouchPosition:function(n){var u=jQuery.uaMatch(navigator.userAgent),i,r,t;return u.browser.toLowerCase()=="mozilla"||u.browser.toLowerCase()=="webkit"?(t=n.originalEvent.touches[0],i=t.pageX-$(this.svgObject).parent().offset().left,r=t.pageY-$(this.svgObject).parent().offset().top,this.leftPadding=$(this.svgObject).offset().left,this.grabPadding=0):u.browser.toLowerCase()=="msie"?(i=n.originalEvent.pageX-$(this.svgObject).offset().left,r=n.originalEvent.pageY-$(this.svgObject).offset().top,this.leftPadding=$(this.svgObject).offset().left):(t=n.originalEvent.touches[0],i=t.pageX-$(this.svgObject).offset().left,r=t.pageY-$(this.svgObject).offset().top,this.leftPadding=$(this.svgObject).offset().left),{X:i,Y:r}},cancelEvent:function(n){n.stopPropagation();var t=jQuery.uaMatch(navigator.userAgent);return t.browser=="chrome"&&(this.model.zooming.enable||this.model.crosshair.visible)&&n.preventDefault(),this.model.enable3D&&(n.preventDefault(),n.stopPropagation()),n.returnValue=!1,n.cancelBubble=!0,!1},resetZoom:function(){var n=this,t="#"+this.svgObject.id;$(".tooltipDiv"+this._id).remove();$(".zoom"+this._id).remove();n.zoomed&&($.each(this.model._axes,function(n,t){t.zoomed=!1;t.zoomFactor=1;t.zoomPosition=0}),n.model.primaryXAxis.zoomFactor=1,n.model.primaryYAxis.zoomFactor=1,n.model.primaryXAxis.zoomPosition=0,n.model.primaryYAxis.zoomPosition=0,$("#"+n._id+"_canvas").css({cursor:"default"}),$(t+"_ResetZoom").remove(),$(t+"_PanBtn").remove(),$(t+"_ZoomBtn").remove(),$(t+"_ZoomInBtn").remove(),$(t+"_ZoomOutBtn").remove(),n.zoomed=!1,n.zooming=!1,n.panning=!1,n.model._chartAreaZoom=!1,n.resetZooming=!0,n.enableTrackBall(),n.redraw(),n.enableAnimation(),n.svgRenderer._setAttr($(n.svgObject).find(t+"_XAxis,"+t+"_ChartArea,"+t+"_YAxis,"+t+"_SeriesCollection"),{cursor:"default"}))},startZoomInOut:function(n){var s=n.target.id.indexOf("ZoomIn")>-1?"zoomIn":"zoomOut",e;this.drag=!1;this.zoomed=!0;var i=this.model.zooming.type.toLowerCase(),r=s=="zoomIn"?.2:-.2,o=!0,t,u,f;for(e=0;e<this.model._axes.length;e++)t=this.model._axes[e],u=t.zoomFactor,f=t.zoomPosition,t.orientation.toLowerCase()=="horizontal"?(t.zoomFactor=i!="y"?u-r:t.zoomFactor,t.zoomPosition=i!="y"?f+r:t.zoomPosition):(t.zoomFactor=i!="x"?u-r:t.zoomFactor,t.zoomPosition=i!="x"?f+r:t.zoomPosition),parseFloat(t.zoomFactor.toFixed(3))<=.001&&(t.zoomFactor=u,t.zoomPosition=f),parseFloat(t.zoomFactor.toFixed(3))>=1&&(t.zoomFactor=1,t.zoomPosition=0),o=o&&t.zoomFactor==1;this._updateScroll();this.redraw(!0);o?(this._removeZoomkit(),this.resetZooming=!0,this.zoomed=this.panning=!1,this.model._chartAreaZoom=!1):this._enableZoomingButtons()},startZoom:function(){var n=this,t="#"+this.svgObject.id,i;$(".tooltipDiv"+this._id).remove();i=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF";n.svgRenderer._setAttr($(t+"_ZoomBtn"),{selected:"true"});n.svgRenderer._setAttr($(t+"_ZoomPath"),{fill:"#14B9FF"});n.svgRenderer._setAttr($(t+"_ZoomIcon"),{fill:"#FFFFFF"});n.svgRenderer._setAttr($(t+"_PanPath"),{fill:"#B7B7B7"});n.svgRenderer._setAttr($(t+"_panIcon"),{fill:i});$(t+"_ZoomBtn").css({"border-color":"#14B9FF","background-color":"#14B9FF"});$(t+"_PanBtn").css({"border-color":"#B7B7B7","background-color":"#B7B7B7"});$("#"+n._id+"_canvas").css({cursor:"default"});this._cursorToDefault();n.panning=!1;n.enableTrackBall()},startPan:function(){var n=this,t="#"+this.svgObject.id,i;$(".tooltipDiv"+this._id).remove();i=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF";n.svgRenderer._setAttr($(t+"_ZoomBtn"),{selected:"false"});n.svgRenderer._setAttr($(t+"_PanBtn"),{selected:"true"});n.svgRenderer._setAttr($(t+"_ZoomPath"),{fill:"#B7B7B7"});n.svgRenderer._setAttr($(t+"_ZoomIcon"),{fill:i});n.svgRenderer._setAttr($(t+"_PanPath"),{fill:"#14B9FF"});n.svgRenderer._setAttr($(t+"_panIcon"),{fill:"#FFFFFF"});$(t+"_ZoomBtn").css({"border-color":"#B7B7B7","background-color":"#B7B7B7"});$(t+"_PanBtn").css({"border-color":"#14B9FF","background-color":"#14B9FF"});$("#"+n._id+"_canvas").css({cursor:"pointer"});this._cursorToPointer();n.panning=!0;n.disableTrackBall()},zoomButton:function(n,t){var i=t=="zoom"?"_Zoom":t=="zoomIn"?"_ZoomIn":"_ZoomOut";var u=n*5+5,r={left:0,top:0},f=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-n*32-u),e=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),o=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",s={id:this.svgObject.id+i+"Path",d:"M32,27c0,2.75-2.25,5-5,5H5c-2.75,0-5-2.25-5-5V5c0-2.75,2.25-5,5-5h22c2.75,0,5,2.25,5,5V27z",fill:this.panning||t=="zoomIn"||t=="zoomOut"?"#b7b7b7":"#14B9FF",zoomId:this._id+i+"Btn",width:26,height:26,left:f+r.left,top:e+r.top,iconColor:o};ej.EjCanvasRender.prototype.zoomButton(s,t,this);t=="zoom"?this._on($("#"+this.svgObject.id+i+"Btn"),"touchstart click",this.startZoom):this._on($("#"+this.svgObject.id+i+"Btn"),"touchstart click",this.startZoomInOut)},panButton:function(n){var i=n*5+5,t={left:0,top:0},r=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-n*32-i),u=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),f=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",e={id:this.svgObject.id+"_PanPath",d:"M 32 27 c 0 2.75 -2.25 5 -5 5 H 5 c -2.75 0 -5 -2.25 -5 -5 V 5 c 0 -2.75 2.25 -5 5 -5 h 22 c 2.75 0 5 2.25 5 5 V 27 Z",fill:this.panning?"#14B9FF":"#b7b7b7",panId:this._id+"_PanBtn",width:26,height:26,left:r+t.left,top:u+t.top,iconColor:f};ej.EjCanvasRender.prototype.panButton(e,this);this._on($("#"+this.svgObject.id+"_PanBtn"),"touchstart click",this.startPan)},resetZoomButton:function(n){var r=n*5+5,t={left:0,top:0},u=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-(n*32+r)),f=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),e=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",o={id:this.svgObject.id+"_ResetZoomPath",d:"M 32 27 c 0 2.75 -2.25 5 -5 5 H 5 c -2.75 0 -5 -2.25 -5 -5 V 5 c 0 -2.75 2.25 -5 5 -5 h 22 c 2.75 0 5 2.25 5 5 V 27 Z",fill:"#b7b7b7",resetZoomId:this._id+"_ResetZoom",width:26,height:26,left:u+t.left,top:f+t.top,iconColor:e},i;ej.EjCanvasRender.prototype.resetZoom(o,this);i=(window.TouchEvent?"touchstart":window.PointerEvent?"pointerdown":window.MSPointerEvent?"MSPointerDown":"click")+" click";this._on($("#"+this.svgObject.id+"_ResetZoom"),i,this.resetZoom)},doZoom:function(n,t,i){var e=this,d,g,o,r,y;if(this.model._chartAreaZoom=!0,this.scrollDraw=!0,$(".tooltipDiv"+this._id).remove(),e.model.enableCanvasRendering)var b=$("#"+this.svgObject.id+"_ZoomArea")[0].getClientRects()[0],k=$("#"+this.svgObject.id)[0].getClientRects()[0],d=b.left-k.left-$(document).scrollLeft(),g=b.top-k.top-$(document).scrollTop();else d=parseFloat(e.svgRenderer._getAttrVal($(n),"x")),g=parseFloat(e.svgRenderer._getAttrVal($(n),"y"));for($("#"+this.svgObject.id+"_ZoomArea").remove(),this.drag=!1,this.zoomed=!0,r=0;r<this.model._axes.length;r++){var u=this.model._axes[r],h=u.zoomFactor,a=u.zoomPosition;u.orientation.toLowerCase()=="horizontal"?(u.zoomFactor=e.model.zooming.type.toLowerCase()!="y"?h*(t/e.model.m_AreaBounds.Width):u.zoomFactor,u.zoomPosition=e.model.zooming.type.toLowerCase()!="y"?a+Math.abs((d-e.model.m_AreaBounds.X)/e.model.m_AreaBounds.Width)*h:u.zoomPosition,parseFloat(u.zoomFactor.toFixed(3))<=.001&&(u.zoomFactor=h,u.zoomPosition=a)):(u.zoomFactor=e.model.zooming.type.toLowerCase()!="x"?h*i/e.model.m_AreaBounds.Height:u.zoomFactor,u.zoomPosition=e.model.zooming.type.toLowerCase()!="x"?a+(1-Math.abs((i+(g-e.model.m_AreaBounds.Y))/e.model.m_AreaBounds.Height))*h:u.zoomPosition,parseFloat(u.zoomFactor.toFixed(3))<=.001&&(u.zoomFactor=h,u.zoomPosition=a))}var s=this.model._visibleSeries,it=s.length,c=[],nt=[],f=[],l,v,p,w,tt;for(o=0;o<it;o++){if(s[o].visibility=="visible")for(f=s[o].points,tt=f.length,l=s[o].type.toLowerCase(),v=new ej.axisTypes[s[o].xAxis._valueType.toLowerCase()],v._calculateVisibleRange(s[o].xAxis,e),v=new ej.axisTypes[s[o].yAxis._valueType.toLowerCase()],v._calculateVisibleRange(s[o].yAxis,e),p=s[o].xAxis.visibleRange,w=s[o].yAxis.visibleRange,r=0;r<tt;r++)p.min<=f[r].xValue&&p.max>=f[r].xValue&&w.min<=f[r].y&&w.max>=f[r].y&&(s[o]._hiloTypes?l=="rangearea"||l=="rangecolumn"||l=="waterfall"||l=="hilo"?c.push({XValue:f[r].x,High:f[r].high,Low:f[r].low}):c.push({XValue:f[r].x,High:f[r].high,Low:f[r].low,Open:f[r].open,Close:f[r].close}):c.push({XValue:f[r].x,YValue:f[r].y}));c.length!=0&&nt.push({selectedData:c});c=[]}y=$.extend({},ej.EjSvgRender.commonChartEventArgs);y.data={};y.data.series=nt;this._trigger("zoomed",y);this.disableAnimation();this.model.legendCollapsed=!1;this.redraw(!0);this._enableZoomingButtons()},_cursorToDefault:function(){var n="#"+this.svgObject.id;this.svgRenderer._setAttr($(this.svgObject).find(n+"_XAxis,"+n+"_ChartArea,"+n+"_YAxis,"+n+"_SeriesCollection,"+n+"_StriplineBehind,"+n+"_StriplineOver"),{cursor:"default"})},_cursorToPointer:function(){var n="#"+this.svgObject.id;this.svgRenderer._setAttr($(this.svgObject).find(n+"_XAxis,"+n+"_ChartArea,"+n+"_YAxis,"+n+"_SeriesCollection,"+n+"_StriplineBehind,"+n+"_StriplineOver"),{cursor:"pointer"})},removeMultiRect:function(){$(this.parentgEle).empty();this.model.selectedDataCollection=[]},multiSelectDataCalculation:function(){for(var lt,at,n,ut,tt,gt=this,i=[],it=this.selectedRectIndex,vt=this.oldRectX[it],yt=this.oldRectY[it],pt=this.oldRectWidth[it],ot=this.oldRectHeight[it],d=1,ft=0,st=this.model.series,wt=st.length,rt=this.multiAxis,bt=rt.length,kt=this.multiSelectType,c,w,g,y,p,e,o,t,f,b,a,v,u,ht,ct,ni=this.model.AreaType.toLowerCase(),s,l,dt,h,et,nt,r,k=0;k<wt;k++){if(r=st[k],ht=r.xAxis.visibleRange,ct=r.yAxis.visibleRange,lt=rt.some(function(n){return n.name.toLowerCase()==r._xAxisName.toLowerCase()}),at=rt.some(function(n){return n.name.toLowerCase()==r._yAxisName.toLowerCase()}),nt=r.selectionSettings,lt&&at&&r.visibility.toLowerCase()=="visible"){for(n=0;n<bt;n++)c=rt[n],w=d,g=ft,c.orientation.toLowerCase()=="horizontal"?(this.selectFactor=nt.rangeType.toLowerCase()!="y"?w*(pt/this.multiAxis[n].width):d,this.selectPosition=nt.rangeType.toLowerCase()!="y"?g+Math.abs((vt-this.multiAxis[n].x)/this.multiAxis[n].width)*w:ft,parseFloat(d.toFixed(3))<=.001&&(this.selectFactor=w,this.selectPosition=g)):(this.selectFactor=nt.rangeType.toLowerCase()!="x"?w*ot/this.multiAxis[n].height:d,this.selectPosition=nt.rangeType.toLowerCase()!="x"?g+(1-Math.abs((ot+(yt-this.multiAxis[n].y))/this.multiAxis[n].height))*w:ft,parseFloat(d.toFixed(3))<=.001&&(this.selectFactor=w,this.selectPosition=g)),c.visibleRange=$.extend(!0,{},c.actualRange),(this.selectFactor<1||this.selectPosition>0)&&(b=c.valueType=="logarithmic"?c.visibleRange:c.actualRange,this.selectFactor=this.selectFactor>1?1:this.selectFactor<0?0:this.selectFactor,this.selectPosition=this.selectPosition<0?0:this.selectPosition>1?1:this.selectPosition,c.isInversed?(a=c.actualRange.max-this.selectPosition*c.actualRange.delta,v=a-this.selectFactor*c.actualRange.delta,dt=!0):(a=Math.abs(c.actualRange.min+this.selectPosition*c.actualRange.delta),v=a+this.selectFactor*c.actualRange.delta),a<b.min&&(v=v+(b.min-a),a=b.min),v>b.max&&(a=a-(v-b.max),v=b.max),c.valueType=="logarithmic"&&(a=Math.pow(10,a),v=Math.pow(10,v)),c.visibleRange.min=Math.min(a,v),c.visibleRange.max=Math.max(a,v));t=r._visiblePoints;f=r.type.toLowerCase();et=r.isTransposed;y=r.xAxis.visibleRange.min;p=r.xAxis.visibleRange.max;e=r.yAxis.visibleRange.min;o=r.yAxis.visibleRange.max;ej.util.isNullOrUndefined(i)&&(i=[]);switch(kt){case"x":for(n=0;n<t.length;n++)t[n].seriesIndex=k,u=t[n].isEmpty,s=t[n].xValue,l=t[n].y,r.xAxis.isInversed||r.yAxis.isInversed?f.indexOf("bar")>=0?f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&o>=h&&e<=h&&i.push(t[n])):f=="waterfall"&&!u&&o>=t[n].YValues[0]&&e<=t[n].YValues[0]?i.push(t[n]):!u&&o>=l&&e<=l&&i.push(t[n]):!u&&p>=s&&y<=s&&i.push(t[n]):et&&f.indexOf("bar")>=0?!u&&y<=s&&p>=s&&i.push(t[n]):f.indexOf("bar")>=0||r.isTransposed&&!(f.indexOf("bar")>=0)?f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&e<=l&&o>=l&&i.push(t[n]):!u&&y<=s&&p>=s&&i.push(t[n]);break;case"y":for(n=0;n<t.length;n++)t[n].seriesIndex=k,u=t[n].isEmpty,s=t[n].xValue,l=t[n].y,r.xAxis.isInversed||r.yAxis.isInversed?f.indexOf("bar")>=0?!u&&p>=s&&y<=s&&i.push(t[n]):f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&o>=t[n].YValues[0]&&e<=t[n].YValues[0]?i.push(t[n]):!u&&o>=l&&e<=l&&i.push(t[n]):et&&f.indexOf("bar")>=0?f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&e<=l&&o>=l&&i.push(t[n]):f.indexOf("bar")>=0||r.isTransposed&&!(f.indexOf("bar")>=0)?!u&&y<=s&&p>=s&&i.push(t[n]):f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&e<=l&&o>=l&&i.push(t[n]);break;case"xy":for(n=0;n<t.length;n++)t[n].seriesIndex=k,u=t[n].isEmpty,s=t[n].xValue,l=t[n].y,f.indexOf("stacking")>=0?(h=r.stackedValue.EndValues[n],!u&&p>=s&&y<=s&&e<=h&&o>=h&&i.push(t[n])):f=="waterfall"&&!u&&p>=s&&y<=s&&e<=t[n].YValues[0]&&o>=t[n].YValues[0]?i.push(t[n]):!u&&p>=s&&y<=s&&e<=l&&o>=l&&i.push(t[n])}}r.xAxis.visibleRange=ht;r.yAxis.visibleRange=ct}ut=this.currentIndex;ej.util.isNullOrUndefined(this.model.selectedDataCollection)&&(this.model.selectedDataCollection=[]);this.removeRect?this.model.selectedDataCollection.splice(ut,1):this.rectPan||this.resize?(this.model.selectedDataCollection[ut]=0,this.model.selectedDataCollection[ut]=i):this.model.selectedDataCollection[this.model.selectedDataCollection.length]=i;tt=$.extend({},ej.EjSvgRender.commonChartEventArgs);tt.data={};tt.data.selectedData=i;tt.data.selectedDataCollection=this.model.selectedDataCollection;this._trigger("rangeSelected",tt)},multiSelectMouseUp:function(n){var a,v,y,p,w,b,k,d,s,g;if(this._isMultiSelect&&this.multiSelectMode=="range"){var h,c,l,i=this.svgObject.id,t=this.selectedRectIndex,e="#"+i+"_selectRect",r=parseInt($(e+t).attr("width")),o=parseInt($(e+t).attr("height")),u=parseInt($(e+t).attr("x")),f=parseInt($(e+t).attr("y"));if((this.multiSelectDraw||!this.removeRect||!this.resize||!this.rectPan)&&r>0&&o>0){for(a={id:i+"_resize_rightRect"+t,x:u+r-5,y:f+10,width:10,height:o-20>0?o-20:0,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"e-resize"},this.svgRenderer.drawRect(a,this.gEle),v={id:i+"_resize_bottomRect"+t,x:u,y:f+o-5,width:r-10>0?r-10:0,height:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"s-resize"},this.svgRenderer.drawRect(v,this.gEle),y={id:i+"_resize_leftRect"+t,x:u-5,y:f,width:10,height:o,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"w-resize"},this.svgRenderer.drawRect(y,this.gEle),p={id:i+"_resize_topRect"+t,x:u,y:f-5,width:r-10>0?r-10:0,height:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"n-resize"},this.svgRenderer.drawRect(p,this.gEle),w={id:i+"_resize_bottomRightCornerCircle"+t,cx:u+r,cy:f+o,r:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"se-resize"},this.svgRenderer.drawCircle(w,this.gEle),b={id:i+"_closeTopRightCornerCircle"+t,cx:u+r,cy:f,r:10,fill:"white",stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawCircle(b,this.gEle),k={id:i+"_closePath"+t,x1:u+r-4,y1:f-4,x2:u+r+4,y2:f+4,stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawLine(k,this.gEle),d={id:i+"_closePathOpposite"+t,x1:u+r+4,y1:f-4,x2:u+r-4,y2:f+4,stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawLine(d,this.gEle),h=[16,10,4,10,4,4],c=[4,4,4,10,10,16],l=["a","b","c","d","e","f"],s=0;s<6;s++)g={id:i+"_gripCircle_"+l[s]+t,cx:u+r-h[s],cy:f+o-c[s],r:.4,stroke:"#5B5B5B","stroke-width":2},this.svgRenderer.drawCircle(g,this.gripCollection);this.gripCollection!=null&&$(this.gripCollection).appendTo(this.gEle);$("#"+i+"_gripCollection"+t).css({visibility:"hidden"})}ej.util.isNullOrUndefined(this.oldRectX)&&(this.oldRectX=[],this.oldRectY=[],this.oldRectWidth=[],this.oldRectHeight=[],this.oldReRightRectX=[],this.oldReTopRectY=[],this.oldReBottomRectY=[]);this.oldRectX[t]=parseInt($(e+t).attr("x"));this.oldRectY[t]=parseInt($(e+t).attr("y"));this.oldRectWidth[t]=parseInt($(e+t).attr("width"));this.oldRectHeight[t]=parseInt($(e+t).attr("height"));this.oldReRightRectX[t]=parseInt($("#"+i+"_resize_rightRect"+t).attr("x"));this.oldReTopRectY[t]=parseInt($("#"+i+"_resize_topRect"+t).attr("y"));this.oldReBottomRectY[t]=parseInt($("#"+i+"_resize_bottomRect"+t).attr("y"));this.oldMultiSelectType=this.multiSelectType;(this.resize||this.rectPan)&&(this.resize&&$("#"+this.svgObject.id+"_gripCollection"+t).attr({transform:""}),$("#"+i+"_closeTopRightCornerCircle"+t).css({display:"inline"}),$("#"+i+"_closePath"+t).css({display:"inline"}),$("#"+i+"_closePathOpposite"+t).css({display:"inline"}),$("#"+i+"_resize_rightRect"+t).css({cursor:"e-resize"}),$("#"+i+"_resize_leftRect"+t).css({cursor:"w-resize"}),$("#"+i+"_resize_bottomRect"+t).css({cursor:"s-resize"}),$("#"+i+"_resize_topRect"+t).css({cursor:"n-resize"}));this.drag=!1;this.removeRect&&($("#"+i+"_selectedRectGroup"+t).remove(),this.parentgEle.childNodes.length<=0&&$(this.parentgEle).remove());(this.multiSelectDraw||this.removeRect||this.resize||this.rectPan)&&r>0&&o>0&&(this.multiSelectDraw=!1,this.multiSelectDataCalculation(n));this.resize&&(this.resize=!1);this.rectPan&&(this.rectPan=!1);this.removeRect=!1;this.enableTrackBall()}},chartMouseUp:function(n){var o,t,s,r,u,a,h,y,p,i,f,e,c,l;if(this.isTouch(n)&&(this.model.touchCross=!1,this.chartMouseUpTouch(n)),!this.currentPageX&&this.panning&&(o=this.calMousePosition(n),this.currentPageX=o.X,this.currentPageY=o.Y),i=this,t=this.model,this.mousedownPointX=this.mousedownPointY=null,$("[id*=_PreviewSeries]").remove(),$("[id*=_Marker]").remove(),i.dragPoint){s=this.dragIndex.seriesIndex;r=t._visibleSeries[s];this.model.enableCanvasRendering||this.gPreviewSeriesGroupEle&&($(this.svgObject).find("#"+this.svgObject.id+"_PreviewSeriesGroup_"+s).remove(),this.gPreviewSeriesGroupEle.childNodes.length>0&&this.gPreviewSeriesGroupEle.removeChild(this.gPreviewSeriesGroupEle.childNodes[0]));this.dragPoint=r.dragPoint=!1;var v=this._getDraggedPoint(r,this.mousemoveX,this.mousemoveY),g=v.X,nt=v.Y;a=r.data.seriesIndex;h=r.data.pointIndex;y={X:this.commonDragEventArgs.data.oldValue.X,Y:this.commonDragEventArgs.data.oldValue.Y};p={X:g,Y:nt};u=$.extend({},this.commonDragEventArgs);u.data={series:r,seriesIndex:a,pointIndex:h,oldValue:y,newValue:p};this._trigger("dragEnd",u);i.commonDragEventArgs=u;i._changeDraggingPoints(r,h,u.data.newValue.X,u.data.newValue.Y);r.region=null;this.redraw()}if(this.multiSelectAreaType!="cartesianaxes"||t.zooming.enable||t.enableCanvasRendering||this.multiSelectMouseUp(n),i=this,t.zooming.enable&&t.AreaType=="cartesianaxes"){if(f=$("#"+this.svgObject.id+"_ZoomArea"),f[0])if(t.enableCanvasRendering)var w=f[0].getClientRects()[0],b=w.width,k=w.height;else var d=$(f),b=parseFloat(this.svgRenderer._getAttrVal(d,"width")),k=parseFloat(this.svgRenderer._getAttrVal(d,"height"));b>0&&k>0?i.doZoom(f,b,k):this.drag=!1;i.panning||this.enableTrackBall()}e=this.svgObject.id;c=ej.util.isNullOrUndefined(n.target.parentNode)?"":n.target.parentNode.id;(c==e+"_ResetZoom"||c==e+"_ZoomBtn"||n.target.id==e+"_ResetZoom"||n.target.id==e+"_ZoomBtn")&&(this.panning=!1,this.model._chartAreaZoom=!1);(ej.isTouchDevice()||t.zooming.enableDeferredZoom)&&this.panning&&this.doPan&&t.AreaType=="cartesianaxes"&&(l={x:this.oPreviousCoords.x-this.currentPageX,y:this.oPreviousCoords.y-this.currentPageY},this.oPreviousCoords={x:this.currentPageX,y:this.currentPageY},$.each(t._axes,function(n,t){var r=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1);i.translate(t,l.x,l.y,r)}),this.model.legendCollapsed=!1,this.redraw(!0,!0,n.target),this._cursorToPointer(),this._enableZoomingButtons());this.doPan&&(this.doPan=!1);this.rotateActivate=!1},multiSelectMouseDown:function(evt){var i,k;this.multiSelectAreaType=this.model.AreaType.toLowerCase();var model=this.model,chartX=model.m_AreaBounds.X,chartWidth=model.m_AreaBounds.Width,chartY=model.m_AreaBounds.Y,chartHeight=model.m_AreaBounds.Height,mouseDownCords=this.calMousePosition(evt);if(this.multiSelectAreaType=="cartesianaxes"&&!model.zooming.enable&&!model.enableCanvasRendering&&mouseDownCords.X>=chartX&&mouseDownCords.X<chartX+chartWidth&&mouseDownCords.Y<chartY+chartHeight&&mouseDownCords.Y>=chartY){var seriesCollection=this.model.series,seriesCollectionLength=seriesCollection.length,id,mouseDownCords,containerSvg=this.svgObject.id,selectMode=seriesCollection.some(function(n){return n.selectionSettings.mode.toLowerCase()=="range"});for(this._isMultiSelect=seriesCollection.some(function(n){return n.selectionSettings.enable==!0&&n.selectionSettings.mode.toLowerCase()=="range"}),selectMode&&(this.multiSelectMode="range"),i=0;i<seriesCollectionLength;i++)seriesCollection[i].selectionSettings.enable==!0&&seriesCollection[i].selectionSettings.mode.toLowerCase()=="range"&&(this.multiSelectType=seriesCollection[i].selectionSettings.rangeType.toLowerCase());if(this._isMultiSelect&&this.multiSelectMode=="range"){this.disableTrackBall();mouseDownCords=this.calMousePosition(evt);this.mouseDownX=mouseDownCords.X;this.mouseDownY=mouseDownCords.Y;this.drag=!0;$(this.parentgEle).find("g").length<1?this.selectedRectIndex=0:(id=$(this.parentgEle).find("g").last().attr("id"),matchStr=containerSvg+"_gripCollection",id=parseInt(id.substr(matchStr.length)),this.selectedRectIndex=id+1);$(this.parentgEle).find("g").length==0&&(this.parentgEle=this.svgRenderer.createGroup({id:containerSvg+"_rectSelectionGroup"}));this.gEle=this.svgRenderer.createGroup({id:containerSvg+"_selectedRectGroup"+this.selectedRectIndex});$(this.gripCollection).find("g").length==0&&(this.gripCollection=this.svgRenderer.createGroup({id:containerSvg+"_gripCollection"+this.selectedRectIndex}));evt.target.id.indexOf("resize")>=0&&(id=evt.target.id.split("resize")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id));evt.target.id.indexOf("close")>=0&&(id=evt.target.id.split("close")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id));evt.target.id.indexOf(this.svgObject.id+"_selectRect")>=0&&(matchStr=this.svgObject.id+"_selectRect",this.selectedRectIndex=parseInt(evt.target.id.substr(matchStr.length)));this.currentIndex=$(evt.target.parentNode).index();var axes=this.model._axes,axesLength=axes.length,axis,mouseMoveCords=this.calMousePosition(evt),mouseMoveX=mouseMoveCords.X,mouseMoveY=mouseMoveCords.Y;for(this.multiAxis=[],k=0;k<axesLength;k++)axis=axes[k],mouseMoveX>axis.Location.X1&&mouseMoveX<axis.Location.X2&&this.multiAxis.push(axis),mouseMoveY<axis.Location.Y1&&mouseMoveY>axis.Location.Y2&&this.multiAxis.push(axis)}}},_grab:function(n,t,i,r,u){commonDragEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs);commonDragEventArgs.data={seriesIndex:i,pointIndex:r,currentPoint:u};t._trigger("dragStart",commonDragEventArgs);n.data=commonDragEventArgs.data;this.commonDragEventArgs=commonDragEventArgs;this.mousedownPointX=this.mousedownPointY=null},_enableDragging:function(n,t,i){var e=this,u,o,r=n.type.toLowerCase(),l=e.model.AreaType,a=n.visibility.toLowerCase(),h,c,s,f;if(this.mousedownPointX&&this.mousedownPointY&&l=="cartesianaxes"&&!this.model.enable3D&&a=="visible"&&(r=="line"||r=="spline"||r=="area"||r=="stepline"||r=="steparea"||r=="splinearea"||r=="column"||r=="bar"||r=="bubble"||r=="scatter")&&(h=[],c=[],u=this.getClosesPointXY(c,h,n,this.mousedownPointX,this.mousedownPointY,i),this.mousemoveX=this.mousedownPointX,this.mousemoveY=this.mousedownPointY,o=this.GetSeriesPoint(i),ej.util.isNullOrUndefined(u.point)||(this.dragPoint=n.dragPoint=!0,u.seriesIndex=t,n.pointData=u,s={xValue:u.point.xValue,yValue:u.point.YValues},e._grab(n,e,t,u.index,s),this.dragIndex={pointIndex:u.index,seriesIndex:t}),!ej.util.isNullOrUndefined(o)&&(f=o.region,t==f.SeriesIndex))){n.region=o.region;this.dragPoint=n.dragPoint=!0;var v=n._visiblePoints[f.Region.PointIndex].xValue,y=n._visiblePoints[f.Region.PointIndex].YValues,s={xValue:v,yValue:y};e._grab(n,e,f.SeriesIndex,f.Region.PointIndex,s);this.dragIndex={pointIndex:f.Region.PointIndex,seriesIndex:f.SeriesIndex}}},chartMouseDown:function(e){var model=this.model,matchStr=this._id+"_scrollbar_",parentNodeId=e.target.parentNode&&e.target.parentNode.id?e.target.parentNode.id:"",selectionIndex=parentNodeId.indexOf(matchStr)>-1?parseInt(parentNodeId.substr(matchStr.length)):NaN,isZoom=this.isZoomButtonHovered(e.target),timer,parent,isZoomToolkit,mousePanCords;axes=model._axes;chart=this;mouseDownCords=this.calMousePosition(e);browserInfo=this.model.browserInfo;this.mousedownPointX=mouseDownCords.X;this.mousedownPointY=mouseDownCords.Y;"which"in e?this.chartRightClick=e.which==3:"button"in e&&(this.chartRightClick=e.button==2);isNaN(selectionIndex)||ej.util.isNullOrUndefined(selectionIndex)||(axes[selectionIndex].previousRange=$.extend(!0,{},model._axes[selectionIndex].visibleRange));this.mousemoveX=this.mouseDownX=mouseDownCords.X;this.mousemoveY=this.mouseDownY=mouseDownCords.Y;this.isTouch(e)&&(this.model.event=e,this.model.touchCross=!0,$.finish?$(this.model.trackerElement).finish():$(this.model.trackerElement).stop(!0,!0),this.model.tapNum=this.model.tapNum||0,isZoom||this.doubleTap(e),chart.model.crosshair.visible&&!isZoom&&(timer=setTimeout(function(){var n=$("#"+chart.svgObject.id).find("#"+chart.svgObject.id+"_ZoomArea"),t=chart.model.elementSpacing/2,i=chart.getEvent(chart.model.event),r=i.pageX,u=i.pageY;chart.model.touchCross&&!chart.panning&&Math.abs(r-chart.model.cachedX)<t&&Math.abs(u-chart.model.cachedY)<t&&(n.length==0||parseFloat($(n).attr("width"))==0||parseFloat($(n).attr("height"))==0)&&(chart.chartInteractiveBehavior(e),chart.model.crosshairMoved=!0,chart.drag=!1)},500)));this.model.enable3D&&this.model.enableRotation&&(this.rotateActivate=!0);this.svgRenderer.vmlNamespace||(this.oPreviousCoords={},e.target.id.indexOf("resize")>=0&&(id=e.target.id.split("resize")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id),this.multiSelectMouseDownId=e.target.id,this.resize=!0),e.target.id.indexOf("close")>=0&&(id=e.target.id.split("close")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id),this.removeRect=!0),e.target.id.indexOf(this.svgObject.id+"_selectRect")>=0&&(matchStr=this.svgObject.id+"_selectRect",this.selectedRectIndex=parseInt(e.target.id.substr(matchStr.length))),e.target.id==this.svgObject.id+"_selectRect"+this.selectedRectIndex&&(this.rectPan=!0,this.PreviousCoords={X:e.pageX,Y:e.pageY}),this.isTouch(e)||this.multiSelectMouseDown(e),parent=this.svgRenderer._getAttrVal($(e.target).parent(),"id"),isZoomToolkit=parent!=this.svgObject.id+"_ZoomBtn"&&parent!=this.svgObject.id+"_ZoomInBtn"&&parent!=this.svgObject.id+"_ZoomOutBtn"&&parent!=this.svgObject.id+"_ResetZoom"&&parent!=this.svgObject.id+"_PanBtn",isZoomToolkit&&this.model.zooming.enable&&!this.model.isLazyZooming&&!this.panning&&this.model.AreaType=="cartesianaxes"?this.mouseDownX>=this.model.m_AreaBounds.X&&this.mouseDownX<model.m_AreaBounds.X+model.m_AreaBounds.Width&&this.mouseDownY<model.m_AreaBounds.Y+model.m_AreaBounds.Height&&this.mouseDownY>=model.m_AreaBounds.Y&&!this.isTouch(e)&&((isNaN(selectionIndex)||ej.util.isNullOrUndefined(selectionIndex))&&(this.drag=!0),this.disableTrackBall()):(isZoomToolkit&&this.panning||$(e.target)[0].className=="e-hhandle e-box")&&(mousePanCords=this.calMousePosition(e),this.mousePanX=mousePanCords.X,this.mousePanY=mousePanCords.Y,this.mousePanX>=model.m_AreaBounds.X&&this.mousePanX<model.m_AreaBounds.X+model.m_AreaBounds.Width&&this.mousePanY<model.m_AreaBounds.Y+model.m_AreaBounds.Height+18&&this.mousePanY>=model.m_AreaBounds.Y&&(this.doPan=!0)),(this.rotateActivate||this.doPan)&&(this.oPreviousCoords={x:e.pageX,y:e.pageY}))},chartMouseLeave:function(n){this.cancelEvent(n);this.isTouch(n)||($("[id*=_TrackSymbol]").remove(),this._removeHighlight(),this._removeTrackBall(),$("#"+this.svgObject.id+"_TrackToolTip").hide(),$("#"+this._id+"_tooltip").remove(),$(".tooltipDiv"+this._id).hasClass(this.svgObject.id)&&$(".tooltipDiv"+this._id).remove());var t=$.extend({},ej.EjSvgRender.commonChartEventArgs);t.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:n.target.id,pageX:n.pageX,pageY:n.pageY};this._trigger("chartMouseLeave",t)},_doClick:function(n){var bt,vt,h,e,o,d,tt,pt,it,c,y,f,t,wt,i,p,w,ft,u,et,nt,ot,st,r;this.drag=!1;this.model.crosshairMoved||this._removeHighlight();this.model.selectedDataPointIndexes||(this.model.selectedDataPointIndexes=[]);this.model.clusterPoints=[];this.model._isStateChaged=!1;var i,u,a,s,ht=this.getEvent(n),ct=ht.pageX,lt=ht.pageY,b=10,ni=n.target.id,ti=this.svgObject.id,k=this.model._visibleSeries,at=this.isZoomButtonHovered(n.target),v=n.target.id;if(seriesLength=k.length,s=this.GetSeriesPoint(n),s?(i=s.region.SeriesIndex,u=s.region.Region.PointIndex):this.model.selectionEnable&&(this.model.enable3D||n.target.id.indexOf("LegendItem")!=-1||this.model.AreaType=="none"||(h=n.target.id,e=h.match(/(\d+)/g),!e||h.indexOf("symbol")==-1&&h.indexOf("Series")==-1||h.indexOf("Text")!=-1?e&&(h.indexOf("Text")!=-1||h.indexOf("dataLabel")!=-1)&&(i=parseInt(e[0].charAt(0)),u=isNaN(parseInt(e[0].charAt(1)))?parseInt(e[1].charAt(0)):parseInt(e[0].charAt(1))):(i=parseInt(e[0]),u=isNaN(parseInt(e[1]))?0:parseInt(e[1])))),!at||this.model.enableCanvasRendering){for(f=0;f<this.model._visibleSeries.length;f++)if(a=this.model._visibleSeries[f],o=a.type.toLowerCase(),this.model.AreaType=="cartesianaxes"&&a.visibility.toLowerCase()=="visible"&&o!=="scatter"&&o!=="bubble"&&o!=="column"&&o.indexOf("bar")==-1&&o!=="stackingcolumn"&&o!=="stackingcolumn100"&&!a._hiloTypes){var yt=this.calMousePosition(n);this.mousemoveX=yt.X;this.mousemoveY=yt.Y;d=this.getClosesPointXY([],[],a,this.mousemoveX,this.mousemoveY,n);ej.util.isNullOrUndefined(d.point)||(i=f,u=d.index,tt=$.extend({},ej.EjSvgRender.commonChartEventArgs),tt.data={location:{x:this.mousemoveX,y:this.mousemoveY},region:{SeriesIndex:f,Region:{PointIndex:d.index}}},this._trigger("pointRegionClick",tt))}s&&!at&&(r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=s,this._trigger("pointRegionClick",r))}if(this.model.AreaType=="none"&&this.model.enable3D&&$(n.target)[0].nodeName=="path"&&(!this.isTouch(n)||Math.abs(ct-this.model.cachedX)<b&&Math.abs(lt-this.model.cachedY)<b))if(l=$(n.target)[0].id.match(/(\d+)/g),i=parseInt(l[l.length-2]),u=parseInt(l[l.length-1]),pt=this.model._visibleSeries[i].explodeIndex,it=this.model._visibleSeries[i]._visiblePoints[u].actualIndex,this.model._visibleSeries[i].explodeIndex=pt==it?null:it,this.vmlRendering||this.model.enableCanvasRendering||(c=this.selectedStyle(this)),$(this.svgObject).empty(),$(this.legendSvgContainer).empty(),this.draw(),this.model.AreaType=="none"){this.model._isStateChaged=!1;var g,kt=c.length,rt="_Region_Series_"+i+"_Point_"+u,ut=$(this.svgObject).find("[id$="+rt+"],[id*="+rt+"back],[id*="+rt+"front]");for(elementsLength=ut.length,y=0;y<kt;y++)for(f=0;f<elementsLength;f++)c[y].id==ut[f].id&&(g=c[y].className,g.indexOf("SelectionStyle")<0&&g.indexOf("Selection"+name+"Style")<0&&$("[id="+ut[f].id+"]").attr("class",g));c.pattern&&this.svgRenderer.append(c.pattern,this.svgObject)}else $("[id*="+this.svgObject.id+"_LegendItemShape],[id*=_Region_Series_]").each(function(){$(this).attr("class","")});if(t=this.getLegendData(n),t&&($("#template_group_"+this._id).remove(),r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=t,this._trigger("legendItemClick",r),i=t.legendItem.LegendItem.SeriesIndex,!this.model.legend.toggleSeriesVisibility&&t.series.selectionSettings.enable&&(this.model._isStateChaged=!1,this.legendSelection(this,t,n,s)),!r.cancel&&this.model.legend.toggleSeriesVisibility)){for($("[id*="+this._id+"_Selection_]").remove(),wt=this.model._visibleSeries.length,this.model.AreaType!="none"||this.model.AreaType=="none"&&o!="pieofpie"&&o!="pyramid"&&o!="funnel"&&wt>1?(i=t.legendItem.LegendItem.SeriesIndex,p=t.legendItem.LegendItem.TrendLineIndex,ej.util.isNullOrUndefined(p)?(t.series.visibility=t.series.visibility.toLowerCase()==="visible"?"hidden":"visible",this.model.series[i].visibility=t.series.visibility,this._notifyArrayChange&&this._notifyArrayChange("series["+i+"]visibility",t.series.visibility)):(w=t.series.trendlines[p].visibility.toLowerCase(),w=w==="visible"?"hidden":"visible",this.model.series[i].trendlines[p].visibility=w,this._notifyArrayChange&&this._notifyArrayChange("series["+i+"].trendlines["+p+"].visibility",w))):(this.model._isPieOfPie?(ft=this._getPieOfPiePoint(t.legendItem.LegendItem.ActualIndex,t.series,t)._visibility,u=t.legendItem.LegendItem.ActualIndex):(ft=t.series.visiblePoints[t.legendItem.LegendItem.PointIndex]._visibility,u=t.series.visiblePoints[t.legendItem.LegendItem.PointIndex].actualIndex),t.series.points[u]._visibility=ft==="visible"?"hidden":"visible"),this.model.enableCanvasRendering&&(et=document.getElementById(this._id).getClientRects()[0],this.svgRenderer.ctx.clearRect(0,0,et.width,et.height),$("#"+this._id).find('[id*="canvas_symbol"]').remove()),$(this.svgObject).empty(),$(this.legendSvgContainer).empty(),nt=0;nt<this.model.series.length;nt++)this.model.series[nt].regionAdded=!1;this.model.legendCollapsed=!0;this.disableAnimation();this.draw();this.enableAnimation();this.model.AreaType!="none"&&this.zoomed&&this._enableZoomingButtons()}if(ot=this.getAxisLabelData(n),ot&&(r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=ot,this._trigger("axisLabelClick",r)),st=this.getAxisMultiLevelLabelsData(n),st&&(r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data=st,this._trigger("multiLevelLabelClick",r)),v.indexOf("annotation_")>=0){var dt=v.lastIndexOf("_"),gt=v.substr(dt+1,v.length),l=parseInt(gt),r=$.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={location:{x:this.mousemoveX,y:this.mousemoveY},contentData:this.model.annotations[l],pageX:n.pageX,pageY:n.pageY};this._trigger("annotationClick",r)}isSelectionSetting=ej.isNullOrUndefined(i)?!1:this.model._visibleSeries[i].selectionSettings.enable;!ej.isNullOrUndefined(i)&&!t&&isSelectionSetting&&(!this.isTouch(n)||!this.model.crosshairMoved&&Math.abs(ct-this.model.cachedX)<b&&Math.abs(lt-this.model.cachedY)<b)&&(bt=k[i].selectionSettings.type.toLowerCase()=="multiple"?!0:!1,vt=k[i].selectionSettings.mode,vt.toLowerCase()!="range"&&this.segmentSelection(n,t,i,u,s,k));this.model.crosshairMoved=!1;r=$.extend({},ej.EjSvgRender.commonChartEventArgs);r.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:v,pageX:n.pageX,pageY:n.pageY};this._trigger("chartClick",r)},getTargetId:function(n,t,i){var r,u=this.model._visibleSeries[n].type.toLowerCase(),f=(u.indexOf("area")!=-1||u.indexOf("line")!=-1||u.indexOf("scatter")!=-1?!0:!1)?!0:!1;return this.model.enable3D?$("[id*=_Region_Series_"+n+"_Point_"+t+"]").each(function(){r=this.id}):i!="series"||this.model.AreaType=="none"?f?$("[id*="+this.svgObject.id+"_Series"+n+"_Point"+t+"_symbol]").each(function(){r=this.id}):$("[id$="+this.svgObject.id+"_Series"+n+"_Point"+t).each(function(){r=this.id}):$("[id*="+this.svgObject.id+"_Series"+n+"]").each(function(){r=this.id}),r},findCanvasSelection:function(n,t,i){var r;return r=i=="point"?$("#"+this._id+"_Selection_series"+n+"_point_"+t+"_canvas").length:i=="series"?$("#"+this._id+"_Selection_series"+n+"_canvas").length:$("#"+this._id+"_Selection_Cluster_point_"+t+"_canvas").length,r==1?!0:!1},segmentSelection:function(n,t,i,r,u){var v=this.model._visibleSeries,b=v[i],it,rt,ot,st,p,ht,w,ct,f,lt;if(ej.isNullOrUndefined(b))return 0;var k=b.selectionSettings,vt=k.enable,y=k.type.toLowerCase()=="multiple"?!0:!1,e=k.mode,ut=!1,at=this,a,c,l,ft,h,s,u,o,d,g,nt,et,tt;if(this.model.isSelected=!0,!ej.isNullOrUndefined(r)&&e=="cluster"){for(it=[],st=v[i]._visiblePoints[r].xValue,p=0,ht=v.length;p<ht;p++)for(rt=v[p].points,ot=rt.length,w=0;w<ot;w++)st==rt[w].xValue&&(it[it.length]={seriesIndex:p,pointIndex:w});this.model.clusterPoints=it}if(this.model.enableCanvasRendering||(a=this.getTargetId(i,r,e),a&&(c=$("#"+a)[0].parentNode.id,ct=$("#"+c)[0],ct!=null&&c&&(ft=c.indexOf(this.svgObject.id+"_TextGroup_")>=0||c.indexOf(this.svgObject.id+"_symbolGroup")>=0?!0:!1,c.indexOf(this.svgObject.id+"_TrackSymbol_")>=0&&(ft=!0,ut=!0)))),this.model.enableCanvasRendering?l=this.findCanvasSelection(i,r,e):(tt=$("#"+a).attr("class")?$("#"+a).attr("class"):"",l=tt.indexOf("Selection")!=-1?!0:!1,this.model.enable3D&&(tt=$("[id*=_Region_Series_"+i+"_Point_"+r+"]").attr("class")?$("[id*=_Region_Series_"+i+"_Point_"+r+"]").attr("class"):"",l=tt.indexOf("Selection")!=-1?!0:!1)),(l||!y||y)&&(this.removeSelection(i,r,v,e,y,t,l),u=this.model.selectedDataPointIndexes,o=u.length,o>0&&!this.model._isStateChaged))if(y){if(l)for(f=0;f<o;f++)h=u[f].seriesIndex,s=u[f].pointIndex,d=e=="series"&&h==i,g=(e=="point"||this.model.AreaType=="none")&&h==i&&s==r,nt=e=="cluster"&&s==r,((d||nt)&&this.model.AreaType!="none"||g)&&(u.splice(f,1),o=u.length,f=-1)}else for(f=0;f<o;f++)h=u[f].seriesIndex,s=u[f].pointIndex,d=e=="series"&&(h==i&&s==r||h!=i||s!=r),g=(e=="point"||this.model.AreaType=="none")&&h==i&&s==r,nt=e=="cluster"&&s==r,(d||g||nt)&&(u.splice(f,1),o=u.length,f=-1);if(!l&&(this.model.enableCanvasRendering?this.canvasSelection(this,n,b,t,i,r,u,k):this.selection(at,n,b,ut,t,i,r,c,a,u),u=this.model.selectedDataPointIndexes,o=u.length,!this.model._isStateChaged))if(o>0)if(y)u.push({event:n,legendData:t,seriesIndex:i,pointIndex:r,data:u});else{for(f=0;f<o;f++)h=u[f].seriesIndex,s=u[f].pointIndex,et=(e=="series"||e=="cluster"||this.model.AreaType=="none")&&(u[f].SeriesIndex!=i||u[f].PointIndex!=r),pointFlag=e=="point"&&u[f].SeriesIndex==i,(et||pointFlag)&&(u.splice(f,1),o=this.model.selectedDataPointIndexes.length,f=-1);u.push({event:n,legendData:t,seriesIndex:i,pointIndex:r,data:u})}else u.push({event:n,legendData:t,seriesIndex:i,pointIndex:r,data:u});lt={selectedData:this.model.selectedDataPointIndexes};this._trigger("seriesRegionClick",lt)},legendSelection:function(n,t,i,r){var e=this.model.selectedDataPointIndexes?this.model.selectedDataPointIndexes:[],o=this.model._visibleSeries.length,u=n.model.AreaType=="none"&&o==1?t.legendItem.LegendItem.PointIndex:t.legendItem.LegendItem.SeriesIndex,f;if(seriesIndex=t.legendItem.LegendItem.SeriesIndex,pointIndex=u,legendItem=n.svgObject.id+"_LegendItemShape"+u,legendClass=$("#"+legendItem).attr("class")?$("#"+legendItem).attr("class"):"",$("#"+n._id+"_Selection_Legend"+u+"_canvas").length==1||legendClass.indexOf("Selection")!=-1){for($("#"+n._id+"_Selection_Legend"+u+"_canvas").remove(),$("[id*="+n._id+"_Selection_series"+u+"]").remove(),$("#"+this._id+"_Selection_series"+seriesIndex+"_point_"+pointIndex+"_canvas").remove(),$("#"+legendItem).attr("class",""),$("[id*="+n.svgObject.id+"_Series"+seriesIndex+"]").attr("class",""),$("[id*=_Region_Series_"+seriesIndex+"]").attr("class",""),f=0;f<e.length;f++)if(e[f].seriesIndex==u||this.model.AreaType=="none"&&e[f].pointIndex==u){e.splice(f,1);break}}else n.segmentSelection(i,t,seriesIndex,pointIndex,r)},chartMouseClick:function(n){this.cancelEvent(n);window.navigator.msPointerEnabled&&(n=n.originalEvent);this._doClick(n)},chartMouseDoubleClick:function(n){window.navigator.msPointerEnabled&&(n=n.originalEvent);var t=$.extend({},ej.EjSvgRender.commonChartEventArgs);t.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:n.target.id,pageX:n.pageX,pageY:n.pageY};this._trigger("chartDoubleClick",t)},drawTrackerSymbol:function(n,t,i,r,u,f,e){var h=n.type.toLowerCase(),a,v,y=new ej.seriesTypes[h],c=n.type.toLowerCase()=="boxandwhisker"?e:i,o=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),p,s,l,w;a=n.isTransposed?n.yAxis.plotOffset:n.xAxis.plotOffset;v=n.isTransposed?n.xAxis.plotOffset:n.yAxis.plotOffset;p={id:this.svgObject.id+"_ClipRectTrack_"+t,x:-a,y:-v,width:o.width+a*2,height:o.height+v*2,fill:"white","stroke-width":1,stroke:"Gray"};this.model.AreaType!="none"&&(this.model.AreaType=="cartesianaxes"&&u.X+o.x<=o.x+o.width&&(u.X+o.x>=o.x||u.X==0)&&(u.Y+o.y>=o.y||u.Y==0)?this.model.crosshair.visible||h=="bubble"||h=="scatter"?(n.trackerRemoved||(s=this.svgObject.id+"_TrackSymbol_"+t,s=h=="boxandwhisker"?s+c:s,$("#"+this._id).find("[id*="+s+"]").remove(),s="canvas_trackSymbol_"+t,s=h=="boxandwhisker"?s+c:s,$("#"+this._id).find("[id*="+s+"]").remove()),l={"clip-path":"url(#"+this.svgObject.id+"_ClipRectTrack_"+t+")","class":"Tracker",id:this.svgObject.id+"_TrackSymbol_"+t+"_"+c,transform:"translate("+o.x+","+o.y+")"},this.gTrackerEle=this.svgRenderer.createGroup(l)):this.gTrackerEle=null:($("#"+this.svgObject.id+"_TrackSymbol_"+t+"_"+c).remove(),l={id:this.svgObject.id+"_TrackSymbol_"+t+"_"+c},this.gTrackerEle=this.svgRenderer.createGroup(l),this.model.enableCanvasRendering||(this.model.AreaType=="polaraxes"?this.gTrackerEle.setAttribute("clip-path","url(#"+this.svgObject.id+"_SeriesGroup_"+t+"_ClipRect)"):(this.gTrackerEle.setAttribute("clip-path","url(#"+this.svgObject.id+"_ClipRectTrack_"+t+")"),this.gTrackerEle.setAttribute("transform","translate("+o.x+","+o.y+")")))),$("#"+this.svgObject.id+"_CrosshairGroup").length==0&&(w={id:this.svgObject.id+"_CrosshairGroup",visibility:"visible"},this.gTrackball=this.svgRenderer.createGroup(w),this.svgRenderer.append(this.gTrackball,this.svgObject)),this.model.crosshair.marker.visible&&!n.isIndicator&&n._visiblePoints[i].visible&&(y.drawSymbol(t,n,i,u.X,u.Y,this,r,e),u.low&&y.drawSymbol(t,n,i,this.model.requireInvertedAxes?u.low:u.X,this.model.requireInvertedAxes?u.Y:u.low,this,r)),this.gTrackerEle&&$("#"+this.gTrackerEle.id).length<1&&this.svgRenderer.append(this.gTrackerEle,this.gTrackball));$(this.svgObject).find("#"+this.svgObject.id+"_ClipRectTrack_"+t).length!=0||this.vmlRendering||this.svgRenderer.drawClipPath(p,$("#"+this.svgObject.id+"_CrosshairGroup"))},getClosesPointXY:function(n,t,i,r,u,f){var b,s=ej.EjSvgRender.utils._getTransform(i.xAxis,i.yAxis,this.model.requireInvertedAxes),k,d,o,a,nt,p,v,y=10,g=this.isTouch(f),tt=i._visiblePoints?i._visiblePoints.length:0,w,e=i.marker?$.extend(!0,{},i.marker.size):{height:6,width:6},h,c,l;if(e.height=g&&e.height<y*2?e.height+y:e.height,e.width=g&&e.width<y*2?e.width+y:e.width,u<=s.y+s.height&&s.y<=u&&s.x<=r&&r<=s.x+s.width)for(h=0;h<tt;h++){if(o=i._visiblePoints[h],a=o.location,p=!1,nt=h,v=null,w=null,i.type=="boxandwhisker"&&!this.model.enable3D&&!ej.util.isNullOrUndefined(o.boxPlotLocation))for(c=0;c<o.boxPlotLocation.length;c++)l={X:o.boxPlotLocation[c].X,Y:o.boxPlotLocation[c].Y},o.boxPlotLocation[c].outlier==!0&&r>l.X+s.x-e.width&&r<l.X+s.x+e.width&&(v=o.x,ej.util.isNullOrUndefined(v)&&(p=o.visible),u>l.Y+s.y-e.height&&u<l.Y+s.y+e.height+y&&(w=o.boxPlotValues.outliers[c],k={X:l.X,Y:l.Y}),ej.util.isNullOrUndefined(k)||(b=o,d=h));a&&(r>a.X+s.x-e.width/2&&r<a.X+s.x+e.width/2&&(v=o.x,ej.util.isNullOrUndefined(v)&&(p=o.visible)),u>a.Y+s.y-e.height/2&&u<a.Y+s.y+e.height/2&&(w=o.YValues[0]),ej.util.isNullOrUndefined(v)&&!p||ej.util.isNullOrUndefined(w)||(b=o,d=h))}return{point:b,index:d,outlierPosition:k}},getClosestPointX:function(n,t,i,r){var e=[],f=ej.EjSvgRender.utils._getTransform(t.xAxis,t.yAxis,this.model.requireInvertedAxes),u;this.model.requireInvertedAxes?(i=Math.abs(r-(f.y+f.height)),r=Math.abs(i-f.x)):(i=Math.abs(i-f.x),r=Math.abs(r-(f.y+f.height)));var s=ej.EjSvgRender.utils._getValuebyPoint(i,r,t),h=this.model.requireInvertedAxes?s.PointX:s.PointX,o=[];return $.each(t.points,function(t,i){n.push(i.xValue)}),u=this.getClosest(n,h),ej.util.isNullOrUndefined(u)||(typeof u=="number"?$.each(t._visiblePoints,function(n,t){t.xValue==u&&(e.push(t),o.push(n))}):(u=u.getTime(),$.each(t._visiblePoints,function(n,t){t.xValue.getTime()==u&&(e.push(t),o.push(n))}))),{point:e,index:o}},getClosest:function(n,t){var i=null,f,u,r;if(this._beforeMin=!1,this._afterMax=!1,f=Math.min.apply(null,n),u=Math.max.apply(null,n),t>=f-.5&&t<=u+.5){for(r=0;r<n.length;r++)(i==null||Math.abs(n[r]-t)<Math.abs(i-t))&&(i=n[r]);this._closest=null}else t>u?(i=n[n.length-1],this._closest=ej.util.isNullOrUndefined(this._closest)?i:i>this._closest?i:this._closest,this._afterMax=!0):(i=n[0],this._closest=ej.util.isNullOrUndefined(this._closest)?i:i<this._closest?i:this._closest,this._beforeMin=!0);return i},createTooltip:function(n,t,i){var y,w,nt,f,e,tt,h,u,b,v,it,d,g,p,l;i||(i=this.model._visibleSeries[n.SeriesIndex]);var ft=i.type=="pieofpie"?this._getPieOfPiePoint(n.Region.PointIndex,i):i._visiblePoints[n.Region.PointIndex],r=this.dragPoint?i.pointCollection[n.Region.PointIndex]:$.extend(!0,{},ft),a=10;if(r.visible){if(y=i.tooltip.format,i.type=="boxandwhisker"){if(w=this.calMousePosition(t),this.mousemoveX=w.X,this.mousemoveY=w.Y,nt=n.Region.Bounds?!0:!1,nt)if(n.Region.Bounds.Width==i.outlierSettings.size.width)for(f=0;f<r.boxPlotLocation.length;f++)r.boxPlotLocation[f].outlier==!0&&r.boxPlotLocation[f].X+i.outlierSettings.size.width/2>this.mousemoveX-i.xAxis.x&&r.boxPlotLocation[f].X-i.outlierSettings.size.width/2<this.mousemoveX-i.xAxis.x&&r.boxPlotLocation[f].Y+i.outlierSettings.size.height/2>this.mousemoveY-i.yAxis.y&&r.boxPlotLocation[f].Y-i.outlierSettings.size.height/2<this.mousemoveY-i.yAxis.y&&(e=this.getTooltipFormat(r,i,n.SeriesIndex,n.Region.PointIndex,y,r.boxPlotLocation[f]),r.x=e.data.x,r.y=e.text);else e=this.getTooltipFormat(r,i,n.SeriesIndex,n.Region.PointIndex,y,r.boxPlotLocation[0]),r.x=e.data.x,r.y=e.text}else e=this.getTooltipFormat(r,i,n.SeriesIndex,n.Region.PointIndex,y),r.x=e.data.x,r.y=e.data.y;tt=null;h=$.extend({},ej.EjSvgRender.commonChartEventArgs);h.data={currentText:tt,seriesIndex:n.SeriesIndex,pointIndex:n.Region.PointIndex,series:i};this._trigger("toolTipInitialize",h);u=$(".tooltipDiv"+this._id);$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden");$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden").hide();$(".tooltipDiv"+this._id).length==0?(this.tooltipFirst=!0,u=$("<div><\/div>").attr("class","tooltipDiv"+this._id).css({position:"absolute","z-index":"13000",display:"block"}),$(document.body).append(u),$(".tooltipDiv"+this._id).addClass(this.svgObject.id)):($(".tooltipDiv"+this._id).css("display","block"),this.tooltipFirst=!1);i.tooltip.template!=null?(b=$("#"+i.tooltip.template).clone(),$(".tooltipDiv"+this._id)[0].innerHTML="",$(b).css("display","block").appendTo(u),i.count=1,r.count=1,v=this.getSeriesColor(r,n.SeriesIndex,i),v?$(u).css("background-color",jQuery.type(v)=="array"?v[0].color:v):$(u).css("background-color",this.model.pointColors[n.Region.PointIndex]),it={series:i,point:r},ej.util.isNullOrUndefined(h.data.currentText)?$(u).html($(u).html().parseTemplate(it)):$(u).html($(b).html(h.data.currentText))):$(u).html(h.data.ToolTip);var o=this.model.m_AreaBounds,c=t.pageX+a,s=t.pageY+a,rt=$(u).width(),ut=$(u).height(),k=document.getElementById(this.svgObject.id).getClientRects()[0];(c===undefined||c===null)&&(c=t.pageX+a);(s===undefined||s===null)&&(s=t.pageY+a);d=c;g=s;c-$(this.svgObject).offset().left+rt>o.X+o.Width&&(p=c-(rt+2*a),d=p+$(document).scrollLeft());s-$(this.svgObject).offset().top+ut>o.Y+o.Height&&(p=s+ut-(o.Y+o.Height+k.top),g=s-p+$(document).scrollTop());$(u).css("left",d);$(u).css("top",g);l=i.tooltip;l.enableAnimation&&$(u).css({"transition-property":"left,top","-moz-transition-property":"left,top","-webkit-transition-property":"left,top","-o-transition-property":"left,top","transition-duration":l.duration,"-moz-transition-duration":l.duration,"-webkit-transition-duration":this.tooltipFirst?"0s":l.duration,"-o-transition-duration":l.duration});templateRect=$(u)[0].getBoundingClientRect();templateRect.top<o.Y+k.top&&$(u).css("top",o.Y+k.top+$(document).scrollTop())}},translate:function(n,t,i,r){var u=n.orientation.toLowerCase()=="horizontal"?t/n.width/r:i/n.height/r;n.zoomPosition=n.orientation.toLowerCase()=="horizontal"?ej.EjSvgRender.utils._minMax(n.zoomPosition+u,0,1-n.zoomFactor):ej.EjSvgRender.utils._minMax(n.zoomPosition-u,0,1-n.zoomFactor)},highlightFill:function(n,t,i,r,u){var e=t.model.seriesColors,h=t.model.pointColors,s=n.color,c=this.model._visibleSeries.length,o,f;return u&&t.model.AreaType=="none"&&(c==1?r=u.legendItem.LegendItem.PointIndex:i=u.legendItem.LegendItem.SeriesIndex),o=u?e[i]:r?t.model.series[i].points[r]?t.model.series[i].points[r].fill:null:null,f=s!=""?s:t.model.AreaType=="none"?h[r]:u?e[i]:o?o:e[i],Object.prototype.toString.call(f)==="[object Array]"&&(f=f[1].color),f},canvasHighlight:function(n,t,i,r){var o=i.highlightSettings,ut=i.data,h=o.color,l=o.opacity,a=o.border.color,v=o.border.width,b=o.pattern.toLowerCase(),vt=n.model.legend.visible,p=o.mode,c=i.seriesIndex,s=i.pointIndex,f=i.type.toLowerCase(),tt=document.getElementById(n._id+"_canvas").getBoundingClientRect(),e=[],ft=[],k=[],ct=this.model._visibleSeries.length,d=this.highlightFill(o,n,c,s,r),at,it,rt,g,et,i,nt,st,ot,w,ht,lt,u,y;if(n.model.AreaType!="none"||n.model.AreaType=="none"&&ct>1&&(p=="series"||r))for(u=0,y=n.model.chartRegions.length;u<y;u++)(p=="series"||r)&&c==n.model.chartRegions[u].SeriesIndex&&e.push(n.model.chartRegions[u].Region);else for(u=0,y=n.model.chartRegions.length;u<y;u++)c==n.model.chartRegions[u].SeriesIndex&&s==n.model.chartRegions[u].Region.PointIndex&&e.push(n.model._isPieOfPie?n._getPieOfPiePoint(n.model.chartRegions[u].Region.PointIndex,i):n.model.chartRegions[u].Region[s]);if(p=="cluster"&&n.model.Areatype!="none"&&typeof s!="undefined")for(at=n.model._visibleSeries[c]._visiblePoints[s].xValue,u=0,y=n.model._visibleSeries.length;u<y;u++)for(it=0;it<n.model._visibleSeries[u]._visiblePoints.length;it++)at==n.model._visibleSeries[u]._visiblePoints[it].xValue&&(k[k.length]={seriesIndex:u,pointIndex:it});for(rt=0;rt<k.length;rt++)for(clusterseriesIndex=k[rt].seriesIndex,clusterpointIndex=k[rt].pointIndex,g=0;g<n.model.chartRegions.length;g++)clusterseriesIndex==n.model.chartRegions[g].SeriesIndex&&clusterpointIndex==n.model.chartRegions[g].Region.PointIndex&&(p!="cluster"?e.push(n.model.chartRegions[g].Region):e.push(n.model.chartRegions[g]));if(et=n.model.AreaType=="none"&&ct==1?s:c,(p=="series"||r)&&$("#"+n._id+"_Selection_series"+et+"_canvas").length==0&&$("#"+n._id+"_Selection_Cluster_point_"+s+"_canvas").length==0&&$("#"+n._id+"_Selection_"+c+"_point_"+s+"_canvas").length==0)if(ft=i._visiblePoints,ctx=this.createCanvasElement(n._id+"_Highlight_series"+c+"_canvas",n.svgWidth,n.svgHeight,tt),h=b=="none"||b==""?d:this.canvasPattern(ctx,n,t,d,o),this.createRect(n,ctx),f.indexOf("column")!=-1||f.indexOf("waterfall")!=-1||f.indexOf("bar")!=-1)for(u=0;u<e.length;u++)ot=$("#"+n._id+"_Selection_"+c+"_point_"+u+"_canvas").length==0?!0:!1,this.canvasSeriesRect(e[u],l,a,v,h,ot,i);else f=="pie"||f=="doughnut"||f=="pieofpie"?(e=ct==1?e:e[0],this.canvasHighlightCircle(n,o,s,l,a,v,h,e,f,ctx)):f=="pyramid"||f=="funnel"?this.canvasHighlightPyramid(n,e[0],o,ctx,l,a,v,h,f):f=="bubble"?this.canvasBubbleHighlight(o,e,n,c,h,v,l,a):f=="scatter"&&this.canvasScatterHighlight(e,h,v,l,a);else if(p=="cluster"&&$("#"+n._id+"_Selection_Cluster_point_"+s+"_canvas").length==0&&this.model.AreaType!="none"&&$("#"+n._id+"_Selection_"+c+"_point_"+s+"_canvas").length==0&&$("#"+n._id+"_Selection_series"+c+"_canvas").length==0){for(u=0,y=this.model._visibleSeries.length;u<y;u++)i=this.model._visibleSeries[u],i.seriesIndex=u,ft.push(i._visiblePoints[s]);for(nt=[],st=[],ctx=this.createCanvasElement(n._id+"_Highlight__Cluster_point_"+s+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),u=0,y=this.model._visibleSeries.length;u<y;u++){for(nt=[],o=n.model._visibleSeries[u].highlightSettings,h=o.color,l=o.opacity,a=o.border.color,v=o.border.width,b=o.pattern.toLowerCase(),d=this.highlightFill(o,n,u,s,et,r),h=b=="none"||b==""?d:this.canvasPattern(ctx,n,t,d,o),st.push(h),w=0,ht=e.length;w<ht;w++)e[w].SeriesIndex==u&&nt.push(e[w].Region);if(f.indexOf("column")!=-1||f.indexOf("waterfall")!=-1||f.indexOf("bar")!=-1)for(ot=$("#"+n._id+"_Selection_"+u+"_point_"+s+"_canvas").length==0?!0:!1,w=0,ht=nt.length;w<ht;w++)this.canvasSeriesRect(nt[w],l,a,v,h,ot,i);else f=="bubble"?this.canvasBubbleHighlight(o,nt,n,u,h,v,l,a):f=="scatter"&&this.canvasScatterHighlight(nt,h,v,l,a)}}else(p=="cluster"&&this.model.AreaType=="none"||p=="point"&&$("#"+n._id+"_Selection_"+c+"_point_"+s+"_canvas").length==0&&$("#"+n._id+"_Selection_series"+c+"_canvas").length==0&&$("#"+n._id+"_Selection_Cluster_point_"+s+"_canvas").length==0)&&(ft[0]=this.model._isPieOfPie?this._getPieOfPiePoint(s,i):i._visiblePoints[s],ctx=this.createCanvasElement(n._id+"_Highlight_"+c+"_point_"+s+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),h=b=="none"||b==""?d:this.canvasPattern(ctx,n,t,d,o),f.indexOf("column")!=-1||f.indexOf("waterfall")!=-1||f.indexOf("bar")!=-1?(e=[],e[0]=ut.region.Region,this.canvasSeriesRect(e[0],l,a,v,h,!0,i)):f=="pie"||f=="doughnut"||f=="pieofpie"?(e=[],e[0]=ut.pointData[0],this.canvasHighlightCircle(n,o,s,l,a,v,h,e,f,ctx)):f=="pyramid"||f=="funnel"?this.canvasHighlightPyramid(n,e[0],o,ctx,l,a,v,h,f):f=="bubble"?(e=[],e[0]=ut.region.Region,this.canvasBubbleHighlight(o,e,n,c,h,v,l,a)):f=="scatter"&&(e=[],e[0]=ut.region.Region,this.canvasScatterHighlight(e,h,v,l,a)));if(vt&&$("#"+n._id+"_Selection_Legend"+et+"_canvas").length==0)if(p!="cluster"||r||this.model.AreaType=="none")this.canvasHighlightLegend(n,i,o,"Highlight",tt,h);else for(u=0,y=k.length;u<y;u++)lt=k[u].seriesIndex,chartSeries=this.model._visibleSeries[lt],this.canvasHighlightLegend(n,chartSeries,o,"Highlight",tt,st[lt]);i.visibility==="visible"&&i.marker.visible==!0&&this.model.AreaType!="none"&&this.canvasHighlightMarker(n,i,ft,o,ctx,t,st)},canvasSeriesRect:function(n,t,i,r,u,f,e){var o={opacity:t,stroke:i,"stroke-width":r,fill:u},s=e.cornerRadius,h;n&&(o.x=n.Bounds.X,o.y=n.Bounds.Y,o.width=n.Bounds.Width,o.height=n.Bounds.Height,f&&(typeof s!="object"&&s>0||s.topLeft>0||s.bottomLeft>0||s.topRight>0||s.bottomRight>0?(o.cornerRadius=e.cornerRadius,h=ej.EjSvgRender.utils._calculateroundedCorner(o),o.d=h,ej.EjCanvasRender.prototype.drawPath(o,ctx)):this.drawRect(o,ctx)))},canvasSelection:function(n,t,i,r,u,f,e,o){var rt,at,et,wt,bt,ut,h,kt,dt,gt,ot,ni,g,d,vt,ft,ti,st,ii;i.seriesIndex=u;i.pointIndex=f;var nt=this.model._visibleSeries,c=o.color,a=o.opacity,v=o.border.color,y=o.border.width,w=o.pattern.toLowerCase(),yt=n.model.legend.visible,b=o.mode,s=i.type.toLowerCase(),tt=document.getElementById(n._id+"_canvas").getBoundingClientRect(),l=[],it=[],ht=this.model._visibleSeries.length,p=n.model.chartRegions,ct=this.model.clusterPoints,ui={seriesIndex:u,series:i},ri=n.model.AreaType=="none"&&ht==1?f:u,k=this.highlightFill(o,n,u,f,r,e),lt,pt;if(lt=p.length,n.model.AreaType!="none"||n.model.AreaType=="none"&&ht>1)for(h=0;h<lt;h++)((b=="series"||r)&&u==p[h].SeriesIndex||(b=="point"||r)&&u==p[h].SeriesIndex&&f==p[h].Region.PointIndex)&&(n.model.AreaType!="none"||b!="point"||r?l.push(p[h].Region):l.push(p[h].Region[f]));else if(lt>0){if(this.model._isPieOfPie){if(r)for(rt=0;rt<i.pieCollections.length;rt++)for(at=i.pieCollections[rt],et=0;et<at.length;et++)if(at[et].actualIndex==r.legendItem.LegendItem.PointIndex){wt=rt;break}bt=i.data?i.data.pointData[0].PieSeriesIndex:wt;ut=p[bt]}else ut=p[0];for(pt=ut.Region.length,h=0;h<pt;h++)f==ut.Region[h].PointIndex&&l.push(ut.Region[h])}if((b=="series"||r)&&(this.model.AreaType!="none"||this.model.AreaType=="none"&&ht>1))if(it=i._visiblePoints,ctx=this.createCanvasElement(n._id+"_Selection_series"+ri+"_canvas",n.svgWidth,n.svgHeight,tt),c=w=="none"||w==""?k:this.canvasPattern(ctx,n,t,k,o),this.createRect(n,ctx),s.indexOf("column")!=-1||s.indexOf("waterfall")!=-1||s.indexOf("bar")!=-1)for(h=0;h<l.length;h++)this.canvasSeriesRect(l[h],a,v,y,c,!0,i);else s=="pie"||s=="doughnut"||s=="pieofpie"?this.canvasHighlightCircle(n,o,f,a,v,y,c,l[0],s,ctx):s=="bubble"?this.canvasBubbleHighlight(o,l,n,u,c,y,a,v):s=="scatter"&&this.canvasScatterHighlight(l,c,y,a,v);else if(b=="cluster"&&this.model.AreaType!="none"&&$("#"+n._id+"_Selection_Cluster_point_"+f+"_canvas").length==0){for(kt=ct.length,g=0;g<kt;g++)dt=ct[g].seriesIndex,gt=ct[g].pointIndex,ot=$.grep(p,function(n){return n.SeriesIndex==dt&&n.Region.PointIndex==gt}),ni=ot.length,ni>0?(l.push(ot[0]),it.push(nt[ot[0].SeriesIndex]._visiblePoints[f])):it.push(nt[g]._visiblePoints[f]);for(this.selectedPoint=f,d=[],vt=[],ctx=this.createCanvasElement(n._id+"_Selection_Cluster_point_"+f+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),h=0,len=nt.length;h<len;h++){for(d=[],highlight=nt[h].selectionSettings,c=highlight.color,a=highlight.opacity,v=highlight.border.color,y=highlight.border.width,w=highlight.pattern.toLowerCase(),k=this.highlightFill(highlight,n,h,f,r),c=w=="none"||w==""?k:this.canvasPattern(ctx,n,t,k,highlight),vt.push(c),ft=0,ti=l.length;ft<ti;ft++)l[ft].SeriesIndex==h&&d.push(l[ft].Region);if(s.indexOf("column")!=-1||s.indexOf("waterfall")!=-1||s.indexOf("bar")!=-1)for(st=0,ii=d.length;st<ii;st++)this.canvasSeriesRect(d[st],a,v,y,c,!0,i);else s=="bubble"?this.canvasBubbleHighlight(highlight,d,n,h,c,y,a,v):s=="scatter"&&this.canvasScatterHighlight(d,c,y,a,v);!r&&this.model.AreaType!="none"&&yt&&(i=nt[h],i.seriesIndex=h,this.canvasHighlightLegend(n,i,o,"SelectionCluster",tt,c))}}else(b=="point"&&$("#"+n._id+"_Selection_"+u+"_point_"+f+"_canvas").length==0||this.model.AreaType=="none")&&(this.selectedPoint=f,it[0]=this.model._isPieOfPie?this._getPieOfPiePoint(f,i):i._visiblePoints[f],ctx=this.createCanvasElement(n._id+"_Selection_series"+u+"_point_"+f+"_canvas",n.svgWidth,n.svgHeight,tt),this.createRect(n,ctx),c=w=="none"||w==""?k:this.canvasPattern(ctx,n,t,k,o),s.indexOf("column")!=-1||s.indexOf("waterfall")!=-1||s.indexOf("bar")!=-1?this.canvasSeriesRect(l[0],a,v,y,c,!0,i):s=="pie"||s=="doughnut"||s=="pieofpie"?this.canvasHighlightCircle(n,o,f,a,v,y,c,l,s,ctx):s=="pyramid"||s=="funnel"?this.canvasHighlightPyramid(n,l[0],o,ctx,a,v,y,c,s):s=="bubble"?this.canvasBubbleHighlight(o,l,n,u,c,y,a,v):s=="scatter"&&this.canvasScatterHighlight(l,c,y,a,v));yt&&(b!="cluster"||r)&&this.canvasHighlightLegend(n,i,o,"Selection",tt,c);i.marker.visible==!0&&this.model.AreaType!="none"&&this.canvasHighlightMarker(n,i,it,o,ctx,t,vt)},createRect:function(n,t){n.model.AreaType!="none"&&(t.lineWidth=0,t.strokeStyle="transparent",t.rect(n.model.m_AreaBounds.X,n.model.m_AreaBounds.Y,n.model.m_AreaBounds.Width,n.model.m_AreaBounds.Height),t.clip(),t.stroke(),t.save())},canvasHighlightPyramid:function(n,t,i,r,u,f,e,o,s){var v=i.color!=""?i.color:n.model.pointColors[t.PointIndex],a=n.model.title.text?ej.EjSvgRender.utils._measureText(n.model.title.text,$(this.svgObject).width()-n.model.margin.left-n.model.margin.right,n.model.title.font):0,h=n.pyrX=(n.model.legend.position.toLowerCase()==="left"?n.model.LegendViewerBounds.Width:0)+n.model.elementSpacing+n.model.margin.left,c=n.pyrY=(n.model.legend.position.toLowerCase()==="top"?n.model.LegendViewerBounds.Height:0)+(n.model.title.text?n.model._titleLocation.Y+a.height:n.model.margin.top+n.model.elementSpacing),l={opacity:u,stroke:f,"stroke-width":e,fill:o,type:s,d:"M "+(h+t.Line1.x)+" "+(c+t.Line1.y)+" L "+(h+t.Line2.x)+" "+(c+t.Line2.y)+" L "+(h+t.Line3.x)+" "+(c+t.Line3.y)+" L "+(h+t.Line4.x)+" "+(c+t.Line4.y)+" z"};s=="funnel"&&(l.d="M "+(h+t.Line1.x)+" "+(c+t.Line1.y)+" L "+(h+t.Line2.x)+" "+(c+t.Line2.y)+" L "+(h+t.Line3.x)+" "+(c+t.Line3.y)+" L "+(h+t.Line4.x)+" "+(c+t.Line4.y)+" L "+(h+t.Line5.x)+" "+(c+t.Line5.y)+" L "+(h+t.Line6.x)+" "+(c+t.Line6.y)+" z");ej.EjCanvasRender.prototype.drawPath(l,r)},canvasScatterHighlight:function(n,t,i,r,u){for(var o,f={},s={},e=0;e<n.length;e++)o={startX:n[e].Bounds.X+n[e].Bounds.Height/2,startY:n[e].Bounds.Y+n[e].Bounds.Width/2},s.height=n[e].Bounds.Height,s.width=n[e].Bounds.Width,f={},f.ShapeSize=s,f.cx=o.startX,f.cy=o.startY,f.Style={},f.Style.BorderColor=u,f.Style.Color=t,f.Style.Opacity=r,f.Style.BorderWidth=i,ej.EjSvgRender.chartSymbol._drawCircle(o,f,this,ctx)},canvasBubbleHighlight:function(n,t,i,r,u,f,e,o){for(var h,l,c={},s=0;s<t.length;s++)h=t[s].Bounds.Height/2,l=n.color!=""?n.color:i.model.seriesColors[r],c={cx:t[s].Bounds.X-this.model.series[r].xAxis.x+h+this.canvasX,cy:t[s].Bounds.Y-this.model.series[r].yAxis.y+h+this.canvasY,r:h,fill:u,"stroke-width":f,opacity:e,stroke:o},ej.EjCanvasRender.prototype.drawCircle(c,ctx)},canvasHighlightCircle:function(n,t,i,r,u,f,e,o,s,h){for(var a,l,c=0;c<o.length;c++)a=t.color!=""?t.color:t.mode=="series"&&n.model._visibleSeries.length>1?n.model.pointColors[c]:n.model.pointColors[i],l={opacity:r,stroke:u,lineWidth:f,color:e,x:o[c].StartX,y:o[c].StartY,radius:n.model._isPieOfPie?n.model.circularRadius[o[c].PieSeriesIndex]:n.model.circularRadius[o[c].SeriesIndex],innerRadius:n.model.innerRadius[o[c].SeriesIndex],startAngle:o[c].StartAngle,endAngle:o[c].EndAngle,type:s},this.highlightSegment(h,l)},canvasHighlightMarker:function(n,t,i,r,u,f,e){var s=r,y=s.pattern.toLowerCase(),p=t.type.toLowerCase(),o={},w=s.color!=""?s.color:n.model.seriesColors[t.seriesIndex],h,a,c,v,l;for(color=y=="none"||y==""?w:this.canvasPattern(u,n,f,w,s),o.Style={},o.Style.BorderColor=s.border.color,o.Style.Opacity=s.opacity,o.Style.BorderWidth=s.border.width,l=0;l<i.length;l++)h=i[l].symbolLocation,h=p.indexOf("line")!=-1||p.indexOf("area")!=-1?i[l].location:i[l].symbolLocation,h&&(a=this.model.AreaType=="cartesianaxes"?{startX:h.X+this.canvasX,startY:h.Y+this.canvasY}:{startX:h.X,startY:h.Y},c=t.marker,v,$.each(n.model.symbolShape,function(n){c.shape.toLowerCase()==n.toLowerCase()&&(v=n)}),o.ShapeSize=c.size,o.r=Math.sqrt(c.size.height*c.size.height+c.size.width*c.size.width)/2,o.cx=a.startX,o.cy=a.startY,o.Style.Color=e?e[l]:color,ej.EjSvgRender.chartSymbol["_draw"+v](a,o,n,u))},canvasHighlightLegend:function(n,t,i,r,u,f){var o=this.model._visibleSeries.length,e=n.model.AreaType=="none"&&o==1?t.pointIndex:t.seriesIndex,c=n._id+"_"+r+"_Legend"+e+"_canvas";if($("#"+c).length==0&&e<t.points.length){legendCtx=this.createCanvasElement(n._id+"_"+r+"_Legend"+e+"_canvas",n.svgWidth,n.svgHeight,u);legendRegion=n.model.AreaType!="none"||n.model.AreaType=="none"&&o>1?n.model.legendRegion[t.seriesIndex]:n.model.legendRegion[t.pointIndex];var s={startX:legendRegion.Bounds.LegendBound.X+legendRegion.Location.startX,startY:legendRegion.Bounds.LegendBound.Y+legendRegion.Location.startY},l={svgRenderer:n.svgRenderer,svgObject:n.svgObject},h={SeriesIndex:e,Style:{Color:f,Opacity:i.opacity,Visibility:!0,BorderWidth:0,BorderColor:f},context:!0,ShapeSize:legendRegion.Style.ShapeSize};legendRegion.SymbolShape.toLowerCase()=="seriestype"?(n.legendItem=legendRegion.LegendItem,ej.EjSvgRender.chartSymbol["_draw"+legendRegion.SymbolShape](s,h,n)):ej.EjSvgRender.chartSymbol["_draw"+legendRegion.SymbolShape](s,h,l,legendCtx)}},createCanvasElement:function(n,t,i,r){svgObj=document.createElement("canvas");_rootId=jQuery(this.element).attr("id");svgObj.setAttribute("id",n);svgObj.height=i;svgObj.width=t;svgObj.style["touch-action"]&&(svgObj.style["touch-action"]="none");svgObj.style["-ms-touch-action"]&&(svgObj.style["-ms-touch-action"]="none");this.svgRenderer.append(svgObj,this.element);var u=document.getElementById(n);return u.style.left=r.left+$(document).scrollLeft()+"px",u.style.top=r.top+$(document).scrollTop()+"px",u.style.position="absolute",svgObj.getContext("2d")},highlightSegment:function(n,t){n.save();n.beginPath();t.type=="pie"||t.type=="pieofpie"?(n.moveTo(t.x,t.y),n.arc(t.x,t.y,t.radius,t.startAngle-1.57,t.endAngle-1.57,!1)):(n.arc(t.x,t.y,t.radius,t.startAngle-1.57,t.endAngle-1.57,!1),n.arc(t.x,t.y,t.innerRadius,t.endAngle-1.57,t.startAngle-1.57,!0));n.fillStyle=t.color;n.globalAlpha=t.opacity;n.fill();n.lineWidth=t.lineWidth;n.strokeStyle=t.stroke;n.clip();n.stroke();n.closePath();n.restore()},canvasPattern:function(n,t,i,r,u){var c=u,a=c.name,l=c.pattern.toLowerCase(),e=r,s=c.opacity,v=c.border.color,y=c.border.width,o=document.createElement("canvas"),h=o.getContext("2d"),f=[];switch(l){case"chessboard":f[0]={x:0,y:0,width:10,height:10,fill:"white",stroke:"white",opacity:s,name:"rect"};f[1]={x:0,y:0,width:5,height:5,fill:e,opacity:s,name:"rect"};f[2]={x:5,y:5,width:5,height:5,fill:e,opacity:s,name:"rect"};o.width=10;o.height=10;this.loadPattern(t,f,"",h);break;case"pacman":f[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 9.081 9.194 L 14.887 6.114 C 14.075000000000001 4.618 12.484 3.0620000000000007 10.596 3.0620000000000007 L 8.835 3.0620000000000007 C 6.138 3.063 3 6.151 3 8.723 L 3 10.402000000000001 C 3 12.974 6.138 16.063000000000002 8.835 16.063000000000002 L 10.596 16.063000000000002 C 12.681000000000001 16.063000000000002 14.431000000000001 14.303000000000003 15.131 12.549000000000003 L 9.081 9.194 z","stroke-width":1,stroke:e,fill:e};o.width=18;o.height=18;this.loadPattern(t,f,"",h);break;case"crosshatch":f[0]={x:0,y:0,width:8,height:8,fill:"white",stroke:r,opacity:s,name:"rect"};f[1]={d:"M 0 0 L 8 8 Z","stroke-width":1,stroke:e,name:"path"};f[2]={d:"M 8 0 L 0 8 Z","stroke-width":1,stroke:e,name:"path"};o.width=8;o.height=8;this.loadPattern(t,f,"",h);break;case"dots":f[0]={x:0,y:0,width:7,height:7,transform:"translate(0,0)",fill:"white",opacity:s,name:"rect"};f[1]={cx:3,cy:3,r:2,"stroke-width":1,fill:e,name:"circle"};o.width=7;o.height=7;this.loadPattern(t,f,"",h);break;case"diagonalforward":f[0]={x:0,y:0,width:6,height:6,fill:"white",stroke:r,opacity:s,name:"rect"};f[1]={d:"M 3 -3 L 9 3 M 6 6 L 0 0 M 3 9 L -3 3","stroke-width":2,stroke:e,name:"path"};o.width=6;o.height=6;this.loadPattern(t,f,"",h);break;case"diagonalbackward":f[0]={x:0,y:0,width:6,height:6,"stroke-width":2,fill:"white",stroke:r,opacity:s,name:"rect"};f[1]={d:"M 3 -3 L -3 3 M 0 6 L 6 0 M 9 3 L 3 9","stroke-width":2,stroke:e,name:"path"};o.width=6;o.height=6;this.loadPattern(t,f,"",h);break;case"grid":f[0]={name:"rect",x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 1 3.5 L 11 3.5 M 0 3.5 L 11 3.5 M 0 7.5 L 11 7.5 M 0 11.5 L 11 11.5 M 5.5 0 L 5.5 12 M 11.5 0 L 11.5 12 Z","stroke-width":1,stroke:e};o.width=6;o.height=6;this.loadPattern(t,f,"",h);break;case"turquoise":f[0]={name:"rect",x:0,y:0,width:17,height:17,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 2.697 0.5319999999999996 C 3.8695005238907747 0.5319999999999996 4.82 1.4771268931071944 4.82 2.643 C 4.82 3.808873106892805 3.8695005238907747 4.754 2.697 4.754 C 1.5244994761092252 4.754 0.5739999999999998 3.808873106892805 0.5739999999999998 2.643 C 0.5739999999999998 1.4771268931071944 1.5244994761092252 0.5319999999999996 2.697 0.5319999999999996 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[2]={name:"path",d:"M 13.928 0.5319999999999996 C 15.100500523890776 0.5319999999999996 16.051000000000002 1.4771268931071944 16.051000000000002 2.643 C 16.051000000000002 3.808873106892805 15.100500523890776 4.754 13.928 4.754 C 12.755499476109225 4.754 11.805 3.808873106892805 11.805 2.643 C 11.805 1.4771268931071944 12.755499476109225 0.5319999999999996 13.928 0.5319999999999996 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[3]={name:"path",d:"M 8.313 0.5319999999999996 C 9.485500523890776 0.5319999999999996 10.436 1.4771268931071944 10.436 2.643 C 10.436 3.808873106892805 9.485500523890776 4.754 8.313 4.754 C 7.140499476109226 4.754 6.19 3.808873106892805 6.19 2.643 C 6.19 1.4771268931071944 7.140499476109226 0.5319999999999996 8.313 0.5319999999999996 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[4]={name:"path",d:"M 13.928 6.16 C 15.100500523890776 6.16 16.051000000000002 7.105126893107196 16.051000000000002 8.271 C 16.051000000000002 9.436873106892806 15.100500523890776 10.382000000000001 13.928 10.382000000000001 C 12.755499476109225 10.382000000000001 11.805 9.436873106892806 11.805 8.271 C 11.805 7.105126893107196 12.755499476109225 6.16 13.928 6.16 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[5]={name:"path",d:"M 8.313 6.16 C 9.485500523890776 6.16 10.436 7.105126893107196 10.436 8.271 C 10.436 9.436873106892806 9.485500523890776 10.382000000000001 8.313 10.382000000000001 C 7.140499476109226 10.382000000000001 6.19 9.436873106892806 6.19 8.271 C 6.19 7.105126893107196 7.140499476109226 6.16 8.313 6.16 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[6]={name:"path",d:"M 13.928 11.787999999999998 C 15.100500523890776 11.787999999999998 16.051000000000002 12.733126893107194 16.051000000000002 13.899 C 16.051000000000002 15.064873106892804 15.100500523890776 16.009999999999998 13.928 16.009999999999998 C 12.755499476109225 16.009999999999998 11.805 15.064873106892804 11.805 13.899 C 11.805 12.733126893107194 12.755499476109225 11.787999999999998 13.928 11.787999999999998 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};f[7]={name:"path",d:"M 8.313 11.787999999999998 C 9.485500523890776 11.787999999999998 10.436 12.733126893107194 10.436 13.899 C 10.436 15.064873106892804 9.485500523890776 16.009999999999998 8.313 16.009999999999998 C 7.140499476109226 16.009999999999998 6.19 15.064873106892804 6.19 13.899 C 6.19 12.733126893107194 7.140499476109226 11.787999999999998 8.313 11.787999999999998 Z","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e};o.width=17;o.height=17;this.loadPattern(t,f,"",h);break;case"star":f[0]={name:"rect",x:0,y:0,width:21,height:21,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 15.913 18.59 L 10.762 12.842 L 5.613 18.75 L 8.291 11.422 L 0.325 9.91 L 8.154 8.33 L 5.337 0.91 L 10.488 6.658 L 15.637 0.75 L 12.959 8.078 L 20.925 9.59 L 13.096 11.17 z","stroke-width":1,stroke:e,fill:e};o.width=21;o.height=21;this.loadPattern(t,f,"",h);break;case"triangle":f[0]={name:"rect",x:0,y:0,width:10,height:10,fill:"white",opacity:s};f[1]={name:"path",d:"M 4.987 0 L 7.48 4.847 L 9.974 9.694 L 4.987 9.694 L 0 9.694 L 2.493 4.847 z","stroke-width":1,stroke:e,fill:e};o.width=10;o.height=10;this.loadPattern(t,f,"",h);break;case"circle":f[0]={name:"rect",x:0,y:0,width:9,height:9,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"circle",cx:5.125,cy:3.875,r:3.625,"stroke-width":1,fill:e};o.width=9;o.height=9;this.loadPattern(t,f,"",h);break;case"tile":f[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0 9 L 0 0 L 9 0 z","stroke-width":1,stroke:e,fill:e};f[2]={name:"path",d:"M 9 9 L 9 0 L 18 0 z","stroke-width":1,stroke:e,fill:e};f[3]={name:"path",d:"M 0 18 L 0 9 L 9 9 z","stroke-width":1,stroke:e,fill:e};f[4]={name:"path",d:"M 9 18 L 9 9 L 18 9 z","stroke-width":1,stroke:e,fill:e};o.width=18;o.height=18;this.loadPattern(t,f,"",h);break;case"horizontaldash":f[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0 1.5 L 10 1.5 M 0 5.5 L 10 5.5 M 0 9.5 L 10 9.5 z","stroke-width":1,stroke:e,fill:e};o.width=12;o.height=12;this.loadPattern(t,f,"",h);break;case"verticaldash":f[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 1.5 0 L 1.5 10 M 5.5 0 L 5.5 10 M 9.5 0 L 9.5 10 z","stroke-width":1,stroke:e,fill:e};o.width=12;o.height=12;this.loadPattern(t,f,"",h);break;case"rectangle":f[0]={x:0,y:0,name:"rect",width:12,height:12,fill:"white",opacity:s};f[1]={name:"rect",x:1,y:2,width:4,height:9,fill:e,opacity:s};f[2]={name:"rect",x:7,y:2,width:4,height:9,fill:e,opacity:s};o.width=12;o.height=12;this.loadPattern(t,f,"",h);break;case"box":f[0]={x:0,y:0,name:"rect",width:13,height:13,fill:"white",opacity:s};f[1]={name:"rect",x:1.5,y:1.5,width:10,height:9,fill:e,opacity:s};o.width=10;o.height=10;this.loadPattern(t,f,"",h);break;case"horizontalstripe":f[0]={name:"rect",x:0,y:0,width:10,height:12,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0 0.5 L 10 0.5 M 0 4.5 L 10 4.5 M 0 8.5 L 10 8.5 z","stroke-width":1,stroke:e,fill:e};o.width=10;o.height=12;this.loadPattern(t,f,"",h);break;case"verticalstripe":f[0]={name:"rect",x:0,y:0,width:12,height:10,transform:"translate(0,0)",fill:"white",opacity:s};f[1]={name:"path",d:"M 0.5 0 L 0.5 10 M 4.5 0 L 4.5 10 M 8.5 0 L 8.5 10 z","stroke-width":1,stroke:e,fill:e};o.width=12;o.height=10;this.loadPattern(t,f,"",h);break;case"bubble":f[0]={name:"rect",x:0,y:0,width:20,height:20,transform:"translate(0,0)",fill:"#ffffff",opacity:s};f[1]={name:"circle",cx:5.217,cy:11.325,r:3.429,"stroke-width":1,fill:"#D0A6D1"};f[2]={name:"circle",cx:13.328,cy:6.24,r:4.884,"stroke-width":1,fill:e};f[3]={name:"circle",cx:13.277,cy:14.66,r:3.018,"stroke-width":1,fill:"#D0A6D1"};o.width=20;o.height=20;this.loadPattern(t,f,"",h);break;case"custom":o=document.getElementById(c.customPattern)}return n.createPattern(o,"repeat")},foundClasses:function(n){var t=[];return $("[id*="+n+"]").each(function(){var n=$(this).attr("class")?$(this).attr("class"):"";n.indexOf("Selection")>=0&&t.push(n)}),t},selection:function(n,t,i,r,u,f,e,o,s,h){var y=this.model.clusterPoints,vt=y?y.length:0,ht=this.model._visibleSeries,g=ht.length,l=this.model.AreaType=="none"&&g==1?e:f,a=i.selectionSettings,yt=this.model._visibleSeries[f].selectionSettings.type.toLowerCase()=="multiple"?!0:!1,c="series"+f,it=!1,pt=$("#"+s).attr("name"),rt=a.pattern.toLowerCase(),p=a.mode,ct,ot,w,tt,v,d,ft,nt,et,lt,at,ut,st,b;if(o&&(ct=o.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||o.indexOf(this.svgObject.id+"_Chart3D")>=0?!0:!1),(this.model.AreaType!="none"||this.model.AreaType=="none"&&p=="series"&&g>1)&&$("style").each(function(){$(this).html().indexOf("."+n._id+"SelectionStyle"+c)>-1&&(it=!0)}),!n.vmlRendering&&this.model.enable3D)(p=="series"||u)&&(this.model.AreaType!="none"||this.model.AreaType=="none"&&g!=1)?(this.highlightSeries(n,f,e,"Selection",c,a,t,u,h),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class","Selection"+c+"Style"+c+"1")):p=="cluster"&&n.model.AreaType!="none"?this.highlightCluster(n,f,e,"Selection",c,a,t,h):this.model.AreaType=="none"?(this.highlightPoint(n,f,e,"Selection",c+l,a,t,h),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class","Selection"+c+l+"Style"+c+l+"1")):(this.highlightPoint(n,f,e,"Selection",c,a,t,h),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class","Selection"+c+"Style"+c+"1"));else{if(p!="cluster"||u||n.model.AreaType=="none"){v={};v.name="2D";v.index=this.model.AreaType=="none"?l:f;v.api="Selection";v.color=a.color!=""?a.color:u?this.model.AreaType=="none"?this.model.pointColors[l]:this.model.seriesColors[l]:$("#"+s).attr("fill")!="none"?$("#"+s).attr("fill"):$("#"+s).attr("stroke");Object.prototype.toString.call(v.color)==="[object Array]"&&(v.color=v.color[1].color);var nt=rt=="none"||n.vmlRendering||rt==""?a.color:this.pattern(n,t,v,a),d=a.opacity,ft=a.border.color,et=a.border.width;it||(this.model.AreaType=="none"&&((p=="series"||u)&&g==1||p!="series"&&!u)?($("style").each(function(){$(this).html().indexOf(".SelectionStyle"+c+"Point"+l)>-1&&(it=!0)}),it||(this.createStyle(n,n._id+"Selection",c+"Point"+l,d,nt,ft,et),this.createStyle(n,n._id+"SelectionLegend",c+"Point"+l,d,nt,"transparent",0))):(this.model.AreaType=="none"&&g>1||this.model.AreaType!="none")&&(this.createStyle(n,n._id+"Selection",c,d,nt,ft,et),this.createStyle(n,n._id+"SelectionLegend",c,d,nt,"transparent",0)))}if((p=="series"||u)&&(n.model.AreaType=="none"&&g>1||n.model.AreaType!="none")){if(!ct)for(ot=$("#"+o).childNodes?$("#"+o).childNodes:[],w=0;w<ot.length;w++)$("#"+ot[w].id).attr("class",n._id+"SelectionStyle");$("[id*="+this.svgObject.id+"_Series"+l+"]").each(function(){if(this.parentNode.id==n.svgObject.id+"_SeriesGroup_"+l||this.parentNode.id==n.svgObject.id+"_symbolGroup_"+l){var t=$(this).attr("name")?n._id+"SelectionPathStyle"+c:n._id+"SelectionStyle"+c;$(this).attr("class",t)}});$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c);r&&$("#"+o).remove()}else if(p!="cluster"||n.model.AreaType=="none"||ej.util.isNullOrUndefined(s)){if($("#"+s).attr("name")||s==n.svgObject.id+"_Series"+l||n.model.AreaType=="none")$("#"+s).attr("class",n._id+"SelectionStyle"+c+"Point"+l),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c+"Point"+l),r&&$("#"+o).remove();else{if($("#"+s).attr("class",n._id+"SelectionStyle"+c),this.model.commonSeriesOptions.columnFacet=="cylinder"||i.columnFacet=="cylinder")for(w=0;w<2;w++)$("#"+s.replace(/2$/,w)).attr("class",n._id+"SelectionStyle"+c);$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c);$("#"+s+"_symbol").attr("class",n._id+"SelectionStyle"+c);r&&($("#"+s+"_symbol").attr("class",n._id+"SelectionStyle"+c),$("#"+o).remove())}b=$("#"+s).attr("name");b!=undefined&&(b=="candle"||b.indexOf("hilo")>=0)&&($("[id$="+s+"]").attr("class",n._id+"SelectionStyle"+c),$("#"+this.svgObject.id+"_LegendItemShape"+l).attr("class",n._id+"SelectionLegendStyle"+c))}else{for(tt=this.svgObject.id+"_Series",y=n.model.clusterPoints,l=s.match(/(\d+)/g),e=parseInt(l[l.length-1]),s.indexOf("SeriesText")>=0&&(lt=this.GetSeriesPoint(t),e=lt.region.Region.PointIndex),k=0;k<y.length;k++){ut=y[k].seriesIndex;c="ClusterSeries"+k;v={};v.index=k;v.name="2D";v.api="Selection"+c;a=ht[ut].selectionSettings;v.color=a.color!=""?a.color:this.model.seriesColors[ut];Object.prototype.toString.call(v.color)==="[object Array]"&&(v.color=v.color[1].color);d=a.opacity;var ft=a.border.color,et=a.border.width,nt=rt=="none"||n.vmlRendering||rt==""?v.color:this.pattern(n,t,v,a);$("style").each(function(){$(this).html().indexOf("."+n._id+"SelectionStyle"+c)>-1&&(at=!0)});at||(this.createStyle(n,n._id+"Selection",c,d,nt,ft,et),this.createStyle(n,n._id+"SelectionLegend",c,d,nt,"transparent",0));st=$("#"+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex).attr("name")?n._id+"SelectionPathStyle"+c:n._id+"SelectionStyle"+c;$("#"+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex).attr("class",st);$("#"+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex+"_symbol").attr("class",st);n.model._visibleSeries[ut].visibility!="hidden"&&$("#"+this.svgObject.id+"_LegendItemShape"+k).not("[class*='Highlight']").attr("class",n._id+"SelectionLegendStyle"+c);b=$("#"+s).attr("name");b!=undefined&&(b=="candle"||b.indexOf("hilo")>=0)&&$("[id$="+tt+y[k].seriesIndex+"_Point"+y[k].pointIndex+"]").attr("class","HighlightStyle"+c)}r&&($("#"+this.svgObject.id+"_Series"+k+"_Point"+e).attr("class",n._id+"SelectionStyle"+c),$("#"+this.svgObject.id+"_Series"+k+"_Point"+e+"_symbol").attr("class",n._id+"SelectionStyle"+c),$("#"+o).remove())}}},removeSelection:function(n,t,r,u,f,e,o){var c=r.length,h=this.model.clusterPoints,l=h?h.length:0,s;if((u=="series"||e)&&(this.model.AreaType!="none"||this.model.AreaType=="none"&&c>1))for(i=0;i<c;i++)selectionSettings=r[i].selectionSettings,selectionSettings.mode!="point"&&selectionSettings.type.toLowerCase()=="single"||e&&selectionSettings.type.toLowerCase()=="single"?($(this.svgObject).find("[id*="+this.svgObject.id+"_SeriesGroup_"+i+"],[id*="+this.svgObject.id+"_symbolGroup_"+i+"],[id*=_Region_Series_"+i+"_]").each(function(){$(this).find("*").attr("class","");$(this).attr("class","")}),$("#"+this._id+"_Selection_Legend"+i+"_canvas").remove(),$("#"+this._id+"_Selection_series"+i+"_canvas").remove(),$("[id*=_Region_Series_"+i+"]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+i).attr("class","")):o&&selectionSettings.type.toLowerCase()=="multiple"&&($("#"+this._id+"_Selection_series"+n+"_canvas").remove(),$("#"+this._id+"_Selection_Legend"+n+"_canvas").remove(),$("[id*=_Region_Series_"+n+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class",""));if(u=="cluster"&&this.model.AreaType!="none"&&!e)if(f)if(this.model.enableCanvasRendering)$("[id*="+this._id+"_Selection_Cluster_point_"+t+"]").remove(),$("[id*="+this._id+"_Selection_Cluster]").length==0?$("[id*="+this._id+"_SelectionCluster_Legend]").remove():0;else{for(s=0;s<l;s++)$("[id*=_Region_Series_"+h[s].seriesIndex+"_Point_"+h[s].pointIndex+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+h[s].seriesIndex+"_Point"+h[s].pointIndex+"]").attr("class","");pointClasses=this.model.enable3D?this.foundClasses("_Region_Series_"+n):this.foundClasses(this.svgObject.id+"_Series"+n);pointClasses.length==0?$("[id*="+this.svgObject.id+"_LegendItemShape]").attr("class",""):0}else if(this.model.enableCanvasRendering)$("[id*="+this._id+"_Selection_Cluster]").remove(),$("[id*="+this._id+"_SelectionCluster_Legend]").remove(),this.selectedPoint=null;else for(s=0;s<l;s++)$("[id*=_Region_Series_"+h[s].seriesIndex+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+h[s].seriesIndex+"_Point]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+h[s].seriesIndex).attr("class","");u!="point"||this.model.AreaType=="none"||e||(f?($("#"+this._id+"_Selection_series"+n+"_point_"+t+"_canvas").remove(),$("[id*=_Region_Series_"+n+"_Point_"+t+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point"+t+"]").attr("class",""),$("[id*="+this._id+"_Selection_series"+n+"]").length==0?$("#"+this._id+"_Selection_Legend"+n+"_canvas").remove():0,pointClasses=this.model.enable3D?this.foundClasses("_Region_Series_"+n):this.foundClasses(this.svgObject.id+"_Series"+n),pointClasses.length==0?$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class",""):0):($("[id*="+this._id+"_Selection_series"+n+"_point_]").remove(),$("[id*="+this._id+"_Selection_Legend"+n+"]").remove(),$("[id*=_Region_Series_"+n+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point]").attr("class",""),$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class","")));u!="point"&&u!="cluster"&&(u!="series"||this.model._visibleSeries.length!=1||this.model.AreaType!="none"||e)||(f?($("#"+this._id+"_Selection_series"+n+"_point_"+t+"_canvas").remove(),$("[id*=_Region_Series_"+n+"_Point_"+t+"]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point"+t+"]").attr("class",""),this.model._visibleSeries.length>1?$("#"+this.svgObject.id+"_LegendItemShape"+n).attr("class",""):$("#"+this.svgObject.id+"_LegendItemShape"+t).attr("class",""),this.model._visibleSeries.length>1?$("#"+this._id+"_Selection_Legend"+n+"_canvas").remove():$("#"+this._id+"_Selection_Legend"+t+"_canvas").remove()):($("[id*="+this._id+"_Selection_series]").remove(),$("[id*="+this._id+"_Selection_Legend]").remove(),$("[id*=_Region_Series_"+n+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+n+"_Point]").attr("class",""),this.model._visibleSeries.length>1?$("[id*="+this.svgObject.id+"_LegendItemShape"+n+"]").attr("class",""):$("[id*="+this.svgObject.id+"_LegendItemShape]").attr("class","")))},createStyle:function(n,t,i,r,u,f,e,o){var s,h,c,l;n.vmlRendering?(s=document.createElement("style"),s.id=t+"Segment",r=r*100,h="."+t+"Style"+i+" {filter: alpha(opacity="+r+");}."+t+"PathStyle"+i+" {filter: alpha(opacity="+r+");}",s.setAttribute("type","text/css"),s.styleSheet?s.styleSheet.cssText=h:(c=document.createTextNode(h),s.appendChild(c)),l=document.getElementsByTagName("head")[0],l.appendChild(s)):($("<style id="+t+"Segment"+i+" type='text/css'> ."+t+"Style"+i+"{ fill:"+u+";opacity:"+r+";stroke:"+f+";stroke-width:"+e+";stroke-opacity:"+o+"}<\/style>").appendTo("body"),$("<style id="+t+"Path"+i+" type='text/css'> ."+t+"PathStyle"+i+"{ opacity:"+r+";stroke:"+f+";stroke-width:"+e+";stroke-opacity:"+o+"}<\/style>").appendTo("body"))},highlightPoint:function(n,t,i,r,u,f,e){for(var s,a,h,l="_Region_Series_"+t+"_Point_"+i,c=$(this.svgObject).find("[id$="+l+"],[id*="+l+"back],[id*="+l+"front]"),o=0;o<c.length;o++)s=[],s.api=r+u,s.seriesName=u,s.name=$("[id="+c[o].id+"]").attr("name"),s.index=o,a=this.highlightFill(f,n,t,i),h=$("#"+c[o].id).attr("class"),h=h?h:"",h.indexOf("Selection")<0&&$("[id="+c[o].id+"]").attr("class",this.dStyle(s,a,n,e,f))},highlightCluster:function(n,t,i,r,u,f,e){var u,a,l,s,v,h,y,c,p,o;if(n.model.AreaType!="none"){for(h=[],y=n.model._visibleSeries[t]._visiblePoints[i].x,c=0,p=n.model._visibleSeries.length;c<p;c++)for(o=0;o<n.model._visibleSeries[c]._visiblePoints.length;o++)y==n.model._visibleSeries[c]._visiblePoints[o].x&&(h[h.length]={seriesIndex:c,pointIndex:o});for(k=0;k<h.length;k++){for(u="series"+k,a="_Region_Series_"+h[k].seriesIndex+"_Point_"+h[k].pointIndex,l=$(this.svgObject).find("[id$="+a+"],[id*="+a+"back],[id*="+a+"front]"),o=0;o<l.length;o++)s=[],s.api=r+u,s.seriesName="series"+k,s.name=$("[id="+l[o].id+"]").attr("name"),s.index=o,t=k,f=r=="Highlight"?n.model._visibleSeries[k].highlightSettings:n.model._visibleSeries[k].selectionSettings,v=this.highlightFill(f,n,t,i),className=$("#"+l[o].id).attr("class"),className=className?className:"",className.indexOf("Selection"+u+"Style")<0&&className.indexOf("SelectionStyle")<0&&$("[id="+l[o].id+"]").attr("class",this.dStyle(s,v,n,e,f));r=="Highlight"?$("#"+this.svgObject.id+"_LegendItemShape"+k).not("[class*='Selection']").attr("class","Highlight"+u+"Style"+u+"1"):$("#"+this.svgObject.id+"_LegendItemShape"+k).attr("class","Selection"+u+"Style"+u+"1")}}},highlightSeries:function(n,t,i,r,u,f,e,o){var t=t,v=i,y=n.model._visibleSeries.length,p=n.model.AreaType=="none"&&y==1?"_Region_Series_"+t+"_Point_"+i:"_Region_Series_"+t+"_Point_",l=$(this.svgObject).find("[id*="+p+"]"),c,a,s=o?$("#"+this.svgObject.id+"_LegendItemShape"+i).attr("class"):e?$("#"+e.target.id).attr("class"):"",h;if(s=s?s:"",s.indexOf("SelectionStyle")<0||o)for(h=0;h<l.length;h++)c=[],c.api=r+u,c.seriesName=u,c.name=$("[id="+l[h].id+"]").attr("name"),c.index=h,a=this.highlightFill(f,n,t,v,o),s=$("#"+l[h].id).attr("class"),s=s?s:"",s.indexOf("SelectionStyle")<0&&s.indexOf("Selection"+u+"Style")<0&&$("[id="+l[h].id+"]").attr("class",this.dStyle(c,a,n,e,f))},highlight:function(n,t,i,r,u,f,e,o){var h=i.highlightSettings,y=$.inArray(i,n.model._visibleSeries),s="series"+y,ft=!1,c=y,l=e||t.target.id,yt=jQuery.uaMatch(navigator.userAgent),ht,ct,a,b,d,v,nt,at,p,vt,it,w;!o&&this.isTouch(t)&&yt.browser=="chrome"&&(myLocation=t.originalEvent.changedTouches[0],l=document.elementFromPoint(myLocation.clientX,myLocation.clientY).id);f=f||t.target.parentNode.id;var pt=f.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||f.indexOf(this.svgObject.id+"_Chart3D")>=0?!0:!1,wt=$("#"+l).attr("name"),rt=h.pattern.toLowerCase(),et=n.model._visibleSeries.length;if(n.model.AreaType=="none"&&et==1&&(n.model.enable3D?c=r?r.legendItem.LegendItem.PointIndex:u.region.Region.PointIndex:(ht=r?this.svgObject.id+"_LegendItemShape":this.svgObject.id+"_Series"+y+"_Point",ct=r?this.svgObject.id+"_LegendItemShape"+r.legendItem.LegendItem.PointIndex:l,pointIndex=ct.substr(ht.length),c=pointIndex)),$("style").each(function(){$(this).html().indexOf(".HighlightStyle"+s)>-1&&(ft=!0)}),n.model.enable3D&&!n.vmlRendering)(h.mode=="series"||r)&&(n.model.AreaType=="none"&&et!=1||n.model.AreaType!="none")?(this.highlightSeries(n,y,c,"Highlight",s,h,t,r),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","Highlight"+s+"Style"+s+"1")):h.mode=="cluster"&&n.model.AreaType!="none"?this.highlightCluster(n,y,u.pointData.pointIndex,"Highlight",s,h,t):(pointIndex=u?u.pointData.pointIndex:c,this.highlightPoint(n,y,pointIndex,"Highlight",s+pointIndex,h,t),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","Highlight"+s+pointIndex+"Style"+s+pointIndex+"1"));else{if(h.mode||this.model.AreaType=="none"){a={};a.name="2D";a.index=y;a.api="Highlight";a.color=h.color!=""?h.color:r?this.model.AreaType=="none"?this.model.pointColors[c]:this.model.seriesColors[c]:$("#"+l).attr("fill");Object.prototype.toString.call(a.color)==="[object Array]"&&(a.color=a.color[1].color);var g=rt=="none"||n.vmlRendering||rt==""?h.color:this.pattern(n,t,a,h),tt=o?1:h.opacity,ot=o?i.type.toLowerCase().indexOf("hilo")==-1?n.model.highlightColor:g:h.border.color,st=o?3.5:h.border.width,lt=o&&i.type.toLowerCase().indexOf("hilo")==-1?.5:1;ft||(this.createStyle(n,"Highlight",s,tt,g,ot,st,lt),this.createStyle(n,"HighlightLegend",s,tt,g,"transparent",0,lt))}if(b=r?$("#"+this.svgObject.id+"_LegendItemShape"+c).attr("class"):$("#"+l).attr("class"),b=b?b:"",b.indexOf("Selection")==-1)if((h.mode=="series"&&!o||r)&&(n.model.AreaType=="none"&&et!=1||n.model.AreaType!="none"))$("[id*="+this.svgObject.id+"_Series"+c+"]").each(function(){if(this.parentNode.id==n.svgObject.id+"_SeriesGroup_"+c||this.parentNode.id==n.svgObject.id+"_symbolGroup_"+c){var t=$(this).attr("class"),i=$(this).attr("name")?"HighlightPathStyle"+s:"HighlightStyle"+s;t!="SelectionStyle"+s&&t!="SelectionStyleClusterSeries"+y&&t!="SelectionPathStyle"+s&&f.indexOf(n.svgObject.id+"_symbolGroup_"+c)<=0&&$(this).attr("class",i)}}),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s);else if(h.mode!="cluster"||n.model.AreaType=="none"||o){if(!$("#"+l).attr("name")&&l!=n.svgObject.id+"_Series"+c){if(ut=$("#"+l).attr("class")?$("#"+l).attr("class"):"",ut.indexOf("Selection")!=0&&f.indexOf(n.svgObject.id+"_symbolGroup_"+c)<=0&&(u||r)){if(pt&&($("#"+l).attr("class","HighlightStyle"+s),this.model.commonSeriesOptions.columnFacet=="cylinder"||i.columnFacet=="cylinder"))for(p=0;p<2;p++)$("#"+l.replace(/2$/,p)).attr("class","HighlightStyle"+s);pointIndex=u?u.region.Region.PointIndex:r.legendItem.LegendItem.PointIndex;$("#"+l+"_symbol").attr("class","HighlightStyle"+s);$("#"+this.svgObject.id+"_Series"+y+"_Point"+pointIndex).not("[class*='Selection']").attr("class","HighlightStyle"+s);$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s)}l.indexOf("symbol")>-1&&$("#"+l).attr("class","HighlightStyle"+s)}w=$("#"+l).attr("name");w!=undefined&&(w=="candle"||w.indexOf("hilo")>=0)&&($("[id$="+l+"]").attr("class","HighlightStyle"+s),$("#"+this.svgObject.id+"_LegendItemShape"+c).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s))}else{if(d=this.svgObject.id+"_Series",v=[],c=l.match(/(\d+)/g),c&&l.toLowerCase().indexOf("point")>0)for(pointIndex=parseInt(c[c.length-1]),at=n.model._visibleSeries[y]._visiblePoints[pointIndex].xValue,p=0,vt=n.model._visibleSeries.length;p<vt;p++)for(it=0;it<n.model._visibleSeries[p]._visiblePoints.length;it++)at==n.model._visibleSeries[p]._visiblePoints[it].xValue&&(v[v.length]={seriesIndex:p,pointIndex:it});for(k=0;k<v.length;k++){nt=v[k].seriesIndex;s="series"+nt;a={};a.name="2D";a.api="Highlight"+s;h=n.model._visibleSeries[nt].highlightSettings;a.color=h.color!=""?h.color:this.model.seriesColors[nt];Object.prototype.toString.call(a.color)==="[object Array]"&&(a.color=a.color[1].color);tt=h.opacity;ot=h.border.color;st=h.border.width;g=rt=="none"||n.vmlRendering||rt==""?a.color:this.pattern(n,t,a,h);ft||(this.createStyle(n,"Highlight",s,tt,g,ot,st),this.createStyle(n,"HighlightLegend",s,tt,g,"transparent",0));var ut=$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex).attr("class"),bt=$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex+"_symbol").attr("class"),b=$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex).attr("name")?"HighlightPathStyle"+s:"HighlightStyle"+s;ut!="SelectionStyleseries"+k&&ut!="SelectionPathStyle"+s&&f.indexOf(n.svgObject.id+"_symbolGroup_"+k)<=0&&($("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex).attr("class",b),$("#"+d+v[k].seriesIndex+"_Point"+v[k].pointIndex+"_symbol").attr("class",b));n.model._visibleSeries[nt].visibility!="hidden"&&$("#"+this.svgObject.id+"_LegendItemShape"+nt).not("[class*='Selection']").attr("class","HighlightLegendStyle"+s);w=$("#"+l).attr("name");w!=undefined&&(w=="candle"||w.indexOf("hilo")>=0)&&$("[id$="+d+v[k].seriesIndex+"_Point"+v[k].pointIndex+"]").attr("class","HighlightStyle"+s)}}}},dStyle:function(n,t,i,r,u){var c=ej.Ej3DRender.prototype.polygon3D.prototype,h=u,e=n.api,o=n.seriesName,l=h.opacity,s,f;return t=i.colorNameToHex(t),t=n.name=="XLight"?c.applyXLight(t,i):n.name=="ZLight"?c.applyZLight(t,i):t,s={},s.name=n.name,s.color=t,s.api=e,t=h.pattern=="none"?t:this.pattern(i,r,s,h),document.getElementById(e+"Segment"+o)?(f=document.getElementById(e+"Segment"+o),f.innerHTML=f.innerHTML+"."+e+"Style"+o+n.index+" { fill:"+t+";opacity:"+l+" }"):(f=document.createElement("style"),f.id=e+"Segment"+o,f.type="text/css",f.innerHTML="."+e+"Style"+o+n.index+" { fill:"+t+";opacity:"+l+" }",document.getElementsByTagName("head")[0].appendChild(f)),e+"Style"+o+n.index},pattern:function(n,t,i,r){var v=r,o=i.api,s=v.pattern.toLowerCase(),e=i.color,c=v.opacity!=""?v.opacity:$("#"+t.target.id).attr("opacity"),a="#ffffff",y,l,u,h,f;document.getElementById(o+"Def")?l=$("#"+o+"Def")[0]:(y={id:o+"Def"},l=n.svgRenderer.createPattern(y,"svg"),n.svgRenderer.append(l,n.svgObject));n.model.enable3D&&(a=i.name=="XLight"?"#595959":i.name=="ZLight"?"#737373":"#808080");"#"+s+"_"+o+"_"+i.name+"_"+i.index&&$("#"+s+"_"+o+"_"+i.name+"_"+i.index).remove();u=[];switch(s){case"chessboard":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:10,height:10},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:10,height:10,fill:a,opacity:c,name:"rect"},u[1]={x:0,y:0,width:5,height:5,fill:e,opacity:c,name:"rect"},u[2]={x:5,y:5,width:5,height:5,fill:e,opacity:c,name:"rect"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"pacman":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"17.917",height:"18.384"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:17.917,height:18.384,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M9.081,9.194l5.806-3.08c-0.812-1.496-2.403-3.052-4.291-3.052H8.835C6.138,3.063,3,6.151,3,8.723v1.679 c0,2.572,3.138,5.661,5.835,5.661h1.761c2.085,0,3.835-1.76,4.535-3.514L9.081,9.194z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"crosshatch":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"8",height:"8"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:8,height:8,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={d:"M0 0L8 8ZM8 0L0 8Z","stroke-width":1,stroke:e,name:"path"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"dots":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:7,height:7,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={cx:3,cy:3,r:2,"stroke-width":1,fill:e,name:"circle"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"diagonalforward":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={d:"M 3 -3 L 9 3 M 6 6 L 0 0 M 3 9 L -3 3","stroke-width":2,stroke:e,name:"path"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"diagonalbackward":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:a,opacity:c,name:"rect"},u[1]={d:"M 3 -3 L -3 3 M 0 6 L 6 0 M 9 3 L 3 9","stroke-width":2,stroke:e,name:"path"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"grid":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M1 3.5L11 3.5 M0 3.5L11 3.5 M0 7.5L11 7.5 M0 11.5L11 11.5 M5.5 0L5.5 12 M11.5 0L11.5 12Z","stroke-width":1,stroke:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"turquoise":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"17",height:"17"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:17,height:17,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0.5739999999999998,2.643a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[2]={name:"path",d:"M11.805,2.643a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[3]={name:"path",d:"M6.19,2.643a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[4]={name:"path",d:"M11.805,8.217a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[5]={name:"path",d:"M6.19,8.217a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[6]={name:"path",d:"M11.805,13.899a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},u[7]={name:"path",d:"M6.19,13.899a2.123,2.111 0 1,0 4.246,0a2.123,2.111 0 1,0 -4.246,0","stroke-width":1,"stroke-miterlimit":10,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"star":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"21",height:"21"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:21,height:21,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M15.913,18.59L10.762 12.842 5.613 18.75 8.291 11.422 0.325 9.91 8.154 8.33 5.337 0.91 10.488 6.658 15.637 0.75 12.959 8.078 20.925 9.59 13.096 11.17 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"triangle":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"10",height:"10"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:10,height:10,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M4.987,0L7.48 4.847 9.974 9.694 4.987 9.694 0 9.694 2.493 4.847 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"circle":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"9",height:"9"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:9,height:9,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"circle",cx:5.125,cy:3.875,r:3.625,"stroke-width":1,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"tile":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"18",height:"18"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0,9L0 0 9 0 z","stroke-width":1,stroke:e,fill:e},u[2]={name:"path",d:"M9,9L9 0 18 0 z","stroke-width":1,stroke:e,fill:e},u[3]={name:"path",d:"M0,18L0 9 9 9 z","stroke-width":1,stroke:e,fill:e},u[4]={name:"path",d:"M9,18L9 9 18 9 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"horizontaldash":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"12"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0,1.5 L10 1.5 M0,5.5 L10 5.5 M0,9.5 L10 9.5 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"verticaldash":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"12"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M1.5,0 L1.5 10 M5.5,0 L5.5 10 M9.5,0 L9.5 10 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"rectangle":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:12,height:12},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",width:12,height:12,fill:a,opacity:c},u[1]={name:"rect",x:1,y:2,width:4,height:9,fill:e,opacity:c},u[2]={name:"rect",x:7,y:2,width:4,height:9,fill:e,opacity:c},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"box":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:10,height:10},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",width:13,height:13,fill:a,opacity:c},u[1]={name:"rect",x:1.5,y:1.5,width:10,height:9,fill:e,opacity:c},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"horizontalstripe":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"10",height:"12"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:10,height:12,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0,0.5 L10 0.5 M0,4.5 L10 4.5 M0,8.5 L10 8.5 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"verticalstripe":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"10"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:12,height:10,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"path",d:"M0.5,0 L0.5 10 M4.5,0 L4.5 10 M8.5,0 L8.5 10 z","stroke-width":1,stroke:e,fill:e},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"bubble":return h={id:s+"_"+o+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"20",height:"20"},f=n.svgRenderer.createPattern(h,"pattern"),u[0]={name:"rect",x:0,y:0,width:20,height:20,transform:"translate(0,0)",fill:a,opacity:c},u[1]={name:"circle",cx:5.217,cy:11.325,r:3.429,"stroke-width":1,fill:"#D0A6D1"},u[2]={name:"circle",cx:13.328,cy:6.24,r:4.884,"stroke-width":1,fill:e},u[3]={name:"circle",cx:13.277,cy:14.66,r:3.018,"stroke-width":1,fill:"#D0A6D1"},this.loadPattern(n,u,f),l.appendChild(f),"url(#"+s+"_"+o+"_"+i.name+"_"+i.index+")";case"custom":return"url(#"+v.customPattern+")"}},loadPattern:function(n,t,i,r){for(var f,u=0;u<t.length;u++)r?t[u].name=="rect"?(t[u].stroke="transparent",this.drawRect(t[u],r)):t[u].name=="path"?ej.EjCanvasRender.prototype.drawPath(t[u],r):t[u].name=="circle"&&(t[u].stroke="transparent",ej.EjCanvasRender.prototype.drawCircle(t[u],r)):(f=n.svgRenderer.createPattern(t[u],t[u].name),i.appendChild(f))},drawRect:function(n,t){t.save();t.beginPath();t.globalAlpha=n.opacity;t.lineWidth=n["stroke-width"];t.strokeStyle=n.stroke;t.rect(n.x,n.y,n.width,n.height);n.fill=="none"&&(n.fill="transparent");t.fillStyle=n.fill;n.transform&&t.translate(n.transform[0],n.transform[1]);t.rotate(n.rotate*Math.PI/180);t.fillRect(n.x,n.y,n.width,n.height);t.clip();t.stroke();t.restore()},chartRightClick:function(n){return this.chartRightClick=!0,this.isTouch(n)&&this.model.crosshair.visible?(event.preventDefault(),event.stopPropagation(),!1):void 0},chartMouseUpTouch:function(n){var t=this,r=jQuery.uaMatch(navigator.userAgent),i=this.calMousePosition(n),u=this.model.browserInfo;return this.mousemoveX=i.X,this.mousemoveY=i.Y,this.enableTrackBall(),clearTimeout(this.model.doubleTapTimer),this.drag||(this.model.doubleTapTimer=setTimeout(function(){(t.model.tapNum<2||t.model.crosshair.visible)&&t.singleTap(n);t.model.tapNum=0;t.model.cachedX=0;t.model.cachedY=0},200)),t.model.tapNum==2&&(t.model.doubleTapped=!1),!0},getEvent:function(n){return n.targetTouches&&n.targetTouches[0]?n.targetTouches[0]:n},doubleTap:function(n){var r=this.getEvent(n),u=r.pageX,f=r.pageY,o=this.model,e=200,i,t=o.m_AreaBounds;this.model.cachedX=this.model.cachedX||u;this.model.cachedY=this.model.cachedY||f;timestamp=(new Date).getTime();this.mouseDownX>=t.X&&this.mouseDownX<t.X+t.Width&&this.mouseDownY<t.Y+t.Height&&this.mouseDownY>=t.Y&&Math.abs(u-this.model.cachedX)<e&&Math.abs(f-this.model.cachedY)<e&&this.model.tapNum++;this.model.tapNum==2&&(this.model.doubleTapped=!0,this.multiSelectMouseDown(n),this.drag=this.model.zooming.enable||this._isMultiSelect,i=this.model.trackerElement,i&&($(i).finish(),i=null))},singleTap:function(n){var t=this,o=n.target.id,p=this.model._visibleSeries,f,s=this.getEvent(n),v=s.pageX,y=s.pageY,h=10,r,i,c,e,u,l,a;if(!this.panning&&!this.isZoomButtonHovered(n.target)){for(this.cancelEvent(n),t.model.trackerElement&&($.finish?$(t.model.trackerElement).finish():$(t.model.trackerElement).stop(!0,!0),t.model.trackerElement=null),$(".ejTooltip"+this._id).remove(),(!t.model.crosshair.visible||t.model.AreaType!="cartesianaxes")&&Math.abs(v-t.model.cachedX)<h&&Math.abs(y-t.model.cachedY)<h?this.chartInteractiveBehavior(n):(t.model.element=$(document).find("#"+this.svgObject.id+"_CrosshairGroup"),t.model.trackerElement=$(t.model.element).children().not(".Tracker").not("defs"),$(t.model.trackerElement).length>0&&$(t.model.trackerElement).fadeOut(1e3,function(){$(t.model.element).find('[id*="trackSymbol"]').attr("visibility","hidden");t.model.trackerElement=null;t._removeHighlight()}),r=$(document).find('[id*="_trackball_grouping_tooltip"]'),$(r).length>0&&$(r).fadeOut(1e3,function(){$(r).remove()})),this.axisTooltip(n,o),this.showTitleTooltip(n,o),this.model.enableCanvasRendering&&(this._textTooltip(n,this.model.xAxisLabelRegions),this._textTooltip(n,this.model.yAxisLabelRegions)),i=0,c=this.model.series.length;i<c;i++)e=this.model.series[i],u=e.marker.dataLabel,!e._enableSmartLabels||this.model.enable3D||u.enableWrap||(l=u.template,a=u.font,this.model.AreaType=="none"&&ej.util.isNullOrUndefined(l)&&this.datalabelTooltip(n,i,a));$(".ejTooltip"+this._id).length>0&&(f=$(".ejTooltip"+this._id));$(".tooltipDiv"+this._id).length>0&&(f=$(".tooltipDiv"+this._id));window.clearTimeout(t.model.timer);t.model.trackerElement=f;t.model.timer=setTimeout(function(){if(pointData=t.model.prevPoint,t.model.trackerElement)t.model.trackerElement.fadeOut(500,function(){if(pointData){if(t.model.AreaType!="polaraxes"){var n=ej.EjSvgRender.utils._getPoint(pointData.point,pointData.series);t.drawTrackerSymbol(pointData.series,pointData.seriesIndex,pointData.pointIndex,null,n)}$("#canvas_trackSymbol").remove()}$("[id*=_TrackSymbol]").remove()});else{if(pointData&&t.model.AreaType!="polaraxes"){var n=ej.EjSvgRender.utils._getPoint(pointData.point,pointData.series);t.drawTrackerSymbol(pointData.series,pointData.seriesIndex,pointData.pointIndex,null,n)}t.model.crosshair.visible||($("#canvas_trackSymbol").remove(),$("[id*=_TrackSymbol]").remove())}},1200)}n.originalEvent.pointerType||this.panning||!this.model.selectionEnable||this._doClick(n)},_getPieOfPiePoint:function(n,t,i){for(var f,u=i?t.points:t._visiblePoints,e=u.length,r=0;r<e;r++)n==u[r].actualIndex&&(f=u[r]);return f},tooltip:function(n,t){var rt=!1,f,l,i=this.GetSeriesPoint(t),b,lt,p,at,vt,u,k,o,et,ot,yt,pt,a,wt,tt,h,e,kt,dt,st,c,d,ht,s,ct,ii;if($("#canvas_trackSymbol").remove(),ej.util.isNullOrUndefined(i)&&!this.dragPoint&&$("#"+n.svgObject.id+"_TrackToolTip").remove(),this.model.crosshair.visible||this.model.AreaType!="cartesianaxes")$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").hide(),ej.util.isNullOrUndefined(i)&&(clearTimeout(this.removeTooltip),n.removeTooltip=setTimeout(function(){$(".tooltipDiv"+n._id).remove()},1e3));else{for(var ut=this.model.indicators,v=this.model._visibleSeries,ft,y,w,ri=v.length,nt=0,g=0;g<ri;g++)for(w=v[g].trendlines,y=0;y<w.length;y++)w[y].visibility.toLowerCase()!="visible"||w[y].isNull||this.model.series[0].type=="boxandwhisker"||(w[y]._visiblePoints=w[y].points,v=v.concat(w[y]));for(b=0;b<ut.length&&ut[b].segment;b++)ft=ut[b],ft.visible&&(v=v.concat(ft.segment));for(lt=v.length,s=0;s<lt;s++)f=v[s],l=s,p=f.type.toLowerCase(),f.visibility.toLowerCase()!="visible"||p==="scatter"||p==="bubble"||p==="column"||p.indexOf("bar")!=-1||p==="stackingcolumn"||p==="stackingcolumn100"||f._hiloTypes?ej.util.isNullOrUndefined(i)&&!this.dragPoint&&$(".tooltipDiv"+this._id).hasClass(this.svgObject.id)&&(clearTimeout(this.removeTooltip),n.removeTooltip=setTimeout(function(){$(".tooltipDiv"+n._id).remove()},1e3)):($("#"+n.svgObject.id+"_TrackToolTipTemplate_"+l).remove(),$(".tooltipDiv"+this._id).hasClass(n.svgObject.id)||$(".tooltipDiv"+this._id).remove(),$("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackSymbol_"+l).remove(),$("#"+n.svgObject.id+"_TrackSymbol_"+l).remove(),at=[],vt=[],h=null,u=n.getClosesPointXY(vt,at,f,n.mousemoveX,n.mousemoveY,t),ej.util.isNullOrUndefined(u.point)&&(!this.model.prevPoint||this.model.prevPoint.seriesIndex&&!this.model.series[this.model.prevPoint.seriesIndex].tooltip.visible)&&!this.dragPoint&&$(".tooltipDiv"+this._id).hasClass(this.svgObject.id)&&(clearTimeout(this.removeTooltip),n.removeTooltip=setTimeout(function(){$(".tooltipDiv"+n._id).remove()},1e3)),u.point&&(f.type.toLowerCase()=="boxandwhisker"?(nt++,h=u.outlierPosition):h=ej.EjSvgRender.utils._getPoint(u.point,f),k=$.extend({},ej.EjSvgRender.commonChartEventArgs),k.data={location:{x:this.mousemoveX,y:this.mousemoveX},region:{SeriesIndex:s,Region:{PointIndex:u.index}}},n._trigger("pointRegionMouseMove",k)),o=this.model.prevPoint,o&&o.seriesIndex==s&&!u.point&&(f.type.toLowerCase()=="boxandwhisker"?(nt++,et=o.outlierPosition):et=ej.EjSvgRender.utils._getPoint(o.point,o.series),n.model.enableCanvasRendering||n.drawTrackerSymbol(o.series,o.seriesIndex,o.pointIndex,null,et),this.model.prevPoint=null),f.isIndicator||f.isTrendLine||f.selectionSettings.enable||f.highlightSettings.enable||!f.marker.visible&&f.type.toLowerCase()!="boxandwhisker"||!u.point||k.cancel||(ej.util.isNullOrUndefined(u.point.marker)||ej.util.isNullOrUndefined(u.point.marker.visible)||u.point.marker&&u.point.marker.visible?n.drawTrackerSymbol(f,l,u.index,!1,h):f.type!="boxandwhisker"||u.point.marker||n.drawTrackerSymbol(f,l,u.index,!1,h),o&&u.point!=o.point&&(f.type.toLowerCase()=="boxandwhisker"?(nt++,ot=o.outlierPosition):ot=ej.EjSvgRender.utils._getPoint(o.point,o.series),n.drawTrackerSymbol(o.series,o.seriesIndex,o.pointIndex,null,ot,it,nt)),(ej.util.isNullOrUndefined(u.point.marker)||ej.util.isNullOrUndefined(u.point.marker.visible)||u.point.marker&&u.point.marker.visible)&&(this.model.prevPoint={point:u.point,pointIndex:u.index,series:f,seriesIndex:l,outlierPosition:u.outlierPosition})),f.tooltip.visible&&u.point&&(!i||s>i.region.SeriesIndex&&!(f._zOrder<this.model._visibleSeries[i.region.SeriesIndex]._zOrder))&&(e=ej.EjSvgRender.utils._getTransform(f.xAxis,f.yAxis,n.model.requireInvertedAxes),h.X+e.x<=e.x+e.width&&(h.X+e.x>=e.x||h.X==0)&&Math.abs(h.Y-(e.y+e.height))<=e.y+e.height&&(Math.abs(h.Y-(e.y+e.height))>=e.y||h.Y==0)&&(k.cancel||($(n.svgObject).find("#"+n.svgObject.id+"_TrackToolTip").length==0&&(yt={id:n.svgObject.id+"_TrackToolTip",transform:"translate("+e.x+","+e.y+")"},n.gTransToolEle=n.svgRenderer.createGroup(yt)),n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_TrackToolTip"),{transform:"translate("+e.x+","+e.y+")",visibility:"visible"}),ej.util.isNullOrUndefined(f.tooltip.template)?(rt=!0,$(".tooltipDiv"+this._id).remove(),n.displayShowTooltip(h,u.point,f,u.index)):(rt=!0,$("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),pt={SeriesIndex:l,Region:{PointIndex:u.index}},n.createTooltip(pt,t,f))))))}if($(".tooltipDiv"+this._id).hasClass(this.svgObject.id)||$(".tooltipDiv"+this._id).remove(),i&&ej.util.isNullOrUndefined(i.region.isStripLine)){if(this.model.AreaType=="none"&&this.model._visibleSeries[i.region.SeriesIndex].explode&&(this.model._visibleSeries[i.region.SeriesIndex].enableAnimation?(this.model.AnimationComplete||this.model.enableCanvasRendering)&&this.pieExplosion(i,t):this.model.enable3D||this.pieExplosion(i,t)),i.region.isIndicator?(r=this.model.indicators[i.region.SeriesIndex],a=r.segment[0]._visiblePoints[i.region.Region.PointIndex],r.fill=r.segment[0].fill):(r=this.model._visibleSeries[i.region.SeriesIndex],a=r.type=="pieofpie"?this._getPieOfPiePoint(i.region.Region.PointIndex,r):this.model._visibleSeries[i.region.SeriesIndex]._visiblePoints[i.region.Region.PointIndex]),a&&this.model.AreaType=="polaraxes"){for(s=0;s<this.model._visibleSeries.length;s++)$("[id*=_TrackSymbol]").remove(),wt="canvas_trackSymbol_"+s,$("#"+this._id).find("[id*="+wt+"]").remove();if(tt=this.model.AreaType!="polaraxes"?ej.EjSvgRender.utils._getPoint(a,r):ej.EjSvgRender.utils.TransformToVisible(r,a.xValue,a.y,this),c=this.model.prevPoint,!ej.util.isNullOrUndefined(c)&&c!=i&&r.marker.visible){var r=this.model._visibleSeries[c.region.SeriesIndex],bt=this.model._visibleSeries[c.region.SeriesIndex]._visiblePoints[c.region.Region.PointIndex],ui=ej.EjSvgRender.utils.TransformToVisible(r,bt.xValue,bt.y,this);this.drawTrackerSymbol(r,c.region.SeriesIndex,c.region.Region.PointIndex,null,ui);this.model.prevPoint=null}r.marker.visible&&r.drawType!="column"&&(this.drawTrackerSymbol(r,i.region.SeriesIndex,i.region.Region.PointIndex,!0,tt),this.model.prevPoint=i)}r.tooltip.visible&&!rt&&r.visibility.toLowerCase()=="visible"&&(ej.util.isNullOrUndefined(r.tooltip.template)?(this.model.AreaType=="cartesianaxes"?(e=ej.EjSvgRender.utils._getTransform(r.xAxis,r.yAxis,this.model.requireInvertedAxes),$(this.svgObject).find("#"+this.svgObject.id+"_TrackToolTip").length==0&&(kt={id:this.svgObject.id+"_TrackToolTip",transform:"translate("+e.x+","+e.y+")"},this.gTransToolEle=this.svgRenderer.createGroup(kt)),this.svgRenderer._setAttr($(this.svgObject).find("#"+this.svgObject.id+"_TrackToolTip"),{transform:"translate("+e.x+","+e.y+")"}),$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","visible"),h={X:i.location.x-this.model.m_AreaBounds.X,Y:Math.abs(i.location.y-this.model.m_AreaBounds.Y)}):($(this.svgObject).find("#"+this.svgObject.id+"_TrackToolTip").length==0&&(dt={id:this.svgObject.id+"_TrackToolTip"},this.gTransToolEle=this.svgRenderer.createGroup(dt)),h={X:i.location.x,Y:Math.abs(i.location.y)}),$(".tooltipDiv"+this._id).remove(),this.displayShowTooltip(h,a,r,i.region.Region.PointIndex)):($("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),this.createTooltip(i.region,t)));st=$.extend({},ej.EjSvgRender.commonChartEventArgs);st.data=i;this._trigger("pointRegionMouseMove",st)}else if(ej.util.isNullOrUndefined(this.model.prevPoint)||this.model.AreaType!="polaraxes"){if(!ej.util.isNullOrUndefined(this.model.explodeValue)){var p=this.model.series[this.model.explodeValue.SeriesIndex].type.toLowerCase(),r=this.model._visibleSeries[this.model.explodeValue.SeriesIndex],gt=new ej.seriesTypes[p],ni,it,ei=r.labelPosition.toLowerCase(),l=this.model.explodeValue.SeriesIndex,ti=this.model._isPieOfPie?this._getPieOfPiePoint(this.model.explodeValue.PointIndex,r):r._visiblePoints[this.model.explodeValue.PointIndex],fi=gt._calculateArcData(this,this.model.explodeValue.PointIndex,ti,r,l,this.model.explodeValue.PieSeriesIndex);for(this.model.enableCanvasRendering&&(this.model.series[l].explodeIndex=null,d=document.getElementById(this.svgObject.id).getClientRects()[0],this.svgRenderer.ctx.clearRect(d.left,d.top,d.width,d.height),$("#"+this._id).ejChart("redraw")),it=this.svgObject.id+"_SeriesGroup_"+l,ni=this.model.explodeValue.PieSeriesIndex==1?$(this.gSeriesEle).children("#"+it)[1]:$(this.gSeriesEle).children("#"+it)[0],ht=$(ni).children(),s=0;s<ht.length;s++)if(ct=ht[s],ii=this.svgRenderer._getAttrVal($(ct)[0],"pointIndex"),parseInt(ii)==this.model.explodeValue.PointIndex){this.svgRenderer._setAttr($(ct),{d:fi.Direction});break}gt.drawDataLabelAcc(this,r,this.model.explodeValue.PointIndex,ti,l,this.model.explodeValue.PieSeriesIndex);this.model.explodeValue=null;this.model.explode=!1}}else c=this.model.prevPoint,r=this.model._visibleSeries[c.region.SeriesIndex],a=this.model._visibleSeries[c.region.SeriesIndex]._visiblePoints[c.region.Region.PointIndex],tt=ej.EjSvgRender.utils.TransformToVisible(r,a.xValue,a.y,this),this.drawTrackerSymbol(r,c.region.SeriesIndex,c.region.Region.PointIndex,null,tt),this.model.prevPoint=null},chartTrackball:function(n,t,i){var y=n.model.requireInvertedAxes,o,r,g,oi=this.model.indicators,h=this.model._visibleSeries,si=!1,yt,pt,u,ft,pr,hi,ci,gi,li,nr,tr,p,ai=0,ir,rr,ur,nt,v=[],et=[],l=[],rt=this.model.enableCanvasRendering,st=0,ot=0,fr=0,er=$("#"+this._id).offset(),ht=[],wt=[],bt=[],ct=this.model.crosshair.trackballTooltipSettings.mode.toLowerCase(),wr=n._id+"_trackball_grouping_tooltip",kt=this.model.locale,vi=0,yi=0,dt,or,lt,a,sr,gt,pi,e,wi,tt,ni,ti,hr,k,it,bi,ii,b,ri,ut,w,c,fi,f,s,br,vr,yr,ei;if(!this.model.enable3D&&this.model.crosshair.visible&&this.model.crosshair.type.toLowerCase()=="trackball"){for($("#"+this.svgObject.id+"_CrosshairGroup").length==0?(dt={id:n.svgObject.id+"_CrosshairGroup",visibility:"visible"},rt?(dt.position="absolute",n.svgRenderer.drawCrosshairLine(dt,"#chartContainer_"+this._id)):(n.gTrackball=n.svgRenderer.createGroup(dt),n.svgRenderer.append(n.gTrackball,n.svgObject))):n.model.trackerElement&&($.finish?$(n.model.trackerElement).finish():$(n.model.trackerElement).stop(!0,!0),n.model.trackerElement=null),this.model.enableCanvasRendering||($("[class*=HighlightStyle]").attr("class",""),$("[class*=HighlightLegendStyle]").attr("class",""),$("[class*=HighlightLegendPathStyle]").attr("class",""),$("[class*=HighlightPathStyle]").attr("class",""),$("[class*=Highlightseries]").attr("class",""),$("[id*="+this._id+"_Highlight_]").remove()),$("#secondCanvas").remove(),$("#"+this._id).find('[id*="_gTooltip_"]').remove(),$("#"+wr).children().remove(),rt&&$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden"),or=h.length,lt=0;lt<oi.length&&oi[lt].segment;lt++)h=h.concat(oi[lt].segment);for(seriesLength=h.length,f=0;f<seriesLength;f++)if(h[f].visibility=="visible"&&(s=f,yt=[],pt=y?n.mousemoveY+h[f].xAxis.plotOffset>h[f].xAxis.y&&n.mousemoveY<h[f].xAxis.y+h[f].xAxis.height+h[f].xAxis.plotOffset:n.mousemoveX+h[f].xAxis.plotOffset>h[f].xAxis.x&&n.mousemoveX<h[f].xAxis.x+h[f].xAxis.width+h[f].xAxis.plotOffset,rt&&(this.canvasX=h[f].xAxis.x),u=n.getClosestPointX(yt,h[f],n.mousemoveX,n.mousemoveY),ft=h[f].xAxis.visibleRange,u.point!=""&&(gt=h[f].type.toLowerCase()=="boxandwhisker"?u.point[0].boxPlotLocation[0].YValues:u.point[0].YValues[0],u.point!=""&&(gt>=h[f].yAxis.visibleRange.min||ct=="grouping")&&u.point[0].xValue>=ft.min&&u.point[0].xValue<=ft.max&&pt)))for(e=0;e<u.point.length;e++)u.point[e].visible&&(h[f].isIndicator||st++);for(f=0;f<seriesLength;f++){if(s=f,r=h[f],a=[],r.visibility.toLowerCase()=="visible")if(yt=[],pt=y?n.mousemoveY+h[f].xAxis.plotOffset>r.xAxis.y&&n.mousemoveY<r.xAxis.y+r.xAxis.height+h[f].xAxis.plotOffset:n.mousemoveX+h[f].xAxis.plotOffset>r.xAxis.x&&n.mousemoveX<r.xAxis.x+r.xAxis.width+h[f].xAxis.plotOffset,rt&&(this.canvasX=r.xAxis.x),u=n.getClosestPointX(yt,r,n.mousemoveX,n.mousemoveY),ft=r.xAxis.visibleRange,u.point!=""){if(gt=h[f].type.toLowerCase()=="boxandwhisker"?u.point[0].boxPlotValues.midvalue:u.point[0].YValues[0],(gt>=h[f].yAxis.visibleRange.min||ct=="grouping")&&u.point[0].xValue>=ft.min&&u.point[0].xValue<=ft.max)if(pt)for(pi=u.point.length,e=0;e<pi;e++)if(u.point[e].visible){if(!r.isIndicator){if(r.type=="boxandwhisker")for(vi++,wi={xValue:u.point[e].xValue,YValues:u.point[e].boxPlotLocation[0].YValues},o=ej.EjSvgRender.utils._getPoint(wi,r),o.YValues=wi.YValues,a.push(o),tt=0;tt<u.point[e].boxPlotLocation.length;tt++)u.point[e].boxPlotLocation[tt].outlier==!0&&(sr={X:u.point[e].boxPlotLocation[tt].X,Y:u.point[e].boxPlotLocation[tt].Y,YValues:u.point[e].boxPlotLocation[tt].YValues,outlier:u.point[e].boxPlotLocation[tt].outlier},a.push(sr));else o=ej.EjSvgRender.utils._getPoint(u.point[e],r);if(this.model.financial=or==1&&pi==1&&r._hiloTypes||!1,y)if(this.model.financial?(ni=o.X>o.low?o.X:o.low,ti=o.X<o.low?o.X:o.low,g="M "+r.yAxis.x+" "+(o.Y+r.xAxis.y)+" L "+(ti+r.yAxis.x)+" "+(o.Y+r.xAxis.y)+" M "+(r.yAxis.x+ni)+" "+(o.Y+r.xAxis.y)+" L "+(r.yAxis.x+r.yAxis.width)+" "+(o.Y+r.xAxis.y)):g="M "+r.yAxis.x+" "+(o.Y+r.xAxis.y)+" L "+(r.yAxis.x+r.yAxis.width)+" "+(o.Y+r.xAxis.y),r.type=="boxandwhisker")for(c=0;c<a.length;c++)v.push({X:a[c].X,Y:a[c].Y,YValues:a[c].YValues,outlier:a[c].outlier});else v.push({X:u.point[e].location.X+r.yAxis.x,Y:u.point[e].location.Y+r.xAxis.y});else if(this.model.financial?(ni=o.Y<o.low?o.Y:o.low,ti=o.Y>o.low?o.Y:o.low,g="M "+(o.X+r.xAxis.x)+" "+n.model.m_AreaBounds.Y+" L "+(o.X+r.xAxis.x)+" "+(ni+r.yAxis.y)+" M "+(o.X+r.xAxis.x)+" "+(ti+r.yAxis.y)+" L "+(o.X+r.xAxis.x)+" "+(n.model.m_AreaBounds.Y+n.model.m_AreaBounds.Height)):g="M "+(o.X+r.xAxis.x)+" "+n.model.m_AreaBounds.Y+" L "+(o.X+r.xAxis.x)+" "+(n.model.m_AreaBounds.Y+n.model.m_AreaBounds.Height),r.type=="boxandwhisker")for(c=0;c<a.length;c++)v.push({X:a[c].X,Y:a[c].Y,YValues:a[c].YValues,outlier:a[c].outlier});else v.push({X:u.point[e].location.X+r.xAxis.x,Y:u.point[e].location.Y+r.yAxis.y});if(pr={left:er.left,top:er.top},hi={id:n.svgObject.id+"_Tracker",fill:"none","stroke-width":n.model.crosshair.line.width,"clip-path":"url(#"+n.svgObject.id+"_ChartAreaClipRect)",stroke:n.model.crosshair.line.color,d:g},$("#"+n.svgObject.id+"_Tracker").length==0?(rt?(k=this.svgRenderer.createCrosshairCanvas(),k.ctx=k.getContext("2d")):(k=this.svgRenderer,hr=n.gTrackball),n.svgRenderer.drawPath.call(k,hi,hr),si=!0):(si=!0,ej.util.isNullOrUndefined(this._closest)?n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_Tracker"),{d:g,visibility:"visible"}):this._beforeMin?this._closest>=u.point[e].xValue&&n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_Tracker"),{d:g,visibility:"visible"}):this._afterMax&&this._closest<=u.point[e].xValue&&n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_Tracker"),{d:g,visibility:"visible"}),$("#"+n.svgObject.id+"_Tracker").css({display:"block"}),rt&&(k=this.svgRenderer.createCrosshairCanvas(),k.ctx=k.getContext("2d"),n.svgRenderer.drawPath.call(k,hi,n.gTrackball)),$("#"+this._id).find('[id*="canvas_Tracker"]').css("visibility","visible")),ci=ej.EjSvgRender.utils._getTransform(r.xAxis,r.yAxis,y),gi={transform:"translate("+ci.x+","+ci.y+")",id:n.svgObject.id+"_TrackToolTip_"+s},n.gTransToolEle=n.svgRenderer.createGroup(gi),li=this.model.prePoint,ej.util.isNullOrUndefined(li)||li.pointIndex[0]!=u.index[0]||!$("#"+n.svgObject.id+"_trackSymbol_"+s+"_"+u.index)){if(ej.util.isNullOrUndefined(nr)&&(this.model.crosshair.tooltipTemplate!=null&&$(document).find('[id*="_TrackToolTipTemplate_"]').attr("visibility","hidden"),n.gTransToolEle&&n.gTrackerEle&&($(this.svgObject).find('[id*="_TrackSymbol_"],[id*="_TrackToolTip"]').attr("visibility","hidden"),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden")),nr=u),it=r.type.toLowerCase(),bi=0,(!r._hiloTypes||it.indexOf("rangearea")>-1)&&(ct!="grouping"||ct=="grouping"&&it.indexOf("column")<0&&it.indexOf("bar")<0))if(r.type=="boxandwhisker")for(ii=0;ii<a.length;ii++)n.drawTrackerSymbol(r,s,u.index[e],!0,a[ii],null,bi),bi++;else n.drawTrackerSymbol(r,s,u.index[e],!0,o);if(r.trackerRemoved=!0,n.model.crosshair.tooltipTemplate)ir,rr,ur=document.getElementById(this.svgRenderer.svgObj.id).getClientRects()[0],n.displayTemplateTooltip(ir,rr,o,u.point[e],r,s,u.index[e],ur);else if(b=v.length-1,yi=a.length,ct=="grouping"||!this.model.financial&&r._hiloTypes&&it!="rangearea"){var ki=this.getSeriesColor(u.point[e],s,r),di,cr=r.tooltip.format,at,lr,vt=[];if(r.type=="boxandwhisker")for(c=0;c<yi;c++)lr=this.getTooltipFormat(u.point[e],r,s,u.index[e],cr,a[c]),vt.push(lr),at=null;else at=this.getTooltipFormat(u.point[e],r,s,u.index[e],cr);if(ri=r.tooltip.font?r.tooltip.font.color?r.tooltip.font.color:ki:ki,ut=r.tooltip.font?$.extend(!1,r.font,{},r.tooltip.font):r.font,typeof ri=="object"&&(ri=ki[1].color),r.type=="boxandwhisker")for(w=0;w<vt.length;w++)ht.push({text:vt[w].text,seriesIndex:s,pointIndex:u.index[e]});else at.text=" "+at.text+" ",ht.push({text:at.text,seriesIndex:s,pointIndex:u.index[e]});if((r._hiloTypes&&it!="rangearea"||it.indexOf("column")>-1||it.indexOf("bar")>-1)&&(data={region:{Region:{PointIndex:u.index[e]},SeriesIndex:s}},this.highlightStart(i,data,this._id+"_svg_SeriesGroup_"+s,this._id+"_svg_Series"+s+"_Point"+u.index[e],!0)),r.type=="boxandwhisker")for(w=0;w<vt.length;w++)bt.push(n._id+"_grouping_text_"+s+"_"+u.index[e]+w);else bt.push(n._id+"_grouping_text_"+s+"_"+u.index[e]);if(di={color:ri,"font-size":ut.size,"font-family":ut.fontFamily,"font-style":ut.fontStyle,"font-weight":ut.fontWeight},r.type=="boxandwhisker")for(w=0;w<vt.length;w++)wt.push(di);else wt.push(di);vi==st&&r.type=="boxandwhisker"?n.displayTooltip(!0,{point:u.point[e],series:r,textCollection:ht,textOptionsCollection:wt,groupingTextId:bt}):st==ht.length&&r.type!="boxandwhisker"&&n.displayTooltip(!0,{point:u.point[e],series:r,textCollection:ht,textOptionsCollection:wt,groupingTextId:bt})}else{var tr=this.getTooltipFormat(u.point[e],r,s,f,r.tooltip.format,f),ar=r.tooltip,ut=ar.font?$.extend(!1,r.font,{},ar.font):r.font,p=ej.EjSvgRender.utils._measureText(tr.text,null,ut),d,fr=y?p.height:p.width,ot=ot>fr?ot:fr,ui=Math.ceil(tr.text.toString().split("<br/>").length/2);if(this.model.tooltipPadding=Number(ut.size.toString().replace(/px/i,""))/3,d=this.model.tooltipPadding+r.tooltip.border.width*2,y)et.push({Start:v[b].X-d-p.width/2,End:v[b].X+d+p.width/2}),l.push({Point:v[b],ClosestPoint:u.point[e],Series:r,ClosestPointIndex:u.index[e],Tgap:ai,StEnd:et[b],TextArea:p,ReqInvertAxis:y});else if(r.type=="boxandwhisker")for(c=0;c<yi;c++)et.push({Start:a[c].Y-d*ui-p.height/2,End:a[c].Y+d*ui+p.height/2}),l.push({Point:a[c],ClosestPoint:u.point[e],Series:r,ClosestPointIndex:u.index[e],Tgap:ai,StEnd:et[c],TextArea:p,ReqInvertAxis:y});else et.push({Start:v[b].Y-d*ui-p.height/2,End:v[b].Y+d*ui+p.height/2}),l.push({Point:v[b],ClosestPoint:u.point[e],Series:r,ClosestPointIndex:u.index[e],Tgap:ai,StEnd:et[b],TextArea:p,ReqInvertAxis:y});if(r.type=="boxandwhisker"&&vi==st)for(ot+=2*d,l=y?l.sort(function(n,t){return n.Point.X-t.Point.X}):l.sort(function(n,t){return n.Point.Y-t.Point.Y}),this.SmartTooltipPosition(l),fi=l.length,n.displayTooltip(!1,l,ot),f=0;f<fi;f++)s=$.inArray(l[f].Series,this.model._visibleSeries),l[f].Series._hiloTypes&&(data={region:{Region:{PointIndex:l[f].ClosestPointIndex},SeriesIndex:s}},this.highlightStart(i,data,this._id+"_svg_SeriesGroup_"+s,this._id+"_svg_Series"+s+"_Point"+l[f].ClosestPointIndex,!0));else if(l.length==st&&r.type!="boxandwhisker")for(ot+=2*d,l=y?l.sort(function(n,t){return n.Point.X-t.Point.X}):l.sort(function(n,t){return n.Point.Y-t.Point.Y}),this.SmartTooltipPosition(l),fi=l.length,n.displayTooltip(!1,l,ot),f=0;f<fi;f++)s=$.inArray(l[f].Series,this.model._visibleSeries),l[f].Series._hiloTypes&&(data={region:{Region:{PointIndex:l[f].ClosestPointIndex},SeriesIndex:s}},this.highlightStart(i,data,this._id+"_svg_SeriesGroup_"+s,this._id+"_svg_Series"+s+"_Point"+l[f].ClosestPointIndex,!0))}}else nt=$(this.svgObject).find('[id*="_TrackSymbol_"],[id*="_TrackToolTip"]'),this.svgRenderer._setAttr($(nt),{visibility:"visible"}),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","visible"),nt=$(this.svgObject).find('[id*="_TrackToolTip"]').children(),this.svgRenderer._setAttr($(nt),{visibility:"visible"}),nt=$(this.svgObject).find('[id*="_trackSymbol_"]'),this.svgRenderer._setAttr($(nt),{visibility:"visible"}),$(n.svgObject).find('[id*="_TrackAxisToolTip"]').attr("visibility","visible"),this.model.crosshair.tooltipTemplate!=null&&(nt=$(document).find('[id*="_TrackToolTipTemplate_"]'),this.svgRenderer._setAttr($(nt),{visibility:"visible"}))}}else $("#"+this.svgObject.id+"_TrackSymbol_"+s).remove();else this._removeTrackBall()}else si||$(n.svgObject).find('[id*="_Tracker"]').remove(),br=$("#"+n.svgObject.id+"_TrackSymbol_"+f),vr=this.svgObject.id+"_TrackSymbol_"+s,$("#"+this._id).find("[id*="+vr+"]").remove(),$("#"+n._id).find("[id*=_canvas_trackSymbol_"+f+"]").css("visibility","hidden"),this.model.enableCanvasRendering||($("[class*=HighlightStyle]").attr("class",""),$("[class*=HighlightLegendStyle]").attr("class",""),$("[class*=HighlightLegendPathStyle]").attr("class",""),$("[class*=HighlightPathStyle]").attr("class",""),$("[class*=Highlightseries]").attr("class",""),$("[id*="+this._id+"_Highlight_]").remove());r.trackerRemoved=!1}this.model.closestPoint!=null&&(this.model.prePoint={point:u.point,pointIndex:u.index,series:r,seriesIndex:s});$("#"+this.svgObject.id+"_TrackAxisToolTip").length==0&&this.model.crosshairLabelVisibility?(yr={id:n.svgObject.id+"_TrackAxisToolTip",visibility:"visible"},n.gTrackAxisEle=n.svgRenderer.createGroup(yr),n.svgRenderer.append(n.gTrackAxisEle,n.gTrackball)):$("#"+this.svgObject.id+"_TrackAxisToolTip").css("display","block");o&&(ei=u.point[0],rt?$(n.svgObject.parentElement).find('[id*="AxisToolTipRect"]').css({visibility:"hidden",display:"none"}):$(n.svgObject).find('[id*="_TrackAxisToolTip"]').attr("visibility","visible").children().attr({display:"none"}),$.each(n.model._axes,function(i,r){var c=r.x,l=r._opposed,f,u,s;if(y){if(r.orientation.toLowerCase()=="vertical"&&r.crosshairLabel.visible&&n.mousemoveY<=r.y+r.height&&r.y<=n.mousemoveY){var f=r._valueType.toLowerCase(),e=ei.xValue,h=[];f=="logarithmic"&&(e=Math.pow(r.logBase,e).toFixed(2).replace(new RegExp("\\.0{2}"),""));f=="datetime"&&(e=ej.format(new Date(Math.floor(e)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,kt));f=="category"&&(e=ej.EjSvgRender.utils._getLabelContent(e,r,kt));h={X:r.x,Y:o.Y+r.y};n.displayAxisTooltip(h,e,r,i,t)}}else r.orientation.toLowerCase()=="horizontal"&&r.crosshairLabel.visible&&o.X+c<=r.x+r.width&&r.x<=v[v.length-1].X&&(f=r._valueType.toLowerCase(),u=(o.X/r.width*r.visibleRange.delta+r.visibleRange.min).toFixed(2).replace(new RegExp("\\.0{2}"),""),f=="logarithmic"&&(u=Math.pow(r.logBase,u)),f=="datetime"&&(u=ej.format(new Date(Math.floor(u)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,kt)),(f=="category"||f=="datetimecategory")&&(typeof ei.x!="object"&&(u=ei.xValue),u=ej.EjSvgRender.utils._getLabelContent(Math.floor(u),r,kt),u=u?u:"undefined"),s={X:v[v.length-1].X,Y:l?r.y+r.height-r.majorTickLines.size:r.y+r.height+r.majorTickLines.size+10},n.displayAxisTooltip(s,u,r,i,t,!0))}))}},chartCrossHair:function(n,t){var d=ej.util.isNullOrUndefined(this.model.primaryYAxis.roundingPlaces)?2:this.model.primaryYAxis.roundingPlaces,o=n.model.enableCanvasRendering,s=this.model.locale,h,p,c,w,l,a,i,it;if(!this.model.enable3D&&this.model.crosshair.visible&&this.model.crosshair.type.toLowerCase()=="crosshair"){for($("#"+this.svgObject.id+"_CrosshairGroup").length==0?(h={id:this.svgObject.id+"_CrosshairGroup",visibility:"visible"},o?(h.position="absolute",n.svgRenderer.drawCrosshairLine(h,"#chartContainer_"+this._id)):(this.gCrosshair=this.svgRenderer.createGroup(h),this.svgRenderer.append(this.gCrosshair,this.svgObject))):$("#"+this.svgObject.id+"_CrosshairGroup").css("display","block"),n.model.trackerElement&&($.finish?$(this.model.trackerElement).finish():$(this.model.trackerElement).stop(!0,!0),this.model.trackerElement=null),a=0;a<this.model._axes.length;a++)i=this.model._axes[a],i.orientation.toLowerCase()=="vertical"?t.y>=i.y&&t.y<=i.y+i.height&&(i.x<t.x?p=Math.min(p||i.x,i.x):c=Math.max(c||i.x,i.x)):t.x>=i.x&&t.x<=i.x+i.width&&(i.y<t.y?w=Math.min(w||i.y,i.y):l=Math.max(l||i.y,i.y));var f=p||this.model.m_AreaBounds.X,b=c?c-f:this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width-f,e=w||this.model.m_AreaBounds.Y,k=l?l-e:this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height-e,g="M "+this.mousemoveX+" "+e+" L "+this.mousemoveX+" "+(e+k),nt="M "+f+" "+this.mousemoveY+" L "+(f+b)+" "+this.mousemoveY,v=$("#"+this._id).offset(),y=n.svgObject,r,u,tt={left:y.offsetLeft>v.left?y.offsetLeft:v.left,top:y.offsetTop>v.top?y.offsetTop:v.top};$("#"+n.svgObject.id+"_CrosshairVertical").length==0?(r={id:n.svgObject.id+"_CrosshairVertical",fill:"none","stroke-width":n.model.crosshair.line.width,stroke:n.model.crosshair.line.color,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",d:g},o?(r.width=0,r.height=k,r.top=e,r.left=f,r.position="absolute",r.style="solid",r.opacity=.5,n.svgRenderer.drawCrosshairLine(r,"#"+this.svgObject.id+"_CrosshairGroup")):n.svgRenderer.drawPath(r,n.gCrosshair)):(n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_CrosshairVertical"),{d:g}),o&&($("#secondCanvas").remove(),$("#"+n.svgObject.id+"_CrosshairVertical").css("left",this.mousemoveX).css({top:e,height:k,display:"block"})),$("#"+n.svgObject.id+"_CrosshairVertical").attr("visibility","visible").css("display","block"));$("#"+n.svgObject.id+"_CrosshairHorizontal").length==0?(u={id:n.svgObject.id+"_CrosshairHorizontal",fill:"none","stroke-width":n.model.crosshair.line.width,stroke:n.model.crosshair.line.color,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",d:nt},o?(u.top=e+tt.top,u.left=f+tt.left,u.width=b,u.height=0,u.position="absolute",u.style="solid",u.opacity=.5,n.svgRenderer.drawCrosshairLine(u,"#"+this.svgObject.id+"_CrosshairGroup")):n.svgRenderer.drawPath(u,n.gCrosshair)):(n.svgRenderer._setAttr($(n.svgObject).find("#"+n.svgObject.id+"_CrosshairHorizontal"),{d:nt}),$("#"+n.svgObject.id+"_CrosshairHorizontal").attr("visibility","visible").css("display","block"),o&&$("#"+n.svgObject.id+"_CrosshairHorizontal").css("top",this.mousemoveY).css({left:f,width:b,display:"block"}));$("#"+n.svgObject.id+"_AxisCrossToolTip").length==0?(it={id:n.svgObject.id+"_AxisCrossToolTip",visibility:"visible"},n.gTrackAxisEle=n.svgRenderer.createGroup(it),n.svgRenderer.append(n.gTrackAxisEle,n.gCrosshair)):(this.svgRenderer._setAttr($(n.gTrackAxisEle),{visibility:"visible"}),$(n.gTrackAxisEle).css("display","block"));$.each(n.model._axes,function(i,r){var u=r._valueType.toLowerCase(),o,f,h,e,c;r.orientation.toLowerCase()=="horizontal"&&r.crosshairLabel.visible?n.mousemoveX<=r.x+r.width&&r.x<=n.mousemoveX?(o=r._valueType=="category"&&r.labelPlacement.toLowerCase()=="betweenticks"?.5:0,f=(Math.abs(n.mousemoveX-(r.isInversed?r.x+r.width:r.x))/r.width*r.visibleRange.delta+r.visibleRange.min+o).toFixed(2).replace(new RegExp("\\.0{2}"),""),u=="logarithmic"&&(f=Math.pow(r.logBase,f).toFixed(2).replace(new RegExp("\\.0{2}"),"")),u=="datetime"&&(f=ej.format(new Date(Math.floor(f)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,s)),(u=="category"||u=="datetimecategory")&&(f=ej.EjSvgRender.utils._getLabelContent(f,r,s)),h={X:n.mousemoveX,Y:r.y},n.displayAxisTooltip(h,f,r,i,t),$("#"+n.svgObject.id+"_AxisToolTipText_"+i).show(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).show()):($("#"+n.svgObject.id+"_AxisToolTipText_"+i).hide(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).hide()):r.orientation.toLowerCase()=="vertical"&&r.crosshairLabel.visible&&(n.mousemoveY<=r.y+r.height&&r.y<=n.mousemoveY?(e=(Math.abs(1-Math.abs(n.mousemoveY-(r.isInversed?r.y+r.height:r.y))/r.width/r.height)*r.visibleRange.delta+r.visibleRange.min).toFixed(d).replace(new RegExp("\\.0{"+d+"}"),""),u=="logarithmic"&&(e=Math.pow(r.logBase,e).toFixed(2).replace(new RegExp("\\.0{2}"),"")),u=="datetime"&&(e=ej.format(new Date(Math.floor(e)),ej.util.isNullOrUndefined(r.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(r._intervalType):r.labelFormat,s)),(u=="category"||u=="datetimecategory")&&(e=ej.EjSvgRender.utils._getLabelContent(e,r,s)),c={X:r.x,Y:n.mousemoveY},n.displayAxisTooltip(c,e,r,i,t),$("#"+n.svgObject.id+"_AxisToolTipText_"+i).show(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).show()):($("#"+n.svgObject.id+"_AxisToolTipText_"+i).hide(),$("#"+n.svgObject.id+"_AxisToolTipRect_"+i).hide()))})}},chartTouchMove:function(n){this.cancelEvent(n);n=n.originalEvent.touches[0];this.chartInteractiveBehavior(n)},isZoomButtonHovered:function(n){if(n.parentNode!=null){var t=n.parentNode.id,i=n.id;if(i.indexOf("_ZoomInBtn ")==-1&&i.indexOf("ZoomOutBtn")==-1&&i.indexOf("_ZoomBtn")==-1&&i.indexOf("_ResetZoom")==-1&&i.indexOf("_PanBtn")==-1&&t&&t.indexOf("_ZoomInBtn")==-1&&t.indexOf("_ZoomOutBtn")==-1&&t.indexOf("_ZoomBtn")==-1&&t.indexOf("_ResetZoom")==-1&&t.indexOf("_PanBtn")==-1)return!1}return!0},showTooltipOnDrag:function(n){$("#"+n.svgObject.id).find("#"+n.svgObject.id+"_TrackToolTip").attr("visibility","visible");$("#"+n.svgObject.id+"_TrackToolTip").show();$(".tooltipDiv").css("display","block")},chartInteractiveBehavior:function(n){var e=this.calMousePosition(n),u,o,s,t,f,r,i,h;this.mousemoveX=e.X;this.mousemoveY=e.Y;u="#"+this.svgObject.id;this.mouseWheelCoords&&(o=Math.abs(this.mouseWheelCoords.x-n.pageX),s=Math.abs(this.mouseWheelCoords.y-n.pageY),(o>0||s>0)&&!this.panning?this.enableTrackBall():this.disableTrackBall());t=this;r=n.target.id;t.model.AreaType=="cartesianaxes"&&this.mousemoveX>=this.model.m_AreaBounds.X&&this.mousemoveX<this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width&&this.mousemoveY<this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height&&this.mousemoveY>=this.model.m_AreaBounds.Y&&this.model.initSeriesRender?(f={x:t.mousemoveX,y:t.mousemoveY},r=t.svgRenderer._getAttrVal($(n.target).parent(),"id"),r!=undefined&&(r==t.svgRenderer._getAttrVal($(this.svgObject).find(u+"_ZoomBtn"),"id")||r==t.svgRenderer._getAttrVal($(this.svgObject).find(u+"_ResetZoom"),"id")||r==t.svgRenderer._getAttrVal($(this.svgObject).find(u+"_PanBtn"),"id"))?this.disableTrackBall():this.enableTrackBall(),this.model.crosshair.visible||this.isZoomButtonHovered(n.target)?this.dragPoint?this.showTooltipOnDrag(t,n):this.closestXyPoint||($("#"+t.svgObject.id).find("#"+t.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+t.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv"+this._id).css("display","none")):this.tooltip(t,n),this.model.enable3D||(this.chartTrackball(t,f,n),this.chartCrossHair(t,f))):(t.model.AreaType!="none"&&t.model.AreaType!="polaraxes"||this.isZoomButtonHovered(n.target)?this.dragPoint?this.showTooltipOnDrag(t,n):this.closestXyPoint||($("#"+t.svgObject.id).find("#"+t.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+t.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv"+this._id).css("display","none"),this._removeTrackBall(),this._removeHighlight()):this.tooltip(t,n),i=this.model.prevPoint,i&&i.point&&(this.model.enableCanvasRendering?$("#canvas_trackSymbol").remove():(h=i.series.type=="boxandwhisker"?i.outlierPosition:ej.EjSvgRender.utils._getPoint(i.point,i.series),t.drawTrackerSymbol(i.series,i.seriesIndex,i.pointIndex,null,h)),this.model.prevPoint=null))},highlightSvg:function(n,t,i,r,u,f,e){var s,o,h;t!=undefined&&(s=this.svgObject.id+"_SeriesGroup_",o=t.substr(s.length),t.indexOf(this.svgObject.id+"_symbolGroup_")>=0&&(s=this.svgObject.id+"_symbolGroup_",o=t.substr(s.length)));o=u!=undefined?u.region.SeriesIndex:o;h=this.model.series[o];i&&h&&(h.highlightSettings.enable||e)&&this.highlight(n,r,h,null,u,t,f,e)},highlightCanvas:function(n,t,i){for(var c,e,u,s,o,i,r,f=0;f<this.model._visibleSeries.length;f++)if(c=f,e=this.model._visibleSeries[f],u=e.type.toLowerCase(),this.model.AreaType=="cartesianaxes"&&e.visibility.toLowerCase()=="visible"&&u!=="scatter"&&u!=="bubble"&&u!=="column"&&u.indexOf("bar")==-1&&u!=="stackingcolumn"&&u!=="stackingcolumn100"&&!e._hiloTypes){var h=this.calMousePosition(t);this.mousemoveX=h.X;this.mousemoveY=h.Y;s=this.getClosesPointXY([],[],e,this.mousemoveX,this.mousemoveY,t);ej.util.isNullOrUndefined(s.point)||(o=$.extend({},ej.EjSvgRender.commonChartEventArgs),o.data={location:{x:this.mousemoveX,y:this.mousemoveY},region:{SeriesIndex:f,Region:{PointIndex:s.index}}})}i=o?o.data:i;i&&this.model.series[i.region.SeriesIndex].highlightSettings.enable&&(r=$.extend({},this.model.series[i.region.SeriesIndex]),r.pointIndex=i.region.Region.PointIndex,r.seriesIndex=i.region.SeriesIndex,r.data=i,$("#"+this._id+"_Selection_series"+r.seriesIndex+"_canvas").length==0&&($("[id*="+this._id+"_Highlight_]").remove(),this.findCanvasSelection(r.seriesIndex,r.pointIndex,r.selectionSettings.mode.toLowerCase())||this.canvasHighlight(this,t,r)))},resizeCursor:function(n,t,i,r,u,f,e){var o=this.selectedRectIndex;t<=r||i<=u||t>=f+r||i>=e+u?($("#"+n+"_resize_rightRect"+o).css({cursor:"default"}),$("#"+n+"_resize_leftRect"+o).css({cursor:"default"}),$("#"+n+"_resize_bottomRect"+o).css({cursor:"default"}),$("#"+n+"_resize_topRect"+o).css({cursor:"default"}),$("#"+n+"_resize_bottomRightCornerCircle"+o).css({cursor:"default"})):(t>=r||i>=u||t<=f+r||i<=e+u)&&($("#"+n+"_resize_rightRect"+o).css({cursor:"e-resize"}),$("#"+n+"_resize_leftRect"+o).css({cursor:"w-resize"}),$("#"+n+"_resize_bottomRect"+o).css({cursor:"s-resize"}),$("#"+n+"_resize_topRect"+o).css({cursor:"n-resize"}),$("#"+n+"_resize_bottomRightCornerCircle"+o).css({cursor:"se-resize"}))},multiSelectMouseMove:function(evt){var q,rectOptions,translate;if(this._isMultiSelect&&this.multiSelectMode=="range"&&!this.dragPoint){var mouseMoveCords=this.calMousePosition(evt),mouseMoveX=mouseMoveCords.X,mouseMoveY=mouseMoveCords.Y,gripMouseMoveX,gripMouseMoveY,translate,selectionSettingsType=this.multiSelectType,width,height,x,y,rectX,rectY,rectWidth,rectHeight,x1,x2,y1,y2,xPlotOffset,yPlotOffset,modifiedX,modifiedY,mouseDownX=this.mouseDownX,mouseDownY=this.mouseDownY,selectedRectIndex=this.selectedRectIndex,containerSvg=this.svgObject.id,chartArea="#"+containerSvg+"_ChartArea";for(chartAreaX=parseInt($(chartArea).attr("x")),chartAreaY=parseInt($(chartArea).attr("y")),chartAreaWidth=parseInt($(chartArea).attr("width")),chartAreaHeight=parseInt($(chartArea).attr("height")),multiSelectMouseDownId=this.multiSelectMouseDownId,selctRectId="#"+containerSvg+"_selectRect",multiAxis=this.multiAxis,q=0;q<multiAxis.length;q++)multiAxis[q].orientation.toLowerCase()=="horizontal"?(x1=multiAxis[q].Location.X1,x2=multiAxis[q].Location.X2,xPlotOffset=multiAxis[q].plotOffset):(y1=multiAxis[q].Location.Y1,y2=multiAxis[q].Location.Y2,yPlotOffset=multiAxis[q].plotOffset);if(this.drag&&!this.resize&&!this.rectPan&&!this.removeRect){var currentX=mouseMoveX,currentY=mouseMoveY,areaBounds=this.model.m_AreaBounds;this.multiSelectDraw=!0;mouseMoveX<areaBounds.X?currentX=areaBounds.X:mouseMoveX>areaBounds.X+areaBounds.Width&&(currentX=areaBounds.X+areaBounds.Width);currentY=mouseMoveY<areaBounds.Y?areaBounds.Y:mouseMoveY>areaBounds.Y+areaBounds.Height?areaBounds.Y+areaBounds.Height:mouseMoveY;switch(selectionSettingsType){case"x":width=Math.abs(currentX-mouseDownX);height=y1-y2+yPlotOffset+yPlotOffset;x=currentX>mouseDownX?mouseDownX:currentX;y=y2-yPlotOffset;break;case"y":width=x2-x1+xPlotOffset+xPlotOffset;height=Math.abs(currentY-mouseDownY);x=x1-xPlotOffset;y=currentY>mouseDownY?mouseDownY:currentY;break;case"xy":width=Math.abs(currentX-mouseDownX);height=Math.abs(currentY-mouseDownY);x=currentX>mouseDownX?mouseDownX:currentX;y=currentY>mouseDownY?mouseDownY:currentY}width>0&&height>0&&(rectOptions={id:this.svgObject.id+"_selectRect"+this.selectedRectIndex,x:x,y:y,width:width,height:height,fill:"rgba(41,136,214,0.2)","stroke-width":2,stroke:"rgba(41,136,214,0.5)",cursor:"pointer","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},x>=x1+xPlotOffset&&mouseMoveX<=x2-xPlotOffset&&mouseMoveY<=y1+yPlotOffset&&y>=y2-yPlotOffset&&this.svgRenderer.drawRect(rectOptions,this.gEle),this.gEle!=null&&($(this.gEle).appendTo(this.parentgEle),this.selectedRectIndex==0&&(this.model.gCurrentEle=this.gEle),$(this.parentgEle).appendTo(this.svgObject)))}if(rectX=parseInt($(selctRectId+selectedRectIndex).attr("x")),rectY=parseInt($(selctRectId+selectedRectIndex).attr("y")),rectWidth=parseInt($(selctRectId+selectedRectIndex).attr("width")),rectHeight=parseInt($(selctRectId+selectedRectIndex).attr("height")),!this.drag&&(evt.target.id.indexOf("selectRect")>=0||evt.target.id.indexOf("resize")>=0)){evt.target.parentNode.id.indexOf("selectedRect")>=0&&(id=evt.target.parentNode.id.split("selectedRect")[1].match(/\d+/)[0],this.gripIndex=eval(id));var selectRectId="#"+containerSvg+"_selectRect",selectRectWidth=parseInt($(selectRectId+this.gripIndex).attr("width")),selectRectHeight=parseInt($(selectRectId+this.gripIndex).attr("height")),selectRectX=parseInt($(selectRectId+this.gripIndex).attr("x")),selectRectY=parseInt($(selectRectId+this.gripIndex).attr("y"));$("#"+containerSvg+"_gripCollection"+selectedRectIndex).css({visibility:"hidden"});(selectRectX+selectRectWidth-16>=selectRectX||selectRectY+selectRectHeight-16>=selectRectY)&&$("#"+this.svgObject.id+"_gripCollection"+this.gripIndex).attr({transform:""});(selectRectX+selectRectWidth-16<selectRectX||selectRectY+selectRectHeight-16<selectRectY)&&(translate="translate(15,15)",$("#"+this.svgObject.id+"_gripCollection"+this.gripIndex).attr({transform:translate}));this.oldId!=evt.target.id&&$("#"+containerSvg+"_gripCollection"+this.oldGripIndex).css({visibility:"hidden"});$("#"+containerSvg+"_gripCollection"+this.gripIndex).css({visibility:"visible"});this.oldId=evt.target.id;this.oldGripIndex=this.gripIndex}if(evt.target.id.indexOf("selectRect")<0&&evt.target.id.indexOf("resize")<0&&$("#"+containerSvg+"_gripCollection"+this.gripIndex).css({visibility:"hidden"}),this.resize){$("#"+containerSvg+"_closeTopRightCornerCircle"+selectedRectIndex).hide();$("#"+containerSvg+"_closePath"+selectedRectIndex).hide();$("#"+containerSvg+"_closePathOpposite"+selectedRectIndex).hide();$("#"+containerSvg+"_gripCollection"+selectedRectIndex).css({visibility:"hidden"});var oldRectX=this.oldRectX[selectedRectIndex],oldRectY=this.oldRectY[selectedRectIndex],oldRectHeight=this.oldRectHeight[selectedRectIndex],oldRectWidth=this.oldRectWidth[selectedRectIndex],oldReBottomRectY=this.oldReBottomRectY[selectedRectIndex],oldReRightRectX=this.oldReRightRectX[selectedRectIndex];switch(selectionSettingsType){case"x":multiSelectMouseDownId==containerSvg+"_resize_rightRect"+selectedRectIndex?(rectWidth=mouseMoveX-oldRectX,$("#"+containerSvg+"_resize_rightRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX<oldRectX?(rectX=mouseMoveX,rectWidth=oldRectX-mouseMoveX):mouseMoveX>=oldRectX&&(rectX=oldRectX)):multiSelectMouseDownId==containerSvg+"_resize_leftRect"+selectedRectIndex&&(rectX=mouseMoveX,rectWidth=oldRectWidth+oldRectX-mouseMoveX,$("#"+containerSvg+"_resize_leftRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX>oldReRightRectX+5&&(rectX=oldReRightRectX+5,rectWidth=mouseMoveX-oldRectX-oldRectWidth));this.resizeCursor(containerSvg,mouseMoveX,mouseMoveY,chartAreaX,chartAreaY,chartAreaWidth,chartAreaHeight);break;case"y":multiSelectMouseDownId==containerSvg+"_resize_topRect"+selectedRectIndex?(rectHeight=oldRectHeight+oldRectY-mouseMoveY,rectY=mouseMoveY,$("#"+containerSvg+"_resize_topRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY>oldReBottomRectY+5&&(rectY=oldReBottomRectY+5,rectHeight=mouseMoveY-oldRectY-oldRectHeight)):multiSelectMouseDownId==containerSvg+"_resize_bottomRect"+selectedRectIndex&&(rectHeight=mouseMoveY-oldRectY,$("#"+containerSvg+"_resize_bottomRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY<oldRectY?(rectY=mouseMoveY,rectHeight=oldRectY-mouseMoveY):mouseMoveY>=oldRectY&&(rectY=oldRectY));this.resizeCursor(containerSvg,mouseMoveX,mouseMoveY,chartAreaX,chartAreaY,chartAreaWidth,chartAreaHeight);break;case"xy":multiSelectMouseDownId==containerSvg+"_resize_rightRect"+selectedRectIndex?(rectWidth=mouseMoveX-oldRectX,$("#"+containerSvg+"_resize_rightRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX<oldRectX?(rectX=mouseMoveX,rectWidth=oldRectX-mouseMoveX):mouseMoveX>=oldRectX&&(rectX=oldRectX)):multiSelectMouseDownId==containerSvg+"_resize_leftRect"+selectedRectIndex?(rectX=mouseMoveX,rectWidth=oldRectWidth+oldRectX-mouseMoveX,$("#"+containerSvg+"_resize_leftRect"+selectedRectIndex).attr("x",mouseMoveX-5),mouseMoveX>oldReRightRectX+5&&(rectX=oldReRightRectX+5,rectWidth=mouseMoveX-oldRectX-oldRectWidth)):multiSelectMouseDownId==containerSvg+"_resize_topRect"+selectedRectIndex?(rectHeight=oldRectHeight+oldRectY-mouseMoveY,rectY=mouseMoveY,$("#"+containerSvg+"_resize_topRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY>oldReBottomRectY+5&&(rectY=oldReBottomRectY+5,rectHeight=mouseMoveY-oldRectY-oldRectHeight)):multiSelectMouseDownId==containerSvg+"_resize_bottomRect"+selectedRectIndex?(rectHeight=mouseMoveY-oldRectY,$("#"+containerSvg+"_resize_bottomRect"+selectedRectIndex).attr("y",mouseMoveY-5),mouseMoveY<oldRectY?(rectY=mouseMoveY,rectHeight=oldRectY-mouseMoveY):mouseMoveY>=oldRectY&&(rectY=oldRectY)):multiSelectMouseDownId==containerSvg+"_resize_bottomRightCornerCircle"+selectedRectIndex&&(rectWidth=mouseMoveX-oldRectX,rectHeight=mouseMoveY-oldRectY,$("#"+containerSvg+"_resize_bottomRightCornerCircle"+selectedRectIndex).attr({cx:mouseMoveX,cy:mouseMoveY}),mouseMoveX<oldRectX&&mouseMoveY<oldRectY?(rectX=mouseMoveX,rectY=mouseMoveY,rectWidth=oldRectX-mouseMoveX,rectHeight=oldRectY-mouseMoveY):mouseMoveX<oldRectX?(rectX=mouseMoveX,rectWidth=oldRectX-mouseMoveX):mouseMoveY<oldRectY?(rectY=mouseMoveY,rectHeight=oldRectY-mouseMoveY):mouseMoveX>=oldRectX&&mouseMoveY>=oldRectY&&(rectX=oldRectX,rectY=oldRectY));this.resizeCursor(containerSvg,mouseMoveX,mouseMoveY,chartAreaX,chartAreaY,chartAreaWidth,chartAreaHeight)}switch(selectionSettingsType){case"x":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX,width:rectWidth});break;case"y":rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({y:rectY,height:rectHeight});break;case"xy":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX,y:rectY,width:rectWidth,height:rectHeight})}}if(this.rectPan){$("#"+containerSvg+"_closeTopRightCornerCircle"+selectedRectIndex).hide();$("#"+containerSvg+"_closePath"+selectedRectIndex).hide();$("#"+containerSvg+"_closePathOpposite"+selectedRectIndex).hide();$("#"+containerSvg+"_gripCollection"+selectedRectIndex).css({visibility:"hidden"});(mouseMoveX<=chartAreaX||mouseMoveY<=chartAreaY||mouseMoveX>=chartAreaX+chartAreaWidth||mouseMoveY>=chartAreaY+chartAreaHeight)&&this.multiSelectMouseUp(evt);modifiedX=this.PreviousCoords.X-evt.pageX;modifiedY=this.PreviousCoords.Y-evt.pageY;rectX=rectX-modifiedX;rectY=rectY-modifiedY;this.PreviousCoords.X=evt.pageX;this.PreviousCoords.Y=evt.pageY;switch(selectionSettingsType){case"x":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX});break;case"y":rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({y:rectY});break;case"xy":rectX>=x1-xPlotOffset&&rectWidth+rectX-x1<=x2-x1-xPlotOffset&&rectHeight+rectY-y2<=y1-y2+yPlotOffset&&rectY>=y2-yPlotOffset&&$(selctRectId+selectedRectIndex).attr({x:rectX,y:rectY})}}}},isTouch:function(n){var i=this.model.browserInfo,t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},highlightStart:function(n,t,i,r,u){if(n.target.parentNode!=null)var i=i||n.target.parentNode.id,f=i.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||i.indexOf(this.svgObject.id+"_symbolGroup_")>=0||i.indexOf(this.svgObject.id+"_TrackSymbol_")>=0||i.indexOf(this.svgObject.id+"_Chart3D")>=0?!0:!1;this.model.enableCanvasRendering?this.highlightCanvas(this,n,t):this.highlightSvg(this,i,f,n,t,r,u)},_changeDraggingPoints:function(n,t,i,r){i=n.xAxis._valueType=="datetime"?new Date(i):i;r=n.yAxis._valueType=="datetime"?new Date(r):r;dragType=n.dragSettings.type.toLowerCase();(dragType=="x"||dragType=="xy")&&n.xAxis._valueType!="category"&&(this.dragPoint?(n.pointCollection[t].x=i,n.pointCollection[t].xValue=n.xAxis._valueType=="datetime"&&typeof i!="object"?new Date(i):i):(n._visiblePoints[t].x=n.points[t].x=i,n._visiblePoints[t].xValue=n.points[t].xValue=n.xAxis._valueType=="datetime"&&typeof i=="object"?Date.parse(i):i),ej.util.isNullOrUndefined(n.dataSource)||(n.dataSource[t][n.xName]=i));(dragType=="y"||dragType=="xy")&&(this.dragPoint?(n.pointCollection[t].y=r,n.pointCollection[t].YValues[0]=n.yAxis._valueType=="datetime"&&typeof r!="object"?new Date(r):r):(n._visiblePoints[t].y=n.points[t].y=r,n._visiblePoints[t].YValues[0]=n.points[t].YValues[0]=n.yAxis._valueType=="datetime"&&typeof r=="object"?Date.parse(r):r),ej.util.isNullOrUndefined(n.dataSource)||(n.dataSource[t][n.yName]=r))},_dragDelta:function(n,t,i,r,u,f){var h=this,o={X:i,Y:r},s={X:n,Y:t},e=$.extend({},this.commonDragEventArgs);e.data={seriesIndex:u,pointIndex:f,oldValue:o,newValue:s};this._trigger("dragging",e);this.commonDragEventArgs=e},_getDraggedPoint:function(n,t,i){var u,o,s,f,e,r=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes);return this.model.requireInvertedAxes?(f=r.y+r.height-i,e=t-r.x):(f=t-r.x,e=r.y+r.height-i),u=ej.EjSvgRender.utils._getValuebyPoint(f,e,n),o=parseFloat(u.PointX.toFixed(2)),s=parseFloat(u.PointY.toFixed(2)),{X:o,Y:s}},_pointDragandDrop:function(n,t,i){var w=n.data.seriesIndex,y=[],b=null,f=n.type.toLowerCase(),h={},c,p,it,ut,r,e,u,o;for(h.axes={},c=0;c<this.model._axes.length;c++)h.axes[this.model._axes[c].name]={};$("[id*=_Marker]").remove();var k=this._getDraggedPoint(n,this.mousemoveX,this.mousemoveY),d=k.X,g=k.Y,nt=this.commonDragEventArgs.data.currentPoint?this.commonDragEventArgs.data.currentPoint.xValue:this.commonDragEventArgs.data.oldValue.X,tt=this.commonDragEventArgs.data.currentPoint?this.commonDragEventArgs.data.currentPoint.yValue[0]:this.commonDragEventArgs.data.oldValue.Y;if(n.region?(o=n.region,i._dragDelta(d,g,nt,tt,o.SeriesIndex,o.Region.PointIndex)):(p=n.pointData,i._dragDelta(d,g,nt,tt,p.seriesIndex,p.index)),this.model.enableCanvasRendering)this.canvasElement&&this.canvasElement.clearRect(0,0,i.svgWidth,i.svgHeight),$("#"+i._id+"_PreviewSeries"+w+"_canvas").length==0&&(it=document.getElementById(i._id+"_canvas").getBoundingClientRect(),canvasElement=this.createCanvasElement(i._id+"_PreviewSeries"+w+"_canvas",i.svgWidth,i.svgHeight,it),this.createRect(i,canvasElement),this.canvasElement=canvasElement);else{n.xAxis=n.xAxis===null||n.xAxis===undefined?this.model._axes[0]:n.xAxis;n.yAxis=n.yAxis===null||n.yAxis===undefined?this.model._axes[1]:n.yAxis;var rt=ej.EjSvgRender.utils._getTransform(n.xAxis,n.yAxis,this.model.requireInvertedAxes),b="translate("+rt.x+","+rt.y+")",ht={id:this.svgObject.id+"_PreviewSeriesGroup",transform:b,cursor:"default",visibility:"visible"};$("#"+this.svgObject.id+"_PreviewSeriesGroup").attr("transform",b);this.gPreviewSeriesGroupEle||(this.chartObj=i,this.chartObj.gPreviewSeriesGroupEle=this.gPreviewSeriesGroupEle=this.svgRenderer.createGroup(ht));this.gPreviewSeriesGroupEle.childNodes.length>0&&this.gPreviewSeriesGroupEle.removeChild(this.gPreviewSeriesGroupEle.childNodes[0])}y=$.extend(!0,{},n._visiblePoints);n.pointCollection=y;y.length=n._visiblePoints.length;var l=i.commonDragEventArgs.data,s=l.pointIndex,a=l.seriesIndex;if(i._changeDraggingPoints(n,s,l.newValue.X,l.newValue.Y),ut=new ej.seriesTypes[f],r=n.pointCollection[s],f=="bubble")u=ej.EjSvgRender.utils._getPoint(r,n),e={id:this.svgObject.id+"_PreviewSeries"+a+"_Point"+s,cx:u.X+this.canvasX,cy:u.Y+this.canvasY,r:r.radius,fill:n.fill,"stroke-width":2,visibility:"visible","stroke-dasharray":"",opacity:.6,stroke:"transparent"},this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawCircle(e,canvasElement):this.svgRenderer.drawCircle(e,this.gPreviewSeriesGroupEle),this.svgRenderer.append(this.gPreviewSeriesGroupEle,this.gSeriesEle);else if(f=="scatter"){var u=ej.EjSvgRender.utils._getPoint(r,n),ft=n.marker.shape.capitalizeFirstString(),u={startX:u.X+this.canvasX,startY:u.Y+this.canvasY},et={ShapeSize:{width:n.marker.size.width,height:n.marker.size.height},ID:this.svgObject.id+"_PreviewSeries"+a+"_Point"+s,Style:{Color:n.fill,BorderWidth:n.marker.border.width,BorderColor:"transparent",Opacity:.6,Visibility:"visible"}};this.model.enableCanvasRendering?ej.EjSvgRender.chartSymbol["_draw"+ft](u,et,this,canvasElement):ej.EjSvgRender.chartSymbol["_draw"+ft](u,et,this,this.gPreviewSeriesGroupEle);this.svgRenderer.append(this.gPreviewSeriesGroupEle,this.gSeriesEle)}else if(f=="column"||f=="bar"){r.xValue=typeof r.xValue=="object"?Date.parse(r.xValue):r.xValue;var ct=ej.EjSeriesRender.prototype.getOrigin(i,n,h),lt=n.sidebysideInfo,ot=r.YValues[0],at=ct,st=ej.EjSeriesRender.prototype.calculateSides(r,lt),vt=st.x1,yt=st.x2,v=ej.EjSeriesRender.prototype.getRectangle(vt,ot,yt,at,n,i);e={id:this.svgObject.id+"_PreviewSeries"+a+"_Point"+s,x:v.X+this.canvasX,y:v.Y+this.canvasY,width:v.Width,height:v.Height,cornerRadius:n.cornerRadius,fill:n.fill,"stroke-width":2,plot:ot<0?"negative":"positive",opacity:.6,stroke:"transparent","stroke-dasharray":""};this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawRect(e,canvasElement):(this.svgRenderer.drawRect(e,this.gPreviewSeriesGroupEle),this.svgRenderer.append(this.gPreviewSeriesGroupEle,this.gSeriesEle))}else(f=="spline"||f=="splinearea")&&(r.xValue=typeof r.xValue=="object"?Date.parse(r.xValue):r.xValue),ut.draw(this,n,h);u=ej.EjSvgRender.utils._getPoint(r,n);n.tooltip.visible&&(ej.util.isNullOrUndefined(n.tooltip.template)?($(".tooltipDiv"+this._id).remove(),i.displayShowTooltip(u,r,n,r.actualIndex)):($("#"+i.svgObject.id).find("#"+i.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),o={SeriesIndex:a,Region:{PointIndex:r.actualIndex}},i.createTooltip(o,t,n)))},_dragPointMarker:function(n,t,i,r,u){var f=null,o=n.seriesIndex,s,h,e;f=ej.EjSvgRender.utils._getPoint(u.point,n);this.model.enableCanvasRendering?$("#"+this.svgObject.id+"_Marker").length==0&&(s=document.getElementById(this.svgObject.id).getBoundingClientRect(),ctx=this.createCanvasElement(this.svgObject.id+"_Marker",this.svgWidth,this.svgHeight,s)):(h={id:this.svgObject.id+"_markerGroup_"+o},this.gMarkerGroupEle||(this.gMarkerGroupEle=this.svgRenderer.createGroup(h)));e={id:this.svgObject.id+"_Series"+o+"_Point"+u.index+"_Marker",cx:f.X+this.model.m_AreaBounds.X,cy:f.Y+this.model.m_AreaBounds.Y,r:7,fill:n.fill,"stroke-width":3,opacity:1,stroke:"white",visibility:"visible"};this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawCircle(e,ctx):(this.svgRenderer.drawCircle(e,this.gMarkerGroupEle),this.svgRenderer.append(this.gMarkerGroupEle,this.gSeriesEle))},_dragPointGripper:function(n){var i=n.region.type.toLowerCase(),f=this.model._visibleSeries[n.region.SeriesIndex],h=f._visiblePoints[n.region.Region.PointIndex],e,o,s,t,u,r;if(transposed=f.isTransposed,inversed=f.yAxis.isInversed,i=="column"||i=="bar"){for(this.model.enableCanvasRendering?(e=document.getElementById(this.svgObject.id).getBoundingClientRect(),canvasGripper=this.createCanvasElement(this.svgObject.id+"_Marker",this.svgWidth,this.svgHeight,e),document.getElementById(canvasGripper.canvas.id).style.zIndex=1):(o={id:this.svgObject.id+"_markerGroup_"+n.region.SeriesIndex},this.gMarkerGroupEle||(this.gMarkerGroupEle=this.svgRenderer.createGroup(o))),s=3,t=n.region.Region.Bounds,(transposed&&i=="bar"||i=="column"&&!transposed)&&(value=t.Width,boundValue=t.X),(!transposed&&i=="bar"||i=="column"&&transposed)&&(value=t.Height,boundValue=t.Y),loc=value<75?value-value/3:50,diff=value>75?value-75:0,radius=(loc-6)/6,cxy=diff/2+boundValue+loc/6+radius/2,u=1;u<=s;u++)r={id:this.svgObject.id+"_Series"+n.region.SeriesIndex+"_Point"+n.region.Region.PointIndex+"_Marker"+u,fill:"white",opacity:1,stroke:"white",visibility:"visible"},cxy+=u==1?radius:2*radius+3,r.r=Math.abs(radius),(transposed&&i=="bar"||i=="column"&&!transposed)&&(r.cx=cxy,r.cy=inversed?t.Y+t.Height-radius-5:t.Y+radius+5),(!transposed&&i=="bar"||i=="column"&&transposed)&&(r.cx=inversed?t.X+radius+5:t.X+t.Width-radius-5,r.cy=cxy),this.model.enableCanvasRendering?ej.EjCanvasRender.prototype.drawCircle(r,canvasGripper):this.svgRenderer.drawCircle(r,this.gMarkerGroupEle);this.svgRenderer.append(this.gMarkerGroupEle,this.gSeriesEle)}},chartMouseMove:function(n){function a(t){var i=o._id,r;$("#"+i+"_tooltip").length<=0?(r=$("<div><\/div>").attr({id:i+"_tooltip","class":"zoom"+i}),$(r).html(" "+t+" "),$(document.body).append(r),$(r).css({left:n.pageX+10,top:n.pageY+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"})):$("#"+i+"_tooltip").css({left:n.pageX+10,top:n.pageY+10})}var ui=this.GetSeriesPoint(n),h=this.svgObject,t=this.model,at=t.zooming.enable,y=t.enableCanvasRendering,ai,vt,yt,pt,tt,fi,vi,it,rt,o,ei,oi,k,e,wt,bt,kt,dt,p,ti,ii,i,st,ht,si,hi,v,ri,s,c,lt,r,u,b;if(t.event=n,clearTimeout(this.removeTooltip),this.doPan&&n.target.id.indexOf(this._id+"_scrollbar")>-1&&(this.doPan=!1),ai=n.target.classList,vt={left:0,top:0},this.multiSelectAreaType!="cartesianaxes"||at||y||this.multiSelectMouseMove(n),this.rotateActivate&&this.oPreviousCoords){if(yt=this.oPreviousCoords.Y-this.mousemoveY,pt=this.oPreviousCoords.X-this.mousemoveX,(pt||yt)&&(t.tilt-=yt,t.rotation+=pt,this.model.isSelected&&(tt=this.selectedStyle(this)),this.isTouch(n)||$(this.chart3D).empty(),$("#template_group_"+this._id).empty(),fi={Width:$(h).width(),Height:$(h).height()},this.graphics.view(h,this,t.rotation,t.tilt,fi,t.perspectiveAngle,t.depth),this.svgRenderer.append(this.chart3D,h),this.model.isSelected))for(i=0;i<tt.length;i++)$("#"+tt[i].id).attr("class",tt[i].className);this.oPreviousCoords.Y=this.mousemoveY;this.oPreviousCoords.X=this.mousemoveX}for(vi=n.target.id,svgObjectId=h.id,isZoom=this.isZoomButtonHovered(n.target),visibleSeries=t._visibleSeries,st=visibleSeries.length,$("[id*=_Marker]").remove(),i=st-1;i>=0;i--)if(chartSeries=visibleSeries[i],k=chartSeries.type.toLowerCase(),chartSeries.dragSettings.enable&&!t.enable3D){if(this._enableDragging(chartSeries,i,n),this.dragPoint)break;if(nt=this.calMousePosition(n),this.mousemoveX=nt.X,this.mousemoveY=nt.Y,it=this.GetSeriesPoint(n),!chartSeries.marker.visible&&k!="bubble"&&k!="scatter"&&k!="column"&&k!="bar"&&(rt=this.getClosesPointXY(ei,oi,chartSeries,this.mousemoveX,this.mousemoveY,n),rt.point)){chartSeries.seriesIndex=i;this._dragPointMarker(chartSeries,this.mousemoveX,this.mousemoveY,n,rt);this.closestXyPoint=rt;break}if(it&&it.region.SeriesIndex==i){this._dragPointGripper(it);break}}if(o=this,this.dragPoint&&(ei=[],oi=[],$(document).keyup(function(n){n.keyCode==27&&($(".tooltipDiv"+this._id).remove(),$("#"+svgObjectId+"_TrackToolTip").remove(),o.dragPoint=!1,visibleSeries[o.commonDragEventArgs.data.seriesIndex].pointCollection=null,o.chartMouseUp(n))}),c=this.dragIndex.seriesIndex,o._pointDragandDrop(visibleSeries[c],n,o)),this.calMousePosition(n),$("#"+this._id+"_tooltip").remove(),!this.dragPoint&&(this.drag||isZoom||(this.isTouch(n)||t.doubleTapped)&&!t.crosshairMoved)||this.chartInteractiveBehavior(n),t.crosshair.visible&&t.AreaType=="cartesianaxes"||(y&&ui||($("[class*=HighlightStyle]").attr("class",""),$("[class*=HighlightLegendStyle]").attr("class",""),$("[class*=HighlightLegendPathStyle]").attr("class",""),$("[class*=HighlightPathStyle]").attr("class",""),$("[class*=Highlightseries]").attr("class",""),$("[id*="+this._id+"_Highlight_]").remove()),this.highlightStart(n,ui)),!this.panning&&(e="#"+svgObjectId,at&&t.AreaType=="cartesianaxes"&&!t.enable3D&&this.drag&&!this.dragPoint&&!this.chartRightClick)){this.disableTrackBall();$("#"+svgObjectId+"_ZoomArea").remove();var ut,ft,et,ot,r=this.mousemoveX,u=this.mousemoveY,f=t.m_AreaBounds;this.mousemoveX<f.X?r=f.X:this.mousemoveX>f.X+f.Width&&(r=f.X+f.Width);u=this.mousemoveY<f.Y?f.Y:this.mousemoveY>f.Y+f.Height?f.Y+f.Height:this.mousemoveY;wt=t.zooming.type.toLowerCase();wt=="x"?(ut=Math.abs(r-this.mouseDownX),ft=f.Height,et=r>this.mouseDownX?this.mouseDownX:r,ot=f.Y):wt=="y"?(ut=f.Width,ft=Math.abs(u-this.mouseDownY),et=f.X,ot=u>this.mouseDownY?this.mouseDownY:u):(ut=Math.abs(r-this.mouseDownX),ft=Math.abs(u-this.mouseDownY),et=r>this.mouseDownX?this.mouseDownX:r,ot=u>this.mouseDownY?this.mouseDownY:u);$(h).css({"-moz-user-select":"-moz-none","-khtml-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none","user-select":"none"});this.zooming=!0;bt={id:svgObjectId+"_ZoomArea",x:et+vt.left,y:ot+vt.top,width:ut,height:ft,fill:"rgba(69,114,167,0.25)","stroke-width":1,stroke:"rgba(69,114,167,0.25)","clip-path":"url(#"+svgObjectId+"_ChartAreaClipRect)"};y?this.svgRenderer.drawZoomRect(bt,this):this.svgRenderer.drawRect(bt,h)}if(kt=t.zooming.enableDeferredZoom,this.panning&&this.doPan&&t.AreaType=="cartesianaxes"&&!this.dragPoint)if(this.currentPageX=n.pageX,this.currentPageY=n.pageY,$("#"+this._id+"_canvas").css({cursor:"pointer"}),ej.isTouchDevice()||kt){if(ej.isTouchDevice()||kt){for(p=0;p<visibleSeries.length;p++){var s=t.series[p],d=ej.EjSvgRender.utils._getTransform(s.xAxis,s.yAxis,t.requireInvertedAxes),gt=n.pageX-this.oPreviousCoords.x+d.x,ni=n.pageY-this.oPreviousCoords.y+d.y,g="translate("+gt+","+ni+")";$("#"+svgObjectId+"_SeriesGroup_"+p).attr("transform",g);$("#"+svgObjectId+"_symbolGroup_"+p).attr("transform",g);$("#"+svgObjectId+"_TextGroup_"+p).attr("transform",g)}for(c=0;c<t.indicators.length&&t.indicators[c]._points.length>0;c++)ti=t.indicators[c],d=ej.EjSvgRender.utils._getTransform(ti.xAxis,ti.yAxis,t.requireInvertedAxes),gt=n.pageX-this.oPreviousCoords.x+d.x,ni=n.pageY-this.oPreviousCoords.y+d.y,g="translate("+gt+","+ni+")",$("#"+svgObjectId+"_indicatorGroup_"+c).attr("transform",g)}}else dt={x:this.oPreviousCoords.x-n.pageX,y:this.oPreviousCoords.y-n.pageY},this.oPreviousCoords={x:n.pageX,y:n.pageY},$.each(t._axes,function(n,t){var i=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1);o.translate(t,dt.x,dt.y,i)}),this._updateScroll(),this.redraw(!0,null,n.target,this.isTouch(n)),this._cursorToPointer(),this._enableZoomingButtons();var w=n.target.id,e=this._id,l=ej.util.isNullOrUndefined(n.target.parentNode)?"":n.target.parentNode.id;if(at&&(l==e+"_svg_ResetZoom"?a(this._localizedLabels.reset):l==e+"_svg_PanBtn"?a(this._localizedLabels.pan):l==e+"_svg_ZoomBtn"?a(this._localizedLabels.zoom):l==e+"_svg_ZoomInBtn"?a(this._localizedLabels.zoomIn):l==e+"_svg_ZoomOutBtn"&&a(this._localizedLabels.zoomOut)),ii=this.getAxisLabelData(n),ii&&(b=$.extend({},ej.EjSvgRender.commonChartEventArgs),b.data=ii,this._trigger("axisLabelMouseMove",b)),!this.isTouch(n))for(this.axisTooltip(n,w),t.title.enableTrim&&this.showTitleTooltip(n,w),i=0,st=t.series.length;i<st;i++)s=t.series[i],ht=s.marker.dataLabel,!s._enableSmartLabels||this.model.enable3D||ht.enableWrap||(si=ht.template,hi=ht.font,t.AreaType=="none"&&ej.util.isNullOrUndefined(si)&&this.datalabelTooltip(n,i,hi));if($(h).find(e+"_ResetZoom,"+e+"_PanBtn,"+e+"_ZoomBtn").length>0&&$(h).find(e+"_ResetZoom,"+e+"_PanBtn,"+e+"_ZoomBtn").appendTo(h),v=this.getLegendData(n),v)if(ri=$.extend({},ej.EjSvgRender.commonChartEventArgs),ri.data=v,v.series.highlightSettings.enable&&(y?(s=$.extend({},v.series),s.seriesIndex=v.legendItem.LegendItem.SeriesIndex,s.pointIndex=v.legendItem.LegendItem.PointIndex,c=this.model.AreaType=="none"?s.pointIndex:s.seriesIndex,$("#"+o._id+"_Selection_Legend"+c+"_canvas").length==0&&($("[id*="+this._id+"_Highlight_]").remove(),this.canvasHighlight(o,n,s,v))):this.highlight(o,n,v.series,v)),this._trigger("legendItemMouseMove",ri),y){var nt=this.calMousePosition(n),ci=nt.X,li=nt.Y,ct=t.LegendBounds;$(this.legendContainer).children().css({cursor:"pointer"});ci>=ct.X&&ci<=ct.X+t.LegendViewerBounds.Width&&li<=ct.Y+t.LegendViewerBounds.Height&&li>=ct.Y&&this._textTooltip(n,t.legendTextRegion)}else this._textTooltip(n,t.legendTextRegion);else y&&$(this.legendContainer).children().css("cursor","default");y&&(w.indexOf("_ResetZoom")!=-1||l.indexOf("_ResetZoom")!=-1?a(this._localizedLabels.reset):w.indexOf("_PanBtn")!=-1||l.indexOf("_PanBtn")!=-1?a(this._localizedLabels.pan):w.indexOf("_ZoomBtn")!=-1||l.indexOf("_ZoomBtn")!=-1?a(this._localizedLabels.zoom):w.indexOf("_ZoomInBtn")!=-1||l.indexOf("_ZoomInBtn")!=-1?a(this._localizedLabels.zoomIn):(w.indexOf("_ZoomOutBtn")!=-1||l.indexOf("_ZoomOutBtn")!=-1)&&a(this._localizedLabels.zoomOut),this.isTouch(n)||(this._textTooltip(n,t.xAxisLabelRegions),this._textTooltip(n,t.yAxisLabelRegions)));lt=this;t.xAxisTitleRegion&&(r=this.mousemoveX,u=this.mousemoveY,$.each(t.xAxisTitleRegion,function(t,i){r>=i.Bounds.X&&r<=i.Bounds.X+i.Bounds.Width&&u>=i.Bounds.Y-i.Bounds.Height&&u<=i.Bounds.Y&&i.trimText!=i.labelText&<.showAxisTooltip(n.pageX,n.pageY,i.labelText)}));t.yAxisTitleRegion&&(r=this.mousemoveX,u=this.mousemoveY,$.each(t.yAxisTitleRegion,function(t,i){r>=i.Bounds.X&&r<=i.Bounds.X+i.Bounds.Width&&u>=i.Bounds.Y-i.Bounds.Height&&u<=i.Bounds.Y&&i.trimText!=i.labelText&<.showAxisTooltip(n.pageX,n.pageY,i.labelText)}));t.axisMultiLevelLabelRegions&&(r=this.mousemoveX,u=this.mousemoveY,$.each(t.axisMultiLevelLabelRegions,function(t,i){r>=i.Bounds.X&&r<=i.Bounds.X+i.Bounds.Width&&u>=i.Bounds.Y-i.Bounds.Height&&u<=i.Bounds.Y&&i.trimText!=i.labelText&<.showAxisTooltip(n.pageX,n.pageY,i.labelText)}));b=$.extend({},ej.EjSvgRender.commonChartEventArgs);b.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:t.svgHeight,width:t.svgWidth},id:n.target.id,pageX:n.pageX,pageY:n.pageY};this._trigger("chartMouseMove",b)},axisTooltip:function(n,t){var o=this.svgObject.id,s=this.model.hAxes,h=this.model.vAxes,i,r,u,f,e;if(t.indexOf("_YLabel_")>=0){for(r=0;r<h.length;r++)if(t.indexOf(o+"_"+h[r].name+"_YLabel_")>=0){i=h[r];break}if(i&&i.enableTrim)for(visibleLabelsLength=i.visibleLabels.length,u=0;u<visibleLabelsLength&&this.model.AreaType=="cartesianaxes";u++)if(t==o+"_"+h[r].name+"_YLabel_"+u){if(f=i.visibleLabels[u],e=f.Text==f.displayText?"":i.labelFormat?i.labelFormat.replace("{value}",f.Text):f.Text,e=="")break;i.labelPosition.toLowerCase()=="inside"&&(this._hideTooltip(),this._removeTrackBall());this.showAxisTooltip(n.pageX,n.pageY,e)}}if(t.indexOf("_XLabel_")>=0){for(r=0;r<s.length;r++)if(t.indexOf(o+"_"+s[r].name+"_XLabel_")>=0){i=s[r];break}if(i&&(i.enableTrim||i.labelIntersectAction.toLowerCase()=="trim"||i.labelIntersectAction.toLowerCase()=="wrap"||i.labelIntersectAction.toLowerCase()=="wrapbyword"))for(visibleLabelsLength=i.visibleLabels.length,u=0;u<visibleLabelsLength&&this.model.AreaType=="cartesianaxes";u++)if(t==o+"_"+s[r].name+"_XLabel_"+u){if(f=i.visibleLabels[u],e=f.Text==f.displayText?"":f.Text,e=="")break;i.labelPosition.toLowerCase()=="inside"&&(this._hideTooltip(),this._removeTrackBall());this.showAxisTooltip(n.pageX,n.pageY,e)}}},showTitleTooltip:function(n,t){var a=ej.EjSvgRender.utils._measureText(this.model.title.text,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,this.model.title.font),i=this.model,r=i._titleLocation,u=i._subTitleLocation,c=i.title.enableTrim,o=i.elementSpacing,f=this.mousemoveX,e=this.mousemoveY,v=i.title.textOverflow.toLowerCase(),l=i.title.subTitle.enableTrim,y=i.title.subTitle.textOverflow.toLowerCase(),s=i.title.text,h=i.title.subTitle.text;c&&this.model.trimTooltip&&(t.indexOf("ChartTitleText")>=0?this.showAxisTooltip(n.pageX,n.pageY,s):this.model.enableCanvasRendering&&f>=r.X-o&&f<=r.X-o+r.size.width&&e>=r.Y-r._height&&e<=r.Y+r.size.height&&this.showAxisTooltip(n.pageX,n.pageY,s));l&&i.subTitleTooltip&&(t.indexOf("ChartSubTitleText")>=0?this.showAxisTooltip(n.pageX,n.pageY,h):i.enableCanvasRendering&&f>=u.X&&f<=u.X+u.size.width&&e>=u.Y&&e<=u.Y+u.size.height&&this.showAxisTooltip(n.pageX,n.pageY,h))},_updateScroll:function(){for(var i=this.model.scrollObj,f=i?i.length:0,r=this.model._axes,u=this.scrollbarContainer,n,t=0;t<f;t++)i[t]&&(n=i[t],(n.zoomPosition!=r[t].zoomPosition||n.zoomFactor!=r[t].zoomFactor)&&(n.zoomPosition=r[t].zoomPosition,n.zoomFactor=r[t].zoomFactor,u._initializeScrollbarVariables(n),u._scrollbarUpdate.call(this,n),u._setScrollPosition.call(this,n.startX,n.startX+n.rectWidth,n)))},_hideTooltip:function(){$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden");$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden").hide();$(".tooltipDiv"+this._id).css("display","none")},_removeHighlight:function(){var n,t;if($("[id*=HighlightSegment]").remove(),$("[id*=HighlightPath]").remove(),$("[id*=HighlightLegendSegment]").remove(),$("[id*=HighlightLegendPath]").remove(),$("[id*=HighlightDef]").remove(),$("[id*=Highlightseries]").remove(),$("[id*="+this._id+"_Highlight_]").remove(),!this.model.enableCanvasRendering&&!this.vmlRendering)if(n=this.svgObject.querySelector("[class^='Highlight']"),n!==null&&n.length==null)n.removeAttribute("class");else for(t=n&&n.length;t--;)n.removeAttribute("class")},_removeSelection:function(){$("[id*="+this._id+"_SelectionCluster_Legend]").remove();$("[id*="+this._id+"_Selection_series]").remove();$("[id*="+this._id+"_Selection_Cluster]").remove();$("[id*="+this._id+"SelectionSegment]").remove();$("[id*="+this._id+"SelectionPath]").remove();$("[id*="+this._id+"SelectionLegend]").remove();$("[id*="+this._id+"SelectionDef]").remove();$("[id*="+this._id+"Selectionseries]").remove();$("[id*="+this._id+"_Selection_]").remove()},datalabelTooltip:function(n,t,i){var y=this.calMousePosition(n);this.mousemoveX=y.X;this.mousemoveY=y.Y;var c=this._id,s=this.mousemoveX,p=this.mousemoveY,w=this.vmlRendering,u=this.model.elementSpacing,e=this,h,l,a,v,r,f,o;ej.util.isNullOrUndefined(this.accDataLabelRegion[t])||$.each(this.accDataLabelRegion[t],function(t,y){h=y.bounds.minX;l=y.bounds.minY;a=y.bounds.maxX;v=y.bounds.maxY;w&&(h=y.bounds.minX+y.bounds.width/2,a=y.bounds.maxX+y.bounds.width/2,l=y.bounds.minY,v=y.bounds.maxY);s>=h&&s<=a&&p>=l&&p<=v&&($("#"+c+"_tooltip").remove(),r=$("<div><\/div>").attr({id:c+"_tooltip","class":"ejTooltip"+c}),y.trimmedText!=y.text&&($("#"+e.svgObject.id+"_TrackToolTip").hide(),$(r).html(y.text),$(document.body).append(r),f=ej.EjSvgRender.utils._measureText(y.text,y.text.length,y.font).width,$(r).css({top:n.pageY+u,display:"block",position:"absolute","z-index":"13000",cursor:"default",color:"#000000","font-size":i.size,"background-color":"#FFFFFF",border:"1px solid #707070","white-space":"nowrap",padding:"5px"}),(y.type=="pyramid"||y.type=="funnel")&&(o=e.model.m_AreaBounds.Width+e.model.m_AreaBounds.X-n.pageX,o>f?$(r).css({left:n.pageX+u}):(left=n.pageX-f+2*u,$(r).css({left:left}))),(y.type=="pie"||y.type=="doughnut"||y.type=="pieofpie")&&(h>y.bounds.centerX?(o=e.svgWidth-e.model.margin.left-e.model.margin.right-s,o<f?(left=n.pageX-f,$(r).css({left:left+u})):$(r).css({left:n.pageX+u})):(o=s,o<f?$(r).css({left:n.pageX+u}):(left=n.pageX-f,$(r).css({left:left-2*u}))))))})},showAxisTooltip:function(n,t,i){var u=this._id,r=$("<div><\/div>").attr({id:u+"_tooltip","class":"ejTooltip"+u});$(r).html(" "+i+" ");$(document.body).append(r);$(r).css({left:n+10,top:t+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"})},_textTooltip:function(n,t){var a=this,o=this.calMousePosition(n),r=this.model.legend._ejScroller,v=r?$("#legend_"+this._id).ejScroller("instance").model.scrollTop:$("#legend_"+this._id).scrollTop(),y=r?$("#legend_"+this._id).ejScroller("instance").model.scrollLeft:$("#legend_"+this._id).scrollLeft(),s=o.X,h=o.Y,u=s,f=h,e=this._id,p=a.model,c=p.legend,w=c.enableScrollbar,b=c.textOverflow.toLowerCase(),l,i;(w||r)&&(u=s+y,f=h+v);$.each(t,function(t,r){u>=r.bounds.x&&u<=r.bounds.x+r.bounds.width&&f>=r.bounds.y-r.bounds.height/3&&f<=r.bounds.y&&($("#"+e+"_tooltip").remove(),i=$("<div><\/div>").attr({id:e+"_tooltip","class":"ejTooltip"+e}),l=jQuery.type(r.trimText)=="array"?r.trimText.join(" "):r.trimText,l!=r.labelText&&($(i).html(" "+r.labelText+" "),$(document.body).append(i),$(i).css({left:n.pageX+10,top:n.pageY+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"})))})},pieExplosion:function(n){var a,v,c,y,f,r,e,l,o;this.model.explode=!0;var t=n,u,s,i=t.region.Series,p=t.region.SeriesIndex,h=new ej.seriesTypes[i.type.toLowerCase()],w=i.explodeIndex,b=i.labelPosition.toLowerCase();if(currentExplodePoint={SeriesIndex:t.pointData[0].SeriesIndex,PointIndex:t.pointData[0].PointIndex},a=this.model._isPieOfPie?t.pointData[0].PointIndex:t.region.Series._visiblePoints[t.pointData[0].PointIndex].actualIndex,w!=a&&!t.region.Series.explodeAll){if(i.explodeIndex=a,pieSeriesIndex=t.pointData[0].PieSeriesIndex,!ej.util.isNullOrUndefined(this.model.explodeValue)&&this.model.explodeValue!=currentExplodePoint){for(this.model.explodeValue.SeriesIndex!=t.region.SeriesIndex&&(i=this.model._visibleSeries[this.model.explodeValue.SeriesIndex]),v=this.model._isPieOfPie?this._getPieOfPiePoint(this.model.explodeValue.PointIndex,i):i._visiblePoints[this.model.explodeValue.PointIndex],c=h._calculateArcData(this,this.model.explodeValue.PointIndex,v,i,this.model.explodeValue.SeriesIndex,this.model.explodeValue.PieSeriesIndex),u=this.svgObject.id+"_SeriesGroup_"+this.model.explodeValue.SeriesIndex,s=this.model.explodeValue.PieSeriesIndex==1?$(this.gSeriesEle).children("#"+u)[1]:$(this.gSeriesEle).children("#"+u)[0],f=$(s).children(),r=0;r<f.length;r++)if(e=f[r],l=this.svgRenderer._getAttrVal($(e)[0],"pointIndex"),parseInt(l)==this.model.explodeValue.PointIndex){this.svgRenderer._setAttr($(e),{d:c.Direction});break}h.drawDataLabelAcc(this,i,this.model.explodeValue.PointIndex,v,this.model.explodeValue.SeriesIndex,this.model.explodeValue.PieSeriesIndex)}for(y=this.model._isPieOfPie?this._getPieOfPiePoint(n.region.Region.PointIndex,i):i._visiblePoints[t.pointData[0].PointIndex],c=h._calculateArcData(this,t.pointData[0].PointIndex,y,t.region.Series,p,pieSeriesIndex),u=this.svgObject.id+"_SeriesGroup_"+t.region.SeriesIndex,s=pieSeriesIndex==1?$(this.gSeriesEle).children("#"+u)[1]:$(this.gSeriesEle).children("#"+u)[0],f=$(s).children(),r=0;r<f.length;r++)if(e=f[r],l=this.svgRenderer._getAttrVal($(e)[0],"pointIndex"),parseInt(l)==t.pointData[0].PointIndex){this.svgRenderer._setAttr($(e),{d:c.Direction});break}this.model.enableCanvasRendering&&(o=document.getElementById(this.svgObject.id).getClientRects()[0],this.svgRenderer.ctx.clearRect(o.left,o.top,o.width,o.height),$("#"+this._id).ejChart("redraw"));h.drawDataLabelAcc(this,i,t.pointData[0].PointIndex,y,p,pieSeriesIndex);this.model.explodeValue={SeriesIndex:t.pointData[0].SeriesIndex,PointIndex:t.pointData[0].PointIndex,PieSeriesIndex:t.pointData[0].PieSeriesIndex}}t.region.Series.explodeIndex=w},displayTemplateTooltip:function(n,t,i,r,u,f,e,o){var h=$.extend(!0,{},r),y=5,p=this.model.locale,b,c,k,v;h.x=h.X;u.xAxis._valueType.toLowerCase()=="datetime"&&(h.x=ej.format(new Date(h.X),ej.util.isNullOrUndefined(u.xAxis.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(u.xAxis.intervalType):u.xAxis.labelFormat,p));u.xAxis._valueType.toLowerCase()=="category"&&(h.x=ej.EjSvgRender.utils._getLabelContent(e,u.xAxis,p));n=ej.util.isNullOrUndefined(n)?0:n;t=ej.util.isNullOrUndefined(t)?0:t;var l=this.model.m_AreaBounds.X+o.left,a=i.X+n+l+this.model.crosshair.marker.size.width+y,w=i.Y+t+this.model.m_AreaBounds.Y+o.top,s;$("#"+this.svgObject.id+"_TrackToolTipTemplate_"+f).length==0?(s=$("<div class='TrackToolTipTemplate' style='position: absolute; z-index: 13000; display: block;'><\/div>"),$(document.body).append(s)):($(document).find('[id*="_TrackToolTipTemplate_"]').css("display","block"),s=$("#"+this.svgObject.id+"_TrackToolTipTemplate_"+f),s.empty());this.svgRenderer._setAttr($(s),{id:this.svgObject.id+"_TrackToolTipTemplate_"+f});this.model.crosshair.tooltipTemplate!=null&&(b=$("#"+this.model.crosshair.tooltipTemplate).clone(),$(b).css("display","block").appendTo(s),u.count=1,h.count=1,c=this.getSeriesColor(h,f,u),$(s).css("background-color",jQuery.type(c)=="array"?c[0].color:c),k={series:u,point:h},$(s).html($(s).html().parseTemplate(k)));w-=parseFloat($(s).css("height"))/2;v=parseFloat($(s).css("width"));a+v>l+this.model.m_AreaBounds.Width&&(a=i.X+n+l-this.model.crosshair.marker.size.width-y-v);$(s).css("left",a);$(s).css("top",w)},displayAxisTooltip:function(n,t,i,r,u,f){var it,p,ut,h,v,y;i._valueType.toLowerCase()=="double"&&(it=i.labelFormat?i.labelFormat.match("{value}"):null,t=i.labelFormat?it!=null?i.labelFormat=="${value}"?i.labelFormat.replace("{value}","$"+Number(t)):i.labelFormat.replace("{value}",Number(t)):ej.format(Number(t),i.labelFormat,this.model.locale):t);var l=0,rt=i.orientation.toLowerCase(),a,g=0,nt=0,o=i._opposed,d=this.model.enableCanvasRendering,ft=o?l+10+(i.x+i.width):i.x+i.width;for(p=0;p<this.model._axes.length;p++)this.model._axes[p].majorTickLines.size>l&&(l=this.model._axes[p].majorTickLines.size);if(n.X>=0&&n.X<=ft){var e=n.X,c=n.Y,s=5,w=$.extend({},ej.EjSvgRender.commonChartEventArgs);w.data={axisIndex:r,chartAxis:i,currentTrackText:t,location:u};this._trigger("trackAxisToolTip",w);ut=w.data.currentTrackText;h=ej.EjSvgRender.utils._measureText(ut,null,i.crosshairLabel.font);rt=="horizontal"&&(e=e-h.width/2,i.labelPosition=="inside"||(o?u.y<i.y:u.y>i.y)?(o==!1&&(c=i.y-h.height+l-(i._isScroll?this.model.scrollerSize:0),a="top"),o==!0&&(c=i.y+h.height-l,a="bottom")):(o==!0&&(c=i.y-h.height/2-s-l,a="bottom"),o==!1&&(c=i.y+h.height-s+l,a="top")),g=s,c=c+(i._isScroll?i.opposedPosition?-this.model.scrollerSize:this.model.scrollerSize:0));!o&&e+h.width>this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&(e=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X-h.width+s+this.model.elementSpacing);rt=="vertical"&&(c=n.Y+h.height/4,i.labelPosition=="inside"||!o&&u.x<i.x?(o==!0&&(e=i.x-h.width+s-l,a="left"),o==!1&&(e=i.x+2*s+(i._isScroll?this.model.scrollerSize:0),a="right")):(o==!0&&(e=i.x+3*s,a="left"),o==!1&&(e=i.x-h.width-l,a="right")),e=e+(i._isScroll?i.opposedPosition?this.model.scrollerSize:-this.model.scrollerSize:0),nt=s);var et={id:this.svgObject.id+"_AxisToolTipText_"+r,x:e-nt,y:c+g,fill:i.crosshairLabel.font.color,"font-size":i.crosshairLabel.font.size,"font-family":i.crosshairLabel.font.fontFamily,"font-style":i.crosshairLabel.font.fontStyle,"font-weight":i.crosshairLabel.font.fontWeight,"text-anchor":"start",opacity:i.crosshairLabel.font.opacity},ct=d?s/4:0,tt=ej.EjSvgRender.utils._measureText(w.data.currentTrackText,this.model.m_AreaBounds.Width,i.crosshairLabel.font),b=i.crosshairLabel,e=e-s,c=c-tt.height,ot=tt.width+2*s,st=2*tt.height-2*s,k={x:e-nt,y:c+g,width:ot,height:st,rx:b.rx*(d?2:1),ry:b.ry*(d?2:1)},ht=ej.EjSvgRender.utils._calculateroundedCorner(k,!0,a,0,f);k={id:this.svgObject.id+"_AxisToolTipRect_"+r,d:ht,fill:b.fill,"stroke-width":b.border.width,stroke:b.border.color};v=this.model._axes[r];u.y<v.y+v.height&&u.y>v.y||u.x<v.x+v.width&&u.x>v.x?(this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipRect_"+r),{display:"block"}),this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipText_"+r),{display:"block"}),k.display="block"):(this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipRect_"+r),{display:"none"}),this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipText_"+r),{display:"none"}),k.display="none");d?(y=this.svgRenderer.createCrosshairCanvas(),y.ctx=y.getContext("2d")):y=this.svgRenderer;this.svgRenderer.drawPath.call(y,k,this.gTrackAxisEle);this.svgRenderer.drawText.call(y,et,w.data.currentTrackText,this.gTrackAxisEle)}},maxWdithArrayCollection:function(n,t){for(var i=0,u,r=0,e=0,o=ej.EjSvgRender.utils._measureText,f=0,s=n.length;f<s;f++)u=o(n[f],0,t),r=u.width,e+=u.height,i=i==0?r:i<r?r:i;return{maxTextWidth:i,totalHeight:e}},displayTooltip:function(n,t,i){var ii=this.model.crosshair,b=ii.trackballTooltipSettings,kt=b.rx,dt=b.ry,yt=b.border,o=this.model.m_AreaBounds,e,pi,nt,wi,k,ut,ki,sr,it,et,di,fi,vt,ei,tr,ir,bt,oi;if(n){var u=t.series,si,gt,rr=document.getElementById(this._id),pr=$(rr).offset(),at=u.tooltip,ht=at.font?$.extend(!1,u.font,{},at.font):u.font,ni=u.type=="boxandwhisker"?t.point.boxPlotLocation[3]:t.point.location,ri=u.marker.size.width/2+u.marker.border.width+yt.width+5,ai=u._isTransposed?u.xAxis.y+ri:u.yAxis.y,ur=u._isTransposed?u.yAxis.x:u.xAxis.x+ri,r={X:ur+ni.X,Y:ai+ni.Y},ct=t.textCollection,vi=t.textOptionsCollection,yi=t.groupingTextId,h,rt={X:r.X,Y:r.Y},pt=document.getElementById(this._id+"_trackball_grouping_tooltip");if(this._trigger("trackToolTip",{data:{currentText:ct,location:rt}}),!ej.util.isNullOrUndefined(this.model.trackToolTip)&&this.model.trackToolTip!="")for(e=0,ut=ct.length;e<ut-1;e++)ct[e].text==""&&(ct.splice(e,1),vi.splice(e,1),yi.splice(e,1));for(ej.util.isNullOrUndefined(pt)?(pt=document.createElement("div"),h={left:rt.X,top:rt.Y,border:parseInt(yt.width?yt.width:1)+"px solid "+(yt.color?yt.color:"#000000"),background:b.fill?b.fill:"#ffffff",opacity:b.opacity,position:"absolute",height:"auto",width:"auto","border-radius":kt+"px "+dt+"px","pointer-events":"none"},pt.setAttribute("id",this._id+"_trackball_grouping_tooltip")):h={left:rt.X,top:rt.Y},e=0,ut=ct.length;e<ut;e++)span=document.createElement("span"),span.setAttribute("id",yi[e]),span.innerHTML=ct[e].text+"<\/br>",$(span).css(vi[e]),pt.appendChild(span);pi=ct.map(function(n){return n.text});si=this.maxWdithArrayCollection(pi,ht);i=si.maxTextWidth;gt=si.totalHeight;h.top=u._isTransposed?h.top:h.top-gt*.5;h.left=u._isTransposed?h.left-i*.5:h.left;ct.length>1&&(h.top=u._isTransposed?h.top:ai+(o.Height*.5-.5*gt),h.left=u._isTransposed?o.Width/2+o.X-i*.5:h.left);u._isTransposed?gt+h.top>o.Y+o.Height&&(h.top-=gt+ri*2):h.left+i>=o.X+o.Width&&(h.left-=i+(ri+yt.width)*2);h.left=rt.X==r.X?h.left:rt.X;h.top=rt.Y==r.Y?h.top:rt.Y;$(pt).css(h);$(pt).appendTo(this.chartContainer)}else for(nt=0,wi=t.length;nt<wi;nt++){var r=t[nt].Point,ni=t[nt].ClosestPoint,u=t[nt].Series,ui=t[nt].ClosestPointIndex,ti=t[nt].Tgap,ft=$.inArray(u,this.model._visibleSeries),y={X1:o.X,Y1:o.Y+o.Height,X2:o.X+o.Width,Y2:o.Y},d=this.model._axes,fr=u._xAxisName,er=u._yAxisName;for(k=0,ut=d.length;k<ut;k++)fr==d[k].name?u._isTransposed?(y.Y1=d[k].Location.Y1,y.Y2=d[k].Location.Y2):(y.X1=d[k].Location.X1,y.X2=d[k].Location.X2):er==d[k].name&&(u._isTransposed?(y.X1=d[k].Location.X1,y.X2=d[k].Location.X2):(y.Y1=d[k].Location.Y1,y.Y2=d[k].Location.Y2));if(r.X=u.type=="boxandwhisker"?r.X+y.X1:r.X,r.Y=u.type=="boxandwhisker"?r.Y+y.Y2:r.Y,r.X>=y.X1&&r.X<=y.X2&&r.Y>=y.Y2&&r.Y<=y.Y1||n){var tt=this.model.requireInvertedAxes,e,a,v=r.X+(u.isIndicator?0:ej.util.isNullOrUndefined(u._trackMarker)?u.marker.size.width:u._trackMarker.size.width)+f+1,p=r.Y,bi=u.tooltip.format,or=ej.util.isNullOrUndefined(u.yAxis.roundingPlaces)?2:u.yAxis.roundingPlaces;if(ki=t[nt].Series.type=="boxandwhisker"&&r.outlier?this.getTooltipFormat(ni,u,ft,ui,bi,r):this.getTooltipFormat(ni,u,ft,ui,bi,or),sr=u.name?u.name.replace(" ",""):"series"+ft,it=$.extend({},ej.EjSvgRender.commonChartEventArgs),it.data={Location:{X:v,Y:p},Series:u,serIndex:ft,pointIndex:ui,currentText:ki.text},this._trigger("trackToolTip",it),!it.cancel){v=it.data.Location.X;p=it.data.Location.Y;var f=this.model.tooltipPadding,l=ti,at=u.tooltip,ht=at.font?$.extend(!1,u.font,{},at.font):u.font,gi=ej.EjSvgRender.utils._measureText(it.data.currentText,u.xAxis.width,ht),hi=this.getSeriesColor(ni,ft,u),ci=this.getTooltipOptions(hi,u),wr=ci.rectBColor,br=ci.rectFColor,kr=ci.rectTextColor,c=gi.width+2*f,s=gi.height+2*f,dr=tt?c/10:s*30/100,nr=tt?u.yAxis.width:u.xAxis.width,hr=tt?ti+r.X-c/2:ti+r.Y-s/2,cr=tt?ti+r.X+c/2:ti+r.Y+s/2,lr=tt?o.X:o.Y,ar=tt?o.X+o.Width:o.Y+o.Height,g=[],vr=3+ii.marker.border.width+(tt?ii.marker.size.height:ii.marker.size.width)/2,w=this.model.financial?0:vr+5,li=u.type.toLowerCase(),lt,wt=li.indexOf("rangearea")==0?this.model.crosshair.marker.size.height/2:0;if(hr>=lr&&cr<=ar||this.model.financial){tt?r.Y-w-i<o.Y?(et={x:r.X-c/2+l,y:r.Y+w,width:c,height:s,rx:kt,ry:dt},g.push({X:r.X-c/2+f+l,Y:r.Y+w+s/2-f}),lt="top"):(this.model.financial?(v=r.X-c/2+l,p=r.Y+f+wt,e=v+f,a=p+2*f,lt="top"):(v=r.X-c/2+l,p=r.Y-w-s,e=r.X-c/2+f+l,a=r.Y-w-s/2-f,lt="bottom"),et={x:v,y:p,width:c,height:s,rx:kt,ry:dt},g.push({X:e,Y:a})):r.X+w+i-o.X>=nr?(this.model.financial?(v=r.X-c/2,p=r.Y-s-f-wt,e=v+f,a=p+l+s,lt="bottom"):(v=r.X-w-c,p=r.Y-s/2+l,e=v+f,a=r.Y+l+s/2,lt="right"),et={x:v,y:p,width:c,height:s,rx:kt,ry:dt},g.push({X:e,Y:a})):(this.model.financial?(v=r.X-c/2,p=r.Y-wt-s-2*f,e=v+f,a=p+l+s,lt="bottom"):(v=r.X+w,p=r.Y-s/2+l,e=v+f,a=r.Y+l+s/2,lt="left"),et={x:v,y:p,width:c,height:s,rx:kt,ry:dt},g.push({X:e,Y:a}));fi=hi;typeof fi=="object"&&(fi=hi[1].color);var ot=it.data.currentText,yr=ot,st=ej.EjSvgRender.utils._measureText(ot,u.xAxis.width,ht).height,ut;it.data.currentText.indexOf("<br/>")>=0&&(ot=it.data.currentText.split("<br/>"),yr=ot[0],tt?r.Y-w-i<o.Y?g.push({X:r.X-c/2+f+l,Y:r.Y+w+st/ot.length}):(this.model.financial?(e=r.X-c/2+f+l,a=r.Y+4*f+wt):(e=r.X-c/2+f+l,a=r.Y-w-s+st/ot.length),g.push({X:e,Y:a})):(vt=li.indexOf("candle")>=0||li.indexOf("hiloopenclose")>=0||!1,r.X+w+i-o.X>=nr?(this.model.financial?(e=r.X-c/2+f,a=r.Y+l-s-wt+(vt?0:2*f),et.y-=vt?f*3:f,et.height+=vt?f*2:f):(e=r.X-c-w+f,a=r.Y+l-s/2+st/ot.length),g.push({X:e,Y:a})):(this.model.financial?(e=r.X-c/2+f,a=r.Y+l-s-wt+(vt?0:f),et.y-=vt?f*2:f,et.height+=vt?f*2:f):(e=r.X+w+f,a=r.Y+l-s/2+st/ot.length),g.push({X:e,Y:a}))),st=0);ut=g.length-1;st=tt?st:-st;ei=u.type=="boxandwhisker"?nt:ui;tr={id:this.svgObject.id+"_ToolTipText_"+ft+"_"+ei,x:g[ut].X,y:g[ut].Y+st/2,fill:at.font?at.font.color?at.font.color:"#ffffff":"#ffffff","font-size":ht.size,"font-family":ht.fontFamily,"font-style":ht.fontStyle,"font-weight":ht.fontWeight,"text-anchor":"start",isTrackball:!0,padding:this.model.tooltipPadding};di=ej.EjSvgRender.utils._calculateroundedCorner(et,!0,lt,l);ir={id:this.svgObject.id+"_gTooltip_"+ft+"_"+ei,d:di,fill:b.fill?b.fill:fi,"stroke-width":parseInt(b.border.width?b.border.width:0)+"px",stroke:b.border.color?b.border.color:"transparent","fill-opacity":b.opacity};this.model.enableCanvasRendering?(bt=this.svgRenderer.createCrosshairCanvas(),bt.ctx=bt.getContext("2d")):bt=this.svgRenderer;oi=this.svgRenderer.createGroup({id:this.svgObject.id+"_gTooltip_"+ft+"_"+ei});this.svgRenderer.drawPath.call(bt,ir,oi);this.svgRenderer.drawText.call(bt,tr,ot,oi,ht)}}$("#"+this.svgObject.id+"_TrackToolTip_"+ft).length==0&&this.svgRenderer.append($(oi),this.gTrackball)}}},SmartTooltipPosition:function(n){for(var i=[[],[]],r=n.length,u=[],o=n[0].Series._isTransposed?this.model.m_AreaBounds.Width:this.model.m_AreaBounds.Height,f=this.model.tooltipPadding,e=-f,t=0;t<r;t++)i[0][t]=$.extend({},n[t].StEnd),i[1][t]={yAxis:n[t].Series._yAxisName,xAxis:n[t].Series._xAxisName,isTransposed:n[t].Series._isTransposed},u[t]=n[t].ReqInvertAxis?n[t].Point.X:n[t].Point.Y,e+=n[t].StEnd.End-n[t].StEnd.Start+f;for(this.ContinousOverlappingPoints(i[0],u),e<o&&this.verticalArrangeMents(i),t=0;t<r;t++)n[t].Tgap=this.model.financial?0:i[0][t].Start-n[t].StEnd.Start},verticalArrangeMents:function(n){for(var f=n[0],c=n[1],k=this.model.m_AreaBounds,w=this.model.tooltipPadding,l,s,h,a,o=this.model._axes,r,u,v,y,p=f.length,e=p-1,t=0,i=0,b=o.length;e>=0;e--){for(l=c[e].isTransposed,a=c[e].yAxis,i=0;i<b;i++)a==o[i].name&&(l?(s=o[i].Location.X2,h=o[i].Location.X1):(s=o[i].Location.Y1,h=o[i].Location.Y2));if(r=f[e],y=r.End-r.Start,s<r.End)for(r.End=s-2,r.Start=r.End-y,t=e-1;t>=0;t--)u=f[t],v=u.End-u.Start,u.End>f[t+1].Start&&f[t+1].Start>h&&f[t+1].End<s&&(u.End=f[t+1].Start-w,u.Start=u.End-v)}for(e=0;e<p;e++){for(l=c[e].isTransposed,a=c[e].yAxis,i=0;i<b;i++)a==o[i].name&&(l?(s=o[i].Location.X2,h=o[i].Location.X1):(s=o[i].Location.Y1,h=o[i].Location.Y2));if(r=f[e],y=r.End-r.Start,r.Start<h)for(r.Start=h+1,r.End=r.Start+y,t=e+1;t<=p-1;t++)u=f[t],v=u.End-u.Start,u.Start<f[t-1].End&&f[t-1].Start>h&&f[t-1].End<s&&(u.Start=f[t-1].End+w,u.End=u.Start+v)}},ContinousOverlappingPoints:function(n,t){var e=this.model.tooltipPadding,h=0,o=0,a=0,r=0,p=n.length-1,l=n[0].End-n[0].Start+e,v,y,s,c,f,i,u;for(h=n[0].Start+l,a=n[0].Start,f=0;f<p;f++)if(h>=n[f+1].Start){if(l=n[f+1].End-n[f+1].Start+e,h+=l,o++,o-1==p-1||f==p-1){for(v=(h-a)/2,y=(t[r]+t[f+1])/2,s=n[r].End-n[r].Start,n[r].Start=y-v,n[r].End=n[r].Start+s,i=r;i>0;i--)if(n[i].Start<=n[i-1].End+e)c=n[i-1].End-n[i-1].Start,n[i-1].Start=n[i].Start-c-e,n[i-1].End=n[i-1].Start+c;else break;for(u=r+1;u<=r+o;u++)s=n[u].End-n[u].Start,n[u].Start=n[u-1].End+e,n[u].End=n[u].Start+s}}else{if(o=f>0?o:0,o>0){for(v=(h-a)/2,y=(t[r]+t[f])/2,s=n[r].End-n[r].Start,n[r].Start=y-v,n[r].End=n[r].Start+s,i=r;i>0;i--)if(n[i].Start<=n[i-1].End+e)c=n[i-1].End-n[i-1].Start,n[i-1].Start=n[i].Start-c-e,n[i-1].End=n[i-1].Start+c;else break;for(u=r+1;u<=r+o;u++)s=n[u].End-n[u].Start,n[u].Start=n[u-1].End+e,n[u].End=n[u].Start+s;o=0}l=n[f+1].End-n[f+1].Start+e;h=n[f+1].Start+l;a=n[f+1].Start;r=f+1}},getTooltipOptions:function(n,t){var r,u,e,o,f,i;return this.model.theme.indexOf("gradient")>=0?(r=jQuery.type(n)=="array"?n[0].color:n,u="white",f="#333333",e=5,o=5):(i=t.type.toLowerCase(),i.indexOf("column")==-1&&i.indexOf("waterfall")==-1&&i.indexOf("bar")==-1&&i.indexOf("box")==-1&&i!="rangearea"&&this.model.AreaType!="none"?(u=jQuery.type(n)=="array"?n[0].color:n,r="transparent",f="white"):(r="#333333",u="white",f="#333333"),e=0,o=0),{rectBColor:r,rectFColor:u,rectTextColor:f,rectX:e,rectY:o}},getSeriesColor:function(n,t,i){return!i||i.isIndicator||i.isTrendLine?i.fill:n._hiloFill?n._hiloFill._gradientStop?n._hiloFill._gradientStop[0].color:n._hiloFill:n.fill?n.fill._gradientStop?n.fill._gradientStop[0].color:n.fill:i.type.toLowerCase()=="waterfall"&&i.positiveFill&&(n.y>0&&!n.showIntermediateSum&&!n.showTotalSum||n.waterfallSum>0)?i.positiveFill:this.model.seriesColors[t]},getFormat:function(n,t){if(!n.tooltip.format){var i=n.type.toLowerCase(),r=n.type!="boxandwhisker"?"null":t.outlier;return i.indexOf("range")>-1||i.indexOf("hilo")>-1&&i.indexOf("open")==-1?"#point.x# <br/> High : #point.high# <br/> Low : #point.low#":i.indexOf("candle")>-1||i.indexOf("open")>-1?"#point.x# <br/> High : #point.high# <br/> Low : #point.low# <br/> Open : #point.open# <br/> Close : #point.close#":i.indexOf("bubble")>-1?"#point.x# : #point.y# : #point.size#":i.indexOf("box")>-1&&r?"X : #boxPlotPoints.xValue# Y : #boxPlotPoints.YValues#":i.indexOf("box")>-1?"Minimum : #boxPlotPoints.Minimum# <br/> Upper Quartile : #boxPlotPoints.UpperQuartile# <br/> Median : #boxPlotPoints.midvalue# <br/> Lower Quartile : #boxPlotPoints.LowerQuartile# <br/> Maximum : #boxPlotPoints.Maximum# ":"#point.x# : #point.y#"}return n.tooltip.format},getTooltipFormat:function(n,t,i,r,u,f){var e=$.extend(!0,{},n),d=this.model.AreaType,h=this.model.locale,rt=t.xAxis,et=t.yAxis,b=rt._valueType.toLowerCase(),ut=ej.util.isNullOrUndefined,c=rt.labelFormat,o=et.labelFormat,g=ej.EjSvgRender.utils._dateTimeLabelFormat,st=ej.EjSvgRender.utils._decimalPlaces,y=!1,a=!1,l,w,v,nt,ft,ot,tt=6,it=20,p,s,k;for(t.count=1,e.count=1,u=this.getFormat(t,f);u.indexOf("ej.format(")>=0;)substr=u.substring(u.indexOf("ej.format("),u.indexOf(")")+1),p=substr.substring(substr.indexOf("(")+1,substr.indexOf(",")),p=="#point.x#"?(y=!0,l=substr.substring(substr.indexOf(",")+1,substr.indexOf(")"))):p=="#point.y#"?(a=!0,w=substr.substring(substr.indexOf(",")+1,substr.indexOf(")"))):(globalizeformat=substr.substring(substr.indexOf(",")+1,substr.indexOf(")")),subStr1=p.substring(p.indexOf("#")+1),val=subStr1.substring(subStr1.indexOf(".")+1,subStr1.indexOf("#")),e.hasOwnProperty(val)&&e[val]&&(e[val]=ej.format(e[val],globalizeformat,h))),u=u.replace(substr,p);if(d=="cartesianaxes"?b.toLowerCase()=="datetime"?(e.x=ej.format(new Date(e.xValue),ut(c)?g(t.xAxis._intervalType):t.xAxis.labelFormat,h),e.x=y?ej.format(new Date(e.xValue),l,h):e.x):b.toLowerCase()=="datetimecategory"?(t.xAxis.intervalType=ej.util.isNullOrUndefined(t.xAxis.intervalType)||t.xAxis.intervalType=="auto"?"years":t.xAxis.intervalType,e.x=ej.format(new Date(e.x),ut(c)?g(t.xAxis.intervalType):t.xAxis.labelFormat,h),e.x=y?ej.format(new Date(e.x),l,h):e.x):b.toLowerCase()=="category"?e.x=this.model.primaryXAxis.isIndexed?e.x?e.x:"undefined":ej.EjSvgRender.utils._getLabelContent(e.xValue,t.xAxis,h):(e.x=y&&(l.indexOf("e")==0||l.indexOf("E")==0)?this.convertExponential(ft,tt,it,e.x,l):y?ej.format(e.x,l,h):e.x,v=c?c.match("{value}"):null,e.x=c?v!=null?c=="${value}"?c.replace("{value}","$"+e.x):c.replace("{value}",e.x):y||c.indexOf("e")==0||c.indexOf("E")==0?e.x:ej.format(Number(e.x),c,h):e.x):b=="date"&&(e.x=ej.format(new Date(e.xValue),g("days"),h),e.x=y?ej.format(new Date(e.xValue),l,h):e.x),a&&(w.indexOf("e")==0||w.indexOf("E")==0)?e.y=this.convertExponential(ot,tt,it,e.y,w):(e.y=e.waterfallSum?e.waterfallSum:e.y,e.y=a?ej.format(e.y,w,h):e.y),v=o?o.match("{value}"):null,e.y=o?v!=null?o=="${value}"?o.replace("{value}","$"+e.y):o.replace("{value}",e.y):a||o.indexOf("e")==0||o.indexOf("E")==0?e.y:ej.format(Number(e.y),o,h):e.y,(d=="none"||d=="polaraxes")&&y&&(l.indexOf("e")==0||l.indexOf("E")==0)&&(e.x=this.convertExponential(ft,tt,it,e.x,l)),t.type.toLowerCase()=="boxandwhisker"){if(s=t._visiblePoints[r].boxPlotValues,f.outlier==!0)for(k=0;k<s.outliers.length;k++)f.YValues==s.outliers[k]&&(f.YValues=o?v!=null?o=="${value}"?o.replace("{value}","$"+f.YValues):o.replace("{value}",f.YValues):a||o.indexOf("e")==0||o.indexOf("E")==0?f.YValues:ej.format(Number(f.YValues),o,h):f.YValues);else f.YValues==s.Minimum?s.Minimum=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.Minimum):o.replace("{value}",s.Minimum):a||o.indexOf("e")==0||o.indexOf("E")==0?s.Minimum:ej.format(Number(s.Minimum),o,h):s.Minimum:f.YValues==s.Maximum?s.Maximum=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.Maximum):o.replace("{value}",s.Maximum):a||o.indexOf("e")==0||o.indexOf("E")==0?s.Maximum:ej.format(Number(s.Maximum),o,h):s.Maximum:f.YValues==s.UpperQuartile?s.UpperQuartile=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.UpperQuartile):o.replace("{value}",s.UpperQuartile):a||o.indexOf("e")==0||o.indexOf("E")==0?s.UpperQuartile:ej.format(Number(s.UpperQuartile),o,h):s.UpperQuartile:f.YValues==s.LowerQuartile?s.LowerQuartile=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.LowerQuartile):o.replace("{value}",s.LowerQuartile):a||o.indexOf("e")==0||o.indexOf("E")==0?s.LowerQuartile:ej.format(Number(s.LowerQuartile),o,h):s.LowerQuartile:f.YValues==s.midvalue&&(s.midvalue=o?v!=null?o=="${value}"?o.replace("{value}","$"+s.midvalue):o.replace("{value}",s.midvalue):a||o.indexOf("e")==0||o.indexOf("E")==0?s.midvalue:ej.format(Number(s.midvalue),o,h):s.midvalue);s.count=t.count;s.xValue=e.x;s.YValues=f.YValues;nt={boxPlotPoints:s}}else nt={series:t,point:e};return u=u.parseTemplate(nt),{data:e,text:u}},convertExponential:function(n,t,i,r,u){return n=u.match(/(\d+)/g),n=n==null?t:n>i?i:n,r.toExponential(n)},displayShowTooltip:function(n,t,i,r){var rt=this.model.requireInvertedAxes,tt,a,at,vt,f,d,o,ot,g,w,st,pt,wt,bt;if(t.visible){$(".ejTooltip"+this._id).not("#"+this.svgObject.id+"_TrackToolTip").remove();$.finish?$(".ejTooltip"+this._id).finish():$(".ejTooltip"+this._id).stop(!0,!0);var ht,ut,b=!i.isIndicator&&!i.isTrendLine?$.inArray(i,this.model._visibleSeries):0,nt,ft,v=7,ct=15,e,h,y,et=i.tooltip.format,l=document.getElementById(this.svgObject.id).getClientRects()[0],lt=this.model.m_AreaBounds,u=i.type.toLowerCase();switch(this.model.AreaType){case"cartesianaxes":e=n.X+(!i.isIndicator&&!i.isTrendLine?ej.util.isNullOrUndefined(i._trackMarker)?u=="bubble"?t.radius+ct:i.marker.size.width:i._trackMarker.size.width:0)+(u=="column"||u=="bar"||u=="stackingbar"||u=="stackingcolumn"||u=="waterfall"||u=="rangecolumn"?lt.X:rt?i.yAxis.x:i.xAxis.x);h=n.Y+(u.indexOf("column")!=-1||u.indexOf("waterfall")!=-1||u.indexOf("bar")!=-1||u.indexOf("rangearea")!=-1||u=="scatter"||u=="bubble"?this.dragPoint?rt?i.xAxis.y:i.yAxis.y:lt.Y:rt?i.xAxis.y:i.yAxis.y);this.dragPoint&&(e=e>i.xAxis.x?e:i.xAxis.x,h=h<i.yAxis.height+i.yAxis.y?h:i.yAxis.height+i.yAxis.y);nt=this.getSeriesColor(t,b,i);break;case"polaraxes":e=n.X+v+(ej.util.isNullOrUndefined(i._trackMarker)?i.marker.size.width:i._trackMarker.size.width);h=n.Y;nt=this.getSeriesColor(t,b,i);break;case"none":e=n.X+i.marker.size.width+v;h=n.Y;nt=this.model.pointColors[r]}if(i.type.toLowerCase()=="boxandwhisker")for(tt=0;tt<i._visiblePoints[r].boxPlotLocation.length;tt++)a=i._visiblePoints[r].boxPlotLocation[tt],at=a.outlier,at?a.X+i.outlierSettings.size.width/2>n.X&&a.X-i.outlierSettings.size.width/2<n.X&&a.Y+i.outlierSettings.size.height/2>n.Y&&a.Y-i.outlierSettings.size.height/2<n.Y&&(y=this.getTooltipFormat(t,i,b,r,et,a),ft=ej.EjSvgRender.utils._measureText(y.text)):(y=this.getTooltipFormat(t,i,b,r,et,a),ft=ej.EjSvgRender.utils._measureText(y.text));else y=this.getTooltipFormat(t,i,b,r,et),ft=ej.EjSvgRender.utils._measureText(y.text);var k=this.getTooltipOptions(nt,i),kt=k.rectBColor,dt=k.rectFColor,gt=k.rectTextColor,ni=k.rectX,ti=k.rectY,f=i.tooltip,p,v=5;if(p=document.getElementById(this.svgObject.id+"_TrackToolTip")==null?$("<div><\/div>").attr({id:this.svgObject.id+"_TrackToolTip","class":"ejTooltip"+this._id}):$("#"+this.svgObject.id+"_TrackToolTip"),vt=!!navigator.userAgent.match(/Trident\/7\./),!ej.isTouchDevice()||vt||this.vmlRendering?this._on(p,"mousemove",this.chartTooltipHover):window.navigator.msPointerEnabled?this._on(p,"MSPointerMove",this.chartTooltipHover):this._on(p,"touchmove",this.chartTooltipHover),$("#"+this.svgObject.id+"_TrackToolTip").show(),ut||(ut=$("#"+this._id)[0].offsetParent.style.zIndex),f={top:h+$(document).scrollTop(),left:e+$(document).scrollLeft(),"background-color":f.fill?f.fill:dt,"border-style":"solid",position:"absolute","border-color":f.border.color?f.border.color:kt,"border-width":f.border.width||f.border.width==0?f.border.width:1,opacity:f.opacity,"z-index":ut+1e6,"border-radius":(f.rx?f.rx:ni).toString()+"px "+(f.ry?f.ry:ti).toString()+"px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"},$(p).css(f),d=$.extend({},ej.EjSvgRender.commonChartEventArgs),d.data={seriesIndex:b,pointIndex:r,currentText:y.text,isTrendLine:i.isTrendLine,trendlineIndex:i.trendlineIndex},this._trigger("toolTipInitialize",d),!d.cancel){var ii=0,it=i.tooltip,c=it.font?$.extend(!1,i.font,{},it.font):i.font,ri={top:h+$(document).scrollTop(),left:e+$(document).scrollLeft(),color:it.font&&it.font.color?c.color:gt,"font-size":c.size,"font-family":c.fontFamily,"font-style":c.fontStyle,"font-weight":c.fontWeight,"align-self":"baseline"};for($(p).css(ri),document.getElementById(this.svgObject.id+"_TrackToolTip")==null&&$(document.body).append(p[0]),o=ht=d.data.currentText,$("#"+this.svgObject.id+"_TrackToolTip").html(o),ot=0,g=0,o=o.replace(/<br >/g,"<br/>").replace(/<br \/>/g,"<br/>").replace(/<br>/g,"<br/>"),o=o.split("<br/>"),w=0;w<o.length;w++)o[w]=o[w],ot+=ej.EjSvgRender.utils._measureText(o[w],null,c).height,st=ej.EjSvgRender.utils._measureText(o[w],null,c).width,g<st&&(g=st);ii=this.model.AreaType=="cartesianaxes"?ej.EjSvgRender.utils._measureText(ht,i.xAxis.width,c).height:ej.EjSvgRender.utils._measureText(o,null,c).height;var ui=this.model.AreaType=="cartesianaxes"?this.model.requireInvertedAxes?i.yAxis.width:i.xAxis.width:$(this.svgObject).width()-(this.model.legend.position.toLowerCase()=="right"?this.model.LegendViewerBounds.Width+2*this.model.elementSpacing:0),yt=this.model.AreaType=="cartesianaxes"?this.model.requireInvertedAxes?i.xAxis.height:i.yAxis.height:$(this.svgObject).height()-(this.model.legend.position.toLowerCase()=="bottom"?this.model.LegendViewerBounds.Height+this.model.elementSpacing:0),s=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect();$("#"+this.svgObject.id+"_TrackToolTip").css("top",$(document).scrollTop()+s.top+l.top-(ot+4)/2);$("#"+this.svgObject.id+"_TrackToolTip").css("left",$(document).scrollLeft()+s.left+l.left+(s.left-e));e+(g+v)>=ui+i.xAxis.x&&(pt=document.getElementById(this.svgObject.id).getClientRects()[0],wt=e-(g+v*2+(!i.isIndicator&&!i.isTrendLine?ej.util.isNullOrUndefined(i._trackMarker)?i.marker.visible?i.marker.size.width:u=="bubble"?t.radius+ct:0:i._trackMarker.size.width:0)+2*v),$("#"+this.svgObject.id+"_TrackToolTip").css("left",wt+pt.left-v+$(document).scrollLeft()));s=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect();(s.bottom>=i.yAxis.y+yt+l.top||s.bottom>=i.xAxis.y+yt+l.top)&&(bt=h-(s.bottom-s.top+(!i.isIndicator&&!i.isTrendLine?ej.util.isNullOrUndefined(i._trackMarker)?i.marker.visible?i.marker.size.height:0:i._trackMarker.size.height:0))+v+l.top,$("#"+this.svgObject.id+"_TrackToolTip").css("top",bt+$(document).scrollTop()));s=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect();s.left<0&&$("#"+this.svgObject.id+"_TrackToolTip").css("left",e);(s.top<l.top||s.top<0)&&$("#"+this.svgObject.id+"_TrackToolTip").css("top",(l.top<0?$(document).scrollTop():l.top)+"px");$("#"+this.svgObject.id+"_TrackToolTip").show()}}},chartTooltipHover:function(n){var t=$("#"+n.target.id)[0].getBoundingClientRect(),u=n.clientX-t.left,i=5,r;$("#"+n.target.id).css("left",t.left+u+i);t=$("#"+n.target.id)[0].getBoundingClientRect();r=document.getElementById(this.svgObject.id).getClientRects()[0];t.right>r.right+i&&$("#"+n.target.id).css("left",n.clientX-(t.right-t.left)-i)},_initializeSeriesColors:function(){var n=this,l=n.model.palette?n.model.palette:n.model.colors,y=l.length,e=n.model.AreaType,o,r,u,i,a,s,p,v,c,h,f,t;if(n.model.seriesColors=[],n.model.seriesBorderColors=[],n.model.pointColors=[],n.model.pointBorderColors=[],s=n.model._visibleSeries.length,p=n.model._visibleSeries,e!="none")o=n.model._visibleSeries,r=n.model.seriesColors,u=n.model.seriesBorderColors;else{for(h=0,t=0;t<s;t++)c=n.model._visibleSeries[t].type.toLowerCase(),n.model._visibleSeries[t].points.length>h?(h=n.model._visibleSeries[t].points.length,v=n.model._visibleSeries[t].points):n.model._visibleSeries[t].points.length==h&&c!="funnel"&&c!="pieofpie"&&c!="pyramid"&&(v=n.model._visibleSeries[t].points);o=v;r=n.model.pointColors;u=n.model.pointBorderColors}if(e=="none"&&s>1)for(f=0;f<s;f++)n.model.seriesColors[f]=l[f%y];for(t=0;t<o.length;t++)i=o[t],a=i.trendlines,i.isFill=i.isFill==undefined?i.fill&&i.fill!=""?!0:!1:i.isFill,i.isFill?r[t]=i.fill:(r[t]=l[t%y],i._hiloTypes||(i.fill=r[t])),e!="none"&&a.length>0&&this._initializeTrendlinesColors(a,r[t]),ej.util.isNullOrUndefined(i.border)||ej.util.isNullOrUndefined(i.border.color)||i.border.color==""?(u[t]=n.model.seriesBorderDefaultColors[t%10],e!="none"&&(i.border.color=u[t])):u[t]=i.border.color,i.dataPoint=i.points},_initializeTrendlinesColors:function(n,t){for(var i in n)(ej.util.isNullOrUndefined(n[i].fill)||n[i].fill=="")&&(n[i].fill=t)},_createAxisLabelAndRange:function(){for(var u,v,f,y=0,t=this.model,i=t.series,c=i.length,l,a,r,n,s=t.primaryXAxis,e=t.primaryYAxis,p,o=0;o<c;o++)a=i[o],a._isTransposed&&y++;for(c&&(y==c?t.requireInvertedAxes=!0:(a=i[0],a._isTransposed&&(t.requireInvertedAxes=!0))),t.requireInvertedAxes?(e.orientation="horizontal",s.orientation="vertical",e.labelPlacement=e.labelPlacement?e.labelPlacement:ej.datavisualization.Chart.LabelPlacement.OnTicks):(e.orientation="vertical",s.orientation="horizontal"),e.name=ej.util.isNullOrUndefined(e.name)?"SecondaryAxis":e.name,s.name=ej.util.isNullOrUndefined(s.name)?"PrimaryAxis":s.name,t._axes=[],t._axes[0]=s,t._axes[1]=e,p=t.axes.length,l=t.indicators,o=0;o<p;o++)if(n=t.axes[o],n.name){for(u=0;u<c;u++)if(v=i[u].type.toLowerCase(),i[u].xAxisName==n.name){n.orientation=v.indexOf("bar")!=-1?i[u].isTransposed?"horizontal":"vertical":i[u].isTransposed?"vertical":"horizontal";break}else if(i[u].yAxisName==n.name){n.orientation=v.indexOf("bar")!=-1?i[u].isTransposed?"vertical":"horizontal":i[u].isTransposed?"horizontal":"vertical";break}for(f=0;f<l.length;f++)if(l[f].xAxisName==n.name){n.orientation="horizontal";break}else if(l[f].yAxisName==n.name){n.orientation="vertical";break}if(!n.orientation)continue;t.axes[o]=n.orientation.toLowerCase()=="horizontal"?$.extend(!0,{},t.secondaryX,n):$.extend(!0,{},t.secondaryY,n);t._axes.push(t.axes[o])}for(f=0;f<t._axes.length;f++){var n=this.model._axes[f],h=n.scrollbarSettings,r=h.range,w=n.orientation.toLowerCase();n.visibleLabels=[];n.range=n.range.min==null&&n.range.max==null&&n.range.interval==null?null:n.range;n.setRange=n.range?ej.util.isNullOrUndefined(n.setRange)?!0:n.setRange:!1;n.setRange=n.actual_Range||n.setRange!=!1?!0:!1;n.actualRange=n.actualRange?n.actualRange:n.range==null?{}:$.extend(!0,{},n.range);n.visibleRange=n.visibleRange?n.visibleRange:n.range==null?{}:n.range;n.name=n.name?n.name:f.toString();n._isScroll=h.visible&&(h.pointsLength!=null||r.min!=null||r.max!=null)||t.zooming.enableScrollbar&&h.visible&&(n.zoomFactor<1||n.zoomPosition>0);n._pointsLength=h.pointsLength;typeof r.min=="string"&&r.min.indexOf("/Date(")!=-1&&(r.min=new Date(parseInt(r.min.substr(6))));typeof r.max=="string"&&r.max.indexOf("/Date(")!=-1&&(r.max=new Date(parseInt(r.max.substr(6))))}},_drawTitle:function(){var n=this.model.title,t=this.model.margin,h=$(this.svgObject).width(),i=ej.EjSvgRender.utils._measureText(n.text,h-t.left-t.right,n.font),u=this.model.elementSpacing,tt=n.text==""||!n.visible?0:i.height+u,t=t,it=this.model.m_AreaBounds,rt=this.model.AreaType,ut=this.model.legend.position.toLowerCase()=="left"?this.model.LegendViewerBounds.Width/2:this.model.legend.position.toLowerCase()=="right"?-this.model.LegendViewerBounds.Width/2:0,b=t.left+u+this.model.border.width,k=t.right+u+this.model.border.width,e=this.model.titleWrapTextCollection,d,ft=parseInt(n.font.size),l=parseInt(n.font.size)*1.2,g=n.enableTrim,f=n.maximumWidth,et=n.textAlignment.toLowerCase(),a=n.textOverflow.toLowerCase(),v=n.text,y=g&&(a=="wrap"||a=="wrapandtrim")&&e.length>1?!0:!1,c,p,w,r,o,nt,s;if(f.toString()=="auto"||f.toString()==""?(f=it.Width*.75,this.model.titleMaxWidth=f):f=parseInt(f),c=i.width>f?!0:!1,g&&c&&a=="trim"&&(v=ej.EjSvgRender.utils._trimText(v,f,n.font),this.model.titleTrim=i=ej.EjSvgRender.utils._measureText(v,h-t.left-t.right,n.font),this.model.trimTooltip=!0),this.model.trimTooltip&&a=="wrap"&&(this.model.trimTooltip=!1),p={width:this.model.trimTooltip&&y||e.length>1?this.model.titleMaxWidth:i.width,height:i.height*(e.length>0?e.length-1:1)},n.text!=""&&n.text!=null){if(d=n.border.color=="transparent"&&n.background=="transparent"?t.top+tt/2+u:t.top+l/2+u+ft/4,w=(rt!="cartesianaxes"?(h-t.left-t.right)/2+(t.left+ut):b+(h-k)/2)-p.width/2,this.model.title.textAlignment.toLowerCase()=="near"?w=b:this.model.title.textAlignment.toLowerCase()=="far"&&(w=h-k-p.width),r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={title:v,location:{x:w,y:d},size:i},this._trigger("titleRendering",r),o={id:this.svgObject.id+"_ChartTitleText",x:r.data.location.x,y:r.data.location.y,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,"text-anchor":"start"},nt={id:this.svgObject.id+"_ChartTitleBorder",x:r.data.location.x-u,y:r.data.location.y-l+l/4,rx:n.border.cornerRadius,ry:n.border.cornerRadius,width:y&&c?this.model.titleMaxWidth+2*u:i.width+2*u,height:y&&c?i.height*e.length:l,fill:n.background,"stroke-width":n.border.width,stroke:n.border.color,opacity:n.border.opacity,"class":"e-titleborder"},this.svgRenderer.drawRect(nt,this.gTitleEle),y&&c)for(s=0;s<e.length;s++)o.id=this.svgObject.id+"_ChartTitleText_"+s,s!=0&&(o.y=o.y+i.height),this.svgRenderer.drawText(o,e[s],this.gTitleEle);else this.svgRenderer.drawText(o,r.data.title,this.gTitleEle);this.model._titleLocation={X:r.data.location.x,Y:r.data.location.y,size:p,_height:i.height};this.svgRenderer.append(this.gTitleEle,this.svgObject);n.subTitle.text!=""&&n.subTitle.text&&n.subTitle.visible&&this._drawSubTitle()}},_getLegendSize:function(n){var r=this.model.legend,t=r.itemStyle,i=ej.EjSvgRender.utils._measureText(n.Text,null,n.Font),u=t.width+10+i.width,f=Math.max(t.height,i.height);return{Width:u,Height:f}},_getYValues:function(n){for(var i=[],r=n.length,t=0;t<r;t++)i.push(n[t].y);return i},_getXValues:function(n){for(var i=[],r=n.length,t=0;t<r;t++)i.push(n[t].xValue);return i},_drawSubTitle:function(){var t=this.model.title,n=t.subTitle,d=$(this.svgObject).width(),a=ej.EjSvgRender.utils._measureText(t.text,d-this.model.margin.left-this.model.margin.right,t.font),i=ej.EjSvgRender.utils._measureText(n.text,d-this.model.margin.left-this.model.margin.right,n.font),e="middle",tt,it=1.2,r=this.model.elementSpacing,lt=parseInt(n.font.size),rt=this.model.m_AreaBounds.Width,at=parseInt(t.font.size)*it,s=parseInt(n.font.size)*it,vt=n.text==""||!n.visible?0:i.height+r,ut=n.enableTrim,f=n.maximumWidth,o=t.maximumWidth,g=n.textOverflow.toLowerCase(),bt=t.textAlignment.toLowerCase(),ft=n.textAlignment.toLowerCase(),w=t.text,et=t.enableTrim,nt=t.textOverflow.toLowerCase(),h=n.text,b,yt=et&&(nt=="wrap"||nt=="wrapandtrim")?!0:!1,ot,v=ut&&(g=="wrap"||g=="wrapandtrim")?!0:!1,pt,c,u,ct,l,k;if(o=o.toString()=="auto"||o.toString()==""?rt*.75:parseInt(o),f=f.toString()=="auto"||f.toString()==""?rt*.75:parseInt(f),a=ej.EjSvgRender.utils._measureText(t.text,d-this.model.margin.left-this.model.margin.right,t.font),pt=a.width>o?!0:!1,ut&&i.width>f&&g=="trim"&&(w=et&&nt=="trim"?ej.EjSvgRender.utils._trimText(w,o,t.font):w,h=ej.EjSvgRender.utils._trimText(h,f,n.font),a=ej.EjSvgRender.utils._measureText(w,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,t.font),i=ej.EjSvgRender.utils._measureText(h,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,n.font),this.model.subTitleTooltip=!0),ot=a.width>o,h!=""&&h!=null){tt=this.model.title.border.color=="transparent"&&this.model.title.background=="transparent"||this.model.title.subTitle.border.color=="transparent"&&this.model.title.subTitle.background=="transparent"?vt/2+r+this.model._titleLocation.Y+this.model._titleLocation._height*(this.model.titleWrapTextCollection?this.model.titleWrapTextCollection.length-1:0):s/2+10+r+(yt&&ot?a.height*this.model.titleWrapTextCollection.length:at)+10+lt/3;c=this.model._titleLocation.X+this.model._titleLocation.size.width/2;ft=="near"?(c=b=this.model._titleLocation.X,e="start"):ft=="far"&&(c=this.model._titleLocation.X+this.model._titleLocation.size.width,e="end");u=$.extend({},ej.EjSvgRender.commonChartEventArgs);u.data={subTitle:h,location:{x:c,y:tt},size:i};this._trigger("subTitleRendering",u);var wt=t.border.color=="transparent"&&t.background=="transparent"||t.subTitle.border.color=="transparent"&&t.subTitle.background=="transparent"?u.data.location.y:u.data.location.y-r/2,y={id:this.svgObject.id+"_ChartSubTitleText",x:u.data.location.x,y:wt,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,"text-anchor":e},st,ht,p=u.data.location.x;if(st=e=="start"?p-r:e=="end"?v?p-r-this.model.subTitleMaxWidth:p-r-i.width:v?p-r-this.model.subTitleMaxWidth/2:p-r-i.width/2,ht=t.border.color=="transparent"&&t.background=="transparent"||n.border.color=="transparent"&&n.background=="transparent"?u.data.location.y-s+s/4:u.data.location.y-s+s/4-r/2,ct={id:this.svgObject.id+"_ChartSubTitleBorder",x:st,y:ht,rx:n.border.cornerRadius,ry:n.border.cornerRadius,width:v?this.model.subTitleMaxWidth+2*r:i.width+2*r,height:v?i.height*this.model.subTitleWrapTextCollection.length:s,fill:n.background,"stroke-width":n.border.width,stroke:n.border.color,opacity:n.border.opacity,"class":"e-subtitleborder"},this.svgRenderer.drawRect(ct,this.gSubTitleEle),v&&i.width>f)for(l=0;l<this.model.subTitleWrapTextCollection.length;l++)y.id=this.svgObject.id+"_ChartSubTitleText_"+l,l!=0&&(y.y=y.y+i.height),this.svgRenderer.drawText(y,this.model.subTitleWrapTextCollection[l],this.gSubTitleEle);else this.svgRenderer.drawText(y,u.data.subTitle,this.gSubTitleEle);k={width:this.model.subTitleTooltip?f:i.width,height:i.height*this.model.subTitleWrapTextCollection.length};e=="middle"?b=c-k.width/2:e=="end"&&(b=c-k.width);this.model._subTitleLocation={X:b,Y:u.data.location.y-i.height/2,size:k};this.svgRenderer.append(this.gSubTitleEle,this.gTitleEle)}},_calculateStackingValues:function(n,t,i){var y=this.model,h,p,s,r;y.stackedValue[t.name]=[];h=y.stackedValue[t.name];h.min=0;h.max=0;var k=y.requireInvertedAxes?y.vAxes:y.hAxes,it=k.length,g,nt,u,rt=n.length,d,o,l,f,c,a,b=ej.util.isNullOrUndefined;for(p=0;p<it;p++){r=0;var o=[],l=[],v=[],w=[],e=0;for(s=0;s<n.length;s++)if(n[s]._xAxisName==k[p].name&&(n[s].type.toLowerCase().indexOf("stacking")!=-1||n[s].isStacking)){for(f={},f.StartValues=[],f.EndValues=[],u=n[s].stackingGroup,u&&n[s].type.toLowerCase()!="stackingarea"?b(o[u])&&(o[u]=[],l[u]=[],v[u]=[],w[u]=[]):(u="",b(o[u])&&(o[u]=[],l[u]=[],v[u]=[],w[u]=[])),series=n[s],e=this._getXCrossValue(series,k[p],i),typeof e!="number"&&(e=0),d=ej.EjSeriesRender.prototype._isVisiblePoints(series),nt=this._getYValues(series._visiblePoints),g=d.length,r=0;r<g;r++){var c=0,tt=0,a=nt[r];b(o[u][series._visiblePoints[r].xValue])&&(o[u][series._visiblePoints[r].xValue]=e);b(l[u][series._visiblePoints[r].xValue])&&(l[u][series._visiblePoints[r].xValue]=e);f.StartValues.length<=r&&(f.StartValues.push(0),f.EndValues.push(0));a>=0?(v[u][r]=v[u][r]==null,a-=v[u][r]&&e,c=o[u][series._visiblePoints[r].xValue],o[u][series._visiblePoints[r].xValue]+=a,tt=c<e?e-c:0,f.StartValues[r]=c+tt,f.EndValues[r]=a+c):(w[u][r]=w[u][r]==null,a-=w[u][r]&&e,c=l[u][series._visiblePoints[r].xValue],l[u][series._visiblePoints[r].xValue]+=a,f.StartValues[r]=c,f.EndValues[r]=a+c,e<f.EndValues[r]&&(l[u][series._visiblePoints[r].xValue]=f.StartValues[r],o[u][series._visiblePoints[r].xValue]=f.EndValues[r],v[u][r]=v[u][r]==null));visiblePointIndex=d[r].actualIndex;series.points[visiblePointIndex].YValues=[f.EndValues[r]]}f.stackedSeries=!0;h.push(f);h.min>Math.min.apply(0,f.StartValues)&&(h.min=Math.min.apply(0,f.StartValues));h.max<Math.max.apply(0,f.EndValues)&&(h.max=Math.max.apply(0,f.EndValues));series.stackedValue=f}}},_calculateStackingCumulativeValues:function(n,t,i){var c,ot,ft,f,k,e,v,b,u,d,g,s,nt,tt;this.model.stackedValue[t.name]=[];this.model.stackedValue[t.name].min=0;this.model.stackedValue[t.name].max=0;var w=this.model.requireInvertedAxes?this.model.vAxes:this.model.hAxes,rt=n.length,et=w.length,it;for(c=0;c<et;c++){var h=[],l=[],a=[],r=" ",y=[],p=[],o=0,ut=[];for(f=0;f<rt;f++)if(ot=ej.EjSeriesRender.prototype._isVisiblePoints(n[f]),r=n[f].stackingGroup,n[f].type.toLowerCase().indexOf("100")!=-1&&n[f]._xAxisName==w[c].name)for(n[f].stackingGroup&&n[f].type.toLowerCase()!=" stackingarea100 "?h[r]||(a[r]=[],h[r]=[],l[r]=[],y[r]=[],p[r]=[]):(n[f].stackingGroup="",r=n[f].stackingGroup,h[r]||(a[r]=[],h[r]=[],l[r]=[],y[r]=[],p[r]=[])),ut[r]=f,v=this._getYValues(n[f]._visiblePoints),b=v.length,u=0;u<b;u++)ft=v[u],a[r][n[f].points[u].xValue]||(a[r][n[f].points[u].xValue]=0),a[r][n[f].points[u].xValue]+=Math.abs(ft);for(f=0;f<rt;f++)if(r=n[f].stackingGroup,n[f].type.toLowerCase().indexOf("100")!=-1&&(k=!1,n[f]._xAxisName==w[c].name)){for(e={},e.StartValues=[],e.EndValues=[],series=n[f],o=this._getXCrossValue(series,w[c],i),typeof o!="number"&&(o=0),v=this._getYValues(series._visiblePoints),b=v.length,u=0;u<b;u++)g=0,s=v[u],it=s/a[r][series.points[u].xValue]*100,s=isNaN(it)?0:it,series.points[u].percentage=s.toFixed(2),h[r][series.points[u].xValue]||(h[r][series.points[u].xValue]=o),l[r][series.points[u].xValue]||(l[r][series.points[u].xValue]=o),e.StartValues.length<=u&&(e.StartValues.push(0),e.EndValues.push(0)),s>=0?(nt=h[r][series.points[u].xValue],y[r][u]=y[r][u]==null,s-=y[r][u]&&o,g=nt<o?o-nt:0,d=nt,h[r][series.points[u].xValue]+=s):(tt=l[r][series.points[u].xValue],p[r][u]=p[r][u]==null,s-=p[r][u]&&o,g=tt>o?o-tt:0,d=tt,l[r][series.points[u].xValue]+=s),e.StartValues[u]=d+g,e.EndValues[u]=d+s,e.EndValues[u]>100&&(e.EndValues[u]=100),series.points[u].YValues=[e.EndValues[u]],k=ut[r]==f?!1||k:!0;e.stackedSeries=k;this.model.stackedValue[t.name].push(e);this.model.stackedValue[t.name].min>Math.min.apply(0,e.StartValues)&&(this.model.stackedValue[t.name].min=Math.min.apply(0,e.StartValues));this.model.stackedValue[t.name].max<Math.max.apply(0,e.EndValues)&&(this.model.stackedValue[t.name].max=Math.max.apply(0,e.EndValues));this.model.stackedValue[t.name].min>Math.min.apply(0,e.EndValues)&&(this.model.stackedValue[t.name].min=-100);series.stackedValue=e}}},_legendItemBounds:function(n,t,i){var r=this.model.legend,s,h=r.position.toLowerCase(),c=r.itemPadding,u,e,o=0,f=0;return ej.util.isNullOrUndefined(r.columnCount)&&r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):ej.util.isNullOrUndefined(r.rowCount)&&r.columnCount?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):r.rowCount&&r.columnCount&&(r.columnCount<r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):r.columnCount>r.rowCount?h==="top"||h==="bottom"||h==="custom"?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):(u=Math.ceil(n/r.columnCount),e=Math.ceil(n/u),o=t*e,f=i*u):h==="top"||h==="bottom"||h==="custom"?(u=Math.ceil(n/r.columnCount),s=Math.ceil(n/r.rowCount),o=t*r.columnCount,f=i*s):(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u)),f+=this.model.elementSpacing,{LegendWidth:o,LegendHeight:f}},_isEjScroller:function(){var n=this,i=n.model,r=$(n.legendContainer),t=i.legend;t._ejScroller=ej.util.isNullOrUndefined($("#"+r[0].id).ejScroller)?!1:t.enableScrollbar},_rowsCalculation:function(n,t,i){for(var v=this,y=v.model,w=y.legend,r,o=[],f,l,p=n.legendItem?n.legendItem.Text.toString():n.text,s=p.split(" "),h=t,c=n.legendItem?n.legendItem.LegendStyle.Font:n.font,a=s.length,e=0,u=0;u<a;u++)if(r=s[u],f=ej.EjSvgRender.utils._measureText(r,null,c).width,f<=h){while(u<a)if(f=ej.EjSvgRender.utils._measureText(r,null,c).width,l=s[u+1]?ej.EjSvgRender.utils._measureText(s[u+1],null,c).width:0,f+l<=h&&l>0)r=r.concat(" "+s[u+1]),u++;else{e=Math.max(e,f);break}o.push(r)}else i=="wrapandtrim"?(r=ej.EjSvgRender.utils._trimText(r,h,c),o.push(r),this.model._legendMaxWidth=h,e=Math.max(e,h),n.legendItem||(this.model.trimTooltip=!0)):(o.push(r),n.legendItem?this.model._legendMaxWidth=Math.max(this.model._legendMaxWidth,f):e=Math.max(e,f));return this.model._legendMaxHeight=Math.max(this.model._legendMaxHeight,o.length),{textCollection:o,wordMax:e}},_triggerLegendEvent:function(n,t,i){var u=this,e=u.model,r=e.legend,c=e.AreaType,l=r.itemStyle,a=l.border,w=e.elementSpacing,o=r.textWidth,b=ej.EjSvgRender,k=u.svgRenderer,v=e._visibleSeries.length,d=u.svgObject,w=e.elementSpacing,s=r.textOverflow.toLowerCase(),f,h,y,p={BorderColor:a.color,BorderWidth:a.width,Opacity:r.opacity,Color:t,Font:r.font};return commonEventArgs=$.extend({},b.commonChartEventArgs),commonEventArgs.data={svgRenderer:k,svgObject:d,symbolShape:r.shape,legendItem:{Text:n,Shape:r.shape,LegendStyle:p,SeriesIndex:c=="none"&&v==1?0:i},style:{ShapeSize:l,ElementSpace:w,Style:p,ID:u.svgObject.id+"_LegendItemShape"+i,SeriesIndex:c=="none"&&v==1?0:i,context:!0},gLegendItemEle:u.gLegendItemEle},u._trigger("legendItemRendering",commonEventArgs),f=commonEventArgs.data.legendItem.Text,h=commonEventArgs.data.legendItem.LegendStyle.Font,y=ej.EjSvgRender.utils._measureText(f,null,h).width,s=="trim"?y>o&&(f=ej.EjSvgRender.utils._trimText(f,o,h),this.model._legendMaxWidth=o):(s=="wrap"||s=="wrapandtrim")&&(f=this._rowsCalculation(commonEventArgs.data,o,this.model.legend.textOverflow.toLowerCase()).textCollection),{commonEventArgs:commonEventArgs,legendItem:f}},_calculateLegendBounds:function(){var at,i,ut;this.model.legendCollection=[];this.model.legendTextRegion=[];this.model.legendRegion=[];this.model.svgHeight=$(this.svgObject).height();this.model.svgWidth=$(this.svgObject).width();this.model._legendMaxWidth=0;this.model._legendMaxHeight=0;var b=this,n=b.model,ni=Math,h=ni.max,oi=ni.min,ot=ni.abs,t=n.legend,p=10,k=t.size.height,d=t.size.width,u=t.itemPadding>0?t.itemPadding:0,e=t.position.toLowerCase(),c=0,l=0,vt=n.svgHeight,yt=n.svgWidth,g=0,nt=0,f=0,y=0,ti=1,o,si,ii,hi,ci,st={},w=[],li,ri,ft,ui,wi=n.AreaType,et=n._visibleSeries,fi=t.rowCount,tt,ei=t.columnCount,pt=n.elementSpacing,wt,a,bt,ht,ct,kt=ej.EjSvgRender.utils._measureText(t.title.text,null,t.title.font),s,ai,it=0,rt=0,vi=n.border.width,lt=t.border.width,dt,r,v,yi,gt=t.textOverflow.toLowerCase(),pi=vt-(pt*4+vi*2+t.border.width*2),bi=yt-(pt*4+vi*2+lt*2);if(et&&t.visible&&et.length!=0){if(dt=et[0].type.toLowerCase(),wi=="none"&&et.length==1||dt=="pieofpie"||dt=="pyramid"||dt=="funnel")for(a=et[0],wt=ej.EjSeriesRender.prototype._calculateVisiblePoints(a).legendPoints,bt=wt.length,i=0;i<bt;i++)ht=t.fill?t.fill._gradientStop?t.fill._gradientStop:t.fill:n.pointColors[wt[i].actualIndex],tt=wt[i],ct=ej.util.isNullOrUndefined(tt.x)?"series"+i:tt.x,visibleOnLegend=tt.visibleOnLegend?tt.visibleOnLegend:"visible",tt.isEmpty||visibleOnLegend.toLowerCase()!="visible"||a.visibleOnLegend.toLowerCase()!="visible"||(r=this._triggerLegendEvent(ct,ht,i),v=r.commonEventArgs.data.legendItem.LegendStyle,st={Text:r.legendItem,displayText:r.commonEventArgs.data.legendItem.Text,Font:v.Font,SeriesIndex:0,PointIndex:i,ActualIndex:tt.actualIndex,fill:v.Color,visibility:tt.visible?"visible":"hidden",Shape:r.commonEventArgs.data.legendItem.Shape,LegendStyle:v,CommonEventArgs:{cancel:r.commonEventArgs.cancel,data:r.commonEventArgs.data}},w.push(st));else for(bt=et.length,i=0;i<bt;i++)for(ht=t.fill?t.fill._gradientStop?t.fill._gradientStop:t.fill:ej.util.isNullOrUndefined(n.seriesColors[i])?n.pointColors[i]:n.seriesColors[i],a=et[i],ct=a.name?a.name:"series"+i,a.visibleOnLegend.toLowerCase()=="visible"&&(r=this._triggerLegendEvent(ct,ht,i),v=r.commonEventArgs.data.legendItem.LegendStyle,st={Text:r.legendItem,displayText:r.commonEventArgs.data.legendItem.Text,Font:v.Font,SeriesIndex:i,fill:v.Color,visibility:a.visibility,Shape:r.commonEventArgs.data.legendItem.Shape,LegendStyle:v,CommonEventArgs:{cancel:r.commonEventArgs.cancel,data:r.commonEventArgs.data}},w.push(st)),ri=a.trendlines,li=ri.length,at=0;at<li;at++)ft=ri[at],ht=t.fill?t.fill._gradientStop?t.fill._gradientStop:t.fill:ft.fill,ct=ft.name?ft.name:"series"+i,ft.visibility!=""&&ft.visibleOnLegend.toLowerCase()=="visible"&&(r=this._triggerLegendEvent(ct,ht,i),v=r.commonEventArgs.data.legendItem.LegendStyle,st={Text:r.legendItem,displayText:r.commonEventArgs.data.legendItem.Text,Font:v.Font,SeriesIndex:i,trendLineIndex:at,fill:v.Color,isTrendLine:!0,visibility:a.visibility.toLowerCase()=="visible"?ft.visibility:"hidden",Shape:r.commonEventArgs.data.legendItem.Shape,LegendStyle:v,CommonEventArgs:{cancel:r.commonEventArgs.cancel,data:r.commonEventArgs.data}},w.push(st));for(legendSeriesLength=w.length,i=0;i<legendSeriesLength;i++)o=w[i],yi=o.CommonEventArgs.data.style.ShapeSize.width,s=b._getLegendSize(o),g=h(this.model._legendMaxWidth>0?this.model._legendMaxWidth+u+yi:s.Width,g),nt=h(gt=="wrap"||gt=="wrapandtrim"?s.Height*this.model._legendMaxHeight:s.Height,nt);for(y=nt+pt*2,f=g,(ei||fi)&&(legendBounds=b._legendItemBounds(w.length,g+u,nt+u),f=legendBounds.LegendWidth,y=legendBounds.LegendHeight,e==="top"||e==="bottom"||e==="custom"?y=y-u+pt:f=f-u),ut=0;ut<legendSeriesLength;ut++)o=w[ut],si=o.SeriesIndex,a=n.series[si],s=b._getLegendSize(o),(gt=="wrap"||gt=="wrapandtrim")&&(s.Width=g,s.Height=nt),fi||ei||(e=="top"||e=="bottom"||e=="custom"?(c+=s.Width+u,c>bi&&ut!=0?(c-=s.Width+u,f=h(f,c),c=s.Width+u,ti++,y+=nt+u):f=h(f,c),l=h(l,nt)):(l+=s.Height+u,l>pi?(l-=s.Height+u,y=h(y,l),l=s.Height+u,f+=g+u):y=h(y,l),c=h(c,g))),ai=o.visibility.toLowerCase()=="visible"?b.svgRenderer.createGradientElement("legend"+ut,w[ut].fill,0,0,0,pi,b.gLegendEle):"gray",o.CommonEventArgs.data.legendItem.LegendStyle.Color=ai,ii=fi||ei?{Width:g,Height:nt}:s,ii._Width=s.Width,o.isTrendLine&&(o.TrendLineIndex=o.trendLineIndex,ui=a.trendlines[o.trendLineIndex].type.toLowerCase(),o.CommonEventArgs.data.legendItem.drawType=o.drawType=ui=="linear"||ui=="movingaverage"?"line":"spline"),w[ut].Bounds=ii,n.legendCollection.push(o);e==="top"||e==="bottom"||e==="custom"?(f=kt.width>f-u?kt.width+p*2+u:f+p*2,c+=p,l+=p*2,n.LegendBounds={Width:h(f,c)-u,Height:h(y,l),Rows:ti}):(f=kt.width>f?kt.width+p*2:f+p*2,c+=p,l+=p,n.LegendBounds={Width:h(f,c),Height:h(y,l)+p-u,Columns:ti});n.LegendViewerBounds={Width:"0",Height:"0"};k==""||k==null?(hi=e=="left"||e=="right"||e=="custom"?ot(vt):ot(vt/100*parseInt("20%")),n.LegendViewerBounds.Height=oi(hi,n.LegendBounds.Height)):n.LegendViewerBounds.Height=k.indexOf("%")!=-1?ot(vt/100*parseInt(k)):parseInt(k);d==""||d==null?(ci=e=="top"||e=="bottom"||e=="custom"?ot(yt):ot(yt/100*parseInt("20%")),n.LegendViewerBounds.Width=oi(ci,n.LegendBounds.Width)):n.LegendViewerBounds.Width=d.indexOf("%")!=-1?ot(yt/100*parseInt(d)):parseInt(d)}else n.LegendBounds={Width:0,Height:0},n.LegendViewerBounds={Width:0,Height:0};legendContainer=$(b.legendContainer);legendSvgContainer=$(b.legendSvgContainer);t.enableScrollbar?(n.LegendActualBounds=n.LegendViewerBounds,legendContainer.removeAttr("style"),legendContainer.css({visibility:"hidden",width:n.LegendViewerBounds.Width,height:n.LegendViewerBounds.Height}),legendSvgContainer.css({height:n.LegendBounds.Height,width:n.LegendBounds.Width}),t._ejScroller?$("#"+legendContainer[0].id).ejScroller({width:n.LegendViewerBounds.Width,height:n.LegendViewerBounds.Height}):legendContainer.css({overflow:"scroll"}),n.LegendBounds.Width>n.LegendViewerBounds.Width&&n.LegendBounds.Height>n.LegendViewerBounds.Height?t._ejScroller?(rt=$(".e-hscrollbar").height()||0,it=$(".e-vscrollbar").width()||0):(legendContainer.css({overflow:"scroll"}),rt=legendContainer[0].offsetHeight-lt*2-legendContainer[0].clientHeight,it=legendContainer[0].offsetWidth-lt*2-legendContainer[0].clientWidth):n.LegendBounds.Width>n.LegendViewerBounds.Width?t._ejScroller?(rt=$(".e-hscrollbar").height()||0,it=0):(legendContainer[0].style.overflowX="scroll",legendContainer[0].style.overflowY="hidden",rt=legendContainer[0].offsetHeight-lt*2-legendContainer[0].clientHeight,it=0):n.LegendBounds.Height>n.LegendViewerBounds.Height&&(t._ejScroller?(rt=0,it=$(".e-vscrollbar").width()):(legendContainer[0].style.overflowY="scroll",legendContainer[0].style.overflowX="hidden",rt=0,it=legendContainer[0].offsetWidth-lt*2-legendContainer[0].clientWidth))):(n.LegendActualBounds=n.LegendBounds,d!=""&&d!=null&&(n.LegendActualBounds.Width=parseInt(d)),k!=""&&k!=null&&(n.LegendActualBounds.Height=parseInt(k)));n.LegendActualBounds.Height+=Math.abs(rt);n.LegendActualBounds.Width+=Math.abs(it);n.LegendActualBounds.hScrollSize=rt;n.LegendActualBounds.vScrollSize=it},GetPointXYOrgin:function(n,t,i,r){var u=(n-i)/(this.model.axes.PrimaryXaxis.visibleRange.max-i)*this.model.m_AreaBounds.Width,f=(t-r)/(this.model.axes.PrimaryYaxis.visibleRange.max-r)*(this.model.m_AreaBounds.Height-this.GetPointXY(this.model.axes.PrimaryXaxis.visibleRange.min,Math.max(this.model.axes.PrimaryYaxis.visibleRange.min,0)).Y);return{X:u,Y:f}},_wrap:function(n,t,i,r,u,f){var s=i,a=f.width,c=[],b=[],g=s.length,k=0,e=0,l=i.split(" "),d=l.length,h,p,v,o,y,w;if(r=="wrap"){if(a>t)for(h=1;h<=s.length;h++)i=s.substring(0,h),a=ej.EjSvgRender.utils._measureText(i,null,u).width,a>t&&(k=k+1,i=s.substring(0,h-1),c[e]=i,s=s.slice(h-1,g),currentTextCollextion=s.split(" "),s=l.indexOf(currentTextCollextion[0])>-1?s:"-"+s,p=ej.EjSvgRender.utils._measureText(i,null,u).width,e++,h=0);c[e]=i}else if(r=="wrapandtrim")for(v=0,e=0;e<d;e++)if(o=l[e],y=ej.EjSvgRender.utils._measureText(o,null,u).width,y<t&&a>t){while(e<d)if(y=ej.EjSvgRender.utils._measureText(o,null,u).width,w=l[e+1]?ej.EjSvgRender.utils._measureText(l[e+1],null,u).width:0,y+w<=t&&w>0)o=o.concat(" "+l[e+1]),e++;else{v=Math.max(v,y);break}c.push(o)}else if(a>t)b.push(o),o=ej.EjSvgRender.utils._trimText(o,t,u),p=ej.EjSvgRender.utils._measureText(o,null,u).width,v=Math.max(v,p),c.push(o);else{c.push(i);break}return{text:c,unTrimmedText:b}},getMultiLevelLabelSize:function(n){var e=0,r,i;n._multiLevelLabelHeight=0;var u=[],f=[],y=[],d=n.multiLevelLabels.length,p=n.visibleRange,t,h,i,w,b,c,l,o,s=10,a,v=n.orientation.toLowerCase(),k=[];for(axisValue=v=="vertical"?n.length:n.width?n.width:this.model.primaryYAxis.AxisMaxWidth?n.length-this.model.primaryYAxis.AxisMaxWidth:n.length,i=0;i<d;i++)t=n.multiLevelLabels[i]=u[i]=$.extend(!0,{},this.model.multiLevelLabelsDefault,n.multiLevelLabels[i]),borderStyle=t.border.type.toLowerCase(),h=t.level,!t.visible||t.text==""||ej.util.isNullOrUndefined(t.start)||ej.util.isNullOrUndefined(t.end)||(w=Math.ceil(ej.EjSvgRender.utils._getPointXY(t.start,p,n.isInversed)*axisValue),b=Math.ceil(ej.EjSvgRender.utils._getPointXY(t.end,p,n.isInversed)*axisValue),c=ej.EjSvgRender.utils._measureText(t.text,null,t.font),textOverflow=t.textOverflow.toLowerCase(),l=ej.util.isNullOrUndefined(t.maximumTextWidth)?b-w:t.maximumTextWidth,o=v=="vertical"?t.maximumTextWidth?t.maximumTextWidth:c.width:c.height,o+=2*t.border.width,c.width>l-s&&(textOverflow=="wrap"||textOverflow=="wrapandtrim")&&(a=this._wrap(n,l-s,t.text,textOverflow,t.font,c),a=a.text,o=v=="vertical"?l-s:o*a.length),f[h]=ej.util.isNullOrUndefined(f[h])?o:f[h]<o?o:f[h]);for(u.sort(function(n,t){return parseFloat(n.level)-parseFloat(t.level)}),n.multiLevelLabels.sort(function(n,t){return parseFloat(n.level)-parseFloat(t.level)}),r=0;r<u.length;r++)r==0?(n.multiLevelLabels[r]._level=u[r]._level=0,greaterIndex=0):u[r].level>greaterIndex+1?(n.multiLevelLabels[r]._level=u[r]._level=greaterIndex+1,greaterIndex=u[r]._level):(n.multiLevelLabels[r]._level=u[r]._level=u[r].level,greaterIndex=u[r].level>greaterIndex?u[r].level:greaterIndex),borderStyle=="curlybrace"&&(k[n.multiLevelLabels[r]._level]=!0);for(i=0;i<f.length;i++)y[i]=e,ej.util.isNullOrUndefined(f[i])?(f.splice(i,1),i--):(e=borderStyle=="brace"?e+f[i]:e+f[i]+s/2,k[i]&&(e+=s,f[i]+=s));return n._multiLevelLabelHeight=e,n.multiLevelLabelHeight=f,n.prevHeight=y,e},_saturationColor:function(n,t){n=this.colorNameToHex(n);n=String(n).replace(/[^0-9a-f]/gi,"");n.length<6&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]);t=t||0;for(var u="#",i,r=0;r<3;r++)i=parseInt(n.substr(r*2,2),16),i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),u+=("00"+i).substr(i.length);return u},_drawChartAreaRect:function(){var t=(this.model.background&&this.model.background._gradientStop)?"url(#"+this.svgObject.id+"_backGradient)":this.model.background,n,i,r;this.model.backGroundImageUrl&&(t="transparent");n=this.model.border;i={id:this.svgObject.id+"_SvgRect",x:n.width/2,y:n.width/2,width:$(this.svgObject).width()-2*n.width,height:$(this.svgObject).height()-2*n.width,fill:t,opacity:n.opacity,"stroke-width":n.width,stroke:n.color,"class":"e-chartborder"};this.svgRenderer.drawRect(i,this.svgObject);this.model.backGroundImageUrl&&this._drawBackImage();this.model.AreaType!="cartesianaxes"||this.model.enable3D||(r={id:this.svgObject.id+"_ChartArea",x:this.model.m_AreaBounds.X,y:this.model.m_AreaBounds.Y,width:this.model.m_AreaBounds.Width,height:this.model.m_AreaBounds.Height,fill:this.model.chartArea.background,"stroke-width":this.model.chartArea.border.width,opacity:this.model.chartArea.border.opacity,stroke:this.model.chartArea.border.color,"class":"e-chartareaborder"},this.svgRenderer.drawRect(r,this.svgObject))},axesIndexCount:function(n,t){for(var i,r=[],u=0;u<n.length;u++)i=n[u],i.orientation.toLowerCase()=="vertical"?i.rowIndex==t&&r.push(i):i.columnIndex==t&&r.push(i);return r},axesCount:function(n){var t=[],o=[],i=0,u=this.model,r,f,e;if($.each(n,function(n,r){r.orientation.toLowerCase()=="vertical"?(i=u.rowDefinitions?u.rowDefinitions.length:0,n==0?t.push({axis:r,index:r.rowIndex}):r.rowIndex!=t[t.length-1].axis.rowIndex&&t.push({axis:r,index:r.rowIndex})):(i=u.columnDefinitions?u.columnDefinitions.length:0,n==0?t.push({axis:r,index:r.columnIndex}):r.columnIndex!=t[t.length-1].axis.columnIndex&&t.push({axis:r,index:r.columnIndex}))}),r=t.length,i>r)for(r=i,f=0;f<i;f++)o.push(f);else for(e=0;e<r;e++)o.push(t[e].index);return{length:r,indexValue:o}},_calRowSize:function(){var t=0,u=[],e=0,f=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height,i,o,n,r,s,h;if(this.model._rowDefinitions[0].rowDefinitions!=null)for(i=0,o=this.model._rowDefinitions.length;i<o;i++)n=this.model._rowDefinitions[i].rowDefinitions,n.rowHeight=Math.abs(n.rowHeight),r=0,n.unit.toLowerCase()=="percentage"?(s=this._axisRowDefinitionSize(this.model.rowDefinitions),r=Math.floor(this.model.m_AreaBounds.Height*(n.rowHeight/s))):r=n.rowHeight,i==0&&u.push(f),u.push(f-r-e),e+=r;else for(h=Math.floor(this.model.m_AreaBounds.Height/this.model._rowDefinitions.length),t=f;t>=this.model.m_AreaBounds.Y;t=t-h)u.push(t);return u},_calColumnSize:function(){var r=[],u=this.model.m_AreaBounds.X,o=this.model.m_AreaBounds.Width,s=0,f=this.model._columnDefinitions,t,h,n,e,c,l,i,a;if(f[0].columnDefinitions!=null)for(t=0,h=f.length;t<h;t++)n=f[t].columnDefinitions,n.columnWidth=Math.abs(n.columnWidth),n.unit.toLowerCase()=="percentage"?(c=this._axisColumnDefinitionSize(this.model.columnDefinitions),e=Math.floor(o*(n.columnWidth/c))):e=n.columnWidth,t==0&&r.push(u),r.push(u+e+s),s+=e;else for(l=Math.floor(o/f.length),i=u,a=u+o;i<=a;i=i+l)r.push(i);return r},_calculateAxisSize:function(n){for(var lt,at,a,o,rt,f,yt,pt,e=!0,u=!0,v=this._calColumnSize(),s=this.model._columnDefinitions,t=0,ct=s.length;t<ct;t++){var wt=v[t],g=v[t+1],y=0,p=0,nt=!0,tt=!0,w=this.model.m_AreaBounds.Y,it=w+this.model.m_AreaBounds.Height;for(f=0,lt=s[t].axis.length;f<lt;f++){var i=s[t].axis[f],h=0,b=0,c=i._opposed;if(n.axes[i.name]._validCross||(c?tt&&(u||p==0)?(h=w,tt=!1):(b=s.farSizes[p],h=w=w-b,p++):nt&&(e||y==0)?(h=it,nt=!1):(b=s.nearSizes[y],h=it=it+b,y++)),i.columnSpan){if(!(s[t].index==i.columnIndex))continue;at=ct>=t+i.columnSpan?t+i.columnSpan:t+1;g=v[at];c||y!=0||(e=nt);c&&p==0&&(u=tt)}else g=v[t+1],e=!0,u=!0;i.Location={};i.Location.X1=wt+i.plotOffset;i.Location.Y1=h;i.Location.X2=g-i.plotOffset;i.Location.Y2=h;i.x=i.Location.X1;i.y=i.Location.Y1;i.width=i.Location.X2-i.Location.X1;i.height=i.Location.Y2-i.Location.Y1}}for(e=!0,u=!0,a=this._calRowSize(),o=this.model._rowDefinitions,t=0,rt=o.length;t<rt;t++){var bt=a[t],ut=a[t+1],k=0,ft=0,et=!0,ot=!0,st=this.model.m_AreaBounds.X,vt=st,ht=st+this.model.m_AreaBounds.Width;for(f=0,yt=o[t].axis.length;f<yt;f++){var d=0,l=0,r=o[t].axis[f],c=r._opposed;if(n.axes[r.name]._validCross||(c?ot&&(u||u==0)?(l=ht,ot=!1):(d=o.farSizes[ft],l=ht=ht+d,ft++):et&&(e||k==0)?(l=st,et=!1):(d=o.nearSizes[k],l=vt=vt-d,k++)),r.rowSpan){if(!(o[t].index==r.rowIndex))continue;pt=rt>=t+r.rowSpan?t+r.rowSpan:t+1;ut=a[pt];c||k!=0||(e=et);c&&ft==0&&(u=ot)}else ut=a[t+1],e=!0,u=!0;r.Location={};r.Location.X1=l;r.Location.Y1=bt-r.plotOffset;r.Location.X2=l;r.Location.Y2=ut+r.plotOffset;r.x=r.Location.X1;r.y=r.Location.Y2;r.height=r.Location.Y1-r.Location.Y2;r.width=r.axisLine.width}}},_validateCrossing:function(n){if(n._opposedPosition=!1,n.crossesAt!=null){var t=this._getCrossAxis(this.model._axes,n.orientation.toLowerCase()=="horizontal",n.crossesInAxis);return n._crossValue=this._getCrossValue(n,t,t._valueType),((t.isInversed?!n.opposedPosition:n.opposedPosition)?n._crossValue<=t.visibleRange.min:n._crossValue>=t.visibleRange.max)&&(n._opposedPosition=!0),t.visibleRange.min<n._crossValue&&t.visibleRange.max>n._crossValue}return!1},_axisCrossing:function(n,t,i){var u=n.orientation.toLowerCase()=="horizontal",r=this._getCrossAxis(this.model._axes,u,n.crossesInAxis),f=n._crossValue,e=Math.abs((r.isInversed?r.visibleRange.max:r.visibleRange.min)-f);this._locateAxis(n,r,u,e);t||(i._crossAxisOverlap=this._avoidOverlapping(n,this.model.m_AreaBounds,u,n.opposedPosition,i)||i._crossAxisOverlap)},_locateAxis:function(n,t,i,r){var u=(i?t.height:t.width)*r/t.visibleRange.delta;i?n.y=t.y+t.height-u:n.x=t.x+u},_avoidOverlapping:function(n,t,i,r,u){var f=0,e=n.showNextToAxisLine?u.axes[n.name]._bounds:0;if(i){if(!r&&n.y+e>t.Y+t.Height)return t.Height-=f=n.y+e-t.Y-t.Height,this._recalculateSpace(n,i,r,f),!0;if(r&&n.y-e<t.Y)return t.Y+=f=e-(n.y-t.Y),t.Height-=f,this._recalculateSpace(n,i,r,f),!0}else{if(!r&&n.x-e<t.X)return t.X+=f=e-(n.x-t.X),t.Width-=f,this._recalculateSpace(n,i,r,f),!0;if(r&&n.x+e>t.X+t.Width)return t.Width-=f=n.x+e-t.X-t.Width,this._recalculateSpace(n,i,r,f),!0;if(n.labelPosition=="inside"&&n.x+e>t.X+t.Width)return t.Width-=f=n.x+e-t.X-t.Width,this._recalculateSpace(n,i,r,f,n.showNextToAxisLine),!0}},_recalculateSpace:function(n,t,i,r,u){var l,e,s,a,f,h,o,c;if(t){for(e=this.model._rowDefinitions,s=i?e.length-1:0,f=0,h=e[s].axis.length;f<h;f++)e[s].axis[f].height-=r,e[s].axis[f].Location.Y2-=r,i&&(e[s].axis[f].Location.Y1=e[s].axis[f].y+=r);for(l=n.columnIndex,e=this.model._columnDefinitions,f=0,h=e.length;f<h;f++)if(f!==l)for(o=0,c=e[f].axis.length;o<c;o++)e[f].axis[o]._opposed===i&&(e[f].axis[o].Location.Y1=e[f].axis[o].Location.Y2=e[f].axis[o].y+=(i?1:-1)*r)}else{for(e=this.model._columnDefinitions,s=i?e.length-1:0,f=0,h=e[s].axis.length;f<h;f++)e[s].axis[f].width-=r,u||(i?e[s].axis[f].Location.X2-=r:e[s].axis[f].Location.X1=e[s].axis[f].x+=r);for(a=n.rowIndex,e=this.model._rowDefinitions,f=0,h=e.length;f<h;f++)if(f!==a)for(o=0,c=e[f].axis.length;o<c;o++)e[f].axis[o]._opposed===i&&(e[f].axis[o].Location.X1=e[f].axis[o].Location.X2=e[f].axis[o].x+=(i?-1:1)*r)}},_getCrossValue:function(n,t,i){switch(i.toLowerCase()){case"category":return t.labels.indexOf(n.crossesAt)!=-1?t.labels.indexOf(n.crossesAt):n.crossesAt;case"datetime":return isNaN(Date.parse(n.crossesAt))?null:Date.parse(n.crossesAt);case"logarithmic":return Math.log(n.crossesAt)/Math.log(t.logBase)}return n.crossesAt},_getXCrossValue:function(n,t,i){var r=t.crossesInAxis,u=n._yAxisName,f=i.axes[t.name]._validCross||i.axes[t.name]._validCross==null;return f&&t.crossesAt&&(!r&&u===this.model.primaryYAxis.name||r&&this._getCrossAxis(this.model._axes,!0,r).name===u)?t.crossesAt:0},_getAxisByName:function(n,t,i){if(i)for(var r=0,u=n.length;r<u;r++)if(n[r].name===i&&(t?n[r].orientation=="vertical":n[r].orientation=="horizontal"))return n[r]},_getCrossAxis:function(n,t,i){return this._getAxisByName(n,t,i)||(this.model.requireInvertedAxes?t?this.model.primaryXAxis:this.model.primaryYAxis:t?this.model.primaryYAxis:this.model.primaryXAxis)},_arrangeAxis:function(){for(var o,i,u,a,c,v,s,r,f,y,l,p,n=this,t,e,h=0;h<this.model._axes.length;h++)t=this.model._axes[h],t.orientation.toLowerCase()=="horizontal"?(n.model.hAxes.push(t),t.columnIndex=ej.util.isNullOrUndefined(t.columnIndex)?0:t.columnIndex,n.model.hAxes[n.model.hAxes.length-1].columnIndex=t.columnIndex):t.orientation.toLowerCase()=="vertical"&&(n.model.vAxes.push(t),t.rowIndex=ej.util.isNullOrUndefined(t.rowIndex)?0:t.rowIndex,n.model.vAxes[n.model.vAxes.length-1].rowIndex=t.rowIndex,e=ej.util.isNullOrUndefined(n.model.rowDefinitions)?null:n.model.rowDefinitions[t.rowIndex],e&&(t.axisBottomLine={},t.axisBottomLine.visible=!0,t.axisBottomLine.lineWidth=e.lineWidth,t.axisBottomLine.color=e.lineColor));if(this.model.hAxes=ej.DataManager(this.model.hAxes,ej.Query().sortBy("columnIndex")).executeLocal(),this.model.vAxes=ej.DataManager(this.model.vAxes,ej.Query().sortBy("rowIndex")).executeLocal(),o=this.axesCount(n.model.vAxes),n.model._rowDefinitions=[],n.model.vAxes.length>0)for(i=0;i<o.length;i++)u=n.model.rowDefinitions,a=u?u[i]?u[i]:u[0]:null,n.model._rowDefinitions.push({axis:this.axesIndexCount(n.model.vAxes,o.indexValue[i]),index:o.indexValue[i],rowDefinitions:a});if(c=n.model._rowDefinitions,v=this._axisFilter(c,"rowSpan"),this._SpanningAxes(c,v,!0),s=this.axesCount(n.model.hAxes),n.model._columnDefinitions=[],n.model.hAxes.length>0)for(r=0;r<s.length;r++)f=n.model.columnDefinitions,y=f?f[r]?f[r]:f[0]:null,n.model._columnDefinitions.push({axis:this.axesIndexCount(n.model.hAxes,s.indexValue[r]),index:s.indexValue[r],columnDefinitions:y});l=n.model._columnDefinitions;p=this._axisFilter(l,"columnSpan");this._SpanningAxes(l,p,!1);this._axisSize()},_SpanningAxes:function(n,t,i){for(var r,c,e,o,s,u,f=0,h=t.length;f<h;f++){if(r=t[f],r==null)break;if(c=i?r.rowSpan:r.columnSpan,e=i?r.rowIndex:r.columnIndex,n[e]!=undefined)for(o=n[e].axis.indexOf(r),s=1,u=e+1;s<c&&u<n.length;s++,u++)n[u].axis.length>=o&&n[u].axis.splice(o,0,r)}},_axisFilter:function(n,t){var i=[];return n.filter(function(n){for(var u=ej.DataManager(n.axis,ej.Query().where(t,">",1)).executeLocal(),r=0,f=u.length;r<f;r++)i.push(u[r])}),i},_axisSize:function(){for(var n,r,t,u,o,i=this._getLegendSpace(),f=$(this.svgObject).width()-this.model.margin.left-this.model.margin.right-this.model.elementSpacing*2-i.leftLegendWidth-i.rightLegendWidth,h=Math.floor(f/this.axesCount(this.model.hAxes).length),e=$(this.svgObject).height()-this.model.margin.top-this.model.margin.bottom-this.model.elementSpacing*2-i.topLegendHeight-i.bottomLegendHeight-i.modelTitleHeight-i.modelsubTitleHeight,c=Math.floor(e/this.axesCount(this.model.vAxes).length),s=0;s<this.model._axes.length;s++)axis=this.model._axes[s],axis.orientation.toLowerCase()=="horizontal"?this.model.AreaType!="polaraxes"?(n=ej.util.isNullOrUndefined(this.model.columnDefinitions)?[]:this.model.columnDefinitions[axis.columnIndex],r=h,n&&(n.unit=n.unit==undefined?"percentage":n.unit,n.columnWidth=n.columnWidth==undefined?100:n.columnWidth,n.unit.toLowerCase()=="percentage"?(o=this._axisColumnDefinitionSize(this.model.columnDefinitions),r=Math.floor(h*(n.columnWidth/o))):r=n.columnWidth),axis.length=axis.columnSpan?axis.columnSpan*r:r):axis.length=f>e*2?f-e:f:axis.orientation.toLowerCase()=="vertical"&&(this.model.AreaType!="polaraxes"?(t=ej.util.isNullOrUndefined(this.model.rowDefinitions)?[]:this.model.rowDefinitions[axis.rowIndex],u=c,t&&(t.unit=t.unit==undefined?"percentage":t.unit,t.rowHeight=t.rowHeight==undefined?100:t.rowHeight,t.unit.toLowerCase()=="percentage"?(o=this._axisRowDefinitionSize(this.model.rowDefinitions),u=Math.floor(c*(t.rowHeight/o))):u=t.rowHeight),axis.length=axis.rowSpan?axis.rowSpan*u:u):axis.length=e/2)},_axisRowDefinitionSize:function(n){var t=0,i;if(n)for(i=0;i<n.length;i++)t=t+n[i].rowHeight;return t>100?t:100},_axisColumnDefinitionSize:function(n){var t=0,i;if(n)for(i=0;i<n.length;i++)t=t+n[i].columnWidth;return t>100?t:100},_axisMeasure:function(n,t,i,r){var u=0,o=0,f=0,e,s;return n.axisLine.width=n.axisLine.width<0?0:n.axisLine.width,n.majorTickLines.size=n.majorTickLines.size<0?0:n.majorTickLines.size,e=!this.model.enable3D&&n.axisLine.visible&&n.axisLine.width,s=ej.EjSvgRender.utils._measureText(n.title.text,t,n.title.font),i=="vertical"?(o=n._LableMaxWidth.width,u=n.title.text==""||!n.title.visible||!n.visible?0:document.documentMode===8?s.width:s.height+2*this.model.elementSpacing):(o=n._LableMaxWidth.height,u=n.title.text==""||!n.title.visible||!n.visible?0:s.height+this.model.elementSpacing),u=n.title.position.toLowerCase()=="inside"?0:u,f=this.getMultiLevelLabelSize(n),n.AxisMaxWidth=r==0&&n.tickLinesPosition=="inside"&&n.labelPosition=="inside"?u+f+e+this.model.elementSpacing:r==0&&n.tickLinesPosition=="inside"&&n.labelPosition!="inside"?u+f+e+this.model.elementSpacing+o:r==0&&n.tickLinesPosition!="inside"&&n.labelPosition=="inside"?u+f+e+this.model.elementSpacing+n.majorTickLines.size:u+f+e+this.model.elementSpacing+n.majorTickLines.size+o,n.AxisMaxWidth+=n._isScroll?18:0,n.AxisMaxWidth},_arraySum:function(n){for(var i=0,t=0;t<n.length;t++)i+=parseFloat(n[t])||0;return i},_calSpace:function(n,t,i,r){for(var h,c,f,u,e=[],o=[],s=0;s<t.length;s++)for(h=0,c=0,f=0;f<t[s].axis.length;f++)(u=t[s].axis[f],bounds=r.axes[u.name]._bounds=this._axisMeasure(u,n,i,f),validCross=r.axes[u.name]._validCross=this._validateCrossing(u),measureValue=validCross?0:bounds,u._opposed=u.opposedPosition?!u._opposedPosition:u._opposedPosition||u.opposedPosiiton||!1,validCross&&t[s].axis[f].showNextToAxisLine)||(u.showNextToAxisLine||(measureValue=u.labelPosition=="inside"?bounds-u._multiLevelLabelHeight:bounds),u._opposed?(o.length<=c?o.push(measureValue):o[c]<measureValue&&(o[c]=measureValue),c++):(e.length<=h?e.push(measureValue):e[h]<measureValue&&(e[h]=measureValue),h++));return{nearSizes:e,farSizes:o}},_getLegendSpace:function(){var h=this.model,c=h.legend,a=c.position.toLowerCase(),w=h.LegendActualBounds,b=ej.EjSvgRender.utils._measureText,n=h.title,t=n.subTitle,l=h.elementSpacing,v=h.margin,y=h.svgWidth,k=c.border.width,d=0,g=0,rt=0,ut=0,ft=0,et=0,bt=n.text.split(" "),ot=n.enableTrim,e=n.maximumWidth,e=e.toString()=="auto"||e.toString()==""?y*.75:parseInt(e),r=n.textOverflow.toLowerCase(),p=n.text,vt=n.visible,o,s,i,st=ej.EjSvgRender.utils._measureText(n.text,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,n.font),kt=t.text.split(" "),ht=t.enableTrim,u=t.maximumWidth,u=u.toString()=="auto"||u.toString()==""?y*.75:parseInt(u),f=t.textOverflow.toLowerCase(),nt=t.text,yt=t.visible,ct=ej.EjSvgRender.utils._measureText(t.text,$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,t.font),lt=vt&&ot&&st.width>e?!0:!1,at=yt&&ht&&ct.width>u?!0:!1,pt=r=="wrap"||r=="wrapandtrim"?!0:!1,wt=f=="wrap"||f=="wrapandtrim"?!0:!1,tt,it;return this.model.titleWrapTextCollection=[],this.model.subTitleWrapTextCollection=[],this.model.trimTooltip=!1,this.model.subTitleTooltip=!1,c.visible&&(g=w.Width+5+l+2*k,rt=a=="left"?g:0,ut=a=="right"?g:0,c.title.text&&(d=b(c.title,null,c.title.font).height),ft=a=="top"?w.Height+d+2*k:0,et=a=="bottom"?w.Height+d+2*k:0),lt&&r=="wrap"?(i={text:p,font:n.font},o=this._rowsCalculation(i,e,r)):lt&&r=="wrapandtrim"?(i={text:p,font:n.font},o=this._rowsCalculation(i,e,r)):(r=="wrapandtrim"||r=="wrap")&&(i={text:p,font:n.font},o=this._rowsCalculation(i,ej.EjSvgRender.utils._measureText(p,null,n.font).width,r)),this.model.titleWrapTextCollection=o?o.textCollection:"",this.model.titleMaxWidth=o?o.wordMax:e,at&&f=="wrap"?(i={text:nt,font:t.font},s=this._rowsCalculation(i,u,f)):at&&f=="wrapandtrim"?(i={text:nt,font:t.font},s=this._rowsCalculation(i,u,f),this.model.subTitleTooltip=this.model.trimTooltip):(f=="wrapandtrim"||f=="wrap")&&(i={text:nt,font:t.font},s=this._rowsCalculation(i,u,f)),this.model.subTitleWrapTextCollection=s?s.textCollection:"",this.model.subTitleMaxWidth=s?s.wordMax:u,tt=b(n.text,y-v.left-v.right,n.font).height,it=b(t.text,y-v.left-v.right,t.font).height,modelTitleHeight=n.text==""||!n.visible?0:ot&&pt&&st.width>e?tt*this.model.titleWrapTextCollection.length+l:tt+l,modelsubTitleHeight=t.text==""||!t.visible||!n.visible?0:ht&&wt&&ct.width>u?it*this.model.subTitleWrapTextCollection.length+l:it+l,{leftLegendWidth:rt,rightLegendWidth:ut,topLegendHeight:ft,bottomLegendHeight:et,modelTitleHeight:modelTitleHeight,modelsubTitleHeight:modelsubTitleHeight}},_arraySome:function(n,t){for(var r=!1,e=this.model.zooming.enableScrollbar,o=n.length,u,f,i=0;i<o;i++)u=n[i].scrollbarSettings.enableScrollbar,f=n[i].scrollbarSettings.pointsLength,r=r||(n[i]._isScroll&&n[i].maxPointLength<f||n[i].zoomFactor<1&&u&&e)&&n[i].orientation.toLowerCase()==t;return r},_calculateAreaBounds:function(n){var t=this,h=$(this.svgObject).width()-this.model.margin.left-this.model.margin.right,f=t.model.border.width,k=this.model._axes[0],d=this.model.zooming.enableScrollbar,g=this.model.zooming.type.toLowerCase(),r,u;t.model.scrollerSize=18;this.model._yScroll=this._arraySome(this.model._axes,"vertical");this.model._xScroll=this._arraySome(this.model._axes,"horizontal");r=this._calSpace(h,t.model._rowDefinitions,"vertical",n);t.model._rowDefinitions.nearSizes=r.nearSizes;t.model._rowDefinitions.farSizes=r.farSizes;var y=this._arraySum(r.nearSizes),p=this._arraySum(r.farSizes),i=this._getLegendSpace(),e=y+i.leftLegendWidth+t.model.margin.left+f,c=p+i.rightLegendWidth+t.model.margin.right+t.model.margin.left+2*f,l=$(this.svgObject).width(),o=l-(e+c);if(o<0&&this.model.AreaType=="cartesianaxes")$(this.svgObject).width(l-o+1),this._calculateAreaBounds(n);else{u=this._calSpace(h,t.model._columnDefinitions,"horizontal",n);t.model._columnDefinitions.nearSizes=u.nearSizes;t.model._columnDefinitions.farSizes=u.farSizes;var w=this._arraySum(u.nearSizes),b=this._arraySum(u.farSizes),s=b+this.model.margin.top+this.model.elementSpacing+i.modelTitleHeight+i.modelsubTitleHeight+i.topLegendHeight+f,a=w+this.model.margin.bottom+i.bottomLegendHeight+2*f,v=Math.abs($(this.svgObject).height()-(s+a));this.model.m_AreaBounds={X:e,Y:s,Width:o,Height:v};this.model.m_Spacing={Left:e,Top:s,Right:c,Bottom:a};this.model.enableCanvasRendering?(this.canvasX=e,this.canvasY=s,this.canvasWidth=o,this.canvasHeight=v):this.canvasX=this.canvasY=this.canvasHeight=this.canvasWidth=0}}};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}}}(jQuery),function(n,t){t.widget("ejChart","ej.datavisualization.Chart",{element:null,model:null,validTags:["div"],defaults:{border:{color:"transparent",width:0,opacity:.3},chartArea:{border:{color:"Gray",width:.5,opacity:.3},background:"transparent"},primaryXAxis:{crossesAt:null,crossesInAxis:null,isIndexed:!1,alignment:"center",labelPlacement:"",scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},range:{min:null,max:null,interval:null},labelPosition:"outside",tickLinesPosition:"outside",alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorGridLines:{width:1,dashArray:"",visible:!0,opacity:1},majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,columnIndex:null,columnSpan:null,labelRotation:null,valueType:null,name:null,labelFormat:null,desiredIntervals:null,intervalType:null,roundingPlaces:null,logBase:10,plotOffset:0,labels:[],stripLine:[{visible:!1,startFromAxis:!1,text:"",width:0,textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"14px",opacity:1,fontWeight:"regular"}},rangePadding:"Auto",additionalPadding:[1,1],orientation:"Horizontal",maximumLabels:3,opposedPosition:!1,showNextToAxisLine:!0,axisLine:{visible:!0,width:1,dashArray:"",offset:0},labelIntersectAction:"none",maximumLabelWidth:34,enableTrim:!1,edgeLabelPlacement:"none",isInversed:!1,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",fontWeight:"regular",opacity:1},visible:!0,crosshairLabel:{visible:!1},zoomFactor:1,zoomPosition:0},primaryYAxis:{crossesAt:null,crossesInAxis:null,showNextToAxisLine:!0,alignment:"center",startFromZero:!0,range:{min:null,max:null,interval:null},scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},labelPlacement:"",labelPosition:"outside",tickLinesPosition:"outside",alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorGridLines:{width:1,dashArray:"",visible:!0,opacity:1},majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,rowIndex:null,rowSpan:null,valueType:null,name:null,labelFormat:null,desiredIntervals:null,intervalType:null,roundingPlaces:null,labels:[],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",opacity:1,size:"14px",fontWeight:"regular"}},rangePadding:"Auto",stripLine:[{visible:!1,startFromAxis:!1,width:0,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],logBase:10,plotOffset:0,orientation:"Vertical",maximumLabels:3,labelIntersectAction:"none",maximumLabelWidth:34,enableTrim:!1,edgeLabelPlacement:"none",isInversed:!1,crosshairLabel:{visible:!1},visible:!0,opposedPosition:!1,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",opacity:1,fontWeight:"regular"},axisLine:{visible:!0,width:1,dashArray:"",offset:0},zoomFactor:1,zoomPosition:0},axes:[],secondaryX:{crossesAt:null,crossesInAxis:null,showNextToAxisLine:!0,alignment:"center",range:{min:null,max:null,interval:null},scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},tickLinesPosition:"outside",labelPosition:"outside",majorGridLines:{width:1,dashArray:"",visible:!0},alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,columnIndex:null,columnSpan:null,labelRotation:null,valueType:null,name:null,labelFormat:null,labelPlacement:"",desiredIntervals:null,intervalType:null,roundingPlaces:null,logBase:10,plotOffset:0,labels:[],stripLine:[{visible:!1,startFromAxis:!1,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"regular",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"14px",opacity:1,fontWeight:"regular"}},rangePadding:"Auto",additionalPadding:[1,1],orientation:"Horizontal",maximumLabels:3,opposedPosition:!1,axisLine:{visible:!0,width:1,dashArray:"",offset:0},labelIntersectAction:"none",edgeLabelPlacement:"none",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",fontWeight:"regular",opacity:1},visible:!0,crosshairLabel:{visible:!1},zoomFactor:1,zoomPosition:0},secondaryY:{crossesAt:null,crossesInAxis:null,showNextToAxisLine:!0,alignment:"center",startFromZero:!0,range:{min:null,max:null,interval:null},scrollbarSettings:{visible:!0,canResize:!0,range:{min:null,max:null},pointsLength:null},tickLinesPosition:"outside",labelPosition:"outside",majorGridLines:{width:1,dashArray:"",visible:!0},alternateGridBand:{odd:{fill:"transparent",opacity:1},even:{fill:"transparent",opacity:1}},enableAutoIntervalOnZooming:!0,majorTickLines:{width:1,size:5,visible:!0},minorGridLines:{width:1,dashArray:"",visible:!0},minorTickLines:{width:1,size:5,visible:!0},labelBorder:{width:0},multiLevelLabels:[{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}}],minorTicksPerInterval:null,rowIndex:null,rowSpan:null,valueType:null,name:null,labelFormat:null,desiredIntervals:null,intervalType:null,roundingPlaces:null,labels:[],title:{text:"",visible:!0,enableTrim:!1,offset:0,alignment:"center",position:"outside",maximumTitleWidth:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",opacity:1,size:"14px",fontWeight:"regular"}},rangePadding:"Auto",stripLine:[{visible:!1,startFromAxis:!1,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"regular",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over"}],logBase:10,plotOffset:0,orientation:"Vertical",maximumLabels:3,labelIntersectAction:"none",labelPlacement:"",edgeLabelPlacement:"none",crosshairLabel:{visible:!1},visible:!0,opposedPosition:!1,font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"11px",opacity:1,fontWeight:"regular"},axisLine:{visible:!0,width:1,dashArray:"",offset:0},zoomFactor:1,zoomPosition:0},trendlineDefaults:{type:"linear",visibility:"",visibleOnLegend:"visible",name:"Trendline",fill:"",width:1,opacity:1,dashArray:"",forwardForecast:0,backwardForecast:0,polynomialOrder:2,period:2,intercept:null,tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",opacity:1}}},indicatorDefaults:{visible:!0,points:[],tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95},seriesName:"",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1},type:"SMA",period:14,standardDeviations:2,kPeriod:3,dPeriod:3,periodLine:{fill:"blue",width:2},lowerLine:{fill:"#008000",width:2},upperLine:{fill:"#ff0000",width:2},macdLine:{fill:"#ff9933",width:2},histogram:{fill:"#ccccff",opacity:1,border:{color:"#9999ff",width:1}},fill:"#00008B",width:2,xAxisName:"",yAxisName:"",visibility:"visible",macdType:"line",shortPeriod:12,longPeriod:26,trigger:9,enableAnimation:!1},annotationsDefault:{visible:!1,content:"",coordinateUnit:"none",verticalAlignment:"middle",horizontalAlignment:"middle",region:"chart",x:0,y:0,opacity:1,angle:0,xAxisName:"",yAxisName:"",margin:{left:0,right:0,bottom:0,top:0}},multiLevelLabelsDefault:{visible:!1,text:"",textAlignment:"center",start:null,end:null,level:0,maximumTextWidth:null,textOverflow:"trim",font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"Regular",opacity:1},border:{type:"rectangle",width:1}},stripLineDefault:{visible:!1,startFromAxis:!1,width:0,text:"",textAlignment:"middlecenter",font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"black",opacity:1},start:null,end:null,color:"gray",borderColor:"black",zIndex:"over",borderWidth:1},rowDefinitions:null,columnDefinitions:null,title:{text:"",enableTrim:!1,visible:!0,maximumWidth:"auto",textOverflow:"trim",textAlignment:"center",background:"transparent",border:{color:"transparent",width:1,opacity:.8,cornerRadius:.8},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"16px",opacity:1,fontWeight:"regular"},subTitle:{text:"",enableTrim:!1,visible:!0,maximumWidth:"auto",textOverflow:"trim",textAlignment:"far",background:"transparent",border:{color:"transparent",width:1,opacity:.8,cornerRadius:.8},font:{fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",opacity:1,fontWeight:"regular"}}},lineCap:{butt:"butt",round:"round",square:"square"},lineJoin:{round:"round",bevel:"bevel",miter:"miter"},legendAlignment:{near:"near",center:"center",far:"far"},legendPosition:{top:"top",bottom:"bottom",right:"right",left:"left",custom:"custom"},enableAnimation:!0,legend:{title:{text:"",textAlignment:"center",font:{size:"12px",fontFamily:"Segoe UI",fontStyle:"normal",fontWeight:"regular"}},border:{color:"transparent",width:1},visible:!0,textOverflow:"none",textWidth:34,toggleSeriesVisibility:!0,enableScrollbar:!0,itemPadding:10,shape:"None",alignment:"Center",position:"Bottom",location:{x:0,y:0},itemStyle:{height:9,width:9,border:{color:"transparent",width:1}},rowCount:null,columnCount:null,opacity:1,fill:null,background:null,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px"},size:{height:null,width:null}},indicators:[{points:[],tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95},seriesName:"",type:"SMA",period:14,standardDeviations:2,kPeriod:3,dPeriod:3,periodLine:{fill:"blue",width:2},lowerLine:{fill:"#008000",width:2},upperLine:{fill:"#ff0000",width:2},macdLine:{fill:"#ff9933",width:2},histogram:{fill:"#ccccff",opacity:1,border:{color:"#9999ff",width:1}},fill:"#00008B",visible:!0,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1},width:2,xAxisName:"",yAxisName:"",macdType:"line",shortPeriod:12,longPeriod:26,trigger:9,visibility:"visible",enableAnimation:!1}],backGroundImageUrl:null,annotations:[{visible:!1,content:"",coordinateUnit:"none",verticalAlignment:"middle",horizontalAlignment:"middle",region:"chart",x:0,y:0,opacity:1,angle:0,xAxisName:"",yAxisName:"",margin:{left:0,right:0,bottom:0,top:0}}],series:[{dragSettings:{enable:!1,type:"xy"},type:"column",splitMode:"value",splitValue:null,gapWidth:50,pieOfPieCoefficient:.6,visibleOnLegend:"visible",enableAnimation:!1,isClosed:!0,isTransposed:!1,isStacking:!0,columnSpacing:0,columnWidth:.7,columnFacet:"rectangle",drawType:"line",doughnutCoefficient:.4,explodeOffset:25,pyramidMode:"linear",boxPlotMode:"exclusive",funnelWidth:"11.6%",funnelHeight:"32.7%",positiveFill:null,showMedian:!0,outlierSettings:{shape:"circle",size:{width:6,height:6}},cornerRadius:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},connectorLine:{width:1,opacity:1,dashArray:null},errorBar:{visibility:"hidden",mode:"vertical",type:"fixedValue",horizontalErrorValue:1,verticalErrorValue:3,horizontalPositiveErrorValue:1,horizontalNegativeErrorValue:1,verticalPositiveErrorValue:5,verticalNegativeErrorValue:5,direction:"both",cap:{visible:!0,width:1,length:20},width:1,opacity:1},highlightSettings:{enable:!1,mode:"series",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},selectionSettings:{type:"Single",enable:!1,mode:"series",rangeType:"xy",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},emptyPointSettings:{visible:!0,style:{color:"",border:{color:"",width:1}},displayMode:"gap"},labelPosition:"inside",gapRatio:0,points:null,pieCoefficient:.8,doughnutSize:.8,dataSource:null,high:"",low:"",open:"",close:"",bullFillColor:null,bearFillColor:null,query:null,xName:"",yName:"",pointColorMappingName:"",visibility:"visible",startAngle:null,endAngle:null,xAxisName:null,yAxisName:null,explodeAll:null,explode:!1,explodeIndex:null,enableSmartLabels:null,tooltip:{visible:!1,format:null,template:null,fill:null,border:{width:1,color:null},enableAnimation:!0,duration:"500ms",opacity:.95},fill:null,opacity:1,lineCap:"butt",lineJoin:"round",dashArray:"",border:{width:1,color:"transparent",dashArray:""},width:2,marker:{shape:"circle",imageUrl:"",size:{width:6,height:6},visible:!1,opacity:1,fill:null,border:{color:"white",width:3},dataLabel:{visible:!1,angle:0,textMappingName:"",verticalTextAlignment:"center",horizontalTextAlignment:"center",textPosition:"top",shape:"none",opacity:1,fill:null,border:{color:"white",width:.1},maximumLabelWidth:null,enableWrap:!1,connectorLine:{width:.5,type:"line",color:null},offset:{x:0,y:0},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"11px",opacity:1},margin:{left:5,top:5,bottom:5,right:5}}},bubbleOptions:{radiusMode:"minmax",minRadius:1,maxRadius:3},trendlines:[{visibility:"",visibleOnLegend:"visible",type:"linear",name:"Trendline",fill:"",width:1,opacity:1,dashArray:"",forwardForecast:0,backwardForecast:0,polynomialOrder:2,period:2,intercept:null,tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",opacity:1}}}],font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1},_isdesigntime:!0}],commonSeriesOptions:{dragSettings:{enable:!1,type:"xy"},type:"column",splitMode:"value",splitValue:null,gapWidth:50,pieOfPieCoefficient:.6,visibleOnLegend:"visible",enableAnimation:!1,isClosed:!0,isTransposed:!1,isStacking:!1,columnWidth:.7,columnSpacing:0,columnFacet:"rectangle",drawType:"line",doughnutCoefficient:.4,explodeOffset:25,pyramidMode:"linear",boxPlotMode:"exclusive",funnelWidth:"11.6%",funnelHeight:"32.7%",positiveFill:null,showMedian:!0,outlierSettings:{shape:"circle",size:{width:6,height:6}},cornerRadius:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},connectorLine:{width:1,opacity:1,dashArray:null},errorBar:{visibility:"hidden",mode:"vertical",type:"fixedValue",horizontalErrorValue:1,verticalErrorValue:3,horizontalPositiveErrorValue:1,horizontalNegativeErrorValue:1,verticalPositiveErrorValue:5,verticalNegativeErrorValue:5,direction:"both",cap:{visible:!0,width:1,length:20},width:1,opacity:1},highlightSettings:{enable:!1,mode:"series",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},selectionSettings:{type:"Single",enable:!1,mode:"series",rangeType:"xy",color:"",opacity:.6,border:{color:"",width:2},pattern:"none",customPattern:""},emptyPointSettings:{visible:!0,style:{color:"",border:{color:"",width:1}},displayMode:"gap"},labelPosition:"inside",gapRatio:0,pieCoefficient:.8,doughnutSize:.8,dataSource:null,xName:"",yName:"",pointColorMappingName:"",high:"",low:"",open:"",close:"",startAngle:null,endAngle:null,xAxisName:null,yAxisName:null,explodeAll:!1,explode:!1,explodeIndex:null,enableSmartLabels:null,tooltip:{visible:!1,format:null,template:null,fill:null,border:{color:null,width:1},enableAnimation:!0,duration:"500ms",opacity:.95},fill:null,opacity:1,lineCap:"butt",lineJoin:"round",dashArray:"",border:{color:"transparent",width:1,dashArray:""},width:2,marker:{shape:"circle",imageUrl:"",size:{width:6,height:6},visible:!1,opacity:1,fill:null,border:{color:"white",width:3},dataLabel:{visible:!1,angle:0,textMappingName:"",verticalTextAlignment:"center",horizontalTextAlignment:"center",textPosition:"top",shape:"none",maximumLabelWidth:null,enableWrap:!1,opacity:1,fill:null,border:{color:"white",width:.1},offset:{x:0,y:0},connectorLine:{width:.5,type:"line"},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"11px",opacity:1},margin:{left:5,top:5,bottom:5,right:5}}},bubbleOptions:{radiusMode:"minmax",minRadius:1,maxRadius:3},trendlines:[{visibility:"",visibleOnLegend:"visible",type:"linear",name:"Trendline",fill:"",width:1,opacity:1,dashArray:"",forwardForecast:0,backwardForecast:0,polynomialOrder:2,period:2,intercept:null,tooltip:{visible:!1,format:null,fill:null,border:{width:1,color:null},duration:"500ms",enableAnimation:!0,opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",opacity:1}}}],font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1}},crosshair:{line:{color:"black",width:1},marker:{visible:!0,size:{width:10,height:10},opacity:1,border:{width:3}},visible:!1,type:"crosshair",trackballTooltipSettings:{fill:null,mode:"float",border:{width:null,color:null},rx:3,ry:3,opacity:1}},pointStyle:{lineCap:"butt",lineJoin:"round",opacity:1,interior:null,borderColor:null,borderWidth:1},textStyle:{marker:{textAlignment:"center",textPosition:"top"},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px",color:"#707070",opacity:1}},symbolShape:{None:0,LeftArrow:1,RightArrow:2,Circle:3,Cross:4,HorizLine:5,VertLine:6,Diamond:7,Rectangle:8,Triangle:9,InvertedTriangle:10,Hexagon:11,Pentagon:12,Star:13,Ellipse:14,Wedge:15,Trapezoid:16,UpArrow:17,DownArrow:18,Image:19,SeriesType:20},initSeriesRender:!0,theme:"flatlight",canResize:!1,isResponsive:!1,enable3D:!1,enableRotation:!1,sideBySideSeriesPlacement:null,perspectiveAngle:90,rotation:0,tilt:0,wallSize:2,depth:100,enableCanvasRendering:!1,selectedDataPointIndexes:[],exportSettings:{type:"png",fileName:"Chart",orientation:"portrait",angle:0,mode:"client",action:"",multipleExport:!1},zooming:{enable:!1,enableScrollbar:!1,type:"x,y",enablePinching:!0,enableMouseWheel:!1,enableDeferredZoom:!1,toolbarItems:["zoomIn","zoomOut","zoom","pan","reset"]},type:"x,y",locale:null,xZoomFactor:1,yZoomFactor:1,xZoomPosition:0,yZoomPosition:0,load:"",axesLabelRendering:"",axesRangeCalculate:"",axesTitleRendering:"",dragStart:"",dragging:"",dragEnd:"",chartAreaBoundsCalculate:"",legendItemRendering:"",legendBoundsCalculate:"",preRender:"",seriesRendering:"",trendlineRendering:"",symbolRendering:"",titleRendering:"",subtitleRendering:"",axesLabelsInitialize:"",pointRegionClick:"",seriesRegionClick:"",annotationClick:"",axisLabelClick:"",chartClick:"",scrollStart:"",scrollEnd:"",scrollChanged:"",chartDoubleClick:"",pointRegionMouseMove:"",legendItemClick:"",axisLabelMouseMove:"",chartMouseMove:"",legendItemMouseMove:"",chartMouseLeave:"",displayTextRendering:"",toolTipInitialize:"",trackAxisToolTip:"",trackToolTip:"",animationComplete:"",zoomed:"",destroy:"",create:"",beforeResize:"",afterResize:"",rangeSelected:"",multiLevelLabelClick:"",multiLevelLabelRendering:"",margin:{left:10,right:10,top:10,bottom:10},size:{width:null,height:null},elementSpacing:10,dateStart:25568.791666666668},dataTypes:{commonSeriesOptions:{dataSource:"data"},axes:"array",series:"array",annotations:"array",indicators:"array",seriesColors:"array",palette:"array",rowDefinitions:"array",columnDefinitions:"array",seriesBorderColors:"array",pointColors:"array",pointBorderColors:"array",initSeriesRender:"boolean",theme:"enum",canResize:"boolean",isResponsive:"boolean",elementSpacing:"number",primaryXAxis:{labels:"array",multiLevelLabels:"array",stripLine:"array",orientation:"enum",rangePadding:"enum",labelPlacement:"enum",tickLinesPosition:"enum",labelPosition:"enum",opposedPosition:"boolean",zoomFactor:"number",zoomPosition:"number",showNextToAxisLine:"boolean"},primaryYAxis:{labels:"array",multiLevelLabels:"array",stripLine:"array",orientation:"enum",rangePadding:"enum",labelPlacement:"enum",opposedPosition:"boolean",zoomFactor:"number",zoomPosition:"number"},legend:{textOverflow:"enum",shape:"enum",alignment:"enum",position:"enum",itemPadding:"number"},exportSettings:{type:"string",fileName:"string",orientation:"enum",angle:"number",mode:"enum",action:"string",multipleExport:"boolean"},zooming:{enable:"boolean",type:"string",enableMouseWheel:"boolean",toolbarItems:"array",enableScrollbar:"boolean"},size:{width:"string",height:"string"}},observables:["xZoomFactor","yZoomFactor","xZoomPosition","yZoomPosition"],_tags:[{tag:"series",attr:["xAxisName","yAxisName","zOrder","endAngle","startAngle","explodeIndex","labelPosition","xName","yName","pointColorMappingName","pyramidMode","boxPlotMode","showMedian","pieCoefficient","explodeAll","explodeOffset","funnelWidth","columnFacet","funnelHeight","gapRatio","isClosed","isTransposed","isStacking","bearFillColor","bullFillColor","dataSource","enableAnimation","doughnutCoefficient","doughnutSize","enableSmartLabels","drawType","dashArray","visibleOnLegend","columnSpacing","columnWidth","drawType","positiveFill","explodeIndex","cornerRadius","lineCap","lineJoin","highlightSettings.enable","highlightSettings.mode","highlightSettings.pattern","highlightSettings.color","highlightSettings.opacity","highlightSettings.customPattern","highlightSettings.border.color","highlightSettings.border.width","selectionSettings.enable","selectionSettings.mode","selectionSettings.pattern","selectionSettings.color","selectionSettings.opacity","selectionSettings.customPattern","selectionSettings.type","selectionSettings.rangeType","selectionSettings.border.width","selectionSettings.border.color","dragSettings.enable","dragSettings.type","connectorLine.width","connectorLine.opacity","connectorLine.dashArray","cornerRadius.topLeft","cornerRadius.topRight","cornerRadius.bottomLeft","cornerRadius.bottomRight","errorBar.visibility","errorBar.mode","errorBar.type","errorBar.horizontalErrorValue","errorBar.verticalErrorValue","errorBar.horizontalPositiveErrorValue","errorBar.horizontalNegativeErrorValue","errorBar.verticalPositiveErrorValue","errorBar.verticalNegativeErrorValue","errorBar.direction","errorBar.cap.visible","errorBar.cap.width","errorBar.cap.length","errorBar.width","errorBar.opacity","emptyPointSettings.visible","emptyPointSettings.style.color","emptyPointSettings.style.border.color","emptyPointSettings.style.border.width","emptyPointSettings.displayMode","bubbleOptions.minRadius","bubbleOptions.maxRadius","bubbleOptions.radiusMode","tooltip.visible","tooltip.format","tooltip.template","tooltip.fill","tooltip.border.width","tooltip.border.color","tooltip.enableAnimation","tooltip.duration","tooltip.opacity","tooltip.font.size","tooltip.font.opacity","tooltip.font.fontFamily","tooltip.font.fontStyle","tooltip.font.fontWeight","tooltip.font.color","border.width","border.color","border.dashArray","marker.shape","marker.imageUrl","marker.size.width","marker.size.height","marker.visible","marker.opacity","marker.fill","marker.border.color","marker.border.width","marker.dataLabel.visible","marker.dataLabel.angle","marker.dataLabel.template","marker.dataLabel.textMappingName","marker.dataLabel.verticalTextAlignment","marker.dataLabel.horizontalTextAlignment","marker.dataLabel.textPosition","marker.dataLabel.shape","marker.dataLabel.opacity","marker.dataLabel.fill","marker.dataLabel.border.color","marker.dataLabel.border.width","marker.dataLabel.maximumLabelWidth","marker.dataLabel.enableWrap","marker.dataLabel.connectorLine.width","marker.dataLabel.connectorLine.type","marker.dataLabel.connectorLine.color","marker.dataLabel.offset","marker.dataLabel.offset.x","marker.dataLabel.offset.y","marker.dataLabel.font.size","marker.dataLabel.font.color","marker.dataLabel.font.opacity","marker.dataLabel.font.fontFamily","marker.dataLabel.font.fontStyle","marker.dataLabel.font.fontWeight","marker.dataLabel.margin","marker.dataLabel.margin.left","marker.dataLabel.margin.top","marker.dataLabel.margin.bottom","marker.dataLabel.margin.right","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color",[{tag:"trendlines",attr:["visibility","visibilityOnLegend","dashArray","forewardForecast","backwardForecast","polynomialOrder","tooltip.visible","tooltip.format","tooltip.fill","tooltip.border.width","tooltip.border.color","tooltip.enableAnimation","tooltip.duration","tooltip.opacity","tooltip.font.size","tooltip.font.opacity","tooltip.font.fontFamily","tooltip.font.fontStyle","tooltip.font.fontWeight","tooltip.font.color",],singular:"trendline"}],[{tag:"points",attr:["x","y","text","textMappingName","isEmpty","fill","visible"],singular:"points"}]],singular:"series"},{tag:"axes",attr:["columnIndex","rowIndex","desiredIntervals","isIndexed","labelPlacement","edgeLabelPlacement","intervalType","labelFormat","labelPosition","labelRotation","logBase","labelIntersectAction","opposedPosition","plotOffset","rangePadding","roundingPlaces","valueType","zoomFactor","zoomPosition","orientation","crossesAt","crossesInAxis","scrollbarSettings.visible","scrollbarSettings.canResize","scrollbarSettings.range.min","scrollbarSettings.range.max","scrollbarSettings.pointsLength","range.min","range.max","range.interval","tickLinesPosition","alternateGridBand.odd.fill","alternateGridBand.odd.opacity","alternateGridBand.even.fill","alternateGridBand.even.opacity","enableAutoIntervalOnZooming","majorGridLines.width","majorGridLines.dashArray","majorGridLines.visible","majorGridLines.opacity","majorTickLines.width","majorTickLines.size","majorTickLines.visible","minorGridLines.width","minorGridLines.dashArray","minorGridLines.visible","minorTickLines.width","minorTickLines.size","minorTickLines.visible","labelBorder.width","minorTicksPerInterval","columnSpan","crosshairLabel.visible","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","isInversed","enableTrim","maximumLabelWidth","axisLine.visible","axisLine.width","axisLine.dashArray","axisLine.offset","maximumLabels","title.text","title.visible","title.enableTrim","title.offset","title.alignment","title.position","title.maximumTitleWidth","title.font.size","title.font.opacity","title.font.fontFamily","title.font.fontStyle","title.font.fontWeight","additionalPadding","showNextToAxisLine",[{tag:"stripLine",attr:["borderColor","startFromAxis","zIndex","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color"],singular:"stripLine"}],[{tag:"multiLevelLabels",attr:["textOverflow","maximumTextWidth","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","border.type","border.width"],singular:"multiLevelLabel"}],],singular:"axis"},{tag:"primaryXAxis.stripLine",attr:["borderColor","startFromAxis","zIndex","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color"],singular:"primaryXAxis.stripLine"},{tag:"primaryYAxis.stripLine",attr:["borderColor","startFromAxis","zIndex","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color"],singular:"primaryYAxis.stripLine"},{tag:"primaryXAxis.multiLevelLabels",attr:["textOverflow","maximumTextWidth","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","border.type","border.width"],singular:"primaryXAxis.multiLevelLabel"},{tag:"primaryYAxis.multiLevelLabels",attr:["textOverflow","maximumTextWidth","textAlignment","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","border.type","border.width"],singular:"primaryYAxis.multiLevelLabel"},{tag:"indicators",attr:["seriesName","xName","xAxisName","macdType","shortPeriod","longPeriod","enableAnimation","yAxisName","standardDeviations","kPeriod","dPeriod","periodLine.fill","periodLine.width","lowerLine.fill","lowerLine.width","upperLine.fill","upperLine.width","macdLine.fill","macdLine.width","histogram.fill","histogram.opacity","histogram.border.color","histogram.border.width","font.size","font.opacity","font.fontFamily","font.fontStyle","font.fontWeight","font.color","tooltip.visible","tooltip.format","tooltip.fill","tooltip.border.width","tooltip.border.color","tooltip.enableAnimation","tooltip.duration","tooltip.opacity",[{tag:"points",attr:[]}]],singular:"indicator"},{tag:"annotations",attr:["coordinateUnit","verticalAlignment","horizontalAlignment","xAxisName","yAxisName","margin.left","margin.right","margin.top","margin.bottom"],singular:"annotation"},{tag:"rowDefinitions",attr:["rowHeight","lineColor","lineWidth"],singular:"rowDefinition"},{tag:"columnDefinitions",attr:["columnWidth","lineColor","lineWidth"],singular:"columnDefinition"},],_xZoomFactor:t.util.valueFunction("xZoomFactor"),_yZoomFactor:t.util.valueFunction("yZoomFactor"),_xZoomPosition:t.util.valueFunction("xZoomPosition"),_yZoomPosition:t.util.valueFunction("yZoomPosition"),_init:function(){this._renderSfChart()},_destroy:function(){n("#template_group_"+this._id).remove();n("#annotation_group_"+this._id).remove();n(this.element).removeClass("e-chart e-js").find("#"+this.svgObject.id).remove();n(this.element).removeClass("e-chart e-js").find("#legend_"+this.svgObject.id).remove()},_series:function(){this.redraw();this._trigger("refresh")},_series_points:function(){this.redraw();this._trigger("refresh")},_primaryXAxis_stripLine:function(){this.redraw();this._trigger("refresh")},_primaryYAxis_stripLine:function(){this.redraw();this._trigger("refresh")},_axes:function(){this.redraw();this._trigger("refresh")},_axes_stripLine:function(){this.redraw();this._trigger("refresh")},_ignoreOnExport:["dataSource"],_removeZoomkit:function(){this.model.zooming.enable&&(n("[id^="+this._id+"_][id$=_ResetZoom]").remove(),n("[id^="+this._id+"_][id$=_PanBtn]").remove(),n("[id^="+this._id+"_][id$=_ZoomBtn]").remove(),n("[id^="+this._id+"_][id$=_ZoomInBtn]").remove(),n("[id^="+this._id+"_][id$=_ZoomOutBtn]").remove())},getCanvasElement:function(t){var f,o=n("#"+t),i=document.createElement("canvas"),e=i.getContext("2d"),r=n("#"+t+"_canvas").width(),u=n("#"+t+"_canvas").height();return i.setAttribute("width",r),i.setAttribute("height",u),f=n("#"+t+"_canvas")[0],e.drawImage(f,0,0,r,u),{canvasContainer:i,canvasArea:e,width:r,height:u}},getSVGElement:function(t){var r=n("#"+t+"_svg").width(),u=n("#"+t+"_svg").height(),f=document.getElementById(t+"_svg"),e=n("<div>").append(n(f).clone()).html(),o=document.getElementById("legend_"+t+"_svg"),i=n("#legend_"+t).position(),h=n("#"+t+"_svg_Legend").attr("transform","translate("+i.left+","+i.top+")"),s=n("<div>").append(n(o).clone()).html();return{chartSVG:e,legendChartSVG:s,width:r,height:u}},print:function(){for(var v,tt,u,t,it,at,r,s,et,k,rt,f,i,ot,e,o,c,l,a,y,p,d=[],g=[],w,b,vt,st=this.model.series.length,ut,ht="",h="",lt=0,nt=0;nt<arguments.length;nt++)if(c=n("#"+arguments[nt]),i=arguments[nt],c.hasClass("e-datavisualization-chart")){o=c.ejChart("instance");f="<html> <div style='position:relative; left:0px; top:"+lt+"px'>";ut="";ot=o.svgObject.id;lt=n("#"+ot).height()+50;n("#axisScrollbar_"+i)[0]&&(ut=n("#axisScrollbar_"+i)[0].innerHTML);var yt=["ResetZoom","PanBtn","ZoomBtn","ZoomOutBtn","ZoomInBtn"],ct=[],ft;for(r=0;r<5;r++)ft="#"+ot+"_"+yt[r],n(ft)[0]&&(ct.push(n(ft)),n(ft).remove());if(o.model.enableCanvasRendering==!0){for(e=this.getCanvasElement(i),vt=o.model.LegendBounds,h=document.createElement("img"),h.setAttribute("src",n("#legend_"+i+"_canvas")[0].toDataURL()),n("#legend_Scroller"+i).prepend(h),f+=document.getElementById("chartContainer_"+i).outerHTML,n(h).remove(),h="",t=0;t<st;t++)if(tt=o.model.series[t].selectionSettings.mode.toLowerCase(),o.model.AreaType!="none")if(tt=="series")n(c).find("#"+i+"_Selection_series"+t+"_canvas").length>0&&(l=n("#"+i+"_Selection_series"+t+"_canvas")[0],e.canvasArea.drawImage(l,0,0,e.width,e.height)),n(c).find("#"+i+"_Selection_Legend"+t+"_canvas").length>0&&(a=n("#"+i+"_Selection_Legend"+t+"_canvas")[0],h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>");else if(tt=="point"){for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n(c).find("#"+i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas").length>0&&(l=n("#"+i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas")[0],e.canvasArea.drawImage(l,0,0,e.width,e.height));n(c).find("#"+i+"_Selection_Legend"+t+"_canvas").length>0&&(a=n("#"+i+"_Selection_Legend"+t+"_canvas")[0],h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>")}else{for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n(c).find("#"+i+"_Selection_Cluster_point_"+u[r].pointIndex+"_canvas").length>0&&(l=n("#"+i+"_Selection_Cluster_point_"+u[r].pointIndex+"_canvas")[0],e.canvasArea.drawImage(l,0,0,e.width,e.height));n(c).find("#"+i+"_SelectionCluster_Legend"+t+"_canvas").length>0&&(a=n("#"+i+"_SelectionCluster_Legend"+t+"_canvas")[0],h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>")}else for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n("#"+i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas").length>0&&(l=document.getElementById(i+"_Selection_series"+t+"_point_"+u[r].pointIndex+"_canvas"),e.canvasArea.drawImage(l,0,0,e.width,e.height),n("#"+i+"_Selection_Legend"+u[r].pointIndex+"_canvas").length>0&&(a=document.getElementById(i+"_Selection_Legend"+u[r].pointIndex+"_canvas"),h="<img style='position:absolute;left:0px;' src='"+a.toDataURL()+"'/>"));e.canvasArea.save();d.push(e.canvasContainer)}else{if(v=this.getSVGElement(i),n("#"+i+"_svg_Legend").removeAttr("transform"),f+=n("#chartContainer_"+i)[0].outerHTML,o.model.enable3D){for(ht="",t=0;t<st;t++)n("#Selectionseries"+t+"Segmentseries"+t).length>0&&(ht+=n("#Selectionseries"+t+"Segmentseries"+t)[0].outerHTML);f+=ht}else for(t=0;t<st;t++)if(tt=o.model.series[t].selectionSettings.mode.toLowerCase(),o.model.AreaType!="none")tt!="cluster"?n("#"+i+"SelectionSegmentseries"+t).length>0&&(y=document.getElementById(i+"SelectionSegmentseries"+t),w=n("<div>").append(n(y).clone()).html(),p=document.getElementById(i+"SelectionLegendSegmentseries"+t),b=n("<div>").append(n(p).clone()).html(),f+=w.toString()+b.toString()):n("#"+i+"SelectionSegmentClusterSeries"+t).length>0&&(y=document.getElementById(i+"SelectionSegmentClusterSeries"+t),w=n("<div>").append(n(y).clone()).html(),p=document.getElementById(i+"SelectionLegendSegmentClusterSeries"+t),b=n("<div>").append(n(p).clone()).html(),f+=w.toString()+b.toString());else for(u=o.model.selectedDataPointIndexes,r=0;r<u.length;r++)u[r].seriesIndex==t&&n("#"+i+"SelectionSegmentseries"+t+"Point"+u[r].pointIndex).length>0&&(y=document.getElementById(i+"SelectionSegmentseries"+t+"Point"+u[r].pointIndex),w=n("<div>").append(n(y).clone()).html(),p=document.getElementById(i+"SelectionLegendSegmentseries"+t+"Point"+u[r].pointIndex),b=n("<div>").append(n(p).clone()).html(),f+=w.toString()+b.toString());o.model.backGroundImageUrl!=null&&(k=new Image,k.src=o.model.backGroundImageUrl,it=document.createElement("canvas"),at=it.getContext("2d"),it.setAttribute("width",v.width),it.setAttribute("height",v.height),at.drawImage(k,0,0,v.width,v.height),f+="<img src='"+it.toDataURL()+"'/>");f+='<svg xmlns="http://www.w3.org/2000/svg" style="left:0px; top:0px; position:absolute;" width="'+v.width+'" height="'+v.height+'" >';f+=v.chartSVG.toString()+" <\/svg>";f+=ut+"<\/div><\/html>";g.push(f)}for(r=0;r<ct.length;r++)n("#chartContainer_"+i).append(ct[r])}else f="<html>",f+=document.getElementById(arguments[nt]).innerHTML,f+="<\/html>",g.push(f);for(s=window.open(),et=0;et<g.length;et++)s.document.write(g[et]);if(d.length>0){for(k=new Image,rt=0;rt<d.length;rt++)f+="<img src='"+d[rt].toDataURL()+"'/>",k.src=d[rt].toDataURL();f+=h;f+=ut+"<\/div><\/html>";k.onload=function(){s.document.write(f);f="";s.document.close();s.focus();s.print();s.close()}}else g.length>0&&(f="",s.document.close(),s.focus(),s.print(),s.close())},redraw:function(i,r,u,f){var o,s,e;if(this.model.enableCanvasRendering)this.model.zooming.enable&&this.svgRenderer.ctx?this.svgRenderer.ctx.clearRect(0,0,n("#"+this._id).width(),n("#"+this._id).height()):(n(this.svgObject).remove(),o=this.svgWidth,n("#canvas_trackSymbol").remove(),n("#"+this._id+"_canvas_Tracker").remove(),n("#secondCanvas").remove(),this.svgRenderer=new t.EjCanvasRender(this.element),this.svgRenderer.svgObj.height=t.util.isNullOrUndefined(this.model.size.height)?"450":this.model.size.height,this.svgRenderer.svgObj.width=t.util.isNullOrUndefined(this.model.size.width)?o:this.model.size.width,this.svgObject=this.svgRenderer.svgObj,s=this.svgRenderer.svgObj.getContext("2d"),n(this.scrollerContainer).remove(),n(this.legendSvgContainer).remove(),n(this.legendContainer).remove(),this.legendContainer=n("<div><\/div>").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=n("<div><\/div>").attr("id","legend_Scroller"+this._id).css("height","0px"),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),n(this.scrollerContainer).appendTo(this.legendContainer),n(this.legendContainer).appendTo(this.chartContainer));else if(this.svgObject.id.indexOf("_canvas")!=-1)this._removeZoomkit(),n(this.svgObject).remove(),this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this.canvasX=this.canvasY=0,n(this.scrollerContainer).remove(),n(this.legendSvgContainer).remove(),n(this.legendContainer).remove(),this.legendContainer=n("<div><\/div>").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=n("<div><\/div>").attr("id","legend_Scroller"+this._id).css("height","0px"),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),n(this.scrollerContainer).appendTo(this.legendContainer),n(this.legendContainer).appendTo(this.chartContainer);else if(!this.dragPoint||!r&&(!this.panning||!u||this.scrollbarUpdate||f||this.panning&&this.model.browserInfo.name!="chrome")||this.model.enable3D)n(this.svgObject).empty(),n(this.legendSvgContainer).empty();else{for(e=this.svgObject,this.chartUpdating=!0,!this.continuePinching&&u&&(u.id="",u.setAttribute("opacity",0),e.appendChild(u),this.continuePinching=!1);e.childNodes.length>1;)e.removeChild(e.firstChild);n(this.legendSvgContainer).empty()}n("#annotation_group_"+this._id).remove();i||(this.model.canResize||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents());this.bindTo(i)},"export":function(n,i,r){var u,f=this.model.exportSettings,n=t.util.isNullOrUndefined(n)?f.type:n.toLowerCase(),i=t.util.isNullOrUndefined(i)?f.action:i.toLowerCase();return n=="xlsx"?this.excelExport(n,i,r):u=n!="svg"&&this.model.enableCanvasRendering?this.imageExport():this.svgExport(),u},excelExport:function(i,r,u){var o=n.extend(!0,{},this.model),a=this.model.exportSettings,u=t.util.isNullOrUndefined(i)?a.multipleExport:u,v={action:r,method:"post"},s=t.buildTag("form","",null,v),f,y=this,e,h,c,l;if(o.event=null,this._ignoreOnExport)for(f=o.series,e=0;e<f.length;e++)delete f[e].dataSource,delete f[e].query,f[e].fill=jQuery.type(f[e].fill)=="array"?f[e].fill[0].color:f[e].fill;return t.raiseWebFormsServerEvents?(this.raiseWebServerEvents(JSON.stringify(o),"excelExporting"),this.raiseWebServerEvents(JSON.stringify(o))):(u?(h={},n("body").find(".e-datavisualization-chart").each(function(i,r){var o=n(r).data("ejChart"),e,u,c,l;if(!t.isNullOrUndefined(o)&&(o.model.event=null,e=JSON.parse(JSON.stringify(o.model)),y._ignoreOnExport)){for(f=e.series,u=0;u<f.length;u++)delete f[u].dataSource,delete f[u].query,f[u].fill=jQuery.type(f[u].fill)=="array"?f[u].fill[0].color:f[u].fill;h[i]=JSON.stringify(e);c={name:"ChartModel",type:"hidden",value:JSON.stringify(e)};l=t.buildTag("input","",null,c);s.append(l)}})):(c={name:"ChartModel",type:"hidden",value:JSON.stringify(o)},l=t.buildTag("input","",null,c),s.append(l),s.append(this)),n("body").append(s),s.submit()),!0},imageExport:function(){var b=n.extend(!0,{},this.model),k,a,d,g,nt,tt;b.event=null;var s=this._id,v=n("[id*="+s+"_Selection_]"),y=n("#legend_"+s+"_canvas")[0],h=this.model.exportSettings,e=h.angle,u,i,o,f,p,r=this.model.LegendBounds,it,c,w,l=this.getCanvasElement(s);for(u=l.canvasContainer,i=l.canvasArea,o=l.width,f=l.height,p=n("#"+s+"_canvas")[0],u.setAttribute("id","Export_"+s),e==0?(r=this.model.LegendBounds,r.X&&r.Width!=0&&r.Height!=0&&i.drawImage(y,r.X,r.Y)):e==90||e==-90?(u.setAttribute("width",f),u.setAttribute("height",o),i.save(),i.translate(f/2,o/2),i.rotate(e*Math.PI/180),i.drawImage(p,-o/2,-f/2),i.restore(),r.X&&(i.save(),e==90?i.translate(f-r.Y-r.Height/2,o-r.X-r.Width/2):i.translate(r.Y+r.Height/2,r.X+r.Width/2),i.rotate(e*Math.PI/180),i.drawImage(y,-r.Width/2,-r.Height/2),i.restore())):(u.setAttribute("width",o),u.setAttribute("height",f),i.save(),i.translate(o,f),i.rotate(Math.PI/1),i.drawImage(p,0,0),i.restore(),r.X&&(i.save(),i.translate(r.X+r.Width/2,f-r.Y-r.Height/2),i.rotate(e*Math.PI/180),i.drawImage(y,-r.Width/2,-r.Height/2),i.restore())),c=0;c<v.length;c++)it=document.getElementById(v[c].id).getBoundingClientRect(),i.drawImage(v[c],0,0);if(w=h.type=="jpg"?u.toDataURL("image/jpeg"):u.toDataURL(),h.mode=="client")return u;t.raiseWebFormsServerEvents?this.raiseWebServerEvents(w):h.mode=="server"&&(k={action:h.action,method:"post"},a=t.buildTag("form","",null,k),d={name:"ChartModel",type:"hidden",value:JSON.stringify(b)},g=t.buildTag("input","",null,d),nt={name:"Data",type:"hidden",value:w},tt=t.buildTag("input","",null,nt),a.append(g).append(tt).append(this),n("body").append(a),a.submit())},svgExport:function(){var p=this.svgObject.id,h=n.extend(!0,{},this.model),a,o,v,y;h.event=null;var w=this._id,r=this.getSVGElement(w),u=this.model.exportSettings,s=u.angle,c=r.height,f=r.chartSVG,e=r.legendChartSVG,l=r.width,i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">';if(i=s==0?i+f.toString()+e.toString()+"<\/svg>":s==90?i+'<g transform="translate('+c+',0) rotate(90 0 0)">'+f.toString()+e.toString()+"<\/g><\/svg>":s==-90?i+'<g transform="translate(0,'+l+') rotate(-90 0 0)">'+f.toString()+e.toString()+"<\/g><\/svg>":i+'<g transform="translate('+l+","+c+') rotate(180 0 0)">'+f.toString()+e.toString()+"<\/g><\/svg>",i=encodeURIComponent(i),n("#"+p+"_Legend").removeAttr("transform"),u.mode=="client")return i;t.raiseWebFormsServerEvents?this.raiseWebServerEvents(i):u.mode=="server"&&(a={action:u.action,method:"post"},o=t.buildTag("form","",null,a),chartModel={name:"ChartModel",type:"hidden",value:JSON.stringify(h)},input1=t.buildTag("input","",null,chartModel),v={name:"Data",type:"hidden",value:i},y=t.buildTag("input","",null,v),o.append(y).append(input1).append(this),n("body").append(o),o.submit())},raiseWebServerEvents:function(i,r){var f=n.extend(!0,{},this.model),u=this.model.exportSettings,r=t.util.isNullOrUndefined(r)?"exporting":r;args={model:f,originalEventType:r};clientArgs={Data:i,Format:u.type,Orientation:u.orientation,FileName:u.fileName};t.raiseWebFormsServerEvents(r,args,clientArgs)},animate:function(n){var i,u,r,t;if(n)if(n.constructor===Array)for(t=0;t<n.length;t++)n[t]._animatedSeries=!1,n[t]._animatedTrendline=!1,n[t].AnimationComplete=!1;else n._animatedSeries=!1,n._animatedTrendline=!1,n.AnimationComplete=!1;else{for(i=this.model.series,t=0;t<i.length;t++)i[t]._animatedSeries=!1,i[t]._animatedTrendline=!1,i[t].AnimationComplete=!1;for(u=this.model.indicators,r=0;r<u.length;r++)u[r]._animatedSeries=!1,u[r]._animatedTrendline=!1}this.redraw()},_setModel:function(i){var e,f,u,o,s,r,h;for(u in i){this.disableAnimation();switch(u){case"theme":for(this.model._themeChanged=!0,this.model.theme=i[u],this.setTheme(t.EjSvgRender.themes,this.model.theme),n.extend(!0,this.model.primaryXAxis,t.EjSvgRender.themes[this.model.theme].primaryXAxis),n.extend(!0,this.model.primaryYAxis,t.EjSvgRender.themes[this.model.theme].primaryYAxis),o=0;o<this.model.axes.length;o++)this.model.axes[o].orientation&&this.model.axes[o].orientation.toLowerCase()=="horizontal"?n.extend(!0,this.model.axes[o],t.EjSvgRender.themes[this.model.theme].secondaryX):n.extend(!0,this.model.axes[o],t.EjSvgRender.themes[this.model.theme].secondaryY);for(s=0;s<this.model.series.length;s++)n.extend(!0,this.model.series[s],t.EjSvgRender.themes[this.model.theme].commonSeriesOptions);break;case"commonSeriesOptions":for(r=0;r<this.model.series.length;r++)i[u].dataSource&&(this.model.series[r].dataSource=null),n.extend(!0,this.model.series[r],{},i[u]);break;case"series":for(e=this.model.series,r=0;r<e.length;r++)i[u][r].dataSource&&(e[r].dataSource=null);for(n.extend(!0,e,{},i[u]),r=0,h=e.length;r<h;r++)e[r].enableAnimation&&(e[r]._animatedSeries=!1),i[u][r]&&i[u][r].dataSource instanceof t.DataManager&&(e[r].dataSource=i[u][r].dataSource),i[u][r]&&i[u][r].query instanceof t.Query&&(e[r].query=i[u][r].query);break;case"legend":n.extend(!0,this.model.legend,{},i[u]);break;case"axes":n.extend(!0,this.model.axes,{},i[u]);break;case"primaryXAxis":this.model.primaryXAxis.setRange=i[u].range?!0:!1;this.model.primaryXAxis.setAxisInterval=i[u].range&&i[u].range.interval?!0:this.model.primaryXAxis.setAxisInterval;this.model.primaryXAxis.actual_Range=this.model._axes[0].setRange?null:this.model._axes[0].actual_Range;n.extend(!0,this.model.primaryXAxis,{},i[u]);break;case"primaryYAxis":this.model.primaryYAxis.setRange=i[u].range?!0:!1;this.model.primaryYAxis.log_Range=i[u].range?i[u].range:this.model.primaryYAxis.log_Range;this.model.primaryYAxis.actual_Range=this.model._axes[1].setRange?null:this.model._axes[1].actual_Range;n.extend(!0,this.model.primaryYAxis,{},i[u]);break;case"xZoomFactor":for(this.model.primaryXAxis.zoomFactor=this._xZoomFactor(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="horizontal"&&(f[r].zoomFactor=this._xZoomFactor());break;case"yZoomFactor":for(this.model.primaryYAxis.zoomFactor=this._yZoomFactor(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="vertical"&&(f[r].zoomFactor=this._yZoomFactor());break;case"xZoomPosition":for(this.model.primaryXAxis.zoomPosition=this._xZoomPosition(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="horizontal"&&(f[r].zoomPosition=this._xZoomPosition());break;case"yZoomPosition":for(this.model.primaryYAxis.zoomPosition=this._yZoomPosition(),f=this.model.axes,r=0;r<f.length;r++)f[r].orientation.toLowerCase()=="vertical"&&(f[r].zoomPosition=this._yZoomPosition());break;case"drilldown":this.model.series=[];this.model.explodeValue=null;n.extend(!0,this.model,{},i[u]);break;case"datasource":for(r=0;r<this.model.series.length;r++)this.model.series[r].dataSource=null,this.model.series[r].points=null;n.extend(!0,this.model,{},i[u]);break;case"chartArea":n.extend(!0,this.model.chartArea,{},i[u]);break;default:for(n.extend(!0,this.model,{},i[u]),e=this.model.series,r=0,h=e.length;r<h;r++)e[r].enableAnimation&&(e[r]._animatedSeries=!1)}}this.model.canResize||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents();n("#annotation_group_"+this._id).remove();this.model.enableCanvasRendering?(n(this.svgObject).remove(),n("#canvas_trackSymbol").remove(),n("#"+this._id+"_canvas_Tracker").remove(),n("#secondCanvas").remove(),this.svgRenderer=new t.EjCanvasRender(this.element),this.svgRenderer.svgObj.height=t.util.isNullOrUndefined(this.model.size.height)?"450":this.model.size.height,this.svgRenderer.svgObj.width=t.util.isNullOrUndefined(this.model.size.width)?n("#"+this._id).width():this.model.size.width,this.svgObject=this.svgRenderer.svgObj,n(this.legendSvgContainer).remove(),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element),this.svgRenderer.append(this.legendSvgContainer,this.legendContainer)):this.svgObject.id.indexOf("_canvas")!=-1?(this._removeZoomkit(),n(this.svgObject).remove(),this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this.canvasX=this.canvasY=0,n(this.legendSvgContainer).remove(),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.svgRenderer.append(this.legendSvgContainer,this.legendContainer)):this.chartUpdating||(n(this.svgObject).empty(),n(this.legendSvgContainer).empty());this.bindTo()}});t.datavisualization.Chart.Locale=t.datavisualization.Chart.Locale||{};t.datavisualization.Chart.Locale["default"]=t.datavisualization.Chart.Locale["en-US"]={zoomIn:"Zoom In",zoomOut:"Zoom Out",zoom:"Zoom",pan:"Pan",reset:"Reset"};t.datavisualization.Chart.CrosshairType={Crosshair:"crosshair",TrackBall:"trackBall"};t.datavisualization.Chart.TrackballDisplayMode={Float:"float",Grouping:"grouping"};t.datavisualization.Chart.VisibleOnLegend={Visible:"visible",Hidden:"hidden"};t.datavisualization.Chart.ExportingType={PNG:"png",JPG:"jpg",PDF:"pdf",SVG:"svg",DOCX:"docx",XLSX:"xlsx"};t.datavisualization.Chart.ExportingMode={Client:"client",Server:"server"};t.datavisualization.Chart.ExportingOrientation={Portrait:"portrait",Landscape:"landscape"};t.datavisualization.Chart.ValueType={Double:"double",DateTime:"datetime",Category:"category",Logarithmic:"logarithmic",DateTimeCategory:"datetimecategory"};t.datavisualization.Chart.TextOverflow={None:"none",Wrap:"wrap",Trim:"trim",WrapAndTrim:"wrapandtrim"};t.datavisualization.Chart.Type={Line:"line",Spline:"spline",Column:"column",Doughnut:"doughnut",Area:"area",SplineArea:"splinearea",StepLine:"stepline",StepArea:"steparea",Pie:"pie",PieOfPie:"pieofpie",Hilo:"hilo",HiloOpenClose:"hiloopenclose",Candle:"candle",Bubble:"bubble",Scatter:"scatter",Bar:"bar",StackingArea:"stackingarea",StackingArea100:"stackingarea100",RangeColumn:"rangecolumn",StackingColumn:"stackingcolumn",StackingColumn100:"stackingcolumn100",StackingBar:"stackingbar",StackingBar100:"stackingbar100",Pyramid:"pyramid",Funnel:"funnel",Polar:"polar",Radar:"radar",RangeArea:"rangearea",Waterfall:"waterfall",BoxAndWhishker:"boxandwhisker"};t.datavisualization.Chart.SplitMode={Position:"position",Value:"value",Percentage:"percentage",Indexes:"indexes"};t.datavisualization.Chart.DragType={XY:"xy",X:"x",Y:"y"};t.datavisualization.Chart.LabelPlacement={BetweenTicks:"betweenTicks",OnTicks:"onTicks"};t.datavisualization.Chart.TrendlinesType={Linear:"linear",Exponential:"exponential",Logarithmic:"logarithmic",Power:"power",Polynomial:"polynomial"};t.datavisualization.Chart.ErrorBarType={FixedValue:"fixedValue",Percentage:"percentage",StandardDeviation:"standardDeviation",StandardError:"standardError",Custom:"custom"};t.datavisualization.Chart.ErrorBarMode={Both:"both",Vertical:"vertical",Horizontal:"horizontal"};t.datavisualization.Chart.ErrorBarDirection={Both:"both",Plus:"plus",Minus:"minus"};t.datavisualization.Chart.LabelIntersectAction={None:"none",Rotate90:"rotate90",Rotate45:"rotate45",Wrap:"wrap",WrapByword:"wrapByWord",Trim:"trim",Hide:"hide",MultipleRows:"multipleRows"};t.datavisualization.Chart.EdgeLabelPlacement={None:"none",Shift:"shift",Hide:"hide"};t.datavisualization.Chart.roundedCorner={Both:"both",Start:"start",End:"end"};t.datavisualization.Chart.Theme={Azure:"azure",FlatLight:"flatlight",Azuredark:"azuredark",Lime:"lime",LimeDark:"limedark",Saffron:"saffron",SaffronDark:"saffrondark",GradientLight:"gradientlight",GradientDark:"gradientdark",HighContrast01:"highcontrast01",HighContrast02:"highcontrast02",Material:"material",Office365:"office365",Bootstrap:"bootstrap"};t.datavisualization.Chart.FontStyle={Normal:"normal",Italic:"italic"};t.datavisualization.Chart.FontWeight={Regular:"regular",Bold:"bold",Lighter:"lighter"};t.datavisualization.Chart.IntervalType={Auto:"auto",Days:"days",Hours:"hours",Seconds:"seconds",Milliseconds:"milliseconds",Minutes:"minutes",Months:"months",Years:"years"};t.datavisualization.Chart.RangePadding={Additional:"additional",Normal:"normal",None:"none",Round:"round",Auto:"auto"};t.datavisualization.Chart.TextAlignment={MiddleTop:"middletop",MiddleCenter:"middlecenter",MiddleBottom:"middlebottom"};t.datavisualization.Chart.LabelPosition={Inside:"inside",Outside:"outside"};t.datavisualization.Chart.ZIndex={Over:"over",Behind:"behind"};t.datavisualization.Chart.Unit={percentage:"percentage",pixel:"pixel"};t.datavisualization.Chart.PyramidMode={Linear:"linear",Surface:"Surface"};t.datavisualization.Chart.DrawType={Line:"line",Column:"column",Area:"area"};t.datavisualization.Chart.columnFacet={Rectangle:"rectangle",Cylinder:"cylinder"};t.datavisualization.Chart.EmptyPointMode={Gap:"gap",Zero:"zero",Average:"average"};t.datavisualization.Chart.Pattern={None:"none",Chessboard:"chessboard",Crosshatch:"crosshatch",Dots:"dots",Pacman:"pacman",DiagonalBackward:"diagonalBackward",DiagonalForward:"diagonalForward",Grid:"grid",Turquoise:"turquoise",Star:"star",Triangle:"triangle",Circle:"circle",Tile:"tile",HorizontalDash:"horizontalDash",VerticalDash:"verticalDash",Rectangle:"rectangle",Box:"box",VerticalStripe:"verticalStripe",HorizontalStripe:"horizontalStripe",Bubble:"bubble",Custom:"custom"};t.datavisualization.Chart.Mode={Series:"series",Point:"point",Cluster:"cluster",Range:"range"};t.datavisualization.Chart.SelectionType={Single:"single",Multiple:"multiple"};t.datavisualization.Chart.Shape={None:"none",LeftArrow:"leftarrow",RightArrow:"rightarrow",Circle:"circle",Cross:"cross",HorizLine:"horizline",VertLine:"vertLine",Diamond:"diamond",Rectangle:"rectangle",Triangle:"triangle",InvertedTriangle:"invertedtriangle",Hexagon:"hexagon",Pentagon:"pentagon",Star:"star",Ellipse:"ellipse",Wedge:"wedge",Trapezoid:"trapezoid",UpArrow:"uparrow",DownArrow:"downarrow",Image:"image"};t.datavisualization.Chart.DrawMode={Both:"both",Open:"open",Close:"close"};t.datavisualization.Chart.LineCap={Butt:"butt",Round:"round",Square:"square"};t.datavisualization.Chart.LineJoin={Round:"round",Bevel:"bevel",Miter:"miter"};t.datavisualization.Chart.Position={Top:"top",Middle:"middle",Bottom:"bottom"};t.datavisualization.Chart.Alignment={Center:"center",Near:"near",Far:"far"};t.datavisualization.Chart.TickLinesPosition={Inside:"inside",Outside:"outside"};t.datavisualization.Chart.CoordinateUnit={None:"none",Pixels:"pixels",Points:"points"};t.datavisualization.Chart.HorizontalAlignment={Left:"left",Right:"right",Middle:"middle"};t.datavisualization.Chart.VerticalAlignment={Top:"top",Bottom:"bottom",Middle:"middle"};t.datavisualization.Chart.Region={Chart:"chart",Series:"series"};t.datavisualization.Chart.ConnectorLineType={Line:"line",Bezier:"bezier"};t.datavisualization.Chart.HorizontalTextAlignment={Near:"near",Far:"far",Center:"center"};t.datavisualization.Chart.VerticalTextAlignment={Near:"near",Far:"far",Center:"center"};t.datavisualization.Chart.multiLevelLabelsBorderType={None:"none",Rectangle:"rectangle",WithoutTopAndBottom:"withouttopandbottom",Brace:"brace",CurlyBrace:"curlybrace"};t.datavisualization.Chart.MACDType={Line:"line",Histogram:"histogram",Both:"both"};t.datavisualization.Chart.IndicatorsType={RSI:"rsi",Momentum:"momentum",Bollingerband:"bollingerband",Accumulationdistribution:"accumulationdistribution",EMA:"ema",SMA:"sma",Stochastic:"stochastic",ATR:"atr",MACD:"macd",TMA:"tma"};t.datavisualization.Chart.BoxPlotMode={Normal:"normal",Exclusive:"exclusive",Inclusive:"inclusive"};t.datavisualization.Chart.BubbleRadiusMode={MinMax:"minmax",Auto:"auto"};n.extend(t.datavisualization.Chart.prototype,t.ejChart)}(jQuery,Syncfusion);ej.EjSvgScrollbarRender=function(n,t){var i,r;this.svgSupport=window.SVGSVGElement?!0:!1;i=jQuery(n).attr("id");this.scrollsvgObj=this.scrollsvgObj?this.scrollsvgObj:[];this.svgSupport?(this.svgLink="http://www.w3.org/2000/svg",this.scrollsvgObj[t.index]=document.createElementNS(this.svgLink,"svg"),this.scrollsvgObj[t.index].setAttribute("id","scrollbar_"+i+t.index)):(r=document,this.scrollsvgObj[t.index]=r.createElement("div"),this.scrollsvgObj[t.index].style.position="relative",this.scrollsvgObj[t.index].setAttribute("id","scrollbar_"+i+t.index))},function(n){ej.EjSvgScrollbarRender.prototype={_initializeScrollbarVariables:function(n){n.offsetLeftX=0;n.rectWidth=n.offsetRightX=n.oldWidth=n.width;n.startX=0;n.endX=0;n.scrollbarLoaded=!1;(n.zoomPosition||n.zoomFactor)&&(n.offsetLeftX=n.zoomPosition*n.width,n.rectWidth=n.zoomFactor*n.width)},_scrollbarUpdate:function(n){var o=parseFloat(n.width),t=15,u=44,e=o-30,r,i,f;n.offsetLeftX=n.scrollbarLoaded?n.offsetLeftX-t:n.offsetLeftX;n.offsetLeftX=n.offsetLeftX<t?0:n.offsetLeftX;r=n.offsetLeftX/n.oldWidth*e+t;i=n.rectWidth/n.oldWidth*e;isMinWidth=i<u;n._diff=isMinWidth?u-i:0;i=i>u?i:u;n.oldWidth=e;f=r+i;n.rectWidth=i;n.offsetLeftX=n.startX=r;n.offsetRightX=f-t<=r?f+t:f;n.endX=n.width-n.offsetRightX;n.startX=r<t?t:r;r+i>n.width-t&&(n.offsetLeftX=n.startX=n.width-t-i,n.offsetRightX=n.width-t,n.endX=n.width-n.offsetRightX);n.scrollbarLoaded=!0},_renderScrollbar:function(t){var u,r,o,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,v;this.scrollsvgObj=this.scrollsvgObj?this.scrollsvgObj:[];n(this.scrollsvgObj[t.index]).empty();this.scrollsvgObj[t.index]&&n(document).find("[id*= "+this.scrollsvgObj[t.index].id+"]").attr("height","0px");var i=this._id,e=15,s=18,c=44;this.scrollsvgObj[t.index]=this.scrollbarContainer.scrollsvgObj[t.index];var l=17,f=parseFloat(t.width),y=8,p=l/2,h=f-e*2;t.offsetLeftX=t.scrollbarLoaded?t.offsetLeftX-e:t.offsetLeftX;t.offsetLeftX=t.offsetLeftX<e?0:t.offsetLeftX;u=t.offsetLeftX/t.oldWidth*h+e;r=t.rectWidth/t.oldWidth*h;isMinWidth=r<c;t._diff=isMinWidth?c-r:0;r=r>c?r:c;t.oldWidth=h;u=u+r>h?h-(r-e):u;o=u+r;t.rectWidth=r;t.offsetLeftX=t.startX=u;t.offsetRightX=u+r;t.endX=t.width-t.offsetRightX;t.scrollbarLoaded=!0;o=o-e<=u?o+e:o;w=this.padding||0;b=this.vmlRendering?-5:0;this.scrollbar=t.orientation=="horizontal"?this.renderer.createGroup({id:i+"_scrollbar_"+t.index,transform:"translate("+w+","+b+")"}):this.renderer.createGroup({id:i+"_scrollbar_"+t.index,transform:"translate(0,"+t.width+") rotate(270)"});var ot=function(n,t,i,r,u,f){var e=" ",c="M",h="h",o="v",s="a",l="z",a=f.orientation,v=f.opposed;return a=="vertical"&&!v||v&&a!="vertical"?c+e+n+e+u+e+o+e+(r-u)+e+h+e+i+e+o+e+(u-r)+e+s+e+u+e+u+e+0+e+0+e+0+e+-u+e+-u+e+h+e+-(i-2*u)+e+s+e+u+e+u+e+0+e+0+e+0+e+-4+e+u+e+l:c+e+n+e+t+e+o+e+(r-u)+e+s+e+u+e+u+e+0+e+0+e+0+e+u+e+u+e+h+e+(i-2*u)+e+s+e+u+e+u+e+0+e+0+e+0+e+u+e+-u+e+o+e+(u-r)+e+l},st=ot(0,0,f,s,4,t),a={id:i+"_scrollbarBackRect_"+t.index,"stroke-width":1,height:s,width:f,"stroke-linejoin":"round",stroke:"#B4B4B4",fill:"#F7F7F7","class":"e-rangeScroll-backRect"};this.vmlRendering?this.renderer.drawRect(a,this.scrollbar):(a.d=st,this.renderer.drawPath(a,this.scrollbar));k={id:i+"_scrollbarRightRect_"+t.index,"stroke-width":1,x:f-5,height:s,width:5,"stroke-linejoin":"round",stroke:"transparent",fill:"transparent"};this.renderer.drawRect(k,this.scrollbar);d={id:i+"_scrollbarLeftRect_"+t.index,"stroke-width":1,x:0,height:s,width:5,"stroke-linejoin":"round",stroke:"transparent",fill:"transparent"};this.renderer.drawRect(d,this.scrollbar);g={id:i+"_scrollbarLeftArrow_"+t.index,"stroke-width":1,stroke:"#999999",d:"M 5 9 L 10 14 L 10 "+3.5+" Z",fill:"#999999","class":"e-rangeScroll-arrow"};this.renderer.drawPath(g,this.scrollbar);nt={id:i+"_scrollbarRightArrow_"+t.index,"stroke-width":1,stroke:"#999999",d:"M "+(f-5)+" 9 L "+(f-10)+" 14 L "+(f-10)+" "+3.5+" Z",fill:"#999999","class":"e-rangeScroll-arrow"};this.renderer.drawPath(nt,this.scrollbar);tt={id:i+"_scrollbarSelect_"+t.index,x:u,y:0,width:r,rx:4,ry:4,height:l,stroke:"#999999","stroke-width":1,fill:"#CECECE","class":"e-rangeScroll-select"};this.renderer.drawRect(tt,this.scrollbar);this.centerLine=this.renderer.createGroup({id:i+"_scrollbarCenterLine_"+t.index,transform:"translate("+(u+r/2-7.5)+")"});it={id:i+"_scrollbarCenterShape_"+t.index,"stroke-width":1,stroke:"#999999",d:"M 0 "+3.5+" L 0 "+13.5+" ZM 5 "+3.5+" L 5 "+13.5+" ZM 10 "+3.5+" L 10 "+13.5+" ZM 15 "+3.5+" L 15 "+13.5+" Z",fill:"#999999","class":"e-rangeScroll-centerShape"};this.renderer.drawPath(it,this.centerLine);this.renderer.append(this.centerLine,this.scrollbar);rt={id:i+"_leftHeaderHideRect_"+t.index,x:u,y:0,width:11,height:17,fill:"transparent",opacity:0,"stroke-width":1,"class":"e-rangeScroll-leftRect"};this.renderer.drawRect(rt,this.scrollbar);ut={id:i+"_scrollbarLeftHeader_"+t.index,cx:u+y,cy:p,r:3,fill:"#999999",stroke:"#999999","stroke-width":1,"class":"e-rangeScroll-leftCircle"};this.renderer.drawCircle(ut,this.scrollbar);ft={id:i+"_rightHeaderHideRect_"+t.index,x:o-11,y:0,width:11,height:l,fill:"transparent",opacity:0,"stroke-width":1,"class":"e-rangeScroll-rightRect"};this.renderer.drawRect(ft,this.scrollbar);et={id:i+"_scrollbarRightHeader_"+t.index,fill:"#999999",cx:o-y,cy:p,r:3,stroke:"#999999","stroke-width":1,"class":"e-rangeScroll-rightCircle"};this.renderer.drawCircle(et,this.scrollbar);this.renderer.append(this.scrollbar,this.scrollsvgObj[t.index]);t.orientation=="horizontal"?(this.scrollsvgObj[t.index].setAttribute("height",s),this.scrollsvgObj[t.index].setAttribute("width",f)):(this.scrollsvgObj[t.index].setAttribute("height",f),this.scrollsvgObj[t.index].setAttribute("width",s));this.renderer.append(this.scrollsvgObj[t.index],t.parent);v=this.vmlRendering?t.y+5:t.y;this.pluginName=="ejRangeNavigator"?this.scrollsvgObj[t.index].setAttribute("style","overflow:visible;position:relative;display:block; top:"+(v-t.y)+"px;left:"+t.x+"px"):this.scrollsvgObj[t.index].setAttribute("style","overflow:visible;position:absolute;display:block; top:"+v+"px;left:"+t.x+"px");n("#"+i+"_scrollbarSelect_"+t.index).css({cursor:"pointer"});t.enableResize?(n("#"+i+"_leftHeaderHideRect_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"}),n("#"+i+"_rightHeaderHideRect_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"}),n("#"+i+"_scrollbarRightHeader_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"}),n("#"+i+"_scrollbarLeftHeader_"+t.index).css({cursor:t.orientation=="horizontal"?"w-resize":"n-resize"})):(n("#"+i+"_leftHeaderHideRect_"+t.index).hide(),n("#"+i+"_rightHeaderHideRect_"+t.index).hide(),n("#"+i+"_scrollbarLeftHeader_"+t.index).hide(),n("#"+i+"_scrollbarRightHeader_"+t.index).hide());this.vmlRendering&&(n("#"+i+"_leftHeaderHideRect_"+t.index).css("visibility","hidden"),n("#"+i+"_rightHeaderHideRect_"+t.index).css("visibility","hidden"));this.scrollbarContainer._bindScrollEvents.call(this,t)},_bindScrollEvents:function(t){function e(t){this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"mousedown",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"mousedown",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"mousedown",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"mousedown",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"mousedown",this.scrollbarContainer._leftArrowDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"mouseup",this.scrollbarContainer._leftArrowUp);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"mousedown",this.scrollbarContainer._rightArrowDown);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"mouseup",this.scrollbarContainer._rightArrowUp);this._on(n("#"+i+"_scrollbarSelect_"+t.index),"mousedown",this.scrollbarContainer._scrollSelectRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"mousedown",this.scrollbarContainer._scrollBackRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"mouseup",this.scrollbarContainer._scrollBackRectUp);this._on(n(window),"mousemove",this.scrollbarContainer._scrollbarMove);this._on(n(window),"mouseup",this.scrollbarContainer._scrollbarUp);this._on(n(this.svgObject),"mousemove",this.scrollbarContainer._scrollbarMove);this._on(n(this.scrollsvgObj[t.index]),"mousemove",this.scrollbarContainer._scrollbarMove);this._on(n(this.scrollsvgObj[t.index]),"mouseup",this.scrollbarContainer._scrollbarUp)}function o(t){this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"touchstart",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"touchstart",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"touchstart",this.scrollbarContainer._leftScrollbarDown);this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"touchstart",this.scrollbarContainer._rightScrollbarDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"touchstart",this.scrollbarContainer._leftArrowDown);this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"touchend",this.scrollbarContainer._leftArrowUp);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"touchstart",this.scrollbarContainer._rightArrowDown);this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"touchend",this.scrollbarContainer._rightArrowUp);this._on(n("#"+i+"_scrollbarSelect_"+t.index),"touchstart",this.scrollbarContainer._scrollSelectRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"touchstart",this.scrollbarContainer._scrollBackRectDown);this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"touchend",this.scrollbarContainer._scrollBackRectUp);this._on(n(window),"touchmove",this.scrollbarContainer._scrollbarMove);this._on(n(window),"touchend",this.scrollbarContainer._scrollbarUp);this._on(n(this.scrollsvgObj[t.index]),"touchmove",this.scrollbarContainer._scrollbarMove);this._on(n(this.scrollsvgObj[t.index]),"touchend",this.scrollbarContainer._scrollbarUp)}var i=this._id,u=jQuery.uaMatch(navigator.userAgent),r=!!navigator.userAgent.match(/Trident\/7\./),f;if(e.call(this,t),window.PointerEvent)this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"pointerdown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"pointerdown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"pointerdown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"pointerdown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"pointerdown",this.scrollbarContainer._leftArrowDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"pointerup",this.scrollbarContainer._leftArrowUp),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"pointerdown",this.scrollbarContainer._rightArrowDown),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"pointerup",this.scrollbarContainer._rightArrowUp),this._on(n("#"+i+"_scrollbarSelect_"+t.index),"pointerdown",this.scrollbarContainer._scrollSelectRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"pointerdown",this.scrollbarContainer._scrollBackRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"pointerup",this.scrollbarContainer._scrollBackRectUp),this._on(n(window),"pointermove",this.scrollbarContainer._scrollbarMove),this._on(n(window),"pointerup",this.scrollbarContainer._scrollbarUp),this._on(n(this.scrollsvgObj[t.index]),"pointermove",this.scrollbarContainer._scrollbarMove),this._on(n(this.scrollsvgObj[t.index]),"pointerup",this.scrollbarContainer._scrollbarUp),n(this.scrollsvgObj[t.index]).css("touch-action","none");else if(window.navigator.msPointerEnabled&&!r)this._on(n("#"+i+"_scrollbarLeftHeader_"+t.index),"MSPointerDown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_scrollbarRightHeader_"+t.index),"MSPointerDown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_leftHeaderHideRect_"+t.index),"MSPointerDown",this.scrollbarContainer._leftScrollbarDown),this._on(n("#"+i+"_rightHeaderHideRect_"+t.index),"MSPointerDown",this.scrollbarContainer._rightScrollbarDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"MSPointerDown",this.scrollbarContainer._leftArrowDown),this._on(n("#"+i+"_scrollbarLeftArrow_"+t.index),"MSPointerUp",this.scrollbarContainer._leftArrowUp),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"MSPointerDown",this.scrollbarContainer._rightArrowDown),this._on(n("#"+i+"_scrollbarRightArrow_"+t.index),"MSPointerUp",this.scrollbarContainer._rightArrowUp),this._on(n("#"+i+"_scrollbarSelect_"+t.index),"MSPointerDown",this.scrollbarContainer._scrollSelectRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"MSPointerDown",this.scrollbarContainer._scrollBackRectDown),this._on(n("#"+i+"_scrollbarBackRect_"+t.index),"MSPointerUp",this.scrollbarContainer._scrollBackRectUp),this._on(n(window),"MSPointerMove",this.scrollbarContainer._scrollbarMove),this._on(n(window),"MSPointerUp",this.scrollbarContainer._scrollbarUp),this._on(n(this.scrollsvgObj[t.index]),"MSPointerMove",this.scrollbarContainer._scrollbarMove),this._on(n(this.scrollsvgObj[t.index]),"MSPointerUp",this.scrollbarContainer._scrollbarUp),n(this.scrollsvgObj[t.index]).css("-ms-touch-action","none");else if(u.browser.toLowerCase()=="chrome")o.call(this,t);else if(this.isDevice()){var s=navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1,h=window.location!=window.parent.location?!0:!1,c=h?window.parent.navigator.userAgent.toLowerCase():window.navigator.userAgent.toLowerCase(),l=/mobile|tablet|android|kindle/i.test(c);ej.isMobile()&&this.isWindows()||!l&&ej.isMobile()&&s?(e.call(this),n(this.scrollsvgObj[t.index]).css("-ms-touch-action","none")):o.call(this,t)}f=u.browser.toLowerCase()=="mozilla"?r?"mousewheel":"DOMMouseScroll":"mousewheel";this._on(n(this.scrollsvgObj[t.index]),f,this.scrollbarContainer._scrollMouseWheel);r&&n(this.scrollsvgObj[t.index]).css("touch-action","none")},_setScrollPosition:function(t,i,r){var f=8,u=this._id,e=t+r.rectWidth/2-7.5;n("#"+u+"_scrollbarLeftHeader_"+r.index).attr("cx",t+f);n("#"+u+"_leftHeaderHideRect_"+r.index).attr("x",t);n("#"+u+"_scrollbarRightHeader_"+r.index).attr("cx",i-f);n("#"+u+"_rightHeaderHideRect_"+r.index).attr("x",i-5);n("#"+u+"_scrollbarSelect_"+r.index).attr("x",t);n("#"+u+"_scrollbarSelect_"+r.index).attr("width",r.rectWidth);n("#"+u+"_scrollbarCenterLine_"+r.index).attr("transform","translate("+e+")");this.pluginName=="ejRangeNavigator"&&(n("#"+u+"_scrollbarLeftHeader_"+r.index).css("left",t),n("#"+u+"_leftHeaderHideRect_"+r.index).css("left",t),n("#"+u+"_scrollbarRightHeader_"+r.index).css("left",i-f),n("#"+u+"_rightHeaderHideRect_"+r.index).css("left",i-5),n("#"+u+"_scrollbarSelect_"+r.index).css("left",t),n("#"+u+"_scrollbarCenterLine_"+r.index).css("left",e))},_calculateScrollLeftMove:function(n,t){t._startX-n>15?(t.startX=t._startX-n,t.offsetLeftX=t.startX,t._offsetRightX=t.startX+t.rectWidth,t.offsetRightX=t._offsetRightX,t.endX=t.width-t.offsetRightX):(t.startX=15,t._offsetLeftX=t.offsetLeftX,t.offsetLeftX=t.startX,t._offsetRightX=t.startX+t.rectWidth,t.offsetRightX=t._offsetRightX,t.endX=t.width-t.offsetRightX)},_calculateScrollRightMove:function(n,t){t&&t._offsetRightX+Math.abs(n)<t.width-15?(t._startX=t.startX+Math.abs(n),t.offsetLeftX=t._startX,t.offsetRightX=t._offsetRightX+Math.abs(n),t.endX=t.width-t.offsetRightX):(t._ofsetRightX=t.offsetRightX,t.offsetRightX=t.width-15,t._startX=t.offsetRightX-t.rectWidth,t.offsetLeftX=t._startX,t.endX=t.width-t.offsetRightX)},_calculateRange:function(t,i,r){var o,s,e,u,f,a=30,h,c,l;return o=(t-15)/(r.width-a-r._diff),e=r.scrollRange,s=(r.rectWidth-r._diff)/(r.width-a-r._diff),r.isRTL?(f=e.max-o*e.delta,u=f-s*e.delta):(u=e.min+o*e.delta,f=u+s*e.delta),r.valueType=="datetime"?(h=r.startDateTime,c=r.endDateTime,r.startDateTime=this.startDateTime=u=new Date(u),r.endDateTime=this.endDateTime=f=new Date(f)):(h=parseInt(r.startValue),c=parseInt(r.endValue),r.startValue=this.startValue=u=Math.ceil(u),r.endValue=this.endValue=f=Math.ceil(f)),r._scrollChanged=!0,l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={zoomPosition:o,zoomFactor:s,oldRange:{start:h,end:c},newRange:{start:u,end:f}},r.zoomPosition=o,r.zoomFactor=s,l},_calculateScrollPosition:function(t,i){var s,h,f,r,u,e,o,y=30,a=15,c,p,w=36,l,v;if(this.leftScrollbarClicked&&i.enableResize)return t=t>=a?t:a,t=t>=a&&t<i.offsetRightX-a?t:i.offsetRightX-a,s=(t-w)/(i.width-y),h=i.rectWidth/(i.width-y),c=i.valueType.toLowerCase(),f=i.scrollRange,i.isRTL?(u=f.max-s*f.delta,u=u<f.max?u:f.max,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.endDateTime=this.endDateTime=u=new Date(u),r=i.startDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.endValue=this.endValue=u=Math.ceil(u),r=Math.ceil(i.startValue))):(r=f.min+s*f.delta,r=r>f.min?r:f.min,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.startDateTime=this.startDateTime=r=new Date(r),u=i.endDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.startValue=this.startValue=r=Math.ceil(r),u=Math.ceil(i.endValue))),l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={zoomPosition:s,zoomFactor:h,oldRange:{start:e,end:o},newRange:{start:r,end:u}},i._scrollChanged=!0,i.zoomPosition=s,i.zoomFactor=h,l;if(this.rightScrollbarClicked&&i.enableResize)return f=i.scrollRange,h=i.rectWidth/(i.width-y),s=i.zoomPosition,c=i.valueType.toLowerCase(),i.isRTL?(s=(t-w)/(i.width-y),r=f.max-s*f.delta,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.startDateTime=this.startDateTime=r=new Date(r),u=i.endDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.startValue=this.startValue=r=Math.floor(r),u=Math.ceil(i.endValue))):(p=f.min+s*f.delta,u=p+h*f.delta,c=="datetime"?(e=i.startDateTime,o=i.endDateTime,i.endDateTime=this.endDateTime=u=new Date(u),r=i.startDateTime):(e=parseInt(i.startValue),o=parseInt(i.endValue),i.endValue=this.endValue=u=Math.floor(u),r=Math.ceil(i.startValue))),l=n.extend({},ej.EjSvgRender.commonChartEventArgs),l.data={zoomPosition:i.zoomPosition?i.zoomPosition:0,zoomFactor:h,oldRange:{start:e,end:o},newRange:{start:r,end:u}},i._scrollChanged=!0,i.zoomFactor=h,l;if(i&&this.scrollRectClicked){if(v=this.mouseDownPos-t,v>0&&i.offsetLeftX>=0)return this.scrollbarContainer._calculateScrollLeftMove.call(this,v,i),this.scrollbarContainer._calculateRange.call(this,i.startX,i.offsetRightX,i);if(v<0)return this.scrollbarContainer._calculateScrollRightMove.call(this,v,i),this.scrollbarContainer._calculateRange.call(this,i._startX,i.offsetRightX,i)}},_scrollbarMove:function(t){var u,s;if(this.moveClientX=ej.isNullOrUndefined(t.clientX)?t.originalEvent.clientX==null?t.originalEvent.touches[0].clientX:t.originalEvent.clientX:t.clientX,this.moveClientX!=this.downClientX){var f=8,o=34,r,e,w=this.model.padding||0,b=jQuery.uaMatch(navigator.userAgent),i=this.scrollbarContainer._doScrollIndex.call(this,t);if(!i)return 0;if(this.lastIndex=i.index,r=!this.vmlRendering&&t.originalEvent.toString()!=="[object TouchEvent]"&&b.browser.toLowerCase()!="msie"||this.vmlRendering?(i.orientation=="horizontal"?this.calMousePosition(t).X-i.x:i.width-(this.calMousePosition(t).Y-i.y))-w:(i.orientation=="horizontal"?this.calTouchPosition(t).X-i.x:i.width-(this.calTouchPosition(t).Y-i.y))-w,this.mouseX=r,u=this._id,this.leftScrollbarClicked&&i.enableResize&&(i&&(r>o||r>23)&&r<i.offsetRightX-o?(i.rectWidth=i.width-(i.endX+r-f),e=r-f+i.rectWidth/2-7.5,n("#"+u+"_scrollbarLeftHeader_"+i.index).attr("cx",r),n("#"+u+"_leftHeaderHideRect_"+i.index).attr("x",r-7.5),n("#"+u+"_scrollbarSelect_"+i.index).attr("x",r-f),n("#"+u+"_scrollbarSelect_"+i.index).attr("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).attr("transform","translate("+e+")"),this.pluginName=="ejRangeNavigator"&&(n("#"+u+"_scrollbarLeftHeader_"+i.index).css("left",r),n("#"+u+"_leftHeaderHideRect_"+i.index).css("left",r-7.5),n("#"+u+"_scrollbarSelect_"+i.index).css("left",r),n("#"+u+"_scrollbarSelect_"+i.index).css("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).css("left",e)),i.offsetLeftX=i.startX=r-8,this.scrollbarContainer._scrollStartArgs.call(this,i),this.scrollbarContainer._scrollChangeArgs.call(this,i),i._diff=0):r>i.offsetRightX-o&&(this.rectWidth=42.899841017488143)),this.rightScrollbarClicked&&i.enableResize&&i&&(r<=i.width-o||r<=i.width-23)&&r>i.offsetLeftX+o&&(i.rectWidth=r-i.offsetLeftX+f,e=i.offsetLeftX+i.rectWidth/2-7.5,n("#"+u+"_scrollbarRightHeader_"+i.index).attr("cx",r),n("#"+u+"_rightHeaderHideRect_"+i.index).attr("x",r-2.5),n("#"+u+"_scrollbarSelect_"+i.index).attr("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).attr("transform","translate("+e+")"),this.pluginName=="ejRangeNavigator"&&(n("#"+u+"_scrollbarRightHeader_"+i.index).css("left",r),n("#"+u+"_rightHeaderHideRect_"+i.index).css("left",r-2.5),n("#"+u+"_scrollbarSelect_"+i.index).css("width",i.rectWidth),n("#"+u+"_scrollbarCenterLine_"+i.index).css("left",e)),i.offsetRightX=r+f,i.endX=i.width-r-f,this.scrollbarContainer._scrollStartArgs.call(this,i),this.scrollbarContainer._scrollChangeArgs.call(this,i),i._diff=0),this.scrollRectClicked&&(s=this.mouseDownPos-r,i._startX=ej.isNullOrUndefined(i._startX)?i.startX:i._startX,i&&s>0&&i.offsetLeftX>=0&&(this.scrollbarContainer._calculateScrollLeftMove.call(this,s,i),this.scrollbarContainer._setScrollPosition.call(this,i.startX,i.offsetRightX,i),(i.offsetLeftX>15||i.offsetLeftX!=i._offsetLeftX)&&(this.scrollbarContainer._scrollStartArgs.call(this,i),this.scrollbarContainer._scrollChangeArgs.call(this,i))),i&&s<0&&(ej.isNullOrUndefined(i._offsetRightX)&&(this.scrollbarContainer._scrollSelectRectDown.call(this,t),this.scrollbarContainer._scrollbarMove.call(this,t)),this.scrollbarContainer._calculateScrollRightMove.call(this,s,i),this.scrollbarContainer._setScrollPosition.call(this,i._startX,i._startX+i.rectWidth,i),(i.offsetRightX<i.width-15||i.offsetRightX!=i._ofsetRightX)&&(this.scrollbarContainer._scrollStartArgs.call(this,i),this.model.enableDeferredUpdate===!1||i.isZooming||this.model.scrollChanged!="")))){var h=this.scrollbarContainer._calculateRange.call(this,i._startX,i._startX+i.rectWidth,i),c=h.data.oldRange,l=h.data.newRange,a,v,y,p;i.valueType.toLowerCase()=="datetime"?(a=Date.parse(c.start),y=Date.parse(l.start),v=Date.parse(c.end),p=Date.parse(l.end)):(a=c.start,y=l.start,v=c.end,p=l.end);this.model.scrollChanged!=""&&(a!=y||v!=p)&&(h=this.scrollbarContainer._args.call(this,i,h),this._trigger("scrollChanged",h));this.model.enableDeferredUpdate||(this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,i))}}this.offsetX=r},_scrollbarUp:function(t){var i=this.scrollbarContainer._doScrollIndex.call(this,t),r,s,u,f,h,c,e,o,l;n("[id^="+this._id+"_scrollbarSelect_]").attr("class","e-rangeScroll-select");this.lastIndex=null;r=this.scrollbarContainer._calculateScrollPosition.call(this,this.mouseX,i);s=this.model.enableDeferredUpdate;r&&(u=r.data.oldRange,f=r.data.newRange,i.valueType.toLowerCase()=="datetime"?(h=Date.parse(u.start),e=Date.parse(f.start),c=Date.parse(u.end),o=Date.parse(f.end)):(h=u.start,e=f.start,c=u.end,o=f.end),(h!=e||c!=o||this.scrollRectClicked&&!s||s||this.leftScrollbarClicked||this.rightScrollbarClicked)&&(l=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&navigator.vendor.toLowerCase().indexOf("google")>-1,(!l||l&&(this.leftScrollbarClicked||this.rightScrollbarClicked)&&this.downClientX!=this.moveClientX||this.scrollRectClicked||this.leftArrowClicked||this.rightArrowClicked)&&(!this.leftScrollbarClicked&&!this.rightScrollbarClicked||(this.leftScrollbarClicked||this.rightScrollbarClicked)&&Math.ceil(i.rectWidth)!=Math.ceil(this.rectOldWidth)&&(Math.abs(i.rectWidth-i.rectOldWidth)>4||!i.rectOldWidth))&&(ej.isNullOrUndefined(i._previousStart)||i._previousStart!=e||i._previousEnd!=o)&&(r=this.scrollbarContainer._args.call(this,i,r),this._trigger("scrollEnd",r),i._scrollStarted=!1,i._previousStart=e,i._previousEnd=o,i.rectOldWidth=i.rectWidth,this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,i))),i.release=!0,i.clicked=!1);this._scrollEnd=!1;this.leftScrollbarClicked=!1;this.rightScrollbarClicked=!1;this.scrollRectClicked=!1;this.leftArrowClicked=!1;this.rightArrowClicked=!1;this.scrollbarBackRectClicked=!1},_leftScrollbarDown:function(n){n.preventDefault();this.leftScrollbarClicked=!0;this.downClientX=ej.isNullOrUndefined(n.clientX)?n.originalEvent.touches[0].clientX:n.clientX},_rightScrollbarDown:function(n){n.preventDefault();this.rightScrollbarClicked=!0;this.downClientX=ej.isNullOrUndefined(n.clientX)?n.originalEvent.touches[0].clientX:n.clientX},_scrollSelectRectDown:function(t){var i=this.scrollbarContainer._doScrollIndex.call(this,t),u;n("#"+this._id+"_scrollbarSelect_"+i.index).attr("class","e-rangeScroll-select e-rangeScroll-select-hover");t.preventDefault();var f=jQuery.uaMatch(navigator.userAgent),r=this.model.padding||0,i=this.scrollbarContainer._doScrollIndex.call(this,t);u=!this.vmlRendering&&t.originalEvent.toString()!=="[object TouchEvent]"&&f.browser.toLowerCase()!="msie"||this.vmlRendering?(i.orientation=="horizontal"?this.calMousePosition(t).X-i.x:i.width-(this.calMousePosition(t).Y-i.y))-r:(i.orientation=="horizontal"?this.calTouchPosition(t).X-i.x:i.width-(this.calTouchPosition(t).Y-i.y))-r;this.mouseDownPos=u;i._startX=i.startX=i.offsetLeftX;i._offsetRightX=i.offsetRightX;i.clicked=!0;i.release=!1;this.scrollRectClicked=!0},_scrollMouseWheel:function(n){n.preventDefault();var t=this.scrollbarContainer._doScrollIndex.call(this,n),r=!!navigator.userAgent.match(/Trident\/7\./),i=n.originalEvent.wheelDelta,u=jQuery.uaMatch(navigator.userAgent),f=u.browser.toLowerCase()=="mozilla"?r?i/120>0?1:-1:-n.originalEvent.detail/3>0?1:-1:i/120>0?1:-1,e=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1),o=Math.max(e+.25*f,1);this.scrollbarContainer.doMouseWheelZoom.call(this,o,.5,t)},_scrollStartArgs:function(t){if(t._scrollStarted=!0,this.model.scrollStart!=""&&!this._scrollEnd){var i=n.extend({},ej.EjSvgRender.commonChartEventArgs);i.data=t.isZooming?{axis:this.model._axes[t.index],currentRange:this.model._axes[t.index].visibleRange}:{startRange:t.valueType=="datetime"?t.startDateTime:t.startValue,endRange:t.valueType=="datetime"?t.endDateTime:t.endValue};this._trigger("scrollStart",i);this._scrollEnd=!0}},_scrollChangeArgs:function(n){if(this.model.enableDeferredUpdate===!1||n.isZooming||this.model.scrollChanged!=""){var t=this.scrollbarContainer._calculateRange.call(this,n.offsetLeftX,n.offsetRightX,n),i=t.data.oldRange,r=t.data.newRange,u,f,e,o;n.valueType.toLowerCase()=="datetime"?(u=Date.parse(i.start),e=Date.parse(r.start),f=Date.parse(i.end),o=Date.parse(r.end)):(u=i.start,e=r.start,f=i.end,o=r.end);this.model.scrollChanged!=""&&(u!=e||f!=o)&&(t=this.scrollbarContainer._args.call(this,n,t),this._trigger("scrollChanged",t));this.model.enableDeferredUpdate||(this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,n))}},_scrollEndArgs:function(n,t){var i=this.scrollbarContainer._calculateRange.call(this,n,t.offsetRightX,t),r,u,f,e,o,s;i&&t._scrollStarted&&(r=i.data.oldRange,u=i.data.newRange,t.valueType.toLowerCase()=="datetime"?(f=Date.parse(r.start),o=Date.parse(u.start),e=Date.parse(r.end),s=Date.parse(u.end)):(f=r.start,o=u.start,e=r.end,s=u.end),(f!=o||e!=s||this.leftScrollbarClicked||this.rightScrollbarClicked)&&(i=this.scrollbarContainer._args.call(this,t,i),this._trigger("scrollEnd",i)),t._scrollStarted=!1,this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,t))},_args:function(n,t){if(n.isZooming){var i=this.model._axes[n.index],r=t.data;r.axis=i;r.newRange=i.visibleRange;r.oldRange=i.previousRange}return n.isVirtual&&(t.data.axis=this.model._axes[n.index],delete t.data.zoomFactor,delete t.data.zoomPosition),t},doMouseWheelZoom:function(n,t,i){if(n>=1){var r=this.scrollbarContainer.calZoomFactors(n,t,i.zoomFactor,i.zoomPosition);i.zoomPosition!=r.zoomMPosition&&r.zoomMPosition+i.zoomFactor<=1&&i.zoomPosition>=0&&(r.zoomMPosition+i.zoomFactor>=1&&(r.zoomMPosition=1-i.zoomFactor),r.zoomMPosition<0&&(r.zoomMPosition=0),i.zoomPosition=r.zoomMPosition,i.startX=i.zoomPosition*(i.width-30-i._diff)+15,i.startX=i.startX+i.rectWidth+5>i.width?i.width-i.rectWidth-15:i.startX,i.offsetLeftX=i.startX,i._offsetRightX=i.startX+i.rectWidth,i._offsetRightX>i.width-15?(i.offsetRightX=i.width-15,i.startX=i.offsetRightX-i.rectWidth,i.offsetLeftX=i.startX):i.offsetRightX=i._offsetRightX,i.endX=i.width-i.offsetRightX,this.scrollbarContainer._setScrollPosition.call(this,i.startX,i.offsetRightX,i),this.scrollbarContainer._calculateMouseWheelRange.call(this,i.startX,i.offsetRightX,i))}return!1},_calculateMouseWheelRange:function(t,i,r){var e,u,f,w=30,c,l,o,s,h,a,v,y,p;r.zoomFactor=r.rectWidth/(r.width-w);r.zoomPosition=(t-15)/(r.width-w-r._diff);e=r.scrollRange;r.isRTL?(f=e.max-r.zoomPosition*e.delta,u=f-r.zoomFactor*e.delta):(u=e.min+r.zoomPosition*e.delta,f=u+r.zoomFactor*e.delta);r.valueType=="datetime"?(c=r.startDateTime,l=r.endDateTime,r.startDateTime=this.startDateTime=u=new Date(u),r.endDateTime=this.endDateTime=f=new Date(f)):(c=parseInt(r.startValue),l=parseInt(r.endValue),r.startValue=this.startValue=u=Math.ceil(u),r.endValue=this.endValue=f=Math.ceil(f));o=n.extend({},ej.EjSvgRender.commonChartEventArgs);o.data={zoomPosition:r.zoomPosition,zoomFactor:r.zoomFactor,oldRange:{start:c,end:l},newRange:{start:u,end:f}};r._scrollChanged=!0;r._scrollStarted=!1;s=o.data.oldRange;h=o.data.newRange;r.valueType.toLowerCase()=="datetime"?(a=Date.parse(s.start),y=Date.parse(h.start),v=Date.parse(s.end),p=Date.parse(h.end)):(a=s.start,y=h.start,v=s.end,p=h.end);(a!=y||v!=p||r.isZooming)&&(this.scrollbarContainer._scrollStartArgs.call(this,r),o=this.scrollbarContainer._args.call(this,r,o),this._trigger("scrollEnd",o),this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this,r),this._scrollEnd=!1)},calZoomFactors:function(n,t,i,r){var u,f;return n==1?(u=1,f=0):(u=ej.EjSvgRender.utils._minMax(1/n,0,1),f=r+(i-u)*t),{zoomMFactor:u,zoomMPosition:f}},_leftArrowDown:function(n){var t,i;this.leftArrowClicked=!0;t=this.scrollbarContainer._doScrollIndex.call(this,n);t._startX=t.startX=t.offsetLeftX;t._offsetRightX=t.offsetRightX;t.leftIncrement=5;i=this;t.interval=setInterval(function(){i.scrollbarContainer.leftArrowRecursive.call(i,t)},50)},_leftArrowUp:function(n){this.leftArrowClicked=!1;var t=this.scrollbarContainer._doScrollIndex.call(this,n);this.scrollbarContainer.leftArrowRecursive.call(this,t)},leftArrowRecursive:function(n){if(this.leftArrowClicked){var t=this._id;this.scrollbarContainer._calculateScrollLeftMove.call(this,n.leftIncrement,n);n._scrollStarted=!0;n.startX>15&&this.scrollbarContainer._scrollEndArgs.call(this,n.startX,n);this.scrollbarContainer._setScrollPosition.call(this,n.startX,n.offsetRightX,n);n.leftIncrement+=5}else clearInterval(n.interval),n.leftIncrement=0},_rightArrowDown:function(n){var t,i;this.rightArrowClicked=!0;t=this.scrollbarContainer._doScrollIndex.call(this,n);t._startX=t.startX=t.offsetLeftX;t._offsetRightX=t.offsetRightX;t.rightIncrement=-5;i=this;t.interval=setInterval(function(){i.scrollbarContainer.rightArrowRecursive.call(i,t)},50)},_rightArrowUp:function(n){this.rightArrowClicked=!1;var t=this.scrollbarContainer._doScrollIndex.call(this,n);this.scrollbarContainer.rightArrowRecursive.call(this,t)},rightArrowRecursive:function(n){if(this.rightArrowClicked){var t=this._id;this.scrollbarContainer._calculateScrollRightMove.call(this,n.rightIncrement,n);n._scrollStarted=!0;n.offsetRightX<n.width-15&&this.scrollbarContainer._scrollEndArgs.call(this,n._startX,n);this.scrollbarContainer._setScrollPosition.call(this,n._startX,n.offsetRightX,n);n.rightIncrement-=5}else clearInterval(n.interval),n.rightIncrement=0},_scrollBackRectDown:function(n){var e=jQuery.uaMatch(navigator.userAgent),r=this.model.padding||0,t=this.scrollbarContainer._doScrollIndex.call(this,n),u,i,f;u=!this.vmlRendering&&n.originalEvent.toString()!=="[object TouchEvent]"&&e.browser.toLowerCase()!="msie"||this.vmlRendering?(t.orientation=="horizontal"?this.calMousePosition(n).X-t.x:t.width-(this.calMousePosition(n).Y-t.y))-r:(t.orientation=="horizontal"?this.calTouchPosition(n).X-t.x:t.width-(this.calTouchPosition(n).Y-t.y))-r;this.mouseDownPos=u;this.scrollbarBackRectClicked=!0;i=this;this.scrollbarContainer._scrollStartArgs.call(this,t);f=setInterval(function(){i.scrollbarContainer.scrollBackRectRecursive.call(i,t);this.scrollbarBackRectClicked||clearInterval(f)},50)},_scrollBackRectUp:function(n){this.scrollbarBackRectClicked=!1;var t=this.scrollbarContainer._doScrollIndex.call(this,n);this.scrollbarContainer.scrollBackRectRecursive.call(this,t)},_doScrollIndex:function(n){var i=this._id+"_scrollbar_",r=n.target.parentNode&&n.target.parentNode.id?n.target.parentNode.id:"",t=r.indexOf(i)>-1?parseInt(r.substr(i.length)):NaN;return ej.isNullOrUndefined(this.lastIndex)||isNaN(this.lastIndex)||!this.model.scrollObj[this.lastIndex].release&&this.model.scrollObj[this.lastIndex].clicked&&(t=this.lastIndex),this.lastIndex=ej.isNullOrUndefined(this.lastIndex)?t:this.lastIndex,ej.isNullOrUndefined(this.model.scrollObj[t])?this.model.scrollObj[this.lastIndex]:this.model.scrollObj[t]},scrollBackRectRecursive:function(n){if(this.scrollbarBackRectClicked){var t=10/100*(n.width-30);n._startX=n.startX=n.offsetLeftX;n._offsetRightX=n.offsetRightX;this.mouseDownPos<n.startX?(t=t<n.startX?t:n.startX-16,this.scrollbarContainer._calculateScrollLeftMove.call(this,t,n),n._scrollStarted=!0,this.scrollbarContainer._scrollEndArgs.call(this,n.startX,n),this.scrollbarContainer._setScrollPosition.call(this,n.startX,n.offsetRightX,n)):this.mouseDownPos>n.offsetRightX?(t=(t<n.endX?t:n.endX-16)*-1,this.scrollbarContainer._calculateScrollRightMove.call(this,t,n),n._scrollStarted=!0,this.scrollbarContainer._scrollEndArgs.call(this,n._startX,n),this.scrollbarContainer._setScrollPosition.call(this,n._startX,n.offsetRightX,n)):n._scrollStarted=!1}else n._scrollStarted=!1},_appendScrollRange:function(n){if(this.scrollbarUpdate=!0,this.pluginName=="ejRangeNavigator")this.renderNavigator();else{var i=n.index,t=this.model._axes[i];n.isZooming&&(t.zoomFactor!=n.zoomFactor||t.zoomPosition!=n.zoomPosition)&&(t.zoomFactor=n.zoomFactor,t.zoomPosition=n.zoomPosition,this.redraw(!0))}this.scrollbarUpdate=!1}}}(jQuery),function(n,t,i){t.widget({ejCircularGauge:"ej.datavisualization.CircularGauge"},{_rootCSS:"e-circulargauge",validTags:["div","span"],_savedPoints:[],_labelRadius:0,_customLblMaxSize:0,defaults:{locale:null,enableGroupSeparator:!1,value:0,minimum:0,maximum:100,radius:180,width:360,height:360,frame:{frameType:"fullcircle",backgroundImageUrl:null,halfCircleFrameStartAngle:180,halfCircleFrameEndAngle:360},backgroundColor:null,interiorGradient:null,readOnly:!0,enableAnimation:!0,animationSpeed:500,theme:"flatlight",isRadialGradient:!1,enableResize:!1,isResponsive:!1,tooltip:{showLabelTooltip:!1,showCustomLabelTooltip:!1,templateID:null},outerCustomLabelPosition:"bottom",gaugePosition:"center",distanceFromCorner:20,rangeZOrder:"rear",drawTicks:null,drawLabels:null,drawPointers:null,drawRange:null,drawCustomLabel:null,drawIndicators:null,drawPointerCap:null,load:null,renderComplete:null,mouseClick:null,mouseClickMove:null,mouseClickUp:null,legendItemRender:null,legendItemClick:null,rangeMouseMove:null,scales:null,legend:{visible:!1,toggleVisibility:!0,border:{color:"transparent",width:1},itemPadding:20,shape:"circle",alignment:"center",position:"bottom",itemStyle:{height:9,width:9,border:{color:"transparent",width:1}},opacity:1,fill:null,font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",size:"12px"},size:{height:null,width:null}},themeProperties:{flatlight:{backgroundColor:"#FFFFFF",scales:{pointerCap:{borderColor:"#424242",backgroundColor:"#424242"},backgroundColor:"#777777",border:{color:"#777777"},pointers:{backgroundColor:"#424242",border:{color:"#424242"}},ticks:{color:"#777777"},labels:{color:"#282828"}}},flatdark:{backgroundColor:"#1F1F1F",scales:{pointerCap:{borderColor:"#686868",backgroundColor:"#686868"},backgroundColor:"#7a7a7a",border:{color:"#7a7a7a"},pointers:{backgroundColor:"#686868",border:{color:"#686868"}},ticks:{color:"#7a7a7a"},labels:{color:"#d3d3d3"}}}}},_defaultScaleValues:function(){return{size:6,pointerCap:{radius:7,borderWidth:3,interiorGradient:null,borderColor:null,backgroundColor:null},showScaleBar:!1,sweepAngle:310,radius:170,startAngle:115,majorIntervalValue:10,minorIntervalValue:2,maximum:null,minimum:null,border:{color:null,width:1.5},backgroundColor:null,direction:"clockwise",showPointers:!0,showRanges:!1,showTicks:!0,showLabels:!0,showIndicators:!1,opacity:1,shadowOffset:0,customLabels:[{value:null,color:null,textAngle:0,positionType:"inner",position:{x:0,y:0},font:{size:"11px",fontFamily:"arial",fontStyle:"bold"}}],pointers:[{distanceFromScale:0,showBackNeedle:!1,backNeedleLength:10,length:150,placement:"near",width:7,opacity:1,value:null,border:{color:null,width:1.5},backgroundColor:null,gradients:null,type:"needle",needleType:"triangle",markerType:"rectangle",imageUrl:"",pointerValueText:{showValue:!1,distance:20,font:{size:"11px",fontFamily:"Arial",fontStyle:"Bold"},color:"#8c8c8c",opacity:1,autoAngle:!1,angle:0}}],ranges:[{legendText:null,distanceFromScale:25,size:5,placement:"near",startValue:null,endValue:null,startWidth:null,endWidth:null,gradients:null,opacity:null,backgroundColor:"#32b3c6",border:{color:"#32b3c6",width:1.5}}],ticks:[{angle:0,distanceFromScale:0,color:null,type:"major",placement:"near",height:16,width:3},{angle:0,distanceFromScale:0,color:null,type:"minor",placement:"near",height:7,width:1}],labels:[{angle:0,autoAngle:!1,opacity:null,font:{size:"11px",fontFamily:"Arial",fontStyle:"Bold"},color:null,distanceFromScale:0,includeFirstValue:!0,placement:"near",type:"major",unitText:"",unitTextPosition:"back"}],indicators:[{height:15,width:15,type:"circle",imageUrl:null,position:{x:0,y:0},stateRanges:[{endValue:0,startValue:0,backgroundColor:null,borderColor:null,text:"",textColor:null,font:null}]}],subGauges:[{height:150,width:150,position:{x:0,y:0}}]}},dataTypes:{scales:"data",isResponsive:"boolean"},observables:["value","minimum","maximum"],_tags:[{tag:"scales",attr:["showScaleBar","pointerCap.radius","pointerCap.borderWidth","pointerCap.interiorGradient","pointerCap.borderColor","pointerCap.backgroundColor","sweepAngle","startAngle","showPointers","showTicks","backgroundColor","scaleRadius","majorIntervalValue","minorIntervalValue","shadowOffset","showRanges","showLabels","showCustomLabels","showIndicators","border.width","border.color",[{tag:"pointers",attr:["distanceFromScale","showBackNeedle","backNeedleLength","backgroundColor","needleType","markerType","border.width","border.color","imageUrl","pointerValueText.showValue","pointerValueText.distance","pointerValueText.font.size","pointerValueText.font.fontFamily","pointerValueText.font.fontStyle","pointerValueText.angle","pointerValueText.autoAngle","pointerValueText.color","pointerValueText.opacity"]},{tag:"labels",attr:["autoAngle","distanceFromScale","includeFirstValue","unitText","unitTextPosition","font.size","font.fontFamily","font.fontStyle"]},{tag:"ticks",attr:["distanceFromScale"]},{tag:"ranges",attr:["legendText","distanceFromScale","startValue","endValue","startWidth","endWidth","backgroundColor","border.color","border.width"]},{tag:"indicators",attr:["imageUrl","position.x","position.y",[{tag:"stateRanges",attr:["endValue","startValue","backgroundColor","borderColor","textColor"]}]]},{tag:"subGauges",attr:["controlID","position.x","position.y"]},{tag:"customLabels",attr:["positionType","textAngle","position.x","position.y","font.size","font.fontFamily","font.fontStyle"]}]]}],value:t.util.valueFunction("value"),minimum:t.util.valueFunction("minimum"),maximum:t.util.valueFunction("maximum"),_setModel:function(t){var i,r,u,f,e;for(i in t)switch(i){case"height":this.model.height=t[i];break;case"width":this.model.width=t[i];break;case"radius":this.model.radius=t[i];break;case"frame":n.extend(this.model.frame,t[i]);break;case"tooltip":n.extend(this.model.tooltip,t[i]);break;case"backgroundColor":this.model.backgroundColor=t[i];break;case"interiorGradient":this.model.interiorGradient=t[i];break;case"readOnly":this.model.readOnly=t[i];break;case"theme":this.model.theme=t[i];break;case"isRadialGradient":this.model.isRadialGradient=t[i];break;case"outerCustomLabelPosition":this.model.outerCustomLabelPosition=t[i];break;case"gaugePosition":this.model.gaugePosition=t[i];break;case"distanceFromCorner":this.model.distanceFromCorner=t[i];break;case"rangeZOrder ":this.model.rangeZOrder=t[i];break;case"value":for(this.value()==""&&this.value(0),r=0;this.model.scales[r]!=null;r++)for(u=0;this.model.scales[r].pointers[u]!=null;u++)this.model.scales[r].pointers[u].value=parseFloat(this.value());break;case"minimum":for(this.minimum()==""&&this.minimum(0),f=0;this.model.scales[f]!=null;f++)this.model.scales[f].minimum=parseInt(this.minimum());break;case"maximum":for(this.maximum()==""&&this.maximum(100),e=0;this.model.scales[e]!=null;e++)this.model.scales[e].maximum=parseInt(this.maximum());break;case"scales":n.extend(!0,this.model.scales,t[i])}this._init()},_destroy:function(){this._unWireEvents();this.element.empty().removeClass("e-widget")},_init:function(){_gaugeCount=n(".e-circulargauge").length;initialGaugeCount=_gaugeCount;this._scaleRedrawn=!1;this._scalesInitialize();this._trigger("load");this._setTheme();this._initialize();this._wireEvents();this._onWindowResize()},_onWindowResize:function(){(this.model.enableResize||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this.resizeCanvas):this._on(n(window),"resize",this.resizeCanvas))},_initialize:function(){this._androidAnimation=this.isAndroid()&&t.datavisualization.CircularGauge.animationPolyfill;this._initObject(this);this._drawOuterLayer();this.model.legend.visible&&this.model.legend._legendItemHeight>0&&this.model.legend._legendItemWidth>0&&(this._drawLegend(),this._legendDrawn=!0);this._drawScales();this.model.renderComplete&&this._onRenderComplete()},_drawLegend:function(){var u=this.model.legend,n,p=this.GaugeEl,i=20,c=this.model.legend.position.toLowerCase(),l=this.model.legend.alignment.toLowerCase(),y,f=this.model.legend.border.width,e=this.model.width,o=this.model.height,s,a,h;for(n=this.model.legendActualBounds,c=="top"||c=="bottom"?(n.y=c=="top"?f+i:o-n.Height-i,n.x=l=="center"?e/2-n.Width/2:l=="near"?f+i:e-n.Width-i,n.x=n.x+n.Width>e?n.x-Math.abs(n.x+n.Width-e):n.x):(n.x=c=="left"?f+i:e-n.Width-i,n.y=l=="center"?o/2-n.Height/2:l=="near"?f+i:o-n.Height-i,n.y=n.y+n.Height>o?n.y-Math.abs(n.y+n.Height-o):n.y),this._legendBounds=n,this.contextEl.lineWidth=f,this.contextEl.save(),this.contextEl.strokeStyle=this.model.legend.border.color,this.contextEl.strokeRect(n.x,n.y,n.Width,n.Height),this.contextEl.restore(),this.model._legendCollection=[],s=0;s<this.model.scales.length;s++)for(a=this.model.scales[s],h=0;h<a.ranges.length;h++){var r=a.ranges[h],v;r._visible=t.util.isNullOrUndefined(r._visible)?!0:r._visible;t.util.isNullOrUndefined(r.legendText)||(v=this._getLegendSize(r,10),y={Bounds:{Height:v.Height,Width:v.Width},legendStyle:{font:u.font,opacity:u.opacity,BorderColor:u.itemStyle.border.color,BorderWidth:u.itemStyle.border.width},displayText:r.legendText,fill:t.util.isNullOrUndefined(u.fill)?r.backgroundColor:u.fill,ScaleIndex:s,RangeIndex:h,visible:r._visible},this.model._legendCollection.push(y))}this._drawLegendItem(n)},legendMouseClick:function(n){var i,t,u,f,e,o,s,h,r=this.calMousePosition(n);if(this.model.legend.toggleVisibility)for(i=0;i<this.legendRegion.length;i++)t=this.legendRegion[i],u=t.X,f=t.X+t.Width,e=t.Y,o=t.Y+t.Height,r.X>=u&&r.X<=f&&r.Y>=e&&r.Y<=o&&(s={type:"legendItemClick",cancel:!1,data:t,model:this.model},this._trigger("legendItemClick",s),h=this.model.scales[t.item.ScaleIndex].ranges[t.item.RangeIndex]._visible?!1:!0,this.setRangeVisible(t.item.ScaleIndex,t.item.RangeIndex,h))},calMousePosition:function(t){var e=jQuery.uaMatch(navigator.userAgent),r,u,f,o,i;return r=this.GaugeEl[0],i=r.querySelector("canvas"),o=e.browser.toLowerCase(),u=t.pageX-n(i).offset().left,f=t.pageY-n(i).offset().top,{X:u,Y:f}},rangesMouseMove:function(t){var ot=this,a,v,p,w,b,k,d,g,ft,f,r,nt,y,s,tt,h=this.calMousePosition(t),i,e,o,et,it,rt,ut,u,c,l;if(this.model.legend.toggleVisibility&&this._legendDrawn)for(v=0;v<this.legendRegion.length;v++)if(i=this.legendRegion[v],p=i.X,w=i.X+i.Width,b=i.Y,k=i.Y+i.Height,h.X>=p&&h.X<=w&&h.Y>=b&&h.Y<=k){n(this.GaugeEl[0]).css("cursor","pointer");break}else n(this.GaugeEl[0]).css("cursor","default");for(d=h.X,g=h.Y,ft=[],f=this.model.scales[0].startAngle,r=this.model.scales[0].sweepAngle,nt=f*(Math.PI/180),y=0;y<this._rangeCollectionRegions.length;y++)if(i=this._rangeCollectionRegions[y],e=d-i.centerRadius.centerX,o=g-i.centerRadius.centerY,et=i.Radius.endRadius?i.Radius.endRadius:0,f=f<0?f+360:f,r=r<0?r+360:r,it=r-f,rt=-.5*Math.PI+nt,it<0){if(r=r/360,ut=r?2*Math.PI*(r<0?1+r:r):0,u=(Math.atan2(o,e)-rt-ut)%(2*Math.PI),u<0&&(u=2*Math.PI+u),c=Math.PI*(i.Region.startAngle/180),l=Math.PI*(i.Region.endAngle/180),u<=c&&u>=l&&(s=Math.sqrt(Math.pow(Math.abs(e),2)+Math.pow(Math.abs(o),2)),s<=i.Radius.startRadius&&s>i.Radius.endRadius)){a={type:"rangeMouseMove",cancel:!1,data:i,model:this.model};this._trigger("rangeMouseMove",a);break}}else if(u=Math.atan2(o,e)%(2*Math.PI),u<0&&(u=2*Math.PI+u),i.Region.endAngle<i.Region.startAngle?(c=e>0&&o>0?0:Math.PI*(i.Region.startAngle/180),l=e>0&&o>0?Math.PI*(i.Region.endAngle/180):Math.PI*((360+i.Region.endAngle)/180)):(c=Math.PI*(i.Region.startAngle/180),l=Math.PI*(i.Region.endAngle/180)),u>=c&&u<=l&&(s=Math.sqrt(Math.pow(Math.abs(e),2)+Math.pow(Math.abs(o),2)),s<=i.Radius.startRadius&&s>i.Radius.endRadius)){tt=i;a={type:"rangeMouseMove",cancel:!1,data:i,model:this.model};this._trigger("rangeMouseMove",a);break}return tt},_drawLegendItem:function(i){var s=[],e=[],et,nt,r,g,vt;for(this.legendRegion=[],this.model.legend._legendTextMaxHeight=0,this.model.legend._legendTextMaxWidth=0,nt=this.model.legend.position.toLowerCase(),r=0;r<this.model._legendCollection.length;r++){var c=this.model.legend.shape.toLowerCase(),y=10,p=10,w=3,a,v,tt,it,u,b,ot,k,rt,st,ut,ht,ct,o,lt,ft,f,d,h,l,at=10;u=this.model._legendCollection[r];t.util.isNullOrUndefined(u.displayText)||(et={type:"legendItemRender",cancel:!1,data:u,model:this.model},this._trigger("legendItemRender",et),this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible=t.util.isNullOrUndefined(this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible)?!0:this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible,ot=this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible?u.fill:"#808080",ht=this.model.scales[u.ScaleIndex].ranges[u.RangeIndex]._visible?u.legendStyle.font.color:"#808080",ct=this._getFontString(this,u.legendStyle.font),o=this.calcText(u.displayText,i.Width,u.legendStyle.font),this.model.legend._legendTextMaxHeight=Math.max(o.height,this.model.legend._legendTextMaxHeight),this.model.legend._legendTextMaxWidth=Math.max(o.width,this.model.legend._legendTextMaxWidth),lt=this.model.legend.itemStyle.height,ft=this.model.legend.itemStyle.width,f=(lt+ft)/2,d={angle:0,width:f,isFill:!0,isStroke:!0,height:f,lineWidth:this.model.legend.itemStyle.border.width,opacity:u.legendStyle.opacity,strokeStyle:u.legendStyle.BorderColor,fillStyle:ot},y=f>o.height/2?y+f/2:y+o.height/4,p=c=="circle"?p+f/2:p,r==0?(a=p+i.x,v=i.y+y):nt=="top"||nt=="bottom"?(g=e[r-1].x+e[r-1].width+this.model.legend.itemPadding,g+f+w+o.width>=i.x+i.Width?(a=p+i.x,v=this.model.legend._legendTextMaxHeight/2>f?e[r-1].y+s[r-1].actualBounds.height/2+f/2+at:at+s[r-1].actualBounds.y+s[r-1].actualBounds.height/2+f/2):(a=c.toLowerCase()=="circle"?g+f/2:g,v=s[r-1].actualBounds.y)):(yPos=e[r-1].height>f?e[r-1].y+this.model.legend.itemPadding:s[r-1].actualBounds.y+f+this.model.legend.itemPadding,vt=e[r-1].height>f?o.height:f,yPos+vt-2>i.y+i.Height+2?(v=i.y+y,a=s[r-1].actualBounds.x+s[r-1].actualBounds.width+(this.model.legend._legendTextMaxWidth+w)+10):(a=s[r-1].actualBounds.x,v=yPos)),h={startX:a,startY:v},c=c.charAt(0).toUpperCase()+c.slice(1),l=n.extend({},h,!0),l.startX=c.toLowerCase()=="circle"?l.startX-f/2:l.startX,l.startY=l.startY-f/2,s.push({actualBounds:{x:h.startX,y:h.startY,height:f,width:f},item:u}),b={angle:0,width:o.width,isFill:!0,isStroke:!0,height:o.height,textValue:u.displayText,font:ct,fillStyle:ht,opacity:u.legendStyle.opacity,strokeStyle:u.legendStyle.BorderColor},tt=c.toLowerCase()=="circle"?h.startX+ft/2+w:h.startX+d.width+w,it=h.startY+o.height/4,e.push({x:tt,y:it,height:o.height/2,width:o.width}),k=l.startX,st=Math.abs(k+s[r].actualBounds.width-k)+w+Math.abs(e[r].x+e[r].width-e[r].x),f>e[r].height?(rt=l.startY,ut=f):(rt=e[r].y-e[r].height,ut=e[r].height),c.toLowerCase()=="circle"?(style=this._setPointerDimension(d,this),this._contextOpenPath(style,this),this._setContextRotation(style,this),this.contextEl.arc(h.startX,h.startY,f/2,0,2*Math.PI),this._contextClosePath(style,this)):this["_draw"+c](h,d,this),this._contextOpenPath(b,this),this.contextEl.font=b.font,this.contextEl.translate(tt,it),this.contextEl.fillText(b.textValue,0,0),this._contextClosePath(b,this),this.legendRegion.push({X:k,Y:rt,Width:st,Height:ut,item:u}))}},calcText:function(t,r,u){var h=n(document).find("#measureTex"),f,c=null,l=null,a=null,v=null,o,s,e,y;if(n("#measureTex").css("display","block"),h.length==0?(f=document.createElement("text"),n(f).attr({id:"measureTex"}),document.body.appendChild(f)):f=h[0],typeof t=="string"&&(t.indexOf("<")>-1||t.indexOf(">")>-1)){for(o=t.split(" "),s=0;s<o.length;s++)o[s].indexOf("<br/>")==-1&&(o[s]=o[s].replace(/[<>]/g,"&"));t=o.join(" ")}return f.innerHTML=t,u!=i&&u.size==i&&(e=u,e=e.split(" "),c=e[0],l=e[1],a=e[2],v=e[3]),u!=null&&(f.style.fontSize=u.size>0?u.size+"px":u.size?u.size:l,f.style.fontStyle&&(f.style.fontStyle=u.fontStyle?u.fontStyle:c),f.style.fontFamily=u.fontFamily?u.fontFamily:a,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(f.style.fontWeight=u.fontWeight?u.fontWeight:v)),f.style.backgroundColor="white",f.style.position="absolute",f.style.top=-100,f.style.left=0,f.style.visibility="hidden",f.style.whiteSpace="nowrap",r&&(f.style.maxwidth=r+"px"),y={width:f.offsetWidth,height:f.offsetHeight},n("#measureTex").css("display","none"),y},_calculateLegendBounds:function(){var i=this,r=i.model.legend,f=0,a,e=i.model.legend.position.toLowerCase(),o,v,c,u=10,y=i.model.legend.border.width,p=i.model.legend.itemPadding,s,l,h;return s=i.findMaxHeightWidth(),this._gaugeResizeState||t.util.isNullOrUndefined(i.model.legend.size.height)&&t.util.isNullOrUndefined(i.model.legend.size.width)?(h=i.findLegendMax(),l={Height:h.Height,Width:h.Width},i.model.legend.size._height=i.model.legend.size._width=null):parseInt(i.model.legend.size.width)<s.width&&!t.util.isNullOrUndefined(i.model.legend.size.width)||parseInt(i.model.legend.size.height)<s.height&&!t.util.isNullOrUndefined(i.model.legend.size.height)?(h=i.findLegendMax(),l={Height:h.Height,Width:h.Width},i.model.legend.size._height=i.model.legend.size._width=null):(i.model.legend._legendItemHeight=0,i.model.legend._columnWidth=0,i.model.legend._legendItemWidth=0,i.model.legend._rowCount=1,i.model.legend._columnCount=1,i.model.legend._maxWidth=0,i.model.legend._maxHeight=0,i._columnIncreasing=0,i._columnDecreasing=0,n.each(i.model.scales,function(w,b){if(b.showRanges&&(i.scaleIndex=w,b.ranges!=null)){for(i.rangeEl=b.ranges,i.index=0,a=0;a<i.model.scales[i.scaleIndex].ranges.length;a++)t.util.isNullOrUndefined(i.model.scales[i.scaleIndex].ranges[a].legendText)||f++;n.each(b.ranges,function(n,a){i.rangeIndex=n;!t.util.isNullOrUndefined(a.legendText)&&a.legendText.replace(/\s/g,"").length>0&&i.index<f&&(o=i._getLegendSize(a),parseInt(i.model.legend.size.width)?(c=i.index==0?u+y:e=="top"||e=="bottom"?p:u,v=i.index==0?u+y:0,r._legendItemWidth=e=="top"||e=="bottom"?c+o.Width+r._legendItemWidth:c+s.width+r._legendItemWidth,r._legendItemHeight=v+Math.max(o.Height,r._legendItemHeight),i._columnIncreasing++,i._columnDecreasing=Math.max(i._columnDecreasing,i._columnIncreasing),parseInt(i.model.legend.size.width)<=r._legendItemWidth?(i.model.legend._rowCount++,i._columnIncreasing=0,r._legendItemHeight+=e=="top"||e=="bottom"?i.index==f-1?o.Height+u*2:o.Height+u:i.index==f-1?o.Height+u+p:o.Height+p,r._legendItemWidth=e=="top"||e=="bottom"?i.index==f-1?parseInt(i.model.legend.size.width):o.Width+u:s.width+u):i.index==f-1&&i.model.legend._rowCount>1&&(r._legendItemHeight+=u,i.model.legend.size._width=i.model.legend.size.width,parseInt(i.model.legend.size.width)>s.width*(i._columnDecreasing-1)+(i._columnDecreasing-1)*u+u&&(r._legendItemWidth=s.width*(i._columnDecreasing-1)+(i._columnDecreasing-1)*u+u,i.model.legend.size._width=null))):e=="left"||e=="right"?(c=i.index==0?u+y:i.index==f-1?u:0,v=i.index==0?u+y:p,r._legendItemWidth=c+Math.max(s.width,r._legendItemWidth),r._legendItemHeight=v+o.Height+r._legendItemHeight,i.model.legend.size._height=parseInt(i.model.legend.size.height),parseInt(i.model.legend.size.height)<r._legendItemHeight?(i.model.legend._rowCount++,r._legendItemWidth+=i.index==f-1?s.width+u*2:s.width+u,r._legendItemHeight=o.Height+u):f==1&&parseInt(i.model.legend.size.height)>r._legendItemHeight&&(i.model.legend.size._height=null,r._legendItemWidth+=u,r._legendItemHeight+=u)):(h=i.findLegendMax(),l={Height:h.Height,Width:h.Width},i.index=f-1));i.index++})}}),l={Height:r._legendItemHeight,Width:r._legendItemWidth}),l},findLegendMax:function(){var i=this,r;i.model.legend._legendItemHeight=0;i.model.legend._rowWidth=0;i.model.legend._legendItemWidth=0;i.model.legend._rowCount=1;i.model.legend._columnCount=1;i.model.legend._maxWidth=0;i.model.legend._maxHeight=0;var r=i.model.legend,f=0,a,v,y=i.model.legend.position.toLowerCase(),o,h,c,e=20,u=10,p,s=i.model.legend.border.width,l=i.model.legend.itemPadding;return i.model.legend.size._height=i.model.legend.size._width=null,n.each(i.model.scales,function(w,b){if(b.showRanges&&(i.scaleIndex=w,b.ranges!=null)){for(i.rangeEl=b.ranges,i.index=0,a=0;a<i.model.scales[i.scaleIndex].ranges.length;a++)t.util.isNullOrUndefined(i.model.scales[i.scaleIndex].ranges[a].legendText)||f++;n.each(b.ranges,function(n,a){i.rangeIndex=n;t.util.isNullOrUndefined(a.legendText)||(o=i._getLegendSize(a),y=="top"||y=="bottom"?(f!=1?(c=i.index==0?u*2+s:i.index==f-1?u+l:l,h=i.index==0?u:i.index==f-1?u:0):h=c=u*2,r._legendItemHeight=h+Math.max(o.Height,r._legendItemHeight),r._maxHeight=Math.max(o.Height,r._maxHeight),r._legendItemWidth=c+o.Width+r._legendItemWidth,p=i.model.legend._rowCount>1&&i.index==f-1?u:0,i.model.width-(e-s)<=r._legendItemWidth-p?(i.model.legend._rowCount++,r._rowWidth=Math.max(r._rowWidth,r._legendItemWidth-l-o.Width),r._legendItemWidth=i.index==f-1?r._rowWidth<i.model.width-e*2?r._rowWidth:i.model.width-e*2:i.index==0?e+u+s:o.Width+e+u+s,r._legendItemHeight+=r._maxHeight+(u+s)):i.index==f-1&&i.model.legend._rowCount>1&&(r._legendItemWidth=r._rowWidth<i.model.width-e*2?r._rowWidth:i.model.width-e*2)):(f!=1?(h=i.index==0?u+s:i.index==f-1?u+l:l,c=i.index==0?u:i.index==f-1?u*2:0):h=c=u*2,r._legendItemHeight=o.Height+h+r._legendItemHeight,r._legendItemWidth=c+Math.max(o.Width,r._legendItemWidth),r._maxWidth=Math.max(o.Width,r._maxWidth),i.model.height-e<r._legendItemHeight?(i.model.legend._columnCount++,v=i.model.legend._columnCount==2?e:0,r._legendItemHeight=i.index==f-1?i.model.height-e*2:o.Height+e+u+s+v,r._legendItemWidth+=r._maxWidth+u):i.index==f-1&&i.model.legend._columnCount>1&&(r._legendItemHeight=i.model.height-e*2)),i.index++)})}}),{Height:r._legendItemHeight,Width:r._legendItemWidth}},findMaxHeightWidth:function(){var u=this,t=0,i=0,r;return n.each(u.model.scales,function(f,e){n.each(e.ranges,function(n,f){r=u._getLegendSize(f);t=Math.max(r.Height,t);i=Math.max(r.Width,i)})}),{height:t,width:i}},_getLegendSize:function(n){var t,i,r,u,f=this.model.legend.font;return t=(this.model.legend.itemStyle.width+this.model.legend.itemStyle.height)/2,i=this.calcText(n.legendText,null,f),r=Math.max(t,i.height/2),u=t+3+i.width,{Height:r,Width:u}},_scalesInitialize:function(){var t=this;this.model.scales!=null?n.each(this.model.scales,function(i,r){r=t._checkArrayObject(r,i);var u=t._defaultScaleValues();n.extend(u,r);n.extend(r,u)}):this.model.scales=[this._defaultScaleValues()]},_checkArrayObject:function(t,i){var r=this,u;return n.each(t,function(n,t){if(u=typeof n,(u!="string"||u=="string"&&n.indexOf("_")==-1&&n.indexOf("__")==-1)&&typeof t!="function")if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"&&!t.setter&&!t.factory&&!t.key){var f=r._defaultScaleValues();r._LoadIndividualDefaultValues(t,f,typeof n=="number"?i:n)}}),t},_LoadIndividualDefaultValues:function(t,i,r){var u=null,e=this,f;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),f=typeof r,n.each(t,function(n,t){t instanceof Array?e._checkArrayObject(t,r):t!=null&&typeof t=="object"&&(f!="string"||f=="string"&&r.indexOf("_")==-1&&r.indexOf("__")==-1)&&e._LoadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},_initObject:function(i){var a,h,s,l,f,e,u,d,w,b,r,o,k,g,c;for(this._savedPoints=[],this.element.addClass("e-widget"),i.GaugeEl=this.element,i.canvasEl?(i.canvasEl.remove(),i.GaugeEl.empty()):i.canvasEl=n("<canvas><\/canvas>"),a=0,r=0;this.model.scales[r]!=null;r++){for(this.model.scales[r].minimum==null&&(this.model.scales[r].minimum=this.minimum()),this.model.scales[r].maximum==null&&(this.model.scales[r].maximum=this.maximum()),h=0;this.model.scales[r].pointers[h]!=null;h++)this.model.scales[r].pointers[h].value==null&&(this.model.scales[r].pointers[h].value=this.value());for(s=0;this.model.scales[r].customLabels[s]!=null;s++)if(this.model.scales[r].customLabels[s].value!=null&&(a++,i.GaugeEl.find("div").length==0))if(this.model.scales[r].customLabels[s]!=null&&this.model.scales[r].customLabels[s].positionType!=null&&this.model.scales[r].customLabels[s].positionType=="outer")if(i.outerDiv=t.buildTag("div"),i.model.outerCustomLabelPosition=="bottom")i.GaugeEl.append(i.canvasEl),i.GaugeEl.append(i.outerDiv),i.outerDiv.css("text-align","center");else if(i.model.outerCustomLabelPosition!="top"){l=t.buildTag("TABLE");l.css("width","100%");var v=t.buildTag("TR"),y=t.buildTag("TD"),p=t.buildTag("td");i.model.outerCustomLabelPosition=="left"?(y.append(i.outerDiv),p.append(i.canvasEl)):(y.append(i.canvasEl),p.append(i.outerDiv));v.append(y);v.append(p);l.append(v);i.GaugeEl.append(l);i.outerDiv.css({width:this.element.width()-i.model.width})}else i.GaugeEl.append(i.outerDiv),i.GaugeEl.append(i.canvasEl),i.outerDiv.css("text-align","center");else i.GaugeEl.append(i.canvasEl);a==0&&i.GaugeEl.append(i.canvasEl)}if(i.canvasEl.attr("role","presentation"),_gaugeCount==initialGaugeCount&&(initialDivWidth=window.innerWidth),i.canvasEl[0].setAttribute("width",i.model.width),i.canvasEl[0].setAttribute("height",i.model.height),i.centerX=i.canvasEl[0].width/2,i.centerY=i.canvasEl[0].height/2,f=20,this.model.legend.visible){if(this.model.legend.font.color=this.model.theme=="flatdark"?t.util.isNullOrUndefined(this.model.legend.font.color)?"#8c8c8c":this.model.legend.font.color:t.util.isNullOrUndefined(this.model.legend.font.color)?"#282828":this.model.legend.font.color,d=this.model.legend.position.toLowerCase(),u=this._calculateLegendBounds(),u.Height=t.util.isNullOrUndefined(this.model.legend.size._height)?u.Height:parseInt(this.model.legend.size.height),u.Width=t.util.isNullOrUndefined(this.model.legend.size._width)?u.Width:parseInt(this.model.legend.size.width),this.model.legendActualBounds=u,u.Height>0&&u.Width>0){switch(d){case"top":w=i.model.height-(u.Height+f);i.centerY=u.Height+f+w/2;e=w/2-f;break;case"bottom":i.centerY=(i.model.height-(u.Height+f))/2;e=i.centerY-f;break;case"left":b=i.model.width-(u.Width+f);i.centerX=u.Width+f+b/2;e=b/2-f*2;break;case"right":i.centerX=(i.model.width-(u.Width+f))/2;e=i.centerX-f*2}for(r=0;r<this.model.scales.length;r++)o=this.model.scales[r],k=0,this._scaleRedrawn||(o._radius=o.radius),n.each(o.ranges,function(n,t){k+=t.size}),g=k/o.ranges.length,e=Math.abs((e-g)/(r+1)),e=o.radius=o._radius<e?o._radius:e}}else n.each(this.model.scales,function(n,i){i.radius=t.util.isNullOrUndefined(i._radius)?i.radius:i._radius});if(this._isHalfCircle&&this._isHalfCircle())if(i.model.frame.halfCircleFrameEndAngle-i.model.frame.halfCircleFrameStartAngle>=180){if(i.model.frame.halfCircleFrameStartAngle==0)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width/2;break;case"topleft":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"topcenter":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width/2;break;case"middleleft":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomleft":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomcenter":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width/2}else if(i.model.frame.halfCircleFrameStartAngle==90)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2;i.centerX=i.model.width/2+i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2+i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"middleright":i.centerY=i.model.height/2;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomleft":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"bottomright":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomcenter":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width/2+i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==180)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2;break;case"middleleft":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"middleright":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomleft":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner+i.model.radius;break;case"bottomright":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomcenter":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width/2}}else if(i.model.frame.halfCircleFrameStartAngle==270&&i.model.frame.halfCircleFrameEndAngle==90)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2;i.centerX=i.model.width/2-i.model.radius/2;break;case"topleft":i.centerY=i.model.radius+i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.radius+i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"topcenter":i.centerY=i.model.radius+i.model.distanceFromCorner;i.centerX=i.model.width/2-i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2;i.centerX=i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2;i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomleft":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width-(i.model.radius+i.model.distanceFromCorner);break;case"bottomcenter":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width/2-i.model.radius/2}else if(i.model.frame.halfCircleFrameEndAngle-i.model.frame.halfCircleFrameStartAngle<=90)if(i.model.frame.halfCircleFrameStartAngle==0)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width/2-i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"topcenter":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width/2-i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomleft":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomcenter":i.centerY=i.model.height-(i.model.distanceFromCorner+i.model.radius);i.centerX=i.model.width/2-i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==90)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width/2+i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"topcenter":i.centerY=i.model.distanceFromCorner;i.centerX=i.model.width/2+i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2-i.model.radius/2;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomleft":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomcenter":i.centerY=i.model.height-(i.model.radius+i.model.distanceFromCorner);i.centerX=i.model.width/2+i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==180)switch(i.model.gaugePosition){case"center":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width/2+i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2+i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomleft":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.radius+i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width-i.model.distanceFromCorner;break;case"bottomcenter":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width/2+i.model.radius/2}else if(i.model.frame.halfCircleFrameStartAngle==270)switch(i.model.gaugePosition){case"center":i.centerY=i.model.radius/2+i.model.height/2;i.centerX=i.model.width/2-i.model.radius/2;break;case"topleft":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.distanceFromCorner;break;case"topright":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"topcenter":i.centerY=i.model.distanceFromCorner+i.model.radius;i.centerX=i.model.width/2-i.model.radius/2;break;case"middleleft":i.centerY=i.model.height/2+i.model.radius/2;i.centerX=i.model.distanceFromCorner;break;case"middleright":i.centerY=i.model.radius/2+i.model.height/2;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomleft":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.distanceFromCorner;break;case"bottomright":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width-(i.model.distanceFromCorner+i.model.radius);break;case"bottomcenter":i.centerY=i.model.height-i.model.distanceFromCorner;i.centerX=i.model.width/2-i.model.radius/2}(c=i.canvasEl[0],typeof G_vmlCanvasManager!="undefined"&&(c=window.G_vmlCanvasManager.initElement(c)),c&&c.getContext)&&(i.contextEl=i.canvasEl[0].getContext("2d"))},_browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},_wireEvents:function(){var f=jQuery.uaMatch(navigator.userAgent),r=this._browserInfo(),i=r.isMSPointerEnabled,t=r.pointerEnabled,u;this.startEv=i?t?"pointerdown":"MSPointerDown":"touchstart mousedown";this.endEv=i?t?"pointerup":"MSPointerUp":"touchend mouseup";this.moveEv=i?t?"pointermove":"MSPointerMove":"touchmove mousemove";this.leaveEv=i?t?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.scrollEv=f.browser.toLowerCase()=="mozilla"?t?"mousewheel":"DOMMouseScroll":"mousewheel";this.model.browserInfo=r;u=this.model.readOnly?"pan-y pan-x":"none";n(this.element).css("touch-action",u);this.onMouseMoveHandler=n.proxy(this._onMouseMove,this);this.onMouseUpHandler=n.proxy(this._onMouseUp,this);this.onMouseDownHandler=n.proxy(this._onMouseDown,this);this.onHoverOCustomLabel=n.proxy(this._onHoverOCustomLabel,this);this.onLeaveOCustomLabel=n.proxy(this._onLeaveOCustomLabel,this);this.model.legend.visible&&this._on(n(this.canvasEl),"click",this.legendMouseClick);this._on(n(this.canvasEl),"mousemove",this.rangesMouseMove);(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&(n(this.canvasEl).bind(this.moveEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.scrollEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.startEv,this.onMouseDownHandler),n(this.canvasEl).bind(this.endEv,this.onLeaveOCustomLabel),n(this.canvasEl).bind(this.leaveEv,this.onLeaveOCustomLabel));this.model.readOnly||n(this.canvasEl).bind(this.startEv,this.onMouseDownHandler);this.model.tooltip.showCustomLabelTooltip&&(n("."+this._id+"outercustomlbl").bind("mouseenter",this.onHoverOCustomLabel),n("."+this._id+"outercustomlbl").bind("this.leaveEv",this.onLeaveOCustomLabel))},_unWireEvents:function(){n(this.canvasEl).unbind(this.startEv,this.onMouseDownHandler)},_onHoverOCustomLabel:function(n){(n.currentTarget.innerHTML!=null||n.currentTarget.innerHTML!="")&&this._showTooltip(n,n.currentTarget.innerHTML)},_onLeaveOCustomLabel:function(t){this.isTouch(t)?(this._performTooltip(t),window.clearTimeout(this.model.timer),this.model.timer=setTimeout(function(){n(".tooltipDiv").fadeOut(500)},1200)):this._hideTooltip()},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_showTooltip:function(t,i){var e=this.model.locale,o=e&&this.model.enableGroupSeparator?i.toLocaleString(e):i.toString(),r=n(".tooltipDiv"),s;r.length==0&&(r=n("<div class='tooltipDiv' style='pointer-events:none; position: absolute; z-index: 105; display: block;'><\/div>"),n(document.body).append(r));this.model.tooltip.templateID!=""&&this.model.tooltip.templateID!=null?(s=n("#"+this.model.tooltip.templateID).clone(),n(".tooltipDiv")[0].innerHTML="",n(s).css("display","block").appendTo(r),n(r).css({"pointer-events":"none","background-color":this.model.backgroundColor,border:"1px solid #bbbcbb","border-radius":"3px",color:"#565656"}),r.html(r.html().replace("#label#",o))):(n(r).html(o),n(r).css({"pointer-events":"none","background-color":"white",border:"2px solid #bbbcbb",position:"absolute",padding:"10px 20px","margin-top":"5px","text-align":"left",font:"12px Segoe UI","font-stretch":"condensed",display:"inline-block","border-radius":"3px",color:"#565656",width:"auto"}));var h=10,u=t.pageX+h,f=t.pageY+h;u=u+n(r).width()<this.model.width?u:u-n(r).width();f=f+n(r).height()<this.model.height?f:f-n(r).height();n(r).css("left",u);n(r).css("top",f);n(".tooltipDiv").show()},_hideTooltip:function(){n(".tooltipDiv").remove()},_onMouseDown:function(t){this._blockDefaultActions(t);this._mouseDown=!0;var s=this.isTouch(t)?10:0,o=t.originalEvent.touches?t.originalEvent.touches[0]:t,u={x:this.centerX,y:this.centerY},f={x:o.pageX-n(this.canvasEl).offset().left,y:o.pageY-n(this.canvasEl).offset().top},h=180*this._getCirucumferenceAngle(u,f)/Math.PI,r,e,i=this;this.model.readOnly||n.each(this.model.scales,function(t,o){i.scaleIndex=t;o.pointers!=null&&(i.pointerEl=o.pointers,r=o.radius,e=o.ticks[0].height,n.each(o.pointers,function(t,c){var l;i._isHalfCircle()&&(o.showBackNeedle=!1);l=i._getAngle(c.value);l>360&&(l=l-360);var v=l+c.width,y=l-c.width,a=Math.sqrt((f.x-u.x)*(f.x-u.x)+(f.y-u.y)*(f.y-u.y)),p=a<(c.placement=="far"?r+c.width+c.distanceFromScale:c.placement=="center"?r-c.distanceFromScale:r-15-e-c.distanceFromScale)&&a>(c.placement=="far"?r+c.distanceFromScale:c.placement=="center"?r-c.width-c.distanceFromScale:r-c.width-15-e-c.distanceFromScale),w=c.type=="needle"?a<=c.length:p;i._isBetween(y,v,h,s)&&w&&(i._onMouseClick(l,o.value),i.activeElement=c,n(document).bind(i.moveEv,i.onMouseMoveHandler),n(document).bind(i.endEv,i.onMouseUpHandler))}))})},_onMouseUp:function(){this._mouseDown=!1;n(document).unbind(self.moveEv,self.onMouseMoveHandler);n(document).unbind(self.endEv,self.onMouseUpHandler);this.activeElement&&this._onMouseClickUp(this._getAngle(this.activeElement.value),this.activeElement.value);this.activeElement=null},_mousePosition:function(n){if(!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=i){if(!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},_calTouchPosition:function(n){var i=jQuery.uaMatch(navigator.userAgent),t=this._mousePosition(n);n.pageX=t.x;n.pageY=t.y},getEvent:function(n){return n.targetTouches&&n.targetTouches[0]?n.targetTouches[0]:n},_onMouseMove:function(i){if(this._mouseDown&&!t.isNullOrUndefined(this.activeElement)){this._blockDefaultActions(i);var f={x:this.centerX,y:this.centerY},u=i.originalEvent.touches?i.originalEvent.touches[0]:i,e={x:u.pageX-n(this.canvasEl).offset().left,y:u.pageY-n(this.canvasEl).offset().top},r=180*this._getCirucumferenceAngle(f,e)/Math.PI;r<this.scaleEl[this.scaleIndex].startAngle&&!this._isHalfCircle()&&(r=r+360);this._onMouseClickMove(this._getAngle(this.activeElement.value),this.activeElement.value);this._getValue(r)<=this.scaleEl[this.scaleIndex].maximum&&(this.activeElement.value=this.scaleEl[this.scaleIndex].direction=="clockwise"?this._getValue(r):this.scaleEl[this.scaleIndex].maximum-this._getValue(r));this.contextEl.putImageData?this._reDrawPointer():this._init()}else(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&!this.isTouch(i)&&this._performTooltip(i)},_performTooltip:function(t){for(var r,u=!1,f=10,o=this.isTouch(t),i=0;this._savedPoints[i]!=null;i++)if(o){var c=this._calTouchPosition(t),e=this.getEvent(t),s=e.pageX,h=e.pageY,r={X:s-n(this.canvasEl).offset().left,Y:h-n(this.canvasEl).offset().top};r.X>this._savedPoints[i].startX-f&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width+f&&r.Y>this._savedPoints[i].startY-f&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height+f?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()}else r={X:t.pageX-n(this.canvasEl).offset().left,Y:t.pageY-n(this.canvasEl).offset().top},r.X>this._savedPoints[i].startX&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width&&r.Y>this._savedPoints[i].startY&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()},_isHalfCircle:function(){return this.model.frame.frameType=="halfcircle"?!0:!1},_calFontLength:function(t){var i=this.model.scales[0].minimum+this.model.scales[0].labels[0].unitText,r=this.model.scales[0].maximum+this.model.scales[0].labels[0].unitText,u=r.length>i.length?r:i,f=n('<span id="test"><\/span>').css({font:t,display:"none",whiteSpace:"nowrap"}).appendTo(n("body")).text(u).width();return n("#test").remove(),f/2},_getHalfCircleYPosition:function(){return this._getYCordinate(this.centerY,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2)},_getHalfCircleXPosition:function(){return this._getXCordinate(this.centerX,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2)},_getXCordinate:function(n,t,i){return n+t*Math.cos(Math.PI*(i/180))},_getYCordinate:function(n,t,i){return n+t*Math.sin(Math.PI*(i/180))},_getAngle:function(n){var t;return t=n>=this.scaleEl[this.scaleIndex].minimum&&n<=this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].direction=="clockwise"?n-this.scaleEl[this.scaleIndex].minimum:this.scaleEl[this.scaleIndex].maximum-n:this.scaleEl[this.scaleIndex].direction=="clockwise"?n<=this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:this.scaleEl[this.scaleIndex].maximum:n<=this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].maximum:this.scaleEl[this.scaleIndex].minimum,t*(this.scaleEl[this.scaleIndex].sweepAngle/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum))+this.scaleEl[this.scaleIndex].startAngle},_subtractDecimal:function(n,t){var r=n.toString(),u=t.toString(),f,e,i,o;return f=r.indexOf(".")>-1?r.length-r.indexOf(".")-1:0,e=u.indexOf(".")>-1?u.length-u.indexOf(".")-1:0,i=f>e?f:e,o=(n*Math.pow(10,i)-t*Math.pow(10,i))/Math.pow(10,i),o},_getCirucumferenceAngle:function(n,t){return t.x>n.x?t.y>n.y?this._tangent(n,t):t.y==n.y?0:2*Math.PI+this._tangent(n,t):t.x==n.x?t.y==n.y?0:t.y>n.y?Math.PI/2:1.5*Math.PI:t.y==n.y?Math.PI:t.y>n.y?Math.PI+this._tangent(n,t):Math.PI+this._tangent(n,t)},_calcDistanceFactor:function(n,t,i){var r;return r=n>240&&n<=300||n>60&&n<=120?0:n>330&&n<=360||n>=0&&n<=30?-i*.5:n>30&&n<=60||n>300&&n<=330?-i/2:n>150&&n<=210?i*.5:i/2,t=="far"?-r:r},_tangent:function(n,t){var i=(t.y-n.y)/(t.x-n.x);return Math.atan(i)},_getValue:function(n){return this.scaleEl[this.scaleIndex].direction=="counterclockwise"?(n-this.scaleEl[this.scaleIndex].startAngle)/this.scaleEl[this.scaleIndex].sweepAngle*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum):(n-this.scaleEl[this.scaleIndex].startAngle)/this.scaleEl[this.scaleIndex].sweepAngle*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)+this.scaleEl[this.scaleIndex].minimum},_drawScales:function(){var r=this,u,i,f,t;if(this.scaleEl=this.model.scales,n.each(this.model.scales,function(n,t){r.scaleIndex=n;t.showScaleBar&&r._setScaleCordinates(t)}),this.model.rangeZOrder=="rear"?(this._setRanges(),this._setTicks()):(this._setTicks(),this._setRanges()),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this.contextEl.putImageData||(this.model.enableAnimation=!1),this.model.animationSpeed!=null&&this.model.animationSpeed>0&&(u=this.model.animationSpeed/25,u>=0&&(i=navigator.userAgent.toLowerCase(),f=i.indexOf("msie")!=-1?parseInt(i.split("msie")[1]):0,this.model.enableAnimation&&f!=9))){for(t=0;t<this.model.scales[0].pointers.length;t++)this.pointerValue=[],this.currentValue=[],this.pointerValue[t]=null,this.currentValue[t]=null,this.updatePointerOnAnimation=!1;this.dt=(new Date).getTime();this._onAnimate(this)}this._setIndicators()},_setTicks:function(){var t=this;n.each(this.model.scales,function(i,r){r.showTicks&&(t.scaleIndex=i,r.ticks!=null&&(t.tickEl=r.ticks,n.each(r.ticks,function(n,i){t.tickIndex=n;t._setTicksCordinates(n,i)})))})},_setLabels:function(){var t=this;n.each(this.model.scales,function(i,r){r.showLabels&&(t.scaleIndex=i,r.labels!=null&&(t.labelEl=r.labels,n.each(r.labels,function(n,i){t.labelIndex=n;t._setLabelCoridnates(n,i)})))})},_setIndicators:function(){var t=this;n.each(this.model.scales,function(i,r){r.showIndicators&&(t.scaleIndex=i,r.indicators!=null&&(t.indicatorEl=r.indicators,n.each(r.indicators,function(n,i){t.indicatorIndex=n;t._drawIndicator(n,i)})))})},_setPointers:function(){var t=this;n.each(this.model.scales,function(i,r){r.showPointers&&(t.scaleIndex=i,r.pointers!=null&&(t.pointerEl=r.pointers,n.each(r.pointers,function(n,i){t._isHalfCircle()&&(r.showBackNeedle=!1);t.pointerIndex=n;t._drawPointers(n,i)})))})},_onAnimate:function(n){if(!this._androidAnimation){for(var o=n,i=o,s=i.model.animationSpeed/25,u,f,h=n.model.scales[0].pointers.length,e=[],r=0;r<h;r++)e[r]=!0,i.model.scales[0].pointers[r]._value||(i.model.scales[0].pointers[r]._value=i.model.scales[0].pointers[r].value),i.pointerValue[r]=t.util.isNullOrUndefined(i.pointerValue[r])?i.model.scales[0].pointers[r]._value:i.pointerValue[r],i.currentValue[r]=i.currentValue[r]?i.currentValue[r]:i.model.scales[0].minimum,u=i.pointerValue[r],now=(new Date).getTime(),delta=now-i.dt,delta>s&&u>i.currentValue[r]?(i.currentValue[r]=i.currentValue[r]+(i.model.scales[0].maximum-i.model.scales[0].minimum)/100,i.updatePointerOnAnimation=!0,u>i.currentValue[r]?i.setPointerValue(0,r,i.currentValue[r]):i.setPointerValue(0,r,u),i.dt=now-delta%s):i.currentValue>=u&&(e[r]=!1);for(f=0;f<e.length;f++)if(animationFlag=e[f],animationFlag)break;animationFlag&&requestAnimationFrame(function(){o._onAnimate(o)})}},_pointInterval:function(n,t,i,r){this.timer=setTimeout(function(){t>n?(n=n+(r.model.scales[0].maximum-r.model.scales[0].minimum)/100,t>n?r.setPointerValue(0,0,n):r.setPointerValue(0,0,t)):n>=t&&window.clearInterval(r.timer);r._pointInterval(n,t,i,r)},i)},_setRanges:function(){var t=this;this._rangeCollectionRegions=[];n.each(this.model.scales,function(i,r){r.showRanges&&(t.scaleIndex=i,r.ranges!=null&&(t.rangeEl=r.ranges,n.each(r.ranges,function(n,i){t.rangeIndex=n;(i._visible||!t.model.legend.visible)&&t._setRangeCordinates(n,i)})))})},_setCustomLabel:function(){var t=this,i;n.each(this.model.scales,function(r,u){t.scaleIndex=r;u.customLabels!=null&&(t.customLabelEl=u.customLabels,n.each(u.customLabels,function(n,r){t.customLabelIndex=n;i=t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex];i.value!=null&&(i.positionType=="outer"?t._setOuterCustomLabels(n,r):t._setCustomLabelCordinates(n,r))}))})},_subGauge:function(){var t=this;n.each(this.model.scales,function(i,r){t.scaleIndex=i;r.subGauges!=null&&(t.subGaugeEl=r.subGauges,n.each(r.subGauges,function(n,r){t.subGaugeIndex=i;t._setSubGauge(n,r)}))})},_setOuterCustomLabels:function(n,i){var r,u;this._customLblMaxSize=this._customLblMaxSize<parseFloat(i.font.size.match(/\d+/)[0])?parseFloat(i.font.size.match(/\d+/)[0]):this._customLblMaxSize;r=t.buildTag("div."+this._id+"outercustomlbl");r.text(this.model.scales[this.scaleIndex].customLabels[n].value);u=this.model.outerCustomLabelPosition=="right"||this.model.outerCustomLabelPosition=="left"?"left":"center";this.outerDiv.append(r);this.outerDiv.append("<\/br>");u=="center"?r.css({display:"inline-block",margin:"0 auto","max-width":this.model.width}):r.css({display:"inline-block","max-width":this.element.width()-this.model.width>10?this.element.width()-this.model.width:10});r.css({color:i.color,overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":i.font!=null&&i.font.size!=null?i.font.size:"12px","font-family":i.font!=null&&i.font.fontFamily!=null?i.font.fontFamily:"Arial","font-weight":i.font!=null&&i.font.fontStyle!=null?i.font.fontStyle:"Normal","text-align":u})},_setScaleCordinates:function(n){if(this.region={centerX:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,centerY:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,startAngle:n.startAngle,endAngle:n.startAngle+n.sweepAngle,startRadius:this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2,endRadius:this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2},this.style={radius:n.radius-n.size/2,strokeStyle:n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color),lineWidth:n.border.width,size:n.size,isFill:!0,opacity:isNaN(n.opacity)?1:n.opacity,isStroke:!0,shadowOffset:n.shadowOffset,fillStyle:n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor),counterClockwise:n.direction=="clockwise"?!1:!0},n.maximum<n.minimum){var t=n.maximum;n.maximum=n.minimum;n.minimum=t}n.maximum==n.minimum&&(n.maximum=n.maximum+1);this.maximum(n.maximum);this.minimum(n.minimum);this._notifyArrayChange&&(this._notifyArrayChange("scales["+this.scaleIndex+"]maximum",n.maximum),this._notifyArrayChange("scales["+this.scaleIndex+"]minimum",n.minimum));this._drawScaleBar(this.region,this.style);this.contextEl.getImageData&&(this.scaleImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawOuterLayer:function(){var n,i,r;this._isHalfCircle()&&(i={x:this.centerX,y:this.centerY},r={x:this.centerX+this.model.radius,y:this.centerY/2});n=this.model.isRadialGradient?this.contextEl.createRadialGradient(this.canvasEl[0].width/2,this.canvasEl[0].height/2,0,this.canvasEl[0].width/2,this.canvasEl[0].height/2,this.model.radius):this.contextEl.createLinearGradient(0,0,0,this.canvasEl[0].height);t.isNullOrUndefined(this.model.interiorGradient)||this._setGradientColor(this,n,this.model.interiorGradient.colorInfo);this.frameOuterLocation={centerX:this.centerX,hcCenterX:this.centerX,hcCenterY:this.centerY,centerY:this.centerY,startAngle:this._isHalfCircle()?Math.PI*(this.model.frame.halfCircleFrameStartAngle/180):0,endAngle:this._isHalfCircle()?Math.PI*(this.model.frame.halfCircleFrameEndAngle/180):2*Math.PI};this._isHalfCircle()&&(this.frameInnerLocation={centerX:this.centerX,hcCenterX:this._getXCordinate(this.centerX,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2),hcCenterY:this._getYCordinate(this.centerX,0,(this.model.frame.halfCircleFrameStartAngle+this.model.frame.halfCircleFrameEndAngle)/2),centerY:this.centerY,startAngle:Math.PI*(this.model.frame.halfCircleFrameStartAngle/180),endAngle:Math.PI*(this.model.frame.halfCircleFrameEndAngle/180)});this.frameInnerStyle={radius:this.model.radius,isStroke:!1,isFill:!0,fillStyle:this.model.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(null,this.model.backgroundColor),counterClockwise:!1};this.model.frame.frameType=="fullcircle"?this._drawCircleFrame(this.frameOuterLocation,this.frameInnerStyle):this.model.frame.frameType=="halfcircle"&&this._drawHalfCircle(this.frameInnerLocation,this.frameInnerStyle);this.contextEl.getImageData&&(this.outerImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setTicksCordinates:function(n,t){var e,o,s,h,f,r,i,u;for(t.type=="major"?(f=this.scaleEl[this.scaleIndex].majorIntervalValue,this.majorTickHeight=t.height):f=this.scaleEl[this.scaleIndex].minorIntervalValue,t.placement=="far"&&(r=this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+this.scaleEl[this.scaleIndex].border.width/2+t.distanceFromScale),t.placement=="center"&&(r=this.scaleEl[this.scaleIndex].radius-t.height/2-this.scaleEl[this.scaleIndex].border.width/2-t.distanceFromScale),t.placement=="near"&&(r=this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-this.scaleEl[this.scaleIndex].border.width/2-t.distanceFromScale),s=t.placement=="near"?-t.height:t.height,u=this.scaleEl[this.scaleIndex].maximum;u>=this.scaleEl[this.scaleIndex].minimum;u-=f)(f==this.scaleEl[this.scaleIndex].minorIntervalValue&&u%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||f==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(u==this.scaleEl[this.scaleIndex].minimum&&(h=!0),i=this._getAngle(u),i=i>360?i-360:i,e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,r,i),o=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,r,i),this.region={startX:e,startY:o},this.style={angle:t.angle+i,isStroke:!0,isFill:!1,lineHeight:s,lineWidth:t.width,strokeStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawTicks&&this._onDrawTicks(i,u),this._drawTickMark(this.region,this.style));h||(i=this._getAngle(this.scaleEl[this.scaleIndex].minimum),i=i>360?i-360:i,e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,r,i),o=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,r,i),this.region={startX:e,startY:o},this.style={angle:t.angle+i,isStroke:!0,isFill:!1,lineHeight:s,lineWidth:t.width,strokeStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)});this.contextEl.getImageData&&(this.tickImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setLabelCoridnates:function(n,t){var s,f,e,h,c,o,u,r,i;for(o=t.type=="major"?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,c=t.type=="major"?this.majorIntervalAngle=this.scaleEl[this.scaleIndex].sweepAngle/((this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)/o):this.scaleEl[this.scaleIndex].sweepAngle/((this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)/o),t.placement=="far"&&(u=this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+this.majorTickHeight+t.distanceFromScale),t.placement=="center"&&(u=this.scaleEl[this.scaleIndex].radius-10-t.distanceFromScale),t.placement=="near"&&(u=this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-10-this.majorTickHeight-t.distanceFromScale),this._labelRadius=u,r=this.scaleEl[this.scaleIndex].maximum;r>=this.scaleEl[this.scaleIndex].minimum;r=this._subtractDecimal(r,o))if(r==this.scaleEl[this.scaleIndex].minimum&&(s=!0),o==this.scaleEl[this.scaleIndex].minorIntervalValue&&r%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||o==this.scaleEl[this.scaleIndex].majorIntervalValue){if(r==this.scaleEl[this.scaleIndex].minimum&&!t.includeFirstValue)continue;i=this._getAngle(r);i=i>360?i-360:i;f=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,i);e=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,i);this.region={startX:f,startY:e};this.style={placement:t.placement,textPositionAngle:i,angle:this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?i+t.angle:t.angle,isStroke:!1,isFill:!0,textValue:r,opacity:t.opacity?t.opacity:1,font:this._getFontString(t,t.font),fillStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)};this.model.drawLabels&&this._onDrawLabels(this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?i+t.angle:t.angle,r);this._drawLabel(this.region,this.style,!1);this.model.tooltip.showLabelTooltip&&this._savedPoints.push({startX:f-10,startY:e-5,width:20,height:parseInt(t.font.size.replace(/\D/g,"")),value:r})}s||(i=this._getAngle(this.scaleEl[this.scaleIndex].minimum),i=i>360?i-360:i,f=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,i),e=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,i),this.region={startX:f,startY:e},this.style={angle:this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?i+t.angle:t.angle,isStroke:!1,isFill:!0,textValue:this.scaleEl[this.scaleIndex].minimum,opacity:t.opacity?t.opacity:1,font:this._getFontString(t,t.font),lineHeight:h,lineWidth:t.width,fillStyle:t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawLabels&&this._onDrawLabels(i,r),this._drawLabel(this.region,this.style,!1),this.model.tooltip.showLabelTooltip&&this._savedPoints.push({startX:f-10,startY:e-5,width:20,height:parseInt(t.font.size.replace(/\D/g,"")),value:r}),i=this._getAngle(r),i=i>360?i-360:i);this.contextEl.getImageData&&(this.labelImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setRangeCordinates:function(n,i){if(i.startValue<this.scaleEl[this.scaleIndex].maximum&&i.endValue<=this.scaleEl[this.scaleIndex].maximum){var o=i.startValue>=this.scaleEl[this.scaleIndex].minimum?i.startValue:this.scaleEl[this.scaleIndex].minimum,s=i.endValue>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:i.endValue,h,c,l,a,r,u,f,v,y,e,p;p=this._getAngle((o+s)/2);r=this._getAngle(o);f=this._getAngle(s);u=this.scaleEl[this.scaleIndex].radius-i.distanceFromScale-this.scaleEl[this.scaleIndex].size/2-i.size-(t.isNullOrUndefined(this.scaleEl[this.scaleIndex].ticks[0])?16:this.scaleEl[this.scaleIndex].ticks[0].height);v=this.scaleEl[this.scaleIndex].radius-i.distanceFromScale-this.scaleEl[this.scaleIndex].size/2-(t.isNullOrUndefined(this.scaleEl[this.scaleIndex].ticks[0])?16:this.scaleEl[this.scaleIndex].ticks[0].height);y=this.scaleEl[this.scaleIndex].radius-i.distanceFromScale-i.size-this.scaleEl[this.scaleIndex].size/2-(t.isNullOrUndefined(this.scaleEl[this.scaleIndex].ticks[0])?16:this.scaleEl[this.scaleIndex].ticks[0].height);h=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,r);c=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,r);l=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,u,f);a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,u,f);r=180*this._getCirucumferenceAngle({x:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,y:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY},{x:h,y:c})/Math.PI;f=180*this._getCirucumferenceAngle({x:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,y:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY},{x:l,y:a})/Math.PI;!t.isNullOrUndefined(i.gradients)&&i.gradients.colorInfo.length>0?(e=this.contextEl.createRadialGradient(this.centerX,this.centerY,y,this.centerX,this.centerY,v),this._setGradientColor(this,e,i.gradients.colorInfo)):e=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.backgroundColor);this.region={startX:h,startY:c,endX:l,endY:a,startAngle:r,endAngle:f};this.style={placement:i.placement,radius:i.placement=="near"?this.scaleEl[this.scaleIndex].radius-i.distanceFromScale:this.scaleEl[this.scaleIndex].radius+i.distanceFromScale,rangeStart:o,rangeEnd:s,startWidth:i.startWidth,isFill:!0,fillStyle:e,strokeStyle:i.border.color=="transparent"?"rgba(0,0,0,0)":i.border.color,opacity:isNaN(i.opacity)?1:i.opacity,counterClockwise:this.scaleEl[this.scaleIndex].direction=="clockwise"?!1:!0,startRadius:v,endRadius:y,endWidth:i.endWidth,lineWidth:i.border.width,isStroke:!0};this.model.drawRange&&this._onDrawRange(this.region,this.style);this._rangeCollectionRegions.push({Range:i,Region:this.region,scaleIndex:this.scaleIndex,rangeIndex:this.rangeIndex,Radius:{startRadius:this.style.startRadius,endRadius:this.style.endRadius},centerRadius:{centerX:this.centerX,centerY:this.centerY,radius:this.style.radius}});this._drawRange(this.region,this.style);this.contextEl.getImageData&&(this.rangeImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))}},_setSubGauge:function(t,i){var r=n("div[id="+i.controlID+"]"),u;r.length>0&&r.find("canvas").length&&(u=r.find("canvas")[0].getContext("2d"),this.contextEl.drawImage(u.canvas,i.position.x,i.position.y,i.width,i.height),r.css("display","none"),this.contextEl.getImageData&&(this.subGaugeImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height)))},_setCustomLabelCordinates:function(n,i){this._customLblMaxSize=this._customLblMaxSize<parseFloat(i.font.size.match(/\d+/)[0])?parseFloat(i.font.size.match(/\d+/)[0]):this._customLblMaxSize;i.color=i.color?i.color:"#282828";this.region=i.position?{startX:i.position.x,startY:i.position.y}:{startX:0,startY:0};this.style={angle:i.textAngle,textValue:i.value,fillStyle:i.color=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.color),font:this._getFontString(i,i.font)};this.model.drawCustomLabel&&this._onDrawCustomLabel(this.region,this.style);this._drawLabel(this.region,this.style,!0);this.model.tooltip.showCustomLabelTooltip&&this._savedPoints.push({startX:this.region.startX-30,startY:this.region.startY-5,width:60,height:t.isNullOrUndefined(i.font)?10:parseInt(i.font.size.replace(/\D/g,"")),value:this.style.textValue});this.contextEl.getImageData&&(this.customLabelImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawIndicator:function(i,r){var u=this,e=!1,f;this.region={centerX:r.position.x-r.width/2,textLocation:r.position,centerY:r.position.y-r.height/2,startAngle:0,endAngle:2*Math.PI};this.style={radius:(r.height+r.width)/2,strokeStyle:"#2BA104",cornerRadius:r.type=="roundedrectangle"?2:0,height:r.height,width:r.width,lineWidth:r.indicatorBorderWidth,fillStyle:"#2BA104",isStroke:!0,isFill:!0,indicatorText:r.indicatorText,textColor:null,font:null,counterClockwise:!1};this.model.drawIndicators&&this._onDrawIndicators(this.style,this.region);r.type==t.datavisualization.CircularGauge.IndicatorType.Image?(f=new Image,f.onload=function(){u.contextEl.drawImage(this,r.position.x,r.position.y)},f.src=r.imageUrl):r.stateRanges!=null&&n.each(r.stateRanges,function(n,i){u.pointerEl[u.pointerIndex].value>=i.startValue&&u.pointerEl[u.pointerIndex].value<=i.endValue&&(e=!0,!t.isNullOrUndefined(i.text)&&i.text.length>0&&(u.style.indicatorText=i.text,u.style.textColor=i.textColor=="transparent"?"rgba(0,0,0,0)":i.textColor,u.style.font=r.font),u.style.strokeStyle=i.borderColor=="transparent"?"rgba(0,0,0,0)":i.borderColor,u.style.fillStyle=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":i.backgroundColor,u._drawIndicatorFrame(r.type,u.region,u.style))});e||r.type==t.datavisualization.CircularGauge.IndicatorType.Image||u._drawIndicatorFrame(r.type,u.region,u.style);this.contextEl.getImageData&&r.type!=t.datavisualization.CircularGauge.IndicatorType.Image&&(this.indicatorImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawIndicatorFrame:function(n,t,i){switch(n){case"circle":this._drawCircleFrame(t,i);break;case"roundedrectangle":case"rectangle":this._drawRectangleFrame(t,i);break;case"text":this._drawText(t,i)}},_drawScaleBar:function(n,t){this.contextEl.shadowColor=t.strokeStyle=="transparent"?"rgba(0,0,0,0)":t.strokeStyle;t.shadowOffset&&(this.contextEl.shadowBlur=t.shadowOffset);this._contextOpenPath(t,this);n.endAngle-n.startAngle==0?this.contextEl.arc(n.centerX,n.centerY,n.startRadius,Math.PI*0,Math.PI*0,!1):(n.endAngle-n.startAngle)%360==0?(this.contextEl.arc(n.centerX,n.centerY,n.startRadius,Math.PI*0,Math.PI*2,!1),this.contextEl.arc(n.centerX,n.centerY,n.endRadius,Math.PI*2,Math.PI*0,!0)):(this.contextEl.arc(n.centerX,n.centerY,n.startRadius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),!1),this.contextEl.arc(n.centerX,n.centerY,n.endRadius,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!0));this._contextClosePath(t,this)},_drawTickMark:function(n,t){this._contextOpenPath(t,this);this.contextEl.translate(n.startX,n.startY);this.contextEl.lineTo(0,0);this.contextEl.rotate(Math.PI*(t.angle/180));this.contextEl.lineTo(t.lineHeight,0);this._contextClosePath(t,this)},_drawLabel:function(n,i,r){var f=0,e=this.model.locale,u;t.isNullOrUndefined(r)||r||(u=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitTextPosition,i.textValue=i.textValue%1!=0?+parseFloat(i.textValue.toFixed(3)):i.textValue,i.textValue=e&&this.model.enableGroupSeparator?i.textValue.toLocaleString(e):i.textValue,t.isNullOrUndefined(u)||u.toString()!="back"?t.isNullOrUndefined(u)||u.toString()!="front"||(i.textValue=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText+i.textValue):i.textValue+=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText,f=this._calcDistanceFactor(i.textPositionAngle,i.placement,this._calFontLength(i.font)));this._contextOpenPath(i,this);this.contextEl.textAlign="center";this.contextEl.textBaseline="middle";this.contextEl.font=i.font;this.contextEl.translate(n.startX+f,n.startY);this.contextEl.lineTo(0,0);r?r&&i.angle!=0&&this.contextEl.rotate(Math.PI*(i.angle/180)):this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?this.contextEl.rotate(Math.PI*((i.angle-270)/180)):this.contextEl.rotate(Math.PI*(i.angle/180));this.contextEl.fillText(i.textValue,0,0);this._contextClosePath(i,this)},_drawCircleFrame:function(n,t){this._contextOpenPath(t,this);this.contextEl.arc(n.centerX,n.centerY,t.radius,n.startAngle,n.endAngle,t.counterClockwise);this._contextClosePath(t,this);t.indicatorText&&this._drawText(n,t)},_drawHalfCircle:function(n,t){this._contextOpenPath(t,this);this.contextEl.lineJoin="round";this.contextEl.arc(n.centerX,n.centerY,t.radius,n.startAngle,n.endAngle,!1);this.contextEl.lineTo(n.centerX,n.centerY);this._contextClosePath(t,this)},_drawRectangleFrame:function(n,t){this._contextOpenPath(t,this);this.contextEl.translate(n.centerX,n.centerY-t.height/2);this.contextEl.lineTo(t.cornerRadius,0);this.contextEl.lineTo(t.width-t.cornerRadius,0);this.contextEl.quadraticCurveTo(t.width,0,t.width,t.cornerRadius);this.contextEl.lineTo(t.width,t.height-t.cornerRadius);this.contextEl.quadraticCurveTo(t.width,t.height,t.width-t.cornerRadius,t.height);this.contextEl.lineTo(t.cornerRadius,t.height);this.contextEl.quadraticCurveTo(0,t.height,0,t.height-t.cornerRadius);this.contextEl.lineTo(0,t.cornerRadius);this.contextEl.quadraticCurveTo(0,0,t.cornerRadius,0);this._contextClosePath(t,this);t.indicatorText&&this._drawText(n,t)},_drawText:function(n,t){this.contextEl.beginPath();this.contextEl.textAlign="center";this.contextEl.fillStyle=t.textColor=="transparent"?"rgba(0,0,0,0)":t.textColor;this.contextEl.font=t.font;this.contextEl.fillText(t.indicatorText,n.textLocation.x,n.textLocation.y);this.contextEl.closePath()},_drawRange:function(n,t){var i;if(t.startWidth==null&&t.endWidth==null)this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.startRadius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.endRadius,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this);else{var u=t.startWidth>t.endWidth?t.startWidth-t.endWidth:t.endWidth-t.startWidth,f=this.scaleEl[this.scaleIndex].direction=="clockwise"?n.startAngle<n.endAngle?n.endAngle-n.startAngle:360-(n.startAngle-n.endAngle):n.endAngle<n.startAngle?n.startAngle-n.endAngle:n.startAngle+(360-n.endAngle),r=f/(u*2);if(t.startWidth<t.endWidth)for(t.startWidth!=0&&(this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.placement=="near"?t.radius-t.startWidth:t.radius+t.startWidth,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this)),t.radius=t.placement=="near"?t.radius-t.startWidth:t.radius+t.startWidth,t.endWidth-=t.startWidth,t.startWidth=0,i=t.startWidth;i<t.endWidth;i+=.5)this.contextEl.beginPath(),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this.contextEl.lineWidth=2,this.contextEl.strokeStyle=t.fillStyle,this.contextEl.stroke(),this.contextEl.restore(),n.startAngle=this.scaleEl[this.scaleIndex].direction=="clockwise"?n.startAngle+r:n.startAngle-r,t.radius=t.placement=="near"?t.radius-.5:t.radius+.5;else for(t.endWidth!=0&&(this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.placement=="near"?t.radius-t.endWidth:t.radius+t.endWidth,Math.PI*(n.endAngle/180),Math.PI*(n.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this)),t.radius=t.placement=="near"?t.radius-t.endWidth:t.radius+t.endWidth,t.startWidth-=t.endWidth,t.endWidth=0,i=t.endWidth;i<t.startWidth;i+=.5)this.contextEl.beginPath(),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.radius,Math.PI*(n.startAngle/180),Math.PI*(n.endAngle/180),t.counterClockwise),this.contextEl.lineWidth=2,this.contextEl.strokeStyle=t.fillStyle,this.contextEl.stroke(),this.contextEl.restore(),n.endAngle=this.scaleEl[this.scaleIndex].direction=="clockwise"?n.endAngle-r:n.endAngle+r,t.radius=t.placement=="near"?t.radius-.5:t.radius+.5}},_drawPointers:function(n,i){i.value=i.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:i.value;i.value=i.value<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:i.value;var e,u,r,f,o,s=this.model.locale;r=this._getAngle(i.value);r=r>360?r-360:r;i.type=="needle"?(i.placement=="far"&&(f=i.length+this.scaleEl[this.scaleIndex].size/2),i.placement=="center"&&(f=i.length),i.placement=="near"&&(f=i.length-this.scaleEl[this.scaleIndex].size/2)):(f=i.length,i.placement=="far"&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+i.distanceFromScale,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+i.distanceFromScale,r)),i.placement=="center"&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale,r)),i.placement=="near"&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale-this.majorTickHeight-15,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale-this.majorTickHeight-15,r)),this._isHalfCircle&&this._isHalfCircle()||(this.model.height>this.model.width?u+=(this.model.height-this.model.width)/2:this.model.height<this.model.width&&(u-=(this.model.width-this.model.height)/2)));f>this.model.radius&&(f=this.model.radius);this.region={startX:i.type=="needle"?this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX:e,startY:i.type=="needle"?this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY:u};!t.isNullOrUndefined(i.gradients)&&i.gradients.colorInfo.length>0?(o=this.contextEl.createLinearGradient(0,0,0,i.width),this._setGradientColor(this,o,i.gradients.colorInfo)):o=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.backgroundColor);this.style={width:i.width,isFill:!0,isStroke:!0,radius:0,showBackNeedle:i.showBackNeedle,backNeedleLength:i.backNeedleLength,angle:i.type=="needle"?r:i.placement=="far"?r:r+180,height:f,lineWidth:i.border.width,opacity:isNaN(i.opacity)?1:i.opacity,strokeStyle:i.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.border.color),fillStyle:o,imageUrl:i.imageUrl,type:i.type};this.model.drawPointers&&this._onDrawPointers(r,i.value);i.type=="needle"?(this._drawNeedlePointer(this.region,this.style,i),this._setPointerCap(i)):(i.markerType=="roundedrectangle"&&(this.style.radius=5),this._drawMarkerType(i.markerType,this.region,this.style));i.pointerValueText.showValue&&(e=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._labelRadius+i.pointerValueText.distance,r),u=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,this._labelRadius+i.pointerValueText.distance,r),this.region={startX:e,startY:u},this.style={angle:i.pointerValueText.autoAngle?i.pointerValueText.angle+r:i.pointerValueText.angle,textValue:s&&this.model.enableGroupSeparator?i.value.toLocaleString(s):i.value,fillStyle:i.pointerValueText.color=="transparent"?"rgba(0,0,0,0)":this._getColor(i,i.pointerValueText.color),font:this._getFontString(i,i.pointerValueText.font),opacity:i.pointerValueText.opacity},this._drawPointerValueText(this.region,this.style));this.contextEl.getImageData&&(this.pointerImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height));this._notifyArrayChange&&this._notifyArrayChange("scales["+this.scaleIndex+"]pointers["+n+"]value",i.value);this.value(i.value)},_drawPointerValueText:function(n,t){this._contextOpenPath(t,this);this.contextEl.textAlign="center";this.contextEl.textBaseline="middle";this.contextEl.font=t.font;this.contextEl.translate(n.startX,n.startY);this.contextEl.lineTo(0,0);this.scaleEl[this.scaleIndex].pointers[this.pointerIndex].pointerValueText.autoAngle?this.contextEl.rotate(Math.PI*((t.angle-270)/180)):this.contextEl.rotate(Math.PI*(t.angle/180));this.contextEl.fillText(t.textValue,0,0);this._contextClosePath(t,this)},_drawMarkerType:function(n,i,r){switch(n){case"rectangle":this._drawRectangle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"triangle":this._drawTriangle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"ellipse":this._drawEllipse(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"diamond":this._drawDiamond(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"pentagon":this._drawPentagon(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"circle":this._drawCircle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"slider":this._drawSlider(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"pointer":this._drawPointer(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"wedge":this._drawWedge(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"trapezoid":this._drawTrapezoid(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"roundedrectangle":this._drawRoundedRectangle(i,r,this);t.isNullOrUndefined(r.imageUrl)&&r.imageUrl==""||this._drawImagePointer(i,r,this);break;case"image":this._drawImagePointer(i,r,this)}},_drawNeedlePointer:function(n,t,i){this.pointerEl[this.pointerIndex].needleType=="image"?this._drawImagePointer(n,t,i):(this._contextOpenPath(t,this),this.contextEl.translate(n.startX,n.startY),this.contextEl.rotate(Math.PI*(t.angle/180)),this.contextEl.lineTo(0,-t.width/2),this.pointerEl[this.pointerIndex].needleType=="triangle"?this.contextEl.lineTo(t.height,0):this.pointerEl[this.pointerIndex].needleType=="rectangle"?(this.contextEl.lineTo(t.height,-t.width/2),this.contextEl.lineTo(t.height,t.width/2)):this.pointerEl[this.pointerIndex].needleType=="trapezoid"?(this.contextEl.lineTo(t.height,-t.width/4),this.contextEl.lineTo(t.height,t.width/4)):this.pointerEl[this.pointerIndex].needleType=="arrow"&&(this.contextEl.lineTo(t.height-t.height/4,-t.width/6),this.contextEl.lineTo(t.height-t.height/4,-t.width/2),this.contextEl.lineTo(t.height,0),this.contextEl.lineTo(t.height-t.height/4,t.width/2),this.contextEl.lineTo(t.height-t.height/4,t.width/6)),this.contextEl.lineTo(0,t.width/2),t.showBackNeedle&&(this.contextEl.lineTo(-(t.backNeedleLength+this.scaleEl[this.scaleIndex].pointerCap.radius/2),t.width/2),this.contextEl.lineTo(-(t.backNeedleLength+this.scaleEl[this.scaleIndex].pointerCap.radius/2),-t.width/2)),this._contextClosePath(t,this));this.canvasEl.attr("aria-label",this.model.scales[this.scaleIndex].pointers[this.pointerIndex].value)},_drawImagePointer:function(n,t){var i=this,r=new Image,f=t.angle,e=n.startX,o=n.startY,s=t.width,u=t.height,h=t.type;r.onload=function(){i.contextEl.save();i.contextEl.translate(e,o);i.contextEl.rotate(Math.PI*(f/180));i.contextEl.drawImage(this,0,-u/2,s,u);i.contextEl.restore()};r.src=t.imageUrl},_setPointerCap:function(n){var i;i=this.contextEl.createRadialGradient(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.canvasEl[0].height/2,0,this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.canvasEl[0].height/2,this.scaleEl[this.scaleIndex].pointerCap.radius);t.isNullOrUndefined(this.scaleEl[this.scaleIndex].pointerCap.interiorGradient)?i=this.scaleEl[this.scaleIndex].pointerCap.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,this._getColor(n,this.scaleEl[this.scaleIndex].pointerCap.backgroundColor)):this._setGradientColor(this,i,this.scaleEl[this.scaleIndex].pointerCap.interiorGradient.colorInfo);this.region={centerX:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,centerY:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,startAngle:0,endAngle:2*Math.PI};this.style={isStroke:!0,isFill:!0,strokeStyle:this.scaleEl[this.scaleIndex].pointerCap.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,this._getColor(n,this.scaleEl[this.scaleIndex].pointerCap.borderColor)),radius:this.scaleEl[this.scaleIndex].pointerCap.radius,lineWidth:this.scaleEl[this.scaleIndex].pointerCap.borderWidth,fillStyle:i};this.model.drawPointerCap&&this._onDrawPointerCap();this._drawCircleFrame(this.region,this.style)},isAndroid:function(){return/android/i.test(navigator.userAgent.toLowerCase())},redraw:function(n){switch(n){case"scale":this._reDrawScale();break;case"pointer":this._reDrawPointer();break;case"range":this._reDrawRange();break;case"label":this._reDrawLabel();break;case"tickMark":this._reDrawTickMark();break;case"subGauges":this._reDrawSubGauge();break;case"CustomLabel":this._reDrawCustomLabel();break;default:this._init()}},_getIndicatorImage:function(){return this.pointerImage?this.pointerImage:this._getPointerImage()},_getPointerImage:function(){return this.customLabelImage?this.customLabelImage:this._getCustomLabelImage()},_getSubGaugeImage:function(){return this.labelImage?this.labelImage:this._getLabelImage()},_getCustomLabelImage:function(){return this.subGaugeImage?this.subGaugeImage:this._getSubGaugeImage()},_getRangeImage:function(){return this.model.rangeZOrder=="rear"?this.scaleImage?this.scaleImage:this.outerImage:this.tickImage?this.tickImage:this._getTickImage()},_getLabelImage:function(){return this.model.rangeZOrder=="rear"?this.tickImage?this.tickImage:this._getTickImage():this.tickImage?this.rangeImage:this._getRangeImage()},_getTickImage:function(){return this.model.rangeZOrder=="rear"?this.rangeImage?this.rangeImage:this._getRangeImage():this.scaleImage?this.scaleImage:this.outerImage},getPointerValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].value:null},setMarkerDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getMarkerDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].distanceFromScale:null},setPointerLength:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].length=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getPointerLength:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].length:null},setPointerWidth:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].width=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getPointerWidth:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].width:null},setBackNeedleLength:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].backNeedleLength=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getBackNeedleLength:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].backNeedleLength:null},setNeedleStyle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].needleType=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getNeedleStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].needleType:null},setPointerPlacement:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},getPointerPlacement:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].placement:null},setPointerNeedleType:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(this.scaleEl[n].pointers[t].type=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize())},getPointerNeedleType:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].type:null},setMarkerStyle:function(n,i,r){n<this.model.scales.length&&i<this.model.scales[n].pointers.length&&r!=null&&(r!="roundedrectangle"&&t.isNullOrUndefined(t.datavisualization.CircularGauge.MarkerType[r.replace(/\w\S*/g,function(n){return n.charAt(0).toUpperCase()+n.substr(1).toLowerCase()})])||(this.scaleEl[n].pointers[i].markerType=r,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize()))},getMarkerStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].pointers.length?this.scaleEl[n].pointers[t].markerType:null},setCustomLabelValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].value=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize())},getCustomLabelValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].value:null},setSubGaugeLocation:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].subGauges.length&&i!=null&&(this.scaleEl[n].subGauges[t].position.x=i.x,this.scaleEl[n].subGauges[t].position.y=i.y,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawSubGauge():this._initialize())},getSubGaugeLocation:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].subGauges.length?this.scaleEl[n].subGauges[t].position:null},setCustomLabelAngle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].textAngle=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawCustomLabel():this._initialize())},getCustomLabelAngle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].textAngle:null},setRangeStartValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].startValue=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeStartValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].startValue:null},setRangeEndValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].endValue=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeEndValue:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].endValue:null},setRangeSize:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].size=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},setRangeVisible:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t]._visible=i,this.contextEl.putImageData&&!this.isAndroid()?(this._initialize(),this._wireEvents()):this._initialize())},getRangeSize:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].size:null},setRangeDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].distanceFromScale:null},setRangePosition:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangePosition:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].placement:null},setRangeBorderWidth:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].border.width=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawRange():this._initialize())},getRangeBorderWidth:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ranges.length?this.scaleEl[n].ranges[t].border.width:null},setPointerValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].pointers.length&&i!=null&&(i>=this.scaleEl[n].minimum&&i<=this.scaleEl[n].maximum&&(this.scaleEl[n].pointers[t].value=i),!this.updatePointerOnAnimation&&this.model.enableAnimation&&(this.pointerValue[t]=i),this.contextEl.putImageData&&!this._androidAnimation?(this._reDrawPointer(),this.updatePointerOnAnimation=!1):this._initialize())},setLabelAngle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].angle=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelAngle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].angle:null},setLabelDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].distanceFromScale:null},setLabelStyle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].type=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].type:null},setLabelPlacement:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawLabel():this._initialize())},getLabelPlacement:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].labels.length?this.scaleEl[n].labels[t].placement:null},setTickAngle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].angle=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickAngle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].angle:null},setTickStyle:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].type=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickStyle:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].type:null},setTickPlacement:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].placement=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickPlacement:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].placement:null},setTickWidth:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].width=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickWidth:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].width:null},setTickHeight:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].height=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickHeight:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].height:null},setTickDistanceFromScale:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].distanceFromScale=i,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawTickMark():this._initialize())},getTickDistanceFromScale:function(n,t){return n<this.model.scales.length&&t<this.model.scales[n].ticks.length?this.scaleEl[n].ticks[t].distanceFromScale:null},setStartAngle:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].startAngle=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getStartAngle:function(n){return n<this.model.scales.length?this.scaleEl[n].startAngle:null},setSweepAngle:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].sweepAngle=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getSweepAngle:function(n){return n<this.model.scales.length?this.scaleEl[n].sweepAngle:null},setMinimumValue:function(n,t){n<this.model.scales.length&&t!=null&&(t<this.scaleEl[n].maximum&&(this.scaleEl[n].minimum=t),this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMinimumValue:function(n){return n<this.model.scales.length?this.scaleEl[n].minimum:null},setMaximumValue:function(n,t){n<this.model.scales.length&&t!=null&&(t>this.scaleEl[n].minimum&&(this.scaleEl[n].maximum=t),this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMaximumValue:function(n){return n<this.model.scales.length?this.scaleEl[n].maximum:null},setScaleBarSize:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].size=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleBarSize:function(n){return n<this.model.scales.length?this.scaleEl[n].size:null},setScaleRadius:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].radius=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleRadius:function(n){return n<this.model.scales.length?this.scaleEl[n].radius:null},setMajorIntervalValue:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].majorIntervalValue=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMajorIntervalValue:function(n){return n<this.model.scales.length?this.scaleEl[n].majorIntervalValue:null},setMinorIntervalValue:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].minorIntervalValue=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMinorIntervalValue:function(n){return n<this.model.scales.length?this.scaleEl[n].minorIntervalValue:null},setPointerCapRadius:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].pointerCap.radius=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getPointerCapRadius:function(n){return n<this.model.scales.length?this.scaleEl[n].pointerCap.radius:null},setScaleBorderWidth:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].border.width=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleBorderWidth:function(n){return n<this.model.scales.length?this.scaleEl[n].border.width:null},setPointerCapBorderWidth:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].pointerCap.borderWidth=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getPointerCapBorderWidth:function(n){return n<this.model.scales.length?this.scaleEl[n].pointerCap.borderWidth:null},setScaleDirection:function(n,t){n<this.model.scales.length&&t!=null&&(this.scaleEl[n].direction=t,this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getScaleDirection:function(n){return n<this.model.scales.length?this.scaleEl[n].direction:null},includeFirstValue:function(n,t,i){n<this.model.scales.length&&t<this.model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].includeFirstValue=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},_reDrawScale:function(){this.model.frame.backgroundImageUrl?this.initialize():(this.contextEl.putImageData(this.outerImage,0,0),this._drawScales())},_reDrawPointer:function(){this.model.frame.backgroundImageUrl?this.initialize():(this.contextEl.putImageData(this._getPointerImage(),0,0),this._setPointers(),this._setIndicators())},_reDrawCustomLabel:function(){this.model.frame.backgroundImageUrl?this.initialize():(this.contextEl.putImageData(this._getCustomLabelImage(),0,0),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawRange:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getRangeImage(),0,0),this.model.rangeZOrder=="rear"?(this._setRanges(),this._setTicks()):this._setRanges(),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawLabel:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getLabelImage(),0,0),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawTickMark:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getTickImage(),0,0),this.model.rangeZOrder=="rear"?this._setTicks():(this._setTicks(),this._setRanges()),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},_reDrawSubGauge:function(){this.model.frame.backgroundImageUrl?this._initialize():(this.contextEl.putImageData(this._getSubGaugeImage(),0,0),this._subGauge(),this._setCustomLabel(),this._setPointers(),this._setIndicators())},refreshSubGauge:function(){this.contextEl.putImageData?this._reDrawSubGauge():this._initialize()},refresh:function(){this._scaleRedrawn=!0;this._initialize();this._wireEvents()},exportImage:function(n,i){var f,u,o,r,c,s;if(t.browserInfo().name==="msie"&&parseFloat(t.browserInfo().version)<10)return!1;f=this.canvasEl[0].toDataURL();f=f.replace(/^data:[a-z]*;,/,"");var l=f.split(","),e=atob(l[1]),h=new ArrayBuffer(e.length),a=new Uint8Array(h);for(u=0;u<e.length;u++)a[u]=e.charCodeAt(u);return o=new Blob([h],{type:"image/png"}),t.browserInfo().name==="msie"?window.navigator.msSaveOrOpenBlob(o,n+"."+i):(r=document.createElement("a"),c=URL.createObjectURL(o),r.href=c,r.setAttribute("download",n+"."+i),document.createEvent?(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(s)):r.fireEvent&&r.fireEvent("onclick")),!0},resizeCanvas:function(){var e,o,i,f,r;if(_gaugeCount=_gaugeCount!=0?_gaugeCount-1:n(".e-circulargauge").length-1,o=!0,t.isNullOrUndefined(this.GaugeEl.parent().attr("style"))||(e=this.GaugeEl.parent().attr("style").split(";")),t.isNullOrUndefined(e)||n.each(e,function(n,t){while(t.indexOf("width")!=-1){o=t.indexOf("px")==-1?!0:!1;break}}),o){var u=window.innerWidth/initialDivWidth,s=this.model.width,h=this.model.height;for((s*u>window.innerWidth||h*u>window.innerHeight)&&(u=1),this.model.width*=u,this.model.height*=u,this.model.radius*=u,this._gaugeResizeState=!0,i=0;this.model.scales[i]!=null;i++){for(this.model.scales[i].radius*=u,this.model.scales[i].pointerCap.radius*=u,f=0;f<this.model.scales[i].customLabels.length;f++)t.isNullOrUndefined(this.model.scales[i].customLabels[f])||(this.model.scales[i].customLabels[f].positionType!="outer"&&(this.model.scales[i].customLabels[f].position.x*=u),this.model.scales[i].customLabels[f].position.y*=u,this.model.scales[i].customLabels[f].font.size=parseFloat(this.model.scales[i].customLabels[f].font.size.match(/\d+/)[0])*u<10?"10px":parseFloat(this.model.scales[i].customLabels[f].font.size.match(/\d+/)[0])*u>this._customLblMaxSize?this._customLblMaxSize.toString()+"px":(parseFloat(this.model.scales[i].customLabels[f].font.size.match(/\d+/)[0])*u).toString()+"px");for(r=0;this.model.scales[i].labels[r]!=null||this.model.scales[i].pointers[r]!=null||this.model.scales[i].ranges[r]!=null||this.model.scales[i].indicators[r]!=null||this.model.scales[i].subGauges[r]!=null||this.model.scales[i].ticks[r]!=null;r++)t.isNullOrUndefined(this.model.scales[i].ticks[r])||(this.model.scales[i].ticks[r].height*=u),t.isNullOrUndefined(this.model.scales[i].pointers[r])||(this.model.scales[i].pointers[r].length*=u,this.model.scales[i].pointers[r].width*=u,this.model.scales[i].pointers[r].backNeedleLength*=u),t.isNullOrUndefined(this.model.scales[i].ranges[r])||(this.model.scales[i].ranges[r].distanceFromScale*=u,this.model.scales[i].ranges[r].size*=u),!t.isNullOrUndefined(this.model.scales[i].indicators[r])&&this.model.scales[i].showIndicators&&(this.model.scales[i].indicators[r].height*=u,this.model.scales[i].indicators[r].width*=u,this.model.scales[i].indicators[r].position.x*=u,this.model.scales[i].indicators[r].position.y*=u),!t.isNullOrUndefined(this.model.scales[i].subGauges[r])&&t.isNullOrUndefined(this.model.scales[i].subGauges[r].controlID)&&(this.model.scales[i].subGauges[r].height*=u,this.model.scales[i].subGauges[r].width*=u,this.model.scales[i].subGauges[r].position.x*=u)}this.refresh();_gaugeCount==0&&(initialDivWidth=window.innerWidth)}},_onDrawTicks:function(n,t){var i={index:this.tickIndex,element:this.tickEl[this.tickIndex],angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,pointerValue:t,style:this.style,position:this.region,tick:i};this._trigger("drawTicks",r)},_onDrawLabels:function(n,t){var i={index:this.labelIndex,element:this.labelEl[this.labelIndex],angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,pointerValue:t,style:this.style,position:this.region,label:i};this._trigger("drawLabels",r)},_onDrawPointers:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],angle:parseInt(n),pointerValue:t},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,pointer:i};this._trigger("drawPointers",r)},_onDrawRange:function(){var n={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,rangeIndex:this.rangeIndex,rangeElement:this.rangeEl[this.rangeEl],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawRange",n)},_onDrawCustomLabel:function(){var n={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,customLabelIndex:this.customLabelIndex,customLabelElement:this.customLabelEl[this.customLabelIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawCustomLabel",n)},_onDrawIndicators:function(){var n={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,indicatorIndex:this.indicatorIndex,indicatorEl:this.indicatorEl[this.indicatorIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawIndicators",n)},_onDrawPointerCap:function(){var n={object:this,scaleElement:this.model.scales,position:this.region,style:this.style,context:this.contextEl};this._trigger("drawPointerCap",n)},_onRenderComplete:function(){var n={object:this,scaleElement:this.model.scales,context:this.contextEl};this._trigger("renderComplete",n)},_onMouseClick:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.position,pointers:i};this._trigger("mouseClick",r)},_onMouseClickMove:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,pointers:i};this._trigger("mouseClickMove",r)},_onMouseClickUp:function(n,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(n)},r={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,pointers:i};this._trigger("mouseClickUp",r)},_setTheme:function(){var n=this.model.themeProperties[this.model.theme];this._setThemeColors(n)},_setThemeColors:function(n){var r=[],f=this.model.themeProperties,s,i,t,u,e,o;for(s in f)r.push(s);for(i=0;i<r.length;i++)for(this.model.backgroundColor=!this.model.backgroundColor||this.model.backgroundColor==f[r[i]].backgroundColor?n.backgroundColor:this.model.backgroundColor,t=0;t<this.model.scales.length;t++){for(this.model.scales[t].backgroundColor=!this.model.scales[t].backgroundColor||this.model.scales[t].backgroundColor==f[r[i]].scales.backgroundColor?n.scales.backgroundColor:this.model.scales[t].backgroundColor,this.model.scales[t].border.color=!this.model.scales[t].border.color||this.model.scales[t].border.color==f[r[i]].scales.border.color?n.scales.border.color:this.model.scales[t].border.color,u=0;u<this.model.scales[t].pointers.length;u++)this.model.scales[t].pointers[u].backgroundColor=!this.model.scales[t].pointers[u].backgroundColor||this.model.scales[t].pointers[u].backgroundColor==f[r[i]].scales.pointers.backgroundColor?n.scales.pointers.backgroundColor:this.model.scales[t].pointers[u].backgroundColor,this.model.scales[t].pointers[u].border.color=!this.model.scales[t].pointers[u].border.color||this.model.scales[t].pointers[u].border.color==f[r[i]].scales.pointers.border.color?n.scales.pointers.border.color:this.model.scales[t].pointers[u].border.color,this.model.scales[t].pointerCap.backgroundColor=!this.model.scales[t].pointerCap.backgroundColor||this.model.scales[t].pointerCap.backgroundColor==f[r[i]].scales.pointerCap.backgroundColor?n.scales.pointerCap.backgroundColor:this.model.scales[t].pointerCap.backgroundColor,this.model.scales[t].pointerCap.borderColor=!this.model.scales[t].pointerCap.borderColor||this.model.scales[t].pointerCap.borderColor==f[r[i]].scales.pointerCap.borderColor?n.scales.pointerCap.borderColor:this.model.scales[t].pointerCap.borderColor;for(e=0;e<this.model.scales[t].ticks.length;e++)this.model.scales[t].ticks[e].color=!this.model.scales[t].ticks[e].color||this.model.scales[t].ticks[e].color==f[r[i]].scales.ticks.color?n.scales.ticks.color:this.model.scales[t].ticks[e].color;for(o=0;o<this.model.scales[t].labels.length;o++)this.model.scales[t].labels[o].color=!this.model.scales[t].labels[o].color||this.model.scales[t].labels[o].color==f[r[i]].scales.labels.color?n.scales.labels.color:this.model.scales[t].labels[o].color}},_getFontString:function(n,t){return t?(t.fontStyle?t.fontStyle:"")+" "+(t.size==null?"11px":t.size)+" "+t.fontFamily:""},_drawTriangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawPointer:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(t.width/2,t.height/4);this._contextClosePath(t,i)},_drawWedge:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(3*t.width/4,0);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawSlider:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/4,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(t.width/4,t.height/2);this._contextClosePath(t,i)},_drawStar:function(n,t,i){this._contextOpenPath(t,i);i.model.Orientation=="Horizontal"&&i.markerPlacement=="near"?(i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY),i.contextEl.lineTo(n.startX,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width/6,n.startY),i.contextEl.lineTo(n.startX+t.width/2,n.startY+t.height)):(i.contextEl.lineTo(n.startX+t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height/3),i.contextEl.lineTo(n.startX,n.startY+t.height/3),i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width/2,n.startY));this._contextClosePath(t,i)},_drawPentagon:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/3,-t.height/2);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width/3,t.height/2);this._contextClosePath(t,i)},_drawDiamond:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(t.width,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(0,0);this._contextClosePath(t,i)},_drawCircle:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_drawLine:function(n,t,i){i.contextEl.beginPath();i.contextEl.strokeStyle=t.fillStyle;i.contextEl.globalAlpha=t.opacity;i.contextEl.lineWidth=t.lineWidth;i.contextEl.moveTo(n.startX,n.startY);i.contextEl.lineTo(n.startX+t.width,n.startY);i.contextEl.closePath();i.contextEl.stroke()},_drawTrapezoid:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/4);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/4);this._contextClosePath(t,i)},_drawRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/2);this._contextClosePath(t,i)},_drawRoundedRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(t.radius,-t.height/2);i.contextEl.lineTo(t.width-t.radius,-t.height/2);i.contextEl.quadraticCurveTo(t.width,-t.height/2,t.width,-t.height/2+t.radius);i.contextEl.lineTo(t.width,t.height/2-t.radius);i.contextEl.quadraticCurveTo(t.width,t.height/2,t.width-t.radius,t.height/2);i.contextEl.lineTo(t.radius,t.height/2);i.contextEl.quadraticCurveTo(0,t.height/2,0,t.height/2-t.radius);i.contextEl.lineTo(0,-t.height/2+t.radius);i.contextEl.quadraticCurveTo(0,-t.height/2,t.radius,-t.height/2);this._contextClosePath(t,i)},_drawCustomImage:function(t,i){var r=new Image;n(r).on("load",function(){t.contextEl.drawImage(this,0,0,t.model.Width,t.model.Height);t.model.scales!=null&&t._drawScales();t.model.items!=null&&t._renderItems()}).attr("src",i)},_drawEllipse:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.scale(2,1);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_setPointerDimension:function(n,i){if(!t.isNullOrUndefined(i.model.Orientation)&&i.model.Orientation=="Horizontal"){var r=n.width,u=n.height;n.height=r;n.width=u}return n},_setContextRotation:function(n,t){t.contextEl.rotate(Math.PI*(n.angle/180))},_contextOpenPath:function(n,t){t.contextEl.save();t.contextEl.beginPath();n.strokeStyle&&(t.contextEl.strokeStyle=n.strokeStyle);n.opacity!=i&&(t.contextEl.globalAlpha=n.opacity);n.lineWidth&&(t.contextEl.lineWidth=n.lineWidth);n.fillStyle&&(t.contextEl.fillStyle=n.fillStyle)},_contextClosePath:function(n,t){t.contextEl.closePath();n.isFill&&t.contextEl.fill();n.isStroke&&t.contextEl.stroke();t.contextEl.restore()},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_isBetween:function(n,t,i,r){return n<t?i>=n-r&&i<=t+r:i>=t-r&&i<=n+r},_getColor:function(n,t){return typeof t=="string"?t:"rgba("+t.r+", "+t.g+","+t.b+", "+t.a/255+")"},_setGradientColor:function(t,i,r){var u=t;r.Name||typeof r=="string"?(i.addColorStop(0,this._getColor(t,r)),i.addColorStop(1,this._getColor(t,r))):n.each(r,function(n,r){i.addColorStop(r.colorStop!=NaN?r.colorStop:0,typeof r.color=="string"?r.color:u._getColor(t,r.color))})}}),function(){for(var u=0,f=["ms","moz","webkit","o"],i,r,n=0;n<f.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[f[n]+"RequestAnimationFrame"];window.requestAnimationFrame||(t.datavisualization.CircularGauge.animationPolyfill=!0,window.requestAnimationFrame=function(n,t){return i=(new Date).getTime(),r=Math.max(0,16-(i-u)),t=window.setTimeout(function(){n(i+r)},r),u=i+r,t})}();t.datavisualization.CircularGauge.Frame={FullCircle:"fullcircle",HalfCircle:"halfcircle"};t.datavisualization.CircularGauge.Directions={Clockwise:"clockwise",CounterClockwise:"counterclockwise"};t.datavisualization.CircularGauge.PointerPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.PointerType={Needle:"needle",Marker:"marker"};t.datavisualization.CircularGauge.NeedleType={Triangle:"triangle",Rectangle:"rectangle",Trapezoid:"trapezoid",Arrow:"arrow",Image:"image"};t.datavisualization.CircularGauge.MarkerType={Rectangle:"rectangle",Triangle:"triangle",Ellipse:"ellipse",Diamond:"diamond",Pentagon:"pentagon",Circle:"circle",Slider:"slider",Pointer:"pointer",Wedge:"wedge",Trapezoid:"trapezoid",RoundedRectangle:"roundedrectangle",Image:"image"};t.datavisualization.CircularGauge.RangePlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.TickType={Major:"major",Minor:"minor"};t.datavisualization.CircularGauge.gaugePosition={TopLeft:"topleft",TopRight:"topright",TopCenter:"topcenter",MiddleLeft:"middleleft",MiddleRight:"middleright",Center:"center",BottomLeft:"bottomleft",BottomRight:"bottomright",BottomCenter:"bottomcenter"};t.datavisualization.CircularGauge.TickPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.CustomLabelPositionType={Inner:"inner",Outer:"outer"};t.datavisualization.CircularGauge.OuterCustomLabelPosition={Left:"left",Right:"right",Top:"top",Bottom:"bottom"};t.datavisualization.CircularGauge.LabelPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.CircularGauge.LabelType={Major:"major",Minor:"minor"};t.datavisualization.CircularGauge.UnitTextPlacement={Back:"back",Front:"front"};t.datavisualization.CircularGauge.RangeZOrderPosition={Rear:"rear",Front:"front"};t.datavisualization.CircularGauge.IndicatorType={Rectangle:"rectangle",Circle:"circle",RoundedRectangle:"roundedrectangle",Text:"text",Image:"image"};t.datavisualization.CircularGauge.Themes={FlatLight:"flatlight",FlatDark:"flatdark"};t.datavisualization.CircularGauge.LegendPosition={Top:"top",Bottom:"bottom",Left:"left",Right:"right"};t.datavisualization.CircularGauge.LegendAlignment={Near:"near",Center:"center",Far:"far"};t.datavisualization.CircularGauge.LegendShape={Rectangle:"rectangle",Triangle:"triangle",Diamond:"diamond",Pentagon:"pentagon",Circle:"circle",Slider:"slider",Wedge:"wedge",Trapezoid:"trapezoid",Line:"line"}}(jQuery,Syncfusion),function(n,t,i){t.widget({ejLinearGauge:"ej.datavisualization.LinearGauge"},{element:null,_rootCSS:"e-lineargauge",_animationFlag:!0,model:null,_customLblMaxSize:0,_savedPoints:[],validTags:["div","span"],defaults:{locale:null,enableGroupSeparator:!1,value:0,minimum:0,maximum:100,width:150,height:400,theme:"flatlight",orientation:"Vertical",pointerGradient1:null,pointerGradient2:null,backgroundColor:null,borderColor:null,labelColor:null,tickColor:null,readOnly:!0,enableResize:!1,isResponsive:!1,tooltip:{showLabelTooltip:!1,showCustomLabelTooltip:!1,templateID:null},outerCustomLabelPosition:"bottom",frame:{backgroundImageUrl:null,outerWidth:12,innerWidth:8},scales:null,enableAnimation:!0,enableMarkerPointerAnimation:!0,animationSpeed:500,drawTicks:null,drawLabels:null,drawBarPointers:null,drawMarkerPointers:null,drawRange:null,drawCustomLabel:null,drawIndicators:null,load:null,init:null,renderComplete:null,mouseClick:null,mouseClickMove:null,mouseClickUp:null,themeProperties:{flatlight:{scales:{backgroundColor:"#FFFFFF",border:{color:"#1d1e1e"},barPointers:{backgroundColor:"#8abc3b",border:{color:"#8abc3b"}},markerPointers:{backgroundColor:"#212121",border:{color:"#212121"}},ticks:{color:"#1d1e1e"},labels:{labelColor:"#222222"}}},flatdark:{scales:{backgroundColor:"#808080",border:{color:"#808080"},barPointers:{backgroundColor:"#8abc3b",border:{color:"#8abc3b"}},markerPointers:{backgroundColor:"#CCCCCC",border:{color:"#CCCCCC"}},ticks:{color:"#808080"},labels:{labelColor:"#CCCCCC"}}}}},_defaultScaleValues:function(){return{minimum:null,maximum:null,majorIntervalValue:10,minorIntervalValue:2,direction:"counterclockwise",backgroundColor:null,border:{color:null,width:1.5},opacity:NaN,width:30,shadowOffset:0,length:290,type:"rectangle",position:{x:50,y:50},showRanges:!1,showIndicators:!1,showCustomLabels:!1,showLabels:!0,showTicks:!0,showBarPointers:!0,showMarkerPointers:!0,ticks:[{distanceFromScale:{x:0,y:0},angle:0,color:null,type:"majorinterval",placement:"near",opacity:0,height:10,width:3},{distanceFromScale:{x:0,y:0},angle:0,color:null,type:"minorinterval",placement:"near",opacity:0,height:5,width:2}],ranges:[{endWidth:10,placement:"center",startWidth:10,distanceFromScale:0,endValue:60,startValue:20,gradients:null,backgroundColor:null,border:{color:null,width:1.5},opacity:null}],labels:[{distanceFromScale:{x:-10,y:0},angle:0,font:{size:"11px",fontFamily:"Arial",fontStyle:"bold"},textColor:null,opacity:0,type:"major",placement:"near",includeFirstValue:!0,unitText:"",unitTextPlacement:"back"}],markerPointers:[{type:"triangle",length:30,placement:"far",gradients:null,distanceFromScale:0,width:30,value:null,backgroundColor:null,border:{color:null,width:1.5},opacity:1}],barPointers:[{gradients:null,distanceFromScale:0,width:30,value:null,backgroundColor:null,border:{color:null,width:1.5},opacity:1}],indicators:[{font:{size:"11px",fontFamily:"Arial",fontStyle:"bold"},height:30,type:"rectangle",width:30,position:{x:0,y:0},textLocation:{x:0,y:0},stateRanges:[{endValue:60,startValue:50,backgroundColor:null,borderColor:null,text:"",textColor:null}],backgroundColor:null,border:{color:null,width:1.5},opacity:NaN}],customLabels:[{font:{size:"11px",fontFamily:"Arial",fontStyle:"bold"},color:null,opacity:0,value:"",textAngle:0,position:{x:0,y:0},positionType:"inner"}]}},dataTypes:{scales:"data",isResponsive:"boolean"},observables:["value","minimum","maximum"],_tags:[{tag:"scales",attr:["majorIntervalValue","minorIntervalValue","backgroundColor","shadowOffset","showRanges","showIndicators","showCustomLabels","showLabels","showTicks","showBarPointers","showMarkerPointers","border.color","border.width","position.x","position.y",[{tag:"markerPointers",attr:["distanceFromScale","backgroundColor","border.width","border.color"]},{tag:"barPointers",attr:["distanceFromScale","backgroundColor","border.width","border.color"]},{tag:"ranges",attr:["distanceFromScale","startValue","endValue","startWidth","endWidth","backgroundColor","border.color","border.width"]},{tag:"ticks",attr:["distanceFromScale.x","distanceFromScale.y"]},{tag:"indicators",attr:["backgroundColor","textLocation","font.size","font.fontFamily","font.fontStyle","position.x","position.y","textLocation.x","textLocation.y","borderColor","textColor",[{tag:"stateRanges",attr:["endValue","startValue","backgroundColor","borderColor","textColor"]}]]},{tag:"labels",attr:["distanceFromScale.x","distanceFromScale.y","textColor","includeFirstValue","unitText","unitTextPlacement","font.size","font.fontFamily","font.fontStyle"]},{tag:"customLabels",attr:["textAngle","font.size","font.fontFamily","font.fontStyle","position.x","position.y"]}]]}],value:t.util.valueFunction("value"),minimum:t.util.valueFunction("minimum"),maximum:t.util.valueFunction("maximum"),_init:function(){_linearGaugeCount=n(".e-lineargauge").length;initialGaugeCount=_linearGaugeCount;this._initialize();this._trigger("load");this._setTheme();this._render();this.wireEvents();this._onWindowResize()},_onWindowResize:function(){(this.model.enableResize||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this.resizeCanvas):this._on(n(window),"resize",this.resizeCanvas))},_setModel:function(t){var i,r,f,u,e,o,s;for(i in t)switch(i){case"theme":this.model.theme=t[i];this._init();break;case"height":this.model.height=t[i];break;case"width":this.model.width=t[i];break;case"orientation":this.model.orientation=t[i];break;case"pointerGradient1":this.model.pointerGradient1=t[i];break;case"pointerGradient2":this.model.pointerGradient2=t[i];break;case"labelColor":this.model.labelColor=t[i];break;case"tick":n.extend(this.model.tick,t[i]);break;case"backgroundColor":this.model.backgroundColor=t[i];break;case"borderColor":this.model.borderColor=t[i];break;case"frame":n.extend(this.model.frame,t[i]);case"outerCustomLabelPosition":this.model.outerCustomLabelPosition=t[i];break;case"tooltip":n.extend(this.model.tooltip,t[i]);break;case"readOnly":this.model.readOnly=t[i];break;case"value":for(this.value()==""&&this.value(0),r=0;this.model.scales[r]!=null;r++)for(f=0;this.model.scales[r].markerPointers[f]!=null;f++)this.model.scales[r].markerPointers[f].value=parseFloat(this.value());for(u=0;this.model.scales[u]!=null;u++)for(e=0;this.model.scales[u].barPointers[e]!=null;e++)this.model.scales[u].barPointers[e].value=parseFloat(this.value());break;case"minimum":for(this.minimum()==""&&this.minimum(0),o=0;this.model.scales[o]!=null;o++)this.model.scales[o].minimum=parseInt(this.minimum());break;case"maximum":for(this.maximum()==""&&this.maximum(0),s=0;this.model.scales[s]!=null;s++)this.model.scales[s].maximum=parseInt(this.maximum());break;case"scales":this.model.scales=t[i];this._itemInitialize()}this._render();this.wireEvents()},_destroy:function(){this.activeElement=null;this.canvasEl=null;this.contextEl=null;this.unWireEvents();this.element.empty().removeClass("e-widget")},_initialize:function(){this.GaugeEl=this.element;this.scaleStartX=[];this.scaleStartY=[];this.isScaleModified=!1;this.target=this.element[0];this._itemInitialize();this.Model=this.model},_render:function(){this.initialize();this.wireEvents()},_itemInitialize:function(){var t=this;this.model.scales!=null?n.each(this.model.scales,function(i,r){r=t._checkArrayObject(r,i);var u=t._defaultScaleValues();n.extend(u,r);n.extend(r,u)}):this.model.scales=[this._defaultScaleValues()]},_checkArrayObject:function(t,i){var r=this,u;return n.each(t,function(n,t){if(u=typeof n,(u!="string"||u=="string"&&n.indexOf("_")==-1&&n.indexOf("__")==-1)&&typeof t!="function")if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"&&!t.setter&&!t.factory&&!t.key){var f=r._defaultScaleValues();r._LoadIndividualDefaultValues(t,f,typeof n=="number"?i:n)}}),t},_LoadIndividualDefaultValues:function(t,i,r){var u=null,e=this,f;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),f=typeof r,n.each(t,function(n,t){t instanceof Array?e._checkArrayObject(t,r):t!=null&&typeof t=="object"&&(f!="string"||f=="string"&&r.indexOf("_")==-1&&r.indexOf("__")==-1)&&e._LoadIndividualDefaultValues(t,u,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},initialize:function(){this._initObject(this);this.Model.frame.backgroundImageUrl?this._drawCustomImage(this,this.Model.frame.backgroundImageUrl):this.Model.scales!=null&&this._drawScales()},_initObject:function(i){var h,r,f,e,u,s,o;for(this._savedPoints=[],this.element.addClass("e-widget"),i.GaugeEl=i.element,i.canvasEl&&(i.canvasEl.parent().empty(),i.GaugeEl.empty()),i.canvasEl=n("<canvas><\/canvas>"),h=0,r=0;this.model.scales[r]!=null;r++){for(this.model.scales[r].minimum==null&&(this.model.scales[r].minimum=this.minimum()),this.model.scales[r].maximum==null&&(this.model.scales[r].maximum=this.maximum()),f=0;this.model.scales[r].markerPointers[f]!=null;f++)this.model.scales[r].markerPointers[f].value==null&&(this.model.scales[r].markerPointers[f].value=this.value());for(e=0;this.model.scales[r].barPointers[e]!=null;e++)this.model.scales[r].barPointers[e].value==null&&(this.model.scales[r].barPointers[e].value=this.value());for(u=0;this.model.scales[r].customLabels[u]!=null&&this.model.scales[r].showCustomLabels==!0;u++)if(h++,this.model.scales[r].customLabels[u].value!=null&&i.GaugeEl.find("div").length==0)if(this.model.scales[r].customLabels[u]!=null&&this.model.scales[r].customLabels[u].positionType!=null&&this.model.scales[r].customLabels[u].positionType=="outer")if(i.outerDiv=t.buildTag("div"),i.model.outerCustomLabelPosition=="bottom")i.GaugeEl.append(i.canvasEl),i.GaugeEl.append(i.outerDiv),i.outerDiv.css("text-align","center"),i.GaugeEl.css({width:i.model.width});else if(i.model.outerCustomLabelPosition!="top"){s=t.buildTag("TABLE");s.css("width","100%");var c=t.buildTag("TR"),l=t.buildTag("TD"),a=t.buildTag("td");i.model.outerCustomLabelPosition=="left"?(l.append(i.outerDiv),a.append(i.canvasEl)):(l.append(i.canvasEl),a.append(i.outerDiv));c.append(l);c.append(a);s.append(c);i.GaugeEl.append(s);i.outerDiv.css({width:this.element.width()-i.model.width})}else i.GaugeEl.append(i.outerDiv),i.GaugeEl.append(i.canvasEl),i.GaugeEl.css({width:i.model.width}),i.outerDiv.css("text-align","center");else i.GaugeEl.append(i.canvasEl);h==0&&i.GaugeEl.append(i.canvasEl)}(i.canvasEl.attr("role","presentation"),_linearGaugeCount==initialGaugeCount&&(initialLinearDivWidth=window.innerWidth),i.canvasEl[0].setAttribute("width",i.model.width),i.canvasEl[0].setAttribute("height",i.model.height),i.centerX=i.canvasEl[0].width/2,i.centerY=i.canvasEl[0].height/2,o=i.canvasEl[0],typeof G_vmlCanvasManager!="undefined"&&(o=window.G_vmlCanvasManager.initElement(o)),o&&o.getContext)&&(i.contextEl=i.canvasEl[0].getContext("2d"))},_drawFrameCircle:function(n,t,i){this._contextOpenPath(t,i);i.contextEl.arc(n.startX,n.startY,t.circleRadius,0,2*Math.PI,!0);this._contextClosePath(t,i);t.indicatorText&&i._drawText(n,t)},_drawFrameRectangle:function(n,t,i){this._contextOpenPath(t,i);i.contextEl.lineTo(n.startX+t.radius,n.startY);i.contextEl.lineTo(n.startX+t.width-t.radius,n.startY);i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.radius);i.contextEl.lineTo(n.startX+t.radius,n.startY+t.height);this._contextClosePath(t,i);t.indicatorText&&i._drawText(n,t)},_drawFrameThermometer:function(n,t,i){var r=i.Model.orientation=="Vertical"?Math.sqrt(t.width*t.width+t.width*t.width)/2:Math.sqrt(t.height*t.height+t.height*t.height)/2;this._contextOpenPath(t,i);i.Model.orientation=="Vertical"?i.scaleEl[i.scaleIndex].direction=="counterclockwise"?(i.contextEl.arc(n.startX+Math.cos(Math.PI*(45/180))*r,n.startY+t.height-Math.sin(Math.PI*(45/180))*r,r,Math.PI*(-45/180),Math.PI*(225/180),!1),i.contextEl.lineTo(n.startX,n.startY+t.calDistance+t.width/2),t.topRounded?i.contextEl.arc(n.startX+t.width/2,n.startY+t.width/2,t.width/2,-Math.PI,0,!1):i.contextEl.lineTo(n.startX+t.width,n.startY+t.calDistance+t.width/2)):(i.contextEl.arc(n.startX+Math.cos(Math.PI*(45/180))*r,n.startY+Math.sin(Math.PI*(45/180))*r,r,Math.PI*(45/180),Math.PI*(-225/180),!0),i.contextEl.lineTo(n.startX,n.startY+t.height-t.width/2),t.topRounded?i.contextEl.arc(n.startX+t.width/2,n.startY+t.height-t.width/2,t.width/2,-Math.PI,0,!0):i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.width/2)):i.scaleEl[i.scaleIndex].direction=="counterclockwise"?(i.contextEl.arc(n.startX+t.width-r/4-Math.cos(Math.PI*(45/180))*r,n.startY+Math.sin(Math.PI*(45/180))*r,r,Math.PI*(135/180),Math.PI*(225/180),!0),i.contextEl.lineTo(n.startX+t.height/2,n.startY),t.topRounded?i.contextEl.arc(n.startX+t.height/2,n.startY+t.height/2,t.height/2,Math.PI*(270/180),Math.PI*(90/180),!0):i.contextEl.lineTo(n.startX+t.height/2,n.startY+t.height)):(i.contextEl.arc(n.startX+r/4+Math.cos(Math.PI*(45/180))*r,n.startY+Math.sin(Math.PI*(45/180))*r,r,Math.PI*(45/180),Math.PI*(315/180),!1),i.contextEl.lineTo(n.startX+t.width-t.height/2,n.startY),t.topRounded?i.contextEl.arc(n.startX+t.width-t.height/2,n.startY+t.height/2,t.height/2,Math.PI*(270/180),Math.PI*(90/180),!1):i.contextEl.lineTo(n.startX+t.width-t.height/2,n.startY+t.height));this._contextClosePath(t,i)},_drawFrameRoundedRectangle:function(n,t,i){this._contextOpenPath(t,i);i.contextEl.lineTo(n.startX+t.radius,n.startY);i.contextEl.lineTo(n.startX+t.width-t.radius,n.startY);i.contextEl.quadraticCurveTo(n.startX+t.width,n.startY,n.startX+t.width,n.startY+t.radius);i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.radius);i.contextEl.quadraticCurveTo(n.startX+t.width,n.startY+t.height,n.startX+t.width-t.radius,n.startY+t.height);i.contextEl.lineTo(n.startX+t.radius,n.startY+t.height);i.contextEl.quadraticCurveTo(n.startX,n.startY+t.height,n.startX,n.startY+t.height-t.radius);i.contextEl.lineTo(n.startX,n.startY+t.radius);i.contextEl.quadraticCurveTo(n.startX,n.startY,n.startX+t.radius,n.startY);this._contextClosePath(t,i);t.indicatorText&&this._drawText(n,t)},_contextOpenPath:function(n,t){t.contextEl.save();t.contextEl.beginPath();n.strokeStyle&&(t.contextEl.strokeStyle=n.strokeStyle);n.opacity!=i&&(t.contextEl.globalAlpha=n.opacity);n.lineWidth&&(t.contextEl.lineWidth=n.lineWidth);n.fillStyle&&(t.contextEl.fillStyle=n.fillStyle)},_contextClosePath:function(n,t){t.contextEl.closePath();n.isFill&&t.contextEl.fill();n.isStroke&&t.contextEl.stroke();t.contextEl.restore()},_drawScales:function(){var t=this,i;this.scaleEl=this.Model.scales;this.contextEl.save();this.contextEl.translate(this.Model.frame.outerWidth+this.Model.frame.innerWidth,this.Model.frame.outerWidth+this.Model.frame.innerWidth);n.each(this.Model.scales,function(n,i){t.scaleIndex=n;t._setScaleCordinates(i,i.type)});this._setTicks();this._setLabels();this._setRange();this._setCustomLabel();this._flagPointer=!1;this._tempOpacity=this.model.scales[0].barPointers[0].opacity;this._setBarPointers();this._setMarkerPointers();this._setIndicators();n.each(this.Model.scales,function(n,i){i.showBarPointers&&i.barPointers.length>1&&(t.model.enableAnimation=!1);i.showMarkerPointers&&i.markerPointers.length>1&&(t.model.enableAnimation=!1)});this.contextEl.putImageData||(this.model.enableAnimation=!1);this.model.animationSpeed!=null&&this.model.animationSpeed>0&&(i=this.model.animationSpeed/25,i>=0&&this.model.enableAnimation&&this._animationFlag&&this._onAnimate(i))},_setTicks:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showTicks&&(t.scaleIndex=i,r.ticks!=null&&(t.tickEl=r.ticks,n.each(r.ticks,function(n,i){t.tickIndex=n;t._setTicksCordinates(i,n)})))})},_setLabels:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showLabels&&(t.scaleIndex=i,r.labels!=null&&(t.labelEl=r.labels,n.each(r.labels,function(n,i){t.labelIndex=n;t._setLabelCordinates(i,n)})))})},_setIndicators:function(){var t=this;n.each(this.Model.scales,function(i,r){t.scaleIndex=i;r.indicators!=null&&r.showIndicators&&(t.indicatorEl=r.indicators,n.each(r.indicators,function(n,i){t.indicatorIndex=n;t._drawIndicator(n,i)}))})},_setBarPointers:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showBarPointers&&(t.scaleIndex=i,r.barPointers!=null&&(t.barPointerEl=r.barPointers,n.each(r.barPointers,function(n,i){t.barPointerIndex=n;r.opacity=t.scaleIndex==0&&t.barPointerIndex==0&&t.model.enableAnimation==!0&&t._flagPointer==!1&&t._animationFlag==!0&&t.model.scales[0].type=="thermometer"?0:t._tempOpacity;t._drawScaleBarPointer(i,n);t._flagPointer=!0})))})},_setMarkerPointers:function(){var t=this;n.each(this.Model.scales,function(i,r){r.showMarkerPointers&&(t.scaleIndex=i,r.markerPointers!=null&&(t.markerPointerEl=r.markerPointers,n.each(r.markerPointers,function(n,i){t.markerPointerIndex=n;t._drawMarkerPointer(i,n);t.canvasEl.attr("aria-label",t.model.scales[t.scaleIndex].markerPointers[t.markerPointerIndex].value)})))})},_onAnimate:function(n){var t=this,f,e,i=t.model.scales[0].minimum,r=t.model.scales[0].barPointers[0].value,u=t.model.scales[0].markerPointers[0].value;f=setInterval(function(){r>i||i==t.model.scales[0].minimum?(i=i+(t.model.scales[0].maximum-t.model.scales[0].minimum)/100,t.scaleEl[0].type=="thermometer"?(t.model.scales[0].barPointers[0].value=r>i?i:r,t.contextEl.putImageData!="undefined"?t._setBarPointers():r>i?t.setBarPointerValue(0,0,i):t.setBarPointerValue(0,0,r)):r>i?t.setBarPointerValue(0,0,i):t.setBarPointerValue(0,0,r)):(t._animationFlag=!1,t.setBarPointerValue(0,0,r),window.clearInterval(f))},n);e=setInterval(function(){t.model.enableMarkerPointerAnimation&&(u>i||i==t.model.scales[0].minimum?(i=i+(t.model.scales[0].maximum-t.model.scales[0].minimum)/100,t.scaleEl[0].type=="thermometer"?(t.model.scales[0].markerPointers[0].value=u>i?i:u,t.contextEl.putImageData!="undefined"?t._setMarkerPointers():u>i?t.setPointerValue(0,0,i):t.setPointerValue(0,0,u)):u>i?t.setPointerValue(0,0,i):t.setPointerValue(0,0,u)):(t._animationFlag=!1,t.setPointerValue(0,0,u),window.clearInterval(e)))},n)},_setRange:function(){var t=this;n.each(this.Model.scales,function(i,r){t.scaleIndex=i;r.ranges!=null&&r.showRanges&&(t.rangeEl=r.ranges,n.each(r.ranges,function(n,i){t.rangeIndex=n;t._drawRange(i)}))})},_setCustomLabel:function(){var t=this;n.each(this.Model.scales,function(i,r){t.scaleIndex=i;r.customLabels!=null&&r.showCustomLabels&&(t.customLabelEl=r.customLabels,n.each(r.customLabels,function(n,i){t.customLabelIndex=n;t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex]!=null&&t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType!=null&&t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType=="outer"?t._setOuterCustomLabelCordinates(n,i):t._setCustomLabelCordinates(n,i)}))})},_setOuterCustomLabelCordinates:function(n,i){var r,u;this._customLblMaxSize=this._customLblMaxSize<parseFloat(i.font.size.match(/\d+/)[0])?parseFloat(i.font.size.match(/\d+/)[0]):this._customLblMaxSize;r=t.buildTag("div."+this._id+"outercustomlbl");r.text(this.model.scales[this.scaleIndex].customLabels[n].value);u=this.model.outerCustomLabelPosition=="right"||this.model.outerCustomLabelPosition=="left"?"left":"center";this.outerDiv.append(r);this.outerDiv.append("<\/br>");u=="center"?r.css({display:"inline-block",margin:"0 auto","max-width":this.model.width}):r.css({display:"inline-block","max-width":this.element.width()-this.model.width>10?this.element.width()-this.model.width:10});r.css({color:i.color,overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":i.font!=null&&i.font.size!=null?i.font.size:"12px","font-family":i.font!=null&&i.font.fontFamily!=null?i.font.fontFamily:"Arial","font-weight":i.font!=null&&i.font.fontStyle!=null?i.font.fontStyle:"Normal","text-align":u})},_setScaleCordinates:function(n,t){var r,i,u,f;this.opacity=1;this.bottomRadius=Math.sqrt(n.width*n.width+n.width*n.width)/2;this.bounds={height:this.canvasEl[0].height-2*(this.Model.frame.outerWidth+this.Model.frame.innerWidth),width:this.canvasEl[0].width-2*(this.Model.frame.outerWidth+this.Model.frame.innerWidth)};this.Model.orientation=="Vertical"?(this.scaleStartX[this.scaleIndex]=(this.bounds.width-n.width)*(n.position.x/100),this.scaleStartY[this.scaleIndex]=(this.bounds.height-n.length)*(n.position.y/100)):(this.scaleStartX[this.scaleIndex]=(this.bounds.width-n.length)*(n.position.x/100),this.scaleStartY[this.scaleIndex]=(this.bounds.height-n.width)*(n.position.y/100));u=t=="roundedrectangle"?5:0;r={startX:this.scaleStartX[this.scaleIndex],startY:this.scaleStartY[this.scaleIndex]};i={width:this.Model.orientation=="Vertical"?n.width:n.length,isStroke:!0,topRounded:!0,fillStyle:n.backgroundColor?n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):this.Model.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.backgroundColor),lineWidth:n.border.width,radius:u,height:this.Model.orientation=="Vertical"?n.length:n.width,isFill:!0,strokeStyle:n.border.color?n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color):this.Model.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.borderColor)};n.maximum<n.minimum&&(f=n.maximum,n.maximum=n.minimum,n.minimum=f);n.maximum==n.minimum&&(n.maximum=n.maximum+1);this.minimum(n.minimum);this.maximum(n.maximum);this._notifyArrayChange&&(this._notifyArrayChange("scales["+this.scaleIndex+"]maximum",n.maximum),this._notifyArrayChange("scales["+this.scaleIndex+"]minimum",n.minimum));n.shadowOffset&&(this.contextEl.shadowBlur=n.shadowOffset,this.contextEl.shadowColor=i.fillStyle=="transparent"?"rgba(0,0,0,0)":i.fillStyle);this._drawFrame(t,r,i);this.scaleEl[this.scaleIndex].type!="thermometer"||this.isScaleModified||(this._modifyWidth(),this.isScaleModified=!0);this.contextEl.getImageData&&(this.scaleImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_setTicksCordinates:function(n){var i,u,f,r,t;if(this.scaleEl[this.scaleIndex].majorIntervalValue>this.scaleEl[this.scaleIndex].minorIntervalValue){for(r=n.type=="majorinterval"?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,n.placement=="near"?i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]:this.scaleStartY[this.scaleIndex]:n.placement=="far"?i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width:n.placement=="center"&&(i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2),u=n.placement=="near"?-n.height:n.height,t=this.scaleEl[this.scaleIndex].maximum;t>=this.scaleEl[this.scaleIndex].minimum;t-=r)(r==this.scaleEl[this.scaleIndex].minorIntervalValue&&t%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||r==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(f=this._getClockwiseLinePosition(t),this.region={lineChangePosition:f+(this.Model.orientation=="horizontal"?n.distanceFromScale.x:n.distanceFromScale.y),lineStaticPosition:i+(this.Model.orientation=="horizontal"?n.distanceFromScale.y:n.distanceFromScale.x)},this.style={lineHeight:u,angle:this.Model.orientation=="Vertical"?n.angle:n.angle+270,tickShape:n.TickShape,strokeStyle:n.color?n.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.color):this.Model.tickColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.tickColor),lineWidth:n.width},this.Model.drawTicks&&this._onDrawTicks(this.Model.orientation=="Vertical"?n.angle:n.angle+270,t),this._drawTickMark(this.region,this.style));this.contextEl.getImageData&&(this.tickImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))}},_drawTickMark:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.lineWidth=t.lineWidth;this.contextEl.strokeStyle=t.strokeStyle;this.Model.orientation=="Vertical"?this.contextEl.translate(n.lineStaticPosition,n.lineChangePosition):this.contextEl.translate(n.lineChangePosition,n.lineStaticPosition);this.contextEl.lineTo(0,0);this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.contextEl.rotate(Math.PI*(t.angle/180)):this.contextEl.rotate(-(Math.PI*(t.angle/180)));this.contextEl.lineTo(t.lineHeight,0);this.contextEl.stroke();this.contextEl.restore();this.contextEl.closePath()},_addDecimal:function(n,t){var r=n.toString(),u=t.toString(),f,e,i,o;return f=r.indexOf(".")>-1?r.length-r.indexOf(".")-1:0,e=u.indexOf(".")>-1?u.length-u.indexOf(".")-1:0,i=f>e?f:e,o=(n*Math.pow(10,i)+t*Math.pow(10,i))/Math.pow(10,i),o},_setLabelCordinates:function(n){var u,f,i,e,r,o=this.model.locale,t;if(this.scaleEl[this.scaleIndex].majorIntervalValue>this.scaleEl[this.scaleIndex].minorIntervalValue)for(this.Model.orientation=="Vertical"?(u=n.distanceFromScale.x,f=n.distanceFromScale.y):(u=n.distanceFromScale.y,f=n.distanceFromScale.x),r=n.type=="major"?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,n.placement=="near"?(i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2:this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width-5,this.contextEl.textAlign=this.Model.orientation=="Vertical"?"right":"center"):n.placement=="far"?(i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width+5,this.contextEl.textAlign=this.Model.orientation=="Vertical"?"left":"center"):(this.contextEl.textAlign="center",i=this.Model.orientation=="Vertical"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+this.scaleEl[this.scaleIndex].border.width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+this.scaleEl[this.scaleIndex].border.width/2),t=this.scaleEl[this.scaleIndex].minimum;t<=this.scaleEl[this.scaleIndex].maximum;t=this._addDecimal(t,r))(r==this.scaleEl[this.scaleIndex].minorIntervalValue&&t%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||r==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(e=this.scaleEl[this.scaleIndex].direction=="counterclockwise"?this._getCounterClockwiseLinePosition(t):this._getClockwiseLinePosition(t),this.labelValue=t,this.region={lineChangePosition:e+f,lineStaticPosition:i+u},this.style={angle:this.Model.orientation=="Vertical"?n.angle:n.angle+270,fillStyle:n.textColor?n.textColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.textColor):this.Model.labelColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.labelColor),opacity:isNaN(n.opacity)?1:n.opacity,font:this._getFontString(this,n.font),textValue:this.labelValue},this.style.textValue=this.labelValue=o&&this.model.enableGroupSeparator?this.labelValue.toLocaleString(o):this.labelValue,this.Model.drawLabels&&this._onDrawLabels(this.Model.orientation=="Vertical"?n.angle:n.angle+270),this._drawLabel(this.region,this.style,!1));this.contextEl.getImageData&&(this.labelImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawLabel:function(n,i,r){if(this.contextEl.beginPath(),this.contextEl.save(),this.contextEl.textBaseline="middle",this.contextEl.fillStyle=i.fillStyle,this.contextEl.font=i.font,i.opacity&&(this.contextEl.globalAlpha=i.opacity),this.Model.orientation=="Vertical"?(this.contextEl.translate(n.lineStaticPosition,n.lineChangePosition),this.model.tooltip.showLabelTooltip&&!r&&this._savedPoints.push({startX:n.lineStaticPosition+5,startY:n.lineChangePosition+10,width:15,height:15,value:i.textValue}),this.model.tooltip.showCustomLabelTooltip&&r&&this._savedPoints.push({startX:n.lineStaticPosition-35,startY:n.lineChangePosition+10,width:110,height:15,value:i.textValue})):(this.contextEl.translate(n.lineChangePosition,n.lineStaticPosition),this.model.tooltip.showLabelTooltip&&!r&&this._savedPoints.push({startX:n.lineChangePosition+10,startY:n.lineStaticPosition+10,width:15,height:15,value:i.textValue}),this.model.tooltip.showCustomLabelTooltip&&r&&this._savedPoints.push({startX:n.lineChangePosition-35,startY:n.lineStaticPosition+10,width:110,height:15,value:i.textValue})),this.contextEl.lineTo(0,0),this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.contextEl.rotate(Math.PI*(i.angle/180)):this.contextEl.rotate(-(Math.PI*(i.angle/180))),!t.isNullOrUndefined(r)&&!r){var u=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitTextPlacement;t.isNullOrUndefined(u)||u.toString()!="back"?t.isNullOrUndefined(u)||u.toString()!="front"||(i.textValue=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText+i.textValue):i.textValue=i.textValue+this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText}this.contextEl.fillText(i.textValue,0,0);this.contextEl.fill();this.contextEl.restore()},_drawScaleBarPointer:function(n,t){n.value=n.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:n.value;n.value=n.value<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:n.value;var u,r,s,f,e,o,c,i,h;h=[{ColorStop:0,Color:this.Model.pointerGradient1=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:this.Model.pointerGradient2=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient2}];s=this.scaleEl[this.scaleIndex].type=="roundedrectangle"?5:0;this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?(r=this._getClockwiseLinePosition(n.value),this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isScaleModified&&(this._restoreWidth(),this.isModify=!0),this.Model.orientation=="Vertical"?(i=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex],i+n.width,this.scaleStartY[this.scaleIndex])):(i=this.scaleStartX[this.scaleIndex],u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2,i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+n.width/2))):(r=this._getCounterClockwiseLinePosition(n.value),this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isScaleModified&&(this._restoreWidth(),this.isModify=!0),this.Model.orientation=="Vertical"?(i=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r,i+n.width,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r)):(i=this.scaleEl[this.scaleIndex].type=="thermometer"?r-this.scaleEl[this.scaleIndex].width/2-this.scaleEl[this.scaleIndex].border.width/2:r-this.scaleEl[this.scaleIndex].border.width/2,u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2,i,this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2+n.width/2)));n.backgroundColor?c=n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):n.gradients?this._setGradientColor(this,u,n.gradients.colorInfo):this.Model.ScaleInterior?this._setGradientColor(this,u,this.Model.ScaleInterior.colorInfo):this._setGradientColor(this,u,h);this.Model.orientation=="Vertical"?(o=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].border.width/2:r,this.scaleEl[this.scaleIndex].direction=="counterclockwise"&&this.scaleEl[this.scaleIndex].type=="thermometer"&&(o=o-this.scaleEl[this.scaleIndex].width/2),f=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?r-this.scaleStartY[this.scaleIndex]:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r-this.scaleEl[this.scaleIndex].border.width/2,e=n.width):(o=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,f=n.width,e=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?r-this.scaleStartX:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].length-r);this.region={startX:i+this.scaleEl[this.scaleIndex].border.width/2,startY:o};this.style={width:this.scaleEl[this.scaleIndex].type=="thermometer"&&this.Model.orientation=="horizontal"?e+f/2-this.scaleEl[this.scaleIndex].border.width/2:e,lineWidth:n.border.width,radius:s,topRounded:!1,isStroke:!1,isFill:!0,height:this.scaleEl[this.scaleIndex].type=="thermometer"&&this.Model.orientation=="Vertical"?f+e/2:f,strokeStyle:n.border.color==null?this.Model.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.borderColor):n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color),fillStyle:n.backgroundColor?n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):u=="transparent"?"rgba(0,0,0,0)":this._getColor(n,u),opacity:isNaN(n.opacity)?.4:n.opacity,calDistance:this.scaleEl[this.scaleIndex].type=="thermometer"&&this.Model.orientation=="Vertical"?(this.scaleEl[this.scaleIndex].width-this.barPointerEl[this.barPointerIndex].width)/2:0};this.value(n.value);this._notifyArrayChange&&this._notifyArrayChange("scales["+this.scaleIndex+"]barpointers["+t+"]value",n.value);this.Model.drawBarPointers&&this._onDrawBarPointers(n.value);this._drawFrame(this.scaleEl[this.scaleIndex].type,this.region,this.style);this.contextEl.getImageData&&(this.barPointerImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawMarkerPointer:function(n,t){n.value=n.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:n.value;n.value=n.value<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:n.value;var i,f,o,e,r,u,s,h=[{ColorStop:0,Color:this.Model.pointerGradient1=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:this.Model.pointerGradient2=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient2}];this.markerPlacement=n.placement;o=Math.sqrt(n.width*n.width+n.length*n.length)/2;this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isModify&&this._modifyWidth();this.Model.orientation=="Vertical"?(this.markerPlacement=="far"&&(i=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,r=0),this.markerPlacement=="near"&&(i=n.type=="star"?this.scaleStartX[this.scaleIndex]+n.distanceFromScale-n.width:this.scaleStartX[this.scaleIndex]+n.distanceFromScale,r=180),this.markerPlacement=="center"&&(i=n.type=="circle"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale+n.border.width:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,r=0)):(this.markerPlacement=="far"&&(i=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,r=90),this.markerPlacement=="near"&&(i=n.type=="star"?this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale-n.length:this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,r=270),this.markerPlacement=="center"&&(i=n.type=="circle"?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.length/2+n.distanceFromScale+n.border.width:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.length/2+n.distanceFromScale,r=90));e=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this._getClockwiseLinePosition(n.value):this._getCounterClockwiseLinePosition(n.value);n.type=="star"?this.Model.orientation=="Vertical"?(u=this.contextEl.createLinearGradient(i,this.scaleStartY[this.scaleIndex],i+n.width,this.scaleStartY[this.scaleIndex]),f=e-n.length/3):(u=this.contextEl.createLinearGradient(e,i,e,i+n.length),f=e-n.width/2):(u=this.contextEl.createLinearGradient(0,0,n.width,0),f=e);n.type=="roundedrectangle"&&(this.Model.orientation=="Vertical"&&this.markerPlacement=="near"?f+=n.length:this.Model.orientation=="horizontal"&&(this.markerPlacement=="near"&&(f-=n.width),i+=n.width/2));n.backgroundColor?s=n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):n.gradients?this._setGradientColor(this,u,n.gradients.colorInfo):this.Model.PointerInterior?this._setGradientColor(this,u,this.Model.PointerInterior.colorInfo):this._setGradientColor(this,u,h);this.region={startX:this.Model.orientation=="Vertical"?i:f,startY:this.Model.orientation=="Vertical"?f:i};this.style={width:n.width,radius:n.type=="rectangle"?0:o,height:n.length,lineWidth:n.border.width,isFill:!0,isStroke:!0,angle:r,strokeStyle:n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color),markerPlacement:this.markerPlacement,opacity:isNaN(n.opacity)?.4:n.opacity,fillStyle:n.backgroundColor?n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):u=="transparent"?"rgba(0,0,0,0)":this._getColor(n,u)};this.value(n.value);this._notifyArrayChange&&this._notifyArrayChange("scales["+this.scaleIndex+"]markerpointers["+t+"]value",n.value);this.Model.drawMarkerPointers&&this._onDrawMarkerPointers(r,n.value);n.type=="roundedrectangle"&&(this.style.radius=5);this._drawMarkerType(n.type,this.region,this.style);this.scaleEl[this.scaleIndex].type=="thermometer"&&this.isModify&&(this._restoreWidth(),this.isScaleModified=!1);this.contextEl.getImageData&&(this.markerPointerImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawMarkerType:function(n,t,i){switch(n){case"rectangle":this._drawRectangle(t,i,this);break;case"triangle":this._drawTriangle(t,i,this);break;case"ellipse":this._drawEllipse(t,i,this);break;case"diamond":this._drawDiamond(t,i,this);break;case"pentagon":this._drawPentagon(t,i,this);break;case"circle":this._drawCircle(t,i,this);break;case"slider":this._drawSlider(t,i,this);break;case"star":this._drawStar(t,i,this);break;case"pointer":this._drawPointer(t,i,this);break;case"wedge":this._drawWedge(t,i,this);break;case"trapezoid":this._drawTrapezoid(t,i,this);break;case"roundedrectangle":this._drawRoundedRectangle(t,i,this)}},_drawRange:function(n){var e,o,u,t,f,r,i,s,h;n.startValue<this.scaleEl[this.scaleIndex].maximum&&n.endValue>this.scaleEl[this.scaleIndex].minimum&&this.scaleEl[this.scaleIndex].minimum<this.scaleEl[this.scaleIndex].maximum&&n.endValue<=this.scaleEl[this.scaleIndex].maximum&&(e=n.startValue<this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:n.startValue,o=n.endValue>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:n.endValue,this.rangePosition=n.placement,h=[{ColorStop:0,Color:this.Model.pointerGradient1=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:this.Model.pointerGradient2=="transparent"?"rgba(0,0,0,0)":this.Model.pointerGradient2}],u=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this._getClockwiseLinePosition(e):this._getCounterClockwiseLinePosition(e),t=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this._getClockwiseLinePosition(o):this._getCounterClockwiseLinePosition(o),this.Model.orientation=="Vertical"?(n.placement=="far"&&(f=this.scaleStartX[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width),n.placement=="near"&&(f=this.scaleStartX[this.scaleIndex]+n.distanceFromScale),n.placement=="center"&&(f=n.startWidth>n.endWidth?this.scaleStartX[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.startWidth/2:this.scaleStartX[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.endWidth/2),i=this.contextEl.createLinearGradient(t,t,t,u),this.region={startX:f,startY:u,endY:t}):(n.placement=="far"&&(r=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+n.distanceFromScale+this.scaleEl[this.scaleIndex].border.width),n.placement=="near"&&(r=this.scaleStartY[this.scaleIndex]+n.distanceFromScale),n.placement=="center"&&(r=n.startWidth>n.endWidth?this.scaleStartY[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.startWidth/2:this.scaleStartY[this.scaleIndex]+n.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-n.endWidth/2),i=this.contextEl.createLinearGradient(t,r,u,r),this.region={startX:u,startY:r,endX:t}),n.backgroundColor?s=n.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.backgroundColor):n.gradients?this._setGradientColor(this,i,n.gradients.colorInfo):this.Model.RangeInterior?this._setGradientColor(this,i,this.Model.RangeInterior.colorInfo):this._setGradientColor(this,i,h),this.style={startWidth:n.startWidth,lineWidth:n.border.width,isStroke:!0,isFill:!0,opacity:isNaN(n.opacity)?.4:n.opacity,endWidth:n.endWidth,fillStyle:n.backgroundColor?s=="transparent"?"rgba(0,0,0,0)":this._getColor(n,s):i=="transparent"?"rgba(0,0,0,0)":this._getColor(n,i),strokeStyle:n.border.color?n.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(n,n.border.color):this.Model.borderColor=="transparent"?"rgba(0,0,0,0)":this._getColor(n,this.Model.borderColor)},this.Model.drawRange&&this._onDrawRange(),this._drawRangeBar(this.region,this.style),this.contextEl.getImageData&&(this.rangeImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height)))},_drawRangeBar:function(n,t){this._contextOpenPath(t,this);this.Model.orientation=="Vertical"?(this.contextEl.lineTo(n.startX,n.startY),this.contextEl.lineTo(n.startX,n.endY),this.rangePosition=="near"?(this.contextEl.lineTo(n.startX-t.endWidth,n.endY),this.contextEl.lineTo(n.startX-t.startWidth,n.startY)):(this.contextEl.lineTo(n.startX+t.endWidth,n.endY),this.contextEl.lineTo(n.startX+t.startWidth,n.startY))):(this.contextEl.lineTo(n.startX,n.startY),this.contextEl.lineTo(n.endX,n.startY),this.rangePosition=="near"?(this.contextEl.lineTo(n.endX,n.startY-t.endWidth),this.contextEl.lineTo(n.startX,n.startY-t.startWidth)):(this.contextEl.lineTo(n.endX,n.startY+t.endWidth),this.contextEl.lineTo(n.startX,n.startY+t.startWidth)));this._contextClosePath(t,this)},_setCustomLabelCordinates:function(n,t){this._customLblMaxSize=this._customLblMaxSize<parseFloat(t.font.size.match(/\d+/)[0])?parseFloat(t.font.size.match(/\d+/)[0]):this._customLblMaxSize;var i,r;this.contextEl.textAlign="center";this.Model.orientation=="Vertical"?(i=this.bounds.width*(t.position.x/100),r=this.bounds.height*(t.position.y/100)):(i=this.bounds.width*(t.position.x/100),r=this.bounds.height*(t.position.y/100));this.region={lineStaticPosition:this.Model.orientation=="Vertical"?i:r,lineChangePosition:this.Model.orientation=="Vertical"?r:i};this.style={angle:t.textAngle,textValue:t.value,fillStyle:t.color?t.color=="transparent"?"rgba(0,0,0,0)":this._getColor(t,t.color):this.Model.labelColor=="transparent"?"rgba(0,0,0,0)":this._getColor(t,this.Model.labelColor),font:this._getFontString(this,t.font)};this.Model.drawCustomLabel&&this._onDrawCustomLabel();this._drawLabel(this.region,this.style,!0);this.contextEl.getImageData&&(this.customLabelImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawIndicator:function(i,r){var u=this,f,e,o,s=!1;f=(this.bounds.width-2*r.width)*(r.position.x/100);e=(this.bounds.height-2*r.height)*(r.position.y/100);o={x:this.bounds.width*(r.textLocation.x/100),y:this.bounds.height*(r.textLocation.y/100)};u.region={startX:r.type=="circle"?f+r.width:f,textLocation:o,startY:r.type=="circle"?e+r.height:e,startAngle:0,endAngle:2*Math.PI};u.style={radius:r.type=="roundedrectangle"?2:0,strokeStyle:r.border.color?r.border.color=="transparent"?"rgba(0,0,0,0)":this._getColor(r,r.border.color):this._getColor(r,"#FFFFFF"),angle:0,circleRadius:(r.height+r.width)/2,height:r.height,width:r.width,lineWidth:r.border.width,fillStyle:r.backgroundColor?r.backgroundColor=="transparent"?"rgba(0,0,0,0)":this._getColor(r,r.backgroundColor):this._getColor(r,"#FFFFFF"),isStroke:!0,isFill:!0,indicatorText:null,textColor:null,font:null,counterClockwise:!1};this.Model.drawIndicators&&this._onDrawIndicators(u.style,u.region);r.stateRanges!=null&&n.each(r.stateRanges,function(n,i){u.markerPointerEl[u.markerPointerIndex].value>=i.startValue&&u.markerPointerEl[u.markerPointerIndex].value<=i.endValue&&(s=!0,!t.isNullOrUndefined(i.text)&&i.text.length>0&&(u.style.indicatorText=i.text,u.style.textColor=i.textColor=="transparent"?"rgba(0,0,0,0)":u._getColor(r,i.textColor),u.style.font=u._getFontString(u,r.font)),r.type!="text"?(u.style.strokeStyle=i.borderColor=="transparent"?"rgba(0,0,0,0)":u._getColor(r,i.borderColor),u.style.fillStyle=i.backgroundColor=="transparent"?"rgba(0,0,0,0)":u._getColor(r,i.backgroundColor),u._drawFrame(r.type,u.region,u.style,u)):r.type=="text"&&u._drawText(u.region,u.style))});s||r.type=="text"||this._drawFrame(r.type,u.region,u.style,u);this.contextEl.getImageData&&(this.indicatorImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawFrame:function(n,t,i){switch(n){case"circle":this._drawFrameCircle(t,i,this);break;case"rectangle":this._drawFrameRectangle(t,i,this);break;case"roundedrectangle":this._drawFrameRoundedRectangle(t,i,this);break;case"thermometer":this._drawFrameThermometer(t,i,this)}},_drawText:function(n,t){this.contextEl.beginPath();this.contextEl.textAlign="center";this.contextEl.fillStyle=t.textColor=="transparent"?"rgba(0,0,0,0)":t.textColor;this.contextEl.font=t.font;this.contextEl.fillText(t.indicatorText,n.textLocation.x,n.textLocation.y);this.contextEl.closePath()},_drawTriangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawPointer:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/4);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(t.width/2,t.height/4);this._contextClosePath(t,i)},_drawWedge:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(3*t.width/4,0);i.contextEl.lineTo(t.width,t.height/2);this._contextClosePath(t,i)},_drawSlider:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/4,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(t.width/4,t.height/2);this._contextClosePath(t,i)},_drawStar:function(n,t,i){this._contextOpenPath(t,i);i.Model.orientation=="horizontal"&&i.markerPlacement=="near"?(i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY),i.contextEl.lineTo(n.startX,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height-t.height/3),i.contextEl.lineTo(n.startX+t.width/6,n.startY),i.contextEl.lineTo(n.startX+t.width/2,n.startY+t.height)):(i.contextEl.lineTo(n.startX+t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width,n.startY+t.height/3),i.contextEl.lineTo(n.startX,n.startY+t.height/3),i.contextEl.lineTo(n.startX+t.width-t.width/6,n.startY+t.height),i.contextEl.lineTo(n.startX+t.width/2,n.startY));this._contextClosePath(t,i)},_drawPentagon:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/3,-t.height/2);i.contextEl.lineTo(t.width,-t.height/4);i.contextEl.lineTo(t.width,t.height/4);i.contextEl.lineTo(t.width/3,t.height/2);this._contextClosePath(t,i)},_drawDiamond:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(t.width/2,-t.height/2);i.contextEl.lineTo(t.width,0);i.contextEl.lineTo(t.width/2,t.height/2);i.contextEl.lineTo(0,0);this._contextClosePath(t,i)},_drawCircle:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_drawTrapezoid:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/4);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/4);this._contextClosePath(t,i)},_drawRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.lineTo(0,0);i.contextEl.lineTo(0,-t.height/2);i.contextEl.lineTo(t.width,-t.height/2);i.contextEl.lineTo(t.width,t.height/2);i.contextEl.lineTo(0,t.height/2);this._contextClosePath(t,i)},_drawRoundedRectangle:function(n,t,i){t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY-t.height/2);this._setContextRotation(t,i);i.contextEl.lineTo(t.radius,0);i.contextEl.lineTo(t.width-t.radius,0);i.contextEl.quadraticCurveTo(t.width,0,t.width,t.radius);i.contextEl.lineTo(t.width,t.height-t.radius);i.contextEl.quadraticCurveTo(t.width,t.height,t.width-t.radius,t.height);i.contextEl.lineTo(t.radius,t.height);i.contextEl.quadraticCurveTo(0,t.height,0,t.height-t.radius);i.contextEl.lineTo(0,t.radius);i.contextEl.quadraticCurveTo(0,0,t.radius,0);this._contextClosePath(t,i)},_drawCustomImage:function(t,i){var r=new Image;n(r).on("load",function(){t.contextEl.drawImage(this,0,0,t.Model.width,t.Model.height);t.Model.scales!=null&&t._drawScales();t.Model.Items!=null&&t._renderItems()}).attr("src",i)},_drawEllipse:function(n,t,i){var r=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i);this._contextOpenPath(t,i);i.contextEl.translate(n.startX,n.startY);this._setContextRotation(t,i);i.contextEl.scale(2,1);i.contextEl.arc(r/2,0,r/2,0,Math.PI*2,!0);this._contextClosePath(t,i)},_getIndicatorImage:function(){return this.pointerImage?this.pointerImage:this._getMarkerPointerImage()},_getBarPointerImage:function(){return this.customLabelImage?this.customLabelImage:this._getCustomLabelImage()},_getMarkerPointerImage:function(){return this.barPointerImage?this.barPointerImage:this._getCustomLabelImage()},_getCustomLabelImage:function(){return this.rangeImage?this.rangeImage:this._getRangeImage()},_getRangeImage:function(){return this.labelImage?this.labelImage:this._getLabelImage()},_getLabelImage:function(){return this.tickImage?this.tickImage:this._getTickImage()},_getTickImage:function(){return this.scaleImage?this.scaleImage:this.outerImage},setPointerValue:function(n,i,r){n<this.Model.scales.length&&i<this.Model.scales[n].markerPointers.length&&r!=null&&(r<=this.scaleEl[n].maximum&&r>=this.scaleEl[n].minimum&&(this.scaleEl[n].markerPointers[i].value=r),this.contextEl.putImageData?(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),!t.isNullOrUndefined(this.outerDiv)&&this.model.scale[n].showCustomLabels&&this.outerDiv.empty(),this._setCustomLabel(),this._setMarkerPointers(),this._setIndicators()):this.initialize())},getPointerValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].value:null},setPointerWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].width=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].width:null},setPointerHeight:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].length=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerHeight:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].length:null},_getColor:function(n,t){return typeof t=="string"?t:"rgba("+t.r+", "+t.g+","+t.b+", "+t.a/255+")"},setPointerDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].distanceFromScale=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].distanceFromScale:null},setPointerPlacement:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].placement=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getPointerPlacement:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].placement:null},setMarkerStyle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length&&i!=null&&(this.scaleEl[n].markerPointers[t].type=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers()):this.initialize())},getMarkerStyle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].markerPointers.length?this.scaleEl[n].markerPointers[t].type:null},setBarPointerValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length&&i!=null&&(i<=this.scaleEl[n].maximum&&i>=this.scaleEl[n].minimum&&(this.scaleEl[n].barPointers[t].value=i),this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():this._reDrawBarPointer():this.initialize())},getBarPointerValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length?this.scaleEl[n].barPointers[t].value:null},setBarWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length&&i!=null&&(this.scaleEl[n].barPointers[t].width=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():this._reDrawBarPointer():this.initialize())},getBarWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length?this.scaleEl[n].barPointers[t].width:null},setBarDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length&&i!=null&&(this.scaleEl[n].barPointers[t].distanceFromScale=i,this.contextEl.putImageData?this.scaleEl[this.scaleIndex].type=="thermometer"?this.initialize():this._reDrawBarPointer():this.initialize())},getBarDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].barPointers.length?this.scaleEl[n].barPointers[t].distanceFromScale:null},setCustomLabelValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].value=i,this.contextEl.putImageData?this._reDrawCustomLabel():this.initialize())},getCustomLabelValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].value:null},setCustomLabelAngle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length&&i!=null&&(this.scaleEl[n].customLabels[t].textAngle=i,this.contextEl.putImageData?this._reDrawCustomLabel():this.initialize())},getCustomLabelAngle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].customLabels.length?this.scaleEl[n].customLabels[t].textAngle:null},setRangeStartValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].startValue=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeStartValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].startValue:null},setRangeEndValue:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].endValue=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeEndValue:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].endValue:null},setRangeStartWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].startWidth=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeStartWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].startWidth:null},setRangeEndWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].endWidth=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeEndWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].endWidth:null},setRangeDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].distanceFromScale=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].distanceFromScale:null},setRangePosition:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].placement=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangePosition:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].placement:null},setRangeBorderWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length&&i!=null&&(this.scaleEl[n].ranges[t].border.width=i,this.contextEl.putImageData?this._reDrawRange():this.initialize())},getRangeBorderWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ranges.length?this.scaleEl[n].ranges[t].border.width:null},setLabelAngle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].angle=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelAngle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].angle:null},setLabelStyle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].type=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelStyle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].type:null},setLabelPlacement:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].placement=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelPlacement:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].placement:null},setLabelXDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].distanceFromScale.x=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelXDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].distanceFromScale.x:null},setLabelYDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].labels.length&&i!=null&&(this.scaleEl[n].labels[t].distanceFromScale.y=i,this.contextEl.putImageData?this._reDrawLabel():this.initialize())},getLabelYDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].labels.length?this.scaleEl[n].labels[t].distanceFromScale.y:null},setTickAngle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].angle=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickAngle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].angle:null},setTickWidth:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].width=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickWidth:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].width:null},setTickHeight:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].height=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickHeight:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].height:null},setTickStyle:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].type=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickStyle:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].type:null},setTickPlacement:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].placement=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickPlacement:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].placement:null},setTickXDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].distanceFromScale.x=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickXDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].distanceFromScale.x:null},setTickYDistanceFromScale:function(n,t,i){n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length&&i!=null&&(this.scaleEl[n].ticks[t].distanceFromScale.y=i,this.contextEl.putImageData?this._reDrawTickMark():this.initialize())},getTickYDistanceFromScale:function(n,t){return n<this.Model.scales.length&&t<this.Model.scales[n].ticks.length?this.scaleEl[n].ticks[t].distanceFromScale.y:null},setScaleLocation:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].position.x=t.x,this.scaleEl[n].position.y=t.y,this.initialize())},getScaleLocation:function(n){return n<this.Model.scales.length?{x:this.scaleEl[n].position.x,y:this.scaleEl[n].position.y}:null},setMaximumValue:function(n,t){n<this.Model.scales.length&&t!=null&&(t>this.scaleEl[n].minimum&&(this.scaleEl[n].maximum=t),this.initialize())},getMaximumValue:function(n){return n<this.Model.scales.length?this.scaleEl[this.scaleIndex].maximum:null},setMinimumValue:function(n,t){n<this.Model.scales.length&&t!=null&&(t<this.scaleEl[n].maximum&&(this.scaleEl[n].minimum=t),this.initialize())},getMinimumValue:function(n){return n<this.Model.scales.length?this.scaleEl[this.scaleIndex].minimum:null},setScaleBarSize:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].width=t,this.initialize())},getScaleBarSize:function(n){return n<this.Model.scales.length?this.scaleEl[n].width:null},setScaleBarLength:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].length=t,this.initialize())},setScaleStyle:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].type=t,this.initialize())},getScaleStyle:function(n){return n<this.Model.scales.length?this.scaleEl[n].type:null},getScaleBarLength:function(n){return n<this.Model.scales.length?this.scaleEl[n].length:null},setScaleBorderWidth:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].border.width=t,this.initialize())},setScaleDirection:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].direction=t,this.initialize())},getScaleDirection:function(n){return n<this.Model.scales.length?this.scaleEl[n].direction:null},getScaleBorderWidth:function(n){return n<this.Model.scales.length?this.scaleEl[n].border.width:null},setMajorIntervalValue:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].majorIntervalValue=t,this.initialize())},getMajorIntervalValue:function(n){return n<this.Model.scales.length?this.scaleEl[n].majorIntervalValue:null},setMinorIntervalValue:function(n,t){n<this.Model.scales.length&&t!=null&&(this.scaleEl[n].minorIntervalValue=t,this.initialize())},getMinorIntervalValue:function(n){return n<this.Model.scales.length?this.scaleEl[n].minorIntervalValue:null},_reDrawBarPointer:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.customLabelImage)?t.isNullOrUndefined(this.rangeImage)?t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage:this.rangeImage:this.customLabelImage();this.contextEl.putImageData(n,0,0);this._setBarPointers();this._setMarkerPointers();this._setIndicators()}else this.contextEl.putImageData!="undefined"&&(this.contextEl.putImageData(this._getBarPointerImage(),0,0),this._setBarPointers(),this._setMarkerPointers(),this._setIndicators())},_reDrawMarkerPointer:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.customLabelImage)?t.isNullOrUndefined(this.rangeImage)?t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage:this.rangeImage:this.customLabelImage();this.contextEl.putImageData(n,0,0);this._setMarkerPointers()}else this.contextEl.putImageData!="undefined"&&(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),this._setMarkerPointers())},_reDrawCustomLabel:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.rangeImage)?t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage:this.rangeImage;this.contextEl.putImageData(n,0,0);this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getCustomLabelImage(),0,0),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},_reDrawRange:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.labelImage)?t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage:this.labelImage;this.contextEl.putImageData(n,0,0);this._setRange();this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getRangeImage(),0,0),this._setRange(),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},_reDrawLabel:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.tickImage)?t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage:this.tickImage;this.contextEl.putImageData(n,0,0);this._setLabels();this._setRange();this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getLabelImage(),0,0),this._setLabels(),this._setRange(),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},_reDrawTickMark:function(){if(this.Model.frame.backgroundImageUrl){var n=t.isNullOrUndefined(this.scaleImage)?null:this.scaleImage;this.contextEl.putImageData(n,0,0);this._setTicks();this._setLabels();this._setRange();this._setCustomLabel();this._setIndicators();this._setBarPointers();this._setMarkerPointers()}else this.contextEl.putImageData(this._getTickImage(),0,0),this._setTicks(),this._setLabels(),this._setRange(),this._setCustomLabel(),this._setIndicators(),this._setBarPointers(),this._setMarkerPointers()},refresh:function(){this._init()},exportImage:function(n,i){var f,u,o,r,c,s;if(t.browserInfo().name==="msie"&&parseFloat(t.browserInfo().version)<10)return!1;f=this.canvasEl[0].toDataURL();f=f.replace(/^data:[a-z]*;,/,"");var l=f.split(","),e=atob(l[1]),h=new ArrayBuffer(e.length),a=new Uint8Array(h);for(u=0;u<e.length;u++)a[u]=e.charCodeAt(u);return o=new Blob([h],{type:"image/png"}),t.browserInfo().name==="msie"?window.navigator.msSaveOrOpenBlob(o,n+"."+i):(r=document.createElement("a"),c=URL.createObjectURL(o),r.href=c,r.setAttribute("download",n+"."+i),document.createEvent?(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(s)):r.fireEvent&&r.fireEvent("onclick")),!0},resizeCanvas:function(){var f,e,u,i,r;if(_linearGaugeCount=_linearGaugeCount!=0?_linearGaugeCount-1:n(".e-lineargauge").length-1,e=!0,t.isNullOrUndefined(this.GaugeEl.parent().attr("style"))||(f=this.GaugeEl.parent().attr("style").split(";")),t.isNullOrUndefined(f)||n.each(f,function(n,t){while(t.indexOf("width")!=-1){e=t.indexOf("px")==-1?!0:!1;break}}),e){for(u=window.innerWidth/initialLinearDivWidth,this.model.width*=u,i=0;this.model.scales[i]!=null;i++)for(this.model.scales[i].length*=u,r=0;this.model.scales[i].markerPointers[r]!=null||this.model.scales[i].barPointers[r]!=null||this.model.scales[i].indicators[r]!=null||this.model.scales[i].customLabels[r]!=null||this.model.scales[i].ranges[r]!=null||this.model.scales[i].labels[r]!=null||this.model.scales[i].ticks[r]!=null;r++)t.isNullOrUndefined(this.model.scales[i].markerPointers[r])||(this.model.scales[i].markerPointers[r].length*=u,this.model.scales[i].markerPointers[r].width*=u),t.isNullOrUndefined(this.model.scales[i].barPointers[r])||(this.model.scales[i].barPointers[r].distanceFromScale*=u,this.model.scales[i].barPointers[r].width*=u),!t.isNullOrUndefined(this.model.scales[i].indicators[r])&&this.model.scales[i].showIndicators&&(this.model.scales[i].indicators[r].height*=u,this.model.scales[i].indicators[r].width*=u,this.model.scales[i].indicators[r].position.x*=u,this.model.scales[i].indicators[r].textLocation.x*=u),t.isNullOrUndefined(this.model.scales[i].ticks[r])||(this.model.scales[i].ticks[r].length*=u,this.model.scales[i].ticks[r].width*=u),t.isNullOrUndefined(this.model.scales[i].ranges[r])||(this.model.scales[i].ranges[r].startWidth*=u,this.model.scales[i].ranges[r].endWidth*=u),t.isNullOrUndefined(this.model.scales[i].customLabels[r])||(this.model.scales[i].customLabels[r].positionType!="outer"&&(this.model.scales[i].customLabels[r].position.x*=u),this.model.scales[i].customLabels[r].font.size=parseFloat(this.model.scales[i].customLabels[r].font.size.match(/\d+/)[0])*u<10?"10px":parseFloat(this.model.scales[i].customLabels[r].font.size.match(/\d+/)[0])*u>this._customLblMaxSize?this._customLblMaxSize.toString()+"px":(parseFloat(this.model.scales[i].customLabels[r].font.size.match(/\d+/)[0])*u).toString()+"px");this._render();_linearGaugeCount==0&&(initialLinearDivWidth=window.innerWidth)}},_onDrawTicks:function(n,t){var r={index:this.tickIndex,element:this.tickEl[this.tickIndex],angle:parseInt(n),value:t},i={Object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region};this._trigger("drawTicks",i)},_onDrawLabels:function(n){var t={index:this.labelIndex,element:this.labelEl[this.labelIndex],angle:parseInt(n),value:this.labelValue},i={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,label:t};this._trigger("drawLabels",i)},_onDrawBarPointers:function(n){var t={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,barPointerIndex:this.barPointerIndex,barElement:this.barPointerEl[this.barPointerIndex],context:this.contextEl,style:this.style,position:this.region,pointerValue:n};this._trigger("drawBarPointers",t)},_onDrawMarkerPointers:function(n,t){var i={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,markerPointerIndex:this.markerPointerIndex,markerElement:this.markerPointerEl[this.markerPointerIndex],context:this.contextEl,style:this.style,position:this.region,pointerValue:t,pointerAngle:parseInt(n)};this._trigger("drawMarkerPointers",i)},_onDrawRange:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,rangeIndex:this.rangeIndex,rangeElement:this.rangeEl[this.rangeIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawRange",n)},_onDrawCustomLabel:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,customLabelIndex:this.customLabelIndex,customLabelElement:this.customLabelEl[this.customLabelIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawCustomLabel",n)},_onDrawIndicators:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,indicatorIndex:this.indicatorIndex,indicatorEl:this.indicatorEl[this.indicatorIndex],context:this.contextEl,style:this.style,position:this.region};this._trigger("drawIndicators",n)},onLoad:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("load",n)},_onInit:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("init",n)},_onRenderComplete:function(){var n={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("renderComplete",n)},_onMouseClick:function(n){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:n},i={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,markerPointer:t};this._trigger("mouseClick",i)},_onMouseClickMove:function(n){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:n},i={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,markerPointer:t};this._trigger("mouseClickMove",i)},_onMouseClickUp:function(n){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:n},i={object:this,scaleElement:this.model.scales[this.scaleIndex],scaleIndex:this.scaleIndex,context:this.contextEl,style:this.style,position:this.region,markerPointer:t};this._trigger("mouseClickUp",i)},_restoreWidth:function(){this.scaleEl[this.scaleIndex].length=this.scaleEl[this.scaleIndex].length+this.bottomRadius+this.scaleEl[this.scaleIndex].width;this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartY[this.scaleIndex]-this.bottomRadius-this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartX[this.scaleIndex]-this.bottomRadius-this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]-this.scaleEl[this.scaleIndex].width/2},_modifyWidth:function(){this.scaleEl[this.scaleIndex].length=this.scaleEl[this.scaleIndex].length-this.bottomRadius-this.scaleEl[this.scaleIndex].width;this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartY[this.scaleIndex]+this.bottomRadius+this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]=this.scaleEl[this.scaleIndex].direction.toLowerCase()=="clockwise"?this.scaleStartX[this.scaleIndex]+this.bottomRadius+this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2},_getClockwiseLinePosition:function(n){var t;return t=(n-this.scaleEl[this.scaleIndex].minimum)/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)*100,this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100):this.scaleStartX[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100)},_getCounterClockwiseLinePosition:function(n){var t;return t=this.scaleEl[this.scaleIndex].maximum-n+this.scaleEl[this.scaleIndex].minimum,t=(t-this.scaleEl[this.scaleIndex].minimum)/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)*100,this.Model.orientation=="Vertical"?this.scaleStartY[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100):this.scaleStartX[this.scaleIndex]+parseInt(t*this.scaleEl[this.scaleIndex].length/100)},_getValue:function(n){var i,t;return i=this.Model.orientation=="Vertical"?(n.y-this.scaleStartY[this.scaleIndex])/this.scaleEl[this.scaleIndex].length*100:(n.x-this.scaleStartX[this.scaleIndex])/this.scaleEl[this.scaleIndex].length*100,t=(i*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)+this.scaleEl[this.scaleIndex].minimum)/100,this.scaleEl[this.scaleIndex].direction=="counterclockwise"?this.scaleEl[this.scaleIndex].maximum-t:this.scaleEl[this.scaleIndex].minimum+t},_getPointerXPosition:function(n){var t,i;return this.Model.orientation=="Vertical"?(this.markerPlacement=="far"&&(t=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,i=0),this.markerPlacement=="near"&&(t=this.scaleStartX[this.scaleIndex]+n.distanceFromScale,i=180),this.markerPlacement=="center"&&(t=n.type=="circle"?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-Math.sqrt(n.length*n.length+n.width*n.width)/2+n.distanceFromScale:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.width/2+n.distanceFromScale,i=0)):(this.markerPlacement=="far"&&(t=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,i=90),this.markerPlacement=="near"&&(t=this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+n.distanceFromScale,i=270),this.markerPlacement=="center"&&(t=n.type=="circle"?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-Math.sqrt(n.length*n.length+n.width*n.width)/2+n.distanceFromScale:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-n.length/2+n.distanceFromScale,i=90)),{startx:t,angle:i}},_hexFromRGB:function(t,i,r){var u=[t.toString(16),i.toString(16),r.toString(16)];return n.each(u,function(n,t){t.length===1&&(u[n]="0"+t)}),u.join("").toUpperCase()},_setGradientColor:function(t,i,r){r.Name||typeof r=="string"?(i.addColorStop(0,r),i.addColorStop(1,r)):n.each(r,function(n,t){i.addColorStop(t.colorStop!=NaN?t.colorStop:0,typeof t.color=="string"?t.color:t.color)})},_getFontString:function(n,t){return t.fontStyle+" "+(t.size==null?"11px":t.size)+" "+t.fontFamily},_setPointerDimension:function(n,t){if(t.Model.orientation&&t.Model.orientation=="horizontal"){var i=n.width,r=n.height;n.height=i;n.width=r}return n},_setContextRotation:function(n,t){t.contextEl.rotate(Math.PI*(n.angle/180))},_browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},wireEvents:function(){var f=jQuery.uaMatch(navigator.userAgent),r=this._browserInfo(),i=r.isMSPointerEnabled,t=r.pointerEnabled,u;this.startEv=i?t?"pointerdown":"MSPointerDown":"touchstart mousedown";this.endEv=i?t?"pointerup":"MSPointerUp":"touchend mouseup";this.moveEv=i?t?"pointermove":"MSPointerMove":"touchmove mousemove";this.leaveEv=i?t?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.scrollEv=f.browser.toLowerCase()=="mozilla"?t?"mousewheel":"DOMMouseScroll":"mousewheel";this.model.browserInfo=r;u=this.model.readOnly?"pan-y pan-x":"none";n(this.element).css("touch-action",u);this.onMouseMoveHandler=n.proxy(this._onMouseMove,this);this.onMouseUpHandler=n.proxy(this._onMouseUp,this);this.onHoverOCustomLabel=n.proxy(this._onHoverOCustomLabel,this);this.onLeaveOCustomLabel=n.proxy(this._onLeaveOCustomLabel,this);this.model.readOnly||(this.onMouseDownHandler=n.proxy(this._onMouseDown,this),this._on(n(this.element),this.startEv,this._onMouseDown));(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&(n(this.canvasEl).bind(this.moveEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.scrollEv,this.onMouseMoveHandler),n(this.canvasEl).bind(this.startEv,this.onMouseDownHandler),n(this.canvasEl).bind(this.endEv,this.onLeaveOCustomLabel),n(this.canvasEl).bind(this.leaveEv,this.onLeaveOCustomLabel));this.element.bind(this.startEv,this.onMouseDownHandler);this.model.tooltip.showCustomLabelTooltip&&(n("."+this._id+"outercustomlbl").bind("mouseenter",this.onHoverOCustomLabel),n("."+this._id+"outercustomlbl").bind(this.leaveEv,this.onLeaveOCustomLabel))},unWireEvents:function(){this.element.unbind(this.startEv,this.onMouseDownHandler)},_onHoverOCustomLabel:function(n){(n.currentTarget.innerHTML!=null||n.currentTarget.innerHTML!="")&&this._showTooltip(n,n.currentTarget.innerHTML)},_onLeaveOCustomLabel:function(t){this.isTouch(t)?(this._performTooltip(t),window.clearTimeout(this.model.timer),this.model.timer=setTimeout(function(){n(".tooltipDiv").fadeOut(500)},1200)):this._hideTooltip()},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_onMouseDown:function(t){var r,u,e,o,h,f,s,i;this._blockDefaultActions(t);this._mouseDown=!0;f=this.isTouch(t)?10:0;s=t.originalEvent.touches?t.originalEvent.touches[0]:t;r={x:s.pageX-n(this.canvasEl).offset().left-(this.Model.frame.outerWidth+this.Model.frame.innerWidth),y:s.pageY-n(this.canvasEl).offset().top-(this.Model.frame.outerWidth+this.Model.frame.innerWidth)};i=this;this.model.readOnly||n.each(this.Model.scales,function(t,s){i.scaleIndex=t;s.markerPointers!=null&&(i.markerPointerEl=s.markerPointers,n.each(s.markerPointers,function(t,s){u=i.scaleEl[i.scaleIndex].direction.toLowerCase()=="clockwise"?i._getClockwiseLinePosition(s.value):i._getCounterClockwiseLinePosition(s.value);e=u+s.width;o=u-s.width;h=i._getPointerXPosition(s).startx;var c=i._isBetween((i.Model.orientation=="horizontal"?r.y:r.x)-s.width,(i.Model.orientation=="horizontal"?r.y:r.x)+s.width,h,f);(i.Model.orientation=="horizontal"?i._isBetween(o,e,r.x,f):i._isBetween(o,e,r.y,f))&&c&&(i.activeElement=s);i.Model.scales[i.scaleIndex].barPointers[t]!=null&&(i.activeBarElement=i.Model.scales[i.scaleIndex].barPointers[t]);i.model.mouseClick&&i._onMouseClick(s.value);i.onMouseMoveHandler=n.proxy(i._onMouseMove,i);i.onMouseUpHandler=n.proxy(i._onMouseUp,i);n(document).bind(i.moveEv,i.onMouseMoveHandler);n(document).bind(i.endEv,i.onMouseUpHandler)}))})},_isBetween:function(n,t,i,r){return n<t?i>=n-r&&i<=t+r:i>=t-r&&i<=n+r},_onMouseUp:function(){this._mouseDown=!1;this.mouseMove=!1;n(document).unbind(self.moveEv,self.onMouseMoveHandler);n(document).unbind(self.endEv,self.onMouseUpHandler);this.model.mouseClickUp&&this.activeElement&&this._onMouseClickUp(this.activeElement.value);this.activeElement=null},_mousePosition:function(n){if(!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=i){if(!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},_calTouchPosition:function(n){var i=jQuery.uaMatch(navigator.userAgent),t=this._mousePosition(n);n.pageX=t.x;n.pageY=t.y},getEvent:function(n){return n.targetTouches&&n.targetTouches[0]?n.targetTouches[0]:n},_onMouseMove:function(i){if(this._mouseDown&&!t.isNullOrUndefined(this.activeElement)){this._blockDefaultActions(i);var r=i.originalEvent.touches?i.originalEvent.touches[0]:i,u={x:r.pageX-n(this.canvasEl).offset().left-(this.Model.frame.outerWidth+this.Model.frame.innerWidth),y:r.pageY-n(this.canvasEl).offset().top-(this.Model.frame.outerWidth+this.Model.frame.innerWidth)};this.activeElement.value=this._getValue(u);this.value(this.activeElement.value);this.model.mouseClickMove&&this._onMouseClickMove(this.activeElement.value);this.activeBarElement&&(this.activeBarElement.value=this._getValue(u));this.contextEl.putImageData?this._reDrawBarPointer():this._init()}else(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&!this.isTouch(i)&&this._performTooltip(i)},_performTooltip:function(t){for(var r,u=!1,f=10,o=this.isTouch(t),i=0;this._savedPoints[i]!=null;i++)if(o){var c=this._calTouchPosition(t),e=this.getEvent(t),s=e.pageX,h=e.pageY,r={X:s-n(this.canvasEl).offset().left,Y:h-n(this.canvasEl).offset().top};r.X>this._savedPoints[i].startX-f&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width+f&&r.Y>this._savedPoints[i].startY-f&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height+f?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()}else r={X:t.pageX-n(this.canvasEl).offset().left,Y:t.pageY-n(this.canvasEl).offset().top},r.X>this._savedPoints[i].startX&&r.X<this._savedPoints[i].startX+this._savedPoints[i].width&&r.Y>this._savedPoints[i].startY&&r.Y<this._savedPoints[i].startY+this._savedPoints[i].height?(this._showTooltip(t,this._savedPoints[i].value),u=!0):u==!1&&this._hideTooltip()},_showTooltip:function(t,i){var e=i+"",r=n(".tooltipDiv"),o;r.length==0&&(r=n("<div class='tooltipDiv' style='position: absolute; z-index: 105; display: block;'><\/div>"),n(document.body).append(r));this.model.tooltip.templateID!=""&&this.model.tooltip.templateID!=null?(o=n("#"+this.model.tooltip.templateID).clone(),n(".tooltipDiv")[0].innerHTML="",n(o).css("display","block").appendTo(r),n(r).css({"background-color":this.model.backgroundColor,border:"1px solid #bbbcbb","border-radius":"3px",color:"#565656"}),r.html(r.html().replace("#label#",e))):(n(r).html(e),n(r).css({"background-color":"white",border:"2px solid #bbbcbb",position:"absolute",padding:"10px 20px","margin-top":"5px","text-align":"left",font:"12px Segoe UI","font-stretch":"condensed",display:"inline-block","border-radius":"3px",color:"#565656",width:"auto"}));var s=10,u=t.pageX+s,f=t.pageY+s;u=u+n(r).width()<n(window).width()?u:u-n(r).width();f=f+n(r).height()<n(window).height()?f:f-n(r).height();n(r).css("left",u);n(r).css("top",f);n(".tooltipDiv").show()},_hideTooltip:function(){n(".tooltipDiv").remove()},_setTheme:function(){var n=this.model.themeProperties[this.model.theme];this._setThemeColors(n)},_setThemeColors:function(n){var f=[],e=this.model.themeProperties,o,i,t,r,u;for(o in e)f.push(o);for(i=0;i<f.length;i++)for(this.model.backgroundColor=!this.model.backgroundColor||this.model.backgroundColor==e[f[i]].scales.backgroundColor?n.scales.backgroundColor:this.model.backgroundColor,this.model.borderColor=!this.model.borderColor||this.model.borderColor==e[f[i]].scales.border.color?n.scales.border.color:this.model.borderColor,this.model.labelColor=!this.model.labelColor||this.model.labelColor==e[f[i]].scales.labels.labelColor?n.scales.labels.labelColor:this.model.labelColor,this.model.tickColor=!this.model.tickColor||this.model.tickColor==e[f[i]].scales.ticks.color?n.scales.ticks.color:this.model.tickColor,t=0;t<this.model.scales.length;t++){for(r=0;r<this.model.scales[t].markerPointers.length;r++)this.model.scales[t].markerPointers[r].backgroundColor=!this.model.scales[t].markerPointers[r].backgroundColor||this.model.scales[t].markerPointers[r].backgroundColor==e[f[i]].scales.markerPointers.backgroundColor?n.scales.markerPointers.backgroundColor:this.model.scales[t].markerPointers[r].backgroundColor,this.model.scales[t].markerPointers[r].border.color=!this.model.scales[t].markerPointers[r].border.color||this.model.scales[t].markerPointers[r].border.color==e[f[i]].scales.markerPointers.border.color?n.scales.markerPointers.border.color:this.model.scales[t].markerPointers[r].border.color;for(u=0;u<this.model.scales[t].barPointers.length;u++)this.model.scales[t].barPointers[u].backgroundColor=!this.model.scales[t].barPointers[u].backgroundColor||this.model.scales[t].barPointers[u].backgroundColor==e[f[i]].scales.barPointers.backgroundColor?n.scales.barPointers.backgroundColor:this.model.scales[t].barPointers[u].backgroundColor,this.model.scales[t].barPointers[u].border.color=!this.model.scales[t].barPointers[u].border.color||this.model.scales[t].barPointers[u].border.color==e[f[i]].scales.barPointers.border.color?n.scales.barPointers.border.color:this.model.scales[t].barPointers[u].border.color}}});t.datavisualization.LinearGauge.TickType={MajorInterval:"majorinterval",MinorInterval:"minorinterval"};t.datavisualization.LinearGauge.LabelType={Major:"major",Minor:"minor"};t.datavisualization.LinearGauge.FontStyle={Bold:"bold",Italic:"italic",Regular:"regular",Strikeout:"strikeout",Underline:"underline"};t.datavisualization.LinearGauge.PointerPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.TickPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.LabelPlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.RangePlacement={Near:"near",Far:"far",Center:"center"};t.datavisualization.LinearGauge.UnitTextPlacement={Front:"front",Back:"back"};t.datavisualization.LinearGauge.Directions={Clockwise:"clockwise",CounterClockwise:"counterclockwise"};t.datavisualization.LinearGauge.ScaleType={Rectangle:"rectangle",RoundedRectangle:"roundedrectangle",Thermometer:"thermometer"};t.datavisualization.LinearGauge.IndicatorType={Rectangle:"rectangle",Circle:"circle",RoundedRectangle:"roundedrectangle",Text:"text"};t.datavisualization.LinearGauge.MarkerType={Rectangle:"rectangle",Triangle:"triangle",Ellipse:"ellipse",Diamond:"diamond",Pentagon:"pentagon",Circle:"circle",Star:"star",Slider:"slider",Pointer:"pointer",Wedge:"wedge",Trapezoid:"trapezoid",RoundedRectangle:"roundedrectangle"};t.datavisualization.LinearGauge.CustomLabelPositionType={Inner:"inner",Outer:"outer"};t.datavisualization.LinearGauge.OuterCustomLabelPosition={Left:"left",Right:"right",Top:"top",Bottom:"bottom"};t.datavisualization.LinearGauge.Themes={FlatLight:"flatlight",FlatDark:"flatdark"}}(jQuery,Syncfusion),function(n,t,i){t.widget({ejDigitalGauge:"ej.datavisualization.DigitalGauge"},{element:null,model:null,validTags:["div","span"],_rootCSS:"e-digitalgauge",defaults:{segmentData:{"0":[0,1,2,3,4,5,14,15],"1":[1,2],"2":[0,14,1,6,8,4,3,15],"3":[0,1,2,3,6,8,14,15],"4":[1,2,5,6,8],"5":[0,2,3,5,6,8,14,15],"6":[0,2,3,4,5,6,8,14,15],"7":[0,1,2,14],"8":[0,1,2,3,4,5,6,8,14,15],"9":[0,1,2,3,5,6,8,14,15],A:[0,1,2,4,5,6,8,14],B:[0,1,2,3,7,9,8,14,15],C:[0,3,4,5,14,15],D:[0,1,2,3,7,9,14,15],E:[0,3,4,5,6,8,14,15],F:[0,4,5,6,8,14],G:[0,2,3,4,5,8,14,15],H:[1,2,4,5,6,8],I:[0,3,7,9,14,15],J:[1,2,3,4,15],K:[4,5,6,10,11],L:[3,4,5,15],M:[1,2,4,5,10,13],N:[1,2,4,5,11,13],O:[0,1,2,3,4,5,14,15],P:[0,1,4,5,6,8,14],Q:[0,1,2,3,4,5,11,14,15],R:[0,1,4,5,6,8,11,14],S:[0,2,3,5,6,8,14,15],T:[0,7,9,14],U:[1,2,3,4,5,15],V:[4,5,10,12],W:[1,2,4,5,11,12],X:[10,11,12,13],Y:[1,5,6,7,8],Z:[0,3,10,12,14,15]},matrixSegmentData:{"1":[0,3,0,4,1,1,1,2,1,3,1,4,2,3,2,4,3,3,3,4,4,3,4,4,5,3,5,4,6,1,6,2,6,3,6,4,6,5,6,6],"2":[0,1,0,2,0,3,0,4,0,5,1,5,1,6,2,5,2,6,3,4,3,5,4,3,4,2,5,2,5,1,6,1,6,2,6,3,6,4,6,5,6,6],"3":[0,1,0,2,0,3,0,4,0,5,1,5,1,6,2,5,2,6,3,2,3,3,3,4,3,5,3,6,4,5,4,6,5,5,5,6,6,1,6,2,6,3,6,4,6,5],"4":[0,3,0,4,0,5,1,2,1,3,1,4,1,5,2,1,2,2,2,4,2,5,3,0,3,1,3,4,3,5,4,0,4,1,4,2,4,3,4,4,4,5,4,6,5,4,5,5,6,4,6,5],"5":[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,5,4,6,5,5,5,6,6,1,6,2,6,3,6,4,6,5,6,6],"6":[0,3,0,4,0,5,0,6,1,2,1,3,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,2,5,3,5,6,5,7,6,3,6,4,6,5,6,6],"7":[0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,6,1,7,2,5,2,6,3,4,3,5,4,3,4,4,5,2,5,3,6,1,6,2],"8":[0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6],"9":[0,2,0,3,0,4,0,5,1,1,1,2,1,5,1,6,2,1,2,2,2,4,2,5,2,6,3,2,3,3,3,4,3,5,3,6,4,5,4,6,5,5,5,6,6,2,6,3,6,4,6,4,6,5],"0":[0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6],a:[0,2,0,3,0,4,0,5,0,6,1,6,1,7,2,6,2,7,3,2,3,3,3,4,3,5,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6,6,7],b:[0,1,0,2,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],c:[1,3,1,4,1,5,1,6,2,2,2,3,3,1,3,2,4,1,4,2,5,2,5,3,6,3,6,4,6,5,6,6],d:[0,6,0,7,1,6,1,7,2,6,2,7,3,2,3,3,3,4,3,5,3,6,3,7,4,1,4,2,4,5,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6,6,7],e:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,2,6,3,6,4,6,5,6,6,6,7],f:[0,4,0,5,0,6,0,7,1,3,1,4,2,3,2,4,3,1,3,2,3,3,3,4,3,5,3,6,3,7,4,3,4,4,5,3,5,4,6,3,6,4],g:[0,2,0,3,0,4,0,5,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,2,3,3,3,4,3,5,3,6,3,7,4,6,4,7,5,6,5,7,6,2,6,3,6,4,6,5,6,6],h:[0,1,0,2,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],i:[0,3,0,4,2,1,2,2,2,3,2,4,3,3,3,4,4,3,4,4,5,3,5,4,6,3,6,4],j:[1,5,1,6,2,5,2,6,3,5,3,6,4,1,4,2,4,5,4,6,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],k:[0,1,0,2,1,1,1,2,1,4,1,5,2,1,2,2,2,3,2,4,3,1,3,2,3,3,4,1,4,2,4,3,4,4,4,5,5,1,5,2,5,5,5,6,6,1,6,2,6,6,6,7],l:[0,2,0,3,0,4,0,5,0,6,1,5,1,6,2,5,2,6,3,5,3,6,4,5,4,6,5,5,5,6,6,5,6,6],m:[0,1,0,2,0,3,0,4,0,5,0,6,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,2,0,2,1,2,3,2,4,2,6,2,7,3,0,3,1,3,3,3,4,3,6,3,7,4,0,4,1,4,3,4,4,4,6,4,7,5,0,5,1,5,3,5,4,5,6,5,7,6,0,6,1,6,3,6,4,6,6,6,7],n:[1,1,1,2,1,3,1,4,1,5,1,6,2,0,2,1,2,2,2,6,2,7,3,0,3,1,3,6,3,7,4,0,4,1,4,6,4,7,5,0,5,1,5,6,5,7,6,0,6,1,6,6,6,7],o:[1,2,1,3,1,4,1,5,2,1,2,2,2,5,2,6,3,1,3,2,3,5,3,6,4,1,4,2,4,5,4,6,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],p:[1,1,1,2,1,3,1,4,1,5,1,6,2,1,2,2,2,3,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,3,4,4,4,5,4,6,5,1,5,2,6,1,6,2],q:[0,2,0,3,0,4,0,5,0,6,0,7,1,1,1,2,1,5,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,5,3,6,3,7,4,2,4,3,4,4,4,5,4,6,4,7,5,6,5,7,6,6,6,7],r:[0,1,0,3,0,4,0,5,1,1,1,2,1,3,1,4,1,5,1,6,2,1,2,2,2,6,3,1,3,2,4,1,4,2,5,1,5,2,6,1,6,2],s:[1,2,1,3,1,4,1,5,2,1,2,2,3,1,3,2,4,3,4,4,5,4,5,5,6,1,6,2,6,3,6,4],t:[0,3,0,4,1,3,1,4,2,1,2,2,2,3,2,4,2,5,2,6,3,3,3,4,4,3,4,4,5,3,5,4,6,4,6,5,6,6,6,7],u:[1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,5,5,6,5,7,6,2,6,3,6,4,6,5,6,6,6,7],v:[1,1,1,2,1,6,1,7,2,2,2,3,2,5,2,6,3,2,3,3,3,5,3,6,4,3,4,4,4,5,5,4,5,5,6,4],w:[0,0,0,1,0,6,0,7,1,0,1,1,1,6,1,7,2,0,2,1,2,3,2,4,2,6,2,7,3,0,3,1,3,3,3,4,3,6,3,7,4,0,4,1,4,3,4,4,4,6,4,7,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],x:[1,1,1,2,1,6,1,7,2,2,2,3,2,5,2,6,3,3,3,4,3,5,4,3,4,4,4,5,5,2,5,3,5,5,5,6,6,1,6,2,6,6,6,7],y:[1,1,1,2,1,5,1,6,2,1,2,2,2,5,2,6,3,2,3,3,3,4,3,5,4,3,4,4,5,2,5,3,6,1,6,2],z:[1,2,1,3,1,4,1,5,1,6,1,7,2,6,2,7,3,5,3,6,4,4,4,5,5,3,5,4,6,2,6,3,6,4,6,5,6,6,6,7],A:[0,3,0,4,1,2,1,3,1,4,1,5,2,2,2,3,2,4,2,5,3,1,3,2,3,5,3,6,4,1,4,2,4,3,4,4,4,5,4,6,5,1,5,2,5,5,5,6,6,0,6,1,6,6,6,7],B:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,3,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],C:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,0,2,1,3,0,3,1,4,0,4,1,5,1,5,2,6,2,6,3,6,4,6,5,6,6],D:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,3,6,4,6,5,6,6],E:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,1,6,2,6,3,6,4,6,5,6,6],F:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,1,6,2],G:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,0,2,1,3,0,3,1,3,4,3,5,3,6,4,0,4,1,4,6,5,1,5,2,5,6,6,2,6,3,6,4,6,5,6,6],H:[0,1,0,2,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],I:[0,2,0,3,0,4,0,5,0,6,1,4,2,4,3,4,4,4,5,4,6,1,6,2,6,3,6,4,6,5,6,6,6,7],J:[0,2,0,3,0,4,0,5,0,6,1,5,1,6,2,5,2,6,3,5,3,6,4,1,4,2,4,5,4,6,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],K:[0,1,0,2,0,5,0,6,1,1,1,2,1,4,1,5,2,1,2,2,2,3,2,4,3,1,3,2,3,3,4,1,4,2,4,3,4,4,5,1,5,2,5,4,5,5,6,1,6,2,6,5,6,6],L:[0,1,0,2,1,1,1,2,2,1,2,2,3,1,3,2,4,1,4,2,5,1,5,2,6,1,6,2,6,3,6,4,6,5,6,6],M:[0,1,0,2,0,6,0,7,1,1,1,2,1,3,1,5,1,6,1,7,2,1,2,2,2,4,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],N:[0,1,0,2,0,6,0,7,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,4,2,6,2,7,3,1,3,2,3,5,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,1,6,2,6,6,6,7],O:[0,2,0,3,0,4,0,5,1,1,1,2,1,5,1,6,2,0,2,1,2,6,2,7,3,0,3,1,3,6,3,7,4,0,4,1,4,6,4,7,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5],P:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,5,1,5,2,6,1,6,2],Q:[0,2,0,3,0,4,0,5,1,1,1,2,1,5,1,6,2,0,2,1,2,6,2,7,3,0,3,1,3,6,3,7,4,0,4,1,4,4,4,6,4,7,5,1,5,2,5,5,5,6,6,2,6,3,6,4,6,5,6,6,6,7],R:[0,1,0,2,0,3,0,4,0,5,0,6,1,1,1,2,1,3,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,3,3,4,3,5,3,6,4,1,4,2,4,5,5,1,5,5,6,2,6,1,6,2,6,6],S:[0,2,0,3,0,4,0,5,0,6,1,1,1,2,2,1,2,2,3,2,3,3,3,4,3,5,4,5,4,6,5,5,5,6,6,1,6,2,6,3,6,4,6,5,6,6],T:[0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,4,2,4,3,4,4,4,5,4],U:[0,1,0,2,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,6,4,7,5,1,5,2,5,6,5,7,6,2,6,3,6,4,6,5,6,6],V:[0,0,0,1,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,2,3,3,3,5,3,6,4,3,4,4,4,5,4,6,5,4,5,5,6,4],W:[0,1,0,2,0,6,0,7,1,1,1,2,1,6,1,7,2,1,2,2,2,6,2,7,3,1,3,2,3,6,3,7,4,1,4,2,4,4,4,6,4,7,5,1,5,2,5,3,5,5,5,6,5,7,6,1,6,2,6,6,6,7],X:[0,0,0,1,0,6,0,7,1,1,1,2,1,5,1,6,2,1,2,2,2,5,2,6,3,2,3,3,3,4,3,5,4,2,4,3,4,4,4,5,5,1,5,2,5,5,5,6,6,0,6,1,6,6,6,7],Y:[0,0,0,1,0,6,0,7,1,0,1,1,1,6,1,7,2,1,2,2,2,5,2,6,3,2,3,3,3,4,3,5,4,3,4,4,5,3,5,4,6,3,6,4],Z:[0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,6,1,7,2,5,2,6,3,4,3,5,4,2,4,3,5,1,5,2,6,1,6,2,6,3,6,4,6,5,6,6,6,7],",":[5,3,5,4,5,5,6,4,6,5,7,3,7,4],":":[1,3,1,4,1,5,2,3,2,4,2,5,4,3,4,4,4,5,5,3,5,4,5,5],"%":[0,6,0,7,1,1,1,2,1,5,1,6,2,1,2,2,2,4,2,5,3,3,3,4,4,2,4,3,5,1,5,2,5,4,5,5,6,0,6,1,6,4,6,5],"!":[0,3,0,4,0,5,1,3,1,4,1,5,2,3,2,4,2,5,3,3,3,4,3,5,4,3,4,4,4,5,5,3,5,4,5,5,7,4],"(":[0,2,0,3,1,1,1,2,2,1,2,2,3,1,3,2,4,1,4,2,5,1,5,2,6,1,6,2,7,2,7,3],")":[0,5,0,6,1,6,1,7,2,6,2,7,3,6,3,7,4,6,4,7,5,6,5,7,6,6,6,7,7,5,7,6],".":[5,3,5,4,5,5,6,3,6,4,6,5,7,3,7,4,7,5]},frame:{backgroundImageUrl:null,innerWidth:6,outerWidth:10},height:150,width:400,enableResize:!1,isResponsive:!1,themes:"flatlight",items:null,init:null,load:null,renderComplete:null,itemRendering:null,value:"text",themeProperties:{flatlight:{items:{segmentSettings:{color:"#232323"},shadowColor:"#232323",textColor:"#232323"}},flatdark:{items:{segmentSettings:{color:"#b1b0b0"},shadowColor:"#b1b0b0",textColor:"#b1b0b0"}}}},dataTypes:{segmentData:"data",matrixSegmentData:"data",items:"array",isResponsive:"boolean"},_setValues:function(){this.gaugeEl=this.element;this.segmentCount=null;this.contextEl=null;this.style=null;this._value=null;this.region=null;this.canvasEl=null;this.segement16X=null;this.segment16Y=null;this.segmentHeight=null;this.segmentAngle=null;this.startX=5;this.startY=5;this.gradient=null;this.itemIndex=null;this.characterSpace=null;this.outerImage=null;this.radius=null;this.frameOuterLocation=null;this.frameInnerLocation=null;this.glassFrameLocation=null;this.glassFrameStyle=null;this.frameOuterStyle=null;this.character=null;this.frameInnerStyle=null;this._itemInitialize()},observables:["value"],_tags:[{tag:"items",attr:["characterSettings.count","characterSettings.opacity","characterSettings.spacing","characterSettings.type","enableCustomFont","segmentSettings.color","segmentSettings.gradient","segmentSettings.length","segmentSettings.opacity","segmentSettings.spacing","segmentSettings.width","shadowBlur","shadowOffsetX","shadowOffsetY","textAlign","shadowColor","textColor","font.size","font.fontFamily","font.fontStyle","position.x","position.y"]}],value:t.util.valueFunction("value"),_destroy:function(){this.element.empty().removeClass("e-widget")},_setModel:function(t){var i,r;for(i in t)switch(i){case"height":this.model.height=t[i];break;case"width":this.model.width=t[i];break;case"items":this.model.items=t[i];this._itemInitialize();break;case"frame":n.extend(this.model.frame,t[i]);break;case"themes":this.model.themes=t[i];break;case"value":for(r=0;this.model.items[r]!=null;r++)this.model.items[r].value=this.value()}this.refresh()},_init:function(){_digitalGaugeCount=n(".e-digitalgauge").length;initialGaugeCount=_digitalGaugeCount;this._setValues();this._trigger("load");this._setTheme();this._initialize();this._onWindowResize()},_onWindowResize:function(){(this.model.enableResize||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this.resizeCanvas):this._on(n(window),"resize",this.resizeCanvas))},_setTheme:function(){var n=this.model.themeProperties[this.model.themes];this._setThemeColors(n)},_setThemeColors:function(n){var u=[],f=this.model.themeProperties,e,r,i;for(e in f)u.push(e);for(r=0;r<u.length;r++)for(i=0;i<this.model.items.length;i++)this.model.items[i].segmentSettings.color=t.isNullOrUndefined(this.model.items[i].segmentSettings.color)||this.model.items[i].segmentSettings.color==f[u[r]].items.segmentSettings.color?n.items.segmentSettings.color:this.model.items[i].segmentSettings.color,this.model.items[i].shadowColor=!this.model.items[i].shadowColor||this.model.items[i].shadowColor==f[u[r]].items.shadowColor?n.items.shadowColor:this.model.items[i].shadowColor,this.model.items[i].textColor=!this.model.items[i].textColor||this.model.items[i].textColor==f[u[r]].items.textColor?n.items.textColor:this.model.items[i].textColor},_initialize:function(){this.model.init&&this._clientSideOnInit();this._initObject(this);this.model.load&&this._clientSideOnLoad();this.model.frame.backgroundImageUrl!=null?this._drawCustomImage(this,this.model.frame.backgroundImageUrl):this._renderItems();this.model.renderComplete&&this._clientSideOnRenderComplete()},_itemInitialize:function(){var t=this;this.model.items!=null?n.each(this.model.items,function(i,r){var u=t._sendDefaultItem();n.extend(!0,u,r);n.extend(!0,r,u)}):this.model.items=[this._sendDefaultItem()]},_sendDefaultItem:function(){return{characterSettings:{count:4,opacity:1,spacing:2,type:t.datavisualization.DigitalGauge.CharacterType.EightCrossEightDotMatrix},enableCustomFont:!1,segmentSettings:{color:null,gradient:null,length:2,opacity:0,spacing:1,width:1},shadowBlur:0,shadowOffsetX:1,shadowOffsetY:1,textAlign:"left",font:{size:"11px",fontFamily:"Arial",fontStyle:"italic"},position:{x:0,y:0},shadowColor:null,textColor:null,value:null}},_initObject:function(t){var i,r;for(this.element.addClass("e-widget"),t.gaugeEl=this.element,i=0;this.model.items[i]!=null;i++)this.model.items[i].value==null&&(this.model.items[i].value=this.value());(t.canvasEl&&t.canvasEl.parent().empty(),t.canvasEl=n("<canvas><\/canvas>"),t.gaugeEl.append(t.canvasEl),t.canvasEl.attr("role","presentation"),_digitalGaugeCount==initialGaugeCount&&(initialDigitalDivWidth=window.innerWidth),t.canvasEl[0].setAttribute("width",t.model.width),t.canvasEl[0].setAttribute("height",t.model.height),t.centerX=t.canvasEl[0].width/2,t.centerY=t.canvasEl[0].height/2,r=t.canvasEl[0],typeof G_vmlCanvasManager!="undefined"&&(r=window.G_vmlCanvasManager.initElement(r)),r&&r.getContext)&&(t.contextEl=t.canvasEl[0].getContext("2d"))},_drawCustomImage:function(t,i){var r=new Image;n(r).on("load",function(){t.contextEl.drawImage(this,0,0,t.model.width,t.model.height);t.model.Scales!=null&&t._drawScales();t.model.items!=null&&t._renderItems()}).attr("src",i)},_setSegmentCount:function(n){switch(n){case"sevensegment":this._SegmentCount=7;break;case"fourteensegment":this._SegmentCount=14;break;case"sixteensegment":this._SegmentCount=16;break;case"eightcrosseightdotmatrix":this._SegmentCount=[8,8];break;case"eightcrosseightsquarematrix":this._SegmentCount=[8,8];break;default:this._SegmentCount=7}},_setInnerPosition:function(){this.contextEl.save();this.contextEl.translate(this.model.frame.outerWidth+this.model.frame.innerWidth,this.model.frame.outerWidth+this.model.frame.innerWidth);this.bounds={height:this.canvasEl[0].height-2*(this.model.frame.outerWidth+this.model.frame.innerWidth),width:this.canvasEl[0].width-2*(this.model.frame.outerWidth+this.model.frame.innerWidth)}},_setWidth:function(){var t=[];this.model.items!=null&&n.each(this.model.items,function(n,i){t.push(i.characterSettings.count)})},_renderItems:function(){if(this.model.items!=null){this._setInnerPosition();var t=this;n.each(this.model.items,function(n,i){t._setSegmentCount(i.characterSettings.type);t.itemIndex=n;t.canvasEl.attr("aria-label",i.value);t._setShadow(n,i);i.enableCustomFont?t._setCustomFont(n,i):i.characterSettings.type.indexOf("matrix")!=-1?t._drawMatrixSegments(n,i):t._drawSegments(n,i)})}},_setGradientColor:function(t,i,r){r.Name||typeof r=="string"?(i.addColorStop(0,this._getColor(t,r)),i.addColorStop(1,this._getColor(t,r))):n.each(r,function(n,r){i.addColorStop(r.colorStop!=NaN?r.colorStop:0,typeof r.color=="string"?r.color:this._getColor(t,r.color))})},_getColor:function(n,t){return typeof t=="string"?t:"rgba("+t.R+", "+t.G+","+t.B+", "+t.A/255+")"},_drawMatrixSegments:function(t,i){var o=[],u=[],s,h,f,r,e;for(i.value?(this._value=i.value.toString().split(""),i.characterSettings.count=this._value.length>4?this._value.length:4):this._value="",this.radius=i.characterSettings.type.indexOf("dot")!=-1?(i.segmentSettings.length+i.segmentSettings.width)/2:i.segmentSettings.width/2,s=this.startX=(this.bounds.width-i.characterSettings.count*(this._SegmentCount[0]*2*this.radius+i.characterSettings.spacing+this._SegmentCount[0]*i.segmentSettings.spacing))*(i.position.x/100),h=this.startY=(this.bounds.height-(this._SegmentCount[1]*(i.characterSettings.type.indexOf("dot")!=-1?2*this.radius:i.segmentSettings.length)+this._SegmentCount[1]*i.segmentSettings.spacing))*(i.position.y/100),f=0;f<i.characterSettings.count;f++)for(this._value&&(this.character=i.textAlign=="right"?this._value[this._value.length-i.characterSettings.count+f]:this._value[f],u=this.model.matrixSegmentData[this.character]),f!=0&&(s=this.startX=this.startX+i.characterSettings.spacing+i.segmentSettings.spacing+2*this.radius,this.startY=h),r=0;r<this._SegmentCount[1];r++){for(r!=0&&(this.startY=(i.characterSettings.type.indexOf("dot")!=-1?2*this.radius:i.segmentSettings.length)+this.startY+i.segmentSettings.spacing,this.startX=s),u&&n.each(u,function(n){if(n%2==0){if(u[n]>r)return!1;u[n]==r&&o.push(parseInt(u[n+1]))}}),e=0;e<this._SegmentCount[0];e++)e!=0&&(this.startX=this.startX+2*this.radius+i.segmentSettings.spacing),this.gradient=i.characterSettings.type.indexOf("dot")!=-1?this.contextEl.createRadialGradient(0,0,0,0,0,this.radius):this.contextEl.createLinearGradient(0,0,i.segmentSettings.width,0),i.segmentSettings.gradient&&this._setGradientColor(this,this.gradient,i.segmentSettings.gradient.colorInfo),this.region={startX:this.startX,startY:this.startY},this.style={opacity:o&&n.inArray(e,o)!=-1?i.characterSettings.opacity:i.segmentSettings.opacity,height:i.segmentSettings.length,width:i.segmentSettings.width,fillStyle:i.segmentSettings.color=="transparent"?"rgba(0,0,0,0)":this._getColor(this,i.segmentSettings.color),skewX:i.SkewAngleX,skewY:i.SkewAngleX},this.model.itemRendering&&this._clientSideOnItemRendering(!0,e,r),i.characterSettings.type.indexOf("dot")!=-1?this._drawDot(this.region,this.style):this._drawSquare(this.region,this.style);o=[]}},_drawSegments:function(t,i){var f=[],u,r;for(i.value&&(this._value=i.value.toUpperCase().toString().split(""),i.characterSettings.count=this._value.length>4?this._value.length:4),this.characterSpace=i.characterSettings.type=="sevensegment"?2*i.segmentSettings.width:4*i.segmentSettings.width,this._renderSegmentCalculation(i),this.gradient=this.contextEl.createLinearGradient(0,0,0,i.segmentSettings.width),i.segmentSettings.color?this._setGradientColor(this,this.gradient,i.segmentSettings.color):i.segmentSettings.gradient&&this._setGradientColor(this,this.gradient,i.segmentSettings.gradient.colorInfo),u=0;u<i.characterSettings.count;u++){for(i.value&&(f=this.model.segmentData[i.textAlign=="right"?this._value[this._value.length-i.characterSettings.count+u]:this._value[u]]),r=0;r<this._SegmentCount;r++)u!=0&&(this.segment16X[r]=this.segment16X[r]+i.segmentSettings.length+this.characterSpace+i.characterSettings.spacing),this._value&&(this.character=i.textAlign=="right"?this._value[this._value.length-i.characterSettings.count+u]:this._value[u]),this.region={startX:this.segment16X[r],startY:this.segment16Y[r]},this.style={angle:this.angle[r],fillStyle:this.gradient,isStroke:!1,isFill:!0,characterHeight:i.characterSettings.type=="sevensegment"?i.segmentSettings.length:this.segmentHeight[r],segmentWidth:i.segmentSettings.width,opacity:f&&n.inArray(r,f)!=-1?i.characterSettings.opacity:i.segmentSettings.opacity},this.model.itemRendering&&this._clientSideOnItemRendering(!1,r),this._drawSegmentLayers(this.region,this.style);this._notifyArrayChange&&this._notifyArrayChange("items["+t+"]value",i.value);this.value(i.value);f=[]}},_setCustomFont:function(n,t){this.startX=(this.bounds.width-this._measureText(t.value,0,this._getFontString(this,t.font)).width)*(t.position.x/100);this.startY=(this.bounds.height-this._measureText(t.value,0,this._getFontString(this,t.font)).height)*(t.position.y/100);this.region={startX:this.startX,startY:this.startY};this.style={font:this._getFontString(this,t.font),text:t.value,textColor:t.textColor?t.textColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,t.textColor):t.segmentSettings.color=="transparent"?"rgba(0,0,0,0)":this._getColor(this,t.segmentSettings.color)};this.model.itemRendering&&this._clientSideOnItemRendering(!1,segment);this._drawText(this.region,this.style)},_getFontString:function(n,t){return(t.size==null?"11px":t.size)+" "+t.fontFamily+" "+(t.fontStyle?t.fontStyle:"")},_renderSegmentCalculation:function(n){var t=n.segmentSettings.length,i=n.segmentSettings.width,r;this.startX=(this.bounds.width-n.characterSettings.count*(t+this.characterSpace+n.characterSettings.spacing))*(n.position.x/100);this.startY=(this.bounds.height-2*t-i)*(n.position.y/100);r=n.characterSettings.type=="sevensegment"?t:t/2;this.segment16X=[this.startX+i/2,this.startX+t+4*i,this.startX+t+4*i,this.startX+i/2,this.startX,this.startX,this.startX+i/2,this.startX+r+2*i,this.startX+2.5*i+r,this.startX+r+2*i,this.startX+t+2.5*i,this.startX+r+2.5*i,this.startX+r+1.5*i,this.startX+1.5*i,this.startX+5*i/2+r,this.startX+2.5*i+r];this.segment16Y=[this.startY,this.startY,this.startY+t+i,this.startY+2*t+2*i,this.startY+t+i,this.startY,this.startY+t+i,this.startY+t+i,this.startY+t+i,this.startY,this.startY+i,this.startY+t+i,this.startY+t+i,this.startY+i,this.startY,this.startY+2*t+2*i];this.segmentHeight=[t/2,t,t,t/2,t,t,t/2,t,t/2,t,t,t,t,t,t/2,t/2];this.angle=[-90,0,0,-90,0,0,-90,0,-90,0,27,-27,27,-27,-90,-90];n.characterSettings.type=="sevensegment"&&(this.segment16X[2]=this.segment16X[1]=this.startX+t+2*i);n.characterSettings.type=="fourteensegment"&&(this.segmentHeight[3]=this.segmentHeight[0]=t+2*i)},_drawSegmentLayers:function(n,t){this._contextOpenPath(t,this);this.contextEl.translate(n.startX,n.startY);this.contextEl.rotate(Math.PI*(t.angle/180));this.contextEl.lineTo(0,0);this.contextEl.lineTo(-t.segmentWidth,t.segmentWidth);this.contextEl.lineTo(-t.segmentWidth,t.characterHeight);this.contextEl.lineTo(0,t.characterHeight+t.segmentWidth);this.contextEl.lineTo(t.segmentWidth,t.characterHeight);this.contextEl.lineTo(t.segmentWidth,t.segmentWidth);this._contextClosePath(t,this)},_drawDot:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.translate(n.startX,n.startY);this.contextEl.fillStyle=t.fillStyle;this.contextEl.globalAlpha=t.opacity;this.contextEl.arc(0,0,this.radius,0,2*Math.PI,!0);this.contextEl.fill();this.contextEl.closePath();this.contextEl.restore()},_setShadow:function(n,t){this.contextEl.save();this.contextEl.shadowColor=t.shadowColor=="transparent"?"rgba(0,0,0,0)":this._getColor(this,t.shadowColor);this.contextEl.shadowOffsetY=t.shadowOffsetY;this.contextEl.shadowOffsetX=t.shadowOffsetX;this.contextEl.shadowBlur=t.shadowBlur},_drawSquare:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.translate(n.startX,n.startY);this.contextEl.fillStyle=t.fillStyle;this.contextEl.globalAlpha=t.opacity;this.contextEl.rect(0,0,t.width,t.height);this.contextEl.fill();this.contextEl.closePath();this.contextEl.restore()},_drawText:function(n,t){this.contextEl.beginPath();this.contextEl.save();this.contextEl.font=t.font;this.contextEl.textBaseline="hanging";this.contextEl.fillStyle=t.textColor=="transparent"?"rgba(0,0,0,0)":t.textColor;this.contextEl.fillText(t.text,n.startX,n.startY);this.contextEl.closePath();this.contextEl.restore()},setValue:function(n,t){n<this.model.items.length&&t!=null&&(this.model.items[n].value=t,this._initialize())},getValue:function(n){return this.model.items[n].value},setPosition:function(n,t){n<this.model.items.length&&t!=null&&(this.model.items[n].position.x=t.x,this.model.items[n].position.y=t.y,this._initialize())},getPosition:function(n){return n<this.model.items.length?{x:this.model.items[n].position.x,y:this.model.items[n].position.y}:null},refresh:function(){this._setTheme();this._initialize()},exportImage:function(n,i){var f,u,o,r,c,s;if(t.browserInfo().name==="msie"&&parseFloat(t.browserInfo().version)<10)return!1;f=this.canvasEl[0].toDataURL();f=f.replace(/^data:[a-z]*;,/,"");var l=f.split(","),e=atob(l[1]),h=new ArrayBuffer(e.length),a=new Uint8Array(h);for(u=0;u<e.length;u++)a[u]=e.charCodeAt(u);return o=new Blob([h],{type:"image/png"}),t.browserInfo().name==="msie"?window.navigator.msSaveOrOpenBlob(o,n+"."+i):(r=document.createElement("a"),c=URL.createObjectURL(o),r.href=c,r.setAttribute("download",n+"."+i),document.createEvent?(s=document.createEvent("MouseEvents"),s.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(s)):r.fireEvent&&r.fireEvent("onclick")),!0},resizeCanvas:function(){var u,f,r,i;if(_digitalGaugeCount=_digitalGaugeCount!=0?_digitalGaugeCount-1:n(".e-digitalgauge").length-1,f=!0,t.isNullOrUndefined(this.canvasEl.parent().attr("style"))||(u=this.GaugeEl.parent().attr("style").split(";")),t.isNullOrUndefined(u)||n.each(u,function(n,t){while(t.indexOf("width")!=-1){f=t.indexOf("px")==-1?!0:!1;break}}),f){for(r=window.innerWidth/initialDigitalDivWidth,this.model.width*=r,i=0;this.model.items[i]!=null;i++)this.model.items[i].segmentSettings.width*=r,this.model.items[i].segmentSettings.length*=r,this.model.items[i].segmentSettings.spacing*=r,this.model.items[i].characterSettings.spacing*=r;this.refresh();_digitalGaugeCount==0&&(initialDigitalDivWidth=window.innerWidth)}},_clientSideOnLoad:function(){var n={object:this,items:this.model.items,context:this.contextEl};this._trigger("load",n)},_clientSideOnItemRendering:function(n,t,i){var r;r=n?{object:this,items:this.model.items,character:this.character,context:this.contextEl,position:this.region,style:this.style,row:t,column:i}:{object:this,model:this.model,id:this.model.ClientId,items:this.model.items,character:this.character,context:this.contextEl,position:this.region,style:this.style,segment:t};this._trigger("itemRendering",r)},_clientSideOnInit:function(){var n={object:this,items:this.model.items,context:this.contextEl};this._trigger("init",n)},_clientSideOnRenderComplete:function(){var n={object:this,items:this.model.items,context:this.contextEl};this._trigger("renderComplete",n)},_contextOpenPath:function(n,t){t.contextEl.save();t.contextEl.beginPath();n.strokeStyle&&(t.contextEl.strokeStyle=n.strokeStyle);n.opacity!=i&&(t.contextEl.globalAlpha=n.opacity);n.lineWidth&&(t.contextEl.lineWidth=n.lineWidth);n.fillStyle&&(t.contextEl.fillStyle=n.fillStyle)},_contextClosePath:function(n,t){t.contextEl.closePath();n.isFill&&t.contextEl.fill();n.isStroke&&t.contextEl.stroke();t.contextEl.restore()},_measureText:function(t,i,r){var u=document.createElement("DIV"),f;return u.innerHTML=t,r!=null&&(u.style.font=r),u.style.backgroundColor="white",u.style.position="absolute",u.style.top=-100,u.style.left=0,i&&(u.style.maxwidth=i+"px"),document.body.appendChild(u),f={width:u.offsetWidth,height:u.offsetHeight},n(u).remove(),f}});t.datavisualization.DigitalGauge.CharacterType={SevenSegment:"sevensegment",FourteenSegment:"fourteensegment",SixteenSegment:"sixteensegment",EightCrossEightDotMatrix:"eightcrosseightdotmatrix",EightCrossEightSquareMatrix:"eightcrosseightsquarematrix"};t.datavisualization.DigitalGauge.TextAlign={Left:"left",Right:"right"};t.datavisualization.DigitalGauge.FontStyle={Normal:"normal",Bold:"bold",Italic:"italic",Underline:"underline",Strikeout:"strikeout"};t.datavisualization.DigitalGauge.Themes={FlatLight:"flatlight",FlatDark:"flatdark"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejBulletGraph","ej.datavisualization.BulletGraph",{element:null,model:null,validTags:["div"],_tags:[{tag:"qualitativeRanges",attr:["rangeEnd","rangeStroke","rangeOpacity"]},{tag:"quantitativeScaleSettings.featureMeasures",attr:["value","comparativeMeasureValue"]}],defaults:{locale:null,enableGroupSeparator:!1,value:0,comparativeMeasureValue:0,width:null,height:null,theme:"flatlight",orientation:"horizontal",flowDirection:"forward",qualitativeRangeSize:32,quantitativeScaleLength:475,tooltipSettings:{enableCaptionTooltip:!1,captionTemplate:null,visible:!0,template:null},quantitativeScaleSettings:{location:{x:10,y:10},minimum:0,maximum:10,interval:1,minorTicksPerInterval:4,majorTickSettings:{size:13,stroke:null,width:2},minorTickSettings:{size:7,stroke:null,width:2},tickPosition:"far",tickPlacement:"outside",labelSettings:{labelPlacement:"outside",labelPrefix:"",labelSuffix:"",stroke:null,size:12,offset:15,font:{fontFamily:"Segoe UI",fontStyle:"Normal ",fontWeight:"regular",opacity:1},position:"below"},featuredMeasureSettings:{stroke:null,width:6},comparativeMeasureSettings:{stroke:null,width:5},featureMeasures:[{value:null,comparativeMeasureValue:null,category:null}]},fields:{dataSource:null,query:null,tableName:null,category:null,featureMeasures:null,comparativeMeasure:null},enableAnimation:!0,enableResizing:!0,isResponsive:!0,applyRangeStrokeToTicks:!1,applyRangeStrokeToLabels:!1,qualitativeRanges:[{rangeEnd:4.3,rangeStroke:null,rangeOpacity:1},{rangeEnd:7.3,rangeStroke:null,rangeOpacity:1},{rangeEnd:10,rangeStroke:null,rangeOpacity:1}],captionSettings:{enableTrim:!0,textPosition:"float",textAlignment:"Near",textAnchor:"start",padding:5,textAngle:0,location:{x:17,y:30},text:"",font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",fontWeight:"regular",opacity:1},subTitle:{textPosition:"float",textAlignment:"Near",textAnchor:"start",padding:5,textAngle:0,text:"",location:{x:10,y:45},font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal ",size:"12px",fontWeight:"regular",opacity:1}},indicator:{textPosition:"float",textAlignment:"Near",textAnchor:"start",padding:5,visible:!1,textAngle:0,textSpacing:3,text:"",symbol:{border:{color:null,width:1},color:null,shape:"",imageURL:"",size:{width:10,height:10},opacity:1},location:{x:10,y:60},font:{color:null,fontFamily:"Segoe UI",fontStyle:"Normal ",size:"12px",fontWeight:"regular",opacity:1}}},load:"",drawTicks:null,drawLabels:null,drawCaption:null,drawIndicator:null,drawQualitativeRanges:null,drawFeatureMeasureBar:null,drawCategory:null,drawComparativeMeasureSymbol:null},observables:["value","comparativeMeasureValue"],value:t.util.valueFunction("value"),comparativeMeasureValue:t.util.valueFunction("comparativeMeasureValue"),dataTypes:{quantitativeScaleSettings:{labelSettings:"data",featureMeasures:"array"},fields:{dataSource:"data",query:"data"},qualitativeRanges:"array",captionSettings:"data",isResponsive:"boolean"},_init:function(){this._renderBulletGraph()},_isSVG:function(){return window.SVGSVGElement?!0:!1},_value:t.util.valueFunction("value"),_comparativeMeasureValue:t.util.valueFunction("comparativeMeasureValue"),_qualitativeRanges:function(){this.redraw();this._trigger("refresh")},_quantitativeScaleSettings_featureMeasures:function(){this.redraw();this._trigger("refresh")},_renderBulletGraph:function(){this._isSVG()&&(this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this._trigger("load"),this._setSvgSize(this),this._setTheme(t.datavisualization.BulletGraph.Themes,this.model.theme),this.bindEvents(),this._renderBulletElements(),this.model.enableAnimation&&this._animateMeasures())},_animateMeasures:function(){this._doAnimation();this._doLineAnimation()},_setSvgSize:function(i){var r=i,o=n(r.element).height(),f=90,u=t.isTouchDevice()?250:595,e=n(r.element).width();r.model.width?u=parseInt(r.model.width):e>0&&e<595?u=e:e>595&&(u=595);n(r.svgObject).width(u);r.model.height?f=parseInt(r.model.height):o>0?f=o:n(r.svgObject).css("display","block");n(r.svgObject).height(f);r.svgObject.width=u;r.svgObject.height=f},_renderBulletElements:function(){var f=this.model.width?this.model.width:595,e=this.model.height?this.model.height:90,i;this.svgObject.setAttribute("viewBox","0 0 "+f+" "+e);this.svgObject.setAttribute("preserveAspectRatio","xMinYMin");this.svgWidth=n(this.svgObject).width();this.svgHeight=n(this.svgObject).height();var r=this.svgRenderer.createGroup({id:this.svgObject.id+"_captionGroup"}),t=this.svgRenderer.createGroup({id:this.svgObject.id+"_scaleGroup"}),u=this.svgRenderer.createGroup({id:this.svgObject.id+"_outerWrap"});this._initializeValues();i=this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/this._scale.interval);this._drawCaption();this._drawIndicator();this._drawCaptionGroup(r);this._scaleGroup=t;this._drawScale(r,t);this._drawQualitativeRanges(t);this._drawMajorTicks(i,t);this._drawMinorTicks(i,t);this._drawLabels(i,t);this._bindData();n(t).appendTo(u);n(r).appendTo(u);this._changeOrientation(t);n(u).appendTo(this.svgObject);n(this.svgObject).appendTo(this.element);this._bindHighlightRemoving()},_bindHighlightRemoving:function(){var t=this.model.browserInfo.isMSPointerEnabled,i=this.model.browserInfo.pointerEnabled;touchStartOut=t?i?"pointerout":"MSPointerOut":"touchout mouseout";this._on(n("[id*="+this.svgObject.id+"_FeatureMeasure_]"),touchStartOut,function(t){this.isTouch(t)||n(t.target).attr("opacity",1)})},_drawCaptionGroup:function(n){var u=this.model.captionSettings,f=u.subTitle,r=this._indicator?this._indicator.settings:u.indicator,c,b,k,l,a,v;u._location=f._location=r._location=c;var y=u.textPosition.toLowerCase()!="float"&&u.text!="",p=f.textPosition.toLowerCase()!="float"&&f.text!="",w=r.visible&&r.textPosition.toLowerCase()!="float";if(y||p||w){b=t.EjSvgRender.utils._measureText(u.text,null,u.font);k=t.EjSvgRender.utils._measureText(f.text,null,f.font);r.visible&&(l=this._indicator.bounds,v={width:r.symbol.size.width+l.width+r.textSpacing,height:Math.max(r.symbol.size.height,l.height)},a={x:0,y:0,width:v.width,height:v.height,padding:r.padding,anchor:r.textAnchor.toLowerCase(),alignment:r.textAlignment.toLowerCase()});var d={x:0,y:0,width:b.width,height:parseFloat(u.font.size),padding:u.padding,anchor:u.textAnchor.toLowerCase(),alignment:u.textAlignment.toLowerCase()},g={x:0,y:0,width:k.width,height:parseFloat(f.font.size),padding:f.padding,anchor:f.textAnchor.toLowerCase(),alignment:f.textAlignment.toLowerCase()},tt={x:this._scale.location.x,y:this._scale.location.y,width:this.model.quantitativeScaleLength,height:this.model.qualitativeRangeSize},nt=[y?u:null,p?f:null,w?r:null];this._positionTextGroup(nt,[d,g,a],tt);this._locateTextGroup(nt,[d,g,a])}var e=u._location==i?u.location:u._location,o=f._location==i?f.location:f._location,s=r._location==i?r.location:r._location;if(u.displayText=u.text,u.enableTrim==!0&&(e.x=e.x<0?0:e.x,e.y=e.y<0?0:e.y,u.displayText=this._displayText(u,e)),f.text!=""&&(f.displayText=f.text,u.enableTrim==!0&&(o.x=o.x<0?0:o.x,o.y=o.y<0?0:o.y,f.displayText=this._displayText(f,o))),r.visible){r.displayText=r.text;this.model.captionSettings.enableTrim==!0&&(s.x=s.x<0?0:s.x,s.y=s.y<0?0:s.y);var c=r._location?r._location:r.location,h={x:c.x+r.symbol.size.width/2,y:c.y-r.symbol.size.height/2,width:r.symbol.size.width,height:r.symbol.size.height},it=this._indicatorTextOptions(r,h,this._indicator.bounds,this.svgObject.id+"_Indicator"),rt=this._indicatorSymbolOptions(n,r);this._drawBulletSymbol(this._indicator.settings.symbol.shape,h,rt,n);this.model.captionSettings.enableTrim==!0&&(r.displayText=this._displayText(r,h))}u.displayText=u.textPosition.toLowerCase()!="float"?this._captionOverlap(this.model.captionSettings):u.displayText;this.svgRenderer.drawText(this._textOptions(u,this.svgObject.id+"_Caption"),u.displayText,n);f.text!=""&&(f.displayText=f.textPosition.toLowerCase()!="float"?this._subOverlap(this.model.captionSettings.subTitle):f.displayText,this.svgRenderer.drawText(this._textOptions(f,this.svgObject.id+"_SubTitle"),f.displayText,n));r.visible&&(r.displayText=r.textPosition.toLowerCase()!="float"?this._indOverlap(r,h):r.displayText,this.svgRenderer.drawText(it,r.displayText,n))},_captionOverlap:function(n){var t;return n.textPosition==n.subTitle.textPosition&&n.textAlignment==n.subTitle.textAlignment&&n.textAngle>0&&n.textAngle<120?t=n.subTitle._location.y-n._location.y:n.textPosition==n.indicator.textPosition&&n.textAlignment==n.indicator.textAlignment&&n.textAngle>0&&n.textAngle<120?t=n.indicator._location.y-n._location.y:n.textPosition==n.subTitle.textPosition&&n._location.y<n.subTitle._location.y&&n.textAngle>0&&n.textAngle<180?t=n.subTitle._location.y-n._location.y:n.textPosition==n.subTitle.textPosition&&n._location.y>n.subTitle._location.y&&n.textAngle>190&&n.textAngle<360?t=n._location.y-n.subTitle._location.y:n.textPosition==n.indicator.textPosition&&n._location.y<n.indicator._location.y&&n.textAngle>0&&n.textAngle<180?t=n.indicator._location.y-n._location.y:n.textPosition==n.indicator.textPosition&&n._location.y>n.indicator._location.y&&n.textAngle>190&&n.textAngle<360&&(t=n._location.y-n.indicator._location.y),this._trim(n.displayText,n,t,isRotate=!0)},_indOverlap:function(n,t){var u,i=this.model.captionSettings.subTitle,r=this.model.captionSettings;return n.textPosition==i.textPosition&&n.textAlignment==i.textAlignment&&n.textAngle>190&&n.textAngle<360?u=t.y-i._location.y:n.textPosition==r.textPosition&&n.textAlignment==r.textAlignment&&n.textAngle>190&&n.textAngle<360?u=t.y-r._location.y:n.textPosition==i.textPosition&&n._location.y<i._location.y&&n.textAngle>0&&n.textAngle<180?u=i._location.y-n._location.y:n.textPosition==i.textPosition&&n._location.y>i._location.y&&n.textAngle>190&&n.textAngle<360?u=n._location.y-i._location.y:n.textPosition==r.textPosition&&n._location.y<r._location.y&&n.textAngle>0&&n.textAngle<180?u=r._location.y-n._location.y:n.textPosition==r.textPosition&&n._location.y>r._location.y&&n.textAngle>190&&n.textAngle<360&&(u=n._location.y-r._location.y),this._trim(n.displayText,n,u,isRotate=!0)},_subOverlap:function(n){var r,t=this.model.captionSettings.indicator,i=this.model.captionSettings;return n.textPosition==t.textPosition&&n.textAlignment==t.textAlignment&&n.textAngle>0&&n.textAngle<180?r=t._location.y-n._location.y:n.textPosition==i.textPosition&&n.textAlignment==i.textAlignment&&n.textAngle>190&&n.textAngle<360?r=n._location.y-i._location.y:n.textPosition==t.textPosition&&n._location.y<t._location.y&&n.textAngle>0&&n.textAngle<180?r=t._location.y-n._location.y:n.textPosition==t.textPosition&&n._location.y>t._location.y&&n.textAngle>190&&n.textAngle<360?r=n._location.y-t._location.y:n.textPosition==i.textPosition&&n._location.y<i._location.y&&n.textAngle>0&&n.textAngle<180?r=i._location.y-n._location.y:n.textPosition==i.textPosition&&n._location.y>i._location.y&&n.textAngle>190&&n.textAngle<360&&(r=n._location.y-i._location.y),this._trim(n.displayText,n,r,isRotate=!0)},rotatedLabel:function(n,i,r,u){var f={"font-size":n.size,transform:"rotate("+r+",0,0)","font-family":n.fontFamily,"font-style":n.fontStyle,rotateAngle:"rotate("+r+"deg)","text-anchor":"middle"},e=i.svgRenderer.createText(f,u);return Math.ceil(t.EjSvgRender.utils._measureBounds(e,i).width)},calcGap:function(n,t,i,r,u,f,e){var o;return n>=0&&n<=90?r+t.y>=e&&n>0?(o=e-t.y,u=!0):r+t.y<=e&&i+t.x>=f&&n>0?o=f-t.x:r+t.y<=e&&n>0?(o=e-t.y,u=!0):o=f-t.x:n>90&&n<180?r+t.y>=e?(o=e-t.y,u=!0):r+t.y<=e&&i+t.x>=f?o=t.x:i+t.x<=f?o=t.x:(o=e-t.y,u=!0):n>=180&&n<270?t.x-i>=0?(o=t.y,u=!0):t.y-r<=0&&t.x-i<=0?o=t.x:t.y-r<=0?(o=e-t.y,u=!0):o=t.x:i+t.x<=f?(o=t.y,u=!0):t.y-r>=0&&i+t.x>=f?o=f-t.x:i+t.x>=f?o=f-t.x:(o=t.y,u=!0),{trimSize:o,rotate:u}},_scaleLoc:function(){var o=this._scale,u=o.labelSettings.offset,i=o.majorTickSettings.size,n,e,s=this._scale.labelSettings,h=t.EjSvgRender.utils._measureText(s.labelPrefix+o.maximum+s.labelSuffix,null,s),f=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?h.height:h.width,r,c;n=o.location.y;r=this.model.qualitativeRangeSize;c=this._tickPosition+this._tickPlacement+this._labelPosition+this._labelPlacement;this._tickPosition=="center"&&(i=i>r&&(i-r)/2);switch(c){case"faroutsidebelowoutside":e=n+f+r+u+(i>u&&i-u);break;case"faroutsidebelowinside":e=n+i+r;n=n-(u+f>r&&u+f-r);break;case"faroutsideaboveoutside":e=n+i+r;n=n-(u+f);break;case"faroutsideaboveinside":e=n+i+r+(u+f>r+i?u+f-(r+i):0);break;case"farinsidebelowoutside":e=n+f+r+u;n=n-(i>r&&i-r);break;case"farinsidebelowinside":e=n+r;n=n-(i>r&&i-r)-(u+f>r+i&&u+f-i);break;case"farinsideaboveoutside":e=n+r;n=n-(u+f)-(i>u+f+r&&i-(u+f+r));break;case"farinsideaboveinside":e=n+r+(u+f>r&&f+u-r);n=n-(i>r&&i-r);break;case"nearoutsidebelowoutside":e=n+r+u+f;n=n-i;break;case"nearoutsidebelowinside":e=n+r;n=n-i-(u+f>r+i&&u+f-(r+i));break;case"nearoutsideaboveoutside":e=n+r;n=n-i-(i<u+f&&u+f-i);break;case"nearoutsideaboveinside":e=n+r+(u+f>r&&u+f-r);n=n-i;break;case"nearinsidebelowoutside":e=n+r+(i>u+f+r?i-r:u+f);break;case"nearinsidebelowinside":e=n+r+(i>r&&i-r);n=n-(u+f>r&&u+f-r);break;case"nearinsideaboveoutside":e=n+(i>r?i:r);n=n-u-f;break;case"nearinsideaboveinside":e=n+r+(i>f+u?i-r:f+u-r);break;case"centeroutsidebelowoutside":e=n+r+(i>u+f?i:u+f);n=n-i;break;case"centeroutsidebelowinside":e=n+r+i;n=n-i-(u+f>r+i&&u+f-(r+i));break;case"centeroutsideaboveoutside":e=n+r+i;n=n-i-(i<u+f&&u+f-i);break;case"centeroutsideaboveinside":e=n+r+(u+f>r+i?u+f-r-i:i);n=n-i;break;case"centerinsidebelowoutside":e=n+r+(i>u+f?i:u+f);n=n-i;break;case"centerinsidebelowinside":e=n+r+i;n=n-(u+f-r>i?u+f-r:i);break;case"centerinsideaboveoutside":e=n+r+i;n=n-i-(i<u+f&&u+f-i);break;case"centerinsideaboveinside":e=n+r+(i>f+u?i:f+u-r);n=n-i}return{x:o.location.x,y:n,height:e}},_displayText:function(i,r){var f=n.extend(!0,r),e=i.textAngle%360,y=i.text,w=i.font,a=this._scale,p=this._scale.labelSettings,b=t.EjSvgRender.utils._measureText(p.labelPrefix+a.minimum+p.labelSuffix,null,p).width,k=t.EjSvgRender.utils._measureText(y,null,w).width,d=t.EjSvgRender.utils.rotatedLabel(i,this,e,i.text),v=this.rotatedLabel(w,this,e,i.text),o,s=this.svgHeight,h=this.svgWidth,l=!1,u=this._scaleLoc(),c,g;return i.textSpacing&&(k=k+i.textSpacing,v=v+i.textSpacing),this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?(f.x<=u.x&&u.y<=f.y&&f.y<=u.height?h=a.location.x-b/2:f.x<=u.x&&f.y<=u.y&&e<90?s=u.y:f.x>=u.x&&f.x<=u.x+this.model.quantitativeScaleLength&&f.y<=u.y?s=u.y:f.y<=u.y&&f.x>=u.x+this.model.quantitativeScaleLength&&e>=90?s=u.y:f.x>=u.x+this.model.quantitativeScaleLength&&u.y<=f.y&&f.y<=u.height&&e<270?(h=h-(u.x+this.model.quantitativeScaleLength),f.x=f.x-(u.x+this.model.quantitativeScaleLength)):f.x<=u.x&&f.y>=u.height&&e>270?f.y=f.y-u.height:f.x>=u.x&&f.x<=u.x+this.model.quantitativeScaleLength&&f.y>=u.height?f.y=f.y-u.height:f.x>=u.x+this.model.quantitativeScaleLength&&f.y>=u.height&&e>=180&&e<270&&(f.y=f.y-u.height),o=this.calcGap(e,f,v,d,l,h,s),l=o.rotate,o=o.trimSize):(c=u.height-u.y,u.y=this.svgHeight-a.location.y-this.model.quantitativeScaleLength,u.height=u.y+this.model.quantitativeScaleLength,f.x<=u.x&&u.y<=f.y&&f.y<=u.height?h=a.location.x-b/2:f.x<=u.x&&f.y<=u.y&&e<90?s=u.y:f.x>=u.x&&f.x<=u.x+c&&f.y<=u.y?s=u.y:f.y<=u.y&&f.x>=u.x+c&&e>=90?s=u.y:f.x>=u.x+c&&u.y<=f.y&&f.y<=u.height&&e<=260?(h=h-(u.x+c),f.x=f.x-(u.x+c)):f.x<=u.x&&f.y>=u.height&&e>=280?f.y=f.y-u.height:f.x>=u.x&&f.x<=u.x+c&&f.y>=u.height?f.y=f.y-u.height:f.x>=u.x+c&&f.y>=u.height&&e>=180&&e<=260&&(f.y=f.y-u.height),o=this.calcGap(e,f,v,d,l,h,s),l=o.rotate,o=o.trimSize),g=y,this._trim(y,i,o,l)},_trim:function(n,i,r,u){var f=n,h=this.rotatedLabel(i.font,this,i.textAngle,n),s=t.EjSvgRender.utils._measureText(n,null,i.font).width,o,e,c;if(i.textSpacing&&(s=s+i.textSpacing,h=h+i.textSpacing),s>r&&n!=""){for(e=1;e<=n.toString().length;e++)if(n=f.toString().substring(0,e)+"... ",o=u==!0?t.EjSvgRender.utils.rotatedLabel(i,this,i.textAngle,n):t.EjSvgRender.utils._measureText(n,null,i.font).width,i.textSpacing&&(o=o+i.textSpacing),o>=r){n=n.toString().substring(0,e-1)+"... ";f=n;break}c=f.toString(0,n.toString.lenght-4);c!=f&&(f=n)}return f},_getVerticalScaleLocation:function(n){return{x:this._scale.location.y,y:this.svgHeight-this._scale.location.x-n}},_horizontalTextPositioning:function(n,i,r,u,f){var h=n.textPosition.toLowerCase(),e=i.alignment,r=this._scaleLoc(),o=this._scale.labelSettings,s=t.EjSvgRender.utils._measureText(o.labelPrefix+this._scale.maximum+o.labelSuffix,null,o).width;switch(h){case"left":i.x=r.x-i.width-i.padding-s/2;i.y=r.y+(e=="center"?u.height/2+i.height/3:e=="far"?u.height:i.height);f[0].push(i);break;case"right":i.x=r.x+u.width+i.padding+s/2;i.y=r.y+(e=="center"?u.height/2+i.height/3:e=="far"?u.height:i.height);f[1].push(i);break;case"top":i.x=e=="center"?u.x+u.width/2-i.width/2:e=="near"?u.x:u.x+u.width-i.width;i.y=r.y-i.padding;f[2].push(i);break;case"bottom":i.x=e=="center"?u.x+u.width/2-i.width/2:e=="near"?u.x:u.x+u.width-i.width;i.y=r.height+i.height/2+i.padding;f[3].push(i)}},_VerticalTextPositioning:function(n,t,i,r,u){var o=n.textPosition.toLowerCase(),f=t.alignment,e=this._scaleLoc();switch(o){case"left":t.x=e.y-t.width-t.padding;t.y=i.y+(f=="center"?r.height/2+t.height/3:f=="far"?r.height:t.height);this._tickPosition=="near"&&this._tickPlacement=="inside"&&this._labelPosition=="above"&&this._labelPlacement=="inside"&&(t.x+=this._scale.majorTickSettings.size);u[0].push(t);break;case"right":t.x=e.height+t.padding;t.y=i.y+(f=="center"?r.height/2+t.height/3:f=="far"?r.height:t.height);u[1].push(t);break;case"top":t.x=r.x-t.width/2+(f=="center"?r.width/2:f=="far"&&r.width);t.y=r.y-t.padding;u[2].push(t);break;case"bottom":t.x=r.x-t.width/2+(f=="center"?r.width/2:f=="far"&&r.width);t.y=r.y+r.height+t.height+t.padding-t.height/3+this._scale.labelSettings.size/2;u[3].push(t)}},_positionTextGroup:function(n,t,i){for(var f=[[],[],[],[]],e=this._orientation=="horizontal",u=e?this._scaleLocation:this._getVerticalScaleLocation(i.width),o=e?i:{x:u.x,y:u.y,width:i.height,height:i.width},r=0;r<n.length;r++)n[r]&&(e?this._horizontalTextPositioning(n[r],t[r],u,o,f):this._VerticalTextPositioning(n[r],t[r],u,o,f));this._avoidElementsOverlapping(f)},_avoidElementsOverlapping:function(n){for(var t,f,r,i,u=0;u<n.length;u++){t=n[u];f=!1;do for(r=0;r<t.length;r++)for(i=r-1;i>=0;i--)if(this._isOverlapping(t[r],t[i])){switch(u){case 0:case 1:t[i].y>t[r].y?t[i].y=t[r].y+t[i].height+(t[i].padding>1?t[i].padding:1):t[r].y=t[i].y+t[r].height+(t[r].padding>1?t[r].padding:1);break;case 2:t[i].y=t[r].y-t[r].height-(t[i].padding>1?t[i].padding:1);break;default:t[r].y=t[i].y+t[i].height+(t[i].padding>1?t[i].padding:1)}f=!0;break}else f=!1;while(f)}this._applyLeftRightAnchor([n[0],n[1]]);this._applyTopBottomAnchor([n[2],n[3]])},_locateTextGroup:function(n,t){for(var i=0;i<n.length;i++)n[i]&&(n[i]._location={x:0,y:0},n[i]._location.x=t[i].x,n[i]._location.y=t[i].y)},_applyLeftRightAnchor:function(n){for(var i,r,t,f,u=0;u<n.length;u++){for(i=n[u],r=0,t=0;t<i.length;t++)r=Math.max(r,i[t].width);for(t=0;t<i.length;t++)f=i[t].anchor,i[t].x+=f=="start"?u==0&&i[t].width-r:f=="middle"?u==0?(i[t].width-r)/2:(r-i[t].width)/2:u!=0&&r-i[t].width}},_applyTopBottomAnchor:function(n){for(var t,r=0;r<n.length;r++){var u=[],f=[],e=[],i=n[r];for(t=0;t<i.length;t++)i[t].alignment=="near"?u.push(i[t]):i[t].alignment=="far"?f.push(i[t]):e.push(i[t]);this._applyNearAnchor(u);this._applyCenterAnchor(e);this._applyFarAnchor(f)}},_applyNearAnchor:function(n){var i,t;if(n.length>1){for(i=0,t=0;t<n.length;t++)i=Math.max(i,n[t].width);for(t=0;t<n.length;t++)n[t].x+=n[t].anchor=="start"?this._orientation=="vertical"&&(n[t].width-i)/2:n[t].anchor=="middle"?this._orientation=="horizontal"&&(i-n[t].width)/2:this._orientation=="horizontal"?i-n[t].width:(i-n[t].width)/2}},_applyCenterAnchor:function(n){var i,t;if(n.length>1){for(i=0,t=0;t<n.length;t++)i=Math.max(i,n[t].width);for(t=0;t<n.length;t++)n[t].anchor=="start"?n[t].x+=(n[t].width-i)/2:n[t].anchor=="end"&&(n[t].x+=(i-n[t].width)/2)}},_applyFarAnchor:function(n){var i,t;if(n.length>1){for(i=0,t=0;t<n.length;t++)i=Math.max(i,n[t].width);for(t=0;t<n.length;t++)n[t].anchor=="start"?n[t].x+=this._orientation=="horizontal"?n[t].width-i:(n[t].width-i)/2:n[t].anchor=="middle"?n[t].x+=this._orientation=="horizontal"&&(n[t].width-i)/2:n[t].anchor=="end"&&(n[t].x+=this._orientation=="vertical"&&(i-n[t].width)/2)}},_isOverlapping:function(n,t){return!(n.x+n.width<t.x||n.x>t.x+t.width||n.y-n.height>t.y||n.y<t.y-t.height)},_initializeValues:function(){this._scale=this.model.quantitativeScaleSettings;this._labelPosition=this._scale.labelSettings.position.toLowerCase();this._tickPosition=this._scale.tickPosition.toLowerCase();this._flowDirection=this.model.flowDirection.toLowerCase();this._orientation=this.model.orientation.toLowerCase();this._tickPlacement=this._scale.tickPlacement.toLowerCase();this._labelPlacement=this._scale.labelSettings.labelPlacement.toLowerCase()},_changeOrientation:function(n){this._orientation==t.datavisualization.BulletGraph.Orientation.Vertical&&n.setAttribute("transform","translate(0,"+this.svgHeight+")rotate(-90)")},_setModel:function(i){var f=!0,r,u;for(r in i){this.model.enableAnimation=!1;switch(r){case"height":this.model.height=i[r];break;case"width":this.model.width=i[r];break;case"theme":this.model.theme=i[r];this._setTheme(t.datavisualization.BulletGraph.Themes,this.model.theme);break;case"orientation":this.model.orientation=i[r];break;case"flowDirection":this.model.flowDirection=i[r];break;case"qualitativeRangeSize":this.model.qualitativeRangeSize=i[r];break;case"quantitativeScaleLength":this.model.quantitativeScaleLength=i[r];break;case"quantitativeScaleSettings":n.extend(!0,this.model.quantitativeScaleSettings,{},i[r]);break;case"applyRangeStrokeToTicks":this.model.applyRangeStrokeToTicks=i[r];break;case"applyRangeStrokeToLabels":this.model.applyRangeStrokeToLabels=i[r];break;case"qualitativeRanges":n.extend(!0,this.model.qualitativeRanges,{},i[r]);break;case"captionSettings":n.extend(!0,this.model.captionSettings,{},i[r]);break;case"dataSource":n.extend(!0,this.model.fields,{},i[r]);break;case"value":for(u=0;this.model.quantitativeScaleSettings.featureMeasures[u]!=null;u++)this.model.quantitativeScaleSettings.featureMeasures[u].value=parseFloat(this.value());break;case"comparativeMeasureValue":for(u=0;this.model.quantitativeScaleSettings.featureMeasures[u]!=null;u++)this.model.quantitativeScaleSettings.featureMeasures[u].comparativeMeasureValue=parseFloat(this.comparativeMeasureValue());break;case"enableAnimation":this.model.enableAnimation=i[r];this.model.enableAnimation&&(n(this.svgObject).empty(),this._renderBulletElements(),this._animateMeasures());f=!1}}f&&(n(this.svgObject).empty(),this._renderBulletElements())},_bindData:function(){t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?(this._dataCount=this._scale.featureMeasures.length,this._drawMeasures()):this.model.fields.dataSource instanceof t.DataManager?this._initDataSource():(this._dataCount=this.model.fields.dataSource.length,this._drawMeasures())},_drawMeasures:function(){this._drawFeatureMeasureBar();this._drawComparativeMeasureSymbol()},_initDataSource:function(){var t=this._columnToSelect(this.model.fields),n=this,i=this.model.fields.dataSource.executeQuery(t);i.done(function(t){n.model.fields.dataSource=t.result;n._dataCount=t.result.length;n._drawFeatureMeasureBar();n._drawComparativeMeasureSymbol();n._bindHighlightRemoving()})},_columnToSelect:function(n){var u=[],r=t.Query(),i;if(t.isNullOrUndefined(n.query)){for(i in n)i!=="tableName"&&i!=="query"&&i!=="dataSource"&&u.push(n[i]);u.length>0&&r.select(u);this.model.fields.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||r.from(n.tableName)}else r=n.query;return r},_drawCaption:function(){if(this.model.drawCaption){var t={font:this.model.captionSettings.font,location:this.model.captionSettings.location,subTitle:this.model.captionSettings.subTitle,text:this.model.captionSettings.text,textAngle:this.model.captionSettings.textAngle};this._trigger("drawCaption",t);this.model.captionSettings=n.extend(this.model.captionSettings,t)}},_drawBulletSymbol:function(n,i,r,u){var e="M "+(i.x-i.width/2+i.width)+" "+(i.y+i.height/4)+" L "+(i.x-i.width/2+i.width)+" "+(i.y+-i.height/4)+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+-i.height/4)+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x-i.width/2)+" "+i.y+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x-i.width/2+i.width/2)+" "+(i.y+i.height/4)+" L "+(i.x-i.width/2+i.width)+" "+(i.y+i.height/4),o,l,a,v,s,y,p,f,d,g,h;switch(n.toLowerCase()){case"circle":o=Math.min(i.height,i.width)/2;r.cx=i.x;r.cy=i.y;r.r=o;this.svgRenderer.drawCircle(r,u);break;case"leftarrow":r.d=e;this.svgRenderer.drawPath(r,u);break;case"rightarrow":r.d=e;r.transform="rotate(180,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"uparrow":r.d=e;r.transform="rotate(90,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"downarrow":r.d=e;r.transform="rotate(-90,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"cross":l="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+i.y+" M "+i.x+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2);r.d=l;r.stroke=r.stroke?r.stroke:r.fill;this.svgRenderer.drawPath(r,u);break;case"horizontalline":a="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+i.y;r.d=a;r.stroke=r.stroke?r.stroke:r.fill;this.svgRenderer.drawPath(r,u);break;case"verticalline":v="M "+i.x+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2);r.d=v;r.stroke=r.stroke?r.stroke:r.fill;this.svgRenderer.drawPath(r,u);break;case"triangle":s="M "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" Z";r.d=s;this.svgRenderer.drawPath(r,u);break;case"invertedtriangle":s="M "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" Z";r.d=s;r.transform="rotate(180,"+i.x+","+i.y+")";this.svgRenderer.drawPath(r,u);break;case"hexagon":y="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+-i.width/4)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/4)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+i.y+" L "+(i.x+i.width/4)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/4)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=y;this.svgRenderer.drawPath(r,u);break;case"wedge":p="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/4)+" "+i.y+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=p;this.svgRenderer.drawPath(r,u);break;case"pentagon":var o=Math.sqrt(i.height*i.height+i.width*i.width)/2,c=t.EjSvgRender.utils._getStringBuilder();for(f=0;f<=5;f++){var nt=f*72,w=Math.PI/180*nt,b=o*Math.cos(w),k=o*Math.sin(w);f==0?c.append("M "+(i.x+b)+" "+(i.y+k)+" "):c.append("L "+(i.x+b)+" "+(i.y+k)+" ")}r.d=c.toString();this.svgRenderer.drawPath(r,u);break;case"star":d="M "+(i.x+i.width/3)+" "+(i.y+-i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/6)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/6)+" L "+(i.x+-i.width/3)+" "+(i.y+-i.height/2)+" L "+i.x+" "+(i.y+i.height/2)+" L "+(i.x+i.width/3)+" "+(i.y+-i.height/2);r.d=d;this.svgRenderer.drawPath(r,u);break;case"rectangle":g="M "+(i.x+-i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+-i.height/2);r.d=g;this.svgRenderer.drawPath(r,u);break;case"trapezoid":h="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+-i.width/2)+" "+(i.y+-i.height/4)+" L "+(i.x+-i.width/2+i.width)+" "+(i.y+-i.height/2)+" L "+(i.x+-i.width/2+i.width)+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+(i.y+i.height/4)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=h;this.svgRenderer.drawPath(r,u);break;case"diamond":h="M "+(i.x+-i.width/2)+" "+i.y+" L "+i.x+" "+(i.y+-i.height/2)+" L "+(i.x+i.width/2)+" "+i.y+" L "+i.x+" "+(i.y+i.height/2)+" L "+(i.x+-i.width/2)+" "+i.y;r.d=h;this.svgRenderer.drawPath(r,u);break;case"ellipse":r.cx=i.x;r.cy=i.y;r.rx=i.width/2;r.ry=i.height/2;this.svgRenderer.drawEllipse(r,u);break;case"image":r.x=i.x-i.width/2;r.y=i.y-i.height/2;r.width=i.width;r.height=i.height;r.href=this.model.captionSettings.indicator.symbol.imageURL;r.visibility="visible";this.svgRenderer.drawImage(r,u)}},_drawIndicator:function(){var i,r,u;this.model.captionSettings.indicator.visible&&(i=this.model.captionSettings.indicator,r=n.extend({},{indicatorSettings:this.model.captionSettings.indicator}),this.model.drawIndicator&&(this._trigger("drawIndicator",r),r.cancel==!1&&(i=r.indicatorSettings,this.model.captionSettings.indicator=i)),u=t.EjSvgRender.utils._measureText(i.text,null,i.font),this._indicator={bounds:u,settings:i})},_indicatorTextOptions:function(n,t,i,r){var u=n._location?n._location:n.location;return{"class":r,x:u.x+t.width+n.textSpacing,y:u.y-t.height/2+parseFloat(n.font.size)/3,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,"text-anchor":"start",opacity:n.font.opacity,transform:"rotate("+n.textAngle+","+t.x+","+t.y+")"}},_indicatorSymbolOptions:function(n,t){return{id:n.id+"_indicatorSymbol",stroke:t.symbol.border.color,fill:t.symbol.color,"stroke-width":t.symbol.border.width,opacity:t.symbol.opacity}},_textOptions:function(n,t){var i=n._location?n._location:n.location;return{"class":t,x:i.x,y:i.y,fill:n.font.color,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,"text-anchor":"start",opacity:n.font.opacity,cursor:"default",transform:"rotate("+n.textAngle+","+i.x+","+i.y+")"}},_drawScale:function(n,i){var r=this._scale._location?this._scale._location:this._scale.location,u,f,e;u=this._tickPosition==t.datavisualization.BulletGraph.TickPosition.Far||this._tickPosition==t.datavisualization.BulletGraph.TickPosition.Center?this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below?r.y:r.y+this._scale.labelSettings.offset+this._scale.labelSettings.size:this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below?r.y+this._scale.majorTickSettings.size:r.y+this._scale.labelSettings.offset+this._scale.labelSettings.size+this._scale.majorTickSettings.size;f=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward?r.x:this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?r.x-this._scale.labelSettings.offset:r.x;e={id:this.svgObject.id+"_SvgScale",x:f,y:u,width:this.model.quantitativeScaleLength,height:this.model.qualitativeRangeSize,fill:"transparent","stroke-width":0};this.svgRenderer.drawRect(e,i)},_drawMajorTicks:function(n,i){var r,l,g=0,a=this._scale.location,p=this._tickPlacement=="inside",s=this._scale.location.x,w=this.model.quantitativeScaleLength,nt=this._scale.labelSettings.offset,b=this.model.qualitativeRangeSize,u=this._scale.majorTickSettings.width,v=this._scale.majorTickSettings.size,f=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,o=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,tt=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,e,y,d;r=o?f?s+u/2:s+w+u/2:f?s+w-u/2:s+u/2;l=this._tickPosition=="far"?a.y+b+(p?-v:0):this._tickPosition=="near"?a.y+(p?0:-v):a.y+b/2-v/2;var h=this._scale.minimum,c=this._scale.maximum,k=this._scale.interval;for(e=h;e<=c;e+=k)g++,e>=c&&(f&&!o?r+=u:r-=u),!f&&o&&(r=e>=c?r+u:e==h?r-u:r),this.model.applyRangeStrokeToTicks&&(strokeColor=this._bindingRangeStrokes(r-u/2)),y=this._majorTickLines(this._scale,r,l),!f&&o&&e==h&&(r=r+u),this.model.drawTicks&&(data={majorTickSettings:this._scale.majorTickSettings,minorTickSettings:this._scale.minorTickSettings,minorTicksPerInterval:this._scale.minorTicksPerInterval,maximum:c,minimum:h,interval:k},this._trigger("drawTicks",data),y=this._majorTickLines(data,r,l)),d=this.svgRenderer.createLine(y),r=!o&&f||o&&!f?r-n:r+n,i.appendChild(d)},_majorTickLines:function(n,t,i){return{x1:t,y1:i,x2:t,y2:i+n.majorTickSettings.size,"stroke-width":n.majorTickSettings.width,stroke:this.model.applyRangeStrokeToTicks&&strokeColor?strokeColor:n.majorTickSettings.stroke}},_forwardStrokeBinding:function(n){if(n>=this._scale.location.x&&n<=this._rangeCollection[0]+this._scale.location.x)return this.model.qualitativeRanges[0].rangeStroke;for(var t=0;t<=this._rangeCollection.length-1;t++)if(n>=this._rangeCollection[t]+this._scale.location.x&&n<=this._rangeCollection[t+1]+this._scale.location.x)return this.model.qualitativeRanges[t+1].rangeStroke},_backwardStrokeBinding:function(t){if(t>=this._rangeCollection[this._rangeCollection.length-1])return this.model.qualitativeRanges[0].rangeStroke;for(k=0;k<=this._rangeCollection.length-1;k++)if(t>=this._rangeCollection[k]&&t<this._rangeCollection[k+1]){var i=n.inArray(this._rangeCollection[k],this._rangeCollection);return this.model.qualitativeRanges[this._rangeCollection.length-1-i].rangeStroke}},_bindingRangeStrokes:function(n){if(this._rangeCollection.length==1){if(n>=this._scale.location.x&&n<=this._rangeCollection[0]+this._scale.location.x)return this.model.qualitativeRanges[0].rangeStroke}else return this.model.orientation==t.datavisualization.BulletGraph.Orientation.Horizontal&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward||this.model.orientation==t.datavisualization.BulletGraph.Orientation.Vertical&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Backward?this._forwardStrokeBinding(n):this._backwardStrokeBinding(n)},_drawMinorTicks:function(i,r){var h,c,s,p,u,g=0,e=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,f=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,nt=this._tickPlacement=="inside",o=this._scale.location.x,tt=this.model.qualitativeRangeSize,et=this._scale.labelSettings.offset,ot=this._scale.majorTickSettings.size,l=this._scale.minorTickSettings.size,it=this._scale.minorTickSettings.width,b=this.model.quantitativeScaleLength,d,k,w,v,y;h=e?f?o:o+b:f?o+b-it/2:o;switch(this._tickPosition){case"far":s=this._scale.location.y+tt;p=s+(nt?-l:l);break;case"near":s=this._scale.location.y+(nt?l:-l);p=this._scale.location.y;break;default:s=this._scale.location.y+tt/2-l/2;p=s+l}var rt=this._scale.maximum,ut=this._scale.minimum,ft=this._scale.interval,a=this._scale.minorTicksPerInterval;for(d=ut;d<=rt;d+=ft){for(c=i/a,k=1;k<=a;k++)g++,u=!f&&e||f&&!e?h-c+c/(a+1):h+c-c/(a+1),!e&&f&&g>=(rt-ut)*a&&(u+=it/2),this.model.applyRangeStrokeToTicks&&(strokeColor=this._bindingRangeStrokes(u)),w=this._minorTickLines(this._scale,u,s,p),this.model.drawTicks&&(data={majorTickSettings:this._scale.majorTickSettings,minorTickSettings:this._scale.minorTickSettings,minorTicksPerInterval:this._scale.minorTicksPerInterval,maximum:this._scale.maximum,minimum:this._scale.minimum,interval:this._scale.interval},this._trigger("drawTicks",data),this._scale=n.extend(this._scale,data),w=this._minorTickLines(data,u,s,p)),!e&&f?(v=b+o+1,u<=v&&u>=o+1&&(y=this.svgRenderer.createLine(w),r.appendChild(y))):e&&!f?(v=o+1,u>=v&&(y=this.svgRenderer.createLine(w),r.appendChild(y))):(v=b+o+1,u<=v&&(y=this.svgRenderer.createLine(w),r.appendChild(y))),c=i/a*(k+1);h=!e&&f||e&&!f?h-i:h+i}},_minorTickLines:function(n,t,i,r){return{x1:t,y1:i,x2:t,y2:r,"stroke-width":n.minorTickSettings.width,stroke:this.model.applyRangeStrokeToTicks&&strokeColor?strokeColor:n.minorTickSettings.stroke}},_drawLabels:function(n,i){var o,l,d=this.model.locale,rt=d&&this.model.enableGroupSeparator,g,nt=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,w=this._scale.location.x,f=this._scale.labelSettings.offset,tt=this.model.quantitativeScaleLength,ot=this._scale.majorTickSettings.width,c,e,y,p,k;o=nt?h?w:w+tt:h?w+tt:w;var it=this._tickPosition+this._labelPlacement,s=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,st=this._scale.location.y,b=this.model.qualitativeRangeSize,u=this._scale.labelSettings.size,ht=this._scale.majorTickSettings.size;switch(it){case"faroutside":case"centeroutside":l=s?this._scale.location.y+b+f+u:this._scale.location.y-f;break;case"farinside":case"centerinside":l=s?this._scale.location.y+b-f:this._scale.location.y+f+(h?u:0);break;case"nearoutside":l=s?this._scale.location.y+b+f+u:this._scale.location.y-f;break;case"nearinside":l=s?this._scale.location.y+b-f:this._scale.location.y+f+u}var ut=this._scale.minimum,ft=this._scale.maximum,et=this._scale.interval,ct=this._labelPlacement=="inside";for(c=ut;c<=ft;c+=et){var r=l,a=o,v=this._scale.labelSettings.font;if(v.size=u,e={width:0,height:0},h)transformText="rotate(0,"+a+","+r+")";else{y=this._scale.labelSettings.labelPrefix+c+this._scale.labelSettings.labelSuffix;switch(it){case"faroutside":case"centeroutside":s?r-=u:(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width);break;case"farinside":case"centerinside":s&&(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width);break;case"nearoutside":s?r-=u:(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width);break;case"nearinside":s?(e=t.EjSvgRender.utils._measureText(y,null,v),r-=e.width):r-=u}a-=u/3;transformText="rotate(90,"+a+","+r+")"}this.model.applyRangeStrokeToLabels&&(strokeColor=this._bindingRangeStrokes(o));p=this._labelOptions(this.model.quantitativeScaleSettings.labelSettings,a,r);this.model.drawLabels&&(k={font:this._scale.labelSettings.font,labelPrefix:this._scale.labelSettings.labelPrefix,labelSuffix:this._scale.labelSettings.labelSuffix,offset:f,size:u,stroke:this._scale.labelSettings.stroke},this._trigger("drawLabels",k),p=this._labelOptions(k,a,r));o=nt?h?o+n:o-n:h?o-n:o+n;g=rt?c.toLocaleString(d):c;this.svgRenderer.drawText(p,p.labelPrefix+g+p.labelSuffix,i)}},_labelOptions:function(n,i,r){return{x:i,y:r,"text-anchor":this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?"middle":"start",fill:this.model.applyRangeStrokeToLabels&&strokeColor?strokeColor:n.stroke,"font-size":n.size+"px","font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,transform:transformText,labelPrefix:n.labelPrefix,labelSuffix:n.labelSuffix}},_drawQualitativeRanges:function(n){var c=this._scale.location.x,y=this._scale.location.y,e,a=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,o=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,p=this._scale.labelSettings.offset,s,h,f,v;this._rangeCollection=[];var w=this._tickPosition+this._labelPlacement,b=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,k=this.model.qualitativeRangeSize,l=this._scale.location.x,r=this._scale.minimum,i=this._scale.maximum,u=this.model.quantitativeScaleLength;for(s=this.model.qualitativeRanges.length-1;s>=0;s--)h={object:this,rangeIndex:s,rangeOptions:this.model.qualitativeRanges[s],rangeEndValue:this.model.qualitativeRanges[s].rangeEnd},this.model.drawQualitativeRanges&&this._trigger("drawQualitativeRanges",h),f=h.rangeEndValue,f=f>i?i:f,a?(c=o?l:l+(u-u/((i-r)/(i-r-(i-f)))),e=o?u/((i-r)/(i-r-(i-f))):u/((i-r)/(i-r-(i-f)))):(c=o?l+(u-u/((i-r)/(i-r-(i-f)))):l,e=o?u/((i-r)/(i-r-(i-f))):u/((i-r)/(i-r-(i-f)))),v={x:c,y:y,height:this.model.qualitativeRangeSize,width:e>0?e<u?e:u:0,fill:h.rangeOptions.rangeStroke,opacity:h.rangeOptions.rangeOpacity},o&&a||!o&&!a?this._rangeCollection.push(e):this._rangeCollection.push(c),this.svgRenderer.drawRect(v,n);this._rangeCollection.sort(this._sortRangeCollection)},_sortRangeCollection:function(n,t){return n-t},_calculateFeatureMeasureBounds:function(n,i){var o=this._scale.minimum,a,v;if(n=n<o&&o<0?o:n,n>=o){var u,h,r,f=this._scale.location.x,e=this.model.quantitativeScaleLength,s=this._scale.maximum-this._scale.minimum,c=this._scale.maximum-n,l=this._flowDirection.toLowerCase()+this._orientation.toLowerCase();i=i==null?"":i;a=this._scale.labelSettings.font;a.size=this._scale.labelSettings.size;v=t.EjSvgRender.utils._measureText(i.toString(),null,a).width;switch(l){case"forwardhorizontal":case"backwardvertical":u=f+(o>0?0:e/s*Math.abs(o));r=e/(s/(o>0?s-c:n));n<0&&(r=Math.abs(r),u-=r);r=u+r<f+e?r:f+e-u;h=f-(l=="forwardhorizontal"?v/2+this._scale.labelSettings.offset:this._scale.labelSettings.offset);break;default:u=f+(e-e/(s/(s-c)));r=o>0?e/(s/(s-c)):e/(s/n);n<0&&(r=Math.abs(r),u-=r);u<f&&(r=u+r-f,u=f);h=f+e+(l=="backwardhorizontal"?v/2+this._scale.labelSettings.offset:this._scale.labelSettings.offset)}return{pointX:u,Width:r,lPointX:h}}return!1},_drawFeatureMeasureBar:function(){var e=1,o,r,s,f,l=this.model.locale,v=l&&this.model.enableGroupSeparator,a=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null,y=this._orientation==t.datavisualization.BulletGraph.Orientation.Vertical,p=typeof this.model.value=="function"?this._value():this.model.value,n,i,h,c,u;if(this._dataCount>0)for(n=this._dataCount-1;n>=0;n--)o=a?this.model.fields.dataSource[n][this.model.fields.featureMeasures]:t.isNullOrUndefined(this._scale.featureMeasures[n].value)?p:this._scale.featureMeasures[n].value,r=a?this.model.fields.dataSource[n][this.model.fields.category]:this._scale.featureMeasures[n].category,s=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*e/2-this._scale.featuredMeasureSettings.width/2,f=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*e/2+this._scale.featuredMeasureSettings.width/2-1,i=this._calculateFeatureMeasureBounds(o,r),i&&(h=this._featureBar(this._scale,i.pointX,s,i.Width,n),this.model.drawFeatureMeasureBar&&(u={featuredMeasureSettings:this._scale.featuredMeasureSettings},this._trigger("drawFeatureMeasureBar",u),h=this._featureBar(u,i.pointX,s,i.Width,n)),this.svgRenderer.drawRect(h,this._scaleGroup),transformText=y?"rotate(90,"+i.lPointX+","+(f-4)+")":"rotate(0,"+i.lPointX+","+f+")",c=this._drawcategory(this.model.quantitativeScaleSettings.labelSettings,i.lPointX,f),this.model.drawCategory&&(u={size:this.model.quantitativeScaleSettings.labelSettings.size,stroke:this.model.quantitativeScaleSettings.labelSettings.stroke,font:this.model.quantitativeScaleSettings.labelSettings.font,categoryValue:r},this._trigger("drawCategory",u),c=this._drawcategory(u,i.lPointX,f),r=u.categoryValue),t.isNullOrUndefined(r)||this.svgRenderer.drawText(c,v?r.toLocaleString(l):r,this._scaleGroup),e+=2,this.value(o))},_drawcategory:function(n,t,i){return{x:t,y:i+this._scale.featuredMeasureSettings.width/2,"text-anchor":"middle",fill:n.stroke,"font-size":n.size+"px","font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,transform:transformText}},_featureBar:function(n,t,i,r,u){return{"class":this.svgObject.id+"_FeatureMeasure",id:this.svgObject.id+"_FeatureMeasure_"+u,x:t,y:i,height:n.featuredMeasureSettings.width,width:r,fill:n.featuredMeasureSettings.stroke}},_drawComparativeMeasureSymbol:function(){var r=1,n,u,f,e,c=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,l=typeof this.model.comparativeMeasureValue=="function"?this._comparativeMeasureValue():this.model.comparativeMeasureValue,i,o,s;if(this._dataCount>0)for(i=this._dataCount-1;i>=0;i--)n=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource[i][this.model.fields.comparativeMeasure]:t.isNullOrUndefined(this._scale.featureMeasures[i].comparativeMeasureValue)?l:this._scale.featureMeasures[i].comparativeMeasureValue,n>=this._scale.minimum&&n<=this._scale.maximum&&(u=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*r/2-this._scale.featuredMeasureSettings.width/2-this._scale.featuredMeasureSettings.width,f=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*r/2-this._scale.featuredMeasureSettings.width/2+2*this._scale.featuredMeasureSettings.width,e=c?h?this._scale.location.x+this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n))):this._scale.location.x+(this.model.quantitativeScaleLength-this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n)))):h?this._scale.location.x+(this.model.quantitativeScaleLength-this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n)))):this._scale.location.x+this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-n))),o=this._compareMeasure(this._scale,e,u,f,i,n),this.model.drawComparativeMeasureSymbol&&(s={comparativeMeasureSettings:this._scale.comparativeMeasureSettings},this._trigger("drawComparativeMeasureSymbol",s),o=this._compareMeasure(s,e,u,f,i,n)),this.svgRenderer.drawLine(o,this._scaleGroup),r+=2,this.comparativeMeasureValue(n))},_compareMeasure:function(n,t,i,r,u,f){return{"class":this.svgObject.id+"_ComparativeMeasure",id:this.svgObject.id+"_ComparativeMeasure_"+u,x1:f==this._scale.maximum?t-n.comparativeMeasureSettings.width/2:f==this._scale.minimum?t+n.comparativeMeasureSettings.width/2:t,y1:i,x2:f==this._scale.maximum?t-n.comparativeMeasureSettings.width/2:f==this._scale.minimum?t+n.comparativeMeasureSettings.width/2:t,y2:r,"stroke-width":n.comparativeMeasureSettings.width,stroke:n.comparativeMeasureSettings.stroke}},_setTheme:function(n,i){var u=[],e,r,f;this._scale=this.model.quantitativeScaleSettings;for(e in n)u.push(e);for(r=0;r<u.length;r++)for(this._scale.majorTickSettings.stroke=!this._scale.majorTickSettings.stroke||this._scale.majorTickSettings.stroke==n[u[r]].quantitativeScaleSettings.majorTickSettings.stroke?n[i].quantitativeScaleSettings.majorTickSettings.stroke:this._scale.majorTickSettings.stroke,this._scale.minorTickSettings.stroke=!this._scale.minorTickSettings.stroke||this._scale.minorTickSettings.stroke==n[u[r]].quantitativeScaleSettings.minorTickSettings.stroke?n[i].quantitativeScaleSettings.minorTickSettings.stroke:this._scale.minorTickSettings.stroke,this._scale.labelSettings.stroke=!this._scale.labelSettings.stroke||this._scale.labelSettings.stroke==n[u[r]].quantitativeScaleSettings.labelSettings.stroke?n[i].quantitativeScaleSettings.labelSettings.stroke:this._scale.labelSettings.stroke,this._scale.featuredMeasureSettings.stroke=!this._scale.featuredMeasureSettings.stroke||this._scale.featuredMeasureSettings.stroke==n[u[r]].quantitativeScaleSettings.featuredMeasureSettings.stroke?n[i].quantitativeScaleSettings.featuredMeasureSettings.stroke:this._scale.featuredMeasureSettings.stroke,this._scale.comparativeMeasureSettings.stroke=!this._scale.comparativeMeasureSettings.stroke||this._scale.comparativeMeasureSettings.stroke==n[u[r]].quantitativeScaleSettings.comparativeMeasureSettings.stroke?n[i].quantitativeScaleSettings.comparativeMeasureSettings.stroke:this._scale.comparativeMeasureSettings.stroke,this.model.captionSettings.font.color=!this.model.captionSettings.font.color||this.model.captionSettings.font.color==n[u[r]].captionSettings.font.color?n[i].captionSettings.font.color:this.model.captionSettings.font.color,this.model.captionSettings.subTitle.font.color=!this.model.captionSettings.subTitle.font.color||this.model.captionSettings.subTitle.font.color==n[u[r]].captionSettings.subTitle.font.color?n[i].captionSettings.subTitle.font.color:this.model.captionSettings.subTitle.font.color,this.model.captionSettings.indicator.font.color=!this.model.captionSettings.indicator.font.color||this.model.captionSettings.indicator.font.color==n[u[r]].captionSettings.indicator.font.color?n[i].captionSettings.indicator.font.color:this.model.captionSettings.indicator.font.color,this.model.captionSettings.indicator.symbol.color=!this.model.captionSettings.indicator.symbol.color||this.model.captionSettings.indicator.symbol.color==n[u[r]].captionSettings.indicator.symbol.color?n[i].captionSettings.indicator.symbol.color:this.model.captionSettings.indicator.symbol.color,f=0;f<this.model.qualitativeRanges.length;f++)this.model.qualitativeRanges[f].rangeStroke=this.model.qualitativeRanges[f].rangeStroke?this.model.qualitativeRanges[f].rangeStroke:t.isNullOrUndefined(n[i].qualitativeRanges[f])?n[i].qualitativeRanges[0].rangeStroke:n[i].qualitativeRanges[f].rangeStroke},_onDrawQualitativeRanges:function(n,t,i){var r={object:this,scaleElement:this.model.quantitativeScaleSettings,rangeIndex:i,rangeElement:n,rangeEndValue:t};this._trigger("drawQualitativeRanges",r)},_doAnimation:function(){for(var r,i=n("."+this.svgObject.id+"_FeatureMeasure"),t=i.length-1;t>=0;t--)r=i[t],this._animateFeatureBar(r)},_doLineAnimation:function(){for(var r,i=n("."+this.svgObject.id+"_ComparativeMeasure"),u=2e3/i.length,t=i.length-1;t>=0;t--)r=i[t],n(r).attr("transform","scale(0)"),this._doLineSymbol(r,u,t)},_animateFeatureBar:function(i){var r=i.getBBox(),u,f;this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Backward||this._orientation==t.datavisualization.BulletGraph.Orientation.Vertical&&this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward?(u=r.x+r.width,f=r.y+r.height):(u=r.x,f=r.y);n(i).animate({scale:1},{duration:1e3,step:function(t){scaleVal=t;n(i).attr("transform","translate("+u+" "+f+") scale("+t+",1) translate("+-u+" "+-f+")")}})},_doLineSymbol:function(t,i,r){var o=parseInt(r*i),u=t.getBBox(),f=u.x+u.width/2,e=u.y+u.height/2;n(t).delay(o).animate({scale:1},{duration:200,step:function(i){n(t).attr("transform","translate("+f+" "+e+") scale("+i+") translate("+-f+" "+-e+")")}})},bindEvents:function(){var u=t.EjSvgRender.utils.browserInfo(),i=u.isMSPointerEnabled,r=u.pointerEnabled,f=i?r?"pointerdown":"MSPointerDown":"touchstart mousedown",e=i?r?"pointerup":"MSPointerUp":"touchend mouseup",o=i?r?"pointermove":"MSPointerMove":"touchmove mousemove",s=i?r?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.model.browserInfo=u;this._on(n(this.svgObject),o,this._bulletMouseMove);this._on(n(this.svgObject),s,this._bulletMouseLeave);this._on(n(this.svgObject),f,this._bulletMouseDown);this._on(n(this.svgObject),e,this._bulletMouseUp);(this.model.enableResizing||this.model.isResponsive)&&(t.isTouchDevice()?this._on(n(window),"orientationchange",this._bulletResize):this._on(n(window),"resize",this._bulletResize))},isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_bulletResize:function(){var i=this,f=this.model.height,r=this.model.width,e=n(i.svgObject),f=90,r=t.isTouchDevice()?250:595,u=n(i.element).width(),o;i.model.width?r=parseInt(i.model.width):u>0&&u<595?r=u:u>595&&(r=595);i.model.height&&(f=parseInt(i.model.height));o=n(i.element).height()>f?f:n(i.element).height();this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){r<n(i.element).width()?e.width(r):e.width(n(i.element).width());e.height(o);i.redraw()},500)},_bulletMouseLeave:function(t){this.isTouch(t)||(n("#tooltip").remove(),n(".tooltipDiv"+this._id).remove())},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_bulletMouseMove:function(t){var i,r;i=n(t.target).attr("id");r=n(t.target).attr("class");this.isTouch(t)||(n("#tooltip").remove(),n(".tooltipDiv"+this._id).remove(),this._elementTooltip(t,r,i),this._displayTooltip(t,r,i))},_bulletMouseDown:function(t){if(this.isTouch(t)){t.preventDefault();n("#tooltip").remove();n(".tooltipDiv"+this._id).remove();var i=n(t.target).attr("id"),r=n(t.target).attr("class");this._elementTooltip(t,r,i);this._displayTooltip(t,r,i)}},_bulletMouseUp:function(t){if(this.isTouch(t)){var i=this,r;window.clearTimeout(i.model.timer);n(".tooltipDiv"+this._id).length==1&&(r=n(".tooltipDiv"+this._id));r&&(i.model.trackerElement=r,i.model.timer=setTimeout(function(){i.model.trackerElement&&n(".tooltipDiv"+i._id).fadeOut(500,function(){n(".tooltipDiv"+i._id).remove();n("[id*="+i.svgObject.id+"_FeatureMeasure_]").attr("opacity","1")})},1200))}},_elementTooltip:function(t,r){var o=this.model.captionSettings,u=n("<div><\/div>").attr({id:"tooltip","class":"tooltipDiv"+this._id}),s=this.mousePosition(t),h,f,e;if(str="",n(u).css({left:s.pageX+10,top:s.pageY+10,display:"block",position:"absolute","z-index":"13000",cursor:"default","font-family":"Segoe UI",color:"#707070","font-size":"12px","background-color":"#FFFFFF",border:"1px solid #707070"}),r==this.svgObject.id+"_Caption"?str=t.target.textContent==o.text?"":o.text:r==this.svgObject.id+"_SubTitle"?str=t.target.textContent==o.subTitle.text?"":o.subTitle.text:r==this.svgObject.id+"_Indicator"&&(str=t.target.textContent==o.indicator.text?"":o.indicator.text),str!="")n(u).html(" "+str+" "),n(document.body).append(u);else if(this.model.tooltipSettings.enableCaptionTooltip&&(r==this.svgObject.id+"_Caption"||r==this.svgObject.id+"_SubTitle"||r==this.svgObject.id+"_Indicator")){var l=n("."+r).text(),a={Text:l},c=this.model.tooltipSettings.captionTemplate;n(".tooltipDiv"+this._id).length==0&&(u=n("<div><\/div>").attr("class","tooltipDiv"+this._id).css({position:"absolute","z-index":"13000",display:"block"}),n(document.body).append(u));c!=""&&c!=null?(h=document.getElementById(c),h=h?n(h).clone():n(c),n(h).css("display","block").appendTo(u),n(u).html(n(h).render(a))):n(u).html(l);n(u).css("font-size","12px");f=s.clientX+n(document).scrollLeft()+10;e=s.clientY+n(document).scrollTop()+10;f=f+n(u).width()<n(window).width()?f:f-n(u).width();e=e+n(u).height()<n(window).height()?e:e-n(u).height();(f===i||f===null)&&(f=s.clientX+n(document).scrollLeft()+10);(e===i||e===null)&&(e=s.clientY+n(document).scrollTop()+10);n(u).css({left:f,top:e,"-webkit-border-radius":"5px 5px 5px 5px","-moz-border-radius":"5px 5px 5px 5px","-o-border-radius":"5px 5px 5px 5px","border-radius":"5px 5px 5px 5px","background-color":"White",border:"1px Solid Black","padding-bottom":"5px","padding-left":"5px","padding-right":"5px","padding-top":"5px"})}},mousePosition:function(n){return!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0?n:n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0?n.originalEvent:n.originalEvent&&n.originalEvent.changedTouches!=i&&!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0?n.originalEvent.changedTouches[0]:n},_displayTooltip:function(r,u,f){var l,a,e,o;if(u!="undefined"&&(u==this.svgObject.id+"_FeatureMeasure"||u==this.svgObject.id+"_ComparativeMeasure")){var h=this.model.locale,v=h&&this.model.enableGroupSeparator,s,y=typeof this.model.value=="function"?this._value():this.model.value,p=typeof this.model.comparativeMeasureValue=="function"?this._comparativeMeasureValue():this.model.comparativeMeasureValue,c=this.mousePosition(r);measureId=f.substring(f.lastIndexOf("_")+1);currentVal=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource[measureId][this.model.fields.featureMeasures]:t.isNullOrUndefined(this._scale.featureMeasures[measureId].value)?y:this._scale.featureMeasures[measureId].value;targetVal=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource[measureId][this.model.fields.comparativeMeasure]:t.isNullOrUndefined(this._scale.featureMeasures[measureId].comparativeMeasureValue)?p:this._scale.featureMeasures[measureId].comparativeMeasureValue;categoryVal=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?t.isNullOrUndefined(this.model.fields.dataSource[measureId][this.model.fields.category])?null:this.model.fields.dataSource[measureId][this.model.fields.category]:t.isNullOrUndefined(this._scale.featureMeasures[measureId].category)?null:this._scale.featureMeasures[measureId].category;s=v?{currentValue:currentVal.toLocaleString(h),targetValue:targetVal.toLocaleString(h),category:t.util.isNullOrUndefined(categoryVal)?categoryVal:categoryVal.toLocaleString(h)}:{currentValue:currentVal,targetValue:targetVal,category:categoryVal};n(".tooltipDiv"+this._id).length==0&&(tooltipdiv=n("<div><\/div>").attr("class","tooltipDiv"+this._id).css({position:"absolute","z-index":"13000",display:"block"}),n(document.body).append(tooltipdiv));this.model.tooltipSettings.template!=""&&this.model.tooltipSettings.template!=null?(l=n("#"+this.model.tooltipSettings.template).clone(),n(l).css("display","block").appendTo(tooltipdiv),n(tooltipdiv).html(n(l).render(s))):(a=t.isNullOrUndefined(s.category)?"":"<br/> Category : "+s.category,n(tooltipdiv).html("Current : "+s.currentValue+"<br/> Target : "+s.targetValue+a));n(tooltipdiv).css("font-size","12px");e=c.clientX+n(document).scrollLeft()+10;o=c.clientY+n(document).scrollTop()+10;e=e+n(tooltipdiv).width()<n(window).width()?e:e-n(tooltipdiv).width();o=o+n(tooltipdiv).height()<n(window).height()?o:o-n(tooltipdiv).height();(e===i||e===null)&&(e=c.clientX+n(document).scrollLeft()+10);(o===i||o===null)&&(o=c.clientY+n(document).scrollTop()+10);n(tooltipdiv).css({left:e,top:o,"-webkit-border-radius":"5px 5px 5px 5px","-moz-border-radius":"5px 5px 5px 5px","-o-border-radius":"5px 5px 5px 5px","border-radius":"5px 5px 5px 5px","background-color":"White",color:"black",border:"1px Solid Black","padding-bottom":"5px","padding-left":"5px","padding-right":"5px","padding-top":"5px"});u==this.svgObject.id+"_FeatureMeasure"&&n("#"+f).attr("opacity","0.7")}},redraw:function(){n(this.svgObject).empty();this._renderBulletElements()},destroy:function(){n(this.element).removeClass("e-bulletgraph e-js").find("#"+this.svgObject.id).remove()},setFeatureMeasureBarValue:function(n,i){this._scale=this.model.quantitativeScaleSettings;var r=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource.length:this._scale.featureMeasures.length;n<r&&i!=null&&(t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?this._scale.featureMeasures[n].value=i:this.model.fields.dataSource[n][this.model.fields.featureMeasures]=i,this.redraw(),this.model.enableAnimation&&this._doAnimation())},setComparativeMeasureSymbol:function(n,i){this._scale=this.model.quantitativeScaleSettings;var r=!t.isNullOrUndefined(this.model.fields)&&this.model.fields.dataSource!=null?this.model.fields.dataSource.length:this._scale.featureMeasures.length;n<r&&i!=null&&(t.isNullOrUndefined(this.model.fields)||this.model.fields.dataSource==null?this._scale.featureMeasures[n].comparativeMeasureValue=i:this.model.fields.dataSource[n][this.model.fields.comparativeMeasure]=i,this.redraw(),this.model.enableAnimation&&this._doLineAnimation())}});t.datavisualization.BulletGraph.Orientation={Horizontal:"horizontal",Vertical:"vertical"};t.datavisualization.BulletGraph.TickPlacement={Inside:"inside",Outside:"outside"};t.datavisualization.BulletGraph.LabelPlacement={Inside:"inside",Outside:"outside"};t.datavisualization.BulletGraph.Shape={Circle:"circle",Cross:"cross",Diamond:"diamond",DownArrow:"downarrow",Ellipse:"ellipse",HorizontalLine:"horizontalLine",Image:"image",InvertedTriangle:"invertedtriangle",LeftArrow:"leftarrow",Pentagon:"pentagon",Rectangle:"Rectangle",RightArrow:"rightarrow",Star:"star",Trapezoid:"trapezoid",Triangle:"triangle",UpArrow:"uparrow",VerticalLine:"verticalline",Wedge:"wedge"};t.datavisualization.BulletGraph.TickPosition={Far:"far",Near:"near",Center:"center"};t.datavisualization.BulletGraph.LabelPosition={Below:"below",Above:"above"};t.datavisualization.BulletGraph.FlowDirection={Forward:"forward",Backward:"backward"};t.datavisualization.BulletGraph.FontStyle={Normal:"Normal",Italic:"Italic",Oblique:"Oblique"};t.datavisualization.BulletGraph.FontWeight={Normal:"Normal",Bold:"Bold",Bolder:"Bolder",Lighter:"Lighter"};t.datavisualization.BulletGraph.Themes={flatlight:{quantitativeScaleSettings:{majorTickSettings:{stroke:"#191919"},minorTickSettings:{stroke:"#191919"},labelSettings:{stroke:"#191919"},featuredMeasureSettings:{stroke:"#191919"},comparativeMeasureSettings:{stroke:"#191919"}},qualitativeRanges:[{rangeStroke:"#ebebeb"},{rangeStroke:"#d8d8d8"},{rangeStroke:"#7f7f7f"}],captionSettings:{font:{color:"#191919"},subTitle:{font:{color:"#191919"}},indicator:{font:{color:"#191919"},symbol:{color:"#191919"}}}},material:{quantitativeScaleSettings:{majorTickSettings:{stroke:"#333333"},minorTickSettings:{stroke:"#191919"},labelSettings:{stroke:"#333333"},featuredMeasureSettings:{stroke:"#333333"},comparativeMeasureSettings:{stroke:"#333333"}},qualitativeRanges:[{rangeStroke:"#ebebeb"},{rangeStroke:"#d8d8d8"},{rangeStroke:"#7f7f7f"}],captionSettings:{font:{color:"#333333"},subTitle:{font:{color:"#333333"}},indicator:{font:{color:"#333333"},symbol:{color:"#333333"}}}},flatdark:{quantitativeScaleSettings:{majorTickSettings:{stroke:"#ffffff"},minorTickSettings:{stroke:"#ffffff"},labelSettings:{stroke:"#ffffff"},featuredMeasureSettings:{stroke:"#ffffff"},comparativeMeasureSettings:{stroke:"#ffffff"}},qualitativeRanges:[{rangeStroke:"#b3b3b3"},{rangeStroke:"#999999"},{rangeStroke:"#4d4d4d"}],captionSettings:{font:{color:"#ffffff"},subTitle:{font:{color:"#ffffff"}},indicator:{font:{color:"#ffffff"},symbol:{color:"#ffffff"}}}}}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejRangeNavigator","ej.datavisualization.RangeNavigator",{ejChart:"",validTags:["div"],defaults:{theme:"",padding:"0",enableAutoResizing:!1,isResponsive:!1,allowSnapping:!1,sizeSettings:{width:"",height:""},_size:{},locale:"en-US",valueType:"datetime",valueAxisSettings:{rangePadding:"none",range:{min:null,max:null,interval:null},axisLine:{visible:!1},font:{size:"0px"},majorTickLines:{width:0,size:0,visible:!0},majorGridLines:{visible:!1},visible:!1},rangePadding:"none",enableRTL:!1,enableScrollbar:!1,dataSource:"",xName:"x",yName:"y",tooltipSettings:{visible:!0,labelFormat:"MM/dd/yyyy",tooltipDisplayMode:"always",backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",fontStyle:"Normal",size:"10px",opacity:1,weight:"regular"}},zoomPosition:"0",zoomFactor:"1",selectedRangeSettings:{start:"",end:""},selectedData:"",rangeSettings:{start:"",end:""},border:{width:1,color:null,opacity:1},scrollRangeSettings:{start:"",end:""},enableDeferredUpdate:!0,series:"",seriesSettings:"",labelSettings:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"},horizontalAlignment:"middle"},higherLevel:{intervalType:null,style:{font:{color:"black",fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",opacity:1,fontWeight:"regular"},horizontalAlignment:"middle"},gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"20 5 0"},border:{color:"transparent",width:.5},fill:"transparent",position:"top",visible:!0,labelPlacement:"outside"},lowerLevel:{intervalType:null,style:{font:{color:"black",fontFamily:"Segoe UI",fontStyle:"Normal",size:"12px",opacity:1,fontWeight:"regular"},horizontalAlignment:"middle"},gridLineStyle:{color:"#B5B5B5",width:1,dashArray:""},border:{color:"transparent",width:.5},fill:"transparent",position:"bottom",visible:!0,labelPlacement:"outside"}},navigatorStyleSettings:{selectedRegionColor:"#EFEFEF",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,leftThumbTemplate:null,rightThumbTemplate:null,thumbStroke:"#303030",background:"#dddddd",border:{color:"transparent",width:.5,dashArray:""},opacity:1,selectedRegionOpacity:0,unselectedRegionOpacity:.3,highlightSettings:{enable:!1,opacity:.5,color:"#006fa0",border:{color:"",width:1}},selectionSettings:{enable:!1,opacity:.5,color:"#0e4a7c",border:{color:"",width:1}},majorGridLineStyle:{color:"#B5B5B5",visible:!0},minorGridLineStyle:{color:"#B5B5B5",visible:!0}},loaded:"",load:"",rangeChanged:"",scrollEnd:"",scrollStart:"",scrollChanged:"",selectedRangeStart:"",selectedRangeEnd:""},dataTypes:{enableAutoResizing:"boolean",isResponsive:"boolean",allowSnapping:"boolean",dataSource:"data",tooltipSettings:{visible:"boolean",labelFormat:"string",tooltipDisplayMode:"string"},zoomPosition:"string",zoomFactor:"string",selectedData:"string",enableDeferredUpdate:"boolean",series:"array",labelSettings:{higherLevel:{intervalType:"string",position:"string",visible:"boolean",labelPlacement:"string"},lowerLevel:{intervalType:"string",position:"string",visible:"boolean",labelPlacement:"string"}},navigatorStyleSettings:{thumbRadius:"number"}},observables:["selectedRangeStart","selectedRangeEnd"],_tags:[{tag:"series",attr:["xName","yName","dataSource","enableAnimation",[{tag:"points",attr:["x","y","text","isEmpty","fill","visible"]}]],singular:"series"}],_selectedRangeStart:t.util.valueFunction("selectedRangeStart"),_selectedRangeEnd:t.util.valueFunction("selectedRangeEnd"),_series:function(){this.renderNavigator();this._trigger("refresh")},_series_points:function(){this.renderNavigator();this._trigger("refresh")},_themes:{flatlight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},azurelight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},limelight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#A9CA44 ",thumbColor:"#AECF49",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},saffronlight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#e5e5e5",unselectedRegionColor:"#FAA113",thumbColor:"#F9920B",thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientlight:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientazure:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientlime:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},gradientsaffron:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#bbbbbb",colorStop:"0%"},{color:"#efefef",colorStop:"15%"},{color:"#bbbbbb",colorStop:"85%"},{color:"#efefef",colorStop:"100%"}],unselectedRegionColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#303030",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},flatdark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},material:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1}},lowerLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#f5f5f5",unselectedRegionColor:"#8d8afd",thumbColor:"#8d8afd",thumbRadius:10,thumbStroke:"#000000",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.3,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},office:{tooltipSettings:{backgroundColor:"#303030",font:{color:"#FFFFFF",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#B5B5B5",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#333333",family:"Segoe UI",style:"Normal",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#eaeaea",unselectedRegionColor:"#0078d7",thumbColor:"#0078d7",thumbRadius:10,thumbStroke:"#000000",background:"#EFEFEF",border:{color:"#606262",width:0},opacity:1,unselectedRegionOpacity:.6,selectedRegionOpacity:0,majorGridLineStyle:{color:"#8c8c8c",visible:!0},minorGridLineStyle:{color:"#8c8c8c",visible:!0}}},highcontrast01:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#008000",thumbColor:"#008000",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.6,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},highcontrast02:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#0000ff",thumbColor:"#0000ff",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.6,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},azuredark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#5EABDE",thumbColor:"#2382C3",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},limedark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#A9CA44",thumbColor:"#AECF49",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},saffrondark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:"#353635",unselectedRegionColor:"#FAA113",thumbColor:"#F9920B",thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientdark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientazuredark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbColor:[{color:"#67C1DC",colorStop:"50%"},{color:"#3D93AA",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientlimedark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",fontStyle:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbColor:[{color:"#A5C14A",colorStop:"50%"},{color:"#738B1F",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}},gradientsaffrondark:{tooltipSettings:{backgroundColor:"#FFFFFF",font:{color:"#1E1E1E",family:"Segoe UI",style:"Normal",size:"10px",opacity:1,weight:"regular"}},labelSettings:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},higherLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"},horizontalAlignment:"left"},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"#FFFFFF",width:1,dashArray:"15 5 0"}},lowerLevel:{style:{font:{color:"#FFFFFF",family:"Segoe UI",style:"Regular",size:"13px",opacity:1,weight:"regular"}},border:{color:"transparent",width:0},fill:"transparent",gridLineStyle:{color:"transparent",width:0}}},navigatorStyleSettings:{selectedRegionColor:[{color:"#0a0a0a",colorStop:"0%"},{color:"#282828",colorStop:"15%"},{color:"#282828",colorStop:"85%"},{color:"#0a0a0a",colorStop:"100%"}],unselectedRegionColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbColor:[{color:"#FEB75B",colorStop:"50%"},{color:"#ED7E16",colorStop:"100%"}],thumbRadius:10,thumbStroke:"#FFFFFF",background:"#FFFFFF",opacity:.08,unselectedRegionOpacity:.3,selectedRegionOpacity:0,border:{color:"#FFFFFF",width:0},majorGridLineStyle:{color:"#FFFFFF",visible:!0},minorGridLineStyle:{color:"#FFFFFF",visible:!0}}}},_setModel:function(t){for(var i in t)switch(i){case"theme":this.model._themeChanged=!0;this.model.theme=t[i];this._setTheme(this._themes,this.model.theme);break;case"selectedRangeStart":this.model.selectedRangeSettings.start=this._selectedRangeStart();break;case"selectedRangeEnd":this.model.selectedRangeSettings.end=this._selectedRangeEnd();break;default:n.extend(!0,this.model,{},t[i])}this.bindTo();this.renderNavigator(this);this._bindevents()},_destroy:function(){this.element.empty().removeClass(this.model.cssClass)},_createSvg:function(){this.svgSupport=window.SVGSVGElement?!0:!1;this.vmlRendering=!this.svgSupport;var n=jQuery.uaMatch(navigator.userAgent);this.brow=n.browser.toLowerCase();this.svgSupport?(this.renderer=new t.EjSvgRender(this.element),this.svgns=this.renderer.svgLink,this.svgDocument=this.renderer.svgObj):(this.renderer=new t.EjVmlRender(this.element),this.svgDocument=this.renderer.svgObj)},_setSVGSize:function(){var o=this.model.valueType,t,f=this.model,u=f.sizeSettings,r=parseFloat(f.labelSettings.higherLevel.style.font.size),e;o=="datetime"?(this.minHighHeight=r<20?20:r+2,r=parseFloat(this.model.labelSettings.lowerLevel.style.font.size)):this.minHighHeight=0;this.minLowHeight=r<20?20:r+2;this.scrollbarLoaded=this.model.scrollObj&&this.model.scrollObj[0].scrollbarLoaded?!0:!1;e=this.model.enableScrollbar&&this.scrollbarLoaded&&this.svgSupport?18:0;t=n(this.element).height()?n(this.element).height()>this.newHeight?n(this.element).height()-e:n(this.element).height():this.newHeight==i?o=="datetime"?120:100:this.newHeight;this.minCenterHeight=parseFloat(t)-parseFloat(this.minLowHeight)-parseFloat(this.minHighHeight);t=t<=0?120:t;this.minHeight=t;this.padding=parseFloat(f.padding);this.newWidth=u.width?u.width:n(this.element).width();this.newHeight=u.height?u.height:(n(this.element).height()&&this.newHeight==i)>this.minHeight?n(this.element).height()-e:this.minHeight;this.scrollWidth=this.newWidth-this.padding*2},_setTheme:function(i,r){var u=r.toLowerCase();u.indexOf("high")>=0&&u.indexOf("01")>=0?i[u]=n.extend(!0,{},i.highcontrast01,i[u]):u.indexOf("high")>=0&&u.indexOf("02")>=0?i[u]=n.extend(!0,{},i.highcontrast02,i[u]):u.indexOf("material")>=0?i[u]=n.extend(!0,{},i.material,i[u]):u.indexOf("office")>=0&&(i[u]=n.extend(!0,{},i.office,i[u]));this.model=t.copyObject({},this.model,i[u])},_setPositions:function(){var i=this.model.labelSettings.higherLevel,r=this.model.labelSettings.lowerLevel,n=i.position,t=r.position,u=i.visible,f=r.visible,e=i.labelPlacement,o=r.labelPlacement;n==="top"&&t==="bottom"?(this.centerPosition=this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minHighHeight+this.centerHeight+1):n==="bottom"&&t==="bottom"?(this.centerPosition=0,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minLowHeight+this.centerHeight+1):n==="bottom"&&t==="top"?(this.centerPosition=this.minLowHeight+1,topPosition=0,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minLowHeight+this.centerHeight+1):n==="top"&&t==="top"&&(this.centerPosition=this.minLowHeight+this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.newHeight);u===!1&&f===!1?(this.centerPosition=0,this.centerHeight=this.newHeight,this.bottomPostion=this.newHeight):u===!1?(this.centerPosition=0,this.centerHeight=this.newHeight-this.minLowHeight,this.bottomPosition=this.newHeight):f===!1&&(this.centerPosition=this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight,this.bottomPosition=this.minHighHeight+this.centerHeight+1);e==="outside"&&o==="outside"?(this.sliderPosition=this.centerPosition,this.sliderHeight=this.centerHeight):e==="outside"?(this.sliderPosition=this.centerPosition,this.sliderHeight=this.newHeight):o==="outside"?(this.sliderPosition=0,this.sliderHeight=this.centerHeight+this.minHighHeight):(this.sliderPosition=0,this.sliderHeight=this.newHeight)},redraw:function(){var r=this.model.scrollRangeSettings,u=this.model.rangeSettings,i,f=r.start,e=r.end;this.loadScrollbar=!1;this.model.enableScrollbar&&(this.scrollUpdate=!0,i=this._scrollRange,this.model.valueType.toLowerCase()=="datetime"&&(f=Date.parse(r.start),e=Date.parse(r.end),rangeStart=Date.parse(u.start),rangeEnd=Date.parse(u.end)),(!i||rangeStart<i.min||i.max<rangeEnd||i.min!=f||i.max!=e||t.isNullOrUndefined(this.scrollsvgObj))&&(this.loadScrollbar=!0,this.scrollbarLoaded=!1,n(this.scrollsvgObj).remove()));this.renderNavigator(this)},renderNavigator:function(r){var l,k,w,u,g,nt,tt,it,pt,rt,ut,s,b,ft,et,ot,st,ht,c,ct,lt,at,v,f,e,o,y,h,p;n(this.svgDocument).empty();l=this.model.locale;this.culture=t.preferredCulture(l);this._localizedLabels=this._getLocalizedLabels();this._initializeVariables.call(this,this.model,this.model.series,this.model.seriesSettings);this._rootId=n(this.element).attr("id");this.leftPadding=parseFloat(n("#"+this._rootId).css("padding-left"));this._setSVGSize.call(this);k=this.model.valueType;this._higherTextNode=[];this._higherTotalValues=[];this._higherLineLeft=[];this._higherTextLeft=[];this._lowerTextNode=[];this._lowerTotalValues=[];this._lowerLineLeft=[];this._lowerTextLeft=[];this.labelRegions=[];var d=this.model.labelSettings,wt=d.higherLevel,bt=d.lowerLevel,kt=this.model.valueType;this.centerPosition=0;this.bottomPosition=0;this.centerHeight=0;this.sliderPosition=0;this.sliderHeight=0;this._setPositions();this.svgDocument.setAttribute("style","overflow:visible;position:relative;display:block");this.svgSupport?(this.svgDocument.setAttribute("height",this.newHeight),this.svgDocument.setAttribute("width",this.newWidth)):(n(this.svgDocument).width(this.newWidth),n(this.svgDocument).height(this.newHeight));this.model._size.width=this.newWidth;this.model._size.height=this.newHeight;w=n.extend({},t.EjSvgRender.commonChartEventArgs);w.data={model:this.model};this._trigger("loaded",w);this.model.theme!=""&&this._setTheme(this._themes,this.model.theme);u=this.model.navigatorStyleSettings;g=u.unselectedRegionColor;this.unselectgrad=this.renderer.createGradientElement("unselected",g,150,0,150,100,this.svgDocument);nt=u.background;this.naviback=this.renderer.createGradientElement("naviback",nt,150,0,150,100,this.svgDocument);tt=u.selectedRegionColor;this.selectedgrad=this.renderer.createGradientElement("selected",tt,150,0,150,100,this.svgDocument);it=u.thumbColor;this.tbClr=this.renderer.createGradientElement("thumbClr",it,150,0,150,100,this.svgDocument);var a=this.model.border,vt=a.color?a.color:this.model.enableScrollbar?"#B4B4B4":"transparent",yt={id:this._rootId+"_Layout",x:this.padding,width:this.newWidth>0?this.newWidth-this.padding*2:0,height:this.newHeight,fill:"transparent","stroke-width":a.width,stroke:vt,opacity:a.opacity};this.renderer.drawRect(yt,this.svgDocument);pt=k=="numeric"?this.newHeight-u.border.width-this.minLowHeight:this.newHeight-u.border.width-this.minLowHeight-this.minHighHeight;rt={id:this._rootId+"_Border",x:this.padding,y:this.sliderPosition,width:this.newWidth>0?this.newWidth-this.padding*2:0,height:this.sliderHeight,fill:this.naviback,"stroke-width":u.border.width,stroke:u.border.color,opacity:u.opacity,"stroke-dasharray":u.border.dashArray};this.renderer.drawRect(rt,this.svgDocument);n("#"+this._rootId+"higherLevel").length==0&&(this.higherLevel=this.renderer.createGroup({id:this._rootId+"higherLevel"}));n("#"+this._rootId+"lowerLevel").length==0&&(this.lowerLevel=this.renderer.createGroup({id:this._rootId+"lowerLevel"}));this.centerLevel=this.renderer.createGroup({id:this._rootId+"centerLelvel"});this.higherLevel.height=this.minHighHeight;this.lowerLevel.height=this.minLowHeight;this.model.tooltipSettings.visible&&this.svgSupport&&(this.leftTooltip=this.renderer.createGroup({id:this._rootId+"leftTooltip"}),this.rightTooltip=this.renderer.createGroup({id:this._rootId+"rightTooltip"}),ut={fill:this.model.tooltipSettings.backgroundColor,d:"M 0 0 L 0 21 L 64 21 L 64 6 L 70 0 Z"},this.renderer.drawPath(ut,this.leftTooltip),s=this.model.tooltipSettings.font,b={id:this._rootId+"_LeftToolText",x:5,fill:s.color,"font-size":s.size,"font-family":s.family,"font-style":s.style,"font-weight":s.weight,"text-anchor":"start",opacity:s.opacity,"dominant-baseline":"middle"},this.renderer.drawText(b,t.format(new Date(1/2e3),"MMMM, yyyy",l),this.leftTooltip),this.leftTxt=this.leftTooltip.childNodes[1],ft={fill:this.model.tooltipSettings.backgroundColor,d:"M 0 0 L 70 0 L 70 21 L 6 21 L 6 6 Z","horizontal-alignment":"stretch"},this.renderer.drawPath(ft,this.rightTooltip),this.renderer.drawText(b,t.format(new Date(1/2e3),"MMMM, yyyy",l),this.rightTooltip),this.rightTxt=this.rightTooltip.childNodes[1]);this.chartGView=this.renderer.createGroup({id:this._rootId+"charView"});this.renderer.append(this.chartGView,this.svgDocument);(this.model.navigatorStyleSettings.highlightSettings.enable||this.model.navigatorStyleSettings.selectionSettings.enable)&&(this.styleRect=this.renderer.createGroup({id:this._rootId+"highlightRect"}),this.renderer.append(this.styleRect,this.svgDocument));this.model.valueType=="datetime"&&this.renderer.append(this.higherLevel,this.svgDocument);this.renderer.append(this.lowerLevel,this.svgDocument);this.renderer.append(this.centerLevel,this.svgDocument);this.leftUnSelected=this.renderer.createGroup({id:"unselectleft"});this.gLeftSlider=this.renderer.createGroup({id:"leftslider"});this.gRightSlider=this.renderer.createGroup({id:"rightslider"});this.gCenterSlider=this.renderer.createGroup({id:"centerslider"});this.rightUnSelected=this.renderer.createGroup({id:"unselectright"});et={width:this.newWidth>0?this.newWidth-this.padding*2:0,height:this.sliderHeight,fill:this.unselectgrad,opacity:u.unselectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"};this.renderer.drawRect(et,this.leftUnSelected);this.leftUnArea=this.leftUnSelected.firstChild;this.renderer.append(this.leftUnSelected,this.svgDocument);ot={width:this.newWidth>0?this.newWidth-4-this.padding*2:0,height:this.sliderHeight,fill:this.selectedgrad,opacity:u.selectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"};this.renderer.drawRect(ot,this.gCenterSlider);this.centerSlider=this.gCenterSlider.firstChild;n(this.centerSlider).css("cursor","pointer");this.renderer.append(this.gCenterSlider,this.svgDocument);st={width:"2",height:this.sliderHeight,fill:u.thumbStroke,opacity:"1",y:this.sliderPosition,transform:"translate("+this.padding+")"};ht={id:"leftCircle"+this._id,cx:this.padding,cy:this.sliderPosition+this.sliderHeight/2,r:u.thumbRadius,"stroke-width":2,stroke:u.thumbStroke,fill:this.tbClr};this.renderer.drawRect(st,this.gLeftSlider);this.model.navigatorStyleSettings.leftThumbTemplate==null?(this.renderer.drawCircle(ht,this.gLeftSlider),this.leftCircle=this.gLeftSlider.lastChild,n(this.leftCircle).css("cursor","pointer")):(v=document.getElementById(this.model.navigatorStyleSettings.leftThumbTemplate)?!0:!1,n("#"+this._id+"thumbleft").length>0&&n("#"+this._id+"thumbleft").remove(),f=this._id,n("#"+f).css("transform")=="none"&&n("#"+f).css("transform","translate(0, 0)"),n("#"+f+"template_group_").length!=0?e=n("#"+f+"template_group_"):(e=n("<div><\/div>").attr("id",f+"template_group_"),n(e).css("position","relative")),o=n("<div><\/div>").attr("id",this._id+"thumbleft"),y=v==!0?n("#"+this.model.navigatorStyleSettings.leftThumbTemplate)[0].innerHTML:this.model.navigatorStyleSettings.leftThumbTemplate,h=n(y),n(o).css("position","absolute"),h.appendTo(n(o)),n(o).appendTo(e),this.svgSupport?n(e).appendTo("#"+f):n(e).appendTo(this.svgDocument),p=this.sliderPosition+this.sliderHeight/2-h.height()/2,n(o).css("top",p).css("cursor","pointer").css("z-index","1"));this.leftSlider=this.gLeftSlider.firstChild;n(this.leftSlider).css("cursor","w-resize");this.renderer.append(this.gLeftSlider,this.svgDocument);c=parseFloat(this.newWidth-this.padding*2);c=c<0?0:c;ct={width:c,height:this.sliderHeight,fill:this.unselectgrad,opacity:u.unselectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"};this.renderer.drawRect(ct,this.rightUnSelected);this.rightUnArea=this.rightUnSelected.firstChild;this.renderer.append(this.rightUnSelected,this.svgDocument);lt={width:"2",height:this.sliderHeight,fill:this.model.navigatorStyleSettings.thumbStroke,opacity:"1",transform:"translate("+parseFloat(this.newWidth-4-this.padding)+", "+this.sliderPosition+" )"};at={id:"rightCircle"+this._id,cx:this.newWidth-4-this.padding,cy:this.sliderPosition+this.sliderHeight/2,r:this.model.navigatorStyleSettings.thumbRadius,"stroke-width":2,stroke:this.model.navigatorStyleSettings.thumbStroke,fill:this.tbClr};this.renderer.drawRect(lt,this.gRightSlider);this.model.navigatorStyleSettings.rightThumbTemplate==null?(this.renderer.drawCircle(at,this.gRightSlider),this.rightCircle=this.gRightSlider.lastChild,n(this.rightCircle).css("cursor","pointer")):(v=document.getElementById(this.model.navigatorStyleSettings.rightThumbTemplate)?!0:!1,n("#"+this._id+"thumbright").length>0&&n("#"+this._id+"thumbright").remove(),f=this._id,n("#"+f+"template_group_").length!=0?e=n("#"+f+"template_group_"):(e=n("<div><\/div>").attr("id",f+"template_group_"),n(e).css("position","absolute")),o=n("<div><\/div>").attr("id",this._id+"thumbright"),y=v==!0?n("#"+this.model.navigatorStyleSettings.rightThumbTemplate)[0].innerHTML:this.model.navigatorStyleSettings.rightThumbTemplate,h=n(y),n(o).css("position","absolute"),h.appendTo(n(o)),n(o).appendTo(e),this.svgSupport?n(e).appendTo("#"+f):n(e).appendTo(this.svgDocument),p=this.sliderPosition+this.sliderHeight/2-h.height()/2,n(o).css("top",p).css("cursor","pointer").css("z-index","1"));this.rightSlider=this.gRightSlider.firstChild;n(this.rightSlider).css("cursor","w-resize");this.renderer.append(this.gRightSlider,this.svgDocument);this.model.tooltipSettings.visible&&this.svgSupport&&(this.renderer.append(this.leftTooltip,this.svgDocument),this.renderer.append(this.rightTooltip,this.svgDocument));this.element.append(this.svgDocument);this.svgSupport&&(this.trueCoords=this.svgDocument.createSVGPoint(),this.grabPoint=this.svgDocument.createSVGPoint());this.backDrop=this.element;this.dragTarget=null;this.sliderHeight>0&&this._renderChart.call(this,this.model);r!=i&&r.target!=i&&(this.resize=!0);this.startDateTime!=i&&this.endDateTime!=i||this.startValue!=i&&this.endValue!=i?(this.calculateInterval.call(this,this.model.labelSettings.higherLevel,this.model.labelSettings.lowerLevel),this.setSliders()):(this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+this.padding+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.leftTooltip.setAttribute("opacity",0),this.rightTooltip.setAttribute("opacity",0));this.model.tooltipSettings.visible&&this.svgSupport&&this.model.tooltipSettings.tooltipDisplayMode=="ondemand"&&(this.rightTooltip.setAttribute("opacity",0),this.leftTooltip.setAttribute("opacity",0));this._scrollChanged=this._scrollChanged?!1:this._scrollChanged;this.model.enableScrollbar?(this.loadScrollbar&&!this.scrollbarUpdate||this.model.scrollObj&&this.model.scrollObj[0].width!=this.scrollWidth?(this.model.scrollObj[0].width=this.scrollWidth,this.scrollbarContainer=new t.EjSvgScrollbarRender(this.element,this.model.scrollObj[0]),this.scrollbarContainer._initializeScrollbarVariables.call(this,this.model.scrollObj[0]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[0])):this.renderer.append(this.scrollsvgObj,this.element),this._bindevents()):(n(this.scrollsvgObj).remove(),this.scrollsvgObj=null,this.scrollZoomPos=null,this.scrollZoomFact=null)},eachInterval:"",_renderChart:function(t){var e=t.valueType.toLowerCase(),u,f=t.rangeSettings,r,o;(t.enableScrollbar||f.start!=""&&f.end!="")&&(u=e=="datetime"?{min:this.startDateTime,max:this.endDateTime}:{min:this.startValue,max:this.endValue});t.dataSource!=""&&t.series==""&&t.seriesSettings==""?n(this.chartGView).ejChart({locale:this.model.locale,border:{width:0,color:"transparent"},margin:{left:0,right:0,top:0,bottom:0},elementSpacing:0,chartArea:{background:"transparent",border:{width:0}},primaryXAxis:{axisLine:{visible:!1},font:{size:"0px"},range:u,majorTickLines:{lineWidth:0,size:0,visible:!0},majorGridLines:{visible:!1},rangePadding:this.model.rangePadding,visible:!1,isInversed:this.model.enableRTL},primaryYAxis:this.model.valueAxisSettings,series:[{dataSource:t.dataSource,xName:t.xName,yName:t.yName,type:"line",width:1.5,enableAnimation:!1},],size:{height:parseFloat(this.sliderHeight).toString(),width:parseFloat(this.newWidth-2*this.padding).toString(),padding:-10},legend:{visible:!1,itemSize:{height:0,width:0,borderColor:"transparent",borderWidth:0}}}):t.dataSource!=""&&t.series!=""&&t.series[0].dataSource==i||t.seriesSettings!=""&&t.seriesSettings.dataSource==i&&t.dataSource!=""?(t.seriesSettings.dataSource=t.dataSource,t.seriesSettings.xName=t.seriesSettings.xName?t.seriesSettings.xName:t.xName,t.seriesSettings.yName=t.seriesSettings.yName?t.seriesSettings.yName:t.yName,r=t.series,r==""&&(r=[{dataSource:t.dataSource,xName:t.seriesSettings.xName,yName:t.seriesSettings.yName,type:"line",width:1.5,enableAnimation:!1}]),n(this.chartGView).ejChart({locale:this.model.locale,border:{width:0,color:"transparent"},margin:{left:0,right:0,top:0,bottom:0},elementSpacing:0,chartArea:{background:"transparent",border:{width:0}},primaryXAxis:{axisLine:{visible:!1},font:{size:"0px"},range:u,majorTickLines:{lineWidth:0,size:0,visible:!0},majorGridLines:{visible:!1},rangePadding:this.model.rangePadding,visible:!1,isInversed:this.model.enableRTL},primaryYAxis:this.model.valueAxisSettings,series:r,commonSeriesOptions:t.seriesSettings,size:{height:parseFloat(this.sliderHeight).toString(),width:parseFloat(this.newWidth-2*this.padding).toString(),padding:-10},legend:{visible:!1,itemSize:{height:0,width:0,borderColor:"transparent",borderWidth:0}}})):(t.series!=""&&t.series[0].dataSource!=i||t.seriesSettings!=""&&t.seriesSettings.dataSource!=i)&&(t.seriesSettings==""&&(t.seriesSettings={type:"line"}),r=t.series,o=r.length,r==""&&(r=[{dataSource:t.seriesSettings.dataSource,xName:t.seriesSettings.xName,yName:t.seriesSettings.yName,type:"line",width:1.5,enableAnimation:!1}]),n(this.chartGView).ejChart({locale:this.model.locale,border:{width:0,color:"transparent"},margin:{left:0,right:0,top:0,bottom:0},elementSpacing:0,chartArea:{background:"transparent",border:{width:0}},primaryXAxis:{axisLine:{visible:!1},range:u,font:{size:"0px"},majorTickLines:{lineWidth:0,size:0,visible:!0},majorGridLines:{visible:!1},rangePadding:this.model.rangePadding,visible:!1,isInversed:this.model.enableRTL},primaryYAxis:this.model.valueAxisSettings,series:r,commonSeriesOptions:t.seriesSettings,size:{height:parseFloat(this.sliderHeight).toString(),width:parseFloat(this.newWidth-2*this.padding).toString(),padding:-10},legend:{visible:!1,itemSize:{height:0,width:0,borderColor:"transparent",borderWidth:0}}}));this.ejChart=n(this.chartGView).data("ejChart");this.renderer._setAttr(n(this.chartGView),{transform:"translate("+this.padding+","+this.sliderPosition+")",height:this.sliderHeight})},_init:function(){var r,u,i;this._createSvg(this);r=n.extend({},t.EjSvgRender.commonChartEventArgs);r.data={model:this.model};this._trigger("load",r);u=this.model.scrollRangeSettings;this.renderNavigator(this);this.model.enableScrollbar&&(this.model.scrollObj=[],i=this.model.scrollObj,i[0]={orientation:"horizontal",index:0,width:this.scrollWidth,x:0,y:this.newHeight,isRTL:this.model.enableRTL,zoomPosition:this.scrollZoomPos,zoomFactor:this.scrollZoomFact,scrollRange:this._scrollRange,valueType:this.model.valueType,parent:this.element,enableResize:!0},i[0].valueType=="datetime"?(i[0].startDateTime=this.startDateTime,i[0].endDateTime=this.endDateTime):(i[0].startValue=this.startValue,i[0].endValue=this.endValue),this.scrollbarContainer=new t.EjSvgScrollbarRender(this.element,this.model.scrollObj[0]),this.scrollbarContainer._initializeScrollbarVariables.call(this,this.model.scrollObj[0]),this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[0]));this.model.enableAutoResizing||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents();this._bindevents()},bindResizeEvents:function(){if(this.model._rangeResizeEventRegistered)return 0;(!this.model.enableScrollbar||this.model.enableScrollbar&&this.svgSupport)&&this._on(n(window),"resize",this.rangeChange);this.model._rangeResizeEventRegistered=!0},removeResizeEvents:function(){this.model._rangeResizeEventRegistered&&(this._off(n(window),"resize",this.rangeChange),this.model._rangeResizeEventRegistered=!1)},rangeChange:function(){var n,i=this;this.rangeResize=!0;clearTimeout(n);t.isNullOrUndefined(window.orientation)?this.renderNavigator():n=setTimeout(function(){i.renderNavigator()},500);this.model.enableScrollbar&&(this.model.scrollObj[0].width=this.scrollWidth,this.scrollbarContainer._renderScrollbar.call(this,this.model.scrollObj[0]))},isDevice:function(){return/mobile|android|kindle/i.test(navigator.userAgent.toLowerCase())},isWindows:function(){if(!t.getBooleanVal(n("head"),"data-ej-android")&&!t.getBooleanVal(n("head"),"data-ej-ios")&&!t.getBooleanVal(n("head"),"data-ej-ios7")&&!t.getBooleanVal(n("head"),"data-ej-flat"))return this._windows()},_windows:function(){return/trident|windows phone/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-windows",!1)===!0},_bindevents:function(){var h=jQuery.uaMatch(navigator.userAgent),u=t.EjSvgRender.utils.browserInfo(),i=u.isMSPointerEnabled,r=u.pointerEnabled,e=i?r?"pointerdown":"MSPointerDown":"touchstart mousedown",f=i?r?"pointerup":"MSPointerUp":"touchend mouseup",o=i?r?"pointermove":"MSPointerMove":"touchmove mousemove",s=i?r?"pointerleave":"MSPointerOut":"touchleave mouseleave";this.model.browserInfo=u;this._on(this.element,o,this._drag);this._on(this.element,s,this._leave);this._on(n(document),f,this._drop);this._on(n(this.element),e,this._grab);this._on(n(this.element),"contextmenu",this._rightClick);this._on(n("#"+this._id+"template_group_"),e,this._grab);this._on(n("#"+this._id+"template_group_"),o,this._drag);this._on(n("#"+this._id+"template_group_"),f,this._drop);this._on(n(window),f,this.mouseup);n(this.element).css("touch-action","none")},_initializeVariables:function(n,t,r){var f,u,o,s,v,h,c;this.ismouseup=!1;var e=this.model.rangeSettings,a=this.model.labelSettings.style,l=this.model.labelSettings.lowerLevel.style,y=this.model.labelSettings.higherLevel.style,p=this.model.scrollRangeSettings;if(y==""&&(this.model.labelSettings.higherLevel.style=a),l==""?this.model.labelSettings.lowerLevel.style=a:l!=i&&l.horizontalAlignment==i&&(this.model.labelSettings.lowerLevel.style.horizontalAlignment="middle"),this.model.valueType=="numeric"&&this.model.tooltipSettings.labelFormat=="MM/dd/yyyy"&&(this.model.tooltipSettings.labelFormat="d"),n.dataSource!=""&&n.xName!=""&&n.yName!="")if(f=t.length,f>0)for(u=0;u<f;u++)t[u].dataSource=n.dataSource,t[u].type=t[u].type?t[u].type:r.type?n.type:"line",t[u].xName=t[u].xName?t[u].xName:n.xName,t[u].yName=t[u].yName?t[u].yName:n.yName,this._processJsonData(t[u].dataSource,t[u]);else this._processJsonData(n.dataSource,this.model);else if(t!=""&&t!=i&&t[0].dataSource!=i&&t[0].xName!=i&&t[0].yName!=i)this._processJsonData(t[0].dataSource,t[0]);else if(r.dataSource!=i)if(f=t.length,f>0)for(u=0;u<f;u++)t[u].dataSource=r.dataSource,t[u].type=t[u].type?t[u].type:r.type?r.type:"line",t[u].xName=t[u].xName?t[u].xName:r.xName,t[u].yName=t[u].yName?t[u].yName:r.yName,this._processJsonData(t[u].dataSource,t[u]);else this._processJsonData(r.dataSource,r);else e.start!=""&&e.end!=""&&(o=startDateTime=e.start,s=endDateTime=e.end,this.model.enableScrollbar?(v=[o,s,new Date(o),new Date(s)],this.calculateZoomingRange.apply(this,v)):this.setRange.call(this,o,s,startDateTime,endDateTime));this.startDateTime!=i&&this.endDateTime!=i&&(this.model.valueType=="datetime"&&this.model.rangePadding=="round"&&(h=new Date(this.startValue),c=new Date(this.endValue),this.startDateTime=new Date(h.getFullYear(),h.getMonth(),h.getDate(),0,0,0),this.endDateTime=new Date(c.getFullYear(),c.getMonth(),c.getDate(),23,59,59)),this.startYear=this.startDateTime.getFullYear(),this.startMonth=this.startDateTime.getMonth(),this.endYear=this.endDateTime.getFullYear(),this.endMonth=this.endDateTime.getMonth())},setSliders:function(){var c=this.newWidth-this.padding*2,f=this.model.valueType,i=this.model.selectedRangeSettings.start,t=this.model.selectedRangeSettings.end,r=this.padding,e=this.startDateTime.getTime(),h=this.endDateTime.getTime(),u,o=this.startValue,s=this.endValue;this.eachInterval=f=="datetime"?c/parseFloat(h-e):c/parseFloat(s-o);u=this.eachInterval;this.model.enableScrollbar||(f=="datetime"?((i==""||new Date(i).getTime()<e)&&(i=this.startDateTime),(t==""||new Date(t).getTime()>h||new Date(t).getTime()<e)&&(t=this.endDateTime)):((i==""||i<o)&&(i=o),(t==""||t>s)&&(t=s)));this.model.enableRTL?f=="datetime"?(this.leftSliderPosition=(h-new Date(t).getTime())*u+r,this.rightSliderPosition=(h-new Date(i).getTime())*u+r,i=new Date(i),t=new Date(t)):(this.leftSliderPosition=(s-t)*u+r,this.rightSliderPosition=(s-i)*u+r):f=="datetime"?(this.leftSliderPosition=(new Date(i).getTime()-e)*u+r,this.rightSliderPosition=(new Date(t).getTime()-e)*u+r,i=new Date(i),t=new Date(t)):(this.leftSliderPosition=(i-o)*u+r,this.rightSliderPosition=(t-o)*u+r);this.setopacity=this.model.tooltipSettings.tooltipDisplayMode=="always"?1:0;this.model.enableScrollbar?this.leftSliderPosition>=r&&this.leftSliderPosition<this.newWidth-r?this.setSliderPositions(this.leftSliderPosition,null,null):this.leftSliderPosition>this.newWidth?(n(this.leftTooltip).hide(),n(this.gLeftSlider).hide()):(n(this.leftTooltip).hide(),n(this.gLeftSlider).hide(),n(this.leftUnSelected).hide()):this.setSliderPositions(this.leftSliderPosition,null,null);this.model.enableScrollbar?this.rightSliderPosition<=this.newWidth-r&&this.rightSliderPosition>r?this.setSliderPositions(null,null,this.rightSliderPosition):this.rightSliderPosition<0?(n(this.rightTooltip).hide(),n(this.gRightSlider).hide()):(n(this.rightTooltip).hide(),n(this.gRightSlider).hide(),n(this.rightUnSelected).hide()):this.setSliderPositions(null,null,this.rightSliderPosition);this.setopacity=1;this.model.enableDeferredUpdate&&(this._calculateSelectedData(),this._calculateSliderZoomFactPosition(),this._scrollChanged||(f=="datetime"?this.startDateTime.getTime()===i.getTime()&&(this.endDateTime.getTime()===t.getTime()||this.rangeResize)||this._trigger("rangeChanged",this.model):this.startValue===i&&(this.endValue===t||this.rangeResize)||this._trigger("rangeChanged",this.model)),this.rangeResize=!1)},centerSliderWidth:"",zoomp:0,zoomf:1,setSliderPositions:function(r,u,f){var w=this.model.locale,a=this.model.valueType,c,rt=this.model.labelSettings.higherLevel.labelPlacement,b,k,it,o,h,e,s;c=rt=="inside"?0:this.centerPosition;var v,p,tt=20,y=this.model.tooltipSettings.labelFormat;if(a=="numeric"&&(y.indexOf("e")==0||y.indexOf("E")==0)&&(p=y.match(/(\d+)/g),p=p==null?6:p>tt?tt:p),r!=null&&r>=this.padding&&r<this.newWidth-this.padding){if(this.leftSliderPosition=r,v=this.model.enableRTL?this.newWidth-r:r,o=a=="datetime"?v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval:v/this.eachInterval+this.startValue-this.padding/this.eachInterval,this.model.tooltipSettings.visible&&this.svgSupport&&this.leftTxt){this.leftTooltip.setAttribute("opacity",this.setopacity);this.leftTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w);var d=t.EjSvgRender.utils._measureText(this.leftTxt.textContent,null,this.model.tooltipSettings.font),e=d.width+15,s=d.height,g=this.brow!="msie"?(s+6)/2:s/2+6;this.leftTxt.setAttribute("y",g);this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z";this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z";r-e>=0?(this.leftTooltip.firstChild.setAttribute("d",this.leftd),this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+(r-e)+","+c+")"}),this.leftTxt.setAttribute("x",5)):r+e<this.rightTooltip.getCTM().e?(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+r+","+c+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd),this.leftTxt.setAttribute("x",10)):this.rightTooltip.getCTM().f<30?(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+r+","+(c+30)+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd)):(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+r+","+c+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd));r>this.newWidth-this.rightTooltip.lastChild.getBBox().width-15&&this.rightTooltip.getCTM().f<30&&this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+(r-e)+","+(c+30)+")"});this.rightTooltip.getCTM().f>=30&&r<this.rightTooltip.getCTM().e&&this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+this.rightTooltip.getCTM().e+","+c+")"})}this.ismouseup==!1?(this.renderer._setAttr(n(this.leftUnArea),{width:r-this.padding,transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+","+this.sliderPosition+")"}),this.leftCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.leftCircle),{cx:r}):this.renderer._setAttr(n(this.leftCircle),{transform:"translate("+parseFloat(r-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._leftValue={left:r-this.model.navigatorStyleSettings.thumbRadius,right:r+this.model.navigatorStyleSettings.thumbRadius}):(h=r-n("#"+this._id+"thumbleft").width()/2,n("#"+this._id+"thumbleft").css("left",h),this._leftValue={left:h,right:h+n("#"+this._id+"thumbleft").width()}),this.renderer._setAttr(n(this.centerSlider),{transform:"translate("+parseFloat(r)+","+this.sliderPosition+")"}),b=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left),b>0&&this.renderer._setAttr(n(this.centerSlider),{width:b})):(this.ismouseup=!1,this.renderer._setAttr(n(this.leftUnArea),{width:r-this.padding,transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+r+","+this.sliderPosition+")"}),this.leftCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.leftCircle),{cx:r}):this.renderer._setAttr(n(this.leftCircle),{transform:"translate("+parseFloat(r-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._leftValue={left:r-this.model.navigatorStyleSettings.thumbRadius,right:r+this.model.navigatorStyleSettings.thumbRadius}):(h=r-n("#"+this._id+"thumbleft").width()/2,n("#"+this._id+"thumbleft").css("left",h),this._leftValue={left:h,right:h+n("#"+this._id+"thumbleft").width()}),this.renderer._setAttr(n(this.centerSlider),{transform:"translate("+parseFloat(r)+","+this.sliderPosition+")"}),b=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left),b>0&&this.renderer._setAttr(n(this.centerSlider),{width:b}));this.model.zoomPosition=(r-this.padding)/(this.newWidth-this.padding*2);this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(n(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-this.padding*2);this.model.enableRTL?this.model.selectedRangeSettings.end=a=="datetime"?new Date(o):o:this.model.selectedRangeSettings.start=a=="datetime"?new Date(o):o;n(this.leftTooltip).show();n(this.gLeftSlider).show();n(this.leftUnSelected).show()}else if(f!=null&&f>this.padding){if(f>this.newWidth-this.padding+1&&(f=this.newWidth-this.padding),this.rightSliderPosition=f,it=new Date(this.model.rangeSettings.start),v=this.model.enableRTL?this.newWidth-f:f,o=v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,o=a=="datetime"?new Date(o):v/this.eachInterval+this.startValue-this.padding/this.eachInterval,this.model.enableRTL?this.model.selectedRangeSettings.start=o:this.model.selectedRangeSettings.end=o,this.model.tooltipSettings.visible&&this.svgSupport&&this.rightTxt){this.rightTooltip.setAttribute("opacity",this.setopacity);this.rightTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w);var d=t.EjSvgRender.utils._measureText(this.rightTxt.textContent,null,this.model.tooltipSettings.font),e=d.width+15,s=d.height,g=this.brow!="msie"?(s+6)/2:s/2+6;this.rightTxt.setAttribute("y",g);this.rightTxt.setAttribute("x",10);this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z";this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z";f+e<=this.newWidth?(this.rightTooltip.firstChild.setAttribute("d",this.rightd),this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+f+","+c+")"})):f+e>=this.newWidth&&f-e>this.centerSlider.getCTM().e?(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(f-e)+","+c+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd),this.rightTxt.setAttribute("x",5)):this.leftTooltip.getCTM().f<30?(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(f-e)+","+(c+30)+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd)):(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(f-e)+","+c+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd));f<this.leftTooltip.getCTM().e+e&&this.leftTooltip.getCTM().f<30&&this.leftSliderPosition>=this.padding&&this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+f+","+(c+30)+")"});this.leftTooltip.getCTM().f>=30&&f>this.leftTooltip.getCTM().e+e&&this.rightTooltip.getCTM().e>this.leftTooltip.getCTM().e+e&&(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+this.leftTooltip.getCTM().e+","+c+")"}),this.rightTxt.setAttribute("x",5))}k=this.newWidth-f-this.padding-2;k=k<0?0:k;this.renderer._setAttr(n(this.rightUnArea),{width:k,transform:"translate("+parseFloat(f+2)+","+this.sliderPosition+")"});this.renderer._setAttr(n(this.rightSlider),{transform:"translate("+f+","+this.sliderPosition+")"});this.rightCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.rightCircle),{cx:f}):this.renderer._setAttr(n(this.rightCircle),{transform:"translate("+parseFloat(f-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._rightValue={left:f-this.model.navigatorStyleSettings.thumbRadius,right:f+this.model.navigatorStyleSettings.thumbRadius}):(h=f-n("#"+this._id+"thumbright").width()/2,n("#"+this._id+"thumbright").css("left",h),this._rightValue={left:h,right:h+n("#"+this._id+"thumbright").width()});this.centerSliderWidth=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left);this.renderer._setAttr(n(this.centerSlider),{width:Math.abs(this.centerSliderWidth)});this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(n(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-this.padding*2);n(this.rightTooltip).show();n(this.gRightSlider).show();n(this.rightUnSelected).show()}else if(u!=null){var ut=this.renderer._getAttrVal(n(this.leftSlider),"width"),nt=this.newWidth-this.padding-2,l=u+parseFloat(this.renderer._getAttrVal(n(this.centerSlider),"width"));if(l>nt?(leftPosX=u=nt-parseFloat(this.renderer._getAttrVal(n(this.centerSlider),"width")),l=nt):leftPosX=u,it=new Date(this.model.rangeSettings.start),v=this.model.enableRTL?this.newWidth-leftPosX:leftPosX,leftPosX>=this.padding&&l<=this.newWidth-this.padding-2){if(o=v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,a=="datetime"&&(o=new Date(o)),this.model.enableRTL?this.model.selectedRangeSettings.end=o:this.model.selectedRangeSettings.start=o,this.svgSupport?this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+leftPosX+",0)"}):this.renderer._setAttr(n(this.leftSlider),{transform:"translate("+leftPosX+","+parseFloat(this.sliderPosition)+")"}),this.leftSliderPosition=leftPosX,this.leftCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.leftCircle),{cx:leftPosX}):this.renderer._setAttr(n(this.leftCircle),{transform:"translate("+parseFloat(leftPosX-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._leftValue={left:leftPosX-this.model.navigatorStyleSettings.thumbRadius,right:leftPosX+this.model.navigatorStyleSettings.thumbRadius}):(h=leftPosX-n("#"+this._id+"thumbleft").width()/2,n("#"+this._id+"thumbleft").css("left",h),this._leftValue={left:h,right:h+n("#"+this._id+"thumbleft").width()}),this.model.tooltipSettings.visible&&this.svgSupport&&this.leftTxt){this.leftTooltip.setAttribute("opacity",this.setopacity);this.leftTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w);var e=this.leftTooltip.lastChild.getBBox().width+15,s=this.leftTooltip.lastChild.getBBox().height,g=this.brow!="msie"?(s+6)/2:s/2+6;this.leftTxt.setAttribute("y",g);this.rightTxt.setAttribute("y",g);this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z";this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z";leftPosX-e>=0?(this.leftTooltip.firstChild.setAttribute("d",this.leftd),this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+(leftPosX-e)+","+c+")"}),this.leftTxt.setAttribute("x",5)):(this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+leftPosX+","+c+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd),this.leftTxt.setAttribute("x",10),this.leftSliderPosition+e>this.rightSlider.getCTM().e&&this.renderer._setAttr(n(this.leftTooltip),{transform:"translate("+leftPosX+","+(c+30)+")"}))}v=this.model.enableRTL?this.newWidth-l:l;o=v/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval;o=a=="datetime"?new Date(o):v/this.eachInterval+this.startValue-this.padding/this.eachInterval;this.model.enableRTL?this.model.selectedRangeSettings.start=o:this.model.selectedRangeSettings.end=o;this.renderer._setAttr(n(this.rightSlider),{transform:"translate("+l+","+this.sliderPosition+")"});this.rightSliderPosition=l;this.rightCircle!=i?(this.svgSupport?this.renderer._setAttr(n(this.rightCircle),{cx:l}):this.renderer._setAttr(n(this.rightCircle),{transform:"translate("+parseFloat(l-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}),this._rightValue={left:l-this.model.navigatorStyleSettings.thumbRadius,right:l+this.model.navigatorStyleSettings.thumbRadius}):(h=l-n("#"+this._id+"thumbright").width()/2,n("#"+this._id+"thumbright").css("left",h),this._rightValue={left:h,right:h+n("#"+this._id+"thumbright").width()});this.model.tooltipSettings.visible&&this.svgSupport&&(this.rightTooltip.setAttribute("opacity",this.setopacity),this.rightTxt.textContent=a=="datetime"?t.format(new Date(o),this.model.tooltipSettings.labelFormat,w):y.indexOf("e")==0||y.indexOf("E")==0?o.toExponential(p):t.format(o,this.model.tooltipSettings.labelFormat,w),e=this.rightTooltip.lastChild.getBBox().width+15,s=this.rightTooltip.lastChild.getBBox().height,this.leftd="M 0 0 L 0 "+(s+6)+" L "+(e-6)+" "+(s+6)+" L "+(e-6)+" 6 L "+e+" 0 Z",this.rightd="M 0 0 L "+e+" 0 L "+e+" "+(s+6)+" L 6 "+(s+6)+" L 6 6 Z",l+e<=this.newWidth?(this.rightTooltip.firstChild.setAttribute("d",this.rightd),this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+l+","+c+")"}),this.rightTxt.setAttribute("x",10)):(this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(l-e)+","+c+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd),this.rightTxt.setAttribute("x",5),this.rightTooltip.getBoundingClientRect().left<this.leftSlider.getBoundingClientRect().left&&this.renderer._setAttr(n(this.rightTooltip),{transform:"translate("+(l-e)+","+(c+30)+")"})));this.renderer._setAttr(n(this.leftUnArea),{width:leftPosX-this.padding,transform:"translate("+this.padding+","+this.sliderPosition+")"});this.renderer._setAttr(n(this.rightUnArea),{transform:"translate("+parseFloat(l+2)+","+this.sliderPosition+")",width:this.newWidth-l-this.padding-2});this.model.zoomPosition=(this.leftSlider.getBoundingClientRect().left-this.padding)/(this.newWidth-this.padding*2);this.renderer._setAttr(n(this.centerSlider),{transform:"translate("+u+","+this.sliderPosition+")"});this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(n(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-this.padding*2);n(this.leftTooltip).show();n(this.rightTooltip).show()}}this._scrollChanged||this.isSelection||!this.model.enableDeferredUpdate&&this.leftSlider.getBoundingClientRect().left<this.rightSlider.getBoundingClientRect().left&&(this._calculateSelectedData(),(this.zoomp!=this.model.zoomPosition||this.zoomf!=this.model.zoomFactor)&&(this._calculateSliderZoomFactPosition(),this._trigger("rangeChanged",this.model),this.zoomp=this.model.zoomPosition,this.zoomf=this.model.zoomFactor))},_calculateSliderZoomFactPosition:function(){var f=this.model,r,e,o,n,t,u=f.selectedRangeSettings,i=f.scrollRangeSettings;f.valueType.toLowerCase()=="datetime"?(n=i.start?new Date(i.start):this.startDateTime,n=n<this.startDateTime?n:this.startDateTime,t=i.end?new Date(i.end):this.endDateTime,t=t>this.endDateTime?t:this.endDateTime,r=t-n,e=(new Date(u.start)-n)/r,o=(new Date(u.end)-new Date(u.start))/r):(n=i.start!=""?parseFloat(i.start):this.startValue,n=n<this.startValue?n:this.startValue,t=i.end!=""?parseFloat(i.end):this.endValue,t=t>this.endValue?t:this.endValue,r=t-n,e=(parseFloat(u.start)-n)/r,o=(parseFloat(u.end)-parseFloat(u.start))/r);f.zoomPosition=e;f.zoomFactor=o},_calculateSelectedData:function(){var u=[],f=0,e=this.model.valueType=="datetime",i=this.model.selectedRangeSettings.start,r=this.model.selectedRangeSettings.end,n,t;if(e&&(i=Date.parse(i),r=Date.parse(r)),n=this.model.dataSource!=""?this.model.dataSource:this.model.series!=""&&this.model.series[0].dataSource!=""?this.model.series[0].dataSource:null,n!=null)for(t=0;t<n.length-1;t++)currentValue=e?Date.parse(n[t][Object.keys(n[t])[0]]):n[t][Object.keys(n[t])[0]],i<=currentValue&¤tValue<=r&&(u[f]=n[t],f++);this.model.selectedData=u},calculateInterval:function(n,t){if(t._intervalType=t.intervalType?t.intervalType:"auto",t.visible===!0&&this.model.valueType=="datetime"&&this.calculateVisibleLabels(t,"lower",0),n.visible===!0&&this.model.valueType=="datetime"){if(n.intervalType&&n.intervalType.toLowerCase()!="auto")n._intervalType=n.intervalType;else switch(t._intervalType){case"years":n._intervalType="years";break;case"quarters":n._intervalType="years";break;case"months":n._intervalType="quarters";break;case"weeks":n._intervalType="months";break;case"days":n._intervalType="weeks";break;case"hours":n._intervalType="days";break;case"minutes":n._intervalType="hours"}n.autoInterval==!1?this.calculateVisibleLabels(n,"higher",0):this.calculateVisibleLabels(n,"higher",0)}t.visible===!0&&this.model.valueType=="numeric"&&this.setInterval(this)},calculateVisibleLabels:function(n,t,i){var f=n._intervalType,r,u;switch(f){case"auto":r=this.calculateDateTimeNiceInterval(this,this.startDateTime,this.endDateTime);u=r.intervalType.toLowerCase();n._intervalType=u;n._interval=r.interval;this.calculateVisibleLabels(n,t,i);break;case"years":this.setYearInterval(this,t);break;case"quarters":this.setQuarterInterval(this,t,i);break;case"months":this.setMonthInterval(this,t,i);break;case"weeks":this.setWeekInterval(this,t,i);break;case"days":this.setDayInterval(this,t,i);break;case"hours":this.setHourInterval(this,t,i);break;case"minutes":this.setMinuteInterval(this,t,i)}},setInterval:function(n){var f,s=this.endValue-this.startValue,o=n.model.rangePadding,u=this.startValue,t=this.calculateNumericInterval(n,s),i,e,r;for(o=="additional"?(this.endValue=this.endValue+t,this.startValue=this.startValue-t,s=this.endValue-this.startValue):o=="normal"?(i=0,u<0?(u=0,i=this.startValue+this.startValue/20,e=t+i%t,.365*t>=e&&(i-=t),i%t<0&&(i=i-t-i%t)):(i=u<5/6*this.endValue?0:u-(this.endValue-u)/2,i%t>0&&(i-=i%t)),r=this.endValue+(this.endValue-u)/20,e=t-r%t,.365*t>=e&&(r+=t),r%t>0&&(r=r+t-r%t),t=this.calculateNumericInterval(n,r-i),this.startValue=i,this.endValue=r):o=="round"&&(this.startValue=Math.floor(this.startValue/t*t),this.endValue=Math.ceil(this.endValue/t*t)),f=n.startValue,count=0;f<=n.endValue;)this._insertNumericText(n,f),count++,f=f+t;this.insertLabels(n,"lower")},calculateDateTimeNiceInterval:function(n,t,i){var u=Math.abs((t.getTime()-i.getTime())/864e5),r=this.calculateNumericInterval(n,u/365),f,e;return r>=1?{interval:r,intervalType:"Years"}:(r=this.calculateNumericInterval(n,u/90),r>=1)?{interval:r,intervalType:"Quarters"}:(r=this.calculateNumericInterval(n,u/30),r>=1)?{interval:r,interval1:r,intervalType:"Months"}:(r=this.calculateNumericInterval(n,u/7),r>=1)?{interval:r,intervalType:"Weeks",intervalType1:"Weeks"}:(r=this.calculateNumericInterval(n,u),r>=1)?{interval:r,intervalType:"Days"}:(f=u*24,r=this.calculateNumericInterval(n,f),r>=1)?{interval:r,intervalType:"Hours"}:(e=u*1440,r=this.calculateNumericInterval(n,e),{interval:r,intervalType:"Minutes"})},calculateNumericInterval:function(n,i){for(var f,e=this.GetDesiredIntervalsCount(n.newWidth),r=i/e,s=Math.pow(10,Math.floor(t.EjSvgRender.utils._logBase(r,10))),o=[10,5,2,1],u=0;u<o.length;u++){if(f=s*o[u],e<i/f)return r;r=f}return r},GetDesiredIntervalsCount:function(n){return Math.max(n*(.8/50),1)},setHourInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();Date.prototype.addHours=function(n){var t=new Date(this.valueOf());return t.getMilliseconds()!==0&&t.setMilliseconds(t.getMilliseconds()+(1e3-t.getMilliseconds())),t.getSeconds()!==0&&t.setSeconds(t.getSeconds()+(60-t.getSeconds())),t.getMinutes()!==0?t.setMinutes(t.getMinutes()+(60-t.getMinutes())):t.setHours(t.getHours()+n),t};var u=t.startDateTime,e=0,o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"hhtt",u,e,f,!1),o+=f,e++,u=u.addHours(1);o>=t.newWidth?t.setHourInterval(t,i,1):this.insertLabels(t,i);break;case 1:while(u<=t.endDateTime)f=this._insertText(t,i,"hht",u,e,f,!1),o+=f,e++,u=u.addHours(1);o>=t.newWidth?t.setHourInterval(t,i,2):this.insertLabels(t,i);break;case 2:while(u<=t.endDateTime)f=this._insertText(t,i,"hh",u,e,f,!1),o+=f,e++,u=u.addHours(1);o>=t.newWidth?(n(t.lowerLevel).empty(),t.model.labelSettings.lowerLevel._intervalType="days",t.setDayInterval(t,i,0)):this.insertLabels(t,i)}},setMinuteInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();Date.prototype.addMinutes=function(n){var t=new Date(this.valueOf());return t.getMilliseconds()!==0&&t.setMilliseconds(t.getMilliseconds()+(1e3-t.getMilliseconds())),t.getSeconds()!==0?t.setSeconds(t.getSeconds()+(60-t.getSeconds())):t.setMinutes(t.getMinutes()+n),t};var u=t.startDateTime,e=0,o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"mm",u,e,f,!1),o+=f,e++,u=u.addMinutes(1);o>=t.newWidth?(n(t.lowerLevel).empty(),t.model.labelSettings.lowerLevel._intervalType="hours",t.setHourInterval(t,i,0)):this.insertLabels(t,i)}},_emptyLabelBars:function(t,i){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty()},_insertWeekText:function(n,i,r,u,f,e){var s=n.model.labelSettings.higherLevel.style.font,h=n.model.labelSettings.lowerLevel.style.font,c,o,l;return i==="higher"?(n._higherTotalValues[f]=f==0?0:u.getTime()-n.startDateTime.getTime(),c={id:this._rootId+"_higLabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":s.size,"font-family":s.family,"font-style":s.style,"font-weight":s.weight,fill:s.color},n.renderer.drawText(c,r,n.higherLevel),n._higherTextNode[f]=n.higherLevel.childNodes[f],o={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].textContent,null,o):t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].innerHTML,null,o),e=Math.max(e,l.width)):(n._lowerTotalValues[f]=f==0?0:u.getTime()-n.startDateTime.getTime(),c={id:this._rootId+"_LabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":h.size,"font-family":h.family,"font-style":h.style,"font-weight":h.weight,fill:h.color},n.renderer.drawText(c,r,n.lowerLevel),n._lowerTextNode[f]=n.lowerLevel.childNodes[f],o={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].textContent,null,o):t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].innerHTML,null,o),e=Math.max(e,l.width)),e},setWeekInterval:function(n,i,r){this._emptyLabelBars(n,i);Date.prototype.getWeek=function(){var n=new Date(this.getTime()),t;return n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7),t=new Date(n.getFullYear(),0,4),1+Math.round(((n.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)};Date.prototype.dayOfWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][this.getDay()]};Date.prototype.addDays=function(n){var t=new Date(this.valueOf());return new Date(t.getFullYear(),t.getMonth(),t.getDate()+n)};Date.prototype.subDays=function(n){var t=new Date(this.valueOf());return new Date(t.getFullYear(),t.getMonth(),t.getDate()-n)};for(var u=n.startDateTime,e=0,o=0,f=0,s=this.model.locale,h=t.datavisualization.RangeNavigator.Locale[s]?t.datavisualization.RangeNavigator.Locale[s]:t.datavisualization.RangeNavigator.Locale["en-US"];u.dayOfWeek()!="Monday";)u=u.subDays(1);switch(r){case 0:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.longWeeks+u.getWeek()+t.format(u," MMMM, yyyy",s),u,e,f),o+=f,e++,u=u.addDays(7);o>=n.newWidth?n.setWeekInterval(n,i,1):this.insertLabels(n,i);break;case 1:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.longWeeks+u.getWeek()+t.format(u," MMM, yy",s),u,e,f),o+=f,e++,u=u.addDays(7);o>=n.newWidth?n.setWeekInterval(n,i,2):this.insertLabels(n,i);break;case 2:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.longWeeks+u.getWeek(),u,e,f),o+=f,e++,u=u.addDays(7);o>=n.newWidth?n.setWeekInterval(n,i,3):this.insertLabels(n,i);break;case 3:while(u<=n.endDateTime)f=this._insertWeekText(n,i,this._localizedLabels.intervals.week.shortWeeks+u.getWeek(),u,e,f),o+=f,e++,u=u.addDays(7);this.insertLabels(n,i)}},setDayInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();Date.prototype.addDays=function(){var n=new Date(this.valueOf());return new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)};var u=t.startDateTime,e=0,o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"dddd, MMMM d, yyyy",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,1):this.insertLabels(t,i);break;case 1:while(u<=t.endDateTime)f=this._insertText(t,i,"ddd, MMM d, yy",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,2):this.insertLabels(t,i);break;case 2:while(u<=t.endDateTime)f=this._insertText(t,i,"dddd, d",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,3):this.insertLabels(t,i);break;case 3:while(u<=t.endDateTime)f=this._insertText(t,i,"MMM, d",u,e,f,!1),o+=f,e++,u=u.addDays();o>=t.newWidth?t.setDayInterval(t,i,4):this.insertLabels(t,i);break;case 4:while(u<=t.endDateTime)f=this._insertText(t,i,"dd",u,e,f,!1),o+=f,e++,u=u.addDays();this.insertLabels(t,i)}},setMonthInterval:function(t,i,r){t._higherTextNode=[];t._higherTotalValues=[];t._lowerTextNode=[];t._lowerTotalValues=[];i==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();var u=t.startDateTime,s=5,e=0,h=new Date(t.startDateTime),o=0,f=0;switch(r){case 0:while(u<=t.endDateTime)f=this._insertText(t,i,"MMMM, yyyy",u,e,f,!1),o+=f,e++,u=u.addMonths();o+s>=t.newWidth?t.setMonthInterval(t,i,1):this.insertLabels(t,i);break;case 1:while(u<=t.endDateTime)f=this._insertText(t,i,"MMMM",u,e,f,!1),o+=f,e++,u=u.addMonths();o+s>=t.newWidth?t.setMonthInterval(t,i,2):this.insertLabels(t,i);break;case 2:while(u<=t.endDateTime)f=this._insertText(t,i,"MMM",u,e,f,!1),o+=f,e++,u=u.addMonths();o+s>=t.newWidth?t.setMonthInterval(t,i,3):this.insertLabels(t,i);break;case 3:while(u<=t.endDateTime)f=this._insertText(t,i,"MMM",u,e,f,!0),o+=f,e++,u=u.addMonths();this.insertLabels(t,i)}},_quarter:function(n,i,r,u,f,e,o){for(var c,s,h,l,a,v=n.startYear;v<=n.endYear;v++)if(c=u!=null?t.format(f,u,n.model.locale):"",v===n.startYear)for(s=n.startMonth;s<=11&&f<=this.endDateTime;s++)h=i=="higher"?{id:this._rootId+"_higLabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight,fill:n.model.labelSettings.higherLevel.style.font.color}:{id:this._rootId+"_LabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight,fill:n.model.labelSettings.lowerLevel.style.font.color},s>=0&&s<=2?(i=="higher"?n.renderer.drawText(h,r+"1 "+c,n.higherLevel):n.renderer.drawText(h,r+"1 "+c,n.lowerLevel),f=new Date(f.setMonth(3)),k=2):s>=3&&s<=5?(i=="higher"?n.renderer.drawText(h,r+"2 "+c,n.higherLevel):n.renderer.drawText(h,r+"2 "+c,n.lowerLevel),f=new Date(f.setMonth(6)),k=5):s>=6&&s<=8?(i=="higher"?n.renderer.drawText(h,r+"3 "+c,n.higherLevel):n.renderer.drawText(h,r+"3 "+c,n.lowerLevel),f=new Date(f.setMonth(9)),k=8):s>=9&&s<=11&&(i=="higher"?n.renderer.drawText(h,r+"4 "+c,n.higherLevel):n.renderer.drawText(h,r+"4 "+c,n.lowerLevel),f=new Date(f.setMonth(12)),k=11),i==="lower"?(n._lowerTotalValues[o]=s===n.startMonth?n.startDateTime.getTime()-n.startDateTime.getTime():new Date(n.startYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._lowerTextNode[o]=n.lowerLevel.childNodes[o],l={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[o].textContent,null,l),e+=a.width):(n._higherTotalValues[o]=s===n.startMonth?n.startDateTime.getTime()-n.startDateTime.getTime():new Date(n.startYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._higherTextNode[o]=n.higherLevel.childNodes[o],l={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[o].textContent,null,l),e+=a.width),o++;else if(v===n.endYear)for(s=0;s<=n.endMonth;s++)h=i=="higher"?{id:this._rootId+"_higLabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight}:{id:this._rootId+"_LabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight},s>=0&&s<=2?(i=="higher"?n.renderer.drawText(h,r+"1 "+c,n.higherLevel):n.renderer.drawText(h,r+"1 "+c,n.lowerLevel),f=new Date(f.setMonth(3)),k=2):s>=3&&s<=5?(i=="higher"?n.renderer.drawText(h,r+"2 "+c,n.higherLevel):n.renderer.drawText(h,r+"2 "+c,n.lowerLevel),f=new Date(f.setMonth(6)),k=5):s>=6&&s<=8?(i=="higher"?n.renderer.drawText(h,r+"3 "+c,n.higherLevel):n.renderer.drawText(h,r+"3 "+c,n.lowerLevel),f=new Date(f.setMonth(9)),k=8):s>=9&&s<=11&&(i=="higher"?n.renderer.drawText(h,r+"4 "+c,n.higherLevel):n.renderer.drawText(h,r+"4 "+c,n.lowerLevel),f=new Date(f.setMonth(12)),k=11),i==="lower"?(n._lowerTotalValues[o]=new Date(n.endYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._lowerTextNode[o]=n.lowerLevel.childNodes[o],l={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[o].textContent,null,l),e+=a.width):(n._higherTotalValues[o]=new Date(n.endYear+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._higherTextNode[o]=n.higherLevel.childNodes[o],l={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[o].textContent,null,l),e+=a.width),o++;else for(s=0;s<=11;s++)h=i=="higher"?{id:this._rootId+"_higLabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight}:{id:this._rootId+"_LabelBarText_"+o,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight},s>=0&&s<=2?(i=="higher"?n.renderer.drawText(h,r+"1 "+c,n.higherLevel):n.renderer.drawText(h,r+"1 "+c,n.lowerLevel),f=new Date(f.setMonth(3)),k=2):s>=3&&s<=5?(i=="higher"?n.renderer.drawText(h,r+"2 "+c,n.higherLevel):n.renderer.drawText(h,r+"2 "+c,n.lowerLevel),f=new Date(f.setMonth(6)),k=5):s>=6&&s<=8?(i=="higher"?n.renderer.drawText(h,r+"3 "+c,n.higherLevel):n.renderer.drawText(h,r+"3 "+c,n.lowerLevel),f=new Date(f.setMonth(9)),k=8):s>=9&&s<=11&&(i=="higher"?n.renderer.drawText(h,r+"4 "+c,n.higherLevel):n.renderer.drawText(h,r+"4 "+c,n.lowerLevel),f=new Date(f.setMonth(12)),k=11),i==="lower"?(n._lowerTotalValues[o]=new Date(v+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._lowerTextNode[o]=n.lowerLevel.childNodes[o],l={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[o].textContent,null,l),e+=a.width):(n._higherTotalValues[o]=new Date(v+"/"+parseInt(s+1)+"/1").getTime()-n.startDateTime.getTime(),s=k,n._higherTextNode[o]=n.higherLevel.childNodes[o],l={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},a=t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[o].textContent,null,l),e+=a.width),o++;return e},setQuarterInterval:function(i,r,u){i._higherTextNode=[];i._higherTotalValues=[];i._lowerTextNode=[];i._lowerTotalValues=[];r==="higher"?n("#higherLevel").children().empty():n("#lowerLevel").children().empty();var e=new Date(i.startDateTime),o=0,f=0,s=this.model.locale,h=t.datavisualization.RangeNavigator.Locale[s]?t.datavisualization.RangeNavigator.Locale[s]:t.datavisualization.RangeNavigator.Locale["en-US"];switch(u){case 0:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.longQuarters,"yyyy",e,f,o);f>=i.newWidth-this.padding?i.setQuarterInterval(i,r,1):this.insertLabels(i,r);break;case 1:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.longQuarters,"yy",e,f,o);f>=i.newWidth-this.padding?i.setQuarterInterval(i,r,2):this.insertLabels(i,r);break;case 2:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.shortQuarters,"yyyy",e,f,o);f>=i.newWidth-this.padding?i.setQuarterInterval(i,r,3):this.insertLabels(i,r);break;case 3:f=this._quarter(i,r,this._localizedLabels.intervals.quarter.shortQuarters,null,e,f,o);this.insertLabels(i,r)}},_insertText:function(n,i,r,u,f,e,o){var c=n.model.locale,s,h,l;return Date.prototype.addYears=function(n){var t=new Date(this.valueOf());return t.getMilliseconds()!==0||t.getSeconds()!==0||t.getMinutes()!==0||t.getHours()!==0||t.getDate()!==0||t.getMonth()!==0?t=new Date(t.getFullYear()+1,0,1):t.setYear(t.getFullYear()+n),t},Date.prototype.addMonths=function(){var n=new Date(this.valueOf());return new Date(n.getFullYear(),n.getMonth()+1,1)},i==="higher"?(n._higherTotalValues[f]=u.getTime()-n.startDateTime.getTime(),s={id:this._rootId+"_higLabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.higherLevel.style.font.size,"font-family":n.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":n.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.higherLevel.style.font.fontWeight,fill:n.model.labelSettings.higherLevel.style.font.color},o==!1?n.renderer.drawText(s,t.format(u,r,c),n.higherLevel):n.renderer.drawText(s,t.format(u,r,c).toString().substring(0,1),n.higherLevel),n._higherTextNode[f]=n.higherLevel.childNodes[f],h={size:n.model.labelSettings.higherLevel.style.font.size,fontStyle:n.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.higherLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].textContent,null,h):t.EjSvgRender.utils._measureText(n.higherLevel.childNodes[f].innerHTML,null,h),e=Math.max(e,l.width)):(n._lowerTotalValues[f]=u.getTime()-n.startDateTime.getTime(),s={id:this._rootId+"_LabelBarText_"+f,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":n.model.labelSettings.lowerLevel.style.font.size,"font-family":n.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":n.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":n.model.labelSettings.lowerLevel.style.font.fontWeight,fill:n.model.labelSettings.lowerLevel.style.font.color},o==!1?n.renderer.drawText(s,t.format(u,r,c),n.lowerLevel):n.renderer.drawText(s,t.format(u,r,c).substring(0,1),n.lowerLevel),n._lowerTextNode[f]=n.lowerLevel.childNodes[f],h={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily},l=this.svgSupport?t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].textContent,null,h):t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[f].innerHTML,null,h),e=Math.max(e,l.width)),e},_insertNumericText:function(n,i){var r,f,u,e;n._lowerTotalValues[count]=i-n.startValue;r=n.model.labelSettings.style.font;f={id:this._rootId+"_LabelBarText_"+count,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":r.size,"font-family":r.family,"font-style":r.style,"font-weight":r.weight,fill:r.color};n.renderer.drawText(f,i,n.lowerLevel);n._lowerTextNode[count]=n.lowerLevel.childNodes[count];u={size:n.model.labelSettings.lowerLevel.style.font.size,fontStyle:n.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:n.model.labelSettings.lowerLevel.style.font.fontFamily};e=this.svgSupport?t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[count].textContent,null,u):t.EjSvgRender.utils._measureText(n.lowerLevel.childNodes[count].innerHTML,null,u)},setYearInterval:function(n,t){var i=n.startDateTime;for(count=0;i<=n.endDateTime;)this._insertText(n,t,"yyyy",i,count,0,!1),count++,i=i.addYears(1);this.insertLabels(n,t)},_applyPadding:function(){for(var n=0;n<this._higherTotalValues.length;n++)this._higherTotalValues[n]+=this.padding;for(n=0;n<this._lowerTotalValues.length;n++)this._lowerTotalValues[n]+=this.padding},insertLabels:function(r,u){var g=jQuery.uaMatch(navigator.userAgent),rt=this.model.labelSettings.lowerLevel.gridLineStyle.color,y,d,b,h,ut,tt,l,it,a,k;this.lgClr=this.renderer.createGradientElement("lgColor",rt,150,0,150,100,this.svgDocument);y=this.model.valueType;d=parseFloat(this.renderer._getAttrVal(n(r.svgDocument),"width"));this.eachInterval=y=="datetime"?(d-this.padding*2)/parseFloat(this.endDateTime.getTime()-this.startDateTime.getTime()):(d-this.padding*2)/parseFloat(this.endValue-this.startValue);var p=0,o=0,s,e,c,v,w,f,nt=r._higherTextNode.length;if(lowerLevelLabels=[],higherLevelLabels=[],b=0,u==="higher"&&r.model.labelSettings.higherLevel.visible===!0){for(r.model.labelSettings.higherLevel.position=="top"&&r.model.labelSettings.lowerLevel.position=="top"?(s={x:this.padding,y:1,width:r.newWidth>0?r.newWidth-r.padding*2:0,height:r.minHighHeight,stroke:r.model.labelSettings.higherLevel.border.color,"stroke-width":r.model.labelSettings.higherLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.higherLevel)):r.model.labelSettings.higherLevel.position=="top"?(s={x:this.padding,y:1,width:r.newWidth-r.padding*2,height:r.minHighHeight,stroke:r.model.labelSettings.higherLevel.border.color,"stroke-width":r.model.labelSettings.higherLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.higherLevel)):(s={x:this.padding,y:r.bottomPosition,width:r.newWidth>0?r.newWidth-r.padding*2:0,height:r.minHighHeight,stroke:r.model.labelSettings.higherLevel.border.color,"stroke-width":r.model.labelSettings.higherLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.higherLevel)),r._higherLineLeft=[],e=r.model.enableRTL?r.newWidth-(r._higherTotalValues[r._higherTextNode.length-1]*this.eachInterval+this.padding):r._higherTotalValues[p]*this.eachInterval+this.padding,r.model.enableRTL?(f=r._higherTextNode.length-1,h=!0):(f=0,h=!1),ut=0;h?f>=0:f<r._higherTextNode.length;h?f--:f++){if(r._higherLineLeft[f]=e,w={size:r.model.labelSettings.higherLevel.style.font.size,fontStyle:r.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:r.model.labelSettings.higherLevel.style.font.fontFamily},v=t.EjSvgRender.utils._measureText(r.higherLevel.childNodes[p].textContent,null,w),o=v.width,c=r._higherTotalValues[f+1]===i?h?0:r.newWidth:h?r.newWidth-(r._higherTotalValues[f+1]*this.eachInterval+this.padding):r._higherTotalValues[f+1]*this.eachInterval+this.padding,l=r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?h?c-(c-e)/2-o/2:(c-e)/2+e-o/2:r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?h?c+10:e+10:h?e-o-2:c-o-2,this.model.enableScrollbar&&((!h&&f==0||h&&nt==f)&&(this.firstLabelPosition=l+o),(!h&&f==1||h&&nt-1==f)&&this.firstLabelPosition>e&&(r._higherTextNode[h?f+1:f-1].textContent="")),r.renderer._setAttr(n(r._higherTextNode[f]),{x:l}),r.renderer._setAttr(n(r._higherTextNode[f]),{fill:r.model.labelSettings.higherLevel.style.font.color}),r._higherTextLeft[f]=l,r.model.labelSettings.higherLevel.position=="top"&&r.model.labelSettings.lowerLevel.position=="top"?(r._higherTextNode[f].setAttribute("y",r.minHighHeight-5),s={x1:e,y1:"0",x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.higherLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.higherLevel)):r.model.labelSettings.higherLevel.position=="top"?(this.svgSupport?g.browser.toLowerCase()=="msie"?r._higherTextNode[f].setAttribute("y",r.centerPosition-5):r._higherTextNode[f].setAttribute("y",r.centerPosition-9):r.renderer._setAttr(n(r._higherTextNode[f]),{y:r.centerPosition/2-5}),s={x1:e,y1:"0",x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.higherLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.higherLevel)):(r._higherTextNode[f].setAttribute("y",r.newHeight-5),s={x1:e,y1:this.bottomPosition,x2:e,y2:r.newHeight,stroke:r.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.higherLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.higherLevel)),(l<this.padding||r.newWidth-e-this.padding<o)&&y=="datetime")if(h)l<this.padding&&e-this.padding>o?r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?r._higherTextNode[f].setAttribute("x",this.padding+(e-this.padding)/2-o/2):r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?r._higherTextNode[f].setAttribute("x",this.padding+10):r._higherTextNode[f].setAttribute("x",e-o-2):r.newWidth-e<o&&r.newWidth-c-this.padding>o?r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?r._higherTextNode[f].setAttribute("x",c+(r.newWidth-c-this.padding)/2-o/2):r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?r._higherTextNode[f].setAttribute("x",c+10):r._higherTextNode[f].setAttribute("x",r.newWidth-o-2-this.padding):r.higherLevel.removeChild(r._higherTextNode[f]);else{r.higherLevel.removeChild(r._higherTextNode[f]);continue}else if(l+o>r.newWidth-this.padding&&y=="datetime"){l=r.model.labelSettings.higherLevel.style.horizontalAlignment==="middle"?e+(r.newWidth-e-this.padding)/2-o/2:r.model.labelSettings.higherLevel.style.horizontalAlignment==="left"?e:r.newWidth-o*3/2;r._higherTextNode[f].setAttribute("x",l);continue}e=this.model.enableRTL?r.newWidth-(r._higherTotalValues[f-1]*this.eachInterval+this.padding):r._higherTotalValues[f+1]*this.eachInterval+this.padding;p++}for(a=0,k=r._higherLineLeft.length;a<k;a++)v=t.EjSvgRender.utils._measureText(r.higherLevel.childNodes[a].textContent,null,w),this.svgSupport?higherLevelLabels.push({size:v,x:r._higherLineLeft[a],y:r._higherTextNode[a].getAttribute("y")-v.height/2+b,lableType:"higherLevel"}):higherLevelLabels.push({size:v,x:r._higherLineLeft[a],y:r._higherTextNode[a].offsetTop-v.height/2+b,lableType:"higherLevel"});this._addLabelsRegion(r,higherLevelLabels)}else if(r.model.labelSettings.lowerLevel.visible===!0){for(r._lowerLineLeft=[],e=r.model.enableRTL?r.newWidth-(r._lowerTotalValues[r._lowerTextNode.length-1]*this.eachInterval+this.padding):r._lowerTotalValues[p]*this.eachInterval+this.padding,tt=r.model.labelSettings.higherLevel.visible?r.bottomPosition:r.centerHeight,r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="top"?(s={x:this.padding,y:tt,width:this.newWidth-r.padding*2,height:r.minLowHeight-1,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},y!="numeric"&&r.renderer.drawRect(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="bottom"?(s={x:this.padding,y:r.centerHeight,width:this.newWidth>0?this.newWidth-r.padding*2:0,height:r.minLowHeight-1,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="top"&&r.model.labelSettings.higherLevel.position==="bottom"?(s={x:this.padding,y:0,width:this.newWidth>0?this.newWidth-r.padding*2:0,height:r.minLowHeight-1,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.lowerLevel)):r.model.labelSettings.higherLevel.position==="top"&&r.model.labelSettings.lowerLevel.position==="top"&&(s={x:this.padding,y:r.minHighHeight-1,width:this.newWidth>0?this.newWidth-r.padding*2:0,height:r.minLowHeight,stroke:r.model.labelSettings.lowerLevel.border.color,"stroke-width":r.model.labelSettings.lowerLevel.border.width,fill:"transparent"},r.renderer.drawRect(s,r.lowerLevel)),r.model.enableRTL?(f=r._lowerTextNode.length-1,h=!0):(f=0,h=!1);h?f>=0:f<r._lowerTextNode.length;h?f--:f++)r._lowerLineLeft[f]=e,w={size:r.model.labelSettings.lowerLevel.style.font.size,fontStyle:r.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:r.model.labelSettings.lowerLevel.style.font.fontFamily},v=t.EjSvgRender.utils._measureText(r.lowerLevel.childNodes[p].textContent,null,w),o=v.width,l=0,c=r._lowerTotalValues[f+1]===i?h?0:r.newWidth:h?r.newWidth-(r._lowerTotalValues[f+1]*this.eachInterval+this.padding):r._lowerTotalValues[f+1]*this.eachInterval+this.padding,l=r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?h?(e-c)/2+c-o/2:(c-e)/2+e-o/2:r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?h?c+2:e+2:h?e-o-2:c-o-2,y=="numeric"&&(l=e-o/2),r.renderer._setAttr(n(r._lowerTextNode[f]),{x:l}),r.renderer._setAttr(n(r._lowerTextNode[f]),{fill:r.model.labelSettings.lowerLevel.style.font.color}),r._lowerTextLeft[f]=l,r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="top"?(this.svgSupport?g.browser.toLowerCase()=="msie"?r._lowerTextNode[f].setAttribute("y",r.newHeight-5):r._lowerTextNode[f].setAttribute("y",r.newHeight-9):r.renderer._setAttr(n(r._lowerTextNode[f]),{y:r.newHeight-v.height}),it=r.model.labelSettings.higherLevel.visible?parseFloat(r.minHighHeight+r.centerHeight):r.minHighHeight,s={x1:e,y1:it,x2:e,y2:r.newHeight,stroke:this.lgClr,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&y!="numeric"&&r.renderer.drawLine(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="bottom"&&r.model.labelSettings.higherLevel.position==="bottom"?(r._lowerTextNode[f].setAttribute("y",r.bottomPosition-5),s={x1:e,y1:r.centerHeight,x2:e,y2:r.bottomPosition,stroke:r.model.labelSettings.lowerLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.lowerLevel)):r.model.labelSettings.lowerLevel.position==="top"&&r.model.labelSettings.higherLevel.position==="bottom"?(r._lowerTextNode[f].setAttribute("y",r.centerPosition-5),s={x1:e,y1:0,x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.lowerLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.lowerLevel)):r.model.labelSettings.higherLevel.position==="top"&&r.model.labelSettings.lowerLevel.position==="top"&&(r._lowerTextNode[f].setAttribute("y",r.centerPosition-5),s={x1:e,y1:r.minHighHeight,x2:e,y2:r.centerPosition,stroke:r.model.labelSettings.lowerLevel.gridLineStyle.color,"stroke-width":r.model.labelSettings.lowerLevel.gridLineStyle.width,"stroke-dasharray":r.model.labelSettings.lowerLevel.gridLineStyle.dashArray},f!=0&&r.renderer.drawLine(s,r.lowerLevel)),(l<this.padding||r.newWidth-e-this.padding<o)&&y=="datetime"?h?(l<this.padding&&e-this.padding>o?r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?r._lowerTextNode[f].setAttribute("x",this.padding+(e-this.padding)/2-o/2):r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?r._lowerTextNode[f].setAttribute("x",this.padding+10):r._lowerTextNode[f].setAttribute("x",e-o-2):r.newWidth-e<o&&r.newWidth-this.padding-c>o?r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?r._lowerTextNode[f].setAttribute("x",c+(r.newWidth-c-this.padding)/2-o/2):r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?r._lowerTextNode[f].setAttribute("x",c+10):r._lowerTextNode[f].setAttribute("x",r.newWidth-o-2-this.padding):r.lowerLevel.removeChild(r._lowerTextNode[f]),p--):(r.lowerLevel.removeChild(r._lowerTextNode[f]),p--):l+o>r.newWidth-this.padding&&y=="datetime"&&(l=r.model.labelSettings.lowerLevel.style.horizontalAlignment==="middle"?e+(r.newWidth-e-this.padding)/2-o/2:r.model.labelSettings.lowerLevel.style.horizontalAlignment==="left"?e:r.newWidth-o*3/2,r._lowerTextNode[f].setAttribute("x",l)),e=this.model.enableRTL?r.newWidth-(r._lowerTotalValues[f-1]*this.eachInterval+this.padding):r._lowerTotalValues[f+1]*this.eachInterval+this.padding,p++;for(a=0,k=r._lowerLineLeft.length;a<k;a++)v=t.EjSvgRender.utils._measureText(r.lowerLevel.childNodes[a].textContent,null,w),this.svgSupport?lowerLevelLabels.push({size:v,x:r._lowerLineLeft[a],y:r._lowerTextNode[a].getAttribute("y")-v.height/2+b,lableType:"lowerLevel"}):lowerLevelLabels.push({size:v,x:r._lowerLineLeft[a],y:r._lowerTextNode[a].offsetTop+b,lableType:"lowerLevel"});this._addLabelsRegion(r,lowerLevelLabels)}r.model.enableRTL?r._lowerLineLeft.push(this.padding):r._lowerLineLeft.push(this.newWidth-this.padding);r._setGridlines(r);n(this.higherLevel).css("cursor","pointer");n(this.lowerLevel).css("cursor","pointer")},_addLabelsRegion:function(n,t){var r,f,u,e=t.length,i;if(e==1)n.labelRegions.push({X:t[0].x,Y:t[0].y,Height:t[0].size.height,Width:n.newWidth-t[0].x,LabelType:t[0].lableType});else for(i=0;i<e;i++)n.model.enableRTL?(r=t[i+1]?t[i].x-t[i+1].x:t[i].x-parseInt(n.model.padding),u=t[i+1]?t[i+1].x:parseInt(n.model.padding)):(r=t[i+1]?t[i+1].x-t[i].x:n.newWidth-t[i].x-parseInt(n.model.padding),u=t[i].x),f=t[i+1]?t[i].size.height:t[i-1].size.height,n.labelRegions.push({X:u,Y:t[i].y,Height:f,Width:r,LabelType:t[i].lableType})},_setGridlines:function(n){var t,i;if(n.model.navigatorStyleSettings.minorGridLineStyle.visible===!0)for(t=1;t<n._lowerTextNode.length;t++)n.model.labelSettings.higherLevel.position=="top"&&n.model.labelSettings.lowerLevel.position=="top"?(i={x1:n._lowerLineLeft[t],y1:n.centerHeight+n.minLowHeight+n.minHighHeight,x2:n._lowerLineLeft[t],y2:n.centerPosition,stroke:n.model.navigatorStyleSettings.minorGridLineStyle.color,"stroke-width":"1"},n.renderer.drawLine(i,n.centerLevel)):(i={x1:n._lowerLineLeft[t],y1:n.centerPosition,x2:n._lowerLineLeft[t],y2:n.centerPosition+n.centerHeight,stroke:n.model.navigatorStyleSettings.minorGridLineStyle.color,"stroke-width":"1"},n.renderer.drawLine(i,n.centerLevel));else for(t=0;t<n._higherTextNode.length;t++)i={x1:n._higherLineLeft[t],y1:n.centerHeight+n.minLowHeight,x2:n._higherLineLeft[t],y2:n.centerPosition,stroke:n.model.navigatorStyleSettings.majorGridLineStyle.color,"stroke-width":"1"},n.renderer.drawLine(i,n.centerLevel)},bindTo:function(){t.util.isNullOrUndefined(this.model.dataSource)||this.model.dataSource!=null&&this.model.dataSource.length>0&&this._processJsonData(this.model.dataSource,this.model)},_processJsonData:function(n,r){for(var f,a,e,o,s,v,h=[],y=[],p=0,u=0;u<n.length;u++)typeof n[u][r.xName]=="string"&&n[u][r.xName].indexOf("/Date(")!=-1&&(n[u][r.xName]=new Date(parseInt(n[u][r.xName].substr(6)))),jQuery.type(n[u][r.xName])!="string"&&jQuery.type(n[u][r.xName])!="date"?h.push(parseFloat(t.util.isNullOrUndefined(n[u][r.xName])?u:n[u][r.xName])):h.push(t.util.isNullOrUndefined(n[u][r.xName])?u:n[u][r.xName]);if(!t.util.isNullOrUndefined(r.yName))for(f=0;f<r.yName.length;f++){for(a=[],e=0;e<n.length;e++)a.push(n[e][r.yName[f]]===null||n[e][r.yName[f]]===i?n[e][r.yName[f]]:parseFloat(n[e][r.yName[f]]));y[f]=a;p=f+1}o=new Date(Math.max.apply(null,h));s=new Date(Math.min.apply(null,h));o.getTime()==s.getTime()&&(s.setHours(0),o.setHours(23));var c=s.getTime(),l=o.getTime(),w=this.model.scrollRangeSettings;this.model.enableScrollbar?(this._scrollRange||this.scrollbarUpdate)&&this.scrollbarUpdate?this._scrollRange={min:Math.min(this._scrollRange.min,c),max:Math.max(this._scrollRange.max,l),delta:l-c}:(v=[c,l,s,o],this.calculateZoomingRange.apply(this,v)):this.setRange.call(this,c,l,s,o)},calculateZoomingRange:function(n,t,i,r){return this.calculateZoomFactorPosition.call(this,n,t,i,r),this.setRange.call(this,n,t,i,r),0},setRange:function(n,t,i,r){var u=this.model.rangeSettings;return u.start!=""&&u.end!=""?(this.startDateTime=new Date(u.start),this.endDateTime=new Date(u.end),this.startValue=u.start,this.endValue=u.end):(this.startDateTime=new Date(i),this.startValue=n,this.endDateTime=new Date(r),this.endValue=t),0},calculateZoomFactorPosition:function(n,t,i,r){var l=this.model,h=l.rangeSettings,u,a,v,f=i,e=r,o=n,s=t,c=l.scrollRangeSettings;return l.valueType.toLowerCase()=="datetime"?(f=Date.parse(c.start?new Date(c.start):i),f=Math.min(f,Date.parse(i)),f=h.start!=""?Math.min(f,Date.parse(new Date(h.start))):f,e=Date.parse(c.end?new Date(c.end):r),e=Math.max(e,Date.parse(r)),e=h.end!=""?Math.max(e,Date.parse(new Date(h.end))):e,u=e-f,l.enableRTL?(a=(e-r)/u,v=(r-i)/u):(a=(i-f)/u,v=(r-i)/u),this._scrollRange={min:f,max:e,delta:e-f}):(o=c.start!=""?parseFloat(c.start):n,o=Math.min(o,n),o=h.start!=""?Math.min(o,parseFloat(h.start)):o,s=c.end!=""?parseFloat(c.end):t,s=Math.max(s,t),s=h.end!=""?Math.max(s,parseFloat(h.end)):s,u=s-o,l.enableRTL?(a=(s-t)/u,v=(t-n)/u):(a=(n-o)/u,v=(t-n)/u),this._scrollRange={min:o,max:s,delta:s-o}),this.scrollZoomPos=a,this.scrollZoomFact=v,0},mousePosition:function(n){if(!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0)return{x:n.pageX,y:n.pageY};if(n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0)return{x:n.originalEvent.pageX,y:n.originalEvent.pageY};if(n.originalEvent&&n.originalEvent.changedTouches!=i){if(!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0)return{x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}}else return{x:0,y:0}},calTouchPosition:function(t){var f=jQuery.uaMatch(navigator.userAgent),i=this.mousePosition(t),r,u,e;return t.pageX=i.x,t.pageY=i.y,e=f.browser.toLowerCase(),r=t.pageX-n(this.svgDocument).offset().left,u=t.pageY-n(this.svgDocument).offset().top,this.leftPadding=n(this.svgDocument).offset().left,{X:r,Y:u}},calMousePosition:function(t){var u=jQuery.uaMatch(navigator.userAgent),i,r;return u.browser.toLowerCase()=="mozilla"||u.browser.toLowerCase()=="webkit"?(i=t.pageX-n(this.svgDocument).parent().offset().left,r=t.pageY-n(this.svgDocument).parent().offset().top,this.leftPadding=0,this.grabPadding=0):(i=(t.originalEvent?t.originalEvent.pageX:t.pageX)-n(this.svgDocument).offset().left,r=(t.originalEvent?t.originalEvent.pageY:t.pageY)-n(this.svgDocument).offset().top,this.leftPadding=n(this.svgDocument).offset().left),{X:i,Y:r}},_performSelection:function(t){var i=this,s=i.model,r=s.navigatorStyleSettings.selectionSettings,h=r.color,u=t.target.parentNode.id,f=u=="leftslider"||u=="rightslider"||u==i._id+"thumbleft"||u==i._id+"thumbright",e=i.model.valueType,o;i._sliderHover=f||i.switched;i.selectionGrad=i.renderer.createGradientElement("selectionGrad",h,150,0,150,100,i.svgDocument);i.isNumericType=u!=i._id;(!i.isNumericType||e!="numeric")&&e=="numeric"||f||i.switched||(n("#highlightRect"+i._id).hide(),n("#selectionRect"+i._id).length==0&&(i.gselection=i.renderer.createGroup({id:"selectionRect"+i._id}),o={height:i.sliderHeight,opacity:r.opacity,stroke:r.border.color,"stroke-width":r.border.width},i.renderer.drawRect(o,i.gselection),i.selectionRect=i.gselection.firstChild,i.renderer.append(i.gselection,i.styleRect)),i.rect=i.selectionRect,i.startX=i.mouseDownX,i.renderer._setAttr(n(i.selectionRect),{fill:i.selectionGrad}),i.renderer._setAttr(n(i.selectionRect),{stroke:r.border.color}),i._highlight.call(i,i,t))},_performHighlight:function(t){var i=this,e=i.model,r=t.target.parentNode.id,u=e.navigatorStyleSettings.highlightSettings,o=u.color,s=r=="leftslider"||r=="rightslider"||r==this._id+"thumbleft"||r==this._id+"thumbright",f;this.highlightGrad=this.renderer.createGradientElement("highlightGrad",o,150,0,150,100,this.svgDocument);n("#highlightRect"+this._id).hide();s||this.isSelection||this._sliderHover||i.switched||(n("#highlightRect"+this._id).length==0&&(this.gHighlight=this.renderer.createGroup({id:"highlightRect"+this._id}),f={height:this.sliderHeight,fill:this.highlightGrad,opacity:u.opacity,stroke:u.border.color,"stroke-width":u.border.width},this.renderer.drawRect(f,this.gHighlight),this.highlightRect=this.gHighlight.firstChild,this.renderer.append(this.gHighlight,this.styleRect)),this.rect=this.highlightRect,i.startX=i.mouseDownX,this._highlight.call(this,i,t))},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_rightClick:function(n){var t=this.model.browserInfo;if(this.isTouch(n)&&this.model.navigatorStyleSettings.selectionSettings.enable)return event.preventDefault(),event.stopPropagation(),!1},_grab:function(t){var u,s,f,a,g,nt,tt,l,it,o,r,e,y;t.preventDefault();var i=this,rt=i.model,vt=rt.browserInfo,ut=this.isTouch(t),ft=rt.navigatorStyleSettings.selectionSettings,et=ut?i.calTouchPosition(t):i.calMousePosition(t);for(i.mouseDownX=et.X,i.mouseDownY=et.Y,ft.enable&&this._performSelection(t),u=i.edge==!0?i.target:t.target,s=u;s.parentNode;)s=s.parentNode,s.id==this._id+"thumbleft"?f=this._id+"thumbleft":s.id==this._id+"thumbright"&&(f=this._id+"thumbright");var p,w,h,b,k,d,ct=i.labelRegions.length,c=i.mouseDownX,ot=i.mouseDownY;for(a=0;a<ct;a++)if(h=i.labelRegions[a],b=h.X,k=h.Y,d=h.LabelType,b<=c&&b+h.Width>=c&&k<=ot&&k+h.Height>=ot){p=d=="lowerLevel"?!0:!1;w=d=="higherLevel"?!0:!1;break}if(g=!1,i.isSelection=!1,i.highlightRect&&(nt=i.highlightRect.getBoundingClientRect(),tt=i.centerSlider.getBoundingClientRect(),nt.left>=tt.left&&nt.right<=tt.right&&(g=!0)),!ft.enable||!i.selectionRect||u.parentNode.id==="leftslider"||u.parentNode.id==="rightslider"||f==this._id+"thumbleft"||f==this._id+"thumbright"||(i.isSelection=!0,i.startX=i.mouseDownX),ut&&!i.switched){var st=this._leftValue,ht=this._rightValue,v=10,lt=n("#"+this._id+"thumbleft"),at=n("#"+this._id+"thumbright");c>=st.left-v&&c<=st.right+v&&(u=this.leftCircle?this.leftCircle:lt[0].firstChild,f=this.leftCircle?f:this._id+"thumbleft",this._sliderMove=!0);c>=ht.left-v&&c<=ht.right+v&&(u=this.rightCircle?this.rightCircle:at[0].firstChild,f=this.rightCircle?f:this._id+"thumbright",this._sliderMove=!0)}if(u.parentNode.id==="leftslider"||u.parentNode.id==="rightslider"||f==this._id+"thumbleft"||f==this._id+"thumbright"||u.parentNode.id==="highlightRect"+this._id&&g||u.parentNode.id==="centerslider"||p||w||i.isSelection)if(i.dragTarget=u.parentNode.id==="highlightRect"+this._id?n("#centerslider").children()[0]:u,i.grabbed=!0,i.edge=!1,l=i.dragTarget.parentNode.id,this.svgSupport&&(it=f==this._id+"thumbleft"||f==this._id+"thumbright"?{e:t.clientX,f:t.clientY}:i.dragTarget.getCTM(),i.grabPoint.x=i.mouseDownX+this.leftPadding-Number(it.e),i.grabPoint.y=i.trueCoords.y-Number(it.f)),e=!1,y=i.model.enableRTL,y&&(i._higherLineLeft.sort(function(n,t){return n-t}),i._lowerLineLeft.sort(function(n,t){return n-t})),l!="leftslider"&&l!="rightslider"&&i.model.valueType=="datetime"&&w){for(i.grabbed=i.dragTarget.parentNode.id=="centerslider"?!0:!1,o=i.mouseDownX,r=0;r<i._higherLineLeft.length;r++)r+1<i._higherLineLeft.length&&o>i._higherLineLeft[r]&&o<i._higherLineLeft[r+1]?(i.setSliderPositions(i._higherLineLeft[r],null,null),i.setSliderPositions(null,null,i._higherLineLeft[r+1]),e=!0):r+1===i._higherLineLeft.length&&o>i._higherLineLeft[r]&&(i.setSliderPositions(i._higherLineLeft[r],null,null),i.setSliderPositions(null,null,i.newWidth-i.padding),e=!0);y&&!e&&(i.setSliderPositions(0+i.padding,null,null),i.setSliderPositions(null,null,i._higherLineLeft[0]),e=!1)}else if(l!="leftslider"&&l!="rightslider"&&i.model.valueType=="datetime"&&p){for(i.center=i.mouseDownX,i.grabbed=i.dragTarget.parentNode.id=="centerslider"?!0:!1,o=i.mouseDownX,r=0;r<i._lowerLineLeft.length;r++)r+1<i._lowerLineLeft.length&&o>i._lowerLineLeft[r]&&o<i._lowerLineLeft[r+1]?(i.setSliderPositions(i._lowerLineLeft[r],null,null),i.setSliderPositions(null,null,i._lowerLineLeft[r+1]),e=!0):r+1===i._lowerLineLeft.length&&o>i._lowerLineLeft[r]&&(i.setSliderPositions(i._lowerLineLeft[r],null,null),i.setSliderPositions(null,null,i.newWidth-i.padding),e=!0);y&&!e&&(i.setSliderPositions(0+i.padding,null,null),i.setSliderPositions(null,null,i._lowerLineLeft[0]),e=!1)}else i.isSelection&&(i.grabbed=!0)},_leave:function(){n("#highlightRect"+this._id).hide()},_drag:function(t){var e,i,c,u,l,y,a,v,o,r,s,f,h;if(t.preventDefault(),e=jQuery.uaMatch(navigator.userAgent),i=this,c=this.svgSupport&&t.originalEvent.toString()!=="[object TouchEvent]"&&e.browser.toLowerCase()!="msie"?i.calMousePosition(t):this.svgSupport?i.calTouchPosition(t):i.calMousePosition(t),mouseX=i.mouseDownX=c.X,mouseY=i.mouseDownY=c.Y,a=i.model.navigatorStyleSettings.highlightSettings,!a.enable||this._sliderMove||this.isTouch(t)||this._performHighlight(t),this.svgSupport&&i.GetTrueCoords(t),i.model.labelSettings.higherLevel.visible||i.model.labelSettings.lowerLevel.visible)for(v=i.labelRegions.length,o=0;o<v;o++)if(u=i.labelRegions[o],l=u.X,y=u.Y,l<=mouseX&&l+u.Width>=mouseX&&u.Y<=mouseY&&u.Y+u.Height>=mouseY){n(i.rightUnSelected).css("cursor","pointer");n(i.leftUnSelected).css("cursor","pointer");break}else n(i.rightUnSelected).css("cursor","default"),n(i.leftUnSelected).css("cursor","default");if(i.dragTarget){for((i.edge||i.dragTarget!==i.leftSlider)&&i.dragTarget!==i.rightSlider&&i.dragTarget!==i.highlightRect&&i.dragTarget!==i.centerSlider?(r=i.mouseDownX,s=i.mouseDownY):this.svgSupport?e.browser.toLowerCase()=="webkit"||e.browser.toLowerCase()=="mozilla"?(r=i.mouseDownX-i.grabPoint.x,r<this.padding&&(r=this.padding),s=i.mouseDownY-i.grabPoint.y):(r=i.trueCoords.x-i.grabPoint.x,r<this.padding&&(r=this.padding),s=i.trueCoords.y-i.grabPoint.y):(r=i.mouseDownX,s=i.mouseDownY),f=i.dragTarget;f.parentNode;)f=f.parentNode,f.id==this._id+"thumbleft"?h=this._id+"thumbleft":f.id==this._id+"thumbright"&&(h=this._id+"thumbright");i.diff=i.leftSlider.getBoundingClientRect().left-i.rightSlider.getBoundingClientRect().left;i.leftdiff=i.rightSlider.getBoundingClientRect().left-this.padding-n(this.svgDocument).offset().left;i.rightdiff=i.leftSlider.getBoundingClientRect().left-this.padding-n(this.svgDocument).offset().left;i.dragTarget.parentNode.id==="leftslider"||h==this._id+"thumbleft"?(i.grabbed=!1,i.diff>=-1&&i.diff<=1&&i.switched==!1&&i.rightdiff<i.newWidth-2*this.padding?(i.target=i.rightSlider,i.switched=!0,i.edge=!0,i._grab(t),i._drag(t)):(r<=this.rightSliderPosition?(i.setSliderPositions(r,null,null),this.leftSliderPosition=r,this.leftset=!1):(i.setSliderPositions(this.rightSliderPosition,null,null),this.leftset=!0,this.leftSliderPosition=this.rightSliderPosition),(i.diff>=1||i.diff<=-1)&&(i.switched=!1)),i.left=r,i.isSelection&&(i.isSelection=!1,this.renderer._setAttr(n(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(n(this.selectionRect),{stroke:"transparent"}))):i.dragTarget.parentNode.id==="rightslider"||h==this._id+"thumbright"?(i.grabbed=!1,i.diff>=0&&i.diff<=1&&i.switched==!1&&i.leftdiff>0?(i.target=i.leftSlider,i.switched=!0,i.edge=!0,i._grab(t),i._drag(t)):(r>=this.leftSliderPosition?(i.setSliderPositions(null,null,r),this.rightSliderPosition=r):(i.setSliderPositions(null,null,this.leftSliderPosition),this.rightSliderPosition=this.leftSliderPosition),(i.diff>=1||i.diff<=-1)&&(i.switched=!1)),i.right=r,i.isSelection&&(i.isSelection=!1,this.renderer._setAttr(n(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(n(this.selectionRect),{stroke:"transparent"}))):i.dragTarget.parentNode.id!=="centerslider"&&i.dragTarget.parentNode.id!=="highlightRect"+this._id||i.isSelection?i.isSelection&&(this.rect=this.selectionRect,this._highlight.call(this,i,t),i.grabbed=!1):(n("#highlightRect"+this._id).hide(),r<this.padding&&(r=parseFloat(this.padding)),i.grabbed?i.grabbed=!1:(i.setSliderPositions(null,r,null),i.center=r),r>r+this.renderer._getAttrVal(n(i.dragTarget),"width")&&i.setSliderPositions(null,r,null))}},_highlight:function(i,r){var e=[],f=[],y=this.sliderHeight,l=i.startX>i.mouseDownX?i.mouseDownX:i.startX,p=i.startX==l?i.mouseDownX:i.startX,w=i.mouseDownY,o,a,v,s,h,k=this.model.labelSettings.higherLevel.labelPlacement,b=this.model.labelSettings.lowerLevel.visible,u,c;targetId=r.target.parentNode.id;n.each(i.labelRegions,function(n,t){o=t.X;a=t.Y;v=t.Width;s=t.LabelType=="higherLevel";h=s?targetId.indexOf("higherLevel")<0&&b?t.Height:y:t.Height;l<=o+v&&o<=p&&a+h>=w&&(s?f.indexOf(t)>-1||f.push(t):e.indexOf(t)>-1||e.push(t))});c=function(n){if(n.length>0){min=n[0].X;max=n[0].X;u=n[0];maximumRegion=n[0];for(var t=0;t<n.length;t++)n[t].X<min?(min=n[t].X,u=n[t]):n[t].X>max&&(max=n[t].X,maximumRegion=n[t])}};f.length>0?c(f):c(e);t.isNullOrUndefined(u)||(n("#"+this.rect.parentNode.id).show(),this.renderer._setAttr(n(this.rect),{transform:"translate("+u.X+","+this.sliderPosition+")",width:maximumRegion.Width+maximumRegion.X-u.X}))},_drop:function(t){var p,r,l,s,f,o,u,e,y;if(n("#highlightRect"+this._id).hide(),this._sliderMove=!1,this.dragTarget){if(p=t.target,this._sliderHover=!1,r=this,r.model.allowSnapping&&parseInt(r.leftSlider.getBoundingClientRect().left+2)<parseInt(r.rightSlider.getBoundingClientRect().left)||r.isSelection){l=parseInt(r.model.padding);s=r.isSelection?r.rect.getBoundingClientRect():0;r.ismouseup=!0;r.dragTarget.parentNode.id==="leftslider"?f=r.left:r.dragTarget.parentNode.id==="rightslider"?f=r.right:r.isSelection?f=Math.abs(parseFloat(s.left-n("#"+this._id)[0].getBoundingClientRect().left+l)):r.dragTarget.parentNode.id==="centerslider"&&(f=r.leftSliderPosition,o=r.rightSliderPosition);var a=0,v=0,w=r._lowerLineLeft.length,h,c;for(u=0;u<r._lowerLineLeft.length;u++)if(u+1<r._lowerLineLeft.length&&f>=r._lowerLineLeft[u]&&f<r._lowerLineLeft[u+1]){if(r.snapValue=r._lowerLineLeft[u],a=r._lowerLineLeft[u+1]-r.snapValue,r.dragTarget.parentNode.id==="centerslider"){for(e=u+1;e<r._lowerLineLeft.length;e++)e+1<r._lowerLineLeft.length&&o>=r._lowerLineLeft[e]&&o<r._lowerLineLeft[e+1]&&(h=r._lowerLineLeft[e],c=r._lowerLineLeft[e+1],v=c-h);o=o>=h+v/2?c:h}f>=r.snapValue+a/2?(r.snapValue=r._lowerLineLeft[u+1],r.dragTarget.parentNode.id==="leftslider"?r.setSliderPositions(r._lowerLineLeft[u+1],null,null):r.dragTarget.parentNode.id==="rightslider"?r.setSliderPositions(null,null,r._lowerLineLeft[u+1]):r.isSelection?(r.setSliderPositions(null,null,r._lowerLineLeft[u+1]+parseFloat(s.right-s.left)),r.setSliderPositions(r._lowerLineLeft[u+1],null,null)):r.dragTarget.parentNode.id!=="centerslider"||r.grabbed||(r.setSliderPositions(null,null,o),r.setSliderPositions(r._lowerLineLeft[u+1],null,null))):(r.snapValue=r._lowerLineLeft[u],r.dragTarget.parentNode.id==="leftslider"?r.setSliderPositions(r._lowerLineLeft[u],null,null):r.dragTarget.parentNode.id==="rightslider"?r.setSliderPositions(null,null,r._lowerLineLeft[u]):r.isSelection?(r.setSliderPositions(null,null,r._lowerLineLeft[u]+parseFloat(s.right-s.left)),r.setSliderPositions(r._lowerLineLeft[u],null,null)):r.dragTarget.parentNode.id!=="centerslider"||r.grabbed||(r.setSliderPositions(null,null,o),r.setSliderPositions(r._lowerLineLeft[u],null,null)))}else u+1===r._lowerLineLeft.length&&f>=r._lowerLineLeft[u]&&(r.isSelection?(r.setSliderPositions(null,null,r._lowerLineLeft[u]+parseFloat(r.rect.getBoundingClientRect().width)),r.setSliderPositions(r._lowerLineLeft[u],null,null)):r.setSliderPositions(null,null,r.newWidth-r.padding))}this.dragTarget=null;this.leftTooltip!=i&&this.model.tooltipSettings.tooltipDisplayMode=="always"?(this.leftTooltip.setAttribute("opacity",1),this.rightTooltip.setAttribute("opacity",1)):this.leftTooltip!=i&&this.model.tooltipSettings.tooltipDisplayMode=="ondemand"&&(this.isTouch(t)?(y=[this.leftTooltip,this.rightTooltip],window.clearTimeout(this.model.timer),this.model.timer=setTimeout(function(){n(y).fadeOut(500)},1200)):(this.leftTooltip.setAttribute("opacity",0),this.rightTooltip.setAttribute("opacity",0)));this.model.enableDeferredUpdate&&(this._calculateSelectedData(),(!r.grabbed||r.isSelection)&&(this._calculateSliderZoomFactPosition(),this.model.valueType=="datetime"?(this.startDateTime.getTime()!==new Date(this.model.selectedRangeSettings.start).getTime()||this.endDateTime.getTime()!==new Date(this.model.selectedRangeSettings.end).getTime())&&this._trigger("rangeChanged",this.model):(this.startValue!==this.model.selectedRangeSettings.start||this.endValue!==this.model.selectedRangeSettings.end)&&this._trigger("rangeChanged",this.model)));r.isSelection&&(r.isSelection=!1,this.renderer._setAttr(n(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(n(this.selectionRect),{stroke:"transparent"}))}this._setSelectedRange()},mouseup:function(n){this.dragTarget!=null&&(this._drop(n),this.dragTarget!=null&&(this.dragTarget.setAttributeNS(null,"pointer-events","all"),this.dragTarget=null),this.model.enableDeferredUpdate&&(this._calculateSelectedData(),this._calculateSliderZoomFactPosition(),this._trigger("rangeChanged",this.model)))},_setSelectedRange:function(){this._selectedRangeStart(this.model.selectedRangeSettings.start);this._selectedRangeEnd(this.model.selectedRangeSettings.end)},GetTrueCoords:function(n){var t=this.svgDocument.currentScale,i=this.svgDocument.currentTranslate,r=jQuery.uaMatch(navigator.userAgent);n.originalEvent.toString()!=="[object TouchEvent]"&&r.browser.toLowerCase()!="msie"?(this.trueCoords.x=(n.clientX-i.x)/t,this.trueCoords.y=(n.clientY-i.y)/t):r.browser.toLowerCase()=="msie"?(this.trueCoords.x=(n.originalEvent.clientX-i.x)/t,this.trueCoords.y=(n.originalEvent.clientY-i.y)/t):(this.trueCoords.x=(n.originalEvent.touches[0].clientX-i.x)/t,this.trueCoords.y=(n.originalEvent.touches[0].clientY-i.y)/t)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.datavisualization.RangeNavigator.Locale=t.datavisualization.RangeNavigator.Locale||{};t.datavisualization.RangeNavigator.Locale["default"]=t.datavisualization.RangeNavigator.Locale["en-US"]={intervals:{quarter:{longQuarters:"Quarter",shortQuarters:"Q"},week:{longWeeks:"Week",shortWeeks:"W"}}};t.datavisualization.RangeNavigator.Locale["fr-FR"]={intervals:{quarter:{longQuarters:"Trimestre",shortQuarters:"T"},week:{longWeeks:"Semaine",shortWeeks:"S"}}};t.datavisualization.RangeNavigator.IntervalType={Auto:"auto",Years:"years",Quarters:"quarters",Months:"months",Weeks:"weeks",Days:"days",Hours:"hours",Minutes:"minutes"};t.datavisualization.RangeNavigator.Position={Top:"top",Bottom:"bottom"};t.datavisualization.RangeNavigator.FontStyle={Normal:"normal",Italic:"italic",Bold:"bold"};t.datavisualization.RangeNavigator.FontWeight={Regular:"regular",Bold:"bold",Lighter:"lighter"};t.datavisualization.RangeNavigator.HorizontalAlignment={Left:"left",Right:"right",Middle:"middle"};t.datavisualization.RangeNavigator.LabelPlacement={Inside:"inside",Outside:"outside"};t.datavisualization.RangeNavigator.ValueType={Numeric:"numeric",Datetime:"datetime"};t.datavisualization.RangeNavigator.RangePadding={Additional:"additional",Normal:"normal",None:"none",Round:"round"};t.datavisualization.RangeNavigator.Theme={Azure:"azure",FlatLight:"flatlight",Azuredark:"azuredark",Lime:"lime",LimeDark:"limedark",Saffron:"saffron",SaffronDark:"saffrondark",GradientLight:"gradientlight",GradientDark:"gradientdark"}}(jQuery,Syncfusion);jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}},function(t,r,u){r.widget({ejMap:"ej.datavisualization.Map"},{validTags:["div"],_initPrivateProperties:function(){this._rootgroup=null;this._bubblegroup=null;this._scale=1;this._prevDistance=0;this._tileTranslatePoint={x:0,y:0};this._translatePoint={x:0,y:0};this._prevPoint=null;this._Tiles=[];this._prevScale=0;this._tileDiv=null;this._containerWidth=500;this._containerHeight=400;this._baseTranslatePoint={x:0,y:0};this._isDragging=!1;this._prevLevel=1;this._startPoint={x:0,y:0};this._stopPoint={x:0,y:0};this.mouseClickable=!1;this._browser=null;this._baseScale=0;this._mapBounds=null;this._svgns="http://www.w3.org/2000/svg";this._ispanning=!1;this._dragStartX=0;this._isNavigationPressed=!1;this._iskeyboardKeysPressed=!1;this._isPolygonSelected=!1;this._dragStartY=0;this._width=350;this._height=350;this._isMapCoordinates=!0;this._margintop=0;this._marginleft=0;this._svgDocument=null;this._tooltipElement=null;this._templateDiv=null;this._scrollLegendDiv=null;this._legendContainer=null;this._legendDiv=null;this._legendDivHeight=0;this._legendDivWidth=0;this._mapContainer=null;this._isSVG=!0;this._VMLPathFractionCount=0;this._sliderControl=null;this._isTileMap=!1;this._isRendered=!1;this._urlTemplate=null;this._polylineCount=0;this._pointscount=0;this._isPinching=!1;this._groupSize=null;this._groupBorder={x:0,y:0}},defaults:{locale:null,enableGroupSeparator:!1,background:"transparent",zoomSettings:{minValue:1,maxValue:100,factor:1,level:1,enableZoomOnSelection:!1,enableZoom:!0},centerPosition:null,enableResize:!0,isResponsive:!0,enableAnimation:!1,draggingOnSelection:!1,navigationControl:{enableNavigation:!1,content:null,orientation:"vertical",absolutePosition:{x:0,y:0},dockPosition:"centerleft"},enableLayerChangeAnimation:!1,enablePan:!0,zoomLevel:1,minZoom:1,maxZoom:100,zoomFactor:1,baseMapIndex:0,shapeSelected:"",markerSelected:"",zoomedIn:"",onRenderComplete:"",refreshed:"",panned:"",zoomedOut:"",mouseover:"",mouseleave:"",layers:[]},observables:["baseMapIndex","enablePan","enableResize","enableAnimation","zoomLevel","minZoom","maxZoom","zoomFactor",],_zoomLevel:r.util.valueFunction("zoomLevel"),_minZoom:r.util.valueFunction("minZoom"),_maxZoom:r.util.valueFunction("maxZoom"),_zoomFactor:r.util.valueFunction("zoomFactor"),baseMapIndex:r.util.valueFunction("baseMapIndex"),enablePan:r.util.valueFunction("enablePan"),enableResize:r.util.valueFunction("enableResize"),enableAnimation:r.util.valueFunction("enableAnimation"),_tags:[{tag:"layers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","labelSettings.showLabels","labelSettings.labelPath","labelSettings.enableSmartLabel","legendSettings.leftLabel","legendSettings.rightLabel","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.maxValue","bubbleSettings.color","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient","shapeSettings.colorPalette","shapeSettings.customPalette",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","gradientColors"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"},{tag:"subLayers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","legendSettings.leftLabel","legendSettings.rightLabel","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.maxValue","bubbleSettings.color","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","key","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","highlightcolor"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"}],],singular:"subLayer"}]],singular:"layer"}],dataTypes:{layers:"array"},_destroy:function(){this._unWireEvents();_isSVG?t(this.element).removeClass("e-datavisualization-map e-js").find("#svgDocument").remove():t(this.element).removeClass("e-datavisualization-map e-js").find("#rootGroup").remove()},_setModel:function(n){var i,r;for(i in n)switch(i){case"zoomSettings":this.model.zoomSettings.enableZoom&&(this._zoomLevel(this.model.zoomSettings.level),this._zoomFactor(this.model.zoomSettings.factor),this._maxZoom(this.model.zoomSettings.maxValue),this._minZoom(this.model.zoomSettings.minValue),this.zoom(this._zoomLevel()));break;case"zoomLevel":this.model.zoomSettings.level=this._zoomLevel();this.zoom(this._zoomLevel());break;case"zoomFactor":this.model.zoomSettings.factor=this._zoomFactor();this.zoom(this._zoomLevel());break;case"minZoom":this.model.zoomSettings.minValue=this._minZoom();this.zoom(this._zoomLevel());break;case"maxZoom":this.model.zoomSettings.maxValue=this._maxZoom();this.zoom(this._zoomLevel());break;case"baseMapIndex":this.baseMapIndex(n[i]);r=this;this._groupSize=null;this.enableAnimation()?(this.model.enableLayerChangeAnimation=!0,t(this._mapContainer).animate({opacity:0},500,function(){r.refresh(!0)})):this.refresh(!0);break;case"background":baseLayer.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background)}},_layers:function(n,t){t=="shapeSettings.fill"||t=="shapeSettings.strokeThickness"||t=="shapeSettings.selectionColor"||t=="shapeSettings.highlightColor"?this.clearShapeSelection():t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh(!0)},_layers_markers:function(){this.refreshMarkers()},_layers_subLayers:function(n,t){t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh(!0)},_init:function(){var n=this;this._navigationStyle=null;this.navigationControlData=null;this._initPrivateProperties();this._setZoomProperties();this._localizedLabels=this._getLocalizedLabels();t.each(this.model.layers,function(t){n._layerInitialize(t)});this._mapContainer=this.element;t(this._mapContainer).css({overflow:"hidden"});document.documentMode==8&&t(this._mapContainer).css({overflow:"hidden",position:"relative"});this._wireEvents();this.refresh();this._trigger("onRenderComplete");this._isRendered=!0;_isSVG&&this.model.enablePan&&t(this._svgDocument).pinchZoom(this._rootgroup,this)},_setZoomProperties:function(){typeof this.model.zoomSettings.factor!="function"&&(this._zoomFactor(this.model.zoomSettings.factor),this._zoomLevel(this.model.zoomSettings.level),this._minZoom(this.model.zoomSettings.minValue),this._maxZoom(this.model.zoomSettings.maxValue))},_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},_layerInitialize:function(n){var i=this;this.model.layers[n]!=null?t.each(this.model.layers,function(n,r){r=i._checkArrayObject(r,n);var u=new f;t.extend(u,r);t.extend(r,u);t.each(r.subLayers,function(n,r){r=i._checkArrayObject(r,n);var u=new f;t.extend(u,r);t.extend(r,u)})}):this.layers[0]=new f},_checkArrayObject:function(n,i){var u=["background","zoomSettings","bubbleSettings","minValue","maxValue","factor","level","enableZoomOnSelection","enableZoom","centerPosition","enableResize","isResponsive","enableAnimation","draggingOnSelection","navigationControl","enableNavigation","orientation","absolutePosition","dockPosition","enablePan","baseMapIndex","enableSelection","selectionMode","enableMouseHover","shapeData","dataSource","showTooltip","legendSettings","showLegend","showLabels","position","height","width","type","mode","dockOnMap","dockPosition","labelSettings","labelPath","enableSmartLabel","smartLabelSize","layerType","showMapItems","shapeSettings","highlightColor","highlightBorderWidth","selectionColor","fill","strokeThickness","stroke","highlightStroke","selectionStroke","selectionStrokeWidth","colorValuePath","valuePath","enableGradient","autoFill",""],r=this;return t.each(n,function(n,t){if(u.indexOf(n)>-1)if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new f;r._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),n},_loadIndividualDefaultValues:function(n,i,r){var u=null,f=this;return t.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),t.each(n,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),t.extend(u,n),t.extend(n,u),n},_refreshWithAnimation:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPositionWithAnimation(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPositionWithAnimation(this)},_resizeShape:function(){this.model.layers[this.baseMapIndex()]._resizeShapes(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._resizeShapes(this)},_refrshLayers:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPosition(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPosition(this)},_panTileMap:function(n,t,i){var u=Math.pow(2,this._zoomLevel())*256,r;this._tileTranslatePoint.x=n/2-u/2;this._tileTranslatePoint.y=t/2-u/2;r=this._convertTileLatLongtoPoint(i[0],i[1]);this._tileTranslatePoint.x-=r.x-n/2;this._tileTranslatePoint.y-=r.y-t/2},_generateTiles:function(n){var w=navigator.language||navigator.userLanguage,b,k,f,o,s,h,i,p,c,u,l,a,v;this.Tiles=[];b=k=Math.pow(2,n);var y=this.model.layers[this.baseMapIndex()],d=Math.min(k,(-this._tileTranslatePoint.y+this._height)/256+1),g=Math.min(b,(-this._tileTranslatePoint.x+this._width)/256+1),nt=-(this._tileTranslatePoint.x+256)/256,tt=-(this._tileTranslatePoint.y+256)/256;for(f=Math.round(nt);f<Math.round(g);f++)for(o=Math.round(tt);o<Math.round(d);o++)s=256*f+this._tileTranslatePoint.x,h=256*o+this._tileTranslatePoint.y,s>-256&&s<=this._width&&h>-256&&h<this._height&&f>=0&&o>=0&&(i=new e(f,o),i.left=s,i.top=h,i.src=y.layerType==r.datavisualization.Map.LayerType.Bing?this._getBingMap(i,y.key,y.bingMapType,w):this._urlTemplate.replace("level",this._zoomLevel()).replace("tileX",i.X).replace("tileY",i.Y),this.Tiles.push(i));for(p=t.extend(!0,[],this.Tiles),c=0;c<this.model.layers[this.baseMapIndex()].subLayers.length;c++)if(u=this.model.layers[this.baseMapIndex()].subLayers[c],u.layerType==r.datavisualization.Map.LayerType.OSM||u.layerType==r.datavisualization.Map.LayerType.Bing)for(l=0;l<p.length;l++)a=p[l],v=t.extend(!0,{},a),v.src=u.layerType==r.datavisualization.Map.LayerType.Bing?this._getBingMap(v,u.key,u.bingMapType,w):u.urlTemplate.replace("level",this._zoomLevel()).replace("tileX",a.X).replace("tileY",a.Y),this.Tiles.push(v);this._arrangeTiles()},_getBingMap:function(n,t,i,u){for(var f,s,h,e="",o=this._zoomLevel();o>0;o--)f=0,s=1<<o-1,(n.X&s)!=0&&f++,(n.Y&s)!=0&&(f+=2),e=e+""+f;return h=i==r.datavisualization.Map.BingMapType.Aerial?"A,G":i==r.datavisualization.Map.BingMapType.AerialWithLabel?"A,G,L":"G,VE,BX,L,LA","http://ak.dynamic.t2.tiles.virtualearth.net/comp/ch/"+e+"?mkt="+u+"&ur=IN&it="+h+"&shading=hill&og=45&n=z&Key="+t},_arrangeTiles:function(){var n=t.templates("<div><div style='position:absolute;left:{{:left}}px;top:{{:top}}px;height:{{:height}}px;width:{{:width}}px;'><img src={{:src}}><\/img><\/div><\/div>"),i=n.render(this.Tiles),r=this._mapContainer[0].children[0];this._tileDiv.html(i)},_generatePath:function(){var n=this.model.layers[this.baseMapIndex()],f="",i,e,o;for(this._polylineCount=0,this._pointscount=0,_isSVG=window.SVGSVGElement?!0:!1,n.layerType==r.datavisualization.Map.LayerType.Geometry?n!=u&&n.shapeData!=null&&(n._isBaseLayer=!0,this._isTileMap=!1,this._scale=this._zoomLevel(),f=this._readShapeData(n)):(this._isTileMap=!0,this._scale=Math.pow(2,this._zoomLevel()-this._zoomFactor())),i=0;i<n.subLayers.length;i++)n.subLayers[i].layerType==r.datavisualization.Map.LayerType.Geometry&&n.subLayers[i].shapeData!=null&&(n.subLayers[i]._isBaseLayer=!1,f+=this._readShapeData(n.subLayers[i]));_isSVG?(e='<div style="position:relative;" id="tileDiv"/><svg xmlns="http://www.w3.org/2000/svg" style= "overflow:hidden;z-index:0;float:left;left:0,top:0"id="svgDocument"> <g id="rootGroup">'+f+"<\/g><\/svg>",this._mapContainer.html(e),this._svgDocument=this.element.find("#svgDocument")[0],this._tileDiv=this.element.find("#tileDiv")):(document.createStyleSheet().addRule(".vml","behavior:url(#default#VML);display:inline-block"),document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),o='<div id="tileDiv"/><v:group id = "rootGroup" style="position:absolute; width:'+this._width+"px;height:"+this._height+'px;" coordorigin = "0 0" coordsize="'+this._width+" "+this._height+'">'+f+"<\/v:group>",this._mapContainer.html(o),this._tileDiv=this.element.find("#tileDiv"),this._bubblegroup=this._createGroup(!1,"bubbleGroup"),this._bubblegroup.style.position="absolute",this.element.append(this._bubblegroup));(n.layerType==r.datavisualization.Map.LayerType.OSM||n.layerType==r.datavisualization.Map.LayerType.Bing)&&(this._urlTemplate=n.urlTemplate,this.model.centerPosition!=null?this._panTileMap(this._width,this._height,this.model.centerPosition):this._panTileMap(this._width,this._height,[0,0]),this._generateTiles(this._zoomLevel()),_isSVG&&t(this._svgDocument).css("position","relative"));_isSVG&&t(this._mapContainer).css("position","relative");this._rootgroup=this.element.find("#rootGroup")[0];this._on(t(this.element),r.eventType.mouseDown,{map:this},this.dragDown);this._on(t(this.element),r.eventType.mouseMove,{map:this},this.dragMove);this._on(t(this.element),r.eventType.mouseUp,{map:this},this.dragUp)},_calculateBBox:function(n,t,i){var f=maxLatitude=minLongitude=maxLongitude=0,o=!1,l,c,r,h,e,s,u;if(n!=null&&n.length>0)for(e=0;e<n.length;e++)for(h=n[e],coords=h.geometry!=null?h.geometry.coordinates:h.coordinates,l=coords.length,c=0;c<l;c++)if(r="",l>1?(r=coords[c][0],r.length<=2&&(r=coords[c])):r=coords[c],r.length>2)for(u=0;u<r.length;u++)r[u][1]!=null&&r[u][0]!=null&&(o?(f=Math.min(f,r[u][1]),maxLatitude=Math.max(maxLatitude,r[u][1]),minLongitude=Math.min(minLongitude,r[u][0]),maxLongitude=Math.max(maxLongitude,r[u][0])):(f=maxLatitude=r[u][1],minLongitude=maxLongitude=r[u][0],o=!0));else r[u][1]!=null&&r[u][0]!=null&&(o?(f=Math.min(f,r[1]),maxLatitude=Math.max(maxLatitude,r[1]),minLongitude=Math.min(minLongitude,r[0]),maxLongitude=Math.max(maxLongitude,r[0])):(f=maxLatitude=r[1],minLongitude=maxLongitude=r[0],o=!0));if(i!=null&&i.length>0)for(e=0;e<i.length;e++)h=i[e],r=h.geometry.coordinates,o?(f=Math.min(f,r[1]),maxLatitude=Math.max(maxLatitude,r[1]),minLongitude=Math.min(minLongitude,r[0]),maxLongitude=Math.max(maxLongitude,r[0])):(f=maxLatitude=r[1],minLongitude=maxLongitude=r[0],o=!0);if(t!=null&&t.length>0)for(e=0;e<t.length;e++)for(s=t[e].geometry==null?t[e].coordinates:t[e].geometry.coordinates,u=0;u<s.length;u++)o?(f=Math.min(f,s[u][1]),maxLatitude=Math.max(maxLatitude,s[u][1]),minLongitude=Math.min(minLongitude,s[u][0]),maxLongitude=Math.max(maxLongitude,s[u][0])):(f=maxLatitude=s[u][1],minLongitude=maxLongitude=s[u][0],o=!0);return this._groupSize!=null||this._isMapCoordinates||(this._groupSize={minX:minLongitude,maxX:maxLongitude,minY:f,maxY:maxLatitude}),[[minLongitude,f],[maxLongitude,maxLatitude]]},_readShapeData:function(n){var u=this,t,i;if(n.shapeData!=null)if(typeof n.shapeData=="string")t=new r.DataManager(n.shapeData),i=r.Query().from(n),t.executeQuery(i).done(function(t){if(t.result!=null)return u._getPathCollection(t.result,n)});else return this._getPathCollection(n.shapeData,n)},_getFactor:function(){var n,t,i,r;if(this._mapBounds!=null){var u=this._convertTileLatLongtoPointForShapes(this._mapBounds[0][1],this._mapBounds[0][0],this._mapBounds),f=this._convertTileLatLongtoPointForShapes(this._mapBounds[1][1],this._mapBounds[1][0],this._mapBounds),r=i=1;n=f.y-u.y;t=f.x-u.x}else n=500,t=500;return i=n<this._height?parseFloat(Math.abs(this._height/n+"e+1").toString().split(".")[0]/10):this._height/n,r=t<this._width?parseFloat(Math.abs(this._width/t+"e+1").toString().split(".")[0]/10):this._width/t,Math.min(r,i)},_getPathCollection:function(n,i){var vt="",it="",rt="",ct,h,c,l,a,g,ii,wt,ut,yt,pt,nt,lt,at,et,y,tt,s,n,u,ft,o,v,f,e,st,ht,p,ot,w,bt;if(n.features!=null?(rt=new r.DataManager(n.features),it="geometry.type",i._isBaseLayer&&(this._mapBounds=n.bbox)):n.geometries!=null&&(rt=new r.DataManager(n.geometries),it="type",i._isBaseLayer&&n.bbox!=null&&(this._mapBounds=[[n.bbox[0],n.bbox[1]],[n.bbox[2],n.bbox[3]]])),n.geometries!=null||n.features!=null){var kt=r.Query().from(i).where(it,r.FilterOperators.equal,"LineString"),dt=r.Query().from(i).where(it,r.FilterOperators.equal,"Polygon"),gt=r.Query().from(i).where(it,r.FilterOperators.equal,"MultiPolygon"),b=rt.executeLocal(kt),k=rt.executeLocal(dt),ni=r.Query().from(i).where(it,r.FilterOperators.equal,"Point"),d=rt.executeLocal(ni),ti=rt.executeLocal(gt);if(this._polylineCount=this._polylineCount+b.length,this._pointscount=this._pointscount+d.length,t.merge(k,ti),i._isBaseLayer&&i.geometryType==r.datavisualization.Map.GeometryType.Normal&&(this._isMapCoordinates=!1),this._mapBounds==null&&i._isBaseLayer?this._mapBounds=this._calculateBBox(k,b,d):this._mapBounds==null&&(this._mapBounds=[[-180,-85],[180,85]]),ot=this._getFactor(),i._newBounds=[],ct="",this._groupSize!=null&&(h=this._groupSize.minX,c=this._groupSize.maxX,l=this._groupSize.minY,a=this._groupSize.maxY),g=!0,d.length>0)for(e=0;e<d.length;e++)ut=d[e],ii="",s=ut.geometry.coordinates,n=[],u=[],n.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])}),ft=0,o=n[0],latitude=o.lat,longitude=o.lng,f=this._convertTileLatLongtoPointForShapes(latitude,longitude,this._mapBounds,ot),v=this._mapBounds,longitude>=v[0][0]&&longitude<=v[1][0]&&latitude>=v[0][1]&&latitude<=v[1][1]?(g&&this._groupSize==null?(h=c=f.x,l=a=f.y,g=!1):(h=Math.min(h,f.x),c=Math.max(c,f.x),l=Math.min(l,f.y),a=Math.max(a,f.y)),_isSVG?u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}):u.push({x:f.x-5/this._scale,y:f.y-5/this._scale,lat:o.lat,lng:o.lng}),_isSVG?ct+='<circle cx="'+u[0].x+'" cy="'+u[0].y+'" r="'+i.shapeSettings.radius/this._scale+'" stroke="'+i.shapeSettings.stroke+'" stroke-width="'+i.shapeSettings.strokeThickness+'" fill="'+i.shapeSettings.fill+'" />':(wt='<v:oval display="block" fill="'+i.shapeSettings.fill+'" style="position:absolute;top: '+u[0].y+"px;left:"+u[0].x+"px;width:"+10/this._scale+"px;height:"+10/this._scale+"px;stroke-width:"+i.shapeSettings.strokeThickness+'px;"><\/v:oval>',ct+=wt)):(d.splice(e,1),e--);if(k.length>0)for(e=0;e<k.length;e++){if(ut=k[e],yt=0,nt=ut.geometry!=null?ut.geometry.coordinates:ut.coordinates,pt=nt[0][0].length,lt=nt.length,lt>1)for(at=nt,et=0;et<at.length;et++)pt<at[et][0].length&&(pt=at[et][0].length,yt=et);for(y="",tt=0;tt<lt;tt++){if(s="",lt>1?(s=nt[tt][0],s.length<=2&&(s=nt[tt])):s=nt[tt],n=[],u=[],s.length>2)for(p=0;p<s.length;p++)n.push({lat:parseFloat(s[p][1]),lng:parseFloat(s[p][0])});else n.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])});for(ft=0;ft<n.length-1||n.length==1&&ft==0;ft++)o=n[ft],latitude=o.lat,longitude=o.lng,v=this._mapBounds,(this._isTileMap||longitude>=v[0][0]&&longitude<=v[1][0]&&latitude>=v[0][1]&&latitude<=v[1][1])&&(f=this._convertTileLatLongtoPointForShapes(latitude,longitude,v,ot),g&&this._groupSize==null?(h=c=f.x,l=a=f.y,g=!1):(h=Math.min(h,f.x),c=Math.max(c,f.x),l=Math.min(l,f.y),a=Math.max(a,f.y)),_isSVG?u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}):u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}));if(tt==yt&&i._newBounds.push(this._findMidPointofPoylgon(u)),u.length>0)if(_isSVG){for(y+="M"+u[0].x+","+u[0].y,m=1;m<u.length;m++)y+=","+u[m].x+","+u[m].y;y+="Z"}else{for(y+="m"+parseInt(u[0].x)+","+parseInt(u[0].y),y+=" l"+parseInt(u[0].x)+","+parseInt(u[0].y),m=1;m<u.length;m++)y+=","+parseInt(u[m].x)+","+parseInt(u[m].y);y+=" e"}}y!=""?vt+=_isSVG?'<path class="mapShape" stroke='+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+" fill= "+i.shapeSettings.fill+' d="'+y+'" stroke-linejoin= round stroke-linecap= square><\/path>':'<v:shape style="width:'+this._width+"px;height:"+this._height+'px;" coordsize="'+this._width+" "+this._height+'" coordorigin="0 0" strokecolor='+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+'px" fillcolor= '+i.shapeSettings.fill+' path="'+y+'"><\/v:shape>':(k.splice(e,1),e--)}if(b.length>0)for(e=0;e<b.length;e++){for(st=b[e].geometry==null?b[e].coordinates:b[e].geometry.coordinates,ht="",p=0;p<st.length;p++)ot=this._getFactor(),w=this._convertTileLatLongtoPointForShapes(st[p][1],st[p][0],this._mapBounds,ot),g&&this._groupSize==null?(h=c=w.x,l=a=w.y,g=!1):(h=Math.min(h,w.x),c=Math.max(c,w.x),l=Math.min(l,w.y),a=Math.max(a,w.y)),ht+=w.x+","+w.y,p!=st.length-1&&(ht+=",");vt+=_isSVG?"<polyline stroke="+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+' fill="transparent" stroke-width="1" points="'+ht+'" ><\/polyline>':'<v:polyline coordsize="'+this._width+","+this._height+'" coordorigin="0 0" strokecolor='+i.shapeSettings.stroke+" strokeweight="+i.shapeSettings.strokeThickness/this._scale+'px" fillcolor='+i.shapeSettings.fill+' points="'+ht+'"/>'}return this._isMapCoordinates&&(this._groupSize={minX:h,maxX:c,minY:l,maxY:a}),bt=[].concat(k,b),i._polygonData=t.merge(bt,d),vt+ct}return i._polygonData=[],null},_createGroup:function(n,t){var i;return i=document.createElement("<v:group class="+t+">"),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,n&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_generatePaletteColorsForShape:function(n,t,i,r){r!=null&&(t.shapeSettings.highlightColor=r.highlightColor,t.shapeSettings.highlightStroke=r.highlightStroke,t.shapeSettings.selectionColor=r.SelectionColor,t.shapeSettings.selectionStroke=r.SelectionStroke);_isSVG?n.setAttribute("fill",i[t._prevPaletteIndex]):n.fillcolor=i[t._prevPaletteIndex];t._prevPaletteIndex=t._prevPaletteIndex+1;t._prevPaletteIndex>i.length-1&&(t._prevPaletteIndex=0)},_renderLayers:function(n,i){var k,w,rt,kt,d,y,lt,g,at,e,l,p,vt,yt,b,ii,pt,s,a,ot,st,ri,ui,h,wt,fi,ht,nt,bt,c,ct,v;n._prevPaletteIndex=0;n._initializeLocalValues();n.selectedItems==null&&(n.selectedItems=[]);var oi=this._rootgroup,ei=this._svgDocument,o=this,f=n;f.legendSettings!=null&&f.shapeSettings.colorMappings!=null&&(f.legendSettings.type==u||f.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&f._generateLegends(this);f.legendSettings!=null&&f.bubbleSettings.colorMappings!=null&&f.legendSettings.type==r.datavisualization.Map.LegendType.Bubbles&&f._generateBubbleLegends(this);f.shapeSettings.colorMappings!=null&&f.shapeSettings.colorMappings.rangeColorMapping!=null&&f.shapeSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);f.bubbleSettings.colorMappings!=null&&f.bubbleSettings.colorMappings.rangeColorMapping!=null&&f.bubbleSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);var tt=0,it=0;if(f.dataSource!=null&&f.bubbleSettings!=null)for(f.bubbleSettings.colorValuePath==null&&(f.bubbleSettings.colorValuePath=f.bubbleSettings.valuePath),k=0;k<f.dataSource.length;k++)w=parseFloat(this._reflection(f.dataSource[k],f.bubbleSettings.valuePath)),k!=0?w>it?it=w:w<tt&&(tt=w):tt=it=w;if(this._generateTooltipForLayers(f),f.shapeData!=null){if(rt=[],f.dataSource!=null)for(a=0;a<f.dataSource.length;a++)kt=f.dataSource[a],d=o._reflection(kt,f.shapeDataPath),d!=null&&(d=d.toLowerCase()),rt.push(d);var dt=r.browserInfo(),si=this.model,ut=dt.isMSPointerEnabled,ft=dt.pointerEnabled,et=ut?ft?"pointerup":"MSPointerUp":"touchend mouseup",gt=ut?ft?"pointermove":"MSPointerMove":"touchmove mousemove",ni=ut?ft?"pointerdown":"MSPointerDown":"touchstart mousedown",ti=ut?ft?"pointerleave":"MSPointerOut":"touchend mouseleave";for(y=0;y<f._polygonData.length;y++){if(lt=f._polygonData[y].properties,g=o._reflection(lt,f.shapePropertyPath),g!=null&&typeof g=="string"&&(at=g.toLowerCase()),e=this._rootgroup.childNodes[y+i],_isSVG?e.setAttribute("fill",f.shapeSettings.fill):(e.fillcolor=f.shapeSettings.fill,e.strokecolor=f.shapeSettings.stroke),s={},l=f._newBounds[y],f.shapeSettings.autoFill)switch(f.shapeSettings.colorPalette){case r.datavisualization.Map.ColorPalette.Palette1:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette1,f._colorPaletteSettings.Palette1);break;case r.datavisualization.Map.ColorPalette.Palette2:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette2,f._colorPaletteSettings.Palette2);break;case r.datavisualization.Map.ColorPalette.Palette3:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette3,f._colorPaletteSettings.Palette3);break;case r.datavisualization.Map.ColorPalette.CustomPalette:this._generatePaletteColorsForShape(e,f,f.shapeSettings.customPalette,null)}if(rt.indexOf(at)!=-1&&(p=f.dataSource[rt.indexOf(at)],vt=g,p!=null)){if(e!=null&&(yt=vt),n._bounds.push(l),f.showMapItems){if(b=t("<div class='mapItems' style='display:block;position:absolute;pointer-events: none;'><\/div>"),b[0].className=vt,o._templateDiv.append(b),t(b).css({left:l.x,top:l.y}),pt=this.model.locale,s=t.extend({},p),pt&&this.model.enableGroupSeparator)for(a in s)s[a]=isNaN(parseFloat(s[a]))?s[a]:parseFloat(s[a]).toLocaleString(pt);ii=f.mapItemsTemplate==null?t(" <div><label>{{:"+f.shapeSettings.valuePath+"}}<\/label><\/div>").render(s):t("#"+f.mapItemsTemplate).render(s);t(b).html(ii);n._mapItems.push(b)}f.shapeSettings.colorMappings!=null?(f.shapeSettings.colorValuePath==null&&(f.shapeSettings.colorValuePath=f.shapeSettings.valuePath),ot=o._reflection(p,f.shapeSettings.colorValuePath),ot==null||f.shapeSettings.autoFill||((f.legendSettings!=null&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive||f.shapeSettings.enableGradient)&&f.shapeSettings.colorMappings.rangeColorMapping!=null?(s.legendrect=f._updateLegendRange(ot,f,e),st=f.shapeSettings.fill,s.legendrect!=u&&(st=s.legendrect.color),_isSVG?e.setAttribute("fill",st):e.fillcolor=st):f._fillColors(ot,f.shapeSettings.colorMappings,e))):f.shapeSettings.autoFill||(_isSVG?e.setAttribute("fill",f.shapeSettings.fill):(e.fillcolor=f.shapeSettings.fill,e.strokecolor=f.shapeSettings.stroke));f.bubbleSettings.showBubble&&f.bubbleSettings!=null&&f.bubbleSettings.valuePath!=null&&(_isSVG?h=document.createElementNS(o._svgns,"circle"):(ri="bubble_"+yt,ui='<v:oval class="mapBubble" id='+ri+' display="block" style="position:absolute;top: 0px;left:0px;width:100px;height:100px;stroke-width:0px;"><v:fill opacity="0.9"/><\/v:oval>',this._bubblegroup.innerHTML=this._bubblegroup.innerHTML+ui,h=document.getElementById("bubble_"+yt)),wt=o._reflection(p,f.bubbleSettings.valuePath),fi=o._reflection(p,f.bubbleSettings.colorValuePath),f.bubbleSettings.colorMappings!=null?f._fillColors(fi,f.bubbleSettings.colorMappings,h):_isSVG?h.setAttribute("fill",f.bubbleSettings.color):(h.strokecolor=f.bubbleSettings.color,h.fillcolor=f.bubbleSettings.color),ht=o._getRatioOfBubble(f.bubbleSettings.minValue,f.bubbleSettings.maxValue,wt,tt,it),_isSVG?(t(h).attr({cx:l.x,cy:l.y,"fill-opacity":f.bubbleSettings.bubbleOpacity,r:ht,"class":"mapBubble"}),o.enableAnimation()&&!this._isTileMap&&t(h).css("display","none")):t(h).css({height:2*ht+"px",width:2*ht+"px"}),f.bubbleSettings.showTooltip==!0?(nt=t("<div class='bubbleToolTip' style='position:absolute;display:none;z-index:9999'/>"),bt=null,f.bubbleSettings.tooltipTemplate!=null?bt=f.bubbleSettings.tooltipTemplate:t(nt).append('<div class="bubbleToolTip" style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">'+wt+"<\/label><\/p><\/div><\/div>"),t(h).mouseenter({htmlobj:nt,templateID:bt,itemsrc:p},o._bubbleEnterFunction),t(h).mousemove({htmlobj:nt},o._bubbleOverFunction),t(h).mouseleave({htmlobj:nt},o._bubbleleaveFunction)):t(h).css("pointer-events","none"),_isSVG?(ei.appendChild(h),n._bubbles.push(h)):n._bubbles.push(h));s.data=p}n.labelSettings!=null&&n.labelSettings.showLabels&&n.labelSettings.labelPath!=null&&f.geometryType!=r.datavisualization.Map.GeometryType.Normal&&(ct=o._reflection(lt,n.labelSettings.labelPath),ct!=null&&(l==null,c=t("<div class='labelStyle'><\/div>"),t(c).css({"pointer-events":"none",position:"absolute"}),c[0].innerHTML=ct,this._templateDiv.append(c),n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="top"?t(this._templateDiv).css({"margin-top":n.legendSettings.height}):n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="left"&&t(this._templateDiv).css({"margin-left":n.legendSettings.width}),t(c).css({left:l.x,top:l.y}),o._off(t(c),r.eventType.mouseUp,o._polyClickFunction),o._on(t(c),r.eventType.mouseUp,{Param1:null,Param2:n,Param3:e},o._polyClickFunction),o._off(t(c),r.eventType.mouseLeave,o._polyLeaveFunction),o._on(t(c),r.eventType.mouseLeave,{Param1:n,Param2:s,map:this},o._polyLeaveFunction),c[0].setAttribute("nodeValue",e.getAttribute("fill")),n._labelCollection.push(c),n._labelBounds.push(l),n._labelData.push(ct)));s.shapeIndex=y;s.shape=e;s.shapeData=n._polygonData[y];o._off(t(c),r.eventType.mouseMove,o._polyMoveFunction);o._on(t(c),r.eventType.mouseMove,{Param1:f,Param2:s},o._polyMoveFunction);e!=null&&(v=null,_isSVG?(v=e.getAttribute("fill"),v=="undefined"&&(v=n.shapeSettings.fill),e.setAttribute("nodeValue",v)):(v=e.fillcolor.value,v=="undefined"&&(v=n.shapeSettings.fill),e.style.behavior=v));o.model.zoomSettings.enableZoomOnSelection&&t(e).hover(function(){t(this).css("cursor","pointer")},function(){t(this).css("cursor","auto")});n._mapShapes.push(s);this._off(t(e),"mouseenter touchmove",o._polyEnterFunction);this._on(t(e),"mouseenter touchmove",{Param1:f,Param2:s,map:o},o._polyEnterFunction);this._off(t(e),ni,o._polyMouseDown);this._on(t(e),ni,{Param1:s,Param2:f},o._polyMouseDown);this._off(t(e),et,o._polyClickFunction);this._on(t(e),et,{Param1:s,Param2:f,Param3:e},o._polyClickFunction);this._off(t(e),gt,o._polyMoveFunction);this._on(t(e),gt,{Param1:f,Param2:s,Param3:e},o._polyMoveFunction);this._off(t(e),ti,o._polyLeaveFunction);this._on(t(e),ti,{Param1:f,Param2:s,map:this},o._polyLeaveFunction);this._off(t(e),et,o._polyUpFunction);this._on(t(e),et,{Param1:s,Param2:f,Param3:e},o._polyUpFunction)}}f._isBaseLayer&&f.geometryType==r.datavisualization.Map.GeometryType.Normal&&f.labelSettings.showLabels&&(f._generateLabels(this),f._labelSizeCalculation(this),this._applyTransform(this._scale,this._translatePoint))},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},validateBubblePosition:function(n,t,i){var e=[],o=[],f,u,r;if(n==null&&(n=[],n.push(t)),!this.isPointInPolygon(n,t,!0)){for(f=0,r=0;r<n.length;r++)u={x:(n[r].x+this._translatePoint.x)*this._scale,y:(n[r].y+this._translatePoint.y)*this._scale},(u.y<t.y&&f.y>=t.y||f.y<t.y&&u.y>=t.y)&&(u.x<t.x?e.push(u.x):o.push(u.x)),f=u;if(!e.length>0||!o.length>0){if(e.length>0){for(r=t.x+i;!this.isPointInPolygon(n,{x:r-2,y:t.y},!0);)r=r-2;t.x=parseFloat(r-2-i)}if(o.length>0){for(r=t.x-i;!this.isPointInPolygon(n,{x:r+2,y:t.y},!0);)r=r+2;t.x=parseFloat(r+2+i)}}}return t},isPointInPolygon:function(n,t,i){for(var r,f,o=!1,e=0,u=0;u<n.length;u++){r={x:n[u].x,y:n[u].y};f={x:n[e].x,y:n[e].y};i&&(r={x:(n[u].x+this._translatePoint.x)*this._scale,y:(n[u].y+this._translatePoint.y)*this._scale},f={x:(n[e].x+this._translatePoint.x)*this._scale,y:(n[e].y+this._translatePoint.y)*this._scale});var s=t.y-r.y,h=f.y-r.y,c=f.x-r.x;(r.y<t.y&&f.y>=t.y||f.y<t.y&&r.y>=t.y)&&r.x+s/h*c<t.x&&(o=!0);e=u}return o},dragDown:function(n){var r=n.data.map,t=r.model.layers[0],i=this._mapContainer,u;if(n.type=="mousedown"?(r._startPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop},r._stopPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop}):n.type=="touchstart"?(r._startPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop}):n.type=="MSPointerDown"&&(r._startPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop}),r.mouseClickable=!0,r.model.draggingOnSelection&&t._prevSelectedShapes.length>0){for(u=0;u<t._prevSelectedShapes.length;u++)t._prevSelectedShapes[u].setAttribute("class","mapShape"),_isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t.fillcolor=t._prevSelectedShapes[u].getAttribute("nodeValue"),t.strokecolor=t.shapeSettings.stroke,t.strokeweight=t.shapeSettings.strokeThickness/this._scale);t._prevSelectedShapes=[]}},dragMove:function(n){var i=n.data.map,o=i.model.layers[0],f,e,r=this._mapContainer,u;i.model.draggingOnSelection&&i.mouseClickable&&(i.ispanning=!1,n.type=="mousemove"?i._stopPoint={x:n.pageX-r[0].offsetLeft,y:n.pageY-r[0].offsetTop}:n.type=="touchmove"?i._stopPoint={x:n.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:n.type=="MSPointerMove"&&(i._stopPoint={x:n.originalEvent.pageX-r[0].offsetLeft,y:n.originalEvent.pageY-r[0].offsetTop}),t(".e-mapDragSelection").remove(),u=t('<div class = "e-mapDragSelection"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),t(u).css({top:Math.min(i._startPoint.y,i._stopPoint.y),left:Math.min(i._startPoint.x,i._stopPoint.x),width:f,height:e,position:"absolute","z-index":100}),t(u).appendTo("#maps"))},dragUp:function(n){var i=n.data.map,s=Math.abs(i._stopPoint.x-i._startPoint.x),h=Math.abs(i._stopPoint.y-i._startPoint.y),e=i.model.layers[0],o=this._mapContainer,u,r,f;if(i.model.draggingOnSelection){for(t(".e-mapDragSelection").remove(),t(".e-mapDragSelection").css({display:"none"}),i.mouseClickable=!1,u=0;u<i.model.layers[0]._mapShapes.length;u++)r=i.model.layers[0]._mapShapes[u].shape,f=r.getBoundingClientRect(),f.left-o[0].offsetLeft+f.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+s<f.left-o[0].offsetLeft||f.top-o[0].offsetTop+f.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+h<f.top-o[0].offsetTop||i.model.layers[0]._contains(e._prevSelectedShapes,r)||e._prevSelectedShapes.push(r);for(u=0;u<e._prevSelectedShapes.length;u++)r=e._prevSelectedShapes[u],f=r.getBoundingClientRect(),r.setAttribute("class","e-mapSelectedShape mapShape"),_isSVG&&(r.setAttribute("fill",e.shapeSettings.selectionColor),r.setAttribute("stroke",e.shapeSettings.selectionStroke),r.setAttribute("stroke-width",e.shapeSettings.selectionStrokeWidth/i._scale))}},isIntersectBubbles:function(){for(var r,n,i,t=[],u=0;u<this.model.layers.length;u++)for(r=this.model.layers[u],Array.prototype.push.apply(t,r._bubbleCollection),n=0;n<r.subLayers.length;n++)Array.prototype.push.apply(t,r.subLayers[n]._bubbleCollection);for(n=0;n<t.length;n++){var f=t[n].getAttribute("cx"),e=t[n].getAttribute("cy"),h=t[n].getAttribute("r");for(i=n+1;i<t.length;i++){var o=t[i].getAttribute("cx"),s=t[i].getAttribute("cy"),c=t[i].getAttribute("r"),l=Math.sqrt((f-o)*(f-o)+(e-s)*(e-s)),a=parseFloat(h)+parseFloat(c);if(l<=a)return!0}}return!1},_zooming:function(n,t){var i=this._getCurrentPoint(t);n>=120?this._zoomingIn(i.x,i.y,t):this._zoomingOut(i.x,i.y,t)},_zoomingIn:function(n,t,i){var r=this,f,e,u;r.model.zoomSettings.enableZoom&&r._zoomLevel()>=r._minZoom()&&r._zoomLevel()<=r._maxZoom()&&(f=r._scale,e={x:n,y:t},r._prevScale=f,this._isTileMap?(this._tileZoom(r._zoomLevel()-r._zoomFactor(),r._zoomLevel(),e),u=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor()),this._generateTiles(this._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,u))/Math.pow(2,u),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,u))/Math.pow(2,u),r._scale=Math.pow(2,u)):(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale+r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale+r._zoomFactor()))/(r._height/t),r._scale=f+r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor())),r._trigger("zoomedIn",{originalEvent:i,zoomLevel:r._zoomLevel()}),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue())},_zoomingOut:function(n,t,i){var r=this,u,f,e;r.model.zoomSettings.enableZoom&&(r._zoomLevel()>this._minZoom()?(u=r._scale,f={x:n,y:t},r._prevScale=u,r._isTileMap?(r._tileZoom(r._zoomLevel()+r._zoomFactor(),r._zoomLevel(),f),e=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._generateTiles(r._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._scale=Math.pow(2,r._zoomLevel()-r._zoomFactor())):r._scale>1&&(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale-r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale-r._zoomFactor()))/(r._height/t),r._scale=r._scale-r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._scale=r._zoomLevel()),r._zoomLevel()<r._minZoom()&&(r.model.zoomSettings.level=r._minZoom(),r._zoomLevel(r._minZoom()),r.zoom(r._zoomLevel())),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue()):r.zoom(r._minZoom(),!1),r._trigger("zoomedOut",{originalEvent:i,zoomLevel:r._zoomLevel()}))},_getRatioOfBubble:function(n,t,i,r,u){var e=100/(u-r)*(i-r),f=(parseFloat(t)-parseFloat(n))/100*e+parseFloat(n);return u==r&&(f=(parseFloat(t)-parseFloat(n))/100+parseFloat(n)),f},_reflection:function(n,i){var r=n,f,e,o;if(i!=null&&n!=null){for(f=i.split("."),e=0,f.push(i);e<f.length;e++)n!=u&&r!=null&&(o=r.hasOwnProperty(f[e]),o&&t.each(r,function(n,t){if(n==f[e])return r=t,!1}));return r}return null},clearShapeSelection:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._clearShapeWidth(this._scale),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._clearShapeWidth(this._scale)},shapeSelectionOnResize:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._shapeSelection(),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._shapeSelection()},refreshMarkers:function(){for(var t,i=document.getElementsByClassName("mapMarker"),n=i.length-1;n>=0;n--)i[n].parentNode.removeChild(i[n]);for(n=this.baseMapIndex(),this.model.layers[n]._generateMarkerForLayers(this),t=0;t<this.model.layers[n].subLayers.length;t++)this.model.layers[n].subLayers[t]._generateMarkerForLayers(this);this._refrshLayers()},_generateTooltipForLayers:function(n){var i,r,u;n.showTooltip&&(i=document.documentMode==8?document.querySelectorAll("shapeToolTip"):document.getElementsByClassName("shapeToolTip"),i!=null&&i.length==0?(r=t("<div class='shapeToolTip' style='display:none;position:absolute;z-index:1000;pointer-events:none;'><\/div>"),t(document.body).append(r),n._tooltipElement=r):n._tooltipElement=i[0],n.tooltipTemplate==null&&(u=n.shapeSettings.valuePath,u!=null&&(n.tooltipTemplate="defaultTooltip",this._mapContainer.append(t('<div id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">{{:#data["'+u+'"]}}<\/label><\/p><\/div><\/div><\/div>')))))},_orderByNameAscending:function(n,t){return n.Range==t.Range?0:n.Range>t.Range?1:-1},_resizingContainer:function(){this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-1):1;this._isTileMap?(this._translatePoint.x=(this._tileTranslatePoint.x-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor()),this._translatePoint.y=(this._tileTranslatePoint.y-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor())):(this._translatePoint.x=this._tileTranslatePoint.x/this._scale,this._translatePoint.y=this._tileTranslatePoint.y/this._scale);this._applyTransform(this._scale,this._translatePoint);this._zoomLevel()>1&&(this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-this._zoomFactor()):this._zoomLevel(),this._applyTransform(this._scale,this._translatePoint));this._baseScale=1;this._baseTranslatePoint={x:this._translatePoint.x*2,y:this._translatePoint.y*2}},_calculateMarginConditions:function(){var n=this._calculateMinMax();this._translatePoint.y>n.maxY?this._translatePoint.y=n.maxY:this._translatePoint.y<n.minY&&(this._translatePoint.y=n.minY);this._translatePoint.x>n.maxX?this._translatePoint.x=n.maxX:this._translatePoint.x<n.minX&&(this._translatePoint.x=n.minX)},_calculateMinMax:function(){var n=this._groupBorder,t,i,r,u;return this._containerHeight*this._scale<=this._height?(i=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y,u=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y):(i=-n.y+1,u=(this._height-this._containerHeight*this._scale)/this._scale-n.y-1),this._containerWidth*this._scale<=this._width?(t=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x,r=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x):(t=-n.x+1,r=(this._width-this._containerWidth*this._scale)/this._scale-n.x-1),{minX:r,maxX:t,minY:u,maxY:i}},_findMidPointofPoylgon:function(n){var y,p,r,t;if(n.length>0){var k=0,v=n.length,u=n[0],d=u.x,g=u.x,nt=u.y,tt=u.y,h,c,f,e,o=0,s=0,i=0;for(r=k;r<=v-1;r++)y=n[r],h=y.x,c=y.y,r==v-1?(f=u.x,e=u.y):(p=n[r+1],f=p.x,e=p.y),o=o+Math.abs(h*e-f*c),s=s+Math.abs((h+f)*(h*e-f*c)),i=i+Math.abs((c+e)*(h*e-f*c));o=.5*o;s=1/(4*o)*s;i=1/(4*o)*i;var w={x:0,y:0},l={x:0,y:0},b={x:0,y:0},a={x:0,y:0};for(r=k;r<=v-1;r++)t=n[r],t.x>s?t.y<i&&i-t.y<i-w.y?w={x:t.x,y:t.y}:t.y>i&&(l.y==0||t.y-i<l.y-i)&&(l={x:t.x,y:t.y}):t.y<i&&i-t.y<i-b.y?b={x:t.x,y:t.y}:t.y>i&&(a.y==0||t.y-i<a.y-i)&&(a={x:t.x,y:t.y});return{x:s,y:i,rightMin:w,rightMax:l,leftMin:b,leftMax:a,points:n}}},_convertPointToLatLong:function(n,t,i,r){var u,f,e;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,f=Math.min(n,0,u-1)/u-.5,e=.5-Math.min(t,0,u-1)/u,latitude=90-360*Math.atan(Math.exp(-e*2*Math.PI))/Math.PI,longitude=360*f,{x:latitude,y:longitude}},_convertTileLatLongtoPointForShapes:function(n,t,i,r){var u,s,f,h,e,o;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,s=(t+180)/360,f=Math.sin(n*Math.PI/180),f==-1&&(f=-.5),h=.5-Math.log((1+f)/(1-f))/(4*Math.PI),this._isMapCoordinates?(e=Math.min(Math.max(s*u+.5,0),u-1),o=Math.min(Math.max(h*u+.5,0),u-1)):r!=null?(e=Math.abs((t-this._mapBounds[0][0])*r),o=Math.abs((this._mapBounds[1][1]-n)*r)):(e=t,o=n),{x:e,y:o}},_convertTileLatLongtoPoint:function(n,t){var u=Math.pow(2,this._zoomLevel())*256,e=(t+180)/360,f=Math.sin(n*Math.PI/180),o=.5-Math.log((1+f)/(1-f))/(4*Math.PI),i,r;return this._isMapCoordinates?(i=e*u+.5+this._tileTranslatePoint.x,r=o*u+.5+this._tileTranslatePoint.y):factor!=null?(i=Math.abs((t-this._mapBounds[0][0])*factor),r=Math.abs((this._mapBounds[1][1]-n)*factor)):(i=t,r=n),{x:i,y:r}},_convertLatLongtoPointforMarker:function(n,t){var r=this._getFactor(),i=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,r);return{x:(i.x+this._translatePoint.x)*this._scale,y:(i.y+this._translatePoint.y)*this._scale}},_animate:function(n){function s(n,t){return n[0]==t[0]?null:(t[1]-n[1])/(t[0]-n[0])}function h(n,t){return t===null?n[0]:n[1]-t*n[0]}this._calculateMarginConditions();t(this._rootgroup).stop(!0,!1);this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1);var i=this,e={x:this._translatePoint.x,y:this._translatePoint.y},r=[this._prevPoint.x,this._prevPoint.y],u=[this._translatePoint.x,this._translatePoint.y];var f=s(r,u),c=h(r,f),l=u[0]-r[0],a=u[1]-r[1],v=this._scale-this._prevScale,o=this._scale;this._updateSliderValue();t(this._rootgroup).animate({count:10},{duration:n,step:function(n,t){var u=i._prevScale+n*(v/t.end),e=r[0]+n*(l/t.end)/(u/o),s;s=f==null?r[1]+n*(a/t.end):f*e+c;_isSVG?i._rootgroup.setAttribute("transform","scale("+u+") translate("+e+", "+s+")"):(i._rootgroup.coordorigin=-e+","+-s,i._rootgroup.coordsize=i._width/u+","+i._height/u);i._translatePoint.x=e;i._translatePoint.y=s;i._scale=u;i._refrshLayers();i._resizeShape()},complete:function(){i._translatePoint.x=e.x;i._translatePoint.y=e.y;i._scale=o;this.count=0}})},_applyTransform:function(n,t){this._scale=n;this._translatePoint=t;this._isTileMap||this._calculateMarginConditions();this._translatePoint.x!=Number.POSITIVE_INFINITY&&this._translatePoint.y!=Number.POSITIVE_INFINITY&&(_isSVG?this._rootgroup.setAttribute("transform","scale("+this._scale+") translate("+this._translatePoint.x+", "+this._translatePoint.y+")"):(this._rootgroup.coordorigin=-this._translatePoint.x+","+-this._translatePoint.y,this._rootgroup.coordsize=this._width/n+","+this._height/n))},_mouseMove:function(n){var t,i,f,e,r,u;n.type=="touchmove"&&n.originalEvent.touches.length>1?this._isPinching=!0:(t=this,t.ispanning&&t.enablePan()&&(n.preventDefault(),n.type=="mousemove"||n.type=="pointermove"?i={x:n.pageX,y:n.pageY}:n.type=="touchmove"?i={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerMove"&&(i={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),this._isTileMap&&(f=this._tileTranslatePoint.x-(this._dragStartX-i.x),e=this._tileTranslatePoint.y-(this._dragStartY-i.y),this._tileTranslatePoint.x=f,this._tileTranslatePoint.y=e,this._generateTiles(this._zoomLevel())),r=t._translatePoint.x-(t._dragStartX-i.x)/t._scale,u=t._translatePoint.y-(t._dragStartY-i.y)/t._scale,(r!=t._translatePoint.x||u!=t._translatePoint.y)&&(t._isDragging=!0),this._translatePoint.x=r,this._translatePoint.y=u,t._applyTransform(t._scale,t._translatePoint),t._dragStartX=i.x,t._dragStartY=i.y,t._refrshLayers()))},_svgMouseLeave:function(){var n=this;n.ispanning=!1},_mouseWheel:function(n){if(this.model.zoomSettings.enableZoom){this.enableAnimation()&&t(this._rootgroup).stop(!0,!1);var i=n.originalEvent,r=n;_isSVG||(i=n);n.target.className!="LegendDiv"&&n.target.className!="e-defaultLegendLabel"&&(i.preventDefault?i.preventDefault():r.preventDefault(),_isSVG?this._zooming(n.originalEvent.wheelDelta,n.originalEvent):this._zooming(n.originalEvent.wheelDelta,i))}},_mouseButtonUp:function(n){var t=this;t.ispanning&&t._trigger("panned",{originalEvent:n});t.ispanning=!1},_mouseUp:function(){this.ispanning=!1;this._isDragging=!1},_mouseButtonDown:function(n){var r,i;this._isPinching=!1;n.target.className!="e-vhandle"&&(this._isNavigationPressed=!1,this.enableAnimation()&&(t(this._rootgroup).stop(!0,!1),this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1)),n.type=="touchstart"&&n.originalEvent.touches.length>1||(n.type=="mousedown"||n.type=="pointerdown"?r={x:n.pageX,y:n.pageY}:n.type=="touchstart"?r={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerDown"&&(r={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),i=this,i._scale>1&&i.model.enablePan&&(n.preventDefault(),i.ispanning=!0),i._dragStartX=r.x,i._dragStartY=r.y))},_getCurrentPoint:function(n){var t=this._mapContainer,i=n.pageX-t.offset().left,r=n.pageY-t.offset().top;return{x:i,y:r}},_legendDoubleClick:function(n){for(var t=n.target;t.parentNode!=null&&t.parentNode.className!="ScrollLegendDiv e-scroller e-js e-widget";)t=t.parentNode;t.parentNode!=null&&t.parentNode.className=="ScrollLegendDiv e-scroller e-js e-widget"&&(this._isNavigationPressed=!0)},_doubleClick:function(n){var t=this,f=t._zoomLevel(),r,u,i;t._legendDoubleClick(n);this._isNavigationPressed||n.target.className.toString().indexOf("e-icon1")!=-1||(r=this._getCurrentPoint(n),t.model.zoomSettings.enableZoom&&t._zoomLevel()+t._zoomFactor()>=t._minZoom()&&t._zoomLevel()+t._zoomFactor()<=t._maxZoom()&&(u=t._scale,t._prevScale=u,this._isTileMap?(this._tileZoom(t._zoomLevel()-t._zoomFactor(),t._zoomLevel(),r),i=t._zoomLevel(),t.model.zoomSettings.level=t._zoomLevel()+t._zoomFactor(),t._zoomLevel(t._zoomLevel()+t._zoomFactor()),this._generateTiles(this._zoomLevel()),t._translatePoint.x=(t._tileTranslatePoint.x-.5*Math.pow(2,i))/Math.pow(2,i),t._translatePoint.y=(t._tileTranslatePoint.y-.5*Math.pow(2,i))/Math.pow(2,i),t._scale=Math.pow(2,i)):(t._prevPoint={x:t._translatePoint.x,y:t._translatePoint.y},t._translatePoint.x-=(t._width/t._scale-t._width/(t._scale+t._zoomFactor()))/(t._width/r.x),t._translatePoint.y-=(t._height/t._scale-t._height/(t._scale+t._zoomFactor()))/(t._height/r.y),t._scale=u+t._zoomFactor(),t.model.zoomSettings.level=t._zoomLevel()+t._zoomFactor(),t._zoomLevel(t._zoomLevel()+t._zoomFactor())),f<t._zoomLevel()&&t._trigger("zoomedIn",{originalEvent:null,zoomLevel:t._zoomLevel()}),t.enableAnimation()&&!this._isTileMap?t._animate(600):(t._applyTransform(t._scale,t._translatePoint),t._refrshLayers(),t._resizeShape()),t._updateSliderValue()))},_tileZoom:function(n,t,i){var c=this,r;if(t>0&&t<20){this._tileDiv.html("");r=Math.pow(2,n)*256;i==u&&(i={x:this._width/2,y:this._height/2});var f=Math.pow(2,t)*256,e=(i.x-this._tileTranslatePoint.x)/r*100,o=(i.y-this._tileTranslatePoint.y)/r*100,s=e*f/100,h=o*f/100;this._tileTranslatePoint.x=i.x-s;this._tileTranslatePoint.y=i.y-h}},_bubbleEnterFunction:function(n){if(n.data.templateID!=null){var i=t("#"+n.data.templateID).render(n.data.itemsrc);t(n.data.htmlobj).html(i)}return t(document.body).append(n.data.htmlobj),t(n.data.htmlobj).css("display","block").css({left:n.pageX+8+"px",top:n.pageY+6+"px"})},_bubbleleaveFunction:function(n){return t(n.data.htmlobj).remove(),t(n.data.htmlobj).css("display","none")},_bubbleOverFunction:function(n){return t(n.data.htmlobj).css("display","block").css({left:n.pageX+8+"px",top:n.pageY+6+"px"})},_polyEnterFunction:function(n){var p=jQuery.uaMatch(navigator.userAgent),i=n.data.Param1,f,w=this.isTouch?this.isTouch(n):!1,h,e,o,s,a,c,l,v,y;if(w&&p.browser=="chrome"?(h=n.originalEvent.changedTouches[0],f=document.elementFromPoint(h.clientX,h.clientY)):f=n.data.Param2.shape,e=n.data.map,o=jQuery.grep(i._smartLabels,function(n){return n.shape==f}),i.enableMouseHover){if(i._clearShapeWidth(e._scale),i._prevHoverdLegend==null||i._contains(i._prevSelectedLegends,i._prevHoverdLegend)||i._prevHoverdLegend.css("background-color",_isSVG?i._prevHoveredShape.getAttribute("fill"):i._prevHoveredShape.fillcolor.value),_isSVG?(f.setAttribute("stroke-width",i.shapeSettings.highlightBorderWidth/e._scale),f.setAttribute("stroke",i.shapeSettings.highlightStroke)):(f.strokeweight=i.shapeSettings.highlightBorderWidth,f.strokecolor=i.shapeSettings.highlightStroke/e._scale),i.shapeSettings.highlightColor!=null&&(i.shapeSettings.highlightColor=="transparent"||i._contains(i._prevSelectedShapes,f)||(f.setAttribute("class","e-mapHighlightedShape mapShape"),_isSVG?(i.shapeSettings.highlightColor!="none"&&f.highlightcolor==null?f.setAttribute("fill",i.shapeSettings.highlightColor):f.setAttribute("fill",f.highlightcolor),f.setAttribute("stroke-width",i.shapeSettings.highlightBorderWidth/e._scale),f.setAttribute("stroke",i.shapeSettings.highlightStroke)):f.fillcolor=i.shapeSettings.highlightColor),o.length>0&&!i._contains(i._prevSelectedLegends,o[0].legend)&&(o[0].legend[0].setAttribute("class","e-mapHighlightedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.highlightColor),i._prevHoverdLegend=o[0].legend),i._prevHoveredShape=f),i.legendSettings!=null&&i.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&i.shapeSettings.colorMappings!=null&&i.shapeSettings.colorMappings.rangeColorMapping!=null&&!i.shapeSettings.autoFill&&(i.legendSettings.showLegend==u||i.legendSettings.showLegend))for(s=0;s<i._mapShapes.length;s++)if(a=i._mapShapes[s].shape,a==f&&(c=null,i.shapeSettings.colorMappings.rangeColorMapping!=u&&(c=i.shapeSettings.colorMappings.rangeColorMapping),l=i.legendSettings.width,i.legendSettings.width==u&&(l=150),v=l/c.length/10,i._mapShapes[s].legendrect!=null)){y=i._mapShapes[s].legendrect.marginLeft;t(i._interactiveArrow).css({"margin-left":y+Math.ceil(v)-i._interactiveArrow.width()/2,display:"block"});break}e._trigger("mouseover",{originalEvent:n.data.Param2})}},_updateShapeRect:function(n){for(var i,t=0;t<n._mapShapes.length;t++)i=n._mapShapes[t],i.left==null&&(i.left=n._mapShapes[t].shape.getBoundingClientRect().left,i.right=n._mapShapes[t].shape.getBoundingClientRect().right,i.top=n._mapShapes[t].shape.getBoundingClientRect().top,i.bottom=n._mapShapes[t].shape.getBoundingClientRect().bottom,n._mapShapes[t]=i)},_polyUpFunction:function(n){var i=n.data.Param2,o=n.data.Param3,s=this.isTouch(n),h,u,f,e;if(s&&n.stopImmediatePropagation(),this.model.zoomSettings.enableZoomOnSelection&&!this._isDragging&&!this._isTileMap&&!this._isPinching){if(_isSVG)h=o.getBBox(),this._zoomOnSelection(h);else for(this._updateShapeRect(i),u=0;u<i._mapShapes.length;u++)if(o==i._mapShapes[u].shape){var c=i._mapShapes[u].left,l=i._mapShapes[u].top,b=i._mapShapes[u].right,k=i._mapShapes[u].bottom,d={x:c,y:l,width:b-c,height:k-l};this._zoomOnSelection(d);break}this.ispanning=!1}if(f=i._tooltipElement,f!=null&&t(f).delay(200).queue(function(n){t(this).css("display","none");n()}),s&&i.showTooltip){var a=this.getEventXY(n),r=this,v=r.model.cachedXY,y=10,p,w;p=Math.abs(v.x-a.X);w=Math.abs(v.y-a.Y);p<y&&w<y&&(this.touchEnd=!0,e=n.data.Param1,n.data.Param1=i,n.data.Param2=e,r._polyMoveFunction(n),n.data.Param1=e,n.data.Param2=i,r.tooltipElement=i._tooltipElement[0],t(r.tooltipElement).stop(!0,!0),r._timeOut=r._timeOut.bind(r),r.touchTimeOut=window.setTimeout(r._timeOut,1e3))}},_timeOut:function(){t(this.tooltipElement).fadeOut()},_markerPressed:function(n){this._trigger("markerSelected",{originalEvent:n.data})},_polyMouseDown:function(n){var e=n.data.Param2,u,y,p,w;if(n.type=="mousedown"||n.type=="pointerdown"?u={x:n.pageX||n.originalEvent.pageX,y:n.pageY||n.originalEvent.pageY}:n.type=="touchstart"?u={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerDown"&&(u={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),this.model.cachedXY=u,!this.isTouch(n)&&n.data.Param1.hasOwnProperty("data")&&e.showTooltip){var i=e._tooltipElement,v=e.tooltipTemplate,f=t(this._mapContainer).offset();f==null&&(f={left:0,width:0,height:0});var r=e._tooltipSize,o=this._height,s=this._width;if(i!=null&&v!=null){t(i).css({display:"block"});y=t("#"+v).render(n.data.Param1.data);t(i).html(y);p=i[0]!=null?i[0].clientHeight:i.clientHeight;w=i[0]!=null?i[0].clientWidth:i.clientWidth;r={height:p,width:w};var c=u.x-t(this._mapContainer).offset().left,l=u.y-t(this._mapContainer).offset().top,h=u.x,a=u.y;r.width+c>=s&&(h-r.width>f.left?h=f.left+s-(s-c)-r.width:h-=r.width+c-s);r.height>o?o+r.height>this._height+l&&(a-=f.top+10):r.height+l>=o&&(a-=r.height+l-o);t(i).css({left:h+10,top:a+10})}}},getEventXY:function(n){var t,i;return t=n.pageX||n.originalEvent.pageX||n.originalEvent.changedTouches[0].pageX,i=n.pageY||n.originalEvent.pageY||n.originalEvent.changedTouches[0].pageY,{X:t,Y:i}},_polyClickFunction:function(n){var k=n.ctrlKey,i=n.data.Param2,h=this,a=10,v=h.model.cachedXY,y,p,w=h.getEventXY(n),f,s,o,b,c,l,e;if(y=Math.abs(v.x-w.X),p=Math.abs(v.y-w.Y),y<a&&p<a){if(f=n.data.Param3,n.data.param4!=u&&(s=n.data.param4),o=jQuery.grep(i._smartLabels,function(n){return n.shape==f}),h._isPolygonSelected=!0,i.enableSelection)if(k&&i.selectionMode==r.datavisualization.Map.SelectionMode.Multiple)o!=null&&o.length>0&&(t.inArray(o[0].legend,i._prevSelectedLegends)==-1?(o[0].legend[0].setAttribute("class","e-mapSelectedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.selectionColor),i._prevSelectedLegends.push(o[0].legend)):(c=i._prevSelectedLegends.indexOf(o[0].legend),o[0].legend[0].setAttribute("class","mapShape"),o[0].legend.css("background-color",o[0].legend[0].getAttribute("nodeValue")),i._prevSelectedLegends.splice(c,1))),s!=null&&(l=document.getElementsByClassName("e-map-labelContainer"),t.inArray(s,i._prevSelectedTemp)==-1?(t(s).css("background-color",i.shapeSettings.selectionColor),t(s).css("width",l[0].clientWidth),i._prevSelectedTemp.push(s)):(t(s).css("background-color",""),b=i._prevSelectedTemp.indexOf(s),i._prevSelectedTemp.splice(b,1))),t.inArray(f,i._prevSelectedShapes)==-1?(f.setAttribute("class","e-mapSelectedShape mapShape"),_isSVG?(f.setAttribute("fill",i.shapeSettings.selectionColor),f.setAttribute("stroke",i.shapeSettings.selectionStroke),f.setAttribute("stroke-width",i.shapeSettings.selectionStrokeWidth/h._scale)):(f.fillcolor=i.shapeSettings.selectionColor,f.strokecolor=i.shapeSettings.selectionStroke,f.strokeweight=i.shapeSettings.selectionStrokeWidth/h._scale),i._prevSelectedShapes.push(f),i.selectedItems.push(n.data.Param1)):(f.setAttribute("class","mapShape"),f.setAttribute("fill",f.getAttribute("nodeValue")),f.setAttribute("stroke",i.shapeSettings.stroke),f.setAttribute("stroke-width",i.shapeSettings.strokeThickness/this._scale),c=i._prevSelectedShapes.indexOf(f),i._prevSelectedShapes.splice(c,1),i.selectedItems.splice(c,1));else{for(e=0;e<i._prevSelectedLegends.length;e++)i._prevSelectedLegends[e][0].setAttribute("class","mapShape"),i._prevSelectedLegends[e].css("background-color",i._prevSelectedLegends[e][0].getAttribute("nodeValue"));for(o!=null&&o.length>0&&(o[0].legend[0].setAttribute("class","e-mapSelectedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.selectionColor),i._prevSelectedLegends.push(o[0].legend)),e=0;e<i._prevSelectedShapes.length;e++)i._prevSelectedShapes[e].setAttribute("class","mapShape"),_isSVG?(i._prevSelectedShapes[e].setAttribute("fill",i._prevSelectedShapes[e].getAttribute("nodeValue")),i._prevSelectedShapes[e].setAttribute("stroke",i.shapeSettings.stroke),i._prevSelectedShapes[e].setAttribute("stroke-width",i.shapeSettings.strokeThickness/this._scale)):(i.fillcolor=i._prevSelectedShapes[e].getAttribute("nodeValue"),i.strokecolor=i.shapeSettings.stroke,i.strokeweight=i.shapeSettings.strokeThickness/this._scale);if(s!=null)if(l=document.getElementsByClassName("e-map-labelContainer"),t.inArray(s,i._prevSelectedTemp)==-1){for(e=0;e<i._prevSelectedTemp.length;e++)t(i._prevSelectedTemp[e]).css("background-color","");i._prevSelectedTemp=[];t(s).css("background-color",i.shapeSettings.selectionColor);t(s).css("width",l[0].clientWidth);i._prevSelectedTemp.push(s)}else{for(e=0;e<i._prevSelectedTemp.length;e++)t(i._prevSelectedTemp[e]).css("background-color","");i._prevSelectedTemp=[]}this._isPinching||t.inArray(f,i._prevSelectedShapes)!=-1?(i._prevSelectedShapes=[],i.selectedItems=[]):(f.setAttribute("class","e-mapSelectedShape mapShape"),i._prevSelectedShapes=[],i.selectedItems=[],_isSVG?(f.setAttribute("fill",i.shapeSettings.selectionColor),f.setAttribute("stroke",i.shapeSettings.selectionStroke),f.setAttribute("stroke-width",i.shapeSettings.selectionStrokeWidth/h._scale)):(f.fillcolor=i.shapeSettings.selectionColor,f.strokecolor=i.shapeSettings.selectionStroke,f.strokeweight=i.shapeSettings.selectionStrokeWidth/h._scale),i._prevSelectedShapes.push(f),i.selectedItems.push(n.data.Param1))}h._trigger("shapeSelected",{originalEvent:i.selectedItems})}},_updateSelection:function(n,t,i){n.enableSelection&&(n.selectionMode!=r.datavisualization.Map.SelectionMode.Multiple&&(n._prevSelectedShapes.pop(),n.selectedItems.pop()),n._prevSelectedShapes.push(t),n.selectedItems.push(i))},_zoomOnSelection:function(n){var u,t,i,r;_isSVG||(n.x=n.x-this._baseTranslatePoint.x/2-n.width/2,n.y=n.y-this._baseTranslatePoint.y/2-n.height/2);t=n.width;i=n.height;u=(this._width-100)/(this._height-100)>t/i?(this._height-100)/i:(this._width-100)/t;this._prevScale=this._scale;this._scale=u;this._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y};this.model.zoomSettings.level=this._scale-this._baseScale+1;this._zoomLevel(this._scale-this._baseScale+1);r=this._zoomLevel();r>this._minZoom()&&r<this._maxZoom()||(this.model.zoomSettings.level=r>(this._maxZoom()-this._minZoom())/2+this._minZoom()?this._maxZoom():this._minZoom(),this._zoomLevel(this.model.zoomSettings.level),this._scale=this._zoomLevel()+this._baseScale-1);var f=this._width/2-t*this._scale/2,e=f/this._scale,o=this._height/2-i*this._scale/2,s=o/this._scale;this._translatePoint.x=-n.x+e;this._translatePoint.y=-n.y+s;this.enableAnimation()&&!this._isTileMap?this._animate(1200):(this._applyTransform(this._scale,this._translatePoint),this._updateSliderValue())},_polyMoveFunction:function(n){var y=n.data.Param1,it=this.isTouch?this.isTouch(n):!1,k,e,s,nt,tt,v;if((!it&&n.type.toString().indexOf("move")>-1||this.touchEnd)&&(this.touchEnd=!1,this.model!=null)){var o=this.model.layers[this.baseMapIndex()],i=y._tooltipElement,d=y.tooltipTemplate,g=n.data.Param2,u=y._tooltipSize,f=t(this._mapContainer).offset();f==null&&(f={left:0,top:0,width:0,height:0});v=o.legendSettings.dockOnMap&&o.legendSettings.dockPosition=="right"?this._width+o.legendSettings.width+20+o.legendSettings.leftLabel.length*10+o.legendSettings.rightLabel.length*10:this._width;var h=this._height,c=v,l=this.getEventXY(n),p=l.X-f.left,w=l.Y-f.top,a=l.X,b=l.Y;if(i!=null&&d!=null&&g.hasOwnProperty("data")&&n.data.Param1.showTooltip){if(t(i).css({display:"block"}),k=this.model.locale,e=t.extend({},g.data),k&&this.model.enableGroupSeparator)for(s in e)e[s]=isNaN(parseFloat(e[s]))?e[s]:parseFloat(e[s]).toLocaleString(k);nt=t("#"+d).render(e);t(i).html(nt);tt=i[0]!=null?i[0].clientHeight:i.clientHeight;v=i[0]!=null?i[0].clientWidth:i.clientWidth;u={height:tt,width:v};r.util.isNullOrUndefined(this.touchTimeOut)||window.clearTimeout(this.touchTimeOut);u.width+p>=c&&(a-u.width>f.left?a=f.left+c-(c-p)-u.width:a-=u.width+p-c);u.height>h?h+u.height>this._height+w&&(b-=f.top+10):u.height+w>=h&&(b-=u.height+w-h);t(i).css({left:a+10,top:b+10})}}},_polyLeaveFunction:function(n){var u=n.data.Param1,h=this.isTouch(n),e=n.data.map,o=n.data.Param2.shape,s=u._tooltipElement,f=u._prevSelectedShapes;if(f.length>0)for(o.setAttribute("class","mapShape"),i=0;i<f.length;i++)f[i].setAttribute("class","e-mapSelectedShape mapShape");else o.setAttribute("class","mapShape");s==null||h||t(s).css("display","none");u.legendSettings!=null&&u.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&u._interactiveArrow!=null&&t(u._interactiveArrow).css("display","none");u._clearShapeWidth(e._scale);e._trigger("mouseleave",{originalEvent:n.data.Param2})},_wireEvents:function(){function o(i){n.enableAnimation()&&t(n._rootgroup).stop(!0,!1);i.preventDefault(i);n._zooming(-40*i.detail,i)}var e=jQuery.uaMatch(navigator.userAgent),i=e.browser.toLowerCase(),f,n,u;this._on(t(this._mapContainer),r.eventType.mouseDown,this._mouseButtonDown);t(document).keydown({className:"home",map:this},this._keyboardKeysPressed);this._on(t(this._mapContainer),r.eventType.mouseMove,this._mouseMove);this._on(t(document),r.eventType.mouseUp,this._mouseUp);f=!!navigator.userAgent.match(/Trident\/7\./);f&&(i="msie");window.navigator.msPointerEnabled?(this._on(t(this._mapContainer),"MSPointerUp",this._mouseButtonUp),this.model.zoomSettings.enableZoom&&t(this._mapContainer).css("-ms-touch-action","none")):this._on(t(this._mapContainer),"mouseup",this._mouseButtonUp);n=this;this._browser=i;i!="mozilla"?this._on(t(this._mapContainer),"mousewheel",this._mouseWheel):(u=this._svgDocument||this._mapContainer[0],u.addEventListener&&u.addEventListener("DOMMouseScroll",o,!1));this._on(t(this._mapContainer),"dblclick",this._doubleClick);(this.model.enableResize||this.model.isResponsive)&&(r.isTouchDevice()?this._on(t(window),"orientationchange",this._mapResize):this._on(t(window),"resize",this._mapResize))},clip:function(n,t,i){return Math.min(Math.max(n,t),i)},pointToLatLong:function(n,t){var i=this,u=i._getFactor(),f=n/i._scale-i._translatePoint.x,e=t/i._scale-i._translatePoint.y,r=Math.min(i._height,i._width)*u,o=i.clip(f,0,r-1)/r-.5,s=.5-i.clip(e,0,r-1)/r;return latitude=90-360*Math.atan(Math.exp(-s*2*Math.PI))/Math.PI,longitude=360*o,{latitude:latitude,longitude:longitude}},_mapResize:function(n){n.preventDefault();n.stopPropagation();var i={width:this._width,height:this._height},r=this._translatePoint,t=this;this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){if(t.model!=null){var n=t.pointToLatLong(t._width/2,t._height/2);t.refresh(!0);t._isTileMap||t.navigateTo(n.latitude,n.longitude,t._zoomLevel(),!1)}},500)},_isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_unWireEvents:function(){var u=jQuery.uaMatch(navigator.userAgent),n=u.browser.toLowerCase(),i;this._off(t(document),"keydown",this._keyboardKeysPressed);this._off(t(document),r.eventType.mouseUp,this._mouseUp);i=!!navigator.userAgent.match(/Trident\/7\./);i&&(n="msie");n!="mozilla"&&this._off(t(this._mapContainer),"mousewheel",this._mouseWheel);window.navigator.msPointerEnabled?(this._off(t(this._mapContainer),"MSPointerDown",this._mouseButtonDown),this._off(t(this._mapContainer),"MSPointerMove",this._mouseMove),this._off(t(this._mapContainer),"MSPointerUp",this._mouseButtonUp)):n=="webkit"||n=="chrome"||n=="mozilla"?(this._off(t(this._mapContainer),"mousedown",this._mouseButtonDown),this._off(t(this._mapContainer),"mousemove",this._mouseMove),this._off(t(this._mapContainer),"mouseup",this._mouseButtonUp)):(this._off(t(this._mapContainer),"mousedown",this._mouseButtonDown),this._off(t(this._mapContainer),"mousemove",this._mouseMove),this._off(t(this._mapContainer),"mouseup",this._mouseButtonUp));this._off(t(this._mapContainer),"dblclick",this._doubleClick)},navigateTo:function(n,t,i,r){var e,f,o,s;r==u&&(r=this.enableAnimation());i=parseFloat(i);i==u&&(i=this._zoomLevel());i>this._minZoom()&&i<this._maxZoom()?(this.model.zoomSettings.level=i,this._zoomLevel(i)):(this.model.zoomSettings.level=i>(this._maxZoom()-this._minZoom())/2+this._minZoom()?this._maxZoom():this._minZoom(),this._zoomLevel(this.model.zoomSettings.level));e=this._getFactor();f=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,e);this._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y};this._prevScale=this._scale;this._scale=this._baseScale+(i-1)*this._zoomFactor();o=(this._containerWidth+this._baseTranslatePoint.x)/2/this._scale;s=(this._containerHeight+this._baseTranslatePoint.y)/2/this._scale;this._translatePoint.x=-f.x+o;this._translatePoint.y=-f.y+s;r&&!this._isTileMap?this._animate(1200):this._applyTransform(this._scale,this._translatePoint);this._updateSliderValue();this._refrshLayers()},selectShape:function(n,t,i){var e,f,u;if(n!=null)for(t==null&&(t=this.model.layers[this.baseMapIndex()]),u=0;u<t._mapShapes.length;u++)if(e=t._mapShapes[u].data,f=t._mapShapes[u].shape,e!=null&&n==this._reflection(e,t.shapeSettings.valuePath)){if(t._prevSelectedShapes.length!=0&&t.selectionMode!=r.datavisualization.Map.SelectionMode.Multiple)for(u=0;u<t._prevSelectedShapes.length;u++)_isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t._prevSelectedShapes[u].fillcolor=t._prevSelectedShapes[u].style.behavior,t._prevSelectedShapes[u].strokecolor=t.shapeSettings.stroke,t._prevSelectedShapes[u].strokeweight=t.shapeSettings.strokeThickness/this._scale);t.enableSelection&&(_isSVG?(t.shapeSettings.selectionColor!="none"&&f.setAttribute("fill",t.shapeSettings.selectionColor),f.setAttribute("stroke",t.shapeSettings.selectionStroke),f.setAttribute("stroke-width",t.shapeSettings.selectionStrokeWidth/this._scale)):(t.shapeSettings.selectionColor!="none"&&(f.fillcolor=t.shapeSettings.selectionColor),f.strokecolor=t.shapeSettings.selectionStroke,f.strokeweight=t.shapeSettings.selectionStrokeWidth/this._scale),this._updateSelection(t,f,n),t._contains(t.selectedItems,t._mapShapes[u])||t.selectedItems.push(t._mapShapes[u]),this._trigger("shapeSelected",{originalEvent:t.selectedItems}));i&&this.model.zoomSettings.enableZoomOnSelection&&this._zoomOnSelection(f.getBBox());u=t._mapShapes.length}},_getIntersectedElements:function(n,i){var r,u;if(n.width+=5,n.height+=5,_isSVG&&this._browser!="mozilla"&&this._browser!="webkit")return r=this._svgDocument.createSVGRect(),r.x=n.left,r.y=n.top,r.width=n.width,r.height=n.height,this._svgDocument.getIntersectionList(r,null);var o=[],s=t(this._mapContainer).offset(),h=s.left,c=s.top;for(u=0;u<i.length;u++){var f=i[u].shape,e=f.getBoundingClientRect(),l=t(f).offset().left-h,a=t(f).offset().top-c;if(this._isIntersect(n,{left:l,top:a,height:e.bottom-e.top,width:e.right-e.left}))return o.push(f),o}return o},_isIntersect:function(n,t){return n.left>=t.left+t.width||n.left+n.width<=t.left||n.top>=t.top+t.height||n.top+n.height<=t.top?!1:!0},pan:function(t){var i=this,r=0,u=0,f,e,o,s;if(this._zoomLevel()!=1){switch(t){case"right":r=this._width/7;u=0;break;case"top":r=0;u=-(this._height/7);break;case"left":r=-(this._width/7);u=0;break;case"bottom":r=0;u=this._height/7}i.enablePan()&&(this._isTileMap&&(f=this._tileTranslatePoint.x-r/i._scale,e=this._tileTranslatePoint.y-u/i._scale,this._tileTranslatePoint.x=f,this._tileTranslatePoint.y=e,this._generateTiles(this._zoomLevel())),o=i._translatePoint.x-r/i._scale,i._prevScale=i._scale,s=i._translatePoint.y-u/i._scale,i._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y},this._translatePoint.x=o,this._translatePoint.y=s,i.enableAnimation()&&!this._isTileMap?i._animate(600):i._applyTransform(i._scale,i._translatePoint),i._refrshLayers())}},zoom:function(n,t){var i=this,r=i._zoomLevel(),f;n<=this._maxZoom()&&n>=this._minZoom()?(this._isTileMap?(this._tileZoom(i._zoomLevel(),n,{x:this._width/2,y:this._height/2}),r=i._zoomLevel(),i.model.zoomSettings.level=n,i._zoomLevel(n),this._generateTiles(this._zoomLevel()),i._translatePoint.x=(i._tileTranslatePoint.x-.5*Math.pow(2,r))/Math.pow(2,r),i._translatePoint.y=(i._tileTranslatePoint.y-.5*Math.pow(2,r))/Math.pow(2,r),i._scale=Math.pow(2,r)):(f=i._baseScale+(n-1)*i._zoomFactor(),i._prevPoint={x:i._translatePoint.x,y:i._translatePoint.y},i._prevScale=i._scale,i._translatePoint.x-=(i._width/i._scale-i._width/f)/2,i._translatePoint.y-=(i._height/i._scale-i._height/f)/2,i._scale=f,i.model.zoomSettings.level=n,i._zoomLevel(n),(i.enableAnimation()&&t||t==u)&&i._animate(600)),i.enableAnimation()&&t||(i._applyTransform(i._scale,i._translatePoint),i._refrshLayers(),i._resizeShape()),i._updateSliderValue()):n<=this._minZoom()?(this.model.zoomSettings.level=this._minZoom(),this._zoomLevel(this._minZoom()),this.zoom(this._zoomLevel())):n>=this._maxZoom()&&(this.model.zoomSettings.level=this._maxZoom(),this._zoomLevel(this._maxZoom()),this.zoom(this._zoomLevel()));r<n?i._trigger("zoomedIn",{originalEvent:null,zoomLevel:i._zoomLevel()}):r>n&&i._trigger("zoomedOut",{originalEvent:null,zoomLevel:i._zoomLevel()})},refresh:function(n){var i,r;t(this._svgDocument).children().remove();t(this._svgDocument).empty();t(this._mapContainer).empty();this.baseMapIndex()>=this.model.layers.length&&this.baseMapIndex(0);this.model.layers[this.baseMapIndex()]._mapItems&&(this.model.layers[this.baseMapIndex()]._mapItems=null);this._svgDocument!=null&&(this._svgDocument=null);this._scale=1;this._margintop=0;this._marginleft=0;this._translatePoint={x:0,y:0};this._height=this._mapContainer.height();this._width=this._mapContainer.width();this._height==0&&(this._height=this._mapContainer[0].parentElement.clientHeight!=0?this._mapContainer[0].parentElement.clientHeight:t(document).height());this._width==0&&(this._width=this._mapContainer[0].parentElement.clientWidth!=0?this._mapContainer[0].parentElement.clientWidth:t(document).width());i=this.model.layers[this.baseMapIndex()];i.legendSettings!=null&&i.legendSettings.showLegend&&i.shapeSettings.colorMappings!=null&&i._sizeCalculation(this);this._generatePath();this._groupSize!=null&&(this._isMapCoordinates?(this._containerHeight=this._groupSize.maxY-this._groupSize.minY,this._containerWidth=this._groupSize.maxX-this._groupSize.minX,this._groupBorder={x:this._groupSize.minX,y:this._groupSize.minY}):(r=this._getFactor(),this._containerHeight=Math.abs((this._groupSize.maxY-this._groupSize.minY)*r),this._containerWidth=Math.abs((this._groupSize.maxX-this._groupSize.minX)*r)));i.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background);this._resizingContainer();this._renderMapElements();i.legendSettings!=null&&i.legendSettings.showLegend&&i.shapeSettings.colorMappings!=null&&this._renderLegend();_isSVG&&t(this._svgDocument).css({height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft});this.model.enableLayerChangeAnimation&&t(this._mapContainer).animate({opacity:1},500);this.model.centerPosition==null||this._isTileMap||this.navigateTo(this.model.centerPosition[0],this.model.centerPosition[1],this._zoomLevel(),!1);this._legendContainer!=null&&this._legendContainer.css({height:this._legendSize.height});this._trigger("refreshed");n||(this._events=null,t(this._mapContainer).removeData(),t(this._mapContainer).data("ejMap",this))},_updateSliderValue:function(n){var t=this._sliderControl,i;n==u&&(n=this.enableAnimation());t!=null&&(i=t.data("ejSlider"),i.option("value",this._zoomLevel()))},_createDivElement:function(n,t,i,u){var f=n,e=t;e.appendTo(f);f.appendTo(i);this._on(e,r.eventType.mouseDown,{className:u,map:this},this._navigationControlPressed)},_navigationControlPressed:function(n){n.stopPropagation();this._isNavigationPressed=!0;var t=n.data.map,i=t.enableAnimation();n.data.className=="zoomIn"?(t.zoom(t._zoomLevel()+1,!0),i||t._updateSliderValue(),t._refrshLayers()):n.data.className=="zoomOut"?(t.zoom(t._zoomLevel()-1,!0),i||t._updateSliderValue()):n.data.className=="panLeft"?t.pan("left"):n.data.className=="panRight"?t.pan("right"):n.data.className=="panTop"?t.pan("top"):n.data.className=="panBottom"?t.pan("bottom"):n.data.className=="home"&&(t.zoom(1,!0),i||t._updateSliderValue())},_keyboardKeysPressed:function(n){this._iskeyboardKeysPressed=!0;var t=n.data.map,i=t.enableAnimation();n.ctrlKey&&n.keyCode==38?t._zoomingIn(t._width/2,t._height/2,n,i):n.ctrlKey&&n.keyCode==40?t._zoomingOut(t._width/2,t._height/2,n,i):n.keyCode==37?t.pan("left"):n.keyCode==39?t.pan("right"):n.keyCode==38?t.pan("top"):n.keyCode==40&&t.pan("bottom")},refreshNavigationControl:function(n){function tt(n){o!=null&&o._isRendered&&o._zoomLevel()!=n.value&&o.zoom(n.value,!1)}function it(n){o!=null&&o._isRendered&&o._zoomLevel()!=n.value&&o.zoom(n.value,!1)}var f=this.model.layers[this.baseMapIndex()],d=this._mapContainer.find("#ejNavigation"),e,l,s,a,h,v,o,p,w,b,k,i;if(d.length>0&&this._mapContainer[0].removeChild(d[0]),this.model.navigationControl!=null&&this.model.navigationControl.enableNavigation){n==u&&(n=this.model.navigationControl);var y=r.datavisualization.Map.LabelOrientation.Vertical,c,g=120,nt=12;c={width:90,height:320};e=t("<div id='ejNavigation' class='e-map-navigation e-orientation-vert'/>");(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(l=t("<div style='height:120px;width:10px;margin-top:-197px;margin-left: 34px;' />"));n.orientation=="horizontal"&&(y=r.datavisualization.Map.LabelOrientation.Horizontal,g=12,nt=120,c={width:320,height:90},e=t("<div id='ejNavigation' class='e-map-navigation e-orientation-horz' />"),(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(l=t("<div style='height:10px;width:120px;margin-top:-18px' />")));(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(s=t("<div class='e-panContainer'/>"),a=y=="horizontal"?"Horz":"Vert",n.orientation=="horizontal"?(h=t("<div style='margin-left: 94px;' />"),v=t("<div style='margin-left: 137px;'/>")):(h=t("<div />"),v=t("<div style='margin-top: 34px;'/>")),s.appendTo(e),h.appendTo(e),l.appendTo(v),v.appendTo(e),this._sliderControl=l,i={x:0,y:0},n.dockPosition==null||n.dockPosition==r.datavisualization.Map.Position.None?(i.x=this._width*n.absolutePosition.x/100,i.y=this._height*n.absolutePosition.y/100):i=this._getPosition(n.dockPosition,c),e.css({"margin-left":i.x+"px","margin-top":i.y+"px"}));o=this;p=this._height*.0025;this.model.navigationControl.content==null||this.model.navigationControl.content==""?navigationStyle=this._browser!="chrome"&&this._browser!="msie"?t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;zoom:"+p+";}<\/style>"):t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;-moz-transform: scale("+p+");}<\/style>"):(w=t("#"+this.model.navigationControl.content).height()||t(this.navigationControlData[0]).height(),b=t("#"+this.model.navigationControl.content).width()||t(this.navigationControlData[0]).width(),navigationStyle=this._browser!="mozilla"&&this._browser!="chrome"?t("<style> .e-map-navigation {width: "+b+"px;height: "+w+"px;position:absolute;z-index:2;}<\/style>"):t("<style> .e-map-navigation {width: "+b+"px;height: "+w+"px;position:absolute;z-index:2;}<\/style>"));this._browser!="mozilla"&&this._browser!="chrome"?(navigationStyle.remove(),t("html > head").append(navigationStyle)):t("html > head").append(navigationStyle);this.model.navigationControl.content==null||this.model.navigationControl.content==""?(t(l).ejSlider({orientation:y,sliderType:r.SliderType.MinRange,value:1,animationSpeed:1200,minValue:this._minZoom(),showTooltip:!0,enableAnimation:!1,maxValue:this._maxZoom(),incrementStep:this._zoomFactor(),slide:it,change:tt,height:g,width:nt}),e.appendTo(this._mapContainer),n.orientation=="horizontal"?(this._createDivElement(t("<div title='"+this._localizedLabels.zoomIn+"' class='e-icon1 e-incrementButton icon_margin1' />"),t("<div class='e-icon1 nav-inc-"+a+" e-innerIncrement'/>"),h,"zoomIn"),this._createDivElement(t("<div title='"+this._localizedLabels.zoomOut+"' class='e-icon1 e-incrementButton icon_margin2'/>"),t("<div class='e-icon1 nav-dec-"+a+" e-innerDecrement'/>"),h,"zoomOut")):(this._createDivElement(t("<div title='"+this._localizedLabels.zoomIn+"' class='e-icon1 e-incrementButton icon_margin1' />"),t("<div class='e-icon1 nav-inc-"+a+" e-innerIncrement'/>"),h,"zoomIn"),this._createDivElement(t("<div title='"+this._localizedLabels.zoomOut+"' class='e-icon1 e-incrementButton icon_margin2'/>"),t("<div class='e-icon1 nav-dec-"+a+" e-innerDecrement'/>"),h,"zoomOut")),this._createDivElement(t("<div title='"+this._localizedLabels.panTop+"' class='e-icon1 e-radialTop'/>"),t("<div class='e-icon1 e-arrowUp'/>"),s,"panTop"),this._createDivElement(t("<div title='"+this._localizedLabels.panLeft+"' class='e-icon1 e-radialLeft'/>"),t("<div class='e-icon1 e-arrowLeft'/>"),s,"panLeft"),this._createDivElement(t("<div title='"+this._localizedLabels.panRight+"' class='e-icon1 e-radialRight'/>"),t("<div class='e-icon1 e-arrowRight'/>"),s,"panRight"),this._createDivElement(t("<div title='"+this._localizedLabels.panBottom+"' class='e-icon1 e-radialBottom'/>"),t("<div class='e-icon1 e-arrowDown'/>"),s,"panBottom"),k=t("<div title='"+this._localizedLabels.home+"' class='e-icon1 e-home-bg'><div class='e-icon1 e-map-home'><\/div>"),k.appendTo(s),k.mousedown({className:"home",map:this},this._navigationControlPressed)):(this.navigationControlData==null?(this.navigationControlData=t("#"+this.model.navigationControl.content),this.navigationControlData.css({display:"block"}),this.navigationControlData.appendTo(e)):this.navigationControlData.appendTo(e),e.appendTo(this._mapContainer),c={width:this.navigationControlData[0].getBoundingClientRect().right-this.navigationControlData[0].getBoundingClientRect().left,height:this.navigationControlData[0].getBoundingClientRect().bottom-this.navigationControlData[0].getBoundingClientRect().top},i={x:0,y:0},n.dockPosition==null||n.dockPosition==r.datavisualization.Map.Position.None?(i.x=this._width*n.absolutePosition.x/100,i.y=this._height*n.absolutePosition.y/100):i=this._getPosition(n.dockPosition,c),f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?e.css({"margin-left":i.x+"px","margin-top":i.y+f.legendSettings.height+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?e.css({"margin-left":i.x+f.legendSettings.width+20+f.legendSettings.leftLabel.length*10+f.legendSettings.rightLabel.length*10+"px","margin-top":i.y+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Default?e.css({"margin-left":i.x+"px","margin-top":i.y+f.legendSettings.height+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Default?e.css({"margin-left":i.x+f.legendSettings.width+"px","margin-top":i.y+"px"}):e.css({"margin-left":i.x+"px","margin-top":i.y+"px"}))}},_getPosition:function(n,t){var i={x:0,y:0};switch(n){case r.datavisualization.Map.Position.TopCenter:i.x=this._width/2-t.width/2;break;case r.datavisualization.Map.Position.TopRight:i.x=this._width-t.width;break;case r.datavisualization.Map.Position.CenterLeft:i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.Center:i.x=this._width/2-t.width/2;i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.CenterRight:i.x=this._width-t.width;i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.BottomLeft:i.y=this._height-t.height;break;case r.datavisualization.Map.Position.BottomCenter:i.x=this._width/2-t.width/2;i.y=this._height-t.height;break;case r.datavisualization.Map.Position.BottomRight:i.x=this._width-t.width;i.y=this._height-t.height}return i},_renderMapElements:function(){this._templateDiv=t("<div class='TemplateDiv'/>");this._templateDiv.appendTo(this._mapContainer);this._templateDiv.css({"pointer-events":"none",overflow:"hidden",position:"absolute","z-index":"1",height:this._height,width:this._width});this.refreshLayers();this.refreshNavigationControl(this.model.navigationControl)},_renderLegend:function(){var n=this.model.layers[this.baseMapIndex()],f,i;this._scrollLegendDiv=t("<div class='ScrollLegendDiv'/>");this._scrollLegendDiv.appendTo(this._mapContainer);this._legendContainer=t("<div id='LegendcontainerDiv'/>");this._legendContainer.appendTo(this._scrollLegendDiv);this._legendDiv=t("<div class='LegendDiv'/>");this._legendDiv.css({height:this._legendDivHeight+"px",width:this._legendDivWidth+"px"});this._isNavigationPressed=!0;this._legendDiv.appendTo(this._legendContainer);this._legendDiv[0].getBoundingClientRect();this._legendContainer.css({position:"relative"});this._scrollLegendDiv.ejScroller({height:Math.round(this._legendSize.height),width:Math.round(this._legendSize.width)});n.legendSettings.labelOrientation==u&&n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Vertical;n.legendSettings.dockOnMap?(n.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?(pos="none",height=n.legendSettings.height+50,width=n.legendSettings.width+20+n.legendSettings.leftLabel.length*10+n.legendSettings.rightLabel.length*10):(pos="auto",height=n.legendSettings.height,width=n.legendSettings.width),this._scrollLegendDiv.css({position:"absolute","z-index":"2",height:this._legendSize.height,width:this._legendSize.width}),(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Center?this._scrollLegendDiv.css({"margin-left":this._width/2-this._legendSize.width/2}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Far?this._scrollLegendDiv.css({"margin-left":this._width-this._legendSize.width}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Center?this._scrollLegendDiv.css({"margin-top":this._height/2-this._legendSize.height/2}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Far&&this._scrollLegendDiv.css({"margin-top":this._height-this._legendSize.height}),n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom?this._scrollLegendDiv.css({"margin-top":this._height}):n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right&&this._scrollLegendDiv.css({"margin-left":this._width})):(n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Horizontal||n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Vertical)&&(f=n.legendSettings.position==u?"topleft":n.legendSettings.position,i=this._getPosition(f,this._legendSize),this._scrollLegendDiv.css({position:"absolute","z-index":"2","margin-left":i.x+"px","margin-top":i.y}));this.refreshLayers();this.refreshNavigationControl(this.model.navigationControl)},_renderMapLayers:function(){var u,i,o,e,n,s;for(t(this._templateDiv).empty(),u=0,i=this.model.layers[this.baseMapIndex()],i.layerType==r.datavisualization.Map.LayerType.Geometry?(this._renderLayers(i,u),i.shapeData!=null&&(u=i._polygonData.length)):(i._initializeLocalValues(),o=t("<div class='map-contribution'>"),o[0].innerHTML=i.contribution,this._mapContainer.append(o)),e=0;e<this.model.layers[this.baseMapIndex()].subLayers.length;e++)n=this.model.layers[this.baseMapIndex()].subLayers[e],n._isBaseLayer=!1,n.layerType==r.datavisualization.Map.LayerType.Geometry&&n.shapeData!=null?(r.util.isNullOrUndefined(n._initializeLocalValues)&&(s=new f,t.extend(s,n),t.extend(n,s)),this._renderLayers(n,u),u+=n._polygonData.length):n._initializeLocalValues();this.refreshMarkers();_isSVG&&this.enableAnimation()&&!this._isTileMap?this._refreshWithAnimation():this._refrshLayers()},refreshLayers:function(){var n=this.model.layers[this.baseMapIndex()];this._processOData(n,this);this.shapeSelectionOnResize()},_processOData:function(n,t){if(n.dataSource!=null)if(n.dataSource instanceof r.DataManager){var i=n.dataSource.executeQuery(n.query);i.done(function(i){i.result!=null&&(n.dataSource=i.result,t._renderMapLayers())})}else t._renderMapLayers();else t._renderMapLayers()}});var e=function(n,t){this.X=n;this.Y=t;this.left=0;this.top=0;this.height=256;this.width=256;this.src=null},f=function(){this.enableSelection=!0;this.selectionMode="default";this.bingMapType="aerial";this.key="";this.selectedItems=[];this.enableMouseHover=!1;this.shapeData=null;this.markers=[];this.dataSource=null;this.urlTemplate="http://a.tile.openstreetmap.org/level/tileX/tileY.png";this.showTooltip=!1;this.tooltipTemplate=null;this.mapItemsTemplate=null;this.enableAnimation=!1;this.legendSettings={showLegend:!1,showLabels:!1,rowSpacing:10,columnSpacing:10,position:"topleft",positionX:0,positionY:0,height:0,width:0,iconHeight:20,iconWidth:20,type:"layers",mode:"default",title:null,leftLabel:null,rightLabel:null,icon:"rectangle",dockOnMap:!1,dockPosition:"top",labelOrientation:"vertical",alignment:"bottom",columnCount:0};this.labelSettings={showLabels:!1,labelPath:"",enableSmartLabel:!1,smartLabelSize:"fixed",labelLength:2};this.markerTemplate=null;this.showMapItems=!1;this.layerType="geometry";this.geometryType="geographic";this._colorPaletteSettings={Palette1:{highlightColor:"#F7CD1C",highlightStroke:"white",SelectionColor:"#F96C0D",SelectionStroke:"white"},Palette2:{highlightColor:"#68A3EA",highlightStroke:"White",SelectionColor:"#116EF4",SelectionStroke:"White"},Palette3:{highlightColor:"#CCCCCC",highlightStroke:"white",SelectionColor:"#4D4D4D",SelectionStroke:"white"}};this.colorPalettes={Palette1:["#4A3825","#736F3D","#F2DABD","#BF9D7E","#7F6039","#7F715F","#70845D","#CC995C","#736F3D","#89541B"],Palette2:["#E51400","#730202","#EF6535","#C63477","#BF004D","#F0A30B","#CE1B1B","#97993D","#D6BF38","#835A2C"],Palette3:["#A4C400","#008B00","#1BA0E2","#0050EF","#AA00FF","#D90073","#E51400","#F96800","#E3C800","#A20026"]};this._prevPaletteIndex=0;this._newBounds=[];this.subLayers=[];this.shapeSettings={highlightColor:"gray",highlightBorderWidth:1,selectionColor:"gray",fill:"#E5E5E5",radius:5,strokeThickness:"0.2",stroke:"#C1C1C1",colorPalette:"palette1",highlightStroke:"#C1C1C1",selectionStroke:"#C1C1C1",selectionStrokeWidth:1,colorValuePath:null,valuePath:null,enableGradient:!1,colorMappings:null,autoFill:!1};this.bubbleSettings={showBubble:!0,bubbleOpacity:"0.9",minValue:10,maxValue:20,color:"gray",colorValuePath:null,valuePath:null,colorMappings:null,showTooltip:!1,tooltipTemplate:null}};f.prototype={dataTypes:{dataSource:"data",markers:"array",subLayers:"array",shapeSettings:{colorMappings:"array"},bubbleSettings:{colorMappings:"array"}},_initializeLocalValues:function(){this._svgns="http://www.w3.org/2000/svg";this._bounds=[];this._bubbleCollection=[];this._prevSelectedShapes=[];this._prevSelectedTemp=[];this._prevSelectedLegends=[];this._isBaseLayer=!0;this._prevHoverdLegend=null;this._prevHoveredShape=null;this._labelCollection=[];this._scrollBar=null;this._mapShapes=[];this._bubbles=[];this._labelBounds=[];this._bubbleCount=0;this._mapItems=[];this._mapMarkers=[];this.selectedItems;this._tooltipSize={height:0,width:0};this._smartLabels=[];this._labelData=[];this._interactiveArrow=null;this._legendRects=[]},_generateMarkerForLayers:function(n){var h,c,e,f,i,o,u,s;for(this._mapMarkers=[],h=n._rootgroup.getBoundingClientRect().top,c=n._rootgroup.getBoundingClientRect().left,e=0;e<this.markers.length;e++)f=this.markers[e],this.markerTemplate!=null?(i=t(".markerTemplateDiv"),i=t("<div class='mapMarker' style='display:block;position:absolute;pointer-events: stroke;'><\/div>"),n._templateDiv.append(i),t(i).css({height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft}),o=t("#"+this.markerTemplate).render(f),n.model.markerSelected==null&&t(i).css({"pointer-events":"none"}),t(i).html(o),n._on(t(i),r.eventType.mouseDown,{marker:t(i),data:f},n._markerPressed),this._mapMarkers.push(i)):(u=t(' <div class="mapMarker" style="display:block;position:absolute;pointer-events: stroke;"><label>'+f.label+"<\/label><\/div>"),_isSVG?n._templateDiv.append(u):u.appendTo(n._templateDiv),n.model.markerSelected==null&&t(u).css({"pointer-events":"none"}),n._on(t(u),r.eventType.mouseDown,{marker:t(u),data:f},n._markerPressed),this._mapMarkers.push(u)),s=this,s.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&(this._height=this._height,this._width=this._width-parseFloat(width),this._marginleft=parseFloat(width))},_contains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i]===t)return!0;return!1},_shapeContains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i].shapeIndex===t)return{isContains:!0,index:n.length-i};return{isContains:!1}},_labelSizeCalculation:function(n){var t=document.getElementsByClassName("e-map-labelContainer"),r=t[0].offsetHeight,i=t[0].offsetWidth;n._width=n._width-i;n._marginleft=i},_sizeCalculation:function(n){var u=this.shapeSettings.colorMappings,v=!1,i;if(this.shapeSettings.colorMappings!=null){u.rangeColorMapping!=null&&(u=u.rangeColorMapping,v=!0);u.equalColorMapping!=null&&(u=u.equalColorMapping);var o=0,c=0,h=this.legendSettings.rowSpacing,y=this.legendSettings.columnSpacing,p=this.legendSettings.iconWidth+5,a=this.legendSettings.iconHeight+5,k=a+h,f=this.legendSettings.iconHeight+h,e=0,t=this.legendSettings,l=this.legendSettings.columnCount;if(t.height==0&&t.width==0&&l==0){for(i=0;i<u.length;i++){var w=u[i].legendLabel!=null?u[i].legendLabel:v?u[i].from:u[i].value,b=this._calcWidth(w),s=p+b+y;t.dockOnMap&&(t.dockPosition==r.datavisualization.Map.DockPosition.Top||t.dockPosition==r.datavisualization.Map.DockPosition.Bottom)||!t.dockOnMap?n._width<o+s?(f=a+h+f,e=Math.max(e,o),o=s):o+=s+5:n._height<c+a+h?(e+=o,f=Math.max(f,c),o=s,c=0):(c+=a+h,o=Math.max(s,o))}t.dockOnMap&&(t.dockPosition==r.datavisualization.Map.DockPosition.Top||t.dockPosition==r.datavisualization.Map.DockPosition.Bottom)||!t.dockOnMap?(e=Math.max(e,o),f+=5):(e+=o+y,f=Math.max(f,c))}else l==0&&(f=t.height.toString().indexOf("%")!=-1?n._height/100*parseInt(t.height.toString().replace("%","")):t.height,e=t.width.toString().indexOf("%")!=-1?n._width/100*parseInt(t.width.replace("%","")):t.width);if(t.height==0&&t.width==0&&l!=0)for(i=0;i<u.length;i++){var w=u[i].legendLabel!=null?u[i].legendLabel:v?u[i].from:u[i].value,b=this._calcWidth(w),s=p+b+y;i%l!=0?(o+=s,i==l-1&&(e=Math.max(e,o))):(i!=0&&(f=p+h+f),e=Math.max(e,o),o=s)}}t.height!=0&&t.width!=0&&(f=t.height,e=t.width);n._legendSize={height:f,width:e};t.dockOnMap&&(t.mode==r.datavisualization.Map.LegendMode.Interactive&&(f=55),this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom?(n._height=n._height-parseFloat(f),this.legendSettings.tempWidth=o):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top?(n._height=n._height-parseFloat(f),n._margintop=parseFloat(f)):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left?(n._width=n._width-e,n._marginleft=e):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right&&(n._height=n._height,n._width=n._width-e))},_clearShapeWidth:function(n){var i,t;for(n==null&&(n=1),i=0;i<this._mapShapes.length;i++)t=this._mapShapes[i],this._contains(this._prevSelectedShapes,t.shape)||(_isSVG?(this.shapeSettings.colorMappings!=null||this.shapeSettings.autoFill?t.shape.setAttribute("fill",t.shape.getAttribute("nodeValue")):(t.shape.setAttribute("nodeValue",this.shapeSettings.fill),t.shape.setAttribute("fill",this.shapeSettings.fill)),t.shape.setAttribute("stroke-width",this.shapeSettings.strokeThickness/n),t.shape.setAttribute("stroke",this.shapeSettings.stroke)):(t.shape.fillcolor=t.shape.style.behavior,t.shape.strokeweight=this.shapeSettings.strokeThickness,t.shape.strokecolor=this.shapeSettings.stroke))},_shapeSelection:function(){for(var n,i,t=0;t<this._mapShapes.length;t++)n=this._mapShapes[t],i=this._shapeContains(this.selectedItems,n.shapeIndex),i.isContains&&(this._contains(this._prevSelectedShapes,n.shape)||this._prevSelectedShapes.push(n.shape),_isSVG?(n.shape.setAttribute("fill",this.shapeSettings.selectionColor),n.shape.setAttribute("stroke-width",this.shapeSettings.selectionStrokeWidth),n.shape.setAttribute("stroke",this.shapeSettings.selectionStroke)):(n.shape.fillcolor=this.shapeSettings.selectionColor,n.shape.strokeweight=this.shapeSettings.selectionStrokeWidth,n.shape.strokecolor=this.shapeSettings.selectionStroke))},_rgbToHex:function(n,t,i){return"#"+this._toHex(n)+this._toHex(t)+this._toHex(i)},_toHex:function(n){var t="0123456789ABCDEF";return(n=parseInt(n,10),isNaN(n))?"00":(n=Math.max(0,Math.min(n,255)),t.charAt((n-n%16)/16)+t.charAt(n%16))},_hexToR:function(n){return parseInt(this._cropHex(n).substring(0,2),16)},_hexToG:function(n){return parseInt(this._cropHex(n).substring(2,4),16)},_hexToB:function(n){return parseInt(this._cropHex(n).substring(4,6),16)},_cropHex:function(n){return n.charAt(0)=="#"?n.substring(1,7):n},_getRangeColorValues:function(n,t,i){var u=[],f,r;if(u.push(t),t>i)for(f=(t-i)/(n-1),r=n;r>2;r--)t=t-f,u.push(t);else for(f=(i-t)/(n-1),r=2;r<n;r++)t=t+f,u.push(t+f);return u.push(i),u},_generateGradientCollection:function(n){for(var f=[],r=n[0],u=n[n.length-1],e=this._hexToR(r),o=this._hexToG(r),s=this._hexToB(r),h=this._hexToR(u),c=this._hexToG(u),l=this._hexToB(u),i=10,a=this._getRangeColorValues(i,e,h),v=this._getRangeColorValues(i,o,c),y=this._getRangeColorValues(i,s,l),t=0;t<i;t++)f.push(this._rgbToHex(a[t],v[t],y[t]));return f},_calculateTextWidth:function(n){var i=t("<span>"+n+"<\/span>"),r;return t("body").append(i),r=i.width(),i.remove(),r},_trimFunction:function(n,i){for(var u=t("#spantag").text(n),r=n;u.width()>i;)r=r.slice(0,-2),u.text(r+"...");return r},_createLabel:function(n,i,r,u){var f=t("<div class="+u+"><\/div>");return f[0].innerHTML=n,f.css({"margin-left":i+"px","margin-top":r+"px",position:"absolute"}),f},_createInteractiveArrow:function(n,i){var r=t("<div class='e-icon1 e-interactiveArrow'><\/div>");return r[0].innerHTML="▲",r.css({"margin-left":n+"px","margin-top":i+"px",position:"absolute"}),r},_getEllipseLegend:function(n,i){var r=t("<div class='e-mapLegend'/>");return r.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","border-radius":this.legendSettings.iconHeight/2+"px",left:n+"px",top:i+"px",position:"absolute"}),r},_getRectLegend:function(n,i){var r=t("<div />");return r.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px",left:n+"px",top:i+"px",position:"absolute"}),r},_generateLegend:function(n){var l=!0,f=null,i;this.shapeSettings.colorMappings.rangeColorMapping!=u?f=this.shapeSettings.colorMappings.rangeColorMapping:this.shapeSettings.colorMappings.equalColorMapping!=u&&(f=this.shapeSettings.colorMappings.equalColorMapping,l=!1);var t=0,e=0,o=this.legendSettings,c=0,a,v,h=o.rowSpacing,y=o.columnSpacing,d=o.iconWidth+5,g=o.iconHeight+h,p=o.columnCount;for(i=0;i<f.length;i++){var w=f[i].legendLabel=f[i].legendLabel!=null?f[i].legendLabel:l?f[i].from:f[i].value,b=this._calcWidth(w),s=o.iconWidth+y+b,k=o.iconHeight;p!=0?i%p!=0?(this._drawLegend(f[i],t,e,n),t+=s+5):(i!=0&&(e+=o.iconHeight+h),t=0,this._drawLegend(f[i],t,e,n),t+=s+5):o.dockPosition==r.datavisualization.Map.DockPosition.Top||o.dockPosition==r.datavisualization.Map.DockPosition.Bottom?n._legendSize.width<t+s?(e+=o.iconHeight+h,t=0,this._drawLegend(f[i],t,e,n),t+=s):(this._drawLegend(f[i],t,e,n),t+=s):n._legendSize.height<e+o.iconHeight?(e=0,t+=c+y,this._drawLegend(f[i],t,e,n),c=0,e+=o.iconHeight+h):(this._drawLegend(f[i],t,e,n),c=Math.max(c,s),e+=o.iconHeight+h);a=n._legendDivHeight>e?n._legendDivHeight:e+k;v=n._legendDivWidth>t+s?n._legendDivWidth:t+s;n._legendDivWidth=v;n._legendDivHeight=a}},_drawLegend:function(n,i,u,f){var o,e;o=this.legendSettings.icon==r.datavisualization.Map.LegendIcons.Circle?this._getEllipseLegend(i,u):this._getRectLegend(i,u);i+=this.legendSettings.iconWidth+5;t(o).css("background-color",n.color);o.appendTo(f._legendDiv);e=t("<div class='e-defaultLegendLabel'/>");e.css({left:i+"px",top:u+"px",position:"absolute","text-overflow":"ellipsis","white-space":"nowrap",overflow:"hidden"});e[0].title=n.legendLabel;e[0].innerHTML=n.legendLabel;e.appendTo(f._legendDiv)},_generateLegends:function(n){var it=this.shapeSettings.colorMappings,rt,lt,ut,ft,a,c,k,o,v,d,st,at,ht,g,e,tt,s,yt,pt;if(it.rangeColorMapping!=null||it.equalColorMapping!=null){var gt=this.legendSettings,ni=this.legendSettings.iconWidth+5,bt=this.legendSettings.iconHeight+5,ti=this.legendSettings.rowSpacing,ii=this.legendSettings.columnSpacing,ri=this.legendSettings.iconHeight+this.legendSettings.rowSpacing,ui=bt+this.legendSettings.rowSpacing;if((this.legendSettings.showLegend==u||this.legendSettings.showLegend)&&!this.shapeSettings.autoFill){t(n._mapContainer).append(t('<div id="labelTooltip" style="display:none;background-color:grey;padding-left:5px; padding-right:5px;position:absolute;z-index:1000;pointer-events:none;"/>'));var w=this,f=10,h=0,ui=this.iconHeight+this.legendSettings.rowSpacing,b=this.legendSettings.height,l=this.legendSettings.width,i=t("<div/>");if(w.legendSettings.dockOnMap?i=t(n._legendDiv):w.legendSettings.dockOnMap||w.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?_isSVG?i.appendTo(n._templateDiv):n._templateDiv.append(i):i=t(n._legendDiv),(this.legendSettings.type==u||this.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&this.shapeSettings.colorMappings!=null&&(this.legendSettings.mode==u||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Default||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.shapeSettings.colorMappings.equalColorMapping!=null))this._generateLegend(n);else if((this.legendSettings.type==u||this.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.shapeSettings.colorMappings!=null){if(s="",this.legendSettings.height==0&&(b=18),this.legendSettings.width==0&&(l=150),this.legendSettings.leftLabel==null&&(this.legendSettings.leftLabel=""),this.legendSettings.rightLabel==null&&(this.legendSettings.rightLabel=""),this.legendSettings.title!=null){if(rt=f,this.legendSettings.showLabels||(rt=f+this.legendSettings.leftLabel.length*10),lt=this.legendSettings.title.length*10,ut=titleText=this.legendSettings.title,lt>l)for(e=1;e<titleText.toString().length;e++)ut=titleText.toString().substring(0,e-1)+"...";s=this._createLabel(ut,rt,h,"e-interactivelegend-title");s[0].title=titleText;s.css({width:l+"px"});_isSVG?s.appendTo(i):i.append(s);h+=25}for(this.legendSettings.showLabels&&(h+=25),this.legendSettings.leftLabel==null||this.legendSettings.showLabels||(s=this._createLabel(this.legendSettings.leftLabel,f,h-3,"e-interactivelegend-leftlabel"),_isSVG?s.appendTo(i):i.append(s),f=f+this.legendSettings.leftLabel.length*10),ft=this._createInteractiveArrow(f,h+b),ft.appendTo(i),this._interactiveArrow=ft,a=null,!_isSVG&&this.shapeSettings.enableGradient&&(a=n._createGroup(!1,"legendGroup"),a.style.left="0px",a.style.top="0px",a.style.position="relative",i.append(a)),c=it.rangeColorMapping,k=0;k<c.length;k++)if(o=c[k],!o.hideLegend){if(v=[],this.shapeSettings.enableGradient&&(v=this._generateGradientCollection(o.gradientColors)),d={},this.shapeSettings.enableGradient)if(_isSVG){var et=t("<canvas/>"),ot=et[0].getContext("2d"),y=ot.createLinearGradient(0,0,300,0),p=0;for(e=0;e<10;e++)p=p+1/10,e==0?(y.addColorStop(0,o.gradientColors[0]),y.addColorStop(p,v[e])):e==v.length-1?(y.addColorStop(p-1/10,v[e]),y.addColorStop(p,o.gradientColors[1])):(y.addColorStop(p-1/10,v[e]),y.addColorStop(p,v[e+1]));ot.fillStyle=y;ot.fillRect(0,0,300,300);et.css({height:b+"px",width:l/c.length+"px","margin-left":f+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"});et.appendTo(i)}else st="legend"+k,at="<v:rect id="+st+' display="block" style="position:absolute;top: '+(h-2)+"px;left:"+f+"px;width:"+l/c.length+"px;height:"+b+'px;"><v:fill opacity="0.9px" type="gradient" method="linear sigma" angle="270"/><v:stroke opacity="0px"/><\/v:rect>',a.innerHTML=a.innerHTML+at,ht=document.getElementById(st),ht.fillcolor=o.gradientColors[0],ht.fill.color2=o.gradientColors[1];else g=t("<div/>"),g.css({height:b+"px",width:l/this.shapeSettings.colorMappings.rangeColorMapping.length+"px","background-color":o.color,"margin-left":f+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"}),_isSVG?g.appendTo(i):i.append(g);for(e=0;e<10;e++)d={},d.marginLeft=f,this._legendRects.push(d),f=f+l/c.length/10;if(this.legendSettings.showLabels){var nt=f-l/c.length,ct=h-25,vt=this._createLabel(o.from,nt,ct,"e-legend-rangestartlabel");nt=f;tt=this._createLabel(o.to,nt,ct);o.legendLabel!=u&&(tt=this._createLabel(o.legendLabel,nt-o.legendLabel.length*5,ct,"e-legend-rangeendlabel"));_isSVG?(o==c[0]&&vt.appendTo(i),tt.appendTo(i)):(o==c[0]&&i.append(vt),i.append(tt))}}this.legendSettings.rightLabel==null||this.legendSettings.showLabels||(s=this._createLabel(this.legendSettings.rightLabel,f+10,h-3,"e-interactivelegend-rightlabel"),_isSVG?s.appendTo(i):i.append(s),f=f+this.legendSettings.rightLabel.length*10);totalwidth=f+10;totalheight=h+b+10;n._legendSize={width:totalwidth,height:totalheight};w.legendSettings.dockOnMap&&(this.legendSettings.dockPosition=="left"?n._marginleft=totalwidth:this.legendSettings.dockPosition=="top"&&(n._margintop=totalheight))}if(w.legendSettings.dockOnMap||this.legendSettings.position!="none"){if(!w.legendSettings.dockOnMap&&this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive){var kt=this.legendSettings.position==u?"topleft":this.legendSettings.position,dt={width:totalwidth,height:totalheight},wt=n._getPosition(kt,dt);i.css({"margin-left":wt.x+"px","margin-top":wt.y})}}else yt=n._width*this.legendSettings.positionX/100,pt=n._height*this.legendSettings.positionY/100,i.css({"margin-left":yt+"px","margin-top":pt+"px"})}}},_generateLabels:function(n){var f=t("<div class='e-map-labelContainer'><\/div>"),i;for(t(f).css({position:"absolute",overflow:"scroll"}),i=0;i<this._polygonData.length;i++){var e=this._polygonData[i].properties,o=n._reflection(e,this.labelSettings.labelPath),u=t("<div class='e-map-label'><\/div>");t(u).css({"margin-top":i*20,position:"absolute"});u[0].innerHTML=o;f.append(u);n._mapContainer.append(f);u.mouseenter({Param1:this,Param2:this._mapShapes[i],map:n},n._polyEnterFunction);n._off(t(u),r.eventType.mouseUp,n._polyClickFunction);n._on(t(u),r.eventType.mouseUp,{Param1:this._mapShapes[i],Param2:this,Param3:this._mapShapes[i].shape,param4:u},n._polyClickFunction)}},_calcWidth:function(n){var i=t('<span class="e-defaultLegendLabel">'+n+"<\/span>"),r;return t("body").append(i),r=i.width()+5,i.remove(),r},_generateBubbleLegends:function(n){var c,i,o,e,y,p,k,d;if(this.legendSettings.showLegend==u||this.legendSettings.showLegend){var l=10,s=10,it=this.legendSettings.iconHeight,a=this.legendSettings.iconWidth,f=t("<div/>");_isSVG?f.appendTo(n._templateDiv):n._templateDiv.append(f);var v=0,w=0,b=!0,h=null;if(this.bubbleSettings.colorMappings.rangeColorMapping!=u?h=this.bubbleSettings.colorMappings.rangeColorMapping:this.bubbleSettings.colorMappings.equalColorMapping!=u&&(h=this.bubbleSettings.colorMappings.equalColorMapping,b=!1),this.legendSettings.type==r.datavisualization.Map.LegendType.Bubbles&&this.bubbleSettings.colorMappings!=null&&(this.legendSettings.mode==u||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Default||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.bubbleSettings.colorMappings.equalColorMapping!=null)){for(this.legendSettings.iconHeight==u&&(this.legendSettings.iconHeight=20),this.legendSettings.iconWidth==u&&(this.legendSettings.iconWidth=20),c=0;c<h.length;c++)i=h[c],i.hideLegend||(o=t("<div class='e-mapBubbleLegend'/>"),this.legendSettings.icon==r.datavisualization.Map.LegendIcons.Circle?o.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","border-radius":this.legendSettings.iconHeight/2+"px","background-color":i.color,"margin-left":l+"px","margin-top":s+"px",position:"absolute"}):o.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","background-color":i.color,"margin-left":l+"px","margin-top":s+"px",position:"absolute"}),e=this._createLabel(i.legendLabel,l+a+5,s,"e-legendlabeltext"),i.legendLabel!=null?e[0].innerText=i.legendLabel:i.legendLabel=e[0].innerText=b?i.from:i.value,_isSVG?(o.appendTo(f),e.appendTo(f)):(f.append(o),f.append(e)),v<e[0].innerText.length*10+a&&(v=e[0].innerText.length*10+a),y=e.height(),p=o.height(),s+=y>p?y+5:p+5);w=s}if(this.legendSettings.position=="none")k=n._width*this.legendSettings.positionX/100,d=n._height*this.legendSettings.positionY/100,f.css({"margin-left":k+"px","margin-top":d+"px"});else{var nt=this.legendSettings.position==u?"topleft":this.legendSettings.position,tt={width:v,height:w},g=n._getPosition(nt,tt);f.css({"margin-left":g.x+"px","margin-top":g.y+"px"})}}},_animateBubble:function(n,i){var u={fx:n.getAttribute("r")/2},e=u.fx*2,f=t(n),r=this;t(u).delay(i).each(function(){}).animate({fx:e},{duration:700,step:function(n){_isSVG&&(f.attr("style","display:block;pointer-events:stroke;"),f.attr("r",n))},complete:function(){r._bubbleCount++;r._bubbleCount==r._bubbles.length&&r._setMapElements()}})},_setMapElements:function(){for(var i,n=0;n<this._mapItems.length;n++)i=this._mapItems[n],t(i).css({display:"block"})},_setMapItemsPositionWithAnimation:function(n){var s,o,e,i,r,u;for(this._bubbleCollection=[],i=0;i<this._bubbles.length;i++){var h=this._bubbles[i],a=this._bubbles[i].getAttribute("r"),u=this._bounds[i],o=(u.x+n._translatePoint.x)*n._scale,e=(u.y+n._translatePoint.y)*n._scale,c=n.validateBubblePosition(u.points,{x:o,y:e},a),l=0,v=Math.floor(Math.random()*(20-l)+l),y=parseInt(v*50);_isSVG&&t(h).attr({cx:c.x,cy:c.y});this._animateBubble(h,y);this._bubbleCollection.push(h)}for(i=0;i<this._mapMarkers.length;i++)r=this._mapMarkers[i],this.markers.length>0&&(s=this.markers[i]),u=n._isTileMap?n._convertTileLatLongtoPoint(s.latitude,s.longitude):n._convertLatLongtoPointforMarker(s.latitude,s.longitude),o=_isSVG?u.x:(u.x+n._transformX)*n._scale,e=u.y,t(r).css({display:"block",left:o,top:e-100}),t(r).delay(500).each(function(){}).animate({top:e},500);for(i=0;i<this._mapItems.length;i++){var r=this._mapItems[i],u=this._bounds[i],f=r[0].getBoundingClientRect(),p=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cx")):0,w=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cy")):0,o=this._bubbleCollection[i]?p-f.width/2:(u.x+n._translatePoint.x)*n._scale-f.width/2,e=this._bubbleCollection[i]?w-f.height/4:(u.y+n._translatePoint.y)*n._scale-f.height/4;this._bubbles.length>0?t(r).css({left:o,top:e,display:"none"}):t(r).css({left:o,top:e,display:"block"})}for(i=0;i<this._labelCollection.length;i++){r=this._labelCollection[i];u=this._labelBounds[i];t(r).css("display","block");var f=r[0].getBoundingClientRect(),b=_isSVG?f.width:f.right-f.left,k=_isSVG?f.height:f.bottom-f.top,o=(u.x+n._translatePoint.x)*n._scale-b/2,e=(u.y+n._translatePoint.y)*n._scale-k/2;(r[0].className="smartLabelStyle")&&(r[0].className="labelStyle",t(r[0]).css({"pointer-events":"none",position:"absolute"}));r[0].innerHTML=this._labelData[i];t(r).css({left:o,top:e})}this.labelSettings!=null&&this.labelSettings.showLabels&&this._validateSmartLabel(n)},_resizeShapes:function(n){var r=this.shapeSettings.strokeThickness/n._scale,i,t;if(this._mapShapes!=u)for(i=0;i<this._mapShapes.length;i++)t=this._mapShapes[i].shape,_isSVG?t.localName=="circle"?t.setAttribute("r",this.shapeSettings.radius/n._scale):this._contains(this._prevSelectedShapes,t)?t.setAttribute("stroke-width",this.shapeSettings.selectionStrokeWidth/n._scale):t.setAttribute("stroke-width",r):t.nodeName=="oval"||(t.strokeweight=this._contains(this._prevSelectedShapes,t)?this.shapeSettings.selectionStrokeWidth/n._scale:r)},_setMapItemsPosition:function(n){var c,s,h,i,e,f;if(this._bubbleCollection=[],this._bubbles!=u)for(i=0;i<this._bubbles.length;i++){var o=this._bubbles[i],a=this._bubbles[i].getAttribute("r"),f=this._bounds[i];if(_isSVG){var s=(f.x+n._translatePoint.x)*n._scale,h=(f.y+n._translatePoint.y)*n._scale,l=n.validateBubblePosition(f.points,{x:s,y:h},a);t(o).attr({cx:l.x,cy:l.y})}else{o=document.getElementById(o.id);var s=(f.x+n._translatePoint.x)*n._scale,h=(f.y+n._translatePoint.y)*n._scale,l=n.validateBubblePosition(f.points,{x:s,y:h},a),v=l.y-(o.getBoundingClientRect().bottom-o.getBoundingClientRect().top)/2,y=l.x-(o.getBoundingClientRect().right-o.getBoundingClientRect().left)/2;t(o).css({left:y,top:v})}this._bubbleCollection.push(o)}if(this._mapItems!=u)for(i=0;i<this._mapItems.length;i++){e=this._mapItems[i];f=this._bounds[i];t(e).css({display:"block"});var r=e[0].getBoundingClientRect(),p=_isSVG?r.width:r.right-r.left,w=_isSVG?r.height:r.bottom-r.top,b=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cx")):0,k=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cy")):0,s=this._bubbleCollection[i]?b-r.width/2:(f.x+n._translatePoint.x)*n._scale-r.width/2,h=this._bubbleCollection[i]?k-r.height/4:(f.y+n._translatePoint.y)*n._scale-r.height/4;t(e).css({left:s,top:h})}if(this._mapMarkers!=u)for(i=0;i<this._mapMarkers.length;i++)e=this._mapMarkers[i],this.markers.length>0&&(c=this.markers[i]),f=n._isTileMap?n._convertTileLatLongtoPoint(c.latitude,c.longitude):n._convertLatLongtoPointforMarker(c.latitude,c.longitude),s=f.x,h=f.y,t(e).css({left:s,top:h});if(this._labelCollection!=u)for(i=0;i<this._labelCollection.length;i++){e=this._labelCollection[i];f=this._labelBounds[i];t(e).css("display","block");var r=e[0].getBoundingClientRect(),p=_isSVG?r.width:r.right-r.left,w=_isSVG?r.height:r.bottom-r.top,s=(f.x+n._translatePoint.x)*n._scale-p/2,h=(f.y+n._translatePoint.y)*n._scale-w/2;(e[0].className="smartLabelStyle")&&(e[0].className="labelStyle",t(e[0]).css("background-color","transparent"),t(e[0]).css({"pointer-events":"none",position:"absolute"}));e[0].innerHTML=this._labelData[i];t(e).css({left:s,top:h})}this.labelSettings!=null&&this.labelSettings.showLabels&&this._validateSmartLabel(n)},_validateSmartLabel:function(n){function fi(n){var i=[],t;for(i.push(0),t=10;t<=n;t+=20)i.push(-t),i.push(t);return i}function ei(n){for(var t=0;t<ht.length;t++)if(oi(n,ht[t]))return!1;return!0}function oi(n,t){return n.left-2>=t.left+t.width||n.left-2+n.width<=t.left-2||n.top-2>=t.top+t.height||n.top+n.height<=t.top-2?!1:!0}var ht,p,yt,pt,it,rt,lt,bt,at,ui,tt,v,et,c,e,st,f;if(this._smartLabels=[],ht=[],this._labelCollection.length>0)for(p=0;p<this._mapShapes.length;p++){var o=this._labelBounds[p],i={x:(o.x+n._translatePoint.x)*n._scale,y:(o.y+n._translatePoint.y)*n._scale},dt={x:(o.rightMin.x+n._translatePoint.x)*n._scale,y:(o.rightMin.y+n._translatePoint.y)*n._scale},gt={x:(o.rightMax.x+n._translatePoint.x)*n._scale,y:(o.rightMax.y+n._translatePoint.y)*n._scale},ni={x:(o.leftMin.x+n._translatePoint.x)*n._scale,y:(o.leftMin.y+n._translatePoint.y)*n._scale},ti={x:(o.leftMax.x+n._translatePoint.x)*n._scale,y:(o.leftMax.y+n._translatePoint.y)*n._scale},l=this._labelCollection[p];if(i.x>0&&i.x<n._width&&i.y>0&&i.y<n._height){var ct=this._mapShapes[p].shape,a=ct.getBoundingClientRect(),w=!1,nt=l[0].getBoundingClientRect(),s=nt.height,h=nt.width;_isSVG||(a={width:a.right*n._scale-a.left*n._scale,height:a.bottom*n._scale-a.top*n._scale},s=nt.bottom-nt.top,h=nt.right-nt.left);yt=!1;pt=!1;(h/2>dt.x-i.x||h/2>gt.x-i.x)&&(s/2>i.y-dt.y||s/2>gt.y-i.y)?yt=!0:(h/2>i.x-ni.x||h/2>i.x-ti.x)&&(s/2>i.y-ni.y||s/2>ti.y-i.y)&&(pt=!0);var b=0,k=0,wt=20,d=[],ii=[];if(s>a.height||h>a.width||yt||pt)if(this.labelSettings.enableSmartLabel)for(this.labelSettings.smartLabelSize==r.datavisualization.Map.LabelSize.Fixed?(s=25,h=15*this.labelSettings.labelLength):(h*=1.3,s=25);!w;){for(wt>400&&(w=!0),d=fi(wt),ii=d,it=0;it<d.length;it++)for(rt=0;rt<d.length;rt++)b=ii[rt],k=d[it],i.x+b+h>n._width&&i.x<n._width&&(b-=i.x+b+h-n._width),i.x+b<0&&(b=0),i.y+k<0&&(k=0),i.y+k+s>n._height&&i.y<n._height&&(k-=i.y+k+s-n._height),lt={left:i.x+b,top:i.y+k,height:s,width:h},ei(lt)&&(bt=n._getIntersectedElements(lt,this._mapShapes),bt!=null&&bt.length==0&&(w=!0,it=d.length,rt=d.length,l[0].className="smartLabelStyle",t(l).css({"pointer-events":"stroke",position:"absolute"}),this.labelSettings.smartLabelSize==r.datavisualization.Map.LabelSize.Fixed&&(l[0].innerHTML=l[0].innerHTML.substring(0,this.labelSettings.labelLength)),l.mouseenter({Param1:this,Param2:this._mapShapes[p],map:n},n._polyEnterFunction),l.mousemove({Param1:this,Param2:this._mapShapes[p]},n._polyMoveFunction),t(l).css({left:i.x+b,top:i.y+k,"background-color":_isSVG?ct.getAttribute("fill"):ct.fillcolor.value}),ht.push(lt),at={},at.shape=ct,at.legend=l,this._smartLabels.push(at)));wt+=10}else{var ri=!0,ut=0,ft=0,w=!0;for(c=0;c<o.points.length;c++)v={x:(o.points[c].x+n._translatePoint.x)*n._scale,y:(o.points[c].y+n._translatePoint.y)*n._scale},w?(ut=v.y,ft=v.y,w=!1):(ut=Math.min(ut,v.y),ft=Math.max(ft,v.y));for(ui=Math.floor((ft-ut)/s),tt=[],f=0;f<ui;f++)e=[],tt.push(e);for(c=0;c<o.points.length;c++)v={x:(o.points[c].x+n._translatePoint.x)*n._scale,y:(o.points[c].y+n._translatePoint.y)*n._scale},et=Math.floor((v.y-ut)/s),et>0&&(et-=1),e=tt[et],e==u&&(e=[]),e.push({x:v.x,y:v.y}),tt[et]=e;for(c=0;c<tt.length;c++){e=tt[c];w=!0;var y=0,g=0,ot=0,vt=[],kt=[];for(f=0;f<e.length;f++)w?(y=e[f].x,g=e[f].x,ot=e[f].y,w=!1):(y=Math.min(y,e[f].x),g=Math.max(g,e[f].x),e[f].x==g&&(ot=e[f].y)),e[f].x<i.x&&vt.push(e[f].x),e[f].x>i.x&&kt.push(e[f].x);for(a.left<n._mapContainer[0].getBoundingClientRect().left+1&&(y=n._mapContainer[0].getBoundingClientRect().left+1-a.left,vt.push(y)),st=!1,f=0;f<vt.length;f++)if(g-vt[f]<h+1){st=!0;break}if(!st)for(f=0;f<kt.length;f++)if(kt[f]-y<h+1){st=!0;break}if(g-y>h+1&&!st){l.css("left",a.left*n._scale+(y-a.left*n._scale)+(g-y)/2-h/2+"px");l.css("top",ot+"px");ft-ot<s&&l.css("top",ot-s+"px");ri=!1;break}}ri&&l.css("display","none")}}}},_fillColors:function(n,t,i){t.rangeColorMapping!=null?this._fillRangeColors(n,t.rangeColorMapping,i):t.equalColorMapping!=null&&this._fillEqualColors(n,t,i)},_fillEqualColors:function(n,i,r){t.each(i.equalColorMapping,function(t,i){i.value==n&&(_isSVG?r.setAttribute("fill",i.color):r.fillcolor=i.color,r.highlightcolor=i.highlightcolor)})},_updateLegendRange:function(n,i,r){for(var h,f,c,a,s,o,l,y,v=i.shapeSettings.colorMappings.rangeColorMapping,e=0;e<v.length;e++)if(h=null,f=v[e],i.shapeSettings.enableGradient&&(h=this._generateGradientCollection(f.gradientColors)),n>=f.from&&n<=f.to)for(c=e,e!=0&&(c=e*10),a=f.from,s=f.from+(f.to-f.from)/10,o=c;o<c+10;o++){if(n>=a&&n<=s)return l={},y=this._getColorRatio(.7,1,n,f.from,f.to),i._legendRects[o]!=u&&(l=i._legendRects[o]),l.color=i.shapeSettings.enableGradient?e!=0?h[o-e*10]:h[o]:f.color,t(r).css({opacity:y}),l;a=s;s=s+(f.to-f.from)/10}},_fillRangeColors:function(n,i,r){for(var u,e,f=0;f<i.length;f++)u=i[f],n>=u.from&&n<=u.to&&(e=this._getColorRatio(.7,1,n,u.from,u.to),_isSVG?r.setAttribute("fill",u.color):r.fillcolor=u.color,r.highlightcolor=u.highlightcolor,t(r).css({opacity:e}))},_getColorRatio:function(n,t,i,r,u){var f=100/(u-r)*(i-r);return(parseFloat(t)-parseFloat(n))/100*f+parseFloat(n)}};t.fn.pinchZoom=function(n,i){var f,u,e=this[0],r=[],o=function(n){var t=e.createSVGPoint(),r=n.targetTouches,u,f,i;return r.length&&(i=r[0],u=i.pageX,f=i.pageY),t.x=u,t.y=f,t},l=function(i){var y=n,e,s,c,l,h,a,v;if(u=y.getCTM().inverse(),f=o(i).matrixTransform(u),e=i.touches,e.length>=2)for(i.preventDefault(),s=0;s<e.length;s++){for(c=e[s],l=!1,h=0;h<r.length;h++)if(a=r[h],c.identifier===a.identifier){l=!0;break}l||(v=t.extend({},c),r.push(v))}},s=function(n,t){var i=t.pageX-n.pageX,r=t.pageY-n.pageY;return Math.sqrt(i*i+r*r)},h=function(n,t){var r=null,u="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";t.a>i._baseScale&&i.model.zoomSettings.enableZoom&&i.enablePan()&&(t.a>i._scale?r=!0:t.a<i._scale&&(r=!1),i._scale=t.a,i._translatePoint.x=t.e/t.a,i._translatePoint.y=t.f/t.a,i._applyTransform(i._scale,i._translatePoint),i.model.zoomSettings.level=i._scale-i._baseScale+1,i._zoomLevel(i._scale-i._baseScale+1),r!=null&&r?(i._trigger("zoomedIn",{originalEvent:null,zoomLevel:i._zoomLevel()}),i._updateSliderValue(!1),i._resizeShape()):r!=null&&(i._trigger("zoomedOut",{originalEvent:null,zoomLevel:i._zoomLevel()}),i._updateSliderValue(!1),i._resizeShape()),i._isDragging=!0,i._refrshLayers())},a=function(n){for(var e,t,u,o,f=n.changedTouches,i=0;i<f.length;i++)for(e=f[i],t=0;t<r.length;t++)u=r[t],u.identifier===e.identifier&&(o=r.indexOf(u),r.splice(o,1));n.preventDefault()},c=function(n,t){n.pageX=t.pageX;n.pageY=t.pageY},v=function(t){var l=n,y=t.touches,w,i,p;if(y.length>=2){t.preventDefault();var a=y[0],v=y[1],b=r[0],k=r[1];w=s(a,v)/s(b,k);i=e.createSVGPoint();i.x=(a.pageX+v.pageX)/2;i.y=(a.pageY+v.pageY)/2;i=i.matrixTransform(l.getCTM().inverse());p=e.createSVGMatrix().translate(i.x,i.y).scale(w).translate(-i.x,-i.y);h(l,l.getCTM().multiply(p));typeof u=="undefined"&&(u=l.getCTM().inverse());u=u.multiply(p.inverse());c(b,a);c(k,v)}else r.length||(i=o(t).matrixTransform(u),h(l,u.inverse().translate(i.x-f.x,i.y-f.y)))};this[0].addEventListener("touchstart",l,!1);this[0].addEventListener("touchend",a,!1);this[0].addEventListener("touchmove",v,!1)};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}};r.datavisualization.Map.Locale=r.datavisualization.Map.Locale||{};r.datavisualization.Map.Locale["default"]=r.datavisualization.Map.Locale["en-US"]={zoomIn:"Zoom In",zoomOut:"Zoom Out",panTop:"Pan Top",panBottom:"Pan Bottom",panLeft:"Pan Left",panRight:"Pan Right",home:"Home"};r.datavisualization.Map.LayerType={Geometry:"geometry",OSM:"osm",Bing:"bing"};r.datavisualization.Map.LegendIcons={Rectangle:"rectangle",Circle:"circle"};r.datavisualization.Map.LabelSize={Fixed:"fixed",Default:"default"};r.datavisualization.Map.LegendMode={Default:"default",Interactive:"interactive"};r.datavisualization.Map.BingMapType={Aerial:"aerial",AerialWithLabel:"aerialwithlabel",Road:"road"};r.datavisualization.Map.GeometryType={Normal:"normal",Geographic:"geographic"};r.datavisualization.Map.SelectionMode={Default:"default",Multiple:"multiple"};r.datavisualization.Map.ColorPalette={Palette1:"palette1",Palette2:"palette2",Palette3:"palette3",CustomPalette:"custompalette"};r.datavisualization.Map.LegendType={Layers:"layers",Bubbles:"bubbles"};r.datavisualization.Map.Position={None:"none",TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",CenterLeft:"centerleft",Center:"center",CenterRight:"centerright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};r.datavisualization.Map.DockPosition={Top:"top",Bottom:"bottom",Right:"right",Left:"left"};r.datavisualization.Map.Alignment={Near:"near",Center:"center",Far:"far"};r.datavisualization.Map.LabelOrientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion),function(n,t,r){var u;t.widget({ejTreeMap:"ej.datavisualization.TreeMap"},{validTags:["div"],defaults:{locale:null,enableGroupSeparator:!1,leafItemSettings:{borderThickness:1,borderBrush:"white",showLabels:!1,labelPath:null,gap:0,itemTemplate:null,labelPosition:"topleft",labelVisibilityMode:"visible"},header:null,isHierarchicalDatasource:!1,dataSource:null,groupColorMapping:[],enableDrillDown:!1,drillDownHeaderColor:null,drillDownSelectionColor:"#000000",colorValuePath:null,weightValuePath:null,treeMapItems:[],showLegend:!1,borderBrush:"white",borderThickness:1,enableResize:!0,enableGradient:!1,isResponsive:!0,itemsLayoutMode:"squarified",levels:[],legendSettings:{template:"",iconHeight:15,iconWidth:15,title:"",height:0,width:0,mode:"default",leftLabel:"",rightLabel:"",dockPosition:"top",alignment:"near",columnCount:0},rangeColorMapping:[],uniColorMapping:{color:null},desaturationColorMapping:{from:0,to:0,color:"",rangeMinimum:0,rangeMaximum:0},paletteColorMapping:{colors:[]},highlightOnSelection:!1,selectionMode:"default",highlightGroupOnSelection:!1,groupSelectionMode:"default",draggingOnSelection:!1,draggingGroupOnSelection:!1,showTooltip:!1,tooltipTemplate:null,highlightBorderThickness:5,highlightGroupBorderThickness:4,highlightBorderBrush:"gray",highlightGroupBorderBrush:"gray"},dataTypes:{dataSource:"data",treeMapItems:"array",levels:"array",rangeColorMapping:"array",paletteColorMapping:"object",groupColorMapping:"array"},observables:["dataSource","colorValuePath","weightValuePath","showLegend","enableResize","highlightOnSelection","selectionMode","groupSelectionMode","highlightGroupOnSelection","enableDrillDown","drillDownHeaderColor","drillDownSelectionColor","showTooltip","highlightBorderThickness","highlightBorderBrush","itemsLayoutMode","leafItemSettings.borderThickness","leafItemSettings.borderBrush","leafItemSettings.showLabels","leafItemSettings.labelPath","legendSettings.iconWidth","legendSettings.iconHeight","legendSettings.dockPosition","legendSettings.height","legendSettings.width","uniColorMapping.color","desaturationColorMapping.from","desaturationColorMapping.to","desaturationColorMapping.color","desaturationColorMapping.rangeMinimum","desaturationColorMapping.rangeMaximum"],_tags:[{tag:"levels",attr:["groupPath","groupGap","headerHeight","showHeader","groupPadding","groupBackground","groupBorderColor","groupBorderThickness"],singular:"level"},{tag:"rangeColorMapping",attr:["color","legendLabel","from","to"],singular:"rangeColor"},{tag:"groupColorMapping",attr:["groupID",{tag:"groupColorMapping.rangeColorMapping",attr:["color","legendLabel","from","to"],singular:"groupRangeColor"},"uniColorMapping.color","desaturationColorMapping.from","desaturationColorMapping.to","desaturationColorMapping.color","desaturationColorMapping.rangeMinimum","desaturationColorMapping.rangeMaximum"],singular:"groupColor"}],dataSource:t.util.valueFunction("dataSource"),colorValuePath:t.util.valueFunction("colorValuePath"),weightValuePath:t.util.valueFunction("weightValuePath"),showLegend:t.util.valueFunction("showLegend"),enableResize:t.util.valueFunction("enableResize"),highlightOnSelection:t.util.valueFunction("highlightOnSelection"),selectionMode:t.util.valueFunction("selectionMode"),highlightGroupOnSelection:t.util.valueFunction("highlightGroupOnSelection"),groupSelectionMode:t.util.valueFunction("groupSelectionMode"),enableDrillDown:t.util.valueFunction("enableDrillDown"),drillDownHeaderColor:t.util.valueFunction("drillDownHeaderColor"),drillDownSelectionColor:t.util.valueFunction("drillDownSelectionColor"),showTooltip:t.util.valueFunction("showTooltip"),highlightBorderThickness:t.util.valueFunction("highlightBorderThickness"),itemsLayoutMode:t.util.valueFunction("itemsLayoutMode"),highlightBorderBrush:t.util.valueFunction("highlightBorderBrush"),borderThickness:t.util.valueFunction("leafItemSettings.borderThickness"),borderBrush:t.util.valueFunction("leafItemSettings.borderBrush"),showLabels:t.util.valueFunction("leafItemSettings.showLabels"),labelPath:t.util.valueFunction("leafItemSettings.labelPath"),iconWidth:t.util.valueFunction("legendSettings.iconWidth"),iconHeight:t.util.valueFunction("legendSettings.iconHeight"),dockPosition:t.util.valueFunction("legendSettings.dockPosition"),legendheight:t.util.valueFunction("legendSettings.height"),legendwidth:t.util.valueFunction("legendSettings.width"),itemTemplate:t.util.valueFunction("leafItemSettings.itemTemplate"),uniColor:t.util.valueFunction("uniColorMapping.color"),_color:t.util.valueFunction("desaturationColorMapping.color"),_from:t.util.valueFunction("desaturationColorMapping.from"),_to:t.util.valueFunction("desaturationColorMapping.to"),_rangeMinimum:t.util.valueFunction("desaturationColorMapping.rangeMinimum"),_rangeMaximum:t.util.valueFunction("desaturationColorMapping.rangeMaximum"),_initPrivateProperties:function(){this._svgDocument=null;this._templateDiv=null;this._legenddiv=null;this._drillHeaderDiv=null;this._drillHoverDiv=null;this._legendHeight=0;this._backgroundTile=null;this._tooltipSize={height:0,width:0};this._height=500;this._margintop=null;this._marginleft=null;this._startPoint={x:0,y:0};this._stopPoint={x:0,y:0};this.mouseClickable=!1;this.dragDiv=null;this._initDiv=null;this._width=500;this._svgns="http://www.w3.org/2000/svg";this._prevSelectedItems=[];this._prevSelectedHeaders=[];this._isLevelColors;this.selectedItems==null&&(this.selectedItems=[]);this.treeMapItemSelected=null;this.treeMapGroupSelected=null;this._browser=null;this._toolTipElement=null;this._rootTreeMapItems=[];this.treemapgroups=[];this._drillHeader=null;this._drilldownItem=null;this._drilldownItems=[];this._treeMapHeaders=[];this._drilldownHeaders=[];this.drillStarted=null;this.drillDownItemSelected=null;this._treeMapLabels=[];this._labelTemplateElements=[];this._itemGroups=[];this._prevSelectedGroupDatas=[];this._interactiveArrow=null;this._legendRects=[]},_setModel:function(n){for(var t in n)switch(t){case"itemsLayoutMode":this.itemsLayoutMode(n[t]);this.refresh()}},_levels:function(){this.refresh()},_rangeColorMapping:function(){this._setColorMappings(this._rootTreeMapItems,this.model)},_groupColorMapping:function(){this._setColorMappings(this._rootTreeMapItems,this.model)},_groupColorMapping_rangeColorMapping:function(){this._setColorMappings(this._rootTreeMapItems,this.model)},_init:function(){this._initPrivateProperties();var t=n("<style>.drillGroupRect:hover{ background-color:"+this.drillDownSelectionColor()+";}<\/style>");n("html > head").append(t);this._levelInitialize();this._isSVG()||(document.createStyleSheet().addRule(".vml","behavior:url(#default#VML);display:inline-block"),document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"));this.refresh()},_destroy:function(){this._unWireEvents();n(this.element).removeClass("e-treemap e-js").find().remove(".tooltipelement");n(this.element).empty()},_levelInitialize:function(){var t=this;this.model.levels!=null?n.each(this.model.levels,function(i,r){r=t._checkArrayObject(r,i);var f=new u;n.extend(f,r);n.extend(r,f)}):this.levels.treeMapLevel=new u},_checkArrayObject:function(t,i){var f=["borderBrush","dataSource","groupColorMapping","enableDrillDown","drillDownHeaderColor","drillDownSelectionColor","colorValuePath","weightValuePath","treeMapItems","showLegend","borderBrush","borderThickness","enableResize","enableGradient","isResponsive","itemsLayoutMode","levels","groupBackground","groupBorderColor","groupBorderThickness","groupPadding","groupPath","groupGap","headerHeight","showHeader","showLabels","headerTemplate","labelTemplate","labelPosition","headerVisibilityMode","labelVisibilityMode","color","leafItemSettings","showLabels","labelPath","gap","itemTemplate","legendSettings","template","iconHeight","iconWidth","height","width","mode","leftLabel","rightLabel","dockPosition","alignment","highlightOnSelection","selectionMode","highlightGroupOnSelection","groupSelectionMode","draggingOnSelection","draggingGroupOnSelection","showTooltip","tooltipTemplate","highlightBorderThickness","highlightGroupBorderThickness","highlightBorderBrush","highlightGroupBorderBrush"],r=this;return n.each(t,function(n,t){if(f.indexOf(n)>-1)if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new u;r._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),t},_loadIndividualDefaultValues:function(t,i,r){var u=null,f=this;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),n.each(t,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},refresh:function(i){var u;if(document.getElementById(this._id)!=null||document.getElementById(this._id)!=r){this._unWireEvents();i||(this._drilldownItems=[]);this.model.enableResize||this.model.isResponsive?this._drilldownItems.length==0&&this._initPrivateProperties():this._initPrivateProperties();n(this.element).empty();this._svgDocument!=null&&n(this._svgDocument).empty();this._height=this.element.height();this._width=this.element.width();this._height==0&&(this._height=this.element[0].parentElement.clientHeight!=0?this.element[0].parentElement.clientHeight:n(document).height());this._width==0&&(this._width=this.element[0].parentElement.clientWidth!=0?this.element[0].parentElement.clientWidth:n(document).width());this.showLegend()&&this._sizeCalculation();var f=jQuery.uaMatch(navigator.userAgent),e=f.browser.toLowerCase(),o=!!navigator.userAgent.match(/Trident\/7\./);if(this._browser=e,n(this.element).css({position:"relative"}),this._height!=0&&this._width!=0){if(this._templateDiv=n("<div class='_templateDiv'><\/div>"),this._templateDiv.css({"pointer-events":"none",overflow:"hidden",float:"left","z-index":"2",height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft,position:"absolute",left:"0",top:"0"}),this.enableDrillDown()&&this._drilldownItems.length==0&&(this._drillHeaderDiv=n("<div class='_drillHeaderDiv'><\/div>"),this._drillHeaderDiv.css({overflow:"hidden",float:"left","z-index":"3",position:"absolute",left:"0",top:"0"}),this._drillHoverDiv=n("<div class='_drillHoverDiv'><\/div>"),this._drillHoverDiv.css({overflow:"hidden",float:"left","z-index":"3",height:this._height-30,width:this._width,position:"absolute",left:"0",top:"30px"})),this._backgroundTile=n('<div id="backgroundTile" style="overflow:hidden;z-index:0;"><\/div>'),this.showLegend()&&this.model.legendSettings!=null&&this._renderLegend(),this.dataSource()!=null)if(this._drilldownItems.length>0){if(this.enableDrillDown()&&this.model.levels.length>=1&&(this._drilldownItem!=null||this._drilldownItem==null)){for(u=0;u<this._drillHeaderDiv[0].children[0].children.length;u++)this._drillHeaderDiv[0].children[0].children[u].className=="e-drilldownlabel"&&(header=this._drillHeaderDiv[0].children[0].children[u].innerHTML);this._backgroundTile[0].innerHTML="";this._drillHeaderDiv[0].innerHTML="";this._templateDiv[0].innerHTML="";this._drillHoverDiv[0].innerHTML="";this._drillDownHeader(header,!0);this._groupdrillDownLevels(this._drilldownItems[this._drilldownItems.length-1],this._drilldownItems.length)}this.showLegend()&&this._generateLegend();this._generateToolTip()}else this.model.dataSource instanceof t.DataManager?this._processOData(this):this._renderTreeMap(this.dataSource());(this.enableResize()||this.model.isResponsive)&&this._on(n(window),"resize",this._treeMapResize)}this._selectItemResize();this._trigger("refreshed","")}},_renderTreeMap:function(n){this.model.browserInfo=this.browserInfo();this.showLegend()&&this._generateLegend();this._groupLevels(n);this._generateToolTip();this._renderLabels()},_renderLegend:function(){this._legenddiv=n("<div class='LegendDiv'/>");this._legenddiv.appendTo(this.element);this._legenddiv.css({"pointer-events":"none",overflow:"hidden",position:"absolute","z-index":"2",height:this._legendSize.height,width:this._legendSize.width})},_processOData:function(n){var t=this,i=n.model.dataSource.executeQuery(n.model.query);i.done(function(n){n.result!=null&&t._renderTreeMap(n.result)})},_treeMapResize:function(n){n.preventDefault();n.stopPropagation();var t=this;this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){t.refresh(!0)},500)},_unWireEvents:function(){var n=jQuery.uaMatch(navigator.userAgent),t=n.browser.toLowerCase()},_groupLevels:function(t){var r=null,h=this.model.isHierarchicalDatasource,f,u,i,s,e,o;if(this.enableDrillDown()&&(this._drilldownHeaders.push(this.model.header||this.model.levels[0].groupPath),this._drillDownHeader(!1)),f=this._getTopGroupitem(this.labelPath(),t,0),r=f,this.model.levels.length==0&&(i=this.model.leafItemSettings,this._rootTreeMapItems=f,this._getTopLevels(f[0].innerItems,i),this._generateTreeMapItems(f[0].innerItems,"gray",this.colorValuePath()),this.showLabels()&&this._generateLabels(f[0].innerItems,i)),this.model.levels.length>0)for(u=0;u<=this.model.levels.length;u++)if(i=this.model.levels[u],i!=null&&(n.isNumeric(i.groupGap)||(i.groupGap=0),n.isNumeric(i.groupPadding)||(i.groupPadding=0),n.isNumeric(i.groupBorderThickness)||(i.groupBorderThickness=0)),u!=0){if(s=r,e=this.model.levels[u-1],r=[],i==null&&(i=this.model.leafItemSettings),this._generateSubItems(s,i,r,e),this._rootTreeMapItems=r,this.enableDrillDown()){if(u==1)return this._generateTreeMapItems(r,"gray",e.DisplayPath),!1}else u==this.model.levels.length&&this._generateTreeMapItems(r,"gray",e.DisplayPath);this.showLabels()&&u==this.model.levels.length&&this._generateLabels(r,i)}else o=this._getGroupitem(h?this.labelPath():i.groupPath,f[0].Data,i.headerHeight),this._rootTreeMapItems=o,this._getTopLevels(o,i),r=o},_groupdrillDownLevels:function(t,i){var f=null,c=this.model.isHierarchicalDatasource,s,u,r,h,e,o;if(i==this.model.levels.length-1?this._drillHoverDiv.css("pointer-events","none"):this._drillHoverDiv.css("pointer-events","auto"),this.model.levels.length>0)for(s=!1,u=c?i-1:0;u<this.model.levels.length;u++)r=this.model.levels[u],r!=null&&(n.isNumeric(r.groupGap)||(r.groupGap=0),n.isNumeric(r.groupPadding)||(r.groupPadding=0),n.isNumeric(r.groupBorderThickness)||(r.groupBorderThickness=0)),u!=(c?i-1:0)?(h=f,e=this.model.levels[u-1],f=[],r==null&&(r=this.model.leafItemSettings),u==i+1?this._generateSubItems(h,r,f,e,null,i+1!=u):this._generateSubItems(h,r,f,e,!0,i+1!=u),this._rootTreeMapItems=f,u!=i+1&&u!=this.model.levels.length-1||s||(this._generateTreeMapItems(f,"gray",e.DisplayPath),s=!0),i==this.model.levels.length-1&&u==i&&r.showLabels&&this._generateLabels(f,r)):(o=this._getGroupitem(this.model.isHierarchicalDatasource?null:r.groupPath,t.Data,r.headerHeight),this._rootTreeMapItems=o,this._getTopLevels(o,r),f=o);this.showLegend()&&this._generateLegend();this._renderLabels();this._trigger("drillDownItemSelected",{level:i,header:this.getDrillDownHeader(this._drilldownHeaders),prevLevel:i-1})},_getTopLevels:function(n,i){var f=i.groupGap!=null?i.groupGap:i.gap!=null?i.gap:0,e=this.itemsLayoutMode(),r=0,u=0;this.enableDrillDown()&&(u=30);this.showLegend()&&this.model.legendSettings!=null&&(r=r);this._legendHeight=r;this.enableDrillDown()&&(this._drillHeaderDiv.css({top:r}),this._drillHoverDiv.css({top:30+r}));e==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceHorizontal?this._calculateSliceAndDiceItemSize(n,0,r,this._width,this._height,f,u,!0,r):e==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceVertical?this._calculateSliceAndDiceItemSize(n,0,r,this._width,this._height,f,u,!1,r):e==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceAuto?this._calculateSliceAndDiceItemSize(n,0,r,this._width,this._height,f,u,null,r):this._calculateSquarifiedItemSize(n,0,r,this._width,this._height,f,u,r)},_generateSubItems:function(n,i,u,f,e,o){var h=f.groupPadding,s,c,l,v,p,y;h==""&&(h=0);var d=this.itemsLayoutMode(),g=n.length,w=this.model.isHierarchicalDatasource?null:i.groupPath;w==null&&(w=this.labelPath());w==null&&(w=this.weightValuePath());var b=i.groupGap!=null?i.groupGap:i.gap!=null?i.gap:0,k=(f.showHeader||f.showHeader==null)&&!this.enableDrillDown()?f.headerHeight:0,a=0;for(s=0;s<g;s++){if(c=this._getGroupitem(w,n[s].Data,i.headerHeight,this.model.isHierarchicalDatasource?f.groupPath:null),d==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceHorizontal?this._calculateSliceAndDiceItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,!0,0):d==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceVertical?this._calculateSliceAndDiceItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,!1,0):d==t.datavisualization.TreeMap.ItemsLayoutMode.SliceAndDiceAuto?this._calculateSliceAndDiceItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,null,0):this._calculateSquarifiedItemSize(c,n[s].LeftPosition+parseFloat(h),n[s].TopPosition+parseFloat(h),n[s].ItemWidth-(f.groupBorderThickness+2*parseFloat(h)),n[s].ItemHeight-(f.groupBorderThickness+2*parseFloat(h)),parseFloat(b),k,0),l=this._rootTreeMapItems[s],l.headerHeight=f.headerHeight,l.showHeader=f.showHeader,l.headerWidth=n[s].ItemWidth,l.headerTemplate=f.headerTemplate,l.headerLeftPosition=n[s].LeftPosition,l.headerTopPosition=n[s].TopPosition,this.enableDrillDown()&&this._createBackGround(l,f,n[s],o),(f.showHeader||f.showHeader==null)&&(this.enableDrillDown()||(this._createBackGround(l,f,n[s]),this._generateHeaders(l,f))),n[s].ChildtreeMapItems=c,n[s].GroupingLevel=this.model.levels.indexOf(f)+1,this.model.levels.indexOf(f)==0){if(this.model.groupColorMapping!=null&&this.model.groupColorMapping.length>0)for(this._isLevelColors=!0,v=0;v<this.model.groupColorMapping.length;v++)p=this.model.groupColorMapping[v],p.groupID==l.header&&this._setColorMappings(c,p,!0)}else if(this.model.levels.indexOf(f)>0&&this.model.groupColorMapping!=null&&this.model.groupColorMapping.length>0)for(v=0;v<this.model.groupColorMapping.length;v++)p=this.model.groupColorMapping[v],p.groupID==n[s].ParentHeader&&this._setColorMappings(c,p,!0);for(y=0;y<c.length;y++)u[a]=c[y],c[y].backgroundColor==null&&(c[y].backgroundColor=n[s].backgroundColor),c[y].backgroundOpacity==null&&(c[y].backgroundOpacity=n[s].backgroundOpacity),(this.enableDrillDown()||u[a].ItemHeight<l.ItemHeight-l.headerHeight)&&(u[a].ParentHeader=l.header,u[a].ItemHeight-=h,u[a].ItemWidth-=h,u[a].LeftPosition+=f.groupBorderThickness,u[a].TopPosition+=f.groupBorderThickness),a++}e==r&&f.showLabels&&this._generateLabels(n,f)},_createBackGround:function(t,i,r,u){var f=n("<div />"),o=t.showHeader||t.showHeader==null||this.enableDrillDown()?t.ItemHeight-2*i.groupBorderThickness:0,h=t.showHeader||t.showHeader==null||this.enableDrillDown()?t.TopPosition:0,e,s;f.css({height:o+"px",width:t.ItemWidth-2*i.groupBorderThickness+"px",left:t.LeftPosition+"px",top:h+"px","border-style":"solid","border-width":i.groupBorderThickness+"px",position:"absolute"});i.groupBorderColor!=null&&f.css("border-color",i.groupBorderColor);i.groupBackground!=null&&f.css("background-color",i.groupBackground);this.treemapgroups.push({header:t.header,element:f});f.appendTo(this._backgroundTile);o=parseFloat(f[0].style.top)-30-this._legendHeight+"px";this.enableDrillDown()&&!u&&(e=n("<div class='drillGroupRect'/>"),e.css({height:f[0].style.height,width:f[0].style.width,left:f[0].style.left,top:o,position:"absolute",opacity:.2,display:"block"}),this._drillHoverDiv.append(e),n(e).mousedown({treemap:this,level:i,param1:r},this._headerClickFunction),n(e).mouseleave({treemap:this,param1:t.header},this._mouseLeaveFunction),s={data:t.Data,label:t.header,header:t.header},n(e).mousemove({treemap:this,hoverItem:s},this._mouseRectHoverFunction));n(f).mousedown({treemap:this,level:i,param1:r},this._headerClickFunction);n(f).mousemove({treemap:this,hoverItem:t.Data},this._mouseRectHoverFunction)},_mouseRectHoverFunction:function(t){var r=t.data.treemap,h=t.data.hoverItem,i,f,e,o,s,u;r.showTooltip()&&(i=r._toolTipElement,f=r.model.tooltipTemplate,i!=null&&f!=null&&(n(i).css({left:t.pageX+10,top:t.pageY+10,display:"block"}),e=n("#"+f).render(h),n(i).html(e),o=i[0]!=null?i[0].clientHeight:i.clientHeight,s=i[0]!=null?i[0].clientWidth:i.clientWidth,r._tooltipSize={height:o,width:s}),u=r._tooltipSize,u.width+t.pageX>=r._width&&(t.pageX-=u.width,t.pageX<0&&(t.pageX=10)),u.height+t.pageY>=r._height&&(t.pageY-=u.height,t.pageY<0&&(t.pageY=10)),i!=null&&(r.enableDrillDown()?n(i).css({left:t.pageX+10,top:t.pageY+10,display:"block"}):n(i).css({left:t.pageX+10,top:t.pageY+10,display:"none"})))},_mouseLeaveFunction:function(t){var i=t.data.treemap;i.showTooltip()&&i._toolTipElement!=null&&n(i._toolTipElement).css("display","none")},_headerClickFunction:function(t){var f=t.data.level,r=t.data.param1,c=t.ctrlKey,i=t.data.treemap,s,o,e,h,u;if(i.highlightGroupOnSelection())if(i._browser!="msie"&&(s=i._backgroundTile[0].children[i._backgroundTile[0].children.length-0],i._backgroundTile[0].insertBefore(this,s)),i.groupSelectionMode()=="multiple"&&c)n.inArray(this,i._prevSelectedHeaders)==-1?(n(this).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders.push(this),i._prevSelectedGroupDatas.push(t.data.Param1)):(n(this).css({"border-width":f.groupBorderThickness,"border-color":f.groupBorderColor}),o=i._prevSelectedHeaders.indexOf(this),i._prevSelectedHeaders.splice(o,1),i._prevSelectedGroupDatas.splice(o,1));else{for(e=0;e<i._prevSelectedHeaders.length;e++)n(i._prevSelectedHeaders[e]).css({"border-width":f.groupBorderThickness,"border-color":f.groupBorderColor});n.inArray(this,i._prevSelectedHeaders)==-1?(n(this).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders=[],i._prevSelectedHeaders.push(this)):i._prevSelectedHeaders=[];i._prevSelectedGroupDatas.push(t.data.Param1)}if(i.enableDrillDown()&&i._trigger("drillStarted",t),i.enableDrillDown()&&i.model.levels.length>1&&(i._drilldownItem!=null&&i._drilldownItem.header!=r.header||i._drilldownItem==null)){for(h="",u=0;u<i._drillHeaderDiv[0].children[0].children.length;u++)i._drillHeaderDiv[0].children[0].children[u].className=="e-drilldownlabel"&&(h=i._drillHeaderDiv[0].children[0].children[u].innerHTML);return i._backgroundTile[0].innerHTML="",i._labelTemplateElements=[],i._drillHeaderDiv[0].innerHTML="",i._templateDiv[0].innerHTML="",i._drillHoverDiv[0].innerHTML="",i._drilldownHeaders.push(r.header),i._drillDownHeader(!0),i._drilldownItem=r,i._drilldownItems.push(r),i._groupdrillDownLevels(r,i._drilldownItems.length),!1}},_rectMouseDown:function(n){n.data.treeMap.isTouch(n)&&n.preventDefault()},_docClickFunction:function(t){var u=t.data.treemap,r=this._toolTipElement,i=this;clearTimeout(i.model.timer);r&&(i.model.trackerElement=r,i.model.timer=setTimeout(function(){i.model.trackerElement&&n(i.model.trackerElement).fadeOut(500,function(){i.model.trackerElement=null})},1200))},mousePosition:function(n){return!t.util.isNullOrUndefined(n.pageX)&&n.pageX>0?n:n.originalEvent&&!t.util.isNullOrUndefined(n.originalEvent.pageX)&&n.originalEvent.pageX>0?n.originalEvent:n.originalEvent&&n.originalEvent.changedTouches!=r&&!t.util.isNullOrUndefined(n.originalEvent.changedTouches[0].pageX)&&n.originalEvent.changedTouches[0].pageX>0?n.originalEvent.changedTouches[0]:n},_highlightTreemap:function(t){var i=t.data.treemap,v=t.data.Param1,h=i.model.levels[0],c,a=t.ctrlKey,l,e=i.mousePosition(t),f,r,u,s,o;if(i.highlightGroupOnSelection()){for(f=0;f<i.treemapgroups.length;f++)if(l=i.treemapgroups[f],r=i.treemapgroups[f].element,u=r[0].getBoundingClientRect(),u.left<e.clientX&&u.left+u.width>e.clientX&&u.top<e.clientY&&u.top+u.height>e.clientY){n(r).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush(),"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});c=!0;break}if(c)if(i.groupSelectionMode()=="multiple"&&a)n.inArray(r,i._prevSelectedHeaders)==-1?(n(r).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders.push(l),i._prevSelectedGroupDatas.push(t.data.Param1)):(n(r).css({"border-width":h.groupBorderThickness,"border-color":h.groupBorderColor}),s=i._prevSelectedHeaders.indexOf(l),i._prevSelectedHeaders.splice(s,1),i._prevSelectedGroupDatas.splice(s,1));else{for(o=0;o<i._prevSelectedHeaders.length;o++)n(i._prevSelectedHeaders[o].element).css({"border-width":h.groupBorderThickness,"border-color":h.groupBorderColor});n.inArray(r,i._prevSelectedHeaders)==-1?(n(r).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.highlightBorderBrush()}),i._prevSelectedHeaders=[],i._prevSelectedHeaders.push(l)):i._prevSelectedHeaders=[];i._prevSelectedGroupDatas.push(t.data.Param1)}i._trigger("treeMapGroupSelected",{selectedGroups:i._prevSelectedHeaders,orginalEvent:t})}if(i.highlightOnSelection()){for(f=0;f<i._rootTreeMapItems.length;f++)if(r=i._rootTreeMapItems[f],u=r.Rectangle.getBoundingClientRect(),u.left<e.clientX&&u.left+u.width>e.clientX&&u.top<e.clientY&&u.top+u.height>e.clientY){n(r.Rectangle).css({"border-width":i.highlightBorderThickness(),"border-color":i.highlightBorderBrush(),"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});c=!0;break}if(c){if(i.selectionMode()=="multiple"&&a)n.inArray(r.Rectangle,i._prevSelectedItems)==-1?(n(r.Rectangle).css({"border-width":i.highlightBorderThickness(),"border-color":i.highlightBorderBrush(),"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"}),i._prevSelectedItems.push(r.Rectangle),i.selectedItems.push(r.Data)):(n(r.Rectangle).css({"border-width":i.borderThickness(),"border-color":i.borderBrush()}),s=i._prevSelectedItems.indexOf(r.Rectangle),i._prevSelectedItems.splice(s,1),i.selectedItems.splice(s,1));else{for(o=0;o<i._prevSelectedItems.length;o++)n(i._prevSelectedItems[o]).css({"border-width":i.borderThickness(),"border-color":i.borderBrush()});n.inArray(r.Rectangle,i._prevSelectedItems)==-1?(n(r.Rectangle).css({"border-width":i.highlightBorderThickness(),"border-color":i.highlightBorderBrush()}),i._prevSelectedItems=[],i.selectedItems=[],i._prevSelectedItems.push(r.Rectangle),i.selectedItems.push(r.Data)):(i._prevSelectedItems=[],i.selectedItems=[])}i._trigger("treeMapItemSelected",{selectedItems:i.selectedItems,originalEvent:t})}}},doubleTap:function(n){var i=n.targetTouches?n.targetTouches[0]:n,r=i.pageX,u=i.pageY,e=this.model,f=200,t=n.data.treemap;t.model.cachedX=t.model.cachedX||r;t.model.cachedY=t.model.cachedY||u;timestamp=(new Date).getTime();Math.abs(r-t.model.cachedX)<f&&Math.abs(u-t.model.cachedY)<f&&t.model.tapNum++},rectClick:function(n){var t=n.data.treemap;t.doubleTap(n);t.isTouch(n)||t._highlightTreemap(n)},dragDown:function(t){var i=t.data.treemap,e=i.model.levels[0],r=i._svgDocument,u,f,o;if(t.type=="mousedown"?(i._startPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop},i._stopPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop}):t.type=="touchstart"?(i._startPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop},i._stopPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop}):t.type=="MSPointerDown"&&(i._startPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop},i._stopPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop}),i.mouseClickable=!0,i.model.draggingGroupOnSelection&&i._prevSelectedGroupDatas.length>0){for(u=0;u<i._prevSelectedGroupDatas.length;u++)f=i._prevSelectedGroupDatas[u][0],o=f.getBoundingClientRect(),n.inArray(f,i._prevSelectedGroupDatas[u][0])==-1&&n(i._prevSelectedGroupDatas[u]).css({"border-width":e.groupBorderThickness,"border-color":i.model.highlightGroupBorderBrush});i._prevSelectedGroupDatas=[]}if(i.model.draggingOnSelection&&i._prevSelectedItems.length>0){for(u=0;u<i._prevSelectedItems.length;u++)f=i._prevSelectedItems[u].rectangle,o=f.getBoundingClientRect(),n.inArray(f,i._prevSelectedItems[u].rectangle)==-1&&n(i._prevSelectedItems[u].rectangle).css({"border-width":e.groupBorderThickness,"border-color":i.model.highlightGroupBorderBrush});i._prevSelectedItems=[]}},dragMove:function(t){var f,e,i=t.data.treemap,r=i._svgDocument,u;(i.model.draggingGroupOnSelection||i.model.draggingOnSelection)&&i.mouseClickable&&(t.type=="mousemove"?i._stopPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop}:t.type=="touchmove"?i._stopPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:t.type=="MSPointerMove"&&(i._stopPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop}),n("#dragDiv").remove(),u=n('<div id = "dragDiv"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),n(u).css({top:Math.min(i._startPoint.y,i._stopPoint.y),left:Math.min(i._startPoint.x,i._stopPoint.x),width:f,height:e,border:"1px solid green",position:"absolute","z-index":100}),n(u).appendTo("#svgDocument"))},dragUp:function(t){var i=t.data.treemap,o=Math.abs(i._stopPoint.x-i._startPoint.x),s=Math.abs(i._stopPoint.y-i._startPoint.y),e=i._svgDocument,r,f,u;if((i.model.draggingGroupOnSelection||i.model.draggingOnSelection)&&(n("#dragDiv").remove(),n("#dragDiv").css({display:"none"}),i.mouseClickable=!1),i.model.draggingGroupOnSelection){for(r=0;r<i.treemapgroups.length;r++)f=i.treemapgroups[r].element,u=f[0].getBoundingClientRect(),u.left-e[0].offsetLeft+u.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+o<u.left-e[0].offsetLeft||u.top-e[0].offsetTop+u.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+s<u.top-e[0].offsetTop||i._contains(i._prevSelectedGroupDatas,f)||i._prevSelectedGroupDatas.push(f);for(r=0;r<i._prevSelectedGroupDatas.length;r++)f=i._prevSelectedGroupDatas[r][0],u=f.getBoundingClientRect(),n(f).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.model.highlightGroupBorderBrush,"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});i.selectedItems.push(i._prevSelectedGroupDatas)}if(i.model.draggingOnSelection){for(r=0;r<i._rootTreeMapItems.length;r++)f=i._rootTreeMapItems[r],u=f.rectangle.getBoundingClientRect(),u.left-e[0].offsetLeft+u.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+o<u.left-e[0].offsetLeft||u.top-e[0].offsetTop+u.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+s<u.top-e[0].offsetTop||i._contains(i._prevSelectedItems,f)||i._prevSelectedItems.push(f);for(r=0;r<i._prevSelectedItems.length;r++)f=i._prevSelectedItems[r].rectangle,u=f.getBoundingClientRect(),n(f).css({"border-width":i.model.highlightGroupBorderThickness,"border-color":i.model.highlightGroupBorderBrush,"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});i.selectedItems.push(i._prevSelectedItems)}},_generateLabels:function(i,u){for(var f,v,l,s,o,k,b,h,y,p,c=0;c<i.length;c++){if(f=i[c],u.labelTemplate==null){var w=8,a=5,e=n('<label class="e-treemap-label" >'+f.label+"<\/label>");this.enableDrillDown()?n(e).css({position:"absolute",color:"black",overflow:"hidden",left:f.LeftPosition+w+"px",top:f.TopPosition+a+"px","font-weight":"normal","pointer-events":"none"}):n(e).css({position:"absolute",color:"white",overflow:"hidden",left:f.LeftPosition+w+"px",top:f.TopPosition+a+"px","font-weight":"normal","pointer-events":"none"});this._treeMapLabels.push(e);this._templateDiv.append(e);v=0;l=0;u.groupPadding!=r&&(v=u.groupPadding);u.groupBorderThickness!=r&&(l=u.groupBorderThickness);s=e[0].getBoundingClientRect().width>0?e[0].getBoundingClientRect().width+v+l+2:f.label.length*8;o=e[0].getBoundingClientRect().height;o==0&&f.ItemHeight>18?o=18:o>0&&o>f.ItemHeight&&(o=f.ItemHeight-a);n(e).css({width:s+"px",height:o+"px"});f.labelPosition=u.labelPosition;f.labelVisibilityMode=l;f.groupPadding=u.groupPadding;f.groupBorderThickness=u.groupBorderThickness;e[0].data=f;this._labelTemplateElements.push(e);u.labelVisibilityMode==t.datavisualization.TreeMap.VisibilityMode.HideOnExceededLength?(s>f.ItemWidth&&(n(e).css({display:"none"}),f.Rectangle!=null&&(f.Rectangle.title=f.label)),k=u.labelVisibilityMode):s<f.ItemWidth?n(e).css({width:s}):n(e).css({width:f.ItemWidth})}u.labelTemplate!=null&&(b=n("#"+u.labelTemplate),h=n("<div style='overflow:hidden;display:block;position:absolute;pointer-events: none;'><\/div>"),h[0].data=f,f.labelPosition=u.labelPosition,f.labelVisibilityMode=u.labelVisibilityMode,y=n.templates(b.html()),p="",p=f.Data instanceof Array?y.render({data:f.Data}):y.render(f.Data),n(h).html(p),this._templateDiv.append(h),this._labelTemplateElements.push(h))}},_generateToolTip:function(){var t,i,r;this.showTooltip()&&(t=document.documentMode==8?document.querySelectorAll("tooltipelement"):document.getElementsByClassName("tooltipelement"+this._id),t!=null&&t.length==0?(i=n("<div><\/div>").attr("class","tooltipelement"+this._id).css({position:"absolute","z-index":"1000",display:"none","pointer-events":"none"}),n(document.body).append(i),this._toolTipElement=i):this._toolTipElement=t[0],this.model.tooltipTemplate==null&&(r=this.labelPath()!=null?this.labelPath():this.weightValuePath(),r!=null&&(this.model.tooltipTemplate="defaultTooltip",this.element.append(n('<div id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">{{:#data["'+r+'"]}}<\/label><\/p><\/div><\/div><\/div>')))))},_generateLegend:function(){var u,e,r,h,f;if(this.model.rangeColorMapping!=null){if(u=this.model.rangeColorMapping,e=this.model.legendSettings,e.mode!=t.datavisualization.TreeMap.LegendMode.Interactive){var n=0,i=0,o=0,c=this.iconWidth()+5,l=this.iconHeight()+15,s=this.model.legendSettings.columnCount;for(r=0;r<u.length;r++)h=this._calcWidth(u[r].legendLabel),f=this.iconWidth()+10+h,s!=0?r%s!=0?(this._drawLegend(u[r],n,i),n+=f+5):(r!=0&&(i+=this.iconHeight()+18),n=0,this._drawLegend(u[r],n,i),n+=f+5):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?this._legendSize.width<n+f?(i+=this.iconHeight()+18,n=0,this._drawLegend(u[r],n,i),n+=f):(this._drawLegend(u[r],n,i),n+=f):this._legendSize.height<i+this.iconHeight()?(i=0,n+=o+10,this._drawLegend(u[r],n,i),o=0,i+=this.iconHeight()+18):(this._drawLegend(u[r],n,i),o=Math.max(o,f),i+=this.iconHeight()+18)}else this._drawInteractiveLegend();(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom)&&e.alignment==t.datavisualization.TreeMap.Alignment.Center?this._legenddiv.css({"margin-left":this._width/2-this._legendSize.width/2}):(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom)&&e.alignment==t.datavisualization.TreeMap.Alignment.Far?this._legenddiv.css({"margin-left":this._width-this._legendSize.width}):(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Left||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right)&&e.alignment==t.datavisualization.TreeMap.Alignment.Center?this._legenddiv.css({"margin-top":this._height/2-this._legendSize.height/2}):(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Left||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right)&&e.alignment==t.datavisualization.TreeMap.Alignment.Far&&this._legenddiv.css({"margin-top":this._height-this._legendSize.height});this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?this._legenddiv.css({"margin-top":this._height+5}):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right&&this._legenddiv.css({"margin-left":this._width+5})}},_drawLegend:function(t,i,r){var f,u;f=this.model.legendSettings.template=="Ellipse"?this._getEllipseLegend(this.model.legendSettings,i,r):this._getRectLegend(this.model.legendSettings,i,r);i+=this.iconWidth()+5;n(f).css("background-color",t.color);f.appendTo(this._legenddiv);u=n("<div class='e-treemap-legendLabel'/>");u.css({left:i+"px",top:r+"px",position:"absolute"});u[0].innerHTML=t.legendLabel;u.appendTo(this._legenddiv)},_calcWidth:function(t){var i=n('<span class ="e-treemap-legendLabel" >'+t+"<\/span>"),r;return n("body").append(i),r=i.width(),i.remove(),r},_getEllipseLegend:function(t,i,r){var u=n("<div class='e-mapLegend'/>");return u.css({height:this.iconHeight()+"px",width:this.iconWidth()+"px","border-radius":this.iconHeight()/2+"px",left:i+"px",top:r+"px",position:"absolute"}),u},_getRectLegend:function(t,i,r){var u=n("<div />");return u.css({height:this.iconHeight()+"px",width:this.iconWidth()+"px",left:i+"px",top:r+"px",position:"absolute"}),u},_getPositionFromParent:function(n,t){var i=n.getBoundingClientRect(),r=t.getBoundingClientRect(),u=window.SVGSVGElement?i.width:i.right-i.left,f=window.SVGSVGElement?i.height:i.bottom-i.top;return{left:i.left-r.left,top:i.top-r.top,height:f,width:u}},_renderLabels:function(){for(var r=0;r<this._labelTemplateElements.length;r++){var u=this._labelTemplateElements[r],f=this._getPositionFromParent(u[0],this._templateDiv[0]),i=u[0].data,e=this._getDockPositionPoint({left:i.LeftPosition,top:i.TopPosition,width:i.ItemWidth,height:i.ItemHeight},f,i);n(u).css({left:e.x,top:e.y,"pointer-events":"none",overflow:"hidden"});i.labelVisibilityMode==t.datavisualization.TreeMap.VisibilityMode.HideOnExceededLength&&(f.height>i.ItemHeight||f.width>i.ItemWidth)&&n(u).css("display","none")}},_generateHeaders:function(i,r){var a=r.headerVisibilityMode,e=!1,s=2,h=2,u,c,o,f,arguments,l;a==t.datavisualization.TreeMap.VisibilityMode.HideOnExceededLength?(u=n("<span>"+i.header+"<\/span>"),n(document.body).append(u),c=u.outerWidth(),u.remove(),i.headerHeight<i.ItemHeight-2*s&&c<i.ItemWidth-2*h&&(e=!0)):i.headerHeight<i.ItemHeight&&(e=!0);e&&(i.headerTemplate==null?(o=n('<div style="display:block;position:absolute;pointer-events: stroke;overflow: hidden;"><label class="e-treemap-header">'+i.header+"<\/label><\/div>"),n(o).css({left:i.headerLeftPosition+s,top:i.headerTopPosition+h,width:i.headerWidth-r.groupPadding,height:i.headerHeight,"margin-left":r.groupPadding}),this._templateDiv.append(o)):(f=n("<div style='display:block;position:absolute;pointer-events: none;overflow: hidden;'><\/div>"),this._templateDiv.append(f),n(f).css({left:i.headerLeftPosition,width:i.headerWidth,top:i.headerTopPosition,height:i.headerHeight}),arguments={header:i.header,data:i.Data},l=n("#"+i.headerTemplate).render(arguments),n(f).html(l)))},getDrillDownHeader:function(n){var i="",t;if(n.length==1)return n[0];for(t=0;t<n.length;t++)i+=n[t],t!=n.length-1&&(i+=".");return i},_drillDownHeader:function(t){var u=[],r;for(i=0;i<this._drilldownHeaders.length;i++)u+="<label class='e-drilldownlabel' style='margin-left:-8px'>"+this._drilldownHeaders[i]+"<\/label>",this._drilldownHeaders.length>1&&i<this._drilldownHeaders.length-1&&(u=u+".");r=n("<div class='e-drilldownHeader' style='display:block;overflow: hidden;'><label class='e-drilldownlabel' style='position:absolute;height:30px;position:absolute;margin-top: 5px;top: 0px;'>"+u+"<\/label><\/div>");t&&(r=n("<div class='e-drilldownHeader' style='display:block;overflow: hidden;'><svg class='e-drilldownarrow' style='width:15px;height:15px;margin-top: 10px;'><polyline points='8,0 8,10 0,5 8,0'/><\/svg><label class='e-drilldownlabel' style='left:17px;position:absolute;height:30px;position:absolute;margin-top: 5px;top: 0px;'>"+u+"<\/label><\/div>"));n(r).css({left:"0px",width:this._width+"px",top:0,height:"30px",cursor:"pointer"});this.drillDownHeaderColor()!=null&&n(r).css("background-color",this.drillDownHeaderColor());this._drillHeaderDiv.append(r);n(r).mousedown({treemap:this},this._drilldownfunction);n(".e-drilldownlabel").mousedown({treemap:this},this._drilldownLabel)},_drilldownLabel:function(n){var u=this.innerHTML,t=n.data.treemap,r,f,e;if(t._drilldownHeaders[0]==u)t._drilldownItems=[],t.refresh();else{for(f="",t._drillHeaderDiv[0].innerHTML="",t._backgroundTile[0].innerHTML="",e="",i=0;i<t._drilldownHeaders.length;i++)u==t._drilldownHeaders[i]&&(r=i+1,t._drilldownHeaders.splice(i+1));return t._labelTemplateElements=[],t._drillDownHeader(!0),t._drilldownItem=t._drilldownItems[r-2],t._drilldownItems.splice(r-1),t._templateDiv[0].innerHTML="",t._groupdrillDownLevels(t._drilldownItem,t._drilldownItems.length),!1}},_drilldownfunction:function(n){var t=n.data.treemap,r,i,u,f;if(t._trigger("drillStarted",n),t._drilldownItems.length>0){if(t._drilldownItems.length==1)t._drilldownItems=[],t.refresh();else{for(r="",i=0;i<t._drillHeaderDiv[0].children[0].children.length;i++)t._drillHeaderDiv[0].children[0].children[i].className=="e-drilldownlabel"&&(r=t._drillHeaderDiv[0].children[0].children[i].innerHTML);u=r.split(".");t._drillHeaderDiv[0].innerHTML="";t._backgroundTile[0].innerHTML="";f="";t._drilldownHeaders.length>1&&t._drilldownHeaders.pop(t._drilldownHeaders.length-1);t._labelTemplateElements=[];t._drillDownHeader(!0);t._drilldownItem=t._drilldownItems[t._drilldownItems.length-2];t._drilldownItems.pop(t._drilldownItems[t._drilldownItems.length-1]);t._templateDiv[0].innerHTML="";t._groupdrillDownLevels(t._drilldownItem,t._drilldownItems.length)}t._trigger("drillDownItemSelected",{level:t._drilldownItems.length,header:t.getDrillDownHeader(t._drilldownHeaders),prevLevel:t._drilldownItems.length-1})}},_sizeCalculation:function(){var o,n,l;if(this.model.rangeColorMapping!=null){var i=this.model.rangeColorMapping,e=0,h=0,a=this.iconWidth()+5,u=this.iconHeight()+15,f=0,c=this.model.legendSettings.columnCount,s=this.model.legendSettings;if(this.model.legendSettings.mode!=t.datavisualization.TreeMap.LegendMode.Interactive){if(this.legendheight()==0&&this.legendwidth()==0&&c==0){for(n=0;n<i.length;n++)i[n].legendLabel==r&&(i[n].legendLabel=i[n].from+"-"+i[n].to),l=this._calcWidth(i[n].legendLabel),o=a+l+10,this.legendheight()==0&&this.legendwidth()==0?this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?this._width<e+o?(u=this.iconHeight()+15+u,f=Math.max(f,e),e=o):e+=o:this._height<h+this.iconHeight()+15?(f+=e,u=Math.max(u,h),e=o,h=0):(h+=this.iconHeight()+18,e=Math.max(o,e)):(xPos+=_legendlabelwidth+18,xPos+150>=this.legendwidth()&&(xPos=10,yPos+=40));this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top||this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?(f=Math.max(f,e),u+=5):(f+=e+15,u=Math.max(u,h))}else if(c==0){for(n=0;n<i.length;n++)i[n].legendLabel==r&&(i[n].legendLabel=i[n].from+"-"+i[n].to);u=this.legendheight().toString().indexOf("%")!=-1?this._height/100*parseInt(this.legendheight().replace("%","")):this.legendheight();f=this.legendwidth().toString().indexOf("%")!=-1?this._width/100*parseInt(this.legendwidth().replace("%","")):this.legendwidth()}if(c!=0)for(n=0;n<i.length;n++)i[n].legendLabel==r&&(i[n].legendLabel=i[n].from+"-"+i[n].to),l=this._calcWidth(i[n].legendLabel),o=a+l+10,n%c!=0?(e+=o,n==c-1&&(f=Math.max(f,e))):(n!=0&&(u=this.iconHeight()+15+u),f=Math.max(f,e),e=o)}else u=(s.height!=0?s.height:30)+18,s.title!=null&&s.title!=""&&(u+=25),f=(s.width!=0?s.width:100)+20+s.leftLabel.length*10+s.rightLabel.length*10;this._legendSize={height:u,width:f};this.model.legendSettings!=null&&(this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Bottom?(this._height=this._height-parseFloat(u),this.model.legendSettings.tempWidth=e):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Top?(this._height=this._height-parseFloat(u),this._margintop=parseFloat(u)):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Left?(this._width=this._width-f,this._marginleft=f):this.dockPosition()==t.datavisualization.TreeMap.DockPosition.Right&&(this._height=this._height,this._width=this._width-f))}},_getDockPositionPoint:function(n,i,u){var o=u.labelPosition,e=2,f=2;return u.groupPadding!=r&&u.groupBorderThickness!=r&&(e=u.groupPadding+u.groupBorderThickness+e,f=u.groupPadding+u.groupBorderThickness+f),u.showHeader&&!this.enableDrillDown()&&(f=f+u.headerHeight),o==t.datavisualization.TreeMap.Position.TopCenter?e=n.width/2-i.width/2:o==t.datavisualization.TreeMap.Position.TopRight?e=n.width-i.width-e:o==t.datavisualization.TreeMap.Position.CenterLeft?f=n.height/2-i.height/2:o==t.datavisualization.TreeMap.Position.Center||o==null?(e=n.width/2-i.width/2,f=n.height/2-i.height/2):o==t.datavisualization.TreeMap.Position.CenterRight?(e=n.width-i.width-e,f=n.height/2-i.height/2):o==t.datavisualization.TreeMap.Position.BottomLeft?f=n.height-i.height-f:o==t.datavisualization.TreeMap.Position.BottomCenter?(e=n.width/2-i.width/2,f=n.height-i.height-f):o==t.datavisualization.TreeMap.Position.BottomRight&&(e=n.width-i.width-e,f=n.height-i.height-f),{x:n.left+e,y:n.top+f}},_generateTreeMapItems:function(t){var u,i,r;if(this._rootTreeMapItems=t,this._getTreeMapItemTemplate(t),t!=null){for(this._isLevelColors||this._setColorMappings(t,this.model),u=0;u<t.length;u++)i=t[u],r=i.rectangle,i.Data!=null&&i.Data.length>0&&(i.Data=i.Data[0]),i.Rectangle=r,n(r).css({"box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"}),i.backgroundColor!=null?n(r).css("background-color",i.backgroundColor):n(r).css("background-color","#E5E5E5"),i.backgroundOpacity!=null&&n(r).css("opacity",i.backgroundOpacity),this._wireEventForTreeMapItem(i,r);this.model.rangeColorMapping.length==0&&this.uniColor()==null&&this._color()!=""?this._setDesaturationColor(t,this.model.desaturationColorMapping):this.model.PaletteColorMapping!=null&&this._setPaletteColor(t,this.model.PaletteColorMapping)}},browserInfo:function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},_wireEventForTreeMapItem:function(t,i){browserInfo=this.model.browserInfo;isPointer=browserInfo.isMSPointerEnabled;isIE11Pointer=browserInfo.pointerEnabled;touchStartEvent=isPointer?isIE11Pointer?"pointerdown":"MSPointerDown":"touchstart mousedown";touchStopEvent=isPointer?isIE11Pointer?"pointerup":"MSPointerUp":"touchend mouseup";touchMoveEvent=isPointer?isIE11Pointer?"pointermove":"MSPointerMove":"touchmove mousemove";touchEnterEvent=isPointer?isIE11Pointer?"pointerenter":"MSPointerEnter":"touchenter mouseenter";touchCancelEvent=isPointer?isIE11Pointer?"pointerleave":"MSPointerOut":"touchleave mouseleave";this._on(n(i),touchMoveEvent,{Param1:t,Param2:this},this._rectMouseMove);this._on(n(i),touchCancelEvent,{treeMap:this},this._rectMouseLeave);this._on(n(i),touchStopEvent,{Param1:t,Param2:this},this._rectMouseUp);this._on(n(i),touchStartEvent,{treeMap:this},this._rectMouseDown);this._on(n(i),touchEnterEvent,{Param1:t,Param2:this},this._rectMouseEnter)},_getTreeMapItemTemplate:function(i){for(var r,e,o,s,f="",u=0;u<i.length;u++)r=i[u],this.model.leafItemSettings.itemTemplate==null?f+='<div style="border-style:solid;position:absolute;left:'+r.LeftPosition+"px;top:"+r.TopPosition+"px;height:"+r.ItemHeight+"px;width:"+r.ItemWidth+"px;border-width:"+this.borderThickness()+"px;border-color:"+this.borderBrush()+'"><\/div>':(e=n("#"+this.model.leafItemSettings.itemTemplate),r.Data!=null&&r.Data.length==1&&(r.Data=r.Data[0]),o=n.templates(e.html()),s="<div style='overflow:hidden;position:absolute;left:"+r.LeftPosition+"px;top:"+r.TopPosition+"px;height:"+r.ItemHeight+"px;width:"+r.ItemWidth+"px'>"+o.render(r)+"<\/div>",f+=s);this._svgDocument!=null&&this.enableDrillDown()&&(this._svgDocument[0].innerHTML="");this._svgDocument=n('<div style= "overflow:hidden;z-index:1;"id="svgDocument">'+f+"<\/div>");this._backgroundTile.appendTo(this.element);this._svgDocument.appendTo(this.element);this._svgDocument.css({height:this._height+"px",width:this._width+"px","margin-top":this._margintop+"px","margin-left":this._marginleft,overflow:"hidden","z-index":1,position:"absolute",left:"0",top:"0"});n(this._backgroundTile).css({height:this._height+"px",width:this._width+"px","margin-top":this._margintop+"px","margin-left":this._marginleft,overflow:"hidden","z-index":0,position:"absolute",left:"0",top:"0"});this._templateDiv.appendTo(this.element);n(this._templateDiv).mousemove({Param2:this},this._rectMouseMove);var h=this.model.browserInfo,c=h.isMSPointerEnabled,l=h.pointerEnabled,a=c?l?"pointerdown":"MSPointerDown":"touchstart mousedown",v=c?l?"pointerup":"MSPointerUp":"touchend mouseup";for(this._on(n(this.element),a,{treemap:this,Param1:i},this.rectClick),this._on(n(this.element),v,{treemap:this,Param1:i},this._docClickFunction),this._on(n(this.element),t.eventType.mouseDown,{treemap:this},this.dragDown),this._on(n(this.element),t.eventType.mouseMove,{treemap:this},this.dragMove),this._on(n(this.element),t.eventType.mouseUp,{treemap:this},this.dragUp),this.enableDrillDown()&&(this._drillHeaderDiv.appendTo(this.element),this._drillHoverDiv.appendTo(this.element)),u=0;u<i.length;u++)i[u].rectangle=this._svgDocument[0].childNodes[u]},selectItem:function(t){var r,i,u,f;if(this._rootTreeMapItems!=null)for(r=0;r<this._rootTreeMapItems.length;r++)i=this._rootTreeMapItems[r],u=i.rectangle,i.Data!=null&&i.Data.length>0&&(i.Data=i.Data[0]),t==i.Data&&this.highlightOnSelection()&&(n(u).css({"border-width":this.highlightBorderThickness(),"border-color":this.highlightBorderBrush()}),this._browser!="msie"&&(f=this._svgDocument[0].children[this._svgDocument[0].children.length-1],this._svgDocument[0].insertBefore(u,f)),this._prevSelectedItems.push(u),this._trigger("treeMapItemSelected",{selectedItems:t,originalEvent:event}))},_selectTreemapItem:function(t){var r,i,u,f;if(this._rootTreeMapItems!=null)for(r=0;r<this._rootTreeMapItems.length;r++)i=this._rootTreeMapItems[r],u=i.rectangle,i.Data!=null&&i.Data.length>0&&(i.Data=i.Data[0]),t!=i.Data||this._contains(this.selectedItems,t)||this.highlightOnSelection()&&(n(u).css({"border-width":this.highlightBorderThickness(),"border-color":this.highlightBorderBrush()}),this._browser!="msie"&&(f=this._svgDocument[0].children[this._svgDocument[0].children.length-1],this._svgDocument[0].insertBefore(u,f)),this._prevSelectedItems=[],this.selectedItems=[],this._prevSelectedItems.push(u),this.selectedItems.push(t))},_selectItemResize:function(){for(var n,i,t=0;t<this._rootTreeMapItems.length;t++)n=this._rootTreeMapItems[t],i=n.rectangle,n.Data!=null&&n.Data.length>0&&(n.Data=n.Data[0]),this._contains(this.selectedItems,n.Data)&&this.selectItem(n.Data)},_updateLegendRange:function(n,t){for(var o,i,s,c,e,f,h,a,l=this.model.rangeColorMapping,u=0;u<l.length;u++)if(o=null,i=l[u],this.model.enableGradient&&(o=this._generateGradientCollection(i.gradientColors)),n>=i.from&&n<=i.to)for(s=u,u!=0&&(s=u*10),c=i.from,e=i.from+(i.to-i.from)/10,f=s;f<s+10;f++){if(n>=c&&n<=e)return h={},a=this._getColorRatio(.7,1,n,i.from,i.to),this._legendRects[f]!=r&&(h=this._legendRects[f]),t.backgroundColor=this.model.enableGradient?u!=0?o[f-u*10]:o[f]:i.color,t.backgroundOpacity=a,h.color=t.backgroundColor,h;c=e;e=e+(i.to-i.from)/10}},selectItemByPath:function(n,t,i){for(var e,c,l,s,f,o=n.split(i),a=t.split(i),n,t,u=this._rootTreeMapItems,r=0;r<o.length;r++){var n=o[r],t=a[r],h=[];for(e=0;e<u.length;e++){for(f=u[e],c=f.Data,s=0;s<o.length;s++)l=this._reflection(c,n);t==l&&h.push(f)}u=h}for(r=0;r<u.length;r++)f=u[r],this.selectItem(f.Data)},_getColorRatio:function(n,t,i,r,u){var f=100/(u-r)*(i-r);return(parseFloat(t)-parseFloat(n))/100*f+parseFloat(n)},_contains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i]===t)return!0;return!1},_rectMouseEnter:function(i){var u=i.data.Param2,h=u.model.legendSettings,y=i.data.Param1.Data,f,c,l,e,s,p,w,b,o,k,a,v,d,g,nt;if(y!=null&&(f=i.data.Param2._toolTipElement,c=i.data.Param2.model.tooltipTemplate,f!=null&&c!=null)){if(u.isTouch(i)||n(f).css({left:i.pageX+10,top:i.pageY+10,display:"block"}),l=this.model.locale,e=n.extend({},y),l&&this.model.enableGroupSeparator)for(s in e)e[s]=isNaN(parseFloat(e[s]))?e[s]:parseFloat(e[s]).toLocaleString(l);p=n("#"+c).render(e);n(f).html(p);w=f[0]!=null?f[0].clientHeight:f.clientHeight;b=f[0]!=null?f[0].clientWidth:f.clientWidth;i.data.Param2._tooltipSize={height:w,width:b}}if(h!=null&&h.mode==t.datavisualization.TreeMap.LegendMode.Interactive&&u.model.rangeColorMapping!=null&&(u.showLegend()==r||u.showLegend()))for(o=0;o<u._rootTreeMapItems.length;o++)if(k=u._rootTreeMapItems[o].Rectangle,k==i.target&&(a=null,u.model.rangeColorMapping!=r&&(a=u.model.rangeColorMapping),v=h.width,h.width==r&&(v=150),d=v/a.length/10,u._rootTreeMapItems[o].legendrect!=null)){g=u._rootTreeMapItems[o].legendrect.marginLeft;nt=g+Math.ceil(d)-u._interactiveArrow.width()/2;n(u._interactiveArrow).css({"margin-left":nt,display:"block"});break}},displayTooltip:function(t){var u=t.data.Param2,f=u._toolTipElement,i=u.mousePosition(t),a=!0,h,o,c,v,y,p,s,e,l;if(u.model.trackerElement&&(clearTimeout(u.model.timer),n(".tooltipelement"+this._id).finish()),t.data.Param1==r&&f!=null){for(e=0;e<u._rootTreeMapItems.length;e++)if(o=u._rootTreeMapItems[e],o.rectangle.offsetLeft<i.offsetX&&o.rectangle.offsetLeft+o.rectangle.offsetWidth>i.offsetX&&o.rectangle.offsetTop<i.offsetY&&o.rectangle.offsetTop+o.rectangle.offsetHeight>i.offsetY){h=o.Data;break}h!=null?(c=t.data.Param2.model.tooltipTemplate,f!=null&&c!=null&&(n(f).css({left:i.pageX+10,top:i.pageY+10,display:"block"}),v=n("#"+c).render(h),n(f).html(v),y=f[0]!=null?f[0].clientHeight:f.clientHeight,p=f[0]!=null?f[0].clientWidth:f.clientWidth,u._tooltipSize={height:y,width:p})):f!=null&&(a=!1,n(f).css("display","none"))}if(a){if(s=u._tooltipSize,s.width+i.pageX>=u._width&&(i.pageX-=s.width,i.pageX<0&&(i.pageX=10)),s.height+i.pageY>=u._height&&(i.pageY-=s.height,i.pageY<0&&(i.pageY=10)),u.enableDrillDown()&&u._browser!="msie")for(e=0;e<u._drillHoverDiv[0].children.length;e++)l=u._drillHoverDiv[0].children[e],l.className==t.data.Param1.ParentHeader&&n(l).css({display:"block"});f!=null&&n(f).css({left:i.pageX+10,top:i.pageY+10,display:"block"})}},_rectMouseUp:function(n){this.isTouch(n)&&this.displayTooltip(n)},_rectMouseMove:function(n){n.data.Param2.isTouch(n)||n.data.Param2.displayTooltip(n)},_rectMouseLeave:function(t){var i=t.data.treeMap._toolTipElement;i==null||t.data.treeMap.isTouch(t)||n(i).css("display","none")},_setColorMappings:function(n,i,r){for(var e,o,f=this,s=this.model.legendSettings,u=0;u<n.length;u++)r||(e=n[u].Data instanceof Array?f._reflection(n[u].Data[0],this.colorValuePath()):f._reflection(n[u].Data,this.colorValuePath())),i.rangeColorMapping!=null&&i.rangeColorMapping.length>0||i.uniColorMapping!=null&&(i.uniColorMapping.color!=null||this.uniColor()!=null)?s.mode==t.datavisualization.TreeMap.LegendMode.Interactive||this.model.enableGradient?n[u].legendrect=this._updateLegendRange(e,n[u]):(o=n[u]._generateColorMappings(i,this),n[u].backgroundColor=o):i.desaturationColorMapping!=null&&(i.desaturationColorMapping.color!=""||this._color()!="")?this._setDesaturationColor(n,i.desaturationColorMapping):i.paletteColorMapping!=null&&this._setPaletteColor(n,i.paletteColorMapping)},_setDesaturationColor:function(n,t){var e,c,u,l,r;n=n.sort(this._orderBycolorWeight);var i=typeof t.from=="number"?t.from:this._from(),f=typeof t.to=="number"?t.to:this._to(),s=typeof t.rangeMinimum=="number"?t.rangeMinimum:this._rangeMinimum(),h=typeof t.rangeMaximum=="number"?t.rangeMaximum:this._rangeMaximum(),o=[];for(e=0;e<n.length;e++)c=n[e].Data[0],u=this._reflection(c,this.colorValuePath()),u!=null&&typeof u!="number"&&(u=Number(u.replace(/[^0-9\.]+/g,""))),o.push(u);for(this._rangeMinimum()==0&&(s=Math.min.apply(Math,o)),this._rangeMaximum()==0&&(h=Math.max.apply(Math,o)),(i<0||i>1)&&(i=1),(f>1||f<0)&&(f=0),l=(i-f)/n.length,r=0;r<n.length;r++)n[r].backgroundColor=typeof t.color=="string"?t.color:this._color(),n[r].colorWeight>=s&&n[r].colorWeight<=h&&(n[r].backgroundOpacity=i,i=i-l)},_generateGradientCollection:function(n){for(var f=[],r=n[0],u=n[n.length-1],e=this._hexToR(r),o=this._hexToG(r),s=this._hexToB(r),h=this._hexToR(u),c=this._hexToG(u),l=this._hexToB(u),i=10,a=this._getRangeColorValues(i,e,h),v=this._getRangeColorValues(i,o,c),y=this._getRangeColorValues(i,s,l),t=0;t<i;t++)f.push(this._rgbToHex(a[t],v[t],y[t]));return f},_hexToR:function(n){return parseInt(this._cropHex(n).substring(0,2),16)},_hexToG:function(n){return parseInt(this._cropHex(n).substring(2,4),16)},_hexToB:function(n){return parseInt(this._cropHex(n).substring(4,6),16)},_cropHex:function(n){return n.charAt(0)=="#"?n.substring(1,7):n},_rgbToHex:function(n,t,i){return"#"+this._toHex(n)+this._toHex(t)+this._toHex(i)},_toHex:function(n){var t="0123456789ABCDEF";return(n=parseInt(n,10),isNaN(n))?"00":(n=Math.max(0,Math.min(n,255)),t.charAt((n-n%16)/16)+t.charAt(n%16))},_getRangeColorValues:function(n,t,i){var u=[],f,r;if(u.push(t),t>i)for(f=(t-i)/(n-1),r=n;r>2;r--)t=t-f,u.push(t);else for(f=(i-t)/(n-1),r=2;r<n;r++)t=t+f,u.push(t+f);return u.push(i),u},_isSVG:function(){return window.SVGSVGElement?!0:!1},_drawInteractiveLegend:function(){var i=this.model.legendSettings,u=0,h=0,f=this._legenddiv,w=this.model.legendSettings.height!=0?this.model.legendSettings.height:30,c=this.model.legendSettings.width!=0?this.model.legendSettings.width:100,it,ht,k,rt,a,l,b,e,v,d,et,ct,ot,g,s,tt,o;if(i.mode==t.datavisualization.TreeMap.LegendMode.Interactive||this.model.rangeColorMapping!=null){for(o="",i.height==0&&(w=30),i.width==0&&(c=100),i.leftLabel==null&&(i.leftLabel=""),i.title!=null&&(it=u,i.showLabels||(it=u+i.leftLabel.length*10),ht=i.title.length*10,k=titleText=i.title,ht>c&&(k=this._trimFunction(k,c)),o=this._createLabel(k,it,h,"e-interactivelegend-title"),o[0].title=titleText,o.css({width:c+"px"}),this._isSVG()?o.appendTo(f):f.append(o),h+=25),i.showLabels&&(h+=25),i.leftLabel==null||i.showLabels||(o=this._createLabel(i.leftLabel,u,h-3,"e-interactivelegend-leftlabel"),this._isSVG()?o.appendTo(f):f.append(o),u=u+i.leftLabel.length*10),rt=this._createInteractiveArrow(u,h+w),rt.appendTo(f),this._interactiveArrow=rt,a=null,!this._isSVG()&&this.model.enableGradient&&(a=this._createGroup(!1,"legendGroup"),a.style.left="0px",a.style.top="0px",a.style.position="relative",f.append(a)),l=this.model.rangeColorMapping,b=0;b<l.length;b++)if(e=l[b],!e.hideLegend){if(v=[],this.model.enableGradient&&(v=this._generateGradientCollection(e.gradientColors)),d={},this.model.enableGradient)if(this._isSVG()){var ut=n("<canvas/>"),ft=ut[0].getContext("2d"),y=ft.createLinearGradient(0,0,300,0),p=0;for(s=0;s<10;s++)p=p+1/10,s==0?(y.addColorStop(0,e.gradientColors[0]),y.addColorStop(p,v[s])):s==v.length-1?(y.addColorStop(p-1/10,v[s]),y.addColorStop(p,e.gradientColors[1])):(y.addColorStop(p-1/10,v[s]),y.addColorStop(p,v[s+1]));ft.fillStyle=y;ft.fillRect(0,0,300,300);ut.css({height:w+"px",width:c/l.length+"px","margin-left":u+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"});ut.appendTo(f)}else et="legend"+b,ct="<v:rect id="+et+' display="block" style="position:absolute;top: '+(h-2)+"px;left:"+u+"px;width:"+c/l.length+"px;height:"+w+'px;"><v:fill opacity="0.9px" type="gradient" method="linear sigma" angle="270"/><v:stroke opacity="0px"/><\/v:rect>',a.innerHTML=a.innerHTML+ct,ot=document.getElementById(et),ot.fillcolor=e.gradientColors[0],ot.fill.color2=e.gradientColors[1];else g=n("<div/>"),g.css({height:w+"px",width:c/this.model.rangeColorMapping.length+"px","background-color":e.color,"margin-left":u+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"}),this._isSVG()?g.appendTo(f):f.append(g);for(s=0;s<10;s++)d={},d.marginLeft=u,this._legendRects.push(d),u=u+c/l.length/10;if(this.model.legendSettings.showLabels){var nt=u-c/l.length,st=h-25,lt=this._createLabel(e.from,nt,st,"e-legend-rangestartlabel");nt=xpos;tt=this._createLabel(e.to,nt,st);e.legendLabel!=r&&(tt=this._createLabel(e.legendLabel,nt-e.legendLabel.length*5,st,"e-legend-rangeendlabel"));this._isSVG()?(e==l[0]&<.appendTo(f),tt.appendTo(f)):(e==l[0]&&f.append(lt),f.append(tt))}}i.rightLabel==null||i.showLabels||(o=this._createLabel(i.rightLabel,u+10,h-3,"e-interactivelegend-rightlabel"),this._isSVG()?o.appendTo(f):f.append(o),u=u+i.rightLabel.length*10);totalwidth=u+10;totalheight=h+w+this._interactiveArrow.height();this._legendSize={width:totalwidth,height:totalheight};i.dockPosition=="left"?this._marginleft=totalwidth:i.dockPosition=="top"&&(this._margintop=totalheight)}},_trimFunction:function(t,i){var r=n('<div style="width:auto;position:absolute;" class= "e-interactivelegend-title">'+t+"<\/div>"),u;for(n(document.body).append(r),u=t;r.width()>i;)u=u.slice(0,-2),r.text(u+"...");return document.body.removeChild(r[0]),r.text()},_createLabel:function(t,i,r,u){var f=n("<div class="+u+"><\/div>");return f[0].innerHTML=t,f.css({"margin-left":i+"px","margin-top":r+"px",position:"absolute"}),f},_createInteractiveArrow:function(t,i){var r=n("<div class='e-icon1 e-interactiveArrow'><\/div>");return r[0].innerHTML="▲",r.css({"margin-left":t+"px","margin-top":i+"px",position:"absolute"}),r},_createGroup:function(n,t){var i;return i=document.createElement("<v:group class="+t+">"),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,n&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_setPaletteColor:function(n,t){n=n.sort(this._orderBycolorWeight);for(var i=0;i<n.length;i++)t.colors!=null&&t.colors.length>0&&(n[i].backgroundColor=t.colors[i%t.colors.length])},_orderBycolorWeight:function(n,t){return n.colorWeight==t.colorWeight?0:n.colorWeight<t.colorWeight?1:-1},_orderByAreaWight:function(n,t){return n.AreaByWeight==t.AreaByWeight?0:n.AreaByWeight<t.AreaByWeight?1:-1},_calculateSliceAndDiceItemSize:function(n,t,i,u,f,e,o,s,h){var a,g,l,p,nt,b,v,tt,d,c,k,y;e==""&&(e=0);a=e;g=this._getTotalWeight(n);s==r&&(s=u>f?!0:!1);l={Width:u,Height:f-h};p=o<l.Height?o:0;l.Height=l.Height-p;var rt={X:t,Y:i+p,Width:l.Width,Height:l.Height},it=l.Height*l.Width,w=n.length;if(s)for(nt=l.Height,b=0,c=0;c<w;c++)k=it/g*n[c].weight,v=k/nt,e=v>a?a:0,b<=l.Width&&(n[c].ItemWidth=c!=w-1?v-parseFloat(e):v,n[c].ItemHeight=nt,n[c].LeftPosition=b+t,n[c].TopPosition=i+o,b+=v);else for(tt=l.Width,d=0,c=0;c<w;c++)k=it/g*n[c].weight,y=k/tt,e=y>a?a:0,d<=l.Height&&(n[c].ItemWidth=tt,n[c].ItemHeight=c!=w-1?y-parseFloat(e):y,n[c].LeftPosition=t,n[c].TopPosition=d+i+p,d+=y)},_calculateSquarifiedItemSize:function(n,t,i,r,u,f,e,o){var a,tt,it,s,v,y,l,g,c;f==""&&(f=0);var rt=this._getTotalWeight(n),p={Width:r,Height:u-o},nt=e<p.Height?e:0;for(p.Height=p.Height-nt,a=n.length-1;a>=0;a--)l=n[a],l.AreaByWeight=p.Height*p.Width*l.weight/rt,l.headerTopPosition=i;var h={X:t,Y:i+nt,Width:p.Width,Height:p.Height},b=n.sort(this._orderByAreaWight),k=0,d=0,w=0;for(a=0;a<n.length;a=w)for(tt=b[a],weightObject=this._getGroupTotalWeight(tt,b,h,a),it=weightObject.totalWeight,w=weightObject.index,s={},v=h.Width>h.Height?!0:!1,y=a;y<w;y++)l=b[y],g=it,y==a&&(s.X=h.X,s.Y=h.Y,v?(s.Width=g/h.Height,s.Height=h.Height,h.X+=s.Width,h.Width=Math.max(0,h.Width-s.Width)):(s.Width=h.Width,s.Height=g/h.Width,h.Y+=s.Height,h.Height=Math.max(0,h.Height-s.Height)),k=s.X,d=s.Y),c={},b.indexOf(l)!=b.length-1?(c.X=0,c.Y=0,c.Width=v?s.Width-parseFloat(f):l.AreaByWeight/s.Height,c.Height=v?l.AreaByWeight/s.Width:s.Height-parseFloat(f),w-y!=1&&(v?c.Height-=parseFloat(f):c.Width-=parseFloat(f))):(c.Width=v?s.Width:l.AreaByWeight/s.Height,c.Height=v?l.AreaByWeight/s.Width:s.Height),l.ItemWidth=c.Width,l.ItemHeight=c.Height,l.LeftPosition=k,l.TopPosition=d,v?d+=w-y!=1?c.Height+parseFloat(f):c.Height:k+=w-y!=1?c.Width+parseFloat(f):c.Width},_getGroupTotalWeight:function(n,t,i,r){for(var f=0,o=0,s,e,h;r<t.length;r++){s=this._getShortersideLength(i.Width,i.Height);e=t[r];f+=e.AreaByWeight;var u=f/s,c=n.AreaByWeight/u,l=e.AreaByWeight/u;if(r==0&&(o=this._aspectRatio(u,s)),h=Math.max(this._aspectRatio(c,u),this._aspectRatio(l,u)),f==e.AreaByWeight||h<o)o=h;else{f-=e.AreaByWeight;u=f/s;o=Math.max(this._aspectRatio(c,u),this._aspectRatio(l,u));break}}return{totalWeight:f,index:r}},_aspectRatio:function(n,t){return n>t?n/t:t/n},_getShortersideLength:function(n,t){return n>t?t:n},_getTotalWeight:function(n){for(var i=0,t=0;t<n.length;t++)i+=parseFloat(n[t].weight);return i},_getGroupitem:function(t,i,r,u){var a=[],y,h,v,e,l,o,s,d;if(u&&(i=i[0][u]),t==null&&(t=this.labelPath()||this.weightValuePath()),i!=null&&this.weightValuePath()!=null){for(h in i)e=i[h],(e!=null&&e.hasOwnProperty(t)?!0:this._containsProperty(e,t))&&(l=this._reflection(e,t),n.inArray(l,a)==-1&&a.push(l));for(y=[],h=0;h<a.length;h++){var c={},w=[],b=a[h],k=0,p=0,g=0;for(v=0;v<i.length;v++)e=i[v],l=this._reflection(e,t),l==b&&(o=this._reflection(e,this.weightValuePath()),o!=null&&typeof o!="number"&&(o=Number(o.replace(/[^0-9\.]+/g,""))),o<0&&(o=-1*o),s=this._reflection(e,this.colorValuePath()),s!=null&&typeof s!="number"&&(s=Number(s.replace(/[^0-9\.]+/g,""))),w.push(e),g++,o!=null&&(p+=parseFloat(o)),s!=null&&(k+=parseFloat(s)));c.header=b;c.data=w;c.weight=p;c.colorWeight=k;c.headerHeight=r;p>0&&(d=new f(c),y.push(d))}return y}return null},_getTopGroupitem:function(n,t){var s,r,y,h,p;n==null&&(n=this.labelPath());n==null&&(n=this.weightValuePath());var u={},c=0,l=0,a=[],v=[];for(s=0;s<t.length;s++){var e=t[s],w=this._reflection(e,n),o={},i=this._reflection(e,this.weightValuePath());i!=null&&typeof i!="number"&&(i=Number(i.replace(/[^0-9\.]+/g,"")));i<0&&(i=-1*i);r=this._reflection(e,this.colorValuePath());r!=null&&typeof r!="number"&&(r=Number(r.replace(/[^0-9\.]+/g,"")));i!=null&&(c+=parseFloat(i));r!=null&&(l+=parseFloat(r));v.push(e);o.weight=i;o.data=e;o.header=w;o.colorWeight=r;y=new f(o);a.push(y)}return u.header="",u.data=v,u.weight=c,u.innerItem=a,u.colorWeight=l,h=[],p=new f(u),h.push(p),h},_containsProperty:function(n,t){for(var i in n)if(i==t)return!0;return!1},_reflection:function(t,i){var r=t,u,f,e;if(i!=null&&t!=null){for(u=i.split("."),u.push(i),f=0;f<u.length;f++)r!=null&&(e=r.hasOwnProperty(u[f])?!0:this._containsProperty(r,u[f]),e&&n.each(r,function(n,t){if(n==u[f])return r=t,!1}));return r}return null}});u=function(){this.groupBackground=null;this.groupBorderColor=null;this.groupBorderThickness=1;this.groupPadding=4;this.groupPath=null;this.groupGap=1;this.headerHeight=20;this.showHeader=!0;this.showLabels=!1;this.headerTemplate=null;this.labelTemplate=null;this.labelPosition="center";labelVisibilityMode="visible";headerVisibilityMode="visible";this.treeMapItems=[]};u.prototype={};var e=function(){this.groupID=null;this.rangeColorMapping=[];this.desaturationColorMapping={from:0,to:0,color:"",rangeMinimum:0,rangeMaximum:0};this.uniColorMapping={color:null};this.paletteColorMapping={colors:[]}},o=function(){this.from=-1;this.to=-1;this.legendlabel=null;this.color=null},f=function(n){this.weight=n.weight;this.colorWeight=n.colorWeight;this.Data=n.data;this.headerHeight=n.headerHeight;this.header=n.header;this.label=n.header;this.headerLeftPosition=0;this.headerTopPosition=0;this.innerItems=n.innerItem;this.headerWidth=0;this.headerTemplate=null};f.prototype={_generateColorMappings:function(n,t){return n.rangeColorMapping!=null&&n.rangeColorMapping.length>0?this._getRangeBrushColor(n.rangeColorMapping):t.uniColor()!=null&&n.uniColorMapping!=null?t.uniColor():n.uniColorMapping.color!=null&&n.uniColorMapping!=null?this._getUniColor(n.uniColorMapping):void 0},_getUniColor:function(n){return n.color},_getRangeBrushColor:function(n){for(var i,t=0;t<n.length;t++)if(i=n[t],this.colorWeight>=i.from&&this.colorWeight<=i.to)return i.color}};t.datavisualization.TreeMap.selectionMode={Default:"default",Multiple:"multiple"};t.datavisualization.TreeMap.groupSelectionMode={Default:"default",Multiple:"multiple"};t.datavisualization.TreeMap.ItemsLayoutMode={Squarified:"squarified",SliceAndDiceHorizontal:"sliceanddicehorizontal",SliceAndDiceVertical:"sliceanddicevertical",SliceAndDiceAuto:"sliceanddiceauto"};t.datavisualization.TreeMap.DockPosition={Top:"top",Bottom:"bottom",Right:"right",Left:"left"};t.datavisualization.TreeMap.LegendMode={Default:"default",Interactive:"interactive"};t.datavisualization.TreeMap.Position={TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",CenterLeft:"centerleft",Center:"center",CenterRight:"centerright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};t.datavisualization.TreeMap.Alignment={Near:"near",Center:"center",Far:"far"};t.datavisualization.TreeMap.VisibilityMode={Visible:"visible",HideOnExceededLength:"hideonexceededlength"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejBarcode","ej.datavisualization.Barcode",{element:{target:null},model:null,validTags:["div","span"],_rootCSS:"e-barcode",defaults:{displayText:!0,text:"",height:"",width:"",symbologyType:"qrbarcode",textColor:"black",lightBarColor:"white",darkBarColor:"black",quietZone:{left:1,top:1,right:1,bottom:1,all:1},narrowBarWidth:1,wideBarWidth:3,barHeight:150,barcodeToTextGapHeight:10,xDimension:4,encodeStartStopSymbol:!0,load:null,enabled:!0},dataTypes:{displayText:"boolean",text:"string",enabled:"boolean",symbologyType:"enum",narrowBarWidth:"number",wideBarWidth:"number",barHeight:"number",encodeStartStopSymbol:"boolean"},_defaultScaleValues:function(){return{enabled:!0,displayText:!0,text:"",symbologyType:"qrbarcode",textColor:"black",lightBarColor:"white",darkBarColor:"black",quietZone:{left:1,top:1,right:1,bottom:1},narrowBarWidth:1,wideBarWidth:3,barHeight:150,barcodeToTextGapHeight:10,xDimension:4,encodeStartStopSymbol:!0}},_init:function(){this._initialize();this._renderBarcode()},_destroy:function(){this.element.empty()},_setModel:function(n){for(var t in n)switch(t){case"enabled":this._disabled(!n[t]);break;case"height":this.model.height=n[t];break;case"width":this.model.width=n[t];break;case"lightBarColor":this.model.lightBarColor=n[t];break;case"darkBarColor":this.model.darkBarColor=n[t];break;case"textColor":this.model.textColor=n[t];break;case"displayText":this.model.displayText=n[t];break;case"quietZone":this.model.quietZone=n[t];break;case"narrowBarWidth":this.model.narrowBarWidth=n[t];break;case"wideBarWidth":this.model.wideBarWidth=n[t];break;case"barHeight":this.model.barHeight=n[t];break;case"xDimension":this.model.xDimension=n[t];break;case"encodeStartStopSymbol":this.model.encodeStartStopSymbol=n[t];break;case"symbologyType":this.model.symbologyType=n[t];this._itemInitialize();break;case"text":this.model.text=n[t];this._itemInitialize()}this._renderBarcode()},_initialize:function(){this.BarcodeEl=this.element;this.target=this.element[0];this._itemInitialize();this.Model=this.model},_renderBarcode:function(){this.initialize()},_itemInitialize:function(){var t=this;this.model.scales!=null?n.each(this.model.scales,function(i,r){r=t._checkArrayObject(r,i);var u=t._defaultScaleValues();n.extend(u,r);n.extend(r,u)}):this.model.scales=[this._defaultScaleValues()]},_checkArrayObject:function(t,i){var r=this;return n.each(t,function(n,t){if(t instanceof Array)t=r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var u=r._defaultScaleValues();t=r._LoadIndividualDefaultValues(t,u,typeof n=="number"?i:n)}}),t},_LoadIndividualDefaultValues:function(t,i,r){var u=null,f=this;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),n.each(t,function(n,t){t instanceof Array?t=f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&(t=f._LoadIndividualDefaultValues(t,u,typeof n=="number"?r:n))}),n.extend(u,t),n.extend(t,u),t},initialize:function(){this.model.enabled&&(this._initObject(this),this.Model.text!=null&&this._findBarcodeType())},enable:function(){this.model.enabled||(this.element.removeClass("e-disable"),this.model.enabled=!0)},height:function(n){this.Model.height=n},width:function(n){this.Model.width=n},resize:function(){this.Model.text!=null&&this._findBarcodeType()},disable:function(){this.model.enabled&&(this.element.addClass("e-disable"),this.model.enabled=!1)},_disabled:function(n){n?this.disable():this.enable()},_initObject:function(t){t.BarcodeEl=n("#"+t.target.id);t.canvasEl?t.canvasEl.remove():t.canvasEl=n("<canvas><\/canvas>");t.BarcodeEl.append(t.canvasEl);t.BarcodeEl.css("width",t.model.width);t.BarcodeEl.css("height",t.model.height);t.canvasEl[0].setAttribute("width",t.BarcodeEl.width());t.canvasEl[0].setAttribute("height",t.BarcodeEl.height());t.centerX=t.canvasEl[0].width/2;t.centerY=t.canvasEl[0].height/2;var r=t.canvasEl[0];(typeof G_vmlCanvasManager!="undefined"&&(r=window.G_vmlCanvasManager.initElement(r)),r&&r.getContext)&&(t.contextEl=t.canvasEl[0].getContext("2d"),t.contextEl==i)},_findBarcodeType:function(){var y,p,c,o,n,v,s,h,u,l,r,f,e,a,w,b;if(this.contextEl!=i&&this.Model.text!=""){if(this.textFont={size:"12px",fontFamily:"Segoe UI",fontStyle:"Regular"},this.model.quietZone.all>1&&(this.model.quietZone.left=this.model.quietZone.right=this.model.quietZone.top=this.model.quietZone.bottom=this.model.quietZone.all),intercharacterGap=1,extendedText="",continuous=!1,validatorExp="",encodedText=this.Model.text,n=this.Model.symbologyType,v=!0,t.datavisualization.Barcode.SymbologyType.dataMatrix==n||t.datavisualization.Barcode.SymbologyType.qrBarcode==n)v=!1;else if(y=t.datavisualization.Barcode.symbologySettings[n].startSymbol,p=t.datavisualization.Barcode.symbologySettings[n].stopSymbol,validatorExp=t.datavisualization.Barcode.symbologySettings[n].validatorExp,c=t.datavisualization.Barcode.symbologySettings[n].symbolTable,o=t.datavisualization.Barcode.symbologySettings[n].extendedCodes,encodedText=this._calculateCheckDigit(encodedText,c,n),t.datavisualization.Barcode.SymbologyType.code39Extended==n){for(s=encodedText.split(""),h="",u=0;u<s.length;u++)for(l=s[u],r=0;r<o.length;r++)if(o[r][0]==l&&(f=o[r][1],!(f==i)))for(e=0;e<f.length;e++)h+=f[e];extendedText=h}else if(t.datavisualization.Barcode.SymbologyType.code93Extended==n){for(s=encodedText.split(""),h="",u=0;u<s.length;u++)for(l=s[u],r=0;r<o.length;r++)if(o[r][0]==l&&(f=o[r][1],!(f==i)))for(e=0;e<f.length;e++)h+=f[e];extendedText=h}if(v){if(!this._validateText(this.Model.text,validatorExp)){console.log("Barcode Text contains characters that are not accepted by this barcode specification.");return}if(this.model.symbologyType=="code32"&&this.model.text.length!=8){console.log("Barcode Text Length that are not accepted by this barcode specification.");return}extendedText.length>0&&(encodedText=extendedText);this.Model.encodeStartStopSymbol&&(encodedText=y.toString()+encodedText+p.toString());a=this._getCharWidth(encodedText,c);a-=continuous==!1?intercharacterGap*encodedText.length:extendedText.length>0?intercharacterGap*(extendedText.length-this.Model.text.length):intercharacterGap;w=parseInt(this.Model.displayText?this.textFont.size.replace("px",""):0);b=this.Model.quietZone.top+this.Model.quietZone.bottom+this.Model.barHeight+intercharacterGap+(this.Model.displayText?w+this.Model.barcodeToTextGapHeight:0);a+=this.Model.quietZone.left+this.Model.quietZone.right;this._draw1DBarcode(encodedText,c,a)}else t.datavisualization.Barcode.SymbologyType.dataMatrix==n?this._buildDataMatrix():t.datavisualization.Barcode.SymbologyType.qrBarcode==n&&this._buildQRBarcode();this._raiseEvent("load")}},_calculateCheckDigit:function(n,t,i){var f,l,a,v,o,e,r,u;if(i=="code128b"){for(f=0,l=[n.split("")],r=0;r<n.split("").length;r++)a=l[0][r],v=this._findCheckDigit(a,t)[1],f+=v*(r+1);for(f+=104,f=f%103,o=[1],e=0;e<t.length;e++)e==f&&(o[0]=t[e][0]);n+=o.toString()}else if(i=="upcbarcode"){var l=[n.split("")],y=0,s=0;for(r=0;r<n.split("").length;r++)r<11&&(s=n[r],y+=r%2==0?s*3:s*1);var p=(10-y%10)%10,h=n.split(""),c=6;for(u=0;u<h.length;u++)u==6?c+="B"+h[u]:u!=11&&(c+=h[u]);n=c;n+=p;n+=6}return n},_findCheckDigit:function(n,t){for(var i=0;i<t.length;i++)if(t[i][0]==n)return t[i]},_raiseEvent:function(n){this.model[n]&&this._trigger(n)},_buildQRBarcode:function(){var t=this.Model.text,u,i,f,n,r,e,o,s,h;for(this.m_EciAssignmentNumber=3,this.mode="numeric",this.isEci=!1,this.m_Version=1,u=[14,26,42,62,84,106,122,152,180,213,251,287,331,362,412,450,504,560,624,666,711,779,857,911,997,1059,1125,1190,1264,1370,1452,1538,1628,1722,1809,1911,1989,2099,2213,2331],n=0;n<t.length;n++)if(i=t.charCodeAt(n),!(i<58)||!(i>47))if(i<91&&i>64||t[n]=="$"||t[n]=="%"||t[n]=="*"||t[n]=="+"||t[n]=="-"||t[n]=="."||t[n]=="/"||t[n]==":"||t[n]==" ")this.mode="alphanumeric";else if(i>=65377&&i<=65439||i>=97&&i<=122){this.mode="binary";break}else{this.mode="binary";this.isEci=!0;break}for(this.mode=="numeric"?u=[34,63,101,149,202,255,293,365,432,513,604,691,796,871,991,1082,1212,1346,1500,1600,1708,1872,2059,2188,2395,2544,2701,2857,3035,3289,3486,3693,3909,4134,4343,4588,4775,5039,5313,5596]:this.mode=="alphanumeric"&&(u=[20,38,61,90,122,154,178,221,262,311,366,419,483,528,600,656,734,816,909,970,1035,1134,1248,1326,1451,1542,1637,1732,1839,1994,2113,2238,2369,2506,2632,2780,2894,3054,3220,3391]),this.isEci==!0&&(this.m_EciAssignmentNumber=this._findECINumber(t)),n=0;n<u.length;n++)if(u[n]>t.length){this.m_Version=n+1;break}for(this.qrbarcodeValues={Version:this.m_Version,ErrorCorrectionLevel:1,NumberOfDataCodeWord:this._getNumberOfDataCodeWord(),NumberOfErrorCorrectingCodeWords:this._getNumberOfErrorCorrectingCodeWords(),NumberOfErrorCorrectionBlocks:this._getNumberOfErrorCorrectionBlocks(),End:this._getEnd(),DataCapacity:this._getDataCapacity(),FormatInformation:this._getFormatInformation(),VersionInformation:this._getVersionInformation()},this.noOfModules=(this.m_Version-1)*4+21,this.moduleValue=this._create2DArray(this.noOfModules,this.noOfModules),n=0;n<this.noOfModules;n++)for(r=0;r<this.noOfModules;r++)this.moduleValue[n][r]={IsBlack:!1,IsFilled:!1,IsPDP:!1};if(this._drawPDP(0,0),this._drawPDP(this.noOfModules-7,0),this._drawPDP(0,this.noOfModules-7),this._drawTimingPattern(),this.m_Version!=1)for(f=this._getAlignmentPatternCoOrdinates(),n=0;n<f.length;n++)for(r=0;r<f.length;r++)e=f[n],o=f[r],this.moduleValue[e][o].IsPDP!=!0&&this._drawAlignmentPattern(e,o);this._allocateFormatVersionInfo();this._encodeData();this._drawFormatInformation();this._addQuietZone();s=this.moduleValue.length*this.Model.xDimension;h=this.moduleValue[0].length*this.Model.xDimension;this.contextEl.beginPath();this.contextEl.fillStyle="white";this.contextEl.fillRect(0,0,s,h);this.contextEl.closePath();this._drawQRBarcode(h,s)},_allocateFormatVersionInfo:function(){for(var i,r,t,n=0;n<9;n++)this.moduleValue[8][n].IsFilled=!0,this.moduleValue[n][8].IsFilled=!0;for(n=this.noOfModules-8;n<this.noOfModules;n++)this.moduleValue[8][n].IsFilled=!0,this.moduleValue[n][8].IsFilled=!0;if(this.m_Version>6)for(i=this.qrbarcodeValues.VersionInformation,r=0,n=0;n<6;n++)for(t=2;t>=0;t--)this.moduleValue[n][this.noOfModules-9-t].IsBlack=i[r]==1?!0:!1,this.moduleValue[n][this.noOfModules-9-t].IsFilled=!0,this.moduleValue[this.noOfModules-9-t][n].IsBlack=i[r++]==1?!0:!1,this.moduleValue[this.noOfModules-9-t][n].IsFilled=!0},_drawTimingPattern:function(){for(var n=8;n<this.noOfModules-8;n+=2)this.moduleValue[n][6].IsBlack=!0,this.moduleValue[n][6].IsFilled=!0,this.moduleValue[n+1][6].IsBlack=!1,this.moduleValue[n+1][6].IsFilled=!0,this.moduleValue[6][n].IsBlack=!0,this.moduleValue[6][n].IsFilled=!0,this.moduleValue[6][n+1].IsBlack=!1,this.moduleValue[6][n+1].IsFilled=!0;this.moduleValue[this.noOfModules-8][8].IsBlack=!0;this.moduleValue[this.noOfModules-8][8].IsFilled=!0},_drawQRBarcode:function(n,t){var u=this.Model.quietZone.all,o,i,s,r,e;u<2&&(u=2);var f=parseInt(this.Model.xDimension);this.Model.height!=""&&this.Model.width!=""?(this.Model.height=this._getProperValue(this.Model.height),this.Model.width=this._getProperValue(this.Model.width)):(this.Model.height=n,this.Model.width=t,this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width),this.canvasEl[0].setAttribute("height",this.Model.height),this.BarcodeEl.css("height",this.Model.height));o=Math.min(this.Model.width,this.Model.height);o!=0&&(f=o/(this.noOfModules+2*u));var h=0,t=this.noOfModules+2*u,c=this.noOfModules+2*u;for(this.contextEl.beginPath(),i=0;i<t;i++){for(s=0,r=0;r<c;r++)e=null,e=this.moduleValue[i][r].IsBlack?this.model.darkBarColor:this.model.lightBarColor,this.dataAllocationValues[r][i].IsFilled&&this.dataAllocationValues[r][i].IsBlack&&(e="black"),this.contextEl.fillStyle=e,this.contextEl.fillRect(s,h,f,f),s+=f;h+=f}this.contextEl.closePath();this.contextEl.stroke()},_getProperValue:function(n){return n==""?"":typeof n=="string"?(n=n.replace("px",""),parseInt(n)):typeof n=="number"?n:0},_addQuietZone:function(){var n=this.Model.quietZone.all,t,i;n<2&&(n=2);var r=this.noOfModules+2*n,u=this.noOfModules+2*n,f=this._create2DArray(r,u),e=this._create2DArray(r,u);for(t=0;t<r;t++)for(i=0;i<u;i++)f[t][i]={IsBlack:!1,IsFilled:!1,IsPDP:!1},e[t][i]={IsBlack:!1,IsFilled:!1,IsPDP:!1};for(t=n;t<r-n;t++)for(i=n;i<u-n;i++)f[t][i]=this.moduleValue[t-n][i-n],e[t][i]=this.dataAllocationValues[t-n][i-n];this.moduleValue=f;this.dataAllocationValues=e},_drawFormatInformation:function(){for(var t=this.qrbarcodeValues.FormatInformation,i=0,n=0;n<7;n++)n==6?this.moduleValue[n+1][8].IsBlack=t[i]==1?!0:!1:this.moduleValue[n][8].IsBlack=t[i]==1?!0:!1,this.moduleValue[8][this.noOfModules-n-1].IsBlack=t[i++]==1?!0:!1;for(i=14,n=0;n<7;n++)n==6?this.moduleValue[8][n+1].IsBlack=t[i]==1?!0:!1:this.moduleValue[8][n].IsBlack=t[i]==1?!0:!1,this.moduleValue[this.noOfModules-n-1][8].IsBlack=t[i--]==1?!0:!1;this.moduleValue[8][8].IsBlack=t[7]==1?!0:!1;this.moduleValue[8][this.noOfModules-8].IsBlack=t[7]==1?!0:!1},_dataAllocationAndMasking:function(n){var r=this.noOfModules,u,t,i,f;for(this.dataAllocationValues=this._create2DArray(r,r),u=0,t=0;t<r;t++)for(i=0;i<r;i++)this.dataAllocationValues[t][i]={IsBlack:!1,IsFilled:!1,IsPDP:!1};for(t=r-1;t>=0;t-=2){for(i=r-1;i>=0;i--)u=this._allocateValues(n,t,i,u);for(t-=2,t==6&&t--,i=0;i<r;i++)u=this._allocateValues(n,t,i,u)}for(t=0;t<r;t++)for(i=0;i<r;i++)this.moduleValue[t][i].IsFilled||(f=this.dataAllocationValues[t][i].IsBlack,this.dataAllocationValues[t][i].IsBlack=f?!1:!0)},_allocateValues:function(n,t,i,r){return this.moduleValue[t][i].IsFilled&&this.moduleValue[t-1][i].IsFilled||(this.moduleValue[t][i].IsFilled||(r+1<n.length&&(this.dataAllocationValues[t][i].IsBlack=n[r++]),this.dataAllocationValues[t][i].IsBlack=(t+i)%3==0?this.dataAllocationValues[t][i].IsBlack?!0:!1:this.dataAllocationValues[t][i].IsBlack?!1:!0,this.dataAllocationValues[t][i].IsFilled=!0),this.moduleValue[t-1][i].IsFilled||(r+1<n.length&&(this.dataAllocationValues[t-1][i].IsBlack=n[r++]),this.dataAllocationValues[t-1][i].IsBlack=(t-1+i)%3==0?this.dataAllocationValues[t-1][i].IsBlack?!0:!1:this.dataAllocationValues[t-1][i].IsBlack?!1:!0,this.dataAllocationValues[t-1][i].IsFilled=!0)),r},_encodeData:function(){var t=[],i=-1,b,s,u,nt,p,a,f,e,l,k,d,g,tt,w,it,c,v,n,o,r;switch(this.mode){case"numeric":t[++i]=!1;t[++i]=!1;t[++i]=!1;t[++i]=!0;break;case"alphanumeric":t[++i]=!1;t[++i]=!1;t[++i]=!0;t[++i]=!1;break;case"binary":if(this.isEci)for(t[++i]=!1,t[++i]=!0,t[++i]=!0,t[++i]=!0,e=this._stringToBoolArray(this.m_EciAssignmentNumber.toString(),8),b=0;b<e.length;b++)t[++i]=e[b];t[++i]=!1;t[++i]=!0;t[++i]=!1;t[++i]=!1}if(s=0,this.m_Version<10)switch(this.mode){case"numeric":s=10;break;case"alphanumeric":s=9;break;case"binary":s=8}else if(this.m_Version<27)switch(this.mode){case"numeric":s=12;break;case"alphanumeric":s=11;break;case"binary":s=16}else switch(this.mode){case"numeric":s=14;break;case"alphanumeric":s=13;break;case"binary":s=16}for(u=this.Model.text,nt=this._intToBoolArray(u.length,s),n=0;n<s;n++)t[++i]=nt[n];if(this.mode=="numeric"){for(f="",n=0;n<u.length;n++)if(e=[],f+=u[n],n%3==2&&n!=0||n==u.length-1)for(e=f.length==3?this._stringToBoolArray(f,10):f.length==2?this._stringToBoolArray(f,7):this._stringToBoolArray(f,4),f="",r=0;r<e.length;r++)t[++i]=e[r]}else if(this.mode=="alphanumeric")for(p="",f=0,n=0;n<u.length;n++){if(e=[],p+=u[n],n%2==0&&n+1!=u.length&&(f=45*this._getAlphanumericvalues(u[n])),n%2==1&&n!=0){for(f+=this._getAlphanumericvalues(u[n]),e=this._intToBoolArray(f,11),f=0,a=0;a<e.length;a++)t[++i]=e[a];p=""}if(n!=1&&p!=null&&n+1==u.length&&p.length==1)for(f=this._getAlphanumericvalues(u[n]),e=this._intToBoolArray(f,6),f=0,r=0;r<e.length;r++)t[++i]=e[r]}else if(this.mode="binary")for(n=0;n<u.length;n++){if(f=0,u.charCodeAt(n)>=32&&u.charCodeAt(n)<=126||u.charCodeAt(n)>=161&&u.charCodeAt(n)<=255)f=u.charCodeAt(n);else if(u.charCodeAt(n)>=65377&&u.charCodeAt(n)<=65439)f=u.charCodeAt(n)-65216;else{console.log("Input text contains non-convertable characters");return}for(e=this._intToBoolArray(f,8),r=0;r<e.length;r++)t[++i]=e[r]}for(n=0;n<4;n++)if(t.length/8==this.qrbarcodeValues.NumberOfDataCodeWord)break;else t[++i]=!1;for(;;)if(t.length%8==0)break;else t[++i]=!1;for(;;){if(t.length/8==this.qrbarcodeValues.NumberOfDataCodeWord)break;else t[++i]=!0,t[++i]=!0,t[++i]=!0,t[++i]=!1,t[++i]=!0,t[++i]=!0,t[++i]=!1,t[++i]=!1;if(t.length/8==this.qrbarcodeValues.NumberOfDataCodeWord)break;else t[++i]=!1,t[++i]=!1,t[++i]=!1,t[++i]=!0,t[++i]=!1,t[++i]=!1,t[++i]=!1,t[++i]=!0}w=this.qrbarcodeValues.NumberOfDataCodeWord;blocks=this.qrbarcodeValues.NumberOfErrorCorrectionBlocks;l=blocks[0];blocks.length==6&&(l=blocks[0]+blocks[3]);var y=new Array(l),h=t,a=-1;if(blocks.length==6)for(k=blocks[0]*blocks[2]*8,h=new Array(k),n=0;n<k;n++)h[++a]=t[n];for(d=this._create2DArray(blocks[0],h.length/8/blocks[0]),d=this._createBlocks(h,blocks[0]),n=0;n<blocks[0];n++)y[n]=this._splitCodeWord(d,n,h.length/8/blocks[0]);if(a=-1,blocks.length==6){for(h=[],n=parseInt(blocks[0]*blocks[2]*8);n<t.length;n++)h[++a]=t[n];for(g=this._create2DArray(blocks[0],h.length/8/blocks[3]),g=this._createBlocks(h,blocks[3]),n=blocks[0],v=0;n<l;n++)y[n]=this._splitCodeWord(g,v++,h.length/8/blocks[3])}for(t=[],i=-1,n=0;n<125;n++)for(o=0;o<l;o++)for(r=0;r<8;r++)n<y[o].length&&(tt=y[o][n][r],t[++i]=tt=="1"?!0:!1);for(this.corCodeWords={DataBits:this.qrbarcodeValues.NumberOfDataCodeWord,ECCW:this.qrbarcodeValues.NumberOfErrorCorrectingCodeWords,DC:0},w=this.corCodeWords.DataBits,it=this.corCodeWords.ECCW,blocks=this.qrbarcodeValues.NumberOfErrorCorrectionBlocks,this.corCodeWords.DataBits=blocks.length==6?(w-blocks[3]*blocks[5])/blocks[0]:w/blocks[0],this.corCodeWords.ECCW=it/l,c=new Array(l),v=0,n=0;n<blocks[0];n++)this.corCodeWords.DC=y[v],c[v++]=this._getERCW();if(blocks.length==6)for(this.corCodeWords.DataBits=(w-blocks[0]*blocks[2])/blocks[3],n=0;n<blocks[3];n++)this.corCodeWords.DC=y[v],c[v++]=this._getERCW();if(blocks.length!=6)for(n=0;n<c[0].length;n++)for(o=0;o<blocks[0];o++)for(r=0;r<8;r++)n<c[o].length&&(t[++i]=c[o][n][r]=="1"?!0:!1);else for(n=0;n<c[0].length;n++)for(o=0;o<l;o++)for(r=0;r<8;r++)n<c[o].length&&(t[++i]=c[o][n][r]=="1"?!0:!1);this._dataAllocationAndMasking(t)},_getERCW:function(){var i,t=new Array(this.corCodeWords.DataBits),n=[];switch(this.corCodeWords.ECCW){case 7:n=[0,87,229,146,149,238,102,21];n=this._getElement(n);break;case 10:n=[0,251,67,46,61,118,70,64,94,32,45];n=this._getElement(n);break;case 13:n=[0,74,152,176,100,86,100,106,104,130,218,206,140,78];n=this._getElement(n);break;case 15:n=[0,8,183,61,91,202,37,51,58,58,237,140,124,5,99,105];n=this._getElement(n);break;case 16:n=[0,120,104,107,109,102,161,76,3,91,191,147,169,182,194,225,120];n=this._getElement(n);break;case 17:n=[0,43,139,206,78,43,239,123,206,214,147,24,99,150,39,243,163,136];n=this._getElement(n);break;case 18:n=[0,215,234,158,94,184,97,118,170,79,187,152,148,252,179,5,98,96,153];n=this._getElement(n);break;case 20:n=[0,17,60,79,50,61,163,26,187,202,180,221,225,83,239,156,164,212,212,188,190];n=this._getElement(n);break;case 22:n=[0,210,171,247,242,93,230,14,109,221,53,200,74,8,172,98,80,219,134,160,105,165,231];n=this._getElement(n);break;case 24:n=[0,229,121,135,48,211,117,251,126,159,180,169,152,192,226,228,218,111,0,117,232,87,96,227,21];n=this._getElement(n);break;case 26:n=[0,173,125,158,2,103,182,118,17,145,201,111,28,165,53,161,21,245,142,13,102,48,227,153,145,218,70];n=this._getElement(n);break;case 28:n=[0,168,223,200,104,224,234,108,180,110,190,195,147,205,27,232,201,21,43,245,87,42,195,212,119,242,37,9,123];n=this._getElement(n);break;case 30:n=[0,41,173,145,152,216,31,179,182,50,48,110,86,239,96,222,125,42,173,226,193,224,130,156,37,251,216,238,40,192,180];n=this._getElement(n);break;case 32:n=[0,10,6,106,190,249,167,4,67,209,138,138,32,242,123,89,27,120,185,80,156,38,69,171,60,28,222,80,52,254,185,220,241];n=this._getElement(n);break;case 34:n=[0,111,77,146,94,26,21,108,19,105,94,113,193,86,140,163,125,58,158,229,239,218,103,56,70,114,61,183,129,167,13,98,62,129,51];n=this._getElement(n);break;case 36:n=[0,200,183,98,16,172,31,246,234,60,152,115,0,167,152,113,248,238,107,18,63,218,37,87,210,105,177,120,74,121,196,117,251,113,233,30,120];n=this._getElement(n);break;case 40:n=[0,59,116,79,161,252,98,128,205,128,161,247,57,163,56,235,106,53,26,187,174,226,104,170,7,175,35,181,114,88,41,47,163,125,134,72,20,232,53,35,15];n=this._getElement(n);break;case 42:n=[0,250,103,221,230,25,18,137,231,0,3,58,242,221,191,110,84,230,8,188,106,96,147,15,131,139,34,101,223,39,101,213,199,237,254,201,123,171,162,194,117,50,96];n=this._getElement(n);break;case 44:n=[0,190,7,61,121,71,246,69,55,168,188,89,243,191,25,72,123,9,145,14,247,1,238,44,78,143,62,224,126,118,114,68,163,52,194,217,147,204,169,37,130,113,102,73,181];n=this._getElement(n);break;case 46:n=[0,112,94,88,112,253,224,202,115,187,99,89,5,54,113,129,44,58,16,135,216,169,211,36,1,4,96,60,241,73,104,234,8,249,245,119,174,52,25,157,224,43,202,223,19,82,15];n=this._getElement(n);break;case 48:n=[0,228,25,196,130,211,146,60,24,251,90,39,102,240,61,178,63,46,123,115,18,221,111,135,160,182,205,107,206,95,150,120,184,91,21,247,156,140,238,191,11,94,227,84,50,163,39,34,108];n=this._getElement(n);break;case 50:n=[0,232,125,157,161,164,9,118,46,209,99,203,193,35,3,209,111,195,242,203,225,46,13,32,160,126,209,130,160,242,215,242,75,77,42,189,32,113,65,124,69,228,114,235,175,124,170,215,232,133,205];n=this._getElement(n);break;case 52:n=[0,116,50,86,186,50,220,251,89,192,46,86,127,124,19,184,233,151,215,22,14,59,145,37,242,203,134,254,89,190,94,59,65,124,113,100,233,235,121,22,76,86,97,39,242,200,220,101,33,239,254,116,51];n=this._getElement(n);break;case 54:n=[0,183,26,201,87,210,221,113,21,46,65,45,50,238,184,249,225,102,58,209,218,109,165,26,95,184,192,52,245,35,254,238,175,172,79,123,25,122,43,120,108,215,80,128,201,235,8,153,59,101,31,198,76,31,156];n=this._getElement(n);break;case 56:n=[0,106,120,107,157,164,216,112,116,2,91,248,163,36,201,202,229,6,144,254,155,135,208,170,209,12,139,127,142,182,249,177,174,190,28,10,85,239,184,101,124,152,206,96,23,163,61,27,196,247,151,154,202,207,20,61,10];n=this._getElement(n);break;case 58:n=[0,82,116,26,247,66,27,62,107,252,182,200,185,235,55,251,242,210,144,154,237,176,141,192,248,152,249,206,85,253,142,65,165,125,23,24,30,122,240,214,6,129,218,29,145,127,134,206,245,117,29,41,63,159,142,233,125,148,123];n=this._getElement(n);break;case 60:n=[0,107,140,26,12,9,141,243,197,226,197,219,45,211,101,219,120,28,181,127,6,100,247,2,205,198,57,115,219,101,109,160,82,37,38,238,49,160,209,121,86,11,124,30,181,84,25,194,87,65,102,190,220,70,27,209,16,89,7,33,240];n=this._getElement(n);break;case 62:n=[0,65,202,113,98,71,223,248,118,214,94,0,122,37,23,2,228,58,121,7,105,135,78,243,118,70,76,223,89,72,50,70,111,194,17,212,126,181,35,221,117,235,11,229,149,147,123,213,40,115,6,200,100,26,246,182,218,127,215,36,186,110,106];n=this._getElement(n);break;case 64:n=[0,45,51,175,9,7,158,159,49,68,119,92,123,177,204,187,254,200,78,141,149,119,26,127,53,160,93,199,212,29,24,145,156,208,150,218,209,4,216,91,47,184,146,47,140,195,195,125,242,238,63,99,108,140,230,242,31,204,11,178,243,217,156,213,231];n=this._getElement(n);break;case 66:n=[0,5,118,222,180,136,136,162,51,46,117,13,215,81,17,139,247,197,171,95,173,65,137,178,68,111,95,101,41,72,214,169,197,95,7,44,154,77,111,236,40,121,143,63,87,80,253,240,126,217,77,34,232,106,50,168,82,76,146,67,106,171,25,132,93,45,105];n=this._getElement(n);break;case 68:n=[0,247,159,223,33,224,93,77,70,90,160,32,254,43,150,84,101,190,205,133,52,60,202,165,220,203,151,93,84,15,84,253,173,160,89,227,52,199,97,95,231,52,177,41,125,137,241,166,225,118,2,54,32,82,215,175,198,43,238,235,27,101,184,127,3,5,8,163,238];n=this._getElement(n)}return t=this._toDecimal(this.corCodeWords.DC,t),i=this._divide(n,t),this._toBinary(i)},_toBinary:function(n){for(var i,r,u,f=new Array(this.corCodeWords.ECCW),t=0;t<n.length;t++){for(i=n[t].toString(2),r=new String,u=0;u<8-i.length;u++)r+="0";f[t]=r+i}return f},_divide:function(n,t){for(var r,h,u,c,e,s,o=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142],l=this.corCodeWords.ECCW,f=[],i=0;i<t.length;i++)f.push({Exponent:t.length-1-i,Coefficient:t[i]});for(r=[],i=0;i<n.length;i++)r.push({Exponent:n.length-1-i,Coefficient:this._findElement(n[i],o)});for(i=0;i<f.length;i++)f[i].Exponent=f[i].Exponent+l;for(h=f[0].Exponent-r[0].Exponent,i=0;i<r.length;i++)r[i].Coefficient=r[i].Coefficient,r[i].Exponent=r[i].Exponent+h;for(u=f,i=0;i<f.length;i++)u[0].Coefficient==0?u.splice(0,1):(c=this._convertToAlphaNotation(u,o),e=this._multiplyGeneratorPolynomByLeadterm(r,c[0],i),e=this._convertToDecNotation(e,o),e=this._XORPolynoms(u,e),u=e);for(s=[],i=0;i<u.length;i++)s.push(u[i].Coefficient);return s},_convertToAlphaNotation:function(n,t){for(var r=[],i=0;i<n.length;i++)n[i].Coefficient!=0&&r.push({Exponent:n[i].Exponent,Coefficient:this._findElement(n[i].Coefficient,t)});return r},_multiplyGeneratorPolynomByLeadterm:function(n,t,i){for(var u=[],r=0;r<n.length;r++)u.push({Exponent:n[r].Exponent-i,Coefficient:(n[r].Coefficient+t.Coefficient)%255});return u},_convertToDecNotation:function(n,t){for(var r=[],i=0;i<n.length;i++)r.push({Exponent:n[i].Exponent,Coefficient:this._getIntValFromAlphaExp(n[i].Coefficient,t)});return r},_getIntValFromAlphaExp:function(n,t){return n>255&&(n=n-255),t[n]},_XORPolynoms:function(n,t){var f=[],r=[],u=[],i;for(n.length>=t.length?(r=n,u=t):(r=t,u=n),i=0;i<r.length;i++)f.push({Exponent:n[0].Exponent-i,Coefficient:r[i].Coefficient^(u.length>i?u[i].Coefficient:0)});return f.splice(0,1),f},_findElement:function(n,t){for(var i=0;i<t.length;i++)if(n==t[i])break;return i},_getElement:function(n){for(var i=new Array(n.length),r=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142],t=0;t<n.length;t++)n[t]>255&&(n[t]=n[t]-255),i[t]=r[n[t]];return i},_toDecimal:function(n){for(var i=new Array(n.length),t=0;t<n.length;t++)i[t]=parseInt(n[t],2);return i},_splitCodeWord:function(n,t,i){var u,r;for(i=parseInt(i),u=new Array(i),r=0;r<i;r++)u[r]=n[t][r];return u},_createBlocks:function(n,t){for(var f=this._create2DArray(t,n.length/8/t),u="",i=0,r=0,e=0;i<n.length;i++)i%8==0&&i!=0&&(f[e][r]=u,u="",r++,r==n.length/t/8&&(e++,r=0)),u+=n[i]?1:0;return f[e][r]=u,f},_getAlphanumericvalues:function(n){return["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"].indexOf(n)},_stringToBoolArray:function(n,t){for(var u=new Array(t),r=0,i=0;i<n.length;i++)r=r*10+n.charCodeAt(i)-48;for(i=0;i<t;i++)u[t-i-1]=(r>>i&1)==1;return u},_intToBoolArray:function(n,t){for(var r=new Array(t),i=0;i<t;i++)r[t-i-1]=(n>>i&1)==1;return r},_drawPDP:function(n,t){for(var i=n,r=t;i<n+7;i++,r++)this.moduleValue[i][t].IsBlack=!0,this.moduleValue[i][t].IsFilled=!0,this.moduleValue[i][t].IsPDP=!0,this.moduleValue[i][t+6].IsBlack=!0,this.moduleValue[i][t+6].IsFilled=!0,this.moduleValue[i][t+6].IsPDP=!0,t+7<this.noOfModules?(this.moduleValue[i][t+7].IsBlack=!1,this.moduleValue[i][t+7].IsFilled=!0,this.moduleValue[i][t+7].IsPDP=!0):t-1>=0&&(this.moduleValue[i][t-1].IsBlack=!1,this.moduleValue[i][t-1].IsFilled=!0,this.moduleValue[i][t-1].IsPDP=!0),this.moduleValue[n][r].IsBlack=!0,this.moduleValue[n][r].IsFilled=!0,this.moduleValue[n][r].IsPDP=!0,this.moduleValue[n+6][r].IsBlack=!0,this.moduleValue[n+6][r].IsFilled=!0,this.moduleValue[n+6][r].IsPDP=!0,n+7<this.noOfModules?(this.moduleValue[n+7][r].IsBlack=!1,this.moduleValue[n+7][r].IsFilled=!0,this.moduleValue[n+7][r].IsPDP=!0):n-1>=0&&(this.moduleValue[n-1][r].IsBlack=!1,this.moduleValue[n-1][r].IsFilled=!0,this.moduleValue[n-1][r].IsPDP=!0);for(n+7<this.noOfModules&&t+7<this.noOfModules?(this.moduleValue[n+7][t+7].IsBlack=!1,this.moduleValue[n+7][t+7].IsFilled=!0,this.moduleValue[n+7][t+7].IsPDP=!0):n+7<this.noOfModules&&t+7>=this.noOfModules?(this.moduleValue[n+7][t-1].IsBlack=!1,this.moduleValue[n+7][t-1].IsFilled=!0,this.moduleValue[n+7][t-1].IsPDP=!0):n+7>=this.noOfModules&&t+7<this.noOfModules&&(this.moduleValue[n-1][t+7].IsBlack=!1,this.moduleValue[n-1][t+7].IsFilled=!0,this.moduleValue[n-1][t+7].IsPDP=!0),n++,t++,i=n,r=t;i<n+5;i++,r++)this.moduleValue[i][t].IsBlack=!1,this.moduleValue[i][t].IsFilled=!0,this.moduleValue[i][t].IsPDP=!0,this.moduleValue[i][t+4].IsBlack=!1,this.moduleValue[i][t+4].IsFilled=!0,this.moduleValue[i][t+4].IsPDP=!0,this.moduleValue[n][r].IsBlack=!1,this.moduleValue[n][r].IsFilled=!0,this.moduleValue[n][r].IsPDP=!0,this.moduleValue[n+4][r].IsBlack=!1,this.moduleValue[n+4][r].IsFilled=!0,this.moduleValue[n+4][r].IsPDP=!0;for(n++,t++,i=n,r=t;i<n+3;i++,r++)this.moduleValue[i][t].IsBlack=!0,this.moduleValue[i][t].IsFilled=!0,this.moduleValue[i][t].IsPDP=!0,this.moduleValue[i][t+2].IsBlack=!0,this.moduleValue[i][t+2].IsFilled=!0,this.moduleValue[i][t+2].IsPDP=!0,this.moduleValue[n][r].IsBlack=!0,this.moduleValue[n][r].IsFilled=!0,this.moduleValue[n][r].IsPDP=!0,this.moduleValue[n+2][r].IsBlack=!0,this.moduleValue[n+2][r].IsFilled=!0,this.moduleValue[n+2][r].IsPDP=!0;this.moduleValue[n+1][t+1].IsBlack=!0;this.moduleValue[n+1][t+1].IsFilled=!0;this.moduleValue[n+1][t+1].IsPDP=!0},_drawAlignmentPattern:function(n,t){for(var i=n-2,r=t-2;i<n+3;i++,r++)this.moduleValue[i][t-2].IsBlack=!0,this.moduleValue[i][t-2].IsFilled=!0,this.moduleValue[i][t+2].IsBlack=!0,this.moduleValue[i][t+2].IsFilled=!0,this.moduleValue[n-2][r].IsBlack=!0,this.moduleValue[n-2][r].IsFilled=!0,this.moduleValue[n+2][r].IsBlack=!0,this.moduleValue[n+2][r].IsFilled=!0;for(i=n-1,r=t-1;i<n+2;i++,r++)this.moduleValue[i][t-1].IsBlack=!1,this.moduleValue[i][t-1].IsFilled=!0,this.moduleValue[i][t+1].IsBlack=!1,this.moduleValue[i][t+1].IsFilled=!0,this.moduleValue[n-1][r].IsBlack=!1,this.moduleValue[n-1][r].IsFilled=!0,this.moduleValue[n+1][r].IsBlack=!1,this.moduleValue[n+1][r].IsFilled=!0;this.moduleValue[n][t].IsBlack=!0;this.moduleValue[n][t].IsFilled=!0},_getAlignmentPatternCoOrdinates:function(){var n=[];switch(this.m_Version){case 02:n=[6,18];break;case 03:n=[6,22];break;case 04:n=[6,26];break;case 05:n=[6,30];break;case 06:n=[6,34];break;case 07:n=[6,22,38];break;case 8:n=[6,24,42];break;case 9:n=[6,26,46];break;case 10:n=[6,28,50];break;case 11:n=[6,30,54];break;case 12:n=[6,32,58];break;case 13:n=[6,34,62];break;case 14:n=[6,26,46,66];break;case 15:n=[6,26,48,70];break;case 16:n=[6,26,50,74];break;case 17:n=[6,30,54,78];break;case 18:n=[6,30,56,82];break;case 19:n=[6,30,58,86];break;case 20:n=[6,34,62,90];break;case 21:n=[6,28,50,72,94];break;case 22:n=[6,26,50,74,98];break;case 23:n=[6,30,54,78,102];break;case 24:n=[6,28,54,80,106];break;case 25:n=[6,32,58,84,110];break;case 26:n=[6,30,58,86,114];break;case 27:n=[6,34,62,90,118];break;case 28:n=[6,26,50,74,98,122];break;case 29:n=[6,30,54,78,102,126];break;case 30:n=[6,26,52,78,104,130];break;case 31:n=[6,30,56,82,108,134];break;case 32:n=[6,34,60,86,112,138];break;case 33:n=[6,30,58,86,114,142];break;case 34:n=[6,34,62,90,118,146];break;case 35:n=[6,30,54,78,102,126,150];break;case 36:n=[6,24,50,76,102,128,154];break;case 37:n=[6,28,54,80,106,132,158];break;case 38:n=[6,32,58,84,110,136,162];break;case 39:n=[6,26,54,82,110,138,166];break;case 40:n=[6,30,58,86,114,142,170]}return n},_findECINumber:function(n){for(var r,i=3,u=0;u<n.length;u++)if(r=n.charCodeAt(u),!(r>=32)||!(r<=255)){var t=r.toString(16);if(["2591","2592","2593","2502","2524","2561","2562","2556","2555","2563","2551","2557","255D","255C","255B","2510","2514","2534","252C","251C","2500","253C","255E","255F","255A","2554","2569","2566","2560","2550","256C","2567","2568","2564","2565","2559","2558","2552","2553","256B","256A","2518","250C","2588","2584","258C","2590","2580","25A0"].indexOf(t)!=-1){i=2;break}else if(["104","2D8","141","13D","15A","160","15E","164","179","17D","17B","105","2DB","142","13E","15B","2C7","161","15F","165","17A","2DD","17E","17C","154","102","139","106","10C","118","11A","10E","110","143","147","150","158","16E","170","162","155","103","13A","107","10D","119","11B","10F","111","144","148","151","159","16F","171","163","2D9"].indexOf(t)!=-1){i=4;break}else if(["126","124","130","15E","11E","134","17B","127","125","131","15F","11F","135","17C","10A","108","120","11C","16C","15C","10B","109","121","11D","16D","15D"].indexOf(t)!=-1){i=5;break}else if(["104","138","156","128","13B","160","112","122","166","17D","105","2DB","157","129","13C","2C7","161","113","123","167","14A","17E","14B","100","12E","10C","118","116","12A","110","145","14C","136","172","168","16A","101","12F","10D","119","117","12B","111","146","14D","137","173","169","16B"].indexOf(t)!=-1){i=6;break}else if(t>=1025&&t<=1119&&t!=1037&&t!=1104&&t!=1117){i=7;break}else if(t>=1569&&t<=1594||t>=1600&&t<=1618||t==1567||t==1563||t==1548){i=8;break}else if(t>=900&&t<=974||t==890){i=9;break}else if(t>=1488&&t<=1514){i=10;break}else if(t>=3585&&t<=3675){i=13;break}else if(["141","104","15E","17B","142","105","15F","13D","13E","17C"].indexOf(t)!=1||t>=1569&&t<=1610){i=21;break}else if(["402","403","453","409","40A","40C","40B","40F","452","459","45A","45C","45B","45F","40E","45E","408","490","401","404","407","406","456","491","451","454","458","405","455","457"].indexOf(t)!=1||t>=1040&&t<=1103){i=22;break}else if(["20AC","201A","192","201E","2026","2020","2021","2C6","2030","160","2039","152","17D","2018","2019","201C","201D","2022","2013","2014","2DC","2122","161","203A","153","17E","178"].indexOf(t)!=-1){i=23;break}else if(["67E","679","152","686","698","688","6AF","6A9","691","153","6BA","6BE","6C1"].indexOf(t)!=-1){i=24;break}}return i},_getNumberOfDataCodeWord:function(){var n=0;switch(this.m_Version){case 01:n=16;break;case 02:n=28;break;case 03:n=44;break;case 04:n=64;break;case 05:n=86;break;case 06:n=108;break;case 07:n=124;break;case 8:n=154;break;case 9:n=182;break;case 10:n=216;break;case 11:n=254;break;case 12:n=290;break;case 13:n=334;break;case 14:n=365;break;case 15:n=415;break;case 16:n=453;break;case 17:n=507;break;case 18:n=563;break;case 19:n=627;break;case 20:n=669;break;case 21:n=714;break;case 22:n=782;break;case 23:n=860;break;case 24:n=914;break;case 25:n=1e3;break;case 26:n=1062;break;case 27:n=1128;break;case 28:n=1193;break;case 29:n=1267;break;case 30:n=1373;break;case 31:n=1455;break;case 32:n=1541;break;case 33:n=1631;break;case 34:n=1725;break;case 35:n=1812;break;case 36:n=1914;break;case 37:n=1992;break;case 38:n=2102;break;case 39:n=2216;break;case 40:n=2334}return n},_getNumberOfErrorCorrectingCodeWords:function(){var n=(this.m_Version-1)*4,t;return n+=1,t=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430],t[n]},_getNumberOfErrorCorrectionBlocks:function(){var n=[];switch(this.m_Version){case 01:case 02:case 03:n[0]=1;break;case 04:case 05:n[0]=2;break;case 06:case 07:n[0]=4;break;case 8:n=[2,60,38,2,61,39];break;case 9:n=[3,58,36,2,59,37];break;case 10:n=[4,69,43,1,70,44];break;case 11:n=[1,80,50,4,81,51];break;case 12:n=[6,58,36,2,59,37];break;case 13:n=[8,59,37,1,60,38];break;case 14:n=[4,64,40,5,65,41];break;case 15:n=[5,65,41,5,66,42];break;case 16:n=[7,73,45,3,74,46];break;case 17:n=[10,74,46,1,75,47];break;case 18:n=[9,69,43,4,70,44];break;case 19:n=[3,70,44,11,71,45];break;case 20:n=[3,67,41,13,68,42];break;case 21:case 22:n[0]=17;break;case 23:n=[4,75,47,14,76,48];break;case 24:n=[6,73,45,14,74,46];break;case 25:n=[8,75,47,13,76,48];break;case 26:n=[19,74,46,4,75,47];break;case 27:n=[22,73,45,3,74,46];break;case 28:n=[3,73,45,23,74,46];break;case 29:n=[21,73,45,7,74,46];break;case 30:n=[19,75,47,10,76,48];break;case 31:n=[2,74,46,29,75,47];break;case 32:n=[10,74,46,23,75,47];break;case 33:n=[14,74,46,21,75,47];break;case 34:n=[14,74,46,23,75,47];break;case 35:n=[12,75,47,26,76,48];break;case 36:n=[6,75,47,34,76,48];break;case 37:n=[29,74,46,14,75,47];break;case 38:n=[13,74,46,32,75,47];break;case 39:n=[40,75,47,7,76,48];break;case 40:n=[18,75,47,31,76,48]}return n},_getEnd:function(){return[208,359,567,807,1079,1383,1568,1936,2336,2768,3232,3728,4256,4651,5243,5867,6523,7211,7931,8683,9252,10068,10916,11796,12708,13652,14628,15371,16411,17483,18587,19723,20891,22091,23008,24272,25568,26896,28256,29648][this.m_Version-1]},_getDataCapacity:function(){return[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706][this.m_Version-1]},_getFormatInformation:function(){return[1,1,0,1,0,0,1,0,1,1,0,1,1,0,1]},_getVersionInformation:function(){var n=[];switch(this.m_Version){case 07:n=[0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0,0];break;case 8:n=[0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0,0];break;case 9:n=[1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,0];break;case 10:n=[1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,0,0];break;case 11:n=[0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,0,0];break;case 12:n=[0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0,0];break;case 13:n=[1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,0,0];break;case 14:n=[1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0];break;case 15:n=[0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0];break;case 16:n=[0,0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0];break;case 17:n=[1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,0];break;case 18:n=[1,1,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1,0];break;case 19:n=[0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0];break;case 20:n=[0,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,0];break;case 21:n=[1,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0];break;case 22:n=[1,0,0,1,0,0,1,1,0,0,0,1,0,1,1,0,1,0];break;case 23:n=[0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,0];break;case 24:n=[0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0];break;case 25:n=[1,0,0,0,0,1,1,1,1,0,0,0,1,0,0,1,1,0];break;case 26:n=[1,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0];break;case 27:n=[0,1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,0];break;case 28:n=[0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0];break;case 29:n=[1,1,1,1,1,1,0,0,1,1,0,0,1,0,1,1,1,0];break;case 30:n=[1,0,1,0,1,1,1,0,1,0,1,1,0,1,1,1,1,0];break;case 31:n=[0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0];break;case 32:n=[1,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,1];break;case 33:n=[0,0,0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1];break;case 34:n=[0,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1];break;case 35:n=[1,1,1,1,1,0,0,1,1,1,1,0,1,1,0,0,0,1];break;case 36:n=[1,1,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1];break;case 37:n=[0,1,1,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1];break;case 38:n=[0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1];break;case 39:n=[1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,0,1];break;case 40:n=[1,0,0,1,0,1,1,0,0,0,1,1,0,0,0,1,0,1]}return n},_getStringCodePoints:function(){function n(n,t){return((n&1023)<<10)+(t&1023)+65536}return function(t){for(var u=[],i=0,r;i<t.length;)r=t.charCodeAt(i),(r&63488)==55296?u.push(n(r,t.charCodeAt(++i))):u.push(r),++i;return u}}(),_create2DArray:function(n,t){var r,i;for(n=parseInt(n),t=parseInt(t),r=new Array(n),i=0;i<n;i++)r[i]=new Array(t);return r},_buildDataMatrix:function(){for(var f,s,h=[[10,10,1,1,3,5,1,3],[12,12,1,1,5,7,1,5],[14,14,1,1,8,10,1,8],[16,16,1,1,12,12,1,12],[18,18,1,1,18,14,1,18],[20,20,1,1,22,18,1,22],[22,22,1,1,30,20,1,30],[24,24,1,1,36,24,1,36],[26,26,1,1,44,28,1,44],[32,32,2,2,62,36,1,62],[36,36,2,2,86,42,1,86],[40,40,2,2,114,48,1,114],[44,44,2,2,144,56,1,144],[48,48,2,2,174,68,1,174],[52,52,2,2,204,84,2,102],[64,64,4,4,280,112,2,140],[72,72,4,4,368,144,4,92],[80,80,4,4,456,192,4,114],[88,88,4,4,576,224,4,144],[96,96,4,4,696,272,4,174],[104,104,4,4,816,336,6,136],[120,120,6,6,1050,408,6,175],[132,132,6,6,1304,496,8,163],[144,144,6,6,1558,620,10,156],[8,18,1,1,5,7,1,5],[8,32,2,1,10,11,1,10],[12,26,1,1,16,14,1,16],[12,36,2,1,22,18,1,22],[16,36,2,1,32,24,1,32],[16,48,2,1,49,28,1,49]],u=this._getStringCodePoints(this.Model.text),l,i,t=[],e=0,n=0;n<u.length;n++)u[n]<127?t[e]=u[n]+1:(t[e++]=235,t[e]=u[n]-127),e++;for(n=0;n<h.length;n++)if(h[n][4]>=u.length){i=h[n];break}if(i[4]>t.length){var r=t.length,o=new Array(i[4]);for(f=0;f<r;f++)o[f]=t[f];for(r<i[4]+1&&(o[r]=129),r++;r<i[4];)s=129+(r+1)*149%253+1,s>254&&(s-=254),o[r++]=s;t=o}l=i[5];errCorrArray=this._errorCorrection(l,t);var y=t.concat(errCorrArray),c=this._createMatrix(y,i),a=c.length*this.Model.xDimension,v=c[0].length*this.Model.xDimension;this.contextEl.beginPath();this.contextEl.fillStyle="white";this.contextEl.fillRect(0,0,a,v);this.contextEl.closePath();this._drawDataMatrix(c,a,v)},_drawDataMatrix:function(n,t,i){var r=parseInt(this.Model.xDimension),h,e,u,o,f,s;for(n.length==n[0].length&&this.Model.height!=""&&this.Model.width!=""?(this.Model.height=this._getProperValue(this.Model.height),this.Model.width=this._getProperValue(this.Model.width),h=Math.min(this.Model.width,this.Model.height),r=h/n.length):(this.Model.height=i,this.Model.width=t,this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width),this.canvasEl[0].setAttribute("height",this.Model.height),this.BarcodeEl.css("height",this.Model.height)),e=0,this.contextEl.beginPath(),u=0;u<n.length;u++){for(o=0,f=0;f<n[u].length;f++)s=null,s=n[u][f]==1?this.model.darkBarColor:this.model.lightBarColor,this.contextEl.fillStyle=s,this.contextEl.fillRect(o,e,r,r),o+=r;e+=r}this.contextEl.closePath();this.contextEl.stroke()},_createMatrix:function(n,t){var i,r,c,l,d=[],e=t[1],s=t[0],b=e/t[2],k=s/t[3],o,a,rt,p,w,g,u,f;for(c=e-2*(e/b),l=s-2*(s/k),d=new Array(c*l),this._ecc200placement(d,l,c),o=new Array(e*s),u=0;u<o.length;u++)o[u]=0;for(r=0;r<s;r+=k){for(i=0;i<e;i++)o[parseInt(r*e)+i]=1;for(i=0;i<e;i+=2)o[parseInt((r+k-1)*e)+i]=1}for(i=0;i<e;i+=b){for(r=0;r<s;r++)o[parseInt(r*e)+i]=1;for(r=0;r<s;r+=2)o[parseInt(r*e)+i+b-1]=1}for(r=0;r<l;r++)for(i=0;i<c;i++)a=d[(l-r-1)*c+i],(a==1||a>7&&(n[(a>>3)-1]&1<<(a&7))!=0)&&(rt=parseInt(parseInt(1+r+2*parseInt(r/(k-2)))*e+1+i+ +(2*parseInt(i/(b-2)))),o[rt]=1);var v=t[1],y=t[0],ut=this._create2DArray(v,y);for(p=0;p<v;p++)for(w=0;w<y;w++)ut[p][w]=o[v*w+p];for(g=this._create2DArray(y,v),u=0;u<y;u++)for(f=0;f<v;f++)g[y-1-u][f]=ut[f][u];var nt=t[0]+(this.Model.quietZone.top+this.Model.quietZone.bottom),tt=t[1]+(this.Model.quietZone.left+this.Model.quietZone.right),h=this.Model.quietZone.all,it=this._create2DArray(nt,tt);for(u=0;u<nt;u++)for(f=0;f<tt;f++)it[u][f]=0;for(u=h;u<nt-h;u++)for(f=h;f<tt-h;f++)it[u][f]=g[u-h][f-h];return it},_ecc200placement:function(n,t,i){for(var u,f,r=0;r<t;r++)for(u=0;u<i;u++)n[r*i+u]=0;f=1;r=4;u=0;do{r!=t||u!=0||this._ecc200placementcornerA(n,t,i,f++);r!=t-2||u!=0||i%4==0||this._ecc200placementcornerB(n,t,i,f++);r!=t-2||u!=0||i%8!=4||this._ecc200placementcornerC(n,t,i,f++);r!=t+4||u!=2||i%8!=0||this._ecc200placementcornerD(n,t,i,f++);do r<t&&u>=0&&!(n[r*i+u]!=0)&&this._ecc200placementblock(n,t,i,r,u,f++),r-=2,u+=2;while(r>=0&&u<i);r++;u+=3;do r>-1&&u<i&&!(n[r*i+u]!=0)&&this._ecc200placementblock(n,t,i,r,u,f++),r+=2,u-=2;while(r<t&&u>=0);r+=3;u++}while(r<t||u<i);n[t*i-1]!=0||(n[t*i-1]=n[t*i-i-2]=1)},_ecc200placementcornerA:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-1,0,r,7);this._ecc200placementbit(n,t,i,t-1,1,r,6);this._ecc200placementbit(n,t,i,t-1,2,r,5);this._ecc200placementbit(n,t,i,0,i-2,r,4);this._ecc200placementbit(n,t,i,0,i-1,r,3);this._ecc200placementbit(n,t,i,1,i-1,r,2);this._ecc200placementbit(n,t,i,2,i-1,r,1);this._ecc200placementbit(n,t,i,3,i-1,r,0)},_ecc200placementcornerB:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-3,0,r,7);this._ecc200placementbit(n,t,i,t-2,0,r,6);this._ecc200placementbit(n,t,i,t-1,0,r,5);this._ecc200placementbit(n,t,i,0,i-4,r,4);this._ecc200placementbit(n,t,i,0,i-3,r,3);this._ecc200placementbit(n,t,i,0,i-2,r,2);this._ecc200placementbit(n,t,i,0,i-1,r,1);this._ecc200placementbit(n,t,i,1,i-1,r,0)},_ecc200placementcornerC:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-3,0,r,7);this._ecc200placementbit(n,t,i,t-2,0,r,6);this._ecc200placementbit(n,t,i,t-1,0,r,5);this._ecc200placementbit(n,t,i,0,i-2,r,4);this._ecc200placementbit(n,t,i,0,i-1,r,3);this._ecc200placementbit(n,t,i,1,i-1,r,2);this._ecc200placementbit(n,t,i,2,i-1,r,1);this._ecc200placementbit(n,t,i,3,i-1,r,0)},_ecc200placementcornerD:function(n,t,i,r){this._ecc200placementbit(n,t,i,t-1,0,r,7);this._ecc200placementbit(n,t,i,t-1,i-1,r,6);this._ecc200placementbit(n,t,i,0,i-3,r,5);this._ecc200placementbit(n,t,i,0,i-2,r,4);this._ecc200placementbit(n,t,i,0,i-1,r,3);this._ecc200placementbit(n,t,i,1,i-3,r,2);this._ecc200placementbit(n,t,i,1,i-2,r,1);this._ecc200placementbit(n,t,i,1,i-1,r,0)},_ecc200placementblock:function(n,t,i,r,u,f){this._ecc200placementbit(n,t,i,r-2,u-2,f,7);this._ecc200placementbit(n,t,i,r-2,u-1,f,6);this._ecc200placementbit(n,t,i,r-1,u-2,f,5);this._ecc200placementbit(n,t,i,r-1,u-1,f,4);this._ecc200placementbit(n,t,i,r-1,+u,f,3);this._ecc200placementbit(n,t,i,+r,u-2,f,2);this._ecc200placementbit(n,t,i,+r,u-1,f,1);this._ecc200placementbit(n,t,i,+r,+u,f,0)},_ecc200placementbit:function(n,t,i,r,u,f,e){r<0&&(r+=t,u+=4-(t+4)%8);u<0&&(u+=i,r+=4-(i+4)%8);n[r*i+u]=(f<<3)+e},_errorCorrection:function(n,t){var f,a=1,h,u=new Array(n+1),e=new Array(256),r=new Array(256),l,c,o,i,s;for(e[0]=-255,r[0]=1,i=1;i<=255;i++)r[i]=r[i-1]*2,r[i]>=256&&(r[i]=r[i]^301),e[r[i]]=i;for(u[0]=1,i=1;i<=n;i++){for(u[i]=1,f=i-1;f>0;f--)u[f]!=0&&(u[f]=r[(e[u[f]]+a)%255]),u[f]^=u[f-1];u[0]=r[(e[u[0]]+a)%255];a++}for(h=new Array(n),l=0;l<h.length;l++)h[l]=u[l];for(c=0,o=new Array(n),i=0;i<n;i++)o[i]=0;for(i=0;i<t.length;i++){for(c=o[n-1]^t[i],s=n-1;s>0;s--)o[s]=c!=0&&h[s]!=0?o[s-1]^r[(e[c]+e[h[s]])%255]:o[s-1];o[0]=c!=0&&h[0]!=0?r[(e[c]+e[h[0]])%255]:0}return o.reverse()},_validateText:function(n,t){var i=new RegExp(t);return i.test(n)},_getCharWidth:function(n,t){for(var i=0,u=n.split(""),r=0;r<u.length;r++)i=i+intercharacterGap+this._getWidth(t,u[r]);return i},_getWidth:function(n,t){for(var u,f,e=!1,i=0,r=0;r<n.length;r++)if(n[r][0]==t){for(u=n[r][2],f=0;f<u.length;f++)e==!1&&u.length%2!=0&&(continuous=!0),i=i+u[f]*this.Model.narrowBarWidth,e=!0;return i}return i},_draw1DBarcode:function(n,t,i){var a,g,nt,u,s,f,r,e,w,b,k,d,h;if(t.length>0){var v=n.split(""),o=this.Model.quietZone.left,c=this.Model.quietZone.top,y=parseInt(this.textFont.size.replace("px",""));this.Model.height==""&&this.Model.width==""&&(this.Model.height=c+this.Model.barHeight+this.Model.quietZone.bottom,this.Model.width=i,this.Model.displayText&&(this.Model.height+=y+this.Model.barcodeToTextGapHeight),this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width),this.canvasEl[0].setAttribute("height",this.Model.height),this.BarcodeEl.css("height",this.Model.height));var tt=this.Model.width,l=this.Model.height,p=0;for(u=0;u<v.length;u++)for(s=0;s<t.length;s++)if(t[s][0]==v[u]){for(f=t[s][2],r=0;r<f.length;r++)e=f[r]*this.Model.narrowBarWidth,p+=f[r];f.length%2!=0&&p++}for(a=(this._getProperValue(this.Model.width)-this.Model.quietZone.right-this.Model.quietZone.left)/p,a<1&&(a=1),this.Model.narrowBarWidth=Math.floor(a),g=(a%1).toFixed(3),nt=p*g,o=parseInt(this.model.quietZone.left)+Math.round(nt/2),this.model.barHeight=this._getProperValue(this.Model.height)-this.Model.quietZone.top-this.Model.quietZone.bottom-(y+this.Model.barcodeToTextGapHeight),this.model.barHeight<0&&(this.model.barHeight=0),intercharacterGap=this.Model.narrowBarWidth,this.contextEl.fillStyle="white",this.contextEl.fillRect(0,0,tt,l),u=0;u<v.length;u++)for(s=0;s<t.length;s++)if(t[s][0]==v[u]){if(f=t[s][2],this.model.symbologyType=="upcbarcode")for(r=0;r<f.length;r++)e=f[r]*this.Model.narrowBarWidth,u>1&&u<=7?r%2!=0&&(this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.darkBarColor,this.contextEl.fillRect(o,c,e,this.Model.barHeight),this.contextEl.closePath()):r%2==0?(this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.darkBarColor,this.contextEl.fillRect(o,c,e,this.Model.barHeight),this.contextEl.closePath()):(this.contextEl.beginPath(),this.contextEl.fillStyle=this.model.lightBarColor,this.contextEl.fillRect(o,c,e,this.model.barHeight)),o+=e,u==1&&r==f.length-1&&(o-=e);else for(r=0;r<f.length;r++)e=f[r]*this.Model.narrowBarWidth,r%2==0?(this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.darkBarColor,this.contextEl.fillRect(o,c,e,this.Model.barHeight),this.contextEl.closePath()):(this.contextEl.beginPath(),this.contextEl.fillStyle=this.model.lightBarColor,this.contextEl.fillRect(o,c,e,this.model.barHeight),this.contextEl.closePath()),o+=e;(f.length%2!=0||this.model.symbologyType=="upcbarcode"&&u==7)&&(o+=intercharacterGap)}if(this.Model.displayText){if(w=this.textFont.fontStyle.toLowerCase()=="regular"?"":+this.textFont.fontStyle.toLowerCase()+" ",w+=this.textFont.size+" "+this.textFont.fontFamily.toLowerCase()+",sans-serif",this.contextEl.font=w,b=0,b=this.contextEl.measureText(this.Model.text).width,this.Model.width<b&&(this.canvasEl[0].setAttribute("width",this.Model.width),this.BarcodeEl.css("width",this.Model.width)),this.contextEl.beginPath(),this.contextEl.fillStyle=this.Model.textColor,this.contextEl.textAlign="center",l=l-y+y/2,this.model.symbologyType=="upcbarcode"){for(k=n.split(""),d="",h=0;h<k.length;h++)(h>1&&h<=7||h>8&&h<=14)&&(d+=k[h]);this.contextEl.fillText(d,this.Model.width/2,l)}else this.contextEl.fillText(this.Model.text,this.Model.width/2,l);this.contextEl.closePath();this.contextEl.stroke()}}}});t.datavisualization.Barcode.SymbologyType={code39:"code39",code39Extended:"code39extended",code11:"code11",codabar:"codabar",code32:"code32",code93:"code93",code93Extended:"code93extended",code128A:"code128a",code128B:"code128b",code128C:"code128c",dataMatrix:"datamatrix",qrBarcode:"qrbarcode",upca:"upcbarcode"};t.datavisualization.Barcode.symbologySettings={code39:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[A-Z0-9-.$/+% ]+$",symbolTable:[["0",0,[1,1,1,3,3,1,3,1,1]],["1",1,[3,1,1,3,1,1,1,1,3]],["2",2,[1,1,3,3,1,1,1,1,3]],["3",3,[3,1,3,3,1,1,1,1,1]],["4",4,[1,1,1,3,3,1,1,1,3]],["5",5,[3,1,1,3,3,1,1,1,1]],["6",6,[1,1,3,3,3,1,1,1,1]],["7",7,[1,1,1,3,1,1,3,1,3]],["8",8,[3,1,1,3,1,1,3,1,1]],["9",9,[1,1,3,3,1,1,3,1,1]],["A",10,[3,1,1,1,1,3,1,1,3]],["B",11,[1,1,3,1,1,3,1,1,3]],["C",12,[3,1,3,1,1,3,1,1,1]],["D",13,[1,1,1,1,3,3,1,1,3]],["E",14,[3,1,1,1,3,3,1,1,1]],["F",15,[1,1,3,1,3,3,1,1,1]],["G",16,[1,1,1,1,1,3,3,1,3]],["H",17,[3,1,1,1,1,3,3,1,1]],["I",18,[1,1,3,1,1,3,3,1,1]],["J",19,[1,1,1,1,3,3,3,1,1]],["K",20,[3,1,1,1,1,1,1,3,3]],["L",21,[1,1,3,1,1,1,1,3,3]],["M",22,[3,1,3,1,1,1,1,3,1]],["N",23,[1,1,1,1,3,1,1,3,3]],["O",24,[3,1,1,1,3,1,1,3,1]],["P",25,[1,1,3,1,3,1,1,3,1]],["Q",26,[1,1,1,1,1,1,3,3,3]],["R",27,[3,1,1,1,1,1,3,3,1]],["S",28,[1,1,3,1,1,1,3,3,1]],["T",29,[1,1,1,1,3,1,3,3,1]],["U",30,[3,3,1,1,1,1,1,1,3]],["V",31,[1,3,3,1,1,1,1,1,3]],["W",32,[3,3,3,1,1,1,1,1,1]],["X",33,[1,3,1,1,3,1,1,1,3]],["Y",34,[3,3,1,1,3,1,1,1,1]],["Z",35,[1,3,3,1,3,1,1,1,1]],["-",36,[1,3,1,1,1,1,3,1,3]],[".",37,[3,3,1,1,1,1,3,1,1]],[" ",38,[1,3,3,1,1,1,3,1,1]],["$",39,[1,3,1,3,1,3,1,1,1]],["/",40,[1,3,1,3,1,1,1,3,1]],["+",41,[1,3,1,1,1,3,1,3,1]],["%",42,[1,1,1,3,1,3,1,3,1]],["*",0,[1,3,1,1,3,1,3,1,1]]]},code39extended:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[\x00-]+$",symbolTable:[["0",0,[1,1,1,3,3,1,3,1,1]],["1",1,[3,1,1,3,1,1,1,1,3]],["2",2,[1,1,3,3,1,1,1,1,3]],["3",3,[3,1,3,3,1,1,1,1,1]],["4",4,[1,1,1,3,3,1,1,1,3]],["5",5,[3,1,1,3,3,1,1,1,1]],["6",6,[1,1,3,3,3,1,1,1,1]],["7",7,[1,1,1,3,1,1,3,1,3]],["8",8,[3,1,1,3,1,1,3,1,1]],["9",9,[1,1,3,3,1,1,3,1,1]],["A",10,[3,1,1,1,1,3,1,1,3]],["B",11,[1,1,3,1,1,3,1,1,3]],["C",12,[3,1,3,1,1,3,1,1,1]],["D",13,[1,1,1,1,3,3,1,1,3]],["E",14,[3,1,1,1,3,3,1,1,1]],["F",15,[1,1,3,1,3,3,1,1,1]],["G",16,[1,1,1,1,1,3,3,1,3]],["H",17,[3,1,1,1,1,3,3,1,1]],["I",18,[1,1,3,1,1,3,3,1,1]],["J",19,[1,1,1,1,3,3,3,1,1]],["K",20,[3,1,1,1,1,1,1,3,3]],["L",21,[1,1,3,1,1,1,1,3,3]],["M",22,[3,1,3,1,1,1,1,3,1]],["N",23,[1,1,1,1,3,1,1,3,3]],["O",24,[3,1,1,1,3,1,1,3,1]],["P",25,[1,1,3,1,3,1,1,3,1]],["Q",26,[1,1,1,1,1,1,3,3,3]],["R",27,[3,1,1,1,1,1,3,3,1]],["S",28,[1,1,3,1,1,1,3,3,1]],["T",29,[1,1,1,1,3,1,3,3,1]],["U",30,[3,3,1,1,1,1,1,1,3]],["V",31,[1,3,3,1,1,1,1,1,3]],["W",32,[3,3,3,1,1,1,1,1,1]],["X",33,[1,3,1,1,3,1,1,1,3]],["Y",34,[3,3,1,1,3,1,1,1,1]],["Z",35,[1,3,3,1,3,1,1,1,1]],["-",36,[1,3,1,1,1,1,3,1,3]],[".",37,[3,3,1,1,1,1,3,1,1]],[" ",38,[1,3,3,1,1,1,3,1,1]],["$",39,[1,3,1,3,1,3,1,1,1]],["/",40,[1,3,1,3,1,1,1,3,1]],["+",41,[1,3,1,1,1,3,1,3,1]],["%",42,[1,1,1,3,1,3,1,3,1]],["*",0,[1,3,1,1,3,1,3,1,1]]],extendedCodes:[['\0',["%","U"]],[String.fromCharCode(parseInt("0001",16)),["$","A"]],[String.fromCharCode(parseInt("0002",16)),["$","B"]],[String.fromCharCode(parseInt("0003",16)),["$","C"]],[String.fromCharCode(parseInt("0004",16)),["$","D"]],[String.fromCharCode(parseInt("0005",16)),["$","E"]],[String.fromCharCode(parseInt("0006",16)),["$","F"]],["a",["$","G"]],["\b",["$","H"]],["\t",["$","I"]],["\n",["$","J"]],['\v',["$","K"]],["\f",["$","L"]],["\r",["$","M"]],[String.fromCharCode(parseInt("000e",16)),["$","N"]],[String.fromCharCode(parseInt("000f",16)),["$","O"]],[String.fromCharCode(parseInt("0010",16)),["$","P"]],[String.fromCharCode(parseInt("0011",16)),["$","Q"]],[String.fromCharCode(parseInt("0012",16)),["$","R"]],[String.fromCharCode(parseInt("0013",16)),["$","S"]],[String.fromCharCode(parseInt("0014",16)),["$","T"]],[String.fromCharCode(parseInt("0015",16)),["$","U"]],[String.fromCharCode(parseInt("0016",16)),["$","V"]],[String.fromCharCode(parseInt("0017",16)),["$","W"]],[String.fromCharCode(parseInt("0018",16)),["$","X"]],[String.fromCharCode(parseInt("0019",16)),["$","Y"]],[String.fromCharCode(parseInt("001a",16)),["$","Z"]],[String.fromCharCode(parseInt("001b",16)),["%","A"]],[String.fromCharCode(parseInt("001c",16)),["%","B"]],[String.fromCharCode(parseInt("001d",16)),["%","C"]],[String.fromCharCode(parseInt("001e",16)),["%","D"]],[String.fromCharCode(parseInt("001f",16)),["%","E"]],[" ",[" "]],["!",["/","A"]],['"',["/","B"]],["#",["/","C"]],["$",["/","D"]],["%",["/","E"]],["&",["/","F"]],["'",["/","G"]],["(",["/","H"]],[")",["/","I"]],["*",["/","J"]],["+",["/","K"]],[",",["/","L"]],["-",["/","M"]],[".",["/","N"]],["/",["/","O"]],["0",["0"]],["1",["1"]],["2",["2"]],["3",["3"]],["4",["4"]],["5",["5"]],["6",["6"]],["7",["7"]],["8",["8"]],["9",["9"]],[":",["/","Z"]],[";",["%","F"]],["<",["%","G"]],["=",["%","H"]],[">",["%","I"]],["?",["%","J"]],["@",["%","V"]],["A",["A"]],["B",["B"]],["C",["C"]],["D",["D"]],["E",["E"]],["F",["F"]],["G",["G"]],["H",["H"]],["I",["I"]],["J",["J"]],["K",["K"]],["L",["L"]],["M",["M"]],["N",["N"]],["O",["O"]],["P",["P"]],["Q",["Q"]],["R",["R"]],["S",["S"]],["T",["T"]],["U",["U"]],["V",["V"]],["W",["W"]],["X",["X"]],["Y",["Y"]],["Z",["Z"]],["[",["%","K"]],["\\",["%","L"]],["]",["%","M"]],["^",["%","N"]],["_",["%","O"]],["`",["%","W"]],["a",["+","A"]],["b",["+","B"]],["c",["+","C"]],["d",["+","D"]],["e",["+","E"]],["f",["+","F"]],["g",["+","G"]],["h",["+","H"]],["i",["+","I"]],["j",["+","J"]],["k",["+","K"]],["l",["+","L"]],["m",["+","M"]],["n",["+","N"]],["o",["+","O"]],["p",["+","P"]],["q",["+","Q"]],["r",["+","R"]],["s",["+","S"]],["t",["+","T"]],["u",["+","U"]],["v",["+","V"]],["w",["+","W"]],["x",["+","X"]],["y",["+","Y"]],["z",["+","Z"]],["{",["%","P"]],["|",["%","Q"]],["}",["%","R"]],["~",["%","S"]],[String.fromCharCode(parseInt("007f",16)),["%","T"]]]},code11:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[0-9-]*$",symbolTable:[["0",0,[1,1,1,1,2]],["1",1,[2,1,1,1,2]],["2",2,[1,2,1,1,2]],["3",3,[2,2,1,1,1]],["4",4,[1,1,2,1,2]],["5",5,[2,1,2,1,1]],["6",6,[1,2,2,1,1]],["7",7,[1,1,1,2,2]],["8",8,[2,1,1,2,1]],["9",9,[2,1,1,1,1]],["-",10,[1,1,2,1,1]],["*",0,[1,1,2,2,1]]]},codabar:{startSymbol:"A",stopSymbol:"B",validatorExp:"^[0-9-.$/:+]*$",symbolTable:[["0",0,[1,1,1,1,1,2,2]],["1",0,[1,1,1,1,2,2,1]],["2",0,[1,1,1,2,1,1,2]],["3",0,[2,2,1,1,1,1,1]],["4",0,[1,1,2,1,1,2,1]],["5",0,[2,1,1,1,1,2,1]],["6",0,[1,2,1,1,1,1,2]],["7",0,[1,2,1,1,2,1,1]],["8",0,[1,2,2,1,1,1,1]],["9",0,[2,1,1,2,1,1,1]],["-",0,[1,1,1,2,2,1,1]],["$",0,[1,1,2,2,1,1,1]],[":",0,[2,1,1,1,2,1,2]],["/",0,[2,1,2,1,1,1,2]],[".",0,[2,1,2,1,2,1,1]],["+",0,[1,1,2,1,2,1,2]],["A",0,[1,1,2,2,1,2,1]],["B",0,[1,1,1,2,1,2,2]]]},code32:{startSymbol:"*",stopSymbol:"*",validatorExp:"^[A-Z0-9 -*.$/+%]+$",symbolTable:[["0",0,[1,1,1,3,3,1,3,1,1]],["1",1,[3,1,1,3,1,1,1,1,3]],["2",2,[1,1,3,3,1,1,1,1,3]],["3",3,[3,1,3,3,1,1,1,1,1]],["4",4,[1,1,1,3,3,1,1,1,3]],["5",5,[3,1,1,3,3,1,1,1,1]],["6",6,[1,1,3,3,3,1,1,1,1]],["7",7,[1,1,1,3,1,1,3,1,3]],["8",8,[3,1,1,3,1,1,3,1,1]],["9",9,[1,1,3,3,1,1,3,1,1]],["B",10,[1,1,3,1,1,3,1,1,3]],["C",11,[3,1,3,1,1,3,1,1,1]],["D",12,[1,1,1,1,3,3,1,1,3]],["F",13,[1,1,3,1,3,3,1,1,1]],["G",14,[1,1,1,1,1,3,3,1,3]],["H",15,[3,1,1,1,1,3,3,1,1]],["J",16,[1,1,1,1,3,3,3,1,1]],["K",17,[3,1,1,1,1,1,1,3,3]],["L",18,[1,1,3,1,1,1,1,3,3]],["M",19,[3,1,3,1,1,1,1,3,1]],["N",20,[1,1,1,1,3,1,1,3,3]],["P",21,[1,1,3,1,3,1,1,3,1]],["Q",22,[1,1,1,1,1,1,3,3,3]],["R",23,[3,1,1,1,1,1,3,3,1]],["S",24,[1,1,3,1,1,1,3,3,1]],["T",25,[1,1,1,1,3,1,3,3,1]],["U",26,[3,3,1,1,1,1,1,1,3]],["V",27,[1,3,3,1,1,1,1,1,3]],["W",28,[3,3,3,1,1,1,1,1,1]],["X",29,[1,3,1,1,3,1,1,1,3]],["Y",30,[3,3,1,1,3,1,1,1,1]],["Z",31,[1,3,3,1,3,1,1,1,1]],["*",0,[1,3,1,1,3,1,3,1,1]]]},code93:{startSymbol:"*",stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"^[A-Z0-9-.$/+% ]+$",symbolTable:[["0",0,[1,3,1,1,1,2]],["1",1,[1,1,1,2,1,3]],["2",2,[1,1,1,3,1,2]],["3",3,[1,1,1,4,1,1]],["4",4,[1,2,1,1,1,2]],["5",5,[1,2,1,2,1,2]],["6",6,[1,2,1,3,1,1]],["7",7,[1,1,1,1,1,4]],["8",8,[1,3,1,2,1,1]],["9",9,[1,4,1,1,1,1]],["A",10,[2,1,1,1,1,3]],["B",11,[2,1,1,2,1,2]],["C",12,[2,1,1,3,1,1]],["D",13,[2,2,1,1,1,2]],["E",14,[2,2,1,2,1,1]],["F",15,[2,3,1,1,1,1]],["G",16,[1,1,2,1,1,3]],["H",17,[1,1,2,2,1,2]],["I",18,[1,1,2,3,1,1]],["J",19,[1,2,2,1,1,2]],["K",20,[1,3,2,1,1,1]],["L",21,[1,1,1,1,2,3]],["M",22,[1,1,1,2,2,2]],["N",23,[1,1,1,3,2,1]],["O",24,[1,2,1,1,2,2]],["P",25,[1,3,1,1,2,1]],["Q",26,[2,1,2,1,1,2]],["R",27,[2,1,2,2,1,1]],["S",28,[2,1,1,1,2,2]],["T",29,[2,1,1,2,2,1]],["U",30,[2,2,1,1,2,1]],["V",31,[2,2,2,1,1,1]],["W",32,[1,1,2,1,2,2]],["X",33,[1,1,2,2,2,1]],["Y",34,[1,2,2,1,2,1]],["Z",35,[1,2,3,1,1,1]],["-",36,[1,2,1,1,3,1]],[".",37,[3,1,1,1,1,2]],[" ",38,[3,1,1,2,1,1]],["$",39,[3,2,1,1,1,1]],["/",40,[1,1,2,1,3,1]],["+",41,[1,1,3,1,2,1]],["%",42,[2,1,1,1,3,1]],["*",0,[1,1,1,1,4,1]],[String.fromCharCode(parseInt("00ff",16)),0,[1,1,1,1,4,1,1]],[String.fromCharCode(parseInt("00fb",16)),43,[1,2,1,2,2,0]],[String.fromCharCode(parseInt("00fc",16)),44,[3,1,2,1,1,1]],[String.fromCharCode(parseInt("00fd",16)),45,[3,1,1,1,2,1]],[String.fromCharCode(parseInt("00fe",16)),46,[1,2,2,2,1,1]]]},code93extended:{startSymbol:"*",stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"^[\x00-\x00fb\x00fd\x00fe'þ''ü''ý']+$",symbolTable:[["0",0,[1,3,1,1,1,2]],["1",1,[1,1,1,2,1,3]],["2",2,[1,1,1,3,1,2]],["3",3,[1,1,1,4,1,1]],["4",4,[1,2,1,1,1,2]],["5",5,[1,2,1,2,1,2]],["6",6,[1,2,1,3,1,1]],["7",7,[1,1,1,1,1,4]],["8",8,[1,3,1,2,1,1]],["9",9,[1,4,1,1,1,1]],["A",10,[2,1,1,1,1,3]],["B",11,[2,1,1,2,1,2]],["C",12,[2,1,1,3,1,1]],["D",13,[2,2,1,1,1,2]],["E",14,[2,2,1,2,1,1]],["F",15,[2,3,1,1,1,1]],["G",16,[1,1,2,1,1,3]],["H",17,[1,1,2,2,1,2]],["I",18,[1,1,2,3,1,1]],["J",19,[1,2,2,1,1,2]],["K",20,[1,3,2,1,1,1]],["L",21,[1,1,1,1,2,3]],["M",22,[1,1,1,2,2,2]],["N",23,[1,1,1,3,2,1]],["O",24,[1,2,1,1,2,2]],["P",25,[1,3,1,1,2,1]],["Q",26,[2,1,2,1,1,2]],["R",27,[2,1,2,2,1,1]],["S",28,[2,1,1,1,2,2]],["T",29,[2,1,1,2,2,1]],["U",30,[2,2,1,1,2,1]],["V",31,[2,2,2,1,1,1]],["W",32,[1,1,2,1,2,2]],["X",33,[1,1,2,2,2,1]],["Y",34,[1,2,2,1,2,1]],["Z",35,[1,2,3,1,1,1]],["-",36,[1,2,1,1,3,1]],[".",37,[3,1,1,1,1,2]],[" ",38,[3,1,1,2,1,1]],["$",39,[3,2,1,1,1,1]],["/",40,[1,1,2,1,3,1]],["+",41,[1,1,3,1,2,1]],["%",42,[2,1,1,1,3,1]],["*",0,[1,1,1,1,4,1]],[String.fromCharCode(parseInt("00ff",16)),0,[1,1,1,1,4,1,1]],[String.fromCharCode(parseInt("00fb",16)),43,[1,2,1,2,2,0]],[String.fromCharCode(parseInt("00fc",16)),44,[3,1,2,1,1,1]],[String.fromCharCode(parseInt("00fd",16)),45,[3,1,1,1,2,1]],[String.fromCharCode(parseInt("00fe",16)),46,[1,2,2,2,1,1]]],extendedCodes:[['\0',[String.fromCharCode(parseInt("00fc",16)),"U"]],[String.fromCharCode(parseInt("0001",16)),[String.fromCharCode(parseInt("00fb",16)),"A"]],[String.fromCharCode(parseInt("0002",16)),[String.fromCharCode(parseInt("00fb",16)),"B"]],[String.fromCharCode(parseInt("0003",16)),[String.fromCharCode(parseInt("00fb",16)),"C"]],[String.fromCharCode(parseInt("0004",16)),[String.fromCharCode(parseInt("00fb",16)),"D"]],[String.fromCharCode(parseInt("0005",16)),[String.fromCharCode(parseInt("00fb",16)),"E"]],[String.fromCharCode(parseInt("0006",16)),[String.fromCharCode(parseInt("00fb",16)),"F"]],["a",[String.fromCharCode(parseInt("00fb",16)),"G"]],["\b",[String.fromCharCode(parseInt("00fb",16)),"H"]],["\t",[String.fromCharCode(parseInt("00fb",16)),"I"]],["\n",[String.fromCharCode(parseInt("00fb",16)),"J"]],['\v',[String.fromCharCode(parseInt("00fb",16)),"K"]],["\f",[String.fromCharCode(parseInt("00fb",16)),"L"]],["\r",[String.fromCharCode(parseInt("00fb",16)),"M"]],[String.fromCharCode(parseInt("000e",16)),[String.fromCharCode(parseInt("00fb",16)),"N"]],[String.fromCharCode(parseInt("000f",16)),[String.fromCharCode(parseInt("00fb",16)),"O"]],[String.fromCharCode(parseInt("0010",16)),[String.fromCharCode(parseInt("00fb",16)),"P"]],[String.fromCharCode(parseInt("0011",16)),[String.fromCharCode(parseInt("00fb",16)),"Q"]],[String.fromCharCode(parseInt("0012",16)),[String.fromCharCode(parseInt("00fb",16)),"R"]],[String.fromCharCode(parseInt("0013",16)),[String.fromCharCode(parseInt("00fb",16)),"S"]],[String.fromCharCode(parseInt("0014",16)),[String.fromCharCode(parseInt("00fb",16)),"T"]],[String.fromCharCode(parseInt("0015",16)),[String.fromCharCode(parseInt("00fb",16)),"U"]],[String.fromCharCode(parseInt("0016",16)),[String.fromCharCode(parseInt("00fb",16)),"V"]],[String.fromCharCode(parseInt("0017",16)),[String.fromCharCode(parseInt("00fb",16)),"W"]],[String.fromCharCode(parseInt("0018",16)),[String.fromCharCode(parseInt("00fb",16)),"X"]],[String.fromCharCode(parseInt("0019",16)),[String.fromCharCode(parseInt("00fb",16)),"Y"]],[String.fromCharCode(parseInt("001a",16)),[String.fromCharCode(parseInt("00fb",16)),"Z"]],[String.fromCharCode(parseInt("001b",16)),[String.fromCharCode(parseInt("00fc",16)),"A"]],[String.fromCharCode(parseInt("001c",16)),[String.fromCharCode(parseInt("00fc",16)),"B"]],[String.fromCharCode(parseInt("001d",16)),[String.fromCharCode(parseInt("00fc",16)),"C"]],[String.fromCharCode(parseInt("001e",16)),[String.fromCharCode(parseInt("00fc",16)),"D"]],[String.fromCharCode(parseInt("001f",16)),[String.fromCharCode(parseInt("00fc",16)),"E"]],[" ",[" "]],["!",[String.fromCharCode(parseInt("00fd",16)),"A"]],['"',[String.fromCharCode(parseInt("00fd",16)),"B"]],["#",[String.fromCharCode(parseInt("00fd",16)),"C"]],["$",[String.fromCharCode(parseInt("00fd",16)),"D"]],["%",[String.fromCharCode(parseInt("00fd",16)),"E"]],["&",[String.fromCharCode(parseInt("00fd",16)),"F"]],["'",[String.fromCharCode(parseInt("00fd",16)),"G"]],["(",[String.fromCharCode(parseInt("00fd",16)),"H"]],[")",[String.fromCharCode(parseInt("00fd",16)),"I"]],["*",[String.fromCharCode(parseInt("00fd",16)),"J"]],["+",[String.fromCharCode(parseInt("00fd",16)),"K"]],[",",[String.fromCharCode(parseInt("00fd",16)),"L"]],["-",[String.fromCharCode(parseInt("00fd",16)),"M"]],[".",[String.fromCharCode(parseInt("00fd",16)),"N"]],["/",[String.fromCharCode(parseInt("00fd",16)),"O"]],["0",["0"]],["1",["1"]],["2",["2"]],["3",["3"]],["4",["4"]],["5",["5"]],["6",["6"]],["7",["7"]],["8",["8"]],["9",["9"]],[":",[String.fromCharCode(parseInt("00fd",16)),"Z"]],[";",[String.fromCharCode(parseInt("00fc",16)),"F"]],["<",[String.fromCharCode(parseInt("00fc",16)),"G"]],["=",[String.fromCharCode(parseInt("00fc",16)),"H"]],[">",[String.fromCharCode(parseInt("00fc",16)),"I"]],["?",[String.fromCharCode(parseInt("00fc",16)),"J"]],["@",[String.fromCharCode(parseInt("00fc",16)),"V"]],["A",["A"]],["B",["B"]],["C",["C"]],["D",["D"]],["E",["E"]],["F",["F"]],["G",["G"]],["H",["H"]],["I",["I"]],["J",["J"]],["K",["K"]],["L",["L"]],["M",["M"]],["N",["N"]],["O",["O"]],["P",["P"]],["Q",["Q"]],["R",["R"]],["S",["S"]],["T",["T"]],["U",["U"]],["V",["V"]],["W",["W"]],["X",["X"]],["Y",["Y"]],["Z",["Z"]],["[",[String.fromCharCode(parseInt("00fc",16)),"K"]],["\\",[String.fromCharCode(parseInt("00fc",16)),"L"]],["]",[String.fromCharCode(parseInt("00fc",16)),"M"]],["^",[String.fromCharCode(parseInt("00fc",16)),"N"]],["_",[String.fromCharCode(parseInt("00fc",16)),"O"]],["`",[String.fromCharCode(parseInt("00fc",16)),"W"]],["a",[String.fromCharCode(parseInt("00fe",16)),"A"]],["b",[String.fromCharCode(parseInt("00fe",16)),"B"]],["c",[String.fromCharCode(parseInt("00fe",16)),"C"]],["d",[String.fromCharCode(parseInt("00fe",16)),"D"]],["e",[String.fromCharCode(parseInt("00fe",16)),"E"]],["f",[String.fromCharCode(parseInt("00fe",16)),"F"]],["g",[String.fromCharCode(parseInt("00fe",16)),"G"]],["h",[String.fromCharCode(parseInt("00fe",16)),"H"]],["i",[String.fromCharCode(parseInt("00fe",16)),"I"]],["j",[String.fromCharCode(parseInt("00fe",16)),"J"]],["k",[String.fromCharCode(parseInt("00fe",16)),"K"]],["l",[String.fromCharCode(parseInt("00fe",16)),"L"]],["m",[String.fromCharCode(parseInt("00fe",16)),"M"]],["n",[String.fromCharCode(parseInt("00fe",16)),"N"]],["o",[String.fromCharCode(parseInt("00fe",16)),"O"]],["p",[String.fromCharCode(parseInt("00fe",16)),"P"]],["q",[String.fromCharCode(parseInt("00fe",16)),"Q"]],["r",[String.fromCharCode(parseInt("00fe",16)),"R"]],["s",[String.fromCharCode(parseInt("00fe",16)),"S"]],["t",[String.fromCharCode(parseInt("00fe",16)),"T"]],["u",[String.fromCharCode(parseInt("00fe",16)),"U"]],["v",[String.fromCharCode(parseInt("00fe",16)),"V"]],["w",[String.fromCharCode(parseInt("00fe",16)),"W"]],["x",[String.fromCharCode(parseInt("00fe",16)),"X"]],["y",[String.fromCharCode(parseInt("00fe",16)),"Y"]],["z",[String.fromCharCode(parseInt("00fe",16)),"Z"]],["{",[String.fromCharCode(parseInt("00fc",16)),"P"]],["|",[String.fromCharCode(parseInt("00fc",16)),"Q"]],["}",[String.fromCharCode(parseInt("00fc",16)),"R"]],["~",[String.fromCharCode(parseInt("00fc",16)),"S"]],[String.fromCharCode(parseInt("007f",16)),[String.fromCharCode(parseInt("00fc",16)),"T"]]]},code128a:{startSymbol:String.fromCharCode(parseInt("00f9",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"[\0\x0001\x0002\x0003\x0004\x0005\x0006\a\b\t\n\v\f\r\x000e\x000f\x0010\x0011\x0012\x0013\x0014\x0015\x0016\x0017\x0018\x0019\x001a\x001b\x001c\x001d\x001e\x001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\x00f0\x00f1\x00f2\x00f3\x00f4]",symbolTable:[["\0",64,[1,1,1,4,2,2]],[String.fromCharCode(parseInt("0001",16)),65,[1,2,1,1,2,4]],[String.fromCharCode(parseInt("0002",16)),66,[1,2,1,4,2,1]],[String.fromCharCode(parseInt("0003",16)),67,[1,4,1,1,2,2]],[String.fromCharCode(parseInt("0004",16)),68,[1,4,1,2,2,1]],[String.fromCharCode(parseInt("0005",16)),69,[1,1,2,2,1,4]],[String.fromCharCode(parseInt("0006",16)),70,[1,1,2,4,1,2]],["a",71,[1,2,2,1,1,4]],["\b",72,[1,2,2,4,1,1]],["\t",73,[1,4,2,1,1,2]],["\n",74,[1,4,2,2,1,1]],["\v",75,[2,4,1,2,1,1]],["\f",76,[2,2,1,1,1,4]],["\r",77,[4,1,3,1,1,1]],[String.fromCharCode(parseInt("000e",16)),78,[2,4,1,1,1,2]],[String.fromCharCode(parseInt("000f",16)),79,[1,3,4,1,1,1]],[String.fromCharCode(parseInt("0010",16)),80,[1,1,1,2,4,2]],[String.fromCharCode(parseInt("0011",16)),81,[1,2,1,1,4,2]],[String.fromCharCode(parseInt("0012",16)),82,[1,2,1,2,4,1]],[String.fromCharCode(parseInt("0013",16)),83,[1,1,4,2,1,2]],[String.fromCharCode(parseInt("0014",16)),84,[1,2,4,1,1,2]],[String.fromCharCode(parseInt("0015",16)),85,[1,2,4,2,1,1]],[String.fromCharCode(parseInt("0016",16)),86,[4,1,1,2,1,2]],[String.fromCharCode(parseInt("0017",16)),87,[4,2,1,1,1,2]],[String.fromCharCode(parseInt("0018",16)),88,[4,2,1,2,1,1]],[String.fromCharCode(parseInt("0019",16)),89,[2,1,2,1,4,1]],[String.fromCharCode(parseInt("001a",16)),90,[2,1,4,1,2,1]],[String.fromCharCode(parseInt("001b",16)),91,[4,1,2,1,2,1]],[String.fromCharCode(parseInt("001c",16)),92,[1,1,1,1,4,3]],[String.fromCharCode(parseInt("001d",16)),93,[1,1,1,3,4,1]],[String.fromCharCode(parseInt("001e",16)),94,[1,3,1,1,4,1]],[String.fromCharCode(parseInt("001f",16)),95,[1,1,4,1,1,3]],[" ",0,[2,1,2,2,2,2]],["!",1,[2,2,2,1,2,2]],['"',2,[2,2,2,2,2,1]],["#",3,[1,2,1,2,2,3]],["$",4,[1,2,1,3,2,2]],["%",5,[1,3,1,2,2,2]],["&",6,[1,2,2,2,1,3]],["'",7,[1,2,2,3,1,2]],["(",8,[1,3,2,2,1,2]],[")",9,[2,2,1,2,1,3]],["*",10,[2,2,1,3,1,2]],["+",11,[2,3,1,2,1,2]],[",",12,[1,1,2,2,3,2]],["-",13,[1,2,2,1,3,2]],[".",14,[1,2,2,2,3,1]],["/",15,[1,1,3,2,2,2]],["0",16,[1,2,3,1,2,2]],["1",17,[1,2,3,2,2,1]],["2",18,[2,2,3,2,1,1]],["3",19,[2,2,1,1,3,2]],["4",20,[2,2,1,2,3,1]],["5",21,[2,1,3,2,1,2]],["6",22,[2,2,3,1,1,2]],["7",23,[3,1,2,1,3,1]],["8",24,[3,1,1,2,2,2]],["9",25,[3,2,1,1,2,2]],[":",26,[3,2,1,2,2,1]],[";",27,[3,1,2,2,1,2]],["<",28,[3,2,2,1,1,2]],["=",29,[3,2,2,2,1,1]],[">",30,[2,1,2,1,2,3]],["?",31,[2,1,2,3,2,1]],["@",32,[2,3,2,1,2,1]],["A",33,[1,1,1,3,2,3]],["B",34,[1,3,1,1,2,3]],["C",35,[1,3,1,3,2,1]],["D",36,[1,1,2,3,1,3]],["E",37,[1,3,2,1,1,3]],["F",38,[1,3,2,3,1,1]],["G",39,[2,1,1,3,1,3]],["H",40,[2,3,1,1,1,3]],["I",41,[2,3,1,3,1,1]],["J",42,[1,1,2,1,3,3]],["K",43,[1,1,2,3,3,1]],["L",44,[1,3,2,1,3,1]],["M",45,[1,1,3,1,2,3]],["N",46,[1,1,3,3,2,1]],["O",47,[1,3,3,1,2,1]],["P",48,[3,1,3,1,2,1]],["Q",49,[2,1,1,3,3,1]],["R",50,[2,3,1,1,3,1]],["S",51,[2,1,3,1,1,3]],["T",52,[2,1,3,3,1,1]],["U",53,[2,1,3,1,3,1]],["V",54,[3,1,1,1,2,3]],["W",55,[3,1,1,3,2,1]],["X",56,[3,3,1,1,2,1]],["Y",57,[3,1,2,1,1,3]],["Z",58,[3,1,2,3,1,1]],["[",59,[3,3,2,1,1,1]],["\\",60,[3,1,4,1,1,1]],["]",61,[2,2,1,4,1,1]],["^",62,[4,3,1,1,1,1]],["_",63,[1,1,1,2,2,4]],[String.fromCharCode(parseInt("00f0",16)),102,[4,1,1,1,3,1]],[String.fromCharCode(parseInt("00f1",16)),97,[4,1,1,1,1,3]],[String.fromCharCode(parseInt("00f2",16)),96,[1,1,4,3,1,1]],[String.fromCharCode(parseInt("00f3",16)),101,[3,1,1,1,4,1]],[String.fromCharCode(parseInt("00f4",16)),98,[4,1,1,3,1,1]],[String.fromCharCode(parseInt("00fc",16)),99,[1,1,3,1,4,1]],[String.fromCharCode(parseInt("00fb",16)),100,[1,1,4,1,3,1]],[String.fromCharCode(parseInt("00f9",16)),103,[2,1,1,4,1,2]],[String.fromCharCode(parseInt("00ff",16)),-1,[2,3,3,1,1,1,2]]]},code128b:{startSymbol:String.fromCharCode(parseInt("00fd",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"^[\x00-]",symbolTable:[[" ",0,[2,1,2,2,2,2]],["!",1,[2,2,2,1,2,2]],['"',2,[2,2,2,2,2,1]],["#",3,[1,2,1,2,2,3]],["$",4,[1,2,1,3,2,2]],["%",5,[1,3,1,2,2,2]],["&",6,[1,2,2,2,1,3]],["'",7,[1,2,2,3,1,2]],["(",8,[1,3,2,2,1,2]],[")",9,[2,2,1,2,1,3]],["*",10,[2,2,1,3,1,2]],["+",11,[2,3,1,2,1,2]],[",",12,[1,1,2,2,3,2]],["-",13,[1,2,2,1,3,2]],[".",14,[1,2,2,2,3,1]],["/",15,[1,1,3,2,2,2]],["0",16,[1,2,3,1,2,2]],["1",17,[1,2,3,2,2,1]],["2",18,[2,2,3,2,1,1]],["3",19,[2,2,1,1,3,2]],["4",20,[2,2,1,2,3,1]],["5",21,[2,1,3,2,1,2]],["6",22,[2,2,3,1,1,2]],["7",23,[3,1,2,1,3,1]],["8",24,[3,1,1,2,2,2]],["9",25,[3,2,1,1,2,2]],[":",26,[3,2,1,2,2,1]],[";",27,[3,1,2,2,1,2]],["<",28,[3,2,2,1,1,2]],["=",29,[3,2,2,2,1,1]],[">",30,[2,1,2,1,2,3]],["?",31,[2,1,2,3,2,1]],["@",32,[2,3,2,1,2,1]],["A",33,[1,1,1,3,2,3]],["B",34,[1,3,1,1,2,3]],["C",35,[1,3,1,3,2,1]],["D",36,[1,1,2,3,1,3]],["E",37,[1,3,2,1,1,3]],["F",38,[1,3,2,3,1,1]],["G",39,[2,1,1,3,1,3]],["H",40,[2,3,1,1,1,3]],["I",41,[2,3,1,3,1,1]],["J",42,[1,1,2,1,3,3]],["K",43,[1,1,2,3,3,1]],["L",44,[1,3,2,1,3,1]],["M",45,[1,1,3,1,2,3]],["N",46,[1,1,3,3,2,1]],["O",47,[1,3,3,1,2,1]],["P",48,[3,1,3,1,2,1]],["Q",49,[2,1,1,3,3,1]],["R",50,[2,3,1,1,3,1]],["S",51,[2,1,3,1,1,3]],["T",52,[2,1,3,3,1,1]],["U",53,[2,1,3,1,3,1]],["V",54,[3,1,1,1,2,3]],["W",55,[3,1,1,3,2,1]],["X",56,[3,3,1,1,2,1]],["Y",57,[3,1,2,1,1,3]],["Z",58,[3,1,2,3,1,1]],["[",59,[3,3,2,1,1,1]],["\\",60,[3,1,4,1,1,1]],["]",61,[2,2,1,4,1,1]],["^",62,[4,3,1,1,1,1]],["_",63,[1,1,1,2,2,4]],["`",64,[1,1,1,4,2,2]],["a",65,[1,2,1,1,2,4]],["b",66,[1,2,1,4,2,1]],["c",67,[1,4,1,1,2,2]],["d",68,[1,4,1,2,2,1]],["e",69,[1,1,2,2,1,4]],["f",70,[1,1,2,4,1,2]],["g",71,[1,2,2,1,1,4]],["h",72,[1,2,2,4,1,1]],["i",73,[1,4,2,1,1,2]],["j",74,[1,4,2,2,1,1]],["k",75,[2,4,1,2,1,1]],["l",76,[2,2,1,1,1,4]],["m",77,[4,1,3,1,1,1]],["n",78,[2,4,1,1,1,2]],["o",79,[1,3,4,1,1,1]],["p",80,[1,1,1,2,4,2]],["q",81,[1,2,1,1,4,2]],["r",82,[1,2,1,2,4,1]],["s",83,[1,1,4,2,1,2]],["t",84,[1,2,4,1,1,2]],["u",85,[1,2,4,2,1,1]],["v",86,[4,1,1,2,1,2]],["w",87,[4,2,1,1,1,2]],["x",88,[4,2,1,2,1,1]],["y",89,[2,1,2,1,4,1]],["z",90,[2,1,4,1,2,1]],["{",91,[4,1,2,1,2,1]],["|",92,[1,1,1,1,4,3]],["}",93,[1,1,1,3,4,1]],["~",94,[1,3,1,1,4,1]],[String.fromCharCode(parseInt("007f",16)),95,[1,1,4,1,1,3]],[String.fromCharCode(parseInt("00f0",16)),102,[4,1,1,1,3,1]],[String.fromCharCode(parseInt("00f1",16)),97,[4,1,1,1,1,3]],[String.fromCharCode(parseInt("00f2",16)),96,[1,1,4,3,1,1]],[String.fromCharCode(parseInt("00f3",16)),100,[1,1,4,1,3,1]],[String.fromCharCode(parseInt("00f4",16)),98,[4,1,1,3,1,1]],[String.fromCharCode(parseInt("00fc",16)),99,[1,1,3,1,4,1]],[String.fromCharCode(parseInt("00fa",16)),101,[3,1,1,1,4,1]],[String.fromCharCode(parseInt("00fd",16)),104,[2,1,1,2,1,4]],[String.fromCharCode(parseInt("00ff",16)),-1,[2,3,3,1,1,1,2]]]},code128c:{startSymbol:String.fromCharCode(parseInt("00fe",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"[0-9]",symbolTable:[["\0",0,[2,1,2,2,2,2]],[String.fromCharCode(parseInt("0001",16)),1,[2,2,2,1,2,2]],[String.fromCharCode(parseInt("0002",16)),2,[2,2,2,2,2,1]],[String.fromCharCode(parseInt("0003",16)),3,[1,2,1,2,2,3]],[String.fromCharCode(parseInt("0004",16)),4,[1,2,1,3,2,2]],[String.fromCharCode(parseInt("0005",16)),5,[1,3,1,2,2,2]],[String.fromCharCode(parseInt("0006",16)),6,[1,2,2,2,1,3]],["a",7,[1,2,2,3,1,2]],["\b",8,[1,3,2,2,1,2]],["\t",9,[2,2,1,2,1,3]],["\n",10,[2,2,1,3,1,2]],["\v",11,[2,3,1,2,1,2]],["\f",12,[1,1,2,2,3,2]],["\r",13,[1,2,2,1,3,2]],[String.fromCharCode(parseInt("000e",16)),14,[1,2,2,2,3,1]],[String.fromCharCode(parseInt("000f",16)),15,[1,1,3,2,2,2]],[String.fromCharCode(parseInt("0010",16)),16,[1,2,3,1,2,2]],[String.fromCharCode(parseInt("0011",16)),17,[1,2,3,2,2,1]],[String.fromCharCode(parseInt("0012",16)),18,[2,2,3,2,1,1]],[String.fromCharCode(parseInt("0013",16)),19,[2,2,1,1,3,2]],[String.fromCharCode(parseInt("0014",16)),20,[2,2,1,2,3,1]],[String.fromCharCode(parseInt("0015",16)),21,[2,1,3,2,1,2]],[String.fromCharCode(parseInt("0016",16)),22,[2,2,3,1,1,2]],[String.fromCharCode(parseInt("0017",16)),23,[3,1,2,1,3,1]],[String.fromCharCode(parseInt("0018",16)),24,[3,1,1,2,2,2]],[String.fromCharCode(parseInt("0019",16)),25,[3,2,1,1,2,2]],[String.fromCharCode(parseInt("001a",16)),26,[3,2,1,2,2,1]],[String.fromCharCode(parseInt("001b",16)),27,[3,1,2,2,1,2]],[String.fromCharCode(parseInt("001c",16)),28,[3,2,2,1,1,2]],[String.fromCharCode(parseInt("001d",16)),29,[3,2,2,2,1,1]],[String.fromCharCode(parseInt("001e",16)),30,[2,1,2,1,2,3]],[String.fromCharCode(parseInt("001f",16)),31,[2,1,2,3,2,1]],[" ",32,[2,3,2,1,2,1]],["!",33,[1,1,1,3,2,3]],['"',34,[1,3,1,1,2,3]],["#",35,[1,3,1,3,2,1]],["$",36,[1,1,2,3,1,3]],["%",37,[1,3,2,1,1,3]],["&",38,[1,3,2,3,1,1]],["'",39,[2,1,1,3,1,3]],["[",40,[2,3,1,1,1,3]],[")",41,[2,3,1,3,1,1]],["*",42,[1,1,2,1,3,3]],["+",43,[1,1,2,3,3,1]],[",",44,[1,3,2,1,3,1]],["-",45,[1,1,3,1,2,3]],[".",46,[1,1,3,3,2,1]],["/",47,[1,3,3,1,2,1]],["0",48,[3,1,3,1,2,1]],["1",49,[2,1,1,3,3,1]],["2",50,[2,3,1,1,3,1]],["3",51,[2,1,3,1,1,3]],["4",52,[2,1,3,3,1,1]],["5",53,[2,1,3,1,3,1]],["6",54,[3,1,1,1,2,3]],["7",55,[3,1,1,3,2,1]],["8",56,[3,3,1,1,2,1]],["9",57,[3,1,2,1,1,3]],[":",58,[3,1,2,3,1,1]],[";",59,[3,3,2,1,1,1]],["<",60,[3,1,4,1,1,1]],["=",61,[2,2,1,4,1,1]],[">",62,[4,3,1,1,1,1]],["?",63,[1,1,1,2,2,4]],["@",64,[1,1,1,4,2,2]],["A",65,[1,2,1,1,2,4]],["B",66,[1,2,1,4,2,1]],["C",67,[1,4,1,1,2,2]],["D",68,[1,4,1,2,2,1]],["E",69,[1,1,2,2,1,4]],["F",70,[1,1,2,4,1,2]],["G",71,[1,2,2,1,1,4]],["H",72,[1,2,2,4,1,1]],["I",73,[1,4,2,1,1,2]],["J",74,[1,4,2,2,1,1]],["K",75,[2,4,1,2,1,1]],["L",76,[2,2,1,1,1,4]],["M",77,[4,1,3,1,1,1]],["N",78,[2,4,1,1,1,2]],["O",79,[1,3,4,1,1,1]],["P",80,[1,1,1,2,4,2]],["Q",81,[1,2,1,1,4,2]],["R",82,[1,2,1,2,4,1]],["S",83,[1,1,4,2,1,2]],["T",84,[1,2,4,1,1,2]],["U",85,[1,2,4,2,1,1]],["V",86,[4,1,1,2,1,2]],["W",87,[4,2,1,1,1,2]],["X",88,[4,2,1,2,1,1]],["Y",89,[2,1,2,1,4,1]],["Z",90,[2,1,4,1,2,1]],["[",91,[4,1,2,1,2,1]],["\\",92,[1,1,1,1,4,3]],["]",93,[1,1,1,3,4,1]],["^",94,[1,3,1,1,4,1]],["_",95,[1,1,4,1,1,3]],["`",96,[1,1,4,3,1,1]],["a",97,[4,1,1,1,1,3]],["b",98,[4,1,1,3,1,1]],["c",99,[1,1,3,1,4,1]],[String.fromCharCode(parseInt("00f0",16)),102,[4,1,1,1,3,1]],[String.fromCharCode(parseInt("00fa",16)),101,[3,1,1,1,4,1]],[String.fromCharCode(parseInt("00fb",16)),100,[1,1,4,1,3,1]],[String.fromCharCode(parseInt("00fe",16)),105,[2,1,1,2,3,2]],[String.fromCharCode(parseInt("00ff",16)),-1,[2,3,3,1,1,1,2]]]},upcbarcode:{startSymbol:String.fromCharCode(parseInt("00fd",16)),stopSymbol:String.fromCharCode(parseInt("00ff",16)),validatorExp:"[0-9]",symbolTable:[["0",0,[3,2,1,1]],["1",1,[2,2,2,1]],["2",2,[2,1,2,2]],["3",3,[1,4,1,1]],["4",4,[1,1,3,2]],["5",5,[1,2,3,1]],["6",6,[1,1,1,4]],["7",7,[1,3,1,2]],["8",8,[1,2,1,3]],["9",9,[3,1,1,2]],["B",0,[1,1,1,1]]]}}}(jQuery,Syncfusion),function($,ej,undefined){"use strict";ej.widget("ejDiagram","ej.datavisualization.Diagram",{element:null,model:null,_requiresID:!0,validTags:["div"],defaults:{width:"",height:"",nodes:[],connectors:[],labelRenderingMode:"html",defaultSettings:{connector:null,node:null,group:null},nodeTemplate:null,connectorTemplate:null,dataSourceSettings:{dataSource:null,query:null,tableName:null,id:"",parent:"",nodes:null,connectors:null,root:"",crudAction:{create:"",update:"",destroy:"",read:""},customFields:[],connectionDataSource:{dataSource:null,id:"",sourceNode:"",targetNode:"",sourcePointX:"",sourcePointY:"",targetPointX:"",targetPointY:"",crudAction:{create:"",update:"",destroy:"",read:""},customFields:[]}},snapSettings:{horizontalGridLines:{linesInterval:[1.25,18.75,.25,19.75,.25,19.75,.25,19.75,.25,19.75],snapInterval:[20],lineDashArray:"",lineColor:"lightgray"},verticalGridLines:{linesInterval:[1.25,18.75,.25,19.75,.25,19.75,.25,19.75,.25,19.75],snapInterval:[20],lineDashArray:"",lineColor:"lightgray"},snapConstraints:15,enableSnapToObject:!0,snapAngle:5,snapObjectDistance:5},scrollSettings:{horizontalOffset:0,verticalOffset:0,currentZoom:1,viewPortHeight:0,viewPortWidth:0,zoomFactor:.2,padding:{left:0,right:0,top:0,bottom:0}},pageSettings:{pageWidth:null,pageHeight:null,multiplePage:!1,pageBorderWidth:0,pageBackgroundColor:"#ffffff",pageBorderColor:"#565656",pageMargin:24,showPageBreak:!1,pageOrientation:"portrait",scrollLimit:"infinity",scrollableArea:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},autoScrollBorder:{left:15,top:15,right:15,bottom:15},boundaryConstraints:"infinity"},locale:"en-US",contextMenu:{items:[],showCustomMenuItemsOnly:!1},enableContextMenu:!0,enableAutoScroll:!0,tooltip:{templateId:"",relativeMode:"object",alignment:{horizontal:"center",vertical:"bottom"},margin:{left:5,right:5,top:5,bottom:5}},showTooltip:!0,layout:{bounds:null,type:"none",horizontalAlignment:"center",verticalAlignment:"top",orientation:"toptobottom",horizontalSpacing:30,verticalSpacing:30,margin:{left:0,right:0,top:0,bottom:0},marginX:0,marginY:0,fixedNode:"",getLayoutInfo:null,getConnectorSegments:null},drawingTools:{},backgroundImage:{source:"",scale:"meet",alignment:"xmidymid"},backgroundColor:"transparent",bridgeDirection:"top",version:"13.1",constraints:502,tool:null,drawType:{},selectedItems:{offsetX:0,offsetY:0,width:0,height:0,rotateAngle:0,children:[],constraints:30,userHandles:[],tooltip:{templateId:"",alignment:{horizontal:"center",vertical:"bottom"},margin:{top:10}},getConstraints:null},commandManager:{commands:{}},historyManager:{push:null,pop:null,canPop:null,canLog:null,undo:null,redo:null,startGroupAction:null,closeGroupAction:null,stackLimit:null,undoStack:[],redoStack:[]},editorFocusChange:null,nodeCollectionChange:null,templateNodeRendering:null,historyChange:null,autoScrollChange:null,itemClick:null,connectorCollectionChange:null,selectionChange:null,mouseLeave:null,mouseEnter:null,mouseOver:null,click:null,doubleClick:null,dragEnter:null,dragOver:null,dragLeave:null,drop:null,drag:null,textChange:null,sizeChange:null,connectionChange:null,rotationChange:null,contextMenuClick:null,contextMenuBeforeOpen:null,connectorSourceChange:null,connectorTargetChange:null,scrollChange:null,segmentChange:null,propertyChange:null,groupChange:null,create:null,destroy:null},observables:["nodes","connectors","locale","enableContextMenu","backgroundColor","backgroundImage","enableAutoScroll","showTooltip","bridgeDirection","tool","pageSettings.pageHeight","pageSettings.pageWidth","pageSettings.multiplePage","pageSettings.pageBorderWidth","pageSettings.pageBackgroundColor","pageSettings.pageBorderColor","pageSettings.pageMargin","pageSettings.showPageBreak","pageSettings.pageOrientation","pageSettings.scrollLimit","snapSettings.enableSnapToObject","snapSettings.snapAngle","snapSettings.snapObjectDistance","snapSettings.snapConstraints","dataSourceSettings.id","dataSourceSettings.parent","dataSourceSettings.root","dataSourceSettings.dataSource","dataSourceSettings.tableName","dataSourceSettings.query","layout.type","layout.orientation","layout.horizontalSpacing","layout.verticalSpacing","layout.marginX","layout.marginY","layout.fixedNode","selectedItems.offsetX","selectedItems.offsetY","selectedItems.width","selectedItems.height","selectedItems.rotateAngle","scrollSettings.horizontalOffset","scrollSettings.verticalOffset","scrollSettings.zoomFactor","tooltip.templateId","tooltip.relativeMode","tooltip.alignment.horizontal","tooltip.alignment.vertical","contextMenu.items","contextMenu.showCustomMenuItemsOnly"],nodes:ej.util.valueFunction("nodes"),connectors:ej.util.valueFunction("connectors"),locale:ej.util.valueFunction("locale"),enableContextMenu:ej.util.valueFunction("enableContextMenu"),enableAutoScroll:ej.util.valueFunction("enableAutoScroll"),showTooltip:ej.util.valueFunction("showTooltip"),bridgeDirection:ej.util.valueFunction("bridgeDirection"),tool:ej.util.valueFunction("tool"),_backgroundColor:ej.util.valueFunction("backgroundColor"),_backgroundImage:ej.util.valueFunction("backgroundImage"),_pageHeight:ej.util.valueFunction("pageSettings.pageHeight"),_pageWidth:ej.util.valueFunction("pageSettings.pageWidth"),_multiplePage:ej.util.valueFunction("pageSettings.multiplePage"),_pageBorderWidth:ej.util.valueFunction("pageSettings.pageBorderWidth"),_pageBackgroundColor:ej.util.valueFunction("pageSettings.pageBackgroundColor"),_pageBorderColor:ej.util.valueFunction("pageSettings.pageBorderColor"),_pageMargin:ej.util.valueFunction("pageSettings.pageMargin"),_showPageBreak:ej.util.valueFunction("pageSettings.showPageBreak"),_pageOrientation:ej.util.valueFunction("pageSettings.pageOrientation"),_scrollLimit:ej.util.valueFunction("pageSettings.scrollLimit"),_enableSnapToObject:ej.util.valueFunction("snapSettings.enableSnapToObject"),_snapConstraints:ej.util.valueFunction("snapSettings.snapConstraints"),_snapAngle:ej.util.valueFunction("snapSettings.snapAngle"),_snapObjectDistance:ej.util.valueFunction("snapSettings.snapObjectDistance"),_selectorOffsetX:ej.util.valueFunction("selectedItems.offsetX"),_selectorOffsetY:ej.util.valueFunction("selectedItems.offsetY"),_selectorWidth:ej.util.valueFunction("selectedItems.width"),_selectorHeight:ej.util.valueFunction("selectedItems.height"),_selectorRotateAngle:ej.util.valueFunction("selectedItems.rotateAngle"),_horizontalOffset:ej.util.valueFunction("scrollSettings.horizontalOffset"),_verticalOffset:ej.util.valueFunction("scrollSettings.verticalOffset"),zoomFactor:ej.util.valueFunction("scrollSettings.zoomFactor"),_layoutType:ej.util.valueFunction("layout.type"),_layoutOrientation:ej.util.valueFunction("layout.orientation"),_horizontalSpacing:ej.util.valueFunction("layout.horizontalSpacing"),_verticalSpacing:ej.util.valueFunction("layout.verticalSpacing"),_layoutMarginX:ej.util.valueFunction("layout.marginX"),_layoutMarginY:ej.util.valueFunction("layout.marginY"),_fixedNode:ej.util.valueFunction("layout.fixedNode"),_dataSourceUniqueId:ej.util.valueFunction("dataSourceSettings.id"),_dataSourceParentId:ej.util.valueFunction("dataSourceSettings.parent"),_dataSource:ej.util.valueFunction("dataSourceSettings.dataSource"),_dataSourceTableName:ej.util.valueFunction("dataSourceSettings.tableName"),_dataSourceQueryString:ej.util.valueFunction("dataSourceSettings.query"),_dataSourceRoot:ej.util.valueFunction("dataSourceSettings.root"),_tooltipTemplateId:ej.util.valueFunction("tooltip.templateId"),_horizontalTooltipAlignment:ej.util.valueFunction("tooltip.alignment.horizontal"),_verticalTooltipAlignment:ej.util.valueFunction("tooltip.alignment.vertical"),_tooltipMode:ej.util.valueFunction("tooltip.relativeMode"),_showCustomContextMenuItems:ej.util.valueFunction("contextMenu.showCustomMenuItemsOnly"),_contextMenuItems:ej.util.valueFunction("contextMenu.items"),dataTypes:{nodes:"data",connectors:"data",contextMenu:{items:"array"},dataSourceSettings:{dataSource:"data"},defaultSettings:{connector:{segments:"data",labels:"data"},node:{children:"data",gradient:{stops:"data"},labels:"data",lanes:"data",phases:"data",points:"data",ports:"data"},group:{children:"data",gradient:{stops:"data"},labels:"data",lanes:"data",phases:"data",points:"data",ports:"data"}},snapSettings:{horizontalGridLines:{linesInterval:"data",snapInterval:"data"},verticalGridLines:{linesInterval:"data",snapInterval:"data"}},selectedItems:{children:"data",userHandles:"data"}},_doubleClickEvent:!1,_nodes:[],_connectors:[],_canvas:null,_svg:null,_toolToActivate:null,_inAction:!1,_isPinching:!1,_isEditing:!1,_nodeToHit:null,_enableAPIMethods:!0,_currentCursor:null,_pasteIndex:null,_page:null,_view:null,_currentLabel:null,_zOrder:0,_clipboardData:null,_currZoom:1,_UndoRedo:!0,_mouseEventTriggered:!1,_selectedItem:"",_historyList:{currentEntry:{next:null,previous:null},canUndo:!1,canRedo:!1},_historyCount:0,_lastbefore:null,_defaultContextMenuItems:[{name:"cut",text:"Cut"},{name:"copy",text:"Copy"},{name:"paste",text:"Paste"},{name:"undo",text:"Undo"},{name:"redo",text:"Redo"},{name:"selectAll",text:"Select All"},{name:"grouping",text:"Grouping",subItems:[{name:"group",text:"Group"},{name:"ungroup",text:"Ungroup"}]},{name:"order",text:"Order",subItems:[{name:"bringToFront",text:"Bring To Front"},{name:"moveForward",text:"Move Forward"},{name:"sendToBack",text:"Send To Back"},{name:"sendBackward",text:"Send Backward"}]}],_hScrollOffset:0,_vScrollOffset:0,_hScrollbar:null,_vScrollbar:null,_scrollPixel:30,_previousSelectedItems:[],_eventCause:{},_crudDeleteNodes:[],_isMobile:!1,_labelHashTable:{},activeTool:null,selectionList:[],tools:null,nameTable:{},boundaryTable:{},_init:function(){var i,r,u,n,f,t;this.boundaryTable={};this.nameTable={};this.selectionList=[];this._isInit=!0;this.nameTable={};this.boundaryTable={};i=window.SVGSVGElement?!0:!1;i&&(ej.widget.unobtrusive!==undefined&&(this.model.snapSettings.horizontalGridLines&&this.model.snapSettings.horizontalGridLines.linesInterval&&typeof this.model.snapSettings.horizontalGridLines.linesInterval=="string"&&(this.model.snapSettings.horizontalGridLines.linesInterval=JSON.parse(this.model.snapSettings.horizontalGridLines.linesInterval)),this.model.snapSettings.verticalGridLines&&this.model.snapSettings.verticalGridLines.linesInterval&&typeof this.model.snapSettings.verticalGridLines.linesInterval=="string"&&(this.model.snapSettings.verticalGridLines.linesInterval=JSON.parse(this.model.snapSettings.verticalGridLines.linesInterval)),this.model.defaultSettings.connector&&(r=ej.datavisualization.Diagram.Connector({}),this.model.defaultSettings.connector=this._equivalentPropMap(r,this.model.defaultSettings.connector)),this.model.defaultSettings.node&&(u=ej.datavisualization.Diagram.Node({}),this.model.defaultSettings.node=this._equivalentPropMap(u,this.model.defaultSettings.node))),n=this,n.model.dataSourceSettings.crudAction.read&&(f=$.ajax({type:"GET",url:n.model.dataSourceSettings.crudAction.read,async:!1,success:function(t){n.model.dataSourceSettings.dataSource=t},error:function(){}}),this._isWebAPI=!0),n.model.dataSourceSettings.connectionDataSource.crudAction.read&&(f=$.ajax({type:"GET",url:n.model.dataSourceSettings.connectionDataSource.crudAction.read,async:!1,success:function(t){n.model.dataSourceSettings.connectionDataSource.dataSource=t},error:function(){}}),this._isWebAPI=!0),this.model.backgroundImage&&(typeof this.model.backgroundImage=="string"&&(t=this.model.backgroundImage),typeof this.model.backgroundImage=="function"&&(t=this.model.backgroundImage()),t&&(this.model.backgroundImage=ej.datavisualization.Diagram.BackgroundImage({source:t}))),this._layoutMarginX()&&(this.model.layout.margin.left=this.model.layout.margin.right=this._layoutMarginX()),this._layoutMarginY()&&(this.model.layout.margin.top=this.model.layout.margin.bottom=this._layoutMarginY()),this._cloneGlobalVariables(),this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch(),this._initDefaults(),this._initViews(),this._initData(),this._initCanvas(),this._initDiagramTool(),this._initVisualGuide(),this._wireEvents(),this._initHandles(),this._initContextMenu(),this._drawingTool=!1,this._isDropped=!1,this._initCommands(),this._initHistoryManager(),this.model.zoomFactor&&this.model.zoomFactor!==.2&&(this.model.scrollSettings.zoomFactor=this.model.zoomFactor),this._updateScrollSettings(this.model.scrollSettings),delete this._viewPort,this._cloneModel=$.extend(!0,{},this.model));delete this._isInit},_equivalentPropMap:function(n,t){var u={},r;for(var i in n)r=i.toLowerCase(),ej.isPlainObject(t[r])||ej.isPlainObject(t[i])?u[i]=this._equivalentPropMap(n[i],t[r]?t[r]:t[i]):(t[r]||t[i])&&(u[i]=t[r]?t[r]:t[i]);return u},refresh:function(){var t,n;if(this._updateTableNodes(),this._updateGroupChildren(this.model),this._isSwimlaneExist){for(t=this.connectors(),n=0;n<t.length;n++)t[n].zOrder=-1;delete this._isSwimlaneExist}this._updateScrollOffset(0,0);this._destroy();this.element.addClass("e-datavisualization-diagram");this._currZoom=1;this._hScrollbar=null;this._vScrollbar=null;this._view=null;this._svg=null;this._page=null;this._pageBackgroundLayer=null;this._diagramLayer=null;this._htmlLayer=null;this.clearHistory();this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch();this.model.dataSourceSettings&&this.model.dataSourceSettings.dataSource&&(this.nodes([]),this.connectors([]),this._nodes=[],this._connectors=[]);this._init()},_initCommands:function(n){var u=ej.datavisualization.Diagram.KeyModifiers,i=ej.datavisualization.Diagram.Keys,r,f,t,e;if(n)r=this.model.commandManager.commands;else{n=this.model.commandManager.commands;r={copy:{gesture:{key:i.C,keyModifiers:u.Control},_isDefault:!0},paste:{gesture:{key:i.V,keyModifiers:u.Control},_isDefault:!0},cut:{gesture:{key:i.X,keyModifiers:u.Control},_isDefault:!0},"delete":{gesture:{key:i.Delete},_isDefault:!0},undo:{gesture:{key:i.Z,keyModifiers:u.Control},_isDefault:!0},redo:{gesture:{key:i.Y,keyModifiers:u.Control},_isDefault:!0},selectAll:{gesture:{key:i.A,keyModifiers:u.Control},_isDefault:!0},nudgeUp:{parameter:"up",gesture:{key:i.Up},_isDefault:!0},nudgeRight:{parameter:"right",gesture:{key:i.Right},_isDefault:!0},nudgeDown:{parameter:"down",gesture:{key:i.Down},_isDefault:!0},nudgeLeft:{parameter:"left",gesture:{key:i.Left},_isDefault:!0},startEdit:{gesture:{key:113},_isDefault:!0},endEdit:{gesture:{key:i.Escape}},focusToNextItem:{gesture:{key:i.Tab},_isDefault:!0},focusToPreviousItem:{gesture:{key:i.Tab,keyModifiers:u.Control},_isDefault:!0},selectFocusedItem:{gesture:{key:i.Enter},_isDefault:!0}};for(f in r)this._initCommandValues(f,r[f])}for(t in n)r[t]?n[t]?(n[t]&&r[t].gesture&&n[t].gesture&&(this._isLoad||r[t]._isDefault&&delete r[t]._isDefault,n[t].gesture=ej.datavisualization.Diagram.Gesture($.extend({},!0,r[t].gesture,n[t].gesture)),this._tempCommandManager&&this._tempCommandManager.commands&&this._tempCommandManager.commands[t]._isDefault&&this._initCommandValues(t,n[t])),$.extend(r[t],!0,n[t])):r[t]=null:n[t]&&(e=ej.datavisualization.Diagram.Command(n[t]),r[t]=e);this.model.commandManager.commands=r},_initCommandValues:function(n,t){switch(n){case"copy":t.execute=$.proxy(this.copy,this);t.canExecute=$.proxy(this._canExecute,this);break;case"paste":t.execute=$.proxy(this._commandPaste,this);t.canExecute=$.proxy(this._canExecute,this);break;case"cut":t.execute=$.proxy(this.cut,this);t.canExecute=$.proxy(this._canExecute,this);break;case"delete":t.execute=$.proxy(this.remove,this);t.canExecute=$.proxy(this._canExecute,this);break;case"undo":t.execute=$.proxy(this.undo,this);t.canExecute=$.proxy(this._canExecute,this);break;case"redo":t.execute=$.proxy(this.redo,this);t.canExecute=$.proxy(this._canExecute,this);break;case"selectAll":t.execute=$.proxy(this._selectCommand,this);t.canExecute=$.proxy(this._canExecute,this);break;case"nudgeUp":case"nudgeRight":case"nudgeDown":case"nudgeLeft":t.execute=$.proxy(this._nudgeCommand,this);t.canExecute=$.proxy(this._canExecute,this);break;case"startEdit":t.execute=$.proxy(this._startEditCommand,this);t.canExecute=$.proxy(this._canExecute,this);break;case"endEdit":t.execute=$.proxy(this._endEdit,this);t.canExecute=$.proxy(this._canExecute,this);break;case"focusToNextItem":case"focusToPreviousItem":t.execute=$.proxy(this._focusToItem,this);t.canExecute=$.proxy(this._canExecute,this);break;case"selectFocusedItem":t.execute=$.proxy(this._selectFocusedItem,this);t.canExecute=$.proxy(this._canExecute,this)}},_initViews:function(n){n||(this._views=[],this._views.push(this._id));this._views[this._id]={type:"mainview",context:ej.datavisualization.Diagram.SvgContext,style:"position:relative; height:"+this.model.height+"; width:"+this.model.width+";"}},_initDefaults:function(){this.tool()||(ej.isMobile()?(this.tool(ej.datavisualization.Diagram.Tool.ZoomPan),this._isMobile=!0):this.tool(ej.datavisualization.Diagram.Tool.SingleSelect|ej.datavisualization.Diagram.Tool.MultipleSelect));this._initTools()},_initCanvas:function(n){this._renderCanvas(n)},_initVisualGuide:function(){this.model.tooltip&&(this.model.tooltip=ej.datavisualization.Diagram.Tooltip(this.model.tooltip));this.model.selectedItems&&(this.model.selectorConstraints&&(this.model.selectedItems.constraints=this.model.selectorConstraints),this.model.selectedItems.tooltip=ej.datavisualization.Diagram.Util.canEnableTooltip(this)&&this.showTooltip()?this.model.selectedItems.tooltip?ej.datavisualization.Diagram.Tooltip(this.model.selectedItems.tooltip):ej.datavisualization.Diagram.Tooltip({margin:{top:10}}):null,this.model.selectedItems.tooltip&&this.model.tooltipTemplateId&&(this.model.selectedItems.tooltip.templateId=this.model.selectedItems.tooltip.templateId||this.model.tooltipTemplateId))},_initTools:function(){this.tools={select:new ej.datavisualization.Diagram.SelectTool(this),move:new ej.datavisualization.Diagram.MoveTool(this),resize:new ej.datavisualization.Diagram.ResizeTool(this),rotate:new ej.datavisualization.Diagram.RotateTool(this),endPoint:new ej.datavisualization.Diagram.ConnectionEditTool(this),panTool:new ej.datavisualization.Diagram.PanTool(this),straightLine:new ej.datavisualization.Diagram.StraightLineTool(this),orthogonalLine:new ej.datavisualization.Diagram.OrthogonalLineTool(this),bezierLine:new ej.datavisualization.Diagram.BezierLineTool(this),phase:new ej.datavisualization.Diagram.PhaseTool(this),shapeTool:new ej.datavisualization.Diagram.ShapeTool(this),text:new ej.datavisualization.Diagram.TextTool(this)};this._toolToActivate="select";this.activeTool=this.tools[this._toolToActivate];this._registerDrawingTools()},_initDiagramTool:function(){var n=this.tool(),t;n&ej.datavisualization.Diagram.Tool.ContinuesDraw?this.model.drawType&&(t=this.model.drawType.shape?this.model.drawType.shape:this.model.drawType.type,this._drawToolShape(t,!1)):n&ej.datavisualization.Diagram.Tool.DrawOnce?this.model.drawType&&(t=this.model.drawType.shape?this.model.drawType.shape:this.model.drawType.type,this._drawToolShape(t,!0)):n&ej.datavisualization.Diagram.Tool.ZoomPan?ej.datavisualization.Diagram.Util.canPanning(this)&&(this._toolToActivate="panTool",this.activeTool=this.tools[this._toolToActivate],this.activeTool._isMouseDown=!1,this._currentCursor="pointer"):n&ej.datavisualization.Diagram.Tool.MultipleSelect&&(this.activateTool("select"),this.activeTool.singleAction=!1)},_initHandles:function(){var t=this.model.selectedItems.userHandles,n;if(t)for(n=0;n<t.length;n++)t[n]=ej.datavisualization.Diagram.UserHandle(t[n]),t[n].tool&&(t[n].tool.diagram=this,this.tools[t[n].name]=t[n].tool)},_initHistoryManager:function(){this.model.historyManager.push=$.proxy(this.addHistoryEntry,this);this.model.historyManager.pop=$.proxy(this.removeHistoryEntry,this);this.model.historyManager.canPop=$.proxy(this.canRemoveHistoryEntry,this);this.model.historyManager.startGroupAction=$.proxy(this._startGroupAction,this);this.model.historyManager.closeGroupAction=$.proxy(this._closeGroupAction,this)},_cloneGlobalVariables:function(){this._historyList=$.extend(!0,{},this._historyList)},_setNodesConnectors:function(n,t){var r=[],u=!1,f=!1,e=n.nodes?typeof n.nodes=="function"?n.nodes().length:n.nodes.length:0,o=n.connectors?n.connectors&&typeof n.connectors=="function"?n.connectors().length:n.connectors.length:0,i;if(n.nodes&&e!=this._nodes.length){for(i=0;i<this.nodes().length;i++)this._removeElementFromCollection(this.nameTable[this.nodes()[i].name]);this._isPreventModelChange=!0;this.nodes(typeof n.nodes=="function"?n.nodes():n.nodes);this._isPreventModelChange=!1;this._initNodeCollection(t);u=!0}if(n.connectors&&o!=this._connectors.length){for(i=0;i<this.connectors().length;i++)this._removeElementFromCollection(this.nameTable[this.connectors()[i].name]);this._isPreventModelChange=!0;this.connectors(typeof n.connectors=="function"?n.connectors():n.connectors);this._isPreventModelChange=!1;this._initConnectorCollection();f=!0}return r=this.nodes(),r=r.length>0?this.nodes().concat(this.connectors()):this.connectors(),(r.length>0||n.nodes.length==0||n.connectors.length==0)&&this._resetObjectCollection(r,t,u,f),!0},_removeElementFromCollection:function(n){if(n){if(n.children)for(var t=0;t<n.children.length;t++)this._removeElementFromCollection(this.nameTable[n.children[t]]);n.segments?this._removeEdges(n):(this._disConnect(n,{}),n.inEdges=n.outEdges=[]);ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[n.name],n);ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,n);this._removeElement(n);delete this.nameTable[n.name]}},_updateCloneModel:function(n){n&&(this._cloneModel[n]=typeof this.model[n]=="string"?this.model[n]:$.extend(!0,{},this.model[n]))},_compareModelProperty:function(n,t,i){if(n&&this._cloneModel[n]!==this.model[n]){var r={};r[n]=this.model[n];this._comparePropertyValues(this._cloneModel,n,r,t,i);this._updateCloneModel(n)}},_setModel:function(n){var l=!1,i,u,t,s,f,h,a,v,r;for(t in n){switch(t){case"height":case"width":this._initViews(!0);this._initCanvas(!0);break;case"nodes":case"connectors":l||this._isPreventModelChange||(l=this._setNodesConnectors(n,this._isLoad));break;case"enableContextMenu":this.model.enableContextMenu=n[t];this._initContextMenu(this._isLoad);break;case"contextMenu":this.model.contextMenu=$.extend({},this.model.contextMenu,n[t]);this._initContextMenu(this._isLoad);break;case"snapSettings":u=n[t];u&&Object.keys(u).length>0&&(this._updateSnapSettings(n[t]),ej.datavisualization.Diagram.SvgContext._renderGrid(this._canvas,this._svg,this._page,this));break;case"selectorConstraints":this._setSelectorConstraints(n[t]);break;case"constraints":if(this.model.constraints=n[t],this._hasSelection()&&!ej.datavisualization.Diagram.Util.isPageEditable(this)&&this._clearSelection(),s=this._getConnectors(),s.length>0)for(f=0;f<s.length;f++)ej.datavisualization.Diagram.Util.updateBridging(this.model.connectors[f],this),ej.datavisualization.Diagram.DiagramContext.update(this.model.connectors[f],this);break;case"drawingTools":this.model.drawingTools=n[t];this._registerDrawingTools();break;case"backgroundImage":this.model.backgroundImage=this.model.backgroundImage&&typeof this.model.backgroundImage=="string"?ej.datavisualization.Diagram.BackgroundImage({source:this.model.backgroundImage}):$.extend(!0,{},this.model.backgroundImage,n[t]);ej.datavisualization.Diagram.SvgContext._renderBackground(this,this._canvas,this._svg,this._page,this.model);break;case"backgroundColor":this.model.backgroundColor=n[t];ej.datavisualization.Diagram.SvgContext._renderBackground(this,this._canvas,this._svg,this._page,this.model);break;case"enableAutoScroll":this.enableAutoScroll(n[t]);break;case"autoScrollMargin":this.model.autoScrollMargin=n[t];break;case"layout":n[t].marginX&&(this.model.layout.margin.left=this.model.layout.margin.right=Number(typeof n[t].marginX=="function"?this._layoutMarginX():n[t].marginX));n[t].marginY&&(this.model.layout.margin.top=this.model.layout.margin.bottom=Number(typeof n[t].marginY=="function"?this._layoutMarginY():n[t].marginY));this.model.layout=$.extend(!0,{},this.model.layout,n[t]);this._setLayout(n[t]);break;case"selectedItems":this.updateSelector(n[t]);break;case"pageSettings":this.updatePageSettings(n[t]);break;case"scrollSettings":this._updateScrollSettings(n[t]);break;case"locale":this.locale(n[t]);h=document.getElementById(this.element[0].id+"_contextMenu");h.parentNode.removeChild(h);this.model.contextMenu&&this.model.contextMenu.items&&this.model.contextMenu.items.length>0&&(this.model.contextMenu.items=[]);this._renderContextMenu();break;case"nodeTemplate":this.clear();this._initData();i=this;this._views.forEach(function(n){var t=i._views[n],r=i._setNodeZOrder(t);i._renderDiagramObjects(r,t)});this.layout();break;case"bridgeDirection":case"tool":this.update(n);break;case"connectorTemplate":this._updateConnectors();break;case"commandManager":a=n[t]&&n[t].commands?n[t].commands:undefined;this._initCommands(a);break;case"historyManager":this.model.historyManager=$.extend(!0,this.model.historyManager,{},n[t]);var e=this.model.historyManager.stackLimit,o=this.model.historyManager.redoStack.length,c=this.model.historyManager.undoStack.length;o>0&&(o>e?(r=o-e,this.model.historyManager.redoStack.splice(0,r),this.model.historyManager.undoStack=[]):(v=e-o,r=c-v,this.model.historyManager.undoStack.splice(0,r)));c>0&&(r=c-e,r>0&&this.model.historyManager.undoStack.splice(0,r));this._initHistoryManager();break;case"showTooltip":this.model.showTooltip=n[t];this.model.selectedItems.tooltip=this.showTooltip()?ej.datavisualization.Diagram.Tooltip({margin:{top:10}}):null;break;case"toolTipTemplateId":this.model.selectedItems.tooltip||(this.model.selectedItems.tooltip=ej.datavisualization.Diagram.Tooltip({margin:{top:10}}));this.model.selectedItems.tooltip.templateId=n[t];break;case"tooltip":this.model.tooltip=n[t]===null?null:ej.datavisualization.Diagram.Tooltip($.extend(!0,this.model.tooltip,{},n[t]));break;case"dataSourceSettings":u=n[t];u&&Object.keys(u).length>0&&(this.clear(),$.extend(this.model.dataSourceSettings,n[t]),this._initData(),i=this,this._views.forEach(function(n){var t=i._views[n],r=i._setNodeZOrder(t);i._renderDiagramObjects(r,t)}),this.layout())}t==="nodes"||t==="connectors"||t==="selectorConstraints"||t==="selectedItems"||t==="bridgeDirection"||t==="tool"||t==="dataSourceSettings"||this._compareModelProperty(t)}},_resetObjectCollection:function(n,t,i,r){var f,u,o,e;if(i&&($(this.element).find(".ej-d-node").remove(),$(this.element).find(".ej-d-group").remove()),r)for(f=$(this.element).find(".ej-d-connector"),u=f.length-1;u>=0;u--)o=this.nameTable[f[u].id],o&&o.parent==""&&$(f[u]).remove();this._hasSelection()&&this._clearSelection();e=this;this._views.forEach(function(n){var t=e._views[n],i=e._setNodeZOrder(t);e._renderDiagramObjects(i,t)})},_getConnectors:function(){var t=[],i,n;for(i in this.nameTable)n=this.nameTable[i],(n._type==="connector"||n.segments)&&t.push(n);return t},_generateNodes:function(n){for(var u,t,i=[],r=0;r<n.length;r++)u=n[r],t=this._makeNode(u),t!=null&&t.name&&!this._findNodeByName(i,t.name)&&i.push(t);return i},_generateConnectors:function(n){for(var u,t,i=[],r=0;r<n.length;r++)u=n[r],t=this._makeLine(u),t&&t.name&&!this._findNodeByName(i,t.name)&&i.push(t);return i},_findNodeByName:function(n,t){for(var i=0;i<n.length;i++)if(n[i].name===t)return!0;return!1},_makeNode:function(n){var t=this.model.dataSourceSettings,r={},u=n[t.id],i;if(u){if(r.name=u,t.customFields&&t.customFields.length>0)for(i=0;i<t.customFields.length;i++)r[t.customFields[i]]=n[t.customFields[i]];return r}return null},_makeLine:function(n){var t=this.model.dataSourceSettings.connectionDataSource,i={},r;if(i.name=n[t.id]?n[t.id]:"connector_"+ej.datavisualization.Diagram.Util.randomId(),i.sourceNode=n[t.sourceNode],i.targetNode=n[t.targetNode],n[t.sourcePointX]&&n[t.sourcePointY]&&(i.sourcePoint={x:Number(n[t.sourcePointX]),y:Number(n[t.sourcePointY])}),n[t.targetPointX]&&n[t.targetPointY]&&(i.targetPoint={x:Number(n[t.targetPointX]),y:Number(n[t.targetPointY])}),t.customFields&&t.customFields.length>0)for(r=0;r<t.customFields.length;r++)i[t.customFields[r]]=n[t.customFields[r]];return i},insertData:function(n){var u,r,f,t,i;if(n)t=this._parameterMap(n),u=n.type==="connector"?this.model.dataSourceSettings.connectionDataSource.crudAction.create:this.model.dataSourceSettings.crudAction.create,t&&this._raiseAjaxPost(JSON.stringify({data:[t]}),u);else{if(r=this._getNewNodes(),r.nodes){for(t=[],i=0;i<r.nodes.length;i++)t.push(this._parameterMap(r.nodes[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.crudAction.create)}if(r.connectors){for(t=[],i=0;i<r.connectors.length;i++)t.push(this._parameterMap(r.connectors[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.connectionDataSource.crudAction.create)}}},updateData:function(n){var u,r,f,t,i;if(n)t=this._parameterMap(n),u=n.type==="connector"?this.model.dataSourceSettings.connectionDataSource.crudAction.update:this.model.dataSourceSettings.crudAction.update,t&&this._raiseAjaxPost(JSON.stringify({data:[t]}),u);else{if(r=this._getUpdatedNodes(),r.nodes){for(t=[],i=0;i<r.nodes.length;i++)t.push(this._parameterMap(r.nodes[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.crudAction.update)}if(r.connectors){for(t=[],i=0;i<r.connectors.length;i++)t.push(this._parameterMap(r.connectors[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.connectionDataSource.crudAction.update)}}},removeData:function(n){var u,r,f,t,i;if(n)t=this._parameterMap(n),u=n.type==="connector"?this.model.dataSourceSettings.connectionDataSource.crudAction.destroy:this.model.dataSourceSettings.crudAction.destroy,t&&this._raiseAjaxPost(JSON.stringify({data:[t]}),u);else{if(r=this._getDeletedNodes(),r.nodes){for(t=[],i=0;i<r.nodes.length;i++)t.push(this._parameterMap(r.nodes[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.crudAction.destroy)}if(r.connectors){for(t=[],i=0;i<r.connectors.length;i++)t.push(this._parameterMap(r.connectors[i]));t&&t.length>0&&this._raiseAjaxPost(JSON.stringify({data:t}),this.model.dataSourceSettings.connectionDataSource.crudAction.destroy)}}},_parameterMap:function(n){var i={},t,r;if(n.type==="connector"){if(t=this.model.dataSourceSettings.connectionDataSource,t.id&&(i[t.id]=n.name),t.sourcePointX&&t.sourcePointY&&(i[t.sourcePointX]=n.sourcePoint.X,i[t.sourcePointY]=n.sourcePoint.Y),t.targetPointX&&t.targetPointY&&(i[t.targetPointX]=n.targetPoint.X,i[t.targetPointY]=n.targetPoint.Y),t.sourceNode&&(i[t.sourceNode]=n.sourceNode),t.targetNode&&(i[t.targetNode]=n.targetNode),t.customFields&&t.customFields.length>0)for(r=0;r<t.customFields.length;r++)i[t.customFields[r]]=n[t.customFields[r]]}else if(t=this.model.dataSourceSettings,t.id&&(i[t.id]=n.name),t.width&&(i[t.width]=n.width),t.height&&(i[t.height]=n.height),t.offsetX&&(i[t.offsetX]=n.offsetX),t.offsetY&&(i[t.offsetY]=n.offsetY),t.customFields&&t.customFields.length>0)for(r=0;r<t.customFields.length;r++)i[t.customFields[r]]=n[t.customFields[r]];return i},_raiseAjaxPost:function(n,t){var i=this,r=$.ajax({contentType:"application/json",type:"POST",url:t,data:this._isWebAPI?JSON.stringify(JSON.parse(n).data):JSON.stringify(JSON.parse(n)),dataType:"json",error:function(n){n.status===404&&console.log("Method not found")}})},_initData:function(){var dataSourceSettings,dataSource,nodes,connectors,dataSourceApplied,tempNodes,tempconnectors,i,collapsedNodes;if(this.model.dataSourceSettings&&(dataSourceSettings={},this.model.dataSourceSettings.dataSource&&this.model.dataSourceSettings.connectionDataSource.dataSource?(dataSourceSettings.dataSource=this.model.dataSourceSettings.dataSource,dataSourceSettings.isBinding=!0,dataSourceSettings.nodes=this._generateNodes(this.model.dataSourceSettings.dataSource),dataSourceSettings.connectors=this._generateConnectors(this.model.dataSourceSettings.connectionDataSource.dataSource)):this.model.dataSourceSettings.dataSource&&(dataSourceSettings.id=this._dataSourceUniqueId(),dataSourceSettings.parent=this._dataSourceParentId(),dataSourceSettings.root=this._dataSourceRoot(),dataSourceSettings.dataSource=this._dataSource(),dataSourceSettings.tableName=this._dataSourceTableName(),dataSourceSettings.query=this._dataSourceQueryString()),dataSource=dataSourceSettings.dataSource||this.model.dataSourceSettings.nodes||this.model.dataSourceSettings.connectors),dataSource){if(nodes=[],connectors=[],dataSourceSettings&&dataSourceSettings.isBinding)dataSourceSettings.nodes&&dataSourceSettings.nodes.length>0&&this._applyTemplate(this.model.dataSourceSettings,dataSourceSettings.nodes,nodes,"nodes"),dataSourceSettings.connectors&&dataSourceSettings.connectors.length>0&&this._applyTemplate(this.model.dataSourceSettings,dataSourceSettings.connectors,connectors,"connectors");else if(this.model.dataSourceSettings.nodes||this.model.dataSourceSettings.connectors){if(this.model.dataSourceSettings.nodes){if(dataSource=this.model.dataSourceSettings.nodes||this.model.dataSourceSettings.dataSource,dataSource)if(dataSource instanceof ej.DataManager){$.ajaxSetup({async:!1});var query=this._findQuery(this.model.dataSourceSettings.nodes,this.model.dataSourceSettings.nodeBinding),queryPromise=dataSource.executeQuery(eval(query)),diagram=this;queryPromise.done(function(n){diagram.retriveData=n.result;diagram._applyTemplate(diagram.model.dataSourceSettings,n.result,nodes,"nodes")})}else this._applyTemplate(this.model.dataSourceSettings,dataSource,nodes,"nodes");this.model.dataSourceSettings.connectors&&(dataSource=this.model.dataSourceSettings.connectors||this.model.dataSourceSettings.dataSource,dataSource&&(dataSource instanceof ej.DataManager?($.ajaxSetup({async:!1}),query=this._findQuery(this.model.dataSourceSettings.connectors,this.model.dataSourceSettings.connectorBinding),queryPromise=dataSource.executeQuery(eval(query)),queryPromise.done(function(n){diagram.retriveData=n.result;diagram._applyTemplate(diagram.model.dataSourceSettings,n.result,connectors,"connectors")})):this._applyTemplate(this.model.dataSourceSettings,dataSource,connectors,"connectors")))}}else dataSource instanceof ej.DataManager?(this._initDataSource(dataSourceSettings,nodes,connectors),dataSourceSettings.parent&&(dataSourceApplied=!0)):typeof dataSource!="string"&&dataSource.length&&(this._applyDataSource(dataSourceSettings,dataSource,nodes,connectors),this.model.dataSourceSettings.parent&&(dataSourceApplied=!0));for(tempNodes=[],tempconnectors=[],this.nodes().length>0&&(tempNodes=this.nodes()),this.connectors().length>0&&(tempconnectors=this.connectors()),this.nodes(nodes),this.connectors(connectors),i=0;i<tempNodes.length;i++)this.nodes().push(tempNodes[i]),this._nodes=$.extend(!0,[],this.nodes());for(i=0;i<tempconnectors.length;i++)this.connectors().push(tempconnectors[i]),this._connectors=$.extend(!0,[],this.connectors())}collapsedNodes=this._initNodeCollection(!1,dataSourceApplied);this._initConnectorCollection(dataSourceApplied);collapsedNodes.length>0&&this._collapseNodes(collapsedNodes);this._cloneModel=$.extend(!0,{},this.model)},_getNodeTemplate:function(){var n;return this.model.nodeTemplate&&(typeof this.model.nodeTemplate=="string"&&(n=ej.util.getObject(this.model.nodeTemplate,window)),$.isFunction(this.model.nodeTemplate)&&(n=this.model.nodeTemplate)),n},_getConnectorTemplate:function(){var n;return this.model.connectorTemplate&&(typeof this.model.connectorTemplate=="string"&&(this.model.connectorTemplate=ej.util.getObject(this.model.connectorTemplate,window)),$.isFunction(this.model.connectorTemplate)&&(n=this.model.connectorTemplate)),n},_initNodeCollection:function(n,t){var f=[],r=this.nodes(),e=this.nodes().length,u,i;for(this.model.dataSourceSettings.dataSource||(u=this._getNodeTemplate()),this._isNodeInitializing=!0,i=0;i<e;i++)r[i].container&&!$.isEmptyObject(r[i].container)||r[i].isSwimlane||r[i].type==="swimlane"?r[i]=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,r[i]):typeof r[i].shape!="object"&&(r[i]=ej.datavisualization.Diagram.NodeType(r[i],this)),r[i].name==""&&(r[i].name="node_"+ej.datavisualization.Diagram.Util.randomId()),r[i].type==="swimlane"||r[i].isSwimlane?this.nameTable[r[i].name]=ej.datavisualization.Diagram.Group(r[i]):r[i]._type==="group"||r[i].children&&r[i].children.length>0?(r[i]=r[i].type=="bpmn"&&r[i].container?ej.datavisualization.Diagram.ContainerHelper._initContainer(this,r[i]):this._getNewGroup(r[i]),r[i]._type="group",this.nameTable[r[i].name]=r[i],this._initGroupNode(r[i]),n||r[i].type==="bpmn"||this._udpateChildRotateAngle(r[i])):t?r[i].shape&&typeof r[i].shape=="object"&&ej.datavisualization.Diagram.Util._updateShapeProperties(r[i]):(r[i]=this._getNewNode(r[i]),this.nameTable[r[i].name]=r[i]),!t&&u&&u(this,r[i]),r[i]._type==="node"&&r[i].labels.length&&(r[i].width==0||r[i].height==0)&&this._getNodeDimension(r[i]),this.nameTable[r[i].name]=r[i],this._updateQuad(r[i]),r[i].isExpanded||f.push(r[i]);return delete this._isNodeInitializing,this._nodes=$.extend(!0,[],r),f},_initConnectorCollection:function(n){for(var i=this.connectors(),t,u=this._getConnectorTemplate(),r=0,f=i.length;r<f;r++)t=n?i[r]:this._getNewConnector(i[r]),this.nameTable[t.name]=t,n||this.model.layout&&this._layoutType()===ej.datavisualization.Diagram.LayoutTypes.None&&this._dock(t,this.nameTable),this._updateEdges(t),u&&!n&&u(this,t),i[r]=t;this._connectors=$.extend(!0,[],i)},_initDataSource:function(dataSourceSettings,nodes,connectors){var dataSource=dataSourceSettings.dataSource,diagram=this,mapper,query,queryPromise;dataSource.dataSource.json&&dataSource.dataSource.json.length>0?diagram._applyDataSource(dataSourceSettings,dataSource.dataSource.json,nodes,connectors):dataSource.dataSource.table||(mapper=dataSourceSettings,dataSource instanceof ej.DataManager&&($.ajaxSetup({async:!1}),query=this._findQuery(mapper,dataSourceSettings.nodeBinding),queryPromise=dataSourceSettings.dataSource.executeQuery(eval(query)),queryPromise.done(function(n){diagram.retriveData=n.result;diagram._applyDataSource(dataSourceSettings,n.result,nodes,connectors)})))},_findQuery:function(n,t){var u=[],e=ej.Query(),h=n.query||this.model.dataSourceSettings.query,c,o,r,i,s,f;if(ej.isNullOrUndefined(h)){c=n.dataSource||this.model.dataSourceSettings.dataSource;o=n.tableName||this.model.dataSourceSettings.tableName;for(r in n)r==="tableName"||r==="dataSource"||r==="designTemplate"||r.match("Binding")||n[r]&&u.push(n[r]);for(i in t)if(i==="labels")for(s=t[i],f=0;f<s.length;f++)s[f].text&&u.push(s[f].text);else i=="shape"||i=="line"?t[i][type]&&r.push(t[i][type]):t[i]&&u.push(t[i]);u.length>0&&e.select(u);c.dataSource.url.match(o+"$")||ej.isNullOrUndefined(o)||e.from(o)}else e=h;return e},_updateMultipleRootNodes:function(n,t,i){var r=n[i.parent],u,f;if(r&&r.length>0)for(f=0;f<r.length;f++)u=r[f],t[u]?t[u].items.push(n):t[u]={items:[n]};return t},_applyDataSource:function(n,t,i,r){for(var u=[],v,s,c,p,l,e,f,o,a,y,w,h=0;h<t.length;h++)f=t[h],$.isArray(f[n.parent])?u=this._updateMultipleRootNodes(f,u,n,t):u[f[n.parent]]?u[f[n.parent]].items.push(f):u[f[n.parent]]={items:[f]},n.root===f[n.id]&&(v={items:[f]});if(o=[],n.parent)if(v)o.push(v);else for(e in u)(e||e===0)&&e!="undefined"&&e!='""'&&e!="null"||o.push(u[e]);else o.push(u[undefined]);for(this.model.nodeTemplate&&(y=this._getNodeTemplate()),this.model.connectorTemplate&&(w=this._getConnectorTemplate()),s=0;s<o.length;s++)for(c=0;c<o[s].items.length;c++)p=o[s].items[c],l=this._applyNodeTemplate(n,p,y),i.push(l),n.parent&&(a=u[l[n.id]],a&&a.items&&this._renderChildNodes(n,a,l.name,i,r,u,y,w))},_getNewNodes:function(){var t=[],i=[],r,n;for(r in this.nameTable)n=this.nameTable[r],n&&n.type==="connector"&&n._status==="new"?(n._status="",i.push(n)):n&&n._status==="new"&&(n._status="",t.push(n));return{nodes:t,connectors:i}},_getUpdatedNodes:function(){var t=[],i=[],r,n;for(r in this.nameTable)n=this.nameTable[r],n&&n.type==="connector"&&n._status==="update"?(n._status="",i.push(n)):n&&n._status==="update"&&(n._status="",t.push(n));return{nodes:t,connectors:i}},_getDeletedNodes:function(){for(var n,i=[],r=[],t=0;t<this._crudDeleteNodes.length;t++)n=this._crudDeleteNodes[t],n&&n.type==="connector"?r.push(n):n&&i.push(n);return this._crudDeleteNodes=[],{nodes:i,connectors:r}},_isContainsSameConnector:function(n,t,i){var r,u;if(t&&i)for(r=0;r<n.length;r++)if(u=n[r],u&&u.sourceNode===t&&u.targetNode===i)return!0;return!1},_renderChildNodes:function(n,t,i,r,u,f,e,o){for(var c,s,l,h=0;h<t.items.length;h++)c=t.items[h],s=this._applyNodeTemplate(n,c,e),this._collectionContains(s.name,r)||r.push(s),this._isContainsSameConnector(u,i,s.name)||u.push(this._applyConnectorTemplate(n,null,i,s.name,o)),l=f[c[n.id]],l&&this._renderChildNodes(n,l,s.name,r,u,f,e,o)},_applyTemplate:function(n,t,i,r){var f,u,e,o,s;if(this.model.nodeTemplate&&(f=this._getNodeTemplate()),this.model.connectorTemplate&&(s=this._getConnectorTemplate()),r=="nodes")for(u=0;u<t.length;u++)e=this._applyNodeTemplate(n,t[u],f),i.push(e);if(r=="connectors")for(u=0;u<t.length;u++)o=this._applyConnectorTemplate(n,t[u],t[u].sourceNode,t[u].targetNode,s),i.push(o)},_applyNodeTemplate:function(n,t,i){var r=t;return r.name!==""&&r.name||(r.name=ej.datavisualization.Diagram.Util.randomId()),r=r.type!="group"?this._getNewNode(r):this._getNewGroup(r),i&&i(this,r),r._type==="group"&&this._initGroupNode(r),r},_applyConnectorTemplate:function(n,t,i,r,u){var f={};return f.name=t&&t.name?t.name:ej.datavisualization.Diagram.Util.randomId(),f.sourceNode=i,f.targetNode=r,f=this._getNewConnector(f),u&&u(this,f),f},_collapseNodes:function(n){for(var i,t=0;t<n.length;t++)i=n[t],this._collapseChildren(i)},_getNewNode:function(n){return n.shape&&typeof n.shape=="object"&&ej.datavisualization.Diagram.Util._updateShapeProperties(n),ej.datavisualization.Diagram.Node($.extend(!0,{},this.model.defaultSettings.node,n))},_getNewGroup:function(n){var t=null,i=0,r;if(n.type=="bpmn"&&(n=ej.datavisualization.Diagram.Util._updateBpmnChild(ej.datavisualization.Diagram.Node(n),this)),n.children&&n.children.length>0)for(r in n.children)t=this.nameTable[this._getChild(n.children[r])],t&&(ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t.name],t),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,t),t.segments?(i=this.connectors().indexOf(t),delete this.nameTable[t.name],this.nameTable[t.name]=this._getNewConnector(t),i>=0&&(this.connectors()[i]=this.nameTable[t.name]),this._dock(this.nameTable[t.name],this.nameTable),ej.datavisualization.Diagram.Util.updateBridging(this.nameTable[t.name],this)):t._type==="node"?(i=this.nodes().indexOf(t),delete this.nameTable[t.name],this.nameTable[t.name]=this._getNewNode(t),i>=0&&(this.nodes()[i]=this.nameTable[t.name])):t._type==="group"&&(i=this.nodes().indexOf(t),delete this.nameTable[t.name],this.nameTable[t.name]=this._getNewGroup(t),i>=0&&(this.nodes()[i]=this.nameTable[t.name])));return ej.datavisualization.Diagram.Group($.extend(!0,{},this.model.defaultSettings.group,n))},_isEmptyDiagramObject:function(n){if($.isEmptyObject(n))return!0;for(var t in n)if(typeof n[t]=="object")return this._isEmptyDiagramObject(n[t]);return!1},_getNewConnector:function(n){var t=$.extend(!0,{},this.model.defaultSettings.connector,n),r,u,i;return this.model.layout&&this.model.layout.type=="organizationalchart"&&(t=$.extend(!0,{},{segments:[{type:"orthogonal"}]},t)),this.model.defaultSettings.connector&&this.model.defaultSettings.connector.segments&&this.model.defaultSettings.connector.segments[0]&&(t.defaultType=this.model.defaultSettings.connector.segments[0].type),t.shape&&!this._isEmptyDiagramObject(t.shape)&&(t.shape.type=="umlactivity"&&(t=ej.datavisualization.Diagram.UMLConnectorShape(t),t.sourceNode&&(r=this.nameTable[t.sourceNode]),t.targetNode&&(u=this.nameTable[t.targetNode]),i=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(u,r,t,this),t.targetNode=i?i.name:null),t.shape.type=="umlclassifier"?(t=ej.datavisualization.Diagram.UMLConnectorShape(t),t.sourceNode&&(r=this.nameTable[t.sourceNode]),t.targetNode&&(u=this.nameTable[t.targetNode]),i=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(u,r,t,this),t.targetNode=i?i.name:null):(t.shape=$.extend(!0,{},ej.datavisualization.Diagram.ConnectorShapeDefaults,t.shape),t.shape.flow=="sequence"&&(t.shape.sequence=="normal"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],targetDecorator:{shape:"arrow"},lineWidth:2},t)),t.shape.sequence=="conditional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],targetDecorator:{shape:"arrow"},lineWidth:2},t),t.sourceDecorator={shape:"diamond",fillColor:"white",width:20,height:10}),t.shape.sequence=="default"&&(t=$.extend(!0,{segments:[{type:"straight"}],targetDecorator:{shape:"arrow"},lineWidth:2},t))),t.shape.flow=="association"&&(t.shape.association=="directional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],lineWidth:2,lineDashArray:"2 2",targetDecorator:{shape:"openarrow",width:5,height:10}},t)),t.shape.association=="nondirectional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],lineWidth:2,lineDashArray:"2 2",targetDecorator:{shape:"none"}},t)),t.shape.association=="bidirectional"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],lineWidth:2,lineDashArray:"2 2",targetDecorator:{shape:"openarrow",width:5,height:10}},t),t.sourceDecorator={shape:"openarrow",width:5,height:10})),t.shape.flow=="message"&&(t=$.extend(!0,{},{segments:[{type:"straight"}],sourceDecorator:{shape:"circle",fillColor:"white"},targetDecorator:{shape:"arrow",fillColor:"white"},lineWidth:2,lineDashArray:"4 4"},t)))),ej.datavisualization.Diagram.Util._initConnectionEnds(t,this),ej.datavisualization.Diagram.Connector(t)},_setOverview:function(n,t){var i,r,u;n?(this._overview=n,this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),this._views[n._id]||(this._views.push(n._id),this._views[n._id]={context:ej.datavisualization.Diagram.SvgContext,type:"overview"},n._renderDocument(this._views[n._id]),i=this._views[n._id],r=this._setNodeZOrder(i),this._renderDiagramObjects(r,i,null,!0),n._updateOverview(i)),delete this._viewPort):(n=$("#"+t).ejOverview("instance"),n._removeDocument(this._views[t]),this._views[t]=undefined,u=this._views.indexOf(t),this._views.splice(u,1))},_updateScrollOffset:function(n,t,i){this._hScrollOffset=Number(n);this._vScrollOffset=Number(t);this._verticalOffset(Number(t));this._horizontalOffset(Number(n));this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);ej.datavisualization.Diagram.ScrollUtil._transform(this,n,t,i);var r=this;this._views.forEach(function(i){var f=r._views[i],u;f.type=="overview"&&(u=$("#"+i).ejOverview("instance"),u&&u._scrollOverviewRect(n,t,r._currZoom))});this.model.scrollSettings.viewPortHeight=this._viewPort.height;this.model.scrollSettings.viewPortWidth=this._viewPort.width;this.model.scrollSettings.currentZoom=this._currZoom},_getChild:function(n){return ej.datavisualization.Diagram.Util.getChild(n)},_getChildren:function(n){var i,r,t;if(n){for(i=[],r=0;r<n.length;r++)t=n[r],t&&(typeof t=="object"?i.push(t.name):i.push(t));return i}},_initGroupNode:function(n,t){for(var i=null,r,u=0;n.children&&u<n.children.length;u++)r=t?$.extend(!0,{},t[this._getChild(n.children[u])]):n.children[u],i=typeof r=="string"?this.nameTable[r]:r,i&&(i._type||i.type!="umlclassifier"||(i._type="group"),i.container&&(i._type="group",i.labels=[]),r&&typeof r=="object"&&(typeof i.shape!="object"&&n.type!="bpmn"&&(i=ej.datavisualization.Diagram.NodeType(i,this)),i._type=="group"||i.children||i.segments||i.type=="connector"?i.segments||i.type=="connector"?(i=this._getNewConnector(i),i.name==""&&(i.name=ej.datavisualization.Diagram.Util.randomId())):(i=this._getNewGroup(i),i.name==""&&(i.name=ej.datavisualization.Diagram.Util.randomId()),this._initGroupNode(i)):(n.type!="bpmn"&&n.type!="umlclassifier"&&(i=this._getNewNode(i)),i.name==""&&(i.name=ej.datavisualization.Diagram.Util.randomId()),i._type=="node"&&i.labels.length&&(i.width==0||i.height==0)&&this._getNodeDimension(i)),n.children[u]=i,i.parent=n.name,this.nameTable[i.name]=i,i.segments&&this._dock(i,this.nameTable)),this._updateQuad(this.nameTable[this._getChild(n.children[u])]));this._isLoad||ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)},_udpateChildRotateAngle:function(n){var f,t,i,r,u,e;if(n.rotateAngle)for(i=ej.Matrix.identity(),ej.Matrix.rotate(i,n.rotateAngle,n.offsetX,n.offsetY),r=0;r<n.children.length;r++)t=this.nameTable[this._getChild(n.children[r])],t.rotateAngle=t.rotateAngle?t.rotateAngle+n.rotateAngle:n.rotateAngle,t.rotateAngle%=360,t.rotateAngle<0&&(t.rotateAngle+=360),t.segments?(t.sourceNode||this._setEndPoint(t,ej.Matrix.transform(i,t.sourcePoint),!1),t.targetNode||this._setEndPoint(t,ej.Matrix.transform(i,t.targetPoint),!0)):(t.type=="group"&&this._udpateChildRotateAngle(t),u=t.offsetX,f=t.offsetY,e=ej.Matrix.transform(i,ej.datavisualization.Diagram.Point(u,f)),this._translate(t,e.x-u,e.y-f,this.nameTable),this._updateAssociatedConnectorEnds(t,this.nameTable))},_getNodeDimension:function(n){var f=n._width,e=n._height,o=n.width?n.width:n.maxWidth?n.maxWidth:n.minWidth,i=document.createElement("span"),s=0,h=0,t,r,u,c;if(n.labels.length){for(ej.datavisualization.Diagram.Util.attr(i,{id:n.name+"_label","class":"ej-d-label",style:"display: inline-block; position: absolute; pointer-events: all; line-height: normal;"}),this.element[0].appendChild(i),r=0;r<n.labels.length;r++)t=n.labels[r],t.bold&&(i.style.fontWeight="bold"),t.italic&&(i.style.fontStyle="italic"),i.style.textDecoration=t.textDecoration,i.style.fontFamily=t.fontFamily,i.style.fontSize=t.fontSize+"px",i.style.color=t.fontColor,i.style.backgroundColor=t.fillColor,i.style.borderColor=t.borderColor,i.style.borderWidth=t.borderWidth+"px",i.textContent=t.text,t.wrapping=="nowrap"?(i.style.whiteSpace="nowrap",i.style.wordWrap="normal"):(t.wrapping=="wrap"&&(i.style.wordBreak="break-all"),i.style.wordWrap="break-word",i.style.whiteSpace="pre"),n.maxWidth&&(i.style.maxWidth=o-(t.margin.left+t.margin.right)-t.fontSize+"px"),n.minWidth&&(i.style.minWidth=o-(t.margin.left+t.margin.right)-t.fontSize+"px"),s+=i.offsetWidth+t.margin.left+t.margin.right+5,h+=i.offsetHeight+t.margin.top+t.margin.bottom;u=n.name.match("_attribute")?"attribute":n.name.match("_method")?"method":n.name.match("_member")?"member":"header";n._width=Math.max(n.minWidth||0,s||0);n.maxWidth&&(n._width=Math.min(n.maxWidth,n._width));n._height=Math.max(n.minHeight||0,h||0);n.maxHeight&&(n._height=Math.min(n.maxHeight,n._height));n.width||n.labels[0].horizontalAlignment!="left"||u=="attribute"||u=="method"||u=="member"||(n.offsetX+=(n._width-f)/2);n.width||n.labels[0].horizontalAlignment!="right"||(n.offsetX-=(n._width-f)/2);n.height||n.labels[0].verticalAlignment!="top"||(n.offsetY+=(n._height-e)/2);n.height||n.labels[0].verticalAlignment!="bottom"||(n.offsetY-=(n._height-e)/2);n.parent&&(c=this.nameTable[n.parent]);this.element[0].removeChild(i)}},_getMinMaxSize:function(n,t,i,r,u){var s=null,h=null,l,f,e,c,a,o;return t>=n.minWidth&&t<=n.maxWidth?s=t:n.horizontalAlign!="stretch"||!n.parent||r||u?u?(f=this.nameTable[n.parent],f&&(e=ej.datavisualization.Diagram.Util.bounds(f),o=this._getMinMaxSize(f,e.width,e.height),s=o.width?o.width:t)):s=t<n.minWidth&&n.minWidth!=0?n.minWidth:t>n.maxWidth&&n.maxWidth!=0&&!n.isSwimlane?n.maxWidth:t:(f=this.nameTable[n.parent],f&&(e=ej.datavisualization.Diagram.Util.bounds(f),e.width==0&&e.height==0&&(e.width=t,e.height=i),o=this._getMinMaxSize(f,e.width,e.height),f.isSwimlane&&f.orientation=="vertical"&&(l=this.nameTable[f.children[0]],l&&(o.height-=l.height)),o.width-=f.paddingLeft+f.paddingRight+f.marginLeft+f.marginRight,o.height-=f.paddingTop+f.paddingBottom+f.marginTop+f.marginBottom,s=o.width?o.width:t)),i>=n.minHeight&&i<=n.maxHeight?h=i:(f=this.nameTable[n.parent],n.verticalAlign!="stretch"||!n.parent||r||n.isLane?h=i<n.minHeight&&n.minHeight!=0?n.minHeight:i>n.maxHeight&&n.maxHeight!=0?n.maxHeight:i:(e=ej.datavisualization.Diagram.Util.bounds(f),e.width==0&&e.height==0&&(c=null,a=!1,e.width=n.minWidth,e.height=n.minHeight,(n.minWidth==0||n.minHeight==0)&&(e.width=t,e.height=i,c=!1,a=!0),a||(c=!0)),o=this._getMinMaxSize(f,e.width,e.height),o.width-=f.paddingLeft+f.paddingRight+f.marginLeft+f.marginRight,o.height-=f.paddingTop+f.paddingBottom+f.marginTop+f.marginBottom,c&&(o.height-=n.marginTop),h=o.height?o.height:i)),{width:s,height:h}},_updateConnectorBridging:function(n){var r=[],i,t;for(this.boundaryTable[n.name]=ej.datavisualization.Diagram.Util.bounds(n),n._intersects&&n._intersects.length&&(r=n._intersects),i=0;i<r.length;i++)t=this.nameTable[r[i]],t&&t.visible&&t.segments&&t!=n&&ej.datavisualization.Diagram.Util.canBridge(t,this)&&(ej.datavisualization.Diagram.Util.updateBridging(t,this,[n]),this._disableSegmentChange||ej.datavisualization.Diagram.DiagramContext._refreshOnlySegments(t,this))},_drawToolShape:function(n,t){n=="image"||n=="native"||n=="html"||n==="text"||n==="basic"||n==="flow"||n==="arrow"||n==="bpmn"?this.activateTool("shapeTool",t):n=="straightLine"?this.activateTool("straightLine",t):n=="orthogonalLine"?this.activateTool("orthogonalLine",t):n=="bezierLine"&&this.activateTool("bezierLine",t)},_destroy:function(){if(this.element.empty().removeClass("e-datavisualization-diagram"),this.enableContextMenu()){var n=$("#"+this.element[0].id+"_contextMenu").data("ejMenu");n.destroy()}$("#"+this.element[0].id+"_contextMenu").remove()},_updateScrollSettings:function(n){var u=this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Limited?!0:!1,r=this.model.pageSettings.scrollableArea,f=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),e,t,i,o;(n.horizontalOffset!==undefined||n.verticalOffset!==undefined)&&(e={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:f},n.horizontalOffset!==undefined&&(t=Number(typeof n.horizontalOffset=="function"?n.horizontalOffset():n.horizontalOffset),(!u||t>=r.x&&t<=r.x+r.width)&&(this._scrollLimit()=="diagram"&&(t=Math.max(this._hScrollbar.model.minimum,t),t=Math.min(this._hScrollbar.model.maximum,t)),this._updateScrollOffset(t,this._verticalOffset()))),n.verticalOffset!==undefined&&(i=Number(typeof n.verticalOffset=="function"?n.verticalOffset():n.verticalOffset),(!u||i>=r.y&&i<=r.y+r.height)&&(this._scrollLimit()=="diagram"&&(i=Math.max(this._vScrollbar.model.minimum,i),i=Math.min(this._vScrollbar.model.maximum,i)),this._updateScrollOffset(this._horizontalOffset(),i))),o={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:f},this._raiseEvent("scrollChange",{newValues:o,oldValues:e}));n.zoomFactor&&this.zoomFactor(typeof n.zoomFactor=="function"?n.zoomFactor():n.zoomFactor);n.padding&&($.extend(this.model.scrollSettings.padding,n.padding),this._updateScrollOffset(this._horizontalOffset(),this._verticalOffset()))},updatePageSettings:function(n){if(n){var t=$.extend(!0,{},this.model.pageSettings);n.pageHeight&&this._pageHeight(Number(typeof n.pageHeight=="function"?n.pageHeight():n.pageHeight));n.pageWidth&&this._pageWidth(Number(typeof n.pageWidth=="function"?n.pageWidth():n.pageWidth));(typeof n.multiplePage=="function"||typeof n.multiplePage=="boolean")&&this._multiplePage(typeof n.multiplePage=="function"?n.multiplePage():n.multiplePage);(typeof n.showPageBreak=="function"||typeof n.showPageBreak=="boolean")&&this._showPageBreak(typeof n.showPageBreak=="function"?n.showPageBreak():n.showPageBreak);(n.pageBorderColor||n.pageBorderColor==="")&&this._pageOrientation(typeof n.pageOrientation=="function"?n.pageOrientation():n.pageOrientation);(n.pageBorderWidth||n.pageBorderWidth===0)&&this._pageBorderWidth(Number(typeof n.pageBorderWidth=="function"?n.pageBorderWidth():n.pageBorderWidth));(n.pageMargin||n.pageMargin===0)&&this._pageMargin(Number(typeof n.pageMargin=="function"?n.pageMargin():n.pageMargin));(n.pageBackgroundColor||n.pageBackgroundColor==="")&&this._pageBackgroundColor(typeof n.pageBackgroundColor=="function"?n.pageBackgroundColor():n.pageBackgroundColor);n.scrollLimit&&this._scrollLimit(typeof n.scrollLimit=="function"?n.scrollLimit():n.scrollLimit);n.scrollableArea&&(this.model.pageSettings.scrollableArea=n.scrollableArea);(n.pageBorderColor||n.pageBorderColor==="")&&this._pageBorderColor(typeof n.pageBorderColor=="function"?n.pageBorderColor():n.pageBorderColor);this._compareModelProperty("pageSettings");this._isUndo||this.addHistoryEntry({type:"pagesettingschanged",undoObject:t,category:"internal",redoObject:$.extend(!0,{},this.model.pageSettings)});ej.datavisualization.Diagram.PageUtil._updatePageSize(this);ej.datavisualization.Diagram.SvgContext._updateBackground(this._hScrollOffset,this._vScrollOffset,this._currZoom,this);ej.datavisualization.Diagram.SvgContext._updateGrid(this._hScrollOffset,this._vScrollOffset,this._currZoom,this)}},_updateSnapSettings:function(n){n&&(n.horizontalGridLines&&n.horizontalGridLines.linesInterval&&(this.model.snapSettings.horizontalGridLines.linesInterval=n.horizontalGridLines.linesInterval),n.verticalGridLines&&n.verticalGridLines.linesInterval&&(this.model.snapSettings.verticalGridLines.linesInterval=n.verticalGridLines.linesInterval),n.snapAngle&&this._snapAngle(Number(typeof n.snapAngle=="function"?n.snapAngle():n.snapAngle)),n.snapObjectDistance&&this._snapObjectDistance(Number(typeof n.snapObjectDistance=="function"?n.snapObjectDistance():n.snapObjectDistance)))},_cloneObject:function(n){var t,i;if((this.getObjectType(n)==="node"||this.getObjectType(n)==="connector")&&n.type!="bpmn")return $.extend(!0,{},n);if(this.getObjectType(n)!=="group"&&n.type!=="bpmn"||n.isSwimlane){if(this.getObjectType(n)==="group"&&n.isSwimlane)return this.getNode(n)}else{for(t=$.extend(!0,{},n),i=0;t.children&&t.children.length>0&&i<t.children.length;i++)t.children[i]=this._cloneObject(this.nameTable[this._getChild(t.children[i])]),t.children[i].parent=t.name;return t}},_cloneSelectionList:function(){for(var n,i,r=[],t=0&&this.selectionList&&this.selectionList.length>0;t<this.selectionList.length;t++)if(this.getObjectType(this.selectionList[t])==="pseudoGroup")for(n=this.selectionList[0],i=0;n.children&&n.children.length>0&&i<n.children.length;i++)r.push(this._cloneObject(this.nameTable[this._getChild(n.children[i])]));else r.push(this._cloneObject(this.selectionList[t]));return r},getNode:function(n,t){if(n)return this._getNode(n,t)},addPhase:function(n,t){this._addPhase(n,t)},stopEvents:function(n){this.activeTool.inAction&&!n.originalEvent.target&&n.target&&(n.originalEvent.target=n.target,this._mouseup(n))},_updateSwimlanePhase:function(n,t){var i,r;n&&t&&(t.label&&(i=this.nameTable[n.name],i&&(this._comparePropertyValues(n,"label",t),t.label=$.extend(!0,{},t.label),t.label.rotateAngle=t.orientation==="vertical"?270:0,t.label.name=i.labels[0].name,t.label.mode=ej.datavisualization.Diagram.LabelEditMode.View,n.label=t.label,this.updateLabel(i.name,i.labels[0],n.label))),(t.lineColor||t.lineDashArray||t.lineWidth)&&(r={},t.lineColor&&(this._comparePropertyValues(n,"lineColor",t),n.lineColor=t.lineColor,r.stroke=t.lineColor),t.lineDashArray&&(this._comparePropertyValues(n,"lineDashArray",t),n.lineDashArray=t.lineDashArray,r["stroke-dasharray"]=t.lineDashArray),t.lineWidth&&(this._comparePropertyValues(n,"lineWidth",t),n.lineWidth=t.lineWidth,r["stroke-width"]=t.lineWidth),ej.datavisualization.Diagram.SvgContext._updatePhaseStyle(n,r,this)),t.fillColor&&(this._comparePropertyValues(n,"fillColor",t),n.fillColor=t.fillColor,ej.datavisualization.Diagram.DiagramContext.updateNodeStyle(n,this)))},_updateNodeVisibility:function(n,t){var u,r,i,f;if(n){if(n.type==="group")for(i=0;i<n.children.length;i++)u=this.nameTable[n.children[i]],u&&this._updateNodeVisibility(u,t);if(n.isSwimlane&&(r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,n),r))for(i=0;i<r.length;i++)f=this.nameTable[r[i]],f.visible=t.visible,ej.datavisualization.Diagram.SvgContext._updatePhaseStyle(f,t,this);n.visible=t.visible}},_compareInnerProperties:function(n,t){var r=!0,i;if(n&&t)for(i in t)if(typeof n[i]=="object"){if(r=this._compareInnerProperties(n[i],t[i]),!r)return!1}else if(n[i]!==t[i])return!1;return!0},_comparePropertyValues:function(n,t,i,r,u){var e,c;if(n){var f=null,s=n,h=i,o=t.split("."),l=o.length;if(l>1)for(e=0;l>e;)if(s=s[o[e]],h=h[o[e]],e++,s&&h)e==l-1&&s[o[e]]!=h[o[e]]&&(f={element:n,cause:u?u:r?ej.datavisualization.Diagram.ActionType.Mouse:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:o[0],oldValue:s,newValue:h},this._raisePropertyChange(f));else break;else f={cause:u?u:r?ej.datavisualization.Diagram.ActionType.Mouse:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:t,oldValue:n[t],newValue:i[t]},t==="labels"||t==="ports"||t==="segments"||(typeof n[t]!="object"||this._compareInnerProperties(n[t],i[t]))&&n[t]&&(typeof n[t]=="object"||n[t]==i[t])?t==="segments"?n[t]!=i[t]&&(f.element=n):(t==="labels"||t==="ports")&&n[t].length>0&&(c=t==="ports"?this._findPort(n,i.name):this._findLabel(n,i.name),this._compareInnerProperties(c,i)||(f.element=c,f.oldValue=c,f.newValue=i)):f.element=n,f.element&&this._raisePropertyChange(f)}},updateNode:function(n,t){var r,w,b,c,o,s,k,l,a,i,v;if(n){var i=this._findNode(n),y=ej.Matrix.identity(),d,f,e,h,u=ej.datavisualization.Diagram.NodeConstraints,p=i&&(i.isSwimlane||i.isLane||i.isPhase||i.type==="phase");(p||!p)&&(this._needUpdate=!1,r=null,i&&(this._isUndo||this._isSizingCommand||this._recordPropertiesChanged(i,t,"node"),t.pivot!=undefined&&(d=ej.datavisualization.Diagram.Util.bounds(i,!0),ej.Matrix.rotate(y,i.rotateAngle,i.offsetX,i.offsetY),t.pivot.x!==undefined&&(this._comparePropertyValues(i,"pivot.x",t),w=t.pivot.x-i.pivot.x,i.pivot.x=t.pivot.x,i.offsetX+=w*(i.width||i._width||0)),t.pivot.y!==undefined&&(this._comparePropertyValues(i,"pivot.y",t),b=t.pivot.y-i.pivot.y,i.pivot.y=t.pivot.y,i.offsetY+=b*(i.height||i._height||0)),h=ej.Matrix.transform(y,{x:i.offsetX,y:i.offsetY}),i.offsetX=h.x,i.offsetY=h.y),t.offsetX!=undefined&&(f=t.offsetX-i.offsetX,this._outOfBoundsOnNudge(i,f,0)&&(r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"offsetX",oldValue:i.offsetX,newValue:i.offsetX+f},this._raisePropertyChange(r),this._translate(i,f,0,this.nameTable),i.marginLeft!=0&&(i.marginLeft+=f))),t.offsetY!=undefined&&(e=t.offsetY-i.offsetY,this._outOfBoundsOnNudge(i,0,e)&&(r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"offsetY",oldValue:i.offsetY,newValue:i.offsetY+e},this._raisePropertyChange(r),this._translate(i,0,e,this.nameTable),i.marginTop!=0&&(i.marginTop+=e))),t.rotateAngle!=undefined&&(this._comparePropertyValues(i,"rotateAngle",t),this._rotate(i,t.rotateAngle-i.rotateAngle,this.nameTable)),i.isSwimlane||i.isLane?this._updateSwimlaneSize(i,t):(c=this.tools.resize,t.width!=undefined&&(i.width=i.width?i.width:1,r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"width",oldValue:i.width,newValue:t.width},this._raisePropertyChange(r),o=!1,s=i.isLane?!0:!1,c._outOfBoundsDrag(i,t.width/i.width,1,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY))&&(this.scale(i,t.width/i.width,1,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable,o,s),i.type==="bpmn"&&i._type==="group"&&ej.datavisualization.Diagram.Util._updateGroupBounds(i,this))),t.height!=undefined&&(i.height=i.height?i.height:1,r={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"height",oldValue:i.height,newValue:t.height},this._raisePropertyChange(r),o=!1,s=i.isLane?!0:!1,c._outOfBoundsDrag(i,1,t.height/i.height,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY))&&(this.scale(i,1,t.height/i.height,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable,o,s),i.type==="bpmn"&&i._type==="group"&&ej.datavisualization.Diagram.Util._updateGroupBounds(i,this)))),t.connectorPadding!=undefined&&(this._comparePropertyValues(i,"connectorPadding",t),i.connectorPadding=t.connectorPadding,this.scale(i,1,1,new ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable)),t.visible!=undefined&&(this._comparePropertyValues(i,"visible",t),this._updateNodeVisibility(i,t),t.visible||this._clearSelection()),t.constraints!=undefined&&(this._comparePropertyValues(i,"constraints",t),(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&((i._type!="group"||i.type==="bpmn")&&(i.constraints&u.Shadow||t.constraints&u.Shadow)&&(!(i.constraints&u.Shadow)&&t.constraints&u.Shadow?(i.constraints=t.constraints,i.type==="bpmn"&&i.children&&i.shape!="group"?(ej.datavisualization.Diagram.DiagramContext.updateBPMNNodeStyle(i,this),ej.datavisualization.Diagram.DiagramContext.renderShadow(this.nameTable[this._getChild(i.children[0])],this)):ej.datavisualization.Diagram.DiagramContext.renderShadow(i,this)):i.constraints&u.Shadow&&!(t.constraints&u.Shadow)&&(i.constraints=t.constraints,ej.datavisualization.Diagram.DiagramContext.removeShadow(i,this))),i.constraints=t.constraints,this.selectionList[0]&&this.selectionList[0].name===i.name&&(ej.datavisualization.Diagram.Util.canSelect(this.selectionList[0])?(ej.datavisualization.Diagram.SvgContext.clearSelector(this._adornerSvg,this._adornerLayer),ej.datavisualization.Diagram.SvgContext.renderSelector(this.selectionList[0],this._adornerSvg,this._adornerLayer,this._currZoom,this.model.selectedItems.constraints),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.renderUserHandles(this.model.selectedItems.userHandles,this.selectionList[0],this._adornerSvg,this.selectionList[0].type==="pseudoGroup",this._currZoom,this._adornerLayer,this)):this._clearSelection(!0)))),t.fillColor!=undefined&&(this._comparePropertyValues(i,"fillColor",t),i.fillColor=t.fillColor),t.cssClass!=undefined&&(this._comparePropertyValues(i,"cssClass",t),i.cssClass=t.cssClass),t.opacity!=undefined&&(this._comparePropertyValues(i,"opacity",t),i.opacity=t.opacity),t.borderColor!=undefined&&(this._comparePropertyValues(i,"borderColor",t),i.borderColor=t.borderColor),t.borderWidth!=undefined&&(this._comparePropertyValues(i,"borderWidth",t),i.borderWidth=t.borderWidth),t.borderDashArray!=undefined&&(this._comparePropertyValues(i,"borderDashArray",t),i.borderDashArray=t.borderDashArray),t.shadow!=undefined&&(this._comparePropertyValues(i,"shadow",t),i.type==="bpmn"&&i.children&&i.shape!="group"?(i.children[0].shadow=ej.datavisualization.Diagram.Shadow($.extend(!0,i.children[0].shadow,{},t.shadow)),ej.datavisualization.Diagram.DiagramContext.updateShadow(i.children[0],this)):(i.shadow=ej.datavisualization.Diagram.Shadow($.extend(!0,i.shadow,{},t.shadow)),ej.datavisualization.Diagram.DiagramContext.updateShadow(i,this))),t.gradient!==undefined&&(this._comparePropertyValues(i,"gradient",t),i.gradient=t.gradient===null?t.gradient:t.gradient&&t.gradient.type==="radial"?ej.datavisualization.Diagram.RadialGradient(t.gradient):ej.datavisualization.Diagram.LinearGradient(t.gradient)),t.isExpanded!==undefined&&(this._comparePropertyValues(i,"isExpanded",t),i._updateExpander=!0,t.isExpanded?(i.isExpanded=!0,this._expandChildren(i)):(i.isExpanded=!1,this._collapseChildren(i)),this._selectionContains(i)&&(k=!0,this._clearSelection(!0)),this.layout(),k&&this._addSelection(i,!0)),t.tooltip!==undefined&&(this._comparePropertyValues(i,"tooltip",t),i.tooltip=ej.datavisualization.Diagram.Tooltip($.extend(!0,i.tooltip,{},t.tooltip))),t.excludeFromLayout!=undefined&&(this._comparePropertyValues(i,"excludeFromLayout",t),i.excludeFromLayout=t.excludeFromLayout,this.layout()),t.addInfo!=undefined&&(this._comparePropertyValues(i,"addInfo",t),i.addInfo=t.addInfo),t.maxWidth!=undefined&&(this._comparePropertyValues(i,"maxWidth",t),i.maxWidth=t.maxWidth),t.maxHeight!=undefined&&(this._comparePropertyValues(i,"maxHeight",t),i.maxHeight=t.maxHeight),i=this._findNode(n),t.shape&&typeof t.shape=="object"&&(this._comparePropertyValues(i,"shape",t),ej.datavisualization.Diagram.Util._updateShapeProperties(t),i.type=="html"&&(l=document.getElementById(i.name+"_parentdiv"),l.parentNode.removeChild(l)),ej.datavisualization.Diagram.DiagramContext.setNodeShape(i,this)),this.getObjectType(i)=="node"&&(i=this._updateShape(i,t)),i&&i.type!="phase"&&(ej.datavisualization.Diagram.DiagramContext.update(i,this),i.type=="bpmn"?ej.datavisualization.Diagram.DiagramContext.updateBPMNNodeStyle(i,this):ej.datavisualization.Diagram.DiagramContext.updateNodeStyle(i,this)),this.selectionList[0]&&this.selectionList[0].name===i.name&&ej.datavisualization.Diagram.SvgContext.updateSelector(i,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)));n&&(t&&t.pathData&&(a=i._absolutePath),i=this._findNode(n),a&&(i._absolutePath=a,i._absoluteBounds=null),i&&i._type==="node"&&t&&t.type==="group"&&t.children&&t.children.length>0&&(v=!1,this._svg.document.getElementById(i.name)&&(v=!0),this.remove(i),i.borderColor="transparent",i.borderDashArray="",i.borderWidth=1,i.fillColor="#1BA0E2",i.labels=[],i.fillColor="",i.type=t.type,i.children=t.children,i=ej.datavisualization.Diagram.Group(i),this._initGroupNode(i),v&&(ej.datavisualization.Diagram.Util._updateGroupBounds(i,this),this.add(i))));i&&(i.isLane||i.isSwimlane||i.type==="phase"||i.isPhase)&&(this._needUpdate=!0,i.isLane?this._updateLane(i,t):i.isSwimlane?(this._needUpdate=!1,this._updateSwimlane(i,t,!0)):(i.type==="phase"||i.phase)&&(this._needUpdate=!1,this._updateSwimlanePhase(i,t)))}},_updateSwimlaneSize:function(n,t){var o,f,e,r,i,u;if(n)if(t.height&&(this._comparePropertyValues(n,"height",t),o=t.height-n.height,this._comparePropertyValues(n,"offsetY",{offsetY:n.offsetY+o/2})),t.width&&(this._comparePropertyValues(n,"width",t),o=t.width-n.width,this._comparePropertyValues(n,"offsetX",{offsetX:n.offsetX+o/2})),n.isSwimlane&&(t.height||t.width)){if(r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(this,n),r.length>0&&(f=this.nameTable[r[r.length-1]],f)){if(n.orientation==="vertical"){if(t.width&&t.width>n.width&&(f.minWidth=f.width+t.width-n.width,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,f,!0)),t.height)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.height>=n.height&&(u.minHeight=t.height)}else{if(t.width)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.width>=n.width&&(u.minWidth=t.width);t.height&&t.height>n.height&&(f.minHeight=f.height+t.height-n.height,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,f,!0))}ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this);ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,n,!0);ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,n)}}else if(n.isLane&&(t.height||t.width)){if(e=this.nameTable[n.parent.split("laneStack")[0]],r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(this,e),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),e&&e.orientation==="vertical"){if(t.width&&(t.minWidth=t.width,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,n,!0)),t.height)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.height>=u.height&&(u.minHeight=t.height,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,u,!0))}else{if(t.width)for(i=0;i<r.length;i++)u=this.nameTable[r[i]],t.width>=u.width&&(u.minWidth=t.width,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,u,!0));t.height&&(t.minHeight=t.height,ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,n,!0))}ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,e,!0);ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,e)}},_updateShape:function(n,t){var i=!1,u,r,f;return t.type&&(this._comparePropertyValues(n,"type",t),n.type=n._shape=t.type,i=!0),t.shape&&(this._comparePropertyValues(n,"shape",t),n.shape=n._shape=t.shape,i=!0),n.type!="bpmn"?(t.cornerRadius!=undefined&&(this._comparePropertyValues(n,"cornerRadius",t),n.cornerRadius=t.cornerRadius,i=!0),t.pathData&&(this._comparePropertyValues(n,"pathData",t),n.pathData=t.pathData,i=!0),t.templateId!==undefined&&(n.templateId=t.templateId,i=!0),t.html!==undefined&&(this._comparePropertyValues(n,"html",t),n.html=t.html,i=!0),t.contentId!==undefined&&(this._comparePropertyValues(n,"contentId",t),n.contentId=t.contentId,i=!0),t.source&&(this._comparePropertyValues(n,"source",t),n.source=t.source,i=!0),t.textBlock&&(this._comparePropertyValues(n,"textBlock",t),n.textBlock=t.textBlock,i=!0),t.points&&(this._comparePropertyValues(n,"points",t),n.points=t.points,i=!0),i&&(n.children&&delete n.children,n=ej.datavisualization.Diagram.NodeType(n,this),u=document.getElementById(n.name+"_parentdiv"),u&&u.parentNode.removeChild(u),ej.datavisualization.Diagram.DiagramContext.setNodeShape(n,this),this._clearSelection(!0),this._addSelection(n,!0))):(r=$.extend(!0,{},this.nameTable[n.name]),t.event&&(this._comparePropertyValues(n,"event",t),r.event=t.event,i=!0),t.trigger&&(this._comparePropertyValues(n,"trigger",t),r.trigger=t.trigger,i=!0),t.gateway&&(this._comparePropertyValues(n,"gateway",t),r.gateway=t.gateway,i=!0),t.data&&(this._comparePropertyValues(n,"data",t),r.data=$.extend(r.data,t.data),i=!0),t.activity&&(this._comparePropertyValues(n,"activity",t),r.activity=t.activity,i=!0),t.task!==undefined&&(this._comparePropertyValues(n,"task",t),r.task=$.extend(r.task,t.task),i=!0),t.annotation!==undefined&&(this._comparePropertyValues(n,"annotation",t),r.annotation=$.extend(r.annotation,t.annotation),i=!0),t.subProcess!==undefined&&(this._comparePropertyValues(n,"subProcess",t),r.subProcess=$.extend(r.subProcess,t.subProcess),i=!0),t.direction&&(this._comparePropertyValues(n,"direction",t),r.direction=t.direction,i=!0),i&&(f=this._svg.getElementById(n.name).nextSibling,this._removeElement(n),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[n.name],n),ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable[n.name]),this._nodes=$.extend(!0,[],this.nodes()),n=ej.datavisualization.Diagram.NodeType(r,this),n=n.type=="bpmn"&&n.container?ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n):this._getNewGroup(n),this._initGroupNode(n),this.nameTable[n.name]=n,this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()),this._updateQuad(n),ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this),f&&this._svg.getElementById(n.name).parentNode.insertBefore(this._svg.getElementById(n.name),this._svg.getElementById(f.id)),this._clearSelection(!0),this._addSelection(n,!0))),n},_updateObject:function(n){var r,i,t,u;if(n)if(n.type=="pseudoGroup")for(i=this._getChildren(n.children),t=0,u=i.length;t<u;t++)r=this.nameTable[i[t]],ej.datavisualization.Diagram.DiagramContext.update(r,this);else n.parent&&ej.datavisualization.Diagram.Util._updateGroupBounds(this.nameTable[n.parent],this),ej.datavisualization.Diagram.DiagramContext.update(n,this)},_udatePhaseSize:function(n,t){var i=this.nameTable[this._getChild(n.children[1])],s,o,h,f,u,r,e;if(n.orientation==="vertical"){if(i.minWidth!=t.phaseSize){if(i.width=i.maxWidth,i.minWidth=t.phaseSize,s=i.maxWidth-t.phaseSize,o=t.phaseSize/i.maxWidth,i.maxWidth=t.phaseSize,this.scale(i,o,.0001,ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable),i.children&&i.children.length>0)for(u=0;u<i.children.length;u++)r=this.nameTable[this._getChild(i.children[u])],r&&this.scale(r,o,.0001,ej.datavisualization.Diagram.Point(r.offsetX,r.offsetY),this.nameTable);e=this.nameTable[this._getChild(n.children[2])];e.marginLeft-=s}}else if(n.orientation==="horizontal"&&i.minHeight!=t.phaseSize){if(i.height=i.maxHeight,i.minHeight=t.phaseSize,h=i.maxHeight-t.phaseSize,f=t.phaseSize/i.maxHeight,f=f===Infinity?0:f,i.maxHeight=t.phaseSize,this.scale(i,.0001,f,ej.datavisualization.Diagram.Point(i.offsetX,i.offsetY),this.nameTable),i.children&&i.children.length>0)for(u=0;u<i.children.length;u++)r=this.nameTable[this._getChild(i.children[u])],r&&this.scale(r,.0001,f,ej.datavisualization.Diagram.Point(r.offsetX,r.offsetY),this.nameTable);e=this.nameTable[this._getChild(n.children[2])];e.marginTop-=h}},_updateLane:function(n,t){var u,i,e,f,r;n&&t&&(t.header&&(this._comparePropertyValues(this.getNode(n.name),"header",t),n.children&&n.children.length>0&&(u=this._getChild(n.children[0]),u&&(i=this.nameTable[u]),i&&(e=this._isUndo,this._isUndo=!0,this.updateLabel(i.name,i.labels[0],t.header),this._isUndo=e,t.header.fillColor&&t.header.fillColor!=i.fillColor&&this.updateNode(i.name,{fillColor:t.header.fillColor})))),t.fillColor&&t.fillColor!=n.fillColor&&(this._comparePropertyValues(n,"fillColor",t),this.updateNode(n.name,{fillColor:t.fillColor})),(t.minHeight&&t.minHeight!=n.minHeight||t.minWidth&&t.minWidth!=n.minWidth)&&(t.minHeight&&(this._comparePropertyValues(n,"minHeight",t),n.minHeight=t.minHeight),t.minWidth&&(this._comparePropertyValues(n,"minWidth",t),n.minWidth=t.minWidth),f=this.nameTable[n.parent],f&&(r=this.nameTable[f.parent],r&&ej.datavisualization.Diagram.SwimLaneContainerHelper._updateSwimlane(this,r)),ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,r),ej.datavisualization.Diagram.SvgContext.updateSelector(r,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)),t.constraints&&t.constraints!=n.constraints&&(this._comparePropertyValues(n,"constraints",t),n.constraints=t.constraints))},_updateLastPhase:function(n,t,i){var r,u,e,f;n.isSwimlane&&n.phases&&n.phases.length==1&&(r=0,u=this.nameTable[n.phases[0]],n.orientation==="horizontal"?(u.offset=n.minWidth-r,this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{width:n.minWidth-r}),i&&(f=ej.datavisualization.Diagram.Util.bounds(n),this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{offsetX:f.x+n.width/2}))):n.orientation==="vertical"&&(u.offset=n.minHeight-r,e=u.offset-r,e=e-(t.header?t.header.height:50),this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{height:e}),i&&(f=ej.datavisualization.Diagram.Util.bounds(n),this.updateNode(this.nameTable["phaseStack"+n.phases[0]].name,{offsetY:(t.header?t.header.height:50)/2+f.y+n.height/2}))))},_updateSwimlane:function(n,t,i){var s,e,y,r,h,c,f,w,v,u,o;t.header&&n.children&&n.children.length>0&&(s=this._getChild(n.children[0]),s&&(e=this.nameTable[s]),e&&(y=this._isUndo,this._isUndo=!0,this._comparePropertyValues(this.getNode(n.name),"header",t),this.updateLabel(e.name,e.labels[0],$.extend({},t.header,{width:50})),t.header.fillColor&&t.header.fillColor!=e.fillColor&&this.updateNode(e.name,{fillColor:t.header.fillColor}),this._isUndo=y));for(r in t)n[r]&&t[r]!==n[r]&&(r==="offsetX"?(this._comparePropertyValues(this.getNode(n.name),"offsetX",t),h=t.offsetX-n.offsetX,this._outOfBoundsOnNudge(n,h,0)&&this._translate(n,h,0,this.nameTable)):r==="offsetY"?(this._comparePropertyValues(this.getNode(n.name),"offsetY",t),c=t.offsetY-n.offsetY,this._outOfBoundsOnNudge(n,0,c)&&this._translate(n,0,c,this.nameTable)):r!=="minWidth"&&r!=="minHeight"&&r!=="maxwidth"&&r!=="maxHeight"&&r!="width"&&r!="height"&&r!="phaseSize"&&(n[r]=t[r]));if(t.phases&&t.phases.length>0)for(u=0;u<t.phases.length;u++)f=this.nameTable[this._getChild(t.phases[u])],f&&this._updateSwimlanePhase(f,t.phases[u],!0);if(i&&(t.phaseSize||t.phaseSize===0)&&t.phaseSize!==n.phaseSize){this._comparePropertyValues(this.getNode(n.name),"phaseSize",t);t.phaseSize!=n.phaseSize&&(w=!0);var l=this.nameTable[n.name+"phaseStack"],p=this.nameTable[n.name+"laneStack"],f,a=t.phaseSize-n.phaseSize;for(u=0;u<l.children.length;u++)f=this.nameTable[this._getChild(l.children[u])],f&&(t.phaseSize=t.phaseSize===0?.0001:t.phaseSize,n.orientation==="horizontal"?f.height=t.phaseSize:f.width=t.phaseSize);n.phaseSize+=a;n.orientation==="horizontal"?p.marginTop+=a:p.marginLeft+=a;ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,l,null,n)}if(t.lanes&&t.lanes.length>0)for(u=0;u<t.lanes.length;u++)v=this.nameTable[this._getChild(t.lanes[u])],v&&this._updateLane(v,t.lanes[u]);i||(t&&t.phaseSize&&(o=!1),t.minHeight&&t.minHeight!=n.minHeight&&(this._comparePropertyValues(this.getNode(n.name),"minHeight",t),n.minHeight=t.minHeight,o=!0),t.minWidth&&t.minWidth!=n.minWidth&&(this._comparePropertyValues(this.getNode(n.name),"minWidth",t),n.minWidth=t.minWidth,o=!0),t.maxHeight&&t.maxHeight!=n.maxHeight&&(this._comparePropertyValues(this.getNode(n.name),"maxHeight",t),n.minHeight=t.maxHeight,o=!0),t.maxWidth&&t.maxWidth!=n.maxWidth&&(this._comparePropertyValues(this.getNode(n.name),"maxWidth",t),n.minWidth=t.maxWidth,o=!0),o&&!this._isUndo&&this._updateLastPhase(n,t),(t.phaseSize||t.phaseSize===0)&&t.phaseSize!=n.phaseSize&&(this._comparePropertyValues(this.getNode(n.name),"phaseSize",t),this._udatePhaseSize(n,t),t.phaseSize===0&&(n.phaseSize=0)));ej.datavisualization.Diagram.DiagramContext.update(n,this);this.selectionList[0]&&this.selectionList[0].name===n.name&&ej.datavisualization.Diagram.SvgContext.updateSelector(n,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)},updateConnector:function(n,t){var i,o,r,s,h,f;if(n&&(i=this._findConnector(n),i)){if(this._isUndo||this._recordPropertiesChanged(i,t,"connector"),(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&t.constraints!==undefined&&(this._comparePropertyValues(i,"constraints",t),i.constraints=t.constraints,ej.datavisualization.Diagram.Util.canSelect(i)||this._clearSelection(!0)),t.lineColor&&(this._comparePropertyValues(i,"lineColor",t),i.lineColor=t.lineColor),(t.cssClass||t.cssClass==="")&&(this._comparePropertyValues(i,"cssClass",t),i.cssClass=t.cssClass),(t.lineWidth||t.lineWidth===0)&&(this._comparePropertyValues(i,"lineWidth",t),i.lineWidth=t.lineWidth),t.lineDashArray!==undefined&&(this._comparePropertyValues(i,"lineDashArray",t),i.lineDashArray=t.lineDashArray),i.shape&&i.shape.type=="umlclassifier"&&t.shape&&t.shape.multiplicity!=undefined)for(i.shape.multiplicity=t.shape.multiplicity,i.shape.multiplicity=ej.datavisualization.Diagram.UMLConnectorMultiplicity(i.shape.multiplicity),o=ej.datavisualization.Diagram.ClassifierHelper.umlConnectorMultiplicity(i),r=0;r<i.labels.length;r++)i.labels[r].name==i.name+"_sourcelabel"?i.labels[r].text=o[0].text:i.labels[r].name==i.name+"_targetlabel"&&(i.labels[r].text=o[1].text);if(t.opacity!==undefined&&(this._comparePropertyValues(i,"opacity",t),i.opacity=t.opacity),t.cornerRadius!==undefined&&(this._comparePropertyValues(i,"cornerRadius",t),i.cornerRadius=t.cornerRadius),t.lineHitPadding!==undefined&&(this._comparePropertyValues(i,"lineHitPadding",t),i.lineHitPadding=t.lineHitPadding),t.sourcePadding!=undefined&&(this._comparePropertyValues(i,"sourcePadding",t),i.sourcePadding=t.sourcePadding,this._dock(i,this.nameTable)),t.targetPadding!=undefined&&(this._comparePropertyValues(i,"targetPadding",t),i.targetPadding=t.targetPadding,this._dock(i,this.nameTable)),t.visible!=undefined&&(this._comparePropertyValues(i,"visible",t),i.visible=t.visible,t.visible||this._clearSelection()),t.bridgeSpace!=undefined&&(this._comparePropertyValues(i,"bridgeSpace",t),i.bridgeSpace=t.bridgeSpace),t.tooltip!==undefined&&(this._comparePropertyValues(i,"tooltip",t),i.tooltip=ej.datavisualization.Diagram.Tooltip($.extend(!0,i.tooltip,{},t.tooltip))),t.segments&&(this._comparePropertyValues(i,"segments",t),t.segments.length>1?(s=$.extend(!0,[],t.segments),i.segments=s):i.segments=t.segments,ej.datavisualization.Diagram.Util._initConnectionEnds(i,this),this.model.defaultSettings.connector&&this.model.defaultSettings.connector.segments&&this.model.defaultSettings.connector.segments.length&&(h=this.model.defaultSettings.connector.segments[0].type),ej.datavisualization.Diagram.Util._initializeSegments(i,h),this._dock(i,this.nameTable),ej.datavisualization.Diagram.Util.updateBridging(i,this),i==this.selectionList[0]&&(ej.datavisualization.Diagram.SvgContext.clearSegments(this._adornerSvg),ej.datavisualization.Diagram.SvgContext.addSegments(this._adornerSvg,this.selectionList[0],this._currZoom))),t.targetDecorator&&(this._comparePropertyValues(i,"targetDecorator",t),f=i.targetDecorator?$.extend(!0,{},i.targetDecorator,t.targetDecorator):ej.datavisualization.Diagram.Decorator(t.targetDecorator),i.targetDecorator=f),t.sourceDecorator&&(this._comparePropertyValues(i,"sourceDecorator",t),f=i.sourceDecorator?$.extend(!0,{},i.sourceDecorator,t.sourceDecorator):ej.datavisualization.Diagram.Decorator(t.sourceDecorator),i.sourceDecorator=f),(t.sourceDecorator||t.targetDecorator)&&(ej.datavisualization.Diagram.DiagramContext.clearDecorators(i,this),ej.datavisualization.Diagram.DiagramContext.renderDecorators(i,this)),t.hasOwnProperty("sourceNode")||t.hasOwnProperty("targetNode")||t.hasOwnProperty("targetPort")||t.hasOwnProperty("sourcePort")||t.hasOwnProperty("targetPoint")||t.hasOwnProperty("sourcePoint")){if(t.sourceNode!==undefined){this._comparePropertyValues(i,"sourceNode",t);var u=this.nameTable[i.sourceNode],c=this.nameTable[t.sourceNode],l=this.nameTable[i.targetNode],e=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(c,l,i,this);t.sourceNode=e?e.name:null;u&&u.outEdges.indexOf(i.name)!=-1&&ej.datavisualization.Diagram.Util.removeItem(u.outEdges,i.name);i.sourceNode=t.sourceNode}if(t.targetNode!==undefined){this._comparePropertyValues(i,"targetNode",t);var c=this.nameTable[i.sourceNode],l=this.nameTable[t.targetNode],u=this.nameTable[i.targetNode],e=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(l,c,i,this);t.targetNode=e?e.name:null;u&&u.inEdges.indexOf(i.name)!=-1&&ej.datavisualization.Diagram.Util.removeItem(u.inEdges,i.name);i.targetNode=t.targetNode}t.targetPort!==undefined&&(this._comparePropertyValues(i,"targetPort",t),i.targetPort=t.targetPort);t.sourcePort!==undefined&&(this._comparePropertyValues(i,"sourcePort",t),i.sourcePort=t.sourcePort);t.targetPoint!==undefined&&(this._comparePropertyValues(i,"targetPoint",t),ej.datavisualization.Diagram.Util._setLineEndPoint(i,t.targetPoint,!0));t.sourcePoint!==undefined&&(this._comparePropertyValues(i,"sourcePoint",t),ej.datavisualization.Diagram.Util._setLineEndPoint(i,t.sourcePoint,!1));this._updateEdges(i);this._dock(i,this.nameTable)}ej.datavisualization.Diagram.Util.updateBridging(i,this);this._svg&&(this._updateConnectorBridging(i),ej.datavisualization.Diagram.DiagramContext.update(i,this),ej.datavisualization.Diagram.DiagramContext.updateConnectorStyle(i,this));this.selectionList[0]&&this.selectionList[0].name===i.name&&ej.datavisualization.Diagram.SvgContext.updateSelector(i,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},_updateDrawType:function(n){var u,i=!1,r,e=n.tool,t,s;if(e&ej.datavisualization.Diagram.Tool.ContinuesDraw?i=!1:e&ej.datavisualization.Diagram.Tool.DrawOnce&&(i=!0),t=n.drawType?n.drawType:this.model.drawType,t)if(t.type==="connector"){var f=this.model.defaultSettings.connector,h=f&&f.segments&&f.segments.length?f.segments[0].type:"",o=t.segments&&t.segments.length&&t.segments[0].type?t.segments[0].type:h;o==="bezier"?this.activateTool("bezierLine",i):o==="orthogonal"?this.activateTool("orthogonalLine",i):this.activateTool("straightLine",i)}else if(t.type==="text")this.activateTool("text",i);else if(t.type||t.shape){u=t.shape?t.shape:t.type;t.type=="basic"?r=ej.datavisualization.Diagram.BasicShapes:t.type=="flow"?r=ej.datavisualization.Diagram.FlowShapes:t.type=="arrow"?r=ej.datavisualization.Diagram.ArrowShapes:t.type=="bpmn"&&(r=ej.datavisualization.Diagram.BPMNShapes);for(s in r)if(r[s]==t.shape){u=t.type;break}u&&this._drawToolShape(u,i)}},update:function(n){var t,u,r,f,i;if(n.scrollSettings&&(this._eventCause.scrollChange=ej.datavisualization.Diagram.ScrollChangeCause.Unknown,this._setModel({scrollSettings:n.scrollSettings})),n.backgroundColor&&this._setModel({backgroundColor:n.backgroundColor}),n.tool&&(this.activeTool._showAllPorts(!0),t=n.tool,this.tool(t),this._compareModelProperty("tool"),t&ej.datavisualization.Diagram.Tool.ContinuesDraw||t&ej.datavisualization.Diagram.Tool.DrawOnce?this._updateDrawType(n):t&ej.datavisualization.Diagram.Tool.ZoomPan?ej.datavisualization.Diagram.Util.canPanning(this)&&(this._toolToActivate="panTool",this.activeTool=this.tools[this._toolToActivate],this.activeTool._isMouseDown=!1,this._currentCursor="pointer"):t&ej.datavisualization.Diagram.Tool.MultipleSelect&&this.activateTool("select",!1)),n.bridgeDirection)for(this.bridgeDirection(typeof n.bridgeDirection=="function"?n.bridgeDirection():n.bridgeDirection),this._compareModelProperty("bridgeDirection"),u=this.connectors(),r=0,f=u.length;r<f;r++)i=u[r],i&&ej.datavisualization.Diagram.Util.canBridge(i,this)&&(ej.datavisualization.Diagram.Util.updateBridging(i,this),ej.datavisualization.Diagram.DiagramContext.update(i,this))},bringToCenter:function(n){var t=this._currZoom,r=this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),i={x:n.x*t,y:n.y*t,width:n.width*t,height:n.height*t},u=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2;ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1,this._hScrollOffset-u,this._vScrollOffset-f,null,!1)},bringIntoView:function(n){var r=0,u=0,t=this._currZoom,o;n.right=n.right?n.right:n.x+n.width;n.bottom=n.bottom?n.bottom:n.y+n.height;var f=this._hScrollOffset,e=this._vScrollOffset,i=this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);n={x:n.x*t,y:n.y*t,width:n.width*t,height:n.height*t,right:n.right*t,bottom:n.bottom*t};o={x:this._hScrollOffset,y:this._vScrollOffset,width:i.width,height:i.height};ej.datavisualization.Diagram.Geometry.containsRect(o,n)||(n.right>-f+i.width&&(r=n.right-i.width),n.x<-f&&(r=n.x),n.bottom>-e+i.height&&(u=n.bottom-i.height),n.y<-e&&(u=n.y),ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1,this._hScrollOffset-r,this._vScrollOffset-u,null,!1))},getBridgeSegment:function(n,t,i,r,u){return"A "+r/2+" "+r/2+" "+i+" , 1 "+u+" "+t.x+","+t.y},fitToPage:function(n,t,i){var r,f,s={},u,o=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0),c,a,l,e,h,v;if(i=i||{},i={top:isNaN(i.top)?25:i.top,bottom:isNaN(i.bottom)?25:i.bottom,left:isNaN(i.left)?25:i.left,right:isNaN(i.right)?25:i.right},t=t?t:"pageSettings",t=="pageSettings"&&this.model.pageSettings.pageWidth&&this.model.pageSettings.pageHeight||this.nodes().length>0||this.connectors().length>0){n=n?n:"page";t!="custom"&&(u=this._getDigramBounds(t),u.x-=this.model.scrollSettings.padding.left,u.y-=this.model.scrollSettings.padding.top,u.width+=this.model.scrollSettings.padding.left+this.model.scrollSettings.padding.right,u.height+=this.model.scrollSettings.padding.top+this.model.scrollSettings.padding.bottom);c=u.width;a=u.height;s.x=(o.width-(i.left+i.right))/c;s.y=(o.height-(i.top+i.bottom))/a;l=this._hScrollOffset;e=this._vScrollOffset;switch(n){case"width":r=s.x;f=r/this._getCurrentZoom();h=(o.width-(t!="content"?u.width:c)*r)/2-u.x*r;l+=h+(i.left-i.right)/2*r;e-=this._vScrollOffset*f;e=t!="custom"?e:e+this._vScrollOffset*f;break;case"height":r=s.y;f=r/this._getCurrentZoom();h=(o.width-(t!="content"?u.width:c)*r)/2-u.x*r;v=(o.height-(t!="content"?u.height:a)*r)/2-u.y*r;l+=h+(i.left-i.right)/2*r;e+=v+(i.top-i.bottom)/2*r;break;case"page":r=Math.min(s.x,s.y);f=r/this._getCurrentZoom();h=(o.width-(t!="content"?u.width:c)*r)/2-u.x*r;v=(o.height-(t!="content"?u.height:a)*r)/2-u.y*r;l+=h+(i.left-i.right)/2*r;e+=v+(i.top-i.bottom)/2*r}ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,f,l,e,new ej.datavisualization.Diagram.Point(0,0),!0)}else f=1/this._getCurrentZoom(),ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,f,this._hScrollOffset,this._vScrollOffset,new ej.datavisualization.Diagram.Point(0,0),!0)},exportDiagram:function(n){var h,ot,s,i,k,d,g,c,nt,tt,it,l,u,a,ht,rt,ct,v,y,r,f,lt,e,at,w,ft,o,vt,et;n=ej.datavisualization.Diagram.ExportSettings(n);n||(n={});var st=n&&n.region?n.region:"content",b=n&&n.mode?n.mode:"download",t=n.margin||{};for(t={top:isNaN(t.top)?25:t.top,bottom:isNaN(t.bottom)?25:t.bottom,left:isNaN(t.left)?25:t.left,right:isNaN(t.right)?25:t.right},i=this._getDigramBounds(st),n.bounds&&(ot=!0,i={x:isNaN(n.bounds.x)?i.x:n.bounds.x,y:isNaN(n.bounds.y)?i.y:n.bounds.y,width:n.bounds.width||i.width,height:n.bounds.height||i.height}),k=this.nodes(),r=0;r<k.length;r++)for(d=k[r],g=d.labels,c=0;c<g.length;c++)nt=g[c],nt.visible&&(tt=ej.datavisualization.Diagram.Util.getLabelbounds(this,d,nt)),tt&&(i=this._union(tt,i));if(i.x-=t.left,i.y-=t.top,i.width+=t.left+t.right,i.height+=t.top+t.bottom,it=n.fileName||"diagram",n.format!="svg"){if(this._setScaleValueforCanvas(n,i),l=this._diagramAsCanvas({bounds:i,margin:t,region:st,scaleX:n._scaleX,scaleY:n._scaleY},ot),h=n.format||"jpg",u=s=l.toDataURL(),b=="data")return s;if(!(ej.browserInfo().name==="msie"&&parseFloat(ej.browserInfo().version)<10))for(n.multiplePage?(n.pageHeight=n.pageHeight?n.pageHeight:this.model.pageSettings.pageHeight,n.pageWidth=n.pageWidth?n.pageWidth:this.model.pageSettings.pageWidth,n.pageHeight=n.pageHeight?n.pageHeight:l.width,n.pageWidth=n.pageWidth?n.pageWidth:l.height,t=n.margin||{},a=!1,n.pageOrientation==ej.datavisualization.Diagram.PageOrientations.Landscape?n.pageHeight>n.pageWidth&&(a=!0):n.pageWidth>n.pageHeight&&(a=!0),a&&(ht=n.pageWidth,n.pageWidth=n.pageHeight,n.pageHeight=ht),n.margin={top:isNaN(t.top)?0:t.top,bottom:isNaN(t.bottom)?0:t.bottom,left:isNaN(t.left)?0:t.left,right:isNaN(t.right)?0:t.right},rt=document.createElement("img"),ct={id:this.element[0].id+"_printImage",src:u},ej.datavisualization.Diagram.Util.attr(rt,ct),v=this._getMultipleImage(rt,n,!0)):v=[u],f=[],y=0;y<v.length;y++){u=v[y];u=u.replace(/^data:[a-z]*;,/,"");var yt=u.split(","),ut=atob(yt[1]),p=new ArrayBuffer(ut.length),pt=new Uint8Array(p);for(r=0;r<ut.length;r++)pt[r]=ut.charCodeAt(r);f.push(p)}}else{if(f=[],h=n.format||"svg",lt=s=this._diagramAsSvg({bounds:i,margin:t}),b=="data")return s;ej.browserInfo().name==="msie"&&parseFloat(ej.browserInfo().version)<10||(p=(new XMLSerializer).serializeToString(lt),f.push(p))}if(b=="download"){if(e=ej.browserInfo(),e.name==="msie"&&parseFloat(e.version)<10||e.name=="webkit")return at=e.name=="webkit"?"Safari":"IE-9",alert("Downloading option is not supported in "+at+", Please use the returned data"),s;for(w=0;w<f.length;w++)ft=new Blob([f[w]],{type:"application/octet-stream"}),e.name==="msie"?window.navigator.msSaveOrOpenBlob(ft,it+"."+h):(o=document.createElement("a"),vt=URL.createObjectURL(ft),o.href=vt,o.setAttribute("download",it+"."+h),document.createEvent?(et=document.createEvent("MouseEvents"),et.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),o.dispatchEvent(et)):o.fireEvent&&o.fireEvent("onclick"))}},_diagramAsSvg:function(n){var i=new ej.datavisualization.Diagram.Svg({id:"diagram_svg",width:n.bounds.width,height:n.bounds.height}),t,o,r,f,h,s,u,c;document.body.appendChild(i.document);t=this._svg.document.getElementById(this._canvas.id+"_pageBackground");t=$(t).find("#pageback")[0];t=t.cloneNode(!0);var e=this._getDigramBounds(),l=e.x,a=e.y,v=e.width,y=e.height;for(i.appendChild(t),t.setAttribute("transform","translate("+-n.bounds.x+", "+-n.bounds.y+")"),t.setAttribute("x",l),t.setAttribute("y",a),t.setAttribute("width",v),t.setAttribute("height",y),t=this._svg.document.getElementById(this._canvas.id+"_diagramLayer"),t=t.cloneNode(!0),i.appendChild(t),t.setAttribute("transform","translate("+-n.bounds.x+", "+-n.bounds.y+")"),o=this.nodes(),u=0;u<o.length;u++)if(r=o[u],r._type=="group"?ej.datavisualization.Diagram.SvgContext._renderLabelGroup(r,i,this):ej.datavisualization.Diagram.SvgContext._renderLabelsAsSvg(r,i,this),r.annotation&&r._annotation&&r._annotation.length)for(f=0;f<r._annotation.length;f++)diagram.nameTable[r._annotation[f]]&&(h=diagram.nameTable[r._annotation[f]],ej.datavisualization.Diagram.SvgContext._renderLabelsAsSvg(h,i,this));for(s=this.connectors(),u=0;u<s.length;u++)c=s[u],ej.datavisualization.Diagram.SvgContext._renderLabelsAsSvg(c,i,this);return document.body.removeChild(i.document),i.appendChild(this._svg.document.getElementById(this._canvas.id+"patterndefinition").cloneNode(!0)),i.document},_setScaleValueforCanvas:function(n,t){n._scaleX=1;n._scaleY=1;n.pageHeight=n.pageHeight?n.pageHeight:this.model.pageSettings.pageHeight;n.pageWidth=n.pageWidth?n.pageWidth:this.model.pageSettings.pageWidth;var i=n.pageHeight?n.pageHeight:t.height,r=n.pageWidth?n.pageWidth:t.width;(n.stretch==="fill"||n.stretch==="uniform"||n.stretch==="uniformtofill")&&(n._scaleX=r/t.width,n._scaleY=i/t.height,n.stretch==="uniform"?n._scaleX=n._scaleY=Math.min(n._scaleX,n._scaleY):n.stretch==="uniformtofill"&&(n._scaleX=n._scaleY=Math.max(n._scaleX,n._scaleY)),t.width=r,t.height=i);t.x*=n._scaleX;t.y*=n._scaleY},_diagramAsCanvas:function(n){var h,u,e=n.bounds,s=n.margin,t=this._getDigramBounds(),nt=this._pageBackgroundColor(),o=new ej.datavisualization.Diagram.Canvas({id:"mycanvas",width:e.width,height:e.height}),i,r,f,a,w,b,v;if(o._diagram=this,o._scaleX=n.scaleX,o._scaleY=n.scaleY,i=o.document.getContext("2d"),i.fillStyle=this._backgroundColor(),i.translate(-e.x,-e.y),i.fillRect(e.x,e.y,e.width,e.height),r=this._backgroundImage(),r&&r.source){t=this._getDigramBounds();f=new Image;f.src=r.source;var k=t.width/f.width,d=t.height/f.height,c=t.x,l=t.y,y=t.width,p=t.height,g=ej.datavisualization.Diagram.CanvasContext._isImageExportable(r);r.scale!="none"&&r.alignment!="none"?(a=r.scale=="meet"?Math.min(k,d):Math.max(k,d),y=a*f.width,p=a*f.height,r.alignment.indexOf("xmid")>-1?c+=(t.width-y)/2:r.alignment.indexOf("xmax")>-1&&(c=c+t.width-y),r.alignment.indexOf("ymid")>-1?l+=(t.height-p)/2:r.alignment.indexOf("ymax")>-1&&(l=l+t.height-p),(this._backgroundColor()=="none"||this._backgroundColor()=="transparent")&&(i.fillStyle="white",i.fillRect(t.x*n.scaleX,t.y*n.scaleY,t.width*n.scaleX,t.height*n.scaleY)),g&&i.drawImage(f,c,l,a*f.width,a*f.height)):g&&i.drawImage(f,c,l,t.width,t.height)}else i.fillStyle=nt,i.fillRect(t.x*n.scaleX-s.left,t.y*n.scaleY-s.top,t.width*n.scaleX+s.left+s.right,n.scaleY*t.height+s.top+s.bottom);for(w=this._pageBorderColor(),b=this._pageBorderWidth(),b&&(i.strokeStyle=w=="none"?"transparent":w,i.lineWidth=b,i.strokeRect(t.x*n.scaleX,t.y*n.scaleY,t.width*n.scaleX,t.height*n.scaleY)),h=this.nodes().concat(this.connectors()),h=this._sortByZIndex(h,!0),this._sortByGroupChildrenZIndex(!0),v=0;v<h.length;v++)u=h[v],u.segments?ej.datavisualization.Diagram.CanvasContext.renderConnector(u,o):u._type!=="group"||u.parent?u._type!=="node"||u.isPhase||u.parent||ej.datavisualization.Diagram.CanvasContext.renderNode(u,o):ej.datavisualization.Diagram.CanvasContext.renderGroup(u,o,this);return o.document},_renderCanvasPhase:function(n,t){var h=0,e=0,y=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,n),o,c,l,p,s,r,a,v,f;if(y)for(c=0;c<y.length;c++){if(o=this.nameTable[y[c]],l=this.nameTable[n.name],l){p=this._getChildren(l.children);p.length>1&&(s=this.nameTable[p[0]]);var u=ej.datavisualization.Diagram.Util.bounds(l),i=[],w,b=u.top+50,k=u.left+50;if(o.orientation=="vertical")for(i.push({x:0,y:0}),i.push({x:u.width,y:0}),w=ej.datavisualization.Diagram.SvgContext._convertToSVGPoints(i),h=u.x,e=u.y+o.offset,s&&(e+=s.height),r=0,a=i.length;r<a;++r)f=ej.datavisualization.Diagram.Geometry.translate(i[r],h,e),i[r]=f;else for(i.push({x:0,y:s.height?s.height:0}),i.push({x:0,y:u.height}),h=u.x+o.offset,e=u.y,r=0,a=i.length;r<a;++r)f=ej.datavisualization.Diagram.Geometry.translate(i[r],h,e),i[r]=f}for(v=0;v<i.length;v++)f=i[v],f.x*=t._scaleX,f.y*=t._scaleY;ej.datavisualization.Diagram.CanvasContext.renderPhases(o,t,i)}},_getPrintCanvasStyle:function(n,t){var i=0,r=0,u;return n&&(i=n.width,r=n.height),t&&((t.pageHeight||t.pageWidth)&&(r=t.pageHeight?t.pageHeight:r,i=t.pageWidth?t.pageWidth:i),t.pageOrientation&&(t.pageOrientation==="landscape"&&r>i?u=i:t.pageOrientation==="portrait"&&i>r&&(u=i),u&&(i=r,r=u))),{height:r,width:i}},_getMultipleImage:function(n,t,i){var ut=[],a=document.createElement("div"),r=this._getPrintCanvasStyle(n,t),v,y,w=t.margin,e=w.left,o=w.top,b=w.right,k=w.bottom,d=0,it=0,u,f,s,h;if(v=r.width+d,y=r.height+it,u=0,f=0,t&&t.multiplePage){if(a.style.height="auto",a.style.width="auto",s=n.height,h=n.width,n){var g=0,rt=0,p,c,l,nt=0,tt=0;do{do nt=r.width,tt=r.height,u+r.width>=h&&(nt=h-u),f+r.height>=s&&(tt=s-f),l=new ej.datavisualization.Diagram.Canvas({id:"multiplePrint"+g+""+rt,width:r.width,height:r.height}),c=l.document.getContext("2d"),c.drawImage(n,d+u+e,it+f+o,nt-b-e,tt-k-o,0+e,0+o,nt-b-e,tt-k-o),u+r.width>=h&&(u-=u-h),p=l.document.toDataURL(),c.restore(),u+=v,i?ut.push(p):this._printImage(a,p,g+""+rt),g++;while(u<h);rt++;g=d=u=0;f+r.height>=s&&(f-=f-s);f+=y}while(f<s)}}else{var d=0,it=0,r=this._getPrintCanvasStyle(n,t),v,y;v=r.width;y=r.height;l=new ej.datavisualization.Diagram.Canvas({id:"multiplePrint0",width:v,height:y});c=l.document.getContext("2d");c.drawImage(n,d+e,it+o,n.width-(b+e),n.height-(o+k),0+e,0+o,v-(b+e),y-(o+k));p=l.document.toDataURL();c.restore();this._printImage(a,p,0)}return i?ut:a},_printImage:function(n,t,i){var f,r,u;f=document.createElement("img");r=document.createElement("div");u={"class":"e-diagram-print-page"};ej.datavisualization.Diagram.Util.attr(r,u);u={id:this.element[0].id+"_multiplePrint_img"+i,style:"float:left",src:t};ej.datavisualization.Diagram.Util.attr(f,u);r.appendChild(f);n.appendChild(r)},print:function(n){var r,t;n=ej.datavisualization.Diagram.PrintSettings(n);var u=this.exportDiagram({mode:"data",region:n.region,margin:{top:0,bottom:0,left:0,right:0},stretch:n.stretch}),i=document.createElement("img"),f={id:this.element[0].id+"_printImage",src:u};ej.datavisualization.Diagram.Util.attr(i,f);r=this._getMultipleImage(i,n);t=window.open("");t!=null&&(t.document.write("<html><head><style> body{margin:0px;} @media print { .e-diagram-print-page {page-break-after: left; }.e-diagram-print-page:last-child {page-break-after: avoid;}} <\/style><title><\/title><\/head>"),t.document.write('<BODY onload="setTimeout(function(){window.print();}, 100)">'),t.document.write("<center>"+r.innerHTML+"<\/center>"),t.document.close())},save:function(){var t=this.model.drawingTools,i=this.model.selectedItems.userHandles,n;return this.model.drawingTools=null,this.model.selectedItems.userHandles=null,this.nameTable.multipleSelection&&(ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable.multipleSelection),this._nodes=$.extend(!0,[],this.nodes())),this._updateTableNodes(),n=jQuery.extend(!0,{},this.model),ej.version&&(n.version=ej.version),this._updateGroupChildren(n),this.model.drawingTools=t,this.model.selectedItems.userHandles=i,this._checkForNullValues(n),n},_checkForNullValues:function(n){this._checkTargetNull(n.pageSettings)},_checkTargetNull:function(n){for(var t in n)n[t]==null||n[t]==Infinity?n[t]=0:typeof n[t]=="object"&&n[t]&&this._checkTargetNull(n[t])},_updateGroupChildren:function(n){var i=[],r,t;if(n&&n.nodes&&n.nodes.length>0)for(t=0;t<n.nodes.length;t++)n.nodes[t].parent!==""||n.nodes[t].isSwimlane?n.nodes[t].isSwimlane&&(r=this._getNode(n.nodes[t].name),this._isSwimlaneExist=!0,r&&i.push(jQuery.extend(!0,{},r))):(this._updateChildren(n.nodes[t]),i.push(jQuery.extend(!0,{},n.nodes[t])));n.nodes=i},_updateChildren:function(n){var u=[],i,r,t;if(n&&n.children&&n.children.length>0)for(t=0;t<n.children.length;t++)r=this._getChild(n.children[t]),r&&(i=this.nameTable[r]),i&&u.push(jQuery.extend(!0,{},i));n.children=u},_containsNode:function(n){var t,i;for(n=this._getChild(n),t=null,i=0;i<this.nodes().length;i++)if(t=this.nodes()[i],t&&t.name===n)return!0;return null},_updateTableNodes:function(){var n=0,t,i;for(n;n<this.nodes().length;n++)t=this.nameTable[this.nodes()[n].name],t&&(this.nodes()[n]=t,t._type==="group"&&this._updateTableGroup(t));for(n;n<this.connectors().length;n++)i=this.nameTable[this.connectors()[n].name],i&&(this.connectors()[n]=i)},_updateTableGroup:function(n){for(var i=n.children,t=0;t<n.children.length;t++)n.children[t]=this.nameTable[this._getChild(n.children[t])],n.children[t]&&n.children[t]._type==="group"&&this._updateTableGroup(n.children[t])},upgrade:function(n){var r=Number(n.version),t,e,u,i,o,f;if(isNaN(r)&&(r=n.version.split("."),n.version=r=Number(r[0]+"."+r[1])),n.version)if(r<14.2){if(n.nodes&&r<14.1)for(t=0;t<n.nodes.length;t++)e=n.nodes[t],this.setConstraints(e);if(n.connectors)for(u=0;u<n.connectors.length;u++){if(i=n.connectors[u],r<14.1&&(i.constraints|=ej.datavisualization.Diagram.ConnectorConstraints.PointerEvents,i.labels&&i.labels.length>0))for(f=0;f<i.labels.length;f++)o=i.labels[f],o.relativeMode=ej.datavisualization.Diagram.LabelRelativeMode.SegmentBounds;r<14.2&&i&&i.segments&&i.segments.length===1&&i.segments[0].type==="orthogonal"&&(i.segments[0].length=13)}}else n.version=="13.1";else if(this.commonAPIChanges(n),n.nodes)for(t=0;t<n.nodes.length;t++)n.nodes[t].inEdges||(n.nodes[t].inEdges=[],n.nodes[t].outEdges=[]),n.nodes[t].constraints=ej.datavisualization.Diagram.NodeConstraints.Default},setConstraints:function(n){var i,r,u,f,t;if(n&&n.type=="group"&&!n.isSwimlane)for(n.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents,i=0;i<n.children.length;i++)t=n.children[i],t.type=="group"?this.setConstraints(t):t.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents;else if(n&&n.type=="group"&&n.isSwimlane)for(n.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents,r=0;r<n.lanes.length;r++)for(u=n.lanes[r],u.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents,f=0;f<u.children.length;f++)t=u.children[f],t.type=="group"?this.setConstraints(t):t.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents;else n.constraints|=ej.datavisualization.Diagram.NodeConstraints.PointerEvents},commonAPIChanges:function(n){var t,i;if(n.defaultSettings={node:n.nodeDefaults,connectors:n.connectorDefaults},n.connectors)for(t=0;t<n.connectors.length;t++)n.connectors[t].constraints=ej.datavisualization.Diagram.ConnectorConstraints.Default,n.connectors[t].line&&(n.connectors[t].line.type=="straight"?(i=[{type:"straight",startPoint:n.connectors[t].line.startPoint,endPoint:n.connectors[t].line.endPoint}],this.commonSourceTargetChanges(n.connectors[t])):n.connectors[t].line.type=="orthogonal"?(i=[{type:"orthogonal",startPoint:n.connectors[t].line.startPoint,endPoint:n.connectors[t].line.endPoint}],this.commonSourceTargetChanges(n.connectors[t])):n.connectors[t].line.type=="bezier"&&(i=[{type:"bezier",startPoint:n.connectors[t].line.startPoint,endPoint:n.connectors[t].line.endPoint,point1:n.connectors[t].line.point1,point2:n.connectors[t].line.point2}],this.commonSourceTargetChanges(n.connectors[t])),n.connectors[t].sourcePoint=n.connectors[t].line.startPoint,n.connectors[t].targetPoint=n.connectors[t].line.endPoint,n.connectors[t].segments=i)},commonSourceTargetChanges:function(n){n.sourceNodeName&&(n.sourceNode=n.sourceNodeName);n.sourceNodePort&&(n.sourcePort=n.sourceNodePort);n.targetNodeName&&(n.targetNode=n.targetNodeName);n.targetPortName&&(n.targetPort=n.targetPortName)},load:function(n){var e,i,t,r,f,u;if(this._isLoad=!0,this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch(),this.clear(),this._zOrder=0,this.enableContextMenu()&&(e=$("#"+this.element[0].id+"_contextMenu").data("ejMenu"),e.destroy(),$("#"+this.element[0].id+"_contextMenu").remove()),n&&n.nodes&&n.nodes.length>0)for(t=n.nodes.length-1;t>=0;t--)i=n.nodes[t],i&&(i.type==="connector"||i.segments)&&(n.connectors.push(i),n.nodes.splice(t,1));if(n&&n.connectors&&n.connectors.length>0)for(t=n.connectors.length-1;t>=0;t--)r=n.connectors[t],f=!1,r.targetNode&&(this._isExist(n,r.targetNode)||(f=!0,n.connectors.splice(t,1))),r.sourceNode&&(this._isExist(n,r.sourceNode)||f||n.connectors.splice(t,1));this.upgrade(n);u={nodes:n.nodes?n.nodes:[],connectors:n.connectors?n.connectors:[],commandManager:n.commandManager?n.commandManager:{},contextMenu:n.contextMenu?n.contextMenu:{},snapSettings:n.snapSettings?n.snapSettings:{},historyManager:n.historyManager?n.historyManager:this._initHistoryManager(),backgroundImage:n.backgroundImage?n.backgroundImage:ej.datavisualization.Diagram.BackgroundImage({source:""}),enableAutoScroll:n.enableAutoScroll?n.enableAutoScroll:!0,autoScrollMargin:n.autoScrollMargin?n.autoScrollMargin:20,layout:n.layout?n.layout:{},pageSettings:n.pageSettings?n.pageSettings:{},click:n.click?n.click:null,connectionChange:n.connectionChange?n.connectionChange:null,defaultSettings:n.defaultSettings?n.defaultSettings:{node:null,connector:null},dataSource:n.dataSource?n.dataSource:null,dataSourceSchema:n.dataSourceSettings?n.dataSourceSettings:{},doubleClick:n.doubleClick?n.doubleClick:null,enableContextMenu:n.enableContextMenu?n.enableContextMenu:!0,tooltip:n.tooltip?n.tooltip:null,height:n.height?n.height:null,mouseEnter:n.mouseEnter?n.mouseEnter:null,mouseOver:n.mouseOver?n.mouseOver:null,mouseLeave:n.mouseLeave?n.mouseLeave:null,nodeTemplate:n.nodeTemplate?n.nodeTemplate:null,rotationChange:n.rotationChange?n.rotationChange:null,selectorConstraints:n.selectorConstraints?n.selectorConstraints:ej.datavisualization.Diagram.SelectorConstraints.All,width:n.width?n.width:null,constraints:n.constraints,phases:n.phases?n.phases:[],scrollSettings:n.scrollSettings?n.scrollSettings:{horizontalOffset:0,verticalOffset:0,currentZoom:1,viewPortHeight:0,viewPortWidth:0,zoomFactor:n.zoomFactor?n.zoomFactor:.2,padding:{left:0,right:0,top:0,bottom:0}}};this._tempCommandManager=n.commandManager;n.showTooltip!==undefined&&(u.showTooltip=n.showTooltip);n.tooltipTemplateId!==undefined&&(u.tooltipTemplateId=n.tooltipTemplateId);$("#"+this._id).ejDiagram(u);this._isLoad=!1;delete this._tempCommandManager},_isExist:function(n,t){for(var r,e,u,i=!1,f=0;n.nodes&&f<n.nodes.length;f++)if(!i&&(r=n.nodes[f],r))if(r.isSwimlane){if(r.lanes)for(e=r.lanes,u=0;u<e.length;u++)if(i=this._checkNodeExist(e[u],t),i)break}else if(i=this._checkNodeExist(r,t),i)break;return i},_checkNodeExist:function(n,t){var i,r,u;if(n.children)for(i=0;i<n.children.length;i++)if(r=n.children[i],r&&(u=this._checkNodeExist(r,t),u))return!0;return n.name===t?!0:!1},layout:function(){this._setLayout()},_setLayout:function(){this._doLayout();ej.datavisualization.Diagram.PageUtil._updatePageSize(this);this._clearSelection()},addSelection:function(n,t){var r,i;n&&!this._selectionContains(n)&&(this.model.selectedItems.children.length>0&&!t?(i=this.nameTable.multipleSelection,i||(i=ej.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),this.nodes().push(i),this.nameTable[i.name]=i),this.model.selectedItems.children.length>1?i.children=this.selectionList[0].children:i.children.push(this.selectionList[0].name),i.children.push(n.name),ej.datavisualization.Diagram.Util._updateGroupBounds(i,this,null,!0),r=i):r=n,this._hasSelection()&&this._clearSelection(!0),i&&this.nameTable.multipleSelection===undefined&&t===!1&&(this.nodes().push(i),this.nameTable[i.name]=i),this._addSelection(r))},clearSelection:function(){this._clearSelection()},removeSelection:function(n){var n,t;(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&n&&(n=this.nameTable[n.name],this.selectionList[0]==n||this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children.length==1?this._clearSelection():this.selectionList[0].type=="pseudoGroup"&&this._collectionContains(n.name,this.selectionList[0].children)&&(t=this.selectionList[0].children.indexOf(n.name),t!=-1?ej.datavisualization.Diagram.Util.removeItem(this.selectionList[0].children,n.name):ej.datavisualization.Diagram.Util.removeItem(this.selectionList[0].children,n),ej.datavisualization.Diagram.Util.removeItem(this.model.selectedItems.children,n),ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this),this._updateSelectionHandle()))},updateSelectedObject:function(n,t){var i=this.nameTable[n];i&&(ej.datavisualization.Diagram.Util.canSelect(i)||i._isHeader)&&(this.activeTool.selectedObject=i);t&&t.isSwimlane&&(this.activeTool.selectedObject=t)},updateSelection:function(n){(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&this._updateSelectionHandle(n)},activateTool:function(n,t){this.tools[n]&&(this.activeTool instanceof ej.datavisualization.Diagram.LineTool&&this.activeTool._showAllPorts(!0),this._toolToActivate=n,this.activeTool=this.tools[this._toolToActivate],this.activeTool.singleAction=!0,(t===!1||n==="panTool")&&(this.activeTool.singleAction=!1));this.activeTool instanceof ej.datavisualization.Diagram.PanTool&&(this._currentCursor="pointer",this.activeTool.startPoint=ej.datavisualization.Diagram.Point(0,0),this.activeTool._isMouseDown=!1);this.activeTool instanceof ej.datavisualization.Diagram.LineTool&&(this.activeTool.singleAction?this.tool(this.tool()|ej.datavisualization.Diagram.Tool.DrawOnce):this.tool(this.tool()|ej.datavisualization.Diagram.Tool.ContinuesDraw),this.activeTool._showAllPorts());this._drawingTool=!0},deactivateTool:function(){this.activeTool instanceof ej.datavisualization.Diagram.LineTool&&this.activeTool._showAllPorts(!0);this.tool()&ej.datavisualization.Diagram.Tool.DrawOnce&&this.tool(this.tool()^ej.datavisualization.Diagram.Tool.DrawOnce);this.tool()&ej.datavisualization.Diagram.Tool.ContinuesDraw&&this.tool(this.tool()^ej.datavisualization.Diagram.Tool.ContinuesDraw);this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan?(this._toolToActivate="panTool",this.activeTool=this.tools[this._toolToActivate],this.activeTool._mousedown=!1,this._currentCursor="pointer"):(this._toolToActivate="select",this.activeTool=this.tools[this._toolToActivate],this.tool(ej.datavisualization.Diagram.Tool.SingleSelect|ej.datavisualization.Diagram.Tool.MultipleSelect))},updateLabel:function(n,t,i){var r,u;if(n&&(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(r=this._findNode(n),r||(r=this._findConnector(n)),i&&t&&!i.name||t.name==i.name)){if(r){this._isUndo||this._recordPropertiesChanged(r,i,"label",t);r.type!=="text"&&(t=this._findLabel(r,t.name));i.name=t.name;this._comparePropertyValues(r,"labels",i);for(u in i)t.hasOwnProperty(u)&&(t[u]=typeof i[u]=="object"?$.extend(!0,{},t[u],i[u]):i[u]);i.wrapText!==undefined&&(t.wrapping=i.wrapText?"wrapwithoverflow":"nowrap");r.segments||r.type!=="text"?(ej.datavisualization.Diagram.DiagramContext.updateLabelStyle(r,t,this),ej.datavisualization.Diagram.DiagramContext.updateLabel(r,t,this)):r.type==="text"&&ej.datavisualization.Diagram.DiagramContext.updateTextBlock(r,t,this)}i.mode===ej.datavisualization.Diagram.LabelEditMode.Edit&&this.startLabelEdit(r,t)}return t},startLabelEdit:function(n,t){var r,i,u;if(n){for(r=0;r<this.selectionList.length;r++)if(i=this.selectionList[r],i!==n&&typeof i.labels.length!="undefined")for(u=0;u<i.labels.length;u++)i.labels[u].mode=ej.datavisualization.Diagram.LabelEditMode.View;t||n.type!=="text"||(t=n.textBlock);this._setLabelEditing(t)?this._startEdit(n):this._endEdit()}},_setSelectorConstraints:function(n){this.model.selectedItems.constraints=n;this.selectionList[0]&&(ej.datavisualization.Diagram.SvgContext.clearSelector(this._adornerSvg,this._adornerLayer),ej.datavisualization.Diagram.SvgContext.renderSelector(this.selectionList[0],this._adornerSvg,this._adornerLayer,this._currZoom,n),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.renderUserHandles(this.model.selectedItems.userHandles,this.selectionList[0],this._adornerSvg,this.selectionList[0].type=="pseudoGroup",this._currZoom,this._adornerLayer,this))},_raiseGroupChangeEvent:function(n,t,i,r){var u={};u.element=n?n:null;u.oldParent=t?t:null;u.newParent=i?i:null;u.cause=r?r:null;t!=i&&this._raiseEvent("groupChange",u)},group:function(){var t,n,i,f,r,u,e;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"){for(t=[],n=0;n<this.selectionList[0].children.length;n++)t.push(this.nameTable[this.selectionList[0].children[n]]);for(this._sortByZIndex(t,!0),f=ej.datavisualization.Diagram.Util.randomId(),r=new ej.datavisualization.Diagram.Group({name:f,rotateAngle:this.selectionList[0].rotateAngle}),this._clearSelection(!0),n=0;n<t.length;n++)this._isUndo=!0,r.children.push(t[n].name),t[n].parent&&(u=this.nameTable[t[n].parent],u&&ej.datavisualization.Diagram.Util.removeChildFromGroup(u.children,t[n].name)),t[n].parent=f,ej.datavisualization.Diagram.Util.removeItem(this.selectionList,t[n].name),t[n].segments?(ej.datavisualization.Diagram.Util.removeItem(this.connectors(),this.nameTable[t[n].name]),this._connectors=$.extend(!0,[],this.connectors())):(ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable[t[n].name]),this._nodes=$.extend(!0,[],this.nodes())),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t[n].name],t[n]),t[n].type=="html"?(i=document.getElementById(t[n].name+"_parentdiv"),i.parentNode.removeChild(i)):t[n]._type==="group"&&this._checkForHtmlNode(t[n]),i=this._svg.document.getElementById(t[n].name),i&&i.parentNode.removeChild(i),this._removeElement(t[n]),this._raiseGroupChangeEvent(t[n],u,r,"group");ej.datavisualization.Diagram.Util.clear(this.selectionList);r=this._getNewGroup(r);this._eventCause.nodeCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.Unknown;this._isGroupNode=!0;this.add(r);e={type:"groupchanged",object:r,actionType:"group",category:"internal"};this.addHistoryEntry(e);this._isUndo=!1;delete this._isGroupNode}},_checkForHtmlNode:function(n){for(var t,r,u=this._getChildren(n.children),i=0;i<u.length;i++)t=this.nameTable[u[i]],t&&(t._type==="group"?this._checkForHtmlNode(t):t.type=="html"&&(r=document.getElementById(t.name+"_parentdiv"),r.parentNode.removeChild(r)))},_removeChildren:function(n,t){for(var i,u=this._getChildren(n.children),r=0;r<u.length;r++)i=this.nameTable[u[r]],i&&(n.isLane?(this._disConnect(i,t),this._removeConnector(i,t)):i.segments?(this._removeEdges(i),i.sourceNode=i.sourcePort=i.targetNode=i.targetPort=null):this._disConnect(i,t,!0),ej.datavisualization.Diagram.Util.removeItem(this.nodes(),i),this._nodes=$.extend(!0,[],this.nodes()),i._type==="group"?(this._removeChildren(i,t),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i),delete this.nameTable[i.name]):(ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i),delete this.nameTable[i.name]),this._removeElement(i))},ungroup:function(){var f,r,i,u,n,e,o,t,s;if(this.selectionList[0]&&this.selectionList[0]._type==="group"&&this.selectionList[0].canUngroup&&!(this.selectionList[0].isSwimlane||this.selectionList[0].isLane)){for(this._isUndo=!0,f=this.selectionList[0].children,u=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],i=this.selectionList[0],$("#"+this.selectionList[0].name)[0].parentNode.removeChild($("#"+this.selectionList[0].name)[0]),this._removeElement(this.selectionList[0]),this._checkForHtmlNode(this.selectionList[0]),this._clearSelection(),ej.datavisualization.Diagram.Util.clear(this.selectionList),r=0;r<f.length;r++)t=this.nameTable[this._getChild(f[r])],t.parent&&(o=this.nameTable[t.parent]),$(u).children("#"+t.name)[0]&&u.removeChild($(u).children("#"+t.name)[0]),t&&(t.parent&&(t.parent=null),t.segments?(n=t,n.parent="",this._updateEdges(n),this._dock(n,this.nameTable),ej.datavisualization.Diagram.DiagramContext.renderConnector(n,this),this.connectors().indexOf(n)===-1&&(this.connectors().push(n),this._connectors=$.extend(!0,[],this.connectors()))):(n=t,n.parent="",n._type==="group"?(this._updateChildrenEdges(n),(n.isLane||n.isSwimlane)&&(n.width=0,n.height=0),ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this)):ej.datavisualization.Diagram.DiagramContext.renderNode(n,this),this.nodes().indexOf(n)===-1&&(this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()))),t.parent&&(e=this.nameTable[t.parent]),this._raiseGroupChangeEvent(t,o,e,"unGroup"));ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this._findNode(i.name));ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i);ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i);s={type:"groupchanged",object:i,actionType:"ungroup",category:"internal"};this.addHistoryEntry(s);this._isUndo=!1}},nudge:function(n,t){t=t?t:1;var u={up:{x:0,y:-t},down:{x:0,y:t},left:{x:-t,y:0},right:{x:t,y:0}},r=u[n],i;n==="up"?i="down":n==="down"?i="up":n==="left"?i="right":n==="right"&&(i="left");r&&this.selectionList[0]&&!this.selectionList[0].isLane&&!this.selectionList[0].isPhase&&(this._isUndo||this.addHistoryEntry({type:"nudge",object:this.selectionList[0],undoDirection:i,redoDirection:n,values:t,category:"internal"}),this._nudge(this.selectionList[0],r.x,r.y,n))},selectAll:function(){var t,u,n,f,i=null,r;for(this._clearSelection(!0),t=ej.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),u=this.nodes(),n=0,f=u.length;n<f;n++)ej.datavisualization.Diagram.Util.canSelect(u[n])&&(i=this.nameTable[u[n].name],i&&i.parent==""&&i.type!="pseudoGroup"&&i.visible&&t.children.push(i.name));for(r=this.connectors(),n=0,f=r.length;n<f;n++)ej.datavisualization.Diagram.Util.canSelect(r[n])&&r[n].parent==""&&r[n].visible&&t.children.push(r[n].name);ej.datavisualization.Diagram.Util._updateGroupBounds(t,this);this.nodes().push(t);this._nodes=$.extend(!0,[],this.nodes());this.nameTable[t.name]=t;t.children.length>0&&this._addSelection(t)},align:function(n){var t,s,i,e,u,f;if(this.selectionList[0]&&(this.selectionList[0].type==="group"||this.selectionList[0].type=="pseudoGroup")&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var h=this.nameTable[this.selectionList[0].name].children,c=[],r,o=this._findCornerNodes();if(n==="left"?r=o.left:n==="right"?r=o.right:n==="top"?r=o.top:n==="bottom"&&(r=o.bottom),r?t=ej.datavisualization.Diagram.Util.bounds(r):(n==="center"||n==="middle")&&(t=ej.datavisualization.Diagram.Util.bounds(this.selectionList[0])),t){for(u=0,f=0,s=0;s<h.length;s++)e=this.nameTable[h[s]],i=ej.datavisualization.Diagram.Util.bounds(e),n==="left"?u=-(i.x-t.x):n==="right"?u=-(i.x+i.width-(t.x+t.width)):n==="top"?f=-(i.y-t.y):n==="bottom"?f=-(i.y+i.height-(t.y+t.height)):n==="center"?u=-(i.x+i.width/2-(t.x+t.width/2)):n==="middle"&&(f=-(i.y+i.height/2-(t.y+t.height/2))),this._moveNode(u,f,e),this._updateContainerOnNudge(e),c.push({object:e,delta:{x:u,y:f}});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}this.addHistoryEntry({type:"alignCommand",values:c,category:"internal",object:this.selectionList[0]})}},sameSize:function(){var t,n;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var i=this.nameTable[this.selectionList[0].name].children,f=this.nameTable[this.selectionList[0].children[0]],r=ej.datavisualization.Diagram.Util.bounds(f),u=[];for(this._isSizingCommand=!0,t=0;t<i.length;t++)n=this.nameTable[i[t]],n.segments||(u.push({object:n,values:{width:n.width||n._width||0,height:n.height||n._height||0}}),this.updateNode(n.name,{width:r.width,height:r.height}));delete this._isSizingCommand;this.addHistoryEntry({type:"sizeCommand",category:"internal",object:this.selectionList[0],values:u});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},sameHeight:function(){var t,n;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var i=this.nameTable[this.selectionList[0].name].children,u=this.nameTable[this.selectionList[0].children[0]],r=[],f=ej.datavisualization.Diagram.Util.bounds(u);for(this._isSizingCommand=!0,t=0;t<i.length;t++)n=this.nameTable[i[t]],n.segments||(r.push({object:n,values:{width:n.width||n._width||0,height:n.height||n._height||0}}),this.updateNode(n.name,{height:f.height}));delete this._isSizingCommand;this.addHistoryEntry({type:"sizeCommand",category:"internal",object:this.selectionList[0],values:r});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},sameWidth:function(){var t,n;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&this.selectionList[0].children&&this.selectionList[0].children.length>0){var i=this.nameTable[this.selectionList[0].name].children,u=this.nameTable[this.selectionList[0].children[0]],f=ej.datavisualization.Diagram.Util.bounds(u),r=[];for(this._isSizingCommand=!0,t=0;t<i.length;t++)n=this.nameTable[i[t]],n.segments||(r.push({object:n,values:{width:n.width||n._width||0,height:n.height||n._height||0}}),this.updateNode(n.name,{width:f.width}));delete this._isSizingCommand;this.addHistoryEntry({type:"sizeCommand",category:"internal",object:this.selectionList[0],values:r});ej.datavisualization.Diagram.Util._updateGroupBounds(this.selectionList[0],this);ej.datavisualization.Diagram.SvgContext.updateSelector(this.selectionList[0],this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}},spaceDown:function(){var t,o,s,i,n,e,u,r,f;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&(t=this.selectionList[0].children,this._sliceDockLines(t),this._sortByYvalue(this.selectionList[0].children),o=t.length,s=[],t&&o>2)){var c=this._findCornerNodes(),l=c.top,h=0,i=null,n=null;for(u in t)i=null,n=null,i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),h+=f.y-(r.y+r.height));e=h/(o-1);for(u in t)i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),this._comparePropertyOnAlign(n,0,r.bottom-f.top+e),this._translate(n,0,r.bottom-f.top+e,this.nameTable),s.push({object:n,delta:{x:0,y:r.bottom-f.top+e}}),this._updateQuad(this,n),this._updateNodeMargin(n),ej.datavisualization.Diagram.DiagramContext.update(n,this));this.addHistoryEntry({type:"spacingCommand",values:s,category:"internal",object:this.selectionList[0]})}},spaceAcross:function(){var t,o,s,i,n,e,l,u,r,f;if(this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&(t=this.selectionList[0].children,this._sliceDockLines(t),this._sortByXvalue(this.selectionList[0].children),o=t.length,s=[],t&&o>2)){var c=this._findCornerNodes(),a=c.left,h=0,i=null,n=null;for(u in t)i=null,n=null,i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),h+=f.x-(r.x+r.width));e=h/(o-1);l=0;for(u in t)i=this.nameTable[this._getChild(t[u])],n=this.nameTable[this._getChild(t[Number(u)+1])],i&&n&&(r=ej.datavisualization.Diagram.Util.bounds(i),f=ej.datavisualization.Diagram.Util.bounds(n),this._comparePropertyOnAlign(n,r.right-f.left+e,0),this._translate(n,r.right-f.left+e,0,this.nameTable),s.push({object:n,delta:{x:r.right-f.left+e,y:0}}),this._updateQuad(this,n),this._updateNodeMargin(n),ej.datavisualization.Diagram.DiagramContext.update(n,this));this.addHistoryEntry({type:"spacingCommand",values:s,category:"internal",object:this.selectionList[0]})}},sendBackward:function(){var t,i,n,r,f,u;if(this.selectionList[0]&&this.selectionList[0].type!="pseudoGroup"&&(n=this.selectionList[0],n)){for(t=this._findOverlapNode(n),this._sortByZIndex(t),r=0;r<t.length;r++)if(n.zOrder>t[r].zOrder){i=t[r];break}f=n.zOrder;i&&(u=i.zOrder,this._comparePropertyValues(n,"zOrder",{zOrder:u},null,ej.datavisualization.Diagram.ActionType.Order),this._sendElementsToBack(f,u,n,i),this.addHistoryEntry({type:"zOrder",command:"back",start:u,end:f,nearestNode:i,object:n,category:"internal"}))}},_sendElementsToBack:function(n,t,i,r){for(var o,f=t;f<n;f++)i.parent!=""?this._findObjectByIndex(f,!0).zOrder+=1:this._findObjectByIndex(f).zOrder+=1;i.parent!=""?i.parent&&(o=this.nameTable[i.parent],this._findChildren(o,i.name).zOrder=t):this._findObjectByName(i.name).zOrder=t;var e=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],s=$(e).find("#"+i.name)[0],h=$(e).find("#"+i.name+"_parentdiv")[0],u=$(e).find("#"+r.name+"_parentdiv")[0];u||(u=$(e).find("#"+r.name)[0]);u&&h&&u.parentNode.insertBefore(h,u);u&&s&&u.parentNode.insertBefore(s,u);this._svg.getElementById(r.name).parentNode.insertBefore(this._svg.getElementById(i.name),this._svg.getElementById(r.name));this._updateSelectionHandle()},_bringElementsToFront:function(n,t,i,r){for(var h,u=t;u>n;u--)i.parent!=""?this._findObjectByIndex(u,!0)&&(this._findObjectByIndex(u,!0).zOrder-=1):this._findObjectByIndex(u)&&(this._findObjectByIndex(u).zOrder-=1);i.parent?(h=this.nameTable[i.parent],this._findChildren(h,i.name).zOrder=t):this._findObjectByName(i.name).zOrder=t;var e=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],c=$(e).find("#"+i.name)[0],s=$(e).find("#"+r.name)[0],f=$(e).find("#"+i.name+"_parentdiv")[0],o=$(e).find("#"+r.name+"_parentdiv")[0];o||(o=$(e).find("#"+r.name)[0]);s&&f&&s.parentNode.insertBefore(f,s.nextSibling);f&&c&&f.parentNode.insertBefore(c,f.nextSibling);o&&f&&o.parentNode.insertBefore(f,o.nextSibling);this._svg.getElementById(r.name).parentNode.insertBefore(this._svg.getElementById(i.name),this._svg.getElementById(r.name).nextSibling);this._updateSelectionHandle()},moveForward:function(){var t,i,n,r,f,u;if(this.selectionList[0]&&this.selectionList[0].type!="pseudoGroup"&&(n=this.selectionList[0],n)){for(t=this._findOverlapNode(n),this._sortByZIndex(t),r=t.length-1;r>=0;r--)if(n.zOrder<t[r].zOrder){i=t[r];break}f=n.zOrder;i&&(u=i.zOrder,this._comparePropertyValues(n,"zOrder",{zOrder:u},null,ej.datavisualization.Diagram.ActionType.Order),this._bringElementsToFront(f,u,n,i),this.addHistoryEntry({type:"zOrder",command:"front",start:u,end:f,nearestNode:i,object:n,category:"internal"}))}},sendToBack:function(){var n=this.selectionList[0],u,t;if(n&&n.type!="pseudoGroup"){var o=this._findOverlapNode(n),i=this._sortByZIndex(o),f=n.zOrder,r=n.zOrder,e;for(t=0;t<i.length;t++)i[t].zOrder<r&&(t==0&&(e=i[t]),r=i[t].zOrder,u=i[t]);u&&(this._comparePropertyValues(n,"zOrder",{zOrder:r},null,ej.datavisualization.Diagram.ActionType.Order),this._sendElementsToBack(f,r,n,u),this.addHistoryEntry({type:"zOrder",command:"back",start:r,end:f,nearestNode:e,object:n,category:"internal"}))}},bringToFront:function(){var n=this.selectionList[0],u,t;if(n&&n.type!="pseudoGroup"){var e=this._findOverlapNode(n),i=this._sortByZIndex(e),f=n.zOrder,r=n.zOrder;for(t=0;t<i.length;t++)i[t].zOrder>r&&(r=i[t].zOrder,u=i[t]);u&&(this._comparePropertyValues(n,"zOrder",{zOrder:r},null,ej.datavisualization.Diagram.ActionType.Order),this._bringElementsToFront(f,r,n,u),this.addHistoryEntry({type:"zOrder",command:"front",start:r,end:f,nearestNode:i[t-1],object:n,category:"internal"}))}},_getChildFromCollection:function(n,t){if(n&&n.length>0&&t)for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i]},_updateNameTable:function(n){var i,t;if(n.children&&n.children.length>0)for(i=0;i<n.children.length;i++)t=typeof n.children[i]=="object"?n.children[i]:null,t&&(this.nameTable[t.name]=t,t.children&&t.children.length>0&&this._updateNameTable(t))},_recordPageSettingsChanged:function(n){var t=n.redoObject;n.isUndo&&(t=n.undoObject);t&&this.updatePageSettings(t)},_recordMultiRotationChanged:function(n){ej.datavisualization.Diagram.canvasHelper._undoMultiRotateNode(this,n)},_recordMultiPinPointChanged:function(n){ej.datavisualization.Diagram.canvasHelper._undoMultiDragNode(this,n)},_recordMultiSizeChanged:function(n){ej.datavisualization.Diagram.canvasHelper._undoMultiResizeNode(this,n)},undo:function(){var n;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&ej.datavisualization.Diagram.Util.canUndo(this)){if(this._getHistoryList(),this._isUndo=!0,n=this.getUndoEntry(),n&&(n.type=="closeGroup"?this._groupUndo=!0:this._undo(n),this._groupUndo)){for(n=this.getUndoEntry();n&&n.type!="startGroup";)this._undo(n),n=this.getUndoEntry();delete this._groupUndo}this._isUndo=!1}},redo:function(){this._isUndo=!0;var n=this.getRedoEntry();if(n&&(n.type=="startGroup"?this._groupRedo=!0:this._redo(n),this._groupRedo)){for(n=this.getRedoEntry();n&&n.type!="closeGroup";)this._isUndo=!0,this._redo(n),n=this.getRedoEntry();delete this._groupRedo}this._isUndo=!1},_ComparehistoryChangeEvent:function(n,t){var i,r={source:[],changes:[]},s,u,f,h,o,e;switch(t.type){case"positionchanged":case"rotationchanged":case"sizechanged":r=this._getPseudoGroupElements(n,t);break;case"endpointchanged":this._UndoRedo?(s=this._historyChangeEvent(t.undoObject,t.redoObject,t),i={type:t.type,oldValues:s.oldValues,newValues:s.newValues,cancel:!1},r.source.push(t.undoObject)):(s=this._historyChangeEvent(t.redoObject,t.undoObject,t),i={type:t.type,oldValues:s.oldValues,newValues:s.newValues,cancel:!1},r.source.push(t.redoObject));r.changes.push(i);break;case"collectionchanged":t.changeType=="remove"&&(i={type:t.type,addedItems:[],deletedItems:[n]});t.changeType=="insert"&&(i={type:t.type,addedItems:[n],deletedItems:[]});r.changes.push(i);r.source.push(n);break;case"labelchanged":i=this._UndoRedo?{type:t.type,newValues:{text:t.previousLabelValue},oldValues:{text:t.updatedLabelValue}}:{type:t.type,newValues:{text:t.updatedLabelValue},oldValues:{text:t.previousLabelValue}};r.changes.push(i);r.source.push(t.shape);break;case"labelcollectionchanged":i={type:t.type,source:t.shape,addedItems:[t.label],deletedItems:[]};r.changes.push(i);r.source.push(t.shape);case"groupchanged":i=t.actionType=="group"?{type:t.type,source:t.object,addedItems:[t.object],deletedItems:[]}:{type:t.type,source:t.object,addedItems:[],deletedItems:[t.object]};r.changes.push(i);r.source.push(t.object);break;case"phasepositionchanged":this._UndoRedo?(i={type:t.type,newValues:{offset:t.undoObject.offset},oldValues:{offset:t.redoObject.offset}},r.source.push(t.undoObject)):(i={type:t.type,newValues:{offset:t.redoObject.offset},oldValues:{offset:t.undoObject.offset}},r.source.push(t.redoObject));r.changes.push(i);break;case"phasecollectionchanged":i=t.isAdded?{type:t.type,addedItems:[t.phase],deletedItems:[]}:{type:t.type,addedItems:[],deletedItems:[t.phase]};r.source.push(t.phase);r.changes.push(i);break;case"propertiesChanged":i=this._propertyChangeEventValues(t);r.source.push(i.source);r.changes.push(i.changes);break;case"portscollectionchanged":t.changeType=="insert"&&(i={type:t.type,addedItems:[t.collection],deletedItems:[]});t.changeType=="remove"&&(i={type:t.type,addedItems:[],deletedItems:[t.collection]});r.source.push(t.object);r.changes.push(i);break;case"nudge":u={};f={};this._UndoRedo?(t.undoDirection=="left"&&(u.offsetX=t.object.offsetX-t.values,f.offsetX=t.object.offsetX),t.undoDirection=="right"&&(u.offsetX=t.object.offsetX+t.values,f.offsetX=t.object.offsetX),t.undoDirection=="up"&&(u.offsetY=t.object.offsetY-t.values,f.offsetY=t.object.offsetY),t.undoDirection=="down"&&(u.offsetY=t.object.offsetY+t.values,f.offsetY=t.object.offsetY),i={type:t.type,newValues:u,oldValues:f}):(t.redoDirection=="left"&&(u.offsetX=t.object.offsetX-t.values,f.offsetX=t.object.offsetX),t.redoDirection=="right"&&(u.offsetX=t.object.offsetX+t.values,f.offsetX=t.object.offsetX),t.redoDirection=="up"&&(u.offsetY=t.object.offsetY-t.values,f.offsetY=t.object.offsetY),t.redoDirection=="down"&&(u.offsetY=t.object.offsetY+t.values,f.offsetY=t.object.offsetY),i={type:t.type,newValues:u,oldValues:f});r.source.push(t.object);r.changes.push(i);break;case"spacingCommand":case"alignCommand":var u={},f={},c=[],l=[];for(o=0;o<t.values.length;o++)e=t.values[o],e.object.segments?(h=$.extend(!0,{},e.object),f={sourcePoint:h.sourcePoint,targetPoint:h.targetPoint},l.push(f),ej.datavisualization.Diagram.Util._translateLine(h,e.delta.x,e.delta.y),u={sourcePoint:h.sourcePoint,targetPoint:h.targetPoint},c.push(u)):(u={offsetX:e.object.offsetX-e.delta.x,offsetY:e.object.offsetY-e.delta.y},c.push(u),f={offsetX:e.object.offsetX,offsetY:e.object.offsetY},l.push(f));i={type:t.type,newValues:c,oldValues:l};r.source.push(t.object);r.changes.push(i);break;case"sizeCommand":var u={},f={},c=[],l=[];for(o=0;o<t.values.length;o++)e=t.values[o],u={width:e.values.width,height:e.values.height},c.push(u),f={width:e.object.width,height:e.object.height},l.push(f);i={type:t.type,newValues:c,oldValues:l};r.source.push(t.object);r.changes.push(i);break;case"zOrder":i={type:t.type,source:t.object,newValues:{zOrder:t.end},oldValues:{zOrder:t.object.zOrder}};r.source.push(t.object);r.changes.push(i)}return r},_getPseudoGroupElements:function(n,t){var e,r,u,i,s=this._UndoRedo?this.nameTable[t.undoObject.node.name]:t.redoObject.node,f,o;if(u={source:[],changes:[]},n&&n.type=="pseudoGroup")for(f=this._getChildren(n.children),r=0;r<f.length;r++)e=this.nameTable[f[r]],o=this._UndoRedo?t.undoObject.childTable[f[r]]:t.redoObject.childTable[f[r]],i=this._historyChangeEvent(o,e,t),i.source&&u.source.push(i.source),i.changes&&u.changes.push(i.changes);else i=this._UndoRedo?this._historyChangeEvent(n,s,t):this._historyChangeEvent(s,n,t),i.source&&u.source.push(i.source),i.changes&&u.changes.push(i.changes);return u},_propertyChangeEventValues:function(n){var f,e=[],i,r,u,t;i=n.elementType=="label"?n.label:n.elementType=="port"?n.port:n.object;r={};u={};for(t in n.values)i[t]!=n.values[t]&&(r[t]=i[t],u[t]=n.values[t]);return f={type:n.type,newValues:u,oldValues:r,deletedItems:[],addedItems:[]},e.push(f),{changes:e,source:i}},_historyChangeEvent:function(n,t,i){var r={type:i.type,deletedItems:[],addedItems:[],oldValues:{},newValues:{}};return n.offsetX!=t.offsetX&&(r.oldValues.offsetX=t.offsetX,r.newValues.offsetX=n.offsetX),n.offsetY!=t.offsetY&&(r.oldValues.offsetY=t.offsetY,r.newValues.offsetY=n.offsetY),n.width!=t.width&&(r.oldValues.width=t.width,r.newValues.width=n.width),n.height!=t.height&&(r.oldValues.height=t.height,r.newValues.height=n.height),n.rotateAngle!=t.rotateAngle&&(r.oldValues.rotateAngle=t.rotateAngle,r.newValues.rotateAngle=n.rotateAngle),n.sourcePoint!=t.sourcePoint&&(r.oldValues.sourcePoint=t.sourcePoint,r.newValues.sourcePoint=n.sourcePoint),n.targetPoint!=t.targetPoint&&(r.oldValues.targetPoint=t.targetPoint,r.newValues.targetPoint=n.targetPoint),{changes:r,source:t}},_undo:function(n){var f=[],t,s,e,i,h,c,l,a,r,v,u,o;if(this._UndoRedo=!0,n)if(n.category=="internal"){if(t=n.object||(n.undoObject?n.undoObject.node||n.undoObject:undefined)||n.shape,!t&&n.phase&&(t=n.phase),t&&n.undoObject&&n.undoObject.node&&(t=this.nameTable[t.name]||t),!t){this.undo();return}if(this.model.historyManager.undoStack.length>0&&(s=this.model.historyManager.undoStack.splice(0,1),this.model.historyManager.redoStack.splice(0,0,s[0])),f=this._ComparehistoryChangeEvent(t,n),f.cause=ej.datavisualization.Diagram.HistoryChangeCause.Undo,this._raiseEvent("historyChange",f),t&&t.parent&&(e=typeof t.parent=="object"?t.parent.name:t.parent),e&&!t.isLane&&!this.nameTable[e]){this._isUndo=!1;this.undo();return}switch(n.type){case"pagesettingschanged":h={isUndo:!0,undoObject:n.undoObject,redoObject:n.redoObject};this._recordPageSettingsChanged(h);break;case"positionchanged":n.swimlaneMultiSelection?(n.undo=!0,this._recordMultiPinPointChanged(n)):(i={object:n.undoObject,isMultipleNode:n.isMultipleNode},this._recordPinPointChanged(i));break;case"rotationchanged":n.swimlaneMultiSelection?(n.undo=!0,this._recordMultiRotationChanged(n)):(i={object:n.undoObject,isMultipleNode:n.isMultipleNode},this._recordRotationChanged(i));break;case"sizechanged":n.undo=!0;n.swimlaneMultiSelection?this._recordMultiSizeChanged(n):(i={object:n.undoObject,isMultipleNode:n.isMultipleNode},this._recordSizeChanged(i,n));break;case"endpointchanged":i={undoObject:n.undoObject,redoObject:n.redoObject,isMultipleNode:n.isMultipleNode,_isUndo:!0};this._recordEndPointChanged(i);break;case"collectionchanged":if(n.changeType=="insert"&&!this.nameTable[n.object.name]){if(this._groupUndo)return;this._isUndo=!1;this.undo()}i={changeType:n.changeType,childTable:n.childTable,edgeTable:n.edgeTable,isUndo:!0,sourcePorts:n.sourcePorts,targetPorts:n.targetPorts,index:n.index};i.object=jQuery.extend(!0,{},n.object);c=this._recordCollectionChanged(i,n);c&&(n.sourcePorts=i.sourcePorts,n.targetPorts=i.targetPorts,n.edgeTable=i.edgeTable,n.childTable=i.childTable);break;case"labelchanged":i={object:n.shape,label:n.previousLabelValue,index:n.index?n.index:0};this._recordLabelChanged(i);break;case"labelcollectionchanged":n.isUndo=!0;this.labelcollectionchanged(n);break;case"groupchanged":i={object:n.object,isUndo:!0,actionType:n.actionType};this._recordGroupChanged(i);break;case"phasepositionchanged":n.undo=!0;this._recordPhasesizeChanged(n);break;case"phasecollectionchanged":n=$.extend(!0,{},{phase:n.phase,group:n.group,isAdded:n.isAdded,phaseObject:n.phaseObject,islastPhase:n.islastPhase});n.undo=!0;this._recordPhaseCollectionChanged(n);break;case"propertiesChanged":r=this.nameTable[n.object.name];r&&(l=this._getModifiedProperties(r,n.values,n[n.elementType]),n.elementType=="node"?this.updateNode(r.name,n.values):n.elementType=="connector"?this.updateConnector(r.name,n.values):n.elementType=="label"?n.label=this.updateLabel(r.name,n.label,n.values):n.elementType=="port"&&this.updatePort(r.name,n.port,n.values),n.values=l);break;case"portscollectionchanged":n.isUndo=!0;this._recordPortsCollectionChanged(n);break;case"nudge":this._recordNudgingChanges(t,n);break;case"spacingCommand":case"alignCommand":this._recordAlignCommandChanges(n);break;case"sizeCommand":this._recordSizeCommandChanges(n);break;case"swapLane":n=jQuery.extend(!0,{},{undoObject:n.undoObject,redoObject:n.redoObject,moveIndex:n.moveIndex,insertIndex:n.currentIndex});n.undo=!0;ej.datavisualization.Diagram.canvasHelper._undoSwap(this,n);break;case"zOrder":a=n.start;r=this.nameTable[n.object.name];this._comparePropertyValues(r,"zOrder",{zOrder:n.end});n.command=="back"?(this._bringElementsToFront(n.start,n.end,n.object,n.nearestNode),n.command="front"):(this._sendElementsToBack(n.start,n.end,n.object,n.nearestNode),n.command="back");n.nearestNode=this._findObjectByIndex(a);v=n.start;n.start=n.end;n.end=v}this.selectionList.length&&t&&this.selectionList[0].name!=t.name&&(this._clearSelection(!0),this._addSelection(this.nameTable[t.name],!0))}else this.model.historyManager.undo&&(u=this.model.historyManager.undo,typeof u=="string"&&(u=ej.util.getObject(u,window)),$.isFunction(u)&&(o=u(n.data),o&&(n.data=o)))},_redo:function(n){var f=[],t,s,e,h,i,c,l,r,a,u,o;if(this._UndoRedo=!1,n)if(n.category=="internal"){if(t=n.object||(n.undoObject?n.undoObject.node||n.undoObject:undefined)||n.shape,!t&&n.phase&&(t=n.phase),t&&n.undoObject&&n.undoObject.node&&(t=this.nameTable[t.name]||t),!t){this.redo();return}if(this.model.historyManager.redoStack.length>0&&(s=this.model.historyManager.redoStack.splice(0,1),this.model.historyManager.undoStack.splice(0,0,s[0])),f=this._ComparehistoryChangeEvent(t,n),f.cause=ej.datavisualization.Diagram.HistoryChangeCause.Redo,this._raiseEvent("historyChange",f),t&&t.parent&&(e=typeof t.parent=="object"?t.parent.name:t.parent),e&&!this.nameTable[e]){this._isUndo=!1;this.redo();return}switch(n.type){case"pagesettingschanged":h={isUndo:!1,undoObject:n.undoObject,redoObject:n.redoObject};this._recordPageSettingsChanged(h);break;case"positionchanged":n.swimlaneMultiSelection?(n.undo=!1,this._recordMultiPinPointChanged(n)):(i={object:n.redoObject,isMultipleNode:n.isMultipleNode},this._recordPinPointChanged(i));break;case"rotationchanged":n.swimlaneMultiSelection?(n.undo=!1,this._recordMultiRotationChanged(n)):(i={object:n.redoObject,isMultipleNode:n.isMultipleNode},this._recordRotationChanged(i));break;case"sizechanged":n.undo=!1;n.swimlaneMultiSelection?this._recordMultiSizeChanged(n):(i={object:n.redoObject,isMultipleNode:n.isMultipleNode},this._recordSizeChanged(i));break;case"endpointchanged":i={undoObject:n.undoObject,redoObject:n.redoObject,isMultipleNode:n.isMultipleNode,_isUndo:!1};this._recordEndPointChanged(i);break;case"collectionchanged":i={changeType:n.changeType,childTable:n.childTable,edgeTable:n.edgeTable,isUndo:!1,sourcePorts:n.sourcePorts,targetPorts:n.targetPorts,index:n.index};i.object=jQuery.extend(!0,{},n.object);this._recordCollectionChanged(i,n.object);break;case"labelchanged":i={object:n.shape,label:n.updatedLabelValue,index:n.index?n.index:0};this._recordLabelChanged(i);break;case"labelcollectionchanged":n.isUndo=!1;this.labelcollectionchanged(n);break;case"groupchanged":i={object:n.object,actionType:n.actionType,isUndo:!1};this._recordGroupChanged(i);break;case"phasepositionchanged":n.undo=!1;this._recordPhasesizeChanged(n);break;case"phasecollectionchanged":n=$.extend(!0,{},{phase:n.phase,group:n.group,phaseObject:n.phaseObject,islastPhase:n.islastPhase,isAdded:n.isAdded});n.undo=!1;this._recordPhaseCollectionChanged(n);break;case"propertiesChanged":r=this.nameTable[n.object.name];r&&(c=this._getModifiedProperties(r,n.values,n[n.elementType]),n.elementType=="node"?this.updateNode(r.name,n.values):n.elementType=="connector"?this.updateConnector(r.name,n.values):n.elementType=="label"?n.label=this.updateLabel(r.name,n.label,n.values):n.elementType=="port"&&this.updatePort(r.name,n.port,n.values),n.values=c);break;case"portscollectionchanged":n.isUndo=!1;this._recordPortsCollectionChanged(n);break;case"nudge":this._recordNudgingChanges(t,n,!0);break;case"spacingCommand":case"alignCommand":this._recordAlignCommandChanges(n);break;case"sizeCommand":this._recordSizeCommandChanges(n);break;case"swapLane":n=jQuery.extend(!0,{},{undoObject:n.undoObject,redoObject:n.redoObject,moveIndex:n.moveIndex,insertIndex:n.currentIndex});n.undo=!1;ej.datavisualization.Diagram.canvasHelper._undoSwap(this,n);break;case"zOrder":l=n.start;r=this.nameTable[n.object.name];this._comparePropertyValues(r,"zOrder",{zOrder:n.end});n.command=="back"?(this._bringElementsToFront(n.start,n.end,n.object,n.nearestNode),n.command="front"):(this._sendElementsToBack(n.start,n.end,n.object,n.nearestNode),n.command="back");n.nearestNode=this._findObjectByIndex(l);a=n.start;n.start=n.end;n.end=a}this.selectionList.length&&t&&this.selectionList[0].name!=t.name&&(this._clearSelection(!0),this._addSelection(this.nameTable[t.name],!0))}else this.model.historyManager.redo&&(u=this.model.historyManager.redo,typeof u=="string"&&(u=ej.util.getObject(u,window)),$.isFunction(u)&&(o=u(n.data),o&&(n.data=o)))},_startGroupAction:function(){this.addHistoryEntry({type:"startGroup",category:"internal"})},_closeGroupAction:function(){this.addHistoryEntry({type:"closeGroup",category:"internal"})},addHistoryEntry:function(n){var i,r,t,e,f,u;if(!this.model.historyManager.suspend){if(this.model.historyManager.canLog&&(i=this.model.historyManager.canLog,typeof i=="string"&&(i=ej.util.getObject(i,window)),$.isFunction(i)&&(f=n.object||n.undoObject&&n.undoObject.node||n.shape,r=this._ComparehistoryChangeEvent(f,n),u={changes:r.changes.length?r.changes[0]:null,source:r.source.length?r.source[0]:null},i(u)==!1)))return;n.category!="internal"&&(n={data:n});this._historyList.canUndo&&this._historyList.currentEntry&&(this._historyList.currentEntry.data||this._historyList.currentEntry.category=="internal")&&(t=this._historyList.currentEntry,t.next?t.previous&&(e=t.next,e.previous=null,t.next=n,n.previous=t):(t.next=n,n.previous=t));this._historyList.currentEntry=n;this.model.historyManager.stackLimit&&(this._historyList.currentEntry&&this._historyList.currentEntry.previous&&!this._lastbefore?this._lastbefore=n:this._historyList.currentEntry.previous||(this._lastbefore=null,this._historyCount=0),this._historyCount<this.model.historyManager.stackLimit?this._historyCount++:this._lastbefore&&(this._lastbefore.previous&&delete this._lastbefore.previous,this._lastbefore.next&&(this._lastbefore=this._lastbefore.next)));f=n.object||(n.redoObject?n.redoObject.node||n.redoObject:undefined)||n.shape;u=this._ComparehistoryChangeEvent(f,n);u.cause=ej.datavisualization.Diagram.HistoryChangeCause.CustomAction;this._getHistoryList();this._raiseEvent("historyChange",u);this._historyList.canUndo=!0;this._historyList.canRedo=!1}},removeHistoryEntry:function(n){var r,t,i,u,f;if(this._historyList.currentEntry!=null){if(r=this._historyList.currentEntry,r)if(r==n)t=r.previous,i=r.next,this._historyList.currentEntry=i||t;else{for(u=r.next;u;)if(u==n){t=u.previous;i=u.next;break}else u=u.next;for(f=r.previous;f;)if(f==n){t=f.previous;i=f.next;break}else f=f.previous}t&&i?(t.next=i,i.previous=t):t?t.next=null:i&&(i.previous=null)}},canRemoveHistoryEntry:function(n){return n.category!="internal"},clearHistory:function(){var n=this._historyList;n.currentEntry=null;n.canUndo=!1;n.canRedo=!1;this.model.historyManager.undoStack=[];this.model.historyManager.redoStack=[]},_getHistroyObject:function(n,t){t&&n.push({redoObject:t.redoObject?t.redoObject:null,undoObject:t.undoObject?t.undoObject:null,type:t.type?t.type:null,isMultipleNode:t.isMultipleNode?t.isMultipleNode:null,category:t.category?t.category:""})},_getHistoryList:function(){var t=[],i=[],n=this._historyList.currentEntry,r,u;for(n=this._historyList.currentEntry,this._historyList.canUndo||this.model.historyManager.undoStack.length===0?this._getHistroyObject(t,n):this._getHistroyObject(i,n);n&&n.previous;)r=n.previous,this._getHistroyObject(t,r),n=n.previous;for(n=this._historyList.currentEntry;n&&n.next;)u=n.next,this._getHistroyObject(i,u),n=n.next;this.model.historyManager.undoStack=t;this.model.historyManager.redoStack=i},getUndoEntry:function(){var i=null,t,n=this._historyList;return n.canUndo&&(i=n.currentEntry,t=n.currentEntry.previous,t?(n.currentEntry=t,n.canRedo||(n.canRedo=!0)):(n.canRedo=!0,n.canUndo=!1)),i},getRedoEntry:function(){var i=null,t,n=this._historyList;return n.canRedo&&(t=n.currentEntry.previous||n.canUndo?n.currentEntry.next:n.currentEntry,t&&(n.currentEntry=t,n.canUndo||(n.canUndo=!0),t.next||(n.canRedo=!1,n.canUndo=!0)),i=n.currentEntry),i},cut:function(){(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(this._pasteIndex=0,this._setClipboard(),this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.ClipBoard,this._multipleAction=!0,this._delete(),delete this._multipleAction)},insertLabel:function(n,t,i){var r,u,f,e;ej.datavisualization.Diagram.Util.isPageEditable(this)&&(r=this.nameTable[n],r&&t&&(u=this.getObjectType(r)=="node"?this.model.defaultSettings.node:this.model.defaultSettings.connector,u&&u.labels&&r.labels&&u.labels[i!==undefined?i:r.labels.length]&&(t=$.extend(!0,{},u.labels[i!==undefined?i:r.labels.length],t)),t=ej.datavisualization.Diagram.Label(t),f=u.labels,f.splice(),r.labels.push(t),e={element:r,index:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"labels",oldValue:f,newValue:r.labels},this._raisePropertyChange(e),ej.datavisualization.Diagram.DiagramContext.addLabel(r,t,this,i),this.addHistoryEntry({type:"labelcollectionchanged",shape:r,label:t,isUndo:!0,category:"internal",index:i})))},addLabel:function(n,t){var i,u,r,f;ej.datavisualization.Diagram.Util.isPageEditable(this)&&(i=this.nameTable[n],i&&t&&(r=this.getObjectType(i)=="node"?this.model.defaultSettings.node:this.model.defaultSettings.connector,r&&r.labels&&i.labels&&r.labels[i.labels.length]&&(t=$.extend(!0,{},r.labels[i.labels.length],t)),t=ej.datavisualization.Diagram.Label(t),u=i.labels,i.labels.push(t),f={element:i,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"labels",oldValue:u,newValue:i.labels},this._raisePropertyChange(f),ej.datavisualization.Diagram.DiagramContext.addLabel(i,t,this),this.addHistoryEntry({type:"labelcollectionchanged",shape:i,label:t,isUndo:!0,category:"internal"})))},addPorts:function(n,t){var r,i;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(r=this.nameTable[n],r&&t)){for(i=0;i<t.length;i++)t[i]=ej.datavisualization.Diagram.Port(t[i]),r.ports.push(t[i]),this._raisePropertyChange({element:r,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"ports",oldValue:null,newValue:t[i]}),ej.datavisualization.Diagram.DiagramContext.renderPort(r,t[i],this);this.addHistoryEntry({type:"portscollectionchanged",object:r,collection:t,changeType:"insert",isUndo:!0,category:"internal"})}},updatePort:function(n,t,i){var u,r;if(n&&(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(u=this._findNode(n),i&&t&&(!i.name||t.name==i.name)&&u)){t=this._findPort(u,t.name);this._isUndo||this._recordPropertiesChanged(u,i,"port",t);i.name=t.name;this._comparePropertyValues(u,"ports",i);for(r in i)t.hasOwnProperty(r)&&(t[r]=typeof i[r]=="object"?$.extend(!0,{},t[r],i[r]):i[r]);ej.datavisualization.Diagram.DiagramContext.updatePort(u,t,this)}},copy:function(){return(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(this._pasteIndex=1,this.selectionList&&this.selectionList.length>0&&this._setClipboard()),this._cloneSelectionList()},paste:function(n,t){(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.ClipBoard,this._paste(n,t!==undefined?t:!0))},_commandPaste:function(){this.paste()},_getNodesfrombounds:function(n,t){for(var e=!1,c,i,s=[],l=this.nodes(),r,h,f,u=0,o=l.length;u<o;u++)r=this.nameTable[l[u].name],t&&(e=t.name===r.name?!0:!1),r&&r.visible&&!e&&(i=ej.datavisualization.Diagram.Util.bounds(r),i=ej.datavisualization.Diagram.Geometry.rect([i.topLeft,i.topRight,i.bottomRight,i.bottomLeft]),ej.datavisualization.Diagram.Util.canSelect(r)&&(c=this.getObjectType(r),ej.datavisualization.Diagram.Geometry.containsRect(n,i)?r.parent===""&&s.push(r):c==="group"&&this.activeTool&&this.activeTool.inAction&&this.activeTool._checkGroupChildren(s,r,n)));for(h=this.connectors(),u=0,o=h.length;u<o;u++)f=this.nameTable[h[u].name],t&&(e=t.name===f.name?!0:!1),f&&f.visible&&!e&&(i=ej.datavisualization.Diagram.Util.bounds(f),i=ej.datavisualization.Diagram.Geometry.rect([i.topLeft,i.topRight,i.bottomRight,i.bottomLeft]),ej.datavisualization.Diagram.Util.canSelect(f)&&ej.datavisualization.Diagram.Geometry.containsRect(n,i)&&f.parent===""&&s.push(f));return s},_setClipboard:function(){var l,r,u,t,o,s;if(this.selectionList.length>0){var i,n=this.selectionList[0],f={},h=[],e,c;if(n._type==="group"||n.type==="pseudoGroup"){for(t=this._getChildren(n.children),r=0;r<t.length;r++)for(u=r+1;u<t.length;u++)o=this.nameTable[t[r]],s=this.nameTable[t[u]],s&&o&&s.zOrder<o.zOrder&&(l=t[r],t[r]=t[u],t[u]=l);f=this._getChildTable(n,f)}f[n.name]=n;e=ej.datavisualization.Diagram.Util.bounds(n);c={x:e.x,y:e.y,width:e.width,height:e.height};h=this._getNodesfrombounds(c,n);i=$.extend(!0,{},{childTable:f,node:n,collection:h});i.node.segments&&(i.node.targetNode=null,i.node.targetPort=null,i.node.sourceNode=null,i.node.sourcePort=null);i.addInfo=this._updateClipBoardConnectors(n,f);this._clipboardData=i}},_updateClipBoardConnectors:function(n,t){var i,u=[],r;if(n&&n.type==="pseudoGroup"&&n.children.length>0)for(r=0;r<n.children.length;r++)i=this.nameTable[this._getChild(n.children[r])],i&&i.isSwimlane&&this._updateSwimlaneGroupConnectors(n,i,t,u);else this._updateSwimlaneGroupConnectors(null,n,t,u);return u},_updateEdgesToClipboard:function(n,t,i,r,u,f){var e,o,s,h;i.parent&&n&&(e=this.nameTable[n.sourceNode],o=this.nameTable[n.targetNode],e&&o&&(s=this.nameTable[e.parent],h=this.nameTable[o.parent],s&&s.isLane&&h&&h.isLane&&(!this._collectionContains(n.name,f?i.outEdges:i.inEdges)||this._collectionContains(n.name,u)||this._collectionContains(n.name,t?t:[])||u.push(this.nameTable[this._getChild(n)]))))},_updateSwimlaneConnectors:function(n,t,i,r){if(t){for(var f,u=0;u<t.inEdges.length>0;u++)f=this.nameTable[this._getChild(t.inEdges[u])],this._updateEdgesToClipboard(f,n,t,i,r);for(u=0;u<t.outEdges.length>0;u++)f=this.nameTable[this._getChild(t.outEdges[u])],this._updateEdgesToClipboard(f,n,t,i,r,!0)}},_updateSwimlaneGroupConnectors:function(n,t,i,r){for(var u,f,h,e=ej.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(this,t),o,s=0;e&&s<e.length;s++)if(u=this.nameTable[this._getChild(e[s])],u&&u.children&&u.children.length>0)for(o=u.children,f=0;f<o.length;f++)h=this.nameTable[this._getChild(o[f])],h&&this._updateSwimlaneConnectors(n&&n.children?n.children:null,h,i,r)},_getChildTable:function(n,t){var u,f,o,e,i,s,h,r;if(f=this._getChildren(n.children),f)for(e=0;e<f.length;e++)if(o=f[e],u=this.nameTable[o],u&&(u.parent===n.name||n.type=="pseudoGroup")){if(i=t[u.name]=$.extend(!0,{},u),(i._type==="group"||i.type==="pseudoGroup")&&(t=this._getChildTable(i,t)),i.inEdges&&i.inEdges.length>0)for(s in i.inEdges)r=this.nameTable[i.inEdges[s]],r&&(t[r.name]&&delete t[r.name],t[r.name]=r);if(i.outEdges&&i.outEdges.length>0)for(h in i.outEdges)r=this.nameTable[i.outEdges[h]],r&&(t[r.name]&&delete t[r.name],t[r.name]=r)}return t},_paste:function(n,t){var f,o,i,w,s,h,r,a,b,k,d,y,nt,tt,l,v,p,it,e,rt,g,u;if(n){var h="",c=[],s=ej.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup"});for(t&&(h=ej.datavisualization.Diagram.Util.randomId()),u=0;u<n.length;u++)n[u].name+=h,n[u].outEdges&&(n[u].outEdges=[]),n[u].inEdges&&(n[u].inEdges=[]),n.length>1&&s.children.push(n[u].name),n[u].type!="connector"?(n[u].type!=="group"&&n[u].type!=="bpmn"||n[u].isSwimlane||(this._clonePasteGroup(n[u],h,n),this.add($.extend({},n[u]))),n[u].isSwimlane?(this._clonePasteSwimlaneObj(n[u],h,n),g=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n[u],f),this._outOfBoundsOnNudge(g,diagram._pasteIndex*10,this._pasteIndex*10)&&this.add(g)):this.add($.extend({},n[u]))):c.push(n[u]);for(u=0;u<c.length;u++)c[u].sourceNode&&this.nameTable[c[u].sourceNode+h]?c[u].sourceNode+=h:(c[u].sourceNode="",c[u].sourcePort=""),c[u].targetNode&&this.nameTable[c[u].targetNode+h]?c[u].targetNode+=h:(c[u].targetNode="",c[u].targetPort=""),n.length>1&&s.children.push(c[u].name),this.add($.extend({},c[u]));n.length>1&&(this.nodes().push(s),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[s.name]=s,this._clearSelection(!0),ej.datavisualization.Diagram.Util._updateGroupBounds(s,this),this.addSelection(s,!0))}else if(this._clipboardData&&(f=this._clipboardData,f=$.extend(!0,{},this._clipboardData),i=f.node,i.zOrder=-1,this.tools.move._outOfBoundsDrag(i,this._pasteIndex*10,this._pasteIndex*10)&&i&&i.type!="phase")){if(i.container)i.isSwimlane?(i=this._pasteSwimlaneObj(i,f),f.childTable=this._getChildTable(i,f.childTable)):(i.isLane?(i=this._cloneLaneObj(i,ej.datavisualization.Diagram.Util.randomId(),f.childTable),i.orientation==="vertical"&&(i.height=i.height),p=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(i,this,this._clipboardData,!0),p&&(this._pasteObj=!0,this.add(p),this._pasteObj=!1),i=p):!i.container||i.isLane||i.isSwimlane||(i=this._cloneContainer(i,ej.datavisualization.Diagram.Util.randomId(),f.childTable),this._preserveConnection(f.childTable,i),this.add(i),i=this.nameTable[i.name]),o=this._pasteIndex*10,this._translate(i,o,o,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(i,this)),this._selectionContains(i)&&(this._clearSelection(!0),this._addSelection(i));else if(i.type=="pseudoGroup"){for(w=i.children,s=ej.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),this._isUndo=!0,this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.ClipBoard,this._multipleAction=!0,u=0;u<w.length;u++)h=w[u],r=f.childTable[h],r.zOrder=-1,r._annotation&&delete r._annotation,r&&(r.isSwimlane||r.type==="swimlane")?(this._isUndo=!1,r=this._pasteSwimlaneObj(r,f),r&&s.children.push(r.name),this._isUndo=!0):r&&r.isLane?(a=this._pasteSwimlane(r,f,!0,this._pasteIndex*10),a&&s.children.push(a.name),o=this._pasteIndex*10,this._translate(a,o,o,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(a,this)):r&&(h=h+ej.datavisualization.Diagram.Util.randomId(),delete f.childTable[r.name],r.name=h,r.parent="",f.childTable[r.name]=r,this._preserveConnection(f.childTable,r),b=!0,r.segments&&(k=!0,d=!0,f.childTable[r._oldSourceNode]&&!this.nameTable[r.sourceNode]&&(k=!1,r.sourceNode=null),f.childTable[r._oldTargetNode]&&!this.nameTable[r.targetNode]&&(d=!1,r.targetNode=null),k||d||(b=!1)),b&&(s.children.push(h),r._type==="group"&&r.type!="bpmn"?this._pasteChildren(f.childTable,r):r.children=[],o=this._pasteIndex*10,this._translate(r,o,o,this.nameTable),!r.segments||r.segments.length!=1||r.segments[0].type!="orthogonal"||r.sourceNode||r.targetNode||(l=r.segments[0].points),v=!1,v=this.add(r),l&&v&&(r=this.nameTable[r.name],r.segments[0].points=l,ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom))));delete this._multipleAction;this._clearSelection();s&&s.children.length>0&&(this.nodes().push(s),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[s.name]=s,ej.datavisualization.Diagram.Util._updateGroupBounds(s,this),this._addSelection(s),y={},y=this._getChildTable(this.selectionList[0],y),nt={type:"collectionchanged",object:this._updatePsedoGroupChildren(this.selectionList[0]),childTable:jQuery.extend(!0,{},y),changeType:"insert",category:"internal"},this.addHistoryEntry(nt),this._isUndo=!1)}else i.type=="bpmn"?(tt=ej.datavisualization.Diagram.Util.randomId(),i.parent="",i.name=i.name+tt,i.inEdges=[],i.outEdges=[],i.children=[],i._annotation&&delete i._annotation,o=this._pasteIndex*10,this._translate(i,o,o,this.nameTable),this.add(i)):(i.name=i.name+ej.datavisualization.Diagram.Util.randomId(),i.parent="",i._type==="group"?this._pasteChildren(f.childTable,i):i.segments||i.segments||(i.inEdges=[],i.outEdges=[]),o=this._pasteIndex*10,this._translate(i,o,o,this.nameTable),!i.segments||i.segments.length!=1||i.segments[0].type!="orthogonal"||i.sourceNode||i.targetNode||(l=i.segments[0].points),v=this.add(i),v&&l&&(i=this.nameTable[i.name],i.segments[0].points=l,ej.datavisualization.Diagram.DiagramContext.update(i,this),ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom)),this._updateSelectionHandle());if(f.addInfo.length){for(it in f.addInfo)e=f.addInfo[it],e.isSwimlane?(f.childTable[e.name]=e,f.childTable=this._getChildTable(e,f.childTable),e=this._pasteSwimlaneObj(e,f),f.childTable[e.name]=e,f.childTable=this._getChildTable(e,f.childTable)):(f.childTable[e.name]&&e!==f.childTable[e.name]&&(e=$.extend(!0,{},f.childTable[e.name])),rt=e.name+ej.datavisualization.Diagram.Util.randomId(),e.name=rt,e.parent="",f.childTable[e.name]=e,this._preserveConnection(f.childTable,e),o=this._pasteIndex*10,this._translate(e,o,o,this.nameTable),this.add(e),this._selectionContains(e)&&this._clearSelection(!0));this._selectionContains(i)||this._addSelection(i)}this._pasteIndex++}},_cloneContainer:function(n,t,i){var u,f,r;for(n.name=n.name+t,u=0;u<n.children.length;u++)f=i?i:this.nameTable,r=f[this._getChild(n.children[u])],r.name+=t,r.parent=n.name,r.children&&r.children.length>0&&(r=this._cloneContainer(r,t,i)),n.children[u]=r;return ej.datavisualization.Diagram.bpmnHelper.updateProcessCollection(n,this),n},_clonePasteGroup:function(n,t,i){for(var f,u,r=0;r<n.children.length;r++)if(n.children[r].name+=t,n.children[r].parent=n.name,n.children[r].segments)n.children[r].sourceNode&&(n.children[r].sourceNode+=t),n.children[r].targetNode&&(n.children[r].targetNode+=t);else{for(u=0;u<n.children[r].inEdges.length;u++)f=n.children[r].inEdges[u],this._collectionContains(f,n.children)||i&&this._collectionContains(f,i)?f+=t:n.children[r].inEdges.splice(u,1);for(u=0;u<n.children[r].outEdges.length;u++)f=n.children[r].outEdges[u],this._collectionContains(f,n.children)||i&&this._collectionContains(f,i)?f+=t:n.children[r].outEdges.splice(u,1)}},_clonePasteSwimlaneObj:function(n,t,i){var s,h,e,u,f,c,r,o;if(n.lanes&&n.lanes.length>0)for(r=0;r<n.lanes.length;r++)if(n.lanes[r]&&(n.lanes[r].name+=t,n.lanes[r].children&&n.lanes[r].children.length>0)){for(s=n.lanes[r].children,h=[],e=0;e<s.length;e++){for(u=jQuery.extend(!0,{},s[e]),u.name+=t,u.parent=n.lanes[r].name,f=0;f<u.inEdges.length;f++)this._collectionContains(u.inEdges[f],i)?(u.inEdges[f]+=t,n.lanes[r].children[e]=u):u.inEdges.splice(f,1);for(f=0;f<u.outEdges.length;f++)this._collectionContains(u.outEdges[f],i)?(u.outEdges[f]+=t,n.lanes[r].children[e]=u):u.outEdges.splice(f,1);h.push(u)}n.lanes[r].children=h}if(n.phases&&n.phases.length>0){for(c=[],r=0;r<n.phases.length;r++)n.phases[r]&&(o=jQuery.extend(!0,{},n.phases[r]),o.name+=t,o.parent="",c.push(o));n.phases=c}},_cloneLaneObj:function(n,t,i){var n=ej.datavisualization.Diagram.SwimLaneContainerHelper._cloneLaneObj(this,n,t,i);return n},_cloneSwimlaneObj:function(n,t,i){n=$.extend(!0,{},n);var n=ej.datavisualization.Diagram.SwimLaneContainerHelper._cloneSwimlaneObj(this,n,t,i);return n},_pasteSwimlaneObj:function(n,t){return ej.datavisualization.Diagram.SwimLaneContainerHelper._pasteSwimlaneObj(this,n,t)},_pasteSwimlane:function(n,t,i,r){if(n&&n.isSwimlane)return ej.datavisualization.Diagram.SwimLaneContainerHelper._pasteSwimlane(this,n,t,i,r)},_cloneNode:function(n,t,i,r){var f=!1,e=null,n,u;if(n){if(n=typeof n=="string"?n:n.name,n=jQuery.extend(!0,{},t.childTable[n]),n.isPhaseStack&&(n.name=n.name.split("phaseStack")[0]+i+"phaseStack",f=!0,e=n.name),n.children&&n.children.length>0)for(u in n.children)this._cloneNode(n.children[u],t,i,e),n.children[u]&&(typeof n.children[u]=="string"?n.children[u]+=i:n.children[u].name+=i);r?n.parent=typeof r=="string"?r:r.name:n.parent!=""&&(n.parent+=i);f||(n.name+=i);this._preserveConnection(t.childTable,n);this.nameTable[n.name]=n}},_cloneSwimlane:function(n,t,i){var f=n.name,u,r;if(n.name+=i,n.children&&n.children.length>0)for(r in n.children)this._cloneNode(n.children[r],t,i,n),typeof n.children[r]=="string"?n.children[r]+=i:n.children[r]=n.children[r].isPhaseStack?f+i+"phaseStack":n.children[r].name+i;if(n.phases&&n.phases.length>0)for(r in n.phases)u=jQuery.extend(!0,{},this.nameTable[n.phases[r]]),u.name+=i,u.parent+=i,this.nameTable[u.name]=u,n.phases[r]=u.name;this.nameTable[n.name]=n},_pasteChild:function(n,t,i,r){var u=n.name+ej.datavisualization.Diagram.Util.randomId();delete t[n.name];n.name=u;t[n.name]=n;this._preserveConnection(t,n);n.parent=i.name;r.push(u);n._type==="group"&&this._pasteChildren(t,n);this.add(n)},_pasteChildren:function(n,t){for(var i,f,e=[],u=t.children,r=0;r<u.length;r++)f=this._getChild(u[r]),i=n[f],i.zOrder=-1,i&&this._pasteChild(i,n,t,e);t.children=e;this._preserveConnection(n,t)},_preserveConnections:function(n,t){for(var i,u=this._getChildren(t.children),r=0;r<u.length;r++)i=n[u[r]],i&&(this._preserveConnection(n,i),i._type==="group"&&this._preserveConnections(n,t))},_preserveConnection:function(n,t){var r,i,f,u;if(t.segments)t.targetNode&&(u=n[t.targetNode],u&&u.inEdges.push(t.name)),t.sourceNode&&(u=n[t.sourceNode],u&&u.outEdges.push(t.name));else{if(f=t.inEdges.length,f>0){for(r=0;r<f;r++)i=n[t.inEdges[r]],i&&(i._oldTargetNode=i.targetNode,i.targetNode=t.name);t.inEdges=[]}if(f=t.outEdges.length,f>0){for(r=0;r<t.outEdges.length;r++)i=n[t.outEdges[r]],i&&(i._oldSourceNode=i.sourceNode,i.sourceNode=t.name);t.outEdges=[]}}},_expandChildren:function(n){for(var i,t,r=0;r<n.outEdges.length;r++)i=this.nameTable[n.outEdges[r]],t=this.nameTable[i.targetNode],t.excludeFromLayout||(i.visible=!0,ej.datavisualization.Diagram.DiagramContext.update(i,this),this._updateQuad(i),t.isExpanded&&this._expandChildren(t),t.visible=!0,ej.datavisualization.Diagram.DiagramContext.update(t,this),this._updateQuad(t))},_collapseChildren:function(n){for(var i,t,r=0;r<n.outEdges.length;r++)i=this.nameTable[n.outEdges[r]],t=this.nameTable[i.targetNode],t.excludeFromLayout||(i.visible=!1,ej.datavisualization.Diagram.DiagramContext.update(i,this),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[i.name],i),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,i),t.isExpanded&&this._collapseChildren(t),t.visible=!1,ej.datavisualization.Diagram.DiagramContext.update(t,this),ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t.name],t),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,t))},zoomTo:function(n){n||(n=new ej.datavisualization.Diagram.Zoom);n.zoomCommand&ej.datavisualization.Diagram.ZoomCommand.ZoomIn?ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1+n.zoomFactor,0,0,n.focusPoint,!0):ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1/(1+n.zoomFactor),0,0,n.focusPoint,!0)},remove:function(n){n&&this.nameTable[n.name]&&(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))?this._delete(n):this._delete()},clear:function(){if(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this)){this._clearSelection();var n=this;this._views.forEach(function(t){var i=n._views[t];$(i.diagramLayer).empty();$(n._expander).empty();$(i.svg.document.parentNode.getElementsByClassName("htmlLayer")[0]).empty()});this.nodes([]);this.connectors([]);this._nodes=[];this._connectors=[];this.nameTable={};this.selectionList=[];this.clearHistory();this._spatialSearch=ej.datavisualization.Diagram.SpatialSearch();this._updateScrollOffset(0,0)}},_updateChildOnGroup:function(n){var i=null,t;return n&&n.parent&&(i=this._svg.document.getElementById(n.parent),t=this.nameTable[n.parent],t&&(t.container?ej.datavisualization.Diagram.ContainerHelper._add(this,n):(t.children.push(n.name),n._type=="group"&&this._initGroupNode(n),ej.datavisualization.Diagram.Util._refreshParentGroup(n,this)))),i},_raiseChildrenPropertyChange:function(n,t){var i,r,s;if(n&&n.parent){var r=this._findNode(n.parent),e,o,u=[],f=[];r&&(r.isLaneStack?(i=this._getNode(r.parent),f=i.lanes,f=f.slice(),t?i.lanes.push(n):i.lanes.splice(u.indexOf(this.getNode(n.name)),1),u=i.lanes,e=i,o="lanes"):r.isPhaseStack?(i=this._getNode(r.parent),f=i.phases,f=f.slice(),t?i.phases.push(n):i.phases.splice(u.indexOf(this.getNode(n.name)),1),u=i.phases,e=i,o="phases"):(r=this._getNode(n.parent),f=r.children.slice(),u=r.children.slice(),t?u.push(n.name):u.splice(u.indexOf(n.name),1),e=r,o="children"),s={element:e,cause:this._isDragg||this.activeTool.inAction?ej.datavisualization.Diagram.ActionType.Mouse:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:o,oldValue:f,newValue:u},this._raisePropertyChange(s))}},addLane:function(n,t){var i,r;n.isLane&&(n=this._dynamicLane(n,this),t||n.parent?(i=this._updateDynamicLane(this,n,t),i&&i.isSwimlane?(r=this.nameTable[this._getChild(i.children[2])],n=ej.datavisualization.Diagram.canvasHelper._updateDropLaneProperties(this,n,i),t||t===0?r.children.splice(t,0,n.name):r.children.push(n.name),n.parent=r.name,this._swimlaneObject=!0):n=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(n,this),this.add(n),r&&i&&(ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,r),ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,i),this._clearSelection(!0),this._addSelection(i)),delete this._swimlaneObject):(n=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(n,this),this.add(n)))},_dynamicLane:function(n,t){var i=ej.datavisualization.Diagram.SwimLaneHelper._createPaletteLane(n,t.nameTable),r=i.orientation;return i=ej.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(i,t.nameTable),i.minHeight=n.height,i.minWidth=n.width,i.parent=n.parent,i.orientation=r,n.orientation&&(i.orientation=n.orientation),i.isLane&&(i=ej.datavisualization.Diagram.ContainerHelper._initContainer(t,i)),i},_updateDynamicLane:function(n,t){var i,r;if(t.parent)r=n.nameTable[t.parent];else for(i=0;i<this.selectionList.length;i++)r=this.selectionList[i];return r},_add:function(n,t,i,r){var v,y,e,f,u,s,p,h,c,l,o,w,a,b;if(!n.length>0&&(n=ej.datavisualization.Diagram.NodeType(n,this),this.model.nodeTemplate&&n._type==="node"?v=this._getNodeTemplate():y=this._getConnectorTemplate(),v&&v(this,n),y&&y(this,n)),n.pivot||(n.pivot={x:.5,y:.5}),this._outOfBoundsOnNudge(n,0,0)){if(this._raiseChildrenPropertyChange(n,!0),e=!1,(n.isSwimlane||n.type==="swimlane")&&!this._pasteObj&&this._isNewNode&&(n=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n)),n.length>0)for(o=0;o<n.length;o++)this.add(n[o]);else if(n.addInfo&&(n.addInfo.height&&(n.height=n.addInfo.height),n.addInfo.width&&(n.width=n.addInfo.width)),f=n.type=="connector"?"connector":"node",u={changeType:"insert",element:this.getNode(n)},n.isLane?(u=this._raiseCollectionChangeEvent(n,f),this._updateLane(n,u.element)):n.isSwimlane?(u=this._raiseCollectionChangeEvent(n,f),this._updateSwimlane(n,u.element,!0)):n.container&&!$.isEmptyObject(n.container)&&(n=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,n)),n.isLane||n.isSwimlane){if(!u.cancel&&(e=n.isLane&&(this._selectedSymbol&&this._selectedSymbol.isLane||this._swimlaneObject||this._isUndo)?!0:this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[n.name]=n,e)){if(n._type==="group"&&t){if(this._paletteItemClick&&(n.offsetX=n.minWidth/2+50,n.offsetY=n.minHeight/2+50),ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this),n.phases&&n.phases.length>0)for(l=null,o=0,w=n.phases.length;o<w;o++)l=this.nameTable[n.phases[o]],l.type=="phase"&&ej.datavisualization.Diagram.SvgContext.renderphase(l,this._svg,this._diagramLayer,this);this._clearSelection(!0);this._addSelection(n)}this._updateQuad(n)}}else n.type!="connector"?(c=this._eventCause[f+"CollectionChange"],c||(this._eventCause[f+"CollectionChange"]=this._isUndo?ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange:ej.datavisualization.Diagram.CollectionChangeCause.Unknown),n._type==="group"||n.children&&n.children.length>0?(n=ej.datavisualization.Diagram.Group(n),this.nameTable[n.name]=n,u=this._raiseCollectionChangeEvent(n,f),n._type="group",n.type=="bpmn"&&(n=ej.datavisualization.Diagram.Util._updateBpmnChild(n,this)),this._initGroupNode(n),this._isGroupNode||n.type==="bpmn"||this._udpateChildRotateAngle(n)):n.isPhase||(n=this._getNewNode(n),this.nameTable[n.name]=n,u=this._raiseCollectionChangeEvent(n,f),this._getNodeDimension(n)),u.cancel||(n._status="new",e=this.nodes().push(n),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[n.name]=n,e&&(n._type==="group"||n.children&&n.children.length>0?(this._updateParent(n),n.offsetX==0&&n.offsetY==0&&ej.datavisualization.Diagram.Util._updateGroupBounds(n,this,!0),this._updateChildrenEdges(n),s=null,s=this._updateChildOnGroup(n),t&&!n.parent&&(delete this._isNodeInitializing,ej.datavisualization.Diagram.DiagramContext.renderGroup(n,this))):t&&(s=null,s=this._updateChildOnGroup(n),(n.parent===""||n.isPhase||this._isInsert)&&ej.datavisualization.Diagram.DiagramContext.renderNode(n,this,s),this._selectedSymbol&&n.textBlock&&(p=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],p&&(h=$(p).find("#"+n.name)[0],h&&h.childNodes&&h.childNodes.length>0&&(h.childNodes[0].style.display="none")))),this._updateQuad(n),this.nameTable[n.name]=n,t&&!r&&(this._clearSelection(!0),this._addSelection(n))))):(n=this._getNewConnector(n),this.nameTable[n.name]=n,c=this._eventCause[f+"CollectionChange"],c||(this._eventCause[f+"CollectionChange"]=this._isUndo?ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange:ej.datavisualization.Diagram.CollectionChangeCause.Unknown),u=this._raiseCollectionChangeEvent(n,f),u.cancel||(e=n.parent?!0:this.connectors().push(n),n._status="new",e&&(this._updateEdges(n),this._dock(n,this.nameTable),ej.datavisualization.Diagram.Util.updateBridging(n,this),n.parent||t&&ej.datavisualization.Diagram.DiagramContext.renderConnector(n,this),this.nameTable[n.name]=n,this._updateQuad(n),this._updateChildOnGroup(n),t&&!r&&(this._clearSelection(!0),this._addSelection(n)))));this._setZorder(n);!this._isUndo&&(!this._selectedSymbol||this._endEditing)&&e&&(a={},this.selectionList&&this.selectionList.length>0&&(a=this._getChildTable(this.selectionList[0],a)),i&&(!i||i.entryHistory)||n.isPhase||(b={type:"collectionchanged",object:jQuery.extend(!0,{},n),childTable:jQuery.extend(!0,{},a),changeType:"insert",category:"internal"},this.addHistoryEntry(b)));this._trigger("refresh");e&&!n.isPhase&&(!this._selectedSymbol||this._endEditing)&&(u.state="changed",this._raiseEvent(f+"CollectionChange",u))}return delete this._isNewNode,e},_raiseCollectionChangeEvent:function(n,t){var i={changeType:"insert",element:this.getNode(n),state:"changing"};return n.isPhase||this._selectedSymbol&&!this._endEditing||(this._raiseEvent(t+"CollectionChange",i),n._absolutePath=null),i},add:function(n,t){if(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this)){this._isNodeInitializing=!0;this._isNewNode=!0;var i=this._add(n,!0,t);return delete this._isNodeInitializing,i}},updateUserHandles:function(n){n=this.nameTable[n.name];ej.datavisualization.Diagram.SvgContext.updateUserHandles(this.model.selectedItems.userHandles,n,this._adornerSvg,!1,!1,this._currZoom,this)},scrollToNode:function(n){var u,f,i=this._currZoom,r=this.element[0].getBoundingClientRect(),t=ej.datavisualization.Diagram.Util.bounds(n),e,o;u=(t.x+t.width/2)*i;f=(t.y+t.height/2)*i;e=this._hScrollOffset;o=this._vScrollOffset;r.width+this._hScrollOffset<u+t.width/2*i&&(e=u+(t.width/2+20)*i-r.width);r.height+this._vScrollOffset<f+t.height/2*i&&(o=f+(t.height/2+20)*i-r.height);this._updateScrollOffset(e,o)},findNode:function(n){return this._findNode(n)},getObjectType:function(n){return ej.datavisualization.Diagram.Util.getObjectType(n)},_registerDrawingTools:function(){var t,n;for(t in this.model.drawingTools)n=this.model.drawingTools[t],n.diagram=this,this.tools[n.name]=n},_sortByXvalue:function(n){for(var f,i,r,u,e,o,t=0;t<n.length;t++)for(i=t+1;i<n.length;i++)e=this.nameTable[this._getChild(n[t])],o=this.nameTable[this._getChild(n[i])],r=ej.datavisualization.Diagram.Util.bounds(e),u=ej.datavisualization.Diagram.Util.bounds(o),(r.x>u.x||r.right>u.right)&&(f=n[t],n[t]=n[i],n[i]=f);return n},_sortByYvalue:function(n){for(var f,i,r,u,e,o,t=0;t<n.length;t++)for(i=t+1;i<n.length;i++)e=this.nameTable[this._getChild(n[t])],o=this.nameTable[this._getChild(n[i])],r=ej.datavisualization.Diagram.Util.bounds(e),u=ej.datavisualization.Diagram.Util.bounds(o),(r.y>u.y||r.bottom>u.bottom)&&(f=n[t],n[t]=n[i],n[i]=f);return n},_sortByZIndex:function(n,t){var u,i,r;if(t)for(i=0;i<n.length;i++)for(r=i+1;r<n.length;r++)n[i].zOrder>n[r].zOrder&&(u=n[i],n[i]=n[r],n[r]=u);else for(i=0;i<n.length;i++)for(r=i+1;r<n.length;r++)n[i].zOrder<n[r].zOrder&&(u=n[i],n[i]=n[r],n[r]=u);return n},_updateBPMNIndex:function(n,t){var s,r,u,o,i,f,e;if(n.type==="bpmn"&&n.parent&&(o=this.nameTable[n.parent],o&&o.isLane))for(i=o.children,r=0;r<i.length;r++)for(u=r+1;u<i.length;u++)f=this.nameTable[i[r]],e=this.nameTable[i[u]],!(t?f.zOrder>e.zOrder:f.zOrder<e.zOrder)||f.isPhase||e.isPhase||f.isLane||e.isLane||(s=i[r],i[r]=i[u],i[u]=s)},_sortByGroupChildrenZIndex:function(n){for(var s=this.nodes(),h,i,u,r,t,f,e,o=0;o<s.length;o++)if(r=s[o],this._updateBPMNIndex(r,n),r._type==="group"&&r.type!=="bpmn"&&!r.isSwimlane){for(t=this._getChildren(r.children),i=0;i<t.length;i++)for(u=i+1;u<t.length;u++)f=this.nameTable[t[i]],e=this.nameTable[t[u]],!(n?f.zOrder>e.zOrder:f.zOrder<e.zOrder)||f.isPhase||e.isPhase||f.isLane||e.isLane||(h=t[i],t[i]=t[u],t[u]=h);r.children=t}},_findCornerNodes:function(){var i,r,u,f,e,n,s=this.selectionList[0].children,o=this.nameTable[this.selectionList[0].children[0]],t,h,c,l,a;if(i=o,r=o,u=o,f=o,s.length>1)for(e=0;e<s.length;e++)t=this.nameTable[s[e]],n=ej.datavisualization.Diagram.Util.bounds(t),h=ej.datavisualization.Diagram.Util.bounds(r),n.x+n.width>h.x+h.width&&(r=t),c=ej.datavisualization.Diagram.Util.bounds(f),n.y+n.height>c.y+c.height&&(f=t),l=ej.datavisualization.Diagram.Util.bounds(i),n.x<l.x&&(i=t),a=ej.datavisualization.Diagram.Util.bounds(u),n.y<a.y&&(u=t);return{left:i,right:r,top:u,bottom:f}},_comparePropertyOnAlign:function(n,t,i,r){n&&(n.segments?(this._comparePropertyValues(n,"sourcePoint",{sourcePoint:{x:n.sourcePoint.x+t,y:n.sourcePoint.y+i}},r),this._comparePropertyValues(n,"targetPoint",{targetPoint:{x:n.targetPoint.x+t,y:n.targetPoint.y+i}},r)):(n.offsetX!=n.offsetX+t&&this._comparePropertyValues(n,"offsetX",{offsetX:n.offsetX+t},null,r),n.offsetY!=n.offsetY+i&&this._comparePropertyValues(n,"offsetY",{offsetX:n.offsetY+i},null,r)))},_moveNode:function(n,t,i){this._comparePropertyOnAlign(i,n,t,ej.datavisualization.Diagram.ActionType.Align);this._translate(i,n,t,this.nameTable);this._updateNodeMargin(i);ej.datavisualization.Diagram.DiagramContext.update(i,this)},_updateContainerOnNudge:function(n){var t=this.nameTable[n.parent];t&&t.container&&(ej.datavisualization.Diagram.canvasHelper._updateNodeMargin(this,n,t),ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,t,!0))},_outOfBoundsOnNudge:function(n,t,i){var r=this.nameTable[this._getChild(n.parent)],u,e,h,a;if(r&&r.isLane&&r.parent){if(u=this.nameTable[this._getChild(r.parent)],u&&u.isLaneStack&&u.parent&&(e=this.nameTable[this._getChild(u.parent)],e&&this.model.pageSettings.boundaryConstraints!="infinity")){var c=ej.datavisualization.Diagram.Util.bounds(r),l=ej.datavisualization.Diagram.Util.bounds(n),f=ej.datavisualization.Diagram.Util.bounds(e),o=f.right,s=f.bottom;if(l.bottom+i+20>=c.bottom&&(s+=i),l.right+t+20>=c.right&&(o+=t),h=this.activeTool._getPageBounds(),i>0&&f.bottom!=s&&s>h.height||t>0&&f.right!=o&&o>h.width)return!1}}else return a=this.tools.move,a._outOfBoundsDrag(n,t,i);return!0},_nudge:function(n,t,i,r,u,f){var a,s,v,e,y,c,o;if(!n||!n.segments||!n.sourceNode||!n.targetNode){var l,k=this.nameTable[n.parent],h;if(this._outOfBoundsOnNudge(n,t,i)){if(!u)if(n.segments)h={element:n,cause:ej.datavisualization.Diagram.ActionType.Nudge,keyCode:r,propertyName:"sourcePoint",oldValue:{sourcePoint:n.sourcePoint},newValue:{sourcePoint:{x:n.sourcePoint.x+t,y:n.sourcePoint.y+i}}},this._raisePropertyChange(h),h={element:n,cause:ej.datavisualization.Diagram.ActionType.Nudge,keyCode:r,propertyName:"targetPoint",oldValue:{targetPoint:n.targetPoint},newValue:{targetPoint:{x:n.targetPoint.x+t,y:n.targetPoint.y+i}}},this._raisePropertyChange(h);else{var p=r==="right"||r==="left"?n.offsetX:n.offsetY,w=r==="right"||r==="left"?n.offsetX+t:n.offsetY+i,b=r==="right"||r==="left"?"offsetX":"offsetY";h={element:n,cause:ej.datavisualization.Diagram.ActionType.Nudge,keyCode:r,propertyName:b,oldValue:p,newValue:w};this._raisePropertyChange(h)}if(e=this.nameTable[n.parent],e&&e.isLane&&(a=this._moveOnLane(n,e,t,i)),!0&&(!a||a.proceedY)||(i=0),!0&&(!a||a.proceedX)||(t=0),n.type=="pseudoGroup"){for(s=this._removeContainerConnector(this._getChildren(n.children)),s=this._sortByYvalue(s),s=this._sortByXvalue(s),v=s.length-1;v>=0;v--)if(l=this.nameTable[this._getChild(s[v])],l){if(!this._nudge(l,t,i,r,!0,v===0))break;this._updateContainerOnNudge(l)}ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdateNode(this,l);delete this._disableSwimlaneUptate;ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)}else this._translate(n,t,i,this.nameTable),this._updateContainerOnNudge(n);if(this._updateNodeMargin(n),n.parent){if(e=this.nameTable[n.parent],e&&e.container&&(ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),this._disablePhaseUpdate=!0,this._disableSwimlaneUptate=!0,e.container.type==="canvas"&&ej.datavisualization.Diagram.canvasHelper._updateCollectionChange(this,e),delete this._disablePhaseUpdate,!u,y=this.nameTable[e.parent],y&&(c=this.nameTable[y.parent],ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,c),!u,this._updateSwimlanes||(this._updateSwimlanes=[]),this._collectionContains(c.name,this._updateSwimlanes)||this._updateSwimlanes.push(c.name),u||(delete this._disableSwimlaneUptate,ej.datavisualization.Diagram.DiagramContext.update(c,this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,c,!0)))),f&&this._updateSwimlanes){for(delete this._disableSwimlaneUptate,o=0;o<this._updateSwimlanes.length;o++)ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[this._updateSwimlanes[o]],this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,this.nameTable[this._updateSwimlanes[o]]);delete this._updateSwimlanes}}else if(f&&this._updateSwimlanes){for(o=0;o<this._updateSwimlanes.length;o++)ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[this._updateSwimlanes[o]],this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,this.nameTable[this._updateSwimlanes[o]]);delete this._updateSwimlanes}else ej.datavisualization.Diagram.DiagramContext.update(n,this);return this._updateSelectionHandle(!0),!0}return!1}},_removeContainerConnector:function(n){var r=[],t,i;if(n&&n.length>0)for(t=0;t<n.length;t++)i=this.nameTable[this._getChild(n[t])],i&&!i.segments?r.push(n[t]):!i.segments||i.sourceNode||i.targetNode||r.push(n[t]);return r},_moveOnLane:function(n,t,i,r){var h=!1,o=0,c=!1,s=0,u,f,e;return i=i?i:0,r=r?r:0,t.children&&t.children.length>0&&(u=this.nameTable[this._getChild(t.children[0])],u&&u.name.indexOf("_Headerr")!=-1&&(t.orientation==="horizontal"?o=u.width:t.orientation==="vertical"&&(s=u.height))),n&&t?(f=ej.datavisualization.Diagram.Util.bounds(n),e=ej.datavisualization.Diagram.Util.bounds(t),f.y+r>=e.y+t.paddingTop+s&&(h=!0),f.x+i>=e.x+t.paddingLeft+o&&(c=!0),{proceedY:h,proceedX:c,x:e.x+t.paddingLeft+o-f.x+i,y:e.y+t.paddingTop+s-f.y+r}):void 0},_selectCommand:function(n){this._isEditing&&(this._endEdit(),document.getElementById(this._id).focus());n.keyDownEventArgs.preventDefault();this.selectAll()},_nudgeCommand:function(n){!this._currentState&&this.selectionList[0]&&(this._currentState={x:this.selectionList[0].offsetX,y:this.selectionList[0].offsetY});this.nudge(n.parameter,n.keyDownEventArgs.shiftKey?5:1);n.keyDownEventArgs.preventDefault()},_startEditCommand:function(){var n,t,i;this.selectionList.length>0&&(n=this.selectionList[0],n.type=="pseudoGroup"||(n.type==="text"&&this._setLabelEditing(n.textBlock)&&this._startEdit(n),n.isSwimlane?(t=this.nameTable[n.name+"_header_swimlane"],t&&this._startEdit(t)):n.isLane?n.children&&n.children.length>0&&(t=this.nameTable[this._getChild(n.children[0])],t&&this._startEdit(t)):n.type&&n.type==="phase"?(i=this.nameTable["phaseStack"+n.name],i&&this._startEdit(i)):n.labels.length>0&&this._setLabelEditing(n.labels[0])&&this._startEdit(n)))},_findObjectByName:function(n){var t=null;return this._findNode(n)&&(t=this._findNode(n)),this._findConnector(n)&&(t=this._findConnector(n)),t},_findObjectByIndex:function(n,t){var e,u=null,i,r,f,o;if(t){if(o=this.nameTable[this.selectionList[0].parent],o)for(e=this._getChildren(o.children),f=0;f<e.length;f++)i=this.nameTable[e[f]],i.zOrder===n&&(u=e[f])}else{for(r=0;r<this.nodes().length;r++)i=this.nodes()[r],i.zOrder===n&&(u=i);for(r=0;r<this.connectors().length;r++)i=this.connectors()[r],i.zOrder===n&&(u=i)}return typeof u=="string"?this.nameTable[u]:u},_findOverlapNode:function(n){var i=[],t,r,s=[],u,h,e,o,f;if(n.parent){if(u=ej.datavisualization.Diagram.Util.bounds(n),h=this.nameTable[n.parent],h)for(o=this._getChildren(h.children),t=0;t<o.length;t++)o[t]!==n.name&&(e=this.nameTable[o[t]],f=ej.datavisualization.Diagram.Util.bounds(e),e&&this._intersect(u,f)&&s.push(e))}else{for(t=0;t<this.nodes().length;t++)i.push(this.nodes()[t]);for(t=0;t<this.connectors().length;t++)i.push(this.connectors()[t]);if(u=ej.datavisualization.Diagram.Util.bounds(n),n)for(r=0;r<i.length;r++)f=ej.datavisualization.Diagram.Util.bounds(i[r]),n.name===i[r].name||n.children&&this._collectionContains(i[r].name,n.children)||this._intersect(u,f)&&s.push(i[r])}return s},_intersect:function(n,t){return n.x<=t.x+t.width&&t.x<=n.x+n.width&&n.y<=t.y+t.height&&t.y<=n.y+n.height},_focusToItem:function(n){var u=this.nodes(),f=this.connectors(),i=0,r=[],t,e=this;if(u.length||f.length){this._diagramElements||(r=this.nodes().concat(this.connectors()),r=this._sortByZIndex(r,!0),r=r.map(function(n){return n.name}),this._diagramElements=r);i=this._focusedElement||this.selectionList.length||!this._diagramElements.length?this._focusedElement?this._diagramElements.indexOf(this._focusedElement):this.selectionList[0].type!="pseudoGroup"?this._diagramElements.indexOf(this.selectionList[0].name):Math.min.apply(Math,this.selectionList[0].children.map(function(n){return e._diagramElements.indexOf(n.name||n)})):n.keyDownEventArgs.shiftKey?0:this._diagramElements.length-1;do(i=n.keyDownEventArgs.shiftKey?i!=0?--i:this._diagramElements.length-1:i!=this._diagramElements.length-1?++i:0,this.nameTable[this._diagramElements[i]].type!="pseudoGroup")&&(this._focusedElement=this._diagramElements[i]);while(!ej.datavisualization.Diagram.Util.canSelect(this.nameTable[this._focusedElement]));t=ej.datavisualization.Diagram.Util.bounds(this.nameTable[this._focusedElement]);t={x:t.x-8,y:t.y-8,width:t.width+16,height:t.height+16};this.bringIntoView({x:t.x-25,y:t.y-25,width:t.width+50,height:t.height+50});ej.datavisualization.Diagram.SvgContext._drawNavigationHighlighter(t,this._adornerSvg,this._adornerLayer,this._currZoom);n.keyDownEventArgs.preventDefault()}},_selectFocusedItem:function(n){ej.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this._adornerSvg,this._adornerLayer);var t=this.nameTable[this._focusedElement];this._eventCause.selectionChange=ej.datavisualization.Diagram.SelectionChangeCause.Keydown;t&&this.addSelection(t,!0);this._diagramElements=null;this._focusedElement=null;n.keyDownEventArgs.preventDefault()},_createDefaultTooltip:function(){var n=document.createElement("div"),t={id:this.element[0].id+"_DefaulttooltipDiv","class":"e-diagram-tooltip-default",style:"padding-top:3px; height: 24px;pointer-events:none;"},i;return ej.datavisualization.Diagram.Util.attr(n,t),this._tooltipLayer.appendChild(n),this.model.tooltipTemplateId||(i=document.createElement("span"),t={"class":"e-diagram-tooltipLabel-default",id:"e-diagram-tooltipLabel-default"},ej.datavisualization.Diagram.Util.attr(i,t),n.appendChild(i)),n},_createMouseOverTooltip:function(){var n=document.createElement("div"),t={id:this.element[0].id+"_mouseovertooltipDiv","class":"e-diagram-tooltip-mouseover",style:"pointer-events:none;"};return ej.datavisualization.Diagram.Util.attr(n,t),this._tooltipLayer.appendChild(n),n},_renderTooltip:function(n,t){var r,e,u,o,s,f,h,i;n.parent&&this.nameTable[n.parent]&&this.nameTable[n.parent].container||this.model.selectedItems.tooltip&&(r=document.getElementById(this.element[0].id+"_DefaulttooltipDiv"),r||(r=this._createDefaultTooltip()),f=this._currZoom,this.model.selectedItems.tooltip.templateId?$.templates&&this.model.selectedItems.tooltip&&(n.segments||(i=this._getTooltipPosition(n,this.model.selectedItems.tooltip),i.x=-this._hScrollOffset+i.x*f,i.y=-this._vScrollOffset+i.y*f,r.style.top=i.y+"px",r.style.left=i.x+"px",r.style.transform="translate("+i.tx+" ,"+i.ty+")",e=$.templates("#"+this.model.selectedItems.tooltip.templateId),o=e.render(n),$(r).html(o))):(t&&(r.style.width="150px"),s=150,h=r.childNodes[0],this.activeTool instanceof ej.datavisualization.Diagram.MoveTool?n.segments||(u="X : "+Math.round(n.offsetX-n.width*n.pivot.x)+"px Y : "+Math.round(n.offsetY-n.height*n.pivot.y)+"px"):this.activeTool instanceof ej.datavisualization.Diagram.ResizeTool?u="W : "+Math.round(n.width)+"px H : "+Math.round(n.height)+"px":this.activeTool instanceof ej.datavisualization.Diagram.RotateTool&&(t&&(r.style.width="50px"),s=50,u=Math.round(n.rotateAngle)+"°"),u?(i=this._getTooltipPosition(n,this.model.selectedItems.tooltip),i.x=-this._hScrollOffset+i.x*f,i.y=-this._vScrollOffset+i.y*f,r.style.top=i.y+"px",r.style.left=i.x+"px",r.style.transform="translate("+i.tx+" ,"+i.ty+")",h.textContent=u):this._removeTooltip()))},_removeTooltip:function(){var n=document.getElementById(this.element[0].id+"_DefaulttooltipDiv");n&&n.parentNode.removeChild(n)},_removeMouseOverTooltip:function(){var n=document.getElementById(this.element[0].id+"_mouseovertooltipDiv");n&&n.parentNode.removeChild(n)},_renderCanvas:function(n){this._browserInfo=ej.browserInfo();this._canvas=document.getElementById(this.element[0].id+"_canvas");this._canvas||(this._canvas=document.createElement("div"),this.element.append(this._canvas));this._canvas.setAttribute("id",this.element[0].id+"_canvas");(this._canvas.getAttribute("class")===null||this._canvas.getAttribute("class")==="")&&this._canvas.setAttribute("class","drawing");this._canvas.setAttribute("style","position:relative; height:"+this.model.height+"; width:"+this.model.width+";");this.element.css({overflow:"hidden",outline:"none",display:"block",height:this.model.height,width:this.model.width});this._views[this._id].canvas=this._canvas;this.element[0].setAttribute("tabindex",0);this._renderDiagram(n);ej.datavisualization.Diagram.Util.canFloatElements(this)&&this._setItemDraggable(this._canvas)},_getDigramBounds:function(n){var t,i,u,f,r;return t=this._spatialSearch.pageLeft||0,i=this._spatialSearch.pageTop||0,u=this._spatialSearch.pageRight-this._spatialSearch.pageLeft||0,f=this._spatialSearch.pageBottom-this._spatialSearch.pageTop||0,n!="content"&&(this.model.pageSettings&&this._multiplePage()?(t=this._spatialSearch.pageLeft,i=this._spatialSearch.pageTop,this._pageWidth()&&(t=Math.floor(t/this._pageWidth())*this._pageWidth(),u=Math.ceil(this._spatialSearch.pageRight/this._pageWidth())*this._pageWidth()-t),this._pageHeight()&&(i=Math.floor(i/this._pageHeight())*this._pageHeight(),f=Math.ceil(this._spatialSearch.pageBottom/this._pageHeight())*this._pageHeight()-i),this._spatialSearch.pageRight===null&&this._pageWidth()!==0&&(u=this._pageWidth()),this._spatialSearch.pageBottom===null&&this._pageHeight()!==0&&(f=this._pageHeight())):(this._pageWidth()&&(t=0,u=this._pageWidth()),this._pageHeight()&&(i=0,f=this._pageHeight()))),r=new ej.datavisualization.Diagram.Rectangle,r.x=t,r.y=i,r.width=u,r.height=f,r},_initContextMenu:function(n){this.enableContextMenu()?this._renderContextMenu(n):$("#"+this.element[0].id+"_contextMenu").remove()},_renderContextMenuItem:function(n){var r=document.createElement("li"),o=document.createElement("a"),h=ej.datavisualization.Diagram.Locale[this.locale()],t,u,f,e,i,s;if(o.innerHTML=h[n.name]||n.text,r.setAttribute("id",this.element[0].id+"_contextMenu_"+n.name),t=document.createElement("span"),t.setAttribute("id",n.name+"_image"),u="display:table-cell; vertical-align:middle; text-align:center;",n.imageUrl&&(u=u+"background-image: url("+n.imageUrl+");width:25px;height:25px"),t.setAttribute("style",u),f="sf-d-menuitem "+n.name,n.cssClass&&(f=f+" "+n.cssClass),t.setAttribute("class",f),o.appendChild(t),n.subItems&&n.subItems.length>0){for(e=document.createElement("ul"),i=0,i;i<n.subItems.length;i++)s=this._renderContextMenuItem(n.subItems[i],e),s.setAttribute("style","display:block;"),e.appendChild(s);r.appendChild(e)}return r.appendChild(o),r},_renderContextMenu:function(){var f=$.extend(!0,[],this.model.contextMenu.items),r,e,u,n,t,s,i,o;if(!this.model.contextMenu.showCustomMenuItemsOnly){for(r=[],n=0;n<this._defaultContextMenuItems.length;n++)if(e=!1,this.model.contextMenu.items.length)for(u=0;u<this.model.contextMenu.items.length;u++){if(this.model.contextMenu.items[u].name===this._defaultContextMenuItems[n].name){e=!0;break}u!==this.model.contextMenu.items.length-1||e||r.push(this._defaultContextMenuItems[n])}else r.push(this._defaultContextMenuItems[n]);for(n=0;n<r.length;n++)f.push(r[n])}for(n=0,i=document.createElement("ul"),i.setAttribute("id",this.element[0].id+"_contextMenu"),n=0;n<f.length;n++)t=f[n],t.templateId?(o=this._renderEjTemplate("#"+t.templateId,t),o&&(i.innerHTML=o)):t&&t.name&&(s=this._renderContextMenuItem(t,i),i.appendChild(s));this._canvas.appendChild(i);$("#"+this.element[0].id+"_contextMenu").ejMenu({menuType:ej.MenuType.ContextMenu,contextMenuTarget:"#"+this.element[0].id+"_canvas",click:$.proxy(this._onMenuItemClick,this),beforeOpen:$.proxy(this._onContextMenuOpen,this),mouseover:$.proxy(this._onMenuItemMouseOver,this),mouseout:$.proxy(this._onMenuItemMouseOut,this),close:$.proxy(this._onContextMenuClose,this)});$("#"+this.element[0].id+"_contextMenu")[0].style.display="none"},_onContextMenuClose:function(){this.element[0].focus()},_onContextMenuOpen:function(n){var t,i,r,u;if(this._disableDefaultContextMenu)return delete this._disableDefaultContextMenu,!1;t=this.element[0].id;i=this._findNodeUnderMouse(n);i===null&&n.target&&$(n.target).attr("class")==="segmentEnd"&&this.selectionList[0]&&(i=this.selectionList[0]);r=!1;$(n.target).parents(".e-scrollbar").length&&this.enableContextMenu()&&(n.cancel=!0,$("#"+this.element[0].id+"_contextMenu").ejMenu("instance").hideContextMenu());this.selectionList[0]&&(this.selectionList[0].type==="pseudoGroup"||this.selectionList[0]._type==="group")&&(r=!0);!i&&this.selectionList.length>0&&!r&&this._clearSelection();this.enableContextMenu()&&($("#"+t+"_contextMenu_cut")[0]&&($("#"+t+"_contextMenu_cut")[0].style.display=this.selectionList.length?"block":"none"),$("#"+t+"_contextMenu_copy")[0]&&($("#"+t+"_contextMenu_copy")[0].style.display=this.selectionList.length?"block":"none"),$("#"+t+"_contextMenu_paste")[0]&&($("#"+t+"_contextMenu_paste")[0].style.display=this._clipboardData?"block":"none"),$("#"+t+"_contextMenu_undo")[0]&&($("#"+t+"_contextMenu_undo")[0].style.display=this._historyList&&this._historyList.canUndo?"block":"none"),$("#"+t+"_contextMenu_redo")[0]&&($("#"+t+"_contextMenu_redo")[0].style.display=this._historyList&&this._historyList.canRedo?"block":"none"),$("#"+t+"_contextMenu_selectAll")[0]&&($("#"+t+"_contextMenu_selectAll")[0].style.display=this.nodes().length+this.connectors().length?"block":"none"),$("#"+t+"_contextMenu_grouping")[0]&&($("#"+t+"_contextMenu_grouping")[0].style.display=this.selectionList[0]&&(this.selectionList[0].type=="group"||this.selectionList[0].type=="pseudoGroup")?"block":"none"),$("#"+t+"_contextMenu_order")[0]&&($("#"+t+"_contextMenu_order")[0].style.display=this.selectionList.length?"block":"none"));u={diagram:this,contextmenu:n};u.target=this.selectionList.length?this.selectionList[0]:this.activeTool.prevSelectObject?this.activeTool.prevSelectObject:this;this._trigger("contextMenuBeforeOpen",u);this.enableContextMenu()&&($("#"+t+"_contextMenu")[0].style.display="block",$("#"+t+"_contextMenu")[0].clientHeight<=2&&(n.cancel=!0),$("#"+t+"_contextMenu")[0].style.display="none");n.events&&!n.events.originalEvent&&(n.events.originalEvent=n.events);this.activeTool.mouseup(n.events,!0)},_onMenuItemClick:function(n){var t=n.events.ID.replace(this._id+"_contextMenu_","");if(n.canExecute=!0,n.target=this.selectionList.length?this.selectionList[0]:this.activeTool.prevSelectObject?this.activeTool.prevSelectObject:this,this._trigger("contextMenuClick",n),n.canExecute)switch(t){case"cut":this.cut();break;case"copy":this.copy();break;case"paste":this.paste();break;case"undo":this.undo();break;case"redo":this.redo();break;case"selectAll":this.selectAll();break;case"group":this.group();break;case"ungroup":this.ungroup();break;case"bringToFront":this.bringToFront();break;case"sendToBack":this.sendToBack();break;case"moveForward":this.moveForward();break;case"sendBackward":this.sendBackward()}},_onMenuItemMouseOver:function(n){var t=n.events.element.lastChild.childNodes[1];$(t).addClass("hover")},_onMenuItemMouseOut:function(n){var t=n.events.element.lastChild.childNodes[1];$(t).removeClass("hover")},_renderDiagram:function(n){var t=this;this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);this._doLayout();this._views.forEach(function(i){var r=t._views[i],u;r.type=="mainview"&&r.context==ej.datavisualization.Diagram.SvgContext&&(r.context._renderDocument(r,t,n),t._createScrollbar(t._canvas),ej.datavisualization.Diagram.ScrollUtil._initScrollbar(t),ej.datavisualization.Diagram.PageUtil._updatePageSize(t));n||(u=t._setNodeZOrder(r),t._renderDiagramObjects(u,r))});$(this._svg.document).pinchDiagram(this._view,this)},_createScrollbar:function(n){var i=document.createElement("div"),t;i.setAttribute("id",n.id+"_hScrollbar");document.getElementById(n.id+"_hScrollbar")||n.appendChild(i);t=document.createElement("div");t.setAttribute("id",n.id+"_vScrollbar");document.getElementById(n.id+"_vScrollbar")||n.appendChild(t)},_disableScrollbar:function(){this._isMobile&&($("#"+this._hScrollbar._id).addClass("e-disable").attr({"aria-disabled":!0,style:"display: none;"}),$("#"+this._vScrollbar._id).addClass("e-disable").attr({"aria-disabled":!0,style:"display: none;"}))},_doLayout:function(){this.model.layout&&this._layoutType()!==ej.datavisualization.Diagram.LayoutTypes.None&&(this._updateEdgeCollection(),ej.datavisualization.Diagram.Layout.doLayout(this))},_updateNodes:function(){for(var t=this.nodes(),n=0;n<t.length;n++)ej.datavisualization.Diagram.DiagramContext.update(t[n],this)},_updateConnectors:function(){for(var t=this.connectors(),n=0;n<t.length;n++)ej.datavisualization.Diagram.DiagramContext.update(t[n],this)},_updateEdgeCollection:function(){for(var n=0;n<this.connectors().length;n++)this._updateEdges(this.connectors()[n])},updateViewPort:function(){this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);ej.datavisualization.Diagram.DiagramContext.updateViewPort(this);this.model.scrollSettings.viewPortHeight=this._viewPort.height;this.model.scrollSettings.viewPortWidth=this._viewPort.width;var n=this;this._views.forEach(function(t){var r=n._views[t],i;r.type=="overview"&&(i=$("#"+t).ejOverview("instance"),i&&i._scrollOverviewRect(n._hScrollOffset,n._vScrollOffset,n._currZoom))})},_containsSameIndex:function(n,t){var u,f,e,o,s,r,i;if(t){for(s=t.children,i=0;i<s.length;i++)if(r=this.nameTable[this._getChild(s[i])],r&&r.zOrder&&r.zOrder===n)return!0}else{for(u=this.nodes(),i=0;i<u.length>0;i++)if(f=u[i],f&&f.zOrder===n)return!0;for(e=this.connectors(),i=0;i<e.length>0;i++)if(o=e[i],o&&o.zOrder===n)return!0}return!1},_setZorder:function(n){var r,t,i;if(n&&n.zOrder){if(n.zOrder==-1)if(this._containsSameIndex(this._zOrder)){do this._zOrder++;while(this._containsSameIndex(this._zOrder));n.zOrder=this._zOrder}else n.zOrder=this._zOrder,this._zOrder++;if(n._type==="group")for(r=n.children,i=0;i<r.length;i++)t=this.nameTable[this._getChild(r[i])],t&&t.zOrder&&t.zOrder===-1&&this._setZorder(t)}},_union:function(n,t){var i=Math.min(n.x,t.x),r=Math.min(n.y,t.y),u=Math.max(n.x+n.width,t.x+t.width),f=Math.max(n.y+n.height,t.y+t.height);return new ej.datavisualization.Diagram.Rectangle(i,r,u-i,f-r)},_getSeperetor:function(n){return this.nameTable[n]},_updateNextPhase:function(n,t,i){ej.datavisualization.Diagram.SwimLaneContainerHelper._updateNextPhase(this,n,t,i)},_getOuterNodes:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getOuterNodes(this,n,t,i)},_getInnerNodes:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getInnerNodes(this,n,t,i)},_moveOuterNodes:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._moveOuterNodes(this,n,t,i)},_moveOnPhaseChange:function(n,t,i){ej.datavisualization.Diagram.SwimLaneContainerHelper._moveOnPhaseChange(this,n,t,i)},_getPhaseDifferece:function(n,t,i){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getPhaseDifferece(this,n,t,i)},_updatePhaseOffset:function(n){var t=this.nameTable[n.name],o,i,e=this.nameTable[t.parent],f=this._getChildren(e.children),u=f.indexOf(t.name),r;f&&f.length>0&&u>-1&&n.offset!=undefined&&(o=this.nameTable[f[u]],i=n.offset-t.offset,r=this.nameTable[e.parent],i=this._getPhaseDifferece(r,u,i),this._moveOuterNodes(r,i,u),u===0?t.orientation==="horizontal"?(t.width+=i,t.offset=t.width,this._comparePropertyValues(r,"offsetX",{offsetX:r.offsetX+i/2},this.activeTool.inAction)):(t.height+=i,t.offset=t.height,this._comparePropertyValues(r,"offsetY",{offsetY:r.offsetY+i/2},this.activeTool.inAction)):t.orientation==="horizontal"?(t.width+=i,t.offset+=i,this._comparePropertyValues(r,"offsetX",{offsetX:r.offsetX+i/2},this.activeTool.inAction)):(t.height+=i,t.offset+=i,this._comparePropertyValues(r,"offsetY",{offsetY:r.offsetY+i/2},this.activeTool.inAction)),this._disablePhaseUpdate=!0,this._disableSwimlaneUptate=!0,ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),this._moveOnPhaseChange(t,i,u),this._updateNextPhase(r,i,u),delete this._disablePhaseUpdate,delete this._disableSwimlaneUptate,ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,r))},_updatePhase:function(n){var t=this.nameTable[n.name];t&&(t.offset!=undefined&&n.offset!=undefined&&n.offset!=t.offset&&(this._comparePropertyValues(t,"offset",{offset:n.offset},this.activeTool.inAction),this._updatePhaseOffset(n),this._hasSelection()&&this._clearSelection(!0)),this._updateSwimlanePhase(t,n))},_setNodeZOrder:function(){for(var o=null,n=this.nodes(),i,f,t,r,u,s,h,n=n.concat(this.connectors()),e=0;e<n.length;e++)n[e].parent===""&&this._setZorder(n[e]);for(i=0;i<n.length;i++){for(f=i+1;f<n.length;f++)n[i].zOrder>n[f].zOrder&&n[i].parent===""&&n[f].parent===""&&(o=n[i],n[i]=n[f],n[f]=o);if(n[i]._type==="group"&&(t=n[i].children,!n[i].isSwimlane))for(r=0;r<t.length;r++)for(u=r+1;u<t.length;u++)s=typeof t[r]=="object"?t[r]:this.nameTable[t[r]],h=typeof t[u]=="object"?t[u]:this.nameTable[t[u]],!(s.zOrder>h.zOrder)||s.isPhase||h.isPhase||s.isLane||h.isLane||(o=t[r],t[r]=t[u],t[u]=o)}return n},_renderDiagramObjects:function(n,t,i,r){for(var e,o,u=0,f=n.length;u<f;++u)this.getObjectType(n[u])==="node"||this.getObjectType(n[u])==="group"?(e=this.nameTable[n[u].name],this._isLoad&&(this._disableSegmentChange=!0),ej.datavisualization.Diagram.DiagramContext._renderNodeObject(e,t,i,r,this),this._isLoad&&delete this._disableSegmentChange):(o=this.nameTable[n[u].name]||n[u],ej.datavisualization.Diagram.DiagramContext._renderConnectorObject(o,t,this))},_unWireEvents:function(){var n=$(this._canvas);this._off(n,ej.eventType.mouseDown,this._mousedown);this._off(n,ej.eventType.mouseMove,this._mousemove);this._off(n,ej.eventType.mouseUp,this._mouseup);this._off(n,ej.eventType.mouseLeave,this._documentmouseup);this._off(n,"doubletap",this._doubleclick);this._off(this.element,"keydown",this._keydown);this._off(this.element,"keyup",this._keyup);this._off(n,"pinchin",this._pinchin);this._off(n,"pinchout",this._pinchout);this._off(this.element,"touchstart",this._handleTouchStart);ej.browserInfo().name==="mozilla"?this._off(this.element,"DOMMouseScroll",this._handleMouseWheel):this._off(this.element,"mousewheel",this._handleMouseWheel);this._off($(document),"mouseup",this._documentmouseup);window&&this.model.constraints&ej.datavisualization.Diagram.DiagramConstraints.Resizable&&this._off($(window),"resize",this.updateViewPort)},_wireEvents:function(){var t=$(this._canvas),n;this._on(t,ej.eventType.mouseDown,this._mousedown);this._on(t,ej.eventType.mouseMove,this._mousemove);this._on(t,ej.eventType.mouseUp,this._mouseup);this._on(t,ej.eventType.mouseLeave,this._documentmouseup);this._on(t,"doubletap",this._doubleclick);this._on(this.element,"keydown",this._keydown);this._on(this.element,"keyup",this._keyup);this._on(this.element,"contextmenu",this._preventDefaultContextMenu);this._on(t,"pinchin",this._pinchin);this._on(t,"pinchout",this._pinchout);this._on(this.element,"touchstart",this._handleTouchStart);ej.browserInfo().name==="mozilla"?this._on(this.element,"DOMMouseScroll",this._handleMouseWheel):this._on(this.element,"mousewheel",this._handleMouseWheel);this._on($(document),"mouseup",this._documentmouseup);window&&this.model.constraints&ej.datavisualization.Diagram.DiagramConstraints.Resizable&&this._on($(window),"resize",this.updateViewPort);n=this;$(t).ejDroppable({over:function(t){n._isDropOver=!0;var i=!1;t.originalEvent&&t.originalEvent.changedTouches?i=!0:t&&t.changedTouches&&(i=!0);i||n.activeTool.inAction===!1&&n._selectedSymbol&&(n._viewPort||(n._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(n,!0)),n._addSymbolToDiagram(t),n._isSvgDropover=!0)},out:function(){delete n._isDropOver},drop:function(t,i){n._svgdrop(t,i);n._isDropped=!0}})},_preventDefaultContextMenu:function(n){if(this._disableDefaultContextMenu)return n.preventDefault(),n.stopPropagation(),delete this._disableDefaultContextMenu,!1},_mousePosition:function(n,t){var u=this._isTouchEvent(n),e=this._scrollLeft!==undefined?this._scrollLeft:this._canvas.scrollLeft,o=this._scrollTop!==undefined?this._scrollTop:this._canvas.scrollTop,f=this._controlBBox?this._controlBBox:this._canvas.getBoundingClientRect(),i=u.clientX+e-f.left,r=o+u.clientY-f.top;return t||(i=(i+this._hScrollOffset)/this._currZoom,r=(r+this._vScrollOffset)/this._currZoom),new ej.datavisualization.Diagram.Point(Math.round(i*100)/100,Math.round(r*100)/100)},_contextmenu:function(n){n.preventDefault();n.stopPropagation()},_pinchin:function(n){this._getTouchEvent(n);n.preventDefault()},_pinchout:function(n){this._getTouchEvent(n);n.preventDefault()},_handleTouchStart:function(n){this._getTouchEvent(n);n.preventDefault()},_getTouchEvent:function(n){this._isTouchedEvent=n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"?!0:!1},_mousedown:function(n){var r,t,u,i;this._getTouchEvent(n);this._isPinching=!1;this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0);this._diagramElements=null;ej.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this._adornerSvg,this._adornerLayer);this._invoke(n)&&(this._scrollLeft=this._canvas.scrollLeft,this._scrollTop=this._canvas.scrollTop,this._controlBBox=this._canvas.getBoundingClientRect(),r=this._mousePosition(n),n.preventDefault(),this.model.contextMenu&&$("#"+this.element[0].id+"_contextMenu").css("display")!=="none"&&(n.cancel=!0),this._isEditing&&(this._endEdit(),this.activeTool.name==="textTool"&&this.activeTool.singleAction&&this.activeTool.diagram.deactivateTool()),(n.which===1||n.which===3||n.which===0&&n.originalEvent.changedTouches)&&(this._removeMouseOverTooltip(),n.which===0&&n.originalEvent.changedTouches&&(t=null,u=this._isUserHandle(n),this._isInternalTool(this.activeTool)&&!this.activeTool.inAction&&(u||(t=this._findNodeUnderMouse(n),this._raiseMouseEvents(t,r)),!t&&this.selectionList[0]&&(t=this.selectionList[0]),ej.datavisualization.Diagram.Util.isPageEditable(this)&&this._checkToolToActivate(n,t))),(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)&&n.shiftKey&&(t=this._findNodeUnderMouse(n),!t&&this.selectionList[0]&&(t=this.selectionList[0]),this._checkToolToActivate(n,t)),this._toolToActivate==="panTool"?this.activeTool=this.tools[this._toolToActivate]:(this._toolToActivate==="move"&&(t=this._findNodeUnderMouse(n),t&&t.isLane&&ej.datavisualization.Diagram.Util.canMultiSelectOnLane(t)&&(this._toolToActivate="select",this._currentCursor="default",this._updateCursor())),i=this.tools[this._toolToActivate]||this.activeTool,this.activateTool(this._toolToActivate,i?i.singleAction:null)),this.activeTool.mousedown(n),this._focusedElement=this.activeTool._findNodeUnderMouse(n,!0)))},_mousemove:function(n){var f,i,t,r,u;if(this._getTouchEvent(n),this._mouseEventTriggered=!0,this._viewPort||(this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0)),n.type=="touchmove"&&n.originalEvent.touches.length>1)this._isPinching=!0;else if(this._isPinching=!1,i=null,f=this._isUserHandle(n),this.activeTool.inAction===!1&&this._selectedSymbol)this._addSymbolToDiagram(n);else{if(this._isInternalTool(this.activeTool)&&!this.activeTool.inAction?(f||(i=ej.datavisualization.Diagram.Util.isClassifier(n)?ej.datavisualization.Diagram.ClassifierHelper.getSelectableElementUnderMouse(n,this):this._findNodeUnderMouse(n),i&&(this._nodeUnderMouse&&this._nodeUnderMouse!=i&&!this._nodeUnderMouse.segments&&this.activeTool._showPort(this._nodeUnderMouse,!0),i.segments||this.activeTool._showPort(i))),!i&&this.selectionList[0]&&(i=this.selectionList[0]),ej.datavisualization.Diagram.Util.isPageEditable(this)&&this._checkToolToActivate(n,i),n.which==1&&n.buttons==1&&(this._focusedElement=this.activeTool._findNodeUnderMouse(n,!0))):(this.activeTool.inAction||(this._toolToActivate=this.activeTool.name,this._currentCursor=this.activeTool.cursor),t=ej.datavisualization.Diagram.Util.isClassifier(n)?ej.datavisualization.Diagram.ClassifierHelper.getDropableElementUnderMouse(n,this):this._findNodeUnderMouse(n),i),this._updateCursor(),t=t||this._findNodeUnderMouse(n),this.activeTool.mousemove(n),this._raiseMouseEvents(t,n),r=!1,this.activeTool.inAction){do if(t&&!ej.datavisualization.Diagram.Util.canAllowDrop(t))if(t.parent)t=this.nameTable[t.parent];else if(t.segments){r=!0;break}else if(t.container)break;else t=null;else break;while(t);this._nodeUnderMouse&&this._nodeUnderMouse.segments&&this._nodeUnderMouse!=t&&ej.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this._adornerLayer,this._adornerSvg);t&&t!=this._focusedElement&&t!=this.nodeUnderMouse&&(r||ej.datavisualization.Diagram.Util.canAllowDrop(t))?(u=this.getObjectType(t),this._focusedElement&&(this._focusedElement.isLane||this._focusedElement.isSwimlane||this._focusedElement.isPhase)&&u=="node"&&u=="connector"?this._nodeUnderMouse=null:this._nodeUnderMouse&&(this._nodeUnderMouse.isLane||this._nodeUnderMouse.isSwimlane||this._nodeUnderMouse.isPhase)&&t.segments||(this._nodeUnderMouse=t)):t&&t.container||(this._nodeUnderMouse=null)}else this._focusedElement||(this._nodeUnderMouse=t);this._initiateAutoScroll(n)}},_mouseup:function(n){var e,r,f,o,c,t,s,i,u,h;this._getTouchEvent(n);!this._isPinching&&n.originalEvent&&n.originalEvent.target&&this._invoke(n)&&(e=this._isForeignObject(n.originalEvent.target),!e&&this._isHyperLink(n)&&n.preventDefault(),this.activeTool instanceof ej.datavisualization.Diagram.PanTool?(document.onmousemove=null,document.onmouseup=null,(!ej.datavisualization.Diagram.Util.isPageEditable(this)||this.activeTool instanceof ej.datavisualization.Diagram.PanTool)&&!this.activeTool.inAction&&(t=this.activeTool._findNodeUnderMouse(n),t&&this._raiseEvent("itemClick",{actualObject:t,selectedObject:t,model:this.model,cancel:!1,event:n}),r=this._mousePosition(n.originalEvent),this._raiseEvent("click",{element:t,actualObject:this.getNode(this.activeTool.actualObject),count:this._getEventDetail(n),offsetX:r.x,offsetY:r.y,event:n}),this.activeTool instanceof ej.datavisualization.Diagram.PanTool&&(document.onmousemove=null,document.onmouseup=null))):n.target.id!==this._id+"_canvas_svg"||!this.activeTool.name!="panTool"&&this.activeTool.inAction||(r=this._mousePosition(n.originalEvent),this._raiseEvent("click",{element:this,actualObject:this.getNode(this.activeTool.actualObject),count:this._getEventDetail(n),offsetX:r.x,offsetY:r.y,event:n})),n.target&&!this._isAnimating&&(f=$(n.target).parents(".ej-d-icon-template"),f&&f.length&&(o=f[0],o.id.endsWith("_expander")&&(c=o.id.replace("_expander",""),t=this.nameTable[c],t&&(s=this.getObjectType(t),(s=="node"||s=="group")&&(this.clearSelection(),ej.datavisualization.Diagram.LayoutUtil.expandSubTree(this,t,t.name,!0,ej.datavisualization.Diagram.Util.canSelect(t))))))),!this._selectedSymbol||this._selectedSymbol.isLane||this._isNodeEnters?this._selectedSymbol&&this._isNodeEnters&&(i=this.findNode(this.selectionList[0].name),this.edgeTable?delete this.edgeTable:(u={},u=this._getChildTable(this.selectionList[0],u),this._selectedSymbol.type=="pseudoGroup"?h={type:"collectionchanged",object:this._updatePsedoGroupChildren(this._selectedSymbol),childTable:jQuery.extend(!0,{},u),changeType:"insert",category:"internal"}:this._selectedSymbol.isPhase||(h={type:"collectionchanged",object:jQuery.extend(!0,{},this._selectedSymbol),childTable:jQuery.extend(!0,{},u),changeType:"insert",category:"internal"}),this.addHistoryEntry(h),this._isDragg=!0),this._clearSelection(!0),this._selectedSymbol=null,delete this._isNodeEnters,i.type=="pseudoGroup"&&(this.nodes().push(i),this._nodes=$.extend(!0,[],this.nodes()),this.nameTable[i.name]=i,ej.datavisualization.Diagram.Util._updateGroupBounds(i,this)),this._addSelection(i)):(this._findLabelEditing=!0,this._dropSymbol(null,n),delete this._findLabelEditing,this._isDragg=!0),ej.browserInfo().name==="msie"&&this._doubleClickEvent&&(this.activeTool._isMouseDown=!0),this.activeTool.mouseup(n),this.activeTool instanceof ej.datavisualization.Diagram.TextTool||!document.activeElement||document.activeElement.id===this.element[0].id||this._isEditing||e||this.element[0].focus(),this._currentCursor=this.activeTool.cursor,this.activeTool.name==="move"&&this._focusedElement&&!ej.datavisualization.Diagram.Util.canSelect(this._focusedElement)?(this._currentCursor="default",this._updateCursor()):this._updateCursor());this._isSvgDropover&&($("#"+this.element[0].id+"_canvas").ejDroppable("instance")._mouseOver=!1);delete this._isSvgDropover;this._focusedElement=null;this._nodeUnderMouse=this._findNodeUnderMouse(n);delete this._scrollLeft;delete this._scrollTop;delete this._controlBBox;this._mouseEventTriggered=!1;this._isDragg=!1;delete this._viewPort;delete this._isDropOver;this._timeStamp=n.timeStamp},_doubleclick:function(n){var u,e,f,t,i,r;if(this._getTouchEvent(n),this._doubleClickEvent=!this._doubleClickEvent,t=this._nodeUnderMouse||this,u={element:this.getNode(t),cancel:!1,actualObject:this.getNode(this.activeTool.actualObject)},this._isEditing||this._raiseEvent("doubleClick",u),e=this.activeTool._drawingPolygon,this.activeTool.name!="panTool"&&(this._nodeUnderMouse&&this.activeTool._doubleClick(this._nodeUnderMouse),ej.datavisualization.Diagram.Util.isClassifier(n)&&(f=ej.datavisualization.Diagram.ClassifierHelper.getEditableElementUnderMouse(n,this)),ej.datavisualization.Diagram.Util.isPageEditable(this)&&!this.activeTool.inAction&&(this.selectionList.length>0||f||this.activeTool.selectedObject)&&!u.cancel&&!e)){if(t=this.activeTool.selectedObject?this.activeTool.selectedObject:this.selectionList[0]?this.selectionList[0]:f,t.type=="umlclassifier")for(i=0;i<t.children.length;i++)t.children[i]=typeof t.children[i]=="string"?this.nameTable[t.children[i]]:t.children[i],i!=t.children.length-t.children.length&&i==t.children.length-1&&(t.children[i].labels[0].text="\n---\n"+t.children[i].labels[0].text),i!=t.children.length-t.children.length&&i==t.children.length-2&&(t.children[i].labels[0].text="\n---\n"+t.children[i].labels[0].text),t.labels[0].text+=t.children[i].labels[0].text;this._isEditing||t.type=="pseudoGroup"||u.cancel||(this.activeTool._findLabelUnderMouse(n,!1,this._mousePosition(n.originalEvent),!0),t.labels&&t.labels.length>0&&(r=this.activeTool.getLabelUnderMouse(),r||(r=t.labels[0])),!this._isEditing&&t.type==="text"&&this._setLabelEditing(t.textBlock)?(this.scrollToNode(t),this._startEdit(t)):this._isEditing||t.isLane||t.isSwimlane||!(t.labels&&(t.labels.length===0||typeof t.labels.length=="undefined")||t.labels&&t.labels.length>0&&this._setLabelEditing(r))?t.isLane&&t.labels&&t.labels.length>0&&this._setLabelEditing(r)?t.labels&&t.labels.length>0?(this.scrollToNode(t),this._startEdit(t)):this.activeTool.selectedObject=null:t.isLane&&(this.activeTool.selectedObject=null):(this.scrollToNode(t),this._startEdit(t)))}this.activeTool._isMouseDown=!1},_documentmouseup:function(n){var i,t;this._getTouchEvent(n);i=this._selectedSymbol;this._removeMouseOverTooltip();this._viewPort||(this._viewPort=ej.datavisualization.Diagram.ScrollUtil._viewPort(this,!0));!this.activeTool||!this.activeTool.inAction||this.activeTool instanceof ej.datavisualization.Diagram.TextTool||this.activeTool instanceof ej.datavisualization.Diagram.ShapeTool&&this.activeTool._drawingPolygon||(this._selectedSymbol&&n.type!="mouseleave"&&(this._findLabelEditing=!0,this._dropSymbol(null,n),delete this._findLabelEditing,this._isDragg=!0),this.activeTool.mouseup(n,!0));i&&(n.keyCode!=27&&n.keyCode!=46&&(t=document.getElementsByClassName("e-paletteItem dragClone")[0],t!=null&&(t.style.display="block"),this._selectedSymbol=i),this._raiseEvent("dragLeave",{element:this.selectionList[0]}),this._mouseEventTriggered&&this._delete(this.selectionList[0]));this._isNodeEnters&&(delete this._isNodeEnters,this._selectedSymbol=null,t=document.getElementsByClassName("dragClone")[0],t!=null&&(t.style.display="block"));delete this._viewPort;delete this._isDropOver;this._mouseEventTriggered=!1;this._isDragg=!1},_invoke:function(n){if(n.originalEvent.target){var t=n.originalEvent.target.className;if(t&&typeof t=="string"&&(t=="edit"||t=="editBox"||t.indexOf("e-hhandle")>-1||t.indexOf("e-hhandlespace")>-1||t.indexOf("e-vhandle")>-1||t.indexOf("e-vhandlespace")>-1))return!1}return!0},_handleMouseWheel:function(n){var r,t,u,i,o,f,s,h,e;n.originalEvent.preventDefault&&n.originalEvent.preventDefault();r=new ej.datavisualization.Diagram.Point(0,0);this._isEditing&&this._endEdit();(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)?(r=this._mousePosition(n.originalEvent),n.originalEvent.wheelDelta>0||-40*n.originalEvent.detail>0?ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1+Number(this.zoomFactor()),0,0,r,!0):ej.datavisualization.Diagram.ZoomUtil.zoomPan(this,1/(1+Number(this.zoomFactor())),0,0,r,!0)):(t=0,u={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:this._viewPort},n.originalEvent.wheelDelta>0||-40*n.originalEvent.detail>0?(o=this._vScrollbar.model.minimum,f=this._scrollLimit()==="limited"&&this._vScrollOffset-this._scrollPixel>=this.model.pageSettings.scrollableArea.y*this._currZoom,this._vScrollOffset-this._scrollPixel>=o||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity||f?(this._updateScrollOffset(this._hScrollOffset,this._vScrollOffset-this._scrollPixel),i=!0,t=-this._scrollPixel):(this._updateScrollOffset(this._hScrollOffset,o),i=!0,t=0)):(s=this._vScrollbar.model.maximum,h=ej.datavisualization.Diagram.ScrollUtil._viewPort(this),f=this._scrollLimit()==="limited"&&(this.model.pageSettings.scrollableArea.y+this.model.pageSettings.scrollableArea.height)*this._currZoom>=this._vScrollOffset+this._scrollPixel+h.height,s>=this._vScrollOffset+this._scrollPixel||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity||f?(this._updateScrollOffset(this._hScrollOffset,this._vScrollOffset+this._scrollPixel),i=!0,t=this._scrollPixel):(this._updateScrollOffset(this._hScrollOffset,s),i=!0,t=0)),i&&(e={zoom:this._getCurrentZoom(),horizontalOffset:this._hScrollOffset,verticalOffset:this._vScrollOffset,viewPort:this._viewPort},(u.horizontalOffset!=e.horizontalOffset||u.verticalOffset!=e.verticalOffset)&&(this._eventCause.scrollChange=ej.datavisualization.Diagram.ScrollChangeCause.Pan,this._raiseEvent("scrollChange",{newValues:e,oldValues:u}))),this._updateEditBox(0,t))},_setActiveTool:function(n){var u=this._mousePosition(n),t,i,r;this.activeTool.inAction||!this._isUserHandleActive(this.activeTool.name)&&this.model.selectedItems.userHandles&&this.model.selectedItems.userHandles.length||(this._isInternalTool(this.activeTool)||this.activeTool.singleAction)&&(i=!1,this.selectionList[0]&&(t=this.selectionList[0],i=this._checkToolToActivate(n,t)),i||(t=this._findNodeUnderMouse(n),this._isUserHandle(n)?(r=$(n.target).parents("g").first().context.id.split("_")[0],this._checkToolToActivate(n,t),this.activeTool=this.tools[this._toolToActivate]):(this._checkToolToActivate(n,t),this._raiseMouseEvents(t),this._isUserHandleActive(this.activateTool.name)&&!this._drawingTool&&(this.activeTool=this.tools[this._toolToActivate]))))},_beginAutoScroll:function(n,t,i){var o=i?i:100,u=this,f=0,e=0,r=ej.datavisualization.Diagram.ScrollUtil._viewPort(this),s=this._hScrollbar.model.maximum+r.width,h=this._vScrollbar.model.maximum+r.height;if(this._canAutoScroll){switch(n){case"right":(this._hScrollOffset+r.width+10<s||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(f=10);break;case"left":(this._hScrollOffset-10>this._hScrollbar.model.minimum||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(f=-10);break;case"bottom":(this._vScrollOffset+r.height+10<h||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(e=10);break;case"top":(this._vScrollOffset-10>this._vScrollbar.model.minimum||this._scrollLimit()===ej.datavisualization.Diagram.ScrollLimit.Infinity)&&(e=-10)}u._clearTimeOutValue=window.setTimeout(function(i){var r=this,i={delay:o};u._raiseEvent("autoScrollChange",i);u._updateScrollBar(f,e,n,t,i.delay)},o)}},_updateScrollBar:function(n,t,i,r,u){if(this._clearTimeOutValue&&window.clearTimeout(this._clearTimeOutValue),n===0&&t===0)this._canAutoScroll=!1;else if(this.activeTool.inAction){var f=this._hScrollOffset+n*this._currZoom,e=this._vScrollOffset+t*this._currZoom,o=this._updateSelectionOnScroll(n,t);o?(this._updateScrollOffset(f,e),this._beginAutoScroll(i,r,u)):this._canAutoScroll=!1}},_updateSelectionOnScroll:function(n,t){var i=this.activeTool,r,f,e,u;if(i.name==="select")i.currentPoint=new ej.datavisualization.Diagram.Point(i.currentPoint.x+n,i.currentPoint.y+t),i._updateHelper();else if(i.name==="orthogonalLine"||i.name==="straightLine")i.currentPoint=new ej.datavisualization.Diagram.Point(i.currentPoint.x+n,i.currentPoint.y+t),i._targetPossibleConnection=i._currentPossibleConnection,i._targetPort=i._possibleConnectionPort,i._updateHelper();else if(this.selectionList.length>0){if(r=this.selectionList[0],r.isLane||(i.currentPoint=ej.datavisualization.Diagram.Point(i.currentPoint.x+n,i.currentPoint.y+t)),i.name==="move")if(!r.isLane&&i._outOfBoundsDrag(r,n,t))i._canMoveLabel?this._translateLabel(r,i.activeLabel,n,t):this._translate(r,n,t,this.nameTable);else return!1;else i.name==="resize"?(ej.datavisualization.Diagram.SnapUtil._removeGuidelines(this),i._updateSize(r,i.previousPoint,i.currentPoint)):i.name==="endPoint"&&(i.selectedSegment&&i._endPoint=="segmentEnd"?(f=i.currentPoint.x-i.previousPoint.x,e=i.currentPoint.y-i.previousPoint.y,i._updateAdjacentSegments(f,e)):(u=i._updatePoints(r),u.cancel||(i._disconnect(r),i._updateConnection(r,u.updateSelection))));i.previousPoint=ej.datavisualization.Diagram.Point(i.currentPoint.x,i.currentPoint.y);i._canMoveLabel||r.type=="phase"||(ej.datavisualization.Diagram.DiagramContext.update(r,this),this._updateSelectionHandle(!0),this._renderTooltip(r))}return!0},_isUserHandle:function(n){return n.target.parentNode.className.animVal==="userHandle"?!0:!1},_isUserHandleActive:function(n){var i=!1,t,r;if(this.model.selectedItems.userHandles&&this.model.selectedItems.userHandles.length>0)for(t=0,r=this.model.selectedItems.userHandles.length,t;t<r;t++)if(this.model.selectedItems.userHandles[t].name===n){i=!0;break}else i=!0;return i},_getEventDetail:function(n){return ej.browserInfo().name==="msie"?this._timeStamp?n.timeStamp-this._timeStamp>=300?1:2:1:n.originalEvent.detail},_raiseMouseEvents:function(n,t){var i,r;this._isEditing||(this._nodeUnderMouse&&(!n||this._nodeUnderMouse!=n)&&(i=document.getElementById(this.element[0].id+"_mouseovertooltipDiv"),i&&i.parentNode.removeChild(i),this._raiseEvent("mouseLeave",{element:this.getNode(this._nodeUnderMouse)}),this._nodeUnderMouse==null||this._nodeUnderMouse.segments||this.activeTool instanceof ej.datavisualization.Diagram.LineTool||this.activeTool._showPort(this._nodeUnderMouse,!0)),n&&this._nodeUnderMouse!==n&&this._raiseEvent("mouseEnter",{element:this.getNode(n)}),n&&(r={element:this.getNode(n)},this._raiseEvent("mouseOver",r),r.element&&!this.activeTool.inAction?this._renderMouseOverTooltip(n,t):this._removeMouseOverTooltip()))},_renderMouseOverTooltip:function(n,t){var v,i,w,h,c,l,y,p,a,nt,f,b,k;if(ej.datavisualization.Diagram.Util.canShowTooltip(n,this)&&(v=this.getObjectType(n),w=v=="node"||v=="group"?ej.datavisualization.Diagram.NodeConstraints:ej.datavisualization.Diagram.ConnectorConstraints,n.constraints&w.InheritTooltip?(i=this.model.tooltip,h=!0):i=n.tooltip,i&&(!h||this._tooltipTemplateId()))){a=this._getTooltipPosition(n,i,t,h);c=a.x;l=a.y;y=a.tx;p=a.ty;c=-this._hScrollOffset+c*this._currZoom;l=-this._vScrollOffset+l*this._currZoom;nt="left:"+c+"px; top:"+l+"px; display: block; position: absolute; pointer-events: none; transform:translate("+y+","+p+")";f=document.getElementById(this.element[0].id+"_mouseovertooltipDiv");f||(f=this._createMouseOverTooltip());f.style.left=c+"px";f.style.top=l+"px";f.style.transform="translate("+y+" ,"+p+")";f.style.display="block";f.style.position="absolute";$.templates&&(b=h?this._tooltipTemplateId():i.templateId,k=$.templates("#"+b).render(n));$(f).html(k);f.style.marginLeft=f.style.marginTop="0px";var u=this.element[0].getBoundingClientRect(),r=f.getBoundingClientRect(),d=this.model.scrollSettings.currentZoom,g=ej.datavisualization.Diagram.Util.bounds(n,this.activeTool.name=="rotatetool"?!0:!1);if(u.left>r.left||u.right<r.right){if((h?this._tooltipMode():i.relativeMode)=="mouse"||i.alignment.horizontal=="center")var s=u.left>r.left?"left":"right",o=s=="right"?r.right-u.right:u.left-r.left,e=s=="right"?-o-i.margin.right:i.margin.left+o;else(i.alignment.horizontal=="left"||i.alignment.horizontal=="right")&&i.alignment.vertical=="center"?(e=g.width*d+r.width+i.margin.left+i.margin.right,e=i.alignment.horizontal=="left"?e*1:e*-1):(s=i.alignment.horizontal,s=="center"&&(s=u.left>r.left?"left":"right"),o=s=="right"?r.right-u.right:u.left-r.left,e=s=="right"?-o-i.margin.right:i.margin.left+o);f.style.marginLeft=e+"px"}(u.bottom<r.bottom||u.top>r.top)&&((h?this._tooltipMode():i.relativeMode)=="mouse"||i.alignment.vertical=="center"?(s=u.top>r.top?"top":"bottom",o=s=="top"?r.top-u.top:r.bottom-u.bottom,e=s=="top"?i.margin.top-o:-(o+i.margin.bottom)):i.alignment.horizontal=="center"&&(i.alignment.vertical=="bottom"||i.alignment.vertical=="top")?(e=g.height*d+r.height+(i.margin.bottom+i.margin.top),e=i.alignment.vertical=="bottom"?e*-1:e*1):(o=i.alignment.vertical=="top"?u.top-r.top:u.bottom-r.bottom,e=i.alignment.vertical=="top"?i.margin.top+o:o-i.margin.bottom),f.style.marginTop=e+"px")}},_getTooltipPosition:function(n,t,i,r){var e=ej.datavisualization.Diagram.Util.bounds(n,!1),u,f,o,s,h;if((r?this._tooltipMode():t.relativeMode)=="object"){switch(r?this._horizontalTooltipAlignment():t.alignment.horizontal){case"left":u=e.x;u-=t.margin.left;o="-100%";break;case"right":u=e.right;u+=t.margin.right;o="0%";break;case"center":u=e.center.x;o="-50%"}switch(r?this._verticalTooltipAlignment():t.alignment.vertical){case"top":f=e.y;f-=t.margin.top;s="-100%";break;case"bottom":f=e.bottom;f+=t.margin.bottom;s="0%";break;case"center":f=e.center.y;s="-50%"}}else i&&(h=this._mousePosition(i),u=h.x+t.margin.left,f=h.y+t.margin.top);return{x:u,y:f,tx:o,ty:s}},_isHandle:function(n){var t=$(n.target).parent("g.handle");return t.length>0?!0:!1},_findNodeUnderMouse:function(n){var t=null,i;if(n.target){var r=$(n.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group"),f=n.target.className,u=n.target.id.split("_");if(u[u.length-1]=="lblbg")return;r&&(i=r.attr("class"),i&&(i==="ej-d-node"||i==="ej-d-group"||ej.datavisualization.Diagram.Util.isClassifier(n))?(t=this._findNode(r.attr("id")),t||(t=this._findNode(r.attr("id").split("_parentdiv")[0])),t&&t._isInternalShape&&t.parent&&this.nameTable[t.parent]&&this.nameTable[t.parent].type=="bpmn"&&(t=this.nameTable[t.parent])):i==="ej-d-connector"&&(t=this._findConnector(r.attr("id"))))}return t},_findConnectableNodeUnderMouse:function(n){var t=null,r,e,o,f,v,i,s,h;if(n&&n.type==="touchmove"){var c=this._mousePosition(n),l=ej.datavisualization.Diagram.Rectangle(c.x,c.y,0,0),a=ej.datavisualization.Diagram.SpatialUtil.findQuads(this._spatialSearch,l);for(r=0;r<a.length;r++)if(e=a[r],e.objects.length>0)for(o=0;o<e.objects.length;o++)if(f=e.objects[o],v=ej.datavisualization.Diagram.Util.bounds(f),ej.datavisualization.Diagram.Geometry.intersectsRect(l,v)&&!f.segments&&f.visible)return f}else{for(var p,y=$(n.target).parents(".ej-d-node,.ej-d-group"),u=y[0],r=1;u;)p=u.getAttribute("class"),t=this._findNode(u.getAttribute("id")),t||(t=this._findNode(u.getAttribute("id").split("_parentdiv")[0])),t&&(ej.datavisualization.Diagram.Util.canConnect(t)||!t.parent)?u=null:(u=y[r],r++);t&&(t.type=="umlclassifier"&&(i=this.activeTool.selectedObject),i&&i.sourceNode&&(s=this.nameTable[i.sourceNode]),i&&i.targetNode&&(h=this.nameTable[i.targetNode]),s&&(t=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(t,s,i,this)),h&&(t=ej.datavisualization.Diagram.ClassifierHelper.EnableorDisableConnection(t,h,i,this)))}return t},_isForeignObject:function(n){var t=n;if(t)while(t.parentNode!=null){if(t.tagName==="foreignObject"||typeof t.className=="string"&&t.className.split(" ").indexOf("foreignObject")!==-1)return t;t=t.parentNode}return null},_altKeyPressed:function(n){return n&ej.datavisualization.Diagram.KeyModifiers.Alt},_ctrlKeyPressed:function(n){return n&ej.datavisualization.Diagram.KeyModifiers.Control},_shiftKeyPressed:function(n){return n&ej.datavisualization.Diagram.KeyModifiers.Shift},_keydown:function(n){var u,t,i,r;this._isKeyDown=!0;this._removeMouseOverTooltip();var e=n.keyCode?n.keyCode:n.which,f=navigator.platform.match("Mac")?n.metaKey:n.ctrlKey,o=n.key;for(u in this.model.commandManager.commands)t=this.model.commandManager.commands[u],t&&t.gesture&&(t.gesture.keyModifiers||t.gesture.key)&&(t.gesture.key&&e!=t.gesture.key&&o!=t.gesture.key||t.gesture.keyModifiers&&(!(f||n.altKey||n.shiftKey)||this._altKeyPressed(t.gesture.keyModifiers)&&!n.altKey||this._shiftKeyPressed(t.gesture.keyModifiers)&&!n.shiftKey||this._ctrlKeyPressed(t.gesture.keyModifiers)&&!f)||(this._currentCommand=u,this._currentCommand!=="focusToNextItem"&&this._currentCommand!=="focusToPreviousItem"&&this._currentCommand!=="selectFocusedItem"&&(this._diagramElements=null,this._focusedElement=null,ej.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this._adornerSvg,this._adornerLayer)),t.execute&&t.canExecute&&(i=t.canExecute,typeof t.canExecute=="string"&&(i=ej.util.getObject(t.canExecute,window)),$.isFunction(i)&&i({model:this.model})&&(r=t.execute,typeof t.execute=="string"&&(r=ej.util.getObject(t.execute,window)),$.isFunction(r)&&r({keyDownEventArgs:n,parameter:t.parameter,model:this.model})))));this.activeTool.keydown(n);this._isKeyDown=!1},_keyup:function(n){var t=n.keyCode?n.keyCode:n.which;this._isEditing||t!==37&&t!==38&&t!==39&&t!==40||(this._currentState,delete this._currentState,n.preventDefault(),this.activeTool.inAction=!1,this._updateSelectionHandle())},_registerHistoryEvents:function(){this.historyManager.addEventHandler("collectionchanged",$.proxy(this._recordCollectionChanged,this));this.historyManager.addEventHandler("positionchanged",$.proxy(this._recordPinPointChanged,this));this.historyManager.addEventHandler("sizechanged",$.proxy(this._recordResizeChanged,this));this.historyManager.addEventHandler("rotationchanged",$.proxy(this._recordRotationChanged,this));this.historyManager.addEventHandler("endpointchanged",$.proxy(this._recordEndPointChanged,this));this.historyManager.addEventHandler("labelchanged",$.proxy(this._recordLabelChanged,this));this.historyManager.addEventHandler("groupingchanged",$.proxy(this._recordGroupChanged,this))},_svgdrop:function(n,t){var f,o,w,s,e,r,h,c;if(this._selectedSymbol&&ej.datavisualization.Diagram.Util.isPageEditable(this)){f={};o=n.originalEvent;o.preventDefault?o.preventDefault():o.returnValue=!1;var l=this._currZoom,a=$("#"+this.element[0].id).offset(),u=this._isTouchEvent(n);u.pageX||n.pageX||(n.originalEvent&&n.originalEvent.changedTouches?u=n.originalEvent.changedTouches[0]:n&&n.changedTouches&&(u=n.changedTouches[0]));var v=(u?u.pageX:n.pageX)+this._hScrollOffset-a.left,y=(u?u.pageY:n.pageY)+this._vScrollOffset-a.top,i=$.extend(!0,{},this._selectedSymbol),p=t.helper[0].getAttribute("paletteId"),b=$("#"+p).ejSymbolPalette("instance");if(p){if(this._selectedSymbol=null,i.name+=ej.datavisualization.Diagram.Util.randomId(),!i.isPhase&&i.segments)i.segments&&ej.datavisualization.Diagram.Util._translateLine(i,v,y),i=this.getNode(i);else if(!i.isPhase){if(w=$.extend(!0,{},b.nameTable),i.offsetX=v/l,i.offsetY=y/l,i._type==="group"){for(s=this._getChildren(i.children),e=0;e<s.length;e++)r=$.extend(!0,{},w[s[e]]),r.parent=i.name,r.name=i.name+r.name,s[e]=r.name,this.nameTable[r.name]=r,this.nodes().push(r),this._nodes=$.extend(!0,[],this.nodes()),this._updateQuad(this.nameTable[r.name]);i.height=i.width=0;this._updateChildBounds(i,this.nameTable)}i._type==="group"?i=this._getNewGroup(i):i.segments?i=this._getNewConnector(i):i.isPhase||i.type==="phase"||(i=this._getNewNode(i))}i&&i.isLane&&(this._cloneGroupNode(i,ej.datavisualization.Diagram.Util.randomId()),i=ej.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(i,this.nameTable));f={element:i,cancel:!1};this._raiseDropEvent(f);i&&i.isLane&&(h=ej.datavisualization.Diagram.SwimLaneHelper._createSwimlane(i,this),h&&h.isSwimlane&&(i=h));i.isPhase||(f.cancel||this.add(i),i=this.selectionList[0],this.scrollToNode(i),i.labels.length>0&&i.labels[0].mode==="edit"?(this._isEditing=!0,this.startLabelEdit(i,i.labels[0])):this.element[0].focus())}}else c=null,c=this._findNodeUnderMouse(n),f={element:t.helper,e:n,draggable:t.draggable,targetNode:c},this._raiseDropEvent(f)},_isTouchEvent:function(n){return n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"?n.originalEvent?n.originalEvent.changedTouches[0]:n.changedTouches[0]:n},_raiseDropEvent:function(n){n.source=this._symbolPalette?this._symbolPalette:null;n.objectType=n.source?ej.datavisualization.Diagram.ObjectTypes.Palette:ej.datavisualization.Diagram.ObjectTypes.Diagram;this._raiseEvent("drop",n);this._symbolPalette=null},_recordCollectionChanged:function(n,t){var s,o,y,r,e,l,h,f,u,i,c,a,v,p;if(this._isUndo=!0,this._isInsert=!0,s=n.changeType,n.isUndo&&(s=n.changeType=="insert"?"remove":"insert"),this._clearSelection(s=="insert"?!1:!0),s=="insert")if(n.object.container){for(i in n.childTable)u=n.childTable[i],this.nameTable[i]=u;r=n.object;r.isSwimlane?(this.nameTable[r.name]=r,r.width=0,r.height=0,this._swimlanePaste=!0,this._multipleAction=!0,this._eventCause.nodeCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange,this._pasteSwimlaneObj(r),delete this._swimlanePaste,this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange,this._addAssiciatedChildConnectors(r),delete this._multipleAction,this._clearSelection(!0)):r.isLane?(n.object&&n.object.parent&&(c=this.nameTable[n.object.parent]),c&&c&&(a=this.nameTable[c.parent]),a&&(this.activeTool.selectedObject=n.object,ej.datavisualization.Diagram.canvasHelper._addNewLane(this,r,a,!0,n.index),this._addAssiciatedChildConnectors(r),this._clearSelection(!0))):(this.add(r),this._addConnector(r,n))}else if(n.object.type!="pseudoGroup"){if(!n.object.segments){if(o=null,n.object.inEdges&&n.object.inEdges.length>0)for(i=0;i<n.object.inEdges.length;i++)this.nameTable[n.object.inEdges[i]]&&(this.nameTable[n.object.inEdges[i]].targetNode=n.object.name),n.targetPorts&&(o=n.targetPorts[n.object.inEdges[i]]),o&&this.nameTable[n.object.inEdges[i]]&&(this.nameTable[n.object.inEdges[i]].targetPort=o);if(n.object.outEdges&&n.object.outEdges.length>0)for(i=0;i<n.object.outEdges.length;i++)this.nameTable[n.object.outEdges[i]]&&(this.nameTable[n.object.outEdges[i]].sourceNode=n.object.name),n.sourcePorts&&(o=n.sourcePorts[n.object.outEdges[i]]),o&&this.nameTable[n.object.outEdges[i]]&&(this.nameTable[n.object.outEdges[i]].sourcePort=o)}n.object._type==="group"&&this._addChildren(n.object,n.childTable);n.object.isSwimlane&&(n.object=ej.datavisualization.Diagram.SwimLaneHelper._initSwimLane(n.object,this));this.add(n.object,n);n.object.parent&&(y=this.nameTable[n.object.parent]);n.object._type==="group"?(this._addConnector(n.object,n),this._addGroupConnector(n.object,n)):this._addConnector(n.object,n)}else{for(delete this.nameTable.multipleSelection,h=[],f=ej.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup"}),i=0;i<n.object.children.length;i++)u=typeof n.object.children[i]=="object"?n.object.children[i]:n.childTable[n.object.children[i]],u&&(l=this.getObjectType(u),l!=="group"||u.isSwimlane||this._addChildren(u,n.childTable),u.isSwimlane?(this._swimlanePaste=!0,this._isUndo=!0,u=this._pasteSwimlaneObj(u,n),delete this._swimlanePaste):l!="connector"?this.add(u,n):h.push(u),u&&f.children.push(u.name));for(i=0;i<h.length;i++)this.add(h[i],n);for(this._addGroupConnector(n.object,n),i=0;i<f.children.length;i++)if(r=this.nameTable[f.children[i]],r&&!r.segments){if(r.inEdges.length>0)for(e=0;e<r.inEdges.length;e++)this._isUndo?n.childTable[r.inEdges[e]].targetNode=r.name:this.nameTable[r.inEdges[e]].targetNode=r.name;if(r.outEdges.length>0)for(e=0;e<r.outEdges.length;e++)this._isUndo?n.childTable[r.outEdges[e]].sourceNode=r.name:this.nameTable[r.outEdges[e]].sourceNode=r.name}this._clearSelection();this.nodes().push(f);this._nodes=$.extend(!0,[],this.nodes());f.offsetX=n.object.offsetX;f.offsetY=n.object.offsetY;f.height=n.object.height;f.width=n.object.width;f.rotateAngle=n.object.rotateAngle;this.nameTable[f.name]=f;this.addSelection(f,!0)}else if(s=="remove")if(n.object.type=="pseudoGroup"||n.object.isLane)if(n.object.isLane)v=n.object,n.index||n.index==0||(p=null,n.object.isLane&&t&&(t.index=this._getRemoveIndex(n.object,!0))),this._remove(v);else for(i=0;i<n.object.children.length;i++)this._remove(this.nameTable[this._getChild(n.object.children[i])]);else return this._removeAdjacentConnections(n.object,n),n.object.isSwimlane||n.object.annotation?this._remove(this.nameTable[n.object.name]):this._remove(n.object),!0;this._groupUndo||(this._isUndo=!1);this._isInsert=!1;this.tools.move._isLane=!1},_addAssiciatedChildConnectors:function(n){var i=this._getChildren(n.children),r,u,t;if(i&&i.length>0)for(r=0,u=i.length;r<u;r++)t=this.nameTable[i[r]],t&&(this._addConnector(t),t.type==="group"&&this._addAssiciatedChildConnectors(t))},_updateRecordPinPoint:function(n,t,i){var r,o,u,s,h,c,l,e,v,a,f;if(n.type=="pseudoGroup"){for(h=n,c=this._getChildren(n.children),o=0;o<c.length;o++)u=this.nameTable[c[o]],s=t[c[o]],s&&(u.segments?(l=t[u.name],u.sourcePoint=l.sourcePoint,u.targetPoint=l.targetPoint,u.segments=jQuery.extend(!0,u.segments,l.segments)):(this._propertyChangeValues(u,s),this._translate(u,s.offsetX-u.offsetX,s.offsetY-u.offsetY,this.nameTable)),ej.datavisualization.Diagram.DiagramContext.update(u,this));this.selectionList[0]&&this.selectionList[0].name===h.name&&(this.selectionList[0].offsetX=h.offsetX,this.selectionList[0].offsetY=h.offsetY);ej.datavisualization.Diagram.SvgContext.updateSelector(h,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)}else n.segments?i?(r=t[n.name],n.sourcePoint=r.sourcePoint,n.targetPoint=r.targetPoint,n.segments=$.extend(!0,[],r.segments),ej.datavisualization.Diagram.DiagramContext.update(n,this)):(this._clearSelection(!0),r=this._findConnector(n.name),n.targetNode&&(e=this.nameTable[n.targetNode],ej.datavisualization.Diagram.Util.removeItem(e.inEdges,n)),n.sourceNode&&(e=this.nameTable[n.sourceNode],ej.datavisualization.Diagram.Util.removeItem(e.outEdges,n)),n.targetNode&&(e=this.nameTable[n.targetNode],e.inEdges.push(n.name)),n.sourceNode&&(e=this.nameTable[n.sourceNode],e.outEdges.push(n.name)),this._propertyChangeConnectorValues(r,n),r.targetNode=n.targetNode,r.sourceNode=n.sourceNode,r.targetPort=n.targetPort,r.sourcePort=n.sourcePort,r.sourcePoint=n.sourcePoint,r.targetPoint=n.targetPoint,r.segments=$.extend(!0,[],n.segments),ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.SvgContext.updateSelector(n,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints),this.addSelection(n,!0)):i?(r=t[n.name],this._translate(n,r.offsetX-n.offsetX,r.offsetY-n.offsetY,t),ej.datavisualization.Diagram.DiagramContext.update(r,this)):(r=this._findNode(n.name),this._clearSelection(!0),this._propertyChangeValues(r,n),n.parent&&(f=this.nameTable[n.parent]),f||(f=this.nameTable[r.parent],v=!0),f&&f.container?(ej.datavisualization.Diagram.canvasHelper._undoDragNode(this,this.nameTable[n.name],n),v&&(a=this.nameTable[f.parent.split("laneStack")[0]],a&&ej.datavisualization.Diagram.DiagramContext.update(a,this))):(this._translate(r,n.offsetX-r.offsetX,n.offsetY-r.offsetY,this.nameTable),n.parent&&ej.datavisualization.Diagram.Util._updateGroupBounds(this.nameTable[r.parent],this),r.parent&&(f=this.nameTable[r.parent],f&&r.parent&&n.parent==""&&(ej.datavisualization.Diagram.Util.removeChildFromGroup(f.children,r.name),this._delete(r),(n.type==="group"||n.type==="bpmn")&&this._initGroupNode(n,t),this.add(n))),n.parent&&(f=this.nameTable[n.parent],n.parent&&r.parent==""&&(this._delete(r),n=$.extend(!0,{},n),(n.type==="group"||n.type==="bpmn")&&this._initGroupNode(n,t),this.add(n)))),ej.datavisualization.Diagram.DiagramContext.update(r,this),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,r),this.addSelection(r,!0))},_propertyChangeValues:function(n,t){var r=n.offsetX===t.offsetX?"":"offsetX",u=n.offsetY===t.offsetY?"":"offsetY",i;r==="offsetX"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:r,oldValue:n.offsetX,newValue:t.offsetX},this._raisePropertyChange(i));u==="offsetY"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:u,oldValue:n.offsetY,newValue:t.offsetY},this._raisePropertyChange(i))},_propertyChangeResizeValues:function(n,t){var r=t.width===n.width?"":"width",u=t.height===n.height?"":"height",i;r==="width"&&(i={element:n,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:r,oldValue:n.width,newValue:t.width},this._raisePropertyChange(i));u==="height"&&(i={element:n,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:u,oldValue:n.height,newValue:t.height},this._raisePropertyChange(i))},_propertyChangeConnectorValues:function(n,t){var r=n.sourcePoint.x===t.sourcePoint.x||n.sourcePoint.y===t.sourcePoint.y?"":"sourcePoint",u=n.targetPoint.x===t.targetPoint.x||n.targetPoint.y===t.targetPoint.y?"":"targetPoint",i;r==="sourcePoint"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:r,oldValue:n.sourcePoint,newValue:t.sourcePoint},this._raisePropertyChange(i));u==="targetPoint"&&(i={element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:u,oldValue:n.targetPoint,newValue:t.targetPoint},this._raisePropertyChange(i))},_renderNodeOnLane:function(n,t){var i,u,r=this;r._views.forEach(function(f){var e;i=r._views[f];u=i.svg||i._canvas;t=i.svg.getElementById(n.parent);i.type=="overview"&&(e=!0);n._type==="group"?i.context.renderGroup(n,u,t||i.diagramLayer,r.nameTable,r,null,!0):r.getObjectType(n)==="node"&&i.context.renderNode(n,u,t||i.diagramLayer)})},_updateUndoObject:function(n,t){var i,u,r;t.parent&&(r=this.nameTable[t.parent]);r&&this._collectionContains(t.name,r.children)?(ej.datavisualization.Diagram.Util.removeChildFromGroup(r.children,t.name),n.parent&&(i=this.nameTable[n.parent]),i&&i.children&&!this._collectionContains(t.name,i.children)&&(i.children.push(n.name),this.nameTable[n.name].parent=i.name,i.isLane&&(u=this.tools.move,u._updateMargin(t,i)))):n.parent&&(r=this.nameTable[n.parent])},_collectionContains:function(n,t){for(var i=0;i<t.length;i++)if(typeof t[i]=="string"&&t[i]===n||t[i].name===n)return!0},_recordPinPointChanged:function(n){var t=n.object.node,i=n.object.childTable;(t||t.isSwimlane)&&this._updateRecordPinPoint(t,i)},_updateRecordRotation:function(n,t){var f,r,u,e,s,h,o,i;if(n.type=="pseudoGroup"){for(this._clearSelection(!0),this.nameTable[n.name]=n,i=this.nameTable[n.name],e=n.children,f=0;f<e.length;f++)r=this.nameTable[e[f]],u=t[e[f]],r&&(r.segments?(s=t[r.name],r.sourcePoint=s.sourcePoint,r.targetPoint=s.targetPoint):u&&(this._translate(r,u.offsetX-r.offsetX,u.offsetY-r.offsetY,this.nameTable),this._comparePropertyValues(r,"rotateAngle",{rotateAngle:u.rotateAngle}),this._rotate(r,u.rotateAngle-r.rotateAngle,this.nameTable)),ej.datavisualization.Diagram.DiagramContext.update(r,this));i&&(h=n.rotateAngle-i.rotateAngle,i.rotateAngle+=h,this.selectionList[0]&&(this.selectionList[0].rotateAngle=i.rotateAngle));this.nameTable[n.name]=n;this.addSelection(n,!0)}else o=null,n.parent&&(o=this.nameTable[n.parent]),o&&o.container?(i=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoRotateNode(this,i,n)):n&&(this._clearSelection(!0),i=this._findNode(n.name),this._comparePropertyValues(i,"rotateAngle",{rotateAngle:n.rotateAngle}),this._rotate(i,n.rotateAngle-i.rotateAngle,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(i,this),this.addSelection(i,!0))},_recordSizeChanged:function(n,t){var i=n.object.node,r=n.object.childTable;this._updateRecordSize(i,r,t)},_updateRecordSize:function(n,t,i){var r,o,e,h,c,u,s,f;if(this._clearSelection(!0),n._type!=="group"&&n.type!=="pseudoGroup"||n.isLane||n.isSwimlane||n.type==="bpmn")n.isLane||n.isSwimlane?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeLane(this,n,i)):n.type=="bpmn"&&n.container?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeNode(this,r,n)):(f=null,n.parent&&(f=this.nameTable[n.parent]),f&&f.container?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeNode(this,r,n)):n.segments||(r=this._findNode(n.name),this._propertyChangeResizeValues(r,n),this._translate(r,n.offsetX-r.offsetX,n.offsetY-r.offsetY,this.nameTable),this.scale(r,n.width/r.width,n.height/r.height,ej.datavisualization.Diagram.Point(r.offsetX,r.offsetY),this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(r,this),this.addSelection(r,!0)));else{for(n.type=="pseudoGroup"&&(this.nameTable[n.name]=n),r=this._findNode(n.name),h=this._getChildren(r.children),c=this._getChildren(n.children),o=0;h&&o<h.length;o++)u=this.nameTable[c[o]],e=t[c[o]],e&&(u.segments?(s=t[u.name],u.sourcePoint=s.sourcePoint,u.targetPoint=s.targetPoint,u.segments=$.extend(!0,[],s.segments)):(this._propertyChangeResizeValues(u,e),this._translate(u,e.offsetX-u.offsetX,e.offsetY-u.offsetY,this.nameTable),this.scale(u,e.width/u.width,e.height/u.height,ej.datavisualization.Diagram.Point(u.offsetX,u.offsetY),this.nameTable)));f=null;n.parent&&(f=this.nameTable[n.parent]);f&&f.container?(r=this._findNode(n.name),ej.datavisualization.Diagram.canvasHelper._undoResizeNode(this,r,n)):(r.offsetX=n.offsetX,r.offsetY=n.offsetY,r.width=n.width,r.height=n.height,this.activeTool.name=="resize"&&this.activeTool.inAction&&this.selectionList[0].type!="pseudoGroup"&&this.selectionList[0].type!="group"||this._updateAssociatedConnectorEnds(r,this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(r,this),this.addSelection(r,!0))}},_recordRotationChanged:function(n){var t=n.object.node,i=n.object.childTable;this._updateRecordRotation(t,i)},_recordEndPointChanged:function(n){this.clearSelection(!0);var t,i,r,u;n._isUndo?(t=i=n.undoObject,r=n.redoObject):(t=i=n.redoObject,r=n.undoObject);t=t.parent?this._findChildren(this.nameTable[t.parent],t.name):this._findConnector(t.name);r.targetNode&&(u=this.nameTable[r.targetNode],ej.datavisualization.Diagram.Util.removeItem(u.inEdges,r.name));r.sourceNode&&(u=this.nameTable[r.sourceNode],ej.datavisualization.Diagram.Util.removeItem(u.outEdges,r.name));i.targetNode&&(u=this.nameTable[i.targetNode],u.inEdges.push(i.name));i.sourceNode&&(u=this.nameTable[i.sourceNode],u.outEdges.push(i.name));this._propertyChangeConnectorValues(t,i);this._comparePropertyValues(t,"targetNode",{targetNode:i.targetNode});t.targetNode=i.targetNode;this._comparePropertyValues(t,"sourceNode",{sourceNode:i.sourceNode});t.sourceNode=i.sourceNode;this._comparePropertyValues(t,"targetPort",{targetPort:i.targetPort});t.targetPort=i.targetPort;this._comparePropertyValues(t,"sourcePort",{sourcePort:i.sourcePort});t.sourcePort=i.sourcePort;this._comparePropertyValues(t,"sourcePoint",{sourcePoint:i.sourcePoint});t.sourcePoint=i.sourcePoint;this._comparePropertyValues(t,"targetPoint",{targetPoint:i.targetPoint});t.targetPoint=i.targetPoint;t.segments=$.extend(!0,[],i.segments);this._updateEdges(t);this._dock(t,this.nameTable);ej.datavisualization.Diagram.Util._updateConnectorSegments(t,t.sourcePort,t.targetPort,this);ej.datavisualization.Diagram.DiagramContext._refreshSegments(t,this);ej.datavisualization.Diagram.Util.updateBridging(t,this);ej.datavisualization.Diagram.DiagramContext.update(t,this);this._updateConnectorBridging(t);this._addSelection(t,this._selectionContains(t)?!0:!1);this.selectionList[0]&&ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom);ej.datavisualization.Diagram.SvgContext.updateSelector(t,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints)},_recordLabelChanged:function(n){var t=this.nameTable[n.object.name];this._comparePropertyValues(t.labels[n.index?n.index:0],"text",{text:n.label});n.object.type==="text"?(t.textBlock.text=n.label,ej.datavisualization.Diagram.DiagramContext.updateTextBlock(t,t.textBlock,this)):t.type=="umlclassifier"?(this._clearSelection(!0),n.label=ej.datavisualization.Diagram.ClassifierHelper.getEditboxValue(n.label,t,this),t=ej.datavisualization.Diagram.ClassifierHelper.getClassifierNodeDimension(t,this),t.labels[n.index].text="",ej.datavisualization.Diagram.DiagramContext.update(t,this),this.addSelection(t,!0)):t.shape&&t.shape.type=="umlclassifier"?(t=ej.datavisualization.Diagram.ClassifierHelper.getUMLConnectorValue(t,n.label,t.labels[n.index]),ej.datavisualization.Diagram.DiagramContext.update(t,this)):t.labels[n.index]?(t.labels[n.index].text=n.label,ej.datavisualization.Diagram.DiagramContext.updateLabel(t,t.labels[n.index],this)):(t.labels[n.index]=ej.datavisualization.Diagram.Label({text:n.label}),ej.datavisualization.Diagram.DiagramContext.addNodeLabel(t,t.labels[n.index],null,this))},labelcollectionchanged:function(n){var t=this.nameTable[n.shape.name],i=t.labels;i.slice(0);n.isUndo?(ej.datavisualization.Diagram.Util.removeItem(t.labels,n.label),diagram._views.forEach(function(i){var u=diagram._views[i],f=u.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],r=$(f).find("#"+t.name+"_"+n.label.name+"_lblbg")[0];r&&r.parentNode.removeChild(r)})):ej.datavisualization.Diagram.DiagramContext.addLabel(t,n.label,this,n.index);this._raisePropertyChange({element:t,cause:ej.datavisualization.Diagram.ActionType.Unknown,propertyName:"labels",oldValue:i,newValue:t.labels})},_recordGroupChanged:function(n){var o=n.actionType,f,u,i,e,s,h,r,c,t;if(n.isUndo&&(n.actionType==="group"&&(o="ungroup"),n.actionType==="ungroup"&&(o="group")),this._clearSelection(o=="group"?!0:!1),f=this._getChildren(n.object.children),o==="group"){for(u=new ej.datavisualization.Diagram.Group(n.object),u.children=[],i=0;i<f.length;i++)u.children.push(f[i]),t=this.nameTable[f[i]],t.parent&&(s=this.nameTable[t.parent]),t.parent=u.name,r=this._svg.document.getElementById(f[i]),r&&r.parentNode.removeChild(r),t.parent&&(h=this.nameTable[t.parent]),this._raiseGroupChangeEvent(t,s,h,"group");this._eventCause.nodeCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange;this.add(u);this._addSelection(u)}else{for(e=n.object,r=this._svg.document.getElementById(e.name),r&&r.parentNode.removeChild(r),c=this._getChildren(e.children),i=0;i<c.length;i++)t=this.nameTable[c[i]],t.parent&&(s=this.nameTable[t.parent]),t.parent="",this._isUndo=!0,t.segments||(t._type=="group"?ej.datavisualization.Diagram.DiagramContext.renderGroup(t,this):ej.datavisualization.Diagram.DiagramContext.renderNode(t,this),this.nodes().indexOf(t)===-1&&(this.nodes().push(t),this._nodes=$.extend(!0,[],this.nodes()))),t.segments&&(ej.datavisualization.Diagram.DiagramContext.renderConnector(t,this),this.connectors().indexOf(t)===-1&&(this.connectors().push(t),this._connectors=$.extend(!0,[],this.connectors()))),this._isUndo=!1,this._nodes=$.extend(!0,[],this.nodes()),t.parent&&(h=this.nameTable[t.parent]),this._raiseGroupChangeEvent(t,s,h,"ungroup");this._removeElement(e);ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this._findNode(e.name));this._nodes=$.extend(!0,[],this.nodes())}},_recordNudgingChanges:function(n,t,i){var r,u;this._isUndo=!0;r=t.undoDirection;i&&(r=t.redoDirection);this._clearSelection(!0);n.type==="pseudoGroup"&&(u=ej.datavisualization.Diagram.Group(n),delete this.nameTable[u.name],this.nameTable[u.name]=n);this._addSelection(this.nameTable[n.name],!0);this.nudge(r,t.values);this._isUndo=!1},_recordPropertiesChanged:function(n,t,i,r){var u=this._getModifiedProperties(i=="port"||i=="label"?r:n,t),f;u&&Object.keys(u).length&&(i=="connector"&&((t.sourcePoint||t.sourceNode)&&(u.sourcePoint=n.sourcePoint,u.sourceNode=n.sourceNode,u.sourcePort=n.sourcePort),(t.targetPoint||t.targetNode)&&(u.targetNode=n.targetNode,u.targetPort=n.targetPort,u.targetPoint=n.targetPoint)),f={type:"propertiesChanged",values:u,category:"internal",object:n,elementType:i},f[i]=r,this.addHistoryEntry(f))},_recordAlignCommandChanges:function(n){var r,t,u,i;if(n&&n.values.length){for(r=0;r<n.values.length;r++)t=n.values[r],t.object&&t.delta&&(u={x:-t.delta.x,y:-t.delta.y},i=this.nameTable[this._getChild(t.object)],this._comparePropertyOnAlign(i,-t.delta.x,-t.delta.y),this._translate(i,-t.delta.x,-t.delta.y,this.nameTable),this._updateContainerOnNudge(i),t.delta=u,this._updateObject(i));this.nameTable[n.object.name]||(this.nameTable[n.object.name]=n.object);ej.datavisualization.Diagram.Util._updateGroupBounds(n.object,this);this._hasSelection()?ej.datavisualization.Diagram.SvgContext.updateSelector(n.object,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints):this.addSelection(n.object,!0)}},_recordPhaseCollectionChanged:function(n){n.undo?n.isAdded?n.phase&&this._removePhase(n.phase.name):n.phase&&this._addPhase(n.group,n.phase,n):n.isAdded?n.phase&&this._addPhase(n.group,n.phase,n):n.phase&&this._removePhase(n.phase.name);this._clearSelection(!0)},_recordSizeCommandChanges:function(n){var r,t,u,i;if(n&&n.values.length){for(r=0;r<n.values.length;r++)t=n.values[r],t.object&&t.values&&(u={width:t.object.width||t.object._width||0,height:t.object.height||t.object._height||0},i=this.nameTable[this._getChild(t.object)],this._comparePropertyValues(i,"height",{height:t.values.height}),this._comparePropertyValues(i,"width",{width:t.values.width}),this.scale(i,t.values.width/(i.width||i._width||0),t.values.height/(i.height||i.height||0),{x:i.offsetX,y:i.offsetY},this.nameTable),t.values=u,this._updateObject(i));this.nameTable[n.object.name]||n.object.type!="pseudoGroup"||(this.nameTable[n.object.name]=n.object);ej.datavisualization.Diagram.Util._updateGroupBounds(n.object,this);this._hasSelection()?ej.datavisualization.Diagram.SvgContext.updateSelector(n.object,this._adornerSvg,this._currZoom,this,this.model.selectedItems.constraints):this.addSelection(n.object,!0)}},_getModifiedProperties:function(n,t,i){var u,r;if(i=i||n,t&&Object.keys(t).length&&i){u={};for(r in t)(t[r]!=i[r]||typeof i[r]=="object")&&(u[r]=i[r]&&i[r]instanceof Array?i[r]:i[r]&&typeof i[r]=="object"?$.extend(!0,{},i[r]):i[r]);return u}},_addCollectionChangeToHistory:function(n){var t,i;n.parent==""&&(t={},this.selectionList&&this.selectionList.length>0&&(t=this._getChildTable(this.selectionList[0],t)),i={type:"collectionchanged",object:jQuery.extend(!0,{},n),childTable:jQuery.extend(!0,{},t),changeType:"insert",category:"internal"},this.addHistoryEntry(i))},_recordPhasesizeChanged:function(n){var t=$.extend(!0,{},n.undoObject),i=$.extend(!0,{},n.redoObject);n.undo?this._updatePhase({name:t.name,offset:t.offset}):this._updatePhase({name:i.name,offset:i.offset})},_recordPortsCollectionChanged:function(n){var u=n.changeType,i,f,r,t;if(n.isUndo&&(u=n.changeType=="insert"?"remove":"insert"),i=this.nameTable[n.object.name],u=="remove")for(t=0;t<n.collection.length;t++)for(ej.datavisualization.Diagram.Util.removeItem(i.ports,n.collection[t]),t=0;t<this._views.length;t++)f=this._views[t],r=this._views[f].svg.document.getElementById(i.name+"_"+n.collection[t].name),r&&r.parentNode.removeChild(r);else for(t=0;t<n.collection.length;t++)i.ports.push(n.collection[t]),ej.datavisualization.Diagram.DiagramContext.renderPort(i,n.collection[t],this)},_addSymbolToDiagram:function(n){var s,h,a,e,r,o,v;if(ej.datavisualization.Diagram.Util.isPageEditable(this)){var f=this._currZoom,y=$("#"+this.element[0].id).offset(),u=this._isTouchEvent(n);u.pageX||n.pageX||(n.originalEvent&&n.originalEvent.changedTouches?u=n.originalEvent.changedTouches[0]:n&&n.changedTouches&&(u=n.changedTouches[0]));var c=(u?u.pageX:n.pageX)+this._hScrollOffset-y.left,l=(u?u.pageY:n.pageY)+this._vScrollOffset-y.top,i=$.extend(!0,{},this._selectedSymbol),t;if(this._selectedSymbol&&(t=i,this._isNodeEnters?t.isSwimlane&&(this.nameTable[t.name]=t,t=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,t,{childTable:this.childTable,object:t}),this._addAssiciatedChildConnectors(t)):(t&&t.type!="pseudoGroup"&&(i.name+=ej.datavisualization.Diagram.Util.randomId()),i.segments?ej.datavisualization.Diagram.Util._translateLine(i,c/f,l/f):(this._cloneGroupNode(i,ej.datavisualization.Diagram.Util.randomId()),i._type==="group"?(s=ej.datavisualization.Diagram.Util._getChildrenBounds(i,this),ej.datavisualization.Diagram.Util._translate(i,c/f-s.x-s.height/2,l/f-s.y-s.width/2,this.nameTable,null,this)):(i.offsetX=c/f,i.offsetY=l/f),i.isLane&&(h=ej.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(i,this.nameTable),h.isLane=i.isLane,h.orientation=i.orientation,t=h),i.type=="bpmn"&&delete t.children)),t&&(a={element:t,cancel:!1},this._raiseEvent("dragEnter",a),!a.cancel))){if(this._isEditing&&(this._endEditing=!0,this._endEdit(),delete this._endEditing),t&&!this._isNodeEnters){if(t.isLane&&(t=ej.datavisualization.Diagram.ContainerHelper._initContainer(this,t),e=this.nameTable[this._getChild(t.children[0])],e&&t.labels&&e.labels.length>0))for(e.ports=[],r=0;r<e.labels.length;r++)e.labels[r].visible=!1;if(t.labels&&t.labels.length>0)for(r=0;r<t.labels.length;r++)t.labels[r].visible=!1}if(t.type!="pseudoGroup")t.isLane&&(this.nameTable[t.children[0]]._isHeader=!0),this.add(t);else{for(o=0;o<t.children.length;o++)this.add(t.children[o]),t.children[o]=t.children[o].name;for(v in this.edgeTable)this.nameTable[v]||this.add(this.edgeTable[v]);this._hasSelection()&&this._clearSelection(!0);this.nodes().push(t);this._nodes=$.extend(!0,[],this.nodes());this.nameTable[t.name]=t;ej.datavisualization.Diagram.Util._updateGroupBounds(t,this);this.addSelection(t,!0)}this._focusedElement=t;t.isLane&&ej.datavisualization.Diagram.SvgContext._hideNode(t,this._svg);this.element[0].focus();this._toolToActivate="move";document.getElementsByClassName("e-paletteItem dragClone")[0]&&$(".e-paletteItem.dragClone").css("display","none");this.activateTool("move",!1);this._symbolDrop=!0;this.activeTool.mousedown(n);this.activeTool.mousemove(n)}}delete this._symbolDrop},_removeSymbolFromDiagram:function(){if(this._selectedSymbol){var n=document.getElementsByClassName("e-paletteItem dragClone")[0];n!=null&&(n.style.display="block");this._remove(this.selectionList[0]);this._selectedSymbol=null}},_updateGroupChild:function(n){for(var i=n.children,t=0;t<n.children.length;t++)n.children[t]=this.nameTable[this._getChild(n.children[t])],n.children[t]&&n.children[t]._type==="group"&&this._updateGroupChild(n.children[t])},_dropSymbol:function(n,t){var f,i,o,u,r,e,s;if(ej.datavisualization.Diagram.Util.isPageEditable(this)){if(f=n||this.selectionList[0]||this.activeTool.selectedObject,i={element:this.getNode(f)},this._nodeUnderMouse&&(i.target=this._nodeUnderMouse),o=!1,i.target||(i.target=this.model),f&&f._type==="group"&&this._updateGroupChild(f),this._remove(f),this.nameTable[i.element.name]=i.element,this._selectedSymbol=null,u=n||i.element,r=this.activeTool._getMouseOverElement(t),this.activeTool._outOfBoundsDrag(u)&&ej.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this,this.activeTool.selectedObject,r)){if(this._raiseDropEvent(i),!i.cancel){if(this._isInsert=!0,u&&u.labels&&u.labels.length>0)for(e=0;e<u.labels.length;e++)u.labels[e].visible=!0;r&&r.container&&ej.datavisualization.Diagram.Util.canAllowDrop(r)&&!r.isSwimlane&&ej.datavisualization.Diagram.bpmnHelper.canAllowDropOnContainer(this.activeTool.selectedObject,r)&&(ej.datavisualization.Diagram.canvasHelper._addNodeToContainer(this,this.activeTool.selectedObject,r),this._raiseGroupChangeEvent(this.selectedObject,null,r,"group"));this._eventCause.nodeCollectionChange=this._eventCause.connectorCollectionChange=ej.datavisualization.Diagram.CollectionChangeCause.Drop;o=this.add(u);this.activeTool.selectedObject=this.selectionList[0];this._isInsert=!1}o?(s=this.nameTable[i.element.name],this._updateDroppedSymbol(s)):this.activeTool.selectedObject=null}else this.activeTool.selectedObject=null,delete this.nameTable[i.element.name],this._clearSelection(!0);ej.datavisualization.Diagram.Util.canDoSingleSelection(this)||(this._clearSelection(!0),this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan&&this.activateTool("panTool"))}},_updateDroppedSymbol:function(n){n&&this.selectionList.length>0&&(this.scrollToNode(n),n.labels.length>0&&n.labels[0].mode==="edit"&&!n.labels[0].readOnly?n.isPhase||n.isSwimlane||n.isLane||(this._isEditing=!0,this.startLabelEdit(n,n.labels[0])):this.element[0].focus(),this._nodeUnderMouse&&this._nodeUnderMouse.segments&&ej.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this._adornerLayer,this._adornerSvg))},_initiateAutoScroll:function(n){if(this.activeTool.inAction&&this.enableAutoScroll()&&!(this.activeTool instanceof ej.datavisualization.Diagram.RotateTool)){var r=this._viewPort,t=this._mousePosition(n,!0),i=this.model.pageSettings.autoScrollBorder;t.x+i.right>=r.width-18?(this._beginAutoScroll("right",n),this._canAutoScroll=!0):t.x<=i.left?(this._beginAutoScroll("left",n),this._canAutoScroll=!0):t.y+i.bottom>=r.height-18?(this._beginAutoScroll("bottom",n),this._canAutoScroll=!0):t.y<=i.top?(this._beginAutoScroll("top",n),this._canAutoScroll=!0):this._canAutoScroll=!1}},_updatePoints:function(n,t,i,r){var u=new ej.datavisualization.Diagram.Point(i.x-t.x,i.y-t.y);ej.datavisualization.Diagram.Geometry.isEmptyPoint(u)||n._updateEndPoint(u.x,u.y,r)},_cloneGroupNode:function(n,t,i){var r=null,u,e=n.children=this._getChildren(n.children),f;if(n._type==="group")for(f=0;f<e.length;f++)i?r=i[e[f]]:this._paletteTable&&(r=this._paletteTable[e[f]]),r&&(r=$.extend(!0,{},r),r._type==="group"&&this._cloneGroupNode(r,t),u=$.extend(!0,{},r),u.name+=t,u.parent=n.name,e[f]=u.name,this.nameTable[u.name]=u)},_addGroupConnector:function(n,t){var r,u,e,i,o,s,f;if(!n.segments)for(s=this._getChildren(n.children),e=0;e<s.length;e++)if(f=this.nameTable[s[e]],f){if(f.inEdges&&f.inEdges.length>0)for(r=f.inEdges,i=0,o=r.length;i<o;i++)u=t.edgeTable?t.edgeTable[r[i]]:t.childTable[r[i]],u&&!this.nameTable[u.name]&&this.add(u);if(f.outEdges&&f.outEdges.length>0)for(r=f.outEdges,i=0,o=r.length;i<o;i++)u=t.edgeTable?t.edgeTable[r[i]]:t.childTable[r[i]],u&&!this.nameTable[u.name]&&this.add(u)}},_addConnector:function(n,t){var r,u,i,f;if(!n.segments){if(n.inEdges&&n.inEdges.length>0)for(r=n.inEdges,i=0,f=r.length;i<f;i++)u=t?t.edgeTable[r[i]]:this.nameTable[r[i]],u.zOrder=-1,this.add(u);if(n.outEdges&&n.outEdges.length>0)for(r=n.outEdges,i=0,f=r.length;i<f;i++)u=t?t.edgeTable[r[i]]:this.nameTable[r[i]],u.zOrder=-1,this.add(u)}},_addChildren:function(n,t){for(var r,u=this._getChildren(n.children),i=0;i<u.length;i++)r=t[u[i]],r._type==="group"&&this._addChildren(r,t),this.nameTable[u[i]]=r,n.children[i]=r.name},_updateLabels:function(n,t){n.labels=t;for(var i=0;i<n.labels.length;i++)ej.datavisualization.Diagram.DiagramContext.updateLabel(n,n.labels[i],this)},_getNode:function(n,t){var i;return(i=t?typeof n=="object"?t[n.name]:t[n]:typeof n=="object"?this.nameTable[n.name]:this.nameTable[n],i||typeof n!="object"?i&&typeof n=="string"&&(i=t?t[n]:this.nameTable[n]):i=n,i)?i.isLane?ej.datavisualization.Diagram.SwimLaneHelper._mapObject(this,i,"lane"):i.isPhase||i.type==="phase"?ej.datavisualization.Diagram.SwimLaneHelper._mapObject(this,i,"phase"):i.isSwimlane?ej.datavisualization.Diagram.SwimLaneHelper._mapObject(this,i,"swimlane",t):i._type==="node"||i._type==="group"||i._type==="pseudoGroup"||this.getObjectType(i)=="node"?i:i:null},_updateEdges:function(n){var t;ej.datavisualization.Diagram.Util.isTargetConnected(n)&&(t=this.nameTable[n.targetNode],t&&t.inEdges.indexOf(n.name)==-1&&t.inEdges.push(n.name));ej.datavisualization.Diagram.Util.isSourceConnected(n)&&(t=this.nameTable[n.sourceNode],t&&t.outEdges.indexOf(n.name)==-1&&t.outEdges.push(n.name))},_updateChildrenEdges:function(n){for(var t,r=this._getChildren(n.children),i=0;i<r.length;i++)t=r[i],t.segments?(this._updateEdges(t),this._dock(t,this.nameTable)):t._type==="group"&&this._updateChildrenEdges(t)},_updateParent:function(n){for(var u,t,r=this._getChildren(n.children),i=0;i<r.length;i++)u=this.nodes().indexOf(this.nameTable[r[i]]),t=this.nameTable[r[i]],t=t.type!="bpmn"&&t.type!="connector"?this._getNewNode(t):t,t&&t._type==="group"?this._updateParent(t):t&&(t.parent=n.name,ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[t.name],this.nameTable[t.name]),ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,this.nameTable[t.name]),this.nameTable[t.name]=t,u!=-1&&(this.nodes()[u]=t)),this._updateQuad(this.nameTable[t.name])},_findPortAtPoint:function(n,t){var f,i,s,e,r,h,c,l,o,u,a;if(t)for(l=ej.datavisualization.Diagram.Util.bounds(t,!0),f=t.ports,u=0,a=f.length;u<a;++u)if(i=f[u],e=ej.datavisualization.Diagram.Size(i.size,i.size),r=ej.datavisualization.Diagram.Util._getPortPosition(i,l),o=ej.Matrix.identity(),ej.Matrix.rotate(o,t.rotateAngle,t.offsetX,t.offsetY),r=ej.Matrix.transform(o,r),h=r.x-i.size/2,c=r.y-i.size/2,s=ej.datavisualization.Diagram.Rectangle(h,c,e.width,e.height),ej.datavisualization.Diagram.Geometry.containsPoint(s,n))return ej.datavisualization.Diagram.Util.canConnect(i,!0)?i:null;return null},_findLabelAtPoint:function(n,t){var o,r=null,y,u,i,p,w,c,l,a,f,s,e,k=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],v=[],h,b;if(t&&(f=ej.datavisualization.Diagram.Util.bounds(t,!0),o=t.labels,o.length>0))for(r=o[0],h=0,b=o.length;h<b;h++)if(r=o[h],s=$(k).find("#"+t.name+"_"+r.name)[0],c=s?s.offsetWidth:0,l=s?s.offsetHeight:0,c||(c=f.width),l||(l=r.fontSize),u=ej.datavisualization.Diagram.Size(c,l),i=ej.datavisualization.Diagram.Util._getLabelPosition(r,f),i.x=f.x+i.x,i.y=f.y+i.y,e=ej.Matrix.identity(),t.segments?ej.Matrix.rotate(e,0,f.x+f.width/2,f.y+f.height/2):ej.Matrix.rotate(e,-t.rotateAngle,t.offsetX,t.offsetY),a=ej.Matrix.transform(e,n),e=ej.Matrix.identity(),ej.Matrix.rotate(e,-r.rotateAngle,i.x,i.y),a=ej.Matrix.transform(e,a),r.verticalAlignment==ej.datavisualization.Diagram.VerticalAlignment.Top?i.y+=u.height/2:r.verticalAlignment==ej.datavisualization.Diagram.VerticalAlignment.Bottom&&(i.y-=u.height/2),r.horizontalAlignment==ej.datavisualization.Diagram.HorizontalAlignment.Left?i.x+=u.width/2:r.horizontalAlignment==ej.datavisualization.Diagram.HorizontalAlignment.Right&&(i.x-=u.width/2),p=i.x-u.width/2,w=i.y-u.height/2,y=ej.datavisualization.Diagram.Rectangle(p,w,u.width,u.height),ej.datavisualization.Diagram.Geometry.containsPoint(y,a)&&v.push(r),h==o.length-1)return v.length?v[v.length-1]:null;return r},_getCurrentZoom:function(){return this._currZoom},_findNode:function(n){return this.nameTable[n]},_findPort:function(n,t){for(var r=n.ports,i=0,u=r.length;i<u;i++)if(r[i].name===t)return r[i];return null},_findLabel:function(n,t){for(var r=n.labels,i=0,u=r.length;i<u;i++)if(r[i].name===t)return r[i];return null},_findConnector:function(n){return this.nameTable[n]},_findChildren:function(n,t){for(var i,r,f=this._getChildren(n.children),u=0;u<f.length;u++)if(i=this.nameTable[f[u]],i){if(t==i.name)return i;if(i._type==="group"&&(r=this._findChildren(i,t),r))return r}return null},_removeLaneParent:function(n){var t,i;return n.isLane&&n.parent&&(t=this.nameTable[n.parent],t.children&&t.children.length===1&&t&&t.parent&&(i=this.nameTable[t.parent],i))?{remove:!0,node:i}:{remove:!1}},_delete:function(n){var u=!1,f,t,e,r,i,o,s;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(n=n||this.selectionList[0],n))if(!n.isPhase&&(n.type&&n.type!="phase"||n.segments||n._type=="node"||n._type=="pseudoGroup")||this._dropPhase){if(f=this._removeLaneParent(n),f.remove&&(n=f.node),this._selectedSymbol||this._removeAdjacentConnections(n),t=n,t.type=="pseudoGroup"){for(e=this._getChildren(t.children),this._multipleAction=!0,r=e.length-1;r>=0;r--)this._remove(this.nameTable[e[r]])&&(u=!0),this._isUndo=!0;delete this._multipleAction;this._isUndo=!1}else this._nodeUnderMouse===t&&(this._nodeUnderMouse=null),u=this._remove(t),t.container&&t.parent&&(i=this.nameTable[t.parent],i&&i.container&&i.container.type=="stack"&&(this._getChild(i.children[0])?(o=this._getSwimlane(t),o&&this._updateChildAdjacentConnectors(o,!0),ej.datavisualization.Diagram.DiagramContext.update(i,this)):(s=this.nameTable[i.parent],s&&this._remove(s))));u&&this._clearSelection()}else n.type&&n.type=="phase"&&(this._removePhase(n.name),this._clearSelection())},_removeAdjacentConnections:function(n,t){var u={},f={},e,o,i,s,r,h,t;if(u=this._getChildTable(n,u),f=this._getEdgeTable(n,f),!this._isUndo||t){if(e={},o={},!n.segments){if(n.outEdges&&n.outEdges.length>0)for(s=n.outEdges.length,r=0;r<s;r++)i=this.nameTable[n.outEdges[r]],i&&i.sourcePort&&(e[i.name]=i.sourcePort);if(n.inEdges&&n.inEdges.length>0)for(s=n.inEdges.length,r=0;r<s;r++)i=this.nameTable[n.inEdges[r]],i&&i.targetPort&&(o[i.name]=i.targetPort)}this._isUndo?(t.targetPorts=o,t.sourcePorts=e,t.edgeTable=f,t.childTable=u):(h=null,n.isLane&&(h=this._getRemoveIndex(n)),t={type:"collectionchanged",object:this._updatePsedoGroupChildren(n),index:h,childTable:jQuery.extend(!0,{},u),edgeTable:jQuery.extend(!0,{},f),sourcePorts:e,targetPorts:o,changeType:"remove",category:"internal"},n.isPhase||ej.datavisualization.Diagram.Util.canDelete(n)&&this.addHistoryEntry(t))}},_updatePsedoGroupChildren:function(n){var i=jQuery.extend(!0,{},n),r,t;if(n&&n.type=="pseudoGroup")for(t=0;t<i.children.length;t++)r=this.nameTable[this._getChild(i.children[t])],r&&r.isSwimlane&&(i.children[t]=this.getNode(r));return i},_getRemoveIndex:function(n){var t,r,i;if(n.parent&&(t=this.nameTable[n.parent],t&&t.children&&t.children.length>0))for(i in t.children)if(r=this._getChild(t.children[i]),r===this._getChild(n))return Number(i);return 0},_getSwimlaneHeader:function(n){var t;return n&&n.isSwimlane&&n.children&&n.children.length>0&&(t=this.nameTable[n.children[0]]),t},_addPhase:function(n,t,i){var r=this.nameTable[n],h=!1,f,o,e,a,u,l;if(r&&r.isSwimlane&&t&&(r&&r.orientation&&t.offset&&(r.orientation=="horizontal"?(f=r.offsetX-r.width/2,e=this._getFirstLane(r),e&&(f+=e.width),h=t.offset>r.width||r.offsetX-r.width/2+t.offset<f?!0:!1):r.orientation=="vertical"&&(f=r.offsetY-r.height/2,o=this._getSwimlaneHeader(r),o&&(f+=o.height),e=this._getFirstLane(r),e&&(f+=e.height),h=t.offset>r.height||r.offsetY-r.height/2+t.offset<f?!0:!1)),t.offset&&!h)){if(i&&i.islastPhase&&(a=i.phase,r.orientation==="horizontal"?r.width>t.offset&&(t.width+=r.width-t.offset,t.offset=r.width):r.height-o.height>t.offset&&(t.height+=r.height-o.height-t.offset,t.offset=r.height-o.height)),u=ej.datavisualization.Diagram.Phase(t),u.orientation=r.orientation,u.label=ej.datavisualization.Diagram.Label(t.label?t.label:{text:"Phase"}),u.parent=r.name,this.nameTable[u.name]&&(ej.datavisualization.Diagram.Util.removeItem(this.model.phases,this.nameTable[u.name]),delete this.nameTable[u.name]),i&&i.islastPhase){var s=this._getInsertIndex(u)+1,c=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,r),v=$.extend(!0,{},i.phaseObject.prevPhase);this._updateInsertPhase(u,v.name,r,s,i);ej.datavisualization.Diagram.SvgContext.renderphase(u,this._svg,this._diagramLayer,this,r);ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this);ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,this.nameTable[this._getChild(r.children[1])],!0);ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdatePhase(this,u)}else{var s=this._getInsertIndex(u)+1,c=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,r),v=$.extend(!0,{},this.nameTable[this._getChild(c[s-1])]);this._updateInsertPhase(u,c[s],r,s);ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this);ej.datavisualization.Diagram.SvgContext.renderphase(u,this._svg,this._diagramLayer,this,r);ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,this.nameTable[this._getChild(r.children[1])],!0);ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdatePhase(this,u)}this._isUndo||(l={type:"phasecollectionchanged",phase:u,category:"internal",group:r.name,isAdded:!0},this.addHistoryEntry(l))}this._clearSelection(!0)},_removePhase:function(n){var t=this.nameTable[n],s=!1,h=null,f,r,c,i,u,o,e,l;t&&(this._raiseChildrenPropertyChange(t),f=this.nameTable[t.parent.split("phaseStack")[0]],r=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,f),f&&r&&r.length>1&&(e=this,c=r.indexOf(t.name),this._views.forEach(function(t){var r=e._views[t],i=r.svg.getElementById(n+"_phase_g");i&&i.parentNode.removeChild(i)}),i=ej.datavisualization.Diagram.SwimLaneContainerHelper._getNextPhase(this,t),c===r.length-1&&(i=ej.datavisualization.Diagram.SwimLaneContainerHelper._getPrevPhase(this,t),h=$.extend(!0,{},{prevPhase:i,currPhase:t}),i.offset=t.offset,s=!0),f.orientation==="horizontal"?i.width+=t.width:i.height+=t.height,u=this.nameTable[n],ej.datavisualization.Diagram.Util.removeItem(this.nodes(),u),this._nodes=$.extend(!0,[],this.nodes()),o=this.nameTable[u.parent],delete this.nameTable[n],ej.datavisualization.Diagram.SvgContext._updatephase(i,this),ej.datavisualization.Diagram.Util.removeItem(r,t.name),ej.datavisualization.Diagram.Util.removeItem(o.children,u.name),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,o,!0),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdatePhase(this,t),e=this,this._views.forEach(function(t){var r=e._views[t],f=r.svg.getElementById(n);f&&f.parentNode.removeChild(f);var o=r.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],s=$(o).find("#"+u.name)[0],i=r.svg.getElementById(u.name);i&&i.parentNode&&i.parentNode.removeChild(i);s&&o.removeChild(s)}),this._isUndo||(l={type:"phasecollectionchanged",phase:t,group:f.name,category:"internal",phaseObject:h,islastPhase:s,isAdded:!1},this.addHistoryEntry(l))))},_getEdgeTable:function(n,t){var u,e,o,i,r,h,f,s;if(!n.segments){if(n._type==="group"||n._type==="pseudoGroup")for(h=this._getChildren(n.children),o=0;o<h.length;o++){if(f=this.nameTable[h[o]],f&&f.inEdges&&f.inEdges.length>0)for(u=f.inEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r));if(f&&f.outEdges&&f.outEdges.length>0)for(u=f.outEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r))}if(n.inEdges&&n.inEdges.length>0)for(u=n.inEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r));if(n.outEdges&&n.outEdges.length>0)for(u=n.outEdges,i=0,e=u.length;i<e;i++)r=this.nameTable[u[i]],r&&(s=t[r.name]=$.extend(!0,{},r))}return t},_remove:function(n,t,i){var l=!1,h,t,u,a,v,s,o,f,e,r,y,c;if(this._raiseChildrenPropertyChange(n),(ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&n&&(ej.datavisualization.Diagram.Util.canDelete(n)||i)&&(h=n.segments?"connector":"node",t=t?ej.datavisualization.Diagram.dependentconnector.dependent:ej.datavisualization.Diagram.dependentconnector.independent,u={changeType:"remove",element:this.getNode(n),cancel:!1,dependent:t,state:"changing"},n.segments||(u.adjustDependent=!0,u.deleteDependent=!0),a=this._eventCause[h+"CollectionChange"],a||(this._isKeyDown||this._isUndo)&&(this._eventCause[h+"CollectionChange"]=this._isUndo&&!this._multipleAction?ej.datavisualization.Diagram.CollectionChangeCause.HistoryChange:ej.datavisualization.Diagram.CollectionChangeCause.Keydown),n.isPhase||this._selectedSymbol||n.isLane||this._raiseEvent(h+"CollectionChange",u),!u.cancel)){if(l=!0,v=n.name,n.type=="group"&&n.type!="pseudoGroup")for(s=this._getChildren(n.children),o=0;o<s.length;o++)if(f=this.nameTable[s[o]],f&&!ej.datavisualization.Diagram.Util.canDelete(f))return;if(n.isSwimlane&&ej.datavisualization.Diagram.SvgContext._removephases(n,this),n.type=="bpmn")for(s=this._getChildren(n.children),o=0;s&&o<s.length;o++)if(f=this.nameTable[s[o]],f&&f.annotation&&f._annotation)for(e=0;e<f._annotation.length;e++)this.nameTable[f._annotation[e]]&&this._remove(this.nameTable[f._annotation[e]],t,!0);if(n.segments)this._removeEdges(n),n.sourceNode=n.sourcePort=n.targetNode=n.targetPort=null,this._crudDeleteNodes&&!this._selectedSymbol&&this._crudDeleteNodes.push(this.nameTable[n.name]),ej.datavisualization.Diagram.Util.removeItem(this.connectors(),this.nameTable[n.name]),this._connectors=$.extend(!0,[],this.connectors());else{if(n.annotation&&n._annotation)for(e=0;e<n._annotation.length;e++)this.nameTable[n._annotation[e]]&&this._remove(this.nameTable[n._annotation[e]]);this._disConnect(n,u);this._removeConnector(n,u);this._crudDeleteNodes&&!this._selectedSymbol&&this._crudDeleteNodes.push(this.nameTable[n.name]);ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.nameTable[n.name]);this._nodes=$.extend(!0,[],this.nodes())}h=this.getObjectType(n);ej.datavisualization.Diagram.SpatialUtil._removeFromaQuad(this._spatialSearch,this._spatialSearch.quadTable[n.name],n);ej.datavisualization.Diagram.SpatialUtil._updateBounds(this,this._spatialSearch,n,!1);n.parent&&(r=this.nameTable[n.parent],r&&(r.type=="group"||r.type=="bpmn"||r.type=="umlclassifier")&&(ej.datavisualization.Diagram.Util.removeChildFromGroup(r.children,n.name),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),y=$.extend(!0,{},r),ej.datavisualization.Diagram.ContainerHelper._updateCollectionChange(this,r,!0),r.parent&&ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,this.nameTable[r.parent]),ej.datavisualization.Diagram.Util._refreshParentGroup(n,this),ej.datavisualization.Diagram.canvasHelper._updateAddRemoveNodeConnectors(this,r,y),ej.datavisualization.Diagram.canvasHelper._updateAddRemoveLaneConnectors(this,n),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,this.nameTable[r.parent]),this._updateQuad(r)));delete this.nameTable[v];n.segments&&this._updateConnectorBridging(n);c=this._svg.getElementById(n.name);n._type=="group"&&n.type!="pseudoGroup"&&this._removeChildren(n,u);this._removeElement(n);c&&c.parentNode&&c.parentNode.removeChild(c);ej.datavisualization.Diagram.SvgContext._removeContainerHelper(this.activeTool.selectedObject,this._adornerSvg,this._adornerLayer);this._clearSelection(this._selectedSymbol||this._dropPhase?!0:!1)}return!l||n.isPhase||this._selectedSymbol||(u.state="changed",n.type==="connector"?this._raiseEvent("connectorCollectionChange",u):this._raiseEvent("nodeCollectionChange",u)),l},_removeConnector:function(n,t){var r,i,u;if(!n.segments){if(t.deleteDependent&&!t.adjustDependent){if(n.inEdges&&n.inEdges.length>0)for(r=n.inEdges,i=r.length-1;i>=0;i--)this._updateConnection(this.nameTable[r[i]],!0);if(n.outEdges&&n.outEdges.length>0)for(r=n.outEdges,i=0,u=r.length;i<u;i++)this._updateConnection(this.nameTable[r[i]],!0)}if(t.deleteDependent&&t.adjustDependent)if(n.inEdges&&n.inEdges.length>0&&n.outEdges&&n.outEdges.length>0){for(r=n.outEdges,i=r.length-1;i>=0;i--)this._updateConnection(this.nameTable[r[i]],!0);for(r=n.inEdges,i=r.length-1;i>=0;i--)this.nameTable[r[i]]&&this._updateConnection(this.nameTable[r[i]],!0)}else if(n.inEdges&&n.inEdges.length==0&&n.outEdges.length>0)for(r=n.outEdges,i=r.length-1;i>=0;i--)this._updateConnection(this.nameTable[r[i]],!0);else if(n.outEdges&&n.outEdges.length==0&&n.inEdges.length>0)for(r=n.inEdges,i=r.length-1;i>=0;i--)this.nameTable[r[i]]&&this._updateConnection(this.nameTable[r[i]],!0);else if((n.inEdges&&n.inEdges.length==1||n.inEdges.length>1)&&n.outEdges.length==1)for(r=n.outEdges,i=0,u=r.length;i<u;i++)this._updateConnection(this.nameTable[r[i]],!0);else if(!(n.inEdges&&n.inEdges.length>1&&n.outEdges.length>1))for(r=n.inEdges,i=0,u=r.length;i<u;i++)this._updateConnection(this.nameTable[r[i]],!0)}},_updateConnection:function(n,t){n&&ej.datavisualization.Diagram.Util.canDelete(n)&&(this._remove(n,t),this.updateConnector(n.name))},_removeElement:function(n){for(var i,t=0;t<this._views.length;t++)i=this._views[t],this._views[i].context.removeChild(n,this._views[i])},_disConnect:function(n,t,i){var u,f,s,c,h,l,r,o,e,v,a;if(n.inEdges&&n.inEdges.length>0)for(u=n.inEdges,r=0,e=u.length;r<e;r++)ej.datavisualization.Diagram.Util.canDelete(this.nameTable[u[r]])&&(a=!0);if(n.outEdges&&n.outEdges.length>0)for(f=n.outEdges,r=0,e=f.length;r<e;r++)ej.datavisualization.Diagram.Util.canDelete(this.nameTable[f[r]])&&(a=!0);if(t.deleteDependent&&t.adjustDependent&&!i&&a){if(n.inEdges&&n.inEdges.length>0&&n.outEdges.length>0)if(u=n.inEdges,f=n.outEdges,(n.inEdges.length>1||n.inEdges.length==1)&&n.outEdges.length==1){for(r=0,e=u.length;r<e;r++)this.nameTable[u[r]]&&this.nameTable[f[0]]&&this.nameTable[u[r]].targetNode==this.nameTable[f[0]].sourceNode&&(h=this.nameTable[this.nameTable[f[0]].targetNode],h&&(l=$.extend(!0,{},h),this.nameTable[u[r]].sourceNode!=this.nameTable[f[0]].targetNode&&(this.nameTable[u[r]].targetNode=this.nameTable[f[0]].targetNode,this.nameTable[u[r]].targetPort=this.nameTable[f[0]].targetPort,h.inEdges.push(this.nameTable[u[r]].name))),ej.datavisualization.Diagram.Util.dock(this.nameTable[u[r]],this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[u[r]],this));this.nameTable[f[0]]&&(this.nameTable[f[0]].sourceNode=null,this.nameTable[f[0]].sourcePort=null)}else if(!(n.inEdges.length>1&&n.outEdges.length>1))for(r=0,e=u.length;r<e;r++)if(n.outEdges.length>0&&this.nameTable[u[r]]){for(c=this.nameTable[this.nameTable[u[r]].sourceNode],l=$.extend(!0,{},c),o=0,v=f.length;o<v;o++)this.nameTable[u[r]].targetNode==this.nameTable[f[o]].sourceNode&&(this.nameTable[f[o]].sourceNode=this.nameTable[u[r]].sourceNode,this.nameTable[f[o]].sourcePort=this.nameTable[u[r]].sourcePort,c.outEdges[l.outEdges.length+o]=this.nameTable[f[o]].name,ej.datavisualization.Diagram.Util.dock(this.nameTable[f[o]],this.nameTable),ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[f[o]],this));this.nameTable[u[r]].targetNode=null;this.nameTable[u[r]].targetPort=null}return}if(n.inEdges&&n.inEdges.length>0)for(u=n.inEdges,r=0,e=u.length;r<e;r++)s=this.nameTable[u[r]],s&&(s.targetNode=null,s.targetPort=null);if(n.outEdges&&n.outEdges.length>0)for(f=n.outEdges,r=0,e=f.length;r<e;r++)s=this.nameTable[f[r]],s&&(s.sourceNode=null,s.sourcePort=null)},_removeEdges:function(n){n.targetNode&&this.nameTable[n.targetNode]&&this.nameTable[n.targetNode].inEdges&&ej.datavisualization.Diagram.Util.removeItem(this.nameTable[n.targetNode].inEdges,n.name);n.sourceNode&&this.nameTable[n.sourceNode]&&this.nameTable[n.sourceNode].outEdges&&ej.datavisualization.Diagram.Util.removeItem(this.nameTable[n.sourceNode].outEdges,n.name)},_selectionContains:function(n){if(this._hasSelection()&&n)for(var t=0;t<this.selectionList.length;t++)if(n.name===this.selectionList[t].name)return!0;return!1},_getPhaseIndex:function(n){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getPhaseIndex(this,n)},_getPhaseBounds:function(n){return ej.datavisualization.Diagram.SwimLaneContainerHelper._getPhaseBounds(this,n)},_addSelection:function(n,t){var s,o,u,c,a,i,l,h;if((ej.datavisualization.Diagram.Util.isPageEditable(this)||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&(ej.datavisualization.Diagram.Util.canDoSingleSelection(this)||n&&n._type==="pseudoGroup"||this._selectedSymbol||ej.datavisualization.Diagram.Util.canEnableAPIMethods(this))&&n&&(ej.datavisualization.Diagram.Util.canSelect(n)||n.type=="phase")&&!this._selectionContains(n)){var f=[],r=[],e=[];if(this._previousSelectedItems&&(r=this._previousSelectedItems),n.type=="pseudoGroup")for(s=this._getChildren(n.children),o=0;o<s.length;o++)u=this.nameTable[s[o]],r.indexOf(u)==-1?f.push(u):ej.datavisualization.Diagram.Util.removeItem(r,u),e.push(u);else f.push(n),e.push(n);c=this._eventCause.selectionChange;c||(this._eventCause.selectionChange=ej.datavisualization.Diagram.SelectionChangeCause.Unknown);a=this.getNode(n);i={changeType:"insert",element:this.getNode(n),state:"changing",selectedItems:e,oldItems:r,newItems:f,cancel:!1};this._selectedSymbol&&!this._endEditing||t||(this._raiseEvent("selectionChange",i),this._previousSelectedItems=i.newItems);i.cancel||(this.selectionList.push(n),this._updateSelectorObject(n),n.isPhase&&(l=this._getPhaseBounds(n)),ej.datavisualization.Diagram.SvgContext.renderSelector(n,this._adornerSvg,this._adornerLayer,this._currZoom,this.model.selectedItems.constraints,l),this.model.selectedItems.userHandles!=null&&this.model.selectedItems.userHandles.length>0&&(h=!1,n.type=="pseudoGroup"&&(h=!0),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.renderUserHandles(this.model.selectedItems.userHandles,n,this._adornerSvg,h,this._currZoom,this._adornerLayer,this)),this._selectedSymbol&&!this._endEditing||t||(i={changeType:"insert",element:this.getNode(n),state:"changed",cause:i.cause,selectedItems:e,oldItems:r,newItems:f,cancel:!1},this._raiseEvent("selectionChange",i)))}},_getInsertIndex:function(n){var f=-1,u,i,e=this.nameTable[n.parent],t=ej.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this,e),r;if(t&&t.length>0&&this.nameTable[t[0]])for(u=this.nameTable[t[0]].offset,r=0;r<t.length;r++)i=this.nameTable[t[r]],i&&i.offset<=n.offset&&i.offset>=u&&(u=i.offset,f=r);return f},_updateInsertPhase:function(n,t,i,r,u){var c=this.nameTable[t],o=this.nameTable[this._getChild(i.children[1])],e,f,s,l,h,a;o&&o.children&&o.children.length>0&&(e=this.nameTable[t],f=ej.datavisualization.Diagram.Node(n),i.isSwimlane&&i.orientation&&i.orientation=="vertical"?(u?(s=n.height,e.height=u.phaseObject.prevPhase.height,e.offset=u.phaseObject.prevPhase.offset):(s=e.height,e.height=c.offset-n.offset,l=s-e.height,f.height=l),f.parent=o.name,f.name=n.name,f.width=e.width,f.isPhase=!0):(u?(h=n.width,e.width=u.phaseObject.prevPhase.width,e.offset=u.phaseObject.prevPhase.offset):(h=e.width,e.width=c.offset-n.offset,a=h-e.width,f.width=a),f.parent=o.name,f.name=n.name,f.height=e.height,f.isPhase=!0),f.x=0,f.y=0,this._isUndo&&f.labels.length!==0||(f.labels=[n.label?n.label:ej.datavisualization.Diagram.Label()]),f.labels[0].rotateAngle=n.orientation=="horizontal"?0:270,f.constraints=ej.datavisualization.Diagram.NodeConstraints.Default&~(ej.datavisualization.Diagram.NodeConstraints.Select|ej.datavisualization.Diagram.NodeConstraints.Connect),f.isPhase=!0,f._type="node",this.add(f,{entryHistory:!0}),o.children.pop(f.name),o.children.splice(r,0,f.name))},_getFirstLane:function(n){var t,i,r;return(n.children[2]&&(t=this.nameTable[this._getChild(n.children[2])]),t&&t.children&&t.children.length>0&&(i=this.nameTable[this._getChild(t.children[0])],i&&i.children&&i.children.length>0&&(r=this.nameTable[this._getChild(i.children[0])],r)))?r:null},updateSelector:function(n){if(this._selectedItem!=""){var t={};n.offsetX&&(t.offsetX=Number(typeof n.offsetX=="function"?n.offsetX():n.offsetX));n.offsetY&&(t.offsetY=Number(typeof n.offsetY=="function"?n.offsetY():n.offsetY));n.width&&(t.width=Number(typeof n.width=="function"?n.width():n.width));n.height&&(t.height=Number(typeof n.height=="function"?n.height():n.height));n.rotateAngle&&(t.rotateAngle=Number(typeof n.rotateAngle=="function"?n.rotateAngle():n.rotateAngle));this.updateNode(this._selectedItem,t)}n.userHandles&&(this.model.selectedItems.userHandles=n.userHandles,this._initHandles(),this.selectionList[0]&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.updateUserHandles(this.model.selectedItems.userHandles,this.selectionList[0],this._adornerSvg,this.selectionList[0].type=="pseudoGroup",!1,this._currZoom,this));n.tooltip&&(this.model.selectedItems.tooltip=ej.datavisualization.Diagram.Tooltip($.extend(!0,this.model.selectedItems.tooltip,{},n.tooltip)))},_updateSelectorObject:function(n){var i,t;if(n.segments||(this._selectorOffsetX(n.offsetX),this._selectorOffsetY(n.offsetY),this._selectorWidth(n.width),this._selectorHeight(n.height),this._selectorRotateAngle(n.rotateAngle),this._selectedItem=n.name),n.type=="pseudoGroup")for(i=0;i<n.children.length;i++)t=n.children[i],typeof t=="object"?this.model.selectedItems.children.indexOf(t)<0&&this.model.selectedItems.children.push(t):typeof t=="string"&&this.model.selectedItems.children.indexOf(this.nameTable[t])<0&&this.model.selectedItems.children.push(this.nameTable[t]);else this.model.selectedItems.children.indexOf(n)<0&&this.model.selectedItems.children.push(n)},_clearSelectorObject:function(){this._selectorOffsetX(0);this._selectorOffsetY(0);this._selectorWidth(0);this._selectorHeight(0);this._selectorRotateAngle(0);this._selectedItem="";this.model.selectedItems.children=[]},_raiseEvent:function(n,t){if(this.model[n])return t.elementType=this.getObjectType(t.element),((n==="nodeCollectionChange"||n==="connectorCollectionChange"||n==="selectionChange")&&t.state==="changing"||n==="scrollChange")&&(t.cause=this._eventCause[n]?this._eventCause[n]:"unknown"),this._multipleAction||(this._eventCause={}),t.diagramId=this.element[0].id,this._trigger(n,t)},_clearSelection:function(n){if(this._hasSelection()){this._isEditing&&this.selectionList.length>0&&!this._isDragg&&this._endEdit();var t={changeType:"remove",state:"changing",element:null,selectedItems:[],oldItems:this.model.selectedItems.children,newItems:[],cancel:!1};this._selectedSymbol||n||(this._raiseEvent("selectionChange",t),this._previousSelectedItems=[]);t.cancel||(this._clearSelectorObject(),this.selectionList[0]&&this.selectionList[0].type=="pseudoGroup"&&(ej.datavisualization.Diagram.Util.removeItem(this.nodes(),this.selectionList[0]),this._nodes=$.extend(!0,[],this.nodes()),delete this.nameTable[this.selectionList[0].name]),ej.datavisualization.Diagram.Util.clear(this.selectionList),ej.datavisualization.Diagram.SvgContext.clearSelector(this._adornerSvg,this._adornerLayer),this._selectedSymbol||n||(t={changeType:"remove",state:"changed",cause:t.cause,element:null,selectedItems:[],oldItems:this.model.selectedItems.children,newItems:[],cancel:!1},this._raiseEvent("selectionChange",t)))}},_updateSelectionHandle:function(n){var t,i,u,r;this.selectionList.length>0&&(t=this.nameTable[this.selectionList[0].name],i=this.model.selectedItems.constraints,n&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&(i=i&~ej.datavisualization.Diagram.SelectorConstraints.UserHandles),this._updateSelectorObject(t),u=ej.datavisualization.Diagram.SvgContext.updateSelector(t,this._adornerSvg,this._currZoom,this,i),u||this.model.selectedItems.userHandles!=null&&this.model.selectedItems.userHandles.length>0&&(r=!1,t.type=="pseudoGroup"&&(r=!0),this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.UserHandles&&ej.datavisualization.Diagram.SvgContext.updateUserHandles(this.model.selectedItems.userHandles,t,this._adornerSvg,r,n,this._currZoom,this)))},_hasSelection:function(){return this.selectionList.length>0},_checkToolToActivate:function(n,t){var i=!1,r,e,f,u,o,s;return r=ej.datavisualization.Diagram.Util._getPseudoGroupConstraints(this,t,this.selectionList[0]),t?((t.segments&&(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)&&n.shiftKey||(navigator.platform.match("Mac")?n.metaKey:n.ctrlKey)&&n.altKey)&&(this._toolToActivate="endPoint",this._currentCursor="move",i=!0),i||(this._selectionContains(t)?(t.segments?i=this._canActivateEndPointTool(n,t):((!r||r&ej.datavisualization.Diagram.NodeConstraints.Resize)&&(i=this._canActivateResizeTool(n,t)),i||(!r||r&ej.datavisualization.Diagram.NodeConstraints.Rotate)&&(i=this._canActivateRotateTool(n,t))),i||(i=this._canActivateUserHandle(n,t)),i||(!r||r&ej.datavisualization.Diagram.NodeConstraints.Drag)&&(t&&t.isLane&&ej.datavisualization.Diagram.Util.canMultiSelectOnLane(t)?(this._toolToActivate="select",this._currentCursor="default"):i=this._canActivateMoveTool(n,t)),i||(i=this._canActivatephaseTool(n))):(n&&n.target&&n.target.getAttribute("class")==="ej-d-port"&&(e=this._mousePosition(n),f=this._findPortAtPoint(e,t),f&&f.constraints&ej.datavisualization.Diagram.PortConstraints.ConnectOnDrag&&f.visibility&ej.datavisualization.Diagram.PortVisibility.Visible&&(this._currentCursor="crosshair",u=this.model.drawType,o=u.segments&&u.segments.length&&u.segments[0].type?u.segments[0].type:"orthogonal",o==="orthogonal"?this.activateTool("orthogonalLine",!0):this.activateTool("straightLine",!0),i=!0)),(!r||r&ej.datavisualization.Diagram.NodeConstraints.Drag)&&(i=this._canActivateMoveTool(n,t))))):i=this._canActivatephaseTool(n),i||(this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan?(this.tool()&ej.datavisualization.Diagram.Tool.SingleSelect&&(s=this._findNodeUnderMouse(n),s&&(this._toolToActivate="select",this._currentCursor="default",i=!0)),i||(this._toolToActivate="panTool",this._currentCursor="pointer")):(this._toolToActivate="select",this._currentCursor="default")),this._toolToActivate!="rotate"&&this._adornerSvg.document.removeAttribute("class"),i},_canActivatephaseTool:function(n){if($(n.target).parents(".ej-d-seperator").first()[0]){var r=$(n.target).parents("g").first()[0].id,t=this._getSeperetor(r.split("_phase_g")[0]),i=this.nameTable[t.parent.split("phaseStack")[0]];if(i&&ej.datavisualization.Diagram.Util.canResize(i))return this._currentCursor=t?t.orientation=="horizontal"?"e-resize":"n-resize":"default",this._toolToActivate="phase",!0}},_canActivateUserHandle:function(n){if(this._isUserHandle(n)&&n.target){var t=n.target.id.split("_")[0];return this._toolToActivate=t,this._currentCursor=this.tools[this._toolToActivate].cursor,!0}return!1},_canActivateEndPointTool:function(n,t){if(t){var i=n.target.getAttribute("class");if(i&&(i==="targetEndPoint"&&ej.datavisualization.Diagram.Util.canDragTargetEnd(t)||i==="sourceEndPoint"&&ej.datavisualization.Diagram.Util.canDragSourceEnd(t)||(i.match("bezierpoint")||i=="segmentEnd")&&ej.datavisualization.Diagram.Util.canDragSegmentThumbs(t)))return this._toolToActivate="endPoint",this._currentCursor="move",!0}return!1},_canActivateResizeTool:function(n,t){var i=n.target.getAttribute("class");return ej.datavisualization.Diagram.Util.canResize(t,i)&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.Resizer&&(i==="nw-resize"||i==="n-resize"||i==="ne-resize"||i==="w-resize"||i==="e-resize"||i==="sw-resize"||i==="s-resize"||i==="se-resize")?(this._toolToActivate="resize",t.rotateAngle>=0&&t.rotateAngle<25||t.rotateAngle>=160&&t.rotateAngle<=205||t.rotateAngle>=340&&t.rotateAngle<=360?this._currentCursor=i:t.rotateAngle>=25&&t.rotateAngle<=70||t.rotateAngle>=205&&t.rotateAngle<=250?this._currentCursor=i==="n-resize"||i==="s-resize"?"ne-resize":i==="nw-resize"||i==="se-resize"?"n-resize":i==="e-resize"||i==="w-resize"?"nw-resize":"e-resize":t.rotateAngle>=70&&t.rotateAngle<=115||t.rotateAngle>=250&&t.rotateAngle<=295?this._currentCursor=i==="n-resize"||i==="s-resize"?"e-resize":i==="nw-resize"||i==="se-resize"?"ne-resize":i==="e-resize"||i==="w-resize"?"n-resize":"nw-resize":(t.rotateAngle>=115&&t.rotateAngle<=155||t.rotateAngle>=295&&t.rotateAngle<=340)&&(this._currentCursor=i==="n-resize"||i==="s-resize"?"nw-resize":i==="nw-resize"||i==="se-resize"?"e-resize":i==="e-resize"||i==="w-resize"?"ne-resize":"n-resize"),!0):!1},_canActivateMoveTool:function(n,t){var s,r,u,f,e,o,i;if(n.target&&(s=n.target.className),r=s&&ej.datavisualization.Diagram.Util.isClassifier(n)?ej.datavisualization.Diagram.ClassifierHelper.getMovableElementUnderMouse(n,this):this._findNodeUnderMouse(n),r&&r.name===t.name){if(u=!0,t.parent&&(u=this.selectionList.length>0&&this._selectionContains(t)?!0:!1),u&&ej.datavisualization.Diagram.Util.canMoveLabel(t)&&(f=n.target.parentNode.id.split("_"),e=n.target.parentNode.getAttribute("class"),f[f.length-1]=="lblbg"||this._isLabelTemplate(n)||e&&e==="ej-d-label"))return this._toolToActivate="move",this._currentCursor="pointer",!0;if(o=!1,t.parent&&(i=this.nameTable[t.parent],i&&((i.isSwimlane||i.isLane)&&ej.datavisualization.Diagram.Util.canMove(i)||i.isPhaseStack)&&(o=!0)),ej.datavisualization.Diagram.Util.canMove(t)||o)return this._toolToActivate="move",this._currentCursor=this._isHyperLink(n)?"pointer":this.selectionList.length>0&&(this._selectionContains(t)||this.selectionList[0].children&&this._findChildren(this.selectionList[0],t.name))?"move":"default",!0}return!1},_isLabelTemplate:function(n){var f,i,r,t,u;if(n&&(f=$(n.target).parents(".ej-label-template"),i=f[0],i)){if(r=i.parentNode.id.split("_"),r[r.length-1]=="lblbg")return!0;for(t=n.target.parentNode,u=t.getAttribute("class");t;){if(u==="ej-label-template")return!0;t=t.parentNode;u=t.getAttribute("class")}}},_isHyperLink:function(n){var t=n.target,i=t.getAttribute("class");return(!i||!i=="ej-d-label")&&t.parentNode&&$(t.parentNode).hasClass("ej-d-label")&&(t=t.parentNode,$(t.parentNode).hasClass("ej-d-anchor"))?!0:!1},_canActivateRotateTool:function(n,t){if(ej.datavisualization.Diagram.Util.canRotate(t)&&this.model.selectedItems.constraints&ej.datavisualization.Diagram.SelectorConstraints.Rotator){var i=n.target.getAttribute("class");if(i==="rotateHandle")return this._toolToActivate="rotate",ej.browserInfo().name==="msie"?(this._currentcursor="default",this._adornerSvg.document.setAttribute("class","svg-rotate-ie"),this._currentCursor=""):(this._adornerSvg.document.setAttribute("class","svg-rotate"),this._currentCursor=""),!0}return!1},_canActivatePivotTool:function(n){var t=n.target.getAttribute("class");return t==="pivot"?(this._toolToActivate="pivot",this._currentCursor="default",!0):!1},_updateCursor:function(){this.element[0].style.cursor=this._currentCursor;this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0].style.cursor=this._currentCursor},_getResizeCursor:function(n){var t="default";switch(n){case"topleft":t="nw-resize";break;case"topcenter":t="n-resize";break;case"topright":t="ne-resize";break;case"middleleft":t="w-resize";break;case"middleright":t="e-resize";break;case"bottomleft":t="sw-resize";break;case"bottomcenter":t="s-resize";break;case"bottomright":t="se-resize"}return t},_startEdit:function(n){var i,f,e,r,s,t,u,v=ej.Matrix.identity(),l=n.width?n.width:n._width,a=n.height?n.height:n._height,y,w,b,o,c,p,h;ej.Matrix.rotate(v,n.rotateAngle,l/2,a/2);n.type==="text"?(r=this._svg.getElementById(n.name+"_shape")!==null?this._svg.getElementById(n.name+"_shape").getBBox():{x:n.offsetX-l*n.pivot.x,y:n.offsetY-a*n.pivot.y,width:l,height:a},i=n.textBlock,i&&!i.readOnly&&(s=ej.datavisualization.Diagram.Util.bounds(n),t=new ej.datavisualization.Diagram.Rectangle(r.x-i.fontSize,r.y-i.fontSize,r.width+i.fontSize/2,r.height+i.fontSize/2),u=this._currZoom,h=ej.Matrix.transform(v,ej.datavisualization.Diagram.Util._getLabelPosition(i,s)),f=n.offsetX-l*n.pivot.x+h.x,e=n.offsetY-a*n.pivot.y+h.y,i.horizontalAlignment=="left"?f+=r.width/2:i.horizontalAlignment=="right"&&(f-=r.width/2),i.verticalAlignment=="top"?e+=r.height/2:i.verticalAlignment=="bottom"&&(e-=r.height/2),r.width===0||r.height===0?(r=ej.datavisualization.Diagram.Util.bounds(n),t.width=r.width==0?50:s.width*u,t.x=f*u-t.width/2*u-this._hScrollOffset,t.height=i.fontSize,t.y=e*u-t.height/2*u-this._vScrollOffset):(t.width=50,t.height=i.fontSize,t.x=f*u-t.width/2*u-this._hScrollOffset,t.y=e*u-t.height/2*u-this._vScrollOffset),this._boundingBox=t,this._createEditBox(i,t.x,t.y,t.width,t.height,n),this._isEditing=!0)):(n.labels.length>0?(i=this.activeTool.getLabelUnderMouse(),i||(i=n.labels[0])):(y=this._findNode(n.name),i=new ej.datavisualization.Diagram.Label({name:"label"+ej.datavisualization.Diagram.Util.randomId()}),n.labels.push(i),w=y!==n?y:null,ej.datavisualization.Diagram.DiagramContext.addNodeLabel(n,i,w,this),this.activeTool.name==="textTool"&&(this.activateTool.activeLabel=i)),i&&!i.readOnly&&i.hyperlink===""&&i.templateId===""&&(this.model.labelRenderingMode!=="svg"?(b=this._htmlLayer?this._htmlLayer:this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],o=$(b).find("#"+n.name+"_"+i.name)[0]):o=this._svg.document.getElementById(n.name+"_"+i.name),o?(s=ej.datavisualization.Diagram.Util.bounds(n),this.model.labelRenderingMode!=="svg"?(t=new ej.datavisualization.Diagram.Rectangle(o.offsetLeft,o.offsetTop,o.offsetWidth,o.offsetHeight),r=t):(r=o.getBBox(),t=new ej.datavisualization.Diagram.Rectangle(0,0,r.width,r.height)),u=this.model.labelRenderingMode!="svg"?this._currZoom:1,c=ej.datavisualization.Diagram.Util._getLabelPosition(i,s),n.segments||i.relativeMode=="segmentpath"?(t=o.getBoundingClientRect(),t={x:t.left,y:t.top,width:t.width,height:t.height},p=this._controlBBox?this._controlBBox:this._canvas.getBoundingClientRect(),f=(t.x+t.width/2-p.left+this._hScrollOffset)/u,e=(t.y+t.height/2-p.top+this._vScrollOffset)/u):(i.horizontalAlignment=="left"?c.x+=r.width/2:i.horizontalAlignment=="right"&&(c.x-=r.width/2),i.verticalAlignment=="top"?c.y+=r.height/2:i.verticalAlignment=="bottom"&&(c.y-=r.height/2),h=ej.Matrix.transform(v,c),f=n.offsetX-l*n.pivot.x+h.x,e=n.offsetY-a*n.pivot.y+h.y),r.width===0||r.height===0?(r=ej.datavisualization.Diagram.Util.bounds(n),n.segments?(t.width=r.width<50?50:s.width,t.x=f*u-t.width/2-this._hScrollOffset):(t.width=r.width<50?50:s.width,t.x=f*u-t.width/2-this._hScrollOffset),t.height=n.type=="umlclassifier"?n.height:i.fontSize,t.y=e*u-t.height/2*u-this._vScrollOffset):(t.x=f*u-t.width/2*u-this._hScrollOffset,t.y=e*u-t.height/2*u-this._vScrollOffset),this._boundingBox=t,this._createEditBox(i,t.x,t.y,t.width,t.height,n),this._isEditing=!0):this.activeTool.selectedObject=null))},_hideShowSVGLabels:function(n,t,i){if(this._svg&&t){var r;r=t.type==="text"?this._svg.document.getElementById(t.name+"_shape_lblbg"):this._svg.document.getElementById(t.name+"_"+n.name);r&&r.setAttribute("visibility",i&&(n.visible||t.visible)?"visible":"hidden");r=this._svg.document.getElementById(t.name+"_"+n.name+"_lblbg");r&&r.setAttribute("visibility",i&&n.visible?"visible":"hidden")}},_createEditBox:function(n,t,i,r,u,f){var c,a,l,s,h,e,o;this._svg&&(this.model.labelRenderingMode==ej.datavisualization.Diagram.LabelRenderingMode.Svg?this._hideShowSVGLabels(n,f):(c=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],c&&(a=f.type==="text"?$(c).find("#"+f.name+"_shape_lblbg")[0]:$(c).find("#"+f.name+"_"+n.name+"_lblbg")[0],a&&(a.style.display="none"))),l=ej.datavisualization.Diagram.Util.bounds(f),s=document.createElement("div"),n.horizontalAlignment=="stretch"&&n.textOverflow&&n.rotateAngle==0&&f.isSwimlane?i=i-n.fontSize:n.horizontalAlignment=="stretch"&&!f.isSwimlane&&f._isHeader&&n.textOverflow&&n.rotateAngle!=0&&(t=-t-n.fontSize-r/4),h={id:this.element[0].id+"_editBoxDiv","class":"edit",style:"top:"+i+"px;left:"+t+"px;width:"+r+"px;font-family:"+n.fontFamily+";font-size:"+n.fontSize+"px;min-width: 50px;min-height:"+n.fontSize+"px;"},ej.datavisualization.Diagram.Util.canZoomTextEditor(this)&&(h.style+="transform: scale("+this._currZoom+");"),ej.datavisualization.Diagram.Util.attr(s,h),e=document.createElement("textarea"),o=n.fontColor?n.fontColor.toLowerCase():"black",o=o!="white"&&o!="ffffff"&&o!="rgb(255,255,255)"?o:"black",h={id:this.element[0].id+"_editBox","class":"editBox",style:"font-size:"+n.fontSize+"px;font-family:"+n.fontFamily+";min-height:"+n.fontSize+"px; height: "+u+"px; line-height: normal; color:"+o+";font-weight:"+(n.bold?"bold":"normal")+";font-style:"+(n.italic?"italic":"normal")+";text-decoration:"+n.textDecoration,nodeWidth:l.width,nodeHeight:l.height,fontSize:n.fontSize,nodeOffsetX:f.offsetX,nodeOffsetY:f.offsetY,containerName:f.name},ej.datavisualization.Diagram.Util.attr(e,h),e.value=n.text,s.appendChild(e),$(this._canvas).append(s),n.text!==""&&this._updateEditor(null,s,e,l.width,n.fontSize,n,f),this._on($(e),"focusout",this._editboxfocusout),this._on($(e),"keyup",this._editBoxKeyUp),this._on($(e),"input",this._editBoxTextChange),this._on($(e),"focusin",this._editboxfocusin),e.focus())},_editBoxKeyUp:function(n){this._updateLabelPosition(n)},_editBoxTextChange:function(n){this._updateLabelPosition(n)},_updateEditBox:function(n,t){var i=document.getElementById(this.element[0].id+"_editBoxDiv");i&&(i.style.left=i.offsetLeft-n+"px",i.style.top=i.offsetTop-t+"px")},_editboxfocusout:function(){this._endEditing=!0;this._endEdit();delete this._endEditing},_editboxfocusin:function(n){n.target.select();this._raiseEvent("editorFocusChange",n)},_updateLabelPosition:function(n){var t=50,o=this._currZoom,r=this._boundingBox,e=Number(n.target.getAttribute("fontSize")),f=Number(n.target.getAttribute("nodeWidth")),s=r.x+r.width/2,l=r.y+r.height/2,i=this._textLength(n),u,h,c;i.width===0?(u=r.width<t?t:r.width,n.target.parentNode.style.width=u+"px",n.target.parentNode.style.left=s-u/2-e/4+"px"):(u=i.width<=f*o?i.width<t?t:i.width:i.width>=f*o?i.width>t?i.width:t:f<t?t:f*o,n.target.parentNode.style.width=u+"px",n.target.parentNode.style.left=s-u/2+"px");i.height===0?(n.target.style.height=e+"px",n.target.parentNode.style.top=l-e/2+"px"):this._selectedItem&&(h=this.nameTable[this._selectedItem],h.type==="text"&&(c=this._currentLabel));this._updateEditor(n,n.target.parentNode,n.target,f,e,c)},_updateEditor:function(n,t,i,r,u,f,e){var y,p,o,s=this._textLength(n,f),h=this.model.labelRenderingMode!="svg"||e&&e.type==="text"?this._currZoom:1,nt=50,k=this._boundingBox.x,tt=this._boundingBox.y,d=this._boundingBox.width,g=this._boundingBox.height,ut=i.value,ft=ut.split("\n"),c,w,b,l,v;e||(e=this.activeTool.selectedObject);e&&e.parent&&(c=this.nameTable[e.parent]);this._nodeUnderMouse&&(this.old=this._nodeUnderMouse,w=this._nodeUnderMouse.name.match("_attribute")?"attribute":this._nodeUnderMouse.name.match("_method")?"method":this._nodeUnderMouse.name.match("_member")?"member":this._nodeUnderMouse.name.match("_header_classifier")?"header":"null");this.old&&(w=this.old.name.match("_attribute")?"attribute":this.old.name.match("_method")?"method":this.old.name.match("_member")?"member":this.old.name.match("_header_classifier")?"header":"null");b=w&&w!="null"?s.width>r?s.width:r:r<s.width?r:s.width;this._browserInfo.name==="mozilla"&&(b+=2);l=b<nt?nt:b;t.style.width=l+"px";y=n?(l-d)/2:(l-d*h)/2;t.style.left=c&&c.isLane&&f&&f.horizontalAlignment=="stretch"&&f.textOverflow&&f.rotateAngle!=0?k-y-u-d/4+"px":k-y-u/4+"px";ft.length>1||s.width!=r?(e&&e.type!="umlclassifier"&&(i.style.height="0"),o=this._browserInfo.name==="mozilla"?i.scrollHeight-5:i.scrollHeight-4):o=u;var it=$(i).offset(),rt=$(this._canvas).offset(),a=$(this._canvas).height();a||(a=this._getCanvasHeight(this._canvas,a));it.top-rt.top+Number(o)>a&&(o=o-(it.top-rt.top+Number(o)-a),o=this._browserInfo.name==="mozilla"?o-7:o-6);i.style.height=o+"px";v=0;n?(p=(o-g)/2,v=tt-p*h):(p=c&&c.isSwimlane&&f&&f.horizontalAlignment=="stretch"&&f.textOverflow&&f.rotateAngle==0?(o-g*h)/2+f.fontSize:(o-g*h)/2,v=tt-p-3*h);t.style.top=v+"px";this._boundingBox=new ej.datavisualization.Diagram.Rectangle(k-y,v,l,o)},_getCanvasHeight:function(n,t){for(var r=t,i=n;r<=0;)i=i.parentNode,i&&(r=$(i).height());return r},_textLength:function(n,t){var i=document.createElement("div"),r=document.getElementById(this.element[0].id+"_editBox"),u={id:this.element[0].id+"_editBoxHiddenDiv",style:"position : absolute; width : auto; height : auto;font-size:"+r.style.fontSize+"px;font-family:"+r.style.fontFamily+";word-wrap: break-word;white-space:pre-wrap;"},f;return t&&(u.style="position : absolute; width : auto; height : auto;font-weight:"+(t.bold?"bold":"normal")+";font-style:"+(t.italic?"italic":"normal")+";text-decoration:"+t.textDecoration+";font-size:"+t.fontSize+"px;font-family:"+t.fontFamily+";word-wrap: break-word;white-space:pre-wrap;"),ej.datavisualization.Diagram.Util.attr(i,u),n?i.appendChild(document.createTextNode(n.target.value)):i.appendChild(document.createTextNode(r.value)),document.body.appendChild(i),f=i.getBoundingClientRect(),document.body.removeChild(i),f},_endEdit:function(n){var k,h,w,b,r=document.getElementById(this.element[0].id+"_editBox"),t,e,c,i,u,d,g,l,f,o,s,a,v,y,p;if(r){if(t=this._findNode(r.getAttribute("containerName")),this.activeTool.name==="textTool")t=this.activeTool.selectedObject;else if(!t)for(e=0;e<this.selectionList.length;e++)c=this.selectionList[e],typeof c.labels.length!="undefined"&&c.labels.length>0&&c.labels[0].mode===ej.datavisualization.Diagram.LabelEditMode.Edit&&(t=this.selectionList[e]);t&&(this._isEditing=!1,t.type=="text"?i=t.textBlock:(i=this.activeTool.getLabelUnderMouse(),i||(i=t.labels[0])),t.type=="umlclassifier"&&(r.value=ej.datavisualization.Diagram.ClassifierHelper.getEditboxValue(r.value,t,this)),i&&(u=i.text),t._type!="node"||t.width&&t.height||!this.nameTable[t.name]||(w=t._width,b=t._height,t.labels[0].text=r.value,this._getNodeDimension(t)),t.type=="umlclassifier"&&(t=ej.datavisualization.Diagram.ClassifierHelper.getClassifierNodeDimension(t,this)),n&&(d=n.keyDownEventArgs.keyCode===27?"ESC":String.fromCharCode(n.keyDownEventArgs.keyCode)),r.value!=u&&(k=this._raiseEvent("textChange",{element:this.getNode(t),label:i,value:r.value,keyCode:d})),k?(t._width&&w&&(t._width=w),t._height&&b&&(t._height=b),t&&t.type==="text"?ej.datavisualization.Diagram.DiagramContext.update(t,this):(i=this.activeTool.activeLabel?this.activeTool.activeLabel:t.labels.length>0?t.labels[0]:null,i!=undefined&&(i.mode=ej.datavisualization.Diagram.LabelEditMode.View,ej.datavisualization.Diagram.DiagramContext.updateLabel(t,i,this))),this.activeTool&&(this.activeTool.activeLabel=null,this.activeTool.selectedObject=null)):(t&&t.type!==undefined&&t.type==="text"?(g=u,t.textBlock.text=r.value,t.textBlock.mode=ej.datavisualization.Diagram.LabelEditMode.View,this._findNode(t.name)?(ej.datavisualization.Diagram.DiagramContext.update(t,this),h={type:"labelchanged",shape:t,previousLabelValue:g,updatedLabelValue:r.value,category:"internal"},this.addHistoryEntry(h)):(r.value!==""&&(l=Number(r.style.height.substring(0,r.style.height.length-2)),t.height<l&&(t.offsetY=t.offsetY-t.height/2+l/2,t.height=l),this.selectionList.length>0&&this._clearSelection(!0),this.tools.move._outOfBoundsDrag(t)&&(this.add(t),f=this.nameTable[t.parent],f&&f.isLane&&(o=this._moveOnLane(t,f),o.proceedX||this.updateNode(t.name,{offsetX:t.offsetX+o.x}),o.proceedY||this.updateNode(t.name,{offsetY:t.offsetY+o.y}),this._updateNodeMargin(t),ej.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this),this._disableSwimlaneUptate=!0,ej.datavisualization.Diagram.canvasHelper._updateCollectionChange(this,f),f.isLane&&(s=this._getSwimlane(f),s&&(this._updateChildAdjacentConnectors(s,!0),delete this._disableSwimlaneUptate,ej.datavisualization.Diagram.canvasHelper._updateLastPhase(this,s),ej.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this,s)))))),this.activeTool.selectedObject=null)):t==undefined||t.type=="pseudoGroup"||(i!=undefined?(this._comparePropertyValues(i,"text",{text:r.value}),u=u?u:i.text,u!=r.value&&(h={type:"labelchanged",shape:t,previousLabelValue:i.text,updatedLabelValue:r.value,index:t.labels.indexOf(i),category:"internal"},this.addHistoryEntry(h)),i.text=r.value,i.mode=ej.datavisualization.Diagram.LabelEditMode.View,ej.datavisualization.Diagram.DiagramContext.updateLabel(t,i,this),t.isPhase&&(t.name.split("phaseStack")[1]&&(a=this.nameTable[t.name.split("phaseStack")[1]]),a&&a.label&&(a.label.text=r.value)),this.activeTool.selectedObject=null):t.labels.length==0&&(i=ej.datavisualization.Diagram.Label(),i.text=r.value,i.mode=ej.datavisualization.Diagram.LabelEditMode.View,t.labels.push(i),ej.datavisualization.Diagram.DiagramContext.addNodeLabel(t,i,null,this)),this.activeTool.activeLabel&&(this.activeTool.activeLabel=null)),t.shape&&t.shape.type=="umlclassifier"&&(t=ej.datavisualization.Diagram.ClassifierHelper.getUMLConnectorValue(t,r.value,i)),t._type!="node"||t.width&&t.height||!this.nameTable[t.name]||(ej.datavisualization.Diagram.DiagramContext.update(t,this),t.parent&&ej.datavisualization.Diagram.DiagramContext.update(this.nameTable[t.parent],this)),t.type=="umlclassifier"&&(t.labels[0].text="",ej.datavisualization.Diagram.DiagramContext.update(t,this)),t.shape&&t.shape.type=="umlclassifier"&&ej.datavisualization.Diagram.DiagramContext.update(t,this)));this._off($(r),"focusout",this._editboxfocusout);this._off($(r),"keyup",this._editBoxKeyUp);this._off($(r),"input",this._editBoxTextChange);v=$("#"+this.element[0].id+"_editBoxDiv")[0];v&&v.parentNode.removeChild(v);this._svg&&(this.model.labelRenderingMode==ej.datavisualization.Diagram.LabelRenderingMode.Svg?this._hideShowSVGLabels(i,t,!0):(y=this._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],y&&(t.type==="text"?p=$(y).find("#"+t.name+"_shape_lblbg")[0]:i&&(p=$(y).find("#"+t.name+"_"+i.name+"_lblbg")[0]),p&&(p.style.display="block"))))}n&&n.keyDownEventArgs&&n.keyDownEventArgs.keyCode===27&&this.element[0].focus()},_getSwimlane:function(n){var i,t;return n=typeof n=="string"?this.nameTable[n]:n,t=this.nameTable[n.parent],t&&(i=this.nameTable[t.parent]),i},_setLabelEditing:function(n){var t;if(n)return n.readOnly?(n.mode=ej.datavisualization.Diagram.LabelEditMode.View,t=!1):(this._currentLabel&&(this._currentLabel.mode=ej.datavisualization.Diagram.LabelEditMode.View),n.mode=ej.datavisualization.Diagram.LabelEditMode.Edit,this._currentLabel=n,t=!0),t},_isInternalTool:function(n){return n instanceof ej.datavisualization.Diagram.SelectTool||n instanceof ej.datavisualization.Diagram.ConnectionEditTool||n instanceof ej.datavisualization.Diagram.MoveTool||n instanceof ej.datavisualization.Diagram.ResizeTool||n instanceof ej.datavisualization.Diagram.PhaseTool||n instanceof ej.datavisualization.Diagram.RotateTool||n instanceof ej.datavisualization.Diagram.PanTool&&this.tool()&ej.datavisualization.Diagram.Tool.SingleSelect&&this.tool()&ej.datavisualization.Diagram.Tool.ZoomPan?!0:!1},_updateNodeMargin:function(n){var t,s,h,r,u,c,o;if(n.parent!=""&&(t=this.nameTable[n.parent],t&&t.container&&t.container.type=="canvas")){var f=ej.datavisualization.Diagram.Util.bounds(t),e=ej.datavisualization.Diagram.Util.bounds(n),i=ej.datavisualization.Diagram.Geometry.rect([e.topLeft,e.topRight,e.bottomRight,e.bottomLeft]);n.marginLeft=i.x-(f.x+t.paddingLeft);s=f.x+t.width-(i.x+i.width)-t.paddingRight;n.marginRight=s<0?0:s;n.marginTop=i.y-(f.y+t.paddingTop);h=f.y+t.height-(i.y+i.height)-t.paddingBottom;n.marginBottom=h<0?0:h;t.isLane&&(r=0,u=0,t.orientation==="horizontal"?(r=50,u=0):(r=0,u=50),n.marginLeft=n.marginLeft>=r?n.marginLeft:r,n.marginTop=n.marginTop>=u?n.marginTop:u)}if((n.type=="pseudoGroup"||n.name=="multipleSelection")&&n.children.length>0)for(o=0;o<n.children.length;o++)c=this.nameTable[this._getChild(n.children[o])],c&&this._updateNodeMargin(c)},_raisePropertyChange:function(n){n&&(this._isSizingCommand?n.cause=ej.datavisualization.Diagram.ActionType.Size:this._isUndo?n.cause=ej.datavisualization.Diagram.ActionType.HistoryChange:this._isTouchedEvent&&(n.cause=ej.datavisualization.Diagram.ActionType.Touch),this._raiseEvent("propertyChange",n))},_updateAdjacentEdges:function(n,t){var i,r;if(n.inEdges&&n.inEdges.length>0)for(i=0,r=n.inEdges.length;i<r;i++)t[n.inEdges[i]]=this.nameTable[n.inEdges[i]];if(n.outEdges&&n.outEdges.length>0)for(i=0,r=n.outEdges.length;i<r;i++)t[n.outEdges[i]]=this.nameTable[n.outEdges[i]]},_translate:function(n,t,i,r,u,f){var h,f,s,o,e;if(t||i)if(n.segments)ej.datavisualization.Diagram.Util._translateLine(n,t,i,n),this._dock(n,r),ej.datavisualization.Diagram.Util.updateBridging(n,this),this._updateConnectorBridging(n);else{if(f||(h=!0),f=f||{},this._updateAdjacentEdges(n,f),n.offsetX+=t,n.offsetY+=i,this._parentNode||this.activeTool.name=="phase"||(this._parentNode=n),(n._type==="group"||n.type==="pseudoGroup")&&!u){for(s=this._getChildren(n.children),o=0;o<s.length;o++)e=r[s[o]],e&&(this._translate(e,t,i,r,undefined,f),e.parent&&e.parent!=n.name&&n.type!="pseudoGroup"&&ej.datavisualization.Diagram.Util._updateGroupBounds(r[e.parent],this));n.type!="group"&&n.container&&ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)}if(n!=this.activeTool.helper&&(this.nameTable[n.name]&&this._updateQuad(n),ej.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(n,t,i,null,this)),this._parentNode==n&&delete this._parentNode,h&&!this._preventDocking&&n!=this.activeTool.helper&&!this._disableSegmentChange)for(o in f)e=this.nameTable[o],e&&((n.isSwimlane||(n.type=="pseudoGroup"||n.type=="group")&&!this._containsChild(n,e))&&ej.datavisualization.Diagram.Util._translateLine(e,t,i,e),this._dock(e,this.nameTable),e.annotation&&ej.datavisualization.Diagram.DefautShapes.updateAnnotationProperties(e,this))}else return!1},_containsChild:function(n,t){var i,r,f,u;if(n.children&&n.children.length>0)for(i=this._getChildren(n.children),r=0;r<i.length;r++){if(f=this._collectionContains(t.name,i),f)return!0;u=this._getChild(i[r]);u&&u.children&&this._containsChild(u,t)}},_translateLabel:function(n,t,i,r){var u=$.extend(!0,{},t);t.margin.left+=i;t.margin.top+=r;t.margin.right-=i;t.margin.bottom-=r;t.horizontalAlignment=="center"&&(t.margin.right=0);t.verticalAlignment=="center"&&(t.margin.bottom=0);ej.datavisualization.Diagram.DiagramContext.updateLabel(n,t,this);this._comparePropertyValues(n,"labels",u)},_rotate:function(n,t,i){var u,e,o,s,r,f,h;if(!n.segments&&t){if(n.rotateAngle+=t,n.rotateAngle%=360,n.rotateAngle<0&&(n.rotateAngle+=360),n._type==="group"||n.type==="pseudoGroup"){for(u=ej.Matrix.identity(),ej.Matrix.rotate(u,t,n.offsetX,n.offsetY),s=this._getChildren(n.children),f=0;f<s.length;f++)r=i[s[f]],r&&(r.segments?(r.sourceNode||this._setEndPoint(r,ej.Matrix.transform(u,r.sourcePoint),!1),r.targetNode||this._setEndPoint(r,ej.Matrix.transform(u,r.targetPoint),!0)):(this._rotate(r,t,i),e=r.offsetX,o=r.offsetY,h=ej.Matrix.transform(u,ej.datavisualization.Diagram.Point(e,o)),this._translate(r,h.x-e,h.y-o,i),this._updateAssociatedConnectorEnds(r,i)),r.parent&&r.parent!=n.name&&n.type!="pseudoGroup"&&ej.datavisualization.Diagram.Util._updateGroupBounds(i[r.parent],this));ej.datavisualization.Diagram.Util._updateGroupBounds(n,this)}n.parent&&this._updateParentBounds(n.parent);n!=this.activeTool.helper&&this._updateQuad(n);this._updateAssociatedConnectorEnds(n,i)}},_raiseOffsetPropertyChange:function(n,t,i,r){n&&!n.segments?(t=t?t:0,i=i?i:0,t!=n.offsetX&&this._comparePropertyValues(n,"offsetX",{offsetX:t},r),i!=n.offsetY&&this._comparePropertyValues(n,"offsetY",{offsetY:i},r)):(t=t?t:0,i=i?i:0,this._comparePropertyValues(n,"sourcePoint",{sourcePoint:{x:n.sourcePoint.x+t,y:n.sourcePoint.y+i}},r),this._comparePropertyValues(n,"targetPoint",{targetPoint:{x:n.targetPoint.x+t,y:n.targetPoint.y+i}},r))},_raiseSizePropertyChange:function(n,t,i,r){if(n&&i&&t){var u=n.height*i,f=n.width*t;u!=n.height&&(this._comparePropertyValues(n,"height",{height:u},r),this._comparePropertyValues(n,"offsetY",{offsetY:n.offsetY+(u-n.height)},r));f!=n.width&&(this._comparePropertyValues(n,"width",{width:f},r),this._comparePropertyValues(n,"offsetX",{offsetX:n.offsetX+(f-n.width)/2},r))}},scale:function(n,t,i,r,u,f,e){var w,y,l,o,p,v,d,g,s,b,k;if(t&&t!=1||i&&i!=1||n.isPhase)if(n.container)switch(n.container.type){case"canvas":v={};s=ej.Matrix.identity();ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY));c=n.width*t;h=n.height*i;e&&(n.minHeight=h,n.minWidth=c);v.width=c;v.height=h;v&&v.width>1&&(d=n.offsetX-n.width/2,n.width!=v.width&&(n._scaled=!0),n.width=v.width,n.offsetX=n._isBpmn?a.x:d+n.width/2);v&&v.height>1&&(g=n.offsetY-n.height/2,n.height!=v.height&&(n._scaled=!0),n.height=v.height,n.offsetY=n._isBpmn?a.y:g+n.height/2);break;case"stack":s=ej.Matrix.identity();ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY));b=0;k=0;t!=0&&(b=n.marginLeft,k=n.marginRight);c=n.width*t-(b+k);h=n.height*i-(n.marginTop+n.marginBottom);v={height:n.height,width:n.width};this._resizeStack&&(n.width=c,n.height=h,n.offsetX=a.x,n.offsetY=a.y)}else if(s=ej.Matrix.identity(),n.segments){for(ej.Matrix.scale(s,t,i,r.x,r.y),l=0;l<n.segments.length;l++){for(o=n.segments[l],p=0;p<o.points.length;p++)o.points[p]=ej.Matrix.transform(s,o.points[p]),l!=0||p!=0||n.sourceNode||(o._startPoint=o.points[0],o._endPoint=o.points[o.points.length-1],ej.datavisualization.Diagram.Util._setLineEndPoint(n,ej.Matrix.transform(s,n.sourcePoint),!1)),l!=n.segments.length-1||p!=o.points.length-1||n.targetNode||(o._startPoint=o.points[0],o._endPoint=o.points[o.points.length-1],n.targetPoint=o._endPoint);o._startPoint=o.points[0];o._endPoint=o.points[o.points.length-1];o.type=="orthogonal"?o.length||o.length===0?o.length=o._length=ej.datavisualization.Diagram.Geometry.distance(o._startPoint,o._endPoint):ej.datavisualization.Diagram.Util._addOrthogonalPoints(o,n.segments[l-1],n.segments[l+1],n.sourcePoint,n.targetPoint):(o.point&&(o.point=o._endPoint),o._point=o._endPoint)}(n.sourceNode||n.targetNode)&&this._dock(n,u)}else{if(n._type==="group"||n.type==="pseudoGroup"){if(n.type!="bpmn"||n.width*t>=20&&n.height*i>=20){for(w=this._getChildren(n.children),l=0;l<w.length;l++)y=u[w[l]],y&&(n.type!="bpmn"||ej.datavisualization.Diagram.Util.canResize(y))&&(this.scale(y,t,i,r,u),y.parent&&y.parent!=n.name&&n.type!="pseudoGroup"&&ej.datavisualization.Diagram.Util._updateGroupBounds(u[y.parent],this));if(n.type=="bpmn"&&ej.datavisualization.Diagram.Util._updateBPMNProperties(n,this,u,!0),n.children.length<=0){ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);var a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),c=n.width?n.width*t:n._width*t,h=n.height?n.height*i:n._height*i;c>1&&(n.width?(c!=n.width&&(n._scaled=!0),n.width=c,n.offsetX=a.x):(c!=n._width&&(n._scaled=!0),n.maxWidth=n.parent&&u[n.parent].width!=n.maxWidth?u[n.parent].width:c,n.offsetX=a.x-(n._width*t-n._width)/2));h>1&&(n.height?(h!=n.height&&(n._scaled=!0),n.height=h,n.offsetY=a.y):(h!=n._height&&(n._scaled=!0),n.maxHeight=n.parent&&u[n.parent].height>h?u[n.parent].height:h,n.offsetY=a.y-(n._height*i-n._height)/2))}ej.datavisualization.Diagram.Util._updateGroupBounds(n,this);n!=this.activeTool.helper&&ej.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(n,1/t,1/i,r,this)}}else{ej.Matrix.rotate(s,-n.rotateAngle,r.x,r.y);ej.Matrix.scale(s,t,i,r.x,r.y);ej.Matrix.rotate(s,n.rotateAngle,r.x,r.y);var a=ej.Matrix.transform(s,ej.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),c=n.width*t,h=n.height*i;n.maxWidth!=0&&(c=Math.min(n.maxWidth,c));n.minWidth!=0&&(c=Math.max(n.minWidth,c));n.maxHeight!=0&&(h=Math.min(n.maxHeight,h));n.minHeight!=0&&(h=Math.max(n.minHeight,h));c>0&&(c!=n.width&&(n._scaled=!0),c!=n.maxWidth&&c!=n.minWidth&&(n.width=c,n.offsetX=a.x));h>0&&(h!=n.height&&(n._scaled=!0),h!=n.maxHeight&&h!=n.minHeight&&(n.height=h,n.offsetY=a.y))}n.parent&&this._updateParentBounds(n.parent);ej.datavisualization.Diagram.Util._updateBPMNProperties(n,this,u,!0);this.activeTool.name=="resize"&&this.activeTool.inAction&&this.selectionList[0]&&this.selectionList[0].type!="pseudoGroup"&&this.selectionList[0].type!="group"||this._updateAssociatedConnectorEnds(n,u);n!=this.activeTool.helper&&this._updateQuad(n)}},_updateParentBounds:function(n){n=this.nameTable[this._getChild(n)];n&&n.type!="bpmn"&&!n.container&&(ej.datavisualization.Diagram.Util._updateGroupBounds(n,this),ej.datavisualization.Diagram.DiagramContext.update(n,this),n.parent&&this._updateParentBounds(n.parent))},_dock:function(n,t,i){if(!this._preventDocking&&!this._disableSegmentChange&&(!this._layoutInAction||!this._isAnimating)){var r=n.segments.length,u=n.segments[0].points.length,f=n.segments[n.segments.length-1].points.length;this._preventSegmentAdjusting&&(n._preventSegmentAdjusting=!0);ej.datavisualization.Diagram.Util.dock(n,t,this);delete n._preventSegmentAdjusting;r!=n.segments.length&&this._svg&&(ej.datavisualization.Diagram.Util._updateConnectorSegments(n,n.sourcePort,n.targetPort,this),ej.datavisualization.Diagram.DiagramContext._refreshSegments(n,this));this.selectionList[0]==n&&(i||u!=n.segments[0].points.length||f!=n.segments[n.segments.length-1].points.length)&&ej.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.selectionList[0],this._adornerSvg,this._currZoom);this._updateQuad(n)}},_updateChildAdjacentConnectors:function(n,t){var u=this._getChildTable(n,{}),r,i;for(r in u)i=this.nameTable[r],i&&i.segments&&n.children.indexOf(r)==-1&&(t||(i._staticLength=!0),this._dock(i,this.nameTable),delete i._staticLength,ej.datavisualization.Diagram.DiagramContext.update(i,this))},_setEndPoint:function(n,t,i){ej.datavisualization.Diagram.Util._setLineEndPoint(n,t,i);this._updateQuad(n)},_updateAssociatedConnectorEnds:function(n,t){var r,f,i,s,u,o,e;if(!n.segments&&(n.inEdges.length||n.outEdges.length)){for(s=this._isNodeToNodeConnection(n),u=n,n.type=="bpmn"&&n._type=="group"&&(u=typeof n.children[0]=="object"?n.children[0]:this.nameTable[n.children[0]]),s&&(o=ej.datavisualization.Diagram.Util._findSegmentPoints(u)),e={},this._parentNode&&(e=this._getChildTable(this._parentNode,{})),r=0,f=n.inEdges.length;r<f;r++)i=t[n.inEdges[r]],!i||this._parentNode&&e[i.sourceNode]||(i.targetPadding?delete u._segmentPoints:u._segmentPoints=o,this._dock(i,t));for(r=0,f=n.outEdges.length;r<f;r++)i=t[n.outEdges[r]],!i||this._parentNode&&e[i.targetNode]||(i.sourcePadding?delete u._segmentPoints:u._segmentPoints=o,this._dock(i,t));delete u._segmentPoints}},_isNodeToNodeConnection:function(n){var t,i;if(n.inEdges.length)for(t=0,i=n.inEdges.length;t<i;t++)if(this.nameTable[n.inEdges[t]]&&!this.nameTable[n.inEdges[t]].targetPort&&(n.type!="bpmn"||this.nameTable[n.inEdges[t]].segments[0].type!="orthogonal"))return!0;if(n.outEdges.length)for(t=0,i=n.outEdges.length;t<i;t++)if(this.nameTable[n.outEdges[t]]&&!this.nameTable[n.outEdges[t]].sourcePort&&(n.type!="bpmn"||this.nameTable[n.outEdges[t]].segments[this.nameTable[n.outEdges[t]].segments.length-1].type!="orthogonal"))return!0},_updateChildBounds:function(n,t){var r,u,i,f,e,o,s;n.width==0&&n.height==0?(r=n.offsetX,u=n.offsetY,ej.datavisualization.Diagram.Util._updateGroupBounds(n,this),this._translate(n,r-n.offsetX,u-n.offsetY,t)):(r=n.offsetX,u=n.offsetY,i=ej.datavisualization.Diagram.Util._getChildrenBounds(n,this),n.offsetX=i.x+i.width*n.pivot.x,n.offsetY=i.y+i.height*n.pivot.y,f=r-n.offsetX,e=r-n.offsetY,this._translate(n,f,e,t),o=n.width/i.width,s=n.height/i.height,this._scale(n,o,s,n.pivot,t),this._translate(n,r-n.offsetX,u-n.offsetY,t))},_updateQuad:function(n){var r,t,i;this._spatialSearch&&this.nameTable[n.name]&&(r=this.getObjectType(n),t=!1,(n.isPhase||n.isLane||n._isHeader||n.isLaneStack||n.isPhaseStack||n._isInternalShape||n.type=="pseudoGroup")&&(t=!0),n.parent&&this.nameTable[n.parent]&&(i=this.nameTable[n.parent],(i.isPhaseStack||i.isSwimlane)&&(t=!0),i.type!="bpmn"&&this._updateQuad(i)),this._selectedSymbol!=null&&this._selectedSymbol.isLane&&n.isLane&&!n.parent&&(t=!1),this._disableUpdateQuad&&(t=!0),t||n._connectorType||ej.datavisualization.Diagram.SpatialUtil._updateQuad(this,this._spatialSearch,n))},_sliceDockLines:function(n){var i=$.extend({},n),t=null;for(var r in i)t=this.nameTable[this._getChild(i[r])],t&&t.segments&&(t.sourceNode||t.targetNode)&&n.pop(t.name)},_canExecute:function(){return this._isEditing&&(this._currentCommand=="delete"||this._currentCommand=="cut"||this._currentCommand=="focusToPreviousItem"||this._currentCommand=="undo"||this._currentCommand=="redo"||this._currentCommand=="focusToNextItem"||this._currentCommand=="selectFocusedItem"||this._currentCommand=="selectAll"||this._currentCommand=="copy"||this._currentCommand=="paste"||this._currentCommand.match("nudge"))?!1:this._currentCommand=="endEdit"&&!this._isEditing?!1:!0},_setItemDraggable:function(n){var t=this,i=!1;this._canDragGlobally=!0;$(n).ejDraggable({clone:!0,helper:function(){var u,n,f,i,r;return this._selectedSymbol=null,this._isDragged=!1,u=t._renderItemContainer("diagram_clone",document.body),u.document.setAttribute("drag","true"),t.activeTool&&t.activeTool.selectedObject&&!t.activeTool.helper&&(n=$.extend(!0,{},t.activeTool.selectedObject),t._updateChildren(n),t.edgeTable={},t.edgeTable=t._getEdgeTable(n,t.edgeTable),this._updateSelectedItem(n,n.isSwimlane),this._selectedSymbol=n,this._isDragged=!1,this._targetId=t._id,f=ej.datavisualization.Diagram.Util.bounds(n),this.cursorAt={top:105,left:105},i=ej.datavisualization.Diagram.NodeType({offsetX:n.offsetX,offsetY:n.offsetY,width:100,height:100,shape:"path",opacity:.5,pathData:"M49.955,50.7915L1.74601,99L98.164,99zM1,1.83699L1,98.332L49.2477,50.0843zM99,1.74699L50.662,50.0845L99,98.422zM1.57701,1L49.9548,49.3773L98.332,1zM0,0L100,0L100,100L0,100z "},t),i=t._getNewNode(i),ej.datavisualization.Diagram.SvgContext.renderNode(i,u,null,!0,t)),r=document.getElementById("diagram_clone_paletteItem"),$(r).addClass("dragClone"),$(r).css("display","none"),$(r)},drag:function(n){var l=$(n.target).parents(".e-datavisualization-diagram"),s,e,h,t,f,r;if(l.length){if(t=$("#"+l.attr("id")).ejDiagram("instance"),(this.model._isDragged||this.model._targetId!=t._id)&&this.model._selectedSymbol){this.model._isDragged||this.model._targetId==t._id?this.model._targetId!=t._id&&(t.edgeTable&&delete t.edgeTable,i=!1):(s=$("#"+this.model._targetId).ejDiagram("instance"),s._delete(s.nameTable[this.model._selectedSymbol.name]),i=!1,f=s._historyList.currentEntry,r=f.previous,f.object=r.undoObject.node,r.undoObject.childTable&&(f.childTable=r.undoObject.childTable),r.undoObject.edgeTable&&(f.edgeTable=r.undoObject.edgeTable),s.removeHistoryEntry(r));this.model._isDragged=!0;t._selectedSymbol=this.model._selectedSymbol;t._isNodeEnters=!0;var u=t._selectedSymbol,o=t._currZoom,a=$("#"+t.element[0].id).offset(),c=t._isTouchEvent(n.event),v=((c?c.pageX:n.event.pageX)+t._hScrollOffset-a.left)/o,y=((c?c.pageY:n.event.pageY)+t._vScrollOffset-a.top)/o;if(u.segments?this.model._translate(u,v-(u.sourcePoint.x+u.targetPoint.x)/2*o,y-(u.sourcePoint.y+u.targetPoint.y)/2*o):this.model._translate(u,v-u.offsetX/o,y-u.offsetY/o),this.model._isDragged&&t.edgeTable&&t.nameTable[u.name]&&!i&&u.type!="pseudoGroup"){for(e in t.edgeTable)t.nameTable[e]?(h=t.nameTable[e],h.sourceNode=t.edgeTable[e].sourceNode,h.sourcePort=t.edgeTable[e].sourcePort,h.targetNode=t.edgeTable[e].targetNode,h.targetPort=t.edgeTable[e].targetPort):t.add(t.edgeTable[e]);t._clearSelection(!0);t._addSelection(t.nameTable[u.name],!0);i=!0}}this.helper.css("display","none")}else this.model._selectedSymbol&&(t=$("#"+this.model._targetId).ejDiagram("instance"),t._delete(t.nameTable[this.model._selectedSymbol.name]),i=!1,this.model._isDragged||(f=t._historyList.currentEntry,r=f.previous,f.object=r.undoObject.node,r.undoObject.childTable&&(f.childTable=r.undoObject.childTable),r.undoObject.edgeTable&&(f.edgeTable=r.undoObject.edgeTable),t.removeHistoryEntry(r)),this.helper.css("display","block"),this.model._isDragged=!0);$("html,body").css("cursor","no-drop")},dragStop:function(n){var u=$(n.target).parents(".e-datavisualization-diagram"),i,r,t;u&&(i=$("#"+u.attr("id")).ejDiagram("instance"),this.model._isDragged&&this.model._targetId==i._id&&(r=i._historyList.currentEntry,t=r.previous,r.undoObject.node=t.object,t.childTable&&(r.undoObject.childTable=t.childTable),t.edgeTable&&(r.undoObject.edgeTable=t.edgeTable),i.removeHistoryEntry(t)),i._selectedSymbol=null,delete i._isNodeEnters);$(this.helper).remove();$("html,body").css("cursor","default")},_translate:function(n,t,i){if(n.segments)ej.datavisualization.Diagram.Util._translateLine(n,t,i,n);else if(n.offsetX+=t,n.offsetY+=i,n.type=="pseudoGroup"||n.type=="group")for(var r=0;r<n.children.length;r++)this._translate(n.children[r],t,i)},_updateSelectedItem:function(n,i){var r,u;if(n.type=="pseudoGroup"||n.type=="group")for(r=0;r<n.children.length;r++)typeof n.children[r]=="string"&&(n.children[r]=t.nameTable[n.children[r]]),this._updateSelectedItem(n.children[r],i);if(!i)if(n.segments)n.sourceNode=n.targetNode=n.sourcePort=n.targetPort="";else{for(r=0;r<n.inEdges.length;r++)u=t.findNode(n.inEdges[r]),t.model.selectedItems.children.indexOf(u)==-1&&n.inEdges.splice(r,1);for(r=0;r<n.outEdges.length;r++)u=t.findNode(n.outEdges[r]),t.model.selectedItems.children.indexOf(u)==-1&&n.outEdges.splice(r,1)}}})},_renderItemContainer:function(n,t){var r=document.createElement("div"),i={width:100,height:100},u={id:n+"_paletteItem",draggable:"true",height:i.height+"px",width:i.width+"px",style:"padding: 4; height:"+(i.height+1)+"px;width:"+(i.width+1)+"px;-ms-touch-action: none;touch-action: none;"};return ej.datavisualization.Diagram.Util.attr(r,u),t.appendChild(r),this._setItemDraggable(r),this._renderAnchor(r,n,i)},_renderAnchor:function(n,t,i){var r=document.createElement("div"),u={id:t+"_anchor",height:i.height+"px","class":"e-anchor"};return ej.datavisualization.Diagram.Util.attr(r,u),n.appendChild(r),this._renderSvg(r,t,i)},_renderSvg:function(n,t,i){var r=document.createElement("div"),u={id:t+"_svgWrapper","class":"e-svg-container",style:"width:"+i.width+"px;height:"+i.height+"px;"},f;return ej.datavisualization.Diagram.Util.attr(r,u),u={id:t+"_svg",width:i.width,height:i.height,version:"1.1",xlink:"http://www.w3.org/1999/xlink"},f=new ej.datavisualization.Diagram.Svg(u),r.appendChild(f.document),n.appendChild(r),f}});ej.datavisualization.Diagram.Locale={};ej.datavisualization.Diagram.Locale["default"]={cut:"Cut",copy:"Copy",paste:"Paste",undo:"Undo",redo:"Redo",selectAll:"Select All",grouping:"Grouping",group:"Group",ungroup:"Ungroup",order:"Order",bringToFront:"Bring To Front",moveForward:"Move Forward",sendBackward:"Send Backward",sendToBack:"Send To Back"};ej.datavisualization.Diagram.Locale["en-US"]={cut:"Cut",copy:"Copy",paste:"Paste",undo:"Undo",redo:"Redo",selectAll:"Select All",grouping:"Grouping",group:"Group",ungroup:"Ungroup",order:"Order",bringToFront:"Bring To Front",moveForward:"Move Forward",sendBackward:"Send Backward",sendToBack:"Send To Back"};$.fn.pinchDiagram=function(n,t){var i=[],f=function(n){var u=n.touches,t,f,e,r,o,s;if(u.length>=2)for(t=0;t<u.length;t++){for(f=u[t],e=!1,r=0;r<i.length;r++)if(o=i[r],f.identifier===o.identifier){e=!0;break}e||(s=$.extend({},f),i.push(s))}n.preventDefault()},r=function(n,t){var i=t.pageX-n.pageX,r=t.pageY-n.pageY;return Math.sqrt(i*i+r*r)},e=function(n){for(var e,t,u,o,f=n.changedTouches,r=0;r<f.length;r++)for(e=f[r],t=0;t<i.length;t++)u=i[t],u.identifier===e.identifier&&(o=i.indexOf(u),i.splice(o,1));n.preventDefault()},u=function(n,t){n.pageX=t.pageX;n.pageY=t.pageY},o=function(n){var f,e,l;if(n.preventDefault(),f=n.touches,f.length>=2){var o=f[0],s=f[1],h=i[0],c=i[1];e=r(o,s)/r(h,c);l=t._mousePosition(n,!1);ej.datavisualization.Diagram.ZoomUtil.zoomPan(t,e,0,0,l,!0,!0);u(h,o);u(c,s)}};this[0].addEventListener("touchstart",f,!1);this[0].addEventListener("touchend",e,!1);this[0].addEventListener("touchmove",o,!1)}}(jQuery,Syncfusion),function(n,t){"use strict";t.MatrixTypes={Identity:0,Translation:1,Scaling:2,Unknown:4};t.MatrixDefaults={m11:1,m12:0,m21:0,m22:1,offsetX:0,offsetY:0,type:t.MatrixTypes.Identity};t.Matrix={identity:function(){return n.extend(!0,{},t.MatrixDefaults)},multiply:function(n,i){var u=n.type,f=i.type,e,r,o,s;if(f!=t.MatrixTypes.Identity){if(u==t.MatrixTypes.Identity){n.m11=i.m11;n.m12=i.m12;n.m21=i.m21;n.m22=i.m22;n.offsetX=i.offsetX;n.offsetY=i.offsetY;n.type=i.type;return}if(f==t.MatrixTypes.Translation){n.offsetX+=i.offsetX;n.offsetY+=i.offsetY;u!=t.MatrixTypes.Unknown&&(n.type|=t.MatrixTypes.Translation);return}if(u!=t.MatrixTypes.Translation){e=u<<4|f;switch(e){case 34:n.m11*=i.m11;n.m22*=i.m22;return;case 35:n.m11*=i.m11;n.m22*=i.m22;n.offsetX=i.offsetX;n.offsetY=i.offsetY;n.type=t.MatrixTypes.Translation|t.MatrixTypes.Scaling;return;case 36:break;default:switch(e){case 50:n.m11*=i.m11;n.m22*=i.m22;n.offsetX*=i.m11;n.offsetY*=i.m22;return;case 51:n.m11*=i.m11;n.m22*=i.m22;n.offsetX=i.m11*n.offsetX+i.offsetX;n.offsetY=i.m22*n.offsetY+i.offsetY;return;case 52:break;default:switch(e){case 66:case 67:case 68:break;default:return}}}r=this.identity();this._setMatrix(r,n.m11*i.m11+n.m12*i.m21,n.m11*i.m12+n.m12*i.m22,n.m21*i.m11+n.m22*i.m21,n.m21*i.m12+n.m22*i.m22,n.offsetX*i.m11+n.offsetY*i.m21+i.offsetX,n.offsetX*i.m12+n.offsetY*i.m22+i.offsetY);r.m21||r.m12?r.type=t.MatrixTypes.Unknown:((r.m11&&r.m11!=1||r.m22&&r.m22!=1)&&(r.type=t.MatrixTypes.Scaling),(r.offsetX||r.offsetY)&&(r.type|=t.MatrixTypes.Translation),(r.type&(t.MatrixTypes.Translation|t.MatrixTypes.Scaling))==t.MatrixTypes.Identity&&(r.type=t.MatrixTypes.Identity));n.m11=r.m11;n.m12=r.m12;n.m21=r.m21;n.m22=r.m22;n.offsetX=r.offsetX;n.offsetY=r.offsetY;n.type=r.type;return}if(o=n.offsetX,s=n.offsetY,n.m11=i.m11,n.m12=i.m12,n.m21=i.m21,n.m22=i.m22,n.offsetX=i.offsetX,n.offsetY=i.offsetY,n.type=i.type,n.offsetX=o*i.m11+s*i.m21+i.offsetX,n.offsetY=o*i.m12+s*i.m22+i.offsetY,f==t.MatrixTypes.Unknown){n.type=t.MatrixTypes.Unknown;return}n.type=t.MatrixTypes.Translation|t.MatrixTypes.Scaling}},transform:function(n,t){var i=this._multiplyPoint(n,t.x,t.y);return{x:Math.round(i.x*100)/100,y:Math.round(i.y*100)/100}},rotate:function(n,t,i,r){t%=360;this.multiply(n,this._createRotationRadians(t*.017453292519943295,i?i:0,r?r:0))},scale:function(n,t,i,r,u){this.multiply(n,this._createScaling(t,i,r?r:0,u?u:0))},translate:function(n,i,r){if(n.type&t.MatrixTypes.Identity){this._setMatrix(n,1,0,0,1,i,r,t.MatrixTypes.Translation);return}if(n.type&t.MatrixTypes.Unknown){n.offsetX+=i;n.offsetY+=r;return}n.offsetX+=i;n.offsetY+=r;n.type|=t.MatrixTypes.Translation},_createScaling:function(n,i,r,u){var f=this.identity();return this._setMatrix(f,n,0,0,i,r-n*r,u-i*u,(r||u)?t.MatrixTypes.Scaling|t.MatrixTypes.Translation:t.MatrixTypes.Scaling),f},_createRotationRadians:function(n,i,r){var e=this.identity(),u=Math.sin(n),f=Math.cos(n),o=i*(1-f)+r*u,s=r*(1-f)-i*u;return this._setMatrix(e,f,u,-u,f,o,s,t.MatrixTypes.Unknown),e},_multiplyPoint:function(n,i,r){switch(n.type){case t.MatrixTypes.Identity:break;case t.MatrixTypes.Translation:i+=n.offsetX;r+=n.offsetY;break;case t.MatrixTypes.Scaling:i*=n.m11;r*=n.m22;break;case t.MatrixTypes.Translation|t.MatrixTypes.Scaling:i*=n.m11;i+=n.offsetX;r*=n.m22;r+=n.offsetY;break;default:var u=r*n.m21+n.offsetX,f=i*n.m12+n.offsetY;i*=n.m11;i+=u;r*=n.m22;r+=f}return{x:i,y:r}},_setMatrix:function(n,i,r,u,f,e,o,s){n.m11=i;n.m12=r;n.m21=u;n.m22=f;n.offsetX=e;n.offsetY=o;n.type=s||t.MatrixTypes.Identity}}}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.HitTesting={_getResizeHandleCenter:function(n,i,r){var f,u;r||(r=1);f=this.bounds(n);u=t.datavisualization.Diagram.Point(0,0);switch(i){case"topleft":u=f.topLeft;break;case"topcenter":u=f.top;break;case"topright":u=f.topRight;break;case"middleleft":u=f.left;break;case"middleright":u=f.right;break;case"bottomleft":u=f.bottomLeft;break;case"bottomcenter":u=f.bottom;break;case"bottomright":u=f.bottomRight;break;case"pivot":u=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY);break;case"rotate":var o=20/r,s=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY-n.height*n.pivot.y-10-o),e=t.Matrix.identity();t.Matrix.rotate(e,n.rotateAngle,n.offsetX,n.offsetY);u=t.Matrix.transform(e,s)}return u},findResizeHandleAtPoint:function(n,i){var e=null,u,o,f,r,s;if(n)for(f=["topleft","topcenter","topright","middleleft","middleright","bottomleft","bottomcenter","bottomright"],r=0,s=f.length;r<s;r++)if(u=this._getResizeHandleCenter(n,f[r]),u!==t.datavisualization.Diagram.Point(0,0)&&(o=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),o)){e=f[r];break}return e},findRotationHandleAtPoint:function(n,i,r){var u=this._getResizeHandleCenter(n,"rotate",r),f=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),10);return f?!0:!1},findPivotHandleAtPoint:function(n,i){var r=this._getResizeHandleCenter(n,"pivot"),u=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(r.x,r.y),7);return u?!0:!1},findEndPointHandleAtPoint:function(n,i){var f=null,r,e,u,o;return n&&(e=n.line.points,u=e[e.length-1],r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),r&&(f="targetEndPoint"),r||(u=e[0],r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),r&&(f="sourceEndPoint")),r||n.line.type!=="bezier"||(u=n.line._point1,r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(u.x,u.y),7),r&&(f="bezierpoint1"),r||(o=n.line._point2,r=t.datavisualization.Diagram.Geometry.checkPointOnCircle(i,t.datavisualization.Diagram.Point(o.x,o.y),7),r&&(f="bezierpoint2")))),f}};t.datavisualization.Diagram.LayoutUtil={expandSubTree:function(n,i,r,u,f,e,o){var s,c,h,l;n._isAnimating||(s=n.model.scrollSettings.currentZoom,c=i.offsetX*s-n.model.scrollSettings.viewPortWidth/2-n.model.scrollSettings.horizontalOffset,(i.offsetY*s<n.model.scrollSettings.verticalOffset||i.offsetY*s>n.model.scrollSettings.verticalOffset+n.model.scrollSettings.viewPortHeight-3*i.height*s)&&n.update({scrollSettings:{verticalOffset:i.offsetY-n.model.scrollSettings.viewPortHeight/2}}),h=0,c!=0&&e?(n._preventScrollerUpdate=!0,l=setInterval(function(){h<4&&n.update({scrollSettings:{horizontalOffset:n.model.scrollSettings.horizontalOffset+c/4}});h++;h==5&&(clearInterval(l),delete n._preventScrollerUpdate,(o!==!1||!i.isExpanded)&&i.outEdges.length?t.datavisualization.Diagram.LayoutUtil.expand(n,i,r,u,f):t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(n))},25)):(delete n._preventScrollerUpdate,(o!==!1||!i.isExpanded)&&i.outEdges.length?this.expand(n,i,r,u,f):t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(n)))},_updateVisiblity:function(n,i,r){for(var u,f,e=0;e<i.outEdges.length;e++)u=i.outEdges[e],u=n.findNode(u),f=n.findNode(u.targetNode),u.opacity=f.opacity=r/100,t.datavisualization.Diagram.DiagramContext.updateNodeStyle(f,n),t.datavisualization.Diagram.DiagramContext.updateConnectorStyle(u,n),f.isExpanded&&f.outEdges.length&&this._updateVisiblity(n,f,r)},expand:function(i,r,u,f,e){var v,s,h,o,y,l,c,a,p;if(u===undefined&&(u=r.name),v=i.model.layout.fixedNode,i.model.layout.fixedNode=u,s=i.selectionList[0]?i.selectionList[0].name:"",s&&i._clearSelection(!0),f){if(!i._isAnimating){if(r._updateExpander=!0,i._updateEdgeCollection(),r.isExpanded?(i._collapseChildren(r),r.isExpanded=!1):(i._expandChildren(r),r.isExpanded=!0),i._isAnimating=!0,h=t.datavisualization.Diagram.Layout.doLayout(i,!1),o=0,h.length)n(".ej-d-connector").attr("opacity",0),n(".ej-d-icon-template").attr("opacity",0),i._layoutInAction=!0,y=setInterval(function(){var r,f,c;if(o++,o<5)for(r=0;r<h.length;r++)f=i.nameTable[h[r].object],i._disableSegmentChange=!0,i.updateNode(f.name,{offsetX:f.offsetX+h[r].diff/4,offsetY:f.offsetY+h[r].diffy/4}),i._disableSegmentChange=!1;if(o==5){for(clearInterval(y),delete i._layoutInAction,c=i._internalLayout,o=0;o<c._firstLevelNodes.length;o++)t.datavisualization.Diagram.HierarchicalLayout._updateConnectors(c,c._firstLevelNodes[o],1);delete i._internalLayout;n(".ej-d-connector").attr("opacity",1);n(".ej-d-icon-template").attr("opacity",1);(s||e)&&i._addSelection(i.findNode(s||u),!e);i._isAnimating=!1;delete i._preventScrollerUpdate;t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(i)}},50);else{for(l=i._internalLayout,o=0;o<l._firstLevelNodes.length;o++)t.datavisualization.Diagram.HierarchicalLayout._updateConnectors(l,l._firstLevelNodes[o],1);(s||e)&&i._addSelection(i.findNode(s||u),!e);i._isAnimating=!1;delete i._internalLayout}c=0;a=this;r.isExpanded&&(a._updateVisiblity(i,r,0),p=setInterval(function(){r.isExpanded&&(c<=100&&a._updateVisiblity(i,r,c),c==120&&clearInterval(p),c+=5)},25));t.datavisualization.Diagram.PageUtil._updatePageSize(i)}}else i.layout();i.model.layout.fixedNode=v}};t.datavisualization.Diagram.Util={convertPathToArray:function(n){var u=[],e=this.parsePathData(n),f,i,r,t;if(e.length>0)for(f=0;f<e.length;f++){i=e[f];r=i[0];switch(r.toLowerCase()){case"m":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x:i[t],y:i[t+1]}),t=t+1,r==="m"?r="l":r==="M"&&(r="L");break;case"l":case"t":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x:i[t],y:i[t+1]}),t=t+1;break;case"h":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x:i[t]});break;case"v":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,y:i[t]});break;case"z":u.push({pathSegTypeAsLetter:r});break;case"c":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x1:i[t],y1:i[t+1],x2:i[t+2],y2:i[t+3],x:i[t+4],y:i[t+5]}),t=t+5;break;case"s":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x2:i[t],y2:i[t+1],x:i[t+2],y:i[t+3]}),t=t+3;break;case"q":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,x1:i[t],y1:i[t+1],x:i[t+2],y:i[t+3]}),t=t+3;break;case"a":for(t=1;t<i.length;t++)u.push({pathSegTypeAsLetter:r,r1:i[t],r2:i[t+1],angle:i[t+2],largeArcFlag:this.parseArcFlag(i[t+3]),sweepFlag:this.parseArcFlag(i[t+4]),x:i[t+5],y:i[t+6]}),t=t+6}}return u},_getImageAlignment:function(n){if(n)switch(n.toLowerCase()){case"xminymin":return"xMinYMin";case"xminymid":return"xMinYMid";case"xminymax":return"xMinYMax";case"xmidymin":return"xMidYMin";case"xmidymid":return"xMidYMid";case"xmidymax":return"xMidYMax";case"xmaxymin":return"xMaxYMin";case"xmaxymid":return"xMaxYMid";case"xmaxymax":return"xMaxYMax";case"none":return"none"}return"none"},parseArcFlag:function(n){var t;return n==="0"||n===0?t=!1:(n==="1"||n===1)&&(t=!0),t},parsePathData:function(n){var f=/([a-z]+)|([+-]?(?:\d+\.?\d*|\.\d+))/gi,i,t,r=[],u,e;for(f.lastIndex=0,u=!1;i=f.exec(n);)i[1]==="e"?(e="",u=!0):i[1]?(i[1].toLowerCase()==="zm"?(t&&r.push(t),r.push(["Z"]),t=[i[1].substring(1,2)]):(t&&r.push(t),t=[i[1]]),u=!1):(t||(t=[]),u||t.push(Number(i[2])),u=!1);return t&&r.push(t),r},pathSegArrayAsString:function(n){for(var i,r="",t=0;t<n.length;t++)i=n[t],r+=t===0?this.pathToString(i):" "+this.pathToString(i);return r},canEnablePointerEvents:function(n,i){var r=n,u;if(i)while(r){if(u=r.segments?r.constraints&t.datavisualization.Diagram.ConnectorConstraints.PointerEvents:r.constraints&t.datavisualization.Diagram.NodeConstraints.PointerEvents,!u)return u;r=typeof r.parent=="string"?i.nameTable[r.parent]:r}return!0},isClassifier:function(t){var i=typeof t.target.className=="string"?t.target.className:t.target.className.baseVal;return n(t.target).hasClass("ej-d-classifier")||i.indexOf("ej-d-classifier")>-1?!0:!1},pathToString:function(n){var t;switch(n.pathSegTypeAsLetter){case"Z":case"z":t=n.pathSegTypeAsLetter;break;case"M":case"m":case"L":case"l":t=n.pathSegTypeAsLetter+" "+n.x+" "+n.y;break;case"C":case"c":t=n.pathSegTypeAsLetter+" "+n.x1+" "+n.y1+" "+n.x2+" "+n.y2+" "+n.x+" "+n.y;break;case"Q":case"q":t=n.pathSegTypeAsLetter+" "+n.x1+" "+n.y1+" "+n.x+" "+n.y;break;case"A":case"a":t=n.pathSegTypeAsLetter+" "+n.r1+" "+n.r2+" "+n.angle+" "+(n.largeArcFlag?"1":"0")+" "+(n.sweepFlag?"1":"0")+" "+n.x+" "+n.y;break;case"H":case"h":t=n.pathSegTypeAsLetter+" "+n.x;break;case"V":case"v":t=n.pathSegTypeAsLetter+" "+n.y;break;case"S":case"s":t=n.pathSegTypeAsLetter+" "+n.x2+" "+n.y2+" "+n.x+" "+n.y;break;case"T":case"t":t=n.pathSegTypeAsLetter+" "+n.x+" "+n.y}return t},findPortByName:function(n,t){var r,i,u;if(n&&n.ports)for(i=0,u=n.ports.length;i<u;i++)if(r=n.ports[i],r.name===t)return r;return null},attr:function(n,t){for(var i in t)n.setAttribute(i.toString(),t[i])},removeChildFromGroup:function(n,t){var i=n.indexOf(t),r;if(i<0)for(r in n)if(typeof n[r]=="object"&&typeof t=="string"&&n[r].name===t){i=r;break}i>=0&&n.splice(i,1)},removeFromCollection:function(n,t,i){var i,r,u;if(n){i=n.nameTable[n._getChild(i)];for(r in t)u=n.nameTable[n._getChild(t[r])],u.name===i.name&&t.splice(r,1)}},removeItem:function(n,t){var i=n.indexOf(t);i>=0&&n.splice(i,1)},clear:function(n){while(n.length>0)n.pop()},getChild:function(n){if(n)return typeof n=="object"?n.name:n},randomId:function(){for(var n,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",r="",u=0;u<4;u++)n=t.getRandomValue(0,i.length-1),r+=i.substring(n,n+1);return r},htmlEncode:function(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")},canMove:function(n){if(this.canSelect(n))return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Drag:n.constraints&t.datavisualization.Diagram.NodeConstraints.Drag},canMoveLabel:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragLabel:n.constraints&t.datavisualization.Diagram.NodeConstraints.DragLabel},canRotate:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Rotate:n.constraints&t.datavisualization.Diagram.NodeConstraints.Rotate},canShowTooltip:function(n,i){var r;return(r=n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.InheritTooltip:n.constraints&t.datavisualization.Diagram.NodeConstraints.InheritTooltip,r)?i.model.tooltip:n.tooltip},canSelect:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Select:n.constraints&t.datavisualization.Diagram.NodeConstraints.Select},canBridge:function(n,i){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Bridging?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Bridging:n.constraints&t.datavisualization.Diagram.ConnectorConstraints.InheritBridging?i.model.constraints&t.datavisualization.Diagram.DiagramConstraints.Bridging:void 0},canCrispEdges:function(n,i){if(n.segments){if(n.constraints&t.datavisualization.Diagram.ConnectorConstraints.CrispEdges)return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.CrispEdges;if(i&&n.constraints&t.datavisualization.Diagram.ConnectorConstraints.InheritCrispEdges)return i.model.constraints&t.datavisualization.Diagram.DiagramConstraints.CrispEdges}else{if(n.constraints&t.datavisualization.Diagram.NodeConstraints.CrispEdges)return n.constraints&t.datavisualization.Diagram.NodeConstraints.CrispEdges;if(i&&n.constraints&t.datavisualization.Diagram.NodeConstraints.InheritCrispEdges)return i.model.constraints&t.datavisualization.Diagram.DiagramConstraints.CrispEdges}},canAllowPan:function(n){return n.constraints&t.datavisualization.Diagram.NodeConstraints.AllowPan},canAllowDrop:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.AllowDrop:n.constraints&t.datavisualization.Diagram.NodeConstraints.AllowDrop},canDelete:function(n){return n.segments?n.constraints&t.datavisualization.Diagram.ConnectorConstraints.Delete:n.constraints&t.datavisualization.Diagram.NodeConstraints.Delete},isPageEditable:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.UserInteraction},canFloatElements:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.FloatElements},canEnableAPIMethods:function(n){if(n&&n._enableAPIMethods)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.APIUpdate},canDoMultipleSelection:function(n){if(n&&this.isPageEditable(n))return n.tool()&t.datavisualization.Diagram.Tool.MultipleSelect},canDoSingleSelection:function(n){if(n&&this.isPageEditable(n))return n.tool()&t.datavisualization.Diagram.Tool.SingleSelect},canMoveOutofBoundary:function(n){return n.model.pageSettings.boundaryConstraints!="infinity"?!0:!1},_getPseudoGroupConstraints:function(i,r,u){var f,e,o,h,s;if(u&&u.type==="pseudoGroup")if((u.children.indexOf(r.name)>=0||r.name===u.name)&&i.model.selectedItems.getConstraints&&(e=i.model.selectedItems.getConstraints,typeof e=="string"&&(e=t.util.getObject(e,window))),e&&n.isFunction(e))f=e();else if(u.children)for(f=t.datavisualization.Diagram.NodeConstraints.Default,o=0;o<u.children.length;o++)h=i.nameTable[i._getChild(u.children[o])],h&&(s=h.constraints,s&t.datavisualization.Diagram.NodeConstraints.Resize||(f=f&~t.datavisualization.Diagram.NodeConstraints.Resize),s&t.datavisualization.Diagram.NodeConstraints.Rotate||(f=f&~t.datavisualization.Diagram.NodeConstraints.Rotate),s&t.datavisualization.Diagram.NodeConstraints.Drag||(f=f&~t.datavisualization.Diagram.NodeConstraints.Drag));return f},canPanning:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableX||n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableY},canZooming:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.Zoomable},canUndo:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.Undoable},canZoomTextEditor:function(n){if(n)return n.model.constraints&t.datavisualization.Diagram.DiagramConstraints.ZoomTextEditor},canMultiSelectOnLane:function(n){return n.constraints&t.datavisualization.Diagram.NodeConstraints.MultiSelect},canMultiSelectOnNode:function(n){return n.constraints&t.datavisualization.Diagram.NodeConstraints.PointerEvents},canEnableTooltip:function(n){return n.model.selectedItems.constraints&t.datavisualization.Diagram.SelectorConstraints.Tooltip?!0:!1},canDrawStackHighlighter:function(n,i,r){var o,u,f,e;if(t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)&&n&&i&&r&&(o=n.nameTable[r.parent],o&&o.isLaneStack&&(u=n.nameTable[o.parent],u&&u.isSwimlane)))if(f=this.bounds(u),e=n.activeTool._getPageBounds(),u.orientation==="horizontal"){if(i.height+f.bottom>=e.height||i.width-u.width+f.right>e.width)return n.activeTool.updateCursor("not-allowed"),n._notAllow=!0,!1}else if(i.width+f.right>=e.width||i.height-u.height+f.bottom>e.height)return n.activeTool.updateCursor("not-allowed"),n._notAllow=!0,!1;return!0},canDragSourceEnd:function(n){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragSourceEnd},canDragTargetEnd:function(n){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragTargetEnd},canDragSegmentThumbs:function(n){return n.constraints&t.datavisualization.Diagram.ConnectorConstraints.DragSegmentThumb},isTargetConnected:function(n){return n.targetNode?!0:!1},isSourceConnected:function(n){return n.sourceNode?!0:!1},bounds:function(n,i){var r={},o,s,h,c,u,e,f;if(n)if(n.segments)for(o=0;o<n.segments.length;o++)s=n.segments[o],o==0?s.points&&(r=t.datavisualization.Diagram.Geometry.rect(s.points)):r=t.datavisualization.Diagram.Geometry.union(r,t.datavisualization.Diagram.Geometry.rect(s.points)),r.width==0&&(r.width=n.lineWidth,r.x-=n.lineWidth/2),r.height==0&&(r.height=n.lineWidth,r.y-=n.lineWidth/2);else n._type=="node"||n._type==="group"||n.type=="umlclassifier"||n._type=="pseudoGroup"?(h=n.width?n.width:n._width||0,c=n.height?n.height:n._height||0,r={x:n.offsetX-h*n.pivot.x,y:n.offsetY-c*n.pivot.y,width:h,height:c}):r=n;else r=t.datavisualization.Diagram.Rectangle();return r?(u={},r.x=Math.round(r.x*100)/100,r.y=Math.round(r.y*100)/100,r.width=Math.round(r.width*100)/100,r.height=Math.round(r.height*100)/100,u.width=r.width,u.height=r.height,u.x=u.left=r.x,u.right=r.x+r.width,u.y=u.top=r.y,u.bottom=r.y+r.height,u.center={x:r.x+r.width/2,y:r.y+r.height/2},u.topLeft={x:r.x,y:r.y},u.topCenter={x:r.x+r.width/2,y:r.y},u.topRight={x:r.x+r.width,y:r.y},u.middleLeft={x:r.x,y:r.y+r.height/2},u.middleRight={x:r.x+r.width,y:r.y+r.height/2},u.bottomLeft={x:r.x,y:r.y+r.height},u.bottomCenter={x:r.x+r.width/2,y:r.y+r.height},u.bottomRight={x:r.x+r.width,y:r.y+r.height},n&&n.rotateAngle&&!i&&(e=t.Matrix.identity(),t.Matrix.rotate(e,n.rotateAngle,n.offsetX,n.offsetY),u.topLeft=t.Matrix.transform(e,u.topLeft),u.topCenter=t.Matrix.transform(e,u.topCenter),u.topRight=t.Matrix.transform(e,u.topRight),u.middleLeft=t.Matrix.transform(e,u.middleLeft),u.middleRight=t.Matrix.transform(e,u.middleRight),u.bottomLeft=t.Matrix.transform(e,u.bottomLeft),u.bottomCenter=t.Matrix.transform(e,u.bottomCenter),u.bottomRight=t.Matrix.transform(e,u.bottomRight),f=t.datavisualization.Diagram.Geometry.rect([u.topLeft,u.topRight,u.bottomRight,u.bottomLeft]),u.x=u.left=f.x,u.y=u.top=f.y,u.right=f.x+f.width,u.bottom=f.y+f.height,u.center=t.datavisualization.Diagram.Point(f.x+f.width/2,f.y+f.height/2)),u.points=[u.topLeft,u.topRight,u.bottomRight,u.bottomLeft],u):r},_swapBounds:function(n,i){var n,i,u,r;return i=i,n.rotateAngle?(n.rotateAngle<45||(n.rotateAngle<=135?(u=t.Matrix.identity(),t.Matrix.rotate(u,n.rotateAngle,n.offsetX,n.offsetY),r=i.topCenter,i.topCenter=i.middleLeft,i.middleLeft=i.bottomCenter,i.bottomCenter=i.middleRight,i.middleRight=r,r=i.topLeft,i.topLeft=i.bottomLeft,i.bottomLeft=i.bottomRight,i.bottomRight=i.topRight,i.topRight=r):n.rotateAngle<=225?(u=t.Matrix.identity(),t.Matrix.rotate(u,n.rotateAngle,n.offsetX,n.offsetY),r=i.topCenter,i.topCenter=i.bottomCenter,i.bottomCenter=r,r=i.middleLeft,i.middleLeft=i.middleRight,i.middleRight=r,r=i.bottomLeft,i.bottomLeft=i.topLeft,i.topLeft=r,r=i.bottomRight,i.bottomRight=i.topRight,i.topRight=r):n.rotateAngle<=315&&(u=t.Matrix.identity(),t.Matrix.rotate(u,n.rotateAngle,n.offsetX,n.offsetY),r=i.topCenter,i.topCenter=i.middleRight,i.middleRight=i.bottomCenter,i.bottomCenter=i.middleLeft,i.middleLeft=r,r=i.topRight,i.topRight=i.bottomRight,i.bottomRight=i.bottomLeft,i.bottomLeft=i.topLeft,i.topLeft=r)),i.points=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],i):void 0},canResize:function(n,i){if(i)switch(i){case"n-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorth;case"s-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouth;case"e-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeEast;case"w-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeWest;case"se-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast;case"ne-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast;case"sw-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest;case"nw-resize":return n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest}else return n.constraints&t.datavisualization.Diagram.NodeConstraints.Resize},canConnect:function(n,i){var r=null;return n&&(i?r=n.constraints&t.datavisualization.Diagram.PortConstraints.Connect:n.segments||(r=n.constraints&t.datavisualization.Diagram.NodeConstraints.Connect)),r},_initializeSegments:function(n,i){var u,f,r;if(n.segments&&n.segments.length<=1){n.segments.length||n.segments.push(t.datavisualization.Diagram.Segment({type:i||"straight"}));u=n.segments[0];switch(u.type){case"straight":u.point?(u.point.x!=n.targetPoint.x||u.point.y!=n.targetPoint.y)&&n.segments.push({type:u.type||"straight"}):u._point=n.targetPoint;break;case"orthogonal":u.length&&u.direction?(t.datavisualization.Diagram.Util._addOrthogonalPoints(u,null,null,n.sourcePoint,n.targetPoint),(u._endPoint.x!=n.targetPoint.x||u._endPoint.y!=n.targetPoint.y)&&n.segments.push({type:u.type||"straight"})):(u._length=u.length||20,u._direction=u.direction||"auto");break;case"bezier":u.point?(u.point.x!=n.targetPoint.x||u.point.y!=n.targetPoint.y)&&n.segments.push({type:u.type||"straight"}):u._point=n.targetPoint}}var e=n.sourcePoint,o=null,h=null,s;for(f=0;f<n.segments.length;f++){if(r=n.segments[f],r._startPoint=e,h=n.segments[f+1],r=n.segments[f]=t.datavisualization.Diagram.Segment(n.segments[f]),r.type=="orthogonal"){if(r._direction=r.direction||"auto",r._length=r.length||20,s=t.datavisualization.Diagram.Util._addOrthogonalPoints(n.segments[f],o,h,n.sourcePoint,n.targetPoint,s),e=n.segments[f]._endPoint,!r.length||!r.direction)break}else if(r.type=="straight"){if(r.points.push(e),r.points.push(n.segments[f].point||n.targetPoint),r._point=r._endPoint=n.segments[f].point||n.targetPoint,s=t.datavisualization.Diagram.Geometry.findAngle(e,r._endPoint),e=n.segments[f]._endPoint,!r.point)break}else if(r.type=="bezier"){if(r._point=r._endPoint=n.segments[f].point||n.targetPoint,r.points.push(e),r.points.push(n.segments[f].point||n.targetPoint),s=t.datavisualization.Diagram.Geometry.findAngle(e,r._endPoint),t.datavisualization.Diagram.Util._updateBezierPoints(r),e=n.segments[f]._endPoint,!r.point)break}else{r=t.datavisualization.Diagram.Segment({type:"orthogonal"});r._direction="auto";r._length=20;r._startPoint=e;r._endPoint=n.targetPoint;n.segments.push(r);t.datavisualization.Diagram.Util._addOrthogonalPoints(r,o,null,n.sourcePoint,n.targetPoint,s);break}o=n.segments[f]}(e.x!=n.targetPoint.x||e.y!=n.targetPoint.y)&&(r=t.datavisualization.Diagram.Segment({type:(o?o.type:i)||"straight"}),r._startPoint=e,r._endPoint=n.targetPoint,r.type=="orthogonal"?t.datavisualization.Diagram.Util._addOrthogonalPoints(r,o,null,n.sourcePoint,n.targetPoint,s):(r._point=n.targetPoint,r.points.push(e),r.points.push(n.targetPoint),r.type=="bezier"&&this._updateBezierPoints(r)),n.segments.push(r))},_getDockableBPMNNode:function(n,t,i,r){var u=r?t.segments[t.segments.length-1]:t.segments[0];if(n&&n.type=="bpmn"){if(u.type=="orthogonal")return n;n._type=="group"&&(n=typeof n.children[0]=="object"?n.children[0]:i[n.children[0]])}return n},dock:function(n,t,i){var r,o=null,u,s=null,h=n._srcDecoratorSize,c=n._tarDecoratorSize,f,e;n.sourcePadding&&(n._srcDecoratorSize+=n.sourcePadding);n.targetPadding&&(n._tarDecoratorSize+=n.targetPadding);r=t[n.targetNode];r&&(o=this.findPortByName(r,n.targetPort));u=t[n.sourceNode];u&&(s=this.findPortByName(u,n.sourcePort));f=this.isSourceConnected(n);e=this.isTargetConnected(n);s?s.connectorPadding&&(n._srcDecoratorSize+=s.connectorPadding):(u=this._getDockableBPMNNode(u,n,t,!1),u&&u.connectorPadding&&(n._srcDecoratorSize+=u.connectorPadding));o?o.connectorPadding&&(n._tarDecoratorSize+=o.connectorPadding):(r=this._getDockableBPMNNode(r,n,t,!0),r&&r.connectorPadding&&(n._tarDecoratorSize+=r.connectorPadding));e&&f&&o&&s?this._dockPortToPort(n,r,o,u,s):e&&o?f?n.segments.length==1?(this._dockNode(n,u,null,e,f),this._dockPortToNode(n,r,o,u,s,!0)):(this._dockNode(n,u,null,e,f),this._updateIntermediateSegments(n),this._dockPortToPoint(n,r,o,!0),this._updatePreviousSegment(n)):(this._dockPortToPoint(n,r,o,!0),this._updatePreviousSegment(n)):f&&s?e?n.segments.length==1?(this._dockNode(n,r,null,e,f),this._dockPortToNode(n,u,s,r,o,!1)):(this._dockPortToPoint(n,u,s,!1),this._updateIntermediateSegments(n),this._dockNode(n,r,null,e,f),this._updatePreviousSegment(n)):(this._dockPortToPoint(n,u,s,!1),this._updateIntermediateSegments(n)):e&&f?r&&u&&this._dockNode(n,r,u,e,f,i):e?this._dockNode(n,r,null,e,f):f&&this._dockNode(n,u,null,e,f);this._adjustEndPoint(n,u,s,r,o);n._srcDecoratorSize=h;n._tarDecoratorSize=c},_dockPortToPort:function(n,i,r,u,f){var o,s,h;if(n.segments.length==1){i&&(s=this.bounds(i,!0));u&&(h=this.bounds(u,!0));var e,c=n.segments[0],w=n.segments[n.segments.length-1],v=n.segments[0];if(v.type!=="orthogonal")r&&(o=this._getPortPosition(r,s),i.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,i.rotateAngle,i.offsetX,i.offsetY),o=t.Matrix.transform(e,o)),this._setLineEndPoint(n,o,!0)),f&&(o=this._getPortPosition(f,h),u.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,u.rotateAngle,u.offsetX,u.offsetY),o=t.Matrix.transform(e,o)),this._setLineEndPoint(n,o,!1)),v.type==="bezier"&&this._updateBezierPoints(v,i,r,s,u,f,h);else{var l=this._getPortPosition(r,s),a=this._getPortPosition(f,h),y=this._swapDirection(i.rotateAngle,this._getDirection(s,l)),p=this._swapDirection(u.rotateAngle,this._getDirection(h,a));u.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,u.rotateAngle,u.offsetX,u.offsetY),a=t.Matrix.transform(e,a));i.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,i.rotateAngle,i.offsetX,i.offsetY),l=t.Matrix.transform(e,l));this._constructSegements(n,c,s,l,y,h,a,p);this._setLineEndPoint(n,c.points[0],!1);this._setLineEndPoint(n,c.points[c.points.length-1],!0)}}else this._dockPortToPoint(n,u,f,!1),this._updateIntermediateSegments(n),this._dockPortToPoint(n,i,r,!0),this._updatePreviousSegment(n)},_dockPortToNode:function(n,i,r,u,f,e){var p=n.segments[0],w=n.segments[n.segments.length-1],h,l,c,b,a,o,y,s,v;i&&(h=this.bounds(i,!0));u&&(l=this.bounds(u,!0));b=e?w:p;b.type!=="orthogonal"?(a=this._getPortPosition(r,h),c=t.Matrix.identity(),t.Matrix.rotate(c,i.rotateAngle,i.offsetX,i.offsetY),a=t.Matrix.transform(c,a),this._setLineEndPoint(n,a,e)):(o=this._getPortPosition(r,h),y=this._swapDirection(i.rotateAngle,this._getDirection(h,o)),c=t.Matrix.identity(),t.Matrix.rotate(c,i.rotateAngle,i.offsetX,i.offsetY),o=t.Matrix.transform(c,o),s=e?n.sourcePoint:n.targetPoint,v=u?this._getDirection(l,s):"top",v&&(h=this.bounds(i),l=u?this.bounds(u):{left:s.x,right:s.x,top:s.y,bottom:s.y},e?(this._setLineEndPoint(n,o,!0),this._constructSegements(n,w,h,o,y,l,s,v)):(this._setLineEndPoint(n,o,!1),this._constructSegements(n,p,l,s,v,h,o,y))))},_dockPortToPoint:function(n,i,r,u){var s=n.segments[0],h=n.segments[n.segments.length-1],a=u?h:s,o,v,y;if(a.type!=="orthogonal")this._dockPortToNode(n,i,r,null,null,u);else{var e=this.bounds(i,!0),f=this._getPortPosition(r,e),c=this._swapDirection(i.rotateAngle,this._getDirection(e,f)),l=t.Matrix.identity();t.Matrix.rotate(l,i.rotateAngle,i.offsetX,i.offsetY);f=t.Matrix.transform(l,f);o=u?h._startPoint:s._endPoint;v=this.bounds(t.datavisualization.Diagram.Rectangle(o.x,o.y,0,0));e=this.bounds(i);y="top";u?(this._setLineEndPoint(n,f,!0),this._pointsFromNodeToPoint(n,h,c,e,i.rotateAngle,f,o,!0)):(this._setLineEndPoint(n,f,!1),this._pointsFromNodeToPoint(n,s,c,e,i.rotateAngle,f,o,!1))}},_containsminSpaceBetweenNode:function(n,t,i){var r;if(n&&n.minSpaceBetweenNode&&t&&i&&n.minSpaceBetweenNode&&n.minSpaceBetweenNode.length>0)for(r in n.minSpaceBetweenNode)if(n.minSpaceBetweenNode[r]===t.name||n.minSpaceBetweenNode[r]===i.name)return!0;return!1},_dockNode:function(n,t,i,r,u,f){var v,y,c=n._srcDecoratorSize+n._tarDecoratorSize,o,e,s,h,l,a,p;c=this._containsminSpaceBetweenNode(f,i,t)?0:c;n.segments.length==1?v=y=n.segments[0]:(v=n.segments[0],y=n.segments[n.segments.length-1]);r&&u&&!n.targetPort&&!n.sourcePort?n.segments.length==1?n.segments[0].type=="orthogonal"?(o=this.bounds(i),e=this.bounds(t),this._swapBounds(i,o),this._swapBounds(t,e),o.y-c>=e.bottom?(s=o.topCenter,l="top",h=e.bottomCenter,a="bottom"):o.bottom+c<=e.y&&(h=e.topCenter,a="top",s=o.bottomCenter,l="bottom"),o.bottom+c>e.y&&o.y<e.bottom+c&&(o.right+c<e.x||e.right>=o.x-c&&o.x>e.x?(s=o.middleRight,l="right",h=e.middleLeft,a="left"):e.right+c<o.x||o.right>=e.x-c&&o.x<e.x?(s=o.middleLeft,l="left",h=e.middleRight,a="right"):o.x<=e.x?(s=o.middleLeft,l="left",h=e.middleLeft,a="left"):o.x<=e.right?(s=o.middleRight,l="right",h=e.middleRight,a="right"):(s=o.middleLeft,l="left",h=e.middleRight,a="right")),p=this._findEndPoint(l,s,i)||o.center,s=this._findIntersection(i,o,n,s,p,!1)||s,p=this._findEndPoint(a,h,t)||e.center,h=this._findIntersection(t,e,n,h,p,!0)||h,this._setLineEndPoint(n,s,!1),this._setLineEndPoint(n,h,!0),n.segments[0].type=="orthogonal"&&(this._constructSegements(n,n.segments[0],e,n.targetPoint,a,o,n.sourcePoint,l),n.segments[0]._direction=l)):(t&&(e=this.bounds(t),this._swapBounds(t,e),i&&(o=this.bounds(i),this._swapBounds(i,o),this._setLineEndPoint(n,o.center,!1),this._setLineEndPoint(n,e.center,!0),this._dockBounds(n,i,o,!1)),this._setLineEndPoint(n,e.center,!0),this._dockBounds(n,t,e,!0)),n.segments[0].type=="bezier"&&this._updateBezierPoints(n.segments[0])):(this._dock(n,v,i,null,!1),this._updateIntermediateSegments(n),n.segments.length==1?(this._dock(n,v,i,t,!1),this._dock(n,y,t,i,!0)):(this._dock(n,y,t,null,!0),this._updatePreviousSegment(n))):r&&!n.targetPort?(this._dock(n,y,t,i,!0),this._updatePreviousSegment(n)):u&&!n.sourcePort&&(this._dock(n,v,t,i,!1),this._updateIntermediateSegments(n))},_adjustEndPoint:function(n,t,i,r,u){var h,c,l,f,a;if(n.sourcePadding||n.targetPadding||i&&i.connectorPadding||u&&u.connectorPadding){var e=0,o=r?this.bounds(r):null,s=t?this.bounds(t):null;t&&(f=n.segments[0],h=f.type!=="orthogonal"?f.type!=="bezier"?f._endPoint:f._point1:f.points[1],i&&(e=n.sourcePadding+i.connectorPadding),c=this._adjustPoint(f._startPoint,h,!0,e),this._setLineEndPoint(n,c,!1),f.type=="bezier"&&this._updateBezierPoints(f,r,u,o,t,i,s));r&&(f=n.segments[n.segments.length-1],l=f.type!=="orthogonal"?f.type!=="bezier"?f._startPoint:f._point2:f.points[f.points.length-2],u&&(e=n.targetPadding+u.connectorPadding),a=this._adjustPoint(l,f._endPoint,!1,e),this._setLineEndPoint(n,a,!0),f.type=="bezier"&&this._updateBezierPoints(f,r,u,o,t,i,s))}},_findEndPoint:function(n,t,i){var r;switch(n){case"top":r={x:t.x,y:t.y+Math.max(i.width,i.height)};break;case"bottom":r={x:t.x,y:t.y-Math.max(i.width,i.height)};break;case"left":r={y:t.y,x:t.x+Math.max(i.width,i.height)};break;case"right":r={y:t.y,x:t.x-Math.max(i.width,i.height)}}return r},_dock:function(n,i,r,u,f){var o,a,c,s,h,v,e,l,y;if(r)if(a=r,c=f?i._startPoint:i._endPoint,o=this.bounds(r),this._swapBounds(r,o),f)if(i.type=="orthogonal")if(e=n.segments[n.segments.length-2],e&&e.type=="orthogonal")if(i.points.length>2&&t.datavisualization.Diagram.Geometry.containsPoint(o,i.points[i.points.length-2])){if(l=!1,e.direction=="top"||e.direction=="bottom"){if(e._endPoint.x>=o.left&&e._endPoint.x<=o.right){this._removeLastSegment(n,i,e,r,u,f);return}e._length=e.length=Math.abs(e._startPoint.y-o.middleLeft.y);e.length==0?l=!0:(e.length<0&&(e._length=e.length*=-1,e._direction=e.direction=e.direction=="top"?"bottom":"top"),n.targetPoint=e._endPoint.x>o.right?o.middleRight:o.middleLeft)}else{if(e._endPoint.y>=o.top&&e._endPoint.y<=o.bottom){this._removeLastSegment(n,i,e,r,u,f);return}e._length=e.length=Math.abs(e._startPoint.x-o.topCenter.x);e.length==0?l=!0:(e.length<0&&(e._length=e.length*=-1,e._direction=e.direction=e.direction=="left"?"right":"left"),n.targetPoint=e._endPoint.y>o.bottom?o.bottomCenter:o.topCenter)}if(l){n.segments.splice(n.segments.length-2,1);this._dock(n,i,r,u,f);return}n.targetPoint=this._findIntersection(r,o,n,n.targetPoint,o.center,f)||n.targetPoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);i._direction=this._getOrthoDirection(i._startPoint,i._endPoint,e);this._setLineEndPoint(n,n.targetPoint,f)}else if(t.datavisualization.Diagram.Geometry.containsPoint(o,i._startPoint)){if(y=e.direction=="left"||e.direction=="right"?a.width/2:a.height/2,e._length=e.length-=y+30,e.length==0){n.segments.splice(n.segments.length-2,1);this._dock(n,i,r,u,f);return}n.targetPoint=e.direction=="left"||e.direction=="right"?e.direction=="right"?o.middleLeft:o.middleRight:e.direction=="bottom"?o.topCenter:o.bottomCenter;n.targetPoint=this._findIntersection(r,o,n,n.targetPoint,o.center,f)||n.targetPoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);i._direction=this._getOrthoDirection(i._startPoint,i._endPoint,e);this._setLineEndPoint(n,n.targetPoint,f)}else this._dockNodeToPoint(n,c,r,f);else this._dockNodeToPoint(n,c,r,f);else this._dockNodeToPoint(n,c,r,f);else if(i.type=="orthogonal"&&n.segments[1]&&n.segments[1].type=="orthogonal")if(n.segments[0]._isInternal&&t.datavisualization.Diagram.Geometry.containsPoint(o,i._endPoint))this._insertSegmentAtSourceEnd(n,i,o,r,f);else if(t.datavisualization.Diagram.Geometry.containsPoint(o,i._endPoint))this._removeFirstSegment(n,i,o,r,f);else{switch(i.direction){case"left":h="left";s=o.middleLeft;break;case"right":h="right";s=o.middleRight;break;case"top":h="top";s=o.topCenter;break;case"bottom":h="bottom";s=o.bottomCenter}i.points=[];v=this._findEndPoint(h,s,r)||o.center;s=this._findIntersection(r,o,n,s,v,f)||s;i.points.push(s);i.points.push(i._endPoint);this._setLineEndPoint(n,s,f)}else this._dockNodeToPoint(n,i._endPoint,r,f)},_removeLastSegment:function(n,t,i,r,u,f){n.segments.splice(n.segments.length-1,1);i.length=i._length=null;i.direction=null;i._direction=t._direction;this._dock(n,i,r,u,f)},_insertSegmentAtSourceEnd:function(n,t,i,r,u){var f=n.segments[1],e=n.segments[2],s,o;n.segments[0].direction=="left"||n.segments[0].direction=="right"?(s="horizontal",n.sourcePoint=f.direction=="top"?i.topCenter:i.bottomCenter,f&&(f.length||f.length===0)&&(f._length=f.length=Math.max(Math.abs(n.sourcePoint.y-f._endPoint.y),25)),e&&(e.length||e.length===0)&&(e.length=e._length=Math.abs(i.topCenter.x-e._endPoint.x))):(s="vertical",n.sourcePoint=f.direction=="left"?i.middleLeft:i.middleRight,f&&(f.length||f.length===0)&&(f._length=f.length=Math.max(Math.abs(n.sourcePoint.x-f._endPoint.x),25)),e&&(e.length||e.length===0)&&(e.length=e._length=Math.abs(i.middleRight.y-e._endPoint.y)));n.segments[3]&&(n.segments[3].length||n.segments[3].length==0)&&(o=f.direction=="bottom"||f.direction=="right"?f.length:-f.length,n.segments[3].length=n.segments[3]._length=s=="vertical"?Math.abs(n.sourcePoint.x+o-n.segments[3]._endPoint.x):Math.abs(n.sourcePoint.y+o-n.segments[3]._endPoint.y),n.segments[3].length<0&&(o=f.direction=="bottom"||f.direction=="right"?f.length:-f.length,n.segments[3].length=n.segments[3]._length=s=="vertical"?Math.abs(n.sourcePoint.x+o-n.segments[3]._endPoint.x):Math.abs(n.sourcePoint.y+o-n.segments[3]._endPoint.y)));n.segments.splice(0,1);n.sourcePoint=this._findIntersection(r,i,n,n.sourcePoint,i.center,u)||n.sourcePoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);this._setLineEndPoint(n,n.sourcePoint,u)},_removeFirstSegment:function(n,i,r,u,f){var h,c,e=n.segments[1].direction||this._getBezierDirection(n.segments[1].points[0],n.segments[1].points[1]),o,l,s,a;e=="left"||e=="right"?(o=i._endPoint.y-r.middleRight.y,n.segments[0].direction=n.segments[0]._direction=o>=0?"bottom":"top",n.segments[0].length=n.segments[0]._length=Math.abs(o),l=e=="right"?n.segments[1]._endPoint.x-r.right:r.left-n.segments[1]._endPoint.x,n.sourcePoint=e=="left"?r.middleLeft:r.middleRight,h=Math.abs(n.sourcePoint.x-n.segments[0]._startPoint.x),c=Math.abs(n.sourcePoint.y-n.segments[0]._endPoint.y)):((n.segments[0].length||n.segments[0].length==0)&&(o=i._endPoint.x-r.bottomCenter.x,n.segments[0].direction=n.segments[0]._direction=o>=0?"right":"left",n.segments[0].length=n.segments[0]._length=Math.abs(o)),l=e=="bottom"?n.segments[1]._endPoint.y-r.bottom:r.top-n.segments[1]._endPoint.y,n.sourcePoint=e=="top"?r.topCenter:r.bottomCenter,h=Math.abs(n.sourcePoint.y-n.segments[0]._startPoint.y),c=Math.abs(n.sourcePoint.x-n.segments[0]._endPoint.x));n.segments[1]&&(n.segments[1].length||n.segments[1].length===0)&&(n.segments[1]._length=n.segments[1].length=l-25,n.segments[1]._length<0&&(n.segments.splice(0,2),(n.segments[0].length||n.segments[0].length===0)&&(n.segments[0].length=n.segments[0]._length=h),s=t.datavisualization.Diagram.Segment({type:"orthogonal",length:c,direction:e})));s||(s=t.datavisualization.Diagram.Segment({type:"orthogonal",length:25,direction:e}));a=[s];s._isInternal=!0;n.segments=a.concat(n.segments);n.sourcePoint=this._findIntersection(u,r,n,n.sourcePoint,r.center,f)||n.sourcePoint;this._updateConnectorSegments(n,n.sourcePort,n.targetPort);this._setLineEndPoint(n,n.sourcePoint,f)},_dockNodeToPoint:function(n,t,i,r){var l,u,a,f,o,e,s,v,y,k,h;if(l=r?n.segments[n.segments.length-1]:n.segments[0],l.type!="orthogonal")u=this.bounds(i),this._swapBounds(i,u),this._setLineEndPoint(n,u.center,r),this._dockBounds(n,i,u,r);else{if(u=this.bounds(i),this._swapBounds(i,u),s=t,n.segments.length>1){var c=n.segments[n.segments.length-2],d=Math.abs(s.x-u.left),p=Math.abs(s.x-u.right),w=Math.abs(s.y-u.top),b=Math.abs(s.y-u.bottom);c&&r&&(v=c.direction=="left"||c.direction=="right",y=c.direction=="top"||c.direction=="bottom");l=r?n.segments[n.segments.length-1]:n.segments[0];l.points.length!=2&&c||l.type!="orthogonal"||(v=y=!1);u.bottom<s.y&&!v?(o="bottom",e="top",f=u.bottomCenter):u.y>s.y&&!v?(o="top",e="bottom",f=u.topCenter):u.right<s.x&&!y?(o="right",e="left",f=u.middleRight):u.x>s.x&&!y?(o="left",e="right",f=u.middleLeft):(h=d,f=u.middleLeft,o="left",e="right",h>=p&&p!=0&&(f=u.middleRight,o="right",e="left",h=p),h>w&&w!=0&&(f=u.topCenter,o="top",e="bottom",h=w),h>b&&b!=0&&(f=u.bottomCenter,o="bottom",e="top",h=b))}else{f=u.center;o=this._getBezierDirection(t,f);switch(o){case"left":e="right";break;case"right":e="left";break;case"top":e="bottom";break;case"bottom":e="top"}}f&&(r||n.segments.length==1?(a=n.segments[n.segments.length-1],a.type=="orthogonal"&&(a._direction=r?o:e)):a=n.segments[0],k=this._findEndPoint(o,f,i)||u.center,f=this._findIntersection(i,u,n,f,k,r)||f,r?n.targetPoint=f:n.sourcePoint=f,n.segments.length!=1&&this._addOrthogonalPoints(a,r?n.segments[n.segments.length-2]:null,r?null:n.segments[1],n.sourcePoint,n.targetPoint),this._setLineEndPoint(n,f,r))}},_getDockSegment:function(n,i,r,u,f,e){var o=this._getEdges(r,u),e="",s,h,c=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint);return(h=f?t.datavisualization.Diagram.LineSegment(i.points[i.points.length-2],i.points[i.points.length-1]):c>5?t.datavisualization.Diagram.LineSegment(i._startPoint,i._endPoint):t.datavisualization.Diagram.LineSegment(i._startPoint,n.segments[1]?n.segments[1]._endPoint:n.targetPoint),t.datavisualization.Diagram.Geometry.intersectSegment(h,o.left)?(s=o.left,e="left"):t.datavisualization.Diagram.Geometry.intersectSegment(h,o.top)?(s=o.top,e="top"):t.datavisualization.Diagram.Geometry.intersectSegment(h,o.right)?(s=o.right,e="right"):t.datavisualization.Diagram.Geometry.intersectSegment(h,o.bottom)&&(s=o.bottom,e="bottom"),e=this._swapDirection(r,e),s)?{dockPoint:t.datavisualization.Diagram.Geometry.midPoint(s),direction:e}:null},_dockBounds:function(n,t,i,r){var u,f,e,o;u=r?n.segments[n.segments.length-1]:n.segments[0];f=u._startPoint;e=u._endPoint||u.point;u.type=="bezier"&&(u.point1||u.point2)&&(r?f=u._point2:e=u._point1);o=this._findIntersection(t,i,n,f,e,r);o&&(this._setLineEndPoint(n,o,r),u.type==="bezier"&&this._updateBezierPoints(u))},_findIntersection:function(n,i,r,u,f,e){var o,v,l=e?r.segments[r.segments.length-1]:r.segments[0],s=n.connectorPadding,y,w,b,c,h,k,d,a,g,p,nt;if(s+=e?r.targetPadding:r.sourcePadding,l.type=="orthogonal"&&(u={x:u.x,y:u.y},u.x==f.x&&(u.y<f.y?u.y-=s+5:u.y+=s+5),u.y==f.y&&(u.x<f.x?u.x-=s+5:u.x+=s+5)),w=e||l.type=="orthogonal"?u:f,l.type!="orthogonal"&&(e?(y=t.datavisualization.Diagram.Geometry.findAngle(u,f),f=t.datavisualization.Diagram.Geometry.transform({x:f.x,y:f.y},y,Math.max(n.width/2,n.height/2))):(y=t.datavisualization.Diagram.Geometry.findAngle(f,u),u=t.datavisualization.Diagram.Geometry.transform({x:u.x,y:u.y},y,Math.max(n.width/2,n.height/2)))),n._shape==="ellipse")return p=t.datavisualization.Diagram.LineSegment(u,f),this._getEllipseIntersectCoords(n,p,r,w,e);if(n._shape!=="polygon"||n.type=="bpmn"&&l.type=="orthogonal")n._shape!=="path"||n.type=="bpmn"&&l.type=="orthogonal"?((n.connectorPadding||r.sourcePadding||r.targetPadding)&&(g=t.datavisualization.Diagram.Rectangle(i.x-s,i.y-s,n.width+2*s,n.height+2*s),i=this.bounds(g)),o=i.points,o[o.length]=o[0],v=i.points.length):(n._segmentPoints||(a=this._findSegmentPoints(n,r,e)),o=a||n._segmentPoints,n.pathData.split("m").length-1+(n.pathData.split("M").length-1)==1&&(o[o.length]=o[0]),v=o.length);else{for(o=[],o=n._segmentPoints?n._segmentPoints:this._findSegmentPoints(n,r,e),n.rotateAngle&&(b=t.Matrix.identity(),t.Matrix.rotate(b,n.rotateAngle,n.offsetX,n.offsetY)),v=o.length,a=[],c=0;c<v;c++)h=t.datavisualization.Diagram.Point(o[c].x+(n.offsetX-n.width*n.pivot.x),o[c].y+(n.offsetY-n.height*n.pivot.y)),n.rotateAngle!=0&&(h=t.Matrix.transform(b,h)),(n.connectorPadding||r.sourcePadding||r.targetPadding)&&(k=n.offsetX==h.x?0:n.offsetX<h.x?1:-1,d=n.offsetY==h.y?0:n.offsetY<h.y?1:-1,h=s?t.datavisualization.Diagram.Geometry.translate(h,k*s,d*s):h),a[c]=h;o=a}return p=t.datavisualization.Diagram.LineSegment(u,f),nt=this._getIntersectionPoints(p,o,!0,w),nt},_getIntersectionPoints:function(n,i,r,u){var e,l=i.length,h=t.datavisualization.Diagram.LineSegment(i[0],i[1]),o=t.datavisualization.Diagram.Geometry.intersectSegment(n,h),f,s,c;if(o){if(!r)return o;f=t.datavisualization.Diagram.Geometry.distance(o,u)}if(isNaN(f)||f>0)for(e=1;e<l-1;e++)if(h=t.datavisualization.Diagram.LineSegment(i[e],i[e+1]),s=t.datavisualization.Diagram.Geometry.intersectSegment(n,h),s){if(!r)return s;if(c=t.datavisualization.Diagram.Geometry.distance(s,u),(isNaN(f)||f>c)&&(f=c,o=s),f>=0&&f<=1)break}return o},_findSegmentPoints:function(n,i,r){var e=[],o,f,y,u,l,a,p,v,h,c,w,s;if(n._shape=="path"){for(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("xlink","http://www.w3.org/1999/xlink"),document.body.appendChild(o),f=document.createElementNS("http://www.w3.org/2000/svg","path"),f.setAttributeNS(null,"d",n._absolutePath||n.pathData),o.appendChild(f),y=!n._absoluteBounds||n._scaled||n._absolutePath?f.getBBox():n._absoluteBounds,u=n.connectorPadding,i&&(u+=r?i.targetPadding:i.sourcePadding),u||!n._absolutePath||n._scaled?(l=t.datavisualization.Diagram.Geometry.updatePath(-u,-u,n.width+2*u,n.height+2*u,n._absolutePath||n.pathData,null,y,u?null:n),f.setAttributeNS(null,"d",l),(!n._scaled||u)&&n._absolutePath||(n._absolutePath=l,n._scaled=!1)):f.setAttributeNS(null,"d",n._absolutePath),a=t.Matrix.identity(),t.Matrix.rotate(a,n.rotateAngle,n.offsetX,n.offsetY),p=f.getTotalLength(),h=0;h<=p;h+=10)v=f.getPointAtLength(h),c={x:n.offsetX-n.width*n.pivot.x+v.x,y:n.offsetY-n.height*n.pivot.y+v.y},n.rotateAngle!=0&&(c=t.Matrix.transform(a,c)),e.push(c);document.body.removeChild(o)}else if(n._shape=="polygon"){for(w=n.points.length,s=0;s<w;s++)e[s]=n.points[s];t.datavisualization.Diagram.Geometry.updatePolygonPoints(n,e);e[e.length]=e[0]}else return null;return e},_getEdges:function(n,i){var u=i.points,r={},e=n%360,f;return r.left=t.datavisualization.Diagram.LineSegment(u[3],u[0]),r.top=t.datavisualization.Diagram.LineSegment(u[0],u[1]),r.right=t.datavisualization.Diagram.LineSegment(u[1],u[2]),r.bottom=t.datavisualization.Diagram.LineSegment(u[2],u[3]),e<0&&(e+=360),e>315||e<45||(e<135?(f=r.top,r.top=r.left,r.left=r.bottom,r.bottom=r.right,r.right=f):e<225?(f=r.top,r.top=r.bottom,r.bottom=f,f=r.left,r.left=r.right,r.right=f):(f=r.bottom,r.bottom=r.left,r.left=r.top,r.top=r.right,r.right=f)),r},_pointsFromNodeToPoint:function(n,t,i,r,u,f,e,o){var h=o?n._tarDecoratorSize:n._srcDecoratorSize,s=[],a,c,l;s.push(f);a=f.y==e.y&&(i=="left"&&e.x<f.x||i=="right"&&e.x>f.x)||f.x==e.x&&(i=="top"&&e.y<f.y||i=="bottom"&&e.y>f.y);a||(i=="top"||i=="bottom"?i=="top"&&e.y<f.y&&e.y>f.y-h||i=="bottom"&&e.y>f.y&&e.y<f.y+h?(c=i=="top"?r.top-h:r.bottom+h,s.push({x:f.x,y:c}),s.push({x:f.x+(e.x-f.x)/2,y:c}),s.push({x:f.x+(e.x-f.x)/2,y:e.y})):Math.abs(f.x-e.x)>h&&(i=="top"&&e.y<f.y||i=="bottom"&&e.y>f.y)?s.push({x:f.x,y:e.y}):Math.abs(f.x-e.x)<=h||(e.x<r.left||e.x>r.right)&&e.y!=f.y?(c=i=="top"?r.top-h:r.bottom+h,s.push({x:f.x,y:c}),s.push({x:e.x,y:c})):(c=i=="top"?r.top-h:r.bottom+h,l=e.x<f.x?r.left-h:r.right+h,s.push({x:f.x,y:c}),s.push({x:l,y:c}),s.push({x:l,y:e.y})):i=="left"&&e.x<f.x&&e.x>f.x-h||i=="right"&&e.x>f.x&&e.x<f.x+h?(l=i=="left"?r.left-h:r.right+h,s.push({x:l,y:f.y}),s.push({x:l,y:f.y+(e.y-f.y)/2}),s.push({x:e.x,y:f.y+(e.y-f.y)/2})):Math.abs(f.y-e.y)>h&&(i=="left"&&e.x<f.x||i=="right"&&e.x>f.x)?s.push({x:e.x,y:f.y}):Math.abs(f.y-e.y)<=h||(e.y<r.top||e.y>r.bottom)&&e.x!=f.x?(l=i=="left"?r.left-h:r.right+h,s.push({x:l,y:f.y}),s.push({x:l,y:e.y})):(c=e.y<f.y?r.top-h:r.bottom+h,l=i=="left"?r.left-h:r.right+h,s.push({x:l,y:f.y}),s.push({x:l,y:c}),s.push({x:e.x,y:c})));s.push(e);o&&s.reverse();t._startPoint=s[0];t._endPoint=s[s.length-1];t.points=s;t.direction&&(t.direction=="left"||t.direction=="right"?(t.length=t._length=Math.abs(t._startPoint.x-t._endPoint.x),t._direction=t._startPoint.x<t._endPoint.x?t.direction="right":t.direction="left"):(t.length=t._length=Math.abs(t._startPoint.y-t._endPoint.y),t._direction=t._startPoint.y<t._endPoint.y?t.direction="bottom":t.direction="top"))},_constructSegements:function(n,t,i,r,u,f,e,o){var s,l,h,c;for(o==="right"&&(u==="left"?s=this._rightToLeft(n,t,i,r,f,e,!1):u==="right"?s=this._rightToRight(n,i,r,f,e):u==="top"?s=this._rightToTop(n,i,r,f,e,!1):u==="bottom"&&(s=this._rightToBottom(n,i,r,f,e,!1))),o==="left"&&(u==="right"&&(s=this._rightToLeft(n,t,f,e,i,r,!0),l=!0),u==="left"&&(s=this._leftToLeft(n,i,r,f,e)),u==="top"&&(s=this._leftToTop(n,i,r,f,e,!1)),u==="bottom"&&(s=this._leftToBottom(n,i,r,f,e,!1))),o==="top"&&(u==="left"&&(s=this._leftToTop(n,f,e,i,r,!0),l=!0),u==="right"&&(s=this._rightToTop(n,f,e,i,r,!0),l=!0),u==="top"&&(s=this._topToTop(n,i,r,f,e)),u==="bottom"&&(s=this._topToBottom(n,t,i,r,f,e,!1))),o==="bottom"&&(u==="left"&&(s=this._leftToBottom(n,f,e,i,r,!0),l=!0),u==="right"&&(s=this._rightToBottom(n,f,e,i,r,!0),l=!0),u==="top"&&(s=this._topToBottom(n,t,f,e,i,r,!0),l=!0),u==="bottom"&&(s=this._bottomToBottom(n,i,r,f,e))),l&&s.reverse(),h=s[s.length-1],c=s[s.length-2];s.length>2&&h.x==c.x&&h.y==c.y;)s.splice(s.length-1,1),h=s[s.length-1],c=s[s.length-2];for(h=s[0],c=s[1];s.length>2&&h.x==c.x&&h.y==c.y;)s.splice(0,1),h=s[0],c=s[1];t._startPoint=s[0];t._endPoint=s[s.length-1];t.points=s},_updateIntermediateSegments:function(n){var u=n.segments[0]._endPoint,r=n.segments[0],f=r.points.length,i;n.segments[1]&&(i=n.segments[1],i._startPoint=u,i.type=="orthogonal"&&(i.length||i.length===0)?(i.direction=="left"||i.direction=="right"?(n.segments[2]&&(n.segments[2].length||n.segments[2].length===0)&&(n.segments[2].direction=="top"?n.segments[2].length+=i._startPoint.y-i._endPoint.y:n.segments[2].length-=i._startPoint.y-i._endPoint.y,n.segments[2].length<0&&(n.segments[2].length*=-1,n.segments[2].direction=n.segments[2]._direction=n.segments[2]._direction=="bottom"?"top":"bottom"),n.segments[2]._length=n.segments[2].length),i._endPoint.y=i._startPoint.y):(n.segments[2]&&(n.segments[2].length||n.segments[2].length===0)&&(n.segments[2].direction=="left"?n.segments[2].length+=i._startPoint.x-i._endPoint.x:n.segments[2].length-=i._startPoint.x-i._endPoint.x,n.segments[2].length<0&&(n.segments[2].length*=-1,n.segments[2].direction=n.segments[2]._direction=n.segments[2]._direction=="right"?"left":"right"),n.segments[2]._length=n.segments[2].length),i._endPoint.x=i._startPoint.x),n.sourcePort&&r.points.length>2&&(i.direction=="left"||i.direction=="right"?r.points[r.points.length-1].y==r.points[r.points.length-2].y&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1],i.points.length==2&&(i._endPoint.y=i._startPoint.y)):r.points[r.points.length-1].x==r.points[r.points.length-2].x&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1],i.points.length==2&&(i._endPoint.x=i._startPoint.x))),(i.length||i.length===0)&&(i.length=i._length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i.points[1])),i.length>0&&(i.direction=i._direction=this._getBezierDirection(i._startPoint,i._endPoint)||i._direction),this._addOrthogonalPoints(i,r,n.segments[2],n.sourcePoint,n.targetPoint),n.segments[2]&&this._addOrthogonalPoints(n.segments[2],n.segments[1],n.segments[3],n.sourcePoint,n.targetPoint)):i.type=="orthogonal"&&i.length===null?(n.sourcePort&&r.points.length>2&&(i._direction=="left"||i._direction=="right"?r.points[r.points.length-1].y==r.points[r.points.length-2].y&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1]):r.points[r.points.length-1].x==r.points[r.points.length-2].x&&(i._startPoint=i.points[0]=r.points[r.points.length-2],r.points.splice(r.points.length-1,1),r._endPoint=r.points[r.points.length-1])),i._startPoint=i.points[0]=n.segments[0]._endPoint,this._addOrthogonalPoints(n.segments[1],n.segments[0],null,n.sourcePoint,n.targetPoint)):(i._startPoint=i.points[0]=n.segments[0]._endPoint,i.type=="bezier"&&this._updateBezierPoints(i)))},_updatePreviousSegment:function(n){var i=n.segments[n.segments.length-2],r=n.segments[n.segments.length-1],u,f,e;i&&(i.type=="orthogonal"&&r.points.length>2&&(u=!1,f=i.points.length==2?i.direction:t.datavisualization.Diagram.Util._getBezierDirection(i.points[i.points.length-2],i.points[i.points.length-1]),f=="left"||f=="right"?r.points[0].y==r.points[1].y&&(u=!0,e=r.points[1].x-r.points[0].x,r.points.splice(0,1),r._startPoint=r.points[0],i._endPoint=r.points[0]):r.points[0].x==r.points[1].x&&(u=!0,r.points.splice(0,1),r._startPoint=r.points[0],i._endPoint=r.points[0])),i._endPoint=r._startPoint,i.points[i.points.length-1]=r._startPoint,i.type=="orthogonal"&&u?(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i._length>0&&(i._direction=i.direction=this._getBezierDirection(i._startPoint,i._endPoint)),(n.segments.length>2||!n.sourcePort)&&this._addOrthogonalPoints(i,n.segments[n.segments.length-3],r,n.sourcePoint,n.targetPoint)):i.point=r._startPoint)},_initConnectionEnds:function(n,i){var u,r,e,o,f;if(n.segments&&n.segments[0]&&n.segments[0].type=="orthogonal"&&n.segments[0].length){if(n.sourceNode&&(e=i.nameTable[n.sourceNode],e))if(r=t.datavisualization.Diagram.Util.bounds(e,!0),n.sourcePort)u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.sourceNode],n.sourcePort),n.sourcePoint=t.datavisualization.Diagram.Util._getPortPosition(u,r);else{f=n.segments[0];switch(f.direction){case"left":n.sourcePoint=r.middleLeft;break;case"right":n.sourcePoint=r.middleRight;break;case"top":n.sourcePoint=r.topCenter;break;case"bottom":n.sourcePoint=r.bottomCenter}}if(n.targetNode&&(o=i.nameTable[n.targetNode],o))if(r=t.datavisualization.Diagram.Util.bounds(o,!0),n.targetPort)u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.targetNode],n.targetPort),n.targetPoint=t.datavisualization.Diagram.Util._getPortPosition(u,r);else{f=n.segments[0];switch(f.direction){case"left":n.targetPoint=r.middleLeft;break;case"right":n.targetPoint=r.middleRight;break;case"top":n.targetPoint=r.topCenter;break;case"bottom":n.targetPoint=r.bottomCenter}}}else n.sourceNode&&(r=t.datavisualization.Diagram.Util.bounds(i.nameTable[n.sourceNode],!0),n.sourcePort?(u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.sourceNode],n.sourcePort),n.sourcePoint=t.datavisualization.Diagram.Util._getPortPosition(u,r)):n.sourcePoint=r.center),n.targetNode&&(r=t.datavisualization.Diagram.Util.bounds(i.nameTable[n.targetNode],!0),n.targetPort?(u=t.datavisualization.Diagram.Util.findPortByName(i.nameTable[n.targetNode],n.targetPort),n.targetPoint=t.datavisualization.Diagram.Util._getPortPosition(u,r)):n.targetPoint=r.center)},_swapDirection:function(n,t){var u,i=n%360,r;return i<0&&(i+=360),i>315||i<45?u=t:i<135?(r={left:"top",top:"right",right:"bottom",bottom:"left"},u=r[t]):i<225?(r={left:"right",top:"bottom",right:"left",bottom:"top"},u=r[t]):(r={left:"bottom",top:"left",right:"top",bottom:"right"},u=r[t]),u},_getEllipseIntersectCoords:function(n,i,r,u,f){var a=[],o=n.connectorPadding,w,s,c,e,h,l;r&&(o+=f?r.targetPadding:r.sourcePadding);o||(o=0);var v=n.width/2,y=n.height/2,p=t.Matrix.identity();for(t.Matrix.rotate(p,n.rotateAngle,n.offsetX,n.offsetY),w="M "+(n.offsetX-n.width*n.pivot.x-o)+", "+n.offsetY+" A "+v+" "+y+" 0 0 1 "+(n.offsetX+n.width*(1-n.pivot.x)+o)+", "+n.offsetY+" A "+v+" "+y+" 0 0 1 "+(n.offsetX-n.width*n.pivot.x-o)+", "+n.offsetY+"z",s=document.createElementNS("http://www.w3.org/2000/svg","path"),s.setAttributeNS(null,"d",w),c=s.getTotalLength(),e=[],h=0;h<c;h=h+3)l=s.getPointAtLength(h),n.rotateAngle!=0&&(l=t.Matrix.transform(p,l)),e[e.length]=l;return e[e.length-1]!=s.getPointAtLength(c)&&(e[e.length]=s.getPointAtLength(c)),a=e,this._getIntersectionPoints(i,a,!0,u)},_rightToLeft:function(n,i,r,u,f,e,o){var c=[],h,s,a,l,v;return c.push(e),a=n._srcDecoratorSize,l=n._tarDecoratorSize,o&&(l=n._srcDecoratorSize,a=n._tarDecoratorSize),f.width==0&&(a=0),r.width==0&&(l=0),v=a+l,u.x>e.x?e.y!=u.y&&(e.x>r.left?(h=f.right+a,s=e.y,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y>f.top?u.y:r.bottom+l,c.push(t.datavisualization.Diagram.Point(h,s)),u.y<=f.top&&(h=r.right+l,c.push(t.datavisualization.Diagram.Point(h,s)),s=r.top-l,c.push(t.datavisualization.Diagram.Point(h,s)),h=r.left-l,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y,c.push(t.datavisualization.Diagram.Point(h,s)))):(h=i.direction||i.length==undefined?r.left-f.right>0?f.right+(r.left-f.right)/2:f.right+a:f.right+i.length,s=e.y,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y,c.push(t.datavisualization.Diagram.Point(h,s)))):(Math.abs(r.top-f.bottom)<v||Math.abs(r.bottom-f.top)<v?e.x>r.right?(h=e.x+a,s=e.y):(h=r.right+l,s=e.y):(h=f.right+a,s=e.y),c.push(t.datavisualization.Diagram.Point(h,s)),r.top-f.bottom>=v?(s=r.top-l,c.push(t.datavisualization.Diagram.Point(h,s))):e.y>u.y?(s=f.top-r.bottom<v?r.left>f.right?r.bottom+(f.top-r.bottom)/2:Math.min(r.top-l,f.top-a):r.bottom+l,c.push(t.datavisualization.Diagram.Point(h,s))):(s=r.left>f.right?r.bottom+(f.top-r.bottom)/2:Math.max(r.bottom+l,f.bottom+a),c.push(t.datavisualization.Diagram.Point(h,s))),h=r.left-l,c.push(t.datavisualization.Diagram.Point(h,s)),s=u.y,c.push(t.datavisualization.Diagram.Point(h,s))),c.push(u),c},_rightToRight:function(n,i,r,u,f){var s=[],e,o,c,h;return s.push(f),o=f.y,c=n._srcDecoratorSize,h=n._tarDecoratorSize,u.width==0&&(c=0),i.width==0&&(h=0),i.right>=u.left?f.y>=i.top-h&&f.y<=i.bottom+h?(e=f.x+c,s.push(t.datavisualization.Diagram.Point(e,o)),f.y>=i.center.y?(o=f.x>i.left?f.y>r.y?i.bottom+h:i.top-h:i.top-h,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o))):(o=i.bottom+h,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o)))):i.right<u.right?(e=u.right+c,s.push(t.datavisualization.Diagram.Point(e,o))):(e=r.x+h,s.push(t.datavisualization.Diagram.Point(e,o))):(e=f.x+c,s.push(t.datavisualization.Diagram.Point(e,o)),r.y>=u.top-c&&r.y<=u.bottom+c&&(r.y<=u.center.y?(o=u.top-c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o))):(o=u.bottom+c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.right+h,s.push(t.datavisualization.Diagram.Point(e,o))))),s.push(t.datavisualization.Diagram.Point(e,r.y)),s.push(r),s},_rightToTop:function(n,i,r,u,f,e){var h=[],c,o,s,l,a;return h.push(f),o=f.y,s=n._srcDecoratorSize,l=n._tarDecoratorSize,e&&(l=n._srcDecoratorSize,s=n._tarDecoratorSize),u.width==0&&(s=0),i.width==0&&(l=0),a=s+l,r.x>=f.x+s?f.y+s>=r.y&&i.height!==0&&(c=i.left<=u.right?i.right+l:i.left-u.right>a?u.right+s:u.right+(i.left-u.right)/2,h.push(t.datavisualization.Diagram.Point(c,o)),o=i.top-l,h.push(t.datavisualization.Diagram.Point(c,o))):u.bottom+s>i.top-l?(c=f.x+s<=i.right?i.right+l:u.right+s,h.push(t.datavisualization.Diagram.Point(c,o)),o=u.top>=i.top?i.height!==0?i.top-l:r.y:u.top>=i.top-l?i.top-l-s:u.top-s,h.push(t.datavisualization.Diagram.Point(c,o))):(c=f.x+s,h.push(t.datavisualization.Diagram.Point(c,o)),i.top-u.bottom<a&&i.height!==0?u.left-i.right>=a?(o=u.bottom+s,h.push(t.datavisualization.Diagram.Point(c,o)),c=u.left-s,h.push(t.datavisualization.Diagram.Point(c,o)),o=i.top-l,h.push(t.datavisualization.Diagram.Point(c,o))):(o=i.top-(i.top-u.bottom)/2,h.push(t.datavisualization.Diagram.Point(c,o))):(o=i.height!==0?i.top-l:r.y,h.push(t.datavisualization.Diagram.Point(c,o)))),h.push(t.datavisualization.Diagram.Point(r.x,o)),h.push(r),h},_rightToBottom:function(n,i,r,u,f,e){var h=[],s,o,c,l,a;return h.push(f),o=f.y,c=n._srcDecoratorSize,l=n._tarDecoratorSize,e&&(l=n._srcDecoratorSize,c=n._tarDecoratorSize),u.width==0&&(c=0),i.width==0&&(l=0),a=c+l,r.x>=f.x?f.y<=i.bottom+l?i.left>u.right+c?(s=f.x+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=i.bottom+l,h.push(t.datavisualization.Diagram.Point(s,o))):(s=i.right+l,h.push(t.datavisualization.Diagram.Point(s,o)),o=i.bottom+l,h.push(t.datavisualization.Diagram.Point(s,o))):u.right+c>r.x?(s=f.x+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=u.top-i.bottom>a?i.bottom+l:i.bottom+(u.top-i.bottom)/2,h.push(t.datavisualization.Diagram.Point(s,o))):o=f.y:f.y<=i.bottom?(s=u.right+c>i.right?u.right+c:i.right+l,h.push(t.datavisualization.Diagram.Point(s,o)),o=i.bottom+l,o<=u.bottom+c&&(o=u.bottom+c),h.push(t.datavisualization.Diagram.Point(s,o))):i.bottom+l<u.top-c?(s=u.right+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=u.top-i.bottom<a?i.bottom+(u.top-i.bottom)/2:i.bottom+l,h.push(t.datavisualization.Diagram.Point(s,o))):(s=u.right+c,h.push(t.datavisualization.Diagram.Point(s,o)),o=u.bottom+c,h.push(t.datavisualization.Diagram.Point(s,o))),h.push(t.datavisualization.Diagram.Point(r.x,o)),h.push(r),h},_leftToLeft:function(n,i,r,u,f){var s=[],e,o,c,h,l;return s.push(f),o=f.y,c=n._srcDecoratorSize,h=n._tarDecoratorSize,u.width==0&&(c=0),i.width==0&&(h=0),l=c+h,r.x-h>=f.x-c?(e=u.left-c,s.push(t.datavisualization.Diagram.Point(e,o)),f.y>r.y?r.y+h>=u.top?(o=u.top-c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.left-u.right>l?i.left-h:u.right+(i.left-u.right)/2,s.push(t.datavisualization.Diagram.Point(e,o))):(o=r.y,s.push(t.datavisualization.Diagram.Point(e,o)),e=r.x):u.bottom+c<r.y?(o=r.y,s.push(t.datavisualization.Diagram.Point(e,o)),e=r.x):(o=u.bottom+c,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.left-u.right>l?i.left-h:u.right+(i.left-u.right)/2,s.push(t.datavisualization.Diagram.Point(e,o)))):(r.y>f.y?f.y>i.top-h&&(e=u.left-i.right<l?i.right+(u.left-i.right)/2:u.left-c,s.push(t.datavisualization.Diagram.Point(e,o)),o=i.top-h,s.push(t.datavisualization.Diagram.Point(e,o))):i.bottom+h>=f.y&&(e=u.left-i.right<l?i.right+(u.left-i.right)/2:u.left-c,s.push(t.datavisualization.Diagram.Point(e,o)),o=i.bottom+h,s.push(t.datavisualization.Diagram.Point(e,o)),e=i.left-h,s.push(t.datavisualization.Diagram.Point(e,o))),e=i.left-h,s.push(t.datavisualization.Diagram.Point(e,o))),s.push(t.datavisualization.Diagram.Point(e,r.y)),s.push(r),s},_leftToTop:function(n,i,r,u,f,e){var h=[],l,c,o,s;return h.push(f),c=f.y,o=n._srcDecoratorSize,s=n._tarDecoratorSize,e&&(s=n._srcDecoratorSize,o=n._tarDecoratorSize),u.width==0&&(o=0),i.width==0&&(s=0),f.x<=r.x?(l=f.y>r.y&&i.left<=u.left?i.left-s:u.left-o,h.push(t.datavisualization.Diagram.Point(l,c)),c=u.bottom<=i.top?u.bottom+o<i.top-s?i.height!==0?i.top-s:r.y:r.x<u.right?u.bottom+(i.top-u.bottom)/2:u.top-o:u.top-o>=i.top-s?i.height!==0?i.top-s:r.y:u.top-o,h.push(t.datavisualization.Diagram.Point(l,c))):r.y<=f.y+o&&(l=u.left-o>i.right+s?u.left-o:i.right+s>=u.left-o?i.left-s:i.right+(u.left-i.right)/2,h.push(t.datavisualization.Diagram.Point(l,c)),c=i.top-s,h.push(t.datavisualization.Diagram.Point(l,c))),h.push(t.datavisualization.Diagram.Point(r.x,c)),h.push(r),h},_leftToBottom:function(n,i,r,u,f,e){var c=[],l,o,s,h,a;return c.push(f),o=f.y,s=n._srcDecoratorSize,h=n._tarDecoratorSize,e&&(h=n._srcDecoratorSize,s=n._tarDecoratorSize),u.width==0&&(s=0),i.width==0&&(h=0),a=s+h,f.x-s<=r.x?(l=i.left<=f.x&&f.y<=i.top?i.left-h:u.left-s,c.push(t.datavisualization.Diagram.Point(l,o)),i.bottom+h<u.top-s?(o=u.top-i.bottom<a?i.bottom+(u.top-i.bottom)/2:i.bottom+h,c.push(t.datavisualization.Diagram.Point(l,o))):(o=i.bottom<u.bottom?u.bottom+s:i.bottom+h,c.push(t.datavisualization.Diagram.Point(l,o)))):f.y-s>r.y||(l=i.right>=u.left?i.left-h:u.left-i.right<a?u.left-(u.left-i.right)/2:u.left-s,c.push(t.datavisualization.Diagram.Point(l,o)),o=i.bottom+h,c.push(t.datavisualization.Diagram.Point(l,o))),c.push(t.datavisualization.Diagram.Point(r.x,o)),c.push(r),c},_topToTop:function(n,i,r,u,f){var s=[],o,e,c,h,l;return s.push(f),o=f.x,c=n._srcDecoratorSize,h=n._tarDecoratorSize,u.width==0&&(c=0),i.width==0&&(h=0),l=c+h,r.x>=f.x?r.y-h>=f.y-c?(e=u.top-c,s.push(t.datavisualization.Diagram.Point(o,e)),r.x<=u.right&&(o=u.right+c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.height!==0?i.top-u.bottom>l?i.top-h:u.bottom+(i.top-u.bottom)/2:r.y,s.push(t.datavisualization.Diagram.Point(o,e)))):i.left<=f.x?(e=u.top-i.bottom>l?u.top-c:i.bottom+(u.top-i.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.left-h,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.top-h,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.height!==0?i.top-h:r.y,s.push(t.datavisualization.Diagram.Point(o,e))):r.y-h>=f.y-c?(e=u.top-c,s.push(t.datavisualization.Diagram.Point(o,e)),r.x>=u.left&&(o=u.left-c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.height!==0?i.top-u.bottom>l?i.top-h:u.bottom+(i.top-u.bottom)/2:r.y,s.push(t.datavisualization.Diagram.Point(o,e)))):i.right>=f.x?(e=u.top-i.bottom>l?u.top-c:i.bottom+(u.top-i.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.right+h,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.top-h,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.height!==0?i.top-h:r.y,s.push(t.datavisualization.Diagram.Point(o,e))),o=r.x,s.push(t.datavisualization.Diagram.Point(o,e)),s.push(r),s},_topToBottom:function(n,i,r,u,f,e,o){var h=[],c,s,l,a,v;return h.push(e),c=e.x,l=n._srcDecoratorSize,a=n._tarDecoratorSize,o&&(a=n._srcDecoratorSize,l=n._tarDecoratorSize),f.width==0&&(l=0),r.width==0&&(a=0),v=l+a,u.x>e.x?(f.top>=r.bottom?f.top-r.bottom>0?(s=i.length==undefined||i.direction?f.top-r.bottom>0?r.bottom+(f.top-r.bottom)/2:r.bottom+a:r.bottom+i.length,h.push(t.datavisualization.Diagram.Point(c,s))):(s=f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=r.left-f.right>=v?f.right+l:f.right+(r.left-f.right)/2,h.push(t.datavisualization.Diagram.Point(c,s)),s=r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))):(s=r.top<f.top?r.left>=f.right+l?f.top-l:r.top-a:f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=r.left>=f.right+l?f.right+l:r.right+a,h.push(t.datavisualization.Diagram.Point(c,s)),s=r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))),h.push(t.datavisualization.Diagram.Point(u.x,s))):u.x<e.x&&(f.top>=r.bottom?f.top-r.bottom>0?(s=i.length==undefined||i.direction?f.top-r.bottom>0?r.bottom+(f.top-r.bottom)/2:r.bottom+a:r.bottom+i.length,h.push(t.datavisualization.Diagram.Point(c,s))):(s=f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=f.left-r.right>=v?f.left-l:r.right+(f.left-r.right)/2,h.push(t.datavisualization.Diagram.Point(c,s)),s=r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))):(s=f.left-l>=r.right+a?f.top-l:f.top-l,h.push(t.datavisualization.Diagram.Point(c,s)),c=f.left>=r.right+a||f.right+l<r.right+a?r.right+a:f.right+l,h.push(t.datavisualization.Diagram.Point(c,s)),s=f.left>=r.right+a?r.bottom+a:r.bottom<=f.bottom?f.bottom+l:r.bottom+a,h.push(t.datavisualization.Diagram.Point(c,s))),h.push(t.datavisualization.Diagram.Point(u.x,s))),h.push(u),h},_bottomToBottom:function(n,i,r,u,f){var s=[],o,e,h,c,l;return s.push(f),o=f.x,h=n._srcDecoratorSize,c=n._tarDecoratorSize,u.width==0&&(h=0),i.width==0&&(c=0),l=h+c,r.x>=f.x?u.bottom+h>=i.bottom+h?(e=u.bottom+h,s.push(t.datavisualization.Diagram.Point(o,e)),r.x<u.right&&(o=u.right+h,s.push(t.datavisualization.Diagram.Point(o,e)),e=u.top-h>=i.bottom+c?u.top-i.bottom>=l?i.bottom+c:i.bottom+(u.top-i.bottom)/2:i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e)))):f.x>i.left?(e=i.bottom-u.bottom>=l?u.bottom+h:u.bottom+(i.bottom-u.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.left-c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))):u.bottom+h>=i.bottom+h?(e=u.bottom+h,s.push(t.datavisualization.Diagram.Point(o,e)),r.x>u.left&&(o=u.left-h,s.push(t.datavisualization.Diagram.Point(o,e)),e=u.top-h>=i.bottom+c?u.top-i.bottom>=l?i.bottom+c:i.bottom+(u.top-i.bottom)/2:i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e)))):f.x<i.right?(e=i.bottom-u.bottom>=l?u.bottom+h:u.bottom+(i.bottom-u.bottom)/2,s.push(t.datavisualization.Diagram.Point(o,e)),o=i.right+c,s.push(t.datavisualization.Diagram.Point(o,e)),e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))):(e=i.bottom+c,s.push(t.datavisualization.Diagram.Point(o,e))),s.push(t.datavisualization.Diagram.Point(r.x,e)),s.push(r),s},_addOrthogonalPoints:function(n,i,r,u,f,e){var v=[],o=i?i._endPoint:u,p,w,s,l,y;v.push(o);n._direction||(n._direction=this._getOrthoDirection(o,f,i));n._direction!=="auto"||i||r||(n._direction=this._getBezierDirection(o,f));var h=!e&&e!=0?this._directionToAngle(n._direction||this._getBezierDirection(o,f)):e,l=n._direction;if(l=="left"||l=="right"||l=="top"||l=="bottom")h={right:0,left:180,top:270,bottom:90,auto:90}[l];else switch(l){case"straight":h=0;break;case"clockWise90":h+=90;break;case"opposite":h+=180;break;case"antiClockWise90":h+=270}if((n.length||n.length==0)&&n.direction)s=t.datavisualization.Diagram.Geometry.transform(o,h||0,n._length),s.x=Math.round(s.x*100)/100,s.y=Math.round(s.y*100)/100,v.push(s),n._endPoint=s,r&&(r._startPoint=n._endPoint,r.points&&(r.points[0]=n._endPoint,r.type=="bezier"&&this._updateBezierPoints(r)));else{if(o.x!=f.x&&o.y!=f.y||i&&i._startPoint.x==f.x){var b=20,a=f.x-(s?s.x:o.x),c=f.y-(s?s.y:o.y);a=Math.abs(a)<=.0001?0:a;c=Math.abs(c)<=.0001?0:c;switch(h){case 0:if(f.x<o.x)break;w=Math.abs(o.x-f.x)<30;break;case 180:if(f.x>o.x)break;w=Math.abs(o.x-f.x)<30;break;case 90:if(f.y<o.y)break;w=Math.abs(o.y-f.y)<30;break;case 270:if(f.y>o.y)break;w=Math.abs(o.y-f.y)<30}i?p=i&&i._startPoint.x==f.x?3:a==0||c==0?2:3:(w?(b=h==90||h==270?Math.abs(o.y-f.y):Math.abs(o.x-f.x),p=2,b<10&&(b+=20,p=3)):p=3,(p!=2||Math.abs(c)>1&&Math.abs(a)>1)&&(s=t.datavisualization.Diagram.Geometry.transform(o,h,b)));p==3&&(l=n._direction=="auto"?i?i._direction=="left"||i.direction=="right"?"left":"top":"bottom":n._direction,l=="left"||l=="right"||c==0?(c=c>0?c:-c,y=t.datavisualization.Diagram.Geometry.transform(s||o,90,f.y-(s?s.y:o.y))):(a=a>0?a:-a,y=t.datavisualization.Diagram.Geometry.transform(s||o,0,f.x-(s?s.x:o.x))));s&&(s.x=Math.round(s.x*100)/100,s.y=Math.round(s.y*100)/100,v.push(s));y&&(y.x=Math.round(y.x*100)/100,y.y=Math.round(y.y*100)/100,v.push(y))}n._direction=this._getBezierDirection(v[v.length-1],f);v.push(f);n._endPoint=f;r&&(r._startPoint=n._endPoint,r.points||(r.points=[]),r.points[0]=n._endPoint,r.type=="bezier"&&this._updateBezierPoints(r))}return n.points=v,h},_getOrthoDirection:function(n,t,i){if(i){var r=t;return Math.abs(r.x-n.x)>Math.abs(r.y-n.y)&&i&&(i._direction=="left"||i._direction=="right")?n.x<r.x?"right":"left":n.y<r.y?"bottom":"top"}return n.y<t.y?"bottom":n.y>t.y?"top":n.x<t.x?"right":n.x>t.x?"left":void 0},_directionToAngle:function(n){return{right:0,left:180,top:270,bottom:90,auto:90}[n]},_resetOrthogonalPoints:function(n){var t=[],i;t.push(n.sourcePoint);t.push(n.targetPoint);n.points=[];n.sourcePoint=t[0];n.points.push(t[0]);i=this._constructOrthogonalPoints(t[0],t[1]);n.points.push(i[0]);n.points.push(i[1]);n.targetPoint=t[1];n.points.push(t[1])},_updateBezierPoints:function(n,i,r,u,f,e,o){var c,v={right:0,left:180,top:270,bottom:90},s,h,l,a;(n.vector1||n.vector2)&&(n.vector1&&(n._point1=t.datavisualization.Diagram.Geometry.transform(n._startPoint,n.vector1.angle,n.vector1.distance)),n.vector2&&(n._point2=t.datavisualization.Diagram.Geometry.transform(n._endPoint,n.vector2.angle,n.vector2.distance)));(n.point1!=null||n.vector1)&&(n.point2!=null||n.vector2)||(s=n._endPoint,h=n._startPoint,e?(c=o,h=this._getPortPosition(e,c),f.rotateAngle!==0&&(a=t.Matrix.identity(),t.Matrix.rotate(a,f.rotateAngle,f.offsetX,f.offsetY),h=t.Matrix.transform(a,h)),l=this._getDirection(c,h,!0)):l=this._getBezierDirection(h,s),n.vector1||(n._point1=n.point1||this._getBezierAdjPoint(v[l],n._startPoint,n._endPoint)),r?(c=u,s=this._getPortPosition(r,c),i.rotateAngle!==0&&(a=t.Matrix.identity(),t.Matrix.rotate(a,i.rotateAngle,i.offsetX,i.offsetY),s=t.Matrix.transform(a,s)),l=this._getDirection(c,s,!0)):l=this._getBezierDirection(s,h),n.vector2||(n._point2=n.point2||this._getBezierAdjPoint(v[l],n._endPoint,n._startPoint)))},_getBezierDirection:function(n,t){return Math.abs(t.x-n.x)>Math.abs(t.y-n.y)?n.x<t.x?"right":"left":n.y<t.y?"bottom":"top"},_findDocAngle:function(n,t){var r={x:t.x,y:n.y},e=this.findLength(n,r),u=this.findLength(r,t),f=this.findLength(t,n),i=Math.asin(u/f);return i=i*180/Math.PI,n.x<t.x?n.y<t.y||(i=360-i):i=n.y<t.y?180-i:180+i,i},_getDirection:function(n,i,r){var e=n.center,h,f,o,c,s,u,a,l;return r?(a=n.points,l=r?45:180/(2+2/(n.height/n.width)),h=l,f=180-l,o=f+2*l,c=360-l,u=t.datavisualization.Diagram.Geometry.findAngle(i,e),s=u>h&&u<f?"top":u>f&&u<o?"right":u>o&&u<c?"bottom":"left"):(u=this._findDocAngle(e,i),h=this._findDocAngle(e,n.bottomRight),f=this._findDocAngle(e,n.bottomLeft),o=this._findDocAngle(e,n.topLeft),c=this._findDocAngle(e,n.topRight),u>o&&u<c?s="top":u>=h&&u<f?s="bottom":u>=f&&u<=o?s="left":(u>=c||u<h)&&(s="right")),s},_getBezierAdjPoint:function(n,i,r){var u=60,f=t.datavisualization.Diagram.Point(0,0),e=n>45&&n<135?"Bottom":n>135&&n<225?"Left":n>225&&n<315?"Top":"Right";switch(e){case"Right":u=Math.min(Math.abs(i.x-r.x)*.45,u);f=t.datavisualization.Diagram.Point(i.x+u,i.y);break;case"Bottom":u=Math.min(Math.abs(i.y-r.y)*.45,u);f=t.datavisualization.Diagram.Point(i.x,i.y+u);break;case"Left":u=Math.min(Math.abs(i.x-r.x)*.45,u);f=t.datavisualization.Diagram.Point(i.x-u,i.y);break;case"Top":u=Math.min(Math.abs(i.y-r.y)*.45,u);f=t.datavisualization.Diagram.Point(i.x,i.y-u)}return f},_setLineEndPoint:function(n,t,i){var o=n,u,r,e,f;t.x=Math.round(t.x*100)/100;t.y=Math.round(t.y*100)/100;i?(u=n.segments[n.segments.length-1],o.targetPoint=t,u.type!="orthogonal"&&(u.point&&(u.point=t),u._point=t),u.points[u.points.length-1]=t,u._endPoint=t):(o.sourcePoint=t,r=n.segments[0],r.points[0]=t,r._startPoint=t,r.type!="orthogonal"||n.sourcePort||n._staticLength||(r.length||r.length===0)&&r.direction&&r.points.length==2&&(r._direction=="left"||r._direction=="right"?(r._endPoint.y=r._startPoint.y,e=Math.abs(r._startPoint.x-r._endPoint.x)):(r._endPoint.x=r._startPoint.x,e=Math.abs(r._startPoint.y-r._endPoint.y)),n.segments[0]._length=e,n.segments[0].length=n.segments[0]._length,n.segments[0].direction=n.segments[0]._direction));f=i?n.segments[n.segments.length-1]:n.segments[0];f.type!=="orthogonal"||(i||n.sourcePort)&&(!i||n.targetPort)||n.sourceNode&&n.targetNode&&!(n.segments.length>1)?f.type==="bezier"&&this._updateBezierPoints(f):(f.points=[],this._addOrthogonalPoints(f,i?n.segments[n.segments.length-2]:null,i?null:n.segments[1],n.sourcePoint,n.targetPoint))},_setBezierPoint:function(n,i,r){r==="bezierpoint1"?n.vector1?(n.vector1={distance:t.datavisualization.Diagram.Geometry.distance(n._startPoint,i),angle:t.datavisualization.Diagram.Geometry.findAngle(n._startPoint,i)},n._point1=i):n.point1=n._point1=i:n.vector2?(n.vector2={distance:t.datavisualization.Diagram.Geometry.distance(n._endPoint,i),angle:t.datavisualization.Diagram.Geometry.findAngle(n._endPoint,i)},n._point2=i):n.point2=n._point2=i},_setPoints:function(n,t){n.sourcePoint=n.points[0]=t[0];n.targetPoint=n.points[n.points.length-1]=t[t.length-1];n.points=t;n.type==="bezier"&&(n.point1=t[2]||n.point1,n.point2=t[3]||n.point2,n.point1||(n._point1=n.point1),n.point2||(n._point2=n.point2),this._updateBezierPoints(n))},_updateConnectorSegments:function(n,i,r,u){for(var o,s=n.sourcePoint,f=0;f<n.segments.length;f++){var e=n.segments[f],h=n.segments[f-1],c=n.segments[f+1];e._startPoint=h?h._endPoint:s;f==0&&i||f==n.segments.length-1&&r||(e.type=="orthogonal"?o=t.datavisualization.Diagram.Util._addOrthogonalPoints(e,h,c,n.sourcePoint,n.targetPoint,o):(o=t.datavisualization.Diagram.Geometry.findAngle(s,e._endPoint),e.type=="bezier"&&this._updateBezierPoints(e)));s=e._endPoint}u&&u._dock(n,u.nameTable)},_translateLine:function(n,i,r){for(var u,f,e=0;e<n.segments.length;e++){for(u=n.segments[e],f=0;f<u.points.length;f++)f==0?(u._startPoint=u.points[f]=t.datavisualization.Diagram.Geometry.translate(u.points[f],i,r),e==0&&(n.sourcePoint=u._startPoint)):f==u.points.length-1?(u._endPoint=u.points[f]=t.datavisualization.Diagram.Geometry.translate(u.points[f],i,r),e==n.segments.length-1&&(n.targetPoint=u._endPoint)):u.points[f]=t.datavisualization.Diagram.Geometry.translate(u.points[f],i,r);u.type===t.datavisualization.Diagram.Segments.Bezier?(u._point1=t.datavisualization.Diagram.Geometry.translate(u._point1,i,r),u._point2=t.datavisualization.Diagram.Geometry.translate(u._point2,i,r),u.point1&&(u.point1=u._point1),u.point2&&(u.point2=u._point2),u.point&&(u.point=u._endPoint),u._point=u._endPoint):u.type=="straight"&&(u.point&&(u.point=u._endPoint),u._point=u._endPoint)}},_adjustPoint:function(n,i,r,u){var f=r?{x:n.x,y:n.y}:{x:i.x,y:i.y},e;return n.x==i.x?n.y<i.y&&r||n.y>i.y&&!r?f.y+=u:f.y-=u:n.y==i.y?n.x<i.x&&r||n.x>i.x&&!r?f.x+=u:f.x-=u:r?(e=t.datavisualization.Diagram.Geometry.findAngle(n,i),f=t.datavisualization.Diagram.Geometry.transform(n,e,u)):(e=t.datavisualization.Diagram.Geometry.findAngle(i,n),f=t.datavisualization.Diagram.Geometry.transform(i,e,u)),f},_getIconPosition:function(n,i,r){var o,s,f,e,u,h,c;if(n)return o=n.margin.left-n.margin.right,s=n.margin.top-n.margin.bottom,f=n.offset.x,e=n.offset.y,r?(u=t.datavisualization.Diagram.Point(i.width*f+o,i.height*e+s),(u.x>i.width||u.y>i.height)&&(u=t.datavisualization.Diagram.Point(i.width*f,i.height*e)),u):(h=i.center.x-i.width/2+i.width*f+o,c=i.center.y-i.height/2+i.height*e+s,t.datavisualization.Diagram.Point(h,c))},_rBounds:function(n,i){var r={},u,e,f;return(n?(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height,r.rotateAngle=i):r=t.datavisualization.Diagram.Rectangle(),r)?(u={},r.x=Math.round(r.x*100)/100,r.y=Math.round(r.y*100)/100,r.width=Math.round(r.width*100)/100,r.height=Math.round(r.height*100)/100,u.width=r.width,u.height=r.height,u.x=u.left=r.x,u.right=r.x+r.width,u.y=u.top=r.y,u.bottom=r.y+r.height,u.center={x:r.x+r.width/2,y:r.y+r.height/2},u.topLeft={x:r.x,y:r.y},u.topCenter={x:r.x+r.width/2,y:r.y},u.topRight={x:r.x+r.width,y:r.y},u.middleLeft={x:r.x,y:r.y+r.height/2},u.middleRight={x:r.x+r.width,y:r.y+r.height/2},u.bottomLeft={x:r.x,y:r.y+r.height},u.bottomCenter={x:r.x+r.width/2,y:r.y+r.height},u.bottomRight={x:r.x+r.width,y:r.y+r.height},r&&r.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,r.rotateAngle,r.x+r.width/2,r.y+r.height/2),u.topLeft=t.Matrix.transform(e,u.topLeft),u.topCenter=t.Matrix.transform(e,u.topCenter),u.topRight=t.Matrix.transform(e,u.topRight),u.middleLeft=t.Matrix.transform(e,u.middleLeft),u.middleRight=t.Matrix.transform(e,u.middleRight),u.bottomLeft=t.Matrix.transform(e,u.bottomLeft),u.bottomCenter=t.Matrix.transform(e,u.bottomCenter),u.bottomRight=t.Matrix.transform(e,u.bottomRight),f=t.datavisualization.Diagram.Geometry.rect([u.topLeft,u.topRight,u.bottomRight,u.bottomLeft]),u.x=u.left=f.x,u.y=u.top=f.y,u.right=f.x+f.width,u.bottom=f.y+f.height,u.center=t.datavisualization.Diagram.Point(f.x+f.width/2,f.y+f.height/2),u.width=-u.topLeft.x+u.right,u.height=-u.topRight.y+u.bottom),u.points=[u.topLeft,u.topRight,u.bottomRight,u.bottomLeft],u):r},_getLabelPosition:function(n,i,r,u,f,e){var c,h,o,s;return e&&(c=e.getBBox(),h=this._rBounds(c,n.rotateAngle)),o=i.width*(r?r.x:n.offset.x),s=i.height*(r?r.y:n.offset.y),n.horizontalAlignment=="left"?o+=n.margin.left:n.horizontalAlignment=="right"?o-=n.margin.right:o+=n.margin.left-n.margin.right+(f?-((h?h.width:i.width)/2):0),n.verticalAlignment=="top"?s+=n.margin.top:n.verticalAlignment=="bottom"?s-=n.margin.bottom:s+=n.margin.top-n.margin.bottom+(u?n.fontSize/2:0),t.datavisualization.Diagram.Point(o,s)},_getPortPosition:function(n,i,r){var u,f,e,o;if(n)return u=(n.margin.left?n.margin.left:0)+(n.margin.right?n.margin.right:0),f=(n.margin.top?n.margin.top:0)+(n.margin.bottom?n.margin.bottom:0),r?t.datavisualization.Diagram.Point(i.width*n.offset.x+u,i.height*n.offset.y+f):(e=i.center.x-i.width/2+i.width*n.offset.x+u,o=i.center.y-i.height/2+i.height*n.offset.y+f,t.datavisualization.Diagram.Point(e,o))},_translate:function(n,i,r,u,f,e){var h,o,s;if(n.segments)t.datavisualization.Diagram.Util._translateLine(n,i,r,n);else if(n.offsetX+=i,n.offsetY+=r,n._type==="group"&&!f){for(h=e._getChildren(n.children),s=0;s<h.length;s++)o=u[h[s]],this._translate(o,i,r,u,null,e),o.parent&&o.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(u[o.parent],e);n._type!="group"&&n.container&&t.datavisualization.Diagram.Util._updateGroupBounds(n,e)}},scale:function(n,i,r,u,f,e,o,s,h){var nt,b,v,c,w,a,d,g,l;if(n.container)switch(n.container.type){case"canvas":a={};l=t.Matrix.identity();t.Matrix.rotate(l,-n.rotateAngle,u.x,u.y);t.Matrix.scale(l,i,r,u.x,u.y);t.Matrix.rotate(l,n.rotateAngle,u.x,u.y);k=t.Matrix.transform(l,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY));y=n.width*i;p=n.height*r;o&&(n.minHeight=p,n.minWidth=y);s!=!0?a=h._getMinMaxSize(n,y,p):(a.width=y,a.height=p);a&&a.width>1&&(d=n.offsetX-n.width/2,n.width=a.width,n.offsetX=d+n.width/2);a&&a.height>1&&(g=n.offsetY-n.height/2,n.height=a.height,n.offsetY=g+n.height/2);break;case"stack":l=t.Matrix.identity();t.Matrix.rotate(l,-n.rotateAngle,u.x,u.y);t.Matrix.scale(l,i,r,u.x,u.y);t.Matrix.rotate(l,n.rotateAngle,u.x,u.y);k=t.Matrix.transform(l,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY));y=n.width*i-(n.marginLeft+n.marginRight);p=n.height*r-(n.marginTop+n.marginBottom);a=h._getMinMaxSize(n,y,p);a.width>1&&(d=n.offsetX-n.width/2,n.width=a.width-n.marginLeft,n.offsetX=d+n.width/2+n.marginLeft);a.height>1&&(g=n.offsetY-n.height/2,n.height=a.height-n.marginTop,n.offsetY=g+n.height/2+n.marginTop);t.datavisualization.Diagram.SvgContext._alignOnStack(n,h)}else if(l=t.Matrix.identity(),n.segments)for(t.Matrix.scale(l,i,r,u.x,u.y),v=0;v<n.segments.length;v++){for(c=n.segments[v],w=0;w<c.points.length;w++)c.points[w]=t.Matrix.transform(l,c.points[w]),v!=0||w!=0||n.sourceNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],t.datavisualization.Diagram.Util._setLineEndPoint(n,t.Matrix.transform(l,n.sourcePoint),!1)),v!=n.segments.length-1||w!=c.points.length-1||n.targetNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],n.targetPoint=c._endPoint);c._startPoint=c.points[0];c._endPoint=c.points[c.points.length-1];c.type=="orthogonal"?c.length||c.length===0?c.length=c._length=t.datavisualization.Diagram.Geometry.distance(c._startPoint,c._endPoint):t.datavisualization.Diagram.Util._addOrthogonalPoints(c,n.segments[v-1],n.segments[v+1],n.sourcePoint,n.targetPoint):(c.point&&(c.point=c._endPoint),c._point=c._endPoint)}else if(n._type==="group"){for(nt=h._getChildren(n.children),v=0;v<nt.length;v++)b=f[nt[v]],b&&(this.scale(b,i,r,u,f),b.parent&&b.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(f[b.parent],h));t.datavisualization.Diagram.Util._updateGroupBounds(n,h)}else{t.Matrix.rotate(l,-n.rotateAngle,u.x,u.y);t.Matrix.scale(l,i,r,u.x,u.y);t.Matrix.rotate(l,n.rotateAngle,u.x,u.y);var k=t.Matrix.transform(l,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),y=n.width*i,p=n.height*r;y>1&&(n.width=y,n.offsetX=k.x);p>1&&(n.height=p,n.offsetY=k.y)}},_getIntersectingElement:function(n,i){for(var u,f,r,h,o=t.datavisualization.Diagram.SpatialUtil.findQuads(n._spatialSearch,i),s=[],e=0;e<o.length;e++)if(u=o[e],u.objects.length>0)for(f=0;f<u.objects.length;f++)r=u.objects[f],r.visible&&(h=t.datavisualization.Diagram.Util.bounds(r),t.datavisualization.Diagram.Geometry.intersectsRect(i,h)&&(r=n._sortByZIndex(r,!0),s.push(r)));return s},_getIntersectingNodeElement:function(n,i){for(var u,f,r,h,o=t.datavisualization.Diagram.SpatialUtil.findQuads(n._spatialSearch,i),s=[],e=0;e<o.length;e++)if(u=o[e],u.objects.length>0)for(f=0;f<u.objects.length;f++)r=u.objects[f],r.visible&&(h=t.datavisualization.Diagram.Util.bounds(r),t.datavisualization.Diagram.Geometry.intersectsRect(i,h)&&(r=n._sortByZIndex(r,!0),r.segments||s.push(r)));return s},_updateChildBounds:function(n,i){var u,f,e,o,r,s,h;e=n.width;o=n.height;u=n.offsetX;f=n.offsetY;r=t.datavisualization.Diagram.Util._getChildrenBounds(n,i);n.offsetX=r.x+r.width/2;n.offsetY=r.y+r.height/2;n.height=r.height;n.width=r.width;s=e/n.width;h=o/n.height;this.scale(n,s,h,n.pivot,i.nameTable,null,null,null,i);this._translate(n,u-n.offsetX,f-n.offsetY,i.nameTable,null,i)},_updateGroupBounds:function(n,i,r,u){var h,c,o,a,v,e,s;if(n&&!n.container&&n&&(n.type==="pseudoGroup"||n.children&&n.children.length>0)){h=n.width;c=n.height;o=n.offsetX;a=n.offsetY;u&&this._updateRotateAngle(n,i.nameTable);var f=this._getChildrenBounds(n,i,r),y=f.x+f.width*n.pivot.x,p=f.y+f.height*n.pivot.y,l={x:y,y:p};if(n.rotateAngle&&(!i._isNodeInitializing||i._isGroupNode)&&(v=t.Matrix.identity(),t.Matrix.rotate(v,n.rotateAngle),l=t.Matrix.transform(v,l)),f&&(n.offsetX=l.x,n.offsetY=l.y,n.width=f.width,n.height=f.height),r){if(e=null,n.children&&n.children.length>0)for(s=0;s<n.children.length;s++)i._getChild(n.children[s])&&(e=i.nameTable[i._getChild(n.children[s])]),e&&(e._type==="group"||e.children&&e.children.length>0)&&this._updateGroupBounds(e,i,r);h&&h!=n.width&&i.scale(n,h/n.width,1,new t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),i.nameTable);c&&c!=n.height&&i.scale(n,1,c/n.height,new t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),i.nameTable);o&&o!=n.offsetX&&i._translate(n,o-n.offsetX,1,i.nameTable);o&&a!=n.offsetY&&i._translate(n,1,a-n.offsetY,i.nameTable)}}},_getChildrenBounds:function(n,i,r){var f=i._getChildren(n.children),e,o=t.datavisualization.Diagram.Rectangle(),u,s,h;for(f.length>0&&(u=i.nameTable[f[0]],u&&(o=this._rotateChildBounds(u,n,i))),s=0,h=f.length;s<h;s++)u=i.nameTable[f[s]],u&&(i.selectedItem||!u._isInternalShape)&&(u._type==="group"?(this._updateGroupBounds(u,i,r),e=this._rotateChildBounds(u,n,i)):e=this._rotateChildBounds(u,n,i)),e&&(o=t.datavisualization.Diagram.Geometry.union(o,e));return o},_updateRotateAngle:function(n,t){var i,r;if(n.offsetX==0&&n.offsetY==0&&n.width==0&&n.height==0)for(i=0;i<n.children.length;i++)if(r=t[n.children[i]],r&&!r.segments&&!n.rotateAngle){n.rotateAngle=r.rotateAngle;return}},_rotateChildBounds:function(n,i,r){var f,u;if(n.segments||(i.rotateAngle||n.rotateAngle)&&(!r._isNodeInitializing||r._isGroupNode)){f=this.bounds(n);u=t.Matrix.identity();t.Matrix.rotate(u,-i.rotateAngle);var e=t.Matrix.transform(u,f.topLeft),o=t.Matrix.transform(u,f.topRight),s=t.Matrix.transform(u,f.bottomLeft),h=t.Matrix.transform(u,f.bottomRight),c=Math.min(e.x,o.x,s.x,h.x),l=Math.min(e.y,o.y,s.y,h.y);return{x:c,width:Math.max(e.x,o.x,s.x,h.x)-c,y:l,height:Math.max(e.y,o.y,s.y,h.y)-l}}return{x:n.offsetX-(n.width||n._width)*n.pivot.x,y:n.offsetY-(n.height||n._height)*n.pivot.y,width:n.width||n._width,height:n.height||n._height}},updateBridging:function(i,r,u){var lt,at,e=[],y,ft,et,c,ni,ot,p,w,ti,ii,ht,bt,ui,tt,kt,dt,fi,h,nt,v,b,o,ei,d,ut,a,gt,s,k,g,oi,si;if(u&&u.length){if(i.segments.length>0)for(h=0;h<i.segments.length;h++)for(v=i.segments[h]._bridges,y=0;y<v.length;y++)v[y]._target==u[0].name?v.splice(y,1):this.findLength(v[y].startPoint,v[y].endPoint)>u[0].bridgeSpace&&(r.nameTable[v[y]._target]&&u.push(r.nameTable[v[y]._target]),v.splice(y,1))}else if(i.segments.length>0)for(h=0;h<i.segments.length;h++)i.segments[h]._bridges=[];if(i._intersects=[],t.datavisualization.Diagram.Util.canBridge(i,r)){var vt=this.getPoints(i),l=i.bridgeSpace,yt=r.bridgeDirection(),pt=-1;if(lt=u&&r.boundaryTable[i.name]?r.boundaryTable[i.name]:t.datavisualization.Diagram.Util.bounds(i),r.boundaryTable[i.name]=lt,ft=u?u:r._getConnectors(),ft.length>0)for(et=0;et<ft.length;et++)if(c=ft[et],i&&i.segments&&i.segments.length>0&&i.segments[0].type!="bezier"&&c&&c.segments&&c.segments.length>0&&c.segments[0].type!="bezier"&&c.segments&&c.visible&&i.name!==c.name&&(at=r.boundaryTable[c.name]?r.boundaryTable[c.name]:t.datavisualization.Diagram.Util.bounds(c),r.boundaryTable[c.name]=at,t.datavisualization.Diagram.Geometry.intersectsRect(lt,at)&&(ni=this.getPoints(c),ot=this.interSect(vt,ni,!1,r,!0),i._intersects.push(c.name),ot.length>0)))for(b=0;b<ot.length;b++){var wt=0,f=0,it=0,rt=0,st=this.getLengthAtFractionPoint(i,ot[b]);if((it=st.lengthAtFractionPt,wt=st.fullLength,f=st.segmentIndex,rt=st.pointIndex,!(f<0))&&i.segments[0])if(ti=(it-l/2)/wt,p=this.getPointAtLength(it-l/2,vt),ti=(it+l/2)/wt,w=this.getPointAtLength(it+l/2,vt),t.datavisualization.Diagram.Geometry.isEmptyPoint(w)&&(w=p),ii=f===0?i.sourcePoint:i.segments[f-1]._endPoint,k=i.segments[f].type==="straight"?i.segments[f]._point:i.segments[f].points[rt],ht=this._findAngle(ii,k),e.length>f&&e[f]!=null){bt=f===0?i.sourcePoint:i.segments[f-1]._endPoint;var hi=Math.abs(this.findLength(bt,w)),ri=0,ct=-1;for(pt=-1,s=0;s<e[f].bridges.length;s++)if(pt++,ui=e[f].bridges[s],ri=Math.abs(this.findLength(bt,ui.endPoint)),hi<ri){ct=pt;break}ct>=0?(tt=this.createSegment(p,w,ht,yt,rt,i,r),tt._target=c.name,e[f].bridges.splice(ct,0,tt),e[f].bridges.join(),e[f].bridgeStartPoint.splice(ct,0,p),e[f].bridgeStartPoint.join(),e[f].segmentIndex=f):(tt=this.createSegment(p,w,ht,yt,rt,i,r),tt._target=c.name,e[f].bridges.push(tt),e[f].bridgeStartPoint.push(p),e[f].segmentIndex=f)}else isNaN(p.x)||isNaN(p.y)||t.datavisualization.Diagram.Geometry.isEmptyPoint(w)||(kt=this.createSegment(p,w,ht,yt,rt,i,r),kt._target=c.name,dt=[],fi=[],dt.push(p),fi.push(w),e.length<f+1,e[f]=n.extend(!0,{},t.datavisualization.Diagram.BridgeSegments,{}),e[f].bridges.push(kt),e[f].bridgeStartPoint=dt,e[f].segmentIndex=f)}if(u&&u.length&&i.segments.length>0)for(h=0;h<i.segments.length;h++)nt=i.segments[h],v=i.segments[h]._bridges,e[h]||(e[h]=n.extend(!0,{},t.datavisualization.Diagram.BridgeSegments),e[h].segmentIndex=h),e[h].bridges=e[h].bridges.concat(v).sort(function(n,t){return nt._startPoint.x!=nt._endPoint.x?nt._startPoint.x<nt._endPoint.x?n.startPoint.x-t.startPoint.x:t.startPoint.x-n.startPoint.x:nt._startPoint.y<nt._endPoint.y?n.startPoint.y-t.startPoint.y:t.startPoint.y-n.startPoint.y}),e[h].bridgeStartPoint=e[h].bridges.map(function(n){return n.startPoint}),i.segments[h]._bridges=[];if(e.length!=0)for(b=0;b<e.length;b++)if(o=e[b],o){for(s=1;s<o.bridges.length;s++)this.findLength(o.bridges[s].endPoint,o.bridges[s-1].endPoint)<l&&(o.bridges[s-1].endPoint=o.bridges[s].endPoint,a=o.bridges[s-1],ei=r.getBridgeSegment(a.startPoint,a.endPoint,a.angle,l,a.sweep),o.bridges[s-1].path=ei,u&&u.length&&o.bridges[s-1]._target==u[0].name&&(o.bridges[s-1]._target=o.bridges[s]._target),o.bridges.splice(s,1),o.bridgeStartPoint.splice(s,1),s--);for(d=i.sourcePoint,ut=0;ut<o.bridges.length;ut++){for(a=o.bridges[ut],gt=!0,s=0;u&&s<u.length;s++)a._target==u[s].name&&(gt=!1);gt?(i.segments[o.segmentIndex]._bridges.push(a),d=a.endPoint):(i.segments[o.segmentIndex].type==="straight"?k=i.segments[o.segmentIndex]._endPoint:i.segments[o.segmentIndex].type==="orthogonal"&&(k=i.segments[o.segmentIndex].points[a.segmentPointIndex]),f!=0&&(d=i.segments[o.segmentIndex]._endPoint),g=[],g.push(t.datavisualization.Diagram.Point(k.x-l,k.y-l)),g.push(t.datavisualization.Diagram.Point(k.x+l,k.y+l)),oi=t.datavisualization.Diagram.Geometry.rect(g),g=[],g.push(t.datavisualization.Diagram.Point(d.x-l,d.y-l)),g.push(t.datavisualization.Diagram.Point(d.x+l,d.y+l)),si=t.datavisualization.Diagram.Geometry.rect(g),t.datavisualization.Diagram.Geometry.containsPoint(oi,o.bridgeStartPoint[ut])||t.datavisualization.Diagram.Geometry.containsPoint(si,a.endPoint)||(i.segments[o.segmentIndex]._bridges.push(a),d=a.endPoint))}}}},createSegment:function(i,r,u,f,e,o,s){var l,c,h=n.extend(!0,{},t.datavisualization.Diagram.PathSegment);return c=this.sweepDirection(u,f,o,s),l=s.getBridgeSegment(i,r,u,o.bridgeSpace,c),h.path=l,h.startPoint=i,h.endPoint=r,h.angle=u,h.segmentPointIndex=e,h.sweep=c,h},sweepDirection:function(n,t){var r=Math.abs(n),i;return t==="top"||t==="bottom"?(i=1,r>=0&&r<=90&&(i=0)):(t==="right"||t==="left")&&(i=1,n<0&&n>=-180&&(i=0)),(t==="right"||t==="bottom")&&(i=i===0?1:0),i},getPointAtLength:function(n,i){for(var u,o,f=0,r=null,s=t.datavisualization.Diagram.Point(0,0),e=0;e<i.length;e++){if(u=i[e],r)if(o=this.findLength(r,u),f+o>n){var h=n-f,c=this.findAngle(r,u),l=h*Math.cos(c*Math.PI/180),a=h*Math.sin(c*Math.PI/180);s=t.datavisualization.Diagram.Point(r.x+l,r.y+a);break}else f+=o;else{r=u;continue}r=u}return s},getLengthAtFractionPoint:function(n,t){var c=100,o=0,l=-1,a=0,v=0,y=-1,f,e,s,w,i,r,h;if(n.segments===null)return 0;var b=n.segments,u=n.sourcePoint,p=u;for(f=0;f<n.segments.length;f++){for(e=[],s=n.segments[f],i=0;i<s.points.length;i++)w=s.points[i],e.push(w);for(i=0;i<e.length;i++)r=e[i],h=this.getSlope(r,u,t,n),h<c&&(c=h,v=o+this.findLength(t,p),l=a,y=i),o+=this.findLength(r,u),u=r,p=r;a++}return{lengthAtFractionPt:v,fullLength:o,segmentIndex:l,pointIndex:y}},getSlope:function(n,t,i,r){var e=3,o=Math.abs(n.x-t.x),s=Math.abs(n.y-t.y),u=(i.y-n.y)/(t.y-n.y),f=(i.x-n.x)/(t.x-n.x);return!isFinite(u)||!isFinite(f)||isNaN(u)||isNaN(f)?n.x===t.x?n.y===t.y?1e4:n.y>i.y&&i.y>t.y||n.y<i.y&&i.y<t.y?Math.abs(n.x-i.x):1e4:n.y==t.y?n.x>i.x&&i.x>t.x||n.x<i.x&&i.x<t.x?Math.abs(n.y-i.y):1e4:1e4:r.segments.length>0?n.x>=i.x&&i.x>=t.x||n.x<=i.x&&i.x<=t.x||o<e?n.y>=i.y&&i.y>=t.y||n.y<=i.y&&i.y<=t.y||s<e?Math.abs(u-f):1e4:1e4:1e4},getPoints:function(n){var r=[],t,i,u;if(n.segments.length>0)for(t=0;t<n.segments.length;t++)if(i=n.segments[t],i.type==="straight"||i.type==="bezier")t===0&&r.push(n.sourcePoint),i._point&&r.push(i._point);else if(i.type==="orthogonal")for(u=0;u<n.segments[t].points.length;u++)r.push(n.segments[t].points[u]);return r},interSect:function(n,t,i,r,u){var s,h,f,e,o;for(i&&t.length>=2&&(t.splice(0,1),t.splice(0,1)),s=[],h=r.bridgeDirection(),f=0;f<n.length-1;f++){if(e=this.interSect1(n[f],n[f+1],t,r,u,h),e.length>0)for(o=0;o<e.length;o++)s.push(e[o]);i&&t.length>=1&&t.splice(0,1)}return s},checkforHorizontalLine:function(n){var t=Math.abs(n);return t>90?180-t:t},interSect1:function(n,i,r,u,f,e){for(var c,s,h,l=[],o=0;o<r.length-1;o++)c=this.interSect2(n,i,r[o],r[o+1]),t.datavisualization.Diagram.Geometry.isEmptyPoint(c)||(s=this._findAngle(n,i),h=this._findAngle(r[o],r[o+1]),s=this.checkforHorizontalLine(s),h=this.checkforHorizontalLine(h),e==="left"||e==="right"?s>h&&l.push(c):(e==="top"||e==="bottom")&&s<h&&l.push(c),s===h&&f&&l.push(c));return l},interSect2:function(n,i,r,u){var e=t.datavisualization.Diagram.LineUtil(n.x,n.y,i.x,i.y),o=t.datavisualization.Diagram.LineUtil(r.x,r.y,u.x,u.y),f=this.interSect3(e,o);return f.enabled?f.intersectPt:t.datavisualization.Diagram.Point(0,0)},interSect3:function(n,i){var f=t.datavisualization.Diagram.Point(0,0),r=n,u=i,o=(u.y2-u.y1)*(r.x2-r.x1)-(u.x2-u.x1)*(r.y2-r.y1),h=(u.x2-u.x1)*(r.y1-u.y1)-(u.y2-u.y1)*(r.x1-u.x1),c=(r.x2-r.x1)*(r.y1-u.y1)-(r.y2-r.y1)*(r.x1-u.x1),e,s;return o==0?{enabled:!1,intersectPt:f}:(e=h/o,s=c/o,e>=0&&e<=1&&s>=0&&s<=1)?(f.x=r.x1+e*(r.x2-r.x1),f.y=r.y1+e*(r.y2-r.y1),{enabled:!0,intersectPt:f}):{enabled:!1,intersectPt:f}},findLength:function(n,t){try{return Math.sqrt((n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y))}catch(i){throw i;}},_findAngle:function(n,t){var i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)*(180/Math.PI)},findAngle:function(n,i){if(t.datavisualization.Diagram.Geometry.isEqualPoint(n,i))return 0;var u=t.datavisualization.Diagram.Point(i.x,n.y),o=this.findLength(n,u),f=this.findLength(u,i),e=this.findLength(i,n),r=Math.asin(f/e);return r=r*180/Math.PI,n.x<i.x?n.y<i.y||(r=360-r):r=n.y<i.y?180-r:180+r,r},_mapPalettePhase:function(n){var i,r;return n.orientation&&n.orientation=="horizontal"?(i={x:0,y:0},r={x:40,y:0}):(i={x:0,y:0},r={x:0,y:40}),t.datavisualization.Diagram.Connector({name:n?n.name:t.datavisualization.Diagram.Util.randomId(),segments:[{type:"straight"}],sourcePoint:{x:i.x,y:i.y},targetPoint:{x:r.x,y:r.y},lineWidth:n.lineWidth?n.lineWidth:1,lineDashArray:n.lineDashArray?n.lineDashArray:null,lineColor:n.lineColor?n.lineColor:"#606060",targetDecorator:{shape:"none"},isPhase:!0,orientation:n.orientation?n.orientation:"horizontal",labels:n.label?[n.label]:[],paletteItem:n.paletteItem?n.paletteItem:null})},_updateShapeProperties:function(n){n._type="node";n.shape.type||(n.shape.type="rectangle");switch(n.shape.type){case"rectangle":n.type="basic";n._shape=n.shape.type;n.shape.cornerRadius&&(n.cornerRadius=n.shape.cornerRadius);break;case"ellipse":n.type="basic";n._shape=n.shape.type;break;case"path":n.type="basic";n._shape=n.shape.type;n.pathData=n.shape.pathData;break;case"polygon":n.type="basic";n._shape=n.shape.type;n.points=n.shape.points;break;case"image":n.type="image";n._shape=n.shape.type;n.source=n.shape.src;break;case"native":n.type="native";n._shape=n.shape.type;n.templateId=n.shape.templateId;break;case"text":n.type="text";n._shape=n.shape.type;n.textBlock=n.shape.textBlock;break;case"html":n.type="html";n._shape=n.shape.type;n.templateId=n.shape.templateId}},_refreshParentGroup:function(n,i){var r=i.nameTable[n.parent],u;r&&(this._updateGroupBounds(r,i),u=r.parent?document.getElementById(r.parent):i._diagramLayer,t.datavisualization.Diagram.DiagramContext.renderGroup(r,i),i._raiseGroupChangeEvent(n,undefined,r,"group"))},intersectsWith:function(n,t){var i=t;return n.x<i.x&&i.x<n.x+n.width&&n.y<i.y&&i.y<n.y+n.height},_findOffsetOnConnector:function(n,i,r,u){for(var e,a,k,l,y=0,o=[],f=0;f<n.segments.length;f++)for(o[f]=[],e=0;e<n.segments[f].points.length-1;e++)y+=t.datavisualization.Diagram.Geometry.distance(n.segments[f].points[e],n.segments[f].points[e+1]),o[f][e]=y;var p=n.sourceNode&&i.offset==0&&u.nameTable[n.sourceNode]||n.targetNode&&i.offset==1&&u.nameTable[n.targetNode],s=p?this.bounds(p):null,r=i.segmentOffset||0,v,c,b,h,w=y*r;for(f=0;f<o.length;f++)for(e=0;e<o[f].length;e++){if(o[f][e]>=w){if(c=n.segments[f],b=t.datavisualization.Diagram.Geometry.findAngle(c.points[e],n.segments[f].points[e+1]),h=t.datavisualization.Diagram.Geometry.transform(c.points[e],b,w-(v||0)),p){if(this.intersectsWith(s,h)&&!t.datavisualization.Diagram.Geometry.containsRect(s,this.bounds(n))){k=i.offset==0?this._getBezierDirection(c.points[e],n.segments[f].points[e+1]):this._getBezierDirection(c.points[e+1],n.segments[f].points[e]);a=i.offset==0?c.points[e+1]:c.points[e];l=!1;switch(k){case"top":s.y>a.y?h.y=s.top:l=!0;break;case"bottom":s.bottom<a.y?h.y=s.bottom:l=!0;break;case"right":s.right<a.x?h.x=s.right:l=!0;break;case"left":s.left>a.x?h.x=s.left:l=!0}if(l){w=i.offset==1?v||0:o[f][e];v=i.offset==0?o[f][e]:o[f][e-2]||(o[f-1]&&o[f-1].length>1?o[f-1][o[f-1].length-1]:o[f-2]&&o[f-2][o[f-2].length-1])||0;i.offset==0?f=f:e?e-=2:f-=2;continue}}return{segment:f,point:e,offset:{x:h.x,y:h.y}}}return{segment:f,point:e,offset:{x:h.x,y:h.y}}}v=o[f][e]}},_alignLabelOnSegments:function(n,i,r,u){var b=u.angle%360,y,c,f,e,p,w,o;u.angle%=360;var s=45,l=135,h=225,v=315,a;(i.segmentOffset==0&&n.sourceNode||i.segmentOffset==1&&n.targetNode)&&(y=i.segmentOffset==0&&n.sourceNode?r.nameTable[n.sourceNode]:r.nameTable[n.targetNode],y&&(a=this.bounds(y)),a&&(c=180/(2+2/(a.height/a.width)),s=c,l=180-c,h=l+2*c,v=360-c));switch(i.alignment){case"before":u.angle>=s&&u.angle<=l?(f="right",e=i.segmentOffset==.5?"center":"top"):u.angle>=h&&u.angle<=v?(f="left",e=i.segmentOffset==.5?"center":"bottom"):u.angle>s&&u.angle<h?(e="top",f=i.segmentOffset==.5?"center":"right"):(e="bottom",f=i.segmentOffset==.5?"center":"left");break;case"after":u.angle>=s&&u.angle<=l?(f="left",e=i.segmentOffset==.5?"center":"top"):u.angle>=h&&u.angle<=v?(f="right",e=i.segmentOffset==.5?"center":"bottom"):u.angle>s&&u.angle<h?(e="bottom",f=i.segmentOffset==.5?"center":"right"):(e="top",f=i.segmentOffset==.5?"center":"left");break;case"center":f="center";e="center"}if(i.boundaryConstraints&&(i.segmentOffset==0||i.segmentOffset==1)){n.segments.length>1&&(o=n.segments[n.segments.length-1]);p=o?o.points.length:n.segments[0].points.length;n.labels[0].name==i.name?w=t.datavisualization.Diagram.Util._getBezierDirection(n.segments[0].points[0],n.segments[0].points[1]):(o=o?o:n.segments[0],w=t.datavisualization.Diagram.Util._getBezierDirection(o.points[p-2],o.points[p-1]));switch(w){case"left":f=i.segmentOffset==0?"right":"left";break;case"right":f=i.segmentOffset==0?"left":"right";break;case"bottom":e=i.segmentOffset==0?"top":"bottom";break;case"top":e=i.segmentOffset==0?"bottom":"top"}}return{hAlign:f,vAlign:e}},getObjectType:function(n){return n?n.segments?"connector":n.type=="bpmn"&&n.container?"group":n._type==="node"||n.type=="bpmn"||n.type=="basic"||n.type=="flow"||n.type=="arrow"?"node":n.type==="text"||n.type==="image"||n.type==="native"||n.type==="html"?"node":n._type!="group"&&n.type=="pseudoGroup"?"pseudoGroup":n._type==="group"||n.isLane||n.isSwimlane?"group":n.isSwimlane?"swimlane":null:null},_canBeTarget:function(n,t){return t&&n.activeTool.helper&&n.activeTool.helper._name&&n.activeTool.helper._name===t.name?!1:!0},getLabelbounds:function(i,r,u){var o=i._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],s=o.getBoundingClientRect(),e,f;if(u&&(e=n(o).find("#"+r.name+"_"+u.name)[0],e))return f=e.getBoundingClientRect(),t.datavisualization.Diagram.Rectangle(f.left-s.left,f.top-s.top,f.right-f.left,f.bottom-f.top)},_updateBpmnChild:function(n,i){switch(n.shape){case"event":n=t.datavisualization.Diagram.DefautShapes._getBPMNEventShape(n,i);break;case"gateway":n=t.datavisualization.Diagram.DefautShapes._getBPMNGatewayShape(n,i);break;case"dataobject":n=t.datavisualization.Diagram.DefautShapes._getBPMNDataShape(n,i);break;case"activity":n=t.datavisualization.Diagram.DefautShapes._getBPMNActivityShape(n,i);break;case"group":n=t.datavisualization.Diagram.DefautShapes._getBPMNGroupShape(n,i)}return t.datavisualization.Diagram.DefautShapes.initBPMNAnnotationShape(n,i)},_getUndoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._undoObject=n.extend(!0,{},{node:i,childTable:r})},_getRedoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._redoObject=n.extend(!0,{},{node:i,childTable:r})},_collectionContains:function(n,t){for(var i=0;i<t.length;i++)if(typeof t[i]=="string"&&t[i]===n||t[i].name===n)return!0},_updateBPMNProperties:function(n,i,r,u){var o,w,f,e,l,a,s,v;switch(n.shape){case"activity":var h=t.datavisualization.Diagram.Util.bounds(n,!0),y=n.offsetX,p=n.offsetY,c=i._getChildren(n.children);for(s=0;s<c.length;s++)(o=typeof c[s]=="object"?c[s]:r[c[s]],u&&s==0&&(h=t.datavisualization.Diagram.Util.bounds(o,!0),y=o.offsetX,p=o.offsetY),s==0&&(o.pathData=o._absolutePath=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(n,12),n.subProcess.type=="transaction"&&(w={x:3,y:3,width:n.width-3,height:n.height-3},o.pathData=o._absolutePath+=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(w,12)),delete o._absoluteBounds),u&&t.datavisualization.Diagram.Util.canResize(o))||(f=o.addInfo,f.offset&&(e=t.datavisualization.Diagram.Point(h.x+h.width*f.offset.x,h.y+h.height*f.offset.y),f.margin=t.datavisualization.Diagram.Margin(f.margin?f.margin:{}),f.hAlign&&(e.x+=f.margin.left-f.margin.right,e.x=f.hAlign=="left"?e.x+f.margin.right:f.hAlign=="right"?e.x-f.margin.left:e.x),f.vAlign&&(e.y+=f.margin.top-f.margin.bottom,e.y=f.vAlign=="top"?e.y+f.margin.bottom:f.vAlign=="bottom"?e.y-f.margin.top:e.y),n.rotateAngle&&(l=t.Matrix.identity(),t.Matrix.rotate(l,n.rotateAngle,y,p),e=t.Matrix.transform(l,e)),o.offsetX=e.x,o.offsetY=e.y));break;case"group":n.pathData=n._absolutePath=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(n,15);n._scaled=!1;break;case"annotation":for(s=0;s<n.outEdges.length;s++)if(v=i.nameTable[n.outEdges[s]],v._isAnnotationLine){a=v;break}a&&t.datavisualization.Diagram.DefautShapes.updateBPMNAnnotationShape(a,null,null,i)}}};t.datavisualization.Diagram.BridgeSegments={bridges:[],bridgeStartPoint:[],segmentIndex:-1};t.datavisualization.Diagram.PathSegment={path:"",startPoint:{x:0,y:0},endPoint:{x:0,y:0},angle:0,segmentPointIndex:-1,sweep:1};t.datavisualization.Diagram.LineUtil=function(n,t,i,r){return{x1:Number(n)||0,y1:Number(t)||0,x2:Number(i)||0,y2:Number(r)||0}};t.datavisualization.Diagram.Geometry={checkPointOnCircle:function(n,t,i){var r=Math.pow(i,2),u=Math.pow(n.x-t.x,2),f=Math.pow(n.y-t.y,2);return u+f<=r?!0:!1},rect:function(n){var c=t.datavisualization.Diagram.Rectangle(),e,i,r,h;if(arguments.length===1){var o=Number.MAX_VALUE,s=Number.MAX_VALUE,l=-Number.MAX_VALUE,a=-Number.MAX_VALUE,v=n.length,u,f;for(e=0;e<v;e++)u=n[e].x,f=n[e].y,u<o&&(o=u),u>l&&(l=u),f<s&&(s=f),f>a&&(a=f);c=t.datavisualization.Diagram.Rectangle(o,s,l-o,a-s)}else arguments.length===2&&(i=t.datavisualization.Diagram.Point(arguments[0]),r=t.datavisualization.Diagram.Point(arguments[1]),i.x>r.x&&(h=i.x,i.x=r.x,r.x=h),i.y>r.y&&(h=i.y,i.y=r.y,r.y=h),c=t.datavisualization.Diagram.Rectangle(i.x,i.y,r.x-i.x,r.y-i.y));return c},union:function(n,i){var r=Math.min(n.x,i.x),u=Math.min(n.y,i.y),f=Math.max(n.x+n.width,i.x+i.width),e=Math.max(n.y+n.height,i.y+i.height);return t.datavisualization.Diagram.Rectangle(r,u,f-r,e-u)},distance:function(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))},translate:function(n,i,r){return t.datavisualization.Diagram.Point(n.x+i,n.y+r)},intersectsRect:function(n,t){return t.x<n.x+n.width&&n.x<t.x+t.width&&t.y<n.y+n.height&&n.y<t.y+t.height},findAngle:function(n,t){var i=Math.atan2(t.y-n.y,t.x-n.x);return i=180*i/Math.PI,i%=360,i<0&&(i+=360),i},intersectSegment:function(n,i){var a=n.point1.x,v=n.point1.y,y=n.point2.x,p=n.point2.y,w=i.point1.x,b=i.point1.y,k=i.point2.x,d=i.point2.y,e,o,s,h,c,l,rt,ut,g,nt,tt,it,r,f,u;return(e=p-v,s=a-y,c=y*v-a*p,tt=e*w+s*b+c,it=e*k+s*d+c,tt!==0&&it!==0&&this.sameSign(tt,it))?null:(o=d-b,h=w-k,l=k*b-w*d,g=o*a+h*v+l,nt=o*y+h*p+l,g!==0&&nt!==0&&this.sameSign(g,nt))?null:(r=e*h-o*s,r===0)?null:(f=r<0?-r/2:r/2,f=0,u=s*l-h*c,rt=u<0?(u-f)/r:(u+f)/r,u=o*c-e*l,ut=u<0?(u-f)/r:(u+f)/r,t.datavisualization.Diagram.Point(rt,ut))},updatePath:function(n,i,r,u,f,e,o,s){var h,c;e&&e.pathBounds?(c=!0,h=o||e.pathBounds(f)):(c=s&&!s._absolutePath?!0:!1,h=o);s&&(s._absoluteBounds=h);var l=0,a=0,v=!1;return(n.toString()!==h.x||i.toString()!==h.y)&&(l=n-Number(h.x),a=i-Number(h.y)),(r!==h.width||u!==h.height)&&(l=r/Number(h.width?h.width:1),a=u/Number(h.height?h.height:1),v=!0),t.datavisualization.Diagram.Geometry.processPathData(f,l,a,v,h.x,h.y,n,i,c,e)},processPathData:function(n,i,r,u,f,e,o,s,h,c){var rt=document.createElementNS("http://www.w3.org/2000/svg","path"),ut,ft,p,w,b,k,d,v,nt,y,tt,it;rt.setAttribute("d",n);h&&(c=c||new t.datavisualization.Diagram.Svg({}),n=c.absolutePath(rt).getAttribute("d"),rt.setAttribute("d",n));d=t.datavisualization.Diagram.Util.convertPathToArray(n);for(var l=0,a=0,g=0,et=d.length;g<et;++g){v=d[g];nt=v.pathSegTypeAsLetter;"x1"in v&&(p=v.x1);"x2"in v&&(b=v.x2);"y1"in v&&(w=v.y1);"y2"in v&&(k=v.y2);"x"in v&&(l=v.x);"y"in v&&(a=v.y);u?(l!=undefined&&(l=t.datavisualization.Diagram.Geometry.scalePathData(l,i,f,o),l=Number(l.toFixed(2))),a!=undefined&&(a=t.datavisualization.Diagram.Geometry.scalePathData(a,r,e,s),a=Number(a.toFixed(2))),p!=undefined&&(p=t.datavisualization.Diagram.Geometry.scalePathData(p,i,f,o),p=Number(p.toFixed(2))),w!=undefined&&(w=t.datavisualization.Diagram.Geometry.scalePathData(w,r,e,s),w=Number(w.toFixed(2))),b!=undefined&&(b=t.datavisualization.Diagram.Geometry.scalePathData(b,i,f,o),b=Number(b.toFixed(2))),k!=undefined&&(k=t.datavisualization.Diagram.Geometry.scalePathData(k,r,e,s),k=Number(k.toFixed(2)))):(l!=undefined&&(l=l+i),a!=undefined&&(a=a+r),p!=undefined&&(p=p+i),w!=undefined&&(w=w+r),b!=undefined&&(b=b+i),k!=undefined&&(k=k+r));switch(nt){case"M":y={pathSegTypeAsLetter:"M",x:l,y:a};break;case"L":y={pathSegTypeAsLetter:"L",x:l,y:a};break;case"H":y={pathSegTypeAsLetter:"H",x:l};break;case"V":y={pathSegTypeAsLetter:"V",y:a};break;case"C":y={pathSegTypeAsLetter:"C",x:l,y:a,x1:p,y1:w,x2:b,y2:k};break;case"S":y={pathSegTypeAsLetter:"S",x:l,y:a,x2:b,y2:k};break;case"Q":y={pathSegTypeAsLetter:"Q",x:l,y:a,x1:p,y1:w};break;case"T":y={pathSegTypeAsLetter:"T",x:l,y:a};break;case"A":tt=v.r1;it=v.r2;u&&(tt=tt*i,it=it*r);y={pathSegTypeAsLetter:"A",x:l,y:a,r1:tt,r2:it,angle:v.angle,largeArcFlag:v.largeArcFlag,sweepFlag:v.sweepFlag};break;case"z":case"Z":l=ut;a=ft;y=d[g]}y&&(d[g]=y);(nt==="M"||nt==="m")&&(ut=l,ft=a)}return t.datavisualization.Diagram.Util.pathSegArrayAsString(d)},scalePathData:function(n,t,i,r){return n!==i?n=r!==i?n*t-(Number(i)*t-Number(i))+(r-Number(i)):Number(n)*t-(Number(i)*t-Number(i)):r!==i&&(n=r),n},updatePolygonPoints:function(n,i){var f,r,e,u;if(n.points)for(i||(i=n.points),t.datavisualization.Diagram.Geometry.scalePoints(i,n),f=t.datavisualization.Diagram.Geometry.rect(n.points),r=0,e=n.points.length;r<e;++r)u=t.datavisualization.Diagram.Geometry.translate(i[r],-f.x,-f.y),u=t.datavisualization.Diagram.Geometry.translate(u,0,0),i[r]=u},scalePoints:function(n,i){var u=t.datavisualization.Diagram.Geometry.rect(i.points),f,e,r,o;if(u.width>0&&u.height>0)for(f=i.width/u.width,e=i.height/u.height,r=0,o=i.points.length;r<o;++r)n[r].x=n[r].x*f,n[r].y=n[r].y*e},sameSign:function(n,t){return n*t>=0},containsPoint:function(n,t){return n.x<=t.x&&t.x<=n.x+n.width&&n.y<=t.y&&t.y<=n.y+n.height},containsRect:function(n,t){return n.x<=t.x&&t.x+t.width<=n.x+n.width&&n.y<=t.y&&t.y+t.height<=n.y+n.height},inflate:function(n,t,i){n.x-=t;n.y-=i;n.width+=2*t;n.height+=2*i},isEmptyRect:function(n){return n.x===0&&n.y===0&&n.width===0&&n.height===0},isEmptyPoint:function(n){return n.x===0&&n.y===0},isEqualPoint:function(n,t){return n.x===t.x&&n.y===t.y},isEmptySize:function(n){return n.width===0&&n.height===0},length:function(n){return t.datavisualization.Diagram.Geometry.distance(n.point1,n.point2)},midPoint:function(n){return t.datavisualization.Diagram.Point((n.point1.x+n.point2.x)/2,(n.point1.y+n.point2.y)/2)},transform:function(n,t,i){var r={};return r.x=Math.round((n.x+i*Math.cos(t*Math.PI/180))*100)/100,r.y=Math.round((n.y+i*Math.sin(t*Math.PI/180))*100)/100,r}};t.datavisualization.Diagram.LineSegment=function(n,t){return{point1:n,point2:t}};t.datavisualization.Diagram.Point=function(n,t){return{x:Number(n)||0,y:Number(t)||0}};t.datavisualization.Diagram.Size=function(n,t){return{width:Number(n)||0,height:Number(t)||0}};t.datavisualization.Diagram.Rectangle=function(n,t,i,r){return{x:Number(n)||0,y:Number(t)||0,width:Number(i)||0,height:Number(r)||0}};t.datavisualization.Diagram.ImageAlignment={None:"none",XMinYMin:"xminymin",XMinYMid:"xminymid",XMinYMax:"xminymax",XMidYMin:"xmidymin",XMidYMid:"xmidymid",XMidYMax:"xmidymax",XMaxYMin:"xmaxymin",XMaxYMid:"xmaxymid",XMaxYMax:"xmaxymax"};t.datavisualization.Diagram.ScaleConstraints={None:"none",Stretch:"stretch",Meet:"meet",Slice:"slice"};t.datavisualization.Diagram.KeyModifiers={None:0,Control:1,Meta:1,Alt:2,Shift:4};t.datavisualization.Diagram.Keys={None:"",Number0:0,Number1:1,Number2:2,Number3:3,Number4:4,Number5:5,Number6:6,Number7:7,Number8:8,Number9:9,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,Left:37,Up:38,Right:39,Down:40,Escape:27,Delete:46,Tab:9,Enter:13};t.datavisualization.Diagram.LabelRenderingMode={Html:"html",Svg:"svg"};t.datavisualization.Diagram.TemplateType={Html:"html",Svg:"svg"};t.datavisualization.Diagram.DecoratorShapes={None:"none",Arrow:"arrow",OpenArrow:"openarrow",Circle:"circle",Diamond:"diamond",Path:"path"};t.datavisualization.Diagram.ActionType={Unknown:"unknown",Nudge:"nudge",Touch:"touch",Mouse:"mouse",Order:"order",Align:"align",Size:"size",HistoryChange:"historyChange"};t.datavisualization.Diagram.dependentconnector={dependent:1,independent:2};t.datavisualization.Diagram.ContainerType={Canvas:"canvas",Stack:"stack"};t.datavisualization.Diagram.IconShapes={Minus:"minus",Plus:"plus",ArrowUp:"arrowup",ArrowDown:"arrowdown",Template:"template",Path:"path",Image:"image",None:"none"};t.datavisualization.Diagram.PortShapes={X:"x",Circle:"circle",Square:"square",Path:"path"};t.datavisualization.Diagram.PortVisibility={Visible:1,Hidden:2,Hover:4,Connect:8,Default:8};t.datavisualization.Diagram.TextAlign={Left:"left",Center:"center",Right:"right",Justify:"justify"};t.datavisualization.Diagram.HorizontalAlignment={Left:"left",Center:"center",Right:"right",Stretch:"stretch"};t.datavisualization.Diagram.Alignment={Before:"before",After:"after",Center:"center"};t.datavisualization.Diagram.LabelRelativeMode={SegmentBounds:"segmentbounds",SegmentPath:"segmentpath"};t.datavisualization.Diagram.LabelEditMode={Edit:"edit",View:"view"};t.datavisualization.Diagram.RelativeMode={Object:"object",Mouse:"mouse"};t.datavisualization.Diagram.TextWrapping={NoWrap:"nowrap",Wrap:"wrap",WrapWithOverflow:"wrapwithoverflow"};t.datavisualization.Diagram.VerticalAlignment={Top:"top",Center:"center",Bottom:"bottom",Stretch:"stretch"};t.datavisualization.Diagram.TextDecorations={Underline:"underline",Overline:"overline",LineThrough:"line-through",None:"none"};t.datavisualization.Diagram.PaletteConstraints={HeaderVisibility:2,Visible:4,Expandable:8,Default:14};t.datavisualization.Diagram.NodeConstraints={None:1,Select:2,Delete:4,Drag:8,Rotate:16,Connect:32,ResizeNorthEast:64,ResizeEast:128,ResizeSouthEast:256,ResizeSouth:512,ResizeSouthWest:1024,ResizeWest:2048,ResizeNorthWest:4096,ResizeNorth:8192,Resize:16320,Shadow:16384,DragLabel:32768,AllowPan:65536,AspectRatio:131072,AllowDrop:262144,InheritTooltip:524288,MultiSelect:1048576,PointerEvents:2097152,PointerVisibility:2097152,CrispEdges:4194304,InheritCrispEdges:8388608,Interaction:16347,Default:11026430};t.datavisualization.Diagram.HistoryChangeCause={Undo:"undo",Redo:"redo",CustomAction:"customAction"};t.datavisualization.Diagram.CollectionChangeCause={ClipBoard:"clipBoard",Drop:"drop",HistoryChange:"historyChange",Unknown:"unknown"};t.datavisualization.Diagram.SelectionChangeCause={Keydown:"keydown",RubberBand:"rubberBand",Mouse:"mouse",Touch:"touch",Unknown:"unknown"};t.datavisualization.Diagram.ScrollChangeCause={Zoom:"zoom",Pan:"pan",Unknown:"unknown"};t.datavisualization.Diagram.ConnectorConstraints={None:1,Select:2,Delete:4,Drag:8,DragSourceEnd:16,DragTargetEnd:32,DragSegmentThumb:64,Bridging:128,DragLabel:256,InheritBridging:512,AllowDrop:1024,InheritTooltip:2048,PointerEvents:4096,PointerVisibility:4096,CrispEdges:8192,InheritCrispEdges:16384,Interaction:122,Default:23166};t.datavisualization.Diagram.PortConstraints={None:1,Connect:2,ConnectOnDrag:4};t.datavisualization.Diagram.SelectorConstraints={None:1,Rotator:2,Resizer:4,UserHandles:8,Tooltip:16,All:30};t.datavisualization.Diagram.UserHandlePositions={TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",MiddleLeft:"middleleft",MiddleRight:"middleright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};t.datavisualization.Diagram.SnapConstraints={None:0,SnapToHorizontalLines:1,SnapToVerticalLines:2,SnapToLines:3,ShowHorizontalLines:4,ShowVerticalLines:8,ShowLines:12,All:15};t.datavisualization.Diagram.PageOrientations={Landscape:"landscape",Portrait:"portrait"};t.datavisualization.Diagram.ScrollLimit={Infinity:"infinity",Diagram:"diagram",Limited:"limited"};t.datavisualization.Diagram.BoundaryConstraints={Infinity:"infinity",Diagram:"diagram",Page:"page"};t.datavisualization.Diagram.LayoutOrientations={TopToBottom:"toptobottom",BottomToTop:"bottomtotop",LeftToRight:"lefttoright",RightToLeft:"righttoleft"};t.datavisualization.Diagram.ObjectTypes={Diagram:"diagram",Palette:"palette",Lane:"lane",Group:"group"};t.datavisualization.Diagram.PaletteDefaults={name:"",expanded:!1,subControlId:null,items:[],constraints:t.datavisualization.Diagram.PaletteConstraints.Default};t.datavisualization.Diagram.Palette=function(i){return n.extend(!0,{},t.datavisualization.Diagram.PaletteDefaults,i)};t.datavisualization.Diagram.Shapes={Image:"image",Text:"text",Html:"html",Native:"native",Basic:"basic",Flow:"flow",Arrow:"arrow",BPMN:"bpmn"};t.datavisualization.Diagram.ClipBoardChangeType={All:"all",None:"none",Specific:"specific"};t.datavisualization.Diagram.OverflowType={Clip:"clip",Ellipsis:"ellipsis"};t.datavisualization.Diagram.ShapeDefaults={shape:"",source:"",pathData:"",textBlock:null,points:[],templateId:null,scale:"meet",contentAlignment:"xmidymid"};t.datavisualization.Diagram.Shape=function(i){return i&&(i.type==="html"&&typeof i.html=="string"&&(i.html=t.datavisualization.Diagram.Util.htmlEncode(i.html)),i.type==="text"&&(i.textBlock=t.datavisualization.Diagram.TextBlock(i.textBlock?i.textBlock:{}),i.fillColor=i.fillColor?i.fillColor:"transparent",i.borderColor=i.borderColor?i.borderColor:"transparent",i.borderWidth=i.borderWidth?i.borderWidth:0),(i.type=="image"||i.type=="native"||i.type==="text"||i.type==="html")&&(i._shape=i.type),i._type||(i._type=i.type?i.type:"node"),i._shape||(i._shape=i.shape?i.shape:"rectangle")),n.extend(!0,{},t.datavisualization.Diagram.ShapeDefaults,i)};t.datavisualization.Diagram.Segments={Straight:"straight",Orthogonal:"orthogonal",Bezier:"bezier"};t.datavisualization.Diagram.SegmentDefaults={type:t.datavisualization.Diagram.Segments.Straight,point:null,point1:null,point2:null,vector1:null,vector2:null,_point1:t.datavisualization.Diagram.Point(),_point2:t.datavisualization.Diagram.Point(),length:null,_length:null,_bridges:[],direction:null,_direction:null};t.datavisualization.Diagram.Segment=function(i){var r=n.extend(!0,{},t.datavisualization.Diagram.SegmentDefaults,i);return r.points=[],r.type=="orthogonal"?(r._length=r.length,r._direction=r.direction):(r.type=="bezier"&&(r._point1=r.point1,r._point2=r.point2),r.point&&(r._point=r.point)),r};t.datavisualization.Diagram.MarginDefaults={top:0,left:0,right:0,bottom:0};t.datavisualization.Diagram.Margin=function(i){return n.extend(!0,{},t.datavisualization.Diagram.MarginDefaults,i)};t.datavisualization.Diagram.GestureDefaults={key:t.datavisualization.Diagram.Keys.None,keyModifiers:t.datavisualization.Diagram.KeyModifiers.None};t.datavisualization.Diagram.Gesture=function(i){return n.extend(!0,{},t.datavisualization.Diagram.GestureDefaults,i)};t.datavisualization.Diagram.CommandDefaults={gesture:t.datavisualization.Diagram.Gesture(),execute:null,canExecute:null,parameter:null};t.datavisualization.Diagram.Command=function(i){return i.gesture&&(i.gesture=t.datavisualization.Diagram.Gesture(i.gesture)),i.canExecute||(i.canExecute=function(){return!0}),i.execute||(i.execute=function(){}),n.extend(!0,{},t.datavisualization.Diagram.CommandDefaults,i)};t.datavisualization.Diagram.TooltipDefaults={templateId:"",relativeMode:"object",alignment:{horizontal:"center",vertical:"bottom"},margin:{left:5,right:5,top:5,bottom:5},offset:null,delay:0};t.datavisualization.Diagram.Tooltip=function(i){return n.extend(!0,{},t.datavisualization.Diagram.TooltipDefaults,i)};t.datavisualization.Diagram.BackgroundImageDefaults={source:"",alignment:"xmidymid",scale:"meet"};t.datavisualization.Diagram.BackgroundImage=function(i){return n.extend(!0,{},t.datavisualization.Diagram.BackgroundImageDefaults,i)};t.datavisualization.Diagram.Path=function(){this._path=""};t.datavisualization.Diagram.Path.prototype={moveTo:function(n,t){return this._path+="M"+n+","+t,this},lineTo:function(n,t){return this._path+="L"+n+","+t,this},cubicBezierTo:function(n,t){return this._path+=t?"S":"C",this._addPoints(n),this},quadraticBezierTo:function(n,t){return this._path+=t?"T":"Q",this._addPoints(n),this},ellipticalArcTo:function(n,t,i,r,u,f,e){return this._path+="A"+n+","+t+" "+i+" "+r+","+u+" "+f+","+e,this},close:function(){return this._path+="Z",this},toString:function(){return this._path},_addPoints:function(n){for(var i,t=0;t<n.length;t++)i=n[t],this._path+=i.x+", "+i.y,t!==n.length-1&&(this._path+=" ")}};t.datavisualization.Diagram.DecoratorDefaults={shape:t.datavisualization.Diagram.DecoratorShapes.Arrow,width:8,height:8,borderColor:"black",borderWidth:1,fillColor:"black",pathData:"",cssClass:""};t.datavisualization.Diagram.Decorator=function(i){return n.extend(!0,{},t.datavisualization.Diagram.DecoratorDefaults,i)};t.datavisualization.Diagram.TextBlockDefaults={readOnly:!1,bold:!1,italic:!1,text:"",textDecoration:t.datavisualization.Diagram.TextDecorations.None,fontSize:12,fontFamily:"Arial",fontColor:"black",boundaryConstraints:!0,segmentOffset:.5,offset:t.datavisualization.Diagram.Point(.5,.5),textAlign:t.datavisualization.Diagram.TextAlign.Center,alignment:t.datavisualization.Diagram.Alignment.Center,relativeMode:t.datavisualization.Diagram.LabelRelativeMode.SegmentPath,horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Center,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Center,wrapping:t.datavisualization.Diagram.TextWrapping.WrapWithOverflow,margin:t.datavisualization.Diagram.Margin(),textOverflow:!1,overflowType:t.datavisualization.Diagram.OverflowType.Ellipsis,mode:t.datavisualization.Diagram.LabelEditMode.Edit,width:50,rotateAngle:0,opacity:1,templateId:"",templateType:"html"};t.datavisualization.Diagram.TextBlock=function(i){return i.wrapText!==undefined&&(i.wrapping=i.wrapText?"wrapwithoverflow":"nowrap"),n.extend(!0,{},t.datavisualization.Diagram.TextBlockDefaults,i)};t.datavisualization.Diagram.LabelDefaults=n.extend(!0,{},t.datavisualization.Diagram.TextBlockDefaults,{name:"",visible:!0,borderColor:"transparent",borderWidth:0,fillColor:"transparent",cssClass:"",hyperlink:""});t.datavisualization.Diagram.Label=function(i){var r=n.extend(!0,{},t.datavisualization.Diagram.LabelDefaults,i);return r.name||(r.name="label_"+t.datavisualization.Diagram.Util.randomId()),r};t.datavisualization.Diagram.ExportSettingsDefaults={multiplePage:!1,pageWidth:null,pageHeight:null,pageOrientation:"portrait",stretch:"none"};t.datavisualization.Diagram.ExportSettings=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ExportSettingsDefaults,i)};t.datavisualization.Diagram.PrintSettingsDefaults={multiplePage:!1,pageWidth:null,pageHeight:null,pageOrientation:"portrait",margin:{left:0,top:0,right:0,bottom:0},region:"pageSettings"};t.datavisualization.Diagram.PrintSettings=function(i){return n.extend(!0,{},t.datavisualization.Diagram.PrintSettingsDefaults,i)};t.datavisualization.Diagram.IconDefaults={shape:t.datavisualization.Diagram.IconShapes.None,width:15,height:15,offset:{x:.5,y:1},borderColor:"#1a1a1a",borderWidth:1,margin:t.datavisualization.Diagram.Margin(),horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Center,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Center,cornerRadius:0,fillColor:"white",source:"",pathData:"",templateId:""};t.datavisualization.Diagram.expandIcon=function(i){return n.extend(!0,{},t.datavisualization.Diagram.IconDefaults,i)};t.datavisualization.Diagram.collapseIcon=function(i){return n.extend(!0,{},t.datavisualization.Diagram.IconDefaults,i)};t.datavisualization.Diagram.PortDefaults={name:"",visibility:t.datavisualization.Diagram.PortVisibility.Default,constraints:t.datavisualization.Diagram.PortConstraints.Connect,size:8,offset:t.datavisualization.Diagram.Point(0,0),borderColor:"#1a1a1a",borderWidth:1,fillColor:"white",shape:t.datavisualization.Diagram.PortShapes.Square,pathData:"",connectorPadding:0,cssClass:"",margin:t.datavisualization.Diagram.Margin()};t.datavisualization.Diagram.ShadowDefaults={distance:5,angle:45,opacity:.7};t.datavisualization.Diagram.Shadow=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ShadowDefaults,i)};t.datavisualization.Diagram.Port=function(i){var r=n.extend(!0,{},t.datavisualization.Diagram.PortDefaults,i);return r.name||(r.name="port_"+t.datavisualization.Diagram.Util.randomId()),r};t.datavisualization.Diagram.StopDefaults={color:"",offset:0,opacity:1};t.datavisualization.Diagram.Stop=function(i){return n.extend(!0,{},t.datavisualization.Diagram.StopDefaults,i)};t.datavisualization.Diagram.LinearGradientDefaults={type:"linear",x1:0,x2:0,y1:0,y2:0,stops:[]};t.datavisualization.Diagram.LinearGradient=function(i){for(var r=0;i.stops&&r<i.stops.length;r++)i.stops[r]=t.datavisualization.Diagram.Stop(i.stops[r]);return n.extend(!0,{},t.datavisualization.Diagram.LinearGradientDefaults,i)};t.datavisualization.Diagram.RadialGradientDefaults={type:"radial",cx:0,cy:0,fx:0,fy:0,r:50,stops:[]};t.datavisualization.Diagram.RadialGradient=function(i){for(var r=0;r<i.stops.length;r++)i.stops[r]=t.datavisualization.Diagram.Stop(i.stops[r]);return n.extend(!0,{},t.datavisualization.Diagram.RadialGradientDefaults,i)};t.datavisualization.Diagram.NodeBaseDefaults={name:"",width:0,height:0,offsetX:0,offsetY:0,visible:!0,zOrder:-1,excludeFromLayout:!1,constraints:t.datavisualization.Diagram.NodeConstraints.Default,parent:"",labels:[],expandIcon:{shape:t.datavisualization.Diagram.IconShapes.None,width:13,height:10,margin:t.datavisualization.Diagram.Margin(),offset:{x:.5,y:1},borderColor:"#1a1a1a",borderWidth:1,cornerRadius:0,fillColor:"black",pathData:"",templateId:""},collapseIcon:{shape:t.datavisualization.Diagram.IconShapes.None,width:13,height:10,margin:t.datavisualization.Diagram.Margin(),offset:{x:.5,y:1},borderColor:"#1a1a1a",borderWidth:1,cornerRadius:0,fillColor:"black",pathData:"",templateId:""},ports:[],inEdges:[],outEdges:[],rotateAngle:0,pivot:t.datavisualization.Diagram.Point(.5,.5),addInfo:{},marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,horizontalAlign:t.datavisualization.Diagram.HorizontalAlignment.Left,verticalAlign:t.datavisualization.Diagram.VerticalAlignment.Top,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,connectorPadding:0,cornerRadius:0,paletteItem:null};t.datavisualization.Diagram.NodeBase=function(i){var r;if(i.expandIcon&&(i.expandIcon=t.datavisualization.Diagram.expandIcon(i.expandIcon?i.expandIcon:{})),i.collapseIcon&&(i.collapseIcon=t.datavisualization.Diagram.collapseIcon(i.collapseIcon?i.collapseIcon:{})),i.labels)for(r=0;r<i.labels.length;r++)i.labels[r]=t.datavisualization.Diagram.Label(i.labels[r]);if(i.ports)for(r=0;r<i.ports.length;r++)i.ports[r]=t.datavisualization.Diagram.Port(i.ports[r]);return i.paletteItem=t.datavisualization.Diagram.PaletteItem(i.paletteItem?i.paletteItem:{}),n.extend(!0,{},t.datavisualization.Diagram.NodeBaseDefaults,i)};t.datavisualization.Diagram.NodeDefaults={fillColor:"white",borderColor:"black",borderWidth:1,borderDashArray:"",opacity:1,gradient:null,type:t.datavisualization.Diagram.Shapes.Basic,isExpanded:!0,shadow:t.datavisualization.Diagram.Shadow(),cssClass:""};t.datavisualization.Diagram.Node=function(i){return i=i||{},i.container&&n.isEmptyObject(i.container)&&(i.container=null),(i.linearGradient||i.radialGradient)&&(i.gradient=i.linearGradient||i.radialGradient),i.gradient&&(i.gradient.type==="linear"?i.gradient=t.datavisualization.Diagram.LinearGradient(i.gradient):i.gradient.type==="radial"&&(i.gradient=t.datavisualization.Diagram.RadialGradient(i.gradient))),i.shadow&&(i.shadow=t.datavisualization.Diagram.Shadow(i.shadow)),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i&&!i.name&&(i.name="node_"+t.datavisualization.Diagram.Util.randomId()),i.minWidth=i.minWidth?i.minWidth:0,i.minHeight=i.minHeight?i.minHeight:0,i.maxWidth=i.maxWidth?i.maxWidth:0,i.maxHeight=i.maxHeight?i.maxHeight:0,i.width||i._width||(i._width=i.minWidth?i.minWidth:i.maxWidth),i.height||i._height||(i._height=i.minHeight?i.minHeight:i.maxHeight),i._hidePorts&&(i.ports=[]),n.extend(!0,{},t.datavisualization.Diagram.NodeDefaults,t.datavisualization.Diagram.NodeBase(i),t.datavisualization.Diagram.Shape(i))};t.datavisualization.Diagram.ConnectorDefaults={name:"",visible:!0,lineDashArray:"",targetDecorator:{shape:t.datavisualization.Diagram.DecoratorShapes.Arrow,width:8,height:8,borderColor:"black",fillColor:"black",pathData:""},sourceDecorator:{shape:t.datavisualization.Diagram.DecoratorShapes.Arrow,width:8,height:8,borderColor:"black",fillColor:"black",pathData:""},shape:undefined,segments:[t.datavisualization.Diagram.Segment({type:"straight"})],sourcePoint:t.datavisualization.Diagram.Point(),targetPoint:t.datavisualization.Diagram.Point(),lineColor:"black",lineWidth:1,constraints:t.datavisualization.Diagram.ConnectorConstraints.Default,opacity:1,parent:"",labels:[],zOrder:-1,lineHitPadding:10,addInfo:{},targetNode:null,targetPort:null,sourceNode:null,sourcePort:null,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,horizontalAlign:t.datavisualization.Diagram.HorizontalAlignment.Left,verticalAlign:t.datavisualization.Diagram.VerticalAlignment.Top,cornerRadius:0,bridgeSpace:10,sourcePadding:0,targetPadding:0,type:"connector",cssClass:""};t.datavisualization.Diagram.Connector=function(i){if(i=i||{},i.name=i.name?i.name:t.datavisualization.Diagram.Util.randomId(),i.targetDecorator=t.datavisualization.Diagram.Decorator(i.targetDecorator||{}),i.sourceDecorator=t.datavisualization.Diagram.Decorator(i.sourceDecorator&&!n.isEmptyObject(i.sourceDecorator)?i.sourceDecorator:{shape:t.datavisualization.Diagram.DecoratorShapes.None}),i.segments=i.segments||[t.datavisualization.Diagram.Segment({type:"straight"})],i._srcDecoratorSize=Math.max(parseInt(i.sourceDecorator.height),parseInt(i.sourceDecorator.width))+5*i.sourceDecorator.borderWidth,i._tarDecoratorSize=Math.max(parseInt(i.targetDecorator.height),parseInt(i.targetDecorator.width))+5*i.targetDecorator.borderWidth,i._inlineDecorators=[],i.segments&&(i.sourcePoint=i.sourcePoint||t.datavisualization.Diagram.Point(),i.targetPoint=i.targetPoint||t.datavisualization.Diagram.Point(),t.datavisualization.Diagram.Util._initializeSegments(i,i.defaultType)),i.labels)for(var r=0;r<i.labels.length;r++)i.labels[r]=t.datavisualization.Diagram.Label(i.labels[r]);return i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i.paletteItem=t.datavisualization.Diagram.PaletteItem(i.paletteItem?i.paletteItem:{}),n.extend(!0,{},t.datavisualization.Diagram.ConnectorDefaults,i)};t.datavisualization.Diagram.ContainerDefaults={type:t.datavisualization.Diagram.ContainerType.Canvas,orientation:"vertical"};t.datavisualization.Diagram.Container=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ContainerDefaults,i)};t.datavisualization.Diagram.GroupDefaults={children:[],canUngroup:!0,allowDrop:!0,container:null,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,minWidth:100,maxWidth:Number.POSITIVE_INFINITY,minHeight:100,maxHeight:Number.POSITIVE_INFINITY,type:"group"};t.datavisualization.Diagram.Group=function(i){return i=i?i:{},i.type=="bpmn"&&(i=t.datavisualization.Diagram.Node(i)),i.minWidth=i.minWidth?i.minWidth:100,i.minHeight=i.minHeight?i.minHeight:100,i.maxWidth=i.maxWidth?i.maxWidth:Number.POSITIVE_INFINITY,i.maxHeight=i.maxHeight?i.maxHeight:Number.POSITIVE_INFINITY,i.container=i.container?t.datavisualization.Diagram.Container(i.container):null,i.fillColor=i.fillColor?i.fillColor:"transparent",i.borderColor=i.borderColor?i.borderColor:"transparent",i&&!i.name&&(i.name="group_"+t.datavisualization.Diagram.Util.randomId()),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i._type||i.type=="umlclassifier"||(i._type=i.type?i.type:"group"),n.extend(!0,{},t.datavisualization.Diagram.NodeDefaults,t.datavisualization.Diagram.GroupDefaults,t.datavisualization.Diagram.NodeBase(i))};t.datavisualization.Diagram.ZoomCommand={ZoomIn:1,ZoomOut:2};t.datavisualization.Diagram.Zoom=function(i){return n.extend(!0,{},{zoomFactor:.2,focusPoint:null,zoomCommand:t.datavisualization.Diagram.ZoomCommand.ZoomIn},i)};t.datavisualization.Diagram.DragState={Starting:"starting",Dragging:"dragging",Completed:"completed"};t.datavisualization.Diagram.ResizeState={Starting:"starting",Resizing:"resizing",Completed:"completed"};t.datavisualization.Diagram.DiagramConstraints={None:1,UserInteraction:2,APIUpdate:4,PageEditable:6,Bridging:8,Zoomable:16,PannableX:32,PannableY:64,Pannable:96,Undoable:128,Resizable:256,ZoomTextEditor:512,FloatElements:1024,CrispEdges:2048,Default:502};t.datavisualization.Diagram.BridgeDirection={Top:"top",Bottom:"bottom",Left:"left",Right:"right"};t.datavisualization.Diagram.Tool={None:1,SingleSelect:2,MultipleSelect:4,ZoomPan:8,DrawOnce:16,ContinuesDraw:32};t.datavisualization.Diagram.Region={Content:"content",PageSettings:"pageSettings"};t.datavisualization.Diagram.FileFormats={JPG:"jpg",PNG:"png",BMP:"bmp",SVG:"svg"};t.datavisualization.Diagram.ExportModes={Download:"download",Data:"data"};t.datavisualization.Diagram.FitMode={Page:"page",Width:"width",Height:"height"};t.datavisualization.Diagram.Stretch={None:"none",Fill:"fill",Uniform:"uniform",UniformToFill:"uniformtofill"};t.datavisualization.Diagram.shapeType={Image:"image",Path:"path",Native:"native"};t.datavisualization.Diagram.UserHandleDefaults={name:"",pathData:"",templateId:"",source:"",shape:t.datavisualization.Diagram.shapeType.Path,borderColor:"",backgroundColor:"#2382c3",position:t.datavisualization.Diagram.UserHandlePositions.BottomCenter,pathColor:"white",tool:"",size:20,visible:!0,enableMultiSelection:!1};t.datavisualization.Diagram.UserHandle=function(i){return n.extend(!0,{},t.datavisualization.Diagram.UserHandleDefaults,i)};t.datavisualization.Diagram.SwimLaneDefaults={header:n.extend(!0,{},t.datavisualization.Diagram.LabelDefaults,{text:"Title",borderColor:"black",fillColor:"#C7D4DF",horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Stretch,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Stretch}),fillColor:"transparent",orientation:"vertical",type:"group",isSwimlane:!0,offsetX:100,offsetY:100,minHeight:100,maxHeight:Number.POSITIVE_INFINITY,minWidth:100,maxWidth:Number.POSITIVE_INFINITY,height:100,width:100,lanes:[],phases:[],phaseSize:20,constraints:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~(t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest),addInfo:{},cssClass:""};t.datavisualization.Diagram.SwimLane=function(i){return i=i||{},i&&!i.name&&(i.name="swimlane_"+t.datavisualization.Diagram.Util.randomId()),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),i.header||(i.header={}),i.header.height=i.header.height?i.header.height:50,i.header.width=i.header.width?i.header.width:50,n.extend(!0,{},t.datavisualization.Diagram.SwimLaneDefaults,i)};t.datavisualization.Diagram.LaneDefaults={header:n.extend(!0,{},t.datavisualization.Diagram.LabelDefaults,{text:"Function",borderColor:"black",fillColor:"#C7D4DF",horizontalAlignment:t.datavisualization.Diagram.HorizontalAlignment.Stretch,verticalAlignment:t.datavisualization.Diagram.VerticalAlignment.Stretch}),name:"",children:[],isLane:!0,orientation:"horizontal",fillColor:"#f5f5f5",labels:[],addInfo:{},minHeight:100,minWidth:100,maxHeight:Number.POSITIVE_INFINITY,maxWidth:Number.POSITIVE_INFINITY,constraints:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,cssClass:""};t.datavisualization.Diagram.Lane=function(i){return i=i||{},i&&!i.name&&(i.name="lane_"+t.datavisualization.Diagram.Util.randomId()),i.tooltip&&(i.tooltip=t.datavisualization.Diagram.Tooltip(i.tooltip)),n.extend(!0,{},t.datavisualization.Diagram.LaneDefaults,i)};t.datavisualization.Diagram.PhaseDefaults={name:"",type:"phase",offset:100,lineWidth:1,lineDashArray:"3,3",lineColor:"#606060",parent:"",fillColor:"white",orientation:"horizontal",label:{text:"Phase"}};t.datavisualization.Diagram.Phase=function(i){return i.label&&(i.label=t.datavisualization.Diagram.Label(i.label),i.label.text=i.label.text?i.label.text:"Phase"),n.extend(!0,{},t.datavisualization.Diagram.PhaseDefaults,i)};t.datavisualization.Diagram.PaletteItemDefaults={width:undefined,height:undefined,enableScale:!0,previewHeight:undefined,previewWidth:undefined,wrapping:t.datavisualization.Diagram.TextWrapping.NoWrap,label:null,margin:t.datavisualization.Diagram.Margin({left:4,right:4,top:4,bottom:4})};t.datavisualization.Diagram.PaletteItem=function(i){return n.extend(!0,{},t.datavisualization.Diagram.PaletteItemDefaults,i)};t.datavisualization.Diagram.SwimLaneHelper={_initSwimLane:function(i,r,u){var f=null,b=null,i=t.datavisualization.Diagram.SwimLane(i),k,s,e,a,v,o;i.orientation=i.orientation?i.orientation:"vertical";k=this._initphases(i,r);b=this._initLanes(i,r,u);s=[];e=null;i.header||(i.header={text:"",height:0,fillColor:"white"});i.orientation==="horizontal"?a=i.header.height:v=i.header.width;i.header&&(e=t.datavisualization.Diagram.Node({_type:"node",_isHeader:!0,name:i.name+"_header_swimlane",labels:[i.header],height:a?a:50,width:v?v:50,fillColor:i.header.fillColor?i.header.fillColor:"white",rotateAngle:0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,horizontalAlign:"stretch",parent:i.name}));e&&(r.nodes().push(e),r._nodes=n.extend(!0,[],r.nodes()),r.nameTable[e.name]=e,s.push(e.name));o=null;o=i.phaseSize==0?.001:i.phaseSize?i.phaseSize:20;var tt=this._initPhaseStack(i,r,s,o),g=null,nt=null;i.orientation=="vertical"?nt="stretch":g="stretch";var y,d=0,p=0,w=0;i.orientation=="horizontal"?(y="vertical",p=(i.header?i.header.height:50)+o,w=0):(y="horizontal",p=i.header?i.header.height:50,d=i.phaseSize?i.phaseSize:o,w=(i.header?i.header.height:50)+o);var h=t.datavisualization.Diagram.Group({name:i.name+"_stack",children:b,parent:i.name,container:{type:t.datavisualization.Diagram.ContainerType.Stack,orientation:y},horizontalAlign:"stretch",verticalAlign:"stretch",marginTop:p,width:10,height:10,marginLeft:d,minHeight:w,constraints:t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Select|t.datavisualization.Diagram.NodeConstraints.Connect)}),c=0,l=0;return i.orientation=="horizontal"?(c=i.width,l=100):i.orientation=="vertical"&&(c=100,l=i.height-e.height),r.nodes().push(h),r._nodes=n.extend(!0,[],r.nodes()),r.nameTable[h.name]=h,s.push(h.name),f=t.datavisualization.Diagram.Group({name:i.name?i.name:"",type:"group",addInfo:i.addInfo?i.addInfo:{},parent:"",offsetX:i.offsetX?i.offsetX:100,offsetY:i.offsetY?i.offsetY:100,children:s,zOrder:i.zOrder||i.zOrder===0?i.zOrder:-1,fillColor:"transparent",labels:[{mode:t.datavisualization.Diagram.LabelEditMode.View}],container:{type:t.datavisualization.Diagram.ContainerType.Canvas},minHeight:l?l:100,maxHeight:i.maxHeight?i.maxHeight:Number.POSITIVE_INFINITY,minWidth:c?c:100,maxWidth:i.maxWidth?i.maxWidth:Number.POSITIVE_INFINITY,constraints:i.constraints?i.constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.AllowDrop^t.datavisualization.Diagram.NodeConstraints.ResizeNorth^t.datavisualization.Diagram.NodeConstraints.ResizeWest^t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest^t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast^t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest,phaseSize:o,cssClass:i.cssClass}),f.isSwimlane=!0,f.phases=k,f.orientation=i.orientation,f.constraints=f.orientation=="horizontal"?f.constraints^t.datavisualization.Diagram.NodeConstraints.ResizeEast^t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast:f.constraints^t.datavisualization.Diagram.NodeConstraints.ResizeSouth^t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast,f},_initPhaseStack:function(i,r,u,f){var c="horizontal",y="left",p="top",l,h,v,e,o;c&&(i.orientation=="horizontal"?(c="horizontal",y="stretch",l=!0):(c="vertical",p="stretch",l=!1));var s=t.datavisualization.Diagram.Group({name:i.name+"phaseStack",container:{type:"stack",orientation:c},type:"group",parent:i.name,offsetX:0,offsetY:0,minHeight:f,maxHeight:f,minWidth:f,maxWidth:f,marginTop:i.header?i.header.height:50,isPhaseStack:!0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect}),a=0;for(i.phaseSize&&(i.phaseSize=i.phaseSize<1?20:i.phaseSize),e=0;e<i.phases.length;e++)l?(h=i.phaseSize?i.phaseSize:20,v=i.phases[e].offset-a):(h=i.phases[e].offset-a,e==0&&(h=h-(i.header?i.header.height:50)),v=i.phaseSize?i.phaseSize:20,i.phases[e].label&&(i.phases[e].label.rotateAngle=270)),o=t.datavisualization.Diagram.Node({parent:i.name+"phaseStack",_isHeader:!0,name:"phaseStack"+i.phases[e].name,height:h,width:v,labels:[i.phases[e].label],constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect}),o.labels[0].name="phaseStack"+i.phases[e].name+"label",o.labels[0].mode=t.datavisualization.Diagram.LabelEditMode.View,o.isPhase=!0,a=i.phases[e].offset,r.nameTable[o.name]=o,s.children.push(o.name),r.nodes().push(o),r._nodes=n.extend(!0,[],r.nodes());r.nodes().push(s);r._nodes=n.extend(!0,[],r.nodes());u.push(s);r.nameTable[s.name]=s},_setDefaultLaneProperties:function(n){n.lanes=n.lanes?n.lanes:[];n.lanes.push(t.datavisualization.Diagram.Lane({}))},_initLanes:function(i,r,u){var o=[],e=null,f;if(i.lanes&&i.lanes.length!==0||this._setDefaultLaneProperties(i),i.lanes)for(f=0;f<i.lanes.length;f++)jQuery.isEmptyObject(i.lanes[f])&&(i.lanes[f]=t.datavisualization.Diagram.Lane()),i.lanes[f]._laneHeader=i.lanes[f]._laneHeader?i.lanes[f]._laneHeader:i.lanes[f].header,e=this._initLane(i.lanes[f],i,r,u),o.push(e.name),r.nodes().push(e),r._nodes=n.extend(!0,[],r.nodes()),r.nameTable[e.name]=e;return o},_initLane:function(i,r,u,f){var c=null,l=null,y,e,s,v,o,a,h;if(r.orientation=="horizontal"?c="stretch":l="stretch",y=!1,e=t.datavisualization.Diagram.Group({name:i.name,addInfo:i.addInfo?i.addInfo:{},type:"group",isLane:!0,parent:r.name+"_stack",offsetX:0,offsetY:0,borderColor:i.borderColor?i.borderColor:"black",orientation:r.orientation?r.orientation:"horizontal",fillColor:i.fillColor,container:{type:t.datavisualization.Diagram.ContainerType.Canvas},horizontalAlign:c?c:"left",verticalAlign:l?l:"top",minHeight:i.height?i.height:100,maxHeight:i.maxHeight?i.maxHeight:Number.POSITIVE_INFINITY,minWidth:i.width?i.width:100,maxWidth:i.maxWidth?i.maxWidth:Number.POSITIVE_INFINITY,paddingTop:20,paddingRight:20,paddingBottom:20,paddingLeft:20,constraints:i.constraints?i.constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,cssClass:i.cssClass}),i.labels&&i.labels.length>0){for(s=0;s<i.labels.length;s++)i.labels[s]=t.datavisualization.Diagram.Label(i.labels[s]);e.labels=i.labels}for(f||(v=i._laneHeader?i._laneHeader:null,o=this._iniLaneHeader(i,e.name,r,u,v),o&&(u.nodes().push(o),u._nodes=n.extend(!0,[],u.nodes()),u.nameTable[o.name]=o,e.children.push(o.name))),a=this._initChildren(i,e.name,u),h=0;h<a.length;h++)e.children.push(a[h]);return e},_iniLaneHeader:function(n,i,r,u,f){var e=null;return n.header&&(e=t.datavisualization.Diagram.Node({_isHeader:!0,name:i+"_Headerr_",type:"node",labels:[r.header],height:f.height?f.height:50,width:f.width?f.width:50,fillColor:n.header.fillColor?n.header.fillColor:"white",rotateAngle:0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,marginLeft:-20,marginTop:-20,marginRight:-20,marginBottom:-20,parent:i}),r.orientation&&r.orientation=="horizontal"?(e.verticalAlign="stretch",e.height=1,e.width=f.width?f.width:50):r.orientation&&r.orientation=="vertical"&&(e.horizontalAlign="stretch",e.labels[0].rotateAngle=0,e.height=f.width?f.width:50,e.width=1)),e},_initChildren:function(t,i,r){var o=[],u=null,f,e;if(t.children)for(f=0;f<t.children.length;f++)u=typeof t.children[f]=="object"?t.type&&t.type==="bpmn"?t.children[f]:this._initChild(t.children[f],i,r):r.nameTable[t.children[f]],u&&(u.segments?(r.connectors().push(u),r._connectors=n.extend(!0,[],r.connectors())):(u.children&&(e=this._initChildren(u,u.name,r)),e&&(u.children=e),r.nodes().push(u),r._nodes=n.extend(!0,[],r.nodes())),o.push(u.name),r.nameTable[u.name]=u);return o},_initChild:function(n,i,r){var u=null;return u=n&&n.children&&n.children.length>0?r._getNewGroup(t.datavisualization.Diagram.NodeType(n,r)):r._getNewNode(t.datavisualization.Diagram.NodeType(n,r)),u.parent=i,u},_swapPhaseSize:function(n){if(n.phases.length>0)for(var i=n.phases,t,u,r=0;r<i.length;r++)for(t=0;t<i.length-r-1;t++)i[t].offset>i[t+1].offset&&(u=i[t],i[t]=i[t+1],i[t+1]=u)},_setSwimlaneSize:function(n){var t,i;if(n.phases.length>0)for(i in n.phases)t=n.phases[i],n.orientation==="horizontal"?t.offset>n.width&&(n.width=t.offset):t.offset>n.height&&(n.height=t.offset)},_setLastPhaseSize:function(n){if(n.phases.length>0){var t=n.phases[n.phases.length-1];t.offset=n.orientation==="horizontal"?n.width:n.height}},_NeedDefaultPhase:function(n){return n.phases.length>0?!1:!0},_checkForDefPhase:function(n){return n.phases.length>0?!1:!0},_initphases:function(n,i){var e=[],r=null,o=0,f=0,s,u;if(n.orientation==="vertical"?(f=n.height,o=270):f=n.width,s=t.datavisualization.Diagram.Phase({name:n.name+"defPhase",offset:f,label:n._lastPhase?n._lastPhase.labels[0]:{text:"Phase",rotateAngle:o}}),this._NeedDefaultPhase(n)?n.phases.push(s):(this._swapPhaseSize(n),this._setSwimlaneSize(n),this._setLastPhaseSize(n)),n.phases&&n.phases.length>0)for(u=0;u<n.phases.length;u++)r=t.datavisualization.Diagram.Phase(n.phases[u]),r.parent=n.name,r.orientation=n.orientation,i.nameTable[r.name]=r,e.push(r.name);return e},_createSwimlane:function(n,i,r,u,f){var l=[],a=r?r.childTable:i.nameTable,o=500,s=500,h=null,p=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,e,c,v,y;return n.children[0]?(e=u?n.children[0]:a[n.children[0]],e||(e=f),typeof e=="string"&&(e=a[e]),h={text:"Title",width:50,fillColor:e.fillColor?e.fillColor:n.fillColor,height:50}):h={text:"Title",width:50,fillColor:"white",height:50},n.orientation||n.container&&(n.orientation=n.container.orientation),c=0,n.orientation=="horizontal"&&i._selectedSymbol?(o=n.height?n.height:100,s=n.width?n.width:650,c=o):(o=n.height?n.height:650,s=n.width?n.width:100,c=n.height+h.height),n.children.length>1&&(n.children.splice(0,0),l=n.children),v={name:n.name+t.datavisualization.Diagram.Util.randomId(),header:h,fillColor:"white",isSwimlane:!0,minWidth:s,minHeight:o,height:c+1,width:s+1,maxHeight:o+Number.POSITIVE_INFINITY,maxWidth:s+Number.POSITIVE_INFINITY,offsetX:n.offsetX,offsetY:n.offsetY,orientation:n.orientation?n.orientation:"horizontal",addInfo:n.addInfo?n.addInfo:null,paletteItem:n.paletteItem?n.paletteItem:null,lanes:[{name:n.name,addInfo:n.addInfo?n.addInfo:{},constraints:p,header:{text:e.labels[0].text?e.labels[0].text:"HEADER",fontSize:e.labels[0].fontSize?e.labels[0].fontSize:11,width:e.width?e.width:50,height:e.height?e.height:50,fillColor:e.fillColor,bold:e.labels[0].bold?!0:!1,italic:e.labels[0].italic?!0:!1,fontFamily:e.labels[0].fontFamily?e.labels[0].fontFamily:"Arial",fontColor:e.labels[0].fontColor?e.labels[0].fontColor:"black"},fillColor:n.fillColor?n.fillColor:"white",height:o,width:s,minHeight:o,minWidth:s,children:l?l:[],_laneHeader:n._laneHeader?n._laneHeader:null},]},y=t.datavisualization.Diagram.ContainerHelper._initContainer(i,v),y},_createDiagramLane:function(n){var i=n._lane?n._lane:null,r=n.orientation,f=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,u={children:[{name:n.name+"_Headerr_",height:i.header?i.header.height:50,width:i.header?i.header.width:50,fillColor:i.header?i.header.fillColor:50,labels:i.header?[i.header]:[],horizontalAlign:r==="vertical"?"stretch":"left",verticalAlign:r==="vertical"?"top":"stretch"}],container:{type:"canvas"},name:n.name?n.name:t.datavisualization.Diagram.Util.randomId(),minHeight:i.minHeight?i.minHeight:100,minWidth:i.minWidth?i.minWidth:100,maxHeight:Number.POSITIVE_INFINITY,maxWidth:Number.POSITIVE_INFINITY,borderColor:"black",constraints:f|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,cssClass:i.cssClass?i.cssClass:"",addInfo:i.addInfo?i.addInfo:null,paletteItem:n.paletteItem?n.paletteItem:null,fillColor:i.fillColor?i.fillColor:"white",isLane:!0,offsetX:n.offsetX?n.offsetX:100,offsetY:n.offsetY?n.offsetY:100};return u.children[0].labels[0].rotateAngle=r==="horizontal"?270:0,u},_createPaletteLane:function(n,i){var r=0,u=0,f=0,e=0,l=0,a="left",c=0,v,y,h,s,o;return n=t.datavisualization.Diagram.Lane(n),v=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,!n.paletteItem||n.paletteItem.enableScale||n.paletteItem.width||n.orientation==="horizontal"&&(c+=2),n.orientation=="horizontal"?(r=n.height?n.height:50,u=25,f=14+c,e=r/2+1,l=270,a="left"):n.orientation=="vertical"&&(r=25,u=n.width?n.width:50,f=u/2,e=15,a="left"),y=n.header.text?n.header.text:"",h=t.datavisualization.Diagram.Node({name:n.name+"_"+y,_type:"node",labels:[{text:n.header.text?n.header.text:"Function",fontSize:n.header.fontSize?n.header.fontSize:11,offset:{x:.5,y:.5},width:100,rotateAngle:l}],height:r,width:u,fillColor:n.header.fillColor?n.header.fillColor:"white",parent:n.name,offsetX:f,offsetY:e,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Connect}),i[h.name]=h,n.orientation=="horizontal"?(r=n.height,u=n.width-25,f=25+u/2+c,e=r/2+1):n.orientation=="vertical"&&(r=n.height-25,u=n.width,f=u/2,e=25+r/2),s=t.datavisualization.Diagram.Node({name:n.name+"content",_type:"node",height:r,width:u,fillColor:n.fillColor?n.fillColor:"white",parent:n.name,offsetX:f,offsetY:e}),s._laneHeader=n.header,i[s.name]=s,o=t.datavisualization.Diagram.Group({name:n.name+"_group",addInfo:n.addInfo?n.addInfo:{},height:n.height,width:n.width,header:n.header?n.header:null,offsetX:n.offsetX,offsetY:n.offsetY,children:[h.name,s.name,],paletteItem:n.paletteItem?n.paletteItem:null}),o._lane=n,o.constraints=v,o.isLane=!0,o.orientation=n.orientation,o},_mapObject:function(n,t,i,r){var u;switch(i){case"lane":u=this._mapLane(n,t);break;case"phase":u=this._mapPhase(n,t);break;case"swimlane":u=this._mapSwimlane(n,t,r)}return u},_mapLane:function(n,i,r){var u=t.datavisualization.Diagram.Lane();return this._mapLaneHeader(n,i,u,r),this._mapChildren(n,i,u,r),u.name=i.name,u.labels=i.labels,u.fillColor=i.fillColor,u.orientation=i.orientation,u.maxHeight=i.maxHeight,u.maxWidth=i.maxWidth,u.minHeight=i.height>i.minHeight?i.height:i.minHeight,u.minWidth=i.width>i.minWidth?i.width:i.minWidth,u.constraints=i.constraints,u.addInfo=i.addInfo?i.addInfo:{},i.orientation==="horizontal"?(u.height=i.height,u.width=null):(u.height=null,u.width=i.width),u},_mapLaneHeader:function(n,t,i,r){var u;t.children[0]&&(u=n.nameTable[n._getChild(t.children[0])]);!u&&r&&(u=r[n._getChild(t.children[0])]);u&&(u.labels&&u.labels[0]&&(i.header.text=u.labels[0].text,i.header.fontColor=u.labels[0].fontColor,i.header.fontSize=u.labels[0].fontSize,i.header.fontFamily=u.labels[0].fontFamily,i.header.bold=u.labels[0].bold,i.header.italic=u.labels[0].italic,i.header.textDecoration=u.labels[0].textDecoration,i.header.rotateAngle=u.labels[0].rotateAngle,i.header.textOverflow=u.labels[0].textOverflow,i.header.overflowType=u.labels[0].overflowType),i.header.fillColor=u.fillColor,t.orientation==="vertical"?(i.header.height=u.height,i.header.width=null):(i.header.height=null,i.header.width=u.width))},_mapChildren:function(n,t,i,r){var u,f;if(t.children&&t.children.length>=2)for(f=1;f<t.children.length;f++)n._getChild(t.children[f])&&(u=n.nameTable[n._getChild(t.children[f])]),r&&!u&&(u=r[n._getChild(t.children[f])]),u&&(u.marginRight=0,u.marginBottom=0,i.children.push(u))},_mapSwimlane:function(n,i,r){var u=t.datavisualization.Diagram.SwimLane();return this._mapSwimlaneHeader(n,i,u,r),this._mapLanes(n,i,u,r),this._mapPhases(n,i,u,r),u.name=i.name,u.orientation=i.orientation,u.offsetX=i.offsetX,u.offsetY=i.offsetY,u.maxHeight=i.maxHeight,u.maxWidth=i.maxWidth,u.minHeight=i.minHeight,u.minWidth=i.minWidth,u.minWidth=u.orientation==="horizontal"?i.width&&i.minWidth&&i.width>i.minWidth?i.width:i.minWidth:i.minWidth,u.phaseSize=i.phaseSize,u.constraints=i.constraints,u.zOrder=i.zOrder,u.addInfo=i.addInfo?i.addInfo:{},u.height=i.height,u.width=i.width,u},_mapSwimlaneHeader:function(n,t,i,r){if(t.children[0])var u=n.nameTable[n._getChild(t.children[0])];!u&&r&&(u=r[n._getChild(t.children[0])]);u&&(u.labels&&u.labels[0]&&(i.header.text=u.labels[0].text,i.header.fontColor=u.labels[0].fontColor,i.header.fontSize=u.labels[0].fontSize,i.header.fontFamily=u.labels[0].fontFamily,i.header.bold=u.labels[0].bold,i.header.italic=u.labels[0].italic,i.header.textDecoration=u.labels[0].textDecoration,i.header.textOverflow=u.labels[0].textOverflow,i.header.overflowType=u.labels[0].overflowType),i.header.fillColor=u.fillColor,i.header.height=u.height,i.header.width=u.width)},_mapLanes:function(n,t,i,r){var u,e,o,f;if(t.children[2]&&n._getChild(t.children[2])&&(u=r?r[n._getChild(t.children[2])]:n.nameTable[n._getChild(t.children[2])]),u&&u.children&&u.children.length>0)for(f=0;f<u.children.length;f++)n._getChild(u.children[f])&&(e=r?r[n._getChild(u.children[f])]:n.nameTable[n._getChild(u.children[f])]),e&&(o=this._mapLane(n,e,r),o&&i.lanes.push(o))},_mapPhases:function(n,i,r,u){var f=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i,u),s,e,h,o,c;if(f&&f.length>0){for(s=f.length,e=u?u:n.nameTable,f[f.length-1]&&e[f[f.length-1]]&&(h=e[f[f.length-1]],h.name.split("defPhase").length>1||h.offset==i.width||s++),o=0;o<s;o++)c=this._mapPhase(n,e[n._getChild(f[o])],u),c&&r.phases.push(c);e["phaseStack"+f[f.length-1]]&&(r._lastPhase=this._mapPhase(n,e["phaseStack"+f[f.length-1]],u))}},_mapPhase:function(n,t,i){var r;return t&&(r=i?i[t.name]:n.nameTable[t.name]),r?r:null},_getSwimLaneNode:function(n,t,i,r){if(n.isSwimlane)if(i){if(r.nameTable[r._getChild(n.children[2])].container.orientation==t.orientation)return n}else if(r.nameTable[r._getChild(n.children[2])].container.orientation!=t.orientation)return n;if(n.parent){var u=r.nameTable[n.parent];if(u)return this._getSwimLaneNode(u,t,undefined,r)}return null}}}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.BasicShapes={Rectangle:"rectangle",Ellipse:"ellipse",Path:"path",Polygon:"polygon",Triangle:"triangle",Plus:"plus",Star:"star",Pentagon:"pentagon",Heptagon:"heptagon",Octagon:"octagon",Trapezoid:"trapezoid",Decagon:"decagon",RightTriangle:"righttriangle",Cylinder:"cylinder"};t.datavisualization.Diagram.FlowShapes={Process:"process",Decision:"decision",Document:"document",PreDefinedProcess:"predefinedprocess",Terminator:"terminator",PaperTap:"papertap",DirectData:"directdata",SequentialData:"sequentialdata",Sort:"sort",MultiDocument:"multidocument",Collate:"collate",SummingJunction:"summingjunction",Or:"or",InternalStorage:"internalstorage",Extract:"extract",ManualOperation:"manualoperation",Merge:"merge",OffPageReference:"offpagereference",SequentialAccessStorage:"sequentialaccessstorage",Annotation1:"annotation1",Annotation2:"annotation2",Data:"data",Card:"card"};t.datavisualization.Diagram.ArrowShapes={None:"none",CircularArrow:"circulararrow",CurvedRightArrow:"curvedrightarrow",CurvedUpArrow:"curveduparrow",CurvedLeftArrow:"curvedleftarrow",CurvedDownArrow:"curveddownarrow",JumpingRightArrow:"jumpingrightarrow",JumpingLeftArrow:"jumpingleftarrow"};t.datavisualization.Diagram.BPMNShapes={Event:"event",Gateway:"gateway",Message:"message",DataObject:"dataobject",DataSource:"datasource",Activity:"activity",Group:"group"};t.datavisualization.Diagram.BPMNEvents={Start:"start",Intermediate:"intermediate",End:"end",NonInterruptingStart:"noninterruptingstart",NonInterruptingIntermediate:"noninterruptingintermediate",ThrowingIntermediate:"throwingintermediate"};t.datavisualization.Diagram.BPMNTriggers={None:"none",Message:"message",Timer:"timer",Escalation:"escalation",Link:"link",Error:"error",Compensation:"compensation",Signal:"signal",Multiple:"multiple",Parallel:"parallel",Cancel:"cancel",Conditional:"conditional",Terminate:"terminate"};t.datavisualization.Diagram.BPMNGateways={None:"none",Exclusive:"exclusive",Inclusive:"inclusive",Parallel:"parallel",Complex:"complex",EventBased:"eventbased",ExclusiveEventBased:"exclusiveeventbased",ParallelEventBased:"paralleleventbased"};t.datavisualization.Diagram.BPMNDataObjects={None:"none",Input:"input",Output:"output"};t.datavisualization.Diagram.BPMNActivity={None:"none",Task:"task",SubProcess:"subprocess"};t.datavisualization.Diagram.BPMNLoops={None:"none",Standard:"standard",ParallelMultiInstance:"parallelmultiinstance",SequenceMultiInstance:"sequencemultiinstance"};t.datavisualization.Diagram.BPMNTasks={None:"none",Service:"service",Receive:"receive",Send:"send",InstantiatingReceive:"instantiatingreceive",Manual:"manual",BusinessRule:"businessrule",User:"user",Script:"script",Parallel:"parallel"};t.datavisualization.Diagram.BPMNSubProcessTypes={None:"none",Transaction:"transaction",Event:"event"};t.datavisualization.Diagram.BPMNBoundary={Default:"default",Call:"call",Event:"event"};t.datavisualization.Diagram.BPMNAnnotationDirections={Top:"top",Left:"left",Right:"right",Bottom:"bottom"};t.datavisualization.Diagram.BPMNFlows={Sequence:"sequence",Association:"association",Message:"message"};t.datavisualization.Diagram.BPMNSequenceFlows={Normal:"normal",Conditional:"conditional",Default:"default"};t.datavisualization.Diagram.BPMNMessageFlows={Default:"default",InitiatingMessage:"initiatingmessage",NonInitiatingMessage:"noninitiatingmessage"};t.datavisualization.Diagram.ClassifierShapes={Package:"package",Class:"class",Interface:"interface",Enumeration:"enumeration",CollapsedPackage:"collapsedpackage",Inheritance:"inheritance",Association:"association",Aggregation:"aggregation",Composition:"composition",Realization:"realization",DirectedAssociation:"directedassociation",Dependency:"dependency"};t.datavisualization.Diagram.AssociationFlows={Default:"default",Directional:"directional",BiDirectional:"bidirectional"};t.datavisualization.Diagram.UMLActivityShapes={Action:"action",Decision:"decision",MergeNode:"mergenode",InitialNode:"initialnode",FinalNode:"finalnode",ForkNode:"forknode",JoinNode:"joinnode",TimeEvent:"timeevent",AcceptingEvent:"acceptingevent",SendSignal:"sendsignal",ReceiveSignal:"receivesignal",StructuredNode:"structurednode",Note:"note"};t.datavisualization.Diagram.UMLActivityFlow={Object:"object",Control:"control",Exception:"exception"};t.datavisualization.Diagram.BPMNEventDefaults={event:t.datavisualization.Diagram.BPMNEvents.Start,trigger:t.datavisualization.Diagram.BPMNTriggers.None,name:null,offset:t.datavisualization.Diagram.Point()};t.datavisualization.Diagram.BPMNGatewayDefaults={gateway:t.datavisualization.Diagram.BPMNGateways.None};t.datavisualization.Diagram.BPMNDataObject=function(i){return n.extend(!0,{},{type:t.datavisualization.Diagram.BPMNDataObjects.None,collection:!1},i)};t.datavisualization.Diagram.BPMNDataObjectDefaults={data:t.datavisualization.Diagram.BPMNDataObject()};t.datavisualization.Diagram.BPMNTaskDefaults={loop:t.datavisualization.Diagram.BPMNLoops.None,type:t.datavisualization.Diagram.BPMNTasks.None,call:!1,compensation:!1,events:[]};t.datavisualization.Diagram.BPMNTask=function(i){return n.extend(!0,{},t.datavisualization.Diagram.BPMNTaskDefaults,i)};t.datavisualization.Diagram.BPMNSubProcessDefaults={type:t.datavisualization.Diagram.BPMNSubProcessTypes.None,event:t.datavisualization.Diagram.BPMNEvents.Start,trigger:t.datavisualization.Diagram.BPMNTriggers.Message,boundary:t.datavisualization.Diagram.BPMNBoundary.Default,loop:t.datavisualization.Diagram.BPMNLoops.None,adhoc:!1,compensation:!1,collapsed:!0,events:[],processes:[]};t.datavisualization.Diagram.BPMNSubProcess=function(i){return n.extend(!0,{},t.datavisualization.Diagram.BPMNSubProcessDefaults,i)};t.datavisualization.Diagram.BPMNActivityDefaults={activity:t.datavisualization.Diagram.BPMNActivity.Task,task:t.datavisualization.Diagram.BPMNTask(),subProcess:t.datavisualization.Diagram.BPMNSubProcess()};t.datavisualization.Diagram.BPMNTextAnnotationDefaults={annotation:{width:20,height:20,angle:0,length:0,text:"",direction:t.datavisualization.Diagram.BPMNAnnotationDirections.Left}};t.datavisualization.Diagram.ConnectorShapeDefaults={type:"bpmn",flow:t.datavisualization.Diagram.BPMNFlows.Sequence,sequence:t.datavisualization.Diagram.BPMNSequenceFlows.Normal,association:t.datavisualization.Diagram.AssociationFlows.Default,message:t.datavisualization.Diagram.BPMNMessageFlows.Default};t.datavisualization.Diagram.Multiplicity={OneToOne:"onetoone",OneToMany:"onetomany",ManyToOne:"manytoone",ManyToMany:"manytomany"};t.datavisualization.Diagram.ClassifierMultiplicityDefault={type:t.datavisualization.Diagram.Multiplicity.OneToOne,source:{optional:!0,lowerBounds:null,upperBounds:null},target:{optional:!0,lowerBounds:null,upperBounds:null}};t.datavisualization.Diagram.UMLActivityFlowDefaults={type:"umlactivity",activityFlow:t.datavisualization.Diagram.UMLActivityFlow.Control};t.datavisualization.Diagram.AssociationDefaults={type:"classifier",association:t.datavisualization.Diagram.AssociationFlows.BiDirectional,multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.AggregationDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.CompositionDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.DependencyDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.RealizationDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.InheritanceDefaults={type:"classifier",multiplicity:t.datavisualization.Diagram.ClassifierMultiplicityDefault};t.datavisualization.Diagram.ScopeValueDefaults={Public:"public",Protected:"",Private:"",Package:""};t.datavisualization.Diagram.ClassMemberDefaults={name:"",value:""};t.datavisualization.Diagram.ClassAttributeDefaults={name:"",type:"",scope:t.datavisualization.Diagram.ScopeValueDefaults.Public};t.datavisualization.Diagram.ClassMethodsArgumentsDefault={name:"",type:""};t.datavisualization.Diagram.ClassMethodsDefaults={name:"",type:"",arguments:t.datavisualization.Diagram.ClassMethodsArgumentsDefault,scope:t.datavisualization.Diagram.ScopeValueDefaults.Public};t.datavisualization.Diagram.ClassmethodArguments=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassMethodsArgumentsDefault,i)};t.datavisualization.Diagram.ClassMethod=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassMethodsDefaults,i)};t.datavisualization.Diagram.ClassMember=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassMemberDefaults,i)};t.datavisualization.Diagram.ClassAttribute=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassAttributeDefaults,i)};t.datavisualization.Diagram.ClassifierClass=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassDefaults,i)};t.datavisualization.Diagram.ClassifierInterface=function(i){return n.extend(!0,{},t.datavisualization.Diagram.InterfaceDefaults,i)};t.datavisualization.Diagram.ClassifierEnumeration=function(i){return n.extend(!0,{},t.datavisualization.Diagram.EnumerationDefaults,i)};t.datavisualization.Diagram.UMLConnector=function(i){return n.extend(!0,{},t.datavisualization.Diagram.UMLConnectorDefaults,i)};t.datavisualization.Diagram.UMLConnectorAssociation=function(i){return n.extend(!0,{},t.datavisualization.Diagram.AssociationDefaults,i)};t.datavisualization.Diagram.UMLConnectorAggregation=function(i){return n.extend(!0,{},t.datavisualization.Diagram.AggregationDefaults,i)};t.datavisualization.Diagram.UMLConnectorComposition=function(i){return n.extend(!0,{},t.datavisualization.Diagram.CompositionDefaults,i)};t.datavisualization.Diagram.UMLConnectorDependency=function(i){return n.extend(!0,{},t.datavisualization.Diagram.DependencyDefaults,i)};t.datavisualization.Diagram.UMLConnectorRealization=function(i){return n.extend(!0,{},t.datavisualization.Diagram.RealizationDefaults,i)};t.datavisualization.Diagram.UMLConnectorInheritance=function(i){return n.extend(!0,{},t.datavisualization.Diagram.InheritanceDefaults,i)};t.datavisualization.Diagram.UMLConnectorMultiplicity=function(i){return n.extend(!0,{},t.datavisualization.Diagram.ClassifierMultiplicityDefault,i)};t.datavisualization.Diagram.UMLActivityFlow=function(i){return n.extend(!0,{},t.datavisualization.Diagram.UMLActivityFlowDefaults,i)};t.datavisualization.Diagram.ClassDefaults={name:" ",attributes:[t.datavisualization.Diagram.ClassAttribute()],methods:[t.datavisualization.Diagram.ClassMethod()]};t.datavisualization.Diagram.InterfaceDefaults={name:" ",attributes:[t.datavisualization.Diagram.ClassAttribute()],methods:[t.datavisualization.Diagram.ClassMethod()]};t.datavisualization.Diagram.EnumerationDefaults={name:" ",members:[t.datavisualization.Diagram.ClassMember()]};t.datavisualization.Diagram.NodeType=function(i,r){if(!i._isInternalShape){var u=r.model.defaultSettings&&r.model.defaultSettings.node&&r.model.defaultSettings.node.type?r.model.defaultSettings.node.type:"",f=!i.isPhase&&r.model.defaultSettings&&r.model.defaultSettings.node?r.model.defaultSettings.node:{};i.type||i.children||i.isLane||i.isSwimlane||i.isPhase||i.isPhaseStack||(i.type=i.segments||i.sourceNode||i.sourcePort||i.sourcePoint||i.targetNode||i.targetPort||i.targetPoint?"connector":u?u:"basic");(i.isSwimlane||i.type=="swimlane")&&(i._type="group");(i.type=="basic"||i.type=="flow"||i.type=="arrow"||i.type=="bpmn"||i.type=="image"||i.type=="native"||i.type==="html"||i.type==="text"||i.type=="umlactivity")&&(r._isLoad&&(!r._isLoad||i._type)||(i._type="node"),i=n.extend(!0,{},f,i));r._isLoad||(i.type=="basic"?i=t.datavisualization.Diagram.BasicShape(i):i.type=="flow"?i=t.datavisualization.Diagram.FlowShape(i):i.type=="arrow"?i=t.datavisualization.Diagram.ArrowShape(i):i.type=="bpmn"?i=t.datavisualization.Diagram.BPMNShape(i):i.type=="umlclassifier"?i=t.datavisualization.Diagram.ClassifierShape(i,r):i.type=="umlactivity"&&(i=t.datavisualization.Diagram.UMLActivityShape(i,r)))}return i};t.datavisualization.Diagram.BasicShape=function(n){n._shape="path";n.shape||(n.shape="rectangle");switch(n.shape){case"rectangle":n._shape="rectangle";break;case"ellipse":n._shape="ellipse";break;case"path":n._shape="path";break;case"polygon":n._shape="polygon";break;case"triangle":n.pathData="M81.1582,85.8677L111.1582,33.9067L141.1582,85.8677L81.1582,85.8677z";break;case"plus":n.pathData="M696.6084,158.2656L674.8074,158.2656L674.8074,136.4656L658.4084,136.4656L658.4084,158.2656L636.6084,158.2656L636.6084,174.6646L658.4084,174.6646L658.4084,196.4656L674.8074,196.4656L674.8074,174.6646L696.6084,174.6646L696.6084,158.2656z";break;case"star":n.pathData="M540.3643,137.9336L546.7973,159.7016L570.3633,159.7296L550.7723,171.9366L558.9053,194.9966L540.3643,179.4996L521.8223,194.9966L529.9553,171.9366L510.3633,159.7296L533.9313,159.7016L540.3643,137.9336z";break;case"pentagon":n.pathData="M370.9702,194.9961L359.5112,159.7291L389.5112,137.9341L419.5112,159.7291L408.0522,194.9961L370.9702,194.9961z";break;case"heptagon":n.pathData="M223.7783,195.7134L207.1303,174.8364L213.0713,148.8034L237.1303,137.2174L261.1883,148.8034L267.1303,174.8364L250.4813,195.7134L223.7783,195.7134z";break;case"octagon":n.pathData="M98.7319,196.4653L81.1579,178.8923L81.1579,154.0393L98.7319,136.4653L123.5849,136.4653L141.1579,154.0393L141.1579,178.8923L123.5849,196.4653L98.7319,196.4653z";break;case"trapezoid":n.pathData="M127.2842,291.4492L95.0322,291.4492L81.1582,256.3152L141.1582,256.3152L127.2842,291.4492z";break;case"decagon":n.pathData="M657.3379,302.4141L642.3369,291.5161L636.6089,273.8821L642.3369,256.2481L657.3379,245.3511L675.8789,245.3511L690.8789,256.2481L696.6089,273.8821L690.8789,291.5161L675.8789,302.4141L657.3379,302.4141z";break;case"righttriangle":n.pathData="M836.293,292.9238L776.293,292.9238L776.293,254.8408L836.293,292.9238z";break;case"cylinder":n.pathData="M 542.802,362.009C 542.802,368.452 525.341,373.676 503.802,373.676C 482.263,373.676 464.802,368.452 464.802,362.009L 464.802,466.484C 464.802,472.928 482.263,478.151 503.802,478.151C 525.341,478.151 542.802,472.928 542.802,466.484L 542.802,362.016C 542.802,368.459 525.341,373.534 503.802,373.534C 482.263,373.534 464.802,368.31 464.802,361.867L 464.802,362.016C 464.802,355.572 482.263,350.349 503.802,350.349C 525.341,350.349 542.802,355.572 542.802,362.016"}return n};t.datavisualization.Diagram.FlowShape=function(n){n._shape="path";n.shape||(n.shape="process");var i=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default;n.constraints&t.datavisualization.Diagram.NodeConstraints.AspectRatio||(i=i|t.datavisualization.Diagram.NodeConstraints.AspectRatio);switch(n.shape){case"process":n.pathData="M419.511,76.687L359.511,76.687L359.511,43.086L419.511,43.086z";break;case"decision":n.pathData="M 253.005,115.687L 200.567,146.071L 148.097,115.687L 200.534,85.304L 253.005,115.687 Z";break;case"document":n.pathData="M 60 31.9 c 0 0 -11 -7.7 -30 0 s -30 0 -30 0 V 0 h 60 V 31.9 Z";break;case"predefinedprocess":n.pathData="M 0,0 L 50,0 L 50,50 L 0,50 Z M 8.333333333333334,0 L 8.333333333333334,50 M 41.66666666666667,0 L 41.66666666666667,50";break;case"terminator":n.pathData="M 269.711,29.3333C 269.711,44.061 257.772,56 243.044,56L 158.058,56C 143.33,56 131.391,44.061 131.391,29.3333L 131.391,29.3333C 131.391,14.6057 143.33,2.66669 158.058,2.66669L 243.044,2.66669C 257.772,2.66669 269.711,14.6057 269.711,29.3333 Z";break;case"papertap":n.pathData="M0.000976562,17.2042 L0.000976562,47.1654 C0.000976562,47.1654 14.403,53.5455 25.001,47.1654 C35.599,40.7852 44.403,43.5087 50.001,47.1654 L50.001,17.2042 M50.001,32.7987 L50.001,2.84052 C50.001,2.84052 35.599,-3.54271 25.001,2.84052 C14.403,9.22376 5.599,6.49418 0.000976562,2.84052 L0.000976562,32.7987";break;case"directdata":n.pathData="M 1477 613 L 1619 613 C 1627 613 1634 636 1634 665 C 1634 694 1627 717 1619 717 L 1477 717 C 1469 717 1461 694 1461 665 C 1461 636 1469 613 1477 613 ZM 1619 613 C 1610 613 1603 636 1603 665 C 1603 694 1610 717 1619 717M 1619 613 C 1610 613 1603 636 1603 665 C 1603 694 1610 717 1619 717";break;case"sequentialdata":n.pathData="M0.00297546,24.999 C0.00297546,11.1922 10.433,0.00216177 23.295,0.00216177 C36.159,0.00216177 46.585,11.1922 46.585,24.999 C46.585,38.8057 36.159,49.9979 23.295,49.9979 C10.433,49.9979 0.00297546,38.8057 0.00297546,24.999 z M23.294,49.999 L50.002,49.999";break;case"sort":n.pathData="M50.001,24.9971 L25.001,49.9971 L0.000976562,24.9971 L25.001,-0.00286865 L50.001,24.9971 z M0.000976562,24.9971 L50.001,24.9971";break;case"multidocument":n.pathData="M43.6826,40 C44.8746,40.6183 45.8586,41.3502 46.8366,42.1122 L46.8366,4.74487 L3.09857,4.74487 L3.09857,10.9544 M46.837,35.1437 C48.027,35.7653 49.025,36.6042 50.003,37.3695 L50.003,0.0021928 L6.26497,0.0021928 L6.26497,4.74451 M43.6826,47.1132 L43.6826,10.7652 L0.00257874,10.7652 L0.00257874,47.1132 C0.00257874,47.1132 12.5846,53.6101 21.8426,47.1132 C31.1006,40.6163 38.7926,43.3935 43.6826,47.1132 z";break;case"collate":n.pathData="M50.001,0.00286865 L25.001,25.0029 L0.000976562,0.00286865 L50.001,0.00286865 z M0.000976562,50.0029 L25.001,25.0029 L50.001,50.0029 L0.000976562,50.0029 z";break;case"summingjunction":n.constraints=i;n.pathData="M7.3252,42.6768 L42.6772,7.32477 M42.6768,42.6768 L7.3248,7.32477 M0.000976562,25.001 C0.000976562,11.193 11.197,0.000976562 25.001,0.000976562 C38.809,0.000976562 50.001,11.193 50.001,25.001 C50.001,38.809 38.809,50.001 25.001,50.001 C11.197,50.001 0.000976562,38.809 0.000976562,25.001 z";break;case"or":n.pathData="M 0 50 L 100 50 M 50 100 L 50 0.0 M 0 50 C 0 22.384 22.392 0 50 0 C 77.616 0 100 22.384 100 50 C 100 77.616 77.616 100 50 100 C 22.392 100 0 77.616 0 50 Z";break;case"internalstorage":n.pathData="M 0 3.8194444444444446A 2.5,3.8194444444444446 0 0,1 2.5,0L 47.5 0A 2.5,3.8194444444444446 0 0,1 50,3.8194444444444446L 50 45.833333333333336A 2.5,3.8194444444444446 0 0,1 47.5,49.65277777777778L 2.5 49.65277777777778A 2.5,3.8194444444444446 0 0,1 0,45.833333333333336L 0 3.8194444444444446ZM 0 11.458333333333334L 50 11.458333333333334M 12.5 0L 12.5 49.65277777777778";break;case"extract":n._shape="polygon";n.constraints=i;n.points=[{x:0,y:35},{x:30,y:0},{x:60,y:35}];break;case"manualoperation":n._shape="polygon";n.points=[{x:46.4,y:28.8},{x:14.8,y:28.8},{x:0,y:0},{x:60,y:0}];break;case"merge":n._shape="polygon";n.constraints=i;n.points=[{x:60,y:0},{x:30,y:35},{x:0,y:0}];break;case"offpagereference":n._shape="polygon";n.points=[{x:60,y:33.3},{x:30.1,y:39},{x:0,y:33.3},{x:0,y:0},{x:60,y:0}];break;case"sequentialaccessstorage":n.constraints=i;n.pathData="M 60 30 C 60 13.4 46.6 0 30 0 S 0 13.4 0 30 s 13.4 30 30 30 h 28.6 v -6.5 h -9.9 C 55.5 48 60 39.5 60 30 Z";break;case"annotation1":n.pathData="M49.9984,50.0029 L-0.00271199,50.0029 L-0.00271199,0.00286865 L49.9984,0.00286865";break;case"annotation2":n.pathData="M49.9977,50.0029 L25.416,50.0029 L25.416,0.00286865 L49.9977,0.00286865 M25.4166,25.0029 L-0.00227869,25.0029";break;case"card":n._shape="polygon";n.points=[{x:275,y:60},{x:400,y:60},{x:400,y:110},{x:260,y:110},{x:260,y:75}];break;case"data":n.pathData="M 10 0 L 40 0 L 30 40 L 0 40 Z "}return n};t.datavisualization.Diagram.ArrowShape=function(n){n._shape="path";n.shape||(n.shape="circulararrow");switch(n.shape){case"circulararrow":n.pathData="M433.4624,503.8848C429.4244,493.2388,419.1354,485.6678,407.0734,485.6678C391.4884,485.6678,378.8544,498.3018,378.8544,513.8868L384.4984,513.8868C384.4984,501.4178,394.6054,491.3108,407.0734,491.3108C415.9494,491.3108,423.6264,496.4338,427.3144,503.8848L422.9114,503.8848L426.8974,508.8848L430.8824,513.8868L434.8684,508.8848L438.8544,503.8848L433.4624,503.8848z";break;case"curvedrightarrow":n.pathData="M0.83006144,28.226993 C2.4030598,37.092016 9.5750604,44.49601 19.365042,48.044014 L19.365042,43.129004 25.376032,47.706001 31.386044,52.282999 25.376032,56.858988 19.365042,61.436991 19.365042,55.399027 C8.24608,51.372995 0.50004381,42.368995 0.50004357,31.905003 0.50004381,30.65601 0.6160717,29.429996 0.83006144,28.226993 z M31.402985,0.5 L31.402985,7.4419994 C15.834992,7.4419994 2.9619988,16.497999 0.81800008,28.275999 0.61199981,27.139999 0.49999988,25.981999 0.5,24.803999 0.49999988,11.379999 14.334993,0.5 31.402985,0.5 z";break;case"curveduparrow":n.pathData="M52.283021,0.51798058 L56.859025,6.5279841 61.436024,12.537989 55.399022,12.537989 C51.373021,23.656996 42.369015,31.403002 31.905011,31.403002 30.65601,31.403002 29.430011,31.288002 28.22701,31.073002 37.092015,29.500999 44.496018,22.328995 48.044018,12.537989 L43.129018,12.537989 47.706021,6.5279841 z M0.5,0.5 L7.4420163,0.5 C7.4420163,16.067989 16.497985,28.940971 28.276,31.083977 27.140013,31.290977 25.981993,31.402 24.804015,31.402 11.380005,31.402 0.5,17.567989 0.5,0.5 z";break;case"curvedleftarrow":n.pathData="M31.073116,28.227982 C31.287107,29.429977 31.403074,30.65599 31.403074,31.905989 31.403074,42.368966 23.657099,51.372959 12.538074,55.399935 L12.538074,61.436979 6.5270846,56.85898 0.51707193,52.282993 6.5270846,47.706976 12.538074,43.129983 12.538074,48.044958 C22.328056,44.496956 29.500118,37.091961 31.073116,28.227982 z M0.5,0.5 C17.568025,0.5 31.403045,11.380997 31.403045,24.803993 31.403045,25.981992 31.291046,27.139992 31.085045,28.276992 28.941042,16.497995 16.068023,7.442997 0.5,7.442997 z";break;case"curveddownarrow":n.pathData="M24.804015,0.50000453 C25.981993,0.50000453 27.140013,0.61301103 28.276,0.8180277 16.498045,2.9630154 7.4420161,15.836023 7.4420156,31.404005 L0.5,31.404005 C0.5,14.336024 11.380004,0.50000453 24.804015,0.50000453 z M31.90502,0.5 C42.369025,0.49999976 51.37303,8.2460016 55.399031,19.365004 L61.436034,19.365004 56.859034,25.377005 52.28303,31.387007 47.70603,25.377005 43.129027,19.365004 48.044028,19.365004 C44.496027,9.5760015 37.092024,2.4040001 28.227019,0.82999995 29.43002,0.61699978 30.65602,0.49999976 31.90502,0.5 z";break;case"jumpingrightarrow":n.pathData="M571.7207,727.7451L563.4507,716.8841L572.3297,716.8841C565.9217,699.1961,552.5427,686.2371,536.5277,683.3951C538.6997,683.0091,540.9157,682.8001,543.1717,682.8001C562.0777,682.8001,578.3457,696.7961,585.6187,716.8841L596.5277,716.8841L588.2577,727.7451L579.9907,738.6041L571.7207,727.7451z";break;case"jumpingleftarrow":n.pathData="M688.4209,727.7441L696.6889,716.8851L687.8119,716.8851C694.2179,699.1971,707.5989,686.2381,723.6119,683.3941C721.4409,683.0101,719.2259,682.8011,716.9679,682.8011C698.0639,682.8011,681.7959,696.7951,674.5209,716.8851L663.6119,716.8851L671.8839,727.7441L680.1509,738.6031L688.4209,727.7441z"}return n};t.datavisualization.Diagram.UMLConnectorShape=function(i){var u,r;i.shape.relationship||(i.shape.relationship="association");switch(i.shape.relationship){case"association":i.shape=t.datavisualization.Diagram.UMLConnectorAssociation(i.shape);break;case"aggregation":i.shape=t.datavisualization.Diagram.UMLConnectorAggregation(i.shape);break;case"composition":i.shape=t.datavisualization.Diagram.UMLConnectorComposition(i.shape);break;case"realization":i.shape=t.datavisualization.Diagram.UMLConnectorRealization(i.shape);break;case"dependency":i.shape=t.datavisualization.Diagram.UMLConnectorDependency(i.shape);break;case"inheritance":i.shape=t.datavisualization.Diagram.UMLConnectorInheritance(i.shape)}if(i.shape.type=="umlactivity")if(i.shape=t.datavisualization.Diagram.UMLActivityFlow(i.shape),i.shape.activityFlow=="object"){if(i=n.extend(!0,i,{lineDashArray:"8 4",targetDecorator:{shape:"openarrow"},lineWidth:2}),i.labels)for(r=0;r<i.labels.length;r++)i.labels[r]=t.datavisualization.Diagram.Label(i.labels[r]),i.labels[r].text="["+i.labels[r].text+"]"}else i.shape.activityFlow=="control"?i=n.extend(!0,i,{sourceDecorator:{shape:"none"},targetDecorator:{shape:"openarrow"},lineWidth:2}):i.shape.activityFlow=="exception"&&(i=n.extend(!0,i,{segments:[{type:"straight"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"openarrow"}}));else if(i.shape.multiplicity)if(u=[],u=t.datavisualization.Diagram.ClassifierHelper.umlConnectorMultiplicity(i),i.labels)for(r=0;r<u.length;r++)i.labels.push(u[r]);else i=n.extend(!0,{},{labels:u},i);return i.shape.type=="umlclassifier"&&(i.shape.relationship=="association"&&(i.shape.association=="bidirectional"?i=n.extend(!0,i,{segments:[{type:"straight"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"none"},lineWidth:2}):i.shape.association=="directional"&&(i=n.extend(!0,i,{segments:[{type:"straight"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"arrow"},lineWidth:2}))),i.shape.relationship=="inheritance"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"arrow",fillColor:"white"},lineWidth:2,lineDashArray:"4 4"})),i.shape.relationship=="composition"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"diamond",fillColor:"black"},targetDecorator:{shape:"none"},lineWidth:2})),i.shape.relationship=="aggregation"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"diamond",fillColor:"white"},targetDecorator:{shape:"none"},lineWidth:2})),i.shape.relationship=="dependency"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"openarrow",fillColor:"white"},lineWidth:2,lineDashArray:"4 4"})),i.shape.relationship=="realization"&&(i=n.extend(!0,i,{segments:[{type:"orthogonal"}],sourceDecorator:{shape:"none"},targetDecorator:{shape:"arrow",fillColor:"white"},lineWidth:2}))),i};t.datavisualization.Diagram.BPMNShape=function(t){t.shape||(t.shape="event");(t.shape!="sequentialflow"||t.shape!="associationflow"||t.shape!="messageflow")&&(t.labels&&t.labels.length||(t.labels=[{}]),t.labels.length&&t.labels[0].offset||(t.labels[0]=n.extend(!0,{},t.labels[0],{offset:{x:.5,y:1},verticalAlignment:"top",margin:{top:2}})));switch(t.shape){case"event":case"gateway":case"dataobject":case"activity":t._type="group";t._isBpmn=!0;t.children==undefined&&(t.children=[]);t.shape=="activity"&&t.activity=="subprocess"&&t.subProcess&&t.subProcess.collapsed==!1&&(t=n.extend(!0,{container:{type:"canvas"},paddingLeft:10,paddingRight:10,paddingBottom:10,paddingTop:10},t));break;case"message":t=n.extend(!0,t,{_shape:"path",pathData:"M0,0L19.8,12.8L40,0L0,0L0,25.5L40,25.5L40,0z"});break;case"datasource":t=n.extend(!0,t,{_shape:"path",pathData:"M 0 10.6 c 0 5.9 16.8 10.6 37.5 10.6 S 75 16.4 75 10.6 v 0 v 68.9 v -0.1 C 75 85.3 58.2 90 37.5 90 S 0 85.3 0 79.4 l 0 0.1 V 56 V 40.6 L 0 10.6 C 0 4.7 16.8 0 37.5 0 S 75 4.7 75 10.6 S 58.2 21.2 37.5 21.2 S 0 16.5 0 10.6 l 0 6.7 v -0.2 c 0 5.9 16.8 10.6 37.5 10.6 S 75 22.9 75 17.1 v 6.8 v -0.1 c 0 5.9 -16.8 10.6 -37.5 10.6 S 0 29.6 0 23.8"});break;case"group":t=n.extend(!0,t,{_type:"group",_isBpmn:!0,minWidth:t.width,minHeight:t.height,cornerRadius:10,container:{type:"canvas"},paddingLeft:10,paddingRight:10,paddingBottom:10,paddingTop:10,borderDashArray:"2 2 6 2"})}return t};t.datavisualization.Diagram.ClassifierShape=function(i,r){var u,f;i.classifier||(i.classifier="class");i.labels||(i.labels=[{margin:{}}]);i.fillColor||(i.fillColor="transparent");i.borderColor||(i.borderColor="transparent");i.borderWidth||(i.borderWidth=1);i.opacity||(i.opacity=1);switch(i.classifier){case"class":for(i["class"]=t.datavisualization.Diagram.ClassifierClass(i["class"]),u=0;u<i["class"].attributes.length;u++)i["class"].attributes[u]=t.datavisualization.Diagram.ClassAttribute(i["class"].attributes[u]);for(f=0;f<i["class"].methods.length;f++)i["class"].methods[f]=t.datavisualization.Diagram.ClassMethod(i["class"].methods[f]);i=t.datavisualization.Diagram.DefautShapes._getClassShape(i,r);break;case"interface":for(i["interface"]=t.datavisualization.Diagram.ClassifierInterface(i["interface"]),u=0;u<i["interface"].attributes.length;u++)i["interface"].attributes[u]=t.datavisualization.Diagram.ClassAttribute(i["interface"].attributes[u]);for(f=0;f<i["interface"].methods.length;f++)i["interface"].methods[f]=t.datavisualization.Diagram.ClassMethod(i["interface"].methods[f]);i=t.datavisualization.Diagram.DefautShapes._getClassShape(i,r);break;case"enumeration":i.enumeration=t.datavisualization.Diagram.ClassifierEnumeration(i.enumeration);i=t.datavisualization.Diagram.DefautShapes._getClassShape(i,r);break;case"member":i.labels[0]=n.extend(!0,{},{name:i.name+"_member",horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5},text:"Member"},i.labels[0]);i=n.extend(!0,{},{borderColor:"transparent",fillColor:"transparent",_shape:"rectangle",horizontalAlign:"stretch",verticalAlign:"bottom",_isClassMember:!0},i)}return i};t.datavisualization.Diagram.UMLActivityShape=function(n){n.type="umlactivity";n.shape||(n.shape="action");n._shape="path";switch(n.shape){case"action":n.pathData="M 90 82.895 C 90 86.819 86.776 90 82.8 90 H 7.2 C 3.224 90 0 86.819 0 82.895 V 7.105 C 0 3.181 3.224 0 7.2 0 h 75.6 C 86.776 0 90 3.181 90 7.105 V 82.895 Z";break;case"decision":n.pathData="M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z";break;case"mergenode":n.pathData="M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z";break;case"initialnode":n.pathData="M10,19.5c-5.238,0-9.5-4.262-9.5-9.5S4.762,0.5,10,0.5s9.5,4.262,9.5,9.5S15.238,19.5,10,19.5z";break;case"finalnode":n.borderColor="transparent";n._type="group";var i=[],r=0,u=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Resize);for(i.push({name:n.name+"_activity_final_1",width:n.width,height:n.height,offsetX:n.offsetX,offsetY:n.offsetY,constraints:u|t.datavisualization.Diagram.NodeConstraints.Resize,type:"node",shape:"path",pathData:"M164.1884,84.6909000000001C156.2414,84.6909000000001,149.7764,78.2259000000001,149.7764,70.2769000000001C149.7764,62.3279000000001,156.2414,55.8629000000001,164.1884,55.8629000000001C172.1354,55.8629000000001,178.6024,62.3279000000001,178.6024,70.2769000000001C178.6024,78.2259000000001,172.1354,84.6909000000001,164.1884,84.6909000000001"}),i.push({name:n.name+"_activity_final_2",width:n.width/2,height:n.height/2,fillColor:"black",offsetX:n.offsetX,offsetY:n.offsetY,constraints:u|t.datavisualization.Diagram.NodeConstraints.Resize,type:"node",shape:"path",pathData:"M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50"}),r=0;r<i.length;r++)i[r]=t.datavisualization.Diagram.Node(i[r]);n.elementType="group";n.children=i;break;case"forknode":n.width=n.width?n.width:40;n.height=5;n.fillColor="black";n.pathData="m0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z";n.labels=[{readOnly:!0}];n.ports=[];break;case"joinnode":n.width=n.width?n.width:40;n.height=5;n.fillColor="black";n.pathData="m0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z";n.labels=[{readOnly:!0}];n.ports=[];break;case"timeevent":n.pathData="M50.001,0.00286865 L25.001,25.0029 L0.000976562,0.00286865 L50.001,0.00286865 z M0.000976562,50.0029 L25.001,25.0029 L50.001,50.0029 L0.000976562,50.0029 z";break;case"acceptingevent":n.pathData="M17.8336 32.164 L29.64 24 L17.32 16 L48.1664 16 L48.5 32 Z";break;case"sendsignal":n.pathData="M48.164 31.8336 L56 23.832 L47.836 16 L16.168 16 L16.1668 31.8336 Z";break;case"receivesignal":n.pathData="M48.1664 31.8336 L39.836 24 L47.836 16 L16.168 16 L16.168 31.836 Z";break;case"structurednode":n._shape="rectangle";n.borderDashArray="2 3";n.labels=[{text:"<<"+n.labels[0].text+">>",wrapText:"nowrap",fillColor:"white"}];break;case"note":n.pathData="M20 12 L4 12 L4 22 L22 22 L22 14 L20 14 L20 12 L22 14 Z"}return n};t.datavisualization.Diagram.DefautShapes={_getBPMNEventShape:function(i,r){var f=[],u,o,s;for(i.children==undefined&&(i.children=[]),i._type="group",i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNEventDefaults,i),u=0;u<i.children.length;u++)r.nameTable[i.children[u].name||i.children[u]]&&(f.push(r.nameTable[i.children[u].name||i.children[u]]),f[u].rotateAngle=i.rotateAngle);var e=i.pivot||{x:.5,y:.5},h=i.offsetX?i.offsetX-i.width*e.x+i.width/2:i.width*e.x+i.width/2,c=i.offsetY?i.offsetY-i.height*e.y+i.height/2:i.height*e.y+i.height/2;if(!f.length)for(o=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect),s={parent:i.name,type:"node",shape:"path",offsetX:h,offsetY:c,ports:[],rotateAngle:i.rotateAngle,constraints:o,_isDisabled:!0,_isInternalShape:!0},f.push({name:i.name+"_0",width:i.width,height:i.height}),f.push({name:i.name+"_1",width:i.width*.85,height:i.height*.85}),f.push({name:i.name+"_2",width:i.width*.5,height:i.height*.5}),u=0;u<f.length;u++)f[u]=t.datavisualization.Diagram.Node(n.extend(!0,{},s,f[u]));return i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.children=this._updateBPMNEventShape(i,f,i.event,i.trigger),i},_getBPMNGatewayShape:function(i,r){var u=[],f,o,s;for(i.children==undefined&&(i.children=[]),i._type="group",i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNGatewayDefaults,i),f=0;f<i.children.length;f++)r.nameTable[i.children[f].name||i.children[f]]&&(u.push(r.nameTable[i.children[f].name||i.children[f]]),u[f].rotateAngle=i.rotateAngle);var e=i.pivot||{x:.5,y:.5},h=i.offsetX?i.offsetX-i.width*e.x+i.width/2:i.width*e.x+i.width/2,c=i.offsetY?i.offsetY-i.height*e.y+i.height/2:i.height*e.y+i.height/2;if(!u.length)for(o=t.datavisualization.Diagram.NodeConstraints.Default^(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect),s={parent:i.name,type:"node",shape:"path",offsetX:h,offsetY:c,ports:[],rotateAngle:i.rotateAngle,constraints:o,_isDisabled:!0,_isInternalShape:!0},u.push({name:i.name+"_0",width:i.width,height:i.height,pathData:"M 40 20 L 20 40 L 0 20 L 20 0 L 40 20 Z"}),u.push({name:i.name+"_1",width:i.width*.45,height:i.height*.45}),f=0;f<u.length;f++)u[f]=t.datavisualization.Diagram.Node(n.extend(!0,{},s,u[f]));i.children=u;i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default;n.extend(!0,u,[{fillColor:i.fillColor,constraints:i.constraints,shadow:i.shadow,borderColor:i.borderColor,borderWidth:i.borderWidth,opacity:i.opacity,gradient:i.gradient},{opacity:i.opacity,fillColor:"black",visible:!0}]);switch(i.gateway){case"none":u[1].visible=!1;break;case"exclusive":u[1].pathData="M 11.196 29.009 l 6.36 -9.712 l -5.764 -8.899 h 4.393 l 3.732 5.979 l 3.656 -5.979 h 4.354 l -5.789 9.039 l 6.36 9.572 h -4.532 l -4.126 -6.437 l -4.139 6.437 H 11.196 Z";break;case"inclusive":u[1].pathData="M 20.323 31.333 c -6.625 0 -12.015 -5.39 -12.015 -12.015 s 5.39 -12.015 12.015 -12.015 s 12.016 5.39 12.016 12.015 S 26.948 31.333 20.323 31.333 Z M 20.323 9.303 c -5.522 0 -10.015 4.493 -10.015 10.015 s 4.492 10.015 10.015 10.015 s 10.016 -4.493 10.016 -10.015 S 25.846 9.303 20.323 9.303 Z";break;case"parallel":u[1].pathData="M 18.394 29.542 v -8.833 H 9.626 v -3.691 h 8.768 V 8.251 h 3.734 v 8.767 h 8.768 v 3.691 h -8.768 v 8.833 H 18.394 Z";break;case"complex":u[1].pathData="M29.198,19.063L23.089,19.063L27.794,14.358L26.38,12.944L21.223,18.101L21.223,10.443L19.223,10.443L19.223,17.976L14.022,12.776L12.608,14.19L17.48,19.063L10.365,19.063L10.365,21.063L18.261,21.063L12.392,26.932L13.806,28.346L19.223,22.929L19.223,30.225L21.223,30.225L21.223,22.805L25.925,27.507L27.339,26.093L22.309,21.063L29.198,21.063z";break;case"eventbased":u[1].fillColor="white";u[1].pathData="M 20.322 29.874 c -5.444 0 -9.873 -4.43 -9.873 -9.874 s 4.429 -9.874 9.873 -9.874 s 9.874 4.429 9.874 9.874 S 25.767 29.874 20.322 29.874 Z M 20.322 32.891 c -7.107 0 -12.89 -5.783 -12.89 -12.891 c 0 -7.107 5.782 -12.89 12.89 -12.89 c 7.108 0 12.891 5.783 12.891 12.89 C 33.213 27.108 27.431 32.891 20.322 32.891 Z M 24.191 25.386 h -7.984 l -2.469 -7.595 l 6.461 -4.693 l 6.461 4.693 L 24.191 25.386 Z";break;case"exclusiveeventbased":u[1].fillColor="white";u[1].pathData="M 30 15 C 30 23.28 23.28 30 15 30 S 0 23.28 0 15 S 6.72 0 15 0 S 30 6.72 30 15 z M 15 5 L 5 12.5 L 8 22.5 H 22 L 25 12.5 z";break;case"paralleleventbased":u[1].fillColor="white";u[1].pathData="M 35 17.5 C 35 27.16 27.16 35 17.5 35 S 0 27.16 0 17.5 S 7.84 0 17.5 0 S 35 7.84 35 17.5 z M 14.58 5.83 V 14.58 H 5.83 V 20.42 H 14.58 V 29.17 H 20.42 V 20.42 H 29.17 V 14.58 H 20.42 V 5.83 z"}return i},_getClassShape:function(i,r){var f=[],k,l,y="",p="",w="",b="",v,a,o,c,e,h,u,s;if(i.children){for(u=0;u<i.children.length;u++)r.nameTable[i.children[u].name||i.children[u]]&&f.push(r.nameTable[i.children[u].name||i.children[u]]);if(f.length<=0&&i.children.length>0)for(s=0;s<i.children.length;s++)f.push(i.children[s])}else{if(v=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Select|t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeSouth|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Rotate|t.datavisualization.Diagram.NodeConstraints.ResizeEast|t.datavisualization.Diagram.NodeConstraints.Drag),a={width:i.width,offsetX:i.offsetX,parent:i.name,ports:[],fillColor:"transparent",borderColor:i.borderColor,type:"node",labels:[{margin:{left:5,right:5,top:5,bottom:5}}],_isClassMember:!0},i.fillColor&&(a.fillColor=i.fillColor),i.borderColor&&(a.borderColor=i.borderColor),i.borderWidth&&(a.borderWidth=i.borderWidth),i.labels)for(u=0;u<i.labels.length;u++)a.labels[u]=n.extend(!0,{},a.labels[u],i.labels[u]);switch(i.classifier){case"class":f.push({ports:[],name:i.name+"_header_classifier",minHeight:30,labels:[{name:"title",offset:{x:.5,y:.65},text:i["class"].name,bold:!0,fontSize:14},{name:"class",offset:{x:.5,y:.25},text:"<<Class>>"}],constraints:v});break;case"interface":f.push({name:i.name+"_header_classifier",minHeight:40,labels:[{name:"title",offset:{x:.5,y:.65},text:i["interface"].name,bold:!0,fontSize:14},{name:"interface",offset:{x:.5,y:.25},text:"<<Interface>>"}],constraints:v});break;case"enumeration":f.push({name:i.name+"_header_classifier",minHeight:40,labels:[{name:i.name+"Label1",offset:{x:.5,y:.65},text:i.enumeration.name,bold:!0,fontSize:14},{name:i.name+"enumeration",offset:{x:.5,y:.25},text:"<<Enumeration>>"}],constraints:v})}if(o=i["class"]?i["class"]:i["interface"],o&&o.attributes&&o.attributes.length){for(u=0;u<o.attributes.length;u++)o.attributes[u]=t.datavisualization.Diagram.ClassAttribute(o.attributes[u]),i.Interface&&(o.attributes[u].scope=t.datavisualization.Diagram.ScopeValueDefaults.Public),o.attributes[u].scope&&o.attributes[u].scope=="public"&&(h="+"),o.attributes[u].scope&&o.attributes[u].scope=="private"&&(h="-"),o.attributes[u].scope&&o.attributes[u].scope=="protected"&&(h="#"),o.attributes[u].scope&&o.attributes[u].scope=="package"&&(h="~"),o.attributes[u].name!=""&&(y+=h?h+" "+o.attributes[u].name+" : "+o.attributes[u].type:o.attributes[u].name+": "+o.attributes[u].type),u!=o.attributes.length-1&&(y+="\n");y&&f.push({name:i.name+"_attribute_classifier",labels:[{text:y,horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:v})}if(c=i.enumeration,c&&c.members&&c.members.length){for(u=0;u<c.members.length;u++)c.members[u]=t.datavisualization.Diagram.ClassMember(c.members[u]),c.members[u].name!=""&&(w+=c.members[u].name),u!=c.members.length-1&&(w+="\n");w&&f.push({name:i.name+"_member_classifier",labels:[{text:w,horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:v})}if(e=i["class"]?i["class"]:i["interface"],e&&e.methods&&e.methods.length){for(u=0;u<e.methods.length;u++){if(e.methods[u]=t.datavisualization.Diagram.ClassMethod(e.methods[u]),e.methods[u].scope&&e.methods[u].scope=="public"&&(h="+"),e.methods[u].scope&&e.methods[u].scope=="private"&&(h="-"),e.methods[u].scope&&e.methods[u].scope=="protected"&&(h="#"),e.methods[u].scope&&e.methods[u].scope=="package"&&(h="~"),e.methods[u].arguments)for(s=0;s<e.methods[u].arguments.length;s++)b+=e.methods[u].arguments[s].type?e.methods[u].arguments[s].name+":"+e.methods[u].arguments[s].type:e.methods[u].arguments[s].name,s!=e.methods[u].arguments.length-1&&(b+=",");e.methods[u].name!=""&&(p+=h?h+" "+e.methods[u].name+"("+b+") : "+e.methods[u].type:e.methods[u].name+"("+b+") :"+e.methods[u].type);u!=e.methods.length-1&&(p+="\n")}p&&f.push({name:i.name+"_method_classifier",labels:[{text:p,horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:v})}for(u=0;u<f.length;u++)for(f[u]=t.datavisualization.Diagram.Node(n.extend(!0,{},a,f[u])),s=0;s<f[u].labels.length;s++)f[u].labels[s]=n.extend(!0,{},f[u].labels[s],a.labels[0]);for(i.children=f,i._type="group",i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.constraints=i.constraints&~(t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeSouth|t.datavisualization.Diagram.NodeConstraints.Rotate|t.datavisualization.Diagram.NodeConstraints.ResizeEast|t.datavisualization.Diagram.NodeConstraints.Drag),u=0;u<f.length;u++)f.length==1&&(i["class"]&&(delete i["class"].attributes,delete i["class"].methods),i["interface"]&&(delete i["interface"].attributes,delete i["interface"].methods),i.enumeration&&delete i.enumeration.members),f.length==2&&(i.children[u]=typeof i.children[u]=="string"?r.nameTable[i.children[u]]:i.children[u],i["class"]&&(i.children[u].name.match("attribute")&&delete i["class"].methods,i.children[u].name.match("method")&&delete i["class"].attributes),i["interface"]&&(i.children[u].name.match("attribute")&&delete i["interface"].methods,i.children[u].name.match("method")&&delete i["interface"].attributes))}for(i._height=0,u=0;u<f.length;u++)r._getNodeDimension(f[u],f[u].labels[0]),k=f[u].height?f[u].height:f[u]._height,f[u].offsetY=i._height+k/2,i._height+=k;for(l=f[0]._width,f[1]&&(l=f[0]._width>f[1]._width?f[0]._width:f[1]._width),f[2]&&(l=f[2]._width>l?f[2]._width:l),f[0].width=l,f[1]&&(f[1].width=l),f[2]&&(f[2].width=l),i._width=l,i.width=i._width,i.height=i._height,u=0;u<f.length;u++)f[u].offsetY+=i.offsetY-i.height/2;return i},_updateClassNode:function(n,i){var h;if(n.name.match("_header"))i.type=="class"?i.className=n.labels[0].text:i.type=="interface"?i.interfaceName=n.labels[0].text:i.enumerationName=n.labels[0].text;else{for(var o=n.name.match("_attribute")?"attribute":n.name.match("_method")?"method":"member",s=n.labels[0],e=s.text.split("\n"),u=[],r,f=0;f<e.length;f++){h=i.Class?i.Class:i.Interface;switch(o){case"attribute":r=e[f].split(/:[ ]*/g);u.push(t.datavisualization.Diagram.ClassMember({name:r[0],type:r[1]}));break;case"method":r=e[f].replace(")","").replace("(",":").split(/:[ ]*/g);u.push(t.datavisualization.Diagram.ClassMember({name:r[0],returnType:r[1],parameter:r[2]}));break;case"member":u.push(t.datavisualization.Diagram.ClassMember({name:e[f]}))}}o=="attribute"?i.attributes=u:o=="method"?i.methods=u:i.members=u}},_getBPMNDataShape:function(i,r){var u=[],f,e,s,o,h,c,l;for(i.children==undefined&&(i.children=[]),i._type="group",e=i.pivot||{x:.5,y:.5},i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNDataObjectDefaults,i),s=i.offsetX?i.offsetX-i.width*e.x:i.width*e.x,o=i.offsetY?i.offsetY-i.height*e.y:i.height*e.y,f=0;f<i.children.length;f++)r.nameTable[i.children[f].name||i.children[f]]&&(u.push(r.nameTable[i.children[f].name||i.children[f]]),u[f].rotateAngle=i.rotateAngle);if(h=i.offsetX?i.offsetX-i.width*e.x+i.width/2:i.width*e.x+i.width/2,!u.length)for(c=t.datavisualization.Diagram.NodeConstraints.Default^(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect),l={parent:i.name,type:"node",shape:"path",offsetX:h,ports:[],rotateAngle:i.rotateAngle,constraints:c,_isDisabled:!0,_isInternalShape:!0},u.push({name:i.name+"_0",width:i.width,height:i.height,offsetY:o+i.height/2,shape:"polygon",points:[{x:29.904,y:5},{x:7.853,y:5},{x:7.853,y:45},{x:42.147,y:45},{x:42.147,y:17.242},{x:29.932,y:5},{x:29.932,y:17.242},{x:42.147,y:17.242}]}),u.push({name:i.name+"_1",width:i.width*.075,height:i.height*.15,offsetY:i.height*.85+o,fillColor:"black",pathData:"M 0 0 L 0.1 0 L 0.1 2 L 0 2 Z M 0.4 0 L 0.6 0 L 0.6 2 L0.4 2 Z M 0.9 0 L 1 0 L 1 2 L 0.9 2 Z "}),u.push({name:i.name+"_2",width:i.width*.25,height:i.height*.2,offsetX:s+i.width*.175,offsetY:o+i.height*.15,borderColor:"black",fillColor:"white",pathData:"M 3 9.4 l 6 0 v 2.4 l 3.6 -4 L 9 4 v 2.5 H 3 V 9.4 Z"}),f=0;f<u.length;f++)u[f]=t.datavisualization.Diagram.Node(n.extend(!0,{},l,u[f]));i.children=u;i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default;n.extend(!0,u,[{fillColor:i.fillColor,constraints:i.constraints,shadow:i.shadow,borderColor:i.borderColor,borderWidth:i.borderWidth,opacity:i.opacity,gradient:i.gradient},{opacity:i.opacity,visible:i.data.collection},{opacity:i.opacity,visible:!0}]);switch(i.data.type){case"none":u[2].visible=!1;break;case"input":u[2].fillColor="white";break;case"output":u[2].fillColor="black"}return i},_getBPMNActivityShape:function(i,r){var f=[],h={},u,s,c,e,o;for(i.children==undefined&&(i.children=[]),i._type="group",i.canUngroup=!1,i=n.extend(!0,{},t.datavisualization.Diagram.BPMNActivityDefaults,i),u=0;u<i.children.length;u++)r.nameTable[i.children[u].name||i.children[u]]&&(f.push(r.nameTable[i.children[u].name||i.children[u]]),f[u].rotateAngle=i.rotateAngle);if(!f.length){for(s=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Resize),c={parent:i.name,type:"node",shape:"path",ports:[],labels:[],constraints:s,rotateAngle:i.rotateAngle,_isDisabled:!0,_isInternalShape:!0},f.push({name:i.name+"_activity",width:i.width,height:i.height,addInfo:{offset:{x:.5,y:.5}},constraints:s|t.datavisualization.Diagram.NodeConstraints.Resize}),f.push({name:i.name+"_taskType",width:14,height:14,borderColor:"black",addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:14,top:14}},pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_loop",width:12,height:12,addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_compensation",width:12,height:12,addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_expanded",width:12,height:12,constraints:t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Resize|t.datavisualization.Diagram.NodeConstraints.Select),addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_adhoc",width:12,height:8,addInfo:{offset:{x:.5,y:1},hAlign:"center",vAlign:"bottom",margin:{bottom:12}},borderColor:"black",fillColor:"black",pathData:"M10 0L40 0L30 40L0 40Z"}),f.push({name:i.name+"_event_1",width:24,height:24,addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:18,top:18}}}),f.push({name:i.name+"_event_2",width:20.4,height:20.4,addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:18,top:18}}}),f.push({name:i.name+"_event_3",width:12,height:12,addInfo:{offset:{x:0,y:0},hAlign:"left",vAlign:"top",margin:{left:18,top:18}}}),u=0;u<f.length;u++)f[u]=t.datavisualization.Diagram.Node(n.extend(!0,{},c,f[u]));if(i.activity=="subprocess"&&!i.subProcess.collapsed&&i.subProcess.processes.length)for(e=0,o=i.subProcess.processes;e<i.subProcess.processes.length;e++)o[e]=t.datavisualization.Diagram.Node(t.datavisualization.Diagram.NodeType(o[e],r)),f.push(o[e])}for(i.constraints=i.constraints?i.constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.children=this._updateBPMNActivityShape(i,f),u=0;u<i.children.length;u++)h[i.children[u].name]=i.children[u];return t.datavisualization.Diagram.Util._updateBPMNProperties(i,r,h),i},_getBPMNGroupShape:function(n,i){var u=[],r=0,f;for(n.children==undefined&&(n.children=[]),r=0;r<n.children.length;r++)i.nameTable[n.children[r].name||n.children[r]]&&u.push(i.nameTable[n.children[r].name||n.children[r]]);if(!u.length)for(r=0;r<n.children.length;r++)f=t.datavisualization.Diagram.Node(t.datavisualization.Diagram.NodeType(n.children[r],i)),f.type=="bpmn"&&u.push(f);return n.ports=[],n.children=u,n.constraints=n.constraints?n.constraints:t.datavisualization.Diagram.NodeConstraints.Default,n.constraints=n.constraints&~t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.AllowDrop,n},_updateBPMNEventShape:function(i,r,u,f){var e,o,s;r&&r[0]&&(e=r[0].constraints?r[0].constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(e=e|t.datavisualization.Diagram.NodeConstraints.Shadow));o="M164.1884,84.6909000000001C156.2414,84.6909000000001,149.7764,78.2259000000001,149.7764,70.2769000000001C149.7764,62.3279000000001,156.2414,55.8629000000001,164.1884,55.8629000000001C172.1354,55.8629000000001,178.6024,62.3279000000001,178.6024,70.2769000000001C178.6024,78.2259000000001,172.1354,84.6909000000001,164.1884,84.6909000000001";s=[{pathData:o,fillColor:i.fillColor,constraints:e,shadow:i.shadow,borderWidth:i.borderWidth,borderColor:i.borderColor,borderDashArray:"1 0",opacity:i.opacity,gradient:i.gradient,visible:!0},{pathData:o,fillColor:i.fillColor,borderColor:i.borderColor,borderDashArray:"1 0",opacity:i.opacity,gradient:i.gradient,visible:!0},{pathData:o,fillColor:"white",borderColor:i.borderColor,opacity:i.opacity,height:r[0].height*.5,visible:!0}];n.extend(!0,r,s);switch(u){case"start":r[1].visible=!1;break;case"noninterruptingstart":r[0].borderDashArray="2 3";r[1].visible=!1;break;case"intermediate":r[0].fillColor="white";r[0].gradient=null;break;case"noninterruptingintermediate":r[0].fillColor="white";r[0].gradient=null;r[0].borderDashArray="2 3";r[1].borderDashArray="2 3";break;case"throwingintermediate":case"end":r[0].fillColor=u!="end"?"white":"black";r[0].gradient=null;r[2].fillColor="black";r[2].borderColor=i.fillColor}switch(f){case t.datavisualization.Diagram.BPMNTriggers.None:r[2].visible=!1;break;case t.datavisualization.Diagram.BPMNTriggers.Message:r[2].pathData="M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0";r[2].height=3*r[2].width/4;break;case t.datavisualization.Diagram.BPMNTriggers.Timer:r[2].pathData="M40,20c0,8.654-5.496,16.024-13.189,18.81C24.685,39.58,22.392,40,20,40C8.954,40,0,31.046,0,20S8.954,0,20,0S40,8.954,40,20z M20,0 L20,2.583 L20,5.283 M10.027,2.681 L11.659,5.507 L12.669,7.257 M2.731,9.989 L6.014,11.885 L7.307,12.631 M0.067,19.967 L2.667,19.967 L5.35,19.967M2.748,29.939 L5.731,28.217 L7.323,27.298 M10.056,37.236 L11.292,35.095 L12.698,32.66 M20.033,39.9 L20.033,36.417 L20.033,34.617 M30.006,37.219 L28.893,35.292 L27.364,32.643 M37.302,29.911 L34.608,28.355 L32.727,27.269M39.967,19.933 L37.417,19.933 L34.683,19.933 M37.286,9.961 L34.583,11.521 L32.71,12.602 M29.977,2.664 L28.653,4.957 L27.336,7.24 M22.104,8.5 L19.688,20 L24.75,20 L31.604,20 L24.75,20 L19.688,20z";break;case t.datavisualization.Diagram.BPMNTriggers.Error:r[2].pathData="M 23.77 18.527 l -7.107 27.396 l 8.507 -17.247 L 36.94 40.073 l 6.394 -25.997 l -8.497 15.754 L 23.77 18.527 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Escalation:r[2].pathData="M 30.001 8.098 L 11.842 43.543 l 18.159 -18.882 l 18.162 18.882 L 30.001 8.098 Z ";break;case t.datavisualization.Diagram.BPMNTriggers.Cancel:r[2].pathData="M 3.5 16 L 0 12.6 L 4.6 8 L 0 3.5 L 3.4 0 L 8 4.6 l 4.5 -4.5 L 16 3.5 L 11.5 8 l 4.5 4.5 l -3.4 3.5 L 8 11.4 L 3.5 16 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Compensation:r[2].pathData="M 25.7086 0 L 0 25 L 25.7086 50 V 26.3752 L 50 50 V 0 L 25.7086 23.6248 V 0 Z ";break;case t.datavisualization.Diagram.BPMNTriggers.Conditional:r[2].pathData="M 0 0 H 16 V 16 H 0 z M 1.14 3.2 H 14.85 M 1.14 6.4 H 14.85 M 1.14 9.6 H 14.85 M 1.14 12.8 H 14.85";break;case t.datavisualization.Diagram.BPMNTriggers.Link:r[2].pathData="M 32.014 19.258 v 5.992 H 9.373 v 9.504 h 22.641 v 5.988 L 50.622 30 L 32.014 19.258 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Signal:r[2].pathData="M 50 50 H 0 L 25.0025 0 L 50 50 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Terminate:r[2].pathData="M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50";break;case t.datavisualization.Diagram.BPMNTriggers.Multiple:r[2].pathData="M 17.784 48.889 H 42.21 l 7.548 -23.23 L 29.997 11.303 L 10.236 25.658 L 17.784 48.889 Z";break;case t.datavisualization.Diagram.BPMNTriggers.Parallel:r[2].pathData="M 27.276 49.986 h 5.58 v -17.15 h 17.146 V 27.17 h -17.15 l 0.004 -17.15 h -5.58 l -0.004 17.15 H 9.994 v 5.666 h 17.278 L 27.276 49.986 Z"}return r},_updateBPMNActivityShape:function(i,r){var v,y,f,u,o,h,p,e,b;r&&r[0]&&(h=r[0].constraints?r[0].constraints:t.datavisualization.Diagram.NodeConstraints.Default,i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(h=h|t.datavisualization.Diagram.NodeConstraints.Shadow));var k=[{fillColor:i.fillColor,borderWidth:i.borderWidth,constraints:h,shadow:i.shadow,borderColor:i.borderColor,borderDashArray:"1 0",opacity:i.opacity,gradient:i.gradient,pathData:this._updateRoundedRectanglePath(i,12)},{fillColor:"white",borderColor:"black",width:14,height:14,opacity:i.opacity,visible:!1},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!0},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!0},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!1},{addInfo:{margin:{left:0}},opacity:i.opacity,visible:!1},{opacity:i.opacity,visible:!1},{opacity:i.opacity,visible:!1},{opacity:i.opacity,visible:!1}],c=[],l=9,e=0;n.extend(!0,r,k);i.activity=="subprocess"&&!i.subProcess.collapsed&&r.length>l&&i.subProcess.processes.length&&(c=r.splice(r.length-i.subProcess.processes.length,i.subProcess.processes.length));v=i.activity=="task"?i.task.loop:i.subProcess.loop;y=i.activity=="task"?i.task.compensation:i.subProcess.compensation;switch(v){case"none":r[2].visible=!1;break;case"standard":r[2].pathData="M 52.002 73.379 c -2.494 -2.536 -6.55 -2.534 -9.043 0 c -1.208 1.228 -1.874 2.861 -1.874 4.598 c 0 1.225 0.337 2.395 0.957 3.411 l -1.167 1.186 l 2.071 0.458 l 2.071 0.458 l -0.45 -2.106 l -0.45 -2.106 l -1.292 1.314 c -1.119 -2.065 -0.842 -4.709 0.877 -6.458 c 2.084 -2.119 5.475 -2.117 7.557 0 c 2.083 2.119 2.083 5.565 0 7.685 c -0.976 0.992 -2.272 1.557 -3.65 1.59 l 0.025 1.068 c 1.65 -0.041 3.2 -0.716 4.368 -1.903 c 1.208 -1.228 1.874 -2.861 1.874 -4.597 C 53.875 76.24 53.209 74.607 52.002 73.379 Z";break;case"parallelmultiinstance":r[2].pathData="M 51.5,69.5 L52.5,69.5 L52.5,84.5 L51.5 84.5 Z M 46.5,69.5 L47.5,69.5 L47.5,84.5 L46.5 84.5 Z M 41.5,69.5 L42.5,69.5 L42.5,84.5 L41.5 84.5 Z ";break;case"sequencemultiinstance":r[2].pathData="M 40.375,71.5 L 55.375,71.5 L 55.375,72.5 L 40.375,72.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,81.5 L 55.375,81.5 L 55.375,82.5 L 40.375,82.5 Z"}if(y?r[3].pathData="M 22.462 18.754 l -6.79 3.92 l 6.79 3.92 V 22.89 l 6.415 3.705 v -7.841 l -6.415 3.705 V 18.754 Z M 28.331 19.701 v 5.947 l -5.149 -2.973 L 28.331 19.701 Z M 21.916 25.647 l -5.15 -2.973 l 5.15 -2.973 V 25.647 Z M 22.275 12.674 c -5.513 0 -9.999 4.486 -9.999 9.999 c 0 5.514 4.486 10.001 9.999 10.001 c 5.514 0 9.999 -4.486 9.999 -10.001 C 32.274 17.16 27.789 12.674 22.275 12.674 Z M 22.275 32.127 c -5.212 0 -9.453 -4.241 -9.453 -9.454 c 0 -5.212 4.241 -9.453 9.453 -9.453 c 5.212 0 9.453 4.241 9.453 9.453 C 31.728 27.887 27.487 32.127 22.275 32.127 Z":r[3].visible=!1,f=i.activity==t.datavisualization.Diagram.BPMNActivity.Task?i.task.events:i.subProcess.events,f&&f.length)for(u=0;u<f.length;u++){if(o=r.slice(l+u*3,l+3+u*3),!o.length||o.length<3){for(h=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.PointerEvents|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Resize),p={parent:i.name,type:"node",shape:"path",ports:[],labels:[],constraints:h,rotateAngle:i.rotateAngle,_isInternalShape:!0,opacity:i.opacity,visible:!1,addInfo:{offset:f[u].offset}},f[u]=n.extend(!0,{},t.datavisualization.Diagram.BPMNEventDefaults,f[u]),o=[{width:24,height:24},{width:20.4,height:20.4},{width:12,height:12}],e=0;e<o.length;e++)o[e]=t.datavisualization.Diagram.Node(n.extend(!0,{name:i.name+"_"+t.datavisualization.Diagram.Util.randomId()},p,o[e])),e==0&&(o[e].constraints=t.datavisualization.Diagram.NodeConstraints.Default&~t.datavisualization.Diagram.NodeConstraints.Resize,o[e].name=f[u].name?f[u].name:i.name+"_"+f[u].event+"_"+f[u].trigger+"_"+t.datavisualization.Diagram.Util.randomId());r=r.concat(o)}this._updateBPMNEventShape(i,o,f[u].event,f[u].trigger)}else r.splice(l,r.length-1);if(i.activity==t.datavisualization.Diagram.BPMNActivity.Task){r[1].visible=!0;switch(i.task.type){case"none":r[1].visible=!1;break;case"service":r[1].pathData="M 32.699 20.187 v -4.005 h -3.32 c -0.125 -0.43 -0.292 -0.83 -0.488 -1.21 l 2.373 -2.375 l -2.833 -2.83 l -2.333 2.333 c -0.44 -0.253 -0.9 -0.448 -1.387 -0.595 v -3.32 h -4.003 v 3.32 c -0.46 0.137 -0.89 0.322 -1.3 0.537 l -2.285 -2.275 l -2.833 2.83 l 2.285 2.278 c -0.235 0.42 -0.41 0.847 -0.547 1.307 h -3.33 v 4.005 h 3.33 c 0.148 0.488 0.343 0.955 0.588 1.395 l -2.325 2.325 l 2.822 2.832 l 2.373 -2.382 c 0.392 0.205 0.792 0.37 1.212 0.497 v 3.33 h 4.003 v -3.33 c 0.46 -0.138 0.89 -0.323 1.3 -0.547 l 2.43 2.432 l 2.822 -2.832 l -2.42 -2.422 c 0.222 -0.41 0.4 -0.85 0.535 -1.297 H 32.699 Z M 22.699 21.987 c -2.1 0 -3.803 -1.703 -3.803 -3.803 c 0 -2.1 1.703 -3.803 3.803 -3.803 c 2.1 0 3.803 1.703 3.803 3.803 C 26.502 20.285 24.8 21.987 22.699 21.987 Z";break;case"receive":r[1].pathData="M 12.217 12.134 v 13.334 h 20 V 12.134 H 12.217 Z M 30.44 13.007 l -8.223 5.35 l -8.223 -5.35 H 30.44 Z M 13.09 24.594 V 13.459 l 9.127 5.94 l 9.127 -5.94 v 11.135 H 13.09 Z";r[1].height=12;break;case"send":r[1].pathData="M 45.7256 3.16055 L 25 23.4017 L 4.27442 3.16055 H 45.7256 Z M 47.8963 46.8413 H 2.10375 V 4.80813 L 25 27.1709 L 47.8963 4.80813 V 46.8413 Z";r[1].height=12;r[1].fillColor="black";r[1].borderColor="white";break;case"instantiatingreceive":r[1].pathData="M 16.306 17.39 v 8.79 h 13.198 v -8.79 H 16.306 Z M 28.375 17.946 l -5.47 3.558 l -5.47 -3.558 H 28.375 Z M 28.948 25.625 H 16.861 v -7.389 l 6.043 3.931 l 6.043 -3.931 V 25.625 Z M 22.905 11.785 c -5.514 0 -9.999 4.486 -9.999 10 c 0 5.514 4.485 10 9.999 10 s 9.999 -4.486 9.999 -10 C 32.904 16.272 28.419 11.785 22.905 11.785 Z M 22.905 31.239 c -5.212 0 -9.453 -4.241 -9.453 -9.454 c 0 -5.212 4.241 -9.453 9.453 -9.453 s 9.452 4.241 9.452 9.453 C 32.357 26.998 28.117 31.239 22.905 31.239 Z";r[1].width=20;r[1].height=20;break;case"manual":r[1].pathData="M 13.183 15.325 h 2.911 c 0.105 0 0.207 -0.043 0.281 -0.117 c 0.078 -0.074 0.117 -0.176 0.117 -0.281 c 0 -0.753 0.718 -1.362 1.596 -1.362 h 2.579 c -0.117 0.227 -0.191 0.48 -0.195 0.757 c 0 0.433 0.168 0.851 0.46 1.144 c 0.008 0.004 0.015 0.011 0.019 0.015 c -0.289 0.285 -0.475 0.691 -0.479 1.148 c 0 0.433 0.168 0.846 0.46 1.139 c 0.011 0.012 0.023 0.02 0.035 0.032 c -0.301 0.281 -0.491 0.694 -0.495 1.155 c 0 0.432 0.168 0.847 0.46 1.143 c 0.265 0.266 0.612 0.414 0.975 0.414 h 0.839 c 0.027 0.004 0.051 0.012 0.074 0.012 h 8.443 c 0.352 0 0.636 0.344 0.636 0.761 c 0 0.414 -0.285 0.753 -0.636 0.753 h -6.687 c -0.019 0 -0.035 -0.008 -0.051 -0.008 h -2.27 c -0.121 -0.835 -0.667 -1.187 -1.795 -1.187 h -2.158 c -0.223 0 -0.402 0.18 -0.402 0.403 c 0 0.219 0.179 0.398 0.402 0.398 h 2.158 c 0.972 0 1.019 0.203 1.019 0.784 c 0 0.219 0.179 0.399 0.402 0.399 c 0.008 0 0.016 -0.004 0.027 -0.004 c 0.028 0.004 0.055 0.016 0.082 0.016 h 2.56 c 0.34 0.015 0.616 0.343 0.616 0.752 c 0 0.418 -0.285 0.757 -0.636 0.761 h -0.004 h -6.442 c -0.878 0 -1.595 -0.639 -1.595 -1.427 v -0.683 c 0 -0.109 -0.043 -0.211 -0.114 -0.285 c -0.078 -0.074 -0.179 -0.117 -0.285 -0.117 h -0.004 l -2.989 0.027 c -0.223 0 -0.398 0.184 -0.398 0.402 c 0 0.219 0.179 0.395 0.398 0.395 h 0.004 l 2.591 -0.02 v 0.282 c 0 1.229 1.073 2.223 2.391 2.223 h 3.895 c 0.004 0 0.007 0.004 0.011 0.004 h 2.536 c 0.792 0 1.436 -0.698 1.436 -1.561 c 0 -0.273 -0.07 -0.53 -0.188 -0.752 h 5.49 c 0.792 0 1.436 -0.695 1.436 -1.553 c 0 -0.858 -0.644 -1.557 -1.436 -1.557 h -3.566 c 0.121 -0.226 0.199 -0.487 0.199 -0.768 c 0 -0.468 -0.195 -0.882 -0.495 -1.167 c 0.301 -0.285 0.495 -0.698 0.495 -1.163 c 0 -0.456 -0.191 -0.866 -0.483 -1.152 c 0.293 -0.285 0.483 -0.694 0.483 -1.151 c 0 -0.858 -0.647 -1.557 -1.439 -1.557 h -8.373 c -1.167 0 -2.142 0.757 -2.352 1.76 l -2.548 -0.004 c -0.219 0 -0.399 0.18 -0.399 0.403 C 12.784 15.145 12.964 15.325 13.183 15.325 L 13.183 15.325 Z M 21.907 19.707 c -0.191 0 -0.328 -0.094 -0.41 -0.176 c -0.144 -0.145 -0.226 -0.355 -0.226 -0.577 c 0.003 -0.418 0.289 -0.753 0.643 -0.753 h 4.468 c 0.008 0 0.015 -0.004 0.027 -0.008 h 0.051 c 0.351 0 0.636 0.344 0.636 0.761 c 0 0.414 -0.286 0.753 -0.636 0.753 H 21.907 Z M 27.097 16.629 c 0 0.414 -0.286 0.753 -0.64 0.753 h -4.464 c -0.004 0 -0.004 0 -0.004 0 h -0.082 c -0.191 0 -0.328 -0.098 -0.414 -0.18 c -0.14 -0.145 -0.222 -0.352 -0.222 -0.573 c 0 -0.413 0.285 -0.749 0.631 -0.753 h 3.434 c 0 0 0 0 0.004 0 h 1.116 c 0.008 0 0.012 -0.004 0.02 -0.004 C 26.819 15.887 27.097 16.215 27.097 16.629 L 27.097 16.629 Z M 27.097 14.322 c 0 0.41 -0.278 0.737 -0.62 0.749 c -0.008 0 -0.012 0 -0.016 0 h -3.637 c -0.008 0 -0.015 0.004 -0.023 0.004 h -0.886 c -0.004 0 -0.008 0 -0.012 0 c -0.187 0 -0.324 -0.094 -0.406 -0.176 c -0.144 -0.144 -0.226 -0.355 -0.226 -0.577 c 0.003 -0.414 0.293 -0.753 0.643 -0.753 h 4.468 c 0.008 0 0.015 -0.004 0.027 -0.004 h 0.051 C 26.811 13.565 27.097 13.905 27.097 14.322 L 27.097 14.322 Z M 27.097 14.322";r[1].width=20;break;case"businessrule":r[1].pathData="M 32.844 13.245 h -0.089 v 0 H 13.764 v -0.015 h -1.009 v 16.989 h 0.095 v 0.011 h 19.716 v -0.011 h 0.278 V 13.245 Z M 31.844 14.229 v 4.185 h -18.08 v -4.185 H 31.844 Z M 18.168 25.306 v 3.938 h -4.404 v -3.938 H 18.168 Z M 13.764 24.322 v -4.923 h 4.404 v 4.923 H 13.764 Z M 19.177 25.306 h 12.667 v 3.938 H 19.177 V 25.306 Z M 19.177 24.322 v -4.923 h 12.667 v 4.923 H 19.177 Z";break;case"user":r[1].pathData="M 21.762 21.935 c 2.584 0 4.687 -2.561 4.687 -5.703 c 0 -3.147 -2.103 -5.703 -4.687 -5.703 c -1.279 0 -2.475 0.61 -3.363 1.721 c -0.855 1.071 -1.327 2.484 -1.324 3.983 C 17.075 19.374 19.178 21.935 21.762 21.935 L 21.762 21.935 Z M 21.762 11.779 c 1.894 0 3.436 1.995 3.436 4.452 c 0 2.453 -1.541 4.452 -3.436 4.452 c -1.895 0 -3.44 -1.999 -3.44 -4.452 C 18.323 13.774 19.864 11.779 21.762 11.779 L 21.762 11.779 Z M 25.699 21.309 c -0.348 0 -0.626 0.277 -0.626 0.626 c 0 0.344 0.277 0.622 0.626 0.622 c 2.136 0 3.875 1.74 3.875 3.879 c 0 0.272 -0.227 0.498 -0.501 0.498 H 14.447 c -0.274 0 -0.497 -0.223 -0.497 -0.498 c 0 -2.139 1.736 -3.879 3.872 -3.879 c 0.344 0 0.625 -0.277 0.625 -0.622 c 0 -0.348 -0.28 -0.626 -0.625 -0.626 c -2.826 0 -5.124 2.297 -5.124 5.126 c 0 0.965 0.784 1.749 1.748 1.749 h 14.626 c 0.964 0 1.748 -0.784 1.748 -1.749 C 30.822 23.606 28.524 21.309 25.699 21.309 L 25.699 21.309 Z M 22.217 9.832 c 0.448 -0.263 0.924 -0.396 1.419 -0.396 c 1.895 0 3.436 1.995 3.436 4.452 c 0 0.439 -0.048 0.873 -0.143 1.284 c -0.08 0.336 0.128 0.672 0.464 0.751 c 0.048 0.012 0.098 0.019 0.143 0.019 c 0.284 0 0.541 -0.195 0.608 -0.483 c 0.119 -0.506 0.18 -1.034 0.18 -1.571 c 0 -3.147 -2.102 -5.703 -4.687 -5.703 c -0.711 0 -1.419 0.198 -2.054 0.573 c -0.296 0.174 -0.397 0.559 -0.219 0.855 C 21.536 9.911 21.921 10.009 22.217 9.832 L 22.217 9.832 Z M 27.697 18.81 c -0.345 0 -0.626 0.277 -0.626 0.622 c 0 0.348 0.281 0.626 0.626 0.626 c 2.137 0 3.75 1.782 3.75 3.918 c 0 0.07 -0.013 0.141 -0.043 0.205 c -0.14 0.314 0.003 0.684 0.318 0.823 c 0.082 0.037 0.167 0.055 0.253 0.055 c 0.241 0 0.466 -0.141 0.57 -0.373 c 0.101 -0.226 0.153 -0.464 0.153 -0.714 C 32.699 21.15 30.523 18.81 27.697 18.81 L 27.697 18.81 Z M 27.697 18.81";break;case"script":r[1].pathData="M 22.453 15.04 c 0 0 -1.194 -3.741 2.548 -3.774 c 0 0 2.497 0.126 1.766 4.321 c -0.008 0.043 -0.015 0.086 -0.024 0.13 c -0.806 4.323 -2.516 8.42 -3.193 10.581 h 3.904 c 0 0 0.983 4.581 -2.549 4.968 H 13.292 c 0 0 -3.097 -1.42 -1.517 -5.323 l 3 -10.839 H 11.84 c 0 0 -1.129 -2.902 1.709 -3.806 l 11.425 -0.032 l -0.73 0.355 l -1.193 1.726 L 22.453 15.04 Z M 22.409 12.597 c 0 0 -0.242 0.483 -0.278 0.98 h -9.098 c 0 0 -0.06 -0.871 0.714 -1.041 L 22.409 12.597 Z M 26.341 27.734 c 0 0 -0.13 2.678 -2.226 1.871 c 0 0 -0.823 -0.565 -0.758 -1.855 L 26.341 27.734 Z M 22.905 15.008 c 0 0 0.653 -0.258 0.709 -1.501 c 0 0 0.145 -1.144 1.483 -0.693 c 0 0 0.808 0.355 0.259 2.404 c 0 0 -2.226 8.5 -3.032 10.339 c 0 0 -1.064 2.646 0.096 4.226 h -8.581 c 0 0 -1.806 -0.452 -0.741 -3.613 c 0 0 2.935 -9.549 3.193 -11.162 L 22.905 15.008 Z"}i.task.call&&(r[0].borderWidth=4);i.task.compensation&&i.task.loop!="none"&&(r[2].addInfo.margin.left-=r[2].width/2+2,r[3].addInfo.margin.left+=r[3].width/2+2)}else if(i.activity==t.datavisualization.Diagram.BPMNActivity.SubProcess){var w=0,a=0,s=2;if(i.subProcess.collapsed)r[4].constraints=h|t.datavisualization.Diagram.NodeConstraints.PointerEvents,r[4].visible=!0,r[4].pathData="M 8.13789 15 H 0 V 0 H 8.13789 V 15 Z M 0.625991 13.75 H 7.51189 V 1.25 H 0.625991 V 13.75 Z M 2.18095 7.03125 L 5.95631 7.03125 L 5.95631 7.46875 L 2.18095 7.46875 Z M 3.8342 3.73 L 4.30369 3.73 L 4.30369 11.2687 L 3.8342 11.2687 Z";else{for(r[4].constraints=r[4].constraints|t.datavisualization.Diagram.NodeConstraints.PointerEvents,r[4].visible=!0,r[4].pathData="M 8.13789 15 H 0 V 0 H 8.13789 V 15 Z M 0.625991 13.75 H 7.51189 V 1.25 H 0.625991 V 13.75 Z M 2.18095 7.03125 L 5.95631 7.03125 L 5.95631 7.46875 L 2.18095 7.46875 Z M 3.8342 3.73 L 4.30369 3.73 L 4.30369 11.2687 L 3.8342 11.2687 Z",r[0]=n.extend(!0,r[0],{marginLeft:-i.paddingLeft,marginRight:-i.paddingRight,marginTop:-i.paddingTop,marginBottom:-i.paddingBottom,minWidth:i.width,minHeight:i.height}),i.constraints=i.constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop,i.minWidth=i.width,i.minHeight=i.height;e<c.length;)c[e].type!="bpmn"&&c.splice(e,1),e++;r=r.concat(c)}switch(i.subProcess.boundary){case"default":r[0].borderWidth=1;r[0].borderDashArray="1 0";break;case"call":r[0].borderWidth=4;r[0].borderDashArray="1 0";break;case"event":r[0].borderWidth=1;r[0].borderDashArray="2 2"}i.subProcess.adhoc?(r[5].visible=!0,r[5].pathData="M 49.832 76.811 v -2.906 c 0 0 0.466 -1.469 1.931 -1.5 c 1.465 -0.031 2.331 1.219 2.897 1.688 s 1.06 0.75 1.526 0.75 c 0.466 0 1.548 -0.521 1.682 -1.208 s 0.083 3.083 0.083 3.083 s -0.76 0.969 -1.859 0.969 c -1.066 0 -1.865 -0.625 -2.464 -1.438 s -1.359 -0.998 -2.064 -0.906 C 50.598 75.467 49.832 76.811 49.832 76.811 Z"):i.subProcess.type=="event"?(r[0].borderWidth=1,r[0].borderDashArray="2 2",this._updateBPMNEventShape(i,r.slice(6,9),i.subProcess.event,i.subProcess.trigger)):i.subProcess.type=="transaction"&&(b={x:3,y:3,width:i.width-3,height:i.height-3},r[0].pathData+=t.datavisualization.Diagram.DefautShapes._updateRoundedRectanglePath(b,12));do r[s].visible&&(r[s].addInfo.margin.left=a+r[s].width/2,a+=r[s].width+2),s++;while(s<6);a-=2;s=2;w=a/2;do r[s].visible&&(r[s].addInfo.margin.left-=w),s++;while(s<6)}return r},_updateRoundedRectanglePath:function(n,t){for(var u="",i=0,r=[{x:n.x||0,y:n.y||0},{x:n.x||0,y:n.height},{x:n.width,y:n.height},{x:n.width,y:n.y||0}],f=[{x:t,y:t},{x:t,y:-t},{x:-t,y:-t},{x:-t,y:t}],i=0;i<r.length;i++)u+=u?"L":"M",u+=r[i].x+(i%2==0?f[i].x:0)+","+(r[i].y+(i%2!=0?f[i].y:0)),u+="C"+r[i].x+","+r[i].y+" "+r[i].x+","+r[i].y,u+=" "+(r[i].x+(i%2!=0?f[i].x:0))+","+(r[i].y+(i%2==0?f[i].y:0));return u+="L"+(r[0].x+f[0].x)+","+r[0].y,u+"Z"},initBPMNAnnotationShape:function(i,r){var u=[],c=0,o,v,f,e;if(i._annotation&&i._annotation.length)while(c<i._annotation.length)if(o=r.nameTable[i._annotation[c++]],o&&o.name.split("annotation_")[0]!=i.name)i._annotation.splice(--c,1);else if(o)u.push(o);else break;if(i.annotation&&i.annotation.text){if(i=n.extend(!0,{},t.datavisualization.Diagram.BPMNTextAnnotationDefaults,i),!u.length){var s=t.datavisualization.Diagram.PortVisibility.Hidden,h=t.datavisualization.Diagram.PortConstraints.None,y=[{offset:{x:0,y:.5},name:"left",visibility:s,constraints:h},{offset:{x:.5,y:0},name:"top",visibility:s,constraints:h},{offset:{x:1,y:.5},name:"right",visibility:s,constraints:h},{offset:{x:.5,y:1},name:"bottom",visibility:s,constraints:h}],l=i.name+"annotation_"+t.datavisualization.Diagram.Util.randomId(),a=i.name+"annotation_"+t.datavisualization.Diagram.Util.randomId(),p=t.datavisualization.Diagram.NodeConstraints.Default&~t.datavisualization.Diagram.NodeConstraints.Connect,w=t.datavisualization.Diagram.ConnectorConstraints.Default&~(t.datavisualization.Diagram.ConnectorConstraints.DragSourceEnd|t.datavisualization.Diagram.ConnectorConstraints.Drag);i._annotation&&i._annotation.length?(l=typeof i._annotation[0]=="string"?i._annotation[0]:i._annotation[0].name,a=typeof i._annotation[1]=="string"?i._annotation[1]:i._annotation[1].name):i._annotation=[];u.push({name:l,labels:[{text:i.annotation.text}],annotation:i.annotation,type:"bpmn",shape:"annotation",_type:"node",_shape:"path",ports:y,constraints:p,width:i.annotation.width,height:i.annotation.height,_preventStretch:!0});u.push({name:a,labels:[{readOnly:!0}],type:"connector",segments:[{type:"straight"}],targetDecorator:{shape:"none"},sourceNode:u[0].name,targetNode:i.name,constraints:w,annotation:i.annotation,_isAnnotationLine:!0})}u[0].offsetX=i.offsetX+i.annotation.length*Math.cos(-i.annotation.angle*(Math.PI/180));u[0].offsetY=i.offsetY+i.annotation.length*Math.sin(-i.annotation.angle*(Math.PI/180));v=[{fillColor:"transparent",borderColor:i.borderColor,rotateAngle:i.rotateAngle,opacity:i.opacity,ports:[]},{lineColor:i.borderColor,opacity:i.opacity}];n.extend(!0,u,v);f=r.nameTable[u[0].name];e=r.nameTable[u[1].name];f||(f=r._getNewNode(u[0]),r.nameTable[f.name]=f,i._annotation.splice(0,1,f.name));e||(e=r._getNewConnector(u[1]),r.nameTable[e.name]=e,i._annotation.splice(1,1,e.name));this.updateBPMNAnnotationShape(e,f,null,i,r)}return i},renderBPMNAnnotationShape:function(n,i){var u,r,f,e;if(n._annotation&&n._annotation.length)for(u=0;u<n._annotation.length;u++)r=typeof n._annotation[u]=="string"?i.nameTable[n._annotation[u]]:n._annotation[u],r&&(i.nameTable[r.name]=r,f=i.getObjectType(r),f=="node"?t.datavisualization.Diagram.DiagramContext.renderNode(r,i):f=="connector"&&(e=i._disableSegmentChange,i._disableSegmentChange=!1,i._updateEdges(r),i._dock(r,i.nameTable),t.datavisualization.Diagram.DiagramContext.renderConnector(r,i),i._disableSegmentChange=e))},updateBPMNAnnotationShape:function(i,r,u,f,e){var a,l,v;if(e.getObjectType(i)=="connector"&&i._isAnnotationLine){u&&e.nameTable[u]&&(a=e.nameTable[u],n.extend(!0,a,t.datavisualization.Diagram.BPMNTextAnnotationDefaults),delete a._annotation);f||(f=e.nameTable[i.targetNode]);var o=t.datavisualization.Diagram.Util.bounds(r),s=20,h=20,c;c=f?t.datavisualization.Diagram.Util.bounds(f):{x:i.targetPoint.x,y:i.targetPoint.y,width:i.lineWidth,height:i.lineWidth};l="";o.x<=c.x+c.width&&o.x+o.width>=c.x&&(o.y+o.height<c.y&&(l="bottom"),o.y>c.y+c.height&&(l="top"));l||(o.x>c.x+c.width&&(l="left"),o.x+o.width<c.x&&(l="right"));l||i.annotation.direction||(l="left");i.annotation.direction=l;r.labels[0].horizontalAlignment=r.labels[0].verticalAlignment=r.labels[0].textAlign="center";switch(i.annotation.direction){case"left":h=o.height;r.pathData="M"+s+","+h+" L0,"+h+" L0,0 L"+s+",0";r.labels[0].horizontalAlignment="left";r.labels[0].textAlign="left";r.labels[0].offset=t.datavisualization.Diagram.Point(.05,.5);break;case"right":h=o.height;s=o.width-20;r.pathData="M"+s+","+h+" L"+(s+20)+","+h+" L"+(s+20)+",0 L"+s+",0";r.labels[0].horizontalAlignment="right";r.labels[0].textAlign="right";r.labels[0].offset=t.datavisualization.Diagram.Point(.95,.5);break;case"top":s=o.width;r.pathData="M"+s+","+h+" L"+s+",0 L0,0 L0,"+h;r.labels[0].verticalAlignment="top";r.labels[0].offset=t.datavisualization.Diagram.Point(.5,0);break;case"bottom":h=o.height-20;s=o.width;r.pathData="M"+s+","+h+" L"+s+","+(h+20)+" L0,"+(h+20)+" L0,"+h;r.labels[0].verticalAlignment="bottom";r.labels[0].offset=t.datavisualization.Diagram.Point(.5,1)}e.nameTable[i.name]&&(v=e._disableSegmentChange,e._disableSegmentChange=!1,i.annotation.direction=i.sourcePort=l,e._updateEdges(i),e._dock(i,e.nameTable),e._disableSegmentChange=v);t.datavisualization.Diagram.DiagramContext.update(r,e)}},translateBPMNAnnotationShape:function(i,r,u,f,e){var h,c,p,w,v,y,b,k;if(i.annotation&&i.shape!="annotation"){if(h=[],i.annotation&&i.annotation.text&&(i=n.extend(!0,{},t.datavisualization.Diagram.BPMNTextAnnotationDefaults,i),i._annotation&&i._annotation.length)){for(c=0;c<i._annotation.length;c++)e.nameTable[i._annotation[c]]&&h.push(e.nameTable[i._annotation[c]]);if(h.length){if(p=r,w=u,f){var p=0,w=0,l=t.Matrix.identity();i.rotateAngle?(t.Matrix.rotate(l,-i.rotateAngle,f.x,f.y),t.Matrix.scale(l,r,u,f.x,f.y),t.Matrix.rotate(l,i.rotateAngle,f.x,f.y)):t.Matrix.scale(l,r,u,f.x,f.y);var o=t.datavisualization.Diagram.Util.bounds(i),d=i.offsetX-f.x,g=i.offsetY-f.y,nt={bottom:{x:i.offsetX,y:o.y},left:{x:o.x+o.width,y:i.offsetY},top:{x:i.offsetX,y:o.y+o.height},right:{x:o.x,y:i.offsetY}},s=nt[h[0].annotation.direction],a=t.Matrix.transform(l,{x:s.x-d,y:s.y-g});a.x!=s.x&&(p=s.x-a.x);a.y!=s.y&&(w=s.y-a.y)}e._translate(h[0],p,w,e.nameTable)}}}else if(i.annotation&&i.shape=="annotation"){for(y=0;y<i.outEdges.length;y++)if(b=e.nameTable[i.outEdges[y]],b._isAnnotationLine){v=b;break}v&&(k=i.targetNode?e.nameTable[i.targetNode]:null,this.updateBPMNAnnotationShape(v,e.nameTable[v.sourceNode],null,k,e))}},updateAnnotationProperties:function(i,r){r.getObjectType(i)=="node"&&(i=r.nameTable[i.outEdges[0]]);var f=r.nameTable[i.targetNode],u=r.nameTable[i.sourceNode];f&&u?(i.annotation.angle=t.datavisualization.Diagram.Util._findAngle({x:u.offsetX,y:u.offsetY},{x:f.offsetX,y:f.offsetY})*-1,i.annotation.length=t.datavisualization.Diagram.Util.findLength({x:f.offsetX,y:f.offsetY},{x:u.offsetX,y:u.offsetY}),u.annotation=f.annotation=n.extend(!0,{},i.annotation),f._annotation=[i.sourceNode,i.name],r.nodes().indexOf(u)>-1&&(t.datavisualization.Diagram.Util.removeItem(r.nodes(),u),t.datavisualization.Diagram.Util.removeItem(r.connectors(),i),r._nodes=n.extend(!0,[],r.nodes()))):u&&(i.annotation.angle=t.datavisualization.Diagram.Util._findAngle({x:u.offsetX,y:u.offsetY},i.targetPoint)*-1,i.annotation.length=t.datavisualization.Diagram.Util.findLength(i.targetPoint,{x:u.offsetX,y:u.offsetY}),u.annotation=n.extend(!0,{},i.annotation),r.nodes().push(u),r.connectors().push(i),r._nodes=n.extend(!0,[],r.nodes()))},updateInlineDecoratorsShape:function(n,i){var r,f,u,e;return n.shape&&n.shape.type=="bpmn"&&n.shape.flow=="message"&&(n._inlineDecorators.length&&(f=n._inlineDecorators.filter(function(t){if(t.name==n.name+"_"+n.shape.message)return t}),f.length&&(r=f[0])),n._inlineDecorators=[],(n.shape.message=="initiatingmessage"||n.shape.message=="noninitiatingmessage")&&(u=t.datavisualization.Diagram.Util._findOffsetOnConnector(n,{segmentOffset:.5},.5,i),e=n.shape.message=="noninitiatingmessage"?"lightgrey":"white",r?(r.offsetX=u.offset.x,r.offsetY=u.offset.y,r.fillColor=e):r=t.datavisualization.Diagram.Node({name:n.name+"_"+n.shape.message,width:25,height:15,offsetX:u.offset.x,offsetY:u.offset.y,fillColor:e,shape:"path",pathData:"M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0",constraints:t.datavisualization.Diagram.NodeConstraints.Delete}),n._inlineDecorators.push(r))),n}};t.datavisualization.Diagram.bpmnHelper={resetNodeMargin:function(n,i,r){var e={marginLeft:n.marginLeft,marginRight:n.marginRight,marginTop:n.marginTop,marginBottom:n.marginBottom},u,o,f;if(t.datavisualization.Diagram.canvasHelper._updateNodeMargin(r,n,i),i&&i._type=="group")for(u=0;u<i.children.length;u++){o=typeof i.children[u]=="string"?r.nameTable[i.children[u]]:i.children[u];for(f in e)e[f]==0&&(o[f]=0)}},updateCanvas:function(n,i){var r,u;i._isUndo||t.datavisualization.Diagram.canvasHelper._updateNodeMargin(i,n,i.nameTable[n.parent]);n.container&&n.container.type==="canvas"&&(t.datavisualization.Diagram.canvasHelper._setSize(i,n,!0),this.updateProcessCollection(n,i),n.parent&&i.nameTable[n.parent]?(r=i.nameTable[n.parent],this.resetNodeMargin(n,r,i),this.updateCanvas(r,i)):t.datavisualization.Diagram.canvasHelper._updateNodeMargin(i,n,i.nameTable[n.parent]),i.nameTable[n.name]&&(u=i._disableSegmentChange,i._disableSegmentChange=!1,i._updateAssociatedConnectorEnds(n,i.nameTable),t.datavisualization.Diagram.DiagramContext.update(n,i),i._disableSegmentChange=u))},updateProcessCollection:function(n,i){var r,f;if(n.shape=="activity"&&n.activity=="subprocess"){for(var u=n.subProcess.processes,r=0,e=i._getChildren(n.children);u&&u.length&&r<u.length;)e.indexOf(u[r].name)==-1?t.datavisualization.Diagram.Util.removeItem(u,u[r]):u[r]=i.nameTable[u[r++].name];for(r=0;r<n.children.length;r++)f=typeof n.children[r]=="string"?i.nameTable[n.children[r]]:n.children[r],f._isInternalShape||u.indexOf(f)!=-1||u.push(f)}},isBPMNContainerChild:function(n,t){if(n&&n.parent){var i=t.nameTable[n.parent];return i&&i.type=="bpmn"&&i.shape!="group"&&i.container?!0:!1}},canMoveOutofBounds:function(n,i,r,u){var e,o,f;return n.getObjectType(i)=="connector"&&(i.sourceNode||i.targetNode)&&(e=n.nameTable[i.sourceNode||i.targetNode],e&&this.isBPMNContainerChild(e,n))?(o=n.nameTable[e.parent],f=t.datavisualization.Diagram.Util.bounds(o),f=t.datavisualization.Diagram.Geometry.rect([f.topLeft,f.topRight,f.bottomRight,f.bottomLeft]),r>=f.x+f.width||r<=f.x||u>=f.y+f.height||u<=f.y?!1:!0):!0},canAllowConnection:function(n,t,i){var r=null;if(t&&i&&i.type=="bpmn"){if(i.parent&&(r=n.nameTable[i.parent]),r&&r.type=="bpmn"&&r.shape!="group"&&t.parent!=i.parent)return r;if(n._containsChild(i,t)||n._containsChild(t,i))return null}return i},canAllowDropOnContainer:function(n,t){return t.type!="bpmn"||n.type=="bpmn"&&n.shape!="annotation"?!0:!1}}}(jQuery,Syncfusion),function(n,t){"use strict";var i=function(){function n(n){return this.xmlns="http://www.w3.org/2000/svg",this.document=document.createElementNS(this.xmlns,"svg"),this.id=n.id,n&&t.datavisualization.Diagram.Util.attr(this.document,n),this}return n.prototype.element=function(n,i){var r;return n&&n.id&&(r=this.document.getElementById(n.id)),r||(r=document.createElementNS(this.xmlns,i)),n&&t.datavisualization.Diagram.Util.attr(r,n),r},n.prototype.g=function(n){return this.element(n,"g")},n.prototype.defs=function(n){return this.element(n,"defs")},n.prototype.image=function(n){return this.element(n,"image")},n.prototype.path=function(n){return this.element(n,"path")},n.prototype.text=function(n){return this.element(n,"text")},n.prototype.textPath=function(n){return this.element(n,"textPath")},n.prototype.tspan=function(n){return this.element(n,"tspan")},n.prototype.rect=function(n){return this.element(n,"rect")},n.prototype.ellipse=function(n){return this.element(n,"ellipse")},n.prototype.circle=function(n){return this.element(n,"circle")},n.prototype.title=function(n){return this.element(n,"title")},n.prototype.line=function(n){return this.element(n,"line")},n.prototype.polyline=function(n){return this.element(n,"polyline")},n.prototype.polygon=function(n){return this.element(n,"polygon")},n.prototype.foreignObject=function(n){return this.element(n,"foreignObject")},n.prototype.linearGradient=function(n){return this.element(n,"linearGradient")},n.prototype.radialGradient=function(n){return this.element(n,"radialGradient")},n.prototype.stop=function(n){return this.element(n,"stop")},n.prototype.pattern=function(n){return this.element(n,"pattern")},n.prototype.appendChild=function(n){this.document.appendChild(n)},n.prototype.removeChild=function(n,t){t?t.removeChild(n):this.document.removeChild(n)},n.prototype.getElementById=function(n){return this.document.getElementById(n)},n.prototype.getElementsByClassName=function(n){return this.document.getElementsByClassName(n)},n.prototype.getElementsByTagName=function(n){return this.document.getElementsByTagName(n)},n.prototype.pathBounds=function(n){var f={d:n},r=this.path(f),i=new t.datavisualization.Diagram.Svg({id:"TempSvg"}),u;return document.body.appendChild(i.document),i.document.appendChild(r),u=r.getBBox(),document.body.removeChild(i.document),u},n.prototype.textBounds=function(n,t,i){var u=null,r;return n&&t?(r=this.text(t),r.appendChild(document.createTextNode(n)),this.document.appendChild(r),u=r.getBBox(),this.document.removeChild(r)):i&&(this.document.appendChild(i),u=i.getBBox(),this.document.removeChild(i)),u},n.prototype.absolutePath=function(n){for(var i,s,f,v,y,h,c,l,a,e=t.datavisualization.Diagram.Util.convertPathToArray(n.getAttribute("d")),r=0,u=0,o=0,p=e.length;o<p;++o){if(i=e[o],s=i.pathSegTypeAsLetter,/[MLHVCSQTA]/.test(s))"x"in i&&(r=i.x),"y"in i&&(u=i.y);else{"x1"in i&&(h=r+i.x1);"x2"in i&&(l=r+i.x2);"y1"in i&&(c=u+i.y1);"y2"in i&&(a=u+i.y2);"x"in i&&(r+=i.x);"y"in i&&(u+=i.y);switch(s){case"m":f={pathSegTypeAsLetter:"M",x:r,y:u};break;case"l":f={pathSegTypeAsLetter:"L",x:r,y:u};break;case"h":f={pathSegTypeAsLetter:"H",x:r};break;case"v":f={pathSegTypeAsLetter:"V",y:u};break;case"c":f={pathSegTypeAsLetter:"C",x:r,y:u,x1:h,y1:c,x2:l,y2:a};break;case"s":f={pathSegTypeAsLetter:"S",x:r,y:u,x2:l,y2:a};break;case"q":f={pathSegTypeAsLetter:"Q",x:r,y:u,x1:h,y1:c};break;case"t":f={pathSegTypeAsLetter:"T",x:r,y:u};break;case"a":f={pathSegTypeAsLetter:"A",x:r,y:u,r1:i.r1,r2:i.r2,angle:i.angle,largeArcFlag:i.largeArcFlag,sweepFlag:i.sweepFlag};break;case"z":case"Z":r=v;u=y;f=e[o]}f&&(e[o]=f)}(s==="M"||s==="m")&&(v=r,y=u)}return n.setAttribute("d",t.datavisualization.Diagram.Util.pathSegArrayAsString(e)),n},n}();t.datavisualization.Diagram.Svg=i;t.datavisualization.Diagram.SvgContext={_renderDocument:function(n,i,r){var f,u;window.SVGSVGElement&&(f={id:n.canvas.id+"_svg",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:"position:absolute","class":"mainview_svg",role:"img"},t.isMobile()&&(f.style="position: inherit"),u=r?i._svg:new t.datavisualization.Diagram.Svg(f),n.svg=u,i&&(i._svg=u,r||document.getElementById(u.document.id)||n.canvas.appendChild(u.document),i._view=this._renderView(n.canvas,n.svg,r),i._page=this._renderPage(n.canvas,n.svg,i._view,r),this._renderBackground(i,n.canvas,n.svg,i._page,i.model,r),i._pageBackgroundLayer=this._renderBackgroundLayer(n.canvas,n.svg,i._page,r),this._renderGrid(n.canvas,n.svg,i._page,i),i._diagramLayer=n.diagramLayer=this._renderDiagramLayer(n.canvas,n.svg,i._page),i._htmlLayer=this._renderHtmlLayer(n.canvas,r),this._renderAdornerLayer(i,n.canvas,r,n)))},_renderView:function(n,t,i){var r=t.document.getElementById(n.id+"_view"),u;return r||(u={id:n.id+"_view"},r=t.g(u)),i||t.appendChild(r),r},_renderHtmlLayer:function(n,i){var r=document.getElementById(n.id+"_htmlLayer"),f,u;return r||(r=document.createElement("div")),f={id:n.id+"_htmlLayer","class":"htmlLayer"},t.datavisualization.Diagram.Util.attr(r,f),u=r,r.style.pointerEvents="none",i||n.appendChild(u),u},_renderAdornerLayer:function(n,i,r,u){var f=document.getElementById(i.id+"_adorner"),e;f||(f=document.createElement("div"));e={id:i.id+"_adorner","class":"adornerLayer",style:"position:absolute;left:0px;top:0px"};t.datavisualization.Diagram.Util.attr(f,e);n._adornerLayer=this._renderAdornerSvg(n,i,f,r,u);n._tooltipLayer=this._renderTooltipLayer(i,f,r);r||i.appendChild(f)},_renderTooltipLayer:function(n,i,r){var u=document.getElementById(n.id+"_tooltip"),e,f;return u||(u=document.createElement("div")),e={id:n.id+"_tooltip","class":"diagram_tooltip"},t.datavisualization.Diagram.Util.attr(u,e),f=u,u.style.pointerEvents="none",r||i.appendChild(f),f},_renderPage:function(n,t,i,r){var u=t.document.getElementById(n.id+"_page"),f;return u||(f={id:n.id+"_page","class":"page"},u=t.g(f)),r||i.appendChild(u),u},_renderDiagramLayer:function(n,t,i){var r=t.document.getElementById(n.id+"_diagramLayer"),u;return r||(u={id:n.id+"_diagramLayer","class":"DiagramLayer"},r=t.g(u),i.appendChild(r)),r},_renderAdornerSvg:function(n,i,r,u,f){var e,s,h,o;if(window.SVGSVGElement)return o={id:i.id+"_svg_adorner",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:"position:absolute",fill:"none","pointer-events":"none"},e=u?n._adornerSvg:new t.datavisualization.Diagram.Svg(o),u||document.getElementById(e.document.id)||r.appendChild(e.document),s=e.document.getElementById(i.id+"_expander"),s||(o={id:i.id+"_expander","class":"ExpanderLayer","pointer-events":"all"},s=e.g(o),e.document.appendChild(s)),f._expander=n._expander=s,h=e.document.getElementById(i.id+"_adornerLayer"),h||(o={id:i.id+"_adornerLayer","class":"AdornerLayer","pointer-events":"none"},h=e.g(o),e.document.appendChild(h)),n._adornerSvg=e,h},_renderBackgroundLayer:function(n,t,i,r){var u=t.document.getElementById(n.id+"_pageBackground"),f;return u||(f={id:n.id+"_pageBackground","class":"PageBackgroundLayer",style:"pointer-events:none;"},u=t.g(f)),r||i.appendChild(u),u},_renderBackground:function(n,i,r,u){var c,l,s;r.document.style.msTouchAction="none";r.document.style.display="block";r.document.style.backgroundColor="white";var h={id:i.id+"_backgroundLayer"},f=r.g(h),e=n._getDigramBounds();if(n._backgroundImage()){var o=n._backgroundImage(),a=t.datavisualization.Diagram.Util._getImageAlignment(o.alignment),v="none "+a!="none"&&o.scale!="none"?a+" "+o.scale:"none";h={id:i.id+"_backgroundImage",x:e.x,y:e.y,width:e.width,height:e.height,preserveAspectRatio:v,"pointer-events":"none"};c=r.image(h);c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o.source);r.getElementById(i.id+"_backgroundImage")||f.appendChild(c)}l=n._backgroundColor();s=r.rect({id:i.id+"_backgroundColor",width:"100%",height:"100%",fill:l,preserveAspectRatio:"none","pointer-events":"none"});l?r.getElementById(i.id+"_backgroundColor")||f.appendChild(s):r.getElementById(s.id)&&f.removeChild(r.getElementById(s.id));r.getElementById(f.id)||u.appendChild(f)},_renderGrid:function(n,i,r,u){var h=u._svg.document.getElementById(n.id+"patterndefinition"),o,c,l,a,e,f,v,s;if(h||(h=i.defs({id:n.id+"patterndefinition"}),i.appendChild(h)),u._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.ShowHorizontalLines||u._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.ShowVerticalLines){var s=document.getElementById(n.id+"_grid"),v=document.getElementById(n.id+"pattern_gridline"),f=document.getElementById(n.id+"pattern_grid");f&&f.parentNode&&f.parentNode.removeChild(f);c={id:n.id+"_grid","pointer-events":"none"};o=i.g(c);l=0;u.model.snapSettings.horizontalGridLines.linesInterval&&u.model.snapSettings.horizontalGridLines.linesInterval.forEach(function(n){l+=n});a=0;u.model.snapSettings.verticalGridLines.linesInterval&&u.model.snapSettings.verticalGridLines.linesInterval.forEach(function(n){a+=n});e=this._scaleSnapInterval(u.model,u._currZoom);c={id:n.id+"pattern_grid",x:0,y:0,width:a*e,height:l*e,patternUnits:"userSpaceOnUse"};f=i.pattern(c);e=this._scaleSnapInterval(u.model,e);this._renderHorizontalGridlines(e,f,a,u,i);this._renderVerticalGridlines(e,f,l,u,i);h.appendChild(f);v=i.rect({id:n.id+"pattern_gridline",x:u._hScrollOffset,y:u._vScrollOffset,width:"100%",height:"100%",fill:"url(#"+n.id+"pattern_grid)"});o.appendChild(v);s||(u._diagramLayer?r.insertBefore(o,u._diagramLayer):r.appendChild(o))}else o=document.getElementById(n.id+"_grid"),o&&(s=document.getElementById(n.id+"pattern_gridline"),s&&s.parentNode&&s.parentNode.removeChild(s))},_updateBackground:function(n,i,r,u){var s={x:n,y:i},o=document.getElementById(u._id+"_canvas_backgroundColor"),e,f;o&&t.datavisualization.Diagram.Util.attr(o,s);e=document.getElementById(u._id+"_canvas_backgroundImage");f=u._getDigramBounds();e&&t.datavisualization.Diagram.Util.attr(e,{transform:"scale("+r+")",x:f.x,y:f.y,width:f.width,height:f.height})},_updateGrid:function(n,i,r,u){var l=document.getElementById(u._canvas.id+"pattern_gridline"),f,e,o,s,a,c,h;if(l){if(e=document.getElementById(u._canvas.id+"pattern_grid"),o=0,u.model.snapSettings.horizontalGridLines.linesInterval)for(f=0;f<u.model.snapSettings.horizontalGridLines.linesInterval.length;f++)o+=u.model.snapSettings.horizontalGridLines.linesInterval[f];if(s=0,u.model.snapSettings.verticalGridLines.linesInterval)for(f=0;f<u.model.snapSettings.verticalGridLines.linesInterval.length;f++)s+=u.model.snapSettings.verticalGridLines.linesInterval[f];h={x:n,y:i};t.datavisualization.Diagram.Util.attr(l,h);r=this._scaleSnapInterval(u.model,r);a=u._svg;c=a.defs({id:u._canvas.id+"patterndefinition"});e&&c.removeChild(e);h={id:u._canvas.id+"pattern_grid",x:0,y:0,width:s*r,height:o*r,patternUnits:"userSpaceOnUse"};e=u._svg.pattern(h);this._renderHorizontalGridlines(r,e,s,u,u._svg);this._renderVerticalGridlines(r,e,o,u,u._svg);c.appendChild(e)}},_scaleSnapInterval:function(n,t){if(t>=2)while(t>=2)t/=2;else if(t<=.5)while(t<=.5)t*=2;var i;if(t!==1){for(n.snapSettings.horizontalGridLines._snapinterval=[],i=0;i<n.snapSettings.horizontalGridLines.snapInterval.length;i++)n.snapSettings.horizontalGridLines._snapinterval[i]=n.snapSettings.horizontalGridLines.snapInterval[i]*t;for(n.snapSettings.verticalGridLines._snapinterval=[],i=0;i<n.snapSettings.verticalGridLines.snapInterval.length;i++)n.snapSettings.verticalGridLines._snapinterval[i]=n.snapSettings.verticalGridLines.snapInterval[i]*t}return t},_renderHorizontalGridlines:function(n,i,r,u,f){var a=u.model,o=a.snapSettings,s,c,e,h,l;if(u._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.ShowHorizontalLines)for(s=0,c=0,e=0;e<o.horizontalGridLines.linesInterval.length;e=e+2)h=o.horizontalGridLines.linesInterval[e],l=f.line({x1:0,y1:s*n,x2:r*n,y2:s*n,stroke:o.horizontalGridLines.lineColor,"stroke-width":h,"stroke-dasharray":o.horizontalGridLines.lineDashArray}),s+=o.horizontalGridLines.linesInterval[e+1]+h,i.appendChild(l),c++},_renderVerticalGridlines:function(n,i,r,u,f){var c=u.model,o=c.snapSettings,s,l,e,h,a;if(o.snapConstraints&t.datavisualization.Diagram.SnapConstraints.ShowVerticalLines)for(s=0,l=0,e=0;e<o.verticalGridLines.linesInterval.length;e=e+2)h=c.snapSettings.verticalGridLines.linesInterval[e],a=f.line({x1:s*n,y1:0,x2:s*n,y2:r*n,stroke:o.verticalGridLines.lineColor,"stroke-width":h,"stroke-dasharray":o.verticalGridLines.lineDashArray}),s+=o.verticalGridLines.linesInterval[e+1]+h,i.appendChild(a),l++},transformView:function(n,i,r){var f=n._view,u={transform:"translate("+i+","+r+")"};t.datavisualization.Diagram.Util.attr(f,u);t.datavisualization.Diagram.Util.attr(n._adornerLayer,u);t.datavisualization.Diagram.Util.attr(n._expander,{transform:"translate("+i+","+r+"),scale("+n.model.scrollSettings.currentZoom+")"});n._htmlLayer&&(n._htmlLayer.style.left=i+"px",n._htmlLayer.style.top=r+"px",n._htmlLayer.style.position="absolute")},scaleContent:function(n,i){var e=n._diagramLayer,u,f,r;t.datavisualization.Diagram.Util.attr(e,{transform:"scale("+i+")"});u=typeof n.model.scrollSettings.horizontalOffset=="function"?n.model.scrollSettings.horizontalOffset():n.model.scrollSettings.horizontalOffset;f=typeof n.model.scrollSettings.verticalOffset=="function"?n.model.scrollSettings.verticalOffset():n.model.scrollSettings.verticalOffset;t.datavisualization.Diagram.Util.attr(n._expander,{transform:"translate("+-u+","+-f+"),scale("+i+")"});n._htmlLayer&&(n._htmlLayer.style.webkitTransform="scale("+i+")",n._htmlLayer.style.MozTransform="scale("+i+")",n._htmlLayer.style.OTransform="scale("+i+")",n._htmlLayer.style.msTransform="scale("+i+")",n._htmlLayer.style.transform="scale("+i+")");n.selectionList.length>0&&this.updateSelector(n.selectionList[0],n._adornerSvg,i,n,n.model.selectedItems.constraints);n.selectionList[0]&&n.model.selectedItems.userHandles&&n.model.selectedItems.userHandles.length>0&&(r=!1,n.selectionList[0].type=="pseudoGroup"&&(r=!0),n.model.selectedItems.constraints&t.datavisualization.Diagram.SelectorConstraints.UserHandles&&t.datavisualization.Diagram.SvgContext.updateUserHandles(n.model.selectedItems.userHandles,n.selectionList[0],n._adornerSvg,r,!1,i,n))},setSize:function(n,i,r){t.datavisualization.Diagram.Util.attr(n._svg.document,{width:i+"px",height:r+"px"});t.datavisualization.Diagram.Util.attr(n._adornerSvg.document,{width:i+"px",height:r+"px"})},_findIndex:function(t,i){var r,f=1,e,u;return u=i.parent?n("#"+i.parent.name).find(">.node,>.connector,>.group"):n("#DiagramContent_canvas_svg").find(">.node,>.connector,>.group"),i.name!="helper"&&(r=u[u.length-1],r&&r.id=="helper"&&(r=u[u.length-2]),r&&(e=0,r.className.animVal=="ej-d-node"||r.className.animVal=="ej-d-group"?f=e+1:r.className.animVal=="ej-d-connector"&&(f=e+1))),f},renderNode:function(n,i,r,u,f){var e,v=n.width?n.width:n._width||0,y=n.height?n.height:n._height||0,p=n.name,c=0,l=0,o=0,s=0,a=0,w=n.visible?"visible":"hidden",h;return u||(o=n.offsetX-v*n.pivot.x,s=n.offsetY-y*n.pivot.y,c=n.offsetX,l=n.offsetY,a=n.rotateAngle),t.datavisualization.Diagram.Util.canCrispEdges(n,f)&&(o=Math.floor(o)+.5,s=Math.floor(s)+.5),h={id:p,"class":"ej-d-node",transform:"rotate("+a+","+c+","+l+"),translate("+o+","+s+")",visibility:w},t.datavisualization.Diagram.Util.canEnablePointerEvents(n,f)||(h.style="pointer-events:none"),n._isClassifier&&(h["class"]+=" ej-d-classifier"),e=i.g(h),r?r.appendChild(e):i.appendChild(e),n._isDisabled&&t.datavisualization.Diagram.Util.attr(e,{style:"pointer-events:none;"}),this._renderNode(n,i,e,f,u),n&&n.annotation&&t.datavisualization.Diagram.DefautShapes.renderBPMNAnnotationShape(n,f),n._isClassifier&&delete n._isClassifier,e},_renderNode:function(n,t,i,r,u){this._renderShape(n,t,i,r);this._renderLabels(n,t,r,u);this._renderPorts(n,t,i);n.outEdges.length>0&&this._renderIcons(n,r)},_renderShadow:function(n,i){var u,f,r,e,o,s;n.segments||(u=i.document.getElementById(n.name),n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=n.fillColor,n.type==="image"||n.type==="text"||n.type==="html"?r=i.document.getElementById(n.name+"_backRect"):n.type!="text"&&n.type!="image"&&(r=i.document.getElementById(n.name+"_shape")),r&&(e=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),o={id:n.name+"_shadow",width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:f!="none"||f!="transparent"?"lightgrey":"none",transform:"translate("+e.x+","+e.y+")",opacity:n.shadow.opacity,"stroke-dasharray":""},n.type==="native"||n.type==="html"?u.insertBefore(i.rect(o),r):(s=r.cloneNode(!0),u.insertBefore(s,r),t.datavisualization.Diagram.Util.attr(s,o)))))},_updateShadow:function(n,i){var f=i.document.getElementById(n.name),r=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),u={id:n.name+"_shadow",transform:"translate("+r.x+","+r.y+")",opacity:n.shadow.opacity};i.g(u)},_removeShadow:function(n,t){if(n.type!="text"){var i,r,u=n.name;n.type==="bpmn"&&n.children&&n.shape!="group"&&(u=n.children[0].name);i=t.document.getElementById(u);r=t.document.getElementById(u+"_shadow");i&&r&&i.removeChild(r)}},_renderphase:function(n,i,r,u,f){var o,p,s,v,y;o=i.g({id:n.name+"_phase_g","class":"ej-d-seperator"});n.parent?r.appendChild(o):i.appendChild(o);var w="visible",c=0,l=0;if(f){p=u._getChildren(f.children);p.length>1&&(s=u.nameTable[p[0]]);var e=t.datavisualization.Diagram.Util.bounds(f),h=[],a,b=e.top+50,k=e.left+50;n.orientation=="vertical"?(h.push({x:0,y:0}),h.push({x:e.width,y:0}),a=this._convertToSVGPoints(h),c=e.x,l=e.y+n.offset+s.height,s&&(b+=s.height),l<e.bottom&&l>b||(w="hidden")):(h.push({x:0,y:s.height?s.height:0}),h.push({x:0,y:e.height}),a=this._convertToSVGPoints(h),c=e.x+n.offset,l=e.y,c<e.right&&c>k||(w="hidden"));v={id:n.name+"_phase",stroke:n.lineColor,"stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,points:a};y=i.polyline(v);o.appendChild(y);v={id:n.name+"_phase_hitTest","class":"hitTest","stroke-width":10,points:a,stroke:"transparent"};y=i.polyline(v);o.appendChild(y);o.setAttribute("transform","translate("+c+","+l+")")}},renderphase:function(n,t,i,r,u){var f,e;r._views.forEach(function(t){f=r._views[t];e=f.svg||f._canvas;i&&(i=e.document.getElementById(i.id));f.context._renderphase(n,e,i||f.diagramLayer,r,u)})},_renderGroupBackground:function(n,i,r,u){var c,f,y,l;if(n.fillColor!="none"){var e=n.offsetX-n.width*n.pivot.x,o=n.offsetY-n.height*n.pivot.y,s=n.fillColor,a=n.borderColor;(n.type=="bpmn"&&n.shape!="group"||n.classifier&&n.classifier=="package")&&(s="transparent",a="transparent");t.datavisualization.Diagram.Util.canCrispEdges(n,u)&&(e=Math.floor(e)+.5,o=Math.floor(o)+.5);var p=n.rotateAngle,v=new t.datavisualization.Diagram.Point(e+n.width*n.pivot.x,o+n.height*n.pivot.y),h={id:n.name+"_shape",rx:n.cornerRadius,ry:n.cornerRadius,width:Math.round(n.width<0?0:n.width),height:Math.round(n.height<0?0:n.height),fill:s,stroke:a,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,transform:"rotate("+p+","+v.x+","+v.y+"),translate("+e+","+o+")"};(n.type=="umlclassifier"||n._isClassifier)&&(h["class"]="ej-d-group ej-d-classifier");n.gradient&&n.type!="bpmn"&&(h.fill=this._renderGradient(n.name,n.gradient,r));this._addCssClass(n,h);c=r.rect(h);i.appendChild(c);n.type==="bpmn"&&n.shape==="group"&&n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),n.shape==="group"&&n.children.length===0&&(f.x=n.offsetX-n.width*n.pivot.x+f.x,f.y=n.offsetY-n.height*n.pivot.y+f.y),y={id:n.name+"_shadow",width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:s!="none"||s!="transparent"?"lightgrey":"none",transform:"translate("+f.x+","+f.y+")",opacity:n.shadow.opacity,"stroke-dasharray":""},l=c.cloneNode(!0),i.insertBefore(l,c),t.datavisualization.Diagram.Util.attr(l,y))}},renderGroup:function(n,i,r,u,f,e,o){var h,b=n.visible?"visible":"hidden",y={id:n.name,"class":"ej-d-group",visibility:b},c,a,w,s,l,p,r,v;if(t.datavisualization.Diagram.Util.canEnablePointerEvents(n,f)||(y.style="pointer-events:none"),(n.type=="umlclassifier"||n._isClassifier)&&(y["class"]+=" ej-d-classifier"),h=i.g(y),r?r.appendChild(h):i.appendChild(h),n.parent==""&&n.container&&(e&&(n.height=0,n.width=0),o||f._updateChildAdjacentConnectors(n)),this._renderGroupBackground(n,h,i,f),n.isSwimlane&&(f._disableSwimlaneUptate=!0),c=n.children,c&&c.length>0)for(a=0,w=c.length;a<w;a++)s=u[t.datavisualization.Diagram.Util.getChild(c[a])],s&&(s._type==="group"?(n.type=="umlclassifier"&&(s._isClassifier=!0),this.renderGroup(s,i,h,u,f,e,o),t.datavisualization.Diagram.Util._updateGroupBounds(s,f,!0),t.datavisualization.Diagram.DiagramContext.update(s,f)):s.segments?(t.datavisualization.Diagram.Util.updateBridging(s,f),this.renderConnector(s,i,h,f)):(n.type=="umlclassifier"&&(s._isClassifier=!0),this.renderNode(s,i,h,undefined,f)));return this._renderLabels(n,i,f),this._renderPorts(n,i,h),n.isSwimlane&&delete f._disableSwimlaneUptate,n&&n.annotation&&t.datavisualization.Diagram.DefautShapes.renderBPMNAnnotationShape(n,f),n&&n.isSwimlane&&(v=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(f,n),f._views.forEach(function(t){var i,u;for(l=f._views[t],p=l.svg||l._canvas,r&&(r=p.document.getElementById(r.id)),i=0;v&&i<v.length;i++)u=f.nameTable[v[i]],u&&l.context._renderphase(u,p,r||l.diagramLayer,f,n)})),n._isClassifier&&delete n._isClassifier,h},_renderGradient:function(n,t,i){var u,r;return t.type==="linear"?(r=this._renderLinearGradient(i.id+"_"+n,t,i),u="url(#"+r+")"):t.type==="radial"&&(r=this._renderRadialGradient(i.id+"_"+n,t,i),u="url(#"+r+")"),u},_checkGradientTag:function(n,t,i){if(t.getElementById(n+"_gradient")){var r=t.getElementById(n+"_gradient");(i&&r.localName==="radialGradient"||!i&&r.localName==="linearGradient")&&r.parentNode.removeChild(r)}},_renderLinearGradient:function(n,t,i){var u=i.document.getElementById(i.document.parentNode.id+"patterndefinition")||i.document.getElementById(n+"patterndefinition"),f,r;return u?(this._checkGradientTag(n,i,!0),f={id:n+"_gradient",x1:t.x1+"%",y1:t.y1+"%",x2:t.x2+"%",y2:t.y2+"%"},r=i.linearGradient(f),this._renderStops(t,i,r),u.appendChild(r),r.id):null},_renderRadialGradient:function(n,t,i){var u=i.document.getElementById(i.document.parentNode.id+"patterndefinition")||i.document.getElementById(n+"patterndefinition"),f,r;return u?(this._checkGradientTag(n,i,!1),f={id:n+"_gradient",cx:t.cx+"%",cy:t.cy+"%",fx:t.fx+"%",fy:t.fy+"%",r:t.r+"%"},r=i.radialGradient(f),this._renderStops(t,i,r),u.appendChild(r),r.id):null},_renderStops:function(n,t,i){var f,r,u,e;if(t.getElementById(i.getAttribute("id"))===i)while(i.firstChild)i.removeChild(i.firstChild);for(f=n.stops,u=0,e=f.length;u<e;u++)r=f[u],i.appendChild(t.stop({offset:r.offset+"%","stop-color":r.color,"stop-opacity":r.opacity}))},_renderShape:function(n,t,i,r){var u=n._shape?n._shape:n.type;switch(u){case"rectangle":this._renderRect(n,t,i);break;case"ellipse":this._renderEllipse(n,t,i);break;case"image":this._renderImage(n,t,i);break;case"path":this._renderPath(n,t,i);break;case"polygon":this._renderPolygon(n,t,i);break;case"text":this._renderTextElement(n,t,i,r);break;case"html":this._renderHtmlElement(n,t,i,r);break;case"native":this._rendercontent(n,t,i,r)}},_renderHTMLTemplate:function(t,i){if(t.templateId&&n.templates)return i._renderEjTemplate("#"+t.templateId,t)},_renderSvgTemplate:function(n,t,i,r){var e=document.createElement("div"),u,o,f;e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g id="tempNative">'+r+"<\/g><\/svg>";document.body.appendChild(e);u=document.getElementById("tempNative").cloneNode(!0);u.id=n.name+"_shape";i.appendChild(u);o={id:n.name+"_shape",fill:n.fillColor,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray};this._addCssClass(n,o);n.gradient&&(o.fill=this._renderGradient(n.name,n.gradient,t));t.g(o);f=this._scaleNodeContent(n,u);f&&u.setAttribute("transform","translate("+f.x+","+f.y+"),scale("+f.sx+","+f.sy+")");u.setAttribute("id",n.name+"_shape");e.parentNode.removeChild(e)},_scaleNodeContent:function(n,t){var u,f,i,r;if(n.scale!="none"){t&&(i=n.type=="html"?t.getBoundingClientRect():t.getBBox());n.type=="html"&&(i.x=i.left,i.y=i.top);u=n.width?n.width:n._width;f=n.height?n.height:n._height;t||(i={x:n.offsetX-n.width*n.pivot.x,y:n.offsetY-n.height*n.pivot.y,width:u,height:f});var e=i.width?u/i.width:1,o=i.height?f/i.height:1,s=i.x*e*-1,h=i.y*o*-1;return n.scale!="stretch"&&n.contentAlignment!="none"?(r=n.scale=="meet"?Math.min(e,o):Math.max(e,o),n.contentAlignment.indexOf("xmid")>-1?s=u/2-i.width*r/2:n.contentAlignment.indexOf("xmax")>-1&&(s=i.x+u-i.width*r),n.contentAlignment.indexOf("ymid")>-1?h=i.y+f/2-i.height*r/2:n.contentAlignment.indexOf("ymax")>-1&&(h=i.y+f-i.height*r),{x:s,y:h,sx:r,sy:r}):{x:s,y:h,sx:e,sy:o}}return null},_rendercontent:function(i,r,u,f){var s,h,c;if(i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow){var e=i.fillColor,o=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},i.shadow.angle,i.shadow.distance),l={id:i.name+"_shadow",width:i.width,height:i.height,stroke:i.borderColor!="none"||i.borderColor!="transparent"?"lightgrey":"none",fill:e!="none"||e!="transparent"?"lightgrey":"none",transform:"translate("+o.x+","+o.y+")",opacity:i.shadow.opacity};u.appendChild(r.rect(l))}!i.segments&&i.templateId&&n.templates&&(s=i.width,h=i.height,i._type!=="node"||i.height||i.width||(i.width=i._width,i.height=i._height),c=f._renderEjTemplate("#"+i.templateId,i),i.width=s,i.height=h,this._renderSvgTemplate(i,r,u,c))},_fill:function(n,t){var i;return n.gradient&&(i=this._renderGradient(n.name,n.gradient,t)),i||(i=n.fillColor),i},_addCssClass:function(n,t){return n.cssClass&&t&&(t["class"]=t["class"]?t["class"]+" "+n.cssClass:n.cssClass),n._cssClass=n.cssClass,t},_updateCssClass:function(n,t){if((n._cssClass!=""||n._cssClass===""&&n.cssClass!=="")&&n._cssClass!==undefined&&n.cssClass!=n._cssClass){var i=t["class"];return i&&(t["class"]=i.replace(n._cssClass,"").trim()),this._addCssClass(n,t)}return t},_renderRect:function(n,i,r){var u=this._fill(n,i),h=n.width?n.width:n._width,c=n.height?n.height:n._height,f={id:n.name+"_shape",rx:n.cornerRadius,ry:n.cornerRadius,role:"presentation",width:h,height:c,fill:u,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray},o,e,s;n._isClassifier&&(o="ej-d-node ej-d-classifier");f["class"]=o;this._addCssClass(n,f);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(e=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),s={id:n.name+"_shadow",rx:n.cornerRadius,ry:n.cornerRadius,width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+e.x+","+e.y+")",opacity:n.shadow.opacity},r.appendChild(i.rect(s)));r.appendChild(i.rect(f))},_renderEllipse:function(n,i,r){var e=n.width?n.width:n._width,o=n.height?n.height:n._height,u=this._fill(n,i),s={id:n.name+"_shape",rx:e/2,ry:o/2,role:"presentation",cx:e/2,cy:o/2,fill:u,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray},f,h;this._addCssClass(n,s);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),h={id:n.name+"_shadow",rx:n.width/2,ry:n.height/2,cx:n.width/2,cy:n.height/2,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+f.x+","+f.y+")",opacity:n.shadow.opacity},r.appendChild(i.ellipse(h)));r.appendChild(i.ellipse(s))},_renderImage:function(n,i,r){var l=n.fillColor,a=this._renderBackgroundRect(n,i,r),o=n.width?n.width:n._width,s=n.height?n.height:n._height,h=t.datavisualization.Diagram.Util._getImageAlignment(n.contentAlignment),c=n.scale=="none"?"meet":n.scale,f={id:n.name+"_shape",opacity:n.opacity,preserveAspectRatio:c!="stretch"&&h!="none"?h+" "+c:"none",width:o,height:s,role:"img"},u=new Image,e;u.src=n.source;n.scale=="none"&&(f.width=u.width||o,f.height=u.height||s);e=i.image(f);e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u.src);r.appendChild(e)},_renderPolygon:function(n,i,r){var u=this._fill(n,i),f,e,o,s;t.datavisualization.Diagram.Geometry.updatePolygonPoints(n);f=this._convertToSVGPoints(n.points);e={id:n.name+"_shape",fill:u,stroke:n.borderColor,role:"presentation","stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,points:f};this._addCssClass(n,e);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(o=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),s={id:n.name+"_shadow",points:f,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+o.x+","+o.y+")",opacity:n.shadow.opacity},r.appendChild(i.polygon(s)));r.appendChild(i.polygon(e))},_renderPath:function(n,i,r){var e=this._fill(n,i),s=n.width?n.width:n._width,h=n.height?n.height:n._height,u,f,o,c;n._absolutePath=n._preventStretch?u=n.pathData:u=t.datavisualization.Diagram.Geometry.updatePath(0,0,s,h,n.pathData,i,null,n);f={id:n.name+"_shape",width:s,height:h,d:u,opacity:n.opacity,role:"presentation","stroke-dasharray":n.borderDashArray,stroke:n.borderColor,"stroke-width":n.borderWidth,fill:e};n._isClassifier&&(f["class"]="ej-d-node ej-d-classifier");this._addCssClass(n,f);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(o=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),c={id:n.name+"_shadow",width:n.width,height:n.height,d:u,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",fill:e!="none"||e!="transparent"?"lightgrey":"none",transform:"translate("+o.x+","+o.y+")",opacity:n.shadow.opacity},r.appendChild(i.path(c)));r.appendChild(i.path(f))},_renderHtmlElement:function(i,r,u,f){var d=this._renderBackgroundRect(i,r,u),c,o,h,l,y,s,p,w,e;if(!i.segments&&i.templateId){e=r.document.parentNode.getElementsByClassName("htmlLayer")[0];c=n(e).children("#"+i.name+"_parentdiv")[0];c&&e.removeChild(c);var a=i.width?i.width:i._width,v=i.height?i.height:i._height,b=i.offsetX-a*i.pivot.x,k=i.offsetY-v*i.pivot.y,o=r.document.getElementById(i.name+"_html");o||(o=document.createElement("div"));h="width:"+a+"px;height:"+v+"px;padding:1px; left:"+b+"px; top:"+k+"px;position:absolute;";h+="display: block; border:0px; pointer-events: all; opacity:"+i.opacity+";";h+="transform:rotate("+i.rotateAngle+"deg)";l={id:i.name+"_html","class":"foreignObject",style:h};this._addCssClass(i,l);t.datavisualization.Diagram.Util.attr(o,l);!i.segments&&i.templateId&&(y=this._renderHTMLTemplate(i,f),o.innerHTML=y);s=document.createElement("div");p={id:i.name+"_parentdiv","class":"ej-d-node"};t.datavisualization.Diagram.Util.attr(s,p);s.appendChild(o);w=i.visible?"visible":"hidden";s.style.visibility=w;e=r.document.parentNode.getElementsByClassName("htmlLayer")[0];e?e.appendChild(s):r.document.parentNode.appendChild(o)}},_initializeGuidelines:function(n,t,i){var r=n.g(t);return i.appendChild(r),r},_renderSideAlignmentLines:function(n,t,i,r,u){var f=r.line({x1:n.x*u,y1:n.y*u,x2:t.x*u,y2:t.y*u,stroke:"#07EDE1","stroke-width":1});i.appendChild(f)},_renderCenterAlignmentLines:function(n,t,i,r,u){var f=r.line({x1:n.x*u,y1:n.y*u,x2:t.x*u,y2:t.y*u,stroke:"#07EDE1","stroke-width":1});i.appendChild(f)},_renderSpacingLines:function(n,t,i,r,u){var e,o,f,s;i&&(f=r.g({}),n.x==t.x?(e="M"+(n.x*u-5)+" "+(n.y*u+5)+" L"+n.x*u+" "+n.y*u+" L"+(n.x*u+5)+" "+(n.y*u+5)+"z",o="M"+(t.x*u-5)+" "+(t.y*u-5)+" L"+t.x*u+" "+t.y*u+" L"+(t.x*u+5)+" "+(t.y*u-5)+"z",f.appendChild(r.line({x1:n.x*u-8,x2:n.x*u+8,y1:n.y*u-1,y2:n.y*u-1,stroke:"#07EDE1","stroke-width":1})),f.appendChild(r.line({x1:t.x*u-8,x2:t.x*u+8,y1:t.y*u+1,y2:t.y*u+1,stroke:"#07EDE1","stroke-width":1}))):(e="M"+(n.x*u+5)+" "+(n.y*u+5)+" L"+n.x*u+" "+n.y*u+" L"+(n.x*u+5)+" "+(n.y*u-5)+"z",o="M"+(t.x*u-5)+" "+(t.y*u-5)+" L"+t.x*u+" "+t.y*u+" L"+(t.x*u-5)+" "+(t.y*u+5)+"z",f.appendChild(r.line({x1:n.x*u-1,x2:n.x*u-1,y1:n.y*u-8,y2:n.y*u+8,stroke:"#07EDE1","stroke-width":1})),f.appendChild(r.line({x1:t.x*u+1,x2:t.x*u+1,y1:t.y*u-8,y2:t.y*u+8,stroke:"#07EDE1","stroke-width":1}))),f.appendChild(r.path({d:e,fill:"#07EDE1"})),s=r.line({x1:n.x*u,y1:n.y*u,x2:t.x*u,y2:t.y*u,stroke:"#07EDE1","stroke-width":.6,fill:"#07EDE1"}),f.appendChild(s),f.appendChild(r.path({d:o,fill:"#07EDE1"})),i.appendChild(f))},_removeGuidelines:function(n,t){t!=null&&n.removeChild(t)},update:function(n,t){t&&!t._isInit&&n._status!=="new"&&(n._status="update");var i=t._svg;n._type==="group"?this.updateGroup(n,i,t):n.segments?this.updateConnector(n,i,t):this.updateNode(n,i,t)},_updateGoupBackground:function(n,i,r){var u=n.offsetX-n.width*n.pivot.x,f=n.offsetY-n.height*n.pivot.y,y=n.rotateAngle,c=new t.datavisualization.Diagram.Point(u+n.width*n.pivot.x,f+n.height*n.pivot.y),l=n.fillColor,a=n.borderColor,p=t.datavisualization.Diagram.NodeConstraints,e,s,h,v,o;(n.type=="bpmn"&&n.shape!="group"||n.classifier&&n.classifier=="package")&&(l="transparent",a="transparent");t.datavisualization.Diagram.Util.canCrispEdges(n,r)&&(u=Math.floor(u)+.5,f=Math.floor(f)+.5);e={id:n.name+"_shape",rx:n.cornerRadius,ry:n.cornerRadius,width:Math.round(n.width<0?0:n.width),height:Math.round(n.height<0?0:n.height),fill:l,stroke:a,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,transform:"rotate("+y+","+c.x+","+c.y+"),translate("+u+","+f+")"};n.shape==="group"&&n.constraints&p.Shadow&&(s=i.document.getElementById(n.name+"_shadow"),h=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),u=n.offsetX-n.width*n.pivot.x+h.x,f=n.offsetY-n.height*n.pivot.y+h.y,v={id:n.name+"_shadow",width:n.width,height:n.height,stroke:n.borderColor!="none"||n.borderColor!="transparent"?"lightgrey":"none",transform:"translate("+u+","+f+")",opacity:n.shadow.opacity,"stroke-dasharray":""},s&&t.datavisualization.Diagram.Util.attr(s,v));n.gradient&&n.type!="bpmn"&&(e.fill=this._renderGradient(n.name,n.gradient,i));o=i.getElementById(n.name+"_shape");o&&(e["class"]=o.getAttribute("class"),this._updateCssClass(n,e),t.datavisualization.Diagram.Util.attr(o,e))},updateGroup:function(n,i,r,u){var l=r._getChildren(n.children),v=n.visible?"visible":"hidden",o="display:block;",s,a,f,e,h,c;for(n.visible||(o="display:none;"),t.datavisualization.Diagram.Util.canEnablePointerEvents(n,r)||(o="pointer-events:none"),i.g({id:n.name,visibility:"visible",style:o}),s=0,a=l.length;s<a;s++)f=r.nameTable[l[s]],f&&(f._type==="group"?this.updateGroup(f,i,r,u):f.segments?(t.datavisualization.Diagram.Util.updateBridging(f,r),this.updateConnector(f,i,r)):this.updateNode(f,i,r,u));if(i.g({id:n.name,visibility:v,style:o}),this._updateGoupBackground(n,i,r),this._updateAssociatedConnector(n,i,r),this._updateLabels(n,i,r),this._updatePorts(n,i),n.isSwimlane&&(e=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(r,n),h=null,e&&e.length>0))for(c=0;c<e.length;c++)h=r.nameTable[r._getChild(e[c])],h&&this._updatephase(h,r,n)},_removephases:function(n,i){var r,u,f;if(n.isSwimlane&&(r=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(i,n),r))for(u=r.length;u>=0;u--)f=i.nameTable[r[u]],this._removePhase(i,f)},_removePhase:function(n,t){t&&n._views.forEach(function(i){var u=n._views[i],f=u.svg||u._canvas,r=f.document.getElementById(t.name+"_phase_g");r&&r.parentNode.removeChild(r)})},_updatePhaseStyle:function(n,t,i){if(n&&t){var r=n.visible?"visible":"hidden";i._svg.g({id:n.name+"_phase_g",visibility:r});t.id=n.name+"_phase";i._svg.g(t)}},_updatephase:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;r.context._updatephase1(n,t,u,i)})},_updatephase1:function(i,r,u,f){var l,o;if(u=u?u:r._svg,f){var s=0,h=0,a=null,c=[],v,e=t.datavisualization.Diagram.Util.bounds(f),y=r._getChildren(f.children);y.length>1&&(l=r.nameTable[y[0]]);var p=e.top+50,w=e.left+50;i.orientation=="vertical"?(s=e.x,h=e.y+l.height+i.offset,l&&(p+=l.height),h-.1<=e.bottom&&h-.1>=p&&(a="translate("+s+","+h+")"),c.push({x:0,y:0}),c.push({x:e.width,y:0}),v=this._convertToSVGPoints(c)):(s=e.x+i.offset,h=e.y,s-.1<=e.right&&s-.1>w&&(a="translate("+s+","+h+")"),l&&(c.push({x:0,y:l.height}),c.push({x:0,y:e.height})),v=this._convertToSVGPoints(c));o={points:v,id:i.name+"_phase"};u.polyline(o);o={points:v,id:i.name+"_phase_hitTest"};u.polyline(o);a&&(o={id:i.name+"_phase_g",transform:a});i.label&&r.model.labelRenderingMode!=t.datavisualization.Diagram.LabelRenderingMode.Svg&&this._updatePhaseLabel(i,i.label,r);u.g(o);u.getElementById(o.id)&&n("#"+o.id).insertAfter(n("#"+o.id)[0].parentNode.lastChild)}},_updatePhaseLabel:function(n,i,r){var f=r._svg,e=r._getPhaseBounds(n),u=f.getElementById(n.name+"_"+i.name);if(u){if(u.setAttribute("fill",i.fontColor),!i.text)return;u.textContent=i.text;e=t.datavisualization.Diagram.Util.bounds(n);this._wrapText(n,e,u,i,f);this._alignTextOnPhase(n,e,u,i,f)}},updateLabelStyle:function(i,r,u,f){var s,e,o;r.templateId||(f&&f.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg?(o={id:i.name+"_"+r.name+"_lblbg",fill:r.fillColor,stroke:r.borderColor,"stroke-width":r.borderWidth,"pointer-events":"none",visibility:r.visible?"visible":"hidden","fill-opacity":r.opacity,"stroke-opacity":r.opacity},u.rect(o),o={id:i.name+"_"+r.name,"class":"ej-d-label","font-family":r.fontFamily,"font-size":r.fontSize,fill:r.fontColor,"text-decoration":r.textDecoration,"font-weight":r.bold?"bold":"normal","font-style":r.italic?"italic":"normal",visibility:r.visible?"visible":"hidden","fill-opacity":r.opacity,"stroke-opacity":r.opacity},e=u.text(o),o["class"]=e.getAttribute("class"),this._updateCssClass(r,o),t.datavisualization.Diagram.Util.attr(e,o)):(s=u.document.parentNode.getElementsByClassName("htmlLayer")[0],e=n(s).find("#"+i.name+"_"+r.name)[0],i&&e&&r&&!r.templateId&&(e.style.fontWeight=r.bold?"bold":"",e.style.fontStyle=r.italic?"italic":"",e.style.visibility=r.visible?"":"hidden",e.style.opacity=r.opacity,e.style.textDecoration=r.textDecoration,e.style.fontFamily=r.fontFamily,e.style.fontSize=r.fontSize+"px",e.style.color=r.fontColor,e.style.backgroundColor=r.fillColor,e.style.borderColor=r.borderColor,e.style.borderWidth=r.borderWidth+"px",e.style.borderStyle="solid",i._isHeader&&(e.style.borderWidth="0px",e.style.backgroundColor="transparent"),o=this._updateCssClass(r,{"class":e.className}),o&&(e.className=o["class"]))))},updatePort:function(n,i,r){var u=r.getElementById(n.name+"_"+i.name),f;u&&(u&&u.parentNode&&u.parentNode.removeChild(u),f=document.getElementById(n.name),u=t.datavisualization.Diagram.SvgContext._renderPort(n,i,r),f.appendChild(u))},_updateNodeStyle:function(i,r){var u,o,s,f,e;i&&r&&(u={},u.opacity=i.opacity,u.fill=i.fillColor,u.stroke=i.borderColor,u["stroke-width"]=i.borderWidth,u["stroke-dasharray"]=i.borderDashArray,i.gradient&&(u.fill=this._renderGradient(i.name,i.gradient,r)),i._type=="node"&&(o=i.type=="text"||i.type=="html"?"_backRect":"_shape",i.type=="html"&&(s=r.document.parentNode.getElementsByClassName("htmlLayer")[0],f=n(s).children("#"+i.name+"_parentdiv")[0].childNodes[0],f&&(f.style.opacity=i.opacity)),f=r.getElementById(i.name+o),f&&(u["class"]=f.getAttribute("class"),this._updateCssClass(i,u),t.datavisualization.Diagram.Util.attr(f,u)),i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(e=r.document.getElementById(i.name+"_shadow"),e&&t.datavisualization.Diagram.Util.attr(e,{fill:i.fillColor!="none"||i.fillColor!="transparent"?"lightgrey":"none"}))))},_updateConnectorStyle:function(n,i){var r,u;n&&i&&(r={},r.opacity=n.opacity,r.stroke=n.lineColor,r["stroke-width"]=n.lineWidth,r["stroke-dasharray"]=n.lineDashArray,u=i.getElementById(n.name+"_segments"),u&&(r["class"]=u.getAttribute("class"),this._updateCssClass(n,r),t.datavisualization.Diagram.Util.attr(u,r)))},updateTargetDecoratorStyle:function(n,i){var r,u;i&&(r={},r.stroke=n.targetDecorator.borderColor,r.fill=n.targetDecorator.fillColor,u=i.getElementById(n.name+"_targetDecorator"),u&&(r["class"]=u.getAttribute("class"),this._updateCssClass(n.targetDecorator,r),t.datavisualization.Diagram.Util.attr(u,r)))},updateSourceDecoratorStyle:function(n,i){var r,u;i&&(r={},r.stroke=n.sourceDecorator.borderColor,r.fill=n.sourceDecorator.fillColor,u=i.getElementById(n.name+"_sourceDecorator"),u&&(r["class"]=u.getAttribute("class"),this._updateCssClass(n.sourceDecorator,r),t.datavisualization.Diagram.Util.attr(u,r)))},updateNode:function(n,t,i){if(t){if(i&&!i._isInit&&n._status!=="new"&&(n._status="update"),this._updateLabels(n,t,i),this._updateNode(n,t,i),n.outEdges.length&&this._updateIcons(n,t,i),n._scaled=!1,i._layoutInAction)return;this._updateAssociatedConnector(n,t,i);i.activeTool.inAction&&(i.activeTool.name==="move"||i.activeTool.name==="rotate")||this._updatePorts(n,t)}},updateTextBlock:function(t,i,r,u){var e=r.document.parentNode.getElementsByClassName("htmlLayer")[0],o=n(e).children("#"+t.name)[0],s=n(o).children("#"+t.name+"_shape_lblbg")[0],f=s.childNodes[0];t&&f&&i&&(f.style.fontWeight=i.bold?"bold":"",f.style.fontStyle=i.italic?"italic":"",f.style.textDecoration=i.textDecoration,f.style.fontFamily=i.fontFamily,f.style.fontSize=i.fontSize+"px",f.style.color=i.fontColor);this._updateTextElement(t,r,u)},_updateAssociatedConnector:function(n,i,r){var u,f;if(n.inEdges&&n.inEdges.length>0)for(u=0,f=n.inEdges.length;u<f;u++)r.nameTable[n.inEdges[u]]&&(r.nameTable[n.inEdges[u]]&&t.datavisualization.Diagram.Util.canBridge(r.nameTable[n.inEdges[u]],r)&&(t.datavisualization.Diagram.Util.updateBridging(r.nameTable[n.inEdges[u]],r),r._updateConnectorBridging(r.nameTable[n.inEdges[u]])),r._disableSegmentChange||t.datavisualization.Diagram.DiagramContext.update(r.nameTable[n.inEdges[u]],r));if(n.outEdges&&n.outEdges.length>0)for(u=0,f=n.outEdges.length;u<f;u++)r.nameTable[n.outEdges[u]]&&(r.nameTable[n.outEdges[u]]&&t.datavisualization.Diagram.Util.canBridge(r.nameTable[n.outEdges[u]],r)&&(t.datavisualization.Diagram.Util.updateBridging(r.nameTable[n.outEdges[u]],r),r._updateConnectorBridging(r.nameTable[n.outEdges[u]])),r._disableSegmentChange||t.datavisualization.Diagram.DiagramContext.update(r.nameTable[n.outEdges[u]],r))},_updateNode:function(i,r,u){var e=i.width?i.width:i._width,o=i.height?i.height:i._height,c=i.offsetX-e*i.pivot.x,l=i.offsetY-o*i.pivot.y,w=i.rotateAngle,a=t.datavisualization.Diagram.Point(i.offsetX,i.offsetY),b=i.visible?"visible":"hidden",v,s,h,f;t.datavisualization.Diagram.Util.canCrispEdges(i,u)&&(c=Math.floor(c)+.5,l=Math.floor(l)+.5);f={id:i.name,transform:"rotate("+w+","+a.x+","+a.y+"),translate("+c+","+l+")",visibility:b};f.style=t.datavisualization.Diagram.Util.canEnablePointerEvents(i,u)?"":"pointer-events:none";r.g(f);v=i._shape?i._shape:i.type;switch(v){case"rectangle":r.rect({id:i.name+"_shape",width:e<0?0:e,height:o<0?0:o});i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"ellipse":r.ellipse({id:i.name+"_shape",rx:e/2,ry:o/2,cx:e/2,cy:o/2});i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.ellipse({id:i.name+"_shadow",rx:i.width/2,ry:i.height/2,cx:i.width/2,cy:i.height/2});break;case"image":this._updateBackgroundRect(i,r);var y=t.datavisualization.Diagram.Util._getImageAlignment(i.contentAlignment),p=i.scale=="none"?"meet":i.scale,f={id:i.name+"_shape",preserveAspectRatio:p!="stretch"&&y!="none"?y+" "+p:"none"};i.scale!="none"&&(f.width=e,f.height=o);r.image(f);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"path":i._preventStretch?s=i._absolutePath=i.pathData:i._scaled||!i._absolutePath?(s=t.datavisualization.Diagram.Geometry.updatePath(0,0,e,o,i.pathData,r,i._absoluteBounds),i._absolutePath=s,i._scaled=!1):s=i._absolutePath;r.path({id:i.name+"_shape",d:s});i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.path({id:i.name+"_shadow",d:s});break;case"polygon":this._updatePolygon(i,r);break;case"text":this._updateTextElement(i,r,u);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"html":this._updateHtmlElement(i,r);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height});break;case"native":h=this._scaleNodeContent(i,n("#"+i.name+"_shape")[0]);f={id:i.name+"_shape",width:i.width,height:i.height};h&&(f.transform="translate("+h.x+","+h.y+"),scale("+h.sx+","+h.sy+")");r.g(f);i.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&r.rect({id:i.name+"_shadow",width:i.width,height:i.height})}},_updateHtmlElement:function(t,i){this._updateBackgroundRect(t,i);var f=t.visible?"visible":"hidden",e=t.width?t.width:t._width,o=t.height?t.height:t._height,s=t.offsetX-e*t.pivot.x,h=t.offsetY-o*t.pivot.y,r,c=i.document.parentNode.getElementsByClassName("htmlLayer")[0],u=n(c).children("#"+t.name+"_parentdiv");u&&(r=n(u).children("#"+t.name+"_html")[0],r&&(r.style.left=s+"px",r.style.top=h+"px",r.style.webkitTransform="rotate("+t.rotateAngle+"deg)",r.style.MozTransform="rotate("+t.rotateAngle+"deg)",r.style.OTransform="rotate("+t.rotateAngle+"deg)",r.style.msTransform="rotate("+t.rotateAngle+"deg)",r.style.transform="rotate("+t.rotateAngle+"deg)",r.style.opacity=t.opacity,r.style.visibility=f));r&&(r.style.width=t.width.toString()+"px",r.style.height=t.height.toString()+"px")},_updatePolygon:function(n,i){t.datavisualization.Diagram.Geometry.updatePolygonPoints(n);i.polygon({id:n.name+"_shape",points:this._convertToSVGPoints(n.points)});n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&i.polygon({id:n.name+"_shadow",points:this._convertToSVGPoints(n.points)})},_convertToSVGPoints:function(n){for(var i="",t=0,r=n.length;t<r;t++)i+=n[t].x+","+n[t].y+" ";return i.trim()},_renderTextElement:function(i,r,u,f){var o,c,l,s,a,e,p;if(f.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){this._renderBackgroundRect(i,r,u);var h=i.textBlock,w=r.getElementById(i.name),b={id:i.name+"_shape_lblbg","class":"ej-d-label","font-family":h.fontFamily,"font-size":h.fontSize,fill:h.fontColor,"text-decoration":h.textDecoration,"font-weight":h.bold?"bold":"normal","font-style":h.italic?"italic":"normal"},o=r.text(b);w.appendChild(o);this._renderLabelSpanElement(o,i,h,r,f,!1)}else if(o=i.textBlock,o){c=r.document.parentNode.getElementsByClassName("htmlLayer")[0];this._renderBackgroundRect(i,r,u);l=document.createElement("div");s=document.createElement("span");t.datavisualization.Diagram.Util.attr(s,{id:i.name,"class":"ej-d-label",style:"display: inline-block; position: absolute; pointer-events: all; line-height: normal; alignment-baseline:middle"});o.bold&&(s.style.fontWeight="bold");o.italic&&(s.style.fontStyle="italic");s.style.textDecoration=o.textDecoration;s.style.fontFamily=o.fontFamily;s.style.fontSize=o.fontSize+"px";s.style.color=o.fontColor;s.textContent=o.text;a="display: inline-block; position: absolute; width: inherit; height: inherit; pointer-events: none; ";t.datavisualization.Diagram.Util.attr(l,{id:i.name+"_shape_lblbg",style:a});l.appendChild(s);e=n(c).children("#"+i.name)[0];e&&c.removeChild(e);e=document.createElement("div");var v=i.width?i.width:i._width,y=i.height?i.height:i._height,k=i.offsetX-v*i.pivot.x,d=i.offsetY-y*i.pivot.y,a="width:"+v+"px; height:"+y+"px; left:"+k+"px; top:"+d+"px; display: block; position: absolute; pointer-events: none; ";t.datavisualization.Diagram.Util.attr(e,{id:i.name,"class":"ej-d-node",style:a});e.style.webkitTransform="rotate("+i.rotateAngle+"deg) ";e.style.MozTransform="rotate("+i.rotateAngle+"deg) ";e.style.OTransform="rotate("+i.rotateAngle+"deg) ";e.style.msTransform="rotate("+i.rotateAngle+"deg)";e.style.transform="rotate("+i.rotateAngle+"deg) ";e.appendChild(l);c&&c.appendChild(e);p=t.datavisualization.Diagram.Util.bounds(i);this._alignTextOnLabel(i,p,s,l,i.textBlock)}},_updateTextElement:function(i,r,u){var s,o,c;if(u.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){this._updateBackgroundRect(i,r);var e=i.textBlock,b=r.getElementById(i.name),p={id:i.name+"_shape_lblbg","class":"ej-d-label","font-family":e.fontFamily,"font-size":e.fontSize,fill:e.fontColor,"text-decoration":e.textDecoration,"font-weight":e.bold?"bold":"normal","font-style":e.italic?"italic":"normal"},k=r.text(p);this._updateLabelSpanElement(i,e,r,u,!1)}else if(this._updateBackgroundRect(i,r),s=r.document.parentNode.getElementsByClassName("htmlLayer")[0],s){var f=this._findChild(s.childNodes,i),w=i.visible?"visible":"hidden",h=t.datavisualization.Diagram.Util.bounds(i),l,a,v,y;f&&(l=h.width,a=h.height,v=i.offsetX-i.width*i.pivot.x,y=i.offsetY-i.height*i.pivot.y,f.style.width=l+"px",f.style.height=a+"px",f.style.left=v+"px",f.style.top=y+"px",f.style.visibility=w,f.style.webkitTransform="rotate("+i.rotateAngle+"deg)",f.style.MozTransform="rotate("+i.rotateAngle+"deg)",f.style.OTransform="rotate("+i.rotateAngle+"deg)",f.style.msTransform="rotate("+i.rotateAngle+"deg)",f.style.transform="rotate("+i.rotateAngle+"deg)");o=n(f).children("#"+i.name+"_shape_lblbg")[0];o&&(c=o.childNodes[0],c.textContent=i.textBlock.text,this._alignTextOnLabel(i,h,c,o,i.textBlock,u))}},_renderBackgroundRect:function(n,i,r){var u=this._fill(n,i),e={id:n.name+"_backRect","class":"backrect",x:0,y:0,width:n.width,height:n.height,fill:u,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray},f,o;this._addCssClass(n,e);n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow&&(f=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance),o={id:n.name+"_shadow","class":"backrect",width:n.width,height:n.height,stroke:"lightgrey",fill:u!="none"||u!="transparent"?"lightgrey":"none",transform:"translate("+f.x+","+f.y+")",opacity:n.shadow.opacity},r.appendChild(i.rect(o)));r.appendChild(i.rect(e))},_updateBackgroundRect:function(n,t){var i=this._fill(n,t),r={id:n.name+"_backRect",x:0,y:0,width:n.width,height:n.height,fill:i,stroke:n.borderColor,"stroke-width":n.borderWidth,opacity:n.opacity,"stroke-dasharray":n.borderDashArray,"class":n.cssClass};t.rect(r)},_hideNode:function(n,t){var i={id:n.name,style:"pointer-events:none;"};t.rect(i)},_showNode:function(n,t){var i={id:n.name,style:"pointer-events:auto;"};t.rect(i)},_removePhasehelper:function(n){n._adornerSvg.getElementById("phase_helper")&&n._adornerSvg.removeChild(n._adornerSvg.getElementById("phase_helper"),n._adornerLayer)},_updatePhaseHelper:function(n,t,i){if(t){var f=n._adornerSvg,r=n._currZoom,u;i.width=i.width<0?1:i.width;i.height=i.height<0?1:i.height;u={id:"phase_helper","class":"helper","pointer-events":"none",width:i.width*r,height:i.height*r};n._adornerSvg.rect(u)}},_phasehelper:function(n,t,i){if(t){var u=n._adornerSvg,r=n._currZoom,f=i.x+i.width/2,e=i.y+i.height/2,o=u.rect({id:"phase_helper","class":"helper","stroke-width":2,"stroke-dasharray":"3,3","pointer-events":"none",width:i.width*r,height:i.height*r,fill:"transparent",stroke:"green",transform:"translate("+(f-i.width/2)*r+","+(e-i.height/2)*r+"),rotate(0,"+i.width/2*r+","+i.height/2*r+")"});n._adornerLayer.appendChild(o)}},_drawContainerHelper:function(n){var i=n.activeTool.helper,c=n._adornerSvg,u=n._currZoom,r,f,e,o,s,h;i&&(r=t.datavisualization.Diagram.Util.bounds(i,!0));f=r.height;e=r.width;o=i.pivot?{x:r.width*i.pivot.x,y:r.height*i.pivot.y}:{x:e/2,y:f/2};s=i.rotateAngle?i.rotateAngle:0;h=c.rect({id:"helper","class":"helper","stroke-width":1,"stroke-dasharray":"3,3","pointer-events":"none",width:e*u,height:f*u,fill:"transparent",stroke:"red",transform:"translate("+r.x*u+","+r.y*u+"),rotate("+s+","+o.x*u+","+o.y*u+")"});n._adornerLayer.appendChild(h)},_updateContainerHelper:function(n){var s,i=n.activeTool.helper,u=n._currZoom,r,f,e,o,h;i&&(r=t.datavisualization.Diagram.Util.bounds(i,!0));f=r.height;e=r.width;o=i.pivot?{x:r.width*i.pivot.x,y:r.height*i.pivot.y}:{x:e/2,y:f/2};n._raiseOffsetPropertyChange(i,r.center.x,r.center.y,!0);n._raiseSizePropertyChange(i,r.width/i.width,r.height/i.height,!0);h=i.rotateAngle?i.rotateAngle:0;s={id:"helper","class":"helper",width:e*u,height:f*u,fill:"transparent",stroke:"red",transform:"translate("+r.x*u+","+r.y*u+"),rotate("+h+","+o.x*u+","+o.y*u+")"};n._adornerSvg.rect(s)},_removeContainerHelper:function(n,t,i){t.getElementById("helper")&&t.removeChild(t.getElementById("helper"),i)},setNodeShape:function(t,i,r,u){var f,e;r?(e=i.getElementById(r.name),f=n(e).find("#"+t.name)[0]):f=i.getElementById(t.name);f&&(n(f).empty(),this._renderNode(t,i,f,u))},setLine:function(t,i,r,u){var f,e;r?(e=i.getElementById(r.name),f=n(e).find("#"+t.name)[0]):f=i.getElementById(t.name);n(f).empty();this.renderConnector(t,i,f,u)},addNodeLabel:function(n,t,i,r,u){this._renderLabels(n,i,u)},renderConnector:function(n,i,r,u){var f,o,h=n.visible?"visible":"hidden",s,e;if(o=t.datavisualization.Diagram.Util.canCrispEdges(n,u)?{id:n.name,"class":"ej-d-connector",visibility:h,opacity:n.opacity,transform:"translate("+.5+","+.5+")"}:{id:n.name,"class":"ej-d-connector",visibility:h,opacity:n.opacity},t.datavisualization.Diagram.Util.canEnablePointerEvents(n,u)||(o.style="pointer-events:none"),f=i.g(o),r?r.id!==f.id&&r.appendChild(f):i.appendChild(f),s=i.g({id:n.name+"segments"}),this._renderSegments(n,i,s,u),f.appendChild(s),this._renderLabels(n,i,u),this._renderDecorators(n,i,f,u),n.shape)for(t.datavisualization.Diagram.DefautShapes.updateInlineDecoratorsShape(n,u),e=0;e<n._inlineDecorators.length;e++)this.renderNode(n._inlineDecorators[e],i,f,undefined,u);return f},_renderSegments:function(n,i,r,u){var h=n.visible&&(u&&u._browserInfo?u._browserInfo.name:t.browserInfo().name)==="msie"?"collapse":"hidden",o=this._findPath(n,u),f={id:n.name+"_hitTest","class":"hitTest","stroke-width":n.lineHitPadding,d:o,stroke:"transparent",visibility:"hidden"},e,s;f["pointer-events"]=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,u)?n.visible?"stroke":"none":"none";e=i.path(f);r.appendChild(e);f={id:n.name+"_segments",d:o,fill:"none",stroke:n.lineColor,"stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,opacity:n.opacity};this._addCssClass(n,f);e=i.path(f);r.appendChild(e);n.shape&&n.shape.type=="umlactivity"&&n.shape.activityFlow=="exception"&&(f={id:n.name+"_Activityflow","class":"umlactivityflow",fill:"none",stroke:n.lineColor,"pointer-events":"none","stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,opacity:n.opacity,d:n._temppath},s=i.path(f),this._addCssClass(n,f),r.appendChild(s))},_findPath:function(n,i){for(var r,k,nt,u,y,c,g,b,w,f,l,tt,a,v,e,s=0;s<n.segments.length;s++){if(r=n.segments[s],r._bridges.length>0)for(k=0;k<r._bridges.length;k++)nt=r._bridges[k],nt._rendered=!1;if(u=r.points,n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&s==0){y={x:r.points[0].x,y:r.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(r.points[0],r.points[1]);c=Math.min(30,c/2);var p=t.datavisualization.Diagram.Geometry.findAngle(r.points[0],r.points[1]),d=t.datavisualization.Diagram.Geometry.transform({x:y.x,y:y.y},p,c),o=t.datavisualization.Diagram.Geometry.transform({x:d.x,y:d.y},p+45,-12),h=t.datavisualization.Diagram.Geometry.transform({x:o.x,y:o.y},p+45,24);g=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?"M"+Math.floor(o.x)+" "+Math.floor(o.y)+" L"+Math.floor(h.x)+" "+Math.floor(h.y):"M"+o.x+" "+o.y+" L"+h.x+" "+h.y}if(n.shape&&n.shape.type=="umlactivity"&&n.shape.activityFlow=="exception"&&s==0){y={x:r.points[0].x,y:r.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(r.points[0],r.points[1]);c=Math.max(30,c/2);var p=t.datavisualization.Diagram.Geometry.findAngle(r.points[0],r.points[1]),d=t.datavisualization.Diagram.Geometry.transform({x:y.x,y:y.y},p,c),o=t.datavisualization.Diagram.Geometry.transform({x:d.x,y:d.y},p+145,9),h=t.datavisualization.Diagram.Geometry.transform({x:o.x,y:o.y},p+225,14);g=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?"M"+Math.floor(o.x)+" "+Math.floor(o.y)+" L"+Math.floor(h.x)+" "+Math.floor(h.y):"M"+h.x+" "+o.y+"L"+h.x+" "+h.y+" L"+o.x+" "+o.y+" L"+o.x+" "+h.y}if(s==0&&(i&&n.sourceNode&&(b=i._findNode(n.sourceNode)),u=this._clipDecorators(n,r,!0,b),r.type=="bezier"&&n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u[0]=t.datavisualization.Diagram.Util._adjustPoint(u[0],r._point1,!0,n.lineWidth)),e=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?"M"+Math.floor(u[0].x)+" "+Math.floor(u[0].y):"M"+u[0].x+" "+u[0].y),s==n.segments.length-1&&(i&&n.targetNode&&(b=i._findNode(n.targetNode)),u=this._clipDecorators(n,r,!1,b)),r.type!="bezier")if(n.cornerRadius>0)for(f=0;f<u.length-1;f++)w=t.datavisualization.Diagram.Geometry.distance(u[f],u[f+1]),w>0&&(v=s<n.segments.length-1||f<u.length-2?w<n.cornerRadius*2?t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!1,w/2):t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!1,n.cornerRadius):u[f+1],(s>0||f>0)&&(w<n.cornerRadius*2?(a=t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!0,w/2),(s<n.segments.length-1||f<u.length-2)&&(v=null)):a=t.datavisualization.Diagram.Util._adjustPoint(u[f],u[f+1],!0,n.cornerRadius)),a&&(e+=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" Q"+Math.floor(u[f].x)+" "+Math.floor(u[f].y)+" "+Math.floor(a.x)+" "+Math.floor(a.y):" Q"+u[f].x+" "+u[f].y+" "+a.x+" "+a.y),v&&(r._bridges.length>0&&(e=this._updateBridging(r,e,f),r.type==="orthogonal"&&(e=this._updateBridging(r,e,f+1))),e+=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" L"+Math.floor(v.x)+" "+Math.floor(v.y):" L"+v.x+" "+v.y));else for(f=0;f<u.length;f++)f>0&&(e=this._updateBridging(r,e,f)+(t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" L"+Math.floor(u[f].x)+" "+Math.floor(u[f].y):" L"+u[f].x+" "+u[f].y));else l=r._endPoint,n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(l=t.datavisualization.Diagram.Util._adjustPoint(r._endPoint,r._point2,!0,n.lineWidth)),n.targetNode&&i&&(tt=i._findNode(n.targetNode),b.borderColor!="none"&&(l=t.datavisualization.Diagram.Util._adjustPoint(l,r._point2,!0,tt.borderWidth/2))),e+=t.datavisualization.Diagram.Util.canCrispEdges(n,i)?" C"+Math.floor(r._point1.x)+" "+Math.floor(r._point1.y)+" "+Math.floor(r._point2.x)+" "+Math.floor(r._point2.y)+" "+Math.floor(l.x)+" "+Math.floor(l.y):" C"+r._point1.x+" "+r._point1.y+" "+r._point2.x+" "+r._point2.y+" "+l.x+" "+l.y}return n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&(e+=g),n.shape&&n.shape.activityFlow=="exception"&&n.shape.type=="umlactivity"&&(e=e,n._temppath=g),e},_updateBridging:function(n,t,i){var f=t,u,r;if(n._bridges.length>0)if(n.type==="straight")for(u=0;u<n._bridges.length;u++)r=n._bridges[u],r._rendered||(f+=" L"+r.startPoint.x+" "+r.startPoint.y,f+=r.path);else if(n.type==="orthogonal")for(u=0;u<n._bridges.length;u++)r=n._bridges[u],r.segmentPointIndex!==i||r._rendered||(f+=" L"+r.startPoint.x+" "+r.startPoint.y,f+=r.path,r._rendered=!0);return f},_refreshSegments:function(n,t,i){this._updateConnector(n,t,i);this._updateDecorators(n,t,i)},_refreshOnlySegments:function(n,t,i){var u=this._findPath(n,i),r=t.document.getElementById(n.name+"_segments");r&&(r.setAttribute("d",u),r=t.document.getElementById(n.name+"_hitTest"),r.setAttribute("d",u))},_clipDecorators:function(n,i,r,u){var f=[],o,c,s,l,h,e;if(!r&&n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None){for(e=0;e<i.points.length;e++)f[e]=i.points[e];o=f[f.length-1];c=f[f.length-2];s=t.datavisualization.Diagram.Geometry.distance(o,c);s=s==0?1:s;l=n.lineWidth;h=t.datavisualization.Diagram.Point();h.x=o.x+l*(c.x-o.x)/s;h.y=o.y+l*(c.y-o.y)/s;u&&u.borderColor!="none"&&(h=t.datavisualization.Diagram.Util._adjustPoint(h,c,!0,u.borderWidth/2));f[f.length-1]=h}else if(r&&n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None){for(e=0;e<i.points.length;e++)f[e]=i.points[e];o=f[0];c=f[1];s=t.datavisualization.Diagram.Geometry.distance(o,c);s=s==0?1:s;l=n.lineWidth;h=t.datavisualization.Diagram.Point();h.x=o.x+l*(c.x-o.x)/s;h.y=o.y+l*(c.y-o.y)/s;i.type=="bezier"&&(h.x=o.x+(i._point1.x-o.x)/s,h.y=o.y+(i._point1.y-o.y)/s);u&&u.borderColor!="none"&&(h=t.datavisualization.Diagram.Util._adjustPoint(h,i.type!="bezier"?c:i._point1,!0,u.borderWidth/2));f[0]=h}else if(r){for(e=0;e<i.points.length;e++)f[e]=i.points[e];u&&u.borderColor!="none"&&(f[0]=t.datavisualization.Diagram.Util._adjustPoint(f[0],f[1],!0,u.borderWidth/2))}else{for(e=0;e<i.points.length;e++)f[e]=i.points[e];u&&u.borderColor!="none"&&(f[f.length-1]=t.datavisualization.Diagram.Util._adjustPoint(f[f.length-1],f[f.length-2],!0,u.borderWidth/2))}return f},_updateConnector:function(n,i,r){var f,u;r&&!r._isInit&&n._status!=="new"&&(n._status="update");f=this._findPath(n,r);i.path({id:n.name+"_segments",d:f});u={id:n.name+"_hitTest",d:f,"stroke-width":n.lineHitPadding};u["pointer-events"]=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,r)?n.isPhase||r._selectedSymbol&&r.selectionList[0]&&r.selectionList[0].name==n.name?"none":n.visible?"stroke":"none":"none";i.path(u);n.shape&&n.shape.type=="umlactivity"&&n.shape.activityFlow=="exception"&&(u={id:n.name+"_Activityflow","class":"umlactivityflow",fill:"none",stroke:n.lineColor,"pointer-events":"none","stroke-width":n.lineWidth,"stroke-dasharray":n.lineDashArray,opacity:n.opacity,d:n._temppath},i.path(u))},updateConnector:function(n,i,r){var f,e,u;if(i&&(f=n.visible?"visible":"hidden",e=t.datavisualization.Diagram.Util.canCrispEdges(n,r)?{id:n.name,visibility:f,opacity:n.opacity,transform:"translate("+.5+","+.5+")"}:{id:n.name,visibility:f,opacity:n.opacity},e.style=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,r)?"":"pointer-events:none",r._animatingLayout||i.g(e),this._updateConnector(n,i,r),this._updateLabels(n,i,r),this._updateDecorators(n,i,r),n.shape))for(t.datavisualization.Diagram.DefautShapes.updateInlineDecoratorsShape(n,r),u=0;u<n._inlineDecorators.length;u++)this.updateNode(n._inlineDecorators[u],i,r)},renderDecorators:function(n,t,i){var r=t.getElementById(n.name);this._renderDecorators(n,t,r,i)},clearDecorators:function(n,t,i){this._updateConnector(n,t,i);var u=t.getElementById(n.name),r=t.getElementById(n.name+"_targetDecorator");r&&t.removeChild(r,u);r=t.getElementById(n.name+"_sourceDecorator");r&&t.removeChild(r,u)},_renderDecorators:function(n,i,r,u){var e,o,s,f,h;n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(f=n.segments[n.segments.length-1],e=f.points[f.points.length-2],o=n.targetPoint,f.type=="bezier"&&(e=f._point2),n.targetNode&&u&&(s=u._findNode(n.targetNode),s&&s.borderColor!="none"&&(o=t.datavisualization.Diagram.Util._adjustPoint(o,e,!0,s.borderWidth/2))),this._renderDecorator(n.name+"_targetDecorator",o,e,n,n.targetDecorator,i,r));n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(f=n.segments[0],e=n.sourcePoint,o=f.points[1],f.type=="bezier"&&(o=f._point1),n.sourceNode&&u&&(h=u._findNode(n.sourceNode),h&&h.borderColor!="none"&&(e=t.datavisualization.Diagram.Util._adjustPoint(e,o,!0,h.borderWidth/2))),this._renderDecorator(n.name+"_sourceDecorator",e,o,n,n.sourceDecorator,i,r))},_renderIcons:function(n,t){var u=n.expandIcon,f=n.collapseIcon,l,i,a;if(u.shape!="none"||f.shape!="none"){var r,v=n.width?n.width:n._width||0,y=n.height?n.height:n._height||0,p=n.name,e=0,o=0,s=0,h=0,c=0,w=n.visible?"visible":"hidden";s=n.offsetX-v*n.pivot.x;h=n.offsetY-y*n.pivot.y;e=n.offsetX;o=n.offsetY;c=n.rotateAngle;l={id:p,transform:"rotate("+c+","+e+","+o+"),translate("+s+","+h+")",visibility:w};i=t._adornerSvg;r=i.g(l);a=i.document.parentNode.getElementsByClassName("ExpanderLayer")[0]||t._expander;a.appendChild(r);u!=undefined&&n.isExpanded&&this._renderIcon(n,i,u,r,t);f==undefined||n.isExpanded||this._renderIcon(n,i,f,r,t)}},_renderIcon:function(n,i,r,u,f){var s,e,u,h,l,a,c,o;if(r!=undefined){if(e=t.datavisualization.Diagram.Util._getIconPosition(r,t.datavisualization.Diagram.Util.bounds(n,!0),!0),r.shape!="path")this._renderExpanderTemplate(n,i,r,u,f,e);else if(r.shape=="path")return u=document.createElementNS("http://www.w3.org/2000/svg","g"),u.setAttribute("id",n.name+"_expander"),u.setAttribute("class","ej-d-icon-template"),h=t.datavisualization.Diagram.Geometry.updatePath(e.x-r.width/2,e.y-r.height/2,r.width,r.height,r.pathData,i),l=n.visible?"visible":"hidden",r._absolutePath=h,r.margin.left&&r.margin.right&&(r.width-=(r.margin.left||0)+(r.margin.right||0)),r.margin.top&&r.margin.bottom&&(r.height-=(r.margin.top||0)+(r.margin.bottom||0)),s={id:n.name+"_pathexpander",x:e.x,y:e.y,width:r.width,height:r.height,fill:r.borderColor,stroke:r.borderColor,"stroke-width":r.borderWidth,visibility:l,d:h},this._addCssClass(u,s),a=i.path(s),u.appendChild(a),u;return r.shape=="image"&&(c=new Image,c.src=r.source,o=i.image(s),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c.src),u.appendChild(o)),o}},_renderExpanderTemplate:function(n,t,i,r,u,f,e){var v=this.construct_template_iconshape(i,n.isExpanded,u),s,h,c,w,b;if(v!="undefined"){e&&r.removeChild(t.document.getElementById(n.name+"_expander"));s=document.createElement("div");s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g id="tempNative">'+v+"<\/g><\/svg>";document.body.appendChild(s);h=document.getElementById("tempNative");c=h.cloneNode(!0);c.id=n.name+"_expander";var o=h.getBBox(),y=i.width,p=i.height,l=o.width?y/o.width:1,a=o.height?p/o.height:1;if(s.parentNode.removeChild(s),r.appendChild(c),w=Math.min(l,a),b=n.visible?"visible":"hidden",i.horizontalAlignment||i.verticalAlignment){var nt={x:i.offset.x,y:i.offset.y};switch(i.horizontalAlignment){case"left":f.x+=0;break;case"center":f.x-=i.width/2;break;case"right":f.x-=i.width}switch(i.verticalAlignment){case"top":f.y+=0;break;case"center":f.y-=i.height/2;break;case"bottom":f.y-=i.height}var k=f.x-o.x*l,d=f.y-o.y*a,g={id:n.name+"_expander","class":"ej-d-icon-template",transform:"translate("+k+","+d+"),scale("+l+","+a+")",x:f.x,y:f.y,width:i.width,height:i.height,fill:i.borderColor,stroke:i.borderColor,"stroke-width":i.borderWidth};t.g(g)}}},construct_template_iconshape:function(n,t,i){var r;if(n.shape){switch(n.shape){case"arrowup":r='<rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><path d="M8.7,7.2L8.9,7h2.2l0.2,0.2l0,0l4.8,4.8h-2.5L10,8.4L6.4,12H3.9L8.7,7.2L8.7,7.2z"/><\/path><\/rect>';break;case"arrowdown":r='<rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><path d="M9,12.2l0.1,0.1h1.7l0.1-0.1l0,0l3.8-3.8h-2L10,11.2L7.2,8.4h-2L9,12.2L9,12.2z"/><\/path><\/rect>';break;case"plus":r='<rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><line style="fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10" x1="6.1" y1="10" x2="13.9" y2="10"/><\/line><line style=" fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10" x1="10" y1="6.1" x2="10" y2="13.9"/><\/line><\/rect>';break;case"minus":r=' <rect x="2.5" y="2.5" width="15" height="15" style="fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10"/><line style="fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10" x1="6.1" y1="10" x2="13.9" y2="10"/><\/line><\/rect>';break;case"template":r=i._renderEjTemplate("#"+n.templateId,n)}return r}},_updateIcons:function(n,t,i){var r=n.expandIcon,u=n.collapseIcon,l,t,w;if(r.shape!="none"||u.shape!="none"){var f,a=n.width?n.width:n._width||0,v=n.height?n.height:n._height||0,y=n.name,e=0,o=0,s=0,h=0,c=0,p=n.visible?"visible":"hidden";s=n.offsetX-a*n.pivot.x;h=n.offsetY-v*n.pivot.y;e=n.offsetX;o=n.offsetY;c=n.rotateAngle;l={id:y,transform:"rotate("+c+","+e+","+o+"),translate("+s+","+h+")",visibility:p};t=i._adornerSvg;f=t.g(l);w=t.document.parentNode.getElementsByClassName("ExpanderLayer")[0]||i._expander;r!=undefined&&n.isExpanded&&this._updateIcon(n,i._adornerSvg,f,r,i);u==undefined||n.isExpanded||this._updateIcon(n,i._adornerSvg,f,u,i)}},_updateIcon:function(n,i,r,u,f){var o,e,s,l,h,c;u!=undefined&&(n._scaled||n._updateExpander)&&(e=t.datavisualization.Diagram.Util._getIconPosition(u,t.datavisualization.Diagram.Util.bounds(n,!0),!0),u.shape!="path"?(n._scaled||n._updateExpander)&&this._renderExpanderTemplate(n,i,u,r,f,e,!0):u.shape=="path"&&(s=t.datavisualization.Diagram.Geometry.updatePath(e.x-u.width/2,e.y-u.height/2,u.width,u.height,u.pathData,i),l=n.visible?"visible":"hidden",u._absolutePath=s,u.margin.left&&u.margin.right&&(u.width-=(u.margin.left||0)+(u.margin.right||0)),u.margin.top&&u.margin.bottom&&(u.height-=(u.margin.top||0)+(u.margin.bottom||0)),o={id:n.name+"_pathexpander",x:e.x,y:e.y,width:u.width,height:u.height,fill:u.borderColor,stroke:u.borderColor,"stroke-width":u.borderWidth,visibility:l,d:s},i.path(o)),u.shape=="image"&&(h=new Image,h.src=u.source,c=i.image(o),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.src),r.appendChild(c)),n._updateExpander=!1)},_renderDecorator:function(n,i,r,u,f,e,o){var c,s,l,a,h=t.datavisualization.Diagram.Size(f.width,f.height),p,w,v,y;switch(f.shape){case"arrow":l=this._constructArrow(i,h);s={id:n,"class":"decorator",d:l,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=1.1*f.borderWidth;break;case"openarrow":l=this._constructArrow(i,h,!0);s={id:n,"class":"decorator",d:l,fill:"transparent",stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=1.1*f.borderWidth;break;case"circle":p=h.width/2;w=h.height/2;s={id:n,"class":"decorator",rx:p,ry:w,cx:i.x+h.width/2,cy:i.y,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.ellipse(s);a=.5*f.borderWidth;break;case"diamond":l=this._constructDiamond(i,h,e);s={id:n,"class":"decorator",x:i.x,y:i.y,width:h.width,height:h.height,d:l,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=.7*f.borderWidth;break;case"path":l=t.datavisualization.Diagram.Geometry.updatePath(i.x,i.y-h.height/2,h.width,h.height,f.pathData,e);f._absolutePath=l;s={id:n,"class":"decorator",x:i.x,y:i.y,width:h.width,height:h.height,d:l,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};this._addCssClass(f,s);c=e.path(s);a=.5*f.borderWidth}c&&(f.borderColor!="none"?(v=t.datavisualization.Diagram.Geometry.findAngle(i,r),y=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},v,a),c.setAttribute("transform","translate("+y.x+","+y.y+"),rotate("+v+" "+i.x+" "+i.y+")")):c.setAttribute("transform","rotate("+t.datavisualization.Diagram.Geometry.findAngle(i,r)+" "+i.x+" "+i.y+")"),o.appendChild(c))},_updateDecorators:function(n,i,r){var f,e,s,u,o,h;n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u=n.segments[n.segments.length-1],o=u.points,f=o[o.length-2],e=n.targetPoint,u.type=="bezier"&&(f=u._point2),n.targetNode&&r&&(s=r._findNode(n.targetNode),s&&s.borderColor!="none"&&(e=t.datavisualization.Diagram.Util._adjustPoint(n.targetPoint,f,!0,s.borderWidth/2))),this._updateDecorator(n.name+"_targetDecorator",e,f,n,n.targetDecorator,i));n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u=n.segments[0],o=u.points,f=n.sourcePoint,e=o[1],u.type=="bezier"&&(e=u._point1),n.sourceNode&&r&&(h=r._findNode(n.sourceNode),h.borderColor!="none"&&(f=t.datavisualization.Diagram.Util._adjustPoint(n.sourcePoint,e,!0,h.borderWidth/2))),this._updateDecorator(n.name+"_sourceDecorator",f,e,n,n.sourceDecorator,i))},_updateDecorator:function(n,i,r,u,f,e){var c,s,h,l,o=t.datavisualization.Diagram.Size(f.width,f.height),y,p,a,v;switch(f.shape){case"arrow":h=this._constructArrow(i,o);s={id:n,d:h};c=e.path(s);l=1.1*f.borderWidth;break;case"openarrow":h=this._constructArrow(i,o,!0);s={id:n,d:h,fill:"transparent",stroke:f.borderColor,"stroke-width":f.borderWidth};c=e.path(s);l=1.1*f.borderWidth;break;case"circle":y=o.width/2;p=o.height/2;s={id:n,rx:y,ry:p,cx:i.x+o.width/2,cy:i.y,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};c=e.ellipse(s);l=.5*f.borderWidth;break;case"diamond":h=this._constructDiamond(i,o,e);s={id:n,x:i.x,y:i.y,width:o.width,height:o.height,d:h,fill:f.fillColor,stroke:f.borderColor,"stroke-width":f.borderWidth};c=e.path(s);l=.7*f.borderWidth;break;case"path":h=t.datavisualization.Diagram.Geometry.updatePath(i.x,i.y-o.height/2,o.width,o.height,f.pathData,e);f._absolutePath=h;s={id:n,d:h};c=e.path(s);l=.5*f.borderWidth}c&&(f.borderColor!="none"?(a=t.datavisualization.Diagram.Geometry.findAngle(i,r),v=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},a,l),c.setAttribute("transform","translate("+v.x+","+v.y+"),rotate("+a+" "+i.x+" "+i.y+")")):c.setAttribute("transform","rotate("+t.datavisualization.Diagram.Geometry.findAngle(i,r)+" "+i.x+" "+i.y+")"))},_constructArrow:function(n,i,r){var u=new t.datavisualization.Diagram.Path;return u.moveTo(n.x+i.width,n.y+i.height/2),u.lineTo(n.x,n.y),u.lineTo(n.x+i.width,n.y-i.height/2),r||u.close(),u.toString()},_constructDiamond:function(n,i){var r=new t.datavisualization.Diagram.Path;return r.moveTo(n.x+i.width,n.y),r.lineTo(n.x+i.width/2,n.y+i.height/2),r.lineTo(n.x,n.y),r.lineTo(n.x+i.width/2,n.y-i.height/2),r.lineTo(n.x+i.width,n.y),r.toString()},_addLabel:function(i,r,u,f,e){var l,p,w,k,d,o,h,v,b,c;if(f&&f.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){if(c=this._renderSVGLabel(i,r,f._svg,f),e!=undefined&&e!=i.labels.length-1&&!(e>i.labels.length-1)&&(l=i.labels[e],l)){var s=f._svg.document.getElementById(i.name+"_"+l.name+"_lblbg"),y=f._svg.document.getElementById(i.name+"_"+r.name+"_lblbg"),a=f._svg.document.getElementById(i.name+"_"+r.name);s&&y&&s.parentNode.insertBefore(y,s);a&&a&&s.parentNode.insertBefore(a,s)}}else o=t.datavisualization.Diagram.Util.bounds(i),p=o.width,w=o.height,k=o.x,d=o.y,v=u.document.parentNode.getElementsByClassName("htmlLayer")[0],h=n(v).children("#"+i.name)[0],b=i._type==="node"?"ej-d-node":i._type==="group"?"ej-d-group":"ej-d-connector",t.datavisualization.Diagram.Util.attr(h,{id:i.name,"class":b}),c=this._renderLabel(i,o,r,h,v,u,p,w,f),e!=undefined&&h.insertBefore(c,h.childNodes[e])},_getCharBoundsValues:function(n,t,i,r,u){var f={id:r.name+"_"+t.name+"temp","class":"ej-d-label","font-family":t.fontFamily,"font-size":12},e=i.text(f),c,l,a,v,y;if(i.document.appendChild(e),c=i.tspan({id:r.name+"_"+t.name+"temp_snap"}),c.textContent=n,e.appendChild(c),l=e.childNodes[0].getComputedTextLength(),f["font-style"]="normal",f["font-weight"]="bold",i.text(f),a=e.childNodes[0].getComputedTextLength(),f["font-style"]="italic",f["font-weight"]="normal",i.text(f),v=e.childNodes[0].getComputedTextLength(),f["font-style"]="italic",f["font-weight"]="bold",i.text(f),y=e.childNodes[0].getComputedTextLength(),i.document.removeChild(e),n==" "){var p=t.text[u-1]&&t.text[u-1]!="\n"?t.text[u-1]:"W",w=t.text[u+1]&&t.text[u+1]!="\n"?t.text[u+1]:"W",o=this._getCharBoundsValues(p,t,i,r,u),s=this._getCharBoundsValues(w,t,i,r,u),h=this._getCharBoundsValues(p+" "+w,t,i,r,u);return{normal:h.normal-(o.normal+s.normal),bold:h.bold-(o.bold+s.bold),italic:h.italic-(o.italic+s.italic),boldItalic:h.boldItalic-(o.boldItalic+s.boldItalic)}}return{normal:l,bold:a,italic:v,boldItalic:y}},_updateHashTableValues:function(n,t,i,r,u){for(var e,f=0;f<n.length;f++)t[n[f]]||(e=n[f]=="\n"?"new_space_line":n[f],t[e]=this._getCharBoundsValues(n[f],i,u,r,f))},_updateHashTable:function(n,i,r,u,f){var e,o,h,s;if(n&&r&&u)if(n.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap||f)(n.text!=""||n.hyperlink!="")&&(o=n.text?n.text:n.hyperlink,e=u._labelHashTable[n.fontFamily],e||(e=u._labelHashTable[n.fontFamily]={}),this._updateHashTableValues(o,e,n,i,r,u));else if(n.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow){for(o=n.text?n.text:n.hyperlink,h=o.split("\n"),s=0;s<h.length;s++){var c=h[s],l=c.split(" "),e=u._labelHashTable[n.fontFamily];e||(e=u._labelHashTable[n.fontFamily]={});this._updateHashTableValues(l,e,n,i,r,u)}e.new_space_line=this._getCharBoundsValues(" ",n,r,i)}},_getSuitableLabelSize:function(n,t,i){t=t=="\n"||t==="."?"new_space_line":t;var r=i._labelHashTable[n.fontFamily][t];return n.bold&&n.italic?r.boldItalic:n.bold?r.bold:n.italic?r.italic:r.normal},_postionConnectorTextElement:function(n,i,r,u,f){var o=0,e=0,h=t.datavisualization.Diagram.Util.bounds(n),s=r.getBBox(),w=this._getCharBoundsValues("W",i,u,n),c=i.horizontalAlignment,l=i.verticalAlignment,p=!1,a,v,y;if(n.segments&&i.relativeMode=="segmentpath"){a=this._getConnectorHandlePosition(i,n,1,f);v=a.position;o=v.x;e=v.y;y=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,i,f,a);l=y.vAlign;c=y.hAlign;p=!0;switch(c){case"left":o=o-s.x+i.margin.left;break;case"right":o=o-s.width-i.margin.right;break;case"stretch":case"center":o=o-s.width/2+i.margin.left-i.margin.right}switch(l){case"top":e=e-s.y+i.fontSize+i.margin.top;break;case"bottom":e=e-s.height+i.fontSize-i.margin.bottom;break;case"stretch":case"center":e=e-s.height/2+i.fontSize+i.margin.top-i.margin.bottom}}else{switch(c){case"left":o=h.width/2+i.margin.left;break;case"right":o=h.width/2-s.width+i.margin.right;break;case"stretch":case"center":o=h.width/2-s.width/2+i.margin.left-i.margin.right}switch(l){case"top":e=h.height/2+s.height/2+i.margin.top;break;case"bottom":e=h.height/2-s.height/2+i.margin.bottom;break;case"stretch":e=h.height/2-s.height/2+i.margin.top-i.margin.bottom;break;case"center":e=h.height/2-s.height/2+i.margin.top-i.margin.bottom}n.segments&&(o+=h.left,e+=h.top)}!i.relativeMode=="segmentpath"&&(o=o*(i.offset.x?i.offset.x/.5:0),e=e*(i.offset.y?i.offset.y/.5:0)+i.fontSize,o=o+(h.center.x-h.width/2),e=e+(h.center.y-h.height/2));this._updateLabelBackground(o,e,s,n,i,r,u,f);n.segments&&n.segments.length>0?r.setAttribute("transform","translate("+o+","+e+")"):r.setAttribute("transform","translate("+o+","+e+") rotate("+i.rotateAngle+" "+(s.x+s.width/2)+" "+(s.y+s.height/2)+")")},_postionNodeTextElement:function(n,i,r,u,f){var o=0,s=0,h=t.datavisualization.Diagram.Util.bounds(n),e=r.getBBox(),a=this._getCharBoundsValues("W",i,u,n);switch(i.horizontalAlignment){case"left":o=h.width/2+i.margin.left;break;case"right":o=h.width/2-e.width;break;case"stretch":o=h.width/2-e.width/2;break;case"center":o=h.width/2-e.width/2}switch(i.verticalAlignment){case"top":s=h.height/2;break;case"bottom":s=h.height/2-e.height;break;case"stretch":s=h.height/2-e.height/2;break;case"center":s=h.height/2-e.height/2}if(o=o*(i.offset.x?i.offset.x/.5:0)+i.margin.left-i.margin.right,s=s*(i.offset.y?i.offset.y/.5:0)+i.fontSize+i.margin.top-i.margin.bottom,this._updateLabelBackground(o,s,e,n,i,r,u,f),n.segments&&n.segments.length>0)r.setAttribute("transform","translate("+(h.center.x-e.width/2)+","+(h.center.y-e.height/2+i.fontSize)+")");else if(n.type==="group"||n.children&&n.children.length>0){var c=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),v=n.width?n.width:n._width,y=n.height?n.height:n._height,o=o+(n.offsetX-n.width/2),s=s+(n.offsetY-n.height/2),l=n.rotateAngle+i.rotateAngle;r.setAttribute("transform","rotate("+l+","+c.x+","+c.y+"),translate("+o+","+s+")")}else r.setAttribute("transform","translate("+o+","+s+") rotate("+i.rotateAngle+" "+(e.x+e.width/2)+" "+(e.y+e.height/2)+")")},_postionSpanElement:function(n,t,i,r,u){for(var e,o,f=0;f<i.childNodes.length;f++)e=i.childNodes[f],e&&(o=this._getSVGTextAlignPosition(e,n,t,i,r,u),e.setAttribute("x",o.x))},_getSVGTextAlignPosition:function(n,t,i,r){var e=0,u,f;if(n&&i){u=n.getAttribute("totalWidth");u=u?Number(u):n.getComputedTextLength();f=r.getBBox();switch(i.textAlign){case"left":e=f.x;break;case"right":e=f.x+f.width-u;break;case"center":case"justify":e=f.x+f.width/2-u/2}}return{x:e,y:0}},_updateTspanElement:function(n,t,i,r,u){this._postionSpanElement(n,t,i,r,u);n.segments&&n.segments.length>0?this._postionConnectorTextElement(n,t,i,r,u):this._postionNodeTextElement(n,t,i,r,u)},_updateLabelBackground:function(i,r,u,f,e,o,s){var c=e.verticalAlignment==="stretch"?f.height-2:u.height,l=e.horizontalAlignment==="stretch"?f.width-2:u.width,v,h;if(i=e.horizontalAlignment==="stretch"?1:i,r=e.verticalAlignment==="stretch"?1:r-e.fontSize,v=n("#"+f.name+"_"+e.name+"_lblbg")[0],h={id:f.name+"_"+e.name+"_lblbg",height:c,width:l,x:i,y:r,transform:"rotate("+e.rotateAngle+" "+(i+l/2)+" "+(r+c/2)+")"},f.type==="group"||f.children&&f.children.length>0){var a=t.datavisualization.Diagram.Point(f.offsetX,f.offsetY),i=i+(f.offsetX-f.width/2),r=r+(f.offsetY-f.height/2),y=f.rotateAngle+e.rotateAngle;h.x=0;h.y=0;h.transform="rotate("+y+","+a.x+","+a.y+"),translate("+i+","+r+")"}s.rect(h)},_renderLabelSpanElement:function(n,i,r,u,f,e){var o,s;r.templateId||(this._updateHashTable(r,i,u,f),r.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap?this._svgTextWrapping(n,i,r,u,f,e):r.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow?this._svgWordWrapping(n,i,r,u,f,e):(o=u.tspan(),n.appendChild(o),o.setAttribute("x","0px"),o.setAttribute("y","0px"),r.textOverflow?(s=this._getLabelSize(r,i,f),this._updateOverFlowTspan(n,i,r,u,f,e,r.text,o,s)):o.textContent=r.text),this._updateTspanElement(i,r,n,u,f))},_getLabelSize:function(n,i){var r=t.datavisualization.Diagram.Util.bounds(i);return Math.max(n.width,r.width)},_svgTextWrapping:function(n,i,r,u,f){var a=t.datavisualization.Diagram.Util.bounds(i),e=u.tspan(),h,o,c,s,l;for(n.appendChild(e),e.setAttribute("x","0px"),e.setAttribute("y","0px"),h=0,o=r.text?r.text:r.hyperlink,e.textContent+=o[0],c=this._getLabelSize(r,i,f),h+=this._getSuitableLabelSize(r,o[0],f)*(r.fontSize/12),s=1;s<o.length;s++)if(o[s]=="\n"||h+this._getSuitableLabelSize(r,o[s],f)*(r.fontSize/12)>=c){if(r.textOverflow)return r.overflowType=="ellipsis"&&(e.textContent=e.textContent.substr(0,e.textContent.length-3),e.textContent+="..."),!1;e.setAttribute("totalWidth",h);e=u.tspan();n.appendChild(e);l=n.getBBox();e.setAttribute("x","0px");e.setAttribute("y",l.height+"px");o[s]!="\n"?(e.textContent+=o[s],h=this._getSuitableLabelSize(r,o[s],f)*(r.fontSize/12)):h=0}else e.textContent+=o[s],h+=this._getSuitableLabelSize(r,o[s],f)*(r.fontSize/12)},_updateOverFlowTspan:function(n,t,i,r,u,f,e,o,s){var l=e,h;this._updateHashTable(i,t,r,u,!0);var a=0,c="",v="",y=0;for(i.overflowType=="ellipsis"&&(y=this._getSuitableLabelSize(i,".",u)*(i.fontSize/12)*3),h=0;h<l.length;h++){if(c=l[h],a+=this._getSuitableLabelSize(i,c,u)*(i.fontSize/12),a+y>=s)break;v+=c}o.textContent=v+(i.overflowType=="ellipsis"?"...":"")},_svgWordWrapping:function(n,i,r,u,f,e){var w,c=0,v,l,y,p,h,s,o,a;for(w=t.datavisualization.Diagram.Util.bounds(i),v=r.text?r.text.split("\n"):r.hyperlink.split("\n"),l=0;l<v.length;l++)for(a=n.getBBox(),o=u.tspan(),n.appendChild(o),o.setAttribute("x","0px"),o.setAttribute("y",a.height+"px"),y=v[l],c=0,p=this._getLabelSize(r,i,f),h=y.split(" "),s=0;s<h.length;s++)if(c+this._getSuitableLabelSize(r,h[s],f)*(r.fontSize/12)>=p)if(r.textOverflow){this._updateOverFlowTspan(n,i,r,u,f,e,y,o,p);break}else o.setAttribute("totalWidth",c),o=u.tspan(),n.appendChild(o),a=n.getBBox(),o.setAttribute("x","0px"),o.setAttribute("y",a.height+"px"),h[s]!="\n"?(o.textContent+=h[s],c=this._getSuitableLabelSize(r,h[s],f)*(r.fontSize/12)):c=0;else c&&(o.textContent+=" "),o.textContent+=h[s],c+=this._getSuitableLabelSize(r,h[s],f)*(r.fontSize/12)},_renderSVGLabel:function(n,i,r,u,f){var s=r.getElementById(n.name),l,h,a,e,v,o,c;return i.templateId&&i.templateType===t.datavisualization.Diagram.TemplateType.Svg?(l=u._renderEjTemplate("#"+i.templateId,i),h=document.createElement("div"),h.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g class="ej-label-template" id='+n.name+"_"+i.name+">"+l+"<\/g><\/svg>",document.body.appendChild(h),a=document.getElementById(n.name+"_"+i.name).cloneNode(!0),s.appendChild(a),h.parentNode.removeChild(h),this._updateSVGTemplate(n,i,r,u,f)):(e={id:n.name+"_"+i.name+"_lblbg",fill:n._isHeader?"transparent":i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth,"pointer-events":"none",visibility:i.visible?"visible":"hidden","fill-opacity":i.opacity,"stroke-opacity":i.opacity},v=r.rect(e),s.appendChild(v),e={id:n.name+"_"+i.name,"class":"ej-d-label","font-family":i.fontFamily,"font-size":i.fontSize,fill:i.hyperlink!==""?"blue":i.fontColor,"text-decoration":i.hyperlink!==""?"underline":i.textDecoration,"font-weight":i.bold?"bold":"normal","font-style":i.italic?"italic":"normal",visibility:i.visible?"visible":"hidden","fill-opacity":i.opacity,"stroke-opacity":i.opacity},this._addCssClass(i,e),i.hyperlink?(o=document.createElementNS("http://www.w3.org/2000/svg","a"),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i.hyperlink),o.setAttribute("target","_blank"),o.setAttribute("class","ej-d-anchor"),c=r.text(e),o.appendChild(c),s.appendChild(o)):(c=r.text(e),s.appendChild(c)),this._renderLabelSpanElement(c,n,i,r,u,f)),s},_renderSVGLabels:function(n,t,i,r){var f,u;if(n.labels.length&&n.type!="text")for(f=n.labels,u=0;u<f.length;u++)this._renderSVGLabel(n,f[u],t,i,r)},_updateLabelSpanElement:function(i,r,u,f,e){var o=u.getElementById(i.name+"_"+r.name),s,h;i.textBlock&&(o=u.getElementById(i.name+"_shape_lblbg"));o&&(n(o).empty(),this._updateHashTable(r,i,u,f),r.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap?this._svgTextWrapping(o,i,r,u,f,e):r.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow?this._svgWordWrapping(o,i,r,u,f,e):(s=u.tspan(),o.appendChild(s),s.setAttribute("x","0px"),s.setAttribute("y","0px"),r.textOverflow?(h=this._getLabelSize(r,i,f),this._updateOverFlowTspan(o,i,r,u,f,e,r.text,s,h)):s.textContent=r.text),this._updateTspanElement(i,r,o,u,f))},_updateSVGTemplate:function(n,i,r,u){var f=0,e=0,s=t.datavisualization.Diagram.Util.bounds(n),h=r.document.getElementById(n.name+"_"+i.name),o,c,l;if(h){if(o=h.getBBox(),n.segments&&i.relativeMode=="segmentpath"){c=this._getConnectorHandlePosition(i,n,1,u);l=c.position;f=l.x;e=l.y;var a=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,i,u,c),v=a.vAlign,y=a.hAlign;switch(y){case"left":f=f-o.x+i.margin.left;break;case"right":f=f-o.width-i.margin.right;break;case"stretch":case"center":f=f-o.width/2+i.margin.left-i.margin.right}switch(v){case"top":e=e-o.y+i.margin.top;break;case"bottom":e=e-o.height+i.margin.bottom;break;case"stretch":case"center":e=e-o.height/2+i.margin.top-i.margin.bottom}}else{switch(i.horizontalAlignment){case"left":f=s.width/2+i.margin.left;break;case"right":f=s.width/2-o.width;break;case"stretch":f=s.width/2-o.width/2;break;case"center":f=s.width/2-o.width/2}switch(i.verticalAlignment){case"top":e=s.height/2;break;case"bottom":e=s.height/2-o.height;break;case"stretch":e=s.height/2-o.height/2;break;case"center":e=s.height/2-o.height/2}f=f*(i.offset.x?i.offset.x/.5:0)+i.margin.left-i.margin.right;e=e*(i.offset.y?i.offset.y/.5:0)+i.margin.top-i.margin.bottom;n.segments&&(f+=s.left,e+=s.top)}h.setAttribute("transform","translate("+f+","+e+")")}},_updateSVGLabel:function(n,t,i,r,u){if(t.templateId)this._updateSVGTemplate(n,t,i,r,u);else{var f={id:n.name+"_"+t.name,"class":"ej-d-label","font-family":t.fontFamily,"font-size":t.fontSize,fill:t.hyperlink!==""?"blue":t.fontColor,"text-decoration":t.hyperlink!==""?"underline":t.textDecoration};i.text(f);this._updateLabelSpanElement(n,t,i,r,u)}},_updateSVGLabels:function(n,t,i,r){var f,u;if(n.labels.length&&n.type!="text")for(f=n.labels,u=0;u<f.length;u++)this._updateSVGLabel(n,f[u],t,i,r)},_renderLabels:function(i,r,u,f){var o,s;if(u&&u.model.labelRenderingMode!=t.datavisualization.Diagram.LabelRenderingMode.Svg){if(i.labels.length&&i.type!="text"){var y=i.labels,h=t.datavisualization.Diagram.Util.bounds(i),c,l,a,v,e,p=!1;for(o=0;o<y.length;o++)if(i.labels[o].hyperlink&&!i.labels[o].text)this._renderSVGLabel(i,i.labels[o],r,u,f);else{if(!p){p=!0;s=r.document.parentNode.getElementsByClassName("htmlLayer")[0];e=n(s).children("#"+i.name)[0];e&&s.removeChild(e);e=document.createElement("div");i.segments?(c=h.width,l=h.height,a=h.x,v=h.y):(c=i.width?i.width:i._width,l=i.height?i.height:i._height,a=i.offsetX-c*i.pivot.x,v=i.offsetY-l*i.pivot.y);f&&(a=0,v=0);var b=i.visible?"visible":"hidden",k="width:"+c+"px; height:"+l+"px; left:"+a+"px; top:"+v+"px; display: block; position: absolute; pointer-events: none; visibility:"+b+"; padding: inherit;",w=i._type==="node"?"ej-d-node":i._type==="group"?"ej-d-group":"ej-d-connector";i._isClassifier&&(w+=" ej-d-classifier");t.datavisualization.Diagram.Util.attr(e,{id:i.name,"class":w,style:k});i.rotateAngle&&(e.style.webkitTransform="rotate("+i.rotateAngle+"deg) ",e.style.MozTransform="rotate("+i.rotateAngle+"deg) ",e.style.OTransform="rotate("+i.rotateAngle+"deg) ",e.style.msTransform="rotate("+i.rotateAngle+"deg)",e.style.transform="rotate("+i.rotateAngle+"deg) ",e.style["transform-origin"]=i.pivot.x*100+"% "+i.pivot.y*100+"%");s&&s.appendChild(e)}this._renderLabel(i,h,y[o],e,s,r,c,l,u)}}}else this._renderSVGLabels(i,r,u,f)},_isParentVisible:function(n,t){for(var i=t.document.getElementById(n);i&&(i.getAttribute("class")!="DiagramLayer"||i.localName&&i.localName!=="svg");){if(i.localName&&i.localName!=="svg")break;if(i&&i.getAttribute("visibility")!=="visible")return!0;i=i.parentNode}},_renderLabel:function(n,i,r,u,f,e,o,s,h){var l=document.createElement("div"),c=document.createElement("span"),p,w,y,v,b,a;return r.templateId&&(p=h._renderEjTemplate("#"+r.templateId,r)),e.document&&e.document.getAttribute("class")==="overview_svg"?t.datavisualization.Diagram.Util.attr(c,this._addCssClass(r,{id:n.name+"_"+r.name,"class":"ej-d-label",style:"display: inline-block; position: absolute; line-height: normal; pointer-events: none"})):(w=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,h),y="ej-d-label",n._isClassifier&&(y+=" ej-d-classifier"),t.datavisualization.Diagram.Util.attr(c,this._addCssClass(r,{id:n.name+"_"+r.name,"class":y,style:"display: inline-block; position: absolute; line-height: normal; pointer-events:"+(w?"all":"none")}))),(r.horizontalAlignment=="stretch"||r.verticalAlignment=="stretch")&&(v=this._rotateLabel(o,s,r),r.horizontalAlignment=="stretch"&&(c.style.width=Math.abs(v.x)+"px"),r.verticalAlignment=="stretch"&&(c.style.alignItems="center",c.style.display="flex",c.style.justifyContent="center",c.style.height=Math.abs(v.y)+"px"),r.textOverflow&&(c.style.display="inline-block",r.rotateAngle==0&&n._isHeader?(c.style.top=Math.abs(v.y)/2-r.fontSize/2+"px",c.style.left="0px"):n._isHeader&&(c.style.left=Math.abs(v.y)/2-r.fontSize/2+"px",c.style.top="0px"))),r.bold&&(c.style.fontWeight="bold"),r.italic&&(c.style.fontStyle="italic"),(!r.visible||this._isParentVisible(n.name,e))&&(c.style.visibility="hidden"),c.style.opacity=r.opacity,c.style.textDecoration=r.textDecoration,c.style.fontFamily=r.fontFamily,c.style.fontSize=r.fontSize+"px",c.style.color=r.fontColor,c.style.backgroundColor=r.fillColor,c.style.borderColor=r.borderColor,c.style.borderWidth=r.borderWidth+"px",n._isHeader&&(c.style.borderWidth="0px",c.style.backgroundColor="transparent"),c.style.borderStyle="solid",c.textContent=r.text,o=o>r.width?o:r.width,s=s>r.height?s:r.height,r.margin.left&&r.margin.right&&(o-=(r.margin.left||0)+(r.margin.right||0)),r.margin.top&&r.margin.bottom&&(s-=(r.margin.top||0)+(r.margin.bottom||0)),b="display: inline-block; position: absolute; pointer-events: none; width:"+o+"px;height:"+s+"px;",t.datavisualization.Diagram.Util.attr(l,{id:n.name+"_"+r.name+"_lblbg",style:b}),r.templateId||(l.appendChild(c),u.appendChild(l),this._alignTextOnLabel(n,i,c,l,r,h,a)),r.templateId&&(a=document.createElement("div"),a.setAttribute("class","ej-label-template"),a.innerHTML=p,l.appendChild(a),u.appendChild(l),a.style.position="absolute",this._alignTextOnLabel(n,i,a,l,r,h)),l},_findChild:function(n,t){for(var r=n.length,i=0;i<r;i++)if(n[i].id==t.name)return n[i]},_updateLabels:function(n,i,r){var u,d,g,h,nt,c,tt,w,o,f,e,b;if(r.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg)this._updateSVGLabels(n,i,r);else if(n.labels&&n.labels.length&&n.type!="text"){var k=n.labels,l=t.datavisualization.Diagram.Util.bounds(n),s,a,v,y,p=i.document.parentNode.getElementsByClassName("htmlLayer")[0];for(p&&(u=p.childNodes[n.zOrder],u&&u.id==n.name||(d=p.childNodes,u=this._findChild(d,n,i))),u&&(n.segments?(s=l.width,a=l.height,v=l.x,y=l.y):(s=n.width?n.width:n._width,a=n.height?n.height:n._height,v=n.offsetX-s*n.pivot.x,y=n.offsetY-a*n.pivot.y),g=n.visible?"visible":"hidden",u.style.width=s+"px",u.style.height=a+"px",u.style.left=v+"px",u.style.top=y+"px",u.style.opacity=n.opacity,h="rotate("+n.rotateAngle+"deg) ",nt=n.pivot?n.pivot.x*100+"% "+n.pivot.y*100+"%":"50% 50%",u.style.webkitTransform=h,u.style.MozTransform=h,u.style.OTransform=h,u.style.msTransform=h,u.style.transform=h,u.style["transform-origin"]=u.style["ms-transform-origin"]=u.style["webkit-transform-origin"]=u.style["o-transform-origin"]=u.style["moz-transform-origin"]=nt,u.style.visibility=g),o=0;o<k.length;o++)n.labels[o].hyperlink&&!n.labels[o].text?this._updateSVGLabel(n,n.labels[o],i,r):u&&(f=k[o],c=u.childNodes[o],c&&(e=c.childNodes[0],(f.text||e.textContent)&&(w=s>f.width?s:f.width,f.margin.left&&f.margin.right&&(w-=(f.margin.left||0)+(f.margin.right||0)),f.margin.top&&f.margin.bottom&&(tt-=(f.margin.top||0)+(f.margin.bottom||0)),c.style.height=tt+"px",c.style.width=w+"px",f.templateId||(e.textContent=f.text),(f.horizontalAlignment=="stretch"||f.verticalAlignment=="stretch")&&(b=this._rotateLabel(s,a,f),f.horizontalAlignment=="stretch"&&(e.style.width=Math.abs(b.x)+"px"),f.verticalAlignment=="stretch"&&(e.style.alignItems="center",e.style.display="flex",e.style.justifyContent="center",e.style.height=Math.abs(b.y)+"px"),f.textOverflow&&(e.style.display="inline-block")),this._alignTextOnLabel(n,l,e,c,f,r))))}},_alignTextOnPhase:function(n,i,r,u,f){var o,e,s,h;f.getElementById(n.name)&&(o=f.getElementById(n.name).getBoundingClientRect());o&&(e=r.getBBox(),s=f.getElementById(n.name+"_"+u.name+"_lblbg"),r.setAttribute("transform","translate("+-e.width/2+",50), rotate(0,0,0)"),r.setAttribute("pointer-events","auto"),s&&(h={width:e.width,height:e.height,fill:u.fillColor,stroke:u.borderColor,"stroke-width":u.borderWidth,transform:"translate("+-e.width+","+o.top+"), rotate(0,0,0)"},t.datavisualization.Diagram.Util.attr(s,h)))},updateLabel:function(i,r,u,f){var e,a;if(typeof r.text=="string"){var o,v,h,s,c,l=t.datavisualization.Diagram.Util.bounds(i),y=u.document.parentNode.getElementsByClassName("htmlLayer")[0]||f._htmlLayer,p=n(y).children("#"+i.name)[0];i.segments?(s=l.width,c=l.height):(s=i.width?i.width:i._width,c=i.height?i.height:i._height);o=n(p).children("#"+i.name+"_"+r.name+"_lblbg")[0];o?(e=o.childNodes[0],h=s>r.width?s:r.width,r.margin.left&&r.margin.right&&(h-=(r.margin.left||0)+(r.margin.right||0)),r.margin.top&&r.margin.bottom&&(v-=(r.margin.top||0)+(r.margin.bottom||0)),o.style.height=v+"px",o.style.width=h+"px",r.templateId||(e.textContent=r.text),e.style.opacity=r.opacity,(r.horizontalAlignment=="stretch"||r.verticalAlignment=="stretch")&&(a=this._rotateLabel(s,c,r),r.horizontalAlignment=="stretch"&&(e.style.width=Math.abs(a.x)+"px"),r.verticalAlignment=="stretch"&&(e.style.alignItems="center",e.style.display="flex",e.style.justifyContent="center",e.style.height=Math.abs(a.y)+"px"),r.textOverflow&&(e.style.display="inline-block")),i.type!="node"||i.width||i.height||this.updateNode(i,u,f),this._alignTextOnLabel(i,l,e,o,r,f)):this._updateLabelSpanElement(i,r,u,f)}},_alignTextOnLabel:function(n,i,r,u,f,e){var c,p,w,h,l,y,b;if(n.segments&&f.relativeMode=="segmentpath"){var k=this._getConnectorHandlePosition(f,n,1,e),d=k.position,h={x:(d.x-i.x)/i.width,y:(d.y-i.y)/i.height},g=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,f,e,k);w=g.vAlign;p=g.hAlign}else h={x:f.offset.x,y:f.offset.y},p=f.horizontalAlignment,w=f.verticalAlignment;r.style["pointer-events"]=t.datavisualization.Diagram.Util.canEnablePointerEvents(n,e)?e&&e.activeTool&&e.activeTool.name==="move"&&e.activeTool.inAction?"none":"all":"none";l=n.width?n.width:n._width;y=n.height?n.height:n._height;l-=f.margin.left+f.margin.right;y-=f.margin.top+f.margin.bottom;c={x:l,y:y};f.textOverflow&&(r.style.textOverflow=f.overflowType,r.style.overflow="hidden",r.style.whiteSpace="nowrap",r.style.width=l+"px");f.rotateAngle&&(b=t.Matrix.identity(),t.Matrix.rotate(b,f.rotateAngle,h.x,h.y),c=t.Matrix.transform(b,{x:l,y:y}));var o=0,s=0,a,v,nt=t.datavisualization.Diagram.Util.canMoveLabel(n);f.wrapping==t.datavisualization.Diagram.TextWrapping.NoWrap?(r.style.whiteSpace="nowrap",r.style.wordWrap="normal",r.style.maxWidth="",r.style.maxHeight=""):f.templateId||(f.textOverflow||(r.style.whiteSpace=f.textAlign!="justify"?"pre-wrap":"pre-line"),f.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap?(r.style.wordBreak="break-all",r.style.wordWrap="break-word",n.segments?r.style.maxWidth=Math.abs(f.width)+"px":(Math.abs(c.x)<f.width&&(c.x=f.width),r.style.maxWidth=Math.abs(c.x)+"px",r.style.maxHeight=Math.abs(c.y)+"px")):(r.style.wordWrap="break-word",r.style.maxWidth="",r.style.maxHeight=""));switch(p){case t.datavisualization.Diagram.HorizontalAlignment.Left:o="0%";a=f.margin.left+"px";break;case t.datavisualization.Diagram.HorizontalAlignment.Center:o="-50%";a=f.margin.left-f.margin.right+"px";break;case t.datavisualization.Diagram.HorizontalAlignment.Right:o="-100%";a=-f.margin.right+"px";break;case t.datavisualization.Diagram.HorizontalAlignment.Stretch:o="-50%"}switch(w){case t.datavisualization.Diagram.VerticalAlignment.Top:s="0%";v=f.margin.top+"px";break;case t.datavisualization.Diagram.VerticalAlignment.Center:s="-50%";v=f.margin.top-f.margin.bottom+"px";break;case t.datavisualization.Diagram.VerticalAlignment.Bottom:s="-100%";v=-f.margin.bottom+"px";break;case t.datavisualization.Diagram.VerticalAlignment.Stretch:s="-50%"}f.margin.left&&f.margin.right&&f.margin.top&&f.margin.bottom&&!n._isClassifier&&!n._isClassMember?(r.style.marginLeft=a,r.style.marginTop=v):(u.style.marginLeft=a,u.style.marginTop=v);h.x*=100;h.y*=100;r.style.textAlign=f.textAlign;r.style.webkitTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.MozTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.OTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.msTransform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";r.style.transform="translate("+o+", "+s+") rotate("+f.rotateAngle+"deg)";f.horizontalAlignment=="stretch"||f.verticalAlignment=="stretch"||f.templateId||(r.style.left="0px",r.style.top="0px");u&&(u.style.left=h.x+"%",u.style.top=h.y+"%")},_rotateLabel:function(n,i,r){var f={x:n,y:i},u;return r.rotateAngle&&(u=t.Matrix.identity(),t.Matrix.rotate(u,r.rotateAngle,0,0),f=t.Matrix.transform(u,{x:n,y:i})),f},_renderLabelGroup:function(n,t,i){var r,u;if(n._type=="group"){for(r=0;r<n.children.length;r++)u=i.nameTable[i._getChild(n.children[r])],u._type=="group"?this._renderLabelGroup(u,t,i):this._renderLabelsAsSvg(u,t,i);this._renderLabelsAsSvg(n,t,i)}},_renderLabelsAsSvg:function(n,t,i){var u=t.document.getElementById(n.name),r;if(n.type=="text")this._renderTextElementAsSvg(n,n.textBlock,u,t,i);else for(r=0;r<n.labels.length;r++)this._renderTextElementAsSvg(n,n.labels[r],u,t,i)},_renderTextElementAsSvg:function(n,i,r,u,f){var o={id:n.name+"_"+i.name,"class":"ej-d-label","font-family":i.fontFamily,"font-size":i.fontSize,fill:i.fontColor,"text-decoration":i.textDecoration,"pointer-events":"none"},e,a,h,s,c,l;(i.bold&&(o["font-weight"]="bold"),i.italic&&(o["font-style"]="italic"),e=u.text(o),e.textContent=i.text,o={id:n.name+"_"+i.name+"_lblbg",fill:i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth,transform:"translate(0,0)"},a=u.rect(o),i.text)&&(r.appendChild(e),r.insertBefore(a,e),h=t.datavisualization.Diagram.Util.bounds(n),s=!1,n._isHeader&&i.rotateAngle&&f&&(c=f.nameTable[n.parent],c&&c.isLane&&(s=!0),l=f.nameTable[n.parent],l&&l.isPhaseStack&&!n.orientation=="vertical"&&(s=!0)),this._wrapText(n,h,e,i,u,s),this._alignTextOnSvgLabel(n,h,e,i,u,f,s))},_alignTextOnSvgLabel:function(n,i,r,u,f,e,o){var l=r.getBBox(),h=t.datavisualization.Diagram.Util._getLabelPosition(u,i),s,c,y,v,a,p;o&&(l=t.datavisualization.Diagram.Util._rBounds(l,u.rotateAngle),h=t.datavisualization.Diagram.Util._getLabelPosition(u,i,null,null,o,r));s=o?h:this._adjustOffsetWithTextBounds(n,u,r,h,l,i,e);c=u.borderWidth||0;r.setAttribute("transform","translate("+(s.x+c)+","+(s.y+c)+"), rotate("+u.rotateAngle+","+(h.x-s.x)+","+(h.y-s.y)+")");y=f.getElementById(n.name+"_"+u.name+"_lblbg");y&&(v=s.x+l.x,a=s.y,t.browserInfo().name==="mozilla"&&(a=s.y+u.fontSize/2),v=v+c/2,a=a+c/2,p={width:l.width+c,height:l.height+c,transform:"translate("+v+","+a+"), rotate("+u.rotateAngle+","+(h.x-v)+","+(h.y-a)+")",fill:u.fillColor?u.fillColor:"transparent",stroke:u.borderColor,"stroke-width":u.borderWidth},o&&(p.fill="transparent"),t.datavisualization.Diagram.Util.attr(y,p))},_adjustOffsetWithTextBounds:function(n,i,r,u,f,e,o){var s={x:0,y:0},c=0,h,a,v;if(n.segments&&i.relativeMode==="segmentpath"){var y=this._getConnectorHandlePosition(i,n,1,o),p=y.position,l={x:(p.x-e.x)/e.width,y:(p.y-e.y)/e.height};l=t.datavisualization.Diagram.Util._getLabelPosition(i,e,l);u.x=l.x;u.y=l.y;v=t.datavisualization.Diagram.Util._alignLabelOnSegments(n,i,o,y);a=v.hAlign;h=v.vAlign}else a=i.horizontalAlignment,h=i.verticalAlignment;if(h==t.datavisualization.Diagram.VerticalAlignment.Top?c=u.y:h==t.datavisualization.Diagram.VerticalAlignment.Center?c=u.y-f.height/2:h==t.datavisualization.Diagram.VerticalAlignment.Bottom?c=u.y-f.height:h==t.datavisualization.Diagram.VerticalAlignment.Stretch&&(c=u.y-f.height/2),s.y=c,i.textAlign=="justify")s.x=r.childNodes.length>1?u.x-n.width/2:u.x;else switch(a){case t.datavisualization.Diagram.HorizontalAlignment.Left:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x+f.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x+f.width}break;case t.datavisualization.Diagram.HorizontalAlignment.Center:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x-f.width/2;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x+f.width/2}break;case t.datavisualization.Diagram.HorizontalAlignment.Right:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x-f.width;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x-f.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x}break;case t.datavisualization.Diagram.HorizontalAlignment.Stretch:switch(i.textAlign){case t.datavisualization.Diagram.TextAlign.Left:s.x=u.x-e.width/2;break;case t.datavisualization.Diagram.TextAlign.Center:s.x=u.x;break;case t.datavisualization.Diagram.TextAlign.Right:s.x=u.x+e.width/2}}return(n.segments||n._type=="group")&&(s.x=s.x+e.x,s.y=s.y+e.y,u.x+=e.x,u.y+=e.y),t.browserInfo().name==="mozilla"&&(s.y=s.y-i.fontSize/2),s},_wrapText:function(n,t,i,r,u,f){for(var d=r.text,o,y,w,l,e,h,g,s,b,c,p,a,v,k;i.hasChildNodes();)i.removeChild(i.lastChild);if(n.segments?(o=t.width,y=t.height):(o=t.width-r.margin.left-r.margin.right,y=t.height-r.margin.top-r.margin.bottom),f&&(w=o,o=y,y=w),o-=2*(r.borderWidth?r.borderWidth:1),o=o<r.width?r.width:o,l=d.split("\n"),g="",u.getElementById(i.id)&&(s=u.getElementById(i.id).childNodes),s){for(p=r.wrapping=="wrapwithoverflow"?!0:!1,h=0;h<l.length;h++)if(e=u.tspan(),e.style.fontSize=r.fontSize,i.appendChild(e),r.wrapping!="nowrap")for(a=r.wrapping=="wrapwithoverflow"?l[h].split(" "):l[h],c=0;c<a.length;c++)e.textContent+=(v&&p?" ":"")+a[c],b=s[s.length-1].getComputedTextLength(),b>=o?c==a.length-1||(e=u.tspan(),i.appendChild(e),v=""):p&&(v=e.textContent,e.textContent+=a[c+1]||"",k=s[s.length-1].getComputedTextLength(),e.textContent=v,k>o&&(e=u.tspan(),i.appendChild(e),v=""));else e.textContent+=l[h];this._wrapTextAlign(i,s,r.fontSize,r.textAlign,n)}},_wrapTextAlign:function(n,i,r,u,f){for(var l,a,o,h,c,e,s=0;s<i.length;s++){u=="justify"&&s!=i.length-1?(e=i[s].textContent,e[e.length-1]==" "&&(e=e.slice(0,e.length-1)),e[0]==" "&&(e=e.slice(1,e.length)),i[s].textContent=e,o=i[s].getComputedTextLength(),h=f.width-o,c=h/(e.split(" ").length-1),i[s].setAttribute("word-spacing",c+"px"),o=i[s].getComputedTextLength()):o=i[s].getComputedTextLength();u=="justify"&&(u=i.length>1?"left":"center");switch(u){case"left":o=0;break;case"center":o=-o/2;break;case"right":o=-o}l={x:Number(o),dy:r};a=i[s];t.datavisualization.Diagram.Util.attr(a,l)}},_renderPorts:function(n,t,i){for(var e,u=n.ports,f,r=0,o=u.length;r<o;++r)f=u[r],e=this._renderPort(n,f,t),i.appendChild(e)},_renderPort:function(n,i,r){var o,u,s,e=t.datavisualization.Diagram.Size(i.size,i.size),f,h,c,l,a;s=i.visibility&t.datavisualization.Diagram.PortVisibility.Hidden||i.visibility&t.datavisualization.Diagram.PortVisibility.Hover||i.visibility&t.datavisualization.Diagram.PortVisibility.Connect?"hidden":"visible";f=n._type==="group"?t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!1):t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!0);n._type==="group"&&n.rotateAngle&&(h=t.Matrix.identity(),t.Matrix.rotate(h,n.rotateAngle,n.offsetX,n.offsetY),f=t.Matrix.transform(h,f),i._absolutePoint=f);switch(i.shape){case"x":c=this._constructX(f,i.size);u={id:n.name+"_"+i.name,"class":"ej-d-port",fill:i.fillColor,visibility:s,stroke:i.borderColor,"stroke-width":i.borderWidth,d:c};this._addCssClass(i,u);o=r.path(u);break;case"circle":l=e.width/2;a=e.height/2;u={id:n.name+"_"+i.name,"class":"ej-d-port",rx:l,ry:a,visibility:s,cx:f.x,cy:f.y,fill:i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth};this._addCssClass(i,u);o=r.ellipse(u);break;case"square":u={id:n.name+"_"+i.name,"class":"ej-d-port",x:f.x-i.size/2,visibility:s,y:f.y-i.size/2,width:e.width,height:e.height,fill:i.fillColor,stroke:i.borderColor,"stroke-width":i.borderWidth};this._addCssClass(i,u);o=r.rect(u);break;case"path":var v=e.width,y=e.height,c=i._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(f.x-i.size/2,f.y-i.size/2,v,y,i.pathData,r),u={id:n.name+"_"+i.name,width:v,height:y,d:c,stroke:i.borderColor,"stroke-width":i.borderWidth,fill:i.fillColor,visibility:s};this._addCssClass(i,u);o=r.path(u)}return o},_insertPort:function(n,i,r){var f,u;f=document.getElementById(n.name);u=t.datavisualization.Diagram.SvgContext._renderPort(n,i,r);f.appendChild(u);(i.visibility&t.datavisualization.Diagram.PortVisibility.Hidden||i.visibility&t.datavisualization.Diagram.PortVisibility.Hover||i.visibility&t.datavisualization.Diagram.PortVisibility.Connect)&&u.setAttribute("visibility","hidden")},_updatePort:function(n,i,r){var e=t.datavisualization.Diagram.Size(i.size,i.size),u=null,f,s,o,h,c;u=n._type==="group"?t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!1):t.datavisualization.Diagram.Util._getPortPosition(i,t.datavisualization.Diagram.Util.bounds(n,!0),!0);f=n.name+"_"+i.name;n._type==="group"&&n.rotateAngle&&(s=t.Matrix.identity(),t.Matrix.rotate(s,n.rotateAngle,n.offsetX,n.offsetY),u=t.Matrix.transform(s,u),i._absolutePoint=u);switch(i.shape){case"x":o=this._constructX(u,i.size);r.path({id:f,d:o});break;case"circle":h=e.width/2;c=e.height/2;n.type==="group"?r.ellipse({id:f,rx:h,ry:c,cx:0,cy:0,transform:"rotate("+n.rotateAngle+","+u.x+","+u.y+"),translate("+u.x+","+u.y+")"}):r.ellipse({id:f,rx:h,ry:c,cx:u.x,cy:u.y});break;case"square":n.type==="group"?r.rect({id:f,x:0,y:0,transform:"rotate("+n.rotateAngle+","+u.x+","+u.y+"),translate("+(u.x-i.size/2)+","+(u.y-i.size/2)+")"}):r.rect({id:f,x:u.x-i.size/2,y:u.y-i.size/2});break;case"path":var a=e.width,v=e.height,o=i._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(u.x-i.size/2,u.y-i.size/2,a,v,i.pathData,r),l={id:f,d:o};n.type==="group"&&(l={id:f,d:o,transform:"rotate("+n.rotateAngle+","+u.x+","+u.y+")"});r.path(l)}},_updatePorts:function(n,t){for(var u,r=n.ports,i=0,f=r.length;i<f;++i)u=r[i],this._updatePort(n,u,t)},_constructX:function(n,i){var r=new t.datavisualization.Diagram.Path;return r.moveTo(n.x-i/2,n.y-i/2),r.lineTo(n.x+i/2,n.y+i/2),r.moveTo(n.x+i/2,n.y-i/2),r.lineTo(n.x-i/2,n.y+i/2),r.toString()},_enableSelectedNode:function(t,i,r){var e,u,a,o,v,s,h,f,c,l;if(t){if(t.type=="pseudoGroup")for(e=t.children,u=0,a=e.length;u<a;u++)o=r.nameTable[r._getChild(e[u])],o&&this._enableSelectedNode(o,i,r);else v={id:t.name,"pointer-events":"auto",style:"pointer-events:block"},t.segments&&(s=i.document.getElementById(t.name+"_hitTest"),s&&s.setAttribute("pointer-events",t.visible?"stroke":"none")),i.g(v);t&&t.type==="html"&&(h=r._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],h&&(f=n(h).find("#"+t.name+"_parentdiv")[0]),f&&(f.style.pointerEvents="all",c=f.children[0],c&&(c.style.pointerEvents="all")));r._adornerSvg&&(l=r._adornerSvg.document.getElementById(r._adornerSvg.document.id+"handle_g"),l&&l.setAttribute("pointer-events","visible"));n(".ej-d-seperator").css("pointer-events","stroke");n(".e-resize").css("pointer-events","visible");n(".s-resize").css("pointer-events","visible")}},_disableSelectedNode:function(t,i,r){var e,u,l,o,a,v,s,h,f,c;if(t){if(t.type=="pseudoGroup")for(e=t.children,u=0,l=e.length;u<l;u++)o=r.nameTable[r._getChild(e[u])],o&&this._disableSelectedNode(o,i,r);else a={id:t.name,style:"pointer-events:none","pointer-events":"none"},t.segments&&(v=i.document.getElementById(t.name+"_hitTest"),v.setAttribute("pointer-events","none")),i.g(a);r._adornerSvg&&(s=r._adornerSvg.document.getElementById(r._adornerSvg.document.id+"handle_g"),s&&s.setAttribute("pointer-events","none"));t&&t.type==="html"&&(h=r._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],h&&(f=n(h).find("#"+t.name+"_parentdiv")[0]),f&&(f.style.pointerEvents="none",c=f.children[0],c&&(c.style.pointerEvents="none")));n(".e-resize").css("pointer-events","none");n(".ej-d-seperator").css("pointer-events","none");n(".s-resize").css("pointer-events","none")}},_drawStackHighlighter:function(n,i,r,u,f,e){var c,s=[],o=t.datavisualization.Diagram.Util.bounds(n);e?f.y>=o.y&&f.y<o.center.y?(s.push({x:o.topLeft.x*u-5,y:o.topLeft.y*u-5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.topLeft.x*u-5,y:o.topLeft.y*u+5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.topRight.x*u+5,y:o.topRight.y*u-5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.topRight.x*u+5,y:o.topRight.y*u+5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u})):(s.push({x:o.bottomLeft.x*u-5,y:o.bottomLeft.y*u-5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u-5,y:o.bottomLeft.y*u+5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u+5,y:o.bottomRight.y*u-5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u+5,y:o.bottomRight.y*u+5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u})):f.x>=o.x&&f.x<o.center.x?(s.push({x:o.topLeft.x*u-5,y:o.topLeft.y*u-5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.topLeft.x*u+5,y:o.topLeft.y*u-5}),s.push({x:o.topLeft.x*u,y:o.topLeft.y*u}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u-5,y:o.bottomLeft.y*u+5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u+5,y:o.bottomLeft.y*u+5}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u}),s.push({x:o.bottomLeft.x*u,y:o.bottomLeft.y*u})):(s.push({x:o.topRight.x*u-5,y:o.topRight.y*u-5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.topRight.x*u+5,y:o.topRight.y*u-5}),s.push({x:o.topRight.x*u,y:o.topRight.y*u}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u-5,y:o.bottomRight.y*u+5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u+5,y:o.bottomRight.y*u+5}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}),s.push({x:o.bottomRight.x*u,y:o.bottomRight.y*u}));var c=this._convertToSVGPoints(s),l={id:"nodeHighlighter",points:c,fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":"none",style:"pointer-events: none"},h=i.polyline(l);return r.appendChild(h),h},_drawNodeHighlighter:function(n,i,r,u){var f,e=n.width?n.width:n._width,o=n.height?n.height:n._height,h=n.offsetX-e*n.pivot.x,c=n.offsetY-o*n.pivot.y,s=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),l="rotate("+n.rotateAngle+","+s.x*u+","+s.y*u+")",a=n.isLane||n.isSwimlane?"red":"#0dc923",v={id:"nodeHighlighter","class":"ej-d-node",x:h*u,y:c*u,width:e*u,height:o*u,fill:"transparent",stroke:a,"stroke-width":2,"pointer-events":"none",transform:l,style:"pointer-events: none"};return f=i.rect(v),r.appendChild(f),f},_drawNavigationHighlighter:function(n,t,i,r){var u={id:"nodeHighlighter",x:n.x*r,y:n.y*r,width:n.width*r,height:n.height*r,fill:"transparent",stroke:"black","stroke-dasharray":"2 2","shape-rendering":"crispEdges",style:"pointer-events: none"};i.appendChild(t.rect(u))},_removeNodeHighlighter:function(n,t){var i=n.getElementById("nodeHighlighter");i&&n.removeChild(i,t)},_drawPortHighlighter:function(n,i,r,u,f){var l,o,e,h,c,a,d=i.width?i.width:i._width,g=i.height?i.height:i._height,s,v="#8CC63F",w="#1A1A1A",b=.5,y,p,k;return n?(o=t.datavisualization.Diagram.Size(n.size*2,n.size*2),e=t.datavisualization.Diagram.Util._getPortPosition(n,t.datavisualization.Diagram.Util.bounds(i,!0)),p=t.Matrix.identity(),t.Matrix.rotate(p,i.rotateAngle,i.offsetX,i.offsetY),e=t.Matrix.transform(p,e),h=(e.x-n.size)*f,c=(e.y-n.size)*f,a="rotate(0,"+(h+o.width/2)+","+(c+o.height/2)+")"):(s=t.datavisualization.Diagram.Util.bounds(i,!0),o=t.datavisualization.Diagram.Size(s.width,s.height),e=t.datavisualization.Diagram.Point(s.x,s.y),h=e.x*f,c=e.y*f,w=v,v="transparent",b=2,y=t.datavisualization.Diagram.Point(i.offsetX,i.offsetY),a="rotate("+i.rotateAngle+","+y.x*f+","+y.y*f+")"),k={id:"portHighlighter","class":"ej-d-port",x:h,y:c,width:o.width*f,height:o.height*f,fill:v,stroke:w,"stroke-width":b,"pointer-events":"none",transform:a},l=r.rect(k),u.appendChild(l),l},_drawConnectorHighlighter:function(n,t,i){var u=t._adornerSvg,r=u.g({id:"connector_highlighter",visibility:"visible",transform:"scale("+i+")"});t._adornerLayer.appendChild(r);var f=this._findPath(n,t),e={id:"highlighter_segments",d:f,fill:"none",stroke:"#0dc923","stroke-width":n.lineWidth,"pointer-events":"none"},o=u.path(e);return r.appendChild(o),r},_removeConnectorHighlighter:function(n,t){var i=t.getElementById("connector_highlighter");i&&n.removeChild(i)},_removePortHighlighter:function(n,t){var i=n.getElementById("portHighlighter");i&&n.removeChild(i,t)},_renderPhaseResize:function(n,i,r,u,f){var s,e=[],l="",a=!1,v=!1,o=t.datavisualization.Diagram.Util.bounds(n),c,h;s;e=[];e.push({x:o.topLeft.x*r,y:o.topLeft.y*r});e.push({x:o.bottomLeft.x*r,y:o.bottomLeft.y*r});s=this._convertToSVGPoints(e);h={id:"w-resize",points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":"none"};c=i.polyline(h);f.appendChild(c);s;e=[];e.push({x:o.topLeft.x*r,y:o.topLeft.y*r});e.push({x:o.topRight.x*r,y:o.topRight.y*r});s=this._convertToSVGPoints(e);h={id:"n-resize",points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":"none"};c=i.polyline(h);f.appendChild(c);l="";n.orientation=="vertical"&&(l="e-resize",v=!0);s;e=[];e.push({x:o.topRight.x*r,y:o.topRight.y*r});e.push({x:o.bottomRight.x*r,y:o.bottomRight.y*r});s=this._convertToSVGPoints(e);v&&(h={id:"e-resize-hitTest","class":l,points:s,fill:"transparent",stroke:"transparent","stroke-width":10,"pointer-events":v?"stroke":"none"},c=i.polyline(h),f.appendChild(c));h={id:"e-resize","class":l,points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":v?"stroke":"none"};c=i.polyline(h);f.appendChild(c);l="";n.orientation=="horizontal"&&(l="s-resize",a=!0);s;e=[];e.push({x:o.bottomLeft.x*r,y:o.bottomLeft.y*r});e.push({x:o.bottomRight.x*r,y:o.bottomRight.y*r});s=this._convertToSVGPoints(e);a&&(h={id:"s-resize-hitTest","class":l,points:s,fill:"transparent",stroke:"transparent","stroke-width":10,"pointer-events":a?"stroke":"none"},c=i.polyline(h),f.appendChild(c));h={id:"s-resize","class":l,points:s,"stroke-dasharray":"3,3",fill:"transparent",stroke:"red","stroke-width":2,"pointer-events":a?"stroke":"none"};c=i.polyline(h);f.appendChild(c)},renderSelector:function(t,i,r,u,f,e){var s,h,o,c;n(".phaseSelector").remove();s=t.width?t.width:t._width;h=t.height?t.height:t._height;t.segments?(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible"}),r.appendChild(o),this._renderEndPointHandle(t,i,u)):t.type!="phase"?t.isLane||t.isSwimlane?(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible"}),r.appendChild(o),this._renderPhaseResize(t,i,u,f,o,e)):(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible",transform:"translate("+(t.offsetX-s*t.pivot.x)*u+","+(t.offsetY-h*t.pivot.y)*u+"),rotate("+t.rotateAngle+","+s*t.pivot.x*u+","+h*t.pivot.y*u+")"}),r.appendChild(o),this._renderResizeHandle(t,i,u,f)):t.type=="phase"&&e&&(o=i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible",transform:"translate("+e.x*u+","+e.y*u+"),rotate(0,"+e.width/2*u+","+e.height/2*u+")"}),i.document.getElementById(i.document.id+"handle_g")||r.appendChild(o),c=i.rect({id:"phaseSelector","class":"phaseSelector","stroke-width":2,"stroke-dasharray":"3,3","pointer-events":"none",width:e.width<0?1:e.width*u,height:e.height<0?1:e.height*u,fill:"transparent",stroke:"red"}),o.appendChild(c))},_renderResizeHandle:function(n,i,r,u){var f=n.width?n.width:n._width,e=n.height?n.height:n._height,s=n.pivot,o=t.datavisualization.Diagram.Point(f*s.x,-20/r);u&t.datavisualization.Diagram.SelectorConstraints.Rotator&&n.type!="umlclassifier"&&(this._renderPivotLine(n,i,r),this._renderRotateThumb("rotateHandle",n,o.x,o.y,r,i));u&t.datavisualization.Diagram.SelectorConstraints.Resizer&&(this._renderResizeBorder("resizeBorder",n,i,r),n.type!="umlclassifier"&&(this._renderResizeCorner("nw-resize",n,0,0,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest)),this._renderResizeCorner("n-resize",n,f/2*r,0,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorth)),this._renderResizeCorner("ne-resize",n,f*r,0,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast)),this._renderResizeCorner("w-resize",n,0,e/2*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeWest)),this._renderResizeCorner("e-resize",n,f*r,e/2*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeEast)),this._renderResizeCorner("sw-resize",n,0,e*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest)),this._renderResizeCorner("s-resize",n,f/2*r,e*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouth)),this._renderResizeCorner("se-resize",n,f*r,e*r,i,!(n.constraints&t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast))))},renderUserHandles:function(n,t,i,r,u,f,e){var h,s,o;if(t&&(t.type==="phase"&&e&&(h=e._getPhaseBounds(t)),n.length))for(s=i.g({id:i.document.id+"userHandle_g","class":"userHandle","pointer-events":"visible"}),f.appendChild(s),o=0;o<n.length;o++)(r&&n[o].enableMultiSelection||!r)&&this._renderUserHandle(n[o],t,i,u,s,h,e)},_renderUserHandle:function(n,i,r,u,f,e,o){var s,w=this._getHandlePosition(n,i,u,e,o),l=w.x*u,a=w.y*u,g=this._getHandleShape(n,l,a),k,v,y,it,d,c,h,p;n._size=n.size;var nt=f.appendChild(r.circle(g)),tt={id:n.name+"_title"},b=r.title(tt);b.innerHTML=n.name;nt.appendChild(b);switch(n.shape){case"path":k=n._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(0,0,n.size/2,n.size/2,n.pathData,r);s=this._getHandleIcon(n,l-n.size/4,a-n.size/4);s.d=k;f.appendChild(r.path(s));break;case"image":s=this._getHandleIcon(n,l-n.size/4,a-n.size/4);s.preserveAspectRatio="none";v=new Image;v.src=n.source;y=r.image(s);y.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",v.src);f.appendChild(y);break;case"native":it=n.visible?"visible":"hidden";s=this._getHandleIcon(n,l-n.size/4,a-n.size/4);d=o._renderEjTemplate("#"+n.templateId,n);c=document.createElement("div");c.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"><g id="tempNative">'+d+"<\/g><\/svg>";document.body.appendChild(c);h=document.getElementById("tempNative").cloneNode(!0);h.id=n.name+"_shape";f.appendChild(h);var e=h.getBBox(),rt=s.width,ut=s.height,ft=e.width?rt/e.width:1,et=e.height?ut/e.height:1;h.setAttribute("transform","scale("+ft+","+et+")");c.parentNode.removeChild(c);p=r.g(s);p.appendChild(h);f.appendChild(p)}},_getHandleIcon:function(n,t,i){var r=n.visible?"visible":"hidden";return{id:n.name+"_icon","class":"userHandle-icon",fill:n.pathColor,transform:"translate("+t+","+i+")",visibility:r,width:n.size/2,height:n.size/2}},_getHandlePosition:function(n,i,r,u,f){var o,s,e;if(i){if(i.segments&&n.offset)return this._getConnectorHandlePosition(n,i,r,f).position;o=t.datavisualization.Diagram.Point();s=i.type==="phase"&&u?t.datavisualization.Diagram.Util.bounds(u):t.datavisualization.Diagram.Util.bounds(i);var l=n.position,h=10,c=t.Matrix.identity();i.rotateAngle&&t.Matrix.rotate(c,i.rotateAngle);e=new t.datavisualization.Diagram.Point;switch(l){case"topleft":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,h+n.size/2));o.x=s.topLeft.x-e.x/r;o.y=s.topLeft.y-e.y/r;break;case"topcenter":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(0,h+n.size/2));o.x=s.topCenter.x-e.x/r;o.y=s.topCenter.y-e.y/r;break;case"topright":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,-(h+n.size/2)));o.x=s.topRight.x+e.x/r;o.y=s.topRight.y+e.y/r;break;case"middleleft":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(-(h+n.size/2),0));o.x=s.middleLeft.x+e.x/r;o.y=s.middleLeft.y+e.y/r;break;case"middleright":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,0));o.x=s.middleRight.x+e.x/r;o.y=s.middleRight.y+e.y/r;break;case"bottomleft":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(-(h+n.size/2),h+n.size/2));o.x=s.bottomLeft.x+e.x/r;o.y=s.bottomLeft.y+e.y/r;break;case"bottomcenter":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(0,h+n.size/2));o.x=s.bottomCenter.x+e.x/r;o.y=s.bottomCenter.y+e.y/r;break;case"bottomright":e=t.Matrix.transform(c,t.datavisualization.Diagram.Point(h+n.size/2,h+n.size/2));o.x=s.bottomRight.x+e.x/r;o.y=s.bottomRight.y+e.y/r}return o}},_getConnectorHandlePosition:function(n,i,r,u){var e=t.datavisualization.Diagram.Util._findOffsetOnConnector(i,n,n.segmentOffset,u),o=e.segment,s=e.point,c=e.offset,a=i.segments[o],l=i.segments[o].points[s],f=t.datavisualization.Diagram.Geometry.findAngle(l,i.segments[o].points[s+1]),h;return n.alignment&&n.alignment!="auto"?(n.offset==1&&(f+=180),{position:t.datavisualization.Diagram.Geometry.transform(e.offset,n.offset!=0&&n.offset!=1?f+45:f,this._getAlignedPosition(i,n)),angle:f}):(h=this._avoidOverlapWithSourceAndTarget(i,n.offset,n.size,e.offset,f,o,s,u),c={position:h.position,angle:n.offset==1?(180+f)%360:f,direction:h.direction},c)},_getAlignedPosition:function(n,t){var i=t.text===undefined?10:0;switch(t.alignment){case"center":return 0;case"before":return-((t.size||0)/2+i);case"after":return(t.size||0)/2+i}return 0},_avoidOverlapWithSourceAndTarget:function(n,i,r,u,f,e,o,s){var y,p,w=u,nt=n.segments[e],h=90,l,k,c;if(i==0?(y=n.segments[e].points[o+2]?n.segments[e].points[o+2]:n.segments[e+1]?n.segments[e+1].points[1]:null,y&&(p=t.datavisualization.Diagram.Geometry.findAngle(n.segments[e].points[o],y)),n.sourceNode&&(h=45)):i==1&&(y=n.segments[e].points[o-1]?n.segments[e].points[o-1]:n.segments[e-1]?n.segments[e-1][n.segments[e].points.length-2]:null,y&&(p=t.datavisualization.Diagram.Geometry.findAngle(n.segments[e].points[o+1],y)),f+=180,f%=360,n.targetNode&&(h=45)),y)if(f%90==0)p>270&&f==0&&(f=360),f==90?p<f?(f+=h,l="right"):(f-=h,l="left"):f==270?p<f?(f+=h,l="left"):(f-=h,l="right"):f==180?p<f?(f+=h,l="bottom"):(f-=h,l="top"):p<f?(f+=h,l="top"):(f-=h,l="bottom"),w=t.datavisualization.Diagram.Geometry.transform(w,f,r!=undefined?Math.max(5,r/2+10):0);else{var d=45,a=135,b=225,g=315,v;(i==0&&n.sourceNode||i==1&&n.targetNode)&&(k=i==0&&n.sourceNode?s.nameTable[n.sourceNode]:s.nameTable[n.targetNode],k&&(v=t.datavisualization.Diagram.Util.bounds(k)),v&&(c=180/(2+2/(v.height/v.width)),d=c,a=180-c,b=a+2*c,g=360-c));h=f>=d&&f<=a||f>=b&&f<=g?f%180>90?-h:h:f>a&&f<b?f>180?-45:45:f>0?-45:45;w=t.datavisualization.Diagram.Geometry.transform(w,f+h,r!=undefined?Math.max(5,r/2+10):0)}else{var d=45,a=135,b=225,g=315,v;(i==0&&n.sourceNode||i==1&&n.targetNode)&&(k=i==0&&n.sourceNode?s.nameTable[n.sourceNode]:s.nameTable[n.targetNode],k&&(v=t.datavisualization.Diagram.Util.bounds(k)),v&&(c=180/(2+2/(v.height/v.width)),d=c,a=180-c,b=a+2*c,g=360-c));h=f>=d&&f<=a||f>=b&&f<=g?f%180>90?-h:h:f>a&&f<b?f>180?-45:45:f<=d?-45:45;f+=360;f%=360;w=t.datavisualization.Diagram.Geometry.transform(w,f+h,r!=undefined?Math.max(5,r/2+(Math.abs(h%45)>0?13:10)):0)}return{position:w,direction:l}},_getHandleShape:function(n,t,i){var r=n.visible?"visible":"hidden";return{id:n.name+"_shape","class":"userHandle",cx:t,cy:i,r:n.size/2,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth||0,visibility:r}},_updateHandleShape:function(n,t,i,r){var u=n.visible?"visible":"hidden",f={id:n.name+"_shape",cx:t,cy:i,r:n.size/2,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth||0,visibility:u};r.circle(f)},_updateHanleIcon:function(n,t,i,r,u){var f=n.visible?"visible":"hidden",e={id:n.name+"_icon",d:t,fill:n.pathColor,transform:"translate("+r+","+u+")",visibility:f};i.path(e)},_getHanleIcon:function(n,t){return{id:n.name,d:t,stroke:n.borderColor,"stroke-width":n.borderWidth,fill:n.fillColor}},renderPivotPoint:function(n,i,r){var u=n.width*n.pivot.x,f=n.height*n.pivot.y;r.getElementById("pivot")?t.datavisualization.Diagram.SvgContext._updateResizeCorner("pivot",u*i,f*i,r):t.datavisualization.Diagram.SvgContext._renderResizeCorner("pivot",n,u*i,f*i,r,undefined,4);this._updatePivotLine(n,r,i,!0)},_removePivotPoint:function(n,t,i){var r=t.getElementById("pivot");r&&(r.parentNode.removeChild(r),this._updatePivotLine(n,t,i,!1))},_renderPivotLine:function(n,i,r){if(!n.container){var u=n.width?n.width:n._width,h=n.height?n.height:n._height,f=t.datavisualization.Diagram.Point(u*n.pivot.x,-20/r),e=t.datavisualization.Diagram.Point(u*n.pivot.x,0),o=i.getElementById(i.document.id+"handle_g"),s=i.line({id:"pivotLine",x1:f.x*r,y1:f.y*r,x2:e.x*r,y2:e.y*r,stroke:"black","stroke-width":1,"stroke-dasharray":"2,3",fill:"none"});o.appendChild(s)}},_renderResizeBorder:function(n,i,r,u){var e=r.getElementById(r.document.id+"handle_g"),o=i.width?i.width:i._width,s=i.height?i.height:i._height,f;f=i.type=="umlclassifier"?t.datavisualization.Diagram.ClassifierHelper.renderResizeBorder(n,i,r,u):r.rect({id:n,"class":"resizeRect",width:o*u,height:s*u,stroke:"#097F7F","stroke-width":.6,"stroke-dasharray":"6,3",fill:"none","pointer-events":"none"});e.appendChild(f)},_renderResizeCorner:function(n,i,r,u,f,e,o){var l=f.getElementById(f.document.id+"handle_g"),h,c="white",s;t.datavisualization.Diagram.Util.canResize(i)||(c="darkgray");e&&(c="darkgray",h="none");s={id:n,"class":"resizeCorners",fill:c,stroke:"black","stroke-width":1,cx:r,cy:u,r:o||7};l.appendChild(f.circle(s));s={id:n+"_transparent","class":n,fill:"transparent",cx:r,cy:u,r:o||10};h&&(s["pointer-events"]=h);l.appendChild(f.circle(s))},_renderRotateThumb:function(n,i,r,u,f,e){if(!i.container){var h=e.getElementById(e.document.id+"handle_g"),c="#231f20";t.datavisualization.Diagram.Util.canRotate(i)||(c="darkgray");var o=20,s=20,l={id:"rotatehandle","class":n,fill:c,stroke:"black","stroke-width":.5,width:o,height:s,d:"M 16.856 10.239 L 18 3.438 l -2.189 0.817 c -0.974 -1.694 -2.482 -2.995 -4.326 -3.696 C 9.375 -0.245 7.071-0.18 5.01 0.744 C 2.942 1.668 1.365 3.342 0.558 5.453 c -0.803 2.115 -0.738 4.414 0.185 6.478 c 0.925 2.064 2.6 3.645 4.714 4.45 c 0.969 0.371 1.993 0.554 3.013 0.554 c 1.345 0 2.685 -0.317 3.897 -0.948 l -1.016 -1.962 c -1.584 0.822-3.445 0.929 -5.114 0.293 c -1.56 -0.596 -2.793 -1.762 -3.479 -3.289 C 2.078 9.502 2.031 7.803 2.622 6.244 C 3.216 4.68 4.387 3.443 5.914 2.761 C 7.437 2.079 9.137 2.03 10.7 2.626 c 1.246 0.475 2.271 1.328 2.986 2.424 L 11.54 5.851 L 16.856 10.239 Z",transform:"translate("+(r*f-o/2)+","+(u*f-s)+")"},a=e.path(l),v=e.circle({id:"rotate","class":n,fill:"transparent",stroke:"none",cx:o/2,cy:s/2,r:13,transform:"translate("+(r*f-o/2)+","+(u*f-s)+")"});h.appendChild(a);h.appendChild(v)}},_refreshEndPointHandles:function(n,t,i){var r,f,u;if(n&&n.segments){if(r=t.getElementById(t.document.id+"handle_g"),r&&r.childNodes.length>0)for(f=r.childNodes.length-1;f>=0;f--)u=r.childNodes[f],u.id!=="sourceEndPoint"&&u.id!=="targetEndPoint"&&u.parentNode.removeChild(u);this._renderEndPointHandle(n,t,i)}},_renderEndPointHandle:function(n,i,r){var e,f,u,o;if(!n.isPhase)for(e=t.datavisualization.Diagram.Util.canDragSegmentThumbs(n),f=0;f<n.segments.length;f++)u=n.segments[f],u.type=="bezier"&&(this._renderBezierLine("bezierline1_"+f,u._startPoint,u._point1,r,i,e),this._renderBezierLine("bezierline2_"+f,u._endPoint,u._point2,r,i,e),this._renderEndPointCorner("bezierpoint1_"+f,u._point1.x*r,u._point1.y*r,!1,i,e),this._renderEndPointCorner("bezierpoint2_"+f,u._point2.x*r,u._point2.y*r,!1,i,e)),o=u.points,f==0&&this._renderEndPointCorner("sourceEndPoint",u._startPoint.x*r,u._startPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)),f==n.segments.length-1?(this._renderEndPointCorner("targetEndPoint",u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isTargetConnected(n),i,t.datavisualization.Diagram.Util.canDragTargetEnd(n)),u.type=="orthogonal"&&this._renderTerminalOrthoThumbs(u,i,r,f,e)):u.type!="orthogonal"?this._renderSegmentEndThumb("segmentEnd_"+f,u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)):this._renderTerminalOrthoThumbs(u,i,r,f,e)},_renderTerminalOrthoThumbs:function(n,i,r,u,f){var o,e,h,s;if(n.points.length>2)for(e=0;e<n.points.length-1;e++)s=t.datavisualization.Diagram.Geometry.distance(n.points[e],n.points[e+1]),o=n.points[e].y.toFixed(2)==n.points[e+1].y.toFixed(2)?"horizontal":"vertical",h=s>=50?"visible":"hidden",this._renderOrthogonalThumb("OrthoThumb_"+e+"_"+u,(n.points[e].x+n.points[e+1].x)/2*r,(n.points[e].y+n.points[e+1].y)/2*r,i,h,o,f);else s=n.length||t.datavisualization.Diagram.Geometry.distance(n._startPoint,n._endPoint),h=s>=50?"visible":"hidden",o=n._startPoint.y.toFixed(2)==n._endPoint.y.toFixed(2)?"horizontal":"vertical",this._renderOrthogonalThumb("OrthoThumb_"+u,(n._endPoint.x+n._startPoint.x)/2*r,(n._endPoint.y+n._startPoint.y)/2*r,i,h,o,f)},_renderEndPointCorner:function(n,t,i,r,u,f){var s=u.getElementById(u.document.id+"handle_g"),o=r?"#8CC63F":"white",e;f||(o="darkgray");e={id:n,"class":n,opacity:.75,fill:o,stroke:"black","stroke-width":2,cx:t,cy:i,r:7};u.getElementById(n)?u.circle(e):s.appendChild(u.circle(e))},_renderSegmentEndThumb:function(n,t,i,r,u,f){var s=u.getElementById(u.document.id+"handle_g"),e="#e2e2e2",o;f||(e="darkgray");o={id:n,"class":"segmentEnd",fill:e,stroke:"black","stroke-width":2,cx:t,cy:i,r:5};s.appendChild(u.circle(o))},_renderOrthogonalThumb:function(n,t,i,r,u,f,e){var o,s,h,l,c,a;f=="horizontal"?(o="M0,7 L15,0 L30,7 L15,14 z",s=-15,h=-7):(o="M7,0 L0,15 L7,30 L14,15 z",s=-7,h=-15);l=r.getElementById(r.document.id+"handle_g");c="#e2e2e2";e||(c="darkgray");a={id:n,"class":"segmentEnd",fill:c,stroke:"black","stroke-width":1,d:o,transform:"translate("+(t+s)+","+(i+h)+")",visibility:u};l.appendChild(r.path(a))},_renderBezierLine:function(n,t,i,r,u){var f=u.line({id:n,x1:t.x*r,y1:t.y*r,x2:i.x*r,y2:i.y*r,stroke:"black","stroke-width":1,"stroke-dasharray":"3,3",fill:"none"}),e=u.getElementById(u.document.id+"handle_g");e.appendChild(f)},_renderControlPointCorner:function(n,t,i,r){var u=r.g({"class":n}),f;r.getElementById(r.document.id+"handle_g").appendChild(u);f={id:n+"_"+i,fill:"white",stroke:"black","stroke-width":2,cx:t.x,cy:t.y,r:5};u.appendChild(r.circle(f))},updateSelector:function(n,i,r,u,f){var o,s,e,l,c,h;if(n)if(o=n.width?n.width:n._width,s=n.height?n.height:n._height,n.segments)this._updateEndPointHandle(n,i,r),f&t.datavisualization.Diagram.SelectorConstraints.UserHandles&&this.updateUserHandles(u.model.selectedItems.userHandles,n,i,!1,!1,r,u);else if(n.type==="phase")e=u._getPhaseBounds(n),i.g({id:i.document.id+"handle_g","class":"handle","pointer-events":"visible",transform:"translate("+e.x*r+","+e.y*r+"),rotate(0,"+e.width/2*r+","+e.height/2*r+")"}),i.rect({id:"phaseSelector","class":"phaseSelector","stroke-width":2,"stroke-dasharray":"3,3","pointer-events":"none",width:e.width<0?1:e.width*r,height:e.height<0?1:e.height*r,fill:"transparent",stroke:"red"});else if(n.isSwimlane||n.isLane||(l=i.g({id:i.document.id+"handle_g",transform:"translate("+(n.offsetX-o*n.pivot.x)*r+","+(n.offsetY-s*n.pivot.y)*r+"),rotate("+n.rotateAngle+","+o*n.pivot.x*r+","+s*n.pivot.y*r+")"})),c=u.getObjectType(n),c!=="group"&&n.type!=="pseudoGroup"&&(u.activeTool.name=="move"||u.activeTool.name=="rotate")&&u.activeTool.inAction||this._updateResizeHandle(n,i,r,f),u.activeTool.name=="rotatetool"&&u.activeTool.inAction&&this.renderPivotPoint(n,r,i),u.model.selectedItems.userHandles&&u.model.selectedItems.userHandles.length>0&&(h=!1,u.selectionList[0]&&u.selectionList[0].name=="multipleSelection"&&(h=!0),f&t.datavisualization.Diagram.SelectorConstraints.UserHandles))return this.updateUserHandles(u.model.selectedItems.userHandles,n,i,h,!1,r,u),!0},_updatePhaseResize:function(n,i,r){var e,u=[],o,f=t.datavisualization.Diagram.Util.bounds(n);e;u=[];u.push({x:f.topLeft.x*r,y:f.topLeft.y*r});u.push({x:f.bottomLeft.x*r,y:f.bottomLeft.y*r});e=this._convertToSVGPoints(u);o={id:"w-resize",points:e};i.polyline(o);e;u=[];u.push({x:f.topLeft.x*r,y:f.topLeft.y*r});u.push({x:f.topRight.x*r,y:f.topRight.y*r});e=this._convertToSVGPoints(u);o={id:"n-resize",points:e};i.polyline(o);e;u=[];u.push({x:f.topRight.x*r,y:f.topRight.y*r});u.push({x:f.bottomRight.x*r,y:f.bottomRight.y*r});e=this._convertToSVGPoints(u);o={id:"e-resize-hitTest",points:e};i.polyline(o);o={id:"e-resize",points:e};i.polyline(o);e;u=[];u.push({x:f.bottomLeft.x*r,y:f.bottomLeft.y*r});u.push({x:f.bottomRight.x*r,y:f.bottomRight.y*r});e=this._convertToSVGPoints(u);o={id:"s-resize-hitTest",points:e};i.polyline(o);o={id:"s-resize",points:e};i.polyline(o)},_updateResizeHandle:function(n,i,r,u){if(n.isSwimlane||n.isLane)this._updatePhaseResize(n,i,r,u);else{var f=n.width?n.width:n._width,e=n.height?n.height:n._height,s=n._corners,o=t.datavisualization.Diagram.Point(f*n.pivot.x,-20/r);u&t.datavisualization.Diagram.SelectorConstraints.Rotator&&n.type!="umlclassifier"&&(this._updateRotateHandle("rotate",o.x,o.y,r,i,n),this._updatePivotLine(n,i,r));u&t.datavisualization.Diagram.SelectorConstraints.Resizer&&(n.type!="umlclassifier"&&(this._updateResizeCorner("nw-resize",0,0,i),this._updateResizeCorner("n-resize",f/2*r,0,i),this._updateResizeCorner("ne-resize",f*r,0,i),this._updateResizeCorner("w-resize",0,e/2*r,i),this._updateResizeCorner("e-resize",f*r,e/2*r,i),this._updateResizeCorner("sw-resize",0,e*r,i),this._updateResizeCorner("s-resize",f/2*r,e*r,i),this._updateResizeCorner("se-resize",f*r,e*r,i)),this._updateResizeBorder("resizeBorder",n,i,r))}},_updateRotateHandle:function(n,t,i,r,u){var f=20,e=20,o={id:"rotatehandle",transform:"translate("+(t*r-f/2)+","+(i*r-e)+")"};u.path(o);u.circle({id:"rotate",transform:"translate("+(t*r-f/2)+","+(i*r-e)+")"})},_updatePivotLine:function(n,i,r,u){var f=n.width?n.width:n._width,s=n.height?n.height:n._height,o=t.datavisualization.Diagram.Point(f*n.pivot.x,-20/r),e,h;e=u?t.datavisualization.Diagram.Point(f*n.pivot.x,s*n.pivot.y):t.datavisualization.Diagram.Point(f*n.pivot.x,0);h=i.line({id:"pivotLine",x1:o.x*r,y1:o.y*r,x2:e.x*r,y2:e.y*r})},_updateResizeBorder:function(n,i,r,u){var f=i.width?i.width:i._width,e=i.height?i.height:i._height,o;i.type=="umlclassifier"?o=t.datavisualization.Diagram.ClassifierHelper.renderResizeBorder(n,i,r,u):r.rect({id:n,width:f*u,height:e*u})},_updateResizeCorner:function(n,t,i,r){var u={id:n,cx:t,cy:i};r.circle(u);u={id:n+"_transparent",cx:t,cy:i};r.circle(u)},_updateEndPointHandle:function(n,i,r){for(var u,e,o=t.datavisualization.Diagram.Util.canDragSegmentThumbs(n),f=0;f<n.segments.length;f++)u=n.segments[f],e=u.points,f==n.segments.length-1?(this._updateEndPointCorner("targetEndPoint",e[e.length-1].x*r,e[e.length-1].y*r,t.datavisualization.Diagram.Util.isTargetConnected(n),i,t.datavisualization.Diagram.Util.canDragTargetEnd(n)),u.type=="orthogonal"&&this._updateTerminalOrthoThumbs(u,i,r,f,o)):u.type!="orthogonal"?this._updateSegmentEndThumb("segmentEnd_"+f,u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)):this._updateTerminalOrthoThumbs(u,i,r,f,o),f==0&&this._updateEndPointCorner("sourceEndPoint",e[0].x*r,e[0].y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)),u.type=="bezier"&&(this._updateEndPointCorner("bezierpoint1_"+f,u._point1.x*r,u._point1.y*r,!1,i,o),this._updateEndPointCorner("bezierpoint2_"+f,u._point2.x*r,u._point2.y*r,!1,i,o),this._updateBezierLine("bezierline1_"+f,u._startPoint,u._point1,r,i),this._updateBezierLine("bezierline2_"+f,u._endPoint,u._point2,r,i))},_updateEndPointCorner:function(n,t,i,r,u,f){var e=r?"#8CC63F":"white",o;f||(e="darkgray");o={id:n,fill:e,cx:t,cy:i};u.circle(o)},_updateSegmentEndThumb:function(n,t,i,r,u){var f={id:n,cx:t,cy:i};u.circle(f)},_updateOrthoThumb:function(n,t,i,r,u,f,e){var c="#e2e2e2",o,s,h,l;e||(c="darkgray");f=="horizontal"?(o="M0,7 L15,0 L30,7 L15,14 z",s=-15,h=-7):(o="M7,0 L0,15 L7,30 L14,15 z",s=-7,h=-15);l={id:n,visibility:u,transform:"translate("+(t+s)+","+(i+h)+")",d:o,fill:c};r.path(l)},_updateTerminalOrthoThumbs:function(n,i,r,u,f){var o,e,h,s;if(n.points.length>2)for(e=0;e<n.points.length-1;e++)s=t.datavisualization.Diagram.Geometry.distance(n.points[e],n.points[e+1]),o=n.points[e].y.toFixed(2)==n.points[e+1].y.toFixed(2)?"horizontal":"vertical",h=s>=50?"visible":"hidden",this._updateOrthoThumb("OrthoThumb_"+e+"_"+u,(n.points[e].x+n.points[e+1].x)/2*r,(n.points[e].y+n.points[e+1].y)/2*r,i,h,o,f);else s=n.length||t.datavisualization.Diagram.Geometry.distance(n._startPoint,n._endPoint),o=n._startPoint.y.toFixed(2)==n._endPoint.y.toFixed(2)?"horizontal":"vertical",h=s>=50?"visible":"hidden",this._updateOrthoThumb("OrthoThumb_"+u,(n._endPoint.x+n._startPoint.x)/2*r,(n._endPoint.y+n._startPoint.y)/2*r,i,h,o,f)},_updateBezierLine:function(n,t,i,r,u){var f=u.line({id:n,x1:t.x*r,y1:t.y*r,x2:i.x*r,y2:i.y*r})},_updateControlPointCorner:function(n,t,i,r){r.circle({id:n+"_"+i,cx:t.x,cy:t.y})},updateUserHandles:function(n,i,r,u,f,e,o){var h=r.document.getElementById(r.document.id+"userHandle_g"),s;if(o.model.selectedItems.constraints&t.datavisualization.Diagram.SelectorConstraints.UserHandles)if(h){if(n&&n.length>0)for(s=0;s<n.length;s++)(u&&n[s].enableMultiSelection||!u)&&this._updateHandle(n[s],i,r,f,e,o)}else this.renderUserHandles(n,i,r,u,e,o._adornerLayer,o)},_updateHandle:function(n,i,r,u,f,e){var s,o,h,c;!u&&i&&n.visible?(s=this._getHandlePosition(n,i,f,null,e),o=n._absolutePath,o&&n.size==n._size||(o=n._absolutePath=t.datavisualization.Diagram.Geometry.updatePath(0,0,n.size/2,n.size/2,n.pathData,r)),n._size=n._size,h=s.x*f,c=s.y*f,this._updateHandleShape(n,h,c,r),this._updateHanleIcon(n,o,r,h-n.size/4,c-n.size/4),r.getElementById(n.name+"_shape")&&n.visible&&(r.getElementById(n.name+"_shape").style.display="block",r.getElementById(n.name+"_icon").style.display="block")):r.getElementById(n.name+"_shape")&&(r.getElementById(n.name+"_shape").style.display="none",r.getElementById(n.name+"_icon").style.display="none")},clearSelector:function(n,t){var i=n.getElementById(n.document.id+"handle_g");i&&t.removeChild(i);i=n.getElementById(n.document.id+"userHandle_g");i&&t.removeChild(i)},clearSegments:function(t){var i=t.getElementById(t.document.id+"handle_g");n(i).find(".segmentEnd").remove()},addSegments:function(n,t,i){var r=n.getElementById(n.document.id+"handle_g");this._renderSegmentHandle(t,n,i)},_renderSegmentHandle:function(n,i,r){var e,f,u,o;if(!n.isPhase)for(e=t.datavisualization.Diagram.Util.canDragSegmentThumbs(n),f=0;f<n.segments.length;f++)u=n.segments[f],u.type=="bezier"&&(this._renderBezierLine("bezierline1_"+f,u._startPoint,u._point1,r,i,e),this._renderBezierLine("bezierline2_"+f,u._endPoint,u._point2,r,i,e),this._renderEndPointCorner("bezierpoint1_"+f,u._point1.x*r,u._point1.y*r,!1,i,e),this._renderEndPointCorner("bezierpoint2_"+f,u._point2.x*r,u._point2.y*r,!1,i,e)),o=u.points,f===0||f===n.segments.length-1||(u.type!="orthogonal"?this._renderSegmentEndThumb("segmentEnd_"+f,u._endPoint.x*r,u._endPoint.y*r,t.datavisualization.Diagram.Util.isSourceConnected(n),i,t.datavisualization.Diagram.Util.canDragSourceEnd(n)):this._renderTerminalOrthoThumbs(u,i,r,f,e))},_initializePageBreaks:function(n,t,i){var r=n.g(t);return i.appendChild(r),r},_renderVPageBreakLine:function(n,t,i,r){var u=i.line({x1:n.x,y1:n.y,x2:t.x,y2:t.y,style:"stroke:#aaaaaa;stroke-width:1;stroke-dasharray:10,10 "});r.appendChild(u)},_renderPageSettingsRect:function(n,t,i,r,u,f,e){var o=i.rect({id:"pageback",x:n.x,y:n.y,width:t.x,height:t.y,style:"fill:"+f+";stroke:"+u+";stroke-width:"+e+""});r.appendChild(o)},_updatePageBakground:function(n,i,r,u,f,e,o){var s=r.document.getElementById("pageback"),h={x:n.x,y:n.y,width:i.x<0?0:i.x,height:i.y<0?0:i.y,style:"fill:"+e+";stroke:"+f+";stroke-width:"+o+""};s&&t.datavisualization.Diagram.Util.attr(s,h)},_renderHPageBreakLine:function(n,t,i,r){var u=i.line({x1:n.x,y1:n.y,x2:t.x,y2:t.y,style:"stroke:#aaaaaa;stroke-width:1;stroke-dasharray:10,10 "});r.appendChild(u)},_removePageBreaks:function(n,t,i){t!=null&&i!=null&&i.removeChild(t)},removeChild:function(n,t){var r=t.svg.document.getElementById(n.name),u=t.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],f=this._findChild(u.childNodes,n),i;r&&r.parentNode.removeChild(r);f&&u.removeChild(f);n._type==="node"&&n.type==="html"&&(i=u.children[n.name+"_parentdiv"],i&&i.parentNode&&i.parentNode.removeChild(i))}};t.datavisualization.Diagram.DiagramContext={_renderNodes:function(n,t,i,r){var f,u,e,o,s;if(r.nodes())for(f=r.nodes(),u=0,e=f.length;u<e;++u)o=r.nameTable[f[u].name],s=n.svg||n._canvas,this._renderNodeObject(o,n,t,i,r)},_renderNodeObject:function(n,i,r,u,f){var e=i.svg||i._canvas;n._type!=="group"||n.parent?n.parent||i.context.renderNode(n,e,i.diagramLayer,null,f):(!n.container,i.context.renderGroup(n,e,i.diagramLayer,f.nameTable,f,r,u),t.datavisualization.Diagram.DiagramContext.update(n,f))},_renderConnectors:function(n,t){var r,e,u,i,f;if(t.connectors()){for(r=t.connectors(),e=n.svg||n._canvas,i=0,f=r.length;i<f;++i)u=r[i],t._setZorder(u);for(i=0,f=r.length;i<f;++i)u=r[i],this._renderConnectorObject(u,n,t)}},_renderConnectorObject:function(n,i,r){var u=i.svg||i._canvas;t.datavisualization.Diagram.Util.updateBridging(n,r);n.parent||i.context.renderConnector(n,u,i.diagramLayer,r)},updateViewPort:function(n){var i;n._views.forEach(function(r){i=n._views[r];i.context==t.datavisualization.Diagram.SvgContext&&i.type=="mainview"&&t.datavisualization.Diagram.PageUtil._updatePageSize(n)})},renderNode:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;i&&(i=u.document.getElementById(i.id));r.context.renderNode(n,u,i||r.diagramLayer,undefined,t)})},addLabel:function(n,t,i,r){var u,f;i._views&&i._views.forEach(function(e){u=i._views[e];f=u.svg||u.canvas;u.context._addLabel(n,t,f,i,r)})},renderPort:function(n,t,i){var r,u;i._views.forEach(function(f){r=i._views[f];u=r.svg||r._canvas;r.context._insertPort(n,t,u)})},renderConnector:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;r.context.renderConnector(n,u,i||r.diagramLayer,t)})},renderGroup:function(n,t,i){var r,u;t._views.forEach(function(f){var e;r=t._views[f];u=r.svg||r._canvas;i=r.svg.getElementById(n.parent);r.type=="overview"&&(e=!0);r.context.renderGroup(n,u,i||r.diagramLayer,t.nameTable,t,null,e)})},update:function(n,t,i){var f=!0,r,u;n.isSwimlane&&t._disableSwimlaneUptate&&(f=!1);f&&t._views.forEach(function(f){r=t._views[f];u=r.svg||r._canvas;t&&!t._isInit&&n._status!=="new"&&(n._status="update");n._type==="group"||n.type==="pseudoGroup"?r.context.updateGroup(n,u,t,i):n.segments?r.context.updateConnector(n,u,t):r.context.updateNode(n,u,t,i)})},_refreshSegments:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;n.segments&&i.context._refreshSegments(n,r,t)})},_refreshOnlySegments:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;n.segments&&i.context._refreshOnlySegments(n,r,t)})},renderShadow:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i._canvas;i.context._renderShadow(n,r)})},updateShadow:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i._canvas;i.context._updateShadow(n,r)})},removeShadow:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i._canvas;i.context._removeShadow(n,r)})},addNodeLabel:function(n,t,i,r){var u,f;r._views&&r._views.forEach(function(e){u=r._views[e];f=u.svg||u.canvas;u.context.addNodeLabel(n,t,f,i,r)})},updateLabel:function(n,i,r){var u,f;r._views.forEach(function(e){u=r._views[e];f=u.svg||u.canvas;r.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg?u.context._updateSVGLabel(n,i,f,r):u.context.updateLabel(n,i,f,r)})},updatePort:function(n,t,i){var r,u;i._views.forEach(function(f){r=i._views[f];u=r.svg||r.canvas;r.context.updatePort(n,t,u,i)})},setNodeShape:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r.canvas;r.context.setNodeShape(n,u,i,t)})},setLine:function(n,t,i){var r,u;t._views.forEach(function(f){r=t._views[f];u=r.svg||r.canvas;r.context.setLine(n,u,i,t)})},renderDecorators:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.renderDecorators(n,r,t)})},clearDecorators:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.clearDecorators(n,r,t)})},updateTargetDecoratorStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.updateTargetDecoratorStyle(n,r)})},updateSourceDecoratorStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context.updateSourceDecoratorStyle(n,r)})},updateNodeStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context._updateNodeStyle(n,r)})},updateLabelStyle:function(n,t,i){i._views.forEach(function(r){var u=i._views[r],f=u.svg||u.canvas;u.context.updateLabelStyle(n,t,f,i)})},updateConnectorStyle:function(n,t){var i,r;t._views.forEach(function(u){i=t._views[u];r=i.svg||i.canvas;i.context._updateConnectorStyle(n,r)})},updateTextBlock:function(n,t,i){var r,u;i._views.forEach(function(f){r=i._views[f];u=r.svg||r.canvas;r.context.updateTextBlock(n,t,u,i)})},updateBPMNNodeStyle:function(n,i){var f,u,r=0;if(n=t.datavisualization.Diagram.Util._updateBpmnChild(n,i),n.children)for(u=i._getChildren(n.children),r=0;r<u.length;r++)f=i.nameTable[u[r]],t.datavisualization.Diagram.DiagramContext.updateNodeStyle(f,i,n);else t.datavisualization.Diagram.DiagramContext.updateNodeStyle(n,i)},updateBPMNNodeShape:function(n,i){var f,r,u=0,e;if(n=t.datavisualization.Diagram.Util._updateBpmnChild(n,i),r=i._getChildren(n.children),r.length>0&&i.nameTable[r[0]])for(u=0;u<r.length;u++)f=i.nameTable[r[u]],f&&t.datavisualization.Diagram.DiagramContext.setNodeShape(f,i,n);else e=i._svg.getElementById(n.name),e.parentNode.removeChild(e),i.add(n)}}}(jQuery,Syncfusion),function(n,t,i){"use strict";t.widget("ejSymbolPalette","ej.datavisualization.SymbolPalette",{element:null,model:null,_requiresID:!0,nameTable:{},defaults:{width:"250px",height:"400px",labelRenderingMode:"html",paletteItemWidth:i,paletteItemHeight:i,previewWidth:i,previewHeight:i,previewOffset:{x:110,y:110},diagramId:"",headerHeight:30,selectedPaletteName:"",cssClass:"e-datavisualization-symbolpalette",showPaletteItemText:!0,allowDrag:!0,palettes:[],defaultSettings:{connector:null,node:null},selectionChange:null,create:null,destroy:null},_oldItem:null,_labelHashTable:{},dataTypes:{paletteItemWidth:"number",paletteItemHeight:"number",previewWidth:"number",previewHeight:"number",headerHeight:"number",showPaletteItemText:"boolean",allowDrag:"boolean",palettes:"array"},_canvas:null,_init:function(){t.browserInfo().name==="msie"&&Number(t.browserInfo().version)<9||(this.nameTable={},this.selectedItem=null,this.activePalette=null,this._selectedElement=null,this._renderSymbolPalette(),this._wireEvents(),this.updateScrollerViewport())},_setModel:function(t){var i,r;for(i in t)switch(i){case"width":this._setWidth(t[i]);break;case"height":this._setHeight(t[i]);break;case"paletteItemWidth":this.model.paletteItemWidth=t[i];this._redrawContent();break;case"paletteItemHeight":this.model.paletteItemHeight=t[i];this._redrawContent();break;case"headerHeight":this._setHeaderHeight(t[i]);break;case"cssClass":this._setCssClass(t[i]);break;case"showPaletteItemText":this._showItemText(t[i]);break;case"allowDrag":this._setAllowDrag(t[i]);break;case"palettes":this._updatePalettes(t[i]);break;case"selectedPaletteName":r=this._getPalette(t.selectedPaletteName);r&&r!==this.activePalette&&(n(document.getElementById(this.activePalette.name+"_header")).removeClass("selected"),this.activePalette=r,n(document.getElementById(this.activePalette.name+"_header")).addClass("selected"))}},_destroy:function(){this.element.empty().removeClass(this.model.cssClass)},_renderSymbolPalette:function(){this._canvas=document.createElement("div");this._canvas.setAttribute("class","e-scanvas");this._canvas.setAttribute("id",this.element[0].id+"_canvas");this.element[0].setAttribute("style","height:"+this.model.height+"; width:"+this.model.width+";");this.element.append(this._canvas);this.element.ejScroller({width:this._setViewPortWidth(),height:this._setViewPortHeight(),enableTouchScroll:!1});this._renderPalettes()},_updatePalettes:function(t){this.model.palettes=t;n("#"+this.element[0].id+"_canvas").empty();this._renderPalettes();this.updateScrollerViewport()},_renderPalettes:function(){var i=this.model.palettes,n,r;if(i)for(n=0,r=i.length;n<r;n++)i[n]=t.datavisualization.Diagram.Palette(i[n]),this._initPaletteitems(i[n]),this._renderPalette(i[n])},_updatePaletteItemWidth:function(n){var i=t.datavisualization.Diagram.Util.bounds(n);n.segments?i.width>this.element.width()-40&&!n.paletteItem&&t.datavisualization.Diagram.Util.scale(n,(this.element.width()-45)/i.width,1,i.center):n.width>this.element.width()-40?n.width=this.element.width()-40:n.paletteItem&&n.paletteItem.width&&n.paletteItem.width>this.element.width()-40&&(n.paletteItem.width=this.element.width()-40)},_renderHtmlLayer:function(n,i){var r=document.createElement("div"),f={id:n.id+"_htmlLayer","class":"htmlLayer"},u;return t.datavisualization.Diagram.Util.attr(r,f),u=r,r.style.pointerEvents="none",r.style.position="absolute",r.style.left=i?i.style.paddingLeft:"0px",r.style.top=i?i.style.paddingTop:"0px",n.appendChild(u),u},_initPaletteitems:function(n){if(n.items)for(var t=0;t<n.items.length;t++)n.items[t]=this._extendPaletteItem(n.items[t])},_initGroupNode:function(i){for(var r=null,f=this.model.defaultSettings&&this.model.defaultSettings.node?this.model.defaultSettings.node:null,e=this.model.defaultSettings&&this.model.defaultSettings.connector?this.model.defaultSettings.connector:null,u=0;u<i.children.length;u++)r=i.children[u],typeof r=="object"&&(r._type=="group"?(r=t.datavisualization.Diagram.Group(n.extend(!0,{},f,r)),r=t.datavisualization.Diagram.Util._updateBpmnChild(r,this),this._initGroupNode(r)):r=r.segments?t.datavisualization.Diagram.Connector(n.extend(!0,{},e,r)):t.datavisualization.Diagram.Node(n.extend(!0,{},f,r)),r=t.datavisualization.Diagram.NodeType(r,this),r.parent=i.name,i.children[u]=r.name,this.nameTable[r.name]=r)},_setViewPortWidth:function(){this.element[0].setAttribute("style","width:"+this.model.width+";");var n=this.element.width();return Math.abs(n)},_setViewPortHeight:function(){this.element[0].setAttribute("style","height:"+this.model.height+";");var n=this.element.height();return Math.abs(n)},_renderPalette:function(n){this._renderHeader(n);this._updateHeaderWrapper(n,this.model.headerHeight);this._renderContent(n);this._collapse(n);this._updatePaletteVisibility(n)},_renderHeader:function(i){var r=document.createElement("div"),u={id:i.name+"_header","class":"e-header",style:"height:"+this.model.headerHeight+"px;"};i.constraints&this._canHeaderVisible(i)||(u.style+="display:none");t.datavisualization.Diagram.Util.attr(r,u);this._renderHeaderArrow(r,i.expanded,i.name,this._canExpand(i));i.templateId&&n.templates?this._renderHeaderTemplate(r,i):this._renderHeaderText(r,i.name);this._addExpandedClass(r,i.expanded);this._disableClickClass(r,this._canExpand(i));this.model.selectedPaletteName===i.name&&(n(r).addClass("selected"),this.activePalette=i);this._canvas.appendChild(r)},_renderHeaderText:function(n,t){var i=document.createElement("span");i.setAttribute("class","e-header-text");i.innerHTML=t;n.appendChild(i)},_renderHeaderTemplate:function(n,i){var u=this._renderEjTemplate("#"+i.templateId,i),r=document.createElement("div"),f={id:i.name+"_Wrapper","class":"e-header-wrapper"};t.datavisualization.Diagram.Util.attr(r,f);this._renderTemplateContent(i,r,u);n.appendChild(r)},_renderTemplateContent:function(i,r,u){var f=document.createElement("div"),e;f.innerHTML=u;f.style.display="inline-block";document.body.appendChild(f);e=f.cloneNode(!0);e.id=i.name+"_templateHeader";var o=f.offsetWidth,h=f.offsetHeight,c=n("#"+this._id).width()-18/o,l=this.model.headerHeight/h,s=Math.min(c,l),a=(s-1)*o/2;t.datavisualization.Diagram.Util.attr(e,{style:"position: relative; left: "+a+"px; transform: scale("+s+")"});r.appendChild(e);f.parentNode.removeChild(f)},_renderHeaderArrow:function(t,i,r,u){var f,e;u?(f=t.getElementsByClassName("e-header-arrow e-icon")[0],f||(f=document.createElement("span"),f.setAttribute("class","e-header-arrow e-icon"),f.setAttribute("style","top:"+(this.model.headerHeight-16)/2+"px;"),this._addExpandedClass(f,i),this.model.selectedPaletteName===name&&n(f).addClass("selected"),t.appendChild(f))):(e=t.getElementsByClassName("e-header-arrow e-icon")[0],e&&e.parentNode.removeChild(e))},_renderContent:function(n){var r=document.getElementById(n.name+"_content"),t,i,u;if(r||(r=document.createElement("div"),this._canvas.appendChild(r)),r.setAttribute("id",n.name+"_content"),r.setAttribute("class","e-scontent"),this.model.palettes.length-1===this.model.palettes.indexOf(n)&&r.setAttribute("style","border-bottom-width: 0px;"),t=n.items,t&&t.length>0)for(i=0,u=t.length;i<u;i++)t[i].parent?this.nameTable[t[i].name]=t[i]:(this._renderItem(t[i],r),this.nameTable[t[i].name]=t[i])},_updateRenderSize:function(n,i,r){var f,e,u;if(n.paletteItem&&(n.type!=="group"||n.isLane)&&(n._type!=="group"||n.type!=="bpmn"))if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase){var u=t.datavisualization.Diagram.Util.bounds(n),o=(n.paletteItem.width?n.paletteItem.width:this.model.paletteItemWidth)/u.width,s=(n.paletteItem.height?n.paletteItem.height:this.model.paletteItemHeight)/u.height;t.datavisualization.Diagram.Util.scale(n,o,s,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase||n.isPhase&&n.paletteItem.width!=n.paletteItem.height){var u=t.datavisualization.Diagram.Util.bounds(n),o=(n.paletteItem.width?n.paletteItem.width:this.model.paletteItemWidth)/u.width,s=(n.paletteItem.height?n.paletteItem.height:this.model.paletteItemHeight)/u.height;t.datavisualization.Diagram.Util.scale(n,o,s,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else n._type=="node"&&this._checkItemUpdate(n)&&(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2);else n.segments?(u=t.datavisualization.Diagram.Util.bounds(n),t.datavisualization.Diagram.Util._translate(n,i.width/2-u.center.x,i.height/2-u.center.y,this.nameTable)):n._type=="group"?this._checkItemUpdate(n)?(f=i.width/n.width,e=i.height/n.height,this.scale(n,f,e,n.pivot,r,null,null,null,this),t.datavisualization.Diagram.Util._translate(n,i.width/2-n.offsetX,i.height/2-n.offsetY,r,null,this)):t.datavisualization.Diagram.Util._translate(n,n.width/2-n.offsetX,n.height/2-n.offsetY,r,null,this):(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2)},_checkItemUpdate:function(n){return(n.paletteItem&&n.paletteItem.enableScale)?!1:!0},_updatePreviewSize:function(n,i){var u,f,r;if(n.paletteItem&&(n.type!=="group"||n.isLane))if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase){var r=t.datavisualization.Diagram.Util.bounds(n),e=(n.paletteItem.previewWidth?n.paletteItem.previewWidth:this.model.previewWidth)/r.width,o=(n.paletteItem.previewHeight?n.paletteItem.previewHeight:this.model.previewHeight)/r.height;t.datavisualization.Diagram.Util.scale(n,e,o,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else if(n.segments&&n.paletteItem&&n.paletteItem.enableScale&&!n.isPhase||n.isPhase&&n.paletteItem.previewWidth!=n.paletteItem.previewHeight){var r=t.datavisualization.Diagram.Util.bounds(n),e=(n.paletteItem.previewWidth?n.paletteItem.previewWidth:this.model.previewWidth)/r.width,o=(n.paletteItem.previewHeight?n.paletteItem.previewHeight:this.model.previewHeight)/r.height;t.datavisualization.Diagram.Util.scale(n,e,o,{x:.5,y:.5});this._updatePaletteItemWidth(n)}else(n._type=="node"||n._type=="group")&&(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2);else n.segments?(r=t.datavisualization.Diagram.Util.bounds(n),t.datavisualization.Diagram.Util._translate(n,i.width/2-r.center.x,i.height/2-r.center.y,this.nameTable)):n.container&&!n.isLane?(u=i.width/n.width,f=i.height/n.height,this.scale(n,u,f,n.pivot,this.nameTable,null,null,null,this),t.datavisualization.Diagram.Util._translate(n,i.width/2-n.offsetX,i.height/2-n.offsetY,this.nameTable,null,this)):(n.width=i.width,n.height=i.height,n.offsetX=i.width/2,n.offsetY=i.height/2)},_getRenderItemSize:function(n){var i=this.model.paletteItemWidth,r=this.model.paletteItemHeight,o,s,f,e,u;return n.segments?(u=t.datavisualization.Diagram.Util.bounds(n),n.paletteItem?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:n.width,r=r?r:n.height,n.paletteItem.width=i,n.paletteItem.height=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=i?i:u.width,r=r?r:u.height)):n.type==="group"?(u=t.datavisualization.Diagram.Util._getChildrenBounds(n,this),n.paletteItem&&!n.isLane?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.width=i,n.paletteItem.height=r):n.paletteItem&&n.isLane?n.paletteItem.enableScale?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.width=i,n.paletteItem.height=r):(o=(n.paletteItem.width?n.paletteItem.width:this.model.paletteItemWidth)/n.width,s=(n.paletteItem.height?n.paletteItem.height:this.model.paletteItemHeight)/n.height,t.datavisualization.Diagram.Util.scale(n,o,s,{x:.5,y:.5},this.nameTable,!1,!1,!1,this),f=.0001,e=.001,n.isLane&&n.paletteItem&&!n.paletteItem.enableScale&&(n.orientation==="horizontal"?f-=2.2:f+=.8,e-=1),t.datavisualization.Diagram.Util._translate(n,f,e,this.nameTable,!1,this),i=n.width?n.width:i,r=n.height?n.height:r):(i=i?i:u.width,r=r?r:u.height)):n.paletteItem?(i=n.paletteItem.width?n.paletteItem.width:i,r=n.paletteItem.height?n.paletteItem.height:r,i=i?i:n.width,r=r?r:n.height,n.paletteItem.width=i,n.paletteItem.height=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=u.width?u.width:i,r=u.height?u.height:r),{width:i,height:r}},_renderPetternDefinition:function(n,t){if(n&&t){var i=t.document.getElementById(n+"patterndefinition");i||(i=t.defs({id:n+"patterndefinition"}),t.appendChild(i))}},_renderItem:function(t,i){for(var f,r=n.extend(!0,{},t),u=this._getRenderItemSize(r),o=[],e=0;t.children&&e<t.children.length;e++)o[t.children[e]]=n.extend(!0,{},this.nameTable[t.children[e]]);return this._updateRenderSize(r,u,o),f=this._renderItemContainer(r.name,i,null,u,r),r.segments?this._renderConnector(r,f,u):r._type!="node"||r.children&&r.children.length>0?this._renderGroup(r,f,u,o):this._renderNode(r,f,u),r.isLane&&r.paletteItem&&!r.paletteItem.enableScale&&r.orientation==="vertical"&&f.document.setAttribute("height",u.height+2),r},_getPreviewItemSize:function(n){var i=this.model.previewWidth,r=this.model.previewHeight,u;return n.segments?(u=t.datavisualization.Diagram.Util.bounds(n),n.paletteItem?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:n.width,r=r?r:n.height,i=i?i:u.width,r=r?r:u.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=i?i:u.width,r=r?r:u.height)):n.type==="group"?(u=t.datavisualization.Diagram.Util._getChildrenBounds(n,this),n.paletteItem&&!n.isLane?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):n.paletteItem&&n.isLane?n.paletteItem.enableScale?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:u.width,r=r?r:u.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r):(i=i?i:u.width,r=r?r:u.height)):n.paletteItem?(i=n.paletteItem.previewWidth?n.paletteItem.previewWidth:i,r=n.paletteItem.previewHeight?n.paletteItem.previewHeight:r,i=i?i:n.width,r=r?r:n.height,n.paletteItem.previewWidth=i,n.paletteItem.previewHeight=r):(u=t.datavisualization.Diagram.Util.bounds(n),i=u.width?u.width:i,r=u.height?u.height:r),{width:i,height:r}},_renderItemContainer:function(n,i,r,u,f){var e=document.createElement("div"),o=this.model.showPaletteItemText?u.height+18:u.height,s=u.width,h=f&&f.paletteItem?f.paletteItem.margin.left:4,c=f&&f.paletteItem?f.paletteItem.margin.top:4,l=f&&f.paletteItem?f.paletteItem.margin.right:4,a=f&&f.paletteItem?f.paletteItem.margin.bottom:4,v={id:n+"_paletteItem",draggable:"true",height:o+"px",width:s+"px","class":"e-paletteItem",style:"padding-left:"+h+"px;padding-right:"+(l+2)+"px;padding-top:"+(c+1)+"px;padding-bottom:"+(a+1)+"px;height:"+(o+1)+"px;width:"+(s+1)+"px;-ms-touch-action: none;touch-action: none;"};return t.datavisualization.Diagram.Util.attr(e,v),i.appendChild(e),this.model.allowDrag&&this._setItemDraggable(e),this._renderAnchor(e,n,u,f)},_renderAnchor:function(n,i,r,u){var f=document.createElement("div"),o={id:i+"_anchor",height:r.height+"px","class":"e-anchor"},e;return t.datavisualization.Diagram.Util.attr(f,o),n.appendChild(f),e=this._renderSvg(f,i,r),this._renderText(f,i,r,u),e},_renderSvg:function(i,r,u){var s,f=document.createElement("div"),e={id:r+"_svgWrapper",width:this.model.paletteItemWidth+"px;",height:+this.model.paletteItemHeight+"px;","class":"e-svg-container",style:"width:"+u.width+"px;height:"+u.height+"px;"},o;return t.datavisualization.Diagram.Util.attr(f,e),e={id:r+"_svg",width:u.width,height:u.height,version:"1.1",xlink:"http://www.w3.org/1999/xlink"},o=new t.datavisualization.Diagram.Svg(e),f.appendChild(o.document),i.id.split("_clone").length>1&&(s=n(i).parents(".e-paletteItem")[0]),this._renderHtmlLayer(f,s),i.appendChild(f),o},_renderText:function(n,i,r,u){var e=document.createElement("div"),f,o,s;e.setAttribute("class","e-text-container");e.setAttribute("style","width:"+r.width+"px; text-align : center;overflow: hidden;text-overflow: ellipsis;font-size: 12px;");f=document.createElement("span");f.setAttribute("class","e-paletteItemText");u&&u.paletteItem&&(i=u.paletteItem.label?u.paletteItem.label:i);f.innerHTML=i.split("_clone").length>1?i.split("_clone")[0]:i;u&&u.paletteItem.wrapping==t.datavisualization.Diagram.TextWrapping.NoWrap&&(f.style.whiteSpace="nowrap",f.style.wordWrap="normal");u&&u.paletteItem.wrapping==t.datavisualization.Diagram.TextWrapping.Wrap&&(f.style.whiteSpace="pre-wrap",f.style.wordBreak="break-all",f.style.wordWrap="break-word");u&&u.paletteItem.wrapping==t.datavisualization.Diagram.TextWrapping.WrapWithOverflow&&(f.style.whiteSpace="pre-wrap",f.style.wordWrap="break-word");e.appendChild(f);this.model.showPaletteItemText||(e.style.display="none");n.appendChild(e);u&&!u.paletteItem.enableScale&&(o=document.getElementById(u.name+"_paletteItem"),s=document.getElementById(u.name+"_anchor").lastChild.getBoundingClientRect(),o.style.height=r.height+s.height+"px")},_renderNode:function(n,i,r){this._renderPetternDefinition(i.id+"_"+n.name,i);var f=t.datavisualization.Diagram.SvgContext.renderNode(n,i,null,!0,this),u=!1;i.document.getAttribute("drag")!=null&&(u=!0);this._transformItem(f,n.width,n.height,n,u,r)},_updateChildBounds:function(n,i){var u=null,f,r;if(n._type=="group"){for(f=this._getChildren(n.children),r=0;r<f.length;r++)u=i[f[r]],u._type=="group"&&this._updateChildBounds(u,i);t.datavisualization.Diagram.Util._updateChildBounds(n,this)}},_getChildren:function(n){var i,r,t;if(n){for(i=[],r=0;r<n.length;r++)t=n[r],t&&(typeof t=="object"?i.push(t.name):typeof t=="string"&&i.push(t));return i}},_renderGroup:function(n,i,r,u){this._renderPetternDefinition(i.id+"_"+n.name,i);u||(u=this.nameTable);(!n.container||n.isLane)&&this._updateChildBounds(n,u);var e=t.datavisualization.Diagram.SvgContext.renderGroup(n,i,null,u,this,!1,!0),f=!1;i.document.getAttribute("drag")!=null&&(f=!0);this._transformItem(e,n.width,n.height,n,f,r)},_renderConnector:function(n,i,r){var e=t.datavisualization.Diagram.SvgContext.renderConnector(n,i,null,this),u=t.datavisualization.Diagram.Util.bounds(n),f=!1;i.document.getAttribute("drag")!=null&&(f=!0);this._transformItem(e,u.width,u.height,n,f,r)},_wireEvents:function(){this._on(this.element,t.eventType.click,".e-header",this._headerClick);this._on(this.element,t.eventType.mouseDown,".e-header",this._headerMouseDown);this._on(this.element,"mouseover",".e-header",this._headerMouseOver);this._on(this.element,"mouseout",".e-header",this._headerMouseOut);this._on(this.element,t.eventType.mouseDown,".e-paletteItem",this._itemMouseDown);this._on(this.element,"mouseover",".e-paletteItem",this._itemMouseOver);this._on(this.element,"mouseout",".e-paletteItem",this._itemMouseOut);this._on(this.element,t.eventType.click,".e-anchor",this._itemClick)},_headerClick:function(n){this._expandOrCollapsePalette("",n.currentTarget);var t=this._getActivePalette(n.currentTarget.id);t&&t!==this.activePalette&&(this.activePalette=t)},_headerMouseDown:function(n){n.preventDefault();n.stopPropagation()},_headerMouseOver:function(t){var i=this._getActivePalette(t.currentTarget.id);i&&this._canExpand(i)&&(n(t.currentTarget).addClass("hover"),n(t.currentTarget).find(".e-header-arrow").addClass("hover"))},_headerMouseOut:function(t){n(t.currentTarget).removeClass("hover");n(t.currentTarget).find(".e-header-arrow").removeClass("hover")},_itemMouseDown:function(i){var r,u,s,e,f,h,o;if(this.model.diagramId&&(r=n("#"+this.model.diagramId).ejDiagram("instance"),r.activeTool instanceof t.datavisualization.Diagram.LineTool&&(r.activeTool._showAllPorts(!0),r.deactivateTool())),this.model.allowDrag||(i.preventDefault(),i.stopPropagation()),this._selectedElement?this._selectedElement!==i.currentTarget&&(n(this._selectedElement).removeClass("selected"),this._selectedElement=i.currentTarget):this._selectedElement=i.currentTarget,n(i.currentTarget).hasClass("selected")||n(i.currentTarget).addClass("selected"),u=this._getActivePalette(i.currentTarget.parentElement.id),u&&u!==this.activePalette&&(this._clearHeaderSelection(),this._updateHeaderSelection(n(i.currentTarget.parentElement).prev()),this.activePalette=u),this.activePalette&&this._selectedElement)for(s=this._selectedElement.id.slice(0,this._selectedElement.id.lastIndexOf("_")),e=this.activePalette.items,f=0,h=e.length;f<h;f++)o=e[f],o.name===s&&(this.selectedItem=o)},_itemMouseOver:function(t){n(t.currentTarget).addClass("hover")},_itemMouseOut:function(t){n(t.currentTarget).removeClass("hover")},_itemDraStart:function(n){var t=n.originalEvent.dataTransfer;t.setData("Text",this.element[0].id);t.effectAllowed="copy"},_itemClick:function(i){var u,r,l,h,s,f,a,e,o,v,c,y;if((i.type==="click"||i.type==="touchend"&&!n(".dragClone")[0])&&this.model.diagramId){if(u=n("#"+this.model.diagramId).ejDiagram("instance"),r=n.extend(!0,{},this.selectedItem),r.name+=t.datavisualization.Diagram.Util.randomId(),r.type=="bpmn"&&(r.children=[]),l=u.getObjectType(r),l=="group"){for(h=this._getChildren(r.children),s=0;s<h.length;s++)f=n.extend(!0,{},this.nameTable[h[s]]),f.parent=r.name,f.name=r.name+f.name,r.children[s]=f.name,u.nameTable[f.name]=f,u.nodes().push(f),u._nodes=n.extend(!0,[],u.nodes()),u.nameTable[f]&&u._updateQuad(u.nameTable[f]);r.isLane||(r.height=r.width=0,u._updateChildBounds(r,u.nameTable))}r&&r.isLane&&(a=t.datavisualization.Diagram.Util.randomId(),u._cloneGroupNode(r,a),e=t.datavisualization.Diagram.SwimLaneHelper._createDiagramLane(r,u.nameTable),e.isLane=r.isLane,e.orientation=r.orientation,e.height=120,e=t.datavisualization.Diagram.Lane(e),o=t.datavisualization.Diagram.SwimLaneHelper._createSwimlane(e,u,null,!0),o&&(o.offsetX+=10,o.offsetY+=40));v=n.extend(!0,{},this._oldItem);c=o?o:r;this._oldItem=n.extend(!0,{},c);y={oldElement:v,newElement:c};this._trigger("selectionChange",y)}},_updatePaletteVisibility:function(n){this._canHeaderVisible(n)&&(this._canPaletteVisible(n)?(document.getElementById(n.name+"_header").style.display="",document.getElementById(n.name+"_content").style.display=""):(document.getElementById(n.name+"_header").style.display="none",document.getElementById(n.name+"_content").style.display="none"))},_collectionChanged:function(n){var t,i,r;n.changeType=="insert"?this._renderPalette(n.element):n.changeType=="remove"&&(t=n.element,t!=null&&(i=document.getElementById(t.name+"_header"),i&&i.parentNode.removeChild(i),r=document.getElementById(t.name+"_content"),r&&r.parentNode.removeChild(r)))},_extendPaletteItem:function(i){var r=this.model.defaultSettings&&this.model.defaultSettings.node?this.model.defaultSettings.node:null,u=this.model.defaultSettings&&this.model.defaultSettings.connector?this.model.defaultSettings.connector:null;return i.shape&&typeof i.shape=="object"?t.datavisualization.Diagram.Util._updateShapeProperties(i):i=t.datavisualization.Diagram.NodeType(i,this),i.type=="connector"?i=t.datavisualization.Diagram.Connector(n.extend(!0,{},u,i)):i.isLane?i=t.datavisualization.Diagram.SwimLaneHelper._createPaletteLane(i,this.nameTable):i.type=="phase"?i=t.datavisualization.Diagram.Util._mapPalettePhase(i):i.container?i=t.datavisualization.Diagram.ContainerHelper._initContainer(this,i):i._type==="group"||i.children&&i.children.length>0?(i=t.datavisualization.Diagram.Group(n.extend(!0,{},r,i)),i=t.datavisualization.Diagram.Util._updateBpmnChild(i,this),this._initGroupNode(i,this),t.datavisualization.Diagram.Util._updateGroupBounds(i,this)):i=t.datavisualization.Diagram.Node(n.extend(!0,{},r,i)),i},addPaletteItem:function(n,t){for(var i,u,r,o,f,e=0;e<this.model.palettes.length;e++)for(i=[],t.length?i=t:i.push(t),u=0;u<i.length;u++)f=this.model.palettes[e],f.name===n&&(r=this._extendPaletteItem(i[u]),f.items.push(r),o=document.getElementById(n+"_content"),this.nameTable[r.name]=r,this._renderItem(r,o))},removePaletteItem:function(i,r){for(var f,o,u,s,e,a,h,c,l=0;l<this.model.palettes.length;l++)for(f=[],r.length?f=r:f.push(r),o=0;o<f.length;o++)if(c=this.model.palettes[l],c.name===i){if(u=f[o],t.datavisualization.Diagram.Util.removeItem(c.items,u),delete this.nameTable[u.name],u.children&&u.children.length)for(s=0;s<u.children.length;s++)e=u.children[s],e&&(typeof e=="object"?delete this.nameTable[e.name]:delete this.nameTable[e]);h=document.getElementById(i+"_content");a=n(h).find("#"+u.name+"_paletteItem")[0];a&&(h.removeChild(a),this.selectedItem=null)}},expandPalette:function(n){var t=this._findPalette(n);t&&!t.expanded&&this._canExpand(t)&&(t.expanded=!0,this._expandOrCollapsePalette(n))},collapsePalette:function(n){var t=this._findPalette(n);t&&t.expanded&&this._canExpand(t)&&(t.expanded=!1,this._expandOrCollapsePalette(n))},addPalette:function(n){this.model.palettes.push(n);this._renderPalette(n)},removePalette:function(n){for(var r,u,i,f=0;f<this.model.palettes.length;f++)i=this.model.palettes[f],i.name===n&&(t.datavisualization.Diagram.Util.removeItem(this.model.palettes,i),r=document.getElementById(i.name+"_header"),r&&r.parentNode.removeChild(r),u=document.getElementById(i.name+"_content"),u&&u.parentNode.removeChild(u))},setWidth:function(n){this.model.width=n;this._setWidth(n)},setHeight:function(n){this.model.height=n;this._setHeight(n)},setPaletteItemWidth:function(n){this.model.paletteItemWidth=n;this._redrawContent()},setPaletteItemHeight:function(n){this.model.paletteItemHeight=n;this._redrawContent()},setHeaderHeight:function(n){this.model.headerHeight=n;this._setHeaderHeight(n)},setCssClass:function(n){this._setCssClass(n);this.model.cssClass=n},showPaletteItemText:function(n){this._showItemText(n);this.model.showPaletteItemText=n},searchPalette:function(n,i){var r=new t.datavisualization.Diagram.Collection;return i!=""&&(n=this._getSearchPaletteItems(i),r.add(n)),r},updatePalette:function(n,t){var r=this._findPalette(n),u,f;r&&t&&(t.constraints&&r.constraints!=t.constraints&&(r.constraints=t.constraints,u=document.getElementById(r.name+"_header"),this._renderHeaderArrow(u,r.expanded,r.name,this._canExpand(r)),this._disableClickClass(u,this._canExpand(r)),this._updatePaletteVisibility(r),u.style.display=this._canHeaderVisible(r)&&this._canPaletteVisible(r)?"":"none"),t.expanded!=i&&this._canExpand(r)&&(r.expanded=t.expanded,this._expandOrCollapsePalette(n)),t.items&&t.items.length>0&&(f=document.getElementById(r.name+"_content"),f.innerHTML="",r.items=t.items,this._initPaletteitems(r),this._renderContent(r)));this.updateScrollerViewport()},_findPalette:function(n){for(var i,t=0;t<this.model.palettes.length;t++)if(this.model.palettes[t].name==n){i=this.model.palettes[t];break}return i},_canExpand:function(n){return n.constraints&t.datavisualization.Diagram.PaletteConstraints.Expandable},_canHeaderVisible:function(n){return n.constraints&t.datavisualization.Diagram.PaletteConstraints.HeaderVisibility},_canPaletteVisible:function(n){return n.constraints&t.datavisualization.Diagram.PaletteConstraints.Visible},_canClick:function(n){var t,i;if(n&&(t=n.id.split("_header")[0],t&&(i=this._findPalette(t),this._canExpand(i))))return!0},_expandOrCollapsePalette:function(t,i){var i=i||(t?document.getElementById(t+"_header"):null),r;if(i)if(this._canClick(i))r=this,n(i).next(".e-scontent").slideToggle(200,function(){r._refresh()}),this._updateHeaderState(i);else return!1},_getSearchPaletteItems:function(n){for(var f=new t.datavisualization.Diagram.Palette,u=this.model.palettes,r,i=0;i<u.length;i++)if(u[i].name.toLocaleLowerCase().search(n.toLocaleLowerCase())>=0)for(r=0;r<u[i].items.length;r++)this.element.find("#"+u[i].items[r].name+"_paletteItem")[0].style.display="block";else for(r=0;r<u[i].items.length;r++)this.element.find("#"+u[i].items[r].name+"_paletteItem")[0].style.display=u[i].items[r].name.toLocaleLowerCase().search(n.toLocaleLowerCase())>=0?"block":"none";return f},_disableClickClass:function(t,i){i?n(t).removeClass("e-disableclick"):n(t).addClass("e-disableclick")},_addExpandedClass:function(t,i){i?n(t).addClass("expanded"):n(t).addClass("collapsed")},_collapse:function(t){t.expanded||n(document.getElementById(t.name+"_header")).next(".e-scontent").slideToggle(10)},_transformItem:function(n,i,r,u,f,e){var h,v;if(!f)if(e&&!u.segments&&u.paletteItem&&u.paletteItem.width&&u.paletteItem.height&&u.paletteItem.enableScale){var k=30*e.width/100,d=30*e.height/100,o=(e.width-k)/u.width,s=(e.height-d)/u.height;o=s=Math.min(o,s);o=o>1?1:o;s=s>1?1:s;var c=e.width/2-i*o/2,l=e.height/2-r*s/2,a="";a+="translate("+c+","+l+")";a+="scale("+o+","+s+")";n.setAttribute("transform",a);h=n.parentNode.nextSibling;h||(h=document.getElementById(n.id+"_svgWrapper_htmlLayer"));h.style.webkitTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.MozTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.OTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.msTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.transform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";u&&t.browserInfo().name==="msie"&&u._type=="group"&&u.type==="html"&&(v=document.getElementById(u.name+"_html"),v.setAttribute("style","zoom:"+scale+";"))}else if(u.segments){if(e&&u.paletteItem&&u.paletteItem.width&&u.paletteItem.height||u.isPhase&&u.paletteItem&&u.paletteItem.enableScale){var k=e.width/10,d=e.height/10,o=(e.width-k)/i,s=(e.height-d)/r;o=s=Math.min(o,s);o=o>1?1:o;s=s>1?1:s;var c=e.width/2-i*o/2,l=e.height/2-r*s/2,a="";a+="translate("+c+","+l+")";a+="scale("+o+","+s+")";n.setAttribute("transform",a);h=document.getElementById(n.id+"_svgWrapper_htmlLayer");h.style.webkitTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.MozTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.OTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.msTransform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";h.style.transform="translate("+c+"px,"+l+"px) scale("+o+", "+s+")";u&&t.browserInfo().name==="msie"&&u._type=="group"&&u.type==="html"&&(v=document.getElementById(u.name+"_html"),v.setAttribute("style","zoom:"+scale+";"))}}else{var y=i/(i+u.borderWidth*3),p=r/(r+u.borderWidth*3),w=(i-i*y)/2,b=(r-r*p)/2;n.childNodes[0].setAttribute("transform","scale("+y+","+p+") translate("+w+","+b+")");u&&u.type==="image"&&n.childNodes[1]?n.childNodes[1].setAttribute("transform","scale("+y+","+p+") translate("+w+","+b+")"):u&&u._type==="group"&&n.setAttribute("transform","scale("+y+","+p+") translate("+w+","+b+")")}},_getScaleFactor:function(n,t){var u=30*this.model.paletteItemWidth/100,f=30*this.model.paletteItemHeight/100,i=(this.model.paletteItemWidth-u)/n,r=(this.model.paletteItemHeight-f)/t;return i=i>1?1:i,r=r>1?1:r,Math.min(i,r)},_getTranslateFactor:function(){var n=15/100*this.model.paletteItemWidth,t=15/100*this.model.paletteItemHeight;return Math.min(n,t)},_setWidth:function(n){this.element.css("width",n)},_setHeight:function(n){this.element.css("height",n)},_setHeaderHeight:function(n){var t,i;for(this.element.find(".e-header").css("height",n),this.element.find(".e-header-arrow").css("top",(n-16)/2),t=0;t<this.model.palettes.length;t++)i=this.model.palettes[t],i&&this._updateHeaderWrapper(i,n);this.updateScrollerViewport()},_updateHeaderWrapper:function(n,t){var i=document.getElementById(n.name+"_Wrapper"),r;i&&(r=i.getBoundingClientRect(),r.height>0&&(i.style.marginTop=t/2-r.height/2+"px"))},_setCssClass:function(n){this.element.removeClass(this.model.cssClass).addClass(n)},_showItemText:function(n){n!==this.model.showPaletteItemText&&(n?this.element.find(".e-text-container").show():this.element.find(".e-text-container").hide())},_setAllowDrag:function(t){var i,e,r,u,f;if(this.model.allowDrag=t,i=this.model.palettes,i)for(r=0;r<i.length;r++)if(u=i[r].items,u)for(f=0;f<u.length;f++)e=document.getElementById(u[f].name+"_paletteItem"),this.model.allowDrag?this._setItemDraggable(e):n(e).ejDraggable("instance").destroy()},_cloneNode:function(n){var u=t.datavisualization.Diagram.Util.randomId(),r,i;if(n.children&&n.children.length>0)for(i=0;i<n.children.length;i++)r=this._cloneChildren(n.children[i],u),this.nameTable[r.name]=r,n.children[i]=r.name;return n.name+=u,n},_cloneChildren:function(t,i){if(typeof t=="object")return r=n.extend(!0,{},t),r.parent+=i,r.name+=i,r;if(typeof t=="string"){var r=this.nameTable[t];if(r)return this._cloneChildren(r,i)}},_setItemDraggable:function(i){var u=this.element[0].id,r=this;n(i).ejDraggable({clone:!0,cursorAt:{top:r.model.previewOffset.y,left:r.model.previewOffset.x},helper:function(){var f=n("#"+r.model.diagramId).ejDiagram("instance"),h,c,i,u,e,s;if(h=r.model.paletteItemWidth,c=r.model.paletteItemHeight,f._selectedSymbol=r.selectedItem,f._symbolPalette=r.model,i=n.extend(!0,{},r.selectedItem),i=r._cloneNode(i),i.isLane&&(r.model.paletteItemWidth=i.paletteItem&&i.paletteItem.previewWidth?i.paletteItem.previewWidth:r.model.previewWidth,r.model.paletteItemHeight=i.paletteItem&&i.paletteItem.previewHeight?i.paletteItem.previewHeight:r.model.previewHeight),u=r._getPreviewItemSize(r.selectedItem),e=r._renderItemContainer(r.selectedItem.name+"_clone",document.body,!0,u),e.document.setAttribute("drag","true"),f._paletteTable=r.nameTable,f._palNameTable=n.extend(!0,{},r.nameTable),i.segments){var o=t.datavisualization.Diagram.Util.bounds(i),l=(u.width-10)/o.width,a=(u.height-10)/o.height;t.datavisualization.Diagram.Util.scale(i,l,a,o.topLeft,f.nameTable);r._renderConnector(i,e,u)}else{if(i.isLane&&i.paletteItem&&!i.paletteItem.enableScale)i.width=u.width,i.height=u.height,i.offsetX=i.width/2,i.offsetY=i.height/2;else if(i._type=="group"){var v=u.width/i.width,y=u.height/i.height;r.scale(i,v,y,i.pivot,r.nameTable,null,null,null,r);t.datavisualization.Diagram.Util._translate(i,i.width/2-i.offsetX,i.height/2-i.offsetY,r.nameTable,null,r)}else i.width=u.width-10,i.height=u.height-10,u&&(u.width=u.width-10,u.height=u.height-10),i.offsetX=i.width/2+10,i.offsetY=i.height/2+1;r._updatePreviewSize(i,u);i._type=="node"?r._renderNode(i,e,u):r._renderGroup(i,e)}return s=document.getElementById(r.selectedItem.name+"_clone_paletteItem"),n(s).addClass("dragClone"),r.model.paletteItemWidth=h,r.model.paletteItemHeight=c,n(s)},drag:function(){var t=this.helper[0];n("#"+r.selectedItem.name+"_clone_svg").css("padding","2px");n("#"+r.selectedItem.name+"_clone_svg").siblings(".htmlLayer").css("padding","2px");t&&t.setAttribute("paletteId",u)},dragStop:function(t){var u=!1,i;t.event&&t.event.originalEvent&&t.event.originalEvent.changedTouches?u=!0:t.event&&t.event.changedTouches&&(u=!0);i=n("#"+r.model.diagramId).ejDiagram("instance");u&&i._isDropOver&&(i._svgdrop(t.event,this),i._isDropped=!0);i._selectedSymbol=null;n(this.helper).remove()}})},_redrawContent:function(){for(var u,e,t,r,o,f=this.element.find(".e-scontent"),i=0,s=f.length;i<s;++i)if(u=f[i],n(u).empty(),e=this.model.palettes[i],t=e.items,t&&t.length>0)for(r=0,o=t.length;r<o;r++)this._renderItem(t[r],u)},_getPalette:function(n){for(var t,r=this.model.palettes,i=0,u=r.length;i<u;i++)if(t=r[i],t.name===n&&t!==this.activePalette)return t;return null},_getActivePalette:function(n){var t=n.slice(0,n.lastIndexOf("_"));return this._getPalette(t)},_updateHeaderState:function(n){this._clearHeaderSelection();this._updateExpandState(n);this._updateHeaderSelection(n)},_updateExpandState:function(t){n(t).hasClass("expanded")?(n(t).removeClass("expanded").addClass("collapsed"),n(t).find(".e-header-arrow").removeClass("expanded").addClass("collapsed"),n(t).attr("aria-expanded","false"),n(t).attr("aria-selected","false")):(n(t).removeClass("collapsed").addClass("expanded"),n(t).find(".e-header-arrow").removeClass("collapsed").addClass("expanded"),n(t).attr("aria-selected","true"),n(t).attr("aria-expanded","true"))},_updateHeaderSelection:function(t){n(t).hasClass("selected")||(n(t).addClass("selected"),n(t).find(".e-header-arrow").addClass("selected"))},_clearHeaderSelection:function(){this.element.find(".e-header").removeClass("selected");this.element.find(".e-header-arrow").removeClass("selected")},_addItem:function(n,t){var i=document.getElementById(n.name+"_content");this._renderItem(t,i)},_removeItem:function(n,t){var i=document.getElementById(n.name+"_content");i.removeChild(document.getElementById(t.name+"_paletteItem"));t===this._selectedElement&&(this._selectedElement=null)},updateScrollerViewport:function(){var n=this.element.ejScroller("instance");n.model.touchScroll=!1;n.model.width=this._setViewPortWidth();n.model.height=this._setViewPortHeight();this._refresh()},_refresh:function(){this.element.ejScroller("refresh")},_getNodeDimension:function(n){var f=n._width,e=n._height,o=n.width?n.width:n.maxWidth?n.maxWidth:n.minWidth,i=document.createElement("span"),s=0,h=0,r,u;if(n.labels.length){for(t.datavisualization.Diagram.Util.attr(i,{id:n.name+"_label","class":"ej-d-label",style:"display: inline-block; position: absolute; pointer-events: all; line-height: normal;"}),this.element[0].appendChild(i),u=0;u<n.labels.length;u++)r=n.labels[u],r.bold&&(i.style.fontWeight="bold"),r.italic&&(i.style.fontStyle="italic"),i.style.textDecoration=r.textDecoration,i.style.fontFamily=r.fontFamily,i.style.fontSize=r.fontSize+"px",i.style.color=r.fontColor,i.style.backgroundColor=r.fillColor,i.style.borderColor=r.borderColor,i.style.borderWidth=r.borderWidth,i.textContent=r.text,i.style.wordWrap="break-word",i.style.whiteSpace="pre",o&&(i.style.maxWidth=o-(r.margin.left+r.margin.right)-r.fontSize+"px"),s+=i.offsetWidth+r.margin.left+r.margin.right,h+=i.offsetHeight+r.margin.top+r.margin.bottom;n._width=s;n._height=h;n.minWidth&&(n.minWidth>n._width||!n._width)&&(n._width=n.minWidth);n.maxWidth&&(n.maxWidth<n._width||!n._width)&&(n._width=n.maxWidth);n.minHeight&&(n.minHeight>n._height||!n._height)&&(n._height=n.minHeight);n.maxHeight&&(n.maxHeight<n._height||!n._height)&&(n._height=n.maxHeight);n.width||n.labels[0].horizontalAlignment!="left"||(n.offsetX+=(n._width-f)*(1-n.pivot.x));n.width||n.labels[0].horizontalAlignment!="right"||(n.offsetX-=(n._width-f)*n.pivot.x);n.height||n.labels[0].verticalAlignment!="top"||(n.offsetY+=(n._height-e)*(1-n.pivot.y));n.height||n.labels[0].verticalAlignment!="bottom"||(n.offsetY-=(n._height-e)*n.pivot.y);this.element[0].removeChild(i)}},_getNewNode:function(i){return i.shape&&typeof i.shape=="object"&&t.datavisualization.Diagram.Util._updateShapeProperties(i),t.datavisualization.Diagram.Node(n.extend(!0,{},this.model.defaultSettings.node,i))},_getNewGroup:function(i){return i.type=="bpmn"&&(i=t.datavisualization.Diagram.Util._updateBpmnChild(t.datavisualization.Diagram.Node(i),this)),t.datavisualization.Diagram.Group(n.extend(!0,{},this.model.defaultSettings.group,i))},scale:function(n,i,r,u,f,e,o,s,h){var a=t.Matrix.identity(),p,y,l,c,v;if(n.segments)for(t.Matrix.scale(a,i,r,u.x,u.y),l=0;l<n.segments.length;l++){for(c=n.segments[l],v=0;v<c.points.length;v++)c.points[v]=t.Matrix.transform(a,c.points[v]),l!=0||v!=0||n.sourceNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],t.datavisualization.Diagram.Util._setLineEndPoint(n,t.Matrix.transform(a,n.sourcePoint),!1)),l!=n.segments.length-1||v!=c.points.length-1||n.targetNode||(c._startPoint=c.points[0],c._endPoint=c.points[c.points.length-1],n.targetPoint=c._endPoint);c._startPoint=c.points[0];c._endPoint=c.points[c.points.length-1];c.type=="orthogonal"?c.length||c.length===0?c.length=c._length=t.datavisualization.Diagram.Geometry.distance(c._startPoint,c._endPoint):t.datavisualization.Diagram.Util._addOrthogonalPoints(c,n.segments[l-1],n.segments[l+1],n.sourcePoint,n.targetPoint):(c.point&&(c.point=c._endPoint),c._point=c._endPoint)}else{if(n._type==="group"){for(p=n.children,l=0;l<p.length;l++)y=f[typeof p[l]=="string"?p[l]:p[l].name],y&&(this.scale(y,i,r,u,f),y.parent&&y.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(f[y.parent],h));t.datavisualization.Diagram.Util._updateGroupBounds(n,h)}t.Matrix.rotate(a,-n.rotateAngle,u.x,u.y);t.Matrix.scale(a,i,r,u.x,u.y);t.Matrix.rotate(a,n.rotateAngle,u.x,u.y);var w=t.Matrix.transform(a,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),b=n.width*i,k=n.height*r;b>1&&(n.width=b,n.offsetX=w.x);k>1&&(n.height=k,n.offsetY=w.y)}},_translate:function(n,i,r,u,f,e){var h,o,s;if(n.segments)t.datavisualization.Diagram.Util._translateLine(n,i,r,n);else if(n.offsetX+=i,n.offsetY+=r,n._type==="group"&&!f){for(h=e._getChildren(n.children),s=0;s<h.length;s++)o=u[h[s]],this._translate(o,i,r,u,null,e),o.parent&&o.parent!=n.name&&n.type!="pseudoGroup"&&t.datavisualization.Diagram.Util._updateGroupBounds(u[o.parent],e);n._type!="group"&&n.container&&t.datavisualization.Diagram.Util._updateGroupBounds(n,e)}}})}(jQuery,Syncfusion),function(n,t){"use strict";var i,u,f,e,o,s,r,h,c,l,a,v,y,p,w,b;t.datavisualization.Diagram.extend=function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r};i=function(){function i(n,i){this.name=n;this.diagram=i;this.helper=null;this.inAction=!1;this.selectedObject=null;this.startPoint=t.datavisualization.Diagram.Point(0,0);this.currentPoint=t.datavisualization.Diagram.Point(0,0);this.previousPoint=t.datavisualization.Diagram.Point(0,0);this.cursor="default";this._currentPossibleConnection=null;this._previousPossibleConnection=null;this._possibleConnectionPort=null;this.singleAction=!1;this.svgHelper=null;this.single=null;this._centralPoint=t.datavisualization.Diagram.Point(0,0);this._enableAutoNode=null;this._prevTool=null;this.activeLabel=null;this._adjustLines={lines:[]}}return i.prototype.abort=function(){this._endAction();this.diagram.selectionList&&this.diagram.selectionList[0]&&t.datavisualization.Diagram.SvgContext.updateSelector(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom,this.diagram,this.diagram.model.selectedItems.constraints);this.diagram._removeTooltip()},i.prototype._snapTop=function(n,i,r,u,f,e){var o=u,s,c,h;if(i.top=!0,n.left=n.right=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.y-this.initialBounds.height*f.pivot.y+u-(f.offsetY-f.height*f.pivot.y),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,r,h,this.selectedObject,e)),i.snapped)o=u-h+i.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines){var l=this.initialBounds.y-this.initialBounds.height*f.pivot.y,a=l+u,v=t.datavisualization.Diagram.SnapUtil._round(a,s.horizontalGridLines.snapInterval,c);o=v-l}return o},i.prototype._getSwimLaneStackIndex=function(n){var u=null,i,r;return n.container.type=="canvas"&&(n.parent&&(i=this.diagram.nameTable[n.parent]),i&&(r=t.datavisualization.Diagram.Util.bounds(n),u=i.container.orientation==="vertical"?this.currentPoint.y>=r.y&&this.currentPoint.y<r.center.y?this._getIndex(i.children,n):this._getIndex(i.children,n)+1:this.currentPoint.x>=r.x&&this.currentPoint.x<r.center.x?this._getIndex(i.children,n):this._getIndex(i.children,n)+1)),u},i.prototype._getIndex=function(n,t){var r,i;if(n&&t){for(r=null,i=0;i<n.length;i++)if(r=this.diagram.nameTable[this.diagram._getChild(n[i])],r&&r.name==t.name)return i}else return-1},i.prototype._snapLeft=function(n,i,r,u,f,e){var o=r,s,c,h,a;if(n.left=!0,i.top=i.bottom=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.x-this.initialBounds.width*f.pivot.x+r-(f.offsetX-f.width*f.pivot.x),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,h,u,this.selectedObject,e)),a=t.datavisualization.Diagram.Util.bounds(f),n.snapped)o=r-h+n.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines){var l=this.initialBounds.x-this.initialBounds.width*f.pivot.x,v=l+r,y=t.datavisualization.Diagram.SnapUtil._round(v,s.horizontalGridLines.snapInterval,c);o=y-l}return o},i.prototype._snapBottom=function(n,i,r,u,f,e){var o=u,s,c,h,a;if(!this.diagram._disableSnap)if(i.bottom=!0,n.left=n.right=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.y+this.initialBounds.height*(1-f.pivot.y)+u-(f.offsetY+f.height*(1-f.pivot.y)),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,r,h,this.selectedObject,e)),a=t.datavisualization.Diagram.Util.bounds(f),i.snapped)o=u-h+i.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines){var l=this.initialBounds.y+this.initialBounds.height*(1-f.pivot.y),v=l+u,y=t.datavisualization.Diagram.SnapUtil._round(v,s.horizontalGridLines.snapInterval,c);o=y-l}return o},i.prototype._snapRight=function(n,i,r,u,f,e){var o=r,s,c,h;if(!this.diagram._disableSnap)if(n.right=!0,i.top=i.bottom=!1,s=this.diagram.model.snapSettings,c=this.diagram._currZoom,!this.diagram._enableSnapToObject()||f.rotateAngle||this.selectedObject.isLane||this.selectedObject.isSwimlane||(h=this.initialBounds.x+this.initialBounds.width*(1-f.pivot.x)+r-(f.offsetX+f.width*(1-f.pivot.x)),t.datavisualization.Diagram.SnapUtil._snapSize(this.diagram,n,i,h,u,this.selectedObject,e)),n.snapped)o=r-h+n.offset;else if(s.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines){var l=this.initialBounds.x+this.initialBounds.width*(1-f.pivot.x),a=l+r,v=t.datavisualization.Diagram.SnapUtil._round(a,s.verticalGridLines.snapInterval,c);o=v-l}return o},i.prototype.keydown=function(n){var i=n.keyCode?n.keyCode:n.which;i===27&&this.inAction?(this.diagram._selectedSymbol?(this.diagram._documentmouseup(n),this._removeHighLighter(),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.diagram._selectedSymbol=null):(this.seletedObject||this.selectedObject)&&(this.selectedObject&&(t.datavisualization.Diagram.SvgContext._enableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram),t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer)),this.seletedObject&&(t.datavisualization.Diagram.SvgContext._enableSelectedNode(this.seletedObject,this.diagram._svg,this.diagram),t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.seletedObject,this.diagram._adornerSvg,this.diagram._adornerLayer)),this._removeHighLighter(),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram)),this.abort()):i===46&&this.inAction?(this.diagram._selectedSymbol&&(this.diagram._documentmouseup(n),this.diagram._selectedSymbol=null),this.abort()):this.inAction||i!=27||this.diagram._clearSelection()},i.prototype._getSwimlaneHeader=function(n){var t;return n&&n.isSwimlane&&n.children&&n.children.length>0&&(t=this.diagram.nameTable[n.children[0]]),t},i.prototype._removeHelpers=function(){t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer);t.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this.diagram._adornerLayer,this.diagram._adornerSvg);this._removeHighLighter()},i.prototype._cloneGroupNode=function(t,i){var o=null,r,u,e,f;if(u=n.extend(!0,{},t),u.name+=i,t&&t._type==="group")for(u.children=[],e=this.diagram._getChildren(t.children),f=0;f<e.length;f++)o=this.diagram.nameTable[e[f]],r=n.extend(!0,{},o),r.name+=i,r.parent&&(r.parent+=i),r._type==="group"&&this._cloneGroupNode(r,i),this.diagram.nameTable[r.name]=r,this.diagram.nodes().push(r),this.diagram._nodes=n.extend(!0,[],this.diagram.nodes()),u.children.push(r.name);return u},i.prototype._updateNextPhases=function(n,i,r){var o=0,s,u,e,f;for(o=n.orientation=="horizontal"?i:r,s=this.diagram._getPhaseIndex(n.name),e=this.diagram.nameTable[n.parent],f=s+1;f<e.phases.length;f++)u=this.diagram.nameTable[e.phases[f]],u&&(u.offset+=o),t.datavisualization.Diagram.SvgContext._updatephase(u,this.diagram)},i.prototype._getphase=function(n){return this.diagram.nameTable[n]},i.prototype._containsSwimlane=function(n){var i,t;for(i in n)if(t=this.diagram.nameTable[n[i]],t.isSwimlane||t.isLane)return!0;return!1},i.prototype._raiseEndPointDrag=function(n,t,i,r){if(t||i){var u,f,e,o;return f=this._currentPossibleConnection?this._currentPossibleConnection:null,e=this._possibleConnectionPort?this._possibleConnectionPort:null,o=this.currentPoint,u=t?"Target":"Source",this._raiseEvent("connector"+u+"Change",{element:n,node:f,port:e,point:o,dragState:r,cancel:!1})}},i.prototype._decideSelectedItem=function(n,t,i){var r=null,f,u;if(t)t.parent?this.diagram.selectionList&&this.diagram.selectionList[0]&&t.parent==this.diagram.selectionList[0].name&&!i?(r=t,this.diagram.selectionList[0].type=="bpmn"&&(r=this.diagram.selectionList[0])):i&&this.diagram.selectionList[0]&&this.diagram.selectionList[0].name==t.name?r=t:(f=this.diagram.nameTable[t.parent],t.isPhase?(u=t.name.split("phaseStack")[1],u&&(t=this.diagram.nameTable[u]),r=t):(r=this._decideSelectedItem(n,f,i),this.diagram.selectionList&&this.diagram.selectionList[0]&&r&&this.diagram.selectionList[0].name==r.name&&!i&&(r=t))):r=t;else return null;return r},i.prototype._isParentAsLane=function(n){for(var i,t,u,r=0;n.children&&r<n.children.length>0;r++)if(i=this.diagram.nameTable[this.diagram._getChild(n.children[r])],i&&(t=this.diagram.nameTable[i.parent],t&&t.isLane))return u=this.diagram.nameTable[t.parent],this.diagram._activeSwimLane=this.diagram.nameTable[u.parent],!0;return null},i.prototype._getAdjustjecentLines=function(n){if(!n.segments){for(var t=0;n.inEdges&&n.inEdges.length>0&&t<n.inEdges.length;t++)this._containsCollection(this._adjustLines.lines,this.diagram.nameTable[n.inEdges[t]])||this._adjustLines.lines.push(jQuery.extend(!0,{},this.diagram.nameTable[n.inEdges[t]]));for(t=0;n.outEdges&&n.outEdges.length>0&&t<n.outEdges.length;t++)this._containsCollection(this._adjustLines.lines,this.diagram.nameTable[n.outEdges[t]])||this._adjustLines.lines.push(jQuery.extend(!0,{},this.diagram.nameTable[n.outEdges[t]]))}},i.prototype._containsCollection=function(n,t){for(var i=0;n&&n.length>0&&i<n.length;i++)if(t&&n[i].name===t.name)return!0},i.prototype._updateMultipleUndoObject=function(n){for(var t,r=[],i=0;n.children&&n.children.length>0&&i<n.children.length;i++)t=this.diagram.nameTable[n.children[i]],t&&(r.push(jQuery.extend(!0,{},t)),this._getAdjustjecentLines(t));this._undoObject||(this._undoObject={collection:r,adjustLines:jQuery.extend(!0,{},this._adjustLines)})},i.prototype._updateNameTable=function(n){this.diagram._updateNameTable(n)},i.prototype._getParentSwimlane=function(n){var t;return n&&n.isLane?(t=this.diagram.nameTable[n.parent],this.diagram.nameTable[t.parent]):null},i.prototype._removeHighLighter=function(){t.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer)},i.prototype._getPadding=function(n){var i=0,r=0,t;return n&&n.parent&&(t=this.diagram.nameTable[n.parent],t&&(i=t.paddingRight,r=t.paddingBottom)),{x:i,y:r}},i.prototype._findStackOverNode=function(n,i){var u,o,r,s,c,h,f,e;if(n&&(u=this.diagram.nameTable[n.parent],o=null,u))for(c=u.children.length,h=0;h<c;h++)if(o=this.diagram.nameTable[this.diagram._getChild(u.children[h])],r=this.mousePosition(i),s=t.datavisualization.Diagram.Util.bounds(o),f=this.diagram.nameTable[this.diagram._getChild(u.children[c-1])],e=this.diagram.nameTable[this.diagram._getChild(u.children[0])],u.container.orientation=="vertical"){if(r.y>=s.y&&r.y<=s.bottom)return o;if(r.y<=e.offsetY-e.height/2)return e;if(r.y>=f.offsetY+f.height/2)return f}else{if(r.x>=s.x&&r.x<=s.right)return o;if(r.x<=e.offsetX-e.width/2)return e;if(r.x>=f.offsetX+f.width/2)return f}},i.prototype._getPageBounds=function(){var i=t.datavisualization.Diagram.Rectangle(0,0,0,0),n=this.diagram.model.pageSettings;return i.x=n.boundaryConstraints==="diagram"?Math.min(this.diagram._getDigramBounds().x,0):0,i.y=n.boundaryConstraints==="diagram"?Math.min(this.diagram._getDigramBounds().y,0):0,i.width=n.boundaryConstraints==="page"?n.pageWidth?n.pageWidth:this.diagram.element.width():this.diagram.element.width(),i.height=n.boundaryConstraints==="page"?n.pageHeight?n.pageHeight:this.diagram.element.height():this.diagram.element.height(),i},i.prototype._nodeHighLighter=function(n){var f=null,r=null,u=null,i,o,e;n&&this.selectedObject.parent?(i=this.diagram.nameTable[this.selectedObject.parent],i&&(i.container&&i.container.type=="stack"&&this.selectedObject.name!=n.name?(o=this._stackOverNode,t.datavisualization.Diagram.SvgContext._drawStackHighlighter(o,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom,this.currentPoint,i.container.orientation==="vertical"?!0:!1)):i.container&&i.container.type=="canvas"&&this.selectedObject.parent!=n.name&&!n.isPhase&&t.datavisualization.Diagram.Util.canAllowDrop(n)?t.datavisualization.Diagram.Util._canBeTarget(this.diagram,n)&&t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom):this._removeHighLighter())):n&&n.container&&!n.isSwimlane?this.selectedObject.isLane?(i=this.diagram.nameTable[n.parent],i&&n.name.indexOf("phaseStack")===-1&&t.datavisualization.Diagram.Util.canDrawStackHighlighter(this.diagram,this.selectedObject,n)&&t.datavisualization.Diagram.SvgContext._drawStackHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom,this.currentPoint,i.container.orientation==="vertical"?!0:!1)):t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom):n.segments?this._removeHighLighter():t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom);this._nodeToHit&&n&&n.name!=this._nodeToHit.name&&(r=t.datavisualization.Diagram.Util.bounds(this._nodeToHit),u=this._getTargetNode(this._nodeToHit,r),this._raiseEvent("mouseLeave",{element:this.diagram.getNode(this.selectedObject),source:this.diagram.getNode(this._nodeToHit),target:this.diagram.getNode(u)}));n?(this._nodeToHit&&this._nodeToHit.name!==n.name||!this._nodeToHit)&&(this._nodeToHit=n,this.selectedObject.parent&&(f=this.diagram.nameTable[this.selectedObject.parent]),this.selectedObject.type=="pseudoGroup"&&(e=this.diagram.nameTable[this.diagram._getChild(this.selectedObject.children[0])],e&&e.parent&&(f=this.diagram.nameTable[e.parent])),r=t.datavisualization.Diagram.Util.bounds(n),u=this._getTargetNode(n,r),this._raiseEvent("mouseEnter",{element:this.diagram.getNode(this.selectedObject),source:this.diagram.getNode(f),target:this.diagram.getNode(u)})):this._nodeToHit=null;n&&(this.selectedObject.parent&&(f=this.diagram.nameTable[this.selectedObject.parent]),r=t.datavisualization.Diagram.Util.bounds(n),u=this._getTargetNode(n,r),this._raiseEvent("mouseOver",{element:this.diagram.getNode(this.selectedObject),source:this.diagram.getNode(f),target:this.diagram.getNode(u)}))},i.prototype._doubleClick=function(n){var t,i;n&&n.parent&&(t=this.diagram.nameTable[n.parent],t&&(i=n.name,this.diagram.updateSelectedObject(i),t.isLane||t.isSwimlane||t.isPhaseStack||(this.diagram._clearSelection(!0),this.diagram.addSelection(n,!0))))},i.prototype._itemClick=function(n,t,i,r){var u,s,e,o,f;if(t&&t.parent){if(u=this.diagram.nameTable[t.parent],u)if(u.container)t&&!this.diagram._selectedSymbol&&(s=t.name,s.indexOf("_header_swimlane")!=-1?n&&this.diagram.updateSelectedObject(n.parent,u):s.indexOf("_Headerr_")!=-1?this.diagram.updateSelectedObject(t.parent):t&&t.isPhase?n.isPhase&&(f=this.diagram.nameTable[n.parent],f&&(this.diagram.selectionList.length===0||this.diagram.selectionList[0].name!=f.name)&&(this.diagram._clearSelection(!0),this.diagram.addSelection(n,!0),this.selectedObject=null)):this.diagram.updateSelectedObject(s)),this.diagram._selectedGNode=null;else if(u.type==="group"){if(u.parent){if(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y)e=this.diagram.nameTable[u.parent];else while(u.parent)if(e=this.diagram.nameTable[u.parent],e&&e.isLane)break;else if(o=this.diagram.nameTable[u.parent],this.diagram._selectedGNode&&o)if(o.name===this.diagram._selectedGNode.name){this.diagram.updateSelectedObject(u.name);break}else u=o;else u=o;e&&e.isLane&&(f=this._getSelectedItem(t,r),f&&this.diagram.updateSelectedObject(f.name))}this.selectedObject&&this.selectedObject.parent&&(this.diagram._selectedGNode=this.selectedObject)}}else t?this.diagram._selectedSymbol||this.diagram.updateSelectedObject(t.name):this.diagram._selectedGNode=null;n&&(n.type=="pseudoGroup"||n.name=="multipleSelection")&&t&&!this._containsChild(n,t.name)&&this.diagram.updateSelectedObject(n.name)},i.prototype._getSelectedItem=function(n,t){var i;if(n&&n.parent)return i=this.diagram.nameTable[n.parent],t&&t.name==i.name?n:i.isLane?n:this._getSelectedItem(i)},i.prototype._getTargetNode=function(n,i){for(var e,o,u,s,h=null,f=[],c=t.datavisualization.Diagram.SpatialUtil.findQuads(this.diagram._spatialSearch,i),r=0;r<c.length;r++)if(e=c[r],e.objects.length>0)for(o=0;o<e.objects.length;o++)u=e.objects[o],!u.segments&&u.visible&&(h=t.datavisualization.Diagram.Util.bounds(u),f.indexOf(u)==-1&&t.datavisualization.Diagram.Geometry.intersectsRect(i,h)&&f.push(u));for(s=[],s.push(n),r=0;r<f.length;r++)f[r].name!=n.name&&s.push(f[r]);return s},i.prototype._updateMargin=function(n,i){var o,s,f,r,u;if(n.type=="pseudoGroup")for(o=null,s=this.diagram._getChildren(n.children),f=0;f<s.length;f++)o=this.diagram.nameTable[s[f]],this._updateMargin(o,i);else if(i&&i.container&&i.container.type=="canvas"){var h=t.datavisualization.Diagram.Util.bounds(i),e=t.datavisualization.Diagram.Util.bounds(n),c=t.datavisualization.Diagram.Geometry.rect([e.topLeft,e.topRight,e.bottomRight,e.bottomLeft]);n.marginLeft=c.x-(h.x+i.paddingLeft);n.marginTop=c.y-(h.y+i.paddingTop);i.isLane&&(r=0,u=0,i.orientation==="horizontal"?(r=50,u=0):(r=0,u=50),n.marginLeft=n.marginLeft>=r?n.marginLeft:r,n.marginTop=n.marginTop>=u?n.marginTop:u)}},i.prototype._getNodeUnderMouse=function(){var n=this.diagram._nodeUnderMouse,i,f,u,r;if(this.diagram._focusedElement&&(this.diagram._focusedElement.isPhase||this.diagram._focusedElement.isLane||this.diagram._focusedElement.isSwimlane)&&(f=!0),this.diagram._focusedElement&&n&&this._containsChild(this.diagram._focusedElement,n.name)&&n&&(f||!t.datavisualization.Diagram.Util.canAllowDrop(n)))if(u=this.diagram.getObjectType(n),u=="connector"||u==="group")i=n;else if(n.parent){if(r=this.diagram.nameTable[n.parent],r&&r.container&&r.container.type=="stack"&&t.datavisualization.Diagram.Util.canAllowDrop(n))return n;u=this.diagram.getObjectType(r);r&&u!="node"&&(i=r)}if(i){if(this.selectedObject!=i&&t.datavisualization.Diagram.Util.canAllowDrop(i)&&(i.type!="bpmn"||this.selectedObject.type=="bpmn"))return i}else if(n&&this.selectedObject!=n&&t.datavisualization.Diagram.Util.canAllowDrop(n))return n},i.prototype._isChange=function(n,t){var i=null;return n._type==="group"||n.type==="pseudoGroup"||t._type==="group"||t.type==="pseudoGroup"?(n._type!=="group"&&n.type!=="pseudoGroup"||t._type==="group"||t.type==="pseudoGroup"||(i=!this._containsChild(n,t.name)),n._type==="group"||n.type==="pseudoGroup"||t._type!=="group"&&t.type!=="pseudoGroup"?(n._type==="group"||n.type==="pseudoGroup")&&(t._type==="group"||t.type==="pseudoGroup")&&n.name==t.name&&(i=!0):i=!this._containsChild(t,n.name)):n.name==t.name&&(i=!0),i},i.prototype._containsChild=function(n,t){var u=!0,i=null,e,f,r;if(n.children)for(f=this.diagram._getChildren(n.children),r=0;r<f.length;r++)i=this.diagram.nameTable[f[r]],e=this.diagram.getObjectType(i),e==="group"?u=this._containsChild(i,t):i&&i.name==t&&(u=!1);return u},i.prototype._findNodeUnderMouse=function(i,r){var f=null,u=null,o,s=this.diagram._isForeignObject(i.target),e,h;return s&&(i.target=s),e=n(i.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group"),h=i.target.className,e&&(s||i.target.localName!="div")?(o=e.attr("class"),o&&(o==="ej-d-node"||o==="ej-d-group"||t.datavisualization.Diagram.Util.isClassifier(i))?(u=this.diagram._findNode(e.attr("id")),u||(u=this.diagram._findNode(e.attr("id").split("_parentdiv")[0]))):o==="ej-d-connector"&&(u=this.diagram._findConnector(e.attr("id")))):this.diagram._isLabelTemplate(i)&&(u=this.diagram._findNode(e.attr("id")),u||(u=this.diagram._findConnector(e.attr("id")))),f=u&&!u.parent?u:this._decideSelectedItem(i,u,r),this.prevSelectObject=f,r&&this.diagram.selectionList[0]&&(f&&f._type==="group"&&!this._containsChild(f,this.diagram.selectionList[0].name)?f=f:f&&this.diagram.selectionList[0].name!=f.name&&this._isChange(this.diagram.selectionList[0],f)?f=this.diagram.selectionList[0]:u&&u.name==this.diagram.selectionList[0].name&&!this._isChange(this.diagram.selectionList[0],f)&&(f=this.diagram.selectionList[0])),this.actualObject=u&&this.diagram._selectedSymbol&&u.name!=this.diagram._selectedSymbol.name&&this.diagram._symbolDrop?this.diagram._selectedSymbol:u,f},i.prototype._findLabelUnderMouse=function(i,r,u,f){var o,p=n(i.target),l=p[0].getAttribute("class"),d,w,k,a,v,b,h,c,g,y,s,e;if(this.diagram.model.labelRenderingMode==t.datavisualization.Diagram.LabelRenderingMode.Svg){if(!l||!l=="ej-d-label")if(p[0].parentNode&&(d=p[0].parentNode.getAttribute("class")),d==="ej-d-label"){for(w=p[0].parentNode.id.split("_"),k="",e=1;e<w.length;e++)k+=w[e],e!=w.length-1&&(k+="_");if(a=this.diagram.nameTable[w[0]],a&&a.labels.length>0)for(e=0;e<a.labels.length;e++)if(a.labels[e].name===k)return this.activeLabel=a.labels[e],a.labels[e]}else for(v=i.target.parentNode,l=v.getAttribute("class");v;){if(l==="ej-label-template")for(s=v.id.split("_"),o=this.diagram._findNode(s[0]),o||(o=this.diagram._findConnector(s[0])),e=0;o&&e<o.labels.length;e++)if(c=o.labels[e].name.split("_"),s[s.length-1]==c[c.length-1])return h=o.labels[e],this.diagram._selectedSymbol||(this.activeLabel=h),h;v=v.parentNode;l=v.getAttribute("class")}}else if(l=="ej-d-label"){if(y=n(i.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group"),y&&(s=y[0].getAttribute("id"),b=y[0].getAttribute("class"),b))if(b==="ej-d-node"||b==="ej-d-group")o=this.diagram._findNode(s),h=this.diagram._findLabelAtPoint(u?u:this.currentPoint,o),this.diagram._selectedSymbol||(this.activeLabel=h);else if(b==="ej-d-connector"){if(o=this.diagram._findConnector(s),h=this.diagram._findLabelAtPoint(u?u:this.currentPoint,o),t.datavisualization.Diagram.Util.canMoveLabel(o)||f){if(h==null&&(p=n(i.target),l=p[0].getAttribute("class"),l=="ej-d-label"))for(s=i.target.id.split("_"),e=0;e<o.labels.length;e++)c=o.labels[e].name.split("_"),s[s.length-1]==c[c.length-1]&&(h=o.labels[e])}else h=null;this.diagram._selectedSymbol||(this.activeLabel=h)}}else if(this.diagram._isLabelTemplate(i)){if(g=n(i.target).parents(".ej-label-template"),y=g[0],y){if(s=y.parentNode.id.split("_"),o=this.diagram._findNode(s[0]),o||(o=this.diagram._findConnector(s[0])),o)for(e=0;e<o.labels.length;e++)c=o.labels[e].name.split("_"),s[2]==c[c.length-1]&&(h=o.labels[e]);this.diagram._selectedSymbol||(this.activeLabel=h)}}else this.activeLabel=null;return o},i.prototype._selectionContainsChild=function(n){var i,t,r,u,f;if(this.diagram.selectionList[0].children){for(i=this.diagram._getChildren(this.diagram.selectionList[0].children),t=null,r=0;r<i.length;r++)if(t=this.diagram.nameTable[i[r]],t&&t.name==n)return!0}else if(this.diagram.selectionList[0]._type==="group"&&this.diagram.selectionList[0].type!="pseudoGroup"){if(this.diagram.selectionList[0].name==n)return!0}else if(this.diagram.nameTable[n]&&this.diagram.nameTable[n]._type==="group"){for(i=this.diagram._getChildren(this.diagram.nameTable[n].children),u=0;u<i.length;u++)if(t=this.diagram.nameTable[i[u]],t&&(f=this._selectionContainsChild(t.name)),f)return f}else if(this.diagram.selectionList[0].name==n)return!0;return!1},i.prototype._isSelected=function(n){var u=null,i=this.diagram.nameTable[n],r,t;if(this._selectionContainsChild(i.name))return!0;if(i._type==="group")for(r=this.diagram._getChildren(i.children),t=0;t<r.length;t++)if(u=r[t],this._selectionContainsChild(u))return!0;return!1},i.prototype._isColleagueSelected=function(n){var u=this.diagram.nameTable[n],f=null,i,r,t;if(u.parent&&(i=this.diagram.nameTable[u.parent],i))for(r=this.diagram._getChildren(i.children),t=0;t<r.length;t++)if(f=r[t],this._isSelected(f))return!0;return!1},i.prototype._isInSelection=function(n){var i,r,t;if(this.diagram.selectionList[0].type=="pseudoGroup"&&this.diagram.selectionList[0].children)for(i=this.diagram._getChildren(this.diagram.selectionList[0].children),r=null,t=0;t<i.length;t++)if(r=this.diagram.nameTable[i[t]],r.name==n)return!0},i.prototype._getCloneNode=function(n){var t=null;return t=jQuery.extend(!0,{},n),t.children=[],t.minHeight=0,t.minWidth=0,t.maxHeight=0,t.maxWidth=0,t},i.prototype._getProcessedObject=function(n){var t=this.diagram.nameTable[n],i;if(t){if(this._isInSelection(n))return null;if(this._selectionContainsChild(t.name))return{add:t,remove:null};if(t.parent)if(this._selectionContainsChild(t.parent)){if(this._isInSelection(t.parent))return{add:t,remove:this.diagram.nameTable[t.parent]};if(i=this.diagram.nameTable[t.parent],i)return{add:i,remove:this.diagram.nameTable[i.parent]}}else return this._isColleagueSelected(t.parent)&&!this._selectionContainsChild(t.parent)?this._isSelected(t.parent)?{add:t,remove:null}:{add:this.diagram.nameTable[t.parent],remove:null}:this.diagram.selectionList[0]&&this._isInSelection(t.parent)?{add:this.diagram.nameTable[t.name],remove:this.diagram.nameTable[t.parent]}:this._getProcessedObject(t.parent);else return{add:t,remove:null}}},i.prototype.hasSameParent=function(){var n,t,u,r,i;if(this.selectedObject.type=="pseudoGroup"){if(n=this.selectedObject,t=null,this.diagram.nameTable[this.diagram._getChild(n.children[0])])for(u=this.diagram.nameTable[this.diagram._getChild(n.children[0])].parent,r=this.diagram._getChildren(n.children),i=0;i<r.length;i++)if(t=this.diagram.nameTable[r[i]],t.parent!=u||t.parent=="")return!1;return!0}return!1},i.prototype._fromDiagram=function(n){for(var r=!0,t=null,i=0;i<n.length;i++)if(t=this.diagram.nameTable[this.diagram._getChild(n[i])],t&&t.parent){r=!1;break}return r},i.prototype._fromContainer=function(n){for(var t=null,i=null,r=0;r<n.length;r++)if(t=this.diagram.nameTable[this.diagram._getChild(n[r])],t.parent&&(i=this.diagram.nameTable[t.parent],i&&i.container))return!0},i.prototype._fromSameContainer=function(n){for(var t=null,i=null,r=0;r<n.length;r++)if(t=this.diagram.nameTable[this.diagram._getChild(n[r])],!i&&t.parent&&(i=t.parent),t.parent&&t.parent!=i)return!1;return!0},i.prototype._anyFromContainer=function(n){for(var i=null,t=null,r=0;r<n.length;r++)if(i=this.diagram.nameTable[this.diagram._getChild(n[r])],i.parent&&(t=this.diagram.nameTable[i.parent]),t&&t.container&&t.container.type==="canvas")return!0;return!1},i.prototype._processCtrlKey=function(i){var s,r,e,b,l,f,u;if(this.diagram.selectionList.length>0&&t.datavisualization.Diagram.Util.canDoMultipleSelection(this.diagram)){var o=this.diagram.selectionList,a,f,c,v=[],y=[],p=[];o[0].type=="pseudoGroup"?(a=!0,s=this._findNodeUnderMouse(i)):s=this._findNodeUnderMouse(i);var w=this._findNodeUnderMouse(i,!0),k=this.selectedObject,h=this._raiseEvent("itemClick",{element:this.selectedObject,actualObject:this.actualObject,selectedObject:w,cancel:!1,event:i});if(this._itemClick(this.selectedObject,this.actualObject,w),h.cancel&&(this.selectedObject=k),this.actualObject)if(this.actualObject.parent)a?(r=o[0],e=this._getProcessedObject(this.actualObject.name),e?(this.selectedObject?(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,this.selectedObject.name)):e.remove&&(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,e.remove.name)),this.selectedObject?this._hasMultipleSelection(this.selectedObject)||r.children.push(this.selectedObject.name):e.add&&(this._hasMultipleSelection(e.add)||r.children.push(e.add.name))):(f=this.actualObject,this.selectedObject?this._hasMultipleSelection(this.selectedObject)?(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,this.selectedObject.name)):r.children.push(this.selectedObject.name):this._hasMultipleSelection(f)?(r.children=this.diagram._getChildren(r.children),t.datavisualization.Diagram.Util.removeItem(r.children,f.name)):r.children.push(f.name)),t.datavisualization.Diagram.Util._updateGroupBounds(r,this.diagram),r.children.length<=1?(b=this.diagram.nameTable[this.diagram._getChild(r.children[0])],this.diagram._hasSelection()&&this.diagram._clearSelection(!0),this.selectedObject=b,this.diagram._addSelection(this.selectedObject)):(this.selectedObject=o[0],this.diagram.updateSelection())):(this.diagram.selectionList[0]._type==="group"&&this.diagram.selectionList[0].type!=="bpmn"?(o=this.diagram.selectionList[0],e=this._getProcessedObject(this.actualObject.name),f=e.add,e&&this.diagram._hasSelection()&&this.diagram._clearSelection()):(e=null,s._type==="group"&&(e=this._getProcessedObject(this.actualObject.name)),f=e?e.add:s,o=this.diagram.selectionList[0],this.diagram._hasSelection()&&this.diagram._clearSelection()),this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Keydown,u=t.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),o.name!=f.name&&u.children.push(o.name),this.selectedObject?u.children.push(this.selectedObject.name):this._containsChild(u,f.name)&&u.children.push(f.name),this._checkRepeatedChild(u.children),this.diagram.nodes().push(u),this.diagram._nodes=n.extend(!0,[],this.diagram.nodes()),this.diagram.nameTable[u.name]=u,t.datavisualization.Diagram.Util._updateGroupBounds(u,this.diagram),this.selectedObject=u,this.diagram._addSelection(this.selectedObject));else if(a){for(r=o[0],f=this.selectedObject?this.selectedObject:this.actualObject,c=this._hasMultipleSelection(f)?"remove":"insert",c=="insert"?(r.children.push(f.name),v.push(f)):(t.datavisualization.Diagram.Util.removeItem(r.children,f.name),y.push(f)),l=0;l<r.children.length;l++)p.push(this.diagram.nameTable[r.children[l]]);h={changeType:c,state:"changing",element:this.diagram.nameTable.multipleSelection,selectedItems:p,oldItems:y,newItems:v,cancel:!1};this._raiseEvent("selectionChange",h);h.cancel||(c=="remove"&&t.datavisualization.Diagram.Util.removeItem(this.diagram.model.selectedItems.children,f),this.diagram.updateSelection(this.selectedObject),t.datavisualization.Diagram.Util._updateGroupBounds(r,this.diagram),this.selectedObject=o[0],this.diagram.model.selectedItems.children.length?t.datavisualization.Diagram.SvgContext.updateSelector(this.selectedObject,this.diagram._adornerSvg,this.diagram._currZoom,this.diagram,this.diagram.model.selectedItems.constraints):(t.datavisualization.Diagram.Util.clear(this.diagram.selectionList),t.datavisualization.Diagram.SvgContext.clearSelector(this.diagram._adornerSvg,this.diagram._adornerLayer)),h={changeType:c,state:"changed",element:this.diagram.nameTable.multipleSelection,selectedItems:p,oldItems:y,newItems:v,cancel:!1},this._raiseEvent("selectionChange",h))}else f=this.actualObject,this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Keydown,o=this.diagram.selectionList[0],f!=o&&(this.diagram._hasSelection()&&this.diagram._clearSelection(!0),u=t.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),u.children.push(o.name),this.selectedObject?u.children.push(this.selectedObject.name):u.children.push(f.name),this.diagram.nodes().push(u),this.diagram._nodes=n.extend(!0,[],this.diagram.nodes()),this.diagram.nameTable[u.name]=u,t.datavisualization.Diagram.Util._updateGroupBounds(u,this.diagram,null,!0),this.selectedObject=u,this.diagram._addSelection(this.selectedObject));this.selectedObject=this.diagram.selectionList[0]}else s=this._findNodeUnderMouse(i),this.selectedObject=s;return s},i.prototype._checkRepeatedChild=function(i){for(var e=null,r=n.extend(!0,{},i),u,r=this.diagram._getChildren(r),f=0;f<r.length;f++)if(e=this.diagram.nameTable[r.children[f]],e._type==="group")for(u=0;u<r.children.length;u++)this._containsChild(e,r.children[u])||(i.children=this.diagram._getChildren(i.children),t.datavisualization.Diagram.Util.removeItem(i.children,r.children[u]))},i.prototype._hasMultipleSelection=function(n){for(var i=this.diagram._getChildren(this.diagram.selectionList[0].children),t=0;t<i.length;t++)if(n.name==i[t])return!0;return!1},i.prototype._getNextParent=function(n){if(n.parent){var t=this.diagram.nameTable[n.parent];return this._hasMultipleSelection(t)?n:this._getNextParent(t)}return n},i.prototype._findObj=function(n,t){var r,u=n.getAttribute("id"),i;return t?r=this.diagram._findChildren(t,u):(i=n.getAttribute("class"),i&&(i==="ej-d-node"||i==="ej-d-group"?r=this.diagram._findNode(u):i==="ej-d-connector"&&(r=this.diagram._findConnector(u)))),r},i.prototype.mousedown=function(n){this.startPoint=this.mousePosition(n);this.currentPoint=this.startPoint;this.previousPoint=this.startPoint;this.diagramBounds=this.diagram._getDigramBounds()},i.prototype.mousemove=function(n){(!t.datavisualization.Diagram.Geometry.isEmptyPoint(this.startPoint)||this instanceof t.datavisualization.Diagram.LineTool)&&(this.currentPoint=this.mousePosition(n))},i.prototype.mouseup=function(){this._endAction();this.diagram._pageBackgroundLayer&&t.datavisualization.Diagram.PageUtil._updatePageSize(this.diagram);this.singleAction&&this.diagram.activateTool("select");delete this.diagramBounds;this._adjustLines={lines:[]};this._undoObject=null;this._redoObject=null},i.prototype.mousePosition=function(n){return this.diagram._mousePosition(n)},i.prototype.updateCursor=function(n){this.diagram._currentCursor=n;this.diagram._updateCursor()},i.prototype.nearestGridPoint=function(n){var i=t.datavisualization.Diagram.Point();if(this.diagram.model.snap&t.datavisualization.Diagram.Snap.Grid){var o=this.diagram.model.magnification/100,r=this.diagram.model.grid.horizontalSpacing*o,u=this.diagram.model.grid.verticalSpacing*o,f=n.x%r,e=n.y%u;i.x=f>=r/2?n.x+r-f:n.x-f;i.y=e>=u/2?n.y+u-e:n.y-e}return i},i.prototype.snap=function(n){var i=this.diagram.model.snapSettings,r=this.diagram._currZoom;return i.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines&&(n.x=t.datavisualization.Diagram.SnapUtil._round(n.x,i.verticalGridLines.snapInterval,r)),i.snapConstraints&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines&&(n.y=t.datavisualization.Diagram.SnapUtil._round(n.y,i.horizontalGridLines.snapInterval,r)),n},i.prototype._endAction=function(){var i,r,s,u,h,f,o,c,e;if(this.inAction=!1,this.svgHelper)if(i=this.helper,r=this.diagram._spatialSearch,i._type!="group")t.datavisualization.Diagram.SpatialUtil._removeFromaQuad(r,r.quadTable[i.name],i);else for(s=this.helper.children.length-1,u=s;u>=0;u--)t.datavisualization.Diagram.SpatialUtil._removeFromaQuad(r,r.quadTable[i.children[u].name],i.children[u]);this.helper&&(this.svgHelper&&(h=this.diagram,f=this,this.diagram._views.forEach(function(t){var r=h._views[t];if(f.helper)var i=r.svg.getElementById(f.helper.name),u=r.svg.document.parentNode.getElementsByClassName("htmlLayer")[0],e=n(u).find("#"+f.helper.name)[0];i&&i.parentNode&&i.parentNode.removeChild(i);e&&u.removeChild(e)})),this.helper.gradient&&(o=this.diagram._svg.getElementsByTagName("defs")[0],c=this.diagram._svg.getElementById(this.helper.name+"_gradient"),o&&c&&o.removeChild(this.diagram._svg.getElementById(this.helper.name+"_gradient"))),e=document.getElementById(this.helper.name+"_parentdiv"),e&&e.parentNode.removeChild(e));this._previousPossibleConnection&&(this._previousPossibleConnection=null,t.datavisualization.Diagram.SvgContext._removePortHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer));this._currentPossibleConnection=null;this._possibleConnectionPort=null;this.helper=null;this.svgHelper=null;this.selectedObject=null;this.startPoint=t.datavisualization.Diagram.Point(0,0);this.currentPoint=t.datavisualization.Diagram.Point(0,0);this.previousPoint=t.datavisualization.Diagram.Point(0,0)},i.prototype._isResizeCorner=function(n){var t=!1;switch(n){case"n-resize":case"e-resize":case"w-resize":case"s-resize":case"ne-resize":case"nw-resize":case"se-resize":case"sw-resize":case"targetEndPoint":case"sourceEndPoint":t=!0}return t},i.prototype._initHelper=function(){this.selectedObject&&(this.helper=n.extend(!0,{},this.selectedObject),this._updateHelperName(this.helper))},i.prototype._updateHelperName=function(n,t){var u,i,r,f,e;for(t?n.name+="helper":n.name="helper",n.opacity=.5,u=n.labels,i=0,r=u.length;i<r;++i)u[i].name+="helper";if(n.ports)for(f=n.ports,i=0,r=f.length;i<r;++i)f[i].name+="helper";if(n._type==="group")for(e=this.diagram._getChildren(n.children),i=0,r=e.length;i<r;i++)this._updateHelperName(e[i],!0)},i.prototype._raiseEvent=function(n,t){return this.diagram.model[n]&&(t.elementType=this.diagram.getObjectType(t.element),t.diagramId=this.diagram.element[0].id,this.diagram._trigger(n,t)),t},i.prototype._findPort=function(n,t){var f=this.diagram._findPortAtPoint(n,t),r,e,u,i;if(!f&&t._type==="group")for(e=this.diagram._getChildren(t.children),u=0;u<e.length;u++)if(i=this.diagram.nameTable[e[u]],i&&!i.segments&&!i._isInternalShape)if(r=this._findPort(n,i),r&&this.diagram.getObjectType(i)!="group")this._currentPossibleConnection=i,f=r;else if(r)return r;return f},i.prototype._checkConnectionPossible=function(n){var r=null,o=null,s=this._sourcePossibleConnection,b=t.datavisualization.Diagram.Point(this.currentPoint.x,this.currentPoint.y),i=this.diagram._findConnectableNodeUnderMouse(n),e,a,v,u,h,c,f,p;if(i&&(this._sourcePossibleConnection||this.selectedObject)&&(this.selectedObject&&(this._endPoint=="targetEndPoint"&&this.selectedObject.sourceNode&&(s=this.diagram.nameTable[this.selectedObject.sourceNode]),this._endPoint=="sourceEndPoint"&&this.selectedObject.targetNode&&(s=this.diagram.nameTable[this.selectedObject.targetNode])),this.selectedObject&&!this.selectedObject._isAnnotationLine&&(i=t.datavisualization.Diagram.bpmnHelper.canAllowConnection(this.diagram,s,i))),i&&!i.segments)i.type=="pseudoGroup"||i.isLane||i.isSwimlane?(this._currentPossibleConnection=null,this._possibleConnectionPort=null):(this._showPorts(i),this._currentPossibleConnection=i,(this._previousPossibleConnection==null||this._previousPossibleConnection.name!==this._currentPossibleConnection.name)&&(this._previousPossibleConnection=this._currentPossibleConnection));else if(this.diagram.activeTool instanceof t.datavisualization.Diagram.LineTool)this._showPorts(),this._currentPossibleConnection=null,this._possibleConnectionPort=null;else{for(e=t.datavisualization.Diagram.Point(0,0),this._endPoint=="targetEndPoint"?(e.x=this.selectedObject.targetPoint.x-25,e.y=this.selectedObject.targetPoint.y-25):this._endPoint=="sourceEndPoint"&&(e.x=this.selectedObject.sourcePoint.x-25,e.y=this.selectedObject.sourcePoint.y-25),a=t.datavisualization.Diagram.Rectangle(e.x,e.y,50,50),v=t.datavisualization.Diagram.SpatialUtil.findQuads(this.diagram._spatialSearch,a),u=0;u<this._nearestNodes.length;u++)this._showPort(this._nearestNodes[u],!0);for(this._nearestNodes=[],u=0;u<v.length;u++)if(h=v[u],h.objects.length>0)for(c=0;c<h.objects.length;c++)f=h.objects[c],p=t.datavisualization.Diagram.Util.bounds(f),t.datavisualization.Diagram.Geometry.intersectsRect(a,p)?!f.segments&&f.visible&&(this._showPort(f),this._nearestNodes.push(f)):f.segments||this._showPort(f,!0);this._currentPossibleConnection=null;this._possibleConnectionPort=null}if(this._currentPossibleConnection){if(r=this._findPort(b,this._currentPossibleConnection),this._currentPossibleConnection&&(this._sourcePossibleConnection||this.selectedObject)&&this.selectedObject&&!this.selectedObject._isAnnotationLine&&(o=t.datavisualization.Diagram.bpmnHelper.canAllowConnection(this.diagram,s,this._currentPossibleConnection),this._currentPossibleConnection!=o&&(this._showPort(this._currentPossibleConnection,!0),o&&this._showPort(o),r=null),this._currentPossibleConnection=o),r&&t.datavisualization.Diagram.Util.canConnect(r,!0)||t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection)?t.datavisualization.Diagram.SvgContext._drawPortHighlighter(r,this._currentPossibleConnection,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom):t.datavisualization.Diagram.SvgContext._removePortHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),this._possibleConnectionPort=r,r&&t.datavisualization.Diagram.Util.canConnect(r,!0)){var l=this._currentPossibleConnection,y=t.datavisualization.Diagram.Util._getPortPosition(this._possibleConnectionPort,t.datavisualization.Diagram.Util.bounds(l,!0)),w=t.Matrix.identity();t.Matrix.rotate(w,l.rotateAngle,l.offsetX,l.offsetY);y=t.Matrix.transform(w,y);this.currentPoint=y}}else this._previousPossibleConnection&&(this._previousPossibleConnection=null,t.datavisualization.Diagram.SvgContext._removePortHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),this._possibleConnectionPort=null)},i.prototype._showPorts=function(n){n?(this._currentPossibleConnection&&this._currentPossibleConnection.name!==n.name&&this._showPort(this._currentPossibleConnection,!0),this._showPort(n)):this._currentPossibleConnection!=null&&this._showPort(this._currentPossibleConnection,!0)},i.prototype._showPort=function(n,i){var r,u,e,f,o;if(i){if(r=n.ports,r)for(f=0,o=r.length;f<o;++f)u=r[f],(u.visibility&t.datavisualization.Diagram.PortVisibility.Hover||u.visibility&t.datavisualization.Diagram.PortVisibility.Connect&&(this.name=="endPoint"||this instanceof t.datavisualization.Diagram.LineTool))&&(e=this.diagram._svg.getElementById(n.name+"_"+u.name),e&&e.setAttribute("visibility","hidden"))}else if(n.visible&&(r=n.ports,r))for(f=0,o=r.length;f<o;++f)u=r[f],(u.visibility&t.datavisualization.Diagram.PortVisibility.Hover||u.visibility&t.datavisualization.Diagram.PortVisibility.Connect&&(this.name=="endPoint"&&this.inAction||this instanceof t.datavisualization.Diagram.LineTool))&&(e=this.diagram._svg.getElementById(n.name+"_"+u.name),e&&e.setAttribute("visibility","visible"))},i.prototype._getAllLaneChildren=function(n,t){var i=this.diagram.getNode(n.name),r,u;if(i&&i.lanes&&i.lanes.length>0)for(r=0;r<i.lanes.length;r++)for(u=0;u<i.lanes[r].children.length;u++)t.push(i.lanes[r].children[u]);return t},i.prototype._getAllChildren=function(n){for(var t=0;t<n.length;t++)n[t].isSwimlane&&n.concat(this._getAllLaneChildren(n[t],n));return n},i.prototype._showAllPorts=function(n){var i,u,r=this.diagram.nodes();if(r=this._getAllChildren(r),t.datavisualization.Diagram.Util.isPageEditable(this.diagram)||(n=!0),n)for(i=0,u=r.length;i<u;i++)this._showPort(r[i],n);else for(i=0,u=r.length;i<u;++i)this._showPort(r[i])},i.prototype._disconnect=function(n){var r,i=this.diagram.nameTable[n.targetNode],u=null;i&&(u=t.datavisualization.Diagram.Util.findPortByName(i,n.targetPort),r=this._raiseEvent("connectionChange",{element:n,connection:i,port:u,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(i.inEdges,n.name),r.cancel||(n.targetNode=null,n.targetPort=null));i=this.diagram.nameTable[n.sourceNode];i&&(u=t.datavisualization.Diagram.Util.findPortByName(i,n.sourcePort),r=this._raiseEvent("connectionChange",{element:n,connection:i,port:u,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(i.outEdges,n.name),r.cancel||(n.sourceNode=null,n.sourcePort=null))},i.prototype.getLabelUnderMouse=function(){return this.diagram._findLabelEditing?null:this.activeLabel},i}();t.datavisualization.Diagram.ToolBase=i;u=function(i){function r(n){i.call(this,"select",n);this.cursor="default";this._svgHelper=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){i.prototype.mousedown.call(this,n);var r=this._findNodeUnderMouse(n);this.selectedObject=r&&t.datavisualization.Diagram.Util.canSelect(r)?r:null;this._itemClick(this.selectedObject,this.actualObject,this.selectedObject);this._nodeUnderMouseDown=this.diagram._findNodeUnderMouse(n)},r.prototype.mousemove=function(n){i.prototype.mousemove.call(this,n);var r=this._nodeUnderMouseDown;(!this.selectedObject&&!t.datavisualization.Diagram.Geometry.isEmptyPoint(this.startPoint)||r&&r.isLane&&t.datavisualization.Diagram.Util.canMultiSelectOnLane(r)||r&&r._type!="connector"&&t.datavisualization.Diagram.Util.canMultiSelectOnNode(r))&&t.datavisualization.Diagram.Util.canDoMultipleSelection(this.diagram)&&(this.inAction||this.startPoint.x==this.currentPoint.x&&this.startPoint.y==this.currentPoint.y?this._updateHelper():(this.inAction=!0,this._initHelper()))},r.prototype.mouseup=function(r){var o,u,s,f,e,h,l,c;if(this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Mouse,this.inAction)if(this.currentPoint=this.mousePosition(r),o=t.datavisualization.Diagram.Geometry.rect([{x:this.startPoint.x,y:this.startPoint.y},{x:this.currentPoint.x,y:this.currentPoint.y}]),o.width!==0||o.height!==0){if(u=[],u=this.diagram._getNodesfrombounds(o),this.diagram._hasSelection()&&(u=this.diagram._getChildren(u),t.datavisualization.Diagram.Util.removeItem(u,"multipleSelection"),this.diagram._clearSelection(u.length?!0:!1)),u.length>0){if(s=u,this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.RubberBand,s.length>1){for(e=t.datavisualization.Diagram.Group({type:"pseudoGroup",name:"multipleSelection"}),h=0;h<s.length;h++)e.children.push(this.diagram._getChild(s[h]));this.diagram.nodes().push(e);this.diagram._nodes=n.extend(!0,[],this.diagram.nodes());this.diagram.nameTable[e.name]=e;f=e}else t.datavisualization.Diagram.Util.canDoSingleSelection(this.diagram)&&(f=u[0]);f&&((f._type==="group"||f.type==="pseudoGroup")&&t.datavisualization.Diagram.Util._updateGroupBounds(f,this.diagram),this.diagram._addSelection(f))}}else this.diagram._hasSelection()&&!this.diagram._isDropped&&this.diagram._clearSelection();else this.selectedObject||this.diagram._hasSelection()?(r.ctrlKey||r.shiftKey?t.datavisualization.Diagram.Util.canDoMultipleSelection(this.diagram)&&this._processCtrlKey(r):this.diagram._hasSelection()&&(!this.selectedObject||this.diagram.selectionList[0].name!=this.selectedObject.name)&&this.diagram._clearSelection(this.selectedObject?!0:!1),this.diagram._enableAPIMethods=!1,this.diagram._addSelection(this.selectedObject),this.diagram._enableAPIMethods=!0):this.diagram._hasSelection()&&!this.diagram._isDropped&&this.diagram._clearSelection();this.diagram._isDropped=!1;this._nodeUnderMouseDown=null;(this.selectedObject||this.actualObject)&&(l=this.selectedObject||this.actualObject,c=this.diagram._mousePosition(r.originalEvent),this._raiseEvent("click",{element:this.diagram.getNode(l),actualObject:this.actualObject,count:this.diagram._getEventDetail(r),offsetX:c.x,offsetY:c.y,event:r}));i.prototype.mouseup.call(this,r)},r.prototype._endAction=function(){this._svgHelper&&(this.diagram._adornerLayer.removeChild(this._svgHelper),this.selectedObject=null,this._svgHelper=null);i.prototype._endAction.apply(this)},r.prototype._initHelper=function(){var n,t,i;this._svgHelper||(n=this.diagram._adornerSvg.g(),this.diagram._adornerLayer.appendChild(n),t=this.diagram._currZoom,i=this.diagram._svg.rect({id:"helper","class":"rubberBandSelection",x:this.startPoint.x*t,y:this.startPoint.y*t,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"}),n.appendChild(i),n.setAttribute("pointer-events","none"),this._svgHelper=n)},r.prototype._updateHelper=function(){var t=this.diagram._adornerSvg.getElementById("helper"),i=Math.abs(this.startPoint.x-this.currentPoint.x),r=Math.abs(this.startPoint.y-this.currentPoint.y),n=this.diagram._currZoom,u=(this.startPoint.x>this.currentPoint.x?this.currentPoint.x:this.startPoint.x)*n,f=(this.startPoint.y>this.currentPoint.y?this.currentPoint.y:this.startPoint.y)*n;t&&this.diagram._adornerSvg.rect({id:t.id,x:u,y:f,width:i*n,height:r*n})},r.prototype._checkGroupChildren=function(n,i,r){for(var u,e,o=this.diagram._getChildren(i.children),f=0;f<o.length;f++)u=this.diagram.nameTable[o[f]],u&&t.datavisualization.Diagram.Util.canSelect(u)&&(e=t.datavisualization.Diagram.Util.bounds(u),t.datavisualization.Diagram.Geometry.containsRect(r,e)&&n.indexOf(u)<0?n.push(u):u._type==="group"&&this._checkGroupChildren(n,u,r))},r}(i);t.datavisualization.Diagram.SelectTool=u;f=function(i){function r(n){i.call(this,"move",n);this.cursor="move";this._isMouseDown=!1;this.diffx=0;this.diffy=0;this.helper=null;this.hoverNode=null;this.stackOverNode=null;this.undoObject=[];this.activeLabel=null;this._canMoveLabel=!1;this.dragState=""}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){if(t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.diffx=0,this.diffy=0,this._allowPan(this.selectedObject,"mousedown",n),i.prototype.mousedown.call(this,n),this._isMouseDown=!0,this._canMoveLabel=!1,this.activeLabel=null,n)var r=this._findNodeUnderMouse(n);r&&!t.datavisualization.Diagram.Util.canSelect(r)?this.updateCursor("default"):this.diagram._currentCursor!="pointer"&&this.updateCursor(this.cursor);this._findLabelUnderMouse(n);this.dragState=t.datavisualization.Diagram.DragState.Starting},r.prototype.mousemove=function(r){var o,u,f,s,h,e,c;this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Mouse;this._allowPan(this.selectedObject,"mousemove",r);i.prototype.mousemove.call(this,r);t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);o=!this.inAction;this._isMouseDown&&!this.inAction&&(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y||this.diagram._selectedSymbol)&&(this.selectedObject||(this._updateSelectedObject(),this._itemClick(this.selectedObject,this.actualObject,this.diagram.model),this.selectedObject!=null&&(u=f=t.datavisualization.Diagram.Util.bounds(this.selectedObject),s={bounds:{x:f.x,y:f.y,width:f.width,height:f.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},h={bounds:{x:u.x,y:u.y,width:u.width,height:u.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},this.diagram.selectionList[0]!=this.selectedObject&&this.diagram._clearSelection(!0),this._raiseDragEvent({element:this.diagram.getNode(this.selectedObject),offset:{x:0,y:0},oldValue:s,newValue:h,cancel:!1}),e={},this.selectedObject&&(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(e=this.diagram._getChildTable(this.selectedObject,e)),c=n.extend(!0,{},{childTable:e,node:this.selectedObject}),this.undoObject=jQuery.extend(!0,{},c))));this._isMouseDown&&this.selectedObject&&t.datavisualization.Diagram.Util.canSelect(this.selectedObject)&&!this.diagram._isEditing&&(this.dragState=t.datavisualization.Diagram.DragState.Dragging,this.inAction||(this.inAction=!0,this._canMoveLabel||this.updateCursor("move"),this._updateSelection(),this.selectedObject.segments&&!this._canMoveLabel&&(t.datavisualization.Diagram.Util.isTargetConnected(this.selectedObject)||t.datavisualization.Diagram.Util.isSourceConnected(this.selectedObject))&&this._disconnect(this.selectedObject),t.datavisualization.Diagram.SvgContext._disableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram)),this._canMoveLabel?this._updateLabelXY(this.activeLabel,this.previousPoint,this.currentPoint):(this.diagram&&!this.diagram._isEditing&&this._containerMouseMove(r),this.helper||this._updateObject(),this.selectedObject.segments||this.selectedObject.isLane||this.diagram._renderTooltip(this.selectedObject,o),this.diagram._updateSelectionHandle(!0)));this.previousPoint=this.currentPoint;this._stackOverNode=this._findStackOverNode(this.helper,r);delete this.diagram._notAllow},r.prototype._updateSelectedObject=function(){var n=this.diagram._focusedElement;n&&(this.activeLabel&&!this.diagram._selectedSymbol&&(t.datavisualization.Diagram.Util.canMoveLabel(n)?this._canMoveLabel=!0:(this._disableLabel(n,this.activeLabel),this._canMoveLabel=!1)),this.diagram.selectionList[0]&&this.diagram.selectionList[0].type=="pseudoGroup"?this._canMoveLabel?(this.selectedObject=n,this.diagram._clearSelection(!0)):this.selectedObject=this.diagram.selectionList[0]:this.diagram.selectionList[0]!=n?(this.diagram._clearSelection(!0),this.selectedObject=this.diagram.nameTable[n.name]):this.selectedObject=this.diagram.nameTable[this.diagram.selectionList[0].name])},r.prototype._nodeCanHighlight=function(n){var t=!1;return this.diagram._getChildren(n.children).indexOf(this.selectedObject.name)==-1&&(this.selectedObject._type!="group"?t=!0:n._type==="group"&&(this._containsChild(this.selectedObject,n.name)||(t=!0))),t},r.prototype._swimlanPhaseDrag=function(){if(this.selectedObject&&this.selectedObject.isPhase){var n=null,i=this._getNodeUnderMouse();i&&(n=this._getSwimLaneNode(i,this.selectedObject,!0));n&&t.datavisualization.Diagram.SvgContext._drawNodeHighlighter(n,this.diagram._adornerSvg,this.diagram._adornerLayer,this.diagram._currZoom)}},r.prototype._containerMouseMove=function(n){var i,f,r=this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent],u;r&&r.container?(u=r.container,(u.type=="canvas"||u.type=="stack")&&(t.datavisualization.Diagram.canvasHelper._updateHelper(this.diagram),t.datavisualization.Diagram.canvasHelper._updateHighlighter(this.diagram,n))):(this.selectedObject.isSwimlane||(this.selectedObject.type=="pseudoGroup"&&this._isParentAsLane(this.selectedObject)?this._removeHighLighter():this.isDiagram(n)||this.selectedObject.segments?!this.isDiagram(n)&&this.selectedObject.isPhase?t.datavisualization.Diagram.SvgContext._disableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram):this._removeHighLighter():(i=this._getNodeUnderMouse(),i&&i.container&&(this.selectedObject.isSwimlane||this.selectedObject.isLane)?this._getSwimLaneNode(i,this.selectedObject)&&this._nodeHighLighter(i):i&&i.container&&i.container.type!="stack"?(this.selectedObject.name!=i.name&&this.selectedObject.type!="pseudoGroup"&&t.datavisualization.Diagram.bpmnHelper.canAllowDropOnContainer(this.selectedObject,i)&&this._nodeHighLighter(i),i&&(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this._fromDiagram(this.selectedObject.children)&&this._nodeHighLighter(i)):i&&(this._removeHighLighter(),i.segments?t.datavisualization.Diagram.SvgContext._drawConnectorHighlighter(i,this.diagram,this.diagram._currZoom):this._nodeHighLighter(i)))),f||(this.selectedObject.type=="pseudoGroup"?this._fromDiagram(this.diagram._getChildren(this.selectedObject.children))?(this._undoObject||t.datavisualization.Diagram.Util._getUndoObject(this.diagram,this.selectedObject),this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)):(this._fromSameContainer(this.diagram._getChildren(this.selectedObject.children))&&this.hasSameParent()||this._anyFromContainer(this.diagram._getChildren(this.selectedObject.children)))&&(t.datavisualization.Diagram.canvasHelper._removeFromParentContainer(this.diagram,this.selectedObject),this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)):t.datavisualization.Diagram.Util.canMove(this.selectedObject)&&this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)));this._swimlanPhaseDrag(n)},r.prototype.isDiagram=function(n){return n.target.id==this.diagram._id+"_canvas_svg"||n.target.id.match(this.selectedObject.name)?!0:!1},r.prototype._allowPan=function(n,i,r){i==="mousedown"&&this.diagram.tools.panTool.mousedown(r);n&&(n._type==="group"||n._type=="node")&&n.constraints&t.datavisualization.Diagram.NodeConstraints.AllowPan&&(i==="mousemove"?this.diagram.tools.panTool.mousemove(r):i==="mouseup"&&this.diagram.tools.panTool.mouseup(r))},r.prototype._checkForDropEvent=function(n,i){var o;if(!this.diagram._selectedSymbol){var r=this.diagram,f=n,e=null,u=t.datavisualization.Diagram.ObjectTypes.Diagram;this.selectedObject&&this.selectedObject.parent&&(r=this.diagram.nameTable[this.selectedObject.parent],r.isLane?u=t.datavisualization.Diagram.ObjectTypes.Lane:r._type=="group"&&(u=t.datavisualization.Diagram.ObjectTypes.Group));n&&!i&&(e=t.datavisualization.Diagram.Util.bounds(n),f=this._getTargetNode(n,e));do if(n&&!t.datavisualization.Diagram.Util.canAllowDrop(n))if(n.parent)n=this.diagram.nameTable[n.parent];else if(n.container)break;else n=null;else break;while(n);if(n)return o=this._raiseEvent("drop",{cancel:!1,element:this.selectedObject,source:this.diagram.getNode(r),target:this.diagram.getNode(f),sourceType:u}),o.cancel}return!1},r.prototype._getSwimLaneNode=function(n,t,i){if(n.isSwimlane)if(i){if(this.diagram.nameTable[this.diagram._getChild(n.children[2])].container.orientation==t.orientation)return n}else if(this.diagram.nameTable[this.diagram._getChild(n.children[2])].container.orientation!=t.orientation)return n;if(n.parent){var r=this.diagram.nameTable[n.parent];if(r)return this._getSwimLaneNode(r,t,i)}return null},r.prototype._cloneGroupNode=function(t,i){var o=null,r,u,e,f;if(u=n.extend(!0,{},t),u.name+=i,t&&t._type==="group")for(u.children=[],e=this.diagram._getChildren(t.children),f=0;f<e.length;f++)o=this.diagram.nameTable[e[f]],r=n.extend(!0,{},o),r.name+=i,r.parent&&(r.parent+=i),r._type==="group"&&this._cloneGroupNode(r,i),this.diagram.nameTable[r.name]=r,u.children.push(r.name);return u},r.prototype._outOfBoundsLaneDrop=function(n,i){var r,o,s;if(n&&n.isLane&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var p=t.datavisualization.Diagram.Util.bounds(n),u=this._getPageBounds(),l=i.offsetX,a=i.offsetY,h=0,c=0,f=0,v=0,y=this.diagram.nameTable[i.children[2]],e=this.diagram.nameTable[i.children[0]];if((v=e?e.height:v,f=i.phaseSize?i.phaseSize:f,y&&(r=this.diagram.nameTable[y.children[0]],r&&(h=r.minHeight>100?r.minHeight:100,c=r.minWidth>100?r.minWidth:100)),n.orientation==="horizontal"?(o=c,s=h+e.height+f):(o=c+f,s=h+e.height),l+o/2+5>=u.width||l-o/2-5<=u.x)||a+s/2+5>=u.height||a-s/2-5<=u.y)return!1}return!0},r.prototype._getMouseOverElement=function(t,i){var r=null,h,e,f;if(t&&t.target)for(var o=n(t.target).parents(".ej-d-node,.ej-d-connector,.ej-d-group,.ej-d-group ej-d-classifier,.ej-d-node ej-d-classifier,.ej-d-label ej-d-classifier"),u=o[0],s=1;u;)if(h=this.diagram._isForeignObject(t.target),r=h?this.diagram._findNode(u.getAttribute("id").split("_parentdiv")[0]):this.diagram._findNode(u.getAttribute("id")),r&&r.container)u=null;else{if(r&&i&&r._isHeader&&r.parent&&(e=this.diagram.nameTable[r.parent],e&&e.isSwimlane))break;u=o[s];!u&&r&&r.parent&&(f=this.diagram.nameTable[r.parent],f&&f.isLane&&(r=f));s++}return r},r.prototype._multiNodedrag=function(n){t.datavisualization.Diagram.canvasHelper&&!this._containsSwimlane(this.selectedObject.children)&&t.datavisualization.Diagram.canvasHelper._multiNodedrag(this.diagram,n,this.selectedObject)},r.prototype._changeNodeState=function(n,i,r){var a,o=null,u=this._getMouseOverElement(n,r),c,f,s,h,e,l;return u&&(u=this.selectedObject&&!this.selectedObject.isLane||u.isLane?u:null),this.diagram._selectedSymbol&&this.diagram._selectedSymbol.isLane&&!i?(this.diagram._isDragg=!0,u&&(o=this._getSwimLaneNode(u,this.selectedObject)),u&&o?t.datavisualization.Diagram.canvasHelper._addNewLane(this.diagram,u,o):(c=this.diagram.nameTable[this.selectedObject.children[0]],this.diagram._isUndo=!0,this.diagram.remove(this.selectedObject),t.datavisualization.Diagram.containerCommon._removeObject(this.diagram,this.selectedObject),this.diagram._selectedSymbol&&t.datavisualization.Diagram.containerCommon._removeObject(this.diagram,this.diagram._selectedSymbol),this.diagram._isUndo=!1,f=t.datavisualization.Diagram.SwimLaneHelper._createSwimlane(this.selectedObject,this.diagram,null,null,c),f&&(s={element:this.diagram.getNode(this.selectedObject),cancel:!1},this.diagram._selectedSymbol=null,this._outOfBoundsLaneDrop(this.selectedObject,f)?(this.diagram._raiseDropEvent(s),s.cancel?this.selectedObject=null:(this.diagram._eventCause.nodeCollectionChange=t.datavisualization.Diagram.CollectionChangeCause.Drop,this.diagram.add(f)?(f=this.diagram.nameTable[f.name]||f,this.diagram._selectedSymbol=f,this.diagram._updateDroppedSymbol(f),this.selectedObject=f):this.selectedObject=null)):this.selectedObject=null))):this.selectedObject&&this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent].container?(h=this.diagram.nameTable[this.selectedObject.parent],h&&(e=h.container,this._removeHelpers(),e&&e.type=="canvas"?(t.datavisualization.Diagram.SvgContext._showNode(this.selectedObject,this.diagram._svg),this.selectedObject.type=="pseudoGroup"||this.diagram._isDragg||(this._swimlaneNodeDragged=t.datavisualization.Diagram.canvasHelper._singleNodedrag(this.diagram,n,u))):e.type=="stack"?t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer):(this.isDiagram(n)&&this._addToDiagram(),this.diffx=this.diffy=0))):this.selectedObject&&!this.selectedObject.isSwimlane&&(this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()?(this.currentPoint=this.previousPoint,this.diffx=0,this.diffy=0,this._removeHelpers(),this._multiNodedrag(n,u)):(this.selectedObject.type!="connector"||this.selectedObject.isPhase)&&!this.isDiagram(n)&&this.selectedObject.type!="pseudoGroup"?(u=this._getMouseOverElement(n),this.diagram._isDragg||(u&&u.container&&t.datavisualization.Diagram.Util.canAllowDrop(u)&&!this._checkForDropEvent(u)&&!u.isSwimlane&&t.datavisualization.Diagram.bpmnHelper.canAllowDropOnContainer(this.selectedObject,u)?(l=this.helper?this.helper:this.selectedObject,t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this.diagram,l,u)?(t.datavisualization.Diagram.canvasHelper._addNodeToContainer(this.diagram,this.selectedObject,u),this.diagram._raiseGroupChangeEvent(this.selectedObject,null,u,"group")):(this.diagram._translate(this.selectedObject,this.undoObject.node.offsetX-this.selectedObject.offsetX,this.undoObject.node.offsetY-this.selectedObject.offsetY,this.diagram.nameTable),this.diagram._updateAssociatedConnectorEnds(this.selectedObject,this.diagram.nameTable))):u&&this.selectedObject.name!=u.name&&this._checkForDropEvent(u,!0))):this.selectedObject.type!="connector"||this.selectedObject.isPhase?(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this.diagram._activeSwimLane?(this._multiNodedrag(n,u),this.selectedObject=null):!this.diagram._activeSwimLane&&u&&u.isLane?(this.diagram._activeSwimLane=this._getParentSwimlane(u),this._multiNodedrag(n,u),this.selectedObject=null):u&&u.type=="bpmn"&&(this._multiNodedrag(n,u),this.selectedObject=null):u&&(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this._fromDiagram(this.selectedObject.children)&&t.datavisualization.Diagram.Util.canAllowDrop(u)&&(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),this._multiNodedrag(n,u))),this._removeHelpers(),this._checkPhaseDrop(n),a},r.prototype._checkPhaseDrop=function(n){var i=null,r,u,f,e,s,o;this.selectedObject&&this.selectedObject.isPhase&&(f=this._findNodeUnderMouse(n),f&&(i=this._getSwimLaneNode(f,this.selectedObject,!0)),i?(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.SvgContext._removeNodeHighlighter(this.diagram._adornerSvg,this.diagram._adornerLayer),e=this._getSwimlaneHeader(i),this.selectedObject.orientation=="vertical"?(r=this.currentPoint.x-(i.offsetX-i.width/2),u="horizontal"):(r=this.currentPoint.y-(i.offsetY-i.height/2),r-=e?e.height:0,u="vertical"),s={element:this.selectedObject,cancel:!1,target:i},this.diagram._dropPhase=!0,this.diagram.remove(this.selectedObject),delete this.diagram._dropPhase,this.diagram._selectedSymbol=null,this.inAction=!1,o=this.selectedObject.labels&&this.selectedObject.labels.length>0?this.selectedObject.labels[0]:{text:"Phase"},this.diagram._addPhase(i.name,{name:t.datavisualization.Diagram.Util.randomId(),offset:r,orientation:u,label:o,lineColor:this.selectedObject.lineColor,lineDashArray:this.selectedObject.lineDashArray,lineWidth:this.selectedObject.lineWidth}),this.diagram._selectedSymbol=null):(this.diagram._remove(this.selectedObject),this.diagram._clearSelection(!0),this.selectedObject=null,this.diagram._selectedSymbol=null))},r.prototype._removeHelpers=function(){t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer);t.datavisualization.Diagram.SvgContext._removeConnectorHighlighter(this.diagram._adornerLayer,this.diagram._adornerSvg);this._removeHighLighter();this.diffx=0;this.diffy=0},r.prototype._updateNodeState=function(n,i){var f,u,o,h,c,e,r,a,l,s;this.diagram.nameTable[this.selectedObject.parent]&&(f=this.diagram.nameTable[this.selectedObject.parent].container);u=this._getNodeUnderMouse();u&&(u=!this.selectedObject.isLane||u.isLane?u:null);f?f.type=="canvas"?u&&i&&(o=this.selectedObject.parent,h=this.diagram._getSwimlane(o),h&&this.diagram._updateChildAdjacentConnectors(h,!0),t.datavisualization.Diagram.DiagramContext.update(i,this.diagram)):f.type=="stack"&&(c=this._checkForDropEvent(u),c||(e=this._stackOverNode,e?(r=this.diagram.nameTable[e.parent],r||(r=u),a=t.datavisualization.Diagram.Util.bounds(r),l=r.rotateAngle,r.rotateAngle==0||l!=0||this.diagram._rotate(r,-r.rotateAngle,this.diagram.nameTable),r.children=this.diagram._getChildren(r.children),this.selectedObject.name!=e.name&&(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.canvasHelper._swapLane(this.diagram,r.children,this.selectedObject.name,e.name,r.container.orientation==="vertical"?!0:!1,r))):this.diffx=this.diffy=0)):this.selectedObject.type=="pseudoGroup"&&(s=this.diagram.nameTable[this.diagram._getChild(this.selectedObject.children[0])],s&&s.parent&&(f=this.diagram.nameTable[s.parent].container),f&&f.type=="canvas"&&u&&i&&(o=this.selectedObject.parent,this.diagram._updateChildAdjacentConnectors(o,!0),t.datavisualization.Diagram.DiagramContext.update(i,this.diagram)))},r.prototype.mouseup=function(r,u){var y=this.inAction,f,c,e,o,p,w,b,k,s,d,g,l,it,a,nt,h,v;if(t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.diagram._eventCause.selectionChange=t.datavisualization.Diagram.SelectionChangeCause.Mouse,this.inAction?(this.dragState=t.datavisualization.Diagram.DragState.Completed,t.datavisualization.Diagram.SvgContext._enableSelectedNode(this.selectedObject,this.diagram._svg,this.diagram),this._canMoveLabel||(c=this._changeNodeState(r,u,!0)),this.inAction=!1,this.selectedObject&&(this._canMoveLabel?this._updateLabelXY(this.activeLabel,this.previousPoint,this.currentPoint):(e=o=t.datavisualization.Diagram.Util.bounds(this.selectedObject),p={bounds:{x:o.x,y:o.y,width:o.width,height:o.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},w={bounds:{x:e.x,y:e.y,width:e.width,height:e.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},this.selectedObject.isLane||(this._swimlaneNodedragged||(b=this._updateXY(this.selectedObject,this.previousPoint,this.currentPoint)),this.selectedObject&&this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent].container&&c||(this._raiseDragEvent({element:this.diagram.getNode(this.selectedObject),offset:{x:0,y:0},oldValue:p,newValue:w,cancel:!1}),this.dragState=""))),u||this._updateNodeState(r,c),this._updateObject(),s={},(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(s=this.diagram._getChildTable(this.selectedObject,s)),this.diagram._selectedSymbol||this.selectedObject.isPhase||this.selectedObject.isLane||this._isLane||this.diagram._isDragg||(d={childTable:s,node:this.selectedObject},k=n.extend(!0,{},d),g={type:"positionchanged",undoObject:jQuery.extend(!0,{},this.undoObject),redoObject:jQuery.extend(!0,{},k),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"},this._multipleUndo||this.diagram.addHistoryEntry(g),this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent].type=="bpmn"&&this.diagram._isGroupActionEnabled&&(this.diagram._closeGroupAction(),delete this.diagram._isGroupActionEnabled)),this.diagram._selectedSymbol&&this.diagram._selectedSymbol.isSwimlane&&(this.diagram._selectedSymbol=null),this.diagram._updateSelectionHandle(),f=this.selectedObject,this._isLane=!1,this._multipleUndo=!1)):this.selectedObject?f=this._findNodeUnderMouse(r):(r.ctrlKey||r.shiftKey?f=this._processCtrlKey(r):(l=!0,it=r.target.className,a=t.datavisualization.Diagram.Util.isClassifier(r)?t.datavisualization.Diagram.ClassifierHelper.getSelectableElementUnderMouse(r,this.diagram):this._findNodeUnderMouse(r),r.which===3&&this.diagram.selectionList[0]&&(this.diagram.selectionList[0].type==="pseudoGroup"||this.diagram.selectionList[0]._type==="group")&&this._hasMultipleSelection(a)&&(l=!1),t.datavisualization.Diagram.Util.canDoSingleSelection(this.diagram)&&this._isMouseDown&&(this.selectedObject=l?a:this.diagram.selectionList[0]),f=this.selectedObject),nt=this.diagram.selectionList.length>0?this.diagram.selectionList[0]:null,this.selectedObject&&!this.diagram._selectionContains(this.selectedObject)&&this.diagram._clearSelection(!0)),!b&&this.selectedObject){if(this.selectedObject&&this.selectedObject.type!="pseudoGroup"&&!y){var tt=this._findNodeUnderMouse(r,!0),rt=this.selectedObject,ut=this._raiseEvent("itemClick",{element:this.selectedObject,actualObject:this.actualObject,selectedObject:tt,model:this.diagram.model,cancel:!1,event:r});this._itemClick(this.selectedObject,this.actualObject,tt,nt);ut.cancel&&(this.selectedObject=rt)}this.selectedObject&&(this._allowPan(this.selectedObject,"mouseup",r),this.selectedObject.isPhase||this._updateSelection(),this._enableLabel(this.selectedObject,this.activeLabel),this.selectedObject&&this.selectedObject.parent===""&&(this.selectedObject.isSwimlane?(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this.diagram,this.selectedObject)):t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),h=this.selectedObject,this.diagram._isDragg&&!this.diagram._selectionContains(h)&&(this.diagram._clearSelection(),h.isPhase||this.diagram._addSelection(h))));f&&!y&&(v=this.diagram._mousePosition(r.originalEvent),this._raiseEvent("click",{element:this.diagram.getNode(f),actualObject:this.diagram.getNode(this.actualObject),count:this.diagram._getEventDetail(r),offsetX:v.x,offsetY:v.y,event:r}))}this._multipleUndo=!1;delete this.diffx;delete this.diffy;delete this._isMouseDown;delete this.actualObject;delete this._swimlaneNodedragged;this.diagram._removeTooltip();this.diagram._isEditing||this.diagram._isDragg||this.diagram._endEdit();delete this.hoverNode;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);this.diagram._activeSwimLane=null;i.prototype.mouseup.call(this,r)},r.prototype._updateObject=function(){var i,r,n,u;if(this.selectedObject)if(this.selectedObject.type=="pseudoGroup")for(r=this.diagram._getChildren(this.selectedObject.children),n=0,u=r.length;n<u;n++)i=this.diagram.nameTable[r[n]],i&&t.datavisualization.Diagram.DiagramContext.update(i,this.diagram);else this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),this.selectedObject.isSwimlane?(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this.diagram,this.selectedObject)):t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram)},r.prototype._endAction=function(){i.prototype._endAction.apply(this);this._isMouseDown=!1;this._mouseOffset=t.datavisualization.Diagram.Size(0,0)},r.prototype._updateHelperXY=function(n,i,r){var a=r.x<i.x,v=r.y<i.y,o=this.diffx+(r.x-i.x),s=this.diffy+(r.y-i.y),u,f,c,e,l,h;(this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines||this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines)&&this.diagram._enableSnapToObject()&&(u=t.datavisualization.Diagram.SnapUtil._snapPoint(this.diagram,this.helper,a,v,t.datavisualization.Diagram.Point(o,s),r,i));u||(u=t.datavisualization.Diagram.Point(o,s));this.diffx=o-u.x;this.diffy=s-u.y;t.datavisualization.Diagram.Geometry.isEmptyPoint(u)||(f=t.datavisualization.Diagram.Util.bounds(n),f=t.datavisualization.Diagram.Rectangle(f.left,f.top,f.right-f.left,f.bottom-f.top),c={bounds:{x:f.x,y:f.y,width:f.width,height:f.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},this._outOfBoundsDrag(n,u.x,u.y)&&this.diagram._translate(n,u.x,u.y,this.diagram.nameTable),e=t.datavisualization.Diagram.Util.bounds(n),e=t.datavisualization.Diagram.Rectangle(e.left,e.top,e.right-e.left,e.bottom-e.top),l={bounds:{x:e.x,y:e.y,width:e.width,height:e.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},h=this._raiseDragEvent({element:this.diagram.getNode(this.helper),offset:u,oldValue:c,newValue:l,cancel:!1}),h&&!h.cancel?this.inAction||n._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram):this.diagram._translate(n,-u.x,-u.y,this.diagram.nameTable))},r.prototype._outOfBoundsDrag=function(n,i,r,u){var f,e,o;if(i=i?i:0,r=r?r:0,n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)&&(f=t.datavisualization.Diagram.Util.bounds(n),e=this._getPageBounds(),u&&(i=u==="horizontal"?0:i,r=u==="vertical"?0:r),f)){if(o=this._getPadding(n),n.isPhase)return!0;if((!this.diagram._selectedSymbol||this._skipSelectedSymbol)&&(f.right+i+o.x>e.width||f.left+i-o.x<e.x)||(!this.diagram._selectedSymbol||this._skipSelectedSymbol)&&(f.bottom+r+o.y>e.height||f.top+r-o.y<e.y))return this.updateCursor("not-allowed"),!1}return this.diagram._notAllow||this.updateCursor("move"),!0},r.prototype._updateXY=function(n,i,r,u){var v=r.x<i.x,y=r.y<i.y,h=this.diffx+(r.x-i.x),c=this.diffy+(r.y-i.y),f,s,e,l,o,a;if((this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines||this.diagram._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines||this.diagram._enableSnapToObject())&&(f=t.datavisualization.Diagram.SnapUtil._snapPoint(this.diagram,this.selectedObject,v,y,t.datavisualization.Diagram.Point(h,c),r,i)),f||(f=t.datavisualization.Diagram.Point(h,c)),this.diffx=h-f.x,this.diffy=c-f.y,(!t.datavisualization.Diagram.Geometry.isEmptyPoint(f)||this.diagram._selectedSymbol&&!this.inAction)&&(e=t.datavisualization.Diagram.Util.bounds(n),e=t.datavisualization.Diagram.Rectangle(e.left,e.top,e.right-e.left,e.bottom-e.top),l={bounds:{x:e.x,y:e.y,width:e.width,height:e.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},n.segments||t.datavisualization.Diagram.Util.canAllowPan(n)&&(this.diagram._hScrollOffset===0&&(f.x=0),this.diagram._vScrollOffset===0&&(f.y=0)),u&&!n.isSwimlane&&n.type!="pseudoGroup"&&(this.diagram._preventDocking=!0),this._outOfBoundsDrag(n,f.x,f.y))){if(this.diagram._raiseOffsetPropertyChange(n,f.x,f.y,!0),this.diagram._translate(n,f.x,f.y,this.diagram.nameTable),delete this.diagram._preventDocking,o=t.datavisualization.Diagram.Util.bounds(n),o=t.datavisualization.Diagram.Rectangle(o.left,o.top,o.right-o.left,o.bottom-o.top),a={bounds:{x:o.x,y:o.y,width:o.width,height:o.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},this.diagram._selectedSymbol){if(s={element:this.diagram.getNode(this.selectedObject),allowDrop:!0,target:this._getNodeUnderMouse(),oldValue:l,newValue:a,cancel:!1},s.target&&s.target.segments&&t.datavisualization.Diagram.SvgContext._drawConnectorHighlighter(s.target,this.diagram,this.diagram._currZoom),this._raiseEvent("dragOver",s),s.allowDrop)this.diagram._notAllow||this.updateCursor("move");else if(this.updateCursor("not-allowed"),!this.inAction)return this.diagram._removeSymbolFromDiagram(),!0}else s=this._raiseDragEvent({element:this.diagram.getNode(this.selectedObject),offset:f,oldValue:l,newValue:a,cancel:!1});s&&!s.cancel||this.diagram._selectedSymbol?(n._type==="group"&&n.type!="bpmn"||n.type==="pseudoGroup")&&t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram):s&&s.cancel&&this.diagram._translate(n,-f.x,-f.y,this.diagram.nameTable)}},r.prototype._updateLabelXY=function(n,i,r){var u=r.x-i.x,f=r.y-i.y,e,o,s;this.selectedObject.segments||(e=t.Matrix.identity(),t.Matrix.rotate(e,-this.selectedObject.rotateAngle),o=t.Matrix.transform(e,t.datavisualization.Diagram.Point(u,f)),u=o.x,f=o.y);this.diagram._translateLabel(this.selectedObject,n,u,f);s=this._raiseDragEvent({element:this.diagram.getNode(n),offset:n.offset,cancel:!1});s&&s.cancel&&this.diagram._translateLabel(this.selectedObject,n,-u,-f)},r.prototype._raiseDragEvent=function(n){if(!this.diagram._selectedSymbol&&!this.diagram._isDragg)return n.dragState=this.dragState,this._raiseEvent("drag",n)},r.prototype._updateSelection=function(){this.diagram._selectionContains(this.selectedObject)||(this.diagram._clearSelection(!0),this.diagram._addSelection(this.selectedObject))},r.prototype._disableLabel=function(t,i){if(t&&i){var u=this.diagram._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],f=t._shape=="text"?t.name:t.name+"_"+i.name,r=n(u).find("#"+f+".ej-d-label")[0];r&&(r.style.pointerEvents="none")}},r.prototype._enableLabel=function(t,i){if(t&&i){var u=this.diagram._svg.document.parentNode.getElementsByClassName("htmlLayer")[0],f=t._shape=="text"?t.name:t.name+"_"+i.name,r=n(u).find("#"+f+".ej-d-label")[0];r&&(r.style.pointerEvents="all")}},r}(i);t.datavisualization.Diagram.MoveTool=f;e=function(i){function r(n){i.call(this,"resize",n);this.cursor="default";this._resizeDirection=null;this._mouseOffset=t.datavisualization.Diagram.Size(0,0);this.diffx=0;this.diffy=0;this._startPoint=t.datavisualization.Diagram.Size(0,0);this.undoObject=null;this.pseudoGroupConstraints=null;this._mouseDown=!1;this.resizeState=""}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);i.prototype.mousedown.call(this,n);this._mouseDown=!0;this.resizeState=t.datavisualization.Diagram.ResizeState.Starting},r.prototype.mousemove=function(r){var h,c,e,u,f,l,a,v,o,s;i.prototype.mousemove.call(this,r);h=!this.inAction;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);!this.inAction&&this.diagram.selectionList[0]&&this._mouseDown&&(this.selectedObject=this.diagram.nameTable[this.diagram.selectionList[0].name],e={},u=f=t.datavisualization.Diagram.Util.bounds(this.selectedObject),l={bounds:{x:f.x,y:f.y,width:f.width,height:f.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},a={bounds:{x:u.x,y:u.y,width:u.width,height:u.height},offsetX:this.selectedObject.offsetX,offsetY:this.selectedObject.offsetY,width:this.selectedObject.width,height:this.selectedObject.height},this._raiseEvent("sizeChange",{element:this.diagram.getNode(this.selectedObject),resizeState:this.resizeState,offset:{x:0,y:0},oldValue:l,newValue:a,cancel:!1,direction:this._resizeDirection}),(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(e=this.diagram._getChildTable(this.selectedObject,e)),v={childTable:e,node:this.selectedObject},this.selectedObject&&this.selectedObject.type==="pseudoGroup"&&(this.pseudoGroupConstraints=this.diagram.model.selectedItems.getConstraints&&n.isFunction(this.diagram.model.selectedItems.getConstraints)?this.diagram.model.selectedItems.getConstraints():t.datavisualization.Diagram.Util._getPseudoGroupConstraints(this.diagram,this.selectedObject,this.selectedObject)),c=n.extend(!0,{},v),this.undoObject=jQuery.extend(!0,{},c),this._resizeDirection=r.target.getAttribute("class"),this.selectedObject.width||(this.selectedObject.width=this.selectedObject._width),this.selectedObject.height||(this.selectedObject.height=this.selectedObject._height),this.initialBounds={width:this.selectedObject.width,height:this.selectedObject.height,y:this.selectedObject.offsetY,x:this.selectedObject.offsetX},t.datavisualization.Diagram.SvgContext._removePivotPoint(this.selectedObject,this.diagram._svg,this.diagram._currZoom),this.inAction=!0);this.selectedObject&&(this.resizeState=t.datavisualization.Diagram.DragState.Resizing,o=!1,this.selectedObject&&this.selectedObject.parent?(s=this.diagram.nameTable[this.selectedObject.parent],s.container&&(s.container.type=="canvas"||s.container.type=="stack")&&(o=!0)):this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(o=!0),this.selectedObject&&o||this.selectedObject.type==="pseudoGroup"&&this._anyFromContainer(this.diagram._getChildren(this.selectedObject.children))?this.selectedObject.type==="pseudoGroup"&&this._isParentAsLane(this.selectedObject)?t.datavisualization.Diagram.canvasHelper._removeFromParentContainer(this.diagram,this.selectedObject):t.datavisualization.Diagram.canvasHelper._updateResizeHelper(this.diagram):this.selectedObject&&this.diagram.nameTable[this.selectedObject.name].container?t.datavisualization.Diagram.canvasHelper._updateResizeHelper(this.diagram):this.selectedObject.parent&&this.diagram.nameTable[this.selectedObject.parent]&&this.diagram.nameTable[this.selectedObject.parent].container&&this.diagram.nameTable[this.selectedObject.parent].container.type=="stack"?(this.helper||(this.helper=this._getCloneNode(this.selectedObject)),t.datavisualization.Diagram.SvgContext._drawContainerHelper(this.diagram),this._startPoint=this.currentPoint,this._updateSize(this.helper,this.previousPoint,this.currentPoint),t.datavisualization.Diagram.DiagramContext.update(this.helper,this.diagram)):this.selectedObject.type!="pseudoGroup"?this._updateSize(this.selectedObject,this.previousPoint,this.currentPoint):this.selectedObject.type=="pseudoGroup"&&!this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&this._fromSameContainer(this.diagram._getChildren(this.selectedObject.children))&&(this._undoObject||t.datavisualization.Diagram.Util._getUndoObject(this.diagram,this.selectedObject),this._updateSize(this.selectedObject,this.previousPoint,this.currentPoint)),this.helper||(this.selectedObject.isSwimlane?this._isMouseDown||(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(this.diagram,this.selectedObject)):t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram)),this.diagram._renderTooltip(this.selectedObject,h),this.diagram._updateSelectionHandle(!0));this.previousPoint=this.currentPoint},r.prototype.mouseup=function(r){var h=null,s,u,o,l,c,a,e,v,f,y,p;this._mouseDown=!1;this.inAction&&(this.resizeState=t.datavisualization.Diagram.ResizeState.Completed,t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this.inAction=!1,s=!1,o=t.datavisualization.Diagram.Util.bounds(this.undoObject.node),l={bounds:{x:o.x,y:o.y,width:o.width,height:o.height},offsetX:this.undoObject.node.offsetX,offsetY:this.undoObject.node.offsetY,width:this.undoObject.node.width,height:this.undoObject.node.height},this.selectedObject.parent?(c=this.diagram.nameTable[this.selectedObject.parent],c&&c.container&&(u=t.datavisualization.Diagram.Util.bounds(this.helper))):u=t.datavisualization.Diagram.Util.bounds(this.selectedObject),a={bounds:{x:u.x,y:u.y,width:u.width,height:u.height},offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,width:u.width,height:u.height},this._raiseEvent("sizeChange",{element:this.diagram.getNode(this.selectedObject),resizeState:this.resizeState,offset:{x:0,y:0},oldValue:l,newValue:a,cancel:!1,direction:this._resizeDirection}),this.resizeState="",(this.selectedObject.isLane||this.selectedObject.isSwimlane)&&(f={},f=this.diagram._getChildTable(this.selectedObject,f),h=n.extend(!0,{},{childTable:f,node:this.selectedObject})),this.selectedObject&&this.selectedObject.parent?(e=this.diagram.nameTable[this.selectedObject.parent],e.container&&(e.container.type=="canvas"||e.container.type=="stack")&&(s=!0)):this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(s=!0),this.selectedObject&&s&&!e.isLaneStack?(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this.diagram,this.diagram.activeTool.helper,e)&&(this.selectedObject.container?t.datavisualization.Diagram.canvasHelper._resizeLane(this.diagram,this.selectedObject):t.datavisualization.Diagram.canvasHelper._singleNodeResize(this.diagram,r,this.selectedObject),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram))):this.selectedObject&&this.diagram.nameTable[this.selectedObject.name].container?(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),t.datavisualization.Diagram.canvasHelper._resizeLane(this.diagram,this.selectedObject)):(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this.diagram._activeSwimLane&&t.datavisualization.Diagram.canvasHelper._multiNodeResize(this.diagram,r,this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.diagram._updateSelectionHandle(),f={},(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(f=this.diagram._getChildTable(this.selectedObject,f)),y={childTable:f,node:this.selectedObject},v=n.extend(!0,{},y),p={type:"sizechanged",undoObject:h?h:this.undoObject,redoObject:jQuery.extend(!0,{},v),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"},this._multipleUndo||this.diagram.addHistoryEntry(p),this.diagram._removeTooltip(),this._multipleUndo=!1);i.prototype.mouseup.call(this,r)},r.prototype._updateSize=function(n,i,r,u,f,e,o,s,h){var y,a,tt=t.Matrix.identity(),rt,ut,v,et,ft,p,ht,w,ct,ot,st;t.Matrix.rotate(tt,-n.rotateAngle);var b={snapped:!1,offset:0,left:!1,right:!1},k={snapped:!1,offset:0,top:!1,bottom:!1},l=u?u:this.currentPoint.x-this.startPoint.x,c=f?f:this.currentPoint.y-this.startPoint.y,d=t.datavisualization.Diagram.Point(0,0),it=t.Matrix.identity(),g=n.offsetX,nt=n.offsetY;t.Matrix.rotate(it,n.rotateAngle,g,nt);rt=n.width;ut=n.height;g=g-rt*n.pivot.x;nt=nt-ut*n.pivot.y;switch(this._resizeDirection){case"n-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt/2,nt+ut));v=1;a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapTop(b,k,l,c,n,r==i);y=(this.initialBounds.height-c)/n.height;break;case"e-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g,nt+ut/2));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;l=this._snapRight(b,k,l,c,n,r==i,h);c=0;v=(this.initialBounds.width+l)/n.width;y=1;break;case"w-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt,nt+ut/2));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;l=this._snapLeft(b,k,l,c,n,r==i);c=0;v=(this.initialBounds.width-l)/n.width;y=1;break;case"s-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt/2,nt));v=1;a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapBottom(b,k,a.x,a.y,n,r&&i&&r==i?!0:!1);y=(this.initialBounds.height+c)/n.height;break;case"ne-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g,nt+ut));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;l=this._snapRight(b,k,l,c,n,r==i,h);c=this._snapTop(b,k,l,c,n,r==i);v=(this.initialBounds.width+l)/n.width;y=(this.initialBounds.height-c)/n.height;break;case"nw-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt,nt+ut));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapTop(b,k,l,c,n,r==i);l=this._snapLeft(b,k,l,c,n,r==i);v=(this.initialBounds.width-l)/n.width;y=(this.initialBounds.height-c)/n.height;break;case"se-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g,nt));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapBottom(b,k,l,c,n,r==i,h);l=s?l:this._snapRight(b,k,l,c,n,r==i);v=(this.initialBounds.width+l)/n.width;y=(this.initialBounds.height+c)/n.height;break;case"sw-resize":d=t.Matrix.transform(it,t.datavisualization.Diagram.Point(g+rt,nt));a=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(l,c));l=a.x;c=a.y;c=this._snapBottom(b,k,l,c,n,r==i,h);l=this._snapLeft(b,k,l,c,n,r==i);v=(this.initialBounds.width-l)/n.width;y=(this.initialBounds.height+c)/n.height}if(n&&(this.pseudoGroupConstraints||(this.pseudoGroupConstraints=n.constraints)),this.pseudoGroupConstraints&t.datavisualization.Diagram.NodeConstraints.AspectRatio&&(this._resizeDirection=="n-resize"||this._resizeDirection=="s-resize"||this._resizeDirection=="w-resize"||this._resizeDirection=="e-resize"?(et=t.Matrix.transform(tt,t.datavisualization.Diagram.Point(i.x-r.x,i.y-r.y)),Math.abs(et.x)>Math.abs(et.y)?y=v:v=y):y=i!=r?v=Math.max(y,v):v=0),ft=t.datavisualization.Diagram.Size(),v<0&&(v=1),y<0&&(y=1),ft.width=v,ft.height=y,p=t.datavisualization.Diagram.Util.bounds(n),p=t.datavisualization.Diagram.Rectangle(p.left,p.top,p.right-p.left,p.bottom-p.top),ht={bounds:{x:p.x,y:p.y,width:p.width,height:p.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},!t.datavisualization.Diagram.Geometry.isEmptySize(ft))if(this.resizeState=t.datavisualization.Diagram.ResizeState.Resizing,this._outOfBoundsDrag(n,v,y,d))this.diagram._raiseSizePropertyChange(n,v,y,!0),this.diagram.scale(n,v,y,d,this.diagram.nameTable,null,e,o),w=t.datavisualization.Diagram.Util.bounds(n),w=t.datavisualization.Diagram.Rectangle(w.left,w.top,w.right-w.left,w.bottom-w.top),ct={bounds:{x:w.x,y:w.y,width:w.width,height:w.height},offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height},ot=n.pathData,(p.width!=w.width||p.height!=w.height)&&(st=this._raiseEvent("sizeChange",{element:this.diagram.getNode(this.selectedObject),resizeState:this.resizeState,offset:ft,oldValue:ht,newValue:ct,direction:this._resizeDirection})),ot&&n.pathData!=ot&&(n._absoluteBounds=null,n._scaled=!0),st&&st.cancel&&!o&&this.diagram.scale(n,1/v,1/y,d,this.diagram.nameTable),n._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram),this.diagram._updateAssociatedConnectorEnds(n,this.diagram.nameTable);else return!0;this.pseudoGroupConstraints=null},r.prototype._getSwimLaneNode=function(n){var u,t,i,r;if(n&&(u=n.parent,t=this.diagram.nameTable[u],t&&(i=t.parent,i&&(r=this.diagram.nameTable[i],r))))return r},r.prototype._outOfBoundsDrag=function(n,i,r,u){var o;if(!this.diagram._skipoutOfBounds&&n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var f=this._getPageBounds(),c=n.height*r-n.height,l=n.width*i-n.width;if(!this.inAction&&n.isLane){var a=this._getSwimLaneNode(n),e=t.datavisualization.Diagram.Util.bounds(a),s=this._getPadding(n);if(!this.diagram._selectedSymbol&&e.right+l+s.x>f.width||!this.diagram._selectedSymbol&&e.bottom+c+s.y>f.height)return this.updateCursor("not-allowed"),!1}else{var e=t.datavisualization.Diagram.Util.bounds(n),s=this._getPadding(n),h=t.Matrix.identity();if((t.Matrix.rotate(h,-n.rotateAngle,u.x,u.y),t.Matrix.scale(h,i,r,u.x,u.y),t.Matrix.rotate(h,n.rotateAngle,u.x,u.y),o=t.Matrix.transform(h,t.datavisualization.Diagram.Point(n.offsetX,n.offsetY)),!this.diagram._selectedSymbol&&(o.x+(e.width+l)/2+s.x>f.width||o.x-(e.width+l)/2<f.x))||!this.diagram._selectedSymbol&&(o.y+(e.height+c)/2+s.y>f.height||o.y-(e.height+c)/2<f.y))return this.updateCursor("not-allowed"),!1}this.updateCursor(this._resizeDirection)}return!0},r}(i);t.datavisualization.Diagram.ResizeTool=e;o=function(i){function r(n){i.call(this,"endPoint",n);this.cursor="move";this._endPoint=null;this._undoObject=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(r){var u;if(!this.inAction){i.prototype.mousedown.call(this,r);r.ctrlKey&&r.shiftKey&&(u=n(r.target).parents(".ej-d-connector"),u.length>0&&(this.selectedObject=this.diagram.nameTable[u[0].id],this.diagram._hasSelection()&&this.diagram._clearSelection(!0),this.diagram._addSelection(this.selectedObject)));this._initialValue=null;this.diagram.selectionList[0]&&!this.selectedObject&&(this.selectedObject=this.diagram.nameTable[this.diagram.selectionList[0].name]);this.undoObject=this._getClonedObject(this.selectedObject);this._endPoint=r.target.getAttribute("class");this.targetid=r.target.id;this._selectedSegment="";this._nearestNodes=[];var f=this._endPoint=="targetEndPoint"?!0:!1,e=this._endPoint=="sourceEndPoint"?!0:!1,o=this._raiseEndPointDrag(this.selectedObject,f,e,t.datavisualization.Diagram.DragState.Starting)}},r.prototype.mousemove=function(r){var g,c,l,v,y,p,o,e,w,a,k,d,s,h,b;if(i.prototype.mousemove.call(this,r),g=!this.inAction,this.selectedObject&&!(r.ctrlKey&&r.shiftKey)){c=!1;this.selectedObject.segments.length==2&&(c=!0);var u=this.currentPoint.x-this.previousPoint.x,f=this.currentPoint.y-this.previousPoint.y,nt=n.extend(!0,{},this.selectedObject.sourcePoint),tt=n.extend(!0,{},this.selectedObject.targetPoint),it=n.extend(!0,{},this.selectedObject.segments);if(this._outOfBoundsDrag(this.selectedObject,this.currentPoint.x,this.currentPoint.y))if(this.inAction||this.startPoint.x==this.currentPoint.x&&this.startPoint.y==this.currentPoint.y)this.inAction&&(this.selectedSegment&&this._endPoint=="segmentEnd"?(d=this._raiseSegmentEditEvent(t.datavisualization.Diagram.DragState.Dragging),d.cancel||u==0&&f==0||(s=this.currentPoint.x-this.startPoint.x,h=this.currentPoint.y-this.startPoint.y,this._initialValue&&(s=this._initialValue.x+s-this.selectedSegment._endPoint.x,h=this._initialValue.y+h-this.selectedSegment._endPoint.y),u=u*s<0?0:s,f=f*h<0?0:h,this._updateAdjacentSegments(u,f))):this._endPoint!="segmentEnd"&&((this._endPoint=="targetEndPoint"||this._endPoint=="sourceEndPoint")&&this._checkConnectionPossible(r),b=this._updatePoints(this.selectedObject,t.datavisualization.Diagram.DragState.Dragging),b.cancel||(this._disconnect(this.selectedObject),this._updateConnection(this.selectedObject,b.updateSelection))),this.diagram._updateSelectionHandle(!0),this.diagram._updateQuad(this.selectedObject),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram));else{if(this.inAction=!0,this.selectedObject.segments.length>0)for(l=0;l<this.selectedObject.segments.length;l++)this.selectedObject.segments[l]._bridges=[];v=this.diagram._svg.getElementById(this.selectedObject.name+"_hitTest");v&&v.setAttribute("pointer-events","none");y=this.diagram._svg.getElementById(this.selectedObject.name);y&&y.setAttribute("pointer-events","none");p=this.diagram._adornerSvg.getElementById(this.diagram._adornerSvg.document.id+"handle_g");p&&p.setAttribute("pointer-events","none");o=this.targetid.split("_");o.reverse();e=Number(o[0]);this.selectedSegment=this.selectedObject.segments[e];w=this.selectedSegment;this.selectedSegment&&this.selectedSegment.type=="orthogonal"?(a=!1,e===0&&(k=!0),this.selectedSegment.length&&this.selectedSegment.direction?e==0?(this.insertFirstSegment(u,f,o),a=!0):this.nextSegment=this.selectedObject.segments[e+1]:(this._addTerminalSegment(u,f,o),a=!0)):this.nextSegment=this.selectedObject.segments[e+1];a&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,!(c||k||!this.selectedObject.sourcePort),!(c||!(w.length||w.length===0)||!this.selectedObject.targetPort),this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom));this.selectedSegment||this._endPoint!="targetEndPoint"||(this.selectedSegment=this.selectedObject.segments[this.selectedObject.segments.length-1]);this.selectedSegment||this._endPoint!="sourceEndPoint"||(this.selectedSegment=this.selectedObject.segments[0],this.nextSegment=this.selectedObject.segments[1]);this.selectedSegment&&(this._initialValue={x:this.selectedSegment._endPoint.x,y:this.selectedSegment._endPoint.y});this.diagram._updateSelectionHandle(!0);this._raiseSegmentEditEvent(t.datavisualization.Diagram.DragState.Starting)}this.diagram._comparePropertyValues(this.selectedObject,"sourcePoint",{sourcePoint:nt},!0);this.diagram._comparePropertyValues(this.selectedObject,"targetPoint",{targetPoint:tt},!0);this.diagram._comparePropertyValues(this.selectedObject,"segments",{segments:it},!0)}this.previousPoint=this.currentPoint},r.prototype._raiseSegmentEditEvent=function(n){return this._raiseEvent("segmentChange",{element:this.selectedObject,dragState:n,point:this.currentPoint,cancel:!1})},r.prototype._updateAdjacentSegments=function(n,i){var r=this.selectedSegment,u={x:n+r._endPoint.x,y:i+r._endPoint.y},e,f;u=this.snap(u);r.type=="orthogonal"?(r._direction=="left"||r._direction=="right"?(i=u.y-r._endPoint.y,r._startPoint.y+=i,r._endPoint.y=r._startPoint.y):(n=u.x-r._endPoint.x,r._startPoint.x+=n,r._endPoint.x=r._startPoint.x),r.points[0]=r._startPoint,r.points[r.points.length-1]=r._endPoint,e=this.selectedObject.segments.indexOf(this.selectedSegment),f=this.selectedObject.segments[e-1],f&&this.updatePreviousSegment(r,f,n,i)):r.type=="straight"?(r.points[r.points.length-1]=r._endPoint=u,r._point=r.point=u):(r.points[r.points.length-1]=r._endPoint=u,r._point=r.point=u,t.datavisualization.Diagram.Util._updateBezierPoints(r));this.nextSegment&&this.updateNextSegment(r,this.nextSegment,n,i)},r.prototype._addTerminalSegment=function(n,i,r){var u=this.selectedSegment,f,e,o,h,c,s;for(this.selectedObject.segments.pop(),f=this.selectedObject.segments[this.selectedObject.segments.length-1]&&this.selectedObject.segments[this.selectedObject.segments.length-1].type=="orthogonal"?this.selectedObject.segments[this.selectedObject.segments.length-1]:null,e=0;e<u.points.length-2;e++)o=t.datavisualization.Diagram.Segment({type:"orthogonal",length:t.datavisualization.Diagram.Geometry.distance(u.points[e],u.points[e+1]),direction:t.datavisualization.Diagram.Util._getBezierDirection(u.points[e],u.points[e+1])}),o.length==0&&(o._direction=f.direction=="top"||f.direction=="bottom"?o.direction=n>0?"right":"left":o.direction=i>0?"bottom":"top"),f=o,this.selectedObject.segments.push(o);if(h=Number(r[1]),(u.points.length==2||h==u.points.length-2)&&(f&&(f.length+=5,f._length=f.length),h!=0)){var l=t.datavisualization.Diagram.Geometry.distance(u.points[u.points.length-2],u._endPoint),a=t.datavisualization.Diagram.Util._getBezierDirection(u.points[u.points.length-2],u._endPoint),v=t.datavisualization.Diagram.Segment({type:"orthogonal",length:2*l/3,direction:a});this.selectedObject.segments.push(v)}c=t.datavisualization.Diagram.Segment({type:"orthogonal"});this.selectedObject.segments.push(c);s=Number(r[0])+(Number(r[1])||0);this.selectedSegment=this.selectedObject.segments[s];this.nextSegment=this.selectedObject.segments[s+1];s==this.selectedObject.segments.length-2?this.nextSegment._direction=Number(r[0])==0?t.datavisualization.Diagram.Util._getBezierDirection(u.points[u.points.length-2],u._endPoint):u._direction:c._direction=t.datavisualization.Diagram.Util._getBezierDirection(u.points[u.points.length-2],u._endPoint);s==0&&this.insertFirstSegment(n,i,r)},r.prototype.insertFirstSegment=function(n,i,r){var u=this.selectedSegment,c,e,o,f,h,l,s,a;if(this.selectedObject.sourcePort&&u.length&&this.selectedObject.segments[0].points.length>2){for(this.selectedObject.segments.splice(0,1),f=[],e=0;e<u.points.length-1;e++)o=t.datavisualization.Diagram.Segment({type:"orthogonal",length:t.datavisualization.Diagram.Geometry.distance(u.points[e],u.points[e+1]),direction:t.datavisualization.Diagram.Util._getBezierDirection(u.points[e],u.points[e+1])}),o.length==0&&(o._direction=c&&(c.direction=="top"||c.direction=="bottom")?o.direction=n>0?"right":"left":o.direction=i>0?"bottom":"top"),c=o,f.push(o);this.selectedObject.segments=f.concat(this.selectedObject.segments);this.selectedSegment=this.selectedObject.segments[Number(r[1])];this.nextSegment=this.selectedObject.segments[Number(r[1])+1]}else u=this.selectedObject.segments[0],f=[],f.push(t.datavisualization.Diagram.Segment({type:"orthogonal",direction:u.direction,length:u.length/3})),u.direction=="bottom"||u.direction=="top"?(h=Math.max(5,Math.abs(n)),l=n>0?"right":"left"):(h=Math.max(5,Math.abs(i)),l=i>0?"bottom":"top"),f.push(t.datavisualization.Diagram.Segment({type:"orthogonal",direction:l,length:h})),s=this.selectedObject.segments[1],s&&s.length&&(l!=s.direction&&(h*=-1),s.length-=h,s._length=s.length),u.length=u._length=2*u._length/3,this.selectedObject.segments=f.concat(this.selectedObject.segments),a=Number(r[0])+Number(r[1]),this.selectedSegment=this.selectedObject.segments[2],this.nextSegment=this.selectedObject.segments[3]},r.prototype.updatePreviousSegment=function(n,i,r,u){i._endPoint=i.points[i.points.length-1]=n._startPoint;i.type=="orthogonal"?(i.direction=="bottom"?(i.length+=u,i.length<0&&(i._direction=i.direction="top",i.length*=-1)):i.direction=="top"?(i.length-=u,i.length<0&&(i._direction=i.direction="bottom",i.length*=-1)):i.direction=="right"?(i.length+=r,i.length<0&&(i._direction=i.direction="left",i.length*=-1)):i.direction=="left"&&(i.length-=r,i.length<0&&(i._direction=i.direction="right",i.length*=-1)),i._length=i.length):i.type=="bezier"&&t.datavisualization.Diagram.Util._updateBezierPoints(i)},r.prototype.updateNextSegment=function(n,i,r,u){var o=n._endPoint,e,f;i._startPoint=i.points[0]=this.selectedSegment._endPoint;i&&(i.type=="orthogonal"?(i.length||i.length===0)&&(i._direction=="left"||i._direction=="right"?(r!=0&&(i._direction=="right"?i._length-=r:i._length+=r,(i.length||i.length===0)&&(i.length=i._length,i.length<0&&(i.direction=="left"?i.direction="right":i.direction=="right"&&(i.direction="left"),i.length*=-1,i._direction=i.direction,i._length=i.length))),u!=0&&n.type!="orthogonal"&&(i._startPoint.y=i.points[0].y=i._endPoint.y=i.points[i.points.length-1].y=o.y,e=this.selectedObject.segments.indexOf(i),f=this.selectedObject.segments[e+1],f._startPoint.y=f.points[0].y=i._endPoint.y,f.length&&(f.direction=="bottom"?(f.length-=u,f.length<0&&(f.direction="top",f.length*=-1)):(f.length+=u,f.length<0&&(f.direction="bottom",f.length*=-1))))):(u!=0&&(i._direction=="bottom"?i._length-=u:i._length+=u,(i.length||i.length===0)&&(i.length=i._length,i.length<0&&(i.direction=="top"?i.direction="bottom":i.direction=="bottom"&&(i.direction="top"),i.length*=-1,i._length=i.length,i._direction=i.direction))),r!=0&&n.type!="orthogonal"&&(i._startPoint.x=i.points[0].x=i._endPoint.x=i.points[i.points.length-1].x=o.x,e=this.selectedObject.segments.indexOf(i),f=this.selectedObject.segments[e+1],f.length&&(f.direction=="right"?(f.length+=r,f.length<0&&(f.direction="left",f.length*=-1)):(f.length-=r,f.length<0&&(f.direction="right",f.length*=-1)))))):i.type=="bezier"&&t.datavisualization.Diagram.Util._updateBezierPoints(i))},r.prototype.mouseup=function(n){var c,u,h,l,a,e;if(n.shiftKey&&n.ctrlKey)this._addOrRemoveStraightSegments(n);else if(this.inAction){if(this.inAction=!1,this._endPoint=="segmentEnd"&&this.selectedSegment.type=="orthogonal"){if(h=this._raiseSegmentEditEvent(t.datavisualization.Diagram.DragState.Completed),!h.cancel){var f=this.selectedObject.segments.indexOf(this.selectedSegment),o=this.selectedObject.segments[f-1],r=this.selectedObject.segments[f+1],s=!1;o&&o.type=="orthogonal"&&Math.abs(o.length)<5?f!=1&&(s=this._removePrevSegment(f)):r&&r.type=="orthogonal"&&(c=r.length||r.length===0?r.length:t.datavisualization.Diagram.Geometry.distance(r.points[0],r.points[1]),Math.abs(c<=5)&&(s=this._removeNextSegment(f)));s&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom))}}else this._endPoint!="segmentEnd"&&(u=this._updatePoints(this.selectedObject,t.datavisualization.Diagram.DragState.Completed),this.diagram.nameTable[this.selectedObject.name]||(this.selectedObject=null),this.selectedObject&&(u.cancel?u&&u.cancel&&u.eventType&&(u.eventType==="connectorSourceChange"&&(this.undoObject.sourceNode?(this.selectedObject.sourceNode=this.undoObject.sourceNode,this.diagram.nameTable[this.undoObject.sourceNode].outEdges.push(this.selectedObject.name),this.selectedObject.sourcePort=this.undoObject.sourcePort):this.undoObject.sourceNode==null&&this.selectedObject.sourceNode?(this.selectedObject.sourceNode=this.undoObject.sourceNode,this.selectedObject.sourcePort=this.undoObject.sourcePort,this.selectedObject.sourcePoint=this.undoObject.sourcePoint,this.selectedObject.segments=this.undoObject.segments):(this.selectedObject.sourcePoint=this.undoObject.sourcePoint,this.selectedObject.segments=this.undoObject.segments)),u.eventType==="connectorTargetChange"&&(this.undoObject.targetNode?(this.selectedObject.targetNode=this.undoObject.targetNode,this.diagram.nameTable[this.undoObject.targetNode].inEdges.push(this.selectedObject.name),this.selectedObject.targetPort=this.undoObject.targetPort):this.undoObject.targetNode==null&&this.selectedObject.targetNode?(this.selectedObject.targetNode=this.undoObject.targetNode,this.selectedObject.targetPort=this.undoObject.targetPort,this.selectedObject.targetPoint=this.undoObject.targetPoint,this.selectedObject.segments=this.undoObject.segments):(this.selectedObject.segments=this.undoObject.segments,this.selectedObject.targetPoint=this.undoObject.targetPoint))):(this._disconnect(this.selectedObject),this._currentPossibleConnection&&!this.inAction?this._updateConnection(this.selectedObject):(this.selectedObject.sourceNode||this.selectedObject.targetNode)&&this._updateConnection(this.selectedObject),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram))));this.selectedObject&&(this.selectedObject.annotation&&(l=this.diagram.nameTable[this.selectedObject.targetNode],t.datavisualization.Diagram.DefautShapes.updateBPMNAnnotationShape(this.selectedObject,this.undoObject.targetNode,l,this.diagram)),this.diagram._dock(this.selectedObject,this.diagram.nameTable,!0),t.datavisualization.Diagram.Util.updateBridging(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext.update(this.selectedObject,this.diagram),this.diagram._updateConnectorBridging(this.selectedObject),this.diagram._updateQuad(this.selectedObject),this.diagram._updateSelectionHandle(),this.selectedObject.annotation&&t.datavisualization.Diagram.DefautShapes.updateAnnotationProperties(this.selectedObject,this.diagram),this.selectedObject&&(this.diagram._svg.getElementById(this.selectedObject.name+"_hitTest").setAttribute("pointer-events","stroke"),this.diagram._svg.getElementById(this.selectedObject.name).setAttribute("pointer-events","auto")),this.diagram._adornerSvg.getElementById(this.diagram._adornerSvg.document.id+"handle_g").setAttribute("pointer-events","visible"),this._initialValue=null)}if(this.selectedObject)for(a={type:"endpointchanged",undoObject:this.undoObject,redoObject:this._getClonedObject(this.selectedObject),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"},this.diagram.addHistoryEntry(a),e=0;e<this._nearestNodes.length;e++)this._showPort(this._nearestNodes[e],!0);delete this._nearestNodes;i.prototype.mouseup.call(this,n)},r.prototype._addOrRemoveStraightSegments=function(n){var s,e,r,f,i,u;if(this._endPoint=="segmentEnd")s=n.target.id,e=s.split("_"),e.reverse(),r=Number(e[0]),i=this.selectedObject.segments[r],i&&i.type=="straight"&&(f=this.selectedObject.segments[r+1],f&&(this.selectedObject.segments.splice(r,1),f._startPoint=f.points[0]=i._startPoint,o=!0));else{var h=n.target.getAttribute("class"),s=n.target.id,o=!1,r=this._findIndex();this.selectedObject.segments&&this.selectedObject.segments[r]&&this.selectedObject.segments[r].type=="straight"&&(i=this.selectedObject.segments[r],u=t.datavisualization.Diagram.Segment({type:"straight",_point:i._endPoint}),this.selectedObject.segments.splice(r+1,0,u),r+1!=this.selectedObject.segments.length-1&&(u.point=u._point),i._point=i.point=i.points[1]=i._endPoint=this.currentPoint,u.points[0]=u._startPoint=this.currentPoint,u.points[1]=u._endPoint=u._point,o=!0)}o&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.Util.updateBridging(this.selectedObject,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom))},r.prototype._findIndex=function(){for(var n,o,e,s,h,u,c,l,f,r=[],i=0;i<this.selectedObject.segments.length;i++)n=this.selectedObject.segments[i],o={x:Math.min(n._startPoint.x,n._endPoint.x),y:Math.min(n._startPoint.y,n._endPoint.y),width:Math.abs(n._startPoint.x-n._endPoint.x),height:Math.abs(n._startPoint.y-n._endPoint.y)},t.datavisualization.Diagram.Geometry.inflate(o,this.selectedObject.lineHitPadding/2,this.selectedObject.lineHitPadding/2),t.datavisualization.Diagram.Geometry.containsPoint(o,this.currentPoint)&&r.push(n);if(r.length==1)return this.selectedObject.segments.indexOf(r[0]);for(i=0;i<r.length;i++)u=r[i],f=this.currentPoint,c=(f.y-u._startPoint.y)/(u._endPoint.y-f.y),l=(f.x-u._startPoint.x)/(u._endPoint.x-f.x),e=Math.abs(c-l),i==0&&(s=e,h=0),e<s&&(s=e,h=i);return this.selectedObject.segments.indexOf(r[h])},r.prototype._removeNextSegment=function(n){var i=this.selectedObject.segments[n-1],r=this.selectedObject.segments[n+2],u=this.selectedObject.segments[n+1];return u.length||u.length===0?(this.selectedObject.segments.splice(n,2),this.selectedSegment.direction=="top"||this.selectedSegment.direction=="bottom"?(r._startPoint.y=this.selectedSegment._startPoint.y,i._endPoint.x=r._startPoint.x):(r._startPoint.x=this.selectedSegment._startPoint.x,i._endPoint.y=r._startPoint.y)):(this.selectedObject.segments.splice(n+1,1),this.selectedSegment.direction=="top"||this.selectedSegment.direction=="bottom"?i._endPoint.x=u._endPoint.x:i._endPoint.y=u._endPoint.y,i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i.length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,i._endPoint)),this.selectedSegment.length=this.selectedSegment._length=this.selectedSegment.direction=null),i&&r&&(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,r._startPoint),i.length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,r._startPoint)),(r.length||r.length===0)&&(r._length=r.length=t.datavisualization.Diagram.Geometry.distance(i._endPoint,r._endPoint),r.length&&(r._direction=r.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._endPoint,r._endPoint)))),!0},r.prototype._removePrevSegment=function(n){var i=this.selectedObject.segments[n-2],f=this.selectedObject.segments[n+1],o=f.length||f.length===0?f.length:t.datavisualization.Diagram.Geometry.distance(f.points[0],f.points[1]),r,u,e;return o<=5?(r=this.selectedObject.segments[n+2],f.length===o?this.selectedObject.segments.splice(n-1,4):this.selectedObject.segments.splice(n-1,3),r?(i.direction=="top"||i.direction=="bottom"?(i._endPoint.y=r._endPoint.y,r._startPoint.x=i._endPoint.x):(i._endPoint.x=r._endPoint.x,r._startPoint.y=i._endPoint.y),(i.length||i.length===0)&&(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i.length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,i._endPoint))),(r.length||r.length===0)&&(r._length=r.length=t.datavisualization.Diagram.Geometry.distance(r._startPoint,r._endPoint),r._length&&(r._direction=r.direction=t.datavisualization.Diagram.Util._getBezierDirection(r._startPoint,r._endPoint)))):(i._endPoint=this.selectedObject.endPoint,i.direction=i.length=i._length=null,i._direction=f._direction)):(u=this.selectedObject.segments[n+1],this.selectedObject.segments.splice(n-1,2),e=this.selectedSegment,e.direction=="left"||e.direction=="right"?(i._endPoint.x=u._startPoint.x,u._startPoint.y=i._endPoint.y):(i._endPoint.y=u._startPoint.y,u._startPoint.x=i._endPoint.x),(this.selectedSegment.length||this.selectedSegment.length===0)&&(i._length=i.length=t.datavisualization.Diagram.Geometry.distance(i._startPoint,i._endPoint),i._length&&(i._direction=i.direction=t.datavisualization.Diagram.Util._getBezierDirection(i._startPoint,i._endPoint))),(u.length||u.length===0)&&(u._length=u.length=t.datavisualization.Diagram.Geometry.distance(u._startPoint,u._endPoint),u.length&&(u._direction=u.direction=t.datavisualization.Diagram.Util._getBezierDirection(u._startPoint,u._endPoint)))),!0},r.prototype._getClonedObject=function(t){if(t){var i=n.extend(!0,{},t);return i.targetNode=t.targetNode,i.sourceNode=t.sourceNode,i.targetPort=t.targetPort,i.sourcePort=t.sourcePort,i}},r.prototype._updateConnection=function(n,i){var r,u;this._endPoint=="targetEndPoint"?(this._currentPossibleConnection?this._possibleConnectionPort&&t.datavisualization.Diagram.Util.canConnect(this._possibleConnectionPort,!0)?(n.targetNode!=this._currentPossibleConnection.name||n.targetPort!=this._possibleConnectionPort.name)&&(r=this._raiseConnectionChangeEvent(n,!0)):t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection)&&(n.targetNode!=this._currentPossibleConnection.name||n.targetPort)&&(r=this._raiseConnectionChangeEvent(n,!0)):this.selectedObject.targetNode&&(r=this._raiseConnectionChangeEvent(n,!0)),r&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),(n.segments.length>2||n.segments[0].points.length==2)&&t.datavisualization.Diagram.Util._updatePreviousSegment(n),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom))):this._endPoint=="sourceEndPoint"&&(this._currentPossibleConnection?this._possibleConnectionPort&&t.datavisualization.Diagram.Util.canConnect(this._possibleConnectionPort,!0)?(n.sourceNode!=this._currentPossibleConnection.name||n.sourcePort!=this._possibleConnectionPort.name)&&(r=this._raiseConnectionChangeEvent(n)):t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection)&&(n.sourceNode!=this._currentPossibleConnection.name||n.sourcePort)&&(r=this._raiseConnectionChangeEvent(n)):(this.selectedObject.sourceNode&&(r=this._raiseConnectionChangeEvent(n),t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram)),r&&t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom)));u=this.selectedSegment._endPoint;this.diagram._dock(n,this.diagram.nameTable,i);r&&this._endPoint=="sourceEndPoint"&&this.selectedObject.segments.length>1&&(this.selectedSegment.points.length==2&&!this.selectedObject.sourcePort&&this.selectedSegment.length?(this.selectedSegment.direction=="right"||this.selectedSegment.direction=="left"?(this.selectedSegment.direction=this.selectedSegment._startPoint.x<u.x?this.selectedSegment._direction="right":this.selectedSegment._direction="left",this.selectedSegment.length=this.selectedSegment._length=Math.abs(this.selectedSegment._startPoint.x-u.x)):(this.selectedSegment.direction=this.selectedSegment._startPoint.y<u.y?this.selectedSegment._direction="bottom":this.selectedSegment._direction="top",this.selectedSegment.length=this.selectedSegment._length=Math.abs(this.selectedSegment._startPoint.y-u.y)),t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom)):r&&(t.datavisualization.Diagram.Util._updateConnectorSegments(this.selectedObject,this.selectedObject.sourcePort,this.selectedObject.targetPort,this.diagram),t.datavisualization.Diagram.DiagramContext._refreshSegments(this.selectedObject,this.diagram),t.datavisualization.Diagram.SvgContext._refreshEndPointHandles(this.diagram.selectionList[0],this.diagram._adornerSvg,this.diagram._currZoom)))},r.prototype._raiseConnectionChangeEvent=function(n,i){var u=this._raiseEvent("connectionChange",{element:this.selectedObject,endPoint:this._endPoint,connection:this._currentPossibleConnection,port:this._possibleConnectionPort,cancel:!1}),r;if(!u.cancel)return i?(this._currentPossibleConnection&&n.targetNode==this._currentPossibleConnection.name||(this._currentPossibleConnection&&this._currentPossibleConnection.inEdges.push(n.name),n.targetNode&&(r=this.diagram.nameTable[this.selectedObject.targetNode],r&&t.datavisualization.Diagram.Util.removeItem(r.inEdges,n.name))),this.diagram._comparePropertyValues(n,"targetNode",{targetNode:this._currentPossibleConnection?this._currentPossibleConnection.name:null},!0),n.targetNode=this._currentPossibleConnection?this._currentPossibleConnection.name:null,this.diagram._comparePropertyValues(n,"targetPort",{targetPort:this._possibleConnectionPort?this._possibleConnectionPort.name:null},!0),n.targetPort=this._possibleConnectionPort?this._possibleConnectionPort.name:null):(this._currentPossibleConnection&&n.sourceNode==this._currentPossibleConnection.name||(this._currentPossibleConnection&&this._currentPossibleConnection.outEdges.push(n.name),n.sourceNode&&(r=this.diagram.nameTable[this.selectedObject.sourceNode],r&&t.datavisualization.Diagram.Util.removeItem(r.outEdges,n.name))),this.diagram._comparePropertyValues(n,"sourceNode",{sourceNode:this._currentPossibleConnection?this._currentPossibleConnection.name:null},!0),n.sourceNode=this._currentPossibleConnection?this._currentPossibleConnection.name:null,this.diagram._comparePropertyValues(n,"sourcePort",{sourcePort:this._possibleConnectionPort?this._possibleConnectionPort.name:null},!0),n.sourcePort=this._possibleConnectionPort?this._possibleConnectionPort.name:null),!0},r.prototype._disconnect=function(){},r.prototype._endAction=function(){this._showPorts();var n;this._currentPossibleConnection&&!this._possibleConnectionPort&&(n=this._currentPossibleConnection);i.prototype._endAction.apply(this);this._endPoint&&(this._endPoint=null,n&&(this.diagram._checkToolToActivate(n,this.currentPoint),this.diagram._updateCursor()))},r.prototype._outOfBoundsDrag=function(n,i,r){if(i=i?i:0,r=r?r:0,n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var u=this._getPageBounds();if(!this.diagram._selectedSymbol&&(i>=u.width||i<=u.x)||!this.diagram._selectedSymbol&&(r>=u.height||r<=u.y))return this.updateCursor("not-allowed"),!1}else if(!t.datavisualization.Diagram.bpmnHelper.canMoveOutofBounds(this.diagram,n,i,r))return this.updateCursor("not-allowed"),!1;return this.updateCursor(this.cursor),!0},r.prototype._updatePoints=function(n,i){var h=!1,w="",f,c,e,y,r,b,l,a,p,u,o,s,v,k;if(this._endPoint&&this._endPoint!="segmentEnd"&&this.selectedSegment&&(f=this._endPoint=="targetEndPoint"?!0:!1,c=this._endPoint=="sourceEndPoint"?!0:!1,this._endPoint)){y=this._endPoint.match("bezierpoint1")?"bezierpoint1":this._endPoint.match("bezierpoint2")?"bezierpoint2":this._endPoint;switch(y){case"targetEndPoint":e=this.selectedSegment._endPoint;break;case"sourceEndPoint":e=this.selectedSegment._startPoint;break;case"bezierpoint1":e=this.selectedSegment._point1;break;case"bezierpoint2":e=this.selectedSegment._point2}if(r=this.currentPoint,this._possibleConnectionPort==null&&(r=this.snap(r)),b=t.datavisualization.Diagram.Point(e.x-r.x,e.y-r.y),l=this._raiseEndPointDrag(n,f,c,i),l&&(h=l.cancel,w=l.type),!t.datavisualization.Diagram.Geometry.isEmptyPoint(b)&&!h)if(f||c){if(a=this._currentPossibleConnection?t.datavisualization.Diagram.Util.canConnect(this._currentPossibleConnection,!1):!1,this._outOfBoundsDrag(this.selectedObject,r.x,r.y,f)&&(this.selectedObject.segments.length>1&&(f||a||this.selectedSegment.type!="orthogonal"||!this.selectedSegment.length&&this.selectedSegment.length!==0?f&&!a&&this.selectedSegment.type=="orthogonal"&&this.selectedSegment.points.length==2&&(o=r.x-this.selectedSegment._endPoint.x,s=r.y-this.selectedSegment._endPoint.y,this.selectedSegment._direction=="left"||this.selectedSegment._direction=="right"?(this.selectedSegment._startPoint.y=this.selectedSegment.points[0].y+=s,this.selectedSegment._endPoint.y=this.selectedSegment.points[1].y=this.selectedSegment._startPoint.y):(this.selectedSegment._startPoint.x=this.selectedSegment.points[0].x+=o,this.selectedSegment._endPoint.x=this.selectedSegment.points[1].x=this.selectedSegment._startPoint.x),v=this.selectedObject.segments.length-1,this.selectedObject.segments[v-1]&&this.updatePreviousSegment(this.selectedObject.segments[v],this.selectedObject.segments[v-1],o,s)):(this.selectedObject.sourcePoint=r,o=r.x-this.selectedSegment._startPoint.x,s=r.y-this.selectedSegment._startPoint.y,this.selectedSegment.direction=="left"||this.selectedSegment.direction=="right"?this.selectedSegment._endPoint.y=this.selectedSegment.points[this.selectedSegment.points.length-1].y=r.y:this.selectedSegment._endPoint.x=this.selectedSegment.points[this.selectedSegment.points.length-1].x=r.x,this.selectedSegment._startPoint=this.selectedSegment.points[0]=r,this.selectedSegment._length=this.selectedSegment.length=t.datavisualization.Diagram.Geometry.distance(r,this.selectedSegment._endPoint),this.selectedSegment._length&&(this.selectedSegment._direction=this.selectedSegment.direction=t.datavisualization.Diagram.Util._getBezierDirection(r,this.selectedSegment._endPoint)),this.updateNextSegment(this.selectedObject.segments[0],this.selectedObject.segments[1],o,s),u=this.selectedObject.segments[1],p=!1,u&&u.length&&(u.length=u._length=t.datavisualization.Diagram.Geometry.distance(this.selectedSegment._endPoint,u._endPoint),u.length&&(u.direction=u._direction=t.datavisualization.Diagram.Util._getBezierDirection(this.selectedSegment._endPoint,u._endPoint))),this.selectedSegment.length==0||u.length===0?(u.length==0&&this.selectedObject.segments.length>2?this.selectedObject.segments.splice(0,2):this.selectedObject.segments.length>1&&this.selectedObject.segments.splice(0,1),this.selectedSegment=this.selectedObject.segments[0],this.selectedSegment._startPoint=this.selectedSegment.points[0]=r,this.selectedSegment._direction=="left"||this.selectedSegment._direction=="right"?this.selectedSegment._endPoint.y=this.selectedSegment.points[this.selectedSegment.points.length-1].y=r.y:this.selectedSegment._endPoint.x=this.selectedSegment.points[this.selectedSegment.points.length-1].x=r.x,u=this.selectedObject.segments[1],this.selectedObject.segments.length>1?(this.selectedSegment._length=this.selectedSegment.length=t.datavisualization.Diagram.Geometry.distance(r,u._startPoint),t.datavisualization.Diagram.Util._addOrthogonalPoints(this.selectedSegment,null,n.segments[1],n.sourcePoint,n.targetPoint),t.datavisualization.Diagram.Util._addOrthogonalPoints(n.segments[1],n.segments[0],n.segments[2],n.sourcePoint,n.targetPoint),u._startPoint=u.points[0]=n.segments[0]._endPoint):t.datavisualization.Diagram.Util._addOrthogonalPoints(this.selectedSegment,null,n.segments[1],n.sourcePoint,n.targetPoint),p=!0):t.datavisualization.Diagram.Util._addOrthogonalPoints(this.selectedSegment,null,n.segments[1],n.sourcePoint,n.targetPoint),u&&u.length&&(u.length=u._length=t.datavisualization.Diagram.Geometry.distance(this.selectedSegment._endPoint,u._endPoint),u.length&&(u.direction=u._direction=t.datavisualization.Diagram.Util._getBezierDirection(this.selectedSegment._endPoint,u._endPoint))))),(c||f)&&!a&&(k=this.selectedSegment.points.length,this.diagram._setEndPoint(n,t.datavisualization.Diagram.Point(r.x,r.y),f),k!=this.selectedSegment.points.length||p)))return{updateSelection:!0,cancel:h}}else t.datavisualization.Diagram.Util._setBezierPoint(this.selectedSegment,t.datavisualization.Diagram.Point(r.x,r.y),y)}return{cancel:h,eventType:w}},r}(i);t.datavisualization.Diagram.ConnectionEditTool=o;s=function(i){function r(n){i.call(this,"shapeTool",n);this.cursor="crosshair";this._drawingPolygon=!1;this._points=[]}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){if(i.prototype.mousedown.call(this,n),this._drawingPolygon){var t=this.helper.points[this.helper.points.length-1];t={x:t.x,y:t.y};this.helper.points.push(t);this._points.push(this.snap(this.currentPoint))}else this.selectedObject=this.createNode(),this.selectedObject.type=="bpmn"&&this.diagram._initGroupNode(this.selectedObject),this.selectedObject._type="node";this._prevPoint=this.currentPoint},r.prototype.createNode=function(){var n=this.diagram._getNewNode(this.diagram.model.drawType),i,r;return n.name=this.diagram.model.drawType.name?this.diagram.model.drawType.name+t.datavisualization.Diagram.Util.randomId():"node"+t.datavisualization.Diagram.Util.randomId(),i=this.snap(this.currentPoint),n.offsetX=i.x,n.offsetY=i.y,n.width=5,n.height=5,n.type!="text"&&(n.shape=this.diagram.model.drawType.shape?this.diagram.model.drawType.shape:n.shape),this.diagram.model.drawType.shape!="polygon"||this.diagram.model.drawType.points&&this.diagram.model.drawType.points.length||(this._drawingPolygon=!0,r=this.snap(this.startPoint),n.points=[{x:r.x,y:r.y},{x:i.x,y:i.y}],this._points=[{x:r.x,y:r.y},{x:i.x,y:i.y}]),t.datavisualization.Diagram.NodeType(n,this.diagram)},r.prototype.mousemove=function(n){if(i.prototype.mousemove.call(this,n),this.selectedObject)if(this.inAction)this._updateHelper();else{if(this.inAction=!0,this.selectedObject.shape==="polygon"&&(!this.diagram.model.drawType.points||!this.diagram.model.drawType.points.length)&&(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y)){var t=this.snap(this.startPoint),r=this.snap(this.currentPoint);this.selectedObject.points=[{x:t.x,y:t.y},{x:r.x,y:r.y}];this._points=[{x:t.x,y:t.y},{x:r.x,y:r.y}]}this._initHelper();this._renderHelper()}this.previousPoint=this.currentPoint},r.prototype.mouseup=function(n){this._drawingPolygon&&n.button!=2&&this.diagram._getEventDetail(n)!=2||(this.inAction&&(this.inAction=!1,this._drawingPolygon&&(this.selectedObject.points=this.helper.points),this._updateSize(this.selectedObject,this.startPoint,this.currentPoint),this.diagram.add(this.selectedObject)),this.diagram._toolToActivate="selectTool",this.diagram._drawingTool=!1,i.prototype.mouseup.call(this,n),this._drawingPolygon&&(this.diagram._disableDefaultContextMenu=!0,delete this._drawingPolygon,delete this._points))},r.prototype._renderHelper=function(){this.svgHelper||(this.helper.type!="bpmn"?this.svgHelper=t.datavisualization.Diagram.SvgContext.renderNode(this.helper,this.diagram._svg,this.diagram._diagramLayer,undefined,this.diagram):(this.helper._type="group",this.diagram._initGroupNode(this.helper),this.svgHelper=t.datavisualization.Diagram.SvgContext.renderGroup(this.helper,this.diagram._svg,this.diagram._diagramLayer,this.diagram.nameTable,this.diagram)),this.svgHelper=document.getElementById(this.helper.name),this.svgHelper.setAttribute("pointer-events","none"))},r.prototype._updateHelper=function(){var i;if(this._drawingPolygon){var u=this.snap(this.currentPoint),f=this.snap(this.previousPoint),r={x:u.x-f.x,y:u.y-f.y};this.helper.points[this.helper.points.length-1].x+=r.x;this.helper.points[this.helper.points.length-1].y+=r.y;this._points[this._points.length-1].x+=r.x;this._points[this._points.length-1].y+=r.y}i=n.extend(!0,{},this.helper);this._updateSize(this.helper,this.snap(this.startPoint),this.snap(this.currentPoint));this.diagram._comparePropertyValues(this.helper,"height",{height:i.height},!0);this.diagram._comparePropertyValues(this.helper,"width",{width:i.width},!0);this.diagram._comparePropertyValues(this.helper,"offsetX",{offsetX:i.offsetX},!0);this.diagram._comparePropertyValues(this.helper,"offsetY",{offsetY:i.offsetY},!0);this.helper.shape!="polygon"||this._drawingPolygon||(this.helper.width=this.helper.width!=0?this.helper.width:5,this.helper.height=this.helper.height!=0?this.helper.height:5);t.datavisualization.Diagram.SvgContext.update(this.helper,this.diagram)},r.prototype._updateSize=function(n,i,r){var o=this._drawingPolygon?this._points:[i,r],f=t.datavisualization.Diagram.Geometry.rect(o),u={width:f.width,height:f.height},e={x:f.x,y:f.y};t.datavisualization.Diagram.Geometry.isEmptySize(u)||(this.helper.type!="bpmn"?(n.offsetX=e.x+u.width/2,n.offsetY=e.y+u.height/2,n.width=u.width,n.height=u.height,n._shape==="path"&&(n._scaled=!0)):(n._type="group",this.diagram._translate(n,e.x+u.width/2-n.offsetX,e.y+u.height/2-n.offsetY,this.diagram.nameTable),this.diagram.scale(n,u.width/this.helper.width,u.height/this.helper.height,new t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),this.diagram.nameTable),t.datavisualization.Diagram.Util._updateGroupBounds(n,this.diagram)))},r}(i);t.datavisualization.Diagram.ShapeTool=s;r=function(i){function r(n,t){i.call(this,n,t);this.cursor="crosshair";this._isMouseDown=!1;this._targetPossibleConnection=null;this._sourcePossibleConnection=null;this._targetPort=null;this._sourcePort=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){if(i.prototype.mousedown.call(this,n),t.datavisualization.Diagram.Util.isPageEditable(this.diagram)){if(this._isMouseDown=!0,this.diagram._hasSelection()&&this.diagram._clearSelection(),n&&n.type==="touchstart"&&(this._currentPossibleConnection=this.diagram._findConnectableNodeUnderMouse(n),this._currentPossibleConnection)){var r=this.mousePosition(n);this._possibleConnectionPort=this.diagram._findPortAtPoint(r,this._currentPossibleConnection)}this._currentPossibleConnection&&(this._sourcePossibleConnection=this._currentPossibleConnection,this._sourcePort=this._possibleConnectionPort);this._raiseEndPointDrag(this.helper,!0,!1,t.datavisualization.Diagram.DragState.Starting)}},r.prototype.mousemove=function(r){if(i.prototype.mousemove.call(this,r),this._checkConnectionPossible(r),this._isMouseDown)if(this.inAction){if(this._targetPossibleConnection=this._currentPossibleConnection,this._targetPort=this._possibleConnectionPort,this.helper){var f=this._raiseEndPointDrag(this.helper,!0,!1,t.datavisualization.Diagram.DragState.Dragging),u=n.extend(!0,{},this.helper);f.cancel||this._updateHelper();this.diagram._comparePropertyValues(this.helper,"sourcePoint",{sourcePoint:u.sourcePoint},!0);this.diagram._comparePropertyValues(this.helper,"targetPoint",{targetPoint:u.targetPoint},!0);this.diagram._comparePropertyValues(this.helper,"segments",{segments:u.segments},!0);this.diagram._comparePropertyValues(this.helper,"targetNode",{targetNode:this._targetPossibleConnection},!0);this.diagram._comparePropertyValues(this.helper,"targetPort",{targetPort:this._targetPort},!0)}}else this.inAction=!0,this._initHelper(),this._renderHelper();this.previousPoint=this.currentPoint},r.prototype.mouseup=function(n){var r,u,f,s;if(this._isMouseDown=!1,this.inAction){this.inAction=!1;var e=this._getStartPoint(),o=this._getCurrentPoint(),h=t.datavisualization.Diagram.Geometry.distance(e,o);this._outOfBoundsDrag(this.helper,o.x,o.y)&&this._outOfBoundsDrag(this.helper,e.x,e.y)&&h>0&&(r=this.createConnector(e,o),r.name="connector"+t.datavisualization.Diagram.Util.randomId(),this._sourcePossibleConnection&&(this._sourcePort&&t.datavisualization.Diagram.Util.canConnect(this._sourcePort,!0)?(u=this._raiseEvent("connectionChange",{element:r,connection:this._sourcePossibleConnection,port:this._sourcePort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._sourcePossibleConnection.outEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.sourceNode=this._sourcePossibleConnection.name,r.sourcePort=this._sourcePort.name)):t.datavisualization.Diagram.Util.canConnect(this._sourcePossibleConnection)&&(u=this._raiseEvent("connectionChange",{element:r,connection:this._sourcePossibleConnection,port:this._sourcePort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._sourcePossibleConnection.outEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.sourceNode=this._sourcePossibleConnection.name))),this._targetPossibleConnection&&(this._targetPort&&t.datavisualization.Diagram.Util.canConnect(this._targetPort,!0)?(u=this._raiseEvent("connectionChange",{element:r,connection:this._targetPossibleConnection,port:this._targetPort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._targetPossibleConnection.inEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.targetNode=this._targetPossibleConnection.name,r.targetPort=this._targetPort.name)):t.datavisualization.Diagram.Util.canConnect(this._targetPossibleConnection)&&(u=this._raiseEvent("connectionChange",{element:r,connection:this._targetPossibleConnection,port:this._targetPort,cancel:!1}),t.datavisualization.Diagram.Util.removeItem(this._targetPossibleConnection.inEdges,this.helper.name),f=this._raiseEndPointDrag(r,!0,!1,t.datavisualization.Diagram.DragState.Completed),u.cancel||f.cancel||(r.targetNode=this._targetPossibleConnection.name))),s=this.diagram.add(r),s&&(r=this.diagram.nameTable[r.name],t.datavisualization.Diagram.Util.updateBridging(r,this.diagram),t.datavisualization.Diagram.SvgContext.update(r,this.diagram),this.diagram._updateConnectorBridging(r)))}this.singleAction&&this.diagram.deactivateTool();this._prevTool&&(this._prevTool.inAction=!1);this._showPorts();i.prototype.mouseup.call(this,n)},r.prototype._getStartPoint=function(){return this._sourcePossibleConnection&&this._sourcePort?t.datavisualization.Diagram.Util._getPortPosition(this._sourcePort,t.datavisualization.Diagram.Util.bounds(this._sourcePossibleConnection)):this.snap(this.startPoint)},r.prototype._getCurrentPoint=function(){return this._targetPossibleConnection&&this._targetPort?t.datavisualization.Diagram.Util._getPortPosition(this._targetPort,t.datavisualization.Diagram.Util.bounds(this._targetPossibleConnection)):this.snap(this.currentPoint)},r.prototype._initHelper=function(){this.helper=this.createConnector(t.datavisualization.Diagram.Point(0,0),t.datavisualization.Diagram.Point(0,0));this.diagram._setZorder(this.helper);this.helper.name="helper";this.helper._connectorType="helper"},r.prototype.createConnector=function(){return null},r.prototype._renderHelper=function(){this.svgHelper||(this.svgHelper=t.datavisualization.Diagram.SvgContext.renderConnector(this.helper,this.diagram._svg,this.diagram._diagramLayer,this.diagram),this.svgHelper=this.diagram._svg.document.getElementById(this.helper.name),this.svgHelper.setAttribute("pointer-events","none"),n(this.diagram._svg.getElementById(this.svgHelper.id)).attr("pointer-events","none"),n(this.diagram._svg.getElementById(this.svgHelper.id+"_hitTest")).attr("pointer-events","none"))},r.prototype._outOfBoundsDrag=function(n,i,r){if(i=i?i:0,r=r?r:0,n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){var u=this._getPageBounds();if(!this.diagram._selectedSymbol&&(i>=u.width||i<=u.x)||!this.diagram._selectedSymbol&&(r>=u.height||r<=u.y))return this.updateCursor("not-allowed"),!1}else if(n.sourceNode!=null&&!t.datavisualization.Diagram.bpmnHelper.canMoveOutofBounds(this.diagram,n,i,r))return this.updateCursor("not-allowed"),!1;return this.updateCursor(this.cursor),!0},r.prototype._updateHelper=function(){var r=[],n=this._getStartPoint(),i=this._getCurrentPoint();r.push(n);r.push(i);this._outOfBoundsDrag(this.helper,i.x,i.y)&&this._outOfBoundsDrag(this.helper,n.x,n.y)&&(this.diagram._setEndPoint(this.helper,n,!1),this.diagram._setEndPoint(this.helper,i,!0),this._disconnect(this.helper),this._sourcePossibleConnection&&(this._sourcePort&&t.datavisualization.Diagram.Util.canConnect(this._sourcePort,!0)?(this.helper.sourceNode=this._sourcePossibleConnection.name,this.helper.sourcePort=this._sourcePort.name,this._sourcePossibleConnection.outEdges.push(this.helper.name)):t.datavisualization.Diagram.Util.canConnect(this._sourcePossibleConnection)&&(this.helper.sourceNode=this._sourcePossibleConnection.name,this._sourcePossibleConnection.outEdges.push(this.helper.name))),this._targetPossibleConnection&&(this._targetPort&&t.datavisualization.Diagram.Util.canConnect(this._targetPort,!0)?(this.helper.targetNode=this._targetPossibleConnection.name,this.helper.targetPort=this._targetPort.name,this._targetPossibleConnection.inEdges.push(this.helper.name)):t.datavisualization.Diagram.Util.canConnect(this._targetPossibleConnection)&&(this.helper.targetNode=this._targetPossibleConnection.name,this._targetPossibleConnection.inEdges.push(this.helper.name))),this.diagram._dock(this.helper,this.diagram.nameTable));t.datavisualization.Diagram.SvgContext.update(this.helper,this.diagram)},r.prototype._endAction=function(){i.prototype._endAction.apply(this);this._targetPossibleConnection=null;this._sourcePossibleConnection=null;this._targetPort=null;this._sourcePort=null;this._isMouseDown=!1},r.prototype._showPorts=function(){},r.prototype._showAllPorts=function(n){i.prototype._showAllPorts.call(this,n)},r}(i);t.datavisualization.Diagram.LineTool=r;h=function(i){function r(n){i.call(this,"straightLine",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createConnector=function(t,i){var r={segments:[{type:"straight"}],sourcePoint:t,targetPoint:i};return this.diagram._getNewConnector(n.extend(!0,{},r,this.diagram.model.drawType))},r}(r);t.datavisualization.Diagram.StraightLineTool=h;c=function(i){function r(n){i.call(this,"orthogonalLine",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createConnector=function(t,i){var r={segments:[{type:"orthogonal"}],sourcePoint:t,targetPoint:i};return this.diagram._getNewConnector(n.extend(!0,{},r,this.diagram.model.drawType))},r}(r);t.datavisualization.Diagram.OrthogonalLineTool=c;l=function(i){function r(n){i.call(this,"bezierLine",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createConnector=function(t,i){var r={segments:[{type:"bezier"}],sourcePoint:t,targetPoint:i};return this.diagram._getNewConnector(n.extend(!0,{},r,this.diagram.model.drawType))},r}(r);t.datavisualization.Diagram.BezierLineTool=l;a=function(i){function r(n){i.call(this,"rotatetool",n);this._mouseOffset=t.datavisualization.Diagram.Size(0,0);this.undoObject=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(t){var u,r,f,e;i.prototype.mousedown.call(this,t);this.selectedObject=this.diagram.selectionList[0];r={};(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(r=this.diagram._getChildTable(this.selectedObject,r));f={childTable:r,node:this.selectedObject};u=n.extend(!0,{},f);this.undoObject=jQuery.extend(!0,{},u);e=this.diagram._currZoom},r.prototype.mousemove=function(n){var f,e,r,o,u,s;if(i.prototype.mousemove.call(this,n),f=!this.inAction,this.selectedObject){if(!this.inAction){if(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")for(e=this.diagram._getChildren(this.selectedObject.children),r=0;r<e.length;r++)if(o=this.diagram.nameTable[e[r]],!o.segments&&!t.datavisualization.Diagram.Util.canRotate(o))return;this._initialValue=this.selectedObject.rotateAngle;this.inAction=!0}u=!1;this.selectedObject.parent?(s=this.diagram.nameTable[this.selectedObject.parent],s.container&&(u=!0)):this.selectedObject.type=="pseudoGroup"&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(u=!0);u?this.selectedObject.type=="pseudoGroup"&&this._isParentAsLane(this.selectedObject)?(t.datavisualization.Diagram.canvasHelper._removeFromParentContainer(this.diagram,this.selectedObject),this._rotate(this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram)):(this.helper||(this.helper=this._getCloneNode(this.selectedObject),this.helper.inEdges=this.helper.outEdges=[],this.helper.type=null,this.helper.name="helper"),this._rotate(this.helper),t.datavisualization.Diagram.SvgContext._drawContainerHelper(this.diagram)):this.selectedObject.type=="pseudoGroup"&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))?this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(this._rotate(this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.diagram._updateSelectionHandle(!0),this.diagram._renderTooltip(this.selectedObject,f)):(this.selectedObject.type==="pseudoGroup"&&this._updateMultipleUndoObject(this.selectedObject),this._rotate(this.selectedObject),this.selectedObject.parent&&t.datavisualization.Diagram.Util._updateGroupBounds(this.diagram.nameTable[this.selectedObject.parent],this.diagram),t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram),this.diagram._updateSelectionHandle(!0),this.diagram._renderTooltip(this.selectedObject,f))}this.previousPoint=this.currentPoint},r.prototype._rotate=function(n){var u,f,e=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),c=this.currentPoint,r=t.datavisualization.Diagram.Geometry.findAngle(t.datavisualization.Diagram.Point(e.x,e.y),c)+90,i,o,s,h;r=t.datavisualization.Diagram.SnapUtil._snapAngle(this.diagram,r)-n.rotateAngle;i=t.datavisualization.Diagram.Util.bounds(n);u=t.datavisualization.Diagram.Rectangle(i.left,i.top,i.right-i.left,i.bottom-i.top);o={bounds:u,offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height};this.diagram._comparePropertyValues(n,"rotateAngle",{rotateAngle:r},!0);this.diagram._rotate(n,r,this.diagram.nameTable);i=t.datavisualization.Diagram.Util.bounds(n);f=t.datavisualization.Diagram.Rectangle(i.left,i.top,i.right-i.left,i.bottom-i.top);s={bounds:f,offsetX:n.offsetX,offsetY:n.offsetY,width:n.width,height:n.height};h=this._raiseEvent("rotationChange",{element:this.diagram.getNode(n),angle:n.rotateAngle,oldValue:o,newValue:s,cancel:!1});h.cancel&&this.diagram._rotate(n,-r,this.diagram.nameTable)},r.prototype.mouseup=function(r){var u,h,c,f,l,a;if(this.inAction){this.inAction=!1;var e=!1,o=!0,s=!1;this.selectedObject.parent?(u=this.diagram.nameTable[this.selectedObject.parent],u.container&&(e=!0)):this.selectedObject.type=="pseudoGroup"&&this.hasSameParent()&&this._fromContainer(this.diagram._getChildren(this.selectedObject.children))&&(h=this.diagram.nameTable[this.diagram._getChild(this.selectedObject.children[0])],u=this.diagram.nameTable[h.parent],u.container&&(e=!0));(this.selectedObject.type=="pseudoGroup"||this.selectedObject.name=="multipleSelection")&&this.diagram._activeSwimLane?t.datavisualization.Diagram.canvasHelper._multiNodeRotate(this.diagram,r,this.selectedObject):e&&(t.datavisualization.Diagram.SvgContext._removeContainerHelper(this.selectedObject,this.diagram._adornerSvg,this.diagram._adornerLayer),this._removeHighLighter(),u.container.type=="canvas"&&(s=!0),s&&(t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(this.diagram,this.diagram.activeTool.helper,u)?t.datavisualization.Diagram.canvasHelper._singleNodeRotate(this.diagram,r,this.selectedObject):o=!1));this.selectedObject.type!="pseudoGroup"?o&&this._rotate(this.selectedObject):this._fromContainer(this.diagram._getChildren(this.selectedObject.children))||this._rotate(this.selectedObject);t.datavisualization.Diagram.DiagramContext.update(this.selectedObject,this.diagram);f={};(this.selectedObject._type==="group"||this.selectedObject.type==="pseudoGroup")&&(f=this.diagram._getChildTable(this.selectedObject,f));l={childTable:f,node:this.selectedObject};c=n.extend(!0,{},l);a={type:"rotationchanged",undoObject:this.undoObject,redoObject:jQuery.extend(!0,{},c),isMultipleNode:this.selectedObject._type==="group"?!0:!1,category:"internal"};this._multipleUndo||this.diagram.addHistoryEntry(a);this.selectedObject&&t.datavisualization.Diagram.SvgContext._removePivotPoint(this.selectedObject,this.diagram._adornerSvg,this.diagram._currZoom);this.diagram._updateSelectionHandle();this.diagram._removeTooltip()}this._multipleUndo=!1;i.prototype.mouseup.call(this,r)},r}(i);t.datavisualization.Diagram.RotateTool=a;v=function(n){function i(i){n.call(this,"PivotTool",i);this._mouseOffset=t.datavisualization.Diagram.Size(0,0)}return t.datavisualization.Diagram.extend(i,n),i.prototype.mousedown=function(t){n.prototype.mousedown.call(this,t);this.selectedObject=this.diagram.selectionList[0]},i.prototype.mousemove=function(i){if(n.prototype.mousemove.call(this,i),this.selectedObject)if(this.inAction){var r=this.currentPoint.x-this.previousPoint.x,u=this.currentPoint.y-this.previousPoint.y,f=t.Matrix.identity();t.Matrix.rotate(f,-this.selectedObject.rotateAngle);var e=t.Matrix.transform(f,t.datavisualization.Diagram.Point(r,u)),o=(this.selectedObject.width*this.selectedObject.pivot.x+e.x)/this.selectedObject.width,s=(this.selectedObject.height*this.selectedObject.pivot.y+e.y)/this.selectedObject.height;this.selectedObject.pivot.x=o;this.selectedObject.pivot.y=s;this.selectedObject.offsetX+=r;this.selectedObject.offsetY+=u;this.diagram._updateSelectionHandle()}else this.inAction=!0;this.previousPoint=this.currentPoint},i.prototype._rotate=function(n){var i=t.datavisualization.Diagram.Point(n.offsetX,n.offsetY),r=this.currentPoint,u=this.FindAngle(i,r);this.diagram._rotate(n,u-n.rotateAngle,i,this.diagram.nameTable)},i.prototype.mouseup=function(t){this.inAction&&(this.inAction=!1,this.diagram._updateSelectionHandle());n.prototype.mouseup.call(this,t)},i}(i);t.datavisualization.Diagram.PivotTool=v;y=function(n){function i(t){n.call(this,"panTool",t);this.diagram=t;this._isMouseDown=!1;this.cursor="pointer"}return t.datavisualization.Diagram.extend(i,n),i.prototype.mousedown=function(t){var r;n.prototype.mousedown.call(this,t);var u=this.diagram._svg.document,i=this.diagram._svg.document.createSVGPoint(),f=this.diagram._isTouchEvent(t);return i.x=f.clientX,i.y=f.clientY,r=i.matrixTransform(this.diagram._svg.document.getScreenCTM().inverse()),u.lastMouseX=r.x,u.lastMouseY=r.y,this._isMouseDown=!0,!1},i.prototype.mousemove=function(i){if(n.prototype.mousemove.call(this,i),this._isMouseDown&&(this.startPoint.x!=this.currentPoint.x||this.startPoint.y!=this.currentPoint.y)){this.inAction=!0;var r=this.diagram._svg.document,u=this.diagram._svg.document.createSVGPoint(),h=this.diagram._isTouchEvent(i);u.x=h.clientX;u.y=h.clientY;var c=u.matrixTransform(this.diagram._svg.document.getScreenCTM().inverse()),f=c.x,e=c.y,o,s;return o=f-r.lastMouseX,s=e-r.lastMouseY,this.diagram.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableX||(o=0),this.diagram.model.constraints&t.datavisualization.Diagram.DiagramConstraints.PannableY||(s=0),t.datavisualization.Diagram.ZoomUtil.zoomPan(this.diagram,1,o,s,t.datavisualization.Diagram.Point(f,e)),r.lastMouseX=f,r.lastMouseY=e,!1}},i.prototype.mouseup=function(i){this.inAction=!1;document.onmousemove=null;document.onmouseup=null;this._isMouseDown=!1;this.diagram._removeTooltip();this.diagram._isEditing||this.diagram._isDragg||this.diagram._endEdit();delete this.hoverNode;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);n.prototype.mouseup.call(this,i)},i}(i);t.datavisualization.Diagram.PanTool=y;p=function(i){function r(n,r){i.call(this,n,r);this.boundingRect=t.datavisualization.Diagram.Rectangle();this.activeLabel=null;this._overNode="";this.cursor="crosshair"}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){i.prototype.mousedown.call(this,n);this._findNodeUnderMouse(n);var t=this._getNodeUnderMouse();t&&(this._overNode=this.selectedObject&&!this.selectedObject.isLane||t.isLane?t.name:"");this.diagram._isEditing&&this.diagram._endEdit()},r.prototype.createNode=function(){},r.prototype.mousemove=function(n){i.prototype.mousemove.call(this,n);t.datavisualization.Diagram.Util.isPageEditable(this.diagram)&&(this.selectedObject||t.datavisualization.Diagram.Geometry.isEmptyPoint(this.startPoint)||this.diagram._isEditing||(this.inAction?this._updateHelper():(this.inAction=!0,this._initHelper())))},r.prototype.mouseup=function(n){var r,u,i;this.activeLabel=null;r=12;this.inAction?(i=this.getBoundingRect(this.startPoint,this.currentPoint),this._endAction(),(i.width===0||i.height===0)&&(i.width=90,i.height=r),this.selectedObject=this.createNode(i.x+i.width/2,i.y+i.height/2,i.width,i.height),this.diagram._startEdit(this.selectedObject)):(u=this._findNodeUnderMouse(n),t.datavisualization.Diagram.Util.isPageEditable(this.diagram)&&(u==null||u.isSwimlane||u.isLane?(i=t.datavisualization.Diagram.Rectangle(this.currentPoint.x-45,this.currentPoint.y-r/2,90,r),this._endAction(),this.selectedObject=this.createNode(i.x+i.width/2,i.y+i.height/2,i.width,r),this.diagram._startEdit(this.selectedObject)):(this.selectedObject=u,this.diagram._startEdit(this.selectedObject))));this._overNode=""},r.prototype.getBoundingRect=function(n,t){var n=this.snap(this.startPoint),t=this.snap(this.currentPoint),i=Math.abs(n.x-t.x),r=Math.abs(n.y-t.y),u=n.x>t.x?t.x:n.x,f=n.y>t.y?t.y:n.y;return{x:u,y:f,width:i,height:r}},r.prototype._initHelper=function(){var n,t,i;this._svgHelper||(n=this.diagram._adornerSvg.g(),this.diagram._adornerLayer.appendChild(n),t=this.diagram._currZoom,i=this.diagram._svg.rect({id:"helper",x:this.startPoint.x*t,y:this.startPoint.y*t,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"}),n.appendChild(i),n.setAttribute("pointer-events","none"),this._svgHelper=n)},r.prototype._updateHelper=function(){var n=this.snap(this.startPoint),t=this.snap(this.currentPoint),r=this.diagram._adornerSvg.getElementById("helper"),u=Math.abs(n.x-t.x),f=Math.abs(n.y-t.y),i=this.diagram._currZoom,e=(n.x>t.x?t.x:n.x)*i,o=(n.y>t.y?t.y:n.y)*i;r&&this.diagram._adornerSvg.rect({id:r.id,x:e,y:o,width:u*i,height:f*i})},r.prototype._endAction=function(){this._svgHelper&&(this.diagram._adornerLayer.removeChild(this._svgHelper),this._svgHelper=null);i.prototype._endAction.apply(this)},r.prototype._findNodeUnderMouse=function(t){var i,o=this.diagram._isForeignObject(t.target),e,s,r,f;if(o&&(t.target=o),e=t.target,e.getAttribute("class")=="ej-d-label")s=n(e).parents(".ej-d-node,.ej-d-connector,.ej-d-group")[0],i=this._findObj(s),this.activeLabel=this.diagram._findLabelAtPoint(this.currentPoint,i);else if(r=n(t.target).parents("g"),r.length>3){var h=r[r.length-4],c=h.getAttribute("id"),u=h.getAttribute("class");u&&(u==="ej-d-node"||u==="ej-d-group"?(i=this.diagram._findNode(c),f=this.diagram._findLabelAtPoint(this.currentPoint,i),this.activeLabel=f):u==="ej-d-connector"&&(i=this.diagram._findConnector(c),f=this.diagram._findLabelAtPoint(this.currentPoint,i),this.activeLabel=f))}return i},r}(t.datavisualization.Diagram.ToolBase);t.datavisualization.Diagram.TextToolBase=p;w=function(i){function r(n){i.call(this,"textTool",n)}return t.datavisualization.Diagram.extend(r,i),r.prototype.createNode=function(i,r,u,f){var s={offsetX:i,offsetY:r,width:u,height:f,parent:this._overNode,labels:[],ports:[],type:"text"},e=this.diagram._getNewNode(n.extend(!0,{},s,this.diagram.model.drawType)),o;return e.name=this.diagram.model.drawType.name?this.diagram.model.drawType.name+t.datavisualization.Diagram.Util.randomId():"text"+t.datavisualization.Diagram.Util.randomId(),(e._type="text")&&(e._type="node"),o=this.diagram.nameTable[e.parent],o&&o.container&&this._updateMargin(e,o),e},r}(t.datavisualization.Diagram.TextToolBase);t.datavisualization.Diagram.TextTool=function(n){return new w(n)};b=function(i){function r(n){i.call(this,"phase",n);this.selectedSeperator=null;this._svgHelper=null}return t.datavisualization.Diagram.extend(r,i),r.prototype.mousedown=function(n){i.prototype.mousedown.call(this,n);this.inAction=!0;this.diagram._selectedGNode=null},r.prototype._getSeperator=function(t){if(n(t.target).parents("g").first()[0]){var i=n(t.target).parents("g").first()[0].id;if(i)return this._getphase(i.split("_phase_g")[0])}},r.prototype._removePhasehelper=function(){t.datavisualization.Diagram.SvgContext._removePhasehelper(this.diagram)},r.prototype._outOfBoundsDrag=function(n){var f=this.currentPoint.x-this.startPoint.x,e=this.currentPoint.y-this.startPoint.y,i,r,u;if(n&&t.datavisualization.Diagram.Util.canMoveOutofBoundary(this.diagram)){if(i=this._getPageBounds(),r=this.diagram.nameTable[n.parent],r&&((u=t.datavisualization.Diagram.Util.bounds(r),!this.diagram._selectedSymbol&&(u.right+f>=i.width||n.offset+f<i.x))||!this.diagram._selectedSymbol&&(u.bottom+e>=i.height||n.offset+e<i.y)))return this.updateCursor("not-allowed"),!1;n.orientation=="horizontal"?this.updateCursor("e-resize"):this.updateCursor("n-resize")}return!0},r.prototype._updatePhasehelper=function(i){var f=this._bounds?jQuery.extend(!0,{},this._bounds):this.diagram._getPhaseBounds(i),r,u,e=this.startPoint,o=this.currentPoint,s={snapped:!1,offset:0,left:!1,right:!1},h={snapped:!1,offset:0,top:!1,bottom:!1};this.selectedObject=this.diagram.nameTable[this.selectedSeperator.parent];this.initialBounds={width:this.selectedObject.width,height:this.selectedObject.height,y:this.selectedObject.offsetY,x:this.selectedObject.offsetX};i.orientation==="horizontal"?(r=o.x-e.x,r=this._snapRight(s,h,r,0,this.selectedObject,!1),u=0,this.diagram._comparePropertyValues(i,"offset",{offset:i.offset+r},!0)):(r=0,u=o.y-e.y,u=this._snapBottom(s,h,0,u,this.selectedObject,!1),this.diagram._comparePropertyValues(i,"offset",{offset:i.offset+u},!0));f&&(f.width+=r,f.height+=u,this._helperBounds=n.extend(!0,{},f),t.datavisualization.Diagram.SvgContext._updatePhaseHelper(this.diagram,i,f))},r.prototype._drawPhasehelper=function(n){var i=this.diagram._getPhaseBounds(n);n&&i&&t.datavisualization.Diagram.SvgContext._phasehelper(this.diagram,n,i)},r.prototype.mousemove=function(n){if(i.prototype.mousemove.call(this,n),t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram),this._outOfBoundsDrag(this.selectedSeperator)){if(this.selectedSeperator)this.selectedSeperator&&(this._bounds||(this._bounds=this.diagram._getPhaseBounds(this.selectedSeperator)),this._updatePhasehelper(this.selectedSeperator));else{if(this.inAction){var r=this._getSeperator(n);r&&!this.selectedSeperator&&(this.selectedSeperator=r)}this._drawPhasehelper(this.selectedSeperator);this.diagram.selectionList[0]&&this.diagram.selectionList[0].type!="phase"?(this.diagram._clearSelection(!0),this.diagram.addSelection(this.selectedSeperator,!0)):this.diagram.addSelection(this.selectedSeperator,!0)}this.previousPoint=this.currentPoint}},r.prototype._getPadding=function(n){var r=20,u=20,f=this.diagram.nameTable[this.diagram._getChild(n.children[n.children.length-1])],i,t;return f&&(i=f.children,i.length>0&&(t=this.diagram.nameTable[this.diagram._getChild(i[0])],t&&t.isLane&&(r=t.paddingRight,u=t.paddingBottom))),{x:r,y:u}},r.prototype.mouseup=function(n){var u=this._getSeperator(n),e,r,h,c;if(this.diagram.selectionList.length>0&&u&&this.diagram.selectionList[0].name!=u.name&&this.diagram._clearSelection(!0),u&&!this.selectedSeperator)this.selectedSeperator=u,this.diagram.addSelection(this.selectedSeperator,!0);else if(this.selectedSeperator&&(e=this.selectedSeperator.parent.split("phaseStack")[0],e&&(r=this.diagram.nameTable[e],r&&this._helperBounds&&r.isSwimlane))){var o=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(this.diagram,r),f=0,s=o.indexOf(this.selectedSeperator.name);s>0?f=this.diagram.nameTable[o[s-1]].offset:r.orientation==="horizontal"&&(f=50);h=jQuery.extend(!0,{},this.selectedSeperator);r.orientation==="horizontal"?this.diagram._updatePhase({name:this.selectedSeperator.name,offset:f+this._helperBounds.width}):this.diagram._updatePhase({name:this.selectedSeperator.name,offset:f+this._helperBounds.height});c={type:"phasepositionchanged",undoObject:jQuery.extend(!0,{},h),redoObject:jQuery.extend(!0,{},jQuery.extend(!0,{},this.selectedSeperator)),category:"internal"};this._multipleUndo||this.diagram.addHistoryEntry(c);this.diagram.addSelection(this.selectedSeperator,!0)}this._removePhasehelper();this._bounds=null;this.inAction=!1;this.selectedSeperator=null;t.datavisualization.Diagram.SnapUtil._removeGuidelines(this.diagram);i.prototype.mouseup.call(this,n)},r.prototype._getOuterPhaseNodes=function(n,i){var f,r,e;if(n){var o=this.diagram.nameTable[this.diagram._getChild(n.children[2])],s=[],h=null,u=null;for(f=0;o&&f<o.children.length;f++)if(r=this.diagram.nameTable[this.diagram._getChild(o.children[f])],r&&r.children&&r.children.length>1)for(e=0;e<r.children.length;e++)u=this.diagram.nameTable[this.diagram._getChild(r.children[e])],u&&(h=t.datavisualization.Diagram.Util.bounds(u),i?h.y>n.offsetY-n.height/2+this.selectedSeperator.offset&&s.push(u):h.x>n.offsetX-n.width/2+this.selectedSeperator.offset&&s.push(u))}return s},r}(i);t.datavisualization.Diagram.PhaseTool=b}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.LayoutTypes={None:"none",HierarchicalTree:"hierarchicaltree",OrganizationalChart:"organizationalchart",RadialTree:"radialtree"};t.datavisualization.Diagram.ChartOrientations={Horizontal:"horizontal",Vertical:"vertical"};t.datavisualization.Diagram.ChartTypes={Left:"left",Right:"right",Alternate:"alternate",Center:"center"};t.datavisualization.Diagram.Layout={doLayout:function(i,r){var e=i.model,u={diagram:i,_anchorX:0,_anchorY:0,_graphNodes:{},_firstLevelNodes:[],_centerNode:null,levels:[],maxLevel:0,layoutNodes:[]};for(var f in e.layout)f=="type"?u.type=i._layoutType():f=="orientation"?u.orientation=i._layoutOrientation():f=="fixedNode"?u.fixedNode=i._fixedNode():f=="horizontalSpacing"?u.horizontalSpacing=Number(i._horizontalSpacing()):f=="verticalSpacing"?u.verticalSpacing=Number(i._verticalSpacing()):f=="marginX"?u.marginX=Number(i._layoutMarginX()):f=="marginY"?u.marginY=Number(i._layoutMarginY()):f=="getLayoutInfo"?typeof e.layout.getLayoutInfo=="string"?u.getLayoutInfo=t.util.getObject(e.layout.getLayoutInfo,window):n.isFunction(e.layout.getLayoutInfo)&&(u.getLayoutInfo=e.layout.getLayoutInfo):f=="getConnectorSegments"?typeof e.layout.getConnectorSegments=="string"?u.getConnectorSegments=t.util.getObject(e.layout.getConnectorSegments,window):n.isFunction(e.layout.getConnectorSegments)&&(u.getConnectorSegments=e.layout.getConnectorSegments):u[f]=e.layout[f];return u.updateView=r===undefined?!0:u.updateView,u.objects=[],u.type!="radialtree"?t.datavisualization.Diagram.HierarchicalLayout.doLayout(u):t.datavisualization.Diagram.RadialTreeLayout.doLayout(u),u.updateView?void 0:u.objects}};t.datavisualization.Diagram.HierarchicalLayout={doLayout:function(n){var f,p,o,r,y,t,i,a,v,s,h,c,l,e,u;if(f=n.diagram,p=f.model,o=f.nodes(),o.length>0){for(t=0;t<o.length;t++)r=o[t],r.excludeFromLayout||(y=n._graphNodes[r.name]=this._setUpLayoutInfo(n,r),y.tree.hasSubTree=!1,r.inEdges&&r.inEdges.length||n._firstLevelNodes.push(r));for(t=0;t<n._firstLevelNodes.length;t++)r=n._firstLevelNodes[t],this._updateEdges(n,r,1);if(n._firstLevelNodes.length>0){for(n._rootNode=n._firstLevelNodes[0],a=0,v=0,t=0;t<n._firstLevelNodes.length;t++)i=this._updateTree(n,a,v,n._firstLevelNodes[t],0,n._firstLevelNodes[t-1]),e=n._graphNodes[n._firstLevelNodes[t].name],e.y<i.y&&(i.y=e.y),e.x<i.x&&(i.x=e.x),n.orientation=="lefttoright"||n.orientation=="righttoleft"?v=i.right+n.horizontalSpacing:a=i.right+n.horizontalSpacing,t==0?(s=i.x,c=i.y,h=i.right,l=i.bottom):(s=Math.min(s,i.x),c=Math.min(c,i.y),h=Math.max(h,i.right),l=Math.max(l,i.bottom));for(this._updateAnchor(n,{x:s,y:c,right:h,bottom:l}),f._layoutInAction=!0,t=0;t<n._firstLevelNodes.length;t++)this._updateNodes(n,n._firstLevelNodes[t],0);if(f._layoutInAction=!1,n.updateView||(f._internalLayout=n),n.updateView){for(t=0;t<n._firstLevelNodes.length;t++)this._updateConnectors(n,n._firstLevelNodes[t],1);for(u=0;u<n.diagram.model.connectors.length;u++)delete n.diagram.model.connectors[u]._visited;for(u=0;u<n.diagram.model.nodes.length;u++)delete n.diagram.model.nodes[u]._visited1,delete n.diagram.model.nodes[u]._isRightAdded}}}delete n.diagram.minSpaceBetweenNode},_getGroupBounds:function(n,i){for(var s,h=t.datavisualization.Diagram.Rectangle(),r,l=0,a=n.length;l<a;l++){if(r=i.diagram.nameTable[i.diagram._getChild(n[l])],r)if(r._visited)s=t.datavisualization.Diagram.Util.bounds(r);else{var e=r.width?r.width:r._width||0,o=r.height?r.height:r._height||0,u=i._anchorX,f=i._anchorY,c=0;i.orientation=="lefttoright"?(u+=i._graphNodes[r.name].y+e/2,f+=i._graphNodes[r.name].x+c+o/2):i.orientation=="righttoleft"?(u-=i._graphNodes[r.name].y+e/2,f+=i._graphNodes[r.name].x+c+o/2):i.orientation=="toptobottom"?(u+=i._graphNodes[r.name].x+c+e/2,f+=i._graphNodes[r.name].y+o/2):(u+=i._graphNodes[r.name].x+c+e/2,f-=i._graphNodes[r.name].y+o/2);u=u;f=f;s={x:u-e*r.pivot.x,y:f-o*r.pivot.y,width:e,height:o}}s&&(h=t.datavisualization.Diagram.Geometry.isEmptyRect(h)?s:t.datavisualization.Diagram.Geometry.union(h,s))}return h},_updateTree:function(n,t,i,r,u,f,e){var s,o,l,y,p,h,w,a,b,v,k,c;return r._visited1?r._treeBounds:(r._visited1=!0,s=this._getDimensions(n,r,t,i,u),o=n._graphNodes[r.name],n.maxLevel=Math.max(n.maxLevel,u),l=u,p=this._hasChild(n,r),p||o.tree.assistants.length?(c=s.y+s.height+n.verticalSpacing,o.tree.assistants.length&&(y=this._setDepthSpaceForAssistants(n,r,c,s.height,u,n.verticalSpacing),l=y.level,c=y.bottom),o.tree.assistants.length||o.tree.orientation=="horizontal"||(c=s.y+s.height+n.verticalSpacing/2),o.tree.children.length&&(h=o.tree.orientation=="horizontal"&&(o.tree.type!="balanced"||o.tree.children.length==1)?this._updateHorizontalTree(n,r,f,s.x,c,l):o.tree.type=="balanced"?this._updateHorizontalTreeWithMultipleRows(n,r,f,s.x,c,l):this._updateVerticalTree(n,r,s.x,c,l,e)),o.y&&o.y>s.y||(o.y=s.y),t&&t>o.mid||(t=o.mid),o.tree.assistants.length&&(k=t!==undefined?t:s.x,v=this._setBreadthSpaceForAssistants(n,r,s,k,c,u),p||(a=h=v,t=(a.x+a.right)/2-s.width/2,h=a),b=v?v.canMoveBy:undefined),o.x=t,o.translate||(o._treeWidth=h.right-h.x),w={x:t,y:s.y,right:t+s.width,bottom:s.y+s.height},this._translateSubTree(n,r,w,h,s,u,b,f!=undefined,e),typeof o.firstChild!="string"&&(o.firstChild.x+=o.subTreeTranslation),r._treeBounds=h,h):(r._treeBounds=this._updateLeafNode(n,r,f,s,u,e),r._treeBounds))},_updateLeafNode:function(n,t,i,r,u,f){var e,o;return e=n._graphNodes[t.name],e.x&&e.x>r.x||(e.x=r.x),e.y&&e.y>r.y||(e.y=r.y),e.maxLevel=Math.max(u,e.maxLevel||0),o={x:r.x,y:r.y,right:r.x+r.width,bottom:r.y+r.height},e.maxLevel=Math.max(e.maxLevel||0,u),this._translateSubTree(n,t,o,o,r,u,undefined,i!=undefined,f),{x:e.x,y:e.y,right:e.x+r.width,bottom:e.y+r.height}},_translateSubTree:function(n,t,i,r,u,f,e,o,s){var h=n._graphNodes[t.name],c=n.diagram.nameTable[h.firstChild?h.firstChild.child:h.tree.children[0]],l=c?n._graphNodes[c.name]:null,a=this._hasChild(n,t),v=this._findIntersectingLevels(n,i,f,h.actualLevel),p=this._findIntersectingLevels(n,r,f,h.actualLevel),y=[];v.length&&h.translate?(h.intersect=v,this._spaceLeftFromPrevSubTree(n,t,i),h.canMoveBy=h.diff,e!==undefined&&(h.canMoveBy=Math.min(e,h.canMoveBy)),c&&l.canMoveBy!==undefined&&(l.canMoveBy>=h.canMoveBy&&(h.translated=!0),h.canMoveBy=Math.min(h.canMoveBy,l.canMoveBy)),o&&(h.x-=h.canMoveBy,h.subTreeTranslation-=h.canMoveBy,a&&(this._shiftSubordinates(n,p,h.canMoveBy),r.x=Math.min(r.x,h.x),r.right=Math.max(r.right,h.x+u.width),r.bottom=Math.max(r.bottom,h.y+u.height),r.x-=h.canMoveBy,r.right-=h.canMoveBy),c&&l.canMoveBy>h.canMoveBy?h.canMoveBy=l.canMoveBy-h.canMoveBy:c&&h.canMoveBy!==undefined&&(h.canMoveBy=0))):(a&&(r.x=Math.min(r.x,i.x),r.right=Math.max(r.right,i.x+u.width),r.bottom=Math.max(r.bottom,h.y+u.height)),h.translate||(h.canMoveBy=0,h.subTreeTranslation=0));s||(i={x:h.x,y:u.y,right:h.x+u.width,bottom:u.y+u.height},y.push({rBounds:i}),this._updateRearBounds(n,t,y,f))},_updateRearBounds:function(n,t,i,r,u){var f,o,u,s,h,a=!0,c,l,e;if(t&&(c=n._graphNodes[t.name],u=c.intersect,a=!c.tree.children.length&&!c.tree.assistants.length),s=i[0].rBounds,h=i[i.length-1].rBounds,u&&u.length){for(f=n.levels[u[0]].rBounds,l=f.bottom,f.y<s.y&&(f.bottom=s.y,i.splice(0,0,{rBounds:f})),l>h.bottom?i.push({rBounds:{x:f.x,right:f.right,y:s.bottom,bottom:l}}):(f=n.levels[u[u.length-1]].rBounds,a&&f.bottom>h.bottom&&(f.y=h.bottom,i.push({rBounds:f}))),o=u[0],e=i.length-1;e>=0;e--)n.levels.splice(o,0,i[e]);o+=i.length;n.levels.splice(o,u.length)}else for(o=this._findLevel(n,i[i.length-1].rBounds,r),e=i.length-1;e>=0;e--)n.levels.splice(o,0,i[e])},_shiftSubordinates:function(n,t,i){var r;if(i!=0)for(r=0;r<t.length;r++)n.levels[t[r]].rBounds&&(n.levels[t[r]].rBounds.x-=i,n.levels[t[r]].rBounds.right-=i)},_setDepthSpaceForAssistants:function(n,t,i,r,u,f){for(var h=n._graphNodes[t.name],s,c,o,l=i,e=0;e<h.tree.assistants.length;e++)s=n._graphNodes[h.tree.assistants[e]],s&&(s.tree.children=s.tree.assistants=[],s.y=i,o=n.diagram.nameTable[h.tree.assistants[e]],c=o.height?o.height:o._height,(n.orientation=="lefttoright"||n.orientation=="righttoleft")&&(c=o.width?o.width:o._width),l=i+c+f/2,n.maxLevel=u+1,e%2==1&&e!=h.tree.assistants.length-1&&(i=l,u++));return{level:n.maxLevel,bottom:i+c+f}},_setBreadthSpaceForAssistants:function(n,t,i,r,u,f){for(var s,y,h,o,c=n._graphNodes[t.name],b=u,a=f,p,v,l,w,e=0;e<c.tree.assistants.length;e++)s=n._graphNodes[c.tree.assistants[e]],s&&(o=n.diagram.nameTable[c.tree.assistants[e]],y=o.width?o.width:o._width,(n.orientation=="lefttoright"||n.orientation=="righttoleft")&&(y=o.height?o.height:o._height),p=e%2==0?r+i.width/2-20-y:r+i.width/2+20,h=this._updateTree(n,p,s.y,n.diagram.nameTable[c.tree.assistants[e]],a+1),this._hasChild(n,t)||(e==0?l=h:this._uniteRects(l,h)),e%2==0&&s.prevBounds&&(v=v===undefined?s.canMoveBy:Math.min(v,s.canMoveBy)),(e%2==1||e==c.tree.assistants.length-1)&&(w=this._findIntersectingLevels(n,h,a+1),this._updateRearBounds(n,null,[{rBounds:h}],a+1,w),a++));return l&&(l.canMoveBy=v),l},_updateHorizontalTree:function(n,t,i,r,u,f){var s,e,h,nt,tt,y,et,p,c,w,it,rt=this._getDimensions(n,t,r,u,f),o=n._graphNodes[t.name],ut=o.tree.type,b=f,ft=r,ot=u,k,d,st=n.levels.slice(0,n.levels.length),g,l,a,v;if(this._hasChild(n,t)){for(g=n.orientation=="lefttoright"||n.orientation=="righttoleft"?!0:!1,l=0;l<o.tree.children.length;l++)s=n.diagram.nameTable[o.tree.children[l]],k=s.width?s.width:s._width,d=s.height?s.height:s._height,nt=g?d:k,tt=g?k:d,et=n.levels[b+1]?n.levels[b+1].rBounds:null,h=this._updateTree(n,ft,ot,s,b+1,n.diagram.nameTable[o.tree.children[l-1]]),e=n._graphNodes[s.name],o.maxLevel=Math.max(o.maxLevel||0,e.maxLevel||0),c={x:e.x,y:e.y,right:e.x+nt,bottom:e.y+tt},l==0&&(p={x:Math.min(e.x,h.x),y:Math.min(e.y,h.y),right:h.right,bottom:h.bottom},y=e),a?(a.x=c.x,a.y=c.y,c.right>a.right&&(a.right=c.right),a.bottom=c.bottom):a=c,l==0&&(o.firstChild={x:e.x,canMoveBy:e.canMoveBy,child:s.name}),this._hasChild(n,s)&&(!o.firstChild||o.firstChild.x>=e.firstChild.x?(e.firstChild&&o.firstChild.canMoveBy<e.canMoveBy&&(v=o.firstChild.canMoveBy,e.canMoveBy=v,n._graphNodes[o.firstChild.child].canMoveBy=v,o.firstChild.canMoveBy=v),o.firstChild={x:e.firstChild.x,canMoveBy:v!==undefined?v:e.canMoveBy,child:s.name}):e.firstChild&&e.translated&&o.firstChild.canMoveBy>e.canMoveBy&&(o.firstChild.canMoveBy=n._graphNodes[o.firstChild.child].canMoveBy=e.canMoveBy)),w=w?Math.max(e.maxLevel,w):e.maxLevel,s._isRightAdded||(this._uniteRects(p,h),ft=l!=0&&!this._hasChild(n,s)&&e.subTreeTranslation<0?h.right-e.subTreeTranslation+n.horizontalSpacing:h.right+n.horizontalSpacing),s._isRightAdded=!0;isNaN(it)||(y.canMoveBy=it);o.mid=(y.x+a.right)/2-rt.width/2;ut=="left"?o.mid=c.right-rt.width:ut=="right"&&(o.mid=r)}return p},_updateHorizontalTreeWithMultipleRows:function(n,t,i,r,u,f,e){var h,l,a,rt,kt,st,ut,ni,ft=this._getDimensions(n,t,r,u,f),b=n._graphNodes[t.name],fi=b.tree.type,g=f,nt=r,ht=u,et,ot,ei=n.levels.slice(0,n.levels.length),e=[],tt=0,bt,lt,p,it,d,ti,dt,gt,at,oi,v,o,vt,yt,pt,wt,s;if(this._hasChild(n,t)){var ct=n.orientation=="lefttoright"||n.orientation=="righttoleft"?!0:!1,w=this._splitChildrenInRows(n,t),k=b.tree.children.length==5&&w[0].length==3,y=[],c=[];if(k)c=w;else for(o=0;o<w.length;o++){if(y[o]=[],c[o]=[],bt=w[o].length,w[o].length%2!=1)for(bt=Math.ceil(w[o].length/2),lt=0;lt<bt;lt++)y[o].push(w[o][lt]);for(s=y[o].length;s<w[o].length;s++)c[o].push(w[o][s])}for(p=[],tt=0,o=0;o<y.length&&y[o].length;o++){for(nt=r,p[o-1]&&(ht=p[o-1].bottom+n.verticalSpacing),s=0;s<y[o].length;s++)h=n.diagram.nameTable[y[o][s]],et=h.width?h.width:h._width,ot=h.height?h.height:h._height,rt=ct?ot:et,kt=ct?et:ot,st=n.levels[g+1]?n.levels[g+1].rBounds:null,l=n._graphNodes[h.name],l.actualLevel=g+1+o,a=this._updateTree(n,nt,ht,h,g+1,n.diagram.nameTable[y[o][s-1]]),s==0?p[o]={x:a.x,y:a.y,right:a.right,bottom:a.bottom}:this._uniteRects(p[o],a),o==0&&s==0?(tt=l.canMoveBy,b.firstChild={x:l.x,child:h.name,canMoveBy:l.canMoveBy}):s==0&&l.canMoveBy!==undefined&&tt>l.canMoveBy&&(tt=Math.min(tt,l.canMoveBy||0),b.firstChild={x:l.x,child:h.name,canMoveBy:l.canMoveBy}),nt=a.right+n.horizontalSpacing;it=o==0?p[o].right:Math.max(it,p[o].right);st=ni}for(o=0;o<y.length&&y[o].length;o++){if(it!=p[o].right)for(d=it-p[o].right,s=0;s<y[o].length;s++)ti=n.diagram.nameTable[y[o][s]],dt=n._graphNodes[y[o][s]],dt.x+=d;o==0?ut={x:p[0].x,y:p[0].y,right:p[0].right,bottom:p[0].bottom}:this._uniteRects(ut,p[o]);st=a}for(gt=(it||0)+(it!==undefined?n.horizontalSpacing/2:0),it!==undefined&&(b.mid=gt-ft.width/2,at=it+n.horizontalSpacing),ht=u,v=[],o=0;o<c.length;o++){for(nt=w[o].length%2==1&&o==c.length-1||k?r:at||r,o!=0&&(ht=v[o-1].bottom+n.verticalSpacing),s=0;s<c[o].length;s++)h=n.diagram.nameTable[c[o][s]],et=h.width?h.width:h._width,ot=h.height?h.height:h._height,rt=ct?ot:et,kt=ct?et:ot,st=n.levels[g+1]?n.levels[g+1].rBounds:null,l=n._graphNodes[h.name],l.actualLevel=g+1+o,s==0&&y[o]&&y[o].length&&(l.translate=!1),k&&o==1&&(s==0&&yt+rt+n.horizontalSpacing<=pt&&(vt=!0,nt=yt-rt/2),vt&&s==1&&(nt=pt-rt/2)),a=this._updateTree(n,nt,ht,h,g+1,n.diagram.nameTable[c[o][s-1]]),k&&s<=2&&o==0&&s==1&&(yt=a.x-n.horizontalSpacing/2,pt=a.x+rt+n.horizontalSpacing/2),s==0?v[o]={x:a.x,y:a.y,right:a.right,bottom:a.bottom}:this._uniteRects(v[o],a),ut||(ut={x:v[o].x,y:v[o].y,right:v[o].right,bottom:v[o].bottom}),this._uniteRects(ut,v[o]),nt=a.right+n.horizontalSpacing,st=a,(!b.firstChild||(o==c.length-1&&w[o].length%2==1||k)&&s==0&&l.canMoveBy!==undefined&&tt>l.canMoveBy)&&(tt=Math.min(tt,l.canMoveBy||0),b.firstChild={x:l.x,child:h.name,canMoveBy:l.canMoveBy});if(k&&o==1&&(wt=v[0].right-v[0].x>=v[1].right-v[1].x?0:1),o==w.length-1&&(w[o].length%2==1||k&&o==1)){var e=c[o][Math.floor(c[o].length/2)],ii=n.diagram.nameTable[e],ri=this._getDimensions(n,ii,n._graphNodes[e].x,n._graphNodes[e].y,g+1);if(d=undefined,!vt&&k?(wt==1&&(o=0),d=(v[wt].x+v[wt].right)/2-(v[o].x+v[o].right)/2,o==0&&(b.mid+=d)):k||at===undefined||(d=at-n.horizontalSpacing/2-(n._graphNodes[e].x+ri.width/2)),d!==undefined)for(s=0;s<c[o].length;s++)if(n._graphNodes[c[o][s]].x+=d,n._graphNodes[c[o][s]].canMoveBy+=d,s==c[o].length-1){var si=this._getDimensions(n,n.diagram.nameTable[c[o][s]],n._graphNodes[c[o][s]].x,n._graphNodes[c[o][s]].y,n._graphNodes[c[o][s]].actualLevel),h=n._graphNodes[c[o][s]],ui=this._findIntersectingLevels(n,{x:h.x,y:h.y,right:h.x+ft.width,bottom:h.y+ft.height},n._graphNodes[c[o][s]].actualLevel);this._updateRearBounds(n,null,[{rBounds:{x:h.x,y:h.y,right:h.x+ft.width,bottom:h.y+ft.height}}],n._graphNodes[c[o][s]].actualLevel,ui)}k&&(b.mid=(pt+yt)/2+(o==0?d:0)-ft.width/2);b.mid==undefined&&n._graphNodes[e]&&(b.mid=n._graphNodes[e].x);vt=!1;o++}}}return ut},_updateVerticalTree:function(n,t,i,r,u,f){var s,o,a,k,nt,tt,v,y,ot,p,ct,e,st,it,rt,ut,d,w,h,ht,b=[],l=[],g,ft,et,c;for(ct=this._getDimensions(n,t,i,r,u),e=n._graphNodes[t.name],st=n.diagram.nameTable[e.tree.children[0]],it=n.orientation=="lefttoright"||n.orientation=="righttoleft"?!0:!1,rt=e.tree.type=="left"||e.tree.type=="leftoffset"?-1:0,ut=i,d=r,w=u,h=0;h<e.tree.children.length;h++)e.tree.type=="alternate"&&(ht=h%2==0&&e.tree.children.length>2?"left":"right",rt=h%2==0&&e.tree.children.length>2?-1:0),ut=i+this._findOffset(n,t,e,ht),s=n.diagram.nameTable[e.tree.children[h]],ft=s.width?s.width:s._width,et=s.height?s.height:s._height,k=it?et:ft,nt=it?ft:et,a=this._updateTree(n,ut+rt*k,d,s,u+1,undefined,!0),o=n._graphNodes[s.name],y={x:o.x,y:o.y,right:o.x+k,bottom:o.y+nt},h==0?(this._uniteRects(a,y),v=a):this._uniteRects(v,a),!o.prevBounds||e.tree.type=="alternate"&&h%2==1&&e.tree.children.length>2||(c=c!==undefined?Math.min(o.canMoveBy,c):o.canMoveBy),e.maxLevel=Math.max(e.maxLevel||0,o.maxLevel||0),e.tree.type=="alternate"&&e.tree.children.length>2&&h%2==0?(h!=0&&(d=tt.bottom+n.verticalSpacing/2),l.push({rBounds:y}),o.levelBounds&&(l=l.concat(o.levelBounds))):(d=e.tree.type=="alternate"&&e.tree.children.length>2?Math.max(a.bottom,tt.bottom)+n.verticalSpacing/2:a.bottom+n.verticalSpacing/2,u=e.maxLevel,b.push({rBounds:y}),p?this._uniteRects(p,y):p={x:o.x,y:o.y,right:o.x+k,bottom:o.y+nt},o.levelBounds&&(b=b.concat(o.levelBounds))),h==0&&(e.firstChild={x:o.x,canMoveBy:o.canMoveBy,child:s.name}),this._hasChild(n,s)&&(!e.firstChild||e.firstChild.x>=o.firstChild.x?(o.firstChild&&e.firstChild.canMoveBy<o.canMoveBy&&(c=e.firstChild.canMoveBy,o.canMoveBy=c,n._graphNodes[e.firstChild.child].canMoveBy=c,e.firstChild.canMoveBy=c),e.firstChild={x:o.firstChild.x,canMoveBy:c!==undefined?c:o.canMoveBy,child:s.name}):o.firstChild&&o.translated&&e.firstChild.canMoveBy>o.canMoveBy&&(e.firstChild.canMoveBy=n._graphNodes[e.firstChild.child].canMoveBy=o.canMoveBy)),tt=y;return f?e.levelBounds=b:(e.tree.type=="alternate"&&e.tree.children.length>2&&(ot={x:l[0].rBounds.x,y:l[0].rBounds.y,right:l[l.length-1].rBounds.right,bottom:l[l.length-1].rBounds.bottom},g=this._findIntersectingLevels(n,ot,w+1),this._updateRearBounds(n,null,l,w+1,g)),g=this._findIntersectingLevels(n,p||v,w+1),this._updateRearBounds(n,null,p?b:[{rBounds:v}],w+1,g)),isNaN(c)||(n._graphNodes[st.name].canMoveBy=c),e.childBounds=v,e.mid=i,v},_splitChildrenInRows:function(t,i){var r=t._graphNodes[i.name],u=4,o=[],f=r.tree.children.length,h=n.extend([],!0,r.tree.children),s,e;for(r.tree.rows?(s=r.tree.children.length,e=Math.ceil(s/r.tree.rows),u=e%2==0?e:e+1):r.tree.children.length==3||r.tree.children.length==4?u=2:r.tree.children.length==5&&(u=3);f>0;)o[o.length]=h.splice(0,u),f-=u,f<u&&(u=f);return o},_findOffset:function(n,t,i,r){var u=0,f=n.orientation=="lefttoright"||n.orientation=="righttoleft"?t.height?t.height:t._height:t.width?t.width:t._width,e=r?r:i.tree.type;u=i.tree.offset||(i.tree.offset===0?0:20);i.tree.type=="alternate"&&u>=n.horizontalSpacing&&(u=n.horizontalSpacing/2);switch(e){case"left":u=f/2-u;break;case"right":u=u+f/2}return u},_translateSiblings:function(n,t,i){var r,f,u,e;for(u=n._graphNodes[t.name],e=n._graphNodes[i.name].diff-n._graphNodes[i.name].canMoveBy,r=0;r<u.tree.children.length;r++){if(i.name==u.tree.children[r])break;f=n._graphNodes[u.tree.children[r]];f.x+=e}},_uniteRects:function(n,t){n.x=Math.min(n.x,t.x);n.right=Math.max(n.right,t.right);n.bottom=Math.max(n.bottom,t.bottom)},_spaceLeftFromPrevSubTree:function(n,t,i){for(var r=n._graphNodes[t.name],f,e,o=n.horizontalSpacing,u=0;u<r.intersect.length;u++)e=n.levels[r.intersect[u]].rBounds,f=i.x-(e.right+o),(r.diff==undefined||f<r.diff)&&(r.diff=f,r.prevBounds=n.levels[r.intersect[u]])},_findIntersectingLevels:function(n,t,i,r){var f={x:t.x,y:t.y,right:t.right,bottom:t.bottom},o,u,e;f.y-=n.verticalSpacing/2;f.bottom+=n.verticalSpacing/2;o=[];e=r!==undefined?r:i;u=n.levels[e]?n.levels[e].rBounds:null;do{if(u&&(f.y<u.y&&f.bottom>u.y||f.y<u.bottom&&u.bottom<f.bottom||f.y>=u.y&&f.bottom<=u.bottom||f.y<u.y&&f.bottom>u.bottom))o.splice(0,0,e);else if(u&&u.bottom<f.y)break;e--;u=n.levels[e]?n.levels[e].rBounds:null}while(e>=0);e=(r!==undefined?r:i)+1;u=n.levels[e]?n.levels[e].rBounds:null;do{if(u&&(f.y<u.y&&f.bottom>u.y||f.y<u.bottom&&u.bottom<f.bottom||f.y>=u.y&&f.bottom<=u.bottom||f.y<u.y&&f.bottom>u.bottom))o.push(e);else if(u&&u.y>f.bottom)break;e++;u=n.levels[e]?n.levels[e].rBounds:null}while(e<=n.levels.length);return o},_findLevel:function(n,t){for(var u=t,i=0,r=n.levels[i]?n.levels[i].rBounds:null;i<n.levels.length;){if(r&&u.bottom<r.y)return i;i++;r=n.levels[i]?n.levels[i].rBounds:null}return i},_updateEdges:function(n,i,r){var u=n._graphNodes[i.name],e,f;if(i.outEdges&&i.outEdges.length&&i.isExpanded)for(e=0;e<i.outEdges.length;e++)f=n.diagram.nameTable[n.diagram.nameTable[i.outEdges[e]].targetNode],f.excludeFromLayout||(t.datavisualization.Diagram.Util._collectionContains(f.name,u.tree.children)||u.tree.children.push(f.name),f.outEdges&&f.outEdges.length&&f.isExpanded&&(u.tree.hasSubTree=!0),this._updateEdges(n,f,r+1));u.tree.level=r;u.tree.hasSubTree&&(u.tree.orientation="horizontal");n.getLayoutInfo&&n.type=="organizationalchart"&&(n.getLayoutInfo(n.diagram,i,u.tree),u.tree.type=="balanced"&&u.tree.hasSubTree&&(u.tree.type="center",u.tree.orientation="horizontal"));n.level&&u.tree.type!="alternate"&&r>=n.level&&(u.tree.hasSubTree=!1)},_updateAnchor:function(n,i){var o,s,u,c,l,h,r,f,a,v,y,p,e;if(n.diagram.viewPort=s=t.datavisualization.Diagram.ScrollUtil._viewPort(n.diagram,!0),s.x=0,s.y=0,r=n.bounds?n.bounds:s,f=n.diagram._layoutOrientation(),f=="toptobottom"||f=="bottomtotop"){switch(n.horizontalAlignment){case"left":n._anchorX=r.x-i.x+n.margin.left;break;case"right":n._anchorX=r.x+r.width-n.margin.right-i.right;break;case"center":n._anchorX=r.x+r.width/2-(i.x+i.right)/2}switch(n.verticalAlignment){case"top":a=r.y+n.margin.top;n._anchorY=f=="toptobottom"?a:i.bottom+a;break;case"bottom":v=r.y+r.height-n.margin.bottom;n._anchorY=f=="toptobottom"?v-i.bottom:v;break;case"center":e=r.y+r.height/2;n._anchorY=n.orientation=="toptobottom"?e-(i.y+i.bottom)/2:e+(i.y+i.bottom)/2}}else if(f=="lefttoright"||f=="righttoleft"){switch(n.horizontalAlignment){case"left":y=r.x+n.margin.left;n._anchorX=f=="lefttoright"?y:i.bottom+y;break;case"right":p=r.x+r.width-n.margin.right;n._anchorX=f=="lefttoright"?p-i.bottom:p;break;case"center":e=r.width/2+r.x;n._anchorX=n.orientation=="lefttoright"?e-(i.y+i.bottom)/2:e+(i.y+i.bottom)/2}switch(n.verticalAlignment){case"top":n._anchorY=r.y+n.margin.top-i.x;break;case"center":n._anchorY=r.y+r.height/2-(i.right+i.x)/2;break;case"bottom":n._anchorY=r.y+r.height-n.margin.bottom-i.right}}if(n.fixedNode){for(u=n.diagram.nameTable[n.fixedNode],c=u.width?u.width:u._width,l=u.height?u.height:u._height,n._anchorX=u.offsetX,n._anchorY=u.offsetY,n._anchorX+=n.orientation=="righttoleft"?c*u.pivot.x:-c*u.pivot.x,n._anchorY+=n.orientation=="bottomtotop"?l*u.pivot.y:-l*u.pivot.y,o=u,h=0;o.inEdges.length;)o=this._getParentNode(n,o),h+=n._graphNodes[o.name].subTreeTranslation||0;n.orientation=="lefttoright"||n.orientation=="righttoleft"?(n._anchorX-=n._graphNodes[u.name].y,n._anchorY-=n._graphNodes[u.name].x+h):(n._anchorX-=n._graphNodes[u.name].x+h,n._anchorY-=n._graphNodes[u.name].y)}},_updateConnectors:function(n,i,r){var l,s,u,f,c,y,e,v=0,a=0,p=0,w=0,o=0,b=0,h,k,d;if(f=n._graphNodes[i.name],i.outEdges.length)for(l=0;l<i.outEdges.length;l++)if(s=n.diagram.nameTable[i.outEdges[l]],u=n.diagram.nameTable[s.targetNode],s.visible&&!s._visited){if(s._visited=!0,n.getConnectorSegments)e=n.getConnectorSegments(n.diagram,s);else if(f&&f.tree.children.indexOf(s.targetNode)!=-1){var g=i.width?i.width:i._width,nt=i.height?i.height:i._height,tt=u.width?u.width:u._width,it=u.height?u.height:u._height;n.type=="organizationalchart"&&(n.orientation=="toptobottom"||n.orientation=="bottomtotop"?(a=n.orientation=="toptobottom"?nt:-nt,w=n.orientation=="toptobottom"?-it:it,c=n.orientation=="toptobottom"?"bottom":"top",f.tree.assistants.length?(o=Math.abs(u.offsetY+w/2-(i.offsetY+a/2))-n.verticalSpacing/2,e=[{type:"orthogonal",length:o,direction:c}]):f.tree.orientation=="horizontal"&&(s.segments.length==1||f.tree.type=="balanced")?f.tree.type=="balanced"?f.tree.children.length==5&&l>2?(h=f.tree.children[1],isNaN(n._graphNodes[h]._treeWidth)&&(n._graphNodes[h]._treeWidth=n.diagram.nameTable[h].width),k=l==3?n.diagram.nameTable[h].offsetX-n._graphNodes[h]._treeWidth/2-n.horizontalSpacing/2:n.diagram.nameTable[h].offsetX+n._graphNodes[h]._treeWidth/2+n.horizontalSpacing/2,e=[{type:"orthogonal",length:n.verticalSpacing/2,direction:"bottom"},{type:"orthogonal",length:i.offsetX-k,direction:"left"},{type:"orthogonal",length:u.offsetY+w/2-(i.offsetY+a/2)-n.verticalSpacing,direction:"bottom"}]):(d=Math.min(30,n.verticalSpacing/2)*(c=="bottom"?1:-1),o=Math.abs(u.offsetY+w*u.pivot.y-d-(i.offsetY+a*(1-u.pivot.y))),e=[{type:"orthogonal",length:o,direction:c}]):n.diagram._dock(s,n.diagram.nameTable):f.tree.orientation=="horizontal"?e=[{type:"orthogonal"}]:f.tree.enableRouting&&(o=Math.abs(u.offsetY-(i.offsetY+a/2)),e=[{type:"orthogonal",length:o,direction:c}],f.tree.offset<5&&(y=f.tree.type=="left"?"right":"left",o=n.verticalSpacing/4,b=Math.abs(f.tree.offset)+n.horizontalSpacing/2,e=[{type:"orthogonal",length:o,direction:c},{type:"orthogonal",length:b,direction:y}]))):(v=n.orientation=="lefttoright"?g:-g,p=n.orientation=="lefttoright"?-tt:tt,c=n.orientation=="lefttoright"?"right":"left",f.tree.assistants.length?(o=Math.abs(u.offsetX+p/2-(i.offsetX+v/2))-n.verticalSpacing/2,e=[{type:"orthogonal",length:o,direction:c}]):f.tree.orientation=="horizontal"&&(s.segments.length==1||f.tree.type=="balanced")?f.tree.type=="balanced"?f.tree.children.length==5&&l>2?(h=f.tree.children[1],isNaN(n._graphNodes[h]._treeWidth)&&(n._graphNodes[h]._treeWidth=n.diagram.nameTable[h].width),k=l==3?n.diagram.nameTable[h].offsetY-n._graphNodes[h]._treeWidth/2-n.verticalSpacing/2:n.diagram.nameTable[h].offsetY+n._graphNodes[h]._treeWidth/2+n.verticalSpacing/2,e=[{type:"orthogonal",length:n.horizontalSpacing/2,direction:"right"},{type:"orthogonal",length:i.offsetY-k,direction:"top"},{type:"orthogonal",length:u.offsetX+p/2-(i.offsetX+v/2)-n.horizontalSpacing,direction:"right"}]):(d=Math.min(30,n.horizontalSpacing/2)*(c=="right"?1:-1),o=Math.abs(u.offsetX+p*u.pivot.x-d-(i.offsetX+v*(1-u.pivot.x))),e=[{type:"orthogonal",length:o,direction:c}]):n.diagram._dock(s,n.diagram.nameTable):f.tree.orientation=="horizontal"?e=[{type:"orthogonal"}]:(o=Math.abs(u.offsetX-(i.offsetX+v/2)),e=[{type:"orthogonal",length:o,direction:c}],f.tree.offset<5&&(y=f.tree.type=="left"?"bottom":"top",o=n.verticalSpacing/4,b=Math.abs(f.tree.offset)+10,e=[{type:"orthogonal",length:o,direction:c},{type:"orthogonal",length:b,direction:y}]))))}e?n.diagram.updateConnector(s.name,{segments:e}):n.diagram._dock(s,n.diagram.nameTable);n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(s,n.diagram);u&&(u.isExpanded||this._hasChild(n,u))&&this._updateConnectors(n,u,r+1)}if(f&&f.tree.assistants.length)for(l=0;l<f.tree.assistants.length;l++)u=n.diagram.nameTable[f.tree.assistants[l]],s=n.diagram.nameTable[u.inEdges[0]],o=Math.abs(u.offsetY-(i.offsetY+a/2)),e=[{type:"orthogonal",length:o,direction:c}],e&&n.diagram.updateConnector(s.name,{segments:e}),n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(s,n.diagram),(u.isExpanded||this._hasChild(n,u))&&this._updateConnectors(n,u,r+1)},_updateNodes:function(n,i,r,u,f,e){var c,h,b,k,v,w,d,y,p,g;i._visited=!0;var l=i.width?i.width:i._width,a=i.height?i.height:i._height,o=i.offsetX,s=i.offsetY;if(!i.excludeFromLayout){if(o=n._anchorX,s=n._anchorY,n.orientation=="lefttoright"?(o+=n._graphNodes[i.name].y+l/2,s+=n._graphNodes[i.name].x+r+a/2):n.orientation=="righttoleft"?(o-=n._graphNodes[i.name].y+l/2,s+=n._graphNodes[i.name].x+r+a/2):n.orientation=="toptobottom"?(o+=n._graphNodes[i.name].x+r+l/2,s+=n._graphNodes[i.name].y+a/2):(o+=n._graphNodes[i.name].x+r+l/2,s-=n._graphNodes[i.name].y+a/2),n._graphNodes&&(b=n._graphNodes[i.name],b&&(k=b.tree,k.enableRouting||(n.diagram.minSpaceBetweenNode||(n.diagram.minSpaceBetweenNode=[]),n.diagram.minSpaceBetweenNode.push(i.name)))),f=f?f:0,e=e?e:0,o+=f,s+=e,i.inEdges&&i.inEdges.length>1){for(v=[],w=0;w<i.inEdges.length;w++)d=n.diagram.nameTable[i.inEdges[w]],y=n.diagram.nameTable[d.sourceNode],y&&y.outEdges&&y.outEdges.length<=1&&v.push(y.name);v&&v.length>0&&(p=this._getGroupBounds(v,n,r),n.orientation==="toptobottom"||n.orientation==="bottomtotop"?f=p.x+p.width/2-o:e=p.y+p.height/2-s,o+=f,s+=e)}n.updateView?n.diagram._translate(i,o-(i.offsetX||0),s-(i.offsetY||0),n.diagram.nameTable):(u=i.name==n.fixedNode||u,!u&&this._withinView(o,s,l,a,i,n)?(o!=i.offsetX||s!=i.offsetY)&&n.objects.push({object:i.name,diff:o-i.offsetX,diffy:s-i.offsetY}):n.diagram._translate(i,o-(i.offsetX||0),s-(i.offsetY||0),n.diagram.nameTable))}if(g=[],this._hasChild(n,i))for(h=0;h<n._graphNodes[i.name].tree.children.length;h++)c=n.diagram.nameTable[n._graphNodes[i.name].tree.children[h]],this._updateNodes(n,c,r+(n._graphNodes[i.name].subTreeTranslation||0),u,f,e),g.push(c);if(n._graphNodes[i.name].tree.assistants.length)for(h=0;h<n._graphNodes[i.name].tree.assistants.length;h++)c=n.diagram.nameTable[n._graphNodes[i.name].tree.assistants[h]],this._updateNodes(n,c,r+(n._graphNodes[i.name].subTreeTranslation||0),null,f,e);n.diagram._updateQuad(n.diagram.nameTable[i.name]);n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(i,n.diagram)},_withinView:function(n,t,i,r,u,f){var e=f.diagram.model.scrollSettings.horizontalOffset/f.diagram.model.scrollSettings.currentZoom,o=f.diagram.model.scrollSettings.verticalOffset/f.diagram.model.scrollSettings.currentZoom,s=f.diagram.model.scrollSettings.viewPortWidth/f.diagram.model.scrollSettings.currentZoom+e,h=f.diagram.model.scrollSettings.viewPortHeight/f.diagram.model.scrollSettings.currentZoom+o;return(n+i/2>e||u.offsetX+i/2>e)&&(n-i/2<s||u.offsetX-i/2<s)&&(t+r/2>o||u.offsetY+r/2>o)&&(t-r/2<h||u.offsetY-r/2<h)?!0:!1},_getDimensions:function(n,t,i,r,u){var f=t.width?t.width:t._width,e=t.height?t.height:t._height,o;return(n.orientation=="lefttoright"||n.orientation=="righttoleft")&&(u||(o=i,i=r,r=o),e=t.width?t.width:t._width,f=t.height?t.height:t._height),{x:i,y:r,width:f,height:e}},_getParentNode:function(n,t){if(t.inEdges&&t.inEdges.length)return n.diagram.nameTable[n.diagram.nameTable[t.inEdges[0]].sourceNode]},_hasChild:function(n,t){var t=n._graphNodes[t.name];return t.tree.children&&t.tree.children.length},_setUpLayoutInfo:function(n){var t={};return t.subTreeTranslation=0,n.type=="organizationalchart"?t.tree={orientation:"vertical",type:"alternate",offset:20,enableRouting:!0}:n.type=="hierarchicaltree"&&(t.tree={orientation:"horizontal",type:"center",enableRouting:!0}),t.tree.children=[],t.tree.assistants=[],t.tree.level=0,t.translate=!0,t}};t.datavisualization.Diagram.RadialTreeLayout={doLayout:function(n){var r,i,t;for(r=n.diagram,i=r.nodes(),t=0;t<i.length;t++)i[t].excludeFromLayout||(n._graphNodes[i[t].name]=this._setUpLayoutInfo(n,i[t]),i[t].inEdges&&i[t].inEdges.length||n._firstLevelNodes.push(i[t]));n.rootNode&&r.nameTable[n.rootNode]?n._centerNode=r.nameTable[n.rootNode]:n._firstLevelNodes.length&&(n._centerNode=n._firstLevelNodes[0],r.model.layout.rootNode=n._centerNode.name);n._centerNode&&(this._updateEdges(n,n._centerNode,0),this._depthFirstAllignment(n,n._centerNode,0,0),this._populateLevels(n),this._transformToCircleLayout(n),this._updateAnchor(n),this._updateNodes(n,n._centerNode))},_updateEdges:function(n,t,i){var u=n._graphNodes[t.name],f,r;for(n.layoutNodes.push(u),u.level=i,u.visited=!0,n.maxLevel=Math.max(n.maxLevel,i),f=0;f<t.outEdges.length;f++)r=n.diagram.nameTable[n.diagram.nameTable[t.outEdges[f]].targetNode],r.excludeFromLayout||r.visited||(u.children.push(r),this._updateEdges(n,r,i+1))},_depthFirstAllignment:function(n,t,i,r){var s,u,o,f,e;if(t){if(u=n._graphNodes[t.name],u.children.length){for(r+=300,e=0;e<u.children.length;e++)s=this._depthFirstAllignment(n,u.children[e],i,r),i=s.x,r=s.y;if(u.children=u.children.sort(function(t,i){return n._graphNodes[t.name].x-n._graphNodes[i.name].x}),o=n._graphNodes[u.children[0].name].min,f=n._graphNodes[u.children[u.children.length-1].name].max,u.x=o+(f-o)/2,i=f+n.horizontalSpacing,u.segmentOffset=f+n.horizontalSpacing,u.x-=u.width/2,u.y-=u.height/2,u.min=o,u.max=f,u.x<o&&u.visited){for(u.x=o,i=u.x+u.width/2-(f-o)/2,u.visited=!1,e=0;e<u.children.length;e++)s=this._depthFirstAllignment(n,u.children[e],i,r);u.visited=!0;i=u.x+u.width+n.horizontalSpacing}f=n._graphNodes[u.children[u.children.length-1].name].segmentOffset;i=i<f?f:i;r-=300;u.y=r}else u.x=i,u.y=r,u.min=i,u.max=i+u.width,i+=u.width+n.horizontalSpacing;return{x:i,y:r}}},_populateLevels:function(n){var i=[],e=Math.min.apply(Math,n.layoutNodes.map(function(n){return n.x})),o=Math.max.apply(Math,n.layoutNodes.map(function(t){return t.x+t.width+n.horizontalSpacing})),s=o-e,r,t,u,f;for(n.levels=[],r=0;r<=n.maxLevel;r++){for(i=n.layoutNodes.filter(function(n){if(n.level==r)return n}),t={},i=i.sort(function(n,t){return n.x-t.x}),t.min=i[0].x,t.max=i[i.length-1].x+i[i.length-1].width+n.horizontalSpacing,t._actualCircumference=0,t.height=0,u=0;u<i.length;u++)i[u].height>t.height&&(t.height=i[u].height),t._actualCircumference+=Math.max(i[u].width,i[u].height),u!=i.length-1&&(t._actualCircumference+=n.horizontalSpacing);for(t.circumference=t.max-t.min,t._actualCircumference<t.circumference&&(t.circumference=(t.circumference+t._actualCircumference)/2),t.radius=t.circumference/(2*Math.PI)+t.height,t.nodes=[],r>1&&n.levels[r-1].radius+n.levels[r-1].height>=t.radius&&(t.radius=n.levels[r-1].radius+n.levels[r-1].height),f=0;f<i.length;f++)i[f].ratio=Math.abs(i[f].x+i[f].width/2-e)/s,t.nodes.push(i[f]);n.levels.push(t)}},_transformToCircleLayout:function(n){var u=n._graphNodes[n._centerNode.name],t,r,i;for(u.x=0,u.y=0,t=1;t<n.levels.length;t++)for(r=0;r<n.levels[t].nodes.length;r++)i=n.levels[t].nodes[r],i.x=Math.cos(i.ratio*360*Math.PI/180)*(n.levels[t].radius+n.verticalSpacing*t),i.y=Math.sin(i.ratio*360*Math.PI/180)*(n.levels[t].radius+n.verticalSpacing*t),n._anchorX=Math.min(n._anchorX,i.x),n._anchorY=Math.min(n._anchorY,i.y)},_updateAnchor:function(n){var i=t.datavisualization.Diagram.ScrollUtil._viewPort(n.diagram);n._anchorX=i.width/2;n._anchorY=i.height/2},_updateNodes:function(n,i){var r=n._graphNodes[i.name],e=r.x+n._anchorX,o=r.y+n._anchorY,u,f;for(n.diagram._translate(i,e-i.offsetX||0,o-i.offsetY||0,n.diagram.nameTable),u=0;u<r.children.length;u++)f=r.children[u],this._updateNodes(n,n.diagram.nameTable[f.name]);n.diagram._svg&&t.datavisualization.Diagram.DiagramContext.update(i,n.diagram)},_isValidLayout:function(n){if(n._centerNode){var t=Math.max.apply(Math,n.diagram.nodes().map(function(n){return n.inEdges.length}));if(t<2)return!0}return!1},_setUpLayoutInfo:function(n,t){var i={};return i.name=t.name,i.x=0,i.y=0,i.min=0,i.max=0,i.width=t.width?t.width:t._width,i.height=t.height?t.height:t._height,i.children=[],i.level=0,i.ratio=0,i.visited=!1,i}}}(jQuery,Syncfusion),function(n,t){"use strict";t.datavisualization.Diagram.ZoomUtil={zoomPan:function(i,r,u,f,e,o){var h,c,a,v,y;if(o&&t.datavisualization.Diagram.Util.canZooming(i)||!o&&t.datavisualization.Diagram.Util.canPanning(i)){var l=t.datavisualization.Diagram.ScrollUtil._viewPort(i,!0),p={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:l},s=t.Matrix.identity();t.Matrix.scale(s,i._currZoom,i._currZoom);t.Matrix.translate(s,-i._hScrollOffset,-i._vScrollOffset);h=i._currZoom*r;h>30?r=30/i._currZoom:h<.25&&(r=.25/i._currZoom);c=t.Matrix.identity();a=e?t.Matrix.transform(s,e):t.datavisualization.Diagram.Point(n(i.element).width()/2,n(i.element).height()/2);t.Matrix.scale(c,r,r,a.x,a.y);h=i._currZoom*r;t.Matrix.translate(c,u,f);t.Matrix.multiply(s,c);v=t.Matrix.transform(s,t.datavisualization.Diagram.Point(0,0));i._compareModelProperty("scrollSettings",!0);this._applyTransform(i,h,v,o,l);y={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:l};i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Zoom;o||(i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Pan);i._raiseEvent("scrollChange",{newValues:y,oldValues:p})}},_applyTransform:function(n,i,r,u,f){n._currZoom=i;var e=r.x*-1,o=r.y*-1,s=n._getDigramBounds();if(!u&&n._scrollLimit()!==t.datavisualization.Diagram.ScrollLimit.Infinity)if(n._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Diagram){s.x-=n.model.scrollSettings.padding.left;s.y-=n.model.scrollSettings.padding.top;s.width+=n.model.scrollSettings.padding.left+n.model.scrollSettings.padding.right;s.height+=n.model.scrollSettings.padding.top+n.model.scrollSettings.padding.bottom;var h=s.width*n._currZoom>f.width,c=s.height*n._currZoom>f.height,l=(s.width+s.x)*n._currZoom-f.width,a=(s.height+s.y)*n._currZoom-f.height;!h&&e>n._hScrollOffset&&e>s.x*n._currZoom||h&&e<n._hScrollOffset&&e<s.x*n._currZoom?e=n._hScrollOffset:(!h&&e<n._hScrollOffset&&e<l||h&&e>n._hScrollOffset&&e>l)&&(e=n._hScrollOffset);!c&&o>n._vScrollOffset&&o>s.y*n._currZoom||c&&o<n._vScrollOffset&&o<s.y*n._currZoom?o=n._vScrollOffset:(!c&&o<n._vScrollOffset&&o<a||c&&o>n._vScrollOffset&&o>a)&&(o=n._vScrollOffset)}else e<n._hScrollbar.model.minimum&&!(n._hScrollbar.model.minimum==0&&-n._hScrollOffset>r.x)?e=n._hScrollOffset:e>n._hScrollbar.model.maximum&&(e=n._hScrollbar.model.maximum),o<n._vScrollbar.model.minimum&&!(n._vScrollbar.model.minimum==0&&-n._vScrollOffset>r.y)?o=n._vScrollOffset:o>n._vScrollbar.model.maximum&&(o=n._vScrollbar.model.maximum);n._updateScrollOffset(e,o,!0,u)}};t.datavisualization.Diagram.PageUtil={_createPageBreaks:function(n){this._removePageBreaks(n);var i={id:n._canvas.id+"pagebreaks","pointer-events":"none"},r=t.datavisualization.Diagram.SvgContext._initializePageBreaks(n._svg,i,n._pageBackgroundLayer);this._updatePageBreaks(r,n)},_removePageBreaks:function(n){var i=n._svg.getElementById(n._canvas.id+"pagebreaks");i&&t.datavisualization.Diagram.SvgContext._removePageBreaks(n._svg,i,n._pageBackgroundLayer)},_updatePageBreaks:function(n,i){var o=i._getDigramBounds(),k=i.model.pageSettings,r=o.x,w=o.width+o.x,u=o.y,b=o.height+o.y,f=i._currZoom,a=i._pageHeight(),v=i._pageWidth(),e=i._pageMargin(),y=parseInt(Math.ceil((w-r)/v)),p=parseInt(Math.ceil((b-u)/a)),s,h,c,l;for(r=-i._canvas.clientLeft+(e+r)*f,u=-i._canvas.clientTop+(e+u)*f,s=(v*y-e*2)*f,h=(a*p-e*2)*f,t.datavisualization.Diagram.SvgContext._renderVPageBreakLine(t.datavisualization.Diagram.Point(r,u),t.datavisualization.Diagram.Point(r+s,u),i._svg,n),t.datavisualization.Diagram.SvgContext._renderHPageBreakLine(t.datavisualization.Diagram.Point(r,u),t.datavisualization.Diagram.Point(r,u+h),i._svg,n),c=1;c<y;c++)t.datavisualization.Diagram.SvgContext._renderVPageBreakLine(t.datavisualization.Diagram.Point(r+(v*c-e)*f,u),t.datavisualization.Diagram.Point(r+(v*c-e)*f,u+h),i._svg,n);for(l=1;l<p;l++)t.datavisualization.Diagram.SvgContext._renderHPageBreakLine(t.datavisualization.Diagram.Point(r,u+(a*l-e)*f),t.datavisualization.Diagram.Point(r+s,u+(a*l-e)*f),i._svg,n);t.datavisualization.Diagram.SvgContext._renderVPageBreakLine(t.datavisualization.Diagram.Point(r+s,u),t.datavisualization.Diagram.Point(r+s,u+h),i._svg,n);t.datavisualization.Diagram.SvgContext._renderHPageBreakLine(t.datavisualization.Diagram.Point(r,u+h),t.datavisualization.Diagram.Point(r+s,u+h),i._svg,n)},_updatePageSize:function(n,i){var f=!1,e,l;n._pageOrientation()==t.datavisualization.Diagram.PageOrientations.Landscape?n._pageHeight()>n._pageWidth()&&(f=!0):n._pageWidth()>n._pageHeight()&&(f=!0);f&&(e=n._pageWidth(),n._pageWidth(n._pageHeight()),n._pageHeight(e));var r=n._getDigramBounds(),u=n._currZoom,o=r.x*u,s=r.y*u,h=r.width*u,c=r.height*u,a=n.model.pageSettings;n._pageBackgroundLayer&&n._pageBackgroundLayer.firstChild?t.datavisualization.Diagram.SvgContext._updatePageBakground(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),n._svg,n._pageBackgroundLayer,n._pageBorderColor(),n._pageBackgroundColor(),n._pageBorderWidth()):t.datavisualization.Diagram.SvgContext._renderPageSettingsRect(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),n._svg,n._pageBackgroundLayer,n._pageBorderColor(),n._pageBackgroundColor(),n._pageBorderWidth());n.model.backgroundImage&&n.model.backgroundImage.source&&t.datavisualization.Diagram.SvgContext._updateBackground(n._hScrollOffset,n._vScrollOffset,n._currZoom,n);n._svg.document.style.left=0;n._svg.document.style.top=0;l=!1;n._pageWidth()||n._pageHeight()||(l=!0);a.pageWidth&&n._pageHeight()&&(n._showPageBreak()?this._createPageBreaks(n):this._removePageBreaks(n));i||t.datavisualization.Diagram.ScrollUtil._setScrollContentSize(n)}};t.datavisualization.Diagram.ScrollUtil={_transform:function(n,i,r,u){t.datavisualization.Diagram.SvgContext.transformView(n,-i,-r);u&&t.datavisualization.Diagram.SvgContext.scaleContent(n,n._currZoom);t.datavisualization.Diagram.PageUtil._updatePageSize(n);t.datavisualization.Diagram.SvgContext._updateGrid(i,r,n._currZoom,n)},_viewPort:function(n,i){var o;if(n._viewPort&&!i)return n._viewPort;var h=n.element[0],r=n.element[0].getBoundingClientRect(),u=r.width,f=n._vScrollbar&&n._vScrollbar.model.height?n._vScrollbar.model.height:null,e=f?r.height===f?f+18:r.height:r.height,s=window.screenX<0?window.screenX*-1:window.screenX;return u===0&&(u=Math.floor(window.innerWidth-s-Math.floor(r.left))),o=window.screenY<0?window.screenY*-1:window.screenY,e===0&&(e=Math.floor(window.innerHeight-o-Math.floor(r.window))),t.datavisualization.Diagram.Size(u,e)},_union:function(n,t){var i,r,u,f;return n.width<=0?t:n.width>0?(i=Math.min(n.x,t.x),r=Math.min(n.y,t.y),t.width===Infinity||n.width===Infinity?n.width=Infinity:(u=Math.max(n.x+n.width,t.x+t.width),n.width=Math.max(u-i,0)),t.height===Infinity||n.height===Infinity?n.height=Infinity:(f=Math.max(n.y+n.height,t.y+t.height),n.height=Math.max(f-r,0)),n.x=i,n.y=r,n):void 0},_setScrollContentSize:function(i){var l=i._currZoom,u=this._viewPort(i),a,v,r,p,b,y,w,k,c,d;u=t.datavisualization.Diagram.Rectangle(i._hScrollOffset,i._vScrollOffset,u.width,u.height);var h=i.model.scrollSettings.padding,f=i._spatialSearch.pageLeft,o=i._spatialSearch.pageRight,e=i._spatialSearch.pageTop,s=i._spatialSearch.pageBottom;f>o&&(f=o=0);e>s&&(e=s=0);i.model.pageSettings&&(a=Number(i._pageWidth()),v=Number(i._pageHeight()),a>0&&v>0?(i._multiplePage()?(f=Math.floor(f/a)*a,e=Math.floor(e/v)*v,o=Math.ceil(o/a)*a,s=Math.ceil(s/v)*v):(f=0,e=0,o=a,s=v),f-=h.left,o+=h.right,e-=h.top,s+=h.bottom):(f=f<0?f:0,e=e<0?e:0,o=o>u.width?o:u.width,s=s>u.height?s:u.height,i._spatialSearch.pageLeft-f<h.left&&(f+=i._spatialSearch.pageLeft-f-h.left),i._spatialSearch.pageTop-e<h.top&&(e+=i._spatialSearch.pageTop-e-h.top),i._spatialSearch.pageRight+h.right>u.width&&i._spatialSearch.pageRight<u.width?o+=h.right+i._spatialSearch.pageRight-u.width:i._spatialSearch.pageRight>u.width&&(o+=h.right),i._spatialSearch.pageBottom+h.bottom>u.height&&i._spatialSearch.pageBottom<u.height?s+=h.bottom+i._spatialSearch.pageBottom-u.height:i._spatialSearch.pageBottom>u.height&&(s+=h.bottom)));f=f*l;e=e*l;o=o*l;s=s*l;r=t.datavisualization.Diagram.Rectangle(0,0,0,0);r=this._union(r,t.datavisualization.Diagram.Rectangle(0,0,u.width,u.height));r=this._union(r,t.datavisualization.Diagram.Geometry.rect([{x:f,y:e},{x:o,y:s}]));r.width-=u.width;r.height-=u.height;r.x>i._hScrollOffset&&(y=r.x-i._hScrollOffset,r.x-=y,r.width+=y);i._hScrollOffset>r.x+r.width&&(r.width=i._hScrollOffset-r.x);p=r.x;b=Math.max(0,r.x+r.width);r.y>i._vScrollOffset&&(y=r.y-i._vScrollOffset,r.y-=y,r.height+=y);i._vScrollOffset>r.y+r.height&&(r.height=i._vScrollOffset-r.y);w=r.y;k=Math.max(0,r.y+r.height);r.width=r.width<u.width?u.width:r.width;r.height=r.height<u.height?u.height:r.height;i._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Limited&&(c=i.model.pageSettings.scrollableArea,p=c.x*l,w=c.y*l,b=(c.x+c.width)*l-u.width,k=(c.y+c.height)*l-u.height,s=(c.y+c.height)*l,o=(c.x+c.width)*l,e=c.y*l,f=c.x*l);f>=i._hScrollOffset&&o<=u.width+i._hScrollOffset?(i._hScrollbar._remove(),i._hScrollbar.model.width=0,i._hScrollbar.model.minimum=i._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Limited?Math.min(0,p):0,i._hScrollbar.model.maximum=0):(i._preventScrollerUpdate?(i._hScrollbar.model.minimum=p,i._hScrollbar.model.maximum=b):(n("#"+i._canvas.id+"_hScrollbar").ejScrollBar({width:u.width-18,viewportSize:u.width-18,maximum:b,minimum:p}),n("#"+i._canvas.id+"_hScrollbar").ejScrollBar("scroll",i._hScrollOffset)),d=document.getElementById(i._canvas.id+"_hScrollbar"),d.style.marginTop=u.height-18+"px");e>=i._vScrollOffset&&s<=u.height+i._vScrollOffset?(i._vScrollbar._remove(),i._vScrollbar.model.height=0,i._vScrollbar.model.minimum=i._scrollLimit()===t.datavisualization.Diagram.ScrollLimit.Limited?Math.min(0,w):0,i._vScrollbar.model.maximum=0):i._preventScrollerUpdate?(i._vScrollbar.model.minimum=w,i._vScrollbar.model.maximum=k):(n("#"+i._canvas.id+"_vScrollbar").ejScrollBar({height:u.height-18,viewportSize:u.height-18,maximum:k,minimum:w}),n("#"+i._canvas.id+"_vScrollbar").ejScrollBar("scroll",i._vScrollOffset));i._isMobile&&i._disableScrollbar();t.datavisualization.Diagram.SvgContext.setSize(i,r.width,r.height)},_setMinMaxValues:function(n,t,i,r,u,f,e){var o=n.model.pageSettings.scrollableArea;return t=Math.max(t,o.x*e),i=Math.max(i,o.y*e),r=Math.min((o.x+o.width)*e-f.width,r),u=Math.min((o.y+o.height)*e-f.height,u),r=r>0?r:0,u=u>0?u:0,{minX:t,minY:i,maxX:r,maxY:u}},_initScrollbar:function(i){var u=i._canvas,f=document.getElementById(u.id+"_hScrollbar"),e=document.getElementById(u.id+"_vScrollbar"),r=this._viewPort(i);n(f).ejScrollBar({orientation:t.ScrollBar.Orientation.Horizontal,width:r.width-18,viewportSize:r.width-18,scroll:function(n){var r,u;n.source!=null&&(n.source=="thumb"||n.source=="button"||n.source=="key")&&n.scrollData!=null&&(r={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._updateScrollOffset(n.scrollLeft,i._vScrollOffset),u={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._compareModelProperty("scrollSettings",!0),i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Pan,i._raiseEvent("scrollChange",{newValues:u,oldValues:r}))}});i._hScrollbar=n(f).ejScrollBar("instance");n(e).ejScrollBar({orientation:t.ScrollBar.Orientation.Vertical,height:r.height-18,viewportSize:r.height-18,scroll:function(n){var r,u;n.source!=null&&(n.source=="thumb"||n.source=="button"||n.source=="key")&&n.scrollData!=null&&(r={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._updateScrollOffset(i._hScrollOffset,n.scrollTop),u={zoom:i._getCurrentZoom(),horizontalOffset:i._hScrollOffset,verticalOffset:i._vScrollOffset,viewPort:i._viewPort},i._compareModelProperty("scrollSettings",!0),i._eventCause.scrollChange=t.datavisualization.Diagram.ScrollChangeCause.Pan,i._raiseEvent("scrollChange",{newValues:u,oldValues:r}))}});i._vScrollbar=n(e).ejScrollBar("instance")}};t.datavisualization.Diagram.SnapUtil={_canConsider:function(n,t,i){var r=!1;return t!=i&&(t._type=="group"||t._type=="pseudoGroup"?r=i.isSwimlane&&!t.isSwimlane?!1:!this._contains(n,t,i):i._type=="group"&&i.type!="bpmn"||i.type=="pseudoGroup"?r=i.isSwimlane&&!t.isSwimlane?!1:!this._contains(n,i,t):t.segments||(r=!(t==i))),r},_contains:function(n,t,i){var e=i.name,o=null,f,u,r;if(t.children.indexOf(e)>=0){if(o=n[e],o==i)return!0}else if(t.children.indexOf(i)>=0)return!0;if(t._type=="group"||t._type=="pseudoGroup"){for(f=!1,u=0;u<t.children.length;u++)if(this.diagram&&(r=typeof t.children[u]=="string"?n[t.children[u]]:n[t.children[u].name],r&&(typeof r=="string"&&(r=n[r]),r._type=="group"&&(f=this._contains(n,r,i)),f)))return f;return f}return!1},_round:function(n,t,i){var f,r;for(i=i>1?Math.pow(2,Math.floor(Math.log(i)/Math.log(2))):Math.pow(2,Math.ceil(Math.log(i)/Math.log(2))),f=0,r=0;r<t.length;r++)f+=t[r];f/=i;var o=Math.floor(Math.abs(n)/f),e=n%f,u=o*f;if(u!=n)if(n>=0)for(r=0;r<t.length;r++){if(e<=t[r]/i)return u+(e<t[r]/(2*i)?0:t[r]/i);u+=t[r]/i;e-=t[r]/i}else for(u=u*-1,r=t.length-1;r>=0;r--){if(Math.abs(e)<=t[r]/i)return u-(Math.abs(e)<t[r]/(2*i)?0:t[r]/i);u-=t[r]/i;e+=t[r]/i}return n},_findNodes:function(n,i,r,u,f){for(var c=[],o,e,l,h,a=t.datavisualization.Diagram.SpatialUtil.findQuads(n,f?u:r),s=0;s<a.length;s++)if(o=a[s],o.objects.length>0)for(h=0;h<o.objects.length;h++)e=o.objects[h],!e.segments&&e.visible&&(l=t.datavisualization.Diagram.Util.bounds(e),c.indexOf(e)==-1&&t.datavisualization.Diagram.Geometry.intersectsRect(r,l)&&c.push(e),f&&f.indexOf(e)&&t.datavisualization.Diagram.Geometry.intersectsRect(u,l)&&f.push(e));return c},_snapAngle:function(n,t){var i=n._snapAngle(),r=t%i;return r>=i/2?t+i-r:t-r},_snapPoint:function(n,i,r,u,f,e,o){var c=n.model.snapSettings,l=n._currZoom,h=t.datavisualization.Diagram.Point(),s=t.datavisualization.Diagram.Util.bounds(i),k={snapped:!1,offset:0},d={snapped:!1,offset:0};this.diagram=n;n._enableSnapToObject()&&this._snapObject(n,i,k,d,f,o==e);var g=s.x+f.x,nt=s.y+f.y,tt=s.x+s.width+f.x,it=s.y+s.height+f.y,a=this._round(tt,c.verticalGridLines.snapInterval,l),v=this._round(g,c.verticalGridLines.snapInterval,l),y=this._round(nt,c.horizontalGridLines.snapInterval,l),p=this._round(it,c.horizontalGridLines.snapInterval,l),w=s.x+s.width,b=s.y+s.height;return k.snapped?h.x=n._enableSnapToObject()?k.offset:e.x-o.x:n._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToVerticalLines?Math.abs(f.x)>=1&&(h.x+=r?Math.abs(a-w)>Math.abs(v-s.x)?v-s.x:a-w:Math.abs(a-w)<Math.abs(v-s.x)?a-w:v-s.x):h.x=e.x-o.x,d.snapped?h.y=d.offset:n._snapConstraints()&t.datavisualization.Diagram.SnapConstraints.SnapToHorizontalLines?Math.abs(f.y)>=1&&(h.y+=u?Math.abs(p-b)>Math.abs(y-s.y)?y-s.y:p-b:Math.abs(p-b)<Math.abs(y-s.y)?p-b:y-s.y):h.y=e.y-o.y,h},_snapObject:function(n,i,r,u,f,e){var v=null,y=null,w,b,d=[],g=[],it=[],rt=[],o=t.datavisualization.Diagram.Util.bounds(i),l=n._currZoom,ut=n._hScrollOffset,ft=n._vScrollOffset,h=n._snapObjectDistance(),p=n._viewPort,et=t.datavisualization.Diagram.Rectangle(ut/l,o.y-h-5,p.width/l,o.height+2*h+10),ot=t.datavisualization.Diagram.Rectangle(o.x-h-5,ft/l,o.width+2*h+10,p.height/l),k,a,c,s,nt,tt;for(p=t.datavisualization.Diagram.Rectangle(ut/l,ft/l,p.width/l,p.height/l),k=this._findNodes(n._spatialSearch,i,ot,p),nt=n.nameTable,a=0;a<k.length;a++)c=k[a],t.datavisualization.Diagram.Util._canBeTarget(n,c)&&!c.segments&&this._canConsider(nt,i,c)&&(s=t.datavisualization.Diagram.Util.bounds(c),s.y+s.height<o.y+f.y?it.push({object:c,distance:Math.abs(o.y+f.y-s.y-s.height)}):s.y>o.y+f.y+o.height&&rt.push({object:c,distance:Math.abs(o.y+f.y+o.height-s.y)}),(v==null||v>Math.abs(s.y-o.y-f.y))&&(Math.abs(s.x+s.width/2-(o.x+o.width/2+f.x))<=h?(w=this._createSnapObject(s,o,"centerX"),v=Math.abs(s.y-o.y)):Math.abs(s.x-(o.x+f.x))<=h?(w=this._createSnapObject(s,o,"left"),v=Math.abs(s.y-o.y)):Math.abs(s.x+s.width-(o.x+o.width+f.x))<=h?(w=this._createSnapObject(s,o,"right"),v=Math.abs(s.y-o.y)):Math.abs(s.x+s.width-(o.x+f.x))<=h?(w=this._createSnapObject(s,o,"leftRight"),v=Math.abs(s.y-o.y)):Math.abs(s.x-(o.x+o.width+f.x))<=h&&(w=this._createSnapObject(s,o,"rightLeft"),v=Math.abs(s.y-o.y))));for(k=this._findNodes(n._spatialSearch,i,et,p),a=0;a<k.length;a++)c=k[a],t.datavisualization.Diagram.Util._canBeTarget(n,c)&&!c.segments&&this._canConsider(nt,i,c)&&(s=t.datavisualization.Diagram.Util.bounds(c),s.x+s.width<o.x+f.x&&(d[d.length]={object:c,distance:Math.abs(o.x+f.x-s.x-s.width)}),s.x>o.x+f.x+o.width&&(g[g.length]={object:c,distance:Math.abs(o.x+f.x+o.width-s.x)}),(y==null||y>Math.abs(s.x-o.x-f.x))&&(Math.abs(s.y+s.height/2-(o.y+o.height/2+f.y))<=h?(b=this._createSnapObject(s,o,"centerY"),y=Math.abs(s.x-o.x)):Math.abs(s.y-o.y-f.y)<=h?(b=this._createSnapObject(s,o,"top"),y=Math.abs(s.x-o.x)):Math.abs(s.y+s.height-(o.y+o.height+f.y))<=h?(b=this._createSnapObject(s,o,"bottom"),y=Math.abs(s.x-o.x)):Math.abs(s.y+s.height-o.y-f.y)<=h?(b=this._createSnapObject(s,o,"topBottom"),y=Math.abs(s.x-o.x)):Math.abs(s.y-(o.y+o.height+f.y))<=h&&(b=this._createSnapObject(s,o,"bottomTop"),y=Math.abs(s.x-o.x))));tt=this._createGuidelines(n,w,b,r,u,e);r.snapped||this._createHSpacingLines(n,i,d,g,r,u,e,tt,f,h);u.snapped||this._createVSpacingLines(n,i,it,rt,r,u,e,tt,f,h)},_snapSize:function(n,i,r,u,f,e,o){var p=null,w=null,d,g,s=t.datavisualization.Diagram.Util.bounds(e),ut=n.nameTable,nt=[],tt=[],l=n._currZoom,st=n._hScrollOffset,ht=n._vScrollOffset,v=n._snapObjectDistance(),y=n._viewPort,lt=t.datavisualization.Diagram.Rectangle(st/l,(s.y-5)/l,y.width/l,(s.height+10)/l),at=t.datavisualization.Diagram.Rectangle((s.x-5)/l,ht/l,(s.width+10)/l,y.height/l),it,b,a,c,h,et,ot;for(y=t.datavisualization.Diagram.Rectangle(st/l,ht/l,y.width/l,y.height/l),it=[],b=this._findNodes(n._spatialSearch,e,at,y,it),a=0;a<b.length;a++)c=b[a],this._canConsider(ut,e,c)&&!c.segments&&(h=t.datavisualization.Diagram.Util.bounds(c),(p==null||p>Math.abs(h.y-s.y))&&(i.left?Math.abs(s.x+u-h.x)<=v?(d=this._createSnapObject(h,s,"left"),p=Math.abs(h.y-s.y)):Math.abs(s.x+u-h.x-h.width)<=v&&(d=this._createSnapObject(h,s,"leftRight"),p=Math.abs(h.y-s.y)):i.right&&(Math.abs(s.x+u+s.width-h.x-h.width)<=v?(d=this._createSnapObject(h,s,"right"),p=Math.abs(h.y-s.y)):Math.abs(s.x+u+s.width-h.x)<=v&&(d=this._createSnapObject(h,s,"rightLeft"),p=Math.abs(h.y-s.y)))));for(b=this._findNodes(n._spatialSearch,e,lt,y),a=0;a<b.length;a++)c=b[a],this._canConsider(ut,e,c)&&!c.segments&&(h=t.datavisualization.Diagram.Util.bounds(c),(w==null||w>Math.abs(h.x-s.x))&&(r.top?Math.abs(s.y+f-h.y)<=v?(g=this._createSnapObject(h,s,"top"),w=Math.abs(h.x-s.x)):Math.abs(s.y+f-h.y-h.height)<=v&&(g=this._createSnapObject(h,s,"topBottom"),w=Math.abs(h.x-s.x)):r.bottom&&(Math.abs(s.y+s.height+f-h.y-h.height)<=v?(g=this._createSnapObject(h,s,"bottom"),w=Math.abs(h.x-s.x)):Math.abs(s.y+s.height+f-h.y)<=v&&(g=this._createSnapObject(h,s,"bottomTop"),w=Math.abs(h.x-s.x)))));for(a=0;a<it.length;a++)if(c=it[a],this._canConsider(ut,e,c)){var k=t.datavisualization.Diagram.Util.bounds(c),ft=i.left?-u:u,ct=Math.abs(s.width+ft-k.width),rt;ct<=v&&(rt=i.left?-k.width+s.width:k.width-s.width,nt[nt.length]={source:c,diff:ct,offset:rt});ft=r.top?-f:f;et=Math.abs(s.height+ft-k.height);et<=v&&(rt=r.top?-k.height+s.height:k.height-s.height,tt[tt.length]={source:c,diff:et,offset:rt})}n.activeTool.selectedSeperator||(ot=this._createGuidelines(n,d,g,i,r,o));!i.snapped&&nt.length>0&&(i.left||i.right)&&this._addSameWidthLines(n,nt,i,o,ot,e);!r.snapped&&tt.length>0&&(r.top||r.bottom)&&this._addSameHeightLines(n,tt,r,o,ot,e)},_createSnapObject:function(n,i,r){var u;switch(r){case"left":u={start:t.datavisualization.Diagram.Point(n.x,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x-i.x,offsetY:0,type:"sideAlign"};break;case"right":u={start:t.datavisualization.Diagram.Point(n.x+n.width,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x+n.width,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x+n.width-i.x-i.width,offsetY:0,type:"sideAlign"};break;case"top":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y),offsetY:n.y-i.y,offsetX:0,type:"sideAlign"};break;case"bottom":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y+n.height),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y+n.height),offsetY:n.y+n.height-i.y-i.height,offsetX:0,type:"sideAlign"};break;case"topBottom":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y+n.height),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y+n.height),offsetY:n.y+n.height-i.y,offsetX:0,type:"sideAlign"};break;case"bottomTop":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y),offsetY:n.y-i.y-i.height,offsetX:0,type:"sideAlign"};break;case"leftRight":u={start:t.datavisualization.Diagram.Point(n.x+n.width,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x+n.width,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x+n.width-i.x,offsetY:0,type:"sideAlign"};break;case"rightLeft":u={start:t.datavisualization.Diagram.Point(n.x,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x-i.x-i.width,offsetY:0,type:"sideAlign"};break;case"centerX":u={start:t.datavisualization.Diagram.Point(n.x+n.width/2,Math.min(n.y,i.y)),end:t.datavisualization.Diagram.Point(n.x+n.width/2,Math.max(n.y+n.height,i.y+i.height)),offsetX:n.x+n.width/2-(i.x+i.width/2),offsetY:0,type:"centerAlign"};break;case"centerY":u={start:t.datavisualization.Diagram.Point(Math.min(n.x,i.x),n.y+n.height/2),end:t.datavisualization.Diagram.Point(Math.max(n.x+n.width,i.x+i.width),n.y+n.height/2),offsetY:n.y+n.height/2-(i.y+i.height/2),offsetX:0,type:"centerAlign"}}return u},_createGuidelines:function(n,i,r,u,f,e){var l={id:n._canvas.id+"guideline",style:"pointer-events:none;"},o=t.datavisualization.Diagram.SvgContext._initializeGuidelines(n._adornerSvg,l,n._adornerLayer),s=n._currZoom,h=n._hScrollOffset,c=n._vScrollOffset;return i&&(u.offset=i.offsetX,u.snapped=!0,e||(i.type=="sideAlign"?t.datavisualization.Diagram.SvgContext._renderSideAlignmentLines(i.start,i.end,o,n._adornerSvg,s,h,c):i.type=="centerAlign"&&t.datavisualization.Diagram.SvgContext._renderCenterAlignmentLines(i.start,i.end,o,n._adornerSvg,s,h,c))),r&&(f.offset=r.offsetY,f.snapped=!0,e||(r.type=="sideAlign"?t.datavisualization.Diagram.SvgContext._renderSideAlignmentLines(r.start,r.end,o,n._adornerSvg,s,h,c):r.type=="centerAlign"&&t.datavisualization.Diagram.SvgContext._renderCenterAlignmentLines(r.start,r.end,o,n._adornerSvg,s,h,c))),o},_removeGuidelines:function(n){var i=n._adornerSvg.getElementById(n._canvas.id+"guideline");i!=null&&t.datavisualization.Diagram.SvgContext._removeGuidelines(n._adornerLayer,i)},_sortByDistance:function(n,t,i){var r,u,f;if(i)for(r=0;r<n.length;r++)for(u=r+1;u<n.length;u++)n[r][t]>n[u][t]&&(f=n[r],n[r]=n[u],n[u]=f);else for(r=0;r<n.length;r++)for(u=r+1;u<n.length;u++)n[r][t]<n[u][t]&&(f=n[r],n[r]=n[u],n[u]=f)},_createHSpacingLines:function(n,i,r,u,f,e,o,s,h,c){var a=null,l,w,p,y,b,v,d,g,k;this._sortByDistance(r,"distance",!0);this._sortByDistance(u,"distance",!0);l=[];w=t.datavisualization.Diagram.Util.bounds(i);r.length>0&&(l[l.length]=r[0],p=t.datavisualization.Diagram.Util.bounds(r[0].object),a=p.y,r.length>1?(b=t.datavisualization.Diagram.Util.bounds(r[1].object),v=p.x-b.x-b.width,Math.abs(v-r[0].distance)<=c?a=this._findEquallySpacedNodesAtLeft(r,v,a,l):v=r[0].distance):v=r[0].distance);this._sortByDistance(l,"distance");l[l.length]={object:i,distance:0};a=w.y<a||!a?w.y:a;u.length>0&&(y=t.datavisualization.Diagram.Util.bounds(u[0].object),a=y.y<a?y.y:a,u.length>1&&(b=t.datavisualization.Diagram.Util.bounds(u[1].object),d=b.x-y.x-y.width),r.length>0?Math.abs(u[0].distance-r[0].distance)<=c?(g=Math.abs(u[0].distance-r[0].distance)/2,u[0].distance<r[0].distance?v-=g:v+=g,l[l.length]=u[0]):r.length==1&&(p=undefined,l.splice(0,1),l[l.length]=u[0],v=d):(v=d,l[l.length]=u[0]),u.length>1&&y.x+y.width<b.x&&(a=this._findEquallySpacedNodesAtRight(u,d,a,l,c)));l.length>2&&(this._addHSpacingLines(n,l,o,s,a),k=0,o&&(k=h.x),p?f.offset=v-Math.abs(w.x+k-p.x-p.width)+k:y&&(f.offset=Math.abs(w.x+w.width+k-y.x)-v+k),f.snapped=!0)},_createVSpacingLines:function(n,i,r,u,f,e,o,s,h,c){var a=null,l,p,w,v,b,y,d,g,k;this._sortByDistance(r,"distance",!0);this._sortByDistance(u,"distance",!0);l=[];p=t.datavisualization.Diagram.Util.bounds(i);r.length>0&&(l[l.length]=r[0],w=t.datavisualization.Diagram.Util.bounds(r[0].object),a=w.x+w.width,r.length>1?(b=t.datavisualization.Diagram.Util.bounds(r[1].object),y=w.y-b.y-b.height,Math.abs(y-r[0].distance)<=c?a=this._findEquallySpacedNodesAtTop(r,y,a,l):y=r[0].distance):y=r[0].distance);this._sortByDistance(l,"distance");l[l.length]={object:i,distance:0};a=p.x+p.width>a||!a?p.x+p.width:a;u.length>0&&(v=t.datavisualization.Diagram.Util.bounds(u[0].object),a=v.x+v.width>a?v.x+v.width:a,u.length>1&&(b=t.datavisualization.Diagram.Util.bounds(u[1].object),d=b.y-v.y-v.height),r.length>0?Math.abs(u[0].distance-r[0].distance)<=c?(g=Math.abs(u[0].distance-r[0].distance)/2,u[0].distance<r[0].distance?y-=g:y+=g,l[l.length]=u[0]):r.length==1&&(w=undefined,l.splice(0,1),l[l.length]=u[0],y=d):(y=d,l[l.length]=u[0]),u.length>1&&b.y>v.y+v.height&&(a=this._findEquallySpacedNodesAtBottom(u,d,a,l,c)));l.length>2&&(this._addVSpacingLine(n,l,o,s,a),k=0,o&&(k=h.y),w?e.offset=y-Math.abs(p.y+k-w.y-w.height)+k:v&&(e.offset=Math.abs(p.y+p.height+k-v.y)-y+k),e.snapped=!0)},_addHSpacingLines:function(n,i,r,u,f){var h=n._currZoom,c=n._hScrollOffset,l=n._vScrollOffset,e,o,s;if(i.length>2&&!r)for(e=0;e<i.length-1;e++)o=t.datavisualization.Diagram.Util.bounds(i[e].object),s=t.datavisualization.Diagram.Util.bounds(i[e+1].object),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+o.width,f-15),t.datavisualization.Diagram.Point(s.x,f-15),u,n._adornerSvg,h,c,l)},_addVSpacingLine:function(n,i,r,u,f){var h=n._currZoom,c=n._hScrollOffset,l=n._vScrollOffset,o,s,e;if(i.length>2&&!r)for(e=0;e<i.length-1;e++)o=t.datavisualization.Diagram.Util.bounds(i[e].object),s=t.datavisualization.Diagram.Util.bounds(i[e+1].object),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(f+15,o.y+o.height),t.datavisualization.Diagram.Point(f+15,s.y),u,n._adornerSvg,h,c,l)},_addSameWidthLines:function(n,i,r,u,f,e){var l=n._currZoom,a=n._hScrollOffset,v=n._vScrollOffset,s,y;this._sortByDistance(i,"offset");var o=t.datavisualization.Diagram.Util.bounds(e),c=i[0],p=t.datavisualization.Diagram.Util.bounds(c.source),h=[];for(h.push(i[0]),s=1;s<i.length;s++)y=t.datavisualization.Diagram.Util.bounds(i[s].source),y.width==p.width&&h.push(i[s]);if(h.length>0&&!u)for(t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+c.offset,o.y-15),t.datavisualization.Diagram.Point(o.x+o.width+c.offset,o.y-15),f,n._adornerSvg,l,a,v),s=0;s<h.length;s++)o=t.datavisualization.Diagram.Util.bounds(h[s].source),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x,o.y-15),t.datavisualization.Diagram.Point(o.x+o.width,o.y-15),f,n._adornerSvg,l,a,v);r.offset=c.offset;r.snapped=!0},_addSameHeightLines:function(n,i,r,u,f,e){var l=n._currZoom,a=n._hScrollOffset,v=n._vScrollOffset,s,y;this._sortByDistance(i,"offset");var o=t.datavisualization.Diagram.Util.bounds(e),c=i[0],p=t.datavisualization.Diagram.Util.bounds(c.source),h=[];for(h.push(i[0]),s=0;s<i.length;s++)y=t.datavisualization.Diagram.Util.bounds(i[s].source),y.height==p.height&&h.push(i[s]);if(h.length>0){if(!u)for(t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+o.width+15,o.y+c.offset),t.datavisualization.Diagram.Point(o.x+o.width+15,o.y+o.height+c.offset),f,n._adornerSvg,l,a,v),s=0;s<h.length;s++)o=t.datavisualization.Diagram.Util.bounds(h[s].source),t.datavisualization.Diagram.SvgContext._renderSpacingLines(t.datavisualization.Diagram.Point(o.x+o.width+15,o.y),t.datavisualization.Diagram.Point(o.x+o.width+15,o.y+o.height),f,n._adornerSvg,l,a,v);r.offset=c.offset;r.snapped=!0}},_findEquallySpacedNodesAtLeft:function(n,i,r,u){for(var o,f,s,e=1;e<n.length;e++)if(o=t.datavisualization.Diagram.Util.bounds(n[e-1].object),f=t.datavisualization.Diagram.Util.bounds(n[e].object),s=o.x-f.x-f.width,Math.abs(s-i)<=1)u[u.length]=n[e],f.y<r&&(r=f.y);else break;return r},_findEquallySpacedNodesAtRight:function(n,i,r,u,f){var l=n[0].distance,s,h,o,c,e;if(Math.abs(i-l)<=f)for(e=0;e<n.length-1;e++)if(s=n[e].object,h=t.datavisualization.Diagram.Util.bounds(n[e+1].object),o=t.datavisualization.Diagram.Util.bounds(s),c=h.x-o.x-o.width,Math.abs(c-i)<=1)u[u.length]=n[e+1],o.y<r&&(r=o.y);else break;return r},_findEquallySpacedNodesAtTop:function(n,i,r,u){for(var o,f,s,e=1;e<n.length;e++)if(o=t.datavisualization.Diagram.Util.bounds(n[e-1].object),f=t.datavisualization.Diagram.Util.bounds(n[e].object),s=o.y-f.y-f.height,Math.abs(s-i)<=1)u[u.length]=n[e],f.x+f.width>r&&(r=f.x+f.width);else break;return r},_findEquallySpacedNodesAtBottom:function(n,i,r,u,f){var l=n[0].distance,s,h,e,c,o;if(Math.abs(i-l)<=f)for(o=0;o<n.length-1;o++)if(s=n[o].object,h=t.datavisualization.Diagram.Util.bounds(n[o+1].object),e=t.datavisualization.Diagram.Util.bounds(s),c=h.y-e.y-e.height,Math.abs(c-i)<=1)u[u.length]=n[o+1],e.x+e.width>r&&(r=e.x+e.width);else break;return r}};t.datavisualization.Diagram.SpatialUtil={findQuads:function(n,t){n.quads=[];var i=n.parentQuad;return this._findQuads(n,i,t),n.quads},_addIntoAQuad:function(n){for(var t=!1;!t;)t=this._add(n,n.parentQuad)},_setCurrentNode:function(n,i){n.childnode=i;var r=t.datavisualization.Diagram.Util.bounds(i);n.childLeft=r.left;n.childTop=r.top;n.childRight=r.right;n.childBottom=r.bottom},_add:function(n,i){if(this._isContained(n,i))return this._selectQuad(n,i),!0;var r,u=!i.objects.length&&i.first==null&&i.second==null&&i.third==null&&i.fourth==null;return n.childLeft<i.left?n.childTop<i.top?(r=t.datavisualization.Diagram.Quad(i.left-i.width,i.top-i.height,i.width*2,i.height*2),u||(r.fourth=i)):(r=t.datavisualization.Diagram.Quad(i.left-i.width,i.top,i.width*2,i.height*2),u||(r.second=i)):n.childTop<i.top?(r=t.datavisualization.Diagram.Quad(i.left,i.top-i.height,i.width*2,i.height*2),u||(r.third=i)):(r=t.datavisualization.Diagram.Quad(i.left,i.top,i.width*2,i.height*2),u||(r.first=i)),i.parent=r,n.parentQuad=r,!1},_isContained:function(n,t){return n.childLeft>=t.left&&n.childRight<=t.left+t.width&&n.childTop>=t.top&&n.childBottom<=t.top+t.height?!0:!1},_selectQuad:function(n,t){for(var i=t;i!==null;)i=this._getQuad(n,i)},_getQuad:function(n,i){var u=i.width/2,f=i.height/2,e,r;if(u>=100&&f>=100)if(e=i.left+u,r=i.top+f,n.childRight<=e){if(n.childBottom<=r)return i.first?i.first:i.first=t.datavisualization.Diagram.Quad(i.left,i.top,u,f,i);if(n.childTop>=r)return i.third?i.third:i.third=t.datavisualization.Diagram.Quad(i.left,r,u,f,i)}else if(n.childLeft>=e){if(n.childBottom<=r)return i.second?i.second:i.second=t.datavisualization.Diagram.Quad(e,i.top,u,f,i);if(n.childTop>=r)return i.fourth?i.fourth:i.fourth=t.datavisualization.Diagram.Quad(e,r,u,f,i)}return i.objects.push(n.childnode),n.quadTable[n.childnode.name]=i,null},_findQuads:function(n,t,i){t.first&&this._isIntersect(t.first,i)&&this._findQuads(n,t.first,i);t.second&&this._isIntersect(t.second,i)&&this._findQuads(n,t.second,i);t.third&&this._isIntersect(t.third,i)&&this._findQuads(n,t.third,i);t.fourth&&this._isIntersect(t.fourth,i)&&this._findQuads(n,t.fourth,i);t.objects.length>0&&n.quads.push(t)},_isIntersect:function(n,t){return n.left+n.width<t.x||n.top+n.height<t.y||n.left>t.x+t.width||n.top>t.y+t.height?!1:!0},_update:function(n){if(n.parent!=null&&n.objects.length==0&&n.first==null&&n.second==null&&n.third==null&&n.fourth==null){var t=n.parent;t.first==n?t.first=null:t.second==n?t.second=null:t.third==n?t.third=null:t.fourth==n&&(t.fourth=null);this._update(n.parent)}else return},_isWithinPageBounds:function(n,t){return t.left>=n.pageLeft&&t.right<=n.pageRight&&t.top>=n.pageTop&&t.bottom<=n.pageBottom?!0:!1},_updateBounds:function(n,i,r,u){var f=!1;i.topElement&&r.name==i.topElement.name&&(f=!0,i.pageTop=null,this._findQuadElement(i,i.parentQuad,"top"));i.leftElement&&r.name==i.leftElement.name&&(f=!0,i.pageLeft=null,this._findQuadElement(i,i.parentQuad,"left"));i.rightElement&&r.name==i.rightElement.name&&(f=!0,i.pageRight=null,this._findQuadElement(i,i.parentQuad,"right"));i.bottomElement&&r.name==i.bottomElement.name&&(f=!0,i.pageBottom=null,this._findQuadElement(i,i.parentQuad,"bottom"));f&&n._pageBackgroundLayer&&t.datavisualization.Diagram.PageUtil._updatePageSize(n,u!==undefined?u:!0)},_findQuadElement:function(n,i,r){var u,f;switch(r){case"bottom":i.third!=null||i.fourth!=null?(i.third!=null&&this._findQuadElement(n,i.third,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r)):(i.first!=null&&this._findQuadElement(n,i.first,r),i.second!=null&&this._findQuadElement(n,i.second,r));break;case"top":i.first!=null||i.second!=null?(i.first!=null&&this._findQuadElement(n,i.first,r),i.second!=null&&this._findQuadElement(n,i.second,r)):(i.third!=null&&this._findQuadElement(n,i.third,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r));break;case"left":i.first!=null||i.third!=null?(i.first!=null&&this._findQuadElement(n,i.first,r),i.third!=null&&this._findQuadElement(n,i.third,r)):(i.second!=null&&this._findQuadElement(n,i.second,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r));break;case"right":i.second!=null||i.fourth!=null?(i.second!=null&&this._findQuadElement(n,i.second,r),i.fourth!=null&&this._findQuadElement(n,i.fourth,r)):(i.third!=null&&this._findQuadElement(n,i.third,r),i.first!=null&&this._findQuadElement(n,i.first,r))}for(f=0;f<i.objects.length;f++)u=t.datavisualization.Diagram.Util.bounds(i.objects[f]),r==="bottom"&&(n.pageBottom<=u.bottom||n.pageBottom==null)?(n.pageBottom=u.bottom,n.bottomElement=i.objects[f]):r==="top"&&(n.pageTop>=u.top||n.pageTop==null)?(n.pageTop=u.top,n.topElement=i.objects[f]):r==="left"&&(n.pageLeft>=u.left||n.pageLeft==null)?(n.pageLeft=u.left,n.leftElement=i.objects[f]):r==="right"&&(n.pageRight<=u.right||n.pageRight==null)&&(n.pageRight=u.right,n.rightElement=i.objects[f])},_initializeNodes:function(n,t){for(var r,f,u=n.nodes(),i=0;i<u.length;i++)r=u[i],f=this.getObjectType(r),f!="group"&&this._updateQuad(n,t,r)},_initializeConnectors:function(n,t){for(var r=n.connectors(),i=0;i<r.length;i++)this._updateQuad(n,t,r[i])},_updateQuad:function(i,r,u){var h,s,f,o,e;this._setCurrentNode(r,u);h=t.datavisualization.Diagram.Util.bounds(u);s=r.quadTable[u.name];s?this._isContained(r,s)||(this._removeFromaQuad(r,s,u),this._addIntoAQuad(r)):(r.parentQuad||(r.parentQuad=t.datavisualization.Diagram.Quad(0,0,200,200)),this._addIntoAQuad(r));this._isWithinPageBounds(r,h)&&r.leftElement!=u&&r.topElement!=u&&r.rightElement!=u&&r.bottomElement!=u||(f=!1,o=!1,r.pageLeft>=r.childLeft||r.pageLeft==null?(r.pageLeft=r.childLeft,r.leftElement=u,f=!0):u==r.leftElement&&(r.pageLeft=null,this._findQuadElement(r,r.parentQuad,"left"),o=f=!0),r.pageTop>=r.childTop||r.pageTop==null?(r.pageTop=r.childTop,r.topElement=u,f=!0):u==r.topElement&&(r.pageTop=null,this._findQuadElement(r,r.parentQuad,"top"),o=f=!0),r.pageBottom<=r.childBottom||r.pageBottom==null?(f=!0,r.pageBottom=r.childBottom,r.bottomElement=u):u==r.bottomElement&&(r.pageBottom=null,this._findQuadElement(r,r.parentQuad,"bottom"),o=f=!0),r.pageRight<=r.childRight||r.pageRight==null?(r.pageRight=r.childRight,r.rightElement=u,f=!0):u==r.rightElement&&(r.pageRight=null,this._findQuadElement(r,r.parentQuad,"right"),o=f=!0));e=i.activeTool.diagramBounds;f&&i.model.pageSettings.multiplePage&&(i.model.pageSettings.pageWidth||i.model.pageSettings.pageHeight)&&e&&(f=!1,(o||r.pageLeft<e.x||r.pageTop<e.y||r.pageRight>e.x+e.width||r.pageBottom>e.y+e.height)&&(f=!0,i.activeTool.diagramBounds=i._getDigramBounds()));f&&(i._views.forEach(function(t){var u=i._views[t],r;u.type=="overview"&&(r=n("#"+t).ejOverview("instance"),r&&r._updateOverview(u))}),!i._layoutInAction&&i._pageBackgroundLayer&&t.datavisualization.Diagram.PageUtil._updatePageSize(i,i.activeTool.inAction||i._selectedSymbol))},_removeFromaQuad:function(n,t,i){if(t){var r=t.objects.indexOf(i);t.objects.splice(r,1);this._update(t);delete n.quadTable[i.name]}}};t.datavisualization.Diagram.Quad=function(n,t,i,r,u){return{left:n,top:t,width:i,height:r,parent:u,first:null,second:null,third:null,fourth:null,objects:[]}};t.datavisualization.Diagram.SpatialSearch=function(){return{pageLeft:null,pageRight:null,pageTop:null,pageBottom:null,topElement:null,bottomElement:null,rightElement:null,leftElement:null,childLeft:null,childTop:null,childRight:null,childBottom:null,childNode:null,quads:null,parentQuad:t.datavisualization.Diagram.Quad(0,0,200,200),quadTable:{}}};t.datavisualization.Diagram.ClassifierHelper={getEditableElementUnderMouse:function(n,t){var i=t._findNodeUnderMouse(n),r;return i&&(r=i.name.match("_attribute")?"attribute":i.name.match("_method")?"method":i.name.match("_member")?"member":"header",r&&i.parent&&(i=t.nameTable[i.parent])),i},getMovableElementUnderMouse:function(n,t){var i=t._findNodeUnderMouse(n),r=n.target.className;return!i||!i.parent||i.type=="umlclassifier"||(i=t.nameTable[i.parent]),i},getSelectableElementUnderMouse:function(n,t){var i=t._findNodeUnderMouse(n);return!i||!i.parent||i.type=="umlclassifier"||(i=t.nameTable[i.parent]),i},getDropableElementUnderMouse:function(n,i){var r=i._findNodeUnderMouse(n);return i._nodeUnderMouse||(i._nodeUnderMouse=r),r&&t.datavisualization.Diagram.Util.canAllowDrop(r)?r:!0},renderResizeBorder:function(n,t,i,r){var u=t.width?t.width:t._width,f=t.height?t.height:t._height;return i.rect({id:n,width:u*r+t.borderWidth+4,height:f*r+t.borderWidth+4,x:-(t.borderWidth/2+2),y:-(t.borderWidth/2+2),stroke:"#f93732","stroke-width":2,"stroke-dasharray":"0",fill:"none","pointer-events":"none"})},getEditboxValue:function(i,r,u){for(var v,s,y,o,p,c,w,a,f,e=0;e<r.children.length;e++)typeof r.children[e]=="string"&&(r.children[e]=u.nameTable[r.children[e]]),v=r.children[e].name.match("_attribute")?"attribute":r.children[e].name.match("_method")?"method":r.children[e].name.match("_member")?"member":"header";for(s=i.split("\n"),f=0;f<s.length;f++)s[f]=s[f].trim().replace(/\s+/g," "),!s[f].indexOf("---")>-1&&s[f].charAt(0)=="+"||s[f].charAt(0)=="-"||s[f].charAt(0)=="#"||s[f].charAt(0)=="~"?s[f]=s[f]:f!=s[f].length-s[f].length&&!s[f].indexOf("---")>-1&&s[f].length>0&&v!="member"&&!r.enumeration&&(s[f]="+ "+s[f]),s[f].indexOf("---")>-1&&s[f].match(/\w|\d|\D|\s/g)&&(y=s[f].match(/---/g),s[f]=y[0]);for(i=s.join("\n"),o=i.split("\n---\n"),f=0;f<o.length;f++)o[f]=o[f].replace(/^\n+/g,"");for(o[0].indexOf("+")>-1&&(o[0]=o[0].replace(/[+]/g,"")),o[0].length>0&&(r.children[0].labels[0].text=o[0]),r.children[1]&&!o[2]?r.children[1].labels[0].text=o[1]:r.children[1]&&o[2]&&(r.children[1].name.indexOf("method")>-1?r.children[1].labels[0].text.indexOf(o[1])>-1?(r.children[1].labels[0].text=o[1],o.pop()):r.children[1].labels[0].text=o[2]:(p=r.children[1].name.indexOf("attribute")>-1?o[1]:r.children[1].name.indexOf("member")>-1?o[1]:o[2],r.children[1].labels[0].text=p)),r.children[2]&&(r.children[2].labels[0].text=o[2]),e=0;e<r.children.length;e++)c=r.children[e].labels[0].text,c&&c.indexOf("--")>-1&&(c=c.replace(/---\n*/g,""),r.children[e].labels[0].text=c),c&&c.endsWith("\n")&&(w=c.replace(/\n+$/g,""),r.children[e].labels[0].text=w),a=r.children[e].labels[0].text?r.children[e].labels[0].text.length:null,!a&&a<=0&&(u._remove(r.children[e]),e--),u.nameTable[r.children[e].name]=r.children[e];if(o[2]&&!r.children[2]||o[1]&&!r.children[1]){var h=[],l=t.datavisualization.Diagram.NodeConstraints.Default&~(t.datavisualization.Diagram.NodeConstraints.Select|t.datavisualization.Diagram.NodeConstraints.ResizeNorthEast|t.datavisualization.Diagram.NodeConstraints.ResizeWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthEast|t.datavisualization.Diagram.NodeConstraints.ResizeNorthWest|t.datavisualization.Diagram.NodeConstraints.ResizeSouthWest|t.datavisualization.Diagram.NodeConstraints.ResizeNorth|t.datavisualization.Diagram.NodeConstraints.ResizeSouth|t.datavisualization.Diagram.NodeConstraints.Connect|t.datavisualization.Diagram.NodeConstraints.Rotate|t.datavisualization.Diagram.NodeConstraints.ResizeEast),b={width:r.width,offsetX:r.offsetX,parent:r.name,ports:[],fillColor:"transparent",borderColor:r.borderColor,type:"node",labels:[{margin:{left:5,right:5,top:5,bottom:5}}],_isClassMember:!0};for(e=0;e<r.children.length;e++)e!=0&&r.children[e].name.indexOf("_attribute")>-1&&o[2].length>0?h.push({name:r.name+"_method_classifier",labels:[{text:o[2],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l}):e!=0&&r.children[e].name.indexOf("_method")>-1&&o[1].length>0&&h.push({name:r.name+"_attribute_classifier",labels:[{text:o[1],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l});for(r.children.length<2&&(o[1]&&h.push({name:r.name+"_attribute_classifier",labels:[{text:o[1],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l}),o[2]&&h.push({name:r.name+"_method_classifier",labels:[{text:o[2],horizontalAlignment:"left",textAlign:"left",offset:{x:0,y:.5}}],constraints:l})),f=0;f<h.length;f++)h[f].labels[0]=n.extend(!0,{},r.labels[0],h[f].labels[0]),h[f]=t.datavisualization.Diagram.Node(n.extend(!0,{},b,h[f])),u._getNodeDimension(h[f],h[f].labels[0]),h[f].offsetY+=r.offsetY-r.height/2,u.add(h[f]),u.nameTable[h[f].name]=h[f];r.children[2]&&r.children[2].match("_attribute")&&(r.children.splice(1,0,r.children[2]),r.children.pop());typeof r.children[1]=="string"&&(r.children[1]=u.nameTable[r.children[1]]);typeof r.children[2]=="string"&&(r.children[2]=u.nameTable[r.children[2]])}for(e=0;e<r.children.length;e++)r.children.length==1&&(r["class"]&&(delete r["class"].attributes,delete r["class"].methods),r["interface"]&&(delete r["interface"].attributes,delete r["interface"].methods),r.enumeration&&delete r.enumeration.members),r.children.length==2&&(r["class"]&&(r.children[e].name.match("attribute")&&delete r["class"].methods,r.children[e].name.match("method")&&delete r["class"].attributes),r["interface"]&&(r.children[e].name.match("attribute")&&delete r["interface"].methods,r.children[e].name.match("method")&&delete r["interface"].attributes)),this._updateClassNode(r.children[e],r);return i},getUMLConnectorValue:function(t,i,r){var o,f,e,u;return(r.name===t.name+"_sourcelabel"||r.name===t.name+"_targetlabel")&&((t.shape.multiplicity.type=="onetoone"||t.shape.multiplicity.type=="manytoone"||t.shape.multiplicity.type=="onetomany")&&(i.length==1&&(i.indexOf("1")>-1||i.indexOf("*")>-1)&&(o=!0),f=!1,r.name===t.name+"_sourcelabel"&&(t.shape.multiplicity.type=="onetoone"||t.shape.multiplicity.type=="onetomany")?(i="1",t.shape.multiplicity=n.extend(!0,{},t.shape.multiplicity,{source:{optional:f,lowerBounds:null,upperBounds:null}})):r.name===t.name+"_targetlabel"&&(t.shape.multiplicity.type=="manytoone"||t.shape.multiplicity.type=="onetoone")&&(i="1",t.shape.multiplicity=n.extend(!0,{},t.shape.multiplicity,{target:{optional:f,lowerBounds:null,upperBounds:null}}))),i=this.umlConnectorEditBox(i),i.match(/\d\.{3}\d/g)?u=i.split("..."):o||(e=this.umlConnectorMultiplicity(t),r.name==t.name+"_sourcelabel"?(u=e[0].text.split("..."),i=e[0].text):(u=e[1].text.split("..."),i=e[1].text)),u&&(t.shape.multiplicity=r.name==t.name+"_sourcelabel"?n.extend(!0,{},t.shape.multiplicity,{source:{optional:f,lowerBounds:u[0],upperBounds:u[1]}}):n.extend(!0,{},t.shape.multiplicity,{target:{optional:f,lowerBounds:u[0],upperBounds:u[1]}}))),r.text=i,t},umlConnectorMultiplicity:function(n){var o=[],t,i,r,u,f,e;return n.shape.multiplicity.source&&(n.shape.multiplicity.source.lowerBounds=this.umlConnectorEditBox(n.shape.multiplicity.source.lowerBounds),n.shape.multiplicity.source.upperBounds=this.umlConnectorEditBox(n.shape.multiplicity.source.upperBounds)),n.shape.multiplicity.target&&(n.shape.multiplicity.target.lowerBounds=this.umlConnectorEditBox(n.shape.multiplicity.target.lowerBounds),n.shape.multiplicity.target.upperBounds=this.umlConnectorEditBox(n.shape.multiplicity.target.upperBounds)),f=n.shape.multiplicity.source,e=n.shape.multiplicity.target,t=f.upperBounds?f.lowerBounds+"..."+f.upperBounds:f.lowerBounds,i=e.upperBounds?e.lowerBounds+"..."+e.upperBounds:e.lowerBounds,n.shape.multiplicity.type=="manytoone"&&(n.shape.multiplicity.target.optional=!1,r=t?t:"*",u="1"),n.shape.multiplicity.type=="onetomany"&&(n.shape.multiplicity.source.optional=!1,u=i?i:"*",r="1"),n.shape.multiplicity.type=="manytomany"&&(r=t?t:"*",u=i?i:"*"),n.shape.multiplicity.type=="onetoone"&&(n.shape.multiplicity.target.optional=!1,n.shape.multiplicity.source.optional=!1,r="1",u="1"),o.push({name:n.name+"_sourcelabel",text:r,segmentOffset:0,alignment:"before",margin:{left:5,top:5}},{name:n.name+"_targetlabel",text:u,segmentOffset:1,alignment:"before",margin:{right:5,bottom:5}}),o},umlConnectorEditBox:function(n){return typeof n=="string"&&n.match(/[a-zA-Z]/g)&&(n=n.replace(/[a-zA-Z]/g,"")),n},EnableorDisableConnection:function(n,t,i){return i.shape&&i.shape.type=="umlclassifier"&&i.shape.relationship!="association"&&(i.shape.relationship!="dependency"&&i.shape.relationship!="inheritance"&&i.shape.relationship!="realization"&&t&&n&&n["interface"]&&t["class"]&&(n=null),i.shape.relationship=="dependency"&&t&&n&&n["class"]&&t["interface"]&&(n=null)),n},getClassifierNodeDimension:function(n,t){for(var f,r,u,i=0;i<n.children.length;i++)t._getNodeDimension(n.children[i]);for(n._height=0,i=0;i<n.children.length;i++)f=n.children[i].height?n.children[i].height:n.children[i]._height,n.children[i].offsetY=n._height+f/2,n._height+=f,n.height=n._height;for(r=n.children[0]._width,n.children[1]&&(r=n.children[0]._width>n.children[1]._width?n.children[0]._width:n.children[1]._width),n.children[2]&&(r=n.children[2]._width>r?n.children[2]._width:r),n.children[0].width=r,n.children[1]&&(n.children[1].width=r),n.children[2]&&(n.children[2].width=r),n.width=r,u=0;u<n.children.length;u++)n.children[u].offsetY+=n.offsetY-n.height/2;return t._updateAssociatedConnectorEnds(n,t.nameTable),n},_updateClassNode:function(n,i){var s,a;if(n.name.match("_header"))i["class"]?i["class"].name=n.labels[0].text:i["interface"]?i["interface"].name=n.labels[0].text:i.enumeration.name=n.labels[0].text;else{for(var v=n.name.match("_attribute")?"attribute":n.name.match("_method")?"method":"member",y=n.labels[0],h,u,l=[],c,f=y.text.split("\n"),e=[],o,r=0;r<f.length;r++){f[r].indexOf("+")>-1?h="public":f[r].indexOf("-")>-1?h="private":f[r].indexOf("#")>-1?h="protected":f[r].indexOf("~")>-1&&(h="package");(f[r].indexOf("+")>-1||f[r].indexOf("-")>-1||f[r].indexOf("#")>-1||f[r].indexOf("~")>-1)&&(f[r]=f[r].replace(/[+|~|#|-]\s/g,""));switch(v){case"attribute":o=f[r].split(/:[ ]*/g);e.push(t.datavisualization.Diagram.ClassAttribute({name:o[0],type:o[1],scope:h}));break;case"method":for(u=f[r].split(/["("|")"]/g),s=0;s<u.length;s++)u[s].indexOf(",")>-1&&(o=u[s].split(",")),s==u.length-1&&(u[s]=u[s].replace(/[:\s]|:/g,""));if(o)for(a=0;a<o.length;a++)c=o[a].split(":"),l.push(t.datavisualization.Diagram.ClassmethodArguments({name:c[0],type:c[1]}));u.length!=3||o||(u[1].indexOf(":")>-1?(c=u[1].split(":"),l.push(t.datavisualization.Diagram.ClassmethodArguments({name:c[0],type:c[1]}))):l.push(t.datavisualization.Diagram.ClassmethodArguments({name:u[1]})));e.push(t.datavisualization.Diagram.ClassMethod({name:u[0],arguments:l,type:u[u.length-1],scope:h}));break;case"member":e.push(t.datavisualization.Diagram.ClassMember({name:f[r]}))}}v=="attribute"?i["class"]?i["class"].attributes=e:i["interface"]&&(i["interface"].attributes=e):v=="method"?i["class"]?i["class"].methods=e:i["interface"]&&(i["interface"].methods=e):i.enumeration.members=e}}};t.datavisualization.Diagram.SwimLaneContainerHelper={_initSwimLane:function(n,i){var i=t.datavisualization.Diagram.SwimLane(i);return i=this._initLaneCollection(n,i),this._swapPhaseSize(i),i=this._setPhaseMinValues(n,i),this._initPhaseCollection(n,i)},_initLaneCollection:function(n,i){var r,u,f,e;for(i.lanes.length===0&&(i.lanes=[t.datavisualization.Diagram.Lane({orientation:i.orientation})]),r=0;r<i.lanes.length;r++){if(i.lanes[r]=t.datavisualization.Diagram.Lane(i.lanes[r]),i.lanes[r].container={type:"canvas",orientation:i.orientation},i.lanes[r].borderColor=i.lanes[r].borderColor?i.lanes[r].borderColor:"black",i.lanes[r].orientation=i.orientation?i.orientation:"horizontal",i.lanes[r].horizontalAlign=i.orientation==="horizontal"?"stretch":"left",i.lanes[r].verticalAlign=i.orientation==="vertical"?"stretch":"top",i.lanes[r].addInfo=i.lanes[r].addInfo?i.lanes[r].addInfo:{},i.lanes[r].fillColor=i.lanes[r].fillColor,i.lanes[r].paddingTop=20,i.lanes[r].paddingRight=20,i.lanes[r].paddingBottom=20,i.lanes[r].paddingLeft=20,i.lanes[r].constraints=i.lanes[r].constraints?i.lanes[r].constraints|t.datavisualization.Diagram.NodeConstraints.AllowDrop:t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop&~t.datavisualization.Diagram.NodeConstraints.Connect,i.lanes[r].cssClass=i.lanes[r].cssClass,i.lanes[r]._laneHeader=i.lanes[r]._laneHeader?i.lanes[r]._laneHeader:null,i.lanes[r].labels&&i.lanes[r].labels.length>0)for(u=0;u<i.lanes[r].labels.length;u++)i.lanes[r].labels[u]=t.datavisualization.Diagram.Label(i.lanes[r].labels[u]);f=i.lanes[r]._laneHeader=i.lanes[r]._laneHeader?i.lanes[r]._laneHeader:i.lanes[r].header;e=this._initLaneHeader(n,i.lanes[r],f,i);i.lanes[r].children.splice(0,0,e)}return i},_initLaneHeader:function(n,i,r,u){var f=i.header,s=u.orientation,e,o,u;return s==="horizontal"?(e="left",o="stretch",f.rotateAngle=270):(e="stretch",o="top",f.rotateAngle=0),t.datavisualization.Diagram.Node({_hidePorts:!0,_isHeader:!0,name:n._isUndo&&r.name?r.name:i.name+"_Headerr_",type:"node",labels:[f],height:r.height?r.height:50,width:r.width?r.width:50,fillColor:f.fillColor?f.fillColor:"white",rotateAngle:0,horizontalAlign:e,verticalAlign:o,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,marginLeft:-20,marginTop:-20,marginRight:-20,marginBottom:-20})},_initPhaseCollection:function(n,i){var u=0,f=0,r;for(i.phases.length===0&&(i.phases=[t.datavisualization.Diagram.Phase({orientation:i.orientation})]),r=0;r<i.phases.length;r++)i.phases[r]=t.datavisualization.Diagram.Phase(i.phases[r]),i.phases[r].isPhase=!0,i.phases[r]._hidePorts=!0,i.phases[r].constraints=t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,i.phases[r].parent="",i.phases[r]._isHeader=!0,i.phases[r]._type="node",i.phases[r].orientation=i.orientation,n._isLoad?i.phases[r].labels&&i.phases[r].labels.length>0&&(i.phases[r].label=[i.phases[r].labels[0]]):i.phases[r].label&&i.phaseSize!=0&&(i.phases[r].label.rotateAngle=i.orientation==="vertical"?270:0,i.phases[r].labels=[i.phases[r].label]),i.orientation==="horizontal"?(i.phases[r].width=i.phases[r].offset-f,i.phases[r].height=i.phaseSize,f=i.phases[r].offset):(i.phases[r].height=i.phases[r].offset-u,i.phases[r].width=i.phaseSize,u=i.phases[r].offset);return i},_setPhaseMinValues:function(n,t){var u,i,r;if(i=t.phases[0],i)for(i.offset<70&&(i.offset=70),r=1;r<t.phases.length;r++)u=t.phases[r],i=t.phases[r-1],i.offset+20>=u.offset&&(u.offset=i.offset+20);return t},_swapPhaseSize:function(n){if(n.phases.length>0)for(var i=n.phases,t,u,r=0;r<i.length;r++)for(t=0;t<i.length-r-1;t++)i[t].offset>i[t+1].offset&&(u=i[t],i[t]=i[t+1],i[t+1]=u)},_setLastPhaseSize:function(n){if(n.phases.length>0){var t=n.phases[n.phases.length-1];t.offset=n.orientation==="horizontal"?n.width:n.height}},_createSwimlane:function(n,i){var e=this._createSwimlaneHeader(n,i),l=i.orientation==="horizontal"?"vertical":"horizontal",s=i.orientation,h,c,f,o;s==="horizontal"?(h=Math.round(e.height+i.phaseSize),c=0):(h=e.height,c=Math.round(i.phaseSize));var u={name:i.name+"phaseStack",isPhaseStack:!0,container:{type:"stack",orientation:s},minHeight:10,minWidth:10,children:i.phases,marginTop:e.height,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect&~t.datavisualization.Diagram.NodeConstraints.AllowDrop},a={name:i.name+"laneStack",isLaneStack:!0,container:{type:"stack",orientation:l},children:i.lanes,marginTop:h,marginLeft:c,verticalAlign:"stretch",horizontalAlign:"stretch",constraints:(t.datavisualization.Diagram.NodeConstraints.Default|t.datavisualization.Diagram.NodeConstraints.AllowDrop)&~t.datavisualization.Diagram.NodeConstraints.Connect},r={_hidePorts:!0,name:i.name,container:{type:"canvas"},children:[e,a],addInfo:i.addInfo?i.addInfo:null,paletteItem:i.paletteItem?i.paletteItem:null,constraints:i.constraints,cssClass:i.cssClass,offsetX:i.offsetX?i.offsetX:100,offsetY:i.offsetY?i.offsetY:100,orientation:i.orientation,phaseSize:i.phaseSize,isSwimlane:!0,height:i.height?i.height:100,width:i.width?i.width:100};return r.offsetX=i.offsetX?i.offsetX:100,r.offsetY=i.offsetY?i.offsetY:100,f=t.datavisualization.Diagram.containerCommon._cloneObject(n,r,t.datavisualization.Diagram.Util.randomId()),f=t.datavisualization.Diagram.ContainerHelper._initContainer(n,f),o=t.datavisualization.Diagram.Util.bounds(f),o=this._setSwimlaneSize(n,r,o),t.datavisualization.Diagram.containerCommon._removeObject(n,f),s==="horizontal"?(u.maxHeight=i.phaseSize,u.minWidth=10):(u.minHeight=10,u.maxWidth=i.phaseSize),r.children.splice(1,0,u),this._setPhaseValues(n,r,o),t.datavisualization.Diagram.ContainerHelper._initContainer(n,r)},_setSwimlaneSize:function(n,t,i){var f,r,u;if(t.orientation==="horizontal"){if(t.width>i.width){for(r=t.children[1].children,u=0;u<r.length;u++)r[u].minWidth=t.width;i.width=t.width}t.height>i.height&&(r=t.children[1].children,f=r[r.length-1],f.minHeight+=t.height-i.height,i.height=t.height)}else if(t.width>i.width&&(r=t.children[1].children,f=r[r.length-1],f.minWidth+=t.width-i.width,i.height=t.height),t.height>i.height){for(r=t.children[1].children,u=0;u<r.length;u++)r[u].minHeight=t.height-2*t.children[0].height;i.height=t.height}return i},_setPhaseValues:function(n,t,i){var f=t.children[1].children,u=f[f.length-1],c=t.orientation,s,h,o,e,r;if(c==="horizontal")if(u.offset<=i.width)for(f.length==1?(u.offset=i.width,u.width=i.width):(h=f[f.indexOf(u)-1],u.offset=i.width,u.width=i.width-h.offset),e=t.children[2].children,r=0;r<e.length;r++)e[r].minWidth=u.offset;else{for(o=0,r=0;r<f.length;r++)f[r].offset>=o&&(o=f[r].offset);for(e=t.children[2].children,r=0;r<e.length;r++)e[r].minWidth=o}else if(s=t.children[0],u.offset<=i.height-s.height)for(f.length==1?(u.offset=i.height-s.height,u.height=u.offset):(h=f[f.indexOf(u)-1],u.offset=i.height-s.height,u.height=i.height-h.offset-s.height),e=t.children[2].children,r=0;r<e.length;r++)e[r].minHeight=u.offset;else{for(o=0,r=0;r<f.length;r++)f[r].offset>=o&&(o=f[r].offset);for(e=t.children[2].children,r=0;r<e.length;r++)e[r].minHeight=o}},_createSwimlaneHeader:function(n,i){var r=i.header,f=i.lanes[0]._laneHeader?i.lanes[0]._laneHeader:null,u=t.datavisualization.Diagram.Node({_type:"node",_hidePorts:!0,_isHeader:!0,name:i.name+"_header_swimlane",labels:[r],height:r.height?r.height:50,width:r.width?r.width:50,fillColor:i.header.fillColor?i.header.fillColor:f?f.fillColor:"white",rotateAngle:0,constraints:t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,horizontalAlign:"stretch",parent:i.name});return u.labels[0].fillColor="transparent",n._isLoad&&(u.fillColor=i.header.fillColor),u},_updateSwimlane:function(n,i){this._updateLaneStack(n,i);this._updatePhaseStack(n,i);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,i)},_updateLaneStack:function(n,t){for(var r,f,e=this.getLanes(n,t),i,u=0;u<e.length;u++)if(i=n.nameTable[n._getChild(e[u])],i){for(r=1;r<i.children.length;r++)f=typeof i.children[r]=="string"?n.nameTable[i.children[r]]:i.children[r],f.marginBottom=f.marginRight=0;this._updateLane(n,i)}},_updatePhaseStack:function(n,i){var r=n.nameTable[n._getChild(i.children[1])];t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r)},_updateLane:function(n,i){t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,i)},getPhases:function(n,t,i){var u,r;if(t&&(t.children[1]&&(u=i?i[n._getChild(t.children[1])]:n.nameTable[n._getChild(t.children[1])]),u&&(r=n._getChildren(u.children),r&&r.length>0)))return r},getLanes:function(n,t){var r,i;return t&&t.isSwimlane&&t.children[2]&&(r=n.nameTable[n._getChild(t.children[2])]),r&&(i=r.children,i&&i.length>0)?i:void 0},_updateLanesMinValue:function(n,t,i,r){for(var e=this.getLanes(n,t),u,f=0;f<e.length;f++)u=n.nameTable[n._getChild(e[f])],u&&(u[i]=r)},_resizeLastPhase:function(){},_getPhaseBounds:function(n,i){var r=null,u,l,o,f=0,h=0,s=0,c=0,e,a,v,y;return i&&i.type=="phase"&&i.parent&&(e=this._getPrevPhase(n,i),a=this._getNextPhase(n,i),u=n.nameTable[i.parent.split("phaseStack")[0]],u&&u.orientation&&(r=t.datavisualization.Diagram.Util.bounds(u),u.orientation=="horizontal"?(o=this._getPrevOffset(n,i,e,a,u,r),e&&e.name===i.name?(f=o.left+r.left,h=f+(i.offset-f-o.left)):(e&&(f=r.left+e.offset),h=i.offset-f+r.left),s=o.top+r.top,c=r.bottom-s,l=t.datavisualization.Diagram.Rectangle(f,s,h,c)):(o=this._getPrevOffset(n,i,e,a,u,r),e===i?(f=o.left+r.left,c=i.offset+s,s=o.top+r.top):(v=typeof u.children[0]=="string"?n.nameTable[u.children[0]]:n.nameTable[u.children[0].name],y=v?v.height:0,f=o.left+r.left,e&&(s=e.offset+r.top+y),c=r.top+i.offset-s+y),h=r.right-f,l=t.datavisualization.Diagram.Rectangle(f,s,h,c)))),l},_getPrevPhase:function(n,i){var f=null,u,e=n.nameTable[i.parent.split("phaseStack")[0]],r=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,e);return e&&r&&r.length>0&&(u=this._getPhaseIndex(n,i.name),f=u===0?n.nameTable[r[0]]:n.nameTable[r[u-1]]),f},_getPrevOffset:function(n,t,i,r,u){var f,e,h=0,c=0,s,o;return u.children[0]&&(s=n.nameTable[n._getChild(u.children[0])],s&&(c=s.height)),u.orientation=="horizontal"&&(u.children[2]&&(f=n.nameTable[n._getChild(u.children[2])]),f&&f.children&&f.children.length>0&&(e=n.nameTable[n._getChild(f.children[0])],e&&e.children&&e.children.length>0&&(o=n.nameTable[n._getChild(e.children[0])],o&&o.name.indexOf("_Headerr")!=-1&&(h=o.width)))),{left:h,top:c}},_getNextPhase:function(n,i){var f=null,u,e=n.nameTable[i.parent.split("phaseStack")[0]],r=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,e);return e&&r&&r.length>0&&(u=n._getPhaseIndex(i.name),f=u===r.length-1?n.nameTable[r[u]]:n.nameTable[r[u+1]]),f},_getPhaseIndex:function(n,i){var r,f,e=-1,u;return r=n.nameTable[i],r&&r.parent&&(f=n.nameTable[r.parent.split("phaseStack")[0]],u=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,f),u&&u.length>0&&(e=u.indexOf(i))),e},_cloneLaneObj:function(t,i,r,u){var s=u?u:t.nameTable,e,o,f;if(i=n.extend(!0,{},i),e=i.children,e&&e.length>0)for(o=0;o<e.length;o++)f=s[t._getChild(e[o])],f&&(f=jQuery.extend(!0,{},f),f&&f.children&&f.children.length&&(f=t._cloneLaneObj(f,r,u)),f.name+=r,f.parent=r,i.children[o]=f,u&&t._preserveConnection(u,f));return i&&i.header&&(i.header.name+=r),i.name+=r,i},_cloneSwimlaneObj:function(t,i,r,u){var f;if(i=n.extend(!0,{},i),i&&i.isSwimlane){if(i=jQuery.extend(!0,{},i),i.name+=r,i.lanes&&i.lanes.length>0)for(f=0;f<i.lanes.length;f++)i.lanes[f]&&(i.lanes[f]=t._cloneLaneObj(i.lanes[f],r,u&&u.childTable?u.childTable:null));if(i.phases&&i.phases.length>0)for(f=0;f<i.phases.length;f++)i.phases[f]&&(i.phases[f].name+=r,i.phases[f].parent="")}return i},_pasteSwimlaneObj:function(n,i,r){if(i=n._pasteSwimlane(i,r),i){var u=n._isUndo?0:n._pasteIndex*10;n._translate(i,u,u,n.nameTable);t.datavisualization.Diagram.DiagramContext.update(i,n)}return i},_pasteSwimlane:function(n,i,r){if(n._pasteObj=!0,i&&i.isSwimlane){var f=n._isUndo?0:n._pasteIndex*10,u=n._cloneSwimlaneObj(n._getNode(i.name,r?r.childTable:null),n._swimlanePaste?"":t.datavisualization.Diagram.Util.randomId(),r);if(u=t.datavisualization.Diagram.ContainerHelper._initContainer(n,u,r),n._outOfBoundsOnNudge(u,f,f))n.add(u);else return t.datavisualization.Diagram.containerCommon._removeObject(n,u),null;return n._pasteObj=!1,u}},_updateNextPhase:function(n,i,r,u){for(var o=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),f,e=u+1;e<o.length;e++)f=n.nameTable[n._getChild(o[e])],f&&(f.offset+=r)},_getOuterNodes:function(n,i,r,u){for(var f,e,o,l,h=[],c=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,i),a=i.orientation==="horizontal"?"left":"top",v=i.orientation==="horizontal"?r:u,s=0;s<c.length;s++)if(f=n.nameTable[n._getChild(c[s])],f&&f.children.length>1)for(e=0;e<f.children.length;e++)o=n.nameTable[n._getChild(f.children[e])],o&&(l=t.datavisualization.Diagram.Util.bounds(o),l[a]>v&&h.push(o));return h},_getInnerNodes:function(n,i,r,u){for(var f,e,o,h,c=[],l=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,i),a=i.orientation==="horizontal"?"left":"top",v=i.orientation==="horizontal"?"right":"bottom",s=0;s<l.length;s++)if(f=n.nameTable[n._getChild(l[s])],f&&f.children.length>1)for(e=0;e<f.children.length;e++)o=n.nameTable[n._getChild(f.children[e])],o&&(h=t.datavisualization.Diagram.Util.bounds(o),h[a]>=r&&h[v]<=u&&c.push(o));return c},_moveOuterNodes:function(n,i,r,u){var v=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),s=n.nameTable[n._getChild(v[u])],h=t.datavisualization.Diagram.Util.bounds(i),y=n.nameTable[n._getChild(i.children[0])],c=h.left+s.offset,l=h.top+s.offset+y.height,a=i.orientation==="horizontal"?"offsetX":"offsetY",w=i.orientation==="horizontal"?c:l,p=i.orientation==="horizontal"?"marginLeft":"marginTop",f=n._getOuterNodes(i,c,l),e,o;if(f&&f.length>0)for(e=0;e<f.length;e++)o=n.nameTable[n._getChild(f[e])],n._translate(o,a==="offsetX"?r:0,a==="offsetY"?r:0,n.nameTable),o[p]+=r},_moveOnPhaseChange:function(n,i,r){var u,s=i.parent.split("phaseStack")[0],f,o,h,e;if(s&&(f=n.nameTable[s]),f){for(o=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,f),h=n.nameTable[n._getChild(f.children[0])],e=0;e<o.length;e++)u=n.nameTable[n._getChild(o[e])],u&&(i.orientation==="horizontal"?(u.width+=r,u.minWidth=u.width):(u.height+=r,u.minHeight=u.height));i.orientation==="horizontal"?f.minWidth+=r:f.minHeight=u.height;t.datavisualization.Diagram.SwimLaneContainerHelper._updateSwimlane(n,f)}},_getPhaseDifferece:function(n,i,r,u){var p=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),f=n.nameTable[n._getChild(p[r])],e=t.datavisualization.Diagram.Util.bounds(i),y=i.orientation==="horizontal"?"left":"top",v=n.nameTable[n._getChild(i.children[0])],c=0,a,s,l,o,h;return i.orientation==="vertical"&&(c=v.height),r===0?(s=n._getInnerNodes(i,e[y]+c,e[y]+f.offset+c),s&&s.length>0?(l=t.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup",children:s}),t.datavisualization.Diagram.Util._updateGroupBounds(l,n),o=t.datavisualization.Diagram.Util.bounds(l)):(o=t.datavisualization.Diagram.Util.bounds(),o.right=e.left+50),i.orientation==="horizontal"?(e.left+(f.offset+u)>=o.right+20||(h=o.right+20-(e.left+(f.offset+u)),u=u+h),f.offset+u<100&&(u=0)):(e.top+v.height+(f.offset+u)>=o.bottom+20||(h=o.bottom+20-(e.top+c+(f.offset+u)),u=u+h),f.offset+u<100&&(u=0))):(a=n.nameTable[n._getChild(p[r-1])],s=n._getInnerNodes(i,e[y]+a.offset+c,e[y]+f.offset+c),s&&s.length>0?(l=t.datavisualization.Diagram.Group({name:"multipleSelection",type:"pseudoGroup",children:s}),t.datavisualization.Diagram.Util._updateGroupBounds(l,n),o=t.datavisualization.Diagram.Util.bounds(l)):(o=t.datavisualization.Diagram.Util.bounds(),o.bottom=e.top+v.height+a.offset),i.orientation==="horizontal"?e.left+(f.offset+u)>=o.right+20||(h=o.right+20-(e.left+(f.offset+u)),u=u+h):e.top+v.height+(f.offset+u)>=o.bottom+20||(h=o.bottom+20-(e.top+v.height+(f.offset+u)),u=u+h)),a&&f.offset-a.offset+u<20&&(u-=f.offset-a.offset+u-20),u}};t.datavisualization.Diagram.ContainerHelper={_initContainer:function(n,i){if(i.container)switch(i.container.type){default:case"canvas":if(i=t.datavisualization.Diagram.canvasHelper._initCanvas(n,i),i.type=="bpmn"){var r=t.datavisualization.Diagram.ContainerHelper.updateparent(i,n);r||t.datavisualization.Diagram.bpmnHelper.updateCanvas(i,n)}break;case"stack":i=t.datavisualization.Diagram.stackHelper._initStack(n,i)}else(i.type==="swimlane"||i.isSwimlane)&&(i=t.datavisualization.Diagram.SwimLaneContainerHelper._initSwimLane(n,i),i=t.datavisualization.Diagram.SwimLaneContainerHelper._createSwimlane(n,i));return i},_add:function(i,r){var u,f,o,s,e;if(i.getObjectType(r)!=="connector"&&(u=r.parent?i.nameTable[r.parent]:null,u&&u.container)){for(f=u.children.length-1;f>=0;f--)o=i.nameTable[i._getChild(u.children[f])],o.name===r.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(u.children,u.children[f]);u.children.push(r.name);i._disableSwimlaneUptate=!0;t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(i);s=n.extend(!0,{},u);this._updateCollectionChange(i,u,!0);t.datavisualization.Diagram.canvasHelper._updateAddRemoveNodeConnectors(i,u,s);delete i._disableSwimlaneUptate;t.datavisualization.Diagram.canvasHelper._updateLastSwimlanePhase(i,r);e=i._svg.document.getElementById(r.parent);r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e);t.datavisualization.Diagram.canvasHelper._enableConnectorUpdateNode(i,r)}},updateparent:function(n,t){var i=n;if(t)while(i&&i.parent)if(i=t.nameTable[i.parent],i&&i.isLane)return i;return!1},_updateCollectionChange:function(n,i,r,u){var f,e,o,s,u,h;n._diagramClear||(o=!0,i&&(s=t.datavisualization.Diagram.Util.bounds(i),f={x:s.x,y:s.y},i.container&&(i.container.type==="canvas"?i._isBpmn?(u=this.updateparent(i,n),u?t.datavisualization.Diagram.canvasHelper._updateCollectionChange(n,i):t.datavisualization.Diagram.bpmnHelper.updateCanvas(i,n)):t.datavisualization.Diagram.canvasHelper._updateCollectionChange(n,i):t.datavisualization.Diagram.stackHelper._updateCollectionChange(n,i,null,u)),(r&&!i.isLane&&!i._isBpmn||i.isSwimlane)&&(n._disableSwimlaneUptate&&(o=!1),h=t.datavisualization.Diagram.Util.bounds(i),e={x:h.x,y:h.y},n._translate(i,f.x-e.x,f.y-e.y,n.nameTable),o&&t.datavisualization.Diagram.DiagramContext.update(i,n))),!i||!i.container||i.isLane||i.isSwimlane||i.isLaneStack||i.isPhaseStack||t.datavisualization.Diagram.DiagramContext.update(i,n))}};t.datavisualization.Diagram.stackHelper={_initStack:function(n,i){return i=t.datavisualization.Diagram.Group(i),i=this._initGroupNode(n,i),i=this._initChildren(n,i),this._setSize(n,i),this._alignChildren(n,i),i},_initGroupNode:function(n,i){return t.datavisualization.Diagram.containerCommon._initGroupNode(n,i)},_initChildren:function(n,i){return t.datavisualization.Diagram.containerCommon._initChildren(n,i)},_setSize:function(n,t){var i=this._getStackBoundsBounds(n,t);i.width>=t.minWidth&&i.width<=t.maxWidth?t.width=i.width:i.width<=t.minWidth?t.width=t.minWidth:i.width>=t.maxWidth&&(t.width=t.maxWidth);i.height>=t.minHeight&&i.height<=t.maxHeight?t.height=i.height:i.height<=t.minHeight?t.height=t.minHeight:i.height>=t.maxHeight&&(t.height=t.maxHeight)},_getStackBoundsBounds:function(n,i){var f=t.datavisualization.Diagram.Rectangle(),e,u,r,c=0,l=0,s=0,h=0,a=i.container.orientation?i.container.orientation:"vertical",o;if(i.children&&i.children.length>0)for(o=i.children,e=0;e<o.length;e++)u=typeof o[e]=="string"?n.nameTable[o[e]]:o[e],u&&(r=t.datavisualization.Diagram.Util.bounds(u),r=t.datavisualization.Diagram.Geometry.rect([r.topLeft,r.topRight,r.bottomRight,r.bottomLeft]),r&&(a==="vertical"?(l=r.width+=u.marginLeft+u.marginRight,l>s&&(s=r.width=l),r.width=u.horizontalAlign==="stretch"?r.width>u.minWidth?r.width:s:s,r.height+=u.marginTop+u.marginBottom,r.height+=f.height):(c=r.height+=u.marginTop+u.marginBottom,c>h&&(h=r.height=c),r.height=u.verticalAlign==="stretch"?r.height>u.minHeight?r.height:h:h,r.width+=u.marginLeft+u.marginRight,r.width+=f.width),r.x=0,r.y=0),f=n._union(f,r));return f.width+=i.paddingLeft+i.paddingRight,f.height+=i.paddingTop+i.paddingBottom,f},_alignChildren:function(n,t){for(var f,i,e=0,o=0,u=t.children,r=0;r<u.length;r++)i=typeof u[r]=="string"?n.nameTable[u[r]]:u[r],i&&(f=this._getStackPosition(n,i,t,e,o),this._translate(n,i,f.x,f.y),t.container.orientation=="vertical"?o+=(i.height?i.height:i._height)+i.marginTop+i.marginBottom:e+=(i.width?i.width:i._width)+i.marginLeft+i.marginRight)},_getStackPosition:function(n,i,r,u,f){var s=0,h=0,e=t.datavisualization.Diagram.Util.bounds(r),o=t.datavisualization.Diagram.Util.bounds(i),y=r.container.orientation?r.container.orientation:"vertical",a=i.width?i.width:i._width,v=i.height?i.height:i._height,c,l;if(r.container.orientation=="vertical"){h=e.y-o.y+f+i.marginTop+r.paddingTop;switch(i.horizontalAlign){case"left":s=e.x-o.x+i.marginLeft+r.paddingLeft;break;case"center":s=e.center.x-o.center.x;break;case"right":s=e.x+e.width-(o.x+o.width+r.paddingRight);break;case"stretch":c=(r.width-(r.paddingLeft+r.paddingRight)-(i.marginLeft+i.marginRight))/a;n.scale(i,c,1,r.pivot,n.nameTable);e=t.datavisualization.Diagram.Util.bounds(r);o=t.datavisualization.Diagram.Util.bounds(i,n);s=e.x+r.paddingLeft+i.marginLeft-o.x}}else{s=e.x-o.x+u+i.marginLeft+r.paddingLeft;switch(i.verticalAlign){case"top":h=e.y-o.y+i.marginTop+r.paddingTop;break;case"center":h=e.center.y-o.center.y;break;case"bottom":h=e.y+e.height-(o.y+o.height+r.paddingBottom);break;case"stretch":l=(r.height-(r.paddingTop+r.paddingBottom)-(i.marginTop+i.marginBottom))/v;n.scale(i,1,l,r.pivot,n.nameTable);e=t.datavisualization.Diagram.Util.bounds(r);o=t.datavisualization.Diagram.Util.bounds(i,n);h=e.y+r.paddingTop+i.marginTop-o.y}}return{x:s,y:h}},_translate:function(n,i,r,u){var f,o,e;if(r||u)if(i.segments)t.datavisualization.Diagram.Util._translateLine(i,r,u,i);else{if(i.offsetX+=r,i.offsetY+=u,i._type==="group"||i.type==="pseudoGroup"||i.type=="umlclassifier")for(f=i.children,e=0;f&&e<f.length;e++)o=n.nameTable[n._getChild(f[e])],o&&this._translate(n,o,r,u);t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(i,r,u,null,n)}},_updateCollectionChange:function(n,i,r,u){if(this._setSize(n,i),this._alignChildren(n,i),i.parent){var f=n.nameTable[i.parent];f||u&&i.isPhaseStack&&(f=u);f&&f.container&&!r&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f)}}};t.datavisualization.Diagram.canvasHelper={_initCanvas:function(n,i){return i._type="group",i.type||(i.type="group"),i=t.datavisualization.Diagram.Group(i),i=this._initGroupNode(n,i),i=this._initChildren(n,i),this._setSize(n,i),this._alignChildren(n,i),i},_initGroupNode:function(n,i){return t.datavisualization.Diagram.containerCommon._initGroupNode(n,i)},_initChildren:function(n,i){return t.datavisualization.Diagram.containerCommon._initChildren(n,i)},_setSize:function(i,r,u,f){var e=this._getCanvasBounds(i,r,f),o=t.datavisualization.Diagram.Util.bounds(r),c,h,s;if(o=t.datavisualization.Diagram.Geometry.rect([o.topLeft,o.topRight,o.bottomRight,o.bottomLeft]),e.width>=r.minWidth&&e.width<=r.maxWidth?e.width=e.width:e.width<=r.minWidth?e.width=r.minWidth:e.width>=r.maxWidth&&(e.width=r.maxWidth),e.height>=r.minHeight&&e.height<=r.maxHeight?e.height=e.height:e.height<=r.minHeight?e.height=r.minHeight:e.height>=r.maxHeight&&(e.height=r.maxHeight),u){var l=e.width/o.width,a=e.height/o.height,v=e.x+e.width/2-(o.x+o.width/2),y=e.y+e.height/2-(o.y+o.height/2),p=t.datavisualization.Diagram.Point(r.offsetX,r.offsetY);if(i._translate(r,v,y,i.nameTable,!0),i.scale(r,l,a,t.datavisualization.Diagram.Point(r.offsetX,r.offsetY),i.nameTable),r._isBpmn){for(c=i._getChildren(r.children),h=0;h<c.length;h++)s=i.nameTable[c[h]],s&&s._isInternalShape&&t.datavisualization.Diagram.Util.canResize(s)&&(s=n.extend(!0,s,{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height}));t.datavisualization.Diagram.Util._updateBPMNProperties(r,i,i.nameTable,!0)}t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(r,1/l,1/a,p,i)}else r.width=e.width,r.height=e.height},_alignChildren:function(i,r){for(var o,u,s=!0,e=r.children,f=0;f<e.length;f++)u=typeof e[f]=="string"?i.nameTable[e[f]]:e[f],u&&!u._isInternalShape&&(i._disablePhaseUpdate&&u.isPhaseStack&&(s=!1),s&&(o=this._getCanvasPosition(i,u,r),this._translate(i,u,o.x,o.y))),u&&u._isInternalShape&&t.datavisualization.Diagram.Util.canResize(u)&&(u=n.extend(!0,u,{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height}),t.datavisualization.Diagram.Util._updateBPMNProperties(r,i,i.nameTable,!0))},_translate:function(n,i,r,u){var o,f,e;if(r||u)if(i.segments)t.datavisualization.Diagram.Util._translateLine(i,r,u,i);else{if(i.offsetX+=r,i.offsetY+=u,i._type==="group"||i.type==="pseudoGroup")for(o=i.children,e=0;e<o.length;e++)f=n.nameTable[n._getChild(o[e])],f&&(this._translate(n,f,r,u),n._updateQuad(f));t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(i,r,u,null,n)}},_getCanvasPosition:function(n,i,r){var e=0,o=0,u=t.datavisualization.Diagram.Util.bounds(r),f=t.datavisualization.Diagram.Util.bounds(i),s,h;switch(i.horizontalAlign){case"left":e=u.x-f.x+i.marginLeft+r.paddingLeft;break;case"center":e=u.x+u.width/2-(f.x+f.width/2)+i.marginLeft+r.paddingLeft;break;case"right":e=u.x+u.width-i.marginRight-(f.x+f.width+r.paddingRight);break;case"stretch":s=(u.width-r.paddingLeft-r.paddingRight-i.marginLeft-i.marginRight)/i.width;n.scale(i,s,0,r.pivot,n.nameTable);f=t.datavisualization.Diagram.Util.bounds(i,n);e=u.x+r.paddingLeft-f.x+i.marginLeft}switch(i.verticalAlign){case"top":o=u.y-f.y+i.marginTop+r.paddingTop;break;case"center":o=u.y+u.height/2-(f.y+f.height/2)+i.marginTop+r.paddingTop;break;case"bottom":o=u.y+u.height-i.marginBottom-(f.y+f.height+r.paddingBottom);break;case"stretch":h=(u.height-r.paddingTop-r.paddingBottom-i.marginTop-i.marginBottom)/i.height;n.scale(i,0,h,r.pivot,n.nameTable);f=t.datavisualization.Diagram.Util.bounds(i,n);o=u.y+r.paddingTop-f.y+i.marginTop}return{x:e,y:o}},_getCanvasBounds:function(n,i,r){var e=t.datavisualization.Diagram.Rectangle(),o=0,f,u,h,c,l,a,s;if(i.children&&i.children.length>0)for(s=i.children;o<s.length;o++)f=typeof s[o]=="string"?n.nameTable[s[o]]:s[o],f&&!f._isInternalShape&&(u=t.datavisualization.Diagram.Util.bounds(f),u=t.datavisualization.Diagram.Geometry.rect([u.topLeft,u.topRight,u.bottomRight,u.bottomLeft]),f.horizontalAlign==="stretch"&&(u.width=u.width>=i.minWidth?u.width:1,(i.isLane||i.isSwimlane)&&o==0&&(u.width=1)),f.verticalAlign==="stretch"&&(u.height=u.height>=i.minHeight?u.height:1,i.isLane&&o==0&&(u.height=1)),u&&(l=f.marginLeft>0?u.x-f.marginLeft:u.x,a=f.marginTop>0?u.y-f.marginTop:u.y,h=h==undefined?l:Math.min(h,l),c=c==undefined?a:Math.min(c,a),u.width+=f.marginLeft+(r?0:f.marginRight),u.height+=f.marginTop+(r?0:f.marginBottom),u.x=0,u.y=0,i.type=="bpmn"&&(f.marginLeft<0&&(u.width-=f.marginLeft),f.marginTop<0&&(u.height-=f.marginTop))),e=t.datavisualization.Diagram.Geometry.union(e,u));return i.type=="bpmn"&&t.datavisualization.Diagram.Geometry.isEmptyRect(e)?(e=t.datavisualization.Diagram.Util.bounds(i),e=t.datavisualization.Diagram.Geometry.rect([e.topLeft,e.topRight,e.bottomRight,e.bottomLeft])):(e.width+=i.paddingLeft+i.paddingRight,e.height+=i.paddingTop+i.paddingBottom,e.x=h-i.paddingLeft,e.y=c-i.paddingTop),e},_updateCollectionChange:function(n,i){var u=!1,r;n.activeTool.name==="resize"&&i.isLane&&(u=!0);this._setSize(n,i,null,u);this._alignChildren(n,i);i.parent&&(r=n.nameTable[i.parent],r&&r.container&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r))},_getSwimlane:function(n,t){var i=n.nameTable[n._getChild(t)],r,u;if(i&&i.isLane&&(r=n.nameTable[i.parent],r&&(u=n.nameTable[r.parent],u)))return n.getNode(u.name)},_laneConnectors:function(n,t,i){var r,f,t,u;if(t&&t.isLane)for(f=0;f<t.children.length;f++)if(u=n.nameTable[n._getChild(t.children[f])],u){if(u.inEdges&&u.inEdges.length>0)for(r=0;r<t.children.length;r++)n._collectionContains(u.inEdges[r],i)||i.push(u.inEdges[r]);if(u.outEdges&&u.outEdges.length>0)for(r=0;r<t.children.length;r++)n._collectionContains(u.outEdges[r],i)||i.push(u.outEdges[r])}},_connectorRelateTolaneCollection:function(n,t,i){if(t){var r,u,e,o,f;if(o=t.sourceNode?n.nameTable[t.sourceNode]:null,e=t.targetNode?n.nameTable[t.targetNode]:null,o&&o.parent&&(r=n.nameTable[o.parent]),e&&e.parent&&(u=n.nameTable[e.parent]),r&&u&&u.name===r.name)return!1;for(f=0;f<i.length;f++)if(r&&r.name===i[f]||u&&u.name===i[f])return!0}return!1},_recreateConnectorSegments:function(n,i,r,u,f){if(n&&i){var h=[],c=[],v,o,e,s,l,a;if(i=n.nameTable[n._getChild(i)],(i&&i.isLane||i.isSwimlane)&&i.isLane&&Array.isArray(r)){for(a=this._getIntermediateLanes(n,r,u,f),e=0;e<a.length;e++)s=n.nameTable[n._getChild(a[e])],this._laneConnectors(n,s,h);for(v=this._getSwimlane(n,i.name),l=v.lanes,e=0;e<l.length;e++)s=n.nameTable[n._getChild(l[e])],this._laneConnectors(n,s,c);for(e=0;e<h.length;e++)o=n.nameTable[n._getChild(h[e])],o&&this._connectorRelateTolaneCollection(n,o,[u,f])&&(o.segments=[],t.datavisualization.Diagram.Util._initializeSegments(o,"orthogonal"));for(e=0;e<c.length;e++)o=n.nameTable[n._getChild(c[e])],o&&this._updateConnectorEndPoints(n,o)}}},_isLineInterSectingNode:function(n,i,r){var f=!1,u,h,e,c,l,a,v,y,p,w,o,s;if(i&&r&&(u=t.datavisualization.Diagram.Util.bounds(r),h=[{x:u.topLeft.x,y:u.topLeft.y},{x:u.topRight.x,y:u.topRight.y},{x:u.bottomRight.x,y:u.bottomRight.y},{x:u.bottomLeft.x,y:u.bottomLeft.y},{x:u.topLeft.x,y:u.topLeft.y}]),e=i.segments,e&&e.length>0)for(c=0;!f&&c<e.length;c++)if(l=e[c],l&&l.points.length>0)for(a=l.points,o=0;!f&&o<a.length-1;o++)for(v=a[o],y=a[o+1],s=0;!f&&s<h.length-1;s++)if(p=h[s],w=h[s+1],this._isInterSecting(v.x,v.y,y.x,y.y,p.x,p.y,w.x,w.y,!0)){f=!0;break}return f},_updateConnectorEndPoints:function(n,i){var r,u,f;n&&i&&(r=!1,i.sourcePoint=t.datavisualization.Diagram.Point(),i.targetPoint=t.datavisualization.Diagram.Point(),t.datavisualization.Diagram.Util._initConnectionEnds(i,n),t.datavisualization.Diagram.Util._initializeSegments(i,"orthogonal"),n._dock(i,n.nameTable),i.sourceNode&&(u=n.nameTable[i.sourceNode]),u&&this._isLineInterSectingNode(n,i,u)&&(r=!0),i.targetNode&&(f=n.nameTable[i.targetNode]),f&&this._isLineInterSectingNode(n,i,f)&&(r=this._anySegmentOrtho(i)?!1:!0),r&&(i.segments=[],t.datavisualization.Diagram.Util._initializeSegments(i,"orthogonal"),n._dock(i,n.nameTable)),t.datavisualization.Diagram.Util._initializeSegments(i,"orthogonal"),n._dock(i,n.nameTable))},_anySegmentOrtho:function(n){var r=!1,i,t;if(n&&n.segments&&n.segments.length>0)for(t=0;t<n.segments.length;t++)if(i=n.segments[t],i&&i.type!=="orthogonal"){r=!0;break}return r},_getIntermediateLanes:function(n,t,i,r){var f=[],u;if(t){var e=t.indexOf(i),o=t.indexOf(r),s=Math.min(e,o),h=Math.max(e,o);for(u=s;u<=h;u++)f.push(t[u])}return f},_swapLane:function(i,r,u,f,e,o){var l=i.nameTable[f],w=r.slice(),s=i.tools.move,a=this._getSwimlane(i,u),y,p;if(s._undoObject=n.extend(!0,{},{name1:u,name2:f}),l){var c=t.datavisualization.Diagram.Util.bounds(l),v=r.indexOf(u),h=r.indexOf(f);r.splice(r.indexOf(u),1);h+=v>h?0:-1;h+=e?s.currentPoint.y>=c.y&&s.currentPoint.y<c.center.y?0:1:s.currentPoint.x>=c.x&&s.currentPoint.x<c.center.x?0:1;r.splice(h,0,u)}s._redoObject=n.extend(!0,{},{name1:f,name2:u});y={type:"swapLane",undoObject:jQuery.extend(!0,{},s._undoObject),redoObject:jQuery.extend(!0,{},s._redoObject),currentIndex:v,moveIndex:h,category:"internal"};p=this._getSwimlane(i,u);a&&i._comparePropertyValues(p,"lanes",{lanes:a.lanes},!0);i.addHistoryEntry(y);s._multipleUndo=!0;o&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,o,!1);i.activeTool.selectedObject&&(t.datavisualization.Diagram.canvasHelper._recreateConnectorSegments(i,i.activeTool.selectedObject.name,w,u,f),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdateLane(i,i.activeTool.selectedObject))},_updateHelper:function(n){n.activeTool.helper?(this._updateHelperXY(n,n.activeTool.helper,n.activeTool.previousPoint,n.activeTool.currentPoint),t.datavisualization.Diagram.SvgContext._updateContainerHelper(n)):this._initHelper(n)},_updateHelperXY:function(n,i,r,u){var h=u.x<r.x,c=u.y<r.y,e=n.activeTool.diffx+(u.x-r.x),o=n.activeTool.diffy+(u.y-r.y),f,l=n.activeTool.diagram._enableSnapToObject(),s;n.activeTool.diagram._enableSnapToObject(!0);f=t.datavisualization.Diagram.SnapUtil._snapPoint(n,n.activeTool.helper,h,c,t.datavisualization.Diagram.Point(e,o),u,r);n.activeTool.diagram._enableSnapToObject(l);f||(f=t.datavisualization.Diagram.Point(e,o));n.activeTool.diffx=e-f.x;n.activeTool.diffy=o-f.y;t.datavisualization.Diagram.Geometry.isEmptyPoint(f)||(s=n.activeTool._raiseDragEvent({element:n.getNode(n.activeTool.helper),offset:f,cancel:!1}),s&&!s.cancel&&(n.activeTool._outOfBoundsDrag(i,f.x,f.y)&&n._translate(i,f.x,f.y,n.nameTable),i._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(i,n)))},_initHelper:function(n){n.activeTool.helper=this._getCloneNode(n.activeTool.selectedObject);n.activeTool.helper._name=n.activeTool.selectedObject.name;n.activeTool.helper.name="helper";n.activeTool.startPoint=n.activeTool.currentPoint;t.datavisualization.Diagram.SvgContext._drawContainerHelper(n)},_getCloneNode:function(n){var t=null;return t=jQuery.extend(!0,{},n),t.children=[],t.minHeight=0,t.minWidth=0,t.maxHeight=0,t.maxWidth=0,t},_updateHighlighter:function(n,t){var i=n.activeTool._getMouseOverElement(t);i&&!i.segments&&(!n.activeTool.selectedObject.isLane||i.isLane)?n.activeTool._nodeHighLighter(i,t):n.activeTool._removeHighLighter()},_updateNodeMargin:function(i,r,u){var h,c,a,o,s;if(r._type=="group")for(h=0;h<r.children.length;h++)c=r.children[h],this._updateNodeMargin(i,typeof c=="string"?i.nameTable[c]:c,r);if(r&&u){var l=n.extend(!0,{},r),f=t.datavisualization.Diagram.Util.bounds(r),e=t.datavisualization.Diagram.Util.bounds(u),y=u.container&&u.container.type&&u.container.type=="stack"?!0:!1;y?u.container.orientation==="horizontal"?r.marginTop=f.top-e.top-u.paddingTop:r.marginLeft=f.left-e.left-u.paddingLeft:(r.marginLeft=f.left-e.left-u.paddingLeft,r.marginTop=f.top-e.top-u.paddingTop);var p=f.right-f.left,w=f.bottom-f.top,v=e.x+e.width-(f.x+p)-u.paddingRight;r.marginRight=v<0?0:v;a=e.y+e.height-(f.y+w)-u.paddingBottom;r.marginBottom=a<0?0:a;u.isLane&&(o=0,s=0,u.orientation==="horizontal"?(o=50,s=0):(o=0,s=50),r.marginLeft=r.marginLeft>=o?r.marginLeft:o,r.marginTop=r.marginTop>=s?r.marginTop:s,i._comparePropertyValues(r,"marginLeft",{marginLeft:l.marginLeft},!0),i._comparePropertyValues(r,"marginRight",{marginLeft:l.marginRight},!0),i._comparePropertyValues(r,"marginBottom",{marginLeft:l.marginBottom},!0),i._comparePropertyValues(r,"marginRight",{marginLeft:l.marginRight},!0))}},_singleNodedrag:function(i,r,u){var c=!i.activeTool._checkForDropEvent(u),f,s,h,o;if(c)if(u){if((t.datavisualization.Diagram.Util.canAllowDrop(u)||u.name==i.activeTool.selectedObject.parent)&&u.container&&u.container.type=="canvas")if(s=!u._isBpmn||u._isBpmn&&i.activeTool.selectedObject.parent!=u.name?!0:!1,t.datavisualization.Diagram.canvasHelper._outOfBoundaryNodeDrop(i,i.activeTool.helper,u)&&s)u.isLane&&this._disableConnectorUpdate(i),i.activeTool.seletedObject=i.nameTable[i.activeTool.selectedObject.name],i.activeTool.selectedObject.parent&&(f=i.nameTable[i.activeTool.selectedObject.parent]),i._disablePhaseUpdate=!0,i._disableSwimlaneUptate=!0,this._removeNodeFromContainer(i,i.activeTool.selectedObject),this._addNodeToContainer(i,i.activeTool.selectedObject,u,null,!0),i._raiseGroupChangeEvent(i.activeTool.selectedObject,f,u,"group"),i._comparePropertyValues(i.activeTool.selectedObject,"parent",{parent:f.name},!0),delete i._disablePhaseUpdate,delete i._disableSwimlaneUptate,this._updateLastSwimlanePhase(i,i.activeTool.selectedObject),u.isLane&&this._enableConnectorUpdateNode(i,i.activeTool.selectedObject);else if(u._isBpmn){var e=i.nameTable[i.activeTool.selectedObject.parent],l=e.width,a=e.height,v={x:e.offsetX,y:e.offsetY};i._translate(i.activeTool.selectedObject,i.activeTool.helper.offsetX-i.activeTool.selectedObject.offsetX,i.activeTool.helper.offsetY-i.activeTool.selectedObject.offsetY,i.nameTable);i._updateAssociatedConnectorEnds(i.activeTool.selectedObject,i.nameTable);h=t.datavisualization.Diagram.ContainerHelper.updateparent(u,i);h?(this._removeNodeFromContainer(i,i.activeTool.selectedObject),this._addNodeToContainer(i,i.activeTool.selectedObject,u,null,!0)):t.datavisualization.Diagram.bpmnHelper.updateCanvas(e,i)}else i._translate(i.activeTool.selectedObject,i.activeTool.undoObject.node.offsetX-i.activeTool.selectedObject.offsetX,i.activeTool.undoObject.node.offsetY-i.activeTool.selectedObject.offsetY,i.nameTable),i._updateAssociatedConnectorEnds(i.activeTool.selectedObject,i.nameTable),this._updateLastSwimlanePhase(i,u)}else o=n.extend(!0,{},i.activeTool.selectedObject),i.activeTool.selectedObject.type!="pseudoGroup"&&this._disableConnectorUpdate(i),i.activeTool.selectedObject.parent&&(f=i.nameTable[i.activeTool.selectedObject.parent]),this._removeNodeFromContainer(i,i.activeTool.selectedObject),i._raiseGroupChangeEvent(i.activeTool.selectedObject,f,null,"group"),this._addMultiNodeToDiagram(i,i.activeTool.selectedObject),this._enableConnectorUpdateNode(i,o),i._updateAssociatedConnectorEnds(o,i.nameTable);return!0},_updateLastSwimlanePhase:function(n,i){var r=t.datavisualization.Diagram.ContainerHelper.updateparent(i,n),u,f;r&&r.isLane&&(u=n.nameTable[r.parent],u&&(f=n.nameTable[u.parent],f&&this._updateLastPhase(n,f)))},_updateLastPhase:function(n,i){var f,r;if(i&&i.isSwimlane){var h=n.nameTable[n._getChild(i.children[2])],c=n.nameTable[n._getChild(i.children[1])],o=t.datavisualization.Diagram.stackHelper._getStackBoundsBounds(n,h),s=t.datavisualization.Diagram.stackHelper._getStackBoundsBounds(n,c),e=t.datavisualization.Diagram.SwimLaneContainerHelper.getPhases(n,i),l=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,i),u;u=n.nameTable[n._getChild(l[0])];e.length>0&&(f=n.nameTable[e[e.length-1]],f&&(i.orientation==="horizontal"?(r=o.width-s.width,f.width+=r,f.offset+=r,u&&u.isLane&&(u.minWidth+=r)):(r=o.height-s.height,f.height+=r,f.offset+=r,u&&u.isLane&&(u.minHeight+=r))),t.datavisualization.Diagram.SwimLaneContainerHelper._updatePhaseStack(n,i))}},_disableConnectorUpdate:function(n){n._disableSegmentChange=!0},_enableConnectorUpdate:function(n,t,i){delete n._disableSegmentChange;t&&(n._updateChildAdjacentConnectors(t,!0),i||(n._disableSegmentChange=!0,this._updateSwimalneAssociatedConnectors(n,t,n._svg),delete n._disableSegmentChange),this._updateChildAdjacentConnectors(n,t))},_updateChildAdjacentConnectors:function(n,i){var f=n._getChildTable(i,{}),u,r;for(u in f)r=n.nameTable[u],r&&r.segments&&i.children.indexOf(u)==-1&&t.datavisualization.Diagram.DiagramContext.update(r,n)},_updateSwimalneAssociatedConnectors:function(n,i,r,u){var e=n._getChildren(i.children),o,s,f;if(e&&e.length>0)for(o=0,s=e.length;o<s;o++)f=n.nameTable[e[o]],f&&(f._type==="group"?this._updateSwimalneAssociatedConnectors(n,f,r,u):this._updateSwimalneAssociatedConnectors(n,f,r,u));i.type!="group"&&t.datavisualization.Diagram.SvgContext._updateAssociatedConnector(i,r,n)},_enableConnectorUpdateNode:function(n,t){var i=null,r;t&&t.parent&&(i=n.nameTable[t.parent]);i&&(i.isLane?(r=n.nameTable[i.parent.split("laneStack")[0]],r&&r.isSwimlane&&this._enableConnectorUpdate(n,r)):i.type=="bpmn"&&this._enableConnectorUpdate(n,i))},_enableConnectorUpdatePhase:function(n,t){if(t&&(t.isPhase||t.type==="phase")){var i=n.nameTable[t.parent.split("phaseStack")[0]];i&&i.isSwimlane&&this._enableConnectorUpdate(n,i)}},_enableConnectorUpdateLane:function(n,t){if(t&&t.isLane){var i=n.nameTable[t.parent.split("laneStack")[0]];i&&i.isSwimlane&&this._enableConnectorUpdate(n,i)}},_outOfBoundaryMultiNodeDrop:function(n,i){var r,u,e,o,f;if(t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)&&i&&i.type==="pseudoGroup")for(o=i.children,f=0;f<o.length;f++)if(r=n.nameTable[n._getChild(o[f])],u=this._getTargets(n,r),u&&u.length>0&&!r.segments&&(e=this._getContainerFromTarget(n,u,r),e&&!this._isExeedBounds(n,r,e)))return!1;return!0},_multiNodedrag:function(n,i,r){var u,e,c,l,o,s,h,f,a;if(this._outOfBoundaryMultiNodeDrop(n,r)){if(r){if(n._disableSwimlaneUptate=!0,this._disableConnectorUpdate(n),r.children.length>0)for(l=r.children,o=0;o<l.length;o++)u=n.nameTable[n._getChild(l[o])],e=this._getTargets(n,u),e&&e.length>0?(c=this._getContainerFromTarget(n,e,u),c?this._addNodeToContainer(n,u,c):this._addMultiNodeToDiagram(n,u)):this._addMultiNodeToDiagram(n,u),u.parent&&(s=n.nameTable[u.parent],s&&s.isLane&&(h=n.nameTable[s.parent.split("laneStack")[0]],h&&(n._updateSwimlanes||(n._updateSwimlanes=[]),n._collectionContains(h.name,n._updateSwimlanes)||n._updateSwimlanes.push(h.name))));if(delete n._disableSwimlaneUptate,n._updateSwimlanes&&n._updateSwimlanes.length>0)for(f=0;f<n._updateSwimlanes.length;f++)t.datavisualization.Diagram.DiagramContext.update(n.nameTable[n._updateSwimlanes[f]],n),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(n,n.nameTable[n._updateSwimlanes[f]]);else delete n._disableSegmentChange;delete n._updateSwimlanes;this._getRedoObject(n,r);a={type:"positionchanged",node:jQuery.extend(!0,{},r),undoObject:jQuery.extend(!0,{},n.activeTool._undoObject),redoObject:jQuery.extend(!0,{},n.activeTool._redoObject),category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(a);n.activeTool._multipleUndo=!0;t.datavisualization.Diagram.Util._updateGroupBounds(r,n);n.updateSelection()}}else this._updateBoundsExceedNodes(n,r,"move")},_updateBoundsExceedNodes:function(n,i,r){var h=n.tools[r].undoObject,s=i.children,e,f,u,c,o;for(i.rotateAngle=h.node.rotateAngle,e=0;e<s.length;e++)f=h.childTable[s[e]],u=n.nameTable[s[e]],f&&u&&(r==="move"?n._translate(u,f.offsetX-u.offsetX,f.offsetY-u.offsetY,n.nameTable):r==="resize"?(n._translate(u,f.offsetX-u.offsetX,f.offsetY-u.offsetY,n.nameTable),n.scale(u,f.width/u.width,f.height/u.height,t.datavisualization.Diagram.Point(u.offsetX,u.offsetY),n.nameTable)):r==="rotate"&&(n._translate(u,f.offsetX-u.offsetX,f.offsetY-u.offsetY,n.nameTable),c=f.rotateAngle-u.rotateAngle,u.rotateAngle+=c),u._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(u,n),n._updateAssociatedConnectorEnds(f,n.nameTable),f.parent&&(o=n.nameTable[f.parent],o&&o.children.length>0&&(o.children.push(f.name),u.parent=f.parent)),t.datavisualization.Diagram.DiagramContext.update(f,n));t.datavisualization.Diagram.Util._updateGroupBounds(i,n);n.updateSelection()},_getContainerFromTarget:function(n,i,r){for(var f,e,u=0;u<i.length;u++)if(i[u].container&&i[u].container.type==="canvas"&&(f=t.datavisualization.Diagram.Util.bounds(r),e=t.datavisualization.Diagram.Util.bounds(i[u]),f.center.x>e.left&&f.center.x<e.right&&f.center.y>e.top&&f.center.y<e.bottom))return i[u]},_getTargets:function(n,i){var a=null,s,u=[],h,c,f,e,o,r,l,v;if(i)for(s=t.datavisualization.Diagram.Util.bounds(i),c=t.datavisualization.Diagram.SpatialUtil.findQuads(n._spatialSearch,s),f=0;f<c.length;f++)if(e=c[f],e.objects.length>0)for(o=0;o<e.objects.length;o++)if(r=e.objects[o],!r.segments&&r.visible&&(a=t.datavisualization.Diagram.Util.bounds(r),u.indexOf(r)==-1&&t.datavisualization.Diagram.Geometry.intersectsRect(s,a)))if(r.isSwimlane){l=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(n,r);for(v in l)h=n.nameTable[n._getChild(l[v])],h&&u.splice(0,0,h)}else u.push(r);return u},_removeFromParentContainer:function(n,t){this._removeNodeFromContainer(n,t)},_removeNodeFromContainer:function(n,i,r){var s,h,f,o,u,e;if(n._removedFromContiner=!0,i.type!=="pseudoGroup"){if(e=n.nameTable[i.parent],e){for(f=e.children,s=f,s=s.slice(0),o=0;o<f.length;o++)u=n.nameTable[n._getChild(f[o])],u.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(e.children,f[o]);t.datavisualization.Diagram.SpatialUtil._removeFromaQuad(n._spatialSearch,n._spatialSearch.quadTable[u.name],u);h={element:e,cause:n.activeTool.inAction?t.datavisualization.Diagram.ActionType.Mouse:t.datavisualization.Diagram.ActionType.Unknown,propertyName:"children",oldValue:s,newValue:f};n._raisePropertyChange(h);n._comparePropertyValues(i,"parent",{parent:""},h.cause);i.parent="";u._type==="group"?t.datavisualization.Diagram.SvgContext.renderGroup(u,n._svg,n._diagramLayer,n.nameTable,n):u.segments?t.datavisualization.Diagram.SvgContext.renderConnector(u,n._svg,n._diagramLayer):t.datavisualization.Diagram.SvgContext.renderNode(u,n._svg,n._diagramLayer,undefined,n);r||t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,e,!0)}}else if(f=i.children,f.length>0){for(this._getUndoObject(n,i),o=0;o<f.length;o++)u=n.nameTable[f[o]],u&&this._removeNodeFromContainer(n,u,!0);u.parent&&(e=n.nameTable[u.parent]);e&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,e,!0)}},_addDrgaHistoryEntry:function(n,t){var i={},i=n._getChildTable(t,i),r;n.activeTool._multipleUndo=!0;r={type:"positionchanged",node:jQuery.extend(!0,{},t),childTable:i,category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(r)},_cloneNode:function(t,i,r){var f,e,u;if(i){if(i=n.extend(!0,{},i),i.name+=r,i.parent+=r,i.children&&i.children.length>0)for(e=i.children,u=0;u<e.length;u++)f=t.nameTable[t._getChild(e[u])],f&&(i.children[u]=this._cloneNode(t,f,r));return i}},_isExeedBounds:function(n,i,r){var s,o,f,u,e,h,c;if(n._disableUpdateQuad=!0,i&&r&&r.isLane&&(s=n.nameTable[r.parent.split("laneStack")[0]],s)){if(o=t.datavisualization.Diagram.Util.randomId(),f=n._cloneSwimlaneObj(n._getNode(s.name),o),f=t.datavisualization.Diagram.ContainerHelper._initContainer(n,f),u=this._cloneNode(n,i,o),n.nameTable[u.name]=u,e=n.nameTable[r.name+o],e){if((e.children.push(u.name),this._updateNodeMargin(n,u,n.nameTable[r.name+o]),n._disableSwimlaneUptate=!0,this._disableConnectorUpdate(n),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,e),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f),delete n._disableSegmentChange,delete n._disableSwimlaneUptate,h=t.datavisualization.Diagram.Util.bounds(f),t.datavisualization.Diagram.containerCommon._removeObject(n,e),t.datavisualization.Diagram.containerCommon._removeObject(n,f),delete n._disableUpdateQuad,c=n.activeTool._getPageBounds(),h.bottom>c.height)||h.right>c.width)return!1;e.children.pop(u.name)}n.nameTable[u.name]}return delete n._disableUpdateQuad,!0},_outOfBoundaryNodeDrop:function(n,i,r){return t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)?this._isExeedBounds(n,i,r):!0},_addNodeToContainer:function(i,r,u,f,e){var h,w,c,v,o,y,nt,tt,it,l,a,s,p;if(i.getObjectType(r)!=="connector"&&r&&u&&!r.isPhase)if(r.parent&&(h=i.nameTable[r.parent],h.container||(w=h.children,t.datavisualization.Diagram.Util.removeFromCollection(i,w,r),t.datavisualization.Diagram.Util._updateGroupBounds(h,i))),r.type!=="pseudoGroup"){var b=t.datavisualization.Diagram.Util.bounds(i.activeTool.helper),k=t.datavisualization.Diagram.Util.bounds(i.activeTool.selectedObject),d=i.activeTool.helper?b.x-k.x:0,g=i.activeTool.helper?b.y-k.y:0;i._raiseOffsetPropertyChange(r,r.offsetX+d,r.offsetY+g,!0);i._translate(r,d,g,i.activeTool.diagram.nameTable);c=u.children;c=c.slice(0);u.children.push(r.name);v={element:u,cause:i.activeTool.inAction?t.datavisualization.Diagram.ActionType.Mouse:t.datavisualization.Diagram.ActionType.Unknown,propertyName:"children",oldValue:c,newValue:u.children};i._raisePropertyChange(v);i._comparePropertyValues(r,"parent",{parent:u.name},v.cause);r.parent=u.name;this._updateNodeMargin(i,r,u);i._isDragg&&(o=i._historyList,o&&o.currentEntry&&o.currentEntry.object&&o.currentEntry.object.parent===""&&(o.currentEntry.object=n.extend(!0,{},r)));y=i._svg.getElementById(u.name);r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,y):r.segments||t.datavisualization.Diagram.DiagramContext.renderNode(r,i,y);this._disableConnectorUpdate(i);f||(u.type=="bpmn"&&(nt=n.extend(!0,{},{node:u})),tt=jQuery.extend(!0,{},u),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),this._updateAddRemoveNodeConnectors(i,u,tt),u.type=="bpmn"&&(i._isGroupActionEnabled=!0,i._startGroupAction(),it={type:"sizechanged",node:jQuery.extend(!0,{},u),undoObject:nt,redoObject:n.extend(!0,{},{node:u}),category:"internal"},i.addHistoryEntry(it)));this._updateLastSwimlanePhase(i,r);e||this._enableConnectorUpdateNode(i,r);i._findLabelEditing&&u.children.splice(u.children.indexOf(r.name),1)}else if(l=r.children,l.length>0){for(a=0;a<l.length;a++)s=i.nameTable[i._getChild(l[a])],s&&this._addNodeToContainer(i,s,u,!0);s&&s.parent&&(p=i.nameTable[s.parent]);p&&(t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,p,!0),t.datavisualization.Diagram.Util._updateGroupBounds(r,i),t.datavisualization.Diagram.SvgContext.updateSelector(r,i._adornerSvg,i._currZoom,i,i.model.selectedItems.constraints))}},_addMultiNodeToDiagram:function(n,i){var r,u,o;if(n.activeTool.helper){var f=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),e=t.datavisualization.Diagram.Util.bounds(i),s=n.activeTool.helper?f.x-e.x:0,h=n.activeTool.helper?f.y-e.y:0;n._translate(i,s,h,n.nameTable)}for(r=n.nodes(),u=r.length-1;u>=0;u--)o=n.nameTable[n._getChild(r[u])],i.name===o.name&&t.datavisualization.Diagram.Util.removeItem(r,r[u]);n.nodes().push(i);n._removedFromContiner&&(i._type==="group"?t.datavisualization.Diagram.SvgContext.renderGroup(i,n._svg,n._diagramLayer,n.nameTable,n):i.segments?t.datavisualization.Diagram.SvgContext.renderConnector(i,n._svg,n._diagramLayer):t.datavisualization.Diagram.SvgContext.renderNode(i,n._svg,n._diagramLayer,undefined,n));delete n._removedFromContiner;n.activeTool.helper&&this._updateLastSwimlanePhase(n,n.activeTool.helper)},_singleNodeResize:function(n,t,i){n.activeTool.selectedObject&&this._resizeNode(n,i)},_resizeNode:function(n,i){var r;if(i){var f=t.datavisualization.Diagram.Util.bounds(i),e=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),u=!0;i.container||(i.parent==""&&i._parent&&(i.parent=i._parent,delete i._parent,u=!1),i.segments||(i.parent&&(r=n.nameTable[i.parent]),r&&r.isLane&&this._disableConnectorUpdate(n),u&&n.activeTool._updateSize(i,n.activeTool.startPoint,n.activeTool.currentPoint),r&&(this._updateNodeMargin(n,i,r),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0),this._updateLastSwimlanePhase(n,i)),this._enableConnectorUpdateNode(n,i)))}},_updateResizeHelper:function(n){var i,r;n.activeTool.helper?(i=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),n._resizeStack=!0,n.activeTool._updateSize(n.activeTool.helper,n.activeTool.previousPoint,n.activeTool.currentPoint,null,null,null,!0),delete n._resizeStack,r=t.datavisualization.Diagram.Util.bounds(n.activeTool.helper),n.activeTool.selectedObject.container&&!n.activeTool.helper._isBpmn&&n._translate(n.activeTool.helper,i.topLeft.x-r.topLeft.x,i.topLeft.y-r.topLeft.y,n.nameTable),t.datavisualization.Diagram.SvgContext._updateContainerHelper(n)):(n.activeTool.helper=n.activeTool._getCloneNode(n.activeTool.selectedObject),n.activeTool.helper.inEdges=n.activeTool.helper.outEdges=[],n.activeTool.helper.type=null,n.activeTool.helper.name="helper",t.datavisualization.Diagram.SvgContext._drawContainerHelper(n),n.activeTool._startPoint=n.activeTool.currentPoint,n._resizeStack=!0,n.activeTool._updateSize(n.activeTool.helper,n.activeTool.previousPoint,n.activeTool.currentPoint,null,null,null,!0),delete n._resizeStack)},_multiNodeResize:function(n,i,r){var u,f,o,s,e,h;if(r)if(this._outOfBoundaryMultiNodeDrop(n,r)){if(r.children.length>0)for(s=r.children,e=0;e<s.length;e++)u=n.nameTable[n._getChild(s[e])],f=this._getTargets(n,u),f&&f.length>0?(o=this._getContainerFromTarget(n,f,u),o?this._addNodeToContainer(n,u,o):this._addMultiNodeToDiagram(n,u)):this._addMultiNodeToDiagram(n,u);this._getRedoObject(n,r);h={type:"sizechanged",node:jQuery.extend(!0,{},r),undoObject:jQuery.extend(!0,{},n.activeTool._undoObject),redoObject:jQuery.extend(!0,{},n.activeTool._redoObject),category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(h);n.activeTool._multipleUndo=!0;t.datavisualization.Diagram.Util._updateGroupBounds(r,n);n.updateSelection()}else this._updateBoundsExceedNodes(n,r,"resize")},_singleNodeRotate:function(n,t,i){n.activeTool.selectedObject&&this._rotateNode(n,i)},_rotateNode:function(n,i){var u,r,e,f;i&&(u=!0,i.container||(i.parent==""&&i._parent&&(i.parent=i._parent,delete i._parent,u=!1),i.parent&&(r=n.nameTable[i.parent]),r&&r.isLane&&this._disableConnectorUpdate(n),i.segments||(u&&(e=n.nameTable[n.activeTool.selectedObject.name],n.activeTool.helper&&(f=n.activeTool.helper.rotateAngle-n.nameTable[n.activeTool.selectedObject.name].rotateAngle,n._comparePropertyValues(i,"rotateAngle",{rotateAngle:n.activeTool.helper.rotateAngle},!0),n._rotate(n.activeTool.selectedObject,f,n.nameTable))),r&&(this._updateNodeMargin(n,i,r),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0),this._updateLastSwimlanePhase(n,i)),this._enableConnectorUpdateNode(n,i))))},_multiNodeRotate:function(n,i,r){var u,f,o,s,e,h;if(r)if(this._outOfBoundaryMultiNodeDrop(n,r)){if(r.children.length>0)for(s=r.children,e=0;e<s.length;e++)u=n.nameTable[n._getChild(s[e])],f=this._getTargets(n,u),f&&f.length>0?(o=this._getContainerFromTarget(n,f,u),o?this._addNodeToContainer(n,u,o):this._addMultiNodeToDiagram(n,u)):this._addMultiNodeToDiagram(n,u);this._getRedoObject(n,r);h={type:"rotationchanged",node:jQuery.extend(!0,{},r),undoObject:jQuery.extend(!0,{},n.activeTool._undoObject),redoObject:jQuery.extend(!0,{},n.activeTool._redoObject),category:"internal",swimlaneMultiSelection:!0};n.addHistoryEntry(h);n.activeTool._multipleUndo=!0;t.datavisualization.Diagram.Util._updateGroupBounds(r,n);n.updateSelection()}else this._updateBoundsExceedNodes(n,r,"rotate")},_updateDropLaneProperties:function(n,i,r){if(i&&r){i.orientation=r.orientation;i.horizontalAlign=r.orientation==="horizontal"?"stretch":"left";i.verticalAlign=r.orientation==="vertical"?"stretch":"top";i.paddingBottom=20;i.paddingTop=20;i.paddingLeft=20;i.paddingRight=20;var u=n.nameTable[i.children[0]];u&&(u.marginLeft=-20,u.marginTop=-20,u.marginRight=-20,u.marginBottom=-20,u.constraints=t.datavisualization.Diagram.NodeConstraints.Default^t.datavisualization.Diagram.NodeConstraints.Select^t.datavisualization.Diagram.NodeConstraints.Connect,u._isHeader=!0)}return i},_updateAddRemoveNodeConnectors:function(n,t,i){if(t&&t.isLane&&i&&i.isLane){var r=0,u=0;r=t.width-i.width;u=t.height-i.height;(r||u)&&this._updateOverlappedConnectorSegment(n,i,r,u)}},_updateAddRemoveLaneConnectors:function(n,t){if(t&&t.isLane){var r=[],u,e,f,i,t;for(e=this._getSwimlane(n,t.name),f=e.lanes,i=0;i<f.length;i++)t=n.nameTable[n._getChild(f[i])],this._laneConnectors(n,t,r);for(i=0;i<r.length;i++)u=n.nameTable[n._getChild(r[i])],u&&this._updateConnectorEndPoints(n,u)}},_outOfBoundaryAddLane:function(i,r,u,f){var e,o,s,h,c;return t.datavisualization.Diagram.Util.canMoveOutofBoundary(i)&&((e=i._cloneSwimlaneObj(i._getNode(r.name),t.datavisualization.Diagram.Util.randomId()),e=t.datavisualization.Diagram.ContainerHelper._initContainer(i,e),o=i.activeTool._cloneGroupNode(n.extend(!0,{},u),t.datavisualization.Diagram.Util.randomId()),i.nameTable[o.name]=o,s=i.nameTable[i._getChild(e.children[2])],f||f===0?s.children.splice(f,0,o.name):s.children.push(o.name),o.parent=s.name,i._disableSwimlaneUptate=!0,this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,o),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,e),this._enableConnectorUpdate(i,e),delete i._disableSwimlaneUptate,h=t.datavisualization.Diagram.Util.bounds(e),t.datavisualization.Diagram.containerCommon._removeObject(i,o),t.datavisualization.Diagram.containerCommon._removeObject(i,e),c=i.activeTool._getPageBounds(),h.bottom>c.height)||h.right>c.width)?!1:!0},_addNewLane:function(n,i,r,u,f){var l,o,e,a,c,f,s,h,v,y;if(n.activeTool._removeHelpers(),o=n.nameTable[n._getChild(r.children[2])],o){if(e=n.activeTool._cloneGroupNode(n.activeTool.selectedObject,u?"":t.datavisualization.Diagram.Util.randomId()),e=this._updateDropLaneProperties(n,e,r),a=n._isUndo,n._isUndo=!0,n.activeTool.selectedObject=null,n.remove(n.activeTool.selectedObject),n._isUndo=a,n._isUndo||this._outOfBoundaryAddLane(n,r,e,f)){if(c={element:n.getNode(e),cancel:!1,target:i},i&&(f=f!==undefined?f:n.activeTool._getSwimLaneStackIndex(i)),f||f===0?o.children.splice(f,0,e.name):o.children.push(e.name),e.parent=o.name,n._raiseDropEvent(c),n.remove(e),!c.cancel){if(n.activeTool._isLane=!0,e.isLane&&(s=n.nameTable[n._getChild(e.children[0])],s&&e.labels&&s.labels.length>0))for(h=0;h<s.labels.length;h++)s.labels[h].visible=!0;n._isUndo||(v=n._getChildTable(e,{}),y={type:"collectionchanged",object:jQuery.extend(!0,{},e),childTable:jQuery.extend(!0,{},v),index:f,changeType:"insert",category:"internal"},n.addHistoryEntry(y));n.add(e)&&n._updateDroppedSymbol(e)}this._disableConnectorUpdate(n);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,o);this._updateAddRemoveLaneConnectors(n,e);t.datavisualization.Diagram.canvasHelper._updateLastPhase(n,r);this._enableConnectorUpdateLane(n,e);l=!0}n._clearSelection(!0);l&&n._addSelection(r,!0);n.activeTool.selectedObject=null}},_outOfBoundsOnLaneResize:function(n,i,r){var e,o,u,f,s,h;return t.datavisualization.Diagram.Util.canMoveOutofBoundary(n)&&(e=r?n.nameTable[i.parent.split("laneStack")[0]]:i,o=t.datavisualization.Diagram.Util.randomId(),e&&((u=n._cloneSwimlaneObj(n._getNode(e.name),o),u=t.datavisualization.Diagram.ContainerHelper._initContainer(n,u),r?(f=n.nameTable[i.name+o],f&&(f.minWidth=n.activeTool.helper.width,f.minHeight=n.activeTool.helper.height)):(u.minWidth=n.activeTool.helper.width,u.minHeight=n.activeTool.helper.height),n._disableSwimlaneUptate=!0,this._disableConnectorUpdate(n),r&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,u),this._enableConnectorUpdateLane(n,u),delete n._disableSwimlaneUptate,s=t.datavisualization.Diagram.Util.bounds(u),t.datavisualization.Diagram.containerCommon._removeObject(n,u),h=n.activeTool._getPageBounds(),s.bottom>h.height)||s.right>h.width))?!1:!0},_getLaneIndex:function(n,t){for(var r=n.lanes,i=0;i<r.length;i++)if(t.name===r[i].name)return i;return null},_isCanAddNodeToSegmentUpdate:function(n,t,i){if(i)if(i&&i.parent){var r=n.nameTable[i.parent],u,f;if(r&&r.isLane){if(u=this._getSwimlane(n,r.name),f=this._getLaneIndex(u,r),f>t)return!0}else return!1}else return!1;return!1},_getUpdateConnectorByEdges:function(n,t,i,r){t&&(this._getUpdateSegmentConnectors(n,t,i,r,t.inEdges),this._getUpdateSegmentConnectors(n,t,i,r,t.outEdges))},_getUpdateSegmentConnectors:function(n,t,i,r,u){var f,o,s,e;if(u&&u.length>0)for(e=0;e<u.length;e++)f=n.nameTable[u[e]],f.sourceNode&&(o=n.nameTable[f.sourceNode]),f.targetNode&&(s=n.nameTable[f.targetNode]),o&&s&&this._isCanAddNodeToSegmentUpdate(n,i,o)&&this._isCanAddNodeToSegmentUpdate(n,i,s)&&!n._collectionContains(f.name,r)&&r.push(f)},_updateConnectorSegments:function(n,i,r,u){var l=this._getSwimlane(n,i.name),o,e,h,f,c,s;if(o=this._getLaneIndex(l,i),o!=null)for(e=[],h=l.lanes,f=o+1;f<h.length;f++)for(c=h[f].children,s=0;s<c.length;s++)this._getUpdateConnectorByEdges(n,c[s],o,e);if(e&&e.length>0&&r!=null&&u!=null)for(f=0;f<e.length;f++)t.datavisualization.Diagram.Util._translateLine(e[f],r,u,e[f])},_resizeLane:function(i,r){var u=i.nameTable[r.name],a=!0,v,c,l,y,p,h,e,f,s;if(u)if(u.isLane||u._isBpmn){if(this._outOfBoundsOnLaneResize(i,u,!0)){if(u.type=="bpmn"&&u.container){var o=i.activeTool.helper,w=o.width/r.width,b=o.height/r.height,k={x:r.offsetX,y:r.offsetY};i._raiseSizePropertyChange(r,o.width/r.width,o.height/r.height,!0);i.activeTool._undoObject=n.extend(!0,{},{node:u});u=n.extend(!0,u,{width:o.width,height:o.height,offsetX:o.offsetX,offsetY:o.offsetY,minWidth:o.width,minHeight:o.height});u.parent?(v=t.datavisualization.Diagram.ContainerHelper.updateparent(u,i),v?(u.minWidth=i.activeTool.helper.width,u.minHeight=i.activeTool.helper.height,t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),this._updateLastSwimlanePhase(i,u)):t.datavisualization.Diagram.bpmnHelper.updateCanvas(u,i)):t.datavisualization.Diagram.bpmnHelper.updateCanvas(u,i);t.datavisualization.Diagram.DefautShapes.translateBPMNAnnotationShape(u,1/w,1/b,k,i);i.activeTool._redoObject=n.extend(!0,{},{node:u})}else u.container&&(i._raiseSizePropertyChange(r,i.activeTool.helper.width/r.width,i.activeTool.helper.height/r.height,!0),i.activeTool._undoObject=n.extend(!0,{},{node:u}),i._comparePropertyValues(r,"minWidth",{minWidth:i.activeTool.helper.width},!0),i._comparePropertyValues(r,"offsetX",{offsetX:r.offsetX+i.activeTool.helper.width/2},!0),u.minWidth=i.activeTool.helper.width<=100?100:i.activeTool.helper.width,i._comparePropertyValues(r,"minHeight",{minHeight:i.activeTool.helper.height},!0),i._comparePropertyValues(r,"offsetY",{offsetY:r.offsetY+i.activeTool.helper.height/2},!0),u.minHeight=i.activeTool.helper.height<=100?100:i.activeTool.helper.height,i.activeTool._redoObject=n.extend(!0,{},{node:u}));s={type:"sizechanged",node:jQuery.extend(!0,{},u),undoObject:jQuery.extend(!0,{},i.activeTool._undoObject),redoObject:jQuery.extend(!0,{},i.activeTool._redoObject),category:"internal"};i.addHistoryEntry(s);i.activeTool._multipleUndo=!0;u.isLane&&(this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),c=u.width-i.activeTool._undoObject.node.width,l=u.height-i.activeTool._undoObject.node.height,y=i._preventDocking,p=i._disableSegmentChange,delete i._preventDocking,delete i._disableSegmentChange,this._updateOverlappedConnectorSegment(i,i.activeTool._undoObject.node,c,l),i._preventDocking=y,i._disableSegmentChange=p,this._updateConnectorSegments(i,u,c,l),this._enableConnectorUpdateLane(i,u))}}else u.isSwimlane?(h=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(i,u),h.length>0&&(f=i.nameTable[h[h.length-1]],f&&(i.activeTool._undoObject=n.extend(!0,{},{node:f}),i._raiseSizePropertyChange(u,i.activeTool.helper.width/u.width,i.activeTool.helper.height/u.height,!0),u.orientation==="vertical"?(e=f.width+i.activeTool.helper.width-u.width,i._comparePropertyValues(f,"minWidth",{minWidth:e},!0),i._comparePropertyValues(f,"offsetX",{offsetX:r.offsetX+e/2},!0),f.minWidth=e<=100?100:e):(e=f.height+i.activeTool.helper.height-u.height,e==f.minHeight?a=!1:(i._comparePropertyValues(f,"minHeight",{minHeight:e},!0),i._comparePropertyValues(f,"offsetY",{offsetY:r.offsetY+e/2},!0),f.minHeight=e<=100?100:e)),a&&(this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0),this._enableConnectorUpdateLane(i,u),i.activeTool._redoObject=n.extend(!0,{},{node:f}),s={type:"sizechanged",node:jQuery.extend(!0,{},u),undoObject:jQuery.extend(!0,{},i.activeTool._undoObject),redoObject:jQuery.extend(!0,{},i.activeTool._redoObject),category:"internal"},i.addHistoryEntry(s),i.activeTool._multipleUndo=!0,this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0),this._enableConnectorUpdateLane(i,u))))):u.container&&(u.minWidth=i.activeTool.helper.width,u.minHeight=i.activeTool.helper.height,t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,u,!0))},_updateOverlappedConnectorSegment:function(n,i,r,u){var y,p,w,l,e,o,a,s,f,v,h,c,b;if(i&&(r!=undefined&&u!=undefined&&(h=this._overLappedConnectros(n,i)),h&&h.length>0))for(c=t.datavisualization.Diagram.Util.bounds(i),i.orientation==="horizontal"?(y=c.bottomLeft,p=c.bottomRight):(y=c.topRight,p=c.bottomRight),w=[],l=0;l<h.length;l++)if(e=this._lineSegmentsIntersect(n,i,h[l],{start:y,end:p}),e&&e.length>0)for(o=0;o<e.length;o++)a=Object.keys(e[o])[0],s=e[o][a].index,b=e[o][a].point,f=n.nameTable[n._getChild(a)],f&&f.segments&&f.segments.length>0&&(i.orientation==="horizontal"?(f.segments[s]&&(v=f.segments[s].length),v&&(f.segments[s].length+=u)):(v=f.segments[s].length,v&&(f.segments[s].length+=r)),this._updateConnectorEndPoints(n,f))},_lineSegmentsIntersect:function(n,t,i,r){var c,l,y,p,o,u,f,e,s,w,b,k,d,a,v,g,h;if(c=r.start.x,l=r.start.y,y=r.end.x,p=r.end.y,v=[],g=t&&t.orientation?t.orientation:"horizontal",i=n.nameTable[n._getChild(i)],i&&i.segments&&i.segments.length>0&&i.segments.length!==1)for(o=0;o<i.segments.length;o++)if(u=i.segments[o],u&&u.points.length>0)for(f=0;f<u.points.length-1;f++)e=u.points[f],s=u.points[f+1],e&&s&&(w=e.x,b=e.y,k=s.x,d=s.y,this._isInterSecting(c,l,y,p,w,b,k,d)&&(a={},h=f,g==="horizontal"?e.y>l&&(h=-1):e.x>c&&(h=-1),a[i.name]={index:o,point:h},v.push(a)));return v},_isInterSecting:function(n,t,i,r,u,f,e,o,s){var l=i-n,a=r-t,v=e-u,y=o-f,h=(-a*(n-u)+l*(t-f))/(-v*a+l*y),c=(+v*(t-f)-y*(n-u))/(-v*a+l*y);return s?h>0&&h<1&&c>0&&c<1:h>=0&&h<=1&&c>=0&&c<=1},_overLappedConnectros:function(n,t){var f=this._getSwimlane(n,t.name),o,i,e,r,u;if(f&&f.isSwimlane&&(o=this._getLaneIndex(f,t),i=n.nameTable[t.parent],e=[],i&&i.isLaneStack&&i&&i.children.length>0))for(r=o;r>=0;r--)u=n.nameTable[n._getChild(i.children[r])],u&&u.isLane&&this._laneConnectors(n,u,e);return e},_getUndoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._undoObject=n.extend(!0,{},{node:i,childTable:r})},_getRedoObject:function(t,i){var r={},r=t._getChildTable(i,r);t.activeTool._redoObject=n.extend(!0,{},{node:i,childTable:r})},_undoRemoveNodeFromContainer:function(n,i){var r,f,e,u;if(i.type!=="pseudoGroup"&&(r=n.nameTable[i.parent],r)){for(i.parent="",f=r.children,u=0;u<f.length;u++)e=n.nameTable[n._getChild(f[u])],e&&e.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(r.children,f[u]);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0)}},_undoAddNodeToContainer:function(i,r,u){if(r.type!=="pseudoGroup"){var f=i.nameTable[u.parent],e;i._translate(r,u.offsetX-r.offsetX,u.offsetY-r.offsetY,i.nameTable);f&&(r.parent=f.name,f.children.push(r.name),e=i._svg.getElementById(f.name),f._isBpmn?(t.datavisualization.Diagram.bpmnHelper.resetNodeMargin(r,f,i),r=n.extend(!0,r,{marginLeft:u.marginLeft,marginRight:u.marginRight,marginTop:u.marginTop,marginBottom:u.marginBottom})):this._updateNodeMargin(i,r,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0));r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):r.segments?t.datavisualization.Diagram.DiagramContext.renderConnector(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e)}},_undoDragNode:function(t,i,r,u){if(r=n.extend(!0,{},r),i&&r&&i.type!=="pseudoGroup"){var e=n.extend(!0,{},r),f=n.extend(!0,{},i);u||(this._disableConnectorUpdate(t),t._disableSwimlaneUptate=!0);this._undoRemoveNodeFromContainer(t,i);this._undoAddNodeToContainer(t,i,r);u||delete t._disableSwimlaneUptate;t._clearSelection(!0);t._addSelection(i,!0);this._updateLastSwimlanePhase(t,i);u||(f.parent?this._enableConnectorUpdateNode(t,f):this._enableConnectorUpdateNode(t,e))}},_undoMultiDragNode:function(i,r){var u=n.extend(!0,{},r.node),s,a,h,f,e,c,l,o;if(u&&u.type==="pseudoGroup"){for(a=u.children,i._disableSwimlaneUptate=!0,h=0;h<a.length;h++)this._disableConnectorUpdate(i),f=i.nameTable[i._getChild(a[h])],e=f.parent,s=r.undo&&f?r.undoObject.childTable?r.undoObject.childTable[f.name]:null:r.redoObject.childTable?r.redoObject.childTable[f.name]:null,this._undoDragNode(i,f,s,!0),e||s.parent&&(e=s.parent),e?(c=i.nameTable[e],c&&c.isLane&&(l=i.nameTable[c.parent.split("laneStack")[0]],l&&(i._updateSwimlanes||(i._updateSwimlanes=[]),i._collectionContains(l.name,i._updateSwimlanes)||i._updateSwimlanes.push(l.name)))):(delete i._disableSegmentChange,this._updateAssociatedConnectorEnds(i,f,i.nameTable)),delete i._disableSegmentChange,this._updateAssociatedConnectorEnds(i,f,i.nameTable);if(delete i._disableSwimlaneUptate,i._updateSwimlanes&&i._updateSwimlanes.length>0)for(o=0;o<i._updateSwimlanes.length;o++)t.datavisualization.Diagram.DiagramContext.update(i.nameTable[i._updateSwimlanes[o]],i),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdate(i,i.nameTable[i._updateSwimlanes[o]]);delete i._updateSwimlanes;i._clearSelection(!0);t.datavisualization.Diagram.Util._updateGroupBounds(u,i);i._addSelection(u,!0);delete i.nameTable[u.name];i.nameTable[u.name]=u}},_updateAssociatedConnectorEnds:function(n,i,r){var f,o,u,c,e,h,s;if(n.getObjectType(i)!=="connector"&&(i.inEdges.length||i.outEdges.length)){for(c=n._isNodeToNodeConnection(i),e=i,i.type=="bpmn"&&i._type=="group"&&(e=typeof i.children[0]=="object"?i.children[0]:n.nameTable[i.children[0]]),c&&(h=t.datavisualization.Diagram.Util._findSegmentPoints(e)),s={},n._parentNode&&(s=n._getChildTable(n._parentNode,{})),f=0,o=i.inEdges.length;f<o;f++)u=r[i.inEdges[f]],!u||n._parentNode&&s[u.sourceNode]||(u.targetPadding?delete e._segmentPoints:e._segmentPoints=h,n._dock(u,r),t.datavisualization.Diagram.DiagramContext.update(u,n));for(f=0,o=i.outEdges.length;f<o;f++)u=r[i.outEdges[f]],!u||n._parentNode&&s[u.targetNode]||(u.sourcePadding?delete e._segmentPoints:e._segmentPoints=h,n._dock(u,r));delete e._segmentPoints}},_undoRemoveResizeNodeFromContainer:function(n,i){var r,f,e,u;if(i.type!=="pseudoGroup"&&(r=n.nameTable[i.parent],r)){for(i.parent="",f=r.children,u=0;u<f.length;u++)e=n.nameTable[n._getChild(f[u])],e&&e.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(r.children,f[u]);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0)}},_undoAddResizeNodeToContainer:function(i,r,u){if(r.type!=="pseudoGroup"){var f=i.nameTable[u.parent],e;r.segments||(i._translate(r,u.offsetX-r.offsetX,u.offsetY-r.offsetY,i.nameTable),i.scale(r,u.width/r.width,u.height/r.height,t.datavisualization.Diagram.Point(r.offsetX,r.offsetY),i.nameTable),r._type==="group"&&t.datavisualization.Diagram.Util._updateGroupBounds(r,i),r.container&&t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,r,!0));f&&(r.parent=f.name,f.children.push(r.name),e=i._svg.getElementById(f.name),f._isBpmn?(t.datavisualization.Diagram.bpmnHelper.resetNodeMargin(r,f,i),r=n.extend(!0,r,{marginLeft:u.marginLeft,marginRight:u.marginRight,marginTop:u.marginTop,marginBottom:u.marginBottom})):this._updateNodeMargin(i,r,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0));r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):r.segments?t.datavisualization.Diagram.DiagramContext.renderConnector(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e)}},_undoResizeNode:function(t,i,r,u){r=n.extend(!0,{},r);i&&r&&i.type!=="pseudoGroup"&&(u||this._disableConnectorUpdate(t),this._undoRemoveResizeNodeFromContainer(t,i),this._undoAddResizeNodeToContainer(t,i,r),t._clearSelection(!0),t._addSelection(i,!0),this._updateLastSwimlanePhase(t,i),u||this._enableConnectorUpdateNode(t,i))},_undoMultiResizeNode:function(i,r){var u=n.extend(!0,{},r.node),s,o,e,f;if(u&&u.type==="pseudoGroup"){for(o=u.children,e=0;e<o.length;e++)f=i.nameTable[i._getChild(o[e])],s=r.undo&&f?r.undoObject.childTable?r.undoObject.childTable[f.name]:null:r.redoObject.childTable?r.redoObject.childTable[f.name]:null,this._undoResizeNode(i,f,s);i._clearSelection(!0);t.datavisualization.Diagram.Util._updateGroupBounds(u,i);i._addSelection(u,!0);delete i.nameTable[u.name];i.nameTable[u.name]=u}},_undoResizeLane:function(i,r,u){var f=i.nameTable[r.name],o,e,s,h,c,l;f&&(u&&u.node&&u.node.isSwimlane?(o=t.datavisualization.Diagram.SwimLaneContainerHelper.getLanes(i,u.node),o.length>0&&(e=i.nameTable[o[o.length-1]],e&&(r=u.undo?u.undoObject&&u.undoObject.node?u.undoObject.node:e:u.undoObject&&u.redoObject.node?u.redoObject.node:e,i._comparePropertyValues(e,"minWidth",{minWidth:r.minWidth}),e.minWidth=r.minWidth,i._comparePropertyValues(e,"minHeight",{minHeight:r.minHeight}),e.minHeight=r.minHeight,this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0),this._enableConnectorUpdateLane(i,f)))):f.isLane&&(f.container&&(i.activeTool._undonode=n.extend(!0,{},{node:f}),i._comparePropertyValues(f,"minWidth",{minWidth:r.minWidth}),f.minWidth=r.minWidth,i._comparePropertyValues(f,"minHeight",{minHeight:r.minHeight}),f.minHeight=r.minHeight),this._disableConnectorUpdate(i),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0),s=f.width-i.activeTool._undonode.node.width,h=f.height-i.activeTool._undonode.node.height,c=i._preventDocking,l=i._disableSegmentChange,delete i._preventDocking,delete i._disableSegmentChange,this._updateOverlappedConnectorSegment(i,i.activeTool._undonode.node,s,h),i._preventDocking=c,i._disableSegmentChange=l,this._updateConnectorSegments(i,f,s,h),this._enableConnectorUpdateLane(i,f)))},_undoRemoveRotateNodeFromContainer:function(n,i){var r,f,e,u;if(i.type!=="pseudoGroup"&&(r=n.nameTable[i.parent],r)){for(i.parent="",f=r.children,u=0;u<f.length;u++)e=n.nameTable[n._getChild(f[u])],e&&e.name===i.name&&t.datavisualization.Diagram.Util.removeChildFromGroup(r.children,f[u]);t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,r,!0)}},_undoAddRotateNodeToContainer:function(i,r,u){var f,e,o;r.type!=="pseudoGroup"&&(f=i.nameTable[u.parent],r.segments||(o=u.rotateAngle-r.rotateAngle,i._rotate(r,o,i.nameTable)),f&&(r.parent=f.name,f.children.push(r.name),e=i._svg.getElementById(f.name),f._isBpmn?(t.datavisualization.Diagram.bpmnHelper.resetNodeMargin(r,f,i),r=n.extend(!0,r,{marginLeft:u.marginLeft,marginRight:u.marginRight,marginTop:u.marginTop,marginBottom:u.marginBottom})):this._updateNodeMargin(i,r,f),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(i,f,!0)),r._type==="group"?t.datavisualization.Diagram.DiagramContext.renderGroup(r,i,e):r.segments?t.datavisualization.Diagram.DiagramContext.renderConnector(r,i,e):t.datavisualization.Diagram.DiagramContext.renderNode(r,i,e))},_undoRotateNode:function(t,i,r,u){r=n.extend(!0,{},r);i&&r&&i.type!=="pseudoGroup"&&(u||this._disableConnectorUpdate(t),this._undoRemoveRotateNodeFromContainer(t,i),this._undoAddRotateNodeToContainer(t,i,r),t._clearSelection(!0),t._addSelection(i,!0),this._updateLastSwimlanePhase(t,i),u||this._enableConnectorUpdateNode(t,i))},_undoMultiRotateNode:function(i,r){var u=n.extend(!0,{},r.node),o,s,e,f;if(u&&u.type==="pseudoGroup"){for(s=u.children,e=0;e<s.length;e++)f=i.nameTable[i._getChild(s[e])],o=r.undo&&f?r.undoObject.childTable?r.undoObject.childTable[f.name]:null:r.redoObject.childTable?r.redoObject.childTable[f.name]:null,this._undoRotateNode(i,f,o,!0);i._clearSelection(!0);u.rotateAngle=o.rotateAngle;t.datavisualization.Diagram.Util._updateGroupBounds(u,i);i._addSelection(u,!0);delete i.nameTable[u.name];i.nameTable[u.name]=u}},_undoSwap:function(n,i){var r,e,o,s;n.activeTool._removeHelpers();n._clearSelection(!0);var h=i.undo?i.insertIndex:i.moveIndex,u=n.nameTable[i.undoObject.name1],f=u&&u.parent?n.nameTable[u.parent]:null;f&&f.children.length>0&&(r=f.children);e=r.slice();o=this._getSwimlane(n,r[0]);r&&r.length>0&&(t.datavisualization.Diagram.canvasHelper._disableConnectorUpdate(n),this._undoSwapLane(n,r,h,u,null),t.datavisualization.Diagram.ContainerHelper._updateCollectionChange(n,f,!1),t.datavisualization.Diagram.canvasHelper._recreateConnectorSegments(n,u.name,e,i.undoObject.name2,i.undoObject.name1),t.datavisualization.Diagram.canvasHelper._enableConnectorUpdateLane(n,u));s=this._getSwimlane(n,r[0]);n._comparePropertyValues(s,"lanes",{lanes:o.lanes})},_undoSwapLane:function(n,t,i,r){t&&t.length>0&&(t.splice(t.indexOf(r.name),1),t.splice(i,0,r.name))}};t.datavisualization.Diagram.containerCommon={_initGroupNode:function(n,i){var r=null,u;for(i=n._getNewGroup(i),u=0;u<i.children.length;u++)r=i.children[u],r&&typeof r=="object"&&(typeof r.shape!="object"&&(r=t.datavisualization.Diagram.NodeType(r,n)),r._type=="group"||r.children||r.segments||r.type=="connector"?r.segments||r.type=="connector"?(r=n._getNewConnector(r),r.name==""&&(r.name=t.datavisualization.Diagram.Util.randomId())):(r=n._getNewGroup(r),r.name==""&&(r.name=t.datavisualization.Diagram.Util.randomId()),r=this._initGroupNode(n,r)):(i.type!="bpmn"&&(r=n._getNewNode(r)),r.name==""&&(r.name=t.datavisualization.Diagram.Util.randomId()),r._type=="node"&&r.labels.length&&(r.width==0||r.height==0)&&n._getNodeDimension(r)),i.children[u]=r,r.parent=i.name);return i},_initChildren:function(n,i){var u,r,f;if(i.children&&i.children.length>0)for(u=i.children,r=0;r<u.length;r++)f=typeof u[r]=="string"?n.nameTable[u[r]]:u[r],f&&(f._isInternalShape||(i.container&&(f.type==="bpmn"?n._translate(f,0-f.offsetX,0-f.offsetY,n.nameTable):f.offsetX=0,f.offsetY=0),f.container?u[r]=t.datavisualization.Diagram.ContainerHelper._initContainer(n,f):f.children?(u[r]=t.datavisualization.Diagram.Group(f),u[r]=this._initGroupNode(n,u[r]),u[r]=n._getNewGroup(u[r]),u[r]=this._initChildren(n,u[r]),this._updateGroupBounds(n,u[r])):f.segments?(u[r]=t.datavisualization.Diagram.Connector(f),u[r]=n._getNewConnector(f)):(u[r]=t.datavisualization.Diagram.NodeType(f,n),u[r]=n._getNewNode(f))),n.nameTable[u[r].name]=u[r],i.children[r]=u[r].name,n._spatialSearch&&n._updateQuad(n.nameTable[i.children[r]]));return i},_getChildrenBounds:function(n,i){var u=i.children,f,e=t.datavisualization.Diagram.Rectangle(),r,o,s;for(u.length>0&&(r=n.nameTable[n._getChild(u[0])],r&&(e=t.datavisualization.Diagram.Util._rotateChildBounds(r,i,n))),o=0,s=u.length;o<s;o++)r=n.nameTable[n._getChild(u[o])],r&&(r._type==="group"?(t.datavisualization.Diagram.Util._updateGroupBounds(r,n),f=t.datavisualization.Diagram.Util._rotateChildBounds(r,i,n)):f=t.datavisualization.Diagram.Util._rotateChildBounds(r,i,n)),f&&(e=t.datavisualization.Diagram.Geometry.union(e,f));return e},_updateGroupBounds:function(n,i,r){var o,s,h,c,e;if(i&&!i.container&&i&&(i.type==="pseudoGroup"||i.children&&i.children.length>0)){o=i.width;s=i.height;h=i.offsetX;c=i.offsetY;r&&t.datavisualization.Diagram.Util._updateRotateAngle(i,n.nameTable);var u=this._getChildrenBounds(n,i),l=u.x+u.width*i.pivot.x,a=u.y+u.height*i.pivot.y,f={x:l,y:a};i.rotateAngle&&(e=t.Matrix.identity(),t.Matrix.rotate(e,i.rotateAngle),f=t.Matrix.transform(e,f));u&&(i.offsetX=f.x,i.offsetY=f.y,i.width=u.width,i.height=u.height)}},_cloneObject:function(t,i,r){var u,f;if(i){if(u=n.extend(!0,{},i),u.children&&u.children.length>0)for(f=0;f<u.children.length;f++)u.children[f]=this._cloneObject(t,u.children[f],r);u.name+=r}return u},_removeObject:function(n,t){var i;if(t){if(typeof t=="string"&&(t=n.nameTable[t]),t&&t.children&&t.children.length>0)for(i=0;i<t.children.length;i++)this._removeObject(n,t.children[i]);t&&delete n.nameTable[t.name]}}}}(jQuery,Syncfusion),function(n,t){"use strict";t.widget("ejOverview","ej.datavisualization.Overview",{element:null,validTags:["div"],model:null,defaults:{sourceID:"",width:null,height:null},_canvas:null,_actionName:"",_startPoint:null,_currentPoint:null,_prevPoint:null,_helper:null,_viewPortRatio:1,_resizeDirection:"",_inAction:!1,_init:function(){t.browserInfo().name==="msie"&&Number(t.browserInfo().version)<9||(this._wireEvents(),this._renderCanvas(),this._setParent(this.model.sourceID))},_renderCanvas:function(){var t=n("#"+this.element[0].id+"_canvas")[0];t||(t=document.createElement("div"),this.element.append(t));t.setAttribute("id",this.element[0].id+"_canvas");t.setAttribute("class","drawing");t.setAttribute("style","position:relative; height:"+this.model.height+"; width:"+this.model.width+";style:-ms-touch-action: none;touch-action: none;");this.element[0].setAttribute("tabindex",0);this.element.css({overflow:"hidden",outline:"none",display:"block",height:this.model.height,width:this.model.width});this._canvas=t},_renderDocument:function(i){var o,r,h,c;if(i.canvas=this._canvas,window.SVGSVGElement){r=n("#"+this._canvas.id+"_svg")[0];r&&r.parentNode.removeChild(r);o={id:this._canvas.id+"_svg",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:i.style,"class":"overview_svg"};r=new t.datavisualization.Diagram.Svg(o);this._svg=r;i.svg=r;var l=document.getElementById(this._id),e=l,u=n(e).width(),f=n(e).height(),s=e.getBoundingClientRect(),a=window.screenX<0?window.screenX*-1:window.screenX;u===0&&(u=Math.floor(window.innerWidth-a-Math.floor(s.left)));h=window.screenY<0?window.screenY*-1:window.screenY;f===0&&(f=Math.floor(window.innerHeight-h-Math.floor(s.top)));r.document.setAttribute("width",u);r.document.setAttribute("height",f);this.width=u;this.height=f;i.diagramLayer=t.datavisualization.Diagram.SvgContext._renderDiagramLayer(i.canvas,i.svg,i.svg);c=r.defs({id:i.canvas.id+"patterndefinition"});r.appendChild(c);i.canvas.appendChild(r.document);this._renderHtmlLayer(i.canvas);this._addOverviewRectPanel(i)}},_removeDocument:function(){var t=document.getElementById(this._canvas.id+"_svg"),n;this._canvas.removeChild(t);n=document.getElementById(this._canvas.id+"_htmlLayer");this._canvas.removeChild(n)},_renderHtmlLayer:function(n){var i=document.createElement("div"),u={id:n.id+"_htmlLayer","class":"htmlLayer"},r;return t.datavisualization.Diagram.Util.attr(i,u),r=i,i.style.pointerEvents="none",i.style.position="absolute",i.style.left="0px",i.style.top="0px",n.appendChild(r),r},_setModel:function(n){var t=!1;for(var i in n)switch(i){case"sourceID":this._setParent(n[i]);break;case"width":case"height":t||(this._renderCanvas(),this._setParent(this.model.sourceID));t=!0}},_setParent:function(t){if(this._parent){var i=n("#"+this._parent._id).ejDiagram("instance");this._parent=null;i._setOverview(null,this._id)}t&&(this.model.sourceID=t,this._parent=n("#"+t).ejDiagram("instance"),this._parent&&this._parent._setOverview(this))},_destroy:function(){this.element.empty().removeClass(this.model.cssClass)},_wireEvents:function(){var i=n(this._canvas);this._on(i,t.eventType.mouseDown,this._mousedown);this._on(i,t.eventType.mouseMove,this._mousemove);this._on(i,t.eventType.mouseUp,this._mouseup);this._on(i,t.eventType.mouseLeave,this._documentmouseup);this._on(i,"touchstart",this.handleTouchStart);this._on(i,"touchmove",this.handleTouchMove);this._on(i,"touchend",this.handleTouchEnd)},_mouseup:function(n){var f,e,t,u;if(this._currentPoint=this._mouseposition(n),f=this.width,e=this.height,this._actionName)if(this._startPoint.x!=this._currentPoint.x||this._startPoint.y!=this._currentPoint.y){if(this._actionName!="pan"&&this._helper){t=this._helper.getBBox();this._resizeDirection=this._resizeDirection||"";var o=t.x,s=t.y,i=t.width,r=t.height,h=this._resizeDirection=="topleft"||this._resizeDirection=="topright"||this._resizeDirection=="bottomleft"||this._resizeDirection=="bottomright";this._renderOverviewRect(o,s,i,r)}}else if((n.target.id==this._canvas.id+"overviewbackrect"||n.target.id=="helper")&&this._startPoint.x==this._currentPoint.x&&this._startPoint.y==this._currentPoint.y){var u=document.getElementById(this._canvas.id+"overviewrect"),t=u.getBBox(),i=t.width||100,r=t.height||100/this._viewPortRatio;this.inAction=!0;this._actionName="pan";this._renderOverviewRect(this._currentPoint.x-i/2,this._currentPoint.y-r/2,i,r);this.inAction=!1}this._helper&&(u=document.getElementById(this._canvas.id+"overviewhandle"),u.removeChild(this._helper),this._helper=null);this._actionName="";this._startPoint=null;this._currentPoint=null;this._prevPoint=null;this._helper=null;this._viewPortRatio=1;this._resizeDirection="";this._inAction=!1},_mousedown:function(n){if(n.target.className.animVal=="overviewbackrect"&&(this._actionName="draw"),n.target.id==this._canvas.id+"overviewrect"&&(this._actionName="pan"),n.target.className.animVal=="overviewresizer"){this._actionName="scale";switch(n.target.id){case this._canvas.id+"left":this._resizeDirection="left";break;case this._canvas.id+"right":this._resizeDirection="right";break;case this._canvas.id+"top":this._resizeDirection="top";break;case this._canvas.id+"bottom":this._resizeDirection="bottom";break;case this._canvas.id+"topleft":this._resizeDirection="topleft";break;case this._canvas.id+"topright":this._resizeDirection="topright";break;case this._canvas.id+"bottomleft":this._resizeDirection="bottomleft";break;case this._canvas.id+"bottomright":this._resizeDirection="bottomright"}}this._startPoint=this._prevPoint=this._mouseposition(n);var i=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent);this._viewPortRatio=i.width/i.height},_mouseposition:function(n){var i=this._parent._isTouchEvent(n);i||(i=n);var u=this._canvas.scrollLeft,f=this._canvas.scrollTop,r=this._canvas.getBoundingClientRect(),e=i.clientX+u-r.left,o=f+i.clientY-r.top;return new t.datavisualization.Diagram.Point(e,o)},_updateCursor:function(n){if(n.target.className.animVal=="overviewresizer")switch(n.target.id){case this._canvas.id+"left":this._canvas.style.cursor="w-resize";break;case this._canvas.id+"right":this._canvas.style.cursor="e-resize";break;case this._canvas.id+"top":this._canvas.style.cursor="n-resize";break;case this._canvas.id+"bottom":this._canvas.style.cursor="s-resize";break;case this._canvas.id+"topleft":this._canvas.style.cursor="nw-resize";break;case this._canvas.id+"topright":this._canvas.style.cursor="ne-resize";break;case this._canvas.id+"bottomleft":this._canvas.style.cursor="sw-resize";break;case this._canvas.id+"bottomright":this._canvas.style.cursor="se-resize"}else this._canvas.style.cursor="default"},_mousemove:function(n){if(this._updateCursor(n),this._currentPoint=this._mouseposition(n),this._actionName)switch(this._actionName){case"draw":this._inAction||this._startPoint.x==this._currentPoint.x&&this._startPoint.y!=this._currentPoint.y||(this._initHelper(),this._inAction=!0);this._inAction&&this._updateHelper();break;case"scale":this._inAction||(this._initHelper(),this._inAction=!0);this._updateOverviewRectangle();break;case"pan":(this._startPoint.x!=this._currentPoint.x||this._startPoint.y==this._currentPoint.y||this._inAction)&&(this._inAction=!0,this._translateOverviewRectangle())}this._prevPoint=this._currentPoint},_documentmouseup:function(){if(this._inAction=!1,this._actionName="",this._helper){var n=document.getElementById(this._canvas.id+"overviewhandle");n.removeChild(this._helper);this._helper=null}},_addOverviewRectPanel:function(){var r=n("#"+this._canvas.id+"_overviewsvg")[0],f,e,u,i,o;r&&r.parentNode.removeChild(r);r=new t.datavisualization.Diagram.Svg({id:this._canvas.id+"_overviewsvg",version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:"position:absolute;left:0px;top:0px",width:this.width,height:this.height});this._canvas.appendChild(r.document);f=r.g({id:this._id+"_overviewlayer"});r.appendChild(f);e=r.rect({fill:"transparent",width:"100%",height:"100%","class":"overviewbackrect",id:this._canvas.id+"overviewbackrect"});f.appendChild(e);u=n(f);this._on(u,t.eventType.mouseDown,this._mousedown);this._on(u,t.eventType.mouseMove,this._mousemove);this._on(u,t.eventType.mouseUp,this._mouseup);this._on(u,t.eventType.mouseLeave,this._documentmouseup);this._on(u,"touchstart",this.handleTouchStart);this._on(u,"touchmove",this.handleTouchMove);this._on(u,"touchend",this.handleTouchEnd);i=r.g({id:this._canvas.id+"overviewhandle"});f.appendChild(i);o=r.rect({id:this._canvas.id+"overviewrect",fill:"transparent"});i.appendChild(o);this._renderOverviewCorner("left",i);this._renderOverviewCorner("right",i);this._renderOverviewCorner("top",i);this._renderOverviewCorner("bottom",i);this._renderOverviewCorner("topleft",i);this._renderOverviewCorner("topright",i);this._renderOverviewCorner("bottomleft",i);this._renderOverviewCorner("bottomright",i)},_updateOverview:function(n){var c,l,i,f,e,v,r,u,y,h;n=n||this._parent._views[this._id];i=this._parent._getDigramBounds();c=i.width;l=i.height;var a=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),o=this.width,s=this.height;n.context==t.datavisualization.Diagram.SvgContext?(f=Math.max(c,a.width),e=Math.max(l,a.height),this.contentWidth=f=Math.max(f,o/s*e),this.contentHeight=e=Math.max(e,s/o*f),v=document.getElementById(this._canvas.id+"_diagramLayer"),r=Math.min(o/f,s/e),this.scale=r,v.setAttribute("transform","scale("+r+","+r+"),translate("+-i.x+","+-i.y+")"),u=document.getElementById(this._canvas.id+"_htmlLayer"),u.style.webkitTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.MozTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.OTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.msTransform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",u.style.transform="scale("+r+") translate("+-i.x+"px,"+-i.y+"px)",y=document.getElementById(this._id+"_overviewlayer"),y.setAttribute("transform","translate("+-i.x*r+","+-i.y*r+")")):(h=n._canvas.document.getContext("2d"),n.scale&&h.scale(1/n.scale.x,1/n.scale.y),n.scale={x:r,y:r},h.scale(r,r),t.datavisualization.Diagram.CanvasContext.refreshCanvas(this._parent.model,n));this._scrollOverviewRect(this._parent._hScrollOffset,this._parent._vScrollOffset,this._parent._currZoom)},_updateOverviewRectangle:function(){var n=this._currentPoint.x-this._prevPoint.x,t=this._currentPoint.y-this._prevPoint.y;if(this._actionName=="scale"){var i={width:0,height:0},r=0,u=0,f,e;switch(this._resizeDirection){case"left":i.width-=n;i.height-=n/this._viewPortRatio;r=n;u=n/this._viewPortRatio/2;break;case"right":i.width+=n;i.height+=n/this._viewPortRatio;u=n/this._viewPortRatio/-2;break;case"top":i.height-=t;i.width-=t*this._viewPortRatio;u=t;r=t*this._viewPortRatio/2;break;case"bottom":i.height+=t;i.width+=t*this._viewPortRatio;r=t*this._viewPortRatio/-2;break;case"topleft":Math.abs(t)>Math.abs(n)?n=t*this._viewPortRatio:t=n/this._viewPortRatio;i.width-=n;i.height-=t;r=n;u=t;break;case"topright":Math.abs(t)>Math.abs(n)?n=-t*this._viewPortRatio:t=-(n/this._viewPortRatio);u=t;i.width+=n;i.height-=t;break;case"bottomleft":Math.abs(t)>Math.abs(n)?n=-t*this._viewPortRatio:t=-n/this._viewPortRatio;r=n;i.width-=n;i.height+=t;break;case"bottomright":Math.abs(t)>Math.abs(n)?n=t*this._viewPortRatio:t=n/this._viewPortRatio;i.width+=n;i.height+=t}this._updateHelper(r,u,i,f,e)}},_initHelper:function(){var e,n,t;if(!this._helper){var o=this._svg,s=document.getElementById(this._canvas.id+"overviewhandle"),h=this._parent._currZoom,i=this._startPoint.x,r=this._startPoint.y,u=1,f=1;this._actionName=="scale"&&(e=document.getElementById(this._canvas.id+"overviewrect"),n=e.getBBox(),i=n.x,r=n.y,u=n.width,f=n.height);t=o.rect({id:"helper",x:i,y:r,width:u,height:f,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"});s.appendChild(t);this._helper=t}},_updateHelper:function(n,i,r){var n,i,o,s;if(r)var u=this._helper.getBBox(),h=u.x+n,c=u.y+i,f=u.width+r.width,e=u.height+r.height;else{n=this._currentPoint.x>this._startPoint.x?this._currentPoint.x-this._prevPoint.x:this._prevPoint.x-this._currentPoint.x;i=this._currentPoint.y>this._startPoint.y?this._currentPoint.y-this._prevPoint.y:this._prevPoint.y-this._currentPoint.y;Math.abs(i)>Math.abs(n)?(n=this._viewPortRatio*i,s=!0,o=!1):(i=n/this._viewPortRatio,o=!0,s=!1);var u=this._helper.getBBox(),h=this._startPoint.x>this._currentPoint.x?u.x-n:u.x,c=this._startPoint.y>this._currentPoint.y?u.y-i:u.y,f=u.width+n,e=u.height+i}this._helper&&t.datavisualization.Diagram.Util.attr(this._helper,{id:this._helper.id,x:h,y:c,width:f<0?0:f,height:e<0?0:e})},_renderOverviewCorner:function(n,t){var i=this._svg,r,u;n=="top"||n=="bottom"||n=="right"||n=="left"?(r=i.rect({id:this._canvas.id+"visible"+n}),t.appendChild(r),u=i.rect({id:this._canvas.id+n,"class":"overviewresizer",fill:"transparent"}),t.appendChild(u)):(r=i.circle({id:this._canvas.id+"visible"+n}),t.appendChild(r),u=i.circle({id:this._canvas.id+n,"class":"overviewresizer",fill:"transparent"}),t.appendChild(u))},_updateOverviewrect:function(n,i,r,u){if(r&&u){var f=document.getElementById(this._canvas.id+"overviewrect"),e={x:n,y:i,width:Math.max(1,r),height:Math.max(1,u)};t.datavisualization.Diagram.Util.attr(f,e);this._updateOverviewCorner("top",n+8,i-2,Math.max(0,r-16),2);this._updateOverviewCorner("bottom",n+8,i+u,Math.max(0,r-16),2);this._updateOverviewCorner("left",n-2,i+8,2,Math.max(0,u-16));this._updateOverviewCorner("right",n+r,i+8,2,Math.max(0,u-16));this._updateOverviewCorner("topleft",n,i,5,5);this._updateOverviewCorner("topright",n+r,i,5,5);this._updateOverviewCorner("bottomleft",n,i+u,5,5);this._updateOverviewCorner("bottomright",n+r,i+u,5,5)}},_scrollOverviewRect:function(n,i,r,u){if(!this._actionName||u){var a=this.width,v=this.height,f=Math.min(this.contentWidth/a,this.contentHeight/v),e={},s=e.x=n/r/f,h=e.y=i/r/f,o=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),c=e.width=o.width/r/f,l=e.height=o.height/r/f,y=o.width/o.height;if(u)return{x:s,y:h,width:c,height:l};this._updateOverviewrect(s,h,c,l)}},_updateOverviewCorner:function(n,i,r,u,f){var h="visible"+n,c=document.getElementById(this._canvas.id+h),e,o,s;n=="top"||n=="bottom"||n=="right"||n=="left"?(e={x:i,y:r,width:u,height:f,fill:"#ED1C24"},o={x:i-2,y:r-2,width:u==2?4:u,height:f==2?4:f}):(e={cx:i,cy:r,r:4,fill:"#ED1C24"},o={cx:i,cy:r,r:6,fill:"transparent"});t.datavisualization.Diagram.Util.attr(c,e);s=document.getElementById(this._canvas.id+n);t.datavisualization.Diagram.Util.attr(s,o)},_translateOverviewRectangle:function(){var o=this.width,s=this.height,h=this._currentPoint.x-this._prevPoint.x,c=this._currentPoint.y-this._prevPoint.y,i=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),a=Math.min(i.width/o,i.height/s),l=document.getElementById(this._canvas.id+"overviewrect"),n=l.getBBox(),r=n.x+h,u=n.y+c,f=n.width,e=n.height;this._updateOverviewrect(r,u,f,e);this._updateView(this._parent._currZoom,r,u,f,e,null)},_updateView:function(i,r,u,f,e,o){var b=this.width,k=this.height,d=this.contentWidth/b,g=this.contentHeight/k,y=r*d*i,p=u*g*i,h=this._parent._getDigramBounds(),v,s;if(i!=1||this._actionName=="pan"){var a=n("#"+this._parent._canvas.id+"_hScrollbar").ejScrollBar("instance").model,w=-y+a.maximum,c=-y+this._parent._hScrollOffset,l=-p+this._parent._vScrollOffset;h.width*i<w&&(s=h.width*i-w,Math.abs(s)<Math.abs(c)&&(c=c-s));a=n("#"+this._parent._canvas.id+"_vScrollbar").ejScrollBar("instance").model;v=-p+a.maximum;h.height*i<v&&(s=h.height*i-v,Math.abs(s)<Math.abs(l)&&(l=l-s))}t.datavisualization.Diagram.ZoomUtil.zoomPan(this._parent,i/this._parent._currZoom,c,l,o,!1)},_renderOverviewRect:function(n,i,r,u){var s=this.width,h=this.height,o=t.datavisualization.Diagram.ScrollUtil._viewPort(this._parent),c=r/s*this.contentWidth,l=u/h*this.contentHeight,e=Math.max(o.width/c,o.height/l),f;e>=.25&&e<=30&&(this._updateView(e,n,i,r,u,new t.datavisualization.Diagram.Point(0,0)),f=this._scrollOverviewRect(this._parent._hScrollOffset,this._parent._vScrollOffset,this._parent._currZoom,!0),this._updateOverviewrect(f.x,f.y,f.width,f.height))},handleTouchStart:function(n){n.preventDefault()},handleTouchMove:function(n){n.preventDefault()},handleTouchEnd:function(n){n.preventDefault()},handleTouchLeave:function(n){n.preventDefault()}})}(jQuery,Syncfusion),function(n,t){"use strict";var i=function(){function i(n){return this.document=document.createElement("canvas"),this.id=n.id,this._scaleX=1,this._scaleY=1,n&&t.datavisualization.Diagram.Util.attr(this.document,n),this}return i.prototype.rect=function(n,t,i,r,u,f){var e=this.document.getContext("2d");e.beginPath();u&&u.angle&&this.rotateContext(u,e);f&&(this.setStyle(f,e),f.dashArray&&this.dashedRectangle(n,t,i,r,f.dashArray));e.fillRect(n,t,i,r);e.strokeRect(n,t,i,r);e.closePath();u&&u.angle&&e.restore()},i.prototype.roundedRect=function(n,t,i,r,u,f,e){var h=this.document.getContext("2d"),o;h.beginPath();f&&f.angle&&this.rotateContext(f,h);var s=[{x:n+u,y:t},{x:n+i-u,y:t},{x:n+i,y:t+u},{x:n+i,y:t+r-u},{x:n+i-u,y:t+r},{x:n+u,y:t+r},{x:n,y:t+r-u},{x:n,y:t+u}],l=[{x:n+i,y:t},{x:n+i,y:t+r},{x:n,y:t+r},{x:n,y:t}],c=0,a,v;for(e&&this.setStyle(e,h),h.moveTo(s[0].x,s[0].y),o=0;o<s.length;o=o+2)a=s[o+1],h.lineTo(a.x,a.y),v=s[o+2]||s[0],h.quadraticCurveTo(l[c].x,l[c].y,v.x,v.y),c++;if(h.fill(),e&&e.dashArray)for(c=0,o=0;o<s.length;o=o+2)this.dashedLine(s[o].x,s[o].y,s[o+1].x,s[o+1].y,e.dashArray),this.quadraticCurve(s[o+1],l[c],s[o+2]||s[0],e),c++;h.stroke();h.closePath();f&&f.angle&&h.restore()},i.prototype.ellipse=function(n,i,r,u,f,e){var s=this.document.getContext("2d"),o;e&&this.setStyle(e,s);o=4*((Math.sqrt(2)-1)/3);s.beginPath();f&&f.angle&&this.rotateContext(f,s);s.moveTo(n,i-u);s.bezierCurveTo(n+o*r,i-u,n+r,i-o*u,n+r,i);s.bezierCurveTo(n+r,i+o*u,n+o*r,i+u,n,i+u);s.bezierCurveTo(n-o*r,i+u,n-r,i+o*u,n-r,i);s.bezierCurveTo(n-r,i-o*u,n-o*r,i-u,n,i-u);s.fill();e&&e.dashArray&&(this.bezierCurve(t.datavisualization.Diagram.Point(n,i-u),new t.datavisualization.Diagram.Point(n+o*r,i-u),new t.datavisualization.Diagram.Point(n+r,i-o*u),new t.datavisualization.Diagram.Point(n+r,i),e),this.bezierCurve(t.datavisualization.Diagram.Point(n+r,i),new t.datavisualization.Diagram.Point(n+r,i+o*u),new t.datavisualization.Diagram.Point(n+o*r,i+u),new t.datavisualization.Diagram.Point(n,i+u),e),this.bezierCurve(t.datavisualization.Diagram.Point(n,i+u),new t.datavisualization.Diagram.Point(n-o*r,i+u),new t.datavisualization.Diagram.Point(n-r,i+o*u),new t.datavisualization.Diagram.Point(n-r,i),e),this.bezierCurve(t.datavisualization.Diagram.Point(n-r,i),new t.datavisualization.Diagram.Point(n-r,i-o*u),new t.datavisualization.Diagram.Point(n-o*r,i-u),new t.datavisualization.Diagram.Point(n,i-u),e));s.stroke();s.closePath();f&&f.angle&&s.restore()},i.prototype.circle=function(n,t,i,r,u){var f=this.document.getContext("2d");u&&this.setStyle(u,f);r&&r.angle&&this.rotateContext(r,f);u&&u.dashArray?(f.beginPath(),f.arc(n,t,i,0,2*Math.PI),f.fill(),f.stroke(),f.closePath()):this.ellipse(n,t,i*2,i*2,r,u);r&&r.angle&&f.restore()},i.prototype.arc=function(n,t,i,r,u,f){var o={angle:r,x:n,y:t},e=this.document.getContext("2d"),s,h;f&&this.setStyle(f,e);o&&o.angle&&this.rotateContext(o,e);e.beginPath();s=0;h=Math.PI;u||(s=Math.PI,h=0);f&&f.dashArray?e.arc(n,t,i,s,h):e.arc(n,t,i,s,h);e.stroke();e.closePath();o&&o.angle&&e.restore()},i.prototype.path=function(n,i,r,u,f,e,o){var h=this.document.getContext("2d"),pt,tt,it,s,wt,g;o&&this.setStyle(o,h);h.beginPath();pt=i;tt=r;h.translate(pt,tt);e&&e.angle&&this.rotateContext(e,h);it=document.createElementNS("http://www.w3.org/2000/svg","path");it.setAttribute("d",n);this.document.appendChild(it);for(var ti=this.getSegments(it),fi=i,ei=r,et,ot,k,d,st,ht,ct=ti,i=0,r=0,lt=0,ii=ct.length;lt<ii;++lt){s=ct[lt];wt=s.command;"x1"in s&&(k=s.x1);"x2"in s&&(st=s.x2);"y1"in s&&(d=s.y1);"y2"in s&&(ht=s.y2);"x"in s&&(i=s.x);"y"in s&&(r=s.y);switch(wt){case"M":h.moveTo(i,r);s.x=i;s.y=r;break;case"L":h.lineTo(i,r);s.x=i;s.y=r;break;case"C":h.bezierCurveTo(k,d,st,ht,i,r);s.x=i;s.y=r;s.x1=k;s.y1=d;s.x2=st;s.y2=ht;break;case"Q":h.quadraticCurveTo(k,d,i,r);s.x=i;s.y=r;s.x1=k;s.y1=d;break;case"A":var w=new t.datavisualization.Diagram.Point(et,ot),c=s.r1,l=s.r2,v=s.angle*(Math.PI/180),ri=s.largeArcFlag,rt=s.sweepFlag,b=new t.datavisualization.Diagram.Point(i,r),a=new t.datavisualization.Diagram.Point(Math.cos(v)*(w.x-b.x)/2+Math.sin(v)*(w.y-b.y)/2,-Math.sin(v)*(w.x-b.x)/2+Math.cos(v)*(w.y-b.y)/2),at=Math.pow(a.x,2)/Math.pow(c,2)+Math.pow(a.y,2)/Math.pow(l,2);at>1&&(c*=Math.sqrt(at),l*=Math.sqrt(at));g=(ri==rt?-1:1)*Math.sqrt((Math.pow(c,2)*Math.pow(l,2)-Math.pow(c,2)*Math.pow(a.y,2)-Math.pow(l,2)*Math.pow(a.x,2))/(Math.pow(c,2)*Math.pow(a.y,2)+Math.pow(l,2)*Math.pow(a.x,2)));isNaN(g)&&(g=0);var y=new t.datavisualization.Diagram.Point(g*c*a.y/l,g*-l*a.x/c),p=new t.datavisualization.Diagram.Point((w.x+b.x)/2+Math.cos(v)*y.x-Math.sin(v)*y.y,(w.y+b.y)/2+Math.sin(v)*y.x+Math.cos(v)*y.y),bt=function(n){return Math.sqrt(Math.pow(n[0],2)+Math.pow(n[1],2))},ut=function(n,t){return(n[0]*t[0]+n[1]*t[1])/(bt(n)*bt(t))},kt=function(n,t){return(n[0]*t[1]<n[1]*t[0]?-1:1)*Math.acos(ut(n,t))},ft=kt([1,0],[(a.x-y.x)/c,(a.y-y.y)/l]),vt=[(a.x-y.x)/c,(a.y-y.y)/l],yt=[(-a.x-y.x)/c,(-a.y-y.y)/l],nt=kt(vt,yt);ut(vt,yt)<=-1&&(nt=Math.PI);ut(vt,yt)>=1&&(nt=0);var ui=1-rt?1:-1,dt=ft+ui*(nt/2),oi=new t.datavisualization.Diagram.Point(p.x+c*Math.cos(dt),p.y+l*Math.sin(dt));if(s.centp=p,s.xAxisRotation=v,s.rx=c,s.ry=l,s.a1=ft,s.ad=nt,s.sweepFlag=rt,h!=null){var ut=c>l?c:l,gt=c>l?1:c/l,ni=c>l?l/c:1;h.save();h.translate(p.x,p.y);h.rotate(v);h.scale(gt,ni);h.arc(0,0,ut,ft,ft+nt,1-rt);h.scale(1/gt,1/ni);h.rotate(-v);h.translate(-p.x,-p.y);h.restore()}break;case"Z":case"z":h.closePath();i=et;r=ot}et=i;ot=r}h.fill();o&&o.dashArray?this.drawDashedPath(ct,o):h.stroke();h.translate(-tt,-tt);e&&e.angle&&h.restore()},i.prototype.getSegments=function(i){for(var r,a,c,l,k,u,e,o,v,y,p,w,d,g,nt=t.datavisualization.Diagram.Util.convertPathToArray(i.getAttribute("d")),f=[],s=0,h=0,b=0,tt=nt.length;b<tt;++b){r=nt[b];a=r.pathSegTypeAsLetter;"x1"in r&&(v=r.x1);"x2"in r&&(p=r.x2);"y1"in r&&(y=r.y1);"y2"in r&&(w=r.y2);"x"in r&&(s=r.x);"y"in r&&(h=r.y);switch(a){case"M":f.push({command:"M",x:s,y:h});break;case"L":f.push({command:"L",x0:e,y0:o,x:s,y:h});break;case"H":f.push({command:"L",x0:e,y0:o,x:s,y:o});break;case"V":f.push({command:"L",x0:e,y0:o,x:e,y:h});break;case"C":f.push({command:"C",x0:e,y0:o,x1:v,y1:y,x2:p,y2:w,x:s,y:h});break;case"S":u&&(c=u.command=="C"||u.command=="S"?{x:u.x2,y:u.y2}:{x:u.x0,y:u.y0},l=new t.datavisualization.Diagram.Point(2*e-c.x,2*o-c.y),f.push({command:"C",x0:e,y0:o,x1:l.x,y1:l.y,x2:p,y2:w,x:s,y:h}));break;case"Q":f.push({command:"Q",x0:e,y0:o,x1:v,y1:y,x:s,y:h});break;case"T":u&&(c=u.command=="Q"?{x:u.x1,y:u.y1}:{x:u.x0,y:u.y0},l=new t.datavisualization.Diagram.Point(2*e-c.x,2*o-c.y),f.push({command:"Q",x0:e,y0:o,x1:l.x,y1:l.y,x:s,y:h}));break;case"A":k=n.extend(!0,{},r);k.command="A";f.push(k);break;case"Z":case"z":f.push({command:"L",x0:s,y0:h,x:d,y:g});s=e;h=o}u=f[f.length-1];(a==="M"||a==="m")&&(d=s,g=h);e=s;o=h}return f},i.prototype.drawDashedPath=function(n,i){for(var r,p,u,h,c,v,y,o,s,l,f=0,e=0,a=0,k=n.length;a<k;++a){r=n[a];p=r.command;"x1"in r&&(h=r.x1);"x2"in r&&(v=r.x2);"y1"in r&&(c=r.y1);"y2"in r&&(y=r.y2);"x"in r&&(f=r.x);"y"in r&&(e=r.y);switch(p){case"M":l={x:f,y:e};break;case"L":this.dashedLine(o,s,f,e,i.dashArray);break;case"H":this.dashedLine(o,s,f,s,i.dashArray);break;case"V":this.dashedLine(o,s,o,e,i.dashArray);break;case"C":this.bezierCurve(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),t.datavisualization.Diagram.Point(v,y),t.datavisualization.Diagram.Point(f,e),i);break;case"Q":this.quadraticCurve(t.datavisualization.Diagram.Point(o,s),t.datavisualization.Diagram.Point(h,c),t.datavisualization.Diagram.Point(f,e),i);break;case"A":if(u=this.document.getContext("2d"),u!=null){var d=r.rx>r.ry?r.rx:r.ry,w=r.rx>r.ry?1:r.rx/r.ry,b=r.rx>r.ry?r.ry/r.rx:1;u.save();u.translate(r.centp.x,r.centp.y);u.rotate(r.xAxisRotation);u.scale(w,b);this.dashedArc(d,0,0,r.a1,r.a1+r.ad,1-r.sweepFlag,i.dashArray);u.scale(1/w,1/b);u.rotate(-r.xAxisRotation);u.translate(-r.centp.x,-r.centp.y);u.restore()}break;case"Z":case"z":this.dashedLine(f,e,l.x,l.y,i.dashArray);f=o;e=s}o=f;s=e}},i.prototype.calculateCirclePoints=function(n,i,r,u,f,e){var h,o,s,c;for(u=u*180/Math.PI,f=f*180/Math.PI,h=2*Math.PI*n*(Math.abs(u-f)/360)*.7,o=Math.abs(u-f)/h,o=e?o*-1:o,s=0,c=[];s<h;)c.push(t.datavisualization.Diagram.Geometry.transform({x:i,y:r},u+o*s,n)),s++;return c},i.prototype.polygon=function(n,t,i){var u=this.document.getContext("2d"),r;for(u.beginPath(),t&&t.angle&&this.rotateContext(t,u),i&&this.setStyle(i,u),u.moveTo(n[0].x,n[0].y),r=1;r<n.length;r++)u.lineTo(n[r].x,n[r].y);if(u.lineTo(n[0].x,n[0].y),u.fill(),i&&i.dashArray){for(r=1;r<n.length;r++)this.line(n[r-1],n[r],i);this.line(n[r-1],n[0],i)}u.stroke();u.closePath();t&&t.angle&&u.restore()},i.prototype.image=function(n,t,i,r,u,f,e){var o=this.document.getContext("2d");o.beginPath();f&&f.angle&&this.rotateContext(f,o);e&&this.setStyle(e,o);r&&u?o.drawImage(n,t,i,r,u):o.drawImage(n,t,i);o.closePath();f&&f.angle&&o.restore()},i.prototype.text=function(n,t,i,r,u){var f=this.document.getContext("2d");f.beginPath();r&&r.angle&&this.rotateContext(r,f);u&&this.setStyle(u,f);f.fillText(n.text,t,i);f.closePath();r&&r.angle&&f.restore()},i.prototype.line=function(n,t,i,r,u){var f=this.document.getContext("2d");r||(f.beginPath(),i&&this.setStyle(i,f));i&&i.dashArray?this.dashedLine(n.x,n.y,t.x,t.y,i.dashArray):(r||f.moveTo(n.x,n.y),f.lineTo(t.x,t.y),f.stroke());u||f.closePath()},i.prototype.polyline=function(n,t){var r=this.document.getContext("2d"),i;for(r.beginPath(),t&&this.setStyle(t,r),i=1;i<n.length;i++)this.line(n[i-1],n[i],t);r.stroke()},i.prototype.bezierCurve=function(n,t,i,r,u){var f=this.document.getContext("2d"),e,c,o,h;if(f.beginPath(),f.moveTo(n.x,n.y),u&&this.setStyle(u,f),u&&u.dashArray){for(e=[],this.flattenCubicBezier(e,n,t,i,r),c=0,o=0;o<u.dashArray.length;o++)c+=Number(u.dashArray[o]);var a=e.length/c,l=!0,s=0;for(o=0;o<a;o++)for(h=0;h<u.dashArray.length;h++)s+=Number(u.dashArray[h]),s<e.length&&(l?f.lineTo(e[s].x,e[s].y):f.moveTo(e[s].x,e[s].y)),l=!l}else f.moveTo(n.x,n.y),f.bezierCurveTo(t.x,t.y,i.x,i.y,r.x,r.y);f.stroke()},i.prototype.quadraticCurve=function(n,t,i,r){var u=this.document.getContext("2d"),f,h,e,s;if(u.beginPath(),u.moveTo(n.x,n.y),r&&this.setStyle(r,u),r&&r.dashArray){for(f=[],this.flattenQuadraticBezier(f,n,t,i),h=0,e=0;e<r.dashArray.length;e++)h+=Number(r.dashArray[e]);var l=f.length/h,c=!0,o=0;for(e=0;e<l;e++)for(s=0;s<r.dashArray.length;s++)o+=Number(r.dashArray[s]),o<f.length&&(c?u.lineTo(f[o].x,f[o].y):u.moveTo(f[o].x,f[o].y)),c=!c}else u.moveTo(n.x,n.y),u.quadraticCurveTo(t.x,t.y,i.x,i.y);u.stroke()},i.prototype.arrow=function(n,t,i,r,u){var f=this.document.getContext("2d");f.beginPath();u&&this.setStyle(u,f);t&&t.angle&&this.rotateContext(t,f);f.moveTo(n.x+i.width,n.y+i.height/2);f.lineTo(n.x,n.y);f.lineTo(n.x+i.width,n.y-i.height/2);r||(f.closePath(),f.fill());f.stroke();t&&t.angle&&f.restore()},i.prototype.diamond=function(n,t,i,r){var u=this.document.getContext("2d");u.beginPath();r&&this.setStyle(r,u);t&&t.angle&&this.rotateContext(t,u);u.moveTo(n.x+i.width,n.y);u.lineTo(n.x+i.width/2,n.y+i.height/2);u.lineTo(n.x,n.y);u.lineTo(n.x+i.width/2,n.y-i.height/2);u.lineTo(n.x+i.width,n.y);u.stroke();u.fill();u.closePath();t&&t.angle&&u.restore()},i.prototype.dashedLine=function(n,t,i,r,u){var f=this.document.getContext("2d");f.save();var o=i-n,s=r-t,h=Math.sqrt(o*o+s*s),l=Math.atan2(s,o);f.beginPath();f.translate(n,t);f.moveTo(0,0);f.rotate(l);for(var a=u.length,v=0,c=!0,e=0;h>e;)e+=Number(u[v++%a]),e>h&&(e=h),c?f.lineTo(e,0):f.moveTo(e,0),c=!c,f.stroke();f.restore()},i.prototype.dashedRectangle=function(n,t,i,r,u){this.dashedLine(n,t,n+i,t,u);this.dashedLine(n+i,t,n+i,t+r,u);this.dashedLine(n+i,t+r,n,t+r,u);this.dashedLine(n,t+r,n,t,u)},i.prototype.dashedArc=function(n,t,i,r,u,f,e){for(var o,h,l,a=0,s=0;s<e.length;s++)a+=Number(e[s]);o=this.calculateCirclePoints(n,t,i,r,u,f,a);h=this.document.getContext("2d");h.beginPath();var y=o.length/a,v=!0,c=0;for(s=0;s<y;s++)for(l=0;l<e.length;l++)c+=Number(e[l]),c<o.length&&(v?(h.lineTo(o[c].x,o[c].y),h.stroke()):h.moveTo(o[c].x,o[c].y)),v=!v;h.closePath()},i.prototype.absolutePath=function(n){for(var r,h,e,y,p,c,l,a,v,o=t.datavisualization.Diagram.Util.convertPathToArray(n.getAttribute("d")),u=0,f=0,s=0,w=o.length;s<w;++s){if(r=o[s],h=r.pathSegTypeAsLetter,/[MLHVCSQTA]/.test(h))"x"in r&&(u=r.x),"y"in r&&(f=r.y);else{"x1"in r&&(c=u+r.x1);"x2"in r&&(a=u+r.x2);"y1"in r&&(l=f+r.y1);"y2"in r&&(v=f+r.y2);"x"in r&&(u+=r.x);"y"in r&&(f+=r.y);switch(h){case"m":e={pathSegTypeAsLetter:"M",x:u,y:f};break;case"l":e={pathSegTypeAsLetter:"L",x:u,y:f};break;case"h":e={pathSegTypeAsLetter:"H",x:u};break;case"v":e={pathSegTypeAsLetter:"V",y:f};break;case"c":e={pathSegTypeAsLetter:"C",x:u,y:f,x1:c,y1:l,x2:a,y2:v};break;case"s":e={pathSegTypeAsLetter:"S",x:u,y:f,x2:a,y2:v};break;case"q":e={pathSegTypeAsLetter:"Q",x:u,y:f,x1:c,y1:l};break;case"t":e={pathSegTypeAsLetter:"T",x:u,y:f};break;case"a":e={pathSegTypeAsLetter:"A",x:u,y:f,r1:r1,r2:r2,angle:angle,largeArcFlag:largeArcFlag,sweepFlag:sweepFlag};break;case"z":case"Z":u=y;f=p;e=o[s]}e&&(o[s]=e)}(h==="M"||h==="m")&&(y=u,p=f)}return n.setAttribute("d",t.datavisualization.Diagram.Util.pathSegArrayAsString(o)),i.prototype._scalePathData=function(n,t,i,r){return n!==i?n=r!==i?n*t-(Number(i)*t-Number(i))+(r-Number(i)):Number(n)*t-(Number(i)*t-Number(i)):r!==i&&(n=r),n},n},i.prototype.setStyle=function(n,t){n.fill&&(t.fillStyle=n.fill);n.stroke&&(t.strokeStyle=n.stroke=="none"?"transparent":n.stroke);n.font&&(t.font=n.font);n.lineWidth&&(t.lineWidth=n.lineWidth)},i.prototype.rotateContext=function(n,t){t.save();t.translate(n.x,n.y);t.rotate(n.angle*Math.PI/180);t.translate(-n.x,-n.y)},i.prototype.pathBounds=function(n){for(var i,b,r,v,y,p,w,c,l,u,f,e,o,s=0,h=0,a=0,k=n.length;a<k;++a){i=n[a];b=i.command;a==0&&i.x&&i.y&&(u=e=i.x,f=o=i.y);"x1"in i&&(v=i.x1);"x2"in i&&(p=i.x2);"y1"in i&&(y=i.y1);"y2"in i&&(w=i.y2);"x"in i&&(s=i.x);"y"in i&&(h=i.y);switch(b){case"M":c=s;l=h;case"L":case"H":case"V":s&&(u=Math.min(s,u),e=Math.max(s,e));h&&(f=Math.min(h,f),o=Math.max(h,o));break;case"C":case"S":r=this.getBezierBounds(t.datavisualization.Diagram.Point(c,l),t.datavisualization.Diagram.Point(v,y),t.datavisualization.Diagram.Point(p,w),t.datavisualization.Diagram.Point(s,h));u=Math.min(r.x,u);e=Math.max(r.x+r.width,e);f=Math.min(r.y,f);o=Math.max(r.y+r.height,o);break;case"Q":case"q":case"T":r=this.getQuadraticBounds(t.datavisualization.Diagram.Point(c,l),t.datavisualization.Diagram.Point(v,y),t.datavisualization.Diagram.Point(s,h));u=Math.min(r.x,u);e=Math.max(r.x+r.width,e);f=Math.min(r.y,f);o=Math.max(r.y+r.height,o);break;case"Z":case"z":s=c;h=l}}return{x:u,y:f,width:e-u,height:o-f}},i.prototype.flattenCubicBezier=function(n,i,r,u,f,e){for(var e=1.5,h=Number((t.datavisualization.Diagram.Geometry.distance(r,i)+t.datavisualization.Diagram.Geometry.distance(u,r)+t.datavisualization.Diagram.Geometry.distance(f,u))/e),s=0;s<=h;s++){var o=s/h,c=(1-o)*(1-o)*(1-o)*i.x+3*o*(1-o)*(1-o)*r.x+3*o*o*(1-o)*u.x+o*o*o*f.x,l=(1-o)*(1-o)*(1-o)*i.y+3*o*(1-o)*(1-o)*r.y+3*o*o*(1-o)*u.y+o*o*o*f.y;n.push(new t.datavisualization.Diagram.Point(c,l))}},i.prototype.flattenQuadraticBezier=function(n,i,r,u,f){for(var f=1.5,s=Number((t.datavisualization.Diagram.Geometry.distance(r,i)+t.datavisualization.Diagram.Geometry.distance(u,r))/f),o=0;o<=s;o++){var e=o/s,h=(1-e)*(1-e)*i.x+2*e*(1-e)*r.x+e*e*u.x,c=(1-e)*(1-e)*i.y+2*e*(1-e)*r.y+e*e*u.y;n.push(new t.datavisualization.Diagram.Point(h,c))}},i.prototype.getBezierBounds=function(n,i,r,u,f){for(var f=3,o,s,h,c,y=Number((t.datavisualization.Diagram.Geometry.distance(i,n)+t.datavisualization.Diagram.Geometry.distance(r,i)+t.datavisualization.Diagram.Geometry.distance(u,r))/f),l=0;l<=y;l++){var e=l/y,a=(1-e)*(1-e)*(1-e)*n.x+3*e*(1-e)*(1-e)*i.x+3*e*e*(1-e)*r.x+e*e*e*u.x,v=(1-e)*(1-e)*(1-e)*n.y+3*e*(1-e)*(1-e)*i.y+3*e*e*(1-e)*r.y+e*e*e*u.y;l==0?(o=h=a,s=c=v):(o=Math.min(a,o),s=Math.min(v,s),h=Math.max(a,h),c=Math.max(v,c))}return{x:o,y:s,width:h-o,height:c-s}},i.prototype.getQuadraticBounds=function(n,i,r,u){for(var u=3,e,o,s,h,v=Number((t.datavisualization.Diagram.Geometry.distance(i,n)+t.datavisualization.Diagram.Geometry.distance(r,i))/u),c=0;c<=v;c++){var f=c/v,l=(1-f)*(1-f)*n.x+2*f*(1-f)*i.x+f*f*r.x,a=(1-f)*(1-f)*n.y+2*f*(1-f)*i.y+f*f*r.y;c==0?(e=s=l,o=h=a):(e=Math.min(l,e),o=Math.min(a,o),s=Math.max(l,s),h=Math.max(a,h))}return{x:e,y:o,width:s-e,height:h-o}},i}();t.datavisualization.Diagram.Canvas=i;t.datavisualization.Diagram.CanvasContext={_renderDocument:function(n,i){var r={id:n.canvas.id+"_canvas",width:i._canvas.clientWidth,height:i._canvas.clientHeight,version:"1.1",xlink:"http://www.w3.org/1999/xlink",style:n.style,"pointer-events":"none"};n._canvas=new t.datavisualization.Diagram.Canvas(r);i._view=n.canvas;n.canvas.appendChild(n._canvas.document);n.type=="mainview"&&(this._canvas=n.canvas,i._svg=this._svg=n._canvas)},_renderGroupBackground:function(n,i,r){var u,f,e,h,o,s;n.pivot||(n.pivot={},n.pivot.x=.5,n.pivot.y=.5);u=i.document.getContext("2d");n.visible&&(f={angle:n.rotateAngle,x:n.offsetX*i._scaleX,y:n.offsetY*i._scaleY},u.save(),u.translate(f.x,f.y),u.rotate(f.angle*Math.PI/180),u.translate(-f.x,-f.y),u.fillStyle=n.type!="bpmn"?n.fillColor:"transparent",u.strokeStyle=n.type!="bpmn"?n.borderColor:"transparent",u.lineWidth=n.borderWidth,n.borderDashArray&&(n.borderDashArray.indexOf("[")!=-1||n.borderDashArray instanceof Array?e=n.borderDashArray:n.borderDashArray.indexOf(",")!=-1?e=n.borderDashArray.split(","):n.borderDashArray.indexOf(" ")!=-1&&(e=n.borderDashArray.split(" ")),u.setLineDash?u.setLineDash(e):u.mozDash?u.mozDash=e:h={dashArray:e}));o=n.offsetX*i._scaleX-n.width*i._scaleX*n.pivot.x;s=n.offsetY*i._scaleY-n.height*i._scaleY*n.pivot.y;t.datavisualization.Diagram.Util.canCrispEdges(n,r)&&(o=Math.floor(o)+.5,s=Math.floor(s)+.5);i.rect(o,s,n.width*i._scaleX,n.height*i._scaleY,null,h);u.restore()},renderGroup:function(n,t,i){var u,f,o,r,c,l,e,s,h;if(n.visible){for(u=t.document.getContext("2d"),f={angle:n.rotateAngle,x:n.offsetX*t._scaleX,y:n.offsetY*t._scaleY},u.save(),this._renderGroupBackground(n,t,i),o=0;o<n.children.length;o++)r=i.nameTable[i._getChild(n.children[o])],r&&(r._type==="group"?this.renderGroup(r,t,i):r._type==="node"?this.renderNode(r,t):r.segments&&this.renderConnector(r,t));if(u.translate(f.x,f.y),u.rotate(f.angle*Math.PI/180),u.translate(-f.x,-f.y),c=n.offsetX*t._scaleX-n.width*t._scaleX*n.pivot.x,l=n.offsetY*t._scaleY-n.height*t._scaleY*n.pivot.y,n.isLane||(this.renderLabels(n,t),this.renderPorts(n,t,c,l)),n.isSwimlane&&i._renderCanvasPhase(n,t),n.annotation&&n._annotation&&n._annotation.length)for(e=0;e<n._annotation.length;e++)i.nameTable[n._annotation[e]]&&(s=i.nameTable[n._annotation[e]],h=i.getObjectType(s),h=="node"?this.renderNode(s,t):h=="connector"&&this.renderConnector(s,t));u.restore()}},_isExportable:function(n,i){var f=!0,e,i,r,u;if(n.type==="image")try{i=new t.datavisualization.Diagram.Canvas({id:"temp_canvas",width:100,height:100});r=i.document.getContext("2d");r.save();i.rect(0,0,n.width*i._scaleX,n.height*i._scaleY);u=new Image;u.src=n.source;i.image(u,0,0,n.width*i._scaleX,n.height*i._scaleY);r.restore();e=i.document.toDataURL()}catch(o){f=!1}return f},_isImageExportable:function(n){var f=!0,e,i,r,u;if(n.source)try{i=new t.datavisualization.Diagram.Canvas({id:"temp_canvas",width:100,height:100});r=i.document.getContext("2d");r.save();u=new Image;u.src=n.source;i.image(u,0,0,100,100);r.restore();e=i.document.toDataURL()}catch(o){f=!1}return f},renderNode:function(n,i){var r=i.document.getContext("2d"),u,f,e,o,d,s,a,h,c,l,g,v,p,y,w,nt;if(n.visible&&this._isExportable(n,i)){u=n.width||n._width||0;f=n.height||n._height||0;u*=i._scaleX;f*=i._scaleY;var b=n.offsetX*i._scaleX,k=n.offsetY*i._scaleY,l={angle:n.rotateAngle,x:b,y:k};if(r.save(),r.translate(l.x,l.y),r.rotate(l.angle*Math.PI/180),r.translate(-l.x,-l.y),r.save(),r.fillStyle=n.fillColor,r.strokeStyle=n.borderColor=="none"||!n.borderWidth?"transparent":n.borderColor,r.lineWidth=n.borderWidth,r.globalAlpha=n.opacity,e=b-u*n.pivot.x,o=k-f*n.pivot.y,t.datavisualization.Diagram.Util.canCrispEdges(n,i._diagram)&&(e=Math.floor(e)+.5,o=Math.floor(o)+.5),n._shape=="path"?this._renderGradient(n,r,0,0):this._renderGradient(n,r,e,o),d=n.fillColor,n.constraints&t.datavisualization.Diagram.NodeConstraints.Shadow){r.save();r.strokeStyle="lightgrey";s=t.datavisualization.Diagram.Geometry.transform({x:0,y:0},n.shadow.angle,n.shadow.distance);r.fillStyle=d!="none"||d!="transparent"?"lightgrey":"none";switch(n._shape){case"image":case"rectangle":n.cornerRadius?i.roundedRect(e+s.x,o+s.y,u,f,n.cornerRadius,null):i.rect(e+s.x,o+s.y,u,f,null);break;case"ellipse":i.ellipse(e+u/2+s.x,o+f/2+s.y,u/2,f/2,null);break;case"path":c=n._absolutePath;(i._scaleX!==1||i._scaleY!==1)&&(c=t.datavisualization.Diagram.Geometry.updatePath(e,o,u,f,c,i._diagram._svg,null,null));i.path(c,e+s.x,o+s.y,u,f,null);break;case"polygon":p=this._updatePolygonPoints(n,i);r.translate(s.x,s.y);i.polygon(p,null,h)}r.restore()}n.borderDashArray&&(n.borderDashArray.indexOf("[")!=-1||n.borderDashArray instanceof Array?a=n.borderDashArray:n.borderDashArray.indexOf(",")!=-1?a=n.borderDashArray.split(","):n.borderDashArray.indexOf(" ")!=-1&&(a=n.borderDashArray.split(" ")),r.setLineDash?r.setLineDash(a):r.mozDash?r.mozDash=a:h={dashArray:a});switch(n._shape){case"rectangle":n.cornerRadius?i.roundedRect(e,o,u,f,n.cornerRadius,null,h):i.rect(e,o,u,f,null,h);break;case"ellipse":i.ellipse(e+u/2,o+f/2,u/2,f/2,null,h);break;case"path":c=n._absolutePath;(i._scaleX!==1||i._scaleY!==1)&&(c=t.datavisualization.Diagram.Geometry.updatePath(0,0,u,f,c,i._diagram._svg,null,null));i.path(c,e,o,u,f,null,h);break;case"image":l={angle:n.rotateAngle,x:b,y:k};i.rect(e,o,u,f,null,h);g=new Image;g.src=n.source;i.image(g,e,o,u,f,null);break;case"text":i.rect(e,o,u,f,null,h);n.textBlock&&(v="",n.textBlock.italic&&(v+="italic "),n.textBlock.bold&&(v+="bold "),v+=n.textBlock.fontSize+" ",v+=n.textBlock.fontFamily,r.font=v,this._renderTextElement(n,n.textBlock,i));break;case"polygon":p=this._updatePolygonPoints(n,i);i.polygon(p,null,h);break;case"native":case"html":diagram._raiseEvent("templateNodeRendering",{element:n,canvas:i})}if(r.restore(),this.renderPorts(n,i,e,o),n.type!="text"&&this.renderLabels(n,i),n.annotation&&n._annotation&&n._annotation.length)for(y=0;y<n._annotation.length;y++)diagram.nameTable[n._annotation[y]]&&(w=diagram.nameTable[n._annotation[y]],nt=diagram.getObjectType(w),nt=="node"?this.renderNode(w,i):nt=="connector"&&this.renderConnector(w,i));r.restore()}},renderPhases:function(n,t,i){var f,r,u;n&&t&&(r=t.document.getContext("2d"),r.save(),r.strokeStyle=n.lineColor?n.lineColor:"black",r.lineWidth=n.lineWidth?n.lineWidth:1,n.lineDashArray&&(n.lineDashArray.indexOf("[")!=-1||n.lineDashArray instanceof Array?u=n.lineDashArray:n.lineDashArray.indexOf(",")!=-1?u=n.lineDashArray.split(","):n.lineDashArray.indexOf(" ")!=-1&&(u=n.lineDashArray.split(" ")),r.setLineDash?r.setLineDash(u):r.mozDash?r.mozDash=u:f={dashArray:u}),i&&i.length>0&&t.line(i[0],i[1],f));r.restore()},renderConnector:function(n,t){var i,r,f,u;if(n.visible&&(i=t.document.getContext("2d"),i.save(),i.strokeStyle=n.lineColor,i.lineWidth=n.lineWidth,n.lineDashArray&&(n.lineDashArray.indexOf("[")!=-1||n.lineDashArray instanceof Array?r=n.lineDashArray:n.lineDashArray.indexOf(",")!=-1?r=n.lineDashArray.split(","):n.lineDashArray.indexOf(" ")!=-1&&(r=n.lineDashArray.split(" ")),i.setLineDash?i.setLineDash(r):i.mozDash?i.mozDash=r:f={dashArray:r}),n.segments&&this._renderSegments(n,t,f),i.restore(),this._renderDecorators(n,t),this.renderLabels(n,t),n.shape))for(u=0;u<n._inlineDecorators.length;u++)this.renderNode(n._inlineDecorators[u],t)},_renderSegments:function(n,i,r){for(var f,d,ut,u,w,b,g,nt,v,c,a,it,h,l,e,p,rt,o,s=0;s<n.segments.length;s++){if(f=n.segments[s],f._bridges.length>0)for(d=0;d<f._bridges.length;d++)ut=f._bridges[d],ut._rendered=!1;if(u=f.points,w=i._diagram,s==0?(w&&n.sourceNode&&(g=w._findNode(n.sourceNode)),u=t.datavisualization.Diagram.SvgContext._clipDecorators(n,f,!0,g),f.type=="bezier"&&n.sourceDecorator&&n.sourceDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(u[0]=t.datavisualization.Diagram.Util._adjustPoint(u[0],f._point1,!0,n.lineWidth)),a=u[0],b=!0):b=!1,s==n.segments.length-1&&(w&&n.targetNode&&(g=w._findNode(n.targetNode)),u=t.datavisualization.Diagram.SvgContext._clipDecorators(n,f,!1,g),a&&n.segments.length<2&&(u[0]=a,a=null),nt=!0),n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&s==0){v={x:f.points[0].x,y:f.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(f.points[0],f.points[1]);c=Math.min(30,c/2);var y=t.datavisualization.Diagram.Geometry.findAngle(f.points[0],f.points[1]),tt=t.datavisualization.Diagram.Geometry.transform({x:v.x,y:v.y},y,c),k=t.datavisualization.Diagram.Geometry.transform({x:tt.x,y:tt.y},y+135,-12),ft=t.datavisualization.Diagram.Geometry.transform({x:k.x,y:k.y},y+135,24)}if(n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&s==0){v={x:f.points[0].x,y:f.points[0].y};c=t.datavisualization.Diagram.Geometry.distance(f.points[0],f.points[1]);c=Math.min(30,c/2);var y=t.datavisualization.Diagram.Geometry.findAngle(f.points[0],f.points[1]),tt=t.datavisualization.Diagram.Geometry.transform({x:v.x,y:v.y},y,c),k=t.datavisualization.Diagram.Geometry.transform({x:tt.x,y:tt.y},y+135,-12),ft=t.datavisualization.Diagram.Geometry.transform({x:k.x,y:k.y},y+135,24)}if(f.type=="bezier")a=u[0],it=f._endPoint,n.targetDecorator&&n.targetDecorator.shape!==t.datavisualization.Diagram.DecoratorShapes.None&&(it=t.datavisualization.Diagram.Util._adjustPoint(f._endPoint,f._point2,!0,n.lineWidth)),i.bezierCurve(a,f._point1,f._point2,it,r);else if(n.cornerRadius>0)for(e=0;e<u.length-1;e++)p=t.datavisualization.Diagram.Geometry.distance(u[e],u[e+1]),p>0&&(rt=l||h,l=s<n.segments.length-1||e<u.length-2?p<n.cornerRadius*2?this._adjustPoint(u[e],u[e+1],!1,p/2):this._adjustPoint(u[e],u[e+1],!1,n.cornerRadius):u[e+1],(s>0||e>0)&&(p<n.cornerRadius*2?(h=this._adjustPoint(u[e],u[e+1],!0,p/2),(s<n.segments.length-1||e<u.length-2)&&(l=null)):h=this._adjustPoint(u[e],u[e+1],!0,n.cornerRadius)),rt&&h?i.quadraticCurve(rt,u[e],h,r):h=u[e],f._bridges.length>0&&this._updateBridging(f,i,e+1,h?h:u[e],l?l:u[e+1],n.bridgeSpace,r,b&&o==1?!0:!1,nt&&o==u.length-1?!0:!1),l&&(f._bridges.length>0||i.line(h,l,r)));else for(o=1;o<u.length;o++)f._bridges.length>0?this._updateBridging(f,i,o,u[o-1],u[o],n.bridgeSpace,r,b&&o==1?!0:!1,nt&&o==u.length-1?!0:!1):i.line(this._scalePointforStretch(u[o-1],i,n),this._scalePointforStretch(u[o],i,n),r,b&&o==1?!1:!0,nt&&o==u.length-1?!1:!0)}n.shape&&n.shape.flow=="sequence"&&n.shape.sequence=="default"&&i.line(this._scalePointforStretch(k,i,n),this._scalePointforStretch(ft,i,n),r)},_scalePointforStretch:function(n,i,r){var u={x:n.x,y:n.y};return r&&t.datavisualization.Diagram.Util.canCrispEdges(r,i._diagram)&&(u.x=Math.floor(u.x),u.y=Math.floor(u.y)),u.x*=i._scaleX,u.y*=i._scaleY,u},_updateBridging:function(n,i,r,u,f,e,o,s,h){var a,v=this._findAngle(u,f),p=i._diagram.bridgeDirection(),y,l,c;if(n._bridges.length>0)if(n.type==="straight"){for(l=0;l<n._bridges.length;l++)if(c=n._bridges[l],!c._rendered){a=n._bridges[l-1]!=null&&n._bridges[l-1].segmentPointIndex==c.segmentPointIndex?n._bridges[l-1].endPoint:u;i.line(a,c.startPoint,o,!(s||l==0),!0);var w=c.startPoint.x+(c.endPoint.x-c.startPoint.x)/2,b=c.startPoint.y+(c.endPoint.y-c.startPoint.y)/2,k=t.datavisualization.Diagram.Util.sweepDirection(v,p,null,i._diagram);i.arc(w,b,e/2,v,k,o);n._bridges[l+1]!=null&&n._bridges[l+1].segmentPointIndex==c.segmentPointIndex?i.line(c.endPoint,n._bridges[l+1].startPoint,o,!1):i.line(c.endPoint,f,o,!1,!h);c._rendered=!0}}else if(n.type==="orthogonal"){for(y=u,l=0;l<n._bridges.length;l++)if(c=n._bridges[l],c.segmentPointIndex===r&&!c._rendered){a=n._bridges[l-1]!=null&&n._bridges[l-1].segmentPointIndex==c.segmentPointIndex?n._bridges[l-1].endPoint:u;i.line(a,c.startPoint,o,!(s||l==0),!0);var w=c.startPoint.x+(c.endPoint.x-c.startPoint.x)/2,b=c.startPoint.y+(c.endPoint.y-c.startPoint.y)/2,k=t.datavisualization.Diagram.Util.sweepDirection(v,p,null,i._diagram);i.arc(w,b,e/2,v,k,o);n._bridges[l+1]!=null&&n._bridges[l+1].segmentPointIndex==c.segmentPointIndex?i.line(c.endPoint,n._bridges[l+1].startPoint,o,!1):y=c.endPoint;c._rendered=!0}i.line(y,f,o,!1,!h)}},_findAngle:function(n,t){var i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)*(180/Math.PI)},_adjustPoint:function(n,i,r,u){var f=r?{x:n.x,y:n.y}:{x:i.x,y:i.y},e;return n.x==i.x?n.y<i.y&&r||n.y>i.y&&!r?f.y+=u:f.y-=u:n.y==i.y?n.x<i.x&&r||n.x>i.x&&!r?f.x+=u:f.x-=u:r?(e=t.datavisualization.Diagram.Geometry.findAngle(n,i),f=t.datavisualization.Diagram.Geometry.transform(n,e,u)):(e=t.datavisualization.Diagram.Geometry.findAngle(i,n),f=t.datavisualization.Diagram.Geometry.transform(i,e,u)),f},renderLabels:function(n,t){for(var i,r,u=0;u<n.labels.length;u++)i=n.labels[u],r=t.document.getContext("2d"),r.save(),r.globalAlpha=i.opacity,r.lineWidth=i.borderWidth,r.strokeStyle=i.borderColor,i.text&&i.visible&&this._renderTextElement(n,i,t),r.restore()},renderPorts:function(n,i,r,u){for(var e,o,f,a,v,l,h,s=i.document.getContext("2d"),c=0;c<n.ports.length;c++)if(e=n.ports[c],!(e.visibility&t.datavisualization.Diagram.PortVisibility.Hidden||e.visibility&t.datavisualization.Diagram.PortVisibility.Hover||e.visibility&t.datavisualization.Diagram.PortVisibility.Connect)){o=t.datavisualization.Diagram.Util._getPortPosition(e,t.datavisualization.Diagram.Util.bounds(n,!0));o=this._scalePointforStretch(o,i);f=e.size*i._scaleY;s.fillStyle=e.fillColor;s.strokeStyle=e.borderColor;s.lineWidth=e.borderWidth;switch(e.shape){case"x":s.beginPath();s.moveTo(o.x-f/2,o.y-f/2);s.lineTo(o.x+f/2,o.y+f/2);s.moveTo(o.x+f/2,o.y-f/2);s.lineTo(o.x-f/2,o.y+f/2);s.stroke();s.fill();s.closePath();break;case"circle":a=f/2;v=f/2;i.ellipse(o.x,o.y,a,v);break;case"square":i.rect(o.x-f/2,o.y-f/2,f,f);break;case"path":s.save();n._type=="group"?(s.translate(offsetX,n.offsetY),s.rotate(-n.rotateAngle*Math.PI/180),s.translate(-offsetX,-n.offsetY),n.rotateAngle&&(l={angle:n.rotateAngle,x:e._absolutePoint.x,y:e._absolutePoint.y}),h=e._absolutePath,(i._scaleX!==1||i._scaleY!==1)&&(h=t.datavisualization.Diagram.Geometry.updatePath(e._absolutePoint.x,e._absolutePoint.y,f,f,h,i._diagram._svg,null,null)),i.path(h,0,0,f,f,l)):(r=o.x-n.width*e.offset.x,u=o.y-n.height*e.offset.y,h=e._absolutePath,(i._scaleX!==1||i._scaleY!==1)&&(h=t.datavisualization.Diagram.Geometry.updatePath(r,u,f,f,h,i._diagram._svg,null,null)),i.path(h,r,u,f,f,l));s.restore()}}},_renderTextElement:function(n,t,i){var f,u,r,e;t&&(f={childNodes:[]},u=i.document.getContext("2d"),u.save(),r="",t.italic&&(r+="italic "),t.bold&&(r+="bold "),r+=t.fontSize*i._scaleY+"px ",r+=t.fontFamily,u.font=r,e=this._wrapText(n,f,t,i),this._alignTextOnLabel(t,n,f,i,e),u.restore())},_alignTextOnLabel:function(n,i,r,u,f){var d=i.width||i._width||0,vt=i.height||i._height||0,o,h,e,it,b,rt,ut,ft,et,s,p,g,nt,st,w,l,ct,tt,lt,at;d*=u._scaleX;vt*=u._scaleY;o={width:f&&f.width||n.width,height:r.childNodes.length*n.fontSize*u._scaleY};h=t.datavisualization.Diagram.Util.bounds(i);h.width*=u._scaleX;h.height*=u._scaleY;h.x*=u._scaleX;h.y*=u._scaleY;rt=u._diagram;i.segments&&n.relativeMode=="segmentpath"?(ut=t.datavisualization.Diagram.SvgContext._getConnectorHandlePosition(n,i,1,rt),ft=this._scalePointforStretch(ut.position,u),e={x:(ft.x-h.x)/h.width,y:(ft.y-h.y)/h.height},et=t.datavisualization.Diagram.Util._alignLabelOnSegments(i,n,rt,ut),b=et.vAlign,it=et.hAlign):(it=n.horizontalAlignment,b=n.verticalAlignment);e=t.datavisualization.Diagram.Util._getLabelPosition(n,h,e);var c={x:0,y:0},y={x:e.x,y:e.y},k=0;k=b==t.datavisualization.Diagram.VerticalAlignment.Top?e.y+o.height/2:b==t.datavisualization.Diagram.VerticalAlignment.Center||b==t.datavisualization.Diagram.VerticalAlignment.Stretch?e.y:e.y-o.height/2;c.y=k;c.x=e.x;y.y=k;s=u.document.getContext("2d");n.textAlign=="justify"?r.childNodes.length>1?(s.textAlign="left",o.width=d-2*n.borderWidth):s.textAlign="center":s.textAlign=n.textAlign;switch(it){case t.datavisualization.Diagram.HorizontalAlignment.Left:y.x=e.x+o.width/2;switch(s.textAlign){case t.datavisualization.Diagram.TextAlign.Left:c.x=e.x;break;case t.datavisualization.Diagram.TextAlign.Center:c.x=e.x+o.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:c.x=e.x+o.width}break;case t.datavisualization.Diagram.HorizontalAlignment.Center:y.x=e.x;switch(s.textAlign){case t.datavisualization.Diagram.TextAlign.Left:c.x=e.x-o.width/2;break;case t.datavisualization.Diagram.TextAlign.Center:c.x=e.x;break;case t.datavisualization.Diagram.TextAlign.Right:c.x=e.x+o.width/2}break;case t.datavisualization.Diagram.HorizontalAlignment.Right:y.x=e.x-o.width/2;switch(s.textAlign){case t.datavisualization.Diagram.TextAlign.Left:c.x=e.x-o.width;break;case t.datavisualization.Diagram.TextAlign.Center:c.x=e.x-o.width/2;break;case t.datavisualization.Diagram.TextAlign.Right:c.x=e.x}break;case t.datavisualization.Diagram.HorizontalAlignment.Stretch:y.x=e.x;c.x=e.x}g=h.x;nt=h.y;i.segments||(g=i.offsetX*u._scaleX-d*i.pivot.x,nt=i.offsetY*u._scaleY-vt*i.pivot.y);var a=n.borderWidth||0,ot=g+c.x+(f?f.x:0)-a/2,k=nt+c.y-o.height/2-a/2;for(n.verticalAlignment=="stretch"?u.rect(ot,h.y,o.width+a,h.height+a,null,{fill:n.fillColor&&!i._isHeader?n.fillColor:"transparent",stroke:a&&!i._isHeader?n.borderColor||"transparent":"transparent",lineWidth:a}):u.rect(ot,k,o.width+a,o.height+a,null,{fill:n.fillColor?n.fillColor:"transparent",stroke:a?n.borderColor||"transparent":"transparent",lineWidth:a}),p={angle:n.rotateAngle,x:g+y.x,y:nt+y.y},n.textAlign=="justify"&&(st=Math.max(d,n.width)-2*n.borderWidth),s.save(),s.translate(p.x,p.y),s.rotate(p.angle*Math.PI/180),s.translate(-p.x,-p.y),w=0;w<r.childNodes.length;w++){var v=r.childNodes[w],yt=ot+v.x-f.x+a/2,pt=k+v.dy*w+n.fontSize*u._scaleY*.8+a/2,ht=s.measureText(v.text).width;if(st>ht&&w<r.childNodes.length-1&&(l=v.text,l[l.length-1]==" "&&(l=l.slice(0,l.length-1)),l[0]==" "&&(l=l.slice(1,l.length)),ht=s.measureText(l).width,ct=l.split(" "),ct.length>1)){for(tt=(st-ht)/s.measureText(" ").width/(ct.length-1),tt=Math.round(tt),lt="",at=0;at<tt;at++)lt+=" ";v.text=l.replace(" ",lt)}if(n.horizontalAlignment=="stretch")switch(n.textAlign){case"left":v.x=e.x-o.width/2;break;case"center":v.x=-o.width/2;break;case"right":v.x=-e.x-o.width/2}u.text({text:v.text},yt-v.x,pt,null,{fill:n.fontColor});n.textDecoration!="none"&&this._renderTextDecoration(yt-v.x,pt,s.measureText(v.text).width,n,u)}s.restore()},_wrapText:function(n,i,r,u){var d=r.text,a,y,f,o,p,e,c,k;r.rotateAngle!=undefined?u&&u._diagram?(a=u._diagram.nameTable[n.parent],a&&a.isLane&&r.rotateAngle!==0?(f=t.datavisualization.Diagram.Util.bounds(n),y=f.width,f.width=f.height,f.height=y):f=t.datavisualization.Diagram.Util.bounds(n)):f=t.datavisualization.Diagram.Util.bounds(n):f=t.datavisualization.Diagram.Util.bounds(n);f.width*=u._scaleX;f.height*=u._scaleY;f.x*=u._scaleX;f.y*=u._scaleY;n.segments?(o=f.width,p=f.height):(o=f.width-r.margin.left-r.margin.right,p=f.height-r.margin.top-r.margin.bottom);o-=2*(r.borderWidth?r.borderWidth:1);o=o<r.width?r.width:o;for(var l=d.split("\n"),w,h,v=u.document.getContext("2d"),b=r.wrapping=="wrapwithoverflow"?!0:!1,s=0;s<l.length;s++)if(e="",r.wrapping!="nowrap")for(c=r.wrapping=="wrapwithoverflow"?l[s].split(" "):l[s],h=0;h<c.length;h++)e+=(e&&b?" ":"")+c[h],w=v.measureText(e).width,w>=o?(i.childNodes[i.childNodes.length]={text:e},e=""):(b&&(k=e+" "+(c[h+1]||""),v.measureText(k).width>o&&(i.childNodes[i.childNodes.length]={text:e},e="")),h==c.length-1&&(i.childNodes[i.childNodes.length]={text:e},e=""));else e+=l[s],i.childNodes[i.childNodes.length]={text:e};return this._wrapTextAlign(i,i.childNodes,r.fontSize*u._scaleY,r.textAlign,v,n,r,u)},_wrapTextAlign:function(n,i,r,u,f,e,o,s){var a,c,v=t.datavisualization.Diagram.Util.bounds(e),l,h;for(v.width*=s._scaleX,v.height*=s._scaleY,v.x*=s._scaleX,v.y*=s._scaleY,l=0;l<i.length;l++){if(h=f.measureText(i[l].text).width,a=h,o.horizontalAlignment=="stretch")a=v.width,h=-a/2;else switch(u){case"left":h=0;break;case"center":h=-h/2;break;case"right":h=-h;break;case"justify":h=i.length>1?0:-h/2}i[l].x=Number(h);i[l].dy=r;c?(c.x=Math.min(c.x,h),c.width=Math.max(c.width,a)):c={x:h,width:a}}return c},_renderTextDecoration:function(n,t,i,r,u){var f=u.document.getContext("2d"),e,o;f.save();f.strokeStyle=r.fontColor;f.lineWidth=1;switch(f.textAlign){case"center":n-=i/2;break;case"right":n-=i}t+=2;switch(r.textDecoration){case"overline":t-=r.fontSize*u._scaleY;break;case"line-through":t-=r.fontSize/2*u._scaleY}e={x:n,y:t};o={x:n+i,y:t};u.line(e,o,null);f.restore()},_renderGradient:function(n,t,i,r){var f,o,s,u,e,h;if(n.gradient){for(u=0;u<n.gradient.stops.length;u++)f=f?Math.max(f,n.gradient.stops[u].offset):n.gradient.stops[u].offset,o=o?Math.min(o,n.gradient.stops[u].offset):n.gradient.stops[u].offset;if(n.gradient.type=="linear")for(s=t.createLinearGradient(i+n.gradient.x1,r+n.gradient.y1,i+n.gradient.x2,r+n.gradient.y2),u=0;u<n.gradient.stops.length;u++)e=n.gradient.stops[u],h=o<0?(f+e.offset)/(2*f):e.offset/f,s.addColorStop(h,e.color);else if(n.gradient.type=="radial")for(s=t.createRadialGradient(i+n.gradient.fx,r+n.gradient.fy,0,i+n.gradient.cx,r+n.gradient.cy,n.gradient.r),u=0;u<n.gradient.stops.length;u++)e=n.gradient.stops[u],h=o<0?(f+e.offset)/(2*f):e.offset/f,s.addColorStop(h,e.color);t.fillStyle=s}},_renderDecorators:function(n,i){var u,f,e=i._diagram,o,r,s;n.targetDecorator&&n.targetDecorator.shape&&(r=n.segments[n.segments.length-1],u=r.points[r.points.length-2],f=n.targetPoint,r.type=="bezier"&&(u=r._point2),n.targetNode&&e&&(o=e._findNode(n.targetNode),o&&o.borderColor!="none"&&(f=t.datavisualization.Diagram.Util._adjustPoint(f,u,!0,o.borderWidth/2))),this._renderDecorator(n.name+"_targetDecorator",f,u,n.targetDecorator,i));n.sourceDecorator&&n.sourceDecorator.shape&&(r=n.segments[0],u=n.sourcePoint,f=r.points[1],r.type=="bezier"&&(f=r._point1),n.sourceNode&&e&&(s=e._findNode(n.sourceNode),s&&s.borderColor!="none"&&(u=t.datavisualization.Diagram.Util._adjustPoint(u,f,!0,s.borderWidth/2))),this._renderDecorator(n.name+"_sourceDecorator",u,f,n.sourceDecorator,i))},_renderDecorator:function(n,i,r,u,f){var v,e=this._scalePointforStretch(i,f),y=this._scalePointforStretch(r,f),o=new t.datavisualization.Diagram.Size(Number(u.width*f._scaleY),Number(u.height*f._scaleY)),h=f.document.getContext("2d"),c,s,l,a;h.fillStyle=u.fillColor;h.strokeStyle=u.borderColor=="none"?"transparent":u.borderColor;h.lineWidth=u.borderWidth;c=t.datavisualization.Diagram.Geometry.findAngle(e,y);s={angle:c,x:e.x,y:e.y};switch(u.shape){case"arrow":f.arrow(e,s,o);break;case"openarrow":f.arrow(e,s,o,!0);break;case"circle":l=o.width/2;a=o.height/2;f.ellipse(e.x+o.width/2,e.y,l,a,s);break;case"diamond":f.diamond(e,s,o);break;case"path":f.path(u._absolutePath,0,0,o.width,o.height,s)}return v},_updatePolygonPoints:function(n,i){var u=[],f,e,o,r,h,c;if(n.points){for(f=n.width||n._width||0,e=n.height||n._height||0,f*=i._scaleX,e*=i._scaleY,r=0;r<n.points.length;r++)o=n.points[r],u.push({x:o.x,y:o.y});if(u.length){this._scalePoints(u,n,i);var s=t.datavisualization.Diagram.Geometry.rect(u),l=n.offsetX*i._scaleX-f*n.pivot.x-s.x,a=n.offsetY*i._scaleY-e*n.pivot.y-s.y;for(r=0,h=u.length;r<h;++r)c=t.datavisualization.Diagram.Geometry.translate(u[r],l,a),u[r]=c}}return u},_scalePoints:function(n,i,r){var f=t.datavisualization.Diagram.Geometry.rect(n),e,o,s,h,u,c;if(f.width>0&&f.height>0)for(e=i.width||i._width||0,o=i.height||i._height||0,e*=r._scaleX,o*=r._scaleY,s=e/f.width,h=o/f.height,u=0,c=n.length;u<c;++u)n[u].x=n[u].x*s,n[u].y=n[u].y*h},updateNode:function(n,t){this.refreshCanvas(n,t)},updateConnector:function(n,t){this.refreshCanvas(n,t)},updateGroup:function(n,t){this.refreshCanvas(n,t)},refreshCanvas:function(n,t){var r=t.document.getContext("2d"),u,i;for(r.save(),view.scale&&r.scale(1/view.scale.x,1/view.scale.y),u={x:t.document.offsetLeft,y:t.document.offsetTop,width:t.document.offsetWidth,height:t.document.offsetHeight},r.clearRect(u.x,u.y,u.width,u.height),view.scale&&r.scale(view.scale.x,view.scale.y),r.restore(),i=0;i<n.nodes.length;i++)n.nodes[i]._type==="node"?this.renderNode(n.nodes[i],t):n.nodes[i]._type==="group"&&this.renderGroup(n.nodes[i],t);for(i=0;i<n.connectors.length;i++)this.renderConnector(n.connectors[i],t)},updateViewport:function(){},addNodeLabel:function(n,t){this.refreshCanvas(n,t)},updateLabel:function(n,t){this.refreshCanvas(n,t)},setNodeShape:function(n,t){this.refreshCanvas(n,t)},setLine:function(n,t){this.refreshCanvas(n,t)},renderDecorators:function(n,t){this.refreshCanvas(n,t)},clearDecorators:function(n,t){this.refreshCanvas(n,t)},updateTargetDecoratorStyle:function(n,t){this.refreshCanvas(n,t)},updateSourceDecoratorStyle:function(n,t){this.refreshCanvas(n,t)},_updateNodeStyle:function(n,t){this.refreshCanvas(n,t)},updateLabelStyle:function(n,t){this.refreshCanvas(n,t)},updateConnectorStyle:function(n,t){this.refreshCanvas(n,t)},updateTextBlock:function(n,t,i){this.refreshCanvas(n,i)},removeChild:function(){this.refreshCanvas(model,canvas)}}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t,i,r;(function(n){n[n.Line="line"]="Line";n[n.Column="column"]="Column";n[n.Area="area"]="Area";n[n.WinLoss="winloss"]="WinLoss";n[n.Pie="pie"]="Pie"})(n.Type||(n.Type={}));t=n.Type,function(n){n[n.flatlight="flatlight"]="flatlight";n[n.azurelight="azurelight"]="azurelight";n[n.limelight="limelight"]="limelight";n[n.saffronlight="saffronlight"]="saffronlight";n[n.gradientlight="gradientlight"]="gradientlight";n[n.flatdark="flatdark"]="flatdark";n[n.azuredark="azuredark"]="azuredark";n[n.limedark="limedark"]="limedark";n[n.saffrondark="saffrondark"]="saffrondark";n[n.gradientdark="gradientdark"]="gradientdark"}(n.Themes||(n.Themes={}));i=n.Themes;r=function(r){function u(u,f){r.call(this);this.defaults={locale:null,enableGroupSeparator:!1,enableCanvasRendering:!1,padding:8,palette:["#8A2BE2","#ff1a75","#99cc00","#4d4dff","#660066","#FFA500","#FFD700","#FF00FF","#808000","#990000"],isResponsive:!0,dataSource:null,xName:"",yName:"",type:t.Line,width:1,stroke:null,opacity:1,fill:"#33ccff",border:{color:"transparent",width:1},rangeBandSettings:{startRange:null,endRange:null,opacity:.4,color:"transparent"},highPointColor:null,lowPointColor:null,negativePointColor:null,startPointColor:null,endPointColor:null,tooltip:{visible:!1,template:null,fill:"white",border:{width:1,color:null},font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",color:"#111111",opacity:1,size:"8px"}},markerSettings:{visible:!1,fill:null,width:2,opacity:1,border:{color:"white",width:1}},background:"transparent",size:{height:"",width:""},axisLineSettings:{visible:!1,color:"#111111",width:1,dashArray:""},theme:i.flatlight,load:null,loaded:null,sparklineMouseMove:null,sparklineMouseLeave:null,seriesRendering:null,pointRegionMouseMove:null,pointRegionMouseClick:null,tooltipInitialize:null};this.dataTypes={dataSource:"data",palette:"array",type:"enum",theme:"enum"};this.model=null;this.svgLink="http://www.w3.org/2000/svg";this._id=null;this.negativePointIndexes=[];this.validTags=["div"];this._id=u;!f||(this.model=n.compareExtend({},f,this.defaults))}return __extends(u,r),u.prototype.isTouch=function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},u.prototype.browserInfo=function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},u.prototype.fadeOut=function(n){var t=1,i=setInterval(function(){t<=.1&&(clearInterval(i),n.parentNode?n.parentNode.removeChild(n):n);n.style.opacity=t;n.style.filter="alpha(opacity="+t*100+")";t-=t*.1},50)},u.prototype._setModel=function(t){var i;for(i in t)switch(i){default:n.deepExtend(!0,this.model,{},t[i])}this.redraw()},u.prototype.unBindEvents=function(){var t=document.getElementById(this.rootId),n="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove",f;n=e+" "+o;n=n.split(" ");for(f in n)t.removeEventListener(n[f],this.sparkMouseMove);t.removeEventListener("mouseout",this.sparkMouseLeave)},u.prototype.bindEvents=function(n){var f;this.sparkMouseMove=this.sparkMouseMove.bind(this);this.sparkMouseLeave=this.sparkMouseLeave.bind(this);var t="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove";t=e+" "+o;t=t.split(" ");for(f in t)n.addEventListener(t[f],this.sparkMouseMove);n.addEventListener("mouseout",this.sparkMouseLeave)},u.prototype.sparkMouseMove=function(n){var ci=this.isTouch(n),rt,si,di,kt,hi,ti,ii,et;if(!(ci&&n.type.toString().toLowerCase().indexOf("move")>-1)){var t=this.model,ot=this,ri=t.locale,li=ri&&t.enableGroupSeparator,ai,vi,ui=this.visiblePoints,yi=this.container.id+"_markerExplode",st,g,h,nt,l,y,lt=t.enableCanvasRendering?0:3,at="",s,u,p,w,b,vt=parseInt(t.size.height),tt=parseInt(t.size.width),e=t.tooltip.font,yt="#point.x#",pt="#point.y#",a=this.container.id+"_tooltip",gi=document.getElementById(a),pi,k=t.tooltip.border.color,wt=document.getElementById(this.container.id),fr=wt.clientHeight,nr=wt.parentNode,it=wt.getClientRects()[0],ht=it.top,ct=it.left,fi=n.clientX||(n.changedTouches?n.changedTouches[0].clientX:n.touches?n.touches[0].clientX:0),wi=n.clientY||(n.changedTouches?n.changedTouches[0].clientY:n.touches?n.touches[0].clientY:0),ei=ui.map(function(n){return n.location.X+it.left}),er=ui.map(function(n){return n.location.markerPos+it.top}),i=Infinity,oi=this.measureText,bi,o=this.model.markerSettings,bt,d,v,ki,r,f,tr=document.getElementById(this.container.id+"_canvasTracker");for(rt=0,di=ei.length;rt<di;rt++)si=Math.abs(fi-ei[rt]),i>si&&(i=si,bt=ei[rt],this.pointIndex=rt);if(fi>ct&&fi<ct+it.width&&wi>ht&&wi<ht+it.height)if(i=ui[this.pointIndex].location,kt=function(n){bi=n.length/2;var o=oi(n,e);s=o.height+4;u=o.width+bi;r=i.X;f=i.markerPos;f-s/2<0?f+=s/2:f+s/2>vt&&(f-=s/2);r+u+u/10>tt-t.padding?(r=i.X-Number(t.markerSettings.width)-Number(t.markerSettings.border.width)-4,at="M "+r+" "+i.markerPos+" L "+(r-u/10)+" "+(f-4)+" L "+(r-u/10)+" "+(f-s/2)+" L "+(r-u-u/10)+" "+(f-s/2)+" L "+(r-u-u/10)+" "+(f+s/2)+" L "+(r-u/10)+" "+(f+s/2)+" L "+(r-u/10)+" "+(f+4)+" Z"):(r=i.X+Number(t.markerSettings.width)+Number(t.markerSettings.border.width)+4,at="M "+r+" "+i.markerPos+" L "+(r+u/10)+" "+(f-4)+" L "+(r+u/10)+" "+(f-s/2)+" L "+(r+u+u/10)+" "+(f-s/2)+" L "+(r+u+u/10)+" "+(f+s/2)+" L "+(r+u/10)+" "+(f+s/2)+" L "+(r+u/10)+" "+(f+4)+" Z")},(t.tooltip.template==null||t.tooltip.template=="")&&(ai=li&&i.Xval?i.Xval.toLocaleString(ri):i.Xval,vi=li&&i.Yval?i.Yval.toLocaleString(ri):i.Yval,h=" X : "+ai+" Y : "+vi+" ",kt(h)),st=this.pointIndex,this.prevMousePos==undefined&&(this.prevMousePos=bt),hi=function(n){var i=ot.highPointIndex,r=ot.lowPointIndex,u=ot.negativePointIndexes,f=ot.startPointIndex,e=ot.endPointIndex;return n==i?t.highPointColor:n==r?t.lowPointColor:n==f&&t.startPointColor!=null?t.startPointColor:n==e&&t.endPointColor!=null?t.endPointColor:u.indexOf(n)>=0&&t.negativePointColor!=null?t.negativePointColor:o.fill?o.fill:t.fill},gi||tr){if(this.prevMousePos!=bt){if(p={data:{pointIndex:st,currentText:h,location:i}},this.model.tooltipInitialize!=null&&this._trigger("tooltipInitialize",p),pi=i.X-t.width/2,h!=p.data.currentText&&(h=p.data.currentText,kt(h)),this.prevMousePos=bt,b=hi(st),nt={id:yi,cx:i.X,cy:i.markerPos,r:Number(o.width),fill:o.border.color,stroke:b,"stroke-width":Number(o.border.width)},t.tooltip.template==null||t.tooltip.template=="")l={id:a,fill:t.tooltip.fill,stroke:k!=null?k:b,"stroke-width":t.tooltip.border.width,d:at},y={x:i.X+u+u/10>tt-t.padding?r+lt-u-u/10:r+lt+u/10,y:f+s/4,fill:e.color,"font-size":e.size,"font-family":e.fontFamily,"font-weight":e.fontWeight,"font-style":e.fontStyle};else{var dt=document.getElementById(t.tooltip.template),ut=dt.innerHTML,ut=ut.replace(yt," "+i.Xval+" "),ut=ut.replace(pt," "+i.Yval+" "),ft=dt.innerText,gt=Number(t.markerSettings.width),ft=ft.replace(yt," "+i.Xval+" "),ft=ft.replace(pt," "+i.Yval+" "),c=oi(ft,e),ni=i.X+Number(o.width)+Number(o.border.width)+gt;f=ht+i.markerPos-c.height/2;r=ct+ni;i.markerPos-c.height/2<t.padding?f+=c.height/2:i.markerPos+c.height/2>vt-t.padding&&(f-=c.height/2);ni+c.width>tt-t.padding&&(r=r-c.width-(Number(o.width)+Number(o.border.width)+gt)*2);l={background:t.tooltip.fill,border:t.tooltip.border.width+"px solid "+(k!=null?k:b),left:r+"px",top:f+"px"};w=document.getElementById(a);w.innerHTML=ut;this.setStyles(l,w)}t.enableCanvasRendering?(d=document.getElementById(this.container.id+"_canvasTracker"),v=d.getContext("2d"),v.clearRect(0,0,tt,vt),this.canvasDrawCircle(nt,v),(t.tooltip.template==null||t.tooltip.template=="")&&(this.canvasDrawPath(l,v),y.font=e.size+" "+e.fontFamily,this.canvasDrawText(y,h,v))):(ti=document.getElementById(a+"_g"),this.drawCircle(nt,ti),t.tooltip.template==null&&(this.drawPath(l,ti),g=wt.getElementsByTagName("text")[0],g.textContent=h,this.setAttributes(y,g),ti.appendChild(g)))}}else{if(p={data:{pointIndex:st,currentText:h,location:i}},this.model.tooltipInitialize!=null&&this._trigger("tooltipInitialize",p),pi=i.X-t.width/2,h!=p.data.currentText&&(h=p.data.currentText,kt(h)),ii=document.getElementsByClassName("ej-sparkline-tooltip"),ii[0]&&ii[0].parentNode.removeChild(ii[0]),b=hi(st),nt={id:yi,cx:i.X,cy:i.markerPos,r:Number(o.width),fill:o.border.color,stroke:b,"stroke-width":Number(o.border.width)},t.tooltip.template==null||t.tooltip.template=="")l={id:a,fill:t.tooltip.fill,stroke:k!=null?k:b,"stroke-width":t.tooltip.border.width,d:at},y={x:i.X+u+u/10>tt-t.padding?r+lt-u-u/10:r+lt+u/10,y:f+s/4,fill:e.color,opacity:e.opacity,"font-size":e.size,"font-family":e.fontFamily,"font-weight":e.fontWeight,"font-style":e.fontStyle};else{var dt=document.getElementById(t.tooltip.template),ut=dt.innerHTML,ut=ut.replace(yt," "+i.Xval+" "),ut=ut.replace(pt," "+i.Yval+" "),ft=dt.innerText,gt=Number(t.markerSettings.width),ft=ft.replace(yt," "+i.Xval+" "),ft=ft.replace(pt," "+i.Yval+" "),c=oi(ft,e),ni=i.X+Number(o.width)+Number(o.border.width)+gt;f=ht+i.markerPos-c.height/2;r=ct+ni;i.markerPos-c.height/2<t.padding?f+=c.height/2:i.markerPos+c.height/2>vt-t.padding&&(f-=c.height/2);ni+c.width>tt-t.padding&&(r=r-c.width-(Number(o.width)+Number(o.border.width)+gt)*2);l={background:t.tooltip.fill,border:t.tooltip.border.width+"px solid "+(k!=null?k:b),left:r+"px",top:f+"px",position:"fixed",height:"auto",width:"auto",display:"block",opacity:e.opacity,font:e.size+" "+e.fontFamily};w=document.createElement("div");this.setAttributes({id:a,"class":"ej-sparkline-tooltip"},w);this.setStyles(l,w);w.innerHTML=ut;nr.appendChild(w)}t.enableCanvasRendering?(d=document.createElement("canvas"),ki={id:this.container.id+"_canvasTracker",fill:"transparent","class":"ej-sparkline-tooltip",height:t.size.height,width:t.size.width},this.setAttributes(ki,d),this.setStyles({left:ct+"px",top:ht+"px",position:"fixed"},d),v=d.getContext("2d"),this.canvasDrawCircle(nt,v),(t.tooltip.template==null||t.tooltip.template=="")&&(this.canvasDrawPath(l,v),y.font=e.size+" "+e.fontFamily,this.canvasDrawText(y,h,v)),this.container.parentNode.appendChild(d)):(et=document.createElementNS(this.svgLink,"g"),this.setAttributes({id:a+"_g","class":"ej-sparkline-tooltip"},et),this.container.appendChild(et),this.drawCircle(nt,et),t.tooltip.template==null&&(this.drawPath(l,et),g=this.createText(y,h),et.appendChild(g)))}if(ci){var ir=t.tooltip.template==null||t.tooltip.template==""?t.enableCanvasRendering?this.container.id+"_canvasTracker":a+"_g":a,rr=document.getElementById(ir),ur=this;setTimeout(function(){ur.fadeOut(rr)},1e3)}}},u.prototype.sparkMouseLeave=function(n){var f=n.clientX||(n.touches[0]?n.touches[0].clientX:n.changedTouches[0].clientX),e=n.clientY||(n.touches[0]?n.touches[0].clientY:n.changedTouches[0].clientY),o=this.container,v=o.clientHeight,r=o.getClientRects()[0],s=r.top,h=r.left,c=this.model,l=this.container.id+"_tooltip",t,a,u,i;(f<h||f>h+r.width||e<s||e>s+r.height||this.touchEnd)&&(c.tooltip.template!=null&&c.tooltip.template!=""&&(t=document.getElementById(l),t?t.parentNode.removeChild(t):t),this.model.enableCanvasRendering?(i=document.getElementById(this.container.id+"_canvasTracker"),i?i.parentNode.removeChild(i):i):(a=l+"_g",u=document.getElementById(a),u?this.container.removeChild(u):u))},u.prototype.bindPieEvents=function(n){var f;this.pieTooltip=this.pieTooltip.bind(this);this.pieTooltipHide=this.pieTooltipHide.bind(this);var t="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove";t=e+" "+o;t=t.split(" ");for(f in t)n.addEventListener(t[f],this.pieTooltip);n.addEventListener("mouseout",this.pieTooltipHide);this.model.pointRegionMouseClick!=null&&(n.addEventListener("click",this.pieTooltip),n.addEventListener("touchstart",this.pieTooltip))},u.prototype.unbindPieEvents=function(){var n="",t=this.browserInfo(),i=t.isMSPointerEnabled,r=t.pointerEnabled,e=i?r?"pointerup":"MSPointerUp":"touchend mouseup",o=i?r?"pointermove":"MSPointerMove":"touchmove mousemove",u=document.getElementById(this.rootId),f;n=e+" "+o;n=n.split(" ");for(f in n)u.removeEventListener(n[f],this.pieTooltip);u.removeEventListener("mouseout",this.pieTooltipHide)},u.prototype.pieTooltip=function(n){var y=this.isTouch(n),e,ot,i,s,st,ht;if(y&&n.stopImmediatePropagation(),!(y&&n.type.toString().toLowerCase().indexOf("move")>-1)){this.model.sparklineMouseMove!=null&&this._trigger("sparklineMouseMove");var t=this.model,h=n.clientX||(n.changedTouches?n.changedTouches[0].clientX:n.touches?n.touches[0].clientX:0),yt=parseInt(t.size.height),pt=parseInt(t.size.width),u=t.tooltip.font,c=n.clientY||(n.changedTouches?n.changedTouches[0].clientY:n.touches?n.touches[0].clientY:0),d=document.getElementById(this.container.id),wt=d.parentNode,g=d.getClientRects()[0],ct=g.top,lt=g.left,bt=this.visiblePoints.map(function(n){return n.coordinates}),nt=this.visiblePoints.map(function(n){return n.location}),at=this.visiblePoints.radius,tt=this.visiblePoints.centerPos,p=this.visiblePoints,it,rt,f,w=h-(tt.X+lt),b=c-(tt.Y+ct),o=Math.atan2(b,w),ut=this.container.id+"_pieTooltip",r=document.getElementById(ut),l,a=t.tooltip.border.color,vt=Math.sqrt(w*w+b*b),k=t.pointRegionMouseClick!=null?"pointRegionMouseClick":t.pointRegionMouseMove!=null?"pointRegionMouseMove":null,v=t.palette,ft=t.locale,et=t.enableGroupSeparator;if(Math.abs(vt)<=at)for(e=0,ot=p.length;e<ot;e++)it=p[e].stAng,rt=p[e].endAng,o=o<0?6.283+o:o,o<=rt&&o>=it&&(f=e,(k=="pointRegionMouseClick"&&(n.type=="click"||n.type=="touchstart")||k=="pointRegionMouseMove")&&this._trigger(k,{data:{pointIndex:e,seriesType:"Pie",locationX:h,locationY:c}}));else r&&r.parentNode.removeChild(r);r&&f!=null?(i=nt[f].Percent.toFixed(2),i=et?" "+parseFloat(i).toLocaleString(ft):i+" % ",s=this.measureText(i,u),l={left:h+12+"px",top:c+"px",border:t.tooltip.border.width+"px solid "+(a!=null?a:v[f%v.length]),"background-color":t.tooltip.fill,height:s.height+"px",width:s.width+"px"},this.setStyles(l,r),r.innerHTML=i):f!=null&&(r=document.createElement("div"),i=nt[f].Percent.toFixed(2),i=et?" "+parseFloat(i).toLocaleString(ft):i+" % ",s=this.measureText(i,u),l={left:h+12+"px",top:c+"px","background-color":t.tooltip.fill,color:u.color,border:t.tooltip.border.width+"px solid "+(a!=null?a:v[f%v.length]),height:s.height+"px",width:s.width+"px","font-size":u.size,opacity:u.opacity,"font-weight":u.fontWeight,"font-family":u.fontFamily,"font-style":u.fontStyle,"z-index":"100000",position:"fixed"},r.setAttribute("id",ut),this.setStyles(l,r),r.innerHTML=i,document.body.appendChild(r));y&&(this.touchEnd=!0,st=document.getElementById(this.container.id+"_pieTooltip"),ht=this,setTimeout(function(){ht.fadeOut(st)},500))}},u.prototype.pieTooltipHide=function(){if(!this.touchEnd){this.model.sparklineMouseLeave!=null&&this._trigger("sparklineMouseLeave");var t=this.container.id+"_pieTooltip",n=document.getElementById(t);n?document.body.removeChild(n):n}},u.prototype.bindRegionEvents=function(n){this.sparklineEvent=this.sparklineEvent.bind(this);var t=this.findBrowser();(t=="IE"||t=="firefox")&&(n.style["touch-action"]="none");this.model.pointRegionMouseMove!=null&&(n.addEventListener("mousemove",this.sparklineEvent,!0),n.addEventListener("touchmove",this.sparklineEvent,!0));this.model.pointRegionMouseClick!=null&&(n.addEventListener("click",this.sparklineEvent,!0),n.addEventListener("touchstart",this.sparklineEvent,!0));this.model.sparklineMouseMove!=null&&(n.addEventListener("mousemove",this.sparklineEvent,!0),n.addEventListener("touchmove",this.sparklineEvent,!0));this.model.sparklineMouseLeave!=null&&(this.sparklineLeave=this.sparklineLeave.bind(this),n.addEventListener("mouseout",this.sparklineLeave,!0),t=="firefox"&&n.addEventListener("mouseup",this.sparklineLeave,!0),n.addEventListener("touchend",this.sparklineLeave,!0))},u.prototype.sparklineLeave=function(){this.model.sparklineMouseLeave!=null&&this._trigger("sparklineMouseLeave")},u.prototype.sparklineEvent=function(n){var i,p;this.model.sparklineMouseMove!=null&&this._trigger("sparklineMouseMove");var s=this.model,l=n.clientX||n.touches[0].clientX,a=n.clientY||n.touches[0].clientY,u=s.type,r=this.visiblePoints,f,e,v,y,o,h,w=document.getElementById(this.container.id),g=w.parentNode,b=w.getClientRects()[0],k=b.top,d=b.left,c;if(c=s.pointRegionMouseClick!=null?"pointRegionMouseClick":s.pointRegionMouseMove!=null?"pointRegionMouseMove":null,u==t.Line||u==t.Area)for(o=2*(s.markerSettings.width+s.markerSettings.border.width),h=o,i=0,p=r.length;i<p;i++)f=d+r[i].location.X-o/2,e=k+r[i].location.Y-h/2,v=f+o,y=e+h,l>=f&&l<=v&&a>=e&&a<=y&&c!=null&&this._trigger(c,{data:{pointIndex:i,seriesType:u,locationX:r[i].location.X,locationY:r[i].location.Y}});else if(u==t.Column||u==t.WinLoss)for(o=r[0].location.width,i=0,p=r.length;i<p;i++)h=r[i].location.height,f=d+r[i].location.X,e=k+r[i].location.Y,v=f+o,y=e+h,l>=f&&l<=v&&a>=e&&a<=y&&c!=null&&this._trigger(c,{data:{pointIndex:i,seriesType:u,locationX:r[i].location.X,locationY:r[i].location.Y}})},u.prototype.findBrowser=function(){return navigator.userAgent.indexOf("Firefox")!=-1?"firefox":navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0?"IE":null},u.prototype.resize=function(){var t=this,n=document.getElementById(this.rootId);n!=null||n!=undefined?(window.removeEventListener("resize",this.resize),this._destroy(),this.createSvg(),this.renderSparkline()):window.removeEventListener("resize",this.resize)},u.prototype.supportsSvg=function(){return!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg")},u.prototype._init=function(){this.supportsSvg()&&(this.rootId=this.rootId!=null?this.rootId:this._id,this.parentElement=this.parentElement!=null?this.parentElement:document.getElementById(this.rootId),this.model.load!=null&&this._trigger("load"),this.setTheme(this.model),this.height=parseInt(this.model.size.height),this.width=parseInt(this.model.size.width),this.createSvg(),this.renderSparkline(),this.model.loaded!=null&&this._trigger("loaded"))},u.prototype.redraw=function(){this.emptyContainer();this.renderSparkline()},u.prototype.touchCheck=function(n){this.touchEnd=!0;this.model.type.toString().toLocaleLowerCase()!="pie"?this.sparkMouseLeave(n):this.pieTooltipHide(n)},u.prototype.emptyContainer=function(){var t=this.model,n;if(t.enableCanvasRendering)this.ctx.clearRect(0,0,this.height,this.width);else for(n=this.container;n.firstChild;)n.removeChild(n.firstChild)},u.prototype._destroy=function(){var n=document.getElementById(this.container.id);n!=null?(this.unBindEvents(),this.unbindPieEvents(),window.removeEventListener("resize",this.resize),n.parentNode.removeChild(n)):window.removeEventListener("resize",this.resize)},u.prototype.renderSparkline=function(){this.setStyles({background:this.model.background},this.container);this.calculatePoints();this.seriesRender();this.resize=this.resize.bind(this);this.model.isResponsive?window.addEventListener("resize",this.resize):window.removeEventListener("resize",this.resize);this.model.type!=t.WinLoss&&this.model.type!=t.Pie&&this.model.tooltip.visible?this.bindEvents(this.parentElement):this.unBindEvents();this.model.type==t.Pie&&this.model.tooltip.visible?this.bindPieEvents(this.parentElement):this.unbindPieEvents();this.bindRegionEvents(this.parentElement)},u.prototype.animateSparkline=function(){function ht(){n<=a?r.setAttribute("width",n.toString()):(clearInterval(it),h._trigger("animationComplete"));n=n+i}function ct(){f=u-n;n>=0?(r.setAttribute("y",n.toString()),r.setAttribute("height",f)):(clearInterval(ut),h._trigger("animationComplete"));n=n-i}function lt(){n<=u?r.setAttribute("height",n.toString()):(clearInterval(rt),h._trigger("animationComplete"));n=n+i}function at(){f=(l-n)*2;n>=-i?(r.setAttribute("y",n<0?0:n.toString()),r.setAttribute("height",f)):(clearInterval(ft),h._trigger("animationComplete"));n=n-i}function vt(){n<=v.length-1?(d=90,et=v[n].location.Degree,ot+=et+(n==0?d:0),b=(d-90)*Math.PI/180,p=(ot-90)*Math.PI/180,n==v.length-1&&(p-=.0001),f={sX:o.X+s*Math.cos(b),sY:o.Y+s*Math.sin(b),eX:o.X+s*Math.cos(p),eY:o.Y+s*Math.sin(p)},k="M "+o.X+" "+o.Y+" L "+f.eX+" "+f.eY+" A "+s+" "+s+" 0 1,0 "+f.sX+" "+f.sY+" Z",r.setAttribute("d",k)):(clearInterval(st),h._trigger("animationComplete"));n+=1}var y=this.model,h=this,c=y.type,g=y.padding,l=this.axisHeight,a=parseInt(y.size.width),u=parseInt(y.size.height),n,f,i,nt=document.createElementNS(this.svgLink,"defs"),w=document.createElementNS(this.svgLink,"clipPath"),e,tt,r,it,rt,ut,ft,st;if(r=c==t.Pie?document.createElementNS(this.svgLink,"path"):document.createElementNS(this.svgLink,"rect"),c==t.Line||c==t.Area)e={id:"clipRectSparkline",x:0,y:0,width:0,height:u},i=a/10,it=setInterval(ht,120),n=i;else if(c==t.Column||c==t.WinLoss)l==g?(e={id:"clipRectSparkline",x:0,y:0,width:a,height:0},i=u/10,n=i,rt=setInterval(lt,120)):l==u-g?(e={id:"clipRectSparkline",x:0,y:u,width:a,height:0},i=u/10,n=u,ut=setInterval(ct,120)):(e={id:"clipRectSparkline",x:0,y:l,width:a,height:0},i=u/10,n=l,ft=setInterval(at,120));else{var v=this.visiblePoints,o=v.centerPos,s=v.radius,et,b,p,k="",d=90,ot=0;n=0;e={id:"clipRectSparkline",d:k};st=setInterval(vt,120)}tt={id:this.container.id+"_sparklineRect"};this.setAttributes(e,r);this.setAttributes(tt,w);w.appendChild(r);nt.appendChild(w);this.container.appendChild(nt)},u.prototype.setTheme=function(n){var r=n.theme,t=this.defaults;r==i.flatdark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#B5B5B5":n.fill,n.stroke=n.stroke==t.stroke?"#F6D321":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#AAAAAA":n.axisLineSettings.color):r==i.gradientlight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#F34649":n.fill,n.stroke=n.stroke==t.stroke?"#597B15":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#8E8E8E":n.axisLineSettings.color):r==i.gradientdark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#005378":n.fill,n.stroke=n.stroke==t.stroke?"#6A9319":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#AAAAAA":n.axisLineSettings.color):r==i.azuredark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#007fff":n.fill,n.stroke=n.stroke==t.stroke?"#f0ffff":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#336699":n.axisLineSettings.color):r==i.azurelight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#336699":n.fill,n.stroke=n.stroke==t.stroke?"#007fff":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#336699":n.axisLineSettings.color):r==i.limedark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#238f23":n.fill,n.stroke=n.stroke==t.stroke?"#32CD32":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#43da21":n.axisLineSettings.color):r==i.limelight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#238f23":n.fill,n.stroke=n.stroke==t.stroke?"#32CD32":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#43da21":n.axisLineSettings.color):r==i.saffrondark?(n.background=n.background==t.background?"#111111":n.background,n.fill=n.fill==t.fill?"#ffaa33":n.fill,n.stroke=n.stroke==t.stroke?"#ffdba9":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#ffc26e":n.axisLineSettings.color):r==i.saffronlight?(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#ffaa33":n.fill,n.stroke=n.stroke==t.stroke?"#ffdba9":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#ffc26e":n.axisLineSettings.color):(r==null||r==i.flatlight)&&(n.background=n.background==t.background?"transparent":n.background,n.fill=n.fill==t.fill?"#33ccff":n.fill,n.stroke=n.stroke==t.stroke?"#33ccff":n.stroke,n.axisLineSettings.color=n.axisLineSettings.color==t.axisLineSettings.color?"#FF0000":n.axisLineSettings.color)},u.prototype.createSvg=function(){var r=this.model,n=this.parentElement,u,f=parseInt(n.style.height)>n.clientHeight?parseInt(n.style.height):n.clientHeight,e=parseInt(n.style.width)>n.clientWidth?parseInt(n.style.width):n.clientWidth,t=parseInt(r.size.width),i=parseInt(r.size.height);i=i>0?i:f>0?f:30;t=t>0?t:e>0?e:50;r.size.height=i.toString();r.size.width=t.toString();this.height=i;this.width=t;u={id:this.rootId+"_sparkline_svg",width:t,height:i};r.enableCanvasRendering?(this.container=document.createElement("canvas"),this.ctx=this.container.getContext("2d")):this.container=document.createElementNS(this.svgLink,"svg");this.setAttributes(u,this.container);n.appendChild(this.container)},u.prototype.setStyles=function(n,t){for(var r=Object.keys(n),u,f=r.map(function(t){return n[t]}),i=0,e=r.length;i<e;i++)u=r[i],t.style[u]=f[i]},u.prototype.setAttributes=function(n,t){for(var r=Object.keys(n),u=r.map(function(t){return n[t]}),i=0,f=r.length;i<f;i++)t.setAttribute(r[i],u[i])},u.prototype.getDefaultPoints=function(n){for(var t=[],i=1;i<=n;i++)Math.random()*10>5&&t.push(-Math.round(Math.random()*100)),t.push(Math.round(Math.random()*100));return t},u.prototype.calculatePoints=function(){var n=this.model,l=n.type,r=n.dataSource!=null?n.dataSource:this.getDefaultPoints(12),e,y,s,w,k,ft=[],h=r.length,o,d=0,a,et,c,i,ut,ot;if(Array.isArray(r)&&typeof r[0]!="object")if(n.type==t.Pie)for(i=0;i<h;i++)d+=Math.abs(r[i]);else y=Math.max.apply(null,r),s=Math.min.apply(null,r),w=0,k=h-1;else if(n.type==t.Pie)for(i=0;i<h;i++)d+=Math.abs(r[i][n.yName]);else r[0][n.xName]?(o=r,o=o.sort(function(t,i){return t[n.yName]-i[n.yName]}),y=o[o.length-1][n.yName],s=o[0][n.yName]):(a=r.map(function(t){return t[n.yName]}),y=Math.max.apply(null,a),s=Math.min.apply(null,a)),r[0][n.xName]?(o=o.sort(function(t,i){return t[n.xName]-i[n.xName]}),k=o[o.length-1][n.xName],w=o[0][n.xName]):(w=0,k=h-1);if(n.type!=t.Pie){this.maxLength=h;var c,b=Number(n.padding),u=parseInt(n.size.height)-b*2,tt=parseInt(n.size.width)-b*2,g=k-w,p=y-s,g=g==0?1:g;p=p==0?1:p;this.min=s;this.unitX=g;this.minX=w;this.unitY=p;this.max=y;this.maxX=k;var it=0,v=u-u/p*-s,f,v=s<0&&y<0?0:s<0&&y>0?v:u;this.axisHeight=v+b;l!=t.WinLoss&&n.axisLineSettings.visible&&this.drawAxis()}for(i=0;i<h;i++){if(r[i][n.xName]||r[i][n.yName]?r[i][n.xName]?(a=r[i][n.xName],e=r[i][n.yName]):(a=i,e=r[i][n.yName]):(a=i,e=r[i]),l==t.Line||l==t.Area)f=h!=1?u-Math.round(u*((e-s)/p)):0,c={X:h!=1?Math.round(tt*((a-w)/g)):tt/2,Y:f,markerPos:f};else if(l==t.Column||l==t.WinLoss){var nt=tt/h,rt=.5*2;nt-=rt;it=i*(nt+rt)+rt/2;l==t.WinLoss?(ut=.5,ot=40,f=e>0?u/4:e<0?u*ut:u*ut-u/ot,c={X:it,Y:f,height:e!=0?u/4:u/20,width:nt}):(f=h!=1?u-u/p*(e-s):0,c={X:it,Y:f>v?v:f,height:Math.abs(f-v),width:nt,markerPos:f>v?v+Math.abs(f-v):f})}else l==t.Pie&&(et=Math.abs(e)/d*100,c={Percent:et,Degree:Math.abs(e)/d*360});l!=t.Pie&&(c.X+=b,c.Y+=b);l!=t.WinLoss&&(c.markerPos+=b);c.Xval=a;c.Yval=e;ft.push({location:c})}this.visiblePoints=ft},u.prototype.seriesRender=function(){var i=this.model,r=this.visiblePoints,f=r.length,u,n=i.type;u={data:{minX:this.minX,minY:this.min,maxX:this.maxX,maxY:this.max,xName:i.xName,yName:i.yName,pointsCount:f,seriesType:n,visiblePoints:this.visiblePoints}};this.model.seriesRendering!=null&&this._trigger("seriesRendering",u);n==t.Line?this.drawLineSeries(r):n==t.Area?this.drawAreaSeries(r):n==t.Column?this.drawColumnSeries(r):n==t.WinLoss?this.drawWinlossSeries(r):n==t.Pie&&this.drawPieSeries();i.markerSettings.visible&&n!=t.WinLoss&&n!=t.Pie&&this.drawMarker(r);i.rangeBandSettings.startRange!=null&&i.rangeBandSettings.endRange!=null&&n!=t.WinLoss&&n!=t.Pie&&this.drawRangeBand()},u.prototype.drawPieSeries=function(){var n=this.model,r=this.visiblePoints,i,c,b,y;n.padding=n.padding==this.defaults.padding?2:n.padding;var nt=r.length,l=parseInt(n.size.height)-n.padding*2,a=parseInt(n.size.width)-n.padding*2,u=l<=a?l/2:a/2,f,e,t={X:a/2,Y:l/2},o,p,v,w=n.palette,s=0,k=n.border.color,d=n.opacity,g=n.border.width,h;for(r.centerPos=t,r.radius=u,i=0,c=90;i<r.length;i++)c+=s,s=r[i].location.Degree,b=c+s,f=(c-90)*Math.PI/180,e=(b-90)*Math.PI/180,r[i].stAng=f,r[i].endAng=e,y=s<180?"0":"1",o=r[i].coordinates={sX:t.X+u*Math.cos(f),sY:t.Y+u*Math.sin(f),eX:t.X+u*Math.cos(e),eY:t.Y+u*Math.sin(e)},p="M "+t.X+" "+t.Y+" L "+o.eX+" "+o.eY+" A "+u+" "+u+" 0 "+y+",0 "+o.sX+" "+o.sY+" Z",v={id:this.container.id+"_pieBase"+i,fill:w[i%w.length],stroke:k,opacity:d,"stroke-width":g,d:p,start:e,end:f,x:t.X,y:t.Y,counterClockWise:y,radius:u},n.enableCanvasRendering?this.canvasDrawPath(v):(h=this.createGroup({id:"sparkpieSeries"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},h),this.container.appendChild(h),this.drawPath(v,h))},u.prototype.drawRangeBand=function(){var n=this.model,t=parseInt(n.size.height)-n.padding*2,f=parseInt(n.size.width)-n.padding*2,o=n.rangeBandSettings.startRange,s=n.rangeBandSettings.endRange,i=Number(t-t/this.unitY*(o-this.min))+n.padding,r=Number(t-t/this.unitY*(s-this.min))+n.padding,u,e;r=r>Number(t+n.padding)?Number(t+n.padding):r<0+n.padding?0+n.padding:r;i=i>Number(t+n.padding)?Number(t+n.padding):i<0+n.padding?0+n.padding:i;e="M "+n.padding+" "+i+" L "+(f+Number(n.padding))+" "+i+" L "+(f+Number(n.padding))+" "+r+" L "+n.padding+" "+r+" Z";u={id:this.container.id+"_rangeBand",fill:n.rangeBandSettings.color,opacity:n.rangeBandSettings.opacity,stroke:"transparent","stroke-width":n.border.width,d:e};n.enableCanvasRendering?this.canvasDrawPath(u):this.drawPath(u)},u.prototype.drawAxis=function(){var n=this.model,r=this.axisHeight,u=n.axisLineSettings.color,f=n.type,i;f!=t.WinLoss&&f!=t.Pie&&(n.axisLineSettings.visible||(u="transparent"),i={id:this.container.id+"_Sparkline_XAxis",x1:0+n.padding,y1:r,x2:parseInt(n.size.width)-n.padding,y2:r,stroke:u,"stroke-dasharray":n.axisLineSettings.dashArray,"stroke-width":n.axisLineSettings.width},n.enableCanvasRendering?this.canvasDrawLine(i):this.drawLine(i))},u.prototype.drawColumnSeries=function(t){var f,u,r=this.model,c=t.length,w=n.compareExtend({},[],t),b=r.border.width,l,k=r.opacity,a,d=r.fill,g=r.border.color,o=r.highPointColor,s=r.lowPointColor,v=r.startPointColor,y=r.endPointColor,p=r.negativePointColor,e,h,i;for((o||s)&&(h=w.map(function(n){return n.location.markerPos}),a=Math.min.apply(null,h),l=Math.max.apply(null,h)),r.enableCanvasRendering==!1&&(e=this.createGroup({id:this.container.id+"sparkcolumnSeries"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},e),this.container.appendChild(e)),i=0;i<c;i++)u=t[i].location,f={id:this.container.id+"_column_series_"+i,x:u.X,y:u.Y,height:u.height,width:u.width,fill:d,stroke:g,opacity:k,"stroke-width":b},u.markerPos==a&&o?(f.fill=o,this.highPointIndex=i):u.markerPos==l&&s?(f.fill=s,this.lowPointIndex=i):i==0&&v?(f.fill=v,this.startPointIndex=i):i==c-1&&y?(f.fill=y,this.endPointIndex=i):u.markerPos>=this.axisHeight&&p&&(f.fill=p,this.negativePointIndexes.push(i)),r.enableCanvasRendering?this.canvasDrawRectangle(f):this.drawRect(f,e),u.X+=u.width/2},u.prototype.drawWinlossSeries=function(n){var f,i,t=this.model,s=t.border.width,e=t.padding,h=t.border.color,c=t.opacity,l=n.length,o=parseInt(t.size.height)-e*2,u,r;for(t.enableCanvasRendering==!1&&(u=this.createGroup({id:this.container.id+"sparkwinlossSeries"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},u),this.container.appendChild(u)),r=0;r<l;r++)i=n[r].location,f={id:this.container.id+"_winloss_series_"+r,x:i.X,y:i.Y,height:i.height,width:i.width,fill:i.Y<o/2+e?i.Y>o/4+e?"#EE82EE":t.fill:t.negativePointColor?t.negativePointColor:"#FF0000",stroke:h,opacity:c,"stroke-width":s},t.enableCanvasRendering?this.canvasDrawRectangle(f):this.drawRect(f,u)},u.prototype.drawAreaSeries=function(n){for(var r="",e=this.axisHeight,t=this.model,f,u,i=0,o=n.length;i<o;i++)i==0&&(r="M "+n[0].location.X+" "+e+" "),r+="L "+n[i].location.X+" "+n[i].location.Y+" ",i==o-1&&(r+="L "+n[i].location.X+" "+e+" Z");f={id:this.container.id+"_area_series_fill",fill:t.fill,stroke:t.stroke?t.stroke:t.fill,"fill-opacity":t.opacity,"stroke-width":t.width,d:r};t.enableCanvasRendering?this.canvasDrawPath(f):(u=this.createGroup({id:"sparkAreaSeries"}),this.container.appendChild(u),this.drawPath(f,u),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},u))},u.prototype.drawLineSeries=function(n){for(var f,u="",t=this.model,r,i=0,e=n.length;i<e;i++)i==0&&(u="M "+n[0].location.X+" "+n[i].location.Y+" "),u+="L "+n[i].location.X+" "+n[i].location.Y+" ";f={id:this.container.id+"_Line_series",fill:"transparent",stroke:t.stroke?t.stroke:t.fill,opacity:t.opacity,"stroke-width":t.width,d:u};t.enableCanvasRendering?this.canvasDrawPath(f):(r=this.createGroup({id:"sparklineSeries"}),this.container.appendChild(r),this.drawPath(f,r),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},r))},u.prototype.drawMarker=function(i){var a=i.length,f,o=this.model.markerSettings,u=this.model,g=n.compareExtend({},[],i),nt=o.fill?o.fill:u.fill,tt=o.border.color,v=o.width,it=o.opacity,y=o.border.width,e,p,w,h=u.highPointColor,c=u.lowPointColor,b=u.startPointColor,k=u.endPointColor,d=u.negativePointColor,s,l,r,rt;for(u.enableCanvasRendering==!1&&(s=this.createGroup({id:this.container.id+"sparkmarkers"}),this.setStyles({"clip-path":"url(#"+this.container.id+"_sparklineRect)"},s),this.container.appendChild(s)),(o.visible==!1||u.type==t.Pie||u.type==t.WinLoss)&&(v=0,y=0),(h||c)&&(l=g.map(function(n){return n.location.markerPos}),w=Math.min.apply(null,l),p=Math.max.apply(null,l)),r=0;r<a;r++)e=i[r].location,rt=e.width!=undefined?e.width/2:0,f={id:this.container.id+"_marker_"+r,cx:e.X,cy:e.markerPos,r:v,fill:nt,stroke:tt,opacity:it,"stroke-width":y},e.markerPos==w&&h?(f.fill=h,this.highPointIndex=r):e.markerPos==p&&c?(f.fill=c,this.lowPointIndex=r):r==0&&b?(f.fill=b,this.startPointIndex=r):r==a-1&&k?(f.fill=k,this.endPointIndex=r):e.markerPos>=this.axisHeight&&d&&(f.fill=d,this.negativePointIndexes.push(r)),this.model.enableCanvasRendering?this.canvasDrawCircle(f):this.drawCircle(f,s)},u.prototype.drawLine=function(n){var t=document.getElementById(n.id);t||(t=document.createElementNS(this.svgLink,"line"));this.setAttributes(n,t);this.container.appendChild(t)},u.prototype.drawCircle=function(n,t){t=!t?this.container:t;var i=document.getElementById(n.id);i||(i=document.createElementNS(this.svgLink,"circle"));this.setAttributes(n,i);t.appendChild(i)},u.prototype.drawPolyLine=function(n){var t=document.getElementById(n.id);t||(t=document.createElementNS(this.svgLink,"polyline"));this.setAttributes(n,t);this.container.appendChild(t)},u.prototype.drawPath=function(n,t){t=!t?this.container:t;var i=document.getElementById(n.id);i||(i=document.createElementNS(this.svgLink,"path"));this.setAttributes(n,i);t.appendChild(i)},u.prototype.drawRect=function(n,t){t=!t?this.container:t;var i=document.getElementById(n.id);i||(i=document.createElementNS(this.svgLink,"rect"));this.setAttributes(n,i);t.appendChild(i)},u.prototype.createGroup=function(n){var t=document.createElementNS(this.svgLink,"g");return this.setAttributes(n,t),t},u.prototype.createText=function(n,t){var i=document.createElementNS(this.svgLink,"text");return this.setAttributes(n,i),t&&(i.textContent=t),i},u.prototype.canvasDrawLine=function(n,t){var i=t?t:this.ctx;i.save();i.beginPath();i.lineWidth=n["stroke-width"];i.strokeStyle=n.stroke;i.moveTo(n.x1,n.y1);i.lineTo(n.x2,n.y2);i.stroke();i.restore();this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawRectangle=function(n,t){var i=t?t:this.ctx,u=t?t:this.ctx,r;i.save();i.beginPath();i.globalAlpha=n.opacity;i.lineWidth=n["stroke-width"];r=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1;r&&this.ctx.setLineDash(r);i.strokeStyle=n.stroke;i.rect(n.x,n.y,n.width,n.height);n.fill=="none"&&(n.fill="transparent");i.fillStyle=n.fill;i.fillRect(n.x,n.y,n.width,n.height);i.stroke();i.restore();i=u;this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawPath=function(n,t){var c=n.d,u=c.split(" "),h=n["stroke-width"],i=t?t:this.ctx,l=t?t:this.ctx,o,s,r,f,e;for(i.save(),i.beginPath(),i.globalAlpha=n.opacity?n.opacity:n["fill-opacity"],o=!0,i.lineWidth=h,s=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1,s&&i.setLineDash(s),i.strokeStyle=n.stroke,r=0;r<u.length;r=r+3){f=parseFloat(u[r+1]);e=parseFloat(u[r+2]);switch(u[r]){case"M":n.innerR||n.cx||i.moveTo(f,e);break;case"L":n.innerR||i.lineTo(f,e);break;case"C":i.bezierCurveTo(f,e,parseFloat(u[r+3]),parseFloat(u[r+4]),parseFloat(u[r+5]),parseFloat(u[r+6]));r=r+4;break;case"A":n.innerR?o&&(i.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),i.arc(n.x,n.y,n.innerR,n.end,n.start,!n.counterClockWise),o=!1):n.cx?i.arc(n.cx,n.cy,n.radius,0,2*Math.PI,n.counterClockWise):(i.moveTo(n.x,n.y),i.arc(n.x,n.y,n.radius,n.start,n.end,n.counterClockWise),i.lineTo(n.x,n.y));r=r+5;break;case"Z":i.closePath()}}n.fill!="none"&&n.fill!=undefined&&(i.fillStyle=n.fill,i.fill());h>0&&i.stroke();i.restore();i=l;this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawCircle=function(n,t){var i=t?t:this.ctx,u=t?t:this.ctx,r;i.save();i.beginPath();i.arc(n.cx,n.cy,n.r,0,2*Math.PI);i.fillStyle=n.fill;i.globalAlpha=n.opacity;i.fill();i.lineWidth=n["stroke-width"];r=n["stroke-dasharray"]?n["stroke-dasharray"].split(","):!1;r&&i.setLineDash(r);i.strokeStyle=n.stroke;i.stroke();i.restore();i=u;this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawPolyline=function(n,t){var i=t?t:this.ctx,u,r;for(i.save(),i.beginPath(),u=n.points.split(" "),r=0;r<u.length-1;r++){var f=u[r].split(","),e=f[0],o=f[1];r==0?i.moveTo(e,o):i.lineTo(e,o)}i.lineWidth=n["stroke-width"];i.strokeStyle=n.stroke;i.stroke();i.restore();this.dataURL=this.container.toDataURL()},u.prototype.canvasDrawText=function(n,t,i){var e=n.font,u=n["text-anchor"],o=n.opacity!==undefined?n.opacity:1,r,f;u=="middle"&&(u="center");r=i?i:this.ctx;r.save();r.fillStyle=n.fill;r.font=e;r.textAlign=u;r.globalAlpha=o;n.baseline&&(r.textBaseline=n.baseline);f=0;n.labelRotation==90&&n.id.indexOf("XLabel")!=-1&&(f=r.measureText(t).width);r.translate(n.x+f/2,n.y);r.rotate(n.labelRotation*Math.PI/180);r.fillText(t,0,0);r.restore();this.dataURL=this.container.toDataURL()},u.prototype.measureText=function(n,t){var e=document.getElementById("measureTex"),i,u,f,r;e&&e.clientHeight!=0?i=e:(i=document.createElement("text"),i.setAttribute("id","measureTex"),document.body.appendChild(i));var o=null,s=null,h=null,c=null;if(typeof n=="string"&&(n.indexOf("<")>-1||n.indexOf(">")>-1)){for(u=n.split(" "),f=0;f<u.length;f++)u[f].indexOf("<br/>")==-1&&(u[f]=u[f].replace(/[<>]/g,"&"));n=u.join(" ")}return i.innerHTML=n,t!=undefined&&t.size==undefined&&(r=t,r=r.split(" "),o=r[0],s=r[1],h=r[2],c=r[3]),t!=null&&(i.style.fontSize=t.size>0?t.size+"px":t.size?t.size:s,i.style.fontStyle&&(i.style.fontStyle=t.fontStyle?t.fontStyle:o),i.style.fontFamily=t.fontFamily?t.fontFamily:h,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(i.style.fontWeight=t.fontWeight?t.fontWeight:c)),i.style.backgroundColor="white",i.style.position="absolute",i.style.top="-100px",i.style.left="0px",i.style.visibility="hidden",i.style.whiteSpace="nowrap",{width:i.offsetWidth,height:i.offsetHeight}},u}(ej.WidgetBase);n.Sparkline=r;ej.widget("ejSparkline","ej.Sparkline",new r);n.deepExtend=function(t){var u,i,r;for(t=t||{},u=1;u<arguments.length;u++)if(i=arguments[u],i)for(r in i)i.hasOwnProperty(r)&&(t[r]=typeof i[r]=="object"?n.deepExtend(t[r],i[r]):i[r]);return t};n.compareExtend=function(t,i,r){var e,o,u,f;if(typeof r=="object"&&r!==null)for(e=Object.keys(r),o=e.length,f=0;f<o;f++)u=e[f],i.hasOwnProperty(u)&&i[u]!=null?(Array.isArray(i[u])||typeof i[u]=="object"&&i[u]!==null)&&n.compareExtend({},i[u],r[u]):i[u]=r[u];return i}}(ejSparkline||(ejSparkline={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var s,v,h,y,r,e,i,t,l,u,f,p,o,c,w,a;(function(n){n[n.left="left"]="left";n[n.right="right"]="right";n[n.center="center"]="center"})(n.sunburstHorizontalAlignment||(n.sunburstHorizontalAlignment={}));s=n.sunburstHorizontalAlignment,function(n){n[n.circle="circle"]="circle";n[n.diamond="diamond"]="diamond";n[n.cross="cross"]="cross";n[n.pentagon="pentagon"]="pentagon";n[n.rectangle="rectangle"]="rectangle";n[n.triangle="triangle"]="triangle"}(n.sunburstLegendShape||(n.sunburstLegendShape={}));v=n.sunburstLegendShape,function(n){n[n.top="top"]="top";n[n.bottom="bottom"]="bottom";n[n.middle="middle"]="middle"}(n.sunburstVerticalAlignment||(n.sunburstVerticalAlignment={}));h=n.sunburstVerticalAlignment,function(n){n[n.flatlight="flatlight"]="flatlight";n[n.flatdark="flatdark"]="flatdark"}(n.sunburstTheme||(n.sunburstTheme={}));y=n.sunburstTheme,function(n){n[n.opacity="opacity"]="opacity";n[n.color="color"]="color"}(n.sunburstHighlightType||(n.sunburstHighlightType={}));r=n.sunburstHighlightType,function(n){n[n.rotation="rotation"]="rotation";n[n.fadeIn="fadeIn"]="fadeIn"}(n.sunburstAnimationType||(n.sunburstAnimationType={}));e=n.sunburstAnimationType,function(n){n[n.opacity="opacity"]="opacity";n[n.color="color"]="color"}(n.sunburstSelectionType||(n.sunburstSelectionType={}));i=n.sunburstSelectionType,function(n){n[n.top="top"]="top";n[n.bottom="bottom"]="bottom";n[n.left="left"]="left";n[n.right="right"]="right";n[n.float="float"]="float"}(n.sunburstLegendPosition||(n.sunburstLegendPosition={}));t=n.sunburstLegendPosition,function(n){n[n.none="none"]="none";n[n.toggleSegmentVisibility="toggleSegmentVisibility"]="toggleSegmentVisibility";n[n.toggleSegmentSelection="toggleSegmentSelection"]="toggleSegmentSelection"}(n.sunburstLegendClickAction||(n.sunburstLegendClickAction={}));l=n.sunburstLegendClickAction,function(n){n[n.near="near"]="near";n[n.far="far"]="far";n[n.center="center"]="center"}(n.sunburstAlignment||(n.sunburstAlignment={}));u=n.sunburstAlignment,function(n){n[n.point="point"]="point";n[n.all="all"]="all";n[n.child="child"]="child";n[n.parent="parent"]="parent"}(n.sunburstHighlightMode||(n.sunburstHighlightMode={}));f=n.sunburstHighlightMode,function(n){n[n.point="point"]="point";n[n.all="all"]="all";n[n.child="child"]="child";n[n.parent="parent"]="parent"}(n.sunburstSelectionMode||(n.sunburstSelectionMode={}));p=n.sunburstSelectionMode,function(n){n[n.trim="trim"]="trim";n[n.hide="hide"]="hide";n[n.none="none"]="none"}(n.sunburstLabelOverflowMode||(n.sunburstLabelOverflowMode={}));o=n.sunburstLabelOverflowMode,function(n){n[n.angle="angle"]="angle";n[n.normal="normal"]="normal"}(n.sunburstLabelRotationMode||(n.sunburstLabelRotationMode={}));c=n.sunburstLabelRotationMode,function(n){n[n.center="center"]="center";n[n.near="near"]="near";n[n.far="far"]="far"}(n.titleAlignment||(n.titleAlignment={}));w=n.titleAlignment;a=function(a){function w(w,b){a.call(this);this.defaults={enableAnimation:!1,load:null,preRender:null,loaded:null,dataLabelRendering:null,titleRendering:null,tooltipInitialize:null,pointRegionClick:null,drillDownClick:null,drillDownBack:null,drillDownReset:null,pointRegionMouseMove:null,legendItemRendering:null,legendItemClick:null,segmentRendering:null,animationType:e.rotation,palette:null,opacity:1,valueMemberPath:null,margin:{top:10,bottom:10,left:10,right:10},points:{x:null,y:null,text:null,fill:null},border:{color:null,width:2},segmentBorder:{color:null,width:2},startAngle:null,endAngle:null,dataSource:null,isResponsive:!0,size:{height:"",width:""},innerRadius:.4,radius:1,tooltip:{visible:!1,border:{color:"#707070",width:1},fill:"#FFFFFF",opacity:.95,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",color:"#707070",opacity:1,size:"12px"},template:null,format:"#point.x# : #point.y#"},dataLabelSettings:{visible:!1,labelRotationMode:c.angle,font:{fontFamily:"Segoe UI",fontStyle:"Normal",fontWeight:"Regular",color:null,opacity:1,size:"12px"},template:null,fill:null,labelOverflowMode:o.trim},title:{text:"",textAlignment:u.center,font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"20px"},subtitle:{visible:!0,textAlignment:u.far,text:"",font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"12px"}},visible:!0},zoomSettings:{enable:!1,toolbarHorizontalAlignment:s.right,toolbarVerticalAlignment:h.top},highlightSettings:{enable:!1,mode:f.point,opacity:.5,color:"red",type:r.opacity},selectionSettings:{enable:!1,mode:p.point,opacity:.5,color:"green",type:i.opacity},levels:null,legend:{clickAction:l.toggleSegmentVisibility,visible:!1,position:t.bottom,rowCount:null,columnCount:null,shape:v.circle,alignment:u.center,title:{font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"12px"},text:"",textAlignment:u.center,visible:!0},itemStyle:{height:7.5,width:7.5},itemPadding:10,size:{height:null,width:null},border:{color:null,width:1},font:{fontFamily:"Segoe UI",fontWeight:"Regular",fontStyle:"Normal",color:null,opacity:1,size:"12px"},location:{x:null,y:null}},theme:y.flatlight,background:null};this.model=null;this.svgLink="http://www.w3.org/2000/svg";this.elementSpacing=10;this._id=null;this._legendHighlight=!1;this.legendClicked=!1;this._legendMaxWidth=0;this._legendMaxHeight=0;this._drillInnerRadius=[];this._drillOuterRadius=[];this.common={data:null,cancel:!1};this.legendPages=[];this.groupID=[];this.highlightgroupID=[];this.selectedgroupID=[];this.baseID=null;this._previousState=[];this._drillDownStartAngle=[];this._drillDownEndAngle=[];this._sunburstRedraw=!1;this._isDoubleClickEvent=!1;this.tapCount=0;this.drilldownCount=0;this.tapped=0;this._points=[];this.visiblePoints=[];this.parentNames=[];this.levelNames=[];this.isResize=!1;this.revAnimation=!1;this.validTags=["div"];this._id=w;!b||(this.model=n.compareExtend({},b,this.defaults))}return __extends(w,a),w.prototype._destroy=function(){var n;n=document.getElementById(this.container.id);this.isNullOrUndefined(n)||(this.unBindEvents(this.parentElement),this.unbindResizeEvents(),n.parentNode.removeChild(n))},w.prototype.unBindEvents=function(n){var t="",i=this.browserInfo(),r=i.isMSPointerEnabled,u=i.pointerEnabled,e=r?u?"pointerup":"MSPointerUp":"touchend mouseup",o=r?u?"pointermove":"MSPointerMove":"touchmove mousemove",f;t=o;t=t.split(" ");for(f in t)n.removeEventListener(t[f],this.sunburstMousemove),n.removeEventListener(e,this.sunburstLeave);n.removeEventListener("mouseout",this.sunburstLeave)},w.prototype.unbindResizeEvents=function(){ej.isTouchDevice()&&this._isOrientationSupported()?window.removeEventListener("orientationchange",this.sunBurstResize):window.removeEventListener("resize",this.sunBurstResize)},w.prototype._setModel=function(t){for(var i in t)switch(i){default:n.deepExtend(!0,this.model,{},t[i])}this.redraw()},w.prototype.supportSVG=function(){return!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg")},w.prototype._init=function(){if(this.supportSVG()){var n=void 0,r=void 0,t=void 0,i=void 0;this._startAngle=this.model.startAngle;this._endAngle=this.model.endAngle;this.isResize||(this._enableAnimation=this.model.enableAnimation,this._drillDownStartAngle=[],this._drillDownEndAngle=[],this._drillInnerRadius=[],this._drillOuterRadius=[]);r=$.extend({},this.common);this._trigger("load",r);this.parentElement=this.isNullOrUndefined(this.parentElement)?document.getElementById(this._id):this.parentElement;n=this.createSvg({id:this._id+"_svg"});this.container=n;this.parentElement.appendChild(n);this.setSvgsize(this.model.size,this._id);this._sunburstRedraw==!1&&this.bindEvents(this.parentElement);this.isResize?this.isResize=this.isResize?!1:!0:(!this.isNullOrUndefined(this.model.dataSource)&&this.model.dataSource.length>0&&this.processDataSource(this.model.dataSource),this.setColors(this.model.points),this._previousState.push(this.model.points),this.processData(this.model.points));t=$.extend({},this.common);t.data={};this._trigger("preRender",t);this.drawSunburst(this.layerData);this._isDrillDown&&this.drawToolbar(n);i=$.extend({},this.common);i.data={model:this.model};this._trigger("loaded",i)}else alert("Sunburst will not be support in IE version < 8")},w.prototype.drawSunburst=function(n){var s,h,f,t,o,i=this.model.title,c=this.model.legend,l=this.model.dataLabelSettings,v=this.model.enableAnimation,r,u,a;s=this.drawContainerRect();document.getElementById(this._id+"_svg").appendChild(s);c.visible&&!this.legendClicked&&this.calculateLegendBounds();o={width:this.width,height:this.height};i.text!=""&&i.visible&&(h=this.drawTitle(i,o),document.getElementById(this._id+"_svg").appendChild(h));this.areaBounds=this.calculateSize(o,i);f=this.sunburstRender(n);document.getElementById(this._id+"_svg").appendChild(f);this._enableAnimation&&(r=void 0,this.groupingRegions(this.model.points),this.animationRegions.length>0&&(this.model.animationType==e.rotation?this._isDrillDown?this.rotateDrillDownAnimation(this,this.animationRegions):this.rotateAnimation(this,this.animationRegions):(this.totallayerCount>1?(u=this.animationRegions[0].length,r=this.animationRegions[0][u-1].endAngle):(u=this.animationRegions.length,r=this.animationRegions[u-1][0].endAngle),this.animateLayer(this,f,this.animationRegions[0],0,0,r))));l.visible&&(t=this.drawDatalabel(n),l.template==null?(this._enableAnimation&&t.setAttribute("visibility","hidden"),document.getElementById(this._id+"_svg").appendChild(t)):this._enableAnimation&&(document.getElementById(t.id).style.visibility="hidden"),this.sunburstDoubleClick=this.sunburstDoubleClick.bind(this),document.getElementById(t.id).addEventListener("dblclick",this.sunburstDoubleClick,!0));c.visible&&(this.gLegendEle=this.createGroup({id:this._id+"SunburstLegend"}),this.model.legendInitialize&&(a=$.extend({},this.common),this._trigger("legendInitialize",a)),this.drawSunburstLegend())},w.prototype.animateLayer=function(n,t,i,r,u,f){var h=i[r].startAngle,o=i[r].endAngle,w,e,a,g,nt,c,b,k,s,v=h,l,y,p=0,d=50;w=(o-h)/Math.ceil(d*(o-h)/f);y=n.model.opacity/2/Math.ceil(d*(o-h)/f);e=i[r];this.layeranim=setInterval(function(){a=e.layerNumber;g=e.layerIndex;nt=e.pointIndex;k=n.circularRadius[a-1];l=e.id;v=v+w;c=v;e.endAngle=c>o?o:c;n.isNullOrUndefined(n.model)?clearInterval(n.layeranim):(b=n.calculateArcData(e,a,k),s=t.querySelector("#"+l),p+=y,s&&(s.setAttribute("d",b.Direction),s.setAttribute("opacity",p.toString())),document.getElementById(l).getAttribute("visibility")=="hidden"&&document.getElementById(l).setAttribute("visibility","visible"),c>=o&&(clearInterval(n.layeranim),n.fadeIn(s,p,n,y),r=r+1,r<i.length?n.animateLayer(n,t,i,r,u,f):(r=0,u=u+1,u<n.animationRegions.length?n.animateLayer(n,t,n.animationRegions[u],r,u,f):n.model.dataLabelSettings.visible&&(document.getElementById(n._id+"_svg_DataLabelGroup").style.visibility="visible"))))},10)},w.prototype.fadeIn=function(n,t,i){var r=setInterval(function(){t=t+.1;n.setAttribute("opacity",t.toString());(i.model==null||t>=i.model.opacity)&&clearInterval(r)},50)},w.prototype.rotateAnimation=function(n,t){var y=t.length,r=0,e,h,u,f,l,i=0,a,v,o,c,s=0;l=document.getElementById(n._id+"_svg");f=n.model.startAngle||0;u=n.model.endAngle||360;o=Math.abs(u-f);c=10/o;r=20/360*o+f;y>0&&(this.rotateanim=setInterval(function(){if(n.model){if(e=document.getElementById(n._id+"_svg_SunBurstElementGroup"),e!=null&&e.parentNode.removeChild(e),n.model.startAngle=f,n.model.endAngle=r>u?u:r,n._enableAnimation=!1,h=n.sunburstRender(n.layerData),l.appendChild(h),i=i+c,i=i>1?1:i,a=n.width/2*(1-i),v=n.height/2*(1-i),h.setAttribute("transform","translate("+a+","+v+") scale("+i+")"),r>=u&&(clearInterval(n.rotateanim),n.rotateanim=undefined,n._enableAnimation=!0,n.model.startAngle=f,n.model.endAngle=u,n.model.dataLabelSettings.visible)){var t=document.getElementById(n._id+"_svg_DataLabelGroup"),y=.1;n.model.dataLabelSettings.template==null?document.getElementById(n._id+"_svg").appendChild(t):document.getElementById(n._id).appendChild(t);t.style.visibility="visible";t.style.opacity=y.toString();n.datalabelanim=setInterval(function(){t.style.opacity=y.toString();y=y+.05;y>1&&clearInterval(n.datalabelanim)},10)}r=r+(10-s);s=s+.1;c=1/(o/10-s)}else clearInterval(n.rotateanim)},25))},w.prototype.rotateDrillDownAnimation=function(n,t){var w=t.length,s=0,h=0,c,l,i,r,a,f=0,v,y,o=1,u=.05,e=0,p;a=document.getElementById(n._id+"_svg");r=n.model.startAngle||0;i=n.model.endAngle||360;s=f=n._drillDownStartAngle[n.drilldownCount-1];h=e=n._drillDownEndAngle[n.drilldownCount-1];v=(s-r)/20;y=(i-h)/20;w>0&&(p=setInterval(function(){var t,w,b;c=document.getElementById(n._id+"_svg_SunBurstElementGroup");c.parentNode.removeChild(c);n.model.startAngle=f<r?r:f;n.model.endAngle=e>i?i:e;n._enableAnimation=!1;l=n.sunburstRender(n.layerData);a.appendChild(l);f<=r&&e>=i&&(clearInterval(p),n._enableAnimation=!0,n.model.startAngle=r,n.model.endAngle=i,n.model.dataLabelSettings.visible&&(t=document.getElementById(n._id+"_svg_DataLabelGroup"),w=.1,n.model.dataLabelSettings.template==null?document.getElementById(n._id+"_svg").appendChild(t):document.getElementById(n._id).appendChild(t),t.style.visibility="visible",t.style.opacity=w.toString(),b=setInterval(function(){t.style.opacity=w.toString();w=w+.05;w>1&&clearInterval(b)},10)));o=o+(1-u);u=u+.015;u=u>.7?.7:u;f=s-v*o;e=h+y*o},25))},w.prototype.groupingRegions=function(){var o=this.sunburstRegions,n,t,r=this.sunburstRegions[this.sunburstRegions.length-1].region,u=[],f,i;for(this.animationRegions=[],u.push(r),i=0;i<r.length;i++)o.length>1?(n=[],t=this.layerData[r[i].layerIndex].point[r[i].pointIndex],f=t.groupNumber,this.isNullOrUndefined(t.point)||this.findChildRegions(t.point,n,t.layerNumber,u,f),this.model.animationType==e.rotation?(n.splice(0,0,t),t.count=0,t.groupLength=n.length,this.animationRegions.push(n)):this.animationRegions=u):(n=[],n.push(r[i]),this.animationRegions.push(n))},w.prototype.findChildRegions=function(n,t,i,r,u){for(var f=0;f<n.length;f++)n[f].pointIndex=f,n[f].layerNumber=this.layerData[n.layerData].layerNumber,n[f].groupNumber=u,n[f].count=0,this.model.animationType==e.rotation?t.push(n[f]):(this.isNullOrUndefined(r[n[f].layerNumber-1])&&(r[n[f].layerNumber-1]=[]),r[n[f].layerNumber-1].push(n[f])),this.isNullOrUndefined(n[f].point)||this.findChildRegions(n[f].point,t,i,r,u)},w.prototype.bindEvents=function(n){var t="",i="",r=this.browserInfo(),u=ej.isDevice(),f=r.isMSPointerEnabled,e=r.pointerEnabled,s=f?e?"pointerup":"MSPointerUp":"touchend mouseup",h=f?e?"pointermove":"MSPointerMove":"touchmove mousemove",o;t=h;t=t.split(" ");this.sunburstMousemove=this.sunburstMousemove.bind(this);this.sunburstClick=this.sunburstClick.bind(this);n.addEventListener("click",this.sunburstClick,!0);this.sunburstLeave=this.sunburstLeave.bind(this);for(o in t)(n.addEventListener(s,this.sunburstLeave),i=t[o],u&&i=="mousemove")||n.addEventListener(i,this.sunburstMousemove);u&&n.addEventListener("mousedown",this.sunburstMousemove);n.addEventListener("mouseout",this.sunburstLeave,!0);this.getIEversion()!=-1&&(this.sunburstDoubletap=this.sunburstDoubletap.bind(this),n.addEventListener("pointerdown",this.sunburstDoubletap,!0));this.model.isResponsive&&this.bindResizeEvents()},w.prototype.browserInfo=function(){var n={},t=[],i={webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,msie:/(msie) ([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i};for(var r in i)if(i.hasOwnProperty(r)&&(t=navigator.userAgent.match(i[r]),t)){n.name=t[1].toLowerCase();n.version=t[2];!navigator.userAgent.match(/Trident\/7\./)||(n.name="msie");break}return n.isMSPointerEnabled=n.name=="msie"&&n.version>9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n},w.prototype.sunburstDoubletap=function(n){var t=n.target.id,i;t.indexOf("reset")==-1&&t.indexOf("back")==-1&&(n.preventDefault(),this.tapped=this.tapped+1,i=this.tapped)},w.prototype.bindResizeEvents=function(){this.sunBurstResize=this.sunBurstResize.bind(this);ej.isTouchDevice()&&this._isOrientationSupported()?window.addEventListener("orientationchange",this.sunBurstResize,!0):window.addEventListener("resize",this.sunBurstResize.bind(this),!0)},w.prototype._isOrientationSupported=function(){return"orientation"in window&&"onorientationchange"in window},w.prototype.sunBurstResize=function(){var n=this,t=$(n.container);this._resizeTO&&clearTimeout(this._resizeTO);this._resizeTO=setTimeout(function(){n.model&&(n.isResize=!0,n.isNullOrUndefined(document.getElementById(n._id+"reset"))||(n._isDrillDown=!0),n.legendClicked=!0,n._enableAnimation=!1,n.redraw(),n._enableAnimation=n.model.enableAnimation,n._isDrillDown=!1,n.legendClicked=!1)},500)},w.prototype.getIEversion=function(){var i=-1,n,t;return navigator.appName=="Microsoft Internet Explorer"?(n=navigator.userAgent,t=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),t.exec(n)!=null&&(i=parseFloat(RegExp.$1))):navigator.appName=="Netscape"&&(n=navigator.userAgent,t=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),t.exec(n)!=null&&(i=parseFloat(RegExp.$1))),i},w.prototype.sunburstDoubleClick=function(n){var t;this.model.zoomSettings.enable&&(t=this.getSunburstPoint(n),this.isNullOrUndefined(t)||(t.pointData[0].layerNumber==1?this.drilldownCount==0&&this.drillDown(t):this.drillDown(t)))},w.prototype.drillDown=function(n){var t,u=[],f,i,o,s,r,h,c;i=document.getElementById(this._id+"_svg");i.parentNode.replaceChild(i.cloneNode(!1),i);t=this.layerData[n.pointData[0].layerIndex].point[n.pointData[0].pointIndex];this.drilldownCount=this.drilldownCount+1;this._drillDownStartAngle.push(t.startAngle*180/Math.PI);this._drillDownEndAngle.push(t.endAngle*180/Math.PI);this._isDrillDown=!0;this._isDoubleClickEvent=!0;this.model.enableAnimation&&this.model.animationType==e.rotation&&(r=n.pointData[0].layerNumber,r==1?(this._drillInnerRadius.push(this.innerRadius),this._drillOuterRadius.push(this.circularRadius)):(h=this.innerRadius.slice(r-1,this.innerRadius.length),c=this.circularRadius.slice(r-1,this.circularRadius.length),this._drillInnerRadius.push(h),this._drillOuterRadius.push(c)));f={fill:n.pointData[0].fill,x:n.pointData[0].x,y:n.pointData[0].y,point:t.point,text:n.pointData[0].text};this.model.drillDownClick&&(o=$.extend({},this.common),o.data=f,this._trigger("drillDownClick",o));u.push(f);this._previousState.push(u);this.processData(u);this.drawSunburst(this.layerData);this._isDrillDown=!1;this.isNullOrUndefined(document.getElementById(this._id+"reset"))&&(s=document.getElementById(this._id+"_svg"),this.drawToolbar(s))},w.prototype.drawToolbar=function(n){var t,i,r;r=n.getBoundingClientRect();i=this.drawResetButton(r);n.appendChild(i);this.reset=this.reset.bind(this);document.getElementById(this._id+"reset").addEventListener("click",this.reset,!0);t=this.drawBackButton(r);n.appendChild(t);this.back=this.back.bind(this);document.getElementById(this._id+"back").addEventListener("click",this.back,!0);ej.isDevice()||(document.getElementById(this._id+"back").addEventListener("mousemove",this.sunburstMousemove,!0),document.getElementById(this._id+"reset").addEventListener("mousemove",this.sunburstMousemove,!0));this.toolbarPositioning(t,i)},w.prototype.toolbarPositioning=function(n,t){var e,o,u,f,c,r,i=this.elementSpacing,l=this.model.zoomSettings.toolbarHorizontalAlignment,a=this.model.zoomSettings.toolbarVerticalAlignment;r=n.getBoundingClientRect();c=t.getBoundingClientRect();l==s.right?(o=this.width-i-c.width,u=this.width-2*i-2*c.width):l==s.left?(u=i,o=r.width+2*i):l==s.center&&(u=this.width/2-(r.width+i+c.width)/2,o=u+i+r.width);a==h.top?f=i:a==h.bottom?f=this.height-i-r.height:a==h.middle&&(f=this.height/2-r.height/2);e="translate("+o.toString()+","+f.toString()+")";t.setAttribute("transform",e);e="translate("+u.toString()+","+f.toString()+")";n.setAttribute("transform",e)},w.prototype.drawBackButton=function(){var n,t,i;return i=this.createGroup({id:this._id+"back"}),n={id:this._id+"backPath",d:"M24,27H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h21c1.7,0,3,1.3,3,3v21C27,25.7,25.7,27,24,27z",fill:"#D6D6D6"},t=this.drawPath(n),i.appendChild(t),n={id:this._id+"backPath1",x:7.7,y:12.5,width:13.8,height:2,fill:"#5E5C5C"},t=this.drawRect(n),i.appendChild(t),n={id:this._id+"backPath2",points:"11.4,19.8 5.5,13.5 11.4,7.2 12.9,8.6 8.2,13.5 12.9,18.4",fill:"#5E5C5C"},t=this.drawPolygon(n),i.appendChild(t),i},w.prototype.back=function(){var f=this.layerData,n=document.getElementById(this._id+"_svg"),o=document.getElementById(this._id+"back"),s=document.getElementById(this._id+"reset"),u=this.model,t,i,r;this.revAnimation||(u.drillDownBack&&(i=$.extend({},this.common),i.data=f,this._trigger("drillDownBack",i)),this._enableAnimation&&u.animationType==e.rotation?(this._enableAnimation=!1,this.reverseAnimation(this,this.animationRegions)):(n.parentNode.replaceChild(n.cloneNode(!1),n),r=this._previousState.length-1,this.layerData=this._previousState[r-1],this._previousState.splice(r,1),this.drilldownCount=this.drilldownCount-1,this.processData(this.layerData),this.drawSunburst(this.layerData),this.drilldownCount!=0&&(t=document.getElementById(this._id+"_svg"),t.appendChild(s),t.appendChild(o))))},w.prototype.reverseAnimation=function(n,t){var nt=t.length,e=0,o=0,h,b,c,l,r,a,v,k,d,y=0,i,tt=document.getElementById(n._id+"back"),it=document.getElementById(n._id+"reset"),s,f,p,w,u=.1,g;r=document.getElementById(n._id+"_svg");l=n.model.startAngle||0;c=n.model.endAngle||360;e=n._drillDownStartAngle[n.drilldownCount-1];o=n._drillDownEndAngle[n.drilldownCount-1];k=(e-l)/20;d=(c-o)/20;i=document.getElementById(n._id+"_svg_DataLabelGroup");nt>0&&(g=setInterval(function(){if(n.revAnimation=!0,h=document.getElementById(n._id+"_svg_SunBurstElementGroup"),h&&h.parentNode.removeChild(h),i&&(i.style.visibility="hidden"),a=k*y+l,n.model.startAngle=a>=e?e:a,v=c-d*y,n.model.endAngle=v<o?o:v,b=n.sunburstRender(n.layerData),r.appendChild(b),v<=o&&a>=e){clearInterval(g);s=document.getElementById(n._id+"_svg_SunBurstElementGroup");s.id=n._id+"_svg_tempSeg";f=document.getElementById(n._id+"_svg_DataLabelGroup");r.parentNode.replaceChild(r.cloneNode(!1),r);document.getElementById(n._id+"_svg").appendChild(s);f&&(f.id=n._id+"_svg_tempLabel",document.getElementById(n._id+"_svg").appendChild(f));p=n._previousState.length-1;n.layerData=n._previousState[p-1];n._previousState.splice(p,1);n.model.startAngle=l;n.model.endAngle=c;n.drilldownCount=n.drilldownCount-1;n._drillDownStartAngle.length=n.drilldownCount;n._drillDownEndAngle.length=n.drilldownCount;n._drillInnerRadius.length=n.drilldownCount;n._drillOuterRadius.length=n.drilldownCount;n.processData(n.layerData);n.drawSunburst(n.layerData);n.drilldownCount!=0&&(r=document.getElementById(n._id+"_svg"),r.appendChild(it),r.appendChild(tt));n._enableAnimation=!0;w=document.getElementById(n._id+"_svg_SunBurstElementGroup");w.style.opacity=u.toString();i&&(i.style.opacity=u.toString());n.model.dataLabelSettings.visible&&(i=document.getElementById(n._id+"_svg_DataLabelGroup"),n.model.dataLabelSettings.template==null?document.getElementById(n._id+"_svg").appendChild(i):document.getElementById(n._id).appendChild(i),i.style.visibility="visible",i.style.opacity=u.toString());var t=setInterval(function(){w.style.opacity=u.toString();i&&(i.style.opacity=u.toString());u>=1&&(clearInterval(t),n.revAnimation=!1,s.parentNode.removeChild(s),f&&f.parentNode.removeChild(f));u=u+.1},50)}y=y+1},40))},w.prototype.drawResetButton=function(){var n,i,t,r;return t=this.createGroup({id:this._id+"reset"}),n={id:this._id+"resetPath",d:"M24,27H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h21c1.7,0,3,1.3,3,3v21C27,25.7,25.7,27,24,27z",fill:"#D6D6D6"},i=this.drawPath(n),t.appendChild(i),n={id:this._id+"resetPath1",d:"M13.6,21.9c-3.6,0-6.8-2.3-8-5.7l1.8-0.6c0.9,2.6,3.4,4.4,6.2,4.4c3.4,0,6.2-2.6,6.5-6l1.9,0.2 C21.6,18.6,18,21.9,13.6,21.9z",fill:"#5E5C5C"},i=this.drawPath(n),t.appendChild(i),n={id:this._id+"resetPath2",d:"M7.1,12.5l-1.9-0.3c0.6-4.1,4.2-7.1,8.3-7.1c3,0,5.8,1.6,7.3,4.2c0.1,0.2,0.2,0.4,0.3,0.6l-1.7,0.8 c-0.1-0.2-0.2-0.3-0.2-0.4c-1.2-2-3.3-3.3-5.7-3.3C10.4,7,7.6,9.3,7.1,12.5z",fill:"#5E5C5C"},i=this.drawPath(n),t.appendChild(i),n={id:this._id+"resetPath3",points:"21.4,11.9 16.2,10.7 16.6,8.9 19.9,9.6 20.7,6.3 22.5,6.7",fill:"#5E5C5C"},r=this.drawPolygon(n),t.appendChild(r),n={id:this._id+"resetPath4",points:"6.3,20.3 4.5,19.9 5.6,14.8 10.8,16 10.4,17.8 7.1,17.1",fill:"#5E5C5C"},r=this.drawPolygon(n),t.appendChild(r),t},w.prototype.reset=function(){if(this.model.drillDownReset){var n=$.extend({},this.common);this._trigger("drillDownReset",n)}this.redraw()},w.prototype.redraw=function(){this.legendPages=[];this.isResize||(this.drilldownCount=0,this._previousState=[],this._drillDownStartAngle=[],this._drillDownEndAngle=[],this._drillInnerRadius=[],this._drillOuterRadius=[]);this._sunburstRedraw=!0;var n=document.getElementById(this._id+"_svg");this.isNullOrUndefined(n)||(n.parentNode.removeChild(n),(this.rotateanim||this.model.enableAnimation)&&this.stopAnimation(),this.parentElement=undefined,this._init(),this._sunburstRedraw=!1)},w.prototype.stopAnimation=function(){this.rotateanim&&(clearInterval(this.rotateanim),this.isResize||(this._enableAnimation=this.model.enableAnimation),this.model.startAngle=this._startAngle,this.model.endAngle=this._endAngle,this.datalabelanim&&clearInterval(this.datalabelanim));this.layeranim&&clearInterval(this.layeranim)},w.prototype.sunburstMousemove=function(n){var e=n.target.id,y,i,c,v,a,o,s,t,u,h,f;if(e.indexOf("reset")!=-1||e.indexOf("back")!=-1)if(this.toolbarTooltip(n,e),e.indexOf("reset")!=-1)for(y=document.getElementById(this._id+"reset"),t=0;t<5;t++)t==0?document.getElementById(this._id+"resetPath").setAttribute("fill","rgb(20, 185, 255)"):document.getElementById(this._id+"resetPath"+t.toString()).setAttribute("fill","#FFFFFF");else for(t=0;t<3;t++)t==0?document.getElementById(this._id+"backPath").setAttribute("fill","rgb(20, 185, 255)"):document.getElementById(this._id+"backPath"+t.toString()).setAttribute("fill","#FFFFFF");else if(document.getElementById(this._id+"toolbarTooltip")!=null&&document.getElementById(this._id+"toolbarTooltip").style.visibility!="hidden"&&(document.getElementById(this._id+"toolbarTooltip").style.visibility="hidden",document.getElementById(this._id+"reset")!=null&&document.getElementById(this._id+"back")!=null)){for(t=0;t<5;t++)t==0?document.getElementById(this._id+"resetPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"resetPath"+t.toString()).setAttribute("fill","#5E5C5C");for(t=0;t<3;t++)t==0?document.getElementById(this._id+"backPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"backPath"+t.toString()).setAttribute("fill","#5E5C5C")}if(i=this.getSunburstPoint(n),i!=undefined&&this.model.pointRegionMouseMove&&(c=$.extend({},this.common),c.data=i,this._trigger("pointRegionMouseMove",c)),!this.isNullOrUndefined(i)&&this.model.tooltip.visible){for(v={id:this._id+"_ToolTip"},this.gTransToolEle=this.createGroup(v),a={X:i.location.x,Y:Math.abs(i.location.y)},t=0;t<this.layerData.length;t++)this.layerData[t].layerNumber==i.pointData[0].layerNumber&&(this.isNullOrUndefined(i.pointData[0].parentName)?(s=this.layerData[0],o=this.layerData[0].point[i.pointData[0].pointIndex]):this.layerData[t].parentName==i.pointData[0].parentName&&(s=this.layerData[t],o=this.layerData[t].point[i.pointData[0].pointIndex]));this.model.tooltip.template?this.createTooltiptemplate(a,o,s,i):this.showTooltip(a,o,s,i)}else this.isNullOrUndefined(document.getElementById(this._id+"_ToolTip"))||(document.getElementById(this._id+"_ToolTip").style.visibility="hidden");if(this.model.highlightSettings.enable&&(u=void 0,h=this.model.highlightSettings,this.highlightSunburst(i),!this.isNullOrUndefined(i)&&this.model.legend.visible))for(f=0;f<this.model.points.length;f++)u=document.getElementById(this._id+"_svg_LegendItemShape"+f),h.type==r.opacity?this.selectedGroupNumber-1!=f&&i.pointData[0].legendIndex!=f&&(u.style.opacity=h.opacity.toString()):i.pointData[0].legendIndex==f?u.getAttribute("class")!="SelectionStyleSunburst"&&(u.setAttribute("class","HighlightStyleSunburst"),u.style.opacity=h.opacity.toString()):u.getAttribute("class")=="HighlightStyleSunburst"||u.removeAttribute("class");e.indexOf(this._id+"_svg_LegendItem")!=-1&&this.model.legend.clickAction==l.toggleSegmentSelection&&this.legendSegments(e)},w.prototype.legendSegments=function(n){var o,u,s,t,f,h,e,r,i;for(o=n.replace(this._id+"_svg",""),u=parseInt(o.replace(/[^0-9\.]/g,"")),s=document.getElementById(this._id+"legendItem_Group"),t=s.childNodes,f=this.model.highlightSettings.opacity.toString(),r=0;r<t.length;r++)document.getElementById(t[r].id).style.opacity=u!=r?f:"1";for(h=document.getElementById(this._id+"_svg_SunBurstElementGroup"),t=h.childNodes,i=0;i<t.length;i++)t[i].id.indexOf("_legendIndex"+u)==-1&&(document.getElementById(t[i].id).style.opacity=f);if(this.model.dataLabelSettings.visible&&(e=document.getElementById(this._id+"_svg_DataLabelGroup"),e))for(t=e.childNodes,i=0;i<t.length;i++)t[i].id.indexOf("_legendIndex"+u)==-1&&(document.getElementById(t[i].id).style.opacity=f);this._legendHighlight=!0},w.prototype.toolbarTooltip=function(n,t){var i,r,u;t=t.indexOf("reset")!=-1?"Reset":"Back";r={top:n.clientY,left:n.clientX,"background-color":"white","border-style":"solid",position:"absolute","border-color":"#2F4F4F","border-width":"1px",opacity:.95,"z-index":1e6,"border-radius":"0px 0px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"};this.isNullOrUndefined(document.getElementById(this._id+"toolbarTooltip"))?(i=document.createElement("div"),i.setAttribute("id",this._id+"toolbarTooltip")):i=document.getElementById(this._id+"toolbarTooltip");i.style.pointerEvents="none";this.setStyles(r,i);u={top:n.clientY,left:n.clientX,color:this.model.tooltip.font.color,"font-size":this.model.tooltip.font.size,"font-family":this.model.tooltip.font.fontFamily,"font-style":this.model.tooltip.font.fontStyle,"font-weight":this.model.tooltip.font.fontWeight,"align-self":"baseline"};this.setStyles(u,i);this.isNullOrUndefined(document.getElementById(this._id+"toolbarTooltip"))&&document.body.appendChild(i);i.innerHTML=t;i.style.visibility=="hidden"&&(i.style.visibility="visible");i.style.left=(n.clientX+window.pageXOffset+10).toString()+"px";i.style.top=(n.clientY+window.pageYOffset+10).toString()+"px"},w.prototype.removeHighlight=function(n){for(var t=0;t<n.length&&document.getElementById(n[t])!=null;t++)document.getElementById(n[t]).getAttribute("class")=="HighlightStyleSunburst"&&document.getElementById(n[t]).removeAttribute("class")},w.prototype.isSelectedElement=function(n,t){for(var r=!1,i=0;i<t.length;i++)n==t[i]&&(r=!0);return r},w.prototype.highlightSunburst=function(n){var u=document.getElementsByTagName("path"),o=n,e,h,y,b,p,d=this.model.legend,i=this.model.highlightSettings,g=this.model.points,k,c,l,a,v,s,w,t;if(this.isNullOrUndefined(o))if(i.type!=r.opacity){if(i.mode==f.point)e=document.getElementsByClassName("HighlightStyleSunburst"),e.length>0&&(e[0].removeAttribute("class"),this.baseID=undefined);else if(i.mode==f.all){if(!this.isNullOrUndefined(this.highlightgroupID)){for(s=0;s<this.highlightgroupID.length;s++)document.getElementById(this.highlightgroupID[s])!=null&&(document.getElementById(this.highlightgroupID[s]).getAttribute("class")==null||document.getElementById(this.highlightgroupID[s]).getAttribute("class")=="HighlightStyleSunburst")&&document.getElementById(this.highlightgroupID[s]).removeAttribute("class");this.groupID=undefined;this.selelectedElementId=undefined}}else if(e=document.getElementsByClassName("HighlightStyleSunburst"),e.length>0){for(w=0;w<e.length;w++)this.highlightgroupID.push(e[w].id);this.removeHighlight(this.highlightgroupID);this.highlightgroupID=[];this.highlightedElementId=null}}else for(t=0;t<u.length;t++)this.selectedgroupID.length==0?this.selectedgroupID.indexOf(u[t].id)==-1&&(u[t].style.opacity="1"):this.selectedgroupID.indexOf(u[t].id)==-1&&(u[t].style.opacity=this.model.selectionSettings.opacity.toString());else if(i.mode==f.point)if(i.type!=r.opacity)e=document.getElementsByClassName("HighlightStyleSunburst"),i.mode==f.point&&e.length>0&&e[0].removeAttribute("class"),h=document.getElementById(o.pointData[0].id),k=this.isSelectedElement(h.id,this.selectedgroupID),document.getElementById(h.id).getAttribute("class")!=null||k||this.createHighlightStyle(h,i),this.baseID=h.id;else{for(t=0;t<u.length;t++)this.selectedgroupID.indexOf(u[t].id)==-1&&(u[t].style.opacity=i.opacity.toString());document.getElementById(o.pointData[0].id).style.opacity="1"}else if(i.mode==f.all){if(y=this.findGroupElements(o),b=this._id+"_legendIndex"+y[0].legendIndex+"_layerNumber1_layerIndex0_pointIndex"+y[0].pointIndex.toString(),i.type!=r.opacity){if(p=document.getElementsByClassName("HighlightStyleSunburst"),p.length>0)for(c=0;c<p.length;c++)this.highlightgroupID.push(p[c].id),this.highlightgroupID[c].indexOf(this._id+"_svg_LegendItemShape")<0&&this.removeHighlight(this.highlightgroupID);this.groupID=undefined;this.highlightgroupID=[];this.selelectedElementId=undefined}if(this.highlightGroup(y,o),i.type==r.opacity){for(l=0;l<u.length;l++)this.selectedgroupID.indexOf(u[l].id)==-1&&(u[l].style.opacity=i.opacity.toString());for(t=0;t<this.highlightgroupID.length;t++)document.getElementById(this.highlightgroupID[t]).style.opacity="1"}}else if(i.mode==f.child){if(b=o.pointData[0].id,i.type!=r.opacity&&(!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.highlightgroupID=[],this.highlightedElementId=undefined),this.highlightChild(o),i.type==r.opacity){for(a=0;a<u.length;a++)this.selectedgroupID.indexOf(u[a].id)==-1&&(u[a].style.opacity=i.opacity.toString());for(t=0;t<this.highlightgroupID.length;t++)document.getElementById(this.highlightgroupID[t]).style.opacity="1";this.highlightedElementId=undefined}}else if(b=o.pointData[0].id,i.type!=r.opacity&&(!this.isNullOrUndefined(this.groupID)&&this.groupID.length>0&&this.removeHighlight(this.groupID),this.groupID=undefined,this.selelectedElementId=undefined),this.highlightParent(o),i.type==r.opacity){for(v=0;v<u.length;v++)this.selectedgroupID.indexOf(u[v].id)==-1&&(u[v].style.opacity=this.model.selectionSettings.opacity.toString());for(t=0;t<this.groupID.length;t++)document.getElementById(this.groupID[t]).style.opacity="1"}},w.prototype.highlightGroup=function(n,t){var i,f=this.model.highlightSettings,e=!1,u,o;for(this.highlightgroupID=[],u=0;u<n.length;u++)if(n[u].layerNumber==1)i=document.getElementById(this._id+"_legendIndex"+t.pointData[0].legendIndex+"_layerNumber1_layerIndex0_pointIndex"+n[u].pointIndex.toString()),e=this.isSelectedElement(i.id,this.selectedgroupID),f.type==r.opacity||document.getElementById(i.id).getAttribute("class")!=null||e||(this.createHighlightStyle(i,f),this.selelectedElementId=i.id),this.highlightgroupID.push(i.id);else for(o=0;o<n[u].point.length;o++)n[u].layerNumber!=1&&(i=document.getElementById(this._id+"_legendIndex"+t.pointData[0].legendIndex+"_layerNumber"+n[u].layerNumber.toString()+"_layerIndex"+n[u].layerIndex.toString()+"_pointIndex"+o.toString()),e=this.isSelectedElement(i.id,this.selectedgroupID),f.type==r.opacity||document.getElementById(i.id).getAttribute("class")!=null||e||this.createHighlightStyle(i,f),this.highlightgroupID.push(i.id))},w.prototype.highlightParent=function(n){var t,e,u=this.model.highlightSettings,f=!1,i;for(this.groupID=[],this.parentEle=[],this.parentEle.push(n.pointData[0]),e=n.pointData[0].id,this.isNullOrUndefined(n.pointData[0].parentName)||this.findSelectionparent(n.pointData[0].parentName),i=0;i<this.parentEle.length;i++)document.getElementById("selectionSunburst")?(t=document.getElementById(this._id+"_legendIndex"+n.pointData[0].legendIndex+"_layerNumber"+this.parentEle[i].layerNumber.toString()+"_layerIndex"+this.parentEle[i].layerIndex.toString()+"_pointIndex"+this.parentEle[i].pointIndex),f=this.isSelectedElement(t.id,this.selectedgroupID),u.type==r.opacity||f||this.createHighlightStyle(t,u),this.groupID.push(t.id),this.highlightgroupID.push(t.id)):(t=document.getElementById(this._id+"_legendIndex"+n.pointData[0].legendIndex+"_layerNumber"+this.parentEle[i].layerNumber.toString()+"_layerIndex"+this.parentEle[i].layerIndex.toString()+"_pointIndex"+this.parentEle[i].pointIndex),f=this.isSelectedElement(t.id,this.selectedgroupID),u.type==r.opacity||f||this.createHighlightStyle(t,u),this.groupID.push(t.id),this.highlightgroupID.push(t.id))},w.prototype.highlightChild=function(n){var f,o,i=this.model.highlightSettings,l,h,c,e=!1,u,t,s;if(this.childEle=[],this.highlightgroupID=[],f=this.layerData[n.pointData[0].layerIndex].point[n.pointData[0].pointIndex],o=n.pointData[0].id,u=document.getElementById(o),e=this.isSelectedElement(u.id,this.selectedgroupID),f.point||f.layerIndex==0||e){for(l=n.pointData[0].layerNumber,this.isNullOrUndefined(f.point)||this.findChild(f,l),i.type==r.opacity||e||this.createHighlightStyle(u,i),this.highlightgroupID.push(u.id),this.highlightedElementId=o,t=0;t<this.childEle.length;t++)if(this.childEle[t].layerNumber>n.pointData[0].layerNumber)for(s=0;s<this.childEle[t].length;s++)h=this._id+"_legendIndex"+n.pointData[0].legendIndex+"_layerNumber"+this.childEle[t].layerNumber.toString()+"_layerIndex"+this.childEle[t].layerIndex+"_pointIndex"+s.toString(),c=document.getElementById(h),e=this.isSelectedElement(h,this.selectedgroupID),i.type==r.opacity||e||this.createHighlightStyle(c,i),this.highlightgroupID.push(c.id)}else i.type!=r.opacity&&(this.createHighlightStyle(u,i),this.highlightedElementId=o),this.highlightgroupID.push(u.id)},w.prototype.createHighlightStyle=function(n,t){var i,r,u;n.getAttribute("class")!="SelectionStyleSunburst"&&(document.getElementById("highlightSunburst")||(i=document.createElement("style"),i.type="text/css",r=t.color,u="1",i.innerHTML=" .HighlightStyleSunburst{ fill:"+r+";opacity:"+u+";stroke:;stroke-width:1}",i.setAttribute("id","highlightSunburst"),document.body.appendChild(i)),n.setAttribute("class","HighlightStyleSunburst"))},w.prototype.showTooltip=function(n,t,i,r){var h=7,c,u,l,o,s,e,f=this.model.tooltip,y=document.getElementById(this._id+"_svg"),p=window.pageYOffset,w=window.pageXOffset,a=y.getBoundingClientRect(),v;o=n.X+h/2+w+a.left;s=n.Y-3*h+p+a.top;document.getElementById(this._id+"_ToolTip")==null?(u=document.createElement("div"),u.id=this._id+"_ToolTip",u.style.pointerEvents="none"):(u=document.getElementById(this._id+"_ToolTip"),u.style.pointerEvents="none");c=this.formatTooltip(r.pointData[0],f.format);e=$.extend({},this.common);e.data={pointIndex:r.pointData[0].pointIndex,currentText:c,Location:{x:o,Y:s}};this._trigger("tooltipInitialize",e);u.innerHTML=e.data.currentText;l={top:e.data.Location.X,left:e.data.Location.Y,"background-color":f.fill,"border-style":"solid",position:"absolute","border-color":f.border.color,"border-width":f.border.width+"px",opacity:f.opacity,"z-index":1e6,"border-radius":"0px 0px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"};this.setStyles(l,u);v={top:s,left:o,color:f.font.color,"font-size":f.font.size,"font-family":f.font.fontFamily,"font-style":f.font.fontStyle,"font-weight":f.font.fontWeight,"align-self":"baseline"};this.setStyles(v,u);this.isNullOrUndefined(document.getElementById(this._id+"Tooltip"))&&document.body.appendChild(u);u.style.visibility=="hidden"&&(u.style.visibility="visible");u.style.left=o.toString()+"px";u.style.top=s.toString()+"px"},w.prototype.formatTooltip=function(n,t){var i=t;return i.search("#point.x#")!=-1&&(i=i.replace("#point.x#",n.x)),i.search("#point.y#")!=-1&&(i=i.replace("#point.y#",n.y)),i},w.prototype.setStyles=function(n,t){for(var r=Object.keys(n),u,f=r.map(function(t){return n[t]}),i=0,e=r.length;i<e;i++)u=r[i],t.style[u]=f[i]},w.prototype.createTooltiptemplate=function(n,t,i,r){var u=document.getElementById("tooltipDiv"),f,e,s=document.getElementById(this._id+"_svg"),h=window.pageYOffset,c=window.pageXOffset,o=s.getBoundingClientRect();f=n.X+c+o.left+10;e=n.Y+h+o.top;this.isNullOrUndefined(u)?(this.tooltipfirst=!0,u=document.createElement("div"),u.className="tooltipDiv",u.style.position="absolute",u.style.zIndex="13000",u.style.display="block",u.id="tooltipDiv",u.style.backgroundColor="white",document.body.appendChild(u),this.clonenode=document.getElementById(this.model.tooltip.template).cloneNode(!0),this.clonenode.style.display="block",document.getElementById("tooltipDiv").innerHTML="",this.clonenode.innerHTML=this.parseTooltipTemplate(r.pointData[0],this.clonenode.innerHTML),document.getElementById("tooltipDiv").appendChild(this.clonenode)):(u.style.display="block",this.tooltipfirst=!1,this.clonenode.innerHTML=this.parseTooltipTemplate(r.pointData[0],this.clonenode.innerHTML));document.getElementById("tooltipDiv").style.left=f.toString()+"px";document.getElementById("tooltipDiv").style.top=e.toString()+"px"},w.prototype.parseTooltipTemplate=function(n){var i=document.getElementById(this.model.tooltip.template).cloneNode(!0),t=i.innerHTML;return t.search("#point.x#")!=-1&&(t=t.replace("#point.x#",n.x.toString())),t.search("#point.y#")!=-1&&(t=t.replace("#point.y#",n.y.toString())),t.search("#point.text#")!=-1&&(t=this.isNullOrUndefined(n.text)?t.replace("#point.text#",n.y.toString()):t.replace("#point.text#",n.text.toString())),t},w.prototype.bindClickEvent=function(n){var t,i;return t=this.getSunburstPoint(n),!this.isNullOrUndefined(t)&&this.model.pointRegionClick&&(i=$.extend({},this.common),i.data=t,this._trigger("pointRegionClick",i)),t},w.prototype.sunburstClick=function(n){var o=this.bindClickEvent(n),t,s,f,e=this.model.selectionSettings,h,u,r;if(e.enable&&(this.selectSunburst(o,n),!this.isNullOrUndefined(o)&&this.model.legend.visible))for(r=0;r<this.model.points.length;r++)u=document.getElementById(this._id+"_svg_LegendItemShape"+r),h=this.model.points[r],e.type==i.opacity?o.pointData[0].legendIndex!=r&&(u.style.opacity=e.opacity.toString()):this.selectedGroupNumber-1==r?(u.setAttribute("class","SelectionStyleSunburst"),u.style.opacity=e.opacity.toString()):u.getAttribute("class")=="SelectionStyleSunburst"||u.removeAttribute("class");t=this;t.tapCount++;s=setTimeout(function(){t.tapCount>=2&&t._isDoubleClickEvent==!1&&(t.sunburstDoubleClick(n),t._isDoubleClickEvent=!1);t.tapCount=0},200);f=document.getElementById(t._id+"toolbarTooltip");t.isNullOrUndefined(f)||f.parentNode.removeChild(f)},w.prototype.isTouch=function(n){var i,t;return(i=this.browserInfo(),t=n.originalEvent?n.originalEvent:n,t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1)?!0:!1},w.prototype.sunburstLeave=function(n){var i=this,u=n.target.id,l,h,c,f,e,o,s,r,a,v,t;if(this._legendHighlight){for(l=document.getElementById(this._id+"legendItem_Group"),h=l.childNodes,r=0;r<h.length;r++)document.getElementById(h[r].id).style.opacity="1";for(c=document.querySelectorAll("[id^="+this._id+"_legendIndex]"),s=0;s<c.length;s++)document.getElementById(c[s].id).style.opacity="1";this._legendHighlight=!1}if(this.model.legend.visible&&this.model.highlightSettings.enable)for(r=0;r<this.model.points.length;r++)f=document.getElementById(this._id+"_svg_LegendItemShape"+r),f!=null&&(f.style.opacity="1",f.removeAttribute("class"));if(this.isNullOrUndefined(document.getElementById(i._id+"_ToolTip"))||(ej.isTouchDevice()||this.isTouch(n)?a=setTimeout(function(){document.getElementById(i._id+"_ToolTip").style.visibility="hidden"},3e3):u==i._id+"_svg_svgRect"&&(this._hideTooltip||clearTimeout(this._hideTooltip),this._hideTooltip=setTimeout(function(){document.getElementById(i._id+"_ToolTip").style.visibility="hidden"},1e3))),o=document.getElementById(i._id+"toolbarTooltip"),i.isNullOrUndefined(o)||o.parentNode.removeChild(o),e=document.getElementById("tooltipDiv"),i.isNullOrUndefined(e)||(ej.isTouchDevice()||this.isTouch(n)?v=setTimeout(function(){e.style.display="none"},3e3):u==i._id+"_svg_svgRect"&&(this._hideTooltipTemplate||clearTimeout(this._hideTooltipTemplate),this._hideTooltipTemplate=setTimeout(function(){e.style.display="none"},1e3))),u.indexOf(this._id+"reset")!=-1)for(t=0;t<5;t++)t==0?document.getElementById(this._id+"resetPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"resetPath"+t.toString()).setAttribute("fill","#5E5C5C");if(u.indexOf(this._id+"back")!=-1)for(t=0;t<3;t++)t==0?document.getElementById(this._id+"backPath").setAttribute("fill","#D6D6D6"):document.getElementById(this._id+"backPath"+t.toString()).setAttribute("fill","#5E5C5C")},w.prototype.selectSunburst=function(n,t){var l,d,a,v=this.model.selectionSettings.mode.toString(),e=document.getElementsByTagName("path"),g,s=this.model.selectionSettings.opacity.toString(),o=this.model.selectionSettings.type,p=this.model.legend,w=this.model.points,r,y,h,b,c,u,k,f;if(this.isNullOrUndefined(n)){if(i.opacity!=o)v=="point"?(h=document.getElementsByClassName("SelectionStyleSunburst"),h.length>0&&h[0].removeAttribute("class")):this.selectedgroupID.length>0&&(this.removeSelection(this.selectedgroupID),this.selectedgroupID=[],this.selectedGroupNumber=null,v=="child"&&(this.selelectedElementId=null),v=="parent"&&(this.groupNumber=null));else{for(this.selectedgroupID=[],f=0;f<e.length;f++)e[f].style.opacity="1";this.mouseClickedElementId="";this.selectedGroupNumber=null}this.removeLegendSelection()}else if(this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),v=="point"){if(this.selectedgroupID=[],g=t.target.id.replace("_layerIndex"+n.pointData[0].layerIndex.toString(),""),i.opacity!=o)!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),l=document.getElementById(n.pointData[0].id),l.getAttribute("class")=="SelectionStyleSunburst"?(l.removeAttribute("class"),this.highlightgroupID.indexOf(l.id)!=-1&&l.setAttribute("class","HighlightStyleSunburst")):(h=document.getElementsByClassName("SelectionStyleSunburst"),this.highlightgroupID.length>0&&h.length>0&&this.highlightgroupID.indexOf(h[0].id)!=-1&&h[0].setAttribute("class","HighlightStyleSunburst"),h.length>0&&h[0].getAttribute("class")=="SelectionStyleSunburst"&&h[0].removeAttribute("class"),!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.selectPointData(l),this.selectedgroupID.push(l.id));else{if(this.mouseClickedElementId!=g){for(u=0;u<e.length;u++)e[u].style.opacity=s;document.getElementById(n.pointData[0].id).style.opacity="1";this.mouseClickedElementId=g;this.selectedgroupID.push(n.pointData[0].id)}else{for(f=0;f<e.length;f++)e[f].style.opacity="1";this.mouseClickedElementId=""}this.selectedGroupNumber=n.pointData[0].groupNumber}if(p.visible&&this.selectedgroupID.length>0)for(c=0;c<w.length;c++)r=document.getElementById(this._id+"_svg_LegendItemShape"+c),n.pointData[0].legendIndex!=c?r!=null&&(r.style.opacity=s,r.removeAttribute("class")):i.opacity==o?r.style.opacity="1":(r.setAttribute("class","SelectionStyleSunburst"),r.style.opacity=s);this.selectedgroupID.length==0&&this.removeLegendSelection()}else if(v=="all")if(y=this.findGroupElements(n),a=n.pointData[0].id,this.selectedgroupID.indexOf(a)==-1){if(this.selectedGroupNumber!=y[0].groupNumber?(this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),this.selectGroup(y,n),this.selectedGroupNumber=y[0].groupNumber):(this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),this.selectedgroupID=[],this.selectedGroupNumber=null),i.opacity==o){for(u=0;u<e.length;u++)e[u].style.opacity=s;for(f=0;f<this.selectedgroupID.length;f++)document.getElementById(this.selectedgroupID[f]).style.opacity="1";this.isSelected=!0}if(p.visible){for(b=0;b<w.length;b++)r=document.getElementById(this._id+"_svg_LegendItemShape"+b),r!=null&&(r.style.opacity=s,r.removeAttribute("class"));i.opacity!=o?document.getElementById(this._id+"_svg_LegendItemShape"+y[0].pointIndex.toString()).setAttribute("class","SelectionStyleSunburst"):document.getElementById(this._id+"_svg_LegendItemShape"+y[0].pointIndex.toString()).style.opacity="1"}}else{if(this.selectedgroupID.length>0)if(i.opacity!=o)this.removeSelection(this.selectedgroupID);else for(u=0;u<e.length;u++)e[u].style.opacity="1";this.isSelected=!1;this.selectedGroupNumber=null;this.selectedgroupID=[];this.baseID="";this.removeLegendSelection()}else if(v=="child")if(a=n.pointData[0].id,this.selectedgroupID.indexOf(a)==-1){if(!this.isNullOrUndefined(this.selectedgroupID)&&this.selectedgroupID.length>0&&this.removeSelection(this.selectedgroupID),!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.selectedgroupID=[],this.selelectedElementId=undefined,this.selectchild(n),i.opacity==o){for(u=0;u<e.length;u++)e[u].style.opacity=s;for(f=0;f<this.selectedgroupID.length;f++)document.getElementById(this.selectedgroupID[f]).style.opacity="1";this.isSelected=!0}if(this.selectedGroupNumber=n.pointData[0].groupNumber,p.visible)for(c=0;c<w.length;c++)r=document.getElementById(this._id+"_svg_LegendItemShape"+c),n.pointData[0].legendIndex!=c?r!=null&&(r.style.opacity=s,r.removeAttribute("class")):i.opacity==o?r.style.opacity="1":(r.setAttribute("class","SelectionStyleSunburst"),r.style.opacity=s)}else this.selectedgroupID=[],this.selelectedElementId=this.baseID="",this.removeSegmentSelection(e,o),this.removeLegendSelection(),this.isSelected=!1;else if(a=n.pointData[0].id,this.selectedgroupID.indexOf(a)==-1){if(this.isNullOrUndefined(this.groupNumber)||this.groupNumber==n.pointData[0].groupNumber?this.selectedgroupID.length>0&&(this.removeSelection(this.selectedgroupID),this.selectedgroupID=[]):this.removeSegmentSelection(e,this.model.selectionSettings.type),!this.isNullOrUndefined(this.highlightgroupID)&&this.highlightgroupID.length>0&&this.removeHighlight(this.highlightgroupID),this.selectParent(n),this.groupNumber=n.pointData[0].groupNumber,i.opacity==o){for(u=0;u<e.length;u++)e[u].style.opacity=s;for(f=0;f<this.selectedgroupID.length;f++)document.getElementById(this.selectedgroupID[f]).style.opacity="1"}if(this.selectedGroupNumber=n.pointData[0].groupNumber,d=n.pointData[0].legendIndex,p.visible){for(k=0;k<w.length;k++)r=document.getElementById(this._id+"_svg_LegendItemShape"+k),r!=null&&(r.style.opacity=s,r.removeAttribute("class"));i.opacity!=o?document.getElementById(this._id+"_svg_LegendItemShape"+d.toString()).setAttribute("class","SelectionStyleSunburst"):document.getElementById(this._id+"_svg_LegendItemShape"+d.toString()).style.opacity="1"}}else this.selectedgroupID=[],this.selelectedElementId=this.baseID="",this.removeSegmentSelection(e,this.model.selectionSettings.type),this.removeLegendSelection()},w.prototype.removeSegmentSelection=function(n,t){for(var r=0;r<n.length;r++)t==i.opacity?n[r].style.opacity="1":n[r].removeAttribute("class")},w.prototype.removeLegendSelection=function(){var n,t;if(this.model.legend.visible)for(t=0;t<this.model.points.length;t++)n=document.getElementById(this._id+"_svg_LegendItemShape"+t),n!=null&&(n.style.opacity="1",n.removeAttribute("class"))},w.prototype.selectParent=function(n){var r,f,u,e=this.model.selectionSettings,o,t;for(this.parentEle=[],u=n.pointData[0].legendIndex,i.opacity==e.type&&(this.selectedgroupID=[]),this.parentEle.push(n.pointData[0]),o=n.pointData[0].id,i.opacity!=e.type&&(this.selectedgroupID=[],this.removeSelection(this.selectedgroupID),this.selelectedElementId=o),this.isNullOrUndefined(n.pointData[0].parentName)||this.findSelectionparent(n.pointData[0].parentName),t=0;t<this.parentEle.length;t++)document.getElementById("selectionSunburst")?(r=document.getElementById(this._id+"_legendIndex"+u+"_layerNumber"+this.parentEle[t].layerNumber.toString()+"_layerIndex"+this.parentEle[t].layerIndex.toString()+"_pointIndex"+this.parentEle[t].pointIndex),i.opacity!=this.model.selectionSettings.type&&r.setAttribute("class","SelectionStyleSunburst"),this.selectedgroupID.push(r.id)):(r=document.getElementById(this._id+"_legendIndex"+u+"_layerNumber"+this.parentEle[t].layerNumber.toString()+"_layerIndex"+this.parentEle[t].layerIndex.toString()+"_pointIndex"+this.parentEle[t].pointIndex),i.opacity!=this.model.selectionSettings.type&&(f=this.createselectionStyle(r,this.model.selectionSettings),document.body.appendChild(f),r.setAttribute("class","SelectionStyleSunburst")),this.selectedgroupID.push(r.id))},w.prototype.findSelectionparent=function(n){var r=this.sunburstRegions,t,i;n:for(t=0;t<r.length;t++)for(i=0;i<r[t].region.length;i++)if(n==r[t].region[i].x)if(this.parentEle.push(r[t].region[i]),this.isNullOrUndefined(r[t].region[i].parentName))break n;else{this.findSelectionparent(r[t].region[i].parentName);break n}},w.prototype.selectchild=function(n){var u,e,t,f=this.model.selectionSettings,o,c,l,h,a,r,s;if(this.childEle=[],u=this.layerData[n.pointData[0].layerIndex].point[n.pointData[0].pointIndex],e=n.pointData[0].id,t=document.getElementById(e),u.point||u.layerIndex==0){for(a=n.pointData[0].layerNumber,this.isNullOrUndefined(u.point)||this.findChild(u,a),f.type!=i.opacity&&(document.getElementById("SelectionStyleSunburst")||(o=this.createselectionStyle(t,f),document.body.appendChild(o)),t.setAttribute("class","SelectionStyleSunburst")),this.selectedgroupID.push(t.id),this.selelectedElementId=e,c=n.pointData[0].legendIndex,r=0;r<this.childEle.length;r++)if(this.childEle[r].layerNumber>n.pointData[0].layerNumber)for(s=0;s<this.childEle[r].length;s++)l=this._id+"_legendIndex"+c+"_layerNumber"+this.childEle[r].layerNumber.toString()+"_layerIndex"+this.childEle[r].layerIndex+"_pointIndex"+s.toString(),h=document.getElementById(l),f.type!=i.opacity&&h.setAttribute("class","SelectionStyleSunburst"),this.selectedgroupID.push(h.id)}else f.type!=i.opacity&&(document.getElementById("selectionSunburst")||(o=this.createselectionStyle(t,f),document.body.appendChild(o)),t.setAttribute("class","SelectionStyleSunburst"),this.selelectedElementId=e),this.selectedgroupID.push(t.id)},w.prototype.findChild=function(n,t){for(var r=[],i=0;i<n.point.length;i++)n.point[i].point?(r.push(n.point[i]),this.findChild(n.point[i],t+1)):r.push(n.point[i]);r.layerNumber=t+1;r.layerIndex=n.point.layerData;this.childEle.push(r)},w.prototype.selectGroup=function(n,t){var s,f=this.model.selectionSettings,r,e,u,o,h;for(this.selectedgroupID=[],s=t.pointData[0].legendIndex,u=0;u<n.length;u++)if(n[u].layerNumber==1)r=document.getElementById(this._id+"_legendIndex"+s+"_layerNumber1_layerIndex0_pointIndex"+n[u].pointIndex.toString()),f.type!=i.opacity&&(e=this.createselectionStyle(r,f),document.body.appendChild(e),r.setAttribute("class","SelectionStyleSunburst")),this.selectedgroupID.push(r.id);else for(o=0;o<n[u].point.length;o++)r=document.getElementById(this._id+"_legendIndex"+s+"_layerNumber"+n[u].layerNumber.toString()+"_layerIndex"+n[u].layerIndex.toString()+"_pointIndex"+o.toString()),f.type!=i.opacity&&(h=document.getElementById("selectionSunburst"),h?r.setAttribute("class","SelectionStyleSunburst"):(e=this.createselectionStyle(r,f),document.body.appendChild(e),r.setAttribute("class","SelectionStyleSunburst"))),this.selectedgroupID.push(r.id)},w.prototype.removeSelection=function(n){for(var t=0;t<n.length&&document.getElementById(n[t])!=null;t++)document.getElementById(n[t]).getAttribute("class")=="SelectionStyleSunburst"&&document.getElementById(n[t]).removeAttribute("class")},w.prototype.findGroupElements=function(n){for(var i,u=n.pointData[0].groupNumber?n.pointData[0].groupNumber:n.pointData[0].pointIndex+1,r=[],t=0;t<this.layerData.length;t++)if(t==0)for(i=0;i<this.layerData[t].point.length;i++)this.layerData[t].point[i].groupNumber==u&&r.push(this.layerData[t].point[i]);else this.layerData[t].groupNumber==u&&(this.layerData[t].layerIndex=t,r.push(this.layerData[t]));return r},w.prototype.selectPointData=function(n){var t;document.getElementById("selectionSunburst")?(n.setAttribute("class","SelectionStyleSunburst"),this.selelectedElementId=n.id):(t=this.createselectionStyle(n,this.model.selectionSettings),document.body.appendChild(t),n.setAttribute("class","SelectionStyleSunburst"),this.selelectedElementId=n.id)},w.prototype.createselectionStyle=function(n,t){var i,r,u;return i=document.createElement("style"),i.type="text/css",r=t.color,u="1",i.innerHTML=" .SelectionStyleSunburst{ fill:"+r+";opacity:"+u+";stroke:;stroke-width:1}",i.setAttribute("id","selectionSunburst"),i},w.prototype.getSunburstPoint=function(n){var r,u,e,s,h,c,f,i,t,o;return f=this.calMousePosition(n),c=this.circularRadius,r=f.X,u=f.Y,i=this.model.startAngle,t=this.model.endAngle,s=this.areaBounds.actualWidth,h=this.areaBounds.actualHeight,o=this.model.startAngle*(Math.PI/180),this.sunburstRegions.forEach(function(n){var a=n.sunburstData,l=n.region,v,y,d,nt,p=0,h,f,s,w=[],g,b,c,k;if(d=a.innerRadius?a.innerRadius:0,v=r-a.centerX,y=u-a.centerY,nt=n.region,i=i<0?i+360:i,t=t<0?t+360:t,g=t-i,b=-.5*Math.PI+o,g<0){for(t=t/360,p=t?2*Math.PI*(t<0?1+t:t):0,h=(Math.atan2(y,v)-b-p)%(2*Math.PI),h<0&&(h=2*Math.PI+h),c=0;c<l.length;c++)if(f=parseFloat(l[c].startAngle.toFixed(14)),s=parseFloat(l[c].endAngle.toFixed(14)),f=f<0?2*Math.PI+f:f,s=s<0?2*Math.PI+s:s,f-=p,s-=p,f=parseFloat(f.toFixed(14)),s=parseFloat(s.toFixed(14)),h<=f&&h>=s){w.push(l[c]);break}}else for(h=(Math.atan2(y,v)-b)%(2*Math.PI),h<0&&(h=2*Math.PI+h),c=0;c<l.length;c++)if(f=parseFloat(l[c].startAngle.toFixed(14)),s=parseFloat(l[c].endAngle.toFixed(14)),f=f<0?2*Math.PI+f:f,s=s<0?2*Math.PI+s:s,f=parseFloat(f.toFixed(14)),s=parseFloat(s.toFixed(14)),h>=f&&h<=s){w.push(l[c]);break}w.length>0&&(k=Math.sqrt(Math.pow(Math.abs(v),2)+Math.pow(Math.abs(y),2)),k<=a.Radius&&k>d&&(e={pointData:w,location:{x:r,y:u}}))}),e},w.prototype.calMousePosition=function(n){var r,u,t,f,i,e,o;return t=this.mousePosition(n),n.pageX=t.x,n.pageY=t.y,f=document.getElementById(this._id+"_svg"),e=window.pageYOffset,o=window.pageXOffset,i=f.getBoundingClientRect(),r=n.pageX-o-i.left,u=n.pageY-e-i.top,{X:r,Y:u}},w.prototype.mousePosition=function(n){return!this.isNullOrUndefined(n.pageX)&&n.pageX>0?{x:n.pageX,y:n.pageY}:{x:0,y:0}},w.prototype.drawSunburstLegend=function(){var n=this.model.legend,i=this.model.legend.title,f,r=!1,u,e=this.elementSpacing;this.gLegendEle=this.createGroup({id:this._id+"_legend_group"});(n.position==t.top||n.postion==t.bottom)&&(f=this.height*(20/100));document.getElementById(this._id+"_svg").appendChild(this.gLegendEle);i.text!=""&&i.visible&&this.gLegendEle.appendChild(this.drawLegendTitle(i,n));u=this.drawlegendItem(n,this.legendCollection,r);this.drilldownCount==0&&(this.legendClick=this.legendClick.bind(this),this.legendItemGroup.addEventListener("click",this.legendClick,!0));this.gLegendEle.appendChild(u);this.legendPages.length>0&&this.drawScrollbuttons(n);this.legendPositioning(n,r)},w.prototype.legendPositioning=function(n,i){var f,c,l,o,p,e,a=this.elementSpacing,s,r,w,b,k,h,v,y;f=document.getElementById(this._id+"_legend_group");c=document.getElementById(this._id+"legendItem_Group");n.position==t.bottom||n.position==t.top?(l=document.getElementById(this._id+"legendItem_Group"),o=l.getBoundingClientRect(),p=o.width,e=this.width/2-p/2,s=n.position==t.bottom?this.isNullOrUndefined(n.size.height)?this.LegendBounds.Height-a:o.height+a:this.isNullOrUndefined(n.size.height)?0:this.LegendBounds.Height-o.top+a,r="translate("+e.toString()+",0)",l.setAttribute("transform",r),n.title.text!=""&&n.title.visible&&document.getElementById(this._id+"_LegendTitleText").setAttribute("transform",r),this.legendPages.length>0&&(w=document.getElementById(this._id).getBoundingClientRect(),e=this.width/2-document.getElementById("scrollButtons").getBoundingClientRect().width/2,n.position==t.bottom?s=o.bottom-w.top:n.position==t.top&&(s=o.top+o.height),r="translate("+e.toString()+","+s.toString()+")",document.getElementById("scrollButtons").setAttribute("transform",r))):n.position==t.left||n.position==t.right?(i||(h=void 0,v=(this.height-f.getBoundingClientRect().height-document.getElementById(this._id+"_legend_group").getBoundingClientRect().top)/2,n.position==t.left?r="translate("+this.elementSpacing.toString()+","+v.toString()+")":(this.isNullOrUndefined(n.size.width)?h=this.width-f.getBoundingClientRect().width-f.getBoundingClientRect().left-2*this.elementSpacing:(h=this.width-f.getBoundingClientRect().width-f.getBoundingClientRect().left-2*this.elementSpacing,h=h-n.size.width),r="translate("+h.toString()+","+v.toString()+")"),f.setAttribute("transform",r)),this.legendPages.length>0&&(o=f.getBoundingClientRect(),b=document.getElementById("scrollButtons").getBoundingClientRect(),e=o.width/2-b.width/2,s=o.height,r="translate("+e.toString()+","+s.toString()+")",document.getElementById("scrollButtons").setAttribute("transform",r))):n.title.visible&&n.title.text!=""&&(k=(c.getBoundingClientRect().width-document.getElementById(this._id+"_LegendTitleText").getBoundingClientRect().width)/2,r="translate("+k.toString()+",0)",document.getElementById(this._id+"_LegendTitleText").setAttribute("transform",r));(n.position==t.bottom||n.position==t.top)&&n.alignment!=u.center?n.alignment==u.near?(e=-Math.abs(c.getBoundingClientRect().left)+this.elementSpacing,r="translate("+e.toString()+"0)",f.setAttribute("transform",r)):n.alignment==u.far&&(e=Math.abs(c.getBoundingClientRect().right-c.getBoundingClientRect().width),e=e-(this.elementSpacing+this.model.margin.right),r="translate("+e.toString()+",0)",f.setAttribute("transform",r)):(n.position==t.left||n.position==t.right)&&n.alignment!=u.center&&(y=f.getAttribute("transform").split(" "),n.alignment==u.near?(e=f.getBoundingClientRect().left+this.elementSpacing,s=this.elementSpacing+this.model.margin.top,r=y[0]+","+s.toString()+")",f.setAttribute("transform",r)):(e=f.getBoundingClientRect().left+this.elementSpacing,s=this.areaBounds.actualHeight-f.getBoundingClientRect().height+this.elementSpacing+this.model.margin.bottom,r=y[0]+","+s.toString()+")",f.setAttribute("transform",r)))},w.prototype.drawScrollbuttons=function(n){var o=n.position,i,r,u,f,e;n.position!=t.float&&(r=this.createGroup({id:"scrollButtons"}),i={id:"scrollUp",d:"M 6 0 L 12 12 0 12 Z",fill:"#3E576F"},u=this.drawPath(i),r.appendChild(u),i={id:"scrollDown",d:"M 40.359375 0 L 52.359375 0 46.359375 12 Z",fill:"#3E576F"},u=this.drawPath(i),r.appendChild(u),i={id:"pageNumber",x:15,y:10,fill:n.font.color,"font-size":n.font.size,"font-style":n.font.fontStyle,"font-family":n.font.fontFamily,"font-weight":n.font.fontWeight,"text-anchor":"start"},e=this.currentpageNumber.toString()+"/"+this.totalpageNumbers,f=this.createText(i,e),r.appendChild(f),this.scrollClick=this.scrollClick.bind(this),r.addEventListener("click",this.scrollClick,!0));this.gLegendEle.appendChild(r)},w.prototype.scrollClick=function(n){var r=this.model.legend,o=n.target.id,i,u=this.currentpageNumber,s=this.totalpageNumbers,e,f;i=document.getElementById(this._id+"legendItem_Group");e=document.getElementById("pageNumber");o=="scrollDown"&&u!=s?(this.currentpageNumber=u+1,i.parentNode.removeChild(i),f=this.drawlegendItem(r,this.legendPages[this.currentpageNumber-1],!0),this.gLegendEle.appendChild(f),document.getElementById(this._id+"_svg").appendChild(this.gLegendEle),e.textContent=this.currentpageNumber.toString()+"/"+this.totalpageNumbers.toString(),this.legendClick=this.legendClick.bind(this),i.addEventListener("click",this.legendClick,!0)):o=="scrollUp"&&u!=1&&(this.currentpageNumber=u-1,i.parentNode.removeChild(i),f=this.drawlegendItem(r,this.legendPages[this.currentpageNumber-1],!0),this.gLegendEle.appendChild(f),document.getElementById(this._id+"_svg").appendChild(this.gLegendEle),e.textContent=this.currentpageNumber.toString()+"/"+this.totalpageNumbers.toString(),this.legendClick=this.legendClick.bind(this),i.addEventListener("click",this.legendClick,!0));(r.position==t.top||r.position==t.bottom)&&this.legendPositioning(r,!1)},w.prototype.drawLegendTitle=function(n,i){var h=n.text,f=this.measureText(n.text,n.font),s,e=this.elementSpacing,c=this.circularRadius[this.totallayerCount-1],r=0,u=0,o=n.font.color;o=this.isNullOrUndefined(o)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":o;i.position==t.bottom?u=this.areaBounds.actualHeight+f.height/2+e+this.yOffset:i.position==t.top?(u=e+this.yOffset+f.height/2,this.isNullOrUndefined(i.size.height)||(u=i.size.height+this.yOffset)):i.position==t.left||i.position==t.right?(u=e+this.model.margin.top,r-=e):(u=i.location.y,r=i.location.x);switch(n.textAlignment){case"far":r+=this.LegendBounds.Width-f.width/2;break;case"near":r+=f.width/2;break;case"center":r+=this.LegendBounds.Width/2}return this.legendTitleLocation={x:r,y:u,width:f.width,height:f.height},s={id:this._id+"_LegendTitleText",x:r,y:u,fill:o,"font-size":n.font.size,"font-style":n.font.fontStyle,"font-family":n.font.fontFamily,"font-weight":n.font.fontWeight,"text-anchor":"middle"},this.createText(s,n.text)},w.prototype.drawlegendItem=function(n,i,r){var f=0,e=0,a,s,h=this.model.legend.itemStyle,k,v,y=0,o,p,w,c,u,l,b;if(this.legendItemGroup=this.createGroup({id:this._id+"legendItem_Group"}),this.model.legend.position==t.bottom||this.model.legend.position==t.top)return this.drawBottomTopLegend(n,i);if(this.model.legend.position==t.left||this.model.legend.position==t.right)return this.drawLeftRightLegend(n,i,r);for(c=0,n.title.visible&&n.title.text!=" "?(a=this.measureText(n.title.text,n.title.font),e=n.location.y+a.height/2+this.elementSpacing):e=n.location.y,f=n.location.x,u=0;u<i.length;u++)f+=y+c,s=Math.sqrt(h.width*h.width+h.height*h.height)/2,k=i[u].visibility?i[u].fill:"grey",v=this.drawLegendShape(i[u],f,e,u),this.model.legendItemRendering&&(l=$.extend({},this.common),b={location:{x:f,y:e},text:i[u].Text,shape:i[u].sunburstLegendShape},l.data=b,this._trigger("legendItemRendering",l)),y=this.measureText(i[u].Text,i[u].font).width+s+this.model.legend.itemPadding,c=n.itemPadding,o=this.createGroup({id:this._id+"_svg_Legend"+u.toString()}),o.style.cursor="pointer",p={id:this._id+"_svg_LegendItemText"+u.toString(),x:f+s,y:e+s*3/4,fill:i[u].font.color,"font-size":i[u].font.size,"font-style":i[u].font.fontStyle,"font-family":i[u].font.fontFamily,"font-weight":i[u].font.fontWeight,"text-anchor":"start"},w=this.createText(p,i[u].Text),o.appendChild(v),o.appendChild(w),this.legendItemGroup.appendChild(o);return this.legendItemGroup},w.prototype.legendClick=function(n){var s,h,u,f=[],i={},a,e,r,t,o,c;if((this.rotateanim||this.model.enableAnimation)&&this.stopAnimation(),this.model.legend.clickAction==l.toggleSegmentVisibility){for(s=n.target.id,e=document.getElementById(s).parentNode,h=e.childNodes[1],a=e.childNodes[0],u=h.textContent,r=document.getElementById(this._id+"_svg"),r.parentNode.replaceChild(r.cloneNode(!1),r),t=0;t<this.legendCollection.length;t++)u==this.legendCollection[t].Text?this.legendCollection[t].visibility?(this.legendCollection[t].visibility=!1,i={x:this.legendCollection[t].x,y:this.legendCollection[t].y,fill:this.legendCollection[t].fill,text:this.legendCollection[t].Text,point:this.legendCollection[t].points}):(this.legendCollection[t].visibility=!0,f.push({x:this.legendCollection[t].x,y:this.legendCollection[t].y,fill:this.legendCollection[t].fill,text:this.legendCollection[t].Text,point:this.legendCollection[t].points})):this.legendCollection[t].visibility&&f.push({x:this.legendCollection[t].x,y:this.legendCollection[t].y,fill:this.legendCollection[t].fill,text:this.legendCollection[t].Text,point:this.legendCollection[t].points});this.model.legendItemClick&&(o=$.extend({},this.common),c={location:{x:i.x,y:i.y},text:u,point:i.point},o.data=c,this._trigger("legendItemClick",o));this.processData(f);this.legendClicked=!0;this.drawSunburst(this.layerData);this.legendClicked=!1}},w.prototype.drawLegendShape=function(n,t,i,r){var y=this.model.legend.itemStyle,e=y.width,u=y.height,p=n.visibility?n.fill:"grey",b=n.sunburstLegendShape,w="Path",k=n.visibility?this.model.legend.border.color:"grey",f,s=t+-e/2,d=i+-u/2,c,o,l,a,v,h;o={id:this._id+"_svg_LegendItemShape"+r.toString(),fill:p,stroke:k,"stroke-width":this.model.legend.border.width,x:s,y:d,width:e,height:u};switch(b){case"circle":w="Circle";c=Math.sqrt(u*u+e*e)/2;o.r=c;o.cx=t;o.cy=i;break;case"diamond":f="M "+s+" "+i+" L "+t+" "+(i+-u/2)+" L "+(t+e/2)+" "+i+" L "+t+" "+(i+u/2)+" L "+s+" "+i+" z";o.d=f;break;case"rectangle":f="M "+s+" "+(i+-u/2)+" L "+(t+e/2)+" "+(i+-u/2)+" L "+(t+e/2)+" "+(i+u/2)+" L "+s+" "+(i+u/2)+" L "+s+" "+(i+-u/2)+" z";o.d=f;break;case"triangle":f="M "+s+" "+(i+u/2)+" L "+t+" "+(i+-u/2)+" L "+(t+e/2)+" "+(i+u/2)+" L "+s+" "+(i+u/2)+" z";o.d=f;break;case"pentagon":for(l=72,c=Math.sqrt(u*u+e*e)/2,h=0;h<=5;h++)a=c*Math.cos(Math.PI/180*h*l),v=c*Math.sin(Math.PI/180*h*l),f=h===0?"M "+(t+a)+" "+(i+v)+" ":f.concat("L "+(t+a)+" "+(i+v)+" ");f=f.concat("Z");o.d=f;break;case"cross":f="M "+(t-e)+" "+i+" L "+(t+e)+" "+i+" M "+t+" "+(i+u)+" L "+t+" "+(i-u);o.d=f;o.stroke=p}return this["draw"+w](o)},w.prototype.drawBottomTopLegend=function(n,i){var rt=this.legendTitleLocation,v=this.model.margin,s=this.yOffset,c=0,tt=0,u=this.elementSpacing,nt,f,y,o,h=this.model.legend.itemStyle,w=this.model.legend.font.color,b,l=0,e,k,d,r,p,g;if(nt=this.isNullOrUndefined(w)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":w,this.isNullOrUndefined(n.rowCount||n.columnCount))for(this.legendItemGroup=this.createGroup({id:this._id+"legendItem_Group"}),n.title.visible&&n.title.text!=" "?(y=this.measureText(n.title.text,n.title.font),f=n.position==t.bottom?this.areaBounds.actualHeight+y.height+2*u+s:s+y.height+2*u):f=(n.position=t.bottom)?u+v.top+2*this.circularRadius[this.totallayerCount-1]+s+u:u+v.top+s+u,r=0;r<i.length;r++)if(c+=u+l+tt,o=Math.sqrt(h.width*h.width+h.height*h.height)/2,w=i[r].visibility?i[r].fill:"grey",c+l>900&&(f=f+this.measureText(i[r].Text,i[r].font).height+u,c=u),this.findLegendPosition(o,c,f,n,i[r]),this.legendInRegion)this.model.legendItemRendering&&(p=$.extend({},this.common),g={location:{x:c,y:f},text:i[r].Text,shape:i[r].sunburstLegendShape},p.data=g,this._trigger("legendItemRendering",p)),e=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),e.style.cursor="pointer",b=this.drawLegendShape(i[r],c,f,r),e.appendChild(b),l=this.measureText(i[r].Text,i[r].font).width+o*2,k={id:this._id+"_svg_LegendItemText"+r.toString(),x:c+u,y:f+o*3/4,fill:nt,"font-size":i[r].font.size,"font-style":i[r].font.fontStyle,"font-family":i[r].font.fontFamily,"font-weight":i[r].font.fontWeight,"text-anchor":"start"},tt=n.itemPadding,d=this.createText(k,i[r].Text),e.appendChild(d),this.legendItemGroup.appendChild(e);else{this.legendPaging(n,r,i);break}else{var ut=n.rowCount,ft=n.columnCount,it=i.length,a=10;for(n.title.visible&&n.title.text!=" "?(y=this.measureText(n.title.text,n.title.font),f=n.position==t.bottom?2*u+v.top+2*this.circularRadius[this.totallayerCount-1]+s+y.height:2*u+v.top+s+y.height):f=n.position==t.bottom?2*u+v.top+2*this.circularRadius[this.totallayerCount-1]+s:2*u+v.top+s,r=0;r<it;r++)if(w=i[r].visibility?i[r].fill:"grey",e=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),o=Math.sqrt(h.width*h.width+h.height*h.height)/2,a+i[r].Bounds.Width>this.LegendBounds.Width+10&&(a=l=10,f+=u+i[r].Bounds.Height),this.findLegendPosition(o,a,f,n,i[r]),this.legendInRegion)this.model.legendItemRendering&&(p=$.extend({},this.common),g={location:{x:a,y:f},text:i[r].Text,shape:i[r].sunburstLegendShape},p.data=g,this._trigger("legendItemRendering",p)),l=this.measureText(i[r].Text,i[r].font).width+o*2,e=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),e.style.cursor="pointer",b=this.drawLegendShape(i[r],a,f,r),e.appendChild(b),l=this.measureText(i[r].Text,i[r].font).width+o*2,k={id:this._id+"_svg_LegendItemText"+r.toString(),x:a+u,y:f+o*3/4,fill:nt,"font-size":i[r].font.size,"font-style":i[r].font.fontStyle,"font-family":i[r].font.fontFamily,"font-weight":i[r].font.fontWeight,"text-anchor":"start"},a+=l+u,d=this.createText(k,i[r].Text),e.appendChild(d),this.legendItemGroup.appendChild(e);else{this.legendPaging(n,r,i);break}}return this.legendItemGroup},w.prototype.drawLeftRightLegend=function(n,t,i){var c=0,it=0,d,o=0,s,u,e=this.model.legend.itemStyle,y=this.model.legend.font.color,p,g=0,f,w,b,a=0,nt=this.elementSpacing,rt=this.model.margin,r,l,k;if(d=this.isNullOrUndefined(y)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":y,this.isNullOrUndefined(n.rowCount||n.columnCount)){for(n.title.visible&&n.title.text!=" "&&(s=this.measureText(n.title.text,n.title.font),a=s.height+nt),o=a+nt+it,c=nt+rt.left,r=0;r<t.length;r++)if(s=this.measureText(t[r].Text,t[r].font),u=Math.sqrt(e.width*e.width+e.height*e.height)/2,y=t[r].visibility?t[r].fill:"grey",this.findLegendPosition(u,c,o,n,t[r]),this.legendInRegion)this.model.legendItemRendering&&(l=$.extend({},this.common),k={location:{x:c,y:o},text:t[r].Text,shape:t[r].sunburstLegendShape},l.data=k,this._trigger("legendItemRendering",l)),p=this.drawLegendShape(t[r],c,o,r),g+=s.width+u,f=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),w={id:this._id+"_svg_LegendItemText"+r.toString(),x:c+this.elementSpacing,y:o+u*3/4,fill:d,"font-size":t[r].font.size,"font-style":t[r].font.fontStyle,"font-family":t[r].font.fontFamily,"font-weight":t[r].font.fontWeight,"text-anchor":"start"},it=n.itemPadding,o+=s.height/2+this.elementSpacing,b=this.createText(w,t[r].Text),f.appendChild(p),f.appendChild(b),this.legendItemGroup.appendChild(f);else{this.legendPaging(n,r,t);break}return this.legendItemGroup}var ft=n.rowCount,et=n.columnCount,ut=t.length,v=10,h=26,tt=0;for(i||(this.LegendBounds.Height+=this.measureText(n.title.text,n.title.font).height),this.model.legend.title.visible&&this.model.legend.title.text!=" "&&(s=this.measureText(n.title.text,n.title.font),a=s.height),o=a+this.elementSpacing,c=this.elementSpacing+this.model.margin.left,r=0;r<ut;r++)if(y=t[r].visibility?t[r].fill:"grey",f=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),u=Math.sqrt(e.width*e.width+e.height*e.height)/2,h+t[r].Bounds.Height+n.itemPadding+a+2>this.LegendBounds.Height+26&&(h=26,v+=tt+n.itemPadding),h+=t[r].Bounds.Height/2+n.itemPadding,tt=Math.max(tt,t[r].Bounds.Width),this.findLegendPosition(u,v,h,n,t[r]),this.legendInRegion)this.model.legendItemRendering&&(l=$.extend({},this.common),k={location:{x:v,y:h},text:t[r].Text,shape:t[r].sunburstLegendShape},l.data=k,this._trigger("legendItemRendering",l)),g=this.measureText(t[r].Text,t[r].font).width+u*2,f=this.createGroup({id:this._id+"_svg_Legend"+r.toString()}),f.style.cursor="pointer",p=this.drawLegendShape(t[r],v,h,r),f.appendChild(p),g=this.measureText(t[r].Text,t[r].font).width+u*2,w={id:this._id+"_svg_LegendItemText"+r.toString(),x:v+u,y:h+u*3/4,fill:d,"font-size":t[r].font.size,"font-style":t[r].font.fontStyle,"font-family":t[r].font.fontFamily,"font-weight":t[r].font.fontWeight,"text-anchor":"start"},b=this.createText(w,t[r].Text),f.appendChild(b),this.legendItemGroup.appendChild(f);else{this.legendPaging(n,r,t);break}return this.legendItemGroup},w.prototype.legendPaging=function(n,t,i){var u=this.legendCollection.length,o=t,f,r,e;for(this.legendPages=[],this.currentpageNumber=1,this.totalpageNumbers=t==0?u:u%t==0?Math.floor(u/t):Math.floor(u/t)+1,r=0;r<u;r=r+o){for(f=[],e=0;e<o;e++)r+e<u&&f.push(i[r+e]);if(o==0){f.push(i[r]);this.legendPages.push(f);break}this.legendPages.push(f)}},w.prototype.findLegendPosition=function(n,i,r,u,f){var e=this.elementSpacing,o,s=20/100;u.position==t.bottom?this.legendInRegion=n+r+e>this.height-e?!1:!0:u.position==t.top?this.legendInRegion=this.yOffset+s*this.height-this.elementSpacing-n>r?!0:!1:(u.position==t.left||u.position==t.right)&&(this.isNullOrUndefined(u.rowCount)&&this.isNullOrUndefined(u.columnCount)?this.legendInRegion=n+r+e>this.height-e?!1:!0:(o=this.measureText(f.Text,f.font),this.legendInRegion=s*this.width+e>i+n+o.width?!0:!1))},w.prototype.drawDatalabel=function(n){var y,a,v;for(this.dataLabelGroupEle=this.createGroup({id:this._id+"_svg_DataLabelGroup"}),y=0;y<n.length;y++){var r=n[y],t=void 0,u=void 0,e=void 0,g=void 0,f=void 0,nt=void 0,tt=void 0,it=void 0,k=void 0,vt=void 0,d=void 0,p=void 0,w=void 0,rt=void 0,l=void 0,ut=void 0,ft=void 0,yt=void 0,s=void 0,h=void 0,et=void 0,ot=void 0,st=void 0,ht=void 0,b=void 0,ct=void 0,lt=void 0,i=this.model,pt=this.circularRadius[0]-this.innerRadius[0],at=void 0;for(a=0;a<r.point.length;a++)t=r.point[a],t.y!=null&&(b=r.layerNumber,u=t.text?t.text:i.dataSource?t.x:t.y.toString(),e=this.measureText(u,i.dataLabelSettings.font),g=-.5*Math.PI,k=this.circularRadius[r.layerNumber-1],yt=e.height/2,s=this.circleCenterX,h=this.circleCenterY,f=t.midAngle+g,et=this.getXcordinate(s,k,f),ot=this.getYcordinate(h,k,f),ct=this.getXcordinate(s,this.innerRadius[b-1],f),lt=this.getYcordinate(h,this.innerRadius[b-1],f),at={dMidX:ct,dMidY:lt},r.layerNumber>1&&(st=this.getXcordinate(s,this.circularRadius[r.layerNumber-2],f),ht=this.getYcordinate(h,this.circularRadius[r.layerNumber-2],f)),nt={midX:et,midY:ot},tt={childMidX:st,childMidY:ht},it={midPoint:nt,childMidPoint:tt,sunburstMidPoint:at},ft={startX:s,startY:h},vt={width:this.width,height:this.height},d=this.calculateLabelPosition(ft,it),p=d.positionX,w=d.positionY,rt="middle",l=this.textOptions(t,p,w,e,rt,r.layerNumber,a),this.isNullOrUndefined(i.dataLabelSettings.template)?(v=$.extend({},this.common),v.data={Text:u,location:{x:p,y:w},pointIndex:t.pointIndex},this._trigger("dataLabelRendering",v),i.dataLabelSettings.labelRotationMode==c.normal&&i.dataLabelSettings.labelOverflowMode!=o.none&&this.isNullOrUndefined(i.dataLabelSettings.template)?u=this.horizontalTrim(l,e.width,v.data.Text,s,h,t,this.model.dataLabelSettings.font,b-1):i.dataLabelSettings.labelRotationMode==c.angle&&i.dataLabelSettings.labelOverflowMode!=o.none&&this.isNullOrUndefined(i.dataLabelSettings.template)&&(u=this.rotatedTrim(l,e.width,v.data.Text,pt,t)),u!=""&&(ut=this.createText(l,u),this.dataLabelGroupEle.appendChild(ut))):this.labelTemplate(p,w,l,e,t))}return this.dataLabelGroupEle},w.prototype.labelTemplate=function(n,t,i,r,u){var l=this._id,o={interior:this.model.dataLabelSettings.fill,opacity:1,borderColor:"white",borderWidth:.1},s,f,e,h,c;s=!this.isNullOrUndefined(o)&&o.interior?o.interior:"transparent";e=document.getElementById(this._id+"_svg_DataLabelGroup");this.isNullOrUndefined(e)&&(e=document.createElement("div"),e.id=this._id+"_svg_DataLabelGroup",e.style.zIndex="5000",document.getElementById(this._id).appendChild(e));f=document.createElement("div");f.id="template_ele_"+this._id;this.clonenode=document.getElementById(this.model.dataLabelSettings.template).cloneNode(!0);this.clonenode.style.display="block";this.clonenode.innerHTML=this.parseTemplate(this.clonenode,u);f.style.backgroundColor=s;f.style.display="block";f.style.cursor="default";f.style.position="absolute";f.appendChild(this.clonenode);document.getElementById(this._id+"_svg_DataLabelGroup").appendChild(f);h=f.clientWidth;c=f.clientHeight;f.style.left=(i.x-h/2).toString()+"px";f.style.top=(i.y-c/2).toString()+"px"},w.prototype.parseTemplate=function(n,t){var i;return i=n.innerHTML,i.search("#point.x#")!=-1&&(i=i.replace("#point.x#",t.x.toString())),i.search("#point.y#")!=-1&&(i=i.replace("#point.y#",t.y.toString())),i.search("#point.text#")!=-1&&(i=this.isNullOrUndefined(t.text)?i.replace("#point.text#",t.y.toString()):i.replace("#point.text#",t.text.toString())),i},w.prototype.rotatedTrim=function(n,t,i,r){for(var u=this.model;r-u.segmentBorder.width<t;)if(u.dataLabelSettings.labelOverflowMode==o.trim)if(i=this.trimText(i,i.length,"..."),i=="..."){i="";break}else t=this.measureText(i,u.dataLabelSettings.font).width;else{i="";break}return i},w.prototype.trimText=function(n,t,i){var r,u;return t--,r=t-i.length,u=n.substr(0,r),u+i},w.prototype.horizontalTrim=function(n,t,i,r,u,f,e,s){var w=-.5*Math.PI,v,a,c,l,d="...",k,y,b,p=this.model,h;if(h=this.calculatePosition(n,t,r,u),v=p.startAngle,a=p.endAngle,k=a-v,v=(Math.atan2(h.rightEndY,h.rightEndX)-w)%(2*Math.PI),v<0&&(v=2*Math.PI+v),a=(Math.atan2(h.leftEndY,h.leftEndX)-w)%(2*Math.PI),a<0&&(a=2*Math.PI+a),c=parseFloat(f.start.toFixed(14)),l=parseFloat(f.end.toFixed(14)),k>0?(c=c,l=l):(c=c<0?2*Math.PI+c:c,l=l<0?2*Math.PI+l:l),v<0&&(a>0||a==null)&&(c=c<0?2*Math.PI+c:c,l=l<=0?2*Math.PI+l:l),y=this.circleCenterX<n.x?Math.sqrt(Math.pow(Math.abs(h.rightEndX),2)+Math.pow(Math.abs(h.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(h.leftEndX),2)+Math.pow(Math.abs(h.leftEndY),2)),k<0&&(l=[c,c=l][0]),a>=c&&a<=l&&v>=c&&v<=l&&y<=this.circularRadius[s]-p.segmentBorder.width&&y>0)b=!0;else{if(p.dataLabelSettings.labelOverflowMode==o.hide)return"";for(b=!1;!b;){if(i=this.trimText(i,i.length,d),i==d){i="";break}t=this.measureText(i,p.dataLabelSettings.font).width;h=this.calculatePosition(n,t,r,u);v=(Math.atan2(h.rightEndY,h.rightEndX)-w)%(2*Math.PI);v<0&&(v=2*Math.PI+v);a=(Math.atan2(h.leftEndY,h.leftEndX)-w)%(2*Math.PI);a<0&&(a=2*Math.PI+a);y=this.circleCenterX<n.x?Math.sqrt(Math.pow(Math.abs(h.rightEndX),2)+Math.pow(Math.abs(h.rightEndY),2)):Math.sqrt(Math.pow(Math.abs(h.leftEndX),2)+Math.pow(Math.abs(h.leftEndY),2));a>=c&&a<=l&&v>=c&&v<=l&&y<=this.circularRadius[s]&&y>0&&(b=!0)}}return i},w.prototype.calculatePosition=function(n,t,i,r){var u,f,e,o;return u=n.x+t/2-i,f=n.y-r,e=n.x-t/2-i,o=n.y-r,{rightEndX:u,rightEndY:f,leftEndX:e,leftEndY:o}},w.prototype.textOptions=function(n,t,i,r,u,f,e){var s,a=0,v,o=this.model.dataLabelSettings.font,h=o.color,l,y;return this.model.dataLabelSettings.labelRotationMode==c.angle&&((n.midAngle>2*Math.PI||n.midAngle<0)&&(s=this.findAngle(n.midAngle)),a=n.midAngle<=Math.PI||!this.isNullOrUndefined(s)?this.isNullOrUndefined(s)?(n.startAngle-Math.PI/2+(n.endAngle-Math.PI/2))/2*(180/Math.PI):s<=Math.PI?(n.startAngle-Math.PI/2+(n.endAngle-Math.PI/2))/2*(180/Math.PI):(n.startAngle+n.endAngle)*90/Math.PI-270:(n.startAngle+n.endAngle)*90/Math.PI-270),v=this._colorNameToHex(n.fill),(this.isNullOrUndefined(h)||h=="")&&(l=this._hexToRgb(v),y=Math.round((parseInt(l.r)*299+parseInt(l.g)*587+parseInt(l.b)*114)/1e3),h=y>=128?"black":"white"),{id:this._id+"_legendIndex"+n.legendIndex+"_layerNumber"+f.toString()+"_pointIndex"+e.toString(),x:t,y:i+r.height/4,fill:h,"font-size":o.size,"font-family":o.fontFamily,"font-style":o.fontStyle,"font-weight":o.fontWeight,opacity:o.opacity,"text-anchor":u,cursor:"default",transform:"rotate("+a+","+t+","+i+")"}},w.prototype._colorNameToHex=function(n){var t=n,i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",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",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:"#ff00ff",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",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#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:"#6b8e23",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return Object.prototype.toString.call(t)=="[object Array]"?t:typeof i[t.toLowerCase()]!="undefined"?i[t.toLowerCase()]:t},w.prototype._hexToRgb=function(n){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},w.prototype.findAngle=function(n){var t;if(n>0)if(t=n%(2*Math.PI),t>2*Math.PI)this.findAngle(t);else return t;else return 2*Math.PI+n},w.prototype.calculateLabelPosition=function(n,t){var i,r,u,f,e,o,c,l,s,h;return u=t.midPoint.midX,f=t.midPoint.midY,e=t.childMidPoint.childMidX,o=t.childMidPoint.childMidY,c=n.startX,l=n.startY,s=t.sunburstMidPoint.dMidX,h=t.sunburstMidPoint.dMidY,this.isNullOrUndefined(e)?(i=(u+s)/2,r=(f+h)/2):(i=(u+e)/2,r=(f+o)/2),{positionX:i,positionY:r}},w.prototype.drawPath=function(n){var t=document.getElementById(n._id);return t===null&&(t=this.createElement("path")),this.setAttributes(n,t),t},w.prototype.sunburstRender=function(n){var i,r,t;for(this.circleCenterX=[],this.circleCenterY=[],this.circularRadius=[],this.sunburstRegions=[],this.startX=[],this.startY=[],this._visiblePoints=n,this.calculateSliceAngle(n[0].point),i=2;i<=this.totallayerCount;i++)for(t=1;t<n.length;t++)i==n[t].layerNumber&&this.calculateChildAngle(n[t]);for(this.circularRadius=this.calculateRadius(this.areaBounds.actualWidth,this.areaBounds.actualHeight,this.totallayerCount),this._drillInnerRadius.length==0?this.circularRadius=this.calculateRadius(this.areaBounds.actualWidth,this.areaBounds.actualHeight,this.totallayerCount):(this.circularRadius=this._drillOuterRadius[this.drilldownCount-1],this.innerRadius=this._drillInnerRadius[this.drilldownCount-1]),this.gSeriesGroupEle=this.createGroup({id:this._id+"_svg_SunBurstElementGroup"}),r=this.totallayerCount;r>0;r--)for(t=0;t<n.length;t++)r==n[t].layerNumber&&this.drawRegion(n[t],t);return this.sunburstDoubleClick=this.sunburstDoubleClick.bind(this),this.gSeriesGroupEle.addEventListener("dblclick",this.sunburstDoubleClick,!0),this.gSeriesGroupEle},w.prototype.calculateArcData=function(n,t,i){var b,c,r,u,a,o,k,v,f,e,s,y,h,p,w,d,g;b=this.model.points;c=-.5*Math.PI;r=n.startAngle+c;u=n.endAngle+c-1e-6;a=this.model.endAngle-this.model.startAngle;o=u-r<Math.PI?0:1;k=(r+u)/2;n.currentMidAngle==undefined&&(n.currentMidAngle=(r+u)/2);s=a>0?1:0;o=s?u-r<Math.PI?0:1:u-r>-1*Math.PI?0:1;f=this.circleCenterX;e=this.circleCenterY;y=f+i*Math.cos(r);p=e+i*Math.sin(r);h=f+i*Math.cos(u);w=e+i*Math.sin(u);var nt=f+this.innerRadius[t-1]*Math.cos(r),tt=e+this.innerRadius[t-1]*Math.sin(r),l=f+this.innerRadius[t-1]*Math.cos(u),it=e+this.innerRadius[t-1]*Math.sin(u),rt=s?0:1;return r<0&&Math.round(n.endAngle-n.startAngle)==6&&(l=l-.01,h=h-.01),v="M "+y+" "+p+" A "+i+" "+i+" 0 "+o+" "+s+" "+h+" "+w+" L "+l+" "+it+" A "+this.innerRadius[t-1]+" "+this.innerRadius[t-1]+" 1 "+o+" "+rt+" "+nt+" "+tt+" z",{Direction:v,centerX:d,centerY:g}},w.prototype.findParent=function(n){for(var i,r=n.layerNumber-1,t=0;t<this._visiblePoints.length;t++)if(r==this._visiblePoints[t].layerNumber)for(i=0;i<this._visiblePoints[t].point.length;i++)if(this._visiblePoints[t].point[i].x==n.parentName&&this._visiblePoints[t].point[i].legendIndex==n.legendIndex)return this._visiblePoints[t].point[i]},w.prototype.drawRegion=function(n,t){var l,a,tt,r,f,b,k=[],d,g,e=this.model,v,y,o=e.segmentBorder.color,p,s,h,it,w,u,c,nt;for(v=this.model.startAngle*(Math.PI/180),h=e.selectionSettings,o=this.isNullOrUndefined(o)?this.model.theme.toString().search("dark")!=-1?"black":"white":o,u=0;u<n.point.length;u++)if(s=!1,y=e.opacity,!isNaN(n.point[u].startAngle)){for(r=n.point[u],it=r.fill,l=this.calculateArcData(r,n.layerNumber,this.circularRadius[n.layerNumber-1]),tt=l.Direction.split(" "),g=this.circularRadius[n.layerNumber-1],r.layerIndex=t,f=this._id+"_legendIndex"+r.legendIndex+"_layerNumber"+n.layerNumber.toString()+"_layerIndex"+t.toString()+"_pointIndex"+u.toString(),c=0;c<this.selectedgroupID.length;c++)f==this.selectedgroupID[c]&&(s=!0);h.type==i.opacity&&!s&&this.selectedgroupID.length>0&&(y=h.opacity);r.id=f;a={id:f,fill:r.fill,"stroke-width":e.segmentBorder.width,"stroke-dasharray":"",d:l.Direction,stroke:o,"stroke-linecap":"butt","stroke-linejoin":"round",opacity:y,radius:g,start:r.startAngle-1.57,end:r.endAngle-1.57,innerR:this.innerRadius[n.layerNumber-1],counterClockWise:!1,x:this.circleCenterX,y:this.circleCenterY,visibility:this._enableAnimation?"hidden":"visible"};p=$.extend({},this.common);p.data={point:r,pathOptions:a};this._trigger("segmentRendering",p);w=this.drawPath(a);s&&h.type==i.color&&this.selectPointData(w);this.gSeriesGroupEle.appendChild(w);b={x:r.x,y:r.y,fill:r.fill,text:r.text,layerNumber:n.layerNumber,layerIndex:t,parentName:n.parentName,pointIndex:u,startAngle:r.startAngle-v,endAngle:r.endAngle-v,startX:this.startX,startY:this.startY,groupNumber:n.groupNumber,id:f,legendIndex:r.legendIndex};k.push(b)}d={Radius:this.circularRadius[n.layerNumber-1],centerX:this.circleCenterX,centerY:this.circleCenterY,innerRadius:this.innerRadius[n.layerNumber-1]};nt={sunburstData:d,region:k};this.sunburstRegions.push(nt)},w.prototype.calculateRadius=function(n,t,i){var r=0,f=[],s,e=this.model.radius,c=Math.min(n,t),o,h=this.model.innerRadius,u;for(this.innerRadius=[],s=e>1?1:e<0?0:e,o=c/2*s,h!=0?this.innerRadius.push(h*o):this.innerRadius.push(0),u=0;u<i;u++)u==0?(r=(o-this.innerRadius[0])/i+this.innerRadius[0],f[u]=r):(this.innerRadius.push(r),r=r-this.innerRadius[u-1]+r,f[u]=r);return f},w.prototype.calculateSliceAngle=function(n){for(var v=n.length,o=0,u=360,i,s=this.model.margin,y,p,h,c=0,w,b,f,d,l=0,a=0,k=this.model.border.width,r=this.model.legend,e=0;e<v;e++)n[e].y=this.isNullOrUndefined(n[e].y)?this.isNullOrUndefined(n[e].point)?0:this.calculateSumofY(n[e],o):n[e].y,o+=n[e].y;for(this.model.startAngle>this.model.endAngle&&(this.model.endAngle==0?this.model.endAngle=360:this.model.endAngle<0&&(this.model.endAngle=360+this.model.endAngle)),u=this.model.endAngle!=null&&this.model.startAngle<this.model.endAngle?this.model.endAngle-this.model.startAngle:this.model.startAngle>this.model.endAngle&&!this.isNullOrUndefined(this.model.endAngle)?360-this.model.startAngle+this.model.endAngle:360,u=u!=360&&u!=-360?u%360:u,this.model.startAngle?(this.model.startAngle=this.model.startAngle%360,this.model.endAngle=this.model.startAngle+u,c=this.model.startAngle?o/360*this.model.startAngle:0,c=c/o):this.model.endAngle=u,r.visible&&(r.position==t.right||r.position==t.left?(l+=this.elementSpacing+this.LegendBounds.Width,this.isNullOrUndefined(r.size.width)||(l=parseFloat(r.size.width))):(r.position==t.bottom||r.position==t.top)&&(a+=this.elementSpacing+this.LegendBounds.Height,this.isNullOrUndefined(r.size.height)||(a=parseFloat(r.size.height)))),y=this.height-(a+s.top+s.bottom+k*2+this.yOffset),p=this.width-(l+s.left+s.right+k*2),this.circleCenterX=p*.5+s.left+(r.visible&&r.position==t.left?l:0),this.circleCenterY=y*.5+s.top+this.yOffset+(r.visible&&r.position==t.top?a:0),u=this.model.endAngle-this.model.startAngle,b=u/180,f=0;f<v;f++)i=n[f],i.startAngle=f==0?2*Math.PI*c:h,h=i.endAngle=b*Math.PI*(i.y/o)+i.startAngle,h=i.endAngle=isNaN(h)?i.startAngle:h,i.start=i.startAngle,i.end=i.endAngle,i.midAngle=(i.endAngle+i.startAngle)/2,i.pointIndex=f,w=-.5*Math.PI,i.radian=i.midAngle/2%(2*Math.PI),c+=i.y/o,d=i.midAngle+w,this.startX[f]=this.circleCenterX,this.startY[f]=this.circleCenterY},w.prototype.calculateTotaldegree=function(n,t){var i=0;return n<t?i=t-n:n>t&&(i=360-n+t),i},w.prototype.calculateSumofY=function(n,t){for(var r=n.point,i=0;i<r.length;i++)this.isNullOrUndefined(r[i].y)?this.isNullOrUndefined(r[i].point)||(r[i].y=this.calculateSumofY(r[i],t),t+=r[i].y):t+=r[i].y;return t},w.prototype.calculateChildAngle=function(n){for(var i,u,o,f=0,s,t,r=this.findParent(n),e=0;e<n.point.length;e++)f=f+n.point[e].y;for(s=r.y,u=i=r.startAngle,o=r.endAngle-r.startAngle,t=0;t<n.point.length;t++)t==0?(n.point[t].startAngle=u,n.point[t].start=u,i=n.point[t].y/f*o+u,n.point[t].end=n.point[t].endAngle=i,n.point[t].midAngle=(n.point[t].startAngle+n.point[t].endAngle)/2):(n.point[t].startAngle=i,n.point[t].start=i,i=n.point[t].y/f*o+i,n.point[t].end=n.point[t].endAngle=i,n.point[t].midAngle=(n.point[t].startAngle+n.point[t].endAngle)/2)},w.prototype.calculateSize=function(n,t){var o,s,u=this.model.border.width,i,f,h,c,l,r=this.model.margin,e=this.elementSpacing;return i=this._getLegendSpace(this.model.legend),f=i.leftLegendWidth+u+r.left,h=i.rightLegendWidth+r.right+r.left+2*u,c=n.width,o=c-(f+h),l=r.top+e+i.modelTitleHeight+i.modelsubTitleHeight+i.topLegendHeight+u,this.yOffset=t.text&&t.visible?this.titleLocation.size.height+e+(t.subtitle.text==""?0:t.subtitle.text&&t.subtitle.visible?this.subTitleLocatation.size.height:0):0,s=n.height-(i.modelTitleHeight+e+r.top+i.modelsubTitleHeight+i.topLegendHeight+i.bottomLegendHeight),{x:f,y:l,actualWidth:o,actualHeight:s}},w.prototype._getLegendSpace=function(n){var l=this.LegendActualBounds,f=this.elementSpacing,k=this.model.legend.border.width,e=0,r=0,u=0,o=0,a,c=this.model.legend.position,v=0,y=0,p=0,w,b,s,h,i=this.model.title;return f=this.legendClicked?0:f,n.visible&&(a=parseFloat(l.Width)+5+f+2*k,h=this.width*(20/100),e=c==t.left?a:0,e>h&&this.isNullOrUndefined(n.size.width)&&(e=h),r=c==t.right?a:0,r>h&&this.isNullOrUndefined(n.size.width)&&(r=h),s=this.height*(20/100),v=n.title.visible?this.measureText(n.title.text,n.title.font).height:0,u=c==t.top?f+parseFloat(l.Height)+v:0,o=c==t.bottom?f+parseFloat(l.Height)+v:0,u>s&&this.isNullOrUndefined(n.size.height)?u=s:o>s&&this.isNullOrUndefined(n.size.height)&&(o=s),this.LegendActualBounds.Height=u==0&&o!=0?o:u!=0?u:this.LegendActualBounds.Height,this.LegendActualBounds.Width=r==0&&e!=0?e:r!=0?r:this.LegendActualBounds.Width),y=this.measureText(i.text,i.font).height,p=this.measureText(i.subtitle.text,i.subtitle.font).height,w=i.text==""||!i.visible?0:y+f,b=i.subtitle.text==""||!i.subtitle.visible?0:p,{leftLegendWidth:e,rightLegendWidth:r,topLegendHeight:u,bottomLegendHeight:o,modelTitleHeight:w,modelsubTitleHeight:b}},w.prototype.calculateLegendBounds=function(){var r,it,k,w;this.legendCollection=[];this.legendRegion=[];this.legendTextRegion=[];this._legendMaxHeight=0;this._legendMaxWidth=0;var u=this.model.legend,h=10,et=u.size.height,ot=u.size.width,n=u.itemPadding>0?u.itemPadding:0,c=u.position.toLowerCase(),f=0,e=0,vt=this.height,yt=this.width,l=0,a=0,t=0,s=0,rt=1,st={},v=[],d=this.model.legend.rowCount,g=this.model.legend.columnCount,nt=this.elementSpacing,tt=this.measureText(u.title.text,u.title.font),ht=u.border.width,ct=this.model.border.width,pt=vt-(nt*4+ct*2+ht*2),wt=yt-(nt*4+ct*2+ht*2),o=[],lt,bt,ut,b,y,at,i,kt,p,ft;if(u.visible){for(o=this.layerData[0].point,lt=o.length,r=0;r<lt;r++)kt=o[r],bt=o[r].fill,ut=o[r].x,st={sunburstLegendShape:u.shape,Text:ut,displayText:ut,font:u.font,groupNumber:o[r].groupNumber,layerIndex:o[r].layerIndex,layerNumber:o[r].layerNumber,Shape:"None",visibility:!0,fill:o[r].fill,points:o[r].point,x:o[r].x,y:o[r].y},v.push(st);for(b=v.length,it=0;it<b;it++)y=v[it],at=u.itemStyle.width,i=this._getLegendSize(y),l=Math.max(this._legendMaxWidth>0?this._legendMaxWidth+n+at:i.Width,l),a=Math.max(i.Height,a);for(s=a+nt*2,t=l,(d||g)&&(ft=this.legendItemBounds(b,l+n,a+n),t=ft.LegendWidth,s=ft.LegendHeight,c==="top"||c==="bottom"||c==="custom"?s=s-n+nt:t=t-n),k=0;k<b;k++)y=v[k],i=this._getLegendSize(y),p=d||g?{Width:l,Height:a}:i,p._Width=i.Width,v[k].Bounds=p,this.legendCollection.push(y);for(w=0;w<b;w++)y=v[w],i=this._getLegendSize(y),d||g||(c=="top"||c=="bottom"||c=="custom"?(f+=i.Width+n,f>wt&&w!=0?(f-=i.Width+n,t=Math.max(t,f),f=i.Width+n,rt++,s+=a+n):t=Math.max(t,f),e=Math.max(e,a)):(e+=i.Height+n,e>pt?(e-=i.Height+n,s=Math.max(s,e),e=i.Height+n,t+=l+n):s=Math.max(s,e),f=Math.max(f,l))),p=d||g?{Width:l,Height:a}:i,p._Width=i.Width,v[w].Bounds=p;c==="top"||c==="bottom"||c==="custom"?(t=tt.width>t-n?tt.width+h*2+n:t+h*2,f+=h,e+=h*2,this.LegendBounds={Width:Math.max(t,f)-n,Height:Math.max(s,e),Rows:rt}):(t=tt.width>t-n?tt.width+h*2+n:t+h*2,f+=h,e+=h*2,this.LegendBounds={Width:Math.max(t,f),Height:Math.max(s,e)+h-n,Columns:rt})}else this.LegendBounds={Width:0,Height:0};this.LegendActualBounds=this.LegendBounds;ot!=null&&(this.LegendActualBounds.Width=ot);et!=null&&(this.LegendActualBounds.Height=et)},w.prototype._getLegendSize=function(n){var r=this.model.legend,t=r.itemStyle,i=this.measureText(n.Text,n.font),u=t.width+10+i.width,f=Math.max(t.height,i.height);return{Width:u,Height:f}},w.prototype.legendItemBounds=function(n,t,i){var r=this.model.legend,s,h=r.position,c=r.itemPadding,u,e,o=0,f=0;return this.isNullOrUndefined(r.columnCount)&&r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):this.isNullOrUndefined(r.rowCount)&&r.columnCount?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):r.rowCount&&r.columnCount&&(r.columnCount<r.rowCount?(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u):r.columnCount>r.rowCount?h==="top"||h==="bottom"||h==="custom"?(u=Math.ceil(n/r.columnCount),s=r.columnCount,o=t*s,f=i*u):(u=Math.ceil(n/r.columnCount),e=Math.ceil(n/u),o=t*e,f=i*u):h==="top"||h==="bottom"?(u=Math.ceil(n/r.columnCount),s=Math.ceil(n/r.rowCount),o=t*r.columnCount,f=i*s):(u=r.rowCount,e=Math.ceil(n/u),o=t*e,f=i*u)),f+=this.elementSpacing,{LegendWidth:o,LegendHeight:f}},w.prototype.drawTitle=function(n,t){var r,o,s,h,c,i,e=this.elementSpacing,f=n.font.color;return f=this.isNullOrUndefined(f)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":f,r=this.measureText(n.text,n.font),o=n.textAlignment==u.center?t.width/2-r.width/2:n.textAlignment==u.near?2*e:t.width-r.width-2*e,s=r.height/2+e,i=$.extend({},this.common),i.data={TitleText:n.text,location:{X:o,Y:s},size:r},this._trigger("titleRendering",i),h={id:this._id+"SunburstTitle",x:i.data.location.X,y:i.data.location.Y,fill:f,"font-size":n.font.size,"font-family":n.font.fontFamily,"font-style":n.font.fontStyle,"font-weight":n.font.fontWeight,opacity:n.font.opacity,"text-anchor":"start"},this.gTitleGroupElement=this.createGroup({id:this._id+"SunburstTitle"}),c=this.createText(h,i.data.TitleText),this.gTitleGroupElement.appendChild(c),this.titleLocation={size:r,x:i.data.location.X,y:i.data.location.Y},n.subtitle.text!=""&&n.subtitle.visible&&this.drawSubtitle(n,t,r,this.titleLocation),this.gTitleGroupElement},w.prototype.drawSubtitle=function(n,t,i,r){var s,e,o,h,c,l,f=n.subtitle.font.color;f=this.isNullOrUndefined(f)?this.model.theme.toString().indexOf("dark")!=-1?"white":"black":f;s=this.measureText(n.subtitle.text,n.subtitle.font);e=n.subtitle.textAlignment==u.far?r.x+r.size.width:n.subtitle.textAlignment==u.near?r.x:r.x+i.width/2;o=r.size.height+2*this.elementSpacing;l=n.subtitle.textAlignment==u.far?"end":n.subtitle.textAlignment==u.near?"start":"middle";h={id:this._id+"SunburstSunbtitle",x:e,y:o,fill:f,"font-size":n.subtitle.font.size,"font-family":n.subtitle.font.fontFamily,"font-style":n.subtitle.font.fontStyle,"font-weight":n.subtitle.font.fontWeight,opacity:n.subtitle.font.opacity,"text-anchor":l};this.subTitleLocatation={size:s,x:e,y:o};c=this.createText(h,n.subtitle.text);this.gTitleGroupElement.appendChild(c)},w.prototype.measureText=function(n,t){var r=document.querySelectorAll("#measureTex"),i;return r.length==0?(i=document.createElement("text"),i.setAttribute("id","measureTex"),document.body.appendChild(i)):(i=r[0],i.style.display="block"),i.innerHTML=n,i.style.fontSize=t.size,i.style.fontFamily=t.fontFamily,i.style.fontWeight=t.fontWeight,i.style.backgroundColor="white",i.style.position="absolute",i.style.visibility="hidden",i.style.whiteSpace="nowrap",{width:i.offsetWidth,height:i.offsetHeight}},w.prototype.drawContainerRect=function(){var n;return n={id:this._id+"_svg_svgRect",x:0,y:0,width:this.width,height:this.height,fill:this.model.background||"transparent",stroke:this.model.border.color,"stroke-width":this.model.border.width,opacity:"0.5"},this.drawRect(n)},w.prototype.processData=function(n){var r=n.length,i,t;for(this.findBaseData(n),t=0;t<n.length;t++)i=n[t],i.legendIndex=t,n[t].point&&this.findLayerData(n[t].point,n[t].x,1,n[t].groupNumber,t)},w.prototype.findBaseData=function(n){var i=[],t;for(this.layerData=[],t=0;t<n.length;t++)i.push(n[t]),i[t].groupNumber=t+1,i[t].layerIndex=0,i[t].layerNumber=1,i[t].legendIndex=t,n[t].groupNumber=t+1;this.layerData.push({point:i,layerNumber:1,legendIndex:0});this.totallayerCount=1},w.prototype.findLayerData=function(n,t,i,r,u){for(var e=[],f=0;f<n.length;f++)n[f].point?(n[f].legendIndex=u,this.findLayerData(n[f].point,n[f].x,i+1,r,u),n[f].layerIndex=this.layerData.length,e.push(n[f])):(n[f].legendIndex=u,n[f].layerIndex=this.layerData.length,e.push(n[f]));n.layerData=this.layerData.length;this.layerData.push({point:e,parentName:t,layerNumber:i+1,groupNumber:r,layerIndex:this.layerData.length,legendIndex:u});i+1>this.totallayerCount&&(this.totallayerCount=i+1)},w.prototype.setColors=function(n){for(var r=["#3082bd","#e55725","#9cbb59","#F6851F","#8165a3","#4fa045","#d456a0","#0dbdef","#e2a325","#03a09c"],i=this.model.palette,t=0;t<n.length;t++)this.isNullOrUndefined(n[t].fill)||this._sunburstRedraw?(this.isNullOrUndefined(i)||i.length!=0?(n[t].fill=this.isNullOrUndefined(i)?r[t%r.length]:i[t%i.length],n[t].fill.trim().length==0&&(n[t].fill="black")):n[t].fill="black",this.isNullOrUndefined(n[t].point)||this.setchildColors(n[t].point,n[t].fill)):this.isNullOrUndefined(n[t].point)||(n[t].fill.trim().length==0&&(n[t].fill="black"),this.setchildColors(n[t].point,n[t].fill))},w.prototype.setchildColors=function(n,t){t=t.trim().length==0?"black":t;for(var i=0;i<n.length;i++)this.isNullOrUndefined(n[i].fill)||this._sunburstRedraw?(n[i].fill=t,n[i].fill.trim().length==0&&(n[i].fill="black"),this.isNullOrUndefined(n[i].point)||this.setchildColors(n[i].point,t)):this.isNullOrUndefined(n[i].point)||this.setchildColors(n[i].point,t)},w.prototype.processDataSource=function(n){var h=this.model.levels.length,u=[],f=0,e,o,t,s,i,r;for(this.model.points=[],this.parentNames=[],this.levelNames=[],this.childProcess=undefined,i=0;i<n.length;i++)if(e=n[i],o=this.model.levels[f].groupMemberPath,t=e[o],s=$.inArray(t,u),s<0)this.model.points.push({x:t,y:n[i][this.model.valueMemberPath],layer:f+1,parentName:t,parentChildName:t}),u.push(t);else for(r=0;r<this.model.points.length;r++)this.model.points[r].x==t&&(this.model.points[r].y+=n[i][this.model.valueMemberPath]);this.model.levels.length>1&&this.createOtherLayerPoints(n,1)},w.prototype.createOtherLayerPoints=function(n,t){for(var o,e,i=n,s=this.model.levels[t].groupMemberPath,h,c=this.model.levels,f=this.model.points,r=0;r<i.length;r++){var u="",l="",v=0,a=void 0,y=void 0,p=void 0,w=void 0;for(o=0;o<=t;o++)y=c[o].groupMemberPath,l=i[r][y],this.isNullOrUndefined(l)||(u+=l+"_"),v==t&&(u=u.substring(0,u.length-1)),v++;if(p=$.inArray(u,this.levelNames),w=c[t-1].groupMemberPath,a=i[r][w],p<0&&!this.isNullOrUndefined(i[r][s]))this.levelNames.push(u),h=i[r][this.model.valueMemberPath],f.push({x:i[r][s],y:h,layer:t+1,parentChildName:u,parentName:a});else if(!this.isNullOrUndefined(i[r][s]))for(e=0;e<f.length;e++)f[e].parentName==a&&u==f[e].parentChildName&&(f[e].y+=h)}t<c.length-1?this.createOtherLayerPoints(i,t+1):(this._points=f,this.model.points=[],this.alignDataSourcePoints(i,1))},w.prototype.alignDataSourcePoints=function(n,t){for(var i,u=this.model.levels,r=t;r<u.length;r++)for(i=0;i<this._points.length;i++)if(r==this._points[i].layer)this.parentNames.push(this._points[i].parentName+"_layer_"+this._points[i].layer);else{r=u.length;break}this.findParentElements(this.model.points)},w.prototype.findParentElements=function(n){for(var r,t,i=0;i<this.parentNames.length;i++)for(r=this.parentNames[i],t=0;t<this._points.length;t++)r==this._points[t].x+"_layer_"+this._points[t].layer&&n.push(this._points[t]);(this.isNullOrUndefined(this.childProcess)||this.childProcess)&&this.findChildElements(n,0)},w.prototype.findChildElements=function(n,t){var i,r;this.visiblePoints=[];t<=n.length-1?(this.childProcess=!0,this.visiblePoints.push(n[t]),this.findOtherChildElements(this.visiblePoints,this.parentNames[t],2,0,i,r,t)):this.childProcess=!1},w.prototype.findOtherChildElements=function(n,t,i,r,u,f,e){for(var c,h,l,v,s=n,a,y=t.substring(0,t.indexOf("_layer_")),o=0;o<s.length;o++){for(s[o].point=[],c=0;c<this._points.length;c++)i==this._points[c].layer&&s[o].x==this._points[c].parentName&&this._points[c].parentChildName.indexOf(y)>=0&&s[o].point.push(this._points[c]);if(this.isNullOrUndefined(u))u=s,f=[],f.push({layer:i}),f[0].point=[];else if(r>=u[o].point.length){for(r>=u[o].point.length&&i>=this.model.levels.length&&this.findChildElements(this.model.points,e+1),r=0,h=0;h<s[o].point.length;h++)f[0].point.push(s[o].point[h]);u=f}else for(h=0;h<s[o].point.length;h++)f[0].point.push(s[o].point[h]);for(l=r;l<u[o].point.length;l++)r<u[o].point.length&&(i=r==0?i+1:i,r++,v=u[o].point[l],a=[],a.push(v)),this.childProcess&&this.findOtherChildElements(a,t,i,r,u,f,e)}},w.prototype.setSvgsize=function(n,t){var u,f,i,r,e,o;u=document.getElementById(t).clientWidth;f=document.getElementById(t).clientHeight;i=450;r=ej.isTouchDevice()?250:600;n.width==""||this.isResize&&this.model.isResponsive?u>0&&(r=u):(e=n.width,r=typeof e=="string"&&e.indexOf("%")!=-1?u/100*parseInt(e):parseFloat(n.width));this.width=r;this.container.setAttribute("width",r.toString());n.height!=""?(o=n.height,i=typeof o=="string"&&o.indexOf("%")!=-1?f/100*parseInt(o):parseFloat(n.height)):f>0&&(i=f);this.height=i;this.container.setAttribute("height",i.toString())},w.prototype.isNullOrUndefined=function(n){return n===undefined||n===null},w.prototype.createSvg=function(n){var t=this.createElement("svg");return this.setAttributes(n,t),t},w.prototype.drawPolygon=function(n){var t=document.getElementById(n.id);return this.isNullOrUndefined(t)&&(t=this.createElement("polygon")),this.setAttributes(n,t),t},w.prototype.createText=function(n,t){var i=this.createElement("text");return this.setAttributes(n,i),t&&(i.textContent=t),i},w.prototype.createGroup=function(n){var t=this.createElement("g");return this.setAttributes(n,t),t},w.prototype.drawRect=function(n){var t=document.getElementById(n._id);return t===null&&(t=this.createElement("rect")),this.setAttributes(n,t),t},w.prototype.drawCircle=function(n){var t=document.getElementById(n.id);return this.isNullOrUndefined(t)&&(t=this.createElement("circle")),this.setAttributes(n,t),t},w.prototype.createElement=function(n){return document.createElementNS("http://www.w3.org/2000/svg",n)},w.prototype.getXcordinate=function(n,t,i){return n+t*Math.cos(i)},w.prototype.getYcordinate=function(n,t,i){return n+t*Math.sin(i)},w.prototype.setAttributes=function(n,t){var r,u,i,f;for(r=Object.keys(n),u=r.map(function(t){return n[t]}),i=0,f=r.length;i<f;i++)t.setAttribute(r[i],u[i])},w}(ej.WidgetBase);n.SunburstChart=a;ej.widget("ejSunburstChart","ej.SunburstChart",new a);n.compareExtend=function(t,i,r){var e,o,u,f;if(typeof r=="object"&&r!==null)for(e=Object.keys(r),o=e.length,f=0;f<o;f++)u=e[f],i.hasOwnProperty(u)&&i[u]!=null?(Array.isArray(i[u])||typeof i[u]=="object"&&i[u]!==null)&&n.compareExtend({},i[u],r[u]):i[u]=r[u];return i};n.deepExtend=function(t){var u,i,r;for(t=t||{},u=1;u<arguments.length;u++)if(i=arguments[u],i)for(r in i)i.hasOwnProperty(r)&&(t[r]=typeof i[r]=="object"?n.deepExtend(t[r],i[r]):i[r]);return t}}(ejSunburstChart||(ejSunburstChart={})),function(n,t,i){t.olap=t.olap||{};t.olap.base={_initProperties:function(){this._columnHeaders=[];this._rowHeaders=[];this._valueCells=[];this.pivotEngine=[];this.olapCtrlObj=null;this._cBIndx=null;this._rBIndx=null;this._OlapDataSource;this._measureDt={};this._cTotIndexInfo=null;this._rTotIndexInfo=null;this._kpi=null;this._rowCount=0;this._colCount=0;this._isPaging=!1},_initControlProperties:function(n){n._drilledCellSet=n.model.enablePaging||n.model.enableVirtualScrolling?t.isNullOrUndefined(n._drilledCellSet)?[]:n._drilledCellSet:[];n.XMLACellSet=null;(t.isNullOrUndefined(n._fieldData)||!t.isNullOrUndefined(n._fieldData)&&t.isNullOrUndefined(n._fieldData.hierarchy))&&this._getFieldItemsInfo(n);this._currIndex={};this._isRowDrilled=!1;this._isColDrilled=!1;this._isNoSummary=n.model.layout=="nosummaries"?!0:!1},getJSONData:function(n,i,r){var u,o,e,f;n.action&&(n.action=="initialLoad"||n.action=="navPaging")&&(this._initControlProperties(r),this._applyTrim(r));this._initProperties();this.olapCtrlObj=r;this._OlapDataSource=i;u="";o=i.data;r.model.enableGroupingBar&&r._createGroupingBar(i);this._isPaging=this.olapCtrlObj.model.enablePaging||this.olapCtrlObj.model.enableVirtualScrolling?!0:!1;u=i.MDXQuery?i.MDXQuery:this._getParsedMDX(i,i.cube,n.action&&n.action!="navPaging"&&this._isPaging&&!t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?!0:!1);f=this._getConnectionInfo(this.olapCtrlObj.model.dataSource.data);e=t.isNullOrUndefined(i.providerName)||i.providerName==t.olap.Providers.SSAS?'<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+u+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+i.catalog+"<\/Catalog> <LocaleIdentifier>"+f.LCID+"<\/LocaleIdentifier> <\/PropertyList> <\/Properties><\/Execute> <\/Body> <\/Envelope>":'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command><Statement><![CDATA['+u+"]\]><\/Statement><\/Command><Properties><PropertyList><DataSourceInfo>"+i.sourceInfo+"<\/DataSourceInfo><Catalog>"+i.catalog+"<\/Catalog><AxisFormat>TupleFormat<\/AxisFormat><Content>Data<\/Content><Format>Multidimensional<\/Format><\/PropertyList><\/Properties><\/Execute><\/SOAP-ENV:Body><\/SOAP-ENV:Envelope>";n.action!="drilldown"||this._isPaging?this.olapCtrlObj.doAjaxPost("POST",f.url,{XMLA:e},n.action&&n.action!="navPaging"&&this._isPaging&&!t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?this._generatePagingData:this._generateJSONData,null,n):this.olapCtrlObj.doAjaxPost("POST",f.url,{XMLA:e},this._onDemandExpand,null,n)},_getParsedMDX:function(n,r,u){var o,e,f,c,s,h;if(n!=i){if(o="",s=n.providerName==t.olap.Providers.Mondrian,s&&n.columns.length==0&&!(n.values[0].axis=="columns"&&n.values[0].measures.length>0))return"";e=t.olap._mdxParser._getRowMDX(n);f=t.olap._mdxParser._getcolumnMDX(n);delete n._isCollapse;e=e.length>0?this._isPaging&&!u||s?"("+e+")":"NON EMPTY("+e+")":"";f=f.length>0?this._isPaging&&!u||s?"("+f+")":"NON EMPTY("+f+")":"";!this._isPaging||u||t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)||(h=this._getPagingQuery(e,f),e=h.rowQuery,f=h.columnQuery);c=t.olap._mdxParser._getSlicerMDX(n,this.olapCtrlObj);o="\nSelect \n"+(f==""?"{}":f)+"\ndimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON COLUMNS \n"+(e==""?"":","+e+"\ndimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON ROWS")+"\n "+t.olap._mdxParser._getIncludefilterQuery(n,r,this.olapCtrlObj)+c+"\n CELL PROPERTIES VALUE, FORMAT_STRING, FORMATTED_VALUE \n ";f==""&&o.replace(/NON EMPTY/g," ")}return o},_getPagingQuery:function(n,t){var i=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)==0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj._categCurrentPage)&&this._colCount>0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize):this.olapCtrlObj._categCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage),r=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)==0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj._seriesCurrentPage)&&this._rowCount>0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize):this.olapCtrlObj._seriesCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage),u=n;return{rowQuery:n!=""?"SUBSET({NONEMPTY("+n+(t!=""?","+t:"")+")},"+((r==0?1:r)-1)*this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize+","+this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize+")":"",columnQuery:t!=""?"SUBSET({NONEMPTY("+t+(u!=""?","+u:"")+")},"+((i==0?1:i)-1)*this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize+","+this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize+")":""}},_getAxisElementsUName:function(n){for(var i="",t=0;t<n.length;t++)i+=i==""?"{"+n[t].uniqueName+"}":", {"+n[t].uniqueName+"}";return i},_generatePagingData:function(i,r){var u,f,e;if(n(r).find("Error").length>0)return this.olapCtrlObj._createErrorDialog(n(r).find("faultstring").text(),i.action),!1;u=n(r).find("Axes, CellData");this._rowCount=u.find("Axis[name|='Axis1'] Tuple").length;this._colCount=u.find("Axis[name|='Axis0'] Tuple").length;f=this._getParsedMDX(this.olapCtrlObj.model.dataSource,this.olapCtrlObj.model.dataSource.cube,!1);e=this._getConnectionInfo(this.olapCtrlObj.model.dataSource.data);this.olapCtrlObj.doAjaxPost("POST",e.url,{XMLA:t.olap._mdxParser.getSoapMsg(f,this.olapCtrlObj.model.dataSource.data,this.olapCtrlObj.model.dataSource.catalog)},this._generateJSONData,null,i)},_generateJSONData:function(r,u){var o,s,h,y,w,p,c,l,a,f,e,v;if(this.olapCtrlObj.model.dataSource=this._OlapDataSource,this._isPaging&&r.action=="drilldown"&&this._onDemandExpand(r,u),o=[],s=[],n(u).find("Error").length>0)return t.Pivot._createErrorDialog(n(u).find("faultstring").text(),"Error",this.olapCtrlObj),!1;if(n(u).find("Axis[name|='SlicerAxis']").remove(),this.olapCtrlObj.XMLACellSet=n(u).find("Axes, CellData"),w=[],r=="onDemandDrill"&&(this.olapCtrlObj.XMLACellSet=u),h=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple"),y=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple"),h.length>0){if(p=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),this._rowHeaders=this._getHeaderCollection(y,"rowheader"),this._columnHeaders=this._getHeaderCollection(h,"colheader"),this._valueCells=this._getValueCells(p,h.length),indexRCell=this._measureDt.axis=="rowheader"?t.sum(this._rowHeaders.maxLvlLen)+1:t.sum(this._rowHeaders.maxLvlLen),indexCCell=this._measureDt.axis=="colheader"?t.sum(this._columnHeaders.maxLvlLen)+1:t.sum(this._columnHeaders.maxLvlLen),this._rowHeaders.headers.length>0&&t.sum(this._rowHeaders.maxLvlLen)==0&&(indexRCell=this._rowHeaders.headers[0].length),this._columnHeaders.headers.length>0&&t.sum(this._columnHeaders.maxLvlLen)==0&&(indexCCell=this._columnHeaders.headers[0].length),this._isPaging)for(f=0;f<this._rowHeaders.headers.length;f++)for(e=0;e<this._columnHeaders.headers.length;e++)t.isNullOrUndefined(this._valueCells[f])?(this._valueCells[f]=[],this._valueCells[f][e]={FormatString:"#,#",Value:""}):t.isNullOrUndefined(this._valueCells[f][e])&&(this._valueCells[f][e]={FormatString:"#,#",Value:""});for(this._populateEngine(this._rowHeaders.headers,this._columnHeaders.headers,this._valueCells),n(this.olapCtrlObj).find(".pivotGridTable").remove(),this.olapCtrlObj._measureDt=this._measureDt,c=this._rowHeaders.headers.length+indexCCell,l=this._columnHeaders.headers.length+indexRCell,this.pivotEngine.length>1&&(c=this.pivotEngine.length),f=0;f<c;f++)for(e=0;e<l;e++)o[e]==i&&(o[e]=[]),this.pivotEngine[f]!=i&&this.pivotEngine[f][e]!=i?(o[e][f]={Index:e+","+f,CSS:this.pivotEngine[f][e].CSS==""?"none":this.pivotEngine[f][e].CSS==i?"value":this.pivotEngine[f][e].CSS,Value:this.pivotEngine[f][e].Value,State:this.pivotEngine[f][e].ChildCount>0?2:this.pivotEngine[f][e].ChildCount<0?1:0,RowSpan:this.pivotEngine[f][e].RowSpan!=i?this.pivotEngine[f][e].RowSpan:1,ColSpan:this.pivotEngine[f][e].ColSpan!=i?this.pivotEngine[f][e].ColSpan:1,Info:this.pivotEngine[f][e].UName+"::"+this.pivotEngine[f][e].LName+"::"+this.pivotEngine[f][e].Value+"::"+this.pivotEngine[f][e].PUName,Span:this.pivotEngine[f][e].Span=="Block"?"Block":"None",Expander:1},this.pivotEngine[f][e].kpiInfo&&(o[e][f].kpi=this.pivotEngine[f][e].kpi,o[e][f].kpiInfo=this.pivotEngine[f][e].kpiInfo),this.pivotEngine[f][e].ActualValue&&(o[e][f].ActualValue=this.pivotEngine[f][e].ActualValue)):this.pivotEngine[f]!=i&&(a="none",f<indexCCell&&e<indexRCell&&(a="rowheader"),o[e][f]={Index:e+","+f,CSS:a,Value:"",State:0,RowSpan:1,ColSpan:1,Info:"",Span:"Block",Expander:0});for(f=0;f<l;f++)for(e=0;e<c;e++)o[f]!=i&&o[f][e]!=i&&s.push(o[f][e]);for(v=0,index=0;index<s.length;index++)if(parseInt(s[index].Index.split(",")[0])==0)v++;else break}this.olapCtrlObj._pivotRecords={records:s,rowCount:v};typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotGrid"?typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotChart"&&typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotGauge"&&typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotTreeMap"?(this._renderPager(r),this.olapCtrlObj.generateJSON({baseObj:this,tranposeEngine:o,jsonObj:s})):this.olapCtrlObj.generateJSON({baseObj:this},o):this._renderPivotGrid(r,s);this._columnHeaders=this._rowHeaders=this._valueCells=this.pivotEngine=[];this._cBIndx=this._rBIndx=null;this._measureDt={axis:"",posision:null};this._cTotIndexInfo=this._rTotIndexInfo=null},_renderPager:function(n){var i,r,u,f;this._isPaging&&n.action!="navPaging"&&(t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?this.olapCtrlObj.model.enablePaging&&(u={CategorialCurrentPage:1,CategorialPageSize:1,SeriesCurrentPage:1,SeriesPageSize:1},f={Column:1,Row:1},this.olapCtrlObj._pagerObj.initPagerProperties(f,u),this.olapCtrlObj._pagerObj.element.css("opacity","0.5"),this.olapCtrlObj._pagerObj.element.find(".pagerTextBox").attr("disabled","disabled"),this.olapCtrlObj._pagerObj._unwireEvents()):(i=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)==0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj._categCurrentPage)?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize):this.olapCtrlObj._categCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage),r=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)==0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj._seriesCurrentPage)?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize):this.olapCtrlObj._seriesCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage),i=i==0?1:i,r=r==0?1:r,this._colCount=this._colCount==0?1:this._colCount,this._rowCount=this._rowCount==0?1:this._rowCount,this.olapCtrlObj.model.enablePaging?(u={CategorialCurrentPage:i,CategorialPageSize:this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize,SeriesCurrentPage:r,SeriesPageSize:this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize},f={Column:this._colCount,Row:this._rowCount},this.olapCtrlObj._pagerObj.element.css("opacity","1"),this.olapCtrlObj._pagerObj.element.find(".pagerTextBox").removeAttr("disabled"),this.olapCtrlObj._pagerObj._unwireEvents(),this.olapCtrlObj._pagerObj._wireEvents(),this.olapCtrlObj._pagerObj.initPagerProperties(f,u)):this.olapCtrlObj.model.enableVirtualScrolling&&(this.olapCtrlObj._categPageCount=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize),this.olapCtrlObj._seriesPageCount=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)),this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage=this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage=0,this.olapCtrlObj._categCurrentPage=i,this.olapCtrlObj._seriesCurrentPage=r,t.isNullOrUndefined(this.olapCtrlObj._pivotGrid)||(this.olapCtrlObj._pivotGrid._categCurrentPage=i,this.olapCtrlObj._pivotGrid._seriesCurrentPage=r,this.olapCtrlObj._pivotGrid._categPageCount=this.olapCtrlObj._categPageCount,this.olapCtrlObj._pivotGrid._seriesPageCount=this.olapCtrlObj._seriesPageCount)))},_renderPivotGrid:function(n,i){this.olapCtrlObj._dataModel="XMLA";this.olapCtrlObj.setJSONRecords(JSON.stringify(i));this.olapCtrlObj.setOlapReport(this.olapCtrlObj.model.dataSource);this._renderPager(n);this.olapCtrlObj.model.enableGroupingBar&&this.olapCtrlObj._createGroupingBar(this.olapCtrlObj.model.dataSource);this.olapCtrlObj.model.layout!=null&&this.olapCtrlObj.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.olapCtrlObj.excelLikeLayout(i):this.olapCtrlObj.renderControlFromJSON(i);n.action&&(n.action=="initialLoad"||n.action=="navPaging")&&(this.olapCtrlObj._trigger("renderSuccess",this.olapCtrlObj),this.olapCtrlObj._fieldData={hierarchy:this.olapCtrlObj._fieldData.hierarchy,measures:this.olapCtrlObj._fieldData.measures})},_onDemandExpand:function(t,i){var et=i,f,it,r="",e=this.olapCtrlObj.XMLACellSet,b,k,d=n(this.olapCtrlObj.XMLACellSet).find("Axis[name='Axis0'] Tuple").length,c=n(this.olapCtrlObj.XMLACellSet).find("Axis[name='Axis1'] Tuple").length,y,rt=0,ut=0,h,u,nt,ft,tt;c=c?c:1;rt=n(i).find("CellData Cell").length;ut=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell").length;it=t.cellInfo.previousElements.split(">#>");var l=n(i).find("Axis[name|='Axis0'] Tuple"),a=n(i).find("Axis[name|='Axis1'] Tuple"),b=l.length;k=a.length;n(i).find("Axis[name='SlicerAxis']").remove();var g=t.cellInfo.itemPosition,v,p,o=0,s=!1,w="";for(p=t.cellInfo.axis=="rowheader"?a[0]:l[0],r=v=n(p).find("Member:nth-child("+(g+1)+") PARENT_UNIQUE_NAME").text(),h=g+1;h>0;h--)e=n(e).find("Tuple Member:nth-child("+h+") UName:contains('"+v+"')").parents("tuple"),v=n(p).find("Member:nth-child("+(h-1)+") UName").text(),w=v+w;if(r=w+r,y=e.index()+1,r=t.cellInfo.previousElements.split(">#>").join().replace(/,/g,""),f=t.cellInfo.preRepItm.split(">#>").join().replace(/,/g,""),this.olapCtrlObj._drilledCellSet&&(o=this.olapCtrlObj._drilledCellSet.length),r=r+" !#"+t.cellInfo.axis,this.olapCtrlObj._drilledCellSet[0]&&o)for(u=0;u<o;u++){for(nt=this.olapCtrlObj._drilledCellSet[u].length,ft=t.cellInfo.parentUniqueName,cEllen=0;cEllen<nt;cEllen++)if(t.cellInfo.previousElements.startsWith(this.olapCtrlObj._drilledCellSet[u][cEllen].key)){this.olapCtrlObj._drilledCellSet[u].push({key:r,repItms:f});s=!0;break}else if(this.olapCtrlObj._drilledCellSet[u][cEllen].key.startsWith(t.cellInfo.previousElements)){this.olapCtrlObj._drilledCellSet[u].splice(cEllen,0,{key:r,repItms:f});s=!0;break}if(s)break}else this.olapCtrlObj._drilledCellSet[0]=[],this.olapCtrlObj._drilledCellSet[0][0]={key:r,repItms:f},s=!0;s||(this.olapCtrlObj._drilledCellSet[o]=[],this.olapCtrlObj._drilledCellSet[o].push({key:r,repItms:f}));this._isPaging||(t.cellInfo.axis=="rowheader"?(tt=n(i).find("Axis[name|='Axis1'] Tuple"),this._insertCellSet("rowheader",e,a,l,k,d,b,y,i)):(tt=n(i).find("Axis[name|='Axis1'] Tuple"),this._insertCellSet("colheader",e,l,a,c,d,b,y,i)),this._generateJSONData("onDemandDrill",this.olapCtrlObj.XMLACellSet))},_insertCellSet:function(t,i,r,u,f,e,o,s,h){var g=n(n(h).find("CellData Cell")[0]).clone(),a,l,c,v,it;n(g).find("FmtValue").text("");i.length>1?n(i[0]).after(r):n(i).after(r);l=e;t=="rowheader"?a=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple"):(a=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple"),l=o);var y=0,nt=n(a).filter(function(t,i){if(u[y]&&n(i).find("UName").text()==n(u[y]).find("UName").text())return y++,!0}),p=0,w=!1;for(c=0;c<f;c++){var tt="",b=0,k=0,d;for(d=t=="rowheader"?(s+c)*l:c*(e+l)+s,v=0;v<l;v++)(t!="rowheader"||n(nt[b]).index()!=v)&&(t!="colheader"||n(nt[p]).index()!=c)&&a.length?n(this.olapCtrlObj.XMLACellSet).find("CellData Cell:nth-child("+(d+k)+")").after(n(g).clone()):(it=t=="rowheader"?c*o:p*o,tt=n(n(h).find("CellData Cell")[it+b]).clone(),n(this.olapCtrlObj.XMLACellSet).find("CellData Cell:nth-child("+(d+k)+")").after(tt),b++,w=!0),k++;t=="colheader"&&(w&&p++,w=!1)}this._setCellOrdinal(this.olapCtrlObj.XMLACellSet[1])},_clearDrilledCellSet:function(){for(var u=n.extend([],this.olapCtrlObj._drilledCellSet),t="",i,r=0;r<u.length;r++)t=u[r][0].key.split("!#"),t.length&&(i=this._getDrilledMemeber({item:{previousElements:t[0]}})),i.length&&this._onDemandCollapse({drilledMembers:i,action:""},t[1])},_onDemandCollapse:function(i,r){var u,f;f=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple");u=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple");try{this.olapCtrlObj.model.dataSource=t.olap._mdxParser._clearCollapsedItems(r,i.drilledMembers[i.drilledMembers.length-1],this.olapCtrlObj.model.dataSource);i.drilledMembers=i.drilledMembers.splice(0,i.drilledMembers.length-1)}catch(e){this.olapCtrlObj._ogridWaitingPopup.hide()}i.drilledMembers.length?this._onDemandCollapse({drilledMembers:i.drilledMembers,action:i.action},r):i.action=="collapse"&&(this.olapCtrlObj.model.dataSource._isCollapse=!0,delete this._currIndex.axis,this.getJSONData({action:"onDemandCollapse"},this.olapCtrlObj.model.dataSource,this.olapCtrlObj))},_removeCellSets:function(t,i,r,u,f,e){for(var c,s,v,p,o,l=t.length,h,y,w=f[0],a=0;a<i.length;a++)if(n(i[a]).find("UName").text()==n(w).find("UName").text()){y=i[a];break}if(c=l,s=n(y).index(),s)if(e=="rowheader"){for(h=r.length;c>0;)n(n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple")[s]).remove(),c--;for(o=ext=s;o<ext+l;o++)v=n(n(this.olapCtrlObj.XMLACellSet).find("CellData Cell")).splice(s*h,h),n(v).remove()}else{for(h=i.length,p=r.length;c>0;)n(n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple")[s]).remove(),c--;for(o=0;o<p;o++)v=n(n(this.olapCtrlObj.XMLACellSet).find("CellData Cell")).splice(h*o-o*l+s,l),n(v).remove()}this._setCellOrdinal(this.olapCtrlObj.XMLACellSet[1])},_getDrilledMemeber:function(t){var e=[],u,i,r,f;for(keyVal=t.item.previousElements.split(">#>").join().replace(/,/g,""),u=this.olapCtrlObj._drilledCellSet,e=n.map(this.olapCtrlObj._drilledCellSet,function(t){return e=n.map(t,function(n){if(n.key.startsWith(keyVal))return n})}),i=0;i<u.length;i++)for(r=0,f=u[i];u[i]&&r<u[i].length;r++)f[r]&&f[r].key.startsWith(keyVal)&&(f.splice(r,1),r--,f.length||(u.splice(i,1),i--));return e},_getHeaderCollection:function(t,r){var f,lt,c=[],tt,it="",w=[],k=null,rt={},p={},o=this,at,e,pt,ot,st,ht,ct,u,ft,h,dt,y,gt,nt;if(f=n(t).filter(function(t,i){var f=n(i).find("Member"),e=n(f[0]).find("LName").text().indexOf("[(All)]")!=-1,l=e?1:0,s=0,u,h;for(k=null,e?(tt=0,it="total"):(it="",tt=f.length),u=1,n(f[0]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1&&(u=0),u;u<f.length;u++)n(f[u]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1?(s=e,p.axis=r,p.posision=u,parseInt(n(f[u]).find("MEMBER_TYPE").text())==4&&(h=n(f[u]).find("UName").text().toLowerCase(),h.indexOf("trend]")!=-1?(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text(),"trend"))&&(k="trend",p.isKpiExist=!0)):h.indexOf("status]")!=-1?(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text(),"status"))&&(k="status",p.isKpiExist=!0)):h.indexOf("goal]")!=-1&&(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text()+"::"+n(f[u]).find("Caption").text(),"goal"))&&(k="goal",p.isKpiExist=!0)))):s=n(f[u]).find("LName").text().indexOf("[(All)]")!=-1,(e==!1&&s==!0||e==!0&&s==!1)&&(l++,tt=u,it="total"),e=s;return lt=t,l<2&&c.push({selIndx:lt,totLvl:tt,type:it,kpi:k,kpiInfo:rt}),l<2}).map(function(t,u){for(var s,a,l,e=n(u).find("Member"),h=[],f=0;f<e.length;f++)s=parseInt(n(e[f]).find("LNum").text()),r=="colheader"&&o._OlapDataSource.columns[f]?o._OlapDataSource.columns[f].hasAllMember&&(s+=1):r=="rowheader"&&o._OlapDataSource.rows[f]&&o._OlapDataSource.rows[f].hasAllMember&&(s+=1),a=n(e[f]).find("PARENT_UNIQUE_NAME").length?n(e[f]).find("PARENT_UNIQUE_NAME").text():"",h.push({CSS:r,Value:n(e[f]).find("Caption").text()==""?"(Blank)":n(e[f]).find("Caption").text(),ColSpan:1,RowSpan:1,HUName:n(e[f]).attr("Hierarchy"),LName:n(e[f]).find("LName").text(),UName:n(e[f]).find("UName").text(),ChildCount:parseInt(n(e[f]).find("CHILDREN_CARDINALITY").text()),PUName:a,LNum:s,MemberType:parseInt(n(e[f]).find("MEMBER_TYPE").text())}),n(e[f]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1&&c[t].kpi&&(h[h.length-1].kpiInfo=c[t].kpiInfo,h[h.length-1].kpi=c[t].kpi),w[f]==i?w[f]=s:w[f]<s&&(w[f]=s);return l=[],l[0]=h,l}),r=="colheader"?this._cTotIndexInfo=c:this._rTotIndexInfo=c,f={headers:f,indxInfo:c,maxLvlLen:w},n.isEmptyObject(p)||(this._measureDt=n.extend({},p)),at=1,r.indexOf(this._OlapDataSource.values[0].axis.substring(0,3))>-1&&(at=this._measureDt.measureCount=this._OlapDataSource.values[0].measures.length),!this._OlapDataSource._enableBasicEngine&&!this._isPaging){var v={headers:[],indxInfo:[]},ni=c,s=c.length,et=v.length,ut=[],vt=[];try{for(u=0;u<s;u++)u<s&&f.indxInfo[u].type=="total"&&(v.indxInfo.push(f.indxInfo.splice(u,1)[0]),v.headers.push(f.headers.splice(u,1)[0]),s--,u--);var b=f.headers.length>0?f.headers[0].length:0,yt=0,d=0;for(this._measureDt.posision==b-1&&this._measureDt.axis==r&&(d=1),s=f.headers.length,u=0;u<=s;u++){var h=null,ft=null,l=null,a=null;for(a=this._updateMemberVariables(f.headers,h,ft,l,u),h=a.prev,ft=a.next,l=a.cur,a=null,e=b-2-d;e>=0;e--)if(pt=this._comparePrevMembers(f.headers,s,u,e,b,-2),u==s||u>0&&(h&&h[e].UName!=l[e].UName||h[e].UName==l[e].UName&&pt))if(l&&h[e].UName==l[e].PUName)ot=this._removeSubtotalMembers(f,u,e),u-=ot,s-=ot,a=this._updateMemberVariables(f.headers,h,ft,l,u),h=a.prev,ft=a.next,l=a.cur,a=null;else{var wt=h,et=0,g,bt=0,kt=0;for(h&&(kt=h[e].LNum),l&&(bt=l[e].LNum),st=!1,ht=bt;ht<=kt;ht++){for(g=this._getSummaryHeaders(wt,v,e,st,d),et=g.headers.length;g.headers.length>0;)f.headers.splice(u,0,g.headers.pop()),f.indxInfo.splice(u,0,g.indexInfo.pop());st=!0;u+=et;s+=et;wt=f.headers[u-1]}}if(u==s&&v.headers.length>0){for(ct=0;v.headers.length>0;)f.headers.splice(u,0,v.headers.pop()),f.indxInfo.splice(u,0,v.indxInfo.pop()),s++,ct++;u+=ct}}var e=0,dt="";for(ut={headers:[],indxInfo:[]},e=b-1-d,s=f.headers.length,u=0;u<s;u++)if(h=this._findPreviousMember(f.headers,u-1,e),u>0&&f.headers[u-1][e].UName!=f.headers[u][e].UName&&e==b-1-d&&w[e]>1){if(u>0&&f.headers[u]!=i&&f.headers[u-1][e].LNum!=0&&f.headers[u-1][e].UName==f.headers[u][e].PUName)for(y=h;y<0;y++)f.indxInfo[u+y].lnum=f.headers[u+y][e].LNum,f.indxInfo[u+y].type="total",ut.indxInfo.push(f.indxInfo.splice(u+y,1)[0]),ut.headers.push(f.headers.splice(u+y,1)[0]),u+1==s?dt=f.headers[u][e].PUName:(u--,s--);(u!=0&&f.headers[u]!=i&&f.headers[u-1][e].LNum>f.headers[u][e].LNum||!1)&&(gt=[],nt=this._insertSummaryHeaders(f,ut,gt,u,e,b,yt,dt,!1,vt),s=nt.itmCnt,u=nt.hCnt,yt=nt.insCnt,vt[e]=nt.subPos)}}catch(ti){this.olapCtrlObj._waitingPopup.hide()}}return r=="rowheader"?this._rBIndx=c:this._cBIndx=c,f},_insertSummaryHeaders:function(t,r,u,f,e,o,s,h,c,l){var u=[],p,w,v,b="",s=0,y,a,k;for(t.headers[f-1]&&(h=t.headers[f-1][e].PUName),v=t.headers.length,p=t.headers[f][e].LNum,w=t.headers[f-1][e].LNum,y=this._comparePrevMembers(t.headers,v,f,e,o,s),lev=p;lev<w;lev++){for(n.grep(r.headers,function(n,r){(h==n[e].UName||t.headers[f+1+s]!=i&&t.headers[f][e].UName!=t.headers[f+1+s][e].UName&&t.headers[f][e].PUName==n[e].UName&&y)&&(b=n[e].PUName,u.push(r))}),h=b,y&&(u.reverse(),y=!1);u.length>0;){for(a=u.length-1,k=u[u.length-1],t.headers.splice(f,0,r.headers.splice(u[u.length-1],1)[0]),t.indxInfo.splice(f,0,r.indxInfo.splice(u[u.length-1],1)[0]);a>=0;)k<u[a]&&u[a]--,a--;u.pop();v++;s++;c&&l[e]++}s>0&&(f+=s,s=0)}return{itmCnt:v,hCnt:f,insCnt:s,subPos:l[e]}},_comparePrevMembers:function(n,t,i,r,u,f){var o=!1,e;if(r>0&&i<t&&i+1+f>=0&&i+1+f<t)for(e=r-1;e>=0;e--)n[i][e].UName!=n[i+1+f][e].UName&&(o=!0);return o},_updateMemberVariables:function(n,t,i,r,u){return n[u]&&(r=n[u]),i=n[u+1]?n[u+1]:null,t=n[u-1]?n[u-1]:null,{cur:r,prev:t,next:i}},_removeSubtotalMembers:function(n,t,i){for(var r=t-1,u=n.headers[r][i].UName;n.headers[r]&&n.headers[r][i].UName==u;)n.indxInfo.splice(r,1),n.headers.splice(r,1),r--;return t-(r+1)},_getSummaryHeaders:function(t,i,r,u){var o=i.headers,f=t,e=r,s=[],h=[],c=i.indxInfo,l;return l=n.grep(o,function(n,t){for(var r=!1,i=e;i>=0;i--)if(n[i].UName==f[i].UName||u&&i==e&&n[i].UName==f[i].PUName)i==0&&(r=!0,h.push(c[t]));else break;return r}),i.headers=n.grep(o,function(n,t){for(var r=!0,i=e;i>=0;i--)if(n[i].UName==f[i].UName||u&&i==e&&n[i].UName==f[i].PUName)i==0&&(r=!1);else break;return r&&s.push(c[t]),r}),i.indxInfo=s,{headers:l,indexInfo:h}},_drillOrderHeaderCollection:function(t,i,r){var o=t,s=i,e=r,u=0,f=this;return n(o).map(function(t,i){var o=n(s[i.selIndx]).find("Member"),h=[],r,l,a,c;for(h[u]=[],r=0;r<o.length;r++)l=parseInt(n(o[r]).find("LNum").text()),e=="colheader"&&f._OlapDataSource.columns[r]?f._OlapDataSource.columns[r].hasAllMember&&(l+=1):e=="rowheader"&&f._OlapDataSource.rows[r]&&f._OlapDataSource.rows[r].hasAllMember&&(l+=1),a=n(o[r]).find("PARENT_UNIQUE_NAME").length?n(o[r]).find("PARENT_UNIQUE_NAME").text():"",h[u].push({CSS:e,Value:n(o[r]).find("Caption").text(),ColSpan:1,RowSpan:1,HUName:n(o[r]).attr("Hierarchy"),LName:n(o[r]).find("LName").text(),UName:n(o[r]).find("UName").text(),ChildCount:parseInt(n(o[r]).find("CHILDREN_CARDINALITY").text()),PUName:a,LNum:l,MemberType:parseInt(n(o[r]).find("MEMBER_TYPE").text())}),c=h[u][h[u].length-1],i.kpiInfo&&c.UName.toLowerCase().indexOf("[measures]")>-1&&c.MemberType==4&&(h[u][h[u].length-1].kpiInfo=i.kpiInfo),i.kpi&&c.UName.toLowerCase().indexOf("[measures]")>-1&&c.MemberType==4&&(h[u][h[u].length-1].kpi=i.kpi);return h})},_loadKpi:function(n,t,i){i={action:"loadFieldElements"};var r=this._getConnectionInfo(n.data),u='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_KPIS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";this.olapCtrlObj.doAjaxPost("POST",r.url,{XMLA:u},this._loadKpiSuccess,null,i)},_loadKpiSuccess:function(n,t){this._kpi=t},_isKpi:function(t,i){var u=n(this._kpi).find("row:contains("+t.split("::")[0]+")"),r={};return u.length?(i=="trend"?(r.Graphic=n(u).find("KPI_TREND_GRAPHIC").text(),r.Value=n(u).find("KPI_NAME").text()):i=="status"?(r.Graphic=n(u).find("KPI_STATUS_GRAPHIC").text(),r.Value=n(u).find("KPI_NAME").text()):i=="goal"&&(r.Caption=t.split("::")[1],r.Value=n(u).find("KPI_NAME").text()),r):!1},_getValueCells:function(t,i){var s=this._columnHeaders.headers.length,c=this._rowHeaders.headers.length?this._rowHeaders.headers.length:1,e=0,u=0,f,l,r,o,h;if(this._valueCells[e]=[],this._fillAllValueCells(),t=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),this._OlapDataSource._enableBasicEngine||this._isPaging)for(r=0;r<t.length;r++)u<s&&(this._valueCells[e][u]={Value:n(t[r]).find("FmtValue")[0]?n(t[r]).find("FmtValue").text():"",FormatString:n(t[r]).find("FormatString")[0]?n(t[r]).find("FormatString").text():""},u++),u==s&&e+1<c&&(u=0,e++,this._valueCells[e]=[]);else for(f=0;f<c;f++)for(l=this._rBIndx.length?this._rBIndx[f].selIndx:0,r=0;r<s;r++)o=n(t[l*i+this._cBIndx[r].selIndx]),h="",(this._columnHeaders.indxInfo[r]&&this._columnHeaders.indxInfo[r].type=="total"||this._rowHeaders.indxInfo[f]&&this._rowHeaders.indxInfo[f].type=="total")&&(h="summary"),u<s&&(this._valueCells[f][r]={ActualValue:n(o).find("Value").text(),Value:n(o).find("FmtValue")[0]?this._getFormatedValue(n(o),n(o).find("FormatString")[0]):"",FormatString:n(o).find("FormatString")[0]?n(o).find("FormatString").text():"",kpi:this._cBIndx[r].kpi?this._cBIndx[r].kpi:this._rBIndx[f]?this._rBIndx[f].kpi:"",summary:h,Span:this._isNoSummary&&h=="summary"?"Block":"None"},u++),u==s&&e+1<c&&(u=0,e++,this._valueCells[e]=[]);return this._valueCells},_fillAllValueCells:function(t){var u,o,i,f,e,r;for(t=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),u=n(t[0]).clone(),n(u).find("FmtValue").text(""),o=t,i=0;i<t.length;i++)if(f=parseInt(n(t[i]).attr("CellOrdinal")),t[i+1]&&(e=parseInt(n(t[i+1]).attr("CellOrdinal"))),f+1<e)for(r=f+1;r<e;r++)n(t[i]).after(n(u).clone().attr("CellOrdinal",r)[0]);return t},_setCellOrdinal:function(t){for(var r=n(t).find("Cell"),i=0;i<r.length;i++)n(r[i]).attr("CellOrdinal",i)},_getFormatedValue:function(i,r){var r,u;if((this.olapCtrlObj.model.locale=="en-US"||!n.isNumeric(parseFloat(n(i).find("Value").text())))&&n(i).length>0)u=n(i).find("FmtValue").text();else{r=n(r).length>0?n(r).text().toLowerCase():t.isNullOrUndefined(r)?"":r.length>0?r:"";u=n(i).length>0?parseFloat(i.find("Value").text()):i;switch(r){case"decimal":u=parseFloat(t.widgetBase.formatting("{0:D2}",u,this.olapCtrlObj.model.locale));break;case"percent":u=t.widgetBase.formatting("{0:P0}",u,this.olapCtrlObj.model.locale);break;case"number":u=t.widgetBase.formatting("{0:N}",u,this.olapCtrlObj.model.locale);break;case"currency":u=t.widgetBase.formatting("{0:C2}",u,this.olapCtrlObj.model.locale);break;case"date":u=new Date((Number(u)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(u)&&(u=t.widgetBase.formatting("{0:MM/dd/yyyy}",u,this.olapCtrlObj.model.locale));break;case"scientific":u=Number(u).toExponential(2).replace("e","E");break;case"accounting":u=this._toAccounting(u,"{0:C2}",this.olapCtrlObj.model.locale);break;case"time":u=new Date((Number(u)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(u)&&(u=t.widgetBase.formatting("{0:h:mm:ss tt}",u,this.olapCtrlObj.model.locale));break;case"fraction":u=this._toFraction(u);u="numerator"in u?u.integer+" "+u.numerator+"/"+u.denominator:u.integer;break;default:u=n(i).find("FmtValue").text()}}return u},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_toAccounting:function(n,i,r){var h=t.preferredCulture(r).numberFormat,f,e,u=h.currency.symbol,o,s;return val=t.widgetBase.formatting(i,n,this.olapCtrlObj.model.locale),o=val.replace(u,""),s=val.indexOf(u),!s||n<0&&s===1?(f=u,e=Number(n)?o:"-"):(f=Number(n)?o:"-",e=u),f+" "+e},_toFraction:function(n){if(this._isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this._getPlaceValue(t,i),f=this._getGCD(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},_isNumber:function(n){return n-parseFloat(n)>=0},_getGCD:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this._getGCD(t,n%t)},_getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},_populateEngine:function(r,u,f){var y=r.length,p=u.length,w=y?r[0].length:y,h=p?u[0].length:p,b=[],g=f.length,nt=f[0].length,o,v,ft,d,a,e,c;try{this.pivotEngine=[];var tt=[],it=[],et=!1,k=[],l=!1,s=[];for(e=0;e<p;e++)for(this.pivotEngine[e+h]==i&&(this.pivotEngine[e+h]=[]),e==0&&(this.pivotEngine[0]=[],this.pivotEngine[0][0]={CSS:"none",Value:"",ColSpan:indexCCell?indexCCell:1,RowSpan:indexRCell?indexRCell:1,HUName:"",LName:"",UName:"",LNum:""}),o=0;o<h;o++)l=!1,this._OlapDataSource.columns&&this._OlapDataSource.columns[o]&&this._OlapDataSource.columns[o].isNamedSets&&(l=!0),this._pivotEngineSpanCalculation("colheader",u,r,this._columnHeaders.maxLvlLen,f,o,e,it,tt,this._cTotIndexInfo,l,k);for(s=this.pivotEngine.slice(),this.pivotEngine=[],e=0;e<s.length;e++)if(s[e])for(o=0;o<s[e].length;o++)s[e][o]&&(this.pivotEngine[o]==i&&(this.pivotEngine[o]=[]),this.pivotEngine[o][e]={CSS:s[e][o].CSS,ColSpan:s[e][o].RowSpan,HUName:s[e][o].HUName,LName:s[e][o].LName,LNum:s[e][o].LNum,RowSpan:s[e][o].ColSpan,UName:s[e][o].UName,PUName:s[e][o].PUName,Value:s[e][o].Value,ChildCount:s[e][o].ChildCount,MemberType:s[e][o].MemberType,Span:s[e][o].Span=="Block"?"Block":"None"},s[e][o].kpiInfo&&(this.pivotEngine[o][e].kpiInfo=s[e][o].kpiInfo,this.pivotEngine[o][e].kpi=s[e][o].kpi));var rt=[],ut=[],et=!1,k=[];for(e=0;e<y;e++)for(this.pivotEngine[e+indexCCell]==i&&(this.pivotEngine[e+indexCCell]=[]),o=0;o<w;o++)l=!1,this._OlapDataSource.rows&&this._OlapDataSource.rows[o]&&this._OlapDataSource.rows[o].isNamedSets&&(l=!0),this._pivotEngineSpanCalculation("rowheader",r,u,this._rowHeaders.maxLvlLen,f,o,e,ut,rt,this._rTotIndexInfo,l,k);for(b=n.extend(!0,[],this.pivotEngine),w=this._measureDt.axis=="rowheader"?indexRCell+1:indexRCell,h=indexCCell?indexCCell:h,e=0;e<g;e++)for(this.pivotEngine[e+h]!=i&&(w=this.pivotEngine[e+h].length),o=0;o<nt;o++)t.isNullOrUndefined(f[e][o])||(this.pivotEngine[e+h]==i&&(this.pivotEngine[e+h]=[]),v=this._setClassName(f[e][o]),f[e][o].CSS=v,v.indexOf("kpiiconvalue")>-1&&(!1||this.olapCtrlObj.pluginName=="ejPivotGrid")?f[e][o].Value="":v.indexOf("kpiiconvalue")>-1&&(f[e][o].Value=parseInt(f[e][o].Value)),this.pivotEngine[e+indexCCell][o+indexRCell]=f[e][o]);if(ft=n.grep(this.pivotEngine,function(n){return n}),this._isPaging){for(t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName)||this.olapCtrlObj._pagingSavedObjects.curDrilledItem.action!="collapse"?t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index)?t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName)||(n.each(this.olapCtrlObj._pagingSavedObjects.savedHdrEngine,function(i,r){n.each(r,function(n,r){if(!t.isNullOrUndefined(r)&&r.UName==t.olap.base.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName.split("::")[0].split("amp;").join(""))return t.olap.base.olapCtrlObj._pagingSavedObjects.drillEngine.push(t.olap.base.olapCtrlObj._pagingSavedObjects.savedHdrEngine[i][n]),!1})}),this.olapCtrlObj._pagingSavedObjects.drillEngine[this.olapCtrlObj._pagingSavedObjects.drillEngine.length-1].ChildCount=-1):(this.olapCtrlObj._pagingSavedObjects.drillEngine.push(this.olapCtrlObj._pagingSavedObjects.savedHdrEngine[parseInt(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index.split(",")[1])][parseInt(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index.split(",")[0])]),this.olapCtrlObj._pagingSavedObjects.drillEngine[this.olapCtrlObj._pagingSavedObjects.drillEngine.length-1].ChildCount=-1):n.each(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n,i){if(i.UName==t.olap.base.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName.split("::")[0].split("amp;").join(""))return t.olap.base.olapCtrlObj._pagingSavedObjects.drillEngine.splice(n,1),!1}),n.map(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(i){var r=n.map(t.olap.base.olapCtrlObj.model.dataSource.columns,function(n){return n.fieldName==i.HUName?!0:!1});i.CSS=r[0]?"colheader":"rowheader"}),this.olapCtrlObj._pagingSavedObjects.curDrilledItem={},e=this.pivotEngine[0][0].RowSpan-2;e>=0;e--){for(d="empty",o=1;o<this.pivotEngine[this.pivotEngine[0][0].RowSpan-1].length;o++)t.isNullOrUndefined(this.pivotEngine[e])&&(this.pivotEngine[e]=[]),t.isNullOrUndefined(this.pivotEngine[e+1])||!t.isNullOrUndefined(this.pivotEngine[e][o])||t.isNullOrUndefined(this.pivotEngine[e+1][o])||(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==t.olap.base.pivotEngine[e+1][o].PUName})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].ColSpan=t.isNullOrUndefined(this.pivotEngine[e][o-1])||this.pivotEngine[e][o-1].UName!=this.pivotEngine[e][o].UName?1:this.pivotEngine[e][o-1].ColSpan+1,this.pivotEngine[e][o].RowSpan=1,d=this.pivotEngine[e][o].UName));for(a=1,o=this.pivotEngine[this.pivotEngine[0][0].RowSpan-1].length-2;o>0;o--)t.isNullOrUndefined(this.pivotEngine[e])||t.isNullOrUndefined(this.pivotEngine[e][o])||t.isNullOrUndefined(this.pivotEngine[e][o+1])||this.pivotEngine[e][o+1].UName!=this.pivotEngine[e][o].UName?t.isNullOrUndefined(this.pivotEngine[e])||t.isNullOrUndefined(this.pivotEngine[e][o+1])||(this.pivotEngine[e][o+1].ColSpan=a==1?this.pivotEngine[e][o+1].ColSpan:a,a=1):(this.pivotEngine[e][o].ColSpan==this.pivotEngine[e][o+1].ColSpan,a++)}for(e=this.pivotEngine[0][0].RowSpan;e<this.pivotEngine.length;e++)for(c="empty",o=this.pivotEngine[0][0].ColSpan-1;o>=0;o--)t.isNullOrUndefined(this.pivotEngine[e][o])?t.isNullOrUndefined(this.pivotEngine[e-1][o])||this.pivotEngine[e-1][o].UName!=c?(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==c})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].RowSpan=1,this.pivotEngine[e][o].ColSpan=1,c=this.pivotEngine[e][o].PUName)):(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==c})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].RowSpan=this.pivotEngine[e-1][o].RowSpan+1,this.pivotEngine[e][o].ColSpan=1,c=this.pivotEngine[e][o].PUName)):c=this.pivotEngine[e][o].PUName;this.olapCtrlObj._pagingSavedObjects.savedHdrEngine=b}}catch(ot){this.olapCtrlObj._ogridWaitingPopup.hide()}},_pivotEngineSpanCalculation:function(t,r,u,f,e,o,s,h,c,l,a,v){var ct=r.length,ft="",kt=u.length,d=ct?r[0].length:ct,p=kt?u[0].length:kt,fi=e.length,ei=e[0].length,gt,g,it,y,dt,yt,rt,nt,ot,ti,lt,pt,wt,at,bt,ii,ri,ui,ht;t=="rowheader"?(p=indexCCell?indexCCell:p,ft="row"):(p=indexRCell?indexRCell:p,ft="col");gt=1;g=0;a&&(r[s][o].ChildCount=0);this._measureDt.axis==t&&this._measureDt.posision==d-1&&(g=1);h[o]||(h[o]=[]);this._isNoSummary&&!v[o]&&(v[o]=[]);this.pivotEngine[s+p]||(this.pivotEngine[s+p]=[]);c[o]=s;var ni=f[o]?f[o]:1,w=0,vt=0;for(it=0;it<o;it++)f[it]&&(w+=f[it]-1,vt+=f[it]);if(!this._OlapDataSource._enableBasicEngine||this._OlapDataSource._checkSummaryHeaders)for(y=1;y<=ni;y++){var k=null,et=!1,b=r[s][o].LNum;if(h[o][y]==i&&(h[o][y]=0),this._isNoSummary&&v[o][y]==i&&(v[o][y]=0),r[s-1]&&h[o][b]&&(r[s][o].LNum!=0&&r[s-1][o].PUName==r[s][o].UName||o+g==d-1&&r[s-1][o].LNum<r[s][o].LNum)&&(tempSpan=h[o][b],this._isNoSummary&&(tempSpan+=v[o][b],v[o][b]=0),this.pivotEngine[s+p-tempSpan][o+b-1+w]=r[s][o],o+g!=d-1&&(this.pivotEngine[s+p][o+b-1+w]=n.extend({},r[s][o]),this._isNoSummary&&(this.pivotEngine[s+p][o+b-1+w].Span="Block")),this._isNoSummary&&(this.pivotEngine[s+p-tempSpan][o+b-1+w].RowSpan=0),a||(this.pivotEngine[s+p-tempSpan][o+b-1+w].ChildCount=-1),this.pivotEngine[s+p-tempSpan][o+b-1+w].ColSpan=1,this.pivotEngine[s+p-tempSpan][o+b-1+w].RowSpan+=h[o][b],this._drilledJSONData(s+p-tempSpan,s+p,o+b-1+w,r[s][o]),h[o][b]=0,o+g==d-1&&r[s-1][o].LNum>r[s][o].LNum)){for(dt=f[o]-b,yt=this._findNextMember(r,s,o),rt=0;rt<yt;rt++)this.pivotEngine[s+p+rt]||(this.pivotEngine[s+p+rt]=[]),this.pivotEngine[s+p+rt][o+w+b]={CSS:"summary "+ft,Value:"Total",ColSpan:dt,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"};this._isNoSummary||(this.pivotEngine[s+p-tempSpan][o+b-1+w].RowSpan+=yt-1)}if(r[s][o].LNum>y&&!(this._isNoSummary&&l[s].type=="total")?h[o][y]++:r[s][o].LNum>y&&this._isNoSummary&&l[s].type=="total"&&v[o][y]++,k=s+p,y==r[s][o].LNum&&s==0&&r[s][o].LNum>1)this.pivotEngine[k]||(this.pivotEngine[k]=[]),this.pivotEngine[k][o+y-1+w]=r[s][o],(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+g==d-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&(this.pivotEngine[k][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[k][o+y-1+w].LNum);else if(s!=0&&r[s][o].LNum>1&&y==r[s][o].LNum&&r[s-1][o].UName!=r[s][o].UName&&r[s-1][o].PUName!=r[s][o].UName)this.pivotEngine[k]==i&&(this.pivotEngine[k]=[]),this.pivotEngine[k][o+y-1+w]=r[s][o],(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+g==d-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&(this.pivotEngine[k][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[k][o+y-1+w].LNum);else if(s!=0&&y==r[s][o].LNum&&r[s-1][o].UName==r[s][o].UName)this._isNoSummary&&l[s].type=="total"?this._isNoSummary&&l[s].type=="total"&&v[o][y]++:h[o][y]++,this.pivotEngine[s+p][o+y-1+w]=r[s][o],this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block"),(r[s+1]!=i&&r[s+1][o].UName!=r[s][o].UName||s+1==ct&&h[o][y]>0)&&(nt=h[o][y],ot=r[s][o].LNum,this._isNoSummary&&(nt+=v[o][y],v[o][y]=0),nt&&this.pivotEngine[s+p-nt][o+ot-1+w]!=i&&this.pivotEngine[s+p-nt][o+ot-1+w].Value!=i&&(this.pivotEngine[s+p-nt][o+ot-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-nt,s+p,o+ot-1+w,r[s][o])),h[o][y]=0);else if(r[s][o].LNum<2&&(y==r[s][o].LNum||r[s][o].LNum==0)||r[s][o].LNum<y&&r[s-1]&&r[s][o].LNum<r[s-1][o].LNum&&l[s].type=="total"&&this._measureDt.axis==t)if(ti=y-1,r[s-1]&&r[s-1][o].UName==r[s][o].UName&&r[s][o].LName.toLowerCase().indexOf("[measures]")>-1&&(this.pivotEngine[s+p][o+y-1+w]=n.extend({},r[s][o]),this._measureDt.measureCount>1&&t==this._measureDt.axis||this._isNoSummary&&l[s].type=="total"?this._measureDt.measureCount>1&&t==this._measureDt.axis||!this._isNoSummary||l[s].type!="total"||v[o][y]++:h[o][y]++,this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block")),r[s][o].UName.indexOf("Measures")!=-1&&this._isPaging||l[s].type=="total")if(l[s].type=="total"&&r[s][o].LName.toLowerCase().indexOf("[measures]")==-1&&r[s][o].LNum!=y&&f[o]!=0){if((r[s][o-1]&&r[s][o-1].LName.toLowerCase().indexOf("[measures]")==-1||this._measureDt.axis!=t)&&(o>l[s].totLvl||o==d-1&&y>l[s].totLvl&&l[s].totLvl!=0||l[s].totLvl==0&&y-1>l[s].totLvl))break;for(var tt=1,st=1,ut=0;r[s-st][o]&&r[s-st][o].LNum==0&&!r[s][o].LName.toLowerCase().indexOf("[measures]")>-1;)r[s][o-1]&&r[s-st+1][o-1].UName!=r[s-st][o-1].UName&&ut++,st++;if(0){for(lt=0,et=!1,ut=0,o<this._measureDt.posision?(pt=o,wt=this._measureDt.posision):o>this._measureDt.posision&&(wt=f.length,pt=o,et=!0),at=pt;at<wt;at++)lt+=f[at];r[s][o+1]&&r[s][o+1].LName.toLowerCase().indexOf("[measures]")>-1&&f[o]>1&&(et=!0,lt-=r[s][o].LNum);tt=lt}else r[s][o].LNum==0&&!r[s][o].LName.toLowerCase().indexOf("[measures]")>-1&&(ht=0,bt=0,s>0&&o>0&&r[s][o].LName.indexOf("(All)")>-1&&r[s][o-1]&&f[o-1]>1&&(ht=this._findPreviousMember(r,s,o-1)),s!=0&&r[s][o-1]&&f[o-1]>1&&r[s+ht]&&r[s][o-1].LNum<r[s+ht][o-1].LNum&&(ut=f[o-1]-r[s][o-1].LNum),t=="rowheader"?(tt=indexRCell-vt+ut,bt=indexRCell-tt):t=="colheader"&&(tt=indexCCell-vt+ut,bt=indexCCell-tt),(f.length!=1&&o==d-1||f.length>1&&o<d-1)&&(et=!0),this._measureDt.axis==t&&(tt-=1),ri=1,s!=0&&r[s][o-1]&&(ii=r[s][o-1].LNum+1),ui=1,ht=s+p,this.pivotEngine[s+p][o+y-1+w-ut]={CSS:"summary "+ft,Value:"Total",ColSpan:tt,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"})}else r[s][o].LName.toLowerCase().indexOf("[measures]")!=-1?(r[s-1]&&r[s-1][o].UName==r[s][o].UName||(this.pivotEngine[s+p][o+y-1+w]=n.extend({},r[s][o]),this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block")),(r[s-1]&&r[s-1][o].UName!=r[s][o].UName||s+1==ct)&&(rSCnt=h[o][y],this._isNoSummary&&(rSCnt+=v[o][y],v[o][y]=0),rSCnt&&this.pivotEngine[s+p-rSCnt][o+y-1+w]!=i&&(this.pivotEngine[s+p-rSCnt][o+y-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-rSCnt,s+p,o+y-1+w,r[s][o])),h[o][y]=0)):l[s].type=="total"&&r.length==1&&(this.pivotEngine[s+p][o+y-1+w]={CSS:"summary "+ft,Value:"Total",ColSpan:1,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"});else r[s-1]&&r[s-1][o].UName==r[s][o].UName||(this.pivotEngine[s+p][o+y-1+w]=r[s][o],rSCnt=h[o][y],this._isNoSummary&&(rSCnt+=v[o][y],v[o][y]=0),rSCnt&&this.pivotEngine[s+p-rSCnt][o+y-1+w]!=i&&(this.pivotEngine[s+p-rSCnt][o+y-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-rSCnt,s+p,o+y-1+w,r[s][o])),h[o][y]=0),!r[s][o].LNum==0&&(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+g==d-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&this.pivotEngine[s+p][o+y-1+w]&&(this.pivotEngine[s+p][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[s+p][o+y-1+w].LNum);if(et)break}else this.pivotEngine[s+p][o]=r[s][o]},_findNextMember:function(n,t,i){for(var r=0;n[t+r]&&n[t][i].UName==n[t+r][i].UName;)r++;return r},_findPreviousMember:function(n,t,i){for(var r=-1;n[t+r]&&n[t][i].UName==n[t+r][i].UName;)r--;return r},_drilledJSONData:function(t,i,r,u){for(var f=t+1;f<i;f++)this.pivotEngine[f][r]=n.extend({},u),this._isNoSummary&&(this.pivotEngine[f][r].Span="Block")},_setClassName:function(n){var i=parseInt(n.Value),t="value";if(n.kpi)if(n.kpi=="trend")switch(i){case-1:t="value kpiiconvalue kpidownarrow";break;case 0:t="value kpiiconvalue kpirightarrow";break;case 1:t="value kpiiconvalue kpiuparrow"}else if(n.kpi=="status")switch(i){case-1:t="value kpiiconvalue kpidiamond";break;case 0:t="value kpiiconvalue kpitriangle";break;case 1:t="value kpiiconvalue kpicircle"}return n.summary+" "+t},_getFieldItemsInfo:function(n){var t=this._getConnectionInfo(n.model.dataSource.data),i='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_HIERARCHIES<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+t.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";n.doAjaxPost("POST",t.url,{XMLA:i},this._getHierarchyInfo,null,{pvtGridObj:n,action:"loadFieldElements"})},_getHierarchyInfo:function(t,i){for(var u,s,o=[],r=t.pvtGridObj,f=this._getConnectionInfo(r.model.dataSource.data),e=0;e<n(i).find("row").length;e++)u=n(n(i).find("row")[e]),o.push({pid:u.find("DIMENSION_UNIQUE_NAME").text(),id:u.find("HIERARCHY_UNIQUE_NAME").text(),name:u.find("HIERARCHY_CAPTION").text(),tag:u.find("HIERARCHY_UNIQUE_NAME").text(),hasAllMember:u.children("ALL_MEMBER").length==0?!0:!1});r._fieldData={hierarchy:o,hierarchySuccess:i,measures:[]};f.LCID.indexOf("1033")>=0&&!r.model.enableDrillThrough||(s='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_MEASURES<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+r.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+r.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+r.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+f.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",r.doAjaxPost("POST",f.url,{XMLA:s},this._getMeasureInfo,null,{pvtGridObj:r,action:"loadFieldElements"}))},_getMeasureInfo:function(t,i){for(var f=[],r=0;r<n(i).find("row").length;r++){var u=n(n(i).find("row")[r]),o=u.children("MEASUREGROUP_NAME").text(),e=u.find("MEASURE_UNIQUE_NAME").text();f.push({id:e,pid:o,name:u.children("MEASURE_CAPTION").text(),tag:e})}t.pvtGridObj._fieldData.measures=f;t.pvtGridObj._fieldData.measureSuccess=i},_getConnectionInfo:function(t){var i={url:"",LCID:"1033"};return t!=""&&n.map(t.split(";"),function(n){n.toLowerCase().indexOf("locale")<0&&i.url.length==0?i.url=n:n.toLowerCase().indexOf("locale")>=0&&(i.LCID=n.replace(/ /g,"").split("=")[1])}),i},_applyTrim:function(r){var f=[],u=r.model.dataSource,e=this;r._fieldData&&r._fieldData.measures&&r._fieldData.hierarchy?(n.merge(f,r._fieldData.hierarchy),n.merge(f,r._fieldData.measures)):r._fieldData&&r._fieldData.hierarchy?r._fieldData.hierarchy:[];u.rows=n.map(u.rows,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.columns=n.map(u.columns,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.filters=n.map(u.filters,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.values=u.values.length>0&&u.values[0].measures!=i?u.values:[{measures:[],axis:"columns"}];u.values[0].measures=n.map(u.values[0].measures,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});r.model.dataSource=u},_getCaption:function(t,r){var f=t.fieldName,u=[];return r.length>0?(u=n.map(r,function(t){if(t.tag!=i&&t.tag.toLowerCase()==n.trim(f.toLowerCase()))return t}),f.toLowerCase().indexOf("[measures]")>=0&&u.length==0&&f.split(".[").length>0?t.fieldCaption=f.split(".[")[1].replace(/]/g,""):u.length>0&&(t.hasAllMember=u[0].hasAllMember?!0:!1,t.fieldCaption=u[0].name)):u.length==0&&(t.fieldCaption=f),t},clearDrilledItems:function(r,u,f){var e=u.action;return r.rows=n.grep(r.rows,function(n){return n.filterItems!=i&&e!="filtering"?delete n.filterItems:n,n.filterItems!=i&&e!="advancedFilter"?delete n.advancedFilter:n,n.drilledItems!=i?delete n.drilledItems:n,n}),r.columns=n.grep(r.columns,function(n){return n.filterItems!=i&&e!="filtering"?delete n.filterItems:n,n.filterItems!=i&&e!="advancedFilter"?delete n.advancedFilter:n,n.drilledItems!=i?delete n.drilledItems:n,n}),r.filters=n.grep(r.filters,function(n){return n.filterItems!=i&&e!="filtering"?delete n.filterItems:n,n.filterItems!=i&&e!="advancedFilter"?delete n.advancedFilter:n,n.drilledItems!=i?delete n.drilledItems:n,n}),e!="filtering"&&(f._currentReportItems=n.map(f._currentReportItems,function(n){if(!t.isNullOrUndefined(n.dataSrc))if(n.dataSrc.cube==r.cube){if(!(n.dataSrc.reportName==r.reportName))return n}else return n}),t.isNullOrUndefined(f._schemaData)||f._schemaData.element.find(".filter").remove()),t.olap.base._clearDrilledCellSet(),r}};t.olap._mdxParser={_getRowMDX:function(r){var f=n(r)[0].rows,o,u,c;if(rowQuery="",measureQuery="",updateQuery=[],isSorted=!1,isDrilled=!1,isCollapse=r._isCollapse,o=r.values.length>0&&r.values[0].measures!=i&&r.values[0].axis==t.olap.AxisName.Row,t.isNullOrUndefined(r.providerName)||r.providerName==t.olap.Providers.SSAS){if(f.length>0){for(isDrilled=t.isNullOrUndefined(f[0].drillCellInfo)?!1:!0,u=0;u<f.length;u++){var h=t.isNullOrUndefined(f[u].isNamedSets)||!f[u].isNamedSets?!1:!0,e="",s="";f[u].fieldName==i||h?h&&(rowQuery=u>0?rowQuery+"*{"+f[u].fieldName+"}":"{"+f[u].fieldName+"}"):(e=this._getDimensionQuery(f[u],r,"rows",u,!1),updateQuery.push(e.replace(/["'\(\)]/g,"").replace(/["'\{\}]/g,"").replace(/\levels0/g,"levels(0)")),t.olap.base._isPaging&&isDrilled&&(s=this._getDimensionQuery(f[u],r,"rows",u,!0)),f[u].sortOrder&&f[u].sortOrder!=t.olap.SortOrder.None?(c=f[u].sortOrder==t.olap.SortOrder.Ascending?"asc":"desc",isSorted=!0,rowQuery=rowQuery+(u>0?"*":"")+"{ORDER({HIERARCHIZE({"+(t.olap.base._isPaging&&isDrilled?s:e)+"})},"+f[u].fieldName+".CurrentMember.MEMBER_CAPTION,"+c+")}"):rowQuery=rowQuery+(u>0?"*":"")+"{HIERARCHIZE({({"+(t.olap.base._isPaging&&isDrilled?s:e)+"})})}")}t.olap.base._isPaging&&this._updateOlapReport(n(r)[0].rows,rowQuery,"rows",updateQuery);isCollapse&&(isSorted=isCollapse);rowQuery=(isSorted?" ":" HIERARCHIZE ")+"( {"+(t.olap.base._isPaging?rowQuery:this._updateOlapReport(n(r)[0].rows,rowQuery,"rows",updateQuery))+"})";isCollapse&&(rowQuery="HIERARCHIZE("+rowQuery+")")}o&&(measureQuery=t.olap._mdxParser._getMeasuresQuery(r),rowQuery=rowQuery!=""?(t.olap.base._isPaging?rowQuery.slice(0,-1):rowQuery)+(rowQuery!=""&&measureQuery!=""?t.olap.base._isPaging?"*":",":"")+measureQuery:(t.olap.base._isPaging?measureQuery!=""?"(":"":"")+measureQuery);t.olap.base._isPaging&&(rowQuery=rowQuery!=""?measureQuery==""?(rowQuery[rowQuery.length-1]!="}"?rowQuery.slice(0,-1):rowQuery)+this._getDrilledSection(r,n.extend(!0,{},f),"row",measureQuery)+")":rowQuery+this._getDrilledSection(r,n.extend(!0,{},f),"row",measureQuery)+")":"")}else rowQuery=this._generateAxisMDXOnMondrian(r,f,o);return rowQuery},_generateAxisMDXOnMondrian:function(n,i,r){for(var e,f="",u=0;u<i.length;u++)e="DrillDownLevel({"+i[u].fieldName+"})",!t.isNullOrUndefined(i[u].drilledItems)&&i[u].drilledItems.length>0&&(e=this._getDrilledMDXOnMondrian(i[u].drilledItems,e)),f+=(f==""?"":"*")+e;return r&&(f+=(f==""?"":"*")+t.olap._mdxParser._getMeasuresQuery(n)),f},_getDrilledMDXOnMondrian:function(n,t){for(var i=0;i<n.length;i++)t="DrillDownMember("+t+", {"+n[i].join()+"})";return t},_getcolumnMDX:function(r){var e=n(r)[0].columns,u="",o="",c=[],l=!1,s=!1,a=r._isCollapse,y=r.values.length>0&&r.values[0].measures!=i&&r.values[0].axis==t.olap.AxisName.Column,f,p;if(t.isNullOrUndefined(r.providerName)||r.providerName==t.olap.Providers.SSAS){if(e.length>0){for(s=t.isNullOrUndefined(e[0].drillCellInfo)?!1:!0,f=0;f<e.length;f++){var w=t.isNullOrUndefined(e[f].isNamedSets)||!e[f].isNamedSets?!0:!1,l=!1,h="",v="";e[f].fieldName!=i&&w?(h=this._getDimensionQuery(e[f],r,"columns",f,!1),c.push(h.replace(/["'\(\)]/g,"").replace(/["'\{\}]/g,"")),t.olap.base._isPaging&&s&&(v=this._getDimensionQuery(e[f],r,"columns",f,!0)),e[f].sortOrder&&e[f].sortOrder!=t.olap.SortOrder.None?(p=e[f].sortOrder==t.olap.SortOrder.Ascending?"asc":"desc",l=!0,u=u+(f>0?"*":"")+"{ ORDER ({HIERARCHIZE ({"+(t.olap.base._isPaging&&s?v:h)+"})},"+e[f].fieldName+".CurrentMember.MEMBER_CAPTION,"+p+")}"):u=u+(f>0?"*":"")+"{"+(t.olap.base._isPaging&&s?v:h)+"}"):u=f>0?u+"*{"+e[f].fieldName+"}":"{"+e[f].fieldName+"}"}t.olap.base._isPaging&&s&&this._updateOlapReport(n(r)[0].columns,u,"columns",c);a&&(l=a);u=(l?" ":" HIERARCHIZE ")+"( {"+(t.olap.base._isPaging?u:this._updateOlapReport(e,u,"columns",c))+"})";a&&(u="HIERARCHIZE("+u+")")}y&&(o=t.olap._mdxParser._getMeasuresQuery(r),u=u!=""?(t.olap.base._isPaging?u.slice(0,-1):u)+(u!=""&&o!=""?t.olap.base._isPaging?"*":",":"")+o:(t.olap.base._isPaging?o!=""?"(":"":"")+o);t.olap.base._isPaging&&(u=u!=""?o==""?(u[u.length-1]!="}"?u.slice(0,-1):u)+this._getDrilledSection(r,n.extend(!0,{},e),"column",o)+")":u+this._getDrilledSection(r,n.extend(!0,{},e),"column",o)+")":"")}else u=this._generateAxisMDXOnMondrian(r,e,y);return u},_getDrilledSection:function(i,r,u,f){var e="",r=r;return n.each(r,function(i,r){t.isNullOrUndefined(r.drilledItems)||n.each(r.drilledItems,function(t,r){var u="",o="";n.each(r,function(n,t){u=u==""?"{"+t+"}":u+"*{"+t+"}";t=n==i?t.replace(".children",""):t;o=o==""?"{"+t+"}":o+"*{"+t+"}"});f!=""&&(u=u+"*"+f,o=o+"*"+f);e=e==""?"+{"+u+"}-{"+o+"}":e+"+{"+u+"}-{"+o+"}"})}),e},_getSortedMembers:function(i){var r=i.fieldName,u;return i.sortOrder&&i.sortOrder!=t.olap.SortOrder.None?(u=i.sortOrder=="ascending"?"asc":"desc",n.map(i.drilledItems,function(t){return n.map(t,function(n){return n.indexOf(r)>=0&&(n="order ( "+n+" , "+r+".CurrentMember.MEMBER_CAPTION,"+u+")"),n})})):i.drilledItems},_updateOlapReport:function(r,u,f,e){var c=this,s,h,o;return f=="rows"?(s=n.map(r,function(n,t){if(r[t].drilledItems!=i)return c._getSortedMembers(n,r)}),t.olap.base._isRowDrilled&&"rows"==t.olap.base._currIndex.axis&&r[t.olap.base._currIndex.Index]!=i&&r[t.olap.base._currIndex.Index].drilledItems!=i?(o=n.map(e,function(n){return n.indexOf("DrillDownlevel")>=0&&(n=n.replace("DrillDownlevel","DrillDownlevel(")+")"),n}),r[t.olap.base._currIndex.Index].drilledItems.push(o),t.olap.base._isRowDrilled=!1):s.length>0&&(t.olap.base._currIndex.axis==i||t.olap.base._currIndex.axis=="columns"&&!t.olap.base._isRowDrilled)&&(u=this._getDrillQuery(s,u,r)),t.isNullOrUndefined(t.olap.base._currIndex.axis)||t.olap.base._currIndex.axis!="rows"||(t.olap.base._currIndex={})):(h=n.map(r,function(n,t){if(r[t].drilledItems!=i)return c._getSortedMembers(n,r)}),t.olap.base._isColDrilled&&"columns"==t.olap.base._currIndex.axis&&r[t.olap.base._currIndex.Index]!=i&&r[t.olap.base._currIndex.Index].drilledItems!=i?(o=n.map(e,function(n){return n.indexOf("DrillDownlevel")>=0&&(n=n.replace("DrillDownlevel","DrillDownlevel(")+")"),n}),r[t.olap.base._currIndex.Index].drilledItems.push(o),t.olap.base._isColDrilled=!1):h.length>0&&(t.olap.base._currIndex.axis==i||t.olap.base._currIndex.axis=="rows"&&!t.olap.base._isColDrilled)&&(u=this._getDrillQuery(h,u,r)),t.isNullOrUndefined(t.olap.base._currIndex.axis)||t.olap.base._currIndex.axis!="columns"||(t.olap.base._currIndex={})),u},_getDrillQuery:function(r,u,f){for(var h,o,c,s="",e=0;e<r.length;e++)if(r[e][r[e].length-1].toLowerCase().indexOf(".children")>=0||r[e][r[e].length-1].toLowerCase().indexOf("drilldownlevel")>=0||r[e][r[e].length-1].toLowerCase().indexOf("members")>=0||(r[e][r[e].length-1]=r[e][r[e].length-1]+".children"),r[e].length!=f.length){for(h=n.map(f,function(u){if(u.fieldName!=i&&u.fieldName!=r[e][[r[e].length-1]].split(".").splice(0,2).join("."))return{uniqueName:t.olap.base._isPaging?"("+n.trim(u.fieldName)+").children":"DrillDownLevel("+n.trim(u.fieldName)+")",fieldName:n.trim(u.fieldName)}}),o=0;o<h.length;o++)c=this._getItemPosition(f,h[o].fieldName)[0],r[e].toString().indexOf(h[o].fieldName)>=0||r[e].splice(c,0,h[o].uniqueName);s=s+""+(e>0?",":"")+"\n ("+r[e]+")"}else s=s+""+(e>0?",":"")+"\n ("+r[e].toString()+")\n";return"("+u+"),"+s},_createDrillThroughQuery:function(i,r){var o;if(r.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)r._waitingPopup.show(),r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.drillThroughDataTable,JSON.stringify({currentReport:n(r.element).parents(".e-pivotclient").length>0||n(r.element).length>0?r.currentReport:JSON.parse(r.getOlapReport()).Report,layout:r.model.layout,cellPos:"",selectorValue:i}),function(n){this._trigger("drillThrough",{element:n.element,data:n})}),r._waitingPopup.hide();else{var e=r.measureGrp,u="",f="DRILLTHROUGH Select("+r._colHeader.join()+","+r._rowHeader.join()+") on 0 from ["+r.model.dataSource.cube+"] RETURN";n.map(r._fieldData.measures,function(n){n.pid==e&&(u+=u==""?"["+e+"]."+n.id.split(".")[1]:",["+e+"]."+n.id.split(".")[1])});f+=i!=""&&!t.isNullOrUndefined(i)?" "+u+","+i:" "+u;f=f.replace(/&/g,"&");o=r._getConnectionInfo(r.model.dataSource.data);pData='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+f+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+r.model.dataSource.catalog+"<\/Catalog> <\/PropertyList> <\/Properties><\/Execute> <\/Body> <\/Envelope>";r.doAjaxPost("POST",o.url,{XMLA:pData},t.Pivot._generateDrillData,null,{pvtGridObj:r,action:"loadFieldElements"})}},_getDimensionQuery:function(r,u,f,e,o){var s="";return r.drillCellInfo==i||o?s=t.isNullOrUndefined(r.hasAllMember)||!r.hasAllMember?t.olap.base._isPaging?"(("+n.trim(r.fieldName)+").children)":"DrillDownlevel(("+n.trim(r.fieldName)+"))":"(("+n.trim(r.fieldName)+").levels(0).members)":(s="{("+r.drillCellInfo.uniqueName+")}",delete r.drillCellInfo),s},_updateReport:function(i,r,u,f){var c=f.model.dataSource.providerName==t.olap.Providers.Mondrian,s,e,h={},o;c?(s=r.preRepItm.split(">#>"),o=r.itemPosition,e=o?r.previousElements.split(s[o-1])[1].split("][").length:r.previousElements.split("][").length,u.drilledItems&&(u.drilledItems.length<=e-1&&(u.drilledItems[e-1]=[]),r.action&&r.action=="collapse"?u.drilledItems[e-1]=n.grep(u.drilledItems[e-1],function(n){return n!=s[o]}):u.drilledItems[e-1].push(s[o]))):(u.drillCellInfo=n.extend({},r),u.drillCellInfo.uniqueName="("+n.trim(u.drillCellInfo.uniqueName)+".children)",h={action:"drilldown",cellInfo:r});t.olap.base.getJSONData(h,f.model.dataSource,f)},_splitCellInfo:function(n){var r=t.olap.base.olapCtrlObj.model.dataSource.providerName==t.olap.Providers.Mondrian?1:2,i;return n&&(i={hierarchyUniqueName:n.split("::")[1].split(".").splice(0,r).join("."),uniqueName:n.split("::")[0],levelUniqueName:n.split("::")[1],leveName:n.split("::")[2],parentUniqueName:n.split("::")[3]}),i},updateDrilledReport:function(r,u,f){var g,o,p,s,c,tt;t.olap.base._isPaging&&!t.isNullOrUndefined(f._pagingSavedObjects.curDrilledItem)&&(f._pagingSavedObjects.curDrilledItem=r);var it=t.olap._mdxParser,l=null,e,w,b="",a="",k,v,nt=f.model.dataSource.providerName==t.olap.Providers.Mondrian;if(e=this._splitCellInfo(r.uniqueName),e.targetUName=r.uniqueName,e.previousElements="",w=u=="rowheader"?f.model.dataSource.rows:u=="colheader"?f.model.dataSource.columns:null,w.length>0){if(k=n.map(w,function(t,r){if(t.fieldName!=i&&n.trim(t.fieldName).toLowerCase()==n.trim(e.hierarchyUniqueName).toLowerCase())return{report:t,index:r}}),l=k[0].report,e.itemPosition=k[0].index,g=n.map(f._pivotRecords.records,function(n){if(n.Info.replace(/&/g,"&")==r.uniqueName)return n.Index}),l.drilledItems!=i?l.drilledItems:l.drilledItems=[],t.olap.base._currIndex={axis:u=="rowheader"?"rows":"columns",Index:k[0].index},f.pluginName=="ejPivotChart"||f.pluginName=="ejPivotTreeMap"||t.isNullOrUndefined(r.index)){for(e.cellIndex=g.length>0?"":r.index,e.axis=v=u,u!="rowheader"?t.olap.base._isColDrilled=r.action!=i&&r.action=="collapse"?!1:!0:t.olap.base._isRowDrilled=r.action!=i&&r.action=="collapse"?!1:!0,o=0;o<f.model.dataSource.rows.length;o++)if(r.seriesInfo[o]==r.uniqueName)break;else f.model.dataSource.rows[o].drillCellInfo=this._splitCellInfo(r.seriesInfo[o]);for(e.previousElements="",e.preRepItm="",o=0;o<r.uniqueNameArray.length;o++)e.previousElements+=this._splitCellInfo(r.uniqueNameArray[o]).uniqueName;for(o=0;o<r.seriesInfo.length;o++)e.preRepItm+=e.preRepItm==""?this._splitCellInfo(r.seriesInfo[o]).uniqueName:">#>"+this._splitCellInfo(r.seriesInfo[o]).uniqueName}else{e.cellIndex=r.index;var y=e.hierarchyUniqueName,v="",b="",h="",d=e.cellIndex.split(",")[0];if(rowPos=e.cellIndex.split(",")[1],u=="rowheader")for(v="rowheader",t.olap.base._isRowDrilled=r.action!=i&&r.action=="collapse"?!1:!0,o=parseInt(d);o>=0;o--)!f._pivotRecords.records[parseInt(o*f._pivotRecords.rowCount+parseInt(d))].Info.indexOf(y)>=0&&(h=f._pivotRecords.records[parseInt(o*f._pivotRecords.rowCount+parseInt(rowPos))].Info,p=this._splitCellInfo(h),p&&(b=p.uniqueName+b),h==""||h.indexOf(y)>=0||(s=this._splitCellInfo(h),s.uniqueName=s.uniqueName.replace(/&/g,"&"),a=s.uniqueName+">#>"+a,currReport=n.map(w,function(t,r){if(t.fieldName!=i&&n.trim(t.fieldName).toLowerCase()==n.trim(s.hierarchyUniqueName).toLowerCase())return r}),r.action!="collapse"&&(f.model.dataSource.rows[currReport[0]].drillCellInfo=s),y=s.hierarchyUniqueName));else for(v="colheader",t.olap.base._isColDrilled=r.action!=i&&r.action=="collapse"?!1:!0,o=parseInt(rowPos);o>=0;o--)!f._pivotRecords.records[parseInt(d*f._pivotRecords.rowCount+parseInt(o))].Info.indexOf(y)>=0&&(h=f._pivotRecords.records[parseInt(d*f._pivotRecords.rowCount+parseInt(o))].Info,p=this._splitCellInfo(h),p&&(b=p.uniqueName+">#>"+b),h==""||h.indexOf(y)>=0||(s=this._splitCellInfo(h),s.uniqueName=s.uniqueName.replace(/&/g,"&"),a=s.uniqueName+a,currReport=n.map(w,function(t,r){if(t.fieldName!=i&&n.trim(t.fieldName).toLowerCase()==n.trim(s.hierarchyUniqueName).toLowerCase())return r}),r.action!="collapse"&&(f.model.dataSource.columns[currReport[0]].drillCellInfo=s),y=s.hierarchyUniqueName));a+=e.uniqueName;e.previousElements=b.replace(/&/g,"&");e.preRepItm=a.replace(/&/g,"&");e.axis=v}if(e.previousElements=e.previousElements.replace(/&/g,"&"),e.preRepItm=e.preRepItm.replace(/&/g,"&"),r.action)if(r.action){if(nt){e.action="collapse";t.olap._mdxParser._updateReport(l.drilledItems,e,l,f);return}if(c=t.olap.base._getDrilledMemeber({item:e}),c.length&&!t.olap.base._isPaging)t.olap.base._onDemandCollapse({drilledMembers:c,action:r.action},v);else{while(c.length!=0)t.olap.base.olapCtrlObj.model.dataSource=t.olap._mdxParser._clearCollapsedItems(v,c[c.length-1],t.olap.base.olapCtrlObj.model.dataSource),c=c.splice(0,c.length-1);t.olap.base.getJSONData(r,t.olap.base.olapCtrlObj.model.dataSource,t.olap.base.olapCtrlObj)}}else tt=n(r.drilledMember).clone(!0),t.olap.base._onDemandExpand({action:"drilldown",cellInfo:e,isExist:!0},r.drilledMember);else c=t.olap.base._getDrilledMemeber({item:e}),t.olap._mdxParser._updateReport(l.drilledItems,e,l,f)}},_clearCollapsedItems:function(t,r,u){return t=="rowheader"?u.rows=n.map(u.rows,function(t){return t.drilledItems!=i&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(r.repItms.replace(/&/g,"&"))<0)return[n]})),t}):t=="colheader"&&(u.columns=n.map(u.columns,function(t){return t.drilledItems!=i&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(r.repItms.replace(/&/g,"&"))<0)return[n]})),t})),u},_getSlicerMDX:function(r,u){for(var c,o=n(r)[0].filters,f="",s=this,h=u._fieldData,l=r.providerName==t.olap.Providers.Mondrian,a=n.merge(n.merge([],r.columns),r.rows),e=0;e<o.length;e++)c=n.grep(a,function(n){var t=s._getDimensionUniqueName(n.fieldName,h),i=s._getDimensionUniqueName(o[e].fieldName,h);return t==i&&!(l&&i==""&&t=="")}).length>0,c||(o[e].fieldName!=i&&o[e].filterItems==i?f=f+(f!=""?"*":"")+"{"+this._getDimensionQuery(o[e])+"}":o[e].filterItems!=i&&(f=f+(f!=""?"*":"")+"{"+o[e].filterItems.values.toString()+"}"));return f!=""?"where ("+f.replace(/DrillDownlevel/g,"")+")":""},_getDimensionUniqueName:function(t,i){var u=i.hierarchy,r;return u?(r=n.map(u,function(n){if(n.id.toLowerCase()==t.toLowerCase())return n.pid}),r.length>0?r[0]:""):t.split(".")[0]},_getMeasuresQuery:function(t){var u=n(t)[0].values,f=[],e="",s="",r,o;return u.length>0&&(r=jQuery.map(u,function(n,t){if(n.measures!=i)return{measureElements:n.measures,Index:t,axisName:n.axis}}),o=r.length>0?n.map(r[0].measureElements,function(n){return n.fieldName}):null,o!=null?f.push({values:o,Index:r[0].Index}):f,s=u.axis),e=n.map(f,function(n){return n.values.toString()}),e[0]!=""?"{"+e+"}":""},_getIncludefilterQuery:function(t,r,u){var l="FROM ["+r+"]",e="FROM ( SELECT (",o,s,a=u._fieldData,h=[],y="COLUMNS",f;for(o=n.map(n(t.rows),function(n){if(n.filterItems!=i)return[n.filterItems.values]}),s=n.map(n(t.columns),function(n){if(n.filterItems!=i)return[n.filterItems.values]}),f=0;f<t.filters.length;f++){var c=t.filters,v=this,p=!1;n.map(t.columns,function(n){v._getDimensionUniqueName(n.fieldName,a)==v._getDimensionUniqueName(c[f].fieldName,a)&&c[f].filterItems!=i&&(s.push(c[f].filterItems.values),p=!0)});p||n.map(t.rows,function(n){v._getDimensionUniqueName(n.fieldName,a)==v._getDimensionUniqueName(c[f].fieldName,a)&&c[f].filterItems!=i&&o.push(c[f].filterItems.values)})}if(t.enableAdvancedFilter){for(f=0;f<=t.columns.length-1;f++)t.columns[f].advancedFilter&&n.merge(h,this._getAdvancedFilterQuery(t.columns[f],e,y));for(f=0;f<=t.rows.length-1;f++)t.rows[f].advancedFilter&&n.merge(h,this._getAdvancedFilterQuery(t.rows[f],e,y))}for(f=0;f<=s.length-1;f++)e=f==0?e+"{"+s[f].toString()+"}":e+",{"+s[f].toString()+"}";for(s.length>0&&(e=o.length>0?e+" ) on COLUMNS ,(":e+" ) on COLUMNS "),f=0;f<=o.length-1;f++)e=f>0?e+",{"+o[f].toString()+"}":e+"{"+o[f].toString()+"}";return e=s.length>0&&o.length>0?e=e+") on ROWS ":s.length==0&&o.length>0?e+") on COLUMNS ":e,h.length>0&&(h=(s.length>0||o.length>0?e:"")+" "+h.join(" ")+" "+l+Array(h.length+1+s.length+o.length).join(")")),l=s.length==0&&o.length==0?l:e+l+")",h.length>0?h:l},_getAdvancedFilterQuery:function(i,r,u){var f=[],e=this;return n.map(i.advancedFilter,function(r){t.isNullOrUndefined(r.labelFilterOperator)&&r.labelFilterOperator==t.olap.LabelFilterOptions.None&&t.isNullOrUndefined(r.valueFilterOperator)&&r.valueFilterOperator==t.olap.ValueFilterOptions.None||f.push("FROM (SELECT Filter("+n.trim(r.name)+".AllMembers, "+e._getAdvancedFilterCondtions(i.fieldName,r.advancedFilterType==t.olap.AdvancedFilterType.LabelFilter||t.isNullOrUndefined(r.advancedFilterType)?r.labelFilterOperator:r.valueFilterOperator,r.values,r.advancedFilterType,r.measure)+")) on "+u)}),f},_getAdvancedFilterCondtions:function(n,i,r,u,f){var e="",u=t.isNullOrUndefined(u)?"label":u;switch(i.toLowerCase()){case"equals":e="("+(u!="value"?n+'.CurrentMember.member_caption ="'+r[0]+'"':f+" = "+r[0]);break;case"notequals":e="("+(u!="value"?n+'.CurrentMember.member_caption <>"'+r[0]+'"':f+" <>"+r[0]);break;case"contains":e="( InStr (1,"+n+'.CurrentMember.member_caption,"'+r[0]+'")>0';break;case"notcontains":e="( InStr (1,"+n+'.CurrentMember.member_caption,"'+r[0]+'")=0';break;case"beginswith":e="( Left ("+n+".CurrentMember.member_caption,"+r[0].length+')="'+r[0]+'"';break;case"notbeginswith":e="( Left ("+n+".CurrentMember.member_caption,"+r[0].length+')<>"'+r[0]+'"';break;case"endswith":e="( Right ("+n+".CurrentMember.member_caption,"+r[0].length+')="'+r[0]+'"';break;case"notendswith":e="( Right ("+n+".CurrentMember.member_caption,"+r[0].length+')<>"'+r[0]+'"';break;case"greaterthan":e="("+(u!="value"?n+'.CurrentMember.member_caption >"'+r[0]+'"':f+" >"+r[0]+"");break;case"greaterthanorequalto":e="("+(u!="value"?n+'.CurrentMember.member_caption >="'+r[0]+'"':f+" >="+r[0]+"");break;case"lessthan":e="("+(u!="value"?n+'.CurrentMember.member_caption <"'+r[0]+'"':f+" <"+r[0]+"");break;case"lessthanorequalto":e="("+(u!="value"?n+'.CurrentMember.member_caption <="'+r[0]+'"':f+" <="+r[0]+"");break;case"between":e="("+(u!="value"?n+'.CurrentMember.member_caption >="'+r[0]+'"AND '+n+'.CurrentMember.member_caption <="'+r[1]+'"':f+" >="+r[0]+" AND "+f+"<="+r[1]);break;case"notbetween":e="("+(u!="value"?n+'.CurrentMember.member_caption >="'+r[0]+'"OR '+n+'.CurrentMember.member_caption <="'+r[1]+'"':f+" >="+r[0]+" OR "+f+"<="+r[1]);break;default:e="( InStr (1,"+n+'.CurrentMember.member_caption,"'+r[0]+'")>0'}return e},_getItemPosition:function(t,r){return n.map(t,function(t,u){if(t.fieldName!=i&&n.trim(t.fieldName)==n.trim(r))return u})},getAllMember:function(i,r,u){var f="select {"+r+"} dimension properties CHILDREN_CARDINALITY on 0 from ["+n.trim(i.cube)+"]",e=t.olap._mdxParser.getSoapMsg(f,i.data,i.catalog),o=t.olap.base._getConnectionInfo(i.data);u.doAjaxPost("POST",o.url,{XMLA:e},u._generateAllMember,null,{action:"loadFieldElements"})},getMembers:function(i,r,u){var f=t.Pivot.getReportItemByFieldName(r,i).item;t.isNullOrUndefined(u.model.pivotControl)||u.model.pivotControl.model.dataSource.providerName!=t.olap.Providers.Mondrian||(this._controlObj=u.model.pivotControl);var e="select {"+(f&&f.hasAllMember?r+".levels(0).members":r+".children")+"}dimension properties CHILDREN_CARDINALITY, MEMBER_TYPE on 0 from ["+n.trim(i.cube)+"]",o=t.olap._mdxParser.getSoapMsg(e,i.data,i.catalog),s=t.olap.base._getConnectionInfo(i.data);u.doAjaxPost("POST",s.url,{XMLA:o},u._generateMembers,null,{action:"fetchMembers"})},getChildren:function(n,i,r){var o="select {"+i+".children} dimension properties CHILDREN_CARDINALITY on 0 from ["+n.cube+"]",u=r.model.pivotControl,f,e;t.isNullOrUndefined(u)||u.model.dataSource.providerName!=t.olap.Providers.Mondrian||(this._controlObj=r.model.pivotControl);f=t.olap._mdxParser.getSoapMsg(o,n.data,n.catalog);e=t.olap.base._getConnectionInfo(n.data);r.doAjaxPost("POST",e.url,{XMLA:f},t.Pivot.generateChildMembers,null,{action:"nodeExpand",currentNode:i})},getSoapMsg:function(n,i,r){var e=t.olap.base._getConnectionInfo(i),f="",u;return t.isNullOrUndefined(this._controlObj)?u='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+n+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+r+"<\/Catalog> <LocaleIdentifier>"+e.LCID+"<\/LocaleIdentifier><\/PropertyList> <\/Properties> <\/Execute> <\/Body> <\/Envelope>":(f=this._controlObj.model.dataSource.sourceInfo,u='<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command><Statement><![CDATA['+n+"]\]><\/Statement><\/Command><Properties><PropertyList><DataSourceInfo>"+f+"<\/DataSourceInfo><Catalog>"+r+"<\/Catalog><AxisFormat>TupleFormat<\/AxisFormat><Content>Data<\/Content><Format>Multidimensional<\/Format><\/PropertyList><\/Properties><\/Execute><\/SOAP-ENV:Body><\/SOAP-ENV:Envelope>",delete this._controlObj),u}};t.olap.SortOrder={None:"none",Ascending:"ascending",Descending:"descending"};t.olap.Providers={SSAS:"ssas",Mondrian:"mondrian"};t.olap.AdvancedFilterType={LabelFilter:"label",ValueFilter:"value"};t.olap.ValueFilterOptions={None:"none",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.olap.LabelFilterOptions={None:"none",BeginsWith:"beginswith",NotBeginsWith:"notbeginswith",EndsWith:"endswith",NotEndsWith:"notendswith",Contains:"contains",NotContains:"notcontains",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.olap.AxisName={Row:"rows",Column:"columns"}}(jQuery,Syncfusion),function($,ej,undefined){ej.PivotAnalysis={_initProperties:function(){this._colKeysCalcValues=[];this._rowKeysCalcValues=[];this._tableKeysCalcValues=[];this._gridMatrix=null;this._rowTotCalc=[];this._colTotCalc=[];this._transposeEngine=[];this._tRowCnt=0;this._tColCnt=0;this._cellType="";this._valueFilterArray=ej.isNullOrUndefined(this._valueFilterArray)?[]:this._valueFilterArray;this._currentFilterVal={};this._fieldMembers={};this._summaryTypes=[];this._editCellsInfo=[];this._locale="en-US";this._valueSorting=ej.isNullOrUndefined(this._valueSorting)?null:this._valueSorting;this._sort=ej.isNullOrUndefined(this._sort)?null:this._sort},setFieldCaptions:function(n){$.each(n.rows,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)});$.each(n.columns,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)});$.each(n.filters,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)});$.each(n.values,function(n,t){ej.isNullOrUndefined(t.fieldCaption)&&(t.fieldCaption=t.fieldName)})},getTreeViewData:function(n){var t=[],e=[],o,f,i,u,r,s;if(n.data!=null)for(i=0;i<n.data.length;i++)jQuery.each(n.data[i],function(n){jQuery.inArray(n,t)==-1&&t.push(n)});for(jQuery.each(n.values,function(n,i){i.isCalculatedField==!0&&jQuery.inArray(i.fieldName,t)==-1&&t.push(i.fieldName)}),o=[n.rows,n.columns,n.filters,n.values],f=[].concat.apply([],o),i=0;i<t.length;i++){for(u=0;u<f.length;u++)(t[i].caption==undefined||t[i].caption=="")&&f[u].fieldName==t[i]&&(t[i]={name:f[u].fieldName,caption:f[u].fieldCaption});(t[i].caption==undefined||t[i].caption=="")&&(t[i]={name:t[i].name||t[i],caption:t[i].name||t[i]})}for(r=0;r<t.length;r++)s=$.grep(n.rows,function(n){return n.fieldName==t[r].name}).length>0||$.grep(n.columns,function(n){return n.fieldName==t[r].name}).length>0||$.grep(n.values,function(n){return n.fieldName==t[r].name}).length>0||$.grep(n.filters,function(n){return n.fieldName==t[r].name}).length>0,e.push({id:t[r].name,name:t[r].name,caption:t[r].caption,isSelected:s,spriteCssClass:""});return e},pivotEnginePopulate:function(model){var dataSource=model.dataSource,currentObj=this,rowFilters,fields,vC,cnt,nC,outputString,rC,cC,isFiltered,temp,value,val,formula,oldValue,newValue,colkeyvalues,rowKeyValues,me,isColumnEmpty,j,i,k,rCnt,emptyCellColSpan,tcnt,cCnt;this._initProperties();model.dataSource.enableAdvancedFilter&&this._valueFilterArray.length==0&&(this._valueFilterArray=$.grep(dataSource.columns,function(n){if(n.advancedFilter&&n.advancedFilter.length>0&&n.advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter)return n.advancedFilter}),rowFilters=$.grep(dataSource.rows,function(n){if(n.advancedFilter&&n.advancedFilter.length>0&&n.advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter)return n.advancedFilter}),rowFilters.length>0&&$.merge(this._valueFilterArray,rowFilters));this._locale=model.locale;var colAxis=dataSource.columns,rowAxis=dataSource.rows,filters=dataSource.filters,calcValues=dataSource.values,colLen,jsonObj=[],pivotFieldList=[],rowLen;if(this._editCellsInfo=[],!ej.isNullOrUndefined(model.editCellsInfo)){var rowHeaders=model.editCellsInfo.rowHeader,colHeaders=model.editCellsInfo.columnHeader,values=model.editCellsInfo.JSONRecords;if(!ej.isNullOrUndefined(values)){for(uV=0;uV<values.length;uV++)fields={},rowAxis.length>0&&(fields.row=rowHeaders[uV].toString().split("#").splice(0,rowAxis.length).join(".")),colAxis.length>0&&(fields.column=colHeaders[uV].toString().split("#").splice(0,colAxis.length).join(".")),fields.value=colHeaders[uV].toString().split("#")[colHeaders[uV].toString().split("#").length-1]+"#"+values[uV].Value,this._editCellsInfo.push(fields);for(vC=0;vC<calcValues.length;vC++)$.each(this._editCellsInfo,function(n,t){calcValues[vC].fieldName==t.value.split("#")[0]&&(ej.PivotAnalysis._editCellsInfo[n].value=vC+"#"+t.value.split("#")[1])})}}for(i=0;i<calcValues.length;i++)this._summaryTypes.push(calcValues[i].summaryType!=null&&calcValues[i].summaryType!=undefined?calcValues[i].summaryType:ej.PivotAnalysis.SummaryType.Sum);if(dataSource.data!=null)for(cnt=0;cnt<dataSource.data.length;cnt++){list=jQuery.extend(!0,{},dataSource.data[cnt]);var table={keys:[],uniqueName:"",value:null},row={keys:[],uniqueName:"",value:null},col={keys:[],uniqueName:"",value:null},values={keys:[],uniqueName:"",value:null},isExcluded=!1;for(i=0;i<filters.length;i++)if(val=this._getReflectedValue(list,filters[i].fieldName,null,null),this._fieldMembers[filters[i].fieldName]==undefined||this._fieldMembers[filters[i].fieldName]==null?this._fieldMembers[filters[i].fieldName]=[val]:$.inArray(val,this._fieldMembers[filters[i].fieldName])==-1&&this._fieldMembers[filters[i].fieldName].push(val),filters[i].filterItems!=null&&filters[i].filterItems!=undefined&&((filters[i].filterItems.filterType==ej.PivotAnalysis.FilterType.Exclude||filters[i].filterItems.filterType==null)&&$.inArray(val!=null?val.toString():val,filters[i].filterItems.values)>=0||filters[i].filterItems.filterType==ej.PivotAnalysis.FilterType.Include&&$.inArray(val!=null?val.toString():val,filters[i].filterItems.values)<0)){isExcluded=!0;break}for(nC=0;nC<calcValues.length;nC++)val="",calcValues[nC]!=undefined&&calcValues[nC]!=null&&(list[calcValues[nC].fieldName]=model.dataSource.isFormattedValues?this._getNumber($(list).prop(calcValues[nC].fieldName),calcValues[nC].formatString):list[calcValues[nC].fieldName],val=this._getReflectedValue(list,calcValues[nC].fieldName,calcValues[nC].format,calcValues[nC].formatString),this._fieldMembers[calcValues[nC].fieldName]==undefined||this._fieldMembers[calcValues[nC].fieldName]==null?this._fieldMembers[calcValues[nC].fieldName]=[val]:$.inArray(val,this._fieldMembers[calcValues[nC].fieldName])==-1&&this._fieldMembers[calcValues[nC].fieldName].push(val)),outputString=val!=null?val.toString().replace(/([AMPME~!@#$%^&*()_+=`{}\[\]\|\\:;'<>,-.\/? ])+/g,""):"0",outputString=outputString.replace(ej.globalize.preferredCulture(this._locale).numberFormat.currency.symbol,""),$.isNumeric(outputString)||calcValues[nC].format=="date"?values.keys.push(val!=null?val:0):values.keys.push(1);for(rC=0;rC<rowAxis.length;rC++){if(val="",rowAxis[rC]!=undefined&&rowAxis[rC]!=null)if(val=this._getReflectedValue(list,rowAxis[rC].fieldName,null,null),this._fieldMembers[rowAxis[rC].fieldName]==undefined||this._fieldMembers[rowAxis[rC].fieldName]==null?this._fieldMembers[rowAxis[rC].fieldName]=[val]:$.inArray(val,this._fieldMembers[rowAxis[rC].fieldName])==-1&&this._fieldMembers[rowAxis[rC].fieldName].push(val),dataSource.enableAdvancedFilter&&!ej.isNullOrUndefined(rowAxis[rC].advancedFilter)&&rowAxis[rC].advancedFilter.length&&rowAxis[rC].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.LabelFilter){if(isFiltered=this._applyLabelFilter(rowAxis[rC].advancedFilter,val),isFiltered){isExcluded=!0;break}}else if(rowAxis[rC].filterItems!=null&&rowAxis[rC].filterItems!=undefined&&((rowAxis[rC].filterItems.filterType==ej.PivotAnalysis.FilterType.Exclude||rowAxis[rC].filterItems.filterType==null)&&$.inArray(val!=null?val.toString():val,rowAxis[rC].filterItems.values)>=0||rowAxis[rC].filterItems.filterType==ej.PivotAnalysis.FilterType.Include&&$.inArray(val!=null?val.toString():val,rowAxis[rC].filterItems.values)<0)){isExcluded=!0;break}val!=null&&val.toString().replace(/^\s+|\s+$/gm,"")||(val="(blank)");row.keys.push(val);row.uniqueName+=row.uniqueName==""?val:"."+val;table.keys.push(val);table.uniqueName+=table.uniqueName==""?val:"."+val}for(cC=0;cC<colAxis.length;cC++){if(val="",colAxis[cC]!=undefined&&colAxis[cC]!=null)if(val=this._getReflectedValue(list,colAxis[cC].fieldName,null,null),this._fieldMembers[colAxis[cC].fieldName]==undefined||this._fieldMembers[colAxis[cC].fieldName]==null?this._fieldMembers[colAxis[cC].fieldName]=[val]:$.inArray(val,this._fieldMembers[colAxis[cC].fieldName])==-1&&this._fieldMembers[colAxis[cC].fieldName].push(val),dataSource.enableAdvancedFilter&&!ej.isNullOrUndefined(colAxis[cC].advancedFilter)&&colAxis[cC].advancedFilter.length&&colAxis[cC].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.LabelFilter){if(isFiltered=this._applyLabelFilter(colAxis[cC].advancedFilter,val),isFiltered){isExcluded=!0;break}}else if(colAxis[cC].filterItems!=null&&colAxis[cC].filterItems!=undefined&&((colAxis[cC].filterItems.filterType==ej.PivotAnalysis.FilterType.Exclude||colAxis[cC].filterItems.filterType==null)&&$.inArray(val!=null?val.toString():val,colAxis[cC].filterItems.values)>=0||colAxis[cC].filterItems.filterType==ej.PivotAnalysis.FilterType.Include&&$.inArray(val!=null?val.toString():val,colAxis[cC].filterItems.values)<0)){isExcluded=!0;break}val!=null&&val.toString().replace(/^\s+|\s+$/gm,"")||(val="(blank)");col.keys.push(val);col.uniqueName+=col.uniqueName==""?val:"."+val;table.keys.push(val);table.uniqueName+=table.uniqueName==""?val:"."+val}isExcluded||(this._isMemberExist("row",row,$.extend(!0,{},values),dataSource),this._isMemberExist("column",col,$.extend(!0,{},values),dataSource),this._isMemberExist("calc",table,$.extend(!0,{},values),dataSource))}for(i=0;i<calcValues.length;i++)if(temp=$.grep(calcValues,function(n){return n.isCalculatedField==!0}),calcValues[i].isCalculatedField&&temp.length!=calcValues.length)for(j=0;j<this._tableKeysCalcValues.length;j++){for(formula=calcValues[i].formula.replace(/\s/g,""),k=0;k<calcValues.length;k++)calcValues[k].isCalculatedField!=!0&&(value=ej.globalize.parseFloat(this._tableKeysCalcValues[j].value.keys[k]==null?"0":calcValues[k].format=="date"?this._dateToInt(this._tableKeysCalcValues[j].value.keys[k].toString()).toString():calcValues[k].format=="time"?this._dateToInt(new Date("1900",this._tableKeysCalcValues[j].value.keys[k].toString().split(":")[0],this._tableKeysCalcValues[j].value.keys[k].toString().split(":")[1],this._tableKeysCalcValues[j].value.keys[k].toString().split(":")[2].split(" ")[0]).toString()).toString():this._tableKeysCalcValues[j].value.keys[k].toString(),this._locale),formula=formula.replace(new RegExp(calcValues[k].fieldName,"g"),calcValues[k].format=="percentage"&&value!=0?value<0?"("+value/100+")":value:value<0?"("+value+")":value));formula.indexOf("^")>-1&&(formula=this._powerFunction(formula));oldValue=!isNaN(eval(formula))&&isFinite(eval(formula))?this._getReflectedValue({calcField:eval(formula)},"calcField",calcValues[i].format,calcValues[i].formatString):dataSource.values[i].format==null?0:"0";newValue=dataSource.values[i].format==null?0:"0";this._tableKeysCalcValues[j].value.keys[i]=this._getSummaryValue(oldValue,newValue,1,this._summaryTypes[i],dataSource.values[i].format,dataSource.values[i].formatString)}else if(calcValues[i].isCalculatedField)for(val={keys:[],uniqueName:"",value:null},j=0;j<this._tableKeysCalcValues.length;j++){for(k=0;k<calcValues.length&&calcValues[k].isCalculatedField;k++)formula=calcValues[k].formula.replace(/\s/g,""),formula.indexOf("^")>-1&&(formula=this._powerFunction(formula)),oldValue=!isNaN(eval(formula))&&isFinite(eval(formula))?this._getReflectedValue({calcField:eval(formula)},"calcField",calcValues[k].format,calcValues[k].formatString):dataSource.values[k].format==null?0:"0",newValue=dataSource.values[k].format==null?0:"0",val.keys.push(this._getSummaryValue(oldValue,newValue,1,"sum",dataSource.values[k].format,dataSource.values[k].formatString));this._tableKeysCalcValues[j].value=val;val={keys:[],uniqueName:"",value:null}}if(rowAxis.length>0&&(this._rowKeysCalcValues=this._sortHeaders(this._rowKeysCalcValues,rowAxis,0)),colAxis.length>0&&(this._colKeysCalcValues=this._sortHeaders(this._colKeysCalcValues,colAxis,0)),colkeyvalues=$.extend([],this._colKeysCalcValues),rowKeyValues=$.extend([],this._rowKeysCalcValues),colAxis.length>0&&this._insertTotalHeader(colAxis,this._colKeysCalcValues),rowAxis.length>0)this._insertTotalHeader(rowAxis,this._rowKeysCalcValues);else if(calcValues.length>0)if(this._rowKeysCalcValues.length>0)this._rowKeysCalcValues[0].keys[0]="Grand Total";else{for(this._rowKeysCalcValues.push({keys:[""],value:{keys:[]}}),i=0;i<calcValues.length;i++)this._rowKeysCalcValues[0].value.keys.push();this._rowKeysCalcValues[0].keys[0]="Grand Total"}for(this._tRowCnt=0,this._tColCnt=0,this._currentFilterVal=this._valueFilterArray.length>0?this._valueFilterArray[0]:{},this._calculateValues(dataSource),i=0;i<this._valueFilterArray.length;i++)this._advancedFilterInfo.length>0&&(me=this,this._rowKeysCalcValues=this._filterKeyValues(rowKeyValues),this._colKeysCalcValues=this._filterKeyValues(colkeyvalues),this._gridMatrix=null,colkeyvalues=$.extend([],this._colKeysCalcValues),rowKeyValues=$.extend([],this._rowKeysCalcValues),colAxis.length>0&&this._insertTotalHeader(colAxis,this._colKeysCalcValues),rowAxis.length>0?this._insertTotalHeader(rowAxis,this._rowKeysCalcValues):calcValues.length>0&&(this._rowKeysCalcValues[0].keys[0]="Grand Total"),this._tRowCnt=0,this._tColCnt=0,this._currentFilterVal=this._valueFilterArray.length!=i+1?this._valueFilterArray[i+1]:{},this._calculateValues(dataSource));if(isColumnEmpty=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot",this._colTotCalc=[],this._rowTotCalc=[],this._colKeysCalcValues=[],this._rowKeysCalcValues=[],this._tableKeysCalcValues=[],this._transposeEngineCreation(),!ej.isNullOrUndefined(model.valueSortSettings)&&!ej.isNullOrUndefined(model.valueSortSettings.sortOrder)&&model.valueSortSettings.sortOrder!="none"&&model.dataSource.values.length>0&&(!ej.isNullOrUndefined(this._valueSorting)||!ej.isNullOrUndefined(model.valueSortSettings.headerText)))if(j=0,model.valueSortSettings.headerDelimiters=model.valueSortSettings.headerDelimiters==undefined?"##":model.valueSortSettings.headerDelimiters,ej.isNullOrUndefined(this._valueSorting)){for(i=0;i<this._transposeEngine.length;i++){for(k=0;k<model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters).length;k++)ej.isNullOrUndefined(this._transposeEngine[i][k])||this._transposeEngine[i][k].Value!=model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters)[k]||j++;if(j==model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters).length){this._valueSorting=i;break}j=0}this._sort=!ej.isNullOrUndefined(model.valueSortSettings)&&!ej.isNullOrUndefined(model.valueSortSettings.sortOrder)?model.valueSortSettings.sortOrder:this._sort;model.dataSource.columns.length+1!=model.valueSortSettings.headerText.split(model.valueSortSettings.headerDelimiters).length||ej.isNullOrUndefined(this._valueSorting)||this._applyValueSorting(model)}else this._applyValueSorting(model);for(rCnt=0;rCnt<this._tColCnt-1;rCnt++){if(rowAxis.length=rowAxis.length==0?1:rowAxis.length,rCnt<rowAxis.length)for(emptyCellColSpan=(isColumnEmpty?1:colAxis.length)+(dataSource.values.length>0?1:0),emptyCellColSpan==0&&rowAxis.length>0&&(emptyCellColSpan=1),tcnt=0;tcnt<emptyCellColSpan;tcnt++)this._gridMatrix.length>0&&jsonObj.push({Index:rCnt+","+tcnt,CSS:"none",Value:"",State:0,ColSpan:rCnt==0&&tcnt==0?rowAxis.length:1,RowSpan:rCnt==0&&tcnt==0?(isColumnEmpty?1:colAxis.length)+(dataSource.values.length>0?1:0):1,Info:"",Span:"None",Expander:0});for(cCnt=0;cCnt<this._tRowCnt-1;cCnt++)this._transposeEngine[rCnt]==undefined||this._transposeEngine[rCnt][cCnt]==undefined||cCnt<(isColumnEmpty?1:colAxis.length)+(dataSource.values.length>0?1:0)&&rCnt<rowAxis.length||jsonObj.push(this._transposeEngine[rCnt][cCnt])}return this._gridMatrix=[],dataSource.rows[0]==undefined&&(dataSource.rows.length=0),{json:jsonObj,pivotEngine:this._transposeEngine}},_applyValueSorting:function(n){for(var s,o,g,nt,a,p,tt,y,c,e,t,rt,f=[],u=[],r=0,v=0,d="",i=0;i<this._transposeEngine.length;i++)for(f[r]=[],ej.isNullOrUndefined(u[v])&&(u[v]=[]),t=0;t<this._transposeEngine[i].length&&this._valueSorting==Number(this._transposeEngine[i][t].Index.split(",")[0]);t++)(this._transposeEngine[i][t].CSS=="colheader"||this._transposeEngine[i][t].CSS.trim()=="calc"||this._transposeEngine[i][t].CSS=="colheader calc"||this._transposeEngine[i][t].CSS=="summary cstot"||this._transposeEngine[i][t].CSS=="summary cstot calc"||this._transposeEngine[i][t].CSS=="summary cgtot"||this._transposeEngine[i][t].CSS=="summary cgtot calc")&&(d=d==""?this._transposeEngine[i][t].Value:d+n.valueSortSettings.headerDelimiters+this._transposeEngine[i][t].Value),this._transposeEngine[n.dataSource.rows.length][t].CSS=="value"&&(f[r].push(this._transposeEngine[i][t]),v=0),this._transposeEngine[n.dataSource.rows.length][t].CSS=="summary value"&&(u[v].push(this._transposeEngine[i][t]),f[r].length>0&&(r=r+1,f[r]=[]),this._transposeEngine[0][t].CSS!="summary rgtot"&&u[v].length>0&&v++,ej.isNullOrUndefined(u[v])&&(u[v]=[]));for(n.valueSortSettings.headerText=d,n.valueSortSettings.sortOrder=this._sort,r=0;r<f.length;r++)for(i=0;i<f[r].length;i++)for(t=i;t<f[r].length;t++)g=this._sort=="descending"?this._getNumber(f[r][i].Value)<this._getNumber(f[r][t].Value):this._getNumber(f[r][i].Value)>this._getNumber(f[r][t].Value),g&&(nt=f[r][t],f[r][t]=f[r][i],f[r][i]=nt);for(r=0;r<f.length;r++)f[r].length==0&&f.splice(r,1);for(s=[],i=0;i<this._tRowCnt-1;i++)s[i]={index:0,level:-1};var l=0,h=[],b=[];for(r=u.length-2;r>=0;r--){for(o=0,t=0;t<u[r].length;t++)for(i=t;i<u[r].length;i++)g=this._sort=="descending"?this._getNumber(u[r][t].Value)<this._getNumber(u[r][i].Value):this._getNumber(u[r][t].Value)>this._getNumber(u[r][i].Value),g&&(nt=u[r][i],u[r][i]=u[r][t],u[r][t]=nt);if(l==0)for(t=0;t<u[r].length;t++)o=o==0?this._transposeEngine[l][Number(u[r][t].Index.split(",")[1])].MCnt+n.dataSource.columns.length+1:this._transposeEngine[l][Number(u[r][t].Index.split(",")[1])].MCnt+o+1,s[o]={index:Number(u[r][t].Index.split(",")[1]),level:l},h[t]==undefined&&(h[t]={}),h[t].end=Number(u[r][t].Index.split(",")[1]),h[t].start=Number(u[r][t].Index.split(",")[1])-this._transposeEngine[l][Number(u[r][t].Index.split(",")[1])].MCnt;else{for(a=[],p=0,c=0;c<h.length;c++){for(a=[],t=0;t<u[r].length;t++)Number(u[r][t].Index.split(",")[1])>h[c].start&&Number(u[r][t].Index.split(",")[1])<h[c].end&&a.push(u[r][t]);for(t=0;t<a.length;t++)o=o==0?this._transposeEngine[l][Number(a[t].Index.split(",")[1])].MCnt+n.dataSource.columns.length+1:this._transposeEngine[l][Number(a[t].Index.split(",")[1])].MCnt+o+1,s[o]={index:Number(a[t].Index.split(",")[1]),level:l},b[p]==undefined&&(b[p]={}),b[p].end=Number(a[t].Index.split(",")[1]),b[p].start=Number(a[t].Index.split(",")[1])-this._transposeEngine[l][Number(a[t].Index.split(",")[1])].MCnt,p++;while(o<this._tRowCnt-2&&s[o].level>s[o+1].level)o++;o--}h=jQuery.extend(!0,[],b)}l++}if(u.length==1&&u[0].length>0)for(tt=n.dataSource.columns.length+1,i=0;i<f[0].length;i++)s[tt]={index:Number(f[0][i].Index.split(",")[1])},tt++;for(y=n.dataSource.columns.length+1,c=0;c<h.length;c++)for(r=0;r<f.length;r++)if(Number(f[r][0].Index.split(",")[1])>=h[c].start&&Number(f[r][0].Index.split(",")[1])<=h[c].end){for(t=0,i=h[c].start;i<h[c].end;i++)s[y]={index:Number(f[r][t].Index.split(",")[1])},t++,y++;for(y++;s[y].index!=0&&y<=s.length;)y++}for(e=[],i=0;i<n.dataSource.columns.length+1;i++)s[i]={index:i};for(i=0;i<s.length-1;i++)e.push(this._gridMatrix[s[i].index]);for(e.push(this._gridMatrix[i]),i=0;i<this._gridMatrix.length&&this._gridMatrix[i]!=undefined&&e[i]!=undefined;i++)for(t=0;t<this._gridMatrix[i].length&&this._gridMatrix[i][t]!=undefined;t++)this._gridMatrix[i][t]!=undefined&&e[i][t]!=undefined&&(e[i][t].Index=this._gridMatrix[i][t].Index);for(t=0;t<n.dataSource.rows.length-1;t++){var w=n.dataSource.columns.length+1,k=0,r=0,it=!1;for(i=n.dataSource.columns.length+(n.dataSource.values.length>0?1:0);i<e.length;i++)if(e[i]!=undefined&&e[i][t]!=undefined&&e[i][t].CSS=="rowheader"&&e[i][t].RowSpan!=undefined&&(it=!0,k=k>e[i][t].RowSpan?k:e[i][t].RowSpan),e[i]!=undefined&&e[i][t]!=undefined&&e[i][t].CSS=="summary rstot"&&it&&!ej.isNullOrUndefined(e[w])){for(it=!1;e[w]==undefined||e[w][t]==undefined;)w++;e[w][t].RowSpan=k;k=0;rt=0;w=i+1;r++}}this._gridMatrix=e;this._transposeEngineCreation()},_transposeEngineCreation:function(){for(var t,n=0;n<this._tRowCnt-1;n++)for(t=0;t<this._tColCnt-1;t++)this._transposeEngine[t]==undefined&&(this._transposeEngine[t]=[]),this._gridMatrix[n]!=undefined&&this._gridMatrix[n][t]!=undefined?this._transposeEngine[t][n]={Index:t+","+n,CSS:this._gridMatrix[n][t].CSS,Value:typeof this._gridMatrix[n][t]=="string"||typeof this._gridMatrix[n][t]=="number"||typeof this._gridMatrix[n][t]=="object"?this._gridMatrix[n][t].Value==0?"":this._gridMatrix[n][t].Value==undefined?"":this._gridMatrix[n][t].Value:"",State:this._gridMatrix[n][t].State,RowSpan:this._gridMatrix[n][t].RowSpan!=undefined?this._gridMatrix[n][t].RowSpan:1,ColSpan:this._gridMatrix[n][t].ColSpan!=undefined?this._gridMatrix[n][t].ColSpan:1,Info:"",Span:"None",Expander:this._gridMatrix[n][t].Expander,MCnt:this._gridMatrix[n][t].MCnt!=undefined?this._gridMatrix[n][t].MCnt:1}:this._gridMatrix[n]!=undefined&&(this._transposeEngine[t][n]={Index:t+","+n,CSS:"none",Value:"",State:0,RowSpan:1,ColSpan:1,Info:"",Span:"None",Expander:0})},_filterKeyValues:function(n){var t=this;return $.grep(n,function(n){for(var i=!1,r=0;r<(!ej.isNullOrUndefined(n.uniqueName)&&n.uniqueName.split(".").length);r++)if(i=$.inArray(n.uniqueName.split(".")[r],t._advancedFilterInfo)>-1?!0:i,i=$.inArray(n.uniqueName,t._advancedFilterInfo)>-1?!0:i,i)break;if(!i)return n})},_getFilteredIndex:function(n,t,i,r){return $.map(t,function(t,u){if(n.length>0&&r[i].keys.length>0&&n[r[i].keys.length-1].advancedFilter&&n[r[i].keys.length-1].advancedFilter.length>0&&(n[r[i].keys.length-1].advancedFilter[0].measure==t.fieldName||n[r[i].keys.length-1].advancedFilter[0].name==t.fieldName))return u})[0]},_applyValueFilter:function(n,t){if(isFiltered=!1,n.length>0&&!ej.isNullOrUndefined(t)){var r=n[0].valueFilterOperator,i=n[0].values;switch(r.toLowerCase()){case"equals":isFiltered=!(t==JSON.parse(n[0].values[0]));break;case"notequals":isFiltered=!(t!=JSON.parse(n[0].values[0]));break;case"greaterthan":isFiltered=!(t>JSON.parse(n[0].values[0]));break;case"greaterthanorequalto":isFiltered=!(t>=JSON.parse(n[0].values[0]));break;case"lessthan":isFiltered=!(t<JSON.parse(n[0].values[0]));break;case"lessthanorequalto":isFiltered=!(t<=JSON.parse(n[0].values[0]));break;case"between":isFiltered=!(t>JSON.parse(i[0]))||!(t<JSON.parse(i[1]));break;case"notbetween":isFiltered=!(!(t>JSON.parse(i[0]))||!(t<JSON.parse(i[1])));break;default:isFiltered=!(t==JSON.parse(n[0].values[0]))}}return isFiltered},_applyLabelFilter:function(n,t){if(n.length>0){var u=n[0].labelFilterOperator,i=n[0].values,r=!1;t=ej.isNullOrUndefined(t)?"":t.toString();switch(u.toLowerCase()){case"equals":r=!(t.toLowerCase()==i[0].toLowerCase());break;case"notequals":r=t.toLowerCase()==i[0].toLowerCase();break;case"contains":r=!(t.toLowerCase().indexOf(i[0].toLowerCase())>-1);break;case"notcontains":r=t.toLowerCase().indexOf(i[0].toLowerCase())>-1;break;case"beginswith":r=!(t.toLowerCase().indexOf(i[0].toLowerCase())==0);break;case"notbeginswith":r=t.toLowerCase().indexOf(i[0].toLowerCase())==0;break;case"endswith":r=ej.isNullOrUndefined(t.toLowerCase().match(i[0].toLowerCase()+"$"));break;case"notendswith":r=!ej.isNullOrUndefined(t.toLowerCase().match(i[0].toLowerCase()+"$"));break;case"greaterthan":r=!(t.toLowerCase()>i[0].toLowerCase());break;case"greaterthanorequalto":r=!(t.toLowerCase()>=i[0].toLowerCase());break;case"lessthan":r=!(t.toLowerCase()<i[0].toLowerCase());break;case"lessthanorequalto":r=!(t.toLowerCase()<=i[0].toLowerCase());break;case"between":r=!(t.toLowerCase()>i[0].toLowerCase())&&!(t.toLowerCase()<i[1].toLowerCase());break;case"notbetween":r=!(!(t.toLowerCase()>i[0].toLowerCase())&&!(t.toLowerCase()<i[1].toLowerCase()));break;default:r=!(t.toLowerCase().indexOf(i[0].toLowerCase())>-1)}return r}},getMembers:function(n,t){var i,r,u;if(ej.isNullOrUndefined(t))return ej.isNullOrUndefined(this._fieldMembers)?[]:ej.isNullOrUndefined(this._fieldMembers[n])?[]:this._fieldMembers[n];for(i={},r=0;r<t.length;r++)u=t[r],$.each(u,function(n,t){ej.isNullOrUndefined(i[n])?i[n]=[t]:i[n].indexOf(t)<0&&i[n].push(t)});return i[n]},_powerFunction:function(n){if(n.indexOf("^")>-1){for(var t=[];n.indexOf("(")>-1;)n=n.replace(/(\([^\(\)]*\))/g,function(n,i){return t.push(i),"~"+(t.length-1)});for(t.push(n),n="~"+(t.length-1);n.indexOf("~")>-1;)n=n.replace(new RegExp("~(\\d+)","g"),function(n,i){return t[i].replace(/(\w*)\^(\w*)/g,"Math.pow($1,$2)")})}return n},_calculatedFieldSummaryValue:function(index,calValue,dataSource){var formula,i,value,oldValue,newValue;if(dataSource.values[index].isCalculatedField==!0){for(formula=dataSource.values[index].formula.replace(/\s/g,""),i=0;i<dataSource.values.length;i++)dataSource.values[i].isCalculatedField!=!0&&(value=ej.globalize.parseFloat(calValue[i]==null?"0":dataSource.values[i].format=="date"?this._dateToInt(calValue[i].toString()).toString():dataSource.values[i].format=="time"?this._dateToInt(new Date("1900",calValue[i].toString().split(":")[0],calValue[i].toString().split(":")[1],calValue[i].toString().split(":")[2].split(" ")[0]).toString()).toString():calValue[i].toString(),this._locale),formula=formula.replace(new RegExp(dataSource.values[i].fieldName,"g"),dataSource.values[i].format=="percentage"&&value!=0?value<0?"("+value/100+")":value:value<0?"("+value+")":value));return formula.indexOf("^")>-1&&(formula=this._powerFunction(formula)),oldValue=!isNaN(eval(formula))&&isFinite(eval(formula))?this._getReflectedValue({calcField:eval(formula)},"calcField",dataSource.values[index].format,dataSource.values[index].formatString):dataSource.values[index].format==null?0:"0",newValue=dataSource.values[index].format==null?0:"0",this._getSummaryValue(oldValue,newValue,1,this._summaryTypes[index]=="count"?"sum":this._summaryTypes[index],dataSource.values[index].format,dataSource.values[index].formatString)}},_sortHeaders:function(n,t,i){for(var r=[],e=[],f=0,o,u=t[i].sortOrder!=ej.PivotAnalysis.SortOrder.None?ej.DataManager(n).executeLocal(ej.Query().sortBy("keys."+i,t[i].sortOrder!=null&&t[i].sortOrder==ej.PivotAnalysis.SortOrder.Descending?ej.sortOrder.Descending:ej.sortOrder.Ascending,!1)):n;f<u.length;)o=u[f].keys[i],r=$.grep(u,function(n){return n.keys[i]==o}),r.length>1&&i+1<u[f].keys.length&&(r=this._sortHeaders(r,t,i+1)),e=e.concat(r),f+=r.length;return e},_isValidTime:function(n){var t=n.indexOf(":")>-1?n.split(":"):[];return t.length==3?(t[3]=t[2].indexOf(" ")>-1?t[2].split(" ")[1]:"AM",t[2]=t[2].indexOf(" ")>-1?t[2].split(" ")[0]:t[2],Number(t[0])>-1&&Number(t[0])<13&&Number(t[1])>-1&&Number(t[1])<61&&jQuery.isNumeric(t[2])&&(t[3]=="AM"||t[3]=="PM")?!0:!1):!1},_getNumber:function(n,t){return ej.isNullOrUndefined(n)||(jQuery.isNumeric(n.toString().replace(/[,.]/g,""))?(n=n.toString().replace(/[,]/g,ej.preferredCulture(this._locale).numberFormat[","]==","?"":"~").replace(/[.]/g,ej.preferredCulture(this._locale).numberFormat["."]=="."?".":""),n=Number(n.toString().replace(/[~]/g,"."))):n=this._isValidTime(n)?this._formatToInt(n,"time",t):ej.isNullOrUndefined(ej.parseDate(n,t==undefined?"MM/dd/yyyy":t))?n.indexOf("/")!=-1&&n.split("/")==2?this._formatToInt(n,"fraction",undefined):n.trim().indexOf("%")==n.trim().length-1?Number(n.replace(/[^\d.-]/g,""))/100:/[a-zA-Z]/.test(n)?1:Number(n.replace(/[^\d.-]/g,"")):this._formatToInt(n,"date",t)),n},_setFormat:function(n,t,i){switch(t){case"percentage":var r=jQuery.isNumeric(n)?1:100;n=typeof n=="string"?n.toString().split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",",".").replace(ej.preferredCulture(this._locale).numberFormat.percent.symbol,"").trim():n;n=jQuery.isNumeric(n)?n:0;n=ej.widgetBase.formatting("{0:P}",n==""?0:n/r,this._locale);break;case"decimal":case"number":n=typeof n=="string"?n.toString().split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",","."):n;n=jQuery.isNumeric(n)?n:0;n=ej.widgetBase.formatting("{0:N}",n,this._locale);break;case"currency":n=typeof n=="string"?n.toString().split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",",".").replace(ej.preferredCulture(this._locale).numberFormat.currency.symbol,"").trim():n;n=jQuery.isNumeric(n)?n:0;n=ej.widgetBase.formatting("{0:C2}",n==""?0:n,this._locale);break;case"date":jQuery.isNumeric(n)?(n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime()),this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:"+(i==undefined?"MM/dd/yyyy":i)+"}",n,this._locale))):new Date(n)!="Invalid Date"?n=ej.widgetBase.formatting("{0:"+(i==undefined?"MM/dd/yyyy":i)+"}",n,this._locale):(n=new Date((Number(0)-2)*864e5+new Date("01/01/1900").getTime()),n=ej.widgetBase.formatting("{0:"+(i==undefined?"MM/dd/yyyy":i)+"}",n,this._locale));break;case"scientific":n=typeof n=="string"?n.split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",","."):n;n=jQuery.isNumeric(n)?n:0;n=Number(n).toExponential(2).replace("e","E");break;case"accounting":n=this._toAccounting(n,"{0:C2}",this._locale);break;case"time":jQuery.isNumeric(n)?(n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime()),this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale))):this._isValidTime(n)?n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale):(n=new Date((Number(0)-2)*864e5+new Date("01/01/1900").getTime()),n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale));break;case"fraction":n=typeof n=="string"?n.split(ej.preferredCulture(this._locale).numberFormat[","]).join("").replace(",","."):n;n=jQuery.isNumeric(n)?this._toFraction(n):this._toFraction(0);n="numerator"in n?n.integer+" "+n.numerator+"/"+n.denominator:n.integer;break;default:n}return n},_getReflectedValue:function(n,t,i,r){var u=$(n).prop(t);return u==null?u:this._setFormat(u,i,r)},_formatToInt:function(value,format,formatString){var time;switch(format){case"date":value=ej.parseDate(value.toString(),formatString==undefined?"MM/dd/yyyy":formatString,this._locale)!=null?this._dateToInt(ej.parseDate(value,formatString==undefined?"MM/dd/yyyy":formatString,this._locale)):value;break;case"percentage":value=value!=0?ej.globalize.parseFloat(value.toString(),this._locale)/100:Number(value);break;case"currency":case"accounting":value=value!=0?ej.globalize.parseFloat(ej.globalize.format(value.toString(),"c",this._locale),this._locale):Number(value);break;case"decimal":case"number":value=value!=0?ej.globalize.parseFloat(value.toString(),this._locale):Number(value);break;case"scientific":value=value!=0||value==0?parseFloat(value):Number(value);break;case"time":this._isNumber(value)||(time=value.toString().split(":"),time=new Date("1900",time[0],time[1],time[2].split(" ")[0]).toString(),value=this._dateToInt(time));break;case"fraction":var temp1=parseFloat(value.toString().split(" ")[0]),temp2=eval(value.toString().split(" ")[1])!=undefined?parseFloat(eval(value.toString().split(" ")[1])):parseFloat(0),value=value!=0?temp1+temp2:Number(value)}return value},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_toAccounting:function(n,t,i){var s=ej.preferredCulture(i).numberFormat,f,e,u=s.currency.symbol,r,o;return val=ej.widgetBase.formatting(t,n),val=val.indexOf(" ")>-1?val.split(" ").join(""):val,r=val.replace(u,""),o=jQuery.isNumeric(r.toString().split(s[","]).join("").replace(",","."))?val.indexOf(u):0,r=jQuery.isNumeric(r.toString().split(",").join(""))?r:"0.00",!o||Number(r)<0&&o===1?(f=u,e=r):(f=r,e=u),f+" "+e},_toFraction:function(n){if(this._isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this._getPlaceValue(t,i),f=this._getGCD(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},_isNumber:function(n){return n-parseFloat(n)>=0},_getGCD:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this._getGCD(t,n%t)},_getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},_cellEdit:function(n,t,i,r){return $.each(this._editCellsInfo,function(u,f){if(n==(ej.isNullOrUndefined(f.row)&&ej.isNullOrUndefined(f.column)?"":ej.isNullOrUndefined(f.row)?f.column:ej.isNullOrUndefined(f.column)?f.row:f.row+"."+f.column)&&i==parseInt(f.value.split("#")[0]))return t=ej.PivotAnalysis._setFormat(ej.isNullOrUndefined(r.format)?jQuery.isNumeric(f.value.split("#")[1].toString().split(",").join(""))?parseFloat(f.value.split("#")[1].toString().split(",").join("")):0:f.value.split("#")[1],r.format,r.formatString),!1}),t},_isMemberExist:function(n,t,i,r){var h=this,f,s,e,u,o;switch(n){case"row":for(s=!1,this._rowKeysCalcValues.length==0&&this._rowKeysCalcValues.push(t),e=0;e<this._rowKeysCalcValues.length;e++)if(t.uniqueName==this._rowKeysCalcValues[e].uniqueName){s=!0;f=e;break}if(s)for(u=0;u<i.keys.length;u++)if(this._rowKeysCalcValues[f].value==null){this._rowKeysCalcValues[f].value=i;break}else this._rowKeysCalcValues[f].value.keys[u]+=i.keys[u];else this._rowKeysCalcValues.push(t);break;case"column":for(s=!1,this._colKeysCalcValues.length==0&&(r.columns.length>0||r.values.length>0)&&this._colKeysCalcValues.push(t),e=0;e<this._colKeysCalcValues.length;e++)if(t.uniqueName==this._colKeysCalcValues[e].uniqueName){s=!0;f=e;break}if(s)for(u=0;u<i.keys.length;u++)if(this._colKeysCalcValues[f].value==null){this._colKeysCalcValues[f].value=i;break}else this._colKeysCalcValues[f].value.keys[u]+=i.keys[u];else(r.columns.length>0||r.values.length>0)&&this._colKeysCalcValues.push(t);break;case"calc":for(s=!1,this._tableKeysCalcValues.length==0&&this._tableKeysCalcValues.push(t),e=0;e<this._tableKeysCalcValues.length;e++)if(t.uniqueName==this._tableKeysCalcValues[e].uniqueName){s=!0;f=e;break}if(s)for(u=0;u<i.keys.length;u++)if(this._tableKeysCalcValues[f].value==null){for(this._tableKeysCalcValues[f].value=i,this._tableKeysCalcValues[f].value.count=1,o=0;o<i.keys.length;o++)this._summaryTypes[o]==ej.PivotAnalysis.SummaryType.Count&&(this._tableKeysCalcValues[f].value.keys[o]=this._tableKeysCalcValues[f].value.count);break}else this._tableKeysCalcValues[f].value.count++,r.values[u].isCalculatedField!=!0&&(this._tableKeysCalcValues[f].value.keys[u]=this._getSummaryValue(this._tableKeysCalcValues[f].value.keys[u],i.keys[u],this._tableKeysCalcValues[f].value.count,this._summaryTypes[u],r.values[u].format,r.values[u].formatString));else for(this._tableKeysCalcValues.push(t),this._tableKeysCalcValues[this._tableKeysCalcValues.length-1].value=i,o=0;o<i.keys.length;o++)this._summaryTypes[o]==ej.PivotAnalysis.SummaryType.Count&&(this._tableKeysCalcValues[this._tableKeysCalcValues.length-1].value.keys[o]=1),this._tableKeysCalcValues[this._tableKeysCalcValues.length-1].value.count=1}},_getSummaryValue:function(n,t,i,r,u,f){n=this._formatToInt(n,u,f);t=this._formatToInt(t,u,f);switch(r){case ej.PivotAnalysis.SummaryType.Sum:n+=t;break;case ej.PivotAnalysis.SummaryType.Average:n=(n*(i-1)+t)/i;Math.floor(n)!=n&&(n=Number(n.toFixed(2)));break;case ej.PivotAnalysis.SummaryType.Min:n=i==1?t:Math.min(n,t);break;case ej.PivotAnalysis.SummaryType.Max:n=i==1?t:Math.max(n,t);break;case ej.PivotAnalysis.SummaryType.Count:n=i}switch(u){case"percentage":n=ej.widgetBase.formatting("{0:P}",n,this._locale);break;case"decimal":case"number":n=ej.widgetBase.formatting("{0:N}",n,this._locale);break;case"date":n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:"+(f==undefined?"MM/dd/yyyy":f)+"}",n,this._locale));break;case"currency":n=ej.widgetBase.formatting("{0:C2}",n,this._locale);break;case"scientific":n=n.toExponential(2).replace("e","E");break;case"accounting":n=this._toAccounting(n,"{0:C2}",this._locale);break;case"time":n=new Date((Number(n)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(n)&&(n=ej.widgetBase.formatting("{0:h:mm:ss tt}",n,this._locale));break;case"fraction":n=this._toFraction(n);n="numerator"in n?n.integer+" "+n.numerator+"/"+n.denominator:n.integer;break;default:n}return n},_dateToInt:function(n){var t=new Date("01/01/1900"),i=this._isDateTime(n)?n:new Date(n),r=i.getTime()-t.getTime();return r/864e5+2},_insertTotalHeader:function(n,t){var s,r,o,u,h,i;if(n.length<=1){t.push({cellType:"RGTot",keys:["Grand Total"],tot:"sub"});return}for(s=-1,r=n.length-2;r>=0;r--)if(s++,o=t.length,o>0){u=t[0].uniqueName.split(".");h=t[0].keys[s];u=u.slice(0,r+1).join(".");var e="",f=0,c="";for(i=1;i<=o;i++)t[i]!=undefined?(e=t[i].uniqueName.split("."),e=e.slice(0,r+1).join("."),c=t[i].keys[r+1]):e=undefined,e!=undefined&&e.indexOf("Total")==-1?u!=undefined&&e!=u&&(t.splice(i,0,{keys:[u.split(".")[r]+" Total"],cellType:"SubTot",uniqueName:u,level:r,mSpan:i-f}),t[f].span==undefined&&(t[f].span=[]),t[f].span[r]=i-f,i++,o++,u=e,f=i,h=c):u!=undefined&&(t.splice(i,0,{keys:[u.split(".")[r]+" Total"],cellType:"SubTot:",uniqueName:u,level:r,mSpan:i-f}),t[f].span==undefined&&(t[f].span=[]),t[f].span[r]=i-f,i++,o++,u=e,f=i,h=c)}t.push({cellType:"RGTot",keys:["Grand Total"]})},_isPreviousLevelEqual:function(n,t,i,r){for(var u=r-1;u>=0;u--)return n[t].keys[u]!=n[i].keys[u]?!0:!1},_calculateValues:function(n){var t=this._rowKeysCalcValues.length+(n.values.length>0?1:0),u=this._colKeysCalcValues.length==0?1:this._colKeysCalcValues.length*(n.values.length==0?1:n.values.length)+1,i,r;this._gridMatrix=new Array(t+n.rows.length+1);this._populateRowHeaders(n,t+n.rows.length+1,n.rows.length==0?1:n.rows.length);i=n.columns.length+1;r=u+(n.rows.length==0?1:n.rows.length);this._populateColumnHeaders(n,i,r);this._advancedFilterInfo=[];n.values.length>0&&this._populateCalcTable(n);this._tRowCnt=t+i;this._tColCnt=r},_populateRowHeaders:function(n,t,i){var u,c,r,h;if(this._rowKeysCalcValues.length!=0){for(u=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?1+(n.values.length>0?1:0):n.columns.length+(n.values.length>0?1:0),this._gridMatrix=[],c="",r=0;r<this._rowKeysCalcValues.length;r++){c=this._rowKeysCalcValues[r];var e=0,f=0,o=0,s=0;if(this._rowKeysCalcValues[r].keys!=undefined&&this._rowKeysCalcValues[r].keys.length!=0)for(this._gridMatrix[u]=new Array(i),s=this._rowKeysCalcValues[r].keys.length,kCnt=0;kCnt<s;kCnt++)this._rowKeysCalcValues[r].cellType!=undefined?this._rowKeysCalcValues[r].cellType.indexOf("SubTot")>-1?(f=this._rowKeysCalcValues[r].level+e,o=i-this._rowKeysCalcValues[r].level,this._cellType="summary rstot"):(this._cellType="summary rgtot",f=e,o=n.rows.length):(this._cellType="rowheader",f=e,o=1),h=s>1?s-kCnt>1?1:0:0,this._gridMatrix[u][f]={Index:f+","+u,CSS:this._cellType,Value:this._rowKeysCalcValues[r].keys[kCnt],State:h,RowSpan:this._rowKeysCalcValues[r].span!=undefined?this._rowKeysCalcValues[r].span[kCnt]:1,ColSpan:o,Info:"",Span:"None",Expander:h,MCnt:this._rowKeysCalcValues[r].mSpan!=undefined?this._rowKeysCalcValues[r].mSpan:0},e++;u++}this._cellType=""}},_populateColumnHeaders:function(n,t){var i,e,u;if(this._colKeysCalcValues.length!=0){var o=tempCnt=n.rows.length==0?1:n.rows.length,f=n.values.length==0?1:n.values.length,s="",r=colKLen=0,h=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?1:n.columns.length;for(i=0;i<this._colKeysCalcValues.length;i++){for(r=0,tempRIndx=0,tempRSpan=0,tempCSpan=0,s=this._colKeysCalcValues[i].keys,this._gridMatrix[r]==undefined&&(this._gridMatrix[r]=[]),colKLen=this._colKeysCalcValues[i].keys.length,kCnt=0;kCnt<colKLen;kCnt++){for(this._gridMatrix[r]==undefined&&(this._gridMatrix[r]=[]),this._colKeysCalcValues[i].cellType!=undefined?this._colKeysCalcValues[i].cellType.indexOf("SubTot")>-1?(tempRIndx=this._colKeysCalcValues[i].level+r,tempRSpan=t-this._colKeysCalcValues[i].level-1,this._cellType="summary cstot"):(tempRIndx=r,tempRSpan=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?1:n.columns.length,this._cellType="summary cgtot"):(tempRIndx=r,tempRSpan=1,this._cellType="colheader"),e=colKLen>1?colKLen-kCnt>1?1:0:0,u=0;u<f;u++)this._gridMatrix[tempRIndx][f*i+u+tempCnt]={Index:o+","+tempRIndx,CSS:this._cellType,Value:this._colKeysCalcValues[i].keys[kCnt],State:e,ColSpan:(this._colKeysCalcValues[i].span!=undefined?this._colKeysCalcValues[i].span[kCnt]==undefined?1:this._colKeysCalcValues[i].span[kCnt]:1)*f,RowSpan:tempRSpan,Info:"",Span:"None",Expander:e};r++}if(n.values.length>0)for(u=0;u<f;u++)this._gridMatrix[r]==undefined&&(this._gridMatrix[r]=[]),this._gridMatrix[h][f*i+u+tempCnt]={Index:f*i+u+tempCnt+","+r,CSS:this._cellType+" calc",Value:n.values[u].fieldName,State:0,ColSpan:1,RowSpan:1,Info:"",Span:"None",Expander:0};o++}this._cellType=""}},_populateCalcTable:function(n){var t=[],o=n.values.length,f=this,et,w,s,c,d,r,a,rt,g,ut,ft,i,e;this._rowTotCalc=[];this._rowTotCalc=[];var u=n.rows.length==0?1:n.rows.length,nt=0,b=!1,p=0,h=this._colKeysCalcValues.length==1&&this._colKeysCalcValues[0].cellType=="RGTot"?2:n.columns.length+1,tt=h,v,k=!1;for(i=0;i<this._rowKeysCalcValues.length;i++){for(this._colTotCalc=[],v=u,b=!0,this._gridMatrix[i+h]==undefined&&(this._gridMatrix[i+h]=[]),this._rowTotCalc[p]=[],cCnt=0;cCnt<this._colKeysCalcValues.length;cCnt++){if(t=[],this._cellType="value",n.columns.length>0&&n.rows.length>0?$.grep(f._tableKeysCalcValues,function(n){if(n.uniqueName==f._rowKeysCalcValues[i].uniqueName+"."+f._colKeysCalcValues[cCnt].uniqueName)for(r=0;r<n.value.keys.length;r++)t.push(n.value.keys[r]);return}):n.rows.length==0?$.grep(f._tableKeysCalcValues,function(n){if(n.uniqueName==f._colKeysCalcValues[cCnt].uniqueName)for(r=0;r<n.value.keys.length;r++)t.push(n.value.keys[r]);return}):$.grep(f._tableKeysCalcValues,function(n){if(n.uniqueName==f._rowKeysCalcValues[i].uniqueName)for(r=0;r<n.value.keys.length;r++)t.push(n.value.keys[r]);return}),this._editCellsInfo.length>0)for(e=0;e<n.values.length;e++)t[e]=ej.PivotAnalysis._cellEdit(n.columns.length>0&&n.rows.length>0?this._rowKeysCalcValues[i].uniqueName+"."+this._colKeysCalcValues[cCnt].uniqueName:n.rows.length==0?this._colKeysCalcValues[cCnt].uniqueName:this._rowKeysCalcValues[i].uniqueName,t[e],e,n.values[e]);if(this._colKeysCalcValues[cCnt].cellType!=undefined&&(this._colKeysCalcValues[cCnt].cellType.indexOf("SubTot")>-1||this._colKeysCalcValues[cCnt].cellType.indexOf("RGTot")>-1)){for(t=[],r=0;r<o;r++)for(a=0,s=0,c=v;c<=cCnt*o+u;c++)this._gridMatrix[i+h]!=undefined&&this._gridMatrix[i+h][v+a*o+r]!=undefined&&this._gridMatrix[i+h][v+a*o+r].Value!=undefined&&(t[r]==undefined&&(t[r]=0),s++,t[r]=n.values[r].isCalculatedField?this._calculatedFieldSummaryValue(r,t,n):this._getSummaryValue(t[r],this._gridMatrix[i+h][v+a*o+r].Value,s,this._summaryTypes[r]=="count"?"sum":this._summaryTypes[r],n.values[r].format,n.values[r].formatString)),a++;nt=0;v=(cCnt+1)*o+u;t!=0&&this._colTotCalc.push({uniqueName:this._colKeysCalcValues[cCnt].uniqueName,level:this._colKeysCalcValues[cCnt].level,value:t});this._colKeysCalcValues[cCnt-1]!=undefined&&this._colKeysCalcValues[cCnt-1].cellType!=undefined&&this._colKeysCalcValues[cCnt-1].cellType.indexOf("SubTot")>-1&&this._colKeysCalcValues[cCnt-1].cellType.indexOf("RGTot")==-1&&(w=$(this._colTotCalc).filter(function(n,t){return t!=undefined&&t.uniqueName!=undefined&&f._colKeysCalcValues[cCnt].uniqueName!=undefined&&t.level!=undefined&&f._colKeysCalcValues[cCnt].level!=undefined&&t.uniqueName.indexOf(f._colKeysCalcValues[cCnt].uniqueName)===0&&f._colKeysCalcValues[cCnt].level+1==t.level}).map(function(i,r){for(var u=0;u<r.value.length;u++)t[u]=ej.isNullOrUndefined(t[u])?0:t[u],r.value[u]=ej.isNullOrUndefined(r.value[u])?0:r.value[u],n.values[u].isCalculatedField?t[u]=ej.PivotAnalysis._calculatedFieldSummaryValue(u,t,n):t[u]+=r.value[u];return t}),t!=0&&this._colTotCalc.push({uniqueName:this._colKeysCalcValues[cCnt].uniqueName,level:this._colKeysCalcValues[cCnt].level,value:t}));this._cellType="summary value"}if(this._colKeysCalcValues[cCnt].cellType!=undefined&&this._colKeysCalcValues[cCnt].cellType.indexOf("RGTot")>-1&&t==0&&(t=[],s=0,w=$(this._colTotCalc).filter(function(n,t){return t!=undefined&&t!=undefined&&t.level!=undefined&&t.level==0}).map(function(i,r){for(var u=0;u<r.value.length;u++)t[u]=ej.isNullOrUndefined(t[u])?0:t[u],r.value[u]=ej.isNullOrUndefined(r.value[u])?0:r.value[u],s++,t[u]=n.values[u].isCalculatedField?ej.PivotAnalysis._calculatedFieldSummaryValue(u,t,n):ej.PivotAnalysis._getSummaryValue(t[u],r.value[u],s,f._summaryTypes[u]=="count"?"sum":f._summaryTypes[u],n.values[u].format,n.values[u].formatString);return t}),this._cellType="summary value"),this._rowKeysCalcValues[i].cellType!=undefined&&(this._rowKeysCalcValues[i].cellType.indexOf("SubTot")>-1||this._rowKeysCalcValues[i].cellType.indexOf("RGTot")>-1)){for(t=[],et=this._rowKeysCalcValues[i].uniqueName,this._rowKeysCalcValues[i-1]!=undefined&&this._rowKeysCalcValues[i-1].cellType!=undefined&&this._rowKeysCalcValues[i-1].cellType.indexOf("SubTot")>-1&&this._rowKeysCalcValues[i].cellType.indexOf("RGTot")==-1&&(s=0,w=$(this._rowTotCalc).filter(function(n,t){return t[0]!=undefined&&t[0].uniqueName!=undefined&&f._rowKeysCalcValues[i].uniqueName!=undefined&&t[0].level!=undefined&&f._rowKeysCalcValues[i].level!=undefined&&t[0].uniqueName.indexOf(f._rowKeysCalcValues[i].uniqueName)===0&&f._rowKeysCalcValues[i].level+1==t[0].level}).map(function(i,r){if(r[u+cCnt].length>0){s++;for(var e=0;e<r[u+cCnt].length;e++)t[e]=ej.isNullOrUndefined(t[e])?0:t[e],r[u+cCnt][e]=ej.isNullOrUndefined(r[u+cCnt][e])?0:r[u+cCnt][e],t[e]=n.values[e].isCalculatedField?ej.PivotAnalysis._calculatedFieldSummaryValue(e,t,n):ej.PivotAnalysis._getSummaryValue(t[e],r[u+cCnt][e],s,f._summaryTypes[e]=="count"?"sum":f._summaryTypes[e],n.values[e].format)}return t})),this._rowKeysCalcValues[i].cellType!=undefined&&this._rowKeysCalcValues[i].cellType.indexOf("RGTot")>-1&&(s=0,w=$(this._rowTotCalc).filter(function(n,t){return t!=undefined&&t[0]!=undefined&&t[0].level!=undefined&&t[0].level==0}).map(function(i,r){if(r[u+cCnt].length>0){s++;for(var e=0;e<r[u+cCnt].length;e++)t[e]=ej.isNullOrUndefined(t[e])?0:t[e],r[u+cCnt][e]=ej.isNullOrUndefined(r[u+cCnt][e])?0:r[u+cCnt][e],t[e]=n.values[e].isCalculatedField?ej.PivotAnalysis._calculatedFieldSummaryValue(e,t,n):ej.PivotAnalysis._getSummaryValue(t[e],r[u+cCnt][e],s,f._summaryTypes[e]=="count"?"sum":f._summaryTypes[e],n.values[e].format,n.values[e].formatString)}return t})),s=1,c=tt;c<=i+h;c++){for(d=!1,r=0;r<o;r++)a=0,this._gridMatrix[c]!=undefined&&this._gridMatrix[c][u+cCnt*o+r]!=undefined&&this._gridMatrix[c][u+cCnt*o+r].Value!=undefined&&(t[r]==undefined&&(t[r]=0),d=!0,t[r]=n.values[r].isCalculatedField?this._calculatedFieldSummaryValue(r,t,n):this._getSummaryValue(t[r],this._gridMatrix[c][u+cCnt*o+r].Value,s,this._summaryTypes[r]=="count"?"sum":this._summaryTypes[r],n.values[r].format,n.values[r].formatString)),a++;d&&s++}nt=0;k=!0;b&&(this._rowTotCalc[p][0]={uniqueName:this._rowKeysCalcValues[i].uniqueName,level:this._rowKeysCalcValues[i].level},b=!1);this._rowTotCalc[p][u+cCnt]=t;this._cellType="summary value"}if(n.enableAdvancedFilter){var y=0,it=this,l=this._currentFilterVal.fieldName?ej.Pivot.getReportItemByFieldName(this._currentFilterVal.fieldName,n):null;l!=null&&l.axis=="rows"&&(y=this._getFilteredIndex(n.rows,n.values,i,it._rowKeysCalcValues));ej.isNullOrUndefined(y)||l==null||l.axis=="rows"||(y=this._getFilteredIndex(n.columns,n.values,cCnt,it._colKeysCalcValues));ej.isNullOrUndefined(y)||(rt=this._rowKeysCalcValues[i].keys.length>0&&n.rows.length>0&&n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter&&n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter.length>0&&n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter?1:null,g=l&&l!=null&&rt!=null&&n.rows[this._rowKeysCalcValues[i].keys.length-1].fieldName==l.item.fieldName?this._applyValueFilter(n.rows[this._rowKeysCalcValues[i].keys.length-1].advancedFilter,t[y]):!1,this._colKeysCalcValues[cCnt].keys.indexOf("Grand Total")>=0&&g&&this._rowKeysCalcValues[i].uniqueName?this._advancedFilterInfo.push(this._rowKeysCalcValues[i].uniqueName):n.columns.length==0&&g&&this._rowKeysCalcValues[i].uniqueName&&this._advancedFilterInfo.push(this._rowKeysCalcValues[i].uniqueName),ut=this._colKeysCalcValues[cCnt].keys.length>0&&n.columns.length>0&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter.length>0&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter[0].advancedFilterType==ej.Pivot.AdvancedFilterType.ValueFilter?1:null,ft=l!=null&&ut!=null&&n.columns[this._colKeysCalcValues[cCnt].keys.length-1].fieldName==l.item.fieldName?this._applyValueFilter(n.columns[this._colKeysCalcValues[cCnt].keys.length-1].advancedFilter,t[y]):!1,this._colKeysCalcValues[cCnt].uniqueName&&jQuery.type(this._rowKeysCalcValues[i].keys[0])==="string"&&this._rowKeysCalcValues[i].keys[0].indexOf("Grand Total")>-1&&ft&&this._advancedFilterInfo.push(this._colKeysCalcValues[cCnt].uniqueName))}for(e=0;e<o;e++)this._gridMatrix[h+i][o*cCnt+e+u]=t!=undefined&&t.length!=undefined?{Index:o*cCnt+e+u+","+h+i,CSS:this._cellType,Value:t[e],State:0,ColSpan:1,RowSpan:1,Info:"",Span:"None",Expander:0}:0}k&&(p++,tt=i+h+1,k=!1)}for(i=0;i<this._rowKeysCalcValues.length;i++)for(cCnt=0;cCnt<this._colKeysCalcValues.length;cCnt++)for(e=0;e<o;e++)n.values[e].isCalculatedField&&this._gridMatrix[h+i][o*cCnt+e+u].Value==null&&(this._gridMatrix[h+i][o*cCnt+e+u].Value=this._calculatedFieldSummaryValue(e,[],n));return this._gridMatrix}};ej.PivotAnalysis.SortOrder={Ascending:"ascending",Descending:"descending",None:"none"};ej.PivotAnalysis.FilterType={Exclude:"exclude",Include:"include"};ej.PivotAnalysis.SummaryType={Sum:"sum",Average:"average",Count:"count",Min:"min",Max:"max"}}(jQuery,Syncfusion);ej.Pivot=ej.Pivot||{},function(n,t,r){t.Pivot={addReportItem:function(n,i){if(i.isMeasuresDropped)i.droppedClass!=""?n.values[0].axis=i.droppedClass=="row"?"rows":i.droppedClass=="column"?"columns":n.values[0].axis:n.values[0].measures=[];else{var r=this.removeReportItem(n,i.droppedFieldName,i.isMeasuresDropped);t.isNullOrUndefined(r)&&(r={fieldName:i.droppedFieldName,fieldCaption:i.droppedFieldCaption});switch(i.droppedClass){case"row":i.droppedPosition.toString()!=""?n.rows.splice(i.droppedPosition,0,r):n.rows.push(r);break;case"column":i.droppedPosition.toString()!=""?n.columns.splice(i.droppedPosition,0,r):n.columns.push(r);break;case"value":n.cube==""?i.droppedPosition.toString()!=""?n.values.splice(i.droppedPosition,0,r):n.values.push(r):i.droppedPosition.toString()!=""?n.values[0].measures.splice(i.droppedPosition,0,r):n.values[0].measures.push(r);break;case"filter":i.droppedPosition.toString()!=""?n.filters.splice(i.droppedPosition,0,r):n.filters.push(r)}}},removeReportItem:function(i,r,u){var o=i.cube==""?t.Pivot.AnalysisMode.Pivot:t.Pivot.AnalysisMode.Olap,f=n.grep(i.columns,function(n){return n.fieldName==r}),e;return u?i.values[0].measures=[]:f.length>0?i.columns=n.grep(i.columns,function(n){return n.fieldName!=r}):(f=n.grep(i.rows,function(n){return n.fieldName==r}),f.length>0?i.rows=n.grep(i.rows,function(n){return n.fieldName!=r}):(e=o==t.Pivot.AnalysisMode.Olap?i.values[0].measures:i.values,f=n.grep(e,function(n){return n.fieldName==r}),f.length>0?i.values=o==t.Pivot.AnalysisMode.Olap?[{measures:n.grep(e,function(n){return n.fieldName!=r}),axis:i.values[0].axis}]:n.grep(e,function(n){return n.fieldName!=r}):(f=n.grep(i.filters,function(n){return n.fieldName==r}),f.length>0&&(i.filters=n.grep(i.filters,function(n){return n.fieldName!=r}))))),f[0]},getReportItemByFieldName:function(i,r){var f="columns",u=n.grep(r.columns,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),e;return u.length==0&&(u=n.grep(r.rows,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),f="rows"),u.length==0&&(e=r.cube==""?r.values:r.values.length>0&&!t.isNullOrUndefined(r.values[0].measures)?r.values[0].measures:[],u=n.grep(e,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),f="values"),u.length==0&&(u=n.grep(r.filters,function(n){return n.fieldName.toLowerCase()==i.toLowerCase()}),f="filters"),{item:u[0],axis:f}},getReportItemByFieldCaption:function(i,r){var f="columns",u=n.grep(r.columns,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),e;return u.length==0&&(u=n.grep(r.rows,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),f="rows"),u.length==0&&(e=r.cube==""?r.values:r.values.length>0&&!t.isNullOrUndefined(r.values[0].measures)?r.values[0].measures:[],u=n.grep(e,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),f="values"),u.length==0&&(u=n.grep(r.filters,function(n){return n.fieldCaption.toLowerCase()==i.toLowerCase()}),f="filters"),{item:u[0],axis:f}},closePreventPanel:function(n){var i=n.type!="close"?n:this;i.element.find("#preventDiv").remove();t.isNullOrUndefined(i.model.pivotControl)||i.model.pivotControl.element.find("#preventDiv").remove();t.isNullOrUndefined(i._waitingPopup)||i._waitingPopup.hide();t.isNullOrUndefined(i.model.pivotControl)||t.isNullOrUndefined(i.model.pivotControl._waitingPopup)||i.model.pivotControl._waitingPopup.hide()},openPreventPanel:function(i){var r=t.buildTag("div#preventDiv.errorDlg").css({width:n("body").width()+"px",height:n("body").height()+"px",position:"absolute",top:n("body").offset().top+"px",left:n("body").offset().left+"px","z-index":10})[0].outerHTML;n("#"+i._id).append(r)},_createErrorDialog:function(i,r,u){var e,o;if(t.Pivot.closePreventPanel(u),u._errorDialog=r,t.Pivot.openPreventPanel(u),u.element.find(".errorDialog:visible").length==0){e=t.isNullOrUndefined(i.Exception)?t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent action:",i)[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK",{margin:"20px 0 10px 165px"})[0].outerHTML)[0].outerHTML).attr("title",r)[0].outerHTML:t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent action:",i.Exception.Message)[0].outerHTML+t.buildTag("br")[0].outerHTML+t.buildTag("div."+u._id+"stackTraceContent","Stack Trace :"+i.Exception.StackTraceString)[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK",{margin:"20px 0 10px 165px"})[0].outerHTML)[0].outerHTML).attr("title",r)[0].outerHTML;u.element.append(e);u.element.find(".errorDialog").ejDialog({target:"#"+u._id,enableResize:!1,enableRTL:u.model.enableRTL,width:"400px",close:t.proxy(t.Pivot.closePreventPanel,u)});o=u.element.find(".errorDialog").data("ejDialog");n("#"+o._id+"_wrapper").css({left:"50%",top:"50%"});u.element.find(".errOKBtn").ejButton({type:t.ButtonType.Button,width:"50px"}).on(t.eventType.click,function(){u._errorDialog!="nodeCheck"||t.isNullOrUndefined(u._schemaData)||t.isNullOrUndefined(u._schemaData._selectedTreeNode)||u._schemaData._tableTreeObj.uncheckNode(u._schemaData._selectedTreeNode);u.element.find("#preventDiv").remove();(u._errorDialog=="Warning"||u._errorDialog=="Exception"||u._errorDialog=="Error")&&u.element.children("#ErrorDialog_wrapper").remove()});if(u.element.find(".e-dialog .e-close").attr("title","Close"),t.isNullOrUndefined(n("#"+u._id).data("ejWaitingPopup"))||n("#"+u._id).data("ejWaitingPopup").hide(),typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide(),!t.isNullOrUndefined(i.Exception)){var f=50,h="...",s="Show more",c="Show less";n("."+u._id+"stackTraceContent").each(function(){var i=n(this).html();if(i.length>f){u._id;var r=i.substr(0,f),e=i.substr(f,i.length-f),o=r+t.buildTag("span."+u._id+"moreellipses",h)[0].outerHTML+t.buildTag("span."+u._id+"morecontent",t.buildTag("span",e).css("display","none")[0].outerHTML+t.buildTag("a."+u._id+"morelink",s).css("display","block")[0].outerHTML)[0].outerHTML;n(this).html(o)}});n("."+u._id+"morelink").click(function(){return n(this).hasClass("less")?(n(this).removeClass("less"),n(this).html(s)):(n(this).addClass("less"),n(this).html(c)),n(this).parent().prev().toggle("slow",function(){}),n(this).prev().toggle("slow",function(){}),!1})}}},_contextMenuOpen:function(i,r){var f,e,u;if(t.Pivot.openPreventPanel(r),r._selectedMember=n(i.target),r.pluginName=="ejPivotGrid"?(f=r.model.analysisMode==t.Pivot.AnalysisMode.Olap?"olap":"pivot",u=n("#pivotTree").data("ejMenu")):(t.isNullOrUndefined(r.model.pivotControl)||(f=r.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"olap":"pivot"),u=n("#pivotTreeContextMenu").data("ejMenu")),f==t.Pivot.AnalysisMode.Olap){if(t.isNullOrUndefined(n(i.target).parent().attr("tag"))&&n(i.target).hasClass("pivotButton")&&n(i.target).children(".pvtBtn:eq(0)").length>0)return r._selectedMember=n(i.target).children(".pvtBtn:eq(0)"),!1;n(i.target).parent().attr("tag").split(":")[1].toLowerCase().startsWith("[measures]")?u.disable():r._selectedMember.parent().attr("tag").split(":")[1].toLowerCase()=="measures"?(u.disableItem(r._getLocalizedLabels("AddToValues")),u.disableItem(r._getLocalizedLabels("AddToFilter")),u.enableItem(r._getLocalizedLabels("AddToRow")),u.enableItem(r._getLocalizedLabels("AddToColumn"))):(u.disableItem(r._getLocalizedLabels("AddToValues")),n(i.target.parentElement).find(".namedSetCDB").length>0?u.disableItem(r._getLocalizedLabels("AddToFilter")):u.enableItem(r._getLocalizedLabels("AddToFilter")),u.enableItem(r._getLocalizedLabels("AddToRow")),u.enableItem(r._getLocalizedLabels("AddToColumn")))}else f==t.Pivot.AnalysisMode.Pivot&&(e=i.target.textContent,n(i.target).hasClass("e-btn")?(u.enable(),r.pluginName=="ejPivotGrid"&&(u.disableItem(r._getLocalizedLabels("CalculatedField")),n(i.target).parents(".pivotButton").attr("tag").split(":")[0].toLowerCase()=="values"&&(r.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&n.grep(r.model.dataSource.values,function(n){return n.fieldCaption==e&&n.isCalculatedField==!0}).length>0?u.disable():r.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n.grep(JSON.parse(r.getOlapReport()).PivotCalculations,function(n){return n.FieldHeader==e&&n.CalculationType==8}).length>0&&u.disable(),u.enableItem(r._getLocalizedLabels("CalculatedField"))))):(u=n("#pivotTree").data("ejMenu"),u.disable()))},_searchTreeNodes:function(i){var a=n(i.target).hasClass("searchTreeView")?this.element.find(".searchTreeView").data("ejMaskEdit"):this.element.find(".searchEditorTreeView").data("ejMaskEdit"),u=n(i.target).hasClass("searchTreeView")?this.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.find(".schemaFieldTree").data("ejTreeView"):this.element.find(".cubeTreeView").data("ejTreeView"):this.element.find(".editorTreeView").data("ejTreeView"),s=u.element,v=t.isNullOrUndefined(a.get_StrippedValue())?"":a.get_StrippedValue().toLowerCase(),f,e,c,o,l,r;if(v.length>0){var y=[],p=[],h=s.find("ul>li>div>a");for(f=0;f<h.length;f++)n(h[f]).text().toLowerCase().indexOf(v)!=-1?y.push(h[f]):p.push(h[f]);for(e=s.find(y).closest("li").css("display","block"),s.find(p).closest("li").css("display","none"),r=0;r<e.length;r++)c=n(e[r]),o=c.parents("ul").closest("li").css("display","block"),o.length>0&&(u.expandNode(o),u.model.expandedNodes.indexOf(n(u._liList).index(o))!=-1||t.isNullOrUndefined(window._temp)||window._temp.push(o)),l=c.children("ul"),l.length>0&&l.children("li:visible").length==0&&(c.children("ul").children("li").css("display","block"),u.expandNode(e[r]),u.model.expandedNodes.indexOf(n(u._liList).index(e[r]))!=-1||t.isNullOrUndefined(window._temp)||window._temp.push(e[r]))}else{if(s.find("ul>li").css("display","block"),!t.isNullOrUndefined(window._temp))for(r=0;r<window._temp.length;r++)u._collpaseNode(window._temp[r]);window._temp=[];n(i.target).hasClass("searchTreeView")&&u.collapseAll()}},editorTreeNavigatee:function(i,u){var o=u._memberPageSettings.currentMemeberPage,e,f;if(!n(i.target).hasClass("pageDisabled")){if(n(i.target).hasClass("nextPage"))u._memberPageSettings.startPage+=u.model.memberEditorPageSize,u._memberPageSettings.currentMemeberPage+=1,u._memberPageSettings.endPage+=u.model.memberEditorPageSize;else if(n(i.target).hasClass("prevPage"))u._memberPageSettings.currentMemeberPage-=1,u._memberPageSettings.startPage=Math.abs(u._memberPageSettings.startPage-(u._memberPageSettings.currentMemeberPage==1?u.model.memberEditorPageSize:u.model.memberEditorPageSize)),u._memberPageSettings.endPage-=u.model.memberEditorPageSize;else if(n(i.target).hasClass("firstPage"))u._memberPageSettings.currentMemeberPage=1,u._memberPageSettings.endPage=u.model.memberEditorPageSize,u._memberPageSettings.startPage=0;else if(n(i.target).hasClass("lastPage"))u._memberPageSettings.currentMemeberPage=parseInt(u.element.find(".memberPageCount").text().split("/")[1].trim()),u._memberPageSettings.endPage=u._memberPageSettings.currentMemeberPage*u.model.memberEditorPageSize,u._memberPageSettings.startPage=u._memberPageSettings.endPage-u.model.memberEditorPageSize;else{if(parseInt(n(i.target).val())>parseInt(t.isNullOrUndefined(u._pivotSchemaDesigner)?u.element.find(".memberPageCount").text().split("/")[1].trim():u._pivotSchemaDesigner.element.find(".memberPageCount").text().split("/")[1].trim())||parseInt(n(i.target).val())==0)return!1;u._memberPageSettings.currentMemeberPage=parseInt(n(i.target).val());u._memberPageSettings.endPage=u._memberPageSettings.currentMemeberPage*u.model.memberEditorPageSize;u._memberPageSettings.startPage=u._memberPageSettings.currentMemeberPage==1||u._memberPageSettings.currentMemeberPage==0?0:u._memberPageSettings.endPage-u.model.memberEditorPageSize}u._waitingPopup.show();u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?(u._isMemberPageFilter=!0,e=t.Pivot.updateTreeView(u._pivotSchemaDesigner),f=t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),f.splice(0,0,{id:"All",name:"All",checkedStatus:u._isAllMemberChecked,tag:""}),u._pivotSchemaDesigner._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(f)})):(u._isSearchApplied=!1,this.editorTreePageInfoSuccess(u._editorTreeData,u))}},editorTreePageInfoSuccess:function(i,u){setTimeout(function(){u._memberPageSettings.currentMemeberPage>1?u.element.find(".prevPage, .firstPage").removeClass("pageDisabled").addClass("pageEnabled"):u.element.find(".prevPage, .firstPage").removeClass("pageEnabled").addClass("pageDisabled");u._memberPageSettings.currentMemeberPage==parseInt(u.element.find(".memberPageCount").text().split("/")[1].trim())?u.element.find(".nextPage, .lastPage").removeClass("pageEnabled").addClass("pageDisabled"):u.element.find(".nextPage, .lastPage").removeClass("pageDisabled").addClass("pageEnabled");var e,f;u.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(e=i[0]!=r?i[0].Value:i.d!=r?i.d[0].Value:i.EditorTreeInfo,f=n.parseJSON(e),f.splice(-1,1));u.element.find(".memberCurrentPage").val(u._memberPageSettings.currentMemeberPage);u._appendTreeViewData(u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?f:t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),!1);u._unWireEvents();u._wireEvents();u._waitingPopup.hide()},0)},_searchEditorTreeNodes:function(i,u){u._waitingPopup.show();var f=this;setTimeout(function(){var e="",s,o,i;if(e=t.isNullOrUndefined(u._pivotSchemaDesigner)?t.isNullOrUndefined(n.trim(u.element.find(".searchEditorTreeView").val()))?"":n.trim(u.element.find(".searchEditorTreeView").val()).toLowerCase():t.isNullOrUndefined(n.trim(u._pivotSchemaDesigner.element.find(".searchEditorTreeView").val()))?"":n.trim(u._pivotSchemaDesigner.element.find(".searchEditorTreeView").val()).toLowerCase(),e!=""){for(i=jQuery.extend(!0,[],t.DataManager(u._editorTreeData).executeLocal(t.Query().where("name","contains",e,!0))),s=jQuery.extend(!0,[],t.DataManager(i).executeLocal(t.Query().where("pid","notEqual",null||r).where("name","contains",e,!0))),o=0;o<s.length;o++)f._appendParentNodes(i,s[o],u);u._isSearchApplied=!0;t.isNullOrUndefined(u._pivotSchemaDesigner)?u._appendTreeViewData(i,!1):(i.length>0&&i.splice(0,0,{id:"All",name:"All",checkedStatus:u._isAllMemberChecked,tag:""}),f._createSearchTreeview(i,u._pivotSchemaDesigner))}else u._isSearchApplied=!1,t.isNullOrUndefined(u._pivotSchemaDesigner)?u._appendTreeViewData(t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),!1):(i=t.DataManager(u._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r).page(u._memberPageSettings.currentMemeberPage,u.model.memberEditorPageSize)),i.splice(0,0,{id:"All",name:"All",checkedStatus:u._isAllMemberChecked,tag:""}),f._createSearchTreeview(i,u._pivotSchemaDesigner));t.isNullOrUndefined(u._pivotSchemaDesigner)&&(u._unWireEvents(),u._wireEvents());u._waitingPopup.hide()},0)},_createSearchTreeview:function(i,r){var f,u;for(r.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:r.model.enableRTL,beforeDelete:function(){return!1},height:r.element.find(".memberEditorDiv").height(),fields:{id:"id",text:"name",isChecked:"checkedStatus",hasChild:"hasChildren",dataSource:i}}),f=r.element.find(".editorTreeView").find("li"),u=0;u<f.length;u++)t.isNullOrUndefined(n(f[u]).attr("id"))||n(f[u]).attr("tag",t.DataManager(i).executeLocal(t.Query().where("id","equal",n(f[u]).attr("id")))[0].tag);r._memberTreeObj=r.element.find(".editorTreeView").data("ejTreeView");r._memberTreeObj.model.nodeCheck=t.proxy(r._nodeCheckChanges,r);r._memberTreeObj.model.nodeUncheck=t.proxy(r._nodeCheckChanges,r);r._memberTreeObj.model.beforeExpand=t.proxy(r._beforeNodeExpand,r);t.isNullOrUndefined(r.element.find(".e-dialog .e-text:visible").first())||(r.element.find(".e-dialog .e-text:visible").length>0?(r.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"),r.element.find(".e-dialog button").removeClass("hoverCell")):r.element.find(".e-dialog button:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"))},_appendParentNodes:function(n,i,r){var u=jQuery.extend(!0,[],t.DataManager(r._editorTreeData).executeLocal(t.Query().where("id","equal",i.pid)));!t.isNullOrUndefined(u)&&u.length>0&&t.DataManager(n).executeLocal(t.Query().where("id","equal",u[0].id)).length==0&&(u[0].expanded=!0,n.push(u[0]),t.isNullOrUndefined(u[0].pid)||this._appendParentNodes(n,u[0],r))},_selectParentTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("id","equal",n.pid));!t.isNullOrUndefined(r)&&r.length>0&&(r[0].checkedStatus=!0,this._selectParentTreeNode(r[0],i))},_selectChildTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",n.id)),u;if(!t.isNullOrUndefined(r)&&r.length>0)for(u=0;u<r.length;u++)r[u].checkedStatus=!0,this._selectChildTreeNode(r[u],i)},_unSelectChildTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",n.id)),u;if(!t.isNullOrUndefined(r)&&r.length>0)for(u=0;u<r.length;u++)r[u].checkedStatus=!1,this._selectChildTreeNode(r[u],i)},_unSelectParentTreeNode:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("id","equal",n.pid));!t.isNullOrUndefined(r)&&r.length>0&&(r[0].checkedStatus=!1,t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",r[0].pid).where("checkedStatus","equal",!0)).length==0&&this._unSelectParentTreeNode(r[0],i))},_getSelectedTreeState:function(n,i){var f,o,h,s,e,u;if(n){for(e=[],f=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",null||r)),u=0;u<f.length;u++){if(o=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",f[u].id)),h={caption:f[u].name,parentId:t.isNullOrUndefined(f[u].pid)?"None":f[u].pid,id:f[u].id,checked:f[u].checkedStatus,expanded:o.length>0?!0:!1,childNodes:[],tag:f[u].tag},o.length>0)for(s=0;s<o.length;s++)h.childNodes.push(this._getEditorSlicerInfo(o[s],i));e.push(h)}return JSON.stringify(e)}for(e="",u=0;u<i._editorTreeData.length;u++)i._editorTreeData[u].checkedStatus==!0&&(e+="::"+i._editorTreeData[u].id+"||"+i._editorTreeData[u].tag);return e},_getUnSelectedTreeState:function(n){for(var i="",t=0;t<n._editorTreeData.length;t++)n._editorTreeData[t].checkedStatus==!1&&(i+="::"+n._editorTreeData[t].id+"||"+n._editorTreeData[t].tag);return i},_getEditorSlicerInfo:function(n,i){var r=t.DataManager(i._editorTreeData).executeLocal(t.Query().where("pid","equal",n.id)),f={caption:n.name,parentId:t.isNullOrUndefined(n.pid)?"None":n.pid,id:n.id,checked:n.checkedStatus,expanded:r.length>0?!0:!1,childNodes:[],tag:n.tag},u;if(r.length>0)for(u=0;u<r.length;u++)f.childNodes.push(this._getEditorSlicerInfo(r[u],i));return f},createErrorDialog:function(i){var r,u;t.Pivot.openPreventPanel(i);i.element.find(".errorDialog").length==0?(u=t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent",i._getLocalizedLabels("AlertMsg"))[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK")[0].outerHTML)[0].outerHTML).attr("title",i._getLocalizedLabels("Warning"))[0].outerHTML,i.element.append(u),i.element.find(".errorDialog").ejDialog({target:"#"+i._id,enableResize:!1,enableRTL:i.model.enableRTL,width:"400px"}),r=i.element.find(".errorDialog").data("ejDialog"),n("#"+r._id+"_wrapper").css({left:"50%",top:"50%"}),i.element.find(".errOKBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(t.Pivot.errOKBtnClick,i)}),i.element.find(".e-dialog .e-close").attr("title",i._getLocalizedLabels("Close"))):(r=i.element.find(".errorDialog").data("ejDialog"),r.open())},errOKBtnClick:function(){this.element.find("#preventDiv").remove();var n=this.element.find(".errorDialog").data("ejDialog");n._ejDialog.find("div.e-dialog-icon").trigger("click")},doAjaxPost:function(i,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==r?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:i,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(t){n.proxy(t,this);var i={action:this._currentAction,customObject:"",element:this.element}},this),error:t.proxy(function(n){typeof this._ogridWaitingPopup!="undefined"&&this._ogridWaitingPopup!=null&&this._ogridWaitingPopup.hide();typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide();var t={action:this._drillAction!=""?this._drillAction:"initialize",customObject:"",element:this.element,Message:n};this._trigger("renderFailure",t);this.renderControlFromJSON("");this._dataModel=="XMLA"&&this._createErrorDialog(n.statusText,this._getLocalizedLabels("Error"));n.statusText},this)})},getCubeList:function(t,i){for(var f,u=[],r=0;r<n(i).find("row").length;r++)f=n(n(i).find("row")[r]),u.push({name:n(f).children("CUBE_NAME").text()});t.pvtCtrldObj.setCubeList(u)},generateTreeViewData:function(n){var t={catalog:n.model.pivotControl.model.dataSource.catalog,cube:n.model.pivotControl.model.dataSource.cube,url:n.model.pivotControl.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"};this._getTreeData(t,this.loadDimensionElements,{schemaData:n,action:"loadFieldElements"})},loadDimensionElements:function(i,u){var h,f=i.schemaData.model.pivotControl,c={},v=t.olap.base._getConnectionInfo(f.model.dataSource.data),o={},a=f.model.dataSource.providerName==t.olap.Providers.Mondrian,s;for(o={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},f.schemaTreeView=[],f.reportItemNames=[],s=0;s<n(u).find("row").length;s++){var l=n(n(u).find("row")[s]),e=l.find("DIMENSION_UNIQUE_NAME").text(),h=l.find("DIMENSION_CAPTION").text();e.toLowerCase().indexOf("[measure")>=0?c={hasChildren:!0,isSelected:!1,id:e,name:h,spriteCssClass:e.toLowerCase()=="[measures]"?"folderCDB e-icon":"dimensionCDB e-icon",tag:e}:!n(n(u).find("row")[0]).find("HIERARCHY_CAPTION").length>0&&f.schemaTreeView.push({hasChildren:!0,isSelected:!1,id:a?e+"~#^Dim":e,name:h,spriteCssClass:"dimensionCDB e-icon",tag:e,defaultHierarchy:n(n(u).find("row")[s]).children("DEFAULT_HIERARCHY").text()})}f.schemaTreeView.splice(0,0,c);!f.model.enableDrillThrough||i.schemaData!=r&&i.schemaData.model.olap.showNamedSets?(o.request="MDSCHEMA_SETS",t.Pivot._getTreeData(o,t.Pivot.loadNamedSetElements,i)):(o.request="MDSCHEMA_HIERARCHIES",(t.isNullOrUndefined(f._fieldData)||!t.isNullOrUndefined(f._fieldData)&&t.isNullOrUndefined(f._fieldData.hierarchy))&&this._getFieldItemsInfo(f),f._fieldData.hierarchySuccess==r?t.Pivot._getTreeData(o,f.loadHierarchyElements,i):t.Pivot.loadHierarchyElements(i,f._fieldData.hierarchySuccess))},loadNamedSetElements:function(i,u){var e=i.schemaData.model.pivotControl,c={catalog:e.model.dataSource.catalog,cube:e.model.dataSource.cube,url:e.model.dataSource.data,request:"MDSCHEMA_HIERARCHIES"},u=e.model.dataSource,h=[],o,s,f;for(o=n.map(u.rows,function(n){if(n.fieldName!=r)return n.fieldName}),n.merge(o,n.map(u.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(o,n.map(u.filters,function(n){if(n.fieldName!=r)return n.fieldName})),s=0;s<n(u).find("row").length;s++)f=n(n(u).find("row")[s]),n.inArray(f.find("DIMENSIONS").text().split(".")[0],h)>=0||(e.schemaTreeView.push({hasChildren:!0,isSelected:!1,pid:f.find("DIMENSIONS").text().split(".")[0],id:f.find("SET_DISPLAY_FOLDER").text()+"_"+f.find("DIMENSIONS").text().split(".")[0],name:f.find("SET_DISPLAY_FOLDER").text(),spriteCssClass:"folderCDB e-icon namedSets"}),h.push(f.find("DIMENSIONS").text().split(".")[0])),e.schemaTreeView.push({hasChildren:!0,isSelected:n.inArray("["+n.trim(f.children("SET_NAME").text())+"]",o)>=0,pid:f.find("SET_DISPLAY_FOLDER").text()+"_"+f.find("DIMENSIONS").text().split(".")[0],id:"["+n.trim(f.children("SET_NAME").text()).replace(/\&/g,"&")+"]",name:f.children("SET_CAPTION").text(),spriteCssClass:"namedSetCDB e-icon",tag:f.find("EXPRESSION").text()});t.isNullOrUndefined(e._fieldData)||e._fieldData.hierarchySuccess==r?t.Pivot._getTreeData(c,t.Pivot.loadHierarchyElements,i):t.Pivot.loadHierarchyElements(i,e._fieldData.hierarchySuccess)},loadHierarchyElements:function(i,u){var f=i.schemaData.model.pivotControl,v={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_LEVELS"},c=f.model.dataSource,o,a=f.model.dataSource.providerName==t.olap.Providers.Mondrian,s;for(o=n.map(c.rows,function(n){if(n.fieldName!=r)return n.fieldName}),n.merge(o,n.map(c.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(o,n.map(c.filters,function(n){if(n.fieldName!=r)return n.fieldName})),s=0;s<n(u).find("row").length;s++){var e=n(n(u).find("row")[s]),l=e.find("DIMENSION_UNIQUE_NAME").text(),h=e.find("HIERARCHY_UNIQUE_NAME").text(),y=n(f.schemaTreeView).filter(function(n,t){return t.tag==l}).map(function(n,t){return t});y.length>0&&(l!=h||a)&&f.schemaTreeView.push({hasChildren:!0,isSelected:n.inArray(h,o)>=0,pid:l+(a?"~#^Dim":""),id:h,name:e.find("HIERARCHY_CAPTION").text(),spriteCssClass:e.find("HIERARCHY_ORIGIN").text()!="2"&&e.find("HIERARCHY_ORIGIN").text()!="6"?"hierarchyCDB e-icon":"attributeCDB e-icon",tag:h})}t.Pivot._getTreeData(v,t.Pivot.loadLevelElements,i)},loadLevelElements:function(i,r){var u=i.schemaData.model.pivotControl,e=n.map(n(r).find("row"),function(t){if(parseInt(n(t).children("LEVEL_TYPE").text())!="1"&&n(t).children("HIERARCHY_UNIQUE_NAME").text().toLowerCase()!="[measures]")return{hasChildren:!1,isChecked:!1,id:n(t).find("LEVEL_UNIQUE_NAME").text(),pid:n(t).find("HIERARCHY_UNIQUE_NAME").text(),name:n(t).find("LEVEL_CAPTION").text(),tag:n(t).find("LEVEL_UNIQUE_NAME").text(),spriteCssClass:"level"+parseInt(n(t).children("LEVEL_NUMBER").text())+" e-icon"}}),f;n.merge(u.schemaTreeView,e);(!u.model.enableDrillThrough||u._fieldData.measureSuccess)&&(t.isNullOrUndefined(u._fieldData)||!u._fieldData.measureSuccess?(f={catalog:u.model.dataSource.catalog,cube:u.model.dataSource.cube,url:u.model.dataSource.data,request:"MDSCHEMA_MEASURES"},t.Pivot._getTreeData(f,t.Pivot.loadMeasureElements,i)):t.Pivot.loadMeasureElements(i,u._fieldData.measureSuccess))},loadMeasureGroups:function(i,r){t.isNullOrUndefined(i.pivotControl._fieldData)&&(i.pivotControl._fieldData={});i.pivotControl._fieldData.measuresGroups=n(r).find("row")},loadMeasureElements:function(i,u){var f=i.schemaData.model.pivotControl,s={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},v=[],y=[],c,h,a;for(v=n.map(f.model.dataSource.values,function(n){if(n.measures!=r)return n.measures}),f.reportItemNames=n.map(v,function(n){if(n.fieldName!=r)return n.fieldName}),f.model.locale!="en-US"&&(s={catalog:f.model.dataSource.catalog,cube:f.model.dataSource.cube,url:f.model.dataSource.data,request:"MDSCHEMA_MEASUREGROUPS"},t.Pivot._getTreeData(s,t.Pivot.loadMeasureGroups,{pivotControl:f,action:"loadFieldElements"})),h=0;h<n(u).find("row").length;h++){var l=n(n(u).find("row")[h]),e=l.children("MEASUREGROUP_NAME").text(),o=l.find("MEASURE_UNIQUE_NAME").text();n.inArray(e,y)>=0||(f.model.locale!="en-US"?(a=n.map(f._fieldData.measuresGroups,function(t){if(n(t).children("MEASUREGROUP_NAME").text()==e)return n(t).children("MEASUREGROUP_CAPTION").text()}),c=a.length>0?a[0]:e):c=e,e!=""&&f.schemaTreeView.push({hasChildren:!0,isChecked:!1,pid:"[Measures]",id:e,name:c,spriteCssClass:"measureGroupCDB e-icon",tag:e}),y.push(e));f.schemaTreeView.push({hasChildren:!0,isSelected:n.inArray(o,f.reportItemNames)>=0,id:o,pid:e==""?"[Measures]":e,name:l.children("MEASURE_CAPTION").text(),spriteCssClass:"measure",tag:o});n.inArray(o,f.reportItemNames)>=0&&f.reportItemNames.splice(f.reportItemNames.indexOf(o),1)}!t.isNullOrUndefined(i.schemaData)&&i.schemaData.model.olap.showKpi?(treeNodeElement={hasChildren:!0,isChecked:!1,id:"folderStruct",name:"KPI",spriteCssClass:"KPICDB folderCDB e-icon",tag:""},f.schemaTreeView.splice(1,0,treeNodeElement),s.request="MDSCHEMA_KPIS",f._getTreeData(s,f.loadKPIElements,i)):t.isNullOrUndefined(i.schemaData)||i.schemaData._createTreeView(this,f.schemaTreeView)},loadKPIElements:function(t,i){for(var r=t.schemaData.model.pivotControl,i=r.model.dataSource,e=this.reportItemNames,a=[],o=0;o<n(i).find("row").length;o++){var f=n(n(i).find("row")[o]),u=f.children("KPI_CAPTION").text(),s=f.children("KPI_goal").text(),h=f.children("KPI_STATUS").text(),c=f.children("KPI_TREND").text(),l=f.find("KPI_VALUE").text();n.inArray(f.children("KPI_NAME").text(),a)>=0||(treeNodeElement={hasChildren:!0,isChecked:!1,pid:"folderStruct",id:u,name:u,spriteCssClass:"measureGroupCDB e-icon",tag:u},r.schemaTreeView.push(treeNodeElement),a.push(u));treeNodeElement={hasChildren:!0,isSelected:n.inArray(s,e)>=0,id:s,pid:u,name:r._getLocalizedLabels("Goal"),spriteCssClass:"kpiGoal e-icon",tag:s};r.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(h,e)>=0,id:h,pid:u,name:r._getLocalizedLabels("Status"),spriteCssClass:"kpiStatus e-icon",tag:h};r.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(c,e)>=0,id:c,pid:u,name:r._getLocalizedLabels("Trend"),spriteCssClass:"kpiTrend e-icon",tag:c};r.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(l,e)>=0,id:l,pid:u,name:r._getLocalizedLabels("Value"),spriteCssClass:"kpiValue e-icon",tag:l};r.schemaTreeView.push(treeNodeElement)}t.schemaData._createTreeView(this,r.schemaTreeView);delete r.reportItemNames;delete r.schemaTreeView},_createCalcMemberDialog:function(i){var o="",s,h,e,c,f,a,l,u;o=i.length>1&&i[0]!=r?JSON.parse(i[0].Value):i.d!=r?JSON.parse(i.d[0].Value):JSON.parse(i.CubeTreeInfo);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchCalcMemberTreeView",element:this.element,customObject:this.model.customObject});t.Pivot.openPreventPanel(this);this.element.find(".calcMemberDialog",".clientDialog",".e-dialog").remove();var v=t.buildTag("div.cubeBrowserCalcMember",t.buildTag("div#"+this._id+"_cubeTreeViewCalcMember.cubeTreeViewCalcMember")[0].outerHTML,{})[0].outerHTML,y=t.buildTag("label.lblCaption",this._getLocalizedLabels("Caption"),{})[0].outerHTML+t.buildTag("input#"+this._id+"_captionFieldCM.captionFieldCM","",{}).attr("aria-label",this._getLocalizedLabels("Caption"))[0].outerHTML,p=t.buildTag("label.lblexpression",this._getLocalizedLabels("Expression"),{})[0].outerHTML+t.buildTag("textarea#"+this._id+"_expressionFieldCM.e-textarea e-droppable expressionFieldCM"+(this.model.enableRTL?" e-rtl":""),"",{}).attr("aria-label",this._getLocalizedLabels("Expression"))[0].outerHTML,w=t.buildTag("label.lblmemberType",this._getLocalizedLabels("MemberType"),{})[0].outerHTML+t.buildTag("input#"+this._id+"_memberTypeFieldCM.memberTypeFieldCM","",{}).attr("aria-label",this._getLocalizedLabels("MemberType"))[0].outerHTML+t.buildTag("input#"+this._id+"_dimensionFieldCM.dimensionFieldCM","",{}).attr("aria-label","dimension")[0].outerHTML,b=t.buildTag("label.lblformat",this._getLocalizedLabels("FormatString"),{})[0].outerHTML+t.buildTag("input#"+this._id+"_formatFieldCM.formatFieldCM","",{}).attr("aria-label",this._getLocalizedLabels("FormatString"))[0].outerHTML+t.buildTag("input#"+this._id+"_customFormatFieldCM.customFormatFieldCM","",{}).attr("aria-label","custom format")[0].outerHTML,k=t.buildTag("div.calcMemberFieldPanel",y+p+w+b,{})[0].outerHTML,d=t.buildTag("button#"+this._id+"_btnOk.btnCalcMemberOk",this._getLocalizedLabels("OK"),{},{name:this._getLocalizedLabels("OK")}).attr("aria-label",this._getLocalizedLabels("OK"))[0].outerHTML,g=t.buildTag("button#"+this._id+"_btnCancel.btnCalcMemberCancel",this._getLocalizedLabels("Cancel"),{},{name:this._getLocalizedLabels("Cancel")}).attr("aria-label",this._getLocalizedLabels("Cancel"))[0].outerHTML,nt=t.buildTag("div.calcMemberFooter",d+g,{})[0].outerHTML;for(this._calcMemberDialog=t.buildTag("div#"+this._id+"_calcMemberDialog",v+k+nt,{})[0].outerHTML,n(this._calcMemberDialog).appendTo("#"+this._id),n("#"+this._id+"_calcMemberDialog").ejDialog({width:"auto",title:this._getLocalizedLabels("CalculatedMember"),cssClass:this.model.cssClass+" calcMemberDialog",enableModal:!1,target:"#"+this._id,enableRTL:this.model.enableRTL,enableResize:!1,close:t.proxy(function(){t.Pivot.closePreventPanel(this)},this),beforeOpen:t.proxy(function(){this.element.find(".calcMemberDialog .e-dialog").css("display","block")},this)}),this._calcMemberDialog=this.element.find("#"+this._id+"_calcMemberDialog").data("ejDialog"),n("#"+this._id+"_btnCancel").ejButton({type:t.ButtonType.Button,width:"80px",enableRTL:this.model.enableRTL,click:t.proxy(function(){this._calcMemberDialog.close();this._selectedCalcMember=null;t.Pivot.closePreventPanel(this)},this)}),n("#"+this._id+"_btnOk").ejButton({type:t.ButtonType.Button,width:"80px",enableRTL:this.model.enableRTL,click:t.proxy(function(){var i,u,r,f;if(n.trim(this.element.find("#"+this._id+"_captionFieldCM").val())==""||n.trim(this.element.find("#"+this._id+"_expressionFieldCM").val())==""){t.Pivot._createErrorDialog(this._getLocalizedLabels("EmptyField"),this._getLocalizedLabels("Warning"),this);return}if(this.element.find("#"+this._id+"_formatFieldCM").val()=="Custom"&&n.trim(this.element.find("#"+this._id+"_customFormatFieldCM").val())==""){t.Pivot._createErrorDialog(this._getLocalizedLabels("EmptyFormat"),this._getLocalizedLabels("Warning"),this);return}if(t.isNullOrUndefined(this._selectedCalcMember))for(i=0;i<this._calcMembers.length;i++)if(n.trim(this.element.find("#"+this._id+"_captionFieldCM").val()).toLowerCase()==this._calcMembers[i].name.toLowerCase())if(confirm(this._getLocalizedLabels("Confirm")))this._selectedCalcMember=n.trim(this.element.find("#"+this._id+"_captionFieldCM").val());else return;this._calcMemberDialog.close();t.Pivot.closePreventPanel(this);u="";t.isNullOrUndefined(this._selectedCalcMember)||(r=t.DataManager(this._calcMembers).executeLocal(t.Query().where("name","equal",this._selectedCalcMember,!0)),!t.isNullOrUndefined(r)&&r.length>0&&(u=r[0].tag));this._selectedCalcMember=null;this._waitingPopup.show();f=JSON.stringify({action:"calculatedMember",olapReport:this.currentReport,clientReports:this.reports,caption:this.currentCubeName+"%"+n.trim(this.element.find("#"+this._id+"_captionFieldCM").val()),expression:n.trim(this.element.find("#"+this._id+"_expressionFieldCM").val()),memberType:this.element.find("#"+this._id+"_memberTypeFieldCM").val(),dimension:this.element.find("#"+this._id+"_dimensionFieldCM").val(),formatString:this.element.find("#"+this._id+"_formatFieldCM").val()=="Custom"?n.trim(this.element.find("#"+this._id+"_customFormatFieldCM").val()):this.element.find("#"+this._id+"_formatFieldCM").val(),uniqueName:u,customObject:this.model.customObject});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.calculatedMember,f,this._calcMemberDroppedSuccess)},this)}),this.element.find("#"+this._id+"_cubeTreeViewCalcMember").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:o},allowDragAndDrop:!0,enableRTL:this.model.enableRTL,allowDropChild:!1,allowDropSibling:!1,dragAndDropAcrossControl:!0,cssClass:"calcMemberTreeViewDragedNode",nodeDropped:t.proxy(function(t){t.target!=null&&t.target.attr("id")==""+this._id+"_expressionFieldCM"&&this.element.find("#"+this._id+"_expressionFieldCM").val(this.element.find("#"+this._id+"_expressionFieldCM").val()+n(t.droppedElement).attr("tag"))},this),beforeExpand:t.proxy(t.Pivot._getMemberChildNodes,this)}),this.element.find("#"+this._id+"_captionFieldCM").ejMaskEdit({name:"inputbox",inputMode:t.InputMode.Text,watermarkText:"",maskFormat:"",textAlign:this.model.enableRTL?"right":"left",width:"100%"}),this.element.find("#"+this._id+"_customFormatFieldCM").ejMaskEdit({name:"inputbox",inputMode:t.InputMode.Text,watermarkText:"",maskFormat:"",textAlign:this.model.enableRTL?"right":"left",width:"100%",cssClass:"calcMemberCustomFormat"}),this.element.find(".calcMemberCustomFormat").css("visibility","hidden"),this.element.find("#"+this._id+"_memberTypeFieldCM").ejDropDownList({dataSource:[{text:"Measure",value:"Measure"},{text:"Dimension",value:"Dimension"}],enableRTL:this.model.enableRTL,width:"100%",selectedIndex:0,change:t.proxy(function(n){n.text=="Dimension"?this.element.find(".calcMemberDimensionField").css("visibility","visible"):this.element.find(".calcMemberDimensionField").css("visibility","hidden")},this)}),s=t.DataManager(o).executeLocal(t.Query().where("spriteCssClass","contains","dimensionCDB")),h=[],u=0;u<s.length;u++)h.push({text:s[u].name,value:s[u].name});for(this.element.find("#"+this._id+"_dimensionFieldCM").ejDropDownList({dataSource:h,selectedIndex:0,width:"100%",enableRTL:this.model.enableRTL,cssClass:"calcMemberDimensionField"}),this.element.find(".calcMemberDimensionField").css("visibility","hidden"),this.element.find("#"+this._id+"_formatFieldCM").ejDropDownList({dataSource:[{text:"Standard",value:"Standard"},{text:"Currency",value:"Currency"},{text:"Percent",value:"Percent"},{text:"Custom",value:"Custom"}],enableRTL:this.model.enableRTL,selectedIndex:0,width:"100%",enableRTL:this.model.enableRTL,change:t.proxy(function(n){n.text=="Custom"?this.element.find(".calcMemberCustomFormat").css("visibility","visible"):this.element.find(".calcMemberCustomFormat").css("visibility","hidden")},this)}),e=this.element.find(".cubeTreeViewCalcMember").find("li"),u=0;u<e.length;u++)t.isNullOrUndefined(n(e[u]).attr("id"))||n(e[u]).attr("tag",t.DataManager(o).executeLocal(t.Query().where("id","equal",n(e[u]).attr("id")))[0].tag);for(c=this.element.find(".cubeTreeViewCalcMember .folderCDB"),u=0;u<c.length;u++)n(c[u].parentElement).removeClass("e-draggable");if(this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").length>0&&this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parent().removeClass("e-draggable"),this._calcMemberTreeObj=this.element.find(".cubeTreeViewCalcMember").data("ejTreeView"),!t.isNullOrUndefined(this._selectedCalcMember)&&(f=t.DataManager(this._calcMembers).executeLocal(t.Query().where("name","equal",this._selectedCalcMember)),f.length>0)){if(this.element.find("#"+this._id+"_captionFieldCM").val(f[0].name),this.element.find("#"+this._id+"_expressionFieldCM").val(f[0].expression),this.element.find("#"+this._id+"_memberTypeFieldCM").data("ejDropDownList").selectItemsByIndices(f[0].nodeType),f[0].nodeType==1)for(a=f[0].tag.split(".")[0].replace(/\[/g,"").replace(/\]/g,""),l=this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").model.dataSource,u=0;u<l.length;u++)l[u].value==a&&this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").selectItemsByIndices(u);t.isNullOrUndefined(f[0].formatString)||(f[0].formatString=="Currency"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(1):f[0].formatString=="Percent"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2):(this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2),this.element.find("#"+this._id+"_customFormatFieldCM").val(f[0].formatString)))}this._waitingPopup.hide()},_getMemberChildNodes:function(i){var r,u,f;(n(i.currentElement).find("a > span")[0].className.indexOf("level")>-1||n(i.currentElement).find("a > span")[0].className.indexOf("member")>-1)&&(r=t.DataManager(this._calcMemberTreeObj.dataSource()).executeLocal(t.Query().where("pid","equal",n(i.currentElement).attr("id")).where("name","equal","(Blank)")),!t.isNullOrUndefined(r)&&r.length>0&&(this._calcMemberTreeObj.hideNode(r[0].id),this.pNode=i.currentElement,this._waitingPopup.show(),u=n(i.currentElement).find("a > span")[0].className.indexOf("level")>-1?"level":"member",this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"fetchMemberChildNodes",element:this.element,customObject:this.model.customObject}),f=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchMemberChildNodes",dimensionName:n(i.currentElement).attr("tag")+":"+u+":"+n(i.currentElement).attr("id"),olapReport:this.currentReport,customObject:f}),t.proxy(t.Pivot._fetchMemberSuccess,this))))},_fetchMemberSuccess:function(u){var f=[],e,o;for(f=u.length>1&&u[0]!=r?JSON.parse(u[0].Value):u.d!=r?JSON.parse(u.d[0].Value):JSON.parse(u.MemberChildNodes),this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchMemberChildNodes",element:this.element,customObject:this.model.customObject}),this._calcMemberTreeObj.model.beforeExpand=null,this._calcMemberTreeObj.addNode(f,n(this.pNode)),e=t.DataManager(this._calcMemberTreeObj.dataSource()).executeLocal(t.Query().where("pid","equal",n(this.pNode).attr("id")).where("name","equal","(Blank)")),!t.isNullOrUndefined(e)&&e.length>0&&this._calcMemberTreeObj.removeNode(e[0].id),n.each(n(this.pNode).children().find("li"),function(n,t){t.setAttribute("tag",f[n].tag)}),o=n(this.pNode).children().find("li"),i=0;i<o.length;i++)f[i].hasChildren==!0&&(this._calcMemberTreeObj.addNode({id:f[i].id+"_Blank_"+i,name:"(Blank)",parentId:f[i].id},o[i]),this.element.find("#"+f[i].id).find("> div > div:first").removeClass("e-process"),this._calcMemberTreeObj.collapseNode(this.element.find("#"+f[i].id)));this._calcMemberTreeObj.model.beforeExpand=t.proxy(t.Pivot._getMemberChildNodes,this);this._waitingPopup.hide()},_drillThroughCellClick:function(r,u){var s,f,h,e,c,o;if(u._waitingPopup.show(),f=n(r.currentTarget.parentElement).attr("p"),u.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.drillThroughDataTable,JSON.stringify({currentReport:JSON.parse(u.getOlapReport()).Report,layout:u.model.layout,cellPos:f,customObject:JSON.stringify(u.model.customObject)}),function(t){n(u.element).parents(".e-pivotclient").length>0?n(u.element).parents(".e-pivotclient").data("ejPivotClient")._trigger("drillThrough",{element:u.element,data:t}):u._trigger("drillThrough",{element:u.element,data:t})});else{for(h=n("#"+u._id).find("tbody").find("tr:first").find("th").length,i=0;i<h;i++)e=u.getJSONRecords()[parseInt(i*u._rowCount+parseInt(f.split(",")[1]))].Info.indexOf("Measures")!=-1||u.getJSONRecords()[parseInt(i*u._rowCount+parseInt(f.split(",")[1]))].RowSpan<=1?u.getJSONRecords()[parseInt(i*u._rowCount+parseInt(f.split(",")[1]))].Info.split("::")[0]:"",e.indexOf("Measures")!=-1&&(s=e),e!=""&&(u._rowHeader[i]=e);for(c=n("#"+u._id).find("tbody").find('[p="'+parseInt(f.split(",")[0])+","+parseInt(f.split(",")[1])+'"]').closest("tbody").prev().children("tr").length,i=0;i<c;i++)o=u.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*u._rowCount+i)].Info.indexOf("Measures")!=-1||u.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*u._rowCount+i)].ColSpan<=1?u.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*u._rowCount+i)].Info.split("::")[0]:"",o.indexOf("Measures")!=-1&&(s=o),o!=""&&(u._colHeader[i]=o);for((t.isNullOrUndefined(u._fieldData)||!t.isNullOrUndefined(u._fieldData)&&t.isNullOrUndefined(u._fieldData.hierarchy))&&u._getFieldItemsInfo(u),j=0;j<u._fieldData.measures.length;j++)s==u._fieldData.measures[j].id&&(u.measureGrp=u._fieldData.measures[j].pid);u._rowHeader=n.grep(u._rowHeader,function(n){return n==0||n});u._colHeader=n.grep(u._colHeader,function(n){return n==0||n});u._createDrillThroughQuery("",u)}},openHierarchySelector:function(n,i){var r,u,f;n.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._createDrillThroughDialog(n,i):(n._waitingPopup.show(),r=n.target.className.indexOf("e-pivotclient")>=0?n._pivotGrid:n,u=r._getConnectionInfo(n.model.dataSource.data),f='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_MEASUREGROUP_DIMENSIONS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.model.dataSource.cube+"<\/CUBE_NAME><MEASUREGROUP_NAME>"+r.measureGrp+"<\/MEASUREGROUP_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+u.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",this.doAjaxPost("POST",u.url,{XMLA:f},r._loadDimensionElements,null,{pvtGridObj:r,action:"loadMeasureElements"}))},_createDrillThroughDialog:function(i,r){var e,u,o,f;i.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode&&r.shift();i.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();var s=t.buildTag("label#",i._getLocalizedLabels("SelectHierarchy"))[0].outerHTML,h="<div class=cubeTable style='width:200px; overflow:auto'><div valign=\"bottom\">"+this._createHierarchyBrowser()+"<\/div><\/div>",c=t.buildTag("div#dropDlg.dropDlg",'<table class="outerTable"><tr><td>'+h+"<\/td><td>"+s+"<br><textarea id='hrSel' style='width:270px; height:300px; resize:none; margin:0px 5px 0 5px'><\/textarea><\/br><br><\/td><\/tr><\/table>")[0].outerHTML+"<\/br>",l=t.buildTag("div",t.buildTag("button#btnOK.dialogBtnOK",i._getLocalizedLabels("OK"))[0].outerHTML+t.buildTag("button#btnCancel.dialogBtnCancel",i._getLocalizedLabels("Cancel"))[0].outerHTML,{float:"right",margin:"-5px 0 6px"})[0].outerHTML,a=t.buildTag("div#clientDialog.clientDialog",c+l,{opacity:"1"}).attr("title","Hierarchy Selector")[0].outerHTML;for(n(a).appendTo("#"+i._id),n("#btnOK, #btnCancel").ejButton(),n("#btnOK, #btnCancel").css({margin:"0 20px 20px 0",width:"50px"}),i.element.find(".clientDialog").ejDialog({width:550,target:"#"+i._id,enableResize:!1,enableRTL:i.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,i)}),i.element.find(".cubeTreeViewHierarchy").ejTreeView({showCheckbox:!0,fields:{id:"id",parentId:"pid",text:"name",isChecked:"isSelected",spriteCssClass:"spriteCssClass",dataSource:i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.parseJSON(r.d):r},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:i.model.enableRTL?!0:!1,beforeDelete:function(){return!1},dragAndDropAcrossControl:!0,nodeDropped:t.proxy(this._hierarchyNodeDropped,i)}),i._tableTreeObj=i.element.find(".cubeTreeViewHierarchy").data("ejTreeView"),i._tableTreeObj.element.find(".e-ul").css({width:"100%",height:"100%"}),i._tableTreeObj.element.find(".e-chkbox-wrap").remove(),e=i._tableTreeObj.element.find("li"),u=0;u<e.length;u++)o=i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.parseJSON(r.d)[u].tag:r[u].tag,e[u].setAttribute("tag",o);i._tableTreeObj&&i._tableTreeObj.element.find("li").mouseover(t.proxy(function(t){n(t.target).parent().find(".measureGroupCDB, .dimensionCDB, .folderCDB").length>0&&n(t.target).css("cursor","default")},i));f=i;n("#btnOK").click(function(){var i=n("#hrSel").val();n(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog, .drilltableDialog").remove();f._waitingPopup.show();t.olap._mdxParser._createDrillThroughQuery(i,f);f._waitingPopup.hide()});n("#btnCancel").click(function(){n(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();f._waitingPopup.hide()});i.model.enableRTL&&(n(".e-dialog").addClass("e-rtl"),n(".dialogBtnCancel").css("margin","0 -70px 0 0"))},_createHierarchyBrowser:function(){return t.buildTag("div.cubeBrowserHierarchy",t.buildTag("div.cubeTreeViewHierarchy")[0].outerHTML,{width:"200px",height:"300px",overflow:"auto"})[0].outerHTML},_hierarchyNodeDropped:function(i){var r,f,u;if(i.dropTarget[0].id=="hrSel"){for(r=n(n(i.droppedElement).children()[0]).find(".dimensionCDB").length>0?this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(i.droppedElement).find("li:first").attr("tag"):n(i.droppedElement).find("li:first")[0].id:n(i.droppedElement).find("li:first").length==0?this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(i.droppedElement.parent().parent()).attr("tag"):n(i.droppedElement.parent().parent())[0].id:this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(i.droppedElement).attr("tag"):i.droppedElementData.id,r=r.replace("[","[$"),f=0;f<n("#hrSel").val().split(",").length;f++)if(r==n("#hrSel").val().split(",")[f])return!1;u=this.element.find("#hrSel").val();u.length!=0?(u=u+","+r,this.element.find("#hrSel").val(u)):this.element.find("#hrSel").val(r)}},_generateDrillData:function(t,i){for(var e=n(i).find("row").children(),r=n.map(e,function(n){var t=parseFloat(n.textContent),i=n.tagName.replace(/_x005B_/g,"[").replace(/_x0020_/g," ").replace(/_x005D_/g,"]").replace(/_x0024_/g,"$").replace("].[","]-[");return'"'+i+'":'+t}),o=r[0],u="",f=0;f<r.length;f++){if(r[f]==o){u+=u==""?"[{"+r[f]:"}, {"+r[f];continue}u+=","+r[f]}u+="}]";n(t.pvtGridObj.element).parents(".e-pivotclient").length>0?n(t.pvtGridObj.element).parents(".e-pivotclient").data("ejPivotClient")._trigger("drillThrough",{element:t.pvtGridObj.element,data:u}):t.pvtGridObj._trigger("drillThrough",{element:t.pvtGridObj.element,data:u})},_getFilterState:function(i,r,u,f){var e="",o;return f.model.operationalMode==t.Pivot.OperationalMode.ClientMode?i?((f._fieldSelectedMembers[u.fieldName.toLowerCase()]=="All"||t.isNullOrUndefined(f._fieldSelectedMembers[u.fieldName.toLowerCase()]))&&t.olap._mdxParser.getAllMember(f.model.dataSource,u.fieldName,f),e=f._fieldSelectedMembers[u.fieldName.toLowerCase()]=="All"||t.isNullOrUndefined(f._fieldSelectedMembers[u.fieldName.toLowerCase()])?f._allMember:f._fieldSelectedMembers[u.fieldName.toLowerCase()]):e=u.filterItems.filterType=="include"?u.filterItems.values.length==1?u.filterItems.values[0]:f._getLocalizedLabels("MultipleItems"):r.length-(u.filterItems.values.indexOf("All")==-1?u.filterItems.values.length:u.filterItems.values.length-1)==1?r.filter(function(n){if(u.filterItems.values.indexOf(n.toString())==-1)return n}):f._getLocalizedLabels("MultipleItems"):f.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(o=t.isNullOrUndefined(f._tempFilterData)?[]:n.map(f._tempFilterData,function(n){return n[u.DimensionHeader]}),e=o.length>0&&f._fieldMembers[u.DimensionHeader]?f._fieldMembers[u.DimensionHeader].length-o.length==1?f._fieldMembers[u.DimensionHeader].filter(function(n){if(o.indexOf(n)==-1)return n}):f._getLocalizedLabels("MultipleItems"):f._getLocalizedLabels("All")):e=(f._fieldSelectedMembers[u.Tag]=="All"?u.AllMember:f._fieldSelectedMembers[u.Tag])||u.AllMember,e},_getTreeViewItems:function(t){for(var r,e=t.element.find(".editorTreeView"),u=[],f=n(e).find(":input.nodecheckbox"),i=0;i<f.length;i++)r=n(f[i]).parents("li:eq(0)"),u.push({Id:r[0].id,name:n(r[0]).find("a:eq(0)").text()});return u},_getEditorMember:function(i,r,u){var f,h,e,o;if(r.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){var c=this._getTreeViewItems(u?r._schemaData:r),l=n.extend(!0,[],u?r._schemaData._memberTreeObj.dataSource():r._memberTreeObj.dataSource()),s=n.map(c,function(i){if(i.Id!="All")return n.map(l,function(n){i.Id==n.id&&(i=n,i.name=t.isNullOrUndefined(i.parentId)?i.name+"_1":i.name)}),i}),f=[],e=n.map(s,function(t){return n.map(s,function(n){t.parentId==n.id&&(t.name=t.name+"_"+(Number(n.name.split("_")[n.name.split("_").length-1])+1))}),t});return n.map(e,function(n){var t=n.name.split("_")[n.name.split("_").length-2],i=Number(n.name.split("_")[n.name.split("_").length-1]),r=n.checkedStatus;f.push({name:t,checked:r,level:Number(i)})}),this._updateEditorMembers(i,f,r)}if(r.model.analysisMode==t.Pivot.AnalysisMode.Olap)return f=[],r.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&r.model.enableMemberEditorPaging?(e=r._editorTreeData,n.map(e,function(n){var t=n.name,i=n.id.split("_")[n.id.split("_").length-1],r=n.checkedStatus;f.push({name:t,checked:r,level:Number(i)})})):(h=u?r._schemaData.element.find(".editorTreeView"):r.element.find(".editorTreeView"),e=n(h).find(":input.nodecheckbox"),n.map(e,function(t){if(n(t).parents("li:eq(0)").attr("id")!="All"){var i=n(t).parent().siblings("a").text(),r=t.value.split("_")[t.value.split("_").length-1],u=t.checked||n(t.parentElement).attr("aria-checked")=="mixed"?!0:!1;f.push({name:i,checked:u,level:Number(r)})}})),this._updateEditorMembers(i,f,r);for(textArr=[],o=1;o<i.length;o++)textArr.push(n(i[o].parentElement).siblings("a").text());return textArr},_updateEditorMembers:function(i,r,u){var f,y,s,a;if(!t.isNullOrUndefined(u._fieldMembers[i])){var v=[],e=0,c="",o=u._fieldMembers[i];for(f=0;f<r.length;f++)if(t.isNullOrUndefined(o[f+e])||r[f].level==o[f+e].level)v.push(r[f]);else if(t.isNullOrUndefined(o[f+e])||r[f].level<o[f+e].level){s=f;do r[f-1].checked&&v.push(o[s]),e++,s++;while(r[f].level<o[s].level);f--}else if(t.isNullOrUndefined(o[f+e])||r[f].level>o[f+e].level){y=o[f+e].level;s=f;do v.push(r[s]),e--,s++,f=s-1;while(r[s].level>y)}}u._fieldMembers[i]=t.isNullOrUndefined(u._fieldMembers[i])?r:v;var l=1,p="",w="",h=[];do if(a=n.map(u._fieldMembers[i],function(n){if(n.level==l)return n}),h=n.map(a,function(n){if(n.checked)return n}),a.length==h.length)c=l==1?"All":p,a.length>1&&(w="All"),l++;else if(h.length==1)p=c=w=="All"?"multiple":h[0].name,l++;else if(h.length>1&&a.length>h.length){c="multiple";break}while(h.length>0&&c!="All"&&c!="multiple"&&n.map(u._fieldMembers[i],function(n){if(n.level==l)return n}).length>0);return c},_getTreeData:function(n,i,r){var u=t.olap.base._getConnectionInfo(n.url),f='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>'+n.request+"<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>"+n.catalog+"<\/CATALOG_NAME>"+(r.action=="loadcubelist"?"":"<CUBE_NAME>"+n.cube+"<\/CUBE_NAME>")+"<\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><LocaleIdentifier>"+u.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";r.action="loadFieldElements";this.doAjaxPost("POST",u.url,{XMLA:f},i,null,r)},updateTreeView:function(t){for(var h,c,o,s,f,e=t.element.find(".editorTreeView").find("li"),l=e.length,i=t._memberTreeObj.dataSource(),a=i.length,u=0;u<l;u++)for(h=n(e[u]).find("span:first").attr("aria-checked"),f=0;f<a;f++)if(e[u].id==i[f].id&&(h=="mixed"||h=="true")){i[f].checkedStatus=!0;break}else if(e[u].id==i[f].id&&h=="false"){i[f].checkedStatus=!1;break}for(u=0;u<i.length;u++)if(c=!1,i[u].checkedStatus==!0){for(f=0;f<i.length;f++)if(i[f].hasOwnProperty("parentId")&&i[f].parentId==i[u].id&&i[f].checkedStatus==!0){c=!0;break}if(!c)for(o=0;o<i.length;o++)i[o].hasOwnProperty("parentId")&&i[o].parentId==i[u].id&&(i[o].checkedStatus=!0)}else if(i[u].checkedStatus==!1)for(s=0;s<i.length;s++)i[s].hasOwnProperty("parentId")&&i[s].parentId==i[u].id&&(i[s].checkedStatus=!1);for(u=0;u<l;u++)if(n(e[u]).attr("tag")==null||r)for(f=0;f<a;f++)if(n(e[u]).attr("id")==i[f].id){n(e[u]).attr("tag",i[f].tag);break}return t._memberTreeObj},getNodesState:function(n){for(var r="",u="",i=[],i=n.pluginName=="ejTreeView"?n.dataSource():n,t=0;t<i.length;t++)i[t].checkedStatus==!0?r+="::"+i[t].id+"||"+i[t].tag+"||"+i[t].parentId+"||"+i[t].name:u+="::"+i[t].parentId+"||"+i[t].tag+"||"+i[t].name;return{selectedNodes:r,unSelectedNodes:u}},removeParentSelectedNodes:function(t){for(var i,u=n.extend([],t),f=0;f<t.length;f++)for(i=0;i<u.length;i++)u[i].Id==t[f].parentId&&u.splice(i,1);return n.map(u,function(n){if(n.tag!=""&&n.tag!=r)return n.tag.replace(/\&/g,"&")})},getChildNodes:function(i,u,f,e,o){var s=i.targetElement,p=e.cube,w=e.catalog,b=e.data,k=o._generateChildMembers,v=n(i.currentElement).find("li").length,h=!1,c,a;if(v==0){var y=t.buildTag("span.nodeExpand e-load e-icon")[0].outerHTML,l=n(s).parents("li:eq(0)").attr("id"),d=n.map(f,function(i){if(i.fieldName==u&&!t.isNullOrUndefined(i.filterItems)){var f=i.filterItems;(t.isNullOrUndefined(o.model.pivotControl)?o.model.enableMemberEditorPaging:o.model.pivotControl.model.enableMemberEditorPaging)?(f=n.map(f,function(n){if(n.pid!=r&&n.pid==l.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"))return h=!0,n}),f.length>0&&h==!0&&(n(s).parents("li:eq(0)").find(".nodeExpand").remove(),n(s).parents("li:eq(0)").find(".e-load").removeClass("e-load"),n.each(f,function(n,t){delete t.parentId}),o._memberTreeObj.addNode(f,n(s).parents("li:eq(0)")),n.each(n(s).parents("li:eq(0)").find("li"),function(n,t){t.setAttribute("tag",f[n].tag)}))):n.map(f,function(n){n.parentId!=r&&n.parentId==l.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-")&&(h=!0)})}});i.isChildLoaded=h?!0:!1;h||(n(s).parents("li:eq(0)").prepend(y),n(s).parents("li:eq(0)").attr("tag")==r&&(c=n.map(f,function(n){if(n.fieldName==u)return n})[0],c&&n.map(c.filterItems,function(t){t.id==n(s).parents("li:eq(0)").attr("id")&&n(s).parents("li:eq(0)").attr("tag",t.tag)})),a=n(s).parents("li:eq(0)").attr("tag").replace(/\&/g,"&"),t.olap._mdxParser.getChildren(e,a,o))}},_getFilterParams:function(n,i,r){var o="",f,u,e;if(n!="schemaValue"){if(f="",!t.isNullOrUndefined(i))for(u=0;u<i.length;u++)if(!t.isNullOrUndefined(i[u][r]))for(e=0;e<i[u][r].length;e++)f+="##"+i[u][r][e];f!=""&&(o=n+"::"+r+"::FILTERED"+f)}return o},generateChildMembers:function(i,r){for(var h,c,o=n(r).find("Axis:eq(0) Tuple"),f=[],u=n("[tag='"+i.currentNode.replace(/&/g,"&")+"']"),e=0;e<o.length;e++){var s=n(n(r).find("Axis:eq(0) Tuple:eq("+e+")").children().children()[0]).text(),l=n(n(r).find("Axis:eq(0) Tuple:eq("+e+")").children()).find("Caption").text()==""?"(Blank)":n(n(r).find("Axis:eq(0) Tuple:eq("+e+")").children()).find("Caption").text(),a={hasChildren:n(o[e]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!1,id:s.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:l,tag:s};f.push(a)}parentNode=n(u).parents("li").length>1?n(u).parents("li").first():n(u).parents("li");n(n(parentNode).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});this._memberTreeObj=n(".editorTreeView").data("ejTreeView");f.length>0&&!t.isNullOrUndefined(this.model)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.enableMemberEditorPaging&&(h=this._selectedFieldName,c=this.model.pivotControl,n.map(this.model.pivotControl._currentReportItems,function(i){i.fieldName!=h||t.isNullOrUndefined(i.filterItems)||(n.each(f,function(t,i){i.pid=n(u).attr("id")}),n.merge(i.filterItems,f),c._editorTreeData=i.filterItems)}));u.find(".nodeExpand").remove();u.find(".e-load").removeClass("e-load");this._memberTreeObj.addNode(f,n(u));n.each(u.find("li"),function(n,t){t.setAttribute("tag",f[n].tag)})},createAdvanceFilterTag:function(r,u){var f="",k=t.buildTag("li.e-separator").css("margin-left","29px")[0].outerHTML,o=u.element.hasClass("e-pivotschemadesigner")?u.model.pivotControl.model.operationalMode:u.model.operationalMode,b=u.element.hasClass("e-pivotschemadesigner")?u.model.pivotControl.model.analysisMode:u.model.analysisMode,h,c,s,a,v,e,y,l,p,w;if(r.action=="filterTag")f=[{id:"ascOrder",text:u._getLocalizedLabels("SortAtoZ"),parentId:null,spriteCssClass:"ascImage e-icon"},{id:"descOrder",text:u._getLocalizedLabels("SortZtoA"),parentId:null,spriteCssClass:"descImage e-icon"},{id:"clearSorting",text:u._getLocalizedLabels("ClearSorting"),parentId:null,spriteCssClass:"e-clrSort e-icon"},{id:"sep",parentId:null,text:"",spriteCssClass:"e-seperator"},{id:"clearAllFilters",text:u._getLocalizedLabels("ClearFilterFrom"),parentId:null,spriteCssClass:"e-clrFilter e-icon"},{id:"labelFilterBtn",text:u._getLocalizedLabels("LabelFilters"),parentId:null},{id:"valueFilterBtn",text:u._getLocalizedLabels("ValueFilters"),parentId:null},{id:"labelClearFilter",parentId:"labelFilterBtn",text:u._getLocalizedLabels("ClearFilter"),spriteCssClass:"e-clrFilter e-icon"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"equals",parentId:"labelFilterBtn",text:u._getLocalizedLabels("Equals"),spriteCssClass:"sprite"},{id:"notequals",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotEquals")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"beginswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("BeginsWith")+"...",spriteCssClass:"sprite"},{id:"notbeginswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotBeginsWith")+"...",spriteCssClass:"sprite"},{id:"endswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("EndsWith")+"...",spriteCssClass:"sprite"},{id:"notendswith",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotEndsWith")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"contains",parentId:"labelFilterBtn",text:u._getLocalizedLabels("Contains")+"...",spriteCssClass:"sprite"},{id:"notcontains",parentId:"labelFilterBtn",text:u._getLocalizedLabels("DoesNotContains")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"labelFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"greaterthan",parentId:"labelFilterBtn",text:u._getLocalizedLabels("GreaterThan")+"...",spriteCssClass:"sprite"},{id:"greaterthanorequalto",parentId:"labelFilterBtn",text:u._getLocalizedLabels("GreaterThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"lessthan",parentId:"labelFilterBtn",text:u._getLocalizedLabels("LessThan")+"...",spriteCssClass:"sprite"},{id:"lessthanorequalto",parentId:"labelFilterBtn",text:u._getLocalizedLabels("LessThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"valueClearFilter",parentId:"valueFilterBtn",text:u._getLocalizedLabels("ClearFilter"),spriteCssClass:"e-clrFilter e-icon"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"equals",parentId:"valueFilterBtn",text:u._getLocalizedLabels("Equals"),spriteCssClass:"equals"},{id:"notequals",parentId:"valueFilterBtn",text:u._getLocalizedLabels("DoesNotEquals")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"greaterthan",parentId:"valueFilterBtn",text:u._getLocalizedLabels("GreaterThan")+"...",spriteCssClass:"sprite"},{id:"greaterthanorequalto",parentId:"valueFilterBtn",text:u._getLocalizedLabels("GreaterThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"lessthan",parentId:"valueFilterBtn",text:u._getLocalizedLabels("LessThan")+"...",spriteCssClass:"sprite"},{id:"lessthanorequalto",parentId:"valueFilterBtn",text:u._getLocalizedLabels("LessThanOrEqualTo")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"between",parentId:"valueFilterBtn",text:u._getLocalizedLabels("Between")+"...",spriteCssClass:"sprite"},{id:"notbetween",parentId:"valueFilterBtn",text:u._getLocalizedLabels("NotBetween")+"...",spriteCssClass:"sprite"},{id:"sep",parentId:"valueFilterBtn",text:"",spriteCssClass:"e-seperator"},{id:"topCount",parentId:"valueFilterBtn",text:u._getLocalizedLabels("Top10")+"...",spriteCssClass:"sprite"}],o==t.Pivot.OperationalMode.ClientMode||o==t.Pivot.OperationalMode.ServerMode&&b==t.Pivot.AnalysisMode.Pivot?f.splice(f.length-1,2):f.splice(0,5);else if(r.action=="clearFilter")f=t.buildTag("div.clearSorting",t.buildTag("span.e-clrSort","",{padding:"0px 10px 0px 4px"}).addClass("e-icon").attr("aria-label","clear sort")[0].outerHTML+t.buildTag("span.clearSortText","Clear Sorting",{padding:"5px 0px"})[0].outerHTML)[0].outerHTML+t.buildTag("div.separator",{padding:"5px 0px"})[0].outerHTML+t.buildTag("div.clearAllFilters",t.buildTag("span.e-clrFilter","",{padding:"0px 10px 0px 4px"}).addClass("e-icon").attr("aria-label"," clear filter")[0].outerHTML+t.buildTag("span.clearFltrText",'Clear Filter From"'+r.selectedLevel.text+'"',{padding:"5px 0px"})[0].outerHTML)[0].outerHTML;else if(r.action=="sort")f=t.buildTag("div#sortDiv.sortDiv",t.buildTag("li#ascOrder.ascOrder",t.buildTag("span.ascImage").addClass("e-icon").attr("aria-label","ascending")[0].outerHTML+u._getLocalizedLabels("Sort")+" A to Z")[0].outerHTML+t.buildTag("li#descOrder.descOrder",t.buildTag("span.descImage").addClass("e-icon").attr("aria-label","descending")[0].outerHTML+u._getLocalizedLabels("Sort")+" Z to A")[0].outerHTML)[0].outerHTML;else if(r.action=="labelFilterDlg"||r.action=="valueFilterDlg"){if(h="",c=[],r.action=="labelFilterDlg")h=t.buildTag("table.labelfilter",t.buildTag("tr",t.buildTag("td",u._getLocalizedLabels("LabelFilterLabel")).attr("colspan","2")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","<input type='text' id='filterOptions' class='filterOptions' style='width:220px'/>")[0].outerHTML+t.buildTag("td.filterValuesTd","<input type='text' id='filterValue1' value='"+(r.filterInfo.length>0?o==t.Pivot.OperationalMode.ClientMode?r.filterInfo[0].values[0]:r.filterInfo[0].value1:"")+"' style='display:inline; width:160px; height:19px; margin-left:7px;' class='filterValues'/><\/br>")[0].outerHTML)[0].outerHTML)[0].outerHTML,c=[{value:"equals",option:u._getLocalizedLabels("Equals").toLowerCase()},{value:"not equals",option:u._getLocalizedLabels("DoesNotEquals").toLowerCase()},{value:"begins with",option:u._getLocalizedLabels("BeginsWith").toLowerCase()},{value:"not begins with",option:u._getLocalizedLabels("DoesNotBeginsWith").toLowerCase()},{value:"ends with",option:u._getLocalizedLabels("EndsWith").toLowerCase()},{value:"not ends with",option:u._getLocalizedLabels("DoesNotEndsWith").toLowerCase()},{value:"contains",option:u._getLocalizedLabels("Contains").toLowerCase()},{value:"not contains",option:u._getLocalizedLabels("DoesNotContains").toLowerCase()},{value:"greater than",option:u._getLocalizedLabels("IsGreaterThan").toLowerCase()},{value:"greater than or equal to",option:u._getLocalizedLabels("IsGreaterThanOrEqualTo").toLowerCase()},{value:"less than",option:u._getLocalizedLabels("IsLessThan").toLowerCase()},{value:"less than or equal to",option:u._getLocalizedLabels("IsLessThanOrEqualTo").toLowerCase()},];else{if(s=[],v=n(r.selectedArgs.element).attr("id")=="between"||n(r.selectedArgs.element).attr("id")=="notbetween"||r.selectedArgs.value=="between"||r.selectedArgs.value=="not between"?"4":"3",u.element.find(".cubeTreeView ").length>0)s=n.map(u.element.find(".cubeTreeView [tag*='[Measures]'] "),function(t){return{option:n(t).text(),value:n(t).attr("tag")}});else for(e=u.element.hasClass("e-pivotschemadesigner")?u.element.find(".schemaValue .pivotButton"):u.element.find(".groupingBarPivot .values .pivotButton"),e=u._schemaData&&e.length==0?n(u._schemaData.element.find(".schemaValue .pivotButton")):e,i=0;i<e.length;i++)s.push({option:n(e[i]).text(),value:n(e[i]).attr("tag").split(":")[1]});a=n(r.selectedArgs.element).hasClass("topCount")?t.buildTag("td","<input type='text' id='filterOptions' class='filterOptions' />").attr("width","80px")[0].outerHTML+t.buildTag("td","<input type='text' id='filterValue1' class='filterValues' />").attr("width","50px")[0].outerHTML+t.buildTag("td","<input type='text' id='filterMeasures' class='filterMeasures' />").attr("width","180px")[0].outerHTML:t.buildTag("td","<input type='text' id='filterMeasures' class='filterMeasures' />").attr("width","180px")[0].outerHTML+t.buildTag("td","<input type='text' id='filterOptions' class='filterOptions'/>").attr("width","180px")[0].outerHTML+t.buildTag("td.filterValuesTd","<input type='text' id='filterValue1' value='"+(r.filterInfo.length>0?o==t.Pivot.OperationalMode.ClientMode?r.filterInfo[0].values[0]:r.filterInfo[0].value1:"")+"' style='display:inline; width:190px; height:19px;' class='filterValues'/>"+(v=="4"?"<span>"+u._getLocalizedLabels("and")+" <\/span><input type='text' id='filterValue2' value='"+(r.filterInfo.length>0?o==t.Pivot.OperationalMode.ClientMode&&!t.isNullOrUndefined(r.filterInfo[0].values[1])?r.filterInfo[0].values[1]:o==t.Pivot.OperationalMode.ServerMode&&!t.isNullOrUndefined(r.filterInfo[0].value2)?r.filterInfo[0].value2:"":"")+"' style='display:inline; width:190px; height:19px;' class='filterValues'/> <\/br>":"<\/br>"))[0].outerHTML;h=t.buildTag("table.valuefilter",t.buildTag("tr",t.buildTag("td",u._getLocalizedLabels("ValueFilterLabel")).attr("colspan",r.text=="Between"?"4":"3")[0].outerHTML)[0].outerHTML+t.buildTag("tr",a)[0].outerHTML)[0].outerHTML;c=[{value:"equals",option:u._getLocalizedLabels("Equals").toLowerCase()},{value:"not equals",option:u._getLocalizedLabels("DoesNotEquals").toLowerCase()},{value:"greater than",option:u._getLocalizedLabels("IsGreaterThan").toLowerCase()},{value:"greater than or equal to",option:u._getLocalizedLabels("IsGreaterThanOrEqualTo").toLowerCase()},{value:"less than",option:u._getLocalizedLabels("IsLessThan").toLowerCase()},{value:"less than or equal to",option:u._getLocalizedLabels("IsLessThanOrEqualTo").toLowerCase()},{value:"between",option:u._getLocalizedLabels("Between").toLowerCase()},{value:"not between",option:u._getLocalizedLabels("NotBetween").toLowerCase()}]}y=t.buildTag("div",t.buildTag("button#filterDlgOKBtn.dialogOKBtn","OK")[0].outerHTML+t.buildTag("button#filterDlgCancelBtn.dialogCancelBtn","Cancel")[0].outerHTML,{float:u.model.enableRTL?"left":"right",margin:"8px 0 6px"})[0].outerHTML;u.element.find(".e-dialog").remove();n(t.buildTag("div#filterDialog.filterDialog",h+y,{opacity:"1"})).appendTo("#"+u._id);u.element.find(".filterDialog").ejDialog({enableRTL:u.model.enableRTL,enableResize:!1,cssClass:"labelValueFilterDlg",width:"auto",content:"#"+u._id,close:t.proxy(t.Pivot.closePreventPanel,u)});r.action=="valueFilterDlg"&&(u.element.find(".filterMeasures").ejDropDownList({dataSource:s,width:"180px",height:"25px",fields:{text:"option",value:"value"},create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),u._measureDDL=u.element.find(".filterMeasures").data("ejDropDownList"),l=s.length>0?s[0].value:r.filterInfo.length>0?r.filterInfo[0].measure:"",l!=""&&u._measureDDL.selectItemByValue(l));n(r.selectedArgs.element).attr("id")=="topCount"?(u.element.find("#filterOptions").ejDropDownList({dataSource:[{option:"Top",value:"topCount"},{option:"Bottom",value:"BottomCount"}],fields:{text:"option",value:"value"},value:r.filterInfo.length>0?r.filterInfo[0].operator:"topCount",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),u.element.find("#filterValue1").ejNumericTextbox({value:r.filterInfo.length>0?parseInt(r.filterInfo[0].value1):5,minValue:1})):(p=n(r.selectedArgs.element).parent().children("li:not(#sep)").index(r.selectedArgs.element),u.element.find(".filterOptions").ejDropDownList({dataSource:c,width:"180px",height:"25px",fields:{value:"value",text:"option"},selectedIndices:[p-1],change:t.proxy(u._filterOptionChanged,u),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(r.selectedArgs.element).length==0&&(w=u.element.find(".filterOptions").data("ejDropDownList"),w.selectItemByValue(r.selectedArgs.selectedValue)));u.element.find("#filterDlgOKBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(u._filterElementOkBtnClick,u)});u.element.find("#filterDlgCancelBtn").ejButton({type:t.ButtonType.Button,click:function(){n(".e-dialog").hide();t.Pivot.closePreventPanel(u)}});u.element.find(".e-titlebar").prepend(t.buildTag("div",(r.action=="valueFilterDlg"?u._getLocalizedLabels("ValueFilters")+"(":u._getLocalizedLabels("LabelFilters")+"(")+(u._selectedLevelUniqueName.indexOf(".")==-1?u._selectedLevelUniqueName:u._selectedLevelUniqueName.indexOf(".")<0?u._selectedLevelUniqueName:u._selectedLevelUniqueName.split(".")[2].replace(/\[/g,"").replace(/\]/g,""))+")",{display:"inline"}))}return f}};t.Pivot.SortOrder={None:"none",Ascending:"ascending",Descending:"descending"};t.Pivot.AdvancedFilterType={LabelFilter:"label",ValueFilter:"value"};t.Pivot.ValueFilterOptions={None:"none",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.Pivot.LabelFilterOptions={None:"none",BeginsWith:"beginswith",NotBeginsWith:"notbeginswith",EndsWith:"endswith",NotEndsWith:"notendswith",Contains:"contains",NotContains:"notcontains",Equals:"equals",NotEquals:"notequals",GreaterThan:"greaterthan",GreaterThanOrEqualTo:"greaterthanorequalto",LessThan:"lessthan",LessThanOrEqualTo:"lessthanorequalto",Between:"between",NotBetween:"notbetween"};t.Pivot.AnalysisMode={Olap:"olap",Pivot:"pivot"};t.Pivot.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"}}(jQuery,Syncfusion),function(n,t,r){t.olap=t.olap||{};t.widget("ejPivotGrid","ej.PivotGrid",{_rootCSS:"e-pivotgrid",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:{url:"",cssClass:"",jsonRecords:"",currentReport:"",layout:"normal",analysisMode:"olap",operationalMode:"clientmode",filterType:"filterType",enablePivotFieldList:!0,enableGroupingBar:!1,enableDeferUpdate:!1,enableJSONRendering:!1,enableVirtualScrolling:!1,enablePaging:!1,enableColumnResizing:!1,enableContextMenu:!1,enableCellContext:!1,enableRTL:!1,enableToolTip:!0,enableToolTipAnimation:!0,enableCellSelection:!1,enableConditionalFormatting:!1,enableCellEditing:!1,enableColumnGrandTotal:!0,enableRowGrandTotal:!0,enableGrandTotal:!0,enableCollapseByDefault:!1,enableCellDoubleClick:!1,enableDrillThrough:!1,isResponsive:!1,enableAdvancedFilter:!1,showUniqueNameOnPivotButton:!1,editCellsInfo:{},hyperlinkSettings:{enableValueCellHyperlink:!1,enableRowHeaderHyperlink:!1,enableColumnHeaderHyperlink:!1,enableSummaryCellHyperlink:!1},headerSettings:{showRowItems:!1,showColumnItems:!1},frozenHeaderSettings:{enableFrozenRowHeaders:!1,enableFrozenColumnHeaders:!1,enableFrozenHeaders:!1,scrollerSize:18},valueSortSettings:{headerText:"",headerDelimiters:"##",sortOrder:t.PivotAnalysis.SortOrder.None},serviceMethodSettings:{initialize:"InitializeGrid",drillDown:"DrillGrid",exportPivotGrid:"Export",paging:"Paging",fetchMembers:"FetchMembers",nodeStateModified:"NodeStateModified",nodeDropped:"NodeDropped",filtering:"Filtering",sorting:"Sorting",valueSorting:"ValueSorting",deferUpdate:"DeferUpdate",memberExpand:"MemberExpanded",writeBack:"WriteBack",cellEditing:"CellEditing",saveReport:"SaveReport",loadReport:"LoadReportFromDB",calculatedField:"CalculatedField",drillThroughHierarchies:"DrillThroughHierarchies",drillThroughDataTable:"DrillThroughDataTable",removeButton:"RemoveButton"},customObject:{},locale:"en-US",dataSource:{data:null,sourceInfo:"",providerName:"ssas",enableAdvancedFilter:!1,isFormattedValues:!1,reportName:"Default",columns:[],cube:"",catalog:"",rows:[],values:[],filters:[],pagerOptions:{categoricalPageSize:0,seriesPageSize:0,categoricalCurrentPage:0,seriesCurrentPage:0}},pivotTableFieldListID:"",collapsedMembers:null,cellSelection:null,valueCellHyperlinkClick:null,rowHeaderHyperlinkClick:null,columnHeaderHyperlinkClick:null,summaryCellHyperlinkClick:null,beforeServiceInvoke:null,afterServiceInvoke:null,drillThrough:null,drillSuccess:null,cellContext:null,load:null,renderComplete:null,renderFailure:null,renderSuccess:null,cellDoubleClick:null,applyFieldCaption:null,beforeExport:null,beforePivotEnginePopulate:null,saveReport:null,loadReport:null,cellEdit:null},dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum",drillDown:"enum",exportPivotGrid:"enum",paging:"enum",fetchMembers:"enum",nodeStateModified:"enum",nodeDropped:"enum",filtering:"enum",sorting:"enum",deferUpdate:"enum",memberExpand:"enum",writeBack:"enum",cellEditing:"enum",saveReport:"enum",loadReport:"enum",calculatedField:"enum",drillThroughHierarchies:"enum",drillThroughDataTable:"enum",removeButton:"enum"},customObject:"data"},observables:["layout","enableCellContext","hyperlinkSettings.enableValueCellHyperlink","hyperlinkSettings.enableRowHeaderHyperlink","hyperlinkSettings.enableColumnHeaderHyperlink","hyperlinkSettings.enableSummaryCellHyperlink"],layout:t.util.valueFunction("layout"),enableCellContext:t.util.valueFunction("enableCellContext"),enableValueCellHyperlink:t.util.valueFunction("hyperlinkSettings.enableValueCellHyperlink"),enableRowHeaderHyperlink:t.util.valueFunction("hyperlinkSettings.enableRowHeaderHyperlink"),enableColumnHeaderHyperlink:t.util.valueFunction("hyperlinkSettings.enableColumnHeaderHyperlink"),enableSummaryCellHyperlink:t.util.valueFunction("hyperlinkSettings.enableSummaryCellHyperlink"),locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(t){this._JSONRecords=n.parseJSON(t)},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){n(this.element).next().length>0&&n(this.element).next()[0].className=="pGridTooltip"&&n(this.element).next().remove();this.element.empty().removeClass("e-pivotgrid"+this.model.cssClass);this._waitingPopup!=r&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._excelLikeJSONRecords=null;this._drillCaption="";this._drillAction="";this._startDrilldown=!1;this._pagerObj=null;this._seriesPageCount=null;this._categPageCount=null;this._seriesCurrentPage=1;this._categCurrentPage=1;this._drillHeaders=[];this._collapsedRowHeaders=[];this._isDragging=!1;this._droppedClass="";this._dataModel="";this._ascdes="";this._filterUpdate=[];this._pivotRow=[];this._pivotColumn=[];this._pivotCalculation=[];this._pivotFilter=[];this._pivotTableFields=[];this._schemaData=null;this._waitingPopup=null;this._oriX=null;this._oriY=null;this._startPosCell=null;this._maxViewLoading=null;this._list=[];this._list.push(this._getLocalizedLabels("AddNew"));this._rowCount=0;this._excelRowCount=0;this._dialogTitle="";this._selectedField="";this._selectedAxis="";this._isUpdateRequired=!1;this._isMembersFiltered=!1;this._selectedCell=null;this._onholdKey="";this._primaryCellPos="";this._currentReportItems=[];this._rowHeader=[];this._colHeader=[];this._cellInfo=[];this._editorFlag=!0;this._isSubTotalHide=!1;this._isSubTotalhidden=!1;this._dimension;this._calculatedField=[];this._isFormatApply=!1;this._cFormat=[];this._curFocus={cell:null,tab:null,tree:null,cformat:null,grp:null,selection:null,filter:null,field:null,formula:null};this._index={index:0,grp:1,cell:1,dialog:1,paging:1,cformat:1,filter:0,field:0,formula:0};this._dataSet=[];this._currentCell=-1;this._target=null;this._orgX=null;this._orgY=null;this._expand=!1;this._excelFilterInfo=[];this._pagingSavedObjects={drillEngine:[],savedHdrEngine:[],curDrilledItem:{}};this._isSchemaInitialize=!0;this._fieldMembers={};this._fieldSelectedMembers={};this._allMember="";this._selectedMeasure="";this._selectedFormat="";this._dialogName="";this._pivotClientObj=null},_load:function(){var r={element:this.element,customObject:this.model.customObject},i;(this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter)&&(this.model.dataSource.enableAdvancedFilter=this.model.enableAdvancedFilter=!0);this.model.enableCellEditing&&this.model.enableCellSelection&&(this.model.enableCellSelection=!1);this._trigger("load",r);this.element.addClass(this.model.cssClass);n(this.element).parents(".e-pivotclient").length>0?(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+this._pivotClientObj._id+"_maxView")[0]&&n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}),t.isNullOrUndefined(this._waitingPopup)&&!t.isNullOrUndefined(this._pivotClientObj._waitingPopup)&&(this._waitingPopup=this._pivotClientObj._waitingPopup),this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)&&(n("#"+this._id).ejWaitingPopup({showOnInit:!0}),this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"));this._waitingPopup.show();this.model.enableJSONRendering?(this.setJSONRecords(this.model.jsonRecords),this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.excelLikeLayout(this.getJSONRecords()):this.renderControlFromJSON()):t.isNullOrUndefined(this.model.dataSource.data)&&this.model.url==""&&!t.isNullOrUndefined(this._pivotClientObj)?(this.renderControlFromJSON(),this._waitingPopup.hide()):this.model.dataSource.data==null&&this.model.url!=""||this.model.dataSource.data!=null&&this.model.url!=""&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(this.model.operationalMode=t.Pivot.OperationalMode.ServerMode,t.isNullOrUndefined(this.model.beforeServiceInvoke)||this._trigger("beforeServiceInvoke",{action:"initialize",element:this.element,customObject:this.model.customObject}),i=JSON.stringify(this.model.customObject),this.model.enableVirtualScrolling&&(this.model.layout=t.PivotGrid.Layout.NoSummaries),this.element[0]!=null&&this.element.parents().find(".controlPanel").length>0&&this.layout()!=""&&this.layout()!=t.PivotGrid.Layout.Normal?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initializeGrid",currentReport:this.model.currentReport,gridLayout:this.layout(),customObject:i}),this._renderControlSuccess):this.element[0]!=null&&this.element.parents().find(".controlPanel").length>0?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:this.model.enableCellDoubleClick||this.model.enableDrillThrough?"initializeGrid:getDataSet":"initializeGrid",currentReport:this.model.currentReport,customObject:i}),this._renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:this.model.enableCellDoubleClick||this.model.enableDrillThrough?"initializeGrid:getDataSet":"initializeGrid",gridLayout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:i}),this._renderControlSuccess)):(this.model.operationalMode=t.Pivot.OperationalMode.ClientMode,this.model.dataSource.cube!=""?(this.model.analysisMode=t.Pivot.AnalysisMode.Olap,this._trigger("beforePivotEnginePopulate",{pivotGridObj:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)):this.model.dataSource.data!=null&&(this.model.analysisMode=t.Pivot.AnalysisMode.Pivot,t.PivotAnalysis.setFieldCaptions(this.model.dataSource),this._populatePivotGrid()))},refreshControl:function(){if(t.Pivot.openPreventPanel(this),this._trigger("beforePivotEnginePopulate",{pivotObject:this}),this.model.enableGroupingBar&&this._createGroupingBar(this.model.dataSource),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){var n=t.PivotAnalysis.pivotEnginePopulate(this.model);this.setJSONRecords(JSON.stringify(n.json));this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.excelLikeLayout(n.json):this.renderControlFromJSON(n.json);this._trigger("renderSuccess",this)}else t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)},_setCaptions:function(){n.each(this.model.dataSource.rows,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)});n.each(this.model.dataSource.columns,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)});n.each(this.model.dataSource.filters,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)});n.each(this.model.dataSource.values,function(n,i){t.isNullOrUndefined(i.fieldCaption)&&(i.fieldCaption=i.fieldName)})},refreshFieldCaption:function(n,t,i){var r;if(i.indexOf("row")>=0)for(r=0;r<this.model.dataSource.rows.length;r++)n==this.model.dataSource.rows[r].fieldName&&(this.model.dataSource.rows[r].fieldCaption=t);else if(i.indexOf("calc")>=0)for(r=0;r<this.model.dataSource.values.length;r++)n==this.model.dataSource.values[r].fieldName&&(this.model.dataSource.values[r].fieldCaption=t);else if(i.indexOf("col")>=0)for(r=0;r<this.model.dataSource.columns.length;r++)n==this.model.dataSource.columns[r].fieldName&&(this.model.dataSource.columns[r].fieldCaption=t);else for(r=0;r<this.model.dataSource.filters.length;r++)n==this.model.dataSource.filters[r].fieldName&&(this.model.dataSource.filters[r].fieldCaption=t);for(r=0;r<this._pivotTableFields.length;r++)n==this._pivotTableFields[r].name&&(this._pivotTableFields[r].caption=t)},refreshPivotGrid:function(){this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this.getOlapReport()&&(this.model.dataSource.rows&&(this.model.dataSource.rows=this.getOlapReport().rows),this.model.dataSource.columns&&(this.model.dataSource.columns=this.getOlapReport().columns),this.model.dataSource.filters&&(this.model.dataSource.filters=this.getOlapReport().filters),this.model.dataSource.values&&(this.model.dataSource.values=this.getOlapReport().values)),this.model.editCellsInfo={},this._populatePivotGrid()):(this._trigger("beforePivotEnginePopulate",{olapObject:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)):this._load()},_populatePivotGrid:function(){var f,u,r,i,e;for(this._trigger("beforePivotEnginePopulate",{pivotObject:this}),f=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,u=n.grep(this.model.dataSource.values,function(n){return n.isCalculatedField==!0}),this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1}),r=0;r<u.length;r++)i=u[r].formula,n.grep(this._calculatedField,function(n){return n.name==u[r].fieldName}).length==0&&(i=i.replace(/\s+|\s+$/gm,""),i=this._parenthesisAsterisk(i),i=i.replace(/[-+/^%*]/g,function(n){return" "+n+" "}),this._calculatedField.push({name:u[r].fieldName,formula:i})),u[r].formula=i,this.model.dataSource.values.push(u[r]);e=t.PivotAnalysis.pivotEnginePopulate(this.model);this.setJSONRecords(JSON.stringify(e.json));this.setOlapReport(this.model.dataSource);this._createGroupingBar(this.model.dataSource);this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.excelLikeLayout(e.json):this.renderControlFromJSON();t.isNullOrUndefined(f)||(f._isTimeOut=!1);this._waitingPopup.hide();this._trigger("renderSuccess",this);t.isNullOrUndefined(this._pivotClientObj)||typeof this._pivotClientObj._pivotSchemaDesigner=="undefined"||(this._schemaData=this._pivotClientObj._pivotSchemaDesigner);this._schemaData!=null&&(pschemaDesignerWaitingPopup.hide(),this._calculatedField.length>0&&this._schemaCalculatedField())},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"OlapReport":this.setOlapReport(n[t]);break;case"JsonData":this.setOlapReport(n[t]);break;case"RefreshOlapGrid":this.element.renderControlFromJSON(n[t]);break;case"layout":this._load();break;case"customObject":this.model.customObject=n[t];break;case"enableCellContext":this._load();break;case"enableValueCellHyperlink":this._load();break;case"enableRowHeaderHyperlink":this._load();break;case"enableColumnHeaderHyperlink":this._load();break;case"enableSummaryCellHyperlink":this._load();break;case"locale":this._load()}},_wireEvents:function(){if(this._on(this.element,"mouseover",".value,.rowheader,.colheader,.summary",t.proxy(function(t){var i,r,u;n(t.target).hasClass("cellValue")||n(t.target).children().hasClass("cellValue")||(i=n(t.target).contents().filter(function(){return this.nodeType==3}),i.text()!=0&&(r=n(t.target).find(".valueSorting").length>0?!0:!1,u=r?n(t.target).find(".valueSorting"):"",n(t.target).find(".valueSorting").remove(),n(t.target).contents().filter(function(){return this.nodeType==3}).remove(),n(t.target).append("<span class='cellValue'>"+i.text()+"<\/span>"),r&&(n(t.target).hasClass("colheader")||n(t.target).hasClass("summary"))&&n(t.target).hasClass("calc")&&!n(t.target).hasClass("rowheader")?n(t.target).append(u):""))})),this._on(this.element,"contextmenu",".value,.rowheader,.colheader,.summary",t.proxy(function(i){var o;if(this.model.enableContextMenu&&t.isNullOrUndefined(this._pivotClientObj)&&!this.model.enableCellContext){i.preventDefault();var r="",u="",f="",e="";e=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?"<li><a>"+this._getLocalizedLabels("Layouts")+"<\/a><ul><li id='normalLayout'><a>"+this._getLocalizedLabels("NormalLayout")+"<\/a><li><li id='excelLikeLayout'><a>"+this._getLocalizedLabels("ExcelLikeLayout")+"<\/a><li><\/ul><\/li>":this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?"<li><a>"+this._getLocalizedLabels("Layouts")+"<\/a><ul><li id='normalLayout'><a>"+this._getLocalizedLabels("NormalLayout")+"<\/a><li><li id='excelLikeLayout'><a>"+this._getLocalizedLabels("ExcelLikeLayout")+"<\/a><li><li id='noSummariesLayout'><a>"+this._getLocalizedLabels("NoSummaries")+"<\/a><li><\/ul><\/li>":"<li><a>"+this._getLocalizedLabels("Layouts")+"<\/a><ul><li id='normalLayout'><a>"+this._getLocalizedLabels("NormalLayout")+"<\/a><li><li id='excelLikeLayout'><a>"+this._getLocalizedLabels("ExcelLikeLayout")+"<\/a><li><li id='noSummariesLayout'><a>"+this._getLocalizedLabels("NoSummaries")+"<\/a><li><li id='normalTopSummaryLayout'><a>"+this._getLocalizedLabels("NormalTopSummary")+"<\/a><li><\/ul><\/li>";r=((this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.analysisMode==t.Pivot.AnalysisMode.Olap)&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)?"":t.buildTag("li.advancedFiltering",t.buildTag("a",this._getLocalizedLabels("AdvancedFiltering"))[0].outerHTML)[0].outerHTML;this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f=t.buildTag("li.collapseByDefault",t.buildTag("a",this._getLocalizedLabels("CollapseByDefault"))[0].outerHTML)[0].outerHTML);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(u=t.buildTag("li.numberFormatting",t.buildTag("a",this._getLocalizedLabels("NumberFormatting"))[0].outerHTML)[0].outerHTML);var s="<li><a>"+this._getLocalizedLabels("HyperLink")+"<\/a><ul><li id='rowHeader'><a>"+this._getLocalizedLabels("EnableRowHeaderHyperlink")+"<\/a><\/li><li id='columnHeader'><a>"+this._getLocalizedLabels("EnableColumnHeaderHyperlink")+"<\/a><\/li><li id='valueCell'><a>"+this._getLocalizedLabels("EnableValueCellHyperlink")+"<\/a><\/li><li id='summaryCell'><a>"+this._getLocalizedLabels("EnableSummaryCellHyperlink")+"<\/a><\/li><\/ul><\/li>",h="<li><a>"+this._getLocalizedLabels("Exporting")+"<\/a><ul><li id='excel'><a>"+this._getLocalizedLabels("Excel")+"<\/a><\/li><li id='word'><a>"+this._getLocalizedLabels("Word")+"<\/a><\/li><li id='pdf'><a>"+this._getLocalizedLabels("PDF")+"<\/a><\/li><li id='csv'><a>"+this._getLocalizedLabels("CSV")+"<\/a><\/li><\/ul><\/li>",c="<li class='e-separator'><a>"+this._getLocalizedLabels("FrozenHeader")+"<\/a><ul><li id='row'><a>"+this._getLocalizedLabels("Row")+"<\/a><\/li><li id='column'><a>"+this._getLocalizedLabels("Column")+"<\/a><\/li><\/ul><\/li>",l=t.buildTag("ul#"+this._id+"contextMenu.pivotGridContextMenu",t.buildTag("li.cellSelect",t.buildTag("a",this._getLocalizedLabels("CellSelection"))[0].outerHTML)[0].outerHTML+t.buildTag("li.columnResize",t.buildTag("a",this._getLocalizedLabels("ColumnResize"))[0].outerHTML)[0].outerHTML+t.buildTag("li.toolTip",t.buildTag("a",this._getLocalizedLabels("ToolTip"))[0].outerHTML)[0].outerHTML+f+r+t.buildTag("li.groupingBar",t.buildTag("a",this._getLocalizedLabels("GroupingBar"))[0].outerHTML)[0].outerHTML+(this.model.analysisMode=="pivot"?t.buildTag("li.cellEditing",t.buildTag("a",this._getLocalizedLabels("CellEditing"))[0].outerHTML)[0].outerHTML:"")+t.buildTag("li.drillThrough",t.buildTag("a",this._getLocalizedLabels("DrillThrough"))[0].outerHTML)[0].outerHTML+t.buildTag("li.rtl",t.buildTag("a",this._getLocalizedLabels("RTL"))[0].outerHTML)[0].outerHTML+e+s+h+c+t.buildTag("li.summaryCustomize",t.buildTag("a",this._getLocalizedLabels("SummaryCustomization"))[0].outerHTML)[0].outerHTML+t.buildTag("li.conditionalFormat",t.buildTag("a",this._getLocalizedLabels("ConditionalFormatting"),{})[0].outerHTML)[0].outerHTML+(this.model.analysisMode=="pivot"?t.buildTag("li.calculatedField",t.buildTag("a",this._getLocalizedLabels("CalculatedField"))[0].outerHTML)[0].outerHTML+u+(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?t.buildTag("li.summaryTypes",t.buildTag("a",this._getLocalizedLabels("SummaryTypes"),{})[0].outerHTML)[0].outerHTML:""):""))[0].outerHTML;n("#"+this._id).append(l);n("li.rtl").addClass("e-separator");o=this.element.find(".pivotGridTable");this.element.find("#"+this._id+"contextMenu").ejMenu({width:"200px",menuType:t.MenuType.ContextMenu,contextMenuTarget:o,enableRTL:this.model.enableRTL,click:t.proxy(this._contextMenuClick,this)});this._stateMaintenance()}})),this._on(n(document),"keydown",this._keyDownPress),this._on(n(document),"keyup",this._keyUpPress),this.model.enableCellSelection&&(this._on(this.element,"mousedown touchstart",".value",this._initCellSelection),this._on(this.element,"click",".colheader,.rowheader",this._headerClickCellSelection)),this.enableCellContext()==!0&&(document.addEventListener?(document.removeEventListener("contextmenu",this._cellContext,!1),document.addEventListener("contextmenu",this._cellContext,!1)):(document.detachEvent("oncontextmenu",this._cellContext),document.attachEvent("oncontextmenu",this._cellContext))),this._on(this.element,"mouseover",".pivotButton",t.proxy(function(i){this._isDragging&&(this.element.append(t.buildTag("span.dropIndicator dropIndicatorActive")[0].outerHTML),i.target.className.indexOf("pivotButton")>=0?this.element.find(".dropIndicator").css("top",n(i.target).position().top-20).css("left",n(i.target).position().left-3):this.element.find(".dropIndicator").css("top",n(i.target).parents(".pivotButton").position().top-20).css("left",n(i.target).parents(".pivotButton").position().left-3))},this)),this._on(this.element,"mouseleave",".pivotButton",t.proxy(function(){this._isDragging&&this.element.find(".dropIndicator").removeClass("dropIndicatorActive")},this)),this._on(this.element,"click","#preventDiv",t.proxy(function(){this.element.find(".e-dialog.advancedFilterDlg:visible").length>0&&(this.element.find(".e-dialog.advancedFilterDlg").hide(),this.element.find("#preventDiv").remove())},this)),this.model.enableCellEditing&&this._on(this.element,"mousedown",".value",this._initCellEditing),this.drillDownHandler=n.proxy(this._drillDown,this),this.addHyperlinkHandler=n.proxy(this._addHyperlink,this),this.removeHyperlinkHandler=n.proxy(this._removeHyperlink,this),this.model.enableCellSelection){n(document).on("click",this._clearSelection);n(document).on("keyup",this._endCellSelection);n(document).on("keydown",this._startCellSelection)}this._on(this.element,"mouseover",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value .cellValue, .rowheader .cellValue, .colheader .cellValue":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue",this.addHyperlinkHandler);this._on(this.element,"mouseleave",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue",this.removeHyperlinkHandler);this._on(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value .cellValue, .rowheader .cellValue, .colheader .cellValue":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue",function(i){if(i.target.className.indexOf("hyperlink")!=-1){var r=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?n(i.target.parentElement).attr("i"):n(i.target.parentElement).attr("p"),f=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this._excelLikeJSONRecords[parseInt(parseInt(r.split(",")[0])*this._rowCount+parseInt(r.split(",")[1]))].Info:this.getJSONRecords()[parseInt(parseInt(r.split(",")[0])*this._excelRowCount+parseInt(r.split(",")[1]))].Info,u={cellValue:i.target.innerHTML,cellPosition:r,cellType:i.target.parentElement.className.split(" ")[0],uniqueName:f.split("::")[0],args:i,rawdata:f};this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&i.target.parentElement.className.indexOf("summary")>=0||i.target.parentElement.className.indexOf("summary value")>=0?this._trigger("summaryCellHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u}):i.target.parentElement.className.indexOf("value")>=0?this._trigger("valueCellHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u}):i.target.parentElement.className.indexOf("rowheader")>=0?this._trigger("rowHeaderHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u}):i.target.parentElement.className.indexOf("colheader")>=0&&this._trigger("columnHeaderHyperlinkClick",{element:this.element,customObject:this.model.customObject,args:u});i.target.parentElement.className.indexOf("value")>=0&&this.model.enableDrillThrough&&(this._rowHeader=[],this._colHeader=[],this.model.analysisMode==t.Pivot.AnalysisMode.Olap?t.Pivot._drillThroughCellClick(i,this):this._cellRangeInfo(i))}});this._on(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?".rowheader, .colheader, .summary":".rowheader, .colheader",function(i){var r,e,s,o,h,u,c,f;if(this.model.enableCellSelection&&!(n(i.target).hasClass("cellValue")&&n(i.target).hasClass("hyperlinkHeaderCell")))if(r=n(i.target).hasClass("cellValue")?i.target.parentElement:i.target,i.shiftKey){if(window.getSelection().removeAllRanges(),n(this.element).find(".selected").removeClass("selected"),e=n(this._selectedCell).attr("p"),s=n(r).attr("p"),(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader")&&(n(this._selectedCell).hasClass("rowheader")||n(this._selectedCell).attr("role")=="rowheader"))for(u=Math.min(e.split(",")[1],s.split(",")[1]);u<=Math.max(e.split(",")[1],s.split(",")[1]);u++)this.element.find("[p='"+e.split(",")[0]+","+u+"']").addClass("selected");if((n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(n(this._selectedCell).hasClass("colheader")||n(this._selectedCell).attr("role")=="columnheader"))for(u=Math.min(e.split(",")[0],s.split(",")[0]);u<=Math.max(e.split(",")[0],s.split(",")[0]);u++)this.element.find("[p='"+u+","+e.split(",")[1]+"']").addClass("selected");if(o=n(this.element).find(".selected"),o.length>0){for(h=[],u=0;u<o.length;u++)c=n(o[u]).attr("p"),f=this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))],f.Value=n(o[u]).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f.Field=this._getFieldName(o[u])),h.push(f);this._trigger("cellSelection",{JSONRecords:h})}}else i.ctrlKey||n(this.element).find(".selected").removeClass("selected"),(n(r).hasClass("colheader")||n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).attr("role")=="columnheader")&&(i.ctrlKey?n(r).toggleClass("selected"):n(r).addClass("selected"),this._selectedCell=r,this._primaryCellPos=n(r).attr("p"),f=this.getJSONRecords()[parseInt(parseInt(this._primaryCellPos.split(",")[0])*this._rowCount+parseInt(this._primaryCellPos.split(",")[1]))],f.Value=n(r).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f.Field=this._getFieldName(r)),i.ctrlKey||this._trigger("cellSelection",{JSONRecords:[f]}))});t.isNullOrUndefined(this._pivotClientObj)?this._on(this.element,"click",".expand, .collapse",t.proxy(this._drillDown,this)):this._pivotClientObj.model.enableDeferUpdate||this._on(this.element,"click",".expand, .collapse",t.proxy(this._drillDown,this));this._on(this.element,"mouseover",".colheader, .rowheader, .expand, .collapse",function(t){if(t.target.className.indexOf("expand")>-1&&!n(t.target).hasClass("header-hover-expand"))n(t.target).addClass("header-hover-expand");else if(t.target.className.indexOf("collapse")>-1&&!n(t.target).hasClass("header-hover-collapse"))n(t.target).addClass("header-hover-collapse");else if((t.target.className.indexOf("expand")<0||t.target.className.indexOf("collapse")<0)&&n(t.target).children("span").length>0){var i=n(t.target).children("span")[0];!n(i).hasClass("header-hover-expand")&&i.className.indexOf("expand")>-1?n(i).addClass("header-hover-expand"):!n(i).hasClass("header-hover-collapse")&&i.className.indexOf("collapse")>-1&&n(i).addClass("header-hover-collapse")}});this._on(this.element,"mouseleave",".colheader, .rowheader, .expand, .collapse",function(){this.element.find(".expand, .collapse").removeClass("header-hover-expand header-hover-collapse")});this.model.enableToolTip&&(this._on(this.element,"mouseover",".value",this._applyToolTip),this._on(this.element,"mouseleave",".value",function(){this.model.enableToolTipAnimation?n("#"+this._id+"_gridTooltip").hide("slow"):n("#"+this._id+"_gridTooltip").hide()}));this.model.enableDrillThrough&&n.proxy(this._addHyperlink,this);this._on(this.element,"click",".filter",t.proxy(this._filterBtnClick,this));this._on(this.element,"click",".sorting",t.proxy(this._sortBtnClick,this));this._on(this.element,"click",".removeBtn",t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._removePvtBtn:this._clientRemovePvtBtn,this));this._on(this.element,"click",".ascOrder, .descOrder",t.proxy(this._sortField,this));this._on(this.element,"mouseover",".pvtBtn",function(t){n(t.target.parentElement).addClass("e-btn e-select")});this._on(this.element,"mouseleave",".pvtBtn",function(t){n(t.target.parentElement).removeClass("e-btn e-select");n(t.target).removeClass("hoverBtn")});this._on(this.element,"mouseover",".pivotButton",function(t){t.target.title=t.target.textContent;n(t.target).find("button").addClass("hoverBtn")});this._on(this.element,"mouseleave",".pivotButton",function(t){n(t.target).find("button").removeClass("hoverBtn")});this._on(this.element,"mouseover",".filter,.sorting,.removeBtn",function(t){n(t.target.parentElement).find("button").addClass("hoverBtn")});this._on(this.element,"mouseleave",".filter,.sorting,.removeBtn",function(t){n(t.target.parentElement).find("button").removeClass("hoverBtn")});this._on(this.element,"mouseleave",".value,.rowheader,.colheader,.summary",t.proxy(function(t){var r=n(t.target).find(".cellValue").contents().filter(function(){return this.nodeType==3}),i,u;r.text()!=0&&(i=n(t.target).find(".valueSorting").length>0?!0:!1,u=i?n(t.target).find(".valueSorting"):"",n(t.target).find(".valueSorting").remove(),n(t.target).find(".cellValue").remove(),n(t.target).append(r.text()),i&&(n(t.target).hasClass("colheader")||n(t.target).hasClass("summary"))&&n(t.target).hasClass("calc")&&!n(t.target).hasClass("rowheader")?n(t.target).append(u):"")}));this._on(this.element,"click",".e-close",t.proxy(function(){this.element.find("#preventDiv").remove()}));this._on(this.element,"click",".dialogOkBtn",t.proxy(this._dialogOKBtnClick,this));(this.model.enableContextMenu||n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen)&&(this._on(this.element,"click",".cellSelect",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".columnResize",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".excelLikeLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".advancedFiltering",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".toolTip",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".collapseByDefault",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".rtl",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".calculatedField",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".cellEditing",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".conditionalFormat",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".summaryCustomize",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".summaryTypes",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".numberFormatting",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".rowHeaderHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".colHeaderHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".valueCellHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".summaryCellHyperLink",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".rowFreeze",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".colFreeze",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".excel",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".word",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".pdf",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".csv",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".normalLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".normalTopSummaryLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".noSummariesLayout",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".drillThrough",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".groupingBar",t.proxy(this._contextMenuClick,this)),this._on(this.element,"click",".frozenHeaders",t.proxy(this._createMenuIcons,this)),this._on(this.element,"click",".exporting",t.proxy(this._createMenuIcons,this)),this._on(this.element,"click",".hyperlinkOptions",t.proxy(this._createMenuIcons,this)),this._on(this.element,"click",".layouts",t.proxy(this._createMenuIcons,this)),n(document).click(function(t){t.target.className.indexOf("hyperlinkOptions")==-1&&n(".hyperLinkDialog").remove();t.target.className.indexOf("exporting")==-1&&n(".exportDialog").remove();t.target.className.indexOf("frozenHeaders")==-1&&n(".frozenDialog").remove();t.target.className.indexOf("layouts")==-1&&n(".layoutsDialog").remove()}));this._on(this.element,"click",".dialogCancelBtn",t.proxy(function(){this.element.find(".e-dialog, .clientDialog").hide();n("#preventDiv").remove()}));this.model.enableColumnResizing&&(this._on(this.element,"mousemove",t.proxy(function(n){this._colResizing(n)})),this._on(this.element,"mousedown","thead,.pivotGridFrozenTable,.pivotGridColValueTable",t.proxy(function(n){this._startColResizing(n)})),this._on(this.element,"mouseup",".e-reSizeColbg",t.proxy(function(n){this._endColResizing(n)})));this._on(this.element,"click",".colheader,.cstot,.cgtot,.calc,.stot,.gtot",t.proxy(function(i){var f,r,o,s,e,u;if(n(i.target).hasClass("collapse")||n(i.target).hasClass("expand"))return!1;if(!t.isNullOrUndefined(this.model.valueSortSettings)&&!t.isNullOrUndefined(this.model.valueSortSettings.sortOrder)&&this.model.valueSortSettings.sortOrder!="none"&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.dataSource.values.length>0||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&JSON.parse(this.getOlapReport()).PivotCalculations.length>0))if(f=this.model.valueSortSettings.sortOrder,r=n(i.target).hasClass("cellValue")||n(i.target).hasClass("valueSorting")||n(i.target).hasClass("expand")||n(i.target).hasClass("collapse")?n(i.target).parent():n(i.target),r.hasClass("calc")||(r=n(this.element).find("[p='"+(Number(r.attr("p").split(",")[0])+Number(r.attr("colspan"))-1)+","+(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource.columns.length:JSON.parse(this.getOlapReport()).PivotColumns.length)+"']")[0]),f=n(r).find(".valueSorting").length>0?n(r).find(".valueSorting").hasClass("descending")?"ascending":"descending":f,this.element.find(".valueSorting").remove(),n(r).find(".valueSorting").length!=0||n(r).hasClass("rowheader")?n(r).find(".valueSorting").removeClass("ascending").removeClass("descending").addClass(f):(o=t.buildTag("span.valueSorting e-icon "+f).css("width","30px").attr("role","button").attr("aria-label","sort")[0].outerHTML,n(r).append(o)),s=JSON.stringify(this.model.customObject),t.PivotAnalysis._valueSorting=Number(n(r).attr("p").split(",")[0]),t.PivotAnalysis._sort=f,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)this.refreshControl();else{for(e="",u=0;u<this.getJSONRecords().length;u++)Number(this.getJSONRecords()[u].Index.split(",")[0])==t.PivotAnalysis._valueSorting&&Number(this.getJSONRecords()[u].Index.split(",")[1])<JSON.parse(this.getOlapReport()).PivotColumns.length+1&&(e=e==""?this.getJSONRecords()[u].Value.indexOf(".")==-1?this.getJSONRecords()[u].Value:this.getJSONRecords()[u].Value.split(".")[1]:e+this.model.valueSortSettings.headerDelimiters+(this.getJSONRecords()[u].Value.indexOf(".")==-1?this.getJSONRecords()[u].Value:this.getJSONRecords()[u].Value.split(".")[1]));this.model.valueSortSettings.index=t.PivotAnalysis._valueSorting;this.model.valueSortSettings.headerText=e;this.model.valueSortSettings.sortOrder=f;this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.valueSorting,JSON.stringify({action:"valueSorting",valueSorting:JSON.stringify(this.model.valueSortSettings),currentReport:JSON.parse(this.getOlapReport()).Report,customObject:s}),this._renderControlSuccess);delete this.model.valueSortSettings.index}}))},_stateMaintenance:function(){var i=t.buildTag("span.enabledState").addClass("e-icon").attr("aria-label",this._getLocalizedLabels("EnabledState"))[0].outerHTML;this.model.dataSource.enableAdvancedFilter&&(this.element.parents(".e-pivotclient").length>0?n(".advancedFiltering").addClass("enabled"):n(".advancedFiltering a:eq(0)").append(i));this.model.enableDrillThrough&&(n(".drillThrough a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CellEditing")));this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough&&(this.element.find(".drillThrough").addClass("enabled"),this.element.find(".toolBar").ejToolbar("disableItemByID","cellEditing"));!this.model.enableToolTip||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||(this.element.parents(".e-pivotclient").length>0?n(".toolTip").addClass("enabled"):n(".toolTip a:eq(0)").append(i));this.model.enableCellSelection&&(n(".cellSelect a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CellEditing")));this.model.enableColumnResizing&&(this.element.parents(".e-pivotclient").length>0?(n(".columnResize").addClass("enabled"),n(".toolBar").ejToolbar("disableItemByID","collapseByDefault")):(n(".columnResize a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CollapseByDefault"))));this.model.enableGroupingBar&&n(".groupingBar a:eq(0)").append(i);this.model.enableRTL&&(this.element.parents(".e-pivotclient").length>0?n(".rtl").addClass("enabled"):n(".rtl a:eq(0)").append(i));this.model.enableCollapseByDefault&&(this.element.parents(".e-pivotclient").length>0?(n(".toolBar").ejToolbar("disableItemByID","columnResize"),n(".toolBar").ejToolbar("disableItemByID","frozenHeaders"),n(".collapseByDefault").addClass("enabled")):(n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("ColumnResize")),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("FrozenHeader")),n(".collapseByDefault a:eq(0)").append(i)));this.model.enableCellEditing&&(this.element.parents(".e-pivotclient").length>0?(this.element.find(".cellEditing").addClass("enabled"),this.element.find(".toolBar").ejToolbar("disableItemByID","drillThrough")):n(".cellEditing a:eq(0)").append(i),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("DrillThrough")),n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("CellSelection")));this.model.frozenHeaderSettings.enableFrozenRowHeaders&&n("li#row a:eq(0)").append(i);this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&n("li#column a:eq(0)").append(i);this.model.hyperlinkSettings.enableRowHeaderHyperlink&&n("li#rowHeader a:eq(0)").append(i);this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&n("li#columnHeader a:eq(0)").append(i);this.model.hyperlinkSettings.enableValueCellHyperlink&&n("li#valueCell a:eq(0)").append(i);this.model.hyperlinkSettings.enableSummaryCellHyperlink&&n("li#summaryCell a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.Normal&&n("li#normalLayout a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.NoSummaries&&n("li#noSummariesLayout a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout&&n("li#excelLikeLayout a:eq(0)").append(i);this.model.layout==t.PivotGrid.Layout.NormalTopSummary&&n("li#normalTopSummaryLayout a:eq(0)").append(i);(this.model.layout==t.PivotGrid.Layout.NormalTopSummary||this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout||this.model.layout==t.PivotGrid.Layout.NoSummaries||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this.element.parents(".e-pivotclient").length>0?n(".toolBar").ejToolbar("disableItemByID","summaryCustomize"):n("#"+this._id+"contextMenu").ejMenu("disableItem",this._getLocalizedLabels("SummaryCustomization")))},_contextMenuClick:function(i){var e=t.buildTag("span.enabledState").addClass("e-icon").attr("aria-label","")[0].outerHTML,o=this.element.parents(".e-pivotclient").length>0?n(i.target):n(i.element),u,f;(n(i.element).hasClass("numberFormatting")||n(i.target).hasClass("numberFormatting"))&&this._createMenuDialog(i);(n(i.element).hasClass("cellSelect")||n(i.target).hasClass("cellSelect"))&&(this.model.enableCellEditing||(this.model.enableCellSelection=!this.model.enableCellSelection),this.renderControlFromJSON());(n(i.element).hasClass("columnResize")||n(i.target).hasClass("columnResize"))&&!this.model.enableCollapseByDefault&&(this.model.enableColumnResizing=!this.model.enableColumnResizing,this.renderControlFromJSON());(n(i.element).hasClass("toolTip")||n(i.target).hasClass("toolTip"))&&(this.model.enableToolTip=!this.model.enableToolTip,this.renderControlFromJSON());!(n(i.element).hasClass("collapseByDefault")||n(i.target).hasClass("collapseByDefault"))||this.model.enableColumnResizing||this.model.enableFrozenColumnHeaders||this.model.enableFrozenRowHeaders||(this.model.enableCollapseByDefault?this.model.enableCollapseByDefault=!1:(this.model.enableCollapseByDefault=!0,this.model.collapsedMembers=null),this.renderControlFromJSON());(n(i.element).hasClass("rtl")||n(i.target).hasClass("rtl"))&&(this.model.enableRTL=!this.model.enableRTL,this.renderControlFromJSON());(n(i.element).hasClass("calculatedField")||n(i.target).hasClass("calculatedField"))&&this._createCalculatedField();(n(i.element).hasClass("cellEditing")||n(i.target).hasClass("cellEditing"))&&(this.model.enableCellSelection||(this.model.enableCellEditing=!this.model.enableCellEditing,this.model.enableDrillThrough=!1),this.renderControlFromJSON());(n(i.element).hasClass("drillThrough")||n(i.target).hasClass("drillThrough"))&&(this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(dialogTitle="Cube Configuration",dialogContent="<p>Please configure cube!<\/p>",u=t.buildTag("div#clientDialog.clientDialog",{opacity:"1"}).attr("title",dialogTitle)[0].outerHTML,n(u).appendTo("#"+this._id),n(dialogContent).appendTo(this.element.find(".clientDialog")),this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:200,target:"#"+this._id,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)})):this.element.parents(".e-pivotclient").length>0?(this._pivotClientObj.model.enableDrillThrough=!this._pivotClientObj.model.enableDrillThrough,this.model.enableDrillThrough=this._pivotClientObj.model.enableDrillThrough,this.model.enableCellEditing=!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.renderControlFromJSON():this._pivotClientObj._load()):(this.model.enableDrillThrough=!this.model.enableDrillThrough,this.model.enableCellEditing=!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.renderControlFromJSON():this._load()));(n(i.element).hasClass("summaryCustomize")||n(i.target).hasClass("summaryCustomize"))&&this._createMenuDialog(i);(n(i.element).hasClass("conditionalFormat")||n(i.target).hasClass("conditionalFormat"))&&(this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.operationalMode=="clientmode"&&this.setOlapReport(this._pivotClientObj.model.dataSource),this.model.enableConditionalFormatting=!0,this.openConditionalFormattingDialog(),t.Pivot.closePreventPanel(this));(n(i.element).hasClass("summaryTypes")||n(i.target).hasClass("summaryTypes"))&&this._createMenuDialog(i);(n(i.element).hasClass("advancedFiltering")||n(i.target).hasClass("advancedFiltering"))&&(this.model.dataSource.enableAdvancedFilter=!this.model.dataSource.enableAdvancedFilter,this.renderControlFromJSON());n(i.element).hasClass("groupingBar")&&(this.model.enableGroupingBar=!this.model.enableGroupingBar,this.renderControlFromJSON());(i.element!="undefined"&&i.parentText==this._getLocalizedLabels("Layouts")||n(i.target).parents().hasClass("layoutsDialog"))&&((i.ID=="normalLayout"||n(i.target).hasClass("normalLayout"))&&(this.model.layout=t.PivotGrid.Layout.Normal,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="normal")),(i.ID=="excelLikeLayout"||n(i.target).hasClass("excelLikeLayout"))&&(this.model.layout=t.PivotGrid.Layout.ExcelLikeLayout,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="excellikelayout")),(i.ID=="noSummariesLayout"||n(i.target).hasClass("noSummariesLayout"))&&(this.model.layout=t.PivotGrid.Layout.NoSummaries,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="nosummaries")),(i.ID=="normalTopSummaryLayout"||n(i.target).hasClass("normalTopSummaryLayout"))&&(this.model.layout=t.PivotGrid.Layout.NormalTopSummary,this.element.parents(".e-pivotclient").length>0&&(this._pivotClientObj.model.gridLayout="normaltopsummary")),i.ID=="excelLikeLayout"||n(i.target).hasClass("excelLikeLayout")?this.excelLikeLayout(this.getJSONRecords()):(this._excelLikeJSONRecords=null,this.refreshPivotGrid()));(i.element!="undefined"&&i.parentText==this._getLocalizedLabels("HyperLink")||n(i.target).parents().hasClass("hyperLinkDialog"))&&((i.ID=="rowHeader"||n(i.target).hasClass("rowHeaderHyperLink"))&&(this.model.hyperlinkSettings.enableRowHeaderHyperlink=!this.model.hyperlinkSettings.enableRowHeaderHyperlink),(i.ID=="columnHeader"||n(i.target).hasClass("colHeaderHyperLink"))&&(this.model.hyperlinkSettings.enableColumnHeaderHyperlink=!this.model.hyperlinkSettings.enableColumnHeaderHyperlink),(i.ID=="valueCell"||n(i.target).hasClass("valueCellHyperLink"))&&(this.model.hyperlinkSettings.enableValueCellHyperlink=!this.model.hyperlinkSettings.enableValueCellHyperlink),(i.ID=="summaryCell"||n(i.target).hasClass("summaryCellHyperLink"))&&(this.model.hyperlinkSettings.enableSummaryCellHyperlink=!this.model.hyperlinkSettings.enableSummaryCellHyperlink),this.renderControlFromJSON());(i.element!=r&&i.parentText==this._getLocalizedLabels("Exporting")||n(i.target).parents().hasClass("exportDialog"))&&(f=this.element.parents(".e-pivotclient").length>0?n(i.target).attr("class").split(" ")[0]:i.ID,this.element.parents(".e-pivotclient").length>0&&!t.isNullOrUndefined(this._pivotClientObj)&&(this.model.beforeExport=this._pivotClientObj.model.beforeExport),this.exportPivotGrid(f,"Sample"));(i.element!=r&&i.parentText==this._getLocalizedLabels("FrozenHeader")||n(i.target).parents().hasClass("frozenDialog"))&&!this.model.enableCollapseByDefault&&((i.ID=="row"||n(i.target).hasClass("rowFreeze"))&&(this.model.frozenHeaderSettings.enableFrozenRowHeaders=this.model.frozenHeaderSettings.enableFrozenRowHeaders?!1:!0),(i.ID=="column"||n(i.target).hasClass("colFreeze"))&&(this.model.frozenHeaderSettings.enableFrozenColumnHeaders=this.model.frozenHeaderSettings.enableFrozenColumnHeaders?!1:!0),this.renderControlFromJSON())},_createMenuIcons:function(i){var u,r,f,e;n(i.target).hasClass("exporting")&&(u=t.buildTag("div.exportDialog#exportDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.excel exportingIcons").attr({"aria-label":this._getLocalizedLabels("Excel"),title:this._getLocalizedLabels("Excel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.word exportingIcons").attr({"aria-label":this._getLocalizedLabels("Word"),title:this._getLocalizedLabels("Word"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pdf exportingIcons").attr({"aria-label":this._getLocalizedLabels("PDF"),title:this._getLocalizedLabels("PDF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.csv exportingIcons").attr({"aria-label":this._getLocalizedLabels("CSV"),title:this._getLocalizedLabels("CSV"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,this.element.find("div .exportDialog").length==0&&(n(u).appendTo(this.element),n(".exportDialog").css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px")));n(i.target).hasClass("hyperlinkOptions")&&(r=t.buildTag("div.hyperLinkDialog#hyperLinkTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.rowHeaderHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableRowHeaderHyperlink"),title:this._getLocalizedLabels("EnableRowHeaderHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.colHeaderHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableColumnHeaderHyperlink"),title:this._getLocalizedLabels("EnableColumnHeaderHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.valueCellHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableValueCellHyperlink"),title:this._getLocalizedLabels("EnableValueCellHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.summaryCellHyperLink hyperLinkIcons").attr({"aria-label":this._getLocalizedLabels("EnableSummaryCellHyperlink"),title:this._getLocalizedLabels("EnableSummaryCellHyperlink"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.hyperLinkDialog").length==0&&(n(r).appendTo(this.element),n(r).css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px"),this.model.hyperlinkSettings.enableRowHeaderHyperlink&&this.element.find(".rowHeaderHyperLink").addClass("enabled"),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&this.element.find(".colHeaderHyperLink").addClass("enabled"),this.model.hyperlinkSettings.enableValueCellHyperlink&&this.element.find(".valueCellHyperLink").addClass("enabled"),this.model.hyperlinkSettings.enableSummaryCellHyperlink&&this.element.find(".summaryCellHyperLink").addClass("enabled")));n(i.target).hasClass("frozenHeaders")&&(f=t.buildTag("div.frozenDialog#frozenDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.rowFreeze frozenHeaderIcons").attr({"aria-label":this._getLocalizedLabels("Row"),title:this._getLocalizedLabels("Row"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.colFreeze frozenHeaderIcons").attr({"aria-label":this._getLocalizedLabels("Column"),title:this._getLocalizedLabels("Column"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,this.element.find("div.frozenDialog").length==0&&(n(f).appendTo(this.element),n(".frozenDialog").css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px"),this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.element.find(".rowFreeze").addClass("enabled"),this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.element.find(".colFreeze").addClass("enabled"),this.model.frozenHeaderSettings.enableFrozenHeaders&&this.element.find(".bothFreeze").addClass("enabled")));n(i.target).hasClass("layouts")&&(e=t.buildTag("div.layoutsDialog#layoutsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.normalLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("NormalLayout"),title:this._getLocalizedLabels("NormalLayout"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.excelLikeLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("ExcelLikeLayout"),title:this._getLocalizedLabels("ExcelLikeLayout"),tabindex:0})[0].outerHTML)[0].outerHTML+(this.model.analysisMode==t.Pivot.AnalysisMode.Olap?t.buildTag("td",t.buildTag("div.noSummariesLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("NoSummaries"),title:this._getLocalizedLabels("NoSummaries"),tabindex:0})[0].outerHTML)[0].outerHTML:"")+(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?t.buildTag("td",t.buildTag("div.normalTopSummaryLayout layoutIcons").attr({"aria-label":this._getLocalizedLabels("NormalTopSummary"),title:this._getLocalizedLabels("NormalTopSummary"),tabindex:0})[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,this.element.find("div .layoutsDialog").length==0&&(n(e).appendTo(this.element),n(".layoutsDialog").css("left",i.target.offsetLeft+20+"px").css("top",i.target.offsetTop+15+"px"),this.model.layout==t.PivotGrid.Layout.Normal&&this.element.find(".normalLayout").addClass("enabled"),this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout&&this.element.find(".excelLikeLayout").addClass("enabled"),this.model.layout==t.PivotGrid.Layout.NoSummaries&&this.element.find(".noSummariesLayout").addClass("enabled"),this.model.layout==t.PivotGrid.Layout.NormalTopSummary&&this.element.find(".normalTopSummaryLayout").addClass("enabled")))},_createMenuDialog:function(i){var c,e,l,a,v,o,s,f,u,h,b,k,d,g;if(this._dialogName=t.isNullOrUndefined(i.target)?n(i.element).attr("class").split(" ")[0]:n(i.target).attr("class").split(" ")[0],t.Pivot.openPreventPanel(this),c=t.buildTag("div#clientDialog.clientDialog",{opacity:"1"})[0].outerHTML,e=currentTag=dialogContent="",n(i.target).hasClass("numberFormatting")||n(i.element).hasClass("numberFormatting")){for(e=this._getLocalizedLabels("NumberFormatting"),currentTag="Number Formatting",l=t.buildTag("label",this._getLocalizedLabels("Measures"))[0].outerHTML,f="<select id='measureOption'>",u=0;u<this.model.dataSource.values.length;u++)f+="<option>"+this.model.dataSource.values[u].fieldName+"<\/option>";f+="<\/select>";a=t.buildTag("label",this._getLocalizedLabels("NumberFormats"))[0].outerHTML;v="<div class='summarTypes'><select id='numberFormatOption'><option value='Decimal'>Decimal<\/option><option value='Currency'>Currency<\/option><option value='Percentage'>Percentage<\/option><option value='Number'>Number<\/option><option value='Date'>Date<\/option><option value='Time'>Time<\/option><option value='Scientific'>Scientific<\/option><option value='Fraction'>Fraction<\/option><\/select><\/div>";dialogContent=t.buildTag("div#reportDlg.reportDlg","<table><tr><td>"+l+"<\/td><td>"+f+"<\/td><\/tr><tr><td>"+a+"<\/td><td>"+v+"<\/td><\/tr><\/table>")[0].outerHTML}if(n(i.target).hasClass("summaryCustomize")||n(i.element).hasClass("summaryCustomize")){e=this._getLocalizedLabels("SummaryCustomization");var s=t.buildTag("label",this._getLocalizedLabels("HideGrandTotal"))[0].outerHTML,h=t.buildTag("label",this._getLocalizedLabels("HideSubTotal"))[0].outerHTML,f="<div class='measures'><select id='hideSubTotal'>";if(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(u=0;u<this.model.dataSource.columns.length;u++)f+="<option>"+this.model.dataSource.columns[u].fieldCaption+"<\/option>";for(u=0;u<this.model.dataSource.rows.length;u++)f+="<option>"+this.model.dataSource.rows[u].fieldCaption+"<\/option>"}else if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){for(o=n(this.element).parents(".e-pivotclient").length>0?this._pivotClientObj.getOlapReport():this.getOlapReport(),u=0;u<JSON.parse(o).PivotRows.length;u++)f+="<option>"+JSON.parse(o).PivotRows[u].FieldName+"<\/option>";for(u=0;u<JSON.parse(o).PivotColumns.length;u++)f+="<option>"+JSON.parse(o).PivotColumns[u].FieldName+"<\/option>"}f+="<\/div>";var y=t.buildTag("input#rowSumCheckBox.rowSumCheckBox","",{},{name:"row",type:"checkbox",tabindex:0})[0].outerHTML+" "+t.buildTag("label.rowGrndlabel",this._getLocalizedLabels("Row"))[0].outerHTML+"<br/>",p=t.buildTag("input#colSumCheckBox.colSumCheckBox","",{},{name:"column",type:"checkbox",tabindex:0})[0].outerHTML+" "+t.buildTag("label.colGrndlabel",this._getLocalizedLabels("Column"))[0].outerHTML+"<br/>",w=t.buildTag("input#bothSumCheckBox.bothSumCheckBox","",{},{name:"both",type:"checkbox",tabindex:0})[0].outerHTML+" "+t.buildTag("label.bothGrndlabel",this._getLocalizedLabels("Both"))[0].outerHTML+"<br/>";dialogContent=this.model.analysisMode=="pivot"?t.buildTag("div#customizeDlg.customizeDlg","<table><tr><td style='vertical-align:top'>"+s+"<\/td><td>"+y+p+w+"<\/td><\/tr><tr><td>"+h+"<\/td><td>"+f+"<\/td><\/tr><\/table>")[0].outerHTML:t.buildTag("div#customizeDlg.customizeDlg","<table><tr><td>"+s+"<\/td><td>"+y+p+w+"<\/td><\/tr><\/table>")[0].outerHTML}if(n(i.target).hasClass("summaryTypes")||n(i.element).hasClass("summaryTypes")){if(e=this._getLocalizedLabels("SummaryTypes"),s=t.buildTag("label",this._getLocalizedLabels("Measures"))[0].outerHTML,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(f="<div class='measures'><select id='drillMeasure'>",u=0;u<this.model.dataSource.values.length;u++)f+="<option>"+this.model.dataSource.values[u].fieldCaption+"<\/option>";f+="<\/div>"}h=t.buildTag("label",this._getLocalizedLabels("SummaryType"))[0].outerHTML;b=t.buildTag("input#drillSum").attr("type","text")[0].outerHTML;dialogContent=t.buildTag("div#summaryDlg.#summaryDlg","<table><tr><td>"+s+"<\/td><td>"+f+"<\/td><\/tr><tr><td>"+h+"<\/td><td>"+b+"<\/td><\/tr><\/table>")[0].outerHTML}k=t.buildTag("div#EditorDiv.editorDiv","",{"margin-left":"5px"})[0].outerHTML;dialogContent+=k;d="<button id=OKBtn class='dialogOkBtn'>"+this._getLocalizedLabels("OK")+"<\/button>";g="<button id=CancelBtn class='dialogCancelBtn'>"+this._getLocalizedLabels("Cancel")+"<\/button>";dialogFooter=t.buildTag("div.dialogFooter",d+g,{float:"right","margin-bottom":"7px"})[0].outerHTML;n(c).appendTo("#preventDiv");n(dialogContent+dialogFooter).appendTo(".clientDialog");n(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:"auto",target:"#"+this._id,enableResize:!1,close:t.Pivot.closePreventPanel(this)});n(".e-titlebar").prepend(t.buildTag("div",e,{display:"inline"})[0].outerHTML)[0];n(".dialogOkBtn, .dialogCancelBtn").ejButton({width:"67px",enableRTL:this.model.enableRTL,type:t.ButtonType.Button});this._selectedFormat==""&&this._selectedMeasure==""&&(n("#numberFormatOption").ejDropDownList({enableRTL:this.model.enableRTL,selectedIndex:0,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n("#measureOption").ejDropDownList({enableRTL:this.model.enableRTL,selectedIndex:0,showCheckbox:!0,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}));this._selectedMeasure!=""&&this._selectedFormat!=""&&(n("#numberFormatOption").ejDropDownList({enableRTL:this.model.enableRTL,text:this._selectedFormat,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n("#measureOption").ejDropDownList({enableRTL:this.model.enableRTL,text:this._selectedMeasure,showCheckbox:!0,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}));n("#categoricalInput").ejMaskEdit({name:"mask",inputMode:t.InputMode.Text,watermarkText:"Column Page Size"});n("#seriesInput").ejMaskEdit({name:"mask",inputMode:t.InputMode.Text,watermarkText:"Row Page Size"});n("#rowSumCheckBox,#colSumCheckBox,#bothSumCheckBox").ejCheckBox({size:"small",showRoundedCorner:!0});this.rowCheckBox=n("#rowSumCheckBox").data("ejCheckBox");this.colCheckBox=n("#colSumCheckBox").data("ejCheckBox");this.bothCheckBox=n("#bothSumCheckBox").data("ejCheckBox");(n(i.target).hasClass("summaryCustomize")||n(i.element).hasClass("summaryCustomize"))&&(this.rowGrand==!1&&this.rowCheckBox.setModel({checked:"checked"}),this.colGrand==!1&&this.colCheckBox.setModel({checked:"checked"}),this.bothGrand==!1&&this.bothCheckBox.setModel({checked:"checked"}),n("#hideSubTotal").ejDropDownList({showCheckbox:!0,enableRTL:this.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.dropmeasure=n("#hideSubTotal").data("ejDropDownList"),this.selval!=r&&this.dropmeasure.setModel({value:this.selval}));(n(i.target).hasClass("summaryTypes")||n(i.element).hasClass("summaryTypes"))&&(n("#_summaryOK,#_summaryCancel").ejButton({enableRTL:this.model.enableRTL}),n("#drillMeasure").ejDropDownList({selectedIndices:[0],enableRTL:this.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n("#drillSum").ejDropDownList({dataSource:[{option:"Sum",value:this._getLocalizedLabels("Sum")},{option:"Average",value:this._getLocalizedLabels("Average")},{option:"Count",value:this._getLocalizedLabels("Count")},{option:"Min",value:this._getLocalizedLabels("Min")},{option:"Max",value:this._getLocalizedLabels("Max")}],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),drilmes=n("#drillMeasure").data("ejDropDownList"),drilsum=n("#drillSum").data("ejDropDownList"),this.drilsumval!=r&&drilmes.setModel({value:this.drilsumval}),this.sumtyp!=null&&drilsum.setModel({value:this.sumtyp}))},_dialogOKBtnClick:function(){var o,f,e,i,h,s,c,l,u,a;if(this._dialogName=="numberFormatting"){for(this._selectedFormat=n("#numberFormatOption").ejDropDownList("getSelectedValue"),this._selectedMeasure=n("#measureOption").ejDropDownList("getSelectedValue"),o=this._selectedMeasure.split(","),this.element.find(".e-dialog").remove(),t.Pivot.closePreventPanel(this),u=0;u<this.model.dataSource.values.length;u++)for(f=0;f<o.length;f++)this.model.dataSource.values[u].fieldName==o[f]&&(this.model.dataSource.values[u].format=this._selectedFormat.toLowerCase());t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.model.analysisMode!="pivot"||this._pivotClientObj.model.operationalMode!="clientmode"||(this.model.collapsedMembers=null);this._populatePivotGrid()}if(this._dialogName=="summaryCustomize"&&(pGridObj=this,t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.model.analysisMode!="pivot"||this._pivotClientObj.model.operationalMode!="clientmode"||(pGridObj.model.collapsedMembers=null),pGridObj.rowCheckBox.model.checked?(pGridObj.model.enableColumnGrandTotal=pGridObj.model.enableGrandTotal=!0,pGridObj.model.enableRowGrandTotal=pGridObj.rowGrand=!1):pGridObj.model.enableRowGrandTotal=pGridObj.rowGrand=!0,pGridObj.colCheckBox.model.checked?(pGridObj.model.enableRowGrandTotal=pGridObj.model.enableGrandTotal=!0,pGridObj.model.enableColumnGrandTotal=pGridObj.colGrand=!1):pGridObj.model.enableColumnGrandTotal=pGridObj.colGrand=!0,pGridObj.bothCheckBox.model.checked||pGridObj.colCheckBox.model.checked&&pGridObj.rowCheckBox.model.checked?(pGridObj.model.enableRowGrandTotal=pGridObj.model.enableColumnGrandTotal=!0,pGridObj.model.enableGrandTotal=pGridObj.bothGrand=!1):pGridObj.model.enableGrandTotal=pGridObj.bothGrand=!0,n("#hideSubTotal").ejDropDownList("getSelectedValue")!=null&&this.model.analysisMode=="pivot"&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(pGridObj.selval=n("#hideSubTotal").ejDropDownList("getSelectedValue"),e=n("#hideSubTotal").ejDropDownList("getSelectedValue").split(","),pGridObj.model.dataSource.rows.length>0&&n.each(pGridObj.model.dataSource.rows,function(n,t){t.fieldName.length>0&&(t.showSubTotal=!0)}),pGridObj.model.dataSource.columns.length>0&&n.each(pGridObj.model.dataSource.columns,function(n,t){t.fieldName.length>0&&(t.showSubTotal=!0)}),n.each(e,function(t,i){pGridObj.model.dataSource.rows.length>0&&n.each(pGridObj.model.dataSource.rows,function(n,t){t.fieldName.length>0&&t.fieldName==i&&(t.showSubTotal=!1)});pGridObj.model.dataSource.columns.length>0&&n.each(pGridObj.model.dataSource.columns,function(n,t){t.fieldName.length>0&&t.fieldName==i&&(t.showSubTotal=!1)})}),pGridObj._populatePivotGrid()):this.model.analysisMode=="pivot"&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(pGridObj.selval=n("#hideSubTotal").ejDropDownList("getSelectedValue"),e=n("#hideSubTotal").ejDropDownList("getSelectedValue").split(","),i=n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()):JSON.parse(pGridObj.getOlapReport()),i.PivotRows.length>0&&n.each(i.PivotRows,function(n,t){t.FieldName.length>0&&(t.showSubTotal=!0)}),i.PivotColumns.length>0&&n.each(i.PivotColumns,function(n,t){t.FieldName.length>0&&(t.showSubTotal=!0)}),n.each(e,function(t,r){i.PivotRows.length>0&&n.each(i.PivotRows,function(n,t){t.FieldName.length>0&&t.FieldName==r&&(t.showSubTotal=!1)});i.PivotColumns.length>0&&n.each(i.PivotColumns,function(n,t){t.FieldName.length>0&&t.FieldName==r&&(t.showSubTotal=!1)})}),h={JsonRecords:JSON.stringify(pGridObj.getJSONRecords()),PivotReport:JSON.stringify(i)},pGridObj._renderControlSuccess(h)):pGridObj._load(),t.Pivot.closePreventPanel(this)),this._dialogName=="summaryTypes"){if(n("#drillSum").val()!=r&&(this.drilsumval=n("#drillMeasure").ejDropDownList("getSelectedValue"),s=this.sumtyp=n("#drillSum").val(),s!=null&&(c=s.toLowerCase()),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)){for(l=n("#drillMeasure").ejDropDownList("getSelectedValue").split(",").length,u=0;u<l;u++)a=n("#drillMeasure").ejDropDownList("getSelectedValue").split(",")[u],n.grep(this.model.dataSource.values,function(n){return n.fieldName==a})[0].summaryType=c;t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.model.analysisMode!="pivot"||this._pivotClientObj.model.operationalMode!="clientmode"||(this.model.collapsedMembers=null);this._populatePivotGrid()}t.Pivot.closePreventPanel(this)}},_keyUpPress:function(t){if(t.which===16&&this.model.enableCellSelection&&(this._completeCellSelection(t),n("#"+this._id).find(".value").removeClass("hoverCell"),this._startPosCell=null,_startPosCell=null),t.which===13&&this.model.enableCellEditing&&!this.model.enableCellSelection&&n("#"+this._id).find(".value.hoverCell").length){n("#"+this._id).find(".value.hoverCell").trigger("mouseover");_startPosCell=n(n("#"+this._id).find(".value.hoverCell")).attr("p");var i={target:n("#"+this._id).find(".value.hoverCell > span")[0]};this._completeCellEditing(i);t.preventDefault();n("#"+this._id).find(".value.hoverCell .curInput").focus();n("#"+this._id).find(".value").removeClass("hoverCell")}},_keyDownPress:function(i){var c,f,u,o,r,s,e,v,a,l;if(n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&((document.activeElement.id=="Pager_CategCurrentPage"||document.activeElement.id=="Pager_SeriesCurrentPage")&&(i.which===35?(i.preventDefault(),document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveLast").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveLast").last().trigger("click")):i.which==36&&(i.preventDefault(),document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveFirst").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveFirst").last().trigger("click")),i.which===39?document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveNext").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .moveNext").last().trigger("click"):i.which===37&&(document.activeElement.id=="Pager_CategCurrentPage"?n(".e-pivotpager[targetcontrolid='"+this._id+"'] .movePrevious").first().trigger("click"):document.activeElement.id=="Pager_SeriesCurrentPage"&&n(".e-pivotpager[targetcontrolid='"+this._id+"'] .movePrevious").last().trigger("click"))),i.stopImmediatePropagation()),i.which!==27||t.isNullOrUndefined(this._curFocus.grp)&&(t.isNullOrUndefined(this._curFocus.tab)||!this._curFocus.tab.hasClass("pivotButton"))?i.which===27&&(this._index.dialog=0):(this._curFocus.tab.mouseleave().removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)?!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("pivotButton")&&(l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),a.mouseover().addClass("hoverCell").focus(),this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,this._index.field=0),i.which===70&&i.ctrlKey&&(i.preventDefault(),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.find(".filter").click():this._curFocus.grp.find(".filter").click()),i.which===83&&i.ctrlKey&&(i.preventDefault(),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(this._curFocus.tab.find(".sorting").click(),l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(this._curFocus.grp.find(".sorting").click(),l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),a.mouseover().addClass("hoverCell").focus()),(i.which===46||i.which===82&&i.ctrlKey)&&(i.which!=46&&i.preventDefault(),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.find(".removeBtn").click():this._curFocus.grp.find(".removeBtn").click()),i.shiftKey&&t.isNullOrUndefined(this._startPosCell)&&(_startPosCell=i.target.getAttribute("p"),this._startPosCell=i.target.getAttribute("p")),i.which===39&&n("#"+this._id).find(".e-dialog .hoverCell").length>0?n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-plus").click():i.which===37&&n("#"+this._id).find(".e-dialog .hoverCell").length>0&&n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-minus").click(),(i.which===40||i.which===39||i.which===38||i.which===37)&&i.shiftKey&&this.model.enableCellSelection){if(n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","0"),c=n(i.target),i.which=="40")for(f=c.attr("p"),u=parseInt(f.split(",")[1])+Number(c.attr("rowspan"));t.isNullOrUndefined(o)&&u<this._rowCount;)r=n(n("#"+this._id)).find("[p='"+f.split(",")[0]+","+u+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),this._curFocus.selection=n(o),u++;else if(i.which=="38")for(f=c.attr("p"),u=parseInt(f.split(",")[1])-1;t.isNullOrUndefined(o)&&u>=0;)r=n(n("#"+this._id)).find("[p='"+f.split(",")[0]+","+u+"']")[0],t.isNullOrUndefined(r)&&(r=n(n("#"+this._id)).find("[p='"+(parseInt(f.split(",")[0])-1)+","+u+"']")[0]),!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),this._curFocus.selection=n(o),u--;else if(i.which=="39")for(f=c.attr("p"),u=parseInt(f.split(",")[0])+Number(c.attr("colspan"));t.isNullOrUndefined(o)&&u<Math.ceil(this.getJSONRecords().length/this._rowCount);)r=n(n("#"+this._id)).find("[p='"+u+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),this._curFocus.selection=n(o),u++;else if(i.which=="37"){for(var f=c.attr("p"),u=parseInt(f.split(",")[0])-1,o=n(n("#"+this._id)).find("[p='"+(parseInt(f.split(",")[0])-1)+","+f.split(",")[1]+"']")[0];t.isNullOrUndefined(o)&&u>=0;)r=n(n("#"+this._id)).find("[p='"+u+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r),u--;this._curFocus.selection=n(o)}if(this._curFocus.selection.attr("tabindex","-1").focus().addClass("hoverCell"),Number(_startPosCell.split(",")[0])<=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])<=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u<=Number(this._curFocus.selection.attr("p").split(",")[0]);u++)for(h=Number(_startPosCell.split(",")[1]);h<=Number(this._curFocus.selection.attr("p").split(",")[1]);h++)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell");else if(Number(_startPosCell.split(",")[0])>=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])>=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u>=Number(this._curFocus.selection.attr("p").split(",")[0]);u--)for(h=Number(_startPosCell.split(",")[1]);h>=Number(this._curFocus.selection.attr("p").split(",")[1]);h--)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell");else if(Number(_startPosCell.split(",")[0])<=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])>=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u<=Number(this._curFocus.selection.attr("p").split(",")[0]);u++)for(h=Number(_startPosCell.split(",")[1]);h>=Number(this._curFocus.selection.attr("p").split(",")[1]);h--)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell");else if(Number(_startPosCell.split(",")[0])>=Number(this._curFocus.selection.attr("p").split(",")[0])&&Number(_startPosCell.split(",")[1])<=Number(this._curFocus.selection.attr("p").split(",")[1]))for(u=Number(_startPosCell.split(",")[0]);u>=Number(this._curFocus.selection.attr("p").split(",")[0]);u--)for(h=Number(_startPosCell.split(",")[1]);h<=Number(this._curFocus.selection.attr("p").split(",")[1]);h++)n("#"+this._id).find("[p='"+u+","+h+"']").hasClass("value")&&n("#"+this._id).find("[p='"+u+","+h+"']").addClass("hoverCell")}else if((i.which===40||i.which===38||i.which===37||i.which===39)&&n("#"+this._id).find(".calcFormulaDiv:visible").length>0)i.preventDefault(),s=n("#"+this._id).find(".calcFormulaDiv td:visible"),t.isNullOrUndefined(this._curFocus.formula)?(this._index.formula=i.which==39?0:i.which==37?s.length-1:0,this._curFocus.formula=s.eq(this._index.formula).addClass("hoverCell").mouseover()):(this._curFocus.formula.removeClass("hoverCell").mouseleave(),i.which===39?this._index.formula=this._index.formula+1>s.length-1?0:this._index.formula+1:i.which===37?this._index.formula=this._index.formula-1<0?s.length-1:this._index.formula-1:i.which===40?this._index.formula=this._index.formula+4>s.length-1?(this._index.formula+4)%10:this._index.formula+4:i.which===38&&(this._index.formula=this._index.formula-4<0?this._index.formula- -16:this._index.formula-4),this._curFocus.formula=s.eq(this._index.formula).addClass("hoverCell").mouseover());else if((i.keyCode===40||i.which===38)&&n("#"+this._id).find(".e-dialog:visible").length>0&&!t.isNullOrUndefined(n("#"+this._id).find(".e-dialog .e-text"))&&n(".e-dialog .e-text").hasClass("hoverCell"))n("#"+this._id).find(".e-dialog .hoverCell").removeClass("hoverCell"),i.preventDefault(),s=n("#"+this._id).find(".e-dialog .e-text:visible"),t.isNullOrUndefined(this._curFocus.filter)?(this._index.filter=i.which==40?1:i.which==38?s.length-1:0,this._curFocus.filter=s.eq(this._index.filter).attr("tabindex","-1")):(this._curFocus.filter.attr("tabindex","0").removeClass("hoverCell"),i.which===40?this._index.filter=this._index.filter+1>s.length-1?0:this._index.filter+1:i.which===38&&(this._index.filter=this._index.filter-1<0?s.length-1:this._index.filter-1),this._curFocus.filter=s.eq(this._index.filter).attr("tabindex","-1")),this._curFocus.filter.focus().addClass("hoverCell"),n(".e-node-focus").removeClass("e-node-focus");else if((i.which===40||i.which===38||i.which===37||i.which===39)&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("pivotButton")&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&!n("#"+this._id).find(".e-dialog:visible").length>0)i.preventDefault(),t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.mouseleave().attr("tabindex","0").removeClass("hoverCell"),s=n("#"+this._id).find(".pivotButton"),t.isNullOrUndefined(this._curFocus.grp)?i.which===40||i.which===39?this._curFocus.grp=s.eq(1).attr("tabindex","-1"):(i.which===38||i.which===37)&&(this._curFocus.grp=s.eq(s.length-1).attr("tabindex","-1")):(this._curFocus.grp.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40||i.which===39?this._index.grp=this._index.grp+1>s.length-1?0:this._index.grp+1:(i.which===38||i.which===37)&&(this._index.grp=this._index.grp-1<0?s.length-1:this._index.grp-1),this._curFocus.grp=s.eq(this._index.grp)),this._curFocus.grp.addClass("hoverCell").mouseover().focus();else if((i.which===40||i.which===38||i.which===37||i.which===39)&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&(document.activeElement.getAttribute("role")=="columnheader"||document.activeElement.getAttribute("role")=="rowheader"||document.activeElement.getAttribute("role")=="gridcell")){if(t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","0"),t.isNullOrUndefined(this._curFocus.cell)||(this._curFocus.cell.attr("tabindex","0").removeClass("hoverCell"),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&this._curFocus.cell.find("span").mouseleave()),this._index.menu=0,this._curFocus.cmenu=null,c=n(i.target),i.which=="40")for(f=c.attr("p"),u=parseInt(f.split(",")[1])+Number(c.attr("rowspan"));t.isNullOrUndefined(o)&&u<=this._rowCount;){if(r=n("#"+this._id).find("[p='"+f.split(",")[0]+","+u+"']")[0],t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+k+","+u+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);t.isNullOrUndefined(o)||(this._curFocus.cell=n(o));u++}else if(i.which=="38")for(var f=c.attr("p"),u=parseInt(f.split(",")[1])-1,o,h=parseInt(f.split(",")[0]);t.isNullOrUndefined(o)&&u>=0;){if(r=n("#"+this._id).find("[p='"+f.split(",")[0]+","+u+"']")[0],t.isNullOrUndefined(r)&&(c.attr("role")=="gridcell"||c.hasClass("summary")&&c.hasClass("calc")))for(k=parseInt(f.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+h+","+k+"']")[0]);if(t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+k+","+u+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);t.isNullOrUndefined(o)||n(o).hasClass("grpRow")||(this._curFocus.cell=n(o));u--;h--}else if(i.which=="39")for(f=c.attr("p"),u=parseInt(f.split(",")[0])+Number(c.attr("colspan"));t.isNullOrUndefined(o)&&u<=Math.ceil((Number(n("#"+this._id).find(".pivotGridTable td:last").attr("p").split(",")[0])+1)*(Number(n("#"+this._id).find(".pivotGridTable td:last").attr("p").split(",")[1])+1)/this._rowCount);){if(r=n("#"+this._id).find("[p='"+u+","+f.split(",")[1]+"']")[0],t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+u+","+k+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);t.isNullOrUndefined(o)||(this._curFocus.cell=n(o));u++}else if(i.which=="37"){for(var f=c.attr("p"),u=parseInt(f.split(",")[0])-1,o=n("#"+this._id).find("[p='"+(parseInt(f.split(",")[0])-1)+","+f.split(",")[1]+"']")[0],h=parseInt(f.split(",")[1]);t.isNullOrUndefined(o)&&u>=0;){if(r=n("#"+this._id).find("[p='"+u+","+f.split(",")[1]+"']")[0],t.isNullOrUndefined(r)&&c.attr("role")=="gridcell")for(k=parseInt(f.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+k+","+h+"']")[0]);if(t.isNullOrUndefined(r))for(k=parseInt(f.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(r)&&(r=n("#"+this._id).find("[p='"+u+","+k+"']")[0]);!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"||n(r).hasClass("value")||n(r).attr("role")=="gridcell")&&(o=r);u--;h--}t.isNullOrUndefined(o)||n(o).hasClass("grpRow")||(this._curFocus.cell=n(o))}t.isNullOrUndefined(this._curFocus.cell)||(n(".hoverCell").removeClass("hoverCell"),this._curFocus.cell.attr("tabindex","-1").focus().addClass("hoverCell"),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&(this._curFocus.cell.mouseover(),this._curFocus.cell.find("span").mouseover()))}else i.which==40&&n(".e-list").hasClass("hoverCell")&&n("#"+this._id).find(".hoverCell").removeClass("hoverCell");i.which===9&&n("#"+this._id).find(".colheader.hoverCell")&&(this._curFocus.cell=n("#"+this._id).find(".colheader.hoverCell"));(i.which===9&&i.shiftKey||i.which===9)&&n("#"+this._id).find("#"+this._id+"_clientDlg_wrapper :visible").length>0?(i.preventDefault(),s=n("#"+this._id+"_editCon_hidden").hasClass("e-disable")||n("#"+this._id+"_conTo").attr("disabled")=="disabled"?n("#"+this._id+"_conTo").attr("disabled")!="disabled"?n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_conFrom,#"+this._id+"_conTo,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"):n("#"+this._id+"_editCon_hidden").hasClass("e-disable")?n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"):n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_editCon_wrapper,#"+this._id+"_removeBtn,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"):n("#"+this._id).find("#"+this._id+"_conType_wrapper,#"+this._id+"_editCon_wrapper,#"+this._id+"_removeBtn,#"+this._id+"_conFrom,#"+this._id+"_conTo,#"+this._id+"_backcolor_wrapper,#"+this._id+"_borderrange_wrapper,#"+this._id+"_conFrom,#"+this._id+"_backcolor_wrapper,#"+this._id+"_bordercolor_wrapper,#"+this._id+"_borderstyle_wrapper,#"+this._id+"_fStyle_wrapper,#"+this._id+"_fSize_wrapper,#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,.e-dialog .e-close"),t.isNullOrUndefined(this._curFocus.cformat)?(this._index.cformat=1,this._curFocus.cformat=s.eq(this._index.cformat).attr("tabindex","-1")):(this._curFocus.cformat.attr("tabindex","0").removeClass("hoverCell"),i.which===9&&i.shiftKey?this._index.cformat=this._index.cformat-1<0?s.length-1:this._index.cformat-1:i.which===9&&(this._index.cformat=this._index.cformat+1>s.length-1?0:this._index.cformat+1),this._curFocus.cformat=s.eq(this._index.cformat).attr("tabindex","-1")),this._curFocus.cformat.focus().addClass("hoverCell")):(i.which===9&&i.shiftKey||i.which===9)&&n("#"+this._id).find(".dlgCalculatedField:visible").length>0?(i.preventDefault(),n("#"+this._id).find(".calcFormulaDiv:visible").length>0&&n("#"+this._id).find(".calcFormulaDiv").css("display","none"),e=[],e.push(n("#"+this._id).find("#"+this._id+"_calculateFieldName:visible")),e.push(n("#"+this._id).find("#"+this._id+"_calculateFieldList_dropdown:visible")),e.push(n("#"+this._id).find(".calculatorFields:visible")),e.push(n("#"+this._id).find(".editFormula:visible")),e.push(n("#"+this._id).find("#"+this._id+"_fieldCollection_container:visible")),n("#"+this._id).find("#"+this._id+"_btnInsert:visible:not([aria-disabled='true'])").length>0&&e.push(n("#"+this._id).find("#"+this._id+"_btnInsert:visible:not([aria-disabled='true'])")),e.push(n("#"+this._id).find("#"+this._id+"_btnAdd:visible")),e.push(n("#"+this._id).find("#"+this._id+"_btnDelete:visible")),e.push(n("#"+this._id).find("#"+this._id+"_btnOk:visible")),e.push(n("#"+this._id).find("#"+this._id+"_btnCancel:visible")),t.isNullOrUndefined(this._curFocus.field)?(this._index.field=e.length>5?6:0,this._curFocus.field=e[this._index.field].attr("tabindex","-1")):(this._curFocus.field.attr("tabindex","0").removeClass("hoverCell").blur(),i.which===9&&i.shiftKey?this._index.field=this._index.field-1<0?e.length-1:this._index.field-1:i.which===9&&(this._index.field=this._index.field+1>e.length-1?0:this._index.field+1),this._curFocus.field=e[this._index.field].attr("tabindex","-1")),this._curFocus.field.focus().addClass("hoverCell")):(i.which===9&&i.shiftKey||i.which===9)&&n("#"+this._id).find(".e-dialog:visible").length>0?(i.preventDefault(),n("#"+this._id).find(".e-dialog .hoverCell").removeClass("hoverCell"),this._curFocus.filter=null,this._index.filter=0,e=n("#"+this._id).find(".dialogOKBtn:visible:not([aria-disabled='true']),.dialogCancelBtn:visible,.e-close:visible,#GroupLabelDrop_wrapper:visible,.filterElementTag:visible,.e-dialog .e-text:visible:first,.filterValues:visible,#filterMeasures_wrapper:visible,#filterOptions_wrapper:visible,#filterValue1:visible,#filterValue2:visible,.searchEditorTreeView"),t.isNullOrUndefined(this._curFocus.tree)?(this._index.dialog=this.model.dataSource.enableAdvancedFilter?1:2,this._curFocus.tree=e.eq(this._index.dialog).attr("tabindex","-1").focus()):(this._curFocus.tree.attr("tabindex","0").removeClass("hoverCell"),i.which===9&&i.shiftKey?this._index.dialog=this._index.dialog-1<0?e.length-1:this._index.dialog-1:i.which===9&&(this._index.dialog=this._index.dialog+1>e.length-1?0:this._index.dialog+1),this._curFocus.tree=e.eq(this._index.dialog).attr("tabindex","-1").focus()),this._curFocus.tree.hasClass("filterElementTag")?this._curFocus.tree.find(".e-list:first:visible").addClass("hoverCell"):this._curFocus.tree.addClass("hoverCell")):(i.which===9&&i.shiftKey||i.which===9)&&!n(".e-dialog:visible").length>0&&t.isNullOrUndefined(this._pivotClientObj)&&(i.preventDefault(),n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._schemaData)||n("#"+this._schemaData._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)||this._curFocus.grp.mouseleave(),this._index.field=0,this._index.grp=1,this._index.cell=1,this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,t.isNullOrUndefined(this._schemaData)||t.isNullOrUndefined(this._schemaData._curFocus)||(this._schemaData._curFocus.tree=null,this._schemaData._curFocus.node=null,this._schemaData._curFocus.button=null),this._curFocus.field=null,this._curFocus.cell=null,this._curFocus.grp=null,this._curFocus.tree=null,this._curFocus.cmenu=null,this._curFocus.cformat=null,this._curFocus.selection=null,e=[],this.model.enableGroupingBar&&n("#"+this._id).find(".pivotButton:visible").first().length>0&&e.push(n("#"+this._id).find(".pivotButton:visible").first()),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&n("[role='columnheader']:visible:not([p='0,0'])").first().length>0?e.push(n("[role='columnheader']:visible:not([p='0,0'])").first()):n("#"+this._id).find("[role='columnheader']:visible").first().length>0&&e.push(n("[role='columnheader']:not('.grpRow'):visible:first")),!t.isNullOrUndefined(this._schemaData)&&n("#"+this._schemaData._id).find(".e-text:visible").first().length>0&&e.push(n("#"+this._schemaData._id).find(".e-text:visible").first()),!t.isNullOrUndefined(this._schemaData)&&n("#"+this._schemaData._id).find(".pvtBtn:visible").first().length>0&&e.push(n("#"+this._schemaData._id).find(".pvtBtn:visible").first()),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&n("#Pager_CategCurrentPage:visible").length>0&&e.push(n("#Pager_CategCurrentPage:visible")),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&n("#Pager_SeriesCurrentPage:visible").length>0&&e.push(n("#Pager_SeriesCurrentPage:visible")),t.isNullOrUndefined(this._curFocus.tab)?this._curFocus.tab=e[0].attr("tabindex","-1"):(this._curFocus.tab.attr("tabindex","0").removeClass("hoverCell"),this._curFocus.tab.hasClass("e-active")&&this._curFocus.tab.removeClass("e-active"),t.isNullOrUndefined(this._schemaData)||(n("#"+this._schemaData._id).find(".e-active").removeClass("e-active"),n("#"+this._schemaData._id).find(".e-node-hover").removeClass("e-node-hover"),n("#"+this._schemaData._id).find(".e-node-focus").removeClass("e-node-focus")),this._curFocus.tab.hasClass("e-node-hover")&&this._curFocus.tab.removeClass("e-node-hover"),this._curFocus.tab.mouseleave(),i.which===9&&i.shiftKey?this._index.index=this._index.index-1<0?e.length-1:this._index.index-1:i.which===9&&(this._index.index=this._index.index+1>e.length-1?0:this._index.index+1),this._curFocus.tab=e[this._index.index].attr("tabindex","-1")),this._curFocus.tab.focus().addClass("hoverCell").mouseover(),this.model.hyperlinkSettings.enableColumnHeaderHyperlink&&(this._curFocus.tab.mouseover(),this._curFocus.tab.find("span").mouseover()),n(".e-node-focus").removeClass("e-node-focus"),i.stopImmediatePropagation());i.which===93&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&this.model.enableGroupingBar&&(!t.isNullOrUndefined(this._curFocus.grp)||!t.isNullOrUndefined(this._curFocus.tab))&&(i.preventDefault(),document.activeElement.className.startsWith("pivotButton")&&(t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(v={x:n(this._curFocus.tab).offset().left+n(this._curFocus.tab).outerWidth(),y:n(this._curFocus.tab).offset().top+n(this._curFocus.tab).outerHeight()},this._curFocus.tab.find("button").trigger({type:"mouseup",which:3,clientX:v.x,clientY:v.y,pageX:v.x,pageY:v.y})):(v={x:n(this._curFocus.grp).offset().left+n(this._curFocus.grp).outerWidth(),y:n(this._curFocus.grp).offset().top+n(this._curFocus.grp).outerHeight()},this._curFocus.grp.find("button").trigger({type:"mouseup",which:3,clientX:v.x,clientY:v.y,pageX:v.x,pageY:v.y}))));i.which===13&&this.model.hyperlinkSettings.enableColumnHeaderHyperlink?t.isNullOrUndefined(this._curFocus.cell)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.find(".cellValue").click():this._curFocus.cell.find(".cellValue").click():i.which==13&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&!n(".e-waitpopup-pane:visible").length>0&&(n("#"+this._id).find(".e-dialog .hoverCell").length>0&&n("#"+this._id).find(".e-dialog .hoverCell").hasClass("e-text")?n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click():document.activeElement.className.startsWith("pivotGridTable")||document.activeElement.getAttribute("role")=="rowheader"||document.activeElement.getAttribute("role")=="columnheader"?t.isNullOrUndefined(this._curFocus.cell)?t.isNullOrUndefined(this._curFocus.tab)||(this._curFocus.tab.find(".expand").length>0?this._curFocus.tab.find(".expand").click():this._curFocus.tab.find(".collapse").length>0&&this._curFocus.tab.find(".collapse").click(),this._curFocus.tab=n("#"+this._id).find("[role='"+this._curFocus.tab.attr("role")+"']:contains('"+this._curFocus.tab.text()+"'):visible").first(),this._curFocus.tab.attr("tabindex","-1").focus().addClass("hoverCell")):this._curFocus.cell.find(".expand,.collapse").length>0?(this._curFocus.cell.find(".expand,.collapse").click(),this._curFocus.cell.removeClass("hoverCell").attr("tabindex","0"),this._curFocus.cell=n("#"+this._id).find("[role='"+this._curFocus.cell.attr("role")+"']:contains('"+this._curFocus.cell.text()+"'):visible").first(),this._curFocus.cell.attr("tabindex","-1").focus().addClass("hoverCell")):(this._curFocus.cell.click(),this._curFocus.cell.removeClass("hoverCell").attr("tabindex","0"),this._curFocus.cell=n("#"+this._id).find("[p='"+this._curFocus.cell.attr("p")+"']"),this._curFocus.cell.attr("tabindex","-1").focus().addClass("hoverCell")):t.isNullOrUndefined(this._curFocus.tree)&&t.isNullOrUndefined(this._curFocus.formula)&&(t.isNullOrUndefined(this._curFocus.field)||!this._curFocus.field.hasClass("editFormula"))||n("#"+this._id).find(".e-dialog .hoverCell:visible").length>0&&(n("#"+this._id).find(".e-dialog .hoverCell:visible").click(),this._index.tree=1),n(".e-pivotpager[targetcontrolid='"+this._id+"']:visible").length>0&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.attr("tabindex","-1").focus());i.keyCode==79&&n("#"+this._id).find(".e-dialog").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogOKBtn:visible").click(),this._index.field=0,this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,this._curFocus.tree=null,t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.mouseleave().removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),t.isNullOrUndefined(a)||a.mouseover().addClass("hoverCell").focus());i.keyCode==67&&n("#"+this._id).find(".e-dialog:visible").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogCancelBtn:visible").click(),this._index.field=0,this._index.filter=0,this._index.dialog=this.model.dataSource.enableAdvancedFilter?0:1,this._curFocus.tree=null,t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.mouseleave().removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.grp)?t.isNullOrUndefined(this._curFocus.tab)||(l=this._curFocus.tab.attr("tag"),a=this._curFocus.tab=n("#"+this._id).find("[tag='"+l+"']")):(l=this._curFocus.grp.attr("tag"),a=this._curFocus.grp=n("#"+this._id).find("[tag='"+l+"']")),t.isNullOrUndefined(a)||a.mouseover().addClass("hoverCell").focus())},_unWireEvents:function(){this._off(this.element,"click",".colheader,.cstot,.cgtot,.calc,.stot,.gtot");this._off(n(document),"keydown",this._keyDownPress);this._off(n(document),"keyup",this._keyUpPress);this._off(this.element,"click","#preventDiv");this._off(this.element,"click",".expand, .collapse");this._off(this.element,"dblclick",".value, .summary");this._off(this.element,"mouseover",".colheader, .rowheader, .expand, .collapse");this._off(this.element,"mouseleave",".colheader, .rowheader, .expand, .collapse");this._off(this.element,"mouseover",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value, .rowheader, .colheader, .summary",this.addHyperlinkHandler);this._off(this.element,"mouseleave",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value, .rowheader, .colheader, .summary",this.removeHyperlinkHandler);this._off(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value, .rowheader, .colheader":".value, .rowheader, .colheader, .summary");this._off(this.element,"click",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?".value .cellValue, .rowheader .cellValue, .colheader .cellValue":".value .cellValue, .rowheader .cellValue, .colheader .cellValue, .summary .cellValue");this._off(this.element,"mouseover",".value");this._off(this.element,"mouseleave",".value");this._off(this.element,"mousedown touchstart",".value");this._off(this.element,"mouseup touchend",".value");this._off(this.element,"click",".filter");this._off(this.element,"click",".sorting");this._off(this.element,"click",".removeBtn");this._off(this.element,"mouseover",".pvtBtn");this._off(this.element,"mouseleave",".pvtBtn");n(document).off("keyup",this._endCellSelection);n(document).off("keydown",this._startCellSelection);n(document).off("click",this._clearSelection);this._off(this.element,"click",".calculatedFieldPopup .menuItem ");this._off(this.element,"contextmenu",".values .pivotButton");this._off(this.element,"click",".filter",t.proxy(this._filterBtnClick,this));this._off(this.element,"click",".sorting",t.proxy(this._sortBtnClick,this));this._off(this.element,"click",".removeBtn",t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._removePvtBtn:this._clientRemovePvtBtn,this));this._off(this.element,"click",".ascOrder, .descOrder");this._off(this.element,"click",".clearAllFilters, .clearSorting");this._off(this.element,"contextmenu");this._off(this.element,"click",".dialogOkBtn");this._off(this.element,"click",".cellSelect");this._off(this.element,"click",".columnResize");this._off(this.element,"click",".excelLikeLayout");this._off(this.element,"click",".advancedFiltering");this._off(this.element,"click",".toolTip");this._off(this.element,"click",".collapseByDefault");this._off(this.element,"click",".rtl");this._off(this.element,"click",".calculatedField");this._off(this.element,"click",".cellEditing");this._off(this.element,"click",".groupingBar");this._off(this.element,"click",".conditionalFormat");this._off(this.element,"click",".summaryCustomize");this._off(this.element,"click",".summaryTypes");this._off(this.element,"click",".numberFormatting");this._off(this.element,"click",".rowHeaderHyperLink");this._off(this.element,"click",".colHeaderHyperLink");this._off(this.element,"click",".valueCellHyperLink");this._off(this.element,"click",".summaryCellHyperLink");this._off(this.element,"click",".rowFreeze");this._off(this.element,"click",".colFreeze");this._off(this.element,"click",".bothFreeze");this._off(this.element,"click",".excel");this._off(this.element,"click",".word");this._off(this.element,"click",".pdf");this._off(this.element,"click",".csv");this._off(this.element,"click",".frozenHeaders");this._off(this.element,"click",".exporting");this._off(this.element,"click",".layouts");this._off(this.element,"click",".hyperlinkOptions");this._off(this.element,"click",".normalLayout");this._off(this.element,"click",".normalTopSummaryLayout");this._off(this.element,"click",".noSummariesLayout");this._off(this.element,"click",".drillThrough");this._off(this.element,"mousedown touchstart",".value",this._initCellSelection);this._off(this.element,"click",".colheader,.rowheader",this._headerClickCellSelection)},_getFieldName:function(i){var r;if(n(i).hasClass("colheader")||n(i).attr("role")=="columnheader"){var u=parseInt(n(i).attr("p").split(",")[1]),f=t.isNullOrUndefined(this.model.dataSource.data)||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()).PivotColumns:JSON.parse(this.getOlapReport()).PivotColumns:this.model.dataSource.columns,e=i.textContent.replace("expanded","");return u<f.length?this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?f[u].fieldName:f[u].FieldName:e}if(n(i).hasClass("rowheader")||n(i).attr("role")=="rowheader")return r=parseInt(n(i).attr("p").split(",")[0]),t.isNullOrUndefined(this.model.dataSource.data)||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.element.parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this._pivotClientObj.getOlapReport()).PivotRows[r].FieldName:JSON.parse(this.getOlapReport()).PivotRows[r].FieldName:t.isNullOrUndefined(this.model.dataSource.rows)?this.model.dataSource.rows[r].fieldName:""},_colResizing:function(t){var r,i,f,u;if(this.model.enableColumnResizing)if(this._expand)x=t.clientX,y=t.clientY,_hedBound=this.element.find("thead,.pivotGridFrozenTable,.pivotGridColValueTable").first()[0].getBoundingClientRect(),_hedBound.left+document.documentElement.scrollLeft+_hedBound.width<x||x<_hedBound.left+document.documentElement.scrollLeft?this.element.find(".e-reSizeColbg").remove():this._currentCell!=-1&&this.element.find(".e-reSizeColbg").css({left:x,top:this._tableY});else{if(this.element.find(".e-reSizeColbg").is(":visible"))return;n(t.target).attr("role")=="columnheader"?(r=this.resCell=t.target,i=r.getBoundingClientRect(),x=t.clientX,y=t.clientY,f=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(".pivotGridFrozenTable,.pivotGridColValueTable").width()+n(".pivotGridFrozenTable,.pivotGridColValueTable").find("tr").offset().left:n(this.element).find("thead").width()+n(this.element).find("thead tr").offset().left,(x>=i.left+document.documentElement.scrollLeft+r.offsetWidth-5||x<=i.left+3)&&x<f&&x>=i.left&&y<=i.top+document.documentElement.scrollTop+t.target.offsetHeight?(x>i.left+3?(u=n(t.target).find("span"),this._currentCell=t.target):(u=n(t.target).prevAll("th:visible:first").find("span"),this._currentCell=n(t.target).prev()),u.length&&n(t.target).parents(".pivotGridTable tr").css("cursor","col-resize")):(n(t.target).parent("tr").css("cursor","pointer"),this._currentCell=null)):(this.element.find("thead,.pivotGridFrozenTable,.pivotGridColValueTable tr").css("cursor","pointer"),this._currentCell=null)}},_startColResizing:function(t){var o,u;if(n(t.target).closest("tr").css("cursor")=="col-resize"&&(x=t.clientX,y=t.clientY,this._target=t.target,this._orgX=x,x+=document.documentElement.scrollLeft,t.button!=2))if(o=n(this._target).parent("tr").find("[role='columnheader']"),this._currentCell!=null&&(u=n(this._currentCell)[0].getBoundingClientRect()),_top=this._tableY=(u==r?0:u.top)+document.documentElement.scrollTop,n(this._target).closest("tr").css("cursor")=="col-resize"){var e=n(document.createElement("div")),f=this.model.enableGroupingBar?this.element.height()-this.element.find(".groupingBarPivot").height():this.element.height(),s=this.element.find("thead,.pivotGridFrozenTable,.pivotGridColValueTable").find("tr[role='row']"),h=n(this._target).parent("tr")[0]==r?0:n(this._target).parent("tr")[0].rowIndex;for(i=0;i<h;i++)f=f-n(s[i]).height();e.addClass("e-reSizeColbg").appendTo(this.element).attr("unselectable","on").css("visibility","hidden");e.css({visibility:"visible",height:f+"px",cursor:"col-resize",left:x,top:_top,position:"fixed"});this._orgX=x;this._orgY=y;this._expand=!0}else this._currentCell=null},_endColResizing:function(i){var h,c,f,e,l,a,o,s,v,p,w;if(this._expand&&(x=i.clientX,y=i.clientY),this.element.find(".e-reSizeColbg").remove(),x+=document.documentElement.scrollLeft,h=n(this._target).parents("thead,.pivotGridFrozenTable,.pivotGridColValueTable"),this._currentCell!=null&&this._expand){c=30;this._expand=!1;var r=this._currentCell,b=n(r)[0].offsetWidth,u=x-this._orgX;parseInt(u)+parseInt(b)>c&&u!=0&&(h.css("cursor","default"),f=parseInt(n(this._currentCell).attr("colspan")),e=(this.model.frozenHeaderSettings.enableFrozenHeaders||!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._JSONRecords[0].CSS=="none"?parseInt(n(r).attr("p").split(",")[0])-this._JSONRecords[0].ColSpan:this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?parseInt(n(r).attr("i").split(",")[0]):parseInt(n(r).attr("p").split(",")[0]),l=Math.round(u/f),a=this.element.find("col:eq("+e+")").width()+l,this._setWidthColResize(e,f,a),n(r).next().length&&(s=parseInt(n(r).next().attr("colspan")),o=(this.model.frozenHeaderSettings.enableFrozenHeaders||!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._JSONRecords[0].CSS=="none"?parseInt(n(r).next().attr("p").split(",")[0])-this._JSONRecords[0].ColSpan:this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?parseInt(n(r).next().attr("i").split(",")[0]):parseInt(n(r).next().attr("p").split(",")[0]),v=Math.round(u/s),p=this.element.find("col:eq("+o+")").width()-v,this._setWidthColResize(o,s,p),this.element.find("tr").css("cursor","default")))}this.model.enableGroupingBar&&this._createFields(null,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth());(this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&this._refreshScroller();!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders&&(w=this.element.find(".e-scroller").data("ejScroller"),w.model.enableTouchScroll=!1);this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.element.find("#coltable").width()<this.element.find(".valScrollArea").width()&&this.element.find("#coltable").width(this.element.find(".valScrollArea").width());this._target=null;this.element.find(".e-reSizeColbg").remove();this._expand=!1;this._currentCell=null},_setWidthColResize:function(n,t,i){for(var u=30,f=i>u?i:u,r=n;r<n+t;r++)this.element.find("colgroup").find("col:eq("+r+")").outerWidth(f)},_direction:function(n){return this.model.enableRTL&&n.indexOf("-")>-1?n.split("-").reverse().join("-"):n},_clearSelection:function(t){n(t.target).parents(".pivotGridTable").length==0&&n(this.element).find(".selected").removeClass("selected")},_startCellSelection:function(i){var f,e,u,o,r;if(this._onholdKey!="Control"&&!t.isNullOrUndefined(this._selectedCell))if(i.preventDefault(),this._onholdKey==""&&(this._onholdKey=i.which.toString()=="16"?"Shift":i.which.toString()=="17"?"Control":""),i.which=="40"){for(f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[1])+this._selectedCell.rowSpan;t.isNullOrUndefined(u)&&e<this._rowCount;)r=n(this.element).find("[p='"+f.split(",")[0]+","+e+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e++;t.isNullOrUndefined(u)||this._selectCells("Down",u)}else if(i.which=="38"){for(f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[1])-1;t.isNullOrUndefined(u)&&e>=0;)r=n(this.element).find("[p='"+f.split(",")[0]+","+e+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e--;if(t.isNullOrUndefined(u)&&this._onholdKey!="Shift"&&(n(this._selectedCell).hasClass("colheader")||n(this._selectedCell).attr("role")=="columnheader"))for(column=parseInt(f.split(",")[0])-1;column>0&&t.isNullOrUndefined(u);column--)for(row=parseInt(f.split(",")[1]-1);row>=0&&t.isNullOrUndefined(u);row--)r=n(this.element).find("[p='"+column+","+row+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r);t.isNullOrUndefined(u)||this._selectCells("Up",u)}else if(i.which=="39"){for(f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[0])+this._selectedCell.colSpan;t.isNullOrUndefined(u)&&e<Math.ceil(this.getJSONRecords().length/this._rowCount);)r=n(this.element).find("[p='"+e+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e++;t.isNullOrUndefined(u)||this._selectCells("Right",u)}else if(i.which=="37"){for(var f=n(this._selectedCell).attr("p"),e=parseInt(f.split(",")[0])-1,u=n(this.element).find("[p='"+(parseInt(f.split(",")[0])-1)+","+f.split(",")[1]+"']")[0];t.isNullOrUndefined(u)&&e>=0;)r=n(this.element).find("[p='"+e+","+f.split(",")[1]+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader"||n(r).hasClass("colheader")||n(r).attr("role")=="columnheader")&&(u=r),e--;if(t.isNullOrUndefined(u)&&this._onholdKey!="Shift"&&(n(this._selectedCell).hasClass("rowheader")||n(this._selectedCell).attr("role")=="rowheader"))for(o=parseInt(f.split(",")[1])-1;t.isNullOrUndefined(u)&&o>0;)r=n(this.element).find("[p='"+parseInt(f.split(",")[0]-1)+","+o+"']")[0],!t.isNullOrUndefined(r)&&n(r).css("display")!="none"&&n(n(r).parents("tr")[0]).css("display")!="none"&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader")&&(u=r),o--;t.isNullOrUndefined(u)||this._selectCells("Left",u)}},_endCellSelection:function(i){var r,e,u,o,f;if(!t.isNullOrUndefined(this._selectedCell)&&(i.preventDefault(),(i.which==16||i.which==17)&&(this._onholdKey="",r=n(this.element).find(".selected"),r.length>0))){for(e=[],u=0;u<r.length;u++)o=n(r[u]).attr("p"),f=this.getJSONRecords()[parseInt(parseInt(o.split(",")[0])*this._rowCount+parseInt(o.split(",")[1]))],f.Value=n(r[u]).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f.Field=this._getFieldName(r[u])),e.push(f);this._trigger("cellSelection",{JSONRecords:e})}},_selectCells:function(i,r){var e,u,s,f,h,o,c;if(this._onholdKey=="Shift")((i=="Up"||i=="Down")&&(n(r).hasClass("rowheader")||n(r).attr("role")=="rowheader")||(i=="Right"||i=="Left")&&(n(r).hasClass("colheader")||n(r).attr("role")=="columnheader"))&&(e=i=="Up"||i=="Down"?1:0,(i=="Up"||i=="Left")&&parseInt(n(r).attr("p").split(",")[e])>=parseInt(this._primaryCellPos.split(",")[e])||(i=="Right"||i=="Down")&&parseInt(n(r).attr("p").split(",")[e])<=parseInt(this._primaryCellPos.split(",")[e])?n(this._selectedCell).removeClass("selected"):n(r).attr("p")!="0,0"&&n(r).addClass("selected"));else if(n(r).attr("p")!="0,0"&&(this.element.find(".selected").removeClass("selected"),n(r).addClass("selected"),this._primaryCellPos=n(r).attr("p"),u=n(this.element).find(".selected"),u.length>0)){for(s=[],f=0;f<u.length;f++)h=n(u[f]).attr("p"),o=this.getJSONRecords()[parseInt(parseInt(h.split(",")[0])*this._rowCount+parseInt(h.split(",")[1]))],o.Value=n(u[f]).text().trim(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(o.Field=this._getFieldName(u[f])),s.push(o);this._trigger("cellSelection",{JSONRecords:s})}c=i=="Up"||i=="Down"?!n(this._selectedCell).hasClass("colheader")&&n(this._selectedCell).attr("role")!="columnheader":!n(this._selectedCell).hasClass("rowheader")&&n(this._selectedCell).attr("role")!="rowheader";n(r).attr("p")!="0,0"&&(this._onholdKey!="Shift"||c)&&(this._selectedCell=r)},_sortBtnClick:function(i){var s,h,f,r,u,o,e,c;if(t.PivotAnalysis._valueSorting=null,t.isNullOrUndefined(this.model.valueSortSettings)||(this.model.valueSortSettings.headerText=null),this._isUpdateRequired=!0,n(i.delegateTarget).attr("id")==this._id&&(n(i.target).toggleClass("descending"),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".pivotButton[tag='"+n(i.target).parent().attr("tag")+"']").find(".sorting").toggleClass("descending")),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)s=n(i.target).siblings(".pvtBtn").attr("fieldName"),h=t.Pivot.getReportItemByFieldName(s,this.model.dataSource).item,h.sortOrder=i.target.className.indexOf("descending")>=0?t.PivotAnalysis.SortOrder.Descending:t.PivotAnalysis.SortOrder.Ascending,this.refreshControl();else{for(f=this._ascdes.split("##"),r=0,u=0;u<f.length;u++)f[u]==n(n(i.target).siblings(".pvtBtn")).text()&&(r=1);classNames=i.target.className;isDescending=new RegExp("descending");isDescending.test(classNames)?r==0&&(this._ascdes+=n(n(i.target).siblings(".pvtBtn")).text()+"##"):r==1&&(this._ascdes=this._ascdes.replace(n(n(i.target).siblings(".pvtBtn")).text()+"##",""));e=JSON.stringify(this.model.customObject);try{o=JSON.parse(this.getOlapReport()).Report}catch(l){o=this.getOlapReport()}this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});e=JSON.stringify(this.model.customObject);c=JSON.stringify({action:"sorting",sortedHeaders:this._ascdes,currentReport:o,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:e});this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.model.enableDeferUpdate?this._waitingPopup.hide():this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.sorting,c,this._sortingSuccess)}},calculateCellWidths:function(){var f={rowHeight:0,columnWidths:[]},r,i,u,t;if(r=this._excelLikeJSONRecords!=null?this._excelLikeJSONRecords.length/this._excelRowCount:this.getJSONRecords()!=null?this.getJSONRecords().length/this._rowCount:0,i=1,u=!1,r>0)for(f.rowHeight=this.element.find("tbody tr:visible").length>0?this.element.find("tbody tr:visible").outerHeight():0,t=0;t<r&&i<=r;t++)n(this._excelLikeJSONRecords!=null?this.element.find("th[i^="+t+"]:visible"):this.element.find("th[p^="+t+"]:visible")).each(function(){if(n(this).length>0&&n(this).attr("colspan")==i&&(n(this).attr("i")!=null?n(this).attr("i").split(",")[0]==t:n(this).attr("p").split(",")[0]==t))return f.columnWidths.push(n(this).outerWidth()),t+=i-1,i=1,u=!0,!1;u=!1}),u||i==r?i=1:(t--,i++);return f},_deferUpdate:function(){var i,r,n,u,f;if(!this._isUpdateRequired)return!1;this._isUpdateRequired=!1;try{i=JSON.parse(this.getOlapReport()).Report}catch(e){i=this.getOlapReport()}for(r="",n=0;n<this._filterUpdate.length;n++)r+=this._filterUpdate[n]+"%%";u=JSON.stringify(this.model.customObject);f=JSON.stringify({action:"deferUpdate",sortedHeaders:this._ascdes,filterParams:r,currentReport:i,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:u});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.deferUpdate,f,this._renderControlSuccess);this._filterUpdate=[];this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()},_dialogBtnClick:function(i){var l,b,h,k,e,ut,d,g,o,y,u,ft,p,tt,it,et,c,rt;if(this.element.find(".e-dialog, .clientDialog").hide(),i.model.text.toLowerCase()=="cancel"||!this._isMembersFiltered)return t.Pivot.closePreventPanel(this),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style"),!1;if(this._isUpdateRequired=!0,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)l=[],b=[],this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueSorting=null,jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:checked"),function(n,t){t.value!="All"&&l.push(t.value)}),jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:not(:checked)"),function(n,t){b.push(t.value=t.value=="(blank)"?"":t.value)}),this._pivotFilterItems(l,b),e=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,e&&(e.advancedFilter=[]),this.model.editCellsInfo={},this._populatePivotGrid()):(this._waitingPopup.show(),h=this._selectedField.toLocaleLowerCase(),this._currentReportItems=n.grep(this._currentReportItems,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()!=h)return n}),this._memberTreeObj=t.Pivot.updateTreeView(this),k=t.Pivot.getNodesState(this._memberTreeObj),this._schemaData!=null&&(this._schemaData._memberTreeObj=this._memberTreeObj),this._currentReportItems.push({filterItems:this._memberTreeObj.dataSource(),fieldName:this._selectedField}),l=n.map(k.selectedNodes.split("::"),function(n){return{Id:n.split("||")[0],tag:n.split("||")[1],parentId:n.split("||")[2]}}),this.model.enableGroupingBar&&(o=t.Pivot._getEditorMember(h,this,!1),this._fieldSelectedMembers[h]=n.map(this._fieldMembers[h],function(n){if(!n.checked)return n}).length==0?"All":o!="All"&&o!="multiple"?o:this._getLocalizedLabels("MultipleItems")),e=t.Pivot.getReportItemByFieldName(h,this.model.dataSource).item,t.isNullOrUndefined(e)||(k.unSelectedNodes!=""?(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"filtering"},this),e.advancedFilter=[],e.filterItems={filterType:"include",values:this._removeSelectedNodes(l)},this.element.find(".pivotButton:contains('"+this._selectedField+"') .filter").addClass("filtered"),this._schemaData!=null&&this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedField+"'] .filter").length==0&&(this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedField+"'] div:first .e-text").after(t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").addClass("filtered"))):(delete e.filterItems,this._schemaData!=null&&(this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedField+"'] .filter").remove(),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").removeClass("filtered")))),this.getJSONData({action:"filtering"},this.model.dataSource,this));else{ut="";d="";d=this.element.find(".editorTreeView :input.nodecheckbox");var a=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?ut=this._getUnSelectedNodes()+"FILTERED"+this._getSelectedNodes(this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._curFilteredAxis=="Slicers"?!0:!1:this._curFilteredAxis=="Filter"?!0:!1):this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),w=!1,s=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?a:this._curFilteredAxis+"::"+this._curFilteredText+"::FILTERED",f=this._curFilteredText,nt=[],v={};if(g=this._getUnSelectedNodes()!=""?!0:!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){for(this.model.enableGroupingBar&&t.isNullOrUndefined(this._fieldMembers[f])&&(this._fieldMembers[f]=t.Pivot._getEditorMember(d,this,!1)),this._removeFilterTag(this._curFilteredText),u=0;u<a.length;u++)nt.push(n(a[u].parentElement).siblings("a").text());for(v[f]=nt,t.isNullOrUndefined(this._tempFilterData)&&(this._tempFilterData=[]),u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][f])||(this._tempFilterData[u][f]=nt,w=!0);if(w||this._tempFilterData.push(v),this._schemaData!=null&&(this._schemaData._tempFilterData=this._tempFilterData),t.isNullOrUndefined(this._curFilteredAxis)||this._curFilteredAxis!="")for(u=0;u<a.length;u++)s+="##"+n(a[u].parentElement).siblings("a").text()}else{for(this.model.enableGroupingBar&&(o=t.Pivot._getEditorMember(f.split(":")[1],this,!1),this._fieldSelectedMembers[f.split(":")[1]]=n.map(this._fieldMembers[f.split(":")[1]],function(n){if(!n.checked)return n}).length==0?"All":o!="All"&&o!="multiple"?o:this._getLocalizedLabels("MultipleItems")),v[this._curFilteredText.split(":")[1]]=s,t.isNullOrUndefined(this._tempFilterData)&&(this._tempFilterData=[]),u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][this._curFilteredText.split(":")[1]])||(this._tempFilterData[u]=v,w=!0);w||this._tempFilterData.push(v)}if(filteredBtn=this.model.layout=="excel"?this.element.find(".schemaFieldTree li:contains('"+this._curFilteredText+"')"):this.element.find("."+this._curFilteredAxis+" .pivotButton:contains("+this._curFilteredText+") .filterBtn"),y=this._curFilteredText,this.model.layout==t.PivotGrid.Layout.Normal&&this._schemaData!=null){for(u=0;u<this._schemaData.element.find(".fieldTable").find("li").length;u++)this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._curFilteredText.split(":")[1]==n(this._schemaData.element.find(".fieldTable").find("li")[u]).attr("tag").replace(/\]/g,"").replace(/\[/g,"")&&(this._schemaData._selectedTreeNode=this._schemaData.element.find(".fieldTable").find("li")[u],y=this._curFilteredText.split(":")[1].split(".")[1]):this._curFilteredText==this._schemaData.element.find(".fieldTable").find("li")[u].id&&(this._schemaData._selectedTreeNode=this._schemaData.element.find(".fieldTable").find("li")[u],y=this._curFilteredText);if(n(this._schemaData._selectedTreeNode).parents("li:eq(0)").children().children("span").hasClass("hierarchyCDB")&&(this._schemaData._selectedTreeNode=n(n(this._schemaData._selectedTreeNode).parents("li:eq(0)"))),g&&n(this._schemaData._selectedTreeNode).find(".filter").length<=0?(ft=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,n(n(this._schemaData._selectedTreeNode).find(".e-text")[0]).after(ft),this._schemaData.element.find(".pvtBtn:contains('"+y+"')").parent().find(".filter").addClass("filtered")):g||(n(this._schemaData._selectedTreeNode).find(".filter").remove(),this._schemaData.element.find(".pvtBtn:contains('"+y+"')").parent().find(".filter").removeClass("filtered")),this._curFilteredAxis=="")return!1}try{p=JSON.parse(this.getOlapReport()).Report}catch(ot){p=this.getOlapReport()}if(this.model.enableAdvancedFilter&&this._selectedLevelUniqueName&&this._selectedLevelUniqueName.split("].").length==3&&(tt=this._getAdvancedFilterInfo(this._selectedLevelUniqueName.split("].").slice(0,2).join(".").replace(/\[/g,"")),tt.length>0&&this._removeFilterTag(tt[0].levelUniqueName)),this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject}),it=JSON.stringify(this.model.customObject),et=this.model.customObject!={}&&s!=""?JSON.stringify({action:"filtering",filterParams:s,sortedHeaders:this._ascdes,currentReport:p,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:it,gridLayout:this.model.layout}):this.model.customObject!={}?JSON.stringify({action:"filtering",currentReport:p,customObject:it,gridLayout:this.model.layout}):s!=""?JSON.stringify({action:"filtering",filterParams:s,sortedHeaders:this._ascdes,currentReport:p,gridLayout:this.model.layout}):JSON.stringify({action:"filtering"}),this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").addClass("freeze").width(n(this._schemaData.element).width()).height(n(this._schemaData.element).height()).css({top:n(this._schemaData.element).offset().top,left:n(this._schemaData.element).offset().left}),this.model.enableDeferUpdate){if(this._filterUpdate.push(s),n.each(this.element.find(".pivotButton .filter"),function(t,i){n(i).removeClass("filtered")}),!t.isNullOrUndefined(this._tempFilterData))for(c=0;c<this._tempFilterData.length;c++)for(rt in this._tempFilterData[c])this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?rt==f.split(":")[1]&&this._tempFilterData[c][f.split(":")[1]].split("FILTERED::")[0].length>0&&this.element.find(".pivotButton[tag='"+f+"']").find("span.filter").addClass("filtered"):rt==f&&this._tempFilterData[c][f].length>0&&this.element.find("#pivotButton"+f).next().addClass("filtered");t.Pivot.closePreventPanel(this);t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")}else this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,et,this._filterElementSuccess)}t.isNullOrUndefined(this._schemaData)||this._schemaData._refreshPivotButtons()},_removeSelectedNodes:function(t){for(var i,u=n.extend([],t),f=0;f<t.length;f++)for(i=0;i<u.length;i++)u[i].Id==t[f].parentId&&u.splice(i,1);return n.map(u,function(n){if(n.tag!=""&&n.tag!=r)return n.tag.replace(/\&/g,"&")})},_pivotFilterItems:function(i,r){var s=this.model.dataSource[this._selectedAxis=="Slicers"?"filters":this._selectedAxis.toLowerCase()],f=t.PivotAnalysis.getMembers(this._selectedField),u,o;jQuery.each(f,function(n,t){t!=null&&t.toString().replace(/^\s+|\s+$/gm,"")||jQuery.each(r,function(n,i){i.toString().replace(/^\s+|\s+$/gm,"")||(r[n]=t)})});var h=this._selectedField,c=this._dialogTitle,e=n.grep(s,function(n){return n.fieldName==h});for(u=0;u<e.length;u++)e[u].filterItems=i.length==f.length?null:{filterType:t.PivotAnalysis.FilterType.Exclude,values:r};this._schemaData!=null&&(r.length>0&&this._schemaData.element.find(".schemaFieldTree li[id='"+this._selectedField+"']").find(".filter").length<=0?(o=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,this._schemaData.element.find(".schemaFieldTree li[id='"+this._selectedField+"']").find(".e-text").after(o),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").addClass("filtered")):r.length==0&&(this._schemaData.element.find(".schemaFieldTree li[id='"+this._selectedField+"']").find(".filter").remove(),this._schemaData.element.find(".pvtBtn[fieldname='"+this._selectedField+"']").parent().find(".filter").removeClass("filtered")))},_getUnSelectedNodes:function(){var e=this.element.find(".editorTreeView")[0],f="",r=n(e).find(":input.nodecheckbox:not(:checked)"),i,u;if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)for(i=0;i<r.length;i++)n(r[i].parentElement).find("span:nth-child(1)").attr("class").indexOf("e-chk-act")>-1||n(r[i].parentElement).attr("aria-checked")=="mixed"||(u=n(r[i]).parents("li:eq(0)"),f+="::"+u[0].id+"||"+n(u).attr("tag"));return f},_getSelectedNodes:function(i){var o,e,f,h,c,s,u,r;if(i){for(this.element.find(".editorTreeView").length>0?o=this.element.find(".editorTreeView")[0].childNodes[0]:t.isNullOrUndefined(this._schemaData)||(o=this._memberTreeObj.element[0].childNodes[0]),e=[],f=n(o).children(),u=0;u<f.length;u++){if(r=f[u],h={caption:n(r.firstChild).find("a").text(),parentId:r.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(r).parents()[1].id,id:r.id,checked:n(r).find(":input.nodecheckbox")[0].checked||n(r).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(r.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(r).attr("tag")},n(r).find("ul:first").children().length>0)for(c=n(r).find("ul:first").children(),s=0;s<c.length;s++)h.childNodes.push(this._getNodeInfo(c[s]));e.push(h)}return JSON.stringify(e)}var o=this.element.find(".editorTreeView")[0],e="",f=n(o).find(":input.nodecheckbox");for(u=0;u<f.length;u++)(f[u].checked||n(f[u].parentElement).attr("aria-checked")=="mixed")&&(r=n(f[u]).parents("li:eq(0)"),e+="::"+r[0].id+"||"+n(r).attr("tag"));return e},_getNodeInfo:function(t){var u={caption:n(t.firstChild).find("a").text(),parentId:t.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(t).parents()[1].id,id:t.id,checked:n(t).find(":input.nodecheckbox")[0].checked||n(t).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(t.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(t).attr("tag")},r,i;if(n(t).find("ul:first").children().length>0)for(r=n(t).find("ul:first").children(),i=0;i<r.length;i++)u.childNodes.push(this._getNodeInfo(r[i]));return u},_getLevelInfo:function(t,i){var r=n.map(n(i).find("row"),function(i){if(parseInt(n(i).children("LEVEL_TYPE").text())!="1"&&n(i).children("HIERARCHY_UNIQUE_NAME").text().toLowerCase()!="[measures]"&&n(i).find("HIERARCHY_UNIQUE_NAME").text()==t.hierarchy)return{value:n(i).find("LEVEL_UNIQUE_NAME").text(),text:n(i).find("LEVEL_CAPTION").text()}});this.olapCtrlObj._currentReportItems.push({fieldName:t.hierarchy,dropdownData:r})},_sortField:function(i){var u,r;if(this.element.find(".e-dialog, .clientDialog").remove(),t.Pivot.closePreventPanel(this),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)return u=this._selectedField,this._ascdes=this._ascdes+u+"##",n(i.element).attr("id")!="descOrder"&&(this._ascdes=n.grep(this._ascdes.split("##"),function(n){return n!=u}).join("##")),this._applySorting(),!1;r=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item;r.sortOrder=n(i.element).attr("id")=="descOrder"?t.PivotAnalysis.SortOrder.Descending:t.PivotAnalysis.SortOrder.Ascending;this.refreshControl()}else t.olap.base._clearDrilledCellSet(),(n(i.element).attr("id")=="descOrder"||n(i.element).attr("id")=="ascOrder")&&(r=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,r.sortOrder=n(i.element).attr("id")=="descOrder"?t.olap.SortOrder.Descending:t.olap.SortOrder.Ascending,this._waitingPopup.show(),t.olap.base.getJSONData({action:"sorting"},this.model.dataSource,this))},_applySorting:function(){var i=JSON.stringify(this.model.customObject),n,r;try{n=JSON.parse(this.getOlapReport()).Report}catch(u){n=this.getOlapReport()}this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});i=JSON.stringify(this.model.customObject);r=JSON.stringify({action:"sorting",sortedHeaders:this._ascdes,currentReport:n,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:i});this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.model.enableDeferUpdate?t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide():this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.sorting,r,this._sortingSuccess)},_createDialog:function(i,r){var f=this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter,p=!1,o,s,a,g,nt,h,c,v,tt,y,u,it,rt,ut,l;f&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this._selectedField=this._curFilteredText,this._curFilteredAxis!="Slicers"&&(p=this._getAdvancedFilterInfo(this._curFilteredText).length>0),f=this.element.find(".pivotButton button[fieldname='"+this._curFilteredText+"']").parents("div:eq(0)").hasClass("drag")?!1:!0):f=f&&!this.element.find(".pivotButton[tag='"+this._curFilteredText+"']").parents("div:eq(0)").hasClass("drag")?!0:!1:f=f&&t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).axis!="filters"?!0:!1);this.element.find(".e-dialog, .clientDialog").remove();var w=this._selectedField,e,b="",k="",d="",st=n(document).height();f&&(s=JSON.parse(r),s[0].name="(Select All)",this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(e=s.splice(s.length-1,1),e=JSON.parse(e[0].levels)):this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(e=n.map(this._currentReportItems,function(n){if(n.fieldName==w)return n.dropdownData}),e.length==0&&(a=this._getConnectionInfo(this.model.dataSource.data),g='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_LEVELS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+this.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+this.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+this.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+a.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",this.doAjaxPost("POST",a.url,{XMLA:g},this._getLevelInfo,null,{pvtGridObj:this,action:"loadFieldElements",hierarchy:this._selectedField}),e=n.map(this._currentReportItems,function(n){if(n.fieldName==w)return n.dropdownData}))):e=[{value:this._selectedField,text:this._selectedField}],r=JSON.stringify(s),b=t.buildTag("div.ddlGroupWrap",this._getLocalizedLabels("SelectField")+t.buildTag("input#GroupLabelDrop.groupLabelDrop").attr("type","text")[0].outerHTML,{})[0].outerHTML,k=t.buildTag("ul.filterElementTag")[0].outerHTML,nt=t.Pivot.createAdvanceFilterTag({action:"filterTag"},this));d=t.buildTag("div.memberSearchEditorDiv",t.buildTag("input#searchEditorTreeView.searchEditorTreeView").attr("type","text")[0].outerHTML,{padding:f?"5px 5px 0px 9px":"0px"})[0].outerHTML;var ft=t.buildTag("div#EditorDiv.editorDiv",b+t.buildTag("div",k+d+t.buildTag("div.memberEditorDiv",t.buildTag("div#editorTreeView.editorTreeView")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML+"<\/br>",et=t.buildTag("div",t.buildTag("button#OKBtn.dialogOKBtn",this._getLocalizedLabels("OK"))[0].outerHTML+t.buildTag("button#CancelBtn.dialogCancelBtn",this._getLocalizedLabels("Cancel"))[0].outerHTML,{float:"right",margin:"-5px "+(f?" 5px 11px ":"0px 5px ")+" 0px"})[0].outerHTML,ot=t.buildTag("div#clientDialog.clientDialog",ft+et,{opacity:"1"}).attr("title",i)[0].outerHTML,r=JSON.parse(r);for(u=0;u<r.length;u++)r[u].name!=null&&r[u].name.toString().replace(/^\s+|\s+$/gm,"")||(r[u].name="(blank)",r[u].id="(blank)");if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!t.isNullOrUndefined(this._fieldMembers):!t.isNullOrUndefined(this._tempFilterData)){if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(u=0;u<Object.keys(this._fieldMembers).length;u++)t.isNullOrUndefined(this._fieldMembers[this._curFilteredText.split(":")[1]])||(h=n.map(this._fieldMembers[this._curFilteredText.split(":")[1]],function(n){if(!n.checked)return n.name}));else for(u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][i])||(h=this._tempFilterData[u][i]);if(!t.isNullOrUndefined(h))for(u=0;u<h.length;u++)for(c=0;c<r.length;c++)h[u]==r[c].name&&(r[c].checkedStatus=!1)}for(n(ot).appendTo("#"+this._id),this.element.find("#searchEditorTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search")+" "+i,maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),this.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:this.model.enableRTL,beforeDelete:function(){return!1},height:n(".memberEditorDiv").height(),fields:{id:"id",text:"name",isChecked:"checkedStatus",hasChild:"hasChildren",dataSource:r}}),f&&(o=this.element.find("[tag*='"+(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._selectedField:this._curFilteredText)+"']").offset(),this.element.find(".filterElementTag").ejMenu({fields:{dataSource:nt,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.NormalMenu,enableRTL:this.model.enableRTL,width:"100%",orientation:t.Orientation.Vertical,click:t.proxy(this._filterElementClick,this)}),this.element.find(".groupLabelDrop").ejDropDownList({width:"99%",enableRTL:this.model.enableRTL,dataSource:e,fields:{id:"id",text:"text",value:"value"},change:t.proxy(this._groupLabelChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),v=this.element.find(".groupLabelDrop").data("ejDropDownList"),v.selectItemByText(v.model.dataSource[0].text),this.element.find(".memberEditorDiv").addClass("advancedFilter")),p&&this.element.find(".editorTreeView").data("ejTreeView").checkAll(),tt=n.grep(r,function(n){if(n.hasChildren==!0)return n}).length>0,tt||this.element.find(".memberEditorDiv").addClass("noChildNode"),y=this.element.find(".editorTreeView").find("li"),u=0;u<y.length;u++)y[u].setAttribute("tag",r[u].tag);this.element.find(".dialogOKBtn, .dialogCancelBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(this._dialogBtnClick,this)});this._dialogOKBtnObj=this.element.find(".dialogOKBtn").data("ejButton");this._memberTreeObj=this.element.find(".editorTreeView").data("ejTreeView");it=this.element.find(".editorTreeView li:gt(0)");rt=n(it).find(":input.nodecheckbox:not(:checked)");rt.length>0&&(ut=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),n(ut).removeClass("e-checkmark").addClass("e-stop"));this.element.find(".clientDialog").ejDialog({width:f?"auto":265,target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,this)});this.element.find("#clientDialog_wrapper").css("top",this.element[0].offsetTop+20);this.element.find(".clientDialog").next(".e-scrollbar").hide();f&&(this.element.find("#clientDialog_wrapper").addClass("advancedFilterDlg"),l=n(".cols-sample-area").position(),l&&l.left>0?this.element.find("#clientDialog_wrapper").css({left:o.left+50-l.left,top:o.top}):t.isNullOrUndefined(o)||this.element.find("#clientDialog_wrapper").css({left:o.left+50,top:o.top}),this.element.find(".clientDialog").css({padding:"0px","min-width":"265px"}).parents().find(".e-titlebar").remove());this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this);this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this);this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this._memberTreeObj.model.beforeExpand=t.proxy(this._beforeNodeExpand,this):this._memberTreeObj.model.nodeClick=t.proxy(this._nodeExpand,this));this._memberTreeObj.element.find(".e-plus").length==0&&this._memberTreeObj.element.find(".e-item").css("padding","0px");this._isMembersFiltered=!1;this._unWireEvents();this._wireEvents();this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"));this.element.find(".e-dialog .e-close").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");t.isNullOrUndefined(i._schemaData)||i._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")})},_clearSorting:function(i){var u;if(n(i.target).parent().attr("disabled")=="disabled")return!1;if(t.Pivot.closePreventPanel(this),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._sortField(i):(u=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,u.sortOrder=t.PivotAnalysis.SortOrder.None,this.refreshControl());else{var f=this.model.dataSource,e=this._selectedField.toLowerCase(),u=n.map(f.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==e)return n});u.length==0&&(u=n.map(f.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==e)return n}));u.length>0&&delete u[0].sortOrder;this.model.dataSource=f;this.element.find(".e-dialog").remove();this.element.find("#preventDiv").remove();this._schemaData!=null&&this._schemaData.element.find(".e-dialog").remove();this._waitingPopup.show();this.getJSONData({action:"clearSorting"},this.model.dataSource,this)}},_clearAllFilters:function(i){var e,s,h,c,l,a;if(n(i.target).parent().attr("disabled")=="disabled")return!1;if(t.Pivot.closePreventPanel(this),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){var o=this.model.dataSource,f=this._selectedField.toLowerCase(),u=n.map(o.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==f)return n});u.length==0&&(u=n.map(o.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==f)return n}));u.length>0&&(e=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):this._schemaData==null?null:this._schemaData.element.find(".groupLabelDrop").data("ejDropDownList"),e!=null?(u[0].advancedFilter&&(u[0].advancedFilter=n.map(u[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLowerCase()!=e.getSelectedValue().toLowerCase())return n})),this._schemaData!=null&&(u[0].advancedFilter&&u[0].advancedFilter.length==0&&this._schemaData._tableTreeObj.element.find("li[tag ='"+u[0].fileName+"'] div:eq(0) .filter").remove(),this._schemaData._tableTreeObj.element.find("li[tag='"+e.getSelectedValue()+"'] div:eq(0) .filter").remove())):delete u[0].advancedFilter,delete u[0].filterItems);this._currentReportItems=n.grep(this._currentReportItems,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()!=f)return n});this.model.dataSource=o;this.element.find(".e-dialog").remove();this.element.find("#preventDiv").remove();this._schemaData!=null&&(this._schemaData._tableTreeObj.element.find("li[tag ='"+this._selectedField+"'] .filter").remove(),this._schemaData.element.find(".e-dialog").remove());this._waitingPopup.show();this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()!=f)return n}),this.refreshControl()):this.getJSONData({action:"advancedfiltering"},this.model.dataSource,this)}else{try{s=JSON.parse(this.getOlapReport()).Report}catch(v){s=this.getOlapReport()}h=this._curFilteredAxis+"::"+this._curFilteredText+"## Clear Filter";this._removeFilterTag(this._curFilteredText);c=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[c])return n});l=JSON.stringify(this.model.customObject);a=JSON.stringify({action:"labelfiltering",filterParams:h,sortedHeaders:this._ascdes,currentReport:s,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:l,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,a,this._filterElementSuccess)}},_removeFilterTag:function(i){var r=this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot,u;(i.indexOf("].")>=0||r)&&(u=i.split("].").length>2||r?"levelUniqueName":"hierarchyUniqueName",this._excelFilterInfo.length>0&&(levelName=this._selectedLevelUniqueName,hierarchyName=this._selectedFieldName,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n[u]!=i)return n})))},_groupLabelChange:function(i){var r=this.element.find(".filterElementTag").data("ejMenu"),a,p,c,w,e;if(r.disableItemByID("labelClearFilter"),r.disableItemByID("valueClearFilter"),r.disableItemByID("clearAllFilters"),r.disableItemByID("clearSorting"),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){var f=this.element.hasClass("e-pivotschemadesigner")?this.model.pivotControl:this,b=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):[],s=f._getAdvancedFiltervalue(f._selectedField,b.getSelectedValue()),v=t.Pivot.getReportItemByFieldName(f._selectedField,f.model.dataSource).item,h=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,y=t.buildTag("span.activeFilter").addClass("e-icon")[0].outerHTML,o=t.Pivot.getReportItemByFieldName(f._selectedField,f.model.dataSource).item,l;o&&o.sortOrder&&o.sortOrder!=t.olap.SortOrder.None&&(l=o&&o.sortOrder==t.olap.SortOrder.Descending?"desc":"asc",t.isNullOrUndefined(l)||l=="asc"?this.element.find(".clientDialog .ascImage").addClass("selectedSort"):this.element.find(".clientDialog .descImage").addClass("selectedSort"),r.enableItemByID("clearSorting"));this.element.find(".filterState,.activeFilter").remove();c=this.element.find("#clearAllFilters a").children().clone();this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(c);s.length>0?(s[0].advancedFilterType==t.Pivot.AdvancedFilterType.LabelFilter?(this.element.find("#labelFilterBtn a:eq(0)").append(h),this.element.find("#labelFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#labelFilterBtn li#"+s[0].labelFilterOperator+" a").append(y),r.enableItemByID("labelClearFilter")):(this.element.find("#valueFilterBtn a:eq(0)").append(h),this.element.find("#valueFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#valueFilterBtn li#"+s[0].valueFilterOperator+" a").append(y),r.enableItemByID("valueClearFilter")),r.enableItemByID("clearAllFilters")):v&&v.filterItems&&(this.element.find(".memberEditorDiv").before(h),this.element.find(".filterState").addClass("memberFilter").css("visibility","hidden"),r.enableItemByID("clearAllFilters"))}else{var a=this._selectedLevelUniqueName=i.selectedValue,h=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,u=[];this._excelFilterInfo.length>0&&(a=this._selectedLevelUniqueName,p=this._selectedFieldName,u=n.map(this._excelFilterInfo,function(n){if(n.hierarchyUniqueName==p&&n.levelUniqueName==a)return{action:n.action,operator:n.operator,value1:n.value1}}));this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(c=this.element.find("#clearAllFilters a").children().clone(),this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(c),w=n.grep(this._ascdes.split("##"),function(n){if(n==a)return n}),w.length>0?(this.element.find(".descImage").addClass("selectedSort"),r.enableItemByID("clearSorting")):this.element.find(".ascImage").addClass("selectedSort"));this.element.find(".filterElementTag .activeFilter,.filterIndicator").remove();u.length>0&&!t.isNullOrUndefined(u[0].operator)?(r.enableItemByID("clearAllFilters"),e="",u[0].action=="valuefiltering"?(e="valueFilterBtn",r.enableItemByID("valueClearFilter")):(e="labelFilterBtn",r.enableItemByID("labelClearFilter")),this.element.find("#"+e+" a:eq(0)").append(h),u[0].operator.replace(/ /g,"")=="BottomCount"?this.element.find("#"+e+" li#"+u[0].operator.replace(/ /g,"").replace("Bottom","top")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML)):this.element.find("#"+e+" li#"+u[0].operator.replace(/ /g,"")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML))):this._getUnSelectedNodes()!=""&&(this.element.find(".memberEditorDiv").before("<div class='filterState e-icon' style='margin-top:5px;position:absolute;visibility:hidden' />"),r.enableItemByID("clearAllFilters"))}},_getAdvancedFiltervalue:function(i,u){var f=t.Pivot.getReportItemByFieldName(i,this.model.dataSource).item,e=[];return f&&f.advancedFilter&&(e=n.map(f.advancedFilter,function(n){if(n.name!=r&&n.name.toLocaleLowerCase()==u.toLowerCase())return n})),e},_filterElementClick:function(i,u){var l,o,s,h,c,a,p,f,e;if(i.ID=="labelFilterBtn"||i.ID=="valueFilterBtn")return!1;if(l=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):u.element.find(".groupLabelDrop").data("ejDropDownList"),this._selectedLevelUniqueName=l.getSelectedValue(),i.ID=="clearAllFilters"||i.ID=="valueClearFilter"&&this.model.analysisMode=="pivot"&&this.model.operationalMode=="servermode"){if(this._clearAllFilters(i),i.ID=="valueClearFilter"&&this.model.analysisMode=="pivot"&&this.model.operationalMode=="servermode")return!1}else i.ID=="clearSorting"?this._clearSorting(i):(i.ID=="ascOrder"||i.ID=="descOrder")&&this._sortField(i);if(this.element.find(".e-dialog, .filterDialog, #preventDiv").remove(),this._schemaData!=null&&this._schemaData.element.find(".e-dialog").remove(),!n(i.element).parent().hasClass("filterElementTag")&&i.ID!="ascOrder"&&i.ID!="descOrder"&&i.ID!="clearSorting"&&i.ID!="clearAllFilters")if(o=this._selectedField,this._filterAction=t.isNullOrUndefined(i.element)?t.isNullOrUndefined(i.parentId)&&(t.isNullOrUndefined(i.menuId)||i.menuId=="")?n(i.selectedItem).attr("id")=="valueFilterBtn"?"valueFiltering":n(i.selectedItem).attr("id")=="labelFilterBtn"?"labelFiltering":"":i.parentId=="valueFilterBtn"?"valueFiltering":i.menuId=="labelFilterBtn"?"labelFiltering":"":n(i.element).parents("#valueFilterBtn").length==0?"labelFiltering":"valueFiltering",n.trim(i.text)==n.trim(this._getLocalizedLabels("ClearFilter")))if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode){this._removeFilterTag(this._selectedLevelUniqueName);try{s=JSON.parse(this.getOlapReport()).Report}catch(b){s=this.getOlapReport()}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)h=JSON.stringify(this.model.customObject),c=JSON.stringify({action:this._filterAction.toLowerCase(),filterParams:this._selectedLevelUniqueName+"--Clear Filter",currentReport:s,customObject:h,gridLayout:this.model.layout}),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,c,this._filterElementSuccess);else{a=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[a])return n});var w=this._curFilteredAxis+"::"+this._curFilteredText+"## Clear Filter",h=JSON.stringify(this.model.customObject),c=JSON.stringify({action:this._filterAction.toLowerCase(),filterParams:w,sortedHeaders:this._ascdes,currentReport:s,customObject:h,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,c,this._filterElementSuccess)}}else{t.Pivot.closePreventPanel(this);var v=this._selectedLevelUniqueName.toLowerCase(),y=[],f=n.map(this.model.dataSource.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n});return f.length==0&&(f=n.map(this.model.dataSource.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n})),t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()!=o.toLowerCase())return n}),f.length>0&&(f[0].advancedFilter&&(y=n.map(f[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLowerCase()!=v)return n})),f[0].advancedFilter=y,this._schemaData&&(f[0].advancedFilter.length==0&&this._schemaData._tableTreeObj.element.find("li[tag ='"+o+"'] div:eq(0) .filter").remove(),this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedLevelUniqueName+"'] div:eq(0) .filter").remove())),this._waitingPopup.show(),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.refreshControl():this.getJSONData({action:"advancedfiltering"},this.model.dataSource,this),!1}else this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(e=[],p=this._selectedLevelUniqueName,this._excelFilterInfo.length>0&&n(i.element).siblings("li:eq(0)").attr("disable")!="true"&&(e=n.map(this._excelFilterInfo,function(n){if(n.levelUniqueName==p)return{value1:n.value1,value2:n.value2,operator:n.operator,measure:n.measure}}),e.length>0&&i.ID!=e[0].operator.replace(/ /g,"")&&(e=[])),t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:i,filterInfo:e},this)):(f=n.map(this.model.dataSource.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n}),f.length==0&&(f=n.map(this.model.dataSource.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()==o.toLowerCase())return n})),e=[],f[0].advancedFilter&&(e=n.map(f[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLowerCase()!=v)return n})),t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:i,filterInfo:e},this))},_filterOptionChanged:function(i){var r=this._getAdvancedFiltervalue(this._selectedField,this._selectedLevelUniqueName),u;r=r.length>0?r[0].advancedFilterType=="label"&&i.value.replace(/ /g,"")==r[0].labelFilterOperator?r[0].values:r[0].advancedFilterType=="value"&&i.value.replace(/ /g,"")==r[0].valueFilterOperator?r[0].values:[""]:[""];u=this.element.find(".filterValuesTd")[0];i.value.toLowerCase().indexOf("between")>=0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/> <span>"+this._getLocalizedLabels("and")+"<\/span> <input type='text' id='filterValue2' value='"+(t.isNullOrUndefined(r[1])?"":r[1])+"' class='filterValues' style='display:inline' /> <\/br>");i.value.toLowerCase().indexOf("between")<0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/>")},_filterElementOkBtnClick:function(){var c,a,v,p,y,nt,f;t.Pivot.closePreventPanel(this);var e=this.element.find(".filterOptions")[0].value,i=[this.element.find("#filterValue1")[0].value],u,l=[],s=this._selectedField;if(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode){var tt=i[0].value,w=this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:"",u,o,h=this._filterAction.toLowerCase();if(o=this._selectedLevelUniqueName+"--"+e+"--"+i[0],this.element.find(".filterMeasures").length>0&&(this.element.find("#filterValue2").length>0&&(o=o+","+w),u=this.element.find(".filterMeasures").data("ejDropDownList").model.value,o=o+"--"+u,h="valuefiltering",u==null))return;try{c=JSON.parse(this.getOlapReport()).Report}catch(it){c=this.getOlapReport()}if(a=JSON.stringify(this.model.customObject),v=JSON.stringify({action:h,filterParams:o,currentReport:c,customObject:a,gridLayout:this.model.layout}),this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").addClass("freeze").width(n(this._schemaData.element).width()).height(n(this._schemaData.element).height()).css({top:n(this._schemaData.element).offset().top,left:n(this._schemaData.element).offset().left}),p=this._curFilteredText.indexOf(":")>-1?this._curFilteredText.split(":")[1]:"",p!=""&&this._tempFilterData&&(this._tempFilterData=n.grep(this._tempFilterData,function(n){if(t.isNullOrUndefined(n[p]))return n})),this._removeFilterTag(this._selectedLevelUniqueName),this._excelFilterInfo.push({action:h,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:e,measure:u,value1:i[0],value2:w}),this.model.analysisMode==t.Pivot.AnalysisMode.Olap)this.model.enableDeferUpdate||this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,v,this._filterElementSuccess);else if(this._filterAction=="labelFiltering"){y=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[y])return n});var b=this._curFilteredAxis+"::"+this._curFilteredText+"##"+e+"::"+i[0],a=JSON.stringify(this.model.customObject),v=JSON.stringify({action:h,filterParams:b,sortedHeaders:this._ascdes,currentReport:c,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:a,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,v,this._filterElementSuccess)}else{y=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[y])return n});this._measureDDL=this.element.find(".filterMeasures").data("ejDropDownList");u=this._measureDDL.getSelectedValue();var b=this._curFilteredText+"::"+e+"::"+u+"::"+i[0]+"::"+(this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:""),a=JSON.stringify(this.model.customObject),v=JSON.stringify({action:h,filterParams:b,sortedHeaders:this._ascdes,currentReport:c,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:a,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filtering,v,this._filterElementSuccess)}return!1}if(this._filterAction=="valueFiltering"){if(this._measureDDL=this.element.find(".filterMeasures").data("ejDropDownList"),u=this._measureDDL.getSelectedValue(),!(!isNaN(parseFloat(i[0]))&&isFinite(i[0]))||u=="")return;this.element.find("#filterValue2")[0]!=r?","+i.push(this.element.find("#filterValue2")[0].value):i}if(this.element.find(".e-dialog").remove(),this._schemaData){var k=t.buildTag("span.filter").addClass("e-icon")[0].outerHTML,d=this._schemaData._tableTreeObj.element.find("li[tag='"+this._selectedLevelUniqueName+"'] div:eq(0)"),g=this._schemaData._tableTreeObj.element.find("li[tag ='"+s+"'] div:eq(0)");d.find(".filter").length==0&&d.append(k);g.find(".filter").length===0&&g.append(k)}nt=this._selectedLevelUniqueName.toLowerCase();f=n.map(this.model.dataSource.columns,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()==s.toLowerCase())return n});f.length==0&&(f=n.map(this.model.dataSource.rows,function(n){if(n.fieldName!=r&&n.fieldName.toLocaleLowerCase()==s.toLowerCase())return n}));f.length>0&&(delete f[0].filterItems,f[0].advancedFilter&&(l=n.map(f[0].advancedFilter,function(n){if(n.name!=r&&n.name.toLocaleLowerCase()!=nt)return n})),this._filterAction.toLowerCase()=="labelfiltering"?l.push({name:this._selectedLevelUniqueName,labelFilterOperator:e.replace(/ /g,""),advancedFilterType:t.Pivot.AdvancedFilterType.LabelFilter,values:i}):l.push({name:this._selectedLevelUniqueName,valueFilterOperator:e.replace(/ /g,""),advancedFilterType:t.Pivot.AdvancedFilterType.ValueFilter,values:i,measure:u}),this._currentReportItems=n.grep(this._currentReportItems,function(n){if(n.fieldName!=s)return n}),f[0].advancedFilter=l,this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"filtering"},this)));this._waitingPopup.show();this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueSorting=null,t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=r&&n.fieldName.toLowerCase()!=s.toLowerCase())return n}),this._filterAction=="valueFiltering"&&t.PivotAnalysis._valueFilterArray.push(f[0]),this.refreshControl()):this.getJSONData({action:"advancedfiltering"},this.model.dataSource,this)},_nodeCheckChanges:function(i){if(this._isMembersFiltered=!0,(i.id.toLowerCase()=="(all)_0"||i.id.toLowerCase()=="all")&&i.type=="nodeUncheck")this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("unCheckAll"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.disable();else if((i.id.toLowerCase()=="(all)_0"||i.id.toLowerCase()=="all")&&i.type=="nodeCheck")this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("checkAll"),n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.enable();else if(i.id.toLowerCase()=="(all)_0"||i.id.toLowerCase()!="all"){var r=this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),u=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)");r.length==0||r.length==1&&r[0].id[r[0].id.length-1]==0?(n(u).parent().removeClass("e-chk-inact").removeClass("e-chk-ind").addClass("e-chk-act"),u.removeClass("e-stop").addClass("e-checkmark")):i.type=="nodeCheck"&&r.length==1&&r[0].id[r[0].id.length-1]==0?u.removeClass("e-stop").addClass("e-checkmark"):r.length>0&&u.removeClass("e-checkmark").addClass("e-stop");this._dialogOKBtnObj.enable();i.type=="nodeUncheck"&&r.length+1==this._memberTreeObj.element.find("li").length&&(u.removeClass("e-checkmark").removeClass("e-stop"),this._dialogOKBtnObj.disable())}},_fetchMemberSuccess:function(n){n[0]!=r&&n.length>0?(this._currentMembers=n[0].Value,n[1]!=null&&n[1]!=r&&(this.model.customObject=n[1].Value)):n.d!=r&&n.d.length>0?(this._currentMembers=n.d[0].Value,n.d[1]!=null&&n.d[1]!=r&&(this.model.customObject=n.d[1].Value)):n!=r&&n.length>0?(this._currentMembers=n.EditorTreeInfo,n!=null&&n!=r&&(this.model.customObject=n.customObject)):n!=r&&(this._currentMembers=n.EditorTreeInfo);this._createDialog(this._dialogHead,this._currentMembers);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.customObject});this.model.dataSource.enableAdvancedFilter?this.element.find(".e-dialog #GroupLabelDrop_wrapper:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"):t.isNullOrUndefined(this.element.find(".e-dialog .e-text:visible").first())||this.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell");this._waitingPopup.hide()},_filterElementSuccess:function(n){n[0]!=r?n[2]!=null&&n[2]!=r&&(this.model.customObject=n[2].Value):n.d!=r?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject});this._renderControlSuccess(n)},_sortingSuccess:function(n){n[0]!=r?n[2]!=r&&n.length>0&&(this.model.customObject=n[2].Value):n.d!=r&&n.d.length>0?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):n!=r&&n.length>0&&n.customObject!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});this._renderControlSuccess(n)},_nodeExpand:function(i){var u=i.event.originalEvent!=r&&i.event.originalEvent.target!=r?i.event.originalEvent.target:i.event.target,o="",v=n(u).parents("li").first().children().find("li").length,l,s,c,e,h,f,a;if(u!=r&&u.className!=r&&u.className!=""&&u.className.indexOf("e-plus")>-1&&v==0){n(u).removeClass("e-plus").addClass("e-load");l=n(u).parent().find("input.e-checkbox").prop("checked");c=n(u).parents("li").first().attr("tag");this.pNode=u;try{s=JSON.parse(this.model.pivotControl!=r?this.model.pivotControl.getOlapReport():this.getOlapReport()).Report}catch(y){s=this.model.pivotControl!=r?this.model.pivotControl.getOlapReport():this.getOlapReport()}for(e=this.element.find(".pivotButton"),f=0;f<e.length>0;f++)n(e[f]).attr("tag").indexOf(t.isNullOrUndefined(this._curFilteredText)?t.isNullOrUndefined(this._schemaData)?"":this._schemaData._curFilteredText:this._curFilteredText)>-1&&n(e[f]).attr("tag").split(":")[1].length==(t.isNullOrUndefined(this._curFilteredText)?t.isNullOrUndefined(this._schemaData)?0:this._schemaData._curFilteredText.length:this._curFilteredText.length)?o=n(e[f]).attr("tag"):n(e[f]).attr("tag").indexOf(t.isNullOrUndefined(this._curFilteredText)?t.isNullOrUndefined(this._schemaData)?"":this._schemaData._curFilteredText:this._curFilteredText)>-1&&(h=n(e[f]).attr("tag"));o=o==""?t.isNullOrUndefined(h)?t.isNullOrUndefined(this._curFilteredText)?this._schemaData._curFilteredText:this._curFilteredText:h.split(":")[1]:o.split(":")[1];this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});a=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.memberExpand,JSON.stringify({action:"memberExpanded",checkedStatus:l,parentNode:n(u).parents("li")[0].id,tag:c,cubeName:JSON.parse(this._olapReport).CurrentCube+"##"+o,currentReport:s,customObject:a}),this._fetchChildNodeSuccess)}},_fetchChildNodeSuccess:function(i){var u,f,e;i.length>1&&i[0]!=r?(u=JSON.parse(i[0].Value),i[1]!=null&&i[1]!=r&&(this.model.customObject=i[1].Value)):i.d!=r?(u=JSON.parse(i.d[0].Value),i.d[1]!=null&&i.d[1]!=r&&(this.model.customObject=i.d[1].Value)):(u=JSON.parse(i.ChildNodes),i.customObject!=null&&i.customObject!=r&&(this.model.customObject=i.customObject));e={id:"id",parentId:"pid",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus"};f=n(this.pNode).parents("li").length>1?n(this.pNode).parents("li").first():n(this.pNode).parents("li");n(n(f).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});!t.isNullOrUndefined(this._memberTreeObj)&&this._editorFlag?this._memberTreeObj._createSubNodesWhenLoadOnDemand(u,this.pNode,e):t.isNullOrUndefined(this._schemaData._memberTreeObj)||this._schemaData._memberTreeObj._createSubNodesWhenLoadOnDemand(u,this.pNode,e);n.each(n(f).children().find("li"),function(n,t){t.setAttribute("tag",u[n].tag)});this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});t.isNullOrUndefined(this._schemaData)||this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_beforeNodeExpand:function(n){t.Pivot.getChildNodes(n,this._selectedField,this._currentReportItems,this.model.dataSource,this)},_generateAllMember:function(t,i){this.olapCtrlObj._allMember=n(n(i).find("Axis:eq(0) Tuple:eq(0)").children().children()[1]).text()},_generateMembers:function(i,r){var o=n(r).find("Axis:eq(0) Tuple"),f=[],s={},u,e,h;for(f.push({id:"All",name:"All",checkedStatus:!0,tag:""}),u=0;u<o.length;u++)e=n(n(r).find("Axis:eq(0) Tuple:eq("+u+")").children().children()[0]).text(),h=n(n(r).find("Axis:eq(0) Tuple:eq("+u+")").children().children()[1]).text(),s={hasChildren:n(o[u]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!0,id:e.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:h,tag:e},f.push(s);t.isNullOrUndefined(this.olapCtrlObj)||(this.olapCtrlObj._waitingPopup.hide(),this.olapCtrlObj._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(f)}))},_filterBtnClick:function(i){var e,u,o;if(this._editorFlag=!0,t.Pivot.openPreventPanel(this),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap){var f=this._selectedField=n(i.currentTarget.parentNode).attr("tag").split(":")[1],r=[];this._dialogHead=n(i.target).siblings(".pvtBtn").attr("fieldCaption");r=n.map(this._currentReportItems,function(n){if(n.fieldName==f)return n.filterItems});r.length>0?this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(r)}):(this._waitingPopup.show(),t.olap._mdxParser.getMembers(this.model.dataSource,f,this))}else this._selectedField=n(i.target).siblings(".pvtBtn").attr("fieldName"),this._dialogHead=n(i.target).siblings(".pvtBtn").attr("fieldCaption"),this._selectedAxis=n(i.target).siblings(".pvtBtn").attr("axis"),e=this._getTreeViewData(this._selectedField,this._selectedAxis),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(e)});else{this._curFilteredAxis=i.target.parentElement.attributes.tag.value.split(":")[0];this._curFilteredText=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?i.target.parentElement.attributes.tag.value:n(n(i.target).siblings()[1]).attr("fieldname");this._dialogTitle=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?i.target.parentElement.attributes.tag.value:n(n(i.target).siblings()[1]).attr("fieldname");this._dialogHead=n(n(i.target).siblings("button")).attr("fieldCaption");try{u=JSON.parse(this.getOlapReport()).Report}catch(s){u=this.getOlapReport()}this._waitingPopup.show();t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").addClass("freeze").width(n(this._schemaData.element).width()).height(n(this._schemaData.element).height()).css({top:n(this._schemaData.element).offset().top,left:n(this._schemaData.element).offset().left});this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.customObject});o=JSON.stringify(this.model.customObject);eventArgs=JSON.stringify({action:"fetchMembers",headerTag:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.enableAdvancedFilter?this._dialogTitle+"##"+this.model.enableAdvancedFilter:this._dialogTitle,sortedHeaders:this._ascdes,currentReport:u,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:o});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMembers,eventArgs,this._fetchMemberSuccess)}},_getTreeViewData:function(i){var e=t.Pivot.getReportItemByFieldName(i,this.model.dataSource).item,f=t.PivotAnalysis.getMembers(i),o=[{id:"All",name:"All",checkedStatus:!0}],u;if(e.filterItems!=null&&e.filterItems!=r)for(u=0;u<f.length;u++)o.push({id:f[u],name:f[u],checkedStatus:e.filterItems.filterType==t.PivotAnalysis.FilterType.Include?n.inArray(f[u]!=null?f[u].toString():f[u],e.filterItems.values)>=0:n.inArray(f[u]!=null?f[u].toString():f[u],e.filterItems.values)<0});else for(u=0;u<f.length;u++)o.push({id:f[u],name:f[u],checkedStatus:!0});return o},_applyToolTip:function(i){var h,s,u,e,o,p,v,c,f,w,a,y,b;if(this.model.enableToolTip&&(e="",valueCell="",o=n(i.target).hasClass("cellValue")?i.target.parentElement:i.target,n(o).find("input").length==0&&!n(o).hasClass("curInput")&&!t.isNullOrUndefined(n(o).attr("role")))){if(u=this.element.find(".summary[role!='gridcell'][p$=',"+n(o).attr("p").split(",")[1]+"'] , .rowheader[role!='gridcell'][p$=',"+n(o).attr("p").split(",")[1]+"']").last().attr("p"),u==null&&(u=n(o).parent("tr").find(".summary,.rowheader").attr("p")),u!=null)if(u[0]==0&&parseInt(u.split(",")[0])!=null)u==this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Index&&(s=this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Value);else while(u[0]>=0)u==this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Index&&(h=this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Value,u=parseInt(u.split(",")[0])-1+","+parseInt(u.split(",")[1])),s=s?h!=""?h+"-"+s:s:h;var k=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,d=this.element.find(k?".pivotGridFrozenTable ":'tr:has(".colheader")').length-1,l=n(o).attr("p");for(l!=r&&l==this.getJSONRecords()[parseInt(parseInt(l.split(",")[0])*this._rowCount+parseInt(l.split(",")[1]))].Index&&(p=parseInt(l.split(",")[0])),v=0;v<=d;v++)c=p+","+v,p!=null&&c==this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))].Index&&(h=this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))].Value,e==""?e=h:h!=""&&(e=e+"-"+h));n("#"+this._id+"_gridTooltip").remove();this.element.find("span#celval").remove();f=n(o).position();(this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&(w=this.element.find(".e-scroller").data("ejScroller"),this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders||!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders?(f.left=f.left+this.element.find(".rowhead").width()-w.model.scrollLeft,f.top=f.top-w.model.scrollTop):this.model.frozenHeaderSettings.enableFrozenHeaders&&(f.top=f.top+(this.element.find(".e-vscrollbar").length>0?this.element.find(".valueCell").height()-80:0),f.left=f.left+(this.element.find(".e-vscrollbar").length>0&&this.element.find(".e-hscrollbar").length>0||this.element.find(".e-vscrollbar").length==0&&this.element.find(".e-hscrollbar").length==0?this.element.find(".rowhead").width():0)));n("#"+this._id).append('<div id="'+this._id+'_gridTooltip" class="pGridTooltip" role=\'tooltip\'><\/div>');n(o).append("<span id='celval' style='display:none'>row- "+s+": column- "+e+"<\/span>");n(o).find("span.cellValue").attr("aria-describedby","span#celval");a=n(o).find("span.cellValue:not('#celval')").text();this.model.enableRTL?(n("#"+this._id+"_gridTooltip").append('<p id="value" class="tooltipText">'+(a?a:this._getLocalizedLabels("NoValue"))+":"+this._getLocalizedLabels("ToolTipValue")+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="row" class="tooltipText">'+(s==r||this._rowCount==1?this._getLocalizedLabels("NoValue"):this._direction(s))+":"+this._getLocalizedLabels("ToolTipRow")+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="column" class="tooltipText">'+(e==r||e==""?this._getLocalizedLabels("NoValue"):this._direction(e))+":"+this._getLocalizedLabels("ToolTipColumn")+"<\/p>")):(n("#"+this._id+"_gridTooltip").append('<p id="value" class="tooltipText">'+this._getLocalizedLabels("ToolTipValue")+": "+(a?a:this._getLocalizedLabels("NoValue"))+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="row" class="tooltipText">'+this._getLocalizedLabels("ToolTipRow")+": "+(s==r||this._rowCount==1?this._getLocalizedLabels("NoValue"):s)+"<\/p>"),n("#"+this._id+"_gridTooltip").append('<p id="column" class="tooltipText">'+this._getLocalizedLabels("ToolTipColumn")+": "+(e==r||e==""?this._getLocalizedLabels("NoValue"):e)+"<\/p>"));y=0;y=t.isNullOrUndefined(this._pivotClientObj)?n("#"+this._id).parent().position().left+n("#"+this._id).parent().width():n("#"+this._id).parent().position().left+this._pivotClientObj.element.find(".gridContainer").width();b=f.left+n("#"+this._id+"_gridTooltip").width();n("#"+this._id+"_gridTooltip").css({left:(f.left>0?f.left:0)+(y-b<0?y-b-20:5),top:n(this.element).height()-f.top<100?f.top-n("#"+this._id+"_gridTooltip").outerHeight()-2:f.top+40});this.model.enableToolTipAnimation?n("#"+this._id+"_gridTooltip").show("fast"):n("#"+this._id+"_gridTooltip").show();t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj.controlPlacement()!="tile"||n("#"+this._id+"_gridTooltip").css("position","absolute")}},_applyVScrolling:function(){var y,c=!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling,p=c?this._pivotClientObj.element.find(".e-pivotgrid"):n(this.element).find(".virtualScrollGrid"),u=c?this._pivotClientObj:this,i=c&&!t.isNullOrUndefined(this._pivotClientObj._pivotGrid)?this._pivotClientObj._pivotGrid:this,s=c&&this.model.isResponsive,h,a,f,l,e,v,r,o;if(i._seriesPageCount>1){h=function(){return s?Math.round(u.element.find(".vScrollPanel").offset().top)+1:Math.round(u.element.find(".vScrollPanel").position().top)+1};a=n(u.element).find(".vScrollPanel");a.height(c?this._pivotClientObj.model.isResponsive?parseInt(this._pivotClientObj.element.find(".controlPanel").height()):parseInt(this._pivotClientObj.element.find(".gridContainer").height()):n(p).height());a.html(t.buildTag("div.vScrollThumb")[0].outerHTML);f=a.find(".vScrollThumb");f.height(Math.max(Math.ceil((c?this._pivotClientObj.model.isResponsive?parseInt(this._pivotClientObj.element.find(".controlPanel").height()):parseInt(this._pivotClientObj.element.find(".gridContainer").height()):n(p).height())/i._seriesPageCount),15));l=a.height()-f.height()-2;f.offset({top:h()+(i._seriesCurrentPage-1)*(l/(i._seriesPageCount-1))});n(".vScrollPanel").on("mousewheel DOMMouseScroll",function(t){var r,e;n("body").on("mousewheel DOMMouseScroll",function(n){return n.preventDefault(),n.stopPropagation(),!1});initThumbPos=(s?f.offset().top:f.position().top)-h();r=i._seriesCurrentPage;movedDistance=t.originalEvent.wheelDelta<0||t.originalEvent.detail>0?t.target.offsetParent.offsetTop+10:-t.target.offsetParent.offsetTop-10;u.element.find(".seriesPageIndicator").removeClass("inActive").css({top:f.position().top,left:f.position().left+20});r=i._seriesCurrentPage;window.navigator.userAgent.indexOf("MSIE ")>-1?n(document).on("selectstart",function(n){n.preventDefault()}):window.getSelection().removeAllRanges();movedDistance>0&&initThumbPos+movedDistance<=l||movedDistance<0&&initThumbPos+movedDistance>=0?e=initThumbPos+movedDistance+h():initThumbPos+movedDistance>l?e=h()+l:initThumbPos+movedDistance<0?e=h():"";f.offset({top:e});r=Math.ceil(((s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount))==0?1:Math.ceil(((s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount));r>i._seriesPageCount&&(r=i._seriesPageCount);u.element.find(".seriesPageIndicator").css({top:f.position().top});u.element.find(".series_CurrentPage").html(r);r!=i._seriesCurrentPage&&(i._seriesCurrentPage=r,clearTimeout(y),y=setTimeout(function(){c?i._pivotClientObj.refreshPagedPivotClient("series",i._seriesCurrentPage):i.refreshPagedPivotGrid("series",i._seriesCurrentPage)},250))});n(f).on("mousedown touchstart",function(t){var o,r,e;n(this).addClass("dragging");o=t.pageY-h();r=(s?f.offset().top:f.position().top)-h();u.element.find(".seriesPageIndicator").removeClass("inActive").css({top:f.position().top,left:f.position().left+20});e=i._seriesCurrentPage;n(document).on("mousemove touchmove",function(t){if(window.navigator.userAgent.indexOf("Trident")>-1)n(document).on("selectstart",function(n){n.preventDefault()});else window.getSelection().removeAllRanges();var c=t.pageY-h()-o;c>0&&r+c<=l?f.offset({top:r+c+h()}):c<0&&r+c>=0?f.offset({top:r+c+h()}):r+c>l?f.offset({top:h()+l}):r+c<0&&f.offset({top:h()});e=Math.floor((Math.round(s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount))==0?1:Math.floor((Math.round(s?f.offset().top:f.position().top)-h())/(l/i._seriesPageCount));u.element.find(".seriesPageIndicator").css({top:f.position().top});u.element.find(".series_CurrentPage").html(e);u.element.find(".vScrollThumb").attr("title",u.element.find(".seriesPageIndicator").text())});n(document).on("mouseup touchend",function(){n(document).off("selectstart");n(this).off("mousemove touchmove").off("mouseup touchend");n(f).removeClass("dragging");e!=i._seriesCurrentPage?(i._seriesCurrentPage=e,c?i._pivotClientObj.refreshPagedPivotClient("series",i._seriesCurrentPage):i.refreshPagedPivotGrid("series",i._seriesCurrentPage)):u.element.find(".seriesPageIndicator").addClass("inActive")})})}if(i._categPageCount>1){e=function(){return s?Math.round(u.element.find(".hScrollPanel").offset().left)+1:Math.round(u.element.find(".hScrollPanel").position().left)+1};this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.element.find(".childsplit").length>0&&this._pivotClientObj.element.find(".childsplit").data("ejSplitter").refresh();v=n(u.element).find(".hScrollPanel");v.width(c?this._pivotClientObj.model.enableSplitter?parseInt(this._pivotClientObj.element.find(".controlPanelTD").width()):parseInt(this._pivotClientObj.element.find(".controlPanel").width()):n(p).width());v.html(t.buildTag("div.hScrollThumb")[0].outerHTML);r=v.find(".hScrollThumb");r.width(Math.max(Math.ceil((c?this._pivotClientObj.model.enableSplitter?parseInt(this._pivotClientObj.element.find(".controlPanelTD").width()):parseInt(this._pivotClientObj.element.find(".controlPanel").width()):n(p).width())/i._categPageCount),15));o=v.width()-r.width()-2;this.model.enableRTL?r.css({right:(i._categCurrentPage-1)*(o/(i._categPageCount-1))}):r.offset({left:e()+(i._categCurrentPage-1)*(o/(i._categPageCount-1))});n(".hScrollPanel").on("mousewheel DOMMouseScroll",function(t){n("body").on("mousewheel DOMMouseScroll",function(n){return n.preventDefault(),n.stopPropagation(),!1});initThumbPos=u.model.enableRTL?u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()):(s?r.offset().left:r.position().left)-e();currentPage=i._categCurrentPage;movedDistance=t.originalEvent.wheelDelta<0||t.originalEvent.detail>0?c?t.target.offsetParent.children[1].offsetLeft+10:t.target.offsetParent.offsetLeft+10:c?-t.target.offsetParent.children[1].offsetLeft-10:-t.target.offsetParent.offsetLeft-10;movedDistance=u.model.enableRTL?-movedDistance:movedDistance;u.element.find(".categPageIndicator").removeClass("inActive").css({left:r.position().left,top:r.position().top+20});window.navigator.userAgent.indexOf("MSIE ")>-1?n(document).on("selectstart",function(n){n.preventDefault()}):window.getSelection().removeAllRanges();var f;u.model.enableRTL?movedDistance>0&&initThumbPos+movedDistance<=o||movedDistance<0&&initThumbPos+movedDistance>=0?f=initThumbPos+movedDistance:initThumbPos+movedDistance>o?f=o:initThumbPos+movedDistance<0?f=0:"":movedDistance>0&&initThumbPos+movedDistance<=o||movedDistance<0&&initThumbPos+movedDistance>=0?f=initThumbPos+movedDistance+e():initThumbPos+movedDistance>o?f=e()+o:initThumbPos+movedDistance<0?f=e():"";u.model.enableRTL?r.css("right",f):r.offset({left:f});currentPage=u.model.enableRTL?Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount))==0?1:Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount)):Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount))==0?1:Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount));currentPage=currentPage>i._categPageCount?i._categPageCount:currentPage<1?1:currentPage;u.element.find(".categPageIndicator").css({left:r.position().left});u.element.find(".categ_CurrentPage").html(currentPage);currentPage!=i._categCurrentPage&&(i._categCurrentPage=currentPage,clearTimeout(y),y=setTimeout(function(){c?i._pivotClientObj.refreshPagedPivotClient("categ",i._categCurrentPage):i.refreshPagedPivotGrid("categ",i._categCurrentPage)},250))});n(r).on("mousedown touchstart",function(t){var l,f,h;n(this).addClass("dragging");l=u.model.enableRTL?u.element.find(".hScrollPanel").width()-(t.pageX-e()):t.pageX-e();f=u.model.enableRTL?u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()):(s?r.offset().left:r.position().left)-e();u.element.find(".categPageIndicator").removeClass("inActive").css({left:r.position().left,top:r.position().top+20});h=i._categCurrentPage;n(document).on("mousemove touchmove",function(t){if(window.navigator.userAgent.indexOf("Trident")>-1)n(document).on("selectstart",function(n){n.preventDefault()});else window.getSelection().removeAllRanges();var c=u.model.enableRTL?u.element.find(".hScrollPanel").width()-(t.pageX-e())-l:t.pageX-e()-l;c>0&&f+c<=o?u.model.enableRTL?r.css({right:f+c}):r.offset({left:f+c+e()}):c<0&&f+c>=0?u.model.enableRTL?r.css({right:f+c}):r.offset({left:f+c+e()}):f+c>o?u.model.enableRTL?r.css({right:o}):r.offset({left:e()+o}):f+c<0&&(u.model.enableRTL?r.css({right:"0px"}):r.offset({left:e()}));h=u.model.enableRTL?Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount))==0?1:Math.floor((u.element.find(".hScrollPanel").width()-((s?r.offset().left:r.position().left)+16-e()))/(o/i._categPageCount)):Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount))==0?1:Math.floor((Math.round(s?r.offset().left:r.position().left)-e())/(o/i._categPageCount));h=h>i._categPageCount?i._categPageCount:h<1?1:h;u.element.find(".categPageIndicator").css({left:r.position().left});u.element.find(".categ_CurrentPage").html(h);u.element.find(".hScrollThumb").attr("title",u.element.find(".categPageIndicator").text())});n(document).on("mouseup touchend",function(){n(document).off("selectstart");n(this).off("mousemove touchmove").off("mouseup touchend");n(r).removeClass("dragging");h!=i._categCurrentPage?(i._categCurrentPage=h,c?i._pivotClientObj.refreshPagedPivotClient("categ",i._categCurrentPage):i.refreshPagedPivotGrid("categ",i._categCurrentPage)):u.element.find(".categPageIndicator").addClass("inActive")})})}n("body").off("mousewheel DOMMouseScroll")},_getLocalizedLabels:function(n){return t.PivotGrid.Locale[this.locale()][n]===r?t.PivotGrid.Locale["en-US"][n]:t.PivotGrid.Locale[this.locale()][n]},_drillDown:function(i){var r,y,c,f,g,p,u,w,v,b,l,nt,s,h;if(this._drillCaption=n(i.target).parent().find(".cellValue").text(),f=i.target.className,this._startDrilldown=!0,gridObj=this,r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,f=f.split(" "),n(i.target).hasClass("expand")?this._drillAction="drilldown":n(i.target).hasClass("collapse")&&(this._drillAction="drillup"),y=n(n(i.target).parent()).hasClass("rowheader")||n(n(i.target).parent()).attr("role")=="rowheader"?"rowheader":"colheader",this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){t.isNullOrUndefined(r)?this._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&gridObj._waitingPopup.show()},800));for(var a=n(i.target).parent().attr("p"),e=this.getJSONRecords()[parseInt(parseInt(a.split(",")[0])*this._rowCount+parseInt(a.split(",")[1]))].Info,d=e.replace(/&/g,"&"),o=parseInt(a.split(",")[0]),k=parseInt(a.split(",")[1]);o>0;){for(o--,s=this.getJSONRecords()[o*this._rowCount+k].Info,h=k;s==""&&h>0;)h--,s=this.getJSONRecords()[o*this._rowCount+h].Info;e=s+">#>"+e}return this.element.parents(".e-pivotclient").length>0?(c=this.element.parents(".e-pivotclient").data("ejPivotClient"),y=="rowheader"&&c.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(c._drillInfo=e,c.setChartDrillParams(e,this._drillAction))):c=this,c._pivotRecords={records:this.getJSONRecords(),rowCount:this._rowCount},n(i.target).hasClass("collapse")?this.updateDrilledReport({uniqueName:d,index:a,action:"collapse"},y,c):this.updateDrilledReport({uniqueName:d,index:a},y,c),!1}if(this.element.find(".e-dialog").remove(),!this.model.enableDeferUpdate){this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this._off(this.element,"click",".expand, .collapse");this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.element.find(".colheader, .rowheader, .value").removeClass("e-droppable");f=i.target.className;g=n(i.target).parent();this._startDrilldown=!0;f=f.split(" ");f[0]=="expand"?this._drillAction="drilldown":f[0]=="collapse"&&(this._drillAction="drillup");this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"drillDown",element:this.element,customObject:this.model.customObject});p=JSON.stringify(this.model.customObject);u=n(i.target).parent().attr("p");this._drillCaption=n(i.target).parent().find(".cellValue").text();t.isNullOrUndefined(this._pivotClientObj)||t.isNullOrUndefined(this._pivotClientObj._waitingPopup)?t.isNullOrUndefined(r)?this._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&gridObj._waitingPopup.show()},800)):(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&(n("#"+gridObj._pivotClientObj._id+"_maxView")[0]?(n("#"+gridObj._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}),gridObj._maxViewLoading=n("#"+gridObj._pivotClientObj._id+"_maxView").data("ejWaitingPopup")):gridObj._pivotClientObj._waitingPopup.show())},800));w=this.model.analysisMode=="relational"?this._drillHeaders.join("||"):this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Info;try{v=n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this._pivotClientObj.getOlapReport()).Report:this._pivotClientObj.currentReport:JSON.parse(this.getOlapReport()).Report}catch(tt){v=n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this._pivotClientObj.getOlapReport():this._pivotClientObj.currentReport:this.getOlapReport()}if(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){b=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(this.element).find(".pivotGridTable"):n(this.element).find("table").detach();l=this._getFieldName(n(i.target).parent()[0]);n(i.target).hasClass("collapse")?(t.isNullOrUndefined(this.model.collapsedMembers)&&(this.model.collapsedMembers={}),t.isNullOrUndefined(this.model.collapsedMembers[l])?this.model.collapsedMembers[l]=[n(i.target).parent()[0].textContent]:this.model.collapsedMembers[l].push(n(n(i.target).parent()[0]).clone().children().remove().end().text())):n(i.target).hasClass("expand")&&(this.model.collapsedMembers[l]=n.grep(this.model.collapsedMembers[l],function(t){return t!=n(i.target).parent()[0].textContent}));nt=n(n(i.target).parent()).hasClass("rowheader")||n(n(i.target).parent()).attr("role")=="rowheader"?"rowheader":n(n(i.target).parent()).hasClass("colheader")||n(n(i.target).parent()).attr("role")=="columnheader"?"columnheader":"";this._collapseMember(b,i.target);n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen?this.element.find("#"+this._id+"Toolbar").append(b):this.element.append(b);(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._applyFrozenHeaderWidth(this._JSONRecords,this._drillAction,g);this._hideGrandTotal(b);this.model.enableGroupingBar&&(tableWidth=n("#"+this._id).find(".pivotGridTable").width(),this.element.find(".groupingBarPivot .drag").width(tableWidth-5),cellWidth=n("#"+this._id).find(".pivotGridTable").find("th").width(),this.element.find(".groupingBarPivot .values").width(cellWidth-2),this.element.find(".groupingBarPivot .columns").width(tableWidth-cellWidth),this.element.find(".groupingBarPivot .valueColumn").width(tableWidth));this.element.find(".colheader, .rowheader, .value").addClass("e-droppable");t.isNullOrUndefined(r)||(r._isTimeOut=!1);this._waitingPopup.hide();var it=i,o=parseInt(u.split(",")[0]),k=parseInt(u.split(",")[1]),e=this._drillCaption;if(nt=="rowheader")while(o>0){for(o--,s=this.getJSONRecords()[this._rowCount*o+k].Value,h=k;s==""&&h>0;)h--,s=this.getJSONRecords()[this._rowCount*o+h].Value;e=s+">#>"+e}this._trigger("drillSuccess",{gridObj:this,drillAction:this._drillAction,drilledMember:e,fieldName:l,axis:y,cellPosition:u});this.model.enableGroupingBar&&this._createFields("drilldown",n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth());this._unWireEvents();this._wireEvents();this._drillAction=""}else this.layout()!=""||this.layout()!="normal"?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,headerInfo:w,layout:this.layout(),customObject:p}),this._drillDownSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,clientReports:this._pivotClientObj.reports,headerInfo:w,layout:this.layout(),customObject:p}),this._drillDownSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,headerInfo:w,customObject:p}),this._drillDownSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:u,currentReport:v,clientReports:this._pivotClientObj.reports,headerInfo:w,customObject:p}),this._drillDownSuccess)}},_collapseMember:function(i,u){var e=n(u).parent()[0],y=n(e).attr("p"),st=n(u).attr("tag")!=r?parseInt(n(u).attr("tag"))+e.rowSpan:e.rowSpan,at=this.model.enableAdvancedFilter&&!t.isNullOrUndefined(n(e).attr("vfcolspan"))?parseInt(n(e).attr("vfcolspan")):n(u).attr("tag")!=r?parseInt(n(u).attr("tag"))+e.colSpan:e.colSpan,o=n(u).closest("tr")[0],ri=null,ui=null,et="false",pt=0,vt,bt,tt,ot,v,ei,c,p,s,w,hi,a,rt,l,ut,lt,g,h,ht,ft,ti,yt,b,k,oi,f,gt;if(e.className.indexOf("rowheader")>=0||e.className.indexOf("summary")>=0&&n(e).attr("role")=="rowheader"){if(this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout){var si=this.getJSONRecords()[1].Index=="0,0"?1:0,st=this.getJSONRecords()[parseInt(y.split(",")[0])*this._rowCount+parseInt(y.split(",")[1])+si].RowSpan,wt=o;for(n(u).attr("class").indexOf("expand")>-1&&n(o).removeAttr("tag"),s=0;s<st;s++)n(u).attr("class")&&n(u).attr("class").indexOf("collapse")>-1&&(n(n(o).next()).attr("tag")==r&&n(n(o).next()).attr("tag",y),n(n(o).next()).css("display","none"),(this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&n(i).find(".pivotGridValueTable td[i$=',"+n(n(o).next()).find("td").attr("i").split(",")[1]+"']").css("display","none")),n(u).attr("class").indexOf("expand")>-1&&(n(n(o).next()).attr("tag")==r||n(n(o).next()).attr("tag")==y)&&(n(n(o).next()).css("display","table-row"),n(n(o).next()).removeAttr("tag"),(this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&this.element.find(".pivotGridValueTable td[i$=',"+n(n(o).next()).find("td").attr("i").split(",")[1]+"']").css("display","")),o=n(o).next();vt=this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders?"td":"th";bt=n(wt).find(vt+" span:not(.cellValue)").css("margin-left");n(wt).find(vt+" span:not(.cellValue)").remove();n(wt).find(vt).prepend(n(u).attr("class").indexOf("collapse")>-1?'<span style="margin-left:'+bt+'" class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":'<span style="margin-left:'+bt+'" class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>");return}var fi=!n(e).index()>0,kt=isLeafHide=!1;if(n(u).attr("class")&&n(u).attr("class").indexOf("collapse")>-1){for(s=0;s<st;s++){if(ri=n(o).next(),fi)n(o).find(".stot,.rstot").length>=1&&s==1&&n(n(o).find(".stot,.rstot")).find(".expand").length>=1&&(isLeafHide=!0),(n(n(o).find(".stot,.rstot")).find(".expand").length>=1||n(o).css("display")=="none")&&(kt=!0),n(o).css("display","none"),(this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&n(i).find(".pivotGridValueTable tr:eq("+n(o).index()+")").css("display","none"),n(o).attr("tag",n(o).attr("tag")!=r?parseInt(n(o).attr("tag"))+1:1);else{for(v=e,k=0;k<=n(e).nextAll().length;k++)n(v).css("display","none").attr("hc",n(v).attr("hc")==r?1:parseInt(n(v).attr("hc"))+1),v=n(v).next();isTdSubSameRow=!1;et="true"}o=ri;fi=!0}for(tt=et=="true"?e.rowSpan-1:e.rowSpan,n(o).css("display")!="none"&&isLeafHide&&(ot=n(u).attr("subTag")!=r?parseInt(n(u).attr("subTag"))==-1?e.rowSpan+1:parseInt(n(u).attr("subTag"))+e.rowSpan:e.rowSpan),n(o).css("display")=="none"&&(n(o).css("display",""),kt=!0,tt=tt-1),kt&&t.isNullOrUndefined(ot)&&(ot=n(u).attr("subTag")!=r?parseInt(n(u).attr("subTag"))==-1?e.rowSpan:parseInt(n(u).attr("subTag"))+e.rowSpan:e.rowSpan),(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&n(i).find(".pivotGridValueTable").length>0?(n(o).find("td").text(n(o).find("td").text().replace(" Total","")),n(o).find("td span:not(.cellValue)").remove(),n(o).find("td").prepend('<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'" tag="'+st+":"+et+'"> <\/span>')):(n(o).find("th").text(n(o).find("th").text().replace(" Total","")),n(o).find("th span:not(.cellValue)").remove(),n(o).find("th").prepend('<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'" tag="'+st+":"+et+(t.isNullOrUndefined(ot)?"":n(u).attr("isChildSubNode")=="true"?'" subTag="'+ot+":"+et+'" isChildSubNode="true':'" subTag="'+ot+":"+et)+'"> <\/span>')),c=n(o).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)"),s=0;s<c.length;s++)parseInt(n(c[s]).attr("p").split(",")[0])<parseInt(y.split(",")[0])&&parseInt(n(c[s]).attr("p").split(",")[1])+c[s].rowSpan+(n(c[s]).find("span").attr("tag")!=r?parseInt(n(c[s]).find("span").attr("tag")):0)>=parseInt(y.split(",")[1])+st&&(c[s].rowSpan-=tt,n(c[s]).find("span").attr("tag")==r&&n(c[s]).find("span").attr("isChildSubNode",!0),n(c[s]).find("span").attr("tag",n(c[s]).find("span").attr("tag")!=r?parseInt(n(c[s]).find("span").attr("tag"))+tt:tt),n(c[s]).find("span").attr("subTag",n(c[s]).find("span").attr("subTag")!=r?parseInt(n(c[s]).find("span").attr("subTag"))+tt:tt))}else if(n(u).attr("class")&&n(u).attr("class").indexOf("expand")>-1){var ht=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,it=removeSubSpan=this._isSubTotalhidden=!1,nt=0;for(s=parseInt(n(u).attr("tag").split(":")[0]);s>=0;s--)ui=n(o).prev(),n(o).attr("tag")==r||parseInt(n(o).attr("tag"))<=1?(this._hideSubTotal(n(o),nt,n(u)),this._isSubTotalHide?(it=!0,this._isSubTotalHide=!1,n(o).css("display","none"),ht&&n(i).find(".pivotGridValueTable tr eq:("+n(o).index()+")").css("display","none")):(n(o).css("display","table-row"),(this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders)&&n(i).find(".pivotGridValueTable tr:eq("+n(o).index()+")").css("display","table-row"))):pt++,nt=nt==0?1:nt,n(o).attr("tag")!=r&&(parseInt(n(o).attr("tag")-1)==0?n(o).removeAttr("tag"):n(o).attr("tag",parseInt(n(o).attr("tag"))-1)),o=ui;if(n(u).attr("tag").split(":")[1]=="true")for(v=n(i).find((ht?".pivotGridRowTable ":"th")+"[p='"+parseInt(n(e).attr("p").split(",")[0])+","+(parseInt(n(e).attr("p").split(",")[1])-parseInt(n(u).attr("tag").split(":")[0]))+"'], td[p='"+parseInt(n(e).attr("p").split(",")[0])+","+(parseInt(n(e).attr("p").split(",")[1])-parseInt(n(u).attr("tag").split(":")[0]))+"']"),ei=n(v).nextAll().length,k=0;k<=ei;k++)n(v).attr("hc")==r||parseInt(n(v).attr("hc"))<=1?(n(v).removeAttr("hc"),n(v).attr("ch")==r&&n(v).css("display","")):n(v).attr("hc",parseInt(n(v).attr("hc"))-1),v=n(v).next();for(c=n(n(u).closest("tr")[0]).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)"),p=n(u).attr("subTag")!=r&&it?n(u).attr("subTag").split(":")[1]=="true"?parseInt(n(u).attr("subTag").split(":")[0])-1:parseInt(n(u).attr("subTag").split(":")[0]):(n(u).attr("tag").split(":")[1]=="true"?parseInt(n(u).attr("tag").split(":")[0])-1:parseInt(n(u).attr("tag").split(":")[0]))-pt,it&&(p=n(u).attr("subTag")!=r?parseInt(n(u).attr("subTag").split(":")[0])==-1?p:p-1:p-1),s=0;s<c.length;s++)parseInt(n(c[s]).attr("p").split(",")[0])<parseInt(y.split(",")[0])&&parseInt(n(c[s]).attr("p").split(",")[1])+c[s].rowSpan+(n(c[s]).find("span").attr("tag")!=r?parseInt(n(c[s]).find("span").attr("tag")):0)>=parseInt(y.split(",")[1])&&(it&&(it=!1,p=n(n(c[s]).find("span")[0]).attr("subTag")!=r?parseInt(n(n(c[s]).find("span")[0]).attr("subTag").split(":")[0])<=p?p:p+1:p,n(u).attr("isChildSubNode")=="true"&&(p=p-pt,n(u).removeAttr("isChildSubNode"))),c[s].rowSpan+=p,n(c[s]).find("span").attr("tag")!=r&&n(c[s]).find("span").attr("tag",parseInt(n(c[s]).find("span").attr("tag"))-p),parseInt(n(c[s]).find("span").attr("tag"))==0&&n(c[s]).find("span").removeAttr("tag"),n(c[s]).find("span").attr("subTag")!=r&&n(c[s]).find("span").attr("subTag",parseInt(n(c[s]).find("span").attr("subTag"))-p),parseInt(n(c[s]).find("span").attr("subTag"))==0&&n(c[s]).find("span").removeAttr("subTag"));n(e).find(".cellValue").length>0?n(e).find(".cellValue").text(n.trim(n(e).find(".cellValue").text())+" Total"):n(e).text(n.trim(n(e).text())+" Total");n(e).find(".expand").remove();n(e).prepend("<span style='margin-left:10px'><\/span>")}}if(e.className.indexOf("colheader")>=0||e.className.indexOf("summary")>=0&&n(e).attr("role")=="columnheader")if(w=parseInt(y.split(",")[0]),hi=n(i).find("tr"),n(u).attr("class")&&n(u).attr("class").indexOf("collapse")>-1){if(rt=e.colSpan,n(e).next().css("display")=="none"){var dt=n(e).next().attr("p"),d=parseInt(dt.split(",")[0]),ci=n(i).find("tr"),ct=parseInt(n(e).next().attr("colspan"));if(n(e).next().attr("class").indexOf("stot","cstot")>-1)for(f=0;f<ct;f++){for(l=n(o).nextAll().find("th[p^='"+(f+d)+",']"),h=0;h<n(l).length;h++)n(l[h]).css("display","");if(n(l[h]).attr("hc")==r||parseInt(n(l[h]).attr("hc"))<1)for(n(i).find("td[p^='"+(f+d)+",']").css("display",""),b=0;b<n(i).find("td[p^='"+(f+d)+",']").length;b++)(n(n(i).find("td[p^='"+(f+d)+",']")[b]).attr("hc")!=r||n(n(i).find("td[p^='"+(f+d)+",']")[b]).attr("hc")>-1)&&n(n(i).find("td[p^='"+(f+d)+",']")[b]).css("display","none")}n(e).next().css("display","");rt=e.colSpan-ct}for(f=0;f<at;f++)if(l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(o).nextAll().find("td[p^='"+(f+w)+",']"):n(o).nextAll().find("th[p^='"+(f+w)+",']"),l.length!=0){for(h=0;h<n(l).length;h++)n(l[h]).attr("hc",n(l[h]).attr("hc")!=r?parseInt(n(l[h]).attr("hc"))+1:1).css("display","none");(n(l[h]).attr("hc")==r||parseInt(n(l[h]).attr("hc"))<1)&&(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?(n(i).find(".pivotGridValueTable td[p^='"+(f+w)+",']").css("display","none"),n(i).find(".pivotGridValueTable td[p^='0,']:not(.summary)").parent().find("td[p^='"+(f+w)+",']").attr("ch",1)):(n(i).find("td[p^='"+(f+w)+",']").css("display","none"),n(i).find("th[p^='0,']:not(.summary)").parent().find("td[p^='"+(f+w)+",']").attr("ch",1)))}for(n(e).attr("hc",1).css("display","none"),n(e).next().text(n(e).next().text().replace(" Total","")),n(e).next().find("span:not(.cellValue)").remove(),n(e).next().prepend('<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'" tag="'+at+'"> <\/span>'),a=n(o).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)"),f=0;f<a.length;f++)gt=this.model.enableAdvancedFilter&&!t.isNullOrUndefined(n(a[f]).attr("vfcolspan"))?parseInt(n(a[f]).attr("vfcolspan")):a[f].colSpan,parseInt(n(a[f]).attr("p").split(",")[1])<parseInt(y.split(",")[1])&&parseInt(n(a[f]).attr("p").split(",")[0])<=parseInt(y.split(",")[0])&&parseInt(n(a[f]).attr("p").split(",")[0])+gt+(n(a[f]).find("span").attr("tag")!=r?parseInt(n(a[f]).find("span").attr("tag")):0)>=parseInt(y.split(",")[0])+at&&(a[f].colSpan-=rt,n(a[f]).find("span").attr("tag",n(a[f]).find("span").attr("tag")!=r?parseInt(n(a[f]).find("span").attr("tag"))+rt:rt))}else if(n(u).attr("class")&&n(u).attr("class").indexOf("expand")>-1){var ni=0,it=removeCell=this._isSubTotalhidden=!1,nt=0,ct=parseInt(n(e).attr("colspan"));if(this._hideSubTotal(n(o),nt,n(u)),this._isSubTotalHide){removeCell=it=!0;this._isSubTotalHide=!1;var dt=n(e).attr("p"),d=parseInt(dt.split(",")[0]),ci=n(i).find("tr");if(n(e).attr("class").indexOf("stot","cstot")>-1)for(f=0;f<ct;f++){for(g=n(o).nextAll().find("th[p^='"+(f+d)+",']"),h=0;h<n(g).length;h++)n(g[h]).css("display","none");(n(g[h]).attr("hc")==r||parseInt(n(g[h]).attr("hc"))<1)&&n(i).find("td[p^='"+(f+d)+",']").css("display","none")}n(e).css("display","none")}for(rt=at-(ct-1),f=1;f<rt;f++){for(l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(o).nextAll().find("td[p^='"+(w-f)+",']"):n(o).nextAll().find("th[p^='"+(w-f)+",']"),h=0;h<n(l).length;h++){for(removeCell=!1,ut=0;ut<n(l[h]).length;ut++)(n(n(l[h])[ut]).hasClass("stot")||n(n(l[h])[ut]).hasClass("cstot"))&&!n(n(l[h])[ut]).hasClass("calc")&&this._hideSubTotal(n(n(l[h])[ut]),nt,n(u));if(this._isSubTotalHide){removeCell=!0;this._isSubTotalHide=!1;var dt=n(l[h]).attr("p"),d=parseInt(dt.split(",")[0]),ci=n(i).find("tr"),ct=parseInt(n(l[h]).attr("colspan"));if(n(l[h]).attr("class").indexOf("stot","cstot")>-1&&!(n(l[h]).find(".expand").length>0))for(lt=0;lt<ct;lt++){for(g=n(o).nextAll().find("th[p^='"+(lt+d)+",']"),h=0;h<n(g).length;h++)n(g[h]).css("display","none");n(g[h]).attr("hc")==r||parseInt(n(g[h]).attr("hc"))<1?n(i).find("td[p^='"+(lt+d)+",']").css("display","none"):ni++}n(l[h]).css("display","none")}n(l[h]).attr("hc")==r||parseInt(n(l[h]).attr("hc"))==1?(n(l[h]).css("display",""),n(l[h]).removeAttr("hc")):parseInt(n(l[h]).attr("hc"))-1==0?n(l[h]).removeAttr("hc"):n(l[h]).attr("hc",parseInt(n(l[h]).attr("hc"))-1)}if(nt=nt==0?1:nt,!removeCell)if(n(l).last().attr("hc")==r){if(ht=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ht?n(i).find("td[p^='"+(w-f)+",']").css("display",""):n(i).find("td[p^='"+(w-f)+",']").css("display",""),ft=[],ht){for(ti=n(i).find("[p^='0,']:not(.summary)").parent(),yt="",b=0;b<ti.length;b++)yt=yt+(b!=0?" , ":"")+" .pivotGridValueTable td:eq("+n(ti[b]).index()+")";ft=n(i).find(yt)}else ft=n(i).find("[p^='0,']:not(.summary)").parent().find("td[p^='"+(w-f)+",']");for(n(ft).removeAttr("ch"),k=0;k<=n(ft).length;k++)n(ft[k]).attr("hc")!=r&&n(ft[k]).css("display","none")}else ni++}n(e).prev().removeAttr("hc").css("display","");var li=parseInt(n(e).prev().attr("colspan")),ii=parseInt(n(u).attr("tag"))-ni,a=n(o).prevAll().find("th:has(span):not(.summary), td:has(span):not(.summary)");for(it&&(it=!1,oi=n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this._pivotClientObj.getOlapReport():this.getOlapReport(),ii=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?parseInt(n(e).prev().attr("colSpan"))-this.model.dataSource.values.length:parseInt(n(e).prev().attr("colSpan"))-JSON.parse(oi).PivotCalculations.length),f=0;f<a.length;f++)gt=this.model.enableAdvancedFilter&&!t.isNullOrUndefined(n(a[f]).attr("vfcolspan"))?parseInt(n(a[f]).attr("vfcolspan")):a[f].colSpan,parseInt(n(a[f]).attr("p").split(",")[1])<parseInt(y.split(",")[1])&&parseInt(n(a[f]).attr("p").split(",")[0])<parseInt(y.split(",")[0])&&parseInt(n(a[f]).attr("p").split(",")[0])+a[f].colSpan+(n(a[f]).find("span").attr("tag")!=r?parseInt(n(a[f]).find("span").attr("tag")):0)>=parseInt(y.split(",")[0])&&(a[f].colSpan+=ii,n(a[f]).find("span").attr("tag")!=r&&n(a[f]).find("span").attr("tag",parseInt(n(a[f]).find("span").attr("tag"))-ii),parseInt(n(a[f]).find("span").attr("tag"))==0&&n(a[f]).find("span").removeAttr("tag"));n(e).find(".cellValue").length>0?n(e).find(".cellValue").text(n.trim(n(e).find(".cellValue").text())+" Total"):n(e).text(n.trim(n(e).text())+" Total");n(e).find(".expand").remove();n(e).prepend("<span style='margin-left:10px'><\/span>")}},_generateTreeViewData:function(){var n={catalog:this.model.dataSource.catalog,cube:this.model.dataSource.cube,url:this.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"};this._getTreeData(n,this._loadDimensionElements,{pvtGridObj:this,action:"loadFieldElements"})},_dimensionsDetails:function(t,i){t.pvtGridObj._dimension=n(i).find("row")},_loadDimensionElements:function(t,i){var y,s,h,c,u,f,e;t.pvtGridObj._waitingPopup.show();var o,l={},a={},v=t.pvtGridObj._getConnectionInfo(t.pvtGridObj.model.dataSource.data);for(t.pvtGridObj.schemaTreeView=[],t.pvtGridObj.reportItemNames=[],y='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_DIMENSIONS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+t.pvtGridObj.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+t.pvtGridObj.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+t.pvtGridObj.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+v.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",t.pvtGridObj.doAjaxPost("POST",v.url,{XMLA:y},t.pvtGridObj._dimensionsDetails,null,{pvtGridObj:t.pvtGridObj,action:"loadFieldElements"}),s=t.pvtGridObj._dimension,h=0;h<n(i).find("row").length;h++){if(c=n(n(i).find("row")[h]),u=c.find("DIMENSION_UNIQUE_NAME").text(),t.pvtGridObj.model.enableDrillThrough)for(f=0;f<s.length;f++)u==n(s[f]).find("DIMENSION_UNIQUE_NAME").text()&&(o=n(s[f]).find("DIMENSION_CAPTION").text());else o=c.find("DIMENSION_CAPTION").text();u.toLowerCase()=="[measures]"?a={hasChildren:!0,isSelected:!1,id:u,name:o,spriteCssClass:u.toLowerCase()=="[measures]"?"folderCDB e-icon":"dimensionCDB e-icon",tag:u}:!n(n(i).find("row")[0]).find("HIERARCHY_CAPTION").length>0&&(l={hasChildren:!0,isSelected:!1,id:u,name:o,spriteCssClass:"dimensionCDB e-icon",tag:u},t.pvtGridObj.schemaTreeView.push(l))}t.pvtGridObj.schemaTreeView.splice(0,0,a);e={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"};!t.pvtGridObj.model.enableDrillThrough||t.pvtGridObj._schemaData!=r&&t.pvtGridObj._schemaData.model.olap.showNamedSets?(e.request="MDSCHEMA_SETS",t.pvtGridObj._getTreeData(e,t.pvtGridObj._loadNamedSetElements,t)):(e.request="MDSCHEMA_HIERARCHIES",t.pvtGridObj._fieldData.hierarchySuccess==r?t.pvtGridObj._getTreeData(e,t.pvtGridObj._loadHierarchyElements,t):t.pvtGridObj._loadHierarchyElements(t,t.pvtGridObj._fieldData.hierarchySuccess))},_loadNamedSetElements:function(t,i){var f,u;t.pvtGridObj._waitingPopup.show();var s={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},e=t.pvtGridObj.model.dataSource,o=n.map(e.rows,function(n){if(n.fieldName!=r)return n.fieldName});for(n.merge(o,n.map(e.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(o,n.map(e.filters,function(n){if(n.fieldName!=r)return n.fieldName})),measureGroupItems=[],f=0;f<n(i).find("row").length;f++)u=n(n(i).find("row")[f]),n.inArray(u.find("DIMENSIONS").text().split(".")[0],measureGroupItems)>=0||(treeNodeElement={hasChildren:!0,isSelected:!1,pid:u.find("DIMENSIONS").text().split(".")[0],id:u.find("SET_DISPLAY_FOLDER").text()+"_"+u.find("DIMENSIONS").text().split(".")[0],name:u.find("SET_DISPLAY_FOLDER").text(),spriteCssClass:"folderCDB e-icon namedSets"},t.pvtGridObj.schemaTreeView.push(treeNodeElement),measureGroupItems.push(u.find("DIMENSIONS").text().split(".")[0])),treeNodeElement={hasChildren:!0,isSelected:n.inArray("["+n.trim(u.children("SET_NAME").text())+"]",o)>=0,pid:u.find("SET_DISPLAY_FOLDER").text()+"_"+u.find("DIMENSIONS").text().split(".")[0],id:"["+n.trim(u.children("SET_NAME").text()).replace(/\&/g,"&")+"]",name:u.children("SET_CAPTION").text(),spriteCssClass:"namedSetCDB e-icon",tag:u.find("EXPRESSION").text()},t.pvtGridObj.schemaTreeView.push(treeNodeElement);s.request="MDSCHEMA_HIERARCHIES";t.pvtGridObj._fieldData.hierarchySuccess==r?t.pvtGridObj._getTreeData(s,t.pvtGridObj._loadHierarchyElements,t):t.pvtGridObj._loadHierarchyElements(t,t.pvtGridObj._fieldData.hierarchySuccess)},_loadHierarchyElements:function(t,i){var h,a,f;t.pvtGridObj._waitingPopup.show();var l={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},o=t.pvtGridObj.model.dataSource,s=n.map(o.rows,function(n){if(n.fieldName!=r)return n.fieldName});for(n.merge(s,n.map(o.columns,function(n){if(n.fieldName!=r)return n.fieldName})),n.merge(s,n.map(o.filters,function(n){if(n.fieldName!=r)return n.fieldName})),h={},a="",f=0;f<n(i).find("row").length;f++){var u=n(n(i).find("row")[f]),c=u.find("DIMENSION_UNIQUE_NAME").text(),e=u.find("HIERARCHY_UNIQUE_NAME").text(),v=n(t.pvtGridObj.schemaTreeView).filter(function(n,t){return t.tag==c}).map(function(n,t){return t});v.length>0&&c!=e&&(h={hasChildren:!0,isSelected:n.inArray(e,s)>=0,pid:c,id:e,name:u.find("HIERARCHY_CAPTION").text(),spriteCssClass:u.find("HIERARCHY_ORIGIN").text()!="2"&&u.find("HIERARCHY_ORIGIN").text()!="6"?"hierarchyCDB e-icon":"attributeCDB e-icon",tag:e},t.pvtGridObj.schemaTreeView.push(h))}l.request="MDSCHEMA_LEVELS";t.pvtGridObj._getTreeData(l,t.pvtGridObj._loadLevelElements,t)},_loadLevelElements:function(i,r){var u,r;i.pvtGridObj._waitingPopup.show();u=n.map(n(r).find("row"),function(t){if(parseInt(n(t).children("LEVEL_TYPE").text())!="1"&&n(t).children("HIERARCHY_UNIQUE_NAME").text().toLowerCase()!="[measures]")return treeNodeElement={hasChildren:!1,isChecked:!1,id:n(t).find("LEVEL_UNIQUE_NAME").text(),pid:n(t).find("HIERARCHY_UNIQUE_NAME").text(),name:n(t).find("LEVEL_CAPTION").text(),spriteCssClass:"level"+parseInt(n(t).children("LEVEL_NUMBER").text())+" e-icon",tag:n(t).find("LEVEL_UNIQUE_NAME").text()}});n.merge(i.pvtGridObj.schemaTreeView,u);!i.pvtGridObj.model.enableDrillThrough&&i.pvtGridObj._fieldData.measureSuccess?i.pvtGridObj._fieldData.measureSuccess?i.pvtGridObj._loadMeasureElements(i,i.pvtGridObj._fieldData.measureSuccess):(r={catalog:i.pvtGridObj.model.dataSource.catalog,cube:i.pvtGridObj.model.dataSource.cube,url:i.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_MEASURES"},i.pvtGridObj._getTreeData(r,i.pvtGridObj._loadMeasureElements,i)):t.Pivot._createDrillThroughDialog(i.pvtGridObj,i.pvtGridObj.schemaTreeView)},_loadMeasureGroups:function(t,i){t.pvtGridObj._fieldData.measuresGroups=n(i).find("row")},_loadMeasureElements:function(t,i){var e={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_DIMENSIONS"},a=t.pvtGridObj.model.dataSource,v=n.map(a.values,function(n){if(n.measures!=r)return n.measures}),s,y,h,o,l;for(this.reportItemNames=n.map(v,function(n){if(n.fieldName!=r)return n.fieldName}),s=[],y="",t.pvtGridObj.model.locale!="en-US"&&(e={catalog:t.pvtGridObj.model.dataSource.catalog,cube:t.pvtGridObj.model.dataSource.cube,url:t.pvtGridObj.model.dataSource.data,request:"MDSCHEMA_MEASUREGROUPS"},t.pvtGridObj._getTreeData(e,this._loadMeasureGroups,{pvtGridObj:this,action:"loadFieldElements"})),o=0;o<n(i).find("row").length;o++){var c=n(n(i).find("row")[o]),u=c.children("MEASUREGROUP_NAME").text(),f=c.find("MEASURE_UNIQUE_NAME").text();n.inArray(u,s)>=0||(t.pvtGridObj.model.locale!="en-US"?(l=n.map(t.pvtGridObj._fieldData.measuresGroups,function(t){if(n(t).children("MEASUREGROUP_NAME").text()==u)return n(t).children("MEASUREGROUP_CAPTION").text()}),h=l.length>0?l[0]:u):h=u,treeNodeElement={hasChildren:!0,isChecked:!1,pid:"[Measures]",id:u,name:h,spriteCssClass:"measureGroupCDB e-icon",tag:u},t.pvtGridObj.schemaTreeView.push(treeNodeElement),s.push(u));treeNodeElement={hasChildren:!0,isSelected:n.inArray(f,this.reportItemNames)>=0,id:f,pid:u,name:c.children("MEASURE_CAPTION").text(),spriteCssClass:"measure",tag:f};t.pvtGridObj.schemaTreeView.push(treeNodeElement);n.inArray(f,t.pvtGridObj.reportItemNames)>=0&&t.pvtGridObj.reportItemNames.splice(t.pvtGridObj.reportItemNames.indexOf(f),1)}t.pvtGridObj._schemaData.model.olap.showKpi?(treeNodeElement={hasChildren:!0,isChecked:!1,id:"folderStruct",name:"KPI",spriteCssClass:"KPICDB folderCDB e-icon",tag:""},t.pvtGridObj.schemaTreeView.splice(1,0,treeNodeElement),e.request="MDSCHEMA_KPIS",t.pvtGridObj._getTreeData(e,t.pvtGridObj._loadKPIElements,t)):t.pvtGridObj._schemaData._createTreeView(this,t.pvtGridObj.schemaTreeView)},_loadKPIElements:function(t,i){for(var a=t.pvtGridObj.model.dataSource,f=this.reportItemNames,l=[],e=0;e<n(i).find("row").length;e++){var u=n(n(i).find("row")[e]),r=u.children("KPI_CAPTION").text(),o=u.children("KPI_goal").text(),s=u.children("KPI_STATUS").text(),h=u.children("KPI_TREND").text(),c=u.find("KPI_VALUE").text();n.inArray(u.children("KPI_NAME").text(),l)>=0||(treeNodeElement={hasChildren:!0,isChecked:!1,pid:"folderStruct",id:r,name:r,spriteCssClass:"measureGroupCDB e-icon",tag:r},t.pvtGridObj.schemaTreeView.push(treeNodeElement),l.push(r));treeNodeElement={hasChildren:!0,isSelected:n.inArray(o,f)>=0,id:o,pid:r,name:t.pvtGridObj._getLocalizedLabels("Goal"),spriteCssClass:"kpiGoal e-icon",tag:o};t.pvtGridObj.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(s,f)>=0,id:s,pid:r,name:t.pvtGridObj._getLocalizedLabels("Status"),spriteCssClass:"kpiStatus e-icon",tag:s};t.pvtGridObj.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(h,f)>=0,id:h,pid:r,name:t.pvtGridObj._getLocalizedLabels("Trend"),spriteCssClass:"kpiTrend e-icon",tag:h};t.pvtGridObj.schemaTreeView.push(treeNodeElement);treeNodeElement={hasChildren:!0,isSelected:n.inArray(c,f)>=0,id:c,pid:r,name:t.pvtGridObj._getLocalizedLabels("Value"),spriteCssClass:"kpiValue e-icon",tag:c};t.pvtGridObj.schemaTreeView.push(treeNodeElement)}t.pvtGridObj._schemaData._createTreeView(this,t.pvtGridObj.schemaTreeView);delete t.pvtGridObj.reportItemNames;delete t.pvtGridObj.schemaTreeView},_getTreeData:function(n,i,r){var u=t.olap.base._getConnectionInfo(n.url),f='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>'+n.request+"<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>"+n.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><LocaleIdentifier>"+u.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";this.doAjaxPost("POST",u.url,{XMLA:f},i,null,r)},_addHyperlink:function(i){if(n(".hyperlinkValueCell")[0]&&n(n(".hyperlinkValueCell")[0]).removeClass("hyperlinkValueCell"),n(".hyperlinkHeaderCell")[0]&&n(n(".hyperlinkHeaderCell")[0]).removeClass("hyperlinkHeaderCell"),n(i.target).text()==""||n(i.target).text()==null)return!1;i.target.parentElement.className.replace(/^\s+/,"").split(" ")[0]=="value"&&(this.enableValueCellHyperlink()||(t.isNullOrUndefined(this._pivotClientObj)?this.model.enableDrillThrough:this._pivotClientObj.model.enableDrillThrough))?n(i.target).addClass("hyperlinkValueCell"):n(i.target.parentElement).hasClass("summary value")&&this.enableSummaryCellHyperlink()?n(i.target).addClass("hyperlinkValueCell"):i.target.parentElement.className.split(" ")[0]=="rowheader"||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&n(i.target.parentElement).attr("role")=="rowheader"?this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot||this.model.enableDeferUpdate||n(this.element).parents(".e-pivotclient").length!=0?this.enableRowHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell"):n(i.target.parentElement).hasClass("rgtot")||(fieldIndex=n(i.target.parentElement).attr("p").split(",")[0],this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&!t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotRows[fieldIndex])&&JSON.parse(this.getOlapReport()).PivotRows[fieldIndex].EnableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.dataSource.rows.length>0&&!t.isNullOrUndefined(this.model.dataSource.rows[fieldIndex].enableHyperlink)&&this.model.dataSource.rows[fieldIndex].enableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.enableRowHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell")):(i.target.parentElement.className.split(" ")[0]=="colheader"||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&n(i.target.parentElement).attr("role")=="columnheader")&&(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot||this.model.enableDeferUpdate||n(this.element).parents(".e-pivotclient").length!=0?this.enableColumnHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell"):n(i.target.parentElement).hasClass("calc")||n(i.target.parentElement).hasClass("cgtot")||n(i.target.parentElement).hasClass("gtot")||(fieldIndex=n(i.target.parentElement).attr("p").split(",")[1],this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&!t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotColumns[fieldIndex])&&JSON.parse(this.getOlapReport()).PivotColumns[fieldIndex].EnableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&!t.isNullOrUndefined(this.model.dataSource.columns[fieldIndex].enableHyperlink)&&this.model.dataSource.columns[fieldIndex].enableHyperlink?n(i.target).addClass("hyperlinkHeaderCell"):this.enableColumnHeaderHyperlink()&&n(i.target).addClass("hyperlinkHeaderCell")))},_removeHyperlink:function(t){n(t.target).removeClass("hyperlinkValueCell").removeClass("hyperlinkHeaderCell")},_cellContext:function(i){var r=n(i.target).parents(".e-pivotgrid").data("ejPivotGrid"),u=(n(i.target).hasClass("cellValue")?n(i.target).parent()[0]:i.target)||(n(i.srcElement).hasClass("cellValue")?n(i.srcElement).parent()[0]:i.srcElement),f;if(!t.isNullOrUndefined(r)&&r.enableCellContext()==!0&&n(u).parents("#"+r._id)[0]&&(f=n(u).attr("p"),f)){var f=r._excelLikeJSONRecords!=null&&r.model.layout.toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?n(u).attr("i"):n(u).attr("p"),e=r._excelLikeJSONRecords!=null&&r.model.layout.toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?r._excelLikeJSONRecords[parseInt(parseInt(f.split(",")[0])*r._excelRowCount+parseInt(f.split(",")[1]))].Info:r.getJSONRecords()[parseInt(parseInt(f.split(",")[0])*r._rowCount+parseInt(f.split(",")[1]))].Info,o={cellValue:u.innerHTML,cellPosition:f,cellType:u.className.split(" ")[0]!=""?u.className.split(" ")[0]:u.className.split(" ")[1],role:n(u).attr("role"),uniqueName:e.split("::")[0],args:i,rawdata:e};o.cellType!=""&&r._trigger("cellContext",{args:o});i.target?i.preventDefault():window.event.returnValue=!1}},_initCellSelection:function(i){var r,u;n("#"+this._id+" td,th").removeClass("highlighted");this._on(this.element,"mouseup touchend",".value",this._completeCellSelection);_oriX=i.pageX;_oriY=i.pageY;r=i.target||window.event.srcElement;n(r).hasClass("cellValue")&&(r=r.parentElement);n(".value").addClass("selection");n("#"+this._id).append(t.buildTag("div.cellSelection#"+this._id+"_cellSelection","",{}));_startPosCell=n(r)[0].attributes.getNamedItem("p").value;this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&(u=this._excelLikeJSONRecords[0*this._rowCount+parseInt(n(r)[0].attributes.getNamedItem("i").value.split(",")[1])].Index,_startPosCell=this.getJSONRecords()[parseInt(n(r)[0].attributes.getNamedItem("p").value.split(",")[0])*this._rowCount+parseInt(u.split(",")[1])].Index);this._on(this.element,"mousemove touchmove",".value, .cellSelection",this._cellSelection)},_headerClickCellSelection:function(i){var r=n(i.target).attr("class").indexOf("colheader")&&n(i.target).attr("class").indexOf("rowheader")==-1?n(i.target).attr("class").indexOf("cellValue")!=-1?n(i.target).parent():null:n(i.target),s,o,h;if(r!=null){n("#"+this._id+" td,th").removeClass("highlighted");var f,e,u;for(f=r.attr("role"),u=f=="columnheader"?r.attr("p").split(",")[0]:r.attr("p").split(",")[1],e=f=="columnheader"?r.attr("colspan"):r.attr("rowspan"),this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&(s=parseInt(r.attr("p").split(",")[0])*this._rowCount+parseInt(r.attr("p").split(",")[1]),e=f=="columnheader"?this._excelLikeJSONRecords[parseInt(r.attr("i").split(",")[0])*this._rowCount+parseInt(r.attr("i").split(",")[1])].ColSpan:this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.getJSONRecords()[s+this._rowCount]!=null&&this.getJSONRecords()[s+this._rowCount].CSS.indexOf("value")==-1?this.getJSONRecords()[s].RowSpan+1:this.getJSONRecords()[s].RowSpan),o=0;o<e;o++)f=="columnheader"?(n("#"+this._id+" [p^='"+(parseInt(o)+parseInt(u))+",']").addClass("highlighted"),n("#"+this._id+" [p^='"+(parseInt(o)+parseInt(u))+",'][role='columnheader']").each(function(t,i){(parseInt(i.attributes.p.value.split(",")[1])<=parseInt(r.attr("p").split(",")[1])||parseInt(i.attributes.colspan.value)>parseInt(r.attr("colspan")))&&n(i).removeClass("highlighted")})):(n("#"+this._id+" [p$=',"+(parseInt(o)+parseInt(u))+"']").addClass("highlighted"),n("#"+this._id+" [p$=',"+(parseInt(o)+parseInt(u))+"'][role='rowheader']").each(function(t,i){(parseInt(i.attributes.p.value.split(",")[0])<=parseInt(r.attr("p").split(",")[0])||parseInt(i.attributes.rowspan.value)>parseInt(r.attr("rowspan")))&&n(i).removeClass("highlighted")}));_startPosCell=f=="columnheader"?n("#"+this._id+" [p^='"+(0+parseInt(u))+",'].value").eq(0).attr("p"):n("#"+this._id+" [p$=',"+(0+parseInt(u))+"'].value").eq(0).attr("p");this._excelLikeJSONRecords==null||this.layout().toLowerCase()!=t.PivotGrid.Layout.ExcelLikeLayout||this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||(_startPosCell=f=="columnheader"?n("#"+this._id+" [p^='"+(0+parseInt(u))+",'].value:not(.summary)").eq(0).attr("p"):n("#"+this._id+" [p$=',"+(0+parseInt(u))+"'].value:not(.summary)").eq(0).attr("p"));h=f=="columnheader"?n("#"+this._id+" [p^='"+(parseInt(e)-1+parseInt(u))+",']").eq(n("#"+this._id+" [p^='"+(parseInt(e)-1+parseInt(u))+",']").length-1):n("#"+this._id+" [p$=',"+(parseInt(e)-1+parseInt(u))+"']").eq(n("#"+this._id+" [p$=',"+(parseInt(e)-1+parseInt(u))+"']").length-1);this._completeCellSelection(h)}},_cellSelection:function(i){n("#"+this._id+"_gridTooltip").hide();var r=n(i.target).parents(".e-pivotclient").length>0,u=i.pageX-this.element.offset().left-(_oriX-this.element.offset().left),f=i.pageY-this.element.offset().top-(_oriY-this.element.offset().top),e=_oriX-this.element.offset().left,o=_oriY-this.element.offset().top+3;u<0&&(u=Math.abs(u),e-=u-5);f<0&&(f=Math.abs(f),o-=f-12);i.pageX<_oriX?n("#"+this._id+"_cellSelection").css({left:r?e:i.pageX+2,width:r?u:_oriX-i.pageX}):n("#"+this._id+"_cellSelection").css({left:r?e:_oriX-6,width:r?u:i.pageX-_oriX});i.pageY<_oriY?n("#"+this._id+"_cellSelection").css({top:r?o:i.pageY,height:r?f:_oriY-i.pageY-7}):n("#"+this._id+"_cellSelection").css({top:r?o:_oriY+7,height:r?f:i.pageY-_oriY-11});n(".pivotGridTable").mouseleave(function(i){var r=n(i.target).parents(".e-pivotgrid").data("ejPivotGrid");t.isNullOrUndefined(i.toElement)||t.isNullOrUndefined(i.toElement.classList)||i.toElement.classList[0]!="e-pivotgrid"||(n("#"+r._id+"_cellSelection").remove(),n(".value").removeClass("selection"),r._off(r.element,"mouseup mouseend",".value"))})},_completeCellSelection:function(i){var h,e,k=[],tt=[],u,it=[],c,ot,v,o,l,y,a,ut,p,s,b,g,ft,nt,et;for(this._off(this.element,"mousemove touchmove",".value"),n(".value").removeClass("selection"),h=n(i).hasClass("value")?i:i.target||window.event.srcElement,n(h).hasClass("cellValue")&&(h=h.parentElement),e=n(h)[0].attributes.getNamedItem("p").value,this._excelLikeJSONRecords==null||this.layout().toLowerCase()!=t.PivotGrid.Layout.ExcelLikeLayout||n(i).hasClass("value")||(ot=this._excelLikeJSONRecords[0*this._rowCount+parseInt(n(h)[0].attributes.getNamedItem("i").value.split(",")[1])].Index,e=this.getJSONRecords()[parseInt(n(h)[0].attributes.getNamedItem("p").value.split(",")[0])*this._rowCount+parseInt(ot.split(",")[1])].Index),v=0,o=parseInt(_startPosCell.split(",")[1])<parseInt(e.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(e.split(",")[1]);o<=(parseInt(_startPosCell.split(",")[1])>parseInt(e.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(e.split(",")[1]));o++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("td[p*=',"+o+"']").parent().is(":visible"))for(l=parseInt(_startPosCell.split(",")[0])<parseInt(e.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(e.split(",")[0]);l<=(parseInt(_startPosCell.split(",")[0])>parseInt(e.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(e.split(",")[0]));l++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("[p*='"+l+",']").last("th").is(":Visible")){k[v]=this.getJSONRecords()[l*this._rowCount+o];var f,w="",rt,st,d=0,ht=0;if(u=this.element.find(".summary[role!='gridcell'][p$=',"+o+"'] , .rowheader[role!='gridcell'][p$=',"+o+"']").last().attr("p"),u==r&&(u=n("#"+this._id).find("tbody").find('[p="'+l+","+o+'"]').parent("tr").find(".summary").first().attr("p")),rt=u,u!=null){while(u[0]>=0)u==this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Index&&(f=this.getJSONRecords()[parseInt(parseInt(u.split(",")[0])*this._rowCount+parseInt(u.split(",")[1]))].Value,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(f=n("#"+this._id).find("td[p*='"+l+","+o+"']").prevAll("th").children(".expand").length>0?f.replace(this._getLocalizedLabels("Total"),""):f),u=parseInt(u.split(",")[0])-1+","+parseInt(u.split(",")[1])),w&&f!=""?w=f+"##"+w:f!=""&&(w=f);tt[v]=w}for(y="",ut=this.element.find('tr:has(".colheader")').length-1,st=ut,c=k[v].Index,c!=r&&c==this.getJSONRecords()[parseInt(parseInt(c.split(",")[0])*this._rowCount+parseInt(c.split(",")[1]))].Index&&(p=parseInt(c.split(",")[0])),s=0;s<=ut;s++){if(p!=null&&p+","+s==this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+s)].Index){if(a=this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+s)].Value,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(b=p;b>=0;b--)if(n("#"+this._id).find("th[p*='"+b+","+s+"']").length>0){a=n("#"+this._id).find("th[p*='"+b+","+s+"']").find(".expand").length>0?a.replace(this._getLocalizedLabels("Total"),""):a;break}y==""?y=a:a!=""&&(y=y+"##"+a)}it[v]=y}v++}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap){for(g=this.getJSONRecords()[parseInt(parseInt(rt.split(",")[0])*this._rowCount+parseInt(rt.split(",")[1]))].Info;g[0]>=0;)f=this.getJSONRecords()[parseInt(parseInt(g.split(",")[0])*this._rowCount+parseInt(g.split(",")[1]))].Info,(f.split("::")[0].indexOf("Measures")>0||f.split("::")[0].indexOf("MEASURES")>0)&&d++,u=parseInt(u.split(",")[0])-1+","+parseInt(u.split(",")[1]);if(ft=parseInt(c.split(",")[0]),d==0)for(nt=0;nt<=st;nt++)ft!=null&&(et=this.getJSONRecords()[parseInt(parseInt(ft)*this._rowCount+nt)].Info),(et.split("::")[0].indexOf("Measures")>0||et.split("::")[0].indexOf("MEASURES")>0)&&ht++}else measureCount=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this.getOlapReport()).PivotCalculations.length:this.model.dataSource.values.length;args={JSONRecords:k,rowHeader:tt,columnHeader:it,measureCount:d>0?"Row:"+d:"Column:"+ht};this._trigger("cellSelection",args);k=tt=it=[];n("#"+this._id+"_cellSelection").remove();this.model.enableToolTip&&this._on(this.element,"mousemove touchmove",".value",this._applyToolTip);this._off(this.element,"mouseup touchend",".value")},exportPivotGrid:function(i,u){var f={url:"",fileName:"PivotGrid",exportMode:t.PivotGrid.ExportMode.JSON,title:"",description:"",exportType:i,controlName:this},o,h,c,s,e;if(this._trigger("beforeExport",f),o={rowCellColor:t.isNullOrUndefined(this.element.find(".rowheader"))?"":t.isNullOrUndefined(this.element.find(".rowheader").css("color"))?"rgb(51, 51, 51)":this.element.find(".rowheader").css("color"),rowCellBGColor:t.isNullOrUndefined(this.element.find(".rowheader"))?"":t.isNullOrUndefined(this.element.find(".rowheader").css("background-color"))?"rgb(255, 255, 255)":this.element.find(".rowheader").css("background-color"),columnCellColor:t.isNullOrUndefined(this.element.find(".colheader"))?"":t.isNullOrUndefined(this.element.find(".colheader").css("color"))?"rgb(51, 51, 51)":this.element.find(".colheader").css("color"),columnCellBGColor:t.isNullOrUndefined(this.element.find(".colheader"))?"":t.isNullOrUndefined(this.element.find(".colheader").css("background-color"))?"rgb(255, 255, 255)":this.element.find(".colheader").css("background-color"),valueCellColor:t.isNullOrUndefined(this.element.find(".value"))?"":t.isNullOrUndefined(this.element.find(".value").css("color"))?"rgb(51, 51, 51)":this._cFormat.length<=0?this.element.find(".value").css("color"):"rgb(51, 51, 51)",valueCellBGColor:t.isNullOrUndefined(this.element.find(".value"))?"":t.isNullOrUndefined(this.element.find(".value").css("background-color"))?"rgb(255, 255, 255)":this._cFormat.length<=0?this.element.find(".value").css("background-color"):"rgb(255, 255, 255)",summaryCellColor:t.isNullOrUndefined(this.element.find(".summary"))?"":t.isNullOrUndefined(this.element.find(".summary").css("color"))?"rgb(51, 51, 51)":this.element.find(".summary").css("color"),summaryCellBGColor:t.isNullOrUndefined(this.element.find(".summary"))?"":t.isNullOrUndefined(this.element.find(".summary").css("background-color"))?"rgb(255, 255, 255)":this.element.find(".summary").css("background-color")},this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode||f.exportMode==t.PivotGrid.ExportMode.JSON)e={args:JSON.stringify({pGridData:this.exportRecords!=null&&this.exportRecords!=""?this.exportRecords:null,rowCount:this._excelLikeJSONRecords!=null?this._excelRowCount:this._rowCount,columnCount:this._excelLikeJSONRecords!=null?Math.floor(this._excelLikeJSONRecords.length/this._excelRowCount):this.getJSONRecords()!=null?Math.floor(this.getJSONRecords().length/this._rowCount):0,fileName:t.isNullOrUndefined(u)?t.isNullOrUndefined(f.fileName)?"PivotGrid":f.fileName:u,colorSettings:o,Formatting:this._cFormat,title:f.title,description:f.description,customObject:JSON.stringify(this.model.customObject)})},t.raiseWebFormsServerEvents&&(i=="excelExport"||i=="wordExport"||i=="pdfExport"||i=="csvExport")&&f.exportMode==t.PivotGrid.ExportMode.JSON&&n.trim(f.url)==""?(h={model:this.model,originalEventType:i},c=e,t.raiseWebFormsServerEvents(i,h,c),setTimeout(function(){t.isOnWebForms=!0},1e3)):this.doPostBack(n.trim(f.url)!=""?f.url:i,e);else{try{s=JSON.parse(this.getOlapReport()).Report}catch(l){s=this.getOlapReport()}e={args:JSON.stringify({exportOption:i,currentReport:s,layout:this.layout(),colorSettings:o!=r?JSON.stringify(o):"",customObject:JSON.stringify(this.model.customObject),title:f.title,description:f.description})};this.doPostBack(n.trim(f.url)!=""?f.url:this.model.url+"/"+this.model.serviceMethodSettings.exportPivotGrid,e)}},_createCalculatedField:function(){var i,r;t.Pivot.openPreventPanel(this);this.element.find(".calculatedFieldPopup",".clientDialog",".e-dialog").remove();dialogTitle=this._getLocalizedLabels("CalculatedField");var u=t.buildTag("label#"+this._id+"_lblCalFieldName",this._getLocalizedLabels("Name"))[0].outerHTML,f=t.buildTag("span.fieldDropDown",t.buildTag("input#"+this._id+"_calculateFieldList","",{},{type:"text"})[0].outerHTML+t.buildTag("input#"+this._id+"_calculateFieldName.calculateFieldName","",{"margin-left":this.model.enableRTL?"56px":"2px",outline:"none"},{type:"text"})[0].outerHTML,{})[0].outerHTML,e=t.buildTag("button#"+this._id+"_btnAdd",this._getLocalizedLabels("Add"),{"margin-top":"-5px"},{name:this._getLocalizedLabels("Add")})[0].outerHTML,o=t.buildTag("label#"+this._id+"_lblCalFieldFormula",this._getLocalizedLabels("Formula"))[0].outerHTML,s=t.buildTag("input.calculatedFieldFormula#"+this._id+"_calculatedFieldFormula","",{width:"192px",height:"27px"},{type:"text",disabled:"disabled"})[0].outerHTML,h=t.buildTag("button#"+this._id+"_btnDelete",this._getLocalizedLabels("Delete"),{"margin-top":"-24px"},{name:this._getLocalizedLabels("Delete")})[0].outerHTML,c=t.buildTag("label#"+this._id+"_pivotGridValueFields",this._getLocalizedLabels("Fields"))[0].outerHTML,l=t.buildTag("ul#"+this._id+"_fieldCollection","")[0].outerHTML,a=t.buildTag("button.calculatorFields","",{"margin-left":this.model.enableRTL?"0px":"10px","margin-right":this.model.enableRTL?"10px":"0px"})[0].outerHTML,v=t.buildTag("span.editFormula e-icon e-cancel","",{padding:"3px","margin-left":"-54px","margin-right":this.model.enableRTL?"-54px":"0px",position:"relative"}).attr("aria-label","cancel")[0].outerHTML,y=t.buildTag("span",t.buildTag("button#"+this._id+"_btnInsert",this._getLocalizedLabels("InsertField"),{},{name:this._getLocalizedLabels("InsertField")})[0].outerHTML,{"margin-right":"150px","margin-left":"150px"})[0].outerHTML,p=t.buildTag("button#"+this._id+"_btnOk",this._getLocalizedLabels("OK"),{"margin-left":"10px"},{name:this._getLocalizedLabels("OK")})[0].outerHTML,w=t.buildTag("button#"+this._id+"_btnCancel",this._getLocalizedLabels("Cancel"),{"margin-left":this.model.enableRTL?"0px":"10px"},{name:this._getLocalizedLabels("Cancel")})[0].outerHTML;dialogFooter=t.buildTag("div",p+w,{float:this.model.enableRTL?"left":"right","margin-bottom":"15px","margin-top":"4px"})[0].outerHTML;var b=t.buildTag("div.calcFormulaDiv",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td","+")[0].outerHTML+t.buildTag("td","-")[0].outerHTML+t.buildTag("td","*")[0].outerHTML+t.buildTag("td","/")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","7")[0].outerHTML+t.buildTag("td","8")[0].outerHTML+t.buildTag("td","9")[0].outerHTML+t.buildTag("td","%")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","4")[0].outerHTML+t.buildTag("td","5")[0].outerHTML+t.buildTag("td","6")[0].outerHTML+t.buildTag("td","^")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","1")[0].outerHTML+t.buildTag("td","2")[0].outerHTML+t.buildTag("td","3")[0].outerHTML+t.buildTag("td","(")[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",".")[0].outerHTML+t.buildTag("td","0")[0].outerHTML+t.buildTag("td","C")[0].outerHTML+t.buildTag("td",")")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{display:"none"})[0].outerHTML,k=t.buildTag("div#calculatedField.dlgCalculatedField",'<table class="outerTable"><tr><td>'+u+"<\/td><td>"+f+"<\/td><td>"+e+"<\/td><\/tr><tr><td>"+o+"<\/td><td>"+s+a+v+"<\/td><td>"+h+'<\/td><\/tr><\/table><p class="borderLine"><\/p><table class="fieldTable"><tr><td>'+c+"<\/td><\/tr><tr><td>"+l+"<\/td><\/tr><tr><td>"+y+"<\/td><\/tr><\/table>")[0].outerHTML,d=t.buildTag("div#clientDialog.clientDialog",k+dialogFooter+b,{opacity:"1"}).attr("title",dialogTitle)[0].outerHTML;n(d).appendTo("#"+this._id);this.element.find(".clientDialog").ejDialog({width:"auto",target:"#"+this._id,enableRTL:this.model.enableRTL,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)});n("#"+this._id+"_btnAdd,#"+this._id+"_btnDelete,#"+this._id+"_btnOk,#"+this._id+"_btnCancel").ejButton({type:t.ButtonType.Button,width:"80",enableRTL:this.model.enableRTL});n("#"+this._id+"_btnInsert").ejButton({type:t.ButtonType.Button,enabled:!1,width:"100",enableRTL:this.model.enableRTL});n(".calculatorFields").ejButton({type:t.ButtonType.Button,contentType:"imageonly",prefixIcon:"e-icon e-sigma",htmlAttributes:{title:"Click Me"},enableRTL:this.model.enableRTL});n("#"+this._id+"_calculateFieldList").ejDropDownList({width:"230px",enableRTL:this.model.enableRTL,dataSource:this._calculatedField,fields:{text:"name",value:"name"},select:t.proxy(this._calculatedFieldListChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});i=[];this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(JSON.parse(this.getOlapReport()).PivotCalculations).each(function(){this.CalculationType!=8&&this.CalculationType!="Formula"&&i.push({fields:this.FieldName})}):n(n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1})).each(function(){i.push({fields:this.fieldName})});r=n("#"+this._id+"_btnInsert").data("ejButton");this._calculatedField.length==0&&(n("#"+this._id+"_btnOk").ejButton("disable"),n("#"+this._id+"_btnOk").attr("disabled","disabled"));n("#"+this._id+"_fieldCollection").ejListBox({dataSource:i,enableRTL:this.model.enableRTL,select:function(){r.enable()},height:"130",width:"400"});r.disable();this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"));n(".calculatorFields").click(function(){n("div.calcFormulaDiv").removeAttr("style")});n(".editFormula").click(function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i=n("#"+t._id+"_calculatedFieldFormula").val().lastIndexOf(" ");n("#"+t._id+"_calculatedFieldFormula").val()!==""&&i>0?i+1==n("#"+t._id+"_calculatedFieldFormula").val().length?n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val().substring(0,i-2)):n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val().substring(0,i)+" "):n("#"+t._id+"_calculatedFieldFormula").val("")});n(document).click(function(t){n(t.target).hasClass("calculatorFields")||n(t.target).hasClass("e-sigma")||n(t.target).parents(".calcFormulaDiv").length>0||n("div.calcFormulaDiv").css("display","none")});n("div.calcFormulaDiv").on("click","td",function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i=this.textContent=="C"?n("#"+t._id+"_calculatedFieldFormula").val(""):n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val()+("+-/%^*".indexOf(this.textContent)>-1?" "+this.textContent+" ":this.textContent))});n("#"+this._id+"_btnInsert").click(function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i=n("#"+t._id+"_fieldCollection").data("ejListBox");n("#"+t._id+"_calculatedFieldFormula").val(n("#"+t._id+"_calculatedFieldFormula").val()+i.value())});n("#"+this._id+"_btnAdd").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),r=n("#"+i._id+"_calculatedFieldFormula").val().split(" "),o=-1,f,s,e,u;if(n("#"+i._id+"_calculateFieldName").val()==""||n("#"+i._id+"_calculatedFieldFormula").val()==""){t.Pivot._createErrorDialog(i._getLocalizedLabels("EmptyField"),i._getLocalizedLabels("Warning"),i);return}for(u=0;u<r.length;u++){if(o="+-/%^*".indexOf(r[u])>-1?u:-1,o>-1&&r.length>0&&(r[0]==""||r[0]=="."||r[r.length-1]==""||r[r.length-1]=="."||r[o+1]==""||r[o+1]==".")){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotValid"),i._getLocalizedLabels("Warning"),i);return}if(r[u].indexOf("(")==r[u].length-1||r[u].indexOf(")")==0||n("#"+i._id+"_calculatedFieldFormula").val().replace(/[^\(_]/g,"").length!=n("#"+i._id+"_calculatedFieldFormula").val().replace(/[^\)_]/g,"").length){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotValid"),i._getLocalizedLabels("Warning"),i);return}}for(f=[],i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n(JSON.parse(i.getOlapReport()).PivotCalculations).each(function(){this.CalculationType!=8&&this.CalculationType!="Formula"&&f.push({fields:this.FieldName})}):n(i.model.dataSource.values).each(function(){f.push({fields:this.fieldName})}),r=n("#"+i._id+"_calculatedFieldFormula").val().replace(/\(|\)/g," ").split(" "),u=0;u<r.length;u++){for(s=!1,e=0;e<f.length;e++)if(r[u].indexOf(f[e].fields)>-1&&r[u]!=f[e].fields)s=!0;else if(r[u]==f[e].fields){s=!1;break}if(s){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotPresent"),i._getLocalizedLabels("Warning"),i);return}}for(u=0;u<i._calculatedField.length;u++)if(i._calculatedField[u].name==n("#"+i._id+"_calculateFieldName").val()){if(confirm(i._getLocalizedLabels("Confirm"))){i._calculatedField[u].formula=n("#"+i._id+"_calculatedFieldFormula").val();n("#"+i._id+"_calculatedFieldFormula").val("");n("#"+i._id+"_calculateFieldName").val("");n("#"+i._id+"_calculateFieldList").ejDropDownList({dataSource:i._calculatedField,fields:{text:"name",value:"name"},enableRTL:i.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});return}return}i._calculatedField.push({name:n("#"+i._id+"_calculateFieldName").val(),formula:n("#"+i._id+"_calculatedFieldFormula").val()});n("#"+i._id+"_calculatedFieldFormula").val("");n("#"+i._id+"_calculateFieldName").val("");n("#"+i._id+"_calculateFieldList").ejDropDownList({dataSource:i._calculatedField,fields:{text:"name",value:"name"},enableRTL:i.model.enableRTL,create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});i._calculatedField.length>0&&(n("#"+i._id+"_btnOk").ejButton("enable"),n("#"+i._id+"_btnOk").removeAttr("disabled"))});n("#"+this._id+"_btnDelete").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),u,f,e,s,r,h,o;if(i._calculatedField.length==0){t.Pivot._createErrorDialog(i._getLocalizedLabels("CalculatedFieldNameNotFound"),i._getLocalizedLabels("Warning"),i);return}for(u=hederTag=n("#"+i._id+"_calculateFieldName").val(),r=0;r<i._calculatedField.length;r++)if(i._calculatedField[r].name==n("#"+i._id+"_calculateFieldName").val()){if(i.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)i.model.dataSource.values=n.grep(i.model.dataSource.values,function(n){return n.fieldCaption!=i._calculatedField[r].name}),i._calculatedField.splice(r,1),i._populatePivotGrid();else{for(i._calculatedField.splice(r,1),r=0;r<i._pivotTableFields.length;r++)i._pivotTableFields[r].name==u&&(i._pivotTableFields[r].isSelected=!1,headerTag=i._pivotTableFields[r],i._pivotTableFields.splice(r,1));try{f=JSON.parse(i.getOlapReport()).Report}catch(c){f=i.getOlapReport()}s="schemaRow::"+headerTag.id+"::FILTERED";i._schemaData==null&&(i.model.beforeServiceInvoke!=null&&i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&i._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:i.element,customObject:i.model.customObject}),h=JSON.stringify(i.model.customObject),e=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(headerTag),dropAxis:"schemaValue::",sortedHeaders:i._ascdes,filterParams:s,currentReport:f,valueSorting:JSON.stringify(i.model.valueSortSettings),customObject:h}),i.model.enableDeferUpdate?i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.nodeStateModified,e.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),i._nodeStateModifiedSuccess):i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.nodeStateModified,e,i._nodeStateModifiedSuccess))}i._schemaData!=null&&(o=i._schemaData._tableTreeObj.element.find("li[id='"+u+"']"),i._schemaData._tableTreeObj.uncheckNode(o),i._schemaData._tableTreeObj.model.beforeDelete=null,i._schemaData._tableTreeObj.removeNode(o),i._schemaData._tableTreeObj.model.beforeDelete=function(){return!1})}else if(r==i._calculatedField.length-1){t.Pivot._createErrorDialog(i._getLocalizedLabels("CalculatedFieldNameNotFound"),i._getLocalizedLabels("Warning"),i);return}});n("#"+this._id+"_btnOk").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),r,f,u,o,e,s;for(i.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&(i.model.dataSource.values=n.grep(i.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1})),r=0;r<i._calculatedField.length;r++){for(f=i._calculatedField[r].formula.replace(/\(|\)/g," ").replace(/[-+*/^%]/g," ").split(" "),u=0;u<f.length;u++)if(!n.isNumeric(f[u])&&f[u].replace(/\s+|\s+$/gm,"")!=""&&(o=i.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.grep(JSON.parse(i.getOlapReport()).PivotCalculations,function(n){return n.FieldName==f[u]}).length:n.grep(i.model.dataSource.values,function(n){return n.fieldName==f[u]}).length,o==0)){t.Pivot._createErrorDialog(i._getLocalizedLabels("NotPresent"),i._getLocalizedLabels("Warning"),i);return}e=i._calculatedField[r].formula.replace(/\s+|\s+$/gm,"");e=i._parenthesisAsterisk(e);i.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode&&n.grep(i.model.dataSource.values,function(n){return n.fieldName==i._calculatedField[r].name&&(n.formula=i._calculatedField[r].formula),n.fieldName==i._calculatedField[r].name}).length==0&&(i.model.dataSource.values.push({fieldName:i._calculatedField[r].name,fieldCaption:i._calculatedField[r].name,isCalculatedField:!0,formula:e}),i._schemaData!=null&&i._schemaData._tableTreeObj.element.find("li[id='"+i._calculatedField[r].name+"']").find(".e-chk-inact").length>0&&i._schemaData._tableTreeObj.checkNode(i._calculatedField[r].name))}if(i.element.find(".e-dialog, .clientDialog").remove(),t.Pivot.closePreventPanel(i),i.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode)i._populatePivotGrid();else{t.isNullOrUndefined(i._waitingPopup)||i._waitingPopup.show();try{report=JSON.parse(i.getOlapReport()).Report}catch(h){report=i.getOlapReport()}i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"calculatedField",element:i.element,customObject:i.model.customObject});s=JSON.stringify(i.model.customObject);eventArgs=JSON.stringify({action:"calculatedField",headerTag:JSON.stringify(i._calculatedField),currentReport:report,valueSorting:JSON.stringify(i.model.valueSortSettings),customObject:s});i.model.enableDeferUpdate?(t.isNullOrUndefined(i._waitingPopup)||i._waitingPopup.hide(),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.calculatedField,eventArgs.replace("calculatedField","calculatedFieldDeferUpdate"),i._schemaData==null?i._renderControlSuccess:i._schemaCalculatedField)):i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.calculatedField,eventArgs,i._schemaData==null?i._renderControlSuccess:i._schemaCalculatedField)}});n("#"+this._id+"_btnCancel").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");i.element.find(".e-dialog, .clientDialog").remove();t.Pivot.closePreventPanel(i)});this._curFocus.field=this.element.find(".e-dialog .calculateFieldName").attr("tabindex","-1").focus().addClass("hoverCell")},_schemaCalculatedField:function(i){var f,u,r;for(this._schemaData._tableTreeObj.model.nodeCheck=null,this._schemaData._tableTreeObj.model.nodeUncheck=null,r=0;r<this._calculatedField.length;r++)f=this._schemaData.element.find(".schemaFieldTree").data("ejTreeView"),this._schemaData._tableTreeObj.element.find("li[id='"+this._calculatedField[r].name+"']").length==0?(u=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?{id:this._calculatedField[r].name,name:this._calculatedField[r].name,caption:this._calculatedField[r].name,isSelected:!0,spriteCssClass:""}:{id:this._calculatedField[r].name,name:this._calculatedField[r].name,isSelected:!0,calculationType:8,formula:this._calculatedField[r].formula,summaryType:6,format:null,allowRunTimeGroupByField:"false",pivotType:"PivotComputationInfo",spriteCssClass:""},this._pivotTableFields.push(u),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&(this._pivotTableFields=t.PivotAnalysis.getTreeViewData(this.model.dataSource)),this._schemaData._setTableFields(this._pivotTableFields),f.addNode(u),this._schemaData._tableTreeObj.element.find(".e-item").css("padding","0px")):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._schemaData!=null&&this._schemaData._tableTreeObj.element.find("li[id='"+this._calculatedField[r].name+"']").find(".e-chk-inact").length>0?this._schemaData._tableTreeObj.checkNode(this._calculatedField[r].name):this._schemaData._tableTreeObj.element.find("li[id='"+this._calculatedField[r].name+"']").removeClass("filter").find(".treeDrop , .filter").remove();if(this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style"),this._schemaData._tableTreeObj.model.nodeCheck=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._schemaData._checkedStateModified,this._schemaData):t.proxy(this._schemaData._pivotCheckedStateModified,this._schemaData),this._schemaData._tableTreeObj.model.nodeUncheck=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._schemaData._checkedStateModified,this._schemaData):t.proxy(this._schemaData._pivotCheckedStateModified,this._schemaData),this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(this.model.enableDeferUpdate?(this._isUpdateRequired=!0,this._deferUpdateSuccess(i)):this._renderControlSuccess(i)),n(this._schemaData.element.find(".schemaValue .pivotButton")).each(function(){n(this).remove()}),t.isNullOrUndefined(this._pivotClientObj)||typeof this._pivotClientObj._pivotSchemaDesigner=="undefined")if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(report=JSON.parse(this.getOlapReport()),r=0;r<report.PivotCalculations.length;r++)this._schemaData._createPivotButton({fieldName:report.PivotCalculations[r].FieldName,fieldCaption:report.PivotCalculations[r].FieldHeader},"value","","","");else for(r=0;r<this.model.dataSource.values.length;r++)this._schemaData._createPivotButton({fieldName:this.model.dataSource.values[r].fieldName,fieldCaption:this.model.dataSource.values[r].fieldCaption},"value","","","");else this._schemaData._refreshPivotButtons();this._schemaData._setPivotBtnWidth()},_calculatedFieldListChange:function(t){n("#"+this._id+"_calculateFieldName").val(t.selectedText);for(var i=0;i<this._calculatedField.length;i++)this._calculatedField[i].name==t.selectedText&&n("#"+this._id+"_calculatedFieldFormula").val(this._calculatedField[i].formula)},_parenthesisAsterisk:function(n){for(var t=1;t<n.length-1;t++)n[t]=="("&&"+-/%^*(".indexOf(n[t-1])==-1&&(n=n.substring(0,t)+"*"+n.substring(t),t--),n[t]==")"&&"+-/%^*)".indexOf(n[t+1])==-1&&(n=n.substring(0,t+1)+"*"+n.substring(t+1),t--);return n},_calcFieldNodeDrop:function(t){for(var r=n.grep(this.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(t.fieldName)>-1}),i=0;i<r.length;i++)this._schemaData._tableTreeObj.uncheckNode(r[i].fieldName)},_schemaButtonCreate:function(){if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){n(this._schemaData.element.find(".schemaValue .pivotButton")).each(function(){n(this).remove()});report=JSON.parse(this.getOlapReport());for(var i=0;i<report.PivotCalculations.length;i++)this._schemaData._createPivotButton({fieldName:report.PivotCalculations[i].FieldName,fieldCaption:report.PivotCalculations[i].FieldHeader},"value","","","")}this._schemaData._setPivotBtnWidth()},_calculatedFieldNodeRemove:function(i){for(var u=n.grep(JSON.parse(this.getOlapReport()).PivotCalculations,function(n){return n.CalculationType==8&&n.Formula.indexOf(i.id)>-1}),r=0;r<u.length;r++)this._schemaData._tableTreeObj.model.nodeUncheck=null,this._schemaData._tableTreeObj.uncheckNode(u[r].FieldName),this._schemaData._tableTreeObj.element.find("li[id='"+u[r].FieldName+"']").removeClass("filter").find(".treeDrop").remove(),this._schemaData._tableTreeObj.model.nodeUncheck=t.proxy(this._schemaData._checkedStateModified,this._schemaData)},createConditionalDialog:function(){this.openConditionalFormattingDialog()},openConditionalFormattingDialog:function(){var o,s,h,y,c,l,a,v,r,f;if(!this.model.enableConditionalFormatting)return!1;t.Pivot.openPreventPanel(this);this.element.find(".e-dialog").remove();o=t.buildTag("div#"+this._id+"_clientDlg.clientDialog",{opacity:"1"})[0].outerHTML;h=this._getLocalizedLabels("ConditionalFormatting");var p=t.buildTag("label#"+this._id+"_conLbl.conditionLbl",this._getLocalizedLabels("Condition"))[0].outerHTML,w=t.buildTag("input#"+this._id+"_conType.conditionType","",{},{type:"text",tabindex:0,accesskey:"f"})[0].outerHTML,b=t.buildTag("label#"+this._id+"_editcond.editcondition",this._getLocalizedLabels("Editcondtion"))[0].outerHTML,k=t.buildTag("label#"+this._id+"_value1.value1",this._getLocalizedLabels("Value1"))[0].outerHTML,d=t.buildTag("label#"+this._id+"_value2.value2",this._getLocalizedLabels("Value2"))[0].outerHTML,g=t.buildTag("label#"+this._id+"_backcolorLbl.backcolorLbl",this._getLocalizedLabels("Backcolor"))[0].outerHTML,nt=t.buildTag("label#"+this._id+"_bordercolorLbl.bordercolorLbl",this._getLocalizedLabels("Bordercolor"))[0].outerHTML,tt=t.buildTag("label#"+this._id+"_borderrangeLbl.borderrangeLbl",this._getLocalizedLabels("Borderrange"))[0].outerHTML,it=t.buildTag("label#"+this._id+"_borderstyleLbl.borderstyleLbl",this._getLocalizedLabels("Borderstyle"))[0].outerHTML,rt=t.buildTag("label#"+this._id+"_fStyleLbl.fStyleLbl",this._getLocalizedLabels("Fontstyle"))[0].outerHTML,ut=t.buildTag("label#"+this._id+"_fSizeLbl.fSizeLbl",this._getLocalizedLabels("Fontsize"))[0].outerHTML,ft=t.buildTag("label#"+this._id+"_fValueLbl.fValueLbl",this._getLocalizedLabels("Measures"))[0].outerHTML,et=t.buildTag("input#"+this._id+"_editCon.editconditionDropDown","",{},{type:"text",tabindex:1,accesskey:"e"})[0].outerHTML,y=t.buildTag("button#"+this._id+"_removeBtn.dialogremoveBtn e-icon","",{},{name:this._getLocalizedLabels("Remove")}).attr("role","button").attr("aria-label","remove")[0].outerHTML,ot=t.buildTag("input#"+this._id+"_conFrom.conditionFrom","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:2})[0].outerHTML,st=t.buildTag("input#"+this._id+"_conTo.conditionTo","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:3})[0].outerHTML,ht=t.buildTag("input#"+this._id+"_backcolor.backcolor","",{},{type:"text",tabindex:4,accesskey:"b"})[0].outerHTML,ct=t.buildTag("input#"+this._id+"_bordercolor.bordercolor","",{},{type:"text",tabindex:5,accesskey:"c"})[0].outerHTML,lt=t.buildTag("input#"+this._id+"_borderrange.borderrange","",{},{type:"text",tabindex:6,accesskey:"r"})[0].outerHTML,at=t.buildTag("input#"+this._id+"_borderstyle.borderstyle","",{},{type:"text",tabindex:7,accesskey:"s"})[0].outerHTML,vt=t.buildTag("input#"+this._id+"_fStyle.fStyle","",{},{type:"text",tabindex:8,accesskey:"o"})[0].outerHTML,yt=t.buildTag("input#"+this._id+"_fSize.fSize","",{},{type:"text",tabindex:9,accesskey:"l"})[0].outerHTML,pt=t.buildTag("input#"+this._id+"_fValue.fValue","",{},{type:"text",tabindex:10,accesskey:"v"})[0].outerHTML,wt=t.buildTag("div#"+this._id+"_conditionDlg.conditionDlg","<table class='conditionformatTbl'><tr><td>"+p+"<\/td><td>"+w+"<\/td><td>"+b+"<\/td><td>"+et+"<\/td><td>"+y+"<\/td><\/tr><tr><td>"+k+"<\/td><td>"+ot+"<\/td><td>"+d+"<\/td><td>"+st+"<\/td><\/tr><tr><td>"+g+"<\/td><td>"+ht+"<\/td><td>"+tt+"<\/td><td>"+lt+"<\/td><\/tr><tr><td>"+nt+"<\/td><td>"+ct+"<\/td><td>"+it+"<\/td><td>"+at+"<\/td><\/tr><tr><td>"+rt+"<\/td><td>"+vt+"<\/td><td>"+ut+"<\/td><td>"+yt+"<\/td><\/tr><tr><td>"+ft+"<\/td><td>"+pt+"<\/td><\/tr><\/table>")[0].outerHTML;s=wt;a=t.buildTag("button#"+this._id+"_OKBtn.dialogOKBtn","",{},{name:this._getLocalizedLabels("OK")})[0].outerHTML;v=t.buildTag("button#"+this._id+"_CancelBtn.dialogCancelBtn","",{},{name:this._getLocalizedLabels("Cancel")})[0].outerHTML;dialogFooter=t.buildTag("div",a+v,{float:this.model.enableRTL?"left":"right",margin:"20px 39px 6px"})[0].outerHTML;n("#"+this._id).after(o);n("#"+this._id+"_clientDlg").append(s+dialogFooter);n("#"+this._id+"_clientDlg").ejDialog({width:"auto",target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,this)});n(".e-titlebar").prepend(t.buildTag("div",h,{display:"inline"})[0].outerHTML)[0];n("#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn,#"+this._id+"_removeBtn").ejButton({type:t.ButtonType.Button});n("#"+this._id+"_OKBtn,#"+this._id+"_CancelBtn").css({margin:"0 0 0 10px",width:"67px"});n("#"+this._id+"_removeBtn").css({width:"29px",height:"29px"});n("#"+this._id+"_conFrom,#"+this._id+"_conTo").css({width:"200px",height:"26px"});n("#"+this._id+"_conditionDlg").css({margin:"13px 0 0 0"});n("#"+this._id+"_editcond,#"+this._id+"_value2,#"+this._id+"_borderrangeLbl,#"+this._id+"_borderstyleLbl,#"+this._id+"_fSizeLbl").css({margin:"0 0 0 15px"});n("#"+this._id+"_conTo").attr("disabled","disabled");this.removeBtn=n("#"+this._id+"_removeBtn").data("ejButton");c=n("#"+this._id+"_OKBtn").data("ejButton");l=n("#"+this._id+"_CancelBtn").data("ejButton");this.removeBtn.setModel({enabled:!1});c.setModel({text:this._getLocalizedLabels("OK")});l.setModel({text:this._getLocalizedLabels("Cancel")});n("#"+this._id+"_conType").ejDropDownList({change:"_activeConditionChange",dataSource:[{option:"Less Than",value:this._getLocalizedLabels("LessThan")},{option:"Less Than Or Equal To",value:this._getLocalizedLabels("LessThanOrEqualTo")},{option:"Greater Than",value:this._getLocalizedLabels("GreaterThan")},{option:"Greater Than Or Equal To",value:this._getLocalizedLabels("GreaterThanOrEqualTo")},{option:"Equals",value:this._getLocalizedLabels("Equals")},{option:"Not Equals",value:this._getLocalizedLabels("NotEquals")},{option:"Between",value:this._getLocalizedLabels("Between")},{option:"Not Between",value:this._getLocalizedLabels("NotBetween")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_editCon").ejDropDownList({change:"_editConditionChange",dataSource:this._list,selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_backcolor").ejDropDownList({dataSource:[{option:"AliceBlue",value:this._getLocalizedLabels("AliceBlue")},{option:"Black",value:this._getLocalizedLabels("Black")},{option:"Blue",value:this._getLocalizedLabels("Blue")},{option:"Brown",value:this._getLocalizedLabels("Brown")},{option:"Gold",value:this._getLocalizedLabels("Gold")},{option:"Green",value:this._getLocalizedLabels("Green")},{option:"Lime",value:this._getLocalizedLabels("Lime")},{option:"Maroon",value:this._getLocalizedLabels("Maroon")},{option:"Orange",value:this._getLocalizedLabels("Orange")},{option:"Pink",value:this._getLocalizedLabels("Pink")},{option:"Red",value:this._getLocalizedLabels("Red")},{option:"Violet",value:this._getLocalizedLabels("Violet")},{option:"White",value:this._getLocalizedLabels("White")},{option:"Yellow",value:this._getLocalizedLabels("Yellow")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_bordercolor").ejDropDownList({dataSource:[{option:"AliceBlue",value:this._getLocalizedLabels("AliceBlue")},{option:"Black",value:this._getLocalizedLabels("Black")},{option:"Blue",value:this._getLocalizedLabels("Blue")},{option:"Brown",value:this._getLocalizedLabels("Brown")},{option:"Gold",value:this._getLocalizedLabels("Gold")},{option:"Green",value:this._getLocalizedLabels("Green")},{option:"Lime",value:this._getLocalizedLabels("Lime")},{option:"Maroon",value:this._getLocalizedLabels("Maroon")},{option:"Orange",value:this._getLocalizedLabels("Orange")},{option:"Pink",value:this._getLocalizedLabels("Pink")},{option:"Red",value:this._getLocalizedLabels("Red")},{option:"Violet",value:this._getLocalizedLabels("Violet")},{option:"White",value:this._getLocalizedLabels("White")},{option:"Yellow",value:this._getLocalizedLabels("Yellow")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_borderrange").ejDropDownList({dataSource:["1","2","3","4","5","6","7","8","9"],selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_borderstyle").ejDropDownList({dataSource:[{option:"Solid",value:this._getLocalizedLabels("Solid")},{option:"Dashed",value:this._getLocalizedLabels("Dashed")},{option:"Dotted",value:this._getLocalizedLabels("Dotted")},{option:"Double",value:this._getLocalizedLabels("Double")},{option:"Groove",value:this._getLocalizedLabels("Groove")},{option:"Inset",value:this._getLocalizedLabels("Inset")},{option:"Outset",value:this._getLocalizedLabels("Outset")},{option:"Ridge",value:this._getLocalizedLabels("Ridge")},{option:"None",value:this._getLocalizedLabels("None")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_fStyle").ejDropDownList({dataSource:[{option:"Algerian",value:this._getLocalizedLabels("Algerian")},{option:"Arial",value:this._getLocalizedLabels("Arial")},{option:"Bodoni MT",value:this._getLocalizedLabels("BodoniMT")},{option:"Britannic Bold",value:this._getLocalizedLabels("BritannicBold")},{option:"Cambria",value:this._getLocalizedLabels("Cambria")},{option:"Calibri",value:this._getLocalizedLabels("Calibri")},{option:"Courier New",value:this._getLocalizedLabels("CourierNew")},{option:"DejaVu Sans",value:this._getLocalizedLabels("DejaVuSans")},{option:"Forte",value:this._getLocalizedLabels("Forte")},{option:"Gerogia",value:this._getLocalizedLabels("Gerogia")},{option:"Impact",value:this._getLocalizedLabels("Impact")},{option:"Segoe UI",value:this._getLocalizedLabels("SegoeUI")},{option:"Tahoma",value:this._getLocalizedLabels("Tahoma")},{option:"Times New Roman",value:this._getLocalizedLabels("TimesNewRoman")},{option:"Verdana",value:this._getLocalizedLabels("Verdana")},{option:"None",value:this._getLocalizedLabels("None")},],fields:{text:"value",value:"option"},selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});n("#"+this._id+"_fSize").ejDropDownList({dataSource:["12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});var u=[],i=[],e;if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){if(n(this.element).parents(".e-pivotclient").length>0)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)for(r=0;r<this._JSONRecords.length;r++)this._JSONRecords[r].Info.indexOf("Measures")>-1&&i.push(this._JSONRecords[r].Value);else i=JSON.parse(this._pivotClientObj.getOlapReport()).PivotCalculations;else i=JSON.parse(this.getOlapReport()).PivotCalculations;e="FieldHeader"}else if(e="fieldCaption",this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)i=this.model.dataSource.values;else for(r=0;r<this.model.dataSource.values.length;r++)i=this.model.dataSource.values[r].measures;for(u=i.length>0?["All"]:u,f=0;f<i.length;f++)n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap?u.push(i[f]):u.push(i[f][e]);return u=u.length>0?u:["No Measure"],n("#"+this._id+"_fValue").ejDropDownList({dataSource:u,selectedIndices:[0],enableRTL:this.model.enableRTL,width:"200px",height:"30px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.element.find("#"+this._id+"_conType").ejDropDownList("option","change",t.proxy(this._activeConditionChange,this)),this.element.find("#"+this._id+"_editCon").ejDropDownList("option","change",t.proxy(this._editConditionChange,this)),this.isNewFormat=!0,this.ddlEditCondition=n("#"+this._id+"_editCon").data("ejDropDownList"),this.ddlConditionType=n("#"+this._id+"_conType").data("ejDropDownList"),this.ddlFont=n("#"+this._id+"_fStyle").data("ejDropDownList"),this.ddlFontSize=n("#"+this._id+"_fSize").data("ejDropDownList"),this.ddlBackColor=n("#"+this._id+"_backcolor").data("ejDropDownList"),this.ddlBorderColor=n("#"+this._id+"_bordercolor").data("ejDropDownList"),this.ddlBorderStyle=n("#"+this._id+"_borderstyle").data("ejDropDownList"),this.ddlBorderWidth=n("#"+this._id+"_borderrange").data("ejDropDownList"),this.ddlFieldValue=n("#"+this._id+"_fValue").data("ejDropDownList"),this.element.find("#"+this._id+"_conFrom,#"+this._id+"_conTo").keypress(function(t){return t.which==8||t.which==0?!0:t.which<45||t.which==45&&(t.target.value!=""||t.target.value.indexOf("-")>-1)||t.which>58?!1:t.which==46&&n(this).val().indexOf(".")!=-1||t.which==47?!1:void 0}),n("#"+this._id+"_OKBtn").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");this.ddlEditCondition=n("#"+i._id+"_editCon").data("ejDropDownList");n("#"+i._id+"_conFrom").val()==""?t.Pivot._createErrorDialog(i._getLocalizedLabels("EnterOperand1"),i._getLocalizedLabels("Warning"),i):n("#"+i._id+"_conTo").attr("disabled")||n("#"+i._id+"_conTo").val()!=""?n("#"+i._id+"_fValue").attr("disabled")&&n("#"+i._id+"_fValue").val()=="No Measure"?t.Pivot._createErrorDialog(i._getLocalizedLabels("NoMeasure"),i._getLocalizedLabels("Warning"),i):(i._applyFormatting(),t.Pivot.closePreventPanel(i)):t.Pivot._createErrorDialog(i._getLocalizedLabels("EnterOperand2"),i._getLocalizedLabels("Warning"),i)}),this.ddlEditCondition.getListData().length>1?n("#"+this._id+"_editCon").ejDropDownList("enable"):(n("#"+this._id+"_editCon").ejDropDownList("disable"),n("#"+this._id+"_editcond").css("color","#cbcbcb")),this.ddlFieldValue.getListData().length==1&&this.ddlFieldValue._selectedValue=="No Measure"?(n("#"+this._id+"_fValue").ejDropDownList("disable"),n("#"+this._id+"_fValueLbl").css("color","#cbcbcb")):n("#"+this._id+"_fValue").ejDropDownList("enable"),this._cFormat.length>0&&(this.ddlEditCondition.selectItemByValue(this._cFormat[this._cFormat.length-1].split(",")[0]),this._editConditionChange()),n("#"+this._id+"_removeBtn").click(function(){var t=n(this).parents(".e-pivotgrid").data("ejPivotGrid"),i,r;t.removeBtn.option("enabled")&&(i=confirm(t._getLocalizedLabels("ConditionalFormattingConformMsg")),i==!0&&(r=t.ddlEditCondition._selectedIndices[0],t._removeCellFormatting(r,i)))}),n("#"+this._id+"_CancelBtn").click(function(){var i=n(this).parents(".e-pivotgrid").data("ejPivotGrid");i.element.find(".e-dialog, .clientDialog").remove();t.Pivot.closePreventPanel(i)}),!1},_activeConditionChange:function(t){t.selectedValue=="Between"||t.selectedValue=="Not Between"?n("#"+this._id+"_conTo").removeAttr("disabled"):(n("#"+this._id+"_conTo").attr("disabled","disabled"),n("#"+this._id+"_conTo").val(""))},_editConditionChange:function(){if(this.ddlEditCondition._selectedIndices[0]>0){var i=this.ddlEditCondition._selectedIndices[0]-1,t=this._cFormat[i].split(",");this.ddlConditionType.selectItemByValue(t[1]);n("#"+this._id+"_conFrom").val(t[8]);t[9]!="undefined"&&n("#"+this._id+"_conTo").val(t[9]);this.ddlBackColor.selectItemByValue(t[2]);this.ddlBorderColor.selectItemByValue(t[3]);this.ddlBorderStyle.selectItemByValue(t[7]);this.ddlBorderWidth.selectItemByValue(t[4]);this.ddlFont.selectItemByValue(t[5]);this.ddlFontSize.selectItemByValue(t[6]);this.ddlFieldValue.selectItemByValue(t[10]);this.removeBtn.option("enabled",!0);this._conditionTypeChange()}else this.removeBtn.option("enabled",!1),this._clearWindow()},_clearWindow:function(){n("#"+this._id+"_clientDlg").find("#"+this._id+"_conFrom,#"+this._id+"_conTo").val("");n("#"+this._id+"_conTo").disabled=!0},_conditionTypeChange:function(){n("#"+this._id+"_conTo").disabled=!(this.ddlConditionType._selectedIndices[0]==4||this.ddlConditionType._selectedIndices[0]==5)},_removeCellFormatting:function(n,t){for(var i,u=n,r=0;r<this._cFormat.length&&n;r++)for(t&&(r=n-1,n=0),i=0;i<this._JSONRecords.length;i++)this._JSONRecords[i].CSS=this._JSONRecords[i].CSS.replace(" "+this._cFormat[r].split(",")[0],"");t?(this._cFormat.splice(u-1,1),this._list.splice(u,1)):(this._cFormat=[],this._list=[]);this.renderControlFromJSON()},_applyStyle:function(t,i,r,u,f,e,o,s,h){var v=i.CSS,a=!1,l=t=="rows"?i.Index.split(",")[1]:t=="columns"?i.Index.split(",")[0]:null,c;(i.Value==r||r=="All")&&(n.inArray(Number(l),u)==-1?u.push(Number(l)):u);c=n.isNumeric(i.Value)==!0?i.Value:i.Value.replace(/[^\d.]/g,"");a=n.inArray(Number(l),u)!=-1?!0:!1;this._getResult(Number(f),Number(e),c,o)&&c!=""&&n.isNumeric(c)&&a&&i.CSS.indexOf("value")!=-1&&(i.CSS=v+" "+h)},_refreshCellFormatting:function(n){for(var u,t,i,f=this._getAxis(),r=0;r<this._cFormat.length;r++)for(u=[],t=this._cFormat[r].split(","),i=0;i<n.length;i++)n[i].CSS.indexOf(t[0])===-1&&this._applyStyle(f,n[i],t[10],u,t[8],t[9],t[1],i,this._cFormat[r].split(",")[0]);return n},_createDynamicRule:function(n,t,i,r,u,f,e){var o=function(){var n=document.createElement("style");return n.appendChild(document.createTextNode("")),document.head.appendChild(n),n.sheet}(),s="background-color: "+n+" !important;border:"+t+" "+i+"px "+r+" !important;font:"+u+"px "+f+" !important;";o.insertRule("."+e+"{"+s+"}",0)},_getAxis:function(){var f,u,i;if(this.getOlapReport())if(f=null,u="",this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){for(f=this.getOlapReport()!=r&&this.getOlapReport()!=""&&JSON.parse(this.getOlapReport()).PivotCalculations.length>0&&!n(this.element).parents(".e-pivotclient").length>0?JSON.parse(this.getOlapReport()).PivotCalculations[0].FieldHeader:JSON.parse(this._pivotClientObj.getOlapReport()).PivotCalculations[0].FieldHeader,i=0;i<this._JSONRecords.length;i++)if(this._JSONRecords[i].Value==f){u=this._JSONRecords[i].CSS=="colheader"?"columns":this._JSONRecords[i].CSS=="rowheader"?"rows":"";break}}else if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)u="columns";else for(i=0;i<this.getOlapReport().values.length;i++)u=this.getOlapReport().values[i].axis;return u},_applyCodeBehindFormatting:function(i){var o,s,r,f,e,h,u,c;if(this._isFormatApply=!0,s=this._getAxis(),!t.isNullOrUndefined(this.model.conditionalFormatSettings))for(r=0;r<this.model.conditionalFormatSettings.length;r++)if(f=[],f=this.model.conditionalFormatSettings[r].measures.split(","),n.inArray(this.model.conditionalFormatSettings[r].name,this._list)==-1){for(e=0;e<f.length;e++)for(h=[],o=f[e],u=0;u<i.length;u++)this._applyStyle(s,i[u],o,h,this.model.conditionalFormatSettings[r].value.split(",")[0],this.model.conditionalFormatSettings[r].value.split(",")[1],this.model.conditionalFormatSettings[r].condition,u,this.model.conditionalFormatSettings[r].name);c=this.model.conditionalFormatSettings[r].name+","+this.model.conditionalFormatSettings[r].condition+","+this.model.conditionalFormatSettings[r].style.backgroundcolor+","+this.model.conditionalFormatSettings[r].style.bordercolor+","+this.model.conditionalFormatSettings[r].style.borderwidth+","+this.model.conditionalFormatSettings[r].style.fontstyle+","+this.model.conditionalFormatSettings[r].style.fontsize+","+this.model.conditionalFormatSettings[r].style.borderstyle+","+this.model.conditionalFormatSettings[r].value.split(",")[0]+","+this.model.conditionalFormatSettings[r].value.split(",")[1]+","+o;this._cFormat.push(c);this._list.push(this.model.conditionalFormatSettings[r].name);this._createDynamicRule(this.model.conditionalFormatSettings[r].style.backgroundcolor,this.model.conditionalFormatSettings[r].style.borderstyle,this.model.conditionalFormatSettings[r].style.borderwidth,this.model.conditionalFormatSettings[r].style.bordercolor,this.model.conditionalFormatSettings[r].style.fontsize,this.model.conditionalFormatSettings[r].style.fontstyle,this.model.conditionalFormatSettings[r].name)}return this._JSONRecords=i,i},_applyFormatting:function(){var s,u,h,e,c,f,l,o,i;if(this._isFormatApply=!0,c=[],l=!1,t.isNullOrUndefined(n("#"+this._id+"_conFrom").val())||(this._formatValue1=n("#"+this._id+"_conFrom").val(),this._formatValue2=n("#"+this._id+"_conTo").val(),cdnTxt=this.ddlConditionType._selectedValue,color=this.ddlBackColor._selectedValue,bordercolor=this.ddlBorderColor._selectedValue,borderrange=this.ddlBorderWidth._selectedValue,fStyle=this.ddlFont._selectedValue,fSize=this.ddlFontSize._selectedValue,borderstyle=this.ddlBorderStyle._selectedValue,editCdn=this.ddlEditCondition._selectedValue),e=this.ddlFieldValue._selectedValue!=r?this.ddlFieldValue._selectedValue:"",n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap){for(i=0;i<this._JSONRecords.length;i++)if(this._JSONRecords[i].Info.indexOf("Measures")>-1&&(f=this._JSONRecords[i].CSS=="colheader"?"columns":this._JSONRecords[i].CSS=="rowheader"?"rows":""),f!="")break}else for(field=JSON.parse(this.getOlapReport()).PivotCalculations[0].FieldHeader,i=0;i<this._JSONRecords.length;i++)if(this._JSONRecords[i].Value==field){f=this._JSONRecords[i].CSS=="colheader calc"?"columns":this._JSONRecords[i].CSS=="rowheader"?"rows":"";break}}else f=this._getAxis();if(n("#"+this._id+"_editCon").val()==this._getLocalizedLabels("AddNew")){for(i=this._cFormat.length;i<this._cFormat.length+1;i++)for(u="Format"+i,o=i;n.inArray(u,this._list)!=-1;o++)u="Format"+o;s=u+","+this.ddlConditionType._selectedValue+","+color+","+bordercolor+","+borderrange+","+fStyle+","+fSize+","+borderstyle+","+this._formatValue1+","+this._formatValue2+","+e;this._cFormat.push(s);this._list.push(u)}else for(u=this.ddlEditCondition._selectedValue,h=this.ddlEditCondition._selectedIndices[0]-1,this._cFormat[h]=u+","+this.ddlConditionType._selectedValue+","+color+","+bordercolor+","+borderrange+","+fStyle+","+fSize+","+borderstyle+","+this._formatValue1+","+this._formatValue2+","+e,i=0;i<this._JSONRecords.length;i++)this._JSONRecords[i].CSS=this._JSONRecords[i].CSS.replace(" "+u,"");for(i=0;i<this._JSONRecords.length;i++)this._applyStyle(f,this._JSONRecords[i],e,c,this._formatValue1,this._formatValue2,this.ddlConditionType._selectedValue,i,u);this._createDynamicRule(color,borderstyle,borderrange,bordercolor,fSize,fStyle,u);this.renderControlFromJSON();this.element.find(".e-dialog, .clientDialog").remove()},_getResult:function(n,t,i,r){switch(r){case"Less Than":return i<n;case"Less Than Or Equal To":if(i<=n)return i;break;case"Greater Than":return i>n;case"Greater Than Or Equal To":if(i>=n)return i;break;case"Equals":if(i==n)return i;break;case"Not Equals":return i!=n;case"Between":return n<t&&i>n&&i<t||n>t&&i<n&&i>t||i==n&&i==t;case"Not Between":return!(n<t&&i>n&&i<t||n>t&&i<n&&i>t||i==n&&i==t)}},_updateReportSettings:function(i){var u=n.map(i,function(n){if(n.Key=="JsonRecords"||n.Key=="PivotRecords")return n}),f=n.map(i,function(n){if(n.Key=="PivotReport"||n.Key=="OlapReport")return n}),r=n.map(i,function(n){if(n.Key=="SortColIndex")return n});this.setJSONRecords(u[0].Value);this.setOlapReport(f[0].Value);r.length>0?(t.PivotAnalysis._valueSorting=JSON.parse(r[0].Value),t.PivotAnalysis._sort=this.model.valueSortSettings.sortOrder):t.PivotAnalysis._valueSorting=null},_updatePageSettings:function(t,i){var r=n.map(t,function(n){if(n.Key=="PageSettings")return n}),u=n.map(t,function(n){if(n.Key=="HeaderCounts")return n});r.length>0&&i._pagerObj!=null&&(i._pagerObj.element.css("opacity","1"),i._pagerObj.element.find(".pagerTextBox").removeAttr("disabled"),i._pagerObj._unwireEvents(),i._pagerObj._wireEvents(),i._pagerObj.initPagerProperties(JSON.parse(u[0].Value),JSON.parse(r[0].Value)))},_removeCells:function(i){var p=[],w=[],a,c,b,o,f,v,st,d,u,g,nt,h,ht,e,l,ut,ct,tt,it,y,s;if(i[0]!=r&&i.length>0?(a=n.map(i,function(n){if(n.Key=="FilteredColumnHeaders")return n}),c=n.map(i,function(n){if(n.Key=="FilteredRowHeaders")return n}),a.length>0&&(p=JSON.parse(a[0].Value)),c.length>0&&(w=JSON.parse(c[0].Value))):i.d!=r?(a=n.map(i.d,function(n){if(n.Key=="FilteredColumnHeaders")return n}),c=n.map(i.d,function(n){if(n.Key=="FilteredRowHeaders")return n}),a.length>0&&(p=JSON.parse(a[0].Value)),c.length>0&&(w=JSON.parse(c[0].Value))):(i.FilteredColumnHeaders&&(p=JSON.parse(i.FilteredColumnHeaders)),i.FilteredRowHeaders&&(w=JSON.parse(i.FilteredRowHeaders))),p.length>0){for(h=p,e=0;e<h.length;e++)for(l=h[e].From;l<=h[e].To;l++)for(u=h[e].Level;u<this._rowCount;u++)this.element.find(".pivotGridTable [p='"+l+","+u+"']").remove();for(c=this.element.find(".pivotGridTable thead").children(),b=c.length-2;b>=0;b--)for(o=n(c[b]).find("th.colheader:visible"),f=0;f<=o.length-1;f++){for(v=n(o[f]).attr("colSpan"),u=0;u<=parseInt(n(o[f]).attr("colSpan"))-1;u++)st=parseInt(n(o[f]).attr("p").split(",")[0])+u,d=this.element.find(".pivotGridTable [p='"+st+","+(b+1)+"']:visible"),n(d).length>0?v=parseInt(v)+(n(d).attr("colspan")?parseInt(n(d).attr("colspan"))-1:0):v--;if(v==0&&n(o[f]).nextAll(".summary.stot:eq(0)").length>0){var k=n(o[f]).nextAll(".summary.stot:eq(0)").attr("p").split(",")[0],rt=[],h=[];for(u=0;u<this._rowCount;u++){if(g="[p='"+parseInt(k)+","+u+"'] ",h.push(g),this._JSONRecords[parseInt(k)*this._rowCount+u].ColSpan>1&&this.element.find(".pivotGridTable [p='"+parseInt(k)+","+u+"']:visible").length>0)for(nt=1;nt<=this._JSONRecords[parseInt(k)*this._rowCount+u].ColSpan-1;nt++)rt.push(parseInt(k)+nt);for(hc=0;hc<rt.length;hc++)g+=", [p='"+rt[hc]+","+u+"'] ";this.element.find(".pivotGridTable "+g).remove()}}t.isNullOrUndefined(n(o[f]).attr("vfColSpan"))&&n(o[f]).attr("vfColSpan",n(o[f]).attr("colSpan"));n(o[f]).attr("colSpan",v)}this.element.find(".colheader[colspan='0']:not(.gtot,.calc)").remove()}if(w.length>0){for(h=w,ht=parseInt(this.element.find(".pivotGridTable td:eq(0)").attr("p").split(",")[0])-2,e=0;e<h.length;e++)for(l=h[e].From;l<=h[e].To;l++)this.element.find(".pivotGridTable tr:eq("+l+") th:last").css("display","none"),this.element.find(".pivotGridTable tr:eq("+l+") td").css("display","none");for(s=ht;s>=0;s--)for(ut=this.element.find(".pivotGridTable tbody").find(" .rowheader[p^='"+s+",'] :visible"),ct=this.element.find(".pivotGridTable th.rowheader").parent(),tt=0;tt<=ut.length;tt++){var ft=n(ut[tt]).parent(),lt=parseInt(ft.attr("rowSpan")),et=ft.attr("p");if(et){var at=parseInt(et.split(",")[1]),vt=parseInt(et.split(",")[0]),ot=0;for(it=at;it<=at+lt;it++)y=ct.children(" [p='"+(s+1)+","+it+"']"),y.length>0&&!y.is(":visible")&&(ot=ot+parseInt(y.attr("rowSpan"))+(y.next("th.rowheader").length>0||parseInt(y.attr("rowSpan"))>1?1:0));ot==lt&&ft.css("display","none")}}for(s=0;s<n(this.element.find(".summary.stot")).length;s++)n(this.element.find(".summary.stot")[s]).nextAll().text()==""&&(n(this.element.find(".summary.stot")[s]).css("display","none"),n(this.element.find(".summary.stot")[s]).nextAll().css("display","none"))}this.model.enableGroupingBar&&this._createFields(null,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth())},_renderControlSuccess:function(i){var o,s,f,h,c,u,e,l;try{if(i[0]!=r&&i.length>0?(this._updateReportSettings(i),i[2]!=null&&i[2]!=r&&i[2].Key=="PageSettings"&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i[3].Value).Column/JSON.parse(i[2].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i[3].Value).Row/JSON.parse(i[2].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i[2].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i[2].Value).SeriesPageSize):n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this._pagerObj!=null&&this._pagerObj.initPagerProperties(JSON.parse(i[3].Value),JSON.parse(i[2].Value)),t.isNullOrUndefined(i[4])||(i[4].Key=="DataSet"?(this._dataSet=i[4].Value,t.isNullOrUndefined(i[5])||(this.model.customObject=i[5].Value)):this.model.customObject=i[4].Value)),t.isNullOrUndefined(i[2])||i[2].Key=="PageSettings"||(i[2].Key=="DataSet"?(this._dataSet=i[2].Value,t.isNullOrUndefined([3])||(this.model.customObject=i[3].Value)):this.model.customObject=i[2].Value),t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._updatePageSettings(i,this._pivotClientObj)):i.d!=r&&i.d.length>0?(this._updateReportSettings(i.d),i.d[2]!=null&&i.d[2]!=r&&i.d[2].Key=="PageSettings"?(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i.d[3].Value).Column/JSON.parse(i.d[2].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.d[3].Value).Row/JSON.parse(i.d[2].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i.d[2].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.d[2].Value).SeriesCurrentPage):this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this._pagerObj.initPagerProperties(JSON.parse(i.d[3].Value),JSON.parse(i.d[2].Value)),t.isNullOrUndefined(i.d[4])||(i.d[4].Key=="DataSet"?(this._dataSet=i.d[4].Value,t.isNullOrUndefined(i.d[5])||(this.model.customObject=i.d[5].Value)):this.model.customObject=i.d[4].Value),t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._updatePageSettings(i.d,this._pivotClientObj)):t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||i.d.length!=2||(this._pivotClientObj._pagerObj.element.css("opacity","0.5"),this._pivotClientObj._pagerObj.element.find(".pagerTextBox").attr("disabled","disabled"),this._pivotClientObj._pagerObj._unwireEvents()),t.isNullOrUndefined(i[2])||i.d[2].Key=="PageSettings"||(i.d[2].Key=="DataSet"?(this._dataSet=i.d[2].Value,t.isNullOrUndefined([3])||(this.model.customObject=i.d[3].Value)):this.model.customObject=i.d[2].Value)):!t.isNullOrUndefined(i)&&t.isNullOrUndefined(i.d)&&(i.SortColIndex!=r?(t.PivotAnalysis._valueSorting=JSON.parse(i.SortColIndex)[0],t.PivotAnalysis._sort=this.model.valueSortSettings.sortOrder):t.PivotAnalysis._valueSorting=null,i.PivotRecords!=r?(this.setJSONRecords(i.PivotRecords),this.setOlapReport(i.OlapReport),i.HeaderCounts!=r&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling)?(this._categPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Column/JSON.parse(i.PageSettings).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Row/JSON.parse(i.PageSettings).SeriesPageSize),this._categCurrentPage=JSON.parse(i.PageSettings).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.PageSettings).SeriesCurrentPage):i.HeaderCounts!=r&&this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r?this._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)):i.HeaderCounts==r||t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings))):i.JsonRecords!=r&&this.model.enableJSONRendering==!0?(this.setJSONRecords(JSON.stringify(i.JsonRecords)),this.setOlapReport(JSON.stringify(i.PivotReport)),i.DataSet!=null&&(this._dataSet=i.DataSet)):i.JsonRecords!=r?(this.setJSONRecords(i.JsonRecords),this.setOlapReport(i.PivotReport),i.DataSet!=null&&(this._dataSet=i.DataSet)):i.JsonRecords==r&&(this.setJSONRecords(null),i.PivotReport&&this.setOlapReport(i.PivotReport),i.OlapReport&&this.setOlapReport(i.OlapReport)),i.customObject!=null&&i.customObject!=r&&(this.model.customObject=i.customObject)),t.isNullOrUndefined(this.getJSONRecords())&&!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enablePaging&&(o={CategorialCurrentPage:1,CategorialPageSize:1,SeriesCurrentPage:1,SeriesPageSize:1},s={Column:1,Row:1},this._pivotClientObj._pagerObj.initPagerProperties(s,o)),(this.model.enableVirtualScrolling||n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r)&&this.layout("nosummaries"),this.getOlapReport()!=r&&this.getOlapReport()!=""&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)try{t.isNullOrUndefined(JSON.parse(this.getOlapReport()).DataModel)||(this.model.analysisMode=JSON.parse(this.getOlapReport()).DataModel=="Olap"?t.Pivot.AnalysisMode.Olap:t.Pivot.AnalysisMode.Pivot)}catch(a){}if(this.model.enableGroupingBar==!0&&(report=JSON.parse(this.getOlapReport()),f=t.isNullOrUndefined(report.ItemsProperties)?[]:JSON.parse(report.ItemsProperties),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(h=report.PivotRows.concat(report.PivotColumns,report.PivotCalculations,report.Filters),c=n.grep(f,function(t){return n.grep(h,function(n){t.id==(n.FieldHeader||n.DimensionHeader)&&(t.id=n.FieldName||n.DimensionName)}),t}),this._pivotTableFields=c):this._pivotTableFields=f,this._createGroupingBar(report)),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(report=JSON.parse(this.getOlapReport()),u=0;u<report.PivotCalculations.length;u++)(report.PivotCalculations[u].CalculationType==8||report.PivotCalculations[u].CalculationType=="Formula")&&n.grep(this._calculatedField,function(n){return n.name==report.PivotCalculations[u].FieldName}).length==0&&this._calculatedField.push({name:report.PivotCalculations[u].FieldName,formula:report.PivotCalculations[u].Formula});this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"initialize",element:this.element,customObject:this.model.customObject});this.getJSONRecords()!=null&&this.getJSONRecords().length>0?this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&this.model.enableVirtualScrolling==!1&&n(".e-pivotpager")[0]==null?this.excelLikeLayout(this.getJSONRecords()):this.renderControlFromJSON(this.getJSONRecords()):this.renderControlFromJSON("");e=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(e)||(e._isTimeOut=!1);t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null?this._waitingPopup.hide():n("#"+this._pivotClientObj._id+"_maxView")[0]&&this._maxViewLoading?this._maxViewLoading.hide():this._pivotClientObj._waitingPopup.hide();t.isNullOrUndefined(this._schemaData)||this._schemaData.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")}catch(a){}this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._schemaData!=null&&this._schemaButtonCreate();l={action:"initialize",customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",l);t.isNullOrUndefined(i.Exception)||t.Pivot._createErrorDialog(i,"Exception",this);this.model.enableAdvancedFilter&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._removeCells(i)},_hideGrandTotal:function(u){var v=u.find(".pivotGridFrozenTable"),y,l,e,o,w,rt,d,s,g,nt,h,p,c,it,b,tt,a,f;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(this.model.enableRowGrandTotal&&this.model.enableGrandTotal||((this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&u.find(".rowhead tr:last").hide(),u.find("tbody").children().length>0&&u.find("tr:last").hide()),(u.find("tr:first th.summary").attr("p")!=r||u.find(".pivotGridFrozenTable tr:first td.summary").attr("p")!=r)&&(!this.model.enableColumnGrandTotal||!this.model.enableGrandTotal)&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(y=[],y=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders?this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?v.find(".gtot[role^='columnheader']"):v.find(".cgtot[role^='columnheader']"):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?u.find("th.gtot[role^='columnheader']"):u.find("th.cgtot[role^='columnheader']"),cLen=0;cLen<y.length;cLen++)u.find('[p^="'+parseInt(n(y[cLen]).attr("p").split(",")[0])+',"]').hide(),u.find('[p^="'+parseInt(n(y[cLen]).attr("p").split(",")[0])+',"]').hide()}else if(this.model.layout=="normal"&&(l=!0,e=0,this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||this.model.analysisMode==t.Pivot.AnalysisMode.Olap)){if((!this.model.enableColumnGrandTotal||!this.model.enableGrandTotal)&&(rwLen=n(u).find("thead tr").length||n(u).find(".pivotGridFrozenTable tr").length,rwLen>1||rwLen==1&&n(u).find("th.summary[p$=',"+e+"']").length>0)){while(l)o=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?n(u).find("td.summary[p$=',"+e+"']"):n(u).find("th.summary[p$=',"+e+"']"),o.length&&(l=!1),e++;for(h=0;h<o.length;h++){var p=e,c=o[h];for(selectedCellPos=n(c).attr("p"),i=parseInt(selectedCellPos.split(",")[1])-1,w=n(c).attr("colspan"),rt=n(u).find("thead tr").length+n(u).find("tbody tr").length,d=0;d<parseInt(w);d++)n(u).find(" [p^='"+(parseInt(selectedCellPos.split(",")[0])+d)+",']").css("display","none");for(s=0;s<rwLen;s++)this.model.frozenHeaderSettings.enableFrozenHeaders?n(v).find("tr:eq("+s+") td").length==1&&(g=n(v).find(" tr:eq("+s+") td").attr("colspan"),n(v).find(" tr:eq("+s+") td").attr("colspan",parseInt(g)-parseInt(w))):n(u).find("thead tr:eq("+s+") th").length==1&&(g=n(u).find("thead tr:eq("+s+") th").attr("colspan"),n(u).find("thead tr:eq("+s+") th").attr("colspan",parseInt(g)-parseInt(w)));if(i>=0)for(a=n(u).find(" [p^='"+selectedCellPos.split(",")[0]+","+i+"']")[0];p>1;){if(t.isNullOrUndefined(a))for(i=parseInt(selectedCellPos.split(",")[1])-1;i>=0;i--){if(f=n(u).find("[p='"+selectedCellPos.split(",")[0]+","+i+"']")[0],t.isNullOrUndefined(f))for(k=parseInt(selectedCellPos.split(",")[0])-1;k>=0;k--)t.isNullOrUndefined(f)&&(f=n(u).find("[p='"+k+","+i+"']")[0]);!t.isNullOrUndefined(f)&&n(f).css("display")!="none"&&n(n(f).parents("tr")[0]).css("display")!="none"&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader"||n(f).hasClass("colheader")||n(f).attr("role")=="columnheader"||n(f).hasClass("value")||n(f).attr("role")=="gridcell")&&(a=f);set_spn=parseInt(n(f).attr("colspan"))-parseInt(w);n(f).attr("colspan",set_spn)}t.isNullOrUndefined(f)||p--}}}if(l=!0,e=0,o="",!this.model.enableRowGrandTotal||!this.model.enableGrandTotal){if(nt=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,rwLen=n(u).find("tbody tr").length,rwLen>1||rwLen==1&&n(u).find(nt?"":"th[p^='"+e+",']")=="summary")for(rwLen=n(u).find("tbody tr").length;l;)o=nt?n(u).find("td.summary[p^='"+e+",']"):n(u).find("th.summary[p^='"+e+",']"),o.length&&(l=!1),e++;if(rwLen>0)for(h=0;h<o.length;h++){for(p=e,c=o[h],selectedCellPos=n(c).attr("p"),i=parseInt(selectedCellPos.split(",")[0])-1,it=n(c).attr("rowspan"),b=n(c).parent(),tt=0;tt<c.rowSpan;tt++)n(b).css("display","none"),nt&&n(u).find(".pivotGridValueTable tr:eq("+n(b).index()+")").css("display","none"),b=n(b).next();if(i>=0)for(a=n(u).find(" [p^='"+i+","+selectedCellPos.split(",")[1]+"']")[0];p>1;){if(t.isNullOrUndefined(a))for(i=parseInt(selectedCellPos.split(",")[0])-1;i>=0;i--){if(f=n(u).find("[p='"+i+","+selectedCellPos.split(",")[1]+"']")[0],t.isNullOrUndefined(f))for(k=parseInt(selectedCellPos.split(",")[1])-1;k>=0;k--)t.isNullOrUndefined(f)&&(f=n(u).find("[p='"+i+","+k+"']")[0]);!t.isNullOrUndefined(f)&&n(f).css("display")!="none"&&n(n(f).parents("tr")[0]).css("display")!="none"&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader"||n(f).hasClass("colheader")||n(f).attr("role")=="columnheader"||n(f).hasClass("value")||n(f).attr("role")=="gridcell")&&(a=f);set_spn=parseInt(n(f).attr("rowspan"))-parseInt(it);n(f).attr("rowspan",set_spn)}t.isNullOrUndefined(f)||p--}}}}},_hideSubTotal:function(i,u){var k,h,d,nt,g,l,e,p,a,s,v,b,y,c,f;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(k=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource.rows:this.element.parents(".e-pivotclient").length>0?JSON.parse(this._pivotClientObj.getOlapReport()).PivotRows:JSON.parse(this.getOlapReport()).PivotRows,d=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource.columns:this.element.parents(".e-pivotclient").length>0?JSON.parse(this._pivotClientObj.getOlapReport()).PivotColumns:JSON.parse(this.getOlapReport()).PivotColumns,!t.isNullOrUndefined(k))for(e=0;e<k.length;e++)if(k[e].showSubTotal==!1)if(nt=e.toString(),n(i).attr("role")=="row"&&n(i).parent().is("tbody")){if(n(i).find(".stot,.rstot").length==0||this._isSubTotalhidden&&n(i).find(".stot,.rstot").find(".expand").length>=1||n(i).find(".stot,.rstot").attr("p").split(",")[0]==nt&&u==1&&n(i).find(".stot,.rstot").find(".expand").length>=1)break;else if(n(i).find(".stot,.rstot").attr("p").split(",")[0]==nt){this._isSubTotalhidden=this._isSubTotalHide=!0;break}}else if(n(i).find("tbody").length>0&&(h=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?i.find('.summary.rstot[p^="'+e+',"]'):i.find('.summary.stot[p^="'+e+',"]'),h.length>0))for(g=0;g<h.length;g++){var tt=n(h[g]).closest("tr"),o=n(tt).find(".stot,.rstot").attr("p"),c=parseInt(o.split(",")[0])-1,ut=parseInt(n(tt).find(".stot,.rstot").attr("rowspan"));for(n(tt).css("display","none"),n(i).find(".valueCell td[p$=',"+o.split(",")[1]+"']").css("display","none"),l=parseInt(o.split(",")[1]);c>=0;){for(f=null;t.isNullOrUndefined(f)&&l>=0;){if(f=n(i).find("[p='"+c+","+l+"']")[0],!t.isNullOrUndefined(f)&&n(n(f).closest("tr")[0]).css("display")!="none"&&n(f).hasClass("rowheader")&&n(f).attr("role")=="rowheader"&&parseInt(n(f).attr("p").split(",")[0])<parseInt(o.split(",")[0])&&parseInt(n(f).attr("p").split(",")[1])+f.rowSpan+(n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag")):0)>=parseInt(o.split(",")[1])+ut){f.rowSpan-=1;n(f).find("span").attr("tag",n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag"))+1:1);break}l--}c--}}if(!t.isNullOrUndefined(d))for(e=0;e<d.length;e++)if(d[e].showSubTotal==!1)if(p=e.toString(),(n(i).hasClass("stot")||n(i).hasClass("cstot"))&&n(i).attr("role")=="columnheader"){if(this._isSubTotalhidden&&n(i).find(".stot,.cstot").find(".expand").length>=1||n(i).attr("p").split(",")[1]==p&&u==1&&n(i).find(".expand").length>=1)break;else if(n(i).attr("p").split(",")[1]==p){this._isSubTotalhidden=this._isSubTotalHide=!0;break}}else if(n(i).attr("role")=="row"&&n(i).parent().is("thead")){if(n(i).find(".stot,.cstot").length==0||this._isSubTotalhidden&&n(i).find(".stot,.cstot").find(".expand").length>=1||n(i).find(".stot,.cstot").attr("p").split(",")[1]==p&&u==1&&n(i).find(".stot,.cstot").find(".expand").length>=1)break;else if(n(i).find(".stot,.cstot").attr("p").split(",")[1]==p){this._isSubTotalhidden=this._isSubTotalHide=!0;break}}else if((n(i).find("thead").length>0||n(i).find(".colhead").length>0)&&(h=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?i.find('th.summary.cstot[p$=",'+e+'"]'):i.find('th.summary.stot[p$=",'+e+'"]'),h.length>0))for(a=h,s=0;s<a.length;s++){var ft=n(a[s]),rt=n(i),o=n(a[s]).attr("p"),et=n(a[s]).closest("tr")[0],it=parseInt(o.split(",")[0]),ut=parseInt(n(a[s]).attr("rowspan")),w=parseInt(n(a[s]).attr("colspan")),l=parseInt(o.split(",")[1])-1;for(v=0;v<w;v++){for(b=n(et).nextAll().find("[p^='"+(v+it)+",']"),y=0;y<n(b).length;y++)n(b[y]).css("display","none");(n(b[y]).attr("hc")==r||parseInt(n(b[y]).attr("hc"))<1)&&(n(rt).find("[p^='"+(v+it)+",']").css("display","none"),n(rt).find("[p^='0,']:not(.summary)").parent().find("td[p^='"+(v+it)+",']").attr("ch",1))}for(n(ft).css("display","none"),c=parseInt(o.split(",")[0]);l>=0;){for(f=null;t.isNullOrUndefined(f)&&c>=0;){if(f=n(i).find("[p='"+c+","+l+"']")[0],!t.isNullOrUndefined(f)&&n(n(f).closest("tr")[0]).css("display")!="none"&&n(f).hasClass("colheader")&&n(f).attr("role")=="columnheader"&&parseInt(n(f).attr("p").split(",")[1])<parseInt(o.split(",")[1])&&parseInt(n(f).attr("p").split(",")[0])<=parseInt(o.split(",")[0])&&parseInt(n(f).attr("p").split(",")[0])+f.colSpan+(n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag")):0)>=parseInt(o.split(",")[0])+w){f.colSpan-=w;n(f).find("span").attr("tag",n(f).find("span").attr("tag")!=r?parseInt(n(f).find("span").attr("tag"))+w:w);break}c--}l--}}}},_filterReport:function(n){for(var r,i=0;i<n.Filters.length;i++)if(n.PivotColumns.length>=1)for(r=0;r<n.PivotColumns.length;r++)n.Filters.length==0||t.isNullOrUndefined(n.Filters[i])||n.Filters[i].Tag!=n.PivotColumns[r].FieldName||(n.Filters.splice(i,1),i=-1);for(i=0;i<n.Filters.length;i++)if(n.PivotRows.length>=1)for(r=0;r<n.PivotRows.length;r++)n.Filters.length==0||t.isNullOrUndefined(n.Filters[i])||n.Filters[i].Tag!=n.PivotRows[r].FieldName||(n.Filters.splice(i,1),i=-1);for(i=0;i<n.Filters.length;i++)if(n.PivotCalculations.length>=1)for(r=0;r<n.PivotCalculations.length;r++)n.Filters.length==0||t.isNullOrUndefined(n.Filters[i])||n.Filters[i].Tag!=n.PivotCalculations[r].FieldName||(n.Filters.splice(i,1),i=-1);return n},_createGroupingBar:function(n){this._pivotFilter=this._getLocalizedLabels("DragFieldHere");this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(n=this._filterReport(n),filterTag=this._createPivotButtons(this._pivotFilter!=null&&n.Filters.length>1&&n.Filters[0].Tag==n.Filters[1].Tag?n.Filters.slice(1):n.Filters,"filter")):filterTag=this._createPivotButtons(this._pivotFilter!=null&&n.filters.length>0?n.filters:"","filter");this._pivotFilter=filterTag;this._pivotRow=this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotRows:n.rows,"row");this._pivotColumn=this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotColumns:n.columns,"column");this._pivotCalculation=this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotCalculations:n.values,"values");this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&n.values.length>0&&n.values[0].measures&&(n.values[0].axis=="columns"&&n.values[0].measures.length>0?this._pivotColumn=this._pivotColumn+this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotColumns:[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}],"column"):n.values[0].axis=="rows"&&n.values[0].measures.length>0&&(this._pivotRow=this._pivotRow+this._createPivotButtons(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?n.PivotColumns:[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}],"row")))},_contextOpen:function(n){t.Pivot._contextMenuOpen(n,this)},_pivotContextClick:function(i){var e,o;if(i.text!=this._getLocalizedLabels("CalculatedField"))if(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode){var r=i.text==this._getLocalizedLabels("AddToColumn")?"column":i.text==this._getLocalizedLabels("AddToRow")?"row":i.text==this._getLocalizedLabels("AddToValues")?"value":i.text==this._getLocalizedLabels("AddToFilter")?"filter":"",u=n(this._selectedMember).attr("fieldName"),s=n(this._selectedMember).text(),f={droppedFieldName:u,droppedFieldCaption:s,droppedClass:r,droppedPosition:"",isMeasuresDropped:u.toLocaleLowerCase().indexOf("measures")==0};this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&r!="values"&&(this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(f.droppedFieldName)==-1}));this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"pvtBtnDropped"},this));t.Pivot.addReportItem(this.model.dataSource,f);this.refreshControl();t.isNullOrUndefined(this._schemaData)||this._schemaData._refreshPivotButtons()}else e=i.text==this._getLocalizedLabels("AddToColumn")?this.element.find(".columns"):i.text==this._getLocalizedLabels("AddToRow")?this.element.find(".grpRow"):i.text==this._getLocalizedLabels("AddToValues")?this.element.find(".values"):i.text==this._getLocalizedLabels("AddToFilter")?this.element.find(".drag"):"",o={element:this._selectedMember,target:e,cancel:!1},this._pvtBtnDropped(o);else this._createCalculatedField()},_getAdvancedFilterInfo:function(t){var i=[],r;return this._excelFilterInfo.length>0&&(r=t,i=n.grep(this._excelFilterInfo,function(n){try{if(n.levelUniqueName.replace(/]/g,"").replace(/\[/g,"").indexOf(t)>-1)return n}catch(i){}})),i},_createPivotButtons:function(i,u){var c=this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?!0:!1,s,l,p,f,v,w,o,b,y,d;if(!t.isNullOrUndefined(i)){var a="",s=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"Slicers":"Values",h="";if(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)for(s=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"filters":"values",s=="values"&&c&&(i=n.map(i,function(n){return n.measures})),f=0;f<i.length;f++){h=i[f].fieldCaption;var g=c?"":t.PivotAnalysis.getMembers(i[f].fieldName),k=t.Pivot.getReportItemByFieldName(i[f].fieldName,this.model.dataSource),e=i[f].filterItems!=null&&i[f].filterItems.values.length>0||!t.isNullOrUndefined(i[f].advancedFilter)&&i[f].advancedFilter.length>0&&k.item&&k.axis!="filters"?"filtered":"";u=="filter"&&(e=="filtered"?h=t.Pivot._getFilterState(c,g,i[f],this):c?(t.olap._mdxParser.getAllMember(this.model.dataSource,i[f].fieldName,this),h=this._allMember):h=this._getLocalizedLabels("All"));l=c?"":i[f].sortOrder==t.PivotAnalysis.SortOrder.Descending?"descending":"";a+=t.buildTag("span.pivotButton",t.buildTag("button.pvtBtn#pivotButton_"+(i[f].fieldName||i[f]),(this.model.showUniqueNameOnPivotButton?u!="values"?i[f].fieldName.replace(/\[/g,"").replace(/\]/g,""):i[f].fieldCaption==r?i[f].fieldName:i[f].fieldCaption||i[f]:i[f].fieldCaption==r?i[f].fieldName:i[f].fieldCaption||i[f])+(u=="filter"?" ("+h+")":""),{},{fieldName:i[f].fieldName,fieldCaption:i[f].fieldCaption,axis:s})[0].outerHTML+(c&&(i[f].fieldName.toLowerCase()=="measures"||!t.isNullOrUndefined(i[f].isNamedSet)&&!i[f].isNamedSet)?"":t.buildTag("span.filter e-icon "+e).attr("role","button").attr("aria-label","filter")[0].outerHTML)+(c?" ":t.buildTag("span.sorting e-icon "+l).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML)+t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML).attr("tag",s+":"+i[f].fieldName||i[f])[0].outerHTML}else for(s=="Values"&&u=="values"&&(p=this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").length>0?this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").parent()[0].className.split(" ")[0]:"schemaColumn",this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(s=p=="schemaColumn"||p=="columns"?"Columns":"Rows")),f=0;f<i.length;f++){for(v=this._ascdes.split("##"),w=0,l="",e="",o=0;o<v.length;o++)(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&v[o]==i[f].Tag||this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&v[o]==i[f])&&(w=1);if(w==1&&(l="descending"),!t.isNullOrUndefined(this._tempFilterData))for(o=0;o<this._tempFilterData.length;o++)for(b in this._tempFilterData[o])this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?b==(i[f].FieldName||i[f].DimensionName)&&this._tempFilterData[o][i[f].FieldName||i[f].DimensionName]!=""&&(e="filtered"):this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&b==(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?i[f].Tag:i[f])&&this._tempFilterData[o][i[f].Tag].indexOf("FILTERED")!=0&&(e="filtered");this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(i[f].FieldHeader=i[f].FieldHeader=="Measures"?this._getLocalizedLabels("Measures"):i[f].FieldHeader,e=u!="filter"&&this.model.enableAdvancedFilter&&this._getAdvancedFilterInfo(i[f].Tag).length>0?"filtered":e,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(y=t.isNullOrUndefined(this._tempFilterData)?[]:n.map(this._tempFilterData,function(n){return n[i[f].DimensionHeader]}),u=="filter"&&(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.enableAdvancedFilter&&this._getAdvancedFilterInfo(i[f].Tag).length>0&&(e="filtered"),h=y.length>0&&e&&this._fieldMembers[i[f].DimensionHeader]?this._fieldMembers[i[f].DimensionHeader].length-y.length==1?this._fieldMembers[i[f].DimensionHeader].filter(function(n){if(y.indexOf(n)==-1)return n}):this._getLocalizedLabels("MultipleItems"):this._getLocalizedLabels("All"))):u=="filter"&&(h=(this._fieldSelectedMembers[i[f].Tag]=="All"?i[f].AllMember:this._fieldSelectedMembers[i[f].Tag])||i[f].AllMember),d=i[f].FieldHeader=="Measures"||i[f].Tag=="Measures"?"":t.buildTag("span.filter e-icon "+e).attr("role","button").attr("aria-label","filter")[0].outerHTML,a+=t.buildTag("span.pivotButton",t.buildTag("span.dropIndicator")[0].outerHTML+t.buildTag("button.pvtBtn#pivotButton"+i[f].FieldHeader||i[f].FieldName||i[f].Name||i[f].DimensionHeader||i[f].DimensionName,(this.model.showUniqueNameOnPivotButton?u!="values"?i[f].Tag:i[f].FieldHeader||i[f].FieldName||i[f].Name||i[f].DimensionHeader||i[f].DimensionName:i[f].FieldHeader||i[f].FieldName||i[f].Name||i[f].DimensionHeader||i[f].DimensionName)+(u=="filter"?" ("+h+")":""),{},this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?{fieldname:i[f].FieldName||i[f].DimensionName||i[f].FieldHeader||i[f].DimensionHeader,fieldCaption:i[f].FieldHeader||i[f].FieldName||i[f].DimensionName||i[f].DimensionHeader}:{fieldCaption:i[f].FieldHeader})[0].outerHTML+d+t.buildTag("span.sorting e-icon "+l).attr("role","button").attr("aria-label","sort")[0].outerHTML+t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML).attr("tag",s+":"+i[f].Tag)[0].outerHTML):a+=t.buildTag("span.pivotButton",t.buildTag("span.dropIndicator")[0].outerHTML+t.buildTag("button.pvtBtn#pivotButton"+i[f],i[f])[0].outerHTML+t.buildTag("span.filter e-icon "+e).attr("role","button").attr("aria-label","filter")[0].outerHTML+t.buildTag("span.sorting e-icon "+l).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML+t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML).attr("tag",s+":"+i[f])[0].outerHTML}return a}},_createFields:function(){var l,e,a,r,v,h,c,o,i,s,f,u,y,p;if(this.element.find(".groupingBarPivot").remove(),this.element.prepend(t.buildTag("div#groupingBarPivot.groupingBarPivot")[0].outerHTML),this.element.find(".groupingBarPivot").prepend(t.buildTag("div.valueColumn",t.buildTag("span.values",t.buildTag("span#grpvalue","values",{display:"none"})[0].outerHTML).attr("aria-describedby","grpvalue")[0].outerHTML+t.buildTag("span.columns",t.buildTag("span#grpcol","column",{display:"none"})[0].outerHTML).attr("aria-describedby","grpcol")[0].outerHTML,{width:"100%"})),this.element.find(".groupingBarPivot").prepend(t.buildTag("div.drag",t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+t.buildTag("span#grpdrag","filter",{display:"none"})[0].outerHTML+this._getLocalizedLabels("DragFieldHere"),{width:"100%"})[0].outerHTML).attr("aria-describedby","grpdrag"),this._pivotFilter!=""&&this._pivotFilter!=null&&this.element.find(".drag").text("").append("<span id='grpdrag' style='display:none'>filter<\/span>"),this.element.find(".drag").append(this._pivotFilter),this.element.find(".values").append(this._pivotCalculation),this.element.find(".columns").append(this._pivotColumn),this.element.find(".values .pivotButton").length==0&&this.element.find(".values").append(t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("ValueArea")),this.element.find(".columns .pivotButton").length==0&&this.element.find(".columns").append(t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("ColumnArea")),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.element.find(".rows").length==0&&!t.isNullOrUndefined(this.getJSONRecords())&&this.getJSONRecords().length>0&&this.getJSONRecords()[0].CSS=="colheader"?(this.element.find(".pivotGridTable thead tr:first").prepend(t.buildTag("th.grpRow",t.buildTag("div.rows",t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("RowArea"))[0].outerHTML,{},{rowspan:this.element.find("thead tr").length})[0].outerHTML),this.element.find(".pivotGridTable tbody tr:first").prepend(t.buildTag("td.rowheader",this._getLocalizedLabels("Total"))[0].outerHTML)):this.element.find(".rows .pivotButton").length==0&&(this.element.find(".rows").text("").children("span").remove(),this.element.find(".rows").append(t.buildTag("span","",{width:"5px",display:"inline-block"})[0].outerHTML+this._getLocalizedLabels("RowArea"))),(this.element.find(".rowheader").length==0&&this.element.find(".colheader").length==0&&this.element.find(".values .pivotButton").length==0||this.element.find(".pivotGridTable th").length==0)&&(l=t.buildTag("div.emptyRows",t.buildTag("span.rows",this._pivotRow!=""?this._pivotRow:this._getLocalizedLabels("RowArea"),{width:"5px"})[0].outerHTML,{width:140})[0].outerHTML,this.element.find(".rows").length==0?this.element.find(".groupingBarPivot").append(l):"",this.model.enableDeferUpdate&&this._pivotRow!=""&&(this.element.find(".rows").text(""),this.element.find(".rows").append(this._pivotRow)),(this.getJSONRecords()==null||this.getJSONRecords().length==0)&&this.element.find(".groupingBarPivot").addClass("emptyPivotGrid"),this.element.find(".emptyRows,.rows").ejDroppable({})),this.element.find(".values").find(".filter").remove(),this.element.find(".values").find(".sorting").remove(),this.element.find(".drag").find(".sorting").remove(),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.element.find(".pivotButton").find(".sorting").remove(),(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this.element.find(".rows").width(this.element.find(".pivotGridRowTable").width()),this._setGroupingBarFrozenRowBtnWidth()),this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._clientPvtBtnDropped:this._pvtBtnDropped,this),helper:t.proxy(function(t){return n(t.element).parent().addClass("dragHover"),n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1?n(t.sender.target).clone().addClass("dragClone").appendTo(this.element):!1},this)}),this.element.find(".drag, .values, .columns, .grpRow, .rows").ejDroppable({}),this.element.find(".pivotGridTable").find("thead th:eq(1), tbody td.value:eq(0)").length>0)this.element.find(".groupingBarPivot").width(this.element.find(".pivotGridTable").width());else if(this.element.find(".pivotGridTable").find("thead, tbody").length>0)this.model.isResponsive||this.element.find(".groupingBarPivot").width(this.element.find(".rows").width()+150);else if(this.element.find(".columns .pivotButton").length==0||this.element.find(".values .pivotButton").length==0&&this.element.find(".columns .pivotButton").length==1)this.element.find(".groupingBarPivot").width(300);else{for(e=0,u=0;u<n(this.element.find(".columns .pivotButton")).length;u++)e=Math.max(n(this.element.find(".columns .pivotButton")[u]).width(),e);e<140?this.element.find(".columns").css("min-width",e+"px"):"";a=e*n(this.element.find(".columns .pivotButton")).length+this.element.find(".values").width()+10;this.element.find(".groupingBarPivot").width(a)}for((this.element.find(".rows").width()>140||this.model.enableDeferUpdate&&this.element.find(".rows").width()<this.element.find(".grpRow").width()&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)&&(this.enableDeferUpdate?this.element.find(".rows").width(this.element.find(".colheader").length==0?this.element.find(".grpRow").width()-140:this.element.find(".grpRow").width()):this.model.isResponsive||this.element.find(".rows").width(this.model.enableDeferUpdate?this.element.find(".grpRow").width()-8:this.element.find(".grpRow").width())),(this.element.find(".pivotGridTable thead").length>0||this.model.enableDeferUpdate&&this.element.find(".pivotGridTable thead").length==0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this.model.isResponsive&&this.element.find(".values .pivotButton").length==0&&this.element.find(".columns .pivotButton").length==0?this.element.find(".values").width(140):this.element.find(".values").width(this.element.find(".grpRow").length>0?this.model.enableDeferUpdate&&this.element.find(".colheader").length==0?this.element.find(".grpRow").width():this.element.find(".grpRow").width()+4:140),this.model.enableDeferUpdate&&this.element.find(".colheader").length==0&&this.element.find(".pivotGridTable .rowheader").length!=0&&(f=this.element.find(".groupingBarPivot").width()-this.element.find(".values").width(),f<140&&this.element.find(".groupingBarPivot").width(this.element.find(".groupingBarPivot").width()+140)),this.element.find(".pivotGridTable").find("thead th:eq(1), tbody td.value:eq(0)").length>0||this.model.enableDeferUpdate&&this.element.find(".columns .pivotButton").length==0||this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?(r=this.element.find(".pivotGridTable").width()-this.element.find(".values").width()-4,this.element.find(".pivotGridTable").find("thead th:eq(2), tbody td:eq(1)").length==0?(this.element.find(".columns").css("min-width",r>=30&&this.element.find(".pivotGridTable .colheader").length==0&&this.element.find(".columns .pivotButton").length==0?140:r).width(r>=30&&this.element.find(".pivotGridTable .colheader").length==0&&this.element.find(".columns .pivotButton").length==0?82:r),this.element.find(".values").height(r>=30&&this.element.find(".pivotGridTable .colheader").length==0&&this.element.find(".columns .pivotButton").length==0?this.element.find(".columns").height():this.element.find(".values").height()),(this.element.find(".columns .pivotButton").length==0||this.model.enableDeferUpdate&&this.element.find(".pivotGridTable .colheader").length==0)&&(this.element.find(".columns .pivotButton").length==0&&(r=this.element.find(".groupingBarPivot").width()-this.element.find(".values").width()-5,this.element.find(".columns").width(r),r<140&&(n(".groupingBarPivot .values .pivotButton").length==1||n(".groupingBarPivot .values .pivotButton").length==0&&this.model.enableDeferUpdate)&&this.element.find(".columns").css("min-width",r+"px")),this.element.find(".columns").addClass("widthSetter"))):r<140?n(".columns .pivotButton").length<2?this.element.find(".columns").css("min-width",r).addClass("widthSetter"):(this.element.find(".columns").width(r).css("min-width",r),this.element.find(".values").height(this.element.find(".columns").height())):this.element.find(".columns").width(r)):this.element.find(".pivotGridTable").find("thead th:eq(1)").length!=0||this.model.enableDeferUpdate||(v=this.element.find(".columns .pivotButton").length<1?1:this.element.find(".columns .pivotButton").length,this.element.find(".columns").addClass("widthSetter"),this.element.find(".columns").css("min-width",(this.element.find(".groupingBarPivot").width()-this.element.find(".values").width()-7)/v))),this.model.dataSource.data!=null&&this.model.url==""&&(h=0,n(".columns .pivotButton").each(function(){h+=parseInt(n(this).width()+10)}),n(".valueColumn").height()>30&&this.element.find(".values button").length==0&&this.element.find(".columns").width()<h&&(c=this.element.find(".columns .pivotButton").length,i=(this.element.find(".valueColumn").width()-this.element.find(".values").width())/(c==0?1:c)-70,this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"}))),this.element.find(".columns").height()>30?(i=this.model.isResponsive?this.element.find(".columns").width()/this.element.find(".columns .pivotButton").length-5:this.element.find(".columns").width()/2-60,this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"})):this.element.find(".columns .pivotButton").width()>this.element.find(".columns").width()&&(i=this.element.find(".columns").width()-60,this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),this.element.find(".drag").height()>30?(i=this.element.find(".groupingBarPivot").width()/4-35,this.element.find(".drag .pvtBtn").width(i).css({"text-overflow":"ellipsis"})):this.element.find(".drag .pivotButton").width()>this.element.find(".drag").width()&&(i=this.element.find(".drag").width()-60,this.element.find(".drag .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),this.element.find(".values").height()>30?(i=this.model.isResponsive?this.element.find(".values").width()/this.element.find(".values .pivotButton").length-5:this.element.find(".values").width()/2-40,this.element.find(".values .pvtBtn").width(i).css({"text-overflow":"ellipsis"})):(this.element.find(".values .pivotButton").width()>this.element.find(".values").width()||this.element.find(".pivotGridTable").find("thead th:eq(1), tbody td.value:eq(0)").length==0&&this.element.find(".values .pivotButton").length>0)&&(i=this.element.find(".values").width()-40,this.element.find(".values .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),o=0,u=0;u<this.element.find(".rows .pivotButton").length;u++)o=o+this.element.find(".rows .pivotButton:eq("+u+")").width();if((o>this.element.find(".rows").width()||this.element.find(".colfreeze").length>0&&o>this.element.find(".colfreeze").width()||this.element.find(".rows").parent(".emptyRows").length>0&&this.element.find(".rows").parent(".emptyRows").width()<o)&&(i=0,i=this.element.find(".colfreeze").length>0?this.element.find(".colfreeze").width()/2-40:this.element.find(".rows").width()/2-40,this.element.find(".rows .pvtBtn").width(i).css({"text-overflow":"ellipsis"})),this.model.enableDeferUpdate&&this.element.find(".columns .pivotButton").length!=0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){for(s=0,f=0,u=0;this.element.find(".columns .pivotButton").length>u;u++)s=this.element.find(".columns .pivotButton:eq("+u+")").width()+s+7;if(this.element.find(".pivotGridTable .colheader,.pivotGridTable tr:eq(0) .summary").each(function(){f=f+n(this).width()}),s>=f){var w=this.element.find(".pivotGridTable .colheader").length>0?1:0,r=w==0?140:f,i=r/(this.model.enableDeferUpdate?this.element.find(".columns .pivotButton").length:3)-15;this.model.enableDeferUpdate?this.element.find(".columns .pvtBtn").width(30).css({"text-overflow":"ellipsis"}):this.element.find(".columns .pvtBtn").width(i).css({"text-overflow":"ellipsis"})}}(this.element.find(".values").height()>this.element.find(".columns").height()||this.element.find(".columns").height()>this.element.find(".values").height())&&(this.element.find(".values").height()>this.element.find(".columns").height()?this.element.find(".columns").height(this.element.find(".values").height()):this.element.find(".values").height(this.element.find(".columns").height()));this.element.find(".colheader, .rowheader, .value").addClass("e-droppable");this.element.find(".summary").removeClass("e-droppable");this.model.enableGroupingBar&&(y=this.element.find(".pvtBtn"),p=t.buildTag("ul.pivotTree#pivotTree",(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?t.buildTag("li.calculatedFieldMenuItem",t.buildTag("a.menuItem",this._getLocalizedLabels("CalculatedField"))[0].outerHTML)[0].outerHTML:" ")+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToFilter"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToValues"))[0].outerHTML)[0].outerHTML)[0].outerHTML,n(this.element).append(p),n("#pivotTree").ejMenu({menuType:t.MenuType.ContextMenu,enableRTL:this.model.enableRTL,openOnClick:!1,contextMenuTarget:y,click:t.proxy(this._pivotContextClick,this),beforeOpen:t.proxy(this._contextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)}))},_clientPvtBtnDropped:function(i){var h,c,s,l,e;t.PivotAnalysis._valueSorting=null;this._isDragging=!1;t.Pivot.openPreventPanel(this);i.element.removeClass("dragHover").css("background-color","inherit");i.element.parent().removeClass("dragHover");this.element.find(".dragClone").remove();this.element.find(".dropIndicator").removeClass("dropIndicatorHover");this.element.find(".dragClone,.dropIndicator").remove();var r=n(i.target).hasClass("columns")||n(i.target).parents(".columns").length>0?"column":n(i.target).hasClass("grpRow")||n(i.target).parents(".grpRow").length>0||n(i.target).hasClass("rows")?"row":n(i.target).hasClass("values")||n(i.target).parents(".values").length>0?"value":n(i.target).hasClass("drag")||n(i.target).parents(".drag").length>0?"filter":"",o=i.element.text(),u=n(i.element).attr("fieldName");if(r!=""&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(u.toLowerCase().indexOf("[measures]")>=0&&r!="value"||u==this._getLocalizedLabels("Measures")&&r!="row"&&r!="column"||u.toLowerCase().indexOf("[measures]")<0&&r=="value")){t.Pivot._createErrorDialog(this._getLocalizedLabels("GroupingBarAlertMsg"),this._getLocalizedLabels("Warning"),this);return}if(r==""&&this._schemaData)if(o.toLowerCase()=="measures"&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)for(h=0;this.model.dataSource.values[0].measures.length>0;)selectedTreeNode=this._schemaData._tableTreeObj.element.find("li[tag='"+this.model.dataSource.values[0].measures[h].fieldName+"']"),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode);else this._schemaData&&(c=this._schemaData._tableTreeObj.element.find("li:contains('"+o+"')"),this._schemaData._tableTreeObj.uncheckNode(c));if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&r!=""&&r!="value"&&n.grep(this._calculatedField,function(n){return n.name==u}).length>0){t.Pivot._createErrorDialog(this._getLocalizedLabels("CalcValue"),this._getLocalizedLabels("Warning"),this);this.element.find(".dragClone,.dropIndicator").remove();return}var f=r==""?"":this._setSplitBtnTargetPos(i.event,r,"drop"),a=r==""?"":this._setSplitBtnTargetPos(i,r,"original"),v=n(i.element).hasClass("columns")||n(i.element).parents(".columns").length>0?"column":n(i.element).hasClass("grpRow")||n(i.element).parents(".grpRow").length>0||n(i.element).hasClass("rows")?"row":n(i.element).hasClass("values")||n(i.element).parents(".values").length>0?"value":n(i.element).hasClass("drag")||n(i.element).parents(".drag").length>0?"filter":"";r!=""&&r.toLowerCase()==v.toLowerCase()&&f>a&&(f=f-1);s={droppedFieldName:u,droppedFieldCaption:o,droppedClass:r,droppedPosition:f,isMeasuresDropped:u.toLocaleLowerCase().indexOf("measures")==0};this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&r!="value"?this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(s.droppedFieldName)==-1}):this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this._fieldMembers={},this._fieldSelectedMembers={},this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"pvtBtnDropped"},this));t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();t.Pivot.addReportItem(this.model.dataSource,s);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(l=n.grep(this.model.dataSource.values,function(n){return n.isCalculatedField==!0}),this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1}),n.merge(this.model.dataSource.values,l));(this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter)&&r=="filter"&&(e=t.Pivot.getReportItemByFieldName(this._selectedField,this.model.dataSource).item,e&&e.advancedFilter&&(e.advancedFilter=[]));this.refreshControl();t.isNullOrUndefined(this._schemaData)||(t.Pivot.getReportItemByFieldName(u,this.model.dataSource).item==null&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._schemaData._tableTreeObj.element.find("li[tag='"+u+"']").removeClass("filter").find(".treeDrop,.filter").remove(),this._schemaData._refreshPivotButtons())},_pvtBtnDropped:function(i){var h,r,c,l,v,a,w;t.Pivot.openPreventPanel(this);n(i.element).parent().removeClass("dragHover");n(i.element).removeClass("dragHover");this._isUpdateRequired=!0;this._isDragging=!1;this.element.find(".dropIndicator").removeClass("dropIndicatorHover");var s=null,f="",o="",e,y=!1,p=!1;if(droppedClass=t.isNullOrUndefined(i.target.className)?n(i.target).hasClass("columns")?"columns":n(i.target).hasClass("grpRow")?"rows":n(i.target).hasClass("values")?"values":n(i.target).hasClass("drag")?"drag":"":i.target.className.indexOf("e-droppable")>=0?i.target.className.split(" ")[0]:"",droppedClass=droppedClass=="grpRow"?"rows":droppedClass,y=n(i.element).parent().find(".filtered").length>0?!0:!1,this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(n(i.target).hasClass("pvtBtn")&&this.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode&&(droppedClass=n(i.target).attr("axis").toLowerCase()),e=t.isNullOrUndefined(i.element.attr("fieldCaption"))?i.element.text():i.element.attr("fieldCaption"),p=n(i.element).parent().find(".descending").length>0?!0:!1,droppedClass==""&&(i.target.tagName=="BUTTON"||i.target.tagName=="SPAN")&&(droppedClass=i.target.parentNode.parentElement.className.split(" ")[0]),h=0;h<this._pivotTableFields.length;h++)this._pivotTableFields[h].name==e&&(this._pivotTableFields[h].isSelected=!0,o=this._pivotTableFields[h]);else t.isNullOrUndefined(i.target.className)?(s=n(i.target),f=n(i.target).hasClass("columns")?"Categorical":n(i.target).hasClass("grpRow")?"Series":n(i.target).hasClass("drag")?"Slicer":"",droppedClass=n(i.target).hasClass("columns")?"columns":n(i.target).hasClass("grpRow")?"rows":n(i.target).hasClass("values")?"values":n(i.target).hasClass("drag")?"drag":""):(s=i.target.className.indexOf("pvtBtn")>-1?n(i.target).parents(".e-droppable")[0]:i.target.className.indexOf("e-droppable")?i.target:i.target[0].tagName.toLowerCase()=="td"?i.target.children(":last")[0]:i.target,f=s.className.split(" ")[0]=="columns"?"Categorical":s.className.split(" ")[0]=="rows"||s.className.split(" ")[0]=="grpRow"?"Series":s.className.split(" ")[0]=="filters"?"Slicer":"",droppedClass=s.className.split(" ")[0]),f==""&&i.element.parent().attr("tag").indexOf("[Measures]")>-1&&(f=this.element.find(".schemaRow .pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").length>0?"Series":"Categorical"),o=n(i.element.parent()[0]).attr("tag"),droppedClass=droppedClass=="grpRow"?"rows":droppedClass,f=f=="grpRow"?"Series":f,e=i.element.text();if(this.element.find(".dragClone").remove(),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(o.split(":")[1].toLocaleUpperCase()=="MEASURES"&&(droppedClass!="columns"||droppedClass!="rows")&&(droppedClass=="drag"||droppedClass=="values")||o.toUpperCase().indexOf("[MEASURES]")>-1&&droppedClass!="values"&&(droppedClass=="rows"||droppedClass=="columns"||droppedClass=="drag")||o.toUpperCase().indexOf("[MEASURES]")==-1&&droppedClass=="values"))return t.Pivot._createErrorDialog(this._getLocalizedLabels("GroupingBarAlertMsg"),this._getLocalizedLabels("Error"),this),this.element.find(".dragClone,.dropIndicator").remove(),i.element.parent().removeAttr("style"),i.element.css("background-color","inherit"),!1;if(droppedClass=="rows"||droppedClass=="columns"||droppedClass=="values"||droppedClass=="drag"){if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&droppedClass!="values"&&(n.grep(this._calculatedField,function(n){return n.name==e}).length>0||n.grep(JSON.parse(this.getOlapReport()).PivotCalculations,function(n){return n.FieldHeader==e&&n.CalculationType==8}).length>0)){t.Pivot._createErrorDialog(this._getLocalizedLabels("CalcValue"),this._getLocalizedLabels("Warning"),this);i.element.parent().removeAttr("style");i.element.css("background-color","inherit");return}r=this._setSplitBtnTargetPos(i,droppedClass,"drop");c=this._setSplitBtnTargetPos(i,droppedClass,"original");droppedClass=="drag"&&this.element.find(".drag").text("").append("<span id='grpdrag' style='display:none'>filter<\/span>");try{report=JSON.parse(this.getOlapReport()).Report}catch(k){report=this.getOlapReport()}if(n(i.element.parent()).remove(),this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)l=i.element.parents(".pivotButton").attr("tag").split(":")[0],this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),n.isNumeric(r)&&droppedClass==l.toLowerCase()&&r>c&&(r=r-1),droppedClass=droppedClass=="rows"?"schemaRow":droppedClass=="columns"?"schemaColumn":droppedClass=="drag"?"schemaFilter":droppedClass=="values"?"schemaValue":"",this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(this.model.enableAdvancedFilter&&droppedClass=="schemaFilter"&&!t.isNullOrUndefined(this._curFilteredText)&&this._curFilteredText.indexOf(":")>-1&&(v=this._getAdvancedFilterInfo(this._curFilteredText.split(":")[1]),v.length>0&&this._removeFilterTag(v[0].levelUniqueName)),f=droppedClass=="schemaFilter"?"Slicer":f,params=JSON.parse(this._olapReport).CurrentCube+"--"+o+"--"+f+"--"+r,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),a=JSON.stringify(this.model.customObject),eventArgs=JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:params,currentReport:report,gridLayout:this.model.layout,customObject:a}),this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtBtnDroppedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs,this._pvtBtnDroppedSuccess)):(this._calculatedField.length>0&&droppedClass!="schemaValue"&&this._schemaData!=null&&this._calculatedFieldNodeRemove(o),this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),a=JSON.stringify(this.model.customObject),w=t.Pivot._getFilterParams(droppedClass,this._tempFilterData,e),eventArgs=JSON.stringify({action:"nodeDropped",dropAxis:droppedClass+"::"+r,headerTag:JSON.stringify(o),sortedHeaders:this._ascdes,filterParams:w,currentReport:report,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:a}),successMethod=this._renderControlSuccess,this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtBtnDroppedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,eventArgs,this._pvtBtnDroppedSuccess));else{if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&droppedClass!="values"&&n.grep(this._calculatedField,function(n){return n.name==e}).length>0){t.Pivot._createErrorDialog(this._getLocalizedLabels("CalcValue"),this._getLocalizedLabels("Warning"),this);this.model.editCellsInfo={};this._populatePivotGrid();return}var u=this._getDroppedItem(e),b={fieldName:u[0].fieldName,fieldCaption:u[0].fieldCaption},l=i.element.parents(".pivotButton").attr("tag").split(":")[0];this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&u.length>0&&droppedClass=="drag"&&(u[0].advancedFilter=[]);n.isNumeric(r)?droppedClass==l.toLowerCase()&&r>c?droppedClass=="rows"?this.model.dataSource.rows.splice(r-1,0,u[0]):droppedClass=="columns"?this.model.dataSource.columns.splice(r-1,0,u[0]):droppedClass=="values"?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures.splice(r-1,0,u[0]):this.model.dataSource.values.splice(r,0,u[0]):this.model.dataSource.filters.splice(r,0,u[0]):droppedClass=="rows"?this.model.dataSource.rows.splice(r,0,u[0]):droppedClass=="columns"?this.model.dataSource.columns.splice(r,0,u[0]):droppedClass=="values"?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures.splice(r,0,u[0]):this.model.dataSource.values.splice(r,0,u[0]):this.model.dataSource.filters.splice(r,0,u[0]):droppedClass=="rows"?this.model.dataSource.rows.push(u[0]):droppedClass=="columns"?this.model.dataSource.columns.push(u[0]):droppedClass=="values"?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures.push(u[0]):this.model.dataSource.values.push(u[0]):this.model.dataSource.filters.push(u[0]);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&droppedClass!="values"&&(this._schemaData!=null&&this._calcFieldNodeDrop(u[0]),this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(u[0].fieldName)==-1}));this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"pvtBtnDropped"},this));this._schemaData!=null&&(droppedClass==l&&r>c&&(r=r-1),this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._schemaData.element.find("button[fieldName='"+e+"']").remove():this._schemaData.element.find("#pivotButton"+e).parent().remove(),this._schemaData._createPivotButton(b,droppedClass=="rows"?"row":droppedClass=="columns"?"column":droppedClass=="drag"?"filter":droppedClass=="values"?"value":"",y,p,r));this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.getJSONData({action:"pvtBtnDropped"},this.model.dataSource,this)):(this.model.editCellsInfo={},this._populatePivotGrid())}}else this._removePvtBtn(i);t.isNullOrUndefined(this._schemaData)||this._schemaData._setPivotBtnWidth()},_getDroppedItem1:function(i){var f=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?!0:!1,r=n.grep(this.model.dataSource.columns,function(n){return n.fieldName==i}),u;return r.length>0?this.model.dataSource.columns=n.grep(this.model.dataSource.columns,function(n){return n.fieldName!=i}):(r=n.grep(this.model.dataSource.rows,function(n){return n.fieldName==i}),r.length>0?this.model.dataSource.rows=n.grep(this.model.dataSource.rows,function(n){return n.fieldName!=i}):(u=this.model.dataSource.values,this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(u=this.model.dataSource.values[0].measures),r=n.grep(u,function(n){return n.fieldName==i}),r.length>0?this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.dataSource.values[0].measures=n.grep(u,function(n){return n.fieldName!=i}):this.model.dataSource.values=n.grep(u,function(n){return n.fieldName!=i}):(r=n.grep(this.model.dataSource.filters,function(n){return n.fieldName==i}),r.length>0&&(this.model.dataSource.filters=n.grep(this.model.dataSource.filters,function(n){return n.fieldName!=i}))))),r},_clearCollapsedItems:function(t,i,u){return t=="rowheader"?u.rows=n.map(u.rows,function(t){return t.drilledItems!=r&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(i.repItms.replace(/&/g,"&"))<0)return[n]})),t}):t=="colheader"&&(u.columns=n.map(u.columns,function(t){return t.drilledItems!=r&&t.drilledItems.length&&(t.drilledItems=n.map(t.drilledItems,function(n){if(n.join("").indexOf(i.repItms.replace(/&/g,"&"))<0)return[n]})),t})),u},_setSplitBtnTargetPos:function(t,i,r){var e="",f,o,u;for(o=r=="drop"?n(t.target).parents(".pivotButton"):n(t.element).parents(".pivotButton"),i=i=="column"?"columns":i=="row"?"rows":i=="filter"?"drag":i=="value"?"values":i,f=this.element.find("."+i).children(".pivotButton"),u=0;u<f.length;u++)n(f[u]).attr("tag")==n(o).attr("tag")&&(e=u);return e},_pvtBtnDroppedSuccess:function(n){!t.isNullOrUndefined(n[0])&&n.length>0?n[2]!=null&&n[2]!=r&&(this.model.customObject=n[2].Value):!t.isNullOrUndefined(n.d)&&n.d.length>0?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):t.isNullOrUndefined(n)||t.isNullOrUndefined(n.OlapReport)||n!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.model.enableDeferUpdate?this._deferUpdateSuccess(n):this._renderControlSuccess(n);this._schemaData!=null&&this._schemaData._refreshPivotButtons()},_deferUpdateSuccess:function(i){t.isNullOrUndefined(i.PivotReport)&&t.isNullOrUndefined(i.OlapReport)?(this.setOlapReport(i.d[0].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(i.d[2].Value),JSON.parse(i.d[1].Value))):(t.isNullOrUndefined(i.PivotReport)?this.setOlapReport(i.OlapReport):this.setOlapReport(i.PivotReport),i.HeaderCounts!=r&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)));this.model.enableGroupingBar&&(report=JSON.parse(this.getOlapReport()),this._pivotTableFields=JSON.parse(report.ItemsProperties),this._createGroupingBar(report),this.element.find(".grpRow .rows").text(""),this.element.find(".grpRow .rows").children().remove(),this.element.find(".grpRow .rows").append(this._pivotRow),this._createFields(null,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth()));this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._calculatedField.length>0&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._schemaData!=null&&this._schemaButtonCreate();t.Pivot.closePreventPanel(this)},_clientRemovePvtBtn:function(i){t.PivotAnalysis._valueSorting=null;t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();var r=n(n(i.target).siblings()[0]).attr("fieldName");delete this._fieldMembers[r.toLowerCase()];delete this._fieldSelectedMembers[r.toLowerCase()];this._calculatedField.length>0&&n.grep(this.model.dataSource.values,function(n){return n.fieldName==r}).length>0?this.model.dataSource.values=n.grep(this.model.dataSource.values,function(n){return(n.isCalculatedField==null||n.isCalculatedField==!1||n.formula.indexOf(r)==-1)&&n.fieldName!=r}):t.Pivot.removeReportItem(this.model.dataSource,r,r.toLocaleLowerCase().indexOf("measures")==0);this.refreshControl();t.isNullOrUndefined(this._schemaData)||(this._schemaData._tableTreeObj.element.find("li[tag='"+r+"']").removeClass("filter").find(".treeDrop,.filter").remove(),this._schemaData.refreshControl())},_removePvtBtn:function(i){var v,f,h,r,c,y,s,u,p,o,a,l;if(this._isUpdateRequired=!0,this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(i.type=="click"){var f=n(n(i.target).siblings()[0]).attr("fieldName"),e="",s="";v=n(n(i.target).siblings()[0]).text()}else{var f=i.element.attr("fieldName"),e="",s="";v=i.element.text()}for(u=0;u<this.element.find(".pivotButton").length;u++)s=n(this.element.find(".pivotButton")[u]).find("button").attr("fieldName"),s==f&&(e=n(this.element.find(".pivotButton")[u]));if(n(e).remove(),this._schemaData!=null){if(a=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this._schemaData._tableTreeObj.element.find("li [tag='"+f+"']"):this._schemaData._tableTreeObj.element.find("li[id='"+f+"']"),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&a.length==0&&f.toLowerCase()=="measures"){for(this._schemaData.element.find("div[tag='"+e.attr("tag")+"']").remove(),u=0;u<this.model.dataSource.values[0].measures.length;u++)this._schemaData._nodeCheck=!0,selectedTreeNode=this._schemaData._tableTreeObj.element.find("li[tag='"+this.model.dataSource.values[0].measures[u].fieldName+"']"),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode),this.element.find("div[tag='values:"+this.model.dataSource.values[0].measures[u].fieldName+"']").remove(),this._schemaData.element.find("div[tag='values:"+this.model.dataSource.values[0].measures[u].fieldName+"']").remove();this.model.dataSource.values[0].measures=[];t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.getJSONData({action:"removeBtn"},this.model.dataSource,this)}this._schemaData._tableTreeObj.uncheckNode(a)}else this.model.dataSource.columns=n.grep(this.model.dataSource.columns,function(n){return n.fieldName!=f}),this.model.dataSource.rows=n.grep(this.model.dataSource.rows,function(n){return n.fieldName!=f}),this.model.analysisMode==t.Pivot.AnalysisMode.Olap?e.attr("tag").split(":")[1].toLowerCase()=="measures"?this.model.dataSource.values[0].measures=[]:this._getItemPosition(this.model.dataSource.values[0].measures,e.attr("tag").split(":")[1]).length>0&&this.model.dataSource.values[0].measures.splice(this._getItemPosition(this.model.dataSource.values[0].measures,e.attr("tag").split(":")[1])[0],1):this.model.dataSource.values=this._calculatedField.length>0?n.grep(this.model.dataSource.values,function(n){return(n.isCalculatedField==null||n.isCalculatedField==!1||n.formula.indexOf(f)==-1)&&n.fieldName!=f}):n.grep(this.model.dataSource.values,function(n){return n.fieldName!=f}),this.model.dataSource.filters=n.grep(this.model.dataSource.filters,function(n){return n.fieldName!=f}),this.model.analysisMode!=t.Pivot.AnalysisMode.Olap&&this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode?(this.model.editCellsInfo={},this._populatePivotGrid()):(t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.dataSource=this.clearDrilledItems(this.model.dataSource,{action:"removeButton"},this),this.getJSONData({action:"removeButton"},this.model.dataSource,this))}else{if(i.type=="click"?(f=n(n(i.target).siblings("button")).attr("fieldcaption"),r=n(n(i.target).siblings("button")).parent().attr("tag")):(f=i.element.attr("fieldcaption"),r=i.element.parent().attr("tag")),!t.isNullOrUndefined(this._tempFilterData)&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)for(c=0;c<this._tempFilterData.length;c++)for(y in this._tempFilterData[c])y==r.split(":")[1]&&this._tempFilterData[c][r.split(":")[1]]!=""&&this._tempFilterData.splice(c,1);for(delete this._fieldMembers[r.split(":")[r.split(":").length-1]],delete this._fieldSelectedMembers[r.split(":")[r.split(":").length-1]],filterTag="",filterItems="",e="",r="",s="",h="",e=this.element.find(".pivotButton:contains("+f+")"),u=0;u<this._pivotTableFields.length;u++)this._pivotTableFields[u].name==f&&(this._pivotTableFields[u].isSelected=!1,r=this._pivotTableFields[u]);try{h=JSON.parse(this.getOlapReport()).Report}catch(w){h=this.getOlapReport()}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)if(r=n(e).attr("tag"),s=r.indexOf("[Measures]")>-1||r.indexOf("[")>-1?r.split(":")[1]:this._getNodeUniqueName(r),s=="[Measures]"){if(e.remove(),!t.isNullOrUndefined(this._schemaData))for(this._schemaData.element.find(".pivotButton:contains("+f+")").remove(),u=0;u<this._schemaData.model.pivotCalculations.length&&r.indexOf("Measures")>-1;u++)s=this._schemaData.model.pivotCalculations[u].Tag,this._schemaData._isMeasureBtnRemove=!0,selectedTreeNode=this._getNodeByUniqueName(s),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode);this._waitingPopup.show();this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.customObject});l=JSON.stringify(this.model.customObject);o=JSON.stringify({action:"removeButton",headerInfo:r,currentReport:h,gridLayout:this.model.layout,customObject:l});!t.isNullOrUndefined(this._schemaData)&&r.indexOf("[Measures]")<0&&r.indexOf("Measures")>=0&&this._schemaData.element.find(".schemaValue .pivotButton").remove();this.model.enableDeferUpdate&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(this._removeButtonDeferUpdate=!0,this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o.replace("removeButton","removeButtonDeferUpdate"),this._pvtBtnDroppedSuccess),this.element.find(".schemaNoClick").removeClass("freeze"),this._waitingPopup.hide()):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o,this._pvtBtnDroppedSuccess)}else if(t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),t.isNullOrUndefined(this._schemaData)){if(l=JSON.stringify(this.model.customObject),o=JSON.stringify({action:"removeButton",headerInfo:r,currentReport:h,gridLayout:this.model.layout,customObject:l}),t.isNullOrUndefined(r))return!1;this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o.replace("removeButton","removeButtonDeferUpdate"),this._pvtBtnDroppedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeButton,o,this._pvtBtnDroppedSuccess)}else selectedTreeNode=this._getNodeByUniqueName(s),this._schemaData._tableTreeObj.uncheckNode(selectedTreeNode);else filterTag="schemaRow::"+r.id+"::FILTERED"+filterItems,p=this._droppedClass!=""?this._droppedClass:r.pivotType=="PivotItem"?"schemaRow":"schemaValue",this._droppedClass="",n(e).remove(),this._waitingPopup=this.element.data("ejWaitingPopup"),t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this._schemaData!=null?(a=this._schemaData._tableTreeObj.element.find("li:contains('"+f+"')"),this._schemaData._tableTreeObj.uncheckNode(a)):(this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.customObject}),l=JSON.stringify(this.model.customObject),o=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:p+"::",sortedHeaders:this._ascdes,filterParams:filterTag,currentReport:h,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:l}),this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeStateModified,o.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeStateModified,o,this._nodeStateModifiedSuccess))}},_getNodeUniqueName:function(n){for(var t="",i=0;i<n.split(":")[1].split(".").length;i++)t!=""&&(t+="."),t+="["+n.split(":")[1].split(".")[i]+"]";return t},_getNodeByUniqueName:function(t){for(var r=null,i=0;i<n(this._schemaData._tableTreeObj.element.find("li")).length;i++)n(this._schemaData._tableTreeObj.element.find("li")[i]).attr("tag").toLowerCase()==t.toLowerCase()&&(r=n(this._schemaData._tableTreeObj.element.find("li")[i]));return r},_nodeStateModifiedSuccess:function(n){n[0]!=r?n[2]!=null&&n[2]!=r&&(this.model.customObject=n[2].Value):n.d!=r?n.d[2]!=null&&n.d[2]!=r&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=r&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.customObject});this.model.enableDeferUpdate?this._deferUpdateSuccess(n):this._renderControlSuccess(n)},_drillDownSuccess:function(i){if(i[0]!=r)this.setJSONRecords(i[0].Value),this.setOlapReport(i[1].Value),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=JSON.parse(i[1].Value).Report,i[2].Value!=r&&i[2].Value!="undefined"&&(this._pivotClientObj.reports=i[2].Value)),i[3]!=null&&i[3]!=r&&i[3].Key=="PageSettings"&&(this.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i[4].Value).Column/JSON.parse(i[3].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i[4].Value).Row/JSON.parse(i[3].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i[3].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i[3].Value).SeriesPageSize):this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r?this._pagerObj.initPagerProperties(JSON.parse(i[4].Value),JSON.parse(i[3].Value)):t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i[4].Value),JSON.parse(i[3].Value)),i[5]!=null&&i[5]!=r&&(this.model.customObject=i[5].Value)),i[3]!=null&&i[3]!=r&&i[3].Key!="PageSettings"&&(this.model.customObject=i[3].Value);else if(i.d!=r)this.setJSONRecords(i.d[0].Value),this.setOlapReport(i.d[1].Value),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=JSON.parse(i.d[1].Value).Report,i.d[2].Value!=r&&i.d[2].Value!="undefined"&&(this._pivotClientObj.reports=i.d[2].Value),this._updatePageSettings(i.d,this._pivotClientObj)),i.d[3]!=null&&i.d[3]!=r&&i.d[3].Key=="PageSettings"&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i.d[4].Value).Column/JSON.parse(i.d[3].Value).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.d[4].Value).Row/JSON.parse(i.d[3].Value).SeriesPageSize),this._categCurrentPage=JSON.parse(i.d[3].Value).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.d[3].Value).SeriesCurrentPage):this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r?this._pagerObj.initPagerProperties(JSON.parse(i.d[4].Value),JSON.parse(i.d[3].Value)):t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._pagerObj==null||this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i.d[4].Value),JSON.parse(i.d[3].Value)),i.d[5]!=null&&i.d[5]!=r&&(this.model.customObject=i.d[5].Value)),i.d[3]!=null&&i.d[3]!=r&&i.d[3].Key!="PageSettings"&&(this.model.customObject=i.d[3].Value);else{if(t.isNullOrUndefined(i.PivotRecords))return t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null?t.isNullOrUndefined(this._pivotClientObj)?t.isNullOrUndefined(this._pivotClientObj)&&(this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"),this._waitingPopup.hide()):this._pivotClientObj._waitingPopup.hide():this._pivotClientObj._waitingPopup.hide(),!1;this.setJSONRecords(i.PivotRecords);this.setOlapReport(i.OlapReport);t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=JSON.parse(i.OlapReport).Report,i.ClientReports!=r&&i.ClientReports!="undefined"&&(this._pivotClientObj.reports=i.ClientReports),i.PageSettings!=r&&i.PageSettings!=null&&this._pivotClientObj._pagerObj!=null&&this._pivotClientObj._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)));i.PageSettings!=r&&i.PageSettings!=null&&(this.model.enableVirtualScrolling||!t.isNullOrUndefined(this._pivotClientObj)&&this._pivotClientObj.model.enableVirtualScrolling?(this._categPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Column/JSON.parse(i.PageSettings).CategorialPageSize),this._seriesPageCount=Math.ceil(JSON.parse(i.HeaderCounts).Row/JSON.parse(i.PageSettings).SeriesPageSize),this._categCurrentPage=JSON.parse(i.PageSettings).CategorialCurrentPage,this._seriesCurrentPage=JSON.parse(i.PageSettings).SeriesCurrentPage):this._pagerObj&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=r&&this._pagerObj.initPagerProperties(JSON.parse(i.HeaderCounts),JSON.parse(i.PageSettings)));i.customObject!=null&&i.customObject!=r&&(this.model.customObject=i.customObject)}this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"drillDown",element:this.element,customObject:this.model.customObject});this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&this.model.enableVirtualScrolling==!1&&n(".e-pivotpager")[0]==null?this.excelLikeLayout(this.getJSONRecords()):this.renderControlFromJSON(this.getJSONRecords());try{this.model.currentReport=JSON.parse(this.getOlapReport()).Report}catch(f){this.model.currentReport=this.getOlapReport()}this._trigger("drillSuccess",this.element);t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null?t.isNullOrUndefined(this._pivotClientObj)?t.isNullOrUndefined(this._pivotClientObj)&&(this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"),this._waitingPopup.hide()):(!this._pivotClientObj||this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._startDrilldown)&&this._pivotClientObj.model.displaySettings.mode!="gridOnly"||this._pivotClientObj._waitingPopup.hide():n("#"+this._pivotClientObj._id+"_maxView")[0]&&this._maxViewLoading?(this._maxViewLoading.hide(),this._pivotClientObj._waitingPopup.hide()):this._pivotClientObj.model.displaySettings.mode=="gridOnly"&&this._pivotClientObj._waitingPopup.hide();t.isNullOrUndefined(this._pivotClientObj)?this._waitingPopup.hide():this._pivotClientObj._pivotGrid._startDrilldown=!1;var u={action:this._drillAction,customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",u)},saveReport:function(n,i,r){var u,f;i.toLowerCase()=="local"?this._trigger("saveReport",{report:this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this.model.dataSource:this.getOlapReport()}):(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(report=JSON.stringify(this.model.dataSource),u="clientMode"):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(report=JSON.parse(this.getOlapReport()).Report,u="serverMode"),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"saveReport",element:this.element,customObject:this.model.customObject}),f=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:n,clientReports:report,operationalMode:u,customObject:f})))},loadReport:function(n,i,r){var e,f,o,u;if(this._waitingPopup.show(),i.toLowerCase()=="local")if(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)this._trigger("loadReport",{targetControl:this,dataModel:this.model.analysisMode}),this.refreshPivotGrid();else{this._trigger("loadReport",{targetControl:this,dataModel:this.model.analysisMode});try{o=JSON.parse(this.getOlapReport()).Report}catch(s){o=this.getOlapReport()}this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"loadReport",element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);e=JSON.stringify({action:"loadReport",gridLayout:this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.layout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,reportName:n,operationalMode:"serverMode",clientReports:o,customObject:u});this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.loadReport,e,this._renderControlSuccess)}else this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"loadReport",element:this.element,customObject:this.model.customObject}),u=JSON.stringify(this.model.customObject),this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(f="clientMode",this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.loadReport,JSON.stringify({action:"loadReport",gridLayout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,reportName:n,operationalMode:f,customObject:u}),this._loadReportSuccess)):this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(f="serverMode",e=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?JSON.stringify({action:"loadReport",reportName:n,gridLayout:this.model.layout,enablePivotFieldList:this.model.enablePivotFieldList,operationalMode:f,customObject:u}):JSON.stringify({action:"loadReport",gridLayout:this.layout(),enablePivotFieldList:this.model.enablePivotFieldList,reportName:n,operationalMode:f,customObject:u}),this.doAjaxPost("POST",r+"/"+this.model.serviceMethodSettings.loadReport,e,this._renderControlSuccess))},_loadReportSuccess:function(n){n.d!=r&&n.d.length>0?this.setOlapReport(JSON.parse(n.d[0].Value)):this.setOlapReport(JSON.parse(n.report));this.model.dataSource=this.getOlapReport();this.refreshPivotGrid();this._unWireEvents();this._wireEvents()},doAjaxPost:function(i,u,f,e,o,s){t.isNullOrUndefined(f.XMLA)&&JSON.parse(f).action!="cellEditing"&&(this.model.editCellsInfo={});var h,c,l,a=!0;f.XMLA==r?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:i,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(i){n.proxy(i,this);var r={action:!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(s.action)?s.action:JSON.parse(f).action,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",r)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();t.isNullOrUndefined(this._pivotClientObj)||this._pivotClientObj._waitingPopup==null||this._pivotClientObj._waitingPopup.hide();var i={action:this._drillAction!=""?this._drillAction:"initialize",customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",i);this.renderControlFromJSON("");this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.Pivot._createErrorDialog(n.statusText,this._getLocalizedLabels("Error"),this);n.statusText},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()},refreshPagedPivotGrid:function(i,r){if(this._isUpdateRequired=!0,t.isNullOrUndefined(this._pivotClientObj)&&(this._waitingPopup=n("#"+this._id).data("ejWaitingPopup"),this._waitingPopup.show()),i=i.indexOf("categ")!=-1?"categorical":"series",this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)i=="categorical"?this._categCurrentPage=parseInt(r):this._seriesCurrentPage=parseInt(r),t.olap.base.getJSONData({action:"navPaging"},this.model.dataSource,this);else{var u;try{u=JSON.parse(this.getOlapReport()).Report}catch(f){u=this.getOlapReport()}this.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"pagingDeferUpdate",pagingInfo:i+":"+r,currentReport:u,layout:this.layout(),customObject:JSON.stringify(this.model.customObject)}),this._deferUpdateSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:i+":"+r,currentReport:u,layout:this.layout(),customObject:JSON.stringify(this.model.customObject)}),this._renderControlSuccess)}},excelLikeLayout:function(i){var nt,v,g,rt,k,d,a,l,s,h,u,e,c;for(this._excelRowCount=0,u=0;u<i.length;u++)if(parseInt(i[u].Index.split(",")[0])==0)this._excelRowCount++;else break;this._rowCount=this._excelRowCount;var r=jQuery.extend(!0,[],i),f=[],w=[],o=null,y=0;if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&(nt=n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this._pivotClientObj.getOlapReport():this.getOlapReport()),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.dataSource.rows.length==0&&this.model.dataSource.data!=null||this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&nt!==""&&JSON.parse(nt).PivotRows.length==0)){this._excelLikeJSONRecords=null;this.renderControlFromJSON();this._excelRowCount=0;return}if(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot&&r!=null&&r!=""){for(v=null,s=r[0].CSS!="colheader"?r[0].ColSpan*this._excelRowCount:0;s<r.length;s++){if(r[s].Info.toLowerCase().indexOf("[measure")>-1&&(v=parseInt(r[s].Index.split(",")[1])),r[s].CSS.indexOf("value")>-1)break;g=parseInt(r[s].Index.split(",")[1])}for(v!=null&&v!=g&&v!=0&&this._columnExcelLikeLayout(r,v,g),rt=r.length/this._excelRowCount,k=0;k<rt&&k<r.length;k++)for(d=0;d<=g&&d<r.length;d++)if(u=k*this._excelRowCount+d,r[u].CSS=="colheader"&&r[u].Span!="Block"&&(r[u].Info.toLowerCase().indexOf("[measure")==-1||r[u].Info.toLowerCase().indexOf("[measure")>-1&&v!=null&&v==0)&&r[u].ColSpan>1){for(e=u;e<u+r[u].RowSpan;e++){for(c=e+this._excelRowCount;c<e+r[u].ColSpan*this._excelRowCount;c=c+this._excelRowCount)r[c].Span="Block";e!=u&&(r[e].Span="Block")}if(a=u+(r[u].RowSpan-1)+(r[u].ColSpan-1)*this._excelRowCount+1,l=null,r[a].CSS.indexOf("summary")>-1&&r[a].Value==this._getLocalizedLabels("Total")&&r[a-this._excelRowCount].CSS.indexOf("summary")==-1)l=a;else if(r[a].CSS.indexOf("summary")>-1&&r[a-this._excelRowCount].CSS.indexOf("summary")>-1)for(e=a-this._excelRowCount;e>=0&&e<r.length;e=e-this._excelRowCount)if(r[e].ColSpan>1||r[e-this._excelRowCount].CSS.indexOf("summary")==-1&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){l=e;break}l!=null&&(r[l].ColSpan=this.model.operationalMode!=t.PivotGrid.OperationalMode.ClientMode?r[l].ColSpan:parseInt(r[a].Index.split(",")[0])-parseInt(r[l].Index.split(",")[0])+1,r[u].ColSpan=r[u].ColSpan-r[l].ColSpan,r[u+r[u].ColSpan*this._excelRowCount]=n.extend(!0,{},r[l]),r[u+r[u].ColSpan*this._excelRowCount].RowSpan=r[l].RowSpan+r[u].RowSpan,r[u+r[u].ColSpan*this._excelRowCount].Value=r[u].Value+" Total")}}if(r!=null&&r!=""&&r[0].CSS!="colheader"&&!(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)){if(r[0].Index=="0,0"&&r[0].CSS!="colheader")for(y=r[0].ColSpan,r[0].RowSpan==0&&(r[0].RowSpan=1),e=0;e<r[0].RowSpan&&e<r.length;e++)f.push(r[e]),r[e].Level=1,r[e].Span="Block";for(s=r[0].RowSpan;s<r.length&&this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot&&this.model.dataSource.rows.length>0;s=s+this._excelRowCount)if(r[s].Info.toLowerCase().indexOf("[measure")>-1){o=parseInt(r[s].Index.split(",")[0]);break}for(u=0;u<r.length&&u<this._excelRowCount;u++)if(r[u].CSS=="rowheader"&&parseInt(r[u].Index.split(",")[0])==0&&r[u].Span!="Block"){for(r[u].Level=1,r[u+this._excelRowCount]!=null&&r[u+this._excelRowCount].CSS.indexOf("value")==-1&&(r[u].itemIndex=r[u+r[u].RowSpan-(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?1:0)].Index),f.push(r[u]),o!=null&&o==0&&r[u].Info.toLowerCase().indexOf("[measure")>-1&&w.push(r[u]),e=u+1;e<u+r[u].RowSpan;e++)(r[e].Info.toLowerCase().indexOf("[measure")==-1||o!=null&&o!=y-1)&&(r[e].Span="Block");this._rowExcelLikeLayout(u,r,f,2,o,w,y)}else(r[u].CSS=="summary rgtot"||r[u].CSS=="summary gtot"||r[u].CSS=="summary calc gtot"||r[u].CSS=="colheader"&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||(r[u].CSS=="summary"&&r[u].Value.indexOf(this._getLocalizedLabels("Total"))>-1||r[u].CSS=="summary row")&&this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot)&&parseInt(r[u].Index.split(",")[0])==0&&(o!=null&&o==y-1&&(r[u].Value+=" "+r[u+this._excelRowCount*parseInt(r[u].ColSpan)].Value),r[u].Value=r[u].Value==this._getLocalizedLabels("Total")?this._getLocalizedLabels("GrandTotal"):r[u].Value,f.push(r[u]),r[u].Level=1);if(o!=null&&o==0){for(u=0;u<w.length;u++)f.push(n.extend(!0,{},w[u])),f[f.length-1].CSS="summary",f[f.length-1].Value=this._getLocalizedLabels("Total")+" "+f[f.length-1].Value;w.splice(0,w.length)}var p=f.length,b=0,tt,ut,it=!1;for(u=0;u<p;u++){for(b=b+u,tt=f[u].itemIndex!=null?f[u].itemIndex:f[u].Index,ut=parseInt(tt.split(",")[0])*this._excelRowCount+parseInt(tt.split(",")[1]),h=ut;h<r.length;h=h+this._excelRowCount)(r[h].CSS.indexOf("value")>-1||r[h].CSS.indexOf("colheader")>-1||r[h].CSS.indexOf("calc")>-1||r[h].CSS.indexOf("cstot")>-1||r[h].CSS.indexOf("cgtot")>-1||r[h].CSS.indexOf("none")>-1)&&parseInt(r[h].Index.split(",")[0])>=y&&(it=!0),it&&(b=b+(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?parseInt(p):this._excelRowCount),f[b]=n.extend(!0,{},r[h]));b=0;it=!1}for(u=0;u<p;u++)f[u]!=null&&(f[u].Span="none",isNaN(f[u].Level)&&(f[u].Level=1),f[u].Index=="0,0"&&f[u].CSS!="colheader"&&u==0||(f[u].RowSpan=1),f[u].ColSpan=o!=null&&o==y-1&&f[u].CSS=="rowheader"&&f[u].Info.toLowerCase().indexOf("[measure")==-1?f.length/p:o!=null&&o==0&&f[u].Info.toLowerCase().indexOf("[measure")>-1&&f[u].CSS=="rowheader"?f.length/p:o!=null&&o!=y-1&&o!=0&&(f[u].Info.toLowerCase().indexOf("[measure")>-1||f[u].CSS=="rowheader"&&parseInt(f[u].Index.split(",")[0])<o)?f.length/p:1);this._excelRowCount=p}for(r!=null&&f.length==0&&(f=r),e=0;e<f.length/this._excelRowCount;e++)for(c=0;c<this._excelRowCount;c++)f[e*this._excelRowCount+c].i=""+e+","+c+"",f[e*this._excelRowCount+c].Span="none";this._excelLikeJSONRecords=f;this.renderControlFromJSON()},_rowExcelLikeLayout:function(n,i,r,u,f,e,o){for(var v,c,h,l=!1,s=n+(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?i[n].ColSpan*this._excelRowCount:this._excelRowCount),a=0;a<i[n].RowSpan&&s<i.length&&i[s].CSS.indexOf("value")==-1;s++,a++){if(f!=null&&f!=o-1&&f!=0&&i[s].Info.toLowerCase().indexOf("[measure")>-1&&i[s].Span!="Block"&&(l=!0),v=f!=null&&f==o-1?i[s].CSS=="summary row"&&(i[s+this._excelRowCount].CSS=="summary row"||i[s+this._excelRowCount].CSS=="none"||i[s+this._excelRowCount].Info.toLowerCase().indexOf("[measure")>-1):f!=null&&f!=o-1&&f!=0?i[s].CSS=="summary"&&(i[s+this._excelRowCount].CSS=="summary"||i[s+this._excelRowCount].CSS=="none"||i[s+this._excelRowCount].Info.toLowerCase().indexOf("[measure")>-1||parseInt(i[s].Index.split(",")[0])-1<=f):!1,(i[s].CSS=="rowheader"||i[s].CSS=="none"||v)&&i[s].Span!="Block"){for(h=s+1;h<s+i[s].RowSpan;h++)(i[h].Info.toLowerCase().indexOf("[measure")==-1||f!=null&&f!=o-1)&&(i[h].Span="Block");if(i[s].Level=u,i[s].CSS!="none")if(i[s+this._excelRowCount]!=null&&i[s+this._excelRowCount].CSS.indexOf("value")==-1&&(i[s].itemIndex=i[s+i[s].RowSpan-(this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?1:0)].Index),v){for(c=s-i[n].ColSpan*this._excelRowCount;c>=0&&c<i.length;c--)if(i[c].Value!=""){i[s].Value=i[c].Value;i[s].Level=i[n].Level;break}f!=null&&f!=o-1&&f!=0&&parseInt(i[s].Index.split(",")[0])-1==f?e.push(i[s]):(i[s].Value+=" "+i[s+this._excelRowCount*parseInt(i[s].ColSpan)].Value,r.push(i[s]))}else r.push(i[s]);i[s].Span="Block";i[s].CSS!="summary row"&&i[s].CSS!="summary"&&this._rowExcelLikeLayout(s,i,r,u+1,f,e,o)}if(l&&a+1==i[n].RowSpan){for(l=!1,h=0;h<e.length;h++)e[h].Value=i[n].Value+" "+e[h].Value,r.push(e[h]);e.splice(0,e.length)}}},_columnExcelLikeLayout:function(t,i,r){for(var l,u,o,s,f,c,y,e,v,h,p=t.length/this._excelRowCount,a=0;a<p&&a<t.length;a++)for(l=0;l<=r&&l<t.length;l++)if(u=a*this._excelRowCount+l,t[u].CSS=="colheader"&&t[u].Span!="Block"&&t[u].Info.toLowerCase().indexOf("[measure")==-1&&t[u].ColSpan>1){for(f=u;f<u+t[u].RowSpan;f++){for(e=f+this._excelRowCount;e<f+t[u].ColSpan*this._excelRowCount;e=e+this._excelRowCount)t[e].Span="Block";f!=u&&(t[f].Span="Block")}if(o=u+(t[u].RowSpan-1)+(t[u].ColSpan-1)*this._excelRowCount+1,t[o].Info.toLowerCase().indexOf("[measure")>-1&&JSON.parse(this.getOlapReport()).PivotCalculations.length>1&&i!=null&&i!=r&&i!=0){for(s=[],f=u+t[u].RowSpan;f<=o;f=f+(t[f].ColSpan+1)*this._excelRowCount)if(c=f+(t[f].RowSpan-1)+(t[f].ColSpan-1)*this._excelRowCount+1,t[c].CSS.indexOf("summary")>-1){for(t[c-1].RowSpan=t[c-1].RowSpan+t[c].RowSpan,y=parseInt(t[c].Index.split(",")[0])*this._excelRowCount,e=0;e<this._excelRowCount;e++)t.splice(parseInt(t[o].Index.split(",")[0])*this._excelRowCount+this._excelRowCount+e+s.length*this._excelRowCount,0,n.extend(!0,{},t[y+e]));s.push(y);t[f].ColSpan=t[f].ColSpan-1}for(v=s.length-1;v>=0;v--)t.splice(parseInt(t[s[v]].Index.split(",")[0])*this._excelRowCount,this._excelRowCount);s.length>0&&(t[u].ColSpan=t[u].ColSpan-s.length,h=u+t[u].ColSpan*this._excelRowCount,t[h].ColSpan=s.length,t[h].RowSpan=t[u].RowSpan,t[h].Value=t[u].Value+" Total",t[h].CSS="summary",t[h].Span="none",t[h].State=0)}else t[o].Info.toLowerCase().indexOf("[measure")>-1&&t[o+1].CSS.indexOf("summary")>-1&&JSON.parse(this.getOlapReport()).PivotCalculations.length==1&&i!=null&&i!=r&&i!=0&&(t[u].ColSpan=t[u].ColSpan-1,t[u+t[u].ColSpan*this._excelRowCount]=n.extend(!0,{},t[o+1]),t[o+1].Value="",t[u+t[u].ColSpan*this._excelRowCount].Value=t[u].Value+" Total",t[u+t[u].ColSpan*this._excelRowCount].RowSpan=t[u].RowSpan)}},_getColumnIndices:function(t,i,r,u){var f=t=="rows"?i.Index.split(",")[1]:t=="columns"?i.Index.split(",")[0]:null;return i.Value==r&&(n.inArray(Number(f),u)==-1?u.push(Number(f)):u),u},renderControlFromJSON:function(){var p=null,i,tt,v,e,ht,ct,lt,gt,l,ut,s,u,h,k,g,w,c,o,ft,y,vt,yt,ri,bt,nt,kt,ot,st,r;if(!t.isNullOrUndefined(this.model.valueSortSettings)&&this.element.find(".valueSorting").length>0&&!t.isNullOrUndefined(t.PivotAnalysis._valueSorting)&&(p=this.element.find(".valueSorting").parent()),i=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this._excelLikeJSONRecords:this.getJSONRecords(),this.model.enableConditionalFormatting&&this._isFormatApply&&(i=this._refreshCellFormatting(i)),this.model.enableConditionalFormatting&&!this._isFormatApply&&(i=this._applyCodeBehindFormatting(i)),n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(tt=n("<div id="+this._id+"Toolbar style='width:"+this._pivotClientObj._gridWidth+";height:"+this._pivotClientObj._gridHeight+";overflow:auto;margin-top:5px;margin-left:5px'><\/div>")),i!=null&&i!="")for(v=0;v<i.length;v++)i[v].Value=="Total"&&(i[v].Value=this._getLocalizedLabels("Total")),i[v].Value=="Grand Total"&&(i[v].Value=this._getLocalizedLabels("GrandTotal"));if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this._applyLocale(i),e=n('<table class="pivotGridTable" cellspacing="0" cellpadding="0" role=\'grid\' aria-readonly=\'true\'><\/table>'),this.model.isResponsive&&e.addClass("e-table"),i!=null&&i!=""||this.model.enableGroupingBar){if(i!=null&&i!=""){for(lt=this._rowCount,this._rowCount=0,gt=this,index=0;index<i.length;index++)if(parseInt(i[index].Index.split(",")[0])==0)this._rowCount++;else break;this._rowCount=this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this._excelRowCount:this._rowCount;var it=n("<thead><\/thead>"),rt=n("<tbody><\/tbody>"),at=!0,b=0;for(i[0].CSS=="none"?b=n(this.element).parents(".e-pivotclient").length>0&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&JSON.parse(this.getOlapReport()).PivotCalculations.length==0&&JSON.parse(this.getOlapReport()).PivotRows.length==0?JSON.parse(this.getOlapReport()).PivotColumns.length-1:i[0].RowSpan-1:(jQuery.each(i,function(n){return b+=i[n].RowSpan,i[n].CSS=="colheader"}),b=b-2),l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ut=!1,index=0;index<i.length;index++)if(index<this._rowCount)if(at){for(at=index>=b?!1:!0,s="<tr role='row'>",this.model.enableGroupingBar&&i[index].Index=="0,0"&&i[index].CSS=="colheader"&&(s=s+"<"+(l?"td":"th")+" class='grpRow' p='-1,-1' colspan= 1 rowspan="+(this._rowCount-1)+"> <div class=rows>"+this._getLocalizedLabels("DragFieldHere")+"<\/div><\/th>",ut=!0),u=index;u<i.length;u=u+this._rowCount)if(i[u].Span!="Block")if(s=i[u].Index=="0,0"&&i[u].CSS!="colheader"&&this.model.enableGroupingBar?s+"<"+(l?"td":"th")+" class=grpRow p="+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='columnheader' aria-describedby='row'"+(i[u].i==null?"":"i="+i[u].i)+">"+t.buildTag("span#row","rows",{display:"none"})[0].outerHTML+(i[u].State==0?'<span style="margin-left: 0px"><\/span>':i[u].State==2?'<span class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":"")+i[u].Value+t.buildTag("div.rows",this._pivotRow,{})[0].outerHTML+"<\/th>":s+"<"+(l?"td":"th")+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+(i[u].CSS=="none"?" p="+i[u].Index:'" p='+i[u].Index)+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='columnheader'"+(i[u].i==null?"":"i="+i[u].i)+">"+(i[u].State==0?'<span style="margin-left: 10px"><\/span>':i[u].State==2?'<span class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span class="collapse e-icon" aria-describedby=\'collapsing\' title=" '+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":"")+i[u].Value+"<\/th>",i[u].RowSpan>1&&i[u].ColSpan<=1)for(r=u+1;r<u+i[u].RowSpan;r++)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan<=1)for(r=u+this._rowCount;r<u+i[u].ColSpan*this._rowCount;r=r+this._rowCount)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan>1)for(r=u;r<u+i[u].RowSpan;r++){for(h=r+this._rowCount;h<r+i[u].ColSpan*this._rowCount;h=h+this._rowCount)i[h].Span="Block";r!=u&&(i[r].Span="Block")}s+="<\/tr>";n(s).text()!=""&&n(it).append(s)}else{for(s="<tr role='row'>",parseInt(i[index].Index.split(",")[0])==0&&parseInt(i[index].Index.split(",")[1])==this._rowCount-1&&ut&&(s=s+"<td class='rowheader' p='-1,-2' colspan=1 rowspan=1>"+(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.layout==t.PivotGrid.Layout.ExcelLikeLayout?this._getLocalizedLabels("GrandTotal"):this._getLocalizedLabels("Total"))+"<\/td>"),u=index;u<i.length;u=u+this._rowCount)if(i[u].Span!="Block")if(s=i[u].CSS=="rowheader"||i[u].CSS=="summary"||i[u].CSS.indexOf("summary rstot")>-1||i[u].CSS.indexOf("summary stot")>-1||i[u].CSS=="summary row"||i[u].CSS.indexOf("summary rgtot")>-1?this.layout().toLowerCase()=="excellikelayout"?s+"<"+(l?"td":"th")+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+'" p='+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='rowheader'"+(i[u].i==null?"":"i="+i[u].i)+">"+(i[u].State==2?'<span style="margin-'+(this.model.enableRTL?"right:":"left:")+i[u].Level*10+'px" class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span style="margin-'+(this.model.enableRTL?"right:":"left:")+i[u].Level*10+'px" class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":'<span style="margin-'+(this.model.enableRTL?"right:":"left:")+(this._excelLikeJSONRecords!=null&&i[u].CSS=="summary row"?i[u].Level*10:(i[u].Level==1?1:i[u].Level+2)*10)+'px"> <\/span>')+i[u].Value+"<\/th>":s+"<"+(l?"td":"th")+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+'" p='+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='rowheader'>"+(i[u].State==0?'<span style="margin-left: 10px"><\/span>':i[u].State==2?'<span class="expand e-icon" aria-describedby=\'expansion\' title="'+this._getLocalizedLabels("Expand")+"\"> <p id='expansion' style='display:none'>collapsed<\/p><\/span>":i[u].State==1?'<span class="collapse e-icon" aria-describedby=\'collapsing\' title="'+this._getLocalizedLabels("Collapse")+"\"> <p id='collapsing' style='display:none'>expanded<\/p><\/span>":"")+i[u].Value+"<\/th>":s+"<td"+(i[u].CSS=="none"?"":' class="'+i[u].CSS)+'" p='+i[u].Index+" colspan="+i[u].ColSpan+" rowspan="+i[u].RowSpan+" role='gridcell'"+(i[u].i==null?"":"i="+i[u].i)+">"+(i[u].State==2?'<span class="expand e-icon" title="'+this._getLocalizedLabels("Expand")+'"> <\/span>':i[u].State==1?'<span class="collapse e-icon" title="'+this._getLocalizedLabels("Collapse")+'"> <\/span>':"")+i[u].Value+"<\/td>",i[u].RowSpan>1&&i[u].ColSpan<=1)for(r=u+1;r<u+i[u].RowSpan;r++)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan<=1)for(r=u+this._rowCount;r<u+i[u].ColSpan*this._rowCount;r=r+this._rowCount)i[r].Span="Block";else if(i[u].ColSpan>1&&i[u].RowSpan>1)for(r=u;r<u+i[u].RowSpan;r++){for(h=r+this._rowCount;h<r+i[u].ColSpan*this._rowCount;h=h+this._rowCount)i[h].Span="Block";r!=u&&(i[r].Span="Block")}s+="<\/tr>";n(s).text()!=""&&n(rt).append(s)}l?this._renderFrozenGridTable(e,it,rt):(n(e).append(it),n(e).append(rt))}}else ht=t.buildTag("tr",t.buildTag("th","",{width:"70px"})[0].outerHTML+t.buildTag("th","",{width:"70px"})[0].outerHTML+t.buildTag("th","",{width:"70px"})[0].outerHTML),ct=t.buildTag("tr",t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML+t.buildTag("td","",{width:"70px"})[0].outerHTML)[0].outerHTML,n(e).append(ht),n(e).append(ct),this._rowCount=0;if(this._unWireEvents(),this._wireEvents(),this.model.enableVirtualScrolling||!(n(e).find("tr:last > td").length>0)||n(e).find("tr:last").find("td").text()!=""||this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this._pagerObj!=null||n(e).find("tr:last").hide(),this.model.enablePaging||this.model.enableVirtualScrolling||(this._hideGrandTotal(e),this._hideSubTotal(e)),this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.enableCollapseByDefault||!t.isNullOrUndefined(this.model.collapsedMembers))&&!t.isNullOrUndefined(i))if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.enableCollapseByDefault){var l=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ni=t.isNullOrUndefined(this.model.dataSource.data)?n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()).PivotRows.length:JSON.parse(this.getOlapReport()).PivotRows.length:this.model.dataSource.rows.length,ti=t.isNullOrUndefined(this.model.dataSource.data)?n(this.element).parents(".e-pivotclient").length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?JSON.parse(this._pivotClientObj.getOlapReport()).PivotColumns.length:JSON.parse(this.getOlapReport()).PivotColumns.length:this.model.dataSource.columns.length;for(this.model.collapsedMembers={},k=ni;k>=0;k--)for(thRList=l?n(e).find(".pivotGridRowTable [p^='"+k+",']:has('span.collapse')[class^='rowheader']"):n(e).find("th[p^='"+k+",']:has('span.collapse')[class^='rowheader']"),w=this._getFieldName(thRList[0]),this.model.collapsedMembers[w]=[],c=0;c<thRList.length;c++)this.model.collapsedMembers[w].push(n(thRList[c]).clone().children().remove().end().text()),this._collapseMember(e,n(thRList[c]).find(".collapse"));for(g=ti;g>=0;g--)for(thCList=n(e).find((l?".pivotGridFrozenTable ":"th")+"[p$=',"+g+"']:has('span.collapse')[class$='colheader']"),w=this._getFieldName(thCList[0]),this.model.collapsedMembers[w]=[],c=0;c<thCList.length;c++)this.model.collapsedMembers[w].push(n(thRList[c]).clone().children().remove().end().text()),this._collapseMember(e,n(thCList[c]).find(".collapse"))}else t.isNullOrUndefined(this.model.collapsedMembers)||(o=this,n.each(this.model.collapsedMembers,function(i,r){var r=r,c,l,a,v,u,f,h,s;if(o.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(u=0;u<o.model.dataSource.rows.length;u++)o.model.dataSource.rows[u].fieldName==i&&(c=u,l="row");for(u=0;u<o.model.dataSource.columns.length;u++)o.model.dataSource.columns[u].fieldName==i&&(c=u,l="column");if(!t.isNullOrUndefined(c))if(l=="row")for(u=o.model.dataSource.columns.length+1;u<o._rowCount;u+=t.isNullOrUndefined(f)?1:f.rowSpan){for(f=n(e).find("tBody th[p='"+c+","+u+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}else if(l=="column")for(u=o.model.dataSource.rows.length;u<Math.ceil(o.getJSONRecords().length/o._rowCount);u+=t.isNullOrUndefined(f)?1:f.colSpan){for(f=n(e).find("thead th[p='"+u+","+c+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("colheader")||n(f).attr("role")=="columnheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}}else{for(a=JSON.parse(o.getOlapReport()).PivotRows,v=JSON.parse(o.getOlapReport()).PivotColumns,u=0;u<a.length;u++)a[u].FieldName==i&&(c=u,l="row");for(u=0;u<v.length;u++)v[u].FieldName==i&&(c=u,l="column");if(!t.isNullOrUndefined(c))if(l=="row")for(u=v.length+1;u<o._rowCount;u+=t.isNullOrUndefined(f)?1:f.rowSpan){for(f=n(e).find("tBody th[p='"+c+","+u+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("rowheader")||n(f).attr("role")=="rowheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}else if(l=="column")for(u=a.length;u<Math.ceil(o.getJSONRecords().length/o._rowCount);u+=t.isNullOrUndefined(f)?1:f.colSpan){for(f=n(e).find("thead th[p='"+u+","+c+"']")[0],h=!1,s=0;s<r.length;s++)if(n(f).text().replace("expanded","").trim()==r[s].toString().trim()){h=!0;break}!t.isNullOrUndefined(f)&&(n(f).hasClass("colheader")||n(f).attr("role")=="columnheader")&&h&&n(f).find(".collapse").length>0&&o._collapseMember(e,n(f).find(".collapse"))}}}));if(this.element.html(""),this.model.enableVirtualScrolling?(this._createVirtualPivotGrid(e),this.model.enableRTL&&this.element.addClass("e-rtl"),this._applyVScrolling()):this.model.enableGroupingBar?(this.element.append(e),(this._JSONRecords==null||this._JSONRecords.length==0)&&this.element.append(t.buildTag("span",this._getLocalizedLabels("NoRecordsToDisplay"),{display:"inline-block",padding:"10px 0px 0px 0px","font-family":"Segoe UI"})[0].outerHTML),this.model.enableRTL&&this.element.addClass("e-rtl"),this._createFields(e,n("#"+this._id).find(".pivotGridTable").width(),n("#"+this._id).find(".pivotGridTable th").outerWidth())):n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen?(n(tt).append(e),this.element.append(n(tt))):this.element.append(e),this.model.enableColumnResizing&&!this.model.enablePaging&&!this.model.enableVirtualScrolling&&!this.model.frozenHeaderSettings.enableFrozenHeaders&&!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders){for(ft=n("<colgroup><\/colgroup>"),r=0;r<i.length/this._rowCount;r++){if(t.isNullOrUndefined(this.element.find("tbody tr:first").children()[r]))break;y="<col style='width:"+this.element.find("tbody tr:first").children()[r].offsetWidth/Number(n(this.element.find("tbody tr:first").children()[r]).attr("colspan"))+"px'><\/col>";ft.append(y)}n(e).append(ft)}if(t.isNullOrUndefined(this._pivotClientObj)||!this._pivotClientObj.model.enableVirtualScrolling||this._pivotClientObj.model.enablePaging||(this._pivotClientObj.element.find(".categPageIndicator, .seriesPageIndicator , .vScrollThumb, .hScrollThumb").remove(),vt=t.buildTag("div.seriesPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("SeriesPage")+" : ")[0].outerHTML+t.buildTag("span.series_CurrentPage",this._seriesCurrentPage)[0].outerHTML+" / "+t.buildTag("span.series_pageCount",this._seriesPageCount)[0].outerHTML)[0].outerHTML,this._seriesPageCount>1?(this._pivotClientObj.element.find(".vScrollPanel").width()!=12&&this._pivotClientObj.element.width(this._pivotClientObj.element.width()+12),this._pivotClientObj.element.find(".vScrollPanel").width(12),this._pivotClientObj.element.find(".virtualScrolling").append(vt),this._pivotClientObj.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this._pivotClientObj.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartAndGrid?this._pivotClientObj.element.find(".virtualScrolling").css("padding-top","10px"):this._pivotClientObj.element.find(".virtualScrolling").css("padding-left","2px")):this._pivotClientObj.element.find(".vScrollPanel").width()==12&&(this._pivotClientObj.element.width(this._pivotClientObj.element.width()-12),this._pivotClientObj.element.find(".vScrollPanel").width(0)),yt=t.buildTag("div.categPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("CategoricalPage")+" : ")[0].outerHTML+t.buildTag("span.categ_CurrentPage",this._categCurrentPage)[0].outerHTML+" / "+t.buildTag("span.categ_pageCount",this._categPageCount)[0].outerHTML)[0].outerHTML,this._categPageCount>1?(this._pivotClientObj.element.find(".hScrollPanel").height()!=12&&this._pivotClientObj.element.find(".hScrollPanel").height(12),this._pivotClientObj.controlPlacement()==t.PivotClient.ControlPlacement.title&&this._pivotClientObj.element.find(".hsVirtualScrolling").css("margin-top","3px"),this._pivotClientObj.element.find(".hsVirtualScrolling").append(yt)):this._pivotClientObj.element.find(".hScrollPanel").height()==12&&(this._pivotClientObj.model.isResponsive?this._pivotClientObj.element.find(".categoricalAxis, .rowAxis,.slicerAxis").height(this._pivotClientObj.element.find(".categoricalAxis, .rowAxis,.slicerAxis").height()-6):this._pivotClientObj.element.find(".categoricalAxis, .rowAxis,.slicerAxis").height(150),this._pivotClientObj.element.find(".cubeBrowser").height(this._pivotClientObj.element.find(".cubeBrowser").height()-20),this._pivotClientObj.element.find(".hScrollPanel").height(0)),this._applyVScrolling(),this._pivotClientObj.element.find(".chartContainer").length>0&&this._pivotClientObj.element.find(".gridContainer").height(this._pivotClientObj.element.find(".chartContainer").height()+5)),this.model.enableColumnResizing?this.element.addClass("column-resize"):this.element.removeClass("column-resize"),(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&(this._applyFrozenHeaderWidth(i),this.model.enableColumnResizing&&this.element.find(".pivotGridTable").width("auto")),this.model.enableCellDoubleClick&&this._on(this.element,"dblclick",".value, .summary",this._cellRangeInfo),this.model.enableRTL?(this.element.addClass("e-rtl"),this.element.find(".groupingBarPivot").addClass("e-rtl"),this.element.find("table .rowheader,.colheader,.summary, .groupingBarPivot, .grpRow").css("text-align","right")):(this.element.removeClass("e-rtl"),this.element.find(".groupingBarPivot").removeClass("e-rtl"),this.element.find("table .rowheader,.colheader,.summary, .grpRow, .groupingBarPivot ").css("text-align","left")),n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen){n("#"+this._id).prepend("<div class='toolBar' style='height:40px,width:"+this.element.find("#PivotGridToolbar").width()+"px'><\/div>");var pt="",wt="",ii=t.buildTag("li#frozenHeaders.frozenHeaders e-icon","",{}).attr("aria-label",this._getLocalizedLabels("FrozenHeader")).attr({title:this._getLocalizedLabels("FrozenHeader"),tabindex:0})[0].outerHTML,ui=t.buildTag("li.cellSelect e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CellSelection")).attr({title:this._getLocalizedLabels("CellSelection"),tabindex:0})[0].outerHTML;this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(wt=t.buildTag("li#collapseByDefault.collapseByDefault e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CollapseByDefault")).attr({title:this._getLocalizedLabels("CollapseByDefault"),tabindex:0})[0].outerHTML);pt=t.buildTag("li.numberFormatting e-icon","",{}).attr("aria-label",this._getLocalizedLabels("NumberFormatting")).attr({title:this._getLocalizedLabels("NumberFormatting"),tabindex:0})[0].outerHTML;ri=t.buildTag("li.calculatedField e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CalculatedField")).attr({title:this._getLocalizedLabels("CalculatedField"),tabindex:0})[0].outerHTML;bt=t.buildTag("ul",(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?t.buildTag("li#cellEditing.cellEditing e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CellEditing")).attr({title:this._getLocalizedLabels("CellEditing"),tabindex:0})[0].outerHTML:" ")+t.buildTag("li#drillThrough.drillThrough e-icon","",{}).attr("aria-label",this._getLocalizedLabels("DrillThrough")).attr({title:this._getLocalizedLabels("DrillThrough"),tabindex:0})[0].outerHTML+(((this.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.analysisMode==t.Pivot.AnalysisMode.Olap)&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode)?"":t.buildTag("li.advancedFiltering e-icon","",{}).attr("aria-label",this._getLocalizedLabels("AdvancedFiltering")).attr({title:this._getLocalizedLabels("AdvancedFiltering"),tabindex:0})[0].outerHTML)+t.buildTag("li#columnResize.columnResize e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ColumnResize")).attr({title:this._getLocalizedLabels("ColumnResize"),tabindex:0})[0].outerHTML+t.buildTag("li.toolTip e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ToolTip")).attr({title:this._getLocalizedLabels("ToolTip"),tabindex:0})[0].outerHTML+(this._pivotClientObj.displayMode()==t.PivotClient.DisplayMode.GridOnly?wt:"")+t.buildTag("li.rtl e-icon","",{}).attr("aria-label",this._getLocalizedLabels("RTL")).attr({title:this._getLocalizedLabels("RTL"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("ul",t.buildTag("li.hyperlinkOptions e-icon","",{}).attr("aria-label",this._getLocalizedLabels("HyperLink")).attr({title:this._getLocalizedLabels("HyperLink"),tabindex:0})[0].outerHTML+t.buildTag("li.layouts e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Layouts")).attr({title:this._getLocalizedLabels("Layouts"),tabindex:0})[0].outerHTML+ii+t.buildTag("li.exporting e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Exporting")).attr({title:this._getLocalizedLabels("Exporting"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("ul",t.buildTag("li.summaryCustomize#summaryCustomize e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SummaryCustomization")).attr({title:this._getLocalizedLabels("SummaryCustomization"),tabindex:0})[0].outerHTML+t.buildTag("li.conditionalFormat e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ConditionalFormatting")).attr({title:this._getLocalizedLabels("ConditionalFormatting"),tabindex:0})[0].outerHTML+(this._pivotClientObj.model.analysisMode=="pivot"&&this._pivotClientObj.model.operationalMode=="clientmode"?t.buildTag("li.summaryTypes e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SummaryTypes")).attr({title:this._getLocalizedLabels("SummaryTypes"),tabindex:0})[0].outerHTML+pt:""))[0].outerHTML;n(".toolBar").append(bt);n(".toolBar").ejToolbar({enableRTL:this.model.enableRTL,height:"35px",enableSeparator:!0})}this._stateMaintenance();n.trim(this.model.pivotTableFieldListID)!=""&&this._isSchemaInitialize&&this.model.enablePivotFieldList&&this._renderPivotSchemaDesigner();this._schemaData!=null&&this.element.find(".colheader, .rowheader, .value").addClass("e-droppable");this.exportRecords=i;t.Pivot.closePreventPanel(this);this._schemaData&&t.Pivot.closePreventPanel(this._schemaData);this._excelLikeJSONRecords!=null&&this.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout&&(this._rowCount=lt);this.model.valueSortSettings&&(t.isNullOrUndefined(this.model.valueSortSettings.headerText)||this.model.valueSortSettings.headerText==""||t.isNullOrUndefined(t.PivotAnalysis._valueSorting)?t.isNullOrUndefined(p)||n(p).find(".rowheader").length!=0||this.element.find("[p='"+Number(n(p).attr("p").split(",")[0])+","+Number(n(p).attr("p").split(",")[1])+"']").html(p.html()):(nt=this.element.find("[p='"+Number(t.PivotAnalysis._valueSorting)+","+(Number(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?JSON.parse(this.getOlapReport()).PivotColumns.length:this.model.dataSource.columns.length)+"']")),n(nt).find(".valueSorting").length!=0||n(nt).hasClass("rowheader")||(kt=t.buildTag("span.valueSorting e-icon "+t.PivotAnalysis._sort).css("width","30px").attr("role","button").attr("aria-label","sort")[0].outerHTML,n(nt).append(kt))));this.model.enableGroupingBar&&this.element.find(".pivotGridTable").width()>0&&!(this.element.find(".values .pvtBtn, .columns .pvtBtn").length==0&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)&&this.element.find("tbody .value").length>0&&this.element.find("thead tr").length>0&&this.element.find(".groupingBarPivot").width(this.element.find(".pivotGridTable").width());(this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders)&&this._applyFrozenHeaderWidth(this._JSONRecords);var d=[],y=[],f={},et=[],dt,a=this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!0:!1;if(this.model.analysisMode!=t.PivotGrid.AnalysisMode.Olap&&(this.model.headerSettings.showColumnItems||this.model.headerSettings.showRowItems)&&!this.model.enableGroupingBar){if(a&&(JSON.parse(this.getOlapReport()).PivotRows.length>0||JSON.parse(this.getOlapReport()).PivotColumns.length>0)&&JSON.parse(this.getOlapReport()).PivotCalculations.length>0||!a&&(this.model.dataSource.rows.length>0||this.model.dataSource.columns.length>0)&&this.model.dataSource.values.length>0){for(r=0;r<(a?JSON.parse(this.getOlapReport()).PivotRows.length:this.model.dataSource.rows.length);r++)d.push(a?JSON.parse(this.getOlapReport()).PivotRows[r].FieldHeader:this.model.dataSource.rows[r].fieldCaption);for(r=0;r<(a?JSON.parse(this.getOlapReport()).PivotColumns.length:this.model.dataSource.columns.length);r++)y.push(a?JSON.parse(this.getOlapReport()).PivotColumns[r].FieldHeader:this.model.dataSource.columns[r].fieldCaption);f={rows:d,columns:y}}}else if(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&(this.model.headerSettings.showColumnItems||this.model.headerSettings.showRowItems)&&!this.model.enableGroupingBar&&(a&&JSON.parse(this.getOlapReport()).PivotCalculations.length||!a&&this.model.dataSource.values[0].measures.length)&&this._getAxis()=="columns"){for(r=0;r<i.length;r++)if(i[r].CSS!="value"&&i[r].CSS!=" value")i[r].CSS=="rowheader"&&i[r].Info!=""&&n.inArray(i[r].Info.split("::")[1].replace(/[\[\]]+/g,""),d)==-1&&(d.push(i[r].Info.split("::")[1].replace(/[\[\]]+/g,"")),et.push(this.element.find("[p='"+i[r].Index.split(",")[0]+","+i[r].Index.split(",")[1]+"']").width()),r=r+(this._rowCount-r%this._rowCount)),i[r].CSS=="colheader"&&i[r].Info!=""&&n.inArray(i[r].Info.split("::")[1].replace(/[\[\]]+/g,""),y)==-1&&i[r].Info.indexOf("Measure")===-1&&y.push(i[r].Info.split("::")[1].replace(/[\[\]]+/g,""));else{dt=i[r].Index.split(",")[0];break}f={rows:d,columns:y}}if(!n.isEmptyObject(f)&&(this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&f.rows.length>0||this.model.analysisMode=="pivot")){for(f.rows!=null&&f.columns!=null&&f.rows.length>1&&f.columns.length>0?this.element.find("[p='0,0']").attr("rowspan",f.columns.length).attr("colspan",f.rows.length-1):this.element.find("[p='0,0']").attr("rowspan","1").attr("colspan","1"),r=0;r<f.columns.length;r++)f.rows.length==0||f.rows.length==1?r==0?this.model.headerSettings.showColumnItems?this.element.find("[p='0,"+r+"']").html(t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML).addClass("headcol").addClass("headcol").addClass("colfirst").addClass("rowfirst"):this.element.find("[p='0,"+r+"']").html("").addClass("headcol").addClass("headcol").addClass("colfirst").addClass("rowfirst"):this.model.headerSettings.showColumnItems?this.element.find("[p='1,"+r+"']").before(t.buildTag("th.headrow rowfirst",t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='1,"+r+"']").before("<th class='headcol rowfirst'><\/th>"):r==0?this.model.headerSettings.showColumnItems?this.element.find("[p='"+f.rows.length+","+r+"']").before(t.buildTag("th.headcol colfirst",t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+r+"']").before("<th class='headcol colfirst'><\/th>"):(this.model.headerSettings.showColumnItems?this.element.find("[p='"+f.rows.length+","+r+"']").before(t.buildTag("th.headrow",t.buildTag("div.colHeadBtn",this.model.analysisMode!="pivot"?f.columns[r].split(".")[2]:f.columns[r]).attr({title:f.columns[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+r+"']").before("<th class='headcol'><\/th>"),this.element.find("[p='0,0']").addClass("topele"));for(f.rows.length==0&&this.element.find("[p='1,"+f.columns.length+"']").before("<th class='headrow rowfirst'><\/th>"),r=0;r<f.rows.length;r++)f.columns.length==0?r==0?this.model.headerSettings.showRowItems?this.element.find("[p='0,"+r+"']").html(t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML).addClass("headrow").addClass("rowfirst").addClass("colfirst"):this.element.find("[p='0,"+r+"']").html("").addClass("headrow").addClass("rowfirst").addClass("colfirst"):this.model.headerSettings.showRowItems?this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before(t.buildTag("th.headrow colfirst",t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before("<th class='headrow colfirst'><\/th>"):r==0?this.model.headerSettings.showRowItems?this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before(t.buildTag("th.headrow rowfirst",t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before("<th class='headrow rowfirst'><\/th>"):(this.model.headerSettings.showRowItems?this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before(t.buildTag("th.headrow",t.buildTag("div.rowHeadBtn",this.model.analysisMode!="pivot"?f.rows[r].split(".")[2]:f.rows[r]).attr({title:f.rows[r]})[0].outerHTML)[0].outerHTML):this.element.find("[p='"+f.rows.length+","+f.columns.length+"']").before("<th class='headrow'><\/th>"),this.element.find("[p='0,0']").addClass("topele"));for(ot=this.element.find(".colHeadBtn"),st=this.element.find(".rowHeadBtn"),r=0;r<ot.length&&!this.model.enableCollapseByDefault;r++)n(ot[r]).css({width:this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?et[dt-1]:this.element.find("[p='"+(f.rows.length==0?0:f.rows.length-1)+","+(f.columns.length+1)+"']").width()});for(r=0;r<st.length&&!this.model.enableCollapseByDefault;r++)n(st[r]).css({width:this.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?et[r]:this.element.find("[p='"+r+","+(f.columns.length+1)+"']").width()})}},_applyLocale:function(i){var c,o,u,s,h,f,v,y;if(this.model.dataSource.values.length!=0){for(c=!1,u=0;u<this.model.dataSource.values[0].measures.length;u++)if(this.model.dataSource.values[0].measures[u].format){c=!0;break}if(c)for(o=this._getAxis(),u=0;u<this.model.dataSource.values[0].measures.length;u++){var p=[],l=[],a=this.model.dataSource.values[0].measures[u].format,e;for(s=0;s<i.length;s++)l=this._getColumnIndices(o,i[s],this.model.dataSource.values[0].measures[u].fieldCaption,p);for(h=0;h<l.length;h++)for(f=0;f<i.length;f++)v=o=="rows"?i[f].Index.split(",")[1]:o=="columns"?i[f].Index.split(",")[0]:null,v==l[h]&&i[f].Value!=""&&(e=i[f].Value.replace(/[\s,%]/g,""),e=e.replace(t.preferredCulture(this.model.locale).numberFormat.currency.symbol,""),n.isNumeric(e)&&a!=r&&(y=t.olap.base._getFormatedValue(e,a),i[f].Value=y))}}},_renderPivotSchemaDesigner:function(){var r,i,u;n("#"+this.model.pivotTableFieldListID).length>0&&(r=n("#"+this.model.pivotTableFieldListID).data("ejPivotSchemaDesigner"),r!=null?(r.model.pivotControl=this,r.model.enableWrapper=!0,r._load(),this._waitingPopup&&this._waitingPopup.hide(),this._isSchemaInitialize=!1):(i=this,u=setInterval(function(){var r=n("#"+i.model.pivotTableFieldListID).data("ejPivotSchemaDesigner");r!=null&&(clearInterval(u),r.model.pivotControl=i,r.model.enableWrapper=!0,r._load(),i._waitingPopup&&i._waitingPopup.hide(),i._isSchemaInitialize=!1,t.isNullOrUndefined(r.model.pivotControl)||r.model.pivotControl.element.find(".colheader, .rowheader, .value").addClass("e-droppable"))},10)))},_renderFrozenGridTable:function(i,r,u){var b=n("<table class=\"pivotGridFrozenTable\" style='height:47px' ><\/table>"),y=n('<table class="pivotGridRowTable" ><\/table>'),f,e,c,l,w;frozenValTable=n('<table class="pivotGridValueTable" ><\/table>');tbodyFrozenCol=n("<tbody><\/tbody>");tbodyFrozenRow=n("<tbody><\/tbody>");tbodyFrozenVal=n("<tbody><\/tbody>");f=tRow1="<tr role='row'>";e=n("<div class='rowhead' style='position: relative; float: left;display: inline-block'>");n(tbodyFrozenCol).append(n(r).children());c=u.children().clone();l=u.children().clone();n(l).find(".value").remove();n(tbodyFrozenRow).append(n(l));n(y).append(tbodyFrozenRow);n(e).append(y);n(c).find(".rowheader, .summary:not(.summary.value)").remove();n(tbodyFrozenVal).append(n(c));var p=n(t.buildTag("div.colhead").css({position:"relative",overflow:"hidden"})[0].outerHTML),o=n(t.buildTag("div.colmovable")[0].outerHTML),s=n(t.buildTag("div.colfreeze").css({float:"left",height:"100%",visibility:this.model.enableGroupingBar?"visible":"hidden"})[0].outerHTML);n(p).append(n(b).append(tbodyFrozenCol));n(f).children().length==0&&(f=n("<tr role='row'><\/tr>"));n(f).length>0&&(n(o).append(p),n(s).append(n("<table id='colfretable' style='height:100%'><\/table>").append(f)));var a=n(t.buildTag("div#rowvaluecontent.valScrollArea")[0].outerHTML),h=n(t.buildTag("div.valueCell").css({position:"relative"})[0].outerHTML),v=n(t.buildTag("div.rowHeaderArea")[0].outerHTML);n(h).append(n(frozenValTable).append(tbodyFrozenVal));!this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders?(n(i).append("<tr><td style='padding:0px' colspan='2'><\/td><\/tr><tr><td style='padding:0px' colspan='2'><\/td><\/tr>"),n(i).find("tr:first td:eq(0)").append(n("<div id='headerContent' class='headerContent'><\/div>")),n(n(i).find("tr:last td:eq(0)")).append(n(a)),n(i).find(".headerContent").append(o),n(i).find(".headerContent .colhead").prepend(s),n(i).find(".headerContent .colhead").append("<div class='headerTable'/>"),n(i).find(".pivotGridFrozenTable").appendTo(n(i).find(".headerTable")),n(i).find(".valScrollArea").append(n(v)),n(i).find(".rowHeaderArea").append(e,h)):this.model.frozenHeaderSettings.enableFrozenRowHeaders&&!this.model.frozenHeaderSettings.enableFrozenColumnHeaders?(n(i).append("<tr ><td style='padding:0px;border-right:0px' ><\/td><td style='padding:0px;'><\/td><\/tr>"),n(i).find("tr:first td:eq(0)").append(n("<div id='headerContent' class='headerContent' style='position:relative'><\/div>")),n(i).find(".headerContent").append(s,e),n(i).find("tr td:last").append(n(a)),n(i).find(".valScrollArea").append(n(v)),n(i).find(".rowHeaderArea").append(o,h)):(n(i).append("<tr><td style='padding:0px'><\/td><td style='padding:0px;'><\/td><\/tr><tr><td style='padding:0px'><\/td><td style='padding:0px' class='valueArea'><\/td><\/tr>"),n(i).find("tr:first td:eq(0)").append(s),n(i).find("tr:first").children("td:eq(1)").append(o),n(i).find("tr:last td:eq(0)").append(n(v)),n(i).find(".rowHeaderArea").append(e),n(i).find(".valueArea").append(n(a)),n(i).find(".valScrollArea").append(h));this.model.enableGroupingBar?n(i).find(".grpRow").length>0&&n(i).find(".grpRow").appendTo(n(i).find(".colfreeze table tr:eq(0)")):(n(i).find("[p='0,0']").length>0||n(i).find("[p='-1,-1']").length>0)&&(w=n(i).find("[p='-1,-1']").length>0?"-1,-1":"0,0",n(i).find("[p='"+w+"']").appendTo(n(i).find(".colfreeze table tr:eq(0)")))},_applyFrozenHeaderWidth:function(i){var r,o,e,f,l,u,s;if(i.length>0){r=this.element;o=this.element.find(".e-scroller").data("ejScroller");o&&(o.destroy(),n(this.element).css("overflow",""),n(r).find(".headerTable").css("display","initial"),n(r).find(".valScrollArea").css("height",""),n(r).find(".pivotGridRowTable, .pivotGridValueTable , .pivotGridFrozenTable").removeClass("frozenTableLayout"),n(r).find(".pivotGridRowTable, .pivotGridValueTable , .pivotGridFrozenTable").removeAttr("style"));n(r).find(".pivotGridFrozenTable colgroup, .pivotGridValueTable colgroup").remove();var h=n("<colgroup><\/colgroup>"),a=n(r).find(".pivotGridFrozenTable"),c=n(r).find(".pivotGridRowTable tr:visible").index();if(c>-1){for(e=n(r).find(".pivotGridValueTable tr:eq("+c+") td"),f=0;f<e.length;f++)l=n(e[f]).attr("p").split(",")[0],u=a.find("[p^='"+l+",']"),u=t.isNullOrUndefined(u.last().attr("colSpan"))||u.last().attr("colSpan")=="1"?n(u).last():u[u.length-2],n(e[f]).is(":visible")&&h.append("<col width ="+Math.max(n(u).outerWidth(),n(e[f]).outerWidth())+"px'>");this.element.find(".pivotGridFrozenTable, .pivotGridValueTable").append(h);this.model.enableColumnGrandTotal||(s=parseInt(n(r).find(".pivotGridFrozenTable tr:first td:last").attr("colspan")),n(r).find(".pivotGridFrozenTable colgroup col").slice(-s).remove(),n(r).find(".pivotGridValueTable colgroup col").slice(-s).remove());this._refreshScroller()}else this._refreshScroller()}},_refreshScroller:function(){var c,l,e,o;if(this.element.find(".pivotGridValueTable .value:visible").length>0){var a=this.element.find(".pivotGridFrozenTable"),s=this.element.find(".pivotGridRowTable"),h=this.element.find(".pivotGridValueTable"),v=this.element.find(".rowhead"),f=this.element.find(".valueCell"),i=t.isNullOrUndefined(this.model.frozenHeaderSettings.scrollerSize)?18:this.model.frozenHeaderSettings.scrollerSize;if(n(a).height(this.element.find(".colfreeze").height()),!this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders){if(this.element.find(".colfreeze").css({height:n(a).height(),width:n(s).width()}),n(f).css({display:"inline-block",width:this.element.width()-n(s).width()}),this.element.find(".headerTable").css({display:"inline-block",width:n(f).width()}),this.element.find(".pivotGridValueTable, .pivotGridFrozenTable").addClass("frozenTableLayout"),this.element.find(".headerContent, .colmovable").addClass("frozenStyle"),this.element.find(".headerContent").css({width:this.element.width(),height:this.element.find(".headerTable").height()}),c=0,l=0,n(h).height()>0){var y=this.model.enableGroupingBar?this.element.find(".groupingBarPivot").height():0,p=this.element.find(".headerContent").height(),w=n(f).height(),e=p+w+y,o=this.element.height(),r=n(h).width()+n(s).width(),u=this.element.find(".pivotGridTable").width();c=(o>e?e:o)-p-y;l=u>r?r:u}this.element.find(".valScrollArea").ejScroller({scrollerSize:i,width:l,height:c,targetControl:this,enableRTL:this.model.enableRTL,scroll:this._applyScroll});this.element.find(".e-vscrollbar").length>0&&(this.element.find(".headerContent").width(this.element.find(".headerContent").width()-i),n(f).width(n(f).width()-i),this.element.find(".headerContent").addClass("frozenColHeaderArea"))}else if(this.model.frozenHeaderSettings.enableFrozenRowHeaders&&!this.model.frozenHeaderSettings.enableFrozenColumnHeaders){var y=this.model.enableGroupingBar?this.element.find(".groupingBarPivot").height():0,c=0,l=0;if(this.element.find(".pivotGridValueTable, .pivotGridFrozenTable"+(this.model.enableGroupingBar?", .pivotGridRowTable":"")).addClass("frozenTableLayout"),this.element.find(".colfreeze").height(n(a).height()),this.element.find(".colhead").css("overflow","visible"),n(h).height()>0){var e=this.element.height(),o=this.element.find(".rowHeaderArea").height(),r=this.element.width()-this.element.find(".headerContent").width(),u=n(h).width();l=u>r?r:u;c=(o>e?e:o)-y+(u>r?i:0)}this.element.find(".valScrollArea").ejScroller({scroll:this._applyScroll,width:l,height:c,targetControl:this,enableRTL:this.model.enableRTL,scrollerSize:i});this.model.enableGroupingBar||this.element.find(".pivotGridRowTable").addClass("frozenTableLayout");this.element.find(".headerContent").css({height:this.element.find(".valScrollArea").height(),overflow:"hidden"});n(v).css("padding-bottom",this.element.find(".valScrollArea .e-hscrollbar").length>0?i:"0px")}else{this.model.enableGroupingBar&&this._setGroupingBarFrozenRowBtnWidth();e=this.element.height()-(this.element.find(".colhead").height()+(this.model.enableGroupingBar?this.element.find(".groupingBarPivot").height():0));o=n(h).height();n(v).css({overflow:"hidden",width:n(s).width()-3,height:o>e?e:o});this.element.find(".colfreeze").width(n(s).width()-3);this.element.find(".pivotGridFrozenTable, .pivotGridValueTable, .pivotGridRowTable").addClass("frozenTableLayout");var r=this.element.width()-n(s).width(),u=n(h).width(),l=u>r?r:u,c=n(v).height()+(u>r?i:0);this.element.find(".valScrollArea").ejScroller({scroll:this._applyScroll,width:l,height:c,targetControl:this,scrollerSize:i});n(v).height(n(f).height());this.element.find(".colmovable").width(n(f).width());this.element.find(".e-vscrollbar").length>0?this.element.find(".colmovable").addClass("frozenColHeaderArea"):this.element.find(".colmovable").removeClass("frozenColHeaderArea");n(v).css("padding-bottom",this.element.find(".valScrollArea .e-hscrollbar").length>0?i:"0px");this.element.find(".colhead , .colfreeze").height(n(a).height());n(a).height("100%");this.model.enableGroupingBar||this.element.find(".pivotGridRowTable").addClass("frozenTableLayout")}this.model.enableGroupingBar&&this._refreshGroupingBarLayout();this.element.find(".pivotGridFrozenTable tr:first td").css("border-top","0px");this.element.find(".pivotGridRowTable tr td:first-child").css(this.model.enableRTL?"border-right":"border-left","0px");this.element.find(".pivotGridRowTable tr td:last-child").css(this.model.enableRTL?"border-left":"border-right","0px");this.element.find(".pivotGridFrozenTable tr:last td").css("border-bottom","0px");!this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&this.model.frozenHeaderSettings.enableFrozenRowHeaders?(this.element.find(".pivotGridFrozenTable tr td:first-child").css(this.model.enableRTL?"border-right":"border-left","0px"),this.element.find(".pivotGridValueTable tr:last td").css("border-bottom","0px"),this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p")&&this.element.find(".pivotGridValueTable tr td[p^='"+this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p").split(",")[0]+",']").css(this.model.enableRTL?"border-right":"border-left","0")):this.model.frozenHeaderSettings.enableFrozenColumnHeaders&&!this.model.frozenHeaderSettings.enableFrozenRowHeaders?(this.element.find(".pivotGridRowTable tr:eq(0) td").css("border-top","0px"),this.element.find(".pivotGridValueTable tr:eq(0) td").css("border-top","0px")):(this.element.find(".pivotGridFrozenTable tr td:first-child").css(this.model.enableRTL?"border-right":"border-left","0px"),this.element.find(".pivotGridValueTable tr:last td").css("border-bottom","0px"),this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p")&&this.element.find(".pivotGridValueTable tr td[p^='"+this.element.find(".pivotGridValueTable tr td:visible:eq(0)").attr("p").split(",")[0]+",']").css(this.model.enableRTL?"border-right":"border-left","0"),this.element.find(".pivotGridRowTable tr:eq(0) td").css("border-top","0px"),this.element.find(".pivotGridValueTable tr:eq(0) td").css("border-top","0px"))}else this.model.enableGroupingBar&&this._refreshGroupingBarLayout(),n(this.element).css("overflow","auto"),this.element.find(".headerTable").css("display","inline-block"),this.element.find(".valScrollArea").css("height","100%")},_applyScroll:function(){this.model.targetControl.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.targetControl.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.targetControl.model.frozenHeaderSettings.enableFrozenHeaders&&!this.model.targetControl.model.frozenHeaderSettings.enableFrozenRowHeaders&&!this.model.targetControl.model.frozenHeaderSettings.enableFrozenColumnHeaders?(this.isVScroll()&&this.model.targetControl.element.find(".rowhead").scrollTop(this.model.scrollTop),this.isHScroll()&&this.model.targetControl.element.find(".colhead").scrollLeft(this.model.scrollLeft)):!this.model.targetControl.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.targetControl.model.frozenHeaderSettings.enableFrozenColumnHeaders?this.isHScroll()&&this.model.targetControl.element.find(".colhead").scrollLeft(this.model.scrollLeft):this.isVScroll()&&this.model.targetControl.element.find(".headerContent").scrollTop(this.model.scrollTop)},_setGroupingBarFrozenRowBtnWidth:function(){var r,u,f;(this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenHeaders&&!(this.model.frozenHeaderSettings.enableFrozenRowHeaders&&this.model.frozenHeaderSettings.enableFrozenColumnHeaders))&&this.element.find(".pivotGridRowTable").outerWidth()>=this.element.find(".grpRow").outerWidth()&&this.element.find(".pivotGridRowTable").css("min-width",this.element.find(".grpRow").outerWidth());this.element.find(".grpRow .removeBtn, .grpRow .filter, .grpRow .sorting ").css("position","inherit");this.element.find(".colfreeze .pivotButton").width("auto");var t=this.element.find(".pivotGridRowTable").width(),i=this.element.find(".colfreeze .pivotButton"),n=t/i.length;t<n&&(n=t-40);this.element.find(".rows").width()>t&&(r=n*i.length,n>50&&r>140?(this.element.find(".rows .pivotButton").width(n-5),this.element.find(".rows .pvtBtn").css({width:n-37,"text-overflow":"ellipsis"})):(this.element.find(".rows .pivotButton").width(50),this.element.find(".rows .pvtBtn").css({width:20,"text-overflow":"ellipsis"})),u=this.element.find(".colfreeze .pivotButton:eq(0)").outerWidth(),f=u*i.length+30,this.element.find(".rowHead").width(f))},_refreshGroupingBarLayout:function(){n(".pivotGridTable .value").length>0||n(".pivotGridTable .colheader").length>0?this.element.find(".groupingBarPivot ").width(this.element.find(".pivotGridTable").width()):this.element.find(".pivotGridRowTable").length>0?this.element.find(".groupingBarPivot ").width(this.element.find(".pivotGridRowTable").width()+140):this.element.find(".groupingBarPivot ").width(330);var t=this.element.find(".pivotGridRowTable").width();this.element.find(".grpRow ,.values").width(t);this.element.find(".columns").css({height:"auto",width:this.element.find(".valueColumn").width()-this.element.find(".values").width()-1});this._setGroupingBarFrozenRowBtnWidth()},_cellRangeInfo:function(i){var a=n(i.target).parents(".e-pivotgrid").data("ejPivotGrid"),k,c,l,f,s,e,r,y,b;n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(this._dataSet=this._pivotClientObj.dataSet);n(i.target).hasClass("cellValue")&&(i.target=i.target.parentElement);var d=n("thead tr").length,h=[],p=0,u=n.grep(this.getJSONRecords(),function(t){return(t.CSS=="colheader"||t.CSS=="summary"||t.CSS==" calc")&&t.Index.split(",")[0]==n(i.target).attr("p").split(",")[0]}),o=n.grep(this.getJSONRecords(),function(t){return(t.CSS=="rowheader"||t.CSS=="summary"||t.CSS=="summary rstot")&&t.Index.split(",")[1]==n(i.target).attr("p").split(",")[1]});if(o.length==1&&u.length==1&&(o[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0||u[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0||u[0].CSS==" calc"))if(k=[],(u[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0||u[0].CSS==" calc")&&o[0].Value.toString().indexOf("Grand")>=0)for(r=0;r<this.model.dataSource.data.length;r++)h[r]=this.model.dataSource.data[r];else for(o[0].Value.toString().indexOf(this._getLocalizedLabels("GrandTotal"))>=0?c=u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0?u[0].Value.replace(" "+this._getLocalizedLabels("Total"),""):u[0].Value:(u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0||u[0].CSS==" calc")&&(c=o[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0?o[0].Value.replace(" "+this._getLocalizedLabels("Total"),""):o[0].Value),r=0;r<a.model.dataSource.data.length;r++)n.each(a.model.dataSource.data[r],function(n,t){t==c&&(h[p]=a.model.dataSource.data[r],p++)});else if(o.length>=1&&u.length>=1&&(o[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0||u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0)){for(o[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0?(c=u,l=o):u[0].Value.toString().indexOf(this._getLocalizedLabels("Total"))>=0&&(c=o,l=u),f=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.model.dataSource.data:this._dataSet.length>0?JSON.parse(this._dataSet):[],s=c.length-1;s>=0;s--){for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==c[s].Value&&e.push(f[r])});f=e}if(h=e,l[0].Value.toString().indexOf("Grand")<=0)for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==l[0].Value.replace(" Total","")&&(h=[],e.push(f[r]))});h=h.length==0?e:h}else{var w=o,v=u,f=this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.model.dataSource.data:this._dataSet.length>0?JSON.parse(this._dataSet):[];for(s=w.length-1;s>=0;s--){for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==w[s].Value&&e.push(f[r])});f=e}for(s=v.length-1;s>=0;s--)if(v[s].CSS.indexOf("calc")==-1){for(e=[],r=0;r<f.length;r++)n.each(f[r],function(n,t){t==v[s].Value&&e.push(f[r])});f=e}h=h.length==0?e:h}y={selectedData:h,element:this.element,customObject:this.model.customObject};this.model.enableCellDoubleClick&&this.model.enableCellDoubleClick!=null&&this._trigger("cellDoubleClick",y);(this.model.enableDrillThrough||n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough)&&h.length>0&&(b=n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableDrillThrough?this._pivotClientObj:this);b._trigger("drillThrough",y)},_initCellEditing:function(i){if(i.target.tagName=="INPUT"||n(i.target).hasClass("summary")||n(i.target).parent().hasClass("summary"))this._off(this.element,"mouseup",".value",this._completeCellEditing);else{this._on(this.element,"mouseup",".value",this._completeCellEditing);var r;_oriX=i.pageX;_oriY=i.pageY;r=i.target||window.event.srcElement;n(r).hasClass("cellValue")&&(r=n(r).parent()[0]);n(".value").addClass("selection");n("#"+this._id).append(t.buildTag("div.cellSelection#"+this._id+"_cellSelection","",{}));_startPosCell=n(r)[0].attributes.getNamedItem("p").value;this._on(this.element,"mousemove",".value, .cellSelection",this._cellSelection)}},_completeCellEditing:function(i){var a,l,w=[],s,y,h,rt,e,o,g,p,v,f,c,u,tt,it;if(i.target.tagName!="INPUT"){if(this._off(this.element,"mousemove",".value"),n(".value").removeClass("selection"),a=i.target||window.event.srcElement,n(a).hasClass("cellValue")&&(a=n(a).parent()[0]),l=n(a)[0].attributes.getNamedItem("p").value,h=0,rt=this.element.find(".curInput"),rt.length>0)return n(a).find(".curInput").length==0&&this._updateTableCell(),n("#"+this._id+"_cellSelection").remove(),this.model.enableToolTip&&this._on(this.element,"mousemove",".value",this._applyToolTip),this._off(this.element,"mouseup",".value"),!1;for(e=parseInt(_startPosCell.split(",")[1])<parseInt(l.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(l.split(",")[1]);e<=(parseInt(_startPosCell.split(",")[1])>parseInt(l.split(",")[1])?parseInt(_startPosCell.split(",")[1]):parseInt(l.split(",")[1]));e++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("td[p*=',"+e+"']").parent().is(":visible"))for(o=parseInt(_startPosCell.split(",")[0])<parseInt(l.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(l.split(",")[0]);o<=(parseInt(_startPosCell.split(",")[0])>parseInt(l.split(",")[0])?parseInt(_startPosCell.split(",")[0]):parseInt(l.split(",")[0]));o++)if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap||n("#"+this._id).find("[p*='"+o+",']").last("th").is(":Visible")||!this.model.enableGrandTotal||!this.model.enableRowGrandTotal){w[h]=this.getJSONRecords()[o*this._rowCount+e];n("[p='"+o+","+e+"']").hasClass("summary")||(n("[p='"+o+","+e+"'] span.cellValue").length>0?(g=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?n("[p='"+o+","+e+"'] span.cellValue").text()!=""?n("[p='"+o+","+e+"'] span.cellValue").text():n(".curInput").val():n("[p='"+o+","+e+"'] span.cellValue").text(),n("[p='"+o+","+e+"'] span.cellValue").html("<input type='text' class='curInput' value='"+g+"' />")):n("[p='"+o+","+e+"']").children().length>0?n("[p='"+o+","+e+"']").append("<input type='text' class='curInput' value='' />"):(g=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?n("[p='"+o+","+e+"']").text()!=""?n("[p='"+o+","+e+"']").text():n(".curInput").val():n("[p='"+o+","+e+"']").text(),n("[p='"+o+","+e+"']").html("<input type='text' class='curInput' value='"+g+"' />")));var b,k="",et,ot,ut=0;if(s=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders?this.element.find(".summary[role!='gridcell'][p$=',"+n(a).attr("p").split(",")[1]+"'] , .rowheader[role!='gridcell'][p$=',"+n(a).attr("p").split(",")[1]+"']").last().attr("p"):this.element.find(".summary[role!='gridcell'][p$=',"+e+"'] , .rowheader[role!='gridcell'][p$=',"+e+"']").last().attr("p"),s==r&&(s=n("#"+this._id).find("tbody").find('[p="'+o+","+e+'"]').parent("tr").find(".summary").first().attr("p")),et=s,s!=null){while(s[0]>=0)s==this.getJSONRecords()[parseInt(parseInt(s.split(",")[0])*this._rowCount+parseInt(s.split(",")[1]))].Index&&(b=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.getJSONRecords()[parseInt(parseInt(s.split(",")[0])*this._rowCount+parseInt(s.split(",")[1]))].Info.split("::")[0]:this.getJSONRecords()[parseInt(parseInt(s.split(",")[0])*this._rowCount+parseInt(s.split(",")[1]))].Value,s=parseInt(s.split(",")[0])-1+","+parseInt(s.split(",")[1])),k&&b!=""?k=b+"#"+k:b!=""&&(k=b);if(this._rowHeader[h]=k,f=this._rowHeader[h].toString().split("#"),f.length>1){for(u=0;u<f.length-1;u++)for(c=0;c<f[u].split(".").length;c++)if(f[u].split(".")[c]==f[u+1].split(".")[c]&&f[u].split(".")[c+1]==f[u+1].split(".")[c+1]){f.splice(u,1);break}for(this._rowHeader[h]="",u=0;u<f.length;u++)this._rowHeader[h]+=this._rowHeader[h]==""?f[u]:"#"+f[u]}}var d="",nt,st=this.model.frozenHeaderSettings.enableFrozenHeaders||this.model.frozenHeaderSettings.enableFrozenColumnHeaders||this.model.frozenHeaderSettings.enableFrozenRowHeaders,ft=this.element.find((st?".pivotGridFrozenTable ":"")+'tr:has(".colheader")').length-1;for(ot=ft,y=w[h].Index,y!=r&&y==this.getJSONRecords()[parseInt(parseInt(y.split(",")[0])*this._rowCount+parseInt(y.split(",")[1]))].Index&&(p=parseInt(y.split(",")[0])),v=0;v<=ft;v++)p!=null&&p+","+v==this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+v)].Index&&(nt=this.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+v)].Info.split("::")[0]:this.getJSONRecords()[parseInt(parseInt(p)*this._rowCount+v)].Value,d==""?d=nt:nt!=""&&(d=d+"#"+nt)),this._colHeader[h]=d;if(f=this._colHeader[h].split("#"),f.length>1){for(u=0;u<f.length-1;u++)for(c=0;c<f[u].split(".").length;c++)if(f[u].split(".")[c]==f[u+1].split(".")[c]&&f[u].split(".")[c+1]==f[u+1].split(".")[c+1]){f.splice(u,1);break}for(this._colHeader[h]="",u=0;u<f.length;u++)this._colHeader[h]+=this._colHeader[h]==""?f[u]:"#"+f[u]}h++}for(this._originalValue="",this._cellInfo=w,tt=0;tt<this.element.find(".curInput").length;tt++)it=this.element.find(".curInput")[tt],this._originalValue+=this._originalValue==""?it.value:"#"+it.value;args={JSONRecords:w,rowHeader:this._rowHeader,columnHeader:this._colHeader,measureCount:ut>0?"Row:"+ut:"Column:0"};this._trigger("cellSelection",args);w=rowHeader=colHeader=[];n("#"+this._id+"_cellSelection").remove();this.model.enableToolTip&&this._on(this.element,"mousemove",".value",this._applyToolTip);this._off(this.element,"mouseup",".value")}n(".curInput").keypress(function(t){if(t.which==13){var i=n(t.target).parents(".e-pivotgrid").data("ejPivotGrid");i._updateTableCell()}})},_updateTableCell:function(){var r="",f="",e=n(".curInput"),u,l,k,s,y,i;n.each(e,function(n,t){r+=r==""?t.value:"#"+t.value});var p=[],h=this._rowHeader,c=this._colHeader;for(f=r.split("#"),u=f.length-1;u>=0;u--)f[u]==this._originalValue.split("#")[u]?(h.splice(u,1),c.splice(u,1),f.splice(u,1),this._cellInfo.splice(u,1)):(p.push(this._originalValue.split("#")[u]),this._cellInfo[u].Value=f[u]=f[u]==""?"0":f[u]);for(p=p.reverse(),r="",i=0;i<f.length;i++)r+=r==""?f[i]:"#"+f[i];if(r.length==0){for(i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(n(".curInput")[i].value);return!1}if(this._waitingPopup.show(),this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)try{l=JSON.parse(this.getOlapReport()).Report}catch(g){l=this.getOlapReport()}if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){(t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)||this.model.editCellsInfo.JSONRecords.length==0)&&(this.model.editCellsInfo={JSONRecords:[],rowHeader:[],columnHeader:[]});var d=this.model.editCellsInfo.rowHeader,o=this.model.editCellsInfo.columnHeader,w=this.model.editCellsInfo.JSONRecords,b=this._cellInfo;for(uV=0;uV<b.length;uV++){for(k=0,s=0;s<w.length;s++)if(d[s]==h[uV]&&o[s]==c[uV]){w[s].Value=b[uV].Value;k++;break}k==0&&(d.push(h[uV]),o.push(c[uV]),w.push(b[uV]))}if(this._trigger("cellEdit",{editCellsInfo:this.model.editCellsInfo}),!t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)&&this.model.editCellsInfo.JSONRecords.length>0)if(this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){var r="",a="",v="";for(n.each(this.model.editCellsInfo.JSONRecords,function(n,t){r=r==""?t.Value:r+":"+t.Value;a=a==""?t.Index:a+":"+t.Index;v=v==""?o[n].toString().split("#")[o[n].toString().split("#").length-1]:v+":"+o[n].toString().split("#")[o[n].toString().split("#").length-1]}),y=JSON.stringify({action:"cellEditing",index:a,valueHeaders:v,summaryValues:r,currentReport:l,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:JSON.stringify(this.model.customObject)}),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.cellEditing,y,this._renderControlSuccess),i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(n(e[i]).val())}else this._populatePivotGrid();else{for(i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(t.isNullOrUndefined(this._originalValue.split("#")[i])?"":this._originalValue.split("#")[i]);this._waitingPopup.hide()}}else if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap)if(this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"writeBack",element:this.element}),this.model.editCellsInfo.JSONRecords=this._cellInfo,this.model.editCellsInfo.rowHeader=h,this.model.editCellsInfo.columnHeader=c,this._trigger("cellEdit",{editCellsInfo:this.model.editCellsInfo}),r="",!t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)&&this.model.editCellsInfo.JSONRecords.length>0&&n.each(this.model.editCellsInfo.JSONRecords,function(n,t){r=r==""?t.Value:r+":"+t.Value}),y=JSON.stringify({action:"writeBack",value:r,rowUniqueName:JSON.stringify(this.model.editCellsInfo.rowHeader),columnUniqueName:JSON.stringify(this.model.editCellsInfo.columnHeader),currentReport:l,customObject:JSON.stringify(this.model.customObject)}),!t.isNullOrUndefined(this.model.editCellsInfo.JSONRecords)&&this.model.editCellsInfo.JSONRecords.length>0)this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.writeBack,y,this._renderControlSuccess);else{for(i=e.length-1;i>=0;i--)n(e[i]).closest("td").text(t.isNullOrUndefined(this._originalValue.split("#")[i])?"":this._originalValue.split("#")[i]);this._waitingPopup.hide()}this._rowHeader=[];this._colHeader=[]},_createVirtualPivotGrid:function(n){var u=this._seriesPageCount>1?t.buildTag("div.vScrollPanel")[0].outerHTML:"",f=this._categPageCount>1?t.buildTag("div.hScrollPanel")[0].outerHTML:"",e=t.buildTag("td.virtualScrollGrid",n[0].outerHTML)[0],o=t.buildTag("td.virtualScrollElement",u),s=t.buildTag("td.virtualScrollElement",f),h=t.buildTag("tr.virtualScrollElement",e.outerHTML+o[0].outerHTML),c=t.buildTag("tr.virtualScrollElement",s[0].outerHTML+t.buildTag("td.virtualScrollElement")[0].outerHTML),l=t.buildTag("tbody.oGridOuterDiv.virtualScrollElement",h[0].outerHTML+c[0].outerHTML),i,r;this.element.html(t.buildTag("table.virtualScrollElement",l[0].outerHTML));i=t.buildTag("div.seriesPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("SeriesPage"))[0].outerHTML+t.buildTag("span.series_CurrentPage",this._seriesCurrentPage)[0].outerHTML+" / "+t.buildTag("span.series_pageCount",this._seriesPageCount)[0].outerHTML)[0].outerHTML;this._seriesPageCount>1&&this.element.append(i);r=t.buildTag("div.categPageIndicator inActive",t.buildTag("span.axislabel",this._getLocalizedLabels("CategoricalPage"))[0].outerHTML+t.buildTag("span.categ_CurrentPage",this._categCurrentPage)[0].outerHTML+" / "+t.buildTag("span.categ_pageCount",this._categPageCount)[0].outerHTML)[0].outerHTML;this._categPageCount>1&&this.element.append(r)}});t.PivotGrid.Layout={Normal:"normal",NormalTopSummary:"normaltopsummary",NoSummaries:"nosummaries",ExcelLikeLayout:"excellikelayout"};t.PivotGrid.Locale={};t.PivotGrid.Locale["en-US"]={Sort:"Sort",Search:"Search",SelectField:"select Field",LabelFilterLabel:"Show the items for which the label",ValueFilterLabel:"Show the items for which",ClearSorting:"Clear Sorting",ClearFilterFrom:"Clear Filter From",SortAtoZ:"Sort A to Z",SortZtoA:"Sort Z to A",and:"and",LabelFilters:"Label Filters ",BeginsWith:"Begins With",DoesNotBeginsWith:"Does Not Begins With",EndsWith:"Ends With",NotEndsWith:"Not Ends With",DoesNotEndsWith:"Does Not End With",Contains:"Contains",DoesNotContains:"Does Not Contain",ValueFilters:"Value Filters",ClearFilter:"Clear Filter",Equals:"Equals",DoesNotEquals:"Does Not Equal",NotEquals:"Not Equals",GreaterThan:"Greater Than",IsGreaterThan:"Is Greater Than",IsGreaterThanOrEqualTo:"Is Greater Than Or Equal To",IsLessThan:"Is Less Than",IsLessThanOrEqualTo:"Is Less Than Or Equal To",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between",Top10:"Top Count",AddToFilter:"Add to Filter",AddToRow:"Add to Row",AddToColumn:"Add to Column",AddToValues:"Add to Values",Warning:"Warning",Error:"Error",GroupingBarAlertMsg:"The field you are moving cannot be placed in that area of the report",Measures:"Measures",Expand:"Expand",Collapse:"Collapse",ToolTipRow:"Row",ToolTipColumn:"Column",ToolTipValue:"Value",NoValue:"No value",SeriesPage:"Series Page",CategoricalPage:"Categorical Page",DragFieldHere:"Drag field here",ColumnArea:"Drop column here",RowArea:"Drop row here",ValueArea:"Drop values here",Close:"Close",OK:"OK",Cancel:"Cancel",Remove:"Remove",Goal:"Goal",Status:"Status",Trend:"Trend",Value:"value",ConditionalFormattingErrorMsg:"The given value is not matched",ConditionalFormattingConformMsg:"Are you sure you want to remove the selected format?",EnterOperand1:"Enter Operand1",EnterOperand2:"Enter Operand2",ConditionalFormatting:"Conditional Formatting",Condition:"Conditional Type",Value1:"Value1",Value2:"Value2",Editcondtion:"Edit Condition",AddNew:"Add New",Format:"Format",Backcolor:"Back Color",Borderrange:"Border Range",Borderstyle:"Border Style",Fontsize:"Font Size",Fontstyle:"Font Style",Bordercolor:"Border Color",NoMeasure:"Please add any measure",AliceBlue:"AliceBlue",Black:"Black",Blue:"Blue",Brown:"Brown",Gold:"Gold",Green:"Green",Lime:"Lime",Maroon:"Maroon",Orange:"Orange",Pink:"Pink",Red:"Red",Violet:"Violet",White:"White",Yellow:"Yellow",Solid:"Solid",Dashed:"Dashed",Dotted:"Dotted",Double:"Double",Groove:"Groove",Inset:"Inset",Outset:"Outset",Ridge:"Ridge",None:"None",Algerian:"Algerian",Arial:"Arial",BodoniMT:"Bodoni MT",BritannicBold:"Britannic Bold",Cambria:"Cambria",Calibri:"Calibri",CourierNew:"Courier New",DejaVuSans:"DejaVu Sans",Forte:"Forte",Gerogia:"Gerogia",Impact:"Impact",SegoeUI:"Segoe UI",Tahoma:"Tahoma",TimesNewRoman:"Times New Roman",Verdana:"Verdana",CubeDimensionBrowser:"Cube Dimension Browser",SelectHierarchy:"Select Hierarchy",CalculatedField:"Calculated Field",Name:"Name:",Add:"Add",Formula:"Formula:",Delete:"Delete",Fields:"Fields:",MultipleItems:"Multiple items",All:"All",CalculatedFieldNameNotFound:"Given CalculatedField name is not found",InsertField:"Insert Field",EmptyField:"Please enter Calculated field name or formula",NotValid:"Given formula is not valid",NotPresent:"Value field used in any of the Calculated Field formula is not present in the PivotGrid",Confirm:"Calculated field with the same name already exists. Due to want to Replace ?",CalcValue:"Calculated field can be inserted only in value area field",NoRecordsToDisplay:"No records to display.",NumberFormatting:"Number Formatting",FrozenHeaders:"Frozen Headers",CellSelection:"Cell Selection",CellContext:"Cell Context",ColumnResize:"Column Resize",Layouts:"Layouts",ExcelLikeLayout:"Excel Like Layout",NormalLayout:"Normal Layout",NormalTopSummary:"NormalTopSummary Layout",NoSummaries:"NoSummaries Layout",FrozenHeader:"Frozen Header",AdvancedFiltering:"Advanced Filtering",Amount:"Amount",Quantity:"Quantity",Measures:"Measures",NumberFormats:"Number Formats",Exporting:"Exporting",FileName:"File Name",ToolTip:"Tool Tip",RTL:"RTL",CollapseByDefault:"Collapse By Default",EnableDisablePaging:"Enalbe / Disable Paging",PagingOptions:"Paging Options",CategoricalPageSize:"Categorical Page Size",SeriesPageSize:"Series Page Size",HyperLink:"HyperLink",CellEditing:"Cell Editing",GroupingBar:"Grouping Bar",SummaryCustomization:"Summary Customization",SummaryTypes:"Summary Types",SummaryType:"Summary Type",EnableRowHeaderHyperlink:"Enable RowHeaderHyperLink",EnableColumnHeaderHyperlink:"Enable ColumnHeaderHyperLink",EnableValueCellHyperlink:"Enable ValueCellHyperLink",EnableSummaryCellHyperlink:"Enable SummaryCellHyperLink",HideGrandTotal:"Hide GrandTotal",HideSubTotal:"Hide SubTotal",Row:"Row",Column:"Column",Both:"Both",Sum:"Sum",Average:"Average",Count:"Count",Min:"Min",Max:"Max",Excel:"Excel",Word:"Word",PDF:"PDF",CSV:"CSV",Total:"Total",GrandTotal:"Grand Total",DrillThrough:"Drill Through",EnabledState:"Enabled State"};t.PivotGrid.ExportOptions={Excel:"excel",Word:"word",PDF:"pdf",CSV:"csv"};t.PivotGrid.ConditionalOptions={Equals:"Equals",NotEquals:"Not Equals",GreaterThan:"Greater Than",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between"};t.PivotGrid.AnalysisMode={Olap:"olap",Relational:"relational"};t.PivotGrid.ExportMode={JSON:"json",PivotEngine:"pivotengine"};t.PivotGrid.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"};t.olap.base&&n.extend(t.PivotGrid.prototype,t.olap.base);t.olap._mdxParser&&n.extend(t.PivotGrid.prototype,t.olap._mdxParser)}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotSchemaDesigner","ej.PivotSchemaDesigner",{_rootCSS:"e-pivotschemadesigner",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:{url:"",cssClass:"",height:n(this.element).parents(".e-pivotclient").length>0?"":"630px",width:"415px",locale:"en-US",layout:"excel",enableRTL:!1,pivotControl:null,pivotTableFields:[],pivotCalculations:[],pivotColumns:[],pivotRows:[],filters:[],olap:{showKpi:!1,showNamedSets:!1},enableWrapper:!1,enableDragDrop:!0,serviceMethods:{fetchMembers:"FetchMembers",nodeStateModified:"NodeStateModified",nodeDropped:"NodeDropped",removeButton:"RemoveButton",memberExpand:"MemberExpanded",filtering:"filtering",sorting:"sorting"},customObject:{},beforeServiceInvoke:null,afterServiceInvoke:null,dragMove:null,applyFieldCaption:null},dataTypes:{serviceMethods:"data",customObject:"data",pivotControl:"data",pivotTableFieldList:"array",pivotCalculationList:"array",pivotColumnList:"array",pivotRowList:"array",filterList:"array"},locale:t.util.valueFunction("locale"),_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this.element.empty().removeClass("e-pivotschemadesigner"+this.model.cssClass)},_initPrivateProperties:function(){this._id=this.element.attr("id");this._dialogTitle="";this._currentMembers=[];this._memberTreeObj=null;this._tableTreeObj=null;this._dialogOKBtnObj=null;this._curFilteredText="";this._curFilteredAxis="";this._tempFilterData=null;this._droppedClass="";this._selectedTreeNode=null;this._selectedMember="";this._selectedLevel="";this._isDragging=!1;this._dataModel="";this._droppedPosition="";this._currentCubeName="";this._errorDialog="";this._nodeDropedParams="";this._contextMenuObj=null;this._removeButtonDeferUpdate=!1;this._isMeasureBtnRemove=!1;this._nodeCheck=!1;this._isFiltered=!1;this._curFocus={tree:null,node:null,tab:null,button:null};this._index={tree:0,node:0,tab:0,button:0};this._selectedFieldName="";this._selectedFieldCaption="";this._selectedFieldAxis="";this._isDropAction=!1;this._ascdes="";this._pivotClientObj=null},_load:function(){var u="",r,e,o,f,s;this.model.pivotControl!=null&&(this.model.pivotControl._schemaData=this,n(this.element).parents(".e-pivotclient").length>0&&(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient")),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?(u=JSON.parse(JSON.parse(this.model.pivotControl.getOlapReport()).ItemsProperties),r=JSON.parse(this.model.pivotControl.getOlapReport()),this.model.pivotControl._dataModel=="Pivot"?(r=this.model.pivotControl._filterReport(r),e=r.PivotRows.concat(r.PivotColumns,r.PivotCalculations,r.Filters),o=n.grep(u,function(t){return n.grep(e,function(n){t.id==(n.FieldHeader||n.DimensionHeader)&&(t.id=n.FieldName||n.DimensionName)}),t}),this._setTableFields(o)):this._setTableFields(u),this._setPivotRows(r.PivotRows),this._setPivotColumns(r.PivotColumns),this._setPivotCalculations(r.PivotCalculations),this._setFilters(r.Filters),this._dataModel=r.DataModel,this._currentCubeName=r.CurrentCube):(r=this.model.pivotControl.model.dataSource,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(this.model.pivotTableFields=t.PivotAnalysis.getTreeViewData(this.model.pivotControl.model.dataSource))),this.model._waitingPopup?this._waitingPopup=this.model._waitingPopup:(n("#"+this._id).ejWaitingPopup({showOnInit:!0}),this._waitingPopup=n("#"+this._id).data("ejWaitingPopup")),this.element.width(this.model.width).height(this.model.height),pschemaDesignerWaitingPopup=this._waitingPopup,this._waitingPopup.show());this.model.enableWrapper?(this.element.show(),this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._refreshPivotButtons():(this._setFilters(r.Filters),this._refreshPivotButtons(),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.element.append(t.buildTag("div.deferUpdateLayout",t.buildTag("input.chkDeferUpdate","",{}).attr("type","checkbox")[0].outerHTML+t.buildTag("button.btnDeferUpdate",this._getLocalizedLabels("Update"),{}).attr("type","button")[0].outerHTML)[0].outerHTML),this.model.pivotControl!=null&&this.model.enableDragDrop&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)})),this._reSizeHandler()):(f=(this.model.layout=="onebyone"?"":t.buildTag("table.headerTable",t.buildTag("tr",t.buildTag("td",t.buildTag("div.listHeader",t.buildTag("span.headerText",this._getLocalizedLabels("PivotTableFieldList"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.listSubhead",t.buildTag("span.subheadText",this._getLocalizedLabels("ChooseFieldsToAddToReport"),{})[0].outerHTML,{})[0].outerHTML,{}).attr("valign","top")[0].outerHTML,{})[0].outerHTML,{width:"100%",height:"10%"})[0].outerHTML)+t.buildTag("div.fieldTable",(this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?t.buildTag("div.cubelists",t.buildTag("input#cubeList.cubeList").attr("type","text")[0].outerHTML)[0].outerHTML:"")+t.buildTag("div.parentSchemaFieldTree",t.buildTag("div.schemaFieldTree#"+this._id+"_schemaFieldTree",{},{width:"100%"})[0].outerHTML).attr("valign","top")[0].outerHTML).attr("overflow","auto")[0].outerHTML,filterAxis=t.buildTag("div.axisTd1",t.buildTag("div.pivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("ReportFilter"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaFilter",t.buildTag("p#reportfilter","report filter",{display:"none"})[0].outerHTML+this._createPivotButtons("filters",this.model.filters)).attr("aria-describedby","reportfilter").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,{})[0].outerHTML,columnAxis=t.buildTag("div.axisTd2",t.buildTag("div.rPivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("ColumnLabel"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaColumn",t.buildTag("p#columnlabel","column label",{display:"none"})[0].outerHTML+this._createPivotButtons("columns",this.model.pivotColumns)+(this._dataModel!="XMLA"||this.model.pivotCalculations.length==0?"":this.model.pivotCalculations[0].measures!=i&&this.model.pivotCalculations[0].measures.length>0&&this.model.pivotCalculations[0].axis!=i&&this.model.pivotCalculations[0].axis=="columns"?this._createPivotButtons("columns",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}]):""),{})[0].outerHTML,{}).attr("aria-describedby","columnlabel").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,rowAxis=t.buildTag("div.axisTd1#axisTd",t.buildTag("div.pivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("RowLabel"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaRow",t.buildTag("p#rowlabel","row label",{display:"none"})[0].outerHTML+this._createPivotButtons("rows",this.model.pivotRows)+(this._dataModel!="XMLA"||this.model.pivotCalculations.length==0?"":this.model.pivotCalculations[0].measures!=i&&this.model.pivotCalculations[0].measures.length>0&&this.model.pivotCalculations[0].axis!=i&&this.model.pivotCalculations[0].axis=="rows"?this._createPivotButtons("rows",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}]):""),{})[0].outerHTML,{}).attr("aria-describedby","rowlabel").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,values=t.buildTag("div.axisTd2#axisTd3",t.buildTag("div.rPivotHeader",t.buildTag("span.headerText",this._getLocalizedLabels("Values"),{})[0].outerHTML,{})[0].outerHTML+t.buildTag("div.schemaValue",t.buildTag("p#valuelabel","values",{display:"none"})[0].outerHTML+this._createPivotButtons("values",this.model.pivotCalculations),{}).attr("aria-describedby","valuelabel").attr("aria-dropeffect","none").attr("aria-selected","false")[0].outerHTML,{})[0].outerHTML,axisTable=t.buildTag("div.axisTable",this.model.layout=="onebyone"?columnAxis+rowAxis+filterAxis+values:t.buildTag("div",filterAxis+columnAxis,{})[0].outerHTML+t.buildTag("div",rowAxis+values,{})[0].outerHTML,this.model.enableRTL&&this.model.layout=="onebyone"?{position:"relative",left:this._pivotClientObj.model.enableSplitter?"":"7px"}:{})[0].outerHTML,deferUpdate=t.buildTag("div.deferUpdateLayout",t.buildTag("input.chkDeferUpdate","",{}).attr("type","checkbox")[0].outerHTML+t.buildTag("button.btnDeferUpdate",this._getLocalizedLabels("Update"),{}).attr("type","button")[0].outerHTML)[0].outerHTML,htmlTag=this.model.enableRTL&&this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableSplitter?axisTable+(this.model.layout=="onebyone"?"":t.buildTag("div.centerDiv")[0].outerHTML+t.buildTag("div.centerHead",this._getLocalizedLabels("DragFieldBetweenAreasBelow"))[0].outerHTML)+f+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("span.responsiveSchema","")[0].outerHTML)+(this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n(this.element).parents(".e-pivotclient").length==0?deferUpdate:"")+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("div.schemaNoClick","")[0].outerHTML):f+(this.model.layout=="onebyone"?"":t.buildTag("div.centerDiv")[0].outerHTML+t.buildTag("div.centerHead",this._getLocalizedLabels("DragFieldBetweenAreasBelow"))[0].outerHTML)+axisTable+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("span.responsiveSchema","")[0].outerHTML)+(this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n(this.element).parents(".e-pivotclient").length==0?deferUpdate:"")+(n(this.element).parents(".e-pivotclient").length>0?"":t.buildTag("div.schemaNoClick","")[0].outerHTML),n(htmlTag).appendTo("#"+this._id),this.element.parents(".e-pivotclient").length>0&&!this._pivotClientObj.model.enableSplitter&&(this._pivotClientObj.model.isResponsive&&this.element.find(".fieldTable").addClass("addedFieldTable"),this.model.enableRTL||this.element.find(".fieldTable").addClass("fieldDisSplitTable")),this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableSplitter&&this.element.find(".fieldTable").addClass("fieldEnSplitTable"),this.model.enableRTL&&this.element.parents(".e-pivotclient").length>0&&(this.element.find(".fieldTable").addClass("clientFieldTable"),this.element.find(".fieldTable").addClass("rtlSplitTable"),this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableSplitter&&this.element.find(".axisTable").addClass("clientAxisSplitterTable")),this.model.pivotControl!=null?((this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.pivotControl.element.hasClass("e-pivotclient"))&&this._refreshPivotButtons(),this._reSizeHandler()):this.element.hide());this.model.enableDragDrop&&this.model.pivotControl&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)});this.element.find(".pivotButton .filterBtn").ejButton({size:"normal",enableRTL:this.model.enableRTL,type:t.ButtonType.Button,contentType:"imageonly",prefixIcon:"filter"});this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&(s={url:this.model.pivotControl.model.dataSource.data,cube:this.model.pivotControl.model.dataSource.cube,catalog:this.model.pivotControl.model.dataSource.catalog,request:"MDSCHEMA_CUBES"},t.Pivot._getTreeData(s,t.Pivot.getCubeList,{pvtCtrldObj:this,action:"loadcubelist",hierarchy:this._selectedField}),this.element.find(".cubeList").ejDropDownList({dataSource:this.model.cubeCollection,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},width:"100%",height:"27px",change:t.proxy(this._cubeChanged,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),ddlTarget=this.element.find(".cubeList").data("ejDropDownList"),t.isNullOrUndefined(ddlTarget)||ddlTarget.selectItemByText(this.model.pivotControl.model.dataSource.cube));this.element.find(".pivotButton input").ejToggleButton({size:"normal",enableRTL:this.model.enableRTL,contentType:"imageonly",defaultPrefixIcon:"ascending",activePrefixIcon:"descending",click:t.proxy(this._sortBtnClick,this)});this.model.pivotControl!=null&&(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot||this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?this._createTreeView(this,this.model.pivotTableFields):t.Pivot.generateTreeViewData(this));this.model.enableRTL&&this.element.addClass("e-rtl");this._createContextMenu();this._waitingPopup&&this._waitingPopup.hide();this._setPivotBtnWidth()},setCubeList:function(n){this.model.cubeCollection=n},refreshControl:function(){var i,t;for(n(this._tableTreeObj.element).ejTreeView("unCheckAll"),this._isDropAction=!0,i=this.model.pivotControl.model.dataSource,t=0;t<i.rows.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.rows[t].fieldName+"']"));for(t=0;t<i.columns.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.columns[t].fieldName+"']"));for(t=0;t<i.filters.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.filters[t].fieldName+"']"));for(t=0;t<i.values.length;t++)this._tableTreeObj.checkNode(this._tableTreeObj.element.find("li[tag='"+i.values[t].fieldName+"']"));this._isDropAction=!1;this._refreshPivotButtons()},_cubeChanged:function(i){this.model.pivotControl.model.dataSource.cube!=i.selectedValue&&(this._pivotClientObj._waitingPopup&&setTimeout(function(){var t=n(i.target).parents(".e-pivotclient").length>0?n(i.target).parents(".e-pivotclient").data("ejPivotClient"):n(this.element).parents(".e-pivotclient").data("ejPivotClient");t._waitingPopup.show()},0),this.model.pivotControl.model.dataSource.cube=i.selectedValue,this.model.pivotControl.model.dataSource.rows=this.model.pivotControl.model.dataSource.columns=this.model.pivotControl.model.dataSource.values=this.model.pivotControl.model.dataSource.filters=[],delete this.model.pivotControl._fieldData,this.element.find(".pivotButton").remove(),this.element.find(".schemaFieldTree").empty(),t.Pivot.generateTreeViewData(this,this.model.pivotControl.model.dataSource),this._pivotClientObj.refreshControl())},_setPivotBtnWidth:function(){if(this.model.layout!="excel"&&this.model.pivotControl){var r=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!0:!1,u=r?this._dataModel:this.model.pivotControl._dataModel,i=u=="Olap"||u=="XMLA"?15:20;n.each(this.element.find(".schemaRow .pvtBtn,.schemaColumn .pvtBtn"),function(t,u){n(u).attr("aria-describedby")=="Measures"?n(u).width(n(u).parent().width()-i-10):(n(u).width(n(u).parent().width()-3*i),this._dataModel!="Pivot"&&r&&n(".pivotButton:contains('"+n(u).text()+"'):first").find(".filtered").length>0&&n(u).parent().find(".filter").addClass("filtered"))});n.each(this.element.find(".schemaValue .pvtBtn"),function(t,r){n(r).width(n(r).parent().width()-i-10)});n.each(this.element.find(".schemaFilter .pvtBtn"),function(t,u){n(u).width(n(u).parent().width()-2*i-10);this._dataModel!="Pivot"&&r&&n(".pivotButton:contains('"+n(u).text()+"'):first").find(".filtered").length>0&&n(u).parent().find(".filter").addClass("filtered")})}else n.each(this.element.find(".pvtBtn"),function(t,i){n(i).width(n(i).parent().width()-15)})},_onContextOpen:function(i){n(i.target).hasClass("removeClientPivotBtn")||t.Pivot._contextMenuOpen(i,this)},_contextClick:function(i){var r,f,u;schemaObj=this;r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(r)?this.model.pivotControl._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));f=i.text==this._getLocalizedLabels("AddToColumn")?this.element.find(".schemaColumn"):i.text==this._getLocalizedLabels("AddToRow")?this.element.find(".schemaRow"):i.text==this._getLocalizedLabels("AddToValues")?this.element.find(".schemaValue"):i.text==this._getLocalizedLabels("AddToFilter")?this.element.find(".schemaFilter"):"";u={element:this._selectedMember,target:f[0],cancel:!1};this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped(u):this._clientOnPvtBtnDropped(u)},_createTreeView:function(r,u){var f,c,e,l,a,o,s,v,h;for(this.element.find(".schemaFieldTree").ejTreeView({showCheckbox:this.model.layout=="onebyone"?!1:!0,fields:{id:"id",parentId:"pid",text:this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"name":"caption",isChecked:"isSelected",spriteCssClass:"spriteCssClass",dataSource:u},enableRTL:this.model.enableRTL,allowDragAndDrop:this.model.enableDragDrop?!0:!1,allowDropChild:!1,allowDropSibling:!1,dragAndDropAcrossControl:!0,beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",nodeDropped:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._nodeDropped:this._clientOnNodeDropped,this),nodeDragStart:t.proxy(this._nodeDrag,this),nodeDrag:t.proxy(this._nodeDraged,this)}),f=[],c=this.model.pivotControl.model.dataSource.providerName==t.olap.Providers.Mondrian,this._tableTreeObj=this.element.find(".schemaFieldTree").data("ejTreeView"),this._tableTreeObj.element.find(".e-ul").css({width:"100%",height:"100%"}),this._tableTreeObj.element.find(".measureGroupCDB").parent().siblings(".e-chkbox-wrap").remove(),this._tableTreeObj.element.find(".folderCDB").parent().siblings(".e-chkbox-wrap").remove(),this._tableTreeObj.element.find(".dimensionCDB").parent().siblings(".e-chkbox-wrap").remove(),this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne&&(this._tableTreeObj.element.find(".measureGroupCDB").parents("li").length==0?this._tableTreeObj.element.find("#\\[Measures\\]").append(t.buildTag("span.elementSeparator")[0].outerHTML):this._tableTreeObj.element.find(".measureGroupCDB").parents("li").append(t.buildTag("span.elementSeparator")[0].outerHTML),this._tableTreeObj.element.find(".dimensionCDB").parents("li").append(t.buildTag("span.elementSeparator")[0].outerHTML)),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&(f=this._tableTreeObj.element,n.map(u,function(t){t.defaultHierarchy&&n(f).find("li[id='"+t.tag+"']").attr("defaultHierarchy",t.defaultHierarchy)})),f=this._tableTreeObj.element.find("li"),e=0;e<f.length;e++)l=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?c?n(f[e]).attr("id").split("~#^")[0]:n(f[e]).attr("id"):this.model.pivotTableFields[e].tag,f[e].setAttribute("tag",l),a=n(f[e]).find(".e-chkbox-wrap"),n(a[0]).attr("aria-checked")=="true"&&n(n(f[e])).find(".folderCDB").length<=0&&n(f[e]).attr("tag").toLowerCase().indexOf("[measures]")==-1&&(this.model.pivotControl._dataModel=="XMLA"?n(f[e]).parents("li:eq(0)").length>0&&n(f[e]).parents("li:eq(0)").attr("tag").toLowerCase().indexOf("[measures]")==-1&&(o=t.Pivot.getReportItemByFieldName(n(f[e]).attr("tag"),this.model.pivotControl.model.dataSource,this._dataModel).item,!t.isNullOrUndefined(o)>0&&(o.isNamedSets==i||!o.isNamedSets)&&(s=t.buildTag("span.e-icon").css("display","inline-block").addClass("treeDrop").attr("role","button").attr("aria-label","filter button")[0].outerHTML,n(n(f[e]).find(".e-text")[0]).after(s))):(s=t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML,n(n(f[e]).find(".e-text")[0]).after(s)));this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?(this._tableTreeObj.model.nodeCheck=t.proxy(this._clientPivotCheckedStateModified,this),this._tableTreeObj.model.nodeUncheck=t.proxy(this._clientPivotCheckedStateModified,this)):(this._tableTreeObj.model.nodeCheck=t.proxy(this._checkedStateModified,this),this._tableTreeObj.model.nodeUncheck=t.proxy(this._checkedStateModified,this));this._tableTreeObj.element.find(".attributeCDB").parent().siblings("ul").remove();this._tableTreeObj.element.find(".attributeCDB").closest("div").find(".e-plus").remove();this._tableTreeObj.element.find(".hierarchyCDB").parent().parent().siblings("ul").find(".e-chkbox-wrap").remove();this._tableTreeObj.element.find(".e-plus").length==0&&this._tableTreeObj.element.find(".e-item").css("padding","0px");this.element.find(".schemaFilter, .schemaColumn, .schemaRow, .schemaValue").ejDroppable({});this.model.pivotControl!=null&&(v=t.buildTag("ul.pivotTreeContext#pivotTreeContext",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToFilter"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToValues"))[0].outerHTML)[0].outerHTML)[0].outerHTML,n(this.element).append(v),n("#pivotTreeContext").ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,enableRTL:this.model.enableRTL,contextMenuTarget:this._tableTreeObj.element,click:t.proxy(this._treeContextClick,this),beforeOpen:t.proxy(this._contextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)}));this.model.pivotControl!=null&&(h=!1,this.model.pivotControl.model.enableDeferUpdate&&(h=!0),this.element.find(".btnDeferUpdate").ejButton({size:"mini",type:t.ButtonType.Button,enabled:h,click:t.proxy(this.model.pivotControl._deferUpdate,this.model.pivotControl)}),this.element.find(".chkDeferUpdate").ejCheckBox({text:this._getLocalizedLabels("DeferLayoutUpdate"),change:this._checkedChange,size:"normal",checked:h}));pschemaDesignerWaitingPopup.hide();this._unWireEvents();this._wireEvents()},_nodeDraged:function(n){this._trigger("dragMove",n)},_setFirst:!0,_setModel:function(t){for(var i in t)switch(i){case"OlapReport":this.setOlapReport(t[i]);break;case"locale":this._load();break;case"locale":case"enableRTL":n(this.element).html("");this._load()}},_wireEvents:function(){this._on(n(document),"keydown",this._keyDownPress);this._on(n(document),"keyup",t.proxy(function(n){n.keyCode===93&&n.preventDefault()}));this.model.layout!="excel"&&this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne&&(this._on(this.element,"mouseover",".pivotButton .pvtBtnDiv",t.proxy(function(t){this._isDragging||n(t.target).find("button").removeClass("e-hoverBtn").addClass("e-hoverBtn")},this)),this._on(this.element,"mouseleave",".pivotButton .pvtBtnDiv",t.proxy(function(t){n(t.target).find("button").length>0?n(t.target).find("button").removeClass("e-hoverBtn"):n(t.target).removeClass("e-hoverBtn")},this)),this._on(this.element,"mouseover",".filter,.sorting,.removeBtn",t.proxy(function(t){this._isDragging||n(t.target.parentElement).find("button").removeClass("e-hoverBtn").addClass("e-hoverBtn")},this)),this._on(this.element,"mouseleave",".filter,.sorting,.removeBtn",t.proxy(function(t){n(t.target.parentElement).find("button").removeClass("e-hoverBtn")},this)));this._on(this.element,"mouseover",".pvtBtnDiv .pvtBtn",t.proxy(function(t){this._isDragging&&(this.element.find(".dropIndicator").removeClass("dropIndicatorHover"),n(t.target).parent().siblings(".dropIndicator").addClass("dropIndicatorHover"))},this));this._on(this.element,"click","#preventDiv",t.proxy(function(){this.element.find(".e-dialog.advancedFilterDlg:visible").length>0&&(this.element.find(".e-dialog.advancedFilterDlg").hide(),this.element.find("#preventDiv").remove())},this));this._on(this.element,"mouseleave",".pivotButton",t.proxy(function(t){this._isDragging&&n(t.target).siblings(".dropIndicator").removeClass("dropIndicatorHover")},this));this._on(this.element,"mouseover",".pivotButton",t.proxy(function(t){n(t.target).attr("title",t.target.textContent)},this));this._tableTreeObj.element.find("li").mouseover(t.proxy(function(i){var u,r;n(i.target).siblings("span.e-icon.filter:eq(0)").length>0||n(i.target).find("span.e-icon.filter:eq(0)").length>0||n(i.target).parentsUntil("li").find("span.e-icon.filter:eq(0)").length>0?(u="-31px",this.element.find("span.e-icon.filter").attr("role","button").attr("aria-label","filtered")):(u="-20px",this.element.find("span.e-icon.treeDrop").attr("role","button").attr("aria-label","filter button"));r=n(i.target).siblings("span.e-icon.filter:eq(0)").length>0||n(i.target).find("span.e-icon.filter:eq(0)").length>0||n(i.target).parentsUntil("li").find("span.e-icon.filter:eq(0)").length>0?10:5;this.model.enableRTL?this.model.pivotControl.model.analysisMode!=t.Pivot.AnalysisMode.Pivot?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute",top:n(i.target).hasClass("filter")?n(i.target).position().top-22:n(i.target).position().top+2,left:n(i.target).hasClass("filter")?n(i.target).position().left+(6-r):(n(i.target).attr("role")==""?n(i.target).position().left:-2)+(5-r)}):n(i.target).find("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).parentsUntil("li").find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).siblings("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute",top:n(i.target).hasClass("filter")?n(i.target).position().top-22:n(i.target).position().top+2,left:n(i.target).hasClass("filter")?n(i.target).position().left+(7-r):n(i.target).position().left+(10-r)}):n(i.target).find("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).parentsUntil("li").find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"absolute"}):n(i.target).siblings("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).siblings("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"static","margin-left":u}):n(i.target).find("span.e-icon.treeDrop:eq(0)").length>0?n(i.target).find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"static"}):n(i.target).parentsUntil("li").find("span.e-icon.treeDrop:eq(0)").css({display:"inline-block",position:"static"});n(i.target).parent().find(".measureGroupCDB, .folderCDB",this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?"":".dimensionCDB").length>0&&n(i.target).css("cursor","default")},this)).mouseout(t.proxy(function(){n(this._tableTreeObj.element).find("span.e-icon.treeDrop").css({display:"none"})},this));this._on(this.element,"click",".filterBtn,.filter",t.proxy(this._filterBtnClickCommon,this));this._on(this.element,"click",".sorting",t.proxy(this._sortBtnClick,this));this._on(this.element,"click",".removeBtn",t.proxy(this._removePvtBtn,this));this._on(this.element,"click",".pvtBtn",t.proxy(this._filterBtnClickCommon,this));this._on(this._tableTreeObj.element,"click",".treeDrop",t.proxy(this._filterBtnClickCommon,this));this._on(this.element,"click",".removeClientPivotBtn",t.proxy(this._removeBtnClick,this));this._on(this.element,"click",".removePivotBtn",t.proxy(this._removeBtnClick,this));this._on(this.element,"click",".ascOrder, .descOrder",t.proxy(this._sortField,this));this._on(this.element,"click",".collapseSchema",t.proxy(this._hideSchemaDesigner,this));this._on(this.element,"click",".expandSchema",t.proxy(this._showSchemaDesigner,this));this._on(this.element,"click",".nextPage, .prevPage, .firstPage, .lastPage",t.proxy(this._navigateTreeData,this));this._on(this.element,"click",".searchEditorTree",t.proxy(function(n){t.Pivot._searchEditorTreeNodes(n,this.model.pivotControl)},this));n(window).on("resize",n.proxy(this._reSizeHandler,this))},_navigateTreeData:function(n){t.Pivot.editorTreeNavigatee(n,this.model.pivotControl)},_filterBtnClickCommon:function(i){if(n(i.target).hasClass("pvtBtn")&&this.element.parents(".e-pivotclient").length>0||n(i.target).hasClass("treeDrop")||n(i.target).hasClass("filter"))if(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode)this._clientOnFilterBtnClick(i);else if(this.model.pivotControl.model.operationalMode!=t.Pivot.OperationalMode.ServerMode||t.isNullOrUndefined(n(i.target.nextElementSibling)))this._filterBtnClick(i);else{if(n(i.target.nextElementSibling).hasClass("treeDrop"))return!1;this._filterBtnClick(i)}},_unWireEvents:function(){this._off(this.element,"click",".filterBtn, .ascOrder, .descOrder, .nextPage, .prevPage, .firstPage, .lastPage, .searchEditorTree");this._off(n(document),"keydown",this._keyDownPress);this._off(n(document),"keyup");this._off(this.element,"click","#preventDiv");this._off(this.element,"mouseover",".pivotButton");this._off(this.element,"mouseover",".pivotButton .pvtBtn");this._off(this.element,"mouseleave",".pivotButton");this._off(this.element,"click",".sorting");this._off(this.element,"click",".filter");this._off(this.element,"click",".removeBtn,.removeClientPivotBtn");this._off(this.element,"mouseover",".schemaFieldTree li");this._off(this.element,"mouseout",".schemaFieldTree li");this._off(this._tableTreeObj.element,"click",".treeDrop");this._off(this.element,"click",".ascOrder, .descOrder",t.proxy(this._sortField,this));this._off(this.element,"click",".filterBtn");this._off(this.element,"click",".pvtBtn");this._off(this._tableTreeObj.element,"click",".treeDrop");this._off(this._tableTreeObj.element,"click","li");this._off(this.element,"click",".removeClientPivotBtn, .removePivotBtn");n(window).off("resize",n.proxy(this._reSizeHandler,this))},_keyDownPress:function(i){var r,u,e,f;if((i.keyCode===40||i.which===38)&&(!t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)&&this.model.pivotControl._curFocus.tab.hasClass("e-text")||n("#"+this._id).find(".schemaFieldList .e-text:visible").hasClass("hoverCell"))&&!n(".editorTreeView:visible").length>0&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0?(n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),this.model.pivotControl._curFocus.tab.mouseleave(),i.preventDefault(),r=n("#"+this._id).find(".schemaFieldTree .e-text:visible"),t.isNullOrUndefined(this._curFocus.tree)?(this._index.tree=i.which==40?1:i.which==38?r.length-1:0,this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1")):(this._curFocus.tree.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40?this._index.tree=this._index.tree+1>r.length-1?0:this._index.tree+1:i.which===38&&(this._index.tree=this._index.tree-1<0?r.length-1:this._index.tree-1),this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1")),this._curFocus.tree.focus().addClass("hoverCell").mouseover(),n(".e-node-focus").removeClass("e-node-focus")):(i.which===40||i.which===38||i.which===37||i.which===39)&&!t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)&&this.model.pivotControl._curFocus.tab.hasClass("pvtBtn")&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&document.activeElement.className.startsWith("pvtBtn")?(i.preventDefault(),n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.mouseleave().attr("tabindex","0").removeClass("hoverCell"),r=n("#"+this._id).find(".pvtBtn"),t.isNullOrUndefined(this._curFocus.button)?i.which===40||i.which===39?this._curFocus.button=r.eq(1).attr("tabindex","-1"):(i.which===38||i.which===37)&&(this._curFocus.button=r.eq(r.length-1).attr("tabindex","-1")):(this._curFocus.button.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40||i.which===39?this._index.button=this._index.button+1>r.length-1?0:this._index.button+1:(i.which===38||i.which===37)&&(this._index.button=this._index.button-1<0?r.length-1:this._index.button-1),this._curFocus.button=r.eq(this._index.button)),this._curFocus.button.addClass("hoverCell").mouseover().focus()):(i.keyCode===40||i.which===38)&&n("#"+this._id).find(".editorTreeView:visible").length>0&&!t.isNullOrUndefined(n("#"+this._id).find(".e-dialog .e-text"))&&n(".e-dialog .e-text").hasClass("hoverCell")&&(n("#"+this._id).find(".editorTreeView .hoverCell").removeClass("hoverCell"),i.preventDefault(),r=n("#"+this._id).find(".e-dialog .e-text:visible"),t.isNullOrUndefined(this._curFocus.node)?(this._index.node=i.which==40?1:i.which==38?r.length-1:0,this._curFocus.node=r.eq(this._index.node).attr("tabindex","-1")):(this._curFocus.node.attr("tabindex","0").removeClass("hoverCell"),i.which===40?this._index.node=this._index.node+1>r.length-1?0:this._index.node+1:i.which===38&&(this._index.node=this._index.node-1<0?r.length-1:this._index.node-1),this._curFocus.node=r.eq(this._index.node).attr("tabindex","-1")),this._curFocus.node.focus().addClass("hoverCell"),n(".e-node-focus").removeClass("e-node-focus")),(i.which===39||i.which===37)&&n("#"+this._id).find(".schemaFieldTree .e-text:visible").hasClass("hoverCell")&&!n(".editorTreeView:visible").length>0?n("#"+this._id).find(".schemaFieldTree .hoverCell").parent().find(".e-plus,.e-minus").click():(i.which===39||i.which===37)&&n("#"+this._id).find(".editorTreeView .e-text:visible").hasClass("hoverCell")?n("#"+this._id).find(".editorTreeView .hoverCell").parent().find(".e-plus,.e-minus").click():i.which===9&&n("#"+this._id).find(".editorTreeView:visible").length>0&&(i.preventDefault(),n("#"+this._id).find(".e-dialog .hoverCell").removeClass("hoverCell"),this._curFocus.node=null,this._index.node=0,u=[],u.push(n("#"+this._id).find(".e-dialog .e-text").first()),n("#"+this._id).find(".dialogOKBtn:visible").hasClass("e-disable")||u.push(n("#"+this._id).find(".dialogOKBtn:visible")),u.push(n("#"+this._id).find(".dialogCancelBtn:visible")),u.push(n("#"+this._id).find(".e-close:visible")),t.isNullOrUndefined(this._curFocus.tab)?(this._index.tab=1,this._curFocus.tab=u[this._index.tab].attr("tabindex","-1")):(this._curFocus.tab.attr("tabindex","0").removeClass("hoverCell"),this._index.tab=this._index.tab+1>u.length-1?0:this._index.tab+1,this._curFocus.tab=u[this._index.tab].attr("tabindex","-1")),this._curFocus.tab.focus().addClass("hoverCell"),i.stopImmediatePropagation()),i.which===13&&n("#"+this._id).find(".hoverCell").length>0&&!n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0){if(n("#"+this._id).find(".e-dialog:visible").length>0){if(n(i.target).hasClass("memberCurrentPage")){t.Pivot.editorTreeNavigatee(i,this.model.pivotControl);return}if(n(i.target).hasClass("searchEditorTreeView")&&n(i.target).parents(".e-dialog").find(".nextPageDiv").length>0){t.Pivot._searchEditorTreeNodes(i,this.model.pivotControl);return}n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").length>0?n("#"+this._id).find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click():(n("#"+this._id).find(".e-dialog .hoverCell").click(),this._index.tab=0,t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"))}else n("#"+this._id).find(".schemaFieldTree .hoverCell").length>0?n("#"+this._id).find(".schemaFieldTree .hoverCell").parent().find(".e-chkbox-small").click():n(".pivotTree:visible,.pivotTreeContext:visible,.pivotTreeContextMenu:visible").length>0&&(this._curFocus.button&&(e=this._curFocus.button.parent().attr("tag")),this.model.pivotControl._curFocus.button=n("#"+this._id).find("[tag='"+e+"'] button"),this.model.pivotControl._curFocus.button.attr("tabindex","-1").focus().addClass("hoverCell"));i.stopImmediatePropagation()}i.which===70&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".treeDrop").length>0&&n("#"+this._id).find(".hoverCell").length>0&&n("#"+this._id).find(".hoverCell").parent().find(".treeDrop").click());i.keyCode===93&&n("#"+this._id).find(".hoverCell").length>0&&(i.preventDefault(),f={x:n(".hoverCell").offset().left+n(".hoverCell").outerWidth(),y:n(".hoverCell").offset().top+n(".hoverCell").outerHeight()},n(".hoverCell").trigger({type:"mouseup",which:3,clientX:f.x,clientY:f.y,pageX:f.x,pageY:f.y}));((i.which===79||i.which===67)&&i.ctrlKey||i.which===27)&&n("#"+this._id).find(".hoverCell").length>0&&(i.keyCode==79&&n("#"+this._id).find(".e-dialog").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogOKBtn:visible").click()),i.keyCode==67&&n("#"+this._id).find(".e-dialog").length>0&&i.ctrlKey&&(i.preventDefault(),n("#"+this._id).find(".dialogCancelBtn:visible").click()),this._index.node=0,n("#"+this._id).find(".hoverCell").removeClass("hoverCell"),t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this._curFocus.button)?t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"):this._curFocus.button.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().mouseover().addClass("hoverCell"))},_getLocalizedLabels:function(n){return t.PivotSchemaDesigner.Locale[this.locale()][n]===i?t.PivotSchemaDesigner.Locale["en-US"][n]:t.PivotSchemaDesigner.Locale[this.locale()][n]},_setTableFields:function(n){t.isNullOrUndefined(n)||(this.model.pivotTableFields=n)},_setPivotRows:function(n){t.isNullOrUndefined(n)||(this.model.pivotRows=n)},_setPivotColumns:function(n){t.isNullOrUndefined(n)||(this.model.pivotColumns=n)},_setPivotCalculations:function(n){t.isNullOrUndefined(n)||(this.model.pivotCalculations=n)},_setFilters:function(n){t.isNullOrUndefined(n)||(this.model.filters=n)},_getSortedHeaders:function(){for(var i=this.element.find(".descending").parents("label"),r="",t=0;t<i.length;t++)r+=n(i[t]).attr("for").replace("toggleBtn","")+"##";return r},_contextOpen:function(i){var u,r;if(n(i.target.parentElement).find(".measureGroupCDB").length>0||n(i.target.parentElement).find(".folderCDB").length>0||!(this.element.parents(".e-pivotclient").length>0)&&n(i.target.parentElement).find(".dimensionCDB").length>0||!n(i.target).hasClass("e-text"))return!1;t.Pivot.openPreventPanel(this);this._selectedMember=n(i.target);this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(r=n("#pivotTreeContext").data("ejMenu"),n(i.target).parents("li:eq(0)").attr("tag").toLowerCase().indexOf("[measures]")>=0?(r.disableItem(this._getLocalizedLabels("AddToFilter")),r.disableItem(this._getLocalizedLabels("AddToRow")),r.disableItem(this._getLocalizedLabels("AddToColumn")),r.enableItem(this._getLocalizedLabels("AddToValues"))):(r.disableItem(this._getLocalizedLabels("AddToValues")),n(i.target.parentElement).find(".namedSetCDB").length>0?r.disableItem(this._getLocalizedLabels("AddToFilter")):r.enableItem(this._getLocalizedLabels("AddToFilter")),r.enableItem(this._getLocalizedLabels("AddToRow")),r.enableItem(this._getLocalizedLabels("AddToColumn")))):this._dataModel=="Pivot"&&(u=i.target.textContent,n(i.target).hasClass("e-text")&&(n(this.element).parents(".e-pivotclient").length>0||n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==u}).length==0)?(r=n("#pivotTreeContext").data("ejMenu"),r.enable()):(r=n("#pivotTreeContext").data("ejMenu"),r.disable()))},_nodeDrag:function(i){return this._isDragging=!0,(n(i.dragTarget.parentElement).find(".measureGroupCDB").length>0||n(i.dragTarget.parentElement).find(".folderCDB").length>0||n(i.dragTarget.parentElement).find(".dimensionCDB").length>0)&&!(n(i.dragTarget.parentElement).find(".dimensionCDB").length>0&&this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne)?!1:void 0},_treeContextClick:function(i){var r,u,f;schemaObj=this;r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this.model.pivotControl._curFocus.tab)||this.model.pivotControl._curFocus.tab.attr("tabindex","-1").focus().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().addClass("hoverCell");u=i.text==this._getLocalizedLabels("AddToColumn")?this.element.find(".schemaColumn"):i.text==this._getLocalizedLabels("AddToRow")?this.element.find(".schemaRow"):i.text==this._getLocalizedLabels("AddToValues")?this.element.find(".schemaValue"):i.text==this._getLocalizedLabels("AddToFilter")?this.element.find(".schemaFilter"):"";f={dropTarget:u,droppedElement:this._selectedMember.parent().parent(),target:u};t.isNullOrUndefined(r)?this.model.pivotControl._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._nodeDropped(f):this._clientOnNodeDropped(f)},_checkedChange:function(t){var i=n(t.event.target).parents(".e-pivotschemadesigner").data("ejPivotSchemaDesigner"),r=n(".btnDeferUpdate").data("ejButton");t.isChecked?(i.model.pivotControl.model.enableDeferUpdate=!0,r.enable()):(i.model.pivotControl.model.enableDeferUpdate=!1,i.model.pivotControl._isUpdateRequired&&i.model.pivotControl._deferUpdate(),r.disable())},_sortBtnClick:function(i){var r;if(n(i.target).toggleClass("descending"),this.model.pivotControl._dataModel!="Olap"&&this.model.pivotControl._dataModel!="XMLA")if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){t.PivotAnalysis._valueSorting=null;var f=n(i.target).parents(".pivotButton").attr("tag").split(":")[1],e=this.model.pivotControl.model.dataSource[n(i.target).parents(".pivotButton").attr("tag").split(":")[0].toLowerCase()],u=n.grep(e,function(n){return n.fieldName==f}),o=i.target.className.indexOf("descending")>=0?t.PivotAnalysis.SortOrder.Descending:t.PivotAnalysis.SortOrder.Ascending;for(r=0;r<u.length;r++)u[r].sortOrder=o;this.model.pivotControl._populatePivotGrid()}else this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this.model.pivotControl._sortBtnClick(i)},_generateMembers:function(r,u){var c=n(u).find("Axis:eq(0) Tuple"),e=[],l={},f,o,a,s,h;for(e.push({id:"All",name:"All",checkedStatus:!0,tag:""}),f=0;f<c.length;f++)o=n(n(u).find("Axis:eq(0) Tuple:eq("+f+")").children().children()[0]).text(),a=n(n(u).find("Axis:eq(0) Tuple:eq("+f+")").children().children()[1]).text()==""?"(Blank)":n(n(u).find("Axis:eq(0) Tuple:eq("+f+")").children().children()[1]).text(),l={hasChildren:n(c[f]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!0,id:o.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:a,tag:o},e.push(l);t.isNullOrUndefined(pschemaDesignerWaitingPopup)||(s=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(s)||(s._isTimeOut=!1),pschemaDesignerWaitingPopup.hide());!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.enableMemberEditorPaging?(this.model.pivotControl._editorTreeData=e,this.model.pivotControl._editorTreeData.splice(0,1),this._memberCount=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i)).length,this.model.pivotControl._currentReportItems.push({filterItems:this.model.pivotControl._editorTreeData,fieldName:this._selectedFieldName,dataSrc:this.model.pivotControl.model.dataSource,pageSettings:this._memberCount}),h=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize)),h.splice(0,0,{id:"All",name:"All",checkedStatus:this.model.pivotControl._isAllMemberChecked,tag:""}),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(h)})):this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(e)})},_generateChildMembers:function(t,i){for(var e=n(i).find("Axis:eq(0) Tuple"),f=[],r=this.element.find("[tag='"+t.currentNode.replace(/&/g,"&")+"']"),u=0;u<e.length;u++){var o=n(n(i).find("Axis:eq(0) Tuple:eq("+u+")").children().children()[0]).text(),s=n(n(i).find("Axis:eq(0) Tuple:eq("+u+")").children()).find("Caption").text(),h={hasChildren:n(e[u]).find("CHILDREN_CARDINALITY").text()!="0",checkedStatus:!1,id:o.replace(/\]*\]/g,"-").replace(/\[*\[/g,"-"),name:s,tag:o};f.push(h)}parentNode=n(r).parents("li").length>1?n(r).parents("li").first():n(r).parents("li");r.find(".e-load").removeClass("e-load");n(n(parentNode).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});n.each(r.find("li"),function(n,t){t.setAttribute("tag",f[n].tag)});this._memberTreeObj=n(".editorTreeView").data("ejTreeView");this._memberTreeObj.addNode(f,n(r))},_sortField:function(i){if(t.Pivot.closePreventPanel(this),this.element.find(".e-dialog, .clientDialog").remove(),n(i.element).attr("id")=="descOrder"||n(i.element).attr("id")=="ascOrder"){var r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource).item;t.isNullOrUndefined(r)||(r.sortOrder=n(i.element).attr("id")=="descOrder"?t.olap.SortOrder.Descending:t.olap.SortOrder.Ascending);this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.model.pivotControl.refreshControl():(t.olap.base._clearDrilledCellSet(),t.olap.base.getJSONData({action:"sorting"},this.model.pivotControl.model.dataSource,this.model.pivotControl))}},_clientOnFilterBtnClick:function(r){var u,e;if(t.Pivot.openPreventPanel(this),schemaObj=this,u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(u)?this._waitingPopup.show():(u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&schemaObj._waitingPopup.show()},800)),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){if(n(r.target).parents().hasClass("pivotButton")&&n(r.target).parents(".pivotButton").attr("tag").indexOf(":[")>=0&&!(n(r.target).parents(".pivotButton").attr("tag").toLowerCase().indexOf("[measures]")>=0))this._selectedFieldName=n(r.target).parents(".pivotButton").attr("tag").split(":")[1];else{if(n(r.target).parents().attr("tag")!=null&&(n(r.target).parents().attr("tag").split(":")[1]=="Measures"||n(r.target).parent().attr("tag").toLowerCase().indexOf("[measures]")>=0))return t.Pivot.closePreventPanel(this),t.isNullOrUndefined(u)||(u._isTimeOut=!1),!1;this._selectedLevel=n(n(r.target).parents("li:eq(0)")).attr("tag");this._selectedFieldName=n(r.target).parents("li:eq(0)").children("div:eq(0)").find(".levels").length>0?n(n(r.target).parents("li:eq(1)")).attr("tag"):n(n(r.target).parents("li:eq(0)")).attr("tag")}if(t.isNullOrUndefined(this._selectedFieldName)||this._selectedFieldName.toLocaleLowerCase().indexOf("measures")>=0)return!1;var h=this._selectedFieldName,s=this.model.pivotControl.model.dataSource,o,f=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName==h&&(t.isNullOrUndefined(n.dataSrc)||n.dataSrc.cube==s.cube&&n.dataSrc.reportName==s.reportName))return o=n.pageSettings,n.filterItems});this.model.pivotControl.model.enableMemberEditorPaging&&(o&&(this._memberCount=o),this.model.pivotControl._memberPageSettings.endPage=this.model.pivotControl.model.memberEditorPageSize,this.model.pivotControl._memberPageSettings.startPage=0,this.model.pivotControl._memberPageSettings.currentMemeberPage=1);f.length>0?(this.model.pivotControl.model.enableMemberEditorPaging&&(this.model.pivotControl._editorTreeData=f,this._memberCount=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i)).length,f=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize)),f.splice(0,0,{id:"All",name:"All",checkedStatus:this.model.pivotControl._isAllMemberChecked,tag:""})),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(f)})):t.olap._mdxParser.getMembers(this.model.pivotControl.model.dataSource,this._selectedFieldName,this)}else this._selectedFieldName=n(r.target).parent().hasClass("pivotButton")&&n(r.target).parent().attr("tag").indexOf(":")>=0?n.grep(this.model.pivotTableFields,function(t){return t.name==n(r.target).parent().attr("tag").split(":")[1]})[0].name:n.grep(this.model.pivotTableFields,function(t){return t.id==n(n(r.target).closest("li")).attr("id")})[0].name;e=n(this.element.find(".pivotButton button[fieldname='"+this._selectedFieldName+"']"));this._dialogHead=this._selectedFieldCaption=e.attr("fieldCaption");this._selectedFieldAxis=e.parents().hasClass("schemaRow")?"rows":e.parents().hasClass("schemaColumn")?"columns":e.parents().hasClass("schemaValue")?"values":"filters";this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(this._getTreeViewData())})},_getTreeViewData:function(){var s=this.model.pivotControl.model.dataSource[this._selectedFieldAxis],o=this._selectedFieldName,f=n.grep(s,function(n){return n.fieldName==o})[0],u=t.PivotAnalysis.getMembers(o,this.model.pivotControl.model.dataSource.data),e=[{id:"All",name:"All",checkedStatus:!0}],r;if(f.filterItems!=null&&f.filterItems!=i)for(r=0;r<u.length;r++)e.push({id:u[r],name:u[r],checkedStatus:f.filterItems.filterType==t.PivotAnalysis.FilterType.Include?n.inArray(u[r].toString(),f.filterItems.values)>=0:n.inArray(u[r].toString(),f.filterItems.values)<0});else for(r=0;r<u.length;r++)e.push({id:u[r],name:u[r],checkedStatus:!0});return e},_filterBtnClick:function(i){var s,e,h,v,l,y,c,u,r,o,f,a,p;if(this.model.pivotControl._editorFlag=!1,t.Pivot.openPreventPanel(this),schemaObj=this,s=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){for(this.model.pivotControl._dataModel=="XMLA"?n(i.target).parents("li:eq(0)").length>0?(this._selectedLevel=n(n(i.target).parents("li:eq(0)")).attr("tag"),e=n(i.target).parents("li:eq(0)").children("div:eq(0)").find(".levels").length>0?n(n(i.target).parents("li:eq(1)")).attr("tag"):n(n(i.target).parents("li:eq(0)")).attr("tag")):(this._selectedLevel=n(i.target).parent().attr("tag").split(":")[1],e=n(i.target).parent().attr("tag").split(":")[1]):e=n.grep(this.model.pivotTableFields,function(t){return t.caption==n(n(i.target).parent()).text()})[0].name,r=0;r<this.element.find(".pivotButton").length;r++)if(uniqueName=n(this.element.find(".pivotButton")[r]).find("button").attr("fieldName"),uniqueName==e){h=n(this.element.find(".pivotButton")[r]).find("button").text();this._selectedAxis=n(this.element.find(".pivotButton")[r]).parent()[0].className.split(" ")[0];break}this._selectedAxis=this.model.pivotControl._selectedAxis=this._selectedAxis=="schemaRow"?"rows":this._selectedAxis=="schemaColumn"?"columns":this._selectedAxis=="schemaValue"?"values":"filters";this._dialogTitle=this.model.pivotControl._dialogTitle=h;this._dialogHead=this.model.pivotControl._dialogHead=h;this._selectedMember=this.model.pivotControl._selectedField=e;this.model.pivotControl._dataModel=="XMLA"?(v=n(i.target).parents("li:eq(0)").length>0?n(i.currentTarget).parents("li:eq(0)").attr("tag"):n(i.target).parent().attr("tag").split(":")[1],l=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName==v)return n.filterItems}),l.length>0?this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(l)}):this._selectedMember=e):(y=this.model.pivotControl._getTreeViewData(e,h,this._selectedAxis),this._fetchMemberSuccess({EditorTreeInfo:JSON.stringify(y)}))}else{if(n(this._tableTreeObj.element).find("span.e-icon.treeDrop").css({display:"none"}),this._dataModel=="Olap"){if(n(i.target).attr("class").indexOf("filter")>-1){for(r=0;r<this.model.pivotTableFields.length;r++)(this.model.pivotTableFields[r].tag.replace(/\[/g,"").replace(/\]/g,"").indexOf("Measures")>-1&&this.model.pivotTableFields[r].isSelected==!0||this.model.pivotTableFields[r].isSelected==!0&&n(i.target.parentElement).attr("tag").split(":")[1]==this.model.pivotTableFields[r].tag.replace(/\[/g,"").replace(/\]/g,""))&&(c=this.model.pivotTableFields[r].spriteCssClass);for(o=0;o<this._tableTreeObj.element.find("li").length;o++)n(n(i.target).parent()).attr("tag").split(":")[1]==n(this._tableTreeObj.element.find("li")[o]).attr("tag").replace(/\]/g,"").replace(/\[/g,"")&&(u=n(this._tableTreeObj.element.find("li")[o]))}else c=n(i.target).parent().find("a>span").attr("class");n(i.target).attr("class").indexOf("filter")>-1||(u=c.indexOf("hierarchyCDB")>-1||c.indexOf("attributeCDB")>-1?n(i.target).parents("li")[0]:n(i.target).parents("li")[1])}else u=n(i.target).attr("class").indexOf("filter")>-1?this._tableTreeObj.element.find("li:contains('"+n(n(i.target).parent()).attr("tag").split(":")[1]+"')"):n(n(i.target).parent()).parent();if(this._selectedTreeNode=u,i.target.tagName.toLowerCase()=="span"||i.target.tagName.toLowerCase()=="button"){if(this._curFilteredText=this.model.layout!="excel"&&n(i.target).attr("class").indexOf("filter")>-1?n(n(i.target).parents(".pivotButton")).attr("tag").split(":")[1].replace(/\]/g,"").replace(/\[/g,""):this._dataModel=="Olap"?n(u).attr("tag").replace(/\]/g,"").replace(/\[/g,""):n(u).attr("id"),n(this.element).parents(".e-pivotclient").length>0&&(this._curFilteredText=n(n(i.target).parents(".pivotButton")).attr("tag").split(":")[1].replace(/\]/g,"").replace(/\[/g,"")),n(i.target).parents("li:eq(1)").find("div:first>a>span").hasClass("hierarchyCDB")&&(this._curFilteredText=n(i.target).parents("li:eq(1)").find("div:first>a").text()),this._dataModel=="Pivot"&&(n(this.element).parents(".e-pivotclient").length>0?(this._curFilteredAxis=n(u)[0].className.split(" ")[0],this.model.pivotControl._curFilteredText=this._curFilteredText):this._curFilteredAxis=t.isNullOrUndefined(this.element.find(".e-btn:contains('"+(n(this.element).parents(".e-pivotclient").length>0?n(u).text():n(u).find("div:first").text())+"')").parents(".e-droppable")[0])?"":this.element.find(".e-btn:contains('"+n(u).find("div:first").text()+"')").parents(".e-droppable")[0].className.split(" ")[0],this._dialogHead=n(i.target).attr("fieldcaption")||this._curFilteredText),this._dialogTitle=this._dataModel=="Olap"?n(this.element.find(".pivotButton:contains('"+n(u).find("div:first").text()+"')")[0]).attr("tag"):n(i.target).parents("li").length>0?n(i.target).parents("li").attr("id")||i.target.id.replace("filterBtn","")||n(i.target).parents(".filterBtn")[0].id.replace("filterBtn",""):n(i.target).parent().attr("tag").split(":")[1]||i.target.id.replace("filterBtn","")||n(i.target).parents(".filterBtn")[0].id.replace("filterBtn",""),n(this.element).parents(".e-pivotclient").length>0&&n(u)[0].className.split(" ")[0]=="schemaFilter"&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(this._dialogTitle=this._dialogHead),this._dataModel=="Olap")for(f=0;f<this.element.find(".e-btn").length;f++)if(!t.isNullOrUndefined(n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag"))&&n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag").split(":")[1]==n(this._selectedTreeNode).attr("tag").replace(/\]/g,"").replace(/\[/g,"")&&n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag").indexOf(this._curFilteredText)>-1){this._curFilteredAxis=t.isNullOrUndefined(n(n(this.element.find(".e-btn"))[0]).parents(".e-droppable")[0])?"":n(n(this.element.find(".e-btn"))[0]).parents(".e-droppable")[0].className.split(" ")[0];this._dialogTitle=n(n(n(this.element.find(".e-btn"))[f]).parent()[0]).attr("tag");this._dialogHead=n(n(n(this.element.find(".e-btn"))[f])[0]).attr("fieldCaption");break}try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(w){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(a=this.model.pivotControl.getOlapReport())}sortedHeaders=this._getSortedHeaders();this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.pivotControl.model.customObject});p=JSON.stringify({action:"fetchMembers",headerTag:this._dialogTitle+(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.enableAdvancedFilter?"##true":"")||"UniqueName##"+n(u).attr("tag"),sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});t.isNullOrUndefined(s)?this.model.pivotControl._waitingPopup.show():(s._isTimeOut=!0,setTimeout(function(){s._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.fetchMembers,p,this._fetchMemberSuccess)}}},_removeBtnClick:function(i){var r,s,e,l,h,u,f,c,o;if(schemaObj=this,r=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(r)?this.model.pivotControl._waitingPopup.show():(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800)),this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode)t.PivotAnalysis._valueSorting=null,s=n(i.target).parent().attr("tag").split(":")[1],t.Pivot.removeReportItem(this.model.pivotControl.model.dataSource,s,s.toLocaleLowerCase().indexOf("measures")==0),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.pivotControl._fieldMembers={},this.model.pivotControl._fieldSelectedMembers={},t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl)),this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl._pivotChart&&(this.model.pivotControl._pivotChart._labelCurrentTags={}),this._refreshPivotButtons(),this.model.pivotControl.refreshControl(),n(i.target).parent().remove();else{for(e=n(i.target.parentElement).find("button").attr("fieldcaption")||n(i.target.parentElement).text(),h=n(n(this._tableTreeObj.element).find("div:contains("+e+")>span")[1]).find(".e-chk-act"),n(h).removeClass("e-chk-act").addClass("e-chk-inact"),n(h).children("e-checkmark").removeClass("e-checkmark"),u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].FieldHeader==e&&(this.model.pivotTableFields[u].IsSelected=!1,l=this.model.pivotTableFields[u]);if(n(i.target.parentElement).remove(),n(this.element).parents(".e-pivotclient").length>0&&(f=n(i.target).parent().attr("tag"),delete this.model.pivotControl._fieldMembers[f.split(":")[f.split(":").length-1]],delete this.model.pivotControl._fieldSelectedMembers[f.split(":")[f.split(":").length-1]]),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject}),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&n(this.element).parents(".e-pivotclient").length>0){try{c=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(a){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(c=this.model.pivotControl.getOlapReport())}o=JSON.stringify({action:"removeButton",args:JSON.stringify({headerTag:e,currentReport:c,sortedHeaders:t.isNullOrUndefined(this.model.pivotControl._ascdes)?"":this.model.pivotControl._ascdes}),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,o,this._droppedSuccess)}else o=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(l),sortedHeaders:this._getSortedHeaders(),currentReport:this.model.pivotControl.getOlapReport(),customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,o,this._nodeStateModifiedSuccess)}t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||t.isNullOrUndefined(r)||(r._isTimeOut=!1)},_nodeCheckChanges:function(r){var s,u,h,f,e,o;if(this._isFiltered=!0,(r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()=="all")&&r.type=="nodeUncheck"){if(this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("unCheckAll"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.disable(),this.model.pivotControl&&this.model.pivotControl.model.enableMemberEditorPaging)for(this.element.find(".dialogOKBtn").attr("disabled","disabled"),this.model.pivotControl._isAllMemberChecked=!1,f=0;f<this.model.pivotControl._editorTreeData.length;f++)this.model.pivotControl._editorTreeData[f].checkedStatus=!1}else if((r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()=="all")&&r.type=="nodeCheck"){if(this._memberTreeObj.model.nodeCheck="",this._memberTreeObj.model.nodeUncheck="",this.element.find(".editorTreeView").ejTreeView("checkAll"),n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop"),this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this),this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this),this._dialogOKBtnObj.enable(),this.model.pivotControl&&this.model.pivotControl.model.enableMemberEditorPaging)for(this.element.find(".dialogOKBtn").removeAttr("disabled"),this.model.pivotControl._isAllMemberChecked=!0,f=0;f<this.model.pivotControl._editorTreeData.length;f++)this.model.pivotControl._editorTreeData[f].checkedStatus=!0}else if((r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()!="all")&&!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.enableMemberEditorPaging){if(r.type=="nodeUncheck")this.model.pivotControl._isMembersFiltered=!0,u="",u=n(r.currentElement).parent().parent().hasClass("editorTreeView")&&!this.model.pivotControl._isSearchApplied?t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize).where("id","equal",r.currentElement.attr("id")))[0]:t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("id","equal",r.currentElement.attr("id")))[0],t.isNullOrUndefined(u)||(u.checkedStatus=!1,t.isNullOrUndefined(u.pid)||(s=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",u.pid).where("checkedStatus","equal",!0)),t.isNullOrUndefined(s)||s.length!=0||t.Pivot._unSelectParentTreeNode(u,this.model.pivotControl)),s=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",u.id)),!t.isNullOrUndefined(s)&&s.length>0&&t.Pivot._unSelectChildTreeNode(u,this.model.pivotControl)),u=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).where("checkedStatus","equal",!0)),o=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),t.isNullOrUndefined(u)||u.length!=0?n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop").addClass("e-checkmark"):(this._dialogOKBtnObj.disable(),this.element.find(".dialogOKBtn").attr("disabled","disabled"),this.model.pivotControl._isAllMemberChecked=!1,o.removeClass("e-stop").removeClass("e-checkmark").addClass("e-chk-inact"));else if(r.type=="nodeCheck"){if(this.model.pivotControl._isMembersFiltered=!0,u="",u=n(r.currentElement).parent().parent().hasClass("editorTreeView")&&!this.model.pivotControl._isSearchApplied?t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().page(this.model.pivotControl._memberPageSettings.currentMemeberPage,this.model.pivotControl.model.memberEditorPageSize).where("id","equal",r.currentElement.attr("id")))[0]:t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("id","equal",r.currentElement.attr("id")))[0],!t.isNullOrUndefined(u)&&(u.checkedStatus=!0,t.isNullOrUndefined(u.pid)||t.Pivot._selectParentTreeNode(u,this.model.pivotControl),!t.isNullOrUndefined(u.id)&&(h=t.DataManager(this.model.pivotControl._editorTreeData).executeLocal(t.Query().where("pid","equal",u.id)),!t.isNullOrUndefined(h)&&h.length>0)))for(f=0;f<h.length;f++)h[f].checkedStatus=!0,t.Pivot._selectChildTreeNode(h[f],this.model.pivotControl);this.element.find(".dialogOKBtn").data("ejButton").enable();this.element.find(".dialogOKBtn").removeAttr("disabled");this.model.pivotControl._isAllMemberChecked=!0;n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)").removeClass("e-stop").addClass("e-checkmark")}}else(r.id.toLowerCase()=="(all)_0"||r.id.toLowerCase()!="all")&&(e=this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),o=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),e.length==0||e.length==1&&e[0].id[e[0].id.length-1]==0?(n(o).parent().removeClass("e-chk-inact").removeClass("e-chk-ind").addClass("e-chk-act"),o.removeClass("e-stop").addClass("e-checkmark")):r.type=="nodeCheck"&&e.length==1&&e[0].id[e[0].id.length-1]==0?o.removeClass("e-stop").addClass("e-checkmark"):e.length>0&&o.removeClass("e-checkmark").addClass("e-stop"),this._dialogOKBtnObj.enable(),r.type=="nodeUncheck"&&e.length+1==this._memberTreeObj.element.find("li").length&&(o.removeClass("e-checkmark").removeClass("e-stop"),this._dialogOKBtnObj.disable()))},_pivotCheckedStateModified:function(r){var f,p,a,w,v,u;if(this._nodeCheck==!0)return this._nodeCheck=!1,!1;if(this._isDropAction)return!1;t.PivotAnalysis._valueSorting=null;var e=this.model.pivotControl._dataModel=="XMLA"?n(r.currentElement).attr("tag"):this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?n.grep(this.model.pivotTableFields,function(t){return t.caption==n(r.currentElement).find("a")[0].textContent})[0].name:n(r.currentElement).find("a")[0].textContent,s=n(r.currentElement).find("a")[0].textContent,h="",c="",y="",l="",o=this.model.pivotControl._dataModel=="XMLA"?"XMLA":"",h=[];for(u=0;u<this.element.find(".pivotButton").length;u++)if(y=n(this.element.find(".pivotButton")[u]).find("button").attr("fieldName"),y==e&&(h.push(this.element.find(".pivotButton")[u]),o=="XMLA"))break;for(u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].name==e&&r.type=="nodeCheck"?(this.model.pivotTableFields[u].isSelected=!0,c=this.model.pivotTableFields[u]):this.model.pivotTableFields[u].name==e&&r.type=="nodeUncheck"&&(this.model.pivotTableFields[u].isSelected=!1,c=this.model.pivotTableFields[u]);if(r.type=="nodeUncheck")if(h.length>1)for(u=0;u<h.length;u++)n(h[u]).find("button").attr("fieldName")==e&&n(h[u]).remove();else n(h).remove();try{l=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(b){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(l=this.model.pivotControl.getOlapReport())}if(o=="XMLA"&&l==""&&(l=this.model.pivotControl.model.dataSource,this._selectedMember=e,this._selectedTreeNode=n(r.currentElement),this.model.pivotControl.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeStateModefied"})),f=this._droppedClass!=""?this._droppedClass:c.pivotType!=i?c.pivotType=="PivotItem"?"schemaRow":"schemaValue":"schemaRow",this._droppedClass="",r.type=="nodeCheck"){if(o=="XMLA"?(s=n(r.currentElement).find(".kpi").length>0?n(r.currentElement).parents("li:eq(0)").children("div").text()+" "+s:s,p=this.model.pivotControl.model.dataSource.enableAdvancedFilter?n(r.currentElement.find(".e-text")):n(r.currentElement.find(".e-text")[0]),n(r.currentElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&!(n(r.currentElement).find(".namedSetCDB").length>0)?p.after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML):"",n(r.currentElement).attr("tag").toLocaleLowerCase().indexOf("[measures]")>=0&&(f="schemaValue"),droppedItem=n(r.currentElement).find(".namedSetCDB").length>0?{fieldName:n(r.currentElement).attr("tag"),fieldCaption:n(r.currentElement).text(),isNamedSets:!0}:t.olap.base._getCaption({fieldName:e,fieldCaption:s},this.model.pivotControl._fieldData.hierarchy)):(n(r.currentElement.find(".e-text")[0]).after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML),droppedItem={fieldName:e,fieldCaption:s}),f=f==""?"row":f=="schemaColumn"?"column":f=="schemaRow"?"row":f=="schemaValue"?"value":f=="schemaFilter"?"filter":"",this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(a=n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e}),a.length>0)){if(this._calculatedFieldItems(a))return;f="value";droppedItem={fieldName:e,fieldCaption:s,isCalculatedField:!0,formula:a[0].formula}}this._createPivotButton(droppedItem,f,"","","");o=="XMLA"&&f=="value"?(this.model.pivotControl.model.dataSource.values.length==0&&this.model.pivotControl.model.dataSource.values.push({measures:[],axis:"columns"}),measuresAxis=this.model.pivotControl.model.dataSource.values[0].axis=="columns"?"Columns:":"Rows:",this.element.find("div[tag='"+measuresAxis+"Measures']").length==0&&this._createPivotButton({fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")},measuresAxis=="Columns:"?"column":"row","","",""),this.model.pivotControl.model.dataSource.values[0].measures.push(droppedItem)):n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.fieldName==droppedItem.fieldName}).length==0&&(f=="row"?this.model.pivotControl.model.dataSource.rows.push(droppedItem):f=="column"?this.model.pivotControl.model.dataSource.columns.push(droppedItem):f=="filter"?this.model.pivotControl.model.dataSource.filters.push(droppedItem):this.model.pivotControl.model.dataSource.values.push(droppedItem));o=="XMLA"?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.show(),t.olap.base.getJSONData({action:"nodeCheck"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(this._trigger("fieldItemDropped",{axis:f,fieldItem:r.currentElement}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}else if(r.type=="nodeUncheck"){if(n(r.currentElement).removeClass("filter").find(".filter").remove(),n(r.currentElement).removeClass("filter").find(".treeDrop").remove(),this.model.pivotControl.model.dataSource.columns=n.grep(this.model.pivotControl.model.dataSource.columns,function(n){return n.fieldName!=e}),this.model.pivotControl.model.dataSource.rows=n.grep(this.model.pivotControl.model.dataSource.rows,function(n){return n.fieldName!=e}),w=this.model.pivotControl.model.dataSource.values,o=="XMLA")t.olap._mdxParser._getItemPosition(this.model.pivotControl.model.dataSource.values[0].measures,e).length>0&&this.model.pivotControl.model.dataSource.values[0].measures.splice(t.olap._mdxParser._getItemPosition(this.model.pivotControl.model.dataSource.values[0].measures,e)[0],1),this.model.pivotControl.model.dataSource.values[0].measures.length==0&&this.element.find("div[tag='"+(this.model.pivotControl.model.dataSource.values[0].axis=="columns"?"Columns":"Rows")+":Measures']").remove();else if(this.model.pivotControl.model.dataSource.values=n.grep(w,function(n){return n.fieldName!=e}),this.model.pivotControl._calculatedField.length>0)for(v=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(e)>-1}),u=0;u<v.length;u++)this._tableTreeObj.uncheckNode(v[u].fieldName);this.model.pivotControl.model.dataSource.filters=n.grep(this.model.pivotControl.model.dataSource.filters,function(n){return n.fieldName!=e});o=="XMLA"?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.show(),t.olap.base.getJSONData({action:"nodeUncheck"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(f=f==""?"row":f=="schemaColumn"?"column":f=="schemaRow"?"row":f=="schemaValue"?"value":f=="schemaFilter"?"filter":"",this._trigger("fieldItemDropped",{axis:f,fieldItem:r.currentElement}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}this._setPivotBtnWidth()},_calculatedFieldItems:function(i){var u,r;if(i.length>0)for(u=i[0].formula.replace(/\(|\)/g," ").replace(/[-+*/^%]/g," ").split(" "),r=0;r<u.length;r++)if(!n.isNumeric(u[r])&&u[r].replace(/\s+|\s+$/gm,"")!=""&&(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.fieldName==u[r]}).length==0||this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.FieldName==u[r]}).length==0))return alert(this.model.pivotControl._getLocalizedLabels("NotPresent")),this._tableTreeObj.model.nodeCheck=null,this._tableTreeObj.model.nodeUncheck=null,this._tableTreeObj.uncheckNode(i[0].name),this._tableTreeObj.model.nodeCheck=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._checkedStateModified,this):t.proxy(this._pivotCheckedStateModified,this),this._tableTreeObj.model.nodeUncheck=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?t.proxy(this._checkedStateModified,this):t.proxy(this._pivotCheckedStateModified,this),!0;return!1},_checkedStateModified:function(i){var nt,b,k,v,h,l,y,p,r,o,f,d,tt,w,u;if(this.model.pivotControl._isUpdateRequired=!0,this._isMeasureBtnRemove==!0)return this._isMeasureBtnRemove=!1,!1;if(this._nodeCheck==!0)return this._nodeCheck=!1,!1;var e=n(i.currentElement).find("a")[0].textContent,a="",g="",s="",r="",c="";if(this._dataModel!="Pivot"||i.type!="nodeCheck"||(nt=n.grep(this.model.pivotControl._calculatedField,function(t){return t.name==n(i.currentElement).attr("id")}),!this._calculatedFieldItems(nt))){if(this._dataModel=="Olap")if(!i.currentElement[0].id.indexOf("[Measures]")>-1){for(u=0;u<this.element.find(".pivotButton").length;u++)if(r=n(this.element.find(".pivotButton")[u]).attr("tag"),c="",c=r.indexOf("[Measures]")>-1||r.indexOf("[")>-1?r.split(":")[1]:this.model.pivotControl._getNodeUniqueName(r),c=c.replace("<>","."),n(i.currentElement).attr("tag").toLowerCase()==c.toLowerCase()){s=n(this.element.find(".pivotButton")[u]);break}}else s=this.element.find(".pivotButton:contains("+e+")"),r,o;else s=this.element.find(".pivotButton:contains("+e+")"),r,o;for(b=s.length>0&&n(s).siblings(".filterIndicator").length>0?!0:!1,k=i.currentElement.find("~ span:eq(0) span.descending").length>0?!0:!1,u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].name==e&&i.type=="nodeCheck"?(this.model.pivotTableFields[u].isSelected=!0,r=this.model.pivotTableFields[u]):this.model.pivotTableFields[u].name==e&&i.type=="nodeUncheck"&&(this.model.pivotTableFields[u].isSelected=!1,r=this.model.pivotTableFields[u]);if(t.isNullOrUndefined(r)&&(r=n(i.currentElement).attr("tag")),i.type=="nodeUncheck")if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this._clearFilterData(e),s.length>1)for(u=0;u<s.length;u++)n(s[u]).text()==e&&n(s[u]).remove();else n(s).remove();else this._droppedClass!=""?this._createPivotButton({fieldName:r.id,fieldCaption:e},this._droppedClass=="schemaColumn"?"column":this._droppedClass=="schemaRow"?"row":this._droppedClass=="schemaValue"?"value":this._droppedClass=="schemaFilter"?"filter":"",b,k,""):this._createPivotButton({fieldName:r.id,fieldCaption:e},this._dataModel=="Olap"&&n(i.currentElement).attr("tag").indexOf("[Measures]")<0||this._dataModel=="Pivot"&&r.pivotType=="PivotItem"?"row":"value",b,k,"");if(!t.isNullOrUndefined(this._tempFilterData))for(u=0;u<this._tempFilterData.length;u++)if(!t.isNullOrUndefined(this._tempFilterData[u][e]))for(v=0;v<this._tempFilterData[u][e].length;v++)g+="##"+this._tempFilterData[u][e][v];try{o=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(it){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(o=this.model.pivotControl.getOlapReport())}if(a="schemaRow::"+e+"::FILTERED"+g,h=this._droppedClass!=""?this._droppedClass:r.pivotType=="PivotItem"?"schemaRow":"schemaValue",this._droppedClass="",t.isNullOrUndefined(this.model.pivotControl)||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left}),i.type=="nodeCheck"||i.type=="nodeUncheck"||h==""){if(i.type=="nodeCheck")this._dataModel=="Olap"?(n(i.currentElement).attr("tag").indexOf("[Measures]")==-1&&(p=t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filter button").addClass("treeDrop")[0].outerHTML,n(i.currentElement.find(".e-text")[0]).after(n(p).hide())),this._nodeDropedParams=h=="schemaColumn"?"Categorical":h=="schemaRow"?"Series":h=="schemaFilter"?"Slicer":"",r=n(i.currentElement).attr("tag"),l=this._nodeDropedParams==""?n(i.currentElement).attr("tag").indexOf("[Measures]")>=0?"Categorical":"Series":this._nodeDropedParams,r.toLowerCase().indexOf("[measures]")>-1&&(l="Categorical"),y=this._currentCubeName+"--"+r+"--"+l+"--",o,this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:y,currentReport:o,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f,this._droppedSuccess)):(n(i.currentElement.find(".e-text")[0]).after(n(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filter button").addClass("treeDrop")[0].outerHTML).hide()),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:h+"::",sortedHeaders:this.model.pivotControl._ascdes,filterParams:a,currentReport:o,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess),t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f,this._nodeStateModifiedSuccess));else if(i.type=="nodeUncheck")if(this._dataModel=="Olap"){if(n(i.currentElement.find(".treeDrop")).remove(),n(i.currentElement).find(".filter").removeClass("filter"),r=n(s).attr("tag"),delete this.model.pivotControl._fieldMembers[r.split(":")[r.split(":").length-1]],delete this.model.pivotControl._fieldSelectedMembers[r.split(":")[r.split(":").length-1]],this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"removeButton",headerInfo:r,currentReport:o,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),t.isNullOrUndefined(r))return!1;(r.indexOf("[Measures]")>=0||r.toLowerCase().indexOf("[measures]"))&&this.element.find(".schemaValue .pivotButton").length==0?(d=r.split(":"),tt=d[0]=="Rows"?".schemaRow":d[0]=="Columns"?".schemaColumn":"",this.element.find(tt+" .pivotButton:contains('Measures')").remove()):r.indexOf("[Measures]")<0&&r.indexOf("Measures")>=0&&this.element.find(".schemaValue .pivotButton").remove();this.model.pivotControl.model.enableDeferUpdate?(this._removeButtonDeferUpdate=!0,this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,f.replace("removeButton","removeButtonDeferUpdate"),this._droppedSuccess)):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,f,this._pvtBtnDroppedSuccess)}else{if(this._clearFilterData(e),this.model.pivotControl._calculatedField.length>0)for(w=n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.CalculationType==8&&n.Formula.indexOf(r.id)>-1}),u=0;u<w.length;u++)this._tableTreeObj.model.nodeUncheck=null,this._tableTreeObj.uncheckNode(w[u].FieldName),this._tableTreeObj.element.find("li[id='"+w[u].FieldName+"']").removeClass("filter").find(".treeDrop").remove(),this._tableTreeObj.model.nodeUncheck=t.proxy(this._checkedStateModified,this);delete this.model.pivotControl._fieldMembers[r.name];n(i.currentElement).removeClass("filter").find(".filter").remove();n(i.currentElement).removeClass("filter").find(".treeDrop").remove();this.model.pivotControl._ascdes=this.model.pivotControl._ascdes.replace(e+"##","");this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject});f=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:h+"::",sortedHeaders:this.model.pivotControl._ascdes,filterParams:a,currentReport:o,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f,this._nodeStateModifiedSuccess)}}else this._dataModel=="Pivote"?(this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeStateModified",headerTag:JSON.stringify(r),dropAxis:h+"::"+this._droppedPosition,sortedHeaders:this.model.pivotControl._ascdes,filterParams:a,currentReport:o,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this._droppedPosition="",this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f.replace("nodeStateModified","nodeStateModifiedDeferUpdate"),this._nodeStateModifiedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeStateModified,f,this._nodeStateModifiedSuccess)):(n(i.currentElement).attr("tag").toLowerCase().indexOf("[measures]")==-1&&(p=t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filter button").addClass("treeDrop")[0].outerHTML,n(i.currentElement.find(".e-text")[0]).after(n(p).hide())),r=n(i.currentElement).attr("tag"),l=this._nodeDropedParams==""?n(i.currentElement).attr("tag").toLowerCase().indexOf("[Measures]")>=0?"Categorical":"Series":this._nodeDropedParams,y=this._currentCubeName+"--"+r+"--"+l+"--",o,this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),f=JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:y,currentReport:o,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,f,this._droppedSuccess));this._setPivotBtnWidth()}},_clearFilterData:function(n){var i,r;if(!t.isNullOrUndefined(this._tempFilterData))for(i=0;i<this._tempFilterData.length;i++)for(r in this._tempFilterData[i])r==n&&this._tempFilterData[i][n]!=""&&this._tempFilterData.splice(i,1);this.model.pivotControl._tempFilterData=this._tempFilterData},_nodeDropped:function(r){var b,it,nt,et,ot,st,rt,k,ht,tt,u,o,d,l,p,w,h,y,ct,g,a;if(n(r.dropTarget).hasClass("pvtBtn")&&(r.dropTarget=n(r.dropTarget).parents("div.e-droppable").length>0&&n(r.dropTarget).parents(".e-pivotschemadesigner").length>0?n(r.dropTarget).parents("div.e-droppable"):r.dropTarget),n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot){var s="",f=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.pivotControl._dataModel!="XMLA"?n.grep(this.model.pivotTableFields,function(n){return n.caption==r.droppedElement.text()})[0].name:this._dataModel=="XMLA"?r.droppedElement.attr("tag"):r.droppedElement.text(),lt=n(r.droppedElement).attr("id"),ut=r.dropTarget.hasClass("schemaColumn")?"schemaColumn":r.dropTarget.hasClass("schemaRow")?"schemaRow":r.dropTarget.hasClass("schemaFilter")?"schemaFilter":r.dropTarget.hasClass("schemaValue")?"schemaValue":"";if(ut=="")return!1;h=this._setSplitBtnTargetPos(t.isNullOrUndefined(r.event)?r:r.event);try{v=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(vt){v=this.model.pivotControl.getOlapReport()}for(t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),u=0;u<this.model.pivotTableFields.length;u++)if(this.model.pivotTableFields[u].name==f){this.model.pivotTableFields[u].isSelected=!0;s=this.model.pivotTableFields[u];break}a=JSON.stringify({action:this.model.pivotControl.model.enableDeferUpdate?"nodeDroppedDeferUpdate":"nodeDropped",args:JSON.stringify({droppedFieldCaption:f,droppedFieldName:lt,headerTag:s,dropAxis:ut,droppedPosition:h,currentReport:v}),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a,this._pvtNodeDroppedSuccess);this._isDragging=!1;return}if(this.model.pivotControl._isUpdateRequired=!0,r.dropTarget[0]!=i||r.dropTarget.className!=i){if(b=!1,this._dataModel=="Pivot")for(it=n(r.dropTarget).parents(),u=0;u<it.length;u++)n(it[u]).hasClass("e-pivotgrid")&&(b=!0);if(r.dropTarget.hasClass("e-droppable")||r.dropTarget[0]!=i&&r.dropTarget[0].className.indexOf("e-droppable")>=0||r.dropTarget.className!=i&&r.dropTarget.className.indexOf("e-droppable")>=0||b){this._isDragging=!1;this.element.find(".dropIndicator").removeClass("dropIndicatorHover");var s=n(r.droppedElement).attr("tag"),f=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this.model.pivotControl._dataModel!="XMLA"?n.grep(this.model.pivotTableFields,function(n){return n.caption==r.droppedElement.text()})[0].name:this._dataModel=="XMLA"?r.droppedElement.attr("tag"):r.droppedElement.text(),at="",v,c=this.element.find(".pivotButton:contains("+f+")"),e=this._dataModel=="XMLA"?this._tableTreeObj.element.find("li[tag='"+s+"']").length>1?r.droppedElement:this._tableTreeObj.element.find("li[tag='"+s+"']"):this._dataModel=="Pivot"&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?this._tableTreeObj.element.find("li[id="+f+"]"):this._dataModel=="Pivot"?this._tableTreeObj.element.find("li:contains('"+f+"'):last"):this._tableTreeObj.element.find("li[tag='"+s+"']"),y=n(c).find(".filterIndicator").length>0?!0:!1,ft=n(c).find("~ span:eq(0) span.descending").length>0?!0:!1;if(r.dropTarget.parent().attr("role")=="presentation")return!1;if(this.model.pivotControl._dataModel=="XMLA"){if(nt=n.map(n(s.split("].")),function(n){return n.lastIndexOf("]")>=0?n:n+"]"}),nt.length>=2&&(et=nt[0]+"."+nt[1],e=this._tableTreeObj.element.find("li[tag='"+et+"']"),s=e.attr("tag")),ot=n(r.dropTarget).hasClass("value")||n(r.dropTarget).hasClass("colheader")||n(r.dropTarget).hasClass("rowheader")||n(r.dropTarget).hasClass("summary")||n(r.dropTarget).parents("table:eq(0)").hasClass("pivotGridTable")||n(r.dropTarget).parents(".groupingBarPivot").length>0,st=r.droppedElement.find(".namedSetCDB").length>0&&n(r.dropTarget).hasClass("schemaFilter"),ot||st||n(r.droppedElement).attr("tag").toLowerCase().indexOf("measures")>=0&&!n(r.dropTarget).hasClass("schemaValue")||n(r.droppedElement).attr("tag").indexOf("Measures")<0&&n(r.dropTarget).hasClass("schemaValue"))return this._createErrorDialog(),pschemaDesignerWaitingPopup.hide(),!1;if(rt=t.Pivot.getReportItemByFieldName(s,this.model.pivotControl.model.dataSource,this._dataModel),k=rt.axis,!(e.length>1)&&rt.item.length>0&&(k=="rows"&&r.dropTarget.hasClass("schemaRow")||k=="columns"&&r.dropTarget.hasClass("schemaColumn")||k=="values"&&n(r.dropTarget).hasClass("schemaValue")||k=="filters"&&n(r.dropTarget).hasClass("schemaFilter")))return!1;if(e.length>1&&r.droppedElement.find(".kpiValue").length>0&&(e=e.find(".kpiValue").parents("li:eq(0)")),this._tableTreeObj.isNodeChecked(e))for(u=0;u<this.element.find(".pivotButton").length;u++)this.element.find(".pivotButton:eq("+u+")").attr("tag").split(":")[1]==s?this.element.find(".pivotButton:eq("+u+")").remove():""}else if(this._dataModel=="Olap"&&(n(r.droppedElement).attr("tag").indexOf("Measures")>=0&&(n(r.dropTarget).hasClass("schemaFilter")||n(r.dropTarget).hasClass("drag"))||n(r.droppedElement).attr("tag").indexOf("Measures")<0&&n(r.dropTarget).hasClass("schemaValue")))return this._createErrorDialog(),pschemaDesignerWaitingPopup.hide(),!1;if(n(e).find(".filter").remove(),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)for(c=[],u=0;u<this.element.find(".pivotButton").length;u++)uniqueName=n(this.element.find(".pivotButton")[u]).find("button").attr("fieldName"),uniqueName==f&&c.push(this.element.find(".pivotButton")[u]);if(b)if(r.event.target.tagName=="TH"||r.event.target.tagName=="TD"||n(r.event.target).hasClass("cellValue")&&(n(r.event.target).parent("th").length>0||n(r.event.target).parent("td").length>0)){if(n(r.event.target).hasClass("cellValue")&&(n(r.event.target).parent("th").length>0?r.event.target=n(r.event.target).parent("th")[0]:n(r.event.target).parent("td").length>0&&(r.event.target=n(r.event.target).parent("td")[0])),this._droppedClass=r.event.target.className.split(" ")[0]=="rowheader"||r.event.target.className.split(" ")[0]=="grpRow"?"schemaRow":r.event.target.className.split(" ")[0]=="colheader"?"schemaColumn":n(r.event.target).hasClass("value")?"schemaValue":"",this._droppedClass=="")return}else this._droppedClass=r.event.target.className.split(" ")[0]=="rows"||r.event.target.className.split(" ")[0]=="emptyRows"?"schemaRow":r.event.target.className.split(" ")[0]=="columns"?"schemaColumn":r.event.target.className.split(" ")[0]=="values"?"schemaValue":r.event.target.className.split(" ")[0]=="drag"?"schemaFilter":"";else this._droppedClass=t.isNullOrUndefined(r.event)?r.dropTarget.hasClass("schemaColumn")?"schemaColumn":r.dropTarget.hasClass("schemaRow")?"schemaRow":r.dropTarget.hasClass("schemaFilter")?"schemaFilter":r.dropTarget.hasClass("schemaValue")?"schemaValue":"":r.event.target.className.split(" ")[0];if(this._dataModel=="Olap"&&(ht=n(r.droppedElement).children("div:eq(0)").find(".e-checkbox").length,e=ht==0?r.droppedElement.parent("ul").parent("li:eq(0)"):r.droppedElement),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._dataModel=="Pivot"&&this._droppedClass!="schemaValue"&&(n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e.attr("id")}).length>0||n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.FieldName==e.attr("id")&&n.CalculationType==8}).length>0)){this.model.pivotControl._createErrorDialog(this.model.pivotControl._getLocalizedLabels("CalcValue"),this.model.pivotControl._getLocalizedLabels("Warning"));return}if(e.find(".e-chk-inact").length>0&&this._droppedClass!=""&&(this._droppedClass=="schemaRow"||this._droppedClass=="schemaColumn"||this._droppedClass=="schemaFilter"||this._droppedClass=="schemaValue"))return this._tableTreeObj.checkNode(e),!1;if(e.find(".e-chk-inact").length>0&&this._droppedClass!=""&&(this._droppedClass=="pvtBtn"||this._droppedClass=="rowheader"||this._droppedClass=="colheader"||this._droppedClass=="value"&&n(r.droppedElement).attr("tag").indexOf("Measures")<0)&&(this._nodeCheck=!0,this._tableTreeObj.checkNode(e)),t.isNullOrUndefined(s))for(u=0;u<this.model.pivotTableFields.length;u++)this.model.pivotTableFields[u].name==f&&(this.model.pivotTableFields[u].isSelected=!0,s=this.model.pivotTableFields[u]);if(!t.isNullOrUndefined(this._tempFilterData))for(u=0;u<this._tempFilterData.length;u++)if(!t.isNullOrUndefined(this._tempFilterData[u][f]))for(tt=0;tt<this._tempFilterData[u][f].length;tt++)at+="##"+this._tempFilterData[u][f][tt];if(r.droppedElement[0].tagName.toLowerCase()=="button")if(c.length>1)for(u=0;u<c.length;u++)n(c[u]).text()==f&&n(c[u]).remove();else n(c).remove();try{v=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(vt){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(v=this.model.pivotControl.getOlapReport())}if(this.model.pivotControl._dataModel=="XMLA"&&(v=this.model.pivotControl.model.dataSource),this._dataModel=="Pivot"||this.model.pivotControl._dataModel=="XMLA"){for(f=this.model.pivotControl._dataModel=="XMLA"?s:f,h="",h=b?this._droppedPosition="":t.isNullOrUndefined(r.event)?"":this._droppedPosition=this._setSplitBtnTargetPos(r.event),u=0;u<this.model.pivotTableFields.length;u++)if(this.model.pivotTableFields[u].name==f){this.model.pivotTableFields[u].isSelected=!0;s=this.model.pivotTableFields[u];n(c).remove();break}if(e.find(".e-chk-inact").length>0&&this._droppedClass!=""&&(this._droppedClass=="schemaRow"||this._droppedClass=="schemaColumn"||this._droppedClass=="schemaFilter"||this._droppedClass=="schemaValue"))this._tableTreeObj.checkNode(e);else if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(o=this.model.pivotControl._getDroppedItem(f),o.length&&o[0].filterItems&&o[0].filterItems.values&&o[0].filterItems.values.length&&n(n(e).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),o.length||(o[0]={fieldName:f,fieldCaption:this._dataModel=="XMLA"&&e.find(".hierarchyCDB ").length>0?e.find("div:eq(0)").text():f}),this.model.pivotControl.model.dataSource.columns=n.grep(this.model.pivotControl.model.dataSource.columns,function(n){return n.fieldName!=f}),this.model.pivotControl.model.dataSource.rows=n.grep(this.model.pivotControl.model.dataSource.rows,function(n){return n.fieldName!=f}),this._dataModel!="XMLA"?this.model.pivotControl.model.dataSource.values=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.fieldName!=f}):this.model.pivotControl.model.dataSource.values[0].measures=n.grep(this.model.pivotControl.model.dataSource.values[0].measures,function(n){return n.fieldName!=f}),this.model.pivotControl.model.dataSource.filters=n.grep(this.model.pivotControl.model.dataSource.filters,function(n){return n.fieldName!=f}),d=this._droppedClass=="schemaRow"?"row":this._droppedClass=="schemaColumn"?"column":this._droppedClass=="schemaFilter"?"filter":this._droppedClass=="schemaValue"?"value":"",this.model.pivotControl._dataModel=="Pivot"&&n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==o[0].fieldCaption}).length>0&&d!="value"){alert(this.model.pivotControl._getLocalizedLabels("CalcValue"));this._tableTreeObj.checkNode(o[0].fieldCaption);return}this._createPivotButton(o[0],d,y,ft,h);n.isNumeric(h)?this._droppedClass=="schemaRow"?this.model.pivotControl.model.dataSource.rows.splice(h,0,o[0]):this._droppedClass=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.splice(h,0,o[0]):this._droppedClass=="schemaValue"?this.model.pivotControl._dataModel=="XMLA"?this.model.pivotControl.model.dataSource.values[0].measures.splice(h,0,o[0]):this.model.pivotControl.model.dataSource.values.splice(h,0,o[0]):this.model.pivotControl.model.dataSource.filters.splice(h,0,o[0]):this._droppedClass=="schemaRow"?this.model.pivotControl.model.dataSource.rows.push(o[0]):this._droppedClass=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.push(o[0]):this._droppedClass=="schemaValue"?this.model.pivotControl._dataModel=="XMLA"?this.model.pivotControl.model.dataSource.values[0].measures.push(o[0]):this.model.pivotControl.model.dataSource.values.push(o[0]):this.model.pivotControl.model.dataSource.filters==null?(this.model.pivotControl.model.dataSource.filters=[],this.model.pivotControl.model.dataSource.filters.push(o[0])):this.model.pivotControl.model.dataSource.filters.push(o[0]);this.model.pivotControl._dataModel=="Pivot"&&this.model.pivotControl._calculatedField.length>0&&d!="value"&&(this.model.pivotControl._calcFieldNodeDrop(o[0]),this.model.pivotControl.model.dataSource.values=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(o[0].fieldName)==-1}));this.model.pivotControl._dataModel=="XMLA"?(this._droppedClass=="schemaFilter"&&(this.model.pivotControl.model.dataSource.filters=n.map(this.model.pivotControl.model.dataSource.filters,function(n){return n.advancedFilter=[],n})),t.olap.base.getJSONData({action:"nodeDropped"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(this._trigger("fieldItemDropped",{axis:d,fieldItem:e}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}else y=!1,this._tempFilterData!=null&&n.each(this._tempFilterData,function(t,i){n.each(i,function(t,i){t==n(e).attr("id")&&i.length>0&&(y=!0)})}),y&&n(n(e).find(".e-text")[0]).after(t.buildTag("span.e-icon").addClass("filter")[0].outerHTML),this._dataModel=="Pivot"&&this.model.pivotControl._calculatedField.length>0&&this._droppedClass!="schemaValue"&&this.model.pivotControl._calculatedFieldNodeRemove(s),this._createPivotButton({fieldName:s.id,fieldCaption:f},this._droppedClass=="schemaRow"?"row":this._droppedClass=="schemaColumn"?"column":this._droppedClass=="schemaFilter"?"filter":this._droppedClass=="schemaValue"?"value":"",y,ft,h),g="",g=t.Pivot._getFilterParams(this._droppedClass,this._tempFilterData,f),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),a=JSON.stringify({action:"nodeDropped",dropAxis:this._droppedClass+"::"+h,filterParams:g,headerTag:JSON.stringify(s),sortedHeaders:this.model.pivotControl._ascdes,currentReport:v,valueSorting:this.model.pivotControl.model.valueSortSettings,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left}),this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtNodeDroppedSuccess),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a,this._pvtNodeDroppedSuccess)}else{if(l=r.dropTarget[0]!=i&&r.dropTarget[0].className=="pivotButton"?n(r.dropTarget).parents()[0]:r.dropTarget[0]!=i&&r.dropTarget[0].tagName.toLowerCase()=="td"&&!n(r.dropTarget.parents("table.pivotGridTable")[0]).length?r.dropTarget.children(":last")[0]:r.dropTarget,this._droppedClass=l[0].className.split(" ")[0],p="",w="",p=l[0].className.split(" ")[0],n(r.dropTarget.parents("table.pivotGridTable")[0]).length){if(w=n(l).hasClass("rowheader")?"Series":n(l).hasClass("grpRow")?"Series":n(l).hasClass("rows")?"Series":n(l).hasClass("colheader")?"Categorical":n(l).hasClass("columns")?"Categorical":n(l).hasClass("value")?"Slicer":n(l).hasClass("drag")?"Slicer":"",n(r.droppedElement).attr("tag").indexOf("Measures")>0&&w=="Slicer")return this._createErrorDialog(),!1}else w=p=="columns"?"Categorical":p=="schemaColumn"?"Categorical":p=="rows"?"Series":p=="schemaRow"?"Series":p=="drag"?"Slicer":p=="schemaFilter"?"Slicer":"";w==""&&(w=this.element.find(".schemaRow .pivotButton:contains('Measures')").length>0||this.element.find(".schemaRow .pivotButton:contains('MEASURES')").length>0?"Series":"Categorical");h=t.isNullOrUndefined(r.event)?"":this._setSplitBtnTargetPos(r.event);y=!1;this.model.pivotControl._tempFilterData!=null&&n.each(this.model.pivotControl._tempFilterData,function(t,i){n.each(i,function(n,t){n==s.replace(/[\[\]']/g,"")&&t.length>0&&(y=!0)})});y&&n(n(e).find(".e-text")[0]).after(t.buildTag("span.e-icon").addClass("filter")[0].outerHTML);ct=this._currentCubeName+"--"+s+"--"+w+"--"+h;g="";this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject});a=JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:ct,filterParams:g,currentReport:v,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.model.pivotControl.model.enableDeferUpdate||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show();this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,a,this._droppedSuccess)}}this._setPivotBtnWidth()}},_addTreeDropIcon:function(i){this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(n(args.currentElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&!(n(args.currentElement).find(".namedSetCDB").length>0)?i.after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML):i.after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML))},_clientPivotCheckedStateModified:function(i){var r,u,f,e;(t.PivotAnalysis._valueSorting=null,this._isDropAction)||(r="",t.isNullOrUndefined(this.model.pivotControl)||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),r=this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?n.grep(this.model.pivotTableFields,function(t){return t.name==n(i.currentElement).attr("id")})[0].name:n(i.currentElement).attr("tag"):n(i.currentElement).find("a")[0].textContent,i.type=="nodeUncheck"?(delete this.model.pivotControl._fieldMembers[r.toLowerCase()],delete this.model.pivotControl._fieldSelectedMembers[r.toLowerCase()],t.Pivot.removeReportItem(this.model.pivotControl.model.dataSource,r,!1),n(i.currentElement).removeClass("filter").find(".treeDrop,.filter").remove()):(u="row",this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&n(i.currentElement).attr("tag").toLocaleLowerCase().indexOf("[measures]")>=0&&(u="value"),(this.model.pivotControl.model.analysisMode!=t.Pivot.AnalysisMode.Olap||n(i.currentElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&n(i.currentElement).find(".namedSetCDB").length==0)&&n(i.currentElement.find(".e-text")).after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML),f=n(i.currentElement).find("a")[0].textContent,e={droppedFieldName:r,droppedFieldCaption:f,droppedClass:u,droppedPosition:"",isMeasuresDropped:r.toLocaleLowerCase().indexOf("measures")==0},t.Pivot.addReportItem(this.model.pivotControl.model.dataSource,e)),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl),this._refreshPivotButtons(),this.model.pivotControl.refreshControl(),this._setPivotBtnWidth())},_clientOnNodeDropped:function(i){var o,u,s,e,r,h,c,l,v;if(t.PivotAnalysis._valueSorting=null,this._isDragging=!1,o=!1,schemaObj=this,u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(s=n(i.dropTarget).parents(),e=0;e<s.length;e++)s[e].className.split(" ")[0]=="e-pivotgrid"&&(o=!0);var f=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?n.grep(this.model.pivotTableFields,function(n){return n.name==i.droppedElement.attr("id")})[0].name:i.droppedElement.attr("defaulthierarchy")||(n(i.droppedElement).find("a:eq(0) span[class^='level'],div[class*='level']").length>0?n(i.droppedElement).parents("li:eq(0)").attr("tag"):i.droppedElement.attr("tag")),a=n(i.droppedElement).find("div:first").text(),r="";if(r=n(i.dropTarget).hasClass("pvtBtn")||n(i.dropTarget).hasClass("pivotButton")?n(i.dropTarget).parents("div.e-droppable").hasClass("schemaColumn")?"column":n(i.dropTarget).parents("div.e-droppable").hasClass("schemaRow")?"row":n(i.dropTarget).parents("div.e-droppable").hasClass("schemaFilter")?"filter":n(i.dropTarget).parents("div.e-droppable").hasClass("schemaValue")?"value":"":i.dropTarget.hasClass("schemaColumn")?"column":i.dropTarget.hasClass("schemaRow")?"row":i.dropTarget.hasClass("schemaFilter")?"filter":i.dropTarget.hasClass("schemaValue")?"value":"",o&&(r=n(i.dropTarget).prop("tagName")=="TH"||n(i.dropTarget).prop("tagName")=="TD"?n(i.dropTarget).hasClass("rowheader")||n(i.dropTarget).hasClass("grpRow")?"row":n(i.dropTarget).hasClass("colheader")?"column":n(i.dropTarget).hasClass("value")?"value":"":n(i.dropTarget).hasClass("rows")||n(i.dropTarget).hasClass("emptyRows")?"row":n(i.dropTarget).hasClass("columns")?"column":n(i.dropTarget).hasClass("values")?"value":n(i.dropTarget).hasClass("drag")?"filter":""),r=="")return!1;if(h=t.isNullOrUndefined(i.event)?"":this._setSplitBtnTargetPos(i.event),c=n(i.dropTarget).hasClass("value")||n(i.dropTarget).hasClass("colheader")||n(i.dropTarget).hasClass("rowheader")||n(i.dropTarget).hasClass("summary")||n(i.dropTarget).parents("table:eq(0)").hasClass("pivotGridTable")||n(i.dropTarget).parents(".groupingBarPivot").length>0,f.toLowerCase().indexOf("[measures]")>=0&&r!="value"||f==this._getLocalizedLabels("Measures")&&r!="row"&&r!="column"||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&f.toLowerCase().indexOf("[measures]")<0&&r=="value"||c&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){this._createErrorDialog();return}this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.pivotControl._fieldMembers={},this.model.pivotControl._fieldSelectedMembers={},f.toLowerCase().indexOf("[measures")>=0&&(this.model.pivotControl.model.dataSource.values[0].axis=r=="column"?"columns":r=="row"?"rows":this.model.pivotControl.model.dataSource.values[0].axis,r="value"));t.isNullOrUndefined(u)?this.model.pivotControl._waitingPopup.show():(u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800));l={droppedFieldName:f,droppedFieldCaption:a,droppedClass:r,droppedPosition:h,isMeasuresDropped:f.toLocaleLowerCase().indexOf("measures")==0};t.Pivot.addReportItem(this.model.pivotControl.model.dataSource,l);this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl);this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl._pivotChart&&(this.model.pivotControl._pivotChart._labelCurrentTags={});v=i.droppedElement;this._isDropAction=!0;r==""?this._tableTreeObj.uncheckNode(i.droppedElement):(n(i.droppedElement).find(".treeDrop").length==0&&this.element.parents(".e-pivotclient").length==0&&(this.model.pivotControl.model.analysisMode!=t.Pivot.AnalysisMode.Olap||n(i.droppedElement).attr("tag").toLowerCase().indexOf("[measures]")<0&&n(i.droppedElement).find(".namedSetCDB").length==0)&&n(i.droppedElement.find(".e-text")).after(t.buildTag("span.e-icon").css("display","none").addClass("treeDrop")[0].outerHTML),this._tableTreeObj.checkNode(i.droppedElement));this._isDropAction=!1;this._refreshPivotButtons();this.model.pivotControl.refreshControl();this._setPivotBtnWidth();t.isNullOrUndefined(u)||u._isTimeOut&&(u._isTimeOut=!1)},_clientOnPvtBtnDropped:function(i){var f,r,c,u,l,a,o,s,e,v,h;if(t.PivotAnalysis._valueSorting=null,schemaObj=this,f=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,t.isNullOrUndefined(this.model.pivotControl)||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)?this.model.pivotControl._waitingPopup.show():(f._isTimeOut=!0,setTimeout(function(){f._isTimeOut&&f.element.find(".errorDialog:visible").length==0&&schemaObj.model.pivotControl._waitingPopup.show()},800))),n(i.target).hasClass("removeClientPivotBtn")&&(i.target=n(i.target).parent()),this._isDragging=!1,n("#"+this._id+"_dragClone").remove(),r="",r=this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?n.grep(this.model.pivotTableFields,function(t){return t.name==n(i.element).attr("fieldName")})[0].name:n(i.element).attr("fieldName"):i.element.text(),c=i.element.text(),t.isNullOrUndefined(this.model.pivotControl._fieldMembers)||(delete this.model.pivotControl._fieldMembers[r.toLowerCase()],delete this.model.pivotControl._fieldSelectedMembers[r.toLowerCase()]),u="",u=n(i.target).hasClass("pvtBtn")||this.element.parents(".e-pivotclient").length>0&&n(i.target).hasClass("pivotButton")?n(i.target).parents("div.e-droppable").hasClass("schemaColumn")?"column":n(i.target).parents("div.e-droppable").hasClass("schemaRow")?"row":n(i.target).parents("div.e-droppable").hasClass("schemaFilter")?"filter":n(i.target).parents("div.e-droppable").hasClass("schemaValue")?"value":"":n(i.target).hasClass("schemaColumn")?"column":n(i.target).hasClass("schemaRow")?"row":n(i.target).hasClass("schemaFilter")?"filter":n(i.target).hasClass("schemaValue")?"value":"",r.toLowerCase().indexOf("[measures]")>=0&&u!="value"&&(u=="row"||u=="column"||u=="filter")||r==this._getLocalizedLabels("Measures")&&u!="row"&&u!="column"&&(u=="value"||u=="filter")||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&r.toLowerCase().indexOf("[measures]")<0&&u=="value"){this._createErrorDialog();i.element.removeClass("dragHover").parent().removeClass("dragHover");return}if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl._calculatedField!=null&&u!="value"&&n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==r}).length>0){t.Pivot._createErrorDialog(this.model.pivotControl._getLocalizedLabels("CalcValue"),this.model.pivotControl._getLocalizedLabels("Warning"),this);i.element.removeClass("dragHover").parent().removeClass("dragHover");this.element.find(".dropIndicator").removeClass("dropIndicatorHover");this.model.pivotControl._waitingPopup.hide();return}if(l=t.isNullOrUndefined(i.event)?"":this._setSplitBtnTargetPos(i.event),a={droppedFieldName:r,droppedFieldCaption:c,droppedClass:u,droppedPosition:l,isMeasuresDropped:r.toLocaleLowerCase().indexOf("measures")==0},this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(r==this._getLocalizedLabels("Measures")||r=="[Measures]")&&(o=this.model.pivotControl.model.dataSource.values[0].measures),t.Pivot.addReportItem(this.model.pivotControl.model.dataSource,a),this.model.pivotControl._calculatedField!=null&&this.model.pivotControl._calculatedField.length>0&&u!="value")for(s=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(r)>-1}),e=0;e<s.length;e++)this._tableTreeObj.uncheckNode(s[e].fieldName);this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl._calculatedField!=null&&this.model.pivotControl._calculatedField.length>0&&(v=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0}),this.model.pivotControl.model.dataSource.values=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1}),n.merge(this.model.pivotControl.model.dataSource.values,v));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.pivotControl._fieldMembers={},this.model.pivotControl._fieldSelectedMembers={},t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"},this.model.pivotControl));this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl._pivotChart&&(this.model.pivotControl._pivotChart._labelCurrentTags={});u==""&&(this._isDropAction=!0,this._tableTreeObj.element.find("li[tag='"+r+"']").removeClass("filter").find(".treeDrop,.filter").remove(),t.isNullOrUndefined(o)?this._tableTreeObj.uncheckNode(this._tableTreeObj.element.find("li[tag='"+r+"']")):(h=this,n.grep(o,function(n){h._tableTreeObj.uncheckNode(h._tableTreeObj.element.find("li[tag='"+n.fieldName+"']"))})),this._isDropAction=!1);this._refreshPivotButtons();this.model.pivotControl.refreshControl();this._setPivotBtnWidth()},_refreshPivotButtons:function(){this.element.find(".axisTable .schemaFilter").html(this._createPivotButtons("filters",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.filters:JSON.parse(this.model.pivotControl.getOlapReport()).Filters));this.element.find(".axisTable .schemaRow").html(this._createPivotButtons("rows",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.rows:JSON.parse(this.model.pivotControl.getOlapReport()).PivotRows));this.element.find(".axisTable .schemaColumn").html(this._createPivotButtons("columns",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.columns:JSON.parse(this.model.pivotControl.getOlapReport()).PivotColumns));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.dataSource.values.length>0&&!t.isNullOrUndefined(this.model.pivotControl.model.dataSource.values[0].measures)&&this.model.pivotControl.model.dataSource.values[0].measures.length>0&&(this.model.pivotControl.model.dataSource.values[0].axis=="columns"?this.element.find(".axisTable .schemaColumn").append(this._createPivotButtons("columns",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}])):this.model.pivotControl.model.dataSource.values[0].axis=="rows"&&this.element.find(".axisTable .schemaRow").append(this._createPivotButtons("rows",[{fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")}])));this.element.find(".axisTable .schemaValue").html(this._createPivotButtons("values",this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.dataSource.values:JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations));this.model.enableDragDrop&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)});this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&this.element.find(".pvtBtn").css("max-width",this.element.find(".schemaColumn").width()-this.element.find(".removeClientPivotBtn").width()-6);this._createContextMenu();this.model.pivotControl.model.isResponsive&&this.model.pivotControl.model.enableSplitter&&!t.isNullOrUndefined(this.model.pivotControl.element.find(".splitresponsive").data("ejSplitter"))&&this.model.pivotControl.element.find(".splitresponsive").data("ejSplitter").refresh();this._setSplitButtonTitle();this.model.pivotControl.model.showUniqueNameOnPivotButton&&n(".pvtBtnDiv").addClass("schemaBtnUnique");this.element.parents(".e-pivotclient").length>0||this._setPivotBtnWidth()},_setSplitButtonTitle:function(){var i,r,f,u;if(this.element.find(".pvtBtn").length>0&&this._tableTreeObj!=null)for(i=0;i<this.element.find(".pvtBtn").length;i++)r=this.element.find(".pvtBtn:eq("+i+")").attr("fieldname"),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(f=this._tableTreeObj.element.find("li[tag='"+r+"']").parents("li:eq(0)").find("a:eq(0)").text(),u=this.element.find(".pvtBtn:eq("+i+")").text(),r.toLowerCase().indexOf("measures")>=0?this.element.find(".pvtBtn:eq("+i+")").attr("title",u):this.element.find(".pvtBtn:eq("+i+")").attr("title",f+" - "+u)):this.element.find(".pvtBtn:eq("+i+")").attr("title",n.grep(this.model.pivotTableFields,function(n){return n.name==r})[0].caption)},_createPivotButtons:function(r,u){var h="",a=r,r,f,e;if(t.isNullOrUndefined(this.model.pivotControl)||this.model.pivotControl.model.operationalMode!=t.Pivot.OperationalMode.ClientMode)for(r=="values"&&(r=this.element.find(".pivotButton:contains("+this._getLocalizedLabels("Measures")+")").length>0?this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").parent()[0].className.split(" ")[0]:"schemaColumn",r=r=="schemaColumn"?"columns":"rows"),f=0;f<u.length;f++)e="",t.isNullOrUndefined(this.model.pivotControl)||r!="filters"&&r!="slicers"||(e=t.Pivot._getFilterState("",[],u[f],this.model.pivotControl),r=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"slicers":r),h+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+(n(this.element).parents(".e-pivotclient").length>0?t.buildTag("button.pvtBtn#pivotButton"+(u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name),(this.model.pivotControl.model.showUniqueNameOnPivotButton?r!="values"?u[f].Tag:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name)+((r=="filters"||r=="slicers")&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f].FieldHeader||u[f].DimensionHeader||u[f].DimensionName||u[f].Name||u[f],fieldCaption:u[f].FieldHeader||u[f].FieldName||u[f].DimensionName||u[f].DimensionHeader,axis:r})[0].outerHTML:t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+(u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name),(this.model.pivotControl.model.showUniqueNameOnPivotButton?a!="values"?u[f].Tag:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name:u[f].FieldHeader||u[f].FieldName||u[f].DimensionHeader||u[f].DimensionName||u[f].Name)+((r=="filters"||r=="slicers")&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f].FieldHeader||u[f].DimensionHeader||u[f].DimensionName||u[f].Name||u[f],fieldCaption:u[f].FieldHeader||u[f].FieldName||u[f].DimensionName||u[f].DimensionHeader,axis:r})[0].outerHTML).attr("tag",r+":"+u[f].Tag)[0].outerHTML)+t.buildTag("span."+(this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?"removeClientPivotBtn":"removePivotBtn"),{},{display:this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne?"none":"inline-block"}).addClass("e-icon")[0].outerHTML).attr("tag",r+":"+u[f].Tag)[0].outerHTML;else for(r=="values"&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(u=n.map(u,function(n){return n.measures})),f=0;f<u.length;f++){var l=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?"":u[f].fieldName,o=n.grep(this.model.pivotTableFields,function(n){return n.name==u[f].fieldName}),s=n.grep(this.model.pivotTableFields,function(n){return n.name==u[f]});o.length>0&&(o=o[0].caption);s.length>0&&(s=s[0].caption);var e="",c=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?!0:!1,v=c?"":t.PivotAnalysis.getMembers(u[f].fieldName),y=u[f].filterItems!=null&&u[f].filterItems.values.length>0?"filtered":"";r=="filters"&&(y=="filtered"?e=t.Pivot._getFilterState(c,v,u[f],this.model.pivotControl):c?(t.olap._mdxParser.getAllMember(this.model.pivotControl.model.dataSource,u[f].fieldName,this.model.pivotControl),e=this.model.pivotControl._allMember):e=this.model.pivotControl._getLocalizedLabels("All"));h+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+(n(this.element).parents(".e-pivotclient").length>0?t.buildTag("button.pvtBtn#pivotButton"+l,(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.showUniqueNameOnPivotButton?r!="values"?u[f].fieldName.replace(/\[/g,"").replace(/\]/g,""):(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:o||s)+(r=="filters"&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f],fieldCaption:u[f].fieldCaption||u[f].fieldName,axis:r})[0].outerHTML:t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+l,(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.showUniqueNameOnPivotButton?r!="values"?u[f].fieldName.replace(/\[/g,"").replace(/\]/g,""):(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:(u[f].fieldCaption!=i?u[f].fieldCaption:u[f].fieldName)||u[f]:o||s)+(r=="filters"&&e!=""?" ("+e+")":""),{},{fieldName:u[f].fieldName||u[f],fieldCaption:u[f].fieldCaption||u[f].fieldName,axis:r})[0].outerHTML).attr("tag",r+":"+u[f].fieldName)[0].outerHTML)+t.buildTag("span."+(this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?"removeClientPivotBtn":"removePivotBtn"),{},{display:this.model.layout!=t.PivotSchemaDesigner.Layouts.OneByOne?"none":"inline-block"}).addClass("e-icon")[0].outerHTML).attr("tag",r+":"+u[f].fieldName||u[f])[0].outerHTML}return h},_pvtBtnDropped:function(r){var s,h,tt,a,l,it,w,b,f,k,d,rt,g,o,ut,nt,et;if(this.element.find(".dropIndicator").removeClass("dropIndicatorHover"),n(r.element).parent().removeClass("dragHover"),n(r.element).removeClass("dragHover"),n("#"+this._id+"_dragClone").remove(),s="",this._isDragging=!1,n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot){n(r.target).hasClass("pivotButton")&&(r.target=r.target.childNodes[1]);var u=t.isNullOrUndefined(r.target.className.indexOf)?"":n(r.target).attr("class")?r.target.className.indexOf("e-droppable")>=0?r.target.className.split(" ")[0]:r.target.className.split(" ")[0]=="pvtBtn"?n(r.target).parents("div.e-droppable").attr("class").split(" ")[0]:"":"",e=r.element.attr("fieldcaption")||r.element.attr("fieldname"),a,ft=r.element.parent().attr("tag").split(":")[1],h=t.isNullOrUndefined(r.event)?"":this._setSplitBtnTargetPos(r.event);for(o=0;o<this.model.pivotTableFields.length;o++)if(this.model.pivotTableFields[o].name==e){this.model.pivotTableFields[o].isSelected=!0;s=this.model.pivotTableFields[o];break}try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(ot){a=this.model.pivotControl.getOlapReport()}t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show();l=JSON.stringify({action:this.model.pivotControl.model.enableDeferUpdate?"nodeDroppedDeferUpdate":"nodeDropped",args:JSON.stringify({droppedFieldCaption:e,droppedFieldName:ft,headerTag:s,dropAxis:u,droppedPosition:h,currentReport:a,sortedHeaders:t.isNullOrUndefined(this.model.pivotControl._ascdes)?"":this.model.pivotControl._ascdes}),customObject:JSON.stringify(this.model.pivotControl.model.customObject)});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l,this._pvtNodeDroppedSuccess);return}this.model.pivotControl._isUpdateRequired=!0;this._isDragging=!1;var c=null,v="",e,u,y=y=r.element.find("~ .filtered").length>0?!0:!1,p=!1;if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap)c=t.isNullOrUndefined(r.target.className)?r.target:r.target.className.indexOf("pvtBtn")>-1?n(r.target).parents(".e-droppable")[0]:r.target.className.indexOf("e-droppable")?r.target:r.target[0].tagName.toLowerCase()=="td"?r.target.children(":last")[0]:r.target,t.isNullOrUndefined(c.className)?(v=c.hasClass("schemaColumn")?"Categorical":c.hasClass("schemaRow")?"Series":c.hasClass("schemaFilter")?"Slicer":"",this._droppedClass=u=c.hasClass("schemaColumn")?"schemaColumn":c.hasClass("schemaRow")?"schemaRow":c.hasClass("schemaFilter")?"schemaFilter":c.hasClass("schemaValue")?"schemaValue":""):(v=c.className.split(" ")[0]=="schemaColumn"?"Categorical":c.className.split(" ")[0]=="schemaRow"?"Series":c.className.split(" ")[0]=="schemaFilter"?"Slicer":"",u=c.className.split(" ")[0]),v==""&&r.element.parent().attr("tag").toLowerCase().indexOf("[measures]")>-1&&(v=this.element.find(".schemaRow .pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").length>0?"Series":"Categorical"),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?e=s=n(r.element.parent()[0]).attr("tag").split(":")[1]:s=n(r.element.parent()[0]).attr("tag");else for(u=t.isNullOrUndefined(r.target.className)?n(r.target).hasClass("schemaColumn")?"schemaColumn":n(r.target).hasClass("schemaRow")?"schemaRow":n(r.target).hasClass("schemaFilter")?"schemaFilter":n(r.target).hasClass("schemaValue")?"schemaValue":"":r.target.className.indexOf("e-droppable")>=0?r.target.className.split(" ")[0]:r.target.className.split(" ")[0]=="pvtBtn"?n(r.target).parents("div.e-droppable").attr("class").split(" ")[0]:"",e=this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode?n.grep(this.model.pivotTableFields,function(n){return n.caption==r.element.text()})[0].name:r.element.attr("fieldCaption"),s,y=r.element.find("~ .filterIndicator").length>0?!0:!1,p=r.element.find("~ span:eq(0) span.descending").length>0?!0:!1,o=0;o<this.model.pivotTableFields.length;o++)this.model.pivotTableFields[o].name==e&&(this.model.pivotTableFields[o].isSelected=!0,s=this.model.pivotTableFields[o]);if(this._dataModel=="Olap"&&(s.split(":")[1].toLocaleUpperCase()=="MEASURES"&&(u!="schemaColumn"||u!="schemaRow")&&(u=="schemaFilter"||u=="schemaValue")||s.toUpperCase().indexOf("[MEASURES]")>-1&&u!="schemaValue"&&(u=="schemaRow"||u=="schemaColumn"||u=="schemaFilter")||s.toUpperCase().indexOf("[MEASURES]")==-1&&u=="schemaValue"))return this._createErrorDialog(),!1;if(u=="schemaValue"||u=="schemaRow"||u=="schemaColumn"||u=="schemaFilter"){if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._dataModel=="Pivot"&&u!="schemaValue"&&(n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e}).length>0||n.grep(JSON.parse(this.model.pivotControl.getOlapReport()).PivotCalculations,function(n){return n.FieldHeader==e&&n.CalculationType==8}).length>0)){this.model.pivotControl._createErrorDialog(this.model.pivotControl._getLocalizedLabels("CalcValue"),this.model.pivotControl._getLocalizedLabels("Warning"));return}h=t.isNullOrUndefined(r.event)?"":this._setSplitBtnTargetPos(r.event);try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(ot){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(a=this.model.pivotControl.getOlapReport())}if(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(this.model.pivotControl.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"}),it=u=="schemaFilter"&&this.model.pivotControl._getNodeByUniqueName(e)!=null&&this.model.pivotControl._getNodeByUniqueName(e).find(".namedSetCDB").length>0,w=n(r.element.parent()).attr("tag").split(":")[0]=="Columns"&&this._droppedClass=="schemaColumn"&&s.toLowerCase()=="measures"||n(r.element.parent()).attr("tag").split(":")[0]=="Rows"&&this._droppedClass=="schemaRow"&&s.toLowerCase()=="measures",w||it||e.toLowerCase().indexOf("[measures]")>=0&&u!="schemaValue"||u=="schemaValue"&&!(e.toLowerCase().indexOf("[measures]")>=0)||u=="schemaFilter"&&e.toLowerCase().indexOf("measures")>=0)return pschemaDesignerWaitingPopup.hide(),w||this._createErrorDialog(),r.Cancel;if(e.toLowerCase().indexOf("measures")>=0&&!(e.toLowerCase().indexOf("[measures]")>=0))return n(r.element.parent().parent()).remove(),this.model.pivotControl.model.dataSource.values[0].axis=u=="schemaRow"?"rows":u=="schemaColumn"?"columns":"columns",this._createPivotButton({fieldName:"Measures",fieldCaption:this._getLocalizedLabels("Measures")},u=="schemaRow"?"row":u=="schemaColumn"?"column":"column","","",h),t.olap.base.getJSONData({action:"nodeDropped"},this.model.pivotControl.model.dataSource,this.model.pivotControl),pschemaDesignerWaitingPopup.hide(),this._setPivotBtnWidth(),!1}if(this.model.pivotControl._dataModel=="Pivot"&&u!="schemaValue"&&n.grep(this.model.pivotControl._calculatedField,function(n){return n.name==e}).length>0){alert(this.model.pivotControl._getLocalizedLabels("CalcValue"));return}if(n(r.element.parent().parent()).remove(),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)this.model.pivotControl.model.enableDeferUpdate||t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||this.model.pivotControl._waitingPopup.show(),this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left}),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(tt=this._currentCubeName+"--"+s+"--"+v+"--"+h,this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),l=JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:tt,currentReport:a,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),this.model.pivotControl.model.enableDeferUpdate?this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l.replace("nodeDropped","nodeDroppedDeferUpdate"),this._droppedSuccess):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l,this._droppedSuccess)):(this._createPivotButton({fieldName:r.element.attr("fieldName"),fieldCaption:r.element.attr("fieldCaption")},u=="schemaRow"?"row":u=="schemaColumn"?"column":u=="schemaFilter"?"filter":u=="schemaValue"?"value":"",y,p,h),!t.isNullOrUndefined(this.model.pivotControl._calculatedField)&&this.model.pivotControl._calculatedField.length>0&&u!="schemaValue"&&this.model.pivotControl._calculatedFieldNodeRemove(s),this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.pivotControl.model.customObject}),b="",b=t.Pivot._getFilterParams(u,this._tempFilterData,e),l=JSON.stringify({action:"nodeDropped",dropAxis:u+"::"+h,filterParams:b,headerTag:JSON.stringify(s),sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:JSON.stringify(this.model.pivotControl.model.customObject)}),successMethod=this.model.pivotControl._renderControlSuccess,this.model.pivotControl.model.enableDeferUpdate?(this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l.replace("nodeDropped","nodeDroppedDeferUpdate"),this._pvtNodeDroppedSuccess),t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.hide()):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.nodeDropped,l,this._pvtNodeDroppedSuccess));else{if(f=this.model.pivotControl._getDroppedItem(e),k={},f.length>0&&(k=f[0].isNamedSets!=i?{fieldName:f[0].fieldName,fieldCaption:f[0].fieldCaption,isNamedSets:f[0].isNamedSets}:{fieldName:f[0].fieldName,fieldCaption:f[0].fieldCaption}),d=u=="schemaRow"?"row":u=="schemaColumn"?"column":u=="schemaFilter"?"filter":u=="schemaValue"?"value":"",this._createPivotButton(k,d,y,p,h),n.isNumeric(h)?u=="schemaRow"?this.model.pivotControl.model.dataSource.rows.splice(h,0,f[0]):u=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.splice(h,0,f[0]):u=="schemaValue"?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.dataSource.values[0].measures.splice(h,0,f[0]):this.model.pivotControl.model.dataSource.values.splice(h,0,f[0]):this.model.pivotControl.model.dataSource.filters.splice(h,0,f[0]):u=="schemaRow"?this.model.pivotControl.model.dataSource.rows.push(f[0]):u=="schemaColumn"?this.model.pivotControl.model.dataSource.columns.push(f[0]):u=="schemaValue"?this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?this.model.pivotControl.model.dataSource.values[0].measures.push(f[0]):this.model.pivotControl.model.dataSource.values.push(f[0]):this.model.pivotControl.model.dataSource.filters.push(f[0]),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl._calculatedField.length>0&&u!="schemaValue"){for(rt=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return t.isNullOrUndefined(n.isCalculatedField)||n.isCalculatedField==!1||n.isCalculatedField==!0&&n.formula.indexOf(f[0].fieldName)==-1}),g=n.grep(this.model.pivotControl.model.dataSource.values,function(n){return n.isCalculatedField==!0&&n.formula.indexOf(f[0].fieldName)>-1}),o=0;o<g.length;o++)this._tableTreeObj.uncheckNode(g[o].fieldName);this.model.pivotControl.model.dataSource.values=rt}this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(ut=this.model.pivotControl.model.dataSource.values[0].axis=="columns"?"Columns:":"Rows:",nt=this.element.find("div[tag='"+ut+"Measures']:first"),nt.appendTo(nt.parent()),et=r.element.attr("axis").toLowerCase(),this.model.pivotControl.model.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"nodeDropped"}));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.show(),t.olap.base.getJSONData({action:"nodeDropped"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(this._trigger("fieldItemDropped",{axis:d,fieldItem:f}),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}}else this._removePvtBtn(r);this._setPivotBtnWidth()},_createErrorDialog:function(){if(t.Pivot.openPreventPanel(this),this.element.find(".errorDialog").length==0){var n=t.buildTag("div.errorDialog#ErrorDialog",t.buildTag("div.warningImg")[0].outerHTML+t.buildTag("div.warningContent",this._getLocalizedLabels("AlertMsg"))[0].outerHTML+t.buildTag("div",t.buildTag("button#ErrOKBtn.errOKBtn","OK")[0].outerHTML)[0].outerHTML).attr("title",this._getLocalizedLabels("Warning"))[0].outerHTML;this.element.append(n);this.element.find(".errorDialog").ejDialog({target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,width:"400px",close:t.proxy(t.Pivot.closePreventPanel,this)});this._errorDialog=this.element.find(".errorDialog").data("ejDialog");this.element.find(".errOKBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(this._errOKBtnClick,this)});this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"))}else this._errorDialog.open()},_errOKBtnClick:function(){t.Pivot.closePreventPanel(this);this._errorDialog._ejDialog.find("div.e-dialog-icon").trigger("click")},_hideSchemaDesigner:function(){n("#"+this._id).animate({left:"-"+n("#"+this._id).width()+"px"},500,function(){});this.element.find(".collapseSchema").addClass("expandSchema").removeClass("collapseSchema")},_showSchemaDesigner:function(){n("#"+this._id).animate({left:"5px"});this.element.find(".expandSchema").addClass("collapseSchema").removeClass("expandSchema")},_reSizeHandler:function(){var f,e,c,i,o,r,u,s,h;this.model.pivotControl&&(f=n("#"+this._id).width(),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?(this.element.find(".axisTd1, .axisTd2").css({width:"100%"}),this._pivotClientObj.model.isResponsive||(e=this._pivotClientObj.element.find("#"+this._id).width()/2,this._pivotClientObj.element.find("div.fieldTable").width(e-6),this._pivotClientObj.element.find("div.axisTable").width(e-5)),this._pivotClientObj.model.isResponsive&&this._pivotClientObj.element.find("div.axisTable").css({width:"52%"})):(this.element.find("div.axisTable").width(f),c=(f-2)/2,this.element.find(".axisTd1, .axisTd2").css({width:c})),i=t.PivotSchemaDesigner.Layouts.OneByOne==this.model.layout?this._pivotClientObj.element.find(".controlPanel").height()-15:25/100*n("#"+this._id).height(),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&(i=this.element.find(".cubelists").length>0?i-27:i+5),this.element.find("div.parentSchemaFieldTree, .schemaFieldTree, div.fieldTable").height(i),this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne&&this.element.find("div.schemaFieldTree").height(i-35),n(this.element).parents(".e-pivotclient").length>0||(n("#"+this._id).height()<450&&n("#"+this._id).css("min-height","450px"),n("#"+this._id).width()<240&&n("#"+this._id).css("min-width","240px")),u=n(this.element).parents(".e-pivotclient").length>0?this._pivotClientObj.element.find(".controlPanel").height()-10:n("#"+this._id).height()+20,s=t.PivotSchemaDesigner.Layouts.OneByOne==this.model.layout?0:this.element.find("table.headerTable").height()+this.element.find("div.fieldTable").height()+this.element.find("div.centerDiv").height()+this.element.find("div.centerHead").height(),o=this.model.pivotControl==null||this.model.pivotControl.element.hasClass("e-pivotclient")||this.model.pivotControl.model.operationalMode!=t.PivotGrid.OperationalMode.ServerMode?t.PivotSchemaDesigner.Layouts.OneByOne==this.model.layout?u:u-(s+80):u-(s+105),this.element.find("div.axisTable").height(o),r=o/(this.model.layout==t.PivotSchemaDesigner.Layouts.OneByOne?4:2),this.element.find(".axisTd1,.axisTd2").css({height:r}),n(this.element).parents(".e-pivotclient").length>0&&(this._pivotClientObj.element.find(".schemaColumn, .schemaValue").height(r-28),this._pivotClientObj.element.find(".schemaRow, .schemaFilter").height(r-28)),this._setPivotBtnWidth(),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(h=n(".schemaFieldTree ul>li div").width(),n(n(".e-pivotschemadesigner .schemaFieldTree.e-treeview .e-text")).each(function(){var t=(h-50)/h*100;n(this).width(t.toString()+"%")})))},_clientDialogBtnClick:function(i){var f=[],a=[],w=this._selectedFieldName,c={},v=this,e=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,h,s,y,p,u,o,r;if(this.element.find(".e-dialog, .clientDialog").hide(),this.element.find("#preventDiv").remove(),i.model.text.toLowerCase()!="cancel"){if(t.isNullOrUndefined(e)?this.model.pivotControl._waitingPopup.show():(e._isTimeOut=!0,setTimeout(function(){e._isTimeOut&&v.model.pivotControl._waitingPopup.show()},800)),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){this.model.pivotControl.element.hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._pivotChart)&&(this.model.pivotControl._pivotChart._labelCurrentTags={});t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"},this.model.pivotControl);this._memberTreeObj=t.Pivot.updateTreeView(this);var u=this._selectedFieldName,o=this.model.pivotControl.model.dataSource,l={};if(this.model.pivotControl._currentReportItems=n.map(this.model.pivotControl._currentReportItems,function(n){return n.fieldName==u&&(t.isNullOrUndefined(n.dataSrc)||n.dataSrc.cube==o.cube&&n.dataSrc.reportName==o.reportName)&&(l=n.filterItems,n.filterItems=v._memberTreeObj.dataSource()),n}),c=t.Pivot.getNodesState(!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.element.hasClass("e-pivotclient")&&this.model.pivotControl.model.enableMemberEditorPaging?this.model.pivotControl._editorTreeData:this._memberTreeObj),h=t.Pivot._getEditorMember(u.toLocaleLowerCase(),this.model.pivotControl,!0),this.model.pivotControl._fieldSelectedMembers[u.toLocaleLowerCase()]=n.map(this.model.pivotControl._fieldMembers[u.toLocaleLowerCase()],function(n){if(!n.checked)return n}).length==0?"All":h!="All"&&h!="multiple"?h:this.model.pivotControl._getLocalizedLabels("MultipleItems"),r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).item,f=n.map(c.selectedNodes.split("::"),function(n){return{Id:n.split("||")[0],tag:n.split("||")[1],parentId:n.split("||")[2]}}),!t.isNullOrUndefined(this.model.pivotControl._selectedNodes))for(s=0;s<this.model.pivotControl._selectedNodes.length;s++)y=this.model.pivotControl._selectedNodes[s],p=n.map(f,function(n){if(y.tag==n.tag)return n}),p.length==0&&f.push(this.model.pivotControl._selectedNodes[s]);t.isNullOrUndefined(r)||(r.advancedFilter=[],r.filterItems={filterType:"include",values:t.Pivot.removeParentSelectedNodes(f)},this._selectedTreeNode=this.element.find(".schemaFieldTree").find("li[tag='"+r.fieldName+"']"),n(this._selectedTreeNode).parents("li:eq(0) span:eq(0)").hasClass("hierarchyCDB")&&(this._selectedTreeNode=n(this._selectedTreeNode).parents("li:eq(0)")),c.unSelectedNodes!=""?(this.model.pivotControl.model.dataSource=t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"},this.model.pivotControl),n(this._selectedTreeNode).find(".filter").length<=0&&(n(n(this._selectedTreeNode).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),this.element.find(".pivotButton:contains('"+this._selectedFieldName+"') .filter").addClass("filtered"),this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").addClass("filtered"))):this.model.pivotControl._unSelectedNodes?(this.model.pivotControl.model.dataSource=t.olap.base.clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"},this.model.pivotControl),n(this._selectedTreeNode).find(".filter").length<=0&&(n(n(this._selectedTreeNode).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),this.element.find(".pivotButton:contains('"+this._selectedFieldName+"') .filter").addClass("filtered"),this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").addClass("filtered"))):(this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").removeClass("filtered"),this._selectedTreeNode.find(".filter").remove(),delete r.filterItems));this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(u=this._selectedFieldName,o=this.model.pivotControl.model.dataSource,this.model.pivotControl._currentReportItems=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName!=u&&(t.isNullOrUndefined(n.dataSrc)||n.dataSrc.cube==o.cube&&n.dataSrc.reportName==o.reportName))return n}),l=this.model.pivotControl.model.enableMemberEditorPaging?this.model.pivotControl._editorTreeData:n.extend([],this._memberTreeObj.dataSource()),this.model.pivotControl._currentReportItems.push({filterItems:l,fieldName:u,dataSrc:this.model.pivotControl.model.dataSource,pageSettings:this._memberCount}));t.olap.base.getJSONData({action:"filtering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)}else t.PivotAnalysis._valueSorting=null,jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:checked"),function(n,t){t.value!="All"&&f.push(t.value)}),jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:not(:checked)"),function(n,t){a.push(t.value=t.value=="(blank)"?"":t.value)}),this._selectedFieldName&&(r=r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).item,r&&(r.advancedFilter=[])),this._pivotFilterItems(f,a),this.model.pivotControl.refreshControl();this._refreshPivotButtons();this.model.pivotControl._isMemberPageFilter=!0;t.isNullOrUndefined(e)||e._isTimeOut&&(e._isTimeOut=!1)}},_pivotFilterItems:function(i,r){var h=this.model.pivotControl.model.dataSource[this._selectedFieldAxis],e=t.PivotAnalysis.getMembers(this._selectedFieldName),o,f,u,s;for(jQuery.each(e,function(n,t){t!=null&&t.toString().replace(/^\s+|\s+$/gm,"")||jQuery.each(r,function(n,i){i.toString().replace(/^\s+|\s+$/gm,"")||(r[n]=t)})}),o=this._selectedFieldName,f=n.grep(h,function(n){return n.fieldName==o}),u=0;u<f.length;u++)f[u].filterItems=i.length==e.length?null:{filterType:t.PivotAnalysis.FilterType.Exclude,values:r};r.length>0&&this.element.find(".schemaFieldTree li[id='"+this._selectedFieldName+"']").find(".filter").length<=0?(s=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,this.element.find(".schemaFieldTree li[id='"+this._selectedFieldName+"']").find(".e-text").after(s),this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").addClass("filtered")):r.length==0&&(this.element.find(".pvtBtn[fieldname='"+this._selectedFieldName+"']").parent().find(".filter").removeClass("filtered"),this.element.find(".schemaFieldTree li[id='"+this._selectedFieldName+"']").find(".filter").remove())},_dialogBtnClick:function(r){var f,l,b,g,v,e,nt,k,tt,h,w,u,rt,a,ut;if(t.Pivot.closePreventPanel(this),this.element.find(".e-dialog, .clientDialog").hide(),schemaObj=this,f=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,!this._isFiltered)return!1;if(this.model.pivotControl._isUpdateRequired=!0,this.model.pivotControl!=null&&(this.model.pivotControl._memberTreeObj=this._memberTreeObj),this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(r.model.text.toLowerCase()=="cancel")return;l=[];b=[];this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?(g=this._selectedMember,this.model.pivotControl._currentReportItems=n.grep(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()!=g.toLocaleLowerCase())return n}),this._memberTreeObj=t.Pivot.updateTreeView(this),this.model.pivotControl._currentReportItems.push({filterItems:n.extend([],this._memberTreeObj.dataSource()),fieldName:this._selectedMember}),l=n.map(this.model.pivotControl._getSelectedNodes().split("::"),function(n){return{Id:n.split("||")[0],tag:n.split("||")[1],parentId:n.split("||")[2]}}),v=this._selectedMember!=i?this._selectedMember.toLocaleLowerCase():this._selectedMember.toLocaleLowerCase(),e=n.map(this.model.pivotControl.model.dataSource.columns,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()==v)return n}),e.length==0&&(e=n.map(this.model.pivotControl.model.dataSource.rows,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()==v)return n})),e.length==0&&(e=n.map(this.model.pivotControl.model.dataSource.filters,function(n){if(n.fieldName!=i&&n.fieldName.toLocaleLowerCase()==v)return n})),e.length>0&&(this._getUnSelectedNodes()!=""&&(this.model.pivotControl.model.dataSource=this.model.pivotControl._clearDrilledItems(this.model.pivotControl.model.dataSource,{action:"filtering"})),e[0].advancedFilter=[],e[0].filterItems={filterType:"include",values:this.model.pivotControl._removeSelectedNodes(l)},this._selectedTreeNode=this.element.find(".schemaFieldTree").find("li[tag='"+e[0].fieldName+"']"),n(this._selectedTreeNode).parents("li:eq(0)").children().children("span").hasClass("hierarchyCDB")&&(this._selectedTreeNode=n(n(this._selectedTreeNode).parents("li:eq(0)"))),this._getUnSelectedNodes()==""?(this._selectedTreeNode.find(".filter").remove(),this.element.find(".pvtBtn[fieldname='"+this._selectedMember+"']").parent().find(".filter").removeClass("filtered"),delete e[0].filterItems):n(n(this._selectedTreeNode)).find(".filter").length<=0&&(n(n(this._selectedTreeNode).find(".e-text")[0]).after(t.buildTag("span.e-icon").attr("role","button").attr("aria-label","filtered").addClass("filter")[0].outerHTML),this.element.find(".pvtBtn[fieldname='"+this._selectedMember+"']").parent().find(".filter").addClass("filtered"))),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)?this.model.pivotControl._waitingPopup.show():(f._isTimeOut=!0,setTimeout(function(){f._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800))),t.olap.base.getJSONData({action:"filtering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)):(t.PivotAnalysis._valueSorting=null,jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:checked"),function(n,t){t.value!="All"&&l.push(t.value)}),jQuery.each(this._memberTreeObj.element.find(":input.nodecheckbox:not(:checked)"),function(n,t){b.push(t.value=t.value=="(blank)"?"":t.value)}),this.element.find(".e-dialog, .clientDialog").hide(),this.model.pivotControl._pivotFilterItems(l,b),this.model.pivotControl.model.editCellsInfo={},this.model.pivotControl._populatePivotGrid())}else{if(nt="",tt=this.element.find(".editorTreeView :input.nodecheckbox"),r.model.text.toLowerCase()!="cancel"){var c=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?nt=this._getUnSelectedNodes()+"FILTERED"+this._getSelectedNodes(this._curFilteredAxis=="schemaFilter"?!0:!1):this._memberTreeObj.element.find(":input:gt(0).nodecheckbox:not(:checked)"),y=!1,o=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap?c:this._curFilteredAxis+"::"+this._curFilteredText+"::FILTERED",s=this._curFilteredText,d=[],p={};if(k=this._getUnSelectedNodes()!=""?!0:!1,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot){for(t.isNullOrUndefined(this.model.pivotControl._fieldMembers[s])&&(this.model.pivotControl._fieldMembers[s]=t.Pivot._getEditorMember(tt,this.model.pivotControl,!0)),u=0;u<c.length;u++)d.push(n(c[u].parentElement).siblings("a").text());for(p[s]=d,h=this.element.parents(".e-pivotclient").length>0?this.model.pivotControl._tempFilterData:this._tempFilterData,t.isNullOrUndefined(h)&&(h=[]),u=0;u<h.length;u++)t.isNullOrUndefined(h[u][s])||(h[u][s]=d,y=!0);if(y||h.push(p),this._tempFilterData=this.model.pivotControl._tempFilterData=h,(t.isNullOrUndefined(this._curFilteredAxis)||this._curFilteredAxis!="")&&this._curFilteredAxis!="schemaValue")for(u=0;u<c.length;u++)o+="##"+n(c[u].parentElement).siblings("a").text()}else{for(w=t.Pivot._getEditorMember(s,this.model.pivotControl,!0),this.model.pivotControl._fieldSelectedMembers[s]=n.map(this.model.pivotControl._fieldMembers[s],function(n){if(!n.checked)return n}).length==0?"All":w!="All"&&w!="multiple"?w:this.model.pivotControl._getLocalizedLabels("MultipleItems"),p[this._curFilteredText]=o,t.isNullOrUndefined(this.model.pivotControl._tempFilterData)&&(this.model.pivotControl._tempFilterData=[]),u=0;u<this.model.pivotControl._tempFilterData.length;u++)t.isNullOrUndefined(this.model.pivotControl._tempFilterData[u][this._curFilteredText])||(this.model.pivotControl._tempFilterData[u][this._curFilteredText]=o,y=!0);y||this.model.pivotControl._tempFilterData.push(p)}var it=this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this._curFilteredText:this._curFilteredText.split(".")[1],ft=this._getSortedHeaders(),et=this.model.layout=="excel"?this.element.find(".schemaFieldTree li:contains('"+this._curFilteredText+"')"):this.element.find("."+this._curFilteredAxis+" .pivotButton:contains("+this._curFilteredText+") .filterBtn");if((this.model.layout=="excel"||this.model.layout=="normal")&&(n(this._selectedTreeNode).parents("li:eq(0)").children().children("span").hasClass("hierarchyCDB")&&(this._selectedTreeNode=n(n(this._selectedTreeNode).parents("li:eq(0)"))),k&&n(n(this._selectedTreeNode)).find(".filter").length<=0?(rt=t.buildTag("span.e-icon",{display:"none"}).addClass("filter")[0].outerHTML,n(n(this._selectedTreeNode).find(".e-text")[0]).after(rt),this.element.find(".pvtBtn:contains('"+it+"')").parent().find(".filter").addClass("filtered")):k||(n(this._selectedTreeNode).find(".filter").remove(),this.element.find(".pvtBtn:contains('"+it+"')").parent().find(".filter").removeClass("filtered")),this._curFilteredAxis==""))return!1;this.model.pivotControl.model.enableGroupingBar&&(n.each(this.model.pivotControl.element.find(".pivotButton .filter"),function(t,i){n(i).removeClass("filtered")}),(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?c.length>0:c.split("FILTERED::")[0].length>0)&&this.model.pivotControl.element.find("#pivotButton"+this._curFilteredText.split(".")[0]).next().addClass("filtered"));try{a=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(ot){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(a=this.model.pivotControl.getOlapReport())}this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.pivotControl.model.customObject});ut=this.model.pivotControl.model.customObject!={}&&o!=""?JSON.stringify({action:"filtering",filterParams:o+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:this.model.pivotControl.model.valueSortSettings,gridLayout:this.model.pivotControl.model.layout,customObject:JSON.stringify(this.model.pivotControl.model.customObject)}):this.model.pivotControl.model.customObject!={}?JSON.stringify({action:"filtering",currentReport:a,valueSorting:this.model.pivotControl.model.valueSortSettings,customObject:serializedCustomObject}):o!=""?JSON.stringify({action:"filtering",filterParams:o,sortedHeaders:this.model.pivotControl._ascdes,currentReport:a,valueSorting:this.model.pivotControl.model.valueSortSettings}):JSON.stringify({action:"filtering",valueSorting:this.model.pivotControl.model.valueSortSettings});t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)?this.model.pivotControl._waitingPopup.show():(f._isTimeOut=!0,setTimeout(function(){f._isTimeOut&&schemaObj.model.pivotControl._waitingPopup.show()},800)));this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.model.pivotControl.model.enableDeferUpdate?(this.model.pivotControl._filterUpdate.push(o),t.isNullOrUndefined(this.model.pivotControl._waitingPopup)||(t.isNullOrUndefined(f)||(f._isTimeOut=!1),this.model.pivotControl._waitingPopup.hide()),this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,ut,this._filterElementSuccess)}this._selectedTreeNode=null;this._refreshPivotButtons()}t.isNullOrUndefined(f)||f._isTimeOut&&(f._isTimeOut=!1)},_beforeNodeExpand:function(n){t.Pivot.getChildNodes(n,this._selectedFieldName,this.model.pivotControl._currentReportItems,this.model.pivotControl.model.dataSource,this)},_nodeExpand:function(n){this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.pivotControl._nodeExpand(n)},_nodeStateModifiedSuccess:function(n){this.model.pivotControl._isUpdateRequired=!0;n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeStateModified",element:this.element,customObject:this.model.customObject});this.model.pivotControl.model.enableDeferUpdate?this.model.pivotControl._deferUpdateSuccess(n):this.model.pivotControl._renderControlSuccess(n);this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_pvtNodeDroppedSuccess:function(r){r[0]!=i?r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value):r.d!=i?(r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value),r.d[0].Key=="PivotReport"&&this.model.pivotControl.setOlapReport(r.d[0].Value)):(r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject),this.model.pivotControl.setOlapReport(r.PivotReport));this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.model.pivotControl.model.enableDeferUpdate?this.model.pivotControl._deferUpdateSuccess(r):n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this.model.pivotControl.refreshControl(r),this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(r)):this.model.pivotControl._renderControlSuccess(r);this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_pvtBtnDroppedSuccess:function(n){n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.customObject});this.model.pivotControl._renderControlSuccess(n);this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(n);this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_filterElementSuccess:function(r){var u,f,e;n(this.element).parents(".e-pivotclient").length>0?(t.isNullOrUndefined(r.d)||(u={},u.PivotReport=r.d[0].Value,u.GridJSON=r.d[1].Value,u.ChartJSON=r.d[2].Value,f=n.map(r.d,function(n){if(n.Key=="FilteredColumnHeaders")return n.Value}),f.length>0&&(u.FilteredColumnHeaders=f[0]),e=n.map(r.d,function(n){if(n.Key=="FilteredRowHeaders")return n.Value}),e.length>0&&(u.FilteredRowHeaders=e[0]),r=u),this.model.pivotControl.refreshControl(r),this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(r)):(r[0]!=i?r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value):r.d!=i?r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value):r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject),this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject}),this.model.pivotControl._renderControlSuccess(r));this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style");t.Pivot.closePreventPanel(this);this.element.find(".e-dialog").remove()},_fetchChildNodeSuccess:function(r){var u,f,e;r.length>1&&r[0]!=i?(u=JSON.parse(r[0].Value),r[1]!=null&&r[1]!=i&&(this.model.customObject=r[1].Value)):r.d!=i?(u=JSON.parse(r.d[0].Value),r.d[1]!=null&&r.d[1]!=i&&(this.model.customObject=r.d[1].Value)):(u=JSON.parse(r.ChildNodes),r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject));e={id:"id",parentId:"pid",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus"};f=n(this.pNode).parents("li").length>1?n(this.pNode).parents("li").first():n(this.pNode).parents("li");n(n(f).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});this._memberTreeObj._createSubNodesWhenLoadOnDemand(u,this.pNode,e);n.each(n(f).children().find("li"),function(n,t){t.setAttribute("tag",u[n].tag)});this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")},_fetchMemberSuccess:function(r){if(r[0]!=i&&r.length>0?(this._currentMembers=r[0].Value,r[1]!=null&&r[1]!=i&&(this.model.customObject=r[1].Value)):r.d!=i&&r.d.length>0?(this._currentMembers=r.d[0].Value,r.d[1]!=null&&r.d[1]!=i&&(this.model.customObject=r.d[1].Value)):r!=i&&r.length>0?(this._currentMembers=r.EditorTreeInfo,r!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)):r!=i&&(this._currentMembers=r.EditorTreeInfo,r!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)),this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"fetchMembers",element:this.element,customObject:this.model.customObject}),this._createDialog(this._dialogHead,this._currentMembers),this.model.pivotControl._waitingPopup){var u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(u)||(u._isTimeOut=!1);this.model.pivotControl._waitingPopup.hide()}this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style");t.isNullOrUndefined(this.element.find(".e-dialog .e-text:visible").first())||this.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell")},_droppedSuccess:function(r){var u=null;this.model.pivotControl.model.enableDeferUpdate?u=this._removeButtonDeferUpdate==!1?t.isNullOrUndefined(r.OlapReport)?JSON.parse(r.d[0].Value):JSON.parse(r.OlapReport):u=t.isNullOrUndefined(r.OlapReport)?r.d[0].Value:r.OlapReport:(!t.isNullOrUndefined(r[0])&&r.length>0?(u=JSON.parse(r[1].Value),r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value)):!t.isNullOrUndefined(r.d)&&r.d.length>0?(u=n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value):JSON.parse(r.d[1].Value),r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value)):t.isNullOrUndefined(r)||t.isNullOrUndefined(r.OlapReport)?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.PivotReport)||(u=JSON.parse(r.PivotReport)):u=JSON.parse(r.OlapReport),r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject));this._removeButtonDeferUpdate==!1&&(this.element.find(".axisTable .pivotButton").remove(),this._setPivotRows(u.PivotRows),this._setPivotColumns(u.PivotColumns),this._setPivotCalculations(u.PivotCalculations),this._setFilters(u.Filters),this.model.pivotControl.setOlapReport(JSON.stringify(u)),this._refreshPivotButtons(),this.model.enableDragDrop&&this.element.find(".pivotButton .pvtBtn").ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)}),this._unWireEvents(),this._wireEvents());this.model.pivotControl.model.enableDeferUpdate?(t.isNullOrUndefined(this.model.pivotControl._ogridWaitingPopup)||this.model.pivotControl._ogridWaitingPopup.hide(),t.isNullOrUndefined(r.OlapReport)?(this.model.pivotControl.setOlapReport(r.d[0].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(r.d[2].Value),JSON.parse(r.d[1].Value))):(this.model.pivotControl.setOlapReport(r.OlapReport),r.HeaderCounts!=i&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this.model.pivotControl._pagerObj.initPagerProperties(JSON.parse(r.HeaderCounts),JSON.parse(r.PageSettings))),this._removeButtonDeferUpdate=!1,this.model.pivotControl._deferUpdateSuccess(r)):n(this.element).parents(".e-pivotclient").length>0&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this.model.pivotControl.refreshControl(r),this.model.pivotControl&&this.model.pivotControl._pivotGrid&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl._pivotGrid._removeCells(r)):this.model.pivotControl._renderControlSuccess(r);this.model.afterServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style");this._createContextMenu();this._setPivotBtnWidth()},_removePvtBtn:function(i){var f,u,o,e,s,r;this.model.pivotControl._waitingPopup.show();n(i.element).length>0?(f=n(i.element).parent().attr("tag").split(":")[1],u=n(i.element).parent().attr("tag")):(f=n(i.target).parent().attr("tag").split(":")[1],u=n(i.target).parent().attr("tag"));try{o=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(h){t.isNullOrUndefined(this.model.pivotControl.getOlapReport)||(o=this.model.pivotControl.getOlapReport())}if(o==""&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(o=this.model.pivotControl.model.dataSource),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap)if(this._clearFilterData(f),e=u.indexOf("[Measures]")>-1||u.indexOf("[")>-1?u.split(":")[1]:this.model.pivotControl._getNodeUniqueName(u),e=e.indexOf("<>")?e.replace("<>","."):e,e=="[Measures]"){if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)t.Pivot.removeReportItem(this.model.pivotControl.model.dataSource,f,f.toLocaleLowerCase().indexOf("measures")==0),this.model.pivotControl.refreshControl(),this.refreshControl();else if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode){for(n(i.element).length>0?n(i.element).parent().parent().remove():n(i.target).parent().parent().remove(),r=0;r<this.model.pivotCalculations.length&&u.indexOf(this._getLocalizedLabels("Measures"))>-1;r++)e=this.model.pivotCalculations[r].Tag,this._isMeasureBtnRemove=!0,selectedTreeNode=this.model.pivotControl._getNodeByUniqueName(e),this._tableTreeObj.uncheckNode(selectedTreeNode);this.element.find(".schemaNoClick").addClass("freeze").width(n(this.element).width()).height(n(this.element).height()).css({top:n(this.element).offset().top,left:n(this.element).offset().left});this.model.beforeServiceInvoke!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:"removeButton",element:this.element,customObject:this.model.pivotControl.model.customObject});s=JSON.stringify({action:"removeButton",headerInfo:u,currentReport:o,customObject:JSON.stringify(this.model.pivotControl.model.customObject),gridLayout:this.model.pivotControl.model.layout});u.indexOf("[Measures]")<0&&u.indexOf("Measures")>=0&&this.element.find(".schemaValue .pivotButton").remove();this.model.pivotControl.model.enableDeferUpdate?(this._removeButtonDeferUpdate=!0,this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,s.replace("removeButton","removeButtonDeferUpdate"),this._droppedSuccess),this.element.find(".schemaNoClick").removeClass("freeze").removeAttr("style")):this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.removeButton,s,this._pvtBtnDroppedSuccess)}}else selectedTreeNode=this.model.pivotControl._getNodeByUniqueName(e),this._tableTreeObj.uncheckNode(selectedTreeNode);else if(this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode){if(t.PivotAnalysis._valueSorting=null,f=n(i.element).length>0?n(i.element).parent().find(".pvtBtn").attr("fieldname"):n(i.target).parent().find(".pvtBtn").attr("fieldname"),this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap){if(u.split(":")[1].toLowerCase()=="measures"){for(this.model.pivotControl._ogridWaitingPopup.show(),this.element.find("div[tag='"+u+"']").remove(),r=0;r<this.model.pivotControl.model.dataSource.values[0].measures.length;r++)this._nodeCheck=!0,selectedTreeNode=this._tableTreeObj.element.find("li[tag='"+this.model.pivotControl.model.dataSource.values[0].measures[r].fieldName+"']"),this._tableTreeObj.uncheckNode(selectedTreeNode),this.element.find("div[tag='values:"+this.model.pivotControl.model.dataSource.values[0].measures[r].fieldName+"']").remove();this.model.pivotControl.model.dataSource.values[0].measures=[];t.olap.base.getJSONData({action:"removeButton"},this.model.pivotControl.model.dataSource,this.model.pivotControl)}if(selectedTreeNode=this._tableTreeObj.element.find("li[tag='"+f+"']"),selectedTreeNode.length>1)for(r=0;r<selectedTreeNode.length;r++)this._tableTreeObj.isNodeChecked(selectedTreeNode[r])&&(selectedTreeNode=selectedTreeNode[r])}else selectedTreeNode=this._tableTreeObj.element.find("li[id="+f+"]");this._tableTreeObj.uncheckNode(selectedTreeNode)}else selectedTreeNode=this._tableTreeObj.element.find("li:contains('"+f+"')"),this._tableTreeObj.uncheckNode(selectedTreeNode)},_createDialog:function(i,r){var s,nt,h,c,o,l,y,tt,p,u,rt,a,b;this.element.find(".e-dialog, .clientDialog").remove();var v,f,k="",d="",g="",e=this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.pivotControl.model.enableAdvancedFilter||this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.model.dataSource.enableAdvancedFilter&&t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).axis!="filters"&&t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).axis!="values"&&!t.isNullOrUndefined(t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource,this._dataModel).item)?!0:!1;e&&(s=JSON.parse(r),s[0].name="(Select All)",v=this._selectedFieldName,this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(f=n.map(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName==v)return n.dropdownData}),f.length==0&&(f=n.map(this._tableTreeObj.element.find("li[tag ='"+this._selectedFieldName+"'] li"),function(t){return{value:n(t).attr("tag"),text:n(t).find("a").text()}}))):f=[{value:this._selectedFieldName,text:this._selectedFieldName}]:this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap?(f=s.splice(s.length-1,1),f=JSON.parse(f[0].levels)):f=[{value:this._curFilteredText,text:this._curFilteredText}],r=JSON.stringify(s),k=t.buildTag("div.ddlGroupWrap",this._getLocalizedLabels("SelectField")+":"+t.buildTag("input#"+this._id+"_GroupLabelDrop.groupLabelDrop").attr("type","text")[0].outerHTML,{})[0].outerHTML,d=t.buildTag("ul.filterElementTag")[0].outerHTML,nt=t.Pivot.createAdvanceFilterTag({action:"filterTag"},this));g=t.buildTag("div.memberSearchEditorDiv",t.buildTag("input#"+this._id+"_SearchEditorTreeView.searchEditorTreeView").attr("type","text")[0].outerHTML+(this.model.pivotControl.model.enableMemberEditorPaging&&n.parseJSON(r).length>=this.model.pivotControl.model.memberEditorPageSize?t.buildTag("span.e-icon searchEditorTree",{})[0].outerHTML:""),{padding:this.model.pivotControl.model.enableAdvancedFilter?"5px 5px 0px 9px":0})[0].outerHTML;var ut=t.buildTag("div#"+this._id+"_EditorDiv.editorDiv",k+d+t.buildTag("div",g+t.buildTag("div.memberEditorDiv",t.buildTag("div#editorTreeView.editorTreeView")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML+"<\/br>",ft=t.buildTag("div",t.buildTag("button#"+this._id+"_OKBtn.dialogOKBtn",this._getLocalizedLabels("OK"))[0].outerHTML+t.buildTag("button#CancelBtn.dialogCancelBtn",this._getLocalizedLabels("Cancel"))[0].outerHTML,{float:"right",margin:(!t.isNullOrUndefined(r)&&n.parseJSON(r).length>=this.model.pivotControl.model.memberEditorPageSize?"10px":"-5px ")+" "+(e?" 5px ":" 0px ")+" 6px 0px"})[0].outerHTML,et=t.buildTag("div.memberPager",t.buildTag("div#"+this._id+"_NextpageDiv.nextPageDiv",t.buildTag("div.e-icon e-media-backward_01 firstPage",{})[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-left prevPage",{})[0].outerHTML+t.buildTag("input.memberCurrentPage#memberCurrentPage",{},{width:"20px",height:"10px"})[0].outerHTML+t.buildTag("span.memberPageCount#memberPageCount")[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-right nextPage",{})[0].outerHTML+t.buildTag("div.e-icon e-media-forward_01 lastPage",{})[0].outerHTML)[0].outerHTML)[0].outerHTML,ot=t.buildTag("div#"+(e?"clientDialog":this._id+"_clientDialog")+".clientDialog",ut+(!t.isNullOrUndefined(r)&&this.model.pivotControl.model.enableMemberEditorPaging&&(n.parseJSON(r).length>=this.model.pivotControl.model.memberEditorPageSize||this.model.pivotControl.model.memberEditorPageSize<this.model.pivotControl._memberPageSettings.endPage)?et:"")+ft,{opacity:"1"}).attr("title",i)[0].outerHTML,r=JSON.parse(r),h;for(u=0;u<r.length;u++)r[u].name!=null&&r[u].name.toString().replace(/^\s+|\s+$/gm,"")||(r[u].name="(blank)",r[u].id="(blank)");if(this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode?!t.isNullOrUndefined(this.model.pivotControl._fieldMembers):!t.isNullOrUndefined(this._tempFilterData)){if(this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Olap&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ServerMode)for(u=0;u<Object.keys(this.model.pivotControl._fieldMembers).length;u++)t.isNullOrUndefined(this.model.pivotControl._fieldMembers[this._curFilteredText])||(h=n.map(this.model.pivotControl._fieldMembers[this._curFilteredText],function(n){if(!n.checked)return n.name}));else for(u=0;u<this._tempFilterData.length;u++)t.isNullOrUndefined(this._tempFilterData[u][i])||(h=this._tempFilterData[u][i]);if(!t.isNullOrUndefined(h))for(u=0;u<h.length;u++)for(c=0;c<r.length;c++)h[u]==r[c].name&&(r[c].checkedStatus=!1)}for(n(ot).appendTo("#"+this._id),this.model.pivotControl.model.enableMemberEditorPaging&&(r.length>=this.model.pivotControl.model.memberEditorPageSize||this.model.pivotControl.model.memberEditorPageSize<this.model.pivotControl._memberPageSettings.endPage)&&(this.element.find(".prevPage, .firstPage").addClass("pageDisabled"),this.element.find(".nextPage, .lastPage").addClass("pageEnabled"),o=this._memberCount/this.model.pivotControl.model.memberEditorPageSize,o!=Math.round(o)&&(o=parseInt(o)+1),this.element.find(".memberPageCount").html("/ "+o),this.element.find(".memberCurrentPage").val(this.model.pivotControl._memberPageSettings.currentMemeberPage),this.model.pivotControl._memberPageSettings.currentMemeberPage>1?this.element.find(".prevPage, .firstPage").removeClass("pageDisabled").addClass("pageEnabled"):this.element.find(".prevPage, .firstPage").removeClass("pageEnabled").addClass("pageDisabled"),this.model.pivotControl._memberPageSettings.currentMemeberPage==parseInt(this.element.find(".memberPageCount").text().split("/")[1].trim())?this.element.find(".nextPage, .lastPage").removeClass("pageEnabled").addClass("pageDisabled"):this.element.find(".nextPage, .lastPage").removeClass("pageDisabled").addClass("pageEnabled"),this.element.find(".nextPageDiv .pageDisabled").css("opacity","0.5")),this.element.find("#"+this._id+"_SearchEditorTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search")+" "+i,maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:!this.model.pivotControl.model.enableMemberEditorPaging||this.element.find(".nextPageDiv").length==0?t.proxy(t.Pivot._searchTreeNodes,this):t.proxy(function(n){t.isNullOrUndefined(n.value)&&t.Pivot._searchEditorTreeNodes(n,this.model.pivotControl)},this)}),this.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:this.model.enableRTL,beforeDelete:function(){return!1},height:n(".memberEditorDiv").height(),fields:{id:"id",text:"name",isChecked:"checkedStatus",hasChild:"hasChildren",dataSource:r}}),e&&(this.element.find(".filterElementTag").ejMenu({fields:{dataSource:nt,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.NormalMenu,width:"100%",enableRTL:this.model.enableRTL,orientation:t.Orientation.Vertical,click:t.proxy(this._filterElementClick,this)}),this.element.find(".groupLabelDrop").ejDropDownList({width:"99%",enableRTL:this.model.enableRTL,dataSource:f,fields:{id:"id",text:"text",value:"value"},change:t.proxy(this._groupLabelChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),l=t.isNullOrUndefined(this._selectedLevel)?"":this._selectedLevel,l=n.map(f,function(n){if(n.value.toLowerCase()==l.toLowerCase())return n.text}),y=this.element.find(".groupLabelDrop").data("ejDropDownList"),y.selectItemByText(l.length>0?l[0]:y.model.dataSource[0].text),this.element.find(".memberEditorDiv").addClass("advancedFilter")),tt=n.grep(r,function(n){if(n.hasChildren==!0)return n}).length>0,tt||this.element.find(".memberEditorDiv").addClass("noChildNode"),p=this.element.find(".editorTreeView").find("li"),u=0;u<p.length;u++)p[u].setAttribute("tag",r[u].tag);this.element.find(".dialogOKBtn, .dialogCancelBtn").ejButton({type:t.ButtonType.Button,click:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._clientDialogBtnClick:this._dialogBtnClick,this)});this._dialogOKBtnObj=this.element.find(".dialogOKBtn").data("ejButton");this._memberTreeObj=this.element.find(".editorTreeView").data("ejTreeView");var it=this.element.find(".editorTreeView li:gt(0)"),w=n(this._memberTreeObj.element.find("li:first")).find("div .e-chkbox-small > span > span:eq(0)"),st=n(it).find(":input.nodecheckbox:not(:checked)");st.length>0&&n(w).removeClass("e-checkmark").addClass("e-stop");!t.isNullOrUndefined(this.model.pivotControl)&&this.model.pivotControl.model.enableMemberEditorPaging&&(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.pivotControl.element.find(".memberPager").css("margin-top","0px"),this.model.pivotControl._isAllMemberChecked||(this._dialogOKBtnObj.disable(),this.element.find(".dialogOKBtn").attr("disabled","disabled"),n(w).removeClass("e-checkmark").removeClass("e-stop").addClass("e-chk-inact")));!t.isNullOrUndefined(this.model.pivotControl._unSelectedNodes)&&this.model.pivotControl._isMemberPageFilter&&(rt=this.model.pivotControl._unSelectedNodes,n.map(it,function(t){var i=t;n.map(rt,function(t){n(i).attr("tag")==t.tag&&(n(n(i).find("div .e-chkbox-small > span > span:eq(0)")).removeClass("e-checkmark"),n(w).removeClass("e-checkmark").addClass("e-stop"))})}));this.element.find(".clientDialog").ejDialog({width:e?"auto":265,target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL,close:t.proxy(t.Pivot.closePreventPanel,this)});this.element.find(".clientDialog").next(".e-scrollbar").hide();this.element.find(".e-dialog .e-close").attr("title",this._getLocalizedLabels("Close"));e&&(this.element.find("#clientDialog_wrapper").addClass("advancedFilterDlg"),this.element.find("#clientDialog_wrapper").css("min-width","265px"),this._droppedClass!="schemaFilter"&&(this.element.find(".clientDialog").css("padding","0px").parents().parents().find(".e-titlebar").remove(),a=t.Pivot.getReportItemByFieldName(v,this.model.pivotControl.model.dataSource).item,a&&a.sortOrder&&a.sortOrder!=t.olap.SortOrder.None&&(b=a.sortOrder==t.olap.SortOrder.Descending?"desc":"asc",t.isNullOrUndefined(b)||b=="asc"?this.element.find(".clientDialog .ascImage").addClass("selectedSort"):this.element.find(".clientDialog .descImage").addClass("selectedSort"))));this._memberTreeObj.model.nodeCheck=t.proxy(this._nodeCheckChanges,this);this._memberTreeObj.model.nodeUncheck=t.proxy(this._nodeCheckChanges,this);this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this._memberTreeObj.model.beforeExpand=t.proxy(this._beforeNodeExpand,this):this._memberTreeObj.model.nodeClick=t.proxy(this._nodeExpand,this);this._memberTreeObj.element.find(".e-plus").length==0&&this._memberTreeObj.element.find(".e-item").css("padding","0px");this._isFiltered=!1;this.model.pivotControl._isMemberPageFilter=!1;t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide();t.isNullOrUndefined(pschemaDesignerWaitingPopup)||pschemaDesignerWaitingPopup.hide()},_applySorting:function(){var i=JSON.stringify(this.model.pivotControl.model.customObject),n,r;try{n=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(u){n=this.model.pivotControl.getOlapReport()}this.model.pivotControl.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"sorting",element:this.element,customObject:this.model.customObject});i=JSON.stringify(this.model.pivotControl.model.customObject);r=JSON.stringify({action:"sorting",sortedHeaders:this.model.pivotControl._ascdes,currentReport:n,valueSorting:JSON.stringify(this.model.pivotControl.model.valueSortSettings),customObject:i});this._waitingPopup=this.element.data("ejWaitingPopup");t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show();this.model.pivotControl.model.enableDeferUpdate?t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide():this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.sorting,r,this._filterElementSuccess)},_filterElementClick:function(r){var f=this._selectedFieldName,h,s,l,p,c,e,w,o,u;if(this._filterAction=t.isNullOrUndefined(r.element)?r.menuId=="valueFilterBtn"?"valueFiltering":r.menuId=="labelFilterBtn"?"labelFiltering":"":n(r.element).parents("li:eq(0)#valueFilterBtn").length==0?"labelFiltering":"valueFiltering",h=this.element.find(".groupLabelDrop").data("ejDropDownList"),this._selectedLevelUniqueName=h.getSelectedValue(),this.model.pivotControl._selectedField=this._selectedFieldName,this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode){if(this.model.pivotControl._selectedField=this.model.pivotControl._curFilteredText=this._curFilteredText,this.model.pivotControl._curFilteredAxis=this._curFilteredAxis,this._selectedField=this._curFilteredText,this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Olap)this.model.pivotControl._filterElementClick(r,this);else{try{s=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(b){s=this.model.pivotControl.getOlapReport()}if(u=[],l=this._selectedLevelUniqueName,n(r.element).find(".descImage").length>0||n(r.element).find(".ascImage").length>0||n(r.element).find(".e-clrSort").length>0)return t.isNullOrUndefined(this.model.pivotControl._ascdes)&&(this.model.pivotControl._ascdes=""),this.model.pivotControl._ascdes.indexOf(this._selectedField)>-1?this.model.pivotControl._ascdes=this.model.pivotControl._ascdes.replace(this._selectedField+"##",""):n(r.element).find(".e-clrSort").length==0&&(this.model.pivotControl._ascdes=this.model.pivotControl._ascdes+this._selectedField+"##"),this._applySorting(r),!1;if(n(r.element).find(".e-clrFilter").length>0){this.model.pivotControl._removeFilterTag(this._selectedLevelUniqueName);var a=this._selectedField+"::"+this._curFilteredText+"## Clear Filter"+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),v=JSON.stringify(this.model.customObject),y=JSON.stringify({action:this._filterAction.toLowerCase(),filterParams:a,sortedHeaders:this._ascdes,currentReport:s,customObject:v,gridLayout:this.model.pivotControl.model.layout});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,y,this._filterElementSuccess)}else t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:r,filterInfo:u},this)}return!1}if(n(r.element).attr("id")=="clearAllFilters"?this._clearAllFilter(r):n(r.element).attr("id")=="clearSorting"?this.model.pivotControl._clearSorting(r):(n(r.element).attr("id")=="ascOrder"||n(r.element).attr("id")=="descOrder")&&this._sortField(r),!n(r.element).parent().hasClass("filterElementTag")){if(this.element.find(".e-dialog, .filterDialog, #preventDiv").remove(),n.trim(r.text)==n.trim(this._getLocalizedLabels("ClearFilter")))return this._clearFilter(f,this._selectedLevelUniqueName,this.model.pivotControl.model.dataSource),this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()!=f.toLowerCase())return n}),this.model.pivotControl.refreshControl()):t.olap.base.getJSONData({action:"advancedfiltering"},this.model.pivotControl.model.dataSource,this.model.pivotControl),!1;p=!1;c=this._selectedLevelUniqueName;this.model.pivotControl&&(this.model.pivotControl._selectedLevelUniqueName=this._selectedLevelUniqueName);e=this._getAdvancedFiltervalue(f,this._selectedLevelUniqueName);w="";e=n(r.element).find(".activeFilter").length>0&&e.length>0?e[0].values:[""];o=t.Pivot.getReportItemByFieldName(f,this.model.pivotControl.model.dataSource).item;u=[];o&&o.advancedFilter&&(u=n.map(o.advancedFilter,function(n){if(n.name!=i&&n.name.toLowerCase()!=c)return n}));t.Pivot.createAdvanceFilterTag({action:this._filterAction=="labelFiltering"?"labelFilterDlg":"valueFilterDlg",selectedArgs:r,filterInfo:u},this)}},_getAdvancedFiltervalue:function(r,u){if(!(this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode)){var f=t.Pivot.getReportItemByFieldName(r,this.model.pivotControl.model.dataSource,"XMLA").item,e=[];return f.advancedFilter&&(e=n.map(f.advancedFilter,function(n){if(n.name!=i&&n.name.toLocaleLowerCase()==u.toLowerCase())return n})),e}return[]},_filterOptionChanged:function(i){var r=this._getAdvancedFiltervalue(this._selectedFieldName,this._selectedLevelUniqueName),u;r=r.length>0?r[0].advancedFilterType=="label"&&i.value.replace(/ /g,"")==r[0].labelFilterOperator?r[0].values:r[0].advancedFilterType=="value"&&i.value.replace(/ /g,"")==r[0].valueFilterOperator?r[0].values:[""]:[""];u=this.element.find(".filterValuesTd")[0];i.value.toLowerCase().indexOf("between")>=0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/> <span>"+this._getLocalizedLabels("and")+"<\/span> <input type='text' id='filterValue2' value='"+(t.isNullOrUndefined(r[1])?"":r[1])+"' class='filterValues' style='display:inline' /> <\/br>");i.value.toLowerCase().indexOf("between")<0&&n(u).html("<input type='text' id='filterValue1' class='filterValues' value='"+r[0]+"' style='display:inline'/>")},_removeFilterTag:function(i){var r=this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot,u;(i.indexOf("].")>=0||r)&&(u=i.split("].").length>2||r?"levelUniqueName":"hierarchyUniqueName",this._excelFilterInfo.length>0&&(levelName=this._selectedLevelUniqueName,hierarchyName=this._selectedFieldName,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n[u]!=i)return n})))},_filterElementOkBtnClick:function(){var f=this.element.find(".filterOptions")[0].value,r=[this.element.find("#filterValue1")[0].value],o=[],l=this._selectedFieldName,p=this._selectedLevelUniqueName.toLowerCase(),s,h,e,c,u;if(this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode){h="";e="";try{s=JSON.parse(this.model.pivotControl.getOlapReport()).Report}catch(w){s=this.model.pivotControl.getOlapReport()}if(this._removeFilterTag(this._selectedLevelUniqueName),this.model.pivotControl.element.find(".reportlist")&&(h=this.model.pivotControl.element.find(".reportlist").data("ejDropDownList").model.value),t.isNullOrUndefined(this._excelFilterInfo)&&(this._excelFilterInfo=[]),this._filterAction=="labelFiltering"){this.model.pivotControl._excelFilterInfo.push({report:h,action:this._filterAction,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:f,measure:e,value1:"",value2:""});c=this._curFilteredText;this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[c])return n});var a=this._curFilteredAxis+"::"+this._curFilteredText+"##"+f+"::"+r[0]+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),v=JSON.stringify(this.model.customObject),y=JSON.stringify({action:this._filterAction,filterParams:a,sortedHeaders:this._ascdes,currentReport:s,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:v,gridLayout:this.model.pivotControl.model.layout});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,y,this._filterElementSuccess)}else{c=this._curFilteredText;this.model.pivotControl._excelFilterInfo.push({report:h,action:this._filterAction,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:f,measure:e,value1:"",value2:""});this._tempFilterData=n.map(this._tempFilterData,function(n){if(!n[c])return n});this._measureDDL=this.element.find(".filterMeasures").data("ejDropDownList");e=this._measureDDL.getSelectedValue();var a=this._curFilteredText+"::"+f+"::"+e+"::"+r[0]+"::"+(this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:"")+(this.model.pivotControl&&n(this.model.pivotControl.element).hasClass("e-pivotclient")&&!t.isNullOrUndefined(this.model.pivotControl._ascdes)&&this.model.pivotControl.model.enableAdvancedFilter?">>#>#>>"+this.model.pivotControl._ascdes:""),v=JSON.stringify(this.model.customObject),y=JSON.stringify({action:this._filterAction,filterParams:a,sortedHeaders:this._ascdes,currentReport:s,valueSorting:JSON.stringify(this.model.valueSortSettings),customObject:v,gridLayout:this.model.layout});this.doAjaxPost("POST",this.model.pivotControl.model.url+"/"+this.model.serviceMethods.filtering,y,this._filterElementSuccess)}return!1}if(this._filterAction=="valueFiltering"){if(!(!isNaN(parseFloat(r[0]))&&isFinite(r[0]))||this._measureDDL.getSelectedValue()=="")return;this.element.find("#filterValue2")[0]!=i?","+r.push(this.element.find("#filterValue2")[0].value):r}this.element.find(".e-dialog").remove();u=t.Pivot.getReportItemByFieldName(l,this.model.pivotControl.model.dataSource).item;u&&(delete u.filterItems,u.advancedFilter&&(o=n.map(u.advancedFilter,function(n){if(n.name!=i&&n.name.toLocaleLowerCase()!=p.toLowerCase())return n})),this._filterAction.toLowerCase()=="labelfiltering"?o.push({name:this._selectedLevelUniqueName,labelFilterOperator:f.replace(/ /g,""),advancedFilterType:t.olap.AdvancedFilterType.LabelFilter,values:r}):o.push({name:this._selectedLevelUniqueName,valueFilterOperator:f.replace(/ /g,""),advancedFilterType:t.olap.AdvancedFilterType.ValueFilter,values:r,measure:this._measureDDL.getSelectedValue()}),this.model.pivotControl._currentReportItems=n.grep(this.model.pivotControl._currentReportItems,function(n){if(n.fieldName!=l)return n}),u.advancedFilter=o);this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()!=l.toLowerCase())return n}),this._filterAction!="valueFiltering"||t.isNullOrUndefined(u)||t.PivotAnalysis._valueFilterArray.push(u),this.model.pivotControl.refreshControl()):t.olap.base.getJSONData({action:"advancedfiltering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)},_groupLabelChange:function(i){var r=this.element.find(".filterElementTag").data("ejMenu"),u,o,y,f,s,p,h;if(r.disableItemByID("labelClearFilter"),r.disableItemByID("valueClearFilter"),r.disableItemByID("clearAllFilters"),r.disableItemByID("clearSorting"),this.model.pivotControl&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode)return this.model.pivotControl._selectedLevelUniqueName=i.selectedValue,u=[],o=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,this.model.pivotControl._excelFilterInfo.length>0&&(s=this.model.pivotControl._selectedLevelUniqueName,y=this.model.pivotControl._selectedFieldName,u=n.map(this.model.pivotControl._excelFilterInfo,function(n){if(n.hierarchyUniqueName==y&&n.levelUniqueName==s)return{action:n.action,operator:n.operator,value1:n.value1}})),this.element.find(".filterElementTag .activeFilter,.filterState").remove(),this.element.find("#labelClearFilter ,#valueClearFilter").css("opacity","0.5").attr("disable",!0),u.length>0&&!t.isNullOrUndefined(u[0].operator)?(f=u[0].action.toLowerCase()=="valuefiltering"?"valueFilterBtn":"labelFilterBtn",f=="labelFilterBtn"?r.enableItemByID("labelClearFilter"):r.enableItemByID("valueClearFilter"),r.enableItemByID("clearAllFilters"),this.element.find("#"+f+" a:eq(0)").append(o),this.element.find("#"+f+" #labelClearFilter").removeAttr("style disable"),this.element.find("#"+f+" #valueClearFilter").removeAttr("style disable"),u[0].operator.replace(/ /g,"")=="BottomCount"?this.element.find("#"+f+" li#"+u[0].operator.replace(/ /g,"").replace("Bottom","top")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML)):this.element.find("#"+f+" li#"+u[0].operator.replace(/ /g,"")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML))):this._getUnSelectedNodes()!=""&&this.element.find(".memberEditorDiv").before("<div class='filterState e-icon' style='top:126px;position:absolute;visibility:hidden' />"),this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(h=this.element.find("#clearAllFilters a").children().clone(),this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(h),s=this.model.pivotControl._curFilteredText,p=t.isNullOrUndefined(this.model.pivotControl._ascdes)?[]:n.grep(this.model.pivotControl._ascdes.split("##"),function(n){if(n==s)return n}),p.length>0?(this.element.find(".descImage").addClass("selectedSort"),r.enableItemByID("clearSorting")):this.element.find(".ascImage").addClass("selectedSort")),!1;var e=this,b=this.element.find(".groupLabelDrop").length>0?this.element.find(".groupLabelDrop").data("ejDropDownList"):[],c=e._getAdvancedFiltervalue(e._selectedFieldName,b.getSelectedValue()),r=this.element.find(".filterElementTag").data("ejMenu"),l=t.Pivot.getReportItemByFieldName(e._selectedFieldName,e.model.pivotControl.model.dataSource).item,o=t.buildTag("span.filterState").addClass("e-icon").attr("aria-label","filter state")[0].outerHTML,w=t.buildTag("span.activeFilter").addClass("e-icon")[0].outerHTML,a=t.Pivot.getReportItemByFieldName(e._selectedFieldName,e.model.pivotControl.model.dataSource).item,v;a&&(a.sortOrder&&a.sortOrder!=t.olap.SortOrder.None?(v=a.sortOrder==t.olap.SortOrder.Descending?"desc":"asc",t.isNullOrUndefined(v)||v=="asc"?this.element.find(".clientDialog .ascImage").addClass("selectedSort"):(this.element.find(".clientDialog .descImage").addClass("selectedSort"),r.enableItemByID("clearSorting"))):this.element.find("#clearSorting").css("opacity","0.5").attr("disabled","disabled"));this.element.find("#clearAllFilters").css("opacity","0.5").attr("disabled","disabled");this.element.find(".filterState,.activeFilter").remove();h=this.element.find("#clearAllFilters a").children().clone();this.element.find("#clearAllFilters a").text(this._getLocalizedLabels("ClearFilter")+' from "'+i.text+'"').append(h);c.length>0?(c[0].advancedFilterType==t.olap.AdvancedFilterType.LabelFilter?(this.element.find("#labelFilterBtn a:eq(0)").append(o),this.element.find("#labelFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#labelFilterBtn li#"+c[0].labelFilterOperator+" a").append(w),r.enableItemByID("labelClearFilter")):(this.element.find("#valueFilterBtn a:eq(0)").append(o),this.element.find("#valueFilterBtn .clearFilter").css("opacity","1").removeAttr("disabled"),this.element.find("#valueFilterBtn li#"+c[0].valueFilterOperator+" a").append(w),r.enableItemByID("valueClearFilter")),r.enableItemByID("clearAllFilters"),this.element.find("#clearAllFilters").css("opacity","1").removeAttr("disabled")):(l.length>0&&l[0].filterItems||this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&l&&l.filterItems)&&(this.element.find(".memberEditorDiv").before(o),this.element.find(".filterState").addClass("memberFilter").css("visibility","hidden"),this.element.find("#clearAllFilters").css("opacity","1").removeAttr("disabled"))},_clearAllFilter:function(){var r,u;t.Pivot.closePreventPanel(this);this.element.find(".e-dialog").remove();this._clearFilter(this._selectedFieldName,this._selectedLevelUniqueName,this.model.pivotControl.model.dataSource);r=t.Pivot.getReportItemByFieldName(this._selectedFieldName,this.model.pivotControl.model.dataSource);r&&r.item&&r.item.filterItems&&(r.item.filterItems.values=[]);this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(u=this._selectedFieldName,t.PivotAnalysis._valueFilterArray=n.grep(t.PivotAnalysis._valueFilterArray,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()!=u.toLowerCase())return n}),this.model.pivotControl.refreshControl()):t.olap.base.getJSONData({action:"advancedfiltering"},this.model.pivotControl.model.dataSource,this.model.pivotControl)},_clearFilter:function(r,u,f){var e=t.Pivot.getReportItemByFieldName(r,f);e.item&&e.item.advancedFilter&&(u=this.model.pivotControl&&this.model.pivotControl.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ClientMode?r:u,e.item.advancedFilter=n.map(e.item.advancedFilter,function(n){if(n.name!=i&&n.name.toLowerCase()!=u.toLowerCase())return n}))},_createPivotButton:function(i,r,u,f,e){var l="",a="",o,c,w,b,k;if(u&&(l="filtered"),f&&(a="descending"),o=r=="row"?".schemaRow":r=="column"?".schemaColumn":r=="value"?".schemaValue":".schemaFilter",this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)var h=r=="column"?"columns":r=="row"?"rows":r=="filter"?"filters":"values",v=(r=="column"||r=="row")&&this.model.layout!="excel"&&this._dataModel!="Olap"&&this._dataModel!="XMLA"?t.buildTag("span.sorting e-icon "+a).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",y=(r=="column"||r=="row"||r=="filter")&&this.model.layout!="excel"&&i.fieldCaption!="Measures"?t.buildTag("span.filter e-icon "+l).attr("role","button").attr("aria-label","filter")[0].outerHTML:"",p=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"",s=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+i.fieldName,this.model.pivotControl._dataModel!="XMLA"?n.grep(this.model.pivotTableFields,function(n){return n.name==i.fieldName})[0].caption:i.fieldCaption,{},{fieldName:i.fieldName,fieldCaption:i.fieldCaption,axis:h})[0].outerHTML+y+v+p).attr("tag",h+":"+i.fieldName)[0].outerHTML).attr("tag",h+":"+i.fieldName)[0].outerHTML;else{c="";w={DimensionHeader:i.fieldCaption,Tag:i.fieldName};t.isNullOrUndefined(this.model.pivotControl)||r!="filter"||(c=t.Pivot._getFilterState("",[],w,this.model.pivotControl));var h=r=="column"?"columns":r=="row"?"rows":r=="filter"?this.model.pivotControl.model.analysisMode==t.PivotGrid.AnalysisMode.Pivot?"filters":"slicers":"values",v=(r=="column"||r=="row")&&this.model.layout!="excel"&&this._dataModel!="Olap"&&this._dataModel!="XMLA"?t.buildTag("span.sorting e-icon "+a).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",y=(r=="column"||r=="row"||r=="filter")&&this.model.layout!="excel"&&i.fieldCaption!="Measures"?t.buildTag("span.filter e-icon "+l).attr("role","button").attr("aria-label","filter")[0].outerHTML:"",p=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"",s=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+i.fieldName,(this._dataModel=="Pivot"?i.fieldCaption:i=="Measures"?i:!t.isNullOrUndefined(i.fieldCaption)&&i.fieldCaption!=""?i.fieldCaption:i.fieldName.split(".")[1])+(c!=""?" ("+c+")":""),{},{fieldName:i.fieldName,fieldCaption:i.fieldCaption,axis:h})[0].outerHTML+y+v+p).attr("tag",h+":"+i.fieldName)[0].outerHTML).attr("tag",h+":"+(t.isNullOrUndefined(i.fieldName)?i:i.fieldName))[0].outerHTML}typeof e=="number"&&n(this.element.find(o+" .pivotButton")[e]).length>0?r=="row"?n(this.element.find(".schemaRow .pivotButton")[e]).before(s):r=="column"?n(this.element.find(".schemaColumn .pivotButton")[e]).before(s):r=="value"?n(this.element.find(".schemaValue .pivotButton")[e]).before(s):r=="filter"?n(this.element.find(".schemaFilter .pivotButton")[e]).before(s):"":r=="row"?this.element.find(".schemaRow").append(s):r=="column"?this.element.find(".schemaColumn").append(s):r=="value"?this.element.find(".schemaValue").append(s):r=="filter"?this.element.find(".schemaFilter").append(s):"";b=typeof e!="number"&&e==""?" .pivotButton .pvtBtn:last":" .pivotButton .pvtBtn:eq("+e+")";this.model.enableDragDrop&&this.element.find(o+b).ejButton({size:"normal",type:t.ButtonType.Button,enableRTL:this.model.enableRTL}).ejDraggable({handle:"button",clone:!0,cursorAt:{left:-5,top:-5},dragStart:t.proxy(function(){this._isDragging=!0},this),dragStop:t.proxy(this.model.pivotControl.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._pvtBtnDropped:this._clientOnPvtBtnDropped,this),helper:t.proxy(function(t){if(n(t.element).addClass("dragHover"),t.sender.target.className.indexOf("e-btn")>-1){var i=n(t.sender.target).clone().attr("id",this._id+"_dragClone").appendTo("body");return n("#"+this._id+"_dragClone").removeAttr("style").height(n(t.sender.target).height()),i}return!1},this)});this.element.find(o+" .pivotButton .filterBtn:last").ejButton({size:"normal",enableRTL:this.model.enableRTL,type:t.ButtonType.Button,contentType:"imageonly",prefixIcon:"filter"});this.element.find(o+" .pivotButton input:last").ejToggleButton({size:"normal",enableRTL:this.model.enableRTL,contentType:"imageonly",defaultPrefixIcon:"ascending",activePrefixIcon:"descending",click:t.proxy(this._sortBtnClick,this)});f&&(this.element.find(o+" .pivotButton:contains("+i+") span:eq(0) span").removeClass("ascending").addClass("descending"),this.element.find(o+" .pivotButton:contains("+i+") span:eq(0) button").addClass("e-active"));this.model.pivotControl._dataModel=="XMLA"&&this.element.find(".pivotButton[tag*=':Measures']").length>0&&(k=n(o+" .pivotButton[tag*=':Measures']"),n(o).append(k));this.element.find(".dropIndicator").removeClass("dropIndicatorHover");this._createContextMenu()},_createContextMenu:function(){var r=this.element.find(".pivotButton"),i;this.model.pivotControl!=null&&(i=t.buildTag("ul.pivotTreeContextMenu#pivotTreeContextMenu",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToFilter"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToValues"))[0].outerHTML)[0].outerHTML)[0].outerHTML,n(this.element).append(i),n("#pivotTreeContextMenu").ejMenu({menuType:t.MenuType.ContextMenu,enableRTL:this.model.enableRTL,openOnClick:!1,contextMenuTarget:r,click:t.proxy(this._contextClick,this),beforeOpen:t.proxy(this._onContextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)}))},_createPivotButtons_1:function(r,u){var o,e,l,f;if(!t.isNullOrUndefined(r)){if(o="",e=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"Slicers":"",this.model.pivotControl!=null&&this.model.pivotControl.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode)for(e=u=="column"?"Columns":u=="row"?"Rows":u=="filter"?"Slicers":"values",e=="values"&&this.model.pivotControl._dataModel=="XMLA"&&(r=n.map(r,function(n){return n.measures})),f=0;f<r.length;f++){var a=this.model.pivotControl._dataModel=="XMLA"||this.model.pivotControl._dataModel=="Olap"?"":t.isNullOrUndefined(r[f].filterItems)?"":"filtered",v=this.model.pivotControl._dataModel=="XMLA"||this.model.pivotControl._dataModel=="Olap"?"":r[f].sortOrder==t.PivotAnalysis.SortOrder.Descending?"descending":"",y=this.model.pivotControl._dataModel=="XMLA"?"":r[f].fieldName,s=(u=="column"||u=="row")&&this.model.layout!="excel"&&this.model.pivotControl._dataModel!="Olap"&&this.model.pivotControl._dataModel!="XMLA"?t.buildTag("span.sorting e-icon "+v).attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",h=(u=="column"||u=="row"||u=="filter")&&this.model.layout!="excel"&&r[f].fieldCaption!="Measures"?t.buildTag("span.filter e-icon "+a).attr("role","button").attr("aria-label","filter")[0].outerHTML:"",c=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"";o+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+y,this.model.pivotControl._dataModel=="XMLA"?(r[f].fieldCaption!=i?r[f].fieldCaption:r[f].fieldName)||r[f]:n.grep(this.model.pivotTableFields,function(n){return n.name==r[f].fieldName})[0].caption||n.grep(this.model.pivotTableFields,function(n){return n.name==r[f]})[0].caption,{},{fieldName:r[f].fieldName||r[f],axis:e})[0].outerHTML+h+s+c).attr("tag",e+":"+r[f].fieldName||r[f])[0].outerHTML).attr("tag",e+":"+r[f].fieldName||r[f])[0].outerHTML}else for(e==""&&u=="values"&&(l=this.element.find(".pivotButton:contains("+this._getLocalizedLabels("Measures")+")").length>0?this.element.find(".pivotButton:contains('"+this._getLocalizedLabels("Measures")+"')").parent()[0].className.split(" ")[0]:"schemaColumn",e=l=="schemaColumn"?"Columns":"Rows"),f=0;f<r.length;f++){r[f].FieldHeader=r[f].FieldHeader=="Measures"?this._getLocalizedLabels("Measures"):r[f].FieldHeader;var s=(u=="column"||u=="row")&&this.model.layout!="excel"&&this._dataModel!="Olap"&&this._dataModel!="XMLA"?t.buildTag("span.sorting e-icon ").attr("role","button").attr("aria-label","sort").attr("aria-expanded","false")[0].outerHTML:"",h=(u=="column"||u=="row"||u=="filter")&&this.model.layout!="excel"&&r[f].FieldHeader!="Measures"?t.buildTag("span.filter e-icon").attr("role","button").attr("aria-label","filter")[0].outerHTML:"",c=this.model.layout!="excel"?t.buildTag("span.removeBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML:"";o+=t.buildTag("div.pivotButton",t.buildTag("div.dropIndicator")[0].outerHTML+t.buildTag("div.pvtBtnDiv",t.buildTag("button.pvtBtn#pivotButton"+r[f].FieldHeader||r[f].FieldName||r[f].Name||r[f].DimensionName,r[f].FieldHeader||r[f].FieldName||r[f].Name||r[f].DimensionName)[0].outerHTML+h+s+c).attr("tag",e+":"+r[f].Tag)[0].outerHTML).attr("tag",e+":"+r[f].Tag)[0].outerHTML}return this._createContextMenu(),o}},_setSplitBtnTargetPos:function(r){var s="",e,u,f,o;if(r.event!=i&&r.event.type=="touchend"?(u=r.event.originalEvent.target!=null?n(r.event.originalEvent.target).parents(".pivotButton"):n(r.event.originalEvent.srcElement).parents(".pivotButton"),f=r.event.originalEvent.target!=null?r.event.originalEvent.target.className:r.event.originalEvent.srcElement.className):(u=t.isNullOrUndefined(r.originalEvent)?n(r.target).parents(".pivotButton"):r.originalEvent.target!=null?n(r.originalEvent.target).parents(".pivotButton"):n(r.originalEvent.srcElement).parents(".pivotButton"),f=t.isNullOrUndefined(r.originalEvent)?n(r.target).attr("class")?n(r.target).attr("class"):"":r.originalEvent.target!=null&&n(r.originalEvent.target).attr("class")?n(r.originalEvent.target).attr("class"):n(r.originalEvent.srcElement).attr("class")?n(r.originalEvent.srcElement).attr("class"):""),this._droppedClass=u.length>0?n(u[0]).parent()[0].className.split(" ")[0]:f.split(" ")[0],u[0]||f!=i&&f!=null&&jQuery.type(f)=="string"&&f.indexOf("pivotButton")>-1)for(u=u[0]?u[0]:r.originalEvent.target!=null?r.originalEvent.target:r.originalEvent.srcElement,e=r.event!=i&&r.event.type=="touchend"?r.target:this._droppedClass!=null&&this._droppedClass!=i&&this._droppedClass!=""?this.element.find("."+this._droppedClass)[0]:u.parentNode,e=n(e).children(".pivotButton"),o=0;o<e.length;o++)n(e[o]).attr("tag")==n(u).attr("tag")&&(s=o);return s},_getUnSelectedNodes:function(){for(var r,f=this.element.find(".editorTreeView")[0],u="",i=n(f).find(":input.nodecheckbox:not(:checked)"),t=0;t<i.length;t++)n(i[t].parentElement).find("span:nth-child(1)").attr("class").indexOf("e-chk-act")>-1||n(i[t].parentElement).attr("aria-checked")=="mixed"||(r=n(i[t]).parents("li:eq(0)"),u+="::"+r[0].id+"||"+n(r).attr("tag"));return u},_getSelectedNodes:function(t){var o,s,e,r,i;if(t){var h=this.element.find(".editorTreeView")[0].childNodes[0],f=[],u=n(h).children();for(r=0;r<u.length;r++){if(i=u[r],o={caption:n(i.firstChild).find("a").text(),parentId:i.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(i).parents()[1].id,id:i.id,checked:n(i).find(":input.nodecheckbox")[0].checked||n(i).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(i.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(i).attr("tag")},n(i).find("ul:first").children().length>0)for(s=n(i).find("ul:first").children(),e=0;e<s.length;e++)o.childNodes.push(this._getNodeInfo(s[e]));f.push(o)}return JSON.stringify(f)}var h=n(".editorTreeView"),f="",u=n(h).find(":input.nodecheckbox");for(r=0;r<u.length;r++)(u[r].checked||n(u[r].parentElement).attr("aria-checked")=="mixed")&&(i=n(u[r]).parents("li:eq(0)"),f+="::"+i[0].id+"||"+n(i).attr("tag"));return f},_getNodeInfo:function(t){var u={caption:n(t.firstChild).find("a").text(),parentId:t.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(t).parents()[1].id,id:t.id,checked:n(t).find(":input.nodecheckbox")[0].checked||n(t).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(t.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(t).attr("tag")},r,i;if(n(t).find("ul:first").children().length>0)for(r=n(t).find("ul:first").children(),i=0;i<r.length;i++)u.childNodes.push(this._getNodeInfo(r[i]));return u},doAjaxPost:function(r,u,f,e,o,s){this.model.pivotControl.model.editCellsInfo={};var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,this,s),a=!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,dataType:c,async:a,data:f,success:l,complete:n.proxy(o,this),error:function(){this.model.pivotControl._ogridWaitingPopup.hide()}})}});t.PivotSchemaDesigner.Locale={};t.PivotSchemaDesigner.Locale["en-US"]={Sort:"Sort",Search:"Search",SelectField:"select Field",LabelFilterLabel:"Show the items for which the label",ValueFilterLabel:"Show the items for which",ClearSorting:"Clear Sorting",ClearFilterFrom:"Clear Filter From",SortAtoZ:"Sort A to Z",SortZtoA:"Sort Z to A",and:"and",LabelFilters:"Label Filters ",BeginsWith:"Begins With",DoesNotBeginsWith:"Not Begins With",EndsWith:"Ends With",DoesNotEndsWith:"Not Ends With",Contains:"Contains",DoesNotContains:"Not Contains",ValueFilters:"Value Filters",ClearFilter:"Clear Filter",Equals:"Equals",DoesNotEquals:"Not Equals",GreaterThan:"Greater Than",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between",Top10:"Top Count",GreaterThan:"Greater Than",IsGreaterThan:"Is Greater Than",IsGreaterThanOrEqualTo:"Is Greater Than Or Equal To",IsLessThan:"Is Less Than",IsLessThanOrEqualTo:"Is Less Than Or Equal To",ClearFilter:"Clear Filter",SelectField:"Select field",Measures:"Measures",Warning:"Warning",AlertMsg:"The field you are moving cannot be placed in that area of the report",Goal:"Goal",Status:"Status",Trend:"Trend",Value:"value",AddToFilter:"Add to Filter",AddToRow:"Add to Row",AddToColumn:"Add to Column",AddToValues:"Add to Value",PivotTableFieldList:"PivotTable Field List",ChooseFieldsToAddToReport:"Choose fields to add to report:",DragFieldBetweenAreasBelow:"Drag fields between areas below:",ReportFilter:"Filters",ColumnLabel:"Columns",RowLabel:"Rows",Values:"Values",DeferLayoutUpdate:"Defer Layout Update",Update:"Update",OK:"OK",Cancel:"Cancel",Close:"Close"};t.PivotSchemaDesigner.Layouts={Excel:"excel",Normal:"normal",OneByOne:"onebyone"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotClient","ej.PivotClient",{_rootCSS:"e-pivotclient",element:null,model:null,validTags:["div","span"],defaults:{url:"",cssClass:"",title:"",gridLayout:"normal",chartType:"column",clientExportMode:"chartandgrid",enableDeferUpdate:!1,enablePivotTreeMap:!1,enableRTL:!1,enableAdvancedFilter:!1,enablePaging:!1,enableSplitter:!1,enableToolBar:!1,enableLocalStorage:!1,enableVirtualScrolling:!1,enableMemberEditorPaging:!1,enableDrillThrough:!1,showUniqueNameOnPivotButton:!1,isResponsive:!1,dataSource:{data:null,sourceInfo:"",providerName:"ssas",enableAdvancedFilter:!1,isFormattedValues:!1,reportName:"Default",columns:[],cube:"",catalog:"",rows:[],values:[],filters:[],pagerOptions:{categoricalPageSize:0,seriesPageSize:0,categoricalCurrentPage:0,seriesCurrentPage:0}},displaySettings:{mode:"chartandgrid",defaultView:"grid",controlPlacement:"tab",enableTogglePanel:!1,enableFullScreen:!1},serviceMethodSettings:{initialize:"InitializeClient",removeSplitButton:"RemoveSplitButton",filterElement:"FilterElement",nodeDropped:"NodeDropped",toggleAxis:"ToggleAxis",fetchMemberTreeNodes:"FetchMemberTreeNodes",cubeChanged:"CubeChanged",measureGroupChanged:"MeasureGroupChanged",toolbarServices:"ToolbarOperations",memberExpand:"MemberExpanded",saveReport:"SaveReportToDB",fetchReportList:"FetchReportListFromDB",loadReport:"LoadReportFromDB",updateReport:"UpdateReport",exportPivotClient:"Export",mdxQuery:"GetMDXQuery",drillThroughHierarchies:"DrillThroughHierarchies",drillThroughDataTable:"DrillThroughDataTable",paging:"Paging",removeDBReport:"RemoveReportFromDB",renameDBReport:"RenameReportInDB",calculatedMember:"CalculatedMember"},size:{height:"685px",width:"1000px"},toolbarIconSettings:{enableAddReport:!0,enableNewReport:!0,enableRenameReport:!0,enableDBManipulation:!0,enableWordExport:!0,enableExcelExport:!0,enablePdfExport:!0,enableMDXQuery:!0,enableDeferUpdate:!1,enableFullScreen:!1,enableSortOrFilterColumn:!0,enableSortOrFilterRow:!0,enableToggleAxis:!0,enableChartTypes:!0,enableRemoveReport:!0,enableCalculatedMember:!1},customObject:{},enableMeasureGroups:!1,locale:"en-US",analysisMode:"olap",operationalMode:"clientmode",renderSuccess:null,renderFailure:null,renderComplete:null,load:null,chartLoad:null,treeMapLoad:null,drillThrough:null,beforeExport:null,beforeServiceInvoke:null,afterServiceInvoke:null,saveReport:null,loadReport:null,fetchReport:null,memberEditorPageSize:100},dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum",removeSplitButton:"enum",filterElement:"enum",nodeDropped:"enum",toggleAxis:"enum",fetchMemberTreeNodes:"enum",cubeChanged:"enum",measureGroupChanged:"enum",toolbarServices:"enum",memberExpand:"enum",saveReport:"enum",fetchReportList:"enum",loadReport:"enum",updateReport:"enum",exportPivotClient:"enum",mdxQuery:"enum",drillThroughHierarchies:"enum",drillThroughDataTable:"enum",paging:"enum",removeDBReport:"enum",renameDBReport:"enum",calculatedMember:"enum"},displaySettings:"data",customObject:"data"},observables:["title","gridLayout","displaySettings.mode","displaySettings.defaultView","displaySettings.controlPlacement","displaySettings.enableTogglePanel","locale"],title:t.util.valueFunction("title"),gridLayout:t.util.valueFunction("gridLayout"),displayMode:t.util.valueFunction("displaySettings.mode"),defaultView:t.util.valueFunction("displaySettings.defaultView"),controlPlacement:t.util.valueFunction("displaySettings.controlPlacement"),enableTogglePanel:t.util.valueFunction("displaySettings.enableTogglePanel"),locale:t.util.valueFunction("locale"),_init:function(){this._initPrivateProperties();this._load()},_initPrivateProperties:function(){this._id=this.element.attr("id");oclientProxy=this;currentReport="";currentCubeName="";reports="";reportsCount=0;this._pivotGrid=null;this._pivotChart=null;this._pivotSchemaDesigner=null;otreemapObj=null;chartObj=null;this._deferReport="";this._keypress=!1;this._memberTreeObj=null;this._chartHeight=0;this._chartWidth=0;this._gridHeight=0;this._gridWidth=0;this._initStyles=[];this._toggleStyles=[];this._initToggle=!0;this._toggleExpand=!1;this._treemapRender=!1;this._dimensionName="";this._dllSortMeasure=null;this._selectedFieldName="";this._axis="";this._isSorted=!1;this._isFiltered=!1;this._sortOrFilterTab="";this._currentAxis="";this._parentElwidth=0;this.pNode="";this.progressPos=null;this._selectedReport="";this._isMembersFiltered=!1;this._pagerObj=null;this._dialogTitle="";this._dataModel=" ";this._clientReportCollection=[];this._drillParams=[];this._drillInfo=[];draggedSplitBtn=null;isDragging=!1;isDropped=!1;measureGroupInfo="";this._currentTab=this.defaultView();this._currentItem=null;this._currentReportItems=[];this._treeViewData={};this._memberPageSettings={currentMemeberPage:1,startPage:0,endPage:0};this._isNodeOrButtonDropped=!1;this._ischartTypesChanged=!1;this._isrenderTreeMap=!1;this._isRemoved=!1;this._waitingPopup=null;this._isGridDrillAction=!1;this._isChartDrillAction=!1;this._olapReport="";this._jsonRecords=null;this._excelFilterInfo=[];this._index={tab:0,icon:1,chartimg:0,button:1,dialog:0,editor:0,tree:0};this._curFocus={tab:null,icon:null,chartimg:null,button:null,dialog:null,editor:null,tree:null};this._seriesCurrentPage=1;this._categCurrentPage=1;this._isReportListAction=!0;this._currentRecordName="";this._pagingSavedObjects={drillEngine:[],savedHdrEngine:[],curDrilledItem:{}};this._fieldMembers={};this._fieldSelectedMembers={};this._allMember="";this._editorTreeData=[];this._isSearchApplied=!1;this._isTimeOut=!1;this._calcMemberTreeObj=null;this._cubeTreeView=null;this._calcMemberDialog=null;this._calcMembers=[];this._selectedCalcMember=null;this._isAllMemberChecked=!0},getOlapReport:function(){return JSON.parse(this._olapReport)},setOlapReport:function(n){this._olapReport=JSON.stringify(n)},getJSONRecords:function(){return JSON.parse(this._jsonRecords)},setJSONRecords:function(n){this._jsonRecords=JSON.stringify(n)},getActiveTab:function(){return this._currentTab},_destroy:function(){this.element.empty().removeClass("e-pivotclient"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy();delete oclientProxy},_load:function(){var u={element:this.element,customObject:this.model.customObject},r,i;(this.model.enableAdvancedFilter||this.model.dataSource.enableAdvancedFilter)&&(this.model.dataSource.enableAdvancedFilter=this.model.enableAdvancedFilter=!0);this.model.toolbarIconSettings.enableFullScreen=this.model.displaySettings.enableFullScreen=this.model.toolbarIconSettings.enableFullScreen||this.model.displaySettings.enableFullScreen?!0:!1;this.model.toolbarIconSettings.enableDeferUpdate=this.model.enableDeferUpdate=this.model.enableDeferUpdate?!0:!1;this._trigger("load",u);this.element.addClass(this.model.cssClass);n("#"+this._id).ejWaitingPopup({showOnInit:!0});this._waitingPopup=n("#"+this._id).data("ejWaitingPopup");this.model.dataSource.data==null&&this.model.url!=""||this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(this.model.operationalMode=t.Pivot.OperationalMode.ServerMode,t.isNullOrUndefined(this.model.beforeServiceInvoke)||this._trigger("beforeServiceInvoke",{action:"initializeClient",element:this.element,customObject:this.model.customObject}),r=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:this.model.enableDrillThrough&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?"initializeClient:getDataSet":"initializeClient",customObject:r,clientParams:this.model.enableMeasureGroups+"-"+this.model.chartType}),this._renderControlSuccess)):(this.model.operationalMode=t.Pivot.OperationalMode.ClientMode,this.model.analysisMode=this.model.dataSource.cube!=""?t.Pivot.AnalysisMode.Olap:t.Pivot.AnalysisMode.Pivot,i=this,setTimeout(function(){i._renderLayout();i._createControl();i.model.enableSplitter&&i._createSplitter()},0))},_renderClientControls:function(t){this._renderLayout();this.setOlapReport(t.PivotReport);var i=n.parseJSON(t.PivotReport);this.currentReport=this.getOlapReport()!=""?JSON.parse(this.getOlapReport()).Report:"";this.setJSONRecords({GridJSON:t.GridJSON,ChartJSON:t.ChartJSON});this._createControl();this.model.enableSplitter&&this._createSplitter();this.model.enableAdvancedFilter&&this._pivotGrid&&this._pivotGrid._removeCells(t)},_createControl:function(){var f="",e,o,h,r,i,u;if(this.element.find("#"+this._id+"_PivotSchemaDesigner").ejPivotSchemaDesigner({pivotControl:this,_waitingPopup:this._waitingPopup,enableRTL:this.model.enableRTL,layout:t.PivotSchemaDesigner.Layouts.OneByOne,olap:{showKPI:!1,showNamedSets:!1},serviceMethods:{nodeDropped:this.model.serviceMethodSettings.nodeDropped,memberExpand:this.model.serviceMethodSettings.memberExpand},locale:this.model.locale,width:this.model.enableSplitter?"100%":this.element.width()/3,height:this.element.find(".controlPanel").height()}),this.model.enablePaging&&(this.element.find("#"+this._id+"_Pager").ejPivotPager({locale:this.model.locale,mode:t.PivotPager.Mode.Both,targetControlID:this._id}),this.element.find(".controlPanel").height(this.element.find(".controlPanel").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".gridContainer").height(this.element.find(".gridContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".chartContainer").height(this.element.find(".chartContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+10))),e=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 5px"})[0].outerHTML,this.element.find(".parentSchemaFieldTree").prepend(e),this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",height:"25px",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),this.model.enableMeasureGroups&&this._createMeasureGroup(),o=this._clientReportCollection.length>0?this._clientReportCollection:[{name:this.model.dataSource.reportName}],this.element.find(".reportlist").ejDropDownList({dataSource:o,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"26px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.element.find(".reportlist").attr("tabindex",0),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this._clientReportCollection.push(this.model.dataSource),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){var s=this.element.find(".csHeader").width()-this.element.find(".cubeText").width()-this.element.find(".toggleExpandButton").width()-(this.model.enableSplitter?50:20),c=this.enableTogglePanel()?s-25:s,l=f==""?"":n.parseJSON(f);this.element.find(".cubeSelector").ejDropDownList({dataSource:l,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},width:this.model.enableSplitter&&!this.model.isResponsive?"100%":""+c+"px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});h=this.element.find(".cubeSelector").data("ejDropDownList");h.selectItemByText(this.currentCubeName)}r=this.element.find("#reportList").data("ejDropDownList");this._isReportListAction=!1;r.model.dataSource.length&&r.selectItemByText(r.model.dataSource[0].name);this._isReportListAction=!0;this._selectedReport=r._currentText;this.element.find(".cubeSelector").ejDropDownList("option","change",t.proxy(this._cubeChanged,this));this.element.find(".cubeSelector").attr("tabindex",0);this.element.find(".reportlist").ejDropDownList("option","change",t.proxy(this._reportChanged,this));this.model.enableMeasureGroups&&this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this));this.element.find("#clientTab").ejTab({enableRTL:this.model.enableRTL,itemActive:t.proxy(this._onTabClick,this)});this.model.enableSplitter||this.element.find(".controlPanel").width(this.element.width()-this.element.find("#"+this._id+"_PivotSchemaDesigner").width()-(this.model.displaySettings.enableTogglePanel?30:10));this.displayMode()!="chartonly"&&(this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({locale:this.model.locale,customObject:this.model.customObject,enableRTL:this.model.enableRTL,isResponsive:this.model.isResponsive,drillSuccess:t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._gridDrillSuccess:this._clientGridDrillSuccess,this),enableCollapseByDefault:!0}),this._pivotGrid=this.element.find("#"+this._id+"_PivotGrid").data("ejPivotGrid"),this._pivotGrid.model.operationalMode=this.model.operationalMode,this._pivotGrid.model.analysisMode=this.model.analysisMode,this._pivotGrid._waitingPopup=this._waitingPopup,this._pivotGrid.model.url=this.model.url,this._pivotGrid.model.dataSource=this.model.dataSource);this.displayMode()!="gridonly"&&(this.element.find("#"+this._id+"_PivotChart").ejPivotChart({locale:this.model.locale,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,drillSuccess:t.proxy(this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this._chartDrillSuccess:this._clientChartDrillSuccess,this),size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}}}),this._pivotChart=this.element.find("#"+this._id+"_PivotChart").data("ejPivotChart"),this._pivotChart.model.operationalMode=this.model.operationalMode,this._pivotChart.model.analysisMode=this.model.analysisMode,this._pivotChart._waitingPopup=this._waitingPopup,this._pivotChart.model.url=this.model.url,this._pivotChart.model.dataSource=this.model.dataSource);this._pivotSchemaDesigner=this.element.find("#"+this._id+"_PivotSchemaDesigner").data("ejPivotSchemaDesigner");i={};this._pivotChart!=null&&(this.element.find("#"+this._id+"_PivotChart").width(this._pivotChart.model.size.width),i.chartModelWidth=this._pivotChart.model.size.width);i.controlPanelWidth=this.element.find(".controlPanel").width();i.chartOuterWidth=this._chartWidth;i.gridOuterWidth=this._gridWidth;this._initStyles.push(i);this.model.isResponsive&&(this._enableResponsive(),this._parentElwidth=n("#"+this._id).parent().width(),this._parentElwidth<850?this._rwdToggleCollapse():this._parentElwidth>850&&this._rwdToggleExpand(),this._pivotSchemaDesigner.element.width((this._pivotSchemaDesigner.element.width()-30)/this._pivotSchemaDesigner.element.width()*100+"%"));this.enableTogglePanel()&&this.element.find(".pivotFieldList").length>0&&(this.element.find(".togglePanel").height(this.element.find("#"+this._id+"_PivotSchemaDesigner").height()).width(14),this.element.find(".toggleExpandButton,.toggleCollapseButton").css("margin-top",(this.element.find("#"+this._id+"_PivotSchemaDesigner").parents("td:eq(0)").height()-9)/2),this.element.find(".togglePanel").children().addClass("toggleButtons"));this._trigger("renderSuccess",this);this.model.analysisMode==t.Pivot.AnalysisMode.Olap?(t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this),this.element.find(".fieldTable").css("border","none"),this.element.find(".parentSchemaFieldTree").addClass("olapFieldList")):this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this._pivotGrid.setJSONRecords(this.getJSONRecords().GridJSON),this._pivotGrid.setOlapReport(this.getOlapReport()),this.model.gridLayout=="excellikelayout"?this._pivotGrid.excelLikeLayout(this._pivotGrid.getJSONRecords()):this._pivotGrid.renderControlFromJSON()),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart.model.enableMultiLevelLabels?this._pivotChart._generateData({JsonRecords:this.getJSONRecords(),PivotReport:this.getOlapReport()}):this._pivotChart.renderControlSuccess({JsonRecords:this.getJSONRecords().ChartJSON,OlapReport:this.getOlapReport()})),this.currentReport=this.getOlapReport()!=""?JSON.parse(this.getOlapReport()).Report:""):(u=t.PivotAnalysis.pivotEnginePopulate(this.model),this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this._pivotGrid.setJSONRecords(JSON.stringify(u.json)),this.model.gridLayout=="excellikelayout"?this._pivotGrid.excelLikeLayout(u.json):this._pivotGrid.renderControlFromJSON()),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart.setPivotEngine(u.pivotEngine),this._pivotChart._generateData(u.pivotEngine)));this._unWireEvents();this._wireEvents()},_createMeasureGroup:function(){this.element.find(".measureGroupselector").remove();n(this.element).find(".cubeBrowser").prepend("<div class ='measureGroupselector' style='margin:5px 5px 0px 5px'><input type='text' id='measureGroupSelector' class='measureGroupSelector' /><\/div>");this.element.find(".measureGroupSelector").ejDropDownList({dataSource:this.measureGroupInfo,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"25px",width:"100%",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});this.element.find(".measureGroupSelector").attr("tabindex",0);measureDropTarget=this.element.find(".measureGroupSelector").data("ejDropDownList");measureDropTarget.selectItemByText(measureDropTarget.model.dataSource[0].name);this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this))},refreshControl:function(r){var s,o;if(t.isNullOrUndefined(this._pivotSchemaDesigner)||this._pivotSchemaDesigner._refreshPivotButtons(),this.element.find(".chartTypesDialog").length>0&&this.element.find(".chartTypesDialog").remove(),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart._labelCurrentTags={}),this.model.operationalMode==t.Pivot.OperationalMode.ServerMode){var u=null,f=null,e=null;r[0]!=i?(u=r[0].Value,f=r[1].Value,e=r[2].Value):t.isNullOrUndefined(r.d)?(u=r.PivotReport,f=r.GridJSON,e=r.ChartJSON):(u=r.d[0].Value,f=r.d[1].Value,e=r.d[2].Value);s=this;this._clientReportCollection=n.map(this._clientReportCollection,function(n){return n.report=n.name==s._currentReportName?JSON.parse(u).Report:n.report,n});this.setJSONRecords({GridJSON:f,ChartJSON:e});this.setOlapReport(u);this._pivotGrid.setJSONRecords(f);this._pivotGrid.renderControlFromJSON();this._pivotGrid&&this._pivotGrid._removeCells(r);this._pivotChart._drillAction&&(this._pivotChart._drillAction="");this._pivotChart.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(this._pivotChart._drillParams=this._drillParams=[],this._pivotChart._generateData({JsonRecords:r,PivotReport:u})):this._pivotChart.renderControlSuccess({OlapReport:u,JsonRecords:e})}else this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(o=t.PivotAnalysis.pivotEnginePopulate(this.model),this.generateJSON({tranposeEngine:o.pivotEngine,jsonObj:o.json})):t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this);this.model.isResponsive&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)||this.element.find("#"+this.chartObj._id).ejChart("option",{model:{size:{height:this._chartHeight}}}));this._unWireEvents();this._wireEvents()},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"title":this.element.find(".titleText").text(this.title());break;case"currentCubeName":this.currentCubeName=n[t];break;case"gridLayout":this._renderPivotGrid();break;case"olapReport":this.currentReport=n[t];break;case"clientReports":this.reports=n[t];break;case"customObject":this.model.customObject=n[t];break;case"locale":this.locale();(this._pivotGrid||this._pivotChart)&&this._load();break;case"displaySettings":(this._pivotGrid||this._pivotChart)&&this._load()}},_getMeasuresList:function(){var t="";return this.element.find(".memberEditorDiv").find("div").each(function(){t+=n(this)[0].id+","}),t},_getUnSelectedNodes:function(){var t="",n;if(this._currentItem.indexOf("Measures")<0)for(n=0;n<this._memberTreeObj.dataSource().length;n++)this._memberTreeObj.dataSource()[n].checkedStatus==!1&&(t+="::"+this._memberTreeObj.dataSource()[n].id+"||"+this._memberTreeObj.dataSource()[n].tag);return t},_getSelectedNodes:function(t){var i,e,o,f,u,r;if(t){var h=this.element.find(".editorTreeView")[0].childNodes[0],u=[],s=n(h).children();for(r=0;r<s.length;r++){if(i=s[r],e={caption:n(i.firstChild).find("a").text(),parentId:i.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(i).parents()[1].id,id:i.id,checked:n(i).find(":input.nodecheckbox")[0].checked||n(i).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(i.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(i).attr("tag")},n(i).find("ul:first").children().length>0)for(o=n(i).find("ul:first").children(),f=0;f<o.length;f++)e.childNodes.push(this._getNodeInfo(o[f]));u.push(e)}return JSON.stringify(u)}if(u="",this._currentItem.indexOf(this._getLocalizedLabels("Measures"))<0)for(r=0;r<this._memberTreeObj.dataSource().length;r++)this._memberTreeObj.dataSource()[r].checkedStatus==!0&&(u+="::"+this._memberTreeObj.dataSource()[r].id+"||"+this._memberTreeObj.dataSource()[r].tag);return u},_getNodeInfo:function(t){var u={caption:n(t.firstChild).find("a").text(),parentId:t.parentElement.parentElement.className.indexOf("editorTreeView")>-1?"None":n(t).parents()[1].id,id:t.id,checked:n(t).find(":input.nodecheckbox")[0].checked||n(t).find("span:nth-child(1)").attr("class").indexOf("e-chk-indeter")>-1,expanded:n(t.firstChild).find(".e-minus").length>0?!0:!1,childNodes:[],tag:n(t).attr("tag")},r,i;if(n(t).find("ul:first").children().length>0)for(r=n(t).find("ul:first").children(),i=0;i<r.length;i++)u.childNodes.push(this._getNodeInfo(r[i]));return u},_removeSplitBtn:function(){var i=n(document).find(".dragClone"),u,f,r,e;clientObj=this;f=this.element.find(".splitBtn");jQuery.each(f,function(t,r){n(n(r).children()[0]).attr("title")==n(i).attr("title")&&(u=n(r).attr("tag"),n(r).remove())});this._currentReportItems.length!=0&&this._treeViewData.hasOwnProperty(n(i).attr("title"))&&(delete this._treeViewData[n(i).attr("title")],this._currentReportItems.splice(n.inArray(n(i).attr("title"),this._currentReportItems),1));this.model.enableAdvancedFilter&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(r=u.split(":")[1].split("."),t.isNullOrUndefined(r)||r.length!=2||(this._setUniqueNameFrmBtnTag(r),this._removeFilterTag(this._selectedFieldName)));n(".dragClone").remove();this._isTimeOut=!0;setTimeout(function(){clientObj._isTimeOut&&clientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"removeSplitButton",element:this.element,customObject:this.model.customObject});e=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeSplitButton,JSON.stringify({action:"removeSplitButton",clientParams:u,olapReport:this.currentReport,clientReports:this.reports,customObject:e}),this._removeSplitButtonSuccess);this._isNodeOrButtonDropped=!0},_wireEvents:function(){this._wireDialogEvent();this._wireEditorRemoveEvent();this._wireMeasureRemoveEvent();this._on(n(document),"keydown",this._keyPressDown);this._on(n(document),"keyup",this._keyPressUp);this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejDraggable({handle:"button",clone:!0,cursorAt:{top:-10,left:-10},dragStart:function(i){i.event.preventDefault();n(this.element.find(".e-txt")).off("touchstart");n(this.element.find(".e-txt")).off(t.eventType.click);isDragging=!0;this.element.find(".e-dialog").hide();draggedSplitBtn=i.event.target},dragStop:function(t){var r,e,u,f;this.element.find(".targetAxis").removeClass("targetAxis");isDragging=!1;r=null;u=n(this.element).parents(".e-pivotclient").data("ejPivotClient");e=t.event.type=="touchend"?u._setSplitBtnTargetPos(t):u._setSplitBtnTargetPos(t.event);u._dropAxisClassName!=i&&u._dropAxisClassName!=""?(u._dropAxisClassName=="outOfAxis"?u._removeSplitBtn():r=u._dropAxisClassName,u._dropAxisClassName=""):t.target!=i?n(t.target).hasClass("e-btn")||n(t.target).hasClass("removeSplitBtn")?r=n(t.target).parents("div:eq(1)").attr("class"):jQuery.type(t.target.className)!="string"?u._removeSplitBtn():r=t.target.className.indexOf("splitBtn")>-1?n(t.target).parents("div:eq(0)").attr("class"):t.target.className:r=n(t.event.originalEvent.srcElement).hasClass("e-btn")||n(t.event.originalEvent.srcElement).hasClass("removeSplitBtn")?n(t.event.originalEvent.srcElement).parents("div:eq(1)").attr("class"):t.event.originalEvent.srcElement.className.indexOf("splitBtn")>-1?n(t.event.originalEvent.srcElement).parents("div:eq(0)").attr("class"):t.event.originalEvent.srcElement.className;r!=i&&r!=null&&(f=r.indexOf("categoricalAxis")>r.indexOf("rowAxis")?r.indexOf("categoricalAxis")>r.indexOf("slicerAxis")?"Categorical":"Slicer":r.indexOf("rowAxis")>r.indexOf("slicerAxis")?"Series":r.indexOf("slicerAxis")>=0?"Slicer":null,f!=null?u._splitButtonDropped(f,e):u._removeSplitBtn(),u._setSplitBtnTitle())},helper:function(t){var i=n(t.sender.target).parents(".e-pivotclient").data("ejPivotClient");return t.sender.target.className.indexOf("e-btn")>-1?n(t.sender.target).clone().addClass("dragClone").appendTo(i.element):!1}});this.element.find(".nextPage, .prevPage, .firstPage, .lastPage").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");t.Pivot.editorTreeNavigatee(i,r)});this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").mouseover(function(){isDragging&&n(this).addClass("targetAxis")});this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").mouseleave(function(){n(this).removeClass("targetAxis")});this.element.find(".e-btn").mouseover(function(t){n(t.target.parentNode).find("span").css("display","inline")});this.model.enableDrillThrough&&(this._pivotGrid.model.enableDrillThrough=!0,n.proxy(this._pivotGrid._addHyperlink,this));this.element.find(".splitBtn").mouseover(function(){isDragging&&n(this).addClass("dropIndicator")});this.element.find(".splitBtn").mouseleave(function(){n(this).removeClass("dropIndicator")});this._on(this.element,"click","#preventDiv",t.proxy(function(){this.element.find(".e-dialog.advancedFilterDlg:visible").length>0&&(this.element.find(".e-dialog.advancedFilterDlg").hide(),this.element.find("#preventDiv").remove())},this));this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode||this._on(this.element,"mouseover",".pvtBtn",t.proxy(function(t){var i=n(t.currentTarget).parents(".e-pivotclient").data("ejPivotClient");(isDragging||i._pivotSchemaDesigner._isDragging)&&n(t.target).siblings(".dropIndicator").addClass("dropIndicatorActive")},this));this._on(this.element,"mouseleave",".pvtBtn",t.proxy(function(t){n(t.target).siblings(".dropIndicator").removeClass("dropIndicatorActive")},this));this.element.find(".sortDisable, .sortEnable, .filterDisable, .filterEnable ").on(t.eventType.click,function(t){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");t.target.className=="sortDisable"?(n(".measuresList_wrapper,.radioBtnAsc, .radioBtnDesc, .preserveHrchy").attr("disabled","disabled"),n(".measureListLbl, .orderLbl, .radioBtnAscLbl, .radioBtnDescLbl, .preserveHrchyLbl").addClass("sortFilterDisable"),i._dllSortMeasure.disable()):t.target.className=="sortEnable"?(n(".measuresList_wrapper,.radioBtnAsc, .radioBtnDesc, .preserveHrchy").removeAttr("disabled"),n(".measureListLbl, .orderLbl, .radioBtnAscLbl, .radioBtnDescLbl, .preserveHrchyLbl").removeClass("sortFilterDisable"),i._dllSortMeasure.enable()):t.target.className=="filterDisable"?(n(".filterFrom, .filterTo").attr("disabled","disabled"),n(".filterMeasureListLbl, .conditionLbl, .filterValueLbl, .filterBtw").addClass("sortFilterDisable"),i._dllFilterCondition.disable(),i._dllfMeasuresList.disable()):t.target.className=="filterEnable"&&(n(".filterFrom, .filterTo").removeAttr("disabled"),n(".filterMeasureListLbl, .conditionLbl, .filterValueLbl, .filterBtw").removeClass("sortFilterDisable"),i._dllFilterCondition.enable(),i._dllfMeasuresList.enable())});this.element.find(".filterFrom , .filterTo").keypress(function(t){return t.which==8||t.which==0?!0:t.which<46||t.which>58?!1:t.which==46&&n(this).val().indexOf(".")!=-1||t.which==47?!1:void 0});this.element.find(".toggleExpandButton").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r,u;i.model.isResponsive?i._rwdToggleCollapse():(i._toggleExpand=!0,i._initToggle&&(i._initToggle=!1,r={},u=(i.element.find(".cubeTable").width()||i.element.find(".pivotFieldList").width())+i.element.find(".controlPanel").width()-17,r.controlPanelWidth=u-3,r.chartOuterWidth=r.chartModelWidth=r.gridOuterWidth=u-17,i._toggleStyles.push(r)),i.displayMode()==t.PivotClient.DisplayMode.GridOnly?i.element.find(".gridContainer").width(i.element.width()-40):i.displayMode()==t.PivotClient.DisplayMode.ChartOnly?i.element.find(".chartContainer").width(i.element.width()-45):i.controlPlacement()==t.PivotClient.ControlPlacement.Tile?i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.width()-25),i.element.find(".chartContainer").width(i.element.width()-65)):(i.element.find(".gridContainer").width(i.element.width()-40),i.element.find(".chartContainer").width(i.element.width()-45)):i.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&(i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.width()-25),i.element.find(".chartContainer").width(i.element.width()-65)):(i.element.find(".gridContainer").width(i.element.width()-25),i.element.find(".chartContainer").width(i.element.width()-45))),i._performToggleAction(i._toggleStyles),i.element.find(".csHeader, .cubeTable,.toggleExpandButton, .pivotFieldList").hide(),i.element.find(".toggleCollapseButton").show(),i.element.find(".toggleText").show(),i.model.enablePivotTreeMap&&i.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(i.chartObj)&&!t.isNullOrUndefined(i.otreemapObj)&&(i.chartObj=i.element.find("#"+i.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(i.chartObj)||(i.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?i.otreemapObj._treeMap.refresh():i.chartObj.redraw())))});this.element.find(".toggleCollapseButton").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");i.model.isResponsive?(i._rwdToggleExpand(),i.model.enableSplitter&&i.element.find(".splitresponsive").data("ejSplitter").refresh()):(i._toggleExpand=!1,i._performToggleAction(i._initStyles),i.element.find(".csHeader, .cubeTable,.toggleExpandButton, .pivotFieldList").show(),i.element.find(".toggleCollapseButton").hide(),i.element.find(".toggleText").hide(),i.displayMode()==t.PivotClient.DisplayMode.GridOnly?i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5):i.displayMode()==t.PivotClient.DisplayMode.ChartOnly?i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5):i.controlPlacement()==t.PivotClient.ControlPlacement.Tile?i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5)):(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5)):i.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&(i.defaultView()==t.PivotClient.DefaultView.Grid?(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5)):(i.element.find(".gridContainer").width(i.element.find(".controlPanel").width()-5),i.element.find(".chartContainer").width(i.element.find(".controlPanel").width()-5))),i.model.enableToolBar&&(i.element.find("#"+this._id+"_PivotCharttoolBar").width(i.element.find(".chartContainer").width()),i.element.find("#"+this._id+"_PivotGridToolbar").width(i.element.find(".gridContainer").width()-10),i.element.find(".chartToolBar").width(i.element.find(".chartContainer").width()),i.element.find(".toolBar").width(i.element.find(".gridContainer").width())),i.model.enablePivotTreeMap&&i.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(i.chartObj)&&!t.isNullOrUndefined(i.otreemapObj)&&(i.chartObj=i.element.find("#"+i.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(i.chartObj)||(i.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?i.otreemapObj._treeMap.refresh():i.chartObj.redraw())))});this.element.find(".maximizedView").click(function(){var t=n(this).parents(".e-pivotclient").data("ejPivotClient");t._maxViewBtnClick()});n(document).on("click",".winCloseBtn",function(t){var i=n("#"+n(t.target).attr("clientID")).data("ejPivotClient");i._maxViewClsBtnClick()});if(this.model.isResponsive)n(window).on("resize",n.proxy(this._reSizeHandler,this));this.model.enableSplitter&&this._on(this.element,"mouseup",".parentsplit,.childsplit",t.proxy(function(t){var i=this,r;n(t.target).hasClass("e-shadowbar")&&(n(t.target).parent().hasClass("childsplit")||!n(t.target).parent().hasClass("parentsplit")?r=i.element.find(".controlPanelTD").width():n(t.target).parent().hasClass("parentsplit")&&!i.model.enableRTL?r=i.element.find(".controlPanelTD").width()+(i.element.find(".controlPanelTD").offset().left-i.element.find(".e-shadowbar").offset().left):n(t.target).parent().hasClass("parentsplit")&&i.model.enableRTL&&(r=i.element.find(".controlPanelTD").width()+(i.element.find(".e-shadowbar").offset().left-i.element.find(".e-split-divider").offset().left)),n("#"+i._pivotChart._id+"Container").width(r),i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),i.chartObj.redraw())}))},_keyPressUp:function(n){if(n.keyCode===93&&!this.element.find(".e-dialog:visible").length>0&&this.element.find(".hoverCell:visible").length>0&&(n.preventDefault(),!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-text"))){var i={x:this.element.find(".hoverCell").offset().left+this.element.find(".hoverCell").outerWidth(),y:this.element.find(".hoverCell").offset().top+this.element.find(".hoverCell").outerHeight()};this.element.find(".hoverCell").trigger({type:"mouseup",which:3,clientX:i.x,clientY:i.y,pageX:i.x,pageY:i.y})}},_createSplitter:function(){this.model.isResponsive||(this.model.enableRTL?(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.enableVirtualScrolling||this.element.find(".parentsplit").ejSplitter({width:"100%",enableRTL:!0,isResponsive:!0,cssClass:"customCSS",height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5):this.element.find(".outerTable").height(),properties:[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"50%"},{collapsible:!1,minSize:225}],resize:function(){var n=this.element.find(".childsplit").data("ejSplitter");n.option("properties",[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"50%",minSize:0},{paneSize:"50%",minSize:0,collapsible:!1}])}}),this.element.find(".childsplit").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+30):"",width:"100%",enableRTL:!0,properties:[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"50%"},{paneSize:"50%",collapsible:!1}]})):(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.enableVirtualScrolling||this.element.find(".parentsplit").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5):this.element.find(".outerTable").height(),properties:[{expandable:!1,collapsible:!1},{enableAutoResize:!0,collapsible:!1}],resize:function(){var n=this.element.find(".childsplit").data("ejSplitter");n.option("properties",[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"47%",enableRTL:this.model.enableRTL},{paneSize:"47%",collapsible:!1}])}}),this.element.find(".childsplit").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+30):"",properties:[{expandable:!1,collapsible:!1,enableAutoResize:!0,paneSize:"47%",enableRTL:this.model.enableRTL},{paneSize:"47%",collapsible:!1}]})));this.model.isResponsive&&this.element.find(".splitresponsive").ejSplitter({cssClass:"customCSS",isResponsive:!0,height:this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+25):"",properties:[{expandable:!1,collapsible:!1,paneSize:"48%"},{enableAutoResize:!0,collapsible:!1}]})},_keyPressDown:function(i){var u,o,f,e,r;if(t.isNullOrUndefined(this._curFocus.button)?t.isNullOrUndefined(this._curFocus.tab)||(u=this._curFocus.tab):u=this._curFocus.button,i.keyCode===93&&!t.isNullOrUndefined(u)&&!this.element.find(".e-dialog:visible").length>0&&this.element.find(".hoverCell:visible").length>0&&(i.preventDefault(),o={x:n(u).offset().left+n(u).outerWidth(),y:n(u).offset().top+n(u).outerHeight()},u.trigger({type:"mouseup",which:3,clientX:o.x,clientY:o.y,pageX:o.x,pageY:o.y})),(i.which===46||i.which===82&&i.ctrlKey)&&!this.element.find(".e-dialog:visible").length>0&&!t.isNullOrUndefined(u)?(i.preventDefault(),u.parent().find(".removeSplitBtn:visible").click()):(i.which===46||i.which===82&&i.ctrlKey&&(!t.isNullOrUndefined(this._curFocus.dialog)&&this._curFocus.dialog.hasClass("measureEditor")||!t.isNullOrUndefined(this._curFocus.editor)&&this._curFocus.editor.hasClass("measureEditor")))&&(t.isNullOrUndefined(this._curFocus.editor)?t.isNullOrUndefined(this._curFocus.dialog)||this._curFocus.dialog.find(".removeMeasure:visible").click():this._curFocus.editor.find(".removeMeasure:visible").click()),i.keyCode==79&&this.element.find(".e-dialog:visible").length>0&&i.ctrlKey&&(i.preventDefault(),!t.isNullOrUndefined(this._curFocus.icon)&&this._curFocus.icon.hasClass("mdxImg")?this.element.find(".dialogCancelBtn:visible").click():this.element.find(".dialogOKBtn:visible").click(),this._curFocus.dialog=null),i.which===70&&i.ctrlKey&&!t.isNullOrUndefined(u)&&u.click(),i.keyCode==67&&this.element.find(".e-dialog:visible").length>0&&this.element.find(".e-dialog .e-titlebar").attr("tag")!="MDX Query"&&i.ctrlKey&&(i.preventDefault(),this.element.find(".dialogCancelBtn:visible").click(),this._curFocus.dialog=null),this.element.find(".e-dialog:visible").length>0&&i.keyCode==27?(t.isNullOrUndefined(this._curFocus.icon)?t.isNullOrUndefined(this._curFocus.editor)?t.isNullOrUndefined(this._curFocus.dialog)||this._curFocus.dialog.attr("tabindex","-1").addClass("hoverCell").focus().mouseover():this._curFocus.editor.attr("tabindex","-1").addClass("hoverCell").focus().mouseover():this._curFocus.icon.attr("tabindex","-1").addClass("hoverCell").focus().mouseover(),this._curFocus.dialog=null,this._index.editor=0):this.element.find(".e-dialog:visible").length==0&&i.keyCode==27&&n(".fullScreenView").length!=0?(this._maxViewClsBtnClick(),t.isNullOrUndefined(this._pivotGrid._curFocus.cell)?this._curFocus.tab.hasClass("e-icon")||this._curFocus.tab.focus().mouseover():this._pivotGrid._curFocus.cell.focus().mouseover()):this.element.find(".chartTypesDialog:visible").length>0&&i.which===27?(this.element.find(".chartTypesDialog").remove(),this._curFocus.chartimg=null):n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&i.which===27&&(t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(u)||u.attr("tabindex","-1").focus().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().addClass("hoverCell")),(i.which===9&&i.shiftKey||i.which===9)&&this.element.find(".e-dialog:visible").length>0?(i.preventDefault(),this._curFocus.editor=null,this.element.find(".e-dialog .hoverCell:visible").removeClass("hoverCell"),f=!t.isNullOrUndefined(this._dllSortMeasure)&&this._dllSortMeasure.model.enabled&&this.element.find("#measuresList_container:visible").length>0||!t.isNullOrUndefined(this._dllfMeasuresList)&&this._dllfMeasuresList.model.enabled&&this.element.find("#fMeasuresList_container:visible").length>0?this.element.find(".e-dialog .filterEnable:visible,#measuresList_container:visible,#fMeasuresList_container:visible,#filterCondition_container:visible,.e-dialog .filterFrom:visible:not([disabled='disabled']),.e-dialog .filterTo:visible:not([disabled='disabled']),.e-dialog .radioBtnAsc:visible:not([disabled='disabled']),.e-dialog .preserveHrchy:visible:not([disabled='disabled']),.e-dialog .dialogOKBtn:visible:not([aria-disabled='true']),.e-dialog .dialogCancelBtn:visible,.e-dialog .e-close:visible,.e-dialog .checkAll:visible,.e-dialog .unCheckAll:visible,.e-dialog .sortfiltTab .e-active:visible,.e-dialog .measureEditor:visible:first,.e-dialog .e-text:visible:first,.e-dialog .sortEnable:visible,.e-dialog .reportName:visible,#reportNameList_container:visible"):this.element.find(".e-dialog .filterEnable:visible,.e-dialog .filterFrom:visible:not([disabled='disabled']),.e-dialog .filterTo:visible:not([disabled='disabled']),.e-dialog .radioBtnAsc:visible:not([disabled='disabled']),.e-dialog .preserveHrchy:visible:not([disabled='disabled']),.e-dialog .dialogOKBtn:visible:not([aria-disabled='true']),.e-dialog .dialogCancelBtn:visible,.e-dialog .e-close:visible,.e-dialog .checkAll:visible,.e-dialog .unCheckAll:visible,.e-dialog .sortfiltTab .e-active:visible,.e-dialog .measureEditor:visible:first,.e-dialog .e-text:visible:first,.e-dialog .sortEnable:visible,.e-dialog .reportName:visible,#reportNameList_container:visible"),t.isNullOrUndefined(this._curFocus.dialog)?(this._index.dialog=f.length>4?4:2,this._curFocus.dialog=f.eq(this._index.dialog)):(this._curFocus.dialog.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===9&&i.shiftKey?this._index.dialog=this._index.dialog-1<0?f.length-1:this._index.dialog-1:i.which===9&&(this._index.dialog=this._index.dialog+1>f.length-1?0:this._index.dialog+1),this._curFocus.dialog=f.eq(this._index.dialog)),this._curFocus.dialog.hasClass("e-input")||this._curFocus.dialog.attr("type")=="radio"?this._curFocus.dialog.attr("tabindex","-1").focus():this._curFocus.dialog.attr("tabindex","-1").focus().addClass("hoverCell").mouseover):(i.which===9&&i.shiftKey||i.which===9)&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&(i.preventDefault(),this.element.find(".hoverCell").removeClass("hoverCell").mouseleave(),this.element.find(".e-node-focus").removeClass("e-node-focus"),this._index.button=1,this._index.icon=1,this._index.chartimg=0,this._index.tree=0,this._index.dialog=0,this._curFocus.button=null,this._curFocus.icon=null,this._curFocus.chartimg=null,this._curFocus.tree=null,this._curFocus.editor=null,this._curFocus.dialog=null,n(".fullScreenView").length!=0?n("[role='columnheader']:visible:not([p='0,0'])").first().length>0&&(f=n("[role='columnheader']:visible:not([p='0,0']):first")):f=this.element.find("[role='columnheader']:visible:not([p='0,0']):first,.schemaFieldTree .e-text:visible:first,.reportToolbar li:visible:first,#reportList_wrapper:visible,#cubeList_wrapper:visible,#cubeSelector_wrapper:visible,.cubeTreeView .e-text:visible:first,.categoricalAxis button:visible:first,.rowAxis button:visible:first,.slicerAxis button:visible:first,.schemaColumn button:visible:first,.schemaRow button:visible:first,.schemaFilter button:visible:first,.schemaValue button:visible:first,.toggleExpandButton:visible:first,.toggleCollapseButton:visible:first,#clientTab .e-active:visible"),t.isNullOrUndefined(this._curFocus.tab)?(this._index.tab=0,this._curFocus.tab=f.eq(this._index.tab).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this._curFocus.tab.hasClass("e-button")&&this._curFocus.tab.parent().find(".removeSplitBtn:visible").addClass("hoverCell")):(this._curFocus.tab.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===9&&i.shiftKey?this._index.tab=this._index.tab-1<0?f.length-1:this._index.tab-1:i.which===9&&(this._index.tab=this._index.tab+1>f.length-1?0:this._index.tab+1),this._curFocus.tab=f.eq(this._index.tab).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this._curFocus.tab.hasClass("e-button")&&this._curFocus.tab.parent().find(".removeSplitBtn:visible").addClass("hoverCell"))),this.element.find(".e-dialog:visible").length>0&&i.keyCode==13){if(n(i.target).hasClass("memberCurrentPage")&&n(i.target).parents(".e-pivotschemadesigner").length==0){t.Pivot.editorTreeNavigatee(i,this);return}if(n(i.target).hasClass("searchEditorTreeView")&&n(i.target).parents(".e-pivotschemadesigner").length==0&&n(i.target).parents(".e-dialog").find(".nextPageDiv").length>0){t.Pivot._searchEditorTreeNodes(i,this);return}i.preventDefault();t.isNullOrUndefined(this._curFocus.editor)?t.isNullOrUndefined(this._curFocus.dialog)?t.isNullOrUndefined(this._curFocus.icon)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","-1").focus().mouseover():this._curFocus.icon.attr("tabindex","-1").focus().mouseover():this._curFocus.dialog.hasClass("e-text")?this.element.find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click():(this._curFocus.dialog.click(),(this._curFocus.dialog.hasClass("dialogOKBtn")||this._curFocus.dialog.hasClass("dialogCancelBtn")||this._curFocus.dialog.hasClass("e-close"))&&(this._curFocus.dialog=null),this._index.editor=0):this._curFocus.editor.hasClass("e-text")&&this.element.find(".e-dialog .hoverCell").parent().find(".e-chkbox-small").click()}else i.keyCode!=13||t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("role")=="columnheader"||(i.preventDefault(),(!t.isNullOrUndefined(this._curFocus.icon)||!t.isNullOrUndefined(this._curFocus.tab)&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&this.element.find(".hoverCell:visible").length>0)&&this.element.find(".hoverCell:visible")[0].click(),t.isNullOrUndefined(this.element.find(".chartTypesDialog"))||t.isNullOrUndefined(this._curFocus.chartimg)||(this._curFocus.chartimg.click(),t.isNullOrUndefined(this._curFocus.icon)||this._curFocus.icon.attr("tabindex","-1").focus().mouseover(),this._index.chartimg=0,this._curFocus.chartimg=null));(i.which===39||i.which===37)&&this.element.find(".e-dialog:visible").length>0&&this.element.find(".e-dialog .e-text:visible").hasClass("hoverCell")?this.element.find(".e-dialog .hoverCell").parent().find(".e-plus,.e-minus").click():(i.which===39||i.which===37)&&this.element.find(".cubeTreeView .e-text:visible").hasClass("hoverCell")&&!this.element.find(".editorTreeView:visible").length>0?this.element.find(".cubeTreeView .hoverCell").parent().find(".e-plus,.e-minus").click():(i.which===37||i.which===39||i.which===38||i.which===40)&&(this.element.find(".chartTypesDialog").length>0||this.element.find(".reportDBDialog").length>0)?(i.preventDefault(),e=this.element.find(".chartTypesDialog").length>0?this.element.find(".chartTypesDialog"):this.element.find(".reportDBDialog"),e.tabindex=-1,e.focus(),r=e.find(".chartTypesIcon").length>0?e.find(".chartTypesIcon"):this.element.find(".reportDBIcon"),t.isNullOrUndefined(this._curFocus.chartimg)?(this._index.chartimg=i.which==39?0:i.which==37?r.length-1:0,this._curFocus.chartimg=r.eq(this._index.chartimg).addClass("hoverCell").mouseover()):(this._curFocus.chartimg.removeClass("hoverCell").mouseleave(),i.which===39?this._index.chartimg=this._index.chartimg+1>r.length-1?0:this._index.chartimg+1:i.which===37?this._index.chartimg=this._index.chartimg-1<0?r.length-1:this._index.chartimg-1:i.which===40&&e.find(".chartTypesIcon").length>0?this._index.chartimg=this._index.chartimg+5>r.length-1?(this._index.chartimg+5)%10:this._index.chartimg+5:i.which===38&&e.find(".chartTypesIcon").length>0&&(this._index.chartimg=this._index.chartimg-5<0?r.length-1:this._index.chartimg-5),this._curFocus.chartimg=r.eq(this._index.chartimg).addClass("hoverCell").mouseover())):(i.which===37||i.which===39)&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-icon")&&!this._curFocus.tab.hasClass("toggleCollapseButton")&&!this._curFocus.tab.hasClass("toggleExpandButton")&&!this.element.find(".e-dialog:visible").length>0&&(i.preventDefault(),this._curFocus.tab.removeClass("hoverCell").mouseleave(),r=this.element.find(".reportToolbar .e-icon:visible:not(.reportCol)"),t.isNullOrUndefined(this._curFocus.icon)?(this._index.icon=i.which==39?1:i.which==37?r.length-2:0,this._curFocus.icon=r.eq(this._index.icon).addClass("hoverCell").mouseover()):(this._curFocus.icon.removeClass("hoverCell").mouseleave(),i.which===39?this._index.icon=this._index.icon+1>r.length-2?0:this._index.icon+1:i.which===37&&(this._index.icon=this._index.icon-1<0?r.length-2:this._index.icon-1),this._curFocus.icon=r.eq(this._index.icon).addClass("hoverCell").mouseover()));(i.which===40||i.which===38)&&this.element.find(".e-dialog:visible").length>0&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&(this.element.find(".e-dialog .e-text").hasClass("hoverCell")||this.element.find(".e-dialog .measureEditor").hasClass("hoverCell"))?(i.preventDefault(),this.element.find(".e-dialog .hoverCell").removeClass("hoverCell"),this.element.find(".e-dialog .e-node-focus").removeClass("e-node-focus"),t.isNullOrUndefined(this._curFocus.dialog)||this._curFocus.dialog.mouseleave(),r=this.element.find(".e-dialog .measureEditor:visible,.e-dialog .e-text:visible"),t.isNullOrUndefined(this._curFocus.editor)?(this._index.editor=r.length>1?i.which==40?1:i.which==38?r.length-1:0:0,this._curFocus.editor=r.eq(this._index.editor).attr("tabindex","0").focus().addClass("hoverCell")):(this._curFocus.editor.attr("tabindex","0").removeClass("hoverCell"),i.which===40?this._index.editor=this._index.editor+1>r.length-1?0:this._index.editor+1:i.which===38&&(this._index.editor=this._index.editor-1<0?r.length-1:this._index.editor-1),this._curFocus.editor=r.eq(this._index.editor).attr("tabindex","0").focus().addClass("hoverCell"))):(i.which===40||i.which===38)&&!this.element.find(".e-dialog:visible").length>0&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-text")&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&t.isNullOrUndefined(this._schemaData)?(this.element.find(".hoverCell").removeClass("hoverCell"),this._curFocus.tab.mouseleave(),i.preventDefault(),r=this.element.find(".cubeTreeView .e-text:visible"),t.isNullOrUndefined(this._curFocus.tree)?(this._index.tree=i.which==40?1:i.which==38?r.length-1:0,this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this.element.find(".e-node-focus").removeClass("e-node-focus")):(this._curFocus.tree.attr("tabindex","0").removeClass("hoverCell").mouseleave(),i.which===40?this._index.tree=this._index.tree+1>r.length-1?0:this._index.tree+1:i.which===38&&(this._index.tree=this._index.tree-1<0?r.length-1:this._index.tree-1),this._curFocus.tree=r.eq(this._index.tree).attr("tabindex","-1").focus().addClass("hoverCell").mouseover(),this.element.find(".e-node-focus").removeClass("e-node-focus"))):(i.which===40||i.which===38)&&!t.isNullOrUndefined(this._curFocus.tab)&&this._curFocus.tab.hasClass("e-button")&&!n(".pivotTree:visible,.pivotTreeContext:visible").length>0&&!this.element.find(".e-dialog:visible").length>0&&t.isNullOrUndefined(this._schemaData)&&(i.preventDefault(),r=null,(this._curFocus.tab.parent().parent().hasClass("categoricalAxis")||this._curFocus.tab.parent().parent().hasClass("rowAxis")||this._curFocus.tab.parent().parent().hasClass("slicerAxis"))&&(this._curFocus.tab.parent().parent().hasClass("categoricalAxis")?r=this.element.find(".categoricalAxis button"):this._curFocus.tab.parent().parent().hasClass("rowAxis")?r=this.element.find(".rowAxis button"):this._curFocus.tab.parent().parent().hasClass("slicerAxis")&&(r=this.element.find(".slicerAxis button")),t.isNullOrUndefined(this._curFocus.tab)||(this._curFocus.tab.removeClass("hoverCell").attr("tabindex","0").mouseleave(),this._curFocus.tab.parent().find(".removeSplitBtn:visible").focus().removeClass("hoverCell")),t.isNullOrUndefined(this._curFocus.button)?(this._index.button=i.which==40?r.length>1?1:0:i.which==38?r.length-1:0,this._curFocus.button=r.eq(this._index.button).attr("tabindex","0").focus().addClass("hoverCell"),this._curFocus.button.parent().find(".removeSplitBtn:visible").addClass("hoverCell")):(this._curFocus.button.attr("tabindex","0").removeClass("hoverCell"),this._curFocus.button.parent().find(".removeSplitBtn:visible").removeClass("hoverCell"),i.which===40?this._index.button=this._index.button+1>r.length-1?0:this._index.button+1:i.which===38&&(this._index.button=this._index.button-1<0?r.length-1:this._index.button-1),this._curFocus.button=r.eq(this._index.button).attr("tabindex","0").focus().addClass("hoverCell"),this._curFocus.button.parent().find(".removeSplitBtn:visible").addClass("hoverCell"))))},_wireMeasureRemoveEvent:function(){this.element.find(".removeMeasure").click(function(t){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");i._isMembersFiltered=!0;n(n(t.target).parent()).remove()})},_wireEditorRemoveEvent:function(){this.element.find(".removeSplitBtn").click(function(i){var r=n(i.target).parents(".e-pivotclient").data("ejPivotClient"),u,f;this._isTimeOut=!0;setTimeout(function(){r._isTimeOut&&r._waitingPopup.show()},800);n(n(i.target).parent()).remove();r._currentReportItems.length!=0&&r._treeViewData.hasOwnProperty(n(i.target).parent().find("button").attr("title"))&&(delete r._treeViewData[n(i.target).parent().find("button").attr("title")],r._currentReportItems.splice(n.inArray(n(i.target).parent().find("button").attr("title"),r._currentReportItems),1));r._off(this.element,"click",".removeSplitBtn");r.model.enableAdvancedFilter&&r.model.analysisMode==t.Pivot.AnalysisMode.Olap&&r.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(u=n(n(i.target)).parent("div:eq(0)").attr("Tag").split(":")[1].split("."),t.isNullOrUndefined(u)||u.length!=2||(r._setUniqueNameFrmBtnTag(u),r._removeFilterTag(r._selectedFieldName)));r.model.beforeServiceInvoke!=null&&r._trigger("beforeServiceInvoke",{action:"removeSplitButton",element:this.element,customObject:r.model.customObject});f=JSON.stringify(r.model.customObject);delete r._fieldSelectedMembers[n(i.target).parent().find("button").attr("title")];r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.removeSplitButton,JSON.stringify({action:"removeSplitButton",clientParams:n(i.target).parent().attr("tag"),olapReport:r.currentReport,clientReports:r.reports,customObject:f}),r._removeSplitButtonSuccess);r._isNodeOrButtonDropped=!0})},_setUniqueNameFrmBtnTag:function(t){var i,r;if(t.length>0)if(i=this.element.find(".cubeTreeView li[tag^='["+t[0]+"'][tag$='"+t[1]+"]']"),i.length>0){for(r=0;r<i.length;r++)if(n(i[r]).attr("tag").split("].").length==2){this._selectedFieldName=n(i[r]).attr("tag");break}}else this._selectedFieldName=i.attr("tag")},_wireDialogEvent:function(){this.element.find(".newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .pvtBtn, .mdxImg,.colSortFilterImg, .rowSortFilterImg, .autoExecuteImg").on(t.eventType.click,function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");if(i.currentTarget.parentElement.className.indexOf("splitBtn")>-1){if(n(n(i.currentTarget).parents(".splitBtn")[0]).attr("tag").indexOf("NAMEDSET")>-1)return!1;r._currentAxis=n(n(i.currentTarget).parents(".splitBtn")[0]).attr("tag").split(":")[0]}i.preventDefault();i.target.innerHTML!=r._getLocalizedLabels("Cancel")&&i.target.innerHTML!=r._getLocalizedLabels("OK")&&i.target.parentElement.innerHTML!=r._getLocalizedLabels("Cancel")&&i.target.parentElement.innerHTML!=r._getLocalizedLabels("OK")&&(r._off(r.element,"click",".newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .mdxImg, .e-txt,.colSortFilterImg, .rowSortFilterImg, .chartTypesImg, .autoExecuteImg"),i.target.className.indexOf("colSortFilterImg")>=0||i.target.className.indexOf("rowSortFilterImg")>=0?(r._sortOrFilterTab=i.target.className.indexOf("SortImg")>=0?"sort":"filter",i.target.className.indexOf("colSortFilterImg")>=0||i.target.className.indexOf("rowSortFilterImg")>=0||r.element.find(".rowAxis").html()!=""||r.element.find(".categoricalAxis").html()!=""||(r._isTimeOut=!0,setTimeout(function(){r._isTimeOut&&r._waitingPopup.show()},800)),r._isSorted=!1,r._isFiltered=!1,r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"FetchSortState",toolbarOperation:null,clientInfo:r._axis=i.target.className.indexOf("colSortFilterImg")>=0?"Column":"Row",olapReport:r.currentReport,clientReports:"",customObject:JSON.stringify(r.model.customObject)}),r._fetchSortState)):i.target.className.indexOf("mdx")>=0?r.model.analysisMode==t.Pivot.AnalysisMode.Olap&&r.model.operationalMode==t.Pivot.OperationalMode.ClientMode?r._mdxQuery(t.olap.base._getParsedMDX(r.model.dataSource,r.model.dataSource.cube)):r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.mdxQuery,JSON.stringify({olapReport:r.currentReport,customObject:JSON.stringify(r.model.customObject)}),r._mdxQuery):i.target.className.indexOf("autoExecute")>=0?(r.model.enableDeferUpdate=!1,r._renderControls(),r._deferReport=r.currentReport,r.model.enableDeferUpdate=!0):(r.model.operationalMode!=t.Pivot.OperationalMode.ServerMode||r.model.analysisMode!=t.Pivot.AnalysisMode.Olap)&&n(i.currentTarget).hasClass("pvtBtn")||r._createDialogRequest(i),r._dimensionName=n(i.currentTarget).parent().attr("tag"));isDropped=!1});this.element.find(".excelExportImg, .wordExportImg, .pdfExportImg").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient"),e,o,s,f,l,a,h,u,c,v,y;(r.model.displaySettings.mode==r.model.clientExportMode||r.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartAndGrid||r.model.clientExportMode==t.PivotClient.ClientExportMode.ChartAndGrid)&&(t.browserInfo().name=="msie"&&t.browserInfo().version<=8&&(r.model.clientExportMode=t.PivotClient.ClientExportMode.GridOnly),e=i.target.className.indexOf("excel")>=0?"Excel":i.target.className.indexOf("word")>=0?"Word":"Pdf",r.model.displaySettings.mode!=t.PivotClient.DisplayMode.GridOnly&&r.model.clientExportMode!=t.PivotClient.ClientExportMode.GridOnly&&(r.chartObj=null,r.chartObj=r.element.find("#"+r._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(r.chartObj)&&!t.isNullOrUndefined(r.otreemapObj)&&(r.chartObj=r.element.find("#"+r.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),r.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"&&(l=r.chartObj.model.primaryXAxis.zoomFactor,r.chartObj.model.primaryXAxis.zoomFactor=1,r.chartObj.model.enableCanvasRendering=!0,r.chartObj.redraw(),a=r.chartObj["export"](),s=a.toDataURL("image/png"),r.chartObj.model.primaryXAxis.zoomFactor=l,r.chartObj.model.enableCanvasRendering=!1,r.chartObj.redraw())),h=r.element.find(".reportlist").data("ejDropDownList").getSelectedValue(),u={url:"",fileName:"PivotClient",exportMode:t.PivotClient.ExportMode.JSON,title:h!=null&&h!=""?h:"",description:""},r._trigger("beforeExport",u),r.model.displaySettings.mode!=t.PivotClient.DisplayMode.ChartOnly&&r.model.clientExportMode!=t.PivotClient.ClientExportMode.ChartOnly&&(c={valueCellColor:r._pivotGrid.element.find(".value").css("color"),valueCellBGColor:r._pivotGrid.element.find(".value").css("background-color"),summaryCellColor:r._pivotGrid.element.find(".summary").css("color"),summaryCellBGColor:r._pivotGrid.element.find(".summary").css("background-color")}),r.model.displaySettings.mode==t.PivotClient.DisplayMode.GridOnly||r.model.clientExportMode==t.PivotClient.ClientExportMode.GridOnly?(f=t.PivotClient.ClientExportMode.GridOnly,o=r.model.operationalMode==t.Pivot.OperationalMode.ClientMode||r._pivotGrid._excelLikeJSONRecords!=null&&u.exportMode==t.PivotClient.ExportMode.JSON||n.trim(u.url)!=""&&u.exportMode==t.PivotClient.ExportMode.JSON?{args:JSON.stringify({exportMode:f,exportOption:e,pGridData:r._pivotGrid.exportRecords!=null&&r._pivotGrid.exportRecords!=""?r._pivotGrid.exportRecords:null,rowCount:r._pivotGrid._excelLikeJSONRecords!=null?r._pivotGrid._excelRowCount:r._pivotGrid._rowCount,columnCount:r._pivotGrid._excelLikeJSONRecords!=null?Math.floor(r._pivotGrid._excelLikeJSONRecords.length/r._pivotGrid._excelRowCount):r._pivotGrid.getJSONRecords()!=null?Math.floor(r._pivotGrid.getJSONRecords().length/r._pivotGrid._rowCount):0,fileName:u.fileName,customObject:JSON.stringify(r._pivotGrid.model.customObject),title:u.title,description:u.description})}:{args:JSON.stringify({exportMode:f,exportOption:e,currentReport:r.model.enableDeferUpdate?r._deferReport:r.currentReport,layout:r.gridLayout(),colorSettings:JSON.stringify(c),title:u.title,description:u.description})}):r.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartOnly||r.model.clientExportMode==t.PivotClient.ClientExportMode.ChartOnly?(f=t.PivotClient.ClientExportMode.ChartOnly,o=r.model.operationalMode==t.Pivot.OperationalMode.ClientMode||r._pivotGrid._excelLikeJSONRecords!=null&&u.exportMode==t.PivotClient.ExportMode.JSON||n.trim(u.url)!=""&&u.exportMode==t.PivotClient.ExportMode.JSON?{args:JSON.stringify({exportMode:f,exportOption:e,fileName:u.fileName,chartdata:s.split(",")[1],bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}:{args:JSON.stringify({exportMode:f,exportOption:e,currentReport:r.model.enableDeferUpdate?r._deferReport:r.currentReport,chartdata:s.split(",")[1],legenddata:"",bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}):(f=t.PivotClient.ClientExportMode.ChartAndGrid,o=r.model.operationalMode==t.Pivot.OperationalMode.ClientMode||r._pivotGrid._excelLikeJSONRecords!=null&&u.exportMode==t.PivotClient.ExportMode.JSON||n.trim(u.url)!=""&&u.exportMode==t.PivotClient.ExportMode.JSON?{args:JSON.stringify({exportMode:f,exportOption:e,pGridData:r._pivotGrid.exportRecords!=null&&r._pivotGrid.exportRecords!=""?r._pivotGrid.exportRecords:null,rowCount:r._pivotGrid._excelLikeJSONRecords!=null?r._pivotGrid._excelRowCount:r._pivotGrid._rowCount,columnCount:r._pivotGrid._excelLikeJSONRecords!=null?Math.floor(r._pivotGrid._excelLikeJSONRecords.length/r._pivotGrid._excelRowCount):r._pivotGrid.getJSONRecords()!=null?Math.floor(r._pivotGrid.getJSONRecords().length/r._pivotGrid._rowCount):0,fileName:u.fileName,customObject:JSON.stringify(r._pivotGrid.model.customObject),chartdata:s.split(",")[1],bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}:{args:JSON.stringify({exportMode:f,exportOption:e,currentReport:r.model.enableDeferUpdate?r._deferReport:r.currentReport,layout:r.gridLayout(),colorSettings:JSON.stringify(c),chartdata:s.split(",")[1],legenddata:"",bgColor:n(r._pivotChart.element).css("background-color"),title:u.title,description:u.description})}),t.raiseWebFormsServerEvents&&n.trim(u.url)!=""&&u.url=="pivotClientExport"&&u.exportMode==t.PivotClient.ExportMode.JSON?(v={model:r.model,originalEventType:u.url},y=o,t.raiseWebFormsServerEvents(u.url,v,y),setTimeout(function(){t.isOnWebForms=!0},1e3)):r.doPostBack(n.trim(u.url)!=""?u.url:r.model.url+"/"+r.model.serviceMethodSettings.exportPivotClient,o))});this.element.find(".toggleaxisImg").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r;i._isTimeOut=!0;setTimeout(function(){i._isTimeOut&&i._waitingPopup.show()},800);i.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i.chartObj=null,i.chartObj=i.element.find("#"+i._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(i.chartObj)&&!t.isNullOrUndefined(i.otreemapObj)&&(i.chartObj=i.element.find("#"+i.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));i.model.operationalMode==t.Pivot.OperationalMode.ClientMode?(r=i.model.dataSource.rows,i.model.dataSource.rows=i.model.dataSource.columns,i.model.dataSource.columns=r,i.model.analysisMode==t.Pivot.AnalysisMode.Olap&&i.model.dataSource.values.length>0&&(i.model.dataSource.values[0].axis=i.model.dataSource.values[0].axis=="rows"?"columns":i.model.dataSource.values[0].axis=="columns"?"rows":"columns"),i.model.analysisMode==t.Pivot.AnalysisMode.Olap&&t.olap.base.clearDrilledItems(i.model.dataSource,{action:"nodeDropped"},i),i.refreshControl()):i.model.analysisMode==t.Pivot.AnalysisMode.Pivot?i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toggleAxis",args:JSON.stringify({currentReport:JSON.parse(i.getOlapReport()).Report,sortedHeaders:t.isNullOrUndefined(i._ascdes)?"":i._ascdes}),customObject:JSON.stringify(i.model.customObject)}),i._toggleAxisSuccess):(i.element.find(".rowAxis").html()!=""||i.element.find(".categoricalAxis").html()!="")&&i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.toggleAxis,JSON.stringify({action:"toggleAxis",currentReport:i.currentReport,clientReports:i.reports,customObject:JSON.stringify(i.model.customObject)}),i._toggleAxisSuccess)});this.element.find(".reportDBImg").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r=t.buildTag("div.reportDBDialog#reportDBDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.saveReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Save"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.saveAsReportImg reportDBIcon").attr({title:i._getLocalizedLabels("SaveAs"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.loadReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Load"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.removeDBReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Remove"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.renameDBReportImg reportDBIcon").attr({title:i._getLocalizedLabels("Rename"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),u=i.element.find("div.reportDBDialog");u.length==0&&(n(r).appendTo(i.element),n(r).css("left",this.offsetLeft+20+"px").css("top",this.offsetTop+20+"px"));i.element.find(".reportDBIcon").click(function(u){var s,e,o,f;if(n(r).remove(),i=i,i._off(i.element,"click",".reportDBIcon"),u.target.className.indexOf("loadReportImg")>=0||u.target.className.indexOf("removeDBReportImg")>=0||u.target.className.indexOf("renameDBReportImg")>=0)s=u.target.className.indexOf("loadReportImg")>=0?"LoadReport":u.target.className.indexOf("removeDBReportImg")>=0?"RemoveDBReport":"RenameDBReport",i._isTimeOut=!0,setTimeout(function(){i._isTimeOut&&i._waitingPopup.show()},800),i.model.operationalMode=="servermode"?(i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"FetchingReportList",element:i.element,customObject:i.model.customObject}),f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.fetchReportList,JSON.stringify({customObject:f,action:s,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode}),i._fetchReportListSuccess)):(e={url:"",reportCollection:i._clientReportCollection,reportList:"",mode:i.model.analysisMode},i._trigger("fetchReport",{targetControl:i,fetchReportSetting:e}),i.model.enableLocalStorage?i._fetchReportListSuccess({d:[{Key:"ReportNameList",Value:e.reportList}]}):(f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",e.url+"/"+i.model.serviceMethodSettings.fetchReportList,JSON.stringify({customObject:f,action:s,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode}),i._fetchReportListSuccess)));else if(u.target.className.indexOf("saveReportImg")>=0){if(i._currentRecordName=="")return i._createDialogRequest(u),!1;i._isTimeOut=!0;setTimeout(function(){i._isTimeOut&&i._waitingPopup.show()},800);i.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"saveReport",element:this.element,customObject:i.model.customObject}),f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:i._currentRecordName,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode,olapReport:i.currentReport,clientReports:i.model.analysisMode=="pivot"?JSON.stringify(i._clientReportCollection):i.reports,customObject:f}),i._toolbarOperationSuccess)):(o={url:"",reportName:i._currentRecordName,reportCollection:i._clientReportCollection,mode:i.model.analysisMode,filterCollection:i._currentReportItems},i._trigger("saveReport",{targetControl:i,saveReportSetting:o}),i.model.enableLocalStorage||(f=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",o.url+"/"+i.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:o.reportName,operationalMode:i.model.operationalMode,analysisMode:i.model.analysisMode,olapReport:JSON.stringify(i.model.dataSource),clientReports:JSON.stringify(i._clientReportCollection)+":>>:"+JSON.stringify(i._currentReportItems),customObject:f}),i._toolbarOperationSuccess)))}else(i.model.operationalMode!=t.Pivot.OperationalMode.ServerMode||i.model.analysisMode!=t.Pivot.AnalysisMode.Olap)&&n(u.currentTarget).hasClass("pvtBtn")||i._createDialogRequest(u)})});this.element.find(".chartTypesImg").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient"),u=t.buildTag("div.chartTypesDialog#chartTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.line chartTypesIcon").attr({title:r._getLocalizedLabels("Line"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.spline chartTypesIcon").attr({title:r._getLocalizedLabels("Spline"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.column chartTypesIcon").attr({title:r._getLocalizedLabels("Column"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.area chartTypesIcon").attr({title:r._getLocalizedLabels("Area"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.splinearea chartTypesIcon").attr({title:r._getLocalizedLabels("SplineArea"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.stepline chartTypesIcon").attr({title:r._getLocalizedLabels("StepLine"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.steparea chartTypesIcon").attr({title:r._getLocalizedLabels("StepArea"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pie chartTypesIcon").attr({title:r._getLocalizedLabels("Pie"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.bar chartTypesIcon").attr({title:r._getLocalizedLabels("Bar"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.stackingarea chartTypesIcon").attr({title:r._getLocalizedLabels("StackingArea"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.stackingcolumn chartTypesIcon").attr({title:r._getLocalizedLabels("StackingColumn"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.stackingbar chartTypesIcon").attr({title:r._getLocalizedLabels("StackingBar"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.funnel chartTypesIcon").attr({title:r._getLocalizedLabels("Funnel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pyramid chartTypesIcon").attr({title:r._getLocalizedLabels("Pyramid"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.doughnut chartTypesIcon").attr({title:r._getLocalizedLabels("Doughnut"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.scatter chartTypesIcon").attr({title:r._getLocalizedLabels("Scatter"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.bubble chartTypesIcon").attr({title:r._getLocalizedLabels("Bubble"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.waterfall chartTypesIcon").attr({title:r._getLocalizedLabels("WaterFall"),tabindex:0})[0].outerHTML)[0].outerHTML+(r.model.enablePivotTreeMap?t.buildTag("td",t.buildTag("div.treemap chartTypesIcon").attr({title:r._getLocalizedLabels("TreeMap"),tabindex:0})[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML),f=r.element.find("div.chartTypesDialog");f.length==0&&(n(u).appendTo(r.element),r.model.enableToolBar?n(u).css("left",n(i.target).offset().left+10+"px").css("top",n(i.target).offset().top+15+"px"):n(u).css("left",this.offsetLeft+20+"px").css("top",this.offsetTop+20+"px"),r._pivotChart.model.enable3D||r.element.find("."+r._pivotChart.seriesType()).addClass("activeChartType"));n(".chartTypesIcon").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient"),f,e;if(r.element.find(".chartTypesIcon").removeClass("activeChartType"),n(u).remove(),f=i.target.className.split(" ")[0],r.model.chartType=f,r._pivotChart.model.enable3D=!1,r._pivotChart.model.type=f,r._pivotChart.model.commonSeriesOptions.type=f,f=="funnel"&&(r._pivotChart.model.commonSeriesOptions.marker={dataLabel:{visible:!0,shape:"none",font:{color:r.element.css("color"),size:"12px",fontWeight:"lighter"}}}),r._pivotChart.getJSONRecords()!=null){if(r.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){if(r.chartObj=null,r.chartObj=r.element.find("#"+r._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(r.chartObj)&&!t.isNullOrUndefined(r.otreemapObj)&&(r.chartObj=r.element.find("#"+r.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),!t.isNullOrUndefined(r.chartObj)){if(r._isrenderTreeMap=!0,r.model.enableDeferUpdate)r._ischartTypesChanged=!0,r.model.enablePivotTreeMap&&this.title.toLocaleLowerCase()=="treemap"?r.model.enablePivotTreeMap&&(r.element.find("#"+r._id+"_PivotChartContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivotchart"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivottreemap")?r.otreemapObj.renderTreeMapFromJSON(r._pivotChart.getJSONRecords()):(r.element.find("#"+r._id+"_PivotChart").ejPivotTreeMap({url:r.model.url,customObject:this.model.customObject,canResize:r.model.isResponsive,currentReport:r.currentReport,locale:r.locale(),size:{height:r._chartHeight,width:r._chartWidth},drillSuccess:t.proxy(r._treemapDrillSuccess,r),beforeServiceInvoke:r.model.treeMapLoad}),r.otreemapObj=r.element.find("#"+r._id+"_PivotChart").data("ejPivotTreeMap"),r._isrenderTreeMap=!0,r.chartObj=null)):(r.element.find("#"+r._id+"_PivotChartTreeMapContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivottreemap"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivotchart")?r._pivotChart.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()}):(r.element.find("#"+r._id+"_PivotChart").ejPivotChart({url:r.model.url,customObject:this.model.customObject,enableRTL:r.model.enableRTL,canResize:r.model.isResponsive,currentReport:r.currentReport,customObject:r.model.customObject,locale:r.locale(),showTooltip:!0,size:{height:r._chartHeight,width:r._chartWidth},commonSeriesOptions:{type:r.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:r.model.chartLoad,drillSuccess:t.proxy(r._chartDrillSuccess,r)}),r._pivotChart=r.element.find("#"+r._id+"_PivotChart").data("ejPivotChart"),r.chartObj=null));else if(r.model.enablePivotTreeMap&&this.title.toLocaleLowerCase()=="treemap")r.model.enablePivotTreeMap&&(r.element.find("#"+r._id+"_PivotChartContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivotchart"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivottreemap")?r.otreemapObj.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()}):(r.element.find("#"+r._id+"_PivotChart").ejPivotTreeMap({url:r.model.url,customObject:r.model.customObject,canResize:r.model.isResponsive,currentReport:r.currentReport,locale:r.locale(),size:{height:r._chartHeight,width:r._chartWidth},drillSuccess:t.proxy(r._treemapDrillSuccess,r),beforeServiceInvoke:r.model.treeMapLoad}),r.otreemapObj=r.element.find("#"+r._id+"_PivotChart").data("ejPivotTreeMap"),r.chartObj=null));else{if(r.element.find("#"+r._id+"_PivotChartTreeMapContainer").remove(),r.element.find("#"+r._id+"_PivotChart").removeClass("e-pivottreemap"),r.element.find("#"+r._id+"_PivotChart").hasClass("e-pivotchart"))return r._pivotChart.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()}),!1;r.element.find("#"+r._id+"_PivotChart").ejPivotChart({url:r.model.url,customObject:r.model.customObject,enableRTL:r.model.enableRTL,canResize:r.model.isResponsive,currentReport:r.currentReport,customObject:r.model.customObject,locale:r.locale(),showTooltip:!0,size:{height:r._chartHeight,width:r._chartWidth},commonSeriesOptions:{type:r.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:r.model.chartLoad,drillSuccess:t.proxy(r._chartDrillSuccess,r)});r._pivotChart=r.element.find("#"+r._id+"_PivotChart").data("ejPivotChart");r.chartObj=null}e=JSON.stringify(r.model.customObject);r.doAjaxPost("POST",r.model.url+"/"+r.model.serviceMethodSettings.updateReport,JSON.stringify({action:"chartTypeChanged",clientParams:f,olapReport:r.currentReport,clientReports:r.reports,customObject:e}),r._chartTypeChangedSuccess)}}else r._pivotChart.renderControlSuccess({JsonRecords:JSON.stringify(r._pivotChart.getJSONRecords()),OlapReport:r._pivotChart.getOlapReport()});r.model.isResponsive&&(r.chartObj=r.element.find("#"+r._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(r.chartObj)||r.element.find("#"+r.chartObj._id).ejChart("option",{model:{size:{height:r._chartHeight}}}))}else r._isTimeOut=!1,r._waitingPopup.hide()})});n(document).click(function(t){t.target.className.indexOf("chartTypesImg")==-1&&n(".chartTypesDialog").remove();t.target.className.indexOf("reportDBImg")==-1&&n(".reportDBDialog").remove();t.target.className.indexOf("exportImg")==-1&&n(".exportTypesDialog").remove();t.target.className.indexOf("chart3DImg")==-1&&n(".chart3DTypesDialog").remove();t.target.className.indexOf("smartLabels")==-1&&n(".smartLabelsDialog").remove();t.target.className.indexOf("interaction")==-1&&n(".interactionsDialog").remove()});this.element.find(".dialogCancelBtn").on(t.eventType.click,function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");i.preventDefault();r.element.find(".e-dialog").hide();r.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();t.Pivot.closePreventPanel(r)});this.element.find(".dialogOKBtn").on(t.eventType.click,function(r){var u=n(this).parents(".e-pivotclient").data("ejPivotClient"),b,p,y,o,v,tt,it,rt,a,k,d,ft,et,g,s,c,nt,f,l;if(r.preventDefault(),u.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(u.chartObj=u.element.find("#"+u._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(u.chartObj)&&u.model.enablePivotTreeMap&&!t.isNullOrUndefined(u.otreemapObj)&&(u.chartObj=u.element.find("#"+u.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),b=t.browserInfo().name=="msie"&&t.browserInfo().version<=8?u._dialogTitle:u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar")[0].textContent==i?u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar")[0].innerText:u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar")[0].textContent,b==u._getLocalizedLabels("Load"))if(u._currentRecordName=u.element.find(".reportNameList")[0].value,o=u.element.find(".reportNameList")[0].value,o!="")u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800),u._fieldMembers={},u._fieldSelectedMembers={},u.model.operationalMode=="servermode"?(u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"loadReport",element:this.element,customObject:u.model.customObject}),s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.loadReport,JSON.stringify({reportName:o,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:currentReport,clientReports:u.reports,customObject:s,clientParams:JSON.stringify(u.model.enableMeasureGroups)}),u.model.analysisMode==t.Pivot.AnalysisMode.Pivot?u._renderControlSuccess:u._toolbarOperationSuccess)):(p={url:"",reportCollection:u._clientReportCollection,selectedReport:o,mode:u.model.analysisMode},u._trigger("loadReport",{targetControl:u,loadReportSetting:p}),u.model.enableLocalStorage?(u.model.dataSource=p.reportCollection[0],u._currentReportCollection=p.reportCollection,u.refreshControl(),u._refreshReportList(),u._pivotSchemaDesigner&&u._pivotSchemaDesigner._refreshPivotButtons()):(s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",p.url+"/"+u.model.serviceMethodSettings.loadReport,JSON.stringify({reportName:o,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:currentReport,clientReports:u.reports,customObject:s,clientParams:JSON.stringify(u.model.enableMeasureGroups)}),u._clientToolbarOperationSuccess)));else return t.Pivot._createErrorDialog(u._getLocalizedLabels("SelectRecordAlertMsg"),"Error",u),!1;else if(b==u._getLocalizedLabels("Remove")){if(o=u.element.find(".reportNameList")[0].value,o==""||t.isNullOrUndefined(o))return t.Pivot._createErrorDialog(u._getLocalizedLabels("SelectRecordAlertMsg"),"Error",u),!1;u._currentRecordName=o==u._currentRecordName?"":u._currentRecordName;u._isTimeOut=!0;setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800);u.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(v={url:"",selectedReport:o,mode:u.model.analysisMode},u._trigger("loadReport",{targetControl:u,fetchReportSetting:v}));u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"removeDBReport",element:this.element,customObject:u.model.customObject});s=JSON.stringify(u.model.customObject);u._fieldMembers={};u._fieldSelectedMembers={};u.doAjaxPost("POST",(u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?v.url:u.model.url)+"/"+u.model.serviceMethodSettings.removeDBReport,JSON.stringify({reportName:o,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,customObject:s}),u._toolbarOperationSuccess)}else if(b==u._getLocalizedLabels("Rename")){if(y=u.element.find(".renameReport").val(),o=u.element.find(".reportNameList")[0].value,o==""||t.isNullOrUndefined(o)||y==""||t.isNullOrUndefined(y))return o==""||t.isNullOrUndefined(o)?t.Pivot._createErrorDialog(u._getLocalizedLabels("SelectRecordAlertMsg"),"Error",u):(y==""||t.isNullOrUndefined(y))&&t.Pivot._createErrorDialog(u._getLocalizedLabels("SetReportNameAlertMsg"),"Error",u),!1;u._isTimeOut=!0;setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800);u.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&(v={url:"",selectedReport:o,mode:u.model.analysisMode},u._trigger("loadReport",{targetControl:u,fetchReportSetting:v}));u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"renameDBReport",element:this.element,customObject:u.model.customObject});s=JSON.stringify(u.model.customObject);u.doAjaxPost("POST",(u.model.operationalMode==t.Pivot.OperationalMode.ClientMode?v.url:u.model.url)+"/"+u.model.serviceMethodSettings.renameDBReport,JSON.stringify({selectedReport:o,renameReport:y,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,customObject:s}),u._toolbarOperationSuccess)}else if(u.element.find(".sortingDlg").length>0){if(u.element.find(".sortEnable")[0].checked==!0&&u.element.find(".measuresList")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterMeasureSelectionAlertMsg"),"Error",u),!1;if(u.element.find(".filterEnable")[0].checked==!0){if(u.element.find(".fMeasuresList")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterMeasureSelectionAlertMsg"),"Error",u),!1;if(u.element.find(".filterCondition")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterConditionAlertMsg"),"Error",u),!1;if(u.element.find(".filterFrom")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterStartValueAlertMsg"),"Error",u),!1;if((u.element.find(".filterCondition")[0].value=="Between"||u.element.find(".filterCondition")[0].value=="NotBetween")&&u.element.find(".filterTo")[0].value=="")return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterEndValueAlertMsg"),"Error",u),!1}if(tt=null,it=null,tt=(u._isSorted==!1||u._isSorted==!0)&&u.element.find(".sortEnable")[0].checked==!0?n("li[tag*='"+u.element.find(".measuresList")[0].value+"']").attr("tag")+"::"+(u.element.find(".radioBtnAsc")[0].checked==!0?"ASC":"DESC")+"::"+u._axis+"::"+(u.element.find(".preserveHrchy")[0].checked==!0?"PHT":"PHF"):u._isSorted==!0&&u.element.find(".sortDisable")[0].checked==!0?"Disable Sorting:: ::"+u._axis+":: ":" :: ::"+u._axis+":: ",it=(u._isFiltered==!1||u._isFiltered==!0)&&u.element.find(".filterEnable")[0].checked==!0?n("li[tag*='"+u.element.find(".fMeasuresList")[0].value+"']").attr("tag")+"::"+u.element.find(".filterCondition")[0].value+"::"+u.element.find(".filterFrom")[0].value+"::"+u.element.find(".filterTo")[0].value:u._isFiltered==!0&&u.element.find(".filterDisable")[0].checked==!0?"Disable Filtering":"",u._SortFilterDetails=tt+"||"+it,u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800),u.element.find(".sortEnable")[0].checked==!0||u.element.find(".filterEnable")[0].checked==!0)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:"SortOrFilter",clientInfo:u._SortFilterDetails,olapReport:u.currentReport,clientReports:u.reports,customObject:JSON.stringify(u.model.customObject)}),u._toolbarOperationSuccess);else if(u.element.find(".sortDisable")[0].checked==!0||u.element.find(".filterDisable")[0].checked==!0)if(u._isSorted==!0||u._isFiltered==!0)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:"SortOrFilter",clientInfo:u._SortFilterDetails,olapReport:u.currentReport,clientReports:u.reports,customObject:JSON.stringify(u.model.customObject)}),u._toolbarOperationSuccess),u._isSorted=!1;else return t.Pivot._createErrorDialog(u._getLocalizedLabels("FilterInvalidAlertMsg"),"Error",u),u._isTimeOut=!1,u._waitingPopup.hide(),!1}else{if(n(".memberEditorDiv").length>0&&r.target.id=="OKBtn"){if(u.model.enableAdvancedFilter&&u._excelFilterInfo.length>0&&(u._removeFilterTag(u._selectedFieldName),u._selectedLevelUniqueName&&u._removeFilterTag(u._selectedLevelUniqueName)),u._currentItem.indexOf(u._getLocalizedLabels("Measures"))<0&&t.Pivot.updateTreeView(u),!u.model.enableMemberEditorPaging&&u._getSelectedNodes()==0&&args_innerHTML!=u._getLocalizedLabels("Measures")&&args_innerHTML!="ToolbarButtons")return!1;if(u._currentItem.indexOf(u._getLocalizedLabels("Measures"))<0){if(u._currentReportItems.length!=0)for(rt=!1,c=0;c<u._currentReportItems.length;c++)if(u._currentReportItems[c]==u._currentItem){rt=!0;break}rt&&u._currentReportItems.length!=0||u._currentReportItems.push(u._currentItem);u._treeViewData[u._currentItem]=u._memberTreeObj.dataSource()}}if(a=null,args_innerHTML!="ToolbarButtons"){if(u._isMembersFiltered||u.model.enableMemberEditorPaging)args_innerHTML==u._getLocalizedLabels("Measures")?a="Measures:"+u._getMeasuresList():args_innerHTML!="ToolbarButtons"&&args_innerHTML!=i&&(t.Pivot.updateTreeView(u),a=u._getUnSelectedNodes()+"CHECKED"+u._getSelectedNodes(u._currentAxis=="Slicers"?!0:!1));else{u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();t.Pivot.closePreventPanel(u);return}u._isTimeOut=!0;setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800);args_innerHTML==u._getLocalizedLabels("Measures")&&a!=null&&a.split(":")[1]==""&&n(u.element).find(".splitBtn").each(function(t,i){i.firstChild.innerHTML==u._getLocalizedLabels("Measures")&&n(i).remove()});n(u).find(".e-dialog").hide();u.model.enableMemberEditorPaging&&args_innerHTML!=u._getLocalizedLabels("Measures")&&(a=t.Pivot._getUnSelectedTreeState(u)+"CHECKED"+t.Pivot._getSelectedTreeState(u._currentAxis=="Slicers"?!0:!1,u));u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"filtering",element:this.element,customObject:u.model.customObject});k=t.Pivot._getEditorMember(u._dialogTitle,u,!1);u._fieldSelectedMembers[u._dimensionName.split(":")[1]]=n.map(u._fieldMembers[u._dialogTitle],function(n){if(!n.checked)return n}).length==0?"All":k!="All"&&k!="multiple"?k:u._getLocalizedLabels("MultipleItems");u._setSplitBtnTitle();s=JSON.stringify(u.model.customObject);u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.filterElement,JSON.stringify({action:"filtering",clientParams:a,olapReport:u.currentReport,clientReports:u.reports,customObject:s}),u._filterElementSuccess)}else if(u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("RemoveReport")&&reportsCount<2)u.element.find(".e-dialog").hide();else{if(n.trim(u.element.find(".reportName").val())===""&&u.element.find(".reportName").val()!=i)return u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("NewReport")||u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("AddReport")||u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().text()==u._getLocalizedLabels("RenameReport")?t.Pivot._createErrorDialog(u._getLocalizedLabels("SetReportNameAlertMsg"),"Error",u):t.Pivot._createErrorDialog(u._getLocalizedLabels("SetReportNameAlertMsg"),"Error",u),!1;var ot=u.element.find("#reportList").data("ejDropDownList"),e=n.trim(u.element.find(".reportName").val())||ot.selectedTextValue,h=u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").first().attr("tag"),w=h=="New Report"?"":u.currentReport,ut=h=="New Report"?"":u.reports;if(u._currentRecordName=h=="New Report"?"":u._currentRecordName,u.element.find(".e-dialog").hide(),u._isTimeOut=!0,setTimeout(function(){u._isTimeOut&&u._waitingPopup.show()},800),u.model.operationalMode==t.Pivot.OperationalMode.ClientMode)d={data:u.model.dataSource.data,reportName:e,enableAdvancedFilter:u.model.dataSource.enableAdvancedFilter,columns:[],cube:u.model.dataSource.cube,catalog:u.model.dataSource.catalog,reportName:e,rows:[],values:[],filters:[]},f=u.element.find(".reportlist").data("ejDropDownList"),u.element.find(".reportlist").ejDropDownList("option","change",t.proxy(u._reportChanged,u)),h=="New Report"?(u.model.dataSource=d,u._clientReportCollection=[d],u.element.find(".reportlist").ejDropDownList("option","dataSource",[{name:e}]),f.selectItemByText(e),u._fieldMembers={},u._fieldSelectedMembers={}):h=="Add Report"?(u.model.dataSource=d,u.model.dataSource.reportName=e,ft=n.map(u._clientReportCollection,function(n){if(n.reportName==u.model.dataSource.reportName)return n}),u._clientReportCollection=n.map(u._clientReportCollection,function(n){if(n.reportName!=u.model.dataSource.reportName)return n}),u._clientReportCollection.push(u.model.dataSource),u._fieldMembers={},u._fieldSelectedMembers={},ft.length==0?(f=u.element.find(".reportlist").data("ejDropDownList"),f.model.dataSource.push({name:e}),l=JSON.stringify(f.model.dataSource),u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l)),f.selectItemByText(e)):u._clientReportCollection.length>0&&u._reportChanged()):h=="Rename Report"?(u._clientReportCollection=n.map(u._clientReportCollection,function(n){return n.reportName==u.model.dataSource.reportName&&(n.reportName=e),n}),l=JSON.stringify(n.map(f.model.dataSource,function(n){return n.name!=f.getValue()?n:{name:e}})),u.model.dataSource.reportName=e,u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l)),f.selectItemByText(e),u._currentItem=""):h=="Remove Report"?(u._clientReportCollection=n.map(u._clientReportCollection,function(n){if(n.reportName!=e)return n}),et=n(f.getSelectedItem()).index()>=u._clientReportCollection.length?u._clientReportCollection.length-1:n(f.getSelectedItem()).index(),u.model.dataSource=u._clientReportCollection[et],l=JSON.stringify(n.map(f.model.dataSource,function(n){if(n.name!=f.getValue())return n})),u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l)),u._fieldMembers={},u._fieldSelectedMembers={},f.model.dataSource.length>0&&f.selectItemByText(u.model.dataSource.reportName)):h=="SaveAs Report"?(u._currentRecordName=e,g={url:"",reportName:e,reportCollection:u._clientReportCollection,mode:u.model.analysisMode,filterCollection:u._currentReportItems},u._trigger("saveReport",{targetControl:u,saveReportSetting:g}),u.model.enableLocalStorage||(s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",g.url+"/"+u.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:g.reportName,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:JSON.stringify(u.model.dataSource),clientReports:JSON.stringify(u._clientReportCollection)+":>>:"+JSON.stringify(u._currentReportItems),customObject:s}),u._toolbarOperationSuccess))):h!="Rename Report"&&(u.refreshControl(),u._pivotSchemaDesigner&&u._pivotSchemaDesigner._refreshPivotButtons()),u._isTimeOut=!1,u._waitingPopup.hide();else if(f=u.element.find(".reportlist").data("ejDropDownList"),u._clientReportCollection=n.map(u._clientReportCollection,function(n){return n.name==f.getValue()&&(n.report=w),n}),h=="SaveAs Report")u._currentRecordName=e,u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"saveReport",element:this.element,customObject:u.model.customObject}),s=JSON.stringify(u.model.customObject),u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.saveReport,JSON.stringify({reportName:e,operationalMode:u.model.operationalMode,analysisMode:u.model.analysisMode,olapReport:w,clientReports:u.model.analysisMode=="pivot"?JSON.stringify(u._clientReportCollection):ut,customObject:s}),u._toolbarOperationSuccess);else if(u.model.beforeServiceInvoke!=null&&u._trigger("beforeServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:u.model.customObject}),s=JSON.stringify(u.model.customObject),u.model.analysisMode==t.Pivot.AnalysisMode.Olap)u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:h,clientInfo:e,olapReport:w,clientReports:ut,customObject:s}),u._toolbarOperationSuccess);else{if(h==u._getLocalizedLabels("NewReport"))u._currentReportName=e,u._fieldMembers={},u._fieldSelectedMembers={};else if(h==u._getLocalizedLabels("AddReport"))u._fieldMembers={},u._fieldSelectedMembers={},f.model.dataSource.push({name:e}),f.selectItemByText(e),u._currentReportName=e;else if(h==u._getLocalizedLabels("RemoveReport")){for(c=0;c<u._clientReportCollection.length;c++)u._clientReportCollection[c].name==u._currentReportName&&u._clientReportCollection.splice(c,1);for(f=u.element.find(".reportlist").data("ejDropDownList"),c=0;c<f.model.dataSource.length;c++)f.model.dataSource[c].name==u._currentReportName&&f.model.dataSource.splice(c,1);f.selectItemByText(f.model.dataSource[0].name);w=u._clientReportCollection[0].report;e=u._clientReportCollection[0].name;u._currentReport="";u._currentReportName=e;u._fieldMembers={};u._fieldSelectedMembers={}}else if(h==u._getLocalizedLabels("RenameReport")){nt="";try{nt=JSON.parse(u.getOlapReport()).Report}catch(st){nt=u.getOlapReport()}u._clientReportCollection=n.map(u._clientReportCollection,function(n){return n.name==u._currentReportName&&(n.name=e),n});f=u.element.find(".reportlist").data("ejDropDownList");l=JSON.stringify(n.map(f.model.dataSource,function(n){return n.name!=f.getValue()?n:{name:e,report:nt}}));u.element.find(".reportlist").ejDropDownList("option","dataSource",JSON.parse(l));u._isReportListAction=!1;f.selectItemByText(e);u._isReportListAction=!0;u._currentReportName=e;u._isTimeOut=!1;u._waitingPopup.hide();t.Pivot.closePreventPanel(u);return}u.doAjaxPost("POST",u.model.url+"/"+u.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:h,args:JSON.stringify({clientInfo:e,currentReport:w}),customObject:s}),u._toolbarOperationSuccess)}}}u._isTimeOut&&(u._isTimeOut=!1);u.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();u.element.find("#preventDiv").remove()});this.element.find(".searchEditorTree").click(function(i){var r=n(this).parents(".e-pivotclient").data("ejPivotClient");t.Pivot._searchEditorTreeNodes(i,r)});this.element.find(".calcMemberImg").click(function(){var i=n(this).parents(".e-pivotclient").data("ejPivotClient"),r;i.element.find(".calcMemberDialog").length>0?(i._calcMemberTreeObj.collapseAll(),t.Pivot.openPreventPanel(i),i._calcMemberDialog.open(),i.element.find("#"+i._id+"_captionFieldCM").val(""),i.element.find("#"+i._id+"_expressionFieldCM").val(""),i.element.find("#"+i._id+"_memberTypeFieldCM").data("ejDropDownList").selectItemsByIndices(0),i.element.find("#"+i._id+"_dimensionFieldCM").data("ejDropDownList").selectItemsByIndices(0),i.element.find("#"+i._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(0),i.element.find("#"+i._id+"_customFormatFieldCM").val("")):(i._waitingPopup.show(),i.model.beforeServiceInvoke!=null&&i._trigger("beforeServiceInvoke",{action:"fetchCalcMemberTreeView",element:i.element,customObject:i.model.customObject}),r=JSON.stringify(i.model.customObject),i.doAjaxPost("POST",i.model.url+"/"+i.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchCalcMemberTreeView",dimensionName:"calcMember",olapReport:i.currentReport,customObject:r}),t.proxy(t.Pivot._createCalcMemberDialog,i)))});this.element.find(".unCheckAll,.checkAll").click(function(t){var i=n(this).parents(".e-pivotclient").data("ejPivotClient");t.target.className.indexOf("checkAll")>-1?(i.element.find(".editorTreeView").ejTreeView("checkAll"),i._isMembersFiltered=!0,i.element.find(".dialogOKBtn").data("ejButton").enable(),i.element.find(".dialogOKBtn").removeAttr("disabled"),i.model.enableMemberEditorPaging&&setTimeout(function(){i._waitingPopup.show();for(var n=0;n<i._editorTreeData.length;n++)i._editorTreeData[n].checkedStatus=!0;i._waitingPopup.hide()},0)):(i.element.find(".editorTreeView").ejTreeView("unCheckAll"),i.element.find(".dialogOKBtn").data("ejButton").disable(),i.element.find(".dialogOKBtn").attr("disabled","disabled"),i.model.enableMemberEditorPaging&&setTimeout(function(){i._waitingPopup.show();for(var n=0;n<i._editorTreeData.length;n++)i._editorTreeData[n].checkedStatus=!1;i._waitingPopup.hide()},0))})},_getLocalizedLabels:function(n){return t.PivotClient.Locale[this.locale()][n]===i?t.PivotClient.Locale["en-US"][n]:t.PivotClient.Locale[this.locale()][n]},_unWireEvents:function(){n(this.element.find(".dialogCancelBtn, .dialogOKBtn, .newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .pvtBtn, .removeSplitBtn, .unCheckAll, .checkAll, .removeMeasure, .toggleCollapseButton, .toggleExpandButton, .reportDBImg, .saveAsReportImg, .saveReportImg, .loadReportImg, .removeDBReportImg, .renameDBReportImg, .mdxImg,.maximizedView,.colSortFilterImg, .rowSortFilterImg, .chartTypesImg, .toggleaxisImg, .autoExecuteImg, .nextPage, .prevPage, .firstPage, .lastPage, .searchEditorTree, .calcMemberImg")).off(t.eventType.click);n(this.element.find(".dialogCancelBtn, .dialogOKBtn, .newReportImg, .addReportImg, .removeReportImg, .renameReportImg, .pvtBtn, .removeSplitBtn, .unCheckAll, .checkAll, .removeMeasure, .toggleCollapseButton, .toggleExpandButton, .reportDBImg, .saveAsReportImg, .saveReportImg, .loadReportImg, .removeDBReportImg, .renameDBReportImg, .mdxImg,.maximizedView,.colSortFilterImg, .rowSortFilterImg, .chartTypesImg, .toggleaxisImg,.autoExecuteImg, .nextPage, .prevPage, .firstPage, .lastPage, .searchEditorTree,.calcMemberImg")).off("click");n(document).find(".winCloseBtn").off(t.eventType.click);n(this._off(this.element,"mouseup",".parentsplit"));this._off(this.element,"click","#preventDiv");n(document).find(".winCloseBtn").off("click");this._off(n(document),"keydown",this._keyPressDown);this._off(n(document),"keyup",this._keyPressUp);this.model.isResponsive&&n(window).off("resize",n.proxy(this._reSizeHandler,this))},_calculateHeight:function(){var i,r;n(this.element).height(n(this.element).height()<450?450:n(this.element).height());this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(i=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5),this.element.find(".oClientTbl").css("height",i+"px"),this.element.find(".outerTable").css("height",i+"px"),this.model.enableVirtualScrolling?(this.element.find(".controlPanel").css("height",i-25+"px"),this._pivotGrid._applyVScrolling()):this.model.enablePaging?this.model.displaySettings.controlPlacement==t.PivotClient.ControlPlacement.Tab?this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()):this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()-5):this.element.find(".controlPanel").css("height",i+"px"),this.element.find(".cubeTable").css("height",this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38)+"px"),cdbHeight=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38),this.element.find(".cubeBrowser").css("height",cdbHeight+7-this.element.find(".cdbHeader").height()),this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-this.element.find(".cubeName").height()-(7+(this.model.enableMeasureGroups?this.element.find(".measureGroupselector").height()+13:0))),aebHeight=cdbHeight-(this.element.find(".axisHeader").height()*3+4),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").css("height",aebHeight/3+"px"),this.model.enableSplitter&&this.element.find(".splitresponsive").height(this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+30))):(i=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5),this.element.find(".outerTable, .controlPanelTD").css("height",i+"px"),this.model.enableVirtualScrolling?(this.element.find(".controlPanel").height(i-15),this.model.displaySettings.mode!=t.PivotClient.DisplayMode.ChartOnly&&this._pivotGrid._applyVScrolling()):this.model.enablePaging?this.model.displaySettings.controlPlacement==t.PivotClient.ControlPlacement.Tab?this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()):this.element.find(".controlPanel").height(i-this.element.find("#"+this._id+"_Pager").height()-5):this.element.find(".controlPanel").height(i),this.element.find("#"+this._id+"_PivotSchemaDesigner").height(i),this._pivotSchemaDesigner._reSizeHandler(),this.enableTogglePanel()&&this.element.find(".pivotFieldList").length>0&&(this.element.find("div.togglePanel").remove(),this.element.find(".controlPanel").width(this.element.width()-(this.element.width()/3+20)),n(t.buildTag("div.togglePanel",t.buildTag("div.toggleExpandButton e-icon","",{}).attr("aria-describedby","toggleexpand")[0].outerHTML+t.buildTag("div.toggleCollapseButton e-icon",{},{display:"none"}).attr("aria-describedby","togglecollapse")[0].outerHTML)[0].outerHTML).appendTo(this.element.find(".pivotFieldList").parent()),this.element.find(".togglePanel").height(this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5)+"px").width(14),this.element.find(".toggleExpandButton,.toggleCollapseButton").css("margin-top",(this.element.find("#"+this._id+"_PivotSchemaDesigner").parents("td:eq(0)").height()-9)/2),this.element.find(".togglePanel").children().addClass("toggleButtons"),this._unWireEvents(),this._wireEvents()));this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?(this.model.enableVirtualScrolling&&this.element.find(".controlPanel").height(this.element.find(".controlPanel").height()-5),this.defaultView()==t.PivotClient.DefaultView.Grid?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10)):this.displayMode()==t.PivotClient.DisplayMode.GridOnly?this.model.enablePaging?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-10):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-20):this.model.enableVirtualScrolling?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+30)):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+15)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-10):this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-15):this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()-17):(r=this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+20),this.model.enableVirtualScrolling?this.element.find(".chartContainer").height(r-5):this.element.find(".chartContainer").height(r-2)));this._chartHeight=this.model.enableToolBar?this.element.find(".chartContainer").height()-68+"px":this.element.find(".chartContainer").height()-3+"px";this._gridHeight=this.model.enableToolBar?this.element.find(".gridContainer").height()-46+"px":this.element.find(".gridContainer").height()-10+"px";this.model.enableToolBar&&(this.element.find("#"+this._id+"_PivotGridToolbar").height(this._gridHeight),this.element.find("#"+this._id+"_PivotCharttoolBar").height(this._chartHeight))},_performToggleAction:function(n){this.element.find(".controlPanel").width(n[0].controlPanelWidth);(this.controlPlacement()!="horizontal"||this.controlPlacement()=="horizontal"&&this.displayMode()=="chartOnly"||this.controlPlacement()=="horizontal"&&this.displayMode()=="gridOnly")&&(this.element.find(".e-pivotchart").width(n[0].chartOuterWidth),this.element.find(".e-pivotgrid").width(n[0].gridOuterWidth),this.element.find("#"+this._id+"_PivotChart").css({width:"100%"}),this.element.find("#"+this._id+"_PivotGrid").css({width:"98%"}),t.isNullOrUndefined(this._pivotChart)&&t.isNullOrUndefined(this.otreemapObj)||(this.element.find("#"+this._pivotChart._id).ejPivotChart("option","width",n[0].chartOuterWidth+"px"),this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)||(this.element.find("#"+this.chartObj._id).ejChart("option",{model:{size:{width:n[0].chartOuterWidth+"px"}}}),this.element.find("#"+this.chartObj._id+"_svg").width(n[0].chartOuterWidth),this.chartObj.redraw())),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.PivotGrid.OperationalMode.ClientMode&&this._toggleExpand&&!t.isNullOrUndefined(this.chartObj)&&(this.element.find("#"+this._id+"_PivotChartContainer").css("width",this.chartObj.model.size.width),this.chartObj.redraw()),this.model.enableToolBar&&(this.element.find("#"+this._id+"_PivotCharttoolBar").width(this.element.find(".chartContainer").width()),this.element.find("#"+this._id+"_PivotGridToolbar").width(this.element.find(".gridContainer").width()-10),this.element.find(".chartToolBar").width(this.element.find(".chartContainer").width()),this.element.find(".toolBar").width(this.element.find(".gridContainer").width())))},_rwdToggleExpand:function(){this.element.find(".csHeader, .cubeTable,.e-pivotschemadesigner,.toggleExpandButton").show();this.element.find(".toggleCollapseButton").hide();this.element.find(".toggleText").hide();this._calculateHeight();this._parentElwidth<850&&(this.element.find(".outerTable").css({position:"absolute",float:this.model.enableRTL?"right":"left",tableLayout:"auto","z-index":"10000"}),this.element.find(".pivotFieldList").width("91%"),this.element.find("table.cubeTable").css({width:"71%"}),this.element.find(".csHeader").css({width:"100%"}),this.element.find("#cubeSelector_wrapper").css({width:"100%"}),this.element.find(".controlPanelTD").css({width:this.element.find(".oClientTbl").width()-this.element.find("table.cubeTable").width(),float:this.model.enableRTL?"left":"right",left:this.model.enableRTL?"0px":"15px",right:this.model.enableRTL?"15px":"0px",position:"relative"}),this.element.find(".controlPanel").css({width:this.element.find(".controlPanelTD").width()-20}));this._parentElwidth>850&&(this.element.find(".controlPanelTD").css({width:"56%",left:"inherit",float:"left","margin-left":"5px"}),this.element.find("table.cubeTable").css({width:"98%"}),this.element.find(".outerTable,.controlPanelTD").css({position:"inherit"}),this._currentTab=="grid"?n(".controlPanel").width(n("#"+this._id).width()*55/100+"px"):this._currentTab=="chart"?n(".controlPanel").width(n("#"+this._id).width()*55/100+"px"):n(".controlPanel").width("100%"),window.navigator.userAgent.indexOf("Trident")>0?(this.element.find(".outerTable").width(n("#"+this._id).width()*43/100),this.element.find(".csHeader").width(n("#"+this._id).width()*41/100+"px"),this.element.find("#cubeSelector_wrapper").width(n("#"+this._id).width()*29/100-60+"px"),this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").width(n("#"+this._id).width()*56/100+"px")):(this.element.find(".outerTable").css({width:n("#"+this._id).width()*42/100+"px",tableLayout:"auto"}),this.element.find(".csHeader").css({width:n("#"+this._id).width()*42/100+"px"}),this.element.find("#cubeSelector_wrapper").css({width:n("#"+this._id).width()*32/100-60+"px"}),this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").css({width:n("#"+this._id).width()*57/100+"px"})));this.displayMode()!="gridonly"&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"?(this.element.find(".gridPanel").width(n(".controlPanel").width()-7),this.model.enableToolBar?n("#"+this._pivotChart._id).width(n(".controlPanel").width()-30):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-7)):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-12),this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()));this._overflow()},_overflow:function(){this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.element.find(".ellipse").remove(),this.element.find(".cdbHeader")[0].scrollHeight>this.element.find(".cdbHeader")[0].offsetHeight?(this.element.find(".cdbHeader").attr("title",this.element.find(".cdbHeader").text()),this.element.find(".cdbHeader").after("<span class='ellipse' style='margin-top:-"+this.element.find(".cdbHeader").height()*78/100+"px'>....<\/span>")):this.element.find(".cdbHeader").removeAttr("title"))},_rwdToggleCollapse:function(){this._parentElwidth<850&&(this.element.find(".outerTable").css({position:"absolute"}),this.element.find(".controlPanelTD").css({left:this.model.enableRTL?"0px":"35px",right:this.model.enableRTL?"35px":"0px",position:"relative"}));this._currentTab=="grid"?n(".controlPanel").css({width:n("#"+this._id).width()*94/100+"px"}):n(".controlPanel").css({width:"100%"});this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").css({width:n("#"+this._id).width()*94/100+"px"});this.element.find(".csHeader, .cubeTable, .e-pivotschemadesigner,.toggleExpandButton").hide();this.element.find(".controlPanelTD").css({left:this.model.enableRTL?"0":"4%",right:this.model.enableRTL?"4%":"0px",position:"relative",width:"95%",tableLayout:"fixed",float:""});n("#"+this._id).width("98%");this.element.find(".outerTable").css({position:"absolute",width:"0px",tableLayout:"fixed"});this.element.find(".toggleCollapseButton").show();this.element.find(".toggleText").show();this.displayMode()!="gridonly"&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"?this.model.enableToolBar?n("#"+this._pivotChart._id).width(n(".controlPanel").width()-45):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-17):n("#"+this._pivotChart._id).width(n(".controlPanel").width()-15),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()))},_removeFilterTag:function(i){var u,r;if(i.indexOf("].")>=0){if(u=i.split("].").length>2?"levelUniqueName":"hierarchyUniqueName",this._excelFilterInfo.length>0){var f=this.element.find(".cubeSelector").data("ejDropDownList").model.value,r=this.element.find("#reportList").data("ejDropDownList").model.value,e=this._selectedLevelUniqueName,o=this._selectedFieldName;this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n.cubeName==f&&n.report==r&&!(n[u]==i))return n})}}else i&&this._excelFilterInfo.length>0&&this.model.analysisMode==t.Pivot.AnalysisMode.Pivot&&(r=this.element.find("#reportList").data("ejDropDownList").model.value,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){if(n.report==r&&!(n.levelUniqueName==i))return n}))},_groupLabelChange:function(i){var r,u;if(this._selectedLevelUniqueName=i.selectedValue,r=[],this._excelFilterInfo.length>0){var f=this.element.find(".cubeSelector").data("ejDropDownList").model.value,e=this.element.find("#reportList").data("ejDropDownList").model.value,o=this._selectedLevelUniqueName,s=this._selectedFieldName;r=n.map(this._excelFilterInfo,function(n){if(n.cubeName==f&&n.report==e&&n.hierarchyUniqueName==s&&n.levelUniqueName==o)return{action:n.action,operator:n.operator,value1:n.value1}})}this.element.find(".filterElementTag .activeFilter,.filterIndicator").remove();this.element.find("#labelClearFilter").css("opacity","0.5").attr("disable",!0);this.element.find("#valueClearFilter").css("opacity","0.5").attr("disable",!0);r.length>0&&!t.isNullOrUndefined(r[0].operator)?(u=r[0].action=="valuefiltering"?"valueFilterBtn":"labelFilterBtn",this.element.find(".clientDialog").prepend("<div class='filterIndicator e-icon' style='top:"+(u=="labelFilterBtn"?"59px":"89px")+"' />"),this.element.find("#"+u+" #labelClearFilter").removeAttr("style disable"),this.element.find("#"+u+" #valueClearFilter").removeAttr("style disable"),r[0].operator.replace(/ /g,"")=="BottomCount"?this.element.find("#"+u+" li#"+r[0].operator.replace(/ /g,"").replace("Bottom","top")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML)):this.element.find("#"+u+" li#"+r[0].operator.replace(/ /g,"")+" a").append(n(t.buildTag("span.activeFilter e-icon")[0].outerHTML))):this._getUnSelectedNodes()!=""&&this.element.find(".clientDialog").prepend("<div class='filterIndicator e-icon' />")},_filterElementClick:function(i){var u,r;if(n(i.element).hasClass("clearFilter")&&n(i.element).css("opacity")=="0.5"||n(i.element).parent(".filterElementTag").length>0)return i.Cancel;this._selectedLevelUniqueName=this.element.find(".groupLabelDrop").data("ejDropDownList").model.value||this.element.find(".groupLabelDrop").data("ejDropDownList").model.dataSource[0].value;var f=this.element.find(".cubeSelector").length>0?this.element.find(".cubeSelector").data("ejDropDownList").model.value:"",e=this.element.find("#reportList").data("ejDropDownList").model.value,o=this._selectedLevelUniqueName,s=this._selectedFieldName;n(i.element).attr("id")=="labelClearFilter"||n(i.element).attr("id")=="valueClearFilter"?(this._removeFilterTag(this._selectedLevelUniqueName),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filterElement,JSON.stringify({action:"labelfiltering",clientParams:this._selectedLevelUniqueName+"--Clear Filter",olapReport:this.currentReport,clientReports:this.reports,customObject:JSON.stringify(this.model.customObject)}),this._filterElementSuccess)):(u=n(i.element).parents("li:eq(0)#valueFilterBtn").length>0?"valueFilterDlg":"labelFilterDlg",r=[],this._excelFilterInfo.length>0&&n(i.element).siblings("li:eq(0)").attr("disable")!="true"&&(r=n.map(this._excelFilterInfo,function(n){if(n.cubeName==f&&n.report==e&&n.hierarchyUniqueName==s&&n.levelUniqueName==o)return{value1:n.value1,value2:n.value2,operator:n.operator,measure:n.measure}}),!n(i.element).hasClass(r[0].operator.replace(/ /g,""))&&r.length>0&&(r=[])),this._schemaData&&(this._schemaData._selectedLevelUniqueName=this._selectedLevelUniqueName,this._schemaData.selectedFieldName=this._selectedFieldName),t.Pivot.createAdvanceFilterTag({action:u,selectedArgs:i,filterInfo:r},this))},_filterOptionChanged:function(n){var i=this.element.find("#filterDialog_wrapper .e-titlebar").text().indexOf("Value")>=0?"valueFilterDlg":"labelFilterDlg";i=="valueFilterDlg"&&t.Pivot.createAdvanceFilterTag({action:i,selectedArgs:n,filterInfo:[]},this)},_filterElementOkBtnClick:function(){pivotClientObj=this;t.isNullOrUndefined(this._waitingPopup)||(pivotClientObj._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800));var u=this.element.find("#filterOptions").data("ejDropDownList").model.value||this.element.find("#filterOptions")[0].value,f=this.element.find("#filterValue1")[0].value,e=this.element.find("#filterValue2").length>0?this.element.find("#filterValue2")[0].value:"",i,n,r="labelfiltering";n=this._selectedLevelUniqueName+"--"+u+"--"+f;this.element.find(".filterMeasures").length>0&&(this.element.find("#filterValue2").length>0&&(n=n+","+e),i=this.element.find(".filterMeasures").data("ejDropDownList").model.value,n=n+"--"+i,r="valuefiltering");this._removeFilterTag(this._selectedLevelUniqueName);this._excelFilterInfo.push({cubeName:this.element.find(".cubeSelector").length>0?this.element.find(".cubeSelector").data("ejDropDownList").model.value:"",report:this.element.find("#reportList").data("ejDropDownList").model.value,action:r,hierarchyUniqueName:this._selectedFieldName,levelUniqueName:this._selectedLevelUniqueName,operator:u,measure:i,value1:f,value2:e});this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.filterElement,JSON.stringify({action:r,clientParams:n,olapReport:this.currentReport,clientReports:this.reports,customObject:JSON.stringify(this.model.customObject)}),this._filterElementSuccess)},_splitButtonDropped:function(i,r){var u,f,e,o;if(isDropped=!0,clientObj=this,u=i=="Series"?"row":i.toLowerCase(),n.trim(r)==""&&this.element.find("."+u+"Axis").find("button:last").attr("title")==this.element.find("button.dragClone").attr("title")||n.trim(r)!=""&&this.element.find(n("."+u+"Axis").find(".splitBtn")[r]).attr("tag").split(":")[1].replace("."," - ")==this.element.find("button.dragClone").attr("title"))return this.element.find("button.dragClone").remove(),!1;if(u=="slicer"&&draggedSplitBtn!=null&&n(draggedSplitBtn).parent("div:eq(0)").attr("Tag").indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1)return this.element.find("button.dragClone").remove(),t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;(n.trim(r)==""||draggedSplitBtn!=null&&this.element.find(n("."+u+"Axis").find(".splitBtn")[r]).attr("tag").split(":")[1].replace("."," - ")!=this.element.find("button.dragClone").attr("title"))&&(f=this.element.find(".cubeName").html()+"--"+n(draggedSplitBtn).parent("div:eq(0)").attr("Tag")+"--"+i+"--"+r,this.model.enableAdvancedFilter&&i=="Slicer"&&(e=n(draggedSplitBtn).parent("div:eq(0)").attr("Tag").split(":")[1].split("."),this._setUniqueNameFrmBtnTag(e),this._removeFilterTag(this._selectedFieldName)),this.element.find("button.dragClone").remove(),draggedSplitBtn=null,this._isTimeOut=!0,setTimeout(function(){clientObj._isTimeOut&&clientObj._waitingPopup.show()},800),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),o=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:f,olapReport:this.currentReport,clientReports:this.reports,customObject:o}),this._nodeDroppedSuccess));this._isNodeOrButtonDropped=!0},_filterElementSuccess:function(n){this._isSearchApplied=!1;t.Pivot.closePreventPanel(this);n[0]!=i?(this.currentReport=n[0].Value,this.reports=n[1].Value,n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value)):n.d!=i?(this.currentReport=n.d[0].Value,this.reports=n.d[1].Value,n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value)):(this.currentReport=n.UpdatedReport,this.reports=n.ClientReports,n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject));this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"filtering",element:this.element,customObject:this.model.customObject});this._renderControls();this._unWireEvents();this._wireEvents();this._successAction="Filter";this._trigger("renderSuccess",this)},_maxViewBtnClick:function(){var r=n(window).width()-150,u=n(window).height()-100,f=t.buildTag("div.fullScreenView","",{width:n(document).width(),height:n(document).height()}),i=t.buildTag("div#"+this._id+"_maxView.maximumView","",{width:r,height:u}),o=t.buildTag("div#Winclose.winCloseBtn e-icon","").attr("role","button").attr("aria-label","close").attr("clientID",this._id),e;this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this.displayMode()==t.PivotClient.DisplayMode.ChartOnly&&(n("#"+this._pivotChart._id+"Container_svg")[0]||n("#"+this.otreemapObj._id+"TreeMapContainer").children().length>0)&&(this._fullScreenView(100,160),t.isNullOrUndefined(this.chartObj)||this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&(n("#"+this.otreemapObj._id).css({width:"99%"}),n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"})),i.append(this.element.find("#"+this._id+"_PivotChart")));this.displayMode()==t.PivotClient.DisplayMode.GridOnly&&i.append(this.element.find("#"+this._id+"_PivotGrid").css({"max-height":u,width:r,overflow:"auto"}));this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.displayMode()=="chartandgrid"?this._currentTab=="grid"?i.append(this.element.find("#"+this._id+"_PivotGrid").css({"max-height":u,width:r})):this._currentTab=="chart"&&(n("#"+this._pivotChart._id+"Container_svg")[0]||n("#"+this.otreemapObj._id+"TreeMapContainer").children().length>0)&&(this._fullScreenView(100,160),t.isNullOrUndefined(this.chartObj)||this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&(n("#"+this.otreemapObj._id).css({width:"99%"}),n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"})),i.append(this.element.find("#"+this._id+"_PivotChart"))):this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&(e=n(window).height()/2-50,this.element.find("#"+this._id+"_PivotGrid").css({"max-height":e,"margin-left":"0px",overflow:"auto"}),t.isNullOrUndefined(this.chartObj)||this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&(n("#"+this.otreemapObj._id).css({width:"99%"}),n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"})),this._fullScreenView(50,160),(n("#"+this._pivotChart._id+"Container_svg")[0]||n("#"+this.otreemapObj._id+"TreeMapContainer").children().length>0)&&(this.defaultView()=="chart"?i.append(this.element.find("#"+this._id+"_PivotChart")).append(this.element.find("#"+this._id+"_PivotGrid").width(n(window).width()-160)):i.append(this.element.find("#"+this._id+"_PivotGrid").width(n(window).width()-160)).append(this.element.find("#"+this._id+"_PivotChart"))),i.append(this.element.find("#"+this._id+"_PivotGrid").width(n(window).width()-160)));i.append(o);f.append(i);n("body").append(f);this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(t.isNullOrUndefined(this.chartObj)||(this.model.enablePivotTreeMap&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()))},_maxViewClsBtnClick:function(){var i=n(".fullScreenView");i.find("#"+this._id+"_PivotGrid").css("margin-left","7px");i.find("#"+this._id+"_PivotChart").appendTo(this.element.find(".chartContainer"));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this.displayMode()==t.PivotClient.DisplayMode.ChartOnly&&n("#"+this._pivotChart._id+"Container_svg")[0]&&this._fullScreenViewCls(560,557);this.displayMode()==t.PivotClient.DisplayMode.GridOnly&&i.find("#"+this._id+"_PivotGrid").css({width:"inherit","max-height":"",overflow:"hidden"});this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.displayMode()=="chartandgrid"&&(this._currentTab=="chart"&&n("#"+this._pivotChart._id+"Container_svg")[0]?this._fullScreenViewCls(533,553):i.find("#"+this._id+"_PivotGrid").css({"max-height":"550px",width:"555px"}));this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&(n("#"+this._pivotChart._id+"Container_svg")[0]?(this._fullScreenViewCls(275,555),i.find("#"+this._id+"_PivotGrid").css({"max-height":"300px",width:"555px",overflow:"hidden"})):i.find("#"+this._id+"_PivotGrid").css({"max-height":"275px",width:"555px"}));this.enableTogglePanel()&&this.element.find(".cubeTable").is(":visible")==!1&&i.find("#"+this._id+"_PivotGrid").css("width","950px");i.find("#"+this._id+"_PivotGrid").appendTo(this.element.find(".gridContainer"));n(".maximumView").remove();n(".fullScreenView").remove();this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(t.isNullOrUndefined(this.chartObj)||(this.model.enablePivotTreeMap&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()))},_enableResponsive:function(){this.element.find(".outerPanel").css({width:"100%"});n(".e-pivotclient").css({width:"100%"});this.element.find(".outerTable").css({float:this.model.enableRTL?"right":"left"});this.element.find(".cdbHeader, .cubeBrowser").addClass("responsive");this.element.find(".rowAxis, .slicerAxis, .categoricalAxis").width("99%");this.element.find(".controlPanelTD").width("56%");this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".controlPanelTD").css("display","inline-block");this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?this.element.find(".cubeTable,.e-pivotschemadesigner").width("100%"):this.element.find(".cubeTable").width("98%");window.navigator.userAgent.indexOf("Trident")>0?(this._currentTab=="grid"?n(".controlPanel").css({width:n("#"+this._id).width()*55/100+"px"}):n(".controlPanel").css({width:"99%"}),this.element.find(".outerTable").width(n("#"+this._id).width()*39/100),this.element.find(".csHeader").width(n("#"+this._id).width()*38/100),this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"&&this.element.find(".gridPanel").width(n("#"+this._id).width()*55/100)):(this.element.find(".outerTable").width(n("#"+this._id).width()*38/100),this.element.find(".csHeader").width(n("#"+this._id).width()*38/100))},_fullScreenView:function(r,u){var f,e;this._pivotChart!=null&&this._pivotChart!=i&&n("#"+this._pivotChart._id+"Container_svg")[0]&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),f=this.chartObj.model.size.width=this._pivotChart.model.size.width=n(window).width()-u+"px",e=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()=="chartandgrid"?this._pivotChart.model.size.height=this.chartObj.model.size.height=n(window).height()/2-r+"px":this._pivotChart.model.size.height=this.chartObj.model.size.height=n(window).height()-r+"px",this.element.find("#"+this._id+"_PivotChart").css({"min-height":e,width:f}),this.element.find("#"+this._id+"_PivotChartContainer").css({width:f,height:e}),this.chartObj.redraw())},_fullScreenViewCls:function(n,t){var u,r;this._pivotChart!=null&&this._pivotChart!=i&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),u=this.chartObj.model.size.height=this._pivotChart.model.size.height=n+"px",r=this.enableTogglePanel()&&this.element.find(".cubeTable").is(":visible")==!1?this.chartObj.model.size.width=this._pivotChart.model.size.width="950px":this.chartObj.model.size.width=this._pivotChart.model.size.width=t+"px",this.element.find("#"+this._id+"_PivotChart").css({"min-height":u,width:r}),this.element.find("#"+this._pivotChart._id+"Container").width(r),this.chartObj.redraw())},_calcMemberDroppedSuccess:function(n){var t;if(n[0]!=i){for(t=0;t<n.length;t++)if(n[t].Key=="calcMemberTreeData"){this._calcMembers=JSON.parse(n[t].Value);n.splice(t,1);break}}else if(n.d!=i){for(t=0;t<n.d.length;t++)if(n.d[t].Key=="calcMemberTreeData"){this._calcMembers=JSON.parse(n.d[t].Value);n.d.splice(t,1);break}}else this._calcMembers=JSON.parse(n.calcMemberTreeData),delete n.calcMemberTreeData;this._calcMemberTreeViewUpdate();this._nodeDroppedSuccess(n)},_nodeDroppedSuccess:function(r){var e,o,s,c,h,u,f;if(r[0]!=i?(e=r[0].Value,o=r[1].Value,s=r[2].Value,this.currentReport=r[3].Value,this.reports=r[4].Value,r[5]!=null&&r[5]!=i&&(this.model.customObject=r[5].Value)):r.d!=i?(e=r.d[0].Value,o=r.d[1].Value,s=r.d[2].Value,this.currentReport=r.d[3].Value,this.reports=r.d[4].Value,r.d[5]!=null&&r.d[5]!=i&&(this.model.customObject=r.d[5].Value)):(e=r.Columns,o=r.Rows,s=r.Slicers,this.currentReport=r.UpdatedReport,this.reports=r.ClientReports,r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)),this._isRemoved&&(this._isRemoved=!1,tempArray=[],e.length>0&&tempArray.push(e),o.length>0&&tempArray.push(o),s.length>0&&tempArray.push(s),tempArray.length>0))for(c=0;c<tempArray.length;c++)if(u=tempArray[c],!t.isNullOrUndefined(u))for(f=0;f<u.split("#").length;f++)h=u.split("#")[f]==""||u.split("#")[f]=="Measures"?null:u.split("#")[f].split(".").length>0?u.split("#")[f].replace("."," - "):u.split("#")[f],t.isNullOrUndefined(h)||this._currentReportItems.length!=0&&this._treeViewData.hasOwnProperty(h)&&(delete this._treeViewData[h],this._currentReportItems.splice(n.inArray(h,this._currentReportItems),1));this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find(".splitBtn, .e-btn").remove();n(this._createSplitButtons(e,"Columns")).appendTo(".categoricalAxis");n(this._createSplitButtons(o,"Rows")).appendTo(".rowAxis");n(this._createSplitButtons(s,"Slicers")).appendTo(".slicerAxis");this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button});this.model.showUniqueNameOnPivotButton&&(n(".pvtBtn").addClass("splitBtnUnique"),n(".removeSplitBtn").addClass("removeBtnUnqiue"));this._setSplitBtnTitle();this._renderControls();this._unWireEvents();this._wireEvents();this._successAction="NodeDrop";this._trigger("renderSuccess",this);this._buttonContextMenu()},_buttonContextMenu:function(){var i=t.buildTag("ul.pivotTree#pivotTree",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToSlicer"))[0].outerHTML)[0].outerHTML)[0].outerHTML;this.element.append(i);n("#pivotTree").ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:this.element.find(".e-button"),click:t.proxy(this._contextClick,this),beforeOpen:t.proxy(this._contextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)})},_editorTreeInfoSuccess:function(n){n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchMemberTreeNodes",element:this.element,customObject:this.model.customObject});this._createDialog(args_className,args_innerHTML,n);this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="EditorTreeInfo";this._trigger("renderSuccess",this);this.element.find(".e-dialog .e-text:visible").first().length>0?this._curFocus.editor=this.element.find(".e-dialog .e-text:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"):this.element.find(".e-dialog .measureEditor:visible").first().length>0&&(this._curFocus.editor=this.element.find(".e-dialog .measureEditor:visible").first().attr("tabindex","-1").focus().addClass("hoverCell"))},_generateAllMember:function(t,i){this.olapCtrlObj._allMember=n(n(i).find("Axis:eq(0) Tuple:eq(0)").children().children()[1]).text()},generateJSON:function(i){this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotChart.model.analysisMode=this.model.analysisMode,this._pivotChart.model.operationalMode=this.model.operationalMode,this._pivotChart.model.dataSource=this.model.dataSource,this._pivotChart.setPivotEngine(i.tranposeEngine),this._pivotChart._drillAction="",this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&this._pivotGrid._drillAction!=""?(this._setChartDrillMembers(i.tranposeEngine,this._pivotGrid._drillAction),this._drillInfo=[]):this._pivotChart.generateJSON(this,i.tranposeEngine),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this._pivotChart._drilledCellSet=this._drilledCellSet.length>0?this._drilledCellSet:[],this._pivotChart.XMLACellSet=this.XMLACellSet.length>0?this.XMLACellSet:[]),this._pivotChart._drillAction="");this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this._pivotGrid.model.analysisMode=this.model.analysisMode,this._pivotGrid.model.operationalMode=this.model.operationalMode,this._pivotGrid.model.dataSource=this.model.dataSource,this._pivotGrid.setJSONRecords(JSON.stringify(i.jsonObj)),this._pivotGrid.model.collapsedMembers=null,this.model.gridLayout=="excellikelayout"?this._pivotGrid.excelLikeLayout(i.jsonObj):this._pivotGrid.renderControlFromJSON(),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this._pivotGrid._drilledCellSet=this._drilledCellSet.length>0?this._drilledCellSet:[],this._pivotGrid.XMLACellSet=this.XMLACellSet.length>0?this.XMLACellSet:[]),this._pivotGrid._drillAction="");this._pivotSchemaDesigner&&this._pivotSchemaDesigner._refreshPivotButtons();this.model.showUniqueNameOnPivotButton&&(n(".pivotButton").addClass("pvtBtnUnique"),n(".pvtBtn").addClass("schemaBtnUnique"),n(".removeClientPivotBtn").addClass("schemaRemoveBtnUnqiue"));this.model.isResponsive&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)||this.element.find("#"+this.chartObj._id).ejChart("option",{model:{size:{height:this._chartHeight}}}))},_renderLayout:function(){var r,i,u,f;this.model.isResponsive&&(this.model.displaySettings.enableTogglePanel=!0);r=t.buildTag("div.reportToolbar#reportToolbar",this._reportToolbar(),{width:"410px",height:"29px"})[0].outerHTML;this.model.enableSplitter?this.model.isResponsive?this.model.isResponsive&&(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).addClass("splitresponsive")[0].outerHTML,u=t.buildTag("span.outerPanel","").append(t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML+r+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",i).attr("width","100%")[0].outerHTML).attr("width","100%")[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%"})[0].outerHTML)):this.model.enableRTL&&!this.model.enableVirtualScrolling?(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).attr("class","childsplit")[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append("<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>"+r+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td class=\"controlPanelTD\" style='width:50%'>"+this._controlPanel()+"<\/td><td style='width:50%'>"+i+"<\/td><\/tr><\/table>")):this.model.enableVirtualScrolling||this.model.enableRTL&&this.model.enableVirtualScrolling?(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).attr("class","childsplit")[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append("<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>"+r+"<table class=\"outerTable\" style='width:100%'><tr style='width:98%'><td style='width:49%'>"+i+"<\/td><td class=\"controlPanelTD\" style='width:49%'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{}).attr("class","childsplit")[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append("<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>"+r+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td style='width:50%'>"+i+"<\/td><td class=\"controlPanelTD\" style='width:50%'>"+this._controlPanel()+"<\/td><\/tr><\/table>")):this.model.isResponsive?this.model.isResponsive&&(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{})[0].outerHTML,u=t.buildTag("span.outerPanel","").append((n.trim(this.model.title)!=""?t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML:"")+r+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",i)[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%"})[0].outerHTML)):(i=t.buildTag("div#"+this._id+"_PivotSchemaDesigner.pivotFieldList","",{})[0].outerHTML,u=t.buildTag("span.outerPanel","",{}).append((n.trim(this.model.title)!=""?"<div class=\"titleText\"><span style='padding-left:10px'>"+this.model.title+"<\/span><\/div>":"")+r+"<table class=\"outerTable\" style='display:block'><tr><td>"+i+"<\/td><td class=\"controlPanelTD\"style='display:block'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>"));this.element.html(u);this.element.find(".reportToolbar").ejToolbar({enableRTL:this.model.enableRTL,height:"35px"});this._calculateSize();this.model.enableRTL&&this.element.addClass("e-rtl");(this.enableTogglePanel()&&!this.model.enableSplitter||this.model.isResponsive)&&(this.element.find(".controlPanel").width(this.element.width()-(this.element.width()/3+20)),n(t.buildTag("div.togglePanel",t.buildTag("div.toggleExpandButton e-icon","",{}).attr("aria-describedby","toggleexpand")[0].outerHTML+t.buildTag("div.toggleCollapseButton e-icon",{},{display:"none"}).attr("aria-describedby","togglecollapse")[0].outerHTML)[0].outerHTML).appendTo(this.element.find(".pivotFieldList").parent()));(this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.defaultView()==t.PivotClient.DefaultView.Grid||this.displayMode()==t.PivotClient.DisplayMode.GridOnly)&&this.element.find(".chartTypesImg").addClass("chartTypesOnGridView");this.element.find(".controlPanel").css("right",3);f="<div class ='reportList' ><input type='text' id='reportList' class='reportlist' title='"+this._getLocalizedLabels("ReportList")+"'/><\/div>";n(this.element).find(".reportCol").append(f)},_calculateSize:function(){var i,f,r,u;n(this.element).height(this.model.size.height).width(this.model.size.width);n(this.element).height(n(this.element).height()<500?500:n(this.element).height());n(this.element).width(n(this.element).width()<600?600:n(this.element).width());i=this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+5);this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?(this.model.isResponsive||this.model.enableSplitter||(r=this.element.width()/2.5,this.element.find(".csHeader").width(r+15),this.element.find(".axisBuilderTD").width(r/2),this.element.find(".cdbHeader, .cubeBrowser").width(r/2),this.element.find(".controlPanel").width(this.element.width()-(r+25))),this.model.enableVirtualScrolling?this.element.find(".controlPanel").height(i-15):this.model.enablePaging?this.element.find(".controlPanel").height(i-5):this.element.find(".controlPanel").height(i),this.element.find(".cubeTable").height(this.element.height()-((this.element.find("div.titleText").length>0?50:0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38)),this.model.isResponsive?(this.element.find(".cubeBrowser").height(this.element.find(".cubeTable").height()-this.element.find(".cdbHeader").height()),this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(56+(this.model.enableMeasureGroups?35:0))),f=this.element.find(".cubeTable").height()-(this.element.find(".axisHeader").height()*3+4)):(this.element.find(".cdbTD, .cubeTableTD").height(this.element.find(".cubeTable").height()),this.element.find(".cubeBrowser").height(this.element.find(".cdbTD, .cubeTableTD").height()+9-this.element.find(".cdbHeader").height()),this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(61+(this.model.enableMeasureGroups?30:0))),f=this.element.find(".axisBuilderTD").height()-(this.element.find(".axisHeader").height()*3+3)),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").height(f/3)):(this.model.isResponsive||this.model.enableSplitter||(this.element.find(".outerTable").width(this.element.width()),this.element.find(".controlPanel").width(this.element.width()*(2/3)),this.enableTogglePanel()&&this.element.find(".pivotFieldList").length>0&&this.element.find(".controlPanel").width(this.element.width()-(this.element.width()/3+20))),this.element.find(".controlPanelTD, .outerTable").height(i),this.model.enableVirtualScrolling?this.element.find(".controlPanel").height(i-20):this.element.find(".controlPanel").height(i));this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?(this.model.enableVirtualScrolling&&this.element.find(".controlPanel").width(this.element.find(".controlPanel").width()-5),this.defaultView()==t.PivotClient.DefaultView.Grid?(this.model.enablePaging?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2+5):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10),this.model.isResponsive||this.model.enableSplitter||this.element.find(".gridContainer").width(this.element.find(".controlPanel").width()-15)):(this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()/2-10),this.model.isResponsive||this.model.enableSplitter||this.element.find(".gridContainer").width(this.element.find(".controlPanel").width()-20))):this.displayMode()==t.PivotClient.DisplayMode.GridOnly?(this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode?12:20)),this.model.isResponsive||this.model.enableSplitter||this.element.find(".gridContainer").width(this.element.find(".controlPanel").width()-15)):this.model.enableVirtualScrolling?this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+30)):this.element.find(".gridContainer").height(this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+15)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?(this.model.enablePaging?this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2+15):this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-10),this.model.isResponsive||this.model.enableSplitter||this.element.find(".chartContainer").width(this.element.find(".controlPanel").width()-15)):(this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()/2-15),this.model.isResponsive||this.model.enableSplitter||this.element.find(".chartContainer").width(this.element.find(".controlPanel").width()-20)):this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?(this.element.find(".chartContainer").height(this.element.find(".controlPanel").height()-17),this.model.isResponsive||this.model.enableSplitter||this.element.find(".chartContainer").width(this.element.find(".controlPanel").width()-20)):(u=this.element.find(".controlPanel").height()-(this.element.find("ul.clientTab").height()+20),this.model.enableVirtualScrolling?this.element.find(".chartContainer").height(u-5):this.model.enablePaging?this.element.find(".chartContainer").height(u):this.element.find(".chartContainer").height(u-2)));this._chartHeight=this.model.enableToolBar?(this.model.enablePaging?this.element.find(".chartContainer").height()-105:this.element.find(".chartContainer").height()-68)+"px":this.element.find(".chartContainer").height()-3+"px";this._chartWidth=this.model.isResponsive||this.model.enableSplitter?"98%":this.element.find(".chartContainer").width()-15+"px";this._gridHeight=this.model.enableToolBar?this.element.find(".gridContainer").height()-46+"px":this.element.find(".gridContainer").height()-10+"px";this._gridWidth=this.model.isResponsive||this.model.enableSplitter?"98%":this.element.find(".gridContainer").width()-20+"px"},_reportToolbar:function(){return t.buildTag("ul",(this.model.toolbarIconSettings.enableNewReport?t.buildTag("li.newReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("NewReport")).attr({title:this._getLocalizedLabels("NewReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableAddReport?t.buildTag("li.addReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("AddReport")).attr({title:this._getLocalizedLabels("AddReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableRemoveReport?t.buildTag("li.removeReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("RemoveReport")).attr({title:this._getLocalizedLabels("RemoveReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableRenameReport?t.buildTag("li.renameReportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("RenameReport")).attr({title:this._getLocalizedLabels("RenameReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableDBManipulation?t.buildTag("li.reportDBImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("DBReport")).attr({title:this._getLocalizedLabels("DBReport"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableMDXQuery&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap?t.buildTag("li.mdxImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("MDXQuery")).attr({title:this._getLocalizedLabels("MDXQuery"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableDeferUpdate&&this.model.enableDeferUpdate&&this.model.analysisMode!=t.Pivot.AnalysisMode.Pivot&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?t.buildTag("li.autoExecuteImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("DeferUpdate")).attr({title:this._getLocalizedLabels("DeferUpdate"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableCalculatedMember?t.buildTag("li.calcMemberImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("CalculatedMember")).attr({title:this._getLocalizedLabels("CalculatedMember"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableExcelExport?t.buildTag("li.excelExportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ExportToExcel")).attr({title:this._getLocalizedLabels("ExportToExcel"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableWordExport?t.buildTag("li.wordExportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ExportToWord")).attr({title:this._getLocalizedLabels("ExportToWord"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enablePdfExport?t.buildTag("li.pdfExportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ExportToPdf")).attr({title:this._getLocalizedLabels("ExportToPdf"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableFullScreen&&this.model.displaySettings.enableFullScreen?t.buildTag("li.maximizedView e-icon","",{}).attr("aria-label",this._getLocalizedLabels("FullScreen")).attr({title:this._getLocalizedLabels("FullScreen"),tabindex:0})[0].outerHTML:"")+(this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&!this.model.enableAdvancedFilter?(this.model.toolbarIconSettings.enableSortOrFilterColumn?t.buildTag("li.colSortFilterImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SortOrFilterColumn")).attr({title:this._getLocalizedLabels("SortOrFilterColumn"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableSortOrFilterRow?t.buildTag("li.rowSortFilterImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SortOrFilterRow")).attr({title:this._getLocalizedLabels("SortOrFilterRow"),tabindex:0})[0].outerHTML:""):"")+(this.model.toolbarIconSettings.enableToggleAxis?t.buildTag("li.toggleaxisImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ToggleAxis")).attr({title:this._getLocalizedLabels("ToggleAxis"),tabindex:0})[0].outerHTML:"")+(this.model.toolbarIconSettings.enableChartTypes?t.buildTag("li.chartTypesImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("ChartTypes")).attr({title:this._getLocalizedLabels("ChartTypes"),tabindex:0})[0].outerHTML:"")+t.buildTag("li.reportCol e-icon","",{}).attr("aria-label","report").attr({title:this._getLocalizedLabels("ReportList"),tabindex:0})[0].outerHTML)},_clientGridDrillSuccess:function(i){if(this._isChartDrillAction)this._isChartDrillAction=!1;else if(i.axis=="rowheader"&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly){i.drillAction=="drilldown"?this._drillParams.push(i.drilledMember):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(i.drilledMember)<0});this._pivotChart._drillParams=this._drillParams;var r=i.drilledMember.split(">#>");this._pivotChart._labelCurrentTags.expandedMembers=r;i.drillAction=="drillup"&&(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(this._pivotChart._labelCurrentTags.expandedMembers=[],this._drillParams.length>0&&this._getDrilledMember(i.drillAction)):this._pivotChart._labelCurrentTags.expandedMembers.length==0&&this._drillParams.length>0&&this._getDrilledMember(i.drillAction));this._pivotChart._drillAction=i.drillAction;this._pivotChart.refreshControl()}},_getDrilledMember:function(){var o=this._drillParams[this._drillParams.length-1],r=n.grep(this._drillParams,function(n){return n.indexOf(o)>=0}),e,f,u,i;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)for(i=0;i<r.length;i++)r[i].split(">#>").length>this._pivotChart._labelCurrentTags.expandedMembers.length&&(this._pivotChart._labelCurrentTags.expandedMembers=r[i].split(">#>"));else{for(e=r[0].split(">#>").length,f=0,i=1;i<r.length;i++)if(r[i].split(">#>").length>e){f=i;break}for(this._drillInfo=r[f].split(">#>"),u=0,this._pivotChart._labelCurrentTags.expandedMembers=[],i=0;i<this._drillInfo.length;i++)t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers[u])&&(this._pivotChart._labelCurrentTags.expandedMembers[u]=[]),i+1<this._drillInfo.length?t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillInfo[i]))||t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillInfo[i+1]))||t.olap._mdxParser._splitCellInfo(this._drillInfo[i]).hierarchyUniqueName!=t.olap._mdxParser._splitCellInfo(this._drillInfo[i+1]).hierarchyUniqueName?u++:this._pivotChart._labelCurrentTags.expandedMembers[u].push(this._drillInfo[i]):(this._pivotChart._labelCurrentTags.expandedMembers[u].push(this._drillInfo[i]),this._isChartDrillAction=!0)}},_clearSorting:function(r){if(n(r.target).parent().attr("disabled")=="disabled")return!1;t.Pivot.closePreventPanel(this);pivotClientObj=this;var f=this.model.dataSource,e=this._schemaData._selectedFieldName.toLowerCase(),u=n.map(f.columns,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()==e)return n});u.length==0&&(u=n.map(f.rows,function(n){if(n.fieldName!=i&&n.fieldName.toLowerCase()==e)return n}));u.length>0&&delete u[0].sortOrder;this.model.dataSource=f;this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog)").remove();this._schemaData!=null&&this._schemaData.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog)").remove();pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?this.refreshControl():t.olap.base.getJSONData({action:"clearSorting"},this.model.dataSource,this)},_clientChartDrillSuccess:function(t){var u=[],f,e,i,o,r;for(t.drilledMember!=""&&(u=t.drilledMember.split(">#>"),this._isChartDrillAction=!0),f=0,e=this._pivotGrid._rowCount,i=0;i<u.length;i++)o=i==u.length-1&&t.drillAction=="drilldown"?this.element.find(".e-pivotgrid .pivotGridTable th.summary[p^='"+i+"']"):this.element.find(".e-pivotgrid .pivotGridTable th.rowheader[p^='"+i+"']"),r=n.grep(o,function(t){return n(t).clone().children().remove().end().text()==u[i]}),r=n.grep(r,function(t){return parseInt(n(t).attr("p").split(",")[1])>=f&&parseInt(n(t).attr("p").split(",")[1])<=e}),i==u.length-1?n(r).find("."+(t.drillAction=="drilldown"?"expand":"collapse")).trigger("click"):(f=parseInt(n(r).attr("p").split(",")[1]),e=f+parseInt(n(r).find("span").attr("tag"))+r[0].rowSpan)},setChartDrillParams:function(i,r){var e,u,h;r=="drilldown"?this._drillParams.push(i):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(i)<0});this._drillInfo=i.split(">#>");e=0;this._pivotChart._labelCurrentTags.expandedMembers=[];var o=this._drillInfo.length-1,s=r=="drillup"&&this._drillParams.length>0&&this._drillParams[this._drillParams.length-1]!=this._drillInfo.join(">#>")&&this._drillParams[this._drillParams.length-1].split(">#>").filter(function(n){return n<o}).join(">#>")==this._drillInfo.filter(function(n){return n<o}).join(">#>"),f=s?this._drillParams[this._drillParams.length-1].split(">#>"):this._drillInfo;for(u=0;u<f.length;u++)t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers[e])&&(this._pivotChart._labelCurrentTags.expandedMembers[e]=[]),u+1<f.length||s?(!t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(f[u]))&&!t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(f[u+1]))?t.olap._mdxParser._splitCellInfo(f[u]).hierarchyUniqueName==t.olap._mdxParser._splitCellInfo(f[u+1]).hierarchyUniqueName:u==f.length-1?!0:!1)?this._pivotChart._labelCurrentTags.expandedMembers[e].push(f[u]):e++:r=="drilldown"&&(this._pivotChart._labelCurrentTags.expandedMembers[e].push(f[u]),this._isChartDrillAction=!0);h=n.grep(this._pivotChart._labelCurrentTags.expandedMembers,function(n){return n.length>0});h.length==0&&this._drillParams.length>0&&(this._getDrilledMember(r),this._pivotGrid._drillAction="drilldown")},_setChartDrillMembers:function(n){var o,h,c,e,p,i,a,r;if(this._drillInfo.length>0&&!this._pivotChart.model.enableMultiLevelLabels){var f=0,u=this._pivotChart._cloneEngine(n),s=!1;for(i=0;i<this._pivotChart._labelCurrentTags.expandedMembers.length;i++)for(r=0;r<this._pivotChart._labelCurrentTags.expandedMembers[i].length;r++)s=!0;if(s){for(h=this._drillInfo[this._drillInfo.length-1],i=0;i<this.model.dataSource.rows.length;i++)c=t.olap._mdxParser._splitCellInfo(h).hierarchyUniqueName,this.model.dataSource.rows[i].fieldName==c&&(o=i);var v=this.model.dataSource.values[0].axis=="rows"?1:0,l=this._drillInfo.length-1,y=this._pivotGrid._drillAction=="drillup"&&this._drillParams.length>0&&this._drillParams[this._drillParams.length-1].split(">#>").filter(function(n){return n<l}).join(">#>")==this._drillInfo.filter(function(n){return n<l}).join(">#>");if(y)for(i=0;i<this._drillParams[this._drillParams.length-1].split(">#>").length;i++)t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillParams[this._drillParams.length-1].split(">#>")[i]))||t.olap._mdxParser._splitCellInfo(this._drillParams[this._drillParams.length-1].split(">#>")[i]).hierarchyUniqueName==""||(e=t.olap._mdxParser._splitCellInfo(this._drillParams[this._drillParams.length-1].split(">#>")[i]).leveName,this._pivotChart._cropData(u,e,i+f,!1));else{if(u[0+f][0].ColSpan>(this._drillInfo.length+this._pivotGrid._drillAction=="drilldown"?1:0))for(i=this._drillInfo.length+(this._pivotGrid._drillAction=="drilldown"?1:0)+(this.model.dataSource.rows.length-(o+1));i+v<u[0+f][0].ColSpan;i++)u.splice(i,1),u[0][0].ColSpan--;for(i=0;i<this._drillInfo.length-(this._pivotGrid._drillAction=="drillup"?1:0);i++)t.isNullOrUndefined(t.olap._mdxParser._splitCellInfo(this._drillInfo[i]))||t.olap._mdxParser._splitCellInfo(this._drillInfo[i]).hierarchyUniqueName==""||(e=t.olap._mdxParser._splitCellInfo(this._drillInfo[i]).leveName,this._pivotChart._cropData(u,e,i+f,!1))}if(p=0,!t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers))for(i=0;i<this._pivotChart._labelCurrentTags.expandedMembers.length;i++)if(!t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers[i]))if(i>o)for(r=0;r<this._pivotChart._labelCurrentTags.expandedMembers[i].length;r++)a=this._pivotChart._labelCurrentTags.expandedMembers[i][r].split("::")[2],this._pivotChart._cropData(u,a,i+f,!0),f++;else for(r=0;r<this._pivotChart._labelCurrentTags.expandedMembers[i].length;r++)f++}this._drillInfo=[];this._pivotChart._generateData(u)}else this._pivotChart.generateJSON(this,n)},refreshPagedPivotClient:function(n,i){var r;if(pivotClientObj=this,t.isNullOrUndefined(this._waitingPopup)||(pivotClientObj._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800)),n=n.indexOf("categ")!=-1?"categorical":"series",this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap)n=="categorical"?this._categCurrentPage=parseInt(i):this._seriesCurrentPage=parseInt(i),t.olap.base.getJSONData({action:"navPaging"},this.model.dataSource,this);else if(this.currentReport!=""){try{r=JSON.parse(this.currentReport)}catch(u){r=this.currentReport}this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:n+":"+i,currentReport:r,layout:t.PivotGrid.Layout.NoSummaries,customObject:null}),this.refreshPagedPivotClientSuccess)}},refreshPagedPivotClientSuccess:function(n){var r=[];n.d!=i?(r[0]=n.d[2],r[1]=n.d[1]):r=n;this.model.displaySettings.mode==t.PivotClient.DisplayMode.GridOnly?this._pivotGrid._renderControlSuccess(n):this.model.displaySettings.mode==t.PivotClient.DisplayMode.ChartOnly?this._pivotChart.renderControlSuccess(r):(this.model.displaySettings.mode=t.PivotClient.DisplayMode.ChartAndGrid)&&(this._pivotGrid._renderControlSuccess(n),this._pivotChart.renderControlSuccess(r))},_hiddenCellInfo:function(t){var i=n.map(t,function(n){if(n.Key=="FilteredColumnHeaders")return n.Value}),r=n.map(t,function(n){if(n.Key=="FilteredRowHeaders")return n.Value});return{columnArea:i.length>0?i[0]:i,rowArea:r.length>0?r[0]:[]}},_renderControlSuccess:function(r){var c,v,nt,l,y,f,p,tt,d,g,w,u,rt,ut,b;this.model.isResponsive&&(this.model.displaySettings.enableTogglePanel=this.model.isResponsive);eventArgs={element:this.element,customObject:this.model.customObject};this._trigger("load",eventArgs);var a="",o="",s="",h="",e="";if(r[0]!=i)a=r[0].Value,o=r[1].Value,s=r[2].Value,h=r[3].Value,e=r[4].Value,this.currentReport=this._deferReport=r[5].Value,this.reports=r[6].Value,reportsCount=r[7].Value,v=n.parseJSON(r[8].Value),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r[9].Value)),this.currentCubeName=r[10].Value,r[11]!=null&&r[11]!=i&&(this.model.customObject=r[11].Value);else if(r.d!=i){if(t.isNullOrUndefined(r.d[3])||r.d[3].Value=="Pivot"){this.model.analysisMode=t.Pivot.AnalysisMode.Pivot;this._currentReportName="Default";c=this._hiddenCellInfo(r.d);r.d.length>4&&r.d[4].Value=="LoadReport"?(this._clientReportCollection=JSON.parse(r.d[5].Value),this._renderClientControls({PivotReport:r.d[0].Value,GridJSON:r.d[1].Value,ChartJSON:r.d[2].Value,FilteredColumnHeaders:c.columnArea.length>0?c.columnArea:"[]",FilteredRowHeaders:c.rowArea.length>0?c.rowArea:"[]"}),v=n.map(this._clientReportCollection,function(n){if(n.name!=i)return{name:n.name}}),nt=this.element.find(".reportlist").data("ejDropDownList"),this.element.find(".reportlist").ejDropDownList("option","dataSource",v),nt.selectItemByText(v[0].name),this._unWireEvents(),this._wireEvents()):(this.model.enableDrillThrough&&!t.isNullOrUndefined(r.d[4].Value)&&(this.dataSet=r.d[4].Value),this._clientReportCollection=[{name:"Default",report:n.parseJSON(r.d[0].Value).Report}],this._renderClientControls({PivotReport:r.d[0].Value,GridJSON:r.d[1].Value,ChartJSON:r.d[2].Value,FilteredColumnHeaders:c.columnArea.length>0?c.columnArea[0]:"[]",FilteredRowHeaders:c.rowArea.length>0?c.rowArea[0]:"[]"}));return}a=r.d[0].Value;o=r.d[1].Value;s=r.d[2].Value;h=r.d[3].Value;e=r.d[4].Value;this.currentReport=this._deferReport=r.d[5].Value;this.reports=r.d[6].Value;reportsCount=r.d[7].Value;v=n.parseJSON(r.d[8].Value);this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.d[9].Value));this.currentCubeName=r.d[10].Value;r.d[11]!=null&&r.d[11]!=i&&(this.model.customObject=r.d[11].Value)}else if(r!="")if(t.isNullOrUndefined(r.DataModel)||r.DataModel=="Olap")this.model.analysisMode=t.Pivot.AnalysisMode.Olap,a=r.Cubes,o=r.Columns,s=r.Rows,h=r.Slicers,e=r.CubeTreeInfo,this.currentReport=r.CurrentReport,this.reports=r.ClientReports,v=n.parseJSON(r.ReportList),reportsCount=r.ReportsCount,this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.MeasureGroups)),this.currentCubeName=r.CurrentCubeName,r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject);else{this.model.analysisMode=t.Pivot.AnalysisMode.Pivot;this._currentReportName=t.isNullOrUndefined(r.ReportCollection)?"Default":JSON.parse(r.ReportCollection)[0].name;this._clientReportCollection=t.isNullOrUndefined(r.ReportCollection)?[{name:"Default",report:n.parseJSON(r.PivotReport).Report}]:JSON.parse(r.ReportCollection);this._renderClientControls(r);return}this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"initialize",element:this.element,customObject:this.model.customObject});l=null;r!=""&&(l=n.parseJSON(e));y=t.buildTag("div.reportToolbar#reportToolbar",this._reportToolbar(),{width:"410px",height:"29px"})[0].outerHTML;this.model.enableSplitter?this.model.isResponsive?(f=this._createCubeSelector()+t.buildTag("table.cubeTable",t.buildTag("tbody",t.buildTag("tr.splitresponsive",t.buildTag("td.cubeTableTD",this._createCubeBrowser(e)).attr({valign:"bottom"}).css("width","50%")[0].outerHTML+t.buildTag("td.cubeTableTD",this._createAxisElementBuilder(o,s,h)).attr({valign:"bottom"}).css("width","50%")[0].outerHTML).css("width","100%")[0].outerHTML)[0].outerHTML)[0].outerHTML,p=t.buildTag("span.outerPanel","").append((n.trim(this.model.title)!=""?t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML:"")+y+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",f)[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%"})[0].outerHTML)):this.model.enableRTL?this.model.enableVirtualScrolling?(f=this._createCubeSelector()+"<table class=cubeTable style='width:100%'><tr class='childsplit' style='width:98%'><td class=axisBuilderTD valign=\"bottom\" style='width:47%'>"+this._createAxisElementBuilder(o,s,h)+"<\/td><td class=cdbTD valign=\"bottom\" style='width:47%;'>"+this._createCubeBrowser(e)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td style='width:49%'>"+f+"<\/td><td class=\"controlPanelTD\" style='width:49%;'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):(f=this._createCubeSelector()+"<table class=cubeTable style='width:98%'><tr class='childsplit'><td class=axisBuilderTD valign=\"bottom\" style='"+(this.model.enableRTL?"padding-right:0px;":"padding-left:"+this.model.enableSplitter?"0px":"5px")+"'>"+this._createAxisElementBuilder(o,s,h)+'<\/td><td class=cdbTD valign="bottom"\'>'+this._createCubeBrowser(e)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit'><td class=\"controlPanelTD\">"+this._controlPanel()+"<\/td><td>"+f+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):(f=this._createCubeSelector()+"<table class=cubeTable style='width:100%'><tr class='childsplit' style='width:98%'><td class=cdbTD valign=\"bottom\" style='width:47%;'>"+this._createCubeBrowser(e)+'<\/td><td class=axisBuilderTD valign="bottom" style=\''+(this.model.enableRTL?"padding-right:5px;":"padding-left:"+this.model.enableSplitter?"0px":"5px")+"width:47%'>"+this._createAxisElementBuilder(o,s,h)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+"<table class=\"outerTable\" style='width:100%'><tr class='parentsplit' style='width:100%'><td style='width:49%'>"+f+"<\/td><td class=\"controlPanelTD\" style='width:49%'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>")):this.model.isResponsive?this.model.isResponsive&&(f=this._createCubeSelector()+t.buildTag("table.cubeTable",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td.cubeTableTD",this._createCubeBrowser(e)).attr({valign:"bottom",width:"50%",height:"100%"}).css({"table-layout":"fixed",display:"initial"})[0].outerHTML+t.buildTag("td.cubeTableTD",this._createAxisElementBuilder(o,s,h)).attr({valign:"bottom",width:"50%",height:"100%"})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,p=t.buildTag("span.outerPanel","").append((n.trim(this.model.title)!=""?t.buildTag("div.titleText",t.buildTag("span",this.title(),{"padding-left":"10px"})[0].outerHTML)[0].outerHTML:"")+y+t.buildTag("table.oClientTbl",t.buildTag("tr",t.buildTag("td",t.buildTag("table.outerTable",t.buildTag("tr",t.buildTag("td",f)[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("table.controlPanelTD",t.buildTag("tr",t.buildTag("td",this._controlPanel())[0].outerHTML+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:""))[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML,{width:"100%","table-layout":"fixed"})[0].outerHTML)):(f=this._createCubeSelector()+"<table class=cubeTable><tr><td class=cdbTD valign=\"bottom\" style='display:block'>"+this._createCubeBrowser(e)+'<\/td><td class=axisBuilderTD valign="bottom" style=\''+(this.model.enableRTL?"padding-right:5px;":"padding-left:5px;")+"'>"+this._createAxisElementBuilder(o,s,h)+"<\/td><\/tr><\/table>",p=t.buildTag("span.outerPanel","",{}).append('<div class="titleText"><span>'+this.title()+"<\/span><\/div>"+y+'<table class="outerTable"><tr><td>'+f+"<\/td><td class=\"controlPanelTD\" style='display:block'>"+this._controlPanel()+"<\/td>"+(this.model.enableVirtualScrolling?t.buildTag("td.virtualScrolling",t.buildTag("div.vScrollPanel")[0].outerHTML)[0].outerHTML:"")+"<\/tr><\/table>"));this.element.html(p);this.element.find(".reportToolbar").ejToolbar({enableRTL:this.model.enableRTL,height:"35px"});this._calculateSize();this.model.enableRTL&&this.element.addClass("e-rtl");(this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.defaultView()==t.PivotClient.DefaultView.Grid||this.displayMode()==t.PivotClient.DisplayMode.GridOnly)&&this.element.find(".chartTypesImg").addClass("chartTypesOnGridView");tt="<div class ='reportList' ><input type='text' id='reportList' class='reportlist' title='"+this._getLocalizedLabels("ReportList")+"'/><\/div>";this.model.enableMeasureGroups&&this._createMeasureGroup();n(this.element).find(".reportCol").append(tt);this.element.find(".reportlist").ejDropDownList({dataSource:v,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"26px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});this.element.find(".reportlist").attr("tabindex",0);var k=this.element.find(".csHeader").width()-this.element.find(".cubeText").width()-(this.element.find(".toggleExpandButton").length>0?this.element.find(".toggleExpandButton").width():0)-(this.model.analysisMode=="olap"&&this.model.operationalMode=="servermode"||this.model.enableSplitter?20:50),it=this.enableTogglePanel()?k-25:k,ft=a==""?"":n.parseJSON(a);for(this.element.find(".cubeSelector").ejDropDownList({dataSource:ft,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},width:this.model.enableSplitter&&!this.model.isResponsive?"100%":""+it+"px"}),ddlTarget=this.element.find(".cubeSelector").data("ejDropDownList"),reportDropTarget=this.element.find("#reportList").data("ejDropDownList"),r==""||t.isNullOrUndefined(ddlTarget)||(ddlTarget.selectItemByText(this.currentCubeName),reportDropTarget.model.dataSource.length&&reportDropTarget.selectItemByText(reportDropTarget.model.dataSource[0].name),this._selectedReport=reportDropTarget.currentValue),this.element.find(".cubeSelector").ejDropDownList("option","change",t.proxy(this._cubeChanged,this)),this.element.find(".cubeSelector").attr("tabindex",0),this.element.find(".reportlist").ejDropDownList("option","change",t.proxy(this.reportChanged,this)),this.model.enableMeasureGroups&&this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this)),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:l},allowDragAndDrop:!0,enableRTL:this.model.enableRTL,allowDropChild:!1,allowDropSibling:!1,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",nodeDropped:t.proxy(this._nodeDropped,this)}),this.element.find(".cubeTreeView").attr("tabindex",0),d=this.element.find(".cubeTreeView").find("li"),u=0;u<d.length;u++)d[u].setAttribute("tag",l[u].tag);for(g=this.element.find(".cubeTreeView .folderCDB"),u=0;u<g.length;u++)n(g[u].parentElement).removeClass("e-draggable");if(this.element.find(".cubeTreeView .calcMemberGroupCDB").length>0&&(this.element.find(".cubeTreeView .calcMemberGroupCDB").parent().removeClass("e-draggable"),w=this.element.find(".cubeTreeView .calcMemberCDB").parents("li").find("li"),w.length>0))for(u=0;u<w.length;u++)this._calcMembers.push(l[u+1]),w[u].setAttribute("expression",l[u+1].expression),w[u].setAttribute("formatString",l[u+1].formatString),w[u].setAttribute("nodeType",l[u+1].nodeType);if(this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView"),rt=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 0px"})[0].outerHTML,ut=t.buildTag("div.cubeName",this.currentCubeName+rt),n(this.element).find(".cubeBrowser").prepend(ut),this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").ejDroppable({drop:t.proxy(this._onDropped,this)}),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button}),this.enableTogglePanel()&&(n(t.buildTag("div.toggleExpandButton e-icon",t.buildTag("p#toggleexpand","toggle expanded",{display:"none"})[0].outerHTML).attr("aria-describedby","toggleexpand")[0].outerHTML).appendTo(this.element.find(".csHeader")),n(this.element.find(".outerTable").find("td")[0]).append(t.buildTag("div.toggleCollapseButton e-icon",t.buildTag("p#togglecollapse","toggle collapsed",{display:"none"})[0].outerHTML).attr("aria-describedby","togglecollapse")[0].outerHTML),n(t.buildTag("div.toggleText")[0].outerHTML).insertAfter(this.element.find(".toggleCollapseButton")),this.element.find(".toggleCollapseButton").hide(),this.element.find(".toggleText").hide()),this._overflow(),this._setSplitBtnTitle(),this.element.find("#clientTab").ejTab({enableRTL:this.model.enableRTL,itemActive:t.proxy(this._onTabClick,this)}),this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){if(this.defaultView()==t.PivotClient.DefaultView.Chart?(this.element.find("#"+this._id+"_PivotChart").ejPivotChart({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),showTooltip:!0,size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:this.model.chartLoad,drillSuccess:t.proxy(this._chartDrillSuccess,this)}),this.gridLayout()!=t.PivotGrid.Layout.Normal?this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,layout:this.gridLayout(),locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}):this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)})):(this.gridLayout()!=t.PivotGrid.Layout.Normal?this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,locale:this.locale(),layout:this.gridLayout(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}):this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,isResponsive:this.model.isResponsive,enableRTL:this.model.enableRTL,currentReport:this.currentReport,locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}),this.element.find("#"+this._id+"_PivotChart").ejPivotChart({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),showTooltip:!0,size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}},drillSuccess:t.proxy(this._chartDrillSuccess,this),beforeServiceInvoke:this.model.chartLoad})),this.model.enablePaging&&(this.element.find("#"+this._id+"_Pager").ejPivotPager({mode:t.PivotPager.Mode.Both,targetControlID:this._id}),this.element.find(".controlPanel").height(this.element.find(".controlPanel").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".gridContainer").height(this.element.find(".gridContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+5)),this.element.find(".chartContainer").height(this.element.find(".chartContainer").height()-(this.element.find("#"+this._id+"_Pager").height()+10))),this.displayMode()!="chartonly"&&(this._pivotGrid=this.element.find("#"+this._id+"_PivotGrid").data("ejPivotGrid")),this.displayMode()!="gridOnly"&&(this._pivotChart=this.element.find("#"+this._id+"_PivotChart").data("ejPivotChart")),b={},this._pivotChart!=null&&(this.element.find("#"+this._id+"_PivotChart").width(this._pivotChart.model.size.width),b.chartModelWidth=this._pivotChart.model.size.width),b.controlPanelWidth=this.element.find(".controlPanel").width(),b.chartOuterWidth=this._chartWidth,b.gridOuterWidth=this._gridWidth,this._initStyles.push(b),this._wireEvents(),this.model.isResponsive&&(this._enableResponsive(),this._parentElwidth=n("#"+this._id).parent().width(),this._parentElwidth<850?this._rwdToggleCollapse():this._parentElwidth>850&&this._rwdToggleExpand()),this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode!=t.Pivot.OperationalMode.ClientMode){var k=this.element.find(".csHeader").width()-this.element.find(".cubeText").width()-this.element.find(".toggleExpandButton").width()-(this.model.enableSplitter?50:20),it=this.enableTogglePanel()?k-25:k,ft=a==""?"":n.parseJSON(a);this.element.find(".cubeSelector").ejDropDownList({width:this.model.enableSplitter&&!this.model.isResponsive?"100%":""+it+"px"})}this._trigger("renderSuccess",this);this._successAction="ClientRender";this.progressPos=n("#"+this._id).position();this._treeContextMenu();this._buttonContextMenu();this.model.analysisMode=="olap"&&this.model.operationalMode=="servermode"&&this.model.enableSplitter&&this._createSplitter();t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this);this.model.showUniqueNameOnPivotButton&&(n(".pvtBtn").addClass("splitBtnUnique"),n(".removeSplitBtn").addClass("removeBtnUnqiue"))}},_contextOpen:function(i){t.Pivot.openPreventPanel(this);var r=n("#pivotTree").data("ejMenu");this._selectedMember=n(i.target);r.enableItem(this._getLocalizedLabels("AddToColumn"));r.enableItem(this._getLocalizedLabels("AddToRow"));r.enableItem(this._getLocalizedLabels("AddToSlicer"))},_contextClick:function(n){var i,r,u,f;if(t.Pivot.closePreventPanel(this),i=n.events.text,r="",pivotClientObj=this,i=i==this._getLocalizedLabels("AddToSlicer")?"Slicer":i==this._getLocalizedLabels("AddToColumn")?"Categorical":i==this._getLocalizedLabels("AddToRow")?"Series":"",i=="Slicer"&&this._selectedMember!=null&&this._selectedMember.parent().attr("tag").indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);f=this.currentCubeName+"--"+this._selectedMember.parent().attr("tag")+"--"+i+"--"+r;this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"SplitButton",nodeInfo:f,olapReport:this.currentReport,clientReports:this.reports,customObject:u}),this._nodeDroppedSuccess)},_onContextOpen:function(i){if(n(i.target).find(".folderCDB").length>0||n(i.target).find(".calcMemberGroupCDB").length>0)return!1;t.Pivot.openPreventPanel(this);var r=n("#pivotTreeContext").data("ejMenu");this._selectedMember=n(i.target);r.enableItem(this._getLocalizedLabels("AddToColumn"));r.enableItem(this._getLocalizedLabels("AddToRow"));n(i.target).find(".calcMemberCDB").length>0?r.showItems(["#Remove"]):r.hideItems(["#Remove"]);n(i.target.parentElement).find(".namedSetCDB").length>0?r.disableItem(this._getLocalizedLabels("AddToSlicer")):r.enableItem(this._getLocalizedLabels("AddToSlicer"))},_onTreeContextClick:function(i){var r,o,e,u,f;if(t.isNullOrUndefined(this._curFocus.tree)?t.isNullOrUndefined(this._curFocus.tab)||this._curFocus.tab.attr("tabindex","-1").focus().addClass("hoverCell"):this._curFocus.tree.attr("tabindex","-1").focus().addClass("hoverCell"),delete this._fieldMembers[this._dialogTitle],delete this._fieldSelectedMembers[this._dialogTitle],t.Pivot.closePreventPanel(this),r=i.events.text,o="",pivotClientObj=this,pivotClientObj._isTimeOut=!0,r==this._getLocalizedLabels("Remove"))setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800),e=this.element.find(".splitBtn"),jQuery.each(e,function(t,i){n(e[t]).attr("tag").split(":")[1]==pivotClientObj._selectedMember.parent().parent().attr("tag").replace(/\[/g,"").replace(/\]/g,"")&&n(i).remove()}),pivotClientObj._cubeTreeView.model.beforeDelete=null,pivotClientObj._cubeTreeView.removeNode(pivotClientObj._selectedMember.parent().parent().attr("id")),pivotClientObj._cubeTreeView.model.beforeDelete=function(){return!1},t.isNullOrUndefined(pivotClientObj._calcMemberTreeObj)||pivotClientObj._calcMemberTreeObj.removeNode(pivotClientObj._selectedMember.parent().parent().attr("id")),pivotClientObj.element.find(".cubeTreeView .calcMemberCDB").length==0&&pivotClientObj.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li").length>0&&(pivotClientObj._cubeTreeView.model.beforeDelete=null,pivotClientObj._cubeTreeView.removeNode(pivotClientObj.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li").attr("id")),pivotClientObj._cubeTreeView.model.beforeDelete=function(){return!1}),pivotClientObj.element.find(".cubeTreeViewCalcMember .calcMemberCDB").length==0&&pivotClientObj.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li").length>0&&pivotClientObj._calcMemberTreeObj.removeNode(pivotClientObj.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li").attr("id")),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"removeCalculatedMember",element:this.element,customObject:this.model.customObject}),u=JSON.stringify(this.model.customObject),f=this._selectedMember.parent().parent().attr("tag"),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.removeSplitButton,JSON.stringify({action:"removeCalculatedMember",clientParams:f,olapReport:pivotClientObj.currentReport,clientReports:pivotClientObj.reports,customObject:u}),pivotClientObj._removeSplitButtonSuccess);else{if(r=r==pivotClientObj._getLocalizedLabels("AddToSlicer")?"Slicer":r==pivotClientObj._getLocalizedLabels("AddToColumn")?"Categorical":r==pivotClientObj._getLocalizedLabels("AddToRow")?"Series":"",r=="Slicer"&&this._selectedMember.parent().parent().attr("tag")!=null&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1||r=="Slicer"&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this._selectedMember.parent().parent().find(".calcMemberCDB").length>0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1&&this._selectedMember.parent().parent().attr("tag").replace(/\[/g,"").replace(/\]/g,"")!=this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").attr("tag").split(":")[1].split("::")[0]||r=="Slicer"&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this._selectedMember.parent().parent().find(".calcMemberCDB").length==0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1||r=="Slicer"&&this._selectedMember.parent().parent().attr("tag").indexOf("Measure")>-1&&this._selectedMember.parent().parent().find(".calcMemberCDB").length==1&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==0&&this.element.find(".splitBtn[tag*=Measure]").length==1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);f=pivotClientObj.currentCubeName+"--"+this._selectedMember.parent().parent().attr("tag")+"--"+r+"--"+o;pivotClientObj.doAjaxPost("POST",pivotClientObj.model.url+"/"+pivotClientObj.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:f,olapReport:pivotClientObj.currentReport,clientReports:pivotClientObj.reports,customObject:u}),pivotClientObj._nodeDroppedSuccess)}},_toggleAxisSuccess:function(r){var u,f,e,o;this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?(t.isNullOrUndefined(r.d)?this.setOlapReport(r.PivotReport):this.setOlapReport(n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value),this.refreshControl(r)):(r[0]!=i?(u=r[0].Value,f=r[1].Value,e=r[2].Value,this.currentReport=r[3].Value,this.reports=r[4].Value):r.d!=i?(u=r.d[0].Value,f=r.d[1].Value,e=r.d[2].Value,this.currentReport=r.d[3].Value,this.reports=r.d[4].Value):(u=r.Columns,f=r.Rows,e=r.Slicers,this.currentReport=r.CurrentReport,this.reports=r.ClientReports),this.model.OperationalMode==t.Pivot.AnalysisMode.ServerMode&&(this.element.find(".cubeTable").find(".categoricalAxis").parent().html("").html(this._createAxisElementBuilder(u,f,e)),this.element.find(".cubeTable").height(this.element.height()-((this.element.find("div.titleText").length>0?this.element.find("div.titleText").height():0)+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38)),this.element.find(".cdbTD, .cubeTableTD").height(this.element.find(".cubeTable").height()),o=this.element.find(".cdbTD, .cubeTableTD").height()-(this.element.find(".axisHeader").height()*3+7),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").height(o/3)),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button}),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").addClass("e-droppable"),this._renderControls(),this._setSplitBtnTitle(),this._unWireEvents(),this._wireEvents(),this._trigger("renderSuccess",this),this._buttonContextMenu())},_measureGroupChangedSuccess:function(r){var f,r,e,o,u;for(r[0]!=i&&(f=r[0].Value),f=r.d!=i?r.d[0].Value:r.CubeTreeInfo,this.element.find(".e-treeview, .cubeTreeView").remove(),r=t.buildTag("div#cubeTreeView.cubeTreeView")[0].outerHTML,this.element.find(".cubeBrowser").append(r),e=n.parseJSON(f),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:e},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:this.model.enableRTL,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},nodeDropped:t.proxy(this._nodeDropped,this),beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:"464px"}),o=this.element.find(".cubeTreeView").find("li"),u=0;u<o.length;u++)o[u].setAttribute("tag",e[u].tag);this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-this.element.find(".cubeName").height()-(7+(this.model.enableMeasureGroups?this.element.find(".measureGroupselector").height()+13:0)));this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView");this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="MeasureGroupChange"},_cubeChangedSuccess:function(r){var f,e,o,s,u;r[0]!=i?(this.currentReport=r[0].Value,f=r[1].Value,this.reports=r[2].Value,reportsCount=r[3].Value,reportList=n.parseJSON(r[4].Value),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r[5].Value)),e=n.parseJSON(r[6].Value),r[7]!=null&&r[7]!=i&&(this.model.customObject=r[7].Value)):r.d!=i?(this.currentReport=r.d[0].Value,f=r.d[1].Value,this.reports=r.d[2].Value,reportsCount=r.d[3].Value,reportList=n.parseJSON(r.d[4].Value),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.d[5].Value)),e=n.parseJSON(r.d[6].Value),r.d[7]!=null&&r.d[7]!=i&&(this.model.customObject=r.d[7].Value)):(this.currentReport=r.NewReport,f=r.CubeTreeInfo,this.reports=r.ClientReports,reportsCount=r.ReportsCount,reportList=n.parseJSON(r.ReportList),this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.MeasureGroups)),e=n.parseJSON(r.ControlSettings),r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject));this.model.chartType=e.ChartType.toLowerCase();this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"cubeChanged",element:this.element,customObject:this.model.customObject});this.model.enableDeferUpdate?this.element.find(".splitBtn, .e-treeview, .cubeTreeView, .cubeName, .searchDiv").remove():this.element.find(".splitBtn, .e-pivotgrid, .e-pivotchart, .e-treeview, .cubeTreeView, .cubeName, .searchDiv").remove();var h=t.buildTag("div#cubeTreeView.cubeTreeView")[0].outerHTML,c=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 5px"})[0].outerHTML,l=t.buildTag("div.cubeName",this.currentCubeName+c)[0].outerHTML;for(this.model.enableMeasureGroups&&this._createMeasureGroup(),o=n.parseJSON(f),n(h).appendTo(".cubeBrowser"),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:o},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:this.model.enableRTL,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},nodeDropped:t.proxy(this._nodeDropped,this),beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:this.model.enableMeasureGroups?"464px":""}),s=this.element.find(".cubeTreeView").find("li"),u=0;u<s.length;u++)s[u].setAttribute("tag",o[u].tag);this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView");this.element.find(".reportlist").ejDropDownList("option","change","");this.element.find(".reportlist").ejDropDownList("option","dataSource",reportList);this.element.find(".reportlist").ejDropDownList("option","value",reportList[0].name);n(this.element).find(".cubeBrowser").prepend(l);this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)});this.element.find(".cubeTable").height(this.element.height()-(this.element.find("div.titleText").height()+this.element.find("#reportToolbar").height()+this.element.find(".csHeader").height()+38));this.element.find(".cdbTD, .cubeTableTD").height(this.element.find(".cubeTable").height());this.element.find(".cubeBrowser").height(this.element.find(".cdbTD, .cubeTableTD").height()-this.element.find(".cdbHeader").height());this._renderControls();this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="CubeChange";this._trigger("renderSuccess",this);this._treeContextMenu();this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-this.element.find(".cubeName").height()-(7+(this.model.enableMeasureGroups?this.element.find(".measureGroupselector").height()+13:0)))},_createMeasureGroup:function(){this.element.find(".measureGroupselector").remove();n(this.element).find(".cubeBrowser").prepend("<div class ='measureGroupselector' style='margin:5px 5px 0px 5px'><input type='text' id='measureGroupSelector' class='measureGroupSelector' /><\/div>");this.element.find(".measureGroupSelector").ejDropDownList({dataSource:this.measureGroupInfo,enableRTL:this.model.enableRTL,fields:{text:"name",value:"name"},height:"25px",width:"100%",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}});this.element.find(".measureGroupSelector").attr("tabindex",0);measureDropTarget=this.element.find(".measureGroupSelector").data("ejDropDownList");measureDropTarget.selectItemByText(measureDropTarget.model.dataSource[0].name);this.element.find(".measureGroupSelector").ejDropDownList("option","change",t.proxy(this._measureGroupChanged,this))},_treeContextMenu:function(){var i=t.buildTag("ul.pivotTreeContext#pivotTreeContext",t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToColumn"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToRow"))[0].outerHTML)[0].outerHTML+t.buildTag("li",t.buildTag("a",this._getLocalizedLabels("AddToSlicer"))[0].outerHTML)[0].outerHTML+t.buildTag("li#Remove",t.buildTag("a",this._getLocalizedLabels("Remove"))[0].outerHTML)[0].outerHTML)[0].outerHTML;n(this.element).append(i);n("#pivotTreeContext").ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:this.element.find(".cubeTreeView")[0],click:t.proxy(this._onTreeContextClick,this),beforeOpen:t.proxy(this._onContextOpen,this),close:t.proxy(t.Pivot.closePreventPanel,this)})},_removeSplitButtonSuccess:function(n){n[0]!=i?(this.currentReport=n[0].Value,this.reports=n[1].Value,n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value)):n.d!=i?(this.currentReport=n.d[0].Value,this.reports=n.d[1].Value,n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value)):(this.currentReport=n.UpdatedReport,this.reports=n.ClientReports,n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject));this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"removeSplitButton",element:this.element,customObject:this.model.customObject});this._renderControls();this._unWireEvents();this._wireEvents();this._successAction="ButtonRemove";this._trigger("renderSuccess",this)},_chartTypeChangedSuccess:function(n){n[0]!=i?(this.currentReport=n[0].Value,this.reports=n[1].Value):n.d!=i?(this.currentReport=n.d[0].Value,this.reports=n.d[1].Value):(this.currentReport=n.CurrentReport,this.reports=n.ClientReports)},_mdxQuery:function(n){this.element.find(".e-dialog").hide();this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();n.d!=i?this._createDialog("mdx",n.d,""):this._createDialog("mdx",n,"")},_refreshReportList:function(){var t=n.map(this._clientReportCollection,function(n){if(n.reportName!=i)return{name:n.reportName}}),r=this.element.find(".reportlist").data("ejDropDownList");this.element.find(".reportlist").ejDropDownList("option","dataSource",t);r.selectItemByText(this.model.dataSource.reportName);this._unWireEvents();this._wireEvents()},_clientToolbarOperationSuccess:function(n){var t="",i;n!=null&&(i="",n&&n.d?(t=n.d[0].Value,t.indexOf(":>>:")>-1&&(this._currentReportItems=JSON.parse(t.split(":>>:")[1]),t=t.split(":>>:")[0]),i=JSON.parse(t)):n&&n.report&&(t=n.report,t.indexOf(":>>:")>-1&&(this._currentReportItems=JSON.parse(t.split(":>>:")[1]),t=t.split(":>>:")[0]),i=JSON.parse(t)),this.model.dataSource=i[0],this._clientReportCollection=i,this.model.dataSource?(this.refreshControl(this.model.dataSource),this._refreshReportList()):this._waitingPopup&&(this._isTimeOut=!1,this._waitingPopup.hide()))},_toolbarOperationSuccess:function(r){var o,s,h,u,a,p,v,y,e,w,d,b,l,f,g,nt,c,k;if(r!=null&&(r.d!=i&&r.d||r[0]!=i&&r[0]||r.CurrentReport||r.PivotReport)){if(r.length>1&&r[0]!=i)this.currentReport=r[0].Value,this.reports=r[1].Value,reportsCount=r[2].Value,o=r[3].Value,s=r[4].Value,h=r[5].Value,u=r[6].Value,e=n.parseJSON(r[7].Value),a=r[8].Value,p=n.parseJSON(r[9].Value),cubeTreeInfo=r[10].Value,v=r[11].Value,this.model.enableMeasureGroups&&r[12]!=null&&r[12]!=i&&(this.measureGroupInfo=r[12].Value),r[13]!=null&&r[13]!=i&&(this.model.customObject=r[13].Value);else if(r.d!=i){if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){u=n.grep(r.d,function(n){return n.Key=="CurrentAction"})[0].Value;this.setOlapReport(n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value);this.currentReport=n.parseJSON(this.getOlapReport()).Report;o=n.parseJSON(this.getOlapReport()).PivotColumns;s=n.parseJSON(this.getOlapReport()).PivotRows;h=n.parseJSON(this.getOlapReport()).Filters;u=="NewReport"?(this._clientReportCollection=[{name:this._currentReportName,report:this.currentReport}],this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value})):u=="AddReport"?(this._clientReportCollection.push({name:this._currentReportName,report:this.currentReport}),this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value})):(u=="RemoveReport"||u=="ChangeReport")&&(y=this._hiddenCellInfo(r.d),this.refreshControl({GridJSON:n.grep(r.d,function(n){return n.Key=="GridJSON"})[0].Value,ChartJSON:n.grep(r.d,function(n){return n.Key=="ChartJSON"})[0].Value,PivotReport:n.grep(r.d,function(n){return n.Key=="PivotReport"})[0].Value,FilteredColumnHeaders:y.columnArea.length>0?y.columnArea:"[]",FilteredRowHeaders:y.rowArea.length>0?y.rowArea:"[]"}));e=n.map(this._clientReportCollection,function(n){return{name:n.name}});this.element.find(".reportlist").ejDropDownList("option","dataSource",e);w=this.element.find(".reportlist").data("ejDropDownList");this._isReportListAction=!1;w.selectItemByText(this._currentReportName);this._isReportListAction=!0;return}this.currentReport=r.d[0].Value;this.reports=r.d[1].Value;reportsCount=r.d[2].Value;o=r.d[3].Value;s=r.d[4].Value;h=r.d[5].Value;u=r.d[6].Value;e=n.parseJSON(r.d[7].Value);a=r.d[8].Value;p=n.parseJSON(r.d[9].Value);cubeTreeInfo=r.d[10].Value;v=r.d[11].Value;this.model.enableMeasureGroups&&r.d[12]!=null&&r.d[12]!=i&&(this.measureGroupInfo=r.d[12].Value);r.d[13]!=null&&r.d[13]!=i&&(this.model.customObject=r.d[13].Value)}else{if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){u=r.CurrentAction;this.setOlapReport(r.PivotReport);this.currentReport=n.parseJSON(this.getOlapReport()).Report;o=n.parseJSON(this.getOlapReport()).PivotColumns;s=n.parseJSON(this.getOlapReport()).PivotRows;h=n.parseJSON(this.getOlapReport()).Filters;u=="NewReport"?(this._clientReportCollection=[{name:this._currentReportName,report:this.currentReport}],this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:r.PivotReport})):u=="AddReport"?(this._clientReportCollection.push({name:this._currentReportName,report:this.currentReport}),this.refreshControl({GridJSON:JSON.stringify(""),ChartJSON:JSON.stringify(""),PivotReport:r.PivotReport})):(u=="RemoveReport"||u=="ChangeReport")&&this.refreshControl({GridJSON:r.GridJSON,ChartJSON:r.ChartJSON,PivotReport:r.PivotReport,FilteredColumnHeaders:t.isNullOrUndefined(r.FilteredColumnHeaders)?"[]":r.FilteredColumnHeaders,FilteredRowHeaders:t.isNullOrUndefined(r.FilteredRowHeaders)?"[]":r.FilteredRowHeaders});e=n.map(this._clientReportCollection,function(n){return{name:n.name}});this.element.find(".reportlist").ejDropDownList("option","dataSource",e);w=this.element.find(".reportlist").data("ejDropDownList");this._isReportListAction=!1;w.selectItemByText(this._currentReportName);this._isReportListAction=!0;return}this.currentReport=r.CurrentReport;this.reports=r.Reports;reportsCount=r.ReportsCount;o=r.Columns;s=r.Rows;h=r.Slicers;u=r.CurrentAction;e=n.parseJSON(r.ReportList);a=r.RenamedReport;p=n.parseJSON(r.ControlSettings);cubeTreeInfo=r.CubeTreeInfo;v=r.CubeSelector;this.model.enableMeasureGroups&&(this.measureGroupInfo=n.parseJSON(r.MeasureGroups));r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject)}if(this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&(this.model.chartType=p.ChartType.toLowerCase()),this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:this.model.customObject}),u!="Report Change"){if(this.element.find(".reportlist").ejDropDownList("option","change",""),this.element.find(".reportlist").ejDropDownList("option","dataSource",e),u=="Load Report"){for(ddlTarget._initValue=!0,ddlTarget.selectItemByText(v),ddlTarget._initValue=!1,reportDropTarget.selectItemByText(reportDropTarget.model.dataSource[0].name),this._selectedReport=reportDropTarget.currentValue,this.element.find(".searchDiv").remove(),d=t.buildTag("div.searchDiv",t.buildTag("input#"+this._id+"_SearchTreeView.searchTreeView").attr("type","text")[0].outerHTML,{margin:"5px 5px 0px 0px"})[0].outerHTML,n(".cubeName").html(v+d),this.element.find("#"+this._id+"_SearchTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search"),maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:t.proxy(t.Pivot._searchTreeNodes,this)}),c=n.parseJSON(cubeTreeInfo),this.element.find(".cubeTreeView").ejTreeView({fields:{id:"id",parentId:"pid",text:"name",spriteCssClass:"spriteCssClass",dataSource:c},allowDragAndDrop:!0,allowDropChild:!1,allowDropSibling:!1,enableRTL:this.model.enableRTL,dragAndDropAcrossControl:!0,nodeDragStart:function(){isDragging=!0},nodeDropped:t.proxy(this._nodeDropped,this),beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:this.model.enableMeasureGroups?"464px":"495px"}),b=this.element.find(".cubeTreeView").find("li"),f=0;f<b.length;f++)b[f].setAttribute("tag",c[f].tag);for(l=this.element.find(".cubeTreeView .folderCDB"),f=0;f<l.length;f++)n(l[f].parentElement).removeClass("e-draggable");for(l=this.element.find(".cubeTreeViewCalcMember .folderCDB"),f=0;f<l.length;f++)n(l[f].parentElement).removeClass("e-draggable");this._cubeTreeView=this.element.find(".cubeTreeView").data("ejTreeView");this.model.isResponsive?this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(56+(this.model.enableMeasureGroups?35:0))):this.element.find(".cubeTreeView").height(this.element.find(".cubeBrowser").height()-(61+(this.model.enableMeasureGroups?30:0)))}else u!="Rename Report"?(this._isReportListAction=!1,reportDropTarget.selectItemByText(reportDropTarget.model.dataSource[e.length-1].name),this._isReportListAction=!0,this._selectedReport=reportDropTarget.currentValue):(this._excelFilterInfo.length>0&&(g=this.element.find(".cubeSelector").data("ejDropDownList").model.value,nt=this.element.find("#reportList").data("ejDropDownList").model.value,this._excelFilterInfo=n.grep(this._excelFilterInfo,function(n){return n.cubeName==g&&n.report==reportDropTarget.model.itemValue&&(n.report=a),n})),this._isReportListAction=!1,reportDropTarget.selectItemByText(a),this._isReportListAction=!0,this._selectedReport=reportDropTarget.currentValue);this.element.find(".reportlist").ejDropDownList("option","change",t.proxy(this._reportChanged,this))}u!="Rename Report"&&(this.model.enableDeferUpdate?this.element.find(".splitBtn").remove():this.element.find(".splitBtn, .e-pivotgrid, .e-pivotchart").remove());(u=="Add Report"||u=="New Report"||u=="Remove Report"||u=="Report Change"||u=="Load Report"||u=="SortOrFilter"||u=="Save Report")&&(c=n.parseJSON(cubeTreeInfo),k=t.DataManager(c).executeLocal(t.Query().where("spriteCssClass","contains","calcMemberGroupCDB")),this._cubeTreeView.model.beforeDelete=null,this._cubeTreeView.removeNode(this.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li")),this._cubeTreeView.model.beforeDelete=function(){return!1},t.isNullOrUndefined(this._calcMemberTreeObj)||this._calcMemberTreeObj.removeNode(this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li")),k.length>0&&!t.isNullOrUndefined(this._cubeTreeView)&&(this._calcMembers=[],this._calcMembers.push(k),n.merge(this._calcMembers,t.DataManager(c).executeLocal(t.Query().where("spriteCssClass","contains","calcMemberCDB"))),this._calcMemberTreeViewUpdate()));(u=="Remove Report"||u=="Report Change"||u=="Load Report"||u=="SortOrFilter"||u=="Save Report")&&(n(this._createSplitButtons(o,"Columns")).appendTo(".categoricalAxis"),n(this._createSplitButtons(s,"Rows")).appendTo(".rowAxis"),n(this._createSplitButtons(h,"Slicers")).appendTo(".slicerAxis"),this.element.find(".categoricalAxis, .rowAxis, .slicerAxis").find("button").ejButton({height:"20px",type:t.ButtonType.Button}),this._renderControls());(u=="Add Report"||u=="New Report")&&this._renderControls()}this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(this._treeContextMenu(),this._buttonContextMenu());this.model.showUniqueNameOnPivotButton&&(n(".pvtBtn").addClass("splitBtnUnique"),n(".removeSplitBtn").addClass("removeBtnUnqiue"));this._setSplitBtnTitle();this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide();this._successAction="ToolbarOperation";this._trigger("renderSuccess",this)},_calcMemberTreeViewUpdate:function(){var i,r,n;if(this._cubeTreeView.model.beforeDelete=null,this._cubeTreeView.removeNode(this.element.find(".cubeTreeView .calcMemberGroupCDB").parents("li")),this._cubeTreeView.model.beforeDelete=function(){return!1},t.isNullOrUndefined(this._calcMemberTreeObj)||this._calcMemberTreeObj.removeNode(this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parents("li")),this.element.find(".cubeTreeView").find("li").first().length>0?(this._cubeTreeView.insertBefore(this._calcMembers[0],this.element.find(".cubeTreeView").find("li").first()),this._cubeTreeView.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id),this.element.find(".cubeTreeView").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._cubeTreeView.collapseNode(this._calcMembers[0].id)):this._calcMembers.length>0&&(this._cubeTreeView.addNodes(this._calcMembers[0]),this.element.find(".cubeTreeView").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._cubeTreeView.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id)),!t.isNullOrUndefined(this._calcMemberTreeObj)&&this.element.find(".cubeTreeViewCalcMember").find("li").first().length>0?(this._calcMemberTreeObj.insertBefore(this._calcMembers[0],this.element.find(".cubeTreeViewCalcMember").find("li").first()),this._calcMemberTreeObj.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id),this.element.find(".cubeTreeViewCalcMember").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._calcMemberTreeObj.collapseNode(this._calcMembers[0].id)):!t.isNullOrUndefined(this._calcMemberTreeObj)&&this._calcMembers.length>0&&(this._calcMemberTreeObj.addNodes(this._calcMembers[0]),this.element.find(".cubeTreeViewCalcMember").find("#"+this._calcMembers[0].id).find("> div > div:first").removeClass("e-process"),this._calcMemberTreeObj.addNodes(t.DataManager(this._calcMembers).executeLocal(t.Query().skip(1)),this._calcMembers[0].id)),this.element.find(".cubeTreeView .calcMemberGroupCDB").length>0&&(this.element.find(".cubeTreeView .calcMemberGroupCDB").parent().removeClass("e-draggable"),this.element.find(".cubeTreeViewCalcMember .calcMemberGroupCDB").parent().removeClass("e-draggable"),i=this.element.find(".cubeTreeView .calcMemberCDB").parents("li").find("li"),r=this.element.find(".cubeTreeViewCalcMember .calcMemberCDB").parents("li").find("li"),i.length>0))for(n=0;n<i.length;n++)i[n].setAttribute("tag",this._calcMembers[n+1].tag),i[n].setAttribute("expression",this._calcMembers[n+1].expression),i[n].setAttribute("formatString",this._calcMembers[n+1].formatString),i[n].setAttribute("nodeType",this._calcMembers[n+1].nodeType),r.length>0&&(r[n].setAttribute("tag",this._calcMembers[n+1].tag),r[n].setAttribute("expression",this._calcMembers[n+1].expression),r[n].setAttribute("formatString",this._calcMembers[n+1].formatString),r[n].setAttribute("nodeType",this._calcMembers[n+1].nodeType))},_fetchChildNodeSuccess:function(r){var u,f,e;u=r.length>1&&r[0]!=i?JSON.parse(r[0].Value):r.d!=i?JSON.parse(r.d[0].Value):JSON.parse(r.ChildNodes);r[0]!=i?r[2]!=null&&r[2]!=i&&(this.model.customObject=r[2].Value):r.d!=i?r.d[2]!=null&&r.d[2]!=i&&(this.model.customObject=r.d[2].Value):r.customObject!=null&&r.customObject!=i&&(this.model.customObject=r.customObject);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});e={id:"id",parentId:"pid",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus"};f=n(this.pNode).parents("li").length>1?n(this.pNode).parents("li").first():n(this.pNode).parents("li");n(n(f).find("input.nodecheckbox")[0]).ejCheckBox({checked:!1});u.length>0&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&this.model.enableMemberEditorPaging&&!t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",u[0].pid)).length>0&&n.merge(this._editorTreeData,u);this.element.find(".nodeExpand").remove();this._memberTreeObj.addNode(u,f);n.each(n(f).children().find("li"),function(n,t){t.setAttribute("tag",u[n].tag)});this._successAction="FetchChildNode";this._trigger("renderSuccess",this);this.element.find(".e-dialog #preventDiv").remove()},_createCubeSelector:function(){return t.buildTag("div.csHeader",t.buildTag("span.cubeText",this._getLocalizedLabels("CubeSelector"),{"padding-left":"6px",float:"left","margin-bottom":"10px",width:this.model.enableSplitter&&!this.model.isResponsive?"25%":"","text-overflow":"ellipsis"})[0].outerHTML+t.buildTag("div.cubeSelect","<input type='text' id='cubeSelector' class ='cubeSelector' />",{display:"inline",float:"left","padding-left":"5px",position:"relative",top:"-3px",width:this.model.enableSplitter&&!this.model.isResponsive?"70%":""})[0].outerHTML,{width:this.model.isResponsive||this.model.enableSplitter?"100%":"",height:"20px"})[0].outerHTML},_createCubeBrowser:function(){return t.buildTag("div.cdbHeader",t.buildTag("span",this._getLocalizedLabels("CubeDimensionBrowser"))[0].outerHTML,{width:this.model.enableSplitter?"100%":"",height:"30px"})[0].outerHTML+t.buildTag("div.cubeBrowser",t.buildTag("div.cubeTreeView.visibleHide")[0].outerHTML,{width:this.model.enableSplitter?"100%":""})[0].outerHTML},_createAxisElementBuilder:function(n,i,r){var u;return this.model.enableSplitter?t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Column"))[0].outerHTML,{height:"30px",width:"99%"})[0].outerHTML+t.buildTag("div.categoricalAxis",t.buildTag("p#categcol","colum",{display:"none"})[0].outerHTML+this._createSplitButtons(n,"Columns"),{width:this.model.isResponsive||this.model.enableSplitter?"99%":""}).attr("aria-describedby","categcol")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Row"))[0].outerHTML,{height:"30px",width:"99%"})[0].outerHTML+t.buildTag("div.rowAxis",t.buildTag("p#categrow","row",{display:"none"})[0].outerHTML+this._createSplitButtons(i,"Rows"),{width:this.model.isResponsive||this.model.enableSplitter?"99%":""}).attr("aria-describedby","categrow")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Slicer"))[0].outerHTML,{height:"30px",width:"99%"})[0].outerHTML+t.buildTag("div.slicerAxis",t.buildTag("p#sliceaxis","slicer",{display:"none"})[0].outerHTML+this._createSplitButtons(r,"Slicers"),{width:this.model.isResponsive||this.model.enableSplitter?"99%":""}).attr("aria-describedby","sliceaxis")[0].outerHTML:t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Column"))[0].outerHTML,{height:"30px"})[0].outerHTML+t.buildTag("div.categoricalAxis",t.buildTag("p#categcol","colum",{display:"none"})[0].outerHTML+this._createSplitButtons(n,"Columns"),{width:this.model.isResponsive?"99%":""}).attr("aria-describedby","categcol")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Row"))[0].outerHTML,{height:"30px"})[0].outerHTML+t.buildTag("div.rowAxis",t.buildTag("p#categrow","row",{display:"none"})[0].outerHTML+this._createSplitButtons(i,"Rows"),{width:this.model.isResponsive?"99%":""}).attr("aria-describedby","categrow")[0].outerHTML+t.buildTag("div.axisHeader",t.buildTag("span",this._getLocalizedLabels("Slicer"))[0].outerHTML,{height:"30px"})[0].outerHTML+t.buildTag("div.slicerAxis",t.buildTag("p#sliceaxis","slicer",{display:"none"})[0].outerHTML+this._createSplitButtons(r,"Slicers"),{width:this.model.isResponsive?"99%":""}).attr("aria-describedby","sliceaxis")[0].outerHTML},_createSplitButtons:function(n,r){var s="",e="",u,o,f;if(n.indexOf("~")>-1)for(u=0;u<n.split("~")[0].split("#").length-1;u++)e=n.split("~")[0].split("#")[u+1].split(".")[0],e=="Measures"?e=this._getLocalizedLabels("Measures"):n.startsWith("#Measure")?n.indexOf("#Measure")>-1&&(e=n.split("~")[u+1]):e=n.split("~")[u+2],e==i&&(e=n.split("~")[u+1]),s+=t.buildTag("div.splitBtn",t.buildTag("button.pvtBtn",e).attr({title:n.split("~")[0].split("#")[u+1].replace("."," - ").split("$")[0],fieldCaption:e,allMember:n.split("~")[0].split("#")[u+1].replace("."," - ").split("$")[1]})[0].outerHTML+t.buildTag("span.removeSplitBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML,"",{tag:r+":"+n.split("~")[0].split("#")[u+1].split("$")[0]})[0].outerHTML;else for(u=0;u<n.split("#").length-1;u++)n.split("#")[u+1].split("::")[1]=="CalculatedMember"?(f=n.split("#")[u+1].split("::")[0],o=f.split(".")[f.split(".").length-1],f=f.replace("."," - ")):(o=n.split("#")[u+1].split(".")[0]=="Measures"?this._getLocalizedLabels("Measures"):n.split("#")[u+1].split(".")[0],o.split("::")[1]=="NAMEDSET"&&(o=o.split("::")[0]),f=n.split("#")[u+1].replace("."," - ").split("$")[0]=="Measures"?this._getLocalizedLabels("Measures"):n.split("#")[u+1].replace("."," - ").split("$")[0]),this.model.enableRTL&&f.indexOf("-")>0&&(f=f.split("-").reverse().join(" - ")),s+=t.buildTag("div.splitBtn",t.buildTag("button.pvtBtn",this.model.showUniqueNameOnPivotButton?f:o).attr({title:f,fieldCaption:o,allMember:n.split("#")[u+1].split("$")[1]})[0].outerHTML+t.buildTag("span.removeSplitBtn e-icon").attr("role","button").attr("aria-label","remove")[0].outerHTML,"",{tag:r+":"+n.split("#")[u+1].split("$")[0]})[0].outerHTML;return s},_setSplitBtnTitle:function(){for(var f,r,o,e,h,i=this.element.find(".splitBtn"),t=0;t<i.length;t++){var s=n(i[t]).attr("tag").split(":")[1].split("."),u="";for(f=0;f<s.length;f++)u+=s[0].toUpperCase()!="[Measures]"?"["+s[f]+"]"+(f%2==0?".":""):s[f]+(f%2==0?".":"");this.element.find(".cubeTreeView").length>0&&!(u.indexOf("Measures")>=0)&&(u=u.indexOf("<>")>0?u.replace("<>","."):u,r="",o=n(i[t]).find("button").attr("allMember"),o=o!="All"?o:this._getLocalizedLabels("All"),e=this.element.find(".cubeTreeView").find("li[tag='"+u+"'] a:eq(0)").text(),e==""&&(e=this.element.find(".cubeTreeView").find("li[tag='["+s[1]+"]'] a:eq(0)").text()),e.indexOf(".")>0?n(i[t]).find("button").attr("title",this.model.enableRTL?e.split(".").reverse().join(" - "):e.replace("."," - ")):(r=n(i[t]).find("button").attr("fieldCaption")+" - "+(this.element.find(".cubeTreeView").find("li[tag='"+u+"'] a:eq(0)").text()||this.element.find(".cubeTreeView").find("li[tag='"+u.toUpperCase()+"'] a:eq(0)").text()||e),r=this.model.enableRTL&&r.indexOf("-")>0?r.split("-").reverse().join(" - "):r,n(i[t]).find("button").attr("title",r)),n(i[t]).attr("tag").split(":")[0]=="Slicers"&&n(i[t]).attr("tag").indexOf("::CalculatedMember")<0&&(r=n(i[t]).attr("tag").split(":")[1],h=(this._fieldSelectedMembers[r]=="All"?o:this._fieldSelectedMembers[r])||o,n(i[t]).find("button").text((this.model.showUniqueNameOnPivotButton?n(i[t]).find("button").parent().attr("tag").split(":")[1].replace("."," - "):n(i[t]).find("button").attr("fieldCaption"))+" ("+h+")"),n(i[t]).find("button").attr("title",n(i[t]).find("button").attr("title")+" ("+h+")")))}},_controlPanel:function(){var f,n,i;if(this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly&&(n=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar?"":"auto",left:"5px",top:"5px",width:this.model.isResponsive||this.model.enableSplitter?"100%":""})[0].outerHTML,{width:"auto",height:"auto"})[0].outerHTML:t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"10px 0px 7px":"10px 7px 7px",padding:"1px",width:this.model.isResponsive&&!this.model.enableSplitter?"auto":this.model.enableSplitter?"100%":""})[0].outerHTML,{position:"relative",left:"7px","border-top":"none","margin-top":"-7px",overflow:this.model.enableToolBar?"":"auto",height:this.model.enablePaging?"277px":"",width:this.model.isResponsive?"100%":""})[0].outerHTML,{width:"auto",height:"auto"})[0].outerHTML:this.displayMode()==t.PivotClient.DisplayMode.GridOnly?t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,{overflow:this.model.enableToolBar?"":"auto",position:"absolute",left:"7px","padding-top":"2px",width:this.model.isResponsive||this.model.enableSplitter?"100%":"",top:"3px"})[0].outerHTML,{width:"auto",height:"auto"})[0].outerHTML:t.buildTag("div#gridPanel.gridPanel",t.buildTag("div.gridContainer",t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,{overflow:this.model.enableToolBar?"":"auto",position:"relative",width:this.model.isResponsive||this.model.enableSplitter?"100%":"",left:window.navigator.userAgent.indexOf("Trident")>0?this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.model.enableRTL?"15px":"0px":this.model.enableRTL?"5px":"7px":this.model.enableRTL?"5px":"7px","padding-top":"5px","border-top":"none"})[0].outerHTML,{width:"100%",height:"auto"})[0].outerHTML),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(i=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?this.defaultView()==t.PivotClient.DefaultView.Grid?t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{overflow:this.model.enableToolBar||this.model.isResponsive?"":"auto",border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter?"":"auto",left:"-2px",padding:this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px",width:this.model.isResponsive||this.model.enableSplitter?"98%":"","border-top":"none","margin-right":"-11px"})[0].outerHTML,{width:"98%",height:"auto"})[0].outerHTML:t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{"min-height":this.model.enablePaging?"255px":"",border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter||this.model.isResponsive?"":"auto",padding:this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px",width:this.model.isResponsive||this.model.enableSplitter?"98%":""})[0].outerHTML,{width:"98%",height:"auto"})[0].outerHTML:this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter||this.model.isResponsive?"":"auto",padding:this.model.enableRTL?"5px 25px 2px 6px":this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px","margin-right":this.model.enableRTL?"1px":"-11px"})[0].outerHTML,{width:"98%",height:"auto"})[0].outerHTML:t.buildTag("div#chartPanel.chartPanel",t.buildTag("div.chartContainer",t.buildTag("div#"+this._id+"_PivotChart","",{border:this.model.enableToolBar?"none":""})[0].outerHTML,{position:"relative",overflow:this.model.enableToolBar||this.model.enableSplitter||this.model.isResponsive?"":"auto",top:"-5px",left:window.navigator.userAgent.indexOf("Trident")>0?"-7px":"0px",padding:this.model.enableRTL?"5px 5px 0px 5px":this.model.enableToolBar?"5px 0px 5px 0px":"5px 0px 5px 5px","border-top":"none","margin-right":this.model.enableRTL?"0px":"-11px","margin-left":this.model.enableRTL?"-11px":"0px"})[0].outerHTML,{width:this.model.enableSplitter?"99%":"98%",height:"auto"})[0].outerHTML),this.controlPlacement()==t.PivotClient.ControlPlacement.Tab&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid){var r,e,s="<a style='font: bold 12px Segoe UI' href='#gridPanel' tabindex='0'>"+this._getLocalizedLabels("Grid")+"<\/a>",h="<a style='font: bold 12px Segoe UI' href='#chartPanel' tabindex='0'>"+this._getLocalizedLabels("Chart")+"<\/a>",u=window.navigator.userAgent.indexOf("Trident")>0?this.model.analysisMode==t.Pivot.AnalysisMode.Olap&&this.model.operationalMode==t.Pivot.OperationalMode.ServerMode?this.model.enableRTL?"15px":"7px":this.model.enableRTL?"5px":"7px":this.model.enableRTL?"5px":"7px",o=0;this.model.enableRTL&&(o="-"+u,u=0);this.defaultView()==t.PivotClient.DefaultView.Chart?(r=t.buildTag("ul.clientTab",t.buildTag("li",h)[0].outerHTML+t.buildTag("li",s)[0].outerHTML,{"margin-left":u,"margin-right":o})[0].outerHTML,e=t.buildTag("div#clientTab",r+i+n)[0].outerHTML):(r=t.buildTag("ul.clientTab",t.buildTag("li",s)[0].outerHTML+t.buildTag("li",h)[0].outerHTML,{"margin-left":u,"margin-right":o})[0].outerHTML,e=t.buildTag("div#clientTab",r+n+i,{height:"100%"})[0].outerHTML);f=e}else f=this._createControlContainer(this.controlPlacement(),i,n);return t.buildTag("div.controlPanel",f,{width:this.model.isResponsive?"100%":this.model.displaySettings.controlPlacement=="tab"?this.model.analysisMode=="olap"&&this.model.operationalMode=="servermode"||!this.model.enableSplitter?"":"100%":"auto",top:this.model.displaySettings.mode==t.PivotClient.DisplayMode.GridOnly?"3px":"none","margin-bottom":this.model.displaySettings.controlPlacement==t.PivotClient.ControlPlacement.Tile&&(this.model.enablePaging||this.model.enableVirtualScrolling)?"5px":"0"})[0].outerHTML+(this.model.enablePaging?t.buildTag("div#"+this._id+"_Pager")[0].outerHTML:this.model.enableVirtualScrolling?t.buildTag("div#hsVirtualScrolling.hsVirtualScrolling",t.buildTag("div.hScrollPanel")[0].outerHTML,{width:"10px"})[0].outerHTML:"")},_createControlContainer:function(n,i,r){return this.displayMode()==t.PivotClient.DisplayMode.ChartOnly?"<table style='width:100%'><tr><td>"+i+"<\/td><\/tr><\/table>":this.displayMode()==t.PivotClient.DisplayMode.GridOnly?"<table style='width:100%'><tr><td>"+r+"<\/td><\/tr><\/table>":this.controlPlacement()==t.PivotClient.ControlPlacement.Tile?this.defaultView()==t.PivotClient.DefaultView.Chart?"<table style='width:100%'><tr><td>"+i+"<\/td><\/tr><tr><td>"+r+"<\/td><\/tr><\/table>":"<table style='width:100%'><tr><td>"+r+"<\/td><\/tr><tr><td>"+i+"<\/td><\/tr><\/table>":this.defaultView()==t.PivotClient.DefaultView.Chart?"<table style='width:100%'><tr><td valign='top'>"+i+"<\/td><td valign='top'>"+r+"<\/td><\/tr><\/table>":"<table style='width:100%'><tr><td valign='top'>"+r+"<\/td><td valign='top'>"+i+"<\/td><\/tr><\/table>"},_renderPivotGrid:function(r){var f,u;if(r=t.isNullOrUndefined(r)?"":r,this.element.find(".e-dialog").hide(),this.displayMode()!=t.PivotClient.DisplayMode.ChartOnly)if(this._pivotChart!=i&&this._pivotChart._startDrilldown){try{u=JSON.parse(this._pivotGrid.getOlapReport()).Report}catch(e){u=this._pivotGrid.getOlapReport()}this._pivotGrid.doAjaxPost("POST",this.model.url+"/"+this._pivotGrid.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillDownGrid",cellPosition:"",currentReport:u,clientReports:this.reports,headerInfo:r,layout:this.gridLayout(),enableRTL:this.model.enableRTL}),this._pivotGrid._drillDownSuccess)}else this.model.enableDeferUpdate?(this._isTimeOut=!1,this._waitingPopup.hide()):(this.element.find(".e-pivotgrid, #"+this._id+"_PivotGrid").remove(),f=this.controlPlacement()==t.PivotClient.ControlPlacement.Tile&&this.displayMode()==t.PivotClient.DisplayMode.ChartAndGrid?t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",width:this.model.isResponsive?"auto":" ",padding:"1px"})[0].outerHTML:t.buildTag("div#"+this._id+"_PivotGrid","",{margin:this.model.enableToolBar?"5px 0px 7px":"5px 7px 7px",padding:"1px"})[0].outerHTML,n(f).appendTo(this.element.find(".gridContainer")),this.gridLayout()!=t.PivotGrid.Layout.Normal?this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,isResponsive:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),layout:this.gridLayout(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}):this.element.find("#"+this._id+"_PivotGrid").ejPivotGrid({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,isResponsive:this.model.isResponsive,currentReport:this.currentReport,locale:this.locale(),drillSuccess:t.proxy(this._gridDrillSuccess,this)}),this._pivotGrid=this.element.find("#"+this._id+"_PivotGrid").data("ejPivotGrid"))},_renderPivotChart:function(r,u){var f,e;this.element.find(".e-dialog").hide();this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotGrid!=i&&this._pivotGrid._startDrilldown?(f=this._pivotChart.getOlapReport(),this._pivotChart.doAjaxPost("POST",this.model.url+"/"+this._pivotChart.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._pivotChart.model.enableMultiLevelLabels?u+"#fullchart":u,drilledSeries:r,olapReport:f,clientReports:this.reports}),this._pivotChart.renderControlSuccess)):this.model.enableDeferUpdate?(this._isTimeOut=!1,this._waitingPopup.hide()):(this.element.find(".e-pivotchart").remove(),e=t.buildTag("div#"+this._id+"_PivotChart","",{height:"auto"})[0].outerHTML,this.element.find(".chartContainer").children().length==0&&n(e).appendTo(this.element.find(".chartContainer")),this.element.find("#"+this._id+"_PivotChart").ejPivotChart({url:this.model.url,customObject:this.model.customObject,enableRTL:this.model.enableRTL,canResize:this.model.isResponsive,currentReport:this.currentReport,customObject:this.model.customObject,locale:this.locale(),showTooltip:!0,size:{height:this._chartHeight,width:this._chartWidth},commonSeriesOptions:{type:this.model.chartType,tooltip:{visible:!0}},beforeServiceInvoke:this.model.chartLoad,drillSuccess:t.proxy(this._chartDrillSuccess,this)}),this._pivotChart=this.element.find("#"+this._id+"_PivotChart").data("ejPivotChart"),this.element.find("#"+this._id+"_PivotChart").width(this._pivotChart.model.size.width)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&this._toggleExpand&&!this.model.isResponsive&&this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"&&this.element.find(".toggleExpandButton").click()},_renderPivotTreeMap:function(r,u){var f,e;this.element.find(".e-dialog").hide();this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._pivotGrid!=i&&this._pivotGrid._startDrilldown?(f=this.otreemapObj.getOlapReport(),this.otreemapObj.doAjaxPost("POST",this.model.url+"/"+this.otreemapObj.model.serviceMethodSettings.drillDown,JSON.stringify({action:u,drillInfo:r,olapReport:f,clientReports:this.reports}),this.otreemapObj.renderControlSuccess),t.isNullOrUndefined(this.chartObj)||(this.model.displaySettings.enableFullScreen||this.enableTogglePanel()&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap")&&(n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"}),this.otreemapObj._treeMap.refresh())):this.model.enableDeferUpdate?(this._isTimeOut=!1,this._waitingPopup.hide()):(this.element.find(".e-pivottreemap").remove(),e=t.buildTag("div#"+this._id+"_PivotChart","",{height:"auto"})[0].outerHTML,this.element.find(".chartContainer").children().length==0&&n(e).appendTo(this.element.find(".chartContainer")),this.element.find("#"+this._id+"_PivotChart").ejPivotTreeMap({url:this.model.url,customObject:this.model.customObject,canResize:this.model.isResponsive,currentReport:this.currentReport,customObject:this.model.customObject,locale:this.locale(),size:{height:this._chartHeight,width:this._chartWidth},beforeServiceInvoke:this.model.treeMapLoad,drillSuccess:t.proxy(this._treemapDrillSuccess,this)}),this.otreemapObj=this.element.find("#"+this._id+"_PivotChart").data("ejPivotTreeMap"),this.element.find("#"+this._id+"_PivotChart").width(this.otreemapObj.model.size.width)));this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&this._toggleExpand&&!this.model.isResponsive&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"&&this.element.find(".toggleExpandButton").click()},_renderControls:function(){(this._isNodeOrButtonDropped&&t.isNullOrUndefined(this.chartObj)||this._isrenderTreeMap)&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this._isNodeOrButtonDropped=!1,this._isrenderTreeMap=!1,this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this.displayMode()==t.PivotClient.DisplayMode.GridOnly?this.defaultView()==t.PivotClient.DefaultView.Chart?(this._renderPivotChart(),this._renderPivotGrid()):(this._renderPivotGrid(),this._renderPivotChart()):this.defaultView()==t.PivotClient.DefaultView.Chart?(t.isNullOrUndefined(this.chartObj)?this.element.find("#"+this._pivotChart._id+"Container").length>0?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap():this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap(),this._renderPivotGrid()):(this._renderPivotGrid(),t.isNullOrUndefined(this.chartObj)?this.element.find("#"+this._pivotChart._id+"Container").length>0?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap():this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap"?this._renderPivotChart():this.model.enablePivotTreeMap&&this._renderPivotTreeMap())},_createDialogRequest:function(r){var u,c,s,h,e,f,o;if(!(r.target.className.indexOf("dialogOKBtn")>=0)){if(r.target.type=="button"&&n(r.target).parent().attr("tag").indexOf("::CalculatedMember")>-1){if(this._selectedCalcMember=n(r.target).parent().text(),this.element.find(".calcMemberDialog").length>0){if(this._calcMemberTreeObj.collapseAll(),t.Pivot.closePreventPanel(this),this._calcMemberDialog.open(),u=t.DataManager(this._calcMembers).executeLocal(t.Query().where("name","equal",this._selectedCalcMember)),u.length>0){if(this.element.find("#"+this._id+"_captionFieldCM").val(u[0].name),this.element.find("#"+this._id+"_expressionFieldCM").val(u[0].expression),this.element.find("#"+this._id+"_memberTypeFieldCM").data("ejDropDownList").selectItemsByIndices(u[0].nodeType),u[0].nodeType==1)for(c=u[0].tag.split(".")[0].replace(/\[/g,"").replace(/\]/g,""),s=this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").model.dataSource,f=0;f<s.length;f++)s[f].value==c&&this.element.find("#"+this._id+"_dimensionFieldCM").data("ejDropDownList").selectItemsByIndices(f);t.isNullOrUndefined(u[0].formatString)||(u[0].formatString=="Currency"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(1):u[0].formatString=="Percent"?this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2):(this.element.find("#"+this._id+"_formatFieldCM").data("ejDropDownList").selectItemsByIndices(2),this.element.find("#"+this._id+"_customFormatFieldCM").val(u[0].formatString)))}}else this._waitingPopup.show(),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"fetchCalcMemberTreeView",element:this.element,customObject:this.model.customObject}),o=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchCalcMemberTreeView",dimensionName:"calcMember",olapReport:this.currentReport,customObject:o}),t.proxy(t.Pivot._createCalcMemberDialog,this));return}if(this.model.enableMemberEditorPaging&&(this._memberPageSettings.startPage=0,this._memberPageSettings.currentMemeberPage=1,this._selectedFieldName=n(r.target).parent().attr("tag"),this._memberPageSettings.filterReportCollection={}),pivotClientObj=this,args_className=r.target.className,args_innerHTML=r.target.innerHTML==""?"ToolbarButtons":r.target.innerHTML,this._dialogTitle=hierarchyCaption=t.browserInfo().name=="msie"&&t.browserInfo().version<=8?n(r.currentTarget)[0].title:r.currentTarget.attributes==""?"":n(r.currentTarget).attr("title")||n(r.currentTarget).attr("aria-label"),this._currentItem=hierarchyCaption,this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove(),args_innerHTML!="ToolbarButtons"&&args_innerHTML!=i&&this.model.analysisMode==t.Pivot.AnalysisMode.Olap){if(n(r.target).parent().attr("tag").indexOf(":")>=0&&n(r.target).parent().attr("tag").split(":")[1].indexOf(".")>=0)if(h=n(r.target).parent().attr("tag").split(":")[1].split("."),e=this.element.find(".cubeTreeView li[tag^='["+h[0]+"'][tag$='"+h[1]+"]']"),e.length>0){for(f=0;f<e.length;f++)if(n(e[f]).attr("tag").split("].").length==2){this._selectedFieldName=n(e[f]).attr("tag");break}}else this._selectedFieldName=e.attr("tag");else this._selectedFieldName="";pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"fetchMemberTreeNodes",element:this.element,customObject:this.model.customObject});o=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.fetchMemberTreeNodes,JSON.stringify({action:"fetchMemberTreeNodes",dimensionName:n(r.target).parent().attr("Tag"),olapReport:this.currentReport,customObject:o}),this._editorTreeInfoSuccess)}else this._createDialog(args_className,args_innerHTML,"")}},_fetchReportListSuccess:function(n){var r="";n[0]!=i?n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value):n.d!=i?n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value):n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject);this.model.afterServiceInvoke!=null&&this._trigger("afterServiceInvoke",{action:"fetchReportList",element:this.element,customObject:this.model.customObject,reports:n});this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();n[0]!=i?(r=t.isNullOrUndefined(n[1].Value)?"":n[1].Value,n=t.isNullOrUndefined(n[0].Value)?"":n[0].Value):n.d!=i?(r=t.isNullOrUndefined(n.d[1].Value)?"":n.d[1].Value,n=t.isNullOrUndefined(n.d[0].Value)?"":n.d[0].Value):(r=n.action,n=n.ReportNameList);n==""?(t.Pivot._createErrorDialog(this._getLocalizedLabels("NoReports"),"Error",this),this._isTimeOut=!1):this._createDialog(r,n,"")},_fetchSortState:function(n){this._isTimeOut=!1;this._waitingPopup.hide();n[0]!=i?this._createDialog("SortFilterDlg",n[0].Value,""):n.d!=i?this._createDialog("SortFilterDlg",n.d[0].Value,""):this._createDialog("SortFilterDlg",n.FetchSortState,"")},_createDialog:function(r,u,f){var y=!1,nt,p,at,ut,ft,e,o,s,yt,pt,wt,bt,kt,dt,gt,l,b,ni,ti,et,ot,st,ii,ri,fi,ct,lt,tt,ei,k,d,g,rt,hi,a;if(t.Pivot.openPreventPanel(this),this.model.operationalMode==t.Pivot.OperationalMode.ServerMode&&(r=="SortFilterDlg"||r=="mdx")){if(nt=this.element.find(".splitBtn"),p=jQuery.grep(nt,function(t){return n(t).attr("tag").split(":")[1]=="Measures"}).length,at=jQuery.grep(nt,function(t){return n(t).attr("tag").split(":")[1]!="Measures"&&n(t).attr("tag").split(":")[0]=="Rows"}).length,ut=jQuery.grep(nt,function(t){return n(t).attr("tag").split(":")[1]!="Measures"&&n(t).attr("tag").split(":")[0]=="Columns"}).length,r=="mdx"&&p==0&&ut==0)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MDXAlertMsg"),"Error",this),!1;if(p>0&&this.element.find(".categoricalAxis ")[0].childElementCount!=0){if(!at&&document.activeElement.className.indexOf("rowSortFilterImg")>-1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortRowAlertMsg"),"Error",this),!1;if(!ut&&document.activeElement.className.indexOf("colSortFilterImg")>-1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortColumnAlertMsg"),"Error",this),!1}else if(r!="mdx")return p||this._axis!="Column"?p||this._axis!="Row"?n(".categoricalAxis ")[0].childElementCount||t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortElementAlertMsg"),"Error",this):t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortrowMeasureAlertMsg"),"Error",this):t.Pivot._createErrorDialog(this._getLocalizedLabels("FilterSortcolMeasureAlertMsg"),"Error",this),!1}this.model.analysisMode!=t.Pivot.AnalysisMode.Olap||t.isNullOrUndefined(this._selectedFieldName)||(y=this.element.find(".pvtBtn").parent("[tag='Slicers:"+this._selectedFieldName.replace(/\[/g,"").replace(/\]/g,"")+"']").length>0);var w="",v="",h="",vt=[],c;if(c=f[0]!=i?f[0].Value:f.d!=i?f.d[0].Value:f.EditorTreeInfo,ft=t.buildTag("div#"+(this.model.enableAdvancedFilter?"clientDialog":this._id+"_ClientDialog")+".clientDialog",{opacity:"1"})[0].outerHTML,r.split(" ")[0]=="newReportImg")o=this._getLocalizedLabels("NewReport"),s="New Report",pt="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",wt="<input type=text id=reportName class='reportName'/><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+pt+"<\/td><td>"+wt+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="addReportImg")o=this._getLocalizedLabels("AddReport"),s="Add Report",bt="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",kt="<input type=text id=reportName class='reportName'/><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+bt+"<\/td><td>"+kt+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="removeReportImg")o=this._getLocalizedLabels("RemoveReport"),s="Remove Report",(this.model.operationalMode==t.Pivot.OperationalMode.ClientMode||this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)&&(reportsCount=this._clientReportCollection.length),e=reportsCount>1?"<p>"+this._getLocalizedLabels("AreYouSureToDeleteTheReport")+"?<\/p>":"<p>"+this._getLocalizedLabels("CannotRemoveSingleReport")+"!<\/p>";else if(r.split(" ")[0]=="SortFilterDlg"){w=u.split("||");w[1]!=""&&(v=w[1].split("<<"));w[2]!=""&&(h=w[2].split("<<"));this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog), .clientDialog").remove();o=this._getLocalizedLabels("SortingAndFiltering");var ci=t.buildTag("label#sortingLbl.sortingLbl",this._getLocalizedLabels("Sorting"))[0].outerHTML,li=t.buildTag("label#measureListLbl.measureListLbl",this._getLocalizedLabels("Measure"))[0].outerHTML,ai=t.buildTag("label#orderLbl.orderLbl",this._getLocalizedLabels("Order"))[0].outerHTML,vi=t.buildTag("input#measuresList.measuresList","",{},{type:"text",accesskey:"M"})[0].outerHTML,yi=t.buildTag("input#sortDisable.sortDisable","",{},{name:"sort",type:"radio",checked:"checked",role:"radio",tabindex:0,accesskey:"i"})[0].outerHTML+t.buildTag("label.sortDisableLbl",this._getLocalizedLabels("Disable"))[0].outerHTML,pi=t.buildTag("input#sortEnable.sortEnable","",{},{name:"sort",type:"radio",role:"radio",tabindex:1,accesskey:"n"})[0].outerHTML+t.buildTag("label.sortEnableLbl",this._getLocalizedLabels("Enable"))[0].outerHTML+"<br/>",wi=t.buildTag("input#radioBtnAsc.radioBtnAsc","",{},{name:"order",type:"radio",checked:"checked",role:"radio",tabindex:0,accesskey:"A"})[0].outerHTML+t.buildTag("label.radioBtnAscLbl",this._getLocalizedLabels("Ascending"))[0].outerHTML+"<br/>",bi=t.buildTag("input#radioBtnDesc.radioBtnDesc","",{},{name:"order",type:"radio",role:"radio",tabindex:2,accesskey:"e"})[0].outerHTML+t.buildTag("label.radioBtnDescLbl",this._getLocalizedLabels("Descending"))[0].outerHTML,ki=t.buildTag("input#preserveHrchy.preserveHrchy","",{},{type:"checkbox",checked:"checked",tabindex:0,role:"radio",accesskey:"r"})[0].outerHTML+t.buildTag("label.preserveHrchyLbl",this._getLocalizedLabels("PreserveHierarchy"))[0].outerHTML,di=t.buildTag("label#filterLbl.filterLbl",this._getLocalizedLabels("Filtering"))[0].outerHTML,gi=t.buildTag("input#filterDisable.filterDisable","",{},{name:"filter",type:"radio",checked:"checked",role:"radio",tabindex:0,accesskey:"i"})[0].outerHTML+t.buildTag("label.filterDisableLbl",this._getLocalizedLabels("Disable"))[0].outerHTML,nr=t.buildTag("input#filterEnable.filterEnable","",{},{name:"filter",type:"radio",role:"radio",tabindex:0,accesskey:"n"})[0].outerHTML+t.buildTag("label.filterDisableLbl",this._getLocalizedLabels("Enable"))[0].outerHTML+"<br/>",tr=t.buildTag("label#conditionLbl.conditionLbl",this._getLocalizedLabels("Condition"))[0].outerHTML,ir=t.buildTag("input#filterCondition.filterCondition","",{},{type:"text",tabindex:0,accesskey:"o"})[0].outerHTML,rr=t.buildTag("div#filterfrom.filterFrmDiv",t.buildTag("input#filterFrom.filterFrom","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:0})[0].outerHTML)[0].outerHTML,ur=t.buildTag("div#filterbtw.filterBtw","<p>"+this._getLocalizedLabels("and")+"<\/p>")[0].outerHTML,fr=t.buildTag("div#filterto.filterToDiv",t.buildTag("input#filterTo.filterTo","",{},{name:"inputVal",type:t.isMobile()?"number":"text",inputmode:t.isMobile()?"numeric":"",pattern:t.isMobile()?"[0-9]*":"",tabindex:0,accesskey:"d"})[0].outerHTML)[0].outerHTML,er=t.buildTag("label#filterMeasureListLbl.filterMeasureListLbl",this._getLocalizedLabels("Measure"))[0].outerHTML,or=t.buildTag("input#fMeasuresList.fMeasuresList","",{},{type:"text",tabindex:0,accesskey:"M"})[0].outerHTML,sr=t.buildTag("label#filterValueLbl.filterValueLbl",this._getLocalizedLabels("Value"),{},{tabindex:0,accesskey:"a"})[0].outerHTML,hr=t.buildTag("div#sortingDlg.sortingDlg","<table class='sortReportTbl'><tr><td style='vertical-align:top;'>"+ci+"<\/td><td>"+pi+yi+"<\/td><\/tr><tr><td>"+li+"<\/td><td>"+vi+"<\/td><\/tr> <tr><td>"+ai+"<\/td><td>"+wi+bi+"<\/td><\/tr><tr><td><\/td><td>"+ki+"<\/td><\/tr><\/table>")[0].outerHTML,cr=t.buildTag("div#filteringDlg.filteringDlg","<table class='sortReportTbl'><tr><td>"+di+"<\/td><td>"+nr+gi+"<\/td><\/tr><tr><td>"+er+"<\/td><td>"+or+"<\/td><\/tr><tr><td>"+tr+"<\/td><td>"+ir+"<\/td><\/tr><tr><td>"+sr+"<\/td><td>"+rr+ur+fr+"<\/td><\/tr><\/table>")[0].outerHTML,lr="<li><a style='font: bold 12px Segoe UI' href='#sortingDlg'>"+this._getLocalizedLabels("Sorting")+"<\/a><\/li>",ar="<li><a style='font: bold 12px Segoe UI' href='#filteringDlg'>"+this._getLocalizedLabels("Filtering")+"<\/a><\/li>",vr=t.buildTag("div#sortfilterTab.sortfilterTab","<ul class ='sortfiltTab'>"+(lr+ar+"<\/ul>"+hr+cr))[0].outerHTML;e=vr}else if(r.split(" ")[0]=="renameReportImg")o=this._getLocalizedLabels("RenameReport"),s="Rename Report",dt=t.isNullOrUndefined(this._currentReportName)?this.element.find(".reportlist").val():this._currentReportName,gt="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",renameReport="<input type=text id=reportName class='reportName' value='"+dt+"' /><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+gt+"<\/td><td>"+renameReport+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="saveAsReportImg"||r.split(" ")[0]=="saveReportImg")o=r.split(" ")[0]=="saveAsReportImg"?this._getLocalizedLabels("SaveAs"):this._getLocalizedLabels("Save"),s="SaveAs Report",l="<p class='dialogPara'>"+this._getLocalizedLabels("ReportName")+"<\/p>",recordName="<input type=text id=reportName class='reportName'/><\/br>",e=t.buildTag("div#"+this._id+"_ReportDlg.reportDlg","<table><tr><td>"+l+"<\/td><td>"+recordName+"<\/td><\/tr><\/table>")[0].outerHTML;else if(r.split(" ")[0]=="LoadReport")o=this._getLocalizedLabels("Load"),s="Load Report",l="<table class='loadReportTbl'><tr><td class='loadReportTd'>"+this._getLocalizedLabels("ReportName")+"<\/td>",b="<td><input type='text' id='reportNameList' class='reportNameList'/><\/td><\/tr><\/table>",e=l+b;else if(r.split(" ")[0]=="RemoveDBReport")o=this._getLocalizedLabels("Remove"),s="RemoveDB Report",l="<table class='removeDBReportTbl'><tr><td class='removeDBReportTd'>"+this._getLocalizedLabels("ReportName")+"<\/td>",b="<td><input type='text' id='reportNameList' class='reportNameList'/><\/td><\/tr><\/table>",e=l+b;else if(r.split(" ")[0]=="RenameDBReport"){o=this._getLocalizedLabels("Rename");s="RenameDB Report";var l="<table class='renameDBReportTbl'><tr><td class='renameDBReportTd'>"+this._getLocalizedLabels("SelectReport")+"<\/td>",b="<td><input type='text' id='reportNameList' class='reportNameList'/><\/td><\/tr>",yr="<tr><td class='renameDBReportTd'>"+this._getLocalizedLabels("RenameReport")+"<\/td>";e=l+b+yr+"<td><input type='text' id='renameReport' class='renameReport' style='width:146px'/><\/td><\/tr><\/table>"}else if(r.split(" ")[0]=="mdx")o=this._getLocalizedLabels("MDXQuery"),s="MDX Query",ni="<textarea readonly='readonly' style='width:460px; height:180px; resize:none; margin:3px'>"+u+"<\/textarea>",e=ni;else if(r.split(" ")[0]=="chartTypesImg")o=this._getLocalizedLabels("ChartTypes"),s="Chart Types",ti="<p class='dialogPara'>"+this._getLocalizedLabels("ChartTypes")+"<\/p>",it="<input type=text id=reportName class='reportName'/><\/br>",e=ti+it;else if(r.indexOf("e-txt")>-1){u==this._getLocalizedLabels("Measures")?(o=this._getLocalizedLabels("MeasureEditor"),e="<p class='editorPara'>"+this._getLocalizedLabels("Measures")+"<\/p>"):(o=this._getLocalizedLabels("MemberEditor"),e=this.model.enableAdvancedFilter&&!y?"":"<p class='editorPara'>"+hierarchyCaption+"<\/p>");et="";st="";n(ct).appendTo(lt);u!=this._getLocalizedLabels("Measures")&&(ii=t.buildTag("div.checkAll e-icon").attr("role","button").attr("aria-label","checkall")[0].outerHTML,ri=t.buildTag("div.unCheckAll e-icon").attr("role","button").attr("aria-label","uncheckall")[0].outerHTML,st=t.buildTag("div.checkOptions",ii+ri,{height:"19px",margin:"10px 0px 0px 31px"})[0].outerHTML,et=t.buildTag("div.memberSearchEditorDiv",t.buildTag("input#searchEditorTreeView.searchEditorTreeView").attr("type","text")[0].outerHTML+(!t.isNullOrUndefined(c)&&u!=this._getLocalizedLabels("Measures")&&this.model.enableMemberEditorPaging&&n.parseJSON(c).length>=this.model.memberEditorPageSize?t.buildTag("span.e-icon searchEditorTree",{})[0].outerHTML:""),{padding:this.model.enableAdvancedFilter?"5px 0px 0px 0px":0})[0].outerHTML);u==this._getLocalizedLabels("Measures")?(this._isMembersFiltered=!1,ot=this._createMeasureEditor(f)):ot=t.buildTag("div#editorTreeView.editorTreeView")[0].outerHTML;var pr=t.buildTag("div.memberEditorDiv",(this._selectedFieldName!=""?st:"")+ot)[0].outerHTML,ht="",ui="";this._selectedFieldName!=""&&!y&&this.model.enableAdvancedFilter&&(ui=t.buildTag("div.ddlGroupWrap",this._getLocalizedLabels("SelectField")+":"+t.buildTag("input#GroupLabelDrop.groupLabelDrop").attr("type","text")[0].outerHTML,{})[0].outerHTML,ht=t.buildTag("div.filterElementTag")[0].outerHTML,fi=t.Pivot.createAdvanceFilterTag({action:"filterTag"},this),vt=n.map(this.element.find(".e-treeview li[tag='"+this._selectedFieldName+"'] li"),function(t){return{text:n(t).text(),value:n(t).attr("tag")}}));ct=t.buildTag("div",(ht!=""&&!y&&this.model.enableAdvancedFilter?ui+t.buildTag("div.e-seperator",{},{padding:"2px"},k)[0].outerHTML+ht+t.buildTag("div.e-seperator",{},{padding:"2px"})[0].outerHTML:"")+et+pr)[0].outerHTML;lt=t.buildTag("div#EditorDiv.editorDiv",ct,{"margin-left":this.model.enableAdvancedFilter?"5px":"0px"})[0].outerHTML;e+=lt;yt=t.buildTag("div.memberPager",t.buildTag("div#NextpageDiv.nextPageDiv",t.buildTag("div.e-icon e-media-backward_01 firstPage",{})[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-left prevPage",{})[0].outerHTML+t.buildTag("input.memberCurrentPage#memberCurrentPage",{},{width:"20px",height:"10px"})[0].outerHTML+t.buildTag("span.memberPageCount#memberPageCount")[0].outerHTML+t.buildTag("div.e-icon e-arrowhead-right nextPage",{})[0].outerHTML+t.buildTag("div.e-icon e-media-forward_01 lastPage",{})[0].outerHTML)[0].outerHTML,{})[0].outerHTML}if(r.split(" ")[0]=="mdx"?(k="<button id=CancelBtn class='dialogCancelBtn'>"+this._getLocalizedLabels("OK")+"<\/button>",tt=t.buildTag("div.dialogFooter",k)[0].outerHTML,n(ft).appendTo("#"+this._id),n(e+tt).appendTo(this.element.find(".clientDialog")),this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:500,target:"#"+this._id,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)})):(ei="<button id=OKBtn class='dialogOKBtn'>"+(r.split(" ")[0]=="RemoveDBReport"?this._getLocalizedLabels("Remove"):this._getLocalizedLabels("OK"))+"<\/button>",k="<button id=CancelBtn class='dialogCancelBtn'>"+this._getLocalizedLabels("Cancel")+"<\/button>",tt=t.buildTag("div.dialogFooter",ei+(r.split(" ")[0]=="removeReportImg"&&reportsCount==1?"":k))[0].outerHTML,n(ft).appendTo("#"+this._id),n(e+(!t.isNullOrUndefined(c)&&u!=this._getLocalizedLabels("Measures")&&this.model.enableMemberEditorPaging&&n.parseJSON(c).length>=this.model.memberEditorPageSize?yt:"")+tt).appendTo(this.element.find(".clientDialog")),r.split(" ")[0]=="SortFilterDlg"?this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:"auto",target:"#"+this._id,cssClass:"SortFilterDlg",enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)}):this.element.find(".clientDialog").ejDialog({enableRTL:this.model.enableRTL,width:"auto",target:"#"+this._id,enableResize:!1,close:t.proxy(t.Pivot.closePreventPanel,this)}),r.split(" ")[0]=="removeReportImg"&&(this.element.find(".clientDialog").css("min-height","60px"),this.element.find("#"+this._id+"_ClientDialog_wrapper").css("min-height","100px"))),this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").prepend(t.buildTag("div",o,{display:"inline"})[0].outerHTML)[0].setAttribute("tag",s),this.element.find(".reportName").ejMaskEdit({width:"155px",textAlign:this.model.enableRTL?"right":"left"}),this.element.find(".memberSearchEditorDiv .e-mask").addClass("dialogInput"),this.element.find(".prevPage, .firstPage").addClass("pageDisabled"),this.element.find(".nextPage, .lastPage").addClass("pageEnabled"),this.element.find(".dialogOKBtn, .dialogCancelBtn").ejButton({type:t.ButtonType.Button}),n(".sortfilterTab").ejTab({enableRTL:this.model.enableRTL}),n(".reportNameList").ejDropDownList({dataSource:u.split("__"),enableRTL:this.model.enableRTL,width:"150px",height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),r.indexOf("e-txt")>-1&&this.element.find("#searchEditorTreeView").ejMaskEdit({name:"inputbox",width:"100%",inputMode:t.InputMode.Text,watermarkText:this._getLocalizedLabels("Search")+" "+hierarchyCaption,maskFormat:"",textAlign:this.model.enableRTL?"right":"left",change:!this.model.enableMemberEditorPaging||this.element.find(".nextPageDiv").length==0?t.proxy(t.Pivot._searchTreeNodes,this):function(n){t.isNullOrUndefined(n.value)&&t.Pivot._searchEditorTreeNodes(n,this)}}),this.element.find(".filterElementTag").ejMenu({fields:{dataSource:fi,id:"id",parentId:"parentId",text:"text",spriteCssClass:"spriteCssClass"},menuType:t.MenuType.NormalMenu,width:"100%",height:"25px",enableRTL:this.model.enableRTL,orientation:t.Orientation.Vertical,click:t.proxy(this._filterElementClick,this)}),this.element.find(".groupLabelDrop").ejDropDownList({width:"100%",height:"25px",enableRTL:this.model.enableRTL,dataSource:vt,fields:{id:"id",text:"text",value:"value"},selectedIndices:[0],change:t.proxy(this._groupLabelChange,this),create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(".filterFrom,.filterTo").ejMaskEdit({width:"80px",height:"20px",textAlign:this.model.enableRTL?"right":"left"}),n(".measuresList").ejDropDownList({dataSource:u.split("||")[0].split("__"),enableRTL:this.model.enableRTL,width:"80%",height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(".fMeasuresList").ejDropDownList({dataSource:u.split("||")[0].split("__"),width:"80%",enableRTL:this.model.enableRTL,height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),n(".filterCondition").ejDropDownList({change:"_onActiveConditionChange",enableRTL:this.model.enableRTL,dataSource:[{option:"EqualTo",value:this._getLocalizedLabels("EqualTo")},{option:"NotEquals",value:this._getLocalizedLabels("NotEquals")},{option:"GreaterThan",value:this._getLocalizedLabels("GreaterThan")},{option:"GreaterThanOrEqualTo",value:this._getLocalizedLabels("GreaterThanOrEqualTo")},{option:"LessThan",value:this._getLocalizedLabels("LessThan")},{option:"LessThanOrEqualTo",value:this._getLocalizedLabels("LessThanOrEqualTo")},{option:"Between",value:this._getLocalizedLabels("Between")},{option:"NotBetween",value:this._getLocalizedLabels("NotBetween")},],fields:{text:"value",value:"option"},width:"80%",height:"20px",create:function(){n(this.wrapper.find(".e-input")).focus(function(){n(this).blur()})}}),this.element.find(".filterCondition").ejDropDownList("option","change",t.proxy(this._onActiveConditionChange,this)),this._dllSortMeasure=n(".measuresList").data("ejDropDownList"),this._dllFilterCondition=n(".filterCondition").data("ejDropDownList"),this._dllfMeasuresList=n(".fMeasuresList").data("ejDropDownList"),v!=""&&(this.element.find(".radioBtnAsc")[0].checked=v[0]=="ASC"?!0:!1,this.element.find(".radioBtnDesc")[0].checked=v[0]=="DESC"?!0:!1,this.element.find(".sortDisable")[0].checked=!(this.element.find(".sortEnable")[0].checked=!0),this.element.find(".preserveHrchy")[0].checked=v[1]=="PH"?!0:!1,this._isSorted=!0,this._dllSortMeasure.setModel({value:v[2]})),h!=""&&(this.element.find(".filterEnable")[0].checked=!0,this._dllfMeasuresList.setModel({value:h[0]}),this._dllFilterCondition.setModel({value:h[1]}),this.element.find(".filterFrom").val(h[2]),h[3]!=i&&h[3]!=""&&(h[1]=="Between"||h[1]=="NotBetween")?this.element.find(".filterTo").val(h[3]):n(".filterTo").attr("disabled","disabled"),this._isFiltered=!0),this.element.find(".sortDisable")[0]!=i&&this.element.find(".sortDisable")[0].checked==!0&&(n(".measuresList_wrapper,.radioBtnAsc, .radioBtnDesc, .preserveHrchy").attr("disabled","disabled"),n(".measureListLbl, .orderLbl, .radioBtnAscLbl, .radioBtnDescLbl, .preserveHrchyLbl").addClass("sortFilterDisable"),this._dllSortMeasure.disable()),this.element.find(".filterDisable")[0]!=i&&this.element.find(".filterDisable")[0].checked==!0&&(n(".filterFrom, .filterTo").attr("disabled","disabled"),n(".filterMeasureListLbl, .conditionLbl, .filterValueLbl, .filterBtw").addClass("sortFilterDisable"),this._dllFilterCondition.disable(),this._dllfMeasuresList.disable()),this.element.find(".e-widget-content").height("auto"),d=!1,this._excelFilterInfo.length>0){var wr=this.element.find(".cubeSelector").length>0?this.element.find(".cubeSelector").data("ejDropDownList").model.value:"",it=this.element.find("#reportList").data("ejDropDownList").model.value,oi=this._selectedLevelUniqueName,si=this._selectedFieldName;this.model.analysisMode==t.Pivot.AnalysisMode.Olap?n.map(this._excelFilterInfo,function(n){n.cubeName==wr&&n.report==it&&(n.hierarchyUniqueName==si||n.levelUniqueName==oi)&&(d=!0)}):n.map(this._excelFilterInfo,function(n){n.report==it&&(n.hierarchyUniqueName==si||n.levelUniqueName==oi)&&(d=!0)})}if(f!=""&&f!=i&&u!=this._getLocalizedLabels("Measures")){if(g=null,!d&&this._currentReportItems.length!=0)for(rt=0;rt<this._currentReportItems.length;rt++)if(this._currentReportItems[rt]==this._currentItem){g=JSON.parse(JSON.stringify(this._treeViewData[this._currentItem]));break}g!=null&&d||(g=n.parseJSON(c));this.model.enableMemberEditorPaging&&u!=this._getLocalizedLabels("Measures")&&(this._editorTreeData=n.parseJSON(c),hi=this._editorTreeData.length,a=hi/this.model.memberEditorPageSize,a!=Math.round(a)&&(a=parseInt(a)+1),this._memberPageSettings.currentMemeberPage==a&&this.element.find(".nextPage, .lastPage").addClass("disabled"),this.element.find(".memberPageCount").html("/ "+a),this.element.find(".memberCurrentPage").val(this._memberPageSettings.currentMemeberPage));this._appendTreeViewData(this.model.enableMemberEditorPaging?t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",null||i).page(this._memberPageSettings.currentMemeberPage,this.model.memberEditorPageSize)):g,y);this.model.enableAdvancedFilter||this.element.find(".memberEditorDiv").css({height:"286px"});this.model.enableAdvancedFilter&&this.element.find("#clientDialog_wrapper").addClass("advancedFilterDlg")}this.element.find("#"+this._id+"_ClientDialog_closebutton").attr("title",this._getLocalizedLabels("Close"));this._unWireEvents();this._wireEvents();this._isTimeOut=!1;this._waitingPopup.hide()},_appendTreeViewData:function(i,r){var f,u,e;if(this.element.find(".editorTreeView").ejTreeView({showCheckbox:!0,loadOnDemand:!0,enableRTL:this.model.enableRTL,nodeUncheck:function(i){var r=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),u,f;r._isMembersFiltered=!0;n(i.currentElement).parents(".e-treeview").find(".e-checkbox:checked").length!=0||r.model.enableMemberEditorPaging||r.element.find(".dialogOKBtn").data("ejButton").disable();r.model.operationalMode!=t.Pivot.OperationalMode.ClientMode&&r.model.enableMemberEditorPaging&&(u="",u=n(i.currentElement).parent().parent().hasClass("editorTreeView")&&!r._isSearchApplied?t.DataManager(r._editorTreeData).executeLocal(t.Query().page(r._memberPageSettings.currentMemeberPage,r.model.memberEditorPageSize).where("id","equal",i.currentElement.attr("id")))[0]:t.DataManager(r._editorTreeData).executeLocal(t.Query().where("id","equal",i.currentElement.attr("id")))[0],t.isNullOrUndefined(u)||(u.checkedStatus=!1,t.isNullOrUndefined(u.pid)||(f=t.DataManager(r._editorTreeData).executeLocal(t.Query().where("pid","equal",u.pid).where("checkedStatus","equal",!0)),t.isNullOrUndefined(f)||f.length!=0||t.Pivot._unSelectParentTreeNode(u,r))))},nodeCheck:function(i){var r=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),u,f,e;if(r._isMembersFiltered=!0,r.element.find(".dialogOKBtn").data("ejButton").enable(),r.element.find(".dialogOKBtn").removeAttr("disabled"),r.model.operationalMode!=t.Pivot.OperationalMode.ClientMode&&r.model.enableMemberEditorPaging&&(u="",u=n(i.currentElement).parent().parent().hasClass("editorTreeView")&&!r._isSearchApplied?t.DataManager(r._editorTreeData).executeLocal(t.Query().page(r._memberPageSettings.currentMemeberPage,r.model.memberEditorPageSize).where("id","equal",i.currentElement.attr("id")))[0]:t.DataManager(r._editorTreeData).executeLocal(t.Query().where("id","equal",i.currentElement.attr("id")))[0],!t.isNullOrUndefined(u)&&(u.checkedStatus=!0,t.isNullOrUndefined(u.pid)||t.Pivot._selectParentTreeNode(u,r),!t.isNullOrUndefined(u.id)&&(f=t.DataManager(r._editorTreeData).executeLocal(t.Query().where("pid","equal",u.id)),!t.isNullOrUndefined(f)&&f.length>0))))for(e=0;e<f.length;e++)f[e].checkedStatus=!0,t.Pivot._selectChildTreeNode(f[e],r)},beforeDelete:function(){return!1},cssClass:"pivotTreeViewDragedNode",height:n(".memberEditorDiv").height(),fields:{id:"id",hasChild:"hasChildren",text:"name",isChecked:"checkedStatus",dataSource:i},beforeExpand:t.proxy(this._onNodeExpand,this)}),f=this.element.find(".editorTreeView").find("li"),pivotClientObj._isSearchApplied)for(u=0;u<f.length;u++)t.isNullOrUndefined(n(f[u]).attr("id"))||n(f[u]).attr("tag",t.DataManager(i).executeLocal(t.Query().where("id","equal",n(f[u]).attr("id")))[0].tag);else for(u=0;u<f.length;u++)n(f[u]).attr("tag",i[u].tag);this._memberTreeObj=this.element.find(".editorTreeView").data("ejTreeView");e=n.grep(i,function(n){if(n.hasChildren==!0)return n}).length>0;e||this.element.find(".memberEditorDiv").addClass("noChildNode");this.element.find(".editorTreeView").height(256);r||!this.model.enableAdvancedFilter||t.isNullOrUndefined(this._memberTreeObj)||(t.isNullOrUndefined(this.element.find(".e-treeview li[tag='"+this._selectedLevelUniqueName+"']").attr("labelFiltering"))||this._memberTreeObj.element.find("."+this.element.find(".e-treeview li[tag='"+this._selectedLevelUniqueName+"']").attr("labelFiltering").split("--")[1].replace(" ","")+" a").append(t.buildTag("div.activeFilter").addClass("e-icon")[0].outerHTML),this.element.find(".e-dialog:not(.calcMemberDialog, .calcMemberDialog .e-dialog) .e-titlebar").hide(),this._groupLabelChange({selectedValue:this.element.find(".groupLabelDrop").data("ejDropDownList").model.value||this.element.find(".groupLabelDrop").data("ejDropDownList").model.dataSource[0].value}),this.element.find(".memberEditorDiv").height(286),this.element.find(".editorTreeView").height(256))},_createMeasureEditor:function(t){var u,f,r;for(u=t[0]!=i?n.parseJSON(t[0].Value):t.d!=i?n.parseJSON(t.d[0].Value):n.parseJSON(t.EditorTreeInfo),f="",r=0;r<u.length;r++)f+='<div id="'+u[r].uniqueName+'"class=measureEditor>'+u[r].name+"<span class='removeMeasure e-icon' role='button' aria-label='remove'><\/span><\/div>";return f},_onNodeExpand:function(r){for(var o,e,s,f=r.targetElement,h=t.buildTag("span.nodeExpand e-load e-icon")[0].outerHTML,c=n(f).parents("li").first().children().find("li").length,u=0;u<this._memberTreeObj.dataSource().length;u++)if(this._memberTreeObj.dataSource()[u].parentId==r.id){r.isChildLoaded=!0;t.Pivot.closePreventPanel(this);return}if(!t.isNullOrUndefined(this)&&this.model.enableMemberEditorPaging&&t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",r.id)).length>0){r.isChildLoaded=!0;t.Pivot.closePreventPanel(this);this.pNode=f;this._fetchChildNodeSuccess({ChildNodes:JSON.stringify(t.DataManager(this._editorTreeData).executeLocal(t.Query().where("pid","equal",r.id))),customObject:this.model.customObject});return}if(!r.isChildLoaded){if(n(f).parents("li").first().prepend(h),o=n(f).parent().find("input.e-checkbox").prop("checked"),e=n(f).parents("li").first().attr("tag"),e==i)for(u=0;u<this._memberTreeObj.dataSource().length;u++)if(this._memberTreeObj.dataSource()[u].id==r.id){e=this._memberTreeObj.dataSource()[u].tag;n(r.currentElement[0]).attr("tag",this._memberTreeObj.dataSource()[u].tag);break}this.pNode=f;this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"memberExpanded",element:this.element,customObject:this.model.customObject});s=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.memberExpand,JSON.stringify({action:"memberExpanded",checkedStatus:o,parentNode:n(f).parents("li")[0].id,tag:e,dimensionName:this._dimensionName,cubeName:this.currentCubeName,olapReport:this.currentReport,clientReports:this.reports,customObject:s}),this._fetchChildNodeSuccess)}},_onActiveConditionChange:function(t){t.selectedValue=="Between"||t.selectedValue=="NotBetween"?(n(".filterTo").removeAttr("disabled"),n(".filterBtw").removeClass("sortFilterDisable")):(n(".filterTo").attr("disabled","disabled"),this.element.find(".filterTo").val(""),n(".filterBtw").addClass("sortFilterDisable"))},_reSizeHandler:function(i){t.isNullOrUndefined(this)||(this._parentHeight=n(i.target).height(),this.element.height(this._parentHeight),this._calculateHeight(),this._parentElwidth=n("#"+this._id).parent().width(),(this._parentElwidth<850||this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this._parentElwidth<910)&&this._rwdToggleCollapse(),(this._parentElwidth>850||this.model.operationalMode==t.Pivot.OperationalMode.ClientMode&&this._parentElwidth>910)&&this._rwdToggleExpand(),this.model.isResponsive&&this.model.enableSplitter&&this.element.find(".splitresponsive").data("ejSplitter").refresh(),this._overflow(),this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),n("#"+this._pivotChart._id+"Container").height(this._chartHeight),t.isNullOrUndefined(this.chartObj)||(this.chartObj.model.size.height=this._chartHeight),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw())))},_chartDrillSuccess:function(r){var h,e,f,s,u;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(this._isGridDrillAction)this._isGridDrillAction=!1;else{this._isGridDrillAction=!1;this._isChartDrillAction=!0;h=this._pivotChart._selectedItem;e=this._pivotChart._drillAction;e=="drilldown"?t.isNullOrUndefined(this._pivotChart._labelCurrentTags.expandedMembers)||this._drillParams.indexOf(this._pivotChart._labelCurrentTags.expandedMembers.join(">#>"))!=-1||this._drillParams.push(this._pivotChart._labelCurrentTags.expandedMembers.join(">#>")):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(h)<0});var o=this._pivotChart.model.enableMultiLevelLabels?r.drilledMember.split(">#>"):e=="drilldown"?this._pivotChart._labelCurrentTags.expandedMembers:this._pivotChart._currentDrillInfo,c=0,l=this._pivotGrid._rowCount;for(f=0;f<o.length;f++)s=f==o.length-1&&e=="drilldown"?this.element.find(".e-pivotgrid .pivotGridTable th.summary[p^='"+f+"']"):this.element.find(".e-pivotgrid .pivotGridTable th.rowheader[p^='"+f+"']"),u=n.grep(s,function(t){return n(t).clone().children().remove().end().text()==o[f]}),u=n.grep(u,function(t){return parseInt(n(t).attr("p").split(",")[1])>=c&&parseInt(n(t).attr("p").split(",")[1])<=l}),f==o.length-1?n(u).find("."+(e=="drilldown"?"expand":"collapse")).trigger("click"):(c=parseInt(n(u).attr("p").split(",")[1]),l=c+(t.isNullOrUndefined(n(u).find("span").attr("tag"))?0:parseInt(n(u).find("span").attr("tag")))+u[0].rowSpan);o.length==0&&(s=this.element.find(".e-pivotgrid .pivotGridTable th.rowheader[p^='0']"),u=n.grep(s,function(t){return n(t).clone().children().remove().end().text()==h}),n(u).find(".collapse").trigger("click"))}else this.currentReport!=i&&(currentReport=this.currentReport),this.reports!=i&&(reports=this.reports),this._pivotChart._startDrilldown&&this._pivotGrid!=null&&this._pivotGrid!=i?this._renderPivotGrid(this._pivotChart._selectedTagInfo):this._pivotGrid!=i&&this._pivotGrid.element.find("table")=="block"&&(this._isTimeOut=!1,this._waitingPopup.hide())},_treemapDrillSuccess:function(){this.currentReport!=i&&(currentReport=this.currentReport);this.reports!=i&&(reports=this.reports);this.otreemapObj._startDrilldown&&this._pivotGrid!=null&&this._pivotGrid!=i?this._renderPivotGrid(this.otreemapObj._selectedTagInfo):this._pivotGrid!=i&&this._pivotGrid.element.find("table")=="block"&&(this._isTimeOut=!1,this._waitingPopup.hide());t.isNullOrUndefined(this.chartObj)||(this.model.displaySettings.enableFullScreen||this.enableTogglePanel()&&this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap")&&(n("#"+this.otreemapObj._id+"TreeMapContainer").css({width:"100%"}),this.otreemapObj._treeMap.refresh())},_gridDrillSuccess:function(r){var s,c,l,a,f,o,e,u,h;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(this._isChartDrillAction)this._isChartDrillAction=!1;else{if(this._isGridDrillAction=!0,this._isChartDrillAction=!1,r.axis=="rowheader"&&this.displayMode()!=t.PivotClient.DisplayMode.GridOnly){r.drillAction=="drilldown"?this._drillParams.push(r.drilledMember):this._drillParams=n.grep(this._drillParams,function(n){return n.indexOf(r.drilledMember)<0});s=r.drilledMember.split(">#>");this._pivotChart._labelCurrentTags.expandedMembers=s;r.drillAction=="drillup"&&(this._pivotChart._labelCurrentTags.expandedMembers=[],this._drillParams.length>0&&this._getDrilledMember(r.drillAction),s=this._pivotChart._labelCurrentTags.expandedMembers);s=this._pivotChart.model.enableMultiLevelLabels?r.drillAction=="drillup"?r.drilledMember.split(">#>").slice(0,-1):r.drilledMember.split(">#>"):s;this._pivotChart._drillAction=r.drillAction;this._pivotChart._drillParams=this._drillParams;try{c=JSON.parse(this.currentReport).Report}catch(v){c=this.currentReport}this._pivotChart.model.enableMultiLevelLabels?this._pivotChart._generateData({JsonRecords:this.getJSONRecords(),PivotReport:this.getOlapReport()}):(l=JSON.stringify(this.model.customObject),a={action:r.drillAction,currentReport:c,drilledSeries:JSON.stringify(s),clientReports:this.reports,customObject:l},this._pivotChart.doAjaxPost("POST",this.model.url+"/"+this._pivotChart.model.serviceMethodSettings.drillDown,JSON.stringify(a),this._pivotChart.renderControlSuccess))}else this._isGridDrillAction=!1;return}if(this.currentReport!=i&&(currentReport=this.currentReport),this.reports!=i&&(reports=this.reports),this._pivotGrid._startDrilldown&&!t.isNullOrUndefined(this._pivotChart)){if(o=this._pivotGrid._drillCaption,this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.model.displaySettings.enableFullScreen&&n("#"+this._id+"_maxView").length>0?n("#"+this._id+"_maxView").find("#"+this._pivotChart._id+"Container").data("ejChart"):this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),u=this,!t.isNullOrUndefined(this.chartObj))if(this.chartObj.sfType.split(".").pop().toLowerCase()!="treemap")jQuery.each(this._pivotChart._labelCurrentTags,function(n,t){t!=i&&t.name==o&&(e=t.tag,f=t)}),this._pivotChart._drillAction=this._pivotGrid._drillAction,this._pivotChart._selectedItem=o,this._pivotGrid._drillAction!="drilldown"||t.isNullOrUndefined(f)?t.isNullOrUndefined(f)||(jQuery.each(this.element.find(".rowAxis").find("button"),function(n,t){t.innerHTML==f.tag.split("[")[1].split("]")[0]&&(u._pivotChart._dimensionIndex=n)}),jQuery.each(this._pivotChart._tagCollection,function(n,t){if(t!=i&&t.name==o)return u._pivotChart._selectedIndex=n+u._pivotChart._dimensionIndex,u._pivotChart._tagCollection.splice(n,u._pivotChart._tagCollection.length),!1})):this._pivotChart._tagCollection.push(f),e!=null&&e!=i?this._renderPivotChart(e,this._pivotGrid._drillAction):(this._isTimeOut=!1,this._waitingPopup.hide());else{for(h=0;h<this.otreemapObj.getJsonRecords().labelTags.length;h++)if(this.otreemapObj.getJsonRecords().labelTags[h].split("::")[2]==o){e=this.otreemapObj.getJsonRecords().labelTags[h];break}this.otreemapObj_currentAction=this._pivotGrid._drillAction;this.otreemapObj._selectedItem=o;this._pivotGrid._drillAction!="drilldown"||t.isNullOrUndefined(f)?t.isNullOrUndefined(f)||(jQuery.each(this.element.find(".rowAxis").find("button"),function(n,t){t.innerHTML==f.tag.split("[")[1].split("]")[0]&&(u.otreemapObj._dimensionIndex=n)}),jQuery.each(this.otreemapObj._tagCollection,function(n,t){if(t!=i&&t.name==o)return u.otreemapObj._selectedIndex=n+u.otreemapObj._dimensionIndex,u.otreemapObj._tagCollection.splice(n,u.otreemapObj._tagCollection.length),!1})):this.otreemapObj._tagCollection.push(f);e!=null&&e!=i?this._renderPivotTreeMap(e,this._pivotGrid._drillAction):(this._isTimeOut=!1,this._waitingPopup.hide())}}else n("#"+this._waitingPopup._id+"_WaitingPopup")[0].style.display=="block"&&(this._isTimeOut=!1,this._waitingPopup.hide())},_nodeDropped:function(r){var f=n(r.dropTarget).hasClass("pvtBtn")&&n(r.dropTarget).parent("div.splitBtn").length>0?n(r.dropTarget).parent("div.splitBtn"):n(r.dropTarget),s,u,o,e,h,c;if(pivotClientObj=this,f.prevObject!=i?f.prevObject.removeClass("targetAxis"):n(f).removeClass("targetAxis"),isDragging=!1,s=this._setSplitBtnTargetPos(r.event),f.prevObject!=i?f.prevObject.parents().find(".e-dialog").hide():n(f).parents().find(".e-dialog").hide(),u=null,n(f).hasClass("splitBtn"))u=n(f).parents("div:eq(0)").attr("class");else if(r.event.type=="touchend")u=f[0].className;else if(r.event.target!=i){if(r.event.target.className==i||r.event.target.className==null||n(r.event.target).parents(".chartContainer").length>0)return!1;u=r.event.target.className.toLowerCase().indexOf("splitbtn")>-1||n(r.event.target).hasClass("e-button")?n(f).attr("class"):r.event.target.className}else u=r.event.originalEvent.srcElement.className.toLowerCase().indexOf("splitbtn")>-1?f[0].className:r.event.originalEvent.srcElement.className;if(delete pivotClientObj._fieldMembers[pivotClientObj._dialogTitle],delete pivotClientObj._fieldSelectedMembers[pivotClientObj._dialogTitle],o=u.indexOf("categoricalAxis")>u.indexOf("rowAxis")?u.indexOf("categoricalAxis")>u.indexOf("slicerAxis")?"Categorical":"Slicer":u.indexOf("rowAxis")>u.indexOf("slicerAxis")?"Series":u.indexOf("slicerAxis")>=0?"Slicer":null,e=n(r.droppedElement).attr("tag"),o=="Slicer"&&e!=null&&e.indexOf("Measure")>-1&&this.element.find(".splitBtn[tag*=Measures]").length>1||o=="Slicer"&&e.indexOf("Measure")>-1&&n(r.droppedElement).find(".calcMemberCDB").length>0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1&&n(r.droppedElement).attr("tag").replace(/\[/g,"").replace(/\]/g,"")!=this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").attr("tag").split(":")[1].split("::")[0]||o=="Slicer"&&e.indexOf("Measure")>-1&&n(r.droppedElement).find(".calcMemberCDB").length==0&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==1||o=="Slicer"&&e.indexOf("Measure")>-1&&n(r.droppedElement).find(".calcMemberCDB").length==1&&this.element.find(".splitBtn[tag*=CalculatedMember][tag*=Measure]").length==0&&this.element.find(".splitBtn[tag*=Measure]").length==1)return t.Pivot._createErrorDialog(this._getLocalizedLabels("MultipleMeasure"),this._getLocalizedLabels("Warning"),this),!1;o!=null&&e!="Measures"&&e.lastIndexOf(".DF")!=e.length-3&&(o=="Slicer"&&(e.indexOf("Measures")>=0||n(r.droppedElement[0].childNodes[0]).find(".namedSetCDB").length>0)||(this._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"nodeDropped",element:this.element,customObject:this.model.customObject}),h=JSON.stringify(this.model.customObject),c=pivotClientObj.currentCubeName+"--"+n(r.droppedElement).attr("tag")+"--"+o+"--"+s,pivotClientObj.doAjaxPost("POST",pivotClientObj.model.url+"/"+pivotClientObj.model.serviceMethodSettings.nodeDropped,JSON.stringify({action:"nodeDropped",dropType:"TreeNode",nodeInfo:c,olapReport:pivotClientObj.currentReport,clientReports:pivotClientObj.reports,customObject:h}),pivotClientObj._nodeDroppedSuccess)));pivotClientObj._isRemoved=!0;pivotClientObj._isNodeOrButtonDropped=!0},_setSplitBtnTargetPos:function(t){var o="",e,r,u,f;if(t.event!=i&&t.event.type=="touchend"?(r=t.event.originalEvent.target!=null?n(t.event.originalEvent.target).parents(".splitBtn"):n(t.event.originalEvent.srcElement).parents(".splitBtn"),u=t.event.originalEvent.target!=null?t.event.originalEvent.target.className:t.event.originalEvent.srcElement.className):(r=t.originalEvent.target!=null?n(t.originalEvent.target).parents(".splitBtn"):n(t.originalEvent.srcElement).parents(".splitBtn"),u=t.originalEvent.target!=null?t.originalEvent.target.className:t.originalEvent.srcElement.className),r[0]||u!=i&&u!=null&&jQuery.type(u)=="string"&&u.indexOf("splitBtn")>-1)if(r=r[0]?r[0]:t.originalEvent.target!=null?t.originalEvent.target:t.originalEvent.srcElement,e=t.event!=i&&t.event.type=="touchend"?t.target:this._dropAxisClassName!=null&&this._dropAxisClassName!=i&&this._dropAxisClassName!=""?this.element.find("."+this._dropAxisClassName)[0]:r.parentNode,e!=i)for(f=0;f<n(e).find(".splitBtn").length;f++)n(e).find(".splitBtn")[f]==r&&(o=f);else this._dropAxisClassName="";return o},_cubeChanged:function(n){if(pivotClientObj=this,this._currentRecordName="",this._fieldMembers={},this._fieldSelectedMembers={},this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=null,this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap"))),this.currentCubeName==n.text)return!1;this.currentCubeName=n.text;pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"cubeChanged",element:this.element,customObject:this.model.customObject});var i=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.cubeChanged,JSON.stringify({action:"cubeChanged",cubeName:this.currentCubeName,customObject:i,clientParams:JSON.stringify(this.model.enableMeasureGroups)}),this._cubeChangedSuccess)},_measureGroupChanged:function(n){var t,i;this._isTimeOut=!0;t=this;setTimeout(function(){t._isTimeOut&&t._waitingPopup.show()},800);this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"cubeChanged",element:this.element,customObject:this.model.customObject});i=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.measureGroupChanged,JSON.stringify({action:"measureGroupChanged",measureGroupName:n.text,olapReport:this.currentReport,clientReports:this.reports,customObject:i}),this._measureGroupChangedSuccess)},_reportChanged:function(i){var u,r,f;if(this._fieldMembers={},this._fieldSelectedMembers={},pivotClientObj=this,u=this.element.find("#reportList").data("ejDropDownList"),this.model.operationalMode==t.Pivot.OperationalMode.ClientMode)r=n.map(this._clientReportCollection,function(n){if(n.reportName==u.getValue())return n}),this.model.dataSource=r[0],this._currentItem!="Rename Report"&&(this.refreshControl(),this._pivotSchemaDesigner._refreshPivotButtons()),this._isTimeOut=!1,this._waitingPopup.hide();else if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot){if(!this._isReportListAction)return;pivotClientObj._isTimeOut=!0;setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800);r=n.map(this._clientReportCollection,function(n){if(n.name==u.getValue())return n});this._currentReportName=r[0].name;this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:this.model.customObject});f=JSON.stringify(this.model.customObject);this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"Change Report",args:JSON.stringify({currentReport:r[0].report}),customObject:f}),this._toolbarOperationSuccess)}else i.selectedText!=this._selectedReport&&(pivotClientObj._isTimeOut=!0,setTimeout(function(){pivotClientObj._isTimeOut&&pivotClientObj._waitingPopup.show()},800),this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:"toolbarOperation",element:this.element,customObject:this.model.customObject}),f=JSON.stringify(this.model.customObject),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.toolbarServices,JSON.stringify({action:"toolbarOperation",toolbarOperation:"Report Change",clientInfo:i.text,olapReport:null,clientReports:this.reports,customObject:f}),this._toolbarOperationSuccess));this._selectedReport=u._currentText},_onDropped:function(n){if(n.target.className.indexOf("e-button")>-1){var t=this._getAxisPosition(this.element.find(".categoricalAxis")),r=this._getAxisPosition(this.element.find(".rowAxis")),u=this._getAxisPosition(this.element.find(".slicerAxis"));this._dropAxisClassName;n.pageX!=i&&n.pageY!=i&&(this._dropAxisClassName=n.pageX>t.left&&n.pageX<t.right&&n.pageY>t.top&&n.pageY<t.bottom?"categoricalAxis":n.pageX>r.left&&n.pageX<r.right&&n.pageY>r.top&&n.pageY<r.bottom?"rowAxis":n.pageX>u.left&&n.pageX<u.right&&n.pageY>u.top&&n.pageY<u.bottom?"slicerAxis":"outOfAxis")}},_getAxisPosition:function(t){var r=t.position(),i={};return i.top=r.top,i.right=r.left+n(t).width(),i.bottom=r.top+n(t).height(),i.left=r.left,i},_onTabClick:function(i){this.displayMode()!=t.PivotClient.DisplayMode.GridOnly&&(this.chartObj=this.element.find("#"+this._pivotChart._id+"Container").data("ejChart"),t.isNullOrUndefined(this.chartObj)&&this.model.enablePivotTreeMap&&!t.isNullOrUndefined(this.otreemapObj)&&(this.chartObj=this.element.find("#"+this.otreemapObj._id+"TreeMapContainer").data("ejTreeMap")));this._currentTab="chart";n(i.activeHeader).find("a").text()==this._getLocalizedLabels("Grid")?(this._currentTab="grid",this.element.find(".chartTypesImg").addClass("chartTypesOnGridView"),this.element.find(".gridPanel").css("display","inline")):t.isNullOrUndefined(this.chartObj)||(this._currentTab="chart",this.element.find(".chartTypesImg").removeClass("chartTypesOnGridView"),t.isNullOrUndefined(this.chartObj)||(this.chartObj.sfType.split(".").pop().toLowerCase()=="treemap"?this.otreemapObj._treeMap.refresh():this.chartObj.redraw()),this.model.enableToolBar&&(this._unWireEvents(),this._wireEvents()))},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,dataType:c,async:a,data:f,success:l,complete:t.proxy(function(){var n={action:!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(s.action)?s.action:JSON.parse(f).action,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",n)},this),error:t.proxy(function(t){this._waitingPopup=n("#"+this._id).data("ejWaitingPopup");this._isTimeOut=!1;this._waitingPopup.hide();var i={customObject:this.model.customObject,element:this.element,Message:t};this._trigger("renderFailure",i);this._renderControlSuccess("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotClient.Locale={};t.PivotClient.Locale["en-US"]={NoReports:"No Reports Found in DB",Sort:"Sort",Search:"Search",SelectField:"Select field",LabelFilterLabel:"Show the items for which the label",ValueFilterLabel:"Show the items for which",ClearSorting:"Clear Sorting",ClearFilterFrom:"Clear Filter From",SortAtoZ:"Sort A to Z",SortZtoA:"Sort Z to A",LabelFilters:"Label Filters ",BeginsWith:"Begins With",DoesNotBeginsWith:"Does Not Begins With",EndsWith:"Ends With",NotEndsWith:"Not Ends With",DoesNotEndsWith:"Does Not Ends With",Contains:"Contains",DoesNotContains:"Does Not Contains",ValueFilters:"Value Filters",ClearFilter:"Clear Filter",Equals:"Equals",DoesNotEquals:"Does Not Equals",NotEquals:"Not Equals",GreaterThan:"Greater Than",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThan:"Less Than",LessThanOrEqualTo:"Less Than Or Equal To",Between:"Between",NotBetween:"Not Between",Top10:"Top Count",GreaterThan:"Greater Than",IsGreaterThan:"Is Greater Than",IsGreaterThanOrEqualTo:"Is Greater Than Or Equal To",IsLessThan:"Is Less Than",IsLessThanOrEqualTo:"Is Less Than Or Equal To",DeferUpdate:"Defer Update",MDXQuery:"MDX Query",Column:"Column",Row:"Row",Slicer:"Slicer",CubeSelector:"Cube Selector",ReportName:"Report Name",NewReport:"New Report",CubeDimensionBrowser:"Cube Dimension Browser",AddReport:"Add Report",RemoveReport:"Remove Report",CannotRemoveSingleReport:"Can not remove single report",AreYouSureToDeleteTheReport:"Are you sure to delete the Report",RenameReport:"Rename Report",ChartTypes:"Chart Types",ToggleAxis:"Toggle Axis",Load:"Load",ExportToExcel:"Export To Excel",ExportToWord:"Export To Word",ExportToPdf:"Export To Pdf",FullScreen:"Full Screen",Grid:"Grid",Chart:"Chart",OK:"<u>O<\/u>K",Cancel:"<u>C<\/u>ancel",Close:"Close",AddToColumn:"Add to Column",AddToRow:"Add to Row",AddToSlicer:"Add to Slicer",MeasureEditor:"Measure Editor",MemberEditor:"Member Editor",Measures:"Measures",SortOrFilterColumn:"Sort/Filter (Column)",SortOrFilterRow:"Sort/Filter (Row)",SortingAndFiltering:"Sorting And Filtering",Sorting:"Sorting",Measure:"<u>M<\/u>easure",Order:"Order",Filtering:"Filtering",Condition:"C<u>o<\/u>ndition",Value:"Val<u>u<\/u>e",PreserveHierarchy:"P<u>r<\/u>eserve Hierarchy",Ascending:"<u>A<\/u>scending",Descending:"D<u>e<\/u>scending",Enable:"E<u>n<\/u>able",Disable:"D<u>i<\/u>sable",and:"<u>a<\/u>nd",EqualTo:"EqualTo",NotEquals:"NotEquals",GreaterThan:"GreaterThan",GreaterThanOrEqualTo:"GreaterThanOrEqualTo",LessThan:"LessThan",LessThanOrEqualTo:"LessThanOrEqualTo",Between:"Between",NotBetween:"NotBetween",ReportList:"Report List",Line:"Line",Spline:"Spline",Column:"Column",Area:"Area",SplineArea:"Spline Area",StepLine:"Step Line",StepArea:"Step Area",Pie:"Pie",Bar:"Bar",StackingArea:"Stacking Area",StackingColumn:"Stacking Column",StackingBar:"Stacking Bar",Pyramid:"Pyramid",Funnel:"Funnel",Doughnut:"Doughnut",Scatter:"Scatter",Bubble:"Bubble",WaterFall:"WaterFall",TreeMap:"TreeMap",Alert:"Alert",MDXAlertMsg:"Please add a measure, dimension or hierarchy in an appropriate axis to view the MDX Query.",FilterSortRowAlertMsg:"Dimension not found in row axis. Please add Dimension element in row axis for sorting/filtering.",FilterSortColumnAlertMsg:"Dimension not found in column axis. Please add Dimension element in column axis for sorting/filtering.",FilterSortcolMeasureAlertMsg:"Please add measure to the Column axis",FilterSortrowMeasureAlertMsg:"Please add measure to the Row axis",FilterSortElementAlertMsg:"Element not found in column axis. Please add an element in column axis for sorting/filtering.",SelectRecordAlertMsg:"Please select a valid report.",FilterMeasureSelectionAlertMsg:"Please select a valid measure.",FilterConditionAlertMsg:"Please set a valid condition.",FilterStartValueAlertMsg:"Please set a start value.",FilterEndValueAlertMsg:"Please set a end value.",FilterInvalidAlertMsg:"Invalid operation !",Remove:"Remove",Save:"Save",SaveAs:"Save As",SelectReport:"Select Report",DBReport:"Report Manipulation in DB",Rename:"Rename",Remove:"Remove",SetReportNameAlertMsg:"Please set report name.",MultipleItems:"Multiple items",All:"All",CalculatedMember:"Calculated Member",Caption:"Caption:",Expression:"Expression:",MemberType:"MemberType:",FormatString:"Format String:",MultipleMeasure:"More than one measure cannot be sliced.",DuplicateCalcMeasure:"Calculated Member with same name already exist.",EmptyField:"Calculated Member name or Expression cannot be empty.",EmptyFormat:"Format String for Calculated Member is empty.",Warning:"Warning",Confirm:"Calculated Member with the same name already exists. Due to want to Replace ?"};t.PivotClient.ControlPlacement={Tab:"tab",Tile:"tile"};t.PivotClient.DisplayMode={ChartOnly:"chartonly",GridOnly:"gridonly",ChartAndGrid:"chartandgrid"};t.PivotClient.ClientExportMode={ChartAndGrid:"chartandgrid",ChartOnly:"chartonly",GridOnly:"gridonly"};t.PivotClient.ExportMode={JSON:"json",PivotEngine:"pivotengine"};t.PivotClient.DefaultView={Chart:"chart",Grid:"grid"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotChart","ej.PivotChart",{_rootCSS:"e-pivotchart",element:null,model:null,_requiresID:!0,validTags:["div","span"],defaults:n.extend(t.datavisualization.Chart.prototype.defaults,{url:"",analysisMode:"pivot",operationalMode:"clientmode",cssClass:"",currentReport:"",customObject:{},enableRTL:!1,isResponsive:!1,enable3D:!1,enableContextMenu:!1,enableMultiLevelLabels:!1,rotation:0,serviceMethodSettings:{initialize:"InitializeChart",drillDown:"DrillChart",exportPivotChart:"Export",paging:"paging"},dataSource:{data:null,sourceInfo:"",providerName:"ssas",isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},locale:null,drillSuccess:null,load:null,beforeServiceInvoke:null,afterServiceInvoke:null,renderComplete:null,renderFailure:null,renderSuccess:null,beforeExport:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},marker:"data",crossHair:"data",size:"data",serviceMethodSettings:{initialize:"enum",drillDown:"enum",exportPivotChart:"enum",paging:"enum"},zooming:"data",customObject:"data"},observables:["title.text","commonSeriesOptions.type","locale"],titleText:t.util.valueFunction("title.text"),seriesType:t.util.valueFunction("commonSeriesOptions.type"),locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(t){this._JSONRecords=n.parseJSON(t)},getPivotEngine:function(){return this._pivotEngine},setPivotEngine:function(n){this._pivotEngine=n},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this._pivotEngine=null;this.element.empty().removeClass("e-pivotchart"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._currentAction="initialize";this._selectedItem="";this._selectedIndex=-1;this._selectedTagInfo=null;this._tagCollection=[];this._selectedTags=[];this._labelCurrentTags=[];this._startDrilldown=!1;this._drillAction="";this._initZooming=!1;this._dimensionIndex=-1;this._selectedMenuItem="";this._pivotEngine=null;this._curFocus=null;this._drillParams=[];this._currentDrillInfo=[];this._selectedSeriesInfo=[];this._waitingPopup=null;this._pivotClientObj=null},_load:function(){var r,u;if(this.model.locale=this.model.locale||"en-US",r={action:"initialize",element:this.element,customObject:this.model.customObject},this._trigger("load",r),this.element.addClass(this.model.cssClass),n(this.element).parents(".e-pivotclient").length>0?(this._pivotClientObj=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+this._pivotClientObj._id+"_maxView")[0]?n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):(this.element.ejWaitingPopup({showOnInit:!0}),this._waitingPopup=this.element.data("ejWaitingPopup"),this._waitingPopup.show()),this.model.zooming!=""&&(this._initZooming=!0),this.model.dataSource.data==null&&this.model.url!=""||this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){if(this.model.operationalMode=t.PivotChart.OperationalMode.ServerMode,this.model.url==""){this.renderChartFromJSON("");return}this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._currentAction,element:this.element,customObject:this.model.customObject});u=JSON.stringify(this.model.customObject);this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize",currentReport:this.model.currentReport,customObject:u}),this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._generateData:this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize"}),this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._generateData:this.renderControlSuccess)}else this.model.operationalMode=t.PivotChart.OperationalMode.ClientMode,this.model.analysisMode=this.model.dataSource.cube!=""?t.PivotChart.AnalysisMode.Olap:t.PivotChart.AnalysisMode.Pivot,this.refreshControl()},refreshControl:function(){var r,u,f,i;if(this.model.analysisMode==t.Pivot.AnalysisMode.Pivot)if(t.PivotAnalysis.setFieldCaptions(this.model.dataSource),r=t.PivotAnalysis.pivotEnginePopulate(this.model),u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null,this._pivotEngine=r.pivotEngine,r.pivotEngine.length>0)if(t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)||this.model.enableMultiLevelLabels)this._generateData(this._pivotEngine);else{for(f=this._cloneEngine(this._pivotEngine),i=0;i<this._labelCurrentTags.expandedMembers.length;i++)this._cropData(f,this._labelCurrentTags.expandedMembers[i],0,!0);this._generateData(f)}else t.isNullOrUndefined(this._waitingPopup)||(t.isNullOrUndefined(u)||(u._isTimeOut=!1),this._waitingPopup.hide());else t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)},_setFirst:!0,_setModel:function(t){var r=this.element.find("#"+this._id+"Container").data("ejChart"),i,u;for(i in t)switch(i){case"olapReport":this.setOlapReport(t[i]);break;case"jsonData":this.setJSONRecords(t[i]);break;case"refreshPivotChart":this.element.renderChartFromJSON(t[i]);break;case"customObject":this.model.customObject=t[i];break;case"height":this.model.size.height=t[i];break;case"width":this.model.size.width=t[i];break;case"commonSeriesOptions":if(r)for(r.model.commonSeriesOptions=t[i],r.model.type=r.model.commonSeriesOptions.type=this.seriesType(),u=0;u<r.model.series.length;u++)r.model.series[u].type=r.model.type;break;case"title":r&&(r.model.title.text=this.titleText());break;case"animation":this.model.animation=t[i];break;case"crossHair":this.model.crossHair=t[i];break;case"marker":this.model.marker=t[i];break;case"zooming":this.model.zooming=t[i];break;case"legend":this.model.legend=t[i];break;case"primaryXAxis":this.model.primaryXAxis=t[i];break;case"primaryYAxis":this.model.primaryYAxis=t[i];break;case"locale":this.locale();break;default:n.extend(!0,this.model,{},t[i])}r&&this.renderControlSuccess({JsonRecords:JSON.stringify(this.getJSONRecords()),OlapReport:this.getOlapReport()})},_keyDownPress:function(n){var u,r,i;n.which!==13||t.isNullOrUndefined(this._curFocus)||this._curFocus.click();(n.which===39||n.which===37||n.which===38||n.which===40)&&this.element.find(".e-dialog").length>0&&(n.preventDefault(),u=this.element.find(".e-dialog"),u.tabindex=-1,u.focus(),r=u.find("li"),n.which===39||n.which===40?(t.isNullOrUndefined(this._curFocus)?this._curFocus=r.eq(0):(this._curFocus.removeClass("hoverCell"),i=this._curFocus.next(),this._curFocus=i.length>0?i:r.eq(0)),this._curFocus.addClass("hoverCell")):(n.which===37||n.which===38)&&(t.isNullOrUndefined(this._curFocus)?this._curFocus=r.last():(this._curFocus.removeClass("hoverCell"),i=this._curFocus.prev(),this._curFocus=i.length>0?i:r.last()),this._curFocus.addClass("hoverCell")))},_wireEvents:function(){if(this._on(n(document),"keydown",this._keyDownPress),!this.model.enableContextMenu||this.element.parents(".e-pivotclient").length>0||this._on(this.element,"contextmenu","#"+this._id+"Container",t.proxy(function(){var u="<li class='chartTypes'><a>"+this._getLocalizedLabels("ChartTypes")+"<\/a><ul><li class='line'><a>"+this._getLocalizedLabels("Line")+"<\/a><\/li><li class='spline'><a>"+this._getLocalizedLabels("Spline")+"<\/a><\/li><li class='column'><a>"+this._getLocalizedLabels("Column")+"<\/a><\/li><li class='area'><a>"+this._getLocalizedLabels("Area")+"<\/a><\/li><li class='splinearea'><a>"+this._getLocalizedLabels("SplineArea")+"<\/a><\/li><li class='stepline'><a>"+this._getLocalizedLabels("StepLine")+"<\/a><\/li><li class='steparea'><a>Step Area<\/a><\/li><li class='pie'><a>Pie<\/a><\/li><li class='bar'><a>Bar<\/a><\/li><li class='stackingarea'><a>Stacking Area<\/a><\/li><li class='stackingcolumn'><a>"+this._getLocalizedLabels("StackingColumn")+"<\/a><\/li><li class='stackingbar'><a>"+this._getLocalizedLabels("StackingBar")+"<\/a><\/li><li class='funnel'><a>"+this._getLocalizedLabels("Funnel")+"<\/a><\/li><li class='pyramid'><a>"+this._getLocalizedLabels("Pyramid")+"<\/a><\/li><li class='doughnut'><a>"+this._getLocalizedLabels("Doughnut")+"<\/a><\/li><li class='scatter'><a>"+this._getLocalizedLabels("Scatter")+"<\/a><\/li><li class='bubble'><a>"+this._getLocalizedLabels("Bubble")+"<\/a><\/li><\/ul><\/li>",f="<li class='chart3DTypes'><a>"+this._getLocalizedLabels("TDCharts")+"<\/a><ul><li class='column'><a>"+this._getLocalizedLabels("ColumnTD")+"<\/a><\/li><li class='pie'><a>"+this._getLocalizedLabels("PieTD")+"<\/a><\/li><li class='bar'><a>"+this._getLocalizedLabels("BarTD")+"<\/a><\/li><li class='stackingbar'><a>"+this._getLocalizedLabels("StackingBarTD")+"<\/a><\/li><li class='stackingcolumn'><a>"+this._getLocalizedLabels("StackingColumnTD")+"<\/a><\/li><li class='disable3D'><a>"+this._getLocalizedLabels("DisableTD")+"<\/a><\/li><\/ul><\/li>",e="<li class='exportTypes'><a>"+this._getLocalizedLabels("Exporting")+"<\/a><ul><li class='excel'><a>"+this._getLocalizedLabels("Excel")+"<\/a><\/li><li class='word'><a>"+this._getLocalizedLabels("Word")+"<\/a><\/li><li class='pdf'><a>"+this._getLocalizedLabels("Pdf")+"<\/a><\/li><li class='png'><a>"+this._getLocalizedLabels("PNG")+"<\/a><\/li><li class='emf'><a>"+this._getLocalizedLabels("EMF")+"<\/a><\/li><li class='gif'><a>"+this._getLocalizedLabels("GIF")+"<\/a><\/li><li class='jpg'><a>"+this._getLocalizedLabels("JPG")+"<\/a><\/li><li class='bmf'><a>"+this._getLocalizedLabels("BMP")+"<\/a><\/li><\/ul><\/li>",o="<li class='smartLabels'><a>"+this._getLocalizedLabels("SmartLabels")+"<\/a><ul><li class='rotate45'><a>"+this._getLocalizedLabels("Rotate45")+"<\/a><\/li><li class='rotate90'><a>"+this._getLocalizedLabels("Rotate90")+"<\/a><\/li><li class='trim'><a>"+this._getLocalizedLabels("Trim")+"<\/a><\/li><li class='multipleRows'><a>"+this._getLocalizedLabels("MultipleRows")+"<\/a><\/li><li class='wrap'><a>"+this._getLocalizedLabels("Wrap")+"<\/a><\/li><li class='hiding'><a>"+this._getLocalizedLabels("Hide")+"<\/a><\/li><li class='wrapByWord'><a>"+this._getLocalizedLabels("WrapByWord")+"<\/a><\/li><\/ul><\/li>",s="<li class='interaction'><a>"+this._getLocalizedLabels("Interactions")+"<\/a><ul><li class='crossHair'><a>"+this._getLocalizedLabels("CrossHair")+"<\/a><\/li><li class='trackBall'><a>"+this._getLocalizedLabels("TrackBall")+"<\/a><\/li><li class='none'><a>"+this._getLocalizedLabels("None")+"<\/a><\/li><\/ul><\/li>",h=t.buildTag("ul#"+this._id+"_ContextMenu",t.buildTag("li.toolTip",t.buildTag("a",this._getLocalizedLabels("Tooltip"))[0].outerHTML)[0].outerHTML+t.buildTag("li.legend",t.buildTag("a",this._getLocalizedLabels("Legend"))[0].outerHTML)[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.zooming",t.buildTag("a",this._getLocalizedLabels("Zooming"))[0].outerHTML)[0].outerHTML)+u+f+e+(this.model.enable3D?"":s+o))[0].outerHTML,r,i;n("#"+this._id).append(h);r=this.element.find("#"+this._id+"Container");this.element.find("#"+this._id+"_ContextMenu").ejMenu({width:"150px",menuType:t.MenuType.ContextMenu,contextMenuTarget:r,enableRTL:this.model.enableRTL,click:t.proxy(this._contextMenuClick,this)});i=t.buildTag("span.enabledState").addClass("e-icon").attr("aria-label",this._getLocalizedLabels("EnabledState"))[0].outerHTML;this.model.enable3D?n("#"+this._id+"_ContextMenu").find(".chart3DTypes ."+this.model.commonSeriesOptions.type+" a:eq(0)").append(i):n("#"+this._id+"_ContextMenu").find(".chartTypes ."+this.model.commonSeriesOptions.type+" a:eq(0)").append(i);this.model.commonSeriesOptions.tooltip.visible&&n("#"+this._id+"_ContextMenu").find(".toolTip a:eq(0)").append(i);this.model.zooming.enable&&n("#"+this._id+"_ContextMenu").find(".zooming a:eq(0)").append(i);this.model.legend.visible&&n("#"+this._id+"_ContextMenu").find(".legend a:eq(0)").append(i);this.model.primaryXAxis.labelIntersectAction!="none"&&(n("#"+this._id+"_ContextMenu").find(".smartLabels a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".smartLabels ."+this.model.primaryXAxis.labelIntersectAction+" a:eq(0)").append(i),this.model.primaryXAxis.labelIntersectAction=="hide"&&n("#"+this._id+"_ContextMenu").find(".smartLabels .hiding a:eq(0)").append(i));this.model.crosshair.type=="crosshair"&&this.model.crosshair.visible&&(n("#"+this._id+"_ContextMenu").find(".interaction a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".interaction .crossHair a:eq(0)").append(i),this.mode.enable3D||n("#"+this._id+"_ContextMenu").ejMenu("disableItem",this._getLocalizedLabels("Tooltip")));this.model.crosshair.type=="trackBall"&&this.model.crosshair.visible&&(n("#"+this._id+"_ContextMenu").find(".interaction a:eq(0)").append(i),n("#"+this._id+"_ContextMenu").find(".interaction .trackBall a:eq(0)").append(i),this.mode.enable3D||n("#"+this._id+"_ContextMenu").ejMenu("disableItem",this._getLocalizedLabels("Tooltip")));this.model.crosshair.visible||n("#"+this._id+"_ContextMenu").find(".interaction .none a:eq(0)").append(i)})),this._on(this.element,"click",".menuList",function(r){var h,c,f,s,e,o,u;if(this._curFocus=null,r.target.innerHTML==this._getLocalizedLabels("Exit"))this.element.find("#"+this._id+"ExpandMenu, .expandMenu, .e-dialog").remove();else if(r.target.innerHTML.indexOf(this._getLocalizedLabels("Expand"))>-1)this._drillAction="drilldown",n(this.element).parents(".e-pivotclient").length>0?(e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+e._id+"_maxView")[0]?n("#"+e._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?(f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?this._getChartDrillDown("",f,r):(this._labelCurrentTags.collapsedMembers=n.grep(this._labelCurrentTags.collapsedMembers,function(n){return n!=f}),h=n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==f})[0],c=t.olap._mdxParser._splitCellInfo(h),this._getChartDrillDown(h,c,r))):(s=JSON.stringify(this.model.customObject),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?(f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this._selectedItem=f,t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),this._labelCurrentTags.expandedMembers.push(f),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),customObject:s,currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess)):(u=this,this._isDrilled||(this._isDrilled=!0,jQuery.each(r.target.parentElement.children,function(n,t){t.innerHTML==r.target.innerHTML&&(u._dimensionIndex=n)})),o=this.getOlapReport(),this._drillAction="drilldown",this._selectedItem=this.model.enableRTL?n.trim(r.target.innerHTML.replace(" - "+this._getLocalizedLabels("Expand"),"")):n.trim(r.target.innerHTML.replace(this._getLocalizedLabels("Expand")+" - ","")),jQuery.each(this._labelCurrentTags,function(n,t){if(t.name==u._selectedItem)return u._tagCollection=[],u._tagCollection=u._selectedTags.slice(),u._selectedTagInfo=t.tag,u._selectedMenuItem=t.name,!1}),this._startDrilldown=!0,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,customObject:s}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports,customObject:s}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drilldown#fullchart":"drilldown",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:this._pivotClientObj.reports}),this.renderControlSuccess)));else if(this._drillAction="drillup",n(this.element).parents(".e-pivotclient").length>0?(e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),n("#"+e._id+"_maxView")[0]?n("#"+e._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show()):t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode)f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],this._getChartDrillDown("",f,r);else if(s=JSON.stringify(this.model.customObject),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){var f=this.model.enableRTL?r.target.innerHTML.split(" - ")[0]:r.target.innerHTML.split(" - ")[1],l=!1,a=[];jQuery.map(this._labelCurrentTags.expandedMembers,function(n){n==f&&(l=!0);l||a.push(n)});this._selectedItem=f;this._labelCurrentTags.expandedMembers=a;this._currentDrillInfo=n.extend([],this._labelCurrentTags.expandedMembers,!0).concat([f]);n(this.element).parents(".e-pivotclient").length>0&&(this._labelCurrentTags.expandedMembers=[],e=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),e._drillParams.length>0&&(e._drillParams=n.grep(e._drillParams,function(n){return n.indexOf(f)<0}),e._getDrilledMember()));this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),customObject:s,currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drilledSeries:JSON.stringify(this._labelCurrentTags.expandedMembers),currentReport:JSON.parse(this.getOlapReport()).Report}),this.renderControlSuccess)}else o=this.getOlapReport(),this._drillAction="drillup",this._selectedItem=this.model.enableRTL?n.trim(r.target.innerHTML.replace(" - "+this._getLocalizedLabels("Collapse"),"")):n.trim(r.target.innerHTML.replace(this._getLocalizedLabels("Collapse")+" - ","")),this._tagCollection=[],this._tagCollection=this._selectedTags.slice(),u=this,jQuery.each(this._tagCollection,function(n,t){if(t.name==u._selectedItem)return u._selectedIndex=n,u._selectedTagInfo=t.tag,u._tagCollection.splice(n,u._tagCollection.length),!1}),this._tagCollection.length==0&&(this._isDrilled=!1),this._startDrilldown=!0,this.model.beforeServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,customObject:s}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:reports,customObject:s}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this.model.enableMultiLevelLabels?"drillup#fullchart":"drillup",drilledSeries:this._selectedTagInfo,olapReport:o,clientReports:reports}),this.renderControlSuccess)}),t.isNullOrUndefined(this._pivotClientObj))n(window).on("resize",n.proxy(this._reSizeHandler,this));this._on(this.element,"click",".chart3DImg",function(i){var r=this;r._createDialog(i);n(".chart3DTypesIcon").click(function(n){r._contextMenuClick(n);t.isNullOrUndefined(this._pivotClientObj)||(r._pivotClientObj._unWireEvents(),r._pivotClientObj._wireEvents())})});this.element.parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(this._on(this.element,"click",".toolTipImg",function(){var n=this;this.model.commonSeriesOptions.tooltip.visible=!this.model.commonSeriesOptions.tooltip.visible;this.renderChartFromJSON(this.getJSONRecords());this.model.commonSeriesOptions.tooltip.visible?this.element.find(".toolTipImg").addClass("enabled"):this.element.find(".toolTipImg").removeClass("enabled")}),this._on(this.element,"click",".exportImg",function(t){var i=this;i._createDialog(t);n(".exportTypesIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".smartLabels",function(t){var i=this;i._createDialog(t);n(".smartLabelsIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".interaction",function(t){var i=this;i._createDialog(t);n(".interactionsIcon").click(function(n){i._contextMenuClick(n)})}),this._on(this.element,"click",".legend",function(n){var t=this;t._contextMenuClick(n)}),this._on(this.element,"click",".zooming",function(n){var t=this;t._contextMenuClick(n)}))},_unWireEvents:function(){this._off(n(document),"keydown",this._keyDownPress);n(document.body).off("click");this._off(this.element,"click",".menuList");n(window).off("resize",n.proxy(this._reSizeHandler,this));this._off(this.element,"contextmenu");this._off(this.element,"click",".chartTypesImg");this._off(this.element,"click",".toolTipImg");this._off(this.element,"click",".chart3DImg");this._off(this.element,"click",".exportImg");this._off(this.element,"click",".legend");this._off(this.element,"click",".zooming");this._off(this.element,"click",".smartLabels");this._off(this.element,"click",".interaction")},_createDialog:function(r){var u=this,f,e,o,s;n(r.target).hasClass("exportImg")?(f=t.buildTag("div.exportTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.excel exportTypesIcon").attr({title:this._getLocalizedLabels("Excel"),"aria-label":this._getLocalizedLabels("Excel"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.word exportTypesIcon").attr({title:this._getLocalizedLabels("Word"),"aria-label":this._getLocalizedLabels("Word"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pdf exportTypesIcon").attr({title:this._getLocalizedLabels("Pdf"),"aria-label":this._getLocalizedLabels("Pdf"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.png exportTypesIcon").attr({title:this._getLocalizedLabels("PNG"),"aria-label":this._getLocalizedLabels("PNG"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.emf exportTypesIcon").attr({title:this._getLocalizedLabels("EMF"),"aria-label":this._getLocalizedLabels("EMF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.gif exportTypesIcon").attr({title:this._getLocalizedLabels("GIF"),"aria-label":this._getLocalizedLabels("GIF"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.jpg exportTypesIcon").attr({title:this._getLocalizedLabels("JPG"),"aria-label":this._getLocalizedLabels("JPG"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.bmp exportTypesIcon").attr({title:this._getLocalizedLabels("BMF"),"aria-label":this._getLocalizedLabels("BMF"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.exportTypesDialog").length==0&&(n(f).appendTo(this.element),n(f).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),this.model.enableRTL&&n(f).addClass("e-rtl"))):n(r.target).hasClass("chart3DImg")?(e=t.buildTag("div.chart3DTypesDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.column3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("ColumnTD"),"aria-label":this._getLocalizedLabels("ColumnTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.pie3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("PieTD"),"aria-label":this._getLocalizedLabels("PieTD"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.bar3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("BarTD"),"aria-label":this._getLocalizedLabels("BarTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.stackingbar3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("StackingBarTD"),"aria-label":this._getLocalizedLabels("StackingBarTD"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.stackingcolumn3D chart3DTypesIcon").attr({title:this._getLocalizedLabels("StackingColumnTD"),"aria-label":this._getLocalizedLabels("StackingColumnTD"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.disable3D chart3DTypesIcon")[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.chart3DTypesDialog").length==0&&(n(e).appendTo(this.element),n(e).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),u.model.enable3D&&n("."+this.model.type+"3D").addClass("enabled"),this.model.enableRTL&&n(e).addClass("e-rtl"))):n(r.target).hasClass("smartLabels")?(o=t.buildTag("div.smartLabelsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.rotate45 smartLabelsIcon").attr({title:this._getLocalizedLabels("Rotate45"),"aria-label":this._getLocalizedLabels("Rotate45"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.rotate90 smartLabelsIcon").attr({title:this._getLocalizedLabels("Rotate90"),"aria-label":this._getLocalizedLabels("Rotate90"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.trim smartLabelsIcon").attr({title:this._getLocalizedLabels("Trim"),"aria-label":this._getLocalizedLabels("Trim"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.multipleRows smartLabelsIcon").attr({title:this._getLocalizedLabels("MultipleRows"),"aria-label":this._getLocalizedLabels("MultipleRows"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.wrap smartLabelsIcon").attr({title:this._getLocalizedLabels("Wrap"),"aria-label":this._getLocalizedLabels("Wrap"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.hiding smartLabelsIcon").attr({title:this._getLocalizedLabels("Hide"),"aria-label":this._getLocalizedLabels("Hide"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML+t.buildTag("tr",t.buildTag("td",t.buildTag("div.wrapByWord smartLabelsIcon").attr({title:this._getLocalizedLabels("WrapByWord"),"aria-label":this._getLocalizedLabels("WrapByWord"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.smartLabelsDialog").length==0&&(n(o).appendTo(this.element),n(o).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),u.model.primaryXAxis.labelIntersectAction!="none"&&u.model.primaryXAxis.labelIntersectAction!="hide"&&u.model.primaryXAxis.labelIntersectAction!=i&&n("."+u.model.primaryXAxis.labelIntersectAction).addClass("enabled"),u.model.primaryXAxis.labelIntersectAction=="hide"&&n(".hiding").addClass("enabled"),this.model.enableRTL&&n(o).addClass("e-rtl"))):n(r.target).hasClass("interaction")&&(s=t.buildTag("div.interactionsDialog",t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",t.buildTag("td",t.buildTag("div.crossHair interactionsIcon").attr({title:this._getLocalizedLabels("CrossHair"),"aria-label":this._getLocalizedLabels("CrossHair"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.trackBall interactionsIcon").attr({title:this._getLocalizedLabels("TrackBall"),"aria-label":this._getLocalizedLabels("TrackBall"),tabindex:0})[0].outerHTML)[0].outerHTML+t.buildTag("td",t.buildTag("div.none interactionsIcon").attr({title:this._getLocalizedLabels("None"),"aria-label":this._getLocalizedLabels("None"),tabindex:0})[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML)[0].outerHTML),this.element.find("div.interactionsDialog").length==0&&(n(s).appendTo(this.element),n(s).css("left",r.target.offsetLeft+20+"px").css("top",r.target.offsetTop+15+"px"),this.model.crosshair.type=="crosshair"&&this.model.crosshair.visible&&this.element.find(".crossHair").addClass("enabled"),this.model.crosshair.type=="trackBall"&&this.model.crosshair.visible&&this.element.find(".trackBall").addClass("enabled"),this.model.crosshair.visible||this.element.find(".none").addClass("enabled"),this.model.enableRTL&&n(s).addClass("e-rtl")))},_contextMenuClick:function(i){chrtObj=n("#"+this._id).data("ejPivotChart");var r=n(this.element).parents(".e-pivotclient").length>0?n(i.target).attr("class").split(" ")[0]:n(i.element).attr("class").split(" ")[0];if(n(i.element).parents().hasClass("chartTypes"))chrtObj.model.enable3D=!1,chrtObj.model.type=chrtObj.model.commonSeriesOptions.type=r,chrtObj.model.type=="funnel"&&(chrtObj.model.commonSeriesOptions.marker={dataLabel:{visible:!0,shape:"none",font:{color:"white",size:"12px",fontWeight:"lighter"}}}),(chrtObj.model.type=="pie"||chrtObj.model.type=="doughnut")&&(chrtObj.model.commonSeriesOptions.explode=!0),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("toolTip"))chrtObj.model.commonSeriesOptions.tooltip.visible=!chrtObj.model.commonSeriesOptions.tooltip.visible,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("legend")||n(i.target).hasClass("legend"))chrtObj.model.legend.visible=!chrtObj.model.legend.visible,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).hasClass("zooming")||n(i.target).hasClass("zooming"))chrtObj.model.zooming.enable=!chrtObj.model.zooming.enable,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("smartLabels")||n(i.target).hasClass("smartLabelsIcon"))chrtObj.model.primaryXAxis.labelIntersectAction=r=="hiding"?"hide":r,chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("interaction")||n(i.target).hasClass("interactionsIcon"))r=="crossHair"&&(chrtObj.model.crosshair.type=t.datavisualization.Chart.CrosshairType.Crosshair,chrtObj.model.crosshair.visible=!0),r=="trackBall"&&(chrtObj.model.crosshair.type=t.datavisualization.Chart.CrosshairType.TrackBall,chrtObj.model.crosshair.visible=!0),r=="none"&&(chrtObj.model.crosshair.visible=!1),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else if(n(i.element).parents().hasClass("chart3DTypes")||n(i.target).hasClass("chart3DTypesIcon"))chrtObj.model.enable3D=!0,r!="disable3D"&&(r=r.split("3")[0]),r=="disable3D"&&(chrtObj.model.enable3D=!1,r=chrtObj.model.commonSeriesOptions.type),chrtObj.model.type=chrtObj.model.commonSeriesOptions.type=r,r=="pie"&&(chrtObj.model.rotation=24),chrtObj.renderControlSuccess({JsonRecords:JSON.stringify(chrtObj.getJSONRecords()),OlapReport:chrtObj.getOlapReport()});else{n(this.element).parents(".e-pivotclient").length>0&&!t.isNullOrUndefined(this._pivotClientObj)&&(this.model.beforeExport=this._pivotClientObj.model.beforeExport);switch(r){case"excel":case"word":case"pdf":chrtObj.exportPivotChart(r,"Sample");break;case"png":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.PNG);break;case"emf":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.EMF);break;case"gif":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.GIF);break;case"jpg":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.JPG);break;case"bmp":chrtObj.exportPivotChart(r,"Sample",t.PivotChart.ExportOptions.BMP)}}},generateJSON:function(n,i){var u,r,f;if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&this._labelCurrentTags.expandedMembers.length>0&&!this.model.enableMultiLevelLabels)for(u=0,r=0;r<this._labelCurrentTags.expandedMembers.length;r++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[r])&&this._labelCurrentTags.expandedMembers[r].length>0)for(r>0&&!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[r-1])&&this._labelCurrentTags.expandedMembers[r-1].length>0&&this._cropData(i,this._selectedSeriesInfo[r-1].split("::")[2],r-1+u,!1),f=0;f<this._labelCurrentTags.expandedMembers[r].length;f++)this._cropData(i,this._labelCurrentTags.expandedMembers[r][f].split("::")[2],r+u,!0),u++;this._generateData(i)},_jsonToEngine:function(n){for(var u,f=JSON.parse(n),i=[],r=0;r<f.length;r++)u=parseInt(f[r].Index.split(",")[0]),t.isNullOrUndefined(i[u])?(i[u]=[],i[u].push(f[r])):i[u].push(f[r]);return i},_generateData:function(r){var ht=!1,s,k,o,a,rt,ut,d,v,w,g,b,ct,p,f,ot,u;if(ht=r[2]!=i?r[2].Value=="Olap"||r[2]=="Olap"?!0:!1:r.d!=i?!t.isNullOrUndefined(r.d[2])&&r.d[2].Value=="Olap"?!0:!1:r.AnalysisMode=="Olap"?!0:!1,ht)this.renderControlSuccess(r);else{var e={seriesNames:[],chartLables:[],labelTags:[],multiLevelLabels:[],multiLevelLabelTags:[],seriesTags:[],points_Y:[],labelFormat:[],measureNames:""},tt="",st=[];if(this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&(s={},r[0]!=i?(n(this.element).parents(".e-pivotclient").length>0?s.JsonRecords=t.isNullOrUndefined(r[0].Value)?r[0]:r[0].Value:(s.JsonRecords={},s.JsonRecords.ChartJSON=t.isNullOrUndefined(r[0].Value)?r[0]:r[0].Value,s.JsonRecords.GridJSON=t.isNullOrUndefined(r[3].Value)?r[3]:r[3].Value),s.PivotReport=t.isNullOrUndefined(r[1].Value)?r[1]:r[1].Value,r=s):r.d!=i&&(n(this.element).parents(".e-pivotclient").length>0?s.JsonRecords=!t.isNullOrUndefined(r.d[0])&&r.d[0].Key=="JsonRecords"?r.d[0].Value:[]:(s.JsonRecords={},s.JsonRecords.ChartJSON=!t.isNullOrUndefined(r.d[0])&&r.d[0].Key=="JsonRecords"?r.d[0].Value:[],s.JsonRecords.GridJSON=!t.isNullOrUndefined(r.d[3])&&r.d[3].Key=="GridJSON"?r.d[3].Value:[]),s.PivotReport=!t.isNullOrUndefined(r.d[1])&&(r.d[1].Key=="PivotReport"||r.d[1].Key=="OlapReport")?r.d[1].Value:[],r=s),tt=r.PivotReport||r.OlapReport,r=t.isNullOrUndefined(r.JsonRecords.GridJSON)?t.isNullOrUndefined(r.GridJSON)?r.JsonRecords:this._jsonToEngine(r.GridJSON):this._jsonToEngine(r.JsonRecords.GridJSON),this._pivotEngine=r,st=t.isNullOrUndefined(JSON.parse(tt).values)?JSON.parse(tt).PivotCalculations:JSON.parse(JSON.parse(tt).values),e.labelFormat=n.map(st,function(n){return n.Format.toLowerCase()})),k=r.length,k>0&&r[0].length>0){var et=r[0].length,it=[],nt=[];for(o=this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&!this.model.enableMultiLevelLabels?this.model.dataSource.rows.length-this._labelCurrentTags.expandedMembers.length:this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?r[0][0].ColSpan:this.model.dataSource.rows.length:r[0][0].ColSpan,this.model.enableMultiLevelLabels&&(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode||this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)?a=r[0][0].RowSpan:(a=this.model.dataSource.columns.length,this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot?a+=this.model.dataSource.values.length>0?1:0:a=r[0][0].RowSpan),rt="",u=o;u<k;u++){for(ut="",d=!1,f=0;f<a;f++)if(!t.isNullOrUndefined(r[u][f])){if(r[u][f].CSS.indexOf("summary")>=0){d=!0;it.push(u);break}r[u][f].Info.indexOf("Measure")>=0&&rt.indexOf(r[u][f].Value)<0&&(rt+=rt==""?r[u][f].Value:"~~"+r[u][f].Value);ut+=(ut==""?"":r[u][f].Value==""?"":"~~")+r[u][f].Value}d||ut==""||e.seriesNames.push(ut)}for(u=a;u<et;u++)if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){if(this.model.enableMultiLevelLabels&&o>1){this._drillParams=this._drillAction!=""?this._drillParams:[];var c=n.extend(!0,[],this._drillParams.sort()),l=c.length>0?-1:0,ft="";for(u=a;u<et;u++)for(v=c[0],w="",f=0;f<o;f++)w+=w==""?r[f][u].Value:">#>"+r[f][u].Value,(l==-1||ft==""||w==c[1])&&(w==v||w==c[1])&&(w==c[1]&&(v=c[1],c.splice(0,1)),l=f+1,ft=w),!t.isNullOrUndefined(v)&&l>0&&l==o-1&&f==o-1?(nt.push(u),e.chartLables.push(v.split(">#>").join("~~")+"~~"+r[f][u].Value)):!t.isNullOrUndefined(v)&&l>0&&l==f&&r[f][u].CSS.indexOf("summary")>-1?(nt.push(u),e.chartLables.push(v.split(">#>").join("~~")+"~~"+r[f][u].Value.split(" Total")[0])):l-1==f&&r[f][u].CSS.indexOf("summary")>-1?(ft!=""&&(c[0]=c[0].split(">#>").slice(0,c[0].split(">#>").length-1).join(">#>"),c[0]==""&&(c.splice(0,1),ft="")),l=l-1):(l==0||ft=="")&&f==0&&r[0][u].CSS.indexOf("summary")>-1&&(t.isNullOrUndefined(v)?!0:v.split(">#>")[0]!=r[0][u].Value.split(" Total")[0])&&r[f][u].Value!="Grand Total"&&(nt.push(u),e.chartLables.push(r[f][u].Value.split(" Total")[0]))}else o>1?r[0][u].CSS=="summary rstot"&&r[0][u].Value!="Grand Total"&&e.chartLables.push(r[0][u].Value.replace(" Total","")):r[0][u].CSS=="rowheader"&&e.chartLables.push(r[0][u].Value);this.model.enableMultiLevelLabels&&(e.multiLevelLabels=n.extend(!0,[],e.chartLables))}else if(t.isNullOrUndefined(this._labelCurrentTags.collapsedMembers)&&(this._labelCurrentTags.collapsedMembers=[]),o>1){var h="",d=!1,y="";for(f=0;f<o;f++)if(r[f][u].CSS=="rowheader")h+=h==""?r[f][u].Value:(r[f][u].Info!=""&&r[f-1][u].Info!=""&&r[f][u].Info.split("::")[3]==r[f-1][u].Info.split("::")[0]?"#":"~~")+r[f][u].Value,r[f][u].Info.indexOf("[Measures]")==-1&&(y+=y==""?r[f][u].Info:(r[f][u].Info!=""&&r[f-1][u].Info!=""&&r[f][u].Info.split("::")[3]==r[f-1][u].Info.split("::")[0]?"#":"~~")+r[f][u].Info),n.inArray(r[f][u].Value,this._labelCurrentTags.collapsedMembers)<0&&r[f][u].State==2&&this._labelCurrentTags.collapsedMembers.push(r[f][u].Value),n.inArray(r[f][u].Info,e.seriesTags)<0&&r[f][u].Info.indexOf("[Measures]")==-1&&e.seriesTags.push(r[f][u].Info);else if((!this.model.enableMultiLevelLabels||h==""||r[f][u].CSS.indexOf("summary")>=0)&&(this.model.enableMultiLevelLabels?!0:r[f][u].CSS.indexOf("none")==-1&&r[f][u].CSS.indexOf("value")==-1)){d=!0;nt.push(u);break}d||(e.chartLables.push(h),e.labelTags.push(y))}else r[0][u].CSS=="rowheader"&&(e.chartLables.push(r[0][u].Value),e.labelTags.push(r[0][u].Info),e.seriesTags.push(r[0][u].Info)),r[0][u].State==2&&this._labelCurrentTags.collapsedMembers.push(r[0][u].Value);if(this.model.enableMultiLevelLabels)if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){for(g=0,f=0;f<e.multiLevelLabels.length;f++)e.multiLevelLabels[f]=n.map(e.multiLevelLabels[f].split("~~"),function(n){return n+"#1"}).join("~~"),g=e.multiLevelLabels[f].split("~~").length>g?e.multiLevelLabels[f].split("~~").length:g;for(b=0;b<e.multiLevelLabels.length;b++)if(g>1&&e.multiLevelLabels[b].split("~~").length<g){ct=e.multiLevelLabels[b].split("~~")[e.multiLevelLabels[b].split("~~").length-1].split("#1")[0];do e.multiLevelLabels[b]+="~~"+ct+"#0";while(e.multiLevelLabels[b].split("~~").length<g)}}else for(u=a;u<et;u++)if(o>1){var h="",y="",d=!1;for(f=0;f<o;f++)if(r[f][u].CSS=="rowheader")h+=h==""?r[f][u].Value+"#"+r[f][u].Expander:"~~"+(r[f][u].Value+"#"+r[f][u].Expander),y+=y==""?r[f][u].Info+"::"+r[f][u].State:"~~"+(r[f][u].Info+"::"+r[f][u].State);else if(r[f][u].CSS.indexOf("none")>=0&&h!="")h+="~~"+h.split("~~")[h.split("~~").length-1].split("#")[0]+"#"+r[f][u].Expander,y+="~~"+y.split("~~")[y.split("~~").length-1];else if(h==""||r[f][u].CSS.indexOf("summary")>=0||r[f][u].CSS.indexOf("value")>=0){d=r[f][u].CSS.indexOf("summary")>=0?!0:!1;break}d||h==""||(e.multiLevelLabels.push(h),e.multiLevelLabelTags.push(y))}else r[0][u].CSS=="rowheader"&&(e.multiLevelLabels.push(r[0][u].Value+"#"+r[0][u].Expander),e.multiLevelLabelTags.push(r[0][u].Info+"::"+r[0][u].State));for(u=a;u<et;u++)if(p=[],o>1){if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot){if(this.model.enableMultiLevelLabels){if(n.inArray(u,nt)>-1){for(f=o;f<k;f++)n.inArray(f,it)<0&&p.push(r[f][u].Value);e.points_Y.push(p)}}else if(r[0][u].CSS=="summary rstot"&&r[0][u].Value!="Grand Total"){for(f=o;f<k;f++)n.inArray(f,it)<0&&p.push(r[f][u].Value);e.points_Y.push(p)}}else if(n.inArray(u,nt)<0){for(f=o;f<k;f++)n.inArray(f,it)<0&&r[f][u].CSS.indexOf("value")>-1&&p.push(r[f][u].Value==""?0:t.parseFloat(r[f][u].Value,this.locale()));e.points_Y.push(p)}}else if(r[0][u].CSS=="rowheader"){for(f=r[0][0].ColSpan;f<k;f++)n.inArray(f,it)<0&&p.push(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?r[f][u].Value==""?0:t.parseFloat(r[f][u].Value,this.locale()):r[f][u].Value);e.points_Y.push(p)}}if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)e.measureNames=rt;else for(ot=this.model.enableMultiLevelLabels&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?n(st).map(function(n,t){return t.FieldHeader}):n(this.model.dataSource.values).map(function(n,t){return t.fieldCaption}),u=0;u<ot.length;u++)e.measureNames+=e.measureNames==""?ot[u]:"~"+ot[u];this.model.enableMultiLevelLabels&&this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?this.renderControlSuccess({JsonRecords:JSON.stringify(e),OlapReport:tt}):this.renderControlSuccess({JsonRecords:JSON.stringify(e),OlapReport:JSON.stringify(this.model.dataSource)});e={}}},_cloneEngine:function(t){for(var r=n.extend([],t),i=0;i<t.length;i++)r[i]=n.extend([],t[i]);return r},_cropData:function(n,i,r,u){for(var f=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?n[0][0].RowSpan:this.model.dataSource.columns.length+(this.model.dataSource.values.length==0||this.model.dataSource.values[0].axis=="rows"?0:1),e;f<n[r].length;)if(n[r][f].Value!=i)for(e=0;e<n.length;e++)n[e].splice(f,1);else f+=n[r][f].RowSpan;this.model.analysisMode!=t.PivotChart.AnalysisMode.Olap&&u&&n.splice(r,1)},refreshPagedPivotChart:function(n,t){typeof ochartWaitingPopup!="undefined"&&ochartWaitingPopup!=null&&ochartWaitingPopup.show();n=n.indexOf("categ")!=-1?"categorical":"series";var i;try{i=JSON.parse(this.getOlapReport())}catch(r){i=this.getOlapReport()}this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.paging,JSON.stringify({action:"paging",pagingInfo:n+":"+t,currentReport:i,customObject:JSON.stringify(this.model.customObject)}),this.renderControlSuccess)},_updatePageSettings:function(t,i){var r=n.map(t,function(n){if(n.Key=="PageSettings")return n}),u=n.map(t,function(n){if(n.Key=="HeaderCounts")return n});r.length>0&&i._pagerObj!=null&&(i._pagerObj.element.css("opacity","1"),i._pagerObj.element.find(".pagerTextBox").removeAttr("disabled"),i._pagerObj._unwireEvents(),i._pagerObj._wireEvents(),i._pagerObj.initPagerProperties(JSON.parse(u[0].Value),JSON.parse(r[0].Value)))},renderControlSuccess:function(r){var h,e,o,c,l,f,u,s;typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&(n("#"+this._pivotClientObj._id+"_maxView")[0]?n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!0}):oclientWaitingPopup.show());try{if(r[0]!=i?(this.setJSONRecords(r[0].Value),this.setOlapReport(r[1].Value),t.isNullOrUndefined(r[2])||r[2].Key!="AnalysisMode"||r[2].Value!="Olap"||(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r[1].Value,r[2]!=null&&r[2]!=i&&r[2].Key=="ClientReports"&&(this._pivotClientObj.reports=r[2].Value),this._updatePageSettings(r,this._pivotClientObj)),r[2]!=null&&r[2]!=i&&!r[2].Key=="ClientReports"&&r[2].Key!="AnalysisMode"&&(this.model.customObject=r[2].Value),n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&this._pagerObj!=null&&r[2]!=null&&r.d[2]!=i&&this._pagerObj.initPagerProperties(JSON.parse(r.d[3].Value),JSON.parse(r.d[2].Value))):r.d!=i?(this.setJSONRecords(r.d[0].Value),this.setOlapReport(r.d[1].Value),r.d[2].Key=="AnalysisMode"&&r.d[2].Value=="Olap"&&(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r.d[1].Value,r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="ClientReports"&&(this._pivotClientObj.reports=r.d[2].Value),this._updatePageSettings(r.d,this._pivotClientObj)),r.d[2]==null||r.d[2]==i||r.d[2].Key=="ClientReports"||(this.model.customObject=r.d[2].Value),this._pagerObj!=null&&n(".e-pivotpager")[0]!=null&&n(".e-pivotpager")[0]!=i&&(r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="PageSettings"&&this._pagerObj.initPagerProperties(JSON.parse(r.d[3].Value),JSON.parse(r.d[2].Value)),r.d[3]!=null&&r.d[3]!=i&&r.d[3].Key=="PageSettings"&&this._pagerObj.initPagerProperties(JSON.parse(r.d[4].Value),JSON.parse(r.d[3].Value)))):(this.setJSONRecords(r.JsonRecords),this.setOlapReport(r.OlapReport),r.AnalysisMode=="Olap"&&(this.model.analysisMode=t.PivotChart.AnalysisMode.Olap),r.customObject!=null&&r.customObject!=null&&(this.model.customObject=r.customObject),t.isNullOrUndefined(this._pivotClientObj)||(typeof this._pivotClientObj.currentReport!="undefined"&&(this._pivotClientObj.currentReport=this.model.analysisMode==t.Pivot.AnalysisMode.Pivot?JSON.parse(this.getOlapReport()).Report:r.OlapReport),typeof this._pivotClientObj.reports!="undefined"&&r.reports!=i&&r.reports!="undefined"&&(this._pivotClientObj.reports=r.reports))),this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&(h=this._drillAction!=""?{action:this._drillAction,element:this.element,customObject:this.model.customObject}:{action:this._currentAction,element:this.element,customObject:this.model.customObject},this._trigger("afterServiceInvoke",h)),e=t.buildTag("div#"+this._id+"Container","",{height:t.isNullOrUndefined(this._pivotClientObj)?this.element.height():this._pivotClientObj._chartHeight,width:t.isNullOrUndefined(this._pivotClientObj)?this.element.width():this._pivotClientObj.model.enableSplitter?this._pivotClientObj.element.find(".controlPanelTD").width():this._pivotClientObj._toggleExpand?this._pivotClientObj.element.find(".controlPanelTD").width()-15:n("#"+this._pivotClientObj._id+"_maxView").length>0&&this._pivotClientObj._pivotChart?n("#"+this._pivotClientObj._pivotChart._id+"Container").width():this._pivotClientObj._chartWidth})[0].outerHTML,n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen?(o=this._pivotClientObj.model.enableSplitter?n("<div id="+this._id+"toolBar style='width:"+this._pivotClientObj._chartWidth+";height:"+this._pivotClientObj._chartHeight+";margin-top:35px;margin-left:5px'><\/div>"):n("<div id="+this._id+"toolBar style='width:"+this._pivotClientObj._chartWidth+";height:"+this._pivotClientObj._chartHeight+";overflow:auto;margin-top:35px;margin-left:5px'><\/div>"),n(o).html(e),this.element.html(o)):this.element.html(e),this.model.legend.toggleSeriesVisibility=this.model.commonSeriesOptions.type==t.PivotChart.ChartTypes.Funnel||this.model.commonSeriesOptions.type==t.PivotChart.ChartTypes.Pyramid?!1:!0,this.renderChartFromJSON(this.getJSONRecords()),n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&(n("#"+this._id).prepend("<div class='chartToolBar' style='height:40px;width:"+this._pivotClientObj.element.find(".chartContainer").width()+"px'><\/div>"),c=t.buildTag("ul",t.buildTag("li.chart3DImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("TDCharts")).attr({title:this._getLocalizedLabels("TDCharts"),tabindex:0})[0].outerHTML+t.buildTag("li.exportImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Exporting")).attr({title:this._getLocalizedLabels("Exporting"),tabindex:0})[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.smartLabels e-icon","",{}).attr("aria-label",this._getLocalizedLabels("SmartLabels")).attr({title:this._getLocalizedLabels("SmartLabels"),tabindex:0})[0].outerHTML)+(this.model.enable3D?"":t.buildTag("li.interaction e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Interactions")).attr({title:this._getLocalizedLabels("Interactions"),tabindex:0})[0].outerHTML))[0].outerHTML+t.buildTag("ul",t.buildTag("li#"+this._id+"_toolTipImg.toolTipImg e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Tooltip")).attr({title:this._getLocalizedLabels("Tooltip"),tabindex:0})[0].outerHTML+t.buildTag("li.legend e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Legend")).attr({title:this._getLocalizedLabels("Legend"),tabindex:0})[0].outerHTML+(this.model.enable3D?"":t.buildTag("li.zooming e-icon","",{}).attr("aria-label",this._getLocalizedLabels("Zooming")).attr({title:this._getLocalizedLabels("Zooming"),tabindex:0})[0].outerHTML))[0].outerHTML,n(".chartToolBar").append(n(c)),n(".chartToolBar").ejToolbar({enableRTL:this.model.enableRTL,enableSeparator:!0,height:"35px"}),this.model.enable3D&&this.element.find(".chart3DImg").addClass("enabled"),this.model.zooming.enable&&this.element.find(".zooming").addClass("enabled"),this.model.legend.visible&&this.element.find(".legend").addClass("enabled"),t.isNullOrUndefined(this.model.primaryXAxis.labelIntersectAction)||this.element.find(".smartLabels").addClass("enabled"),this.model.commonSeriesOptions.tooltip.visible&&this.element.find(".toolTipImg").addClass("enabled"),this.model.crosshair.visible&&this.element.find(".interaction").addClass("enabled"),this.model.crosshair.type=="trackball"&&this.element.find(".trackBall").addClass("enabled"),this.model.crosshair.type=="crosshair"&&this.element.find(".crossHair").addClass("enabled"),this.model.crosshair.visible||this.element.find(".none").addClass("enabled"),this._pivotClientObj._unWireEvents(),this._pivotClientObj._wireEvents()),this._unWireEvents(),this._wireEvents(),this._drillAction!=""){if(this.model.currentReport=this.getOlapReport(),this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&!this.model.enableMultiLevelLabels)if(this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode){if(f=this.getJSONRecords(),this.model.dataSource.rows.length-this._labelCurrentTags.expandedMembers.length>1)for(this._labelCurrentTags.collapsedMembers=[],u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u])}else if(f=this.getJSONRecords(),l=t.isNullOrUndefined(JSON.parse(this.getOlapReport()).rows)?JSON.parse(this.getOlapReport()).PivotRows:JSON.parse(JSON.parse(this.getOlapReport()).rows),this._labelCurrentTags.collapsedMembers=[],l.length-this._labelCurrentTags.expandedMembers.length>1)for(u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u]);this._trigger("drillSuccess",this.element)}else if(this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot)if(this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode){if(f=this.getJSONRecords(),this._labelCurrentTags={collapsedMembers:[]},this.model.dataSource.rows.length>1)for(u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u])}else if(f=this.getJSONRecords(),this.model.currentReport=JSON.parse(this.getOlapReport()),this._labelCurrentTags={collapsedMembers:[]},n(this.element).parents(".e-pivotclient").length>0?this.model.currentReport.PivotRows.length>1:JSON.parse(this.model.currentReport.rows).length>1)for(u=0;u<f.chartLables.length;u++)this._labelCurrentTags.collapsedMembers.push(f.chartLables[u]);s=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(s)||(s._isTimeOut=!1);typeof this._pivotClientObj!="undefined"&&this._pivotClientObj._waitingPopup!=null?(n("#"+this._pivotClientObj._id+"_maxView")[0]?(n("#"+this._pivotClientObj._id+"_maxView").ejWaitingPopup({showOnInit:!1}),this._pivotClientObj._waitingPopup.hide()):t.isNullOrUndefined(this._pivotClientObj._pivotGrid)||(this._pivotClientObj&&this._pivotClientObj._pivotGrid._drillAction&&!this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._drillAction&&!this._pivotClientObj._pivotChart._startDrilldown?this._pivotClientObj._waitingPopup.hide():!this._pivotClientObj||this._pivotClientObj._pivotGrid._drillAction!=""||this._pivotClientObj._pivotChart._drillAction!=""||this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._startDrilldown||this._pivotClientObj._pivotGrid._JSONRecords==null&&this._pivotClientObj._pivotChart._JSONRecords!=null?!this._pivotClientObj._pivotChart._startDrilldown||this._pivotClientObj._pivotGrid._startDrilldown||n("#"+this._pivotClientObj._id+"_maxView")[0]?this._pivotClientObj._pivotChart._startDrilldown||this._pivotClientObj._pivotGrid._startDrilldown||this._pivotClientObj._pivotChart._drillAction!=""||this._pivotClientObj._pivotGrid._drillAction!=""||this._pivotClientObj._pivotGrid._JSONRecords==null&&this._pivotClientObj._pivotChart._JSONRecords!=null||this._pivotClientObj._waitingPopup.hide():this._pivotClientObj._waitingPopup.show():this._pivotClientObj._waitingPopup.hide()),this._pivotClientObj.model.displaySettings.mode=="chartonly"&&this._pivotClientObj._waitingPopup.hide()):this._waitingPopup.hide();t.isNullOrUndefined(this._pivotClientObj)||(this._pivotClientObj._pivotChart._startDrilldown=!1)}catch(a){}t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this);this._trigger("renderSuccess",this)},renderChartFromJSON:function(r){var d,vt,h,et,rt,e,g,ot,a,nt,st,tt,ut,it,b,y,ht,ct,u,f,lt,p,yt,pt,s,at;if(this.setJSONRecords(JSON.stringify(r)),d=[],r==null||r=="")r==""&&(vt=t.buildTag("div#"+this._id+"Container")[0].outerHTML,this.element.html(vt)),d=[],this.model.primaryXAxis.multiLevelLabels=[];else if(r!=null&&r.chartLables.length>0&&r.points_Y.length>0){s=this;this.model.enableRTL&&(r.chartLables=n.map(r.chartLables,function(n){return n.split("~~").map(function(n){return n.split("#").reverse().join("#")}).reverse().join("~~")}),r.seriesNames=n.map(r.seriesNames,function(n){return n.split("~~").map(function(n){return n.split("#").reverse().join("#")}).reverse().join("~~")}));h=[];h=s.model.analysisMode==t.PivotChart.AnalysisMode.Olap?n.map(n.extend([],r.chartLables,!0),function(n){return n.split("#").join("~~")}):n.map(n.extend([],r.chartLables,!0),function(n){return!t.isNullOrUndefined(s._labelCurrentTags.expandedMembers)&&s._labelCurrentTags.expandedMembers.length>0?s._labelCurrentTags.expandedMembers.join("~~")+"~~"+n:n});var ft=[],dt=h,w=[],v=pCnt=0,y=0,o,c=0;if(c=r.measureInfo!=""?parseInt(r.measureInfo):0,jQuery.each(h,function(n){var l=[],e,f,u;if(c>1&&r.addInfo.action!="DrillChart"||c>1&&r.addInfo.levelHash=="1"){for(e=(n+1)*c-c,f=0;f<c;f++)if(r.points_Y[e+f]!=i&&h[n].split("~~")[0]==r.points_Y[e+f][0].Item1)for(u=0;u<r.points_Y[n].length;u++)o={xValues:h[n],yValues:r.points_Y[e+f][u].Item2.indexOf(",")>-1?t.globalize.parseFloat(t.globalize.format(r.points_Y[e+f][u].Item2,"c",s.model.locale),s.model.locale):r.points_Y[e+f][u].Item2==""?0:t.globalize.parseFloat(r.points_Y[e+f][u].Item2),text:r.points_Y[e+f][u].Item2==""?0:r.points_Y[e+f][u].Item2},o.yValues=t.isNullOrUndefined(o.yValues)?o.yValues:jQuery.isNumeric(o.yValues)?o.yValues:t.globalize.parseFloat(r.points_Y[e+f][u].Item2.toString().replace(/[^\d.,-]/g,"")),l.push(o)}else for(u=0;u<r.points_Y[n].length;u++)s.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&s.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?(o=s.seriesType()=="bubble"?{xValues:h[n],yValues:r.points_Y[n][u].Item2==""?0:r.points_Y[n][u].Item2,size:r.points_Y[n][u].Item2==""?0:r.points_Y[n][u].Item2}:{xValues:h[n],yValues:r.points_Y[n][u].Item2==""?0:t.globalize.parseFloat(r.points_Y[n][u].Item2),text:r.points_Y[n][u].Item2==""?0:r.points_Y[n][u].Item2},o.yValues=t.isNullOrUndefined(o.yValues)?o.yValues:jQuery.isNumeric(o.yValues)?o.yValues:t.globalize.parseFloat(r.points_Y[n][u].Item2.toString().replace(/[^\d.,-]/g,""))):(o=s.seriesType()=="bubble"?{xValues:h[n].toString().split("#")[h[n].toString().split("#").length-1],yValues:r.points_Y[n][u]==""?0:r.points_Y[n][u],size:r.points_Y[n][u]==""?0:r.points_Y[n][u]}:{xValues:h[n].toString().split("#")[h[n].toString().split("#").length-1],yValues:r.points_Y[n][u]==""?0:r.points_Y[n][u],text:r.points_Y[n][u]==""?0:r.points_Y[n][u]},o.yValues=t.isNullOrUndefined(o.yValues)?o.yValues:jQuery.isNumeric(o.yValues)?o.yValues:t.globalize.parseFloat(r.points_Y[n][u].toString().replace(/[^\d.,-]/g,""))),l.push(o);ft.push(l)}),c>1&&r.addInfo.action!="DrillChart"||c>1&&r.addInfo.levelHash=="1")for(et=0;et<c*r.seriesNames.length;et++)w.push([]);else jQuery.each(r.seriesNames,function(){w.push([])});if(jQuery.each(h,function(n){for(var i=0;i<ft[n].length;i++)t.isNullOrUndefined(w[i])&&(w[i]=[]),w[i].push(ft[n][i])}),c>1&&r.addInfo.action!="DrillChart"||c>1&&r.addInfo.levelHash=="1")for(rt=0;rt<c*r.seriesNames.length;rt++)d[pCnt]={dataSource:w[rt],xName:"xValues",yName:"yValues",name:r.seriesNames[v]},v++,pCnt++,v==r.seriesNames.length&&(v=0);else this.seriesType()=="bubble"?(jQuery.each(r.seriesNames,function(n){d[v]={dataSource:w[n],xName:"xValues",yName:"yValues",size:"size",name:r.seriesNames[v]};v++}),this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1)):(jQuery.each(r.seriesNames,function(n){d[v]={dataSource:w[n],xName:"xValues",yName:"yValues",name:r.seriesNames[v],marker:{dataLabel:{textMappingName:"text"}}};v++}),this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1));if(this.model.enableMultiLevelLabels&&!t.isNullOrUndefined(r.multiLevelLabels)){for(this.model.primaryXAxis.majorTickLines={size:0},e=[],g=[],u=0;u<r.multiLevelLabels.length;u++)g.push(r.multiLevelLabels[u].split("~~"));for(u=r.multiLevelLabels[0].split("~~").length-1;u>=0;u--){for(ot=[],f=0;f<r.multiLevelLabels.length;f++){if(a={},a.name=r.multiLevelLabels[f].split("~~")[u].split("#")[0],this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode)a.rowSpan=parseInt(r.multiLevelLabels[f].split("~~")[u].split("#")[1]),a.colSpan=parseInt(r.multiLevelLabels[f].split("~~")[u].split("#")[2]),a.tag=r.multiLevelLabelTags[f].split("~~")[u];else{if(u==r.multiLevelLabels[0].split("~~").length-1)a.colSpan=1;else{for(nt="",st=0,k=f;k<g.length;k++){for(tt="",l=u;l>=0;l--)tt+=tt==""?g[k][l]:"$"+g[k][l];if(st+=nt==""||nt==tt?1:0,nt!=tt&&nt!="")break;else nt=tt}a.colSpan=st}if(parseInt(r.multiLevelLabels[f].split("~~")[u].split("#")[1])==0){for(b=0,ut=u;ut>=0;ut--)if(b++,parseInt(g[f][ut].split("#")[1])>0)break;a.rowSpan=b}else a.rowSpan=1;a.tag=t.isNullOrUndefined(r.multiLevelLabelTags[f])?"":r.multiLevelLabelTags[f].split("~~")[u]}ot.push(a)}e.push(ot)}if(it=[],this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){for(f=0;f<e[0].length;f++)for(u=e.length-1;u>=0;u--)if(!t.isNullOrUndefined(e[u][f])&&e[u][f].rowSpan>1&&it.indexOf(u+"-"+f)==-1){b=e[u][f].rowSpan;y=1;do delete e[u-y][f],y++;while(b>y);it.push(u+"-"+f)}}else for(f=0;f<e[0].length;f++)for(u=0;u<e.length;u++)if(!t.isNullOrUndefined(e[u][f])&&e[u][f].rowSpan>1&&it.indexOf(u+"-"+f)==-1){b=e[u][f].rowSpan;y=0;do delete e[u+y][f],y++;while(b>y+1);e[u+y][f].rowSpan=b;it.push(u+y+"-"+f)}for(ht=[],ct=this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotRows)?JSON.parse(JSON.parse(this.getOlapReport()).rows).length:JSON.parse(this.getOlapReport()).PivotRows.length:this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?this.model.dataSource.rows.length:0,u=0;u<e.length;u++)for(f=0;f<e[u].length;f++)t.isNullOrUndefined(e[u][f])||(lt=f-.5,p={},p.visible=!0,p.text=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?e[u][f].tag.endsWith("2")?"+ "+e[u][f].name:e[u][f].tag.endsWith("1")?"- "+e[u][f].name:e[u][f].name:ct==e.length&&u==0?e[u][f].name:u==0||e[u][f].rowSpan>1?"+ "+e[u][f].name:"- "+e[u][f].name,p.tag=this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?e[u][f].tag:ct==e.length&&u==0?e[u][f].name+"#0":u==0||e[u][f].rowSpan>1?e[u][f].name+"#1":e[u][f].name+"#2",p.start=lt,p.end=lt+e[u][f].colSpan,p.level=u,p.span=e[u][f].rowSpan>1?!0:!1,ht.push(p),f+=e[u][f].colSpan-1);this.model.primaryXAxis.multiLevelLabels=ht;this.model.zooming.enableScrollbar=!0}else r.chartLables.length>10&&this.model.zooming==""?this.model.zooming={enable:!0,type:"x,y",enableMouseWheel:!0}:r.chartLables.length<10&&this._initZooming==""&&(this.model.zooming=this._initZooming);if(jQuery.inArray(this.seriesType(),["line","spline","area","splinearea","stepline","steparea","stackingarea","scatter"])>-1&&!this.model.commonSeriesOptions.marker.visible?this.model.commonSeriesOptions.marker={shape:t.PivotChart.SymbolShapes.Circle,size:{height:12,width:12},visible:!0,connectorLine:{height:30,type:"line"},dataLabel:{visible:!1},border:{width:3,color:"white"}}:this.seriesType()=="pie"||this.seriesType()=="doughnut"?(this.model.commonSeriesOptions.marker.visible=!1,this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1)):this.seriesType()=="pyramid"||this.seriesType()=="funnel"?this.model.commonSeriesOptions.marker={dataLabel:{visible:!0}}:jQuery.inArray(this.seriesType(),["column","stackingcolumn","bar","stackingbar"])>-1&&this.model.commonSeriesOptions.marker&&(this.model.commonSeriesOptions.marker.dataLabel&&(this.model.commonSeriesOptions.marker.dataLabel.visible=!1),this.model.commonSeriesOptions.marker.visible=!1),this.model.crosshair.visible?this.model.commonSeriesOptions.tooltip.format="#point.x# : #point.y#":this.model.enableRTL?this.model.commonSeriesOptions.tooltip={visible:!0,template:"e-toolTip"}:this.model.commonSeriesOptions.tooltip.format=this._getLocalizedLabels("Measure")+" : "+r.measureNames+" <br/>"+this._getLocalizedLabels("Column")+" : #series.name# <br/>"+this._getLocalizedLabels("Row")+" : #point.x# <br/>"+this._getLocalizedLabels("Value")+" : #point.y#",this.model.analysisMode==t.PivotChart.AnalysisMode.Olap?this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:r.labelFormat.indexOf("#")>-1&&r.measureNames.indexOf("~")<0?r.labelFormat=="#,#"?"Number":"{value}"+r.labelFormat.split("##")[r.labelFormat.split("##").length-1]:r.labelFormat.toLowerCase().indexOf("percent")>-1&&r.measureNames.indexOf("~")<0?"{value}%":r.labelFormat.toLowerCase().indexOf("currency")>-1&&r.measureNames.indexOf("~")<0?"Currency":"":this.model.dataSource.values[0].measures.length==1&&(t.isNullOrUndefined(this.model.dataSource.values[0].measures[0].format)||(this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:this.model.dataSource.values[0].measures[0].format.toLowerCase()=="decimal"?"n2":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="number"?"Number":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="percent"?"p2":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="currency"?"Currency":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="date"?"MM/dd/yyyy":this.model.dataSource.values[0].measures[0].format.toLowerCase()=="time"?"hh:mm:ss":"")):this.model.analysisMode==t.PivotChart.AnalysisMode.Pivot&&(this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode?this.model.dataSource.values.length==1&&(t.isNullOrUndefined(this.model.dataSource.values[0].format)||(this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:this.model.dataSource.values[0].format.toLowerCase()=="decimal"?"n2":this.model.dataSource.values[0].format.toLowerCase()=="number"?"Number":this.model.dataSource.values[0].format.toLowerCase()=="percentage"?"p2":this.model.dataSource.values[0].format.toLowerCase()=="currency"?"Currency":this.model.dataSource.values[0].format.toLowerCase()=="date"?t.isNullOrUndefined(this.model.dataSource.values[0].formatString)?"dd/MMMM/yyyy":this.model.dataSource.values[0].formatString:this.model.dataSource.values[0].format.toLowerCase()=="time"?"hh:mm:ss":"")):(yt=t.isNullOrUndefined(JSON.parse(this.getOlapReport()).PivotCalculations)?JSON.parse(JSON.parse(this.getOlapReport()).values):JSON.parse(this.getOlapReport()).PivotCalculations,r.labelFormat.length==1&&yt.length==1&&(this.model.primaryYAxis.labelFormat=(this.model.primaryYAxis.labelFormat!=null||this.model.primaryYAxis.labelFormat!="")&&this.model.primaryYAxis.labelFormat?this.model.primaryYAxis.labelFormat:r.labelFormat[0].toLowerCase()=="#.##"?"n2":r.labelFormat[0].toLowerCase()=="###"?"Number":r.labelFormat[0].toLowerCase()=="p"?"p2":r.labelFormat[0].toLowerCase()=="c"?"Currency":""))),this.model.zooming.enableScrollbar){t.isNullOrUndefined(this.model.size.width)&&(this.model.size.width="800px");t.isNullOrUndefined(this.model.size.height)&&(this.model.size.height="400px");var wt=this.model.size.width.indexOf("%")>-1?this.element.width()*this.model.size.width.split("%")[0]/100:this.model.size.width.split("px")[0],bt=this.model.size.height.indexOf("%")>-1?this.element.height()*this.model.size.height.split("%")[0]/100:this.model.size.height.split("px")[0],kt=this.seriesType()=="bar"||this.seriesType()=="stackingbar"?bt/100*6:wt/100*3;this.model.primaryXAxis.zoomFactor=kt/(r.chartLables.length*r.seriesNames.length)}else this.model.primaryXAxis.zoomFactor=1;this.model.primaryXAxis.labelRotation=t.isNullOrUndefined(this.model.primaryXAxis.labelRotation)?270:this.model.primaryXAxis.labelRotation}else this.model.primaryXAxis.multiLevelLabels=[];n("#"+this._id+"Container").ejChart({border:this.model.border,backGroundImageUrl:this.model.backGroundImageUrl,palette:this.model.palette,chartArea:this.model.chartArea,primaryXAxis:this.model.primaryXAxis,primaryYAxis:this.model.primaryYAxis,secondaryX:this.model.secondaryX,secondaryY:this.model.secondaryY,striplineDefault:this.model.striplineDefault,title:{text:this.titleText(),textAlignment:this.model.title.textAlignment,font:{color:this.model.title.color,fontFamily:this.model.title.fontFamily,fontWeight:this.model.title.fontWeight,opacity:this.model.title.opacity,size:this.model.title.size,fontStyle:this.model.title.fontStyle}},locale:this.model.locale,lineCap:this.model.lineCap,lineJoin:this.model.lineJoin,legendAlignment:this.model.legendAlignment,legendPosition:this.model.legendPosition,legend:this.model.legend,animation:this.model.animation,crosshair:this.model.crosshair,commonSeriesOptions:{doughnutCoefficient:this.model.commonSeriesOptions.doughnutCoefficient,explodeOffset:this.model.commonSeriesOptions.explodeOffset,pyramidMode:this.model.commonSeriesOptions.pyramidMode,gapRatio:this.model.commonSeriesOptions.gapRatio,pieCoefficient:this.model.commonSeriesOptions.pieCoefficient,doughnutSize:this.model.commonSeriesOptions.doughnutSize,startAngle:this.model.commonSeriesOptions.startAngle,xAxisName:this.model.commonSeriesOptions.xAxisName,yAxisName:this.model.commonSeriesOptions.yAxisName,explodeAll:this.model.commonSeriesOptions.explodeAll,explodeIndex:this.model.commonSeriesOptions.explodeIndex,tooltipOptions:this.model.commonSeriesOptions.tooltipOptions,marker:this.model.commonSeriesOptions.marker||this.model.marker,font:this.model.commonSeriesOptions.font,type:this.seriesType(),enableAnimation:this.model.commonSeriesOptions.enableAnimation,style:this.model.commonSeriesOptions.style,explode:this.model.commonSeriesOptions.explode,labelPosition:this.model.commonSeriesOptions.labelPosition,tooltip:this.model.commonSeriesOptions.tooltip,zOrder:this.model.commonSeriesOptions.zOrder,drawType:this.model.commonSeriesOptions.drawType,isStacking:this.model.commonSeriesOptions.isStacking,enableSmartLabels:this.model.commonSeriesOptions.enableSmartLabels},seriesStyle:this.model.seriesStyle,pointStyle:this.model.pointStyle,textStyle:this.model.textStyle,initSeriesRender:this.model.initSeriesRender,theme:this.model.theme,canResize:this.model.isResponsive,rotation:this.model.rotation,enable3D:this.model.enable3D,zooming:this.model.zooming,margin:this.model.margin,elementSpacing:this.model.elementSpacing,seriesColors:this.model.seriesColors,seriesBorderColors:this.model.seriesBorderColors,pointColors:this.model.pointColors,pointBorderColors:this.model.pointBorderColors,series:d,size:this.model.size,load:this._onChartLoad(this),loaded:this.model.enableMultiLevelLabels?t.proxy(this._onChartLoaded,this):null,axesRangeCalculate:this.model.axesRangeCalculate,axesTitleRendering:this.model.axesTitleRendering,chartAreaBoundsCalculate:this.model.chartAreaBoundsCalculate,legendItemRendering:this.model.legendItemRendering,lengendBoundsCalculate:this.model.lengendBoundsCalculate,preRender:this.model.preRender,seriesRendering:this.model.seriesRendering,symbolRendering:this.model.symbolRendering,titleRendering:this.model.titleRendering,axesLabelsInitialize:this.model.axesLabelsInitialize,pointRegionMouseMove:this.model.pointRegionMouseMove,legendItemClick:this.model.legendItemClick,legendItemMouseMove:this.model.legendItemMouseMove,displayTextRendering:this.model.displayTextRendering,toolTipInitialize:this.model.toolTipInitialize,trackAxisToolTip:this.model.trackAxisToolTip,trackToolTip:this.model.trackToolTip,animationComplete:this.model.animationComplete,destroy:this.model.destroy,create:this.model.create,axesLabelRendering:t.proxy(this._labelRenders,this),multiLevelLabelClick:t.isNullOrUndefined(this._pivotClientObj)?t.proxy(this._multiLevelLabelClick,this):this._pivotClientObj.model.enableDeferUpdate?null:t.proxy(this._multiLevelLabelClick,this),pointRegionClick:this.model.enableMultiLevelLabels?null:t.isNullOrUndefined(this._pivotClientObj)?t.proxy(this._seriesClick,this):this._pivotClientObj.model.enableDeferUpdate?null:t.proxy(this._seriesClick,this)});this.model.enableRTL&&r!=null&&(pt=t.buildTag("div#e-toolTip.e-toolTip",t.buildTag("div.toolTipInfo",t.buildTag("div",r.measureNames+" : "+this._getLocalizedLabels("Measure")+" <br/>")[0].outerHTML+t.buildTag("div","#series.name#: "+this._getLocalizedLabels("Row")+" <br/>")[0].outerHTML+t.buildTag("div","#point.x# : "+this._getLocalizedLabels("Column")+" <br/>")[0].outerHTML+t.buildTag("div","#point.y# : "+this._getLocalizedLabels("Value"))[0].outerHTML).addClass("e-rtl")[0].outerHTML,{display:"none",width:"auto","min-width":"200px","font-size":"12px",padding:"2px 5px","background-color":"rgb(255, 255, 255)",border:"1px solid rgb(0, 0, 0)"})[0].outerHTML,n("#"+this._id).append(pt));n("#"+this._id+"progressContainer").hide();this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode&&r!=null&&r!=""&&(this._labelCurrentTags.splice(0,this._labelCurrentTags.length),s=this,jQuery.each(r.labelTags,function(n,t){var r={},i=t.split("::");r={name:i[2],state:i[i.length-1],tag:t};s._labelCurrentTags.push(r)}),t.isNullOrUndefined(s._selectedTagInfo)||jQuery.each(this._labelCurrentTags,function(n,t){if(t.tag.split("::")[0]==s._selectedTagInfo.split("::")[0]&&s._drillAction=="drillup")return s._selectedTagInfo=s._labelCurrentTags[n].tag,!1}));at=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(at)||(at._isTimeOut=!1);this._waitingPopup!=null&&this._waitingPopup.hide();n(this.element).parents(".e-pivotclient").length>0&&this._pivotClientObj.model.enableToolBar&&!this._pivotClientObj.model.displaySettings.enableFullScreen&&this.model.commonSeriesOptions.tooltip.visible&&this.element.find(".toolTipImg").addClass("enabled");t.isNullOrUndefined(this._pivotClientObj)||t.isNullOrUndefined(this._pivotClientObj)||!this._pivotClientObj.model.isResponsive||n("#"+this._id+"Container").width("100%")},_onChartLoad:function(n){for(var u,i=t.isNullOrUndefined(n.model.primaryXAxis.multiLevelLabels)?[]:n.model.primaryXAxis.multiLevelLabels,r=0;r<i.length;r++)if(i[r].span)for(i[r].border={type:"withouttopborder"},u=0;u<i[r].level;u++)i.push({start:i[r].start,end:i[r].end,visible:!0,text:" ",tag:i[r].tag,level:u,border:{type:"withouttopandbottomborder"}});return this.model.load},_onChartLoaded:function(){this.element.find("#"+this._id+"Container_svg_XAxisMultiLevelLabels_0").attr("cursor","pointer")},_setDrillParams:function(t,i){for(var e,o,f=this.getJSONRecords().chartLables[i.start+.5].split("~~"),r="",u=0;u<f.length;u++)if(r+=r==""?f[u]:">#>"+f[u],t==f[u])break;return e=r,this._drillAction=="drilldown"?this._drillParams.push(r):this._drillParams=n.map(this._drillParams,function(n){if(n.indexOf(r)==-1)return n}),n(this.element).parents(".e-pivotclient").length>0&&(o=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),o._drillParams=this._drillParams),e},_getChartDrillDown:function(i,r,u){var ut=this.model.dataSource.providerName==t.olap.Providers.Mondrian,y,v,o,h,it,c,s,p,l,e,tt,k,b,f;if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){for(e=[],f=0;f<this.model.dataSource.rows.length;f++){if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers))for(o=0;o<this._labelCurrentTags.expandedMembers.length;o++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[o]))for(y=0;y<this._labelCurrentTags.expandedMembers[o].length;y++)this._labelCurrentTags.expandedMembers[o][y].indexOf(this.model.dataSource.rows[f].fieldName)>=0&&e.indexOf(this._labelCurrentTags.expandedMembers[o][y].replace("&","&"))<0&&e.indexOf(this._labelCurrentTags.expandedMembers[o][y])<0&&e.push(this._labelCurrentTags.expandedMembers[o][y]);for(o=0;o<this._selectedSeriesInfo.length;o++)this._selectedSeriesInfo[o].indexOf(this.model.dataSource.rows[f].fieldName)>=0&&e.indexOf(this._selectedSeriesInfo[o])<0&&e.indexOf(this._selectedSeriesInfo[o].replace(/&/g,"&"))<0&&e.push(this._selectedSeriesInfo[o].replace(/&/g,"&"))}for(f=0;f<this._selectedSeriesInfo.length;f++)this._selectedSeriesInfo[f]=this._selectedSeriesInfo[f].replace(/&/g,"&");if(v=e,this._drillAction=="drillup"){for(f=0;f<this._labelCurrentTags.expandedMembers.length;f++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[f]))for(o=0;o<this._labelCurrentTags.expandedMembers[f].length;o++)this.model.enableMultiLevelLabels&&i!=""?this._labelCurrentTags.expandedMembers[f][o]==i&&(e=[],jQuery.map(this._labelCurrentTags.expandedMembers[f],function(n){n==i&&(l=!0);l||e.push(n)}),this._labelCurrentTags.expandedMembers[f]=e):this._labelCurrentTags.expandedMembers[f][o].split("::")[2]==r&&(i=this._labelCurrentTags.expandedMembers[f][o],e=[],jQuery.map(this._labelCurrentTags.expandedMembers[f],function(n){n.split("::")[2]==r&&(l=!0);l||e.push(n)}),this._labelCurrentTags.expandedMembers[f]=e);r=t.olap._mdxParser._splitCellInfo(i)}else i=i.indexOf("&")==-1?i.replace(/&/g,"&"):i;for(h=-1,f=0;f<this.model.dataSource.rows.length;f++)if(this.model.dataSource.rows[f].fieldName==r.hierarchyUniqueName){h=f;break}for(ut&&this._drillAction=="drillup"&&!t.isNullOrUndefined(this._selectedSeriesInfo[h])&&(this._selectedSeriesInfo[h]=i),c=n.inArray(i,this._selectedSeriesInfo),e=[],f=0;f<=c;f++)e.push(this._selectedSeriesInfo[f]);for(it=e,this._selectedSeriesInfo=e.length>0?e:this._selectedSeriesInfo,c=n.inArray(i,v),e=[],f=0;f<=c;f++)e.push(v[f]);if(v=e,s=n(this.element).parents(".e-pivotclient").length>0?this.element.parents(".e-pivotclient").data("ejPivotClient"):this,this._drillAction=="drilldown")t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[h])&&(this._labelCurrentTags.expandedMembers[h]=[]),this._labelCurrentTags.expandedMembers[h].push(i),this.element.parents(".e-pivotclient").length>0&&(s=this.element.parents(".e-pivotclient").data("ejPivotClient"),s._drillParams.push(n.map(v,function(n){return n.split("&").join("&")}).join(">#>")));else if(this.element.parents(".e-pivotclient").length>0){s=this.element.parents(".e-pivotclient").data("ejPivotClient");var rt=[],g="",w=[];for(n.each(v,function(n,t){(g==""||g.split("::")[0]!=t.split("::")[3])&&rt.push(t);g=t}),n.each(rt,function(n,t){n<h&&t.length>0&&w.push(t.split("&").join("&"))}),s._drillParams=n.grep(s._drillParams,function(t){return h<1?t.indexOf(i.split("&").join("&"))==-1:!(t.indexOf(i.split("&").join("&"))>-1&&n.map(t.split(">#>"),function(n){if(w.indexOf(n)>-1)return n}).length==w.length)}),l=!1,f=0;f<this._labelCurrentTags.expandedMembers.length;f++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[f])&&this._labelCurrentTags.expandedMembers[f].length>0){l=!0;break}if(s._drillParams.length>0&&this._drilledCellSet.length>0&&!l&&!t.isNullOrUndefined(s._drillParams[s._drillParams.length-1])){var c=0,d="",a="",nt=!1;for(f=0;f<s._drillParams[s._drillParams.length-1].split(">#>").length;f++)a=s._drillParams[s._drillParams.length-1].split(">#>")[f],a.indexOf("undefined")==-1&&(c=d==""?0:a.split("::")[0].split(".")[0]+"."+a.split("::")[0].split(".")[1]==d.split("::")[0].split(".")[0]+"."+d.split("::")[0].split(".")[1]?c:c+1,n.each(this._drilledCellSet,function(t,i){(n.map(i[0].key.split("][").join("]>#>[").split(">#>"),function(n){if(w.indexOf(n)>-1)return n}).length!=w.length||w.length==0)&&n.each(i[0].key.split("][").join("]>#>[").split(">#>"),function(n,t){a.split("::")[0]+" !#rowheader"==t&&(nt=!0)})}),nt&&(a=a.split("&").join("&"),t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[c])?this._labelCurrentTags.expandedMembers[c]=a:this._labelCurrentTags.expandedMembers[c].push(a),nt=!1),d=a)}}for(f=h+1;f<this._labelCurrentTags.expandedMembers.length;f++)this._labelCurrentTags.expandedMembers[f]=[];this._drillAction=="drilldown"?t.olap._mdxParser.updateDrilledReport({uniqueName:i,seriesInfo:this._selectedSeriesInfo,uniqueNameArray:v},"rowheader",s):t.olap._mdxParser.updateDrilledReport({uniqueName:i,seriesInfo:it,uniqueNameArray:v,action:"collapse"},"rowheader",s)}else{if(p="",this._drillAction==""&&this.model.enableMultiLevelLabels)return this._waitingPopup.hide(),!1;if(this._drillAction=="drilldown"){if(this.model.enableMultiLevelLabels)p=this._setDrillParams(r,i),this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?(this._selectedItem=r,this._generateData({JsonRecords:this._pivotEngine,PivotReport:this.getOlapReport()})):this._generateData(this._pivotEngine);else{for(t.isNullOrUndefined(this._labelCurrentTags.expandedMembers)&&(this._labelCurrentTags.expandedMembers=[]),this._labelCurrentTags.expandedMembers.push(r),b=this._cloneEngine(this._pivotEngine),f=0;f<this._labelCurrentTags.expandedMembers.length;f++)this._cropData(b,this._labelCurrentTags.expandedMembers[f],0,!0);this._generateData(b)}this._trigger("drillSuccess",{chartObj:this,drillAction:"drilldown",drilledMember:this.model.enableMultiLevelLabels?p:this._labelCurrentTags.expandedMembers.join(">#>"),event:u})}else{if(this.model.enableMultiLevelLabels)p=this._setDrillParams(r,i),this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode?(this._selectedItem=r,this._generateData({JsonRecords:this._pivotEngine,PivotReport:this.getOlapReport()})):this._generateData(this._pivotEngine);else{for(l=!1,e=[],jQuery.map(this._labelCurrentTags.expandedMembers,function(n){n==r&&(l=!0);l||e.push(n)}),this._labelCurrentTags.expandedMembers=e,p=this._labelCurrentTags.expandedMembers.length==0?r:this._labelCurrentTags.expandedMembers.join(">#>")+">#>"+r,tt=this.model.operationalMode==t.PivotChart.OperationalMode.ClientMode,(this._labelCurrentTags.expandedMembers.length==0||tt)&&n(this.element).parents(".e-pivotclient").length>0&&(k=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),k._drillParams.length>0&&(k._drillParams=n.grep(k._drillParams,function(n){return n.indexOf(tt?p:r)<0}),k._getDrilledMember())),b=this._cloneEngine(this._pivotEngine),f=0;f<this._labelCurrentTags.expandedMembers.length;f++)this._cropData(b,this._labelCurrentTags.expandedMembers[f],0,!0);this._generateData(b)}this._trigger("drillSuccess",{chartObj:this,drillAction:"drillup",drilledMember:p,event:u})}}},_multiLevelLabelClick:function(r){var h,c,e,o,u,s,l;if(n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejWaitingPopup").show():t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.show(),this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)if(this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode){if(h=parseInt(r.data.multiLevelLabel.tag.split("::")[r.data.multiLevelLabel.tag.split("::").length-1]),r.data.multiLevelLabel.tag.startsWith("[Measures]")||h==0)return n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejWaitingPopup").hide():t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide(),!1;this._selectedTagInfo=r.data.multiLevelLabel.tag;this._drillAction=h==2?"drilldown":"drillup";this._startDrilldown=!0;c=JSON.stringify(this.model.customObject);e=this.getOlapReport();this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:this._drillAction,element:this.element,customObject:this.model.customObject});this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e,customObject:c}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e,clientReports:this._pivotClientObj.reports,customObject:c}),this.renderControlSuccess):t.isNullOrUndefined(this._pivotClientObj)?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e,clientReports:reports}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.drillDown,JSON.stringify({action:this._drillAction+"#fullchart",drilledSeries:this._selectedTagInfo,olapReport:e}),this.renderControlSuccess)}else{if(r.data.multiLevelLabel.tag.endsWith("0"))return t.isNullOrUndefined(this._waitingPopup)||this._waitingPopup.hide(),!1;var f=r.data.multiLevelLabel.tag.split("::").splice(0,r.data.multiLevelLabel.tag.split("::").length-1).join("::"),l=t.olap._mdxParser._splitCellInfo(f),a=this.getJSONRecords().labelTags[r.data.multiLevelLabel.start+.5].split("~~");for(this._selectedSeriesInfo=[],o=0;o<a.length;o++)this._selectedSeriesInfo.push(a[o].split("#")[a[o].split("#").length-1]);if(this._labelCurrentTags.collapsedMembers=n.grep(this._labelCurrentTags.collapsedMembers,function(n){return n!=r.data.multiLevelLabel.text.slice(2,r.data.multiLevelLabel.text.length)}),this._drillAction=r.data.multiLevelLabel.tag.split("::")[r.data.multiLevelLabel.tag.split("::").length-1]=="2"?"drilldown":r.data.multiLevelLabel.tag.split("::")[r.data.multiLevelLabel.tag.split("::").length-1]=="1"?"drillup":"",!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers))for(u=0;u<this._labelCurrentTags.expandedMembers.length;u++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[u]))for(s=0;s<this._labelCurrentTags.expandedMembers[u].length;s++)if(this._labelCurrentTags.expandedMembers[u][s].indexOf(f.replace(/&/g,"&"))>=0||this._labelCurrentTags.expandedMembers[u][s].indexOf(f)>=0){f=f.replace(/&/g,"&");break}this._getChartDrillDown(f,l,r)}else l=r.data.multiLevelLabel.tag.split("#")[0],this._drillAction=r.data.multiLevelLabel.tag.endsWith("1")?"drilldown":r.data.multiLevelLabel.tag.endsWith("2")?"drillup":"",this._getChartDrillDown(r.data.multiLevelLabel,l,r)},_labelRenders:function(r){if(this.model.enableMultiLevelLabels&&(this.seriesType()=="bar"||this.seriesType()=="stackingbar"?r.data.axis.orientation.toLowerCase()=="vertical":r.data.axis.orientation.toLowerCase()=="horizontal"))r.data.label.Text="";else if(this._trigger("axesLabelRendering",r),(r.data.axis.orientation.toLowerCase()=="horizontal"&&r.data.label.Text!=i||(this.seriesType()=="bar"||this.seriesType()=="stackingbar")&&r.data.axis.orientation.toLowerCase()=="vertical"&&r.data.label.Text!=i)&&this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){var f=this.model.enableRTL?r.data.label.Text.toString().split("~~").reverse():r.data.label.Text.toString().split("~~"),u=this;t.isNullOrUndefined(u.getJSONRecords())||n.each(n.extend([],u.getJSONRecords().chartLables,!0),function(n,t){if(t.toString().split("#").join("~~")==f.join("~~"))return r.data.label.Text=t.toString().split("~~").map(function(n){return n.split("#")[n.split("#").length-1]}).join("~~"),!1})}},_reSizeHandler:function(){var n=this.element.find("#"+this._id+"Container").height(this.element.height()).width(this.element.width()).data("ejChart");t.isNullOrUndefined(n)||n.redraw()},_getLocalizedLabels:function(n){return t.PivotChart.Locale[this.locale()][n]===i?t.PivotChart.Locale["en-US"][n]:t.PivotChart.Locale[this.locale()][n]},_onPreventPanelClose:function(i){n("body").find("#preventDiv").remove();!n(".e-pivotgrid").data("ejWaitingPopup")||!t.isNullOrUndefined(i)&&(n(i.target).hasClass("pivotTree")||n(i.target).hasClass("pivotTreeContext")||n(i.target).hasClass("pivotTreeContextMenu"))||n(".e-pivotgrid").data("ejWaitingPopup").hide()},_seriesClick:function(r){var s,e,p,v,b,h,k,y,c,f,d;this.element.find("#"+this._id+"ExpandMenu, .expandMenu, .e-dialog").remove();var o,u=[],w=this.element.position(),l=this,a=this;if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&this.model.operationalMode==t.PivotChart.OperationalMode.ServerMode)this._selectedTags=[],r.data.region!=null&&r.data.region!=i?(p=this.model.enableRTL?n.map(r.model.primaryXAxis.labels,function(n){return n.split("~~").reverse().join("~~")}):r.model.primaryXAxis.labels,o=p[r.data.region.Region.PointIndex],e=r.data.region.Region.PointIndex):r.data.point.x!=null&&r.data.point.x!=i&&r.data.point.x!=""&&(p=this.model.enableRTL?n.map(r.data.series.xAxis.labels,function(n){return n.split("~~").reverse().join("~~")}):r.data.series.xAxis.labels,o=p[r.data.point.X],e=r.data.point.X),this.model.enableMultiLevelLabels?s=r.model.primaryXAxis.labels[e].split("~~")[r.model.primaryXAxis.labels[e].split("~~").length-1]:n(n("#"+this._id+"Container_vml_XAxisLabels_0")[0]).children()[e]!=i?s=n(n("#"+this._id+"Container_vml_XAxisLabels_0")[0]).children()[e].innerHTML:n("#"+this._id+"Container_svg_XAxisLabels_0").children()[e]?s=n("#"+this._id+"Container_svg_XAxisLabels_0").children()[e].textContent:this.seriesType()=="bar"||this.seriesType()=="stackingbar"?n(n("#"+this._id+"Container_vml_YAxisLabels_0")[0]).children()[e]!=i?s=n(n("#"+this._id+"Container_vml_YAxisLabels_0")[0]).children()[e].innerHTML:n("#"+this._id+"Container_svg_YAxisLabels_0").children()[e]?s=n("#"+this._id+"Container_svg_YAxisLabels_0").children()[e].textContent:(v=r.model.primaryXAxis.labels[e].split("~~"),s=v[v.length-1]):(v=r.model.primaryXAxis.labels[e].split("~~"),s=v[v.length-1]),s&&(n("#"+this._id).find("#"+this._id+"ExpandMenu, .expandMenu, .e-dialog").remove(),b=o.split("~~"),jQuery.each(b,function(t,i){jQuery.each(a._labelCurrentTags,function(t,r){if(n.trim(i)==r.name)return a._selectedTags.push(r),!1})}),jQuery.each(this._selectedTags,function(i,r){r.state>1&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",r.name+" - "+a._getLocalizedLabels("Expand"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",a._getLocalizedLabels("Expand")+" - "+r.name)[0]).attr("role","presentation")[0].outerHTML))}),jQuery.each(this._selectedTags,function(i,r){for(var f=0;f<o.split("~~").length-1;f++)o.split("~~")[f]==r.name&&r.state==1&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",r.name+" - "+a._getLocalizedLabels("Collapse"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",a._getLocalizedLabels("Collapse")+" - "+o.split("~~")[f])[0]).attr("role","presentation")[0].outerHTML))}));else{if(o=r.data.region!=null&&r.data.region!=i?this.getJSONRecords().chartLables[r.data.region.Region.PointIndex]:r.data.series.xAxis.labels[r.data.point.X],this.model.analysisMode==t.PivotChart.AnalysisMode.Olap&&(o=o.split("~~").map(function(n){return n.split("#")[n.split("#").length-1]}).join("~~")),!t.isNullOrUndefined(this._labelCurrentTags.collapsedMembers))if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap)for(h=o.split("~~"),this.model.dataSource.values[0].axis==t.olap.AxisName.Row&&(k=n.map(this.model.dataSource.values[0].measures,function(n){return n.fieldName}),n.inArray(h[h.length-1],k)>=0&&h.splice(h.length-1,1)),this._selectedSeriesInfo=[],f=0;f<h.length;f++)y=h[f].split("#")[h[f].split("#").length-1],n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==y}).length>0&&this._selectedSeriesInfo.push(n(this.getJSONRecords().seriesTags).filter(function(n,t){return t.split("::")[2]==y})[0]),n.inArray(y,this._labelCurrentTags.collapsedMembers)>=0&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",y+" - "+this._getLocalizedLabels("Expand"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Expand")+" - "+y)[0]).attr("role","presentation")[0].outerHTML));else n.inArray(o,this._labelCurrentTags.collapsedMembers)>=0&&(l.model.enableRTL?u.push(n(t.buildTag("li.menuList",o+" - "+this._getLocalizedLabels("Expand"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Expand")+" - "+o)[0]).attr("role","presentation")[0].outerHTML));if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers))if(this.model.analysisMode==t.PivotChart.AnalysisMode.Olap){for(c=0;c<this._labelCurrentTags.expandedMembers.length;c++)if(!t.isNullOrUndefined(this._labelCurrentTags.expandedMembers[c]))for(f=0;f<this._labelCurrentTags.expandedMembers[c].length;f++)l.model.enableRTL?u.push(n(t.buildTag("li.menuList",this._labelCurrentTags.expandedMembers[c][f].split("::")[2]+" - "+this._getLocalizedLabels("Collapse"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Collapse")+" - "+this._labelCurrentTags.expandedMembers[c][f].split("::")[2])[0]).attr("role","presentation")[0].outerHTML)}else for(f=0;f<this._labelCurrentTags.expandedMembers.length;f++)l.model.enableRTL?u.push(n(t.buildTag("li.menuList",this._labelCurrentTags.expandedMembers[f]+" - "+this._getLocalizedLabels("Collapse"))[0]).attr("role","presentation")[0].outerHTML):u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Collapse")+" - "+this._labelCurrentTags.expandedMembers[f])[0]).attr("role","presentation")[0].outerHTML)}u.length>0&&(u.push(n(t.buildTag("li.menuList",this._getLocalizedLabels("Exit"))[0]).attr("role","presentation")[0].outerHTML),d=n(t.buildTag("div#"+this._id+"ExpandMenu.expandMenu",u)[0]).attr("role","presentation")[0].outerHTML,n(d).ejDialog({width:"auto",target:"#"+this._id,enableResize:!1,enableRTL:this.model.enableRTL}),n("#"+this._id+"ExpandMenu_wrapper").appendTo(this.element).css({left:r.data.location.x+8+w.left,top:r.data.location.y+8+w.top,"min-height":navigator.userAgent.toLowerCase().indexOf("webkit")>0?"initial":"auto"}),n("#"+this._id+"ExpandMenu").css({"min-height":navigator.userAgent.toLowerCase().indexOf("webkit")>0?"initial":"auto"}));this.element.find(".e-titlebar, .e-header").remove();this._trigger("pointRegionClick",r)},exportPivotChart:function(i,r,u){var e,c,l,s,h,f,a,v,o;t.browserInfo().name=="msie"&&t.browserInfo().version<=8||((t.isNullOrUndefined(r)||r=="")&&(r="Sample"),e=n("#"+this._id+"Container").data("ejChart"),c=e.model.primaryXAxis.zoomFactor,e.model.primaryXAxis.zoomFactor=1,e.model.enableCanvasRendering=!0,e.redraw(),l=e["export"](),s=l.toDataURL("image/png"),e.model.primaryXAxis.zoomFactor=c,e.model.enableCanvasRendering=!1,e.redraw(),h=n(this.element).css("background-color")!=""?n(this.element).css("background-color"):"rgb(255, 255, 255)",f={url:"",fileName:"PivotChart",exportMode:t.PivotChart.ExportMode.ClientMode,title:"",description:"",exportType:i,controlName:this},this._trigger("beforeExport",f),f.exportMode==t.PivotChart.ExportMode.ClientMode?(o={args:JSON.stringify({fileName:t.isNullOrUndefined(r)?t.isNullOrUndefined(f.fileName)?"PivotChart":f.fileName:r,chartdata:s.split(",")[1],bgColor:h,exportFormat:u,title:f.title,description:f.description})},t.raiseWebFormsServerEvents&&(i=="excelExport"||i=="pdfExport"||i=="wordExport"||i=="imageExport")&&f.exportMode==t.PivotChart.ExportMode.ClientMode&&n.trim(f.url)==""?(a={model:this.model,originalEventType:i},v=o,t.raiseWebFormsServerEvents(i,a,v),setTimeout(function(){t.isOnWebForms=!0},1e3)):this.doPostBack(n.trim(f.url)!=""?f.url:i,o)):(o={args:JSON.stringify({exportOption:i,chartdata:s.split(",")[1],bgColor:h,title:f.title,description:f.description})},this.doPostBack(n.trim(f.url)!=""?f.url:this.model.url+"/"+this.model.serviceMethodSettings.exportPivotChart,o)))},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!0);n.ajax({type:r,url:u,data:f,async:a,contentType:h,dataType:c,success:l,complete:t.proxy(function(){var n={action:!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(s.action)?s.action:JSON.parse(f).action,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",n)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();typeof oclientWaitingPopup!="undefined"&&oclientWaitingPopup!=null&&oclientWaitingPopup.hide();var t={action:this._currentAction,customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",t);this.renderChartFromJSON("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotChart.Locale={};t.PivotChart.Locale["en-US"]={Measure:"Measure",Row:"Row",Column:"Column",Value:"Value",Expand:"Expand",Collapse:"Collapse",Exit:"Exit",ChartTypes:"Chart Types",TDCharts:"3D Charts",Tooltip:"Tooltip",Exporting:"Exporting",Line:"Line",Spline:"Spline",Column:"Column",Area:"Area",SplineArea:"Spline Area",StepLine:"Step Line",StepArea:"Step Area",Pie:"Pie",Bar:"Bar",StackingArea:"Stacking Area",StackingColumn:"Stacking Column",StackingBar:"Stacking Bar",Pyramid:"Pyramid",Funnel:"Funnel",Doughnut:"Doughnut",Scatter:"Scatter",Bubble:"Bubble",TreeMap:"TreeMap",ColumnTD:"Column 3D",PieTD:"Pie 3D",BarTD:"Bar 3D",StackingBarTD:"StackingBar 3D",StackingColumnTD:"StackingColumn 3D",Excel:"Excel",Word:"Word",Pdf:"PDF",PNG:"PNG",EMF:"EMF",GIF:"GIF",JPG:"JPG",BMP:"BMP",ZoomIn:"Zoom In",ZoomOut:"Zoom Out",Legend:"Legend",SmartLabels:"Smart Labels",Interactions:"Interactions",Zooming:"Zooming",Rotate45:"Rotate45",Rotate90:"Rotate90",Trim:"Trim",MultipleRows:"Multiple Rows",Wrap:"Wrap",Hide:"Hide",WrapByWord:"Wrap By word",CrossHair:"Cross Hair",TrackBall:"Track Ball",DisableTD:"Disable 3D Charts",None:"None"};t.PivotChart.ChartTypes={Line:"line",Spline:"spline",Column:"column",Area:"area",SplineArea:"splinearea",StepLine:"stepline",StepArea:"steparea",Pie:"pie",Bar:"bar",StackingArea:"stackingarea",StackingColumn:"stackingcolumn",StackingBar:"stackingbar",Pyramid:"pyramid",Funnel:"funnel",Doughnut:"doughnut",Scatter:"scatter",Bubble:"bubble",WaterFall:"waterfall"};t.PivotChart.ExportOptions={Excel:"excel",Word:"word",PDF:"pdf",CSV:"csv",PNG:"png",JPG:"jpg",EMF:"emf",GIF:"gif",BMP:"bmp"};t.PivotChart.SymbolShapes={None:"none",LeftArrow:"leftarrow",RightArrow:"rightarrow",Circle:"circle",Cross:"cross",HorizLine:"horizline",VertLine:"vertline",Diamond:"diamond",Rectangle:"rectangle",Triangle:"triangle",InvertedTriangle:"invertedtriangle",Hexagon:"hexagon",Pentagon:"pentagon",Star:"star",Ellipse:"ellipse",Wedge:"wedge",Trapezoid:"trapezoid",UpArrow:"uparrow",DownArrow:"downarrow",Image:"image"};t.PivotChart.AnalysisMode={Olap:"olap",Pivot:"pivot"};t.PivotChart.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"};t.PivotChart.ExportMode={ClientMode:"clientmode",ServerMode:"servermode"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotTreeMap","ej.PivotTreeMap",{_rootCSS:"e-pivottreemap",element:null,model:null,validTags:["div","span"],defaults:n.extend(t.datavisualization.TreeMap.prototype.defaults,{url:"",cssClass:"",currentReport:"",operationalMode:"clientmode",customObject:{},isResponsive:!1,dataSource:{data:null,isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},serviceMethodSettings:{initialize:"InitializeTreeMap",drillDown:"DrillTreeMap"},locale:"en-US",drillSuccess:null,beforeServiceInvoke:null,afterServiceInvoke:null,load:null,renderComplete:null,renderFailure:null,renderSuccess:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum",drillDown:"enum"},customObject:"data"},locale:t.util.valueFunction("locale"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJsonRecords:function(){return this._JSONRecords},setJsonRecords:function(n){this._JSONRecords=JSON.parse(n)},_init:function(){this._initPrivateProperties();this._load()},_destroy:function(){this.element.empty().removeClass("e-pivottreemap"+this.model.cssClass);this._waitingPopup!=i&&this._waitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");ptreemapProxy=this;this._olapReport="";this._JSONRecords=null;this._treeMapDatasource=[];this._currentAction="initialize";this._selectedItem="";this._selectedTagInfo=null;this._tagCollection=[];this._drilledMembers=[];this._startDrilldown=!1;this._isDrilled=!1;this._treeMap=null;this._waitingPopup=null;this._drillText="";this._showDrillText=""},_load:function(){var r,u;if(this.element.addClass(this.model.cssClass),n(this.element).parents(".e-pivotclient").length>0?(r=n(this.element).parents(".e-pivotclient").data("ejPivotClient"),this.model.customObject=oclientProxy.model.customObject,n("#"+r._id+"_maxView")[0]?n("#"+r._id+"_maxView").ejWaitingPopup({showOnInit:!0}):t.isNullOrUndefined(r._waitingPopup)||r._waitingPopup.show()):(this.element.ejWaitingPopup({showOnInit:!0}),this._waitingPopup=this.element.data("ejWaitingPopup"),this._waitingPopup.show()),u=JSON.stringify(this.model.customObject),this.model.dataSource.data==null&&this.model.url==""&&this.model.dataSource.cube==""){this.renderTreeMapFromJSON(null);this._waitingPopup.hide();return}this.model.dataSource.data==null&&this.model.url!=""||this.model.dataSource.data!=null&&this.model.url!=""&&this.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(this.model.operationalMode=t.PivotTreeMap.OperationalMode.ServerMode,this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{action:this._currentAction,element:this.element,customObject:u}),this.model.customObject!=""&&this.model.customObject!=null&&this.model.customObject!=i?this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize",currentReport:this.model.currentReport,customObject:u}),this.renderControlSuccess):this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initialize"}),this.renderControlSuccess)):(this.model.operationalMode=t.PivotTreeMap.OperationalMode.ClientMode,this.model.dataSource.rows.length>1&&(this.model.dataSource.rows=[this.model.dataSource.rows[this.model.dataSource.rows.length-1]]),this.model.dataSource.cube!=""&&(this._trigger("beforePivotEnginePopulate",{treeMapObject:this}),t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)))},generateJSON:function(n,i){for(var g,a,c,ut,v,nt,e,u,f,o,tt=[],it=[],p="",k=[],y=[],s=[],w=[],l={},r=0;r<this.model.dataSource.values[0].measures.length;r++)p+=p==""?this.model.dataSource.values[0].measures[r].fieldCaption:"~"+this.model.dataSource.values[0].measures[r].fieldCaption;var rt=this.model.dataSource.values[0].axis,d=this.model.dataSource.rows.length,h=i[0][0].ColSpan,b=0;for(h-d<=0?(h=0,b=d,rowElementCount=d):(b=rt=="rows"?h-1:h,h=b-1),u=[],r=0;r<i.length;r++)for(f=0;f<i[r].length;f++)if(g=null,i[r][f].CSS==" value"&&w.push(i[r][f].Value),i[r][f].CSS=="rowheader"&&i[r][f].Value!=""){if(o={},g=i[r][f].Info+"::"+i[r][f].State,it.push(i[r][f].Info.replace(/&/g,"&")),tt.push(g),u.length==0&&i[r][f].Info.split(".")[0].indexOf("Measures")<0&&(o.level=r,o.index=f,o.label=i[r][f].Value,u.push(o)),u.length!=0&&i[r][f].Info.split(".")[0].indexOf("Measures")<0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e]))if(u[e].index==f&&u[e].level!=r){u[e].level=r;u[e].label=u[e].label+"~~"+i[r][f].Value;break}else if(u[e].level==r){for(a=!1,c=0;c<u.length;c++)if(!t.isNullOrUndefined(u[c])&&u[c].index==f){a=!0;break}if(!a&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){o.level=r;o.index=f;o.label=i[r][f].Value;u.push(o);break}}}else if(i[r][f].CSS=="summary"&&u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e])&&u[e].index==f){delete u[e];break}for(e=0;e<u.length;e++)t.isNullOrUndefined(u[e])||b==u[e].label.split("~~").length&&s.push(u[e].label);for(u=[],r=0;r<i.length;r++)for(f=0;f<i[r].length;f++)if(i[r][f].CSS=="colheader"&&i[r][f].Value!=""){if(o={},u.length==0&&(o.level=f,o.index=r,o.label=i[r][f].Value,u.push(o)),u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e]))if(u[e].index==r&&u[e].level!=f&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){u[e].index=r;u[e].label=u[e].label+"~~"+i[r][f].Value;break}else if(u[e].level==f&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){for(a=!0,c=0;c<u.length;c++)if(!t.isNullOrUndefined(u[c])&&(a=!1,u[c].index==r)){a=!0;break}if(!a&&i[r][f].Info.split(".")[0].indexOf("Measures")<0){o.level=f;o.index=r;o.label=i[r][f].Value;u.push(o);break}}}else if(i[r][f].CSS=="summary"&&u.length!=0)for(e=0;e<u.length;e++)if(!t.isNullOrUndefined(u[e])&&u[e].index==r){delete u[e];break}for(e=0;e<u.length;e++)t.isNullOrUndefined(u[e])||y.push(u[e].label);if(p!=""&&rt==t.olap.AxisName.Column)for(r=0;r<y.length;r++)y[r]=y[r]+"~"+p;if(h==0)for(ut=w.length/y.length,r=0;r<s.length;r++){for(u=[],f=r;f<w.length;f=f+ut)o={},o.Item1=s[r].indexOf("~~")>=0?s[r].split("~~")[0]:s[r],o.Item2=w[f],u.push(o);k.push(u)}else{for(v=[],nt=null,r=0;r<s.length;r++)for(u=[],f=0;f<i[h].length;f++)if(i[h][f].CSS=="rowheader"&&i[h][f].Value!=""&&s[r].split("~~")[s[r].split("~~").length-1]==i[h][f].Value){nt=f;u.push(nt);u.push(s[r]);v.push(u);break}for(e=0;e<v.length;e++){for(u=[],r=0;r<i.length;r++)for(f=v[e][0];f<i[r].length;f++){i[r][f].CSS==" value"&&(o={},o.Item1=v[e][1].indexOf("~~")>=0?v[e][1].split("~~")[0]:v[e][1],o.Item2=i[r][f].Value,u.push(o));break}u.length!=0&&k.push(u)}}l.labelTags=tt;l.drillTags=it;l.measureNames=p;l.points_Y=k;l.seriesNames=y;l.treemapLabels=s;ptreemapProxy._JSONRecords=l;this.renderTreeMapFromJSON(l);this._unWireEvents();this._wireEvents()},_wireEvents:function(){if(typeof oclientProxy=="undefined")n(window).on("resize",n.proxy(this._reSizeHandler,this));this._on(this.element,"click",".drillItem",this._drillTreeMap)},_drillTreeMap:function(r){var u=null,e,f,o,s;if(r.type=="treeMapGroupSelected"){if(ptreemapProxy._treemapWaitingPopup({show:!0}),r.selectedGroups.length==0){ptreemapProxy._treemapWaitingPopup({show:!1});return}for(ptreemapProxy._currentAction="drilldown",ptreemapProxy._selectedItem=r.selectedGroups[0].header,e=0;e<ptreemapProxy._treeMapDatasource.length;e++)if(ptreemapProxy._treeMapDatasource[e].Tag.split("::")[2]==ptreemapProxy._selectedItem){if(ptreemapProxy._selectedTagInfo=ptreemapProxy._treeMapDatasource[e].Tag,ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(u=ptreemapProxy._treeMapDatasource[e].drillTag),ptreemapProxy._selectedTagInfo.split("::")[ptreemapProxy._selectedTagInfo.split("::").length-1]!=2){ptreemapProxy._treeMap.refresh();ptreemapProxy._treemapWaitingPopup({show:!1});return}break}ptreemapProxy._startDrilldown=!0;ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(ptreemapProxy.model.beforeServiceInvoke!=null&&ptreemapProxy._trigger("beforeServiceInvoke",{action:ptreemapProxy._currentAction,element:ptreemapProxy.element,customObject:ptreemapProxy.model.customObject}),o=JSON.stringify(ptreemapProxy.model.customObject),ptreemapProxy.model.customObject!=""&&ptreemapProxy.model.customObject!=null&&ptreemapProxy.model.customObject!=i?typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports,customObject:o}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),customObject:o}),ptreemapProxy.renderControlSuccess):!typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport()}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drilldown",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports}),ptreemapProxy.renderControlSuccess)):(ptreemapProxy._drilledMembers.push(u),t.olap._mdxParser.updateDrilledReport({uniqueName:u,seriesInfo:[u],uniqueNameArray:ptreemapProxy._drilledMembers},"rowheader",ptreemapProxy))}else{if(ptreemapProxy._treemapWaitingPopup({show:!0}),ptreemapProxy._currentAction="drillup",n(r.target).hasClass("drillItem"))if(ptreemapProxy.getJsonRecords().treemapLabels[0].indexOf("~~")>=0){for(ptreemapProxy._selectedItem=n(r.target).text(),f=0;f<ptreemapProxy.getJsonRecords().labelTags.length;f++)if(ptreemapProxy.getJsonRecords().labelTags[f].split("::")[2]==ptreemapProxy._selectedItem&&ptreemapProxy.getJsonRecords().labelTags[f].split("::")[ptreemapProxy.getJsonRecords().labelTags[f].split("::").length-1]==1){if(ptreemapProxy._selectedTagInfo=ptreemapProxy.getJsonRecords().labelTags[f],ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(u=ptreemapProxy.getJsonRecords().drillTags[f]),ptreemapProxy._selectedTagInfo.split("::")[ptreemapProxy._selectedTagInfo.split("::").length-1]!=1){ptreemapProxy._treemapWaitingPopup({show:!1});return}break}}else{ptreemapProxy._treemapWaitingPopup({show:!1});return}ptreemapProxy._tagCollection.length==0&&(ptreemapProxy._isDrilled=!1);ptreemapProxy._startDrilldown=!0;ptreemapProxy.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode?(ptreemapProxy.model.beforeServiceInvoke!=null&&ptreemapProxy._trigger("beforeServiceInvoke",{action:ptreemapProxy._currentAction,element:ptreemapProxy.element,customObject:ptreemapProxy.model.customObject}),o=JSON.stringify(ptreemapProxy.model.customObject),ptreemapProxy.model.customObject!=""&&ptreemapProxy.model.customObject!=null&&ptreemapProxy.model.customObject!=i?typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports,customObject:o}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),customObject:o}),ptreemapProxy.renderControlSuccess):!typeof oclientProxy!="undefined"?ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport()}),ptreemapProxy.renderControlSuccess):ptreemapProxy.doAjaxPost("POST",ptreemapProxy.model.url+"/"+ptreemapProxy.model.serviceMethodSettings.drillDown,JSON.stringify({action:"drillup",drillInfo:ptreemapProxy._selectedTagInfo,olapReport:ptreemapProxy.getOlapReport(),clientReports:oclientProxy.reports}),ptreemapProxy.renderControlSuccess)):(s=ptreemapProxy._drilledMembers.slice(0,n.inArray(u,ptreemapProxy._drilledMembers)+1),ptreemapProxy._drilledMembers=ptreemapProxy._drilledMembers.slice(0,n.inArray(u,ptreemapProxy._drilledMembers)),t.olap._mdxParser.updateDrilledReport({uniqueName:u,seriesInfo:[u],uniqueNameArray:s,action:"collapse"},"rowheader",ptreemapProxy))}},_unWireEvents:function(){n(window).off("resize",n.proxy(this._reSizeHandler,this));this._off(this.element,"click",".drillItem",this._drillTreeMap)},renderControlSuccess:function(r){var f,u;ptreemapProxy=this;ptreemapProxy._treemapWaitingPopup({show:!0});try{r[0]!=i?(this.setJsonRecords(r[0].Value),this.setOlapReport(r[1].Value),typeof oclientProxy!="undefined"&&(oclientProxy.currentReport=r[1].Value,r[2]!=null&&r[2]!=i&&r[2].Key=="ClientReports"&&(oclientProxy.reports=r[2].Value)),r[2]!=null&&r[2]!=i&&!r[2].Key=="ClientReports"&&(this.model.customObject=r[2].Value)):r.d!=i?(this.setJsonRecords(r.d[0].Value),this.setOlapReport(r.d[1].Value),typeof oclientProxy!="undefined"&&(oclientProxy.currentReport=r.d[1].Value,r.d[2]!=null&&r.d[2]!=i&&r.d[2].Key=="ClientReports"&&(oclientProxy.reports=r.d[2].Value)),r.d[2]==null||r.d[2]==i||r.d[2].Key=="ClientReports"||(this.model.customObject=r.d[2].Value)):(this.setJsonRecords(r.JsonRecords),this.setOlapReport(r.OlapReport),r.customObject!=null&&r.customObject!=null&&(this.model.customObject=r.customObject),typeof oclientProxy!="undefined"&&(typeof oclientProxy.currentReport!="undefined"&&(oclientProxy.currentReport=r.OlapReport),typeof oclientProxy.reports!="undefined"&&r.reports!=i&&r.reports!="undefined"&&(oclientProxy.reports=r.reports)));this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotTreeMap.OperationalMode.ServerMode&&(f=this._currentAction!="initialize"?{action:this._currentAction,element:this.element,customObject:this.model.customObject}:{action:this._currentAction,element:this.element,customObject:this.model.customObject},this._trigger("afterServiceInvoke",f));this.renderTreeMapFromJSON(this.getJsonRecords());this._unWireEvents();this._wireEvents();this._currentAction!="initialize"&&(this.model.currentReport=this.getOlapReport(),this._trigger("drillSuccess",this.element));u=n(this.element).parents(".e-pivotclient").length>0?n(this.element).parents(".e-pivotclient").data("ejPivotClient"):null;t.isNullOrUndefined(u)||(u._isTimeOut=!1);typeof u!="undefined"&&u._waitingPopup!=null?(n("#"+u._id+"_maxView")[0]?n("#"+u._id+"_maxView").ejWaitingPopup({showOnInit:!1}):typeof u._pivotGrid!="undefined"&&(u&&u._pivotGrid._drillAction&&!u._pivotGrid._startDrilldown||u.otreemapObj._currentAction&&!u.otreemapObj._startDrilldown?u._waitingPopup.hide():!u||u._pivotGrid._drillAction!=""||u.otreemapObj._currentAction!=""||u._pivotGrid._startDrilldown||u.otreemapObj._startDrilldown||u._pivotGrid._JSONRecords==null&&u.otreemapObj._JSONRecords!=null?!u.otreemapObj._startDrilldown||u._pivotGrid._startDrilldown||n("#"+u._id+"_maxView")[0]?u.otreemapObj._startDrilldown||u._pivotGrid._startDrilldown||u.otreemapObj._currentAction!=""||u._pivotGrid._drillAction!=""||u._pivotGrid._JSONRecords==null&&u.otreemapObj._JSONRecords!=null||u._waitingPopup.hide():u._waitingPopup.hide():u._waitingPopup.hide()),u.model.displaySettings.mode=="chartonly"&&u._waitingPopup.hide()):this._waitingPopup.hide();typeof u!="undefined"&&(u.otreemapObj._startDrilldown=!1)}catch(e){}t.isNullOrUndefined(r.Exception)||t.Pivot._createErrorDialog(r,"Exception",this)},renderTreeMapFromJSON:function(i){var s,f,y,l,e,o,v,h,u,a,c,p,r,w,b;if(this._treeMapDatasource=[],s="",t.isNullOrUndefined(i)||i.length<=0||i.labelTags.length==0||i.points_Y.length==0){ptreemapProxy._treemapWaitingPopup({show:!1});return}if(t.isNullOrUndefined(i.chartLables)?i.treemapLabels:i.treemapLabels=i.chartLables,i.points_Y.length!=i.treemapLabels.length)for(oclientProxy._onFiltered=!1,f=[],r=0;r<JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y)).length-1;r++)f.push(JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y))[r]);else f=JSON.parse(JSON.stringify(ptreemapProxy.getJsonRecords().points_Y));for(typeof oclientProxy!="undefined"&&oclientProxy.model.enableDeferUpdate&&oclientProxy._ischartTypesChanged&&(oclientProxy._ischartTypesChanged=!1),r=0;r<f.length;r++)for(y=ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length-1],u=0;u<f[r].length;u++)f[r][u].Item1=f[r][u].Item1.replace(f[r][u].Item1,y),f[r][u].Column=ptreemapProxy.getJsonRecords().seriesNames[u].split("~")[0],f[r][u].Measures=ptreemapProxy.getJsonRecords().measureNames,f[r][u].Tag=n.grep(ptreemapProxy.getJsonRecords().labelTags,function(n){return n.split("::")[2]==f[r][u].Item1})[0],this.model.operationalMode==t.PivotTreeMap.OperationalMode.ClientMode&&(f[r][u].drillTag=n.grep(ptreemapProxy.getJsonRecords().drillTags,function(n){return n.split("::")[2]==f[r][u].Item1})[0]),f[r][u][f[r][u].Tag.split("::")[1].split(".")[0].replace("[","").replace("]","")]=f[r][u].Item1,f[r][u].RowItem=f[r][u].Item1,f[r][u].Value=f[r][u].Item2!=""?f[r][u].Item2:"0",f[r][u].Index=u,delete f[r][u].Item1,delete f[r][u].Item2,s+=(s==""?"":";")+f[r][u].Tag.split("::")[1].split(".")[0].replace("[","").replace("]","");if(t.isNullOrUndefined(ptreemapProxy.getJsonRecords().measureNames)||(l=ptreemapProxy.getJsonRecords().measureNames.split("~")),l.length!=2)for(r=0;r<f.length;r++)for(u=0;u<f[r].length;u++)f[r][u].Value=t.isNullOrUndefined(f[r][u].Value)?0:(f[r][u].Value.indexOf(",")||f[r][u].Value.indexOf(".")||f[r][u].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(f[r][u].Value,"c",this.model.locale),this.model.locale):t.globalize.parseFloat(f[r][u].Value),this._treeMapDatasource.push(f[r][u]),(t.isNullOrUndefined(e)||e>=f[r][u].Value)&&(e=f[r][u].Value),(t.isNullOrUndefined(o)||o<=f[r][u].Value)&&(o=f[r][u].Value);else l.length==2&&(v=[],n.each(f,function(i,r){for(var u=0;u<r.length;u++)t.isNullOrUndefined(r[u].Value)||(r[u].Value=t.isNullOrUndefined(r[u].Value)?0:(r[u].Value.indexOf(",")||r[u].Value.indexOf(".")||r[u].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(r[u].Value,"c",ptreemapProxy.model.locale),ptreemapProxy.model.locale):t.globalize.parseFloat(r[u].Value),r[u].Color=r[u].Value,t.isNullOrUndefined(r[u+1])?r[u].Value=0:r[u].Column==r[u+1].Column&&(r[u].Value=t.isNullOrUndefined(r[u+1].Value)?0:(r[u+1].Value.indexOf(",")||r[u+1].Value.indexOf(".")||r[u+1].Value.indexOf(" "))>-1?t.globalize.parseFloat(t.globalize.format(r[u+1].Value,"c",ptreemapProxy.model.locale),ptreemapProxy.model.locale):t.globalize.parseFloat(r[u+1].Value),u=u+1));n.each(r,function(n,i){t.isNullOrUndefined(i)||t.isNullOrUndefined(i.Value)||!t.isNullOrUndefined(i.Color)||r.splice(n,1)});n.each(r,function(n,i){t.isNullOrUndefined(i)||(i.Index=n,v.push(i))})}),this._treeMapDatasource=v,n.each(this._treeMapDatasource,function(n,i){t.isNullOrUndefined(i.Color)||((t.isNullOrUndefined(e)||e>=i.Color)&&(e=i.Color),(t.isNullOrUndefined(o)||o<=i.Color)&&(o=i.Color))}));if(ptreemapProxy.getJsonRecords().treemapLabels.length>0){for(ptreemapProxy._drillText="",h=[],r=0;r<ptreemapProxy.getJsonRecords().treemapLabels.length;r++)if(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length>1)for(u=0;u<ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~").length-1;u++){for(a=0,c=0;c<ptreemapProxy.getJsonRecords().labelTags.length;c++)if(ptreemapProxy.getJsonRecords().labelTags[c].split("::")[2]==ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]&&ptreemapProxy.getJsonRecords().labelTags[c].split("::")[ptreemapProxy.getJsonRecords().labelTags[c].split("::").length-1]==1){a=1;break}h.length==0&&a==1?h.push(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]):h.length>0&&(p=jQuery.inArray(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u],h),p==-1&&a==1&&h.push(ptreemapProxy.getJsonRecords().treemapLabels[r].split("~~")[u]))}for(r=0;r<h.length;r++)ptreemapProxy._drillText+=ptreemapProxy._drillText==""?t.buildTag("a.drillItem",h[r])[0].outerHTML:" > "+t.buildTag("a.drillItem",h[r])[0].outerHTML}this._showDrillText=ptreemapProxy._drillText==""?t.buildTag("span.drillup",s.split(";")[0],{"margin-left":"5px"})[0].outerHTML:t.buildTag("span.drillup",s.split(";")[0],{"margin-left":"5px"})[0].outerHTML+": "+ptreemapProxy._drillText;w=t.buildTag("div#"+this._id+"TreeMapContainer","",{height:typeof oclientProxy!="undefined"?(parseInt(oclientProxy._chartHeight)-50).toString()+"px":this.element.height(),width:typeof oclientProxy!="undefined"?oclientProxy._chartWidth:this.element.width(),"margin-top":"50px"})[0].outerHTML;this.element.html(w);e=e-1;o=o+1;s=s.split(";")[0];n("#"+this._id+"TreeMapContainer").ejTreeMap({dataSource:this._treeMapDatasource,showTooltip:!0,colorValuePath:l.length==2?"Color":"Value",tooltipTemplate:"tooltipTemplate",enableDrillDown:!1,enableGradient:!0,highlightGroupOnSelection:typeof oclientProxy!="undefined"?oclientProxy.model.enableDeferUpdate?!1:!0:!0,treeMapGroupSelected:this._drillTreeMap,refreshed:this._treeMapRenderSuccess,showLegend:!0,legendSettings:{leftLabel:e.toString(),width:150,height:20,title:this._treeMapDatasource[0].Measures,rightLabel:o.toString(),mode:"interactive",dockPosition:"bottom",alignment:"center"},rangeColorMapping:[{from:e,to:o,gradientColors:["#fde6cc","#fab665"]}],weightValuePath:"Value",leafItemSettings:{showLabels:!0,labelPath:"Column",labelVisibilityMode:"hideonexceededlength"},levels:[{groupPath:s,groupGap:2,showHeader:!0,headerHeight:25,labelPosition:"topleft",headerVisibilityMode:"hideonexceededlength"}]});this._treeMap=n("#"+this._id+"TreeMapContainer").data("ejTreeMap");this._treeMap.rowItem=s;n.views.helpers({Measures:function(n){return n.Measures},Row:function(n){return n.Column},Column:function(n){return n.RowItem},Value:function(n){return n.Value},Color:function(n){return t.isNullOrUndefined(n.Color)?n.Value:n.Color}});b={action:this._currentAction,customObject:this.model.customObject,element:this.element};this._trigger("renderSuccess",b);typeof oclientProxy!="undefined"&&n("#"+this._id+"TreeMapContainer").css({width:"100%"});this._treeMap.refresh();ptreemapProxy=this;ptreemapProxy._JSONRecords=i;ptreemapProxy._treemapWaitingPopup({show:!1})},_treemapWaitingPopup:function(i){if(ptreemapProxy=n(this.element).hasClass("e-pivottreemap")?n(this.element).data("ejPivotTreeMap"):n(this.element).parents(".e-pivottreemap").data("ejPivotTreeMap"),n(ptreemapProxy.element).parents(".e-pivotclient").length>0){var r=n(ptreemapProxy.element).parents(".e-pivotclient").data("ejPivotClient");t.isNullOrUndefined(r)||i.show||(r._isTimeOut=!1);n("#"+r._id+"_maxView")[0]?n("#"+r._id+"_maxView").ejWaitingPopup({showOnInit:i.show}):t.isNullOrUndefined(r._waitingPopup)||(i.show?r._waitingPopup.show():r._waitingPopup.hide())}else!t.isNullOrUndefined(ptreemapProxy._waitingPopup)&&i.show?ptreemapProxy._waitingPopup.show():ptreemapProxy._waitingPopup.hide()},_treeMapRenderSuccess:function(){ptreemapProxy._treeMap=n("#"+ptreemapProxy._id+"TreeMapContainer").data("ejTreeMap");t.isNullOrUndefined(ptreemapProxy._treeMap)||(ptreemapProxy._treeMap.model.legendSettings.dockPosition=="top"?ptreemapProxy.element.find("#"+ptreemapProxy._id+"TreeMapContainer").children().hasClass("drillupAction")||n(t.buildTag("div#drillHeader .drillupAction",ptreemapProxy._showDrillText,{height:"25px",width:"99.8%","z-index":"10",position:"absolute","margin-top":"33px"})[0].outerHTML).insertAfter(n("#"+ptreemapProxy._id+"TreeMapContainer").find(".LegendDiv").css("margin-top","-50px").css("font-size","12px")):(n("#"+ptreemapProxy._id+"TreeMapContainer").find(".LegendDiv").css("font-size","12px").insertAfter(n("#"+ptreemapProxy._id+"TreeMapContainer").find("._templateDiv")),n(t.buildTag("div#drillHeader .drillupAction",ptreemapProxy._showDrillText,{height:"25px",width:"99.8%",position:"absolute","margin-top":"-32px"})[0].outerHTML).insertBefore(n("#"+ptreemapProxy._id+"TreeMapContainer").find("#backgroundTile"))))},_reSizeHandler:function(){var n=ptreemapProxy.element.find("#"+ptreemapProxy._id+"TreeMapContainer").width(ptreemapProxy.element.width()).data("ejTreeMap");t.isNullOrUndefined(n)||n.refresh()},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=t.browserInfo().name=="msie"&&t.browserInfo().version<=9?!1:!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,async:a,dataType:c,data:f,success:l,complete:t.proxy(function(t){n.proxy(t,this);var i={action:this._currentAction,customObject:this.model.customObject,element:this.element};this._trigger("renderComplete",i)},this),error:t.proxy(function(n){typeof this._waitingPopup!="undefined"&&this._waitingPopup!=null&&this._waitingPopup.hide();ptreemapProxy._treemapWaitingPopup({show:!1});var t={action:this._currentAction,customObject:this.model.customObject,element:this.element,Message:n};this._trigger("renderFailure",t);this.renderTreeMapFromJSON("")},this)})},doPostBack:function(t,i){var r=n("<form>").attr({action:t,method:"POST",name:"export"}),f=function(t,i){var u=n('<input type="hidden" title="params">').attr({id:t,name:t,value:i}).appendTo(r)};for(var u in i)f(u,i[u]);r.appendTo(document.body).submit().remove()}});t.PivotTreeMap.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotGauge","ej.PivotGauge",{_rootCSS:"e-pivotgauge",element:null,model:null,validTags:["div","span"],defaults:n.extend({},t.datavisualization.CircularGauge.prototype.defaults,{url:"",analysisMode:"pivot",operationalMode:"clientmode",cssClass:"",rowsCount:0,columnsCount:0,enableTooltip:!1,enableAnimation:!1,isResponsive:!1,enableRTL:!1,labelFormatSettings:{numberFormat:"default",decimalPlaces:5,prefixText:"",suffixText:""},showHeaderLabel:!0,scales:t.datavisualization.CircularGauge.prototype._defaultScaleValues(),customObject:{},dataSource:{data:null,sourceInfo:"",providerName:"ssas",isFormattedValues:!1,columns:[],cube:"",catalog:"",rows:[],values:[],filters:[]},locale:"en-US",serviceMethodSettings:{initialize:"InitializeGauge"},renderSuccess:null,renderComplete:null,renderFailure:null,beforeServiceInvoke:null,afterServiceInvoke:null,load:null,beforePivotEnginePopulate:null}),dataTypes:{dataSource:{data:"data",columns:"array",rows:"array",values:"array",filters:"array"},serviceMethodSettings:{initialize:"enum"},customObject:"data",scales:"data"},observables:["rowsCount","columnsCount","showHeaderLabel","locale","radius","frameType"],rowsCount:t.util.valueFunction("rowsCount"),columnsCount:t.util.valueFunction("columnsCount"),showHeaderLabel:t.util.valueFunction("showHeaderLabel"),locale:t.util.valueFunction("locale"),radius:t.util.valueFunction("radius"),frameType:t.util.valueFunction("frameType"),getOlapReport:function(){return this._olapReport},setOlapReport:function(n){this._olapReport=n},getJSONRecords:function(){return this._JSONRecords},setJSONRecords:function(n){this._JSONRecords=JSON.parse(n)},_init:function(){this.model=n.extend(t.datavisualization.CircularGauge.prototype.defaults,this.model);this._scalesInitialize();this._initPrivateProperties();this._load()},_scalesInitialize:function(){this.model.scales!=null?n.each(this.model.scales,t.proxy(function(i,r){var u=t.datavisualization.CircularGauge.prototype._defaultScaleValues();n.extend(u,r);n.extend(r,u)},this)):this.model.scales=[t.datavisualization.CircularGauge.prototype._defaultScaleValues()];this.model.enableRTL&&n.each(this.model.scales,function(n,t){t.direction="counterClockwise"})},_destroy:function(){this._unWireEvents();this.element.empty().removeClass("e-pivotgauge"+this.model.cssClass);this._ogaugeWaitingPopup!=i&&this._ogaugeWaitingPopup._destroy()},_initPrivateProperties:function(){this._id=this.element.attr("id");this._olapReport="";this._JSONRecords=null;this._maximum=[];this._maxValue=0;this._pointerValue_0=0;this._pointerValue_1=0;this._currentLayout="";this._defaultArea=0;this._defaultWidth=0;this._gaugeObj={};this._ogaugeWaitingPopup=null;this._ogaugeProgressBar=null;this._ogaugeProgressText=null;this._notationStr=null;this._ogaugeTimer=null},_load:function(){var r,u;this.element.addClass(this.model.cssClass);n("#"+this._id).ejWaitingPopup({showOnInit:!0});this._ogaugeWaitingPopup=n("#"+this._id).data("ejWaitingPopup");this.model.load!=null&&this._trigger("load",{action:"initialize",model:this.model,element:this.element,customObject:this.model.customObject});r=JSON.stringify(this.model.customObject);this.model.dataSource&&typeof this.model.dataSource.data=="string"?(this._trigger("beforePivotEnginePopulate",{gaugeObject:this}),this.model.operationalMode=t.PivotGauge.OperationalMode.ClientMode,t.olap.base.getJSONData({action:"initialLoad"},this.model.dataSource,this)):this.model.dataSource&&typeof this.model.dataSource.data=="object"&&this.model.dataSource.data!=null?(this._trigger("beforePivotEnginePopulate",{gaugeObject:this}),u=t.PivotAnalysis.pivotEnginePopulate(this.model),this._dataModel="Pivot",this.generateJSON({baseObj:this},u.pivotEngine)):this.model.customObject!=null&&this.model.customObject!=i&&this.model.customObject!={}&&(this.model.operationalMode=t.PivotGauge.OperationalMode.ServerMode,this.model.beforeServiceInvoke!=null&&this._trigger("beforeServiceInvoke",{element:this.element,customObject:this.model.customObject}),this.doAjaxPost("POST",this.model.url+"/"+this.model.serviceMethodSettings.initialize,JSON.stringify({action:"initializeGauge",customObject:r}),this._renderControlSuccess))},_setFirst:!0,_setModel:function(n){for(var t in n)switch(t){case"OlapReport":this.setOlapReport(n[t]);break;case"JsonData":this.setOlapReport(n[t]);break;case"RefreshPivotGauge":this.element.renderControlFromJSON(n[t]);break;case"customObject":this.model.customObject=n[t];break;case"locale":this.locale();break;case"rowsCount":this.rowsCount();break;case"columnsCount":this.columnsCount();break;case"showHeaderLabel":this.showHeaderLabel();break;case"locale":this.locale();break;case"radius":this.radius();break;case"frameType":this.frameType()}this._gaugeObj.obj0&&this._renderControlSuccess({PivotRecords:JSON.stringify(this.getJSONRecords()),OlapReport:this.getOlapReport()})},_wireEvents:function(){this.element.find(".e-circulargauge").mouseenter(t.proxy(function(n){this.model.enableTooltip&&this._showTooltip(n)},this)).mouseout(t.proxy(function(){n(this._tooltip).fadeOut("slow")},this)).mousemove(t.proxy(function(n){this.model.enableTooltip&&(this._showTooltip(n),this._hideTooltip())},this))},_getLocalizedLabels:function(n){return t.PivotGauge.Locale[this.locale()][n]===i?t.PivotGauge.Locale["en-US"][n]:t.PivotGauge.Locale[this.locale()][n]},_unWireEvents:function(){},_showTooltip:function(r){var e,o,f,l;if(t.browserInfo().name!="msie"||!(t.browserInfo().version<=8)){n(this._tooltip).remove();var c=r.target.id.split("_")==""?r.target.parentNode.id.split("_"):r.target.id.split("_"),u=c[c.length-1],s=this._numberFormatConversion(this._JSONRecords[u].GoalValue||0,this.model.labelFormatSettings.numberFormat,this.model.labelFormatSettings.decimalPlaces),h=this._numberFormatConversion(this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value,this.model.labelFormatSettings.numberFormat,this.model.labelFormatSettings.decimalPlaces),a=this._setMaxScaleValue(this._JSONRecords[u].GoalValue||0,this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value,u);if(this.model.labelFormatSettings.numberFormat==t.PivotGauge.NumberFormat.Notation){for(e=this._JSONRecords[u].GoalValue||0,o=this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value;e>=10;)e=parseInt(e)/10;while(o>=10)o=parseInt(o)/10;s=e.toFixed(1)+s;h=o.toFixed(1)+h}f=this._JSONRecords[u].MemberName||this._JSONRecords[u].Measure;(f==i||f=="undefined")&&(f=this._JSONRecords[u].MeasureCaption);l=this.model.enableRTL||this._gaugeObj["obj"+u].model.scales[0].direction=="counterClockwise"?f.split(" - ").reverse().join(" - ")+"<br/>"+s+" :"+this._getLocalizedLabels("RevenueGoal")+"<br/>"+h+" :"+this._getLocalizedLabels("RevenueValue"):f+"<br/>"+this._getLocalizedLabels("RevenueGoal")+": "+s+"<br/>"+this._getLocalizedLabels("RevenueValue")+": "+h;this._tooltip=t.buildTag("div.e-pivotgauge-tooltip",l);n(this._tooltip).appendTo("body");n(this._tooltip).addClass(".e-pivotgauge-active");this._changeTooltipPos(r);this.model.enableRTL||this._gaugeObj["obj"+u].model.scales[0].direction=="counterClockwise"?n(this._tooltip).css("text-align","right"):n(this._tooltip).css("text-align","left")}},_changeTooltipPos:function(t){var i=t.pageX-8,r=t.pageY+8;n(this._tooltip).css({top:r,left:i})},_hideTooltip:function(){window.setTimeout(t.proxy(function(){n(this._tooltip).fadeOut(1500,"linear")},this),3e3)},_renderControlSuccess:function(n){var u,f,c,l,e;try{this.model.analysisMode=n.DataModel=="Olap"?t.PivotGauge.AnalysisMode.Olap:t.PivotGauge.AnalysisMode.Pivot;var r="",o="",s="",a="",h=0;if(n[0]!=i&&n.length>0?(this.setJSONRecords(n[0].Value),this.setOlapReport(n[1].Value),n[2]!=null&&n[2]!=i&&(this.model.customObject=n[2].Value)):n.d!=i&&n.d.length>0?(this.setJSONRecords(n.d[0].Value),this.setOlapReport(n.d[1].Value),n.d[2]!=null&&n.d[2]!=i&&(this.model.customObject=n.d[2].Value)):n.PivotRecords&&n.OlapReport&&(this.setJSONRecords(n.PivotRecords),this.setOlapReport(n.OlapReport),n.customObject!=null&&n.customObject!=i&&(this.model.customObject=n.customObject)),this.model.afterServiceInvoke!=null&&this.model.operationalMode==t.PivotGauge.OperationalMode.ServerMode&&this._trigger("afterServiceInvoke",{element:this.element,customObject:this.model.customObject}),u=this.getJSONRecords(),u!=null&&u.length>0){if(this.rowsCount()<1&&this.columnsCount()<1){for(this._currentLayout="WrapPanel",f=0;f<u.length;f++)o=t.buildTag("img#statusIndicator_"+f+".kpiiconvalue")[0].outerHTML,s=t.buildTag("img#trendIndicator_"+f+".kpiiconvalue")[0].outerHTML,a+=t.buildTag("li",t.buildTag("div#"+this._id+"_"+f,o+s)[0].outerHTML)[0].outerHTML;r=t.buildTag("ul.wrapLayout",a)[0].outerHTML}else{for(this._currentLayout="Table",(this.columnsCount()==i||this.columnsCount()<1)&&this.columnsCount((u.length/this.rowsCount()).toFixed()),(this.rowsCount()==i||this.rowsCount()<1)&&this.rowsCount((u.length/this.columnsCount()).toFixed()),r="<table><tbody>",c=0;c<this.rowsCount();c++){for(r+="<tr>",l=0;l<this.columnsCount();l++)o=t.buildTag("img#statusIndicator_"+h+".kpiiconvalue")[0].outerHTML,s=t.buildTag("img#trendIndicator_"+h+".kpiiconvalue")[0].outerHTML,r+="<td>"+t.buildTag("div#"+this._id+"_"+h,o+s)[0].outerHTML+"<\/td>",h++;r+="<\/tr>"}r+="<\/tbody><\/table>"}this.element.html(r);e=this;setTimeout(function(){e.renderControlFromJSON(u);var n={element:e.element,customObject:e.model.customObject};e._trigger("renderSuccess",n)},0);this._defaultWidth=this.element.find("canvas").width();this._defaultArea=this.element.find("table").height()*this.element.find("table").width()}}catch(v){}t.isNullOrUndefined(n.Exception)||t.Pivot._createErrorDialog(n,"Exception",this)},doAjaxPost:function(r,u,f,e,o,s){var h,c,l,a=!0;f.XMLA==i?(h="application/json; charset=utf-8",c="json",l=n.proxy(e,this)):(h="text/xml",c="xml",f=f.XMLA,l=n.proxy(e,t.olap.base,s),a=!t.isNullOrUndefined(s)&&s.action!="loadFieldElements"?!0:!1);n.ajax({type:r,url:u,contentType:h,async:!1,dataType:c,data:f,success:l,complete:t.proxy(function(){var n={element:this.element,customObject:this.model.customObject};this._trigger("renderComplete",n)},this),error:t.proxy(function(n){this._ogaugeWaitingPopup.hide();var t={element:this.element,Message:n,customObject:this.model.customObject};this._trigger("renderFailure",t)},this)})},_getCalculatedValue:function(n){var t=n.toString(),r=1,f,i,u;for(f=t.indexOf(".")>-1?t.split(".")[0].length:t.length,i=parseInt(t),u=0;u<f;u++)i>this._maxValue&&(i=i/10,r=r*10);return r},_findNearestUpperLimit:function(n,t){var r=n.toString(),i=parseInt(r),u=i%t;return i+(t-u)},_setMaxScaleValue:function(n,t,i){var r;return t>n?(r=this._getCalculatedValue(t),this._maximum[i]=this._findNearestUpperLimit(t/r,10)):(r=this._getCalculatedValue(n),this._maximum[i]=this._findNearestUpperLimit(n/r*4/3,10)),r},_numberFormatConversion:function(n,i,r){function s(n,t){for(var i=n,r=t;;){if(!(i%=r))return r;if(!(r%=i))return i}}var e,n,r,o,u,f;switch(i){case t.PivotGauge.NumberFormat.Default:return parseFloat(n).toFixed(r);case t.PivotGauge.NumberFormat.Text:return n.toString();case t.PivotGauge.NumberFormat.Currency:return t.format(parseInt(n),"c",this.model.locale);case t.PivotGauge.NumberFormat.Percentage:return n*=100,parseFloat(n).toFixed(2)+"%";case t.PivotGauge.NumberFormat.Fraction:for(n||(n=this),e=String(n).split(".")[0],n=parseFloat("."+String(n).split(".")[1]),n=n.toFixed(4),r="1",z=0;z<String(n).length-2;z++)r+="0";for(n=n*r,r=parseInt(r),z=2;z<n+1;z++)n%z==0&&r%z==0&&(n=n/z,r=r/z,z=2);return n.toString().length==2&&r.toString().length==3?(n=Math.round(Math.round(n)/10),r=Math.round(Math.round(r)/10)):n.toString().length==2&&r.toString().length==2&&(n=Math.round(n/10),r=Math.round(r/10)),o=s(n,r),(e==0?"":e+" ")+n/o+"/"+r/o;case t.PivotGauge.NumberFormat.Scientific:return parseFloat(n).toExponential();case t.PivotGauge.NumberFormat.Notation:for(u=0,f=parseInt(n);f>=1;)f=parseInt(f)/10,u++;return this._notationStr=u==1?"da":u==2?"h":u==3?"k":u==4?"k*da":u==5?"k*h":u==6?"M":u==7?"M*da":u==8?"M*h":u==9?"G":u==10?"G*da":u==11?"G*h":u==12?"T":""}},removeImg:function(){this.element.find("img").remove()},renderControlFromJSON:function(r){var b,u,c,ot,l,st,ht,f;for(this._maxValue=99,maxGaugeCount=0,b=this.radius()/22,this._currentLayout=="Table"&&this.rowsCount()*this.columnsCount()<=r.length?maxGaugeCount=this.rowsCount()*this.columnsCount():(this._currentLayout=="WrapPanel"||this.rowsCount()*this.columnsCount()>r.length)&&(maxGaugeCount=r.length),u=0;u<maxGaugeCount;u++){var a=0,v=0,nt=0,h=0,tt=0,y=0,p=0,k=0,e="",o,it=[],rt=[],d=[],ut=[],ft=[],et=[],g=[],s="",w="";if(r[u].MeasureValue!=null&&r[u].MeasureValue!=i?(v=parseFloat(r[u].MeasureValue)||0,a=parseFloat(r[u].GoalValue)||0,e=this.model.labelFormatSettings.prefixText+" "+r[u].MeasureCaption+(n.trim(r[u].MemberName)?" - ":"")+r[u].MemberName+" "+this.model.labelFormatSettings.suffixText):(v=parseFloat(r[u].Value),a=0,e=r[u].Measure,this.model.scales[0].showIndicators=!1),e=this.model.enableRTL||this.model.scales[0].direction=="counterClockwise"?e.split(" - ").reverse().join(" - "):e,y=this._setMaxScaleValue(a,v,u),tt=v,p=a/y,k=tt/y,this._pointerValue_0=h+k,this._pointerValue_1=p+h,nt=h,h=h+k,r[u].StatusGraphic=="Traffic Signals"?r[u].StatusValue==-1?s="kpiredroad":r[u].StatusValue==0?s="kpiallcolor":r[u].StatusValue==1&&(s="kpigreenroad"):r[u].StatusValue==-1?s="kpidiamond":r[u].StatusValue==0?s="kpitriangle":r[u].StatusValue==1&&(s="kpicircle"),o=this.element.find("#statusIndicator_"+[u]).addClass(s),o!=null&&o!=i&&(c=n(o).css("background-image"),ot={height:15,width:15,type:"image",imageUrl:!t.isNullOrUndefined(c)&&c!="none"&&c!=""?c.split("(")[1].split(")")[0].replace('"',"").replace('"',""):"",position:{x:this.radius()-20,y:260},location:{x:this.radius()-20,y:260}}),r[u].TrendGraphic!=null&&r[u].TrendGraphic!=i&&r[u].TrendGraphic!=""&&r[u].TrendGraphic.toLowerCase()=="standard arrow"&&(r[u].TrendValue==-1?w="kpidownarrow":r[u].TrendValue==0?w="kpirightarrow":r[u].TrendValue==1&&(w="kpiuparrow"),o=this.element.find("#trendIndicator_"+[u]).toggleClass(w)),t.isNullOrUndefined(o)||(l=n(o).css("background-image"),st={height:15,width:15,type:"image",imageUrl:!t.isNullOrUndefined(l)&&l!="none"&&l!=""?l.split("(")[1].split(")")[0].replace('"',"").replace('"',""):"",position:{x:this.radius(),y:260},location:{x:this.radius(),y:260}}),!t.isNullOrUndefined(this.model.scales[0])){for(this.frameType()=="fullcircle"?(this.model.scales[0].startAngle=122,this.model.scales[0].sweepAngle=296):this.frameType()=="halfcircle"&&(this.model.scales[0].startAngle=180,this.model.scales[0].sweepAngle=180),this.model.scales[0].indicators=this.model.scales[0].showIndicators?[ot,st]:this.model.scales[0].indicators,t.isNullOrUndefined(this.model.scales[0].pointers[0])||(ht=t.datavisualization.CircularGauge.prototype._defaultScaleValues().pointerCap,this.model.scales[0].pointers[0].value=this._pointerValue_0,this.model.scales[0].pointers[0].pointerCap=ht,this.model.scales[0].pointers[0].pointerCap.radius=b),t.isNullOrUndefined(this.model.scales[0].pointers[1])||(this.model.scales[0].pointers[1].value=this._pointerValue_1,this.model.scales[0].pointers[1].type=this.model.scales[0].pointers[1].type||"marker",this.model.scales[0].pointers[1].markerType=this.model.scales[0].pointers[1].markerType||"diamond",this.model.scales[0].pointers[1].placement=this.model.scales[0].pointers[1].placement||"center"),t.isNullOrUndefined(this.model.scales[0].ranges[0])||(this.model.scales[0].ranges[0].startValue=nt,this.model.scales[0].ranges[0].endValue=p),t.isNullOrUndefined(this.model.scales[0].ranges[1])||(this.model.scales[0].ranges[1].startValue=p,this.model.scales[0].ranges[1].endValue=this._maximum[u]),t.isNullOrUndefined(this.model.scales[0].customLabels[0])||(this.model.scales[0].customLabels[0].value=this.showHeaderLabel()?"X "+y:""),t.isNullOrUndefined(this.model.scales[0].customLabels[1])||(this.model.scales[0].customLabels[1].value=this.showHeaderLabel()?e:""),t.isNullOrUndefined(this.model.scales[0].customLabels[2])||(this.model.scales[0].customLabels[2].value=this.showHeaderLabel()?e:""),f=0;f<this.model.scales[0].ranges.length;f++)it.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().ranges[0],this.model.scales[0].ranges[f]));for(f=0;f<this.model.scales[0].pointers.length;f++)rt.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().pointers[0],this.model.scales[0].pointers[f]));for(f=0;f<this.model.scales[0].labels.length;f++)this.model.labelFormatSettings.numberFormat!=t.PivotGauge.NumberFormat.Notation||t.isNullOrUndefined(t.datavisualization.CircularGauge.prototype._defaultScaleValues().labels[0])||(this._numberFormatConversion(this._JSONRecords[u].MeasureValue||this._JSONRecords[u].Value,this.model.labelFormatSettings.numberFormat,this.model.labelFormatSettings.decimalPlaces),this.model.scales[0].labels[f].unitText=this._notationStr),d.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().labels[0],this.model.scales[0].labels[f]));for(f=0;f<this.model.scales[0].labels.length;f++)d.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().labels[0],this.model.scales[0].labels[f]));for(f=0;f<this.model.scales[0].customLabels.length;f++)ut.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().customLabels[0],this.model.scales[0].customLabels[f]));for(f=0;f<this.model.scales[0].ticks.length;f++)ft.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().ticks[0],this.model.scales[0].ticks[f]));if(this.model.scales[0].indicators)for(f=0;f<this.model.scales[0].indicators.length;f++)et.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues().indicators[0],this.model.scales[0].indicators[f]));for(newScale={pointerCap:{radius:b||this.model.scales[0].pointerCap.radius,borderWidth:this.model.scales[0].pointerCap.borderWidth,interiorGradient:this.model.scales[0].pointerCap.interiorGradient,borderColor:this.model.scales[0].pointerCap.borderColor,backgroundColor:this.model.scales[0].pointerCap.backgroundColor},border:{color:this.model.scales[0].border.color,width:this.model.scales[0].border.width},majorIntervalValue:this.model.scales[0].majorIntervalValue,minorIntervalValue:this.model.scales[0].minorIntervalValue,minimum:this.model.scales[0].minimum,backgroundColor:this.model.scales[0].backgroundColor,direction:this.model.scales[0].direction,showPointers:this.model.scales[0].showPointers,showTicks:this.model.scales[0].showTicks,showLabels:this.model.scales[0].showLabels,showIndicators:this.model.scales[0].showIndicators,showRanges:this.model.scales[0].showRanges,showScaleBar:this.model.scales[0].showScaleBar,startAngle:this.model.scales[0].startAngle,sweepAngle:this.model.scales[0].sweepAngle,radius:this.model.scales[0].radius,size:this.model.scales[0].size,maximum:this.model.scales[0].maximum||this._maximum[u],pointers:rt,ticks:ft,labels:d,ranges:it,customLabels:ut,indicators:et},f=0;f<this.model.scales.length;f++)f==0?g.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues(),newScale)):g.push(n.extend({},t.datavisualization.CircularGauge.prototype._defaultScaleValues(),this.model.scales[f]))}n("#"+this._id+"_"+u).ejCircularGauge({backgroundColor:this.model.backgroundColor,frame:{frameType:this.model.frame.frameType,halfCircleFrameStartAngle:this.model.halfCircleFrameStartAngle,halfCircleFrameEndAngle:this.model.halfCircleFrameEndAngle},radius:this.radius(),width:this.model.width,height:this.model.height,interiorGradient:this.model.interiorGradient,readOnly:this.model.readOnly,enableResize:this.model.isResponsive,enableAnimation:t.isMobile()?!1:this.model.enableAnimation,animationSpeed:this.model.animationSpeed,theme:this.model.theme,isRadialGradient:this.model.isRadialGradient,load:this.model.load,drawTicks:this.model.drawTicks,drawLabels:this.model.drawLabels,drawPointers:this.model.drawPointers,drawRange:this.model.drawRange,drawCustomLabel:this.model.drawCustomLabel,drawIndicators:this.model.drawIndicators,drawPointerCap:this.model.drawPointerCap,renderComplete:this.model.renderComplete,mouseClick:this.model.mouseClick,mouseClickMove:this.model.mouseClickMove,mouseClickUp:this.model.mouseClickUp,scales:g});this._gaugeObj["obj"+u]=n("#"+this._id+"_"+u).data("ejCircularGauge")}this.removeImg();this._wireEvents();t.isNullOrUndefined(this._ogaugeWaitingPopup)||this._ogaugeWaitingPopup.hide()},refresh:function(){if(this._gaugeObj==null||this._gaugeObj==i)for(var t=0;t<this._JSONRecords.length;t++)this._gaugeObj["obj"+t]=n("#"+this._id+"_"+t).data("ejCircularGauge"),this._gaugeObj["obj"+t].refresh();else for(key in this._gaugeObj)this._gaugeObj[key].refresh()},getJSONData:function(n,i){t.olap.base.getJSONData({action:n.action},i,n.activeObject)},generateJSON:function(n,t){var i,r,u;return this.baseObj=n.baseObj,this.pivotEngine=t,this.kpiInfo=[],pivotRecords="",this.baseObj._measureDt&&this.baseObj._measureDt.isKpiExist?(u=this.baseObj._measureDt.axis,t&&(u=="colheader"?(i=t.length,r=i?t[0].length:0):(r=t.length,i=r?t[0].length:0)),this._getKpiHeadersCollection(i,r,u)):this._getSummaryInfo(),pivotRecords=JSON.stringify(this.kpiInfo),this._renderControlSuccess({PivotRecords:pivotRecords,OlapReport:"null"}),this.kpiInfo},_getKpiHeadersCollection:function(t,i,r){var k=this.pivotEngine,o={},v,y,p,w,h,s,l,b,a,u,f,e,c;for(r=="rowheader"?(v=t,y=i,p=i,w=t,h="rowheader",s="colheader"):r=="colheader"&&(v=i,y=t,s="rowheader",h="colheader",p=t,w=i),u=0;u<y;u++){for(f=0;f<v;f++)if(e=null,e=r=="rowheader"?this.pivotEngine[f][u]:this.pivotEngine[u][f],e.CSS==h)o=this._fillKpiInfo_kpiAxis(e,h,u,o);else break;c=0;(c=this._isKpiExist(o))?this._copyKpi(parseInt(c),o):n.isEmptyObject(o)||this.kpiInfo.push(o);o={}}for(l={},b=this.kpiInfo,this.kpiInfo=[],u=0;u<w;u++){for(f=0;f<p;f++)if(e=null,r=="rowheader"?(e=this.pivotEngine[u][f],this.pivotEngine[f][u-1]&&(a=this.pivotEngine[f][u-1])):(e=this.pivotEngine[f][u],this.pivotEngine[f-1]&&(a=this.pivotEngine[f-1][u])),e&&e.CSS==s&&e.Value!="")l=this._fillKpiInfo_kpiAxis(e,s,u,o);else break;c=0;a&&a.CSS==s&&e.CSS.indexOf("summary")==-1&&this._mergeValues(l,b,r,u,f);l={}}},_mergeValues:function(t,i,r,u,f){for(var s={},h=i.length,e={},o=0;o<h;o++)e=i[o],t.MemberRowIndex?e.MemberRowIndex=t.MemberRowIndex:t.MemberColIndex&&(e.MemberColIndex=t.MemberColIndex),e.MemberName?t.MemberName&&(e.MemberName+="-"+t.MemberName):e.MemberName=t.MemberName,r=="rowheader"?(e.ValueIndex>0&&(e.MeasureValue=this.pivotEngine[f][e.ValueIndex].ActualValue,e.ActualMeasureValue=this.pivotEngine[f][e.ValueIndex].Value),e.TrendIndex>0&&(e.TrendValue=this.pivotEngine[f][e.TrendIndex].Value),e.StatusIndex>0&&(e.StatusValue=this.pivotEngine[f][e.StatusIndex].Value),e.GoalIndex>0):r=="colheader"&&(e.ValueIndex>0&&(e.MeasureValue=this.pivotEngine[e.ValueIndex][u].ActualValue,e.ActualMeasureValue=this.pivotEngine[e.ValueIndex][u].Value),e.TrendIndex>0&&(e.TrendValue=this.pivotEngine[e.TrendIndex][u].Value),e.StatusIndex>0&&(e.StatusValue=this.pivotEngine[e.StatusIndex][u].Value),e.GoalIndex>0&&(e.GoalValue=this.pivotEngine[e.GoalIndex][u].Value,e.ActualGoalValue=this.pivotEngine[e.GoalIndex][u].ActualValue)),e.IsValidKpi=!0,s={ActualMeasureValue:0,GoalCaption:"",Kpi_Name:"",MeasureCaption:"",GoalValue:"",ActualGoalValue:0,MeasureValue:"",MemberName:"",StatusValue:-2,TrendValue:-2,TrendGraphic:null,StatusGraphic:null,ValueIndex:"",TrendIndex:-1,GoalIndex:"",StatusIndex:-1,MemberRowIndex:null,MemberColIndex:null,IsValidKpi:!0},this.kpiInfo.push(n.extend(s,e))},_isKpiExist:function(n){for(var t=0;t<this.kpiInfo.length;t++)if(this.kpiInfo[t].MemberName==n.MemberName&&this.kpiInfo[t].Kpi_Name==n.Kpi_Name)return t+"";return!1},_copyKpi:function(t,i){this.kpiInfo[t]=n.extend(this.kpiInfo[t],i)},_fillKpiInfo_kpiAxis:function(n,t,i,r){var u=n.Info.split("::")[0],f;if(!n.kpiInfo&&n.CSS==t&&u.indexOf("[Measures]")>-1&&!n.kpiInfo)r.Kpi_Name=this._getKpiName(u),r.MeasureCaption=n.Value,r.ValueIndex=i;else if(n.CSS==t){n.kpiInfo?r.Kpi_Name=n.kpiInfo.Value:(!r.MemberName&&n.Value?r.MemberName=n.Value:n.Value&&(r.MemberName+=" - "+n.Value),t=="colheader"?r.MemberColIndex=i:r.MemberRowIndex=i);f=n.kpi?n.kpi:"none";switch(f){case"status":r.StatusGraphic=n.kpiInfo.Graphic;r.StatusIndex=i;break;case"goal":r.GoalCaption=n.Value;r.GoalIndex=i;break;case"trend":r.TrendGraphic=n.kpiInfo.Graphic;r.TrendIndex=i}}return r},_getSummaryInfo:function(){for(var e,i={},r=this,f=n.map(this.pivotEngine,function(u){var o=!1,e,f;if(i.Measure="",i.Value="",i.DoubleValue=0,t.browserInfo().name=="msie"&&t.browserInfo().version<=8){for(f=0;f<u.length;f++)(u[f].CSS.indexOf("summary col")>-1||u[f].CSS.indexOf("summary cgtot calc")>-1)&&(o=!0),(o&&u[f].Info.indexOf("[Measures]")>-1||u[f].CSS.indexOf("summary cgtot calc")>-1)&&(i.Measure=u[f].Value);if(!o||r._dataModel=="Pivot"){if(o&&r._dataModel=="Pivot")return i.Value=u[f-1].Value.toString(),i.DoubleValue=u[f-1].Value,n.extend({},i)}else return i.Value=u[f-1].ActualValue,i.DoubleValue=parseFloat(u[f-1].ActualValue),n.extend({},i)}else{for(e in u)(u[parseInt(e)].CSS.indexOf("summary col")>-1||u[parseInt(e)].CSS.indexOf("summary cgtot calc")>-1)&&(o=!0),(o&&u[parseInt(e)].Info.indexOf("[Measures]")>-1||u[parseInt(e)].CSS.indexOf("summary cgtot calc")>-1)&&(i.Measure=u[parseInt(e)].Value);if(!o||r._dataModel=="Pivot"){if(o&&r._dataModel=="Pivot")return i.Value=u[parseInt(e)].Value.toString(),i.DoubleValue=u[parseInt(e)].Value,n.extend({},i)}else return i.Value=u[parseInt(e)].ActualValue,i.DoubleValue=parseFloat(u[parseInt(e)].ActualValue),n.extend({},i)}}),u=0;u<f.length;u++)e={Caption:null,Object:null,CellIndex:-1,Type:-1,Measure:"",ClassName:"",DoubleValue:0,ExpandState:0,HasChildren:!1,Level:-1,RowIndex:3,Range:null,Span:null,Tag:null,UniqueName:"",Value:""},this.kpiInfo.push(n.extend(e,f[u]))},_getKpiName:function(t){var r=this.baseObj._kpi,i="";return(i=n(r).find("row:contains('"+t+"')"),i)?n(i).find("KPI_NAME").text():""}});t.PivotGauge.Locale={};t.PivotGauge.Locale["en-US"]={RevenueGoal:"Revenue Goal",RevenueValue:"Revenue Value"};t.PivotGauge.NumberFormat={Default:"default",Currency:"currency",Percentage:"percentage",Fraction:"fraction",Scientific:"scientific",Text:"text",Notation:"notation"};t.PivotGauge.AxisName={Rows:"rows",Columns:"columns"};t.PivotGauge.OperationalMode={ClientMode:"clientmode",ServerMode:"servermode"};t.PivotGauge.AnalysisMode={Olap:"olap",Pivot:"pivot"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejPivotPager","ej.PivotPager",{_rootCSS:"e-pivotpager",element:null,model:null,_getModel:function(){return this.model},_setModel:function(n){this.model=n},defaults:{targetControlID:"",categoricalCurrentPage:1,seriesCurrentPage:1,seriesPageCount:0,categoricalPageCount:0,locale:"en-US",mode:"both"},_init:function(){n("#"+this.model.targetControlID).hasClass("e-pivotgrid")?(this.targetControlName="PivotGrid",this.targetControl=n("#"+this.model.targetControlID).data("ejPivotGrid"),this.targetControl._pagerObj=this):n("#"+this.model.targetControlID).hasClass("e-pivotchart")?(this.targetControlName="PivotChart",this.targetControl=n("#"+this.model.targetControlID).data("ejPivotChart"),this.targetControl._pagerObj=this):n("#"+this.model.targetControlID).hasClass("e-pivotclient")&&(this.targetControlName="PivotClient",this.targetControl=n("#"+this.model.targetControlID).data("ejPivotClient"),this.targetControl._pagerObj=this);this._load();this._unwireEvents();this._wireEvents()},_destroy:function(){this.element.empty().removeClass("e-pivotpager")},_wireEvents:function(){this._on(this.element,"keydown",".pagerTextBox",this._pagerTextBoxClick);this._on(this.element,"click",".moveNext",this._moveNextPage);this._on(this.element,"click",".moveLast",this._moveLastPage);this._on(this.element,"click",".moveFirst",this._moveFirstPage);this._on(this.element,"blur",".pagerTextBox",this._restorePageNo);this._on(this.element,"click",".movePrevious",this._movePreviousPage)},_unwireEvents:function(){this._off(this.element,"click",".moveNext",this._moveNextPage);this._off(this.element,"blur",".pagerTextBox",this._restorePageNo);this._off(this.element,"click",".moveLast",this._moveLastPage);this._off(this.element,"click",".moveFirst",this._moveFirstPage);this._off(this.element,"click",".movePrevious",this._movePreviousPage);this._off(this.element,"keydown",".pagerTextBox",this._pagerTextBoxClick)},_getLocalizedLabels:function(n){return t.PivotPager.Locale[this.model.locale][n]===i?t.PivotPager.Locale["en-US"][n]:t.PivotPager.Locale[this.model.locale][n]},_load:function(){var i,r,u,f;n(this.element).addClass("pivotPager").attr("targetControlID",this.model.targetControlID);i="";this.targetControl.model.enableRTL&&this.element.addClass("e-rtl");this.model.mode!="series"&&(r=t.buildTag("td.categPagerTd",""),n(r).html(t.buildTag("div.pagerDiv",t.buildTag("span.moveFirst e-icon").attr("role","button").attr("aria-label","move first")[0].outerHTML+t.buildTag("span.movePrevious e-icon").attr("role","button").attr("aria-label","move previous")[0].outerHTML+t.buildTag("span.pagerLabel",this._getLocalizedLabels("CategoricalPage"))[0].outerHTML+t.buildTag("input#"+this._id+"_CategCurrentPage.pagerTextBox")[0].outerHTML+t.buildTag("span.categPageCount")[0].outerHTML+t.buildTag("span.moveNext e-icon").attr("role","button").attr("aria-label","move next")[0].outerHTML+t.buildTag("span.moveLast e-icon").attr("role","button").attr("aria-label","move last")[0].outerHTML)),i=r[0].outerHTML);this.model.mode!="categorical"&&(u=t.buildTag("td.seriesPagerTd",""),n(u).html(t.buildTag("div.pagerDiv",t.buildTag("span.moveFirst e-icon").attr("role","button").attr("aria-label","move first")[0].outerHTML+t.buildTag("span.movePrevious e-icon").attr("role","button").attr("aria-label","move previous")[0].outerHTML+t.buildTag("span.pagerLabel",this._getLocalizedLabels("SeriesPage"))[0].outerHTML+t.buildTag("input#"+this._id+"_SeriesCurrentPage.pagerTextBox")[0].outerHTML+t.buildTag("span.seriesPageCount")[0].outerHTML+t.buildTag("span.moveNext e-icon").attr("role","button").attr("aria-label","move next")[0].outerHTML+t.buildTag("span.moveLast e-icon").attr("role","button").attr("aria-label","move last")[0].outerHTML)),i+=u[0].outerHTML);f=t.buildTag("table",t.buildTag("tbody",t.buildTag("tr",i)))[0];n(this.element).html(f)},initPagerProperties:function(t,i){t.Row<=i.SeriesPageSize?(n("#"+this._id+"_SeriesCurrentPage").attr("disabled",!0),n(".seriesPagerTd").fadeTo(0,.5)):(n("#"+this._id+"_SeriesCurrentPage").attr("disabled",!1),n(".seriesPagerTd").fadeTo(0,1));t.Column<=i.CategorialPageSize?(n("#"+this._id+"_CategCurrentPage").attr("disabled",!0),n(".categPagerTd").fadeTo(0,.5)):(n("#"+this._id+"_CategCurrentPage").attr("disabled",!1),n(".categPagerTd").fadeTo(0,1));this.model.categoricalPageCount=i.CategorialPageSize==0?1:Math.ceil(t.Column/i.CategorialPageSize);this.model.seriesPageCount=i.SeriesPageSize==0?1:Math.ceil(t.Row/i.SeriesPageSize);this.model.categoricalCurrentPage=i.CategorialCurrentPage;this.model.seriesCurrentPage=i.SeriesCurrentPage;this._initPagerControl()},_initPagerControl:function(){this.model.mode!="series"&&(n(this.element.find(".categPageCount")[0]).html("/ "+this.model.categoricalPageCount),n("#"+this._id+"_CategCurrentPage")[0].value=this.model.categoricalCurrentPage,this._setNavigators(this.model.categoricalCurrentPage,this.model.categoricalPageCount,this.element.find(".categPagerTd")[0]));this.model.mode!="categorical"&&(n(this.element.find(".seriesPageCount")[0]).html("/ "+this.model.seriesPageCount),n("#"+this._id+"_SeriesCurrentPage")[0].value=this.model.seriesCurrentPage,this._setNavigators(this.model.seriesCurrentPage,this.model.seriesPageCount,this.element.find(".seriesPagerTd")[0]))},_moveNextPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".movePrevious")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).removeClass("disabled");i.value=parseInt(i.value)+1;i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value,this.targetControlName=="PivotGrid"&&this.targetControl.refreshPagedPivotGrid("categorical",i.value),this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value),i.value==this.model.categoricalPageCount&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).addClass("disabled"))):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("series",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value),i.value==this.model.seriesPageCount&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).addClass("disabled")))}},_movePreviousPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".moveNext")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).removeClass("disabled");i.value=parseInt(i.value)-1;i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("categorical",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value),i.value=="1"&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).addClass("disabled"))):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"&&this.targetControl.refreshPagedPivotChart("series",i.value),this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value),i.value=="1"&&(n(t.target).addClass("disabled"),n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).addClass("disabled")))}},_moveLastPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".movePrevious")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveFirst")[0]).removeClass("disabled");n(t.target).addClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveNext")[0]).addClass("disabled");i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value=this.model.categoricalPageCount,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("categorical",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value)):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value=this.model.seriesPageCount,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("series",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value))}},_moveFirstPage:function(t){if(!n(t.target).hasClass("disabled")){var i=n(n(t.target).parents("td")[0]).find(".pagerTextBox")[0];n(n(n(t.target).parents("td")[0]).find(".moveNext")[0]).removeClass("disabled");n(n(n(t.target).parents("td")[0]).find(".moveLast")[0]).removeClass("disabled");n(t.target).addClass("disabled");n(n(n(t.target).parents("td")[0]).find(".movePrevious")[0]).addClass("disabled");i.id.indexOf("Categ")!=-1?(this.model.categoricalCurrentPage=i.value=1,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("categorical",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("categorical",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("categorical",i.value)):i.id.indexOf("Series")!=-1&&(this.model.seriesCurrentPage=i.value=1,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid("series",i.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart("series",i.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient("series",i.value))}},_pagerTextBoxClick:function(i){if(i.which==13){i.preventDefault();var r=n(i.target).parents("td")[0],u=r.className.indexOf("categ")!=-1?this.model.categoricalPageCount:this.model.seriesPageCount;parseInt(i.target.value)>u||parseInt(i.target.value)<1||i.target.value==""?(this._restorePageNo(i),t.Pivot._createErrorDialog(this._getLocalizedLabels("PageCountErrorMsg"),"Error",this)):(r.className.indexOf("categ")!=-1&&this.model.categoricalCurrentPage!=parseInt(i.target.value)?(this.model.categoricalCurrentPage=i.target.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid(r.className,i.target.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart(r.className,i.target.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient(r.className,i.target.value)):r.className.indexOf("series")!=-1&&this.model.seriesCurrentPage!=parseInt(i.target.value)&&(this.model.seriesCurrentPage=i.target.value,this.targetControlName=="PivotGrid"?this.targetControl.refreshPagedPivotGrid(r.className,i.target.value):this.targetControlName=="PivotChart"?this.targetControl.refreshPagedPivotChart(r.className,i.target.value):this.targetControlName=="PivotClient"&&this.targetControl.refreshPagedPivotClient(r.className,i.target.value)),this._setNavigators(i.target.value,u,r),i.target.blur())}else{if(n.inArray(i.keyCode,[46,8,9,27,13,190])!==-1||i.keyCode==65&&i.ctrlKey===!0||i.keyCode>=35&&i.keyCode<=39)return;(i.shiftKey||i.keyCode<48||i.keyCode>57)&&(i.keyCode<96||i.keyCode>105)&&i.preventDefault()}},_restorePageNo:function(n){n.target.value=n.target.id.indexOf("Categ")!=-1?this.model.categoricalCurrentPage:this.model.seriesCurrentPage},_setNavigators:function(t,i,r){t==i&&(n(n(r).find(".moveNext")[0]).addClass("disabled"),n(n(r).find(".moveLast")[0]).addClass("disabled"));t=="1"&&(n(n(r).find(".movePrevious")[0]).addClass("disabled"),n(n(r).find(".moveFirst")[0]).addClass("disabled"));t>1&&(n(n(r).find(".movePrevious")[0]).removeClass("disabled"),n(n(r).find(".moveFirst")[0]).removeClass("disabled"));t<i&&(n(n(r).find(".moveNext")[0]).removeClass("disabled"),n(n(r).find(".moveLast")[0]).removeClass("disabled"))}});t.PivotPager.Locale={};t.PivotPager.Locale["en-US"]={SeriesPage:"Series Page",CategoricalPage:"Categorical Page",Error:"Error",OK:"OK",Close:"Close",PageCountErrorMsg:"Enter valid page number"};t.PivotPager.Mode={Both:"both",Categorical:"categorical",Series:"series"}}(jQuery,Syncfusion);